Fix OOB in bom bowl man (#1808)

* Fix OOB access

* Remove rej

* Remove comment

* Forgot headers don't auto build

* Use 4 elements

* rename CSID3
This commit is contained in:
louist103 2025-04-23 13:55:54 +00:00 committed by GitHub
parent a4056abd3c
commit dc81d2285c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 33 additions and 36 deletions

View File

@ -156,8 +156,8 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play) {
if ((gSaveContext.save.entrance == ENTRANCE(EAST_CLOCK_TOWN, 2)) && CHECK_WEEKEVENTREG(WEEKEVENTREG_73_80) &&
!CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) {
this->csId3 = this->actor.csId;
if (this->csId3 == 0) {
this->csId = this->actor.csId;
if (this->csId == 0) {
Actor_Kill(&this->actor);
}
func_809C52B4(this);
@ -251,9 +251,9 @@ void func_809C4BC4(EnBomBowlMan* this, PlayState* play) {
if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) {
CutsceneManager_Stop(CS_ID_GLOBAL_TALK);
CutsceneManager_Queue(this->csId1);
} else if (!CutsceneManager_IsNext(this->csId1)) {
CutsceneManager_Queue(this->csId1);
CutsceneManager_Queue(this->csIdList[2]);
} else if (!CutsceneManager_IsNext(this->csIdList[2])) {
CutsceneManager_Queue(this->csIdList[2]);
}
EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_3, 1.0f);
@ -273,16 +273,16 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) {
if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) {
CutsceneManager_Stop(CS_ID_GLOBAL_TALK);
CutsceneManager_Queue(this->csId1);
CutsceneManager_Queue(this->csIdList[2]);
return;
}
if (!CutsceneManager_IsNext(this->csId1)) {
CutsceneManager_Queue(this->csId1);
if (!CutsceneManager_IsNext(this->csIdList[2])) {
CutsceneManager_Queue(this->csIdList[2]);
return;
}
CutsceneManager_StartWithPlayerCs(this->csId1, &this->actor);
CutsceneManager_StartWithPlayerCs(this->csIdList[2], &this->actor);
this->unk_2B8 = 1;
this->unk_2C0 = 0;
this->unk_2D4 = this->actor.yawTowardsPlayer;
@ -305,7 +305,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) {
case 0:
this->unk_2C0 = 1;
D_809C6104 = 1;
Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(this->csId1)),
Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(this->csIdList[2])),
&this->unk_2D8->actor);
this->unk_2D4 = 0;
this->unk_2BC = 10;
@ -325,7 +325,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) {
case 2:
if (player->transformation == PLAYER_FORM_HUMAN) {
this->unk_2B8 = 2;
CutsceneManager_Stop(this->csId1);
CutsceneManager_Stop(this->csIdList[2]);
func_809C59A4(this, play);
sp28 = true;
} else {
@ -335,11 +335,11 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) {
D_809C6100 = 1;
if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) {
CutsceneManager_Stop(CS_ID_GLOBAL_TALK);
CutsceneManager_Queue(this->csId2);
} else if (!CutsceneManager_IsNext(this->csId2)) {
CutsceneManager_Queue(this->csId2);
CutsceneManager_Queue(this->csIdList[3]);
} else if (!CutsceneManager_IsNext(this->csIdList[3])) {
CutsceneManager_Queue(this->csIdList[3]);
}
CutsceneManager_Stop(this->csId1);
CutsceneManager_Stop(this->csIdList[2]);
this->actionFunc = func_809C5B1C;
sp28 = true;
}
@ -356,7 +356,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) {
case 4:
if (this->unk_2B8 != 2) {
CutsceneManager_Stop(this->csId1);
CutsceneManager_Stop(this->csIdList[2]);
}
play->msgCtx.msgLength = 0;
EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_1, 1.0f);
@ -514,11 +514,11 @@ void func_809C5738(EnBomBowlMan* this, PlayState* play) {
func_809C4B6C(this);
if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) {
CutsceneManager_Stop(CS_ID_GLOBAL_TALK);
CutsceneManager_Queue(this->csId3);
} else if (!CutsceneManager_IsNext(this->csId3)) {
CutsceneManager_Queue(this->csId3);
CutsceneManager_Queue(this->csId);
} else if (!CutsceneManager_IsNext(this->csId)) {
CutsceneManager_Queue(this->csId);
} else {
CutsceneManager_StartWithPlayerCs(this->csId3, &this->actor);
CutsceneManager_StartWithPlayerCs(this->csId, &this->actor);
this->unk_2C2 = 2;
EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_18, 1.0f);
}
@ -526,11 +526,11 @@ void func_809C5738(EnBomBowlMan* this, PlayState* play) {
} else if (this->unk_2C2 == 1) {
if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) {
CutsceneManager_Stop(CS_ID_GLOBAL_TALK);
CutsceneManager_Queue(this->csId3);
} else if (!CutsceneManager_IsNext(this->csId3)) {
CutsceneManager_Queue(this->csId3);
CutsceneManager_Queue(this->csId);
} else if (!CutsceneManager_IsNext(this->csId)) {
CutsceneManager_Queue(this->csId);
} else {
CutsceneManager_StartWithPlayerCs(this->csId3, &this->actor);
CutsceneManager_StartWithPlayerCs(this->csId, &this->actor);
this->unk_2C2 = 2;
EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_18, 1.0f);
}
@ -545,7 +545,7 @@ void func_809C5738(EnBomBowlMan* this, PlayState* play) {
if (this->unk_298 >= this->path->count) {
SET_WEEKEVENTREG(WEEKEVENTREG_84_80);
CLEAR_WEEKEVENTREG(WEEKEVENTREG_83_04);
CutsceneManager_Stop(this->csId3);
CutsceneManager_Stop(this->csId);
Actor_Kill(&this->actor);
return;
}
@ -592,11 +592,11 @@ void func_809C5AA4(EnBomBowlMan* this, PlayState* play) {
void func_809C5B1C(EnBomBowlMan* this, PlayState* play) {
if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) {
CutsceneManager_Stop(CS_ID_GLOBAL_TALK);
CutsceneManager_Queue(this->csId2);
} else if (!CutsceneManager_IsNext(this->csId2)) {
CutsceneManager_Queue(this->csId2);
CutsceneManager_Queue(this->csIdList[3]);
} else if (!CutsceneManager_IsNext(this->csIdList[3])) {
CutsceneManager_Queue(this->csIdList[3]);
} else {
CutsceneManager_StartWithPlayerCs(this->csId2, &this->actor);
CutsceneManager_StartWithPlayerCs(this->csIdList[3], &this->actor);
func_809C5BA0(this);
}
}
@ -634,7 +634,7 @@ void func_809C5BF4(EnBomBowlMan* this, PlayState* play) {
}
if (this->unk_2F4 == 0) {
subCam = Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(this->csId2));
subCam = Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(this->csIdList[3]));
if (D_809C6100 > 5) {
Player* player = GET_PLAYER(play);

View File

@ -44,11 +44,9 @@ typedef struct EnBomBowlMan {
/* 0x2C2 */ s16 unk_2C2;
/* 0x2C4 */ f32 animEndFrame;
/* 0x2C8 */ f32 unk_2C8;
/* 0x2CC */ s16 csIdList[2];
/* 0x2D0 */ s16 csId1;
/* 0x2D2 */ s16 csId2;
/* 0x2CC */ s16 csIdList[4];
/* 0x2D4 */ s16 unk_2D4;
/* 0x2D6 */ s16 csId3;
/* 0x2D6 */ s16 csId;
/* 0x2D8 */ struct EnBomBowlMan* unk_2D8;
/* 0x2DC */ struct EnBomBowlMan* unk_2DC[5];
/* 0x2F0 */ s16 unk_2F0;

View File

@ -42,8 +42,7 @@ typedef struct EnBomjima {
/* 0x2CA */ s16 unk_2CA;
/* 0x2CC */ f32 animEndFrame;
/* 0x2D0 */ f32 unk_2D0;
/* 0x2D4 */ s16 csIdList[2];
/* 0x2D8 */ UNK_TYPE1 unk2D8[4]; // maybe a part of the above?
/* 0x2D4 */ s16 csIdList[4];
/* 0x2DC */ s16 unk_2DC;
/* 0x2DE */ s16 cutsceneEnded;
/* 0x2E0 */ s16 unk_2E0;