mirror of https://github.com/nmlgc/ReC98.git
[Decompilation] [th05] Line sets: Rendering
With all the memmove()-style shifting of individual lines, there's probably a point to reserving 20 lines per set, but only ever rendering 4 of them. We'll see once I get to decompile all of these functions. Part of P0110, funded by [Anonymous] and Blue Bolt.
This commit is contained in:
parent
8cf1e74565
commit
7c4d31c02b
|
@ -135,7 +135,7 @@ bin\th05\op.exe: bin\th05\op.obj th05\op_01.cpp
|
||||||
$**
|
$**
|
||||||
|
|
|
|
||||||
|
|
||||||
bin\th05\main.exe: bin\th05\main.obj th05\p_common.cpp th05\p_reimu.cpp th05\p_marisa.cpp th05\p_mima.cpp th05\p_yuuka.cpp bin\th05\player.obj bin\th05\hud_bar.obj bin\th05\scoreupd.obj th05\main011.cpp th05\main012.cpp bin\th05\bullet.obj th05\main031.cpp th05\main032.cpp th05\main033.cpp
|
bin\th05\main.exe: bin\th05\main.obj th05\main010.cpp th05\p_common.cpp th05\p_reimu.cpp th05\p_marisa.cpp th05\p_mima.cpp th05\p_yuuka.cpp bin\th05\player.obj bin\th05\hud_bar.obj bin\th05\scoreupd.obj th05\main011.cpp th05\main012.cpp bin\th05\bullet.obj th05\main031.cpp th05\main032.cpp th05\main033.cpp
|
||||||
$(CC) $(CFLAGS) -ml -3 -Z -DGAME=5 -DBINARY='M' -nbin\th05\ -eMAIN.EXE @&&|
|
$(CC) $(CFLAGS) -ml -3 -Z -DGAME=5 -DBINARY='M' -nbin\th05\ -eMAIN.EXE @&&|
|
||||||
$**
|
$**
|
||||||
|
|
|
|
||||||
|
|
|
@ -42,6 +42,10 @@ public:
|
||||||
return v >> 4;
|
return v >> 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operator T() const {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
static T None() {
|
static T None() {
|
||||||
return to_sp(PIXEL_NONE);
|
return to_sp(PIXEL_NONE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
// A random shared point variable used for drawing various things.
|
||||||
|
extern SPPoint drawpoint;
|
|
@ -1,3 +1,2 @@
|
||||||
; A random shared point variable used for drawing various things.
|
|
||||||
public _drawpoint
|
public _drawpoint
|
||||||
_drawpoint Point <?>
|
_drawpoint Point <?>
|
||||||
|
|
|
@ -8,5 +8,9 @@ int pascal near vector2_near(
|
||||||
);
|
);
|
||||||
|
|
||||||
int pascal vector2_at(
|
int pascal vector2_at(
|
||||||
Point near &ret, int origin_x, int origin_y, int length, int angle
|
SPPoint near &ret,
|
||||||
|
subpixel_t origin_x,
|
||||||
|
subpixel_t origin_y,
|
||||||
|
subpixel_t length,
|
||||||
|
int angle
|
||||||
);
|
);
|
||||||
|
|
|
@ -3,6 +3,12 @@
|
||||||
* Rendering code for all bosses
|
* Rendering code for all bosses
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <master.h>
|
||||||
|
#include "th01/math/subpixel.hpp"
|
||||||
|
#include "th04/math/vector.hpp"
|
||||||
|
#include "th04/main/drawp.hpp"
|
||||||
|
#include "th04/main/playfld.h"
|
||||||
|
|
||||||
/// Structures
|
/// Structures
|
||||||
/// ----------
|
/// ----------
|
||||||
#define BOSS_PARTICLE_COUNT 64
|
#define BOSS_PARTICLE_COUNT 64
|
||||||
|
@ -36,3 +42,21 @@ struct lineset_t {
|
||||||
extern boss_particle_t boss_particles[BOSS_PARTICLE_COUNT];
|
extern boss_particle_t boss_particles[BOSS_PARTICLE_COUNT];
|
||||||
extern lineset_t linesets[LINESET_COUNT];
|
extern lineset_t linesets[LINESET_COUNT];
|
||||||
/// ----------
|
/// ----------
|
||||||
|
|
||||||
|
// Draws the given line out of [set] with the current GRCG tile and color.
|
||||||
|
void pascal near grcg_lineset_line_put(lineset_t near &set, int i)
|
||||||
|
{
|
||||||
|
vector2_at(drawpoint,
|
||||||
|
set.center[i].x, set.center[i].y, set.radius[i], set.angle[i]
|
||||||
|
);
|
||||||
|
int x1 = (PLAYFIELD_X + drawpoint.x.to_screen());
|
||||||
|
int y1 = (PLAYFIELD_Y + drawpoint.y.to_screen());
|
||||||
|
|
||||||
|
vector2_at(drawpoint,
|
||||||
|
set.center[i].x, set.center[i].y, set.radius[i], (set.angle[i] + 0x80)
|
||||||
|
);
|
||||||
|
int x2 = (PLAYFIELD_X + drawpoint.x.to_screen());
|
||||||
|
int y2 = (PLAYFIELD_Y + drawpoint.y.to_screen());
|
||||||
|
|
||||||
|
grcg_line(x1, y1, x2, y2);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
/* ReC98
|
||||||
|
* -----
|
||||||
|
* 1st part of code segment #1 of TH05's MAIN.EXE
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma codeseg main__TEXT main_01
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "th05/main/boss/render.cpp"
|
||||||
|
}
|
172
th05_main.asm
172
th05_main.asm
|
@ -4026,83 +4026,13 @@ loc_D4F4:
|
||||||
leave
|
leave
|
||||||
retn
|
retn
|
||||||
sub_D3C6 endp
|
sub_D3C6 endp
|
||||||
|
|
||||||
|
GRCG_LINESET_LINE_PUT procdesc pascal near \
|
||||||
|
set:near ptr, i:word
|
||||||
main__TEXT ends
|
main__TEXT ends
|
||||||
|
|
||||||
main_0_TEXT segment word public 'CODE' use16
|
main_0_TEXT segment word public 'CODE' use16
|
||||||
|
|
||||||
; =============== S U B R O U T I N E =======================================
|
|
||||||
|
|
||||||
; Attributes: bp-based frame
|
|
||||||
|
|
||||||
sub_D4F8 proc near
|
|
||||||
|
|
||||||
var_8 = word ptr -8
|
|
||||||
var_6 = word ptr -6
|
|
||||||
var_4 = word ptr -4
|
|
||||||
var_2 = word ptr -2
|
|
||||||
arg_0 = word ptr 4
|
|
||||||
arg_2 = word ptr 6
|
|
||||||
|
|
||||||
enter 8, 0
|
|
||||||
push si
|
|
||||||
push di
|
|
||||||
mov si, [bp+arg_2]
|
|
||||||
mov di, [bp+arg_0]
|
|
||||||
push offset _drawpoint
|
|
||||||
mov bx, di
|
|
||||||
shl bx, 2
|
|
||||||
push [bx+si+lineset_t.LS_center.x]
|
|
||||||
mov bx, di
|
|
||||||
shl bx, 2
|
|
||||||
push [bx+si+lineset_t.LS_center.y]
|
|
||||||
mov bx, di
|
|
||||||
add bx, bx
|
|
||||||
push [bx+si+lineset_t.LS_radius]
|
|
||||||
mov bx, di
|
|
||||||
mov al, [bx+si+lineset_t.LS_angle]
|
|
||||||
mov ah, 0
|
|
||||||
push ax
|
|
||||||
call vector2_at
|
|
||||||
mov ax, _drawpoint.x
|
|
||||||
sar ax, 4
|
|
||||||
add ax, 32
|
|
||||||
mov [bp+var_2], ax
|
|
||||||
mov ax, _drawpoint.y
|
|
||||||
sar ax, 4
|
|
||||||
add ax, 16
|
|
||||||
mov [bp+var_4], ax
|
|
||||||
push offset _drawpoint
|
|
||||||
mov bx, di
|
|
||||||
shl bx, 2
|
|
||||||
push [bx+si+lineset_t.LS_center.x]
|
|
||||||
mov bx, di
|
|
||||||
shl bx, 2
|
|
||||||
push [bx+si+lineset_t.LS_center.y]
|
|
||||||
mov bx, di
|
|
||||||
add bx, bx
|
|
||||||
push [bx+si+lineset_t.LS_radius]
|
|
||||||
mov bx, di
|
|
||||||
mov al, [bx+si+lineset_t.LS_angle]
|
|
||||||
mov ah, 0
|
|
||||||
add ax, 80h
|
|
||||||
push ax
|
|
||||||
call vector2_at
|
|
||||||
mov ax, _drawpoint.x
|
|
||||||
sar ax, 4
|
|
||||||
add ax, 32
|
|
||||||
mov [bp+var_6], ax
|
|
||||||
mov ax, _drawpoint.y
|
|
||||||
sar ax, 4
|
|
||||||
add ax, 16
|
|
||||||
mov [bp+var_8], ax
|
|
||||||
call grcg_line pascal, [bp+var_2], [bp+var_4], [bp+var_6], ax
|
|
||||||
pop di
|
|
||||||
pop si
|
|
||||||
leave
|
|
||||||
retn 4
|
|
||||||
sub_D4F8 endp
|
|
||||||
|
|
||||||
|
|
||||||
; =============== S U B R O U T I N E =======================================
|
; =============== S U B R O U T I N E =======================================
|
||||||
|
|
||||||
; Attributes: bp-based frame
|
; Attributes: bp-based frame
|
||||||
|
@ -4201,34 +4131,18 @@ loc_D630:
|
||||||
mov ah, GC_BRG
|
mov ah, GC_BRG
|
||||||
call _grcg_setcolor_direct_seg1_raw
|
call _grcg_setcolor_direct_seg1_raw
|
||||||
call sub_D327
|
call sub_D327
|
||||||
push offset lineset0
|
call grcg_lineset_line_put pascal, offset lineset0, 18
|
||||||
push 12h
|
call grcg_lineset_line_put pascal, offset lineset0, 12
|
||||||
call sub_D4F8
|
call grcg_lineset_line_put pascal, offset lineset1, 18
|
||||||
push offset lineset0
|
call grcg_lineset_line_put pascal, offset lineset1, 12
|
||||||
push 0Ch
|
|
||||||
call sub_D4F8
|
|
||||||
push offset lineset1
|
|
||||||
push 12h
|
|
||||||
call sub_D4F8
|
|
||||||
push offset lineset1
|
|
||||||
push 0Ch
|
|
||||||
call sub_D4F8
|
|
||||||
mov ah, GC_RG
|
mov ah, GC_RG
|
||||||
call _grcg_setcolor_direct_seg1_raw
|
call _grcg_setcolor_direct_seg1_raw
|
||||||
push offset lineset0
|
call grcg_lineset_line_put pascal, offset lineset0, 6
|
||||||
push 6
|
call grcg_lineset_line_put pascal, offset lineset1, 6
|
||||||
call sub_D4F8
|
|
||||||
push offset lineset1
|
|
||||||
push 6
|
|
||||||
call sub_D4F8
|
|
||||||
mov ah, 0Fh
|
mov ah, 0Fh
|
||||||
call _grcg_setcolor_direct_seg1_raw
|
call _grcg_setcolor_direct_seg1_raw
|
||||||
push offset lineset0
|
call grcg_lineset_line_put pascal, offset lineset0, 0
|
||||||
push 0
|
call grcg_lineset_line_put pascal, offset lineset1, 0
|
||||||
call sub_D4F8
|
|
||||||
push offset lineset1
|
|
||||||
push 0
|
|
||||||
call sub_D4F8
|
|
||||||
GRCG_OFF_CLOBBERING dx
|
GRCG_OFF_CLOBBERING dx
|
||||||
pop di
|
pop di
|
||||||
pop si
|
pop si
|
||||||
|
@ -4462,34 +4376,18 @@ loc_D82E:
|
||||||
mov ah, GC_BRG
|
mov ah, GC_BRG
|
||||||
call _grcg_setcolor_direct_seg1_raw
|
call _grcg_setcolor_direct_seg1_raw
|
||||||
call sub_D327
|
call sub_D327
|
||||||
push offset lineset0
|
call grcg_lineset_line_put pascal, offset lineset0, 18
|
||||||
push 12h
|
call grcg_lineset_line_put pascal, offset lineset0, 12
|
||||||
call sub_D4F8
|
call grcg_lineset_line_put pascal, offset lineset1, 18
|
||||||
push offset lineset0
|
call grcg_lineset_line_put pascal, offset lineset1, 12
|
||||||
push 0Ch
|
|
||||||
call sub_D4F8
|
|
||||||
push offset lineset1
|
|
||||||
push 12h
|
|
||||||
call sub_D4F8
|
|
||||||
push offset lineset1
|
|
||||||
push 0Ch
|
|
||||||
call sub_D4F8
|
|
||||||
mov ah, GC_RG
|
mov ah, GC_RG
|
||||||
call _grcg_setcolor_direct_seg1_raw
|
call _grcg_setcolor_direct_seg1_raw
|
||||||
push offset lineset0
|
call grcg_lineset_line_put pascal, offset lineset0, 6
|
||||||
push 6
|
call grcg_lineset_line_put pascal, offset lineset1, 6
|
||||||
call sub_D4F8
|
|
||||||
push offset lineset1
|
|
||||||
push 6
|
|
||||||
call sub_D4F8
|
|
||||||
mov ah, 0Fh
|
mov ah, 0Fh
|
||||||
call _grcg_setcolor_direct_seg1_raw
|
call _grcg_setcolor_direct_seg1_raw
|
||||||
push offset lineset0
|
call grcg_lineset_line_put pascal, offset lineset0, 0
|
||||||
push 0
|
call grcg_lineset_line_put pascal, offset lineset1, 0
|
||||||
call sub_D4F8
|
|
||||||
push offset lineset1
|
|
||||||
push 0
|
|
||||||
call sub_D4F8
|
|
||||||
GRCG_OFF_CLOBBERING dx
|
GRCG_OFF_CLOBBERING dx
|
||||||
pop di
|
pop di
|
||||||
pop si
|
pop si
|
||||||
|
@ -4688,34 +4586,18 @@ loc_D9C6:
|
||||||
mov ah, GC_BRG
|
mov ah, GC_BRG
|
||||||
call _grcg_setcolor_direct_seg1_raw
|
call _grcg_setcolor_direct_seg1_raw
|
||||||
call sub_D327
|
call sub_D327
|
||||||
push offset lineset0
|
call grcg_lineset_line_put pascal, offset lineset0, 18
|
||||||
push 12h
|
call grcg_lineset_line_put pascal, offset lineset0, 12
|
||||||
call sub_D4F8
|
call grcg_lineset_line_put pascal, offset lineset1, 18
|
||||||
push offset lineset0
|
call grcg_lineset_line_put pascal, offset lineset1, 12
|
||||||
push 0Ch
|
|
||||||
call sub_D4F8
|
|
||||||
push offset lineset1
|
|
||||||
push 12h
|
|
||||||
call sub_D4F8
|
|
||||||
push offset lineset1
|
|
||||||
push 0Ch
|
|
||||||
call sub_D4F8
|
|
||||||
mov ah, GC_RG
|
mov ah, GC_RG
|
||||||
call _grcg_setcolor_direct_seg1_raw
|
call _grcg_setcolor_direct_seg1_raw
|
||||||
push offset lineset0
|
call grcg_lineset_line_put pascal, offset lineset0, 6
|
||||||
push 6
|
call grcg_lineset_line_put pascal, offset lineset1, 6
|
||||||
call sub_D4F8
|
|
||||||
push offset lineset1
|
|
||||||
push 6
|
|
||||||
call sub_D4F8
|
|
||||||
mov ah, 0Fh
|
mov ah, 0Fh
|
||||||
call _grcg_setcolor_direct_seg1_raw
|
call _grcg_setcolor_direct_seg1_raw
|
||||||
push offset lineset0
|
call grcg_lineset_line_put pascal, offset lineset0, 0
|
||||||
push 0
|
call grcg_lineset_line_put pascal, offset lineset1, 0
|
||||||
call sub_D4F8
|
|
||||||
push offset lineset1
|
|
||||||
push 0
|
|
||||||
call sub_D4F8
|
|
||||||
GRCG_OFF_CLOBBERING dx
|
GRCG_OFF_CLOBBERING dx
|
||||||
pop di
|
pop di
|
||||||
pop si
|
pop si
|
||||||
|
|
Loading…
Reference in New Issue