mirror of https://github.com/nmlgc/ReC98.git
[Decompilation] [th05] Shinki: Background type A rendering
The one in the first four phases, with the two parallel zooming lines that give the impression of flying into a corridor, and random blue particles shooting out from the center. Part of P0146, funded by -Tom- and Ember2528.
This commit is contained in:
parent
4672f226bb
commit
a9496fa10f
|
@ -4,11 +4,13 @@
|
|||
*/
|
||||
|
||||
#include "platform.h"
|
||||
#include "x86real.h"
|
||||
#include "pc98.h"
|
||||
#include "decomp.hpp"
|
||||
#include "master.hpp"
|
||||
#include "th01/math/area.hpp"
|
||||
#include "th01/math/subpixel.hpp"
|
||||
#include "th04/hardware/grcg.h"
|
||||
#include "th04/math/vector.hpp"
|
||||
#include "th04/math/motion.hpp"
|
||||
#include "th04/math/randring.h"
|
||||
|
@ -58,6 +60,12 @@ extern lineset_t linesets[LINESET_COUNT];
|
|||
static const int SHINKI_LINESET_COUNT = 2;
|
||||
static const int PARTICLES_UNINITIALIZED = (-1 & 0xFF);
|
||||
|
||||
// Maps one of Shinki's four visible lines to its index in a line set.
|
||||
static const int SHINKI_LINE_MAIN = (0 * 6);
|
||||
static const int SHINKI_LINE_2 = (1 * 6);
|
||||
static const int SHINKI_LINE_3 = (2 * 6);
|
||||
static const int SHINKI_LINE_4 = (3 * 6);
|
||||
|
||||
extern unsigned char shinki_bg_linesets_zoomed_out;
|
||||
extern int shinki_bg_type_a_particles_alive;
|
||||
|
||||
|
@ -204,4 +212,57 @@ void pascal near lineset_forward_copy(lineset_t near &set)
|
|||
set.radius[i].v = set.radius[i - 1].v;
|
||||
}
|
||||
}
|
||||
|
||||
inline void shinki_bg_render_blue_particles_and_lines(void)
|
||||
{
|
||||
grcg_setmode_rmw_seg1();
|
||||
|
||||
grcg_setcolor_direct_seg1(8);
|
||||
shinki_bg_particles_render();
|
||||
grcg_lineset_line_put(linesets[0], SHINKI_LINE_4);
|
||||
grcg_lineset_line_put(linesets[0], SHINKI_LINE_3);
|
||||
grcg_lineset_line_put(linesets[1], SHINKI_LINE_4);
|
||||
grcg_lineset_line_put(linesets[1], SHINKI_LINE_3);
|
||||
|
||||
grcg_setcolor_direct_seg1(9);
|
||||
grcg_lineset_line_put(linesets[0], SHINKI_LINE_2);
|
||||
grcg_lineset_line_put(linesets[1], SHINKI_LINE_2);
|
||||
|
||||
grcg_setcolor_direct_seg1(15);
|
||||
grcg_lineset_line_put(linesets[0], SHINKI_LINE_MAIN);
|
||||
grcg_lineset_line_put(linesets[1], SHINKI_LINE_MAIN);
|
||||
|
||||
grcg_off();
|
||||
}
|
||||
|
||||
// Particles: Blue, shooting out from the center in random directions and at
|
||||
// random speeds
|
||||
// Lines: Two parallel, repeatedly zooming lines that give the impression of
|
||||
// flying into a corridor, with random blue particles
|
||||
void near shinki_bg_type_a_update_and_render(void)
|
||||
{
|
||||
// MODDERS: Just fuse into this function.
|
||||
shinki_bg_type_a_update_part1();
|
||||
|
||||
lineset_t near *set = linesets;
|
||||
int i = 0;
|
||||
while(i < SHINKI_LINESET_COUNT) {
|
||||
lineset_forward_copy(*set);
|
||||
set->radius[SHINKI_LINE_MAIN] += 4.0f;
|
||||
vector2_at(
|
||||
set->center[SHINKI_LINE_MAIN],
|
||||
to_sp(PLAYFIELD_W / 2),
|
||||
to_sp(PLAYFIELD_H / 2),
|
||||
((set->radius[SHINKI_LINE_MAIN].v * 3) / 4),
|
||||
(set->angle[SHINKI_LINE_MAIN] - 0x40)
|
||||
);
|
||||
if(set->radius[SHINKI_LINE_MAIN] >= to_sp(224.0f)) {
|
||||
shinki_bg_linesets_zoomed_out++;
|
||||
set->radius[SHINKI_LINE_MAIN].set(0.0f);
|
||||
}
|
||||
i++;
|
||||
set++;
|
||||
}
|
||||
shinki_bg_render_blue_particles_and_lines();
|
||||
}
|
||||
/// ----------------
|
||||
|
|
|
@ -3533,82 +3533,15 @@ loc_D322:
|
|||
yumeko_bg_render endp
|
||||
|
||||
_shinki_bg_particles_render procdesc c near
|
||||
_shinki_bg_type_a_update_part1 procdesc c near
|
||||
GRCG_LINESET_LINE_PUT procdesc pascal near \
|
||||
set:near ptr, i:word
|
||||
LINESET_FORWARD_COPY procdesc pascal near \
|
||||
set:near ptr
|
||||
_shinki_bg_type_a_update_and_rend 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_D5E2 proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
push si
|
||||
push di
|
||||
call _shinki_bg_type_a_update_part1
|
||||
mov si, offset _linesets
|
||||
xor di, di
|
||||
jmp short loc_D630
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_D5F1:
|
||||
call lineset_forward_copy pascal, si
|
||||
add [si+lineset_t.LS_radius], (4 shl 4)
|
||||
push si
|
||||
push ((192 shl 4) shl 16) or (184 shl 4)
|
||||
mov ax, [si+lineset_t.LS_radius]
|
||||
imul ax, 3
|
||||
mov bx, 4
|
||||
cwd
|
||||
idiv bx
|
||||
push ax
|
||||
mov al, [si+lineset_t.LS_angle]
|
||||
mov ah, 0
|
||||
add ax, -64
|
||||
push ax
|
||||
call vector2_at
|
||||
cmp [si+lineset_t.LS_radius], (224 shl 4)
|
||||
jl short loc_D62B
|
||||
inc _shinki_bg_linesets_zoomed_out
|
||||
mov [si+lineset_t.LS_radius], 0
|
||||
|
||||
loc_D62B:
|
||||
inc di
|
||||
add si, size lineset_t
|
||||
|
||||
loc_D630:
|
||||
cmp di, 2
|
||||
jl short loc_D5F1
|
||||
call _grcg_setmode_rmw_seg1
|
||||
mov ah, GC_BRG
|
||||
call _grcg_setcolor_direct_seg1_raw
|
||||
call _shinki_bg_particles_render
|
||||
call grcg_lineset_line_put pascal, offset lineset0, 18
|
||||
call grcg_lineset_line_put pascal, offset lineset0, 12
|
||||
call grcg_lineset_line_put pascal, offset lineset1, 18
|
||||
call grcg_lineset_line_put pascal, offset lineset1, 12
|
||||
mov ah, GC_RG
|
||||
call _grcg_setcolor_direct_seg1_raw
|
||||
call grcg_lineset_line_put pascal, offset lineset0, 6
|
||||
call grcg_lineset_line_put pascal, offset lineset1, 6
|
||||
mov ah, 0Fh
|
||||
call _grcg_setcolor_direct_seg1_raw
|
||||
call grcg_lineset_line_put pascal, offset lineset0, 0
|
||||
call grcg_lineset_line_put pascal, offset lineset1, 0
|
||||
GRCG_OFF_CLOBBERING dx
|
||||
pop di
|
||||
pop si
|
||||
pop bp
|
||||
retn
|
||||
sub_D5E2 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
@ -4174,7 +4107,7 @@ loc_DADD:
|
|||
cmp _boss_phase, 4
|
||||
jnb short loc_DAEC
|
||||
call sub_E92E
|
||||
call sub_D5E2
|
||||
call _shinki_bg_type_a_update_and_rend
|
||||
leave
|
||||
retn
|
||||
; ---------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue