mirror of https://github.com/nmlgc/ReC98.git
[C decompilation] [th02/maine] HUUMA.CFG loading
This commit is contained in:
parent
2ccad4f5a4
commit
a8384c925f
|
@ -44,7 +44,7 @@ bin\th02\op.exe: bin\th02\op.obj th02\op_03.c th02\op_04.c th02\op_05.c th02\op_
|
|||
$**
|
||||
|
|
||||
|
||||
bin\th02\maine.exe: bin\th02\maine.obj th02\maine_04.c th02\maine_05.c
|
||||
bin\th02\maine.exe: bin\th02\maine.obj th02\maine_03.c th02\maine_04.c th02\maine_05.c
|
||||
$(CC) $(CFLAGS) -ml -3 -Z -DGAME=2 -nbin\th02\ -eMAINE.EXE @&&|
|
||||
$**
|
||||
|
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/* ReC98
|
||||
* -----
|
||||
* Code segment #3 of TH02's MAINE.EXE
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include "th02\th02.h"
|
||||
|
||||
char rank = RANK_NORMAL;
|
||||
char unused_1 = 0;
|
||||
|
||||
mikoconfig_t *mikoconfig;
|
||||
char unused_2;
|
||||
char rem_lives;
|
||||
char rem_bombs;
|
||||
char unused_3;
|
||||
char unused_4;
|
||||
char unused_5;
|
||||
long score;
|
||||
int unused_6;
|
||||
|
||||
int pascal cfg_load(void)
|
||||
{
|
||||
int mikoconfig_sgm;
|
||||
|
||||
file_ropen("huuma.cfg");
|
||||
file_seek(offsetof(huuma_cfg_t, mikoconfig_sgm), 0);
|
||||
file_read(&mikoconfig_sgm, sizeof(mikoconfig_sgm));
|
||||
file_close();
|
||||
if(!mikoconfig_sgm) {
|
||||
return 0;
|
||||
}
|
||||
mikoconfig = MK_FP(mikoconfig_sgm, 0);
|
||||
rem_lives = mikoconfig->rem_lives;
|
||||
rem_bombs = mikoconfig->rem_bombs;
|
||||
rank = mikoconfig->rank;
|
||||
score = mikoconfig->score;
|
||||
return 1;
|
||||
}
|
13
th02/th02.h
13
th02/th02.h
|
@ -137,6 +137,19 @@ void snd_se_update(void);
|
|||
#define MUSIC_CMT_LINE_LEN 42
|
||||
#define MUSIC_CMT_LINE_COUNT 20
|
||||
|
||||
// Configuration file
|
||||
#pragma option -a1
|
||||
typedef struct {
|
||||
char rank;
|
||||
char music;
|
||||
char bombs;
|
||||
char lives;
|
||||
char perf;
|
||||
int mikoconfig_sgm;
|
||||
char debug;
|
||||
} huuma_cfg_t;
|
||||
#pragma option -a2
|
||||
|
||||
// Resident structure
|
||||
typedef struct {
|
||||
char id[11]; // = "MIKOConfig"
|
||||
|
|
|
@ -3004,7 +3004,7 @@ _envp = dword ptr 0Ch
|
|||
|
||||
push bp
|
||||
mov bp, sp
|
||||
call sub_B888
|
||||
call cfg_load
|
||||
or ax, ax
|
||||
jz loc_B1FE
|
||||
les bx, _mikoconfig
|
||||
|
@ -3598,56 +3598,7 @@ maine_02_TEXT ends
|
|||
|
||||
; Segment type: Pure code
|
||||
maine_03_TEXT segment byte public 'CODE' use16
|
||||
assume cs:maine_03_TEXT
|
||||
;org 8
|
||||
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_B888 proc far
|
||||
|
||||
var_2 = word ptr -2
|
||||
|
||||
enter 2, 0
|
||||
push ds
|
||||
push offset aHuuma_cfg ; "huuma.cfg"
|
||||
call file_ropen
|
||||
pushd 5
|
||||
push 0
|
||||
call file_seek
|
||||
push ss
|
||||
lea ax, [bp+var_2]
|
||||
push ax
|
||||
push 2
|
||||
call file_read
|
||||
call file_close
|
||||
cmp [bp+var_2], 0
|
||||
jnz short loc_B8BA
|
||||
xor ax, ax
|
||||
leave
|
||||
retf
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_B8BA:
|
||||
mov ax, [bp+var_2]
|
||||
mov word ptr _mikoconfig+2, ax
|
||||
mov word ptr _mikoconfig, 0
|
||||
les bx, _mikoconfig
|
||||
mov al, es:[bx+mikoconfig_t.rem_lives]
|
||||
mov byte_FB07, al
|
||||
mov al, es:[bx+mikoconfig_t.rem_bombs]
|
||||
mov byte_FB08, al
|
||||
mov al, es:[bx+mikoconfig_t.rank]
|
||||
mov _rank, al
|
||||
mov eax, es:[bx+mikoconfig_t.score]
|
||||
mov _score, eax
|
||||
mov ax, 1
|
||||
leave
|
||||
retf
|
||||
sub_B888 endp
|
||||
|
||||
extern CFG_LOAD:proc
|
||||
maine_03_TEXT ends
|
||||
|
||||
; ===========================================================================
|
||||
|
@ -3824,10 +3775,7 @@ include th02/formats/pfopen[data].asm
|
|||
_snd_active db 0
|
||||
db 0
|
||||
aUmx db '“Œ•û••–‚.˜^',0
|
||||
public _rank
|
||||
_rank db 1
|
||||
db 0
|
||||
aHuuma_cfg db 'huuma.cfg',0
|
||||
extern _rank:byte
|
||||
|
||||
.data?
|
||||
|
||||
|
@ -5093,17 +5041,7 @@ include libs/master.lib/pfint21[bss].asm
|
|||
include th02/hardware/input_sense[bss].asm
|
||||
include th02/hardware/snd[bss].asm
|
||||
include th02/hardware/snd_load[bss].asm
|
||||
public _mikoconfig
|
||||
_mikoconfig dd ?
|
||||
db ? ;
|
||||
byte_FB07 db ?
|
||||
byte_FB08 db ?
|
||||
db ?
|
||||
db ? ;
|
||||
db ? ;
|
||||
public _score
|
||||
_score dd ?
|
||||
db ? ;
|
||||
db ? ;
|
||||
extern _mikoconfig:dword
|
||||
extern _score:dword
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue