[Reverse-engineering] [th02/th05] Player movement speed

Yes, both characters in TH04 have the same speed!

Funded by -Tom-.
This commit is contained in:
nmlgc 2018-12-26 22:03:23 +01:00
parent 261d5037ed
commit 8ee87233b8
4 changed files with 61 additions and 52 deletions

View File

@ -0,0 +1,8 @@
; All values are signed. (Yes, allowing you to invert the controls with
; negative values!)
public _playchar_speed_aligned_x, _playchar_speed_aligned_y
public _playchar_speed_diagonal_x, _playchar_speed_diagonal_y
_playchar_speed_aligned_x db ?
_playchar_speed_aligned_y db ?
_playchar_speed_diagonal_x db ?
_playchar_speed_diagonal_y db ?

View File

@ -3704,10 +3704,10 @@ loc_C5C2:
loc_C634:
mov playchar_shot_func, offset shot_a
mov byte_2060A, 5
mov byte_2060B, 5
mov byte_2060C, 4
mov byte_2060D, 4
mov _playchar_speed_aligned_x, 5
mov _playchar_speed_aligned_y, 5
mov _playchar_speed_diagonal_x, 4
mov _playchar_speed_diagonal_y, 4
mov byte_2060E, 30h ; '0'
pop bp
retn
@ -3715,10 +3715,10 @@ loc_C634:
loc_C655:
mov playchar_shot_func, offset shot_b
mov byte_2060A, 4
mov byte_2060B, 4
mov byte_2060C, 3
mov byte_2060D, 3
mov _playchar_speed_aligned_x, 4
mov _playchar_speed_aligned_y, 4
mov _playchar_speed_diagonal_x, 3
mov _playchar_speed_diagonal_y, 3
mov byte_2060E, 34h ; '4'
mov byte_2060F, 37h ; '7'
inc byte_1E51B
@ -3728,10 +3728,10 @@ loc_C655:
loc_C67F:
mov playchar_shot_func, offset shot_c
mov byte_2060A, 3
mov byte_2060B, 3
mov byte_2060C, 3
mov byte_2060D, 3
mov _playchar_speed_aligned_x, 3
mov _playchar_speed_aligned_y, 3
mov _playchar_speed_diagonal_x, 3
mov _playchar_speed_diagonal_y, 3
mov byte_1E518, 3
mov byte_2060E, 7Dh ; '}'
mov byte_2060F, 3Bh ; ';'
@ -9356,7 +9356,7 @@ loc_F222:
jmp cs:off_F443[bx]
loc_F238:
mov al, byte_2060B
mov al, _playchar_speed_aligned_y
cbw
neg ax
mov di, ax
@ -9365,7 +9365,7 @@ loc_F238:
; ---------------------------------------------------------------------------
loc_F244:
mov al, byte_2060B
mov al, _playchar_speed_aligned_y
cbw
mov di, ax
xor si, si
@ -9373,7 +9373,7 @@ loc_F244:
; ---------------------------------------------------------------------------
loc_F24E:
mov al, byte_2060A
mov al, _playchar_speed_aligned_x
cbw
neg ax
mov si, ax
@ -9383,7 +9383,7 @@ loc_F24E:
; ---------------------------------------------------------------------------
loc_F260:
mov al, byte_2060A
mov al, _playchar_speed_aligned_x
cbw
mov si, ax
xor di, di
@ -9392,13 +9392,13 @@ loc_F260:
; ---------------------------------------------------------------------------
loc_F270:
mov al, byte_2060D
mov al, _playchar_speed_diagonal_y
cbw
neg ax
loc_F276:
mov di, ax
mov al, byte_2060C
mov al, _playchar_speed_diagonal_x
cbw
neg ax
mov si, ax
@ -9407,11 +9407,11 @@ loc_F276:
; ---------------------------------------------------------------------------
loc_F288:
mov al, byte_2060D
mov al, _playchar_speed_diagonal_y
cbw
neg ax
mov di, ax
mov al, byte_2060C
mov al, _playchar_speed_diagonal_x
cbw
mov si, ax
mov word_1E512, 3
@ -9419,16 +9419,16 @@ loc_F288:
; ---------------------------------------------------------------------------
loc_F29E:
mov al, byte_2060D
mov al, _playchar_speed_diagonal_y
cbw
jmp short loc_F276
; ---------------------------------------------------------------------------
loc_F2A4:
mov al, byte_2060D
mov al, _playchar_speed_diagonal_y
cbw
mov di, ax
mov al, byte_2060C
mov al, _playchar_speed_diagonal_x
cbw
mov si, ax
mov word_1E512, 3
@ -9443,7 +9443,7 @@ loc_F2BC:
mov word_1E512, 0
loc_F2C2:
mov al, byte_2060A
mov al, _playchar_speed_aligned_x
cbw
cmp ax, 5
jnz short loc_F2FB
@ -37010,10 +37010,7 @@ byte_20606 db ?
byte_20607 db ?
byte_20608 db ?
byte_20609 db ?
byte_2060A db ?
byte_2060B db ?
byte_2060C db ?
byte_2060D db ?
include th02/playchar_speed[bss].asm
byte_2060E db ?
byte_2060F db ?
byte_20610 db ?

View File

@ -0,0 +1,7 @@
; All values are signed. (Yes, allowing you to invert the controls with
; negative values!)
public _playchar_speed_aligned, _playchar_speed_diagonal
_playchar_speed_aligned dw ?
dw ?
_playchar_speed_diagonal dw ?
dw ?

View File

@ -594,30 +594,30 @@ loc_B09F:
add bx, bx
jmp cs:off_B22F[bx]
loc_B0C4:
mov word_2CEAC, 38h ; '8'
mov word_2CEB0, 28h ; '('
playchar_reimu:
mov _playchar_speed_aligned, 56
mov _playchar_speed_diagonal, 40
mov fp_2429C, offset sub_C78E
jmp short loc_B112
; ---------------------------------------------------------------------------
loc_B0D8:
mov word_2CEAC, 40h
mov word_2CEB0, 30h ; '0'
playchar_marisa:
mov _playchar_speed_aligned, 64
mov _playchar_speed_diagonal, 48
mov fp_2429C, offset sub_C9DA
jmp short loc_B112
; ---------------------------------------------------------------------------
loc_B0EC:
mov word_2CEAC, 48h ; 'H'
mov word_2CEB0, 34h ; '4'
playchar_mima:
mov _playchar_speed_aligned, 72
mov _playchar_speed_diagonal, 52
mov fp_2429C, offset sub_CBFD
jmp short loc_B112
; ---------------------------------------------------------------------------
loc_B100:
mov word_2CEAC, 38h ; '8'
mov word_2CEB0, 28h ; '('
playchar_yuuka:
mov _playchar_speed_aligned, 56
mov _playchar_speed_diagonal, 40
mov fp_2429C, offset sub_CD94
loc_B112:
@ -730,10 +730,10 @@ off_B225 dw offset loc_B18A
dw offset loc_B1C0
dw offset loc_B1E3
dw offset loc_B206
off_B22F dw offset loc_B0C4
dw offset loc_B0D8
dw offset loc_B0EC
dw offset loc_B100
off_B22F dw offset playchar_reimu
dw offset playchar_marisa
dw offset playchar_mima
dw offset playchar_yuuka
; =============== S U B R O U T I N E =======================================
@ -14103,7 +14103,7 @@ sub_11DEA endp
sub_11FDF proc near
push bp
mov bp, sp
push 0C4C0h
push offset player_pos
call _motion_update_1
cmp ax, 80h
jge short loc_11FF2
@ -14346,7 +14346,7 @@ loc_12213:
; ---------------------------------------------------------------------------
loc_12224:
push 0C4C0h
push offset player_pos
call _motion_update_1
dec byte_2CEBD
@ -18963,9 +18963,9 @@ sub_142F8 proc near
mov bx, ss:[bx+2]
cmp bl, 0Ah
ja short loc_1434D
mov cx, word_2CEB0
mov cx, _playchar_speed_diagonal
mov ax, cx
mov dx, word_2CEAC
mov dx, _playchar_speed_aligned
and bh, 0Fh
jz short loc_14321
or bl, bl
@ -51729,10 +51729,7 @@ _stage_bgm_title dd ?
_boss_bgm_title dd ?
word_2CE9E dw ?
player_pos motion_t <?>
word_2CEAC dw ?
dw ?
word_2CEB0 dw ?
dw ?
include th05/playchar_speed[bss].asm
dword_2CEB4 dd ?
dword_2CEB8 dd ?
chara_invulnerable_time_left db ?