mirror of https://github.com/nmlgc/ReC98.git
[Reverse-engineering] [th01] Frame-based random number
Yes, no "generator", just a single number. Used to add some very minimal randomness to certain things, by taking it modulo a small number. Part of P0131, funded by Yanga.
This commit is contained in:
parent
21da5a330d
commit
bcdc073403
|
@ -4,6 +4,12 @@ extern rank_t rank;
|
||||||
extern bool bgm_mode;
|
extern bool bgm_mode;
|
||||||
extern char bombs;
|
extern char bombs;
|
||||||
extern char credit_bombs;
|
extern char credit_bombs;
|
||||||
|
|
||||||
|
// Current gameplay frame plus resident_t::rand, without any frame_delay().
|
||||||
|
// Displayed as "rand" in the debug output, but can't be /* ZUN symbol */'d
|
||||||
|
// like that, due to obviously colliding with the C standard library function.
|
||||||
|
extern unsigned long frame_rand;
|
||||||
|
|
||||||
extern char lives_extra;
|
extern char lives_extra;
|
||||||
|
|
||||||
extern char stage_num;
|
extern char stage_num;
|
||||||
|
|
|
@ -2790,7 +2790,7 @@ loc_D414:
|
||||||
add sp, 4
|
add sp, 4
|
||||||
pushd [dword_36C20]
|
pushd [dword_36C20]
|
||||||
push _bomb_doubletap_frames
|
push _bomb_doubletap_frames
|
||||||
pushd [_rand]
|
pushd [_frame_rand]
|
||||||
pushd [dword_34A62]
|
pushd [dword_34A62]
|
||||||
push ds
|
push ds
|
||||||
push offset aMain7luRand7lu ; " main:%7lu, rand:%7lu, bomb:%d, timer:%"...
|
push offset aMain7luRand7lu ; " main:%7lu, rand:%7lu, bomb:%d, timer:%"...
|
||||||
|
@ -2986,7 +2986,7 @@ loc_D54F:
|
||||||
push ds
|
push ds
|
||||||
push offset _continues_total
|
push offset _continues_total
|
||||||
push ds
|
push ds
|
||||||
push offset _rand
|
push offset _frame_rand
|
||||||
push ds
|
push ds
|
||||||
push offset _lives_extra
|
push offset _lives_extra
|
||||||
push ds
|
push ds
|
||||||
|
@ -3016,7 +3016,7 @@ loc_D583:
|
||||||
idiv ebx
|
idiv ebx
|
||||||
inc ax
|
inc ax
|
||||||
mov word_34A8A, ax
|
mov word_34A8A, ax
|
||||||
mov eax, _rand
|
mov eax, _frame_rand
|
||||||
mov random_seed, eax
|
mov random_seed, eax
|
||||||
call _game_init
|
call _game_init
|
||||||
call key_start
|
call key_start
|
||||||
|
@ -3658,7 +3658,7 @@ loc_DC3A:
|
||||||
mov byte_36C1E, 0
|
mov byte_36C1E, 0
|
||||||
mov _input_shot, 0
|
mov _input_shot, 0
|
||||||
mov byte_34A47, 1
|
mov byte_34A47, 1
|
||||||
mov eax, _rand
|
mov eax, _frame_rand
|
||||||
mov random_seed, eax
|
mov random_seed, eax
|
||||||
mov _bomb_doubletap_frames, BOMB_DOUBLETAP_WINDOW
|
mov _bomb_doubletap_frames, BOMB_DOUBLETAP_WINDOW
|
||||||
mov _first_stage_in_scene, 0
|
mov _first_stage_in_scene, 0
|
||||||
|
@ -3667,7 +3667,7 @@ loc_DC3A:
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
|
|
||||||
loc_DC64:
|
loc_DC64:
|
||||||
inc _rand
|
inc _frame_rand
|
||||||
mov ax, _lives
|
mov ax, _lives
|
||||||
imul ax, 200
|
imul ax, 200
|
||||||
mov dx, 1800
|
mov dx, 1800
|
||||||
|
@ -3678,7 +3678,7 @@ loc_DC64:
|
||||||
sub dx, ax
|
sub dx, ax
|
||||||
mov [bp+var_C], dx
|
mov [bp+var_C], dx
|
||||||
movsx ebx, [bp+var_C]
|
movsx ebx, [bp+var_C]
|
||||||
mov eax, _rand
|
mov eax, _frame_rand
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
div ebx
|
div ebx
|
||||||
cmp edx, 0
|
cmp edx, 0
|
||||||
|
@ -3713,7 +3713,7 @@ loc_DCCA:
|
||||||
inc _orb_force_frame
|
inc _orb_force_frame
|
||||||
inc dword_34A62
|
inc dword_34A62
|
||||||
inc _bomb_doubletap_frames
|
inc _bomb_doubletap_frames
|
||||||
test byte ptr _rand, 3
|
test byte ptr _frame_rand, 3
|
||||||
jnz short loc_DCFA
|
jnz short loc_DCFA
|
||||||
call sub_1938A
|
call sub_1938A
|
||||||
|
|
||||||
|
@ -3839,7 +3839,7 @@ loc_DE72:
|
||||||
call _z_vsync_wait_and_scrollup stdcall, 0
|
call _z_vsync_wait_and_scrollup stdcall, 0
|
||||||
pop cx
|
pop cx
|
||||||
les bx, _resident
|
les bx, _resident
|
||||||
mov eax, _rand
|
mov eax, _frame_rand
|
||||||
mov es:[bx+reiidenconfig_t.rand], eax
|
mov es:[bx+reiidenconfig_t.rand], eax
|
||||||
mov _test_damage, 0
|
mov _test_damage, 0
|
||||||
mov dword_34A62, 0C8h ; 'È'
|
mov dword_34A62, 0C8h ; 'È'
|
||||||
|
@ -19704,7 +19704,7 @@ loc_21AAE:
|
||||||
jz short loc_21AE9
|
jz short loc_21AE9
|
||||||
|
|
||||||
loc_21AD5:
|
loc_21AD5:
|
||||||
pushd [_rand]
|
pushd [_frame_rand]
|
||||||
nopcall sub_22234
|
nopcall sub_22234
|
||||||
add sp, 4
|
add sp, 4
|
||||||
cmp ax, 1
|
cmp ax, 1
|
||||||
|
@ -20256,7 +20256,7 @@ loc_21F23:
|
||||||
cwd
|
cwd
|
||||||
idiv bx
|
idiv bx
|
||||||
movsx eax, dx
|
movsx eax, dx
|
||||||
mov edx, _rand
|
mov edx, _frame_rand
|
||||||
and edx, 1
|
and edx, 1
|
||||||
cmp eax, edx
|
cmp eax, edx
|
||||||
jnz short loc_21F7D
|
jnz short loc_21F7D
|
||||||
|
@ -20378,7 +20378,7 @@ loc_2207D:
|
||||||
cwd
|
cwd
|
||||||
idiv bx
|
idiv bx
|
||||||
movsx eax, dx
|
movsx eax, dx
|
||||||
mov edx, _rand
|
mov edx, _frame_rand
|
||||||
and edx, 1
|
and edx, 1
|
||||||
cmp eax, edx
|
cmp eax, edx
|
||||||
jnz short loc_220A1
|
jnz short loc_220A1
|
||||||
|
@ -20430,7 +20430,7 @@ loc_220F6:
|
||||||
cwd
|
cwd
|
||||||
idiv bx
|
idiv bx
|
||||||
movsx eax, dx
|
movsx eax, dx
|
||||||
mov edx, _rand
|
mov edx, _frame_rand
|
||||||
and edx, 1
|
and edx, 1
|
||||||
cmp eax, edx
|
cmp eax, edx
|
||||||
jnz loc_221C1
|
jnz loc_221C1
|
||||||
|
@ -25345,7 +25345,7 @@ sub_24FE0 proc far
|
||||||
mov _boss_hp, 14
|
mov _boss_hp, 14
|
||||||
mov _hud_hp_first_white, 10
|
mov _hud_hp_first_white, 10
|
||||||
mov _hud_hp_first_redwhite, 6
|
mov _hud_hp_first_redwhite, 6
|
||||||
mov eax, _rand
|
mov eax, _frame_rand
|
||||||
mov random_seed, eax
|
mov random_seed, eax
|
||||||
xor si, si
|
xor si, si
|
||||||
jmp short loc_250B3
|
jmp short loc_250B3
|
||||||
|
@ -30775,7 +30775,7 @@ loc_2871C:
|
||||||
call _graph_accesspage_func
|
call _graph_accesspage_func
|
||||||
call _pagetrans_diagonal_8x8 stdcall, 40
|
call _pagetrans_diagonal_8x8 stdcall, 40
|
||||||
add sp, 0Ch
|
add sp, 0Ch
|
||||||
mov eax, _rand
|
mov eax, _frame_rand
|
||||||
mov random_seed, eax
|
mov random_seed, eax
|
||||||
pop si
|
pop si
|
||||||
pop bp
|
pop bp
|
||||||
|
@ -36662,7 +36662,7 @@ loc_2C117:
|
||||||
mov word_3B431, 0
|
mov word_3B431, 0
|
||||||
call @boss_palette_snap$qv
|
call @boss_palette_snap$qv
|
||||||
call _stage_palette_set c, offset _z_Palettes, ds
|
call _stage_palette_set c, offset _z_Palettes, ds
|
||||||
mov eax, _rand
|
mov eax, _frame_rand
|
||||||
mov random_seed, eax
|
mov random_seed, eax
|
||||||
|
|
||||||
loc_2C14E:
|
loc_2C14E:
|
||||||
|
@ -37367,7 +37367,7 @@ loc_2C8AE:
|
||||||
call sub_19E48
|
call sub_19E48
|
||||||
pop cx
|
pop cx
|
||||||
mov word_3B431, 0
|
mov word_3B431, 0
|
||||||
mov eax, _rand
|
mov eax, _frame_rand
|
||||||
mov random_seed, eax
|
mov random_seed, eax
|
||||||
call _mdrv2_bgm_fade_out_nonblock
|
call _mdrv2_bgm_fade_out_nonblock
|
||||||
push 1
|
push 1
|
||||||
|
@ -40895,7 +40895,7 @@ var_2 = word ptr -2
|
||||||
mov word_3B529, 0
|
mov word_3B529, 0
|
||||||
mov _konngara_initial_hp_rendered, 0
|
mov _konngara_initial_hp_rendered, 0
|
||||||
call @boss_palette_snap$qv
|
call @boss_palette_snap$qv
|
||||||
mov eax, _rand
|
mov eax, _frame_rand
|
||||||
mov random_seed, eax
|
mov random_seed, eax
|
||||||
jmp loc_2FC40
|
jmp loc_2FC40
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
|
@ -43083,7 +43083,8 @@ _INIT_ ends
|
||||||
public _credit_bombs
|
public _credit_bombs
|
||||||
_credit_bombs db ?
|
_credit_bombs db ?
|
||||||
byte_36C15 db ?
|
byte_36C15 db ?
|
||||||
_rand dd ?
|
public _frame_rand
|
||||||
|
_frame_rand dd ?
|
||||||
dword_36C1A dd ?
|
dword_36C1A dd ?
|
||||||
byte_36C1E db ?
|
byte_36C1E db ?
|
||||||
public _mode_debug
|
public _mode_debug
|
||||||
|
|
Loading…
Reference in New Issue