[Reverse-engineering] [th04/th05] Bullet structure

And since everyone always cares about caps:
• TH04: 240 for the white 8×8 pellets, 220 for 16×16 sprites
• TH05: 180 for the white 8×8 pallets, 240 for 16×16 sprites

Completes P0072, funded by [Anonymous] and -Tom-.
This commit is contained in:
nmlgc 2020-02-03 20:32:56 +01:00
parent 1568121f05
commit cea3ea6dc7
5 changed files with 784 additions and 6706 deletions

View File

@ -43,5 +43,6 @@ template <class T> struct SPPointBase {
typedef SubpixelBase<subpixel_t> Subpixel;
typedef SPPointBase<Subpixel> SPPoint;
// 8-bit (Q4.4)
typedef SubpixelBase<unsigned char> SubpixelLength8;
typedef SubpixelBase<char> Subpixel8;
typedef SPPointBase<Subpixel8> SPPoint8;

96
th04/bullet/bullet.hpp Normal file
View File

@ -0,0 +1,96 @@
/// States and modes
/// ----------------
#pragma option -b-
#define BSS_CLOUD_FRAMES 16
#define BMS_DECAY_FRAMES 16
#define BMS_SLOWDOWN_BASE_SPEED 4.5f
#define BMS_SLOWDOWN_FRAMES 32
enum bullet_spawn_state_t {
/// Hitbox is active
/// ----------------
BSS_GRAZEABLE = 0,
BSS_GRAZED = 1,
BSS_ACTIVE = 2,
/// ----------------
/// Delay "cloud", no hitbox
/// ------------------------
BSS_CLOUD_BACKWARDS = 3,
BSS_CLOUD_FORWARDS = 4,
BSS_CLOUD_END = (BSS_CLOUD_FORWARDS + BSS_CLOUD_FRAMES),
/// ------------------------
};
enum bullet_move_state_t {
/// Hitbox is active
/// ----------------
// Slows down from BMS_SLOWDOWN_BASE_SPEED to [final_speed]
BMS_SLOWDOWN = 0,
// Special processing according to [special_motion]
BMS_SPECIAL = 1,
// No special processing
BMS_NORMAL = 2,
/// ----------------
/// Decay, no hitbox
/// ----------------
BMS_DECAY = 4,
BMS_DECAY_END = (BMS_DECAY + BMS_DECAY_FRAMES),
/// ----------------
};
enum bullet_special_motion_t {
};
#pragma option -b
/// ----------------
struct bullet_t {
char flag;
char age;
motion_t pos;
unsigned char from_pattern; // unused
int8_t unused;
SubpixelLength8 speed_cur;
unsigned char angle;
bullet_spawn_state_t spawn_state;
bullet_move_state_t move_state;
bullet_special_motion_t special_motion;
unsigned char speed_final;
union {
unsigned char slowdown_time; // with BMS_SLOWDOWN
unsigned char turn_count; // with BMS_SPECIAL
} ax;
union {
unsigned char slowdown_speed_delta; // with BMS_SLOWDOWN
unsigned char turn_angle; // with BMS_SPECIAL
} dx;
int patnum;
#if GAME == 5
// Coordinates for BSM_STRAIGHT
SPPoint origin;
int distance;
#endif
};
#define PELLET_W 8
#define PELLET_H 8
#define BULLET16_W 16
#define BULLET16_H 16
#if GAME == 5
# define PELLET_COUNT 180
# define BULLET16_COUNT 220
#else
# define PELLET_COUNT 240
# define BULLET16_COUNT 200
#endif
#define BULLET_COUNT (PELLET_COUNT + BULLET16_COUNT)
extern bullet_t bullets[BULLET_COUNT];
#define pellets (&bullets[0])
#define bullets16 (&bullets[PELLET_COUNT])

View File

@ -0,0 +1,66 @@
BSS_CLOUD_FRAMES = 16
BMS_DECAY_FRAMES = 16
BMS_SLOWDOWN_BASE_SPEED = (4 shl 4) + 8
BMS_SLOWDOWN_FRAMES = 32
BSS_GRAZEABLE = 0
BSS_GRAZED = 1
BSS_ACTIVE = 2
BSS_CLOUD_BACKWARDS = 3
BSS_CLOUD_FORWARDS = 4
BSS_CLOUD_END = (BSS_CLOUD_FORWARDS + BSS_CLOUD_FRAMES)
BMS_SLOWDOWN = 0
BMS_SPECIAL = 1
BMS_NORMAL = 2
BMS_DECAY = 4
BMS_DECAY_END = (BMS_DECAY + BMS_DECAY_FRAMES)
bullet_t struc
flag db ?
age db ?
pos motion_t <?>
from_pattern db ?
db ?
speed_cur db ?
BULLET_angle db ?
spawn_state db ?
move_state db ?
special_motion db ?
speed_final db ?
slowdown_time label byte
turn_count label byte
db ?
slowdown_speed_delta label byte
turn_angle label byte
db ?
BULLET_patnum dw ?
if GAME eq 5
BULLET_origin Point <?>
distance dw ?
endif
bullet_t ends
PELLET_W = 8
PELLET_H = 8
BULLET16_W = 16
BULLET16_H = 16
if GAME eq 5
PELLET_COUNT = 180
BULLET16_COUNT = 220
else
PELLET_COUNT = 240
BULLET16_COUNT = 200
endif
BULLET_COUNT = (PELLET_COUNT + BULLET16_COUNT)
public _bullets, _pellets, _bullets16
_bullets label bullet_t
_pellets bullet_t PELLET_COUNT dup(<?>)
_bullets16 bullet_t BULLET16_COUNT dup(<?>)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff