Use PlayState instead of GlobalContext (#1927)

* Use PlayState instead of GlobalContext
- GlobalContext -> PlayState
- globalCtx -> play
- GlobalCtx -> PlayState
- globalContext -> playState

* Find and replace Gameplay_ with Play_

* Correct some misnamed argument cases
This commit is contained in:
Garrett Cox
2022-11-06 02:24:34 -06:00
committed by GitHub
parent 710a768d76
commit 99260acaf1
926 changed files with 41210 additions and 41210 deletions

View File

@@ -285,7 +285,7 @@ Vec3f sGetItemRefPos;
s32 D_80160014;
s32 D_80160018;
void Player_SetBootData(GlobalContext* globalCtx, Player* this) {
void Player_SetBootData(PlayState* play, Player* this) {
s32 currentBoots;
s16* bootRegs;
@@ -324,21 +324,21 @@ void Player_SetBootData(GlobalContext* globalCtx, Player* this) {
IREG(69) = bootRegs[15];
MREG(95) = bootRegs[16];
if (globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_2) {
if (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_2) {
REG(45) = 500;
}
}
s32 Player_InBlockingCsMode(GlobalContext* globalCtx, Player* this) {
return (this->stateFlags1 & 0x20000080) || (this->csMode != 0) || (globalCtx->sceneLoadFlag == 0x14) ||
s32 Player_InBlockingCsMode(PlayState* play, Player* this) {
return (this->stateFlags1 & 0x20000080) || (this->csMode != 0) || (play->sceneLoadFlag == 0x14) ||
(this->stateFlags1 & 1) || (this->stateFlags3 & 0x80) ||
((gSaveContext.unk_13F0 != 0) && (Player_ActionToMagicSpell(this, this->itemActionParam) >= 0));
}
s32 Player_InCsMode(GlobalContext* globalCtx) {
Player* this = GET_PLAYER(globalCtx);
s32 Player_InCsMode(PlayState* play) {
Player* this = GET_PLAYER(play);
return Player_InBlockingCsMode(globalCtx, this) || (this->unk_6AD == 4);
return Player_InBlockingCsMode(play, this) || (this->unk_6AD == 4);
}
s32 func_8008E9C4(Player* this) {
@@ -413,19 +413,19 @@ void func_8008EC70(Player* this) {
this->unk_6AD = 0;
}
void Player_SetEquipmentData(GlobalContext* globalCtx, Player* this) {
void Player_SetEquipmentData(PlayState* play, Player* this) {
if (this->csMode != 0x56) {
this->currentShield = CUR_EQUIP_VALUE(EQUIP_SHIELD);
this->currentTunic = CUR_EQUIP_VALUE(EQUIP_TUNIC) - 1;
this->currentBoots = CUR_EQUIP_VALUE(EQUIP_BOOTS) - 1;
this->currentSwordItem = B_BTN_ITEM;
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemActionParam));
Player_SetBootData(globalCtx, this);
Player_SetBootData(play, this);
}
}
void Player_UpdateBottleHeld(GlobalContext* globalCtx, Player* this, s32 item, s32 actionParam) {
Inventory_UpdateBottleItem(globalCtx, item, this->heldItemButton);
void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 actionParam) {
Inventory_UpdateBottleItem(play, item, this->heldItemButton);
if (item != ITEM_BOTTLE) {
this->heldItemId = item;
@@ -451,30 +451,30 @@ void func_8008EE08(Player* this) {
func_8008EDF0(this);
}
void func_8008EEAC(GlobalContext* globalCtx, Actor* actor) {
Player* this = GET_PLAYER(globalCtx);
void func_8008EEAC(PlayState* play, Actor* actor) {
Player* this = GET_PLAYER(play);
func_8008EE08(this);
this->unk_664 = actor;
this->unk_684 = actor;
this->stateFlags1 |= 0x10000;
Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, actor);
Camera_ChangeMode(Gameplay_GetCamera(globalCtx, 0), 2);
Camera_SetParam(Play_GetCamera(play, 0), 8, actor);
Camera_ChangeMode(Play_GetCamera(play, 0), 2);
}
s32 func_8008EF30(GlobalContext* globalCtx) {
Player* this = GET_PLAYER(globalCtx);
s32 func_8008EF30(PlayState* play) {
Player* this = GET_PLAYER(play);
return (this->stateFlags1 & 0x800000);
}
s32 func_8008EF44(GlobalContext* globalCtx, s32 ammo) {
globalCtx->shootingGalleryStatus = ammo + 1;
s32 func_8008EF44(PlayState* play, s32 ammo) {
play->shootingGalleryStatus = ammo + 1;
return 1;
}
s32 Player_IsBurningStickInRange(GlobalContext* globalCtx, Vec3f* pos, f32 xzRange, f32 yRange) {
Player* this = GET_PLAYER(globalCtx);
s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 yRange) {
Player* this = GET_PLAYER(play);
Vec3f diff;
s32 pad;
@@ -498,28 +498,28 @@ s32 Player_GetStrength(void) {
}
}
u8 Player_GetMask(GlobalContext* globalCtx) {
Player* this = GET_PLAYER(globalCtx);
u8 Player_GetMask(PlayState* play) {
Player* this = GET_PLAYER(play);
return this->currentMask;
}
Player* Player_UnsetMask(GlobalContext* globalCtx) {
Player* this = GET_PLAYER(globalCtx);
Player* Player_UnsetMask(PlayState* play) {
Player* this = GET_PLAYER(play);
this->currentMask = PLAYER_MASK_NONE;
return this;
}
s32 Player_HasMirrorShieldEquipped(GlobalContext* globalCtx) {
Player* this = GET_PLAYER(globalCtx);
s32 Player_HasMirrorShieldEquipped(PlayState* play) {
Player* this = GET_PLAYER(play);
return (this->currentShield == PLAYER_SHIELD_MIRROR);
}
s32 Player_HasMirrorShieldSetToDraw(GlobalContext* globalCtx) {
Player* this = GET_PLAYER(globalCtx);
s32 Player_HasMirrorShieldSetToDraw(PlayState* play) {
Player* this = GET_PLAYER(play);
return (this->rightHandType == 10) && (this->currentShield == PLAYER_SHIELD_MIRROR);
}
@@ -612,12 +612,12 @@ return_neg:
return -1;
}
s32 func_8008F2F8(GlobalContext* globalCtx) {
Player* this = GET_PLAYER(globalCtx);
s32 func_8008F2F8(PlayState* play) {
Player* this = GET_PLAYER(play);
TextTriggerEntry* triggerEntry;
s32 var;
if (globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { // Room is hot
if (play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { // Room is hot
var = 0;
} else if ((this->unk_840 > 80) &&
((this->currentBoots == PLAYER_BOOTS_IRON) || (this->unk_840 >= 300))) { // Deep underwater
@@ -629,14 +629,14 @@ s32 func_8008F2F8(GlobalContext* globalCtx) {
}
// Trigger general textboxes under certain conditions, like "It's so hot in here!"
if (!Player_InCsMode(globalCtx)) {
if (!Player_InCsMode(play)) {
triggerEntry = &sTextTriggers[var];
if ((triggerEntry->flag != 0) && !(gSaveContext.textTriggerFlags & triggerEntry->flag) &&
(((var == 0) && (this->currentTunic != PLAYER_TUNIC_GORON && CVar_GetS32("gSuperTunic", 0) == 0)) ||
(((var == 1) || (var == 3)) && (this->currentBoots == PLAYER_BOOTS_IRON) &&
(this->currentTunic != PLAYER_TUNIC_ZORA && CVar_GetS32("gSuperTunic", 0) == 0)))) {
Message_StartTextbox(globalCtx, triggerEntry->textId, NULL);
Message_StartTextbox(play, triggerEntry->textId, NULL);
gSaveContext.textTriggerFlags |= triggerEntry->flag;
}
}
@@ -712,14 +712,14 @@ Gfx* sBootDListGroups[][2] = {
{ gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL },
};
void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
void func_8008F470(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw,
void* data) {
Color_RGB8* color;
s32 eyeIndex = (jointTable[22].x & 0xF) - 1;
s32 mouthIndex = (jointTable[22].x >> 4) - 1;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
if (eyeIndex < 0) {
eyeIndex = sEyeMouthIndexes[face][0];
@@ -775,7 +775,7 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
sDListsLodOffset = lod * 2;
SkelAnime_DrawFlexLod(globalCtx, skeleton, jointTable, dListCount, overrideLimbDraw, postLimbDraw, data, lod);
SkelAnime_DrawFlexLod(play, skeleton, jointTable, dListCount, overrideLimbDraw, postLimbDraw, data, lod);
if ((overrideLimbDraw != func_800902F0) && (overrideLimbDraw != func_80090440) && (gSaveContext.gameMode != 3)) {
if (LINK_IS_ADULT) {
@@ -815,7 +815,7 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
}
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
Vec3f D_8012602C = { 0.0f, 0.0f, 0.0f };
@@ -832,7 +832,7 @@ f32 D_80126068[] = { 5.0f, 3.0f };
Vec3f D_80126070 = { 0.0f, -300.0f, 0.0f };
void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot,
void func_8008F87C(PlayState* play, Player* this, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot,
s32 thighLimbIndex, s32 shinLimbIndex, s32 footLimbIndex) {
Vec3f spA4;
Vec3f sp98;
@@ -875,7 +875,7 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime,
footprintPos.y += 15.0f;
sp80 = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &sp88, &sp84, &this->actor, &footprintPos) + sp74;
sp80 = BgCheck_EntityRaycastFloor4(&play->colCtx, &sp88, &sp84, &this->actor, &footprintPos) + sp74;
if (sp98.y < sp80) {
sp70 = sp98.x - spA4.x;
@@ -915,17 +915,17 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime,
skelAnime->jointTable[shinLimbIndex].z = skelAnime->jointTable[shinLimbIndex].z + temp1;
skelAnime->jointTable[footLimbIndex].z = skelAnime->jointTable[footLimbIndex].z + temp2 - temp1;
temp3 = func_80041D4C(&globalCtx->colCtx, sp88, sp84);
temp3 = func_80041D4C(&play->colCtx, sp88, sp84);
if ((temp3 >= 2) && (temp3 < 4) && !SurfaceType_IsWallDamage(&globalCtx->colCtx, sp88, sp84)) {
if ((temp3 >= 2) && (temp3 < 4) && !SurfaceType_IsWallDamage(&play->colCtx, sp88, sp84)) {
footprintPos.y = sp80;
EffectSsGFire_Spawn(globalCtx, &footprintPos);
EffectSsGFire_Spawn(play, &footprintPos);
}
}
}
}
s32 func_8008FCC8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
s32 func_8008FCC8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
Player* this = (Player*)thisx;
if (limbIndex == PLAYER_LIMB_ROOT) {
@@ -977,10 +977,10 @@ s32 func_8008FCC8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
Matrix_RotateZ(this->unk_6C0 * (M_PI / 0x8000), MTXMODE_APPLY);
}
} else if (limbIndex == PLAYER_LIMB_L_THIGH) {
func_8008F87C(globalCtx, this, &this->skelAnime, pos, rot, PLAYER_LIMB_L_THIGH, PLAYER_LIMB_L_SHIN,
func_8008F87C(play, this, &this->skelAnime, pos, rot, PLAYER_LIMB_L_THIGH, PLAYER_LIMB_L_SHIN,
PLAYER_LIMB_L_FOOT);
} else if (limbIndex == PLAYER_LIMB_R_THIGH) {
func_8008F87C(globalCtx, this, &this->skelAnime, pos, rot, PLAYER_LIMB_R_THIGH, PLAYER_LIMB_R_SHIN,
func_8008F87C(play, this, &this->skelAnime, pos, rot, PLAYER_LIMB_R_THIGH, PLAYER_LIMB_R_SHIN,
PLAYER_LIMB_R_FOOT);
return false;
} else {
@@ -991,10 +991,10 @@ s32 func_8008FCC8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
return false;
}
s32 func_80090014(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
s32 func_80090014(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
Player* this = (Player*)thisx;
if (!func_8008FCC8(globalCtx, limbIndex, dList, pos, rot, thisx)) {
if (!func_8008FCC8(play, limbIndex, dList, pos, rot, thisx)) {
if (limbIndex == PLAYER_LIMB_L_HAND) {
Gfx** dLists = this->leftHandDLists;
@@ -1054,10 +1054,10 @@ s32 func_80090014(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
return false;
}
s32 func_800902F0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
s32 func_800902F0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
Player* this = (Player*)thisx;
if (!func_8008FCC8(globalCtx, limbIndex, dList, pos, rot, thisx)) {
if (!func_8008FCC8(play, limbIndex, dList, pos, rot, thisx)) {
if (this->unk_6AD != 2) {
*dList = NULL;
} else if (limbIndex == PLAYER_LIMB_L_FOREARM) {
@@ -1079,19 +1079,19 @@ s32 func_800902F0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
return false;
}
s32 func_80090440(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
if (!func_8008FCC8(globalCtx, limbIndex, dList, pos, rot, thisx)) {
s32 func_80090440(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
if (!func_8008FCC8(play, limbIndex, dList, pos, rot, thisx)) {
*dList = NULL;
}
return false;
}
u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip,
u8 func_80090480(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip,
Vec3f* newBase) {
if (weaponInfo->active == 0) {
if (collider != NULL) {
Collider_ResetQuadAT(globalCtx, &collider->base);
Collider_ResetQuadAT(play, &collider->base);
}
Math_Vec3f_Copy(&weaponInfo->tip, newTip);
Math_Vec3f_Copy(&weaponInfo->base, newBase);
@@ -1101,13 +1101,13 @@ u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* w
(weaponInfo->tip.z == newTip->z) && (weaponInfo->base.x == newBase->x) &&
(weaponInfo->base.y == newBase->y) && (weaponInfo->base.z == newBase->z)) {
if (collider != NULL) {
Collider_ResetQuadAT(globalCtx, &collider->base);
Collider_ResetQuadAT(play, &collider->base);
}
return 0;
} else {
if (collider != NULL) {
Collider_SetQuadVertices(collider, newBase, newTip, &weaponInfo->base, &weaponInfo->tip);
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &collider->base);
CollisionCheck_SetAT(play, &play->colChkCtx, &collider->base);
}
Math_Vec3f_Copy(&weaponInfo->base, newBase);
Math_Vec3f_Copy(&weaponInfo->tip, newTip);
@@ -1116,7 +1116,7 @@ u8 func_80090480(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* w
}
}
void func_80090604(GlobalContext* globalCtx, Player* this, ColliderQuad* collider, Vec3f* quadSrc) {
void func_80090604(PlayState* play, Player* this, ColliderQuad* collider, Vec3f* quadSrc) {
static u8 shieldColTypes[PLAYER_SHIELD_MAX] = {
COLTYPE_METAL,
COLTYPE_WOOD,
@@ -1135,8 +1135,8 @@ void func_80090604(GlobalContext* globalCtx, Player* this, ColliderQuad* collide
Matrix_MultVec3f(&quadSrc[3], &quadDest[3]);
Collider_SetQuadVertices(collider, &quadDest[0], &quadDest[1], &quadDest[2], &quadDest[3]);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &collider->base);
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &collider->base);
CollisionCheck_SetAC(play, &play->colChkCtx, &collider->base);
CollisionCheck_SetAT(play, &play->colChkCtx, &collider->base);
}
}
@@ -1150,29 +1150,29 @@ Vec3f D_801260A4[3] = {
{ 0.0f, -400.0f, 1000.0f },
};
void func_800906D4(GlobalContext* globalCtx, Player* this, Vec3f* newTipPos) {
void func_800906D4(PlayState* play, Player* this, Vec3f* newTipPos) {
Vec3f newBasePos[3];
Matrix_MultVec3f(&D_801260A4[0], &newBasePos[0]);
Matrix_MultVec3f(&D_801260A4[1], &newBasePos[1]);
Matrix_MultVec3f(&D_801260A4[2], &newBasePos[2]);
if (func_80090480(globalCtx, NULL, &this->swordInfo[0], &newTipPos[0], &newBasePos[0]) &&
if (func_80090480(play, NULL, &this->swordInfo[0], &newTipPos[0], &newBasePos[0]) &&
!(this->stateFlags1 & 0x400000)) {
EffectBlure_AddVertex(Effect_GetByIndex(this->swordEffectIndex), &this->swordInfo[0].tip,
&this->swordInfo[0].base);
}
if ((this->swordState > 0) && ((this->swordAnimation < 0x18) || (this->stateFlags2 & 0x20000))) {
func_80090480(globalCtx, &this->swordQuads[0], &this->swordInfo[1], &newTipPos[1], &newBasePos[1]);
func_80090480(globalCtx, &this->swordQuads[1], &this->swordInfo[2], &newTipPos[2], &newBasePos[2]);
func_80090480(play, &this->swordQuads[0], &this->swordInfo[1], &newTipPos[1], &newBasePos[1]);
func_80090480(play, &this->swordQuads[1], &this->swordInfo[2], &newTipPos[2], &newBasePos[2]);
}
}
void Player_DrawGetItemImpl(GlobalContext* globalCtx, Player* this, Vec3f* refPos, s32 drawIdPlusOne) {
void Player_DrawGetItemImpl(PlayState* play, Player* this, Vec3f* refPos, s32 drawIdPlusOne) {
f32 height = (this->exchangeItemId != EXCH_ITEM_NONE) ? 6.0f : 14.0f;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
gSegments[6] = VIRTUAL_TO_PHYSICAL(this->giObjectSegment);
@@ -1181,27 +1181,27 @@ void Player_DrawGetItemImpl(GlobalContext* globalCtx, Player* this, Vec3f* refPo
Matrix_Translate(refPos->x + (3.3f * Math_SinS(this->actor.shape.rot.y)), refPos->y + height,
refPos->z + ((3.3f + (IREG(90) / 10.0f)) * Math_CosS(this->actor.shape.rot.y)), MTXMODE_NEW);
Matrix_RotateZYX(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY);
Matrix_RotateZYX(0, play->gameplayFrames * 1000, 0, MTXMODE_APPLY);
Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY);
if (!(this->getItemEntry.modIndex == MOD_RANDOMIZER && this->getItemEntry.getItemId == RG_ICE_TRAP)) {
// RANDOTODO: Make this more flexible for easier toggling of individual item recolors in the future.
if (this->getItemEntry.drawFunc != NULL &&
(CVar_GetS32("gRandoMatchKeyColors", 0) || this->getItemEntry.getItemId == RG_DOUBLE_DEFENSE)) {
this->getItemEntry.drawFunc(globalCtx, &this->getItemEntry);
this->getItemEntry.drawFunc(play, &this->getItemEntry);
} else {
GetItem_Draw(globalCtx, drawIdPlusOne - 1);
GetItem_Draw(play, drawIdPlusOne - 1);
}
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void Player_DrawGetItem(GlobalContext* globalCtx, Player* this) {
void Player_DrawGetItem(PlayState* play, Player* this) {
//if (!this->giObjectLoading || !osRecvMesg(&this->giObjectLoadQueue, NULL, OS_MESG_NOBLOCK)) // OTRTODO: Do something about osRecvMesg here...
{
this->giObjectLoading = false;
Player_DrawGetItemImpl(globalCtx, this, &sGetItemRefPos, ABS(this->unk_862));
Player_DrawGetItemImpl(play, this, &sGetItemRefPos, ABS(this->unk_862));
}
}
@@ -1221,7 +1221,7 @@ void func_80090A28(Player* this, Vec3f* vecs) {
Matrix_MultVec3f(&D_80126098, &vecs[2]);
}
void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2) {
void Player_DrawHookshotReticle(PlayState* play, Player* this, f32 arg2) {
static Vec3f D_801260C8 = { -500.0f, -100.0f, 0.0f };
CollisionPoly* sp9C;
s32 bgId;
@@ -1237,24 +1237,24 @@ void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2
D_801260C8.z = arg2;
Matrix_MultVec3f(&D_801260C8, &sp80);
if (BgCheck_AnyLineTest3(&globalCtx->colCtx, &sp8C, &sp80, &sp74, &sp9C, 1, 1, 1, 1, &bgId)) {
OPEN_DISPS(globalCtx->state.gfxCtx);
if (BgCheck_AnyLineTest3(&play->colCtx, &sp8C, &sp80, &sp74, &sp9C, 1, 1, 1, 1, &bgId)) {
OPEN_DISPS(play->state.gfxCtx);
WORLD_OVERLAY_DISP = Gfx_CallSetupDL(WORLD_OVERLAY_DISP, 0x07);
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sp74, &sp68, &sp64);
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sp74, &sp68, &sp64);
sp60 = (sp64 < 200.0f) ? 0.08f : (sp64 / 200.0f) * 0.08f;
Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW);
Matrix_Scale(sp60, sp60, sp60, MTXMODE_APPLY);
gSPMatrix(WORLD_OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(WORLD_OVERLAY_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(WORLD_OVERLAY_DISP++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment);
gSPSegment(WORLD_OVERLAY_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment);
gSPDisplayList(WORLD_OVERLAY_DISP++, gLinkAdultHookshotReticleDL);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
}
@@ -1308,7 +1308,7 @@ Vec3f D_801261E0[] = {
{ 200.0f, 200.0f, 0.0f },
};
void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
void func_80090D20(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
Player* this = (Player*)thisx;
if (*dList != NULL) {
@@ -1324,14 +1324,14 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
if (this->itemActionParam == PLAYER_AP_STICK) {
Vec3f sp124[3];
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
if (this->actor.scale.y >= 0.0f) {
D_80126080.x = this->unk_85C * 5000.0f;
func_80090A28(this, sp124);
if (this->swordState != 0) {
EffectBlure_ChangeType(Effect_GetByIndex(this->swordEffectIndex), 7); // default sword type
func_800906D4(globalCtx, this, sp124);
func_800906D4(play, this, sp124);
} else {
Math_Vec3f_Copy(&this->swordInfo[0].tip, &sp124[0]);
}
@@ -1341,11 +1341,11 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
Matrix_RotateZYX(-0x8000, 0, 0x4000, MTXMODE_APPLY);
Matrix_Scale(1.0f, this->unk_85C, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gLinkChildLinkDekuStickDL);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
} else if ((this->actor.scale.y >= 0.0f) && (this->swordState != 0)) {
Vec3f spE4[3];
@@ -1360,18 +1360,18 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
}
func_80090A28(this, spE4);
func_800906D4(globalCtx, this, spE4);
func_800906D4(play, this, spE4);
} else if ((*dList != NULL) && (this->leftHandType == 7)) {
Color_RGB8* bottleColor = &sBottleColors[Player_ActionToBottle(this, this->itemActionParam)];
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetEnvColor(POLY_XLU_DISP++, bottleColor->r, bottleColor->g, bottleColor->b, 0);
gSPDisplayList(POLY_XLU_DISP++, sBottleDLists[(gSaveContext.linkAge)]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
if (this->actor.scale.y >= 0.0f) {
@@ -1407,7 +1407,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
} else if ((this->rightHandType == 11) || (this->rightHandType == 12)) {
BowStringData* stringData = &sBowStringData[gSaveContext.linkAge];
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
Matrix_Push();
Matrix_Translate(stringData->pos.x, stringData->pos.y, stringData->pos.z, MTXMODE_APPLY);
@@ -1438,16 +1438,16 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
Matrix_RotateZ(this->unk_858 * -0.2f, MTXMODE_APPLY);
}
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, stringData->dList);
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
} else if ((this->actor.scale.y >= 0.0f) && (this->rightHandType == 10)) {
Matrix_Get(&this->shieldMf);
func_80090604(globalCtx, this, &this->shieldQuad, D_80126154);
func_80090604(play, this, &this->shieldQuad, D_80126154);
}
if (this->actor.scale.y >= 0.0f) {
@@ -1468,7 +1468,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
if (func_8002DD78(this) != 0) {
Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY);
Player_DrawHookshotReticle(
globalCtx, this, (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 38600.0f : 77600.0f);
play, this, (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 38600.0f : 77600.0f);
}
}
}
@@ -1491,7 +1491,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
if (limbIndex == PLAYER_LIMB_SHEATH) {
if ((this->rightHandType != 10) && (this->rightHandType != 0xFF)) {
if (Player_IsChildWithHylianShield(this)) {
func_80090604(globalCtx, this, &this->shieldQuad, D_8012619C);
func_80090604(play, this, &this->shieldQuad, D_8012619C);
}
Matrix_TranslateRotateZYX(&D_801261CC, &D_801261D8);
@@ -1507,7 +1507,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
}
}
u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) {
u32 func_80091738(PlayState* play, u8* segment, SkelAnime* skelAnime) {
s16 linkObjectId = gLinkObjectIds[gSaveContext.linkAge];
size_t size;
void* ptr;
@@ -1525,7 +1525,7 @@ u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) {
gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + 0x3800);
gSegments[6] = VIRTUAL_TO_PHYSICAL(segment + 0x8800);
SkelAnime_InitLink(globalCtx, skelAnime, gPlayerSkelHeaders[gSaveContext.linkAge], &gPlayerAnim_link_normal_wait, 9,
SkelAnime_InitLink(play, skelAnime, gPlayerSkelHeaders[gSaveContext.linkAge], &gPlayerAnim_link_normal_wait, 9,
ptr, ptr, PLAYER_LIMB_MAX);
return size + 0x8800 + 0x90;
@@ -1533,7 +1533,7 @@ u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) {
u8 D_801261F8[] = { 2, 2, 5 };
s32 func_80091880(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* arg) {
s32 func_80091880(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* arg) {
u8* ptr = arg;
u8 modelGroup = D_801261F8[ptr[0] > 0 ? ptr[0] - 1 : 0];
s32 type;
@@ -1583,7 +1583,7 @@ s32 func_80091880(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
#include <overlays/actors/ovl_Demo_Effect/z_demo_effect.h>
void Pause_DrawTriforceSpot(GlobalContext* globalCtx, s32 showLightColumn) {
void Pause_DrawTriforceSpot(PlayState* play, s32 showLightColumn) {
static DemoEffect triforce;
static s16 rotation = 0;
@@ -1592,12 +1592,12 @@ void Pause_DrawTriforceSpot(GlobalContext* globalCtx, s32 showLightColumn) {
triforce.triforceSpot.lightColumnOpacity = showLightColumn ? 244 : 0;
triforce.triforceSpot.rotation = rotation;
DemoEffect_DrawTriforceSpot(&triforce, globalCtx);
DemoEffect_DrawTriforceSpot(&triforce, play);
rotation += 0x03E8;
}
void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot,
void func_80091A24(PlayState* play, void* seg04, void* seg06, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot,
f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots, s32 width, s32 height, Vec3f* eye, Vec3f* at,
f32 fovy, void* img1, void* img2) {
static Vp viewport = { 128, 224, 511, 0, 128, 224, 511, 0 };
@@ -1608,10 +1608,10 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime
Gfx* xluRef;
Gfx* kalRef;
u16 perspNorm;
Mtx* perspMtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx));
Mtx* lookAtMtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx));
Mtx* perspMtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx));
Mtx* lookAtMtx = Graph_Alloc(play->state.gfxCtx, sizeof(Mtx));
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
@@ -1653,15 +1653,15 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime
gSPSetLights1(POLY_OPA_DISP++, lights1);
func_80093C80(globalCtx);
func_80093C80(play);
POLY_OPA_DISP = Gfx_SetFog2(POLY_OPA_DISP++, 0, 0, 0, 0, 997, 1000);
func_8002EABC(pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx);
func_8002EABC(pos, &play->view.eye, &lightDir, play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList);
func_8008F470(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0,
func_8008F470(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0,
func_80091880, NULL, &sp12C);
if (CVar_GetS32("gPauseTriforce", 0)) {
@@ -1673,15 +1673,15 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime
Gfx* ohNo = POLY_XLU_DISP;
POLY_XLU_DISP = POLY_OPA_DISP;
Pause_DrawTriforceSpot(globalCtx, 1);
Pause_DrawTriforceSpot(play, 1);
POLY_OPA_DISP = POLY_XLU_DISP;
POLY_XLU_DISP = ohNo;
}
POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP++);
POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP++);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
uintptr_t SelectedAnim = 0; // Current Animaiton on the menu
@@ -1689,9 +1689,9 @@ s16 EquipedStance; // Link's current mode (Two handed, One handed...)
s16 FrameCountSinceLastAnim = 0; // Time since last animation
s16 MinFrameCount; // Frame to wait before checking if we need to change the animation
void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale,
void func_8009214C(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale,
s32 sword, s32 tunic, s32 shield, s32 boots) {
Input* p1Input = &globalCtx->state.input[0];
Input* p1Input = &play->state.input[0];
Vec3f eye = { 0.0f, 0.0f, -400.0f };
Vec3f at = { 0.0f, 0.0f, 0.0f };
Vec3s* destTable;
@@ -1888,11 +1888,11 @@ void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime,
}
if (skelAnime->animation != anim) {
LinkAnimation_Change(globalCtx, skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_LOOP,
LinkAnimation_Change(play, skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_LOOP,
-6.0f);
}
LinkAnimation_Update(globalCtx, skelAnime);
LinkAnimation_Update(play, skelAnime);
if (!LINK_IS_ADULT) {
// Link is placed too far up by default when animating
@@ -1924,7 +1924,7 @@ void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime,
}
func_80091A24(globalCtx, segment + 0x3800, segment + 0x8800, skelAnime, pos, rot, scale, sword, tunic, shield,
boots, 64, 112, &eye, &at, 60.0f, globalCtx->state.gfxCtx->curFrameBuffer,
globalCtx->state.gfxCtx->curFrameBuffer + 0x1C00);
func_80091A24(play, segment + 0x3800, segment + 0x8800, skelAnime, pos, rot, scale, sword, tunic, shield,
boots, 64, 112, &eye, &at, 60.0f, play->state.gfxCtx->curFrameBuffer,
play->state.gfxCtx->curFrameBuffer + 0x1C00);
}