[Maintenance] [th04/th05] Declare boss explosions in C land

Part of P0086, funded by [Anonymous] and Blue Bolt.
This commit is contained in:
nmlgc 2020-04-08 19:59:53 +02:00
parent cb8da961c9
commit 4bab289d8a
13 changed files with 90 additions and 48 deletions

View File

@ -1 +1,40 @@
/// Explosions
/// ----------
#define EXPLOSION_SMALL_COUNT 2
struct explosion_t {
char flag;
unsigned char age;
SPPoint center;
SPPoint radius_cur;
SPPoint radius_delta;
int8_t unused;
// Offset to add to the angle for the Y coordinate, turning the circle
// into a slanted ellipse. See https://www.desmos.com/calculator/faeefi6w1u
// for a plot of the effect.
unsigned char angle_offset;
};
enum explode_type_t {
ET_NONE = -1,
ET_NW_SE = 1,
ET_SW_NE = 2,
ET_HORIZONTAL = 3,
ET_VERTICAL = 4,
};
extern explosion_t explosions_small[EXPLOSION_SMALL_COUNT];
extern explosion_t explosions_big;
void pascal near boss_explode_small(unsigned int type);
#if GAME == 4
void pascal near boss_explode_big(unsigned int type);
#endif
void pascal near explosions_small_update_and_render(void);
void pascal near explosions_big_update_and_render(void);
void pascal explosions_small_reset(void);
/// ----------
void near boss_items_drop();

View File

@ -1,4 +1,3 @@
; void pascal near boss_explode_big(unsigned int type);
public BOSS_EXPLODE_BIG
boss_explode_big proc near

View File

@ -50,7 +50,6 @@ EXPLOSION_TYPED macro
dw offset @@type4
endm
; void pascal near boss_explode_small(unsigned int type);
public BOSS_EXPLODE_SMALL
boss_explode_small proc near

View File

@ -1,14 +1,10 @@
explosion_t struc
flag db ?
age db ?
; Stored in 1/16th-pixel playfield coordinates.
center Point <?>
EXPLOSION_radius_cur Point <?>
EXPLOSION_radius_delta Point <?>
db ?
; Offset to add to the angle for the Y coordinate, turning the circle into
; a slanted ellipse. See https://www.desmos.com/calculator/faeefi6w1u for
; a plot of the effect.
angle_offset db ?
explosion_t ends
@ -19,6 +15,13 @@ EXPLOSION_SMALL_H = 16
EXPLOSION_SMALL_SPRITES = 64
EXPLOSION_BIG_SPRITES = 16
; explode_type_t
ET_NONE = -1
ET_NW_SE = 1
ET_SW_NE = 2
ET_HORIZONTAL = 3
ET_VERTICAL = 4
public _explosions_small
public _explosions_big
_explosions_small explosion_t EXPLOSION_SMALL_COUNT dup (<?>)

View File

@ -1,4 +1,3 @@
; void pascal near explosions_big_update_and_render(void);
public EXPLOSIONS_BIG_UPDATE_AND_RENDER
explosions_big_update_and_render proc near

View File

@ -1,4 +1,3 @@
; void pascal explosions_small_reset(void);
public EXPLOSIONS_SMALL_RESET
explosions_small_reset proc far
push bp

View File

@ -1,4 +1,3 @@
; void pascal near explosions_small_update_and_render(void);
public EXPLOSIONS_SMALL_UPDATE_AND_RENDER
explosions_small_update_and_render proc near

View File

@ -18775,7 +18775,7 @@ loc_167AF:
mov _bullet_clear_time, 20
loc_167BB:
call boss_explode_small pascal, 1
call boss_explode_small pascal, ET_NW_SE
inc _boss_phase
mov _boss_phase_frame, 0
mov _boss_mode_change, 0
@ -18886,7 +18886,7 @@ loc_168A8:
call sub_1E67C
cmp _boss_phase_frame, 288
jl loc_169B8
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
cmp _bullet_clear_time, 20
jnb short loc_168C9
mov _bullet_clear_time, 20
@ -18928,7 +18928,7 @@ loc_1691A:
jl loc_169B8
loc_1692E:
call boss_explode_small pascal, 1
call boss_explode_small pascal, ET_NW_SE
inc _boss_phase
cmp _boss_phase_frame, 1000
jge short loc_16946
@ -18948,7 +18948,7 @@ loc_16953:
inc _boss_phase_frame
cmp _boss_phase_frame, 16
jnz short loc_16963
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
loc_16963:
cmp _boss_phase_frame, 32
@ -21085,7 +21085,7 @@ loc_17B98:
mov _boss_mode_change, 1
loc_17BA4:
call boss_explode_small pascal, 3
call boss_explode_small pascal, ET_HORIZONTAL
inc _boss_phase
mov _boss_phase_frame, 0
@ -21152,7 +21152,7 @@ loc_17C44:
inc _boss_phase_frame
cmp _boss_phase_frame, 16
jnz short loc_17C54
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
loc_17C54:
cmp _boss_phase_frame, 32
@ -22690,7 +22690,7 @@ loc_188BD:
call sub_18556
cmp _boss_phase_frame, 0
jnz loc_189A1
call boss_explode_small pascal, 3
call boss_explode_small pascal, ET_HORIZONTAL
inc _boss_phase
mov _boss_phase_frame, 0
mov _boss_sprite, 129
@ -22719,7 +22719,7 @@ loc_18904:
jl loc_189A1
loc_18915:
call boss_explode_small pascal, 1
call boss_explode_small pascal, ET_NW_SE
inc _boss_phase
cmp _boss_phase_frame, 4000
jge short loc_1892D
@ -22742,7 +22742,7 @@ loc_1894A:
inc _boss_phase_frame
cmp _boss_phase_frame, 16
jnz short loc_1895A
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
loc_1895A:
cmp _boss_phase_frame, 32
@ -24077,7 +24077,7 @@ loc_194C1:
loc_194D2:
inc _boss_phase
call sparks_add_circle pascal, _boss_pos.cur.x, _boss_pos.cur.y, large (((8 shl 4) shl 16) or 48)
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
cmp _boss_phase_frame, 600
jge short loc_194FB
mov _boss_mode_change, 1
@ -24123,7 +24123,7 @@ loc_19548:
inc _boss_phase_frame
cmp _boss_phase_frame, 16
jnz short loc_1955E
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
loc_1955E:
cmp _boss_phase_frame, 32
@ -25027,7 +25027,7 @@ loc_19DBE:
mov _boss_mode_change, 0
loc_19DC3:
call boss_explode_small pascal, 3
call boss_explode_small pascal, ET_HORIZONTAL
inc _boss_phase
mov _boss_phase_frame, 0
mov _boss_mode, 0
@ -25065,7 +25065,7 @@ loc_19E27:
inc _boss_phase_frame
cmp _boss_phase_frame, 16
jnz short loc_19E3D
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
loc_19E3D:
cmp _boss_phase_frame, 32
@ -28131,7 +28131,7 @@ loc_1B652:
jl loc_1B8EA
cmp _boss_pos.cur.y, (80 shl 4)
jnz loc_1B8EA
call boss_explode_small pascal, 2
call boss_explode_small pascal, ET_SW_NE
cmp _bullet_clear_time, 20
jnb short loc_1B681
mov _bullet_clear_time, 20
@ -28356,7 +28356,7 @@ loc_1B84B:
jl loc_1B8EA
loc_1B85F:
call boss_explode_small pascal, 1
call boss_explode_small pascal, ET_NW_SE
inc _boss_phase
cmp _boss_phase_frame, 2500
jge short loc_1B877
@ -28379,7 +28379,7 @@ loc_1B894:
inc _boss_phase_frame
cmp _boss_phase_frame, 16
jnz short loc_1B8A4
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
loc_1B8A4:
cmp _boss_phase_frame, 32
@ -29852,7 +29852,7 @@ loc_1C585:
loc_1C591:
inc _boss_phase
call sparks_add_circle pascal, _boss_pos.cur.x, _boss_pos.cur.y, large (((8 shl 4) shl 16) or 48)
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
mov _boss_phase_frame, 0
loc_1C5B1:
@ -29901,7 +29901,7 @@ loc_1C61F:
inc _boss_phase_frame
cmp _boss_phase_frame, 16
jnz short loc_1C62F
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
loc_1C62F:
cmp _boss_phase_frame, 32
@ -35445,7 +35445,7 @@ loc_1F802:
jl loc_1F8A5
loc_1F822:
call boss_explode_small pascal, 3
call boss_explode_small pascal, ET_HORIZONTAL
inc _boss_phase
mov _boss_mode_change, 0
cmp _boss_phase_frame, 1000
@ -35461,7 +35461,7 @@ loc_1F845:
inc _boss_phase_frame
cmp _boss_phase_frame, 16
jnz short loc_1F855
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
loc_1F855:
cmp _boss_phase_frame, 32
@ -37082,7 +37082,7 @@ loc_20619:
jl loc_206B6
loc_2062A:
call boss_explode_small pascal, 1
call boss_explode_small pascal, ET_NW_SE
inc _boss_phase
cmp _boss_phase_frame, 5000
jge short loc_20642
@ -37105,7 +37105,7 @@ loc_2065F:
inc _boss_phase_frame
cmp _boss_phase_frame, 16
jnz short loc_2066F
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
loc_2066F:
cmp _boss_phase_frame, 32

View File

@ -1,4 +1,3 @@
; void pascal near boss2_explode_big(void);
public BOSS2_EXPLODE_BIG
boss2_explode_big proc near

View File

@ -1,4 +1,3 @@
; void pascal near boss2_explode_small(unsigned int type);
public BOSS2_EXPLODE_SMALL
boss2_explode_small proc near

10
th05/main/boss/boss.hpp Normal file
View File

@ -0,0 +1,10 @@
#include "th04/main/boss/boss.hpp"
/// Explosions
/// ----------
// No longer using a type parameter in TH05.
void pascal near boss_explode_big(void);
void pascal near boss2_explode_small(unsigned int type);
void pascal near boss2_explode_big(void);
/// ----------

View File

@ -1,6 +1,3 @@
; No longer using a type parameter in TH05.
; void pascal near boss_explode_big(void);
public BOSS_EXPLODE_BIG
boss_explode_big proc near
push bp

View File

@ -20717,7 +20717,7 @@ loc_1A1F8:
mov _bullet_clear_time, 20
loc_1A208:
call boss_explode_small pascal, 1
call boss_explode_small pascal, ET_NW_SE
inc _boss_phase
mov _boss_phase_frame, 0
mov _boss_mode_change, 0
@ -20771,7 +20771,7 @@ loc_1A284:
jl loc_1A3B2
push 5
call sub_17416
call boss_explode_small pascal, 1
call boss_explode_small pascal, ET_NW_SE
cmp _bullet_clear_time, 20
jnb short loc_1A2D7
mov _bullet_clear_time, 20
@ -22017,7 +22017,7 @@ loc_1ACF1:
loc_1AD0D:
call snd_se_play pascal, 15
call boss_explode_small pascal, 1
call boss_explode_small pascal, ET_NW_SE
call boss2_explode_small pascal, 2
jmp short loc_1AD29
; ---------------------------------------------------------------------------
@ -22147,7 +22147,7 @@ loc_1AE4F:
jnz short loc_1AE6C
cmp _boss2_mode_change, 0
jnz short loc_1AE64
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
jmp short loc_1AE69
; ---------------------------------------------------------------------------
@ -23458,7 +23458,7 @@ loc_1BAAD:
push _boss_pos.cur.x
push _boss_pos.cur.y
call circles_add_growing
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
mov fp_2CE42, offset sub_1B557
mov _boss_sprite_left, 206
mov _boss_sprite_right, 205
@ -23664,7 +23664,7 @@ loc_1BCDB:
mov _boss_mode_change, 1
loc_1BCE7:
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
mov _boss_phase_frame, 0
mov _boss_phase, PHASE_BOSS_EXPLODE_SMALL
call b4balls_reset
@ -24655,7 +24655,7 @@ loc_1C5D8:
mov _boss_phase_frame, 0
mov _boss_mode, 1
mov _boss_mode_change, 0
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
push _boss_pos.cur.x
push _boss_pos.cur.y
call circles_add_growing
@ -24871,7 +24871,7 @@ loc_1C7D7:
mov _boss_mode_change, 1
loc_1C7E3:
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
mov _boss_phase_frame, 0
mov _boss_phase, PHASE_BOSS_EXPLODE_SMALL
call b4balls_reset
@ -25985,7 +25985,7 @@ loc_1D4DD:
mov _boss_mode_change, 1
loc_1D4F4:
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
mov _boss_phase_frame, 0
mov _boss_phase, PHASE_BOSS_EXPLODE_SMALL
mov _boss_custombullets_render, offset nullfunc_near
@ -27487,7 +27487,7 @@ loc_1E4F9:
mov _boss_mode_change, 1
loc_1E510:
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
mov _boss_phase_frame, 0
mov _boss_phase, PHASE_BOSS_EXPLODE_SMALL
jmp short loc_1E527
@ -29457,7 +29457,7 @@ loc_1F626:
mov _boss_mode_change, 1
loc_1F643:
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
mov _boss_phase_frame, 0
mov _boss_phase, PHASE_BOSS_EXPLODE_SMALL
mov _boss_custombullets_render, offset nullfunc_near
@ -30080,7 +30080,7 @@ n1000 = word ptr 4
loc_1FBE1:
cmp _boss_phase_frame, 16
jnz short loc_1FBED
call boss_explode_small pascal, 4
call boss_explode_small pascal, ET_VERTICAL
loc_1FBED:
cmp _boss_phase_frame, 32