Redo simplifications

This commit is contained in:
JordanLongstaff 2025-04-05 14:30:22 -04:00
commit b9e60c3e65
3 changed files with 12 additions and 13 deletions

View file

@ -1428,6 +1428,7 @@ typedef enum {
// ``` // ```
// #### `args` // #### `args`
// - `*EnHeishi2` // - `*EnHeishi2`
// - `bool` (clearCamera - true if the code clears a sub-camera, false otherwise)
VB_PLAY_GATE_OPENING_OR_CLOSING_CS, VB_PLAY_GATE_OPENING_OR_CLOSING_CS,
// #### `result` // #### `result`

View file

@ -726,12 +726,10 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li
EnHeishi2* enHeishi2 = va_arg(args, EnHeishi2*); EnHeishi2* enHeishi2 = va_arg(args, EnHeishi2*);
enHeishi2->unk_2F2[0] = 0; enHeishi2->unk_2F2[0] = 0;
if (enHeishi2->cameraId != MAIN_CAM) { // The second argument determines whether the vanilla code should be run anyway. It
Play_ClearCamera(gPlayState, enHeishi2->cameraId); // should be set to `true` ONLY IF said code calls `Play_ClearCamera`, false otherwise.
Play_ChangeCameraStatus(gPlayState, MAIN_CAM, CAM_STAT_ACTIVE); bool clearCamera = va_arg(args, bool);
} *should = clearCamera && enHeishi2->cameraId != MAIN_CAM;
*should = false;
} }
break; break;
} }

View file

@ -314,7 +314,7 @@ void func_80A5372C(EnHeishi2* this, PlayState* play) {
f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim);
Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f);
if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this)) { if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, false)) {
this->unk_2F2[0] = 200; this->unk_2F2[0] = 200;
this->cameraId = Play_CreateSubCamera(play); this->cameraId = Play_CreateSubCamera(play);
Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT);
@ -336,12 +336,12 @@ void func_80A53850(EnHeishi2* this, PlayState* play) {
BgSpot15Saku* gate; BgSpot15Saku* gate;
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this)) { if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, false)) {
Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C);
} }
gate = (BgSpot15Saku*)this->gate; gate = (BgSpot15Saku*)this->gate;
if ((this->unk_2F2[0] == 0) || (gate->unk_168 == 0)) { if ((this->unk_2F2[0] == 0) || (gate->unk_168 == 0)) {
if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this)) { if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, true)) {
Play_ClearCamera(play, this->cameraId); Play_ClearCamera(play, this->cameraId);
Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE);
} }
@ -485,7 +485,7 @@ void func_80A53DF8(EnHeishi2* this, PlayState* play) {
f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim);
Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f);
if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this)) { if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, false)) {
this->unk_2F2[0] = 200; this->unk_2F2[0] = 200;
this->cameraId = Play_CreateSubCamera(play); this->cameraId = Play_CreateSubCamera(play);
Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT);
@ -511,12 +511,12 @@ void func_80A53F30(EnHeishi2* this, PlayState* play) {
BgGateShutter* gate; BgGateShutter* gate;
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this)) { if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, false)) {
Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C);
} }
gate = (BgGateShutter*)this->gate; gate = (BgGateShutter*)this->gate;
if ((this->unk_2F2[0] == 0) || (gate->openingState == 0)) { if ((this->unk_2F2[0] == 0) || (gate->openingState == 0)) {
if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this)) { if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, true)) {
Play_ClearCamera(play, this->cameraId); Play_ClearCamera(play, this->cameraId);
Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE);
} }