[Reverse-engineering] [th02] Reduced effect rendering flag

The 演出 option.

Part of P0236, funded by Yanga.
This commit is contained in:
nmlgc 2023-03-18 17:11:35 +01:00
parent 1f962c865e
commit ebc766bbce
7 changed files with 43 additions and 31 deletions

View File

@ -5,7 +5,7 @@
int8_t bgm_mode;
int8_t bombs;
int8_t lives;
int8_t perf;
bool reduce_effects;
} cfg_options_t;
#define CFG_LIVES_MAX 4

View File

@ -74,7 +74,7 @@ int cfg_load(void)
return 1;
}
resident = resident_sgm;
resident->perf = cfg.opts.perf;
resident->reduce_effects = cfg.opts.reduce_effects;
resident->debug = cfg.debug;
file_close();
@ -103,7 +103,7 @@ void cfg_save(void)
cfg.opts.bgm_mode = snd_bgm_mode;
cfg.opts.bombs = bombs;
cfg.opts.lives = lives;
cfg.opts.perf = resident->perf;
cfg.opts.reduce_effects = resident->reduce_effects;
file_create(cfg_fn);
file_write(&cfg, offsetof(cfg_t, resident));
@ -327,8 +327,7 @@ const unsigned char gbcBGM_MODE[3][5] = {
gb_M_, gb_I_, gb_D_, gb_I_, 0
};
const shiftjis_t *PERF_TITLE = "演出";
const shiftjis_t *PERF_OPTIONS[2] = {" 通常 ", "一部軽減"};
#include "th02/shiftjis/op_main.hpp"
#pragma option -d
@ -467,7 +466,7 @@ void pascal near option_put_shadow(void)
graph_gaiji_puts(196, 276, 16, gbMUSIC, 0);
graph_gaiji_puts(196, 292, 16, gbPLAYER, 0);
graph_gaiji_puts(196, 308, 16, gbBOMB, 0);
graph_putsa_fx(196, 324, 0, PERF_TITLE);
graph_putsa_fx(196, 324, 0, REDUCE_EFFECTS_TITLE);
graph_gaiji_puts(284, 340, 16, gbRESET, 0);
graph_gaiji_puts(292, 372, 16, gbQUIT, 0);
}
@ -495,10 +494,14 @@ void pascal near option_put(int sel, unsigned int atrb)
graph_copy_rect_1_to_0_16(392, 308, 32, 16);
graph_gaiji_putc(396, 308, bombs + gb_0_, 0);
} else if(sel == 4) {
text_putsa(24, 20, PERF_TITLE, atrb);
text_putsa(45, 20, PERF_OPTIONS[resident->perf], atrb);
text_putsa(24, 20, REDUCE_EFFECTS_TITLE, atrb);
text_putsa(
45, 20, REDUCE_EFFECTS_CHOICES[resident->reduce_effects], atrb
);
graph_copy_rect_1_to_0_16(360, 324, 128, 16);
graph_putsa_fx(364, 324, 0, PERF_OPTIONS[resident->perf]);
graph_putsa_fx(
364, 324, 0, REDUCE_EFFECTS_CHOICES[resident->reduce_effects]
);
} else if(sel == 5) {
gaiji_putsa(35, 21, gbRESET, atrb);
} else if(sel == 6) {
@ -561,7 +564,7 @@ void option_update_and_render(void)
ring_direction(bombs, option_bombs_max()); \
break; \
case 4: \
resident->perf = 1 - resident->perf; \
resident->reduce_effects = (true - resident->reduce_effects); \
break; \
} \
option_put(menu_sel, TX_WHITE);
@ -608,7 +611,7 @@ void option_update_and_render(void)
lives = CFG_LIVES_DEFAULT;
bombs = CFG_BOMBS_DEFAULT;
resident->unused_2 = 1;
resident->perf = 0;
resident->reduce_effects = false;
option_put(0, TX_YELLOW);
option_put(1, TX_YELLOW);
option_put(2, TX_YELLOW);

View File

@ -18,7 +18,7 @@ typedef struct {
int unused_1;
char unused_2;
unsigned char op_main_retval;
bool perf;
bool reduce_effects;
char unused_3;
char shottype;
char demo_num;
@ -28,3 +28,9 @@ typedef struct {
} resident_t;
extern resident_t *resident;
// Redundant copies of resident structure fields to static data
// ------------------------------------------------------------
extern bool reduce_effects;
// ------------------------------------------------------------

View File

@ -0,0 +1,2 @@
const shiftjis_t *REDUCE_EFFECTS_TITLE = "演出";
const shiftjis_t *REDUCE_EFFECTS_CHOICES[2] = {" 通常 ", "一部軽減"};

View File

@ -31,7 +31,7 @@ mikoconfig_t struc
unused_1 dw ?
unused_2 db ?
main_retval db ?
perf db ?
reduce_effects db ?
unused_3 db ?
shottype db ?
demo_num db ?

View File

@ -16,7 +16,7 @@ extern "C" int pascal scoredat_verify(void);
char debug = 0;
const cfg_options_t OPTS_DEFAULT = {
RANK_NORMAL, SND_BGM_FM, CFG_BOMBS_DEFAULT, CFG_LIVES_DEFAULT, 0
RANK_NORMAL, SND_BGM_FM, CFG_BOMBS_DEFAULT, CFG_LIVES_DEFAULT, false
};
#include "th02/formats/cfg_init.c"

View File

@ -426,7 +426,7 @@ loc_3F15:
mov ax, [bx+si+4]
sar ax, 4
mov word_20166, ax
cmp byte_2066C, 0
cmp _reduce_effects, 0
jz short loc_3F4B
mov al, _page_back
mov ah, 0
@ -586,7 +586,7 @@ loc_404F:
loc_4055:
mov [si+0Ah], bl
cmp byte_2066C, 0
cmp _reduce_effects, 0
jz short loc_406E
mov al, _page_back
mov ah, 0
@ -1122,8 +1122,8 @@ loc_B2F5:
call gaiji_load
call sub_E178
les bx, _resident
mov al, es:[bx+mikoconfig_t.perf]
mov byte_2066C, al
mov al, es:[bx+mikoconfig_t.reduce_effects]
mov _reduce_effects, al
setfarfp farfp_1F4A4, sub_BCB1
cmp es:[bx+mikoconfig_t.continues_used], 0
jz short loc_B34C
@ -1454,7 +1454,7 @@ loc_B76A:
setfarfp _boss_end, marisa_end
setfarfp _boss_bg_render_func, marisa_bg_render
setfarfp _boss_update_func, marisa_update
cmp byte_2066C, 0
cmp _reduce_effects, 0
jnz short loc_B7CB
setfarfp farfp_1F490, sub_19E2F
@ -4582,7 +4582,7 @@ var_3 = byte ptr -3
loc_D3A3:
cmp byte ptr [si], 0
jz loc_D46E
cmp byte_2066C, 0
cmp _reduce_effects, 0
jz short loc_D3BF
mov al, _page_back
mov ah, 0
@ -4705,7 +4705,7 @@ var_2 = word ptr -2
sub sp, 0Eh
push si
push di
mov al, byte_2066C
mov al, _reduce_effects
mov cl, _page_back
shl al, cl
mov [bp+var_9], al
@ -5751,7 +5751,7 @@ var_4 = dword ptr -4
sub sp, 4
cmp score_218AC, 0
jz loc_DE46
cmp byte_2066C, 0
cmp _reduce_effects, 0
jnz short loc_DDA1
mov eax, score_218AC
mov [bp+var_4], eax
@ -6898,7 +6898,7 @@ loc_E74D:
; ---------------------------------------------------------------------------
loc_E774:
cmp byte_2066C, 0
cmp _reduce_effects, 0
jz short loc_E782
test byte ptr _bomb_frame, 1
jz short loc_E7A0
@ -7314,7 +7314,7 @@ loc_EB9E:
jge loc_EC56
call grcg_boxfill pascal, (PLAYFIELD_LEFT shl 16) or 0, ((PLAYFIELD_RIGHT - 1) shl 16) or (RES_Y - 1)
mov byte_2066D, 2
cmp byte_2066C, 0
cmp _reduce_effects, 0
jz short loc_EBCC
test byte ptr _bomb_frame, 1
jz short loc_EBEF
@ -9084,7 +9084,7 @@ sub_102D6 proc far
mov bp, sp
push si
push di
cmp byte_2066C, 0
cmp _reduce_effects, 0
jnz short loc_102EE
mov byte_2174B, 1
mov byte_2174C, 30h ; '0'
@ -15702,7 +15702,7 @@ loc_13739:
jl short locret_13784
call sub_1403E
inc word_1ED94
mov al, byte_2066C
mov al, _reduce_effects
mov ah, 0
add ax, ax
add ax, 3EAh
@ -21221,7 +21221,7 @@ loc_167A0:
mov al, [bp+var_1]
mov ah, 0
push ax
mov al, byte_2066C
mov al, _reduce_effects
mov ah, 0
imul ax, 0Eh
add ax, 2
@ -23501,7 +23501,7 @@ var_1 = byte ptr -1
call egc_off
call grcg_setcolor pascal, (GC_RMW shl 16) + 0
call grcg_byteboxfill_x pascal, (PLAYFIELD_VRAM_LEFT shl 16) or PLAYFIELD_TOP, ((PLAYFIELD_VRAM_RIGHT - 1) shl 16) or PLAYFIELD_BOTTOM - 1
mov al, byte_2066C
mov al, _reduce_effects
mov ah, 0
mov dx, ax
add dx, dx
@ -26147,7 +26147,7 @@ var_1 = byte ptr -1
mov word_26C64, ax
test byte ptr dword_20612, 1
jnz short loc_1953B
cmp byte_2066C, 0
cmp _reduce_effects, 0
jnz short loc_1950F
mov al, byte_26CF8
add al, 8
@ -30603,7 +30603,7 @@ loc_1BF3A:
inc word_20650
test byte ptr dword_20612, 1
jz short loc_1BF78
cmp byte_2066C, 0
cmp _reduce_effects, 0
jz short loc_1BF53
test byte ptr dword_20612, 3
jz short loc_1BF78
@ -33698,7 +33698,8 @@ byte_20664 db ?
db 5 dup(?)
byte_2066A db ?
byte_2066B db ?
byte_2066C db ?
public _reduce_effects
_reduce_effects db ?
byte_2066D db ?
word_2066E dw ?
word_20670 dw ?