diff --git a/th05/main/bullet/b4ball.hpp b/th05/main/bullet/b4ball.hpp index 5559687b..c4542254 100644 --- a/th05/main/bullet/b4ball.hpp +++ b/th05/main/bullet/b4ball.hpp @@ -7,7 +7,7 @@ typedef struct { unsigned char angle; PlayfieldMotion pos; unsigned int age; - int revenge; + bool16 revenge; int patnum_tiny_base; int hp; int damaged_this_frame; @@ -15,10 +15,28 @@ typedef struct { int8_t padding; } b4ball_t; -#define b4ball_template (reinterpret_cast(custom_entities[0])) +struct b4ball_template_t { + /* -------------------- */ int8_t _unused_1; + unsigned char angle; + PlayfieldPoint origin; + /* -------------------- */ int16_t _unused_2[5]; + bool16 revenge; + int patnum_tiny_base; + int hp; + /* -------------------- */ int16_t _unused_3; + SubpixelLength8 speed; +}; + +#define b4ball_template ( \ + reinterpret_cast(custom_entities[0]) \ +) #define b4balls (reinterpret_cast(&custom_entities[1])) void pascal near b4balls_reset(void); + +// Spawns a new ball bullet according to the [b4ball_template]. Reads all +// non-unused fields of the b4ball_template_t structure. void pascal near b4balls_add(void); + void pascal near b4balls_update(void); void pascal near b4balls_render(void); diff --git a/th05/main/bullet/b6ball.cpp b/th05/main/bullet/b6ball.cpp index 7f0f82bd..97e5afdf 100644 --- a/th05/main/bullet/b6ball.cpp +++ b/th05/main/bullet/b6ball.cpp @@ -28,7 +28,7 @@ void near b6balls_add(void) continue; } p->flag = B6BF_CLOUD; - p->pos.cur = b6ball_template.pos.cur; + p->pos.cur = b6ball_template.origin; vector2_near(p->pos.velocity, b6ball_template.angle, speed); p->patnum_tiny = b6ball_template.patnum_tiny; p->cloud_radius.set(48.0f); diff --git a/th05/main/bullet/b6ball.hpp b/th05/main/bullet/b6ball.hpp index 23b76d4a..9e4e568b 100644 --- a/th05/main/bullet/b6ball.hpp +++ b/th05/main/bullet/b6ball.hpp @@ -16,21 +16,32 @@ enum b6ball_flag_t { typedef struct { b6ball_flag_t flag; - unsigned char angle; // unused + int8_t unused_1; PlayfieldMotion pos; unsigned int age; // unused and broken, because it's never reset Subpixel cloud_radius; int patnum_tiny; int decay_frames; - int16_t unused; - SubpixelLength8 speed; // unused - int8_t padding; + int8_t unused_2[4]; } b6ball_t; -#define b6ball_template (reinterpret_cast(custom_entities[0])) +struct b6ball_template_t { + /* -------------------- */ int8_t _unused_1; + unsigned char angle; + PlayfieldPoint origin; + /* -------------------- */ int16_t _unused_2[6]; + int patnum_tiny; + /* -------------------- */ int16_t _unused_3[2]; + SubpixelLength8 speed; +}; + +#define b6ball_template ( \ + reinterpret_cast(custom_entities[0]) \ +) #define b6balls (reinterpret_cast(&custom_entities[1])) -// Spawns a new ball bullet according to the [b6ball_template]. +// Spawns a new ball bullet according to the [b6ball_template]. Reads all +// non-unused fields of the b6ball_template_t structure. void near b6balls_add(); void near b6balls_update(); diff --git a/th05/main/bullet/cheeto.hpp b/th05/main/bullet/cheeto.hpp index b68bdae2..4cfe6106 100644 --- a/th05/main/bullet/cheeto.hpp +++ b/th05/main/bullet/cheeto.hpp @@ -13,15 +13,13 @@ enum cheeto_flag_t { // Defines the [col] instead of the (automatically calculated) [sprite]. typedef struct { - cheeto_flag_t flag; + /* -------------------- */ int8_t _unused_1; unsigned char angle; - PlayfieldMotion pos; - unsigned int age; // unused and broken, because it's never reset - int16_t unused_2; + PlayfieldPoint origin; + /* -------------------- */ int16_t _unused_2[6]; int col; - int32_t unused_3; + /* -------------------- */ int32_t _unused_3; SubpixelLength8 speed; - int8_t padding; } cheeto_template_t; typedef struct { @@ -58,6 +56,9 @@ extern cheeto_trail_t cheeto_trails[CHEETO_COUNT + 1]; // coordinate! [top] must therefore be between 0 and (RES_Y - 1). void __fastcall near cheeto_put(uscreen_x_t left, uscreen_y_t top, int sprite); -void near cheetos_add(); +// Spawns a new cheeto bullet according to the [cheeto_template]. Reads all +// non-unused fields of the cheeto_template_t structure. +void near cheetos_add(void); + void near cheetos_update(); void pascal near cheetos_render(); diff --git a/th05/main/bullet/cheeto_u.cpp b/th05/main/bullet/cheeto_u.cpp index aa097d04..2fa1f1d9 100644 --- a/th05/main/bullet/cheeto_u.cpp +++ b/th05/main/bullet/cheeto_u.cpp @@ -43,10 +43,10 @@ void near cheetos_add(void) vector2_near(head_p->pos.velocity, head_p->angle, head_p->speed); trail_p->col = cheeto_template.col; head_p->sprite = bullet_patnum_for_angle(0, head_p->angle); - head_p->pos.cur = cheeto_template.pos.cur; + head_p->pos.cur = cheeto_template.origin; for(node_i = 0; node_i < CHEETO_TRAIL_NODE_COUNT; node_i++) { - trail_p->node_pos[node_i] = cheeto_template.pos.cur; + trail_p->node_pos[node_i] = cheeto_template.origin; trail_p->node_sprite[node_i] = head_p->sprite; } return; diff --git a/th05/main/bullet/sword.hpp b/th05/main/bullet/sword.hpp index 79cb226c..a0f1a377 100644 --- a/th05/main/bullet/sword.hpp +++ b/th05/main/bullet/sword.hpp @@ -15,9 +15,26 @@ typedef struct { int8_t padding; } sword_t; -#define sword_template (reinterpret_cast(custom_entities[0])) +struct sword_template_t { + /* -------------------- */ int8_t unused_1; + unsigned char angle; + PlayfieldPoint origin; + /* -------------------- */ int16_t unused_2[4]; + unsigned int twirl_time; + /* -------------------- */ int16_t unused_3; + int patnum_tiny; + /* -------------------- */ int16_t unused_4[2]; + SubpixelLength8 speed; +}; + +#define sword_template (\ + reinterpret_cast(custom_entities[0]) \ +) #define swords (reinterpret_cast(&custom_entities[1])) +// Spawns a new sword according to the [sword_template]. Reads all non-unused +// fields of the sword_template_t structure. void pascal near swords_add(void); + void pascal near swords_update(void); void pascal near swords_render(void); diff --git a/th05/main/custom[bss].asm b/th05/main/custom[bss].asm index b12ea5f2..8f7fa711 100644 --- a/th05/main/custom[bss].asm +++ b/th05/main/custom[bss].asm @@ -53,7 +53,7 @@ cheeto_template_t struc db ? CBTMPL_angle db ? pos motion_t - CBTMPL_age dw ? + dw ? dw ? CBTMPL_col dw ? dd ? @@ -133,10 +133,10 @@ b6ball_t struc flag db ? B6B_angle db ? pos motion_t - B6B_age dw ? + dw ? cloud_radius dw ? B6B_patnum_tiny dw ? - B6B_decay_frames dw ? + dw ? dw ? B6B_speed db ? db ?