From 4030ef737a6fbe029552c979cb9ec4aafa313987 Mon Sep 17 00:00:00 2001 From: nmlgc Date: Sun, 1 Dec 2019 18:13:28 +0100 Subject: [PATCH] [Reverse-engineering] [th03] Character movement and gauge charge speeds Part of P0061, funded by Touhou Patch Center. --- th03/chars/chars.h | 12 ++++++++ th03/chars/speeds[data].asm | 24 ++++++++++++++++ th03_main.asm | 55 ++----------------------------------- 3 files changed, 39 insertions(+), 52 deletions(-) create mode 100644 th03/chars/speeds[data].asm diff --git a/th03/chars/chars.h b/th03/chars/chars.h index ec38ec63..492a0316 100644 --- a/th03/chars/chars.h +++ b/th03/chars/chars.h @@ -10,3 +10,15 @@ typedef enum { PLAYCHAR_YUMEMI = 8 PLAYCHAR_COUNT = 9 } playchars_t; + +typedef struct { + SPPoint8 aligned; + SPPoint8 diagonal; +} speed_t; + +typedef struct { + speed_t motion; + unsigned char gauge_charge; +} playchar_speeds_t; + +extern playchar_speeds_t PLAYCHAR_SPEEDS[PLAYCHAR_COUNT + 1]; diff --git a/th03/chars/speeds[data].asm b/th03/chars/speeds[data].asm new file mode 100644 index 00000000..8551daad --- /dev/null +++ b/th03/chars/speeds[data].asm @@ -0,0 +1,24 @@ +include th03/math/subpixel.inc + +speed_t struc + aligned SPPoint8 + diagonal SPPoint8 +speed_t ends + +playchar_speeds_t struc + motion speed_t + gauge_charge db ? +playchar_speeds_t ends + +public _PLAYCHAR_SPEEDS +_PLAYCHAR_SPEEDS label playchar_speeds_t + db (4 shl 4), (4 shl 4), (3 shl 4), (3 shl 4), 32 ; Reimu + db (4 shl 4) + 8, (4 shl 4) + 8, (3 shl 4) + 6, (3 shl 4) + 6, 20 ; Mima + db (4 shl 4), (4 shl 4), (3 shl 4), (3 shl 4), 28 ; Marisa + db (3 shl 4) + 4, (3 shl 4) + 4, (2 shl 4) + 14, (2 shl 4) + 14, 14 ; Ellen + db (4 shl 4) + 4, (4 shl 4) + 4, (3 shl 4) + 4, (3 shl 4) + 4, 28 ; Kotohime + db (3 shl 4) + 8, (3 shl 4) + 8, (2 shl 4) + 12, (2 shl 4) + 12, 32 ; Kana + db (4 shl 4) + 8, (4 shl 4) + 8, (3 shl 4) + 6, (3 shl 4) + 6, 16 ; Rikako + db (5 shl 4), (5 shl 4), (4 shl 4), (4 shl 4), 28 ; Chiyuri + db (5 shl 4), (5 shl 4), (4 shl 4), (4 shl 4), 20 ; Yumemi + db (size playchar_speeds_t) dup(0) diff --git a/th03_main.asm b/th03_main.asm index 8235f18a..4b962cad 100644 --- a/th03_main.asm +++ b/th03_main.asm @@ -848,8 +848,8 @@ loc_9D85: sub ax, dx sar ax, 1 mov [bp+var_2], ax - imul ax, 5 - add ax, 108h + imul ax, size playchar_speeds_t + add ax, offset _PLAYCHAR_SPEEDS mov [bp+var_8], ax mov ax, si shl ax, 7 @@ -35752,56 +35752,7 @@ main_11_TEXT ends db 3 db 0BCh db 2 - db 40h - db 40h - db 30h ; 0 - db 30h ; 0 - db 20h - db 48h ; H - db 48h ; H - db 36h ; 6 - db 36h ; 6 - db 14h - db 40h - db 40h - db 30h ; 0 - db 30h ; 0 - db 1Ch - db 34h ; 4 - db 34h ; 4 - db 2Eh ; . - db 2Eh ; . - db 0Eh - db 44h ; D - db 44h ; D - db 34h ; 4 - db 34h ; 4 - db 1Ch - db 38h ; 8 - db 38h ; 8 - db 2Ch ; , - db 2Ch ; , - db 20h - db 48h ; H - db 48h ; H - db 36h ; 6 - db 36h ; 6 - db 10h - db 50h ; P - db 50h ; P - db 40h - db 40h - db 1Ch - db 50h ; P - db 50h ; P - db 40h - db 40h - db 14h - db 0 - db 0 - db 0 - db 0 - db 0 +include th03/chars/speeds[data].asm aCOul db '–²Žž‹ó2.dat',0 aGameft_bft db 'GAMEFT.bft',0 aOp db 'op',0