match Play_UpdateMain & Play_DrawMain

This commit is contained in:
Alejandro Javier Asenjo Nitti
2023-11-05 18:52:03 -03:00
parent b36e235a94
commit 3cda5a175d
5 changed files with 56 additions and 75 deletions
+1 -1
View File
@@ -508,7 +508,7 @@ void Camera_EarthquakeDay3(Camera* camera);
s32 Camera_UpdateHotRoom(Camera* camera);
s32 Camera_SetSwordDistortion(Camera* camera);
s32 Camera_RequestGiantsMaskSetting(Camera* camera);
Vec3s* Camera_Update(Vec3s* inputDir, Camera* camera);
Vec3s Camera_Update(Camera* camera);
s32 func_800DF498(Camera* camera);
s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 forceChange);
s32 Camera_ChangeMode(Camera* camera, s16 mode);
+5 -10
View File
@@ -7366,7 +7366,7 @@ s32 Camera_RequestGiantsMaskSetting(Camera* camera) {
}
}
Vec3s* Camera_Update(Vec3s* inputDir, Camera* camera) {
Vec3s Camera_Update(Camera* camera) {
Vec3f viewAt;
Vec3f viewEye;
Vec3f viewUp;
@@ -7390,8 +7390,7 @@ Vec3s* Camera_Update(Vec3s* inputDir, Camera* camera) {
// Camera of status CUT only updates to this point
if (camera->status == CAM_STATUS_CUT) {
*inputDir = camera->inputDir;
return inputDir;
return camera->inputDir;
}
sUpdateCameraDirection = false;
@@ -7535,8 +7534,7 @@ Vec3s* Camera_Update(Vec3s* inputDir, Camera* camera) {
// Camera of status WAIT only updates to this point
if (camera->status == CAM_STATUS_WAIT) {
*inputDir = camera->inputDir;
return inputDir;
return camera->inputDir;
}
camera->behaviorFlags = 0;
@@ -7566,8 +7564,7 @@ Vec3s* Camera_Update(Vec3s* inputDir, Camera* camera) {
// Camera of status UNK3 only updates to this point
if (camera->status == CAM_STATUS_UNK3) {
*inputDir = camera->inputDir;
return inputDir;
return camera->inputDir;
}
/**
@@ -7625,9 +7622,7 @@ Vec3s* Camera_Update(Vec3s* inputDir, Camera* camera) {
camera->inputDir.z = 0;
}
*inputDir = camera->inputDir;
return inputDir;
return camera->inputDir;
}
s32 func_800DF498(Camera* camera) {
+25 -36
View File
@@ -915,12 +915,11 @@ const char D_801DFA34[][4] = {
"h", "i", "f", "fa", "fb", "fc", "fd", "fe", "ff", "fg", "fh", "fi", "fj", "fk",
};
#ifdef NON_MATCHING
// Stack issues
void Play_UpdateMain(PlayState* this) {
s32 pad;
Input* input = this->state.input;
u8 freezeFlashTimer;
s32 sp5C = false;
u8 freezeFlashTimer;
gSegments[4] = OS_K0_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment);
gSegments[5] = OS_K0_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment);
@@ -932,6 +931,7 @@ void Play_UpdateMain(PlayState* this) {
Play_TakePictoPhoto(&this->pauseBgPreRender);
R_PICTO_PHOTO_STATE = PICTO_PHOTO_STATE_OFF;
}
Actor_SetMovementScale(this->state.framerateDivisor);
if (FrameAdvance_Update(&this->frameAdvCtx, &input[1])) {
@@ -959,26 +959,28 @@ void Play_UpdateMain(PlayState* this) {
break;
}
}
Play_UpdateTransition(this);
if (gTransitionTileState != TRANS_TILE_READY) {
if ((gSaveContext.gameMode == GAMEMODE_NORMAL) &&
(((this->msgCtx.msgMode == MSGMODE_NONE)) ||
((this->msgCtx.currentTextId == 0xFF) && (this->msgCtx.msgMode == MSGMODE_TEXT_DONE) &&
(this->msgCtx.textboxEndType == TEXTBOX_ENDTYPE_41)) ||
((this->msgCtx.currentTextId >= 0x100) && (this->msgCtx.currentTextId <= 0x200))) &&
if (((gSaveContext.gameMode == GAMEMODE_NORMAL) &&
(((this->msgCtx.msgMode == MSGMODE_NONE) ||
(((this->msgCtx.currentTextId == 0xFF) && (this->msgCtx.msgMode == MSGMODE_TEXT_DONE)) &&
(this->msgCtx.textboxEndType == TEXTBOX_ENDTYPE_41))) ||
((this->msgCtx.currentTextId >= 0x100) && (this->msgCtx.currentTextId <= 0x200)))) &&
(this->gameOverCtx.state == GAMEOVER_INACTIVE)) {
KaleidoSetup_Update(this);
}
sp5C = (this->pauseCtx.state != 0) || (this->pauseCtx.debugEditor != DEBUG_EDITOR_NONE);
AnimationContext_Reset(&this->animationCtx);
Object_UpdateEntries(&this->objectCtx);
if (!sp5C && (IREG(72) == 0)) {
this->gameplayFrames++;
Rumble_SetUpdateEnabled(true);
if ((this->actorCtx.freezeFlashTimer != 0) && (this->actorCtx.freezeFlashTimer-- < 5)) {
if ((this->actorCtx.freezeFlashTimer != 0) && ((this->actorCtx.freezeFlashTimer--) < 5)) {
freezeFlashTimer = this->actorCtx.freezeFlashTimer;
if ((freezeFlashTimer > 0) && ((freezeFlashTimer % 2) != 0)) {
this->envCtx.fillScreen = true;
@@ -1026,17 +1028,16 @@ void Play_UpdateMain(PlayState* this) {
}
}
if (!sp5C || gDbgCamEnabled) {
s32 sp54; // camId
Vec3s sp48; // InputDir
if ((!sp5C) || gDbgCamEnabled) {
s32 i;
this->nextCamera = this->activeCamId;
for (sp54 = 0; sp54 < 4; sp54++) {
if ((sp54 != this->nextCamera) && (this->cameraPtrs[sp54] != NULL)) {
Camera_Update(&sp48, this->cameraPtrs[sp54]);
for (i = 0; i < 4; i++) {
if ((i != this->nextCamera) && (this->cameraPtrs[i] != NULL)) {
Camera_Update(this->cameraPtrs[i]);
}
}
Camera_Update(&sp48, this->cameraPtrs[this->nextCamera]);
Camera_Update(this->cameraPtrs[this->nextCamera]);
}
if (!sp5C) {
@@ -1055,10 +1056,6 @@ void Play_UpdateMain(PlayState* this) {
}
}
}
#else
void Play_UpdateMain(PlayState* this);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_UpdateMain.s")
#endif
void Play_Update(PlayState* this) {
if (!sBombersNotebookOpen) {
@@ -1128,13 +1125,12 @@ void Play_PostWorldDraw(PlayState* this) {
}
}
#ifdef NON_MATCHING
// Something weird going on with the stack of the unused arg0 of `Camera_Update`
void Play_DrawMain(PlayState* this) {
GraphicsContext* gfxCtx = this->state.gfxCtx;
Lights* sp268;
Vec3f sp25C;
Vec3f temp;
u8 sp25B = false;
f32 var_fv0; // zFar
if (R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_UNK4) {
PreRender_ApplyFiltersSlowlyDestroy(&this->pauseBgPreRender);
@@ -1171,7 +1167,6 @@ void Play_DrawMain(PlayState* this) {
gSPSegment(OVERLAY_DISP++, 0x02, this->sceneSegment);
if (1) {
f32 var_fv0; // zFar
ShrinkWindow_Draw(gfxCtx);
@@ -1340,10 +1335,10 @@ void Play_DrawMain(PlayState* this) {
if (1) {
if (!this->envCtx.sunDisabled) {
sp25C.x = this->view.eye.x + this->envCtx.sunPos.x;
sp25C.y = this->view.eye.y + this->envCtx.sunPos.y;
sp25C.z = this->view.eye.z + this->envCtx.sunPos.z;
Environment_DrawSunLensFlare(this, &this->envCtx, &this->view, gfxCtx, sp25C);
temp.x = this->view.eye.x + this->envCtx.sunPos.x;
temp.y = this->view.eye.y + this->envCtx.sunPos.y;
temp.z = this->view.eye.z + this->envCtx.sunPos.z;
Environment_DrawSunLensFlare(this, &this->envCtx, &this->view, gfxCtx, temp);
}
Environment_DrawCustomLensFlare(this);
@@ -1430,9 +1425,7 @@ void Play_DrawMain(PlayState* this) {
SkipPostWorldDraw:
if ((this->view.unk164 != 0) && !gDbgCamEnabled) {
Vec3s sp4C;
Camera_Update(&sp4C, GET_ACTIVE_CAM(this));
Camera_Update(GET_ACTIVE_CAM(this));
View_UpdateViewingMatrix(&this->view);
this->view.unk164 = 0;
if ((this->skyboxId != SKYBOX_NONE) && !this->envCtx.skyboxDisabled) {
@@ -1446,10 +1439,6 @@ SkipPostWorldDraw:
CLOSE_DISPS(gfxCtx);
}
#else
void Play_DrawMain(PlayState* this);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_DrawMain.s")
#endif
void Play_Draw(PlayState* this) {
GraphicsContext* gfxCtx = this->state.gfxCtx;
+16 -16
View File
@@ -211,44 +211,44 @@ void EnJso2_Init(Actor* thisx, PlayState* play) {
Collider_InitAndSetQuad(play, &this->unkF40, &this->actor, &D_80A7B634);
Collider_InitAndSetQuad(play, &this->unkFC0, &this->actor, &D_80A7B634);
rightSwordBlureInit.p2EndColor[2] = rightSwordBlureInit.p1EndColor[0] = 0xFF; // 0x360 // t7
rightSwordBlureInit.p2EndColor[2] = rightSwordBlureInit.p1EndColor[0] = 0xFF; // 0x360 // t7
rightSwordBlureInit.p2EndColor[0] = 0xFF; // 0x364 // t9
rightSwordBlureInit.p2EndColor[0] = 0xFF; // 0x364 // t9
leftSwordBlureInit.p2EndColor[2] = leftSwordBlureInit.p1EndColor[0] = 0xFF; // 0x1c0 // t6 -> t7
leftSwordBlureInit.p2EndColor[2] = leftSwordBlureInit.p1EndColor[0] = 0xFF; // 0x1c0 // t6 -> t7
leftSwordBlureInit.p2EndColor[0] = 0xFF; // 0x1c4 // t8
leftSwordBlureInit.p2EndColor[0] = 0xFF; // 0x1c4 // t8
rightSwordBlureInit.p2StartColor[3] = leftSwordBlureInit.p2StartColor[3] = 0x40; // 0x1bf // t9
leftSwordBlureInit.elemDuration = 8; // 0x1c8 // t6
leftSwordBlureInit.elemDuration = 8; // 0x1c8 // t6
rightSwordBlureInit.p1StartColor[0] = 0xFF; // 0x358 // t0
rightSwordBlureInit.p1StartColor[0] = 0xFF; // 0x358 // t0
leftSwordBlureInit.p1StartColor[0] = 0xFF; // 0x1b8
leftSwordBlureInit.p1StartColor[0] = 0xFF; // 0x1b8
rightSwordBlureInit.p1StartColor[2] = rightSwordBlureInit.p1StartColor[1] = 0; // 0x359 // zero
rightSwordBlureInit.p1StartColor[2] = rightSwordBlureInit.p1StartColor[1] = 0; // 0x359 // zero
rightSwordBlureInit.p1StartColor[3] = 0x80; // 0x35b // t3
rightSwordBlureInit.p1StartColor[3] = 0x80; // 0x35b // t3
rightSwordBlureInit.p2StartColor[0] = 0xFF; // 0x35c // t4
rightSwordBlureInit.p2StartColor[0] = 0xFF; // 0x35c // t4
rightSwordBlureInit.p1EndColor[3] = leftSwordBlureInit.p1EndColor[3] = rightSwordBlureInit.p2EndColor[3] =
leftSwordBlureInit.p2EndColor[3] = rightSwordBlureInit.p2EndColor[1] = leftSwordBlureInit.p2EndColor[1] =
rightSwordBlureInit.p1EndColor[2] = leftSwordBlureInit.p1EndColor[2] = rightSwordBlureInit.p1EndColor[1] =
leftSwordBlureInit.p1EndColor[1] = rightSwordBlureInit.p2StartColor[2] =
rightSwordBlureInit.p2StartColor[1] = 0; // 0x35d // zero
rightSwordBlureInit.p2StartColor[1] = 0; // 0x35d // zero
rightSwordBlureInit.elemDuration = 8; // 0x368 // t7
rightSwordBlureInit.elemDuration = 8; // 0x368 // t7
rightSwordBlureInit.unkFlag = leftSwordBlureInit.unkFlag = 0; // 0x1cc // zero
leftSwordBlureInit.calcMode = 2; // 0x1d0
rightSwordBlureInit.calcMode = 2; // 0x370
leftSwordBlureInit.calcMode = 2; // 0x1d0
rightSwordBlureInit.calcMode = 2; // 0x370
leftSwordBlureInit.p2StartColor[0] = 0xFF; // 0x1bc
leftSwordBlureInit.p2StartColor[0] = 0xFF; // 0x1bc
leftSwordBlureInit.p1StartColor[3] = 0x80; // 0x1bb
leftSwordBlureInit.p1StartColor[3] = 0x80; // 0x1bb
leftSwordBlureInit.p2StartColor[2] = leftSwordBlureInit.p2StartColor[1] = leftSwordBlureInit.p1StartColor[2] =
leftSwordBlureInit.p1StartColor[1] = 0; // 0x1b9 // zero
@@ -178,7 +178,6 @@ static DamageTable D_80AF64F4 = {
/* Powder Keg */ DMG_ENTRY(1, 0x0),
};
void EnWdhand_Init(Actor* thisx, PlayState* play) {
EnWdhand* this = THIS;
s32 i;
@@ -488,20 +487,17 @@ void func_80AF520C(EnWdhand* this, PlayState* play) {
s32 var_s2;
Vec3f sp68;
f32 var_fv1;
SkelAnime_Update(&this->unk144);
this->unk1EC[0].z--;
player->av2.actionVar2 = 0;
var_s2 = this->unk1EC[0].z;
for (var_s1 = 0; var_s1 < 4; var_s1++, var_s2+=2) {
for (var_s1 = 0; var_s1 < 4; var_s1++, var_s2 += 2) {
if (this->unk1EC[0].z < 0x4C) {
this->unk1EC[1 + var_s1].x =
(s16)(s32)(this->unk1EC[1 + var_s1].z * Math_SinF(var_s2 * 0.3926991f));
this->unk1EC[1 + var_s1].x = (s16)(s32)(this->unk1EC[1 + var_s1].z * Math_SinF(var_s2 * 0.3926991f));
} else {
Math_ScaledStepToS(&this->unk1EC[1 + var_s1].x,
(s16)(s32)(this->unk1EC[1 + var_s1].z * Math_SinF(var_s2 * 0.3926991f)),
0x400);
(s16)(s32)(this->unk1EC[1 + var_s1].z * Math_SinF(var_s2 * 0.3926991f)), 0x400);
}
if (!(var_s2 & 0xF)) {
if (var_s2 == 0x10) {
@@ -661,7 +657,8 @@ void func_80AF5820(EnWdhand* this, PlayState* play) {
var_s3 = this->unk1EC[0].z;
for (var_s2 = 0; var_s2 < tmp; var_s2++) {
if (this->unk1EC[0].z > 0) {
Math_ScaledStepToS(&this->unk1EC[1 + var_s2].x, this->unk1EC[1 + var_s2].z * (Math_SinF(var_s3 * 0.8975979f)), 0x200);
Math_ScaledStepToS(&this->unk1EC[1 + var_s2].x,
this->unk1EC[1 + var_s2].z * (Math_SinF(var_s3 * 0.8975979f)), 0x200);
} else if (Rand_ZeroOne() < 0.65f) {
this->unk1EC[1 + var_s2].x = this->unk1EC[1 + var_s2].z * Math_SinF(var_s3 * 0.8975979f);
}
@@ -671,7 +668,7 @@ void func_80AF5820(EnWdhand* this, PlayState* play) {
} else {
this->unk1EC[1].y += (s16)Rand_CenteredFloat(12288.0f);
}
this->unk1EC[1 + var_s2].z = Rand_S16Offset((s16) ((var_s2 * 0x100) + 0xC00), 0x800);
this->unk1EC[1 + var_s2].z = Rand_S16Offset((s16)((var_s2 * 0x100) + 0xC00), 0x800);
}
var_s3 += 2;
}
@@ -699,11 +696,11 @@ void func_80AF5820(EnWdhand* this, PlayState* play) {
for (var_s2 = 0; var_s2 < 2; var_s2++) {
D_80AF6514.y = Rand_ZeroOne() + 1.0f;
EffectSsDtBubble_SpawnColorProfile(play, &this->unk25C[var_s2], &D_80AF6514, &D_80AF6520, Rand_S16Offset(40, 40), 25, 2, 1);
EffectSsDtBubble_SpawnColorProfile(play, &this->unk25C[var_s2], &D_80AF6514, &D_80AF6520,
Rand_S16Offset(40, 40), 25, 2, 1);
}
}
void func_80AF5E3C(EnWdhand* this, PlayState* play) {
if (this->unk274.base.acFlags & 2) {