ReC98/th01/main/player/shots.hpp
nmlgc c11a95666b [Decompilation] [th01] Pellets: Shot/Orb/deflecting player collision
First off: 👏 Just 👏 pass 👏 a 👏 reference 👏 to 👏 the 👏
currently 👏 iterated 👏 pellet 👏 if 👏 you 👏 need 👏 to 👏
modify 👏 it 👏
Second: Don't we hit-test pellets vs. shots already, in the CShots
class? So what is this garbage…?!

Completes P0101, funded by Yanga and Ember2528.
2020-07-12 16:21:17 +02:00

41 lines
1.1 KiB
C++

#include "th01/sprites/pellet.h"
#include "th01/math/overlap.hpp"
static const int SHOT_COUNT = 8;
static const int SHOT_W = 16;
static const int SHOT_H = 16;
struct CShots {
int left[SHOT_COUNT];
int top[SHOT_COUNT];
int unknown[SHOT_COUNT];
// A shot slot can be considered "alive" if either of these are nonzero.
unsigned char moving[SHOT_COUNT];
unsigned char decay_frame[SHOT_COUNT];
void add(int new_left, int new_top);
void unput_and_reset_all(void);
void unput_update_render(void);
bool16 is_moving(int i) {
return moving[i];
}
// Processes any collision between *the given* shot and the Orb, placed at
// the given position, and returns true if they did collide.
bool16 hittest_orb(int i, int orb_left, int orb_top);
// Processes any collision between *any* shot and a pellet, placed at the
// given position, and returns true if they did collide.
bool16 hittest_pellet(int pellet_left, int pellet_top);
// Processes any collision between *any* shot and a boss with the given
// hitbox, and returns true if they did collide.
bool16 hittest_boss(
int hitbox_left, int hitbox_top, int hitbox_w, int hitbox_h
);
};
extern CShots Shots;