figurine cleanup

This commit is contained in:
theo3 2022-03-28 17:26:07 -07:00
parent 52439a0fc8
commit 6cf555f074
23 changed files with 81 additions and 92 deletions

View File

@ -263,7 +263,7 @@
.equiv SFX_106, 0x106
.equiv SFX_107, 0x107
.equiv SFX_108, 0x108
.equiv SFX_109, 0x109
.equiv SFX_ITEM_GET, 0x109
.equiv SFX_10A, 0x10a
.equiv SFX_10B, 0x10b
.equiv SFX_BUTTON_PRESS, 0x10c

View File

@ -2,9 +2,9 @@
SCRIPT_START script_PlayerGetSword
SetInventoryValue 0x0001, 0x0001
CallWithArg PutItemAnySlot, 0x00000001
PlaySound SFX_109
PlaySound SFX_ITEM_GET
CallWithArg SetPlayerAnimation2, 0x0000045f
Call WaitForPlayerFrameHiBit
Call WaitForPlayerAnim
MessageFromTargetPos 0x0501, 0x000e
WaitUntilTextboxCloses
SetSyncFlag 0x00000020

View File

@ -3,16 +3,16 @@ SCRIPT_START script_PlayerGetGreenCap
BeginBlock
Call sub_08094BE0
CallWithArg SetPlayerAnimation2, 0x0000045b
PlaySound SFX_109
PlaySound SFX_ITEM_GET
EndBlock
Call WaitForPlayerFrameHiBit
Call WaitForPlayerAnim
Wait 0x005a
SetSyncFlag 0x00000008
BeginBlock
CallWithArg ResetPlayerFlag, 0x00000008
CallWithArg SetPlayerAnimation2, 0x000008e4
EndBlock
Call WaitForPlayerFrameHiBit
Call WaitForPlayerAnim
SetAnimationState 0x0004
DoPostScriptAction 0x0000
Wait 0x003c

View File

@ -8,11 +8,11 @@ SCRIPT_START script_PlayerAtTakeover
SetAnimationState 0x0004
DoPostScriptAction 0x0000
CallWithArg SetPlayerAnimation2, 0x000003c5
Call WaitForPlayerFrameHiBit
Call WaitForPlayerAnim
MessageFromTargetPos 0x1318, 0x000c
WaitUntilTextboxCloses
CallWithArg SetPlayerAnimation2, 0x000003c9
Call WaitForPlayerFrameHiBit
Call WaitForPlayerAnim
SetAnimationState 0x0004
DoPostScriptAction 0x0000
SetSyncFlag 0x00000100

View File

@ -4,7 +4,7 @@ SCRIPT_START script_PlayerStonesFall
SetAnimationState 0x0004
DoPostScriptAction 0x0000
CallWithArg SetPlayerAnimation2, 0x000003c5
Call WaitForPlayerFrameHiBit
Call WaitForPlayerAnim
SetSyncFlag 0x00000004
Call SetPlayerActionNormal
SCRIPT_END

View File

@ -8,7 +8,7 @@ SCRIPT_START script_DampeInside
Call sub_0806BE84
WaitUntilTextboxCloses
JumpIfNot script_08009622
PlaySound SFX_109
PlaySound SFX_ITEM_GET
_0807F088 0x003c
MessageFromTarget 0x053c
WaitPlayerGetItem

View File

@ -2,9 +2,9 @@
SCRIPT_START script_PlayerGetWhiteSword
SetInventoryValue 0x0002, 0x0001
CallWithArg PutItemAnySlot, 0x00000002
PlaySound SFX_109
PlaySound SFX_ITEM_GET
CallWithArg SetPlayerAnimation2, 0x000001e2
Call WaitForPlayerFrameHiBit
Call WaitForPlayerAnim
MessageNoOverlap 0x0502
WaitUntilTextboxCloses
SetSyncFlag 0x00000008

View File

@ -55,7 +55,7 @@ script_080134F8:
SetInventoryValue 0x0003, 0x0001
Call NPC4E_SaveEquippedItems
Call NPC4E_RestoreEquippedItems
Call WaitForPlayerFrameHiBit
Call WaitForPlayerAnim
Wait 0x003c
SetFadeTime 0x0004
SetFade7
@ -66,7 +66,7 @@ script_080134F8:
SetFadeTime 0x0002
SetFade6
WaitForFadeFinish
PlaySound SFX_109
PlaySound SFX_ITEM_GET
MessageFromTargetPos 0x0503, 0x000c
WaitUntilTextboxCloses
SetSyncFlag 0x00040000

View File

@ -58,7 +58,7 @@ script_0801373C:
SetInventoryValue 0x0004, 0x0001
Call NPC4E_SaveEquippedItems
Call NPC4E_RestoreEquippedItems
Call WaitForPlayerFrameHiBit
Call WaitForPlayerAnim
Wait 0x003c
SetFadeTime 0x0004
SetFade7
@ -69,7 +69,7 @@ script_0801373C:
SetFadeTime 0x0002
SetFade6
WaitForFadeFinish
PlaySound SFX_109
PlaySound SFX_ITEM_GET
MessageFromTargetPos 0x0504, 0x000c
WaitUntilTextboxCloses
SetSyncFlag 0x00040000

View File

@ -63,7 +63,7 @@ script_080138D0:
Call UpdatePlayerSkills
Call NPC4E_SaveEquippedItems
Call NPC4E_RestoreEquippedItems
Call WaitForPlayerFrameHiBit
Call WaitForPlayerAnim
Wait 0x003c
SetFadeTime 0x0004
SetFade7
@ -74,7 +74,7 @@ script_080138D0:
SetFadeTime 0x0002
SetFade6
WaitForFadeFinish
PlaySound SFX_109
PlaySound SFX_ITEM_GET
MessageFromTargetPos 0x0505, 0x000c
WaitUntilTextboxCloses
SetSyncFlag 0x00040000

View File

@ -6,7 +6,7 @@ SCRIPT_START script_PlayerPickUpFinalSword
Call sub_08096028
Wait 0x0078
SetSyncFlag 0x00020000
Call WaitForPlayerFrameHiBit
Call WaitForPlayerAnim
Wait 0x0078
WaitForSyncFlagAndClear 0x00040000
Call SetPlayerActionNormal

View File

@ -5,7 +5,7 @@ SCRIPT_START script_PlayerPickUpSword
Call sub_08096028
Wait 0x003c
SetSyncFlag 0x00020000
Call WaitForPlayerFrameHiBit
Call WaitForPlayerAnim
Wait 0x0078
WaitForSyncFlagAndClear 0x00040000
Call SetPlayerActionNormal

View File

@ -104,12 +104,12 @@ typedef struct {
/*0x14*/ u8 filler14[6];
/*0x1a*/ u8 unk1a;
/*0x1b*/ u8 filler1b[1];
/*0x1c*/ u8 unk1c;
/*0x1c*/ u8 figure_idx;
/*0x1d*/ u8 unk1d;
/*0x1e*/ u8 unk1e;
/*0x1f*/ s8 unk1f;
/*0x20*/ u8 unk20;
/*0x21*/ u8 unk21;
/*0x21*/ bool8 duplicate;
/*0x22*/ u8 filler22[0xc];
/*0x2e*/ u16 unk2e;
} FigurineMenu;

View File

@ -38,7 +38,7 @@ typedef struct {
/*0x002*/ u8 msg_speed; /**< Message speed. */
/*0x003*/ u8 brightness; /**< Brightness. */
/*0x004*/ u8 filler4[0x2];
/*0x006*/ u8 unk6;
/*0x006*/ u8 saw_staffroll;
/*0x007*/ u8 unk7;
/*0x008*/ u8 global_progress; /**< @see UpdateGlobalProgress */
/*0x009*/ u8 field_0x9[0x34];

View File

@ -297,7 +297,7 @@ typedef enum {
SFX_106,
SFX_107,
SFX_108,
SFX_109,
SFX_ITEM_GET,
SFX_10A,
SFX_10B,
SFX_BUTTON_PRESS,

View File

@ -94,7 +94,7 @@ void Subtask_FigurineMenu(void) {
}
void FigurineMenu_080A4608(void) {
s32 iVar2;
s32 iVar2, r1, r2;
SetBgmVolume(0x80);
sub_080A4DA8(3);
@ -110,20 +110,13 @@ void FigurineMenu_080A4608(void) {
for (iVar2 = 0; iVar2 < 0x10; iVar2++) {
gFigurineMenu.unk10.a[iVar2] = 0xee;
}
{
int r0, r1, r2;
r1 = gUI.field_0x3;
r0 = gSave.unk6;
r2 = 0x88;
if (r0 == 0) {
r2 = 0x82;
}
r2 = !gSave.saw_staffroll ? 0x82 : 0x88;
if (r2 < r1) {
r1 = 1;
}
gFigurineMenu.unk1c = r1;
}
gFigurineMenu.figure_idx = r1;
SetFade(4, 8);
}
@ -141,7 +134,7 @@ void FigurineMenu0_Type0(void) {
void FigurineMenu0_Type1(void) {
if (gFadeControl.active == 0) {
CreateObject(OBJECT_A2, gUnk_080FC3E4[gFigurineMenu.unk1c].unk7, 0);
CreateObject(OBJECT_A2, gUnk_080FC3E4[gFigurineMenu.figure_idx].unk7, 0);
SetMenuType(2);
}
}
@ -154,7 +147,7 @@ void FigurineMenu0_Type2(void) {
gFigurineMenu.unk20 += 1;
switch (gFigurineMenu.unk20) {
case 0x40:
gFigurineMenu.unk21 = WriteBit(&gUnk_02002B0E, gFigurineMenu.unk1c);
gFigurineMenu.duplicate = WriteBit(&gUnk_02002B0E, gFigurineMenu.figure_idx);
gMenu.column_idx = 1;
default:
bVar1 = gFigurineMenu.unk20 >> 2;
@ -171,8 +164,8 @@ void FigurineMenu0_Type2(void) {
SetMenuType(3);
sub_080A70AC((KeyButtonLayout*)&gUnk_0812813C);
gMenu.column_idx = 0x15;
if (gFigurineMenu.unk21 == 0) {
sound = SFX_109;
if (!gFigurineMenu.duplicate) {
sound = SFX_ITEM_GET;
} else {
sound = SFX_MENU_ERROR;
}
@ -225,43 +218,43 @@ void FigurineMenu1_Type1(void) {
return;
r5 = gFigurineMenu.unk1f;
r4 = gFigurineMenu.unk1c;
r4 = gFigurineMenu.figure_idx;
switch (gInput.unk4) {
case 2:
case 8:
case B_BUTTON:
case START_BUTTON:
SetMenuType(3);
break;
case 0x200:
case L_BUTTON:
r4 -= 5;
break;
case 0x100:
case R_BUTTON:
r4 += 5;
break;
case 0x40:
case DPAD_UP:
r4--;
break;
case 0x80:
case DPAD_DOWN:
r4++;
break;
case 0x10:
case DPAD_RIGHT:
r5 += 8;
break;
case 0x20:
case DPAD_LEFT:
r5 -= 8;
break;
case 1:
case A_BUTTON:
break;
}
r1 = (gSave.unk6 == 0) ? 0x82 : 0x88;
r1 = !gSave.saw_staffroll ? 0x82 : 0x88;
if (r4 <= 0) {
r4 = 1;
}
if (r1 < r4) {
r4 = r1;
}
r0 = gFigurineMenu.unk1c;
r0 = gFigurineMenu.figure_idx;
if (r0 != r4) {
gFigurineMenu.unk1c = r4;
gFigurineMenu.figure_idx = r4;
SoundReq(SFX_TEXTBOX_CHOICE);
SetMenuType(2);
r5 = 0;
@ -290,7 +283,7 @@ u32 sub_080A4948(s32 param_1) {
u32 uVar2;
uVar2 = 0;
iVar1 = gSave.unk6 == 0 ? 0x82 : 0x88;
iVar1 = !gSave.saw_staffroll ? 0x82 : 0x88;
if ((0 < param_1) || (iVar1 >= param_1)) {
if (ReadBit((u32*)&gSave.stats.filler4[4], param_1)) {
uVar2 = 1;
@ -322,11 +315,11 @@ void FigurineMenu_080A4978(void) {
gOamCmd.x = 0x9c;
gOamCmd.y = 0x48;
DrawDirect(sub_080A4978_draw_constant, 0);
r2 = (gSave.unk6 == 0) ? 0x82 : 0x88;
r2 = !gSave.saw_staffroll ? 0x82 : 0x88;
if ((gMenu.column_idx & 2) != 0) {
if (r2 >= (gFigurineMenu.unk1c)) {
if (r2 >= (gFigurineMenu.figure_idx)) {
gOamCmd.x = 0xe8;
r0 = (0x5000 / r2) * (gFigurineMenu.unk1c - 1);
r0 = (0x5000 / r2) * (gFigurineMenu.figure_idx - 1);
if (r0 < 0) {
r0 += 0xff;
}
@ -364,7 +357,7 @@ void FigurineMenu_080A4978(void) {
if (gSaveHeader->language) {
if (gMenu.column_idx & 0x4) {
gOamCmd.y = 0x10;
r4 = gFigurineMenu.unk1c;
r4 = gFigurineMenu.figure_idx;
for (r6 = 2; r6 >= 0; r6--) {
gOamCmd.x = 0x5d + (r6 * 7);
gOamCmd._8 = ((r4 % 10) << 1) | 0x9e0;
@ -374,16 +367,16 @@ void FigurineMenu_080A4978(void) {
}
}
if (gMenu.column_idx & 1) {
if (sub_080A4948(gFigurineMenu.unk1c)) {
if (sub_080A4948(gFigurineMenu.figure_idx)) {
gOamCmd.x = 0x2c;
gOamCmd.y = 0x48;
gOamCmd._8 = 0xd4 << 7;
DrawDirect(sub_080A4978_draw_constant - 4, gFigurineMenu.unk1c - 1);
if (gFigurineMenu.unk1d != gFigurineMenu.unk1c) {
DrawDirect(sub_080A4978_draw_constant - 4, gFigurineMenu.figure_idx - 1);
if (gFigurineMenu.unk1d != gFigurineMenu.figure_idx) {
const Figurine* fig;
u8* gfx;
gFigurineMenu.unk1d = gFigurineMenu.unk1c;
fig = &gFigurines[gFigurineMenu.unk1c];
gFigurineMenu.unk1d = gFigurineMenu.figure_idx;
fig = &gFigurines[gFigurineMenu.figure_idx];
LoadPalettes(fig->pal, 0x16, 9);
gfx = fig->gfx;
if (fig->size < 0) {
@ -399,7 +392,7 @@ void FigurineMenu_080A4978(void) {
void sub_080A4B44(void) {
u32 uVar1;
uVar1 = gFigurineMenu.unk1c;
uVar1 = gFigurineMenu.figure_idx;
if ((gMenu.column_idx & 0x10) != 0) {
gFigurineMenu.unk1e = sub_080A4CBC(uVar1);
}
@ -472,7 +465,7 @@ void sub_080A4BA0(u32 arg1, u32 arg2) {
s0.unk14 = arg2;
}
tmp = (gSave.unk6 == 0) ? 0x82 : 0x88;
tmp = !gSave.saw_staffroll ? 0x82 : 0x88;
if (r5 <= 0 || tmp < r5) {
r5 = -1;

View File

@ -82,7 +82,7 @@ void FigurineDevice_Init(FigurineDeviceEntity* this) {
super->action = super->type + 1;
switch (super->type) {
case 0:
if (CheckLocalFlag(0x5e)) {
if (CheckLocalFlag(SHOP07_TANA)) {
this->unk_7a = 1;
sub_080787B4(super);
} else {
@ -134,7 +134,7 @@ void FigurineDevice_Action1(FigurineDeviceEntity* this) {
if (super->interactType != 0) {
super->interactType = 0;
ResetPlayerAnimationAndAction();
if (CheckLocalFlag(0x5e)) {
if (CheckLocalFlag(SHOP07_TANA)) {
this->unk_7a = 2;
SetRoomFlag(2);
MenuFadeIn(7, 0xff);
@ -160,7 +160,7 @@ void FigurineDevice_Action2(FigurineDeviceEntity* this) {
switch (this->unk_7a) {
case 0:
if (CheckRoomFlag(0)) {
if (CheckLocalFlag(0x5e)) {
if (CheckLocalFlag(SHOP07_TANA)) {
this->unk_7a = 1;
} else {
this->unk_7a = 2;
@ -168,7 +168,7 @@ void FigurineDevice_Action2(FigurineDeviceEntity* this) {
}
break;
case 2:
SetLocalFlag(0x5e);
SetLocalFlag(SHOP07_TANA);
case 1:
this->unk_7a = 0;
sub_08088328((FigurineDeviceEntity*)super->child);
@ -330,23 +330,19 @@ void sub_08088034(FigurineDeviceEntity* this) {
void sub_0808804C(FigurineDeviceEntity* this) {
u8 result = 0;
if (gSave.unk6 != 0) {
if (gSave.saw_staffroll) {
result = 9;
} else if (CheckGlobalFlag(LV5_CLEAR)) {
result = 7;
} else if (CheckLocalFlagByBank(0x800, 0x77)) {
} else if (CheckLocalFlagByBank(FLAG_BANK_9, LV5_31_CAP_0)) {
result = 6;
} else if (CheckLocalFlagByBank(0x300, 0x32)) {
} else if (CheckLocalFlagByBank(FLAG_BANK_3, OUBO_KAKERA)) {
result = 5;
} else if (CheckGlobalFlag(LV4_CLEAR)) {
result = 4;
} else if (CheckGlobalFlag(LV3_CLEAR)) {
result = 3;
#if defined(JP) || defined(DEMO_JP) || defined(EU)
} else if (CheckLocalFlagByBank(0x100, 0x9b)) {
#else
} else if (CheckLocalFlagByBank(0x100, 0x9c)) {
#endif
} else if (CheckLocalFlagByBank(FLAG_BANK_1, SOUGEN_08_TORITSUKI)) {
result = 2;
} else if (CheckGlobalFlag(LV2_CLEAR)) {
result = 1;
@ -374,8 +370,8 @@ void sub_080880D8(FigurineDeviceEntity* this) {
}
gSave.field_0x9[0] = this->unk_80;
}
if (CheckLocalFlag(0x5f) && (this->unk_80 != gSave.stats.filler[0])) {
ClearLocalFlag(0x5f);
if (CheckLocalFlag(SHOP07_COMPLETE) && (this->unk_80 != gSave.stats.filler[0])) {
ClearLocalFlag(SHOP07_COMPLETE);
}
}
}
@ -387,7 +383,7 @@ void sub_0808826C(FigurineDeviceEntity* this) {
s32 tmp = 0x64;
tmp *= ((this->unk_80 - gSave.stats.filler[0]));
tmp = tmp / this->unk_80;
if (tmp == 0 && !CheckLocalFlag(0x5f)) {
if (tmp == 0 && !CheckLocalFlag(SHOP07_COMPLETE)) {
tmp = 1;
}
this->unk_83 = tmp;
@ -463,7 +459,7 @@ void sub_08088478(void) {
messageIndex = 0x4329;
break;
case 0x82:
if (gSave.unk6 != 0) {
if (gSave.saw_staffroll) {
messageIndex = 0x4327;
} else {
messageIndex = 0x4328;
@ -521,7 +517,7 @@ void sub_08088574(void) {
#else
if (CheckRoomFlag(9)) {
#endif
if (CheckLocalFlag(0x5f)) {
if (CheckLocalFlag(SHOP07_COMPLETE)) {
index = 0x4313;
} else {
index = 0x430c;

View File

@ -163,7 +163,7 @@ void sub_0808E988(Entity* this) {
}
void sub_0808E9F4(Entity* this) {
if (sub_0808E950() && gSave.unk6) {
if (sub_0808E950() && gSave.saw_staffroll) {
this->spriteSettings.draw = 2;
} else {
this->spriteSettings.draw = 0;
@ -294,7 +294,7 @@ void sub_0808EBB8(Entity* this) {
case 0:
break;
case 1:
y = ((SaveHeader*)0x2000000)->language * 16 + 24;
y = gSaveHeader->language * 16 + 24;
x = 112;
break;
case 2:

View File

@ -69,14 +69,14 @@ void ObjectB_Action1(ObjectBEntity* this) {
case 0x43:
break;
default:
SoundReq(SFX_109);
SoundReq(SFX_ITEM_GET);
break;
}
break;
case 2:
GiveItem(super->type, super->type2);
this->unk_68 = gUnk_080FD964[super->type].unk_6;
SoundReq(SFX_109);
SoundReq(SFX_ITEM_GET);
break;
case 5:
tmp = GetInventoryValue((u32)super->type);

View File

@ -90,7 +90,7 @@ void PlayerItemBottle_Action1(Entity* this) {
#else
InitItemGetSequence(this->type2, iVar1, 5);
#endif
SoundReq(SFX_109);
SoundReq(SFX_ITEM_GET);
}
DeleteThisEntity();
}

View File

@ -1654,7 +1654,7 @@ void WaitForAnimDone(Entity* entity, ScriptExecutionContext* context) {
}
}
void WaitForPlayerFrameHiBit(Entity* entity, ScriptExecutionContext* context) {
void WaitForPlayerAnim(Entity* entity, ScriptExecutionContext* context) {
if ((gPlayerEntity.frame & ANIM_DONE) != 0) {
gActiveScriptInfo.flags |= 1;
} else {

View File

@ -1091,7 +1091,7 @@ const Song gSongTable[] = {
[SFX_106] = { &sfx106, MUSIC_PLAYER_0B, MUSIC_PLAYER_0B },
[SFX_107] = { &sfx107, MUSIC_PLAYER_0A, MUSIC_PLAYER_0A },
[SFX_108] = { &sfx108, MUSIC_PLAYER_09, MUSIC_PLAYER_09 },
[SFX_109] = { &sfx109, MUSIC_PLAYER_1E, MUSIC_PLAYER_1E },
[SFX_ITEM_GET] = { &sfx109, MUSIC_PLAYER_1E, MUSIC_PLAYER_1E },
[SFX_10A] = { &sfx10A, MUSIC_PLAYER_08, MUSIC_PLAYER_08 },
[SFX_10B] = { &sfx10B, MUSIC_PLAYER_07, MUSIC_PLAYER_07 },
[SFX_BUTTON_PRESS] = { &sfxButtonPress, MUSIC_PLAYER_06, MUSIC_PLAYER_06 },

View File

@ -56,12 +56,12 @@ extern void (*const gUnk_08127D10[])(void);
void sub_080A3954(void);
void StaffrollTask(void) {
gRoomTransition.frameCount += 1;
gRoomTransition.frameCount++;
gUnk_08127D00[gMain.state]();
}
void StaffrollTask_State0(void) {
gSave.unk6 = 1;
gSave.saw_staffroll = TRUE;
SetGlobalFlag(GAMECLEAR);
gMain.state = 1;
gStaffrollMenu.base.menuType = 0;