Finish s03b (with annoying inline)

We matched this function a while ago but didn't get around to merging,
partly because it has an annoying inline to deal with f802's tomfoolery.
This commit is contained in:
Kieron 2024-03-22 16:47:36 +00:00
parent 65d12023e5
commit fbe83d22a7
5 changed files with 153 additions and 226 deletions

View File

@ -259,7 +259,7 @@ Individual overlay progress:
<td><b>s03b</b></td>
<td>66 KB</td>
<td>Medical Room</td>
<td>🚧 Work in progress</td>
<td><b>✔️ 100% decompiled!</b></td>
</tr>
<tr>
<td><b>s03c</b></td>

View File

@ -1,183 +0,0 @@
opt c+, at+, e+, n-
section overlay.text
xdef s03b_torture_800C4740
s03b_torture_800C4740:
dw 0x27BDFFE8 ; 800C4740
dw 0xAFB00010 ; 800C4744
dw 0xAFBF0014 ; 800C4748
dw 0x0C0325D3 ; 800C474C
dw 0x00808021 ; 800C4750
dw 0x3C02800B ; 800C4754
dw 0x944205E2 ; 800C4758
dw 0x00000000 ; 800C475C
dw 0x30420040 ; 800C4760
dw 0x10400007 ; 800C4764
dw 0x3C02800C ; 800C4768
dw 0x244246B8 ; 800C476C
dw 0xAE020808 ; 800C4770
dw 0xA600081A ; 800C4774
dw 0xA6000818 ; 800C4778
dw 0x0803127E ; 800C477C
dw 0xAE00080C ; 800C4780
dw 0x86030818 ; 800C4784
dw 0x00000000 ; 800C4788
dw 0x2C620006 ; 800C478C
dw 0x10400099 ; 800C4790
dw 0x3C02800D ; 800C4794
dw 0x24422E94 ; 800C4798
dw 0x00031880 ; 800C479C
dw 0x00621821 ; 800C47A0
dw 0x8C620000 ; 800C47A4
dw 0x00000000 ; 800C47A8
dw 0x00400008 ; 800C47AC
dw 0x00000000 ; 800C47B0
dw 0x8602081A ; 800C47B4
dw 0x00000000 ; 800C47B8
dw 0x14400003 ; 800C47BC
dw 0x24040001 ; 800C47C0
dw 0x0C0325A7 ; 800C47C4
dw 0x3405EA60 ; 800C47C8
dw 0x8E0208FC ; 800C47CC
dw 0x00000000 ; 800C47D0
dw 0x14400005 ; 800C47D4
dw 0x24040001 ; 800C47D8
dw 0x00002821 ; 800C47DC
dw 0x0C0340FA ; 800C47E0
dw 0x00A03021 ; 800C47E4
dw 0xAE0208FC ; 800C47E8
dw 0x9602081A ; 800C47EC
dw 0x240300C8 ; 800C47F0
dw 0x24420001 ; 800C47F4
dw 0xA602081A ; 800C47F8
dw 0x00021400 ; 800C47FC
dw 0x00021403 ; 800C4800
dw 0x1443007C ; 800C4804
dw 0x00000000 ; 800C4808
dw 0x96020818 ; 800C480C
dw 0xA600081A ; 800C4810
dw 0x0803127D ; 800C4814
dw 0x24420001 ; 800C4818
dw 0x86020820 ; 800C481C
dw 0x00000000 ; 800C4820
dw 0x24420003 ; 800C4824
dw 0x00021080 ; 800C4828
dw 0x02021021 ; 800C482C
dw 0x8C44087C ; 800C4830
dw 0x0C0324EB ; 800C4834
dw 0x00000000 ; 800C4838
dw 0x96020820 ; 800C483C
dw 0x24030002 ; 800C4840
dw 0xA6030818 ; 800C4844
dw 0x24420001 ; 800C4848
dw 0x0803127E ; 800C484C
dw 0xA6020820 ; 800C4850
dw 0x0C03257B ; 800C4854
dw 0x00000000 ; 800C4858
dw 0x10400066 ; 800C485C
dw 0x24020004 ; 800C4860
dw 0x86030820 ; 800C4864
dw 0x00000000 ; 800C4868
dw 0x14620061 ; 800C486C
dw 0x24020003 ; 800C4870
dw 0x0C0325BA ; 800C4874
dw 0x00000000 ; 800C4878
dw 0x96020802 ; 800C487C
dw 0x00000000 ; 800C4880
dw 0x34420004 ; 800C4884
dw 0x0803127E ; 800C4888
dw 0xA6020802 ; 800C488C
dw 0x96020802 ; 800C4890
dw 0x24030700 ; 800C4894
dw 0x30420700 ; 800C4898
dw 0x10430003 ; 800C489C
dw 0x24020096 ; 800C48A0
dw 0x0803127C ; 800C48A4
dw 0xA602081A ; 800C48A8
dw 0x86050820 ; 800C48AC
dw 0x02002021 ; 800C48B0
dw 0x0C03110E ; 800C48B4
dw 0x24A5FFFF ; 800C48B8
dw 0x24020001 ; 800C48BC
dw 0x0803127D ; 800C48C0
dw 0xA600081A ; 800C48C4
dw 0x9602081A ; 800C48C8
dw 0x00000000 ; 800C48CC
dw 0x2442FFFF ; 800C48D0
dw 0xA602081A ; 800C48D4
dw 0x00021400 ; 800C48D8
dw 0x14400008 ; 800C48DC
dw 0x02002021 ; 800C48E0
dw 0x84850820 ; 800C48E4
dw 0x24020001 ; 800C48E8
dw 0xA4820818 ; 800C48EC
dw 0x0C03110E ; 800C48F0
dw 0x24A5FFFF ; 800C48F4
dw 0x0803127E ; 800C48F8
dw 0x00000000 ; 800C48FC
dw 0x8E020834 ; 800C4900
dw 0x00000000 ; 800C4904
dw 0x94450000 ; 800C4908
dw 0x00000000 ; 800C490C
dw 0x10A00039 ; 800C4910
dw 0x30A2F000 ; 800C4914
dw 0x10400009 ; 800C4918
dw 0x2404FFFF ; 800C491C
dw 0x92020803 ; 800C4920
dw 0x96030802 ; 800C4924
dw 0x30420001 ; 800C4928
dw 0x14400005 ; 800C492C
dw 0x30A2000F ; 800C4930
dw 0x8E040884 ; 800C4934
dw 0x08031263 ; 800C4938
dw 0x34620100 ; 800C493C
dw 0x30A2000F ; 800C4940
dw 0x10400009 ; 800C4944
dw 0x30A200E0 ; 800C4948
dw 0x86020802 ; 800C494C
dw 0x96030802 ; 800C4950
dw 0x30420200 ; 800C4954
dw 0x14400004 ; 800C4958
dw 0x30A200E0 ; 800C495C
dw 0x8E04087C ; 800C4960
dw 0x08031263 ; 800C4964
dw 0x34620200 ; 800C4968
dw 0x10400008 ; 800C496C
dw 0x00000000 ; 800C4970
dw 0x86020802 ; 800C4974
dw 0x96030802 ; 800C4978
dw 0x30420400 ; 800C497C
dw 0x14400003 ; 800C4980
dw 0x34620400 ; 800C4984
dw 0x8E040880 ; 800C4988
dw 0xA6020802 ; 800C498C
dw 0x04800019 ; 800C4990
dw 0x00000000 ; 800C4994
dw 0x0C0324EB ; 800C4998
dw 0x00000000 ; 800C499C
dw 0x0803127D ; 800C49A0
dw 0x24020005 ; 800C49A4
dw 0x0C03257B ; 800C49A8
dw 0x00000000 ; 800C49AC
dw 0x10400011 ; 800C49B0
dw 0x00000000 ; 800C49B4
dw 0x9602081A ; 800C49B8
dw 0x00000000 ; 800C49BC
dw 0x2442FF38 ; 800C49C0
dw 0xA602081A ; 800C49C4
dw 0x00021400 ; 800C49C8
dw 0x1C400009 ; 800C49CC
dw 0x24020004 ; 800C49D0
dw 0x86050820 ; 800C49D4
dw 0x02002021 ; 800C49D8
dw 0x0C03110E ; 800C49DC
dw 0x24A5FFFF ; 800C49E0
dw 0x24020001 ; 800C49E4
dw 0x0803127D ; 800C49E8
dw 0xA600081A ; 800C49EC
dw 0x24020004 ; 800C49F0
dw 0xA6020818 ; 800C49F4
dw 0x8FBF0014 ; 800C49F8
dw 0x8FB00010 ; 800C49FC
dw 0x03E00008 ; 800C4A00
dw 0x27BD0018 ; 800C4A04

View File

@ -93,29 +93,22 @@ extern char s03b_dword_800C32D8[];
extern char s03b_dword_800D32F0[16];
extern const char s03b_dword_800D2E5C[];
extern const char s03b_aTurn_800D2E64[];
extern const char s03b_aLeave_800D2E6C[];
extern const char s03b_dword_800D2E74[];
extern const char s03b_dword_800D2E80[];
extern const char s03b_aTime_800D2E8C[];
extern const char s03b_aMode_800D2EAC[];
extern const char s03b_aGoubg_800D2EB4[];
extern const char s03b_aGoumon_800D2EBC[];
GV_ACT *NewFadeIo_800C4224(int name, int where);
GV_ACT *NewPlasma_800CD1A4(OBJECT *, int, int, int, int, int);
GV_ACT *NewInfo_800CA534(unsigned short name1, unsigned short name2, int *abe);
GV_ACT * NewFadeIo_800C4224(int name, int where);
GV_ACT * NewPlasma_800CD1A4(OBJECT *, int, int, int, int, int);
GV_ACT * NewInfo_800CA534(unsigned short name1, unsigned short name2, int *abe);
GV_ACT * NewBlur_800CD530(int, int, int);
void InfoKill_800CA5D0(void);
void s03b_boxall_800C9328(void);
void s03b_boxall_800C93AC(int);
void s03b_boxall_800C93F0(int, int);
void s03b_boxall_800C9404(void);
int s03b_boxall_800C95EC(void);
int s03b_boxall_800C9654(int);
void s03b_boxall_800C969C(int, int);
void s03b_boxall_800C96E8(void);
void s03b_boxall_800C974C(void);
void s03b_torture_800C4C48(TortureWork *work, int);
void s03b_torture_800C5AF8(TortureWork *work, int);
@ -365,9 +358,9 @@ void s03b_torture_800C435C(TortureWork *work, int vx)
f802 = work->f802;
if (f802 & 0x8)
{
msg.address = GV_StrCode_80016CCC(s03b_dword_800D2E5C);
msg.address = GV_StrCode_80016CCC("拷問台");
msg.message_len = 2;
msg.message[0] = GV_StrCode_80016CCC(s03b_aTurn_800D2E64);
msg.message[0] = GV_StrCode_80016CCC("turn");
if (abs(vx) >= 2048)
{
@ -386,9 +379,9 @@ void s03b_torture_800C43F0(void)
{
GV_MSG msg;
msg.address = GV_StrCode_80016CCC(s03b_dword_800D2E5C);
msg.address = GV_StrCode_80016CCC("拷問台");
msg.message_len = 1;
msg.message[0] = GV_StrCode_80016CCC(s03b_aLeave_800D2E6C);
msg.message[0] = GV_StrCode_80016CCC("leave");
GV_SendMessage_80016504(&msg);
}
@ -397,7 +390,7 @@ void s03b_torture_800C4438(TortureWork *work, int message)
{
GV_MSG msg;
msg.address = GV_StrCode_80016CCC(s03b_dword_800D2E74);
msg.address = GV_StrCode_80016CCC("リキッド");
msg.message_len = 1;
msg.message[0] = message;
@ -408,7 +401,7 @@ void s03b_torture_800C447C(TortureWork *work, int arg1, int arg2)
{
GV_MSG msg;
msg.address = GV_StrCode_80016CCC(s03b_dword_800D2E80);
msg.address = GV_StrCode_80016CCC("オセロット");
msg.message_len = 2;
msg.message[0] = arg1;
msg.message[1] = arg2;
@ -463,7 +456,7 @@ int s03b_torture_800C45E4(TortureWork *work)
{
MENU_BAR_CONF *conf;
memcpy(s03b_dword_800D32F0, s03b_aTime_800D2E8C, 5);
memcpy(s03b_dword_800D32F0, "Time", 5);
conf = &work->time_conf;
conf->field_0_text = s03b_dword_800D32F0;
@ -530,8 +523,142 @@ void s03b_torture_800C46B8(TortureWork *work, int arg1)
}
}
#pragma INCLUDE_ASM("asm/overlays/s03b/s03b_torture_800C4740.s")
void s03b_torture_800C4740(TortureWork *work);
// TODO: This is wrong.
// All other accesses to f802 are doing weird things (lh vs lhu),
// but we have been working around it by assigning them to ints.
static inline char s03b_torture_helper_800C4740(TortureWork *work)
{
return LLOAD(&work->f802) >> 8;
}
void s03b_torture_800C4740(TortureWork *work)
{
int status;
int vox_stream;
int f802;
s03b_boxall_800C974C();
if (GV_PadData_800B05C0[2].press & PAD_CROSS)
{
work->f808 = s03b_torture_800C46B8;
work->f81A = 0;
work->f818 = 0;
work->f80C = 0;
return;
}
switch(work->f818)
{
case 0:
if (work->f81A == 0)
{
s03b_boxall_800C969C(1, 60000);
}
if (work->f8FC == 0)
{
work->f8FC = NewBlur_800CD530(1, 0, 0);
}
if (++work->f81A == 200)
{
work->f81A = 0;
work->f818++;
}
break;
case 1:
s03b_boxall_800C93AC(work->f87C[work->f820 + 3]);
work->f818 = 2;
work->f820++;
break;
case 2:
if (s03b_boxall_800C95EC())
{
if (work->f820 == 4)
{
s03b_boxall_800C96E8();
work->f802 |= 0x4;
}
else
{
work->f818 = 3;
}
}
break;
case 3:
if ((work->f802 & 0x700) != 0x700)
{
work->f81A = 150;
work->f818 = 4;
}
else
{
s03b_torture_800C4438(work, work->f820 - 1);
work->f81A = 0;
work->f818 = 1;
}
break;
case 4:
if (work->f81A-- == 1)
{
work->f818 = 1;
s03b_torture_800C4438(work, work->f820 - 1);
break;
}
status = work->f834->status;
if (status == 0)
{
break;
}
vox_stream = -1;
if ((status & 0xf000) != 0 && (f802 = work->f802, (s03b_torture_helper_800C4740(work) & 0x1) == 0))
{
work->f802 |= 0x100;
vox_stream = work->f87C[2];
}
else if ((status & 0xf) != 0 && (f802 = work->f802, (f802 & 0x200) == 0))
{
work->f802 |= 0x200;
vox_stream = work->f87C[0];
}
else if ((status & 0xe0) != 0 && (f802 = work->f802, (f802 & 0x400) == 0))
{
work->f802 |= 0x400;
vox_stream = work->f87C[1];
}
if (vox_stream >= 0)
{
s03b_boxall_800C93AC(vox_stream);
work->f818 = 5;
}
break;
case 5:
if (s03b_boxall_800C95EC())
{
work->f81A -= 200;
if (work->f81A < 1)
{
s03b_torture_800C4438(work, work->f820 - 1);
work->f81A = 0;
work->f818 = 1;
}
else
{
work->f818 = 4;
}
}
break;
}
}
void s03b_torture_800C4A08(TortureWork *work)
{
@ -609,7 +736,7 @@ void s03b_torture_800C4C48(TortureWork *work, int arg1)
if (arg1 == 0)
{
s03b_torture_800C447C(work, GV_StrCode_80016CCC(s03b_aMode_800D2EAC), 4);
s03b_torture_800C447C(work, GV_StrCode_80016CCC("mode"), 4);
args.argc = 1;
args.argv = data;
@ -816,7 +943,7 @@ void s03b_torture_800C50A8(TortureWork *work, int arg1)
control->field_4C_turn.vy = 2048;
control->field_8_rot.vy = 2048;
s03b_torture_800C447C(work, GV_StrCode_80016CCC(s03b_aMode_800D2EAC), 3);
s03b_torture_800C447C(work, GV_StrCode_80016CCC("mode"), 3);
work->f820 = 0xB7;
work->f802 |= 0x8;
@ -959,8 +1086,7 @@ void s03b_torture_800C5420(TortureWork *work, int arg1)
{
abe[0] = 1;
abe[1] = 0;
NewInfo_800CA534(GV_StrCode_80016CCC(s03b_aGoubg_800D2EB4), GV_StrCode_80016CCC(s03b_aGoumon_800D2EBC),
abe);
NewInfo_800CA534(GV_StrCode_80016CCC("gou_bg"), GV_StrCode_80016CCC("goumon"), abe);
}
GM_SeSet2_80032968(0, 0x3F, 0xB4);
}

View File

@ -65,19 +65,3 @@ int s03b_dword_800C335C = 0x800D2F30;
int s03b_dword_800C3360 = 0x800D2F2C;
int s03b_dword_800C3364 = 0x800D2F28;
int s03b_dword_800C3368 = 0x800D2F24;
const char s03b_dword_800D2E5C[] = "拷問台";
const char s03b_aTurn_800D2E64[] = "turn";
const char s03b_aLeave_800D2E6C[] = "leave";
const char s03b_dword_800D2E74[] = "リキッド";
const char s03b_dword_800D2E80[] = "オセロット";
const char s03b_aTime_800D2E8C[] = "Time";
const int s03b_dword_800D2E94 = 0x800C47B4;
const int s03b_dword_800D2E98 = 0x800C481C;
const int s03b_dword_800D2E9C = 0x800C4854;
const int s03b_dword_800D2EA0 = 0x800C4890;
const int s03b_dword_800D2EA4 = 0x800C48C8;
const int s03b_dword_800D2EA8 = 0x800C49A8;
const char s03b_aMode_800D2EAC[] = "mode";
const char s03b_aGoubg_800D2EB4[] = "gou_bg";
const char s03b_aGoumon_800D2EBC[] = "goumon";

Binary file not shown.