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

Turns out that angles are more clearly expressed in hex after all. And
if we use negative values for everything greater than 80h, we still
remove those from the PI calculation.

*Really* not sure about using that delta union in the TH04 one though.
Might be saner to just hide the complexity of the technically two
separate types after all… Let's see.

Part of P0075, funded by Myles and -Tom-.
This commit is contained in:
nmlgc 2020-02-15 21:13:31 +01:00
parent 3292af086b
commit f21269f373
5 changed files with 2530 additions and 2596 deletions

View File

@ -114,3 +114,31 @@ int pascal near bullet_patnum_for_angle(unsigned char angle);
extern bullet_t bullets[BULLET_COUNT];
#define pellets (&bullets[0])
#define bullets16 (&bullets[PELLET_COUNT])
struct bullet_template_t {
uint8_t spawn_type;
unsigned char patnum; // TH05: 0 = pellet
SPPoint origin;
#if GAME == 5
bullet_pattern_t pattern;
bullet_special_motion_t special_motion;
unsigned char spread;
unsigned char spread_angle_delta;
unsigned char stack;
SubpixelLength8 stack_speed_delta;
unsigned char angle;
SubpixelLength8 speed;
#else
SPPoint velocity;
bullet_pattern_t pattern;
unsigned char angle;
SubpixelLength8 speed;
unsigned char count;
bullet_template_delta_t delta;
uint8_t unused_1;
bullet_special_motion_t special_motion;
uint8_t unused_2;
#endif
};
extern bullet_template_t bullet_template;

View File

@ -1,5 +1,12 @@
#pragma option -b-
typedef union {
unsigned char spread_angle;
// In subpixels, obviously, but pre-C++11 doesn't let us use any of the
// Subpixel classes with their custom assignment operators in a union...
unsigned char stack_speed;
} bullet_template_delta_t;
// All _AIMED patterns define the 0° [angle] as the current player position,
// relative to the bullet origin.
typedef enum {

View File

@ -1,5 +1,34 @@
if GAME eq 4
bullet_template_delta_t union
spread_angle db ?
stack_speed db ?
bullet_template_delta_t ends
endif
bullet_template_t struc
spawn_type db ?
patnum db ?
BT_origin Point <?>
if GAME eq 5
pattern db ?
BT_special_motion db ?
spread db ?
spread_angle_delta db ?
BT_stack db ?
stack_speed_delta db ?
BT_angle db ?
speed db ?
else
BT_velocity Point <?>
pattern db ?
BT_angle db ?
speed db ?
count db ?
BT_delta bullet_template_delta_t <?>
db ?
BT_special_motion db ?
db ?
endif
bullet_template_t ends
public _bullet_template

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff