mirror of https://github.com/nmlgc/ReC98.git
[Decompilation] [th04/th05] MAINE.EXE: Top-level ending function
Part of P0265, funded by [Anonymous] and iruleatgames.
This commit is contained in:
parent
1350a60e3f
commit
1de8585136
|
@ -9,14 +9,22 @@ extern "C" {
|
|||
}
|
||||
#include "th03/formats/cfg_impl.hpp"
|
||||
#include "th03/core/initexit.h"
|
||||
#include "th03/cutscene/cutscene.hpp"
|
||||
#include "th04/score.h"
|
||||
#include "th04/end/end.h"
|
||||
#if (GAME == 5)
|
||||
#include "th04/shiftjis/fnshared.hpp"
|
||||
#include "th05/resident.hpp"
|
||||
#include "th05/shiftjis/fns.hpp"
|
||||
#else
|
||||
#include "th04/resident.hpp"
|
||||
#endif
|
||||
|
||||
resident_t far* resident;
|
||||
|
||||
// ZUN bloat: Should be its own translation unit.
|
||||
resident_t __seg* near cfg_load_resident_ptr(void)
|
||||
{
|
||||
#undef CFG_FN
|
||||
extern const char CFG_FN[];
|
||||
cfg_t cfg;
|
||||
return cfg_load_and_set_resident(cfg, CFG_FN);
|
||||
}
|
||||
|
@ -32,3 +40,26 @@ void pascal near game_exit_and_exec(char* fn)
|
|||
game_exit();
|
||||
execl(fn, fn, nullptr);
|
||||
}
|
||||
|
||||
void near end_animate(void)
|
||||
{
|
||||
#if (GAME == 5)
|
||||
static char* SCRIPT_FN = "_ED00.TXT\0" OP_AND_END_PF_FN "\0" SE_FN;
|
||||
if(resident->end_sequence == ES_CONTINUED) {
|
||||
SCRIPT_FN[3] = '0';
|
||||
} else if(resident->end_sequence == ES_EXTRA) {
|
||||
SCRIPT_FN[3] = '2';
|
||||
} else {
|
||||
SCRIPT_FN[3] = '1';
|
||||
}
|
||||
SCRIPT_FN[4] = ('0' + resident->playchar);
|
||||
#else
|
||||
static char* SCRIPT_FN = "_ED000.TXT";
|
||||
SCRIPT_FN[3] = resident->playchar_ascii;
|
||||
SCRIPT_FN[4] = ('0' + resident->shottype);
|
||||
SCRIPT_FN[5] = resident->end_type_ascii;
|
||||
#endif
|
||||
cutscene_script_load(SCRIPT_FN);
|
||||
cutscene_animate();
|
||||
cutscene_script_free();
|
||||
}
|
||||
|
|
|
@ -150,6 +150,7 @@ MAINE_E_TEXT segment byte public 'CODE' use16
|
|||
@cfg_load_resident_ptr$qv procdesc near
|
||||
@GAME_EXIT_AND_EXEC$QNC procdesc pascal near \
|
||||
fn_off:word, fn_seg:word
|
||||
@end_animate$qv procdesc near
|
||||
MAINE_E_TEXT ends
|
||||
|
||||
; Segment type: Pure code
|
||||
|
@ -158,36 +159,6 @@ CUTSCENE_TEXT segment byte public 'CODE' use16
|
|||
;org 9
|
||||
assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_A0BD proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
les bx, _resident
|
||||
mov al, es:[bx+resident_t.playchar_ascii]
|
||||
les bx, off_E5C0
|
||||
mov es:[bx+3], al
|
||||
les bx, _resident
|
||||
mov al, es:[bx+resident_t.shottype]
|
||||
add al, '0'
|
||||
les bx, off_E5C0
|
||||
mov es:[bx+4], al
|
||||
les bx, _resident
|
||||
mov al, es:[bx+resident_t.end_type_ascii]
|
||||
les bx, off_E5C0
|
||||
mov es:[bx+5], al
|
||||
push word ptr off_E5C0+2
|
||||
push bx
|
||||
call @cutscene_script_load$qnxc
|
||||
call @cutscene_animate$qv
|
||||
call @cutscene_script_free$qv
|
||||
pop bp
|
||||
retn
|
||||
sub_A0BD endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
@ -226,7 +197,7 @@ _main proc far
|
|||
les bx, _resident
|
||||
cmp es:[bx+resident_t.end_sequence], ES_CONTINUED
|
||||
jb loc_A1FE
|
||||
call sub_A0BD
|
||||
call @end_animate$qv
|
||||
call @staffroll_animate$qv
|
||||
call @verdict_animate$qv
|
||||
les bx, _resident
|
||||
|
@ -300,11 +271,6 @@ locret_A290:
|
|||
leave
|
||||
retf
|
||||
_main endp
|
||||
|
||||
@CUTSCENE_SCRIPT_LOAD$QNXC procdesc pascal near \
|
||||
fn:dword
|
||||
@cutscene_script_free$qv procdesc near
|
||||
@cutscene_animate$qv procdesc pascal near
|
||||
CUTSCENE_TEXT ends
|
||||
|
||||
maine_01_TEXT segment byte public 'CODE' use16
|
||||
|
@ -3191,11 +3157,7 @@ SHARED_ ends
|
|||
|
||||
.data
|
||||
|
||||
off_E5C0 dd a_ed000_txt
|
||||
; "_ED000.TXT"
|
||||
include th04/formats/cfg_lres[data].asm
|
||||
public _CongFN
|
||||
a_ed000_txt db '_ED000.TXT',0
|
||||
_CongFN db 'CONG00.pi',0
|
||||
aMSzlEd_dat db 'Œ¶‘z‹½ed.dat',0
|
||||
aGameft_bft db 'GAMEFT.bft',0
|
||||
|
|
|
@ -157,6 +157,7 @@ MAINE_E_TEXT segment byte public 'CODE' use16
|
|||
@cfg_load_resident_ptr$qv procdesc near
|
||||
@GAME_EXIT_AND_EXEC$QNC procdesc pascal near \
|
||||
fn_off:word, fn_seg:word
|
||||
@end_animate$qv procdesc near
|
||||
MAINE_E_TEXT ends
|
||||
|
||||
; Segment type: Pure code
|
||||
|
@ -165,49 +166,6 @@ CUTSCENE_TEXT segment byte public 'CODE' use16
|
|||
;org 5
|
||||
assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_A5A4 proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
les bx, _resident
|
||||
cmp es:[bx+resident_t.end_sequence], ES_CONTINUED
|
||||
jnz short loc_A5BD
|
||||
les bx, off_10190
|
||||
mov byte ptr es:[bx+3], '0'
|
||||
jmp short loc_A5DC
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_A5BD:
|
||||
les bx, _resident
|
||||
cmp es:[bx+resident_t.end_sequence], ES_EXTRA
|
||||
jnz short loc_A5D3
|
||||
les bx, off_10190
|
||||
mov byte ptr es:[bx+3], '2'
|
||||
jmp short loc_A5DC
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_A5D3:
|
||||
les bx, off_10190
|
||||
mov byte ptr es:[bx+3], '1'
|
||||
|
||||
loc_A5DC:
|
||||
les bx, _resident
|
||||
mov al, es:[bx+resident_t.playchar]
|
||||
add al, '0'
|
||||
les bx, off_10190
|
||||
mov es:[bx+4], al
|
||||
push word ptr off_10190+2
|
||||
push bx
|
||||
call @cutscene_script_load$qnxc
|
||||
call @cutscene_animate$qv
|
||||
pop bp
|
||||
retn
|
||||
sub_A5A4 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
@ -244,7 +202,7 @@ _envp = dword ptr 0Ch
|
|||
les bx, _resident
|
||||
cmp es:[bx+resident_t.end_sequence], ES_CONTINUED
|
||||
jb short loc_A665
|
||||
call sub_A5A4
|
||||
call @end_animate$qv
|
||||
call @staffroll_animate$qv
|
||||
jmp short loc_A679
|
||||
; ---------------------------------------------------------------------------
|
||||
|
@ -253,7 +211,7 @@ loc_A665:
|
|||
les bx, _resident
|
||||
cmp es:[bx+resident_t.end_sequence], ES_EXTRA
|
||||
jnz short loc_A67E
|
||||
call sub_A5A4
|
||||
call @end_animate$qv
|
||||
call @allcast_animate$qv
|
||||
call @verdict_animate$qv
|
||||
|
||||
|
@ -274,10 +232,6 @@ loc_A693:
|
|||
pop bp
|
||||
retf
|
||||
_main endp
|
||||
|
||||
@CUTSCENE_SCRIPT_LOAD$QNXC procdesc pascal near \
|
||||
fn:dword
|
||||
@cutscene_animate$qv procdesc pascal near
|
||||
CUTSCENE_TEXT ends
|
||||
|
||||
maine_01_TEXT segment byte public 'CODE' use16
|
||||
|
@ -6320,12 +6274,8 @@ SHARED_ ends
|
|||
|
||||
.data
|
||||
|
||||
off_10190 dd a_ed00_txt
|
||||
; "_ED00.TXT"
|
||||
include th04/formats/cfg_lres[data].asm
|
||||
a_ed00_txt db '_ED00.TXT',0
|
||||
aKaikidan1_dat db '‰öãY’k1.dat',0
|
||||
aMiko db 'miko',0
|
||||
aKaikidan1_dat = ($ - 17)
|
||||
aMiko = ($ - 5)
|
||||
; char arg0[]
|
||||
arg0 db 'op',0
|
||||
db 0
|
||||
|
|
Loading…
Reference in New Issue