mirror of https://github.com/nmlgc/ReC98.git
[Decompilation] [th05] Shinki: Background type B initialization and gravity
We're really going to have a needless "update, part 1" function for all four background types, eh? Part of P0146, funded by -Tom- and Ember2528.
This commit is contained in:
parent
a9496fa10f
commit
f5702a599b
|
@ -15,6 +15,7 @@
|
|||
#include "th04/math/motion.hpp"
|
||||
#include "th04/math/randring.h"
|
||||
#include "th04/main/drawp.hpp"
|
||||
#include "th04/main/frames.h"
|
||||
#include "th04/main/playfld.hpp"
|
||||
#include "th05/sprites/main_pat.h"
|
||||
#include "th05/formats/super.h"
|
||||
|
@ -68,6 +69,7 @@ static const int SHINKI_LINE_4 = (3 * 6);
|
|||
|
||||
extern unsigned char shinki_bg_linesets_zoomed_out;
|
||||
extern int shinki_bg_type_a_particles_alive;
|
||||
extern bool shinki_bg_type_b_initialized;
|
||||
|
||||
void near shinki_bg_particles_render(void)
|
||||
{
|
||||
|
@ -265,4 +267,58 @@ void near shinki_bg_type_a_update_and_render(void)
|
|||
}
|
||||
shinki_bg_render_blue_particles_and_lines();
|
||||
}
|
||||
|
||||
void near shinki_bg_type_b_update_part1(void)
|
||||
{
|
||||
boss_particle_t near *particle;
|
||||
int i;
|
||||
subpixel_t center_x;
|
||||
int line_i;
|
||||
lineset_t near *set;
|
||||
|
||||
if(!shinki_bg_type_b_initialized) {
|
||||
center_x = to_sp(playfield_fraction_x(1 / 6.0f));
|
||||
set = linesets;
|
||||
i = 0;
|
||||
while(i < SHINKI_LINESET_COUNT) {
|
||||
for(line_i = SHINKI_LINE_4; line_i >= 0; line_i--) {
|
||||
set->center[line_i].x.v = center_x;
|
||||
set->center[line_i].y.v = to_sp((PLAYFIELD_H / 2) + 32);
|
||||
set->radius[line_i].set(256.0f);
|
||||
set->angle[line_i] = 0x40;
|
||||
}
|
||||
set->velocity_y.set(0.0f);
|
||||
i++;
|
||||
set++;
|
||||
center_x += to_sp(playfield_fraction_x(4 / 6.0f));
|
||||
}
|
||||
particle = boss_particles;
|
||||
i = 0;
|
||||
while(i < BOSS_PARTICLE_COUNT) {
|
||||
particle->pos.x.v = randring1_next16_mod(to_sp(PLAYFIELD_W));
|
||||
// Huh? Not PLAYFIELD_H?
|
||||
particle->pos.y.v = randring1_next16_mod(to_sp(PLAYFIELD_W));
|
||||
particle->origin.x = particle->pos.x;
|
||||
particle->origin.y.set(-1.0f);
|
||||
particle->velocity.set(0.0f, 0.0f);
|
||||
particle->patnum = (
|
||||
PAT_PARTICLE + randring1_next16_and(PARTICLE_CELS - 1)
|
||||
);
|
||||
i++;
|
||||
particle++;
|
||||
}
|
||||
shinki_bg_type_b_initialized++;
|
||||
return;
|
||||
}
|
||||
|
||||
particle = boss_particles;
|
||||
i = 0;
|
||||
while(i < BOSS_PARTICLE_COUNT) {
|
||||
if(particle->velocity.y < to_sp(10.0f)) {
|
||||
particle->velocity.y.v += stage_frame_mod2;
|
||||
}
|
||||
i++;
|
||||
particle++;
|
||||
}
|
||||
}
|
||||
/// ----------------
|
||||
|
|
120
th05_main.asm
120
th05_main.asm
|
@ -3538,124 +3538,11 @@ yumeko_bg_render endp
|
|||
LINESET_FORWARD_COPY procdesc pascal near \
|
||||
set:near ptr
|
||||
_shinki_bg_type_a_update_and_rend procdesc c near
|
||||
_shinki_bg_type_b_update_part1 procdesc c near
|
||||
main__TEXT ends
|
||||
|
||||
main_0_TEXT segment word public 'CODE' use16
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_D694 proc near
|
||||
|
||||
@@set = word ptr -6
|
||||
@@line_i = word ptr -4
|
||||
@@center_x = word ptr -2
|
||||
|
||||
enter 6, 0
|
||||
push si
|
||||
push di
|
||||
cmp byte_21D70, 0
|
||||
jnz loc_D751
|
||||
mov [bp+@@center_x], (64 shl 4)
|
||||
mov [bp+@@set], offset _linesets
|
||||
xor di, di
|
||||
jmp short loc_D707
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_D6B1:
|
||||
mov [bp+@@line_i], (LINESET_LINE_COUNT - 2)
|
||||
jmp short loc_D6EE
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_D6B8:
|
||||
mov bx, [bp+@@line_i]
|
||||
shl bx, 2
|
||||
add bx, [bp+@@set]
|
||||
mov ax, [bp+@@center_x]
|
||||
mov [bx+lineset_t.LS_center.x], ax
|
||||
mov bx, [bp+@@line_i]
|
||||
shl bx, 2
|
||||
add bx, [bp+@@set]
|
||||
mov [bx+lineset_t.LS_center.y], (216 shl 4)
|
||||
mov bx, [bp+@@line_i]
|
||||
add bx, bx
|
||||
add bx, [bp+@@set]
|
||||
mov word ptr [bx+lineset_t.LS_radius], (256 shl 4)
|
||||
mov bx, [bp+@@set]
|
||||
add bx, [bp+@@line_i]
|
||||
mov byte ptr [bx+lineset_t.LS_angle], 40h
|
||||
dec [bp+@@line_i]
|
||||
|
||||
loc_D6EE:
|
||||
cmp [bp+@@line_i], 0
|
||||
jge short loc_D6B8
|
||||
mov bx, [bp+@@set]
|
||||
mov word ptr [bx+lineset_t.LS_velocity_y], 0
|
||||
inc di
|
||||
add [bp+@@set], size lineset_t
|
||||
add [bp+@@center_x], (256 shl 4)
|
||||
|
||||
loc_D707:
|
||||
cmp di, 2
|
||||
jl short loc_D6B1
|
||||
mov si, offset _boss_particles
|
||||
xor di, di
|
||||
jmp short loc_D746
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_D713:
|
||||
call randring1_next16_mod pascal, (PLAYFIELD_W shl 4)
|
||||
mov [si+boss_particle_t.BP_pos.x], ax
|
||||
call randring1_next16_mod pascal, (PLAYFIELD_W shl 4) ; Huh?
|
||||
mov [si+boss_particle_t.BP_pos.y], ax
|
||||
mov ax, [si+boss_particle_t.BP_pos.x]
|
||||
mov [si+boss_particle_t.BP_origin.x], ax
|
||||
mov [si+boss_particle_t.BP_origin.y], (-1 shl 4)
|
||||
mov [si+boss_particle_t.BP_velocity.x], 0
|
||||
mov [si+boss_particle_t.BP_velocity.y], 0
|
||||
call randring1_next16_and pascal, 3
|
||||
add al, PAT_PARTICLE
|
||||
mov [si+boss_particle_t.BP_patnum], al
|
||||
inc di
|
||||
add si, size boss_particle_t
|
||||
|
||||
loc_D746:
|
||||
cmp di, BOSS_PARTICLE_COUNT
|
||||
jl short loc_D713
|
||||
inc byte_21D70
|
||||
jmp short loc_D770
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_D751:
|
||||
mov si, offset _boss_particles
|
||||
xor di, di
|
||||
jmp short loc_D76B
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_D758:
|
||||
cmp [si+boss_particle_t.BP_velocity.y], (10 shl 4)
|
||||
jge short loc_D767
|
||||
mov al, _stage_frame_mod2
|
||||
mov ah, 0
|
||||
add [si+boss_particle_t.BP_velocity.y], ax
|
||||
|
||||
loc_D767:
|
||||
inc di
|
||||
add si, size boss_particle_t
|
||||
|
||||
loc_D76B:
|
||||
cmp di, BOSS_PARTICLE_COUNT
|
||||
jl short loc_D758
|
||||
|
||||
loc_D770:
|
||||
pop di
|
||||
pop si
|
||||
leave
|
||||
retn
|
||||
sub_D694 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
@ -3668,7 +3555,7 @@ var_2 = word ptr -2
|
|||
enter 4, 0
|
||||
push si
|
||||
push di
|
||||
call sub_D694
|
||||
call _shinki_bg_type_b_update_part1
|
||||
mov [bp+var_2], 4
|
||||
mov si, offset _linesets
|
||||
xor di, di
|
||||
|
@ -27083,10 +26970,11 @@ byte_21762 db 0
|
|||
include th04/sprites/pointnum.asp
|
||||
include th05/formats/bb_playchar[data].asm
|
||||
public _shinki_bg_linesets_zoomed_out, _shinki_bg_type_a_particles_alive
|
||||
public _shinki_bg_type_b_initialized
|
||||
_shinki_bg_linesets_zoomed_out db 0
|
||||
db 0
|
||||
_shinki_bg_type_a_particles_alive dw (-1 and 255)
|
||||
byte_21D70 db 0
|
||||
_shinki_bg_type_b_initialized db 0
|
||||
db 0
|
||||
word_21D72 dw 0
|
||||
byte_21D74 db 0
|
||||
|
|
Loading…
Reference in New Issue