2020-10-03 15:22:44 +00:00
|
|
|
|
#include "global.h"
|
|
|
|
|
#include "vt.h"
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
void* D_8012D1F0 = NULL;
|
|
|
|
|
UNK_TYPE D_8012D1F4 = 0; // unused
|
|
|
|
|
Input* D_8012D1F8 = NULL;
|
|
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
|
TransitionUnk sTrnsnUnk;
|
|
|
|
|
s32 gTrnsnUnkState;
|
2020-05-15 09:02:39 +00:00
|
|
|
|
VisMono D_80161498;
|
2020-09-30 00:18:46 +00:00
|
|
|
|
Color_RGBA8_u32 D_801614B0;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
FaultClient D_801614B8;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
s16 sTransitionFillTimer;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
u64 D_801614D0[0xA00];
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_SpawnScene(PlayState* this, s32 sceneNum, s32 spawn);
|
2022-05-17 22:41:50 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_800BC450(PlayState* this) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Camera_ChangeDataIdx(GET_ACTIVE_CAM(this), this->unk_1242B - 1);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_800BC490(PlayState* this, s16 point) {
|
2021-04-29 18:39:46 +00:00
|
|
|
|
ASSERT(point == 1 || point == 2, "point == 1 || point == 2", "../z_play.c", 2160);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->unk_1242B = point;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if ((YREG(15) != 0x10) && (gSaveContext.cutsceneIndex < 0xFFF0)) {
|
2022-04-23 14:55:18 +00:00
|
|
|
|
Audio_PlaySoundGeneral((point == 1) ? NA_SE_SY_CAMERA_ZOOM_DOWN : NA_SE_SY_CAMERA_ZOOM_UP, &gSfxDefaultPos, 4,
|
|
|
|
|
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
func_800BC450(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_800BC56C(PlayState* this, s16 arg1) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
return (arg1 == this->unk_1242B);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-16 21:36:12 +00:00
|
|
|
|
// original name: "Game_play_shop_pr_vr_switch_set"
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_800BC590(PlayState* this) {
|
2020-03-17 04:31:30 +00:00
|
|
|
|
osSyncPrintf("Game_play_shop_pr_vr_switch_set()\n");
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2020-03-22 21:19:43 +00:00
|
|
|
|
if (YREG(15) == 0x10) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->unk_1242B = 2;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_SetupTransition(PlayState* this, s32 transitionType) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
TransitionContext* transitionCtx = &this->transitionCtx;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
bzero(transitionCtx, sizeof(TransitionContext));
|
|
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
|
transitionCtx->transitionType = transitionType;
|
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
// circle types
|
2020-04-30 18:41:09 +00:00
|
|
|
|
if ((transitionCtx->transitionType >> 5) == 1) {
|
|
|
|
|
transitionCtx->init = TransitionCircle_Init;
|
|
|
|
|
transitionCtx->destroy = TransitionCircle_Destroy;
|
|
|
|
|
transitionCtx->start = TransitionCircle_Start;
|
|
|
|
|
transitionCtx->isDone = TransitionCircle_IsDone;
|
|
|
|
|
transitionCtx->draw = TransitionCircle_Draw;
|
|
|
|
|
transitionCtx->update = TransitionCircle_Update;
|
|
|
|
|
transitionCtx->setType = TransitionCircle_SetType;
|
|
|
|
|
transitionCtx->setColor = TransitionCircle_SetColor;
|
2022-05-04 19:25:26 +00:00
|
|
|
|
transitionCtx->setUnkColor = TransitionCircle_SetUnkColor;
|
2020-08-15 17:23:29 +00:00
|
|
|
|
} else {
|
|
|
|
|
switch (transitionCtx->transitionType) {
|
2022-04-27 20:00:25 +00:00
|
|
|
|
case TRANS_TYPE_TRIFORCE:
|
2020-08-15 17:23:29 +00:00
|
|
|
|
transitionCtx->init = TransitionTriforce_Init;
|
|
|
|
|
transitionCtx->destroy = TransitionTriforce_Destroy;
|
|
|
|
|
transitionCtx->start = TransitionTriforce_Start;
|
|
|
|
|
transitionCtx->isDone = TransitionTriforce_IsDone;
|
|
|
|
|
transitionCtx->draw = TransitionTriforce_Draw;
|
|
|
|
|
transitionCtx->update = TransitionTriforce_Update;
|
|
|
|
|
transitionCtx->setType = TransitionTriforce_SetType;
|
|
|
|
|
transitionCtx->setColor = TransitionTriforce_SetColor;
|
2022-05-04 19:25:26 +00:00
|
|
|
|
transitionCtx->setUnkColor = NULL;
|
2020-08-15 17:23:29 +00:00
|
|
|
|
break;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
|
|
|
|
case TRANS_TYPE_WIPE:
|
|
|
|
|
case TRANS_TYPE_WIPE_FAST:
|
2020-08-15 17:23:29 +00:00
|
|
|
|
transitionCtx->init = TransitionWipe_Init;
|
|
|
|
|
transitionCtx->destroy = TransitionWipe_Destroy;
|
|
|
|
|
transitionCtx->start = TransitionWipe_Start;
|
|
|
|
|
transitionCtx->isDone = TransitionWipe_IsDone;
|
|
|
|
|
transitionCtx->draw = TransitionWipe_Draw;
|
|
|
|
|
transitionCtx->update = TransitionWipe_Update;
|
|
|
|
|
transitionCtx->setType = TransitionWipe_SetType;
|
|
|
|
|
transitionCtx->setColor = TransitionWipe_SetColor;
|
2022-05-04 19:25:26 +00:00
|
|
|
|
transitionCtx->setUnkColor = NULL;
|
2020-08-15 17:23:29 +00:00
|
|
|
|
break;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
|
|
|
|
case TRANS_TYPE_FADE_BLACK:
|
|
|
|
|
case TRANS_TYPE_FADE_WHITE:
|
|
|
|
|
case TRANS_TYPE_FADE_BLACK_FAST:
|
|
|
|
|
case TRANS_TYPE_FADE_WHITE_FAST:
|
|
|
|
|
case TRANS_TYPE_FADE_BLACK_SLOW:
|
|
|
|
|
case TRANS_TYPE_FADE_WHITE_SLOW:
|
|
|
|
|
case TRANS_TYPE_FADE_WHITE_CS_DELAYED:
|
|
|
|
|
case TRANS_TYPE_FADE_WHITE_INSTANT:
|
|
|
|
|
case TRANS_TYPE_FADE_GREEN:
|
|
|
|
|
case TRANS_TYPE_FADE_BLUE:
|
2020-08-15 17:23:29 +00:00
|
|
|
|
transitionCtx->init = TransitionFade_Init;
|
|
|
|
|
transitionCtx->destroy = TransitionFade_Destroy;
|
|
|
|
|
transitionCtx->start = TransitionFade_Start;
|
|
|
|
|
transitionCtx->isDone = TransitionFade_IsDone;
|
|
|
|
|
transitionCtx->draw = TransitionFade_Draw;
|
|
|
|
|
transitionCtx->update = TransitionFade_Update;
|
|
|
|
|
transitionCtx->setType = TransitionFade_SetType;
|
|
|
|
|
transitionCtx->setColor = TransitionFade_SetColor;
|
2022-05-04 19:25:26 +00:00
|
|
|
|
transitionCtx->setUnkColor = NULL;
|
2020-08-15 17:23:29 +00:00
|
|
|
|
break;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
|
|
|
|
case TRANS_TYPE_FILL_WHITE2:
|
|
|
|
|
case TRANS_TYPE_FILL_WHITE:
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionMode = TRANS_MODE_FILL_WHITE_INIT;
|
2020-08-15 17:23:29 +00:00
|
|
|
|
break;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
|
|
|
|
case TRANS_TYPE_INSTANT:
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionMode = TRANS_MODE_INSTANT;
|
2020-08-15 17:23:29 +00:00
|
|
|
|
break;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
|
|
|
|
case TRANS_TYPE_FILL_BROWN:
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionMode = TRANS_MODE_FILL_BROWN_INIT;
|
2020-08-15 17:23:29 +00:00
|
|
|
|
break;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
|
|
|
|
case TRANS_TYPE_SANDSTORM_PERSIST:
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionMode = TRANS_MODE_SANDSTORM_INIT;
|
2020-08-15 17:23:29 +00:00
|
|
|
|
break;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
|
|
|
|
case TRANS_TYPE_SANDSTORM_END:
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionMode = TRANS_MODE_SANDSTORM_END_INIT;
|
2020-08-15 17:23:29 +00:00
|
|
|
|
break;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
|
|
|
|
case TRANS_TYPE_CS_BLACK_FILL:
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionMode = TRANS_MODE_CS_BLACK_FILL_INIT;
|
2020-08-15 17:23:29 +00:00
|
|
|
|
break;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
2020-08-15 17:23:29 +00:00
|
|
|
|
default:
|
|
|
|
|
Fault_AddHungupAndCrash("../z_play.c", 2290);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_800BC88C(PlayState* this) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionCtx.transitionType = -1;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Gfx* Play_SetFog(PlayState* this, Gfx* gfx) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
return Gfx_SetFog2(gfx, this->lightCtx.fogColor[0], this->lightCtx.fogColor[1], this->lightCtx.fogColor[2], 0,
|
|
|
|
|
this->lightCtx.fogNear, 1000);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
void Play_Destroy(GameState* thisx) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
PlayState* this = (PlayState*)thisx;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Player* player = GET_PLAYER(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->state.gfxCtx->callback = NULL;
|
|
|
|
|
this->state.gfxCtx->callbackParam = 0;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
SREG(91) = 0;
|
|
|
|
|
R_PAUSE_MENU_MODE = 0;
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
PreRender_Destroy(&this->pauseBgPreRender);
|
|
|
|
|
Effect_DeleteAll(this);
|
|
|
|
|
EffectSs_ClearAll(this);
|
|
|
|
|
CollisionCheck_DestroyContext(this, &this->colChkCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
|
if (gTrnsnUnkState == 3) {
|
|
|
|
|
TransitionUnk_Destroy(&sTrnsnUnk);
|
|
|
|
|
gTrnsnUnkState = 0;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->transitionMode == TRANS_MODE_INSTANCE_RUNNING) {
|
|
|
|
|
this->transitionCtx.destroy(&this->transitionCtx.instanceData);
|
|
|
|
|
func_800BC88C(this);
|
|
|
|
|
this->transitionMode = TRANS_MODE_OFF;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-09 01:54:39 +00:00
|
|
|
|
ShrinkWindow_Destroy();
|
2022-05-17 22:41:50 +00:00
|
|
|
|
TransitionFade_Destroy(&this->transitionFade);
|
2020-05-15 09:02:39 +00:00
|
|
|
|
VisMono_Destroy(&D_80161498);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (gSaveContext.linkAge != this->linkAgeOnLoad) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
Inventory_SwapAgeEquipment();
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Player_SetEquipmentData(this, player);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
func_80031C3C(&this->actorCtx, this);
|
|
|
|
|
func_80110990(this);
|
|
|
|
|
KaleidoScopeCall_Destroy(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
KaleidoManager_Destroy();
|
|
|
|
|
ZeldaArena_Cleanup();
|
|
|
|
|
Fault_RemoveClient(&D_801614B8);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
void Play_Init(GameState* thisx) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
PlayState* this = (PlayState*)thisx;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
GraphicsContext* gfxCtx = this->state.gfxCtx;
|
2021-01-13 01:02:56 +00:00
|
|
|
|
u32 zAlloc;
|
|
|
|
|
u32 zAllocAligned;
|
|
|
|
|
size_t zAllocSize;
|
|
|
|
|
Player* player;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
s32 playerStartCamId;
|
|
|
|
|
s32 i;
|
2021-01-13 01:02:56 +00:00
|
|
|
|
u8 tempSetupIndex;
|
|
|
|
|
s32 pad[2];
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-09 17:45:53 +00:00
|
|
|
|
if (gSaveContext.entranceIndex == ENTR_LOAD_OPENING) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.entranceIndex = 0;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->state.running = false;
|
|
|
|
|
SET_NEXT_GAMESTATE(&this->state, Opening_Init, OpeningContext);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SystemArena_Display();
|
2022-05-17 22:41:50 +00:00
|
|
|
|
GameState_Realloc(&this->state, 0x1D4790);
|
|
|
|
|
KaleidoManager_Init(this);
|
|
|
|
|
View_Init(&this->view, gfxCtx);
|
2021-11-07 16:58:50 +00:00
|
|
|
|
Audio_SetExtraFilter(0);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
Quake_Init();
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
for (i = 0; i < ARRAY_COUNT(this->cameraPtrs); i++) {
|
|
|
|
|
this->cameraPtrs[i] = NULL;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Camera_Init(&this->mainCamera, &this->view, &this->colCtx, this);
|
|
|
|
|
Camera_ChangeStatus(&this->mainCamera, CAM_STAT_ACTIVE);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Camera_Init(&this->subCameras[i], &this->view, &this->colCtx, this);
|
|
|
|
|
Camera_ChangeStatus(&this->subCameras[i], CAM_STAT_UNK100);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->cameraPtrs[CAM_ID_MAIN] = &this->mainCamera;
|
|
|
|
|
this->cameraPtrs[CAM_ID_MAIN]->uid = 0;
|
|
|
|
|
this->activeCamId = CAM_ID_MAIN;
|
|
|
|
|
func_8005AC48(&this->mainCamera, 0xFF);
|
|
|
|
|
Sram_Init(this, &this->sramCtx);
|
|
|
|
|
func_80112098(this);
|
|
|
|
|
Message_Init(this);
|
|
|
|
|
GameOver_Init(this);
|
|
|
|
|
SoundSource_InitAll(this);
|
|
|
|
|
Effect_InitContext(this);
|
|
|
|
|
EffectSs_InitInfo(this, 0x55);
|
|
|
|
|
CollisionCheck_InitContext(this, &this->colChkCtx);
|
|
|
|
|
AnimationContext_Reset(&this->animationCtx);
|
|
|
|
|
func_8006450C(this, &this->csCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (gSaveContext.nextCutsceneIndex != 0xFFEF) {
|
|
|
|
|
gSaveContext.cutsceneIndex = gSaveContext.nextCutsceneIndex;
|
|
|
|
|
gSaveContext.nextCutsceneIndex = 0xFFEF;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (gSaveContext.cutsceneIndex == 0xFFFD) {
|
|
|
|
|
gSaveContext.cutsceneIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-20 18:40:13 +00:00
|
|
|
|
if (gSaveContext.nextDayTime != NEXT_TIME_NONE) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.dayTime = gSaveContext.nextDayTime;
|
2021-09-20 16:51:35 +00:00
|
|
|
|
gSaveContext.skyboxTime = gSaveContext.nextDayTime;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-20 18:40:13 +00:00
|
|
|
|
if (gSaveContext.dayTime > CLOCK_TIME(18, 0) || gSaveContext.dayTime < CLOCK_TIME(6, 30)) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.nightFlag = 1;
|
|
|
|
|
} else {
|
|
|
|
|
gSaveContext.nightFlag = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Cutscene_HandleConditionalTriggers(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2021-01-13 01:02:56 +00:00
|
|
|
|
if (gSaveContext.gameMode != 0 || gSaveContext.cutsceneIndex >= 0xFFF0) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.nayrusLoveTimer = 0;
|
2022-05-23 16:52:01 +00:00
|
|
|
|
Magic_Reset(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.sceneSetupIndex = (gSaveContext.cutsceneIndex & 0xF) + 4;
|
2021-08-21 23:12:57 +00:00
|
|
|
|
} else if (!LINK_IS_ADULT && IS_DAY) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.sceneSetupIndex = 0;
|
2021-08-21 23:12:57 +00:00
|
|
|
|
} else if (!LINK_IS_ADULT && !IS_DAY) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.sceneSetupIndex = 1;
|
2021-08-21 23:12:57 +00:00
|
|
|
|
} else if (LINK_IS_ADULT && IS_DAY) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.sceneSetupIndex = 2;
|
|
|
|
|
} else {
|
|
|
|
|
gSaveContext.sceneSetupIndex = 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tempSetupIndex = gSaveContext.sceneSetupIndex;
|
2021-08-21 23:12:57 +00:00
|
|
|
|
if ((gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_SPOT00) && !LINK_IS_ADULT &&
|
2021-01-13 01:02:56 +00:00
|
|
|
|
gSaveContext.sceneSetupIndex < 4) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) &&
|
|
|
|
|
CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE)) {
|
|
|
|
|
gSaveContext.sceneSetupIndex = 1;
|
|
|
|
|
} else {
|
|
|
|
|
gSaveContext.sceneSetupIndex = 0;
|
|
|
|
|
}
|
2021-01-13 01:02:56 +00:00
|
|
|
|
} else if ((gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_SPOT04) && LINK_IS_ADULT &&
|
|
|
|
|
gSaveContext.sceneSetupIndex < 4) {
|
2022-04-29 18:19:48 +00:00
|
|
|
|
gSaveContext.sceneSetupIndex = GET_EVENTCHKINF(EVENTCHKINF_48) ? 3 : 2;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Play_SpawnScene(
|
|
|
|
|
this, gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].scene,
|
2022-05-15 14:38:31 +00:00
|
|
|
|
gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].spawn);
|
2021-01-13 01:02:56 +00:00
|
|
|
|
osSyncPrintf("\nSCENE_NO=%d COUNTER=%d\n", ((void)0, gSaveContext.entranceIndex), gSaveContext.sceneSetupIndex);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
// When entering Gerudo Valley in the right setup, trigger the GC emulator to play the ending movie.
|
|
|
|
|
// The emulator constantly checks whether PC is 0x81000000, so this works even though it's not a valid address.
|
2021-01-13 01:02:56 +00:00
|
|
|
|
if ((gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_SPOT09) &&
|
|
|
|
|
gSaveContext.sceneSetupIndex == 6) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
osSyncPrintf("エンディングはじまるよー\n"); // "The ending starts"
|
|
|
|
|
((void (*)())0x81000000)();
|
|
|
|
|
osSyncPrintf("出戻り?\n"); // "Return?"
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Cutscene_HandleEntranceTriggers(this);
|
|
|
|
|
KaleidoScopeCall_Init(this);
|
|
|
|
|
func_801109B0(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-20 18:40:13 +00:00
|
|
|
|
if (gSaveContext.nextDayTime != NEXT_TIME_NONE) {
|
|
|
|
|
if (gSaveContext.nextDayTime == NEXT_TIME_DAY) {
|
2021-09-20 16:51:35 +00:00
|
|
|
|
gSaveContext.totalDays++;
|
|
|
|
|
gSaveContext.bgsDayCount++;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.dogIsLost = true;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (Inventory_ReplaceItem(this, ITEM_WEIRD_EGG, ITEM_CHICKEN) ||
|
|
|
|
|
Inventory_ReplaceItem(this, ITEM_POCKET_EGG, ITEM_POCKET_CUCCO)) {
|
|
|
|
|
Message_StartTextbox(this, 0x3066, NULL);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
2022-05-20 18:40:13 +00:00
|
|
|
|
gSaveContext.nextDayTime = NEXT_TIME_DAY_SET;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-05-20 18:40:13 +00:00
|
|
|
|
gSaveContext.nextDayTime = NEXT_TIME_NIGHT_SET;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SREG(91) = -1;
|
|
|
|
|
R_PAUSE_MENU_MODE = 0;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
PreRender_Init(&this->pauseBgPreRender);
|
|
|
|
|
PreRender_SetValuesSave(&this->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0);
|
|
|
|
|
PreRender_SetValues(&this->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
|
2020-04-30 18:41:09 +00:00
|
|
|
|
gTrnsnUnkState = 0;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionMode = TRANS_MODE_OFF;
|
|
|
|
|
FrameAdvance_Init(&this->frameAdvCtx);
|
2020-12-26 10:44:53 +00:00
|
|
|
|
Rand_Seed((u32)osGetTime());
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Matrix_Init(&this->state);
|
|
|
|
|
this->state.main = Play_Main;
|
|
|
|
|
this->state.destroy = Play_Destroy;
|
|
|
|
|
this->transitionTrigger = TRANS_TRIGGER_END;
|
|
|
|
|
this->unk_11E16 = 0xFF;
|
|
|
|
|
this->unk_11E18 = 0;
|
|
|
|
|
this->unk_11DE9 = false;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (gSaveContext.gameMode != 1) {
|
2022-04-27 20:00:25 +00:00
|
|
|
|
if (gSaveContext.nextTransitionType == TRANS_NEXT_TYPE_DEFAULT) {
|
|
|
|
|
// fade in
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionType =
|
2022-04-27 20:00:25 +00:00
|
|
|
|
(gEntranceTable[((void)0, gSaveContext.entranceIndex) + tempSetupIndex].field >> 7) & 0x7F;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionType = gSaveContext.nextTransitionType;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionType = TRANS_TYPE_FADE_BLACK_SLOW;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-09 01:54:39 +00:00
|
|
|
|
ShrinkWindow_Init();
|
2022-05-17 22:41:50 +00:00
|
|
|
|
TransitionFade_Init(&this->transitionFade);
|
|
|
|
|
TransitionFade_SetType(&this->transitionFade, 3);
|
|
|
|
|
TransitionFade_SetColor(&this->transitionFade, RGBA8(160, 160, 160, 255));
|
|
|
|
|
TransitionFade_Start(&this->transitionFade);
|
2020-05-15 09:02:39 +00:00
|
|
|
|
VisMono_Init(&D_80161498);
|
2020-07-17 01:37:53 +00:00
|
|
|
|
D_801614B0.a = 0;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Flags_UnsetAllEnv(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
osSyncPrintf("ZELDA ALLOC SIZE=%x\n", THA_GetSize(&this->state.tha));
|
|
|
|
|
zAllocSize = THA_GetSize(&this->state.tha);
|
|
|
|
|
zAlloc = GameState_Alloc(&this->state, zAllocSize, "../z_play.c", 2918);
|
2021-01-13 01:02:56 +00:00
|
|
|
|
zAllocAligned = (zAlloc + 8) & ~0xF;
|
|
|
|
|
ZeldaArena_Init(zAllocAligned, zAllocSize - zAllocAligned + zAlloc);
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "Zelda Heap"
|
2020-04-16 21:36:12 +00:00
|
|
|
|
osSyncPrintf("ゼルダヒープ %08x-%08x\n", zAllocAligned,
|
2021-09-04 13:33:19 +00:00
|
|
|
|
(s32)(zAllocAligned + zAllocSize) - (s32)(zAllocAligned - zAlloc));
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
Fault_AddClient(&D_801614B8, ZeldaArena_Display, NULL, NULL);
|
2022-05-17 22:41:50 +00:00
|
|
|
|
func_800304DC(this, &this->actorCtx, this->linkActorEntry);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
while (!func_800973FC(this, &this->roomCtx)) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
; // Empty Loop
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
player = GET_PLAYER(this);
|
|
|
|
|
Camera_InitPlayerSettings(&this->mainCamera, player);
|
|
|
|
|
Camera_ChangeMode(&this->mainCamera, CAM_MODE_NORMAL);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
playerStartCamId = player->actor.params & 0xFF;
|
|
|
|
|
if (playerStartCamId != 0xFF) {
|
|
|
|
|
osSyncPrintf("player has start camera ID (" VT_FGCOL(BLUE) "%d" VT_RST ")\n", playerStartCamId);
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Camera_ChangeDataIdx(&this->mainCamera, playerStartCamId);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-13 01:02:56 +00:00
|
|
|
|
if (YREG(15) == 32) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->unk_1242B = 2;
|
2021-01-13 01:02:56 +00:00
|
|
|
|
} else if (YREG(15) == 16) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->unk_1242B = 1;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->unk_1242B = 0;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Interface_SetSceneRestrictions(this);
|
|
|
|
|
Environment_PlaySceneSequence(this);
|
|
|
|
|
gSaveContext.seqId = this->sequenceCtx.seqId;
|
|
|
|
|
gSaveContext.natureAmbienceId = this->sequenceCtx.natureAmbienceId;
|
|
|
|
|
func_8002DF18(this, GET_PLAYER(this));
|
|
|
|
|
AnimationContext_Update(this, &this->animationCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.respawnFlag = 0;
|
|
|
|
|
|
|
|
|
|
if (dREG(95) != 0) {
|
|
|
|
|
D_8012D1F0 = D_801614D0;
|
|
|
|
|
osSyncPrintf("\nkawauso_data=[%x]", D_8012D1F0);
|
2021-11-07 16:58:50 +00:00
|
|
|
|
DmaMgr_DmaRomToRam(0x03FEB000, (u32)D_8012D1F0, sizeof(D_801614D0));
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_Update(PlayState* this) {
|
2021-02-15 17:29:06 +00:00
|
|
|
|
s32 pad1;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
s32 sp80;
|
|
|
|
|
Input* input;
|
2021-02-15 17:29:06 +00:00
|
|
|
|
u32 i;
|
|
|
|
|
s32 pad2;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
input = this->state.input;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if ((SREG(1) < 0) || (DREG(0) != 0)) {
|
|
|
|
|
SREG(1) = 0;
|
|
|
|
|
ZeldaArena_Display();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) == 18) && (HREG(81) < 0)) {
|
|
|
|
|
HREG(81) = 0;
|
|
|
|
|
osSyncPrintf("object_exchange_rom_address %u\n", gObjectTableSize);
|
|
|
|
|
osSyncPrintf("RomStart RomEnd Size\n");
|
|
|
|
|
for (i = 0; i < gObjectTableSize; i++) {
|
|
|
|
|
s32 size = gObjectTable[i].vromEnd - gObjectTable[i].vromStart;
|
2021-11-30 23:40:42 +00:00
|
|
|
|
|
2020-04-16 21:36:12 +00:00
|
|
|
|
osSyncPrintf("%08x-%08x %08x(%8.3fKB)\n", gObjectTable[i].vromStart, gObjectTable[i].vromEnd, size,
|
2021-03-31 16:18:31 +00:00
|
|
|
|
size / 1024.0f);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
osSyncPrintf("\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(81) == 18) && (HREG(82) < 0)) {
|
|
|
|
|
HREG(82) = 0;
|
|
|
|
|
ActorOverlayTable_LogPrint();
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
|
|
|
|
|
gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
|
|
|
|
|
gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (FrameAdvance_Update(&this->frameAdvCtx, &input[1])) {
|
|
|
|
|
if ((this->transitionMode == TRANS_MODE_OFF) && (this->transitionTrigger != TRANS_TRIGGER_OFF)) {
|
|
|
|
|
this->transitionMode = TRANS_MODE_SETUP;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
|
if (gTrnsnUnkState != 0) {
|
|
|
|
|
switch (gTrnsnUnkState) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
case 2:
|
2021-02-15 17:29:06 +00:00
|
|
|
|
if (TransitionUnk_Init(&sTrnsnUnk, 10, 7) == NULL) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
osSyncPrintf("fbdemo_init呼出し失敗!\n"); // "fbdemo_init call failed!"
|
2020-04-30 18:41:09 +00:00
|
|
|
|
gTrnsnUnkState = 0;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2021-02-14 00:49:40 +00:00
|
|
|
|
sTrnsnUnk.zBuffer = (u16*)gZBuffer;
|
2020-04-30 18:41:09 +00:00
|
|
|
|
gTrnsnUnkState = 3;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
R_UPDATE_RATE = 1;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
2020-04-30 18:41:09 +00:00
|
|
|
|
func_800B23E8(&sTrnsnUnk);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->transitionMode) {
|
|
|
|
|
switch (this->transitionMode) {
|
2022-04-27 20:00:25 +00:00
|
|
|
|
case TRANS_MODE_SETUP:
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->transitionTrigger != TRANS_TRIGGER_END) {
|
2022-04-27 20:00:25 +00:00
|
|
|
|
s16 sceneSetupIndex = 0;
|
|
|
|
|
|
2020-04-16 21:36:12 +00:00
|
|
|
|
Interface_ChangeAlpha(1);
|
|
|
|
|
|
|
|
|
|
if (gSaveContext.cutsceneIndex >= 0xFFF0) {
|
2022-04-27 20:00:25 +00:00
|
|
|
|
sceneSetupIndex = (gSaveContext.cutsceneIndex & 0xF) + 4;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
// fade out bgm if "continue bgm" flag is not set
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (!(gEntranceTable[this->nextEntranceIndex + sceneSetupIndex].field & 0x8000)) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "Sound initalized. 111"
|
|
|
|
|
osSyncPrintf("\n\n\nサウンドイニシャル来ました。111");
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if ((this->transitionType < TRANS_TYPE_MAX) && !Environment_IsForcedSequenceDisabled()) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "Sound initalized. 222"
|
|
|
|
|
osSyncPrintf("\n\n\nサウンドイニシャル来ました。222");
|
2020-04-16 21:36:12 +00:00
|
|
|
|
func_800F6964(0x14);
|
2021-12-03 14:49:32 +00:00
|
|
|
|
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
|
2021-12-27 17:35:05 +00:00
|
|
|
|
gSaveContext.natureAmbienceId = NATURE_ID_DISABLED;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
if (!R_TRANS_DBG_ENABLED) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Play_SetupTransition(this, this->transitionType);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Play_SetupTransition(this, R_TRANS_DBG_TYPE);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->transitionMode >= TRANS_MODE_FILL_WHITE_INIT) {
|
2022-04-27 20:00:25 +00:00
|
|
|
|
// non-instance modes break out of this switch
|
2020-04-16 21:36:12 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2022-04-27 20:00:25 +00:00
|
|
|
|
// fallthrough
|
|
|
|
|
case TRANS_MODE_INSTANCE_INIT:
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionCtx.init(&this->transitionCtx.instanceData);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
// circle types
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if ((this->transitionCtx.transitionType >> 5) == 1) {
|
|
|
|
|
this->transitionCtx.setType(&this->transitionCtx.instanceData,
|
|
|
|
|
this->transitionCtx.transitionType | TC_SET_PARAMS);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
gSaveContext.transWipeSpeed = 14;
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if ((this->transitionCtx.transitionType == TRANS_TYPE_WIPE_FAST) ||
|
|
|
|
|
(this->transitionCtx.transitionType == TRANS_TYPE_FILL_WHITE2)) {
|
2022-04-27 20:00:25 +00:00
|
|
|
|
//! @bug TRANS_TYPE_FILL_WHITE2 will never reach this code.
|
|
|
|
|
//! It is a non-instance type transition which doesn't run this case.
|
|
|
|
|
gSaveContext.transWipeSpeed = 28;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
gSaveContext.transFadeDuration = 60;
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if ((this->transitionCtx.transitionType == TRANS_TYPE_FADE_BLACK_FAST) ||
|
|
|
|
|
(this->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_FAST)) {
|
2022-04-27 20:00:25 +00:00
|
|
|
|
gSaveContext.transFadeDuration = 20;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
} else if ((this->transitionCtx.transitionType == TRANS_TYPE_FADE_BLACK_SLOW) ||
|
|
|
|
|
(this->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_SLOW)) {
|
2022-04-27 20:00:25 +00:00
|
|
|
|
gSaveContext.transFadeDuration = 150;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
} else if (this->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_INSTANT) {
|
2022-04-27 20:00:25 +00:00
|
|
|
|
gSaveContext.transFadeDuration = 2;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if ((this->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE) ||
|
|
|
|
|
(this->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_FAST) ||
|
|
|
|
|
(this->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_SLOW) ||
|
|
|
|
|
(this->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_CS_DELAYED) ||
|
|
|
|
|
(this->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_INSTANT)) {
|
|
|
|
|
this->transitionCtx.setColor(&this->transitionCtx.instanceData, RGBA8(160, 160, 160, 255));
|
|
|
|
|
if (this->transitionCtx.setUnkColor != NULL) {
|
|
|
|
|
this->transitionCtx.setUnkColor(&this->transitionCtx.instanceData,
|
|
|
|
|
RGBA8(160, 160, 160, 255));
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
2022-05-17 22:41:50 +00:00
|
|
|
|
} else if (this->transitionCtx.transitionType == TRANS_TYPE_FADE_GREEN) {
|
|
|
|
|
this->transitionCtx.setColor(&this->transitionCtx.instanceData, RGBA8(140, 140, 100, 255));
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->transitionCtx.setUnkColor != NULL) {
|
|
|
|
|
this->transitionCtx.setUnkColor(&this->transitionCtx.instanceData,
|
|
|
|
|
RGBA8(140, 140, 100, 255));
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
2022-05-17 22:41:50 +00:00
|
|
|
|
} else if (this->transitionCtx.transitionType == TRANS_TYPE_FADE_BLUE) {
|
|
|
|
|
this->transitionCtx.setColor(&this->transitionCtx.instanceData, RGBA8(70, 100, 110, 255));
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->transitionCtx.setUnkColor != NULL) {
|
|
|
|
|
this->transitionCtx.setUnkColor(&this->transitionCtx.instanceData,
|
|
|
|
|
RGBA8(70, 100, 110, 255));
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionCtx.setColor(&this->transitionCtx.instanceData, RGBA8(0, 0, 0, 0));
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->transitionCtx.setUnkColor != NULL) {
|
|
|
|
|
this->transitionCtx.setUnkColor(&this->transitionCtx.instanceData, RGBA8(0, 0, 0, 0));
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->transitionTrigger == TRANS_TRIGGER_END) {
|
|
|
|
|
this->transitionCtx.setType(&this->transitionCtx.instanceData, 1);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionCtx.setType(&this->transitionCtx.instanceData, 2);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionCtx.start(&this->transitionCtx.instanceData);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_CS_DELAYED) {
|
|
|
|
|
this->transitionMode = TRANS_MODE_INSTANCE_WAIT;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionMode = TRANS_MODE_INSTANCE_RUNNING;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
case TRANS_MODE_INSTANCE_RUNNING:
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->transitionCtx.isDone(&this->transitionCtx.instanceData)) {
|
|
|
|
|
if (this->transitionCtx.transitionType >= TRANS_TYPE_MAX) {
|
|
|
|
|
if (this->transitionTrigger == TRANS_TRIGGER_END) {
|
|
|
|
|
this->transitionCtx.destroy(&this->transitionCtx.instanceData);
|
|
|
|
|
func_800BC88C(this);
|
|
|
|
|
this->transitionMode = TRANS_MODE_OFF;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
2022-05-17 22:41:50 +00:00
|
|
|
|
} else if (this->transitionTrigger != TRANS_TRIGGER_END) {
|
|
|
|
|
this->state.running = false;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
2020-04-16 21:36:12 +00:00
|
|
|
|
if (gSaveContext.gameMode != 2) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState);
|
2022-05-17 22:41:50 +00:00
|
|
|
|
gSaveContext.entranceIndex = this->nextEntranceIndex;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
2020-04-16 21:36:12 +00:00
|
|
|
|
if (gSaveContext.minigameState == 1) {
|
|
|
|
|
gSaveContext.minigameState = 3;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
SET_NEXT_GAMESTATE(&this->state, FileChoose_Init, FileChooseContext);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionCtx.destroy(&this->transitionCtx.instanceData);
|
|
|
|
|
func_800BC88C(this);
|
|
|
|
|
this->transitionMode = TRANS_MODE_OFF;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
|
if (gTrnsnUnkState == 3) {
|
|
|
|
|
TransitionUnk_Destroy(&sTrnsnUnk);
|
|
|
|
|
gTrnsnUnkState = 0;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
R_UPDATE_RATE = 3;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionTrigger = TRANS_TRIGGER_OFF;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionCtx.update(&this->transitionCtx.instanceData, R_UPDATE_RATE);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
// update non-instance transitions
|
2022-05-17 22:41:50 +00:00
|
|
|
|
switch (this->transitionMode) {
|
2022-04-27 20:00:25 +00:00
|
|
|
|
case TRANS_MODE_FILL_WHITE_INIT:
|
|
|
|
|
sTransitionFillTimer = 0;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->envCtx.fillScreen = true;
|
|
|
|
|
this->envCtx.screenFillColor[0] = 160;
|
|
|
|
|
this->envCtx.screenFillColor[1] = 160;
|
|
|
|
|
this->envCtx.screenFillColor[2] = 160;
|
|
|
|
|
|
|
|
|
|
if (this->transitionTrigger != TRANS_TRIGGER_END) {
|
|
|
|
|
this->envCtx.screenFillColor[3] = 0;
|
|
|
|
|
this->transitionMode = TRANS_MODE_FILL_IN;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->envCtx.screenFillColor[3] = 255;
|
|
|
|
|
this->transitionMode = TRANS_MODE_FILL_OUT;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
case TRANS_MODE_FILL_IN:
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->envCtx.screenFillColor[3] = (sTransitionFillTimer / 20.0f) * 255.0f;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
|
|
|
|
if (sTransitionFillTimer >= 20) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->state.running = false;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState);
|
2022-05-17 22:41:50 +00:00
|
|
|
|
gSaveContext.entranceIndex = this->nextEntranceIndex;
|
|
|
|
|
this->transitionTrigger = TRANS_TRIGGER_OFF;
|
|
|
|
|
this->transitionMode = TRANS_MODE_OFF;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-04-27 20:00:25 +00:00
|
|
|
|
sTransitionFillTimer++;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
case TRANS_MODE_FILL_OUT:
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->envCtx.screenFillColor[3] = (1 - sTransitionFillTimer / 20.0f) * 255.0f;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
|
|
|
|
if (sTransitionFillTimer >= 20) {
|
2020-04-30 18:41:09 +00:00
|
|
|
|
gTrnsnUnkState = 0;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
R_UPDATE_RATE = 3;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionTrigger = TRANS_TRIGGER_OFF;
|
|
|
|
|
this->transitionMode = TRANS_MODE_OFF;
|
|
|
|
|
this->envCtx.fillScreen = false;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-04-27 20:00:25 +00:00
|
|
|
|
sTransitionFillTimer++;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
case TRANS_MODE_FILL_BROWN_INIT:
|
|
|
|
|
sTransitionFillTimer = 0;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->envCtx.fillScreen = true;
|
|
|
|
|
this->envCtx.screenFillColor[0] = 170;
|
|
|
|
|
this->envCtx.screenFillColor[1] = 160;
|
|
|
|
|
this->envCtx.screenFillColor[2] = 150;
|
|
|
|
|
|
|
|
|
|
if (this->transitionTrigger != TRANS_TRIGGER_END) {
|
|
|
|
|
this->envCtx.screenFillColor[3] = 0;
|
|
|
|
|
this->transitionMode = TRANS_MODE_FILL_IN;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->envCtx.screenFillColor[3] = 255;
|
|
|
|
|
this->transitionMode = TRANS_MODE_FILL_OUT;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
case TRANS_MODE_INSTANT:
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->transitionTrigger != TRANS_TRIGGER_END) {
|
|
|
|
|
this->state.running = false;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState);
|
2022-05-17 22:41:50 +00:00
|
|
|
|
gSaveContext.entranceIndex = this->nextEntranceIndex;
|
|
|
|
|
this->transitionTrigger = TRANS_TRIGGER_OFF;
|
|
|
|
|
this->transitionMode = TRANS_MODE_OFF;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2020-04-30 18:41:09 +00:00
|
|
|
|
gTrnsnUnkState = 0;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
R_UPDATE_RATE = 3;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionTrigger = TRANS_TRIGGER_OFF;
|
|
|
|
|
this->transitionMode = TRANS_MODE_OFF;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
case TRANS_MODE_INSTANCE_WAIT:
|
|
|
|
|
if (gSaveContext.cutsceneTransitionControl != 0) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionMode = TRANS_MODE_INSTANCE_RUNNING;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
case TRANS_MODE_SANDSTORM_INIT:
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->transitionTrigger != TRANS_TRIGGER_END) {
|
2022-04-27 20:00:25 +00:00
|
|
|
|
// trigger in, leaving area
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->envCtx.sandstormState = SANDSTORM_FILL;
|
|
|
|
|
this->transitionMode = TRANS_MODE_SANDSTORM;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->envCtx.sandstormState = SANDSTORM_UNFILL;
|
|
|
|
|
this->envCtx.sandstormPrimA = 255;
|
|
|
|
|
this->envCtx.sandstormEnvA = 255;
|
|
|
|
|
this->transitionMode = TRANS_MODE_SANDSTORM;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
case TRANS_MODE_SANDSTORM:
|
2022-04-23 14:55:18 +00:00
|
|
|
|
Audio_PlaySoundGeneral(NA_SE_EV_SAND_STORM - SFX_FLAG, &gSfxDefaultPos, 4,
|
|
|
|
|
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
|
|
|
|
|
&gSfxDefaultReverb);
|
2022-04-27 20:00:25 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->transitionTrigger == TRANS_TRIGGER_END) {
|
|
|
|
|
if (this->envCtx.sandstormPrimA < 110) {
|
2020-04-30 18:41:09 +00:00
|
|
|
|
gTrnsnUnkState = 0;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
R_UPDATE_RATE = 3;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionTrigger = TRANS_TRIGGER_OFF;
|
|
|
|
|
this->transitionMode = TRANS_MODE_OFF;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->envCtx.sandstormEnvA == 255) {
|
|
|
|
|
this->state.running = false;
|
2022-05-21 18:23:43 +00:00
|
|
|
|
SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState);
|
2022-05-17 22:41:50 +00:00
|
|
|
|
gSaveContext.entranceIndex = this->nextEntranceIndex;
|
|
|
|
|
this->transitionTrigger = TRANS_TRIGGER_OFF;
|
|
|
|
|
this->transitionMode = TRANS_MODE_OFF;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
case TRANS_MODE_SANDSTORM_END_INIT:
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->transitionTrigger == TRANS_TRIGGER_END) {
|
|
|
|
|
this->envCtx.sandstormState = SANDSTORM_DISSIPATE;
|
|
|
|
|
this->envCtx.sandstormPrimA = 255;
|
|
|
|
|
this->envCtx.sandstormEnvA = 255;
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "It's here!!!!!!!!!"
|
|
|
|
|
LOG_STRING("来た!!!!!!!!!!!!!!!!!!!!!", "../z_play.c", 3471);
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionMode = TRANS_MODE_SANDSTORM_END;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionMode = TRANS_MODE_SANDSTORM_INIT;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
case TRANS_MODE_SANDSTORM_END:
|
2022-04-23 14:55:18 +00:00
|
|
|
|
Audio_PlaySoundGeneral(NA_SE_EV_SAND_STORM - SFX_FLAG, &gSfxDefaultPos, 4,
|
|
|
|
|
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
|
|
|
|
|
&gSfxDefaultReverb);
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->transitionTrigger == TRANS_TRIGGER_END) {
|
|
|
|
|
if (this->envCtx.sandstormPrimA <= 0) {
|
2020-04-30 18:41:09 +00:00
|
|
|
|
gTrnsnUnkState = 0;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
R_UPDATE_RATE = 3;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionTrigger = TRANS_TRIGGER_OFF;
|
|
|
|
|
this->transitionMode = TRANS_MODE_OFF;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
case TRANS_MODE_CS_BLACK_FILL_INIT:
|
|
|
|
|
sTransitionFillTimer = 0;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->envCtx.fillScreen = true;
|
|
|
|
|
this->envCtx.screenFillColor[0] = 0;
|
|
|
|
|
this->envCtx.screenFillColor[1] = 0;
|
|
|
|
|
this->envCtx.screenFillColor[2] = 0;
|
|
|
|
|
this->envCtx.screenFillColor[3] = 255;
|
|
|
|
|
this->transitionMode = TRANS_MODE_CS_BLACK_FILL;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2022-04-27 20:00:25 +00:00
|
|
|
|
case TRANS_MODE_CS_BLACK_FILL:
|
|
|
|
|
if (gSaveContext.cutsceneTransitionControl != 0) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->envCtx.screenFillColor[3] = gSaveContext.cutsceneTransitionControl;
|
2022-04-27 20:00:25 +00:00
|
|
|
|
if (gSaveContext.cutsceneTransitionControl <= 100) {
|
2020-04-30 18:41:09 +00:00
|
|
|
|
gTrnsnUnkState = 0;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
R_UPDATE_RATE = 3;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionTrigger = TRANS_TRIGGER_OFF;
|
|
|
|
|
this->transitionMode = TRANS_MODE_OFF;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3533);
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
|
if (1 && (gTrnsnUnkState != 3)) {
|
2021-02-15 17:29:06 +00:00
|
|
|
|
if (1 && HREG(63)) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3542);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if ((gSaveContext.gameMode == 0) && (this->msgCtx.msgMode == MSGMODE_NONE) &&
|
|
|
|
|
(this->gameOverCtx.state == GAMEOVER_INACTIVE)) {
|
|
|
|
|
KaleidoSetup_Update(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3551);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
sp80 = (this->pauseCtx.state != 0) || (this->pauseCtx.debugState != 0);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3555);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
AnimationContext_Reset(&this->animationCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3561);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Object_UpdateBank(&this->objectCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3577);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((sp80 == 0) && (IREG(72) == 0)) {
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3580);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->gameplayFrames++;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
func_800AA178(1);
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->actorCtx.freezeFlashTimer && (this->actorCtx.freezeFlashTimer-- < 5)) {
|
|
|
|
|
osSyncPrintf("FINISH=%d\n", this->actorCtx.freezeFlashTimer);
|
|
|
|
|
if ((this->actorCtx.freezeFlashTimer > 0) && ((this->actorCtx.freezeFlashTimer % 2) != 0)) {
|
|
|
|
|
this->envCtx.fillScreen = true;
|
|
|
|
|
this->envCtx.screenFillColor[0] = this->envCtx.screenFillColor[1] =
|
|
|
|
|
this->envCtx.screenFillColor[2] = 150;
|
|
|
|
|
this->envCtx.screenFillColor[3] = 80;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->envCtx.fillScreen = false;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3606);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
func_800973FC(this, &this->roomCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3612);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
CollisionCheck_AT(this, &this->colChkCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3618);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
CollisionCheck_OC(this, &this->colChkCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3624);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
CollisionCheck_Damage(this, &this->colChkCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3631);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
CollisionCheck_ClearContext(this, &this->colChkCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3637);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (!this->unk_11DE9) {
|
|
|
|
|
Actor_UpdateAll(this, &this->actorCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3643);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
func_80064558(this, &this->csCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3648);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
func_800645A0(this, &this->csCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3651);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Effect_UpdateAll(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3657);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
EffectSs_UpdateAll(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3662);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
func_800AA178(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3672);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
func_80095AA0(this, &this->roomCtx.curRoom, &input[1], 0);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3675);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
func_80095AA0(this, &this->roomCtx.prevRoom, &input[1], 1);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3677);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->unk_1242B != 0) {
|
2020-10-03 15:22:44 +00:00
|
|
|
|
if (CHECK_BTN_ALL(input[0].press.button, BTN_CUP)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugState != 0)) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "Changing viewpoint is prohibited due to the kaleidoscope"
|
2020-04-16 21:36:12 +00:00
|
|
|
|
osSyncPrintf(VT_FGCOL(CYAN) "カレイドスコープ中につき視点変更を禁止しております\n" VT_RST);
|
2022-05-17 22:41:50 +00:00
|
|
|
|
} else if (Player_InCsMode(this)) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "Changing viewpoint is prohibited during the cutscene"
|
2020-04-16 21:36:12 +00:00
|
|
|
|
osSyncPrintf(VT_FGCOL(CYAN) "デモ中につき視点変更を禁止しております\n" VT_RST);
|
|
|
|
|
} else if (YREG(15) == 0x10) {
|
2022-04-23 14:55:18 +00:00
|
|
|
|
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
|
|
|
|
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
func_800BC490(this, this->unk_1242B ^ 3);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-05-17 22:41:50 +00:00
|
|
|
|
func_800BC450(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3708);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
SkyboxDraw_Update(&this->skyboxCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3716);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugState != 0)) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3721);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
KaleidoScopeCall_Update(this);
|
|
|
|
|
} else if (this->gameOverCtx.state != GAMEOVER_INACTIVE) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3727);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
GameOver_Update(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3733);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Message_Update(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3737);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3742);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Interface_Update(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3765);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
AnimationContext_Update(this, &this->animationCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3771);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
SoundSource_UpdateAll(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3777);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-09 01:54:39 +00:00
|
|
|
|
ShrinkWindow_Update(R_UPDATE_RATE);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3783);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
TransitionFade_Update(&this->transitionFade, R_UPDATE_RATE);
|
2021-02-15 17:29:06 +00:00
|
|
|
|
} else {
|
|
|
|
|
goto skip;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3799);
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-15 17:29:06 +00:00
|
|
|
|
skip:
|
2020-04-16 21:36:12 +00:00
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3801);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-12 13:04:37 +00:00
|
|
|
|
if ((sp80 == 0) || gDbgCamEnabled) {
|
2021-02-15 17:29:06 +00:00
|
|
|
|
s32 pad3[5];
|
|
|
|
|
s32 i;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->nextCamId = this->activeCamId;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3806);
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-31 16:18:31 +00:00
|
|
|
|
for (i = 0; i < NUM_CAMS; i++) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if ((i != this->nextCamId) && (this->cameraPtrs[i] != NULL)) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3809);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Camera_Update(this->cameraPtrs[i]);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Camera_Update(this->cameraPtrs[this->nextCamId]);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3814);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 3816);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Environment_Update(this, &this->envCtx, &this->lightCtx, &this->pauseCtx, &this->msgCtx, &this->gameOverCtx,
|
|
|
|
|
this->state.gfxCtx);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_DrawOverlayElements(PlayState* this) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugState != 0)) {
|
|
|
|
|
KaleidoScopeCall_Draw(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (gSaveContext.gameMode == 0) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Interface_Draw(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Message_Draw(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->gameOverCtx.state != GAMEOVER_INACTIVE) {
|
|
|
|
|
GameOver_FadeInLights(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_Draw(PlayState* this) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
GraphicsContext* gfxCtx = this->state.gfxCtx;
|
2020-09-05 13:45:10 +00:00
|
|
|
|
Lights* sp228;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
Vec3f sp21C;
|
|
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
|
OPEN_DISPS(gfxCtx, "../z_play.c", 3907);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
|
|
|
|
|
gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
|
|
|
|
|
gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
|
|
|
|
|
gSPSegment(POLY_XLU_DISP++, 0x00, NULL);
|
|
|
|
|
gSPSegment(OVERLAY_DISP++, 0x00, NULL);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
|
|
|
|
|
gSPSegment(POLY_XLU_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
|
|
|
|
|
gSPSegment(OVERLAY_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
|
|
|
|
|
gSPSegment(POLY_XLU_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
|
|
|
|
|
gSPSegment(OVERLAY_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x02, this->sceneSegment);
|
|
|
|
|
gSPSegment(POLY_XLU_DISP++, 0x02, this->sceneSegment);
|
|
|
|
|
gSPSegment(OVERLAY_DISP++, 0x02, this->sceneSegment);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
func_80095248(gfxCtx, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) != 10) || (HREG(82) != 0)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
POLY_OPA_DISP = Play_SetFog(this, POLY_OPA_DISP);
|
|
|
|
|
POLY_XLU_DISP = Play_SetFog(this, POLY_XLU_DISP);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
View_SetPerspective(&this->view, this->view.fovy, this->view.zNear, this->lightCtx.fogFar);
|
|
|
|
|
View_Apply(&this->view, VIEW_ALL);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2021-11-30 23:52:16 +00:00
|
|
|
|
// The billboard matrix temporarily stores the viewing matrix
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Matrix_MtxToMtxF(&this->view.viewing, &this->billboardMtxF);
|
|
|
|
|
Matrix_MtxToMtxF(&this->view.projection, &this->viewProjectionMtxF);
|
|
|
|
|
Matrix_Mult(&this->viewProjectionMtxF, MTXMODE_NEW);
|
2021-11-30 23:52:16 +00:00
|
|
|
|
// The billboard is still a viewing matrix at this stage
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Matrix_Mult(&this->billboardMtxF, MTXMODE_APPLY);
|
|
|
|
|
Matrix_Get(&this->viewProjectionMtxF);
|
|
|
|
|
this->billboardMtxF.mf[0][3] = this->billboardMtxF.mf[1][3] = this->billboardMtxF.mf[2][3] =
|
|
|
|
|
this->billboardMtxF.mf[3][0] = this->billboardMtxF.mf[3][1] = this->billboardMtxF.mf[3][2] = 0.0f;
|
2021-11-30 23:52:16 +00:00
|
|
|
|
// This transpose is where the viewing matrix is properly converted into a billboard matrix
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Matrix_Transpose(&this->billboardMtxF);
|
|
|
|
|
this->billboardMtx = Matrix_MtxFToMtx(Matrix_CheckFloats(&this->billboardMtxF, "../z_play.c", 4005),
|
|
|
|
|
Graph_Alloc(gfxCtx, sizeof(Mtx)));
|
2021-11-30 23:52:16 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x01, this->billboardMtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if ((HREG(80) != 10) || (HREG(92) != 0)) {
|
2021-02-15 17:29:06 +00:00
|
|
|
|
Gfx* gfxP;
|
2020-10-29 21:31:09 +00:00
|
|
|
|
Gfx* sp1CC = POLY_OPA_DISP;
|
2021-03-31 16:18:31 +00:00
|
|
|
|
|
2021-02-15 17:29:06 +00:00
|
|
|
|
gfxP = Graph_GfxPlusOne(sp1CC);
|
2020-10-29 21:31:09 +00:00
|
|
|
|
gSPDisplayList(OVERLAY_DISP++, gfxP);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if ((this->transitionMode == TRANS_MODE_INSTANCE_RUNNING) ||
|
|
|
|
|
(this->transitionMode == TRANS_MODE_INSTANCE_WAIT) || (this->transitionCtx.transitionType >= 56)) {
|
2021-02-15 17:29:06 +00:00
|
|
|
|
View view;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
View_Init(&view, gfxCtx);
|
2022-04-08 22:50:28 +00:00
|
|
|
|
view.flags = VIEW_VIEWPORT | VIEW_PROJECTION_ORTHO;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2020-06-14 02:59:58 +00:00
|
|
|
|
SET_FULLSCREEN_VIEWPORT(&view);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-04-08 22:50:28 +00:00
|
|
|
|
View_ApplyTo(&view, VIEW_ALL, &gfxP);
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionCtx.draw(&this->transitionCtx.instanceData, &gfxP);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
TransitionFade_Draw(&this->transitionFade, &gfxP);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2020-07-17 01:37:53 +00:00
|
|
|
|
if (D_801614B0.a > 0) {
|
2020-05-14 23:11:33 +00:00
|
|
|
|
D_80161498.primColor.rgba = D_801614B0.rgba;
|
2020-05-15 09:02:39 +00:00
|
|
|
|
VisMono_Draw(&D_80161498, &gfxP);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
|
gSPEndDisplayList(gfxP++);
|
|
|
|
|
Graph_BranchDlist(sp1CC, gfxP);
|
2020-10-29 21:31:09 +00:00
|
|
|
|
POLY_OPA_DISP = gfxP;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
|
if (gTrnsnUnkState == 3) {
|
2020-10-29 21:31:09 +00:00
|
|
|
|
Gfx* sp88 = POLY_OPA_DISP;
|
2021-03-31 16:18:31 +00:00
|
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
|
TransitionUnk_Draw(&sTrnsnUnk, &sp88);
|
2020-10-29 21:31:09 +00:00
|
|
|
|
POLY_OPA_DISP = sp88;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
goto Play_Draw_DrawOverlayElements;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
PreRender_SetValues(&this->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, gfxCtx->curFrameBuffer, gZBuffer);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (R_PAUSE_MENU_MODE == 2) {
|
|
|
|
|
MsgEvent_SendNullTask();
|
2022-05-17 22:41:50 +00:00
|
|
|
|
PreRender_Calc(&this->pauseBgPreRender);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
R_PAUSE_MENU_MODE = 3;
|
|
|
|
|
} else if (R_PAUSE_MENU_MODE >= 4) {
|
|
|
|
|
R_PAUSE_MENU_MODE = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (R_PAUSE_MENU_MODE == 3) {
|
2020-10-29 21:31:09 +00:00
|
|
|
|
Gfx* sp84 = POLY_OPA_DISP;
|
2021-03-31 16:18:31 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
func_800C24BC(&this->pauseBgPreRender, &sp84);
|
2020-10-29 21:31:09 +00:00
|
|
|
|
POLY_OPA_DISP = sp84;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
goto Play_Draw_DrawOverlayElements;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
|
|
|
|
s32 sp80;
|
2021-03-31 16:18:31 +00:00
|
|
|
|
|
2020-04-16 21:36:12 +00:00
|
|
|
|
if ((HREG(80) != 10) || (HREG(83) != 0)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->skyboxId && (this->skyboxId != SKYBOX_UNSET_1D) && !this->envCtx.skyboxDisabled) {
|
|
|
|
|
if ((this->skyboxId == SKYBOX_NORMAL_SKY) || (this->skyboxId == SKYBOX_CUTSCENE_MAP)) {
|
|
|
|
|
Environment_UpdateSkybox(this->skyboxId, &this->envCtx, &this->skyboxCtx);
|
|
|
|
|
SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, this->envCtx.skyboxBlend,
|
|
|
|
|
this->view.eye.x, this->view.eye.y, this->view.eye.z);
|
|
|
|
|
} else if (this->skyboxCtx.unk_140 == 0) {
|
|
|
|
|
SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x,
|
|
|
|
|
this->view.eye.y, this->view.eye.z);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) != 10) || (HREG(90) & 2)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (!this->envCtx.sunMoonDisabled) {
|
|
|
|
|
Environment_DrawSunAndMoon(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) != 10) || (HREG(90) & 1)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Environment_DrawSkyboxFilters(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) != 10) || (HREG(90) & 4)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Environment_UpdateLightningStrike(this);
|
|
|
|
|
Environment_DrawLightning(this, 0);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) != 10) || (HREG(90) & 8)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
sp228 = LightContext_NewLights(&this->lightCtx, gfxCtx);
|
|
|
|
|
Lights_BindAll(sp228, this->lightCtx.listHead, NULL);
|
2020-09-05 13:45:10 +00:00
|
|
|
|
Lights_Draw(sp228, gfxCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) != 10) || (HREG(84) != 0)) {
|
|
|
|
|
if (VREG(94) == 0) {
|
|
|
|
|
if (HREG(80) != 10) {
|
|
|
|
|
sp80 = 3;
|
|
|
|
|
} else {
|
|
|
|
|
sp80 = HREG(84);
|
|
|
|
|
}
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Scene_Draw(this);
|
|
|
|
|
Room_Draw(this, &this->roomCtx.curRoom, sp80 & 3);
|
|
|
|
|
Room_Draw(this, &this->roomCtx.prevRoom, sp80 & 3);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) != 10) || (HREG(83) != 0)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if ((this->skyboxCtx.unk_140 != 0) && (GET_ACTIVE_CAM(this)->setting != CAM_SET_PREREND_FIXED)) {
|
2021-03-31 16:18:31 +00:00
|
|
|
|
Vec3f sp74;
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Camera_GetSkyboxOffset(&sp74, GET_ACTIVE_CAM(this));
|
|
|
|
|
SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x + sp74.x,
|
|
|
|
|
this->view.eye.y + sp74.y, this->view.eye.z + sp74.z);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-20 18:40:13 +00:00
|
|
|
|
if (this->envCtx.precipitation[PRECIP_RAIN_CUR] != 0) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Environment_DrawRain(this, &this->view, gfxCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) != 10) || (HREG(84) != 0)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Environment_FillScreen(gfxCtx, 0, 0, 0, this->unk_11E18, FILL_SCREEN_OPA);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) != 10) || (HREG(85) != 0)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
func_800315AC(this, &this->actorCtx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) != 10) || (HREG(86) != 0)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (!this->envCtx.sunMoonDisabled) {
|
|
|
|
|
sp21C.x = this->view.eye.x + this->envCtx.sunPos.x;
|
|
|
|
|
sp21C.y = this->view.eye.y + this->envCtx.sunPos.y;
|
|
|
|
|
sp21C.z = this->view.eye.z + this->envCtx.sunPos.z;
|
|
|
|
|
Environment_DrawSunLensFlare(this, &this->envCtx, &this->view, gfxCtx, sp21C, 0);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Environment_DrawCustomLensFlare(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) != 10) || (HREG(87) != 0)) {
|
|
|
|
|
if (MREG(64) != 0) {
|
2021-09-20 16:51:35 +00:00
|
|
|
|
Environment_FillScreen(gfxCtx, MREG(65), MREG(66), MREG(67), MREG(68),
|
|
|
|
|
FILL_SCREEN_OPA | FILL_SCREEN_XLU);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
switch (this->envCtx.fillScreen) {
|
2021-02-15 17:29:06 +00:00
|
|
|
|
case 1:
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Environment_FillScreen(gfxCtx, this->envCtx.screenFillColor[0],
|
|
|
|
|
this->envCtx.screenFillColor[1], this->envCtx.screenFillColor[2],
|
|
|
|
|
this->envCtx.screenFillColor[3], FILL_SCREEN_OPA | FILL_SCREEN_XLU);
|
2021-02-15 17:29:06 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) != 10) || (HREG(88) != 0)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->envCtx.sandstormState != SANDSTORM_OFF) {
|
|
|
|
|
Environment_DrawSandstorm(this, this->envCtx.sandstormState);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) != 10) || (HREG(93) != 0)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
DebugDisplay_DrawObjects(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-30 18:41:09 +00:00
|
|
|
|
if ((R_PAUSE_MENU_MODE == 1) || (gTrnsnUnkState == 1)) {
|
2021-02-15 17:29:06 +00:00
|
|
|
|
Gfx* sp70 = OVERLAY_DISP;
|
2021-03-31 16:18:31 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->pauseBgPreRender.fbuf = gfxCtx->curFrameBuffer;
|
|
|
|
|
this->pauseBgPreRender.fbufSave = (u16*)gZBuffer;
|
|
|
|
|
func_800C1F20(&this->pauseBgPreRender, &sp70);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
if (R_PAUSE_MENU_MODE == 1) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->pauseBgPreRender.cvgSave = (u8*)gfxCtx->curFrameBuffer;
|
|
|
|
|
func_800C20B4(&this->pauseBgPreRender, &sp70);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
R_PAUSE_MENU_MODE = 2;
|
|
|
|
|
} else {
|
2020-04-30 18:41:09 +00:00
|
|
|
|
gTrnsnUnkState = 2;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
2021-02-15 17:29:06 +00:00
|
|
|
|
OVERLAY_DISP = sp70;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->unk_121C7 = 2;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
SREG(33) |= 1;
|
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Play_Draw_DrawOverlayElements:
|
2020-04-16 21:36:12 +00:00
|
|
|
|
if ((HREG(80) != 10) || (HREG(89) != 0)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Play_DrawOverlayElements(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->view.unk_124 != 0) {
|
|
|
|
|
Camera_Update(GET_ACTIVE_CAM(this));
|
|
|
|
|
View_UpdateViewingMatrix(&this->view);
|
|
|
|
|
this->view.unk_124 = 0;
|
|
|
|
|
if (this->skyboxId && (this->skyboxId != SKYBOX_UNSET_1D) && !this->envCtx.skyboxDisabled) {
|
|
|
|
|
SkyboxDraw_UpdateMatrix(&this->skyboxCtx, this->view.eye.x, this->view.eye.y, this->view.eye.z);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Camera_Finish(GET_ACTIVE_CAM(this));
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
|
CLOSE_DISPS(gfxCtx, "../z_play.c", 4508);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
void Play_Main(GameState* thisx) {
|
2022-05-21 18:23:43 +00:00
|
|
|
|
PlayState* this = (PlayState*)thisx;
|
2020-10-13 00:44:22 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
D_8012D1F8 = &this->state.input[0];
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
DebugDisplay_Init();
|
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 4556);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) == 10) && (HREG(94) != 10)) {
|
|
|
|
|
HREG(81) = 1;
|
|
|
|
|
HREG(82) = 1;
|
|
|
|
|
HREG(83) = 1;
|
|
|
|
|
HREG(84) = 3;
|
|
|
|
|
HREG(85) = 1;
|
|
|
|
|
HREG(86) = 1;
|
|
|
|
|
HREG(87) = 1;
|
|
|
|
|
HREG(88) = 1;
|
|
|
|
|
HREG(89) = 1;
|
|
|
|
|
HREG(90) = 15;
|
|
|
|
|
HREG(91) = 1;
|
|
|
|
|
HREG(92) = 1;
|
|
|
|
|
HREG(93) = 1;
|
|
|
|
|
HREG(94) = 10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((HREG(80) != 10) || (HREG(81) != 0)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Play_Update(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
2020-06-14 03:29:59 +00:00
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 4583);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Play_Draw(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (1 && HREG(63)) {
|
|
|
|
|
LOG_NUM("1", 1, "../z_play.c", 4587);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// original name: "Game_play_demo_mode_check"
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Play_InCsMode(PlayState* this) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
return (this->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
f32 func_800BFCB8(PlayState* this, MtxF* mf, Vec3f* vec) {
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
CollisionPoly poly;
|
2020-06-07 14:08:06 +00:00
|
|
|
|
f32 temp1;
|
|
|
|
|
f32 temp2;
|
|
|
|
|
f32 temp3;
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
f32 floorY;
|
|
|
|
|
f32 nx;
|
|
|
|
|
f32 ny;
|
|
|
|
|
f32 nz;
|
2020-06-07 14:08:06 +00:00
|
|
|
|
s32 pad[5];
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
floorY = BgCheck_AnyRaycastFloor1(&this->colCtx, &poly, vec);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
if (floorY > BGCHECK_Y_MIN) {
|
|
|
|
|
nx = COLPOLY_GET_NORMAL(poly.normal.x);
|
|
|
|
|
ny = COLPOLY_GET_NORMAL(poly.normal.y);
|
|
|
|
|
nz = COLPOLY_GET_NORMAL(poly.normal.z);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
temp1 = sqrtf(1.0f - SQ(nx));
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2020-06-07 14:08:06 +00:00
|
|
|
|
if (temp1 != 0.0f) {
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
temp2 = ny * temp1;
|
|
|
|
|
temp3 = -nz * temp1;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2020-06-07 14:08:06 +00:00
|
|
|
|
temp3 = 0.0f;
|
|
|
|
|
temp2 = 0.0f;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-06-07 14:08:06 +00:00
|
|
|
|
mf->xx = temp1;
|
2021-08-31 18:19:41 +00:00
|
|
|
|
mf->yx = -nx * temp2;
|
|
|
|
|
mf->zx = nx * temp3;
|
|
|
|
|
mf->xy = nx;
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
mf->yy = ny;
|
2021-08-31 18:19:41 +00:00
|
|
|
|
mf->zy = nz;
|
|
|
|
|
mf->yz = temp3;
|
2020-06-07 14:08:06 +00:00
|
|
|
|
mf->zz = temp2;
|
2021-08-31 18:19:41 +00:00
|
|
|
|
mf->wx = 0.0f;
|
|
|
|
|
mf->wy = 0.0f;
|
|
|
|
|
mf->xz = 0.0f;
|
|
|
|
|
mf->wz = 0.0f;
|
|
|
|
|
mf->xw = vec->x;
|
|
|
|
|
mf->yw = floorY;
|
|
|
|
|
mf->zw = vec->z;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
mf->ww = 1.0f;
|
|
|
|
|
} else {
|
|
|
|
|
mf->xy = 0.0f;
|
|
|
|
|
mf->zx = 0.0f;
|
2021-08-31 18:19:41 +00:00
|
|
|
|
mf->yx = 0.0f;
|
|
|
|
|
mf->xx = 0.0f;
|
|
|
|
|
mf->wz = 0.0f;
|
|
|
|
|
mf->xz = 0.0f;
|
|
|
|
|
mf->wy = 0.0f;
|
|
|
|
|
mf->wx = 0.0f;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
mf->zz = 0.0f;
|
|
|
|
|
mf->yz = 0.0f;
|
2021-08-31 18:19:41 +00:00
|
|
|
|
mf->zy = 0.0f;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
mf->yy = 1.0f;
|
2021-08-31 18:19:41 +00:00
|
|
|
|
mf->xw = vec->x;
|
|
|
|
|
mf->yw = vec->y;
|
|
|
|
|
mf->zw = vec->z;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
mf->ww = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
return floorY;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void* Play_LoadFile(PlayState* this, RomFile* file) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
u32 size;
|
|
|
|
|
void* allocp;
|
|
|
|
|
|
|
|
|
|
size = file->vromEnd - file->vromStart;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
allocp = GameState_Alloc(&this->state, size, "../z_play.c", 4692);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
DmaMgr_SendRequest1(allocp, file->vromStart, size, "../z_play.c", 4694);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-04-16 21:36:12 +00:00
|
|
|
|
return allocp;
|
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_InitEnvironment(PlayState* this, s16 skyboxId) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Skybox_Init(&this->state, &this->skyboxCtx, skyboxId);
|
|
|
|
|
Environment_Init(this, &this->envCtx, 0);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_InitScene(PlayState* this, s32 spawn) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->curSpawn = spawn;
|
|
|
|
|
this->linkActorEntry = NULL;
|
|
|
|
|
this->unk_11DFC = NULL;
|
|
|
|
|
this->setupEntranceList = NULL;
|
|
|
|
|
this->setupExitList = NULL;
|
|
|
|
|
this->cUpElfMsgs = NULL;
|
|
|
|
|
this->setupPathList = NULL;
|
|
|
|
|
this->numSetupActors = 0;
|
|
|
|
|
Object_InitBank(this, &this->objectCtx);
|
|
|
|
|
LightContext_Init(this, &this->lightCtx);
|
|
|
|
|
TransitionActor_InitContext(&this->state, &this->transiActorCtx);
|
|
|
|
|
func_80096FD4(this, &this->roomCtx.curRoom);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
YREG(15) = 0;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.worldMapArea = 0;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Scene_ExecuteCommands(this, this->sceneSegment);
|
|
|
|
|
Play_InitEnvironment(this, this->skyboxId);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_SpawnScene(PlayState* this, s32 sceneNum, s32 spawn) {
|
2021-08-15 23:15:58 +00:00
|
|
|
|
SceneTableEntry* scene = &gSceneTable[sceneNum];
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-04-16 21:36:12 +00:00
|
|
|
|
scene->unk_13 = 0;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->loadedScene = scene;
|
|
|
|
|
this->sceneNum = sceneNum;
|
2022-05-31 18:19:46 +00:00
|
|
|
|
this->sceneDrawConfig = scene->drawConfig;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-03-31 16:18:31 +00:00
|
|
|
|
osSyncPrintf("\nSCENE SIZE %fK\n", (scene->sceneFile.vromEnd - scene->sceneFile.vromStart) / 1024.0f);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->sceneSegment = Play_LoadFile(this, &scene->sceneFile);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
scene->unk_13 = 0;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
ASSERT(this->sceneSegment != NULL, "this->sceneSegment != NULL", "../z_play.c", 4960);
|
2021-04-29 18:39:46 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Play_InitScene(this, spawn);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
osSyncPrintf("ROOM SIZE=%fK\n", func_80096FE8(this, &this->roomCtx) / 1024.0f);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_GetScreenPos(PlayState* this, Vec3f* src, Vec3f* dest) {
|
2022-05-20 18:40:13 +00:00
|
|
|
|
f32 w;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Matrix_Mult(&this->viewProjectionMtxF, MTXMODE_NEW);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
Matrix_MultVec3f(src, dest);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-20 18:40:13 +00:00
|
|
|
|
w = this->viewProjectionMtxF.ww + (this->viewProjectionMtxF.wx * src->x + this->viewProjectionMtxF.wy * src->y +
|
|
|
|
|
this->viewProjectionMtxF.wz * src->z);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-20 18:40:13 +00:00
|
|
|
|
dest->x = (SCREEN_WIDTH / 2) + ((dest->x / w) * (SCREEN_WIDTH / 2));
|
|
|
|
|
dest->y = (SCREEN_HEIGHT / 2) - ((dest->y / w) * (SCREEN_HEIGHT / 2));
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s16 Play_CreateSubCamera(PlayState* this) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
s16 i;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-12 18:35:31 +00:00
|
|
|
|
for (i = CAM_ID_SUB_FIRST; i < NUM_CAMS; i++) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->cameraPtrs[i] == NULL) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-03-31 16:18:31 +00:00
|
|
|
|
if (i == NUM_CAMS) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
osSyncPrintf(VT_COL(RED, WHITE) "camera control: error: fulled sub camera system area\n" VT_RST);
|
2022-05-12 18:35:31 +00:00
|
|
|
|
return CAM_ID_NONE;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
osSyncPrintf("camera control: " VT_BGCOL(CYAN) " " VT_COL(WHITE, BLUE) " create new sub camera [%d] " VT_BGCOL(
|
|
|
|
|
CYAN) " " VT_RST "\n",
|
|
|
|
|
i);
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->cameraPtrs[i] = &this->subCameras[i - CAM_ID_SUB_FIRST];
|
|
|
|
|
Camera_Init(this->cameraPtrs[i], &this->view, &this->colCtx, this);
|
|
|
|
|
this->cameraPtrs[i]->camId = i;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
return i;
|
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s16 Play_GetActiveCamId(PlayState* this) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
return this->activeCamId;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s16 Play_ChangeCameraStatus(PlayState* this, s16 camId, s16 status) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2021-03-31 16:18:31 +00:00
|
|
|
|
if (status == CAM_STAT_ACTIVE) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->activeCamId = camIdx;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
return Camera_ChangeStatus(this->cameraPtrs[camIdx], status);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_ClearCamera(PlayState* this, s16 camId) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-12 18:35:31 +00:00
|
|
|
|
if (camIdx == CAM_ID_MAIN) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
osSyncPrintf(VT_COL(RED, WHITE) "camera control: error: never clear camera !!\n" VT_RST);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->cameraPtrs[camIdx] != NULL) {
|
|
|
|
|
Camera_ChangeStatus(this->cameraPtrs[camIdx], CAM_STAT_UNK100);
|
|
|
|
|
this->cameraPtrs[camIdx] = NULL;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
osSyncPrintf("camera control: " VT_BGCOL(CYAN) " " VT_COL(WHITE, BLUE) " clear sub camera [%d] " VT_BGCOL(
|
|
|
|
|
CYAN) " " VT_RST "\n",
|
|
|
|
|
camIdx);
|
|
|
|
|
} else {
|
|
|
|
|
osSyncPrintf(VT_COL(RED, WHITE) "camera control: error: camera No.%d already cleared\n" VT_RST, camIdx);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_ClearAllSubCameras(PlayState* this) {
|
2022-05-12 18:35:31 +00:00
|
|
|
|
s16 subCamId;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-12 18:35:31 +00:00
|
|
|
|
for (subCamId = CAM_ID_SUB_FIRST; subCamId < NUM_CAMS; subCamId++) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->cameraPtrs[subCamId] != NULL) {
|
|
|
|
|
Play_ClearCamera(this, subCamId);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->activeCamId = CAM_ID_MAIN;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
Camera* Play_GetCamera(PlayState* this, s16 camId) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
return this->cameraPtrs[camIdx];
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Play_CameraSetAtEye(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye) {
|
2020-08-15 17:23:29 +00:00
|
|
|
|
s32 ret = 0;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
|
|
|
|
|
Camera* camera = this->cameraPtrs[camIdx];
|
2020-04-16 21:36:12 +00:00
|
|
|
|
Player* player;
|
|
|
|
|
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
|
ret |= Camera_SetParam(camera, 1, at);
|
2020-08-15 17:23:29 +00:00
|
|
|
|
ret <<= 1;
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
|
ret |= Camera_SetParam(camera, 2, eye);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
|
camera->dist = Math3D_Vec3f_DistXYZ(at, eye);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
player = camera->player;
|
|
|
|
|
if (player != NULL) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
camera->posOffset.x = at->x - player->actor.world.pos.x;
|
|
|
|
|
camera->posOffset.y = at->y - player->actor.world.pos.y;
|
|
|
|
|
camera->posOffset.z = at->z - player->actor.world.pos.z;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
|
camera->posOffset.x = camera->posOffset.y = camera->posOffset.z = 0.0f;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
|
camera->atLERPStepScale = 0.01f;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Play_CameraSetAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) {
|
2020-08-15 17:23:29 +00:00
|
|
|
|
s32 ret = 0;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
|
|
|
|
|
Camera* camera = this->cameraPtrs[camIdx];
|
2020-04-16 21:36:12 +00:00
|
|
|
|
Player* player;
|
|
|
|
|
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
|
ret |= Camera_SetParam(camera, 1, at);
|
2020-08-15 17:23:29 +00:00
|
|
|
|
ret <<= 1;
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
|
ret |= Camera_SetParam(camera, 2, eye);
|
2020-08-15 17:23:29 +00:00
|
|
|
|
ret <<= 1;
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
|
ret |= Camera_SetParam(camera, 4, up);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
|
camera->dist = Math3D_Vec3f_DistXYZ(at, eye);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
player = camera->player;
|
|
|
|
|
if (player != NULL) {
|
2021-01-18 21:04:04 +00:00
|
|
|
|
camera->posOffset.x = at->x - player->actor.world.pos.x;
|
|
|
|
|
camera->posOffset.y = at->y - player->actor.world.pos.y;
|
|
|
|
|
camera->posOffset.z = at->z - player->actor.world.pos.z;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
|
camera->posOffset.x = camera->posOffset.y = camera->posOffset.z = 0.0f;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
|
camera->atLERPStepScale = 0.01f;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Play_CameraSetFov(PlayState* this, s16 camId, f32 fov) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
s32 ret = Camera_SetParam(this->cameraPtrs[camId], 0x20, &fov) & 1;
|
2021-11-30 23:40:42 +00:00
|
|
|
|
|
2020-08-15 17:23:29 +00:00
|
|
|
|
if (1) {}
|
|
|
|
|
return ret;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Play_SetCameraRoll(PlayState* this, s16 camId, s16 roll) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
|
|
|
|
|
Camera* camera = this->cameraPtrs[camIdx];
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
|
camera->roll = roll;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-04-16 21:36:12 +00:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_CopyCamera(PlayState* this, s16 destCamId, s16 srcCamId) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
s16 srcCamId2 = (srcCamId == CAM_ID_NONE) ? this->activeCamId : srcCamId;
|
|
|
|
|
s16 destCamId1 = (destCamId == CAM_ID_NONE) ? this->activeCamId : destCamId;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Camera_Copy(this->cameraPtrs[destCamId1], this->cameraPtrs[srcCamId2]);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_800C0808(PlayState* this, s16 camId, Player* player, s16 setting) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
Camera* camera;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
camera = this->cameraPtrs[camIdx];
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
|
Camera_InitPlayerSettings(camera, player);
|
|
|
|
|
return Camera_ChangeSetting(camera, setting);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 Play_CameraChangeSetting(PlayState* this, s16 camId, s16 setting) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
return Camera_ChangeSetting(Play_GetCamera(this, camId), setting);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void func_800C08AC(PlayState* this, s16 camId, s16 arg2) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
s16 i;
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Play_ClearCamera(this, camIdx);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-12 18:35:31 +00:00
|
|
|
|
for (i = CAM_ID_SUB_FIRST; i < NUM_CAMS; i++) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (this->cameraPtrs[i] != NULL) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
osSyncPrintf(
|
|
|
|
|
VT_COL(RED, WHITE) "camera control: error: return to main, other camera left. %d cleared!!\n" VT_RST,
|
|
|
|
|
i);
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Play_ClearCamera(this, i);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (arg2 <= 0) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Play_ChangeCameraStatus(this, CAM_ID_MAIN, CAM_STAT_ACTIVE);
|
|
|
|
|
this->cameraPtrs[CAM_ID_MAIN]->childCamId = this->cameraPtrs[CAM_ID_MAIN]->parentCamId = CAM_ID_MAIN;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
OnePointCutscene_Init(this, 1020, arg2, NULL, CAM_ID_MAIN);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s16 Play_CameraGetUID(PlayState* this, s16 camId) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Camera* camera = this->cameraPtrs[camId];
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
|
|
|
|
if (camera != NULL) {
|
2020-04-30 14:49:11 +00:00
|
|
|
|
return camera->uid;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s16 func_800C09D8(PlayState* this, s16 camId, s16 arg2) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Camera* camera = this->cameraPtrs[camId];
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-04-16 21:36:12 +00:00
|
|
|
|
if (camera != NULL) {
|
|
|
|
|
return 0;
|
2020-04-30 14:49:11 +00:00
|
|
|
|
} else if (camera->uid != arg2) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
return 0;
|
2021-03-31 16:18:31 +00:00
|
|
|
|
} else if (camera->status != CAM_STAT_ACTIVE) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
return 2;
|
|
|
|
|
} else {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_SaveSceneFlags(PlayState* this) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
SavedSceneFlags* savedSceneFlags = &gSaveContext.sceneFlags[this->sceneNum];
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
savedSceneFlags->chest = this->actorCtx.flags.chest;
|
|
|
|
|
savedSceneFlags->swch = this->actorCtx.flags.swch;
|
|
|
|
|
savedSceneFlags->clear = this->actorCtx.flags.clear;
|
|
|
|
|
savedSceneFlags->collect = this->actorCtx.flags.collect;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_SetRespawnData(PlayState* this, s32 respawnMode, s16 entranceIndex, s32 roomIndex, s32 playerParams,
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Vec3f* pos, s16 yaw) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
RespawnData* respawnData = &gSaveContext.respawn[respawnMode];
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-04-16 21:36:12 +00:00
|
|
|
|
respawnData->entranceIndex = entranceIndex;
|
|
|
|
|
respawnData->roomIndex = roomIndex;
|
|
|
|
|
respawnData->pos = *pos;
|
|
|
|
|
respawnData->yaw = yaw;
|
|
|
|
|
respawnData->playerParams = playerParams;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
respawnData->tempSwchFlags = this->actorCtx.flags.tempSwch;
|
|
|
|
|
respawnData->tempCollectFlags = this->actorCtx.flags.tempCollect;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_SetupRespawnPoint(PlayState* this, s32 respawnMode, s32 playerParams) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Player* player = GET_PLAYER(this);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
s32 entranceIndex;
|
|
|
|
|
s8 roomIndex;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if ((this->sceneNum != SCENE_YOUSEI_IZUMI_TATE) && (this->sceneNum != SCENE_KAKUSIANA)) {
|
|
|
|
|
roomIndex = this->roomCtx.curRoom.num;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
entranceIndex = gSaveContext.entranceIndex;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Play_SetRespawnData(this, respawnMode, entranceIndex, roomIndex, playerParams, &player->actor.world.pos,
|
|
|
|
|
player->actor.shape.rot.y);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_TriggerVoidOut(PlayState* this) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = this->actorCtx.flags.tempSwch;
|
|
|
|
|
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = this->actorCtx.flags.tempCollect;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.respawnFlag = 1;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionTrigger = TRANS_TRIGGER_START;
|
|
|
|
|
this->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex;
|
|
|
|
|
this->transitionType = TRANS_TYPE_FADE_BLACK;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_LoadToLastEntrance(PlayState* this) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
gSaveContext.respawnFlag = -1;
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionTrigger = TRANS_TRIGGER_START;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if ((this->sceneNum == SCENE_GANON_SONOGO) || (this->sceneNum == SCENE_GANON_FINAL) ||
|
|
|
|
|
(this->sceneNum == SCENE_GANONTIKA_SONOGO) || (this->sceneNum == SCENE_GANON_DEMO)) {
|
|
|
|
|
this->nextEntranceIndex = ENTR_GANON_FINAL_0;
|
|
|
|
|
Item_Give(this, ITEM_SWORD_MASTER);
|
2022-05-09 17:45:53 +00:00
|
|
|
|
} else if ((gSaveContext.entranceIndex == ENTR_SPOT00_11) || (gSaveContext.entranceIndex == ENTR_SPOT00_12) ||
|
|
|
|
|
(gSaveContext.entranceIndex == ENTR_SPOT00_13) || (gSaveContext.entranceIndex == ENTR_SPOT00_15)) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->nextEntranceIndex = ENTR_SPOT00_6;
|
2020-03-22 21:19:43 +00:00
|
|
|
|
} else {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->nextEntranceIndex = gSaveContext.entranceIndex;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
this->transitionType = TRANS_TYPE_FADE_BLACK;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Play_TriggerRespawn(PlayState* this) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
Play_SetupRespawnPoint(this, RESPAWN_MODE_DOWN, 0xDFF);
|
|
|
|
|
Play_LoadToLastEntrance(this);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_800C0CB8(PlayState* this) {
|
2022-05-21 12:54:51 +00:00
|
|
|
|
return (this->roomCtx.curRoom.meshHeader->base.type != 1) && (YREG(15) != 0x20) && (YREG(15) != 0x30) &&
|
2022-05-17 22:41:50 +00:00
|
|
|
|
(YREG(15) != 0x40) && (this->sceneNum != SCENE_HAIRAL_NIWA);
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 FrameAdvance_IsEnabled(PlayState* this) {
|
2022-05-17 22:41:50 +00:00
|
|
|
|
return !!this->frameAdvCtx.enabled;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_800C0D34(PlayState* this, Actor* actor, s16* yaw) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
TransitionActorEntry* transitionActor;
|
2020-09-19 01:45:39 +00:00
|
|
|
|
s32 frontRoom;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2021-01-18 21:04:04 +00:00
|
|
|
|
if (actor->category != ACTORCAT_DOOR) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
transitionActor = &this->transiActorCtx.list[(u16)actor->params >> 10];
|
2020-09-19 01:45:39 +00:00
|
|
|
|
frontRoom = transitionActor->sides[0].room;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
|
if (frontRoom == transitionActor->sides[1].room) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-19 01:45:39 +00:00
|
|
|
|
if (frontRoom == actor->room) {
|
2020-04-16 21:36:12 +00:00
|
|
|
|
*yaw = actor->shape.rot.y;
|
|
|
|
|
} else {
|
|
|
|
|
*yaw = actor->shape.rot.y + 0x8000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
s32 func_800C0DB4(PlayState* this, Vec3f* pos) {
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
WaterBox* waterBox;
|
|
|
|
|
CollisionPoly* poly;
|
|
|
|
|
Vec3f waterSurfacePos;
|
|
|
|
|
s32 bgId;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
waterSurfacePos = *pos;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
|
2022-05-17 22:41:50 +00:00
|
|
|
|
if (WaterBox_GetSurface1(this, &this->colCtx, waterSurfacePos.x, waterSurfacePos.z, &waterSurfacePos.y,
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
&waterBox) == true &&
|
|
|
|
|
pos->y < waterSurfacePos.y &&
|
2022-05-17 22:41:50 +00:00
|
|
|
|
BgCheck_EntityRaycastFloor3(&this->colCtx, &poly, &bgId, &waterSurfacePos) != BGCHECK_Y_MIN) {
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
return true;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
} else {
|
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes
* got matching
* changed order a bit
* clean up bgcheck
* fix conflict
* fix conflict again
* first stab at identifying types, some oks
* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs
* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args
* couple more OKs
* pushing some OKs
* fix compilation issues
* code_800430A0.c OK, more files decomp'd
* 8003A3E0 big OK :)
* Decomp most of func_8003C614, decomp helper funcs
* Decomp SurfaceType, CamData, and WaterBox property related functions
* more OKs, big OK in 8003C078
* more OKs, more progress, move a function definition in z_collision_check to functions.h
* more clean-ups, more OKs, dyn_vtx is now defined as u8*
* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better
* data migrated, more OKs
* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled
* func_80040284, 800409A8 non_matching, add IS_ZERO macro
* All asm files have C representations, some big OKs, lots of minor tweaks
* More OKs, non-matching code cleanup
* 8003FBF4 and 80040BE4 OK, improve codegen for most functions
* format z_bgcheck.c
* fix warnings, compile errors on NON_MATCHING
* func_8003EE80 is now NON_MATCHING
* begin documenting some functions
* formatting
* more documentation, func_8003A95C OK
* fix PHYSICAL_TO_VIRTUAL changes
* fix var rename
* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP
* func_8004239C ok, more NON_MATCHING improvements, more documentation
* Implement most suggested changes
* Convert comments to slower comments
* /**
* Implement ZAP2 changes
* my anti-virus ate my format.sh results
* Rename a couple hundred functions, fix minor stuff
* rename var so that clang formats correctly
* run format.sh
* implement Petrie's matches/suggestions
* format
* matches
* and the asm
* slight error
* Add SSList
* two more matches
* stuff
* implement code changes
* clean up Petrie's matchings
Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
2021-01-08 11:12:58 +00:00
|
|
|
|
return false;
|
2020-04-16 21:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|