PlayState rename (#835)

* PlayState rename

* Make this work with the latest master and run format

* Respond to hensldm's review

* Respond to Elliptic's review

* Add Effect_GetPlayState to namefixer.py

* Add missed comma
This commit is contained in:
Tom Overton
2022-06-26 08:57:37 -07:00
committed by GitHub
parent f77c4770f7
commit 158d1b26b0
1175 changed files with 36240 additions and 36688 deletions
+12 -13
View File
@@ -1,7 +1,7 @@
#include "global.h"
void Actor_ContinueText(GlobalContext* globalCtx, Actor* actor, u16 textId) {
func_80151938(globalCtx, textId);
void Actor_ContinueText(PlayState* play, Actor* actor, u16 textId) {
func_80151938(play, textId);
actor->textId = textId;
}
@@ -77,16 +77,15 @@ s32 Actor_TrackPoint(Actor* actor, Vec3f* target, Vec3s* headRot, Vec3s* torsoRo
*
* @note same note as Actor_TrackPlayer
*/
s32 Actor_TrackPlayerSetFocusHeight(GlobalContext* globalCtx, Actor* actor, Vec3s* headRot, Vec3s* torsoRot,
f32 focusHeight) {
Player* player = GET_PLAYER(globalCtx);
s32 Actor_TrackPlayerSetFocusHeight(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, f32 focusHeight) {
Player* player = GET_PLAYER(play);
s16 yaw;
Vec3f target;
actor->focus.pos = actor->world.pos;
actor->focus.pos.y += focusHeight;
if (!((globalCtx->csCtx.state != 0) || gDbgCamEnabled)) {
if (!((play->csCtx.state != 0) || gDbgCamEnabled)) {
yaw = ABS_ALT(BINANG_SUB(actor->yawTowardsPlayer, actor->shape.rot.y));
if (yaw >= 0x4300) {
Actor_TrackNone(headRot, torsoRot);
@@ -94,8 +93,8 @@ s32 Actor_TrackPlayerSetFocusHeight(GlobalContext* globalCtx, Actor* actor, Vec3
}
}
if ((globalCtx->csCtx.state != 0) || gDbgCamEnabled) {
target = globalCtx->view.eye;
if ((play->csCtx.state != 0) || gDbgCamEnabled) {
target = play->view.eye;
} else {
target = player->actor.focus.pos;
}
@@ -121,14 +120,14 @@ s32 Actor_TrackPlayerSetFocusHeight(GlobalContext* globalCtx, Actor* actor, Vec3
* @note if in a cutscene or debug camera is enabled, the computed rotation will instead turn towards the view eye no
* matter the yaw.
*/
s32 Actor_TrackPlayer(GlobalContext* globalCtx, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, Vec3f focusPos) {
Player* player = GET_PLAYER(globalCtx);
s32 Actor_TrackPlayer(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, Vec3f focusPos) {
Player* player = GET_PLAYER(play);
s16 yaw;
Vec3f target;
actor->focus.pos = focusPos;
if (!((globalCtx->csCtx.state != 0) || gDbgCamEnabled)) {
if (!((play->csCtx.state != 0) || gDbgCamEnabled)) {
yaw = ABS_ALT(BINANG_SUB(actor->yawTowardsPlayer, actor->shape.rot.y));
if (yaw >= 0x4300) {
Actor_TrackNone(headRot, torsoRot);
@@ -136,8 +135,8 @@ s32 Actor_TrackPlayer(GlobalContext* globalCtx, Actor* actor, Vec3s* headRot, Ve
}
}
if ((globalCtx->csCtx.state != 0) || gDbgCamEnabled) {
target = globalCtx->view.eye;
if ((play->csCtx.state != 0) || gDbgCamEnabled) {
target = play->view.eye;
} else {
target = player->actor.focus.pos;
}
+11 -11
View File
@@ -474,15 +474,15 @@ u16 gScenesPerRegion[11][27] = {
},
};
s32 Inventory_GetBtnBItem(GlobalContext* globalCtx) {
s32 Inventory_GetBtnBItem(PlayState* play) {
if (gSaveContext.buttonStatus[0] == BTN_DISABLED) {
return ITEM_NONE;
} else if (gSaveContext.unk_1015 == ITEM_NONE) {
return ITEM_NONE;
} else if (CUR_FORM_EQUIP(EQUIP_SLOT_B) == ITEM_NONE) {
if (globalCtx->interfaceCtx.unk_21C != 0) {
if (globalCtx->interfaceCtx.unk_21E != 0) {
return globalCtx->interfaceCtx.unk_21E;
if (play->interfaceCtx.unk_21C != 0) {
if (play->interfaceCtx.unk_21E != 0) {
return play->interfaceCtx.unk_21E;
}
}
return ITEM_NONE;
@@ -501,12 +501,12 @@ void Inventory_ChangeEquipment(s16 value) {
/**
* Only deletes shield, equipment argument unused and is a remnant of OoT
*/
u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) {
Player* player = GET_PLAYER(globalCtx);
u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment) {
Player* player = GET_PLAYER(play);
if (GET_CUR_EQUIP_VALUE(EQUIP_SHIELD) != 0) {
SET_EQUIP_VALUE(EQUIP_SHIELD, 0);
Player_SetEquipmentData(globalCtx, player);
Player_SetEquipmentData(play, player);
return true;
}
@@ -719,12 +719,12 @@ s16 Inventory_GetSkullTokenCount(s16 sceneIndex) {
}
}
void Inventory_SaveLotteryCodeGuess(GlobalContext* globalCtx) {
void Inventory_SaveLotteryCodeGuess(PlayState* play) {
u16 lotteryCodeGuess;
lotteryCodeGuess = ((globalCtx->msgCtx.unk12054[0] & 0xF) << 8); // First Digit
lotteryCodeGuess |= ((globalCtx->msgCtx.unk12054[1] & 0xF) << 4); // Second Digit
lotteryCodeGuess |= (globalCtx->msgCtx.unk12054[2] & 0xF); // Third Digit
lotteryCodeGuess = ((play->msgCtx.unk12054[0] & 0xF) << 8); // First Digit
lotteryCodeGuess |= ((play->msgCtx.unk12054[1] & 0xF) << 4); // Second Digit
lotteryCodeGuess |= (play->msgCtx.unk12054[2] & 0xF); // Third Digit
gSaveContext.save.lotteryCodeGuess =
(gSaveContext.save.lotteryCodeGuess & 0xFFFF0000) | (lotteryCodeGuess & 0xFFFF);
}
+3 -3
View File
@@ -134,8 +134,8 @@ static u32 sCurrentBit = 0;
static s32 sTimer = 0;
void FlagSet_Update(GameState* gameState) {
GlobalContext* globalCtx = (GlobalContext*)gameState;
Input* input = CONTROLLER1(&globalCtx->state);
PlayState* play = (PlayState*)gameState;
Input* input = CONTROLLER1(&play->state);
/* Intra-byte navigation */
@@ -255,7 +255,7 @@ void FlagSet_Update(GameState* gameState) {
// Pressing B will exit
} else if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
globalCtx->pauseCtx.debugState = 0;
play->pauseCtx.debugState = 0;
}
}
+530 -537
View File
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -15,11 +15,11 @@ void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 flags) {
dynaActor->stateFlags = DYNAPOLY_STATE_NONE;
}
void DynaPolyActor_LoadMesh(GlobalContext* globalCtx, DynaPolyActor* dynaActor, CollisionHeader* meshHeader) {
void DynaPolyActor_LoadMesh(PlayState* play, DynaPolyActor* dynaActor, CollisionHeader* meshHeader) {
CollisionHeader* header = NULL;
CollisionHeader_GetVirtual(meshHeader, &header);
dynaActor->bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &dynaActor->actor, header);
dynaActor->bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &dynaActor->actor, header);
}
void DynaPolyActor_ResetState(DynaPolyActor* dynaActor) {
@@ -102,7 +102,7 @@ s32 DynaPolyActor_IsInHeavySwitchPressedState(DynaPolyActor* dynaActor) {
}
}
s32 DynaPolyActor_ValidateMove(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 startRadius, s16 endRadius,
s32 DynaPolyActor_ValidateMove(PlayState* play, DynaPolyActor* dynaActor, s16 startRadius, s16 endRadius,
s16 startHeight) {
Vec3f startPos;
Vec3f endPos;
@@ -125,16 +125,16 @@ s32 DynaPolyActor_ValidateMove(GlobalContext* globalCtx, DynaPolyActor* dynaActo
endPos.y = startPos.y;
endPos.z = sign * adjustedEndRadius * cos + startPos.z;
if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &startPos, &endPos, &intersectionPos, &poly, true, false, false,
true, &bgId, &dynaActor->actor, 0.0f)) {
if (BgCheck_EntityLineTest3(&play->colCtx, &startPos, &endPos, &intersectionPos, &poly, true, false, false, true,
&bgId, &dynaActor->actor, 0.0f)) {
return false;
}
startPos.x = (dynaActor->actor.world.pos.x * 2.0f) - startPos.x;
startPos.z = (dynaActor->actor.world.pos.z * 2.0f) - startPos.z;
endPos.x = sign * adjustedEndRadius * sin + startPos.x;
endPos.z = sign * adjustedEndRadius * cos + startPos.z;
if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &startPos, &endPos, &intersectionPos, &poly, true, false, false,
true, &bgId, &dynaActor->actor, 0.0f)) {
if (BgCheck_EntityLineTest3(&play->colCtx, &startPos, &endPos, &intersectionPos, &poly, true, false, false, true,
&bgId, &dynaActor->actor, 0.0f)) {
return false;
}
return true;
+89 -93
View File
@@ -124,13 +124,13 @@ void DynaSSNodeList_SetSSListHead(DynaSSNodeList* list, SSList* ssList, s16* pol
ssList->head = index;
}
void DynaSSNodeList_Init(GlobalContext* globalCtx, DynaSSNodeList* list) {
void DynaSSNodeList_Init(PlayState* play, DynaSSNodeList* list) {
list->tbl = NULL;
list->count = 0;
}
void DynaSSNodeList_Alloc(GlobalContext* globalCtx, DynaSSNodeList* list, u32 numNodes) {
list->tbl = (SSNode*)THA_AllocEndAlign(&globalCtx->state.heap, numNodes * sizeof(SSNode), -2);
void DynaSSNodeList_Alloc(PlayState* play, DynaSSNodeList* list, u32 numNodes) {
list->tbl = (SSNode*)THA_AllocEndAlign(&play->state.heap, numNodes * sizeof(SSNode), -2);
list->maxNodes = numNodes;
list->count = 0;
}
@@ -1376,7 +1376,7 @@ s32 BgCheck_PolyIntersectsSubdivision(Vec3f* min, Vec3f* max, CollisionPoly* pol
* Initialize StaticLookup Table
* returns size of table, in bytes
*/
u32 BgCheck_InitStaticLookup(CollisionContext* colCtx, GlobalContext* globalCtx, StaticLookup* lookupTbl) {
u32 BgCheck_InitStaticLookup(CollisionContext* colCtx, PlayState* play, StaticLookup* lookupTbl) {
Vec3s* vtxList;
CollisionPoly* polyList;
s32 polyMax;
@@ -1460,11 +1460,11 @@ u32 BgCheck_InitStaticLookup(CollisionContext* colCtx, GlobalContext* globalCtx,
/**
* Returns whether the current scene should reserve less memory for it's collision lookup
*/
s32 BgCheck_IsSmallMemScene(GlobalContext* globalCtx) {
s32 BgCheck_IsSmallMemScene(PlayState* play) {
s16* i;
for (i = sSmallMemScenes; i < sSmallMemScenes + ARRAY_COUNT(sSmallMemScenes); i++) {
if (globalCtx->sceneNum == *i) {
if (play->sceneNum == *i) {
return true;
}
}
@@ -1499,11 +1499,11 @@ void BgCheck_SetSubdivisionDimension(f32 min, s32 subdivAmount, f32* max, f32* s
*max = *subdivLength * subdivAmount + min;
}
s32 BgCheck_GetSpecialSceneMaxObjects(GlobalContext* globalCtx, s32* maxNodes, s32* maxPolygons, s32* maxVertices) {
s32 BgCheck_GetSpecialSceneMaxObjects(PlayState* play, s32* maxNodes, s32* maxPolygons, s32* maxVertices) {
s32 i;
for (i = 0; i < ARRAY_COUNT(sCustomDynapolyMem); i++) {
if (globalCtx->sceneNum == sCustomDynapolyMem[i].sceneId) {
if (play->sceneNum == sCustomDynapolyMem[i].sceneId) {
*maxNodes = sCustomDynapolyMem[i].maxNodes;
*maxPolygons = sCustomDynapolyMem[i].maxPolygons;
*maxVertices = sCustomDynapolyMem[i].maxVertices;
@@ -1516,7 +1516,7 @@ s32 BgCheck_GetSpecialSceneMaxObjects(GlobalContext* globalCtx, s32* maxNodes, s
/**
* Allocate CollisionContext
*/
void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, CollisionHeader* colHeader) {
void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader* colHeader) {
u32 tblMax;
u32 memSize;
u32 lookupTblMemSize;
@@ -1527,7 +1527,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
colCtx->colHeader = colHeader;
colCtx->flags = 0;
if (BgCheck_IsSmallMemScene(globalCtx)) {
if (BgCheck_IsSmallMemScene(play)) {
colCtx->memSize = 0xF000;
colCtx->dyna.polyNodesMax = 1000;
colCtx->dyna.polyListMax = 512;
@@ -1540,7 +1540,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
s32 useCustomSubdivisions;
s32 i;
if (BgCheck_TryGetCustomMemsize(globalCtx->sceneNum, &customMemSize)) {
if (BgCheck_TryGetCustomMemsize(play->sceneNum, &customMemSize)) {
colCtx->memSize = customMemSize;
} else {
colCtx->memSize = 0x23000;
@@ -1548,12 +1548,12 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
colCtx->dyna.polyNodesMax = 1000;
colCtx->dyna.polyListMax = 544;
colCtx->dyna.vtxListMax = 512;
BgCheck_GetSpecialSceneMaxObjects(globalCtx, &colCtx->dyna.polyNodesMax, &colCtx->dyna.polyListMax,
BgCheck_GetSpecialSceneMaxObjects(play, &colCtx->dyna.polyNodesMax, &colCtx->dyna.polyListMax,
&colCtx->dyna.vtxListMax);
useCustomSubdivisions = false;
for (i = 0; i < ARRAY_COUNT(sSceneSubdivisionList); i++) {
if (globalCtx->sceneNum == sSceneSubdivisionList[i].sceneId) {
if (play->sceneNum == sSceneSubdivisionList[i].sceneId) {
colCtx->subdivAmount.x = sSceneSubdivisionList[i].subdivAmount.x;
colCtx->subdivAmount.y = sSceneSubdivisionList[i].subdivAmount.y;
colCtx->subdivAmount.z = sSceneSubdivisionList[i].subdivAmount.z;
@@ -1568,7 +1568,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
}
}
colCtx->lookupTbl = THA_AllocEndAlign(
&globalCtx->state.heap,
&play->state.heap,
colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z, ~1);
if (colCtx->lookupTbl == NULL) {
Fault_AddHungupAndCrash("../z_bgcheck.c", 3955);
@@ -1601,12 +1601,12 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
}
SSNodeList_Init(&colCtx->polyNodes);
SSNodeList_Alloc(globalCtx, &colCtx->polyNodes, tblMax, colCtx->colHeader->numPolygons);
SSNodeList_Alloc(play, &colCtx->polyNodes, tblMax, colCtx->colHeader->numPolygons);
lookupTblMemSize = BgCheck_InitStaticLookup(colCtx, globalCtx, colCtx->lookupTbl);
lookupTblMemSize = BgCheck_InitStaticLookup(colCtx, play, colCtx->lookupTbl);
DynaPoly_Init(globalCtx, &colCtx->dyna);
DynaPoly_Alloc(globalCtx, &colCtx->dyna);
DynaPoly_Init(play, &colCtx->dyna);
DynaPoly_Alloc(play, &colCtx->dyna);
}
/**
@@ -1661,7 +1661,7 @@ s32 BgCheck_PosInStaticBoundingBox(CollisionContext* colCtx, Vec3f* pos) {
* returns the yIntersect of the nearest poly found directly below `pos`, or BGCHECK_Y_MIN if no floor detected
* returns the poly found in `outPoly`, and the bgId of the entity in `outBgId`
*/
f32 BgCheck_RaycastFloorImpl(GlobalContext* globalCtx, CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly,
f32 BgCheck_RaycastFloorImpl(PlayState* play, CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly,
s32* outBgId, Vec3f* pos, Actor* actor, u32 arg7, f32 checkDist, s32 arg9) {
f32 yIntersectDyna;
f32 yIntersect;
@@ -1693,7 +1693,7 @@ f32 BgCheck_RaycastFloorImpl(GlobalContext* globalCtx, CollisionContext* colCtx,
checkPos.y -= colCtx->subdivLength.y;
}
if (!(arg9 & 1)) {
dynaRaycast.globalCtx = globalCtx;
dynaRaycast.play = play;
dynaRaycast.colCtx = colCtx;
dynaRaycast.xpFlags = xpFlags;
dynaRaycast.resultPoly = outPoly;
@@ -1741,22 +1741,20 @@ f32 BgCheck_EntityRaycastFloor1(CollisionContext* colCtx, CollisionPoly** outPol
* Public raycast toward floor
* returns yIntersect of the poly found, or BGCHECK_Y_MIN if no poly detected
*/
f32 BgCheck_EntityRaycastFloor2(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly,
Vec3f* pos) {
f32 BgCheck_EntityRaycastFloor2(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos) {
s32 bgId;
return BgCheck_RaycastFloorImpl(globalCtx, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, &bgId, pos, NULL, 0x1C, 1.0f, 0);
return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, &bgId, pos, NULL, 0x1C, 1.0f, 0);
}
/**
* Public raycast toward floor
* returns yIntersect of the poly found, or BGCHECK_Y_MIN if no poly detected
*/
f32 BgCheck_EntityRaycastFloor2_1(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly,
Vec3f* pos) {
f32 BgCheck_EntityRaycastFloor2_1(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos) {
s32 bgId;
return BgCheck_RaycastFloorImpl(globalCtx, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, &bgId, pos, NULL, 0x1C, 1.0f, 1);
return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, &bgId, pos, NULL, 0x1C, 1.0f, 1);
}
/**
@@ -1780,18 +1778,18 @@ f32 BgCheck_EntityRaycastFloor5(CollisionContext* colCtx, CollisionPoly** outPol
* Public raycast toward floor
* returns yIntersect of the poly found, or BGCHECK_Y_MIN if no poly detected
*/
f32 BgCheck_EntityRaycastFloor5_2(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly,
s32* bgId, Actor* actor, Vec3f* pos) {
return BgCheck_RaycastFloorImpl(globalCtx, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, bgId, pos, actor, 0x1C, 1.0f, 0);
f32 BgCheck_EntityRaycastFloor5_2(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId,
Actor* actor, Vec3f* pos) {
return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, bgId, pos, actor, 0x1C, 1.0f, 0);
}
/**
* Public raycast toward floor
* returns yIntersect of the poly found, or BGCHECK_Y_MIN if no poly detected
*/
f32 BgCheck_EntityRaycastFloor5_3(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly,
s32* bgId, Actor* actor, Vec3f* pos) {
return BgCheck_RaycastFloorImpl(globalCtx, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, bgId, pos, actor, 0x3C, 1.0f, 0);
f32 BgCheck_EntityRaycastFloor5_3(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId,
Actor* actor, Vec3f* pos) {
return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, bgId, pos, actor, 0x3C, 1.0f, 0);
}
/**
@@ -2453,11 +2451,11 @@ void SSNodeList_Init(SSNodeList* this) {
* tblMax is the number of SSNode records to allocate
* numPolys is the number of polygons defined within the CollisionHeader
*/
void SSNodeList_Alloc(GlobalContext* globalCtx, SSNodeList* this, s32 tblMax, s32 numPolys) {
void SSNodeList_Alloc(PlayState* play, SSNodeList* this, s32 tblMax, s32 numPolys) {
this->max = tblMax;
this->count = 0;
this->tbl = THA_AllocEndAlign(&globalCtx->state.heap, tblMax * sizeof(SSNode), -2);
this->polyCheckTbl = THA_AllocEndAlign16(&globalCtx->state.heap, numPolys * sizeof(u8));
this->tbl = THA_AllocEndAlign(&play->state.heap, tblMax * sizeof(SSNode), -2);
this->polyCheckTbl = THA_AllocEndAlign16(&play->state.heap, numPolys * sizeof(u8));
if (this->polyCheckTbl == NULL) {
sprintf(D_801ED950, "this->polygon_check == NULL(game_alloc() MemoryAllocationError.)\n");
@@ -2554,7 +2552,7 @@ void DynaLookup_ResetWaterBoxStartIndex(u16* waterBoxStartIndex) {
/**
* Initialize BgActor
*/
void BgActor_Init(GlobalContext* globalCtx, BgActor* bgActor) {
void BgActor_Init(PlayState* play, BgActor* bgActor) {
bgActor->actor = NULL;
bgActor->colHeader = NULL;
ScaleRotPos_Init(&bgActor->prevTransform);
@@ -2598,8 +2596,8 @@ void DynaPoly_NullPolyList(CollisionPoly** polyList) {
/**
* Allocate dyna.polyList
*/
void DynaPoly_AllocPolyList(GlobalContext* globalCtx, CollisionPoly** polyList, s32 numPolys) {
*polyList = THA_AllocEndAlign(&globalCtx->state.heap, numPolys * sizeof(CollisionPoly), -2);
void DynaPoly_AllocPolyList(PlayState* play, CollisionPoly** polyList, s32 numPolys) {
*polyList = THA_AllocEndAlign(&play->state.heap, numPolys * sizeof(CollisionPoly), -2);
}
/**
@@ -2612,8 +2610,8 @@ void DynaPoly_NullVtxList(Vec3s** vtxList) {
/**
* Allocate dyna.vtxList
*/
void DynaPoly_AllocVtxList(GlobalContext* globalCtx, Vec3s** vtxList, s32 numVtx) {
*vtxList = THA_AllocEndAlign(&globalCtx->state.heap, numVtx * sizeof(Vec3s), -2);
void DynaPoly_AllocVtxList(PlayState* play, Vec3s** vtxList, s32 numVtx) {
*vtxList = THA_AllocEndAlign(&play->state.heap, numVtx * sizeof(Vec3s), -2);
}
/**
@@ -2627,14 +2625,14 @@ void DynaPoly_InitWaterBoxList(DynaWaterBoxList* waterBoxList) {
/**
* Allocate dyna.waterBoxList
*/
void DynaPoly_AllocWaterBoxList(GlobalContext* globalCtx, DynaWaterBoxList* waterBoxList, s32 numWaterBoxes) {
waterBoxList->boxes = THA_AllocEndAlign(&globalCtx->state.heap, numWaterBoxes * sizeof(WaterBox), -2);
void DynaPoly_AllocWaterBoxList(PlayState* play, DynaWaterBoxList* waterBoxList, s32 numWaterBoxes) {
waterBoxList->boxes = THA_AllocEndAlign(&play->state.heap, numWaterBoxes * sizeof(WaterBox), -2);
}
/**
* Update BgActor's prevTransform
*/
void DynaPoly_SetBgActorPrevTransform(GlobalContext* globalCtx, BgActor* bgActor) {
void DynaPoly_SetBgActorPrevTransform(PlayState* play, BgActor* bgActor) {
bgActor->prevTransform = bgActor->curTransform;
}
@@ -2651,43 +2649,42 @@ s32 DynaPoly_IsBgIdBgActor(s32 bgId) {
/**
* Init DynaCollisionContext
*/
void DynaPoly_Init(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
void DynaPoly_Init(PlayState* play, DynaCollisionContext* dyna) {
dyna->bitFlag = DYNAPOLY_INVALIDATE_LOOKUP;
DynaPoly_NullPolyList(&dyna->polyList);
DynaPoly_NullVtxList(&dyna->vtxList);
DynaPoly_InitWaterBoxList(&dyna->waterBoxList);
DynaSSNodeList_Init(globalCtx, &dyna->polyNodes);
DynaSSNodeList_Init(play, &dyna->polyNodes);
}
/**
* Set DynaCollisionContext
*/
void DynaPoly_Alloc(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
void DynaPoly_Alloc(PlayState* play, DynaCollisionContext* dyna) {
s32 i;
for (i = 0; i < BG_ACTOR_MAX; i++) {
BgActor_Init(globalCtx, &dyna->bgActors[i]);
BgActor_Init(play, &dyna->bgActors[i]);
dyna->bgActorFlags[i] = 0;
}
DynaPoly_NullPolyList(&dyna->polyList);
DynaPoly_AllocPolyList(globalCtx, &dyna->polyList, dyna->polyListMax);
DynaPoly_AllocPolyList(play, &dyna->polyList, dyna->polyListMax);
DynaPoly_NullVtxList(&dyna->vtxList);
DynaPoly_AllocVtxList(globalCtx, &dyna->vtxList, dyna->vtxListMax);
DynaPoly_AllocVtxList(play, &dyna->vtxList, dyna->vtxListMax);
DynaPoly_InitWaterBoxList(&dyna->waterBoxList);
DynaPoly_AllocWaterBoxList(globalCtx, &dyna->waterBoxList, DYNA_WATERBOX_MAX);
DynaPoly_AllocWaterBoxList(play, &dyna->waterBoxList, DYNA_WATERBOX_MAX);
DynaSSNodeList_Init(globalCtx, &dyna->polyNodes);
DynaSSNodeList_Alloc(globalCtx, &dyna->polyNodes, dyna->polyNodesMax);
DynaSSNodeList_Init(play, &dyna->polyNodes);
DynaSSNodeList_Alloc(play, &dyna->polyNodes, dyna->polyNodesMax);
}
/**
* Set BgActor
* original name: DynaPolyInfo_setActor
*/
s32 DynaPoly_SetBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* actor,
CollisionHeader* colHeader) {
s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* actor, CollisionHeader* colHeader) {
s32 bgId;
s32 foundSlot = false;
@@ -2721,42 +2718,42 @@ DynaPolyActor* DynaPoly_GetActor(CollisionContext* colCtx, s32 bgId) {
return (DynaPolyActor*)colCtx->dyna.bgActors[bgId].actor;
}
void func_800C62BC(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void func_800C62BC(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
if (DynaPoly_IsBgIdBgActor(bgId)) {
dyna->bgActorFlags[bgId] |= 4;
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
}
void func_800C6314(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void func_800C6314(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
if (DynaPoly_IsBgIdBgActor(bgId)) {
dyna->bgActorFlags[bgId] &= ~4;
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
}
void func_800C636C(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void func_800C636C(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
if (DynaPoly_IsBgIdBgActor(bgId)) {
dyna->bgActorFlags[bgId] |= 8;
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
}
void func_800C63C4(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void func_800C63C4(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
if (DynaPoly_IsBgIdBgActor(bgId)) {
dyna->bgActorFlags[bgId] &= ~8;
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
}
void func_800C641C(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void func_800C641C(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
if (DynaPoly_IsBgIdBgActor(bgId)) {
dyna->bgActorFlags[bgId] |= 0x20;
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
}
void func_800C6474(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void func_800C6474(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
if (DynaPoly_IsBgIdBgActor(bgId)) {
dyna->bgActorFlags[bgId] &= ~0x20;
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
@@ -2766,13 +2763,13 @@ void func_800C6474(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgI
/**
* original name: DynaPolyInfo_delReserve
*/
void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
DynaPolyActor* actor;
if (DynaPoly_IsBgIdBgActor(bgId) == false) {
return;
}
actor = DynaPoly_GetActor(&globalCtx->colCtx, bgId);
actor = DynaPoly_GetActor(&play->colCtx, bgId);
if (actor != NULL) {
actor->bgId = BGACTOR_NEG_ONE;
@@ -2781,7 +2778,7 @@ void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna
}
}
void func_800C6554(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
void func_800C6554(PlayState* play, DynaCollisionContext* dyna) {
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
@@ -2839,8 +2836,8 @@ void BgCheck_CalcWaterboxDimensions(Vec3f* minPos, Vec3f* maxXPos, Vec3f* maxZPo
/**
* original name: DynaPolyInfo_expandSRT
*/
void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex,
s32* polyStartIndex, s32* waterBoxStartIndex) {
void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, s32* polyStartIndex,
s32* waterBoxStartIndex) {
Actor* actor;
s32 pad;
s32 pad2;
@@ -3064,13 +3061,13 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/DynaPoly_ExpandSRT.s")
#endif
void BgCheck_ResetFlagsIfLoadedActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* actor) {
void BgCheck_ResetFlagsIfLoadedActor(PlayState* play, DynaCollisionContext* dyna, Actor* actor) {
DynaPolyActor* dynaActor;
s32 i;
for (i = 0; i < BG_ACTOR_MAX; i++) {
if ((dyna->bgActorFlags[i] & 1)) {
dynaActor = DynaPoly_GetActor(&globalCtx->colCtx, i);
dynaActor = DynaPoly_GetActor(&play->colCtx, i);
if (dynaActor != NULL && &dynaActor->actor == actor) {
DynaPolyActor_ResetState((DynaPolyActor*)actor);
return;
@@ -3082,7 +3079,7 @@ void BgCheck_ResetFlagsIfLoadedActor(GlobalContext* globalCtx, DynaCollisionCont
/**
* original name: DynaPolyInfo_setup
*/
void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
void DynaPoly_Setup(PlayState* play, DynaCollisionContext* dyna) {
DynaPolyActor* actor;
s32 vtxStartIndex;
s32 polyStartIndex;
@@ -3099,19 +3096,19 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
if (dyna->bgActorFlags[i] & 2) {
// Initialize BgActor
dyna->bgActorFlags[i] = 0;
BgActor_Init(globalCtx, &dyna->bgActors[i]);
BgActor_Init(play, &dyna->bgActors[i]);
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
if (dyna->bgActors[i].actor != NULL && dyna->bgActors[i].actor->update == NULL) {
// Delete BgActor
actor = DynaPoly_GetActor(&globalCtx->colCtx, i);
actor = DynaPoly_GetActor(&play->colCtx, i);
if (actor == NULL) {
return;
}
actor->bgId = BGACTOR_NEG_ONE;
dyna->bgActorFlags[i] = 0;
BgActor_Init(globalCtx, &dyna->bgActors[i]);
BgActor_Init(play, &dyna->bgActors[i]);
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
}
@@ -3120,7 +3117,7 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
waterBoxStartIndex = 0;
for (i = 0; i < BG_ACTOR_MAX; i++) {
if ((dyna->bgActorFlags[i] & 1) && !(dyna->bgActorFlags[i] & 2)) {
DynaPoly_ExpandSRT(globalCtx, dyna, i, &vtxStartIndex, &polyStartIndex, &waterBoxStartIndex);
DynaPoly_ExpandSRT(play, dyna, i, &vtxStartIndex, &polyStartIndex, &waterBoxStartIndex);
}
}
dyna->bitFlag &= ~DYNAPOLY_INVALIDATE_LOOKUP;
@@ -3150,12 +3147,12 @@ void func_800C756C(DynaCollisionContext* dyna, s32* numPolygons, s32* numVertice
/**
* Update all BgActor's previous ScaleRotPos
*/
void DynaPoly_UpdateBgActorTransforms(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
void DynaPoly_UpdateBgActorTransforms(PlayState* play, DynaCollisionContext* dyna) {
s32 i;
for (i = 0; i < BG_ACTOR_MAX; i++) {
if (dyna->bgActorFlags[i] & 1) {
DynaPoly_SetBgActorPrevTransform(globalCtx, &dyna->bgActors[i]);
DynaPoly_SetBgActorPrevTransform(play, &dyna->bgActors[i]);
}
}
}
@@ -3295,10 +3292,10 @@ f32 BgCheck_RaycastFloorDyna(DynaRaycast* dynaRaycast) {
}
dynaActor = DynaPoly_GetActor(dynaRaycast->colCtx, *dynaRaycast->bgId);
if ((result != BGCHECK_Y_MIN) && (dynaActor != NULL) && (dynaRaycast->globalCtx != NULL)) {
pauseState = dynaRaycast->globalCtx->pauseCtx.state != 0;
if ((result != BGCHECK_Y_MIN) && (dynaActor != NULL) && (dynaRaycast->play != NULL)) {
pauseState = dynaRaycast->play->pauseCtx.state != 0;
if (!pauseState) {
pauseState = dynaRaycast->globalCtx->pauseCtx.debugState != 0;
pauseState = dynaRaycast->play->pauseCtx.debugState != 0;
}
if (!pauseState && (dynaRaycast->colCtx->dyna.bgActorFlags[*dynaRaycast->bgId] & 2)) {
curTransform = &dynaRaycast->dyna->bgActors[*dynaRaycast->bgId].curTransform;
@@ -3983,7 +3980,7 @@ void CollisionHeader_GetVirtual(CollisionHeader* colHeader, CollisionHeader** de
/**
* SEGMENT_TO_VIRTUAL all active BgActor CollisionHeaders
*/
void BgCheck_InitCollisionHeaders(CollisionContext* colCtx, GlobalContext* globalCtx) {
void BgCheck_InitCollisionHeaders(CollisionContext* colCtx, PlayState* play) {
DynaCollisionContext* dyna = &colCtx->dyna;
s32 i;
u16 flag;
@@ -3991,7 +3988,7 @@ void BgCheck_InitCollisionHeaders(CollisionContext* colCtx, GlobalContext* globa
for (i = 0; i < BG_ACTOR_MAX; i++) {
flag = dyna->bgActorFlags[i];
if ((flag & 1) && !(flag & 2)) {
Actor_SetObjectDependency(globalCtx, dyna->bgActors[i].actor);
Actor_SetObjectDependency(play, dyna->bgActors[i].actor);
CollisionHeader_SegmentedToVirtual(dyna->bgActors[i].colHeader);
}
}
@@ -4378,7 +4375,7 @@ u32 SurfaceType_IsWallDamage(CollisionContext* colCtx, CollisionPoly* poly, s32
* returns true if point is within the xz boundaries of an active water box, else false
* `ySurface` returns the water box's surface, while `outWaterBox` returns a pointer to the WaterBox
*/
s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
WaterBox** outWaterBox, s32* bgId) {
CollisionHeader* colHeader;
u32 room;
@@ -4392,7 +4389,7 @@ s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx,
for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes;
curWaterBox++) {
room = 0x3F & (curWaterBox->properties >> 13);
if (room == (u32)globalCtx->roomCtx.currRoom.num || room == 0x3F) {
if (room == (u32)play->roomCtx.currRoom.num || room == 0x3F) {
if (curWaterBox->properties & 0x80000) {
continue;
}
@@ -4438,16 +4435,16 @@ s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx,
}
// boolean
s32 WaterBox_GetSurface1(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
WaterBox** outWaterBox) {
return WaterBox_GetSurface1_2(globalCtx, colCtx, x, z, ySurface, outWaterBox);
return WaterBox_GetSurface1_2(play, colCtx, x, z, ySurface, outWaterBox);
}
// boolean
s32 WaterBox_GetSurface1_2(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
s32 WaterBox_GetSurface1_2(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
WaterBox** outWaterBox) {
s32 bgId;
return WaterBox_GetSurfaceImpl(globalCtx, colCtx, x, z, ySurface, outWaterBox, &bgId);
return WaterBox_GetSurfaceImpl(play, colCtx, x, z, ySurface, outWaterBox, &bgId);
}
#ifdef NON_MATCHING
@@ -4457,7 +4454,7 @@ s32 WaterBox_GetSurface1_2(GlobalContext* globalCtx, CollisionContext* colCtx, f
* returns the index of the waterbox found, or -1 if no waterbox is found
* `outWaterBox` returns the pointer to the waterbox found, or NULL if none is found
*/
s32 WaterBox_GetSurface2(GlobalContext* globalCtx, CollisionContext* colCtx, Vec3f* pos, f32 surfaceCheckDist,
s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceCheckDist,
WaterBox** outWaterBox, s32* bgId) {
CollisionHeader* colHeader;
s32 room;
@@ -4477,7 +4474,7 @@ s32 WaterBox_GetSurface2(GlobalContext* globalCtx, CollisionContext* colCtx, Vec
waterBox = &colHeader->waterBoxes[i];
room = WATERBOX_ROOM(waterBox->properties);
if (!(room == globalCtx->roomCtx.currRoom.num || room == 0x3F)) {
if (!(room == play->roomCtx.currRoom.num || room == 0x3F)) {
continue;
}
if ((waterBox->properties & 0x80000)) {
@@ -4596,8 +4593,8 @@ u32 WaterBox_GetLightSettingIndex(CollisionContext* colCtx, WaterBox* waterBox)
* returns true if point is within the xz boundaries of an active water box, else false
* `ySurface` returns the water box's surface, while `outWaterBox` returns a pointer to the WaterBox
*/
s32 func_800CA6F0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
WaterBox** outWaterBox, s32* bgId) {
s32 func_800CA6F0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox,
s32* bgId) {
CollisionHeader* colHeader;
u32 room;
WaterBox* curWaterBox;
@@ -4614,7 +4611,7 @@ s32 func_800CA6F0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32
for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes;
curWaterBox++) {
room = WATERBOX_ROOM(curWaterBox->properties);
if (room == (u32)globalCtx->roomCtx.currRoom.num || room == 0x3F) {
if (room == (u32)play->roomCtx.currRoom.num || room == 0x3F) {
if ((curWaterBox->properties & 0x80000) != 0) {
if (curWaterBox->minPos.x < x && x < curWaterBox->minPos.x + curWaterBox->xLength) {
if (curWaterBox->minPos.z < z && z < curWaterBox->minPos.z + curWaterBox->zLength) {
@@ -4656,11 +4653,10 @@ s32 func_800CA6F0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800CA6F0.s")
#endif
s32 func_800CA9D0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
WaterBox** outWaterBox) {
s32 func_800CA9D0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) {
s32 bgId;
return func_800CA6F0(globalCtx, colCtx, x, z, ySurface, outWaterBox, &bgId);
return func_800CA6F0(play, colCtx, x, z, ySurface, outWaterBox, &bgId);
}
/**
+8 -8
View File
@@ -3,37 +3,37 @@
/**
* Draws a display list to the opaque display buffer
*/
void Gfx_DrawDListOpa(GlobalContext* globalCtx, Gfx* dlist) {
void Gfx_DrawDListOpa(PlayState* play, Gfx* dlist) {
Gfx* dl;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
dl = POLY_OPA_DISP;
gSPDisplayList(&dl[0], &sSetupDL[6 * 0x19]);
gSPMatrix(&dl[1], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(&dl[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(&dl[2], dlist);
POLY_OPA_DISP = &dl[3];
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* Draws a display list to the translucent display buffer
*/
void Gfx_DrawDListXlu(GlobalContext* globalCtx, Gfx* dlist) {
void Gfx_DrawDListXlu(PlayState* play, Gfx* dlist) {
Gfx* dl;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
dl = POLY_XLU_DISP;
gSPDisplayList(&dl[0], &sSetupDL[6 * 0x19]);
gSPMatrix(&dl[1], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(&dl[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(&dl[2], dlist);
POLY_XLU_DISP = &dl[3];
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,4 +1,4 @@
#include "global.h"
void func_801AAAA0(GlobalContext* globalCtx) {
void func_801AAAA0(PlayState* play) {
}
+21 -21
View File
@@ -7,10 +7,10 @@ typedef struct {
/* 0x04 */ void* drawArg; // segment address (display list or texture) passed to the draw funciton when called
} DebugDispObjectInfo; // size = 0x8
typedef void (*DebugDispObject_DrawFunc)(DebugDispObject*, void*, GlobalContext*);
typedef void (*DebugDispObject_DrawFunc)(DebugDispObject*, void*, PlayState*);
void DebugDisplay_DrawSpriteI8(DebugDispObject*, void*, GlobalContext*);
void DebugDisplay_DrawPolygon(DebugDispObject*, void*, GlobalContext*);
void DebugDisplay_DrawSpriteI8(DebugDispObject*, void*, PlayState*);
void DebugDisplay_DrawPolygon(DebugDispObject*, void*, PlayState*);
DebugDispObject* DebugDisplay_Init(void) {
sDebugObjectListHead = NULL;
@@ -51,44 +51,44 @@ DebugDispObjectInfo sDebugObjectInfoTable[] = {
{ 1, &sDebugDisplay2DL },
};
void DebugDisplay_DrawObjects(GlobalContext* globalCtx) {
void DebugDisplay_DrawObjects(PlayState* play) {
DebugDispObject* dispObj = sDebugObjectListHead;
DebugDispObjectInfo* objInfo;
while (dispObj != NULL) {
objInfo = &sDebugObjectInfoTable[dispObj->type];
sDebugObjectDrawFuncTable[objInfo->drawType](dispObj, objInfo->drawArg, globalCtx);
sDebugObjectDrawFuncTable[objInfo->drawType](dispObj, objInfo->drawArg, play);
dispObj = dispObj->next;
}
}
void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
func_8012C6FC(globalCtx->state.gfxCtx);
func_8012C6FC(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a);
Matrix_Translate(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, MTXMODE_NEW);
Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY);
Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY);
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZYX(dispObj->rot.x, dispObj->rot.y, dispObj->rot.z, MTXMODE_APPLY);
gDPLoadTextureBlock(POLY_XLU_DISP++, texture, G_IM_FMT_I, G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, sDebugDisplaySpriteDL);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
Lights1 sDebugDisplayLight1 = gdSPDefLights1(128, 128, 128, 255, 255, 255, 73, 73, 73);
void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* arg1, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* arg1, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
func_8012C588(globalCtx->state.gfxCtx);
func_8012C588(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a);
@@ -96,10 +96,10 @@ void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* arg1, GlobalContex
Matrix_SetTranslateRotateYXZ(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, &dispObj->rot);
Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, arg1);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
s32 D_801BB068[] = {
@@ -110,16 +110,16 @@ s32 D_801BB08C = 0;
Gfx* func_800E99B0(GraphicsContext* gfxCtx, s32 arg1);
void func_800E992C(GlobalContext* globalCtx, s32 arg1) {
void func_800E992C(PlayState* play, s32 arg1) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_8012C560(globalCtx->state.gfxCtx);
func_8012C560(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, func_800E99B0(globalCtx->state.gfxCtx, arg1));
gSPDisplayList(POLY_XLU_DISP++, func_800E99B0(play->state.gfxCtx, arg1));
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug_display/func_800E99B0.s")
+281 -281
View File
File diff suppressed because it is too large Load Diff
+12 -12
View File
@@ -1,10 +1,10 @@
#include "global.h"
void EffFootmark_Init(GlobalContext* globalCtx) {
void EffFootmark_Init(PlayState* play) {
EffFootmark* footmark;
s32 i;
for (footmark = globalCtx->footprintInfo, i = 0; i < 100; i++, footmark++) {
for (footmark = play->footprintInfo, i = 0; i < 100; i++, footmark++) {
footmark->actor = NULL;
footmark->location.x = 0;
footmark->location.y = 0;
@@ -16,15 +16,15 @@ void EffFootmark_Init(GlobalContext* globalCtx) {
}
}
void EffFootmark_Add(GlobalContext* globalCtx, MtxF* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size,
u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay) {
void EffFootmark_Add(PlayState* play, MtxF* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size, u8 red,
u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay) {
s32 i;
EffFootmark* footmark;
EffFootmark* destination = NULL;
EffFootmark* oldest = NULL;
s32 isNew = 1;
for (footmark = globalCtx->footprintInfo, i = 0; i < 100; i++, footmark++) {
for (footmark = play->footprintInfo, i = 0; i < 100; i++, footmark++) {
if (((actor == footmark->actor) && (footmark->id == id)) && ((footmark->flags & 1) == 0)) {
if (fabsf((footmark->location).x - location->x) <= 1) {
if (fabsf((footmark->location).z - location->z) <= 1) {
@@ -70,11 +70,11 @@ void EffFootmark_Add(GlobalContext* globalCtx, MtxF* displayMatrix, Actor* actor
}
}
void EffFootmark_Update(GlobalContext* globalCtx) {
void EffFootmark_Update(PlayState* play) {
EffFootmark* footmark;
s32 i;
for (footmark = globalCtx->footprintInfo, i = 0; i < 100; i++, footmark++) {
for (footmark = play->footprintInfo, i = 0; i < 100; i++, footmark++) {
if (footmark->actor != NULL) {
if ((footmark->flags & 1) == 1) {
if (footmark->age < 0xFFFFu) { // TODO replace with MAX_U16 or something
@@ -95,21 +95,21 @@ void EffFootmark_Update(GlobalContext* globalCtx) {
}
}
void EffFootmark_Draw(GlobalContext* globalCtx) {
void EffFootmark_Draw(PlayState* play) {
EffFootmark* footmark;
s32 i;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
GraphicsContext* gfxCtx = play->state.gfxCtx;
func_8012C448(globalCtx->state.gfxCtx);
func_8012C448(play->state.gfxCtx);
gSPDisplayList(gfxCtx->polyXlu.p++, D_801BC240);
for (footmark = globalCtx->footprintInfo, i = 0; i < 100; i++, footmark++) {
for (footmark = play->footprintInfo, i = 0; i < 100; i++, footmark++) {
if (footmark->actor != NULL) {
Matrix_Put(&footmark->displayMatrix);
Matrix_Scale(footmark->size * (1.0f / 0x100) * 0.7f, 1, footmark->size * (1.0f / 0x100), MTXMODE_APPLY);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, footmark->red, footmark->green, footmark->blue,
footmark->alpha >> 8);
+4 -4
View File
@@ -43,7 +43,7 @@ void EffectShieldParticle_Init(void* thisx, void* initParamsx) {
this->lightInfo.type = LIGHT_POINT_NOGLOW;
this->lightInfo.params.point = initParams->lightPoint;
this->lightNode =
LightContext_InsertLight(Effect_GetGlobalCtx(), &Effect_GetGlobalCtx()->lightCtx, &this->lightInfo);
LightContext_InsertLight(Effect_GetPlayState(), &Effect_GetPlayState()->lightCtx, &this->lightInfo);
} else {
this->lightNode = NULL;
}
@@ -54,10 +54,10 @@ void EffectShieldParticle_Destroy(void* thisx) {
EffectShieldParticle* this = (EffectShieldParticle*)thisx;
if ((this != NULL) && (this->lightDecay == true)) {
if (this->lightNode == Effect_GetGlobalCtx()->lightCtx.listHead) {
Effect_GetGlobalCtx()->lightCtx.listHead = this->lightNode->next;
if (this->lightNode == Effect_GetPlayState()->lightCtx.listHead) {
Effect_GetPlayState()->lightCtx.listHead = this->lightNode->next;
}
LightContext_RemoveLight(Effect_GetGlobalCtx(), &Effect_GetGlobalCtx()->lightCtx, this->lightNode);
LightContext_RemoveLight(Effect_GetPlayState(), &Effect_GetPlayState()->lightCtx, this->lightNode);
}
}
+2 -2
View File
@@ -122,7 +122,7 @@ s32 EffectSpark_Update(void* thisx) {
void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
Vtx* vertices;
EffectSpark* this = (EffectSpark*)thisx;
GlobalContext* globalCtx = Effect_GetGlobalCtx();
PlayState* play = Effect_GetPlayState();
s32 i;
s32 j;
u8 sp1D3;
@@ -199,7 +199,7 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
SkinMatrix_SetTranslate(&spEC, elem->position.x, elem->position.y, elem->position.z);
temp = ((Rand_ZeroOne() * 2.5f) + 1.5f) / 64.0f;
SkinMatrix_SetScale(&spAC, temp, temp, 1.0f);
SkinMatrix_MtxFMtxFMult(&spEC, &globalCtx->billboardMtxF, &sp6C);
SkinMatrix_MtxFMtxFMult(&spEC, &play->billboardMtxF, &sp6C);
SkinMatrix_MtxFMtxFMult(&sp6C, &spAC, &sp12C);
vertices[j].v.ob[0] = -32;
+20 -20
View File
@@ -1,11 +1,11 @@
#include "global.h"
void func_800AE2A0(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) {
void func_800AE2A0(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) {
f32 cos;
Gfx* displayListHead;
f32 absCos;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
displayListHead = POLY_OPA_DISP;
cos = Math_CosS((0x8000 / arg3) * arg2);
@@ -23,14 +23,14 @@ void func_800AE2A0(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a
POLY_OPA_DISP = displayListHead;
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void func_800AE434(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) {
void func_800AE434(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) {
Gfx* displayListHead;
f32 cos;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
cos = Math_CosS((0x4000 / arg3) * arg2);
displayListHead = POLY_OPA_DISP;
@@ -41,26 +41,26 @@ void func_800AE434(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a
POLY_OPA_DISP = displayListHead;
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void func_800AE5A0(GlobalContext* globalCtx) {
void func_800AE5A0(PlayState* play) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
gDPPipeSync(POLY_OPA_DISP++);
POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP);
POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void func_800AE5E4(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) {
void func_800AE5E4(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) {
f32 cos;
Gfx* displayListHead;
f32 absCos;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
displayListHead = POLY_XLU_DISP;
cos = Math_CosS((0x8000 / arg3) * arg2);
@@ -78,14 +78,14 @@ void func_800AE5E4(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a
POLY_XLU_DISP = displayListHead;
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void func_800AE778(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) {
void func_800AE778(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) {
f32 cos;
Gfx* displayListHead;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
displayListHead = POLY_XLU_DISP;
cos = Math_CosS((0x4000 / arg3) * arg2);
@@ -96,16 +96,16 @@ void func_800AE778(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a
POLY_XLU_DISP = displayListHead;
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void func_800AE8EC(GlobalContext* globalCtx) {
void func_800AE8EC(PlayState* play) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
gDPPipeSync(POLY_XLU_DISP++);
POLY_XLU_DISP = func_801660B8(globalCtx, POLY_XLU_DISP);
POLY_XLU_DISP = func_801660B8(play, POLY_XLU_DISP);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
+13 -13
View File
@@ -40,8 +40,8 @@ EffectInfo sEffectInfoTable[] = {
},
};
GlobalContext* Effect_GetGlobalCtx(void) {
return sEffectContext.globalCtx;
PlayState* Effect_GetPlayState(void) {
return sEffectContext.play;
}
void* Effect_GetByIndex(s32 index) {
@@ -93,7 +93,7 @@ void Effect_InitStatus(EffectStatus* status) {
status->unk2 = 0;
}
void Effect_Init(GlobalContext* globalCtx) {
void Effect_Init(PlayState* play) {
s32 i;
for (i = 0; i < SPARK_COUNT; i++) {
@@ -113,10 +113,10 @@ void Effect_Init(GlobalContext* globalCtx) {
Effect_InitStatus(&sEffectContext.tireMarks[i].status);
}
sEffectContext.globalCtx = globalCtx;
sEffectContext.play = play;
}
void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams) {
void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams) {
u32 slotFound;
s32 i;
void* effect = NULL;
@@ -124,7 +124,7 @@ void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg
*pIndex = TOTAL_EFFECT_COUNT;
if (FrameAdvance_IsEnabled(&globalCtx->state) != true) {
if (FrameAdvance_IsEnabled(&play->state) != true) {
slotFound = false;
switch (type) {
case EFFECT_SPARK:
@@ -217,14 +217,14 @@ void Effect_DrawAll(GraphicsContext* gfxCtx) {
}
}
void Effect_UpdateAll(GlobalContext* globalCtx) {
void Effect_UpdateAll(PlayState* play) {
s32 i;
for (i = 0; i < SPARK_COUNT; i++) {
if (1) {} // necessary to match
if (sEffectContext.sparks[i].status.active) {
if (sEffectInfoTable[EFFECT_SPARK].update(&sEffectContext.sparks[i].effect) == 1) {
Effect_Destroy(globalCtx, i);
Effect_Destroy(play, i);
}
}
}
@@ -233,7 +233,7 @@ void Effect_UpdateAll(GlobalContext* globalCtx) {
if (1) {} // necessary to match
if (sEffectContext.blures[i].status.active) {
if (sEffectInfoTable[EFFECT_BLURE1].update(&sEffectContext.blures[i].effect) == 1) {
Effect_Destroy(globalCtx, i + SPARK_COUNT);
Effect_Destroy(play, i + SPARK_COUNT);
}
}
}
@@ -242,7 +242,7 @@ void Effect_UpdateAll(GlobalContext* globalCtx) {
if (1) {} // necessary to match
if (sEffectContext.shieldParticles[i].status.active) {
if (sEffectInfoTable[EFFECT_SHIELD_PARTICLE].update(&sEffectContext.shieldParticles[i].effect) == 1) {
Effect_Destroy(globalCtx, i + SPARK_COUNT + BLURE_COUNT);
Effect_Destroy(play, i + SPARK_COUNT + BLURE_COUNT);
}
}
}
@@ -251,13 +251,13 @@ void Effect_UpdateAll(GlobalContext* globalCtx) {
if (1) {} // necessary to match
if (sEffectContext.tireMarks[i].status.active) {
if (sEffectInfoTable[EFFECT_TIRE_MARK].update(&sEffectContext.tireMarks[i].effect) == 1) {
Effect_Destroy(globalCtx, i + SPARK_COUNT + BLURE_COUNT + SHIELD_PARTICLE_COUNT);
Effect_Destroy(play, i + SPARK_COUNT + BLURE_COUNT + SHIELD_PARTICLE_COUNT);
}
}
}
}
void Effect_Destroy(GlobalContext* globalCtx, s32 index) {
void Effect_Destroy(PlayState* play, s32 index) {
if (index == TOTAL_EFFECT_COUNT) {
return;
}
@@ -290,7 +290,7 @@ void Effect_Destroy(GlobalContext* globalCtx, s32 index) {
}
}
void Effect_DestroyAll(GlobalContext* globalCtx) {
void Effect_DestroyAll(PlayState* play) {
s32 i;
for (i = 0; i < SPARK_COUNT; i++) {
+18 -18
View File
@@ -3,12 +3,12 @@
EffectSsInfo sEffectSsInfo = { NULL, 0, 0 };
void EffectSS_Init(GlobalContext* globalCtx, s32 numEntries) {
void EffectSS_Init(PlayState* play, s32 numEntries) {
u32 i;
EffectSs* effectsSs;
EffectSsOverlay* overlay;
sEffectSsInfo.data_table = (EffectSs*)THA_AllocEndAlign16(&globalCtx->state.heap, numEntries * sizeof(EffectSs));
sEffectSsInfo.data_table = (EffectSs*)THA_AllocEndAlign16(&play->state.heap, numEntries * sizeof(EffectSs));
sEffectSsInfo.searchIndex = 0;
sEffectSsInfo.size = numEntries;
@@ -24,7 +24,7 @@ void EffectSS_Init(GlobalContext* globalCtx, s32 numEntries) {
}
}
void EffectSS_Clear(GlobalContext* globalCtx) {
void EffectSS_Clear(PlayState* play) {
u32 i;
EffectSs* effectsSs;
EffectSsOverlay* overlay;
@@ -150,10 +150,10 @@ s32 EffectSS_FindFreeSpace(s32 priority, s32* tableEntry) {
return false;
}
void EffectSS_Copy(GlobalContext* globalCtx, EffectSs* effectsSs) {
void EffectSS_Copy(PlayState* play, EffectSs* effectsSs) {
s32 index;
if (FrameAdvance_IsEnabled(&globalCtx->state) != true) {
if (FrameAdvance_IsEnabled(&play->state) != true) {
if (EffectSS_FindFreeSpace(effectsSs->priority, &index) == 0) {
sEffectSsInfo.searchIndex = index + 1;
sEffectSsInfo.data_table[index] = *effectsSs;
@@ -161,7 +161,7 @@ void EffectSS_Copy(GlobalContext* globalCtx, EffectSs* effectsSs) {
}
}
void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* initData) {
void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initData) {
s32 index;
u32 overlaySize;
EffectSsOverlay* entry = &gParticleOverlayTable[type];
@@ -199,13 +199,13 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init
sEffectSsInfo.data_table[index].type = type;
sEffectSsInfo.data_table[index].priority = priority;
if (initInfo->init(globalCtx, index, &sEffectSsInfo.data_table[index], initData) == 0) {
if (initInfo->init(play, index, &sEffectSsInfo.data_table[index], initData) == 0) {
EffectSS_ResetEntry(&sEffectSsInfo.data_table[index]);
}
}
}
void EffectSS_UpdateParticle(GlobalContext* globalCtx, s32 index) {
void EffectSS_UpdateParticle(PlayState* play, s32 index) {
EffectSs* particle = &sEffectSsInfo.data_table[index];
if (particle->update != NULL) {
@@ -217,11 +217,11 @@ void EffectSS_UpdateParticle(GlobalContext* globalCtx, s32 index) {
particle->pos.y += particle->velocity.y;
particle->pos.z += particle->velocity.z;
particle->update(globalCtx, index, particle);
particle->update(play, index, particle);
}
}
void EffectSS_UpdateAllParticles(GlobalContext* globalCtx) {
void EffectSS_UpdateAllParticles(PlayState* play) {
s32 i;
for (i = 0; i < sEffectSsInfo.size; i++) {
@@ -234,25 +234,25 @@ void EffectSS_UpdateAllParticles(GlobalContext* globalCtx) {
}
if (sEffectSsInfo.data_table[i].life > -1) {
EffectSS_UpdateParticle(globalCtx, i);
EffectSS_UpdateParticle(play, i);
}
}
}
void EffectSS_DrawParticle(GlobalContext* globalCtx, s32 index) {
void EffectSS_DrawParticle(PlayState* play, s32 index) {
EffectSs* entry = &sEffectSsInfo.data_table[index];
if (entry->draw != NULL) {
entry->draw(globalCtx, index, entry);
entry->draw(play, index, entry);
}
}
void EffectSS_DrawAllParticles(GlobalContext* globalCtx) {
Lights* lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx);
void EffectSS_DrawAllParticles(PlayState* play) {
Lights* lights = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx);
s32 i;
Lights_BindAll(lights, globalCtx->lightCtx.listHead, NULL, globalCtx);
Lights_Draw(lights, globalCtx->state.gfxCtx);
Lights_BindAll(lights, play->lightCtx.listHead, NULL, play);
Lights_Draw(lights, play->state.gfxCtx);
for (i = 0; i < sEffectSsInfo.size; i++) {
if (sEffectSsInfo.data_table[i].life > -1) {
@@ -264,7 +264,7 @@ void EffectSS_DrawAllParticles(GlobalContext* globalCtx) {
(sEffectSsInfo.data_table[i].pos.z < BGCHECK_Y_MIN)) {
EffectSS_Delete(&sEffectSsInfo.data_table[i]);
} else {
EffectSS_DrawParticle(globalCtx, i);
EffectSS_DrawParticle(play, i);
}
}
}
+170 -174
View File
@@ -32,8 +32,8 @@
#include "overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.h"
#include "overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h"
void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* texture) {
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) {
GraphicsContext* gfxCtx = play->state.gfxCtx;
f32 scale;
MtxF mfTrans;
MtxF mfScale;
@@ -41,14 +41,14 @@ void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* textur
MtxF mfTrans11DA0;
s32 pad1;
Mtx* mtx;
void* object = globalCtx->objectCtx.status[this->rgObjBankIdx].segment;
void* object = play->objectCtx.status[this->rgObjBankIdx].segment;
OPEN_DISPS(gfxCtx);
scale = this->rgScale * 0.0025f;
SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetScale(&mfScale, scale, scale, scale);
SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTrans11DA0);
SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0);
SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult);
gSegments[0x06] = PHYSICAL_TO_VIRTUAL(object);
gSPSegment(POLY_XLU_DISP++, 0x06, object);
@@ -70,7 +70,7 @@ void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* textur
// EffectSsDust Spawn Functions
void EffectSsDust_Spawn(GlobalContext* globalCtx, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
void EffectSsDust_Spawn(PlayState* play, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life,
u8 updateMode) {
EffectSsDustInitParams initParams;
@@ -86,80 +86,78 @@ void EffectSsDust_Spawn(GlobalContext* globalCtx, u16 drawFlags, Vec3f* pos, Vec
initParams.life = life;
initParams.updateMode = updateMode;
EffectSs_Spawn(globalCtx, EFFECT_SS_DUST, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_DUST, 128, &initParams);
}
void func_800B0DE0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_800B0DE0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s16 scaleStep) {
EffectSsDust_Spawn(globalCtx, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0);
EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0);
}
void func_800B0E48(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_800B0E48(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s16 scaleStep) {
EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0);
EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0);
}
void func_800B0EB0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_800B0EB0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) {
EffectSsDust_Spawn(globalCtx, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0);
EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0);
}
void func_800B0F18(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_800B0F18(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) {
EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0);
EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0);
}
void func_800B0F80(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_800B0F80(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) {
EffectSsDust_Spawn(globalCtx, 2, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0);
EffectSsDust_Spawn(play, 2, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0);
}
void func_800B0FE8(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_800B0FE8(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s16 scaleStep) {
EffectSsDust_Spawn(globalCtx, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1);
EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1);
}
void func_800B1054(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_800B1054(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s16 scaleStep) {
EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1);
EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1);
}
static Color_RGBA8 sDustBrownPrim = { 170, 130, 90, 255 };
static Color_RGBA8 sDustBrownEnv = { 100, 60, 20, 255 };
void func_800B10C0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0);
void func_800B10C0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0);
}
void func_800B1130(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0);
void func_800B1130(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0);
}
void func_800B11A0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) {
EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0);
void func_800B11A0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) {
EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0);
}
void func_800B1210(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) {
EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0);
void func_800B1210(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) {
EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0);
}
void func_800B1280(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
s16 life) {
EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0);
void func_800B1280(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life) {
EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0);
}
void func_800B12F0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
s16 life) {
EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0);
void func_800B12F0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life) {
EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0);
}
void func_800B1360(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_800B1360(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor) {
func_800B0DE0(globalCtx, pos, velocity, accel, primColor, envColor, 100, 5);
func_800B0DE0(play, pos, velocity, accel, primColor, envColor, 100, 5);
}
void func_800B139C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_800B139C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor) {
func_800B0E48(globalCtx, pos, velocity, accel, primColor, envColor, 100, 5);
func_800B0E48(play, pos, velocity, accel, primColor, envColor, 100, 5);
}
void func_800B13D8(Vec3f* srcPos, f32 randScale, Vec3f* newPos, Vec3f* velocity, Vec3f* accel) {
@@ -182,7 +180,7 @@ void func_800B13D8(Vec3f* srcPos, f32 randScale, Vec3f* newPos, Vec3f* velocity,
accel->z = 0.0f;
}
void func_800B14D4(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) {
void func_800B14D4(PlayState* play, f32 randScale, Vec3f* srcPos) {
s32 i;
Vec3f pos;
Vec3f velocity;
@@ -190,11 +188,11 @@ void func_800B14D4(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) {
for (i = 0; i < 20; i++) {
func_800B13D8(srcPos, randScale, &pos, &velocity, &accel);
func_800B1280(globalCtx, &pos, &velocity, &accel, 100, 30, 7);
func_800B1280(play, &pos, &velocity, &accel, 100, 30, 7);
}
}
void func_800B1598(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) {
void func_800B1598(PlayState* play, f32 randScale, Vec3f* srcPos) {
s32 i;
Vec3f pos;
Vec3f velocity;
@@ -202,24 +200,24 @@ void func_800B1598(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) {
for (i = 0; i < 20; i++) {
func_800B13D8(srcPos, randScale, &pos, &velocity, &accel);
func_800B12F0(globalCtx, &pos, &velocity, &accel, 100, 30, 7);
func_800B12F0(play, &pos, &velocity, &accel, 100, 30, 7);
}
}
void EffectSsKirakira_SpawnSmallYellow(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
void EffectSsKirakira_SpawnSmallYellow(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
Color_RGBA8 primColor = { 255, 255, 200, 255 };
Color_RGBA8 envColor = { 255, 200, 0, 0 };
EffectSsKirakira_SpawnDispersed(globalCtx, pos, velocity, accel, &primColor, &envColor, 1000, 16);
EffectSsKirakira_SpawnDispersed(play, pos, velocity, accel, &primColor, &envColor, 1000, 16);
}
void EffectSsKirakira_SpawnSmall(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
Color_RGBA8* primColor, Color_RGBA8* envColor) {
EffectSsKirakira_SpawnDispersed(globalCtx, pos, velocity, accel, primColor, envColor, 1000, 16);
void EffectSsKirakira_SpawnSmall(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor) {
EffectSsKirakira_SpawnDispersed(play, pos, velocity, accel, primColor, envColor, 1000, 16);
}
void EffectSsKirakira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life) {
void EffectSsKirakira_SpawnDispersed(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s32 life) {
EffectSsKirakiraInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -236,11 +234,11 @@ void EffectSsKirakira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f
initParams.envColor = *envColor;
initParams.alphaStep = (-(255.0f / initParams.life)) + (-(255.0f / initParams.life));
EffectSs_Spawn(globalCtx, EFFECT_SS_KIRAKIRA, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_KIRAKIRA, 128, &initParams);
}
void EffectSsKirakira_SpawnFocused(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life) {
void EffectSsKirakira_SpawnFocused(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s32 life) {
EffectSsKirakiraInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -255,10 +253,10 @@ void EffectSsKirakira_SpawnFocused(GlobalContext* globalCtx, Vec3f* pos, Vec3f*
Color_RGBA8_Copy(&initParams.envColor, envColor);
initParams.alphaStep = (-(255.0f / initParams.life)) + (-(255.0f / initParams.life));
EffectSs_Spawn(globalCtx, EFFECT_SS_KIRAKIRA, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_KIRAKIRA, 128, &initParams);
}
void EffectSsBomb2_SpawnFade(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
void EffectSsBomb2_SpawnFade(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
EffectSsBomb2InitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -268,11 +266,10 @@ void EffectSsBomb2_SpawnFade(GlobalContext* globalCtx, Vec3f* pos, Vec3f* veloci
initParams.scaleStep = 0;
initParams.drawMode = 0;
EffectSs_Spawn(globalCtx, EFFECT_SS_BOMB2, 10, &initParams);
EffectSs_Spawn(play, EFFECT_SS_BOMB2, 10, &initParams);
}
void EffectSsBomb2_SpawnLayered(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale,
s16 scaleStep) {
void EffectSsBomb2_SpawnLayered(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) {
EffectSsBomb2InitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -282,12 +279,12 @@ void EffectSsBomb2_SpawnLayered(GlobalContext* globalCtx, Vec3f* pos, Vec3f* vel
initParams.scaleStep = scaleStep;
initParams.drawMode = 1;
EffectSs_Spawn(globalCtx, EFFECT_SS_BOMB2, 10, &initParams);
EffectSs_Spawn(play, EFFECT_SS_BOMB2, 10, &initParams);
}
// EffectSsBlast Spawn Functions
void EffectSsBlast_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void EffectSsBlast_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 sclaeStepDecay, s16 life) {
EffectSsBlastInitParams initParams;
@@ -301,32 +298,32 @@ void EffectSsBlast_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
initParams.sclaeStepDecay = sclaeStepDecay;
initParams.life = life;
EffectSs_Spawn(globalCtx, EFFECT_SS_BLAST, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_BLAST, 128, &initParams);
}
void EffectSsBlast_SpawnWhiteCustomScale(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale,
void EffectSsBlast_SpawnWhiteCustomScale(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale,
s16 scaleStep, s16 life) {
static Color_RGBA8 primColor = { 255, 255, 255, 255 };
static Color_RGBA8 envColor = { 200, 200, 200, 0 };
EffectSsBlast_Spawn(globalCtx, pos, velocity, accel, &primColor, &envColor, scale, scaleStep, 35, life);
EffectSsBlast_Spawn(play, pos, velocity, accel, &primColor, &envColor, scale, scaleStep, 35, life);
}
void EffectSsBlast_SpawnShockwave(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
Color_RGBA8* primColor, Color_RGBA8* envColor, s16 life) {
EffectSsBlast_Spawn(globalCtx, pos, velocity, accel, primColor, envColor, 100, 375, 35, life);
void EffectSsBlast_SpawnShockwave(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 life) {
EffectSsBlast_Spawn(play, pos, velocity, accel, primColor, envColor, 100, 375, 35, life);
}
void EffectSsBlast_SpawnWhiteShockwave(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
void EffectSsBlast_SpawnWhiteShockwave(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
static Color_RGBA8 primColor = { 255, 255, 255, 255 };
static Color_RGBA8 envColor = { 200, 200, 200, 0 };
EffectSsBlast_SpawnShockwave(globalCtx, pos, velocity, accel, &primColor, &envColor, 10);
EffectSsBlast_SpawnShockwave(play, pos, velocity, accel, &primColor, &envColor, 10);
}
// EffectSsGSpk Spawn Functions
void EffectSsGSpk_SpawnAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
void EffectSsGSpk_SpawnAccel(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) {
EffectSsGSpkInitParams initParams;
@@ -340,11 +337,11 @@ void EffectSsGSpk_SpawnAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* pos,
initParams.scaleStep = scaleStep;
initParams.updateMode = 0;
EffectSs_Spawn(globalCtx, EFFECT_SS_G_SPK, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_G_SPK, 128, &initParams);
}
// unused
void EffectSsGSpk_SpawnNoAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
void EffectSsGSpk_SpawnNoAccel(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep) {
EffectSsGSpkInitParams initParams;
@@ -358,19 +355,19 @@ void EffectSsGSpk_SpawnNoAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* po
initParams.scaleStep = scaleStep;
initParams.updateMode = 1;
EffectSs_Spawn(globalCtx, EFFECT_SS_G_SPK, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_G_SPK, 128, &initParams);
}
void EffectSsGSpk_SpawnFuse(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
void EffectSsGSpk_SpawnFuse(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
Color_RGBA8 primColor = { 255, 255, 150, 255 };
Color_RGBA8 envColor = { 255, 0, 0, 0 };
EffectSsGSpk_SpawnSmall(globalCtx, actor, pos, velocity, accel, &primColor, &envColor);
EffectSsGSpk_SpawnSmall(play, actor, pos, velocity, accel, &primColor, &envColor);
}
// unused
void EffectSsGSpk_SpawnRandColor(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
s16 scale, s16 scaleStep) {
void EffectSsGSpk_SpawnRandColor(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale,
s16 scaleStep) {
Color_RGBA8 primColor = { 255, 255, 150, 255 };
Color_RGBA8 envColor = { 255, 0, 0, 0 };
s32 randOffset = (Rand_ZeroOne() * 20.0f) - 10.0f;
@@ -384,16 +381,16 @@ void EffectSsGSpk_SpawnRandColor(GlobalContext* globalCtx, Actor* actor, Vec3f*
envColor.b += randOffset;
envColor.a += randOffset;
EffectSsGSpk_SpawnAccel(globalCtx, actor, pos, velocity, accel, &primColor, &envColor, scale, scaleStep);
EffectSsGSpk_SpawnAccel(play, actor, pos, velocity, accel, &primColor, &envColor, scale, scaleStep);
}
void EffectSsGSpk_SpawnSmall(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
void EffectSsGSpk_SpawnSmall(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
Color_RGBA8* primColor, Color_RGBA8* envColor) {
EffectSsGSpk_SpawnAccel(globalCtx, actor, pos, velocity, accel, primColor, envColor, 100, 5);
EffectSsGSpk_SpawnAccel(play, actor, pos, velocity, accel, primColor, envColor, 100, 5);
}
// EffectSsDFire Spawn Functions
void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
s16 alpha, s16 fadeDelay, s16 arg8, s32 life) {
EffectSsDFireInitParams initParams;
@@ -407,12 +404,12 @@ void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
initParams.unk_2C = arg8;
initParams.life = life;
EffectSs_Spawn(globalCtx, EFFECT_SS_D_FIRE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_D_FIRE, 128, &initParams);
}
// EffectSsBubble Spawn Functions
void EffectSsBubble_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale,
void EffectSsBubble_Spawn(PlayState* play, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale,
f32 scale) {
EffectSsBubbleInitParams initParams;
@@ -422,12 +419,12 @@ void EffectSsBubble_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 yPosOffset,
initParams.xzPosRandScale = xzPosRandScale;
initParams.scale = scale;
EffectSs_Spawn(globalCtx, EFFECT_SS_BUBBLE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_BUBBLE, 128, &initParams);
}
// EffectSsGRipple Spawn Functions
void EffectSsGRipple_Spawn(GlobalContext* globalCtx, Vec3f* pos, s16 radius, s16 radiusMax, s16 life) {
void EffectSsGRipple_Spawn(PlayState* play, Vec3f* pos, s16 radius, s16 radiusMax, s16 life) {
EffectSsGRippleInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -435,13 +432,13 @@ void EffectSsGRipple_Spawn(GlobalContext* globalCtx, Vec3f* pos, s16 radius, s16
initParams.radiusMax = radiusMax;
initParams.life = life;
EffectSs_Spawn(globalCtx, EFFECT_SS_G_RIPPLE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_G_RIPPLE, 128, &initParams);
}
// EffectSsGSplash Spawn Functions
void EffectSsGSplash_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor,
s16 type, s16 scale) {
void EffectSsGSplash_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type,
s16 scale) {
EffectSsGSplashInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -456,23 +453,23 @@ void EffectSsGSplash_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* pr
initParams.customColor = 0;
}
EffectSs_Spawn(globalCtx, EFFECT_SS_G_SPLASH, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_G_SPLASH, 128, &initParams);
}
// EffectSsGFire Spawn Functions
void EffectSsGFire_Spawn(GlobalContext* globalCtx, Vec3f* pos) {
void EffectSsGFire_Spawn(PlayState* play, Vec3f* pos) {
EffectSsGFireInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
EffectSs_Spawn(globalCtx, EFFECT_SS_G_FIRE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_G_FIRE, 128, &initParams);
}
// EffectSsLightning Spawn Functions
void EffectSsLightning_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor,
s16 scale, s16 yaw, s16 life, s16 numBolts) {
void EffectSsLightning_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale,
s16 yaw, s16 life, s16 numBolts) {
EffectSsLightningInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -483,13 +480,13 @@ void EffectSsLightning_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8*
initParams.life = life;
initParams.numBolts = numBolts;
EffectSs_Spawn(globalCtx, EFFECT_SS_LIGHTNING, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_LIGHTNING, 128, &initParams);
}
// EffectSsDtBubble Spawn Functions
void EffectSsDtBubble_SpawnColorProfile(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale,
s16 life, s16 colorProfile, s16 randXZ) {
void EffectSsDtBubble_SpawnColorProfile(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 life,
s16 colorProfile, s16 randXZ) {
EffectSsDtBubbleInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -501,10 +498,10 @@ void EffectSsDtBubble_SpawnColorProfile(GlobalContext* globalCtx, Vec3f* pos, Ve
initParams.life = life;
initParams.randXZ = randXZ;
EffectSs_Spawn(globalCtx, EFFECT_SS_DT_BUBBLE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_DT_BUBBLE, 128, &initParams);
}
void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
void EffectSsDtBubble_SpawnCustomColor(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 life, s16 randXZ) {
EffectSsDtBubbleInitParams initParams;
@@ -518,7 +515,7 @@ void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, Vec3f* pos, Vec
initParams.randXZ = randXZ;
initParams.customColor = 1;
EffectSs_Spawn(globalCtx, EFFECT_SS_DT_BUBBLE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_DT_BUBBLE, 128, &initParams);
}
// EffectSsHahen Spawn Functions
@@ -532,8 +529,8 @@ void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, Vec3f* pos, Vec
* - due to how life is implemented it is capped at 200. Any value over 200 is accepted, but the fragment will
* only live for 200 frames
*/
void EffectSsHahen_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16 scale,
s16 objId, s16 life, Gfx* dList) {
void EffectSsHahen_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16 scale, s16 objId,
s16 life, Gfx* dList) {
EffectSsHahenInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -545,7 +542,7 @@ void EffectSsHahen_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
initParams.objId = objId;
initParams.life = life;
EffectSs_Spawn(globalCtx, EFFECT_SS_HAHEN, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_HAHEN, 128, &initParams);
}
/**
@@ -557,8 +554,8 @@ void EffectSsHahen_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
* - due to how life is implemented it is capped at 200. Any value over 200 is accepted, but the fragment will
* only live for 200 frames
*/
void EffectSsHahen_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos, f32 burstScale, s16 unused, s16 scale,
s16 randScaleRange, s16 count, s16 objId, s16 life, Gfx* dList) {
void EffectSsHahen_SpawnBurst(PlayState* play, Vec3f* pos, f32 burstScale, s16 unused, s16 scale, s16 randScaleRange,
s16 count, s16 objId, s16 life, Gfx* dList) {
s32 i;
Vec3f velocity;
Vec3f accel;
@@ -571,15 +568,15 @@ void EffectSsHahen_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos, f32 burstSca
velocity.z = (Rand_ZeroOne() - 0.5f) * burstScale;
velocity.y = ((Rand_ZeroOne() * 0.5f) + 0.5f) * burstScale;
EffectSsHahen_Spawn(globalCtx, pos, &velocity, &accel, unused, Rand_S16Offset(scale, randScaleRange), objId,
life, dList);
EffectSsHahen_Spawn(play, pos, &velocity, &accel, unused, Rand_S16Offset(scale, randScaleRange), objId, life,
dList);
}
}
void func_800B2364(GlobalContext* globalCtx, Vec3f* pos, Gfx* dList) {
void func_800B2364(PlayState* play, Vec3f* pos, Gfx* dList) {
Vec3f accel = { 0.0f, -2.0f, 0.0f };
EffectSsHahen_Spawn(globalCtx, pos, &gZeroVec3f, &accel, 1, 5, 1, 10, dList);
EffectSsHahen_Spawn(play, pos, &gZeroVec3f, &accel, 1, 5, 1, 10, dList);
}
// EffectSsStick Spawn Functions
@@ -588,19 +585,19 @@ void func_800B2364(GlobalContext* globalCtx, Vec3f* pos, Gfx* dList) {
* As child, spawn a broken stick fragment
* As adult, spawn a broken sword fragment
*/
void EffectSsStick_Spawn(GlobalContext* globalCtx, Vec3f* pos, s16 yaw) {
void EffectSsStick_Spawn(PlayState* play, Vec3f* pos, s16 yaw) {
EffectSsStickInitParams initParams;
initParams.pos = *pos;
initParams.yaw = yaw;
EffectSs_Spawn(globalCtx, EFFECT_SS_STICK, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_STICK, 128, &initParams);
}
// EffectSsSibuki Spawn Functions
void EffectSsSibuki_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 moveDelay,
s16 direction, s16 scale) {
void EffectSsSibuki_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 moveDelay, s16 direction,
s16 scale) {
EffectSsSibukiInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -610,48 +607,48 @@ void EffectSsSibuki_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
initParams.direction = direction;
initParams.scale = scale;
EffectSs_Spawn(globalCtx, EFFECT_SS_SIBUKI, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_SIBUKI, 128, &initParams);
}
void EffectSsSibuki_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos) {
void EffectSsSibuki_SpawnBurst(PlayState* play, Vec3f* pos) {
s16 i;
Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
s16 randDirection = Rand_ZeroOne() * 1.99f;
for (i = 0; i < KREG(19) + 30; i++) {
EffectSsSibuki_Spawn(globalCtx, pos, &zeroVec, &zeroVec, i / (KREG(27) + 6), randDirection, KREG(18) + 40);
EffectSsSibuki_Spawn(play, pos, &zeroVec, &zeroVec, i / (KREG(27) + 6), randDirection, KREG(18) + 40);
}
}
// EffectSsStone1 Spawn Functions
void EffectSsStone1_Spawn(GlobalContext* globalCtx, Vec3f* pos, s32 reg0) {
void EffectSsStone1_Spawn(PlayState* play, Vec3f* pos, s32 reg0) {
EffectSsStone1InitParams initParams;
initParams.pos = *pos;
initParams.reg0 = reg0;
EffectSs_Spawn(globalCtx, EFFECT_SS_STONE1, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_STONE1, 128, &initParams);
}
// EffectSsHitMark Spawn Functions
void EffectSsHitMark_Spawn(GlobalContext* globalCtx, s32 type, s16 scale, Vec3f* pos) {
void EffectSsHitMark_Spawn(PlayState* play, s32 type, s16 scale, Vec3f* pos) {
EffectSsHitMarkInitParams initParams;
initParams.type = type;
initParams.scale = scale;
Math_Vec3f_Copy(&initParams.pos, pos);
EffectSs_Spawn(globalCtx, EFFECT_SS_HITMARK, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_HITMARK, 128, &initParams);
}
void EffectSsHitMark_SpawnFixedScale(GlobalContext* globalCtx, s32 type, Vec3f* pos) {
EffectSsHitMark_Spawn(globalCtx, type, 300, pos);
void EffectSsHitMark_SpawnFixedScale(PlayState* play, s32 type, Vec3f* pos) {
EffectSsHitMark_Spawn(play, type, 300, pos);
}
void EffectSsHitMark_SpawnCustomScale(GlobalContext* globalCtx, s32 type, s16 scale, Vec3f* pos) {
EffectSsHitMark_Spawn(globalCtx, type, scale, pos);
void EffectSsHitMark_SpawnCustomScale(PlayState* play, s32 type, s16 scale, Vec3f* pos) {
EffectSsHitMark_Spawn(play, type, scale, pos);
}
// EffectSsFhgFlash Spawn Functions
@@ -664,7 +661,7 @@ void EffectSsHitMark_SpawnCustomScale(GlobalContext* globalCtx, s32 type, s16 sc
* 1: spawn at one of Player's body parts, chosen at random
* 2: spawn at one of Phantom Ganon's body parts, chosen at random
*/
void EffectSsFhgFlash_SpawnShock(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 scale, u8 param) {
void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 param) {
EffectSsFhgFlashInitParams initParams;
initParams.actor = actor;
@@ -673,12 +670,12 @@ void EffectSsFhgFlash_SpawnShock(GlobalContext* globalCtx, Actor* actor, Vec3f*
initParams.param = param;
initParams.type = FHGFLASH_SHOCK;
EffectSs_Spawn(globalCtx, EFFECT_SS_FHG_FLASH, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_FHG_FLASH, 128, &initParams);
}
// EffectSsKFire Spawn Functions
void EffectSsKFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scaleMax, u8 type) {
void EffectSsKFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scaleMax, u8 type) {
EffectSsKFireInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -687,12 +684,12 @@ void EffectSsKFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
initParams.scaleMax = scaleMax;
initParams.type = type;
EffectSs_Spawn(globalCtx, EFFECT_SS_K_FIRE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_K_FIRE, 128, &initParams);
}
// EffectSsSolderSrchBall Spawn Functions
void EffectSsSolderSrchBall_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused,
void EffectSsSolderSrchBall_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused,
s16* linkDetected, s16 drawFlag) {
EffectSsSolderSrchBallInitParams initParams;
@@ -703,14 +700,14 @@ void EffectSsSolderSrchBall_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* v
initParams.linkDetected = linkDetected;
initParams.drawFlag = drawFlag;
EffectSs_Spawn(globalCtx, EFFECT_SS_SOLDER_SRCH_BALL, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_SOLDER_SRCH_BALL, 128, &initParams);
}
// EffectSsKakera Spawn Functions
void EffectSsKakera_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5,
s16 arg6, s16 arg7, s16 arg8, s16 scale, s16 arg10, s16 arg11, s32 life, s16 colorIdx,
s16 objId, Gfx* dList) {
void EffectSsKakera_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, s16 arg6,
s16 arg7, s16 arg8, s16 scale, s16 arg10, s16 arg11, s32 life, s16 colorIdx, s16 objId,
Gfx* dList) {
EffectSsKakeraInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -729,12 +726,12 @@ void EffectSsKakera_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
initParams.objId = objId;
initParams.dList = dList;
EffectSs_Spawn(globalCtx, EFFECT_SS_KAKERA, 101, &initParams);
EffectSs_Spawn(play, EFFECT_SS_KAKERA, 101, &initParams);
}
// EffectSsIcePiece Spawn Functions
void EffectSsIcePiece_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, s32 life) {
void EffectSsIcePiece_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, s32 life) {
EffectSsIcePieceInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -742,10 +739,10 @@ void EffectSsIcePiece_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec
Math_Vec3f_Copy(&initParams.accel, accel);
initParams.scale = scale;
initParams.life = life;
EffectSs_Spawn(globalCtx, EFFECT_SS_ICE_PIECE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_ICE_PIECE, 128, &initParams);
}
void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 scale) {
void EffectSsIcePiece_SpawnBurst(PlayState* play, Vec3f* refPos, f32 scale) {
static Vec3f accel = { 0.0f, 0.0f, 0.0f };
static Vec3f vecScales[] = {
{ 0.0f, 70.0f, 0.0f },
@@ -776,15 +773,15 @@ void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 sc
pos.y += vecScales[i].y;
pos.z += vecScales[i].z;
EffectSsIcePiece_Spawn(globalCtx, &pos, (Rand_ZeroFloat(1.0f) + 0.5f) * ((scale * 1.3f) * 100.0f), &velocity,
&accel, 25);
EffectSsIcePiece_Spawn(play, &pos, (Rand_ZeroFloat(1.0f) + 0.5f) * ((scale * 1.3f) * 100.0f), &velocity, &accel,
25);
}
}
// EffectSsEnIce Spawn Functions
void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Color_RGBA8* prim,
Color_RGBA8* env, f32 scale) {
void EffectSsEnIce_SpawnFlyingVec3f(PlayState* play, Actor* actor, Vec3f* pos, Color_RGBA8* prim, Color_RGBA8* env,
f32 scale) {
EffectSsEnIceInitParams initParams;
initParams.actor = actor;
@@ -798,25 +795,25 @@ void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3
Actor_PlaySfxAtPos(actor, NA_SE_PL_FREEZE_S);
}
EffectSs_Spawn(globalCtx, EFFECT_SS_EN_ICE, 80, &initParams);
EffectSs_Spawn(play, EFFECT_SS_EN_ICE, 80, &initParams);
}
void func_800B2B44(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 scale) {
void func_800B2B44(PlayState* play, Actor* actor, Vec3f* pos, f32 scale) {
static Color_RGBA8 primColor = { 150, 150, 150, 250 };
static Color_RGBA8 envColor = { 235, 245, 255, 255 };
EffectSsEnIce_SpawnFlyingVec3f(globalCtx, actor, pos, &primColor, &envColor, scale);
EffectSsEnIce_SpawnFlyingVec3f(play, actor, pos, &primColor, &envColor, scale);
}
void func_800B2B7C(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, f32 scale) {
void func_800B2B7C(PlayState* play, Actor* actor, Vec3s* arg2, f32 scale) {
Vec3f dest;
Math_Vec3s_ToVec3f(&dest, arg2);
func_800B2B44(globalCtx, actor, &dest, scale);
func_800B2B44(play, actor, &dest, scale);
}
void EffectSsEnIce_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel,
Color_RGBA8* primColor, Color_RGBA8* envColor, s32 life) {
void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s32 life) {
EffectSsEnIceInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -828,12 +825,12 @@ void EffectSsEnIce_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f*
initParams.life = life;
initParams.type = 1;
EffectSs_Spawn(globalCtx, EFFECT_SS_EN_ICE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_EN_ICE, 128, &initParams);
}
// EffectSsFireTail Spawn Functions
void EffectSsFireTail_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 scale, Vec3f* arg4, s16 arg5,
void EffectSsFireTail_Spawn(PlayState* play, Actor* actor, Vec3f* pos, f32 scale, Vec3f* arg4, s16 arg5,
Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, s16 bodyPart, s32 life) {
EffectSsFireTailInitParams initParams;
@@ -848,10 +845,10 @@ void EffectSsFireTail_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos,
initParams.bodyPart = bodyPart;
initParams.life = life;
EffectSs_Spawn(globalCtx, EFFECT_SS_FIRE_TAIL, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_FIRE_TAIL, 128, &initParams);
}
void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart,
void EffectSsFireTail_SpawnFlame(PlayState* play, Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart,
f32 colorIntensity) {
static Color_RGBA8 primColor = { 255, 255, 0, 255 };
static Color_RGBA8 envColor = { 255, 0, 0, 255 };
@@ -863,20 +860,19 @@ void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f*
envColor.b = 0;
primColor.r = envColor.r = (s32)(255.0f * colorIntensity);
EffectSsFireTail_Spawn(globalCtx, actor, pos, arg3, &actor->velocity, 15, &primColor, &envColor,
EffectSsFireTail_Spawn(play, actor, pos, arg3, &actor->velocity, 15, &primColor, &envColor,
(colorIntensity == 1.0f) ? 0 : 1, bodyPart, 1);
}
void EffectSsFireTail_SpawnFlameOnPlayer(GlobalContext* globalCtx, f32 scale, s16 bodyPart, f32 colorIntensity) {
Player* player = GET_PLAYER(globalCtx);
void EffectSsFireTail_SpawnFlameOnPlayer(PlayState* play, f32 scale, s16 bodyPart, f32 colorIntensity) {
Player* player = GET_PLAYER(play);
EffectSsFireTail_SpawnFlame(globalCtx, &player->actor, &player->bodyPartsPos[bodyPart], scale, bodyPart,
colorIntensity);
EffectSsFireTail_SpawnFlame(play, &player->actor, &player->bodyPartsPos[bodyPart], scale, bodyPart, colorIntensity);
}
// EffectSsEnFire Spawn Functions
void EffectSsEnFire_SpawnVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags,
void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags,
s16 bodyPart) {
EffectSsEnFireInitParams initParams;
@@ -891,10 +887,10 @@ void EffectSsEnFire_SpawnVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* po
Actor_PlaySfxAtPos(actor, NA_SE_EV_FLAME_IGNITION);
}
EffectSs_Spawn(globalCtx, EFFECT_SS_EN_FIRE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_EN_FIRE, 128, &initParams);
}
void EffectSsEnFire_SpawnVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* pos, s16 scale, s16 arg4, s16 flags,
void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 scale, s16 arg4, s16 flags,
s16 bodyPart) {
EffectSsEnFireInitParams initParams;
@@ -911,12 +907,12 @@ void EffectSsEnFire_SpawnVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* po
Actor_PlaySfxAtPos(actor, NA_SE_EV_FLAME_IGNITION);
}
EffectSs_Spawn(globalCtx, EFFECT_SS_EN_FIRE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_EN_FIRE, 128, &initParams);
}
// EffectSsExtra Spawn Functions
void EffectSsExtra_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx) {
void EffectSsExtra_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx) {
EffectSsExtraInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -925,12 +921,12 @@ void EffectSsExtra_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
initParams.scale = scale;
initParams.scoreIdx = scoreIdx;
EffectSs_Spawn(globalCtx, EFFECT_SS_EXTRA, 100, &initParams);
EffectSs_Spawn(play, EFFECT_SS_EXTRA, 100, &initParams);
}
// EffectSsDeadDb Spawn Functions
void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim,
void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim,
Color_RGBA8* env, s16 scale, s16 scaleStep, s32 unk) {
EffectSsDeadDbInitParams initParams;
@@ -948,10 +944,10 @@ void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
initParams.envColor.b = env->b;
initParams.unk_30 = unk;
EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DB, 120, &initParams);
EffectSs_Spawn(play, EFFECT_SS_DEAD_DB, 120, &initParams);
}
void func_800B3030(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
void func_800B3030(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
s32 colorIndex) {
static Color_RGBA8 primColor = { 255, 255, 255, 255 };
static Color_RGBA8 envColors[] = {
@@ -961,12 +957,12 @@ void func_800B3030(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f*
{ 150, 150, 150, 255 },
};
EffectSsDeadDb_Spawn(globalCtx, pos, velocity, accel, &primColor, &envColors[colorIndex], scale, scaleStep, 9);
EffectSsDeadDb_Spawn(play, pos, velocity, accel, &primColor, &envColors[colorIndex], scale, scaleStep, 9);
}
// EffectSsDeadDd Spawn Functions
void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim,
void EffectSsDeadDd_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim,
Color_RGBA8* env, s16 scale, s16 scaleStep, s16 alphaStep, s32 life) {
EffectSsDeadDdInitParams initParams;
@@ -986,12 +982,12 @@ void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
initParams.alphaStep = alphaStep;
initParams.life = life;
EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DD, 120, &initParams);
EffectSs_Spawn(play, EFFECT_SS_DEAD_DD, 120, &initParams);
}
// EffectSsDeadDs Spawn Functions
void EffectSsDeadDs_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
void EffectSsDeadDs_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
s16 alpha, s32 life) {
EffectSsDeadDsInitParams initParams;
@@ -1002,16 +998,16 @@ void EffectSsDeadDs_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
initParams.scaleStep = scaleStep;
initParams.alpha = alpha;
initParams.life = life;
EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DS, 100, &initParams);
EffectSs_Spawn(play, EFFECT_SS_DEAD_DS, 100, &initParams);
}
void func_800B31BC(GlobalContext* globalCtx, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, s32 life) {
EffectSsDeadDs_Spawn(globalCtx, pos, &gZeroVec3f, &gZeroVec3f, scale, scaleStep, alpha, life);
void func_800B31BC(PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, s32 life) {
EffectSsDeadDs_Spawn(play, pos, &gZeroVec3f, &gZeroVec3f, scale, scaleStep, alpha, life);
}
// EffectSsIceSmoke Spawn Functions
void EffectSsIceSmoke_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) {
void EffectSsIceSmoke_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) {
EffectSsIceSmokeInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -1019,12 +1015,12 @@ void EffectSsIceSmoke_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocit
Math_Vec3f_Copy(&initParams.accel, accel);
initParams.scale = scale;
EffectSs_Spawn(globalCtx, EFFECT_SS_ICE_SMOKE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_ICE_SMOKE, 128, &initParams);
}
// EffectSsIceBlock Spawn Functions
void EffectSsIceBlock_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) {
void EffectSsIceBlock_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) {
EffectEnIceBlockInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -1032,5 +1028,5 @@ void EffectSsIceBlock_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocit
Math_Vec3f_Copy(&initParams.accel, accel);
initParams.scale = scale;
EffectSs_Spawn(globalCtx, EFFECT_EN_ICE_BLOCK, 128, &initParams);
EffectSs_Spawn(play, EFFECT_EN_ICE_BLOCK, 128, &initParams);
}
+3 -3
View File
@@ -1,6 +1,6 @@
#include "global.h"
u16 ElfMessage_GetFirstCycleHint(GlobalContext* globalCtx) {
u16 ElfMessage_GetFirstCycleHint(PlayState* play) {
if (INV_CONTENT(ITEM_OCARINA) == ITEM_OCARINA) {
return 0;
}
@@ -20,7 +20,7 @@ u16 ElfMessage_GetFirstCycleHint(GlobalContext* globalCtx) {
if (gSaveContext.save.weekEventReg[9] & 1) {
return 0x21E;
}
if (globalCtx->sceneNum == SCENE_YOUSEI_IZUMI) {
if (play->sceneNum == SCENE_YOUSEI_IZUMI) {
return 0;
}
return 0x21D;
@@ -29,7 +29,7 @@ u16 ElfMessage_GetFirstCycleHint(GlobalContext* globalCtx) {
return 0x21F;
}
if (INV_CONTENT(ITEM_DEED_LAND) == ITEM_DEED_LAND) {
if (globalCtx->sceneNum != SCENE_OKUJOU) {
if (play->sceneNum != SCENE_OKUJOU) {
return 0x244;
}
return 0;
+16 -16
View File
@@ -2,56 +2,56 @@
#define THIS ((EnAObj*)thisx)
void EnAObj_Update1(EnAObj* this, GlobalContext* globalCtx);
void EnAObj_Update2(EnAObj* this, GlobalContext* globalCtx);
void EnAObj_Update1(EnAObj* this, PlayState* play);
void EnAObj_Update2(EnAObj* this, PlayState* play);
void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnAObj_Init(Actor* thisx, PlayState* play) {
EnAObj* this = THIS;
this->actor.textId = ((this->actor.params >> 8) & 0xFF) | 0x300;
this->actor.params = (this->actor.params & 0xFF) - 9;
Actor_ProcessInitChain(&this->actor, &enAObjInitVar);
ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 12);
Collider_InitAndSetCylinder(globalCtx, &this->collision, &this->actor, &enAObjCylinderInit);
Collider_InitAndSetCylinder(play, &this->collision, &this->actor, &enAObjCylinderInit);
Collider_UpdateCylinder(&this->actor, &this->collision);
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
this->actionFunc = EnAObj_Update1;
}
void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnAObj_Destroy(Actor* thisx, PlayState* play) {
EnAObj* this = THIS;
Collider_DestroyCylinder(globalCtx, &this->collision);
Collider_DestroyCylinder(play, &this->collision);
}
void EnAObj_Update1(EnAObj* this, GlobalContext* globalCtx) {
void EnAObj_Update1(EnAObj* this, PlayState* play) {
s32 yawDiff;
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) {
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
this->actionFunc = EnAObj_Update2;
} else {
yawDiff = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y));
if ((yawDiff < 0x2800) || ((this->actor.params == 1) && (yawDiff > 0x5800))) {
func_800B863C(&this->actor, globalCtx);
func_800B863C(&this->actor, play);
}
}
}
void EnAObj_Update2(EnAObj* this, GlobalContext* globalCtx) {
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
void EnAObj_Update2(EnAObj* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
this->actionFunc = EnAObj_Update1;
}
}
void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnAObj_Update(Actor* thisx, PlayState* play) {
EnAObj* this = THIS;
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
Actor_SetFocus(&this->actor, 45.0f);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collision.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collision.base);
}
void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx) {
Gfx_DrawDListOpa(globalCtx, enAObjDisplayLists[thisx->params]);
void EnAObj_Draw(Actor* thisx, PlayState* play) {
Gfx_DrawDListOpa(play, enAObjDisplayLists[thisx->params]);
}
+34 -34
View File
@@ -58,7 +58,7 @@ s32 EnHy_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) {
return isChanged;
}
EnDoor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx) {
EnDoor* EnHy_FindNearestDoor(Actor* actor, PlayState* play) {
EnDoor* nearestDoor = NULL;
Actor* doorIter = NULL;
f32 dist;
@@ -67,7 +67,7 @@ EnDoor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx) {
f32 minDist = 0.0f;
do {
doorIter = SubS_FindActor(globalCtx, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR);
doorIter = SubS_FindActor(play, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR);
door = (EnDoor*)doorIter;
dist = Actor_DistanceBetweenActors(actor, &door->dyna.actor);
if (!isSetup || (dist < minDist)) {
@@ -83,16 +83,16 @@ EnDoor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx) {
return nearestDoor;
}
void EnHy_ChangeObjectAndAnim(EnHy* enHy, GlobalContext* globalCtx, s16 animIndex) {
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[enHy->animObjIndex].segment);
void EnHy_ChangeObjectAndAnim(EnHy* enHy, PlayState* play, s16 animIndex) {
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[enHy->animObjIndex].segment);
EnHy_ChangeAnim(&enHy->skelAnime, animIndex);
}
s32 EnHy_UpdateSkelAnime(EnHy* enHy, GlobalContext* globalCtx) {
s32 EnHy_UpdateSkelAnime(EnHy* enHy, PlayState* play) {
s32 isUpdated = false;
if (enHy->actor.draw != NULL) {
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[enHy->animObjIndex].segment);
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[enHy->animObjIndex].segment);
SkelAnime_Update(&enHy->skelAnime);
isUpdated = true;
}
@@ -109,26 +109,26 @@ void EnHy_Blink(EnHy* enHy, s32 eyeTexMaxIndex) {
}
}
s32 EnHy_Init(EnHy* enHy, GlobalContext* globalCtx, FlexSkeletonHeader* skeletonHeaderSeg, s16 animIndex) {
s32 EnHy_Init(EnHy* enHy, PlayState* play, FlexSkeletonHeader* skeletonHeaderSeg, s16 animIndex) {
s32 isInitialized = false;
if ((SubS_IsObjectLoaded(enHy->animObjIndex, globalCtx) == true) &&
(SubS_IsObjectLoaded(enHy->headObjIndex, globalCtx) == true) &&
(SubS_IsObjectLoaded(enHy->skelUpperObjIndex, globalCtx) == true) &&
(SubS_IsObjectLoaded(enHy->skelLowerObjIndex, globalCtx) == true)) {
if ((SubS_IsObjectLoaded(enHy->animObjIndex, play) == true) &&
(SubS_IsObjectLoaded(enHy->headObjIndex, play) == true) &&
(SubS_IsObjectLoaded(enHy->skelUpperObjIndex, play) == true) &&
(SubS_IsObjectLoaded(enHy->skelLowerObjIndex, play) == true)) {
enHy->actor.objBankIndex = enHy->skelLowerObjIndex;
isInitialized = true;
ActorShape_Init(&enHy->actor.shape, 0.0f, NULL, 0.0f);
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[enHy->actor.objBankIndex].segment);
SkelAnime_InitFlex(globalCtx, &enHy->skelAnime, skeletonHeaderSeg, NULL, enHy->jointTable, enHy->morphTable,
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[enHy->actor.objBankIndex].segment);
SkelAnime_InitFlex(play, &enHy->skelAnime, skeletonHeaderSeg, NULL, enHy->jointTable, enHy->morphTable,
ENHY_LIMB_MAX);
EnHy_ChangeObjectAndAnim(enHy, globalCtx, animIndex);
EnHy_ChangeObjectAndAnim(enHy, play, animIndex);
}
return isInitialized;
}
void func_800F0BB4(EnHy* enHy, GlobalContext* globalCtx, EnDoor* door, s16 arg3, s16 arg4) {
void func_800F0BB4(EnHy* enHy, PlayState* play, EnDoor* door, s16 arg3, s16 arg4) {
s32 pad;
s8 animIndex;
Vec3f offset;
@@ -137,26 +137,26 @@ void func_800F0BB4(EnHy* enHy, GlobalContext* globalCtx, EnDoor* door, s16 arg3,
Actor_OffsetOfPointInActorCoords(&door->dyna.actor, &offset, &enHy->actor.world.pos);
phi_f0 = (offset.z >= 0.0f) ? 1.0f : -1.0f;
animIndex = ((s8)phi_f0 < 0) ? 0 : 2;
EnHy_ChangeObjectAndAnim(enHy, globalCtx, (animIndex == 0) ? arg3 : arg4);
EnHy_ChangeObjectAndAnim(enHy, play, (animIndex == 0) ? arg3 : arg4);
enHy->skelAnime.baseTransl = *enHy->skelAnime.jointTable;
enHy->skelAnime.prevTransl = *enHy->skelAnime.jointTable;
enHy->skelAnime.moveFlags |= 3;
AnimationContext_SetMoveActor(globalCtx, &enHy->actor, &enHy->skelAnime, 1.0f);
AnimationContext_SetMoveActor(play, &enHy->actor, &enHy->skelAnime, 1.0f);
door->unk_1A1 = 1;
door->animIndex = animIndex;
}
s32 func_800F0CE4(EnHy* enHy, GlobalContext* globalCtx, ActorFunc draw, s16 arg3, s16 arg4, f32 arg5) {
s32 func_800F0CE4(EnHy* enHy, PlayState* play, ActorFunc draw, s16 arg3, s16 arg4, f32 arg5) {
s32 ret = false;
s16 yaw;
EnDoor* door;
s32 pad;
if (SubS_CopyPointFromPath(enHy->path, enHy->curPoint, &enHy->actor.world.pos)) {
door = EnHy_FindNearestDoor(&enHy->actor, globalCtx);
door = EnHy_FindNearestDoor(&enHy->actor, play);
if (door != NULL) {
ret = true;
func_800F0BB4(enHy, globalCtx, door, arg3, arg4);
func_800F0BB4(enHy, play, door, arg3, arg4);
yaw = Math_Vec3f_Yaw(&enHy->actor.world.pos, &door->dyna.actor.world.pos);
enHy->actor.world.pos.x += arg5 * Math_SinS(yaw);
enHy->actor.world.pos.z += arg5 * Math_CosS(yaw);
@@ -168,17 +168,17 @@ s32 func_800F0CE4(EnHy* enHy, GlobalContext* globalCtx, ActorFunc draw, s16 arg3
return ret;
}
s32 func_800F0DD4(EnHy* enHy, GlobalContext* globalCtx, s16 arg2, s16 arg3) {
s32 func_800F0DD4(EnHy* enHy, PlayState* play, s16 arg2, s16 arg3) {
s32 ret = false;
s32 pad;
EnDoor* door;
enHy->curPoint = 0;
if (SubS_CopyPointFromPath(enHy->path, enHy->curPoint, &enHy->actor.world.pos)) {
door = EnHy_FindNearestDoor(&enHy->actor, globalCtx);
door = EnHy_FindNearestDoor(&enHy->actor, play);
if (door != NULL) {
ret = true;
func_800F0BB4(enHy, globalCtx, door, arg2, arg3);
func_800F0BB4(enHy, play, door, arg2, arg3);
enHy->actor.shape.rot.y = Math_Vec3f_Yaw(&enHy->actor.world.pos, &door->dyna.actor.world.pos);
enHy->actor.world.rot.y = enHy->actor.shape.rot.y;
enHy->actor.gravity = 0.0f;
@@ -188,16 +188,16 @@ s32 func_800F0DD4(EnHy* enHy, GlobalContext* globalCtx, s16 arg2, s16 arg3) {
return ret;
}
s32 EnHy_SetPointFowards(EnHy* enHy, GlobalContext* globalCtx, f32 gravity, s16 animIndex) {
s32 EnHy_SetPointFowards(EnHy* enHy, PlayState* play, f32 gravity, s16 animIndex) {
enHy->actor.gravity = gravity;
enHy->actor.flags |= ACTOR_FLAG_1;
EnHy_ChangeObjectAndAnim(enHy, globalCtx, animIndex);
EnHy_ChangeObjectAndAnim(enHy, play, animIndex);
enHy->curPoint++;
return false;
}
s32 EnHy_SetPointBackwards(EnHy* enHy, GlobalContext* globalCtx, s16 animIndex) {
EnHy_ChangeObjectAndAnim(enHy, globalCtx, animIndex);
s32 EnHy_SetPointBackwards(EnHy* enHy, PlayState* play, s16 animIndex) {
EnHy_ChangeObjectAndAnim(enHy, play, animIndex);
enHy->curPoint--;
return false;
}
@@ -238,16 +238,16 @@ s32 EnHy_MoveBackwards(EnHy* enHy, f32 speedTarget) {
return reachedEnd;
}
void EnHy_UpdateCollider(EnHy* enHy, GlobalContext* globalCtx) {
void EnHy_UpdateCollider(EnHy* enHy, PlayState* play) {
enHy->collider.dim.pos.x = enHy->actor.world.pos.x;
enHy->collider.dim.pos.y = enHy->actor.world.pos.y;
enHy->collider.dim.pos.z = enHy->actor.world.pos.z;
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &enHy->collider.base);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &enHy->collider.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &enHy->collider.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &enHy->collider.base);
}
s32 EnHy_PlayWalkingSound(EnHy* enHy, GlobalContext* globalCtx, f32 distAboveThreshold) {
s32 EnHy_PlayWalkingSound(EnHy* enHy, PlayState* play, f32 distAboveThreshold) {
u8 wasLeftFootOnGround = enHy->isLeftFootOnGround;
u8 wasRightFootOnGround = enHy->isRightFootOnGround;
s32 waterSfxId;
@@ -262,15 +262,15 @@ s32 EnHy_PlayWalkingSound(EnHy* enHy, GlobalContext* globalCtx, f32 distAboveThr
}
sfxId = waterSfxId + SFX_FLAG;
} else {
sfxId = SurfaceType_GetSfx(&globalCtx->colCtx, enHy->actor.floorPoly, enHy->actor.floorBgId) + SFX_FLAG;
sfxId = SurfaceType_GetSfx(&play->colCtx, enHy->actor.floorPoly, enHy->actor.floorBgId) + SFX_FLAG;
}
enHy->isLeftFootOnGround = isFootOnGround = SubS_IsFloorAbove(globalCtx, &enHy->leftFootPos, distAboveThreshold);
enHy->isLeftFootOnGround = isFootOnGround = SubS_IsFloorAbove(play, &enHy->leftFootPos, distAboveThreshold);
if (enHy->isLeftFootOnGround && !wasLeftFootOnGround && isFootOnGround) {
Actor_PlaySfxAtPos(&enHy->actor, sfxId);
}
enHy->isRightFootOnGround = isFootOnGround = SubS_IsFloorAbove(globalCtx, &enHy->rightFootPos, distAboveThreshold);
enHy->isRightFootOnGround = isFootOnGround = SubS_IsFloorAbove(play, &enHy->rightFootPos, distAboveThreshold);
if (enHy->isRightFootOnGround && !wasRightFootOnGround && isFootOnGround) {
Actor_PlaySfxAtPos(&enHy->actor, sfxId);
}
+152 -154
View File
@@ -6,16 +6,16 @@
#define THIS ((EnItem00*)thisx)
void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx);
void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx);
void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnItem00_Init(Actor* thisx, PlayState* play);
void EnItem00_Destroy(Actor* thisx, PlayState* play);
void EnItem00_Update(Actor* thisx, PlayState* play);
void EnItem00_Draw(Actor* thisx, PlayState* play);
void EnItem00_WaitForHeartObject(EnItem00* this, GlobalContext* globalCtx);
void func_800A640C(EnItem00* this, GlobalContext* globalCtx);
void func_800A6650(EnItem00* this, GlobalContext* globalCtx);
void func_800A6780(EnItem00* this, GlobalContext* globalCtx);
void func_800A6A40(EnItem00* this, GlobalContext* globalCtx);
void EnItem00_WaitForHeartObject(EnItem00* this, PlayState* play);
void func_800A640C(EnItem00* this, PlayState* play);
void func_800A6650(EnItem00* this, PlayState* play);
void func_800A6780(EnItem00* this, PlayState* play);
void func_800A6A40(EnItem00* this, PlayState* play);
const ActorInit En_Item00_InitVars = {
ACTOR_EN_ITEM00,
@@ -53,8 +53,8 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP),
};
void EnItem00_SetObject(EnItem00* this, GlobalContext* globalCtx, f32* shadowOffset, f32* shadowScale) {
Actor_SetObjectDependency(globalCtx, &this->actor);
void EnItem00_SetObject(EnItem00* this, PlayState* play, f32* shadowOffset, f32* shadowScale) {
Actor_SetObjectDependency(play, &this->actor);
Actor_SetScale(&this->actor, 0.5f);
this->unk154 = 0.5f;
*shadowOffset = 0.0f;
@@ -62,7 +62,7 @@ void EnItem00_SetObject(EnItem00* this, GlobalContext* globalCtx, f32* shadowOff
this->actor.world.rot.x = 0x4000;
}
void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnItem00_Init(Actor* thisx, PlayState* play) {
EnItem00* this = THIS;
s32 pad;
f32 shadowOffset = 980.0f;
@@ -74,7 +74,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
thisx->params &= 0xFF; // Has to be thisx to match
if (Flags_GetCollectible(globalCtx, this->collectibleFlag)) {
if (Flags_GetCollectible(play, this->collectibleFlag)) {
if (this->actor.params == ITEM00_HEART_PIECE) {
sp30 = 0;
this->collectibleFlag = 0;
@@ -89,7 +89,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
}
Actor_ProcessInitChain(&this->actor, sInitChain);
Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->unk150 = 1;
@@ -164,16 +164,16 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
this->unk154 = 0.01f;
break;
case ITEM00_SHIELD_HERO:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_2);
EnItem00_SetObject(this, globalCtx, &shadowOffset, &shadowScale);
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_2);
EnItem00_SetObject(this, play, &shadowOffset, &shadowScale);
break;
case ITEM00_MAP:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_MAP);
EnItem00_SetObject(this, globalCtx, &shadowOffset, &shadowScale);
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_MAP);
EnItem00_SetObject(this, play, &shadowOffset, &shadowScale);
break;
case ITEM00_COMPASS:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_COMPASS);
EnItem00_SetObject(this, globalCtx, &shadowOffset, &shadowScale);
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_COMPASS);
EnItem00_SetObject(this, play, &shadowOffset, &shadowScale);
break;
default:
break;
@@ -205,51 +205,51 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
switch (this->actor.params) {
case ITEM00_RUPEE_GREEN:
Item_Give(globalCtx, ITEM_RUPEE_GREEN);
Item_Give(play, ITEM_RUPEE_GREEN);
break;
case ITEM00_RUPEE_BLUE:
Item_Give(globalCtx, ITEM_RUPEE_BLUE);
Item_Give(play, ITEM_RUPEE_BLUE);
break;
case ITEM00_RUPEE_RED:
Item_Give(globalCtx, ITEM_RUPEE_RED);
Item_Give(play, ITEM_RUPEE_RED);
break;
case ITEM00_RUPEE_PURPLE:
Item_Give(globalCtx, ITEM_RUPEE_PURPLE);
Item_Give(play, ITEM_RUPEE_PURPLE);
break;
case ITEM00_RUPEE_HUGE:
Item_Give(globalCtx, ITEM_RUPEE_HUGE);
Item_Give(play, ITEM_RUPEE_HUGE);
break;
case ITEM00_HEART:
Item_Give(globalCtx, ITEM_HEART);
Item_Give(play, ITEM_HEART);
break;
case ITEM00_FLEXIBLE:
case ITEM00_BIG_FAIRY:
func_80115908(globalCtx, 0x70);
func_80115908(play, 0x70);
break;
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
Item_Give(globalCtx, ITEM_BOMBS_5);
Item_Give(play, ITEM_BOMBS_5);
break;
case ITEM00_ARROWS_10:
Item_Give(globalCtx, ITEM_ARROWS_10);
Item_Give(play, ITEM_ARROWS_10);
break;
case ITEM00_ARROWS_30:
Item_Give(globalCtx, ITEM_ARROWS_30);
Item_Give(play, ITEM_ARROWS_30);
break;
case ITEM00_ARROWS_40:
Item_Give(globalCtx, ITEM_ARROWS_40);
Item_Give(play, ITEM_ARROWS_40);
break;
case ITEM00_ARROWS_50:
Item_Give(globalCtx, ITEM_ARROWS_50);
Item_Give(play, ITEM_ARROWS_50);
break;
case ITEM00_MAGIC_LARGE:
Item_Give(globalCtx, ITEM_MAGIC_LARGE);
Item_Give(play, ITEM_MAGIC_LARGE);
break;
case ITEM00_MAGIC_SMALL:
Item_Give(globalCtx, ITEM_MAGIC_SMALL);
Item_Give(play, ITEM_MAGIC_SMALL);
break;
case ITEM00_SMALL_KEY:
Item_Give(globalCtx, ITEM_KEY_SMALL);
Item_Give(play, ITEM_KEY_SMALL);
break;
case ITEM00_NUTS_1:
getItemId = GI_NUTS_1;
@@ -261,31 +261,31 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
break;
}
if ((getItemId != GI_NONE) && (Actor_HasParent(&this->actor, globalCtx) == 0)) {
Actor_PickUp(&this->actor, globalCtx, getItemId, 50.0f, 20.0f);
if ((getItemId != GI_NONE) && (Actor_HasParent(&this->actor, play) == 0)) {
Actor_PickUp(&this->actor, play, getItemId, 50.0f, 20.0f);
}
this->actionFunc = func_800A6A40;
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnItem00_Destroy(Actor* thisx, PlayState* play) {
EnItem00* this = THIS;
Collider_DestroyCylinder(globalCtx, &this->collider);
Collider_DestroyCylinder(play, &this->collider);
}
void EnItem00_WaitForHeartObject(EnItem00* this, GlobalContext* globalCtx) {
void EnItem00_WaitForHeartObject(EnItem00* this, PlayState* play) {
s32 sp1C;
sp1C = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEARTS);
if (Object_IsLoaded(&globalCtx->objectCtx, sp1C)) {
sp1C = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEARTS);
if (Object_IsLoaded(&play->objectCtx, sp1C)) {
this->actor.objBankIndex = sp1C;
this->actionFunc = func_800A640C;
}
}
void func_800A640C(EnItem00* this, GlobalContext* globalCtx) {
void func_800A640C(EnItem00* this, PlayState* play) {
if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->unk152 < 0)) ||
(this->actor.params == ITEM00_HEART_PIECE) || (this->actor.params == ITEM00_HEART_CONTAINER)) {
this->actor.shape.rot.y = this->actor.shape.rot.y + 960;
@@ -335,18 +335,18 @@ static Color_RGBA8 D_801ADF14 = { 255, 255, 255, 0 };
static Vec3f D_801ADF18 = { 0.0f, 0.1f, 0.0f };
static Vec3f D_801ADF24 = { 0.0f, 0.01f, 0.0f };
void func_800A6650(EnItem00* this, GlobalContext* globalCtx) {
void func_800A6650(EnItem00* this, PlayState* play) {
u32 pad;
Vec3f pos;
if (this->actor.params <= ITEM00_RUPEE_RED) {
this->actor.shape.rot.y = this->actor.shape.rot.y + 960;
}
if ((globalCtx->gameplayFrames & 1) != 0) {
if ((play->gameplayFrames & 1) != 0) {
pos.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(10.0f);
pos.y = this->actor.world.pos.y + randPlusMinusPoint5Scaled(10.0f);
pos.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(10.0f);
EffectSsKirakira_SpawnSmall(globalCtx, &pos, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14);
EffectSsKirakira_SpawnSmall(play, &pos, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14);
}
if ((this->actor.bgCheckFlags & 3) != 0) {
if (this->actor.velocity.y > -2.0f) {
@@ -359,7 +359,7 @@ void func_800A6650(EnItem00* this, GlobalContext* globalCtx) {
}
}
void func_800A6780(EnItem00* this, GlobalContext* globalCtx) {
void func_800A6780(EnItem00* this, PlayState* play) {
s32 pad;
Vec3f pos;
s32 var1;
@@ -399,11 +399,11 @@ void func_800A6780(EnItem00* this, GlobalContext* globalCtx) {
}
}
if ((globalCtx->gameplayFrames & 1) == 0) {
if ((play->gameplayFrames & 1) == 0) {
pos.x = this->actor.world.pos.x + ((Rand_ZeroOne() - 0.5f) * 10.0f);
pos.y = this->actor.world.pos.y + ((Rand_ZeroOne() - 0.5f) * 10.0f);
pos.z = this->actor.world.pos.z + ((Rand_ZeroOne() - 0.5f) * 10.0f);
EffectSsKirakira_SpawnSmall(globalCtx, &pos, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14);
EffectSsKirakira_SpawnSmall(play, &pos, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14);
}
if (this->actor.bgCheckFlags & 0x0003) {
@@ -413,12 +413,12 @@ void func_800A6780(EnItem00* this, GlobalContext* globalCtx) {
}
}
void func_800A6A40(EnItem00* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void func_800A6A40(EnItem00* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (this->unk14A != GI_NONE) {
if (Actor_HasParent(&this->actor, globalCtx) == 0) {
Actor_PickUp(&this->actor, globalCtx, this->unk14A, 50.0f, 80.0f);
if (Actor_HasParent(&this->actor, play) == 0) {
Actor_PickUp(&this->actor, play, this->unk14A, 50.0f, 80.0f);
this->unk152++;
} else {
this->unk14A = GI_NONE;
@@ -445,10 +445,10 @@ void func_800A6A40(EnItem00* this, GlobalContext* globalCtx) {
}
}
void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnItem00_Update(Actor* thisx, PlayState* play) {
EnItem00* this = THIS;
s32 pad;
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
s32 sp38 = player->stateFlags3 & 0x1000;
s32 getItemId = GI_NONE;
s32 params;
@@ -461,7 +461,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
this->unk14E = this->unk152;
}
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
Math_SmoothStepToF(&this->actor.scale.x, this->unk154, 0.1f, this->unk154 * 0.1f, 0.0f);
this->actor.scale.z = this->actor.scale.x;
@@ -469,7 +469,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
if (this->actor.gravity != 0.0f) {
Actor_MoveWithGravity(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 15.0f, 15.0f, 0x1D);
Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 15.0f, 15.0f, 0x1D);
if (this->actor.floorHeight <= BGCHECK_Y_MIN) {
Actor_MarkForDeath(&this->actor);
@@ -478,7 +478,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
}
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
params = this->actor.params;
if ((params == ITEM00_SHIELD_HERO) || (params == ITEM00_MAP) || (params == ITEM00_COMPASS)) {
@@ -493,35 +493,35 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
(this->actor.playerHeightRel <= 100.0f)) &&
!((sp38 == 0) && (this->actor.xzDistToPlayer <= 30.0f) && (this->actor.playerHeightRel >= -50.0f) &&
(this->actor.playerHeightRel <= 50.0f))) {
if (!Actor_HasParent(&this->actor, globalCtx)) {
if (!Actor_HasParent(&this->actor, play)) {
return;
}
}
if (globalCtx->gameOverCtx.state != 0) {
if (play->gameOverCtx.state != 0) {
return;
}
switch (this->actor.params) {
case ITEM00_RUPEE_GREEN:
this->unk1A4 = 1;
Item_Give(globalCtx, ITEM_RUPEE_GREEN);
Item_Give(play, ITEM_RUPEE_GREEN);
break;
case ITEM00_RUPEE_BLUE:
this->unk1A4 = 1;
Item_Give(globalCtx, ITEM_RUPEE_BLUE);
Item_Give(play, ITEM_RUPEE_BLUE);
break;
case ITEM00_RUPEE_RED:
this->unk1A4 = 1;
Item_Give(globalCtx, ITEM_RUPEE_RED);
Item_Give(play, ITEM_RUPEE_RED);
break;
case ITEM00_RUPEE_PURPLE:
this->unk1A4 = 1;
Item_Give(globalCtx, ITEM_RUPEE_PURPLE);
Item_Give(play, ITEM_RUPEE_PURPLE);
break;
case ITEM00_RUPEE_HUGE:
this->unk1A4 = 1;
Item_Give(globalCtx, ITEM_RUPEE_HUGE);
Item_Give(play, ITEM_RUPEE_HUGE);
break;
case ITEM00_STICK:
getItemId = GI_STICKS_1;
@@ -533,27 +533,27 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
getItemId = GI_NUTS_10;
break;
case ITEM00_HEART:
Item_Give(globalCtx, ITEM_HEART);
Item_Give(play, ITEM_HEART);
break;
case ITEM00_FLEXIBLE:
case ITEM00_BIG_FAIRY:
func_80115908(globalCtx, 0x70);
func_80115908(play, 0x70);
break;
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
Item_Give(globalCtx, ITEM_BOMBS_5);
Item_Give(play, ITEM_BOMBS_5);
break;
case ITEM00_ARROWS_10:
Item_Give(globalCtx, ITEM_ARROWS_10);
Item_Give(play, ITEM_ARROWS_10);
break;
case ITEM00_ARROWS_30:
Item_Give(globalCtx, ITEM_ARROWS_30);
Item_Give(play, ITEM_ARROWS_30);
break;
case ITEM00_ARROWS_40:
Item_Give(globalCtx, ITEM_ARROWS_40);
Item_Give(play, ITEM_ARROWS_40);
break;
case ITEM00_ARROWS_50:
Item_Give(globalCtx, ITEM_ARROWS_50);
Item_Give(play, ITEM_ARROWS_50);
break;
case ITEM00_SMALL_KEY:
getItemId = GI_KEY_SMALL;
@@ -565,10 +565,10 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
getItemId = GI_HEART_CONTAINER;
break;
case ITEM00_MAGIC_LARGE:
Item_Give(globalCtx, ITEM_MAGIC_LARGE);
Item_Give(play, ITEM_MAGIC_LARGE);
break;
case ITEM00_MAGIC_SMALL:
Item_Give(globalCtx, ITEM_MAGIC_SMALL);
Item_Give(play, ITEM_MAGIC_SMALL);
break;
case ITEM00_SHIELD_HERO:
getItemId = GI_SHIELD_HERO;
@@ -584,8 +584,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
}
if (getItemId != GI_NONE) {
if (!Actor_HasParent(&this->actor, globalCtx)) {
Actor_PickUp(&this->actor, globalCtx, getItemId, 50.0f, 20.0f);
if (!Actor_HasParent(&this->actor, play)) {
Actor_PickUp(&this->actor, play, getItemId, 50.0f, 20.0f);
}
}
@@ -596,8 +596,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
case ITEM00_SHIELD_HERO:
case ITEM00_MAP:
case ITEM00_COMPASS:
if (Actor_HasParent(&this->actor, globalCtx)) {
Flags_SetCollectible(globalCtx, this->collectibleFlag);
if (Actor_HasParent(&this->actor, play)) {
Flags_SetCollectible(play, this->collectibleFlag);
Actor_MarkForDeath(&this->actor);
}
return;
@@ -608,8 +608,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
if ((this->actor.params <= ITEM00_RUPEE_RED) || (this->actor.params == ITEM00_RUPEE_HUGE)) {
play_sound(NA_SE_SY_GET_RUPY);
} else if (getItemId != GI_NONE) {
if (Actor_HasParent(&this->actor, globalCtx)) {
Flags_SetCollectible(globalCtx, this->collectibleFlag);
if (Actor_HasParent(&this->actor, play)) {
Flags_SetCollectible(play, this->collectibleFlag);
Actor_MarkForDeath(&this->actor);
}
return;
@@ -617,7 +617,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
play_sound(NA_SE_SY_GET_ITEM);
}
Flags_SetCollectible(globalCtx, this->collectibleFlag);
Flags_SetCollectible(play, this->collectibleFlag);
this->unk152 = 15;
this->unk14C = 35;
@@ -632,12 +632,12 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc = func_800A6A40;
}
void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx);
void EnItem00_DrawSprite(EnItem00* this, GlobalContext* globalCtx);
void EnItem00_DrawHeartContainer(EnItem00* this, GlobalContext* globalCtx);
void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx);
void EnItem00_DrawRupee(EnItem00* this, PlayState* play);
void EnItem00_DrawSprite(EnItem00* this, PlayState* play);
void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play);
void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play);
void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnItem00_Draw(Actor* thisx, PlayState* play) {
s32 pad;
EnItem00* this = THIS;
@@ -648,26 +648,26 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
case ITEM00_RUPEE_RED:
case ITEM00_RUPEE_HUGE:
case ITEM00_RUPEE_PURPLE:
EnItem00_DrawRupee(this, globalCtx);
EnItem00_DrawRupee(this, play);
break;
case ITEM00_HEART_PIECE:
EnItem00_DrawHeartPiece(this, globalCtx);
EnItem00_DrawHeartPiece(this, play);
break;
case ITEM00_HEART_CONTAINER:
EnItem00_DrawHeartContainer(this, globalCtx);
EnItem00_DrawHeartContainer(this, play);
break;
case ITEM00_HEART:
if (this->unk152 < 0) {
if (this->unk152 == -1) {
s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART);
if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) {
s8 bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEART);
if (Object_IsLoaded(&play->objectCtx, bankIndex)) {
this->actor.objBankIndex = bankIndex;
Actor_SetObjectDependency(globalCtx, &this->actor);
Actor_SetObjectDependency(play, &this->actor);
this->unk152 = -2;
}
} else {
Matrix_Scale(16.0f, 16.0f, 16.0f, MTXMODE_APPLY);
GetItem_Draw(globalCtx, 8);
GetItem_Draw(play, 8);
}
break;
}
@@ -684,16 +684,16 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
case ITEM00_SMALL_KEY:
case ITEM00_NUTS_10:
case ITEM00_BOMBS_0:
EnItem00_DrawSprite(this, globalCtx);
EnItem00_DrawSprite(this, play);
break;
case ITEM00_SHIELD_HERO:
GetItem_Draw(globalCtx, GID_SHIELD_HERO);
GetItem_Draw(play, GID_SHIELD_HERO);
break;
case ITEM00_MAP:
GetItem_Draw(globalCtx, GID_DUNGEON_MAP);
GetItem_Draw(play, GID_DUNGEON_MAP);
break;
case ITEM00_COMPASS:
GetItem_Draw(globalCtx, GID_COMPASS);
GetItem_Draw(play, GID_COMPASS);
case ITEM00_MASK:
case ITEM00_FLEXIBLE:
case ITEM00_3_HEARTS:
@@ -712,14 +712,14 @@ TexturePtr D_801ADF30[] = {
gameplay_keep_Tex_062020 // Purple rupee
};
void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx) {
void EnItem00_DrawRupee(EnItem00* this, PlayState* play) {
s32 pad;
s32 iconNb;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
func_800B8050(&this->actor, globalCtx, 0);
func_8012C28C(play->state.gfxCtx);
func_800B8050(&this->actor, play, 0);
if (this->actor.params <= ITEM00_RUPEE_RED) {
iconNb = this->actor.params;
@@ -727,13 +727,13 @@ void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx) {
iconNb = this->actor.params - 0x10;
}
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_801ADF30[iconNb]));
gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_0622C0); // TODO symbol
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
TexturePtr D_801ADF44[12] = {
@@ -751,12 +751,12 @@ TexturePtr D_801ADF44[12] = {
gameplay_keep_Tex_05F7C0 // Small Key
};
void EnItem00_DrawSprite(EnItem00* this, GlobalContext* globalCtx) {
void EnItem00_DrawSprite(EnItem00* this, PlayState* play) {
s32 iconNb = this->actor.params - 3;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP);
POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
if (this->actor.params == ITEM00_NUTS_10) {
iconNb = 6;
@@ -773,45 +773,45 @@ void EnItem00_DrawSprite(EnItem00* this, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_801ADF44[iconNb]));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05F6F0);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void EnItem00_DrawHeartContainer(EnItem00* actor, GlobalContext* globalCtx) {
void EnItem00_DrawHeartContainer(EnItem00* actor, PlayState* play) {
s32 pad;
s32 pad2;
if (Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEARTS) == actor->actor.objBankIndex) {
OPEN_DISPS(globalCtx->state.gfxCtx);
if (Object_GetIndex(&play->objectCtx, OBJECT_GI_HEARTS) == actor->actor.objBankIndex) {
OPEN_DISPS(play->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
func_8012C2DC(play->state.gfxCtx);
Matrix_Scale(20.0f, 20.0f, 20.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, object_gi_hearts_DL_001290);
gSPDisplayList(POLY_XLU_DISP++, object_gi_hearts_DL_001470);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
}
void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx) {
void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
func_800B8118(&this->actor, globalCtx, 0);
func_8012C2DC(play->state.gfxCtx);
func_800B8118(&this->actor, play, 0);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_05AAB0);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
s16 func_800A7650(s16 dropId) {
@@ -834,7 +834,7 @@ s16 func_800A7650(s16 dropId) {
return dropId;
}
Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 params) {
Actor* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, u32 params) {
s32 pad;
Actor* spawnedActor = NULL;
s32 newParamFF;
@@ -850,29 +850,28 @@ Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 param
if (paramFF == ITEM00_3_HEARTS) {
for (i = 0; i < 3; i++) {
spawnedActor = Item_DropCollectible(globalCtx, spawnPos, param7F00 | ITEM00_HEART | param8000);
spawnedActor = Item_DropCollectible(play, spawnPos, param7F00 | ITEM00_HEART | param8000);
}
} else if (paramFF == ITEM00_MUSHROOM_CLOUD) {
param7F00 >>= 8;
if (!Flags_GetCollectible(globalCtx, param7F00)) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OBJ_KINOKO, spawnPos->x, spawnPos->y, spawnPos->z, 0, 0,
0, param7F00);
if (!Flags_GetCollectible(play, param7F00)) {
Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_KINOKO, spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, 0,
param7F00);
}
} else if (((paramFF == ITEM00_FLEXIBLE) || (newParamFF == ITEM00_BIG_FAIRY)) && (param10000 == 0)) {
newParamFF = params & 0xFF;
if (newParamFF == ITEM00_FLEXIBLE) {
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f,
spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) << 9) & 0xFE00) | 0x102);
if (!Flags_GetCollectible(globalCtx, (param7F00 >> 8) & 0x7F)) {
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY);
if (!Flags_GetCollectible(play, (param7F00 >> 8) & 0x7F)) {
SoundSource_PlaySfxAtFixedWorldPos(play, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY);
}
} else {
spawnedActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7);
spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7);
if (param20000 == 0) {
if (!Flags_GetCollectible(globalCtx, (param7F00 >> 8) & 0x7F)) {
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY);
if (!Flags_GetCollectible(play, (param7F00 >> 8) & 0x7F)) {
SoundSource_PlaySfxAtFixedWorldPos(play, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY);
}
}
}
@@ -881,8 +880,8 @@ Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 param
params = func_800A7650(newParamFF);
}
if ((s32)params != ITEM00_NO_DROP) {
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y,
spawnPos->z, 0, 0, 0, (s32)params | param8000 | param7F00);
spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, spawnPos->z, 0,
0, 0, (s32)params | param8000 | param7F00);
if ((spawnedActor != NULL) && (param8000 == 0)) {
if (param10000 == 0) {
spawnedActor->velocity.y = 8.0f;
@@ -907,7 +906,7 @@ Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 param
return spawnedActor;
}
Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s32 params) {
Actor* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s32 params) {
Actor* spawnedActor = NULL;
s32 pad;
s32 param10000 = params & 0x10000;
@@ -922,21 +921,20 @@ Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s32 para
if ((((params & 0xFF) == ITEM00_FLEXIBLE) || ((params & 0xFF) == ITEM00_BIG_FAIRY)) && (param10000 == 0)) {
if ((params & 0xFF) == ITEM00_FLEXIBLE) {
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f,
spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) << 9) & 0xFE00) | 0x102);
} else {
spawnedActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7);
spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7);
}
if (Flags_GetCollectible(globalCtx, (param7F00 >> 8) & 0x7F) == 0) {
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY);
if (Flags_GetCollectible(play, (param7F00 >> 8) & 0x7F) == 0) {
SoundSource_PlaySfxAtFixedWorldPos(play, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY);
}
} else {
params = func_800A7650(params & 0xFF);
if (params != ITEM00_NO_DROP) {
spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y,
spawnPos->z, 0, 0, 0, (s32)params | param8000 | param7F00);
spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, spawnPos->z, 0,
0, 0, (s32)params | param8000 | param7F00);
if (spawnedActor != NULL) {
if (param8000 == 0) {
spawnedActor->velocity.y = 0.0f;
@@ -1032,7 +1030,7 @@ u8 sDropTableAmounts[DROP_TABLE_SIZE * DROP_TABLE_NUMBER] = {
0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
};
void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3f* spawnPos, s16 params) {
void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnPos, s16 params) {
EnItem00* spawnedActor;
u8 dropId;
s32 dropQuantity;
@@ -1084,9 +1082,9 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
if (dropId == ITEM00_FLEXIBLE) {
if (gSaveContext.save.playerData.health <= 0x10) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f,
spawnPos->z, 0, 0, 0, 2);
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0,
2);
SoundSource_PlaySfxAtFixedWorldPos(play, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY);
return;
}
@@ -1129,8 +1127,8 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
if (param8000 == 0) {
dropId = func_800A7650(dropId);
if (dropId != (u8)ITEM00_NO_DROP) {
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00,
spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, 0, dropId);
spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x,
spawnPos->y, spawnPos->z, 0, 0, 0, dropId);
if ((spawnedActor != 0) && (dropId != (u8)ITEM00_NO_DROP)) {
spawnedActor->actor.velocity.y = 8.0f;
spawnedActor->actor.speedXZ = 2.0f;
@@ -1148,7 +1146,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
}
}
} else {
Item_DropCollectible(globalCtx, spawnPos, params | 0x8000);
Item_DropCollectible(play, spawnPos, params | 0x8000);
}
dropQuantity--;
@@ -1185,6 +1183,6 @@ s32 func_800A817C(s32 index) {
return D_801AE214[index];
}
s32 Item_CanDropBigFairy(GlobalContext* globalCtx, s32 index, s32 collectibleFlag) {
return (func_800A8150(index) == ITEM00_BIG_FAIRY) && (!Flags_GetCollectible(globalCtx, collectibleFlag));
s32 Item_CanDropBigFairy(PlayState* play, s32 index, s32 collectibleFlag) {
return (func_800A8150(index) == ITEM00_BIG_FAIRY) && (!Flags_GetCollectible(play, collectibleFlag));
}
+9 -9
View File
@@ -1,33 +1,33 @@
#include "global.h"
void EnvFlags_UnsetAll(GlobalContext* globalCtx) {
void EnvFlags_UnsetAll(PlayState* play) {
u8 i;
for (i = 0; i < ARRAY_COUNT(globalCtx->envFlags); i++) {
globalCtx->envFlags[i] = 0;
for (i = 0; i < ARRAY_COUNT(play->envFlags); i++) {
play->envFlags[i] = 0;
}
}
void EnvFlags_Set(GlobalContext* globalCtx, s16 flag) {
void EnvFlags_Set(PlayState* play, s16 flag) {
s16 index = flag / 16;
s16 bit = flag % 16;
s16 mask = 1 << bit;
globalCtx->envFlags[index] |= mask;
play->envFlags[index] |= mask;
}
void EnvFlags_Unset(GlobalContext* globalCtx, s16 flag) {
void EnvFlags_Unset(PlayState* play, s16 flag) {
s16 index = flag / 16;
s16 bit = flag % 16;
s16 mask = (1 << bit) ^ 0xFFFF;
globalCtx->envFlags[index] &= mask;
play->envFlags[index] &= mask;
}
s32 EnvFlags_Get(GlobalContext* globalCtx, s16 flag) {
s32 EnvFlags_Get(PlayState* play, s16 flag) {
s16 index = flag / 16;
s16 bit = flag % 16;
s16 mask = 1 << bit;
return globalCtx->envFlags[index] & mask;
return play->envFlags[index] & mask;
}
+3 -3
View File
@@ -178,9 +178,9 @@ static u16 sReactionTextIds[][PLAYER_MASK_GIANT - 1] = {
};
// clang-format on
u16 Text_GetFaceReaction(GlobalContext* globalCtx, u32 reactionSet) {
if ((Player_GetMask(globalCtx) > PLAYER_MASK_NONE) && (Player_GetMask(globalCtx) < PLAYER_MASK_GIANT)) {
return sReactionTextIds[reactionSet][Player_GetMask(globalCtx) - 1];
u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet) {
if ((Player_GetMask(play) > PLAYER_MASK_NONE) && (Player_GetMask(play) < PLAYER_MASK_GIANT)) {
return sReactionTextIds[reactionSet][Player_GetMask(play) - 1];
}
return 0;
}
+18 -18
View File
@@ -44,7 +44,7 @@ void SkelCurve_Clear(SkelCurve* skelCurve) {
*
* @return bool always true
*/
s32 SkelCurve_Init(GlobalContext* globalCtx, SkelCurve* skelCurve, CurveSkeletonHeader* skeletonHeaderSeg,
s32 SkelCurve_Init(PlayState* play, SkelCurve* skelCurve, CurveSkeletonHeader* skeletonHeaderSeg,
CurveAnimationHeader* animation) {
SkelCurveLimb** limbs;
CurveSkeletonHeader* skeletonHeader = Lib_SegmentedToVirtual(skeletonHeaderSeg);
@@ -61,7 +61,7 @@ s32 SkelCurve_Init(GlobalContext* globalCtx, SkelCurve* skelCurve, CurveSkeleton
/**
* Frees the joint table.
*/
void SkelCurve_Destroy(GlobalContext* globalCtx, SkelCurve* skelCurve) {
void SkelCurve_Destroy(PlayState* play, SkelCurve* skelCurve) {
if (skelCurve->jointTable != NULL) {
ZeldaArena_Free(skelCurve->jointTable);
}
@@ -91,7 +91,7 @@ typedef enum {
*
* @return bool true when the animation has finished.
*/
s32 SkelCurve_Update(GlobalContext* globalCtx, SkelCurve* skelCurve) {
s32 SkelCurve_Update(PlayState* play, SkelCurve* skelCurve) {
s16* jointData;
u8* knotCounts;
CurveAnimationHeader* animation;
@@ -108,7 +108,7 @@ s32 SkelCurve_Update(GlobalContext* globalCtx, SkelCurve* skelCurve) {
constantData = Lib_SegmentedToVirtual(animation->constantData);
jointData = *skelCurve->jointTable;
skelCurve->curFrame += skelCurve->playSpeed * ((s32)globalCtx->state.framerateDivisor * 0.5f);
skelCurve->curFrame += skelCurve->playSpeed * ((s32)play->state.framerateDivisor * 0.5f);
if (((skelCurve->playSpeed >= 0.0f) && (skelCurve->curFrame > skelCurve->endFrame)) ||
((skelCurve->playSpeed < 0.0f) && (skelCurve->curFrame < skelCurve->endFrame))) {
@@ -155,16 +155,16 @@ s32 SkelCurve_Update(GlobalContext* globalCtx, SkelCurve* skelCurve) {
/**
* Recursively draws limbs with appropriate properties.
*/
void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelCurve* skelCurve,
OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, Actor* thisx) {
void SkelCurve_DrawLimb(PlayState* play, s32 limbIndex, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw,
PostCurveLimbDraw postLimbDraw, s32 lod, Actor* thisx) {
SkelCurveLimb* limb = Lib_SegmentedToVirtual(skelCurve->skeleton[limbIndex]);
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
Matrix_Push();
if ((overrideLimbDraw == NULL) ||
((overrideLimbDraw != NULL) && overrideLimbDraw(globalCtx, skelCurve, limbIndex, thisx))) {
((overrideLimbDraw != NULL) && overrideLimbDraw(play, skelCurve, limbIndex, thisx))) {
Vec3f scale;
Vec3s rot;
Vec3f pos;
@@ -191,7 +191,7 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelCurve* skel
dList = limb->dList[0];
if (dList != NULL) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, dList);
}
@@ -200,13 +200,13 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelCurve* skel
dList = limb->dList[0];
if (dList != NULL) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, dList);
}
dList = limb->dList[1];
if (dList != NULL) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, dList);
}
@@ -214,25 +214,25 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelCurve* skel
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, skelCurve, limbIndex, thisx);
postLimbDraw(play, skelCurve, limbIndex, thisx);
}
if (limb->child != LIMB_DONE) {
SkelCurve_DrawLimb(globalCtx, limb->child, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx);
SkelCurve_DrawLimb(play, limb->child, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx);
}
Matrix_Pop();
if (limb->sibling != LIMB_DONE) {
SkelCurve_DrawLimb(globalCtx, limb->sibling, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx);
SkelCurve_DrawLimb(play, limb->sibling, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void SkelCurve_Draw(Actor* actor, GlobalContext* globalCtx, SkelCurve* skelCurve,
OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, Actor* thisx) {
void SkelCurve_Draw(Actor* actor, PlayState* play, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw,
PostCurveLimbDraw postLimbDraw, s32 lod, Actor* thisx) {
if (skelCurve->jointTable != NULL) {
SkelCurve_DrawLimb(globalCtx, 0, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx);
SkelCurve_DrawLimb(play, 0, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx);
}
}
+30 -31
View File
@@ -37,7 +37,7 @@ FireObjLightParams sFireObjLightParams[] = {
{ 200, { 128, 128, 0 }, { 127, 127, 0 } },
};
void FireObj_InitWithParams(GlobalContext* globalCtx, FireObj* fire, FireObjInitParams* init) {
void FireObj_InitWithParams(PlayState* play, FireObj* fire, FireObjInitParams* init) {
fire->size = init->size;
fire->sizeInv = 1.0f / init->size;
fire->dynamicSizeStep = init->dynamicSizeStep;
@@ -92,8 +92,8 @@ void FireObj_StepSize(FireObj* fire) {
fire->xScale = fire->dynamicSize * fire->size;
}
void FireObj_UpdateStateTransitions(GlobalContext* globalCtx, FireObj* fire) {
Player* player = GET_PLAYER(globalCtx);
void FireObj_UpdateStateTransitions(PlayState* play, FireObj* fire) {
Player* player = GET_PLAYER(play);
WaterBox* waterBox;
f32 waterY;
s32 sp40 = false;
@@ -114,7 +114,7 @@ void FireObj_UpdateStateTransitions(GlobalContext* globalCtx, FireObj* fire) {
FireObj_SetState(fire, fire->dynamicSizeStep, nextState);
}
if ((fire->flags & 1) && (fire->state != FIRE_STATE_3) &&
WaterBox_GetSurface1_2(globalCtx, &globalCtx->colCtx, fire->position.x, fire->position.z, &waterY, &waterBox) &&
WaterBox_GetSurface1_2(play, &play->colCtx, fire->position.x, fire->position.z, &waterY, &waterBox) &&
(waterY - fire->position.y > 6500.0f * fire->yScale)) {
FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_3);
}
@@ -131,25 +131,24 @@ void FireObj_UpdateStateTransitions(GlobalContext* globalCtx, FireObj* fire) {
}
} else if (player->unk_B28 == 0) {
player->unk_B28 = 0xD2;
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &fire->position, 20, NA_SE_EV_FLAME_IGNITION);
SoundSource_PlaySfxAtFixedWorldPos(play, &fire->position, 20, NA_SE_EV_FLAME_IGNITION);
} else if (player->unk_B28 < 0xC8) {
player->unk_B28 = 0xC8;
}
}
}
void FireObj_Draw(GlobalContext* globalCtx, FireObj* fire) {
void FireObj_Draw(PlayState* play, FireObj* fire) {
s32 pad;
FireObjColors* fireColors = &sFireObjColors[fire->colorsIndex];
if (fire->state != FIRE_STATE_3) {
Vec3s vec;
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
gSPSegment(
POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (fire->unk26 * -20) & 511, 32, 128));
OPEN_DISPS(play->state.gfxCtx);
func_8012C2DC(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (fire->unk26 * -20) & 511, 32, 128));
gDPSetPrimColor(POLY_XLU_DISP++, 0, fireColors->lod, fireColors->primColor.r, fireColors->primColor.g,
fireColors->primColor.b, fireColors->primColor.a);
@@ -157,31 +156,31 @@ void FireObj_Draw(GlobalContext* globalCtx, FireObj* fire) {
gDPSetEnvColor(POLY_XLU_DISP++, fireColors->envColor.r, fireColors->envColor.g, fireColors->envColor.b, 0);
vec.x = 0;
vec.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000;
vec.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000;
vec.z = 0;
Matrix_SetTranslateRotateYXZ(fire->position.x, fire->position.y, fire->position.z, &vec);
Matrix_Scale(fire->xScale, fire->yScale, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
}
void FireObj_InitLight(GlobalContext* globalCtx, FireObjLight* light, u8* paramsIndex, Vec3f* pos) {
void FireObj_InitLight(PlayState* play, FireObjLight* light, u8* paramsIndex, Vec3f* pos) {
FireObjLightParams* objectParams = &sFireObjLightParams[*paramsIndex];
Lights_PointGlowSetInfo(&light->lightInfo, pos->x, pos->y, pos->z, objectParams->color.r, objectParams->color.g,
objectParams->color.b, objectParams->radius);
light->light = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &light->lightInfo);
light->light = LightContext_InsertLight(play, &play->lightCtx, &light->lightInfo);
light->lightParamsIndex = *paramsIndex;
}
void FireObj_DestroyLight(GlobalContext* globalCtx, FireObjLight* light) {
LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, light->light);
void FireObj_DestroyLight(PlayState* play, FireObjLight* light) {
LightContext_RemoveLight(play, &play->lightCtx, light->light);
}
void FireObj_UpdateLight(GlobalContext* globalCtx, FireObjLight* light, FireObj* fire) {
void FireObj_UpdateLight(PlayState* play, FireObjLight* light, FireObj* fire) {
FireObjLightParams* lightParams = &sFireObjLightParams[light->lightParamsIndex];
s16 radius;
@@ -198,33 +197,33 @@ void FireObj_UpdateLight(GlobalContext* globalCtx, FireObjLight* light, FireObj*
}
}
void FireObj_Init(GlobalContext* globalCtx, FireObj* fire, FireObjInitParams* init, Actor* actor) {
void FireObj_Init(PlayState* play, FireObj* fire, FireObjInitParams* init, Actor* actor) {
FireObj* fire2 = fire;
FireObj_InitWithParams(globalCtx, fire, init);
Collider_InitCylinder(globalCtx, &fire->collision);
Collider_SetCylinder(globalCtx, &fire->collision, actor, &sFireObjCollisionInit);
FireObj_InitWithParams(play, fire, init);
Collider_InitCylinder(play, &fire->collision);
Collider_SetCylinder(play, &fire->collision, actor, &sFireObjCollisionInit);
fire2->collision.dim.radius = (fire->size * 4000.0f) + 2.5f;
fire2->collision.dim.height = fire->size * 16000.0f;
fire->collision.dim.yShift = fire->size * -1728.0f;
FireObj_InitLight(globalCtx, &fire->light, &init->lightParamsIndex, &fire->position);
FireObj_InitLight(play, &fire->light, &init->lightParamsIndex, &fire->position);
}
void FireObj_Destroy(GlobalContext* globalCtx, FireObj* fire) {
Collider_DestroyCylinder(globalCtx, &fire->collision);
FireObj_DestroyLight(globalCtx, &fire->light);
void FireObj_Destroy(PlayState* play, FireObj* fire) {
Collider_DestroyCylinder(play, &fire->collision);
FireObj_DestroyLight(play, &fire->light);
}
void FireObj_SetState2(FireObj* fire, f32 dynamicSizeStep, u8 newState) {
FireObj_SetState(fire, dynamicSizeStep, newState);
}
void FireObj_Update(GlobalContext* globalCtx, FireObj* fire, Actor* actor) {
void FireObj_Update(PlayState* play, FireObj* fire, Actor* actor) {
s32 pad; // Gamestate cast?
EnArrow* arrow = (EnArrow*)fire->collision.base.ac;
FireObj_UpdateStateTransitions(globalCtx, fire);
FireObj_UpdateStateTransitions(play, fire);
if (fire->state == FIRE_STATE_3) {
if ((fire->collision.base.acFlags & AC_HIT) && (fire->collision.info.acHitInfo->toucher.dmgFlags & 0x800)) {
FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_0);
@@ -237,6 +236,6 @@ void FireObj_Update(GlobalContext* globalCtx, FireObj* fire, Actor* actor) {
fire->collision.dim.pos.x = fire->position.x;
fire->collision.dim.pos.y = fire->position.y;
fire->collision.dim.pos.z = fire->position.z;
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &fire->collision.base);
FireObj_UpdateLight(globalCtx, &fire->light, fire);
CollisionCheck_SetAC(play, &play->colChkCtx, &fire->collision.base);
FireObj_UpdateLight(play, &fire->light, fire);
}
+1 -1
View File
@@ -17,7 +17,7 @@ GameStateOverlay gGameStateOverlayTable[] = {
GAMESTATE_OVERLAY_INTERNAL(TitleSetup_Init, TitleSetup_Destroy, sizeof(GameState)),
GAMESTATE_OVERLAY(select, Select_Init, Select_Destroy, sizeof(SelectContext)),
GAMESTATE_OVERLAY(title, Title_Init, Title_Destroy, sizeof(TitleContext)),
GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Fini, sizeof(GlobalContext)),
GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Fini, sizeof(PlayState)),
GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)),
GAMESTATE_OVERLAY(file_choose, FileChoose_Init, FileChoose_Destroy, sizeof(FileChooseContext)),
GAMESTATE_OVERLAY(daytelop, Daytelop_Init, Daytelop_Destroy, sizeof(DaytelopContext)),
+12 -12
View File
@@ -1,27 +1,27 @@
#include "global.h"
void GameOver_Init(GlobalContext* globalCtx) {
globalCtx->gameOverCtx.state = GAMEOVER_INACTIVE;
void GameOver_Init(PlayState* play) {
play->gameOverCtx.state = GAMEOVER_INACTIVE;
}
void GameOver_FadeLights(GlobalContext* globalCtx) {
GameOverContext* gameOverCtx = &globalCtx->gameOverCtx;
void GameOver_FadeLights(PlayState* play) {
GameOverContext* gameOverCtx = &play->gameOverCtx;
if ((gameOverCtx->state >= GAMEOVER_DEATH_WAIT_GROUND && gameOverCtx->state < GAMEOVER_REVIVE_START) ||
(gameOverCtx->state >= GAMEOVER_REVIVE_RUMBLE && gameOverCtx->state < GAMEOVER_REVIVE_FADE_OUT)) {
Kankyo_FadeInGameOverLights(globalCtx);
Kankyo_FadeInGameOverLights(play);
}
}
static s16 sGameOverTimer = 0;
void GameOver_Update(GlobalContext* globalCtx) {
GameOverContext* gameOverCtx = &globalCtx->gameOverCtx;
void GameOver_Update(PlayState* play) {
GameOverContext* gameOverCtx = &play->gameOverCtx;
s16 i;
switch (gameOverCtx->state) {
case GAMEOVER_DEATH_START:
func_801477B4(globalCtx);
func_801477B4(play);
for (i = 0; i < ARRAY_COUNT(gSaveContext.unk_3DD0); i++) {
gSaveContext.unk_3DD0[i] = 0;
@@ -60,14 +60,14 @@ void GameOver_Update(GlobalContext* globalCtx) {
gSaveContext.unk_3F20 = 0;
gSaveContext.unk_3F22 = 0;
gSaveContext.unk_3F24 = 0;
Kankyo_InitGameOverLights(globalCtx);
Kankyo_InitGameOverLights(play);
sGameOverTimer = 20;
func_8013ECE0(0.0f, 126, 124, 63);
gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND;
break;
case GAMEOVER_DEATH_FADE_OUT:
if (func_801A8A50(1) != NA_BGM_GAME_OVER) {
func_80169F78(&globalCtx->state);
func_80169F78(&play->state);
if (gSaveContext.respawnFlag != -7) {
gSaveContext.respawnFlag = -6;
}
@@ -84,7 +84,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
case GAMEOVER_REVIVE_START:
gameOverCtx->state++;
sGameOverTimer = 0;
Kankyo_InitGameOverLights(globalCtx);
Kankyo_InitGameOverLights(play);
ShrinkWindow_SetLetterboxTarget(32);
break;
case GAMEOVER_REVIVE_RUMBLE:
@@ -107,7 +107,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
}
break;
case GAMEOVER_REVIVE_FADE_OUT:
Kankyo_FadeOutGameOverLights(globalCtx);
Kankyo_FadeOutGameOverLights(play);
sGameOverTimer--;
if (sGameOverTimer == 0) {
gameOverCtx->state = GAMEOVER_INACTIVE;
+2 -2
View File
@@ -54,7 +54,7 @@ void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl) {
}
}
void KaleidoManager_Init(GlobalContext* globalCtx) {
void KaleidoManager_Init(PlayState* play) {
s32 largestSize = 0;
s32 size;
u32 i;
@@ -66,7 +66,7 @@ void KaleidoManager_Init(GlobalContext* globalCtx) {
}
}
sKaleidoAreaPtr = THA_AllocEndAlign16(&globalCtx->state.heap, largestSize);
sKaleidoAreaPtr = THA_AllocEndAlign16(&play->state.heap, largestSize);
gKaleidoMgrCurOvl = NULL;
Fault_AddAddrConvClient(&sKaleidoAreaFaultClient, KaleidoManager_FaultAddrConvFunc, NULL);
}
+17 -17
View File
@@ -1,11 +1,11 @@
#include "prevent_bss_reordering.h"
#include "global.h"
void (*sKaleidoScopeUpdateFunc)(GlobalContext* globalCtx);
void (*sKaleidoScopeDrawFunc)(GlobalContext* globalCtx);
void (*sKaleidoScopeUpdateFunc)(PlayState* play);
void (*sKaleidoScopeDrawFunc)(PlayState* play);
extern void KaleidoScope_Update(GlobalContext* globalCtx);
extern void KaleidoScope_Draw(GlobalContext* globalCtx);
extern void KaleidoScope_Update(PlayState* play);
extern void KaleidoScope_Draw(PlayState* play);
void KaleidoScopeCall_LoadPlayer() {
KaleidoMgrOverlay* playerActorOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR];
@@ -19,21 +19,21 @@ void KaleidoScopeCall_LoadPlayer() {
}
}
void KaleidoScopeCall_Init(GlobalContext* globalCtx) {
void KaleidoScopeCall_Init(PlayState* play) {
sKaleidoScopeUpdateFunc = KaleidoManager_GetRamAddr(KaleidoScope_Update);
sKaleidoScopeDrawFunc = KaleidoManager_GetRamAddr(KaleidoScope_Draw);
KaleidoSetup_Init(globalCtx);
KaleidoSetup_Init(play);
}
void KaleidoScopeCall_Destroy(GlobalContext* globalCtx) {
KaleidoSetup_Destroy(globalCtx);
void KaleidoScopeCall_Destroy(PlayState* play) {
KaleidoSetup_Destroy(play);
}
void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
void KaleidoScopeCall_Update(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx;
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0)) {
if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugState != 0)) {
if (pauseCtx->state == 1 || pauseCtx->state == 19) {
if (ShrinkWindow_GetLetterboxMagnitude() == 0) {
R_PAUSE_MENU_MODE = 1;
@@ -60,9 +60,9 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
}
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
sKaleidoScopeUpdateFunc(globalCtx);
sKaleidoScopeUpdateFunc(play);
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) {
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) {
KaleidoManager_ClearOvl(kaleidoScopeOvl);
KaleidoScopeCall_LoadPlayer();
}
@@ -71,14 +71,14 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
}
}
void KaleidoScopeCall_Draw(GlobalContext* globalCtx) {
void KaleidoScopeCall_Draw(PlayState* play) {
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
if (R_PAUSE_MENU_MODE == 3) {
if (((globalCtx->pauseCtx.state >= 4) && (globalCtx->pauseCtx.state <= 7)) ||
((globalCtx->pauseCtx.state >= 11) && (globalCtx->pauseCtx.state <= 26))) {
if (((play->pauseCtx.state >= 4) && (play->pauseCtx.state <= 7)) ||
((play->pauseCtx.state >= 11) && (play->pauseCtx.state <= 26))) {
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
sKaleidoScopeDrawFunc(globalCtx);
sKaleidoScopeDrawFunc(play);
}
}
}
+19 -20
View File
@@ -5,8 +5,8 @@ s16 D_801BDB00[] = { PAUSE_1, PAUSE_2, PAUSE_3, PAUSE_0 };
f32 sKaleidoSetupEyeX[] = { -64.0f, 0.0f, 64.0f, 0.0f };
f32 sKaleidoSetupEyeZ[] = { 0.0f, -64.0f, 0.0f, 64.0f };
void func_800F4A10(GlobalContext* globalCtx) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
void func_800F4A10(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx;
s16 i;
func_8013EE24();
@@ -59,35 +59,34 @@ void func_800F4A10(GlobalContext* globalCtx) {
YREG(26) = -0x3840;
}
void KaleidoSetup_Update(GlobalContext* globalCtx) {
Input* input = CONTROLLER1(&globalCtx->state);
MessageContext* msgCtx = &globalCtx->msgCtx;
Player* player = GET_PLAYER(globalCtx);
PauseContext* pauseCtx = &globalCtx->pauseCtx;
void KaleidoSetup_Update(PlayState* play) {
Input* input = CONTROLLER1(&play->state);
MessageContext* msgCtx = &play->msgCtx;
Player* player = GET_PLAYER(play);
PauseContext* pauseCtx = &play->pauseCtx;
if (CHECK_BTN_ALL(input->cur.button, BTN_R)) {
if (msgCtx && msgCtx) {}
}
if ((pauseCtx->state == 0) && (pauseCtx->debugState == 0) && (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE)) {
if ((globalCtx->sceneLoadFlag == 0) && (globalCtx->unk_18B4A == 0)) {
if ((pauseCtx->state == 0) && (pauseCtx->debugState == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE)) {
if ((play->sceneLoadFlag == 0) && (play->unk_18B4A == 0)) {
if ((gSaveContext.save.cutscene < 0xFFF0) && (gSaveContext.nextCutsceneIndex < 0xFFF0)) {
if (!Play_InCsMode(globalCtx) || ((msgCtx->msgMode != 0) && (msgCtx->currentTextId == 0xFF))) {
if ((globalCtx->unk_1887C < 2) && (gSaveContext.unk_3F28 != 8) && (gSaveContext.unk_3F28 != 9)) {
if (!Play_InCsMode(play) || ((msgCtx->msgMode != 0) && (msgCtx->currentTextId == 0xFF))) {
if ((play->unk_1887C < 2) && (gSaveContext.unk_3F28 != 8) && (gSaveContext.unk_3F28 != 9)) {
if (!(gSaveContext.eventInf[1] & 0x80) && !(player->stateFlags1 & 0x20)) {
if (!(globalCtx->actorCtx.unk5 & 2) && !(globalCtx->actorCtx.unk5 & 4)) {
if ((globalCtx->actorCtx.unk268 == 0) &&
CHECK_BTN_ALL(input->press.button, BTN_START)) {
if (!(play->actorCtx.unk5 & 2) && !(play->actorCtx.unk5 & 4)) {
if ((play->actorCtx.unk268 == 0) && CHECK_BTN_ALL(input->press.button, BTN_START)) {
gSaveContext.unk_3F26 = gSaveContext.unk_3F22;
pauseCtx->unk_2B9 = 0;
pauseCtx->state = 1;
func_800F4A10(globalCtx);
func_800F4A10(play);
pauseCtx->mode = pauseCtx->pageIndex * 2 + 1;
func_801A3A7C(1);
}
if (pauseCtx->state == 1) {
Game_SetFramerateDivisor(&globalCtx->state, 2);
Game_SetFramerateDivisor(&play->state, 2);
if (ShrinkWindow_GetLetterboxTarget() != 0) {
ShrinkWindow_SetLetterboxTarget(0);
}
@@ -102,8 +101,8 @@ void KaleidoSetup_Update(GlobalContext* globalCtx) {
}
}
void KaleidoSetup_Init(GlobalContext* globalCtx) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
void KaleidoSetup_Init(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx;
s32 pad[2];
bzero(pauseCtx, sizeof(PauseContext));
@@ -138,8 +137,8 @@ void KaleidoSetup_Init(GlobalContext* globalCtx) {
pauseCtx->unk_2BC = 40;
pauseCtx->unk_29E = 100;
View_Init(&pauseCtx->view, globalCtx->state.gfxCtx);
View_Init(&pauseCtx->view, play->state.gfxCtx);
}
void KaleidoSetup_Destroy(GlobalContext* globalCtx) {
void KaleidoSetup_Destroy(PlayState* play) {
}
+3 -3
View File
@@ -1,11 +1,11 @@
#include "global.h"
// stubbed in NTSC-U
void Font_LoadChar(GlobalContext* globalCtx, u16 codePointIndex, s32 offset) {
void Font_LoadChar(PlayState* play, u16 codePointIndex, s32 offset) {
}
void Font_LoadCharNES(GlobalContext* globalCtx, u8 codePointIndex, s32 offset) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void Font_LoadCharNES(PlayState* play, u8 codePointIndex, s32 offset) {
MessageContext* msgCtx = &play->msgCtx;
Font* font = &msgCtx->font;
DmaMgr_SendRequest0(&font->charBuf[font->unk_11D88][offset],
+20 -20
View File
@@ -33,8 +33,8 @@ TexturePtr HeartDDTextures[] = {
gDefenseHeartThreeQuarterTex,
};
void LifeMeter_Init(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
void LifeMeter_Init(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
interfaceCtx->unkTimer = 320;
@@ -71,8 +71,8 @@ void LifeMeter_Init(GlobalContext* globalCtx) {
sHeartsDDEnv[0][2] = sHeartsDDEnv[1][2] = 0;
}
void LifeMeter_UpdateColors(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
void LifeMeter_UpdateColors(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
f32 factorBeating = interfaceCtx->lifeColorChange * 0.1f;
f32 ddFactor;
s32 type = 0;
@@ -167,26 +167,26 @@ void LifeMeter_UpdateColors(GlobalContext* globalCtx) {
sBeatingHeartsDDEnv[2] = (u8)(bFactor + 0) & 0xFF;
}
s32 LifeMeter_SaveInterfaceHealth(GlobalContext* globalCtx) {
gSaveContext.save.playerData.health = globalCtx->interfaceCtx.health;
s32 LifeMeter_SaveInterfaceHealth(PlayState* play) {
gSaveContext.save.playerData.health = play->interfaceCtx.health;
return 1;
}
s32 LifeMeter_IncreaseInterfaceHealth(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
s32 LifeMeter_IncreaseInterfaceHealth(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
interfaceCtx->unkTimer = 320;
interfaceCtx->health += 0x10;
if (globalCtx->interfaceCtx.health >= gSaveContext.save.playerData.health) {
globalCtx->interfaceCtx.health = gSaveContext.save.playerData.health;
if (play->interfaceCtx.health >= gSaveContext.save.playerData.health) {
play->interfaceCtx.health = gSaveContext.save.playerData.health;
return 1;
}
return 0;
}
s32 LifeMeter_DecreaseInterfaceHealth(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
s32 LifeMeter_DecreaseInterfaceHealth(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
if (interfaceCtx->unkTimer != 0) {
interfaceCtx->unkTimer--;
@@ -195,14 +195,14 @@ s32 LifeMeter_DecreaseInterfaceHealth(GlobalContext* globalCtx) {
interfaceCtx->health -= 0x10;
if (interfaceCtx->health <= 0) {
interfaceCtx->health = 0;
globalCtx->damagePlayer(globalCtx, -(((void)0, gSaveContext.save.playerData.health) + 1));
play->damagePlayer(play, -(((void)0, gSaveContext.save.playerData.health) + 1));
return 1;
}
}
return 0;
}
void LifeMeter_Draw(GlobalContext* globalCtx) {
void LifeMeter_Draw(PlayState* play) {
s32 pad[5];
TexturePtr heartTex;
s32 curColorSet;
@@ -213,8 +213,8 @@ void LifeMeter_Draw(GlobalContext* globalCtx) {
f32 posX;
f32 halfTexSize;
f32 temp_f4;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
GraphicsContext* gfxCtx = play->state.gfxCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
Vtx* beatingHeartVtx = interfaceCtx->beatingHeartVtx;
s32 fractionHeartCount = gSaveContext.save.playerData.health % 0x10;
s16 healthCapacity = gSaveContext.save.playerData.healthCapacity / 0x10;
@@ -391,16 +391,16 @@ void LifeMeter_Draw(GlobalContext* globalCtx) {
CLOSE_DISPS(gfxCtx);
}
void LifeMeter_UpdateSizeAndBeep(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
void LifeMeter_UpdateSizeAndBeep(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
if (interfaceCtx->lifeSizeChangeDirection != 0) {
interfaceCtx->lifeSizeChange--;
if (interfaceCtx->lifeSizeChange <= 0) {
interfaceCtx->lifeSizeChange = 0;
interfaceCtx->lifeSizeChangeDirection = 0;
if (!Player_InCsMode(&globalCtx->state) && (globalCtx->pauseCtx.state == 0) &&
(globalCtx->pauseCtx.debugState == 0) && LifeMeter_IsCritical() && !Play_InCsMode(globalCtx)) {
if (!Player_InCsMode(&play->state) && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) &&
LifeMeter_IsCritical() && !Play_InCsMode(play)) {
play_sound(NA_SE_SY_HITPOINT_ALARM);
}
}
+19 -20
View File
@@ -124,7 +124,7 @@ void Lights_BindPointWithReference(Lights* lights, LightParams* params, Vec3f* p
}
}
void Lights_BindPoint(Lights* lights, LightParams* params, GlobalContext* globalCtx) {
void Lights_BindPoint(Lights* lights, LightParams* params, PlayState* play) {
Light* light;
f32 radiusF = params->point.radius;
Vec3f posF;
@@ -135,7 +135,7 @@ void Lights_BindPoint(Lights* lights, LightParams* params, GlobalContext* global
posF.x = params->point.x;
posF.y = params->point.y;
posF.z = params->point.z;
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &posF, &adjustedPos);
SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &posF, &adjustedPos);
if ((adjustedPos.z > -radiusF) && (600 + radiusF > adjustedPos.z) && (400 > fabsf(adjustedPos.x) - radiusF) &&
(400 > fabsf(adjustedPos.y) - radiusF)) {
light = Lights_FindSlot(lights);
@@ -189,7 +189,7 @@ void Lights_BindDirectional(Lights* lights, LightParams* params, void* unused) {
* Note: Lights in a given list can only be binded to however many free slots are
* available in the Lights group. This is at most 7 slots for a new group, but could be less.
*/
void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* refPos, GlobalContext* globalCtx) {
void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* refPos, PlayState* play) {
static LightsPosBindFunc posBindFuncs[] = {
Lights_BindPoint,
(LightsPosBindFunc)Lights_BindDirectional,
@@ -204,7 +204,7 @@ void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* refPos, GlobalCo
if (listHead != NULL) {
if ((refPos == NULL) && (lights->enablePosLights == 1)) {
do {
posBindFuncs[listHead->info->type](lights, &listHead->info->params, globalCtx);
posBindFuncs[listHead->info->type](lights, &listHead->info->params, play);
listHead = listHead->next;
} while (listHead != NULL);
} else {
@@ -248,8 +248,8 @@ void Lights_FreeNode(LightNode* light) {
}
}
void LightContext_Init(GlobalContext* globalCtx, LightContext* lightCtx) {
LightContext_InitList(globalCtx, lightCtx);
void LightContext_Init(PlayState* play, LightContext* lightCtx) {
LightContext_InitList(play, lightCtx);
LightContext_SetAmbientColor(lightCtx, 80, 80, 80);
func_80102544(lightCtx, 0, 0, 0, 0x3E4, 0x3200);
bzero(&sLightsBuffer, sizeof(LightsBuffer));
@@ -276,13 +276,13 @@ Lights* LightContext_NewLights(LightContext* lightCtx, GraphicsContext* gfxCtx)
return Lights_New(gfxCtx, lightCtx->ambient.r, lightCtx->ambient.g, lightCtx->ambient.b);
}
void LightContext_InitList(GlobalContext* globalCtx, LightContext* lightCtx) {
void LightContext_InitList(PlayState* play, LightContext* lightCtx) {
lightCtx->listHead = NULL;
}
void LightContext_DestroyList(GlobalContext* globalCtx, LightContext* lightCtx) {
void LightContext_DestroyList(PlayState* play, LightContext* lightCtx) {
while (lightCtx->listHead != NULL) {
LightContext_RemoveLight(globalCtx, lightCtx, lightCtx->listHead);
LightContext_RemoveLight(play, lightCtx, lightCtx->listHead);
lightCtx->listHead = lightCtx->listHead->next;
}
}
@@ -293,7 +293,7 @@ void LightContext_DestroyList(GlobalContext* globalCtx, LightContext* lightCtx)
* Note: Due to the limited number of slots in a Lights group, inserting too many lights in the
* list may result in older entries not being bound to a Light when calling Lights_BindAll
*/
LightNode* LightContext_InsertLight(GlobalContext* globalCtx, LightContext* lightCtx, LightInfo* info) {
LightNode* LightContext_InsertLight(PlayState* play, LightContext* lightCtx, LightInfo* info) {
LightNode* light;
light = Lights_FindBufSlot();
@@ -312,7 +312,7 @@ LightNode* LightContext_InsertLight(GlobalContext* globalCtx, LightContext* ligh
return light;
}
void LightContext_RemoveLight(GlobalContext* globalCtx, LightContext* lightCtx, LightNode* light) {
void LightContext_RemoveLight(PlayState* play, LightContext* lightCtx, LightNode* light) {
if (light != NULL) {
if (light->prev != NULL) {
light->prev->next = light->next;
@@ -372,8 +372,8 @@ Lights* Lights_New(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambient
return lights;
}
void Lights_GlowCheck(GlobalContext* globalCtx) {
LightNode* light = globalCtx->lightCtx.listHead;
void Lights_GlowCheck(PlayState* play) {
LightNode* light = play->lightCtx.listHead;
while (light != NULL) {
LightPoint* params = &light->info->params.point;
@@ -386,7 +386,7 @@ void Lights_GlowCheck(GlobalContext* globalCtx) {
pos.x = params->x;
pos.y = params->y;
pos.z = params->z;
Actor_GetProjectedPos(globalCtx, &pos, &multDest, &wDest);
Actor_GetProjectedPos(play, &pos, &multDest, &wDest);
params->drawGlow = 0;
@@ -406,13 +406,13 @@ void Lights_GlowCheck(GlobalContext* globalCtx) {
}
}
void Lights_DrawGlow(GlobalContext* globalCtx) {
void Lights_DrawGlow(PlayState* play) {
Gfx* dl;
LightPoint* params;
LightNode* light = globalCtx->lightCtx.listHead;
LightNode* light = play->lightCtx.listHead;
if (light != NULL) {
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
dl = func_8012C7FC(POLY_XLU_DISP);
@@ -434,8 +434,7 @@ void Lights_DrawGlow(GlobalContext* globalCtx) {
Matrix_Translate(params->x, params->y, params->z, MTXMODE_NEW);
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(dl++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(dl++, gameplay_keep_DL_029CF0);
}
@@ -446,6 +445,6 @@ void Lights_DrawGlow(GlobalContext* globalCtx) {
POLY_XLU_DISP = dl;
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
}
+89 -89
View File
@@ -42,8 +42,8 @@ void func_80147520(void) {
D_801CFCA4[7] = D_801CFCA4[8] = 0;
}
void func_80147564(GlobalContext* globalCtx) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void func_80147564(PlayState* play) {
MessageContext* msgCtx = &play->msgCtx;
msgCtx->unk1204A[0] = 0xBD;
msgCtx->unk1204A[1] = 0xB8;
@@ -65,9 +65,9 @@ void func_80147564(GlobalContext* globalCtx) {
D_801F6B20 = 0xA;
}
s32 Message_ShouldAdvance(GlobalContext* globalCtx) {
MessageContext* msgCtx = &globalCtx->msgCtx;
Input* controller = CONTROLLER1(&globalCtx->state);
s32 Message_ShouldAdvance(PlayState* play) {
MessageContext* msgCtx = &play->msgCtx;
Input* controller = CONTROLLER1(&play->state);
if ((msgCtx->unk12020 == 0x10) || (msgCtx->unk12020 == 0x11)) {
if (CHECK_BTN_ALL(controller->press.button, BTN_A)) {
@@ -84,9 +84,9 @@ s32 Message_ShouldAdvance(GlobalContext* globalCtx) {
}
}
s32 Message_ShouldAdvanceSilent(GlobalContext* globalCtx) {
MessageContext* msgCtx = &globalCtx->msgCtx;
Input* controller = CONTROLLER1(&globalCtx->state);
s32 Message_ShouldAdvanceSilent(PlayState* play) {
MessageContext* msgCtx = &play->msgCtx;
Input* controller = CONTROLLER1(&play->state);
if (msgCtx->unk12020 == 0x10 || msgCtx->unk12020 == 0x11) {
return CHECK_BTN_ALL(controller->press.button, BTN_A);
@@ -96,10 +96,10 @@ s32 Message_ShouldAdvanceSilent(GlobalContext* globalCtx) {
}
}
void func_801477B4(GlobalContext* globalCtx) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void func_801477B4(PlayState* play) {
MessageContext* msgCtx = &play->msgCtx;
if (globalCtx->msgCtx.unk11F10 != 0) {
if (play->msgCtx.unk11F10 != 0) {
msgCtx->unk12023 = 2;
msgCtx->msgMode = 0x43;
msgCtx->unk12020 = 0;
@@ -114,10 +114,10 @@ void func_801477B4(GlobalContext* globalCtx) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80148558.s")
#ifdef NON_MATCHING
void func_80148B98(GlobalContext* globalCtx, u8 arg1) {
void func_80148B98(PlayState* play, u8 arg1) {
static s16 held = 0;
MessageContext* msgCtx = &globalCtx->msgCtx;
Input* curInput = CONTROLLER1(&globalCtx->state);
MessageContext* msgCtx = &play->msgCtx;
Input* curInput = CONTROLLER1(&play->state);
if ((curInput->rel.stick_y > 29) && held == 0) {
held = 1;
@@ -147,8 +147,8 @@ void func_80148B98(GlobalContext* globalCtx, u8 arg1) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80148B98.s")
#endif
void func_80148CBC(GlobalContext* globalCtx, UNK_PTR puParm2, u8 arg2) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void func_80148CBC(PlayState* play, UNK_PTR puParm2, u8 arg2) {
MessageContext* msgCtx = &play->msgCtx;
msgCtx->unk11FF4 = 0x30;
if (arg2 == 1) {
@@ -156,7 +156,7 @@ void func_80148CBC(GlobalContext* globalCtx, UNK_PTR puParm2, u8 arg2) {
} else {
msgCtx->unk11FF6 = msgCtx->unk11FFE[msgCtx->choiceIndex];
}
func_80147818(globalCtx, puParm2, msgCtx->unk11FF4, msgCtx->unk11FF6);
func_80147818(play, puParm2, msgCtx->unk11FF4, msgCtx->unk11FF6);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80148D64.s")
@@ -173,8 +173,8 @@ void func_80148CBC(GlobalContext* globalCtx, UNK_PTR puParm2, u8 arg2) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80149C18.s")
void Message_FindMessage(GlobalContext* globalCtx, u16 textId) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void Message_FindMessage(PlayState* play, u16 textId) {
MessageContext* msgCtx = &play->msgCtx;
Font* font = &msgCtx->font;
MessageTableEntry* msgEntry = msgCtx->messageEntryTable;
const char* segment = msgEntry->segment;
@@ -209,12 +209,12 @@ void Message_FindMessage(GlobalContext* globalCtx, u16 textId) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8014C70C.s")
void Message_LoadChar(GlobalContext* globalCtx, u16 codePointIndex, s32* offset, f32* arg3, s16 decodedBufPos) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void Message_LoadChar(PlayState* play, u16 codePointIndex, s32* offset, f32* arg3, s16 decodedBufPos) {
MessageContext* msgCtx = &play->msgCtx;
s32 temp1 = *offset;
f32 temp2 = *arg3;
Font_LoadChar(globalCtx, codePointIndex, temp1);
Font_LoadChar(play, codePointIndex, temp1);
msgCtx->decodedBuffer.wchar[decodedBufPos] = codePointIndex;
temp1 += FONT_CHAR_TEX_SIZE;
temp2 += (16.0f * msgCtx->unk12098);
@@ -223,21 +223,21 @@ void Message_LoadChar(GlobalContext* globalCtx, u16 codePointIndex, s32* offset,
}
// Message_LoadRupees JPN ?
void func_8014CCB4(GlobalContext* globalCtx, s16* decodedBufPos, s32* offset, f32* arg3) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void func_8014CCB4(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3) {
MessageContext* msgCtx = &play->msgCtx;
s16 t = *decodedBufPos;
s32 k = *offset;
f32 f = *arg3;
Font_LoadChar(globalCtx, 0x838B, k); // 0x838b = ル in JISX0213
Font_LoadChar(play, 0x838B, k); // 0x838b = ル in JISX0213
k += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.wchar[t] = 0x838B;
t += 1;
Font_LoadChar(globalCtx, 0x8373, k); // 0x8373 = ピ in JISX0213
Font_LoadChar(play, 0x8373, k); // 0x8373 = ピ in JISX0213
k += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.wchar[t] = 0x8373;
t += 1;
Font_LoadChar(globalCtx, 0x815C, k); // Ox815C = ― in JISX0213
Font_LoadChar(play, 0x815C, k); // Ox815C = ― in JISX0213
k += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.wchar[t] = 0x815C;
@@ -257,7 +257,7 @@ void func_8014CCB4(GlobalContext* globalCtx, s16* decodedBufPos, s32* offset, f3
extern u16* D_801D0188;
extern s16* D_801D0250;
void func_8014D62C(GlobalContext* arg0, s32* arg1, f32* arg2, s16* arg3) {
void func_8014D62C(PlayState* play, s32* arg1, f32* arg2, s16* arg3) {
f32 sp3C;
s16 temp_s0;
s16 temp_s1;
@@ -276,10 +276,10 @@ void func_8014D62C(GlobalContext* arg0, s32* arg1, f32* arg2, s16* arg3) {
temp_s1 = *arg3;
temp_s2 = *arg1;
sp3C = *arg2;
if ((func_8010A0A4(arg0) != 0) || (arg0->sceneNum == 0x4F)) {
if ((func_8010A0A4(play) != 0) || (play->sceneNum == 0x4F)) {
phi_v0 = 0xA;
} else {
phi_v0 = arg0->pauseCtx.unk_238[4];
phi_v0 = play->pauseCtx.unk_238[4];
}
temp_s6 = *(&D_801D0250 + (phi_v0 * 2));
phi_s0 = 0;
@@ -290,8 +290,8 @@ void func_8014D62C(GlobalContext* arg0, s32* arg1, f32* arg2, s16* arg3) {
phi_s2 = temp_s2;
do {
temp_v0 = (phi_v0 * 0x12) + &D_801D0188 + (phi_s0 * 2);
(arg0 + 0x4908 + (phi_s1 * 2))->decodedBuffer = (u16)*temp_v0;
Font_LoadChar(arg0, *temp_v0, phi_s2);
(play + 0x4908 + (phi_s1 * 2))->decodedBuffer = (u16)*temp_v0;
Font_LoadChar(play, *temp_v0, phi_s2);
temp_s0 = phi_s0 + 1;
temp_s1_2 = phi_s1 + 1;
temp_s2_2 = phi_s2 + 0x80;
@@ -304,7 +304,7 @@ void func_8014D62C(GlobalContext* arg0, s32* arg1, f32* arg2, s16* arg3) {
}
*arg3 = phi_s1_2 - 1;
*arg1 = phi_s2_2;
*arg2 = sp3C + ((f32)(temp_s6 - 1) * (16.0f * arg0->msgCtx.unk12098));
*arg2 = sp3C + ((f32)(temp_s6 - 1) * (16.0f * play->msgCtx.unk12098));
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8014D62C.s")
@@ -318,53 +318,53 @@ void func_8014D62C(GlobalContext* arg0, s32* arg1, f32* arg2, s16* arg3) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_801514B0.s")
void Message_StartTextbox(GlobalContext* globalCtx, u16 textId, Actor* Actor) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void Message_StartTextbox(PlayState* play, u16 textId, Actor* Actor) {
MessageContext* msgCtx = &play->msgCtx;
msgCtx->ocarinaAction = 0xFFFF;
func_80150D08(globalCtx, textId);
func_80150D08(play, textId);
msgCtx->unkActor = Actor;
msgCtx->msgMode = 1;
msgCtx->unk12023 = 0;
msgCtx->unk12024 = 0;
globalCtx->msgCtx.ocarinaMode = 0;
play->msgCtx.ocarinaMode = 0;
}
void func_80151938(GlobalContext* globalCtx, u16 textId) {
MessageContext* msgCtx = &globalCtx->msgCtx;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
void func_80151938(PlayState* play, u16 textId) {
MessageContext* msgCtx = &play->msgCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
msgCtx->unk11F10 = 0;
func_80150D08(globalCtx, textId);
func_80150A84(globalCtx);
func_80150D08(play, textId);
func_80150A84(play);
msgCtx->msgMode = 5;
msgCtx->unk12023 = 8;
msgCtx->unk12024 = 0;
if (interfaceCtx->unk_222 == 0) {
if (textId != 0x1B93) {
func_8011552C(globalCtx, 0x10);
func_8011552C(play, 0x10);
} else if (textId != 0xF8) {
func_8011552C(globalCtx, 6);
func_8011552C(play, 6);
}
}
msgCtx->unk1203C = msgCtx->unk1203A;
if (globalCtx->pauseCtx.unk_1F0 != 0) {
if (play->pauseCtx.unk_1F0 != 0) {
msgCtx->unk12004 = 0x22;
msgCtx->unk12006 = 0x15E;
func_80149C18(globalCtx);
func_80149C18(play);
msgCtx->unk12023 = 1;
}
}
void func_80151A68(GlobalContext* globalCtx, u16 textId) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void func_80151A68(PlayState* play, u16 textId) {
MessageContext* msgCtx = &play->msgCtx;
msgCtx->unk11F10 = 0;
func_80150D08(globalCtx, textId);
func_80150A84(globalCtx);
func_8015B198(globalCtx);
func_80150D08(play, textId);
func_80150A84(play);
func_8015B198(play);
msgCtx->msgMode = 0x45;
msgCtx->unk12024 = 0;
msgCtx->unk1203C = msgCtx->unk1203A = msgCtx->unk1201E = 0;
@@ -386,8 +386,8 @@ void func_80151A68(GlobalContext* globalCtx, u16 textId) {
}
}
void func_80151BB4(GlobalContext* globalCtx, u8 arg1) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void func_80151BB4(PlayState* play, u8 arg1) {
MessageContext* msgCtx = &play->msgCtx;
u8 temp = arg1;
if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) {
@@ -403,8 +403,8 @@ void func_80151BB4(GlobalContext* globalCtx, u8 arg1) {
}
}
u32 func_80151C9C(GlobalContext* globalCtx) {
MessageContext* msgCtx = &globalCtx->msgCtx;
u32 func_80151C9C(PlayState* play) {
MessageContext* msgCtx = &play->msgCtx;
while (true) {
if (msgCtx->unk120B1 == 0) {
@@ -419,7 +419,7 @@ u32 func_80151C9C(GlobalContext* globalCtx) {
(u8)D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]];
if ((D_801C6AB8[msgCtx->unk120B2[msgCtx->unk120B1]] != 0) && CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) {
func_80151938(globalCtx, D_801C6AB8[msgCtx->unk120B2[msgCtx->unk120B1]]);
func_80151938(play, D_801C6AB8[msgCtx->unk120B2[msgCtx->unk120B1]]);
play_sound(NA_SE_SY_SCHEDULE_WRITE);
return true;
}
@@ -429,14 +429,14 @@ u32 func_80151C9C(GlobalContext* globalCtx) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80151DA4.s")
void func_80152434(GlobalContext* globalCtx, u16 arg2) {
globalCtx->msgCtx.unk12046 = 0;
func_80151DA4(globalCtx, arg2);
void func_80152434(PlayState* play, u16 arg2) {
play->msgCtx.unk12046 = 0;
func_80151DA4(play, arg2);
}
void func_80152464(GlobalContext* globalCtx, u16 arg1) {
globalCtx->msgCtx.unk12046 = 1;
func_80151DA4(globalCtx, arg1);
void func_80152464(PlayState* play, u16 arg1) {
play->msgCtx.unk12046 = 1;
func_80151DA4(play, arg1);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/Message_GetState.s")
@@ -451,21 +451,21 @@ void func_80152C64(View* view) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80152CAC.s")
// Spawn song effect?
void func_80152EC0(GlobalContext* globalCtx) {
MessageContext* msgCtx = &globalCtx->msgCtx;
Player* player = GET_PLAYER(globalCtx);
void func_80152EC0(PlayState* play) {
MessageContext* msgCtx = &play->msgCtx;
Player* player = GET_PLAYER(play);
if (1) {}
if ((msgCtx->songPlayed < 0x17) && (msgCtx->songPlayed != 0xE) &&
((msgCtx->ocarinaAction < 0x43) || (msgCtx->ocarinaAction >= 0x47))) {
msgCtx->unk120B0 = 1;
if (msgCtx->songPlayed != 0x16) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, D_801D02D8[msgCtx->songPlayed], player->actor.world.pos.x,
Actor_Spawn(&play->actorCtx, play, D_801D02D8[msgCtx->songPlayed], player->actor.world.pos.x,
player->actor.world.pos.y, player->actor.world.pos.z, 0, 0, 0, D_801D02F8[msgCtx->songPlayed]);
return;
}
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OCEFF_WIPE4, player->actor.world.pos.x,
player->actor.world.pos.y, player->actor.world.pos.z, 0, 0, 0, 0);
Actor_Spawn(&play->actorCtx, play, ACTOR_OCEFF_WIPE4, player->actor.world.pos.x, player->actor.world.pos.y,
player->actor.world.pos.z, 0, 0, 0, 0);
}
}
@@ -473,34 +473,34 @@ void func_80152EC0(GlobalContext* globalCtx) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80153750.s")
void func_80153E7C(GlobalContext* globalCtx, void* arg1) {
if ((gSaveContext.options.language == 0) && (globalCtx->msgCtx.unk12090 == 0)) {
func_8014ADBC(globalCtx, arg1);
void func_80153E7C(PlayState* play, void* arg1) {
if ((gSaveContext.options.language == 0) && (play->msgCtx.unk12090 == 0)) {
func_8014ADBC(play, arg1);
return;
}
if (globalCtx->msgCtx.unk12090 != 0) {
func_8015E7EC(globalCtx, arg1);
if (play->msgCtx.unk12090 != 0) {
func_8015E7EC(play, arg1);
return;
}
func_8015966C(globalCtx, arg1, 0);
func_8015966C(play, arg1, 0);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80153EF0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_801541D4.s")
void func_80156758(GlobalContext* globalCtx) {
void func_80156758(PlayState* play) {
Gfx* nextDisplayList;
Gfx* polyOpa;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
GraphicsContext* gfxCtx = play->state.gfxCtx;
OPEN_DISPS(gfxCtx);
polyOpa = POLY_OPA_DISP;
nextDisplayList = Graph_GfxPlusOne(polyOpa);
gSPDisplayList(OVERLAY_DISP++, nextDisplayList);
if ((globalCtx->msgCtx.currentTextId != 0x5E6) || !Play_InCsMode(globalCtx)) {
func_801541D4(globalCtx, &nextDisplayList);
if ((play->msgCtx.currentTextId != 0x5E6) || !Play_InCsMode(play)) {
func_801541D4(play, &nextDisplayList);
}
gSPEndDisplayList(nextDisplayList++);
@@ -511,17 +511,17 @@ void func_80156758(GlobalContext* globalCtx) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8015680C.s")
void func_801586A4(GlobalContext* globalCtx) {
globalCtx->msgCtx.messageEntryTableNes = D_801C6B98;
globalCtx->msgCtx.messageTableStaff = D_801CFB08;
void func_801586A4(PlayState* play) {
play->msgCtx.messageEntryTableNes = D_801C6B98;
play->msgCtx.messageTableStaff = D_801CFB08;
}
void Message_Init(GlobalContext* globalCtx) {
void Message_Init(PlayState* play) {
Font* font;
MessageContext* messageCtx = &globalCtx->msgCtx;
MessageContext* messageCtx = &play->msgCtx;
func_801586A4(globalCtx);
globalCtx->msgCtx.ocarinaMode = 0;
func_801586A4(play);
play->msgCtx.ocarinaMode = 0;
messageCtx->msgMode = 0;
messageCtx->unk11F10 = 0;
messageCtx->currentTextId = 0;
@@ -529,10 +529,10 @@ void Message_Init(GlobalContext* globalCtx) {
messageCtx->choiceIndex = 0;
messageCtx->ocarinaAction = messageCtx->unk11FF2 = 0;
messageCtx->unk1201E = 0xFF;
View_Init(&messageCtx->view, globalCtx->state.gfxCtx);
messageCtx->unk11EF8 = THA_AllocEndAlign16(&globalCtx->state.heap, 0x13C00);
font = &globalCtx->msgCtx.font;
Font_LoadOrderedFont(&globalCtx->msgCtx.font);
View_Init(&messageCtx->view, play->state.gfxCtx);
messageCtx->unk11EF8 = THA_AllocEndAlign16(&play->state.heap, 0x13C00);
font = &play->msgCtx.font;
Font_LoadOrderedFont(&play->msgCtx.font);
font->unk_11D88 = 0;
messageCtx->unk12090 = messageCtx->unk12092 = 0;
messageCtx->unk12094 = 0;
+33 -33
View File
@@ -42,8 +42,8 @@ extern u8 D_801D0710[4];
extern u8 D_801D0714[11][16];
extern s16 D_801D07C4[11];
void Message_FindMessageNES(GlobalContext* globalCtx, u16 textId) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void Message_FindMessageNES(PlayState* play, u16 textId) {
MessageContext* msgCtx = &play->msgCtx;
Font* font = &msgCtx->font;
MessageTableEntry* msgEntry = msgCtx->messageEntryTableNes;
const char* segment = msgEntry->segment;
@@ -70,12 +70,12 @@ void Message_FindMessageNES(GlobalContext* globalCtx, u16 textId) {
font->messageEnd = nextSegment - foundSegment;
}
void Message_LoadCharNES(GlobalContext* globalCtx, u8 codePointIndex, s32* offset, f32* arg3, s16 decodedBufPos) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void Message_LoadCharNES(PlayState* play, u8 codePointIndex, s32* offset, f32* arg3, s16 decodedBufPos) {
MessageContext* msgCtx = &play->msgCtx;
s32 temp1 = *offset;
f32 temp2 = *arg3;
Font_LoadCharNES(globalCtx, codePointIndex, temp1);
Font_LoadCharNES(play, codePointIndex, temp1);
msgCtx->decodedBuffer.schar[decodedBufPos] = codePointIndex;
temp1 += FONT_CHAR_TEX_SIZE;
temp2 += (16.0f * msgCtx->unk12098);
@@ -83,35 +83,35 @@ void Message_LoadCharNES(GlobalContext* globalCtx, u8 codePointIndex, s32* offse
*arg3 = temp2;
}
void Message_LoadPluralRupeesNES(GlobalContext* globalCtx, s16* decodedBufPos, s32* offset, f32* arg3) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void Message_LoadPluralRupeesNES(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3) {
MessageContext* msgCtx = &play->msgCtx;
s16 p = *decodedBufPos;
s32 o = *offset;
f32 f = *arg3;
msgCtx->decodedBuffer.schar[p] = 0x20;
p++;
Font_LoadCharNES(globalCtx, 'R', o);
Font_LoadCharNES(play, 'R', o);
o += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.schar[p] = 'R';
p++;
Font_LoadCharNES(globalCtx, 'u', o);
Font_LoadCharNES(play, 'u', o);
o += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.schar[p] = 'u';
p++;
Font_LoadCharNES(globalCtx, 'p', o);
Font_LoadCharNES(play, 'p', o);
o += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.schar[p] = 'p';
p++;
Font_LoadCharNES(globalCtx, 'e', o);
Font_LoadCharNES(play, 'e', o);
o += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.schar[p] = 'e';
p++;
Font_LoadCharNES(globalCtx, 'e', o);
Font_LoadCharNES(play, 'e', o);
o += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.schar[p] = 'e';
p++;
Font_LoadCharNES(globalCtx, 's', o);
Font_LoadCharNES(play, 's', o);
o += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.schar[p] = 's';
@@ -121,8 +121,8 @@ void Message_LoadPluralRupeesNES(GlobalContext* globalCtx, s16* decodedBufPos, s
*arg3 = f;
}
void Message_LoadLocalizedRupeesNES(GlobalContext* globalCtx, s16* decodedBufPos, s32* offset, f32* arg3) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void Message_LoadLocalizedRupeesNES(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3) {
MessageContext* msgCtx = &play->msgCtx;
s16 p = *decodedBufPos;
s32 o = *offset;
f32 f = *arg3;
@@ -132,7 +132,7 @@ void Message_LoadLocalizedRupeesNES(GlobalContext* globalCtx, s16* decodedBufPos
p++;
for (j = 0; j < D_801D0710[gSaveContext.options.language - 1]; j++) {
Font_LoadCharNES(globalCtx, D_801D06F0[gSaveContext.options.language - 1][j], o);
Font_LoadCharNES(play, D_801D06F0[gSaveContext.options.language - 1][j], o);
msgCtx->decodedBuffer.schar[p] = D_801D06F0[gSaveContext.options.language - 1][j];
o += FONT_CHAR_TEX_SIZE;
p++;
@@ -145,37 +145,37 @@ void Message_LoadLocalizedRupeesNES(GlobalContext* globalCtx, s16* decodedBufPos
*arg3 = f;
}
void Message_LoadRupeesNES(GlobalContext* globalCtx, s16* decodedBufPos, s32* offset, f32* arg3, s16 singular) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void Message_LoadRupeesNES(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3, s16 singular) {
MessageContext* msgCtx = &play->msgCtx;
s16 p = *decodedBufPos;
s32 o = *offset;
f32 f = *arg3;
msgCtx->decodedBuffer.schar[p] = ' ';
p++;
Font_LoadCharNES(globalCtx, 'R', o);
Font_LoadCharNES(play, 'R', o);
o += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.schar[p] = 'R';
p++;
Font_LoadCharNES(globalCtx, 'u', o);
Font_LoadCharNES(play, 'u', o);
o += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.schar[p] = 'u';
p++;
Font_LoadCharNES(globalCtx, 'p', o);
Font_LoadCharNES(play, 'p', o);
o += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.schar[p] = 'p';
p++;
Font_LoadCharNES(globalCtx, 'e', o);
Font_LoadCharNES(play, 'e', o);
o += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.schar[p] = 'e';
p++;
Font_LoadCharNES(globalCtx, 'e', o);
Font_LoadCharNES(play, 'e', o);
o += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.schar[p] = 'e';
if (singular != 1) {
p++;
Font_LoadCharNES(globalCtx, 's', o);
Font_LoadCharNES(play, 's', o);
o += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.schar[p] = 's';
f += 16.0f * msgCtx->unk12098 * 6.0f;
@@ -188,8 +188,8 @@ void Message_LoadRupeesNES(GlobalContext* globalCtx, s16* decodedBufPos, s32* of
*arg3 = f;
}
void Message_LoadTimeNES(GlobalContext* globalCtx, u8 arg1, s32* offset, f32* arg3, s16* decodedBufPos) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void Message_LoadTimeNES(PlayState* play, u8 arg1, s32* offset, f32* arg3, s16* decodedBufPos) {
MessageContext* msgCtx = &play->msgCtx;
s16 p = *decodedBufPos;
s32 o = *offset;
f32 f = *arg3;
@@ -225,12 +225,12 @@ void Message_LoadTimeNES(GlobalContext* globalCtx, u8 arg1, s32* offset, f32* ar
}
for (i = 0; i < 4; i++) {
Font_LoadCharNES(globalCtx, digits[i] + '0', o);
Font_LoadCharNES(play, digits[i] + '0', o);
o += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.schar[p] = digits[i] + '0';
p++;
if (i == 1) {
Font_LoadCharNES(globalCtx, ':', o);
Font_LoadCharNES(play, ':', o);
o += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.schar[p] = ':';
p++;
@@ -243,8 +243,8 @@ void Message_LoadTimeNES(GlobalContext* globalCtx, u8 arg1, s32* offset, f32* ar
*arg3 = f;
}
void Message_LoadAreaTextNES(GlobalContext* globalCtx, s32* offset, f32* arg2, s16* decodedBufPos) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void Message_LoadAreaTextNES(PlayState* play, s32* offset, f32* arg2, s16* decodedBufPos) {
MessageContext* msgCtx = &play->msgCtx;
s16 p = *decodedBufPos;
s32 o = *offset;
f32 f = *arg2;
@@ -253,10 +253,10 @@ void Message_LoadAreaTextNES(GlobalContext* globalCtx, s32* offset, f32* arg2, s
s16 currentArea;
s16 stringLimit;
if ((func_8010A0A4(globalCtx) != 0) || (globalCtx->sceneNum == SCENE_SECOM)) {
if ((func_8010A0A4(play) != 0) || (play->sceneNum == SCENE_SECOM)) {
currentArea = 10;
} else {
currentArea = globalCtx->pauseCtx.unk_238[4];
currentArea = play->pauseCtx.unk_238[4];
}
stringLimit = D_801D07C4[currentArea];
@@ -264,7 +264,7 @@ void Message_LoadAreaTextNES(GlobalContext* globalCtx, s32* offset, f32* arg2, s
msgCtx->decodedBuffer.schar[p] = D_801D0714[currentArea][i];
currentChar = msgCtx->decodedBuffer.schar[p];
if (currentChar != ' ') {
Font_LoadCharNES(globalCtx, D_801D0714[currentArea][i], o);
Font_LoadCharNES(play, D_801D0714[currentArea][i], o);
o += FONT_CHAR_TEX_SIZE;
}
currentChar = msgCtx->decodedBuffer.schar[p];
+2 -2
View File
@@ -1,8 +1,8 @@
#include "global.h"
#include "message_data_static.h"
void Message_FindCreditsMessage(GlobalContext* globalCtx, u16 textId) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void Message_FindCreditsMessage(PlayState* play, u16 textId) {
MessageContext* msgCtx = &play->msgCtx;
Font* font = &msgCtx->font;
MessageTableEntry* msgEntry = msgCtx->messageTableStaff;
const char* segment = msgEntry->segment;
+2 -2
View File
@@ -1,10 +1,10 @@
#include "global.h"
Path* Path_GetByIndex(GlobalContext* globalCtx, s16 index, s16 max) {
Path* Path_GetByIndex(PlayState* play, s16 index, s16 max) {
Path* path;
if (index != max) {
path = &globalCtx->setupPathList[index];
path = &play->setupPathList[index];
} else {
path = NULL;
}
+63 -63
View File
@@ -58,8 +58,8 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Update.s")
s32 Play_InCsMode(GlobalContext* globalCtx) {
return (globalCtx->csCtx.state != 0) || Player_InCsMode(&globalCtx->state);
s32 Play_InCsMode(PlayState* this) {
return (this->csCtx.state != 0) || Player_InCsMode(&this->state);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169100.s")
@@ -154,113 +154,113 @@ s16 Play_GetOriginalSceneNumber(s16 sceneNum) {
* Copies the flags set in ActorContext over to the current scene's CycleSceneFlags, usually using the original scene
* number. Exception for Inverted Stone Tower Temple, which uses its own.
*/
void Play_SaveCycleSceneFlags(GameState* gameState) {
GlobalContext* globalCtx = (GlobalContext*)gameState;
void Play_SaveCycleSceneFlags(GameState* thisx) {
PlayState* this = (PlayState*)thisx;
CycleSceneFlags* cycleSceneFlags;
cycleSceneFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(globalCtx->sceneNum)];
cycleSceneFlags->chest = globalCtx->actorCtx.flags.chest;
cycleSceneFlags->switch0 = globalCtx->actorCtx.flags.switches[0];
cycleSceneFlags->switch1 = globalCtx->actorCtx.flags.switches[1];
cycleSceneFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(this->sceneNum)];
cycleSceneFlags->chest = this->actorCtx.flags.chest;
cycleSceneFlags->switch0 = this->actorCtx.flags.switches[0];
cycleSceneFlags->switch1 = this->actorCtx.flags.switches[1];
if (globalCtx->sceneNum == SCENE_INISIE_R) { // Inverted Stone Tower Temple
cycleSceneFlags = &gSaveContext.cycleSceneFlags[globalCtx->sceneNum];
if (this->sceneNum == SCENE_INISIE_R) { // Inverted Stone Tower Temple
cycleSceneFlags = &gSaveContext.cycleSceneFlags[this->sceneNum];
}
cycleSceneFlags->collectible = globalCtx->actorCtx.flags.collectible[0];
cycleSceneFlags->clearedRoom = globalCtx->actorCtx.flags.clearedRoom;
cycleSceneFlags->collectible = this->actorCtx.flags.collectible[0];
cycleSceneFlags->clearedRoom = this->actorCtx.flags.clearedRoom;
}
void Play_SetRespawnData(GameState* gameState, s32 respawnMode, u16 entranceIndex, s32 roomIndex, s32 playerParams,
void Play_SetRespawnData(GameState* thisx, s32 respawnMode, u16 entranceIndex, s32 roomIndex, s32 playerParams,
Vec3f* pos, s16 yaw) {
GlobalContext* globalCtx = (GlobalContext*)gameState;
PlayState* this = (PlayState*)thisx;
gSaveContext.respawn[respawnMode].entranceIndex = Entrance_CreateIndex(entranceIndex >> 9, 0, entranceIndex & 0xF);
gSaveContext.respawn[respawnMode].roomIndex = roomIndex;
gSaveContext.respawn[respawnMode].pos = *pos;
gSaveContext.respawn[respawnMode].yaw = yaw;
gSaveContext.respawn[respawnMode].playerParams = playerParams;
gSaveContext.respawn[respawnMode].tempSwitchFlags = globalCtx->actorCtx.flags.switches[2];
gSaveContext.respawn[respawnMode].unk_18 = globalCtx->actorCtx.flags.collectible[1];
gSaveContext.respawn[respawnMode].tempCollectFlags = globalCtx->actorCtx.flags.collectible[2];
gSaveContext.respawn[respawnMode].tempSwitchFlags = this->actorCtx.flags.switches[2];
gSaveContext.respawn[respawnMode].unk_18 = this->actorCtx.flags.collectible[1];
gSaveContext.respawn[respawnMode].tempCollectFlags = this->actorCtx.flags.collectible[2];
}
void Play_SetupRespawnPoint(GameState* gameState, s32 respawnMode, s32 playerParams) {
GlobalContext* globalCtx = (GlobalContext*)gameState;
Player* player = GET_PLAYER(globalCtx);
void Play_SetupRespawnPoint(GameState* thisx, s32 respawnMode, s32 playerParams) {
PlayState* this = (PlayState*)thisx;
Player* player = GET_PLAYER(this);
if (globalCtx->sceneNum != SCENE_KAKUSIANA) { // Grottos
Play_SetRespawnData(&globalCtx->state, respawnMode, (u16)((void)0, gSaveContext.save.entranceIndex),
globalCtx->roomCtx.currRoom.num, playerParams, &player->actor.world.pos,
if (this->sceneNum != SCENE_KAKUSIANA) { // Grottos
Play_SetRespawnData(&this->state, respawnMode, (u16)((void)0, gSaveContext.save.entranceIndex),
this->roomCtx.currRoom.num, playerParams, &player->actor.world.pos,
player->actor.shape.rot.y);
}
}
// Override respawn data in Sakon's Hideout
void func_80169ECC(GlobalContext* globalCtx) {
if (globalCtx->sceneNum == SCENE_SECOM) {
globalCtx->nextEntranceIndex = 0x2060;
void func_80169ECC(PlayState* this) {
if (this->sceneNum == SCENE_SECOM) {
this->nextEntranceIndex = 0x2060;
gSaveContext.respawnFlag = -7;
}
}
// Gameplay_TriggerVoidOut ?
// Used by Player, Ikana_Rotaryroom, Bji01, Kakasi, LiftNuts, Test4, Warptag, WarpUzu, Roomtimer
void func_80169EFC(GameState* gameState) {
GlobalContext* globalCtx = (GlobalContext*)gameState;
void func_80169EFC(GameState* thisx) {
PlayState* this = (PlayState*)thisx;
gSaveContext.respawn[RESTART_MODE_DOWN].tempSwitchFlags = globalCtx->actorCtx.flags.switches[2];
gSaveContext.respawn[RESTART_MODE_DOWN].unk_18 = globalCtx->actorCtx.flags.collectible[1];
gSaveContext.respawn[RESTART_MODE_DOWN].tempCollectFlags = globalCtx->actorCtx.flags.collectible[2];
globalCtx->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_DOWN].entranceIndex;
gSaveContext.respawn[RESTART_MODE_DOWN].tempSwitchFlags = this->actorCtx.flags.switches[2];
gSaveContext.respawn[RESTART_MODE_DOWN].unk_18 = this->actorCtx.flags.collectible[1];
gSaveContext.respawn[RESTART_MODE_DOWN].tempCollectFlags = this->actorCtx.flags.collectible[2];
this->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_DOWN].entranceIndex;
gSaveContext.respawnFlag = 1;
func_80169ECC(globalCtx);
globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 2;
func_80169ECC(this);
this->sceneLoadFlag = 0x14;
this->unk_1887F = 2;
}
// Gameplay_LoadToLastEntrance ?
// Used by game_over and Test7
void func_80169F78(GameState* gameState) {
GlobalContext* globalCtx = (GlobalContext*)gameState;
void func_80169F78(GameState* thisx) {
PlayState* this = (PlayState*)thisx;
globalCtx->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_TOP].entranceIndex;
this->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_TOP].entranceIndex;
gSaveContext.respawnFlag = -1;
func_80169ECC(globalCtx);
globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 2;
func_80169ECC(this);
this->sceneLoadFlag = 0x14;
this->unk_1887F = 2;
}
// Gameplay_TriggerRespawn ?
// Used for void by Wallmaster, Deku Shrine doors. Also used by Player, Kaleido, DoorWarp1
void func_80169FDC(GameState* gameState) {
func_80169F78(gameState);
void func_80169FDC(GameState* thisx) {
func_80169F78(thisx);
}
// Used by Kankyo to determine how to change the lighting, e.g. for game over.
s32 func_80169FFC(GameState* gameState) {
GlobalContext* globalCtx = (GlobalContext*)gameState;
s32 func_80169FFC(GameState* thisx) {
PlayState* this = (PlayState*)thisx;
return globalCtx->roomCtx.currRoom.mesh->type0.type != 1;
return this->roomCtx.currRoom.mesh->type0.type != 1;
}
s32 FrameAdvance_IsEnabled(GameState* gameState) {
GlobalContext* globalCtx = (GlobalContext*)gameState;
s32 FrameAdvance_IsEnabled(GameState* thisx) {
PlayState* this = (PlayState*)thisx;
return globalCtx->frameAdvCtx.enabled != 0;
return this->frameAdvCtx.enabled != 0;
}
// Unused, unchanged from OoT, which uses it only in one Camera function.
/**
* @brief Tests if \p actor is a door and the sides are different rooms.
*
* @param[in] gameState GameState, promoted to globalCtx inside.
* @param[in] thisx GameState, promoted to play inside.
* @param[in] actor Actor to test.
* @param[out] yaw Facing angle of the actor, or reverse if in the back room.
* @return true if \p actor is a door and the sides are in different rooms, false otherwise
*/
s32 func_8016A02C(GameState* gameState, Actor* actor, s16* yaw) {
GlobalContext* globalCtx = (GlobalContext*)gameState;
s32 func_8016A02C(GameState* thisx, Actor* actor, s16* yaw) {
PlayState* this = (PlayState*)thisx;
TransitionActorEntry* transitionActor;
s8 frontRoom;
@@ -268,7 +268,7 @@ s32 func_8016A02C(GameState* gameState, Actor* actor, s16* yaw) {
return false;
}
transitionActor = &globalCtx->doorCtx.transitionActorList[(u16)actor->params >> 10];
transitionActor = &this->doorCtx.transitionActorList[(u16)actor->params >> 10];
frontRoom = transitionActor->sides[0].room;
if (frontRoom == transitionActor->sides[1].room) {
return false;
@@ -287,11 +287,11 @@ s32 func_8016A02C(GameState* gameState, Actor* actor, s16* yaw) {
/**
* @brief Tests if \p pos is underwater.
*
* @param[in] globalCtx GlobalContext
* @param[in] play PlayState
* @param[in] pos position to test
* @return true if inside a waterbox and not above a void.
*/
s32 Play_IsUnderwater(GlobalContext* globalCtx, Vec3f* pos) {
s32 Play_IsUnderwater(PlayState* this, Vec3f* pos) {
WaterBox* waterBox;
CollisionPoly* poly;
Vec3f waterSurfacePos;
@@ -299,10 +299,10 @@ s32 Play_IsUnderwater(GlobalContext* globalCtx, Vec3f* pos) {
waterSurfacePos = *pos;
if ((WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, waterSurfacePos.x, waterSurfacePos.z, &waterSurfacePos.y,
if ((WaterBox_GetSurface1(this, &this->colCtx, waterSurfacePos.x, waterSurfacePos.z, &waterSurfacePos.y,
&waterBox) == true) &&
(pos->y < waterSurfacePos.y) &&
(BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &poly, &bgId, &waterSurfacePos) != BGCHECK_Y_MIN)) {
(BgCheck_EntityRaycastFloor3(&this->colCtx, &poly, &bgId, &waterSurfacePos) != BGCHECK_Y_MIN)) {
return true;
} else {
return false;
@@ -320,17 +320,17 @@ extern s16 D_801D0D64[];
// Used by Player
/**
* Extract the common actor cutscene ids used by Player from the scene and set the actor cutscene ids in
* globalCtx->playerActorCsIds. If a playerActorCsId is not present in the scene, then that particular id is set
* this->playerActorCsIds. If a playerActorCsId is not present in the scene, then that particular id is set
* to -1. Otherwise, if there is an ActorCutscene where csCamSceneDataId matches the appropriate element of D_801D0D64,
* set the corresponding playerActorCsId (and possibly change its priority for the zeroth one)
*/
void Play_AssignPlayerActorCsIdsFromScene(GameState* gameState, s32 startActorCsId) {
GlobalContext* globalCtx = (GlobalContext*)gameState;
void Play_AssignPlayerActorCsIdsFromScene(GameState* thisx, s32 startActorCsId) {
PlayState* this = (PlayState*)thisx;
s32 i;
s16* curPlayerActorCsId = globalCtx->playerActorCsIds;
s16* curPlayerActorCsId = this->playerActorCsIds;
s16* phi_s1 = D_801D0D64;
for (i = 0; i < ARRAY_COUNT(globalCtx->playerActorCsIds); i++, curPlayerActorCsId++, phi_s1++) {
for (i = 0; i < ARRAY_COUNT(this->playerActorCsIds); i++, curPlayerActorCsId++, phi_s1++) {
ActorCutscene* actorCutscene;
s32 curActorCsId;
@@ -352,7 +352,7 @@ void Play_AssignPlayerActorCsIdsFromScene(GameState* gameState, s32 startActorCs
}
// These regs are used by Gameplay_Draw, and several actors, purpose as yet unclear.
void func_8016A268(GameState* gameState, s16 arg1, u8 arg2, u8 arg3, u8 arg4, u8 arg5) {
void func_8016A268(GameState* thisx, s16 arg1, u8 arg2, u8 arg3, u8 arg4, u8 arg5) {
MREG(64) = arg1;
MREG(65) = arg2;
MREG(66) = arg3;
+16 -16
View File
@@ -9,10 +9,10 @@ ActorFunc sPlayerCallDestroyFunc;
ActorFunc sPlayerCallUpdateFunc;
ActorFunc sPlayerCallDrawFunc;
void PlayerCall_Init(Actor* thisx, GlobalContext* globalCtx);
void PlayerCall_Destroy(Actor* thisx, GlobalContext* globalCtx);
void PlayerCall_Update(Actor* thisx, GlobalContext* globalCtx);
void PlayerCall_Draw(Actor* thisx, GlobalContext* globalCtx);
void PlayerCall_Init(Actor* thisx, PlayState* play);
void PlayerCall_Destroy(Actor* thisx, PlayState* play);
void PlayerCall_Update(Actor* thisx, PlayState* play);
void PlayerCall_Draw(Actor* thisx, PlayState* play);
const ActorInit Player_InitVars = {
ACTOR_PLAYER,
@@ -26,10 +26,10 @@ const ActorInit Player_InitVars = {
(ActorFunc)PlayerCall_Draw,
};
void Player_Init(Actor* thisx, GlobalContext* globalCtx);
void Player_Destroy(Actor* thisx, GlobalContext* globalCtx);
void Player_Update(Actor* thisx, GlobalContext* globalCtx);
void Player_Draw(Actor* thisx, GlobalContext* globalCtx);
void Player_Init(Actor* thisx, PlayState* play);
void Player_Destroy(Actor* thisx, PlayState* play);
void Player_Update(Actor* thisx, PlayState* play);
void Player_Draw(Actor* thisx, PlayState* play);
void PlayerCall_InitFuncPtrs(void) {
sPlayerCallInitFunc = KaleidoManager_GetRamAddr(Player_Init);
@@ -38,23 +38,23 @@ void PlayerCall_InitFuncPtrs(void) {
sPlayerCallDrawFunc = KaleidoManager_GetRamAddr(Player_Draw);
}
void PlayerCall_Init(Actor* thisx, GlobalContext* globalCtx) {
void PlayerCall_Init(Actor* thisx, PlayState* play) {
KaleidoScopeCall_LoadPlayer();
PlayerCall_InitFuncPtrs();
sPlayerCallInitFunc(thisx, globalCtx);
sPlayerCallInitFunc(thisx, play);
}
void PlayerCall_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void PlayerCall_Destroy(Actor* thisx, PlayState* play) {
KaleidoScopeCall_LoadPlayer();
sPlayerCallDestroyFunc(thisx, globalCtx);
sPlayerCallDestroyFunc(thisx, play);
}
void PlayerCall_Update(Actor* thisx, GlobalContext* globalCtx) {
void PlayerCall_Update(Actor* thisx, PlayState* play) {
KaleidoScopeCall_LoadPlayer();
sPlayerCallUpdateFunc(thisx, globalCtx);
sPlayerCallUpdateFunc(thisx, play);
}
void PlayerCall_Draw(Actor* thisx, GlobalContext* globalCtx) {
void PlayerCall_Draw(Actor* thisx, PlayState* play) {
KaleidoScopeCall_LoadPlayer();
sPlayerCallDrawFunc(thisx, globalCtx);
sPlayerCallDrawFunc(thisx, play);
}
+15 -15
View File
@@ -303,7 +303,7 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
s32 ret;
u32 eq;
Vec3f originVec;
GlobalContext* globalCtx = camera->globalCtx;
PlayState* play = camera->play;
originVec.x = 0.0f;
originVec.y = 0.0f;
@@ -326,7 +326,7 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
for (idx = 0; idx < ARRAY_COUNT(sQuakeRequest); idx++) {
req = &sQuakeRequest[idx];
if (req->callbackIdx != 0) {
if (globalCtx->cameraPtrs[req->camId] == NULL) {
if (play->cameraPtrs[req->camId] == NULL) {
Quake_Remove(req);
} else {
eq = (camera->camId != req->camera->camId);
@@ -382,9 +382,9 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
return ret;
}
void Distortion_Init(GlobalContext* globalCtx) {
sDistortionContext.globalCtx = globalCtx;
View_ClearDistortion(&globalCtx->view);
void Distortion_Init(PlayState* play) {
sDistortionContext.play = play;
View_ClearDistortion(&play->view);
sDistortionContext.type = 0;
sDistortionContext.countdown = 0;
sDistortionContext.state = DISTORTION_INACTIVE;
@@ -419,9 +419,9 @@ void Distortion_ClearType(s32 type) {
* Checks that the bg surface is an underwater conveyor type and if so, returns the conveyor speed
*/
s32 Distortion_GetUnderwaterCurrentSpeed(Player* player) {
if (SurfaceType_GetConveyorType(&sDistortionContext.globalCtx->colCtx, player->actor.floorPoly,
if (SurfaceType_GetConveyorType(&sDistortionContext.play->colCtx, player->actor.floorPoly,
player->actor.floorBgId) == CONVEYOR_WATER) {
return SurfaceType_GetConveyorSpeed(&sDistortionContext.globalCtx->colCtx, player->actor.floorPoly,
return SurfaceType_GetConveyorSpeed(&sDistortionContext.play->colCtx, player->actor.floorPoly,
player->actor.floorBgId);
}
return 0;
@@ -446,9 +446,9 @@ void Distortion_Update(void) {
f32 zScale;
f32 speed;
Player* player;
GlobalContext* globalCtx = sDistortionContext.globalCtx;
PlayState* play = sDistortionContext.play;
PosRot playerPosRot;
Camera* camera = GET_ACTIVE_CAM(globalCtx);
Camera* camera = GET_ACTIVE_CAM(play);
f32 speedRatio = CLAMP_MAX(camera->speedRatio, 1.0f);
if (sDistortionContext.type != 0) {
@@ -636,7 +636,7 @@ void Distortion_Update(void) {
screenPlanePhase = 0x156;
sDistortionContext.countdown = 2;
player = GET_PLAYER(globalCtx);
player = GET_PLAYER(play);
if (player != NULL) {
Actor_GetWorldPosShapeRot(&playerPosRot, &player->actor);
@@ -688,7 +688,7 @@ void Distortion_Update(void) {
screenPlanePhase = 0x156;
sDistortionContext.countdown = 2;
player = GET_PLAYER(globalCtx);
player = GET_PLAYER(play);
depthPhaseStep = 359.2f;
screenPlanePhaseStep = -18.5f;
@@ -759,20 +759,20 @@ void Distortion_Update(void) {
depthPhase += DEGF_TO_BINANG(depthPhaseStep);
screenPlanePhase += DEGF_TO_BINANG(screenPlanePhaseStep);
View_SetDistortionDirRot(&sDistortionContext.globalCtx->view,
View_SetDistortionDirRot(&sDistortionContext.play->view,
Math_CosS(depthPhase) * (DEGF_TO_RADF(rotX) * xyScaleFactor),
Math_SinS(depthPhase) * (DEGF_TO_RADF(rotY) * xyScaleFactor),
Math_SinS(screenPlanePhase) * (DEGF_TO_RADF(rotZ) * zScaleFactor));
View_SetDistortionScale(&sDistortionContext.globalCtx->view,
View_SetDistortionScale(&sDistortionContext.play->view,
(Math_SinS(screenPlanePhase) * (xScale * xyScaleFactor)) + 1.0f,
(Math_CosS(screenPlanePhase) * (yScale * xyScaleFactor)) + 1.0f,
(Math_CosS(depthPhase) * (zScale * zScaleFactor)) + 1.0f);
View_SetDistortionSpeed(&sDistortionContext.globalCtx->view, speed * speedScaleFactor);
View_SetDistortionSpeed(&sDistortionContext.play->view, speed * speedScaleFactor);
sDistortionContext.state = DISTORTION_ACTIVE;
} else if (sDistortionContext.state != DISTORTION_INACTIVE) {
View_ClearDistortion(&globalCtx->view);
View_ClearDistortion(&play->view);
sDistortionContext.state = DISTORTION_INACTIVE;
sDistortionContext.countdown = 0;
+2 -2
View File
@@ -896,8 +896,8 @@ void func_8012C240(GraphicsContext* gfxCtx) {
gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x19]);
}
void func_8012C268(GlobalContext* globalCtx) {
func_8012C28C(globalCtx->state.gfxCtx);
void func_8012C268(PlayState* play) {
func_8012C28C(play->state.gfxCtx);
}
void func_8012C28C(GraphicsContext* gfxCtx) {
+34 -34
View File
@@ -1,30 +1,30 @@
#include "global.h"
void Room_nop8012D510(GlobalContext* globalCtx, Room* room, UNK_PTR param_3, UNK_TYPE1 param_4) {
void Room_nop8012D510(PlayState* play, Room* room, UNK_PTR param_3, UNK_TYPE1 param_4) {
}
void Room_DrawType3Mesh(GlobalContext* globalCtx, Room* room, u32 flags) {
void Room_DrawType3Mesh(PlayState* play, Room* room, u32 flags) {
}
void Room_DrawType0Mesh(GlobalContext* globalCtx, Room* room, u32 flags) {
void Room_DrawType0Mesh(PlayState* play, Room* room, u32 flags) {
RoomMeshType0* mesh;
s32 i;
RoomMeshType0Params* meshParams;
GraphicsContext* gfxCtx;
UNK_TYPE4 pad;
gfxCtx = globalCtx->state.gfxCtx;
gfxCtx = play->state.gfxCtx;
if (flags & 1) {
func_800BCBF4(&D_801C1D10, globalCtx);
func_800BCBF4(&D_801C1D10, play);
gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment);
func_8012C268(globalCtx);
func_8012C268(play);
gSPMatrix(gfxCtx->polyOpa.p++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD);
}
if (flags & 2) {
func_800BCC68(&D_801C1D10, globalCtx);
func_800BCC68(&D_801C1D10, play);
gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment);
func_8012C2DC(globalCtx->state.gfxCtx);
func_8012C2DC(play->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD);
}
@@ -51,18 +51,18 @@ void Room_DrawType0Mesh(GlobalContext* globalCtx, Room* room, u32 flags) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_8012E32C.s")
void Room_DrawType1Mesh(GlobalContext* globalCtx, Room* room, u32 flags) {
void Room_DrawType1Mesh(PlayState* play, Room* room, u32 flags) {
RoomMeshType1* mesh = &room->mesh->type1;
if (mesh->format == 1) {
func_8012DEE8(globalCtx, room, flags);
func_8012DEE8(play, room, flags);
} else if (mesh->format == 2) {
func_8012E32C(globalCtx, room, flags);
func_8012E32C(play, room, flags);
} else {
__assert("../z_room.c", 0x3c5);
}
}
void Room_Init(GlobalContext* globalCtx, RoomContext* roomCtx) {
void Room_Init(PlayState* play, RoomContext* roomCtx) {
s32 i;
roomCtx->currRoom.num = -1;
roomCtx->currRoom.segment = NULL;
@@ -75,7 +75,7 @@ void Room_Init(GlobalContext* globalCtx, RoomContext* roomCtx) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/Room_AllocateAndLoad.s")
s32 Room_StartRoomTransition(GlobalContext* globalCtx, RoomContext* roomCtx, s32 index) {
s32 Room_StartRoomTransition(PlayState* play, RoomContext* roomCtx, s32 index) {
if (roomCtx->unk31 == 0) {
s32 size;
@@ -84,14 +84,14 @@ s32 Room_StartRoomTransition(GlobalContext* globalCtx, RoomContext* roomCtx, s32
roomCtx->currRoom.segment = NULL;
roomCtx->unk31 = 1;
size = globalCtx->roomList[index].vromEnd - globalCtx->roomList[index].vromStart;
size = play->roomList[index].vromEnd - play->roomList[index].vromStart;
roomCtx->activeRoomVram =
(void*)(((s32)roomCtx->roomMemPages[roomCtx->activeMemPage] - (size + 8) * roomCtx->activeMemPage + 8) &
0xfffffff0);
osCreateMesgQueue(&roomCtx->loadQueue, roomCtx->loadMsg, 1);
DmaMgr_SendRequestImpl(&roomCtx->dmaRequest, roomCtx->activeRoomVram, globalCtx->roomList[index].vromStart,
size, 0, &roomCtx->loadQueue, NULL);
DmaMgr_SendRequestImpl(&roomCtx->dmaRequest, roomCtx->activeRoomVram, play->roomList[index].vromStart, size, 0,
&roomCtx->loadQueue, NULL);
roomCtx->activeMemPage ^= 1;
return 1;
@@ -100,7 +100,7 @@ s32 Room_StartRoomTransition(GlobalContext* globalCtx, RoomContext* roomCtx, s32
return 0;
}
s32 Room_HandleLoadCallbacks(GlobalContext* globalCtx, RoomContext* roomCtx) {
s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) {
if (roomCtx->unk31 == 1) {
if (!osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK)) {
roomCtx->unk31 = 0;
@@ -108,18 +108,18 @@ s32 Room_HandleLoadCallbacks(GlobalContext* globalCtx, RoomContext* roomCtx) {
// TODO: Segment number enum
gSegments[0x03] = PHYSICAL_TO_VIRTUAL(roomCtx->activeRoomVram);
Scene_ProcessHeader(globalCtx, (SceneCmd*)roomCtx->currRoom.segment);
func_80123140(globalCtx, GET_PLAYER(globalCtx));
Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx);
Scene_ProcessHeader(play, (SceneCmd*)roomCtx->currRoom.segment);
func_80123140(play, GET_PLAYER(play));
Actor_SpawnTransitionActors(play, &play->actorCtx);
if (((globalCtx->sceneNum != SCENE_IKANA) || (roomCtx->currRoom.num != 1)) &&
(globalCtx->sceneNum != SCENE_IKNINSIDE)) {
globalCtx->envCtx.lightSettingOverride = 0xff;
globalCtx->envCtx.unk_E0 = 0;
if (((play->sceneNum != SCENE_IKANA) || (roomCtx->currRoom.num != 1)) &&
(play->sceneNum != SCENE_IKNINSIDE)) {
play->envCtx.lightSettingOverride = 0xff;
play->envCtx.unk_E0 = 0;
}
func_800FEAB0();
if (!func_800FE4B8(globalCtx)) {
func_800FD858(globalCtx);
if (!func_800FE4B8(play)) {
func_800FD858(play);
}
} else {
return 0;
@@ -129,23 +129,23 @@ s32 Room_HandleLoadCallbacks(GlobalContext* globalCtx, RoomContext* roomCtx) {
return 1;
}
void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags) {
void Room_Draw(PlayState* play, Room* room, u32 flags) {
if (room->segment != NULL) {
// TODO: Segment number enum
gSegments[0x03] = PHYSICAL_TO_VIRTUAL(room->segment);
roomDrawFuncs[room->mesh->type0.type](globalCtx, room, flags);
roomDrawFuncs[room->mesh->type0.type](play, room, flags);
}
return;
}
void func_8012EBF8(GlobalContext* globalCtx, RoomContext* roomCtx) {
void func_8012EBF8(PlayState* play, RoomContext* roomCtx) {
roomCtx->prevRoom.num = -1;
roomCtx->prevRoom.segment = NULL;
func_800BA798(globalCtx, &globalCtx->actorCtx);
Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx);
func_800BA798(play, &play->actorCtx);
Actor_SpawnTransitionActors(play, &play->actorCtx);
if (-1 < roomCtx->currRoom.num) {
func_8010A33C(globalCtx, roomCtx->currRoom.num);
func_8010A2DC(globalCtx);
func_8010A33C(play, roomCtx->currRoom.num);
func_8010A2DC(play);
}
func_801A3CD8(globalCtx->roomCtx.currRoom.echo);
func_801A3CD8(play->roomCtx.currRoom.echo);
}
+120 -120
View File
@@ -23,17 +23,17 @@ s32 Object_Spawn(ObjectContext* objectCtx, s16 id) {
}
void Object_InitBank(GameState* gameState, ObjectContext* objectCtx) {
GlobalContext* globalCtx = (GlobalContext*)gameState;
PlayState* play = (PlayState*)gameState;
s32 pad;
u32 spaceSize;
s32 i;
if (globalCtx->sceneNum == SCENE_CLOCKTOWER || globalCtx->sceneNum == SCENE_TOWN ||
globalCtx->sceneNum == SCENE_BACKTOWN || globalCtx->sceneNum == SCENE_ICHIBA) {
if (play->sceneNum == SCENE_CLOCKTOWER || play->sceneNum == SCENE_TOWN || play->sceneNum == SCENE_BACKTOWN ||
play->sceneNum == SCENE_ICHIBA) {
spaceSize = OBJECT_SPACE_SIZE_CLOCK_TOWN;
} else if (globalCtx->sceneNum == SCENE_MILK_BAR) {
} else if (play->sceneNum == SCENE_MILK_BAR) {
spaceSize = OBJECT_SPACE_SIZE_MILK_BAR;
} else if (globalCtx->sceneNum == SCENE_00KEIKOKU) {
} else if (play->sceneNum == SCENE_00KEIKOKU) {
spaceSize = OBJECT_SPACE_SIZE_TERMINA_FIELD;
} else {
spaceSize = OBJECT_SPACE_SIZE_DEFAULT;
@@ -141,45 +141,45 @@ void* func_8012F73C(ObjectContext* objectCtx, s32 iParm2, s16 id) {
}
// SceneTableEntry Header Command 0x00: Spawn List
void Scene_HeaderCmdSpawnList(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_HeaderCmdSpawnList(PlayState* play, SceneCmd* cmd) {
s32 loadedCount;
s16 playerObjectId;
void* nextObject;
globalCtx->linkActorEntry = (ActorEntry*)Lib_SegmentedToVirtual(cmd->spawnList.segment) +
globalCtx->setupEntranceList[globalCtx->curSpawn].spawn;
if ((globalCtx->linkActorEntry->params & 0x0F00) >> 8 == 0x0C ||
play->linkActorEntry =
(ActorEntry*)Lib_SegmentedToVirtual(cmd->spawnList.segment) + play->setupEntranceList[play->curSpawn].spawn;
if ((play->linkActorEntry->params & 0x0F00) >> 8 == 0x0C ||
(gSaveContext.respawnFlag == 0x02 && gSaveContext.respawn[RESTART_MODE_RETURN].playerParams == 0x0CFF)) {
// Skull Kid Object
Object_Spawn(&globalCtx->objectCtx, OBJECT_STK);
Object_Spawn(&play->objectCtx, OBJECT_STK);
return;
}
loadedCount = Object_Spawn(&globalCtx->objectCtx, OBJECT_LINK_CHILD);
nextObject = globalCtx->objectCtx.status[globalCtx->objectCtx.num].segment;
globalCtx->objectCtx.num = loadedCount;
globalCtx->objectCtx.spawnedObjectCount = loadedCount;
loadedCount = Object_Spawn(&play->objectCtx, OBJECT_LINK_CHILD);
nextObject = play->objectCtx.status[play->objectCtx.num].segment;
play->objectCtx.num = loadedCount;
play->objectCtx.spawnedObjectCount = loadedCount;
playerObjectId = gLinkFormObjectIndexes[(void)0, gSaveContext.save.playerForm];
gActorOverlayTable[0].initInfo->objectId = playerObjectId;
Object_Spawn(&globalCtx->objectCtx, playerObjectId);
Object_Spawn(&play->objectCtx, playerObjectId);
globalCtx->objectCtx.status[globalCtx->objectCtx.num].segment = nextObject;
play->objectCtx.status[play->objectCtx.num].segment = nextObject;
}
// SceneTableEntry Header Command 0x01: Actor List
void Scene_HeaderCmdActorList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->numSetupActors = cmd->actorList.num;
globalCtx->setupActorList = Lib_SegmentedToVirtual(cmd->actorList.segment);
globalCtx->actorCtx.unkC = 0;
void Scene_HeaderCmdActorList(PlayState* play, SceneCmd* cmd) {
play->numSetupActors = cmd->actorList.num;
play->setupActorList = Lib_SegmentedToVirtual(cmd->actorList.segment);
play->actorCtx.unkC = 0;
}
// SceneTableEntry Header Command 0x02: List of cameras for actor cutscenes
void Scene_HeaderCmdActorCutsceneCamList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->csCamData = Lib_SegmentedToVirtual(cmd->csCameraList.segment);
void Scene_HeaderCmdActorCutsceneCamList(PlayState* play, SceneCmd* cmd) {
play->csCamData = Lib_SegmentedToVirtual(cmd->csCameraList.segment);
}
// SceneTableEntry Header Command 0x03: Collision Header
void Scene_HeaderCmdColHeader(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_HeaderCmdColHeader(PlayState* play, SceneCmd* cmd) {
CollisionHeader* colHeaderTemp;
CollisionHeader* colHeader;
@@ -200,55 +200,55 @@ void Scene_HeaderCmdColHeader(GlobalContext* globalCtx, SceneCmd* cmd) {
colHeader->waterBoxes = Lib_SegmentedToVirtual(colHeader->waterBoxes);
}
BgCheck_Allocate(&globalCtx->colCtx, globalCtx, colHeader);
BgCheck_Allocate(&play->colCtx, play, colHeader);
}
// SceneTableEntry Header Command 0x04: Room List
void Scene_HeaderCmdRoomList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->numRooms = cmd->roomList.num;
globalCtx->roomList = Lib_SegmentedToVirtual(cmd->roomList.segment);
void Scene_HeaderCmdRoomList(PlayState* play, SceneCmd* cmd) {
play->numRooms = cmd->roomList.num;
play->roomList = Lib_SegmentedToVirtual(cmd->roomList.segment);
}
// SceneTableEntry Header Command 0x06: Entrance List
void Scene_HeaderCmdEntranceList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->setupEntranceList = Lib_SegmentedToVirtual(cmd->entranceList.segment);
void Scene_HeaderCmdEntranceList(PlayState* play, SceneCmd* cmd) {
play->setupEntranceList = Lib_SegmentedToVirtual(cmd->entranceList.segment);
}
// SceneTableEntry Header Command 0x07: Special Files
void Scene_HeaderCmdSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_HeaderCmdSpecialFiles(PlayState* play, SceneCmd* cmd) {
static RomFile tatlMessageFiles[2] = {
{ SEGMENT_ROM_START(elf_message_field), SEGMENT_ROM_END(elf_message_field) },
{ SEGMENT_ROM_START(elf_message_ydan), SEGMENT_ROM_END(elf_message_ydan) },
};
if (cmd->specialFiles.subKeepIndex != 0) {
globalCtx->objectCtx.subKeepIndex = Object_Spawn(&globalCtx->objectCtx, cmd->specialFiles.subKeepIndex);
play->objectCtx.subKeepIndex = Object_Spawn(&play->objectCtx, cmd->specialFiles.subKeepIndex);
// TODO: Segment number enum?
gSegments[0x05] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment);
gSegments[0x05] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment);
}
if (cmd->specialFiles.cUpElfMsgNum != 0) {
globalCtx->unk_18868 = Play_LoadScene(globalCtx, &tatlMessageFiles[cmd->specialFiles.cUpElfMsgNum - 1]);
play->unk_18868 = Play_LoadScene(play, &tatlMessageFiles[cmd->specialFiles.cUpElfMsgNum - 1]);
}
}
// SceneTableEntry Header Command 0x08: Room Behavior
void Scene_HeaderCmdRoomBehavior(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->roomCtx.currRoom.unk3 = cmd->roomBehavior.gpFlag1;
globalCtx->roomCtx.currRoom.unk2 = cmd->roomBehavior.gpFlag2 & 0xFF;
globalCtx->roomCtx.currRoom.unk5 = (cmd->roomBehavior.gpFlag2 >> 8) & 1;
globalCtx->msgCtx.unk12044 = (cmd->roomBehavior.gpFlag2 >> 0xa) & 1;
globalCtx->roomCtx.currRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xb) & 1;
globalCtx->envCtx.unk_E2 = (cmd->roomBehavior.gpFlag2 >> 0xc) & 1;
void Scene_HeaderCmdRoomBehavior(PlayState* play, SceneCmd* cmd) {
play->roomCtx.currRoom.unk3 = cmd->roomBehavior.gpFlag1;
play->roomCtx.currRoom.unk2 = cmd->roomBehavior.gpFlag2 & 0xFF;
play->roomCtx.currRoom.unk5 = (cmd->roomBehavior.gpFlag2 >> 8) & 1;
play->msgCtx.unk12044 = (cmd->roomBehavior.gpFlag2 >> 0xa) & 1;
play->roomCtx.currRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xb) & 1;
play->envCtx.unk_E2 = (cmd->roomBehavior.gpFlag2 >> 0xc) & 1;
}
// SceneTableEntry Header Command 0x0A: Mesh Header
void Scene_HeaderCmdMesh(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->roomCtx.currRoom.mesh = Lib_SegmentedToVirtual(cmd->mesh.segment);
void Scene_HeaderCmdMesh(PlayState* play, SceneCmd* cmd) {
play->roomCtx.currRoom.mesh = Lib_SegmentedToVirtual(cmd->mesh.segment);
}
// SceneTableEntry Header Command 0x0B: Object List
void Scene_HeaderCmdObjectList(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_HeaderCmdObjectList(PlayState* play, SceneCmd* cmd) {
s32 i;
s32 j;
s32 k;
@@ -260,21 +260,21 @@ void Scene_HeaderCmdObjectList(GlobalContext* globalCtx, SceneCmd* cmd) {
objectEntry = Lib_SegmentedToVirtual(cmd->objectList.segment);
k = 0;
i = globalCtx->objectCtx.spawnedObjectCount;
status = &globalCtx->objectCtx.status[i];
firstObject = globalCtx->objectCtx.status;
i = play->objectCtx.spawnedObjectCount;
status = &play->objectCtx.status[i];
firstObject = play->objectCtx.status;
while (i < globalCtx->objectCtx.num) {
while (i < play->objectCtx.num) {
if (status->id != *objectEntry) {
status2 = &globalCtx->objectCtx.status[i];
status2 = &play->objectCtx.status[i];
for (j = i; j < globalCtx->objectCtx.num; j++) {
for (j = i; j < play->objectCtx.num; j++) {
status2->id = 0;
status2++;
}
globalCtx->objectCtx.num = i;
func_800BA6FC(globalCtx, &globalCtx->actorCtx);
play->objectCtx.num = i;
func_800BA6FC(play, &play->actorCtx);
continue;
}
@@ -286,7 +286,7 @@ void Scene_HeaderCmdObjectList(GlobalContext* globalCtx, SceneCmd* cmd) {
}
while (k < cmd->objectList.num) {
nextPtr = func_8012F73C(&globalCtx->objectCtx, i, *objectEntry);
nextPtr = func_8012F73C(&play->objectCtx, i, *objectEntry);
if (i < OBJECT_EXCHANGE_BANK_MAX - 1) {
firstObject[i + 1].segment = nextPtr;
@@ -297,30 +297,30 @@ void Scene_HeaderCmdObjectList(GlobalContext* globalCtx, SceneCmd* cmd) {
objectEntry++;
}
globalCtx->objectCtx.num = i;
play->objectCtx.num = i;
}
// SceneTableEntry Header Command 0x0C: Light List
void Scene_HeaderCmdLightList(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_HeaderCmdLightList(PlayState* play, SceneCmd* cmd) {
s32 i;
LightInfo* lightInfo = Lib_SegmentedToVirtual(cmd->lightList.segment);
for (i = 0; i < cmd->lightList.num; i++) {
LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, lightInfo);
LightContext_InsertLight(play, &play->lightCtx, lightInfo);
lightInfo++;
}
}
// SceneTableEntry Header Command 0x0D: Path List
void Scene_HeaderCmdPathList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->setupPathList = Lib_SegmentedToVirtual(cmd->pathList.segment);
void Scene_HeaderCmdPathList(PlayState* play, SceneCmd* cmd) {
play->setupPathList = Lib_SegmentedToVirtual(cmd->pathList.segment);
}
// SceneTableEntry Header Command 0x0E: Transition Actor List
void Scene_HeaderCmdTransiActorList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->doorCtx.numTransitionActors = cmd->transiActorList.num;
globalCtx->doorCtx.transitionActorList = Lib_SegmentedToVirtual(cmd->transiActorList.segment);
func_80105818(globalCtx, globalCtx->doorCtx.numTransitionActors, globalCtx->doorCtx.transitionActorList);
void Scene_HeaderCmdTransiActorList(PlayState* play, SceneCmd* cmd) {
play->doorCtx.numTransitionActors = cmd->transiActorList.num;
play->doorCtx.transitionActorList = Lib_SegmentedToVirtual(cmd->transiActorList.segment);
func_80105818(play, play->doorCtx.numTransitionActors, play->doorCtx.transitionActorList);
}
// Init function for the transition system.
@@ -329,16 +329,16 @@ void Door_InitContext(GameState* state, DoorContext* doorCtx) {
}
// SceneTableEntry Header Command 0x0F: Environment Light Settings List
void Scene_HeaderCmdEnvLightSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->envCtx.numLightSettings = cmd->lightSettingList.num;
globalCtx->envCtx.lightSettingsList = Lib_SegmentedToVirtual(cmd->lightSettingList.segment);
void Scene_HeaderCmdEnvLightSettings(PlayState* play, SceneCmd* cmd) {
play->envCtx.numLightSettings = cmd->lightSettingList.num;
play->envCtx.lightSettingsList = Lib_SegmentedToVirtual(cmd->lightSettingList.segment);
}
/**
* Loads different texture files for each region of the world.
* These later are stored in segment 0x06, and used in maps.
*/
void Scene_LoadAreaTextures(GlobalContext* globalCtx, s32 fileIndex) {
void Scene_LoadAreaTextures(PlayState* play, s32 fileIndex) {
static RomFile sceneTextureFiles[9] = {
{ 0, 0 }, // Default
{ SEGMENT_ROM_START(scene_texture_01), SEGMENT_ROM_END(scene_texture_01) },
@@ -354,51 +354,51 @@ void Scene_LoadAreaTextures(GlobalContext* globalCtx, s32 fileIndex) {
size_t size = sceneTextureFiles[fileIndex].vromEnd - vromStart;
if (size != 0) {
globalCtx->roomCtx.unk74 = THA_AllocEndAlign16(&globalCtx->state.heap, size);
DmaMgr_SendRequest0(globalCtx->roomCtx.unk74, vromStart, size);
play->roomCtx.unk74 = THA_AllocEndAlign16(&play->state.heap, size);
DmaMgr_SendRequest0(play->roomCtx.unk74, vromStart, size);
}
}
// SceneTableEntry Header Command 0x11: Skybox Settings
void Scene_HeaderCmdSkyboxSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->skyboxId = cmd->skyboxSettings.skyboxId & 3;
globalCtx->envCtx.unk_17 = globalCtx->envCtx.unk_18 = cmd->skyboxSettings.unk5;
globalCtx->envCtx.unk_1E = cmd->skyboxSettings.unk6;
Scene_LoadAreaTextures(globalCtx, cmd->skyboxSettings.data1);
void Scene_HeaderCmdSkyboxSettings(PlayState* play, SceneCmd* cmd) {
play->skyboxId = cmd->skyboxSettings.skyboxId & 3;
play->envCtx.unk_17 = play->envCtx.unk_18 = cmd->skyboxSettings.unk5;
play->envCtx.unk_1E = cmd->skyboxSettings.unk6;
Scene_LoadAreaTextures(play, cmd->skyboxSettings.data1);
}
// SceneTableEntry Header Command 0x12: Skybox Disables
void Scene_HeaderCmdSkyboxDisables(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->envCtx.skyboxDisabled = cmd->skyboxDisables.unk4;
globalCtx->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk5;
void Scene_HeaderCmdSkyboxDisables(PlayState* play, SceneCmd* cmd) {
play->envCtx.skyboxDisabled = cmd->skyboxDisables.unk4;
play->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk5;
}
// SceneTableEntry Header Command 0x10: Time Settings
void Scene_HeaderCmdTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_HeaderCmdTimeSettings(PlayState* play, SceneCmd* cmd) {
if (cmd->timeSettings.hour != 0xFF && cmd->timeSettings.min != 0xFF) {
gSaveContext.environmentTime = gSaveContext.save.time =
(u16)(((cmd->timeSettings.hour + (cmd->timeSettings.min / 60.0f)) * 60.0f) / 0.021972656f);
}
if (cmd->timeSettings.unk6 != 0xFF) {
globalCtx->envCtx.timeIncrement = cmd->timeSettings.unk6;
play->envCtx.timeIncrement = cmd->timeSettings.unk6;
} else {
globalCtx->envCtx.timeIncrement = 0;
play->envCtx.timeIncrement = 0;
}
if ((gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) && (globalCtx->envCtx.timeIncrement != 0)) {
globalCtx->envCtx.timeIncrement = 5;
if ((gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) && (play->envCtx.timeIncrement != 0)) {
play->envCtx.timeIncrement = 5;
}
if (gSaveContext.sunsSongState == SUNSSONG_INACTIVE) {
REG(15) = globalCtx->envCtx.timeIncrement;
REG(15) = play->envCtx.timeIncrement;
}
globalCtx->envCtx.unk_4 = -(Math_SinS(((void)0, gSaveContext.save.time) - 0x8000) * 120.0f) * 25.0f;
globalCtx->envCtx.unk_8 = (Math_CosS(((void)0, gSaveContext.save.time) - 0x8000) * 120.0f) * 25.0f;
globalCtx->envCtx.unk_C = (Math_CosS(((void)0, gSaveContext.save.time) - 0x8000) * 20.0f) * 25.0f;
play->envCtx.unk_4 = -(Math_SinS(((void)0, gSaveContext.save.time) - 0x8000) * 120.0f) * 25.0f;
play->envCtx.unk_8 = (Math_CosS(((void)0, gSaveContext.save.time) - 0x8000) * 120.0f) * 25.0f;
play->envCtx.unk_C = (Math_CosS(((void)0, gSaveContext.save.time) - 0x8000) * 20.0f) * 25.0f;
if (globalCtx->envCtx.timeIncrement == 0 && gSaveContext.save.cutscene < 0xFFF0) {
if (play->envCtx.timeIncrement == 0 && gSaveContext.save.cutscene < 0xFFF0) {
gSaveContext.environmentTime = gSaveContext.save.time;
if (gSaveContext.environmentTime >= CLOCK_TIME(4, 0) && gSaveContext.environmentTime < CLOCK_TIME(6, 30)) {
@@ -417,30 +417,30 @@ void Scene_HeaderCmdTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
}
// SceneTableEntry Header Command 0x05: Wind Settings
void Scene_HeaderCmdWindSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_HeaderCmdWindSettings(PlayState* play, SceneCmd* cmd) {
s8 temp1 = cmd->windSettings.west;
s8 temp2 = cmd->windSettings.vertical;
s8 temp3 = cmd->windSettings.south;
globalCtx->envCtx.windDir.x = temp1;
globalCtx->envCtx.windDir.y = temp2;
globalCtx->envCtx.windDir.z = temp3;
globalCtx->envCtx.windSpeed = cmd->windSettings.clothIntensity;
play->envCtx.windDir.x = temp1;
play->envCtx.windDir.y = temp2;
play->envCtx.windDir.z = temp3;
play->envCtx.windSpeed = cmd->windSettings.clothIntensity;
}
// SceneTableEntry Header Command 0x13: Exit List
void Scene_HeaderCmdExitList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->setupExitList = Lib_SegmentedToVirtual(cmd->exitList.segment);
void Scene_HeaderCmdExitList(PlayState* play, SceneCmd* cmd) {
play->setupExitList = Lib_SegmentedToVirtual(cmd->exitList.segment);
}
// SceneTableEntry Header Command 0x09: Undefined
void Scene_HeaderCmd09(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_HeaderCmd09(PlayState* play, SceneCmd* cmd) {
}
// SceneTableEntry Header Command 0x15: Sound Settings=
void Scene_HeaderCmdSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->soundCtx.seqIndex = cmd->soundSettings.musicSeq;
globalCtx->soundCtx.nightSeqIndex = cmd->soundSettings.nighttimeSFX;
void Scene_HeaderCmdSoundSettings(PlayState* play, SceneCmd* cmd) {
play->soundCtx.seqIndex = cmd->soundSettings.musicSeq;
play->soundCtx.nightSeqIndex = cmd->soundSettings.nighttimeSFX;
if (gSaveContext.seqIndex == (u8)NA_BGM_DISABLED || func_801A8A50(0) == NA_BGM_FINAL_HOURS) {
audio_setBGM(cmd->soundSettings.bgmId);
@@ -448,12 +448,12 @@ void Scene_HeaderCmdSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
}
// SceneTableEntry Header Command 0x16: Echo Setting
void Scene_HeaderCmdEchoSetting(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->roomCtx.currRoom.echo = cmd->echoSettings.echo;
void Scene_HeaderCmdEchoSetting(PlayState* play, SceneCmd* cmd) {
play->roomCtx.currRoom.echo = cmd->echoSettings.echo;
}
// SceneTableEntry Header Command 0x18: Alternate Header List=
void Scene_HeaderCmdAltHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_HeaderCmdAltHeaderList(PlayState* play, SceneCmd* cmd) {
SceneCmd** altHeaderList;
SceneCmd* altHeader;
@@ -462,40 +462,40 @@ void Scene_HeaderCmdAltHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) {
altHeader = altHeaderList[gSaveContext.sceneSetupIndex - 1];
if (altHeader != NULL) {
Scene_ProcessHeader(globalCtx, Lib_SegmentedToVirtual(altHeader));
Scene_ProcessHeader(play, Lib_SegmentedToVirtual(altHeader));
(cmd + 1)->base.code = 0x14;
}
}
}
// SceneTableEntry Header Command 0x17: Cutscene List
void Scene_HeaderCmdCutsceneList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->csCtx.sceneCsCount = cmd->base.data1;
globalCtx->csCtx.sceneCsList = Lib_SegmentedToVirtual(cmd->base.data2);
void Scene_HeaderCmdCutsceneList(PlayState* play, SceneCmd* cmd) {
play->csCtx.sceneCsCount = cmd->base.data1;
play->csCtx.sceneCsList = Lib_SegmentedToVirtual(cmd->base.data2);
}
// SceneTableEntry Header Command 0x1B: Actor Cutscene List
void Scene_HeaderCmdActorCutsceneList(GlobalContext* globalCtx, SceneCmd* cmd) {
ActorCutscene_Init(globalCtx, Lib_SegmentedToVirtual(cmd->cutsceneActorList.segment), cmd->cutsceneActorList.num);
void Scene_HeaderCmdActorCutsceneList(PlayState* play, SceneCmd* cmd) {
ActorCutscene_Init(play, Lib_SegmentedToVirtual(cmd->cutsceneActorList.segment), cmd->cutsceneActorList.num);
}
// SceneTableEntry Header Command 0x1C: Mini Maps
void Scene_HeaderCmdMiniMap(GlobalContext* globalCtx, SceneCmd* cmd) {
func_80104CF4(globalCtx);
func_8010549C(globalCtx, cmd->minimapSettings.segment);
void Scene_HeaderCmdMiniMap(PlayState* play, SceneCmd* cmd) {
func_80104CF4(play);
func_8010549C(play, cmd->minimapSettings.segment);
}
// SceneTableEntry Header Command 0x1D: Undefined
void Scene_HeaderCmd1D(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_HeaderCmd1D(PlayState* play, SceneCmd* cmd) {
}
// SceneTableEntry Header Command 0x1E: Minimap Compass Icon Info
void Scene_HeaderCmdMiniMapCompassInfo(GlobalContext* globalCtx, SceneCmd* cmd) {
func_8010565C(globalCtx, cmd->minimapChests.num, cmd->minimapChests.segment);
void Scene_HeaderCmdMiniMapCompassInfo(PlayState* play, SceneCmd* cmd) {
func_8010565C(play, cmd->minimapChests.num, cmd->minimapChests.segment);
}
// SceneTableEntry Header Command 0x1A: Sets Area Visited Flag
void Scene_HeaderCmdSetAreaVisitedFlag(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_HeaderCmdSetAreaVisitedFlag(PlayState* play, SceneCmd* cmd) {
s16 j = 0;
s16 i = 0;
@@ -509,7 +509,7 @@ void Scene_HeaderCmdSetAreaVisitedFlag(GlobalContext* globalCtx, SceneCmd* cmd)
}
}
if (globalCtx->sceneNum == gScenesPerRegion[i][j]) {
if (play->sceneNum == gScenesPerRegion[i][j]) {
break;
}
@@ -522,22 +522,22 @@ void Scene_HeaderCmdSetAreaVisitedFlag(GlobalContext* globalCtx, SceneCmd* cmd)
}
// SceneTableEntry Header Command 0x1A: Material Animations
void Scene_HeaderCmdAnimatedMaterials(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->sceneMaterialAnims = (AnimatedMaterial*)Lib_SegmentedToVirtual(cmd->textureAnimations.segment);
void Scene_HeaderCmdAnimatedMaterials(PlayState* play, SceneCmd* cmd) {
play->sceneMaterialAnims = (AnimatedMaterial*)Lib_SegmentedToVirtual(cmd->textureAnimations.segment);
}
/**
* Sets the exit fade from the next entrance index.
*/
void Scene_SetExitFade(GlobalContext* globalCtx) {
globalCtx->unk_1887F = Entrance_GetTransitionFlags(globalCtx->nextEntranceIndex) & 0x7F;
void Scene_SetExitFade(PlayState* play) {
play->unk_1887F = Entrance_GetTransitionFlags(play->nextEntranceIndex) & 0x7F;
}
/**
* Executes all of the commands in a scene or room header.
*/
s32 Scene_ProcessHeader(GlobalContext* globalCtx, SceneCmd* header) {
static void (*sceneCmdHandlers[])(GlobalContext*, SceneCmd*) = {
s32 Scene_ProcessHeader(PlayState* play, SceneCmd* header) {
static void (*sceneCmdHandlers[])(PlayState*, SceneCmd*) = {
Scene_HeaderCmdSpawnList,
Scene_HeaderCmdActorList,
Scene_HeaderCmdActorCutsceneCamList,
@@ -580,7 +580,7 @@ s32 Scene_ProcessHeader(GlobalContext* globalCtx, SceneCmd* header) {
}
if (cmdId < SCENE_CMD_MAX) {
sceneCmdHandlers[cmdId](globalCtx, header);
sceneCmdHandlers[cmdId](play, header);
}
header++;
+117 -120
View File
@@ -22,8 +22,8 @@ static Gfx sSceneDrawDefaultDL[] = {
/**
* Executes the current scene draw config handler.
*/
void Scene_ExecuteDrawConfig(GlobalContext* globalCtx) {
static void (*sceneDrawConfigHandlers[])(GlobalContext*) = {
void Scene_ExecuteDrawConfig(PlayState* play) {
static void (*sceneDrawConfigHandlers[])(PlayState*) = {
Scene_DrawConfigDefault,
Scene_DrawConfigMatAnim,
Scene_DrawConfigDoNothing,
@@ -34,27 +34,27 @@ void Scene_ExecuteDrawConfig(GlobalContext* globalCtx) {
Scene_DrawConfigMatAnimManualStep,
};
sceneDrawConfigHandlers[globalCtx->sceneConfig](globalCtx);
sceneDrawConfigHandlers[play->sceneConfig](play);
}
/**
* SceneTableEntry Draw Config 0:
* Default scene draw config function. This just executes `sSceneDrawDefaultDL`.
*/
void Scene_DrawConfigDefault(GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
void Scene_DrawConfigDefault(PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
gSPDisplayList(POLY_OPA_DISP++, sSceneDrawDefaultDL);
gSPDisplayList(POLY_XLU_DISP++, sSceneDrawDefaultDL);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* Returns a pointer to a single layer texture scroll displaylist.
*/
Gfx* AnimatedMat_TexScroll(GlobalContext* globalCtx, AnimatedMatTexScrollParams* params) {
return Gfx_TexScroll(globalCtx->state.gfxCtx, params->xStep * sMatAnimStep, -(params->yStep * sMatAnimStep),
Gfx* AnimatedMat_TexScroll(PlayState* play, AnimatedMatTexScrollParams* params) {
return Gfx_TexScroll(play->state.gfxCtx, params->xStep * sMatAnimStep, -(params->yStep * sMatAnimStep),
params->width, params->height);
}
@@ -62,11 +62,11 @@ Gfx* AnimatedMat_TexScroll(GlobalContext* globalCtx, AnimatedMatTexScrollParams*
* Animated Material Type 0:
* Scrolls a single layer texture using the provided `AnimatedMatTexScrollParams`.
*/
void AnimatedMat_DrawTexScroll(GlobalContext* globalCtx, s32 segment, void* params) {
void AnimatedMat_DrawTexScroll(PlayState* play, s32 segment, void* params) {
AnimatedMatTexScrollParams* texScrollParams = (AnimatedMatTexScrollParams*)params;
Gfx* texScrollDList = AnimatedMat_TexScroll(globalCtx, texScrollParams);
Gfx* texScrollDList = AnimatedMat_TexScroll(play, texScrollParams);
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
if (sMatAnimFlags & 1) {
gSPSegment(POLY_OPA_DISP++, segment, texScrollDList);
@@ -76,28 +76,27 @@ void AnimatedMat_DrawTexScroll(GlobalContext* globalCtx, s32 segment, void* para
gSPSegment(POLY_XLU_DISP++, segment, texScrollDList);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* Returns a pointer to a two layer texture scroll displaylist.
*/
Gfx* AnimatedMat_TwoLayerTexScroll(GlobalContext* globalCtx, AnimatedMatTexScrollParams* params) {
return Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, params[0].xStep * sMatAnimStep,
-(params[0].yStep * sMatAnimStep), params[0].width, params[0].height, 1,
params[1].xStep * sMatAnimStep, -(params[1].yStep * sMatAnimStep), params[1].width,
params[1].height);
Gfx* AnimatedMat_TwoLayerTexScroll(PlayState* play, AnimatedMatTexScrollParams* params) {
return Gfx_TwoTexScroll(play->state.gfxCtx, 0, params[0].xStep * sMatAnimStep, -(params[0].yStep * sMatAnimStep),
params[0].width, params[0].height, 1, params[1].xStep * sMatAnimStep,
-(params[1].yStep * sMatAnimStep), params[1].width, params[1].height);
}
/**
* Animated Material Type 1:
* Scrolls a two layer texture using the provided `AnimatedMatTexScrollParams`.
*/
void AnimatedMat_DrawTwoTexScroll(GlobalContext* globalCtx, s32 segment, void* params) {
void AnimatedMat_DrawTwoTexScroll(PlayState* play, s32 segment, void* params) {
AnimatedMatTexScrollParams* texScrollParams = (AnimatedMatTexScrollParams*)params;
Gfx* texScrollDList = AnimatedMat_TwoLayerTexScroll(globalCtx, texScrollParams);
Gfx* texScrollDList = AnimatedMat_TwoLayerTexScroll(play, texScrollParams);
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
if (sMatAnimFlags & 1) {
gSPSegment(POLY_OPA_DISP++, segment, texScrollDList);
@@ -107,16 +106,16 @@ void AnimatedMat_DrawTwoTexScroll(GlobalContext* globalCtx, s32 segment, void* p
gSPSegment(POLY_XLU_DISP++, segment, texScrollDList);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* Generates a displaylist that sets the prim and env color, and stores it in the provided segment ID.
*/
void AnimatedMat_SetColor(GlobalContext* globalCtx, s32 segment, F3DPrimColor* primColorResult, F3DEnvColor* envColor) {
Gfx* colorDList = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(Gfx) * 4);
void AnimatedMat_SetColor(PlayState* play, s32 segment, F3DPrimColor* primColorResult, F3DEnvColor* envColor) {
Gfx* colorDList = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Gfx) * 4);
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
// clang-format off
if (sMatAnimFlags & 1) { gSPSegment(POLY_OPA_DISP++, segment, colorDList); }
@@ -132,14 +131,14 @@ void AnimatedMat_SetColor(GlobalContext* globalCtx, s32 segment, F3DPrimColor* p
gSPEndDisplayList(colorDList++);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* Animated Material Type 2:
* Color key frame animation without linear interpolation.
*/
void AnimatedMat_DrawColor(GlobalContext* globalCtx, s32 segment, void* params) {
void AnimatedMat_DrawColor(PlayState* play, s32 segment, void* params) {
AnimatedMatColorParams* colorAnimParams = (AnimatedMatColorParams*)params;
F3DPrimColor* primColor = Lib_SegmentedToVirtual(colorAnimParams->primColors);
F3DEnvColor* envColor;
@@ -150,7 +149,7 @@ void AnimatedMat_DrawColor(GlobalContext* globalCtx, s32 segment, void* params)
? (F3DEnvColor*)Lib_SegmentedToVirtual(colorAnimParams->envColors) + curFrame
: NULL;
AnimatedMat_SetColor(globalCtx, segment, primColor, envColor);
AnimatedMat_SetColor(play, segment, primColor, envColor);
}
/**
@@ -164,7 +163,7 @@ s32 AnimatedMat_Lerp(s32 min, s32 max, f32 norm) {
* Animated Material Type 3:
* Color key frame animation with linear interpolation.
*/
void AnimatedMat_DrawColorLerp(GlobalContext* globalCtx, s32 segment, void* params) {
void AnimatedMat_DrawColorLerp(PlayState* play, s32 segment, void* params) {
AnimatedMatColorParams* colorAnimParams = (AnimatedMatColorParams*)params;
F3DPrimColor* primColorMax = Lib_SegmentedToVirtual(colorAnimParams->primColors);
F3DEnvColor* envColorMax;
@@ -216,7 +215,7 @@ void AnimatedMat_DrawColorLerp(GlobalContext* globalCtx, s32 segment, void* para
envColorMax = NULL;
}
AnimatedMat_SetColor(globalCtx, segment, &primColorResult, (envColorMax != NULL) ? &envColorResult : NULL);
AnimatedMat_SetColor(play, segment, &primColorResult, (envColorMax != NULL) ? &envColorResult : NULL);
}
/**
@@ -277,7 +276,7 @@ u8 Scene_LagrangeInterpColor(s32 n, f32 x[], f32 fx[], f32 xp) {
* Animated Material Type 4:
* Color key frame animation with non-linear interpolation.
*/
void AnimatedMat_DrawColorNonLinearInterp(GlobalContext* globalCtx, s32 segment, void* params) {
void AnimatedMat_DrawColorNonLinearInterp(PlayState* play, s32 segment, void* params) {
AnimatedMatColorParams* colorAnimParams = (AnimatedMatColorParams*)params;
F3DPrimColor* primColorCur = Lib_SegmentedToVirtual(colorAnimParams->primColors);
F3DEnvColor* envColorCur = Lib_SegmentedToVirtual(colorAnimParams->envColors);
@@ -355,21 +354,21 @@ void AnimatedMat_DrawColorNonLinearInterp(GlobalContext* globalCtx, s32 segment,
envColorCur = NULL;
}
AnimatedMat_SetColor(globalCtx, segment, &primColorResult, (envColorCur != NULL) ? &envColorResult : NULL);
AnimatedMat_SetColor(play, segment, &primColorResult, (envColorCur != NULL) ? &envColorResult : NULL);
}
/**
* Animated Material Type 5:
* Cycles between a list of textures (imagine like a GIF)
*/
void AnimatedMat_DrawTexCycle(GlobalContext* globalCtx, s32 segment, void* params) {
void AnimatedMat_DrawTexCycle(PlayState* play, s32 segment, void* params) {
AnimatedMatTexCycleParams* texAnimParams = params;
void** texList = Lib_SegmentedToVirtual(texAnimParams->textureList);
u8* texId = Lib_SegmentedToVirtual(texAnimParams->textureIndexList);
s32 curFrame = sMatAnimStep % texAnimParams->keyFrameLength;
void* tex = Lib_SegmentedToVirtual(texList[texId[curFrame]]);
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
if (sMatAnimFlags & 1) {
gSPSegment(POLY_OPA_DISP++, segment, tex);
@@ -379,15 +378,15 @@ void AnimatedMat_DrawTexCycle(GlobalContext* globalCtx, s32 segment, void* param
gSPSegment(POLY_XLU_DISP++, segment, tex);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* This is the main function that handles the animated material system.
* There are six different animated material types, which should be set in the provided `AnimatedMaterial`.
*/
void AnimatedMat_DrawMain(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step, u32 flags) {
static void (*matAnimDrawHandlers[])(GlobalContext*, s32 segment, void* params) = {
void AnimatedMat_DrawMain(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step, u32 flags) {
static void (*matAnimDrawHandlers[])(PlayState*, s32 segment, void* params) = {
AnimatedMat_DrawTexScroll, AnimatedMat_DrawTwoTexScroll, AnimatedMat_DrawColor,
AnimatedMat_DrawColorLerp, AnimatedMat_DrawColorNonLinearInterp, AnimatedMat_DrawTexCycle,
};
@@ -402,7 +401,7 @@ void AnimatedMat_DrawMain(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f
do {
segment = matAnim->segment;
segmentAbs = ((segment < 0) ? -segment : segment) + 7;
matAnimDrawHandlers[matAnim->type](globalCtx, segmentAbs, Lib_SegmentedToVirtual(matAnim->params));
matAnimDrawHandlers[matAnim->type](play, segmentAbs, Lib_SegmentedToVirtual(matAnim->params));
matAnim++;
} while (segment >= 0);
}
@@ -411,123 +410,123 @@ void AnimatedMat_DrawMain(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f
/**
* Draws an animated material to both OPA and XLU buffers.
*/
void AnimatedMat_Draw(GlobalContext* globalCtx, AnimatedMaterial* matAnim) {
AnimatedMat_DrawMain(globalCtx, matAnim, 1, globalCtx->gameplayFrames, 3);
void AnimatedMat_Draw(PlayState* play, AnimatedMaterial* matAnim) {
AnimatedMat_DrawMain(play, matAnim, 1, play->gameplayFrames, 3);
}
/**
* Draws an animated material to only the OPA buffer.
*/
void AnimatedMat_DrawOpa(GlobalContext* globalCtx, AnimatedMaterial* matAnim) {
AnimatedMat_DrawMain(globalCtx, matAnim, 1, globalCtx->gameplayFrames, 1);
void AnimatedMat_DrawOpa(PlayState* play, AnimatedMaterial* matAnim) {
AnimatedMat_DrawMain(play, matAnim, 1, play->gameplayFrames, 1);
}
/**
* Draws an animated material to only the XLU buffer.
*/
void AnimatedMat_DrawXlu(GlobalContext* globalCtx, AnimatedMaterial* matAnim) {
AnimatedMat_DrawMain(globalCtx, matAnim, 1, globalCtx->gameplayFrames, 2);
void AnimatedMat_DrawXlu(PlayState* play, AnimatedMaterial* matAnim) {
AnimatedMat_DrawMain(play, matAnim, 1, play->gameplayFrames, 2);
}
/**
* Draws an animated material with an alpha ratio (0.0 - 1.0) both OPA and XLU buffers.
*/
void AnimatedMat_DrawAlpha(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio) {
AnimatedMat_DrawMain(globalCtx, matAnim, alphaRatio, globalCtx->gameplayFrames, 3);
void AnimatedMat_DrawAlpha(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio) {
AnimatedMat_DrawMain(play, matAnim, alphaRatio, play->gameplayFrames, 3);
}
/**
* Draws an animated material with an alpha ratio (0.0 - 1.0) to only the OPA buffer.
*/
void AnimatedMat_DrawAlphaOpa(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio) {
AnimatedMat_DrawMain(globalCtx, matAnim, alphaRatio, globalCtx->gameplayFrames, 1);
void AnimatedMat_DrawAlphaOpa(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio) {
AnimatedMat_DrawMain(play, matAnim, alphaRatio, play->gameplayFrames, 1);
}
/**
* Draws an animated material with an alpha ratio (0.0 - 1.0) to only the XLU buffer.
*/
void AnimatedMat_DrawAlphaXlu(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio) {
AnimatedMat_DrawMain(globalCtx, matAnim, alphaRatio, globalCtx->gameplayFrames, 2);
void AnimatedMat_DrawAlphaXlu(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio) {
AnimatedMat_DrawMain(play, matAnim, alphaRatio, play->gameplayFrames, 2);
}
/**
* Draws an animated material with a step to both the OPA and XLU buffers.
*/
void AnimatedMat_DrawStep(GlobalContext* globalCtx, AnimatedMaterial* matAnim, u32 step) {
AnimatedMat_DrawMain(globalCtx, matAnim, 1, step, 3);
void AnimatedMat_DrawStep(PlayState* play, AnimatedMaterial* matAnim, u32 step) {
AnimatedMat_DrawMain(play, matAnim, 1, step, 3);
}
/**
* Draws an animated material with a step to only the OPA buffer.
*/
void AnimatedMat_DrawStepOpa(GlobalContext* globalCtx, AnimatedMaterial* textures, u32 step) {
AnimatedMat_DrawMain(globalCtx, textures, 1, step, 1);
void AnimatedMat_DrawStepOpa(PlayState* play, AnimatedMaterial* textures, u32 step) {
AnimatedMat_DrawMain(play, textures, 1, step, 1);
}
/**
* Draws an animated material with a step to only the XLU buffer.
*/
void AnimatedMat_DrawStepXlu(GlobalContext* globalCtx, AnimatedMaterial* matAnim, u32 step) {
AnimatedMat_DrawMain(globalCtx, matAnim, 1, step, 2);
void AnimatedMat_DrawStepXlu(PlayState* play, AnimatedMaterial* matAnim, u32 step) {
AnimatedMat_DrawMain(play, matAnim, 1, step, 2);
}
/**
* Draws an animated material with an alpha ratio (0.0 - 1.0) and a step to both the OPA and XLU buffers.
*/
void AnimatedMat_DrawAlphaStep(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step) {
AnimatedMat_DrawMain(globalCtx, matAnim, alphaRatio, step, 3);
void AnimatedMat_DrawAlphaStep(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step) {
AnimatedMat_DrawMain(play, matAnim, alphaRatio, step, 3);
}
/**
* Draws an animated material with an alpha ratio (0.0 - 1.0) and a step to only the OPA buffer.
*/
void AnimatedMat_DrawAlphaStepOpa(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step) {
AnimatedMat_DrawMain(globalCtx, matAnim, alphaRatio, step, 1);
void AnimatedMat_DrawAlphaStepOpa(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step) {
AnimatedMat_DrawMain(play, matAnim, alphaRatio, step, 1);
}
/**
* Draws an animated material with an alpha ratio (0.0 - 1.0) and a step to only the XLU buffer.
*/
void AnimatedMat_DrawAlphaStepXlu(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step) {
AnimatedMat_DrawMain(globalCtx, matAnim, alphaRatio, step, 2);
void AnimatedMat_DrawAlphaStepXlu(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step) {
AnimatedMat_DrawMain(play, matAnim, alphaRatio, step, 2);
}
/**
* SceneTableEntry Draw Config 1:
* Allows the usage of the animated material system in scenes.
*/
void Scene_DrawConfigMatAnim(GlobalContext* globalCtx) {
AnimatedMat_Draw(globalCtx, globalCtx->sceneMaterialAnims);
void Scene_DrawConfigMatAnim(PlayState* play) {
AnimatedMat_Draw(play, play->sceneMaterialAnims);
}
/**
* SceneTableEntry Draw Config 3:
* This config is unused, although it is identical to the grotto scene config from Ocarina of Time.
*/
void Scene_DrawConfig3(GlobalContext* globalCtx) {
void Scene_DrawConfig3(PlayState* play) {
u32 frames;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
frames = globalCtx->gameplayFrames;
frames = play->gameplayFrames;
gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (frames * 1) % 64, 256, 16));
gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, (frames * 1) % 64, 256, 16));
gSPSegment(POLY_XLU_DISP++, 0x09,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (frames % 128), (frames * 1) % 128, 32, 32, 1,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - (frames % 128), (frames * 1) % 128, 32, 32, 1,
frames % 128, (frames * 1) % 128, 32, 32));
gSPSegment(POLY_OPA_DISP++, 0x0A,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (frames * 1) % 128, 32, 32));
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (frames * 1) % 128, 32, 32));
gSPSegment(POLY_OPA_DISP++, 0x0B, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (frames * 1) % 128, 32, 32));
gSPSegment(POLY_OPA_DISP++, 0x0B, Gfx_TexScroll(play->state.gfxCtx, 0, (frames * 1) % 128, 32, 32));
gSPSegment(POLY_XLU_DISP++, 0x0C,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (frames * 50) % 2048, 8, 512, 1, 0, (frames * 60) % 2048,
8, 512));
gSPSegment(
POLY_XLU_DISP++, 0x0C,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (frames * 50) % 2048, 8, 512, 1, 0, (frames * 60) % 2048, 8, 512));
gSPSegment(POLY_OPA_DISP++, 0x0D,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (frames * 1) % 128, 32, 32));
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (frames * 1) % 128, 32, 32));
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128);
@@ -535,7 +534,7 @@ void Scene_DrawConfig3(GlobalContext* globalCtx) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
@@ -543,16 +542,16 @@ void Scene_DrawConfig3(GlobalContext* globalCtx) {
* This config is unused and just has a single TwoTexScroll intended for two 32x32 textures (likely two water textures).
* It is identical to the Castle Courtyard and Sacred Forest Meadow scene config from Ocarina of Time.
*/
void Scene_DrawConfig4(GlobalContext* globalCtx) {
void Scene_DrawConfig4(PlayState* play) {
u32 frames;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
frames = globalCtx->gameplayFrames;
frames = play->gameplayFrames;
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - frames % 128, (frames * 1) % 128, 32, 32, 1,
frames % 128, (frames * 1) % 128, 32, 32));
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - frames % 128, (frames * 1) % 128, 32, 32, 1, frames % 128,
(frames * 1) % 128, 32, 32));
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128);
@@ -560,20 +559,20 @@ void Scene_DrawConfig4(GlobalContext* globalCtx) {
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* SceneTableEntry Draw Config 2:
* Has no effect, and is only used in SPOT00 (cutscene scene).
*/
void Scene_DrawConfigDoNothing(GlobalContext* globalCtx) {
void Scene_DrawConfigDoNothing(PlayState* play) {
}
/**
* Stores a displaylist in the provided segment ID that sets a render mode from the index provided.
*/
void Scene_SetRenderModeXlu(GlobalContext* globalCtx, s32 index, u32 flags) {
void Scene_SetRenderModeXlu(PlayState* play, s32 index, u32 flags) {
static Gfx renderModeSetNoneDL[] = {
gsSPEndDisplayList(),
// These instructions will never get executed
@@ -612,7 +611,7 @@ void Scene_SetRenderModeXlu(GlobalContext* globalCtx, s32 index, u32 flags) {
};
Gfx* dList = dLists[index];
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
if (flags & 1) {
gSPSegment(POLY_OPA_DISP++, 0x0C, dList);
@@ -622,14 +621,14 @@ void Scene_SetRenderModeXlu(GlobalContext* globalCtx, s32 index, u32 flags) {
gSPSegment(POLY_XLU_DISP++, 0x0C, dList);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* Although this function is unused, it will store a displaylist in the provided segment ID that sets the culling mode
* from the index provided.
*/
void Scene_SetCullFlag(GlobalContext* globalCtx, s32 index, u32 flags) {
void Scene_SetCullFlag(PlayState* play, s32 index, u32 flags) {
static Gfx setBackCullDL[] = {
gsSPSetGeometryMode(G_CULL_BACK),
gsSPEndDisplayList(),
@@ -644,7 +643,7 @@ void Scene_SetCullFlag(GlobalContext* globalCtx, s32 index, u32 flags) {
};
Gfx* dList = dLists[index];
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
if (flags & 1) {
gSPSegment(POLY_OPA_DISP++, 0x0C, dList);
@@ -654,37 +653,37 @@ void Scene_SetCullFlag(GlobalContext* globalCtx, s32 index, u32 flags) {
gSPSegment(POLY_XLU_DISP++, 0x0C, dList);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* SceneTableEntry Draw Config 5:
* This config is unused, and its purpose is unknown.
*/
void Scene_DrawConfig5(GlobalContext* globalCtx) {
void Scene_DrawConfig5(PlayState* play) {
u32 dListIndex;
u32 alpha;
if (globalCtx->roomCtx.unk7A[0] != 0) {
if (play->roomCtx.unk7A[0] != 0) {
dListIndex = 1;
alpha = globalCtx->roomCtx.unk7A[1];
alpha = play->roomCtx.unk7A[1];
} else {
dListIndex = 0;
alpha = 255;
}
if (alpha == 0) {
globalCtx->roomCtx.unk78 = 0;
play->roomCtx.unk78 = 0;
} else {
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
globalCtx->roomCtx.unk78 = 1;
AnimatedMat_Draw(globalCtx, globalCtx->sceneMaterialAnims);
Scene_SetRenderModeXlu(globalCtx, dListIndex, 3);
play->roomCtx.unk78 = 1;
AnimatedMat_Draw(play, play->sceneMaterialAnims);
Scene_SetRenderModeXlu(play, dListIndex, 3);
gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, alpha);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
}
@@ -693,8 +692,8 @@ void Scene_DrawConfig5(GlobalContext* globalCtx) {
* This is a special draw config for Sakon's Hideout, as well as the Music Box House. Its step value is set manually
* rather than always animating like `Scene_DrawConfigMatAnim`.
*/
void Scene_DrawConfigMatAnimManualStep(GlobalContext* globalCtx) {
AnimatedMat_DrawStep(globalCtx, globalCtx->sceneMaterialAnims, globalCtx->roomCtx.unk7A[0]);
void Scene_DrawConfigMatAnimManualStep(PlayState* play) {
AnimatedMat_DrawStep(play, play->sceneMaterialAnims, play->roomCtx.unk7A[0]);
}
/**
@@ -703,7 +702,7 @@ void Scene_DrawConfigMatAnimManualStep(GlobalContext* globalCtx) {
* fraction to a certain value when certain flags are set, which are likely used for the pipes whenever they are
* activated.
*/
void Scene_DrawConfigGreatBayTemple(GlobalContext* globalCtx) {
void Scene_DrawConfigGreatBayTemple(PlayState* play) {
static Gfx greatBayTempleColorSetDL[] = {
gsDPSetPrimColor(0, 255, 255, 255, 255, 255),
gsSPEndDisplayList(),
@@ -713,18 +712,18 @@ void Scene_DrawConfigGreatBayTemple(GlobalContext* globalCtx) {
Gfx* dListHead;
Gfx* dList;
if (Flags_GetSwitch(globalCtx, 0x33) && Flags_GetSwitch(globalCtx, 0x34) && Flags_GetSwitch(globalCtx, 0x35) &&
Flags_GetSwitch(globalCtx, 0x36)) {
BgCheck_SetContextFlags(&globalCtx->colCtx, BGCHECK_FLAG_REVERSE_CONVEYOR_FLOW);
if (Flags_GetSwitch(play, 0x33) && Flags_GetSwitch(play, 0x34) && Flags_GetSwitch(play, 0x35) &&
Flags_GetSwitch(play, 0x36)) {
BgCheck_SetContextFlags(&play->colCtx, BGCHECK_FLAG_REVERSE_CONVEYOR_FLOW);
} else {
BgCheck_UnsetContextFlags(&globalCtx->colCtx, BGCHECK_FLAG_REVERSE_CONVEYOR_FLOW);
BgCheck_UnsetContextFlags(&play->colCtx, BGCHECK_FLAG_REVERSE_CONVEYOR_FLOW);
}
dList = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(Gfx) * 18);
dList = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Gfx) * 18);
AnimatedMat_Draw(globalCtx, globalCtx->sceneMaterialAnims);
AnimatedMat_Draw(play, play->sceneMaterialAnims);
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
for (dListHead = dList, i = 0; i < 9; i++, dListHead += 2) {
lodFrac = 0;
@@ -733,50 +732,48 @@ void Scene_DrawConfigGreatBayTemple(GlobalContext* globalCtx) {
switch (i) {
case 0:
if (Flags_GetSwitch(globalCtx, 0x33) && Flags_GetSwitch(globalCtx, 0x34) &&
Flags_GetSwitch(globalCtx, 0x35) && Flags_GetSwitch(globalCtx, 0x36)) {
if (Flags_GetSwitch(play, 0x33) && Flags_GetSwitch(play, 0x34) && Flags_GetSwitch(play, 0x35) &&
Flags_GetSwitch(play, 0x36)) {
lodFrac = 255;
}
break;
case 1:
if (Flags_GetSwitch(globalCtx, 0x37)) {
if (Flags_GetSwitch(play, 0x37)) {
lodFrac = 68;
}
break;
case 2:
if (Flags_GetSwitch(globalCtx, 0x37) && Flags_GetSwitch(globalCtx, 0x38)) {
if (Flags_GetSwitch(play, 0x37) && Flags_GetSwitch(play, 0x38)) {
lodFrac = 68;
}
break;
case 3:
if (Flags_GetSwitch(globalCtx, 0x37) && Flags_GetSwitch(globalCtx, 0x38) &&
Flags_GetSwitch(globalCtx, 0x39)) {
if (Flags_GetSwitch(play, 0x37) && Flags_GetSwitch(play, 0x38) && Flags_GetSwitch(play, 0x39)) {
lodFrac = 68;
}
break;
case 4:
if (!(Flags_GetSwitch(globalCtx, 0x33))) {
if (!(Flags_GetSwitch(play, 0x33))) {
lodFrac = 68;
}
break;
case 5:
if (Flags_GetSwitch(globalCtx, 0x34)) {
if (Flags_GetSwitch(play, 0x34)) {
lodFrac = 68;
}
break;
case 6:
if (Flags_GetSwitch(globalCtx, 0x34) && Flags_GetSwitch(globalCtx, 0x35)) {
if (Flags_GetSwitch(play, 0x34) && Flags_GetSwitch(play, 0x35)) {
lodFrac = 68;
}
break;
case 7:
if (Flags_GetSwitch(globalCtx, 0x34) && Flags_GetSwitch(globalCtx, 0x35) &&
Flags_GetSwitch(globalCtx, 0x36)) {
if (Flags_GetSwitch(play, 0x34) && Flags_GetSwitch(play, 0x35) && Flags_GetSwitch(play, 0x36)) {
lodFrac = 68;
}
break;
case 8:
if (Flags_GetSwitch(globalCtx, 0x3A)) {
if (Flags_GetSwitch(play, 0x3A)) {
lodFrac = 68;
}
break;
@@ -788,5 +785,5 @@ void Scene_DrawConfigGreatBayTemple(GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x06, dList);
gSPSegment(POLY_XLU_DISP++, 0x06, dList);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
+25 -25
View File
@@ -6,7 +6,7 @@
(dest) = (temp) * (0x10000 / 60 / 24.0f); \
(dest) = SCHEDULE_CONVERT_TIME(dest);
s32 Schedule_CheckFlagS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_CheckFlagS(PlayState* play, u8** script, ScheduleResult* result) {
ScheduleCmdCheckFlagS* cmd = (ScheduleCmdCheckFlagS*)*script;
u16 flag = (cmd->flagByte << 8) | cmd->flagMask;
@@ -17,7 +17,7 @@ s32 Schedule_CheckFlagS(GlobalContext* globalCtx, u8** script, ScheduleResult* r
return false;
}
s32 Schedule_CheckFlagL(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_CheckFlagL(PlayState* play, u8** script, ScheduleResult* result) {
ScheduleCmdCheckFlagL* cmd = (ScheduleCmdCheckFlagL*)*script;
u16 flag = (cmd->flagByte << 8) | cmd->flagMask;
@@ -28,7 +28,7 @@ s32 Schedule_CheckFlagL(GlobalContext* globalCtx, u8** script, ScheduleResult* r
return false;
}
s32 Schedule_CheckTimeRangeS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_CheckTimeRangeS(PlayState* play, u8** script, ScheduleResult* result) {
s32 inRange = false;
ScheduleCmdCheckTimeRangeS* cmd = (ScheduleCmdCheckTimeRangeS*)*script;
f32 f;
@@ -54,7 +54,7 @@ s32 Schedule_CheckTimeRangeS(GlobalContext* globalCtx, u8** script, ScheduleResu
return false;
}
s32 Schedule_CheckTimeRangeL(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_CheckTimeRangeL(PlayState* play, u8** script, ScheduleResult* result) {
s32 inRange = false;
ScheduleCmdCheckTimeRangeL* cmd = (ScheduleCmdCheckTimeRangeL*)*script;
f32 f;
@@ -80,7 +80,7 @@ s32 Schedule_CheckTimeRangeL(GlobalContext* globalCtx, u8** script, ScheduleResu
return false;
}
s32 Schedule_ReturnValueL(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_ReturnValueL(PlayState* play, u8** script, ScheduleResult* result) {
ScheduleCmdReturnValueL* cmd = (ScheduleCmdReturnValueL*)*script;
//! @bug result is a u8, value is truncated
@@ -90,36 +90,36 @@ s32 Schedule_ReturnValueL(GlobalContext* globalCtx, u8** script, ScheduleResult*
return true;
}
s32 Schedule_ReturnNone(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_ReturnNone(PlayState* play, u8** script, ScheduleResult* result) {
result->hasResult = false;
return true;
}
s32 Schedule_ReturnEmpty(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_ReturnEmpty(PlayState* play, u8** script, ScheduleResult* result) {
result->hasResult = true;
return true;
}
s32 Schedule_Nop(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_Nop(PlayState* play, u8** script, ScheduleResult* result) {
return false;
}
s32 Schedule_CheckMiscS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_CheckMiscS(PlayState* play, u8** script, ScheduleResult* result) {
ScheduleCmdCheckMiscS* cmd = (ScheduleCmdCheckMiscS*)*script;
if (((cmd->which == SCHEDULE_CHECK_MISC_ROOM_KEY) && (INV_CONTENT(ITEM_ROOM_KEY) == ITEM_ROOM_KEY)) ||
((cmd->which == SCHEDULE_CHECK_MISC_LETTER_TO_KAFEI) &&
(INV_CONTENT(ITEM_LETTER_TO_KAFEI) == ITEM_LETTER_TO_KAFEI)) ||
((cmd->which == SCHEDULE_CHECK_MISC_MASK_ROMANI) && (Player_GetMask(globalCtx) == PLAYER_MASK_ROMANI))) {
((cmd->which == SCHEDULE_CHECK_MISC_MASK_ROMANI) && (Player_GetMask(play) == PLAYER_MASK_ROMANI))) {
*script += cmd->offset;
}
return false;
}
s32 Schedule_ReturnValueS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_ReturnValueS(PlayState* play, u8** script, ScheduleResult* result) {
ScheduleCmdReturnValueS* cmd = (ScheduleCmdReturnValueS*)*script;
result->result = cmd->result;
@@ -128,29 +128,29 @@ s32 Schedule_ReturnValueS(GlobalContext* globalCtx, u8** script, ScheduleResult*
return true;
}
s32 Schedule_CheckNotInSceneS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_CheckNotInSceneS(PlayState* play, u8** script, ScheduleResult* result) {
ScheduleCmdCheckNotInSceneS* cmd = (ScheduleCmdCheckNotInSceneS*)*script;
s16 scene = (cmd->sceneH << 8) | cmd->sceneL;
if (scene != globalCtx->sceneNum) {
if (scene != play->sceneNum) {
*script += cmd->offset;
}
return false;
}
s32 Schedule_CheckNotInSceneL(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_CheckNotInSceneL(PlayState* play, u8** script, ScheduleResult* result) {
ScheduleCmdCheckNotInSceneL* cmd = (ScheduleCmdCheckNotInSceneL*)*script;
s16 scene = (cmd->sceneH << 8) | cmd->sceneL;
if (scene != globalCtx->sceneNum) {
if (scene != play->sceneNum) {
*script = *script + (s16)((cmd->offsetH << 8) | cmd->offsetL);
}
return false;
}
s32 Schedule_CheckNotInDayS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_CheckNotInDayS(PlayState* play, u8** script, ScheduleResult* result) {
ScheduleCmdCheckNotInDayS* cmd = (ScheduleCmdCheckNotInDayS*)*script;
s16 day = (cmd->dayH << 8) | cmd->dayL;
@@ -161,7 +161,7 @@ s32 Schedule_CheckNotInDayS(GlobalContext* globalCtx, u8** script, ScheduleResul
return false;
}
s32 Schedule_CheckNotInDayL(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_CheckNotInDayL(PlayState* play, u8** script, ScheduleResult* result) {
ScheduleCmdCheckNotInDayL* cmd = (ScheduleCmdCheckNotInDayL*)*script;
s16 day = (cmd->dayH << 8) | cmd->dayL;
@@ -172,7 +172,7 @@ s32 Schedule_CheckNotInDayL(GlobalContext* globalCtx, u8** script, ScheduleResul
return false;
}
s32 Schedule_ReturnTime(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_ReturnTime(PlayState* play, u8** script, ScheduleResult* result) {
ScheduleCmdReturnTime* cmd = (ScheduleCmdReturnTime*)*script;
f32 f;
u16 time0;
@@ -191,7 +191,7 @@ s32 Schedule_ReturnTime(GlobalContext* globalCtx, u8** script, ScheduleResult* r
return true;
}
s32 Schedule_CheckBeforeTimeS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_CheckBeforeTimeS(PlayState* play, u8** script, ScheduleResult* result) {
ScheduleCmdCheckBeforeTimeS* cmd = (ScheduleCmdCheckBeforeTimeS*)*script;
f32 f;
u16 testTime;
@@ -208,7 +208,7 @@ s32 Schedule_CheckBeforeTimeS(GlobalContext* globalCtx, u8** script, ScheduleRes
return false;
}
s32 Schedule_CheckBeforeTimeL(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_CheckBeforeTimeL(PlayState* play, u8** script, ScheduleResult* result) {
ScheduleCmdCheckBeforeTimeL* cmd = (ScheduleCmdCheckBeforeTimeL*)*script;
f32 f;
u16 testTime;
@@ -225,21 +225,21 @@ s32 Schedule_CheckBeforeTimeL(GlobalContext* globalCtx, u8** script, ScheduleRes
return false;
}
s32 Schedule_BranchS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_BranchS(PlayState* play, u8** script, ScheduleResult* result) {
ScheduleCmdBranchS* cmd = (ScheduleCmdBranchS*)*script;
*script += cmd->offset;
return false;
}
s32 Schedule_BranchL(GlobalContext* globalCtx, u8** script, ScheduleResult* result) {
s32 Schedule_BranchL(PlayState* play, u8** script, ScheduleResult* result) {
ScheduleCmdBranchL* cmd = (ScheduleCmdBranchL*)*script;
*script += (s16)((cmd->offsetH << 8) | cmd->offsetL);
return false;
}
static s32 (*sScheduleCmdFuncs[])(GlobalContext*, u8**, ScheduleResult*) = {
static s32 (*sScheduleCmdFuncs[])(PlayState*, u8**, ScheduleResult*) = {
Schedule_CheckFlagS, Schedule_CheckFlagL, Schedule_CheckTimeRangeS, Schedule_CheckTimeRangeL,
Schedule_ReturnValueL, Schedule_ReturnNone, Schedule_ReturnEmpty, Schedule_Nop,
Schedule_CheckMiscS, Schedule_ReturnValueS, Schedule_CheckNotInSceneS, Schedule_CheckNotInSceneL,
@@ -269,13 +269,13 @@ static u8 sScheduleCmdSizes[] = {
sizeof(ScheduleCmdBranchL),
};
s32 Schedule_RunScript(GlobalContext* globalCtx, u8* script, ScheduleResult* result) {
s32 Schedule_RunScript(PlayState* play, u8* script, ScheduleResult* result) {
u8 size;
s32 stop;
do {
size = sScheduleCmdSizes[*script];
stop = (*sScheduleCmdFuncs[*script])(globalCtx, &script, result);
stop = (*sScheduleCmdFuncs[*script])(play, &script, result);
script += size;
} while (!stop);
+185 -194
View File
File diff suppressed because it is too large Load Diff
+12 -12
View File
@@ -182,11 +182,11 @@ void Skin_DrawLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dLis
CLOSE_DISPS(gfxCtx);
}
void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
void Skin_DrawImpl(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw,
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags) {
s32 i;
SkinLimb** skeleton;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
GraphicsContext* gfxCtx = play->state.gfxCtx;
OPEN_DISPS(gfxCtx);
@@ -212,7 +212,7 @@ void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostD
s32 segmentType;
if (overrideLimbDraw != NULL) {
shouldDraw = overrideLimbDraw(actor, globalCtx, i, skin);
shouldDraw = overrideLimbDraw(actor, play, i, skin);
}
segmentType = ((SkinLimb*)Lib_SegmentedToVirtual(skeleton[i]))->segmentType;
@@ -225,7 +225,7 @@ void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostD
}
if (postDraw != NULL) {
postDraw(actor, globalCtx, skin);
postDraw(actor, play, skin);
}
close_disps:;
@@ -233,26 +233,26 @@ close_disps:;
}
// allows specifying postDraw and setTranslation
void func_80138228(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, s32 setTranslation) {
Skin_DrawImpl(actor, globalCtx, skin, postDraw, NULL, setTranslation, false, 0);
void func_80138228(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, s32 setTranslation) {
Skin_DrawImpl(actor, play, skin, postDraw, NULL, setTranslation, false, 0);
}
// allows specifying OverrideLimbDraw, postDraw and setTranslation
void func_80138258(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
void func_80138258(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw,
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation) {
Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, false, 0);
Skin_DrawImpl(actor, play, skin, postDraw, overrideLimbDraw, setTranslation, false, 0);
}
// allows specifying OverrideLimbDraw, postDraw, setTranslation, and arg6
void func_8013828C(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
void func_8013828C(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw,
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6) {
Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, arg6, 0);
Skin_DrawImpl(actor, play, skin, postDraw, overrideLimbDraw, setTranslation, arg6, 0);
}
// allows specifying all variables
void func_801382C4(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
void func_801382C4(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw,
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags) {
Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, arg6, drawFlags);
Skin_DrawImpl(actor, play, skin, postDraw, overrideLimbDraw, setTranslation, arg6, drawFlags);
}
void Skin_GetLimbPos(Skin* skin, s32 limbIndex, Vec3f* offset, Vec3f* dst) {
+1 -1
View File
@@ -105,7 +105,7 @@ void Skin_Free(GameState* gameState, Skin* skin) {
ZeldaArena_Free(skin->vtxTable);
}
SkelAnime_Free(&skin->skelAnime, (GlobalContext*)gameState);
SkelAnime_Free(&skin->skelAnime, (PlayState*)gameState);
}
}
+13 -13
View File
@@ -2,10 +2,10 @@
typedef struct {
Actor actor;
s32 (*pictoFunc)(GlobalContext* globalCtx, Actor* actor);
s32 (*pictoFunc)(PlayState* play, Actor* actor);
} PictoActor;
s32 func_8013A240(GlobalContext* globalCtx) {
s32 func_8013A240(PlayState* play) {
PictoActor* pictoActor;
Actor* actor;
s32 type = 0;
@@ -15,15 +15,15 @@ s32 func_8013A240(GlobalContext* globalCtx) {
gSaveContext.save.pictoFlags0 = 0;
gSaveContext.save.pictoFlags1 = 0;
if (globalCtx->sceneNum == SCENE_20SICHITAI) {
if (play->sceneNum == SCENE_20SICHITAI) {
func_8013A41C(1);
}
for (; type < 12; type++) {
for (actor = globalCtx->actorCtx.actorLists[type].first; actor != NULL; actor = actor->next) {
for (actor = play->actorCtx.actorLists[type].first; actor != NULL; actor = actor->next) {
seen = 0;
switch (globalCtx->sceneNum) {
switch (play->sceneNum) {
case SCENE_20SICHITAI:
if ((actor->id == ACTOR_EN_MNK) || (actor->id == ACTOR_EN_BIGOKUTA)) {
seen = 1;
@@ -63,7 +63,7 @@ s32 func_8013A240(GlobalContext* globalCtx) {
if (seen != 0) {
pictoActor = (PictoActor*)actor;
if (pictoActor->pictoFunc != NULL) {
if ((pictoActor->pictoFunc)(globalCtx, actor) == 0) {
if ((pictoActor->pictoFunc)(play, actor) == 0) {
count++;
}
}
@@ -107,14 +107,14 @@ s16 func_8013A504(s16 val) {
return (val >= 0) ? val : -val;
}
s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin,
f32 distanceMax, s16 angleError) {
s32 func_8013A530(PlayState* play, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, f32 distanceMax,
s16 angleError) {
Vec3f screenSpace;
s16 x;
s16 y;
f32 distance;
CollisionPoly* poly;
Camera* camera = GET_ACTIVE_CAM(globalCtx);
Camera* camera = GET_ACTIVE_CAM(play);
Actor* actors[2];
s32 ret = 0;
s32 bgId;
@@ -132,7 +132,7 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos,
ret |= 0x3E;
}
Actor_GetProjectedPos(globalCtx, pos, &screenSpace, &distance);
Actor_GetProjectedPos(play, pos, &screenSpace, &distance);
x = (s16)(screenSpace.x * distance * 160.0f + 160.0f) - 85;
y = (s16)(screenSpace.y * distance * -120.0f + 120.0f) - 67;
if ((x < 0) || (150 < x) || (y < 0) || (105 < y)) {
@@ -140,15 +140,15 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos,
ret |= 0x3D;
}
if (BgCheck_ProjectileLineTest(&globalCtx->colCtx, pos, &camera->eye, &screenSpace, &poly, true, true, true, true,
if (BgCheck_ProjectileLineTest(&play->colCtx, pos, &camera->eye, &screenSpace, &poly, true, true, true, true,
&bgId)) {
func_8013A41C(0x3C);
ret |= 0x3C;
}
actors[0] = actor;
actors[1] = &GET_PLAYER(globalCtx)->actor;
if (CollisionCheck_LineOCCheck(globalCtx, &globalCtx->colChkCtx, pos, &camera->eye, actors, 2)) {
actors[1] = &GET_PLAYER(play)->actor;
if (CollisionCheck_LineOCCheck(play, &play->colChkCtx, pos, &camera->eye, actors, 2)) {
func_8013A41C(0x3B);
ret |= 0x3B;
}
+16 -16
View File
@@ -1,24 +1,24 @@
#include "global.h"
void SoundSource_InitAll(GlobalContext* globalCtx) {
SoundSource* sources = &globalCtx->soundSources[0];
void SoundSource_InitAll(PlayState* play) {
SoundSource* sources = &play->soundSources[0];
s32 i;
// clang-format off
for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) { sources[i].countdown = 0; }
for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) { sources[i].countdown = 0; }
// clang-format on
}
void SoundSource_UpdateAll(GlobalContext* globalCtx) {
SoundSource* source = &globalCtx->soundSources[0];
void SoundSource_UpdateAll(PlayState* play) {
SoundSource* source = &play->soundSources[0];
s32 i;
for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) {
for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) {
if (source->countdown != 0) {
if (DECR(source->countdown) == 0) {
Audio_StopSfxByPos(&source->projectedPos);
} else {
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
if (source->playSfxEachFrame) {
Audio_PlaySfxAtPos(&source->projectedPos, source->sfxId);
}
@@ -29,15 +29,15 @@ void SoundSource_UpdateAll(GlobalContext* globalCtx) {
}
}
void SoundSource_Add(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u16 sfxId, u32 playSfxEachFrame) {
void SoundSource_Add(PlayState* play, Vec3f* worldPos, u32 duration, u16 sfxId, u32 playSfxEachFrame) {
s32 countdown;
SoundSource* source;
s32 smallestCountdown = 0xFFFF;
SoundSource* backupSource = NULL;
s32 i;
source = &globalCtx->soundSources[0];
for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) {
source = &play->soundSources[0];
for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) {
if (source->countdown == 0) {
break;
}
@@ -52,7 +52,7 @@ void SoundSource_Add(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u1
}
// If no sound source is available, replace the sound source with the smallest remaining countdown
if (i >= ARRAY_COUNT(globalCtx->soundSources)) {
if (i >= ARRAY_COUNT(play->soundSources)) {
source = backupSource;
Audio_StopSfxByPos(&source->projectedPos);
}
@@ -62,14 +62,14 @@ void SoundSource_Add(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u1
source->playSfxEachFrame = playSfxEachFrame;
source->sfxId = sfxId;
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
Audio_PlaySfxAtPos(&source->projectedPos, sfxId);
}
void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u16 sfxId) {
SoundSource_Add(globalCtx, worldPos, duration, sfxId, false);
void SoundSource_PlaySfxAtFixedWorldPos(PlayState* play, Vec3f* worldPos, u32 duration, u16 sfxId) {
SoundSource_Add(play, worldPos, duration, sfxId, false);
}
void SoundSource_PlaySfxEachFrameAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u16 sfxId) {
SoundSource_Add(globalCtx, worldPos, duration, sfxId, true);
void SoundSource_PlaySfxEachFrameAtFixedWorldPos(PlayState* play, Vec3f* worldPos, u32 duration, u16 sfxId) {
SoundSource_Add(play, worldPos, duration, sfxId, true);
}
+17 -18
View File
@@ -226,7 +226,7 @@ void Sram_ClearFlagsAtDawnOfTheFirstDay(void) {
/**
* Used by Song of Time (when clicking "Yes") and (indirectly) by the "Dawn of the New Day" cutscene
*/
void Sram_SaveEndOfCycle(GlobalContext* globalCtx) {
void Sram_SaveEndOfCycle(PlayState* play) {
s16 sceneNum;
s32 j;
s32 i;
@@ -243,14 +243,14 @@ void Sram_SaveEndOfCycle(GlobalContext* globalCtx) {
gSaveContext.save.playerData.deaths = 999;
}
sceneNum = Play_GetOriginalSceneNumber(globalCtx->sceneNum);
Play_SaveCycleSceneFlags(&globalCtx->state);
sceneNum = Play_GetOriginalSceneNumber(play->sceneNum);
Play_SaveCycleSceneFlags(&play->state);
globalCtx->actorCtx.flags.chest &= D_801C5FC0[sceneNum][2];
globalCtx->actorCtx.flags.switches[0] &= D_801C5FC0[sceneNum][0];
globalCtx->actorCtx.flags.switches[1] &= D_801C5FC0[sceneNum][1];
globalCtx->actorCtx.flags.collectible[0] &= D_801C5FC0[sceneNum][3];
globalCtx->actorCtx.flags.clearedRoom = 0;
play->actorCtx.flags.chest &= D_801C5FC0[sceneNum][2];
play->actorCtx.flags.switches[0] &= D_801C5FC0[sceneNum][0];
play->actorCtx.flags.switches[1] &= D_801C5FC0[sceneNum][1];
play->actorCtx.flags.collectible[0] &= D_801C5FC0[sceneNum][3];
play->actorCtx.flags.clearedRoom = 0;
for (i = 0; i < SCENE_MAX; i++) {
gSaveContext.cycleSceneFlags[i].switch0 = ((void)0, gSaveContext.cycleSceneFlags[i].switch0) & D_801C5FC0[i][0];
@@ -346,7 +346,7 @@ void Sram_SaveEndOfCycle(GlobalContext* globalCtx) {
for (j = 1; j < 4; j++) {
if (GET_CUR_FORM_BTN_ITEM(j) == gSaveContext.save.inventory.items[i]) {
SET_CUR_FORM_BTN_ITEM(j, ITEM_BOTTLE);
func_80112B40(globalCtx, j);
func_80112B40(play, j);
}
}
gSaveContext.save.inventory.items[i] = ITEM_BOTTLE;
@@ -415,7 +415,7 @@ void Sram_SaveEndOfCycle(GlobalContext* globalCtx) {
for (j = 1; j < 4; j++) {
if (GET_CUR_FORM_BTN_ITEM(j) >= ITEM_MOON_TEAR && GET_CUR_FORM_BTN_ITEM(j) <= ITEM_PENDANT_MEMORIES) {
SET_CUR_FORM_BTN_ITEM(j, ITEM_NONE);
func_80112B40(globalCtx, j);
func_80112B40(play, j);
}
}
@@ -446,7 +446,7 @@ void Sram_SaveEndOfCycle(GlobalContext* globalCtx) {
gSaveContext.jinxTimer = 0;
gSaveContext.rupeeAccumulator = 0;
func_800F3B2C(globalCtx);
func_800F3B2C(play);
}
void Sram_IncrementDay(void) {
@@ -1519,9 +1519,9 @@ void func_80146EBC(SramContext* sramCtx, s32 curPage, s32 numPages) {
/**
* Saves the game on the very first time Player enters South Clock Town from the Clock Tower
*/
void Sram_SaveSpecialEnterClockTown(GlobalContext* globalCtx) {
void Sram_SaveSpecialEnterClockTown(PlayState* play) {
s32 pad[2];
SramContext* sramCtx = &globalCtx->sramCtx;
SramContext* sramCtx = &play->sramCtx;
gSaveContext.save.isFirstCycle = true;
gSaveContext.save.isOwlSave = false;
@@ -1532,7 +1532,7 @@ void Sram_SaveSpecialEnterClockTown(GlobalContext* globalCtx) {
/**
* Saves when beating the game, after showing the "Dawn of the New Day" message
*/
void Sram_SaveSpecialNewDay(GlobalContext* globalCtx) {
void Sram_SaveSpecialNewDay(PlayState* play) {
s32 cutscene = gSaveContext.save.cutscene;
s32 day;
u16 time = gSaveContext.save.time;
@@ -1542,14 +1542,13 @@ void Sram_SaveSpecialNewDay(GlobalContext* globalCtx) {
// Unconfirmed: "Obtained Fierce Deity Mask?"
gSaveContext.save.weekEventReg[84] &= (u8)~0x20;
Sram_SaveEndOfCycle(globalCtx);
func_8014546C(&globalCtx->sramCtx);
Sram_SaveEndOfCycle(play);
func_8014546C(&play->sramCtx);
gSaveContext.save.day = day;
gSaveContext.save.time = time;
gSaveContext.save.cutscene = cutscene;
func_80185F64(globalCtx->sramCtx.saveBuf, D_801C67C8[gSaveContext.fileNum * 2],
D_801C67F0[gSaveContext.fileNum * 2]);
func_80185F64(play->sramCtx.saveBuf, D_801C67C8[gSaveContext.fileNum * 2], D_801C67F0[gSaveContext.fileNum * 2]);
}
void func_80147008(SramContext* sramCtx, u32 curPage, u32 numPages) {
+74 -77
View File
@@ -17,12 +17,12 @@ s32 D_801C5DBC[] = { 0, 1 }; // Unused
/**
* Finds the first EnDoor instance with unk_1A4 == 5 and the specified switchFlag.
*/
EnDoor* SubS_FindDoor(GlobalContext* globalCtx, s32 switchFlag) {
EnDoor* SubS_FindDoor(PlayState* play, s32 switchFlag) {
Actor* actor = NULL;
EnDoor* door;
while (true) {
actor = SubS_FindActor(globalCtx, actor, ACTORCAT_DOOR, ACTOR_EN_DOOR);
actor = SubS_FindActor(play, actor, ACTORCAT_DOOR, ACTOR_EN_DOOR);
door = (EnDoor*)actor;
if (actor == NULL) {
@@ -44,7 +44,7 @@ EnDoor* SubS_FindDoor(GlobalContext* globalCtx, s32 switchFlag) {
return door;
}
Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
Gfx* SubS_DrawTransformFlexLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw,
TransformLimbDraw transformLimbDraw, Actor* actor, Mtx** mtx, Gfx* gfx) {
StandardLimb* limb;
@@ -62,11 +62,11 @@ Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void**
pos.z = limb->jointPos.z;
newDList = limbDList = limb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor, &gfx)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, actor, &gfx)) {
Matrix_TranslateRotateZYX(&pos, &rot);
Matrix_Push();
transformLimbDraw(globalCtx, limbIndex, actor, &gfx);
transformLimbDraw(play, limbIndex, actor, &gfx);
if (newDList != NULL) {
Matrix_ToMtx(*mtx);
@@ -80,15 +80,15 @@ Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void**
Matrix_Pop();
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, actor, &gfx);
postLimbDraw(play, limbIndex, &limbDList, &rot, actor, &gfx);
}
if (limb->child != LIMB_DONE) {
gfx = SubS_DrawTransformFlexLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
gfx = SubS_DrawTransformFlexLimb(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
transformLimbDraw, actor, mtx, gfx);
}
Matrix_Pop();
if (limb->sibling != LIMB_DONE) {
gfx = SubS_DrawTransformFlexLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
gfx = SubS_DrawTransformFlexLimb(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
transformLimbDraw, actor, mtx, gfx);
}
return gfx;
@@ -103,7 +103,7 @@ Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void**
* coordinates.
* Note that the `TransformLimbDraw` does not have a NULL check, so must be provided even if empty.
*/
Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
Gfx* SubS_DrawTransformFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw,
TransformLimbDraw transformLimbDraw, Actor* actor, Gfx* gfx) {
StandardLimb* rootLimb;
@@ -112,7 +112,7 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo
Gfx* limbDList;
Vec3f pos;
Vec3s rot;
Mtx* mtx = GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(dListCount * sizeof(Mtx)));
Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(dListCount * sizeof(Mtx)));
if (skeleton == NULL) {
return NULL;
@@ -128,11 +128,11 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo
newDlist = rootLimb->dList;
limbDList = rootLimb->dList;
if (overrideLimbDraw == NULL || !overrideLimbDraw(globalCtx, 1, &newDlist, &pos, &rot, actor, &gfx)) {
if (overrideLimbDraw == NULL || !overrideLimbDraw(play, 1, &newDlist, &pos, &rot, actor, &gfx)) {
Matrix_TranslateRotateZYX(&pos, &rot);
Matrix_Push();
transformLimbDraw(globalCtx, 1, actor, &gfx);
transformLimbDraw(play, 1, actor, &gfx);
if (newDlist != NULL) {
Matrix_ToMtx(mtx);
@@ -147,21 +147,21 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, 1, &limbDList, &rot, actor, &gfx);
postLimbDraw(play, 1, &limbDList, &rot, actor, &gfx);
}
if (rootLimb->child != LIMB_DONE) {
gfx = SubS_DrawTransformFlexLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw,
postLimbDraw, transformLimbDraw, actor, &mtx, gfx);
gfx = SubS_DrawTransformFlexLimb(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
transformLimbDraw, actor, &mtx, gfx);
}
Matrix_Pop();
return gfx;
}
s32 SubS_InCsMode(GlobalContext* globalCtx) {
s32 SubS_InCsMode(PlayState* play) {
s32 inCsMode = false;
if (Play_InCsMode(globalCtx)) {
if (Play_InCsMode(play)) {
inCsMode = true;
}
@@ -434,14 +434,14 @@ s32 SubS_TimePathing_Update(Path* path, f32* progress, s32* elapsedTime, s32 way
/**
* Computes the initial Y component of a time based path
*
* @param[in] globalCtx
* @param[in] play
* @param[in] path
* @param[in] waypoint the current waypoint, this and the previous two points will be used to compute the target pos
* @param[out] targetPos the computed position to move to, only the Y component has meaning
*
* @note Same note as SubS_TimePathing_Update()
*/
void SubS_TimePathing_ComputeInitialY(GlobalContext* globalCtx, Path* path, s32 waypoint, Vec3f* targetPos) {
void SubS_TimePathing_ComputeInitialY(PlayState* play, Path* path, s32 waypoint, Vec3f* targetPos) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
Vec3f posA;
Vec3f posB;
@@ -475,18 +475,17 @@ void SubS_TimePathing_ComputeInitialY(GlobalContext* globalCtx, Path* path, s32
posB = *targetPos;
posA.y = max;
posB.y = min;
if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &posA, &posB, &posResult, &outPoly, true, true, true, true,
&bgId)) {
if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posResult, &outPoly, true, true, true, true, &bgId)) {
targetPos->y = posResult.y;
}
}
Path* SubS_GetAdditionalPath(GlobalContext* globalCtx, u8 pathIndex, s32 max) {
Path* SubS_GetAdditionalPath(PlayState* play, u8 pathIndex, s32 max) {
Path* path;
s32 i = 0;
do {
path = &globalCtx->setupPathList[pathIndex];
path = &play->setupPathList[pathIndex];
if (i >= max) {
break;
}
@@ -500,7 +499,7 @@ Path* SubS_GetAdditionalPath(GlobalContext* globalCtx, u8 pathIndex, s32 max) {
/**
* Finds the nearest actor instance of a specified Id and category to an actor.
*/
Actor* SubS_FindNearestActor(Actor* actor, GlobalContext* globalCtx, u8 actorCategory, s16 actorId) {
Actor* SubS_FindNearestActor(Actor* actor, PlayState* play, u8 actorCategory, s16 actorId) {
Actor* actorIter = NULL;
Actor* actorTmp;
f32 dist;
@@ -509,7 +508,7 @@ Actor* SubS_FindNearestActor(Actor* actor, GlobalContext* globalCtx, u8 actorCat
s32 isSetup = false;
do {
actorIter = SubS_FindActor(globalCtx, actorIter, actorCategory, actorId);
actorIter = SubS_FindActor(play, actorIter, actorCategory, actorId);
actorTmp = actorIter;
if (actorTmp == NULL) {
@@ -586,7 +585,7 @@ s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex) {
return reached;
}
Path* SubS_GetDayDependentPath(GlobalContext* globalCtx, u8 pathIndex, u8 max, s32* startPointIndex) {
Path* SubS_GetDayDependentPath(PlayState* play, u8 pathIndex, u8 max, s32* startPointIndex) {
Path* path = NULL;
s32 found = false;
s32 time = (((s16)TIME_TO_MINUTES_F(gSaveContext.save.time) % 60) +
@@ -599,7 +598,7 @@ Path* SubS_GetDayDependentPath(GlobalContext* globalCtx, u8 pathIndex, u8 max, s
}
while (pathIndex != 0xFF) {
path = &globalCtx->setupPathList[pathIndex];
path = &play->setupPathList[pathIndex];
if (sPathDayFlags[day] & path->unk2) {
found = true;
break;
@@ -817,29 +816,29 @@ s32 SubS_CopyPointFromPathCheckBounds(Path* path, s32 pointIndex, Vec3f* dst) {
}
//! TODO: Needs docs with func_800B8500
s32 func_8013C964(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 itemId, s32 type) {
s32 func_8013C964(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 itemId, s32 type) {
s32 ret = false;
s16 x;
s16 y;
f32 xzDistToPlayerTemp;
Actor_GetScreenPos(globalCtx, actor, &x, &y);
Actor_GetScreenPos(play, actor, &x, &y);
switch (type) {
case 1:
yRange = fabsf(actor->playerHeightRel) + 1.0f;
xzRange = actor->xzDistToPlayer + 1.0f;
ret = Actor_PickUp(actor, globalCtx, itemId, xzRange, yRange);
ret = Actor_PickUp(actor, play, itemId, xzRange, yRange);
break;
case 2:
if ((fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange)) {
ret = func_800B8500(actor, globalCtx, xzRange, yRange, itemId);
ret = func_800B8500(actor, play, xzRange, yRange, itemId);
}
break;
case 3:
//! @bug: Both x and y conditionals are always true, || should be an &&
if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT))) {
ret = func_800B8500(actor, globalCtx, xzRange, yRange, itemId);
ret = func_800B8500(actor, play, xzRange, yRange, itemId);
}
break;
case 4:
@@ -848,7 +847,7 @@ s32 func_8013C964(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRang
xzDistToPlayerTemp = actor->xzDistToPlayer;
actor->xzDistToPlayer = 0.0f;
actor->flags |= 0x10000;
ret = func_800B8500(actor, globalCtx, xzRange, yRange, itemId);
ret = func_800B8500(actor, play, xzRange, yRange, itemId);
actor->xzDistToPlayer = xzDistToPlayerTemp;
break;
case 5:
@@ -856,7 +855,7 @@ s32 func_8013C964(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRang
if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT)) &&
(fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange) && actor->isTargeted) {
actor->flags |= 0x10000;
ret = func_800B8500(actor, globalCtx, xzRange, yRange, itemId);
ret = func_800B8500(actor, play, xzRange, yRange, itemId);
}
break;
case 6:
@@ -864,7 +863,7 @@ s32 func_8013C964(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRang
if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT)) &&
(fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange)) {
actor->flags |= 0x10000;
ret = func_800B8500(actor, globalCtx, xzRange, yRange, itemId);
ret = func_800B8500(actor, play, xzRange, yRange, itemId);
}
break;
}
@@ -1090,8 +1089,8 @@ s32 SubS_AngleDiffLessEqual(s16 angleA, s16 threshold, s16 angleB) {
return (ABS_ALT(BINANG_SUB(angleB, angleA)) <= threshold) ? true : false;
}
Path* SubS_GetPathByIndex(GlobalContext* globalCtx, s16 pathIndex, s16 max) {
return (pathIndex != max) ? &globalCtx->setupPathList[pathIndex] : NULL;
Path* SubS_GetPathByIndex(PlayState* play, s16 pathIndex, s16 max) {
return (pathIndex != max) ? &play->setupPathList[pathIndex] : NULL;
}
s32 SubS_CopyPointFromPath(Path* path, s32 pointIndex, Vec3f* dst) {
@@ -1153,22 +1152,22 @@ s16 SubS_GetDistSqAndOrientPath(Path* path, s32 pointIndex, Vec3f* pos, f32* dis
return Math_Atan2S(diffX, diffZ);
}
s8 SubS_IsObjectLoaded(s8 index, GlobalContext* globalCtx) {
return !Object_IsLoaded(&globalCtx->objectCtx, index) ? false : true;
s8 SubS_IsObjectLoaded(s8 index, PlayState* play) {
return !Object_IsLoaded(&play->objectCtx, index) ? false : true;
}
s8 SubS_GetObjectIndex(s16 id, GlobalContext* globalCtx) {
return Object_GetIndex(&globalCtx->objectCtx, id);
s8 SubS_GetObjectIndex(s16 id, PlayState* play) {
return Object_GetIndex(&play->objectCtx, id);
}
/**
* Finds the first actor instance of a specified Id and category.
*/
Actor* SubS_FindActor(GlobalContext* globalCtx, Actor* actorListStart, u8 actorCategory, s16 actorId) {
Actor* SubS_FindActor(PlayState* play, Actor* actorListStart, u8 actorCategory, s16 actorId) {
Actor* actor = actorListStart;
if (actor == NULL) {
actor = globalCtx->actorCtx.actorLists[actorCategory].first;
actor = play->actorCtx.actorLists[actorCategory].first;
}
while (actor != NULL && actorId != actor->id) {
@@ -1178,9 +1177,9 @@ Actor* SubS_FindActor(GlobalContext* globalCtx, Actor* actorListStart, u8 actorC
return actor;
}
s32 SubS_FillLimbRotTables(GlobalContext* globalCtx, s16* limbRotTableY, s16* limbRotTableZ, s32 numLimbs) {
s32 SubS_FillLimbRotTables(PlayState* play, s16* limbRotTableY, s16* limbRotTableZ, s32 numLimbs) {
s32 i;
u32 frames = globalCtx->gameplayFrames;
u32 frames = play->gameplayFrames;
for (i = 0; i < numLimbs; i++) {
limbRotTableY[i] = (i * 50 + 0x814) * frames;
@@ -1190,7 +1189,7 @@ s32 SubS_FillLimbRotTables(GlobalContext* globalCtx, s16* limbRotTableY, s16* li
return true;
}
s32 SubS_IsFloorAbove(GlobalContext* globalCtx, Vec3f* pos, f32 distAbove) {
s32 SubS_IsFloorAbove(PlayState* play, Vec3f* pos, f32 distAbove) {
CollisionPoly* outPoly;
Vec3f posA;
Vec3f posB;
@@ -1199,8 +1198,7 @@ s32 SubS_IsFloorAbove(GlobalContext* globalCtx, Vec3f* pos, f32 distAbove) {
posA = posB = *pos;
posB.y += distAbove;
return BgCheck_EntityLineTest1(&globalCtx->colCtx, &posA, &posB, &posResult, &outPoly, false, true, false, true,
&bgId);
return BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posResult, &outPoly, false, true, false, true, &bgId);
}
s32 SubS_CopyPointFromPathList(Path* paths, s32 pathIndex, s32 pointIndex, Vec3f* dst) {
@@ -1220,12 +1218,11 @@ u8 SubS_GetPathCountFromPathList(Path* paths, s32 pathIndex) {
return path->count;
}
void SubS_ActorPathing_Init(GlobalContext* globalCtx, Vec3f* worldPos, Actor* actor, ActorPathing* actorPath,
Path* paths, s32 pathIndex, s32 begPointIndex, s32 endPointIndex, s32 curPointIndex,
u8 flags) {
void SubS_ActorPathing_Init(PlayState* play, Vec3f* worldPos, Actor* actor, ActorPathing* actorPath, Path* paths,
s32 pathIndex, s32 begPointIndex, s32 endPointIndex, s32 curPointIndex, u8 flags) {
Path* path;
actorPath->setupPathList = globalCtx->setupPathList;
actorPath->setupPathList = play->setupPathList;
actorPath->pathIndex = pathIndex;
path = &paths[pathIndex];
actorPath->points = Lib_SegmentedToVirtual(path->points);
@@ -1250,9 +1247,9 @@ void SubS_ActorPathing_Init(GlobalContext* globalCtx, Vec3f* worldPos, Actor* ac
actorPath->prevFlags = flags;
}
s32 SubS_ActorPathing_Update(GlobalContext* globalCtx, ActorPathing* actorPath,
ActorPathingComputeFunc computePointInfoFunc, ActorPathingUpdateFunc updateActorInfoFunc,
ActorPathingUpdateFunc moveFunc, ActorPathingUpdateFunc setNextPointFunc) {
s32 SubS_ActorPathing_Update(PlayState* play, ActorPathing* actorPath, ActorPathingComputeFunc computePointInfoFunc,
ActorPathingUpdateFunc updateActorInfoFunc, ActorPathingUpdateFunc moveFunc,
ActorPathingUpdateFunc setNextPointFunc) {
s32 shouldSetNextPoint;
s32 reupdate;
@@ -1272,24 +1269,24 @@ s32 SubS_ActorPathing_Update(GlobalContext* globalCtx, ActorPathing* actorPath,
do {
shouldSetNextPoint = false;
if (actorPath->computePointInfoFunc != NULL) {
actorPath->computePointInfoFunc(globalCtx, actorPath);
actorPath->computePointInfoFunc(play, actorPath);
}
if (actorPath->updateActorInfoFunc != NULL) {
shouldSetNextPoint = actorPath->updateActorInfoFunc(globalCtx, actorPath);
shouldSetNextPoint = actorPath->updateActorInfoFunc(play, actorPath);
}
if (shouldSetNextPoint) {
if (actorPath->setNextPointFunc != NULL) {
reupdate = actorPath->setNextPointFunc(globalCtx, actorPath);
reupdate = actorPath->setNextPointFunc(play, actorPath);
}
} else if (actorPath->moveFunc != NULL) {
reupdate = actorPath->moveFunc(globalCtx, actorPath);
reupdate = actorPath->moveFunc(play, actorPath);
}
} while (reupdate);
actorPath->prevFlags = actorPath->flags;
return false;
}
void SubS_ActorPathing_ComputePointInfo(GlobalContext* globalCtx, ActorPathing* actorPath) {
void SubS_ActorPathing_ComputePointInfo(PlayState* play, ActorPathing* actorPath) {
Vec3f diff;
actorPath->curPoint.x = actorPath->points[actorPath->curPointIndex].x + actorPath->pointOffset.x;
@@ -1305,17 +1302,17 @@ void SubS_ActorPathing_ComputePointInfo(GlobalContext* globalCtx, ActorPathing*
actorPath->rotToCurPoint.z = 0;
}
s32 SubS_ActorPathing_MoveWithGravity(GlobalContext* globalCtx, ActorPathing* actorPath) {
s32 SubS_ActorPathing_MoveWithGravity(PlayState* play, ActorPathing* actorPath) {
Actor_MoveWithGravity(actorPath->actor);
return false;
}
s32 SubS_ActorPathing_MoveWithoutGravityReverse(GlobalContext* globalCtx, ActorPathing* actorPath) {
s32 SubS_ActorPathing_MoveWithoutGravityReverse(PlayState* play, ActorPathing* actorPath) {
Actor_MoveWithoutGravityReverse(actorPath->actor);
return false;
}
s32 SubS_ActorPathing_SetNextPoint(GlobalContext* globalCtx, ActorPathing* actorPath) {
s32 SubS_ActorPathing_SetNextPoint(PlayState* play, ActorPathing* actorPath) {
s32 reupdate = true;
Math_Vec3f_Copy(&actorPath->prevPoint, &actorPath->curPoint);
@@ -1484,18 +1481,18 @@ s32 SubS_LineSegVsPlane(Vec3f* point, Vec3s* rot, Vec3f* unitVec, Vec3f* linePoi
* Finds the first actor instance of a specified Id and category verified with a custom callback.
* The callback should return `true` when the actor is succesfully verified.
*/
Actor* SubS_FindActorCustom(GlobalContext* globalCtx, Actor* actor, Actor* actorListStart, u8 actorCategory,
s16 actorId, void* verifyData, VerifyActor verifyActor) {
Actor* SubS_FindActorCustom(PlayState* play, Actor* actor, Actor* actorListStart, u8 actorCategory, s16 actorId,
void* verifyData, VerifyActor verifyActor) {
Actor* actorIter = actorListStart;
if (actorListStart == NULL) {
actorIter = globalCtx->actorCtx.actorLists[actorCategory].first;
actorIter = play->actorCtx.actorLists[actorCategory].first;
}
while (actorIter != NULL && (actorId != actorIter->id ||
(actorId == actorIter->id &&
(verifyActor == NULL ||
(verifyActor != NULL && !verifyActor(globalCtx, actor, actorIter, verifyData)))))) {
while (actorIter != NULL &&
(actorId != actorIter->id ||
(actorId == actorIter->id &&
(verifyActor == NULL || (verifyActor != NULL && !verifyActor(play, actor, actorIter, verifyData)))))) {
actorIter = actorIter->next;
}
@@ -1503,18 +1500,18 @@ Actor* SubS_FindActorCustom(GlobalContext* globalCtx, Actor* actor, Actor* actor
}
//! TODO: Needs docs with func_800B8500
s32 func_8013E748(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 exchangeItemId, void* data,
s32 func_8013E748(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 exchangeItemId, void* data,
func_8013E748_VerifyFunc verifyFunc) {
s32 ret = false;
if ((verifyFunc == NULL) || ((verifyFunc != NULL) && verifyFunc(globalCtx, actor, data))) {
ret = func_800B8500(actor, globalCtx, xzRange, yRange, exchangeItemId);
if ((verifyFunc == NULL) || ((verifyFunc != NULL) && verifyFunc(play, actor, data))) {
ret = func_800B8500(actor, play, xzRange, yRange, exchangeItemId);
}
return ret;
}
s32 SubS_ActorAndPlayerFaceEachOther(GlobalContext* globalCtx, Actor* actor, void* data) {
Player* player = GET_PLAYER(globalCtx);
s32 SubS_ActorAndPlayerFaceEachOther(PlayState* play, Actor* actor, void* data) {
Player* player = GET_PLAYER(play);
Vec3s* yawTols = (Vec3s*)data;
s16 playerYaw = ABS(BINANG_SUB(Actor_YawBetweenActors(&player->actor, actor), player->actor.shape.rot.y));
s16 actorYaw = ABS(BINANG_SUB(actor->yawTowardsPlayer, actor->shape.rot.y));
@@ -1533,13 +1530,13 @@ s32 SubS_ActorAndPlayerFaceEachOther(GlobalContext* globalCtx, Actor* actor, voi
}
//! TODO: Needs docs with func_800B8500
s32 func_8013E8F8(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 exhangeItemId, s16 playerYawTol,
s32 func_8013E8F8(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 exhangeItemId, s16 playerYawTol,
s16 actorYawTol) {
Vec3s yawTols;
yawTols.x = playerYawTol;
yawTols.y = actorYawTol;
return func_8013E748(actor, globalCtx, xzRange, yRange, exhangeItemId, &yawTols, SubS_ActorAndPlayerFaceEachOther);
return func_8013E748(actor, play, xzRange, yRange, exhangeItemId, &yawTols, SubS_ActorAndPlayerFaceEachOther);
}
/**
+5 -5
View File
@@ -36,7 +36,7 @@ void func_80143148(SkyboxContext* skyboxCtx, s32 arg1) {
}
void func_801431E8(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType) {
GlobalContext* globalCtx = (GlobalContext*)gameState;
PlayState* play = (PlayState*)gameState;
size_t size;
void* offset;
s32 pad;
@@ -75,13 +75,13 @@ void func_801431E8(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType)
skyboxCtx->envB = 40;
// Inverted Stone Tower Temple and Inverted Stone Tower
if ((globalCtx->sceneNum == SCENE_F41) || (globalCtx->sceneNum == SCENE_INISIE_R)) {
if ((play->sceneNum == SCENE_F41) || (play->sceneNum == SCENE_INISIE_R)) {
skyboxCtx->rotZ = 3.15000009537f;
}
}
}
void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyType) {
void func_80143324(PlayState* play, SkyboxContext* skyboxCtx, s16 skyType) {
size_t size;
if (1) {}
@@ -89,7 +89,7 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy
if (skyType == 1) {
osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1);
if (globalCtx->envCtx.unk_10 == 0) {
if (play->envCtx.unk_10 == 0) {
// Send a DMA request for the clear sky texture
size = SEGMENT_ROM_SIZE(d2_fine_static);
@@ -106,7 +106,7 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy
osRecvMesg(&skyboxCtx->loadQueue, NULL, OS_MESG_BLOCK);
osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1);
if (globalCtx->envCtx.unk_11 == 0) {
if (play->envCtx.unk_11 == 0) {
// Send a DMA request for the clear sky texture
size = SEGMENT_ROM_SIZE(d2_fine_static);