Use PlayState instead of GlobalContext (#1927)

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

* Find and replace Gameplay_ with Play_

* Correct some misnamed argument cases
This commit is contained in:
Garrett Cox 2022-11-06 02:24:34 -06:00 committed by GitHub
parent 710a768d76
commit 99260acaf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
926 changed files with 41210 additions and 41210 deletions

File diff suppressed because it is too large Load Diff

View File

@ -31,9 +31,9 @@
#define RGBA8(r, g, b, a) ((((r) & 0xFF) << 24) | (((g) & 0xFF) << 16) | (((b) & 0xFF) << 8) | (((a) & 0xFF) << 0))
#define GET_PLAYER(globalCtx) ((Player*)(globalCtx)->actorCtx.actorLists[ACTORCAT_PLAYER].head)
#define GET_PLAYER(play) ((Player*)(play)->actorCtx.actorLists[ACTORCAT_PLAYER].head)
#define GET_ACTIVE_CAM(globalCtx) ((globalCtx)->cameraPtrs[(globalCtx)->activeCamera])
#define GET_ACTIVE_CAM(play) ((play)->cameraPtrs[(play)->activeCamera])
#define LINK_IS_ADULT (gSaveContext.linkAge == 0)
#define LINK_IS_CHILD (gSaveContext.linkAge == 1)

View File

@ -101,7 +101,7 @@ extern "C"
extern void* gItemIcons[0x82];
extern u8 gItemAgeReqs[];
extern u8 gItemSlots[56];
extern void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(GlobalContext*, SceneCmd*);
extern void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(PlayState*, SceneCmd*);
extern s16 gLinkObjectIds[2];
extern u32 gObjectTableSize;
extern RomFile gObjectTable[OBJECT_ID_MAX];

View File

@ -1228,7 +1228,7 @@ typedef struct {
} TransitionActorContext;
// Global Context (dbg ram start: 80212020)
typedef struct GlobalContext {
typedef struct PlayState {
/* 0x00000 */ GameState state;
/* 0x000A4 */ s16 sceneNum;
/* 0x000A6 */ u8 sceneConfig;
@ -1266,15 +1266,15 @@ typedef struct GlobalContext {
/* 0x117A4 */ ObjectContext objectCtx;
/* 0x11CBC */ RoomContext roomCtx;
/* 0x11D34 */ TransitionActorContext transiActorCtx;
/* 0x11D3C */ void (*playerInit)(Player* player, struct GlobalContext* globalCtx, FlexSkeletonHeader* skelHeader);
/* 0x11D40 */ void (*playerUpdate)(Player* player, struct GlobalContext* globalCtx, Input* input);
/* 0x11D44 */ s32 (*isPlayerDroppingFish)(struct GlobalContext* globalCtx);
/* 0x11D48 */ s32 (*startPlayerFishing)(struct GlobalContext* globalCtx);
/* 0x11D4C */ s32 (*grabPlayer)(struct GlobalContext* globalCtx, Player* player);
/* 0x11D50 */ s32 (*startPlayerCutscene)(struct GlobalContext* globalCtx, Actor* actor, s32 mode);
/* 0x11D54 */ void (*func_11D54)(Player* player, struct GlobalContext* globalCtx);
/* 0x11D58 */ s32 (*damagePlayer)(struct GlobalContext* globalCtx, s32 damage);
/* 0x11D5C */ void (*talkWithPlayer)(struct GlobalContext* globalCtx, Actor* actor);
/* 0x11D3C */ void (*playerInit)(Player* player, struct PlayState* play, FlexSkeletonHeader* skelHeader);
/* 0x11D40 */ void (*playerUpdate)(Player* player, struct PlayState* play, Input* input);
/* 0x11D44 */ s32 (*isPlayerDroppingFish)(struct PlayState* play);
/* 0x11D48 */ s32 (*startPlayerFishing)(struct PlayState* play);
/* 0x11D4C */ s32 (*grabPlayer)(struct PlayState* play, Player* player);
/* 0x11D50 */ s32 (*startPlayerCutscene)(struct PlayState* play, Actor* actor, s32 mode);
/* 0x11D54 */ void (*func_11D54)(Player* player, struct PlayState* play);
/* 0x11D58 */ s32 (*damagePlayer)(struct PlayState* play, s32 damage);
/* 0x11D5C */ void (*talkWithPlayer)(struct PlayState* play, Actor* actor);
/* 0x11D60 */ MtxF viewProjectionMtxF;
/* 0x11DA0 */ MtxF billboardMtxF;
/* 0x11DE0 */ Mtx* billboardMtx;
@ -1315,7 +1315,7 @@ typedef struct GlobalContext {
/* 0x1242B */ u8 unk_1242B;
/* 0x1242C */ SceneTableEntry* loadedScene;
/* 0x12430 */ char unk_12430[0xE8];
} GlobalContext; // size = 0x12518
} PlayState; // size = 0x12518
typedef struct {
/* 0x0000 */ GameState state;

View File

@ -14,14 +14,14 @@
#define MASS_HEAVY 0xFE // Can only be pushed by OC collisions with IMMOVABLE and HEAVY objects.
struct Actor;
struct GlobalContext;
struct PlayState;
struct Lights;
typedef void (*ActorFunc)(struct Actor*, struct GlobalContext*);
typedef void (*ActorFunc)(struct Actor*, struct PlayState*);
typedef void (*ActorResetFunc)(void);
typedef void (*ActorShadowFunc)(struct Actor*, struct Lights*, struct GlobalContext*);
typedef u16 (*callback1_800343CC)(struct GlobalContext*, struct Actor*);
typedef s16 (*callback2_800343CC)(struct GlobalContext*, struct Actor*);
typedef void (*ActorShadowFunc)(struct Actor*, struct Lights*, struct PlayState*);
typedef u16 (*callback1_800343CC)(struct PlayState*, struct Actor*);
typedef s16 (*callback2_800343CC)(struct PlayState*, struct Actor*);
typedef struct {
Vec3f pos;
@ -278,7 +278,7 @@ typedef enum {
struct EnItem00;
typedef void (*EnItem00ActionFunc)(struct EnItem00*, struct GlobalContext*);
typedef void (*EnItem00ActionFunc)(struct EnItem00*, struct PlayState*);
typedef struct EnItem00 {
/* 0x000 */ Actor actor;
@ -314,7 +314,7 @@ typedef enum {
struct EnAObj;
typedef void (*EnAObjActionFunc)(struct EnAObj*, struct GlobalContext*);
typedef void (*EnAObjActionFunc)(struct EnAObj*, struct PlayState*);
typedef struct EnAObj {
/* 0x000 */ DynaPolyActor dyna;

View File

@ -5,7 +5,7 @@
#include "z64dma.h"
#include "z64math.h"
struct GlobalContext;
struct PlayState;
struct Actor;
struct SkelAnime;
@ -106,15 +106,15 @@ typedef struct {
/* 0x08 */ JointKey* jointKey;
} LegacyAnimationHeader; // size = 0xC
typedef s32 (*OverrideLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
typedef s32 (*OverrideLimbDrawOpa)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void*);
typedef void (*PostLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void*);
typedef void (*PostLimbDrawOpa)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void*);
typedef s32 (*OverrideLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
typedef s32 (*OverrideLimbDraw)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void*, Gfx** gfx);
typedef void (*PostLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void*, Gfx** gfx);
typedef void (*PostLimbDraw)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void*, Gfx** gfx);
typedef enum {
ANIMENTRY_LOADFRAME,
@ -187,7 +187,7 @@ typedef struct AnimationContext {
AnimationEntry entries[ANIMATION_ENTRY_MAX];
} AnimationContext; // size = 0xC84
typedef void (*AnimationEntryCallback)(struct GlobalContext* globalCtx, AnimationEntryData* data);
typedef void (*AnimationEntryCallback)(struct PlayState* play, AnimationEntryData* data);
// fcurve_skelanime structs
typedef struct {
@ -234,8 +234,8 @@ typedef struct {
/* 0x001C */ LimbTransform* transforms;
} SkelAnimeCurve; // size = 0x20
typedef s32 (*OverrideCurveLimbDraw)(struct GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, s32 limbIndex, void*);
typedef void (*PostCurveLimbDraw)(struct GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, s32 limbIndex, void*);
typedef s32 (*OverrideCurveLimbDraw)(struct PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void*);
typedef void (*PostCurveLimbDraw)(struct PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void*);
typedef s32 (*AnimUpdateFunc)();

View File

@ -1,7 +1,7 @@
#ifndef Z_BGCHECK_H
#define Z_BGCHECK_H
struct GlobalContext;
struct PlayState;
struct Actor;
struct DynaPolyActor;
@ -166,7 +166,7 @@ typedef struct CollisionContext {
} CollisionContext; // size = 0x1464
typedef struct {
/* 0x00 */ struct GlobalContext* globalCtx;
/* 0x00 */ struct PlayState* play;
/* 0x04 */ struct CollisionContext* colCtx;
/* 0x08 */ u16 xpFlags;
/* 0x0C */ CollisionPoly** resultPoly;

View File

@ -18,8 +18,8 @@
#define SUBCAM_ACTIVE -1
#define ONEPOINT_CS_INFO(camera) ((Unique9OnePointCs*)camera->paramData)
#define PARENT_CAM(cam) ((cam)->globalCtx->cameraPtrs[(cam)->parentCamIdx])
#define CHILD_CAM(cam) ((cam)->globalCtx->cameraPtrs[(cam)->childCamIdx])
#define PARENT_CAM(cam) ((cam)->play->cameraPtrs[(cam)->parentCamIdx])
#define CHILD_CAM(cam) ((cam)->play->cameraPtrs[(cam)->childCamIdx])
typedef enum {
/* 0x00 */ CAM_SET_NONE,
@ -1163,7 +1163,7 @@ typedef struct {
/* 0x068 */ Vec3f up;
/* 0x074 */ Vec3f eyeNext;
/* 0x080 */ Vec3f skyboxOffset;
/* 0x08C */ struct GlobalContext* globalCtx;
/* 0x08C */ struct PlayState* play;
/* 0x090 */ struct Player* player;
/* 0x094 */ PosRot playerPosRot;
/* 0x0A8 */ struct Actor* target;

View File

@ -4,7 +4,7 @@
#include <libultraship/color.h>
struct GraphicsContext;
struct GlobalContext;
struct PlayState;
/* Effects */
@ -163,7 +163,7 @@ typedef struct {
} EffectShieldParticle; // size = 0x1C8
typedef struct {
/* 0x0000 */ struct GlobalContext* globalCtx;
/* 0x0000 */ struct PlayState* play;
struct {
EffectStatus status;
EffectSpark effect;
@ -197,9 +197,9 @@ typedef enum {
struct EffectSs;
typedef u32 (*EffectSsInitFunc)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* effectSs, void* initParams);
typedef void (*EffectSsUpdateFunc)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* effectSs);
typedef void (*EffectSsDrawFunc)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* effectSs);
typedef u32 (*EffectSsInitFunc)(struct PlayState* play, u32 index, struct EffectSs* effectSs, void* initParams);
typedef void (*EffectSsUpdateFunc)(struct PlayState* play, u32 index, struct EffectSs* effectSs);
typedef void (*EffectSsDrawFunc)(struct PlayState* play, u32 index, struct EffectSs* effectSs);
typedef struct {
/* 0x00 */ u32 type;

View File

@ -451,9 +451,9 @@ typedef struct {
#define PLAYER_STATE3_6 (1 << 6)
#define PLAYER_STATE3_7 (1 << 7)
typedef void (*PlayerFunc674)(struct Player*, struct GlobalContext*);
typedef s32(*PlayerFunc82C)(struct Player*, struct GlobalContext*);
typedef void (*PlayerFuncA74)(struct GlobalContext*, struct Player*);
typedef void (*PlayerFunc674)(struct Player*, struct PlayState*);
typedef s32(*PlayerFunc82C)(struct Player*, struct PlayState*);
typedef void (*PlayerFuncA74)(struct PlayState*, struct Player*);
typedef struct Player {
/* 0x0000 */ Actor actor;

View File

@ -79,8 +79,8 @@ typedef struct {
/* 0x04C */ SkelAnime skelAnime;
} Skin; // size = 0x90
typedef void (*SkinPostDraw)(struct Actor*, struct GlobalContext*, Skin*);
typedef s32 (*SkinOverrideLimbDraw)(struct Actor*, struct GlobalContext*, s32, Skin*);
typedef void (*SkinPostDraw)(struct Actor*, struct PlayState*, Skin*);
typedef s32 (*SkinOverrideLimbDraw)(struct Actor*, struct PlayState*, s32, Skin*);
#define SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS (1 << 0)
#define SKIN_DRAW_FLAG_CUSTOM_MATRIX (1 << 1)

View File

@ -13,7 +13,7 @@
append_str(buff, len, varName); \
append_str(buff, len, varValue);
extern "C" GlobalContext* gGlobalCtx;
extern "C" PlayState* gPlayState;
static std::array<const char*, ACTORCAT_MAX> sCatToStrArray{
"SWITCH", "BG", "PLAYER", "EXPLOSIVE", "NPC", "ENEMY", "PROP", "ITEMACTION", "MISC", "BOSS", "DOOR", "CHEST",
@ -139,7 +139,7 @@ static void CrashHandler_WriteActorData(char* buffer, size_t* pos) {
append_line(buffer, pos, "Actor Id Params");
for (unsigned int i = 0; i < ACTORCAT_MAX; i++) {
ActorListEntry* entry = &gGlobalCtx->actorCtx.actorLists[i];
ActorListEntry* entry = &gPlayState->actorCtx.actorLists[i];
Actor* cur;
if(entry->length == 0) {
@ -167,13 +167,13 @@ extern "C" void CrashHandler_PrintSohData(char* buffer, size_t* pos) {
WRITE_VAR_LINE(buffer, pos, "Game Version: ", (const char*)gBuildVersion);
WRITE_VAR_LINE(buffer, pos, "Build Date: ", (const char*)gBuildDate);
if (gGlobalCtx != nullptr) {
if (gPlayState != nullptr) {
append_line(buffer, pos, "Actors:");
CrashHandler_WriteActorData(buffer, pos);
WRITE_VAR_LINE(buffer, pos, "Scene: ", sSceneIdToStrArray[gGlobalCtx->sceneNum]);
WRITE_VAR_LINE(buffer, pos, "Scene: ", sSceneIdToStrArray[gPlayState->sceneNum]);
snprintf(intCharBuffer, sizeof(intCharBuffer), "%i", gGlobalCtx->roomCtx.curRoom.num);
snprintf(intCharBuffer, sizeof(intCharBuffer), "%i", gPlayState->roomCtx.curRoom.num);
WRITE_VAR_LINE(buffer, pos, "Room: ", intCharBuffer);
}
}

View File

@ -12,7 +12,7 @@ extern "C" {
#include "variables.h"
#include "functions.h"
#include "macros.h"
extern GlobalContext* gGlobalCtx;
extern PlayState* gPlayState;
}
#include "../debugconsole.h"
@ -286,11 +286,11 @@ void CrowdControl::ReceiveFromCrowdControl()
CrowdControl::EffectResult CrowdControl::ExecuteEffect(std::string effectId, uint32_t value, bool dryRun) {
// Don't execute effect and don't advance timer when the player is not in a proper loaded savefile
// and when they're busy dying.
if (gGlobalCtx == NULL || gGlobalCtx->gameOverCtx.state > 0 || gSaveContext.fileNum < 0 || gSaveContext.fileNum > 2) {
if (gPlayState == NULL || gPlayState->gameOverCtx.state > 0 || gSaveContext.fileNum < 0 || gSaveContext.fileNum > 2) {
return EffectResult::Retry;
}
Player* player = GET_PLAYER(gGlobalCtx);
Player* player = GET_PLAYER(gPlayState);
if (player != NULL) {
if (effectId == "add_heart_container") {
@ -338,8 +338,8 @@ CrowdControl::EffectResult CrowdControl::ExecuteEffect(std::string effectId, uin
}
}
if (player != NULL && !Player_InBlockingCsMode(gGlobalCtx, player) && gGlobalCtx->pauseCtx.state == 0
&& gGlobalCtx->msgCtx.msgMode == 0) {
if (player != NULL && !Player_InBlockingCsMode(gPlayState, player) && gPlayState->pauseCtx.state == 0
&& gPlayState->msgCtx.msgMode == 0) {
if (effectId == "high_gravity") {
if (dryRun == 0) CMD_EXECUTE("gravity 2");
return EffectResult::Success;
@ -432,7 +432,7 @@ CrowdControl::EffectResult CrowdControl::ExecuteEffect(std::string effectId, uin
}
bool CrowdControl::SpawnEnemy(std::string effectId) {
Player* player = GET_PLAYER(gGlobalCtx);
Player* player = GET_PLAYER(gPlayState);
int enemyId = 0;
int enemyParams = 0;
@ -488,17 +488,17 @@ bool CrowdControl::SpawnEnemy(std::string effectId) {
posYOffset = 50;
}
return Actor_Spawn(&gGlobalCtx->actorCtx, gGlobalCtx, enemyId, player->actor.world.pos.x + posXOffset,
return Actor_Spawn(&gPlayState->actorCtx, gPlayState, enemyId, player->actor.world.pos.x + posXOffset,
player->actor.world.pos.y + posYOffset, player->actor.world.pos.z + posZOffset, 0, 0, 0, enemyParams);
}
void CrowdControl::RemoveEffect(std::string effectId) {
if (gGlobalCtx == NULL) {
if (gPlayState == NULL) {
return;
}
Player* player = GET_PLAYER(gGlobalCtx);
Player* player = GET_PLAYER(gPlayState);
if (player != NULL) {
if (effectId == "giant_link"

View File

@ -24,7 +24,7 @@ extern "C" {
#include "variables.h"
#include "functions.h"
#include "macros.h"
extern GlobalContext* gGlobalCtx;
extern PlayState* gPlayState;
}
#include <libultraship/Cvar.h>
@ -52,12 +52,12 @@ static bool ActorSpawnHandler(std::shared_ptr<Ship::Console> Console, const std:
return CMD_FAILED;
}
if (gGlobalCtx == nullptr) {
SohImGui::GetConsole()->SendErrorMessage("GlobalCtx == nullptr");
if (gPlayState == nullptr) {
SohImGui::GetConsole()->SendErrorMessage("PlayState == nullptr");
return CMD_FAILED;
}
Player* player = GET_PLAYER(gGlobalCtx);
Player* player = GET_PLAYER(gPlayState);
PosRot spawnPoint;
const s16 actorId = std::stoi(args[1]);
const s16 params = std::stoi(args[2]);
@ -87,7 +87,7 @@ static bool ActorSpawnHandler(std::shared_ptr<Ship::Console> Console, const std:
}
}
if (Actor_Spawn(&gGlobalCtx->actorCtx, gGlobalCtx, actorId, spawnPoint.pos.x, spawnPoint.pos.y, spawnPoint.pos.z,
if (Actor_Spawn(&gPlayState->actorCtx, gPlayState, actorId, spawnPoint.pos.x, spawnPoint.pos.y, spawnPoint.pos.z,
spawnPoint.rot.x, spawnPoint.rot.y, spawnPoint.rot.z, params) == NULL) {
SohImGui::GetConsole()->SendErrorMessage("Failed to spawn actor. Actor_Spawn returned NULL");
return CMD_FAILED;
@ -97,8 +97,8 @@ static bool ActorSpawnHandler(std::shared_ptr<Ship::Console> Console, const std:
static bool GiveDekuShieldHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>&) {
// Give Deku Shield to the player, and automatically equip it when they're child and have no shield currently equiped.
Player* player = GET_PLAYER(gGlobalCtx);
Item_Give(gGlobalCtx, ITEM_SHIELD_DEKU);
Player* player = GET_PLAYER(gPlayState);
Item_Give(gPlayState, ITEM_SHIELD_DEKU);
if (LINK_IS_CHILD && player->currentShield == PLAYER_SHIELD_NONE) {
player->currentShield = PLAYER_SHIELD_DEKU;
Inventory_ChangeEquipment(EQUIP_SHIELD, PLAYER_SHIELD_DEKU);
@ -173,12 +173,12 @@ static bool RupeeHandler(std::shared_ptr<Ship::Console> Console, const std::vect
}
static bool SetPosHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string> args) {
if (gGlobalCtx == nullptr) {
SohImGui::GetConsole()->SendErrorMessage("GlobalCtx == nullptr");
if (gPlayState == nullptr) {
SohImGui::GetConsole()->SendErrorMessage("PlayState == nullptr");
return CMD_FAILED;
}
Player* player = GET_PLAYER(gGlobalCtx);
Player* player = GET_PLAYER(gPlayState);
if (args.size() == 1) {
SohImGui::GetConsole()->SendInfoMessage("Player position is [ %.2f, %.2f, %.2f ]", player->actor.world.pos.x,
@ -200,13 +200,13 @@ static bool SetPosHandler(std::shared_ptr<Ship::Console> Console, const std::vec
}
static bool ResetHandler(std::shared_ptr<Ship::Console> Console, std::vector<std::string> args) {
if (gGlobalCtx == nullptr) {
SohImGui::GetConsole()->SendErrorMessage("GlobalCtx == nullptr");
if (gPlayState == nullptr) {
SohImGui::GetConsole()->SendErrorMessage("PlayState == nullptr");
return CMD_FAILED;
}
SET_NEXT_GAMESTATE(&gGlobalCtx->state, TitleSetup_Init, GameState);
gGlobalCtx->state.running = false;
SET_NEXT_GAMESTATE(&gPlayState->state, TitleSetup_Init, GameState);
gPlayState->state.running = false;
return CMD_SUCCESS;
}
@ -332,7 +332,7 @@ static bool GiveItemHandler(std::shared_ptr<Ship::Console> Console, const std::v
return CMD_FAILED;
}
GiveItemEntryWithoutActor(gGlobalCtx, getItemEntry);
GiveItemEntryWithoutActor(gPlayState, getItemEntry);
return CMD_SUCCESS;
}
@ -352,53 +352,53 @@ static bool EntranceHandler(std::shared_ptr<Ship::Console> Console, const std::v
return CMD_FAILED;
}
gGlobalCtx->nextEntranceIndex = entrance;
gGlobalCtx->sceneLoadFlag = 0x14;
gGlobalCtx->fadeTransition = 11;
gPlayState->nextEntranceIndex = entrance;
gPlayState->sceneLoadFlag = 0x14;
gPlayState->fadeTransition = 11;
gSaveContext.nextTransition = 11;
}
static bool VoidHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (gGlobalCtx != nullptr) {
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = gGlobalCtx->actorCtx.flags.tempSwch;
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = gGlobalCtx->actorCtx.flags.tempCollect;
if (gPlayState != nullptr) {
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = gPlayState->actorCtx.flags.tempSwch;
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = gPlayState->actorCtx.flags.tempCollect;
gSaveContext.respawnFlag = 1;
gGlobalCtx->sceneLoadFlag = 0x14;
gGlobalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex;
gGlobalCtx->fadeTransition = 2;
gPlayState->sceneLoadFlag = 0x14;
gPlayState->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex;
gPlayState->fadeTransition = 2;
gSaveContext.nextTransition = 2;
} else {
SohImGui::GetConsole()->SendErrorMessage("gGlobalCtx == nullptr");
SohImGui::GetConsole()->SendErrorMessage("gPlayState == nullptr");
return CMD_FAILED;
}
return CMD_SUCCESS;
}
static bool ReloadHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (gGlobalCtx != nullptr) {
gGlobalCtx->nextEntranceIndex = gSaveContext.entranceIndex;
gGlobalCtx->sceneLoadFlag = 0x14;
gGlobalCtx->fadeTransition = 11;
if (gPlayState != nullptr) {
gPlayState->nextEntranceIndex = gSaveContext.entranceIndex;
gPlayState->sceneLoadFlag = 0x14;
gPlayState->fadeTransition = 11;
gSaveContext.nextTransition = 11;
} else {
SohImGui::GetConsole()->SendErrorMessage("gGlobalCtx == nullptr");
SohImGui::GetConsole()->SendErrorMessage("gPlayState == nullptr");
return CMD_FAILED;
}
return CMD_SUCCESS;
}
static bool FWHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (gGlobalCtx != nullptr) {
if (gPlayState != nullptr) {
if (gSaveContext.respawn[RESPAWN_MODE_TOP].data > 0) {
gGlobalCtx->sceneLoadFlag = 0x14;
gGlobalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex;
gGlobalCtx->fadeTransition = 5;
gPlayState->sceneLoadFlag = 0x14;
gPlayState->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex;
gPlayState->fadeTransition = 5;
} else {
SohImGui::GetConsole()->SendErrorMessage("Farore's wind not set!");
}
}
else {
SohImGui::GetConsole()->SendErrorMessage("gGlobalCtx == nullptr");
SohImGui::GetConsole()->SendErrorMessage("gPlayState == nullptr");
return CMD_FAILED;
}
@ -406,18 +406,18 @@ static bool FWHandler(std::shared_ptr<Ship::Console> Console, const std::vector<
}
static bool FileSelectHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (gGlobalCtx != nullptr) {
SET_NEXT_GAMESTATE(&gGlobalCtx->state, FileChoose_Init, FileChooseContext);
gGlobalCtx->state.running = 0;
if (gPlayState != nullptr) {
SET_NEXT_GAMESTATE(&gPlayState->state, FileChoose_Init, FileChooseContext);
gPlayState->state.running = 0;
} else {
SohImGui::GetConsole()->SendErrorMessage("gGlobalCtx == nullptr");
SohImGui::GetConsole()->SendErrorMessage("gPlayState == nullptr");
return CMD_FAILED;
}
return CMD_SUCCESS;
}
static bool QuitHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
gGlobalCtx->state.running = 0;
gPlayState->state.running = 0;
return CMD_SUCCESS;
}
@ -490,7 +490,7 @@ static bool InvisibleHandler(std::shared_ptr<Ship::Console> Console, const std::
try {
chaosEffectInvisibleLink = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
if (!chaosEffectInvisibleLink) {
Player* player = GET_PLAYER(gGlobalCtx);
Player* player = GET_PLAYER(gPlayState);
player->actor.shape.shadowDraw = ActorShadow_DrawFeet;
}
@ -624,10 +624,10 @@ static bool DamageHandler(std::shared_ptr<Ship::Console> Console, const std::vec
return CMD_FAILED;
}
Player* player = GET_PLAYER(gGlobalCtx);
Player* player = GET_PLAYER(gPlayState);
Health_ChangeBy(gGlobalCtx, -value * 0x10);
func_80837C0C(gGlobalCtx, player, 0, 0, 0, 0, 0);
Health_ChangeBy(gPlayState, -value * 0x10);
func_80837C0C(gPlayState, player, 0, 0, 0, 0, 0);
player->invincibilityTimer = 28;
return CMD_SUCCESS;
@ -650,7 +650,7 @@ static bool HealHandler(std::shared_ptr<Ship::Console> Console, const std::vecto
return CMD_FAILED;
}
Health_ChangeBy(gGlobalCtx, value * 0x10);
Health_ChangeBy(gPlayState, value * 0x10);
return CMD_SUCCESS;
} catch (std::invalid_argument const& ex) {
SohImGui::GetConsole()->SendErrorMessage("[SOH] Heal value must be a number.");
@ -659,7 +659,7 @@ static bool HealHandler(std::shared_ptr<Ship::Console> Console, const std::vecto
}
static bool FillMagicHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
Magic_Fill(gGlobalCtx);
Magic_Fill(gPlayState);
return CMD_SUCCESS;
}
@ -708,7 +708,7 @@ static bool PacifistHandler(std::shared_ptr<Ship::Console> Console, const std::v
chaosEffectPacifistMode = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
// Force interface to update to make the buttons transparent
gSaveContext.unk_13E8 = 50;
Interface_Update(gGlobalCtx);
Interface_Update(gPlayState);
return CMD_SUCCESS;
} catch (std::invalid_argument const& ex) {
SohImGui::GetConsole()->SendErrorMessage("[SOH] Pacifist value must be a number.");
@ -746,30 +746,30 @@ static bool RainstormHandler(std::shared_ptr<Ship::Console> Console, const std::
try {
uint32_t rainstorm = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1;
if (rainstorm) {
gGlobalCtx->envCtx.unk_F2[0] = 20; // rain intensity target
gGlobalCtx->envCtx.gloomySkyMode = 1; // start gloomy sky
if ((gWeatherMode != 0) || gGlobalCtx->envCtx.unk_17 != 0) {
gGlobalCtx->envCtx.unk_DE = 1;
gPlayState->envCtx.unk_F2[0] = 20; // rain intensity target
gPlayState->envCtx.gloomySkyMode = 1; // start gloomy sky
if ((gWeatherMode != 0) || gPlayState->envCtx.unk_17 != 0) {
gPlayState->envCtx.unk_DE = 1;
}
gGlobalCtx->envCtx.lightningMode = LIGHTNING_MODE_ON;
Environment_PlayStormNatureAmbience(gGlobalCtx);
gPlayState->envCtx.lightningMode = LIGHTNING_MODE_ON;
Environment_PlayStormNatureAmbience(gPlayState);
} else {
gGlobalCtx->envCtx.unk_F2[0] = 0;
if (gGlobalCtx->csCtx.state == CS_STATE_IDLE) {
Environment_StopStormNatureAmbience(gGlobalCtx);
gPlayState->envCtx.unk_F2[0] = 0;
if (gPlayState->csCtx.state == CS_STATE_IDLE) {
Environment_StopStormNatureAmbience(gPlayState);
} else if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_AMBIENCE) {
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_1, 0);
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 0);
}
osSyncPrintf("\n\n\nE_wether_flg=[%d]", gWeatherMode);
osSyncPrintf("\nrain_evt_trg=[%d]\n\n", gGlobalCtx->envCtx.gloomySkyMode);
if (gWeatherMode == 0 && (gGlobalCtx->envCtx.gloomySkyMode == 1)) {
gGlobalCtx->envCtx.gloomySkyMode = 2; // end gloomy sky
osSyncPrintf("\nrain_evt_trg=[%d]\n\n", gPlayState->envCtx.gloomySkyMode);
if (gWeatherMode == 0 && (gPlayState->envCtx.gloomySkyMode == 1)) {
gPlayState->envCtx.gloomySkyMode = 2; // end gloomy sky
} else {
gGlobalCtx->envCtx.gloomySkyMode = 0;
gGlobalCtx->envCtx.unk_DE = 0;
gPlayState->envCtx.gloomySkyMode = 0;
gPlayState->envCtx.unk_DE = 0;
}
gGlobalCtx->envCtx.lightningMode = LIGHTNING_MODE_LAST;
gPlayState->envCtx.lightningMode = LIGHTNING_MODE_LAST;
}
@ -844,10 +844,10 @@ static bool BootsHandler(std::shared_ptr<Ship::Console> Console, const std::vect
return CMD_FAILED;
}
Player* player = GET_PLAYER(gGlobalCtx);
Player* player = GET_PLAYER(gPlayState);
player->currentBoots = it->second;
Inventory_ChangeEquipment(EQUIP_BOOTS, it->second + 1);
Player_SetBootData(gGlobalCtx, player);
Player_SetBootData(gPlayState, player);
return CMD_SUCCESS;
}
@ -865,8 +865,8 @@ static bool KnockbackHandler(std::shared_ptr<Ship::Console> Console, const std::
return CMD_FAILED;
}
Player* player = GET_PLAYER(gGlobalCtx);
func_8002F71C(gGlobalCtx, &player->actor, value * 5, player->actor.world.rot.y + 0x8000, value * 5);
Player* player = GET_PLAYER(gPlayState);
func_8002F71C(gPlayState, &player->actor, value * 5, player->actor.world.rot.y + 0x8000, value * 5);
return CMD_SUCCESS;
} catch (std::invalid_argument const& ex) {
@ -876,9 +876,9 @@ static bool KnockbackHandler(std::shared_ptr<Ship::Console> Console, const std::
}
static bool ElectrocuteHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
Player* player = GET_PLAYER(gGlobalCtx);
Player* player = GET_PLAYER(gPlayState);
if (PlayerGrounded(player)) {
func_80837C0C(gGlobalCtx, player, 4, 0, 0, 0, 0);
func_80837C0C(gPlayState, player, 4, 0, 0, 0, 0);
return CMD_SUCCESS;
}
@ -886,21 +886,21 @@ static bool ElectrocuteHandler(std::shared_ptr<Ship::Console> Console, const std
}
static bool BurnHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
Player* player = GET_PLAYER(gGlobalCtx);
Player* player = GET_PLAYER(gPlayState);
if (PlayerGrounded(player)) {
for (int i = 0; i < 18; i++) {
player->flameTimers[i] = Rand_S16Offset(0, 200);
}
player->isBurning = true;
func_80837C0C(gGlobalCtx, player, 0, 0, 0, 0, 0);
func_80837C0C(gPlayState, player, 0, 0, 0, 0, 0);
return CMD_FAILED;
}
return CMD_SUCCESS;
}
static bool CuccoStormHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
Player* player = GET_PLAYER(gGlobalCtx);
EnNiw* cucco = (EnNiw*)Actor_Spawn(&gGlobalCtx->actorCtx, gGlobalCtx, ACTOR_EN_NIW, player->actor.world.pos.x,
Player* player = GET_PLAYER(gPlayState);
EnNiw* cucco = (EnNiw*)Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_NIW, player->actor.world.pos.x,
player->actor.world.pos.y + 2200, player->actor.world.pos.z, 0, 0, 0, 0);
cucco->actionFunc = func_80AB70A0_nocutscene;
return CMD_SUCCESS;

View File

@ -15,7 +15,7 @@ extern "C" {
#include "variables.h"
#include "functions.h"
#include "macros.h"
extern GlobalContext* gGlobalCtx;
extern PlayState* gPlayState;
#include "textures/icon_item_static/icon_item_static.h"
#include "textures/icon_item_24_static/icon_item_24_static.h"
@ -99,7 +99,7 @@ std::map<u16, const char*> actorDescriptions = {
{ ACTOR_EN_TP, "Electric Tailpasaran" },
{ ACTOR_EN_ST, "Skulltula" },
{ ACTOR_EN_BW, "Torch Slug" },
{ ACTOR_EN_A_OBJ, "Gameplay_keep items" },
{ ACTOR_EN_A_OBJ, "Play_keep items" },
{ ACTOR_EN_EIYER, "Stinger (Land)" },
{ ACTOR_EN_RIVER_SOUND, "Ambient Sound Effects" },
{ ACTOR_EN_HORSE_NORMAL, "Horse" },
@ -516,8 +516,8 @@ void PopulateActorDropdown(int i, std::vector<Actor*>& data) {
if (data.size() != 0) {
data.clear();
}
if (gGlobalCtx != nullptr) {
ActorListEntry currList = gGlobalCtx->actorCtx.actorLists[i];
if (gPlayState != nullptr) {
ActorListEntry currList = gPlayState->actorCtx.actorLists[i];
Actor* currAct = currList.head;
if (currAct != nullptr) {
while (currAct != nullptr) {
@ -555,8 +555,8 @@ void DrawActorViewer(bool& open) {
static std::vector<Actor*> list;
static u16 lastSceneId = 0;
if (gGlobalCtx != nullptr) {
needs_reset = lastSceneId != gGlobalCtx->sceneNum;
if (gPlayState != nullptr) {
needs_reset = lastSceneId != gPlayState->sceneNum;
if (needs_reset) {
display = empty;
fetch = nullptr;
@ -566,7 +566,7 @@ void DrawActorViewer(bool& open) {
list.clear();
needs_reset = false;
}
lastSceneId = gGlobalCtx->sceneNum;
lastSceneId = gPlayState->sceneNum;
if (ImGui::BeginCombo("Actor Type", acMapping[category])) {
for (int i = 0; i < acMapping.size(); i++) {
if (ImGui::Selectable(acMapping[i])) {
@ -579,9 +579,9 @@ void DrawActorViewer(bool& open) {
}
if (ImGui::BeginCombo("Actor", filler.c_str())) {
if (gGlobalCtx != nullptr && lastSceneId != gGlobalCtx->sceneNum) {
if (gPlayState != nullptr && lastSceneId != gPlayState->sceneNum) {
PopulateActorDropdown(category, list);
lastSceneId = gGlobalCtx->sceneNum;
lastSceneId = gPlayState->sceneNum;
}
for (int i = 0; i < list.size(); i++) {
std::string label = std::to_string(i) + ": " + list[i]->overlayEntry->name;
@ -652,13 +652,13 @@ void DrawActorViewer(bool& open) {
}
if (ImGui::Button("Go to Actor")) {
Player* player = GET_PLAYER(gGlobalCtx);
Player* player = GET_PLAYER(gPlayState);
Math_Vec3f_Copy(&player->actor.world.pos, &display.world.pos);
Math_Vec3f_Copy(&player->actor.home.pos, &player->actor.world.pos);
}
if (ImGui::Button("Fetch from Target")) {
Player* player = GET_PLAYER(gGlobalCtx);
Player* player = GET_PLAYER(gPlayState);
fetch = player->targetActor;
if (fetch != NULL) {
display = *fetch;
@ -669,7 +669,7 @@ void DrawActorViewer(bool& open) {
}
UIWidgets::InsertHelpHoverText("Grabs actor with target arrow above it. You might need C-Up for enemies");
if (ImGui::Button("Fetch from Held")) {
Player* player = GET_PLAYER(gGlobalCtx);
Player* player = GET_PLAYER(gPlayState);
fetch = player->heldActor;
if (fetch != NULL) {
display = *fetch;
@ -680,7 +680,7 @@ void DrawActorViewer(bool& open) {
}
UIWidgets::InsertHelpHoverText("Grabs actor that Link is holding");
if (ImGui::Button("Fetch from Interaction")) {
Player* player = GET_PLAYER(gGlobalCtx);
Player* player = GET_PLAYER(gPlayState);
fetch = player->interactRangeActor;
if (fetch != NULL) {
display = *fetch;
@ -722,7 +722,7 @@ void DrawActorViewer(bool& open) {
});
if (ImGui::Button("Fetch from Link")) {
Player* player = GET_PLAYER(gGlobalCtx);
Player* player = GET_PLAYER(gPlayState);
Vec3f newPos = player->actor.world.pos;
Vec3s newRot = player->actor.world.rot;
newActor.pos = newPos;
@ -731,7 +731,7 @@ void DrawActorViewer(bool& open) {
if (ImGui::Button("Spawn")) {
if (newActor.id >= 0 && newActor.id < ACTOR_ID_MAX && gActorOverlayTable[newActor.id].initInfo != NULL) {
Actor_Spawn(&gGlobalCtx->actorCtx, gGlobalCtx, newActor.id, newActor.pos.x, newActor.pos.y,
Actor_Spawn(&gPlayState->actorCtx, gPlayState, newActor.id, newActor.pos.x, newActor.pos.y,
newActor.pos.z, newActor.rot.x, newActor.rot.y, newActor.rot.z, newActor.params);
} else {
func_80078884(NA_SE_SY_ERROR);
@ -743,7 +743,7 @@ void DrawActorViewer(bool& open) {
if (parent != NULL) {
if (newActor.id >= 0 && newActor.id < ACTOR_ID_MAX &&
gActorOverlayTable[newActor.id].initInfo != NULL) {
Actor_SpawnAsChild(&gGlobalCtx->actorCtx, parent, gGlobalCtx, newActor.id, newActor.pos.x,
Actor_SpawnAsChild(&gPlayState->actorCtx, parent, gPlayState, newActor.id, newActor.pos.x,
newActor.pos.y, newActor.pos.z, newActor.rot.x, newActor.rot.y,
newActor.rot.z, newActor.params);
} else {

View File

@ -13,7 +13,7 @@ extern "C" {
#include "variables.h"
#include "functions.h"
#include "macros.h"
extern GlobalContext* gGlobalCtx;
extern PlayState* gPlayState;
}
enum class ColRenderSetting { Disabled, Solid, Transparent };
@ -358,29 +358,29 @@ void DrawDynapoly(std::vector<Gfx>& dl, CollisionHeader* col, int32_t bgId) {
for (int i = 0; i < col->numPolygons; i++) {
CollisionPoly* poly = &col->polyList[i];
if (SurfaceType_IsHookshotSurface(&gGlobalCtx->colCtx, poly, bgId)) {
if (SurfaceType_IsHookshotSurface(&gPlayState->colCtx, poly, bgId)) {
colorR = CVar_GetS32("gColViewerColorHookshotR", 128);
colorG = CVar_GetS32("gColViewerColorHookshotG", 128);
colorB = CVar_GetS32("gColViewerColorHookshotB", 255);
} else if (func_80041D94(&gGlobalCtx->colCtx, poly, bgId) > 0x01) {
} else if (func_80041D94(&gPlayState->colCtx, poly, bgId) > 0x01) {
colorR = CVar_GetS32("gColViewerColorInteractableR", 192);
colorG = CVar_GetS32("gColViewerColorInteractableG", 0);
colorB = CVar_GetS32("gColViewerColorInteractableB", 192);
} else if (func_80041E80(&gGlobalCtx->colCtx, poly, bgId) == 0x0C) {
} else if (func_80041E80(&gPlayState->colCtx, poly, bgId) == 0x0C) {
colorR = CVar_GetS32("gColViewerColorVoidR", 255);
colorG = CVar_GetS32("gColViewerColorVoidG", 0);
colorB = CVar_GetS32("gColViewerColorVoidB", 0);
} else if (SurfaceType_GetSceneExitIndex(&gGlobalCtx->colCtx, poly, bgId) ||
func_80041E80(&gGlobalCtx->colCtx, poly, bgId) == 0x05) {
} else if (SurfaceType_GetSceneExitIndex(&gPlayState->colCtx, poly, bgId) ||
func_80041E80(&gPlayState->colCtx, poly, bgId) == 0x05) {
colorR = CVar_GetS32("gColViewerColorEntranceR", 0);
colorG = CVar_GetS32("gColViewerColorEntranceG", 255);
colorB = CVar_GetS32("gColViewerColorEntranceB", 0);
} else if (func_80041D4C(&gGlobalCtx->colCtx, poly, bgId) != 0 ||
SurfaceType_IsWallDamage(&gGlobalCtx->colCtx, poly, bgId)) {
} else if (func_80041D4C(&gPlayState->colCtx, poly, bgId) != 0 ||
SurfaceType_IsWallDamage(&gPlayState->colCtx, poly, bgId)) {
colorR = CVar_GetS32("gColViewerColorSpecialSurfaceR", 192);
colorG = CVar_GetS32("gColViewerColorSpecialSurfaceG", 255);
colorB = CVar_GetS32("gColViewerColorSpecialSurfaceB", 192);
} else if (SurfaceType_GetSlope(&gGlobalCtx->colCtx, poly, bgId) == 0x01) {
} else if (SurfaceType_GetSlope(&gPlayState->colCtx, poly, bgId) == 0x01) {
colorR = CVar_GetS32("gColViewerColorSlopeR", 255);
colorG = CVar_GetS32("gColViewerColorSlopeG", 255);
colorB = CVar_GetS32("gColViewerColorSlopeB", 128);
@ -445,7 +445,7 @@ void DrawSceneCollision() {
InitGfx(dl, showSceneColSetting);
dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH));
DrawDynapoly(dl, gGlobalCtx->colCtx.colHeader, BGCHECK_SCENE);
DrawDynapoly(dl, gPlayState->colCtx.colHeader, BGCHECK_SCENE);
}
// Draws all Bg Actors
@ -460,8 +460,8 @@ void DrawBgActorCollision() {
dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH));
for (int32_t bgIndex = 0; bgIndex < BG_ACTOR_MAX; bgIndex++) {
if (gGlobalCtx->colCtx.dyna.bgActorFlags[bgIndex] & 1) {
BgActor& bg = gGlobalCtx->colCtx.dyna.bgActors[bgIndex];
if (gPlayState->colCtx.dyna.bgActorFlags[bgIndex] & 1) {
BgActor& bg = gPlayState->colCtx.dyna.bgActors[bgIndex];
Mtx m;
MtxF mf;
SkinMatrix_SetTranslateRotateYXZScale(&mf, bg.curTransform.scale.x, bg.curTransform.scale.y,
@ -584,7 +584,7 @@ void DrawColCheckCollision() {
InitGfx(dl, showColCheckSetting);
dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH));
CollisionCheckContext& col = gGlobalCtx->colChkCtx;
CollisionCheckContext& col = gPlayState->colChkCtx;
dl.push_back(gsDPSetPrimColor(0, 0, CVar_GetS32("gColViewerColorOCR", 255), CVar_GetS32("gColViewerColorOCG", 255),
CVar_GetS32("gColViewerColorOCB", 255), 255));
@ -602,7 +602,7 @@ void DrawColCheckCollision() {
void DrawWaterbox(std::vector<Gfx>& dl, WaterBox* water, float water_max_depth = -4000.0f) {
// Skip waterboxes that would be disabled in current room
int32_t room = ((water->properties >> 13) & 0x3F);
if ((room != gGlobalCtx->roomCtx.curRoom.num) && (room != 0x3F)) {
if ((room != gPlayState->roomCtx.curRoom.num) && (room != 0x3F)) {
return;
}
@ -641,14 +641,14 @@ void DrawWaterboxList() {
CVar_GetS32("gColViewerColorWaterboxG", 0),
CVar_GetS32("gColViewerColorWaterboxB", 255), 255));
CollisionHeader* col = gGlobalCtx->colCtx.colHeader;
CollisionHeader* col = gPlayState->colCtx.colHeader;
for (int32_t waterboxIndex = 0; waterboxIndex < col->numWaterBoxes; waterboxIndex++) {
WaterBox* water = &col->waterBoxes[waterboxIndex];
DrawWaterbox(dl, water);
}
// Zora's Domain has a special, hard-coded waterbox with a bottom so you can go under the waterfall
if (gGlobalCtx->sceneNum == SCENE_SPOT07) {
if (gPlayState->sceneNum == SCENE_SPOT07) {
DrawWaterbox(dl, &zdWaterBox, zdWaterBoxMinY);
}
}
@ -663,7 +663,7 @@ template <typename T> size_t ResetVector(T& vec) {
}
void DrawColViewer() {
if (gGlobalCtx == nullptr) {
if (gPlayState == nullptr) {
return;
}
@ -698,7 +698,7 @@ void DrawColViewer() {
return;
}
OPEN_DISPS(gGlobalCtx->state.gfxCtx);
OPEN_DISPS(gPlayState->state.gfxCtx);
opaDl.push_back(gsSPEndDisplayList());
gSPDisplayList(POLY_OPA_DISP++, opaDl.data());
@ -706,5 +706,5 @@ void DrawColViewer() {
xluDl.push_back(gsSPEndDisplayList());
gSPDisplayList(POLY_XLU_DISP++, xluDl.data());
CLOSE_DISPS(gGlobalCtx->state.gfxCtx);
CLOSE_DISPS(gPlayState->state.gfxCtx);
}

View File

@ -17,7 +17,7 @@ extern "C" {
#include "functions.h"
#include "macros.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h"
extern GlobalContext* gGlobalCtx;
extern PlayState* gPlayState;
#include "textures/icon_item_static/icon_item_static.h"
#include "textures/icon_item_24_static/icon_item_24_static.h"
@ -545,7 +545,7 @@ void DrawBGSItemFlag(uint8_t itemID) {
}
} else {
gSaveContext.adultTradeItems &= ~(1 << tradeIndex);
Inventory_ReplaceItem(gGlobalCtx, itemID, Randomizer_GetNextAdultTradeItem());
Inventory_ReplaceItem(gPlayState, itemID, Randomizer_GetNextAdultTradeItem());
}
}
}
@ -730,8 +730,8 @@ void DrawFlagArray16(const FlagTable& flagTable, uint16_t row, uint16_t& flags)
void DrawFlagsTab() {
if (ImGui::TreeNode("Current Scene")) {
if (gGlobalCtx != nullptr) {
ActorContext* act = &gGlobalCtx->actorCtx;
if (gPlayState != nullptr) {
ActorContext* act = &gPlayState->actorCtx;
DrawGroupWithBorder([&]() {
ImGui::Text("Switch");
@ -786,18 +786,18 @@ void DrawFlagsTab() {
ImGui::BeginGroup();
if (ImGui::Button("Reload Flags")) {
act->flags.swch = gSaveContext.sceneFlags[gGlobalCtx->sceneNum].swch;
act->flags.clear = gSaveContext.sceneFlags[gGlobalCtx->sceneNum].clear;
act->flags.collect = gSaveContext.sceneFlags[gGlobalCtx->sceneNum].collect;
act->flags.chest = gSaveContext.sceneFlags[gGlobalCtx->sceneNum].chest;
act->flags.swch = gSaveContext.sceneFlags[gPlayState->sceneNum].swch;
act->flags.clear = gSaveContext.sceneFlags[gPlayState->sceneNum].clear;
act->flags.collect = gSaveContext.sceneFlags[gPlayState->sceneNum].collect;
act->flags.chest = gSaveContext.sceneFlags[gPlayState->sceneNum].chest;
}
UIWidgets::SetLastItemHoverText("Load flags from saved scene flags. Normally happens on scene load");
if (ImGui::Button("Save Flags")) {
gSaveContext.sceneFlags[gGlobalCtx->sceneNum].swch = act->flags.swch;
gSaveContext.sceneFlags[gGlobalCtx->sceneNum].clear = act->flags.clear;
gSaveContext.sceneFlags[gGlobalCtx->sceneNum].collect = act->flags.collect;
gSaveContext.sceneFlags[gGlobalCtx->sceneNum].chest = act->flags.chest;
gSaveContext.sceneFlags[gPlayState->sceneNum].swch = act->flags.swch;
gSaveContext.sceneFlags[gPlayState->sceneNum].clear = act->flags.clear;
gSaveContext.sceneFlags[gPlayState->sceneNum].collect = act->flags.collect;
gSaveContext.sceneFlags[gPlayState->sceneNum].chest = act->flags.chest;
}
UIWidgets::SetLastItemHoverText("Save current scene flags. Normally happens on scene exit");
@ -833,10 +833,10 @@ void DrawFlagsTab() {
}
// Don't show current scene button if there is no current scene
if (gGlobalCtx != nullptr) {
if (gPlayState != nullptr) {
ImGui::SameLine();
if (ImGui::Button("Current")) {
selectedSceneFlagMap = gGlobalCtx->sceneNum;
selectedSceneFlagMap = gPlayState->sceneNum;
}
UIWidgets::SetLastItemHoverText("Open flags for current scene");
}
@ -1316,8 +1316,8 @@ void DrawQuestStatusTab() {
}
void DrawPlayerTab() {
if (gGlobalCtx != nullptr) {
Player* player = GET_PLAYER(gGlobalCtx);
if (gPlayState != nullptr) {
Player* player = GET_PLAYER(gPlayState);
const char* curSword;
const char* curShield;
const char* curTunic;
@ -1434,12 +1434,12 @@ void DrawPlayerTab() {
ImGui::InputScalar("Gravity", ImGuiDataType_Float, &player->actor.gravity);
UIWidgets::InsertHelpHoverText("Rate at which Link falls. Default -4.0f");
if (ImGui::BeginCombo("Link Age on Load", gGlobalCtx->linkAgeOnLoad == 0 ? "Adult" : "Child")) {
if (ImGui::BeginCombo("Link Age on Load", gPlayState->linkAgeOnLoad == 0 ? "Adult" : "Child")) {
if (ImGui::Selectable("Adult")) {
gGlobalCtx->linkAgeOnLoad = 0;
gPlayState->linkAgeOnLoad = 0;
}
if (ImGui::Selectable("Child")) {
gGlobalCtx->linkAgeOnLoad = 1;
gPlayState->linkAgeOnLoad = 1;
}
ImGui::EndCombo();
}

View File

@ -15,6 +15,6 @@
#include <stdio.h>
#include <stdlib.h>
extern GlobalContext* gGlobalCtx;
extern PlayState* gPlayState;
void GameConsole_Init() {}

View File

@ -29,7 +29,7 @@ typedef struct ConsoleCommand
char* description;
} ConsoleCommand;
extern GlobalContext* gGlobalCtx;
extern PlayState* gPlayState;
void GameConsole_Init();

View File

@ -3,13 +3,13 @@
#include "global.h"
#include "z64.h"
extern GlobalContext* gGlobalCtx;
extern PlayState* gPlayState;
/**
* Simple wrapper to load a texture to be drawn.
*/
void sprite_load(sprite_t* sprite) {
OPEN_DISPS(gGlobalCtx->state.gfxCtx);
OPEN_DISPS(gPlayState->state.gfxCtx);
if (sprite->im_siz == G_IM_SIZ_16b) {
gDPLoadTextureBlock(
@ -37,7 +37,7 @@ void sprite_load(sprite_t* sprite) {
);
}
CLOSE_DISPS(gGlobalCtx->state.gfxCtx);
CLOSE_DISPS(gPlayState->state.gfxCtx);
}
/**
@ -48,7 +48,7 @@ void sprite_draw(sprite_t* sprite, int left, int top, int width, int height) {
int width_factor = (1 << 10) * sprite->width / width;
int height_factor = (1 << 10) * sprite->height / height;
OPEN_DISPS(gGlobalCtx->state.gfxCtx);
OPEN_DISPS(gPlayState->state.gfxCtx);
gSPWideTextureRectangle(
OVERLAY_DISP++,
@ -59,5 +59,5 @@ void sprite_draw(sprite_t* sprite, int left, int top, int width, int height) {
width_factor, height_factor
);
CLOSE_DISPS(gGlobalCtx->state.gfxCtx);
CLOSE_DISPS(gPlayState->state.gfxCtx);
}

View File

@ -35,10 +35,10 @@ typedef enum GetItemCategory {
#define GET_ITEM_NONE \
{ ITEM_NONE, 0, 0, 0, 0, 0, 0, 0, false, ITEM_FROM_NPC, ITEM_CATEGORY_JUNK, NULL }
typedef struct GlobalContext GlobalContext;
typedef struct PlayState PlayState;
typedef struct GetItemEntry GetItemEntry;
typedef void (*CustomDrawFunc)(GlobalContext* globalCtx, GetItemEntry* getItemEntry);
typedef void (*CustomDrawFunc)(PlayState* play, GetItemEntry* getItemEntry);
typedef struct GetItemEntry {
/* 0x00 */ uint16_t itemId;

View File

@ -3,9 +3,9 @@
#include "variables.h"
#include "macros.h"
void Randomizer_ConsumeAdultTradeItem(GlobalContext* globalCtx, u8 itemId) {
void Randomizer_ConsumeAdultTradeItem(PlayState* play, u8 itemId) {
gSaveContext.adultTradeItems &= ~ADULT_TRADE_FLAG(itemId);
Inventory_ReplaceItem(globalCtx, itemId, Randomizer_GetNextAdultTradeItem());
Inventory_ReplaceItem(play, itemId, Randomizer_GetNextAdultTradeItem());
}
u8 Randomizer_GetNextAdultTradeItem() {

View File

@ -6,7 +6,7 @@
#define ADULT_TRADE_FLAG(itemId) (1 << (itemId - ITEM_POCKET_EGG))
#define PLAYER_HAS_SHUFFLED_ADULT_TRADE_ITEM(itemID) (gSaveContext.adultTradeItems & ADULT_TRADE_FLAG(itemID))
void Randomizer_ConsumeAdultTradeItem(GlobalContext* globalCtx, u8 itemId);
void Randomizer_ConsumeAdultTradeItem(PlayState* play, u8 itemId);
u8 Randomizer_GetNextAdultTradeItem();
u8 Randomizer_GetPrevAdultTradeItem();

View File

@ -8,7 +8,7 @@
#include "objects/object_gi_bosskey/object_gi_bosskey.h"
#include "objects/object_gi_hearts/object_gi_hearts.h"
extern "C" void Randomizer_DrawSmallKey(GlobalContext* globalCtx, GetItemEntry* getItemEntry) {
extern "C" void Randomizer_DrawSmallKey(PlayState* play, GetItemEntry* getItemEntry) {
s32 pad;
s16 color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_SMALL_KEY;
@ -24,11 +24,11 @@ extern "C" void Randomizer_DrawSmallKey(GlobalContext* globalCtx, GetItemEntry*
{ 80, 80, 80 } // Ganon's Castle
};
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, (char*)__FILE__, __LINE__),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
G_MTX_MODELVIEW | G_MTX_LOAD);
gsDPSetGrayscaleColor(POLY_OPA_DISP++, colors[color_slot][0], colors[color_slot][1], colors[color_slot][2], 255);
@ -38,10 +38,10 @@ extern "C" void Randomizer_DrawSmallKey(GlobalContext* globalCtx, GetItemEntry*
gsSPGrayscale(POLY_OPA_DISP++, false);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
extern "C" void Randomizer_DrawBossKey(GlobalContext* globalCtx, GetItemEntry* getItemEntry) {
extern "C" void Randomizer_DrawBossKey(PlayState* play, GetItemEntry* getItemEntry) {
s32 pad;
s16 color_slot;
color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_BOSS_KEY;
@ -54,11 +54,11 @@ extern "C" void Randomizer_DrawBossKey(GlobalContext* globalCtx, GetItemEntry* g
{ 210, 0, 0 } // Ganon's Castle
};
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, (char*)__FILE__, __LINE__),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
G_MTX_MODELVIEW | G_MTX_LOAD);
if (color_slot == 5) { // Ganon's Boss Key
@ -72,9 +72,9 @@ extern "C" void Randomizer_DrawBossKey(GlobalContext* globalCtx, GetItemEntry* g
gsSPGrayscale(POLY_OPA_DISP++, false);
}
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, (char*)__FILE__, __LINE__),
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
G_MTX_MODELVIEW | G_MTX_LOAD);
gsDPSetGrayscaleColor(POLY_XLU_DISP++, colors[color_slot][0], colors[color_slot][1], colors[color_slot][2],
@ -85,10 +85,10 @@ extern "C" void Randomizer_DrawBossKey(GlobalContext* globalCtx, GetItemEntry* g
gsSPGrayscale(POLY_XLU_DISP++, false);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
extern "C" void Randomizer_DrawKeyRing(GlobalContext* globalCtx, GetItemEntry* getItemEntry) {
extern "C" void Randomizer_DrawKeyRing(PlayState* play, GetItemEntry* getItemEntry) {
s32 pad;
s16 color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_KEY_RING;
@ -104,9 +104,9 @@ extern "C" void Randomizer_DrawKeyRing(GlobalContext* globalCtx, GetItemEntry* g
{ 80, 80, 80 } // Ganon's Castle
};
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gsDPSetGrayscaleColor(POLY_OPA_DISP++, colors[color_slot][0], colors[color_slot][1], colors[color_slot][2], 255);
gsSPGrayscale(POLY_OPA_DISP++, true);
@ -122,7 +122,7 @@ extern "C" void Randomizer_DrawKeyRing(GlobalContext* globalCtx, GetItemEntry* g
Matrix_RotateY(-(0.19f * 2), MTXMODE_APPLY);
Matrix_RotateZ(-(0.20f * 2), MTXMODE_APPLY);
for (int i = 0; i < 5; i++) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, (char*)__FILE__, __LINE__),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
G_MTX_MODELVIEW | G_MTX_LOAD);
Matrix_Translate(3.12f, -0.34f, 17.53f, MTXMODE_APPLY);
Matrix_RotateX(-0.31f, MTXMODE_APPLY);
@ -133,16 +133,16 @@ extern "C" void Randomizer_DrawKeyRing(GlobalContext* globalCtx, GetItemEntry* g
gsSPGrayscale(POLY_OPA_DISP++, false);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
extern "C" void Randomizer_DrawDoubleDefense(GlobalContext* globalCtx, GetItemEntry getItemEntry) {
extern "C" void Randomizer_DrawDoubleDefense(PlayState* play, GetItemEntry getItemEntry) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD);
gsDPSetGrayscaleColor(POLY_XLU_DISP++, 255, 255, 255, 255);
gsSPGrayscale(POLY_XLU_DISP++, true);
@ -153,5 +153,5 @@ extern "C" void Randomizer_DrawDoubleDefense(GlobalContext* globalCtx, GetItemEn
gSPDisplayList(POLY_XLU_DISP++, (Gfx*)gGiHeartContainerDL);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -4,11 +4,11 @@
#include "../item-tables/ItemTableTypes.h"
typedef struct GlobalContext GlobalContext;
typedef struct PlayState PlayState;
extern "C" void Randomizer_DrawSmallKey(GlobalContext* globalCtx, GetItemEntry* getItemEntry);
extern "C" void Randomizer_DrawKeyRing(GlobalContext* globalCtx, GetItemEntry* getItemEntry);
extern "C" void Randomizer_DrawBossKey(GlobalContext* globalCtx, GetItemEntry* getItemEntry);
extern "C" void Randomizer_DrawDoubleDefense(GlobalContext* globalCtx, GetItemEntry getItemEntry);
extern "C" void Randomizer_DrawSmallKey(PlayState* play, GetItemEntry* getItemEntry);
extern "C" void Randomizer_DrawKeyRing(PlayState* play, GetItemEntry* getItemEntry);
extern "C" void Randomizer_DrawBossKey(PlayState* play, GetItemEntry* getItemEntry);
extern "C" void Randomizer_DrawDoubleDefense(PlayState* play, GetItemEntry getItemEntry);
#endif

View File

@ -15,7 +15,7 @@ extern "C" {
#include "variables.h"
#include "functions.h"
#include "macros.h"
extern GlobalContext* gGlobalCtx;
extern PlayState* gPlayState;
#include "textures/icon_item_static/icon_item_static.h"
#include "textures/icon_item_24_static/icon_item_24_static.h"
@ -862,7 +862,7 @@ void DrawItemTracker(bool& open) {
int comboButton1Mask = buttonMap[CVar_GetS32("gItemTrackerComboButton1", 6)];
int comboButton2Mask = buttonMap[CVar_GetS32("gItemTrackerComboButton2", 8)];
bool comboButtonsHeld = buttonsPressed != nullptr && buttonsPressed[0].button & comboButton1Mask && buttonsPressed[0].button & comboButton2Mask;
bool isPaused = CVar_GetS32("gItemTrackerShowOnlyPaused", 0) == 0 || gGlobalCtx != nullptr && gGlobalCtx->pauseCtx.state > 0;
bool isPaused = CVar_GetS32("gItemTrackerShowOnlyPaused", 0) == 0 || gPlayState != nullptr && gPlayState->pauseCtx.state > 0;
if (CVar_GetS32("gItemTrackerWindowType", 0) == 1 || isPaused && (CVar_GetS32("gItemTrackerDisplayType", 0) == 0 ? CVar_GetS32("gItemTrackerEnabled", 0) : comboButtonsHeld)) {
if (

View File

@ -22,7 +22,7 @@
#include "../../src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h"
#include "../../src/overlays/actors/ovl_En_Fr/z_en_fr.h"
extern "C" GlobalContext* gGlobalCtx;
extern "C" PlayState* gPlayState;
// FROM z_lights.c
// I didn't feel like moving it into a header file.
@ -860,7 +860,7 @@ void SaveStateMgr::ProcessSaveStateRequests(void) {
}
SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
if (gGlobalCtx == nullptr) {
if (gPlayState == nullptr) {
SPDLOG_ERROR("[SOH] Can not save or load a state outside of \"GamePlay\"");
SohImGui::GetGameOverlay()->TextDrawNotification(1.0f, true, "states not available here", request.slot);
return SaveStateReturn::FAIL_WRONG_GAMESTATE;

View File

@ -652,7 +652,7 @@ uint32_t IsSceneMasterQuest(s16 sceneNum) {
value = 0;
if (gSaveContext.n64ddFlag) {
if (!OTRGlobals::Instance->gRandomizer->masterQuestDungeons.empty()) {
if (gGlobalCtx != NULL && OTRGlobals::Instance->gRandomizer->masterQuestDungeons.contains(sceneNum)) {
if (gPlayState != NULL && OTRGlobals::Instance->gRandomizer->masterQuestDungeons.contains(sceneNum)) {
value = 1;
}
}
@ -663,7 +663,7 @@ uint32_t IsSceneMasterQuest(s16 sceneNum) {
}
uint32_t IsGameMasterQuest() {
return gGlobalCtx != NULL ? IsSceneMasterQuest(gGlobalCtx->sceneNum) : 0;
return gPlayState != NULL ? IsSceneMasterQuest(gPlayState->sceneNum) : 0;
}
extern "C" uint32_t ResourceMgr_GameHasMasterQuest() {
@ -1898,8 +1898,8 @@ extern "C" CustomMessageEntry Randomizer_GetCustomGetItemMessage(Player* player)
return getItemText;
}
extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx) {
MessageContext* msgCtx = &globalCtx->msgCtx;
extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
MessageContext* msgCtx = &play->msgCtx;
uint16_t textId = msgCtx->textId;
Font* font = &msgCtx->font;
char* buffer = font->msgBuf;
@ -1907,7 +1907,7 @@ extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx) {
CustomMessageEntry messageEntry;
if (gSaveContext.n64ddFlag) {
if (textId == TEXT_RANDOMIZER_CUSTOM_ITEM) {
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
if (player->getItemEntry.getItemId == RG_ICE_TRAP) {
u16 iceTrapTextId = Random(0, NUM_ICE_TRAP_MESSAGES);
messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::IceTrapRandoMessageTableID, iceTrapTextId);
@ -1919,29 +1919,29 @@ extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx) {
} else if (textId == TEXT_RANDOMIZER_GOSSIP_STONE_HINTS && Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) != 0 &&
(Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) == 1 ||
(Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) == 2 &&
Player_GetMask(globalCtx) == PLAYER_MASK_TRUTH) ||
Player_GetMask(play) == PLAYER_MASK_TRUTH) ||
(Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) == 3 && CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY)))) {
s16 actorParams = msgCtx->talkActor->params;
// if we're in a generic grotto
if (globalCtx->sceneNum == 62 && actorParams == 14360) {
if (play->sceneNum == 62 && actorParams == 14360) {
// look for the chest in the actorlist to determine
// which grotto we're in
int numOfActorLists =
sizeof(globalCtx->actorCtx.actorLists) / sizeof(globalCtx->actorCtx.actorLists[0]);
sizeof(play->actorCtx.actorLists) / sizeof(play->actorCtx.actorLists[0]);
for (int i = 0; i < numOfActorLists; i++) {
if (globalCtx->actorCtx.actorLists[i].length) {
if (globalCtx->actorCtx.actorLists[i].head->id == 10) {
if (play->actorCtx.actorLists[i].length) {
if (play->actorCtx.actorLists[i].head->id == 10) {
// set the params for the hint check to be negative chest params
actorParams = 0 - globalCtx->actorCtx.actorLists[i].head->params;
actorParams = 0 - play->actorCtx.actorLists[i].head->params;
}
}
}
}
RandomizerCheck hintCheck =
Randomizer_GetCheckFromActor(msgCtx->talkActor->id, globalCtx->sceneNum, actorParams);
Randomizer_GetCheckFromActor(msgCtx->talkActor->id, play->sceneNum, actorParams);
messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::hintMessageTableID, hintCheck);
} else if (textId == TEXT_ALTAR_CHILD || textId == TEXT_ALTAR_ADULT) {
@ -1958,7 +1958,7 @@ extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx) {
// textId: TEXT_SCRUB_RANDOM + (randomizerInf - RAND_INF_SCRUBS_PURCHASED_DODONGOS_CAVERN_DEKU_SCRUB_NEAR_BOMB_BAG_LEFT)
} else if (textId >= TEXT_SCRUB_RANDOM && textId <= TEXT_SCRUB_RANDOM + NUM_SCRUBS) {
RandomizerInf randoInf = (RandomizerInf)((textId - TEXT_SCRUB_RANDOM) + RAND_INF_SCRUBS_PURCHASED_DODONGOS_CAVERN_DEKU_SCRUB_NEAR_BOMB_BAG_LEFT);
messageEntry = OTRGlobals::Instance->gRandomizer->GetMerchantMessage(randoInf, TEXT_SCRUB_RANDOM, Player_GetMask(globalCtx) != PLAYER_MASK_TRUTH);
messageEntry = OTRGlobals::Instance->gRandomizer->GetMerchantMessage(randoInf, TEXT_SCRUB_RANDOM, Player_GetMask(play) != PLAYER_MASK_TRUTH);
// Shop items each have two message entries, second one offset by NUM_SHOP_ITEMS
// textId: TEXT_SHOP_ITEM_RANDOM + (randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1)
// textId: TEXT_SHOP_ITEM_RANDOM + ((randomizerInf - RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1) + NUM_SHOP_ITEMS)

View File

@ -126,7 +126,7 @@ GetItemEntry Randomizer_GetItemFromActorWithoutObtainabilityCheck(s16 actorId, s
GetItemEntry Randomizer_GetItemFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId);
GetItemEntry Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck(RandomizerCheck randomizerCheck, GetItemID ogId);
ItemObtainability Randomizer_GetItemObtainabilityFromRandomizerCheck(RandomizerCheck randomizerCheck);
int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx);
int CustomMessage_RetrieveIfExists(PlayState* play);
void Overlay_DisplayText(float duration, const char* text);
GetItemEntry ItemTable_Retrieve(int16_t getItemID);
GetItemEntry ItemTable_RetrieveEntry(s16 modIndex, s16 getItemID);

View File

@ -6,25 +6,25 @@
#include "vt.h"
#include <libultraship/Vertex.h>
extern "C" void Gameplay_InitScene(GlobalContext * globalCtx, s32 spawn);
extern "C" void Gameplay_InitEnvironment(GlobalContext * globalCtx, s16 skyboxId);
void OTRGameplay_InitScene(GlobalContext* globalCtx, s32 spawn);
s32 OTRScene_ExecuteCommands(GlobalContext* globalCtx, Ship::Scene* sceneCmd);
extern "C" void Play_InitScene(PlayState * play, s32 spawn);
extern "C" void Play_InitEnvironment(PlayState * play, s16 skyboxId);
void OTRPlay_InitScene(PlayState* play, s32 spawn);
s32 OTRScene_ExecuteCommands(PlayState* play, Ship::Scene* sceneCmd);
//Ship::OTRResource* OTRGameplay_LoadFile(GlobalContext* globalCtx, RomFile* file) {
Ship::Resource* OTRGameplay_LoadFile(GlobalContext* globalCtx, const char* fileName)
//Ship::OTRResource* OTRPlay_LoadFile(PlayState* play, RomFile* file) {
Ship::Resource* OTRPlay_LoadFile(PlayState* play, const char* fileName)
{
auto res = OTRGlobals::Instance->context->GetResourceManager()->LoadResource(fileName);
return res.get();
}
extern "C" void OTRGameplay_SpawnScene(GlobalContext* globalCtx, s32 sceneNum, s32 spawn) {
extern "C" void OTRPlay_SpawnScene(PlayState* play, s32 sceneNum, s32 spawn) {
SceneTableEntry* scene = &gSceneTable[sceneNum];
scene->unk_13 = 0;
globalCtx->loadedScene = scene;
globalCtx->sceneNum = sceneNum;
globalCtx->sceneConfig = scene->config;
play->loadedScene = scene;
play->sceneNum = sceneNum;
play->sceneConfig = scene->config;
//osSyncPrintf("\nSCENE SIZE %fK\n", (scene->sceneFile.vromEnd - scene->sceneFile.vromStart) / 1024.0f);
@ -36,44 +36,44 @@ extern "C" void OTRGameplay_SpawnScene(GlobalContext* globalCtx, s32 sceneNum, s
}
std::string scenePath = StringHelper::Sprintf("scenes/%s/%s/%s", sceneVersion.c_str(), scene->sceneFile.fileName, scene->sceneFile.fileName);
globalCtx->sceneSegment = (Ship::Scene*)OTRGameplay_LoadFile(globalCtx, scenePath.c_str());
play->sceneSegment = (Ship::Scene*)OTRPlay_LoadFile(play, scenePath.c_str());
// Failed to load scene... default to doodongs cavern
if (globalCtx->sceneSegment == nullptr)
if (play->sceneSegment == nullptr)
{
lusprintf(__FILE__, __LINE__, 2, "Unable to load scene %s... Defaulting to Doodong's Cavern!\n",
scenePath.c_str());
OTRGameplay_SpawnScene(globalCtx, 0x01, 0);
OTRPlay_SpawnScene(play, 0x01, 0);
return;
}
scene->unk_13 = 0;
//ASSERT(globalCtx->sceneSegment != NULL);
//gSegments[2] = VIRTUAL_TO_PHYSICAL(globalCtx->sceneSegment);
//ASSERT(play->sceneSegment != NULL);
//gSegments[2] = VIRTUAL_TO_PHYSICAL(play->sceneSegment);
OTRGameplay_InitScene(globalCtx, spawn);
OTRPlay_InitScene(play, spawn);
osSyncPrintf("ROOM SIZE=%fK\n", func_80096FE8(globalCtx, &globalCtx->roomCtx) / 1024.0f);
osSyncPrintf("ROOM SIZE=%fK\n", func_80096FE8(play, &play->roomCtx) / 1024.0f);
}
void OTRGameplay_InitScene(GlobalContext* globalCtx, s32 spawn) {
globalCtx->curSpawn = spawn;
globalCtx->linkActorEntry = nullptr;
globalCtx->unk_11DFC = nullptr;
globalCtx->setupEntranceList = nullptr;
globalCtx->setupExitList = nullptr;
globalCtx->cUpElfMsgs = nullptr;
globalCtx->setupPathList = nullptr;
globalCtx->numSetupActors = 0;
Object_InitBank(globalCtx, &globalCtx->objectCtx);
LightContext_Init(globalCtx, &globalCtx->lightCtx);
TransitionActor_InitContext(&globalCtx->state, &globalCtx->transiActorCtx);
func_80096FD4(globalCtx, &globalCtx->roomCtx.curRoom);
void OTRPlay_InitScene(PlayState* play, s32 spawn) {
play->curSpawn = spawn;
play->linkActorEntry = nullptr;
play->unk_11DFC = nullptr;
play->setupEntranceList = nullptr;
play->setupExitList = nullptr;
play->cUpElfMsgs = nullptr;
play->setupPathList = nullptr;
play->numSetupActors = 0;
Object_InitBank(play, &play->objectCtx);
LightContext_Init(play, &play->lightCtx);
TransitionActor_InitContext(&play->state, &play->transiActorCtx);
func_80096FD4(play, &play->roomCtx.curRoom);
YREG(15) = 0;
gSaveContext.worldMapArea = 0;
OTRScene_ExecuteCommands(globalCtx, globalCtx->sceneSegment);
Gameplay_InitEnvironment(globalCtx, globalCtx->skyboxId);
OTRScene_ExecuteCommands(play, play->sceneSegment);
Play_InitEnvironment(play, play->skyboxId);
/* auto data = static_cast<Ship::Vertex*>(Ship::Window::GetInstance()
->GetResourceManager()
->LoadResource("object_link_child\\object_link_childVtx_01FE08")

View File

@ -11,10 +11,10 @@
#include <libultraship/Text.h>
#include <libultraship/Blob.h>
extern Ship::Resource* OTRGameplay_LoadFile(GlobalContext* globalCtx, const char* fileName);
extern Ship::Resource* OTRPlay_LoadFile(PlayState* play, const char* fileName);
extern "C" s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId);
extern "C" RomFile sNaviMsgFiles[];
s32 OTRScene_ExecuteCommands(GlobalContext* globalCtx, Ship::Scene* scene);
s32 OTRScene_ExecuteCommands(PlayState* play, Ship::Scene* scene);
std::shared_ptr<Ship::File> ResourceMgr_LoadFile(const char* path) {
std::string Path = path;
@ -30,7 +30,7 @@ std::shared_ptr<Ship::File> ResourceMgr_LoadFile(const char* path) {
// Forward Declaration of function declared in OTRGlobals.cpp
std::shared_ptr<Ship::Resource> ResourceMgr_LoadResource(const char* path);
bool Scene_CommandSpawnList(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandSpawnList(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetStartPositionList* cmdStartPos = (Ship::SetStartPositionList*)cmd;
@ -39,7 +39,7 @@ bool Scene_CommandSpawnList(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
if (cmdStartPos->cachedGameData != nullptr)
{
ActorEntry* entries = (ActorEntry*)cmdStartPos->cachedGameData;
linkSpawnEntry = &entries[globalCtx->setupEntranceList[globalCtx->curSpawn].spawn];
linkSpawnEntry = &entries[play->setupEntranceList[play->curSpawn].spawn];
}
else
{
@ -57,31 +57,31 @@ bool Scene_CommandSpawnList(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
entries[i].rot.z = cmdStartPos->entries[i].rotZ;
}
linkSpawnEntry = &entries[globalCtx->setupEntranceList[globalCtx->curSpawn].spawn];
linkSpawnEntry = &entries[play->setupEntranceList[play->curSpawn].spawn];
cmdStartPos->cachedGameData = entries;
}
ActorEntry* linkEntry = globalCtx->linkActorEntry = linkSpawnEntry;
ActorEntry* linkEntry = play->linkActorEntry = linkSpawnEntry;
s16 linkObjectId;
globalCtx->linkAgeOnLoad = ((void)0, gSaveContext.linkAge);
play->linkAgeOnLoad = ((void)0, gSaveContext.linkAge);
linkObjectId = gLinkObjectIds[((void)0, gSaveContext.linkAge)];
//gActorOverlayTable[linkEntry->id].initInfo->objectId = linkObjectId;
Object_Spawn(&globalCtx->objectCtx, linkObjectId);
Object_Spawn(&play->objectCtx, linkObjectId);
return false;
}
bool Scene_CommandActorList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) {
bool Scene_CommandActorList(PlayState* play, Ship::SceneCommand* cmd) {
Ship::SetActorList* cmdActor = (Ship::SetActorList*)cmd;
globalCtx->numSetupActors = cmdActor->entries.size();
play->numSetupActors = cmdActor->entries.size();
if (cmdActor->cachedGameData != nullptr)
globalCtx->setupActorList = (ActorEntry*)cmdActor->cachedGameData;
play->setupActorList = (ActorEntry*)cmdActor->cachedGameData;
else
{
ActorEntry* entries = (ActorEntry*)malloc(cmdActor->entries.size() * sizeof(ActorEntry));
@ -99,21 +99,21 @@ bool Scene_CommandActorList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) {
}
cmdActor->cachedGameData = entries;
globalCtx->setupActorList = entries;
play->setupActorList = entries;
}
return false;
}
bool Scene_CommandUnused2(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandUnused2(PlayState* play, Ship::SceneCommand* cmd)
{
// Do we need to implement this?
//globalCtx->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment);
//play->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment);
return false;
}
bool Scene_CommandCollisionHeader(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandCollisionHeader(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetCollisionHeader* cmdCol = (Ship::SetCollisionHeader*)cmd;
@ -214,100 +214,100 @@ bool Scene_CommandCollisionHeader(GlobalContext* globalCtx, Ship::SceneCommand*
colRes->cachedGameAsset = colHeader;
}
BgCheck_Allocate(&globalCtx->colCtx, globalCtx, colHeader);
BgCheck_Allocate(&play->colCtx, play, colHeader);
return false;
}
bool Scene_CommandRoomList(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandRoomList(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetRoomList* cmdRoomList = (Ship::SetRoomList*)cmd;
globalCtx->numRooms = cmdRoomList->rooms.size();
globalCtx->roomList = (RomFile*)malloc(globalCtx->numRooms * sizeof(RomFile));
play->numRooms = cmdRoomList->rooms.size();
play->roomList = (RomFile*)malloc(play->numRooms * sizeof(RomFile));
for (int i = 0; i < cmdRoomList->rooms.size(); i++)
{
globalCtx->roomList[i].fileName = (char*)cmdRoomList->rooms[i].name.c_str();
globalCtx->roomList[i].vromStart = cmdRoomList->rooms[i].vromStart;
globalCtx->roomList[i].vromEnd = cmdRoomList->rooms[i].vromEnd;
play->roomList[i].fileName = (char*)cmdRoomList->rooms[i].name.c_str();
play->roomList[i].vromStart = cmdRoomList->rooms[i].vromStart;
play->roomList[i].vromEnd = cmdRoomList->rooms[i].vromEnd;
}
return false;
}
bool Scene_CommandEntranceList(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandEntranceList(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetEntranceList* otrEntrance = (Ship::SetEntranceList*)cmd;
if (otrEntrance->cachedGameData != nullptr)
globalCtx->setupEntranceList = (EntranceEntry*)otrEntrance->cachedGameData;
play->setupEntranceList = (EntranceEntry*)otrEntrance->cachedGameData;
else
{
globalCtx->setupEntranceList = (EntranceEntry*)malloc(otrEntrance->entrances.size() * sizeof(EntranceEntry));
play->setupEntranceList = (EntranceEntry*)malloc(otrEntrance->entrances.size() * sizeof(EntranceEntry));
for (int i = 0; i < otrEntrance->entrances.size(); i++)
{
globalCtx->setupEntranceList[i].room = otrEntrance->entrances[i].roomToLoad;
globalCtx->setupEntranceList[i].spawn = otrEntrance->entrances[i].startPositionIndex;
play->setupEntranceList[i].room = otrEntrance->entrances[i].roomToLoad;
play->setupEntranceList[i].spawn = otrEntrance->entrances[i].startPositionIndex;
}
otrEntrance->cachedGameData = globalCtx->setupEntranceList;
otrEntrance->cachedGameData = play->setupEntranceList;
}
return false;
}
bool Scene_CommandSpecialFiles(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandSpecialFiles(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetSpecialObjects* otrSpecial = (Ship::SetSpecialObjects*)cmd;
if (otrSpecial->globalObject != 0)
globalCtx->objectCtx.subKeepIndex = Object_Spawn(&globalCtx->objectCtx, otrSpecial->globalObject);
play->objectCtx.subKeepIndex = Object_Spawn(&play->objectCtx, otrSpecial->globalObject);
if (otrSpecial->elfMessage != 0)
{
auto res = (Ship::Blob*)OTRGameplay_LoadFile(globalCtx, sNaviMsgFiles[otrSpecial->elfMessage - 1].fileName);
globalCtx->cUpElfMsgs = (ElfMessage*)res->data.data();
auto res = (Ship::Blob*)OTRPlay_LoadFile(play, sNaviMsgFiles[otrSpecial->elfMessage - 1].fileName);
play->cUpElfMsgs = (ElfMessage*)res->data.data();
}
return false;
}
bool Scene_CommandRoomBehavior(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandRoomBehavior(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetRoomBehavior* cmdRoom = (Ship::SetRoomBehavior*)cmd;
globalCtx->roomCtx.curRoom.behaviorType1 = cmdRoom->gameplayFlags;
globalCtx->roomCtx.curRoom.behaviorType2 = cmdRoom->gameplayFlags2 & 0xFF;
globalCtx->roomCtx.curRoom.lensMode = (cmdRoom->gameplayFlags2 >> 8) & 1;
globalCtx->msgCtx.disableWarpSongs = (cmdRoom->gameplayFlags2 >> 0xA) & 1;
play->roomCtx.curRoom.behaviorType1 = cmdRoom->gameplayFlags;
play->roomCtx.curRoom.behaviorType2 = cmdRoom->gameplayFlags2 & 0xFF;
play->roomCtx.curRoom.lensMode = (cmdRoom->gameplayFlags2 >> 8) & 1;
play->msgCtx.disableWarpSongs = (cmdRoom->gameplayFlags2 >> 0xA) & 1;
return false;
}
bool Scene_CommandMeshHeader(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandMeshHeader(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetMesh* otrMesh = (Ship::SetMesh*)cmd;
if (otrMesh->cachedGameData != nullptr)
globalCtx->roomCtx.curRoom.meshHeader = (MeshHeader*)otrMesh->cachedGameData;
play->roomCtx.curRoom.meshHeader = (MeshHeader*)otrMesh->cachedGameData;
else
{
globalCtx->roomCtx.curRoom.meshHeader = (MeshHeader*)malloc(sizeof(MeshHeader));
globalCtx->roomCtx.curRoom.meshHeader->base.type = otrMesh->meshHeaderType;
globalCtx->roomCtx.curRoom.meshHeader->polygon0.num = otrMesh->meshes.size();
play->roomCtx.curRoom.meshHeader = (MeshHeader*)malloc(sizeof(MeshHeader));
play->roomCtx.curRoom.meshHeader->base.type = otrMesh->meshHeaderType;
play->roomCtx.curRoom.meshHeader->polygon0.num = otrMesh->meshes.size();
if (otrMesh->meshHeaderType == 2)
globalCtx->roomCtx.curRoom.meshHeader->polygon0.start = malloc(sizeof(PolygonDlist2) * globalCtx->roomCtx.curRoom.meshHeader->polygon0.num);
play->roomCtx.curRoom.meshHeader->polygon0.start = malloc(sizeof(PolygonDlist2) * play->roomCtx.curRoom.meshHeader->polygon0.num);
else
globalCtx->roomCtx.curRoom.meshHeader->polygon0.start = malloc(sizeof(PolygonDlist) * globalCtx->roomCtx.curRoom.meshHeader->polygon0.num);
play->roomCtx.curRoom.meshHeader->polygon0.start = malloc(sizeof(PolygonDlist) * play->roomCtx.curRoom.meshHeader->polygon0.num);
for (int i = 0; i < globalCtx->roomCtx.curRoom.meshHeader->polygon0.num; i++)
for (int i = 0; i < play->roomCtx.curRoom.meshHeader->polygon0.num; i++)
{
if (otrMesh->meshHeaderType == 2)
{
PolygonDlist2* arr = (PolygonDlist2*)globalCtx->roomCtx.curRoom.meshHeader->polygon0.start;
PolygonDlist2* arr = (PolygonDlist2*)play->roomCtx.curRoom.meshHeader->polygon0.start;
PolygonDlist2* dlist = &arr[i];
if (otrMesh->meshes[i].opa != "")
@ -339,7 +339,7 @@ bool Scene_CommandMeshHeader(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
dlist->pos.z = otrMesh->meshes[i].z;
dlist->unk_06 = otrMesh->meshes[i].unk_06;
//globalCtx->roomCtx.curRoom.meshHeader->base.start = dlist;
//play->roomCtx.curRoom.meshHeader->base.start = dlist;
}
else if (otrMesh->meshHeaderType == 1)
{
@ -355,56 +355,56 @@ bool Scene_CommandMeshHeader(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
else
pType->xlu = 0;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.dlist = (Gfx*)pType;
play->roomCtx.curRoom.meshHeader->polygon1.dlist = (Gfx*)pType;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.format = otrMesh->meshes[0].imgFmt;
play->roomCtx.curRoom.meshHeader->polygon1.format = otrMesh->meshes[0].imgFmt;
if (otrMesh->meshes[0].imgFmt == 1)
{
globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.fmt = otrMesh->meshes[0].images[0].fmt;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.source =
play->roomCtx.curRoom.meshHeader->polygon1.single.fmt = otrMesh->meshes[0].images[0].fmt;
play->roomCtx.curRoom.meshHeader->polygon1.single.source =
(void*)(ResourceMgr_LoadFile(otrMesh->meshes[0].images[0].sourceBackground.c_str()))
.get()
->buffer.get();
globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.siz = otrMesh->meshes[0].images[0].siz;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.width = otrMesh->meshes[0].images[0].width;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.height = otrMesh->meshes[0].images[0].height;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.fmt = otrMesh->meshes[0].images[0].fmt;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.mode0 = otrMesh->meshes[0].images[0].mode0;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.single.tlutCount = otrMesh->meshes[0].images[0].tlutCount;
play->roomCtx.curRoom.meshHeader->polygon1.single.siz = otrMesh->meshes[0].images[0].siz;
play->roomCtx.curRoom.meshHeader->polygon1.single.width = otrMesh->meshes[0].images[0].width;
play->roomCtx.curRoom.meshHeader->polygon1.single.height = otrMesh->meshes[0].images[0].height;
play->roomCtx.curRoom.meshHeader->polygon1.single.fmt = otrMesh->meshes[0].images[0].fmt;
play->roomCtx.curRoom.meshHeader->polygon1.single.mode0 = otrMesh->meshes[0].images[0].mode0;
play->roomCtx.curRoom.meshHeader->polygon1.single.tlutCount = otrMesh->meshes[0].images[0].tlutCount;
}
else
{
globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.count = otrMesh->meshes[0].images.size();
globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list =
(BgImage*)calloc(sizeof(BgImage), globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.count);
play->roomCtx.curRoom.meshHeader->polygon1.multi.count = otrMesh->meshes[0].images.size();
play->roomCtx.curRoom.meshHeader->polygon1.multi.list =
(BgImage*)calloc(sizeof(BgImage), play->roomCtx.curRoom.meshHeader->polygon1.multi.count);
for (size_t i = 0; i < otrMesh->meshes[0].images.size(); i++)
{
globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].fmt = otrMesh->meshes[0].images[i].fmt;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].source =
play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].fmt = otrMesh->meshes[0].images[i].fmt;
play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].source =
(void*)(ResourceMgr_LoadFile(otrMesh->meshes[0].images[i].sourceBackground.c_str()))
.get()
->buffer.get();
globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].siz = otrMesh->meshes[0].images[i].siz;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].width = otrMesh->meshes[0].images[i].width;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].height =
play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].siz = otrMesh->meshes[0].images[i].siz;
play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].width = otrMesh->meshes[0].images[i].width;
play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].height =
otrMesh->meshes[0].images[i].height;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].fmt = otrMesh->meshes[0].images[i].fmt;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].mode0 = otrMesh->meshes[0].images[i].mode0;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].tlutCount =
play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].fmt = otrMesh->meshes[0].images[i].fmt;
play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].mode0 = otrMesh->meshes[0].images[i].mode0;
play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].tlutCount =
otrMesh->meshes[0].images[i].tlutCount;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].unk_00 =
play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].unk_00 =
otrMesh->meshes[0].images[i].unk_00;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].unk_0C =
play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].unk_0C =
otrMesh->meshes[0].images[i].unk_0C;
globalCtx->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].id = otrMesh->meshes[0].images[i].id;
play->roomCtx.curRoom.meshHeader->polygon1.multi.list[i].id = otrMesh->meshes[0].images[i].id;
}
}
}
else
{
PolygonDlist* arr = (PolygonDlist*)globalCtx->roomCtx.curRoom.meshHeader->polygon0.start;
PolygonDlist* arr = (PolygonDlist*)play->roomCtx.curRoom.meshHeader->polygon0.start;
PolygonDlist* dlist = &arr[i];
if (otrMesh->meshes[i].opa != "")
@ -427,11 +427,11 @@ bool Scene_CommandMeshHeader(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
else
dlist->xlu = 0;
//globalCtx->roomCtx.curRoom.meshHeader->base.start = dlist;
//play->roomCtx.curRoom.meshHeader->base.start = dlist;
}
}
otrMesh->cachedGameData = globalCtx->roomCtx.curRoom.meshHeader;
otrMesh->cachedGameData = play->roomCtx.curRoom.meshHeader;
}
return false;
@ -439,7 +439,7 @@ bool Scene_CommandMeshHeader(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
extern "C" void* func_800982FC(ObjectContext * objectCtx, s32 bankIndex, s16 objectId);
bool Scene_CommandObjectList(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandObjectList(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetObjectList* cmdObj = (Ship::SetObjectList*)cmd;
@ -454,37 +454,37 @@ bool Scene_CommandObjectList(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
void* nextPtr;
k = 0;
//i = globalCtx->objectCtx.unk_09;
//i = play->objectCtx.unk_09;
i = 0;
firstStatus = &globalCtx->objectCtx.status[0];
status = &globalCtx->objectCtx.status[i];
firstStatus = &play->objectCtx.status[0];
status = &play->objectCtx.status[i];
for (int i = 0; i < cmdObj->objects.size(); i++) {
bool alreadyIncluded = false;
for (int j = 0; j < globalCtx->objectCtx.num; j++) {
if (globalCtx->objectCtx.status[j].id == cmdObj->objects[i]) {
for (int j = 0; j < play->objectCtx.num; j++) {
if (play->objectCtx.status[j].id == cmdObj->objects[i]) {
alreadyIncluded = true;
break;
}
}
if (!alreadyIncluded) {
globalCtx->objectCtx.status[globalCtx->objectCtx.num++].id = cmdObj->objects[i];
func_80031A28(globalCtx, &globalCtx->actorCtx);
play->objectCtx.status[play->objectCtx.num++].id = cmdObj->objects[i];
func_80031A28(play, &play->actorCtx);
}
}
/*
while (i < globalCtx->objectCtx.num) {
while (i < play->objectCtx.num) {
if (status->id != *objectEntry) {
status2 = &globalCtx->objectCtx.status[i];
for (j = i; j < globalCtx->objectCtx.num; j++) {
status2 = &play->objectCtx.status[i];
for (j = i; j < play->objectCtx.num; j++) {
status2->id = OBJECT_INVALID;
status2++;
}
globalCtx->objectCtx.num = i;
func_80031A28(globalCtx, &globalCtx->actorCtx);
play->objectCtx.num = i;
func_80031A28(play, &play->actorCtx);
continue;
}
@ -495,13 +495,13 @@ bool Scene_CommandObjectList(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
status++;
}
globalCtx->objectCtx.num = i;
play->objectCtx.num = i;
*/
return false;
}
bool Scene_CommandLightList(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandLightList(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetLightList* cmdLight = (Ship::SetLightList*)cmd;
@ -519,31 +519,31 @@ bool Scene_CommandLightList(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
lightInfo[i].params.point.color[1] = cmdLight->lights[i].g;
lightInfo[i].params.point.color[2] = cmdLight->lights[i].b;
LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &lightInfo[i]);
LightContext_InsertLight(play, &play->lightCtx, &lightInfo[i]);
}
return false;
}
bool Scene_CommandPathList(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandPathList(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetPathways* cmdPath = (Ship::SetPathways*)cmd;
Ship::Path* path = (Ship::Path*)ResourceMgr_LoadResource(cmdPath->paths[0].c_str()).get();
globalCtx->setupPathList = (Path*)malloc(path->paths.size() * sizeof(Path));
play->setupPathList = (Path*)malloc(path->paths.size() * sizeof(Path));
//for (int i = 0; i < cmdPath->paths.size(); i++)
{
for (int j = 0; j < path->paths.size(); j++)
{
globalCtx->setupPathList[j].count = path->paths[j].size();
globalCtx->setupPathList[j].points = (Vec3s*)malloc(sizeof(Vec3s) * path->paths[j].size());
play->setupPathList[j].count = path->paths[j].size();
play->setupPathList[j].points = (Vec3s*)malloc(sizeof(Vec3s) * path->paths[j].size());
for (int k = 0; k < path->paths[j].size(); k++)
{
globalCtx->setupPathList[j].points[k].x = path->paths[j][k].x;
globalCtx->setupPathList[j].points[k].y = path->paths[j][k].y;
globalCtx->setupPathList[j].points[k].z = path->paths[j][k].z;
play->setupPathList[j].points[k].x = path->paths[j][k].x;
play->setupPathList[j].points[k].y = path->paths[j][k].y;
play->setupPathList[j].points[k].z = path->paths[j][k].z;
}
}
}
@ -551,24 +551,24 @@ bool Scene_CommandPathList(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
return false;
}
bool Scene_CommandTransitionActorList(GlobalContext* globalCtx, Ship::SceneCommand* cmd) {
bool Scene_CommandTransitionActorList(PlayState* play, Ship::SceneCommand* cmd) {
Ship::SetTransitionActorList* cmdActor = (Ship::SetTransitionActorList*)cmd;
globalCtx->transiActorCtx.numActors = cmdActor->entries.size();
globalCtx->transiActorCtx.list = (TransitionActorEntry*)malloc(cmdActor->entries.size() * sizeof(TransitionActorEntry));
play->transiActorCtx.numActors = cmdActor->entries.size();
play->transiActorCtx.list = (TransitionActorEntry*)malloc(cmdActor->entries.size() * sizeof(TransitionActorEntry));
for (int i = 0; i < cmdActor->entries.size(); i++)
{
globalCtx->transiActorCtx.list[i].sides[0].room = cmdActor->entries[i].frontObjectRoom;
globalCtx->transiActorCtx.list[i].sides[0].effects = cmdActor->entries[i].frontTransitionReaction;
globalCtx->transiActorCtx.list[i].sides[1].room = cmdActor->entries[i].backObjectRoom;
globalCtx->transiActorCtx.list[i].sides[1].effects = cmdActor->entries[i].backTransitionReaction;
globalCtx->transiActorCtx.list[i].id = cmdActor->entries[i].actorNum;
globalCtx->transiActorCtx.list[i].pos.x = cmdActor->entries[i].posX;
globalCtx->transiActorCtx.list[i].pos.y = cmdActor->entries[i].posY;
globalCtx->transiActorCtx.list[i].pos.z = cmdActor->entries[i].posZ;
globalCtx->transiActorCtx.list[i].rotY = cmdActor->entries[i].rotY;
globalCtx->transiActorCtx.list[i].params = cmdActor->entries[i].initVar;
play->transiActorCtx.list[i].sides[0].room = cmdActor->entries[i].frontObjectRoom;
play->transiActorCtx.list[i].sides[0].effects = cmdActor->entries[i].frontTransitionReaction;
play->transiActorCtx.list[i].sides[1].room = cmdActor->entries[i].backObjectRoom;
play->transiActorCtx.list[i].sides[1].effects = cmdActor->entries[i].backTransitionReaction;
play->transiActorCtx.list[i].id = cmdActor->entries[i].actorNum;
play->transiActorCtx.list[i].pos.x = cmdActor->entries[i].posX;
play->transiActorCtx.list[i].pos.y = cmdActor->entries[i].posY;
play->transiActorCtx.list[i].pos.z = cmdActor->entries[i].posZ;
play->transiActorCtx.list[i].rotY = cmdActor->entries[i].rotY;
play->transiActorCtx.list[i].params = cmdActor->entries[i].initVar;
}
return false;
@ -578,69 +578,69 @@ bool Scene_CommandTransitionActorList(GlobalContext* globalCtx, Ship::SceneComma
// transiActorCtx->numActors = 0;
//}
bool Scene_CommandLightSettingsList(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandLightSettingsList(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetLightingSettings* otrLight = (Ship::SetLightingSettings*)cmd;
globalCtx->envCtx.numLightSettings = otrLight->settings.size();
globalCtx->envCtx.lightSettingsList = (EnvLightSettings*)malloc(globalCtx->envCtx.numLightSettings * sizeof(EnvLightSettings));
play->envCtx.numLightSettings = otrLight->settings.size();
play->envCtx.lightSettingsList = (EnvLightSettings*)malloc(play->envCtx.numLightSettings * sizeof(EnvLightSettings));
for (int i = 0; i < otrLight->settings.size(); i++)
{
globalCtx->envCtx.lightSettingsList[i].ambientColor[0] = otrLight->settings[i].ambientClrR;
globalCtx->envCtx.lightSettingsList[i].ambientColor[1] = otrLight->settings[i].ambientClrG;
globalCtx->envCtx.lightSettingsList[i].ambientColor[2] = otrLight->settings[i].ambientClrB;
play->envCtx.lightSettingsList[i].ambientColor[0] = otrLight->settings[i].ambientClrR;
play->envCtx.lightSettingsList[i].ambientColor[1] = otrLight->settings[i].ambientClrG;
play->envCtx.lightSettingsList[i].ambientColor[2] = otrLight->settings[i].ambientClrB;
globalCtx->envCtx.lightSettingsList[i].light1Color[0] = otrLight->settings[i].diffuseClrA_R;
globalCtx->envCtx.lightSettingsList[i].light1Color[1] = otrLight->settings[i].diffuseClrA_G;
globalCtx->envCtx.lightSettingsList[i].light1Color[2] = otrLight->settings[i].diffuseClrA_B;
play->envCtx.lightSettingsList[i].light1Color[0] = otrLight->settings[i].diffuseClrA_R;
play->envCtx.lightSettingsList[i].light1Color[1] = otrLight->settings[i].diffuseClrA_G;
play->envCtx.lightSettingsList[i].light1Color[2] = otrLight->settings[i].diffuseClrA_B;
globalCtx->envCtx.lightSettingsList[i].light1Dir[0] = otrLight->settings[i].diffuseDirA_X;
globalCtx->envCtx.lightSettingsList[i].light1Dir[1] = otrLight->settings[i].diffuseDirA_Y;
globalCtx->envCtx.lightSettingsList[i].light1Dir[2] = otrLight->settings[i].diffuseDirA_Z;
play->envCtx.lightSettingsList[i].light1Dir[0] = otrLight->settings[i].diffuseDirA_X;
play->envCtx.lightSettingsList[i].light1Dir[1] = otrLight->settings[i].diffuseDirA_Y;
play->envCtx.lightSettingsList[i].light1Dir[2] = otrLight->settings[i].diffuseDirA_Z;
globalCtx->envCtx.lightSettingsList[i].light2Color[0] = otrLight->settings[i].diffuseClrB_R;
globalCtx->envCtx.lightSettingsList[i].light2Color[1] = otrLight->settings[i].diffuseClrB_G;
globalCtx->envCtx.lightSettingsList[i].light2Color[2] = otrLight->settings[i].diffuseClrB_B;
play->envCtx.lightSettingsList[i].light2Color[0] = otrLight->settings[i].diffuseClrB_R;
play->envCtx.lightSettingsList[i].light2Color[1] = otrLight->settings[i].diffuseClrB_G;
play->envCtx.lightSettingsList[i].light2Color[2] = otrLight->settings[i].diffuseClrB_B;
globalCtx->envCtx.lightSettingsList[i].light2Dir[0] = otrLight->settings[i].diffuseDirB_X;
globalCtx->envCtx.lightSettingsList[i].light2Dir[1] = otrLight->settings[i].diffuseDirB_Y;
globalCtx->envCtx.lightSettingsList[i].light2Dir[2] = otrLight->settings[i].diffuseDirB_Z;
play->envCtx.lightSettingsList[i].light2Dir[0] = otrLight->settings[i].diffuseDirB_X;
play->envCtx.lightSettingsList[i].light2Dir[1] = otrLight->settings[i].diffuseDirB_Y;
play->envCtx.lightSettingsList[i].light2Dir[2] = otrLight->settings[i].diffuseDirB_Z;
globalCtx->envCtx.lightSettingsList[i].fogColor[0] = otrLight->settings[i].fogClrR;
globalCtx->envCtx.lightSettingsList[i].fogColor[1] = otrLight->settings[i].fogClrG;
globalCtx->envCtx.lightSettingsList[i].fogColor[2] = otrLight->settings[i].fogClrB;
play->envCtx.lightSettingsList[i].fogColor[0] = otrLight->settings[i].fogClrR;
play->envCtx.lightSettingsList[i].fogColor[1] = otrLight->settings[i].fogClrG;
play->envCtx.lightSettingsList[i].fogColor[2] = otrLight->settings[i].fogClrB;
globalCtx->envCtx.lightSettingsList[i].fogNear = otrLight->settings[i].fogNear;
globalCtx->envCtx.lightSettingsList[i].fogFar = otrLight->settings[i].fogFar;
play->envCtx.lightSettingsList[i].fogNear = otrLight->settings[i].fogNear;
play->envCtx.lightSettingsList[i].fogFar = otrLight->settings[i].fogFar;
}
return false;
}
// Scene Command 0x11: Skybox Settings
bool Scene_CommandSkyboxSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandSkyboxSettings(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetSkyboxSettings* cmdSky = (Ship::SetSkyboxSettings*)cmd;
globalCtx->skyboxId = cmdSky->skyboxNumber;
globalCtx->envCtx.unk_17 = globalCtx->envCtx.unk_18 = cmdSky->cloudsType;
globalCtx->envCtx.indoors = cmdSky->isIndoors;
play->skyboxId = cmdSky->skyboxNumber;
play->envCtx.unk_17 = play->envCtx.unk_18 = cmdSky->cloudsType;
play->envCtx.indoors = cmdSky->isIndoors;
return false;
}
bool Scene_CommandSkyboxDisables(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandSkyboxDisables(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetSkyboxModifier* cmdSky = (Ship::SetSkyboxModifier*)cmd;
globalCtx->envCtx.sunMoonDisabled = cmdSky->disableSunMoon;
globalCtx->envCtx.skyboxDisabled = cmdSky->disableSky;
play->envCtx.sunMoonDisabled = cmdSky->disableSunMoon;
play->envCtx.skyboxDisabled = cmdSky->disableSky;
return false;
}
bool Scene_CommandTimeSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandTimeSettings(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetTimeSettings* cmdTime = (Ship::SetTimeSettings*)cmd;
@ -650,21 +650,21 @@ bool Scene_CommandTimeSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd
}
if (cmdTime->unk != 0xFF) {
globalCtx->envCtx.timeIncrement = cmdTime->unk;
play->envCtx.timeIncrement = cmdTime->unk;
}
else {
globalCtx->envCtx.timeIncrement = 0;
play->envCtx.timeIncrement = 0;
}
if (gSaveContext.sunsSongState == SUNSSONG_INACTIVE) {
gTimeIncrement = globalCtx->envCtx.timeIncrement;
gTimeIncrement = play->envCtx.timeIncrement;
}
globalCtx->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f;
globalCtx->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f;
globalCtx->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 20.0f) * 25.0f;
play->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f;
play->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f;
play->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 20.0f) * 25.0f;
if (((globalCtx->envCtx.timeIncrement == 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) ||
if (((play->envCtx.timeIncrement == 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) ||
(gSaveContext.entranceIndex == 0x0604)) {
gSaveContext.skyboxTime = ((void)0, gSaveContext.dayTime);
if ((gSaveContext.skyboxTime >= 0x2AAC) && (gSaveContext.skyboxTime < 0x4555)) {
@ -684,43 +684,43 @@ bool Scene_CommandTimeSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd
return false;
}
bool Scene_CommandWindSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd) {
bool Scene_CommandWindSettings(PlayState* play, Ship::SceneCommand* cmd) {
Ship::SetWind* cmdWind = (Ship::SetWind*)cmd;
s8 x = cmdWind->windWest;
s8 y = cmdWind->windVertical;
s8 z = cmdWind->windSouth;
globalCtx->envCtx.windDirection.x = x;
globalCtx->envCtx.windDirection.y = y;
globalCtx->envCtx.windDirection.z = z;
play->envCtx.windDirection.x = x;
play->envCtx.windDirection.y = y;
play->envCtx.windDirection.z = z;
globalCtx->envCtx.windSpeed = cmdWind->clothFlappingStrength;
play->envCtx.windSpeed = cmdWind->clothFlappingStrength;
return false;
}
bool Scene_CommandExitList(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandExitList(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::ExitList* cmdExit = (Ship::ExitList*)cmd;
globalCtx->setupExitList = (int16_t*)malloc(cmdExit->exits.size() * sizeof(int16_t));
play->setupExitList = (int16_t*)malloc(cmdExit->exits.size() * sizeof(int16_t));
for (int i = 0; i < cmdExit->exits.size(); i++)
globalCtx->setupExitList[i] = cmdExit->exits[i];
play->setupExitList[i] = cmdExit->exits[i];
return false;
}
bool Scene_CommandUndefined9(GlobalContext* globalCtx, Ship::SceneCommand* cmd) {
bool Scene_CommandUndefined9(PlayState* play, Ship::SceneCommand* cmd) {
return false;
}
bool Scene_CommandSoundSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd) {
bool Scene_CommandSoundSettings(PlayState* play, Ship::SceneCommand* cmd) {
Ship::SetSoundSettings* cmdSnd = (Ship::SetSoundSettings*)cmd;
globalCtx->sequenceCtx.seqId = cmdSnd->musicSequence;
globalCtx->sequenceCtx.natureAmbienceId = cmdSnd->nightTimeSFX;
play->sequenceCtx.seqId = cmdSnd->musicSequence;
play->sequenceCtx.natureAmbienceId = cmdSnd->nightTimeSFX;
if (gSaveContext.seqId == 0xFF) {
Audio_QueueSeqCmd(cmdSnd->reverb | 0xF0000000);
@ -729,16 +729,16 @@ bool Scene_CommandSoundSettings(GlobalContext* globalCtx, Ship::SceneCommand* cm
return false;
}
bool Scene_CommandEchoSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandEchoSettings(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetEchoSettings* cmdEcho = (Ship::SetEchoSettings*)cmd;
globalCtx->roomCtx.curRoom.echo = cmdEcho->echo;
play->roomCtx.curRoom.echo = cmdEcho->echo;
return false;
}
bool Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandAlternateHeaderList(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetAlternateHeaders* cmdHeaders = (Ship::SetAlternateHeaders*)cmd;
@ -759,7 +759,7 @@ bool Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, Ship::SceneComma
if (headerData != nullptr)
{
OTRScene_ExecuteCommands(globalCtx, headerData);
OTRScene_ExecuteCommands(play, headerData);
return true;
}
else
@ -780,7 +780,7 @@ bool Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, Ship::SceneComma
if (headerData != nullptr)
{
OTRScene_ExecuteCommands(globalCtx, headerData);
OTRScene_ExecuteCommands(play, headerData);
return true;
}
}
@ -789,33 +789,33 @@ bool Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, Ship::SceneComma
return false;
}
bool Scene_CommandCutsceneData(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandCutsceneData(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetCutscenes* cmdCS = (Ship::SetCutscenes*)cmd;
Ship::Cutscene* csData = (Ship::Cutscene*)ResourceMgr_LoadResource(cmdCS->cutscenePath.c_str()).get();
globalCtx->csCtx.segment = csData->commands.data();
play->csCtx.segment = csData->commands.data();
//osSyncPrintf("\ngame_play->demo_play.data=[%x]", globalCtx->csCtx.segment);
//osSyncPrintf("\ngame_play->demo_play.data=[%x]", play->csCtx.segment);
return false;
}
// Camera & World Map Area
bool Scene_CommandMiscSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd)
bool Scene_CommandMiscSettings(PlayState* play, Ship::SceneCommand* cmd)
{
Ship::SetCameraSettings* cmdCam = (Ship::SetCameraSettings*)cmd;
YREG(15) = cmdCam->cameraMovement;
gSaveContext.worldMapArea = cmdCam->mapHighlights;
if ((globalCtx->sceneNum == SCENE_SHOP1) || (globalCtx->sceneNum == SCENE_SYATEKIJYOU)) {
if ((play->sceneNum == SCENE_SHOP1) || (play->sceneNum == SCENE_SYATEKIJYOU)) {
if (LINK_AGE_IN_YEARS == YEARS_ADULT) {
gSaveContext.worldMapArea = 1;
}
}
if (((globalCtx->sceneNum >= SCENE_SPOT00) && (globalCtx->sceneNum <= SCENE_GANON_TOU)) ||
((globalCtx->sceneNum >= SCENE_ENTRA) && (globalCtx->sceneNum <= SCENE_SHRINE_R))) {
if (((play->sceneNum >= SCENE_SPOT00) && (play->sceneNum <= SCENE_GANON_TOU)) ||
((play->sceneNum >= SCENE_ENTRA) && (play->sceneNum <= SCENE_SHRINE_R))) {
if (gSaveContext.cutsceneIndex < 0xFFF0) {
gSaveContext.worldMapAreaData |= gBitFlags[gSaveContext.worldMapArea];
osSyncPrintf(" _%x (%d)\n", gSaveContext.worldMapAreaData,
@ -825,7 +825,7 @@ bool Scene_CommandMiscSettings(GlobalContext* globalCtx, Ship::SceneCommand* cmd
return false;
}
bool (*sceneCommands[])(GlobalContext*, Ship::SceneCommand*) =
bool (*sceneCommands[])(PlayState*, Ship::SceneCommand*) =
{
Scene_CommandSpawnList, // SCENE_CMD_ID_SPAWN_LIST
Scene_CommandActorList, // SCENE_CMD_ID_ACTOR_LIST
@ -855,7 +855,7 @@ bool (*sceneCommands[])(GlobalContext*, Ship::SceneCommand*) =
Scene_CommandMiscSettings, // SCENE_CMD_ID_MISC_SETTINGS
};
s32 OTRScene_ExecuteCommands(GlobalContext* globalCtx, Ship::Scene* scene)
s32 OTRScene_ExecuteCommands(PlayState* play, Ship::Scene* scene)
{
Ship::SceneCommandID cmdCode;
@ -875,7 +875,7 @@ s32 OTRScene_ExecuteCommands(GlobalContext* globalCtx, Ship::Scene* scene)
}
if ((int)cmdCode <= 0x19) {
if (sceneCommands[(int)cmdCode](globalCtx, sceneCmd))
if (sceneCommands[(int)cmdCode](play, sceneCmd))
break;
}
else {
@ -889,7 +889,7 @@ s32 OTRScene_ExecuteCommands(GlobalContext* globalCtx, Ship::Scene* scene)
return 0;
}
extern "C" s32 OTRfunc_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) {
extern "C" s32 OTRfunc_800973FC(PlayState* play, RoomContext* roomCtx) {
if (roomCtx->status == 1) {
//if (!osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK)) {
if (1)
@ -898,9 +898,9 @@ extern "C" s32 OTRfunc_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx)
roomCtx->curRoom.segment = roomCtx->unk_34;
gSegments[3] = VIRTUAL_TO_PHYSICAL(roomCtx->unk_34);
OTRScene_ExecuteCommands(globalCtx, roomCtx->roomToLoad);
Player_SetBootData(globalCtx, GET_PLAYER(globalCtx));
Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx);
OTRScene_ExecuteCommands(play, roomCtx->roomToLoad);
Player_SetBootData(play, GET_PLAYER(play));
Actor_SpawnTransitionActors(play, &play->actorCtx);
return 1;
}
@ -911,7 +911,7 @@ extern "C" s32 OTRfunc_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx)
return 1;
}
extern "C" s32 OTRfunc_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) {
extern "C" s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) {
u32 size;
if (roomCtx->status == 0) {
@ -920,19 +920,19 @@ extern "C" s32 OTRfunc_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx,
roomCtx->curRoom.segment = NULL;
roomCtx->status = 1;
ASSERT(roomNum < globalCtx->numRooms);
ASSERT(roomNum < play->numRooms);
if (roomNum >= globalCtx->numRooms)
if (roomNum >= play->numRooms)
return 0; // UH OH
size = globalCtx->roomList[roomNum].vromEnd - globalCtx->roomList[roomNum].vromStart;
size = play->roomList[roomNum].vromEnd - play->roomList[roomNum].vromStart;
roomCtx->unk_34 = (void*)ALIGN16((uintptr_t)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7));
osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1);
//DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, globalCtx->roomList[roomNum].vromStart, size, 0,
//DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, play->roomList[roomNum].vromStart, size, 0,
//&roomCtx->loadQueue, NULL, __FILE__, __LINE__);
auto roomData = ResourceMgr_LoadResource(globalCtx->roomList[roomNum].fileName);
auto roomData = ResourceMgr_LoadResource(play->roomList[roomNum].fileName);
roomCtx->status = 1;
roomCtx->roomToLoad = (Ship::Scene*)roomData.get();

View File

@ -76,7 +76,7 @@ s32 func_800435B4(DynaPolyActor* dynaActor) {
}
}
s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4) {
s32 func_800435D8(PlayState* play, DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4) {
Vec3f posA;
Vec3f posB;
Vec3f posResult;
@ -98,7 +98,7 @@ s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 arg2,
posB.y = posA.y;
posB.z = sign * a3 * cos + posA.z;
if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId,
if (BgCheck_EntityLineTest3(&play->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId,
&dynaActor->actor, 0.0f)) {
return false;
}
@ -106,7 +106,7 @@ s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 arg2,
posA.z = (dynaActor->actor.world.pos.z * 2) - posA.z;
posB.x = sign * a3 * sin + posA.x;
posB.z = sign * a3 * cos + posA.z;
if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId,
if (BgCheck_EntityLineTest3(&play->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId,
&dynaActor->actor, 0.0f)) {
return false;
}

View File

@ -1,33 +1,33 @@
#include "global.h"
void Flags_UnsetAllEnv(GlobalContext* globalCtx) {
void Flags_UnsetAllEnv(PlayState* play) {
u8 i;
for (i = 0; i < 20; i++) {
globalCtx->envFlags[i] = 0;
play->envFlags[i] = 0;
}
}
void Flags_SetEnv(GlobalContext* globalCtx, s16 flag) {
void Flags_SetEnv(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 Flags_UnsetEnv(GlobalContext* globalCtx, s16 flag) {
void Flags_UnsetEnv(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 Flags_GetEnv(GlobalContext* globalCtx, s16 flag) {
s32 Flags_GetEnv(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;
}

View File

@ -188,8 +188,8 @@ void Inventory_ChangeEquipment(s16 equipment, u16 value) {
gSaveContext.equips.equipment |= value << gEquipShifts[equipment];
}
u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) {
Player* player = GET_PLAYER(globalCtx);
u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment) {
Player* player = GET_PLAYER(play);
s32 pad;
u16 sp26 = gSaveContext.equips.equipment & gEquipMasks[equipment];
@ -211,8 +211,8 @@ u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) {
gSaveContext.infTable[29] = 1;
}
Player_SetEquipmentData(globalCtx, player);
globalCtx->pauseCtx.cursorSpecialPos = PAUSE_CURSOR_PAGE_LEFT;
Player_SetEquipmentData(play, player);
play->pauseCtx.cursorSpecialPos = PAUSE_CURSOR_PAGE_LEFT;
}
return sp26;

View File

@ -1,7 +1,7 @@
#include "ultra64.h"
#include "global.h"
static GlobalContext* sGlobalCtx;
static PlayState* sPlayState;
// TODO: cleanup these arrays and UB access
char* D_8012CEE0[] = { GFXP_KATAKANA "キ-フレ-ム" GFXP_HIRAGANA "ガ" };
@ -349,7 +349,7 @@ s32 func_800B4370(DbCamera* dbCamera, s16 idx, Camera* cam) {
void func_800B44E0(DbCamera* dbCamera, Camera* cam) {
s32 i;
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CRIGHT)) {
sDbCamAnim.keyframe = 0;
sDbCamAnim.unk_0A = 1;
sDbCamAnim.curFrame = 0.0f;
@ -523,7 +523,7 @@ void DbCamera_Init(DbCamera* dbCamera, Camera* cameraPtr) {
dbCamera->sub.unk_104A.x = dbCamera->sub.unk_104A.z;
dbCamera->fov = 0.0f;
dbCamera->rollDegrees = 0.0f;
sGlobalCtx = cameraPtr->globalCtx;
sPlayState = cameraPtr->play;
dbCamera->sub.mode = 0;
dbCamera->sub.nFrames = -1;
dbCamera->sub.nPoints = 1;
@ -598,7 +598,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
sp80 = &dbCamera->eye;
sp7C = &dbCamera->at;
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_Z)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_Z)) {
dbCamera->unk_00++;
dbCamera->unk_00 %= 3;
dbCamera->unk_38 = 1;
@ -688,7 +688,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
dbCamera->unk_3C = D_80161140;
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B | BTN_L)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_B | BTN_L)) {
sp104.r += temp_f2;
if (sp104.r > 30000.0f) {
@ -702,7 +702,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
dbCamera->unk_40 = 7;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_B)) {
spFC = sp104;
spFC.r = temp_f2;
if (!D_80161144) {
@ -719,7 +719,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 0xB;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A | BTN_L)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_A | BTN_L)) {
sp104.r -= temp_f2;
if (sp104.r < 10.0f) {
sp104.r = 10.0f;
@ -730,7 +730,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 8;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_A)) {
spFC = sp104;
spFC.r = -temp_f2;
if (!D_80161144) {
@ -752,7 +752,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_40 = -1;
}
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DDOWN | BTN_L)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DDOWN | BTN_L)) {
spFC = sp104;
spFC.r = temp_f2;
spFC.pitch = 0;
@ -770,7 +770,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 1;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DUP | BTN_L)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DUP | BTN_L)) {
spFC = sp104;
spFC.r = -temp_f2;
spFC.pitch = 0;
@ -787,7 +787,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 2;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DUP)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DUP)) {
spFC = sp104;
spFC.r = temp_f2;
spFC.pitch = 0x3FFF;
@ -803,7 +803,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 3;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DDOWN)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DDOWN)) {
spFC = sp104;
spFC.r = temp_f2;
spFC.pitch = -0x3FFF;
@ -819,8 +819,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 4;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, (BTN_DRIGHT | BTN_L)) ||
CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DRIGHT)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, (BTN_DRIGHT | BTN_L)) ||
CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DRIGHT)) {
spFC = sp104;
spFC.r = temp_f2;
spFC.pitch = 0;
@ -837,8 +837,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 5;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, (BTN_DLEFT | BTN_L)) ||
CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DLEFT)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, (BTN_DLEFT | BTN_L)) ||
CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DLEFT)) {
spFC = sp104;
spFC.r = temp_f2;
spFC.pitch = 0;
@ -855,7 +855,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 6;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B | BTN_L)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_B | BTN_L)) {
sp104.r = sp104.r + temp_f2;
if (sp104.r > 30000.0f) {
sp104.r = 30000.0f;
@ -866,7 +866,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 7;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_B)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_B)) {
spFC = sp104;
spFC.r = temp_f2;
if (!D_80161144) {
@ -883,7 +883,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 0xB;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A | BTN_L)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_A | BTN_L)) {
sp104.r -= temp_f2;
if (sp104.r < 10.0f) {
@ -895,7 +895,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_44 = 0;
}
dbCamera->unk_40 = 8;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_A)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_A)) {
spFC = sp104;
spFC.r = -temp_f2;
if (!D_80161144) {
@ -917,7 +917,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_40 = -1;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_R)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_R)) {
if (dbCamera->unk_00 == 0) {
dbCamera->sub.unk_104A = cam->inputDir;
*sp7C = cam->at;
@ -931,12 +931,12 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
func_800B41DC(dbCamera, dbCamera->sub.unkIdx, cam);
} else {
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_R) &&
CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_R) &&
CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) {
Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
dbCamera->sub.nPoints = dbCamera->sub.unkIdx + 1;
func_800B4088(dbCamera, cam);
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_R)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_R)) {
if (dbCamera->sub.unkIdx == 0x80) {
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
} else {
@ -952,8 +952,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
}
} else {
temp_f0_5 = sGlobalCtx->state.input[2].rel.stick_y;
temp_f2_2 = sGlobalCtx->state.input[2].rel.stick_x;
temp_f0_5 = sPlayState->state.input[2].rel.stick_y;
temp_f2_2 = sPlayState->state.input[2].rel.stick_x;
pitch = DEGF_TO_BINANG((SQ(temp_f0_5) / 600.0f) * 0.8f);
yaw = DEGF_TO_BINANG((SQ(temp_f2_2) / 600.0f) * 0.8f);
if (!D_80161144) {
@ -973,7 +973,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
OLib_Vec3fDiffToVecSphGeo(&spF4, sp80, sp7C);
DbCamera_CalcUpFromPitchYawRoll(&dbCamera->unk_1C, spF4.pitch, spF4.yaw, DEGF_TO_BINANG(dbCamera->rollDegrees));
if (dbCamera->unk_00 == 1) {
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_CRIGHT)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_CRIGHT)) {
cam->inputDir = dbCamera->sub.unk_104A;
new_var2 = OLib_Vec3fDist(&cam->at, &cam->eye);
cam->at = *sp7C;
@ -987,12 +987,12 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
if (dbCamera->unk_00 == 1) {
OREG(0) = 8;
func_8006376C(0xC, 5, 0, D_8012CEF4);
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_CRIGHT) &&
!CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_CRIGHT) &&
!CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) {
func_800B44E0(dbCamera, cam);
} else {
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT) &&
CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CRIGHT) &&
CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) {
Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
osSyncPrintf("@@@\n@@@\n@@@/* *** spline point data ** start here *** */\n@@@\n");
DbCamera_PrintPoints("Lookat", dbCamera->sub.nPoints, dbCamera->sub.lookAt);
@ -1001,13 +1001,13 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
osSyncPrintf("@@@static short nFrames = %d;\n@@@\n", dbCamera->sub.nFrames);
osSyncPrintf("@@@static short Mode = %d;\n@@@\n", dbCamera->sub.mode);
osSyncPrintf("@@@\n@@@\n@@@/* *** spline point data ** finish! *** */\n@@@\n");
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CLEFT)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
dbCamera->sub.unk_08 = (dbCamera->sub.unk_08 + 1) % 3;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CUP) &&
CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CUP) &&
CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
if (dbCamera->sub.unkIdx > 0) {
dbCamera->sub.unkIdx--;
@ -1015,7 +1015,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->sub.unkIdx = dbCamera->sub.nPoints - 1;
}
} else {
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CUP)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CUP)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
if (dbCamera->sub.unkIdx > 0) {
@ -1036,8 +1036,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L) &&
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CDOWN)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L) &&
CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CDOWN)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
if (dbCamera->sub.unkIdx < (dbCamera->sub.nPoints - 1)) {
dbCamera->sub.unkIdx++;
@ -1045,7 +1045,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->sub.unkIdx = 0;
}
} else {
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CDOWN)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CDOWN)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
if (dbCamera->sub.unkIdx < (dbCamera->sub.nPoints - 1)) {
@ -1115,7 +1115,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
break;
case 1:
dbCamera->unk_3C = true;
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DUP)) {
Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
if (dbCamera->sub.unk_0A == 0) {
@ -1124,7 +1124,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->sub.unk_0A--;
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DDOWN)) {
Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
if (dbCamera->sub.unk_0A == 5) {
@ -1133,12 +1133,12 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->sub.unk_0A++;
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DLEFT)) {
Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
switch (dbCamera->sub.unk_0A) {
case 1:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame -= 5;
} else {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame--;
@ -1170,7 +1170,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->sub.unk_0C = false;
break;
case 2:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll -= 5;
dbCamera->roll = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll;
} else {
@ -1182,7 +1182,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DLEFT)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DLEFT)) {
if ((D_8012D10C++ % 5) == 0) {
Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
@ -1190,7 +1190,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
switch (dbCamera->sub.unk_0A) {
case 0:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle -= 1.0f;
dbCamera->fov = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle;
} else {
@ -1199,7 +1199,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
break;
case 5:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.nFrames -= 10;
} else {
dbCamera->sub.nFrames--;
@ -1221,13 +1221,13 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DRIGHT)) {
Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
switch (dbCamera->sub.unk_0A) {
case 1:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame += 5;
} else {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame++;
@ -1258,7 +1258,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->sub.unk_0C = true;
break;
case 2:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll += 5;
dbCamera->roll = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll;
} else {
@ -1269,7 +1269,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
break;
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_DRIGHT)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_DRIGHT)) {
if ((D_8012D10C++ % 5) == 0) {
Audio_PlaySoundGeneral(NA_SE_SY_ATTENTION_ON, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
@ -1277,7 +1277,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
switch (dbCamera->sub.unk_0A) {
case 0:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle += 1.0f;
dbCamera->fov = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle;
} else {
@ -1286,7 +1286,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
break;
case 5:
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) {
dbCamera->sub.nFrames += 10;
} else {
dbCamera->sub.nFrames++;
@ -1388,11 +1388,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 2.0f, 0.02f,
0xFF, 0xFF, 0x7F, 0x40, 0, cam->globalCtx->view.gfxCtx);
0xFF, 0xFF, 0x7F, 0x40, 0, cam->play->view.gfxCtx);
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 2.0f, 0.02f, 0.02f,
0x7F, 0xFF, 0xFF, 0x40, 0, cam->globalCtx->view.gfxCtx);
0x7F, 0xFF, 0xFF, 0x40, 0, cam->play->view.gfxCtx);
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 0.02f, 2.0f,
0xFF, 0x7F, 0xFF, 0x40, 0, cam->globalCtx->view.gfxCtx);
0xFF, 0x7F, 0xFF, 0x40, 0, cam->play->view.gfxCtx);
if (dbCamera->sub.unk_08 == 2) {
for (i = 0; i < (dbCamera->sub.nPoints - 1); i++) {
if (dbCamera->sub.mode != 1) {
@ -1406,14 +1406,14 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
spAA = dbCamera->sub.lookAt[i].cameraRoll * 0xB6;
if (i == dbCamera->sub.unkIdx) {
DebugDisplay_AddObject(spAC.x, spAC.y, spAC.z, spFC.pitch * -1, spFC.yaw, spAA, .5f, .5f, .5f,
0x7F, 0xFF, 0x7F, 0x80, 5, cam->globalCtx->view.gfxCtx);
0x7F, 0xFF, 0x7F, 0x80, 5, cam->play->view.gfxCtx);
DebugDisplay_AddObject(spB8.x, spB8.y, spB8.z, spFC.pitch * -1, spFC.yaw, spAA, 1.5f, 2.0f,
1.0f, 0x7F, 0xFF, 0x7F, 0x80, 4, cam->globalCtx->view.gfxCtx);
1.0f, 0x7F, 0xFF, 0x7F, 0x80, 4, cam->play->view.gfxCtx);
} else {
DebugDisplay_AddObject(spAC.x, spAC.y, spAC.z, spFC.pitch * -1, spFC.yaw, spAA, .5f, .5f, .5f,
0xFF, 0x7F, 0x7F, 0x80, 5, cam->globalCtx->view.gfxCtx);
0xFF, 0x7F, 0x7F, 0x80, 5, cam->play->view.gfxCtx);
DebugDisplay_AddObject(spB8.x, spB8.y, spB8.z, spFC.pitch * -1, spFC.yaw, spAA, 1.5f, 2.0f,
1.0f, 0xFF, 0x7F, 0x7F, 0x80, 4, cam->globalCtx->view.gfxCtx);
1.0f, 0xFF, 0x7F, 0x7F, 0x80, 4, cam->play->view.gfxCtx);
}
}
}
@ -1423,7 +1423,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->roll = 0;
dbCamera->fov = 60.0f;
dbCamera->rollDegrees = dbCamera->roll * 1.40625f;
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CLEFT)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
dbCamera->unk_78 = (dbCamera->unk_78 + 1) % 3;
dbCamera->unk_38 = -1;
@ -1471,18 +1471,18 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
OLib_Vec3fDiffToVecSphGeo(&spA0, &cam->eye, &cam->at);
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 2.0f, 0.02f, 0xFF,
0xFF, 0x7F, 0x2D, 0, cam->globalCtx->view.gfxCtx);
0xFF, 0x7F, 0x2D, 0, cam->play->view.gfxCtx);
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 2.0f, 0.02f, 0.02f, 0x7F,
0xFF, 0xFF, 0x2D, 0, cam->globalCtx->view.gfxCtx);
0xFF, 0xFF, 0x2D, 0, cam->play->view.gfxCtx);
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 0.02f, 2.0f, 0xFF,
0x7F, 0xFF, 0x2D, 0, cam->globalCtx->view.gfxCtx);
0x7F, 0xFF, 0x2D, 0, cam->play->view.gfxCtx);
DebugDisplay_AddObject(cam->eye.x, cam->eye.y, cam->eye.z, spA0.pitch * -1, spA0.yaw, 0, .5f, .5f, .5f, 0xFF,
0x7F, 0x7F, 0x80, 5, cam->globalCtx->view.gfxCtx);
0x7F, 0x7F, 0x80, 5, cam->play->view.gfxCtx);
DebugDisplay_AddObject(cam->at.x, cam->at.y, cam->at.z, spA0.pitch * -1, spA0.yaw, 0, 1.5f, 2.0f, 1.0f, 0xFF,
0x7F, 0x7F, 0x80, 4, cam->globalCtx->view.gfxCtx);
0x7F, 0x7F, 0x80, 4, cam->play->view.gfxCtx);
OLib_Vec3fDiffToVecSphGeo(&spA0, &cam->eyeNext, &cam->at);
DebugDisplay_AddObject(cam->eyeNext.x, cam->eyeNext.y, cam->eyeNext.z, spA0.pitch * -1, spA0.yaw, 0, .5f, .5f,
.5f, 0xFF, 0xC0, 0x7F, 0x50, 5, cam->globalCtx->view.gfxCtx);
.5f, 0xFF, 0xC0, 0x7F, 0x50, 5, cam->play->view.gfxCtx);
}
}
@ -1850,8 +1850,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
case DEMO_CTRL_MENU(ACTION_LOAD, MENU_INFO):
case DEMO_CTRL_MENU(ACTION_CLEAR, MENU_INFO): {
if ((1 << sCurFileIdx) & sMempakFiles) {
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT) ||
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DLEFT) ||
CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DRIGHT)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
dbCamera->sub.demoCtrlToggleSwitch ^= 1;
@ -1864,7 +1864,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
func_8006376C(0x11, 8, dbCamera->sub.demoCtrlToggleSwitch ? 4 : 7, D_8012CF94);
func_8006376C(0x15, 8, dbCamera->sub.demoCtrlToggleSwitch ? 7 : 4, D_8012CF98);
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_A)) {
if (dbCamera->sub.demoCtrlToggleSwitch == 0) {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
@ -1886,7 +1886,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
func_8006376C(0xD, 9, dbCamera->sub.demoCtrlToggleSwitch ? 1 : 6, "PRESS B BUTTON");
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_B)) {
Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
dbCamera->sub.demoCtrlMenu = 0;
return 1;
@ -1921,8 +1921,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
func_8006376C(0x17, 7, 5, D_8012CFA4);
func_8006376C(0xD, 9, (dbCamera->sub.demoCtrlToggleSwitch != 0) ? 1 : 6, "PRESS B BUTTON");
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A) ||
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_A) ||
CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_B)) {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
if (dbCamera->sub.demoCtrlMenu == DEMO_CTRL_MENU(ACTION_LOAD, MENU_SUCCESS)) {
dbCamera->sub.demoCtrlActionIdx = ACTION_E;
@ -1943,8 +1943,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
func_8006376C(0x17, 7, 5, D_8012CFA4);
func_8006376C(0xD, 9, (dbCamera->sub.demoCtrlToggleSwitch != 0) ? 1 : 6, "PRESS B BUTTON");
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A) ||
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_A) ||
CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_B)) {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
dbCamera->sub.demoCtrlMenu -= 9;
}
@ -1978,7 +1978,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
sp74[i * 2 + 0] = '-';
sp74[i * 2 + 1] = '\0';
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DRIGHT)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
if (sCurFileIdx >= 4) {
@ -1995,7 +1995,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
dbCamera->sub.demoCtrlActionIdx = ACTION_SAVE;
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DLEFT)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
if (sCurFileIdx <= 0) {
@ -2038,24 +2038,24 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
func_8006376C(0xD, 0x1A, 5, D_8012CF60[0]);
func_8006376C(0x14, 0x1A, 5, D_8012CF70);
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DUP)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx - 1) % 4u;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DDOWN)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx + 1) % 4u;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_A)) {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
dbCamera->sub.demoCtrlToggleSwitch = 0;
dbCamera->sub.demoCtrlMenu = DEMO_CTRL_MENU(dbCamera->sub.demoCtrlActionIdx, MENU_INFO);
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_B)) {
Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
dbCamera->sub.demoCtrlActionIdx = ACTION_E;
@ -2065,9 +2065,9 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
} else {
func_8006376C(0xC, 0x1A, 4, D_8012CF60[0]);
func_8006376C(0x13, 0x1A, 4, D_8012CF80);
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B) ||
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP) ||
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_B) ||
CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DUP) ||
CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DDOWN)) {
Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
@ -2081,13 +2081,13 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
break;
default: {
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DUP)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DUP)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
dbCamera->sub.demoCtrlMenu = DEMO_CTRL_MENU(ACTION_E, MENU_INFO);
dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx - 1) % 4u;
sCurFileIdx = 0;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DDOWN)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DDOWN)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
dbCamera->sub.demoCtrlMenu = DEMO_CTRL_MENU(ACTION_E, MENU_INFO);
dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx + 1) % 4u;
@ -2100,7 +2100,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
func_8006376C(4, 7, 5, D_8012CF4C);
func_8006376C(D_8016110C * 2 + 6, 7, 7, ">");
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CUP)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CUP)) {
if (D_8016110C > 0) {
D_8016110C--;
}
@ -2108,7 +2108,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
sDbCamAnim.curFrame = 0.0f;
sDbCamAnim.keyframe = 0;
sDbCamAnim.unk_04 = 0;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CDOWN)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CDOWN)) {
if (D_8016110C < 14) {
D_8016110C++;
}
@ -2116,7 +2116,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
sDbCamAnim.curFrame = 0.0f;
sDbCamAnim.keyframe = 0;
sDbCamAnim.unk_04 = 0;
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CLEFT)) {
sDbCamAnim.unk_0A = 0;
Interface_ChangeAlpha(2);
ShrinkWindow_SetVal(0);
@ -2135,7 +2135,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
return 2;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[1].press.button, BTN_CRIGHT)) {
if (CHECK_BTN_ALL(sPlayState->state.input[1].press.button, BTN_CRIGHT)) {
D_8015FCC8 = 0;
gSaveContext.cutsceneIndex = 0xFFFD;
gSaveContext.cutsceneTrigger = 1;
@ -2148,7 +2148,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
Audio_PlaySoundGeneral(NA_SE_SY_HP_RECOVER, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_L)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_L)) {
if (sp74[sCurFileIdx] == '?') {
sLastFileIdx = -1;
D_801612EA = '*';
@ -2156,7 +2156,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
sLastFileIdx = sCurFileIdx;
D_801612EA = sDbCameraCuts[idx1].letter;
}
} else if (!CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L)) {
} else if (!CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L)) {
if (sLastFileIdx != -1) {
switch (sp74[sCurFileIdx]) {
case '?':
@ -2198,7 +2198,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
sLastFileIdx = -1;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_A)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_A)) {
if (sp74[sCurFileIdx] == '?') {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
sp74[sCurFileIdx] = DbCamera_InitCut(idx1, &dbCamera->sub);
@ -2208,7 +2208,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_B)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_B)) {
if (sp74[sCurFileIdx] != '?' && sp74[sCurFileIdx] != '-') {
Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
sp74[sCurFileIdx] = '?';
@ -2216,7 +2216,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_R)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_R)) {
if (sp74[sCurFileIdx] != '?' && sp74[sCurFileIdx] != '-') {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
@ -2239,7 +2239,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DRIGHT)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DRIGHT)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
if (sCurFileIdx == 0x1E) {
sCurFileIdx = 0;
@ -2247,21 +2247,21 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
sCurFileIdx++;
}
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_DLEFT)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_DLEFT)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
sCurFileIdx = (sCurFileIdx == 0) ? 0x1E : sCurFileIdx - 1;
}
if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L) &&
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT)) {
if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L) &&
CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CRIGHT)) {
for (i = 0; i < ARRAY_COUNT(sDbCameraCuts) - 1; i++) {
osSyncPrintf("###%2d:(%c) (%d %d) %d %d %d\n", i, sDbCameraCuts[i].letter,
sDbCameraCuts[i].position, sDbCameraCuts[i].lookAt, sDbCameraCuts[i].nFrames,
sDbCameraCuts[i].nPoints, sDbCameraCuts[i].mode);
}
DbCamera_PrintAllCuts(cam);
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].cur.button, BTN_L) &&
CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CLEFT)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].cur.button, BTN_L) &&
CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CLEFT)) {
Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
for (i = 0; i < ARRAY_COUNT(sDbCameraCuts) - 1; i++) {
if (sDbCameraCuts[i].nPoints != 0) {
@ -2269,7 +2269,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
DbCamera_PrintCutBytes(&sDbCameraCuts[i]);
}
}
} else if (CHECK_BTN_ALL(sGlobalCtx->state.input[2].press.button, BTN_CRIGHT)) {
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CRIGHT)) {
sDbCamAnim.curFrame = 0.0f;
sDbCamAnim.keyframe = 0;
sDbCamAnim.unk_04 = 0.0f;

View File

@ -1,6 +1,6 @@
#include "global.h"
void FlagSet_Update(GlobalContext* globalCtx) {
void FlagSet_Update(PlayState* play) {
static s32 entryIdx = 0;
static u32 curBit = 0;
static s32 timer = 0;
@ -35,8 +35,8 @@ void FlagSet_Update(GlobalContext* globalCtx) {
{ &gSaveContext.eventInf[2], "event_inf[2]" }, { &gSaveContext.eventInf[3], "event_inf[3]" },
};
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Input* input = &globalCtx->state.input[0];
GraphicsContext* gfxCtx = play->state.gfxCtx;
Input* input = &play->state.input[0];
Gfx* gfx;
Gfx* polyOpa;
@ -145,7 +145,7 @@ void FlagSet_Update(GlobalContext* globalCtx) {
}
if (CHECK_BTN_ALL(input->press.button, BTN_L)) {
globalCtx->pauseCtx.debugState = 0;
play->pauseCtx.debugState = 0;
}
CLOSE_DISPS(gfxCtx);

View File

@ -389,10 +389,10 @@ void GameState_Update(GameState* gameState) {
// Moon Jump On L
if (CVar_GetS32("gMoonJumpOnL", 0) != 0) {
if (gGlobalCtx) {
Player* player = GET_PLAYER(gGlobalCtx);
if (gPlayState) {
Player* player = GET_PLAYER(gPlayState);
if (CHECK_BTN_ANY(gGlobalCtx->state.input[0].cur.button, BTN_L)) {
if (CHECK_BTN_ANY(gPlayState->state.input[0].cur.button, BTN_L)) {
player->actor.velocity.y = 6.34375f;
}
}
@ -400,18 +400,18 @@ void GameState_Update(GameState* gameState) {
// Permanent infinite sword glitch (ISG)
if (CVar_GetS32("gEzISG", 0) != 0) {
if (gGlobalCtx) {
Player* player = GET_PLAYER(gGlobalCtx);
if (gPlayState) {
Player* player = GET_PLAYER(gPlayState);
player->swordState = 1;
}
}
// Unrestricted Items
if (CVar_GetS32("gNoRestrictItems", 0) != 0) {
if (gGlobalCtx) {
u8 sunsBackup = gGlobalCtx->interfaceCtx.restrictions.sunsSong;
memset(&gGlobalCtx->interfaceCtx.restrictions, 0, sizeof(gGlobalCtx->interfaceCtx.restrictions));
gGlobalCtx->interfaceCtx.restrictions.sunsSong = sunsBackup;
if (gPlayState) {
u8 sunsBackup = gPlayState->interfaceCtx.restrictions.sunsSong;
memset(&gPlayState->interfaceCtx.restrictions, 0, sizeof(gPlayState->interfaceCtx.restrictions));
gPlayState->interfaceCtx.restrictions.sunsSong = sunsBackup;
}
}

View File

@ -124,7 +124,7 @@ GameStateOverlay* Graph_GetNextGameState(GameState* gameState) {
if (gameStateInitFunc == Title_Init) {
return &gGameStateOverlayTable[2];
}
if (gameStateInitFunc == Gameplay_Init) {
if (gameStateInitFunc == Play_Init) {
return &gGameStateOverlayTable[3];
}
if (gameStateInitFunc == Opening_Init) {
@ -469,8 +469,8 @@ static void RunFrame()
// Setup the normal skybox once before entering any game states to avoid the 0xabababab crash.
// The crash is due to certain skyboxes not loading all the data they need from Skybox_Setup.
if (!hasSetupSkybox) {
GlobalContext* globalCtx = (GlobalContext*)runFrameContext.gameState;
Skybox_Setup(globalCtx, &globalCtx->skyboxCtx, SKYBOX_NORMAL_SKY);
PlayState* play = (PlayState*)runFrameContext.gameState;
Skybox_Setup(play, &play->skyboxCtx, SKYBOX_NORMAL_SKY);
hasSetupSkybox = true;
}

View File

@ -294,7 +294,7 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) {
if (HealthMeter_IsCritical()) {
controllerCallback.ledColor = 0;
} else if (gGlobalCtx) {
} else if (gPlayState) {
switch (CUR_EQUIP_VALUE(EQUIP_TUNIC) - 1) {
case PLAYER_TUNIC_KOKIRI:
controllerCallback.ledColor = 1;

View File

@ -2147,8 +2147,8 @@ s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z) {
return false;
}
void Math3D_DrawSphere(GlobalContext* globalCtx, Sphere16* sph) {
void Math3D_DrawSphere(PlayState* play, Sphere16* sph) {
}
void Math3D_DrawCylinder(GlobalContext* globalCtx, Cylinder16* cyl) {
void Math3D_DrawCylinder(PlayState* play, Cylinder16* cyl) {
}

File diff suppressed because it is too large Load Diff

View File

@ -95,7 +95,7 @@ void DynaSSNodeList_SetSSListHead(DynaSSNodeList* nodeList, SSList* ssList, s16*
/**
* Initialize DynaSSNodeList
*/
void DynaSSNodeList_Initialize(GlobalContext* globalCtx, DynaSSNodeList* nodeList) {
void DynaSSNodeList_Initialize(PlayState* play, DynaSSNodeList* nodeList) {
nodeList->tbl = NULL;
nodeList->count = 0;
}
@ -103,8 +103,8 @@ void DynaSSNodeList_Initialize(GlobalContext* globalCtx, DynaSSNodeList* nodeLis
/**
* Initialize DynaSSNodeList tbl
*/
void DynaSSNodeList_Alloc(GlobalContext* globalCtx, DynaSSNodeList* nodeList, s32 max) {
nodeList->tbl = THA_AllocEndAlign(&globalCtx->state.tha, max * sizeof(SSNode), -2);
void DynaSSNodeList_Alloc(PlayState* play, DynaSSNodeList* nodeList, s32 max) {
nodeList->tbl = THA_AllocEndAlign(&play->state.tha, max * sizeof(SSNode), -2);
ASSERT(nodeList->tbl != NULL);
@ -1355,7 +1355,7 @@ s32 BgCheck_PolyIntersectsSubdivision(Vec3f* min, Vec3f* max, CollisionPoly* pol
* Initialize StaticLookup Table
* returns size of table, in bytes
*/
u32 BgCheck_InitializeStaticLookup(CollisionContext* colCtx, GlobalContext* globalCtx, StaticLookup* lookupTbl) {
u32 BgCheck_InitializeStaticLookup(CollisionContext* colCtx, PlayState* play, StaticLookup* lookupTbl) {
Vec3s* vtxList;
CollisionPoly* polyList;
s32 polyMax;
@ -1438,7 +1438,7 @@ u32 BgCheck_InitializeStaticLookup(CollisionContext* colCtx, GlobalContext* glob
/**
* Is current scene a SPOT scene
*/
s32 BgCheck_IsSpotScene(GlobalContext* globalCtx) {
s32 BgCheck_IsSpotScene(PlayState* play) {
static s16 spotScenes[] = {
SCENE_SPOT00, SCENE_SPOT01, SCENE_SPOT02, SCENE_SPOT03, SCENE_SPOT04, SCENE_SPOT05, SCENE_SPOT06,
SCENE_SPOT07, SCENE_SPOT08, SCENE_SPOT09, SCENE_SPOT10, SCENE_SPOT11, SCENE_SPOT12, SCENE_SPOT13,
@ -1447,7 +1447,7 @@ s32 BgCheck_IsSpotScene(GlobalContext* globalCtx) {
s16* i;
for (i = spotScenes; i < spotScenes + ARRAY_COUNT(spotScenes); i++) {
if (globalCtx->sceneNum == *i) {
if (play->sceneNum == *i) {
return true;
}
}
@ -1501,7 +1501,7 @@ typedef struct {
/**
* Allocate CollisionContext
*/
void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, CollisionHeader* colHeader) {
void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader* colHeader) {
static BgCheckSceneSubdivisionEntry sceneSubdivisionList[] = {
{ SCENE_HAKADAN, { 23, 7, 14 }, -1 },
{ SCENE_BMORI1, { 38, 1, 38 }, -1 },
@ -1522,7 +1522,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
osSyncPrintf("/*---------------- BGCheck バッファーメモリサイズ -------------*/\n");
if (YREG(15) == 0x10 || YREG(15) == 0x20 || YREG(15) == 0x30 || YREG(15) == 0x40) {
if (globalCtx->sceneNum == SCENE_MALON_STABLE) {
if (play->sceneNum == SCENE_MALON_STABLE) {
// "/* BGCheck LonLon Size %dbyte */\n"
osSyncPrintf("/* BGCheck LonLonサイズ %dbyte */\n", 0x3520);
colCtx->memSize = 0x3520;
@ -1537,7 +1537,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
colCtx->subdivAmount.x = 2;
colCtx->subdivAmount.y = 2;
colCtx->subdivAmount.z = 2;
} else if (BgCheck_IsSpotScene(globalCtx) == true) {
} else if (BgCheck_IsSpotScene(play) == true) {
colCtx->memSize = 0xF000;
// "/* BGCheck Spot Size %dbyte */\n"
osSyncPrintf("/* BGCheck Spot用サイズ %dbyte */\n", 0xF000);
@ -1548,7 +1548,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
colCtx->subdivAmount.y = 4;
colCtx->subdivAmount.z = 16;
} else {
if (BgCheck_TryGetCustomMemsize(globalCtx->sceneNum, &customMemSize)) {
if (BgCheck_TryGetCustomMemsize(play->sceneNum, &customMemSize)) {
colCtx->memSize = customMemSize;
} else {
colCtx->memSize = 0x1CC00;
@ -1561,7 +1561,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
useCustomSubdivisions = false;
for (i = 0; i < ARRAY_COUNT(sceneSubdivisionList); i++) {
if (globalCtx->sceneNum == sceneSubdivisionList[i].sceneId) {
if (play->sceneNum == sceneSubdivisionList[i].sceneId) {
colCtx->subdivAmount.x = sceneSubdivisionList[i].subdivAmount.x;
colCtx->subdivAmount.y = sceneSubdivisionList[i].subdivAmount.y;
colCtx->subdivAmount.z = sceneSubdivisionList[i].subdivAmount.z;
@ -1576,7 +1576,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
}
}
colCtx->lookupTbl = THA_AllocEndAlign(
&globalCtx->state.tha,
&play->state.tha,
colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z, ~1);
if (colCtx->lookupTbl == NULL) {
LOG_HUNGUP_THREAD();
@ -1624,15 +1624,15 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
}
SSNodeList_Initialize(&colCtx->polyNodes);
SSNodeList_Alloc(globalCtx, &colCtx->polyNodes, tblMax, colCtx->colHeader->numPolygons);
SSNodeList_Alloc(play, &colCtx->polyNodes, tblMax, colCtx->colHeader->numPolygons);
lookupTblMemSize = BgCheck_InitializeStaticLookup(colCtx, globalCtx, colCtx->lookupTbl);
lookupTblMemSize = BgCheck_InitializeStaticLookup(colCtx, play, colCtx->lookupTbl);
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("/*---結局 BG使用サイズ %dbyte---*/\n", memSize + lookupTblMemSize);
osSyncPrintf(VT_RST);
DynaPoly_Init(globalCtx, &colCtx->dyna);
DynaPoly_Alloc(globalCtx, &colCtx->dyna);
DynaPoly_Init(play, &colCtx->dyna);
DynaPoly_Alloc(play, &colCtx->dyna);
}
/**
@ -1675,7 +1675,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 chkDist) {
f32 yIntersectDyna;
@ -1720,7 +1720,7 @@ f32 BgCheck_RaycastFloorImpl(GlobalContext* globalCtx, CollisionContext* colCtx,
dynaRaycast.actor = actor;
dynaRaycast.unk_20 = arg7;
dynaRaycast.chkDist = chkDist;
dynaRaycast.globalCtx = globalCtx;
dynaRaycast.play = play;
dynaRaycast.resultPoly = outPoly;
dynaRaycast.bgId = outBgId;
@ -1760,11 +1760,11 @@ 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,
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);
return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, &bgId, pos, NULL, 0x1C, 1.0f);
}
/**
@ -1788,9 +1788,9 @@ f32 BgCheck_EntityRaycastFloor4(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(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId,
f32 BgCheck_EntityRaycastFloor5(PlayState* play, 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);
return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, bgId, pos, actor, 0x1C, 1.0f);
}
/**
@ -2441,14 +2441,14 @@ void SSNodeList_Initialize(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.tha, tblMax * sizeof(SSNode), -2);
this->tbl = THA_AllocEndAlign(&play->state.tha, tblMax * sizeof(SSNode), -2);
ASSERT(this->tbl != NULL);
this->polyCheckTbl = GAMESTATE_ALLOC_MC(&globalCtx->state, numPolys);
this->polyCheckTbl = GAMESTATE_ALLOC_MC(&play->state, numPolys);
ASSERT(this->polyCheckTbl != NULL);
}
@ -2534,7 +2534,7 @@ void DynaLookup_ResetVtxStartIndex(u16* vtxStartIndex) {
/**
* Initialize BgActor
*/
void BgActor_Initialize(GlobalContext* globalCtx, BgActor* bgActor) {
void BgActor_Initialize(PlayState* play, BgActor* bgActor) {
bgActor->actor = NULL;
bgActor->colHeader = NULL;
ScaleRotPos_Initialize(&bgActor->prevTransform);
@ -2577,8 +2577,8 @@ void DynaPoly_NullPolyList(CollisionPoly** polyList) {
/**
* Allocate dyna.polyList
*/
void DynaPoly_AllocPolyList(GlobalContext* globalCtx, CollisionPoly** polyList, s32 numPolys) {
*polyList = THA_AllocEndAlign(&globalCtx->state.tha, numPolys * sizeof(CollisionPoly), -2);
void DynaPoly_AllocPolyList(PlayState* play, CollisionPoly** polyList, s32 numPolys) {
*polyList = THA_AllocEndAlign(&play->state.tha, numPolys * sizeof(CollisionPoly), -2);
ASSERT(*polyList != NULL);
}
@ -2592,15 +2592,15 @@ void DynaPoly_NullVtxList(Vec3s** vtxList) {
/**
* Allocate dyna.vtxList
*/
void DynaPoly_AllocVtxList(GlobalContext* globalCtx, Vec3s** vtxList, s32 numVtx) {
*vtxList = THA_AllocEndAlign(&globalCtx->state.tha, numVtx * sizeof(Vec3s), -2);
void DynaPoly_AllocVtxList(PlayState* play, Vec3s** vtxList, s32 numVtx) {
*vtxList = THA_AllocEndAlign(&play->state.tha, numVtx * sizeof(Vec3s), -2);
ASSERT(*vtxList != NULL);
}
/**
* Update BgActor's prevTransform
*/
void DynaPoly_SetBgActorPrevTransform(GlobalContext* globalCtx, BgActor* bgActor) {
void DynaPoly_SetBgActorPrevTransform(PlayState* play, BgActor* bgActor) {
bgActor->prevTransform = bgActor->curTransform;
}
@ -2617,38 +2617,38 @@ 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);
DynaSSNodeList_Initialize(globalCtx, &dyna->polyNodes);
DynaSSNodeList_Initialize(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_Initialize(globalCtx, &dyna->bgActors[i]);
BgActor_Initialize(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);
DynaSSNodeList_Initialize(globalCtx, &dyna->polyNodes);
DynaSSNodeList_Alloc(globalCtx, &dyna->polyNodes, dyna->polyNodesMax);
DynaSSNodeList_Initialize(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,
s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* actor,
CollisionHeader* colHeader) {
s32 bgId;
s32 foundSlot = false;
@ -2690,28 +2690,28 @@ DynaPolyActor* DynaPoly_GetActor(CollisionContext* colCtx, s32 bgId) {
return (DynaPolyActor*)colCtx->dyna.bgActors[bgId].actor;
}
void func_8003EBF8(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void func_8003EBF8(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
if (DynaPoly_IsBgIdBgActor(bgId)) {
dyna->bgActorFlags[bgId] |= 4;
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
}
void func_8003EC50(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void func_8003EC50(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
if (DynaPoly_IsBgIdBgActor(bgId)) {
dyna->bgActorFlags[bgId] &= ~4;
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
}
void func_8003ECA8(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void func_8003ECA8(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
if (DynaPoly_IsBgIdBgActor(bgId)) {
dyna->bgActorFlags[bgId] |= 8;
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
}
void func_8003ED00(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) {
void func_8003ED00(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
if (DynaPoly_IsBgIdBgActor(bgId)) {
dyna->bgActorFlags[bgId] &= ~8;
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
@ -2721,7 +2721,7 @@ void func_8003ED00(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;
osSyncPrintf(VT_FGCOL(GREEN));
@ -2746,7 +2746,7 @@ void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna
return;
}
}
actor = DynaPoly_GetActor(&globalCtx->colCtx, bgId);
actor = DynaPoly_GetActor(&play->colCtx, bgId);
if (actor != NULL) {
actor->bgId = BGACTOR_NEG_ONE;
@ -2755,14 +2755,14 @@ void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna
}
}
void func_8003EE6C(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
void func_8003EE6C(PlayState* play, DynaCollisionContext* dyna) {
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
/**
* original name: DynaPolyInfo_expandSRT
*/
void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex,
void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex,
s32* polyStartIndex) {
MtxF mtx;
Actor* actor;
@ -2941,13 +2941,13 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3
}
}
void func_8003F8EC(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* actor) {
void func_8003F8EC(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) {
func_800434A0((DynaPolyActor*)actor);
return;
@ -2959,7 +2959,7 @@ void func_8003F8EC(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor*
/**
* DynaPolyInfo_setup
*/
void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
void DynaPoly_Setup(PlayState* play, DynaCollisionContext* dyna) {
DynaPolyActor* actor;
s32 vtxStartIndex;
s32 polyStartIndex;
@ -2979,7 +2979,7 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
osSyncPrintf(VT_RST);
dyna->bgActorFlags[i] = 0;
BgActor_Initialize(globalCtx, &dyna->bgActors[i]);
BgActor_Initialize(play, &dyna->bgActors[i]);
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
if (dyna->bgActors[i].actor != NULL && dyna->bgActors[i].actor->update == NULL) {
@ -2987,14 +2987,14 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("DynaPolyInfo_setup():削除 index=%d\n", i);
osSyncPrintf(VT_RST);
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_Initialize(globalCtx, &dyna->bgActors[i]);
BgActor_Initialize(play, &dyna->bgActors[i]);
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
}
}
@ -3002,7 +3002,7 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
polyStartIndex = 0;
for (i = 0; i < BG_ACTOR_MAX; i++) {
if (dyna->bgActorFlags[i] & 1) {
DynaPoly_ExpandSRT(globalCtx, dyna, i, &vtxStartIndex, &polyStartIndex);
DynaPoly_ExpandSRT(play, dyna, i, &vtxStartIndex, &polyStartIndex);
}
}
dyna->bitFlag &= ~DYNAPOLY_INVALIDATE_LOOKUP;
@ -3011,12 +3011,12 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) {
/**
* 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]);
}
}
}
@ -3155,10 +3155,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 == 0) {
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;
@ -3820,7 +3820,7 @@ void CollisionHeader_GetVirtual(void* colHeader, CollisionHeader** dest)
/**
* SEGMENT_TO_VIRTUAL all active BgActor CollisionHeaders
*/
void func_800418D0(CollisionContext* colCtx, GlobalContext* globalCtx) {
void func_800418D0(CollisionContext* colCtx, PlayState* play) {
DynaCollisionContext* dyna = &colCtx->dyna;
s32 i;
u16 flag;
@ -3828,7 +3828,7 @@ void func_800418D0(CollisionContext* colCtx, GlobalContext* globalCtx) {
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);
}
}
@ -4205,9 +4205,9 @@ f32 zdWaterBoxMaxZ = -967.0f;
* 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_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) {
if (globalCtx->sceneNum == SCENE_SPOT07) {
if (play->sceneNum == SCENE_SPOT07) {
if (zdWaterBoxMinX < x && x < zdWaterBoxMaxX && zdWaterBoxMinY < *ySurface && *ySurface < zdWaterBoxMaxY &&
zdWaterBoxMinZ < z && z < zdWaterBoxMaxZ) {
*outWaterBox = &zdWaterBox;
@ -4215,7 +4215,7 @@ s32 WaterBox_GetSurface1(GlobalContext* globalCtx, CollisionContext* colCtx, f32
return true;
}
}
return WaterBox_GetSurfaceImpl(globalCtx, colCtx, x, z, ySurface, outWaterBox);
return WaterBox_GetSurfaceImpl(play, colCtx, x, z, ySurface, outWaterBox);
}
/**
@ -4223,7 +4223,7 @@ s32 WaterBox_GetSurface1(GlobalContext* globalCtx, CollisionContext* colCtx, f32
* 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) {
CollisionHeader* colHeader = colCtx->colHeader;
u32 room;
@ -4236,7 +4236,7 @@ s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx,
for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes;
curWaterBox++) {
room = (curWaterBox->properties >> 13) & 0x3F;
if (room == (u32)globalCtx->roomCtx.curRoom.num || room == 0x3F) {
if (room == (u32)play->roomCtx.curRoom.num || room == 0x3F) {
if ((curWaterBox->properties & 0x80000) == 0) {
if (curWaterBox->xMin < x && x < curWaterBox->xMin + curWaterBox->xLength) {
if (curWaterBox->zMin < z && z < curWaterBox->zMin + curWaterBox->zLength) {
@ -4257,7 +4257,7 @@ s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx,
* 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 surfaceChkDist,
s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist,
WaterBox** outWaterBox) {
CollisionHeader* colHeader = colCtx->colHeader;
s32 room;
@ -4274,7 +4274,7 @@ s32 WaterBox_GetSurface2(GlobalContext* globalCtx, CollisionContext* colCtx, Vec
waterBox = &colHeader->waterBoxes[i];
room = WATERBOX_ROOM(waterBox->properties);
if (!(room == globalCtx->roomCtx.curRoom.num || room == 0x3F)) {
if (!(room == play->roomCtx.curRoom.num || room == 0x3F)) {
continue;
}
if ((waterBox->properties & 0x80000)) {
@ -4334,7 +4334,7 @@ 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_800425B0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
s32 func_800425B0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
WaterBox** outWaterBox) {
CollisionHeader* colHeader = colCtx->colHeader;
u32 room;
@ -4347,7 +4347,7 @@ s32 func_800425B0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32
for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes;
curWaterBox++) {
room = (curWaterBox->properties >> 0xD) & 0x3F;
if ((room == (u32)globalCtx->roomCtx.curRoom.num) || (room == 0x3F)) {
if ((room == (u32)play->roomCtx.curRoom.num) || (room == 0x3F)) {
if ((curWaterBox->properties & 0x80000) != 0) {
if (curWaterBox->xMin < x && x < (curWaterBox->xMin + curWaterBox->xLength)) {
if (curWaterBox->zMin < z && z < (curWaterBox->zMin + curWaterBox->zLength)) {
@ -4403,7 +4403,7 @@ s32 func_800427B4(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec
/**
* Draw a list of dyna polys, specified by `ssList`
*/
void BgCheck_DrawDynaPolyList(GlobalContext* globalCtx, CollisionContext* colCtx, DynaCollisionContext* dyna,
void BgCheck_DrawDynaPolyList(PlayState* play, CollisionContext* colCtx, DynaCollisionContext* dyna,
SSList* ssList, u8 r, u8 g, u8 b) {
s16 curPolyId;
CollisionPoly* poly;
@ -4437,7 +4437,7 @@ void BgCheck_DrawDynaPolyList(GlobalContext* globalCtx, CollisionContext* colCtx
vC.y += AREG(26) * ny;
vC.z += AREG(26) * nz;
}
Collider_DrawPoly(globalCtx->state.gfxCtx, &vA, &vB, &vC, r, g, b);
Collider_DrawPoly(play->state.gfxCtx, &vA, &vB, &vC, r, g, b);
if (curNode->next == SS_NULL) {
break;
}
@ -4450,17 +4450,17 @@ void BgCheck_DrawDynaPolyList(GlobalContext* globalCtx, CollisionContext* colCtx
* Draw a BgActor's dyna polys
* `bgId` is the BgActor index that should be drawn
*/
void BgCheck_DrawBgActor(GlobalContext* globalCtx, CollisionContext* colCtx, s32 bgId) {
void BgCheck_DrawBgActor(PlayState* play, CollisionContext* colCtx, s32 bgId) {
if (AREG(21)) {
BgCheck_DrawDynaPolyList(globalCtx, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.ceiling, 255,
BgCheck_DrawDynaPolyList(play, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.ceiling, 255,
0, 0);
}
if (AREG(22)) {
BgCheck_DrawDynaPolyList(globalCtx, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.wall, 0, 255,
BgCheck_DrawDynaPolyList(play, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.wall, 0, 255,
0);
}
if (AREG(23)) {
BgCheck_DrawDynaPolyList(globalCtx, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.floor, 0, 0,
BgCheck_DrawDynaPolyList(play, colCtx, &colCtx->dyna, &colCtx->dyna.bgActors[bgId].dynaLookup.floor, 0, 0,
255);
}
}
@ -4468,7 +4468,7 @@ void BgCheck_DrawBgActor(GlobalContext* globalCtx, CollisionContext* colCtx, s32
/**
* Draw all dyna polys
*/
void BgCheck_DrawDynaCollision(GlobalContext* globalCtx, CollisionContext* colCtx) {
void BgCheck_DrawDynaCollision(PlayState* play, CollisionContext* colCtx) {
s32 bgId;
for (bgId = 0; bgId < BG_ACTOR_MAX; bgId++) {
@ -4476,14 +4476,14 @@ void BgCheck_DrawDynaCollision(GlobalContext* globalCtx, CollisionContext* colCt
if (!(colCtx->dyna.bgActorFlags[bgId] & 1)) {
continue;
}
BgCheck_DrawBgActor(globalCtx, colCtx, bgId);
BgCheck_DrawBgActor(play, colCtx, bgId);
}
}
/**
* Draw a static poly
*/
void BgCheck_DrawStaticPoly(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly* poly, u8 r, u8 g, u8 b) {
void BgCheck_DrawStaticPoly(PlayState* play, CollisionContext* colCtx, CollisionPoly* poly, u8 r, u8 g, u8 b) {
Vec3f vA;
Vec3f vB;
Vec3f vC;
@ -4508,13 +4508,13 @@ void BgCheck_DrawStaticPoly(GlobalContext* globalCtx, CollisionContext* colCtx,
vC.y += AREG(26) * ny;
vC.z += AREG(26) * nz;
}
Collider_DrawPoly(globalCtx->state.gfxCtx, &vA, &vB, &vC, r, g, b);
Collider_DrawPoly(play->state.gfxCtx, &vA, &vB, &vC, r, g, b);
}
/**
* Draw a list of static polys, specified by `ssList`
*/
void BgCheck_DrawStaticPolyList(GlobalContext* globalCtx, CollisionContext* colCtx, SSList* ssList, u8 r, u8 g, u8 b) {
void BgCheck_DrawStaticPolyList(PlayState* play, CollisionContext* colCtx, SSList* ssList, u8 r, u8 g, u8 b) {
SSNode* curNode;
CollisionPoly* polyList = colCtx->colHeader->polyList;
s16 curPolyId;
@ -4523,7 +4523,7 @@ void BgCheck_DrawStaticPolyList(GlobalContext* globalCtx, CollisionContext* colC
curNode = &colCtx->polyNodes.tbl[ssList->head];
while (true) {
curPolyId = curNode->polyId;
BgCheck_DrawStaticPoly(globalCtx, colCtx, &polyList[curPolyId], r, g, b);
BgCheck_DrawStaticPoly(play, colCtx, &polyList[curPolyId], r, g, b);
if (curNode->next == SS_NULL) {
break;
}
@ -4535,17 +4535,17 @@ void BgCheck_DrawStaticPolyList(GlobalContext* globalCtx, CollisionContext* colC
/**
* Draw scene collision
*/
void BgCheck_DrawStaticCollision(GlobalContext* globalCtx, CollisionContext* colCtx) {
Player* player = GET_PLAYER(globalCtx);
void BgCheck_DrawStaticCollision(PlayState* play, CollisionContext* colCtx) {
Player* player = GET_PLAYER(play);
StaticLookup* lookup = BgCheck_GetNearestStaticLookup(colCtx, colCtx->lookupTbl, &player->actor.world.pos);
if (AREG(23) != 0) {
BgCheck_DrawStaticPolyList(globalCtx, colCtx, &lookup->floor, 0, 0, 255);
BgCheck_DrawStaticPolyList(play, colCtx, &lookup->floor, 0, 0, 255);
}
if (AREG(22) != 0) {
BgCheck_DrawStaticPolyList(globalCtx, colCtx, &lookup->wall, 0, 255, 0);
BgCheck_DrawStaticPolyList(play, colCtx, &lookup->wall, 0, 255, 0);
}
if (AREG(21) != 0) {
BgCheck_DrawStaticPolyList(globalCtx, colCtx, &lookup->ceiling, 255, 0, 0);
BgCheck_DrawStaticPolyList(play, colCtx, &lookup->ceiling, 255, 0, 0);
}
}

View File

@ -211,7 +211,7 @@ Vec3f* Camera_Vec3fTranslateByUnitVector(Vec3f* dest, Vec3f* src, Vec3f* unitVec
* Detects the collision poly between `from` and `to`, places collision info in `to`
*/
s32 Camera_BGCheckInfo(Camera* camera, Vec3f* from, CamColChk* to) {
CollisionContext* colCtx = &camera->globalCtx->colCtx;
CollisionContext* colCtx = &camera->play->colCtx;
Vec3f toNewPos;
Vec3f toPoint;
Vec3f fromToNorm;
@ -274,7 +274,7 @@ s32 Camera_BGCheck(Camera* camera, Vec3f* from, Vec3f* to) {
}
s32 func_80043F94(Camera* camera, Vec3f* from, CamColChk* to) {
CollisionContext* colCtx = &camera->globalCtx->colCtx;
CollisionContext* colCtx = &camera->play->colCtx;
Vec3f toNewPos;
Vec3f toPos;
Vec3f fromToNorm;
@ -359,7 +359,7 @@ s32 Camera_CheckOOB(Camera* camera, Vec3f* from, Vec3f* to) {
s32 pad2;
s32 bgId;
CollisionPoly* poly;
CollisionContext* colCtx = &camera->globalCtx->colCtx;
CollisionContext* colCtx = &camera->play->colCtx;
poly = NULL;
if (BgCheck_CameraLineTest1(colCtx, from, to, &intersect, &poly, 1, 1, 1, 0, &bgId) &&
@ -378,7 +378,7 @@ s32 Camera_CheckOOB(Camera* camera, Vec3f* from, Vec3f* to) {
f32 Camera_GetFloorYNorm(Camera* camera, Vec3f* floorNorm, Vec3f* chkPos, s32* bgId) {
s32 pad;
CollisionPoly* floorPoly;
f32 floorY = BgCheck_EntityRaycastFloor3(&camera->globalCtx->colCtx, &floorPoly, bgId, chkPos);
f32 floorY = BgCheck_EntityRaycastFloor3(&camera->play->colCtx, &floorPoly, bgId, chkPos);
if (floorY == BGCHECK_Y_MIN) {
// no floor
@ -414,7 +414,7 @@ f32 Camera_GetFloorY(Camera* camera, Vec3f* pos) {
*/
f32 Camera_GetFloorYLayer(Camera* camera, Vec3f* norm, Vec3f* pos, s32* bgId) {
CollisionPoly* floorPoly;
CollisionContext* colCtx = &camera->globalCtx->colCtx;
CollisionContext* colCtx = &camera->play->colCtx;
f32 floorY;
s32 i;
@ -449,14 +449,14 @@ f32 Camera_GetFloorYLayer(Camera* camera, Vec3f* norm, Vec3f* pos, s32* bgId) {
* Returns the CameraSettingType of the camera at index `camDataIdx`
*/
s16 Camera_GetCamDataSetting(Camera* camera, s32 camDataIdx) {
return func_80041A4C(&camera->globalCtx->colCtx, camDataIdx, BGCHECK_SCENE);
return func_80041A4C(&camera->play->colCtx, camDataIdx, BGCHECK_SCENE);
}
/**
* Returns the scene camera info for the current camera data index
*/
Vec3s* Camera_GetCamBGData(Camera* camera) {
return func_80041C10(&camera->globalCtx->colCtx, camera->camDataIdx, BGCHECK_SCENE);
return func_80041C10(&camera->play->colCtx, camera->camDataIdx, BGCHECK_SCENE);
}
/**
@ -469,9 +469,9 @@ s32 Camera_GetDataIdxForPoly(Camera* camera, s32* bgId, CollisionPoly* poly) {
s32 ret;
Actor_GetWorldPosShapeRot(&playerPosRot, &camera->player->actor); // unused.
camDataIdx = SurfaceType_GetCamDataIndex(&camera->globalCtx->colCtx, poly, *bgId);
camDataIdx = SurfaceType_GetCamDataIndex(&camera->play->colCtx, poly, *bgId);
if (func_80041A4C(&camera->globalCtx->colCtx, camDataIdx, *bgId) == CAM_SET_NONE) {
if (func_80041A4C(&camera->play->colCtx, camDataIdx, *bgId) == CAM_SET_NONE) {
ret = -1;
} else {
ret = camDataIdx;
@ -492,13 +492,13 @@ Vec3s* Camera_GetCamBgDataUnderPlayer(Camera* camera, u16* dataCnt) {
Actor_GetWorldPosShapeRot(&playerPosShape, &camera->player->actor);
playerPosShape.pos.y += Player_GetHeight(camera->player);
if (BgCheck_EntityRaycastFloor3(&camera->globalCtx->colCtx, &floorPoly, &bgId, &playerPosShape.pos) ==
if (BgCheck_EntityRaycastFloor3(&camera->play->colCtx, &floorPoly, &bgId, &playerPosShape.pos) ==
BGCHECK_Y_MIN) {
// no floor
return NULL;
}
*dataCnt = SurfaceType_GetNumCameras(&camera->globalCtx->colCtx, floorPoly, bgId);
return SurfaceType_GetCamPosData(&camera->globalCtx->colCtx, floorPoly, bgId);
*dataCnt = SurfaceType_GetNumCameras(&camera->play->colCtx, floorPoly, bgId);
return SurfaceType_GetCamPosData(&camera->play->colCtx, floorPoly, bgId);
}
/**
@ -515,7 +515,7 @@ s32 Camera_GetWaterBoxDataIdx(Camera* camera, f32* waterY) {
Actor_GetWorldPosShapeRot(&playerPosShape, &camera->player->actor);
*waterY = playerPosShape.pos.y;
if (!WaterBox_GetSurface1(camera->globalCtx, &camera->globalCtx->colCtx, playerPosShape.pos.x, playerPosShape.pos.z,
if (!WaterBox_GetSurface1(camera->play, &camera->play->colCtx, playerPosShape.pos.x, playerPosShape.pos.z,
waterY, &waterBox)) {
// player's position is not in a water box.
*waterY = BGCHECK_Y_MIN;
@ -528,8 +528,8 @@ s32 Camera_GetWaterBoxDataIdx(Camera* camera, f32* waterY) {
return -1;
}
ret = WaterBox_GetCamDataIndex(&camera->globalCtx->colCtx, waterBox);
if ((ret <= 0) || (WaterBox_GetCameraSType(&camera->globalCtx->colCtx, waterBox) <= 0)) {
ret = WaterBox_GetCamDataIndex(&camera->play->colCtx, waterBox);
if ((ret <= 0) || (WaterBox_GetCameraSType(&camera->play->colCtx, waterBox) <= 0)) {
// no camera data idx, or no CameraSettingType
return -2;
}
@ -550,7 +550,7 @@ f32 Camera_GetWaterSurface(Camera* camera, Vec3f* chkPos, s32* envProp) {
Actor_GetWorldPosShapeRot(&playerPosRot, &camera->player->actor);
waterY = playerPosRot.pos.y;
if (!WaterBox_GetSurface1(camera->globalCtx, &camera->globalCtx->colCtx, chkPos->x, chkPos->z, &waterY,
if (!WaterBox_GetSurface1(camera->play, &camera->play->colCtx, chkPos->x, chkPos->z, &waterY,
&waterBox)) {
// chkPos is not within the x/z boundaries of a water box.
return BGCHECK_Y_MIN;
@ -562,7 +562,7 @@ f32 Camera_GetWaterSurface(Camera* camera, Vec3f* chkPos, s32* envProp) {
return BGCHECK_Y_MIN;
}
*envProp = WaterBox_GetLightSettingIndex(&camera->globalCtx->colCtx, waterBox);
*envProp = WaterBox_GetLightSettingIndex(&camera->play->colCtx, waterBox);
return waterY;
}
@ -604,7 +604,7 @@ s16 func_80044ADC(Camera* camera, s16 yaw, s16 arg2) {
rotatedPos.x = playerPos.x + (sp30 * sinYaw);
rotatedPos.y = playerPos.y;
rotatedPos.z = playerPos.z + (sp30 * cosYaw);
if (arg2 || (camera->globalCtx->state.frames % 2) == 0) {
if (arg2 || (camera->play->state.frames % 2) == 0) {
D_8015CE58.pos.x = playerPos.x + (sp2C * sinYaw);
D_8015CE58.pos.y = playerPos.y;
D_8015CE58.pos.z = playerPos.z + (sp2C * cosYaw);
@ -1419,17 +1419,17 @@ s32 SetCameraManual(Camera* camera) {
f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f;
f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f;
if ((fabsf(newCamX) >= 15.0f || fabsf(newCamY) >= 15.0f) && camera->globalCtx->manualCamera == false) {
camera->globalCtx->manualCamera = true;
if ((fabsf(newCamX) >= 15.0f || fabsf(newCamY) >= 15.0f) && camera->play->manualCamera == false) {
camera->play->manualCamera = true;
VecSph eyeAdjustment;
OLib_Vec3fDiffToVecSphGeo(&eyeAdjustment, &camera->at, &camera->eye);
camera->globalCtx->camX = eyeAdjustment.yaw;
camera->globalCtx->camY = eyeAdjustment.pitch;
camera->play->camX = eyeAdjustment.yaw;
camera->play->camY = eyeAdjustment.pitch;
}
if (camera->globalCtx->manualCamera) {
if (camera->play->manualCamera) {
return 1;
}
@ -1458,8 +1458,8 @@ s32 Camera_Free(Camera* camera) {
if (RELOAD_PARAMS) {
OLib_Vec3fDiffToVecSphGeo(&spA8, &camera->at, &camera->eye);
camera->globalCtx->camX = spA8.yaw;
camera->globalCtx->camY = spA8.pitch;
camera->play->camX = spA8.yaw;
camera->play->camY = spA8.pitch;
CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values;
f32 yNormal = (1.0f + PCT(OREG(46))) - (PCT(OREG(46)) * (68.0f / playerHeight));
@ -1488,22 +1488,22 @@ s32 Camera_Free(Camera* camera) {
f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f * (CVar_GetFloat("gCameraSensitivity", 1.0f));
f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f * (CVar_GetFloat("gCameraSensitivity", 1.0f));
camera->globalCtx->camX += newCamX * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1);
camera->globalCtx->camY += newCamY * (CVar_GetS32("gInvertYAxis", 1) ? 1 : -1);
camera->play->camX += newCamX * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1);
camera->play->camY += newCamY * (CVar_GetS32("gInvertYAxis", 1) ? 1 : -1);
if (camera->globalCtx->camY > 0x32A4) {
camera->globalCtx->camY = 0x32A4;
if (camera->play->camY > 0x32A4) {
camera->play->camY = 0x32A4;
}
if (camera->globalCtx->camY < -0x228C) {
camera->globalCtx->camY = -0x228C;
if (camera->play->camY < -0x228C) {
camera->play->camY = -0x228C;
}
camera->dist = Camera_LERPCeilF(para1->distTarget, camera->dist, 1.0f / camera->rUpdateRateInv, 0.0f);
OLib_Vec3fDiffToVecSphGeo(&spA8, at, eyeNext);
spA8.r = camera->dist;
spA8.yaw = camera->globalCtx->camX;
spA8.pitch = camera->globalCtx->camY;
spA8.yaw = camera->play->camX;
spA8.pitch = camera->play->camY;
Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spA8);
if (camera->status == CAM_STAT_ACTIVE) {
@ -1733,7 +1733,7 @@ s32 Camera_Normal1(Camera* camera) {
// crit wiggle
if(!CVar_GetS32("gDisableCritWiggle",0)) {
if (gSaveContext.health <= 16 && ((camera->globalCtx->state.frames % 256) == 0)) {
if (gSaveContext.health <= 16 && ((camera->play->state.frames % 256) == 0)) {
wiggleAdj = Rand_ZeroOne() * 10000.0f;
camera->inputDir.y = wiggleAdj + camera->inputDir.y;
}
@ -1903,7 +1903,7 @@ s32 Camera_Normal2(Camera* camera) {
if (camera->status == CAM_STAT_ACTIVE) {
bgChk.pos = *eyeNext;
if (!camera->globalCtx->envCtx.skyboxDisabled || norm2->interfaceFlags & 0x10) {
if (!camera->play->envCtx.skyboxDisabled || norm2->interfaceFlags & 0x10) {
Camera_BGCheckInfo(camera, at, &bgChk);
*eye = bgChk.pos;
} else {
@ -2123,7 +2123,7 @@ s32 Camera_Parallel1(Camera* camera) {
OLib_Vec3fDiffToVecSphGeo(&atToEyeDir, at, eye);
OLib_Vec3fDiffToVecSphGeo(&atToEyeNextDir, at, eyeNext);
camera->globalCtx->manualCamera = false;
camera->play->manualCamera = false;
switch (camera->animState) {
case 0:
@ -2241,7 +2241,7 @@ s32 Camera_Parallel1(Camera* camera) {
Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spA8);
if (camera->status == CAM_STAT_ACTIVE) {
sp6C.pos = *eyeNext;
if (!camera->globalCtx->envCtx.skyboxDisabled || para1->interfaceFlags & 0x10) {
if (!camera->play->envCtx.skyboxDisabled || para1->interfaceFlags & 0x10) {
Camera_BGCheckInfo(camera, at, &sp6C);
*eye = sp6C.pos;
} else {
@ -3051,7 +3051,7 @@ s32 Camera_Battle1(Camera* camera) {
Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spB4);
spBC.pos = *eyeNext;
if (camera->status == CAM_STAT_ACTIVE) {
if (!camera->globalCtx->envCtx.skyboxDisabled || batt1->flags & 1) {
if (!camera->play->envCtx.skyboxDisabled || batt1->flags & 1) {
Camera_BGCheckInfo(camera, at, &spBC);
} else if (batt1->flags & 2) {
func_80043F94(camera, at, &spBC);
@ -3382,7 +3382,7 @@ s32 Camera_KeepOn1(Camera* camera) {
Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spD8);
sp8C.pos = *eyeNext;
if (camera->status == CAM_STAT_ACTIVE) {
if (!camera->globalCtx->envCtx.skyboxDisabled || keep1->interfaceFlags & 1) {
if (!camera->play->envCtx.skyboxDisabled || keep1->interfaceFlags & 1) {
Camera_BGCheckInfo(camera, at, &sp8C);
} else if (keep1->interfaceFlags & 2) {
func_80043F94(camera, at, &sp8C);
@ -3448,9 +3448,9 @@ s32 Camera_KeepOn3(Camera* camera) {
return 1;
}
if (camera->animState == 0 || camera->animState == 0xA || camera->animState == 0x14) {
if (camera->globalCtx->view.unk_124 == 0) {
if (camera->play->view.unk_124 == 0) {
camera->unk_14C |= 0x20;
camera->globalCtx->view.unk_124 = camera->thisIdx | 0x50;
camera->play->view.unk_124 = camera->thisIdx | 0x50;
return 1;
}
camera->unk_14C &= ~0x20;
@ -3538,7 +3538,7 @@ s32 Camera_KeepOn3(Camera* camera) {
Camera_Vec3fVecSphGeoAdd(&lineChkPointB, &anim->atTarget, &atToEyeAdj);
if (!(keep3->flags & 0x80)) {
while (i < angleCnt) {
if (!CollisionCheck_LineOCCheck(camera->globalCtx, &camera->globalCtx->colChkCtx, &anim->atTarget,
if (!CollisionCheck_LineOCCheck(camera->play, &camera->play->colChkCtx, &anim->atTarget,
&lineChkPointB, colChkActors, 2) &&
!Camera_BGCheck(camera, &anim->atTarget, &lineChkPointB)) {
break;
@ -3622,15 +3622,15 @@ s32 Camera_KeepOn4(Camera* camera) {
KeepOn4_Unk20* unk20 = &keep4->unk_20;
s32 pad;
f32 playerHeight;
Player* player = GET_PLAYER(camera->globalCtx);
Player* player = GET_PLAYER(camera->play);
s16 angleCnt;
s32 i;
if (camera->animState == 0 || camera->animState == 0xA || camera->animState == 0x14) {
if (camera->globalCtx->view.unk_124 == 0) {
if (camera->play->view.unk_124 == 0) {
camera->unk_14C |= 0x20;
camera->unk_14C &= ~(0x4 | 0x2);
camera->globalCtx->view.unk_124 = camera->thisIdx | 0x50;
camera->play->view.unk_124 = camera->thisIdx | 0x50;
return 1;
}
unk20->unk_14 = *temp_s0;
@ -3643,7 +3643,7 @@ s32 Camera_KeepOn4(Camera* camera) {
camera->animState = 0x14;
camera->unk_14C |= 0x20;
camera->unk_14C &= ~(0x4 | 0x2);
camera->globalCtx->view.unk_124 = camera->thisIdx | 0x50;
camera->play->view.unk_124 = camera->thisIdx | 0x50;
return 1;
}
@ -3761,7 +3761,7 @@ s32 Camera_KeepOn4(Camera* camera) {
OLib_Vec3fDiffToVecSphGeo(&spA8, at, eyeNext);
D_8015BD50 = playerPosRot->pos;
D_8015BD50.y += playerHeight;
temp_f0_2 = BgCheck_CameraRaycastFloor2(&camera->globalCtx->colCtx, &spC0, &i, &D_8015BD50);
temp_f0_2 = BgCheck_CameraRaycastFloor2(&camera->play->colCtx, &spC0, &i, &D_8015BD50);
if (temp_f0_2 > (keep4->unk_00 + D_8015BD50.y)) {
D_8015BD50.y = temp_f0_2 + 10.0f;
} else {
@ -3821,7 +3821,7 @@ s32 Camera_KeepOn4(Camera* camera) {
if (!(keep4->unk_1C & 1)) {
angleCnt = ARRAY_COUNT(D_8011D3B0);
for (i = 0; i < angleCnt; i++) {
if (!CollisionCheck_LineOCCheck(camera->globalCtx, &camera->globalCtx->colChkCtx, &D_8015BD50,
if (!CollisionCheck_LineOCCheck(camera->play, &camera->play->colChkCtx, &D_8015BD50,
&D_8015BD70, spCC, sp9C) &&
!Camera_BGCheck(camera, &D_8015BD50, &D_8015BD70)) {
break;
@ -4303,8 +4303,8 @@ s32 Camera_Subj3(Camera* camera) {
Actor_GetFocus(&sp60, &camera->player->actor);
playerHeight = Player_GetHeight(camera->player);
if (camera->globalCtx->view.unk_124 == 0) {
camera->globalCtx->view.unk_124 = camera->thisIdx | 0x50;
if (camera->play->view.unk_124 == 0) {
camera->play->view.unk_124 = camera->thisIdx | 0x50;
return true;
}
@ -4364,7 +4364,7 @@ s32 Camera_Subj3(Camera* camera) {
*eye = *eyeNext;
anim->animTimer--;
if (!camera->globalCtx->envCtx.skyboxDisabled) {
if (!camera->play->envCtx.skyboxDisabled) {
Camera_BGCheck(camera, at, eye);
} else {
func_80044340(camera, at, eye);
@ -4430,8 +4430,8 @@ s32 Camera_Subj4(Camera* camera) {
Camera_CopyPREGToModeValues(camera);
}
if (camera->globalCtx->view.unk_124 == 0) {
camera->globalCtx->view.unk_124 = (camera->thisIdx | 0x50);
if (camera->play->view.unk_124 == 0) {
camera->play->view.unk_124 = (camera->thisIdx | 0x50);
anim->unk_24 = camera->xzSpeed;
return true;
}
@ -5223,11 +5223,11 @@ s32 Camera_Unique9(Camera* camera) {
} else if ((anim->curKeyFrame->unk_01 & 0xF0) == 0xC0) {
Camera_UpdateInterface(0xF000 | ((anim->curKeyFrame->unk_01 & 0xF) << 8));
} else if (camera->player->stateFlags1 & 0x8000000 && player->currentBoots != PLAYER_BOOTS_IRON) {
func_8002DF38(camera->globalCtx, camera->target, 8);
func_8002DF38(camera->play, camera->target, 8);
osSyncPrintf("camera: demo: player demo set WAIT\n");
} else {
osSyncPrintf("camera: demo: player demo set %d\n", anim->curKeyFrame->unk_01);
func_8002DF38(camera->globalCtx, camera->target, anim->curKeyFrame->unk_01);
func_8002DF38(camera->play, camera->target, anim->curKeyFrame->unk_01);
}
}
} else {
@ -5246,9 +5246,9 @@ s32 Camera_Unique9(Camera* camera) {
anim->atTarget = anim->curKeyFrame->atTargetInit;
} else if (atInitFlags == 2) {
if (anim->isNewKeyFrame) {
anim->atTarget.x = camera->globalCtx->view.lookAt.x + anim->curKeyFrame->atTargetInit.x;
anim->atTarget.y = camera->globalCtx->view.lookAt.y + anim->curKeyFrame->atTargetInit.y;
anim->atTarget.z = camera->globalCtx->view.lookAt.z + anim->curKeyFrame->atTargetInit.z;
anim->atTarget.x = camera->play->view.lookAt.x + anim->curKeyFrame->atTargetInit.x;
anim->atTarget.y = camera->play->view.lookAt.y + anim->curKeyFrame->atTargetInit.y;
anim->atTarget.z = camera->play->view.lookAt.z + anim->curKeyFrame->atTargetInit.z;
}
} else if (atInitFlags == 3) {
if (anim->isNewKeyFrame) {
@ -5328,9 +5328,9 @@ s32 Camera_Unique9(Camera* camera) {
anim->eyeTarget = anim->curKeyFrame->eyeTargetInit;
} else if (eyeInitFlags == 0x200) {
if (anim->isNewKeyFrame) {
anim->eyeTarget.x = camera->globalCtx->view.eye.x + anim->curKeyFrame->eyeTargetInit.x;
anim->eyeTarget.y = camera->globalCtx->view.eye.y + anim->curKeyFrame->eyeTargetInit.y;
anim->eyeTarget.z = camera->globalCtx->view.eye.z + anim->curKeyFrame->eyeTargetInit.z;
anim->eyeTarget.x = camera->play->view.eye.x + anim->curKeyFrame->eyeTargetInit.x;
anim->eyeTarget.y = camera->play->view.eye.y + anim->curKeyFrame->eyeTargetInit.y;
anim->eyeTarget.z = camera->play->view.eye.z + anim->curKeyFrame->eyeTargetInit.z;
}
} else if (eyeInitFlags == 0x300) {
if (anim->isNewKeyFrame) {
@ -5417,7 +5417,7 @@ s32 Camera_Unique9(Camera* camera) {
}
if (anim->curKeyFrame->initFlags == 2) {
anim->fovTarget = camera->globalCtx->view.fovy;
anim->fovTarget = camera->play->view.fovy;
anim->rollTarget = 0;
} else if (anim->curKeyFrame->initFlags == 0) {
anim->fovTarget = camera->fov;
@ -5571,12 +5571,12 @@ s32 Camera_Unique9(Camera* camera) {
// Change the parent camera (or default)'s mode to normal
s32 camIdx = camera->parentCamIdx <= SUBCAM_NONE ? MAIN_CAM : camera->parentCamIdx;
Camera_ChangeModeFlags(camera->globalCtx->cameraPtrs[camIdx], CAM_MODE_NORMAL, 1);
Camera_ChangeModeFlags(camera->play->cameraPtrs[camIdx], CAM_MODE_NORMAL, 1);
}
case 18: {
// copy the current camera to the parent (or default)'s camera.
s32 camIdx = camera->parentCamIdx <= SUBCAM_NONE ? MAIN_CAM : camera->parentCamIdx;
Camera* cam = camera->globalCtx->cameraPtrs[camIdx];
Camera* cam = camera->play->cameraPtrs[camIdx];
*eye = *eyeNext;
Camera_Copy(cam, camera);
@ -5698,7 +5698,7 @@ s32 Camera_Demo1(Camera* camera) {
camera->animState++;
// "absolute" : "relative"
osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: spline demo: start %s \n",
camera->globalCtx->state.frames, *relativeToPlayer == 0 ? "絶対" : "相対");
camera->play->state.frames, *relativeToPlayer == 0 ? "絶対" : "相対");
if (PREG(93)) {
Camera_DebugPrintSplineArray("CENTER", 5, csAtPoints);
@ -5794,7 +5794,7 @@ s32 Camera_Demo3(Camera* camera) {
sp68.x = anim->initialAt.x + (Math_SinS(angle) * 40.0f);
sp68.y = anim->initialAt.y + 40.0f;
sp68.z = anim->initialAt.z + (Math_CosS(angle) * 40.0f);
if (camera->globalCtx->state.frames & 1) {
if (camera->play->state.frames & 1) {
angle -= 0x3FFF;
anim->yawDir = 1;
} else {
@ -5991,7 +5991,7 @@ s32 Camera_Demo5(Camera* camera) {
Actor_GetFocus(&camera->targetPosRot, camera->target);
OLib_Vec3fDiffToVecSphGeo(&playerTargetGeo, &camera->targetPosRot.pos, &camera->playerPosRot.pos);
D_8011D3AC = camera->target->category;
Actor_GetScreenPos(camera->globalCtx, camera->target, &sp78.yaw, &sp78.pitch);
Actor_GetScreenPos(camera->play, camera->target, &sp78.yaw, &sp78.pitch);
eyeTargetDist = OLib_Vec3fDist(&camera->targetPosRot.pos, &camera->eye);
OLib_Vec3fDiffToVecSphGeo(&eyePlayerGeo, &playerhead.pos, &camera->eyeNext);
sp4A = eyePlayerGeo.yaw - playerTargetGeo.yaw;
@ -6087,7 +6087,7 @@ s32 Camera_Demo5(Camera* camera) {
// the target is a door.
D_8011D954[0].timerInit = camera->timer - 5;
sp4A = 0;
if (!func_800C0D34(camera->globalCtx, camera->target, &sp4A)) {
if (!func_800C0D34(camera->play, camera->target, &sp4A)) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "camera: attention demo: this door is dummy door!\n" VT_RST);
if (ABS(playerTargetGeo.yaw - camera->target->shape.rot.y) >= 0x4000) {
sp4A = camera->target->shape.rot.y;
@ -6140,7 +6140,7 @@ s32 Camera_Demo5(Camera* camera) {
ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D9F4;
ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D9F4);
if (camera->parentCamIdx != MAIN_CAM) {
if (camera->globalCtx->state.frames & 1) {
if (camera->play->state.frames & 1) {
D_8011D9F4[0].rollTargetInit = -D_8011D9F4[0].rollTargetInit;
D_8011D9F4[1].rollTargetInit = -D_8011D9F4[1].rollTargetInit;
}
@ -6151,12 +6151,12 @@ s32 Camera_Demo5(Camera* camera) {
}
}
pad = sDemo5PrevSfxFrame - camera->globalCtx->state.frames;
pad = sDemo5PrevSfxFrame - camera->play->state.frames;
if ((pad >= 0x33) || (pad < -0x32)) {
func_80078884(camera->data1);
}
sDemo5PrevSfxFrame = camera->globalCtx->state.frames;
sDemo5PrevSfxFrame = camera->play->state.frames;
if (camera->player->stateFlags1 & 0x8000000 && (player->currentBoots != PLAYER_BOOTS_IRON)) {
// swimming, and not iron boots
@ -6166,21 +6166,21 @@ s32 Camera_Demo5(Camera* camera) {
} else {
sp4A = playerhead.rot.y - playerTargetGeo.yaw;
if (camera->target->category == ACTORCAT_PLAYER) {
pad = camera->globalCtx->state.frames - sDemo5PrevAction12Frame;
pad = camera->play->state.frames - sDemo5PrevAction12Frame;
if (player->stateFlags1 & 0x800) {
// holding object over head.
func_8002DF54(camera->globalCtx, camera->target, 8);
func_8002DF54(camera->play, camera->target, 8);
} else if (ABS(pad) > 3000) {
func_8002DF54(camera->globalCtx, camera->target, 12);
func_8002DF54(camera->play, camera->target, 12);
} else {
func_8002DF54(camera->globalCtx, camera->target, 69);
func_8002DF54(camera->play, camera->target, 69);
}
} else {
func_8002DF54(camera->globalCtx, camera->target, 1);
func_8002DF54(camera->play, camera->target, 1);
}
}
sDemo5PrevAction12Frame = camera->globalCtx->state.frames;
sDemo5PrevAction12Frame = camera->play->state.frames;
Camera_ChangeSettingFlags(camera, CAM_SET_CS_C, (4 | 1));
Camera_Unique9(camera);
return true;
@ -6201,7 +6201,7 @@ s32 Camera_Demo6(Camera* camera) {
s16 stateTimers[4];
Vec3f* at = &camera->at;
mainCam = Gameplay_GetCamera(camera->globalCtx, MAIN_CAM);
mainCam = Play_GetCamera(camera->play, MAIN_CAM);
camFocus = camera->target;
stateTimers[1] = 0x37;
stateTimers[2] = 0x46;
@ -6235,7 +6235,7 @@ s32 Camera_Demo6(Camera* camera) {
camera->animState++;
case 1:
if (stateTimers[camera->animState] < anim->animTimer) {
func_8002DF54(camera->globalCtx, &camera->player->actor, 8);
func_8002DF54(camera->play, &camera->player->actor, 8);
Actor_GetWorld(&focusPosRot, camFocus);
anim->atTarget.x = focusPosRot.pos.x;
anim->atTarget.y = focusPosRot.pos.y - 20.0f;
@ -6306,7 +6306,7 @@ s32 Camera_Demo9(Camera* camera) {
f32* camFOV = &camera->fov;
Demo9Anim* anim = &demo9->anim;
mainCam = Gameplay_GetCamera(camera->globalCtx, MAIN_CAM);
mainCam = Play_GetCamera(camera->play, MAIN_CAM);
mainCamPlayerPosRot = &mainCam->playerPosRot;
if (RELOAD_PARAMS) {
values = sCameraSettings[camera->setting].cameraModes[camera->mode].values;
@ -6397,7 +6397,7 @@ s32 Camera_Demo9(Camera* camera) {
// finish action = 0x2000, run OnePointCs 0x3FC (Dramatic Return to Link)
onePointTimer =
demo9OnePoint->onePointCs.initTimer < 50 ? 5 : demo9OnePoint->onePointCs.initTimer / 5;
OnePointCutscene_Init(camera->globalCtx, 1020, onePointTimer, NULL, camera->parentCamIdx);
OnePointCutscene_Init(camera->play, 1020, onePointTimer, NULL, camera->parentCamIdx);
}
} else {
// finish action = 0x1000, copy the current camera's values to the
@ -6616,7 +6616,7 @@ s32 Camera_Special7(Camera* camera) {
yOffset = Player_GetHeight(camera->player);
if (camera->animState == 0) {
if (camera->globalCtx->sceneNum == SCENE_JYASINZOU) {
if (camera->play->sceneNum == SCENE_JYASINZOU) {
// Spirit Temple
spec7->idx = 3;
} else if (playerPosRot->pos.x < 1500.0f) {
@ -6838,7 +6838,7 @@ s32 Camera_Special9(Camera* camera) {
// 0xE38 ~ 20 degrees
eyeAdjustment.pitch = 0xE38;
// 0xAAA ~ 15 degrees.
yaw = 0xAAA * ((camera->globalCtx->state.frames & 1) ? 1 : -1);
yaw = 0xAAA * ((camera->play->state.frames & 1) ? 1 : -1);
eyeAdjustment.yaw = anim->targetYaw + yaw;
eyeAdjustment.r = 200.0f * yNormal;
Camera_Vec3fVecSphGeoAdd(eyeNext, at, &eyeAdjustment);
@ -6909,12 +6909,12 @@ s32 Camera_Special9(Camera* camera) {
return true;
}
Camera* Camera_Create(View* view, CollisionContext* colCtx, GlobalContext* globalCtx) {
Camera* Camera_Create(View* view, CollisionContext* colCtx, PlayState* play) {
Camera* newCamera = ZELDA_ARENA_MALLOC_DEBUG(sizeof(*newCamera));
if (newCamera != NULL) {
osSyncPrintf(VT_FGCOL(BLUE) "camera: create --- allocate %d byte" VT_RST "\n", sizeof(*newCamera) * 4);
Camera_Init(newCamera, view, colCtx, globalCtx);
Camera_Init(newCamera, view, colCtx, play);
} else {
osSyncPrintf(VT_COL(RED, WHITE) "camera: create: not enough memory\n" VT_RST);
}
@ -6930,7 +6930,7 @@ void Camera_Destroy(Camera* camera) {
}
}
void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalContext* globalCtx) {
void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState* play) {
Camera* camP;
s32 i;
s16 curUID;
@ -6950,7 +6950,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalCon
sInitRegs = false;
PREG(88) = -1;
}
camera->globalCtx = D_8015BD7C = globalCtx;
camera->play = D_8015BD7C = play;
DbCamera_Init(&D_8015BD80, camera);
curUID = sNextUID;
sNextUID++;
@ -6960,7 +6960,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalCon
}
for (j = 0; j < NUM_CAMS; j++) {
camP = camera->globalCtx->cameraPtrs[j];
camP = camera->play->cameraPtrs[j];
if (camP != NULL && curUID == camP->uid) {
break;
}
@ -7009,11 +7009,11 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalCon
}
void func_80057FC4(Camera* camera) {
if (camera != &camera->globalCtx->mainCamera) {
if (camera != &camera->play->mainCamera) {
camera->prevSetting = camera->setting = CAM_SET_FREE0;
camera->unk_14C &= ~0x4;
} else if (camera->globalCtx->roomCtx.curRoom.meshHeader->base.type != 1) {
switch (camera->globalCtx->roomCtx.curRoom.behaviorType1) {
} else if (camera->play->roomCtx.curRoom.meshHeader->base.type != 1) {
switch (camera->play->roomCtx.curRoom.behaviorType1) {
case ROOM_BEHAVIOR_TYPE1_1:
Camera_ChangeDoorCam(camera, NULL, -99, 0, 0, 18, 10);
camera->prevSetting = camera->setting = CAM_SET_DUNGEON0;
@ -7025,7 +7025,7 @@ void func_80057FC4(Camera* camera) {
break;
default:
osSyncPrintf("camera: room type: default set etc (%d)\n",
camera->globalCtx->roomCtx.curRoom.behaviorType1);
camera->play->roomCtx.curRoom.behaviorType1);
Camera_ChangeDoorCam(camera, NULL, -99, 0, 0, 18, 10);
camera->prevSetting = camera->setting = CAM_SET_NORMAL0;
camera->unk_14C |= 4;
@ -7088,7 +7088,7 @@ void Camera_InitPlayerSettings(Camera* camera, Player* player) {
camera->waterPrevCamSetting = -1;
camera->unk_14C |= 4;
if (camera == &camera->globalCtx->mainCamera) {
if (camera == &camera->play->mainCamera) {
sCameraInterfaceFlags = 0xB200;
} else {
sCameraInterfaceFlags = 0;
@ -7142,13 +7142,13 @@ void Camera_PrintSettings(Camera* camera) {
char sp48[8];
s32 i;
if ((OREG(0) & 1) && (camera->globalCtx->activeCamera == camera->thisIdx) && !gDbgCamEnabled) {
if ((OREG(0) & 1) && (camera->play->activeCamera == camera->thisIdx) && !gDbgCamEnabled) {
for (i = 0; i < NUM_CAMS; i++) {
if (camera->globalCtx->cameraPtrs[i] == NULL) {
if (camera->play->cameraPtrs[i] == NULL) {
sp58[i] = '-';
sp48[i] = ' ';
} else {
switch (camera->globalCtx->cameraPtrs[i]->status) {
switch (camera->play->cameraPtrs[i]->status) {
case 0:
sp58[i] = 'c';
break;
@ -7174,7 +7174,7 @@ void Camera_PrintSettings(Camera* camera) {
sp58[i] = '\0';
sp48[i] = '\0';
sp48[camera->globalCtx->activeCamera] = 'a';
sp48[camera->play->activeCamera] = 'a';
func_8006376C(3, 0x16, 5, sp58);
func_8006376C(3, 0x16, 1, sp48);
func_8006376C(3, 0x17, 5, "S:");
@ -7288,7 +7288,7 @@ s32 Camera_UpdateWater(Camera* camera) {
if (!(camera->unk_14C & 0x100)) {
camera->unk_14C |= 0x100;
osSyncPrintf("kankyo changed water, sound on\n");
Environment_EnableUnderwaterLights(camera->globalCtx, waterLightsIndex);
Environment_EnableUnderwaterLights(camera->play, waterLightsIndex);
camera->waterDistortionTimer = 80;
}
@ -7311,7 +7311,7 @@ s32 Camera_UpdateWater(Camera* camera) {
if (camera->waterDistortionTimer > 0) {
camera->waterDistortionTimer--;
camera->distortionFlags |= DISTORTION_UNDERWATER_STRONG;
} else if (camera->globalCtx->sceneNum == SCENE_TURIBORI) {
} else if (camera->play->sceneNum == SCENE_TURIBORI) {
camera->distortionFlags |= DISTORTION_UNDERWATER_FISHING;
} else {
camera->distortionFlags |= DISTORTION_UNDERWATER_WEAK;
@ -7320,7 +7320,7 @@ s32 Camera_UpdateWater(Camera* camera) {
if (camera->unk_14C & 0x100) {
camera->unk_14C &= ~0x100;
osSyncPrintf("kankyo changed water off, sound off\n");
Environment_DisableUnderwaterLights(camera->globalCtx);
Environment_DisableUnderwaterLights(camera->play);
if (*quakeId != 0) {
Quake_RemoveFromIdx(*quakeId);
}
@ -7334,7 +7334,7 @@ s32 Camera_UpdateWater(Camera* camera) {
s32 Camera_UpdateHotRoom(Camera* camera) {
camera->distortionFlags &= ~DISTORTION_HOT_ROOM;
if (camera->globalCtx->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) {
if (camera->play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) {
camera->distortionFlags |= DISTORTION_HOT_ROOM;
}
@ -7344,7 +7344,7 @@ s32 Camera_UpdateHotRoom(Camera* camera) {
s32 Camera_DbgChangeMode(Camera* camera) {
s32 changeDir = 0;
if (!gDbgCamEnabled && camera->globalCtx->activeCamera == MAIN_CAM) {
if (!gDbgCamEnabled && camera->play->activeCamera == MAIN_CAM) {
if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_CUP)) {
osSyncPrintf("attention sound URGENCY\n");
func_80078884(NA_SE_SY_ATTENTION_URGENCY);
@ -7440,17 +7440,17 @@ void Camera_UpdateDistortion(Camera* camera) {
depthPhase += DEGF_TO_BINANG(depthPhaseStep);
screenPlanePhase += DEGF_TO_BINANG(screenPlanePhaseStep);
View_SetDistortionOrientation(&camera->globalCtx->view, Math_CosS(depthPhase) * 0.0f, Math_SinS(depthPhase) * 0.0f,
View_SetDistortionOrientation(&camera->play->view, Math_CosS(depthPhase) * 0.0f, Math_SinS(depthPhase) * 0.0f,
Math_SinS(screenPlanePhase) * 0.0f);
View_SetDistortionScale(&camera->globalCtx->view, Math_SinS(screenPlanePhase) * (xScale * scaleFactor) + 1.0f,
View_SetDistortionScale(&camera->play->view, Math_SinS(screenPlanePhase) * (xScale * scaleFactor) + 1.0f,
Math_CosS(screenPlanePhase) * (yScale * scaleFactor) + 1.0f,
Math_CosS(depthPhase) * (zScale * scaleFactor) + 1.0f);
View_SetDistortionSpeed(&camera->globalCtx->view, speed * speedFactor);
View_SetDistortionSpeed(&camera->play->view, speed * speedFactor);
camera->unk_14C |= 0x40;
} else if (camera->unk_14C & 0x40) {
View_ClearDistortion(&camera->globalCtx->view);
View_ClearDistortion(&camera->play->view);
camera->unk_14C &= ~0x40;
}
}
@ -7471,7 +7471,7 @@ Vec3s Camera_Update(Camera* camera) {
QuakeCamCalc quake;
Player* player;
player = camera->globalCtx->cameraPtrs[MAIN_CAM]->player;
player = camera->play->cameraPtrs[MAIN_CAM]->player;
if (R_DBG_CAM_UPDATE) {
osSyncPrintf("camera: in %x\n", camera);
@ -7497,7 +7497,7 @@ Vec3s Camera_Update(Camera* camera) {
spAC = curPlayerPosRot.pos;
spAC.y += Player_GetHeight(camera->player);
playerGroundY = BgCheck_EntityRaycastFloor5(camera->globalCtx, &camera->globalCtx->colCtx, &playerFloorPoly,
playerGroundY = BgCheck_EntityRaycastFloor5(camera->play, &camera->play->colCtx, &playerFloorPoly,
&bgId, &camera->player->actor, &spAC);
if (playerGroundY != BGCHECK_Y_MIN) {
// player is above ground.
@ -7581,10 +7581,10 @@ Vec3s Camera_Update(Camera* camera) {
D_8011D3F0--;
sCameraInterfaceFlags = 0x3200;
Camera_UpdateInterface(sCameraInterfaceFlags);
} else if (camera->globalCtx->transitionMode != 0) {
} else if (camera->play->transitionMode != 0) {
sCameraInterfaceFlags = 0xF200;
Camera_UpdateInterface(sCameraInterfaceFlags);
} else if (camera->globalCtx->csCtx.state != CS_STATE_IDLE) {
} else if (camera->play->csCtx.state != CS_STATE_IDLE) {
sCameraInterfaceFlags = 0x3200;
Camera_UpdateInterface(sCameraInterfaceFlags);
} else {
@ -7593,7 +7593,7 @@ Vec3s Camera_Update(Camera* camera) {
}
if (R_DBG_CAM_UPDATE) {
osSyncPrintf("camera: shrink_and_bitem %x(%d)\n", sCameraInterfaceFlags, camera->globalCtx->transitionMode);
osSyncPrintf("camera: shrink_and_bitem %x(%d)\n", sCameraInterfaceFlags, camera->play->transitionMode);
}
if (R_DBG_CAM_UPDATE) {
@ -7608,16 +7608,16 @@ Vec3s Camera_Update(Camera* camera) {
gDbgCamEnabled ^= 1;
if (gDbgCamEnabled) {
DbgCamera_Enable(&D_8015BD80, camera);
} else if (camera->globalCtx->csCtx.state != CS_STATE_IDLE) {
func_80064534(camera->globalCtx, &camera->globalCtx->csCtx);
} else if (camera->play->csCtx.state != CS_STATE_IDLE) {
func_80064534(camera->play, &camera->play->csCtx);
}
}
// Debug cam update
if (gDbgCamEnabled) {
camera->globalCtx->view.fovy = D_8015BD80.fov;
camera->play->view.fovy = D_8015BD80.fov;
DbCamera_Update(&D_8015BD80, camera);
func_800AA358(&camera->globalCtx->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C);
func_800AA358(&camera->play->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C);
if (R_DBG_CAM_UPDATE) {
osSyncPrintf("camera: debug out\n");
}
@ -7662,13 +7662,13 @@ Vec3s Camera_Update(Camera* camera) {
Camera_UpdateDistortion(camera);
if ((camera->globalCtx->sceneNum == SCENE_SPOT00) && (camera->fov < 59.0f)) {
View_SetScale(&camera->globalCtx->view, 0.79f);
if ((camera->play->sceneNum == SCENE_SPOT00) && (camera->fov < 59.0f)) {
View_SetScale(&camera->play->view, 0.79f);
} else {
View_SetScale(&camera->globalCtx->view, 1.0f);
View_SetScale(&camera->play->view, 1.0f);
}
camera->globalCtx->view.fovy = viewFov;
func_800AA358(&camera->globalCtx->view, &viewEye, &viewAt, &viewUp);
camera->play->view.fovy = viewFov;
func_800AA358(&camera->play->view, &viewEye, &viewAt, &viewUp);
camera->camDir.x = eyeAtAngle.pitch;
camera->camDir.y = eyeAtAngle.yaw;
camera->camDir.z = 0;
@ -7708,18 +7708,18 @@ Vec3s Camera_Update(Camera* camera) {
* When the camera's timer is 0, change the camera to its parent
*/
void Camera_Finish(Camera* camera) {
Camera* mainCam = camera->globalCtx->cameraPtrs[MAIN_CAM];
Player* player = GET_PLAYER(camera->globalCtx);
Camera* mainCam = camera->play->cameraPtrs[MAIN_CAM];
Player* player = GET_PLAYER(camera->play);
if (camera->timer == 0) {
Gameplay_ChangeCameraStatus(camera->globalCtx, camera->parentCamIdx, CAM_STAT_ACTIVE);
Play_ChangeCameraStatus(camera->play, camera->parentCamIdx, CAM_STAT_ACTIVE);
if ((camera->parentCamIdx == MAIN_CAM) && (camera->csId != 0)) {
player->actor.freezeTimer = 0;
player->stateFlags1 &= ~0x20000000;
if (player->csMode != 0) {
func_8002DF54(camera->globalCtx, &player->actor, 7);
func_8002DF54(camera->play, &player->actor, 7);
osSyncPrintf("camera: player demo end!!\n");
}
@ -7740,9 +7740,9 @@ void Camera_Finish(Camera* camera) {
camera->childCamIdx = camera->parentCamIdx = SUBCAM_FREE;
camera->timer = -1;
camera->globalCtx->envCtx.fillScreen = false;
camera->play->envCtx.fillScreen = false;
Gameplay_ClearCamera(camera->globalCtx, camera->thisIdx);
Play_ClearCamera(camera->play, camera->thisIdx);
}
}
@ -7756,7 +7756,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) {
static s32 modeChangeFlags = 0;
if (QREG(89)) {
osSyncPrintf("+=+(%d)+=+ recive request -> %s\n", camera->globalCtx->state.frames, sCameraModeNames[mode]);
osSyncPrintf("+=+(%d)+=+ recive request -> %s\n", camera->play->state.frames, sCameraModeNames[mode]);
}
if (camera->unk_14C & 0x20 && flags == 0) {
@ -7858,7 +7858,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) {
func_80078884(0);
break;
case 2:
if (camera->globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) {
if (camera->play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) {
func_80078884(NA_SE_SY_ATTENTION_URGENCY);
} else {
func_80078884(NA_SE_SY_ATTENTION_ON);
@ -7905,7 +7905,7 @@ s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags) {
}
}
if (((setting == CAM_SET_MEADOW_BIRDS_EYE) || (setting == CAM_SET_MEADOW_UNUSED)) && LINK_IS_ADULT &&
(camera->globalCtx->sceneNum == SCENE_SPOT05)) {
(camera->play->sceneNum == SCENE_SPOT05)) {
camera->unk_14A |= 0x10;
return -5;
}
@ -7951,7 +7951,7 @@ s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags) {
Camera_CopyDataToRegs(camera, camera->mode);
}
osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: change camera[%d] set %s\n", camera->globalCtx->state.frames,
osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: change camera[%d] set %s\n", camera->play->state.frames,
camera->thisIdx, sCameraSettingNames[camera->setting]);
return setting;
@ -8280,9 +8280,9 @@ s32 func_8005B198() {
s16 func_8005B1A4(Camera* camera) {
camera->unk_14C |= 0x8;
if ((camera->thisIdx == MAIN_CAM) && (camera->globalCtx->activeCamera != MAIN_CAM)) {
GET_ACTIVE_CAM(camera->globalCtx)->unk_14C |= 0x8;
return camera->globalCtx->activeCamera;
if ((camera->thisIdx == MAIN_CAM) && (camera->play->activeCamera != MAIN_CAM)) {
GET_ACTIVE_CAM(camera->play)->unk_14C |= 0x8;
return camera->play->activeCamera;
}
return camera->thisIdx;

View File

@ -2398,6 +2398,6 @@ s16 D_8011DAFC[] = {
CAM_SET_NORMAL0, CAM_SET_NORMAL1, CAM_SET_NORMAL2, CAM_SET_DUNGEON0, CAM_SET_DUNGEON1, CAM_SET_DUNGEON2,
};
GlobalContext* D_8015BD7C;
PlayState* D_8015BD7C;
DbCamera D_8015BD80;
CollisionPoly* playerFloorPoly;

View File

@ -1,23 +1,23 @@
#include "global.h"
void Gfx_DrawDListOpa(GlobalContext* globalCtx, Gfx* dlist) {
OPEN_DISPS(globalCtx->state.gfxCtx);
void Gfx_DrawDListOpa(PlayState* play, Gfx* dlist) {
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, dlist);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void Gfx_DrawDListXlu(GlobalContext* globalCtx, Gfx* dlist) {
OPEN_DISPS(globalCtx->state.gfxCtx);
void Gfx_DrawDListXlu(PlayState* play, Gfx* dlist) {
OPEN_DISPS(play->state.gfxCtx);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, dlist);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,19 @@
#include "global.h"
#include <textures/do_action_static/do_action_static.h>
void func_80110990(GlobalContext* globalCtx) {
Map_Destroy(globalCtx);
void func_80110990(PlayState* play) {
Map_Destroy(play);
}
void func_801109B0(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
void func_801109B0(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
u32 parameterSize;
u8 temp;
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
gSaveContext.unk_13E8 = gSaveContext.unk_13EA = 0;
View_Init(&interfaceCtx->view, globalCtx->state.gfxCtx);
View_Init(&interfaceCtx->view, play->state.gfxCtx);
interfaceCtx->unk_1FA = interfaceCtx->unk_261 = interfaceCtx->unk_1FC = 0;
interfaceCtx->unk_1EC = interfaceCtx->unk_1EE = interfaceCtx->unk_1F0 = 0;
@ -33,7 +33,7 @@ void func_801109B0(GlobalContext* globalCtx) {
// "Permanent PARAMETER Segment = %x"
osSyncPrintf("常駐PARAMETERセグメント=%x\n", parameterSize);
interfaceCtx->parameterSegment = GAMESTATE_ALLOC_MC(&globalCtx->state, parameterSize);
interfaceCtx->parameterSegment = GAMESTATE_ALLOC_MC(&play->state, parameterSize);
osSyncPrintf("parameter->parameterSegment=%x\n", interfaceCtx->parameterSegment);
@ -41,7 +41,7 @@ void func_801109B0(GlobalContext* globalCtx) {
DmaMgr_SendRequest1(interfaceCtx->parameterSegment, (uintptr_t)_parameter_staticSegmentRomStart, parameterSize,
__FILE__, 162);
interfaceCtx->doActionSegment = GAMESTATE_ALLOC_MC(&globalCtx->state, 0x480);
interfaceCtx->doActionSegment = GAMESTATE_ALLOC_MC(&play->state, 0x480);
osSyncPrintf("DOアクション テクスチャ初期=%x\n", 0x480); // "DO Action Texture Initialization"
osSyncPrintf("parameter->do_actionSegment=%x\n", interfaceCtx->doActionSegment);
@ -55,7 +55,7 @@ void func_801109B0(GlobalContext* globalCtx) {
memcpy(interfaceCtx->doActionSegment + attackDoActionTexSize, ResourceMgr_LoadTexByName(gReturnDoActionENGTex), ResourceMgr_LoadTexSizeByName(gReturnDoActionENGTex));
interfaceCtx->iconItemSegment = GAMESTATE_ALLOC_MC(
&globalCtx->state, 0x1000 * ARRAY_COUNT(gSaveContext.equips.buttonItems));
&play->state, 0x1000 * ARRAY_COUNT(gSaveContext.equips.buttonItems));
// "Icon Item Texture Initialization = %x"
osSyncPrintf("アイコンアイテム テクスチャ初期=%x\n", 0x4000);
@ -118,8 +118,8 @@ void func_801109B0(GlobalContext* globalCtx) {
osSyncPrintf("PARAMETER領域=%x\n", parameterSize + 0x5300); // "Parameter Area = %x"
HealthMeter_Init(globalCtx);
Map_Init(globalCtx);
HealthMeter_Init(play);
Map_Init(play);
interfaceCtx->unk_23C = interfaceCtx->unk_242 = 0;
@ -136,29 +136,29 @@ void func_801109B0(GlobalContext* globalCtx) {
R_A_BTN_COLOR(2) = 50;
}
void Message_Init(GlobalContext* globalCtx) {
MessageContext* msgCtx = &globalCtx->msgCtx;
void Message_Init(PlayState* play) {
MessageContext* msgCtx = &play->msgCtx;
s32 pad;
Message_SetTables();
globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00;
play->msgCtx.ocarinaMode = OCARINA_MODE_00;
msgCtx->msgMode = MSGMODE_NONE;
msgCtx->msgLength = 0;
msgCtx->textId = msgCtx->textboxEndType = msgCtx->choiceIndex = msgCtx->ocarinaAction = msgCtx->textUnskippable = 0;
msgCtx->textColorAlpha = 255;
View_Init(&msgCtx->view, globalCtx->state.gfxCtx);
View_Init(&msgCtx->view, play->state.gfxCtx);
msgCtx->textboxSegment = GAMESTATE_ALLOC_MC(&globalCtx->state, 0x2200);
msgCtx->textboxSegment = GAMESTATE_ALLOC_MC(&play->state, 0x2200);
osSyncPrintf("message->fukidashiSegment=%x\n", msgCtx->textboxSegment);
osSyncPrintf("吹き出しgame_alloc=%x\n", 0x2200); // "Textbox game_alloc=%x"
ASSERT(msgCtx->textboxSegment != NULL);
Font_LoadOrderedFont(&globalCtx->msgCtx.font);
Font_LoadOrderedFont(&play->msgCtx.font);
YREG(31) = 0;
}
@ -572,6 +572,6 @@ void func_80111070(void) {
VREG(92) = -63;
}
void func_80112098(GlobalContext* globalCtx) {
void func_80112098(PlayState* play) {
func_80111070();
}

View File

@ -6,10 +6,10 @@ typedef struct {
/* 0x04 */ void* drawArg; // segment address (display list or texture) passed to the draw function when called
} DebugDispObjectInfo; // size = 0x8
typedef void (*DebugDispObject_DrawFunc)(DebugDispObject*, void*, GlobalContext*);
typedef void (*DebugDispObject_DrawFunc)(DebugDispObject*, void*, PlayState*);
void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, GlobalContext* globalCtx);
void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, GlobalContext* globalCtx);
void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, PlayState* play);
void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, PlayState* play);
static DebugDispObject_DrawFunc sDebugObjectDrawFuncTable[] = {
DebugDisplay_DrawSpriteI8,
@ -55,43 +55,43 @@ DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX,
return sDebugObjectListHead;
}
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_80094678(globalCtx->state.gfxCtx);
func_80094678(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),
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, gDebugSpriteDL);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx);
void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
func_8009435C(globalCtx->state.gfxCtx);
func_8009435C(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a);
@ -100,9 +100,9 @@ void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, GlobalConte
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),
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, dlist);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}

File diff suppressed because it is too large Load Diff

View File

@ -79,40 +79,40 @@
#include "objects/object_st/object_st.h"
// "Get Item" Model Draw Functions
void GetItem_DrawMaskOrBombchu(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawSoldOut(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawBlueFire(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawPoes(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawFairy(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawMirrorShield(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawSkullToken(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawEggOrMedallion(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawCompass(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawPotion(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawGoronSword(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawDekuNuts(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawRecoveryHeart(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawFish(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawOpa0(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawOpa0Xlu1(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawXlu01(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawOpa10Xlu2(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawMagicArrow(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawMagicSpell(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawOpa1023(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawOpa10Xlu32(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawSmallRupee(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawScale(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawBulletBag(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawWallet(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawJewel(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawJewelKokiri(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawJewelGoron(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawJewelZora(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawGenericMusicNote(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawMaskOrBombchu(PlayState* play, s16 drawId);
void GetItem_DrawSoldOut(PlayState* play, s16 drawId);
void GetItem_DrawBlueFire(PlayState* play, s16 drawId);
void GetItem_DrawPoes(PlayState* play, s16 drawId);
void GetItem_DrawFairy(PlayState* play, s16 drawId);
void GetItem_DrawMirrorShield(PlayState* play, s16 drawId);
void GetItem_DrawSkullToken(PlayState* play, s16 drawId);
void GetItem_DrawEggOrMedallion(PlayState* play, s16 drawId);
void GetItem_DrawCompass(PlayState* play, s16 drawId);
void GetItem_DrawPotion(PlayState* play, s16 drawId);
void GetItem_DrawGoronSword(PlayState* play, s16 drawId);
void GetItem_DrawDekuNuts(PlayState* play, s16 drawId);
void GetItem_DrawRecoveryHeart(PlayState* play, s16 drawId);
void GetItem_DrawFish(PlayState* play, s16 drawId);
void GetItem_DrawOpa0(PlayState* play, s16 drawId);
void GetItem_DrawOpa0Xlu1(PlayState* play, s16 drawId);
void GetItem_DrawXlu01(PlayState* play, s16 drawId);
void GetItem_DrawOpa10Xlu2(PlayState* play, s16 drawId);
void GetItem_DrawMagicArrow(PlayState* play, s16 drawId);
void GetItem_DrawMagicSpell(PlayState* play, s16 drawId);
void GetItem_DrawOpa1023(PlayState* play, s16 drawId);
void GetItem_DrawOpa10Xlu32(PlayState* play, s16 drawId);
void GetItem_DrawSmallRupee(PlayState* play, s16 drawId);
void GetItem_DrawScale(PlayState* play, s16 drawId);
void GetItem_DrawBulletBag(PlayState* play, s16 drawId);
void GetItem_DrawWallet(PlayState* play, s16 drawId);
void GetItem_DrawJewel(PlayState* play, s16 drawId);
void GetItem_DrawJewelKokiri(PlayState* play, s16 drawId);
void GetItem_DrawJewelGoron(PlayState* play, s16 drawId);
void GetItem_DrawJewelZora(PlayState* play, s16 drawId);
void GetItem_DrawGenericMusicNote(PlayState* play, s16 drawId);
typedef struct {
/* 0x00 */ void (*drawFunc)(GlobalContext*, s16);
/* 0x00 */ void (*drawFunc)(PlayState*, s16);
/* 0x04 */ Gfx* dlists[8];
} DrawItemTableEntry; // size = 0x24
@ -391,21 +391,21 @@ DrawItemTableEntry sDrawItemTable[] = {
* Draw "Get Item" Model
* Calls the corresponding draw function for the given draw ID
*/
void GetItem_Draw(GlobalContext* globalCtx, s16 drawId) {
sDrawItemTable[drawId].drawFunc(globalCtx, drawId);
void GetItem_Draw(PlayState* play, s16 drawId) {
sDrawItemTable[drawId].drawFunc(play, drawId);
}
/**
* Draw "Get Item" Model from a `GetItemEntry`
* Uses the Custom Draw Function if it exists, or just calls `GetItem_Draw`
*/
void GetItemEntry_Draw(GlobalContext* globalCtx, GetItemEntry getItemEntry) {
void GetItemEntry_Draw(PlayState* play, GetItemEntry getItemEntry) {
// RANDOTODO: Make this more flexible for easier toggling of individual item recolors in the future.
if (getItemEntry.drawFunc != NULL &&
(CVar_GetS32("gRandoMatchKeyColors", 0) || getItemEntry.getItemId == RG_DOUBLE_DEFENSE)) {
getItemEntry.drawFunc(globalCtx, &getItemEntry);
getItemEntry.drawFunc(play, &getItemEntry);
} else {
GetItem_Draw(globalCtx, getItemEntry.gid);
GetItem_Draw(play, getItemEntry.gid);
}
}
@ -416,7 +416,7 @@ void GetItemEntry_Draw(GlobalContext* globalCtx, GetItemEntry getItemEntry) {
/* 0x017E */ u8 primOpaColor[3];
/* 0x0181 */ u8 envOpaColor[3];
void GetItem_DrawJewelKokiri(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawJewelKokiri(PlayState* play, s16 drawId) {
primXluColor[2] = 160;
primXluColor[0] = 255;
primXluColor[1] = 255;
@ -430,10 +430,10 @@ void GetItem_DrawJewelKokiri(GlobalContext* globalCtx, s16 drawId) {
envOpaColor[0] = 150;
envOpaColor[2] = 0;
GetItem_DrawJewel(globalCtx, drawId);
GetItem_DrawJewel(play, drawId);
}
void GetItem_DrawJewelGoron(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawJewelGoron(PlayState* play, s16 drawId) {
primXluColor[1] = 170;
primXluColor[0] = 255;
primXluColor[2] = 255;
@ -447,10 +447,10 @@ void GetItem_DrawJewelGoron(GlobalContext* globalCtx, s16 drawId) {
envOpaColor[0] = 150;
envOpaColor[2] = 0;
GetItem_DrawJewel(globalCtx, drawId);
GetItem_DrawJewel(play, drawId);
}
void GetItem_DrawJewelZora(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawJewelZora(PlayState* play, s16 drawId) {
primXluColor[0] = 50;
primXluColor[1] = 255;
primXluColor[2] = 255;
@ -464,355 +464,355 @@ void GetItem_DrawJewelZora(GlobalContext* globalCtx, s16 drawId) {
envOpaColor[0] = 150;
envOpaColor[2] = 0;
GetItem_DrawJewel(globalCtx, drawId);
GetItem_DrawJewel(play, drawId);
}
void GetItem_DrawJewel(GlobalContext* globalCtx, s16 drawId) {
OPEN_DISPS(globalCtx->state.gfxCtx);
void GetItem_DrawJewel(PlayState* play, s16 drawId) {
OPEN_DISPS(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 9,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 % 256, (256 - (0 % 256)) - 1, 64, 64, 1, 0 % 256,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 % 256, (256 - (0 % 256)) - 1, 64, 64, 1, 0 % 256,
(256 - (0 % 256)) - 1, 16, 16));
gSPSegment(POLY_OPA_DISP++, 8, Gfx_TexScroll(globalCtx->state.gfxCtx, (u8)0, (u8)0, 16, 16));
gSPSegment(POLY_OPA_DISP++, 8, Gfx_TexScroll(play->state.gfxCtx, (u8)0, (u8)0, 16, 16));
Matrix_Push();
Matrix_RotateZYX(0, -0x4000, 0x4000, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2597),
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2597),
G_MTX_NOPUSH | G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2599),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_demo_effect.c", 2599),
G_MTX_NOPUSH | G_MTX_LOAD);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
// func_8002ED80(&this->actor, globalCtx, 0);
// func_8002ED80(&this->actor, play, 0);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, primXluColor[0], primXluColor[1], primXluColor[2], 255);
gDPSetEnvColor(POLY_XLU_DISP++, envXluColor[0], envXluColor[1], envXluColor[2], 255);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D18(globalCtx->state.gfxCtx);
// func_8002EBCC(&this->actor, globalCtx, 0);
func_80093D18(play->state.gfxCtx);
// func_8002EBCC(&this->actor, play, 0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 128, primOpaColor[0], primOpaColor[1], primOpaColor[2], 255);
gDPSetEnvColor(POLY_OPA_DISP++, envOpaColor[0], envOpaColor[1], envOpaColor[2], 255);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawMaskOrBombchu(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawMaskOrBombchu(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093BA8(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093BA8(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawSoldOut(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawSoldOut(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 5);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawBlueFire(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawBlueFire(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0),
0 * (globalCtx->state.frames * 0), 16, 32, 1, 1 * (globalCtx->state.frames * 1),
1 * -(globalCtx->state.frames * 8), 16, 32));
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0),
0 * (play->state.frames * 0), 16, 32, 1, 1 * (play->state.frames * 1),
1 * -(play->state.frames * 8), 16, 32));
Matrix_Push();
Matrix_Translate(-8.0f, -2.0f, 0.0f, MTXMODE_APPLY);
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
Matrix_ReplaceRotation(&play->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawPoes(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawPoes(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0),
0 * (globalCtx->state.frames * 0), 16, 32, 1, 1 * (globalCtx->state.frames * 1),
1 * -(globalCtx->state.frames * 6), 16, 32));
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0),
0 * (play->state.frames * 0), 16, 32, 1, 1 * (play->state.frames * 1),
1 * -(play->state.frames * 6), 16, 32));
Matrix_Push();
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
Matrix_ReplaceRotation(&play->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawFairy(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawFairy(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0),
0 * (globalCtx->state.frames * 0), 32, 32, 1, 1 * (globalCtx->state.frames * 1),
1 * -(globalCtx->state.frames * 6), 32, 32));
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0),
0 * (play->state.frames * 0), 32, 32, 1, 1 * (play->state.frames * 1),
1 * -(play->state.frames * 6), 32, 32));
Matrix_Push();
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
Matrix_ReplaceRotation(&play->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawMirrorShield(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawMirrorShield(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0) % 256,
1 * (globalCtx->state.frames * 2) % 256, 64, 64, 1,
0 * (globalCtx->state.frames * 0) % 128, 1 * (globalCtx->state.frames * 1) % 128, 32,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0) % 256,
1 * (play->state.frames * 2) % 256, 64, 64, 1,
0 * (play->state.frames * 0) % 128, 1 * (play->state.frames * 1) % 128, 32,
32));
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawSkullToken(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawSkullToken(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0),
1 * -(globalCtx->state.frames * 5), 32, 32, 1, 0 * (globalCtx->state.frames * 0),
0 * (globalCtx->state.frames * 0), 32, 64));
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0),
1 * -(play->state.frames * 5), 32, 32, 1, 0 * (play->state.frames * 0),
0 * (play->state.frames * 0), 32, 64));
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawEggOrMedallion(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawEggOrMedallion(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093BA8(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093BA8(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawCompass(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawCompass(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 5);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawPotion(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawPotion(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -1 * (globalCtx->state.frames * 1),
1 * (globalCtx->state.frames * 1), 32, 32, 1, -1 * (globalCtx->state.frames * 1),
1 * (globalCtx->state.frames * 1), 32, 32));
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
Gfx_TwoTexScroll(play->state.gfxCtx, 0, -1 * (play->state.frames * 1),
1 * (play->state.frames * 1), 32, 32, 1, -1 * (play->state.frames * 1),
1 * (play->state.frames * 1), 32, 32));
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[2]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[3]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[4]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[5]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawGoronSword(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawGoronSword(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 1),
0 * (globalCtx->state.frames * 1), 32, 32, 1, 0 * (globalCtx->state.frames * 1),
0 * (globalCtx->state.frames * 1), 32, 32));
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 1),
0 * (play->state.frames * 1), 32, 32, 1, 0 * (play->state.frames * 1),
0 * (play->state.frames * 1), 32, 32));
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawDekuNuts(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawDekuNuts(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 6),
1 * (globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 6),
1 * (globalCtx->state.frames * 6), 32, 32));
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 6),
1 * (play->state.frames * 6), 32, 32, 1, 1 * (play->state.frames * 6),
1 * (play->state.frames * 6), 32, 32));
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawRecoveryHeart(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawRecoveryHeart(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 1),
1 * -(globalCtx->state.frames * 3), 32, 32, 1, 0 * (globalCtx->state.frames * 1),
1 * -(globalCtx->state.frames * 2), 32, 32));
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 1),
1 * -(play->state.frames * 3), 32, 32, 1, 0 * (play->state.frames * 1),
1 * -(play->state.frames * 2), 32, 32));
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawFish(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawFish(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0),
1 * (globalCtx->state.frames * 1), 32, 32, 1, 0 * (globalCtx->state.frames * 0),
1 * (globalCtx->state.frames * 1), 32, 32));
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0 * (play->state.frames * 0),
1 * (play->state.frames * 1), 32, 32, 1, 0 * (play->state.frames * 0),
1 * (play->state.frames * 1), 32, 32));
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawOpa0(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawOpa0(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawOpa0Xlu1(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawOpa0Xlu1(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawGenericMusicNote(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawGenericMusicNote(PlayState* play, s16 drawId) {
s32 pad;
s16 color_slot = drawId-120; //0 = generic
s16* colors[7][3] = {
@ -825,195 +825,195 @@ void GetItem_DrawGenericMusicNote(GlobalContext* globalCtx, s16 drawId) {
{146,146,146} //Storms
};
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, __FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, __FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD);
gsDPSetGrayscaleColor(POLY_XLU_DISP++, colors[color_slot][0], colors[color_slot][1], colors[color_slot][2], 255);
gsSPGrayscale(POLY_XLU_DISP++, true);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]);
gsSPGrayscale(POLY_XLU_DISP++, false);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawXlu01(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawXlu01(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawOpa10Xlu2(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawOpa10Xlu2(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawMagicArrow(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawMagicArrow(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawMagicSpell(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawMagicSpell(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 2),
1 * -(globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 1),
-1 * (globalCtx->state.frames * 2), 32, 32));
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 2),
1 * -(play->state.frames * 6), 32, 32, 1, 1 * (play->state.frames * 1),
-1 * (play->state.frames * 2), 32, 32));
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawOpa1023(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawOpa1023(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[2]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[3]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawOpa10Xlu32(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawOpa10Xlu32(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawSmallRupee(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawSmallRupee(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
Matrix_Scale(0.7f, 0.7f, 0.7f, MTXMODE_APPLY);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawScale(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawScale(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 2),
-1 * (globalCtx->state.frames * 2), 64, 64, 1, 1 * (globalCtx->state.frames * 4),
1 * -(globalCtx->state.frames * 4), 32, 32));
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 2),
-1 * (play->state.frames * 2), 64, 64, 1, 1 * (play->state.frames * 4),
1 * -(play->state.frames * 4), 32, 32));
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawBulletBag(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawBulletBag(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[4]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void GetItem_DrawWallet(GlobalContext* globalCtx, s16 drawId) {
void GetItem_DrawWallet(PlayState* play, s16 drawId) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[0]);
@ -1024,5 +1024,5 @@ void GetItem_DrawWallet(GlobalContext* globalCtx, s16 drawId) {
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[6]);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[7]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -55,7 +55,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;
}
@ -66,10 +66,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);
}
}

View File

@ -134,7 +134,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;
@ -216,7 +216,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;

View File

@ -1,11 +1,11 @@
#include "global.h"
void func_80026230(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) {
void func_80026230(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,15 +23,15 @@ void func_80026230(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_80026400(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) {
void func_80026400(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) {
Gfx* displayListHead;
f32 cos;
if (arg3 != 0) {
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
cos = Math_CosS((0x4000 / arg3) * arg2);
displayListHead = POLY_OPA_DISP;
@ -42,27 +42,27 @@ void func_80026400(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_80026608(GlobalContext* globalCtx) {
void func_80026608(PlayState* play) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
gDPPipeSync(POLY_OPA_DISP++);
POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP);
POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void func_80026690(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) {
void func_80026690(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);
@ -80,14 +80,14 @@ void func_80026690(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_80026860(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) {
void func_80026860(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);
@ -98,16 +98,16 @@ void func_80026860(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_80026A6C(GlobalContext* globalCtx) {
void func_80026A6C(PlayState* play) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
gDPPipeSync(POLY_XLU_DISP++);
POLY_XLU_DISP = Gameplay_SetFog(globalCtx, POLY_XLU_DISP);
POLY_XLU_DISP = Play_SetFog(play, POLY_XLU_DISP);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -33,8 +33,8 @@ EffectInfo sEffectInfoTable[] = {
},
};
GlobalContext* Effect_GetGlobalCtx(void) {
return sEffectContext.globalCtx;
PlayState* Effect_GetPlayState(void) {
return sEffectContext.play;
}
void* Effect_GetByIndex(s32 index) {
@ -77,7 +77,7 @@ void Effect_InitStatus(EffectStatus* status) {
status->unk_02 = 0;
}
void Effect_InitContext(GlobalContext* globalCtx) {
void Effect_InitContext(PlayState* play) {
s32 i;
for (i = 0; i < SPARK_COUNT; i++) {
@ -93,10 +93,10 @@ void Effect_InitContext(GlobalContext* globalCtx) {
Effect_InitStatus(&sEffectContext.blures[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) {
s32 i;
u32 slotFound;
void* effect = NULL;
@ -104,7 +104,7 @@ void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg
*pIndex = TOTAL_EFFECT_COUNT;
if (FrameAdvance_IsEnabled(globalCtx) != true) {
if (FrameAdvance_IsEnabled(play) != true) {
slotFound = false;
switch (type) {
case EFFECT_SPARK:
@ -178,13 +178,13 @@ 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 (sEffectContext.sparks[i].status.active) {
if (sEffectInfoTable[EFFECT_SPARK].update(&sEffectContext.sparks[i].effect) == 1) {
Effect_Delete(globalCtx, i);
Effect_Delete(play, i);
}
}
}
@ -192,7 +192,7 @@ void Effect_UpdateAll(GlobalContext* globalCtx) {
for (i = 0; i < BLURE_COUNT; i++) {
if (sEffectContext.blures[i].status.active) {
if (sEffectInfoTable[EFFECT_BLURE1].update(&sEffectContext.blures[i].effect) == 1) {
Effect_Delete(globalCtx, i + SPARK_COUNT);
Effect_Delete(play, i + SPARK_COUNT);
}
}
}
@ -200,13 +200,13 @@ void Effect_UpdateAll(GlobalContext* globalCtx) {
for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) {
if (sEffectContext.shieldParticles[i].status.active) {
if (sEffectInfoTable[EFFECT_SHIELD_PARTICLE].update(&sEffectContext.shieldParticles[i].effect) == 1) {
Effect_Delete(globalCtx, i + SPARK_COUNT + BLURE_COUNT);
Effect_Delete(play, i + SPARK_COUNT + BLURE_COUNT);
}
}
}
}
void Effect_Delete(GlobalContext* globalCtx, s32 index) {
void Effect_Delete(PlayState* play, s32 index) {
if (index == TOTAL_EFFECT_COUNT) {
return;
}
@ -232,7 +232,7 @@ void Effect_Delete(GlobalContext* globalCtx, s32 index) {
}
}
void Effect_DeleteAll(GlobalContext* globalCtx) {
void Effect_DeleteAll(PlayState* play) {
s32 i;
osSyncPrintf("エフェクト総て解放\n"); // "All effect release"

View File

@ -5,7 +5,7 @@
EffectSsInfo sEffectSsInfo = { 0 }; // "EffectSS2Info"
void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) {
void EffectSs_InitInfo(PlayState* play, s32 tableSize) {
u32 i;
EffectSs* effectSs;
EffectSsOverlay* overlay;
@ -17,7 +17,7 @@ void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) {
}
sEffectSsInfo.table =
GAMESTATE_ALLOC_MC(&globalCtx->state, tableSize * sizeof(EffectSs));
GAMESTATE_ALLOC_MC(&play->state, tableSize * sizeof(EffectSs));
ASSERT(sEffectSsInfo.table != NULL);
sEffectSsInfo.searchStartIndex = 0;
@ -34,7 +34,7 @@ void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) {
}
}
void EffectSs_ClearAll(GlobalContext* globalCtx) {
void EffectSs_ClearAll(PlayState* play) {
u32 i;
EffectSs* effectSs;
EffectSsOverlay* overlay;
@ -155,10 +155,10 @@ s32 EffectSs_FindSlot(s32 priority, s32* pIndex) {
return 0;
}
void EffectSs_Insert(GlobalContext* globalCtx, EffectSs* effectSs) {
void EffectSs_Insert(PlayState* play, EffectSs* effectSs) {
s32 index;
if (FrameAdvance_IsEnabled(globalCtx) != true) {
if (FrameAdvance_IsEnabled(play) != true) {
if (EffectSs_FindSlot(effectSs->priority, &index) == 0) {
sEffectSsInfo.searchStartIndex = index + 1;
sEffectSsInfo.table[index] = *effectSs;
@ -167,7 +167,7 @@ void EffectSs_Insert(GlobalContext* globalCtx, EffectSs* effectSs) {
}
// original name: "EffectSoftSprite2_makeEffect"
void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* initParams) {
void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) {
s32 index;
u32 overlaySize;
EffectSsOverlay* overlayEntry;
@ -237,7 +237,7 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init
sEffectSsInfo.table[index].priority = priority;
sEffectSsInfo.table[index].epoch++;
if (initInfo->init(globalCtx, index, &sEffectSsInfo.table[index], initParams) == 0) {
if (initInfo->init(play, index, &sEffectSsInfo.table[index], initParams) == 0) {
osSyncPrintf(VT_FGCOL(GREEN));
// "Construction failed for some reason. The constructor returned an error.
// Ceasing effect addition."
@ -249,7 +249,7 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init
}
}
void EffectSs_Update(GlobalContext* globalCtx, s32 index) {
void EffectSs_Update(PlayState* play, s32 index) {
EffectSs* effectSs = &sEffectSsInfo.table[index];
if (effectSs->update != NULL) {
@ -261,11 +261,11 @@ void EffectSs_Update(GlobalContext* globalCtx, s32 index) {
effectSs->pos.y += effectSs->velocity.y;
effectSs->pos.z += effectSs->velocity.z;
effectSs->update(globalCtx, index, effectSs);
effectSs->update(play, index, effectSs);
}
}
void EffectSs_UpdateAll(GlobalContext* globalCtx) {
void EffectSs_UpdateAll(PlayState* play) {
s32 i;
for (i = 0; i < sEffectSsInfo.tableSize; i++) {
@ -278,28 +278,28 @@ void EffectSs_UpdateAll(GlobalContext* globalCtx) {
}
if (sEffectSsInfo.table[i].life > -1) {
EffectSs_Update(globalCtx, i);
EffectSs_Update(play, i);
}
}
}
void EffectSs_Draw(GlobalContext* globalCtx, s32 index) {
void EffectSs_Draw(PlayState* play, s32 index) {
EffectSs* effectSs = &sEffectSsInfo.table[index];
if (effectSs->draw != NULL) {
FrameInterpolation_RecordOpenChild(effectSs, effectSs->epoch);
effectSs->draw(globalCtx, index, effectSs);
effectSs->draw(play, index, effectSs);
FrameInterpolation_RecordCloseChild();
}
}
// original name: "EffectSoftSprite2_disp"
void EffectSs_DrawAll(GlobalContext* globalCtx) {
Lights* lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx);
void EffectSs_DrawAll(PlayState* play) {
Lights* lights = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx);
s32 i;
Lights_BindAll(lights, globalCtx->lightCtx.listHead, NULL);
Lights_Draw(lights, globalCtx->state.gfxCtx);
Lights_BindAll(lights, play->lightCtx.listHead, NULL);
Lights_Draw(lights, play->state.gfxCtx);
for (i = 0; i < sEffectSsInfo.tableSize; i++) {
if (sEffectSsInfo.table[i].life > -1) {
@ -322,7 +322,7 @@ void EffectSs_DrawAll(GlobalContext* globalCtx) {
EffectSs_Delete(&sEffectSsInfo.table[i]);
} else {
EffectSs_Draw(globalCtx, i);
EffectSs_Draw(play, i);
}
}
}

View File

@ -40,8 +40,8 @@ static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
// effects that use this draw function are responsible for making sure their regs line up with the usage here
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;
@ -49,14 +49,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[6] = VIRTUAL_TO_PHYSICAL(object);
gSPSegment(POLY_XLU_DISP++, 0x06, object);
@ -78,7 +78,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;
@ -94,86 +94,86 @@ 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_8002829C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_8002829C(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_80028304(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_80028304(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_8002836C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_8002836C(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_800283D4(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_800283D4(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_8002843C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_8002843C(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);
}
// unused
void func_800284A4(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_800284A4(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);
}
// unused
void func_80028510(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_80028510(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_8002857C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0);
void func_8002857C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0);
}
// unused
void func_800285EC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0);
void func_800285EC(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0);
}
void func_8002865C(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_8002865C(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_800286CC(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_800286CC(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_8002873C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
void func_8002873C(PlayState* play, 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);
EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0);
}
void func_800287AC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
void func_800287AC(PlayState* play, 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);
EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0);
}
// unused
void func_8002881C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_8002881C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor) {
func_8002829C(globalCtx, pos, velocity, accel, primColor, envColor, 100, 5);
func_8002829C(play, pos, velocity, accel, primColor, envColor, 100, 5);
}
// unused
void func_80028858(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
void func_80028858(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor) {
func_80028304(globalCtx, pos, velocity, accel, primColor, envColor, 100, 5);
func_80028304(play, pos, velocity, accel, primColor, envColor, 100, 5);
}
void func_80028894(Vec3f* srcPos, f32 randScale, Vec3f* newPos, Vec3f* velocity, Vec3f* accel) {
@ -196,7 +196,7 @@ void func_80028894(Vec3f* srcPos, f32 randScale, Vec3f* newPos, Vec3f* velocity,
accel->z = 0.0f;
}
void func_80028990(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) {
void func_80028990(PlayState* play, f32 randScale, Vec3f* srcPos) {
s32 i;
Vec3f pos;
Vec3f velocity;
@ -204,11 +204,11 @@ void func_80028990(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) {
for (i = 0; i < 20; i++) {
func_80028894(srcPos, randScale, &pos, &velocity, &accel);
func_8002873C(globalCtx, &pos, &velocity, &accel, 100, 30, 7);
func_8002873C(play, &pos, &velocity, &accel, 100, 30, 7);
}
}
void func_80028A54(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) {
void func_80028A54(PlayState* play, f32 randScale, Vec3f* srcPos) {
s32 i;
Vec3f pos;
Vec3f velocity;
@ -216,25 +216,25 @@ void func_80028A54(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) {
for (i = 0; i < 20; i++) {
func_80028894(srcPos, randScale, &pos, &velocity, &accel);
func_800287AC(globalCtx, &pos, &velocity, &accel, 100, 30, 7);
func_800287AC(play, &pos, &velocity, &accel, 100, 30, 7);
}
}
// EffectSsKiraKira Spawn Functions
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,
void EffectSsKiraKira_SpawnSmall(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
Color_RGBA8* primColor, Color_RGBA8* envColor) {
EffectSsKiraKira_SpawnDispersed(globalCtx, pos, velocity, accel, primColor, envColor, 1000, 16);
EffectSsKiraKira_SpawnDispersed(play, pos, velocity, accel, primColor, envColor, 1000, 16);
}
void EffectSsKiraKira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
void EffectSsKiraKira_SpawnDispersed(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life) {
EffectSsKiraKiraInitParams initParams;
@ -252,10 +252,10 @@ 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,
void EffectSsKiraKira_SpawnFocused(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life) {
EffectSsKiraKiraInitParams initParams;
@ -271,26 +271,26 @@ 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);
}
// EffectSsBomb Spawn Functions
// unused
void EffectSsBomb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
void EffectSsBomb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
EffectSsBombInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
Math_Vec3f_Copy(&initParams.velocity, velocity);
Math_Vec3f_Copy(&initParams.accel, accel);
EffectSs_Spawn(globalCtx, EFFECT_SS_BOMB, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_BOMB, 128, &initParams);
}
// EffectSsBomb2 Spawn Functions
// unused
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);
@ -300,10 +300,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,
void EffectSsBomb2_SpawnLayered(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale,
s16 scaleStep) {
EffectSsBomb2InitParams initParams;
@ -314,12 +314,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) {
EffectSsBlastParams initParams;
@ -333,32 +333,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,
void EffectSsBlast_SpawnShockwave(PlayState* play, 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);
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;
@ -372,11 +372,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;
@ -390,18 +390,18 @@ 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,
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 };
@ -416,17 +416,17 @@ 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, s32 life) {
EffectSsDFireInitParams initParams;
@ -439,17 +439,17 @@ void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
initParams.fadeDelay = fadeDelay;
initParams.life = life;
EffectSs_Spawn(globalCtx, EFFECT_SS_D_FIRE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_D_FIRE, 128, &initParams);
}
void EffectSsDFire_SpawnFixedScale(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 alpha,
void EffectSsDFire_SpawnFixedScale(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 alpha,
s16 fadeDelay) {
EffectSsDFire_Spawn(globalCtx, pos, velocity, accel, 100, 35, alpha, fadeDelay, 8);
EffectSsDFire_Spawn(play, pos, velocity, accel, 100, 35, alpha, fadeDelay, 8);
}
// 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;
@ -459,12 +459,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);
@ -472,12 +472,12 @@ 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,
void EffectSsGSplash_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor,
s16 type, s16 scale) {
EffectSsGSplashInitParams initParams;
@ -493,32 +493,32 @@ void EffectSsGSplash_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* pr
initParams.customColor = false;
}
EffectSs_Spawn(globalCtx, EFFECT_SS_G_SPLASH, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_G_SPLASH, 128, &initParams);
}
// EffectSsGMagma Spawn Functions
void EffectSsGMagma_Spawn(GlobalContext* globalCtx, Vec3f* pos) {
void EffectSsGMagma_Spawn(PlayState* play, Vec3f* pos) {
EffectSsGMagmaInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
EffectSs_Spawn(globalCtx, EFFECT_SS_G_MAGMA, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_G_MAGMA, 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,
void EffectSsLightning_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor,
s16 scale, s16 yaw, s16 life, s16 numBolts) {
EffectSsLightningInitParams initParams;
@ -530,12 +530,12 @@ 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,
void EffectSsDtBubble_SpawnColorProfile(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale,
s16 life, s16 colorProfile, s16 randXZ) {
EffectSsDtBubbleInitParams initParams;
@ -548,10 +548,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;
@ -565,7 +565,7 @@ void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, Vec3f* pos, Vec
initParams.randXZ = randXZ;
initParams.customColor = true;
EffectSs_Spawn(globalCtx, EFFECT_SS_DT_BUBBLE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_DT_BUBBLE, 128, &initParams);
}
// EffectSsHahen Spawn Functions
@ -579,7 +579,7 @@ 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,
void EffectSsHahen_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16 scale,
s16 objId, s16 life, Gfx* dList) {
EffectSsHahenInitParams initParams;
@ -592,7 +592,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);
}
/**
@ -604,7 +604,7 @@ 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,
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;
@ -618,7 +618,7 @@ 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,
EffectSsHahen_Spawn(play, pos, &velocity, &accel, unused, Rand_S16Offset(scale, randScaleRange), objId,
life, dList);
}
}
@ -629,18 +629,18 @@ void EffectSsHahen_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos, f32 burstSca
* 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,
void EffectSsSibuki_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 moveDelay,
s16 direction, s16 scale) {
EffectSsSibukiInitParams initParams;
@ -651,10 +651,10 @@ 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 unusedZeroVec1 = { 0.0f, 0.0f, 0.0f };
Vec3f unusedZeroVec2 = { 0.0f, 0.0f, 0.0f };
@ -662,26 +662,26 @@ void EffectSsSibuki_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos) {
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);
}
}
// EffectSsSibuki2 Spawn Functions
// unused
void EffectSsSibuki2_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) {
void EffectSsSibuki2_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) {
EffectSsSibuki2InitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
Math_Vec3f_Copy(&initParams.velocity, velocity);
Math_Vec3f_Copy(&initParams.accel, accel);
initParams.scale = scale;
EffectSs_Spawn(globalCtx, EFFECT_SS_SIBUKI2, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_SIBUKI2, 128, &initParams);
}
// EffectSsGMagma2 Spawn Functions
void EffectSsGMagma2_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor,
void EffectSsGMagma2_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor,
s16 updateRate, s16 drawMode, s16 scale) {
EffectSsGMagma2InitParams initParams;
@ -692,38 +692,38 @@ void EffectSsGMagma2_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* pr
initParams.drawMode = drawMode;
initParams.scale = scale;
EffectSs_Spawn(globalCtx, EFFECT_SS_G_MAGMA2, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_G_MAGMA2, 128, &initParams);
}
// EffectSsStone1 Spawn Functions
void EffectSsStone1_Spawn(GlobalContext* globalCtx, Vec3f* pos, s32 arg2) {
void EffectSsStone1_Spawn(PlayState* play, Vec3f* pos, s32 arg2) {
EffectSsStone1InitParams initParams;
initParams.pos = *pos;
initParams.unk_C = arg2;
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
@ -734,7 +734,7 @@ void EffectSsHitMark_SpawnCustomScale(GlobalContext* globalCtx, s32 type, s16 sc
* param changes the color of the ball. Refer to FhgFlashLightBallParam for the options.
* Note: this type requires OBJECT_FHG to be loaded
*/
void EffectSsFhgFlash_SpawnLightBall(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale,
void EffectSsFhgFlash_SpawnLightBall(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale,
u8 param) {
EffectSsFhgFlashInitParams initParams;
@ -745,7 +745,7 @@ void EffectSsFhgFlash_SpawnLightBall(GlobalContext* globalCtx, Vec3f* pos, Vec3f
initParams.param = param;
initParams.type = FHGFLASH_LIGHTBALL;
EffectSs_Spawn(globalCtx, EFFECT_SS_FHG_FLASH, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_FHG_FLASH, 128, &initParams);
}
/**
@ -756,7 +756,7 @@ void EffectSsFhgFlash_SpawnLightBall(GlobalContext* globalCtx, Vec3f* pos, Vec3f
* 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;
@ -765,12 +765,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);
@ -779,12 +779,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) {
EffectSsSolderSrchBallInitParams initParams;
@ -794,12 +794,12 @@ void EffectSsSolderSrchBall_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* v
initParams.unused = unused;
initParams.linkDetected = linkDetected;
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,
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;
@ -820,12 +820,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);
@ -833,10 +833,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 },
@ -867,14 +867,14 @@ 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,
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, s16 primR, s16 primG, s16 primB,
void EffectSsEnIce_SpawnFlyingVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 primR, s16 primG, s16 primB,
s16 primA, s16 envR, s16 envG, s16 envB, f32 scale) {
EffectSsEnIceInitParams initParams;
@ -895,10 +895,10 @@ void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3
Audio_PlayActorSound2(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 EffectSsEnIce_SpawnFlyingVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* pos, s16 primR, s16 primG, s16 primB,
void EffectSsEnIce_SpawnFlyingVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 primR, s16 primG, s16 primB,
s16 primA, s16 envR, s16 envG, s16 envB, f32 scale) {
EffectSsEnIceInitParams initParams;
@ -921,10 +921,10 @@ void EffectSsEnIce_SpawnFlyingVec3s(GlobalContext* globalCtx, Actor* actor, Vec3
Audio_PlayActorSound2(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 EffectSsEnIce_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel,
void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel,
Color_RGBA8* primColor, Color_RGBA8* envColor, s32 life) {
EffectSsEnIceInitParams initParams;
@ -937,12 +937,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;
@ -957,10 +957,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 };
@ -972,21 +972,21 @@ 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,
EffectSsFireTail_SpawnFlame(play, &player->actor, &player->bodyPartsPos[bodyPart], scale, bodyPart,
colorIntensity);
}
// EffectSsEnFire Spawn Functions
// note: if bodyPart is greater than -1 the actor MUST have a table of Vec3f positions at offset 0x14C in the instance
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;
@ -1001,11 +1001,11 @@ void EffectSsEnFire_SpawnVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* po
Audio_PlayActorSound2(actor, NA_SE_EV_FLAME_IGNITION);
}
EffectSs_Spawn(globalCtx, EFFECT_SS_EN_FIRE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_EN_FIRE, 128, &initParams);
}
// note: if bodyPart is greater than -1 the actor MUST have a table of Vec3s positions at offset 0x14C in the instance
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;
@ -1022,12 +1022,12 @@ void EffectSsEnFire_SpawnVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* po
Audio_PlayActorSound2(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);
@ -1036,12 +1036,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);
}
// EffectSsFCircle Spawn Functions
void EffectSsFCircle_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 radius, s16 height) {
void EffectSsFCircle_Spawn(PlayState* play, Actor* actor, Vec3f* pos, s16 radius, s16 height) {
EffectSsFcircleInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@ -1049,12 +1049,12 @@ void EffectSsFCircle_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s
initParams.radius = radius;
initParams.height = height;
EffectSs_Spawn(globalCtx, EFFECT_SS_FCIRCLE, 128, &initParams);
EffectSs_Spawn(play, EFFECT_SS_FCIRCLE, 128, &initParams);
}
// EffectSsDeadDb Spawn Functions
void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
s16 primR, s16 primG, s16 primB, s16 primA, s16 envR, s16 envG, s16 envB, s16 unused,
s32 arg14, s16 playSound) {
EffectSsDeadDbInitParams initParams;
@ -1075,12 +1075,12 @@ void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
initParams.unk_34 = arg14;
initParams.playSound = playSound;
EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DB, 120, &initParams);
EffectSs_Spawn(play, EFFECT_SS_DEAD_DB, 120, &initParams);
}
// EffectSsDeadDd Spawn Functions
void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
void EffectSsDeadDd_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
s16 primR, s16 primG, s16 primB, s16 alpha, s16 envR, s16 envG, s16 envB, s16 alphaStep,
s32 life) {
EffectSsDeadDdInitParams initParams;
@ -1101,11 +1101,11 @@ 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);
}
// unused
void EffectSsDeadDd_SpawnRandYellow(GlobalContext* globalCtx, Vec3f* pos, s16 scale, s16 scaleStep, f32 randPosScale,
void EffectSsDeadDd_SpawnRandYellow(PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, f32 randPosScale,
s32 randIter, s32 life) {
EffectSsDeadDdInitParams initParams;
@ -1117,12 +1117,12 @@ void EffectSsDeadDd_SpawnRandYellow(GlobalContext* globalCtx, Vec3f* pos, s16 sc
initParams.life = life;
initParams.type = 1;
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;
@ -1133,17 +1133,17 @@ 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 EffectSsDeadDs_SpawnStationary(GlobalContext* globalCtx, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha,
void EffectSsDeadDs_SpawnStationary(PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha,
s32 life) {
EffectSsDeadDs_Spawn(globalCtx, pos, &sZeroVec, &sZeroVec, scale, scaleStep, alpha, life);
EffectSsDeadDs_Spawn(play, pos, &sZeroVec, &sZeroVec, scale, scaleStep, alpha, life);
}
// EffectSsDeadSound Spawn Functions
void EffectSsDeadSound_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u16 sfxId,
void EffectSsDeadSound_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u16 sfxId,
s16 lowerPriority, s16 repeatMode, s32 life) {
EffectSsDeadSoundInitParams initParams;
@ -1156,15 +1156,15 @@ void EffectSsDeadSound_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* veloci
initParams.life = life;
if (!lowerPriority) {
EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_SOUND, 100, &initParams);
EffectSs_Spawn(play, EFFECT_SS_DEAD_SOUND, 100, &initParams);
} else {
EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_SOUND, 127, &initParams);
EffectSs_Spawn(play, EFFECT_SS_DEAD_SOUND, 127, &initParams);
}
}
void EffectSsDeadSound_SpawnStationary(GlobalContext* globalCtx, Vec3f* pos, u16 sfxId, s16 lowerPriority,
void EffectSsDeadSound_SpawnStationary(PlayState* play, Vec3f* pos, u16 sfxId, s16 lowerPriority,
s16 repeatMode, s32 life) {
EffectSsDeadSound_Spawn(globalCtx, pos, &sZeroVec, &sZeroVec, sfxId, lowerPriority, repeatMode, life);
EffectSsDeadSound_Spawn(play, pos, &sZeroVec, &sZeroVec, sfxId, lowerPriority, repeatMode, life);
}
// EffectSsIceSmoke Spawn Functions
@ -1174,7 +1174,7 @@ void EffectSsDeadSound_SpawnStationary(GlobalContext* globalCtx, Vec3f* pos, u16
*
* Note: this effect requires OBJECT_FZ to be loaded
*/
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);
@ -1182,5 +1182,5 @@ 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);
}

View File

@ -148,12 +148,12 @@ u16 ElfMessage_GetTextFromMsgs(ElfMessage* msg) {
}
}
u16 ElfMessage_GetSariaText(GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
u16 ElfMessage_GetSariaText(PlayState* play) {
Player* player = GET_PLAYER(play);
ElfMessage* msgs;
if (!LINK_IS_ADULT) {
if (Actor_FindNearby(globalCtx, &player->actor, ACTOR_EN_SA, 4, 800.0f) == NULL) {
if (Actor_FindNearby(play, &player->actor, ACTOR_EN_SA, 4, 800.0f) == NULL) {
msgs = sChildSariaMsgs;
} else {
return 0x0160; // Special text about Saria preferring to talk to you face-to-face
@ -165,10 +165,10 @@ u16 ElfMessage_GetSariaText(GlobalContext* globalCtx) {
return ElfMessage_GetTextFromMsgs(msgs);
}
u16 ElfMessage_GetCUpText(GlobalContext* globalCtx) {
if (globalCtx->cUpElfMsgs == NULL) {
u16 ElfMessage_GetCUpText(PlayState* play) {
if (play->cUpElfMsgs == NULL) {
return 0;
} else {
return ElfMessage_GetTextFromMsgs(globalCtx->cUpElfMsgs);
return ElfMessage_GetTextFromMsgs(play->cUpElfMsgs);
}
}

View File

@ -5,16 +5,16 @@
#define FLAGS ACTOR_FLAG_4
void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx);
void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx);
void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnAObj_Init(Actor* thisx, PlayState* play);
void EnAObj_Destroy(Actor* thisx, PlayState* play);
void EnAObj_Update(Actor* thisx, PlayState* play);
void EnAObj_Draw(Actor* thisx, PlayState* play);
void EnAObj_WaitFinishedTalking(EnAObj* this, GlobalContext* globalCtx);
void EnAObj_WaitTalk(EnAObj* this, GlobalContext* globalCtx);
void EnAObj_BlockRot(EnAObj* this, GlobalContext* globalCtx);
void EnAObj_BoulderFragment(EnAObj* this, GlobalContext* globalCtx);
void EnAObj_Block(EnAObj* this, GlobalContext* globalCtx);
void EnAObj_WaitFinishedTalking(EnAObj* this, PlayState* play);
void EnAObj_WaitTalk(EnAObj* this, PlayState* play);
void EnAObj_BlockRot(EnAObj* this, PlayState* play);
void EnAObj_BoulderFragment(EnAObj* this, PlayState* play);
void EnAObj_Block(EnAObj* this, PlayState* play);
void EnAObj_SetupWaitTalk(EnAObj* this, s16 type);
void EnAObj_SetupBlockRot(EnAObj* this, s16 type);
@ -84,7 +84,7 @@ void EnAObj_SetupAction(EnAObj* this, EnAObjActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnAObj_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL;
s32 pad;
EnAObj* this = (EnAObj*)thisx;
@ -131,13 +131,13 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
case A_OBJ_BLOCK_LARGE:
case A_OBJ_BLOCK_HUGE:
this->dyna.bgId = 1;
Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_BG);
Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_BG);
EnAObj_SetupBlock(this, thisx->params);
break;
case A_OBJ_BLOCK_SMALL_ROT:
case A_OBJ_BLOCK_LARGE_ROT:
this->dyna.bgId = 3;
Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_BG);
Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_BG);
EnAObj_SetupBlockRot(this, thisx->params);
break;
case A_OBJ_UNKNOWN_6:
@ -160,8 +160,8 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
// clang-format on
this->focusYoffset = 45.0f;
EnAObj_SetupWaitTalk(this, thisx->params);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit);
thisx->colChkInfo.mass = MASS_IMMOVABLE;
thisx->targetMode = 0;
break;
@ -181,25 +181,25 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
if (this->dyna.bgId != BGACTOR_NEG_ONE) {
CollisionHeader_GetVirtual(sColHeaders[this->dyna.bgId], &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
}
}
void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnAObj_Destroy(Actor* thisx, PlayState* play) {
EnAObj* this = (EnAObj*)thisx;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
switch (this->dyna.actor.params) {
case A_OBJ_SIGNPOST_OBLONG:
case A_OBJ_SIGNPOST_ARROW:
Collider_DestroyCylinder(globalCtx, &this->collider);
Collider_DestroyCylinder(play, &this->collider);
break;
}
}
void EnAObj_WaitFinishedTalking(EnAObj* this, GlobalContext* globalCtx) {
if (Actor_TextboxIsClosing(&this->dyna.actor, globalCtx)) {
void EnAObj_WaitFinishedTalking(EnAObj* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->dyna.actor, play)) {
EnAObj_SetupWaitTalk(this, this->dyna.actor.params);
}
}
@ -208,17 +208,17 @@ void EnAObj_SetupWaitTalk(EnAObj* this, s16 type) {
EnAObj_SetupAction(this, EnAObj_WaitTalk);
}
void EnAObj_WaitTalk(EnAObj* this, GlobalContext* globalCtx) {
void EnAObj_WaitTalk(EnAObj* this, PlayState* play) {
s16 relYawTowardsPlayer;
if (this->dyna.actor.textId != 0) {
relYawTowardsPlayer = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y;
if (ABS(relYawTowardsPlayer) < 0x2800 ||
(this->dyna.actor.params == A_OBJ_SIGNPOST_ARROW && ABS(relYawTowardsPlayer) > 0x5800)) {
if (Actor_ProcessTalkRequest(&this->dyna.actor, globalCtx)) {
if (Actor_ProcessTalkRequest(&this->dyna.actor, play)) {
EnAObj_SetupAction(this, EnAObj_WaitFinishedTalking);
} else {
func_8002F2F4(&this->dyna.actor, globalCtx);
func_8002F2F4(&this->dyna.actor, play);
}
}
}
@ -232,7 +232,7 @@ void EnAObj_SetupBlockRot(EnAObj* this, s16 type) {
EnAObj_SetupAction(this, EnAObj_BlockRot);
}
void EnAObj_BlockRot(EnAObj* this, GlobalContext* globalCtx) {
void EnAObj_BlockRot(EnAObj* this, PlayState* play) {
if (this->rotateState == 0) {
if (this->dyna.unk_160 != 0) {
this->rotateState++;
@ -275,7 +275,7 @@ void EnAObj_SetupBoulderFragment(EnAObj* this, s16 type) {
EnAObj_SetupAction(this, EnAObj_BoulderFragment);
}
void EnAObj_BoulderFragment(EnAObj* this, GlobalContext* globalCtx) {
void EnAObj_BoulderFragment(EnAObj* this, PlayState* play) {
Math_SmoothStepToF(&this->dyna.actor.speedXZ, 1.0f, 1.0f, 0.5f, 0.0f);
this->dyna.actor.shape.rot.x += this->dyna.actor.world.rot.x >> 1;
this->dyna.actor.shape.rot.z += this->dyna.actor.world.rot.z >> 1;
@ -303,7 +303,7 @@ void EnAObj_SetupBlock(EnAObj* this, s16 type) {
EnAObj_SetupAction(this, EnAObj_Block);
}
void EnAObj_Block(EnAObj* this, GlobalContext* globalCtx) {
void EnAObj_Block(EnAObj* this, PlayState* play) {
this->dyna.actor.speedXZ += this->dyna.unk_150;
this->dyna.actor.world.rot.y = this->dyna.unk_158;
this->dyna.actor.speedXZ = CLAMP(this->dyna.actor.speedXZ, -2.5f, 2.5f);
@ -318,17 +318,17 @@ void EnAObj_Block(EnAObj* this, GlobalContext* globalCtx) {
this->dyna.unk_150 = 0.0f;
}
void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnAObj_Update(Actor* thisx, PlayState* play) {
EnAObj* this = (EnAObj*)thisx;
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
Actor_MoveForward(&this->dyna.actor);
if (this->dyna.actor.gravity != 0.0f) {
if (this->dyna.actor.params != A_OBJ_BOULDER_FRAGMENT) {
Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 5.0f, 40.0f, 0.0f, 0x1D);
Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 5.0f, 40.0f, 0.0f, 0x1D);
} else {
Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 5.0f, 20.0f, 0.0f, 0x1D);
Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 5.0f, 20.0f, 0.0f, 0x1D);
}
}
@ -339,17 +339,17 @@ void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) {
case A_OBJ_SIGNPOST_OBLONG:
case A_OBJ_SIGNPOST_ARROW:
Collider_UpdateCylinder(&this->dyna.actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
break;
}
}
void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnAObj_Draw(Actor* thisx, PlayState* play) {
s32 type = thisx->params;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
if (type >= A_OBJ_MAX) {
type = A_OBJ_BOULDER_FRAGMENT;
@ -359,9 +359,9 @@ void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 1, 60, 60, 60, 50);
}
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDLists[type]);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -5,20 +5,20 @@
#define FLAGS 0
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 func_8001DFC8(EnItem00* this, GlobalContext* globalCtx);
void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx);
void func_8001E304(EnItem00* this, GlobalContext* globalCtx);
void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx);
void func_8001DFC8(EnItem00* this, PlayState* play);
void func_8001E1C8(EnItem00* this, PlayState* play);
void func_8001E304(EnItem00* this, PlayState* play);
void func_8001E5C8(EnItem00* this, PlayState* play);
void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx);
void EnItem00_DrawCollectible(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_DrawCollectible(EnItem00* this, PlayState* play);
void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play);
void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play);
const ActorInit En_Item00_InitVars = {
ACTOR_EN_ITEM00,
@ -330,7 +330,7 @@ void EnItem00_SetupAction(EnItem00* this, EnItem00ActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnItem00_Init(Actor* thisx, PlayState* play) {
EnItem00* this = (EnItem00*)thisx;
s32 pad;
f32 yOffset = 980.0f;
@ -346,14 +346,14 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.params &= 0xFF;
if (Flags_GetCollectible(globalCtx, this->collectibleFlag)) {
if (Flags_GetCollectible(play, this->collectibleFlag)) {
Actor_Kill(&this->actor);
return;
}
Actor_ProcessInitChain(&this->actor, sInitChain);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->unk_158 = 1;
@ -397,8 +397,8 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
this->scale = 0.01f;
break;
case ITEM00_SHIELD_DEKU:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_1);
Actor_SetObjectDependency(globalCtx, &this->actor);
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_1);
Actor_SetObjectDependency(play, &this->actor);
Actor_SetScale(&this->actor, 0.5f);
this->scale = 0.5f;
yOffset = 0.0f;
@ -406,8 +406,8 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.world.rot.x = 0x4000;
break;
case ITEM00_SHIELD_HYLIAN:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_2);
Actor_SetObjectDependency(globalCtx, &this->actor);
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_2);
Actor_SetObjectDependency(play, &this->actor);
Actor_SetScale(&this->actor, 0.5f);
this->scale = 0.5f;
yOffset = 0.0f;
@ -416,8 +416,8 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
break;
case ITEM00_TUNIC_ZORA:
case ITEM00_TUNIC_GORON:
this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_CLOTHES);
Actor_SetObjectDependency(globalCtx, &this->actor);
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_CLOTHES);
Actor_SetObjectDependency(play, &this->actor);
Actor_SetScale(&this->actor, 0.5f);
this->scale = 0.5f;
yOffset = 0.0f;
@ -432,7 +432,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.focus.pos = this->actor.world.pos;
this->getItemId = GI_NONE;
RandomizerCheck randoCheck =
Randomizer_GetCheckFromActor(this->actor.id, globalCtx->sceneNum, this->ogParams);
Randomizer_GetCheckFromActor(this->actor.id, play->sceneNum, this->ogParams);
if (gSaveContext.n64ddFlag && randoCheck != RC_UNKNOWN_CHECK) {
this->randoGiEntry =
@ -455,41 +455,41 @@ 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_ORANGE:
Item_Give(globalCtx, ITEM_RUPEE_GOLD);
Item_Give(play, ITEM_RUPEE_GOLD);
break;
case ITEM00_HEART:
Item_Give(globalCtx, ITEM_HEART);
Item_Give(play, ITEM_HEART);
break;
case ITEM00_FLEXIBLE:
Health_ChangeBy(globalCtx, 0x70);
Health_ChangeBy(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_SINGLE:
Item_Give(globalCtx, ITEM_BOW);
Item_Give(play, ITEM_BOW);
break;
case ITEM00_ARROWS_SMALL:
Item_Give(globalCtx, ITEM_ARROWS_SMALL);
Item_Give(play, ITEM_ARROWS_SMALL);
break;
case ITEM00_ARROWS_MEDIUM:
Item_Give(globalCtx, ITEM_ARROWS_MEDIUM);
Item_Give(play, ITEM_ARROWS_MEDIUM);
break;
case ITEM00_ARROWS_LARGE:
Item_Give(globalCtx, ITEM_ARROWS_LARGE);
Item_Give(play, ITEM_ARROWS_LARGE);
break;
case ITEM00_MAGIC_LARGE:
getItemId = GI_MAGIC_SMALL;
@ -498,7 +498,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
getItemId = GI_MAGIC_LARGE;
break;
case ITEM00_SMALL_KEY:
Item_Give(globalCtx, ITEM_KEY_SMALL);
Item_Give(play, ITEM_KEY_SMALL);
break;
case ITEM00_SEEDS:
getItemId = GI_SEEDS_5;
@ -518,31 +518,31 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
case ITEM00_BOMBS_SPECIAL:
break;
case ITEM00_BOMBCHU:
Item_Give(globalCtx, ITEM_BOMBCHUS_5);
Item_Give(play, ITEM_BOMBCHUS_5);
break;
}
if (!Actor_HasParent(&this->actor, globalCtx)) {
if (!Actor_HasParent(&this->actor, play)) {
if (getItemId != GI_NONE) {
if (!gSaveContext.n64ddFlag || this->randoGiEntry.getItemId == GI_NONE) {
func_8002F554(&this->actor, globalCtx, getItemId);
func_8002F554(&this->actor, play, getItemId);
} else {
GiveItemEntryFromActorWithFixedRange(&this->actor, globalCtx, this->randoGiEntry);
GiveItemEntryFromActorWithFixedRange(&this->actor, play, this->randoGiEntry);
}
}
}
EnItem00_SetupAction(this, func_8001E5C8);
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnItem00_Destroy(Actor* thisx, PlayState* play) {
EnItem00* this = (EnItem00*)thisx;
Collider_DestroyCylinder(globalCtx, &this->collider);
Collider_DestroyCylinder(play, &this->collider);
}
void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) {
void func_8001DFC8(EnItem00* this, PlayState* play) {
if (!CVar_GetS32("gNewDrops", 0)){
if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->unk_15A < 0)) ||
@ -601,7 +601,7 @@ void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) {
}
}
void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) {
void func_8001E1C8(EnItem00* this, PlayState* play) {
f32 originalVelocity;
Vec3f effectPos;
@ -609,11 +609,11 @@ void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) {
this->actor.shape.rot.y += 960;
}
if (globalCtx->gameplayFrames & 1) {
if (play->gameplayFrames & 1) {
effectPos.x = this->actor.world.pos.x + Rand_CenteredFloat(10.0f);
effectPos.y = this->actor.world.pos.y + Rand_CenteredFloat(10.0f);
effectPos.z = this->actor.world.pos.z + Rand_CenteredFloat(10.0f);
EffectSsKiraKira_SpawnSmall(globalCtx, &effectPos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor,
EffectSsKiraKira_SpawnSmall(play, &effectPos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor,
&sEffectEnvColor);
}
@ -629,7 +629,7 @@ void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) {
}
}
void func_8001E304(EnItem00* this, GlobalContext* globalCtx) {
void func_8001E304(EnItem00* this, PlayState* play) {
s32 pad;
Vec3f pos;
s32 rotOffset;
@ -669,11 +669,11 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) {
}
}
if (!(globalCtx->gameplayFrames & 1)) {
if (!(play->gameplayFrames & 1)) {
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, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor,
EffectSsKiraKira_SpawnSmall(play, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor,
&sEffectEnvColor);
}
@ -685,14 +685,14 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) {
}
}
void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void func_8001E5C8(EnItem00* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (this->getItemId != GI_NONE) {
if (!Actor_HasParent(&this->actor, globalCtx)) {
if (!Actor_HasParent(&this->actor, play)) {
if (!gSaveContext.n64ddFlag) {
func_8002F434(&this->actor, globalCtx, this->getItemId, 50.0f, 80.0f);
func_8002F434(&this->actor, play, this->getItemId, 50.0f, 80.0f);
} else {
GiveItemEntryFromActor(&this->actor, globalCtx, this->randoGiEntry, 50.0f, 80.0f);
GiveItemEntryFromActor(&this->actor, play, this->randoGiEntry, 50.0f, 80.0f);
}
this->unk_15A++;
} else {
@ -721,7 +721,7 @@ void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) {
}
// The BSS in the function acted weird in the past. It is matching now but might cause issues in the future
void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnItem00_Update(Actor* thisx, PlayState* play) {
static u32 D_80157D90;
static s16 D_80157D94[1];
s16* params;
@ -762,7 +762,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
this->unk_156 = this->unk_15A;
}
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
Math_SmoothStepToF(&this->actor.scale.x, this->scale, 0.1f, this->scale * 0.1f, 0.0f);
temp = &D_80157D90;
@ -771,12 +771,12 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
if (this->actor.gravity) {
if (this->actor.bgCheckFlags & 0x0003) {
if (*temp != globalCtx->gameplayFrames) {
D_80157D90 = globalCtx->gameplayFrames;
if (*temp != play->gameplayFrames) {
D_80157D90 = play->gameplayFrames;
D_80157D94[0] = 0;
for (i = 0; i < 50; i++) {
if (globalCtx->colCtx.dyna.bgActorFlags[i] & 1) {
dynaActor = globalCtx->colCtx.dyna.bgActors[i].actor;
if (play->colCtx.dyna.bgActorFlags[i] & 1) {
dynaActor = play->colCtx.dyna.bgActors[i].actor;
if ((dynaActor != NULL) && (dynaActor->update != NULL)) {
if ((dynaActor->world.pos.x != dynaActor->prevPos.x) ||
(dynaActor->world.pos.y != dynaActor->prevPos.y) ||
@ -795,7 +795,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
}
if (sp3A || D_80157D94[0]) {
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 15.0f, 0x1D);
Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 15.0f, 15.0f, 0x1D);
if (this->actor.floorHeight <= -10000.0f) {
Actor_Kill(&this->actor);
@ -805,7 +805,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);
if ((this->actor.params == ITEM00_SHIELD_DEKU) || (this->actor.params == ITEM00_SHIELD_HYLIAN) ||
(this->actor.params == ITEM00_TUNIC_ZORA) || (this->actor.params == ITEM00_TUNIC_GORON)) {
@ -819,30 +819,30 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
if (!((this->actor.xzDistToPlayer <= 30.0f) && (this->actor.yDistToPlayer >= -50.0f) &&
(this->actor.yDistToPlayer <= 50.0f))) {
if (!Actor_HasParent(&this->actor, globalCtx)) {
if (!Actor_HasParent(&this->actor, play)) {
return;
}
}
if (globalCtx->gameOverCtx.state != GAMEOVER_INACTIVE) {
if (play->gameOverCtx.state != GAMEOVER_INACTIVE) {
return;
}
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_ORANGE:
Item_Give(globalCtx, ITEM_RUPEE_GOLD);
Item_Give(play, ITEM_RUPEE_GOLD);
break;
case ITEM00_STICK:
getItemId = GI_STICKS_1;
@ -851,26 +851,26 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
getItemId = GI_NUTS_5;
break;
case ITEM00_HEART:
Item_Give(globalCtx, ITEM_HEART);
Item_Give(play, ITEM_HEART);
break;
case ITEM00_FLEXIBLE:
Health_ChangeBy(globalCtx, 0x70);
Health_ChangeBy(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_SINGLE:
Item_Give(globalCtx, ITEM_BOW);
Item_Give(play, ITEM_BOW);
break;
case ITEM00_ARROWS_SMALL:
Item_Give(globalCtx, ITEM_ARROWS_SMALL);
Item_Give(play, ITEM_ARROWS_SMALL);
break;
case ITEM00_ARROWS_MEDIUM:
Item_Give(globalCtx, ITEM_ARROWS_MEDIUM);
Item_Give(play, ITEM_ARROWS_MEDIUM);
break;
case ITEM00_ARROWS_LARGE:
Item_Give(globalCtx, ITEM_ARROWS_LARGE);
Item_Give(play, ITEM_ARROWS_LARGE);
break;
case ITEM00_SEEDS:
getItemId = GI_SEEDS_5;
@ -905,18 +905,18 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
case ITEM00_BOMBS_SPECIAL:
break;
case ITEM00_BOMBCHU:
Item_Give(globalCtx, ITEM_BOMBCHUS_5);
Item_Give(play, ITEM_BOMBCHUS_5);
break;
}
params = &this->actor.params;
if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, globalCtx)) {
if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, play)) {
if (!gSaveContext.n64ddFlag || this->randoGiEntry.getItemId == GI_NONE) {
func_8002F554(&this->actor, globalCtx, getItemId);
func_8002F554(&this->actor, play, getItemId);
} else {
getItemId = this->randoGiEntry.getItemId;
GiveItemEntryFromActorWithFixedRange(&this->actor, globalCtx, this->randoGiEntry);
GiveItemEntryFromActorWithFixedRange(&this->actor, play, this->randoGiEntry);
}
}
@ -928,8 +928,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
case ITEM00_SHIELD_HYLIAN:
case ITEM00_TUNIC_ZORA:
case ITEM00_TUNIC_GORON:
if (Actor_HasParent(&this->actor, globalCtx)) {
Flags_SetCollectible(globalCtx, this->collectibleFlag);
if (Actor_HasParent(&this->actor, play)) {
Flags_SetCollectible(play, this->collectibleFlag);
Actor_Kill(&this->actor);
}
return;
@ -938,8 +938,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
if ((*params <= ITEM00_RUPEE_RED) || (*params == ITEM00_RUPEE_ORANGE)) {
Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
} 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_Kill(&this->actor);
}
return;
@ -947,7 +947,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
Audio_PlaySoundGeneral(NA_SE_SY_GET_ITEM, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
Flags_SetCollectible(globalCtx, this->collectibleFlag);
Flags_SetCollectible(play, this->collectibleFlag);
this->unk_15A = 15;
this->unk_154 = 35;
@ -962,7 +962,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
EnItem00_SetupAction(this, func_8001E5C8);
}
void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnItem00_Draw(Actor* thisx, PlayState* play) {
EnItem00* this = (EnItem00*)thisx;
f32 mtxScale;
@ -975,7 +975,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.shape.shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
GetItem_Draw(globalCtx, GID_RUPEE_GREEN);
GetItem_Draw(play, GID_RUPEE_GREEN);
break;
}
case ITEM00_RUPEE_BLUE:
@ -985,7 +985,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.shape.shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
GetItem_Draw(globalCtx, GID_RUPEE_BLUE);
GetItem_Draw(play, GID_RUPEE_BLUE);
break;
}
case ITEM00_RUPEE_RED:
@ -995,14 +995,14 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.shape.shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
GetItem_Draw(globalCtx, GID_RUPEE_RED);
GetItem_Draw(play, GID_RUPEE_RED);
break;
} else {
this->actor.shape.shadowScale = 6.0f;
Actor_SetScale(&this->actor, 0.015f);
this->scale = 0.015f;
this->actor.shape.yOffset = 750.0f;
EnItem00_DrawRupee(this, globalCtx);
EnItem00_DrawRupee(this, play);
break;
}
case ITEM00_RUPEE_ORANGE:
@ -1012,14 +1012,14 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.shape.shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
GetItem_Draw(globalCtx, GID_RUPEE_GOLD);
GetItem_Draw(play, GID_RUPEE_GOLD);
break;
} else {
Actor_SetScale(&this->actor, 0.045 - 1e-10);
this->actor.shape.shadowScale = 6.0f;
this->scale = 0.045 - 1e-10;
this->actor.shape.yOffset = 750.0f;
EnItem00_DrawRupee(this, globalCtx);
EnItem00_DrawRupee(this, play);
break;
}
case ITEM00_RUPEE_PURPLE:
@ -1029,14 +1029,14 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.shape.shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
GetItem_Draw(globalCtx, GID_RUPEE_PURPLE);
GetItem_Draw(play, GID_RUPEE_PURPLE);
break;
} else {
Actor_SetScale(&this->actor, 0.03f);
this->actor.shape.shadowScale = 6.0f;
this->scale = 0.03f;
this->actor.shape.yOffset = 750.0f;
EnItem00_DrawRupee(this, globalCtx);
EnItem00_DrawRupee(this, play);
break;
}
case ITEM00_HEART_PIECE:
@ -1046,17 +1046,17 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
GetItem_Draw(globalCtx, GID_HEART_PIECE);
GetItem_Draw(play, GID_HEART_PIECE);
} else {
this->actor.shape.yOffset = 650.0f;
this->actor.shape.shadowScale = 0.03f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
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 (CVar_GetS32("gNewDrops", 0)) {
@ -1065,23 +1065,23 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.shadowScale = 0.3f;
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
GetItem_Draw(globalCtx, GID_HEART);
GetItem_Draw(play, GID_HEART);
mtxScale = 16.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
break;
} else {
if (this->unk_15A < 0) {
if (this->unk_15A == -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->unk_15A = -2;
}
} else {
mtxScale = 16.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(globalCtx, GID_HEART);
GetItem_Draw(play, GID_HEART);
}
break;
}
@ -1091,7 +1091,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.shadowScale = 6.0f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
EnItem00_DrawCollectible(this, globalCtx);
EnItem00_DrawCollectible(this, play);
break;
}
@ -1102,7 +1102,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
GetItem_Draw(globalCtx, GID_BOMB);
GetItem_Draw(play, GID_BOMB);
break;
}
case ITEM00_BOMBS_B:
@ -1112,7 +1112,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
GetItem_Draw(globalCtx, GID_BOMB);
GetItem_Draw(play, GID_BOMB);
break;
}
case ITEM00_BOMBS_SPECIAL:
@ -1123,7 +1123,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
GetItem_Draw(globalCtx, GID_ARROWS_SMALL);
GetItem_Draw(play, GID_ARROWS_SMALL);
break;
}
case ITEM00_ARROWS_SMALL:
@ -1133,7 +1133,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
GetItem_Draw(globalCtx, GID_ARROWS_SMALL);
GetItem_Draw(play, GID_ARROWS_SMALL);
break;
}
case ITEM00_ARROWS_MEDIUM:
@ -1143,7 +1143,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
GetItem_Draw(globalCtx, GID_ARROWS_MEDIUM);
GetItem_Draw(play, GID_ARROWS_MEDIUM);
break;
}
case ITEM00_ARROWS_LARGE:
@ -1153,7 +1153,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
GetItem_Draw(globalCtx, GID_ARROWS_LARGE);
GetItem_Draw(play, GID_ARROWS_LARGE);
break;
}
case ITEM00_NUTS:
@ -1163,7 +1163,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
GetItem_Draw(globalCtx, GID_NUTS);
GetItem_Draw(play, GID_NUTS);
break;
}
case ITEM00_STICK:
@ -1173,7 +1173,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
GetItem_Draw(globalCtx, GID_STICK);
GetItem_Draw(play, GID_STICK);
break;
}
case ITEM00_MAGIC_LARGE:
@ -1183,7 +1183,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
GetItem_Draw(globalCtx, GID_MAGIC_LARGE);
GetItem_Draw(play, GID_MAGIC_LARGE);
break;
}
case ITEM00_MAGIC_SMALL:
@ -1193,7 +1193,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.shape.shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
GetItem_Draw(globalCtx, GID_MAGIC_SMALL);
GetItem_Draw(play, GID_MAGIC_SMALL);
break;
}
case ITEM00_SEEDS:
@ -1203,7 +1203,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.shape.shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
GetItem_Draw(globalCtx, GID_SEEDS);
GetItem_Draw(play, GID_SEEDS);
break;
}
case ITEM00_SMALL_KEY:
@ -1213,7 +1213,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.5f;
GetItem_Draw(globalCtx, GID_KEY_SMALL);
GetItem_Draw(play, GID_KEY_SMALL);
break;
} else {
Actor_SetScale(&this->actor, 0.03f);
@ -1224,7 +1224,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.world.rot.x = 0;
this->actor.shape.rot.y = 0;
}
EnItem00_DrawCollectible(this, globalCtx);
EnItem00_DrawCollectible(this, play);
break;
}
case ITEM00_BOMBCHU:
@ -1234,19 +1234,19 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
GetItem_Draw(globalCtx, GID_BOMBCHU);
GetItem_Draw(play, GID_BOMBCHU);
break;
case ITEM00_SHIELD_DEKU:
GetItem_Draw(globalCtx, GID_SHIELD_DEKU);
GetItem_Draw(play, GID_SHIELD_DEKU);
break;
case ITEM00_SHIELD_HYLIAN:
GetItem_Draw(globalCtx, GID_SHIELD_HYLIAN);
GetItem_Draw(play, GID_SHIELD_HYLIAN);
break;
case ITEM00_TUNIC_ZORA:
GetItem_Draw(globalCtx, GID_TUNIC_ZORA);
GetItem_Draw(play, GID_TUNIC_ZORA);
break;
case ITEM00_TUNIC_GORON:
GetItem_Draw(globalCtx, GID_TUNIC_GORON);
GetItem_Draw(play, GID_TUNIC_GORON);
break;
case ITEM00_FLEXIBLE:
break;
@ -1254,7 +1254,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
}
void EnItem00_CustomItemsParticles(Actor* Parent, GlobalContext* globalCtx, GetItemEntry giEntry) {
void EnItem00_CustomItemsParticles(Actor* Parent, PlayState* play, GetItemEntry giEntry) {
s16 color_slot;
switch (giEntry.modIndex) {
case MOD_NONE:
@ -1351,20 +1351,20 @@ void EnItem00_CustomItemsParticles(Actor* Parent, GlobalContext* globalCtx, GetI
pos.z = Rand_CenteredFloat(32.0f) + Parent->world.pos.z;
EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 1000, 50);
EffectSsKiraKira_SpawnDispersed(play, &pos, &velocity, &accel, &primColor, &envColor, 1000, 50);
}
/**
* Draw Function used for Rupee types of En_Item00.
*/
void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx) {
void EnItem00_DrawRupee(EnItem00* this, PlayState* play) {
s32 pad;
s32 texIndex;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
func_8002EBCC(&this->actor, globalCtx, 0);
func_80093D18(play->state.gfxCtx);
func_8002EBCC(&this->actor, play, 0);
if (this->actor.params <= ITEM00_RUPEE_RED) {
texIndex = this->actor.params;
@ -1372,31 +1372,31 @@ void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx) {
texIndex = this->actor.params - 0x10;
}
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sRupeeTex[texIndex]));
gSPDisplayList(POLY_OPA_DISP++, gRupeeDL);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* Draw Function used for most collectible types of En_Item00 (ammo, bombs, sticks, nuts, magic...).
*/
void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx) {
void EnItem00_DrawCollectible(EnItem00* this, PlayState* play) {
if (gSaveContext.n64ddFlag && (this->getItemId != GI_NONE || this->actor.params == ITEM00_SMALL_KEY)) {
f32 mtxScale = 16.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
EnItem00_CustomItemsParticles(&this->actor, globalCtx, this->randoGiEntry);
GetItemEntry_Draw(globalCtx, this->randoGiEntry);
EnItem00_CustomItemsParticles(&this->actor, play, this->randoGiEntry);
GetItemEntry_Draw(play, this->randoGiEntry);
} else {
s32 texIndex = this->actor.params - 3;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP);
POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
if (this->actor.params == ITEM00_BOMBS_SPECIAL) {
texIndex = 1;
@ -1411,58 +1411,58 @@ void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sItemDropTex[texIndex]));
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, gItemDropDL);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
}
/**
* Draw Function used for the Heart Container type of En_Item00.
*/
void EnItem00_DrawHeartContainer(EnItem00* this, GlobalContext* globalCtx) {
void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play) {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D18(globalCtx->state.gfxCtx);
func_8002EBCC(&this->actor, globalCtx, 0);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D18(play->state.gfxCtx);
func_8002EBCC(&this->actor, play, 0);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, gHeartPieceExteriorDL);
func_80093D84(globalCtx->state.gfxCtx);
func_8002ED80(&this->actor, globalCtx, 0);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D84(play->state.gfxCtx);
func_8002ED80(&this->actor, play, 0);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, gHeartContainerInteriorDL);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* Draw Function used for the Piece of Heart type of En_Item00.
*/
void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx) {
void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play) {
if (gSaveContext.n64ddFlag) {
f32 mtxScale = 16.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
EnItem00_CustomItemsParticles(&this->actor, globalCtx, this->randoGiEntry);
GetItemEntry_Draw(globalCtx, this->randoGiEntry);
EnItem00_CustomItemsParticles(&this->actor, play, this->randoGiEntry);
GetItemEntry_Draw(play, this->randoGiEntry);
} else {
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
func_80093D84(globalCtx->state.gfxCtx);
func_8002ED80(&this->actor, globalCtx, 0);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80093D84(play->state.gfxCtx);
func_8002ED80(&this->actor, play, 0);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, gHeartPieceInteriorDL);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
}
@ -1538,7 +1538,7 @@ s16 func_8001F404(s16 dropId) {
// External functions used by other actors to drop collectibles, which usually results in spawning an En_Item00 actor.
EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params) {
EnItem00* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, s16 params) {
s32 pad[2];
EnItem00* spawnedActor = NULL;
s16 param4000 = params & 0x4000;
@ -1551,9 +1551,9 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa
if (((params & 0x00FF) == ITEM00_FLEXIBLE) && !param4000) {
// TODO: Prevent the cast to EnItem00 here since this is a different actor (En_Elf)
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x,
spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x,
spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, FAIRY_HEAL_TIMED);
EffectSsDeadSound_SpawnStationary(globalCtx, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true,
EffectSsDeadSound_SpawnStationary(play, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true,
DEADSOUND_REPEAT_MODE_OFF, 40);
} else {
if (!param8000) {
@ -1561,7 +1561,7 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa
}
if (params != -1) {
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x,
spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x,
spawnPos->y, spawnPos->z, 0, 0, 0, params | param8000 | param3F00);
if ((spawnedActor != NULL) && !param8000) {
spawnedActor->actor.velocity.y = !param4000 ? 8.0f : -2.0f;
@ -1583,7 +1583,7 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa
return spawnedActor;
}
EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params) {
EnItem00* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s16 params) {
EnItem00* spawnedActor = NULL;
s32 pad;
s16 param4000 = params & 0x4000;
@ -1596,14 +1596,14 @@ EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 p
if (((params & 0x00FF) == ITEM00_FLEXIBLE) && !param4000) {
// TODO: Prevent the cast to EnItem00 here since this is a different actor (En_Elf)
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x,
spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x,
spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, FAIRY_HEAL_TIMED);
EffectSsDeadSound_SpawnStationary(globalCtx, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true,
EffectSsDeadSound_SpawnStationary(play, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true,
DEADSOUND_REPEAT_MODE_OFF, 40);
} else {
params = func_8001F404(params & 0x00FF);
if (params != -1) {
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x,
spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x,
spawnPos->y, spawnPos->z, 0, 0, 0, params | param8000 | param3F00);
if ((spawnedActor != NULL) && !param8000) {
spawnedActor->actor.velocity.y = 0.0f;
@ -1618,7 +1618,7 @@ EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 p
return spawnedActor;
}
void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3f* spawnPos, s16 params) {
void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnPos, s16 params) {
s32 pad;
EnItem00* spawnedActor;
s16 dropQuantity;
@ -1667,9 +1667,9 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
if (dropId == ITEM00_FLEXIBLE) {
if (gSaveContext.health <= 0x10) { // 1 heart or less
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0,
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0,
0, 0, FAIRY_HEAL_TIMED);
EffectSsDeadSound_SpawnStationary(globalCtx, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true,
EffectSsDeadSound_SpawnStationary(play, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true,
DEADSOUND_REPEAT_MODE_OFF, 40);
return;
} else if (gSaveContext.health <= 0x30 && !CVar_GetS32("gNoHeartDrops", 0)) { // 3 hearts or less
@ -1715,7 +1715,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
if (!param8000) {
dropId = func_8001F404(dropId);
if (dropId != 0xFF) {
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x,
spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x,
spawnPos->y, spawnPos->z, 0, 0, 0, dropId);
if ((spawnedActor != NULL) && (dropId != 0xFF)) {
spawnedActor->actor.velocity.y = 8.0f;
@ -1734,7 +1734,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
}
}
} else {
Item_DropCollectible(globalCtx, spawnPos, params | 0x8000);
Item_DropCollectible(play, spawnPos, params | 0x8000);
}
dropQuantity--;
}

View File

@ -63,8 +63,8 @@ u16 sReactionTextIds[][PLAYER_MASK_MAX] = {
{ 0x0000, 0x7104, 0x7105, 0x7107, 0x7105, 0x710C, 0x7105, 0x7107, 0x7107 },
};
u16 Text_GetFaceReaction(GlobalContext* globalCtx, u32 reactionSet) {
u8 currentMask = Player_GetMask(globalCtx);
u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet) {
u8 currentMask = Player_GetMask(play);
return sReactionTextIds[reactionSet][currentMask];
}

View File

@ -11,7 +11,7 @@ void SkelCurve_Clear(SkelAnimeCurve* skelCurve) {
skelCurve->unk_0C = 0.0f;
}
s32 SkelCurve_Init(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, SkelCurveLimbList* limbListSeg,
s32 SkelCurve_Init(PlayState* play, SkelAnimeCurve* skelCurve, SkelCurveLimbList* limbListSeg,
TransformUpdateIndex* transUpdIdx) {
if (ResourceMgr_OTRSigCheck(limbListSeg))
@ -29,7 +29,7 @@ s32 SkelCurve_Init(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, SkelCurv
return 1;
}
void SkelCurve_Destroy(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve) {
void SkelCurve_Destroy(PlayState* play, SkelAnimeCurve* skelCurve) {
if (skelCurve->transforms != NULL) {
ZELDA_ARENA_FREE_DEBUG(skelCurve->transforms);
}
@ -44,7 +44,7 @@ void SkelCurve_SetAnim(SkelAnimeCurve* skelCurve, TransformUpdateIndex* transUpd
skelCurve->transUpdIdx = transUpdIdx;
}
s32 SkelCurve_Update(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve) {
s32 SkelCurve_Update(PlayState* play, SkelAnimeCurve* skelCurve) {
s16* transforms;
u8* transformRefIdx;
TransformUpdateIndex* transformIndex;
@ -99,16 +99,16 @@ s32 SkelCurve_Update(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve) {
return ret;
}
void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve* skelCurve,
void SkelCurve_DrawLimb(PlayState* play, s32 limbIndex, SkelAnimeCurve* skelCurve,
OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* data) {
SkelCurveLimb* limb = SEGMENTED_TO_VIRTUAL(skelCurve->limbList[limbIndex]);
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
Matrix_Push();
if (overrideLimbDraw == NULL ||
(overrideLimbDraw != NULL && overrideLimbDraw(globalCtx, skelCurve, limbIndex, data))) {
(overrideLimbDraw != NULL && overrideLimbDraw(play, skelCurve, limbIndex, data))) {
Vec3f scale;
Vec3s rot;
Vec3f pos;
@ -135,7 +135,7 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve*
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);
}
@ -144,13 +144,13 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve*
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);
}
@ -161,25 +161,25 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve*
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, skelCurve, limbIndex, data);
postLimbDraw(play, skelCurve, limbIndex, data);
}
if (limb->firstChildIdx != LIMB_DONE) {
SkelCurve_DrawLimb(globalCtx, limb->firstChildIdx, skelCurve, overrideLimbDraw, postLimbDraw, lod, data);
SkelCurve_DrawLimb(play, limb->firstChildIdx, skelCurve, overrideLimbDraw, postLimbDraw, lod, data);
}
Matrix_Pop();
if (limb->nextLimbIdx != LIMB_DONE) {
SkelCurve_DrawLimb(globalCtx, limb->nextLimbIdx, skelCurve, overrideLimbDraw, postLimbDraw, lod, data);
SkelCurve_DrawLimb(play, limb->nextLimbIdx, skelCurve, overrideLimbDraw, postLimbDraw, lod, data);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void SkelCurve_Draw(Actor* actor, GlobalContext* globalCtx, SkelAnimeCurve* skelCurve,
void SkelCurve_Draw(Actor* actor, PlayState* play, SkelAnimeCurve* skelCurve,
OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* data) {
if (skelCurve->transforms != NULL) {
SkelCurve_DrawLimb(globalCtx, 0, skelCurve, overrideLimbDraw, postLimbDraw, lod, data);
SkelCurve_DrawLimb(play, 0, skelCurve, overrideLimbDraw, postLimbDraw, lod, data);
}
}

View File

@ -15,7 +15,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(Gameplay_Init, Gameplay_Destroy, sizeof(GlobalContext)),
GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Destroy, sizeof(PlayState)),
GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)),
GAMESTATE_OVERLAY(file_choose, FileChoose_Init, FileChoose_Destroy, sizeof(FileChooseContext)),
};

View File

@ -1,23 +1,23 @@
#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_FadeInLights(GlobalContext* globalCtx) {
GameOverContext* gameOverCtx = &globalCtx->gameOverCtx;
void GameOver_FadeInLights(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)) {
Environment_FadeInGameOverLights(globalCtx);
Environment_FadeInGameOverLights(play);
}
}
// This variable cannot be moved into this file as all of z_message_PAL rodata is in the way
extern s16 gGameOverTimer;
void GameOver_Update(GlobalContext* globalCtx) {
GameOverContext* gameOverCtx = &globalCtx->gameOverCtx;
void GameOver_Update(PlayState* play) {
GameOverContext* gameOverCtx = &play->gameOverCtx;
s16 i;
s16 j;
s32 v90;
@ -26,7 +26,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
switch (gameOverCtx->state) {
case GAMEOVER_DEATH_START:
Message_CloseTextbox(globalCtx);
Message_CloseTextbox(play);
gSaveContext.timer1State = 0;
gSaveContext.timer2State = 0;
@ -42,7 +42,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
for (j = 1; j < ARRAY_COUNT(gSaveContext.equips.buttonItems); j++) {
if (gSaveContext.equips.buttonItems[j] == gSpoilingItems[i]) {
gSaveContext.equips.buttonItems[j] = gSpoilingItemReverts[i];
Interface_LoadItemIcon1(globalCtx, j);
Interface_LoadItemIcon1(play, j);
}
}
}
@ -75,7 +75,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
}
gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = 0;
Environment_InitGameOverLights(globalCtx);
Environment_InitGameOverLights(play);
gGameOverTimer = 20;
v90 = VREG(90);
v91 = VREG(91);
@ -94,7 +94,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
gGameOverTimer--;
if (gGameOverTimer == 0) {
globalCtx->pauseCtx.state = 8;
play->pauseCtx.state = 8;
gameOverCtx->state++;
func_800AA15C();
}
@ -103,7 +103,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
case GAMEOVER_REVIVE_START:
gameOverCtx->state++;
gGameOverTimer = 0;
Environment_InitGameOverLights(globalCtx);
Environment_InitGameOverLights(play);
ShrinkWindow_SetVal(0x20);
return;
@ -138,7 +138,7 @@ void GameOver_Update(GlobalContext* globalCtx) {
break;
case GAMEOVER_REVIVE_FADE_OUT:
Environment_FadeOutGameOverLights(globalCtx);
Environment_FadeOutGameOverLights(play);
gGameOverTimer--;
if (gGameOverTimer == 0) {

View File

@ -14,7 +14,7 @@ s32 func_8006CFC0(s32 scene) {
return 0;
}
void func_8006D074(GlobalContext* globalCtx) {
void func_8006D074(PlayState* play) {
gSaveContext.horseData.scene = SCENE_SPOT00;
gSaveContext.horseData.pos.x = -1840;
gSaveContext.horseData.pos.y = 72;
@ -22,7 +22,7 @@ void func_8006D074(GlobalContext* globalCtx) {
gSaveContext.horseData.angle = -27353;
}
void func_8006D0AC(GlobalContext* globalCtx) {
void func_8006D0AC(PlayState* play) {
if (gSaveContext.horseData.scene == SCENE_SPOT06) {
gSaveContext.horseData.scene = SCENE_SPOT06;
gSaveContext.horseData.pos.x = -2065;
@ -39,7 +39,7 @@ typedef struct {
/* 0x0A */ s16 type;
} HorseSpawn;
void func_8006D0EC(GlobalContext* globalCtx, Player* player) {
void func_8006D0EC(PlayState* play, Player* player) {
s32 i;
HorseSpawn horseSpawns[] = {
{ SCENE_SPOT00, -460, 100, 6640, 0, 2 }, { SCENE_SPOT06, -1929, -1025, 768, 0, 2 },
@ -48,30 +48,30 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) {
};
if ((AREG(6) != 0) && (Flags_GetEventChkInf(0x18) || (DREG(1) != 0))) {
player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, player->actor.world.pos.x,
player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, player->actor.world.pos.x,
player->actor.world.pos.y, player->actor.world.pos.z, player->actor.shape.rot.x,
player->actor.shape.rot.y, player->actor.shape.rot.z, 9);
ASSERT(player->rideActor != NULL);
Actor_MountHorse(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
gSaveContext.horseData.scene = globalCtx->sceneNum;
Actor_MountHorse(play, player, player->rideActor);
func_8002DE74(play, player);
gSaveContext.horseData.scene = play->sceneNum;
if (globalCtx->sceneNum == SCENE_SPOT12) {
if (play->sceneNum == SCENE_SPOT12) {
player->rideActor->room = -1;
}
} else if ((globalCtx->sceneNum == SCENE_SPOT12) && (gSaveContext.minigameState == 3)) {
} else if ((play->sceneNum == SCENE_SPOT12) && (gSaveContext.minigameState == 3)) {
Actor* horseActor;
gSaveContext.minigameState = 0;
horseActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 3586.0f, 1413.0f, -402.0f, 0, 0x4000, 0, 1);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 3586.0f, 1413.0f, -402.0f, 0, 0x4000, 0, 1);
horseActor->room = -1;
} else if ((gSaveContext.entranceIndex == 1230) && (gSaveContext.eventChkInf[1] & 0x100)) {
Actor* horseActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, -25.0f, 0.0f, -1600.0f, 0, -0x4000, 0, 1);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -25.0f, 0.0f, -1600.0f, 0, -0x4000, 0, 1);
ASSERT(horseActor != NULL);
} else if ((globalCtx->sceneNum == gSaveContext.horseData.scene) &&
} else if ((play->sceneNum == gSaveContext.horseData.scene) &&
(((Flags_GetEventChkInf(0x18) != 0) && (!gSaveContext.n64ddFlag ||
(gSaveContext.n64ddFlag && CHECK_QUEST_ITEM(QUEST_SONG_EPONA) &&
(INV_CONTENT(ITEM_OCARINA_FAIRY) != ITEM_NONE)))) || DREG(1) != 0)) {
@ -80,11 +80,11 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) {
DREG(1));
if (func_8006CFC0(gSaveContext.horseData.scene)) {
Actor* horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE,
gSaveContext.horseData.pos.x, gSaveContext.horseData.pos.y,
gSaveContext.horseData.pos.z, 0, gSaveContext.horseData.angle, 0, 1);
ASSERT(horseActor != NULL);
if (globalCtx->sceneNum == SCENE_SPOT12) {
if (play->sceneNum == SCENE_SPOT12) {
horseActor->room = -1;
}
} else {
@ -92,21 +92,21 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) {
// "Horse_SetNormal():%d set spot is no good."
osSyncPrintf("Horse_SetNormal():%d セットスポットまずいです。\n", gSaveContext.horseData.scene);
osSyncPrintf(VT_RST);
func_8006D074(globalCtx);
func_8006D074(play);
}
} else if ((globalCtx->sceneNum == SCENE_SPOT20) && !Flags_GetEventChkInf(0x18) && (DREG(1) == 0)) {
} else if ((play->sceneNum == SCENE_SPOT20) && !Flags_GetEventChkInf(0x18) && (DREG(1) == 0)) {
Actor* horseActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 0.0f, 0.0f, -500.0f, 0, 0, 0, 1);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 0.0f, 0.0f, -500.0f, 0, 0, 0, 1);
ASSERT(horseActor != NULL);
} else if (Flags_GetEventChkInf(0x18) || (DREG(1) != 0)) {
for (i = 0; i < ARRAY_COUNT(horseSpawns); i++) {
HorseSpawn* horseSpawn = &horseSpawns[i];
if (horseSpawn->scene == globalCtx->sceneNum) {
if (horseSpawn->scene == play->sceneNum) {
Actor* horseActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, horseSpawn->pos.x, horseSpawn->pos.y,
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, horseSpawn->pos.x, horseSpawn->pos.y,
horseSpawn->pos.z, 0, horseSpawn->angle, 0, horseSpawn->type);
ASSERT(horseActor != NULL);
if (globalCtx->sceneNum == SCENE_SPOT12) {
if (play->sceneNum == SCENE_SPOT12) {
horseActor->room = -1;
}
@ -114,8 +114,8 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) {
}
}
} else if (!Flags_GetEventChkInf(0x18)) {
if ((DREG(1) == 0) && (globalCtx->sceneNum == SCENE_SOUKO) && !IS_DAY) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 0.0f, 0.0f, -60.0f, 0, 0x7360, 0, 1);
if ((DREG(1) == 0) && (play->sceneNum == SCENE_SOUKO) && !IS_DAY) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 0.0f, 0.0f, -60.0f, 0, 0x7360, 0, 1);
}
}
}
@ -128,7 +128,7 @@ typedef struct {
/* 0x10 */ s16 type;
} struct_8011F9B8;
void func_8006D684(GlobalContext* globalCtx, Player* player) {
void func_8006D684(PlayState* play, Player* player) {
s32 pad;
s32 i;
Vec3s spawnPos;
@ -153,24 +153,24 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
spawnPos = spawnPositions[3];
}
player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, spawnPos.x, spawnPos.y,
player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, spawnPos.x, spawnPos.y,
spawnPos.z, 0, player->actor.world.rot.y, 0, 7);
ASSERT(player->rideActor != NULL);
Actor_MountHorse(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
gSaveContext.horseData.scene = globalCtx->sceneNum;
} else if ((globalCtx->sceneNum == SCENE_SPOT20) && ((gSaveContext.eventInf[0] & 0xF) == 6) &&
Actor_MountHorse(play, player, player->rideActor);
func_8002DE74(play, player);
gSaveContext.horseData.scene = play->sceneNum;
} else if ((play->sceneNum == SCENE_SPOT20) && ((gSaveContext.eventInf[0] & 0xF) == 6) &&
(Flags_GetEventChkInf(0x18) == 0) && (DREG(1) == 0)) {
player->rideActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 894.0f, 0.0f, -2084.0f, 0, -0x7FFF, 0, 5);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 894.0f, 0.0f, -2084.0f, 0, -0x7FFF, 0, 5);
ASSERT(player->rideActor != NULL);
Actor_MountHorse(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
gSaveContext.horseData.scene = globalCtx->sceneNum;
Actor_MountHorse(play, player, player->rideActor);
func_8002DE74(play, player);
gSaveContext.horseData.scene = play->sceneNum;
if (globalCtx->sceneNum == SCENE_SPOT12) {
if (play->sceneNum == SCENE_SPOT12) {
player->rideActor->room = -1;
}
} else {
@ -182,22 +182,22 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
};
for (i = 0; i < ARRAY_COUNT(D_8011F9B8); i++) {
if ((globalCtx->sceneNum == D_8011F9B8[i].scene) &&
if ((play->sceneNum == D_8011F9B8[i].scene) &&
(((void)0, gSaveContext.cutsceneIndex) == D_8011F9B8[i].cutsceneIndex)) {
if (D_8011F9B8[i].type == 7) {
if ((globalCtx->sceneNum == 99) && (((void)0, gSaveContext.cutsceneIndex) == 0xFFF1)) {
if ((play->sceneNum == 99) && (((void)0, gSaveContext.cutsceneIndex) == 0xFFF1)) {
D_8011F9B8[i].pos.x = player->actor.world.pos.x;
D_8011F9B8[i].pos.y = player->actor.world.pos.y;
D_8011F9B8[i].pos.z = player->actor.world.pos.z;
}
player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE,
D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0,
player->actor.world.rot.y, 0, D_8011F9B8[i].type);
ASSERT(player->rideActor != NULL);
Actor_MountHorse(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
Actor_MountHorse(play, player, player->rideActor);
func_8002DE74(play, player);
} else if ((D_8011F9B8[i].type == 5) || (D_8011F9B8[i].type == 6) || (D_8011F9B8[i].type == 8)) {
Vec3f sp54;
s32 temp = 0;
@ -206,7 +206,7 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
temp = 0x8000;
}
player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE,
D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0,
D_8011F9B8[i].angle, 0, D_8011F9B8[i].type | temp);
ASSERT(player->rideActor != NULL);
@ -217,16 +217,16 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
player->actor.shape.rot.x = player->actor.shape.rot.z = 0;
player->actor.shape.rot.y = D_8011F9B8[i].angle;
Actor_MountHorse(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
Actor_MountHorse(play, player, player->rideActor);
func_8002DE74(play, player);
sp54.x = player->actor.world.pos.x - 200.0f;
sp54.y = player->actor.world.pos.y + 100.0f;
sp54.z = player->actor.world.pos.z;
Gameplay_CameraSetAtEye(globalCtx, globalCtx->activeCamera, &player->actor.world.pos, &sp54);
Play_CameraSetAtEye(play, play->activeCamera, &player->actor.world.pos, &sp54);
} else {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x,
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x,
D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0,
D_8011F9B8[i].type);
}
@ -236,26 +236,26 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
}
}
void func_8006DC68(GlobalContext* globalCtx, Player* player) {
void func_8006DC68(PlayState* play, Player* player) {
if (LINK_IS_ADULT) {
if (!func_8006CFC0(gSaveContext.horseData.scene)) {
osSyncPrintf(VT_COL(RED, WHITE));
// "Horse_Set_Check():%d set spot is no good."
osSyncPrintf("Horse_Set_Check():%d セットスポットまずいです。\n", gSaveContext.horseData.scene);
osSyncPrintf(VT_RST);
func_8006D074(globalCtx);
func_8006D074(play);
}
if (func_8006CFC0(globalCtx->sceneNum)) {
if (func_8006CFC0(play->sceneNum)) {
if ((gSaveContext.sceneSetupIndex > 3) ||
((gSaveContext.entranceIndex == 0x028A || gSaveContext.entranceIndex == 0x028E ||
gSaveContext.entranceIndex == 0x0292 || gSaveContext.entranceIndex == 0x0476) &&
(gSaveContext.respawnFlag == 0)) ||
((globalCtx->sceneNum == SCENE_SPOT20) && ((gSaveContext.eventInf[0] & 0xF) == 6) &&
((play->sceneNum == SCENE_SPOT20) && ((gSaveContext.eventInf[0] & 0xF) == 6) &&
!Flags_GetEventChkInf(0x18) && (DREG(1) == 0))) {
func_8006D684(globalCtx, player);
func_8006D684(play, player);
} else {
func_8006D0EC(globalCtx, player);
func_8006D0EC(play, player);
}
}
}

View File

@ -46,7 +46,7 @@ void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl) {
}
}
void KaleidoManager_Init(GlobalContext* globalCtx) {
void KaleidoManager_Init(PlayState* play) {
ptrdiff_t largestSize = 0;
ptrdiff_t size;
u32 i;
@ -62,7 +62,7 @@ void KaleidoManager_Init(GlobalContext* globalCtx) {
osSyncPrintf("KaleidoArea の最大サイズは %d バイトを確保します\n", largestSize);
osSyncPrintf(VT_RST);
sKaleidoAreaPtr = GAMESTATE_ALLOC_MC(&globalCtx->state, largestSize);
sKaleidoAreaPtr = GAMESTATE_ALLOC_MC(&play->state, largestSize);
LOG_CHECK_NULL_POINTER("KaleidoArea_allocp", sKaleidoAreaPtr);
osSyncPrintf(VT_FGCOL(GREEN));

View File

@ -1,14 +1,14 @@
#include "global.h"
#include "vt.h"
void (*sKaleidoScopeUpdateFunc)(GlobalContext* globalCtx);
void (*sKaleidoScopeDrawFunc)(GlobalContext* globalCtx);
void (*sKaleidoScopeUpdateFunc)(PlayState* play);
void (*sKaleidoScopeDrawFunc)(PlayState* play);
f32 gBossMarkScale;
u32 D_8016139C;
PauseMapMarksData* gLoadedPauseMarkDataTable;
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];
@ -30,7 +30,7 @@ void KaleidoScopeCall_LoadPlayer() {
}
}
void KaleidoScopeCall_Init(GlobalContext* globalCtx) {
void KaleidoScopeCall_Init(PlayState* play) {
// "Kaleidoscope replacement construction"
osSyncPrintf("カレイド・スコープ入れ替え コンストラクト \n");
@ -42,19 +42,19 @@ void KaleidoScopeCall_Init(GlobalContext* globalCtx) {
LOG_ADDRESS("kaleido_scope_draw", KaleidoScope_Draw);
LOG_ADDRESS("kaleido_scope_draw_func", sKaleidoScopeDrawFunc);
KaleidoSetup_Init(globalCtx);
KaleidoSetup_Init(play);
}
void KaleidoScopeCall_Destroy(GlobalContext* globalCtx) {
void KaleidoScopeCall_Destroy(PlayState* play) {
// "Kaleidoscope replacement destruction"
osSyncPrintf("カレイド・スコープ入れ替え デストラクト \n");
KaleidoSetup_Destroy(globalCtx);
KaleidoSetup_Destroy(play);
}
void KaleidoScopeCall_Update(GlobalContext* globalCtx) {
void KaleidoScopeCall_Update(PlayState* play) {
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
PauseContext* pauseCtx = &globalCtx->pauseCtx;
PauseContext* pauseCtx = &play->pauseCtx;
if ((pauseCtx->state != 0) || (pauseCtx->debugState != 0)) {
if (pauseCtx->state == 1) {
@ -101,9 +101,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)) {
osSyncPrintf(VT_FGCOL(GREEN));
// "Kaleido area Kaleidoscope Emission"
osSyncPrintf("カレイド領域 カレイドスコープ排出\n");
@ -117,15 +117,15 @@ 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 <= 18))) {
if (((play->pauseCtx.state >= 4) && (play->pauseCtx.state <= 7)) ||
((play->pauseCtx.state >= 11) && (play->pauseCtx.state <= 18))) {
if (gKaleidoMgrCurOvl == kaleidoScopeOvl)
{
sKaleidoScopeDrawFunc(globalCtx);
sKaleidoScopeDrawFunc(play);
}
}
}

View File

@ -8,15 +8,15 @@ s16 sKaleidoSetupKscpPos1[] = { PAUSE_MAP, PAUSE_QUEST, PAUSE_EQUIP, PAUSE_ITEM
f32 sKaleidoSetupEyeX1[] = { -64.0f, 0.0f, 64.0f, 0.0f };
f32 sKaleidoSetupEyeZ1[] = { 0.0f, -64.0f, 0.0f, 64.0f };
void KaleidoSetup_Update(GlobalContext* globalCtx) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
Input* input = &globalCtx->state.input[0];
void KaleidoSetup_Update(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx;
Input* input = &play->state.input[0];
if (pauseCtx->state == 0 && pauseCtx->debugState == 0 && globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE &&
globalCtx->sceneLoadFlag == 0 && globalCtx->transitionMode == 0 && gSaveContext.cutsceneIndex < 0xFFF0 &&
gSaveContext.nextCutsceneIndex < 0xFFF0 && !Gameplay_InCsMode(globalCtx) &&
globalCtx->shootingGalleryStatus <= 1 && gSaveContext.unk_13F0 != 8 && gSaveContext.unk_13F0 != 9 &&
(globalCtx->sceneNum != SCENE_BOWLING || !Flags_GetSwitch(globalCtx, 0x38))) {
if (pauseCtx->state == 0 && pauseCtx->debugState == 0 && play->gameOverCtx.state == GAMEOVER_INACTIVE &&
play->sceneLoadFlag == 0 && play->transitionMode == 0 && gSaveContext.cutsceneIndex < 0xFFF0 &&
gSaveContext.nextCutsceneIndex < 0xFFF0 && !Play_InCsMode(play) &&
play->shootingGalleryStatus <= 1 && gSaveContext.unk_13F0 != 8 && gSaveContext.unk_13F0 != 9 &&
(play->sceneNum != SCENE_BOWLING || !Flags_GetSwitch(play, 0x38))) {
if (CVar_GetS32("gCheatEasyPauseBufferFrameAdvance", 0) == 2 && !CHECK_BTN_ALL(input->press.button, BTN_START)) {
CVar_SetS32("gCheatEasyPauseBufferFrameAdvance", 0);
@ -71,8 +71,8 @@ void KaleidoSetup_Update(GlobalContext* globalCtx) {
}
}
void KaleidoSetup_Init(GlobalContext* globalCtx) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
void KaleidoSetup_Init(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx;
u64 temp = 0; // Necessary to match
pauseCtx->state = 0;
@ -124,8 +124,8 @@ void KaleidoSetup_Init(GlobalContext* globalCtx) {
pauseCtx->ocarinaSongIdx = -1;
pauseCtx->cursorSpecialPos = 0;
View_Init(&pauseCtx->view, globalCtx->state.gfxCtx);
View_Init(&pauseCtx->view, play->state.gfxCtx);
}
void KaleidoSetup_Destroy(GlobalContext* globalCtx) {
void KaleidoSetup_Destroy(PlayState* play) {
}

File diff suppressed because it is too large Load Diff

View File

@ -123,8 +123,8 @@ s16 sBeatingHeartsDDEnv[3];
s16 sHeartsDDPrim[2][3];
s16 sHeartsDDEnv[2][3];
void HealthMeter_Init(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
void HealthMeter_Init(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
if (CVar_GetS32("gHudColors", 1) == 2) {
HeartInner = CVar_GetRGB("gCCHeartsPrim", HeartInner_ori);
HeartDDInner = CVar_GetRGB("gCCDDHeartsPrim", HeartDDInner_ori);
@ -169,8 +169,8 @@ void HealthMeter_Init(GlobalContext* globalCtx) {
sHeartsDDEnv[0][2] = sHeartsDDEnv[1][2] = HeartDDInner.b;
}
void HealthMeter_Update(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
void HealthMeter_Update(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
f32 factor = interfaceCtx->unk_1FE * 0.1f;
f32 ddFactor;
s32 type = 0;
@ -328,13 +328,13 @@ void HealthMeter_Update(GlobalContext* globalCtx) {
}
s32 func_80078E18(GlobalContext* globalCtx) {
gSaveContext.health = globalCtx->interfaceCtx.unk_226;
s32 func_80078E18(PlayState* play) {
gSaveContext.health = play->interfaceCtx.unk_226;
return 1;
}
s32 func_80078E34(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
s32 func_80078E34(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
interfaceCtx->unk_228 = 0x140;
interfaceCtx->unk_226 += 0x10;
@ -347,8 +347,8 @@ s32 func_80078E34(GlobalContext* globalCtx) {
return 0;
}
s32 func_80078E84(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
s32 func_80078E84(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
if (interfaceCtx->unk_228 != 0) {
interfaceCtx->unk_228--;
@ -357,7 +357,7 @@ s32 func_80078E84(GlobalContext* globalCtx) {
interfaceCtx->unk_226 -= 0x10;
if (interfaceCtx->unk_226 <= 0) {
interfaceCtx->unk_226 = 0;
globalCtx->damagePlayer(globalCtx, -(gSaveContext.health + 1));
play->damagePlayer(play, -(gSaveContext.health + 1));
return 1;
}
}
@ -419,7 +419,7 @@ s16 getHealthMeterYOffset() {
}
}
void HealthMeter_Draw(GlobalContext* globalCtx) {
void HealthMeter_Draw(PlayState* play) {
s32 pad[5];
void* heartBgImg;
u32 curColorSet;
@ -431,8 +431,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
f32 temp2;
f32 temp3;
f32 temp4;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
GraphicsContext* gfxCtx = play->state.gfxCtx;
Vtx* sp154 = interfaceCtx->beatingHeartVtx;
s32 curHeartFraction = gSaveContext.health % 0x10;
s16 totalHeartCount = gSaveContext.healthCapacity / 0x10;
@ -673,16 +673,16 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
CLOSE_DISPS(gfxCtx);
}
void HealthMeter_HandleCriticalAlarm(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
void HealthMeter_HandleCriticalAlarm(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
if (interfaceCtx->unk_22C != 0) {
interfaceCtx->unk_22A--;
if (interfaceCtx->unk_22A <= 0) {
interfaceCtx->unk_22A = 0;
interfaceCtx->unk_22C = 0;
if (CVar_GetS32("gLowHpAlarm", 0) == 0 && !Player_InCsMode(globalCtx) && (globalCtx->pauseCtx.state == 0) &&
(globalCtx->pauseCtx.debugState == 0) && HealthMeter_IsCritical() && !Gameplay_InCsMode(globalCtx)) {
if (CVar_GetS32("gLowHpAlarm", 0) == 0 && !Player_InCsMode(play) && (play->pauseCtx.state == 0) &&
(play->pauseCtx.debugState == 0) && HealthMeter_IsCritical() && !Play_InCsMode(play)) {
func_80078884(NA_SE_SY_HITPOINT_ALARM);
}
}

View File

@ -205,8 +205,8 @@ s32 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);
LightContext_SetFog(lightCtx, 0, 0, 0, 996, 12800);
memset(&sLightsBuffer, 0, sizeof(sLightsBuffer));
@ -233,13 +233,13 @@ Lights* LightContext_NewLights(LightContext* lightCtx, GraphicsContext* gfxCtx)
return Lights_New(gfxCtx, lightCtx->ambientColor[0], lightCtx->ambientColor[1], lightCtx->ambientColor[2]);
}
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;
}
}
@ -250,7 +250,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* node;
node = Lights_FindBufSlot();
@ -270,7 +270,7 @@ LightNode* LightContext_InsertLight(GlobalContext* globalCtx, LightContext* ligh
return node;
}
void LightContext_RemoveLight(GlobalContext* globalCtx, LightContext* lightCtx, LightNode* node) {
void LightContext_RemoveLight(PlayState* play, LightContext* lightCtx, LightNode* node) {
if (node != NULL) {
if (node->prev != NULL) {
node->prev->next = node->next;
@ -326,7 +326,7 @@ Lights* Lights_New(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambient
return lights;
}
void Lights_GlowCheckPrepare(GlobalContext* globalCtx) {
void Lights_GlowCheckPrepare(PlayState* play) {
LightNode* node;
LightPoint* params;
Vec3f pos;
@ -335,7 +335,7 @@ void Lights_GlowCheckPrepare(GlobalContext* globalCtx) {
f32 wX;
f32 wY;
node = globalCtx->lightCtx.listHead;
node = play->lightCtx.listHead;
while (node != NULL) {
params = &node->info->params.point;
@ -348,7 +348,7 @@ void Lights_GlowCheckPrepare(GlobalContext* globalCtx) {
pos.x = params->x;
pos.y = params->y;
pos.z = params->z;
func_8002BE04(globalCtx, &pos, &multDest, &wDest);
func_8002BE04(play, &pos, &multDest, &wDest);
wX = multDest.x * wDest;
wY = multDest.y * wDest;
@ -364,7 +364,7 @@ void Lights_GlowCheckPrepare(GlobalContext* globalCtx) {
}
}
void Lights_GlowCheck(GlobalContext* globalCtx) {
void Lights_GlowCheck(PlayState* play) {
LightNode* node;
LightPoint* params;
Vec3f pos;
@ -375,7 +375,7 @@ void Lights_GlowCheck(GlobalContext* globalCtx) {
s32 wZ;
s32 zBuf;
node = globalCtx->lightCtx.listHead;
node = play->lightCtx.listHead;
while (node != NULL) {
params = &node->info->params.point;
@ -388,7 +388,7 @@ void Lights_GlowCheck(GlobalContext* globalCtx) {
pos.x = params->x;
pos.y = params->y;
pos.z = params->z;
func_8002BE04(globalCtx, &pos, &multDest, &wDest);
func_8002BE04(play, &pos, &multDest, &wDest);
params->drawGlow = false;
wX = multDest.x * wDest;
wY = multDest.y * wDest;
@ -410,13 +410,13 @@ void Lights_GlowCheck(GlobalContext* globalCtx) {
}
}
void Lights_DrawGlow(GlobalContext* globalCtx) {
void Lights_DrawGlow(PlayState* play) {
s32 pad;
LightNode* node;
node = globalCtx->lightCtx.listHead;
node = play->lightCtx.listHead;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
POLY_XLU_DISP = func_800947AC(POLY_XLU_DISP++);
gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE);
@ -439,7 +439,7 @@ void Lights_DrawGlow(GlobalContext* globalCtx) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, params->color[0], params->color[1], params->color[2], 50);
Matrix_Translate(params->x, params->y, params->z, MTXMODE_NEW);
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gGlowCircleDL);
FrameInterpolation_RecordCloseChild();
@ -448,5 +448,5 @@ void Lights_DrawGlow(GlobalContext* globalCtx) {
node = node->next;
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -17,17 +17,17 @@ s16 Left_MM_Margin = 0;
s16 Right_MM_Margin = 0;
s16 Bottom_MM_Margin = 0;
void Map_SavePlayerInitialInfo(GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void Map_SavePlayerInitialInfo(PlayState* play) {
Player* player = GET_PLAYER(play);
sPlayerInitialPosX = player->actor.world.pos.x;
sPlayerInitialPosZ = player->actor.world.pos.z;
sPlayerInitialDirection = (s16)((0x7FFF - player->actor.shape.rot.y) / 0x400);
}
void Map_SetPaletteData(GlobalContext* globalCtx, s16 room) {
void Map_SetPaletteData(PlayState* play, s16 room) {
s32 mapIndex = gSaveContext.mapIndex;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
s16 paletteIndex = gMapData->roomPalette[mapIndex][room];
if (interfaceCtx->mapRoomNum == room) {
@ -44,9 +44,9 @@ void Map_SetPaletteData(GlobalContext* globalCtx, s16 room) {
interfaceCtx->mapPalette[paletteIndex * 2 + 1] = 0xBF;
}
void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor) {
void Map_SetFloorPalettesData(PlayState* play, s16 floor) {
s32 mapIndex = gSaveContext.mapIndex;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
s16 room;
s16 i;
@ -60,7 +60,7 @@ void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor) {
interfaceCtx->mapPalette[31] = 1;
}
switch (globalCtx->sceneNum) {
switch (play->sceneNum) {
case SCENE_YDAN:
case SCENE_DDAN:
case SCENE_BDAN:
@ -82,7 +82,7 @@ void Map_SetFloorPalettesData(GlobalContext* globalCtx, s16 floor) {
for (i = 0; i < gMapData->maxPaletteCount[mapIndex]; i++) {
room = gMapData->paletteRoom[mapIndex][floor][i];
if ((room != 0xFF) && (gSaveContext.sceneFlags[mapIndex].rooms & gBitFlags[room])) {
Map_SetPaletteData(globalCtx, room);
Map_SetPaletteData(play, room);
}
}
break;
@ -360,12 +360,12 @@ const char* minimapTableDangeon[] =
gIceCavernRoom11MinimapTex,
};
void Map_InitData(GlobalContext* globalCtx, s16 room) {
void Map_InitData(PlayState* play, s16 room) {
s32 mapIndex = gSaveContext.mapIndex;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
s16 extendedMapIndex;
switch (globalCtx->sceneNum) {
switch (play->sceneNum) {
case SCENE_SPOT00:
case SCENE_SPOT01:
case SCENE_SPOT02:
@ -387,19 +387,19 @@ void Map_InitData(GlobalContext* globalCtx, s16 room) {
case SCENE_SPOT20:
case SCENE_GANON_TOU:
extendedMapIndex = mapIndex;
if (globalCtx->sceneNum == SCENE_SPOT02) {
if (play->sceneNum == SCENE_SPOT02) {
if (CHECK_QUEST_ITEM(QUEST_SONG_NOCTURNE)) {
extendedMapIndex = 0x14;
}
} else if (globalCtx->sceneNum == SCENE_SPOT06) {
} else if (play->sceneNum == SCENE_SPOT06) {
if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && !CHECK_QUEST_ITEM(QUEST_MEDALLION_WATER)) {
extendedMapIndex = 0x15;
}
} else if (globalCtx->sceneNum == SCENE_SPOT09) {
} else if (play->sceneNum == SCENE_SPOT09) {
if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && !((gSaveContext.eventChkInf[9] & 0xF) == 0xF)) {
extendedMapIndex = 0x16;
}
} else if (globalCtx->sceneNum == SCENE_SPOT12) {
} else if (play->sceneNum == SCENE_SPOT12) {
if ((gSaveContext.eventChkInf[9] & 0xF) == 0xF) {
extendedMapIndex = 0x17;
}
@ -414,7 +414,7 @@ void Map_InitData(GlobalContext* globalCtx, s16 room) {
if (sEntranceIconMapIndex < 24) {
const char* textureName = minimapTableOW[sEntranceIconMapIndex];
memcpy(globalCtx->interfaceCtx.mapSegment, ResourceMgr_LoadTexByName(textureName), ResourceMgr_LoadTexSizeByName(textureName));
memcpy(play->interfaceCtx.mapSegment, ResourceMgr_LoadTexByName(textureName), ResourceMgr_LoadTexSizeByName(textureName));
}
interfaceCtx->unk_258 = mapIndex;
@ -442,31 +442,31 @@ void Map_InitData(GlobalContext* globalCtx, s16 room) {
osSyncPrintf("デクの樹ダンジョンMAP テクスチャDMA(%x) scene_id_offset=%d VREG(30)=%d\n", room,
mapIndex, VREG(30));
osSyncPrintf(VT_RST);
//DmaMgr_SendRequest1(globalCtx->interfaceCtx.mapSegment,
//DmaMgr_SendRequest1(play->interfaceCtx.mapSegment,
//(uintptr_t)_map_i_staticSegmentRomStart +
//((gMapData->dgnMinimapTexIndexOffset[mapIndex] + room) * 0xFF0),
//0xFF0, __FILE__, __LINE__);
const char* textureName = minimapTableDangeon[gMapData->dgnMinimapTexIndexOffset[mapIndex] + room];
memcpy(globalCtx->interfaceCtx.mapSegment, ResourceMgr_LoadTexByName(textureName), ResourceMgr_LoadTexSizeByName(textureName));
memcpy(play->interfaceCtx.mapSegment, ResourceMgr_LoadTexByName(textureName), ResourceMgr_LoadTexSizeByName(textureName));
R_COMPASS_OFFSET_X = gMapData->roomCompassOffsetX[mapIndex][room];
R_COMPASS_OFFSET_Y = gMapData->roomCompassOffsetY[mapIndex][room];
Map_SetFloorPalettesData(globalCtx, VREG(30));
Map_SetFloorPalettesData(play, VREG(30));
osSyncPrintf(" 各階ONチェック\n"); // "MAP Individual Floor ON Check"
break;
}
}
void Map_InitRoomData(GlobalContext* globalCtx, s16 room) {
void Map_InitRoomData(PlayState* play, s16 room) {
s32 mapIndex = gSaveContext.mapIndex;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
osSyncPrintf("\n\nroom_no=%d (%d)(%d)\n\n\n", room,
mapIndex, globalCtx->sceneNum);
mapIndex, play->sceneNum);
if (room >= 0) {
switch (globalCtx->sceneNum) {
switch (play->sceneNum) {
case SCENE_YDAN:
case SCENE_DDAN:
case SCENE_BDAN:
@ -489,11 +489,11 @@ void Map_InitRoomData(GlobalContext* globalCtx, s16 room) {
osSyncPrintf("_%d\n", gSaveContext.sceneFlags[mapIndex].rooms);
interfaceCtx->mapRoomNum = room;
interfaceCtx->unk_25A = mapIndex;
Map_SetPaletteData(globalCtx, room);
Map_SetPaletteData(play, room);
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("部屋部屋=%d\n", room); // "Room Room = %d"
osSyncPrintf(VT_RST);
Map_InitData(globalCtx, room);
Map_InitData(play, room);
break;
}
} else {
@ -505,27 +505,27 @@ void Map_InitRoomData(GlobalContext* globalCtx, s16 room) {
}
}
void Map_Destroy(GlobalContext* globalCtx) {
MapMark_ClearPointers(globalCtx);
void Map_Destroy(PlayState* play) {
MapMark_ClearPointers(play);
gMapData = NULL;
}
void Map_Init(GlobalContext* globalCtx) {
void Map_Init(PlayState* play) {
s32 mapIndex = gSaveContext.mapIndex;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
gMapData = &gMapDataTable;
interfaceCtx->unk_258 = -1;
interfaceCtx->unk_25A = -1;
interfaceCtx->mapSegment = GAMESTATE_ALLOC_MC(&globalCtx->state, 0x1000);
interfaceCtx->mapSegment = GAMESTATE_ALLOC_MC(&play->state, 0x1000);
// " texture initialization scene_data_ID=%d mapSegment=%x"
osSyncPrintf("\n\n\n テクスチャ初期化 scene_data_ID=%d\nmapSegment=%x\n\n", globalCtx->sceneNum,
interfaceCtx->mapSegment, globalCtx);
osSyncPrintf("\n\n\n テクスチャ初期化 scene_data_ID=%d\nmapSegment=%x\n\n", play->sceneNum,
interfaceCtx->mapSegment, play);
ASSERT(interfaceCtx->mapSegment != NULL);
switch (globalCtx->sceneNum) {
switch (play->sceneNum) {
case SCENE_SPOT00:
case SCENE_SPOT01:
case SCENE_SPOT02:
@ -546,13 +546,13 @@ void Map_Init(GlobalContext* globalCtx) {
case SCENE_SPOT18:
case SCENE_SPOT20:
case SCENE_GANON_TOU:
mapIndex = globalCtx->sceneNum - SCENE_SPOT00;
mapIndex = play->sceneNum - SCENE_SPOT00;
R_MAP_INDEX = gSaveContext.mapIndex = mapIndex;
R_COMPASS_SCALE_X = gMapData->owCompassInfo[mapIndex][0];
R_COMPASS_SCALE_Y = gMapData->owCompassInfo[mapIndex][1];
R_COMPASS_OFFSET_X = gMapData->owCompassInfo[mapIndex][2];
R_COMPASS_OFFSET_Y = gMapData->owCompassInfo[mapIndex][3];
Map_InitData(globalCtx, mapIndex);
Map_InitData(play, mapIndex);
R_OW_MINIMAP_X = gMapData->owMinimapPosX[mapIndex];
R_OW_MINIMAP_Y = gMapData->owMinimapPosY[mapIndex];
break;
@ -582,24 +582,24 @@ void Map_Init(GlobalContext* globalCtx) {
case SCENE_JYASINBOSS:
case SCENE_HAKADAN_BS:
mapIndex =
(globalCtx->sceneNum >= SCENE_YDAN_BOSS) ? globalCtx->sceneNum - SCENE_YDAN_BOSS : globalCtx->sceneNum;
(play->sceneNum >= SCENE_YDAN_BOSS) ? play->sceneNum - SCENE_YDAN_BOSS : play->sceneNum;
R_MAP_INDEX = gSaveContext.mapIndex = mapIndex;
if ((globalCtx->sceneNum <= SCENE_ICE_DOUKUTO) || (globalCtx->sceneNum >= SCENE_YDAN_BOSS)) {
if ((play->sceneNum <= SCENE_ICE_DOUKUTO) || (play->sceneNum >= SCENE_YDAN_BOSS)) {
R_COMPASS_SCALE_X = gMapData->dgnCompassInfo[mapIndex][0];
R_COMPASS_SCALE_Y = gMapData->dgnCompassInfo[mapIndex][1];
R_COMPASS_OFFSET_X = gMapData->dgnCompassInfo[mapIndex][2];
R_COMPASS_OFFSET_Y = gMapData->dgnCompassInfo[mapIndex][3];
R_MAP_TEX_INDEX = R_MAP_TEX_INDEX_BASE = gMapData->dgnMinimapTexIndexBase[mapIndex];
Map_InitRoomData(globalCtx, globalCtx->roomCtx.curRoom.num);
MapMark_Init(globalCtx);
Map_InitRoomData(play, play->roomCtx.curRoom.num);
MapMark_Init(play);
}
break;
}
}
void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
void Minimap_DrawCompassIcons(PlayState* play) {
s32 pad;
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
s16 tempX, tempZ;
const Color_RGB8 LastEntrance_arrow = { 200, 0, 0 };
const Color_RGB8 CurrentPosition_arrow = { 200, 255, 0 };
@ -613,10 +613,10 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
Y_Margins_Minimap = 0;
}
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
if (globalCtx->interfaceCtx.minimapAlpha >= 0xAA) {
func_80094A14(globalCtx->state.gfxCtx);
if (play->interfaceCtx.minimapAlpha >= 0xAA) {
func_80094A14(play->state.gfxCtx);
//Player current position (yellow arrow)
gSPMatrix(OVERLAY_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@ -656,7 +656,7 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
Matrix_RotateX(-1.6f, MTXMODE_APPLY);
tempX = (0x7FFF - player->actor.shape.rot.y) / 0x400;
Matrix_RotateY(tempX / 10.0f, MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (CVar_GetS32("gHudColors", 1) == 2) {
@ -697,7 +697,7 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
Matrix_Scale(VREG(9) / 100.0f, VREG(9) / 100.0f, VREG(9) / 100.0f, MTXMODE_APPLY);
Matrix_RotateX(VREG(52) / 10.0f, MTXMODE_APPLY);
Matrix_RotateY(sPlayerInitialDirection / 10.0f, MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (CVar_GetS32("gHudColors", 1) == 2) {
@ -708,24 +708,24 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
gSPDisplayList(OVERLAY_DISP++, gCompassArrowDL);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void Minimap_Draw(GlobalContext* globalCtx) {
void Minimap_Draw(PlayState* play) {
s32 pad[2];
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
s32 mapIndex = gSaveContext.mapIndex;
const Color_RGB8 Dungeon_minimap = {100, 255, 255};
const Color_RGB8 Overworld_minimap = {R_MINIMAP_COLOR(0), R_MINIMAP_COLOR(1), R_MINIMAP_COLOR(2)};
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
// If any of these CVars are enabled, disable toggling the minimap with L, unless gEnableMapToggle is set
bool enableMapToggle =
!(CVar_GetS32("gDebugEnabled", 0) || CVar_GetS32("gMoonJumpOnL", 0) || CVar_GetS32("gTurboOnL", 0)) ||
CVar_GetS32("gEnableMapToggle", 0);
if (globalCtx->pauseCtx.state < 4) {
if (play->pauseCtx.state < 4) {
//Minimap margins
s16 X_Margins_Minimap;
s16 Y_Margins_Minimap;
@ -737,7 +737,7 @@ void Minimap_Draw(GlobalContext* globalCtx) {
Y_Margins_Minimap = 0;
}
switch (globalCtx->sceneNum) {
switch (play->sceneNum) {
case SCENE_YDAN:
case SCENE_DDAN:
case SCENE_BDAN:
@ -749,7 +749,7 @@ void Minimap_Draw(GlobalContext* globalCtx) {
case SCENE_HAKADANCH:
case SCENE_ICE_DOUKUTO:
if (!R_MINIMAP_DISABLED) {
func_80094520(globalCtx->state.gfxCtx);
func_80094520(play->state.gfxCtx);
gDPSetCombineLERP(OVERLAY_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0,
TEXEL0, 0, PRIMITIVE, 0);
@ -787,14 +787,14 @@ void Minimap_Draw(GlobalContext* globalCtx) {
}
if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, mapIndex)) {
Minimap_DrawCompassIcons(globalCtx); // Draw icons for the player spawn and current position
func_80094520(globalCtx->state.gfxCtx);
MapMark_Draw(globalCtx);
Minimap_DrawCompassIcons(play); // Draw icons for the player spawn and current position
func_80094520(play->state.gfxCtx);
MapMark_Draw(play);
}
}
if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Gameplay_InCsMode(globalCtx) && enableMapToggle) {
osSyncPrintf("Game_play_demo_mode_check=%d\n", Gameplay_InCsMode(globalCtx));
if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_L) && !Play_InCsMode(play) && enableMapToggle) {
osSyncPrintf("Game_play_demo_mode_check=%d\n", Play_InCsMode(play));
// clang-format off
if (!R_MINIMAP_DISABLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &D_801333D4, 4,
&D_801333E0, &D_801333E0, &D_801333E8); }
@ -826,7 +826,7 @@ void Minimap_Draw(GlobalContext* globalCtx) {
case SCENE_SPOT20:
case SCENE_GANON_TOU:
if (!R_MINIMAP_DISABLED) {
func_80094520(globalCtx->state.gfxCtx);
func_80094520(play->state.gfxCtx);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
if (CVar_GetS32("gHudColors", 1) == 2) {//Overworld minimap
@ -865,8 +865,8 @@ void Minimap_Draw(GlobalContext* globalCtx) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, Overworld_minimap.r, Overworld_minimap.g, Overworld_minimap.b, interfaceCtx->minimapAlpha);
}
if (((globalCtx->sceneNum != SCENE_SPOT01) && (globalCtx->sceneNum != SCENE_SPOT04) &&
(globalCtx->sceneNum != SCENE_SPOT08)) ||
if (((play->sceneNum != SCENE_SPOT01) && (play->sceneNum != SCENE_SPOT04) &&
(play->sceneNum != SCENE_SPOT08)) ||
(LINK_AGE_IN_YEARS != YEARS_ADULT)) {
bool Map0 = gMapData->owEntranceIconPosY[sEntranceIconMapIndex] << 2 == 0;
s16 IconSize = 8;
@ -941,13 +941,13 @@ void Minimap_Draw(GlobalContext* globalCtx) {
}
}
if ((globalCtx->sceneNum == SCENE_SPOT08) && (gSaveContext.infTable[26] & gBitFlags[9])) {
if ((play->sceneNum == SCENE_SPOT08) && (gSaveContext.infTable[26] & gBitFlags[9])) {
gDPLoadTextureBlock(OVERLAY_DISP++, gMapDungeonEntranceIconTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8,
8, 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);
gSPWideTextureRectangle(OVERLAY_DISP++, entranceX << 2, entranceY << 2, (entranceX + 32) << 2, (entranceY + 8) << 2,
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
} else if ((globalCtx->sceneNum == SCENE_SPOT08) && CVar_GetS32("gAlwaysShowDungeonMinimapIcon", 0) != 0){
} else if ((play->sceneNum == SCENE_SPOT08) && CVar_GetS32("gAlwaysShowDungeonMinimapIcon", 0) != 0){
gDPLoadTextureBlock(OVERLAY_DISP++, gMapDungeonEntranceIconTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8,
8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
@ -957,10 +957,10 @@ void Minimap_Draw(GlobalContext* globalCtx) {
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
}
Minimap_DrawCompassIcons(globalCtx); // Draw icons for the player spawn and current position
Minimap_DrawCompassIcons(play); // Draw icons for the player spawn and current position
}
if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Gameplay_InCsMode(globalCtx) && enableMapToggle) {
if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_L) && !Play_InCsMode(play) && enableMapToggle) {
// clang-format off
if (!R_MINIMAP_DISABLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &D_801333D4, 4,
&D_801333E0, &D_801333E0, &D_801333E8); }
@ -974,18 +974,18 @@ void Minimap_Draw(GlobalContext* globalCtx) {
}
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
s16 Map_GetFloorTextIndexOffset(s32 mapIndex, s32 floor) {
return gMapData->floorTexIndexOffset[mapIndex][floor];
}
void Map_Update(GlobalContext* globalCtx) {
void Map_Update(PlayState* play) {
static s16 sLastRoomNum = 99;
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
s32 mapIndex = gSaveContext.mapIndex;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
s16 floor;
s16 i;
@ -994,8 +994,8 @@ void Map_Update(GlobalContext* globalCtx) {
Right_MM_Margin = CVar_GetS32("gHUDMargin_R", 0);
Bottom_MM_Margin = CVar_GetS32("gHUDMargin_B", 0);
if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0)) {
switch (globalCtx->sceneNum) {
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) {
switch (play->sceneNum) {
case SCENE_YDAN:
case SCENE_DDAN:
case SCENE_BDAN:
@ -1040,9 +1040,9 @@ void Map_Update(GlobalContext* globalCtx) {
// "Layer switching = %x"
osSyncPrintf("階層切替=%x\n", interfaceCtx->mapRoomNum);
osSyncPrintf(VT_RST);
Map_InitData(globalCtx, interfaceCtx->mapRoomNum);
Map_InitData(play, interfaceCtx->mapRoomNum);
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
Map_SavePlayerInitialInfo(globalCtx);
Map_SavePlayerInitialInfo(play);
}
}
@ -1056,9 +1056,9 @@ void Map_Update(GlobalContext* globalCtx) {
case SCENE_MIZUSIN_BS:
case SCENE_JYASINBOSS:
case SCENE_HAKADAN_BS:
VREG(30) = gMapData->bossFloor[globalCtx->sceneNum - SCENE_YDAN_BOSS];
VREG(30) = gMapData->bossFloor[play->sceneNum - SCENE_YDAN_BOSS];
R_MAP_TEX_INDEX = R_MAP_TEX_INDEX_BASE +
gMapData->floorTexIndexOffset[globalCtx->sceneNum - SCENE_YDAN_BOSS][VREG(30)];
gMapData->floorTexIndexOffset[play->sceneNum - SCENE_YDAN_BOSS][VREG(30)];
break;
}
}

View File

@ -54,11 +54,11 @@ static MapMarkInfo sMapMarkInfoTable[] = {
MapMarkData** sLoadedMarkDataTable;
void MapMark_Init(GlobalContext* globalCtx) {
void MapMark_Init(PlayState* play) {
//MapMarkDataOverlay* overlay = &sMapMarkDataOvl;
//u32 overlaySize = (uintptr_t)overlay->vramEnd - (uintptr_t)overlay->vramStart;
//overlay->loadedRamAddr = GAMESTATE_ALLOC_MC(&globalCtx->state, overlaySize);
//overlay->loadedRamAddr = GAMESTATE_ALLOC_MC(&play->state, overlaySize);
//LOG_CHECK_NULL_POINTER("dlftbl->allocp", overlay->loadedRamAddr);
//Overlay_Load(overlay->vromStart, overlay->vromEnd, overlay->vramStart, overlay->vramEnd, overlay->loadedRamAddr);
@ -75,12 +75,12 @@ void MapMark_Init(GlobalContext* globalCtx) {
//: NULL);
}
void MapMark_ClearPointers(GlobalContext* globalCtx) {
void MapMark_ClearPointers(PlayState* play) {
//sMapMarkDataOvl.loadedRamAddr = NULL;
sLoadedMarkDataTable = NULL;
}
void MapMark_DrawForDungeon(GlobalContext* globalCtx) {
void MapMark_DrawForDungeon(PlayState* play) {
InterfaceContext* interfaceCtx;
MapMarkIconData* mapMarkIconData;
MapMarkPoint* markPoint;
@ -90,18 +90,18 @@ void MapMark_DrawForDungeon(GlobalContext* globalCtx) {
s32 rectLeft;
s32 rectTop;
interfaceCtx = &globalCtx->interfaceCtx;
interfaceCtx = &play->interfaceCtx;
if ((gMapData != NULL) && (globalCtx->interfaceCtx.mapRoomNum >= gMapData->dgnMinimapCount[dungeon])) {
if ((gMapData != NULL) && (play->interfaceCtx.mapRoomNum >= gMapData->dgnMinimapCount[dungeon])) {
// "Room number exceeded, yikes %d/%d MapMarkDraw processing interrupted"
osSyncPrintf(VT_COL(RED, WHITE) "部屋番号がオーバーしてるで,ヤバイで %d/%d \nMapMarkDraw の処理を中断します\n",
VT_RST, globalCtx->interfaceCtx.mapRoomNum, gMapData->dgnMinimapCount[dungeon]);
VT_RST, play->interfaceCtx.mapRoomNum, gMapData->dgnMinimapCount[dungeon]);
return;
}
mapMarkIconData = &sLoadedMarkDataTable[dungeon][interfaceCtx->mapRoomNum][0];
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
while (true) {
if (mapMarkIconData->markType == MAP_MARK_NONE) {
@ -131,7 +131,7 @@ void MapMark_DrawForDungeon(GlobalContext* globalCtx) {
markPoint = &mapMarkIconData->points[0];
//Place each chest / boss room icon
for (i = 0; i < mapMarkIconData->count; i++) {
if ((mapMarkIconData->markType != MAP_MARK_CHEST) || !Flags_GetTreasure(globalCtx, markPoint->chestFlag)) {
if ((mapMarkIconData->markType != MAP_MARK_CHEST) || !Flags_GetTreasure(play, markPoint->chestFlag)) {
//Minimap chest / boss icon
const s32 PosX_Minimap_ori = GREG(94) + OTRGetRectDimensionFromRightEdge(markPoint->x+X_Margins_Minimap_ic) + 204;
const s32 PosY_Minimap_ori = GREG(95) + markPoint->y + Y_Margins_Minimap_ic + 140;
@ -139,10 +139,10 @@ void MapMark_DrawForDungeon(GlobalContext* globalCtx) {
rectTop = (markPoint->y + Y_Margins_Minimap_ic + 140 + CVar_GetS32("gMinimapPosY", 0));
if (CVar_GetS32("gMinimapPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap_ic = Left_MC_Margin;};
if (globalCtx->sceneNum == SCENE_YDAN || globalCtx->sceneNum == SCENE_DDAN || globalCtx->sceneNum == SCENE_BDAN ||
globalCtx->sceneNum == SCENE_BMORI1 || globalCtx->sceneNum == SCENE_HIDAN || globalCtx->sceneNum == SCENE_MIZUSIN ||
globalCtx->sceneNum == SCENE_JYASINZOU || globalCtx->sceneNum == SCENE_HAKADAN || globalCtx->sceneNum == SCENE_HAKADANCH ||
globalCtx->sceneNum == SCENE_ICE_DOUKUTO) {
if (play->sceneNum == SCENE_YDAN || play->sceneNum == SCENE_DDAN || play->sceneNum == SCENE_BDAN ||
play->sceneNum == SCENE_BMORI1 || play->sceneNum == SCENE_HIDAN || play->sceneNum == SCENE_MIZUSIN ||
play->sceneNum == SCENE_JYASINZOU || play->sceneNum == SCENE_HAKADAN || play->sceneNum == SCENE_HAKADANCH ||
play->sceneNum == SCENE_ICE_DOUKUTO) {
rectLeft = OTRGetRectDimensionFromLeftEdge(markPoint->x+CVar_GetS32("gMinimapPosX", 0)+204+X_Margins_Minimap_ic);
} else {
rectLeft = OTRGetRectDimensionFromLeftEdge(markPoint->x+CVar_GetS32("gMinimapPosX", 0)+204+X_Margins_Minimap_ic);
@ -183,11 +183,11 @@ void MapMark_DrawForDungeon(GlobalContext* globalCtx) {
mapMarkIconData++;
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
void MapMark_Draw(GlobalContext* globalCtx) {
switch (globalCtx->sceneNum) {
void MapMark_Draw(PlayState* play) {
switch (play->sceneNum) {
case SCENE_YDAN:
case SCENE_DDAN:
case SCENE_BDAN:
@ -203,7 +203,7 @@ void MapMark_Draw(GlobalContext* globalCtx) {
case SCENE_BDAN_BOSS:
case SCENE_MORIBOSSROOM:
case SCENE_FIRE_BS:
MapMark_DrawForDungeon(globalCtx);
MapMark_DrawForDungeon(play);
break;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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;
}

File diff suppressed because it is too large Load Diff

View File

@ -2,20 +2,20 @@
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_26)
void (*sPlayerCallInitFunc)(Actor* thisx, GlobalContext* globalCtx);
void (*sPlayerCallDestroyFunc)(Actor* thisx, GlobalContext* globalCtx);
void (*sPlayerCallUpdateFunc)(Actor* thisx, GlobalContext* globalCtx);
void (*sPlayerCallDrawFunc)(Actor* thisx, GlobalContext* globalCtx);
void (*sPlayerCallInitFunc)(Actor* thisx, PlayState* play);
void (*sPlayerCallDestroyFunc)(Actor* thisx, PlayState* play);
void (*sPlayerCallUpdateFunc)(Actor* thisx, PlayState* play);
void (*sPlayerCallDrawFunc)(Actor* thisx, PlayState* play);
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);
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);
const ActorInit Player_InitVars = {
ACTOR_PLAYER,
@ -37,23 +37,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);
}

View File

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

View File

@ -319,9 +319,9 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
s32 ret;
u32 eq;
Vec3f vec;
GlobalContext* globalCtx;
PlayState* play;
globalCtx = camera->globalCtx;
play = camera->play;
vec.x = 0.0f;
vec.y = 0.0f;
vec.z = 0.0f;
@ -344,7 +344,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->camPtrIdx] == NULL) {
if (play->cameraPtrs[req->camPtrIdx] == NULL) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: stopped! 'coz camera [%d] killed!!\n" VT_RST,
req->camPtrIdx);
Quake_Remove(req);

View File

@ -1007,12 +1007,12 @@ void func_80093C14(GraphicsContext* gfxCtx) {
CLOSE_DISPS(gfxCtx);
}
void func_80093C80(GlobalContext* globalCtx) {
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
void func_80093C80(PlayState* play) {
GraphicsContext* gfxCtx = play->state.gfxCtx;
func_80093D18(gfxCtx);
if (globalCtx->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_3) {
if (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_3) {
OPEN_DISPS(gfxCtx);
gDPSetColorDither(POLY_OPA_DISP++, G_CD_DISABLE);

View File

@ -1,9 +1,9 @@
#include "global.h"
#include "vt.h"
void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags);
void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags);
void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags);
void func_80095AB4(PlayState* play, Room* room, u32 flags);
void func_80095D04(PlayState* play, Room* room, u32 flags);
void func_80096F6C(PlayState* play, Room* room, u32 flags);
Vec3f D_801270A0 = { 0.0f, 0.0f, 0.0f };
@ -22,34 +22,34 @@ Gfx D_801270B0[] = {
gsSPEndDisplayList(),
};
void (*sRoomDrawHandlers[])(GlobalContext* globalCtx, Room* room, u32 flags) = {
void (*sRoomDrawHandlers[])(PlayState* play, Room* room, u32 flags) = {
func_80095AB4,
func_80096F6C,
func_80095D04,
};
void func_80095AA0(GlobalContext* globalCtx, Room* room, Input* arg2, UNK_TYPE arg3) {
void func_80095AA0(PlayState* play, Room* room, Input* arg2, UNK_TYPE arg3) {
}
// Room Draw Polygon Type 0
void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) {
void func_80095AB4(PlayState* play, Room* room, u32 flags) {
s32 i;
PolygonType0* polygon0;
PolygonDlist* polygonDlist;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
if (flags & 1) {
func_800342EC(&D_801270A0, globalCtx);
func_800342EC(&D_801270A0, play);
gSPSegment(POLY_OPA_DISP++, 0x03, room->segment);
func_80093C80(globalCtx);
func_80093C80(play);
gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
if (flags & 2) {
func_8003435C(&D_801270A0, globalCtx);
func_8003435C(&D_801270A0, play);
gSPSegment(POLY_XLU_DISP++, 0x03, room->segment);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
@ -67,7 +67,7 @@ void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) {
polygonDlist++;
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
#define SHAPE_SORT_MAX 64
@ -80,7 +80,7 @@ typedef struct struct_80095D04 {
} struct_80095D04; // size = 0x10
// Room Draw Polygon Type 2
void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) {
void func_80095D04(PlayState* play, Room* room, u32 flags) {
PolygonType2* polygon2;
PolygonDlist2* polygonDlist;
struct_80095D04 spB8[SHAPE_SORT_MAX];
@ -99,17 +99,17 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) {
PolygonDlist2* temp;
f32 temp_f2;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
if (flags & 1) {
func_800342EC(&D_801270A0, globalCtx);
func_800342EC(&D_801270A0, play);
//gSPSegment(POLY_OPA_DISP++, 0x03, room->segment);
func_80093C80(globalCtx);
func_80093C80(play);
gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
if (flags & 2) {
func_8003435C(&D_801270A0, globalCtx);
func_8003435C(&D_801270A0, play);
//gSPSegment(POLY_XLU_DISP++, 0x03, room->segment);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
@ -124,11 +124,11 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) {
sp90.x = polygonDlist->pos.x;
sp90.y = polygonDlist->pos.y;
sp90.z = polygonDlist->pos.z;
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sp90, &sp84, &sp80);
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sp90, &sp84, &sp80);
if (-(f32)polygonDlist->unk_06 < sp84.z)
{
temp_f2 = sp84.z - polygonDlist->unk_06;
if (temp_f2 < globalCtx->lightCtx.fogFar) {
if (temp_f2 < play->lightCtx.fogFar) {
phi_v0 = spB4;
spA4->unk_00 = polygonDlist;
spA4->unk_04 = temp_f2;
@ -214,7 +214,7 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) {
iREG(88) = sp9C - 1;
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
#define JPEG_MARKER 0xFFD8FFE0
@ -332,7 +332,7 @@ void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 h
}
// Room Draw Polygon Type 1 - Single Format
void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) {
void func_80096680(PlayState* play, Room* room, u32 flags) {
Camera* camera;
Gfx* spA8;
PolygonType1* polygon1;
@ -342,9 +342,9 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) {
u32 sp94;
u32 sp90;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
camera = GET_ACTIVE_CAM(globalCtx);
camera = GET_ACTIVE_CAM(play);
sp9C = (camera->setting == CAM_SET_PREREND_FIXED);
polygon1 = &room->meshHeader->polygon1;
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist);
@ -356,7 +356,7 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) {
gSPSegment(POLY_OPA_DISP++, 0x03, room->segment);
if (sp94) {
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, polygonDlist->opa);
}
@ -383,15 +383,15 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) {
if (sp90) {
gSPSegment(POLY_XLU_DISP++, 0x03, room->segment);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, polygonDlist->xlu);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) {
BgImage* func_80096A74(PolygonType1* polygon1, PlayState* play) {
Camera* camera;
s32 camId;
s16 camId2;
@ -399,7 +399,7 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) {
BgImage* bgImage;
s32 i;
camera = GET_ACTIVE_CAM(globalCtx);
camera = GET_ACTIVE_CAM(play);
camId = camera->camDataIdx;
if (camId == -1 && CVar_GetS32("gNoRestrictItems", 0)) {
// This prevents a crash when using items that change the
@ -408,12 +408,12 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) {
}
// jfifid
camId2 = func_80041C10(&globalCtx->colCtx, camId, BGCHECK_SCENE)[2].y;
camId2 = func_80041C10(&play->colCtx, camId, BGCHECK_SCENE)[2].y;
if (camId2 >= 0) {
camId = camId2;
}
player = GET_PLAYER(globalCtx);
player = GET_PLAYER(play);
player->actor.params = (player->actor.params & 0xFF00) | camId;
bgImage = SEGMENTED_TO_VIRTUAL(polygon1->multi.list);
@ -432,7 +432,7 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) {
}
// Room Draw Polygon Type 1 - Multi Format
void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
void func_80096B6C(PlayState* play, Room* room, u32 flags) {
Camera* camera;
Gfx* spA8;
PolygonType1* polygon1;
@ -443,13 +443,13 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
u32 sp90;
u32 sp8C;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
camera = GET_ACTIVE_CAM(globalCtx);
camera = GET_ACTIVE_CAM(play);
sp98 = (camera->setting == CAM_SET_PREREND_FIXED);
polygon1 = &room->meshHeader->polygon1;
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist);
bgImage = func_80096A74(polygon1, globalCtx);
bgImage = func_80096A74(polygon1, play);
sp94 = (flags & 1) && sp98 && bgImage->source && !(SREG(25) & 1);
sp90 = (flags & 1) && polygonDlist->opa && !(SREG(25) & 2);
sp8C = (flags & 2) && polygonDlist->xlu && !(SREG(25) & 4);
@ -458,7 +458,7 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
gSPSegment(POLY_OPA_DISP++, 0x03, room->segment);
if (sp90) {
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, polygonDlist->opa);
}
@ -484,35 +484,35 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
if (sp8C) {
gSPSegment(POLY_XLU_DISP++, 0x03, room->segment);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_XLU_DISP++, polygonDlist->xlu);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
// Room Draw Polygon Type 1
void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags) {
void func_80096F6C(PlayState* play, Room* room, u32 flags) {
PolygonType1* polygon1 = &room->meshHeader->polygon1;
if (polygon1->format == 1) {
func_80096680(globalCtx, room, flags);
func_80096680(play, room, flags);
} else if (polygon1->format == 2) {
func_80096B6C(globalCtx, room, flags);
func_80096B6C(play, room, flags);
} else {
LOG_HUNGUP_THREAD();
}
}
void func_80096FD4(GlobalContext* globalCtx, Room* room) {
void func_80096FD4(PlayState* play, Room* room) {
room->num = -1;
room->segment = NULL;
}
u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
u32 func_80096FE8(PlayState* play, RoomContext* roomCtx) {
u32 maxRoomSize = 0;
RomFile* roomList = globalCtx->roomList;
RomFile* roomList = play->roomList;
u32 roomSize;
s32 i;
s32 j;
@ -522,7 +522,7 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
u32 backRoomSize;
u32 cumulRoomSize;
for (i = 0; i < globalCtx->numRooms; i++) {
for (i = 0; i < play->numRooms; i++) {
roomSize = roomList[i].vromEnd - roomList[i].vromStart;
osSyncPrintf("ROOM%d size=%d\n", i, roomSize);
if (maxRoomSize < roomSize) {
@ -530,13 +530,13 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
}
}
if (globalCtx->transiActorCtx.numActors != 0) {
RomFile* roomList = globalCtx->roomList;
TransitionActorEntry* transitionActor = &globalCtx->transiActorCtx.list[0];
if (play->transiActorCtx.numActors != 0) {
RomFile* roomList = play->roomList;
TransitionActorEntry* transitionActor = &play->transiActorCtx.list[0];
LOG_NUM("game_play->room_rom_address.num", globalCtx->numRooms);
LOG_NUM("game_play->room_rom_address.num", play->numRooms);
for (j = 0; j < globalCtx->transiActorCtx.numActors; j++) {
for (j = 0; j < play->transiActorCtx.numActors; j++) {
frontRoom = transitionActor->sides[0].room;
backRoom = transitionActor->sides[1].room;
frontRoomSize = (frontRoom < 0) ? 0 : roomList[frontRoom].vromEnd - roomList[frontRoom].vromStart;
@ -555,7 +555,7 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
osSyncPrintf(VT_FGCOL(YELLOW));
// "Room buffer size=%08x(%5.1fK)"
osSyncPrintf("部屋バッファサイズ=%08x(%5.1fK)\n", maxRoomSize, maxRoomSize / 1024.0f);
roomCtx->bufPtrs[0] = GAMESTATE_ALLOC_MC(&globalCtx->state, maxRoomSize);
roomCtx->bufPtrs[0] = GAMESTATE_ALLOC_MC(&play->state, maxRoomSize);
// "Room buffer initial pointer=%08x"
osSyncPrintf("部屋バッファ開始ポインタ=%08x\n", roomCtx->bufPtrs[0]);
roomCtx->bufPtrs[1] = (void*)((intptr_t)roomCtx->bufPtrs[0] + maxRoomSize);
@ -566,16 +566,16 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
roomCtx->status = 0;
frontRoom = gSaveContext.respawnFlag > 0 ? ((void)0, gSaveContext.respawn[gSaveContext.respawnFlag - 1].roomIndex)
: globalCtx->setupEntranceList[globalCtx->curSpawn].room;
func_8009728C(globalCtx, roomCtx, frontRoom);
: play->setupEntranceList[play->curSpawn].room;
func_8009728C(play, roomCtx, frontRoom);
return maxRoomSize;
}
s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) {
s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) {
size_t size;
return OTRfunc_8009728C(globalCtx, roomCtx, roomNum);
return OTRfunc_8009728C(play, roomCtx, roomNum);
if (roomCtx->status == 0) {
roomCtx->prevRoom = roomCtx->curRoom;
@ -583,13 +583,13 @@ s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) {
roomCtx->curRoom.segment = NULL;
roomCtx->status = 1;
ASSERT(roomNum < globalCtx->numRooms);
ASSERT(roomNum < play->numRooms);
size = globalCtx->roomList[roomNum].vromEnd - globalCtx->roomList[roomNum].vromStart;
size = play->roomList[roomNum].vromEnd - play->roomList[roomNum].vromStart;
roomCtx->unk_34 = (void*)ALIGN16((intptr_t)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7));
osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1);
DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, globalCtx->roomList[roomNum].vromStart, size, 0,
DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, play->roomList[roomNum].vromStart, size, 0,
&roomCtx->loadQueue, OS_MESG_PTR(NULL), __FILE__, __LINE__);
roomCtx->unk_30 ^= 1;
@ -599,8 +599,8 @@ s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) {
return 0;
}
s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) {
return OTRfunc_800973FC(globalCtx, roomCtx);
s32 func_800973FC(PlayState* play, RoomContext* roomCtx) {
return OTRfunc_800973FC(play, roomCtx);
if (roomCtx->status == 1) {
@ -609,9 +609,9 @@ s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) {
roomCtx->curRoom.segment = roomCtx->unk_34;
gSegments[3] = VIRTUAL_TO_PHYSICAL(roomCtx->unk_34);
Scene_ExecuteCommands(globalCtx, roomCtx->curRoom.segment);
Player_SetBootData(globalCtx, GET_PLAYER(globalCtx));
Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx);
Scene_ExecuteCommands(play, roomCtx->curRoom.segment);
Player_SetBootData(play, GET_PLAYER(play));
Actor_SpawnTransitionActors(play, &play->actorCtx);
return 1;
}
@ -622,23 +622,23 @@ s32 func_800973FC(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)
{
gSegments[3] = VIRTUAL_TO_PHYSICAL(room->segment);
ASSERT(room->meshHeader->base.type < ARRAY_COUNTU(sRoomDrawHandlers));
sRoomDrawHandlers[room->meshHeader->base.type](globalCtx, room, flags);
sRoomDrawHandlers[room->meshHeader->base.type](play, room, flags);
}
}
void func_80097534(GlobalContext* globalCtx, RoomContext* roomCtx) {
void func_80097534(PlayState* play, RoomContext* roomCtx) {
roomCtx->prevRoom.num = -1;
roomCtx->prevRoom.segment = NULL;
func_80031B14(globalCtx, &globalCtx->actorCtx);
Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx);
Map_InitRoomData(globalCtx, roomCtx->curRoom.num);
if (!((globalCtx->sceneNum >= SCENE_SPOT00) && (globalCtx->sceneNum <= SCENE_SPOT20))) {
Map_SavePlayerInitialInfo(globalCtx);
func_80031B14(play, &play->actorCtx);
Actor_SpawnTransitionActors(play, &play->actorCtx);
Map_InitRoomData(play, roomCtx->curRoom.num);
if (!((play->sceneNum >= SCENE_SPOT00) && (play->sceneNum <= SCENE_SPOT20))) {
Map_SavePlayerInitialInfo(play);
}
Audio_SetEnvReverb(globalCtx->roomCtx.curRoom.echo);
Audio_SetEnvReverb(play->roomCtx.curRoom.echo);
}

View File

@ -2,7 +2,7 @@
void Sample_HandleStateChange(SampleContext* this) {
if (CHECK_BTN_ALL(this->state.input[0].press.button, BTN_START)) {
SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext);
SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState);
this->state.running = false;
}
}

View File

@ -31,24 +31,24 @@ s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId) {
return objectCtx->num - 1;
}
void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx) {
GlobalContext* globalCtx2 = globalCtx; // Needs to be a new variable to match (possibly a sub struct?)
void Object_InitBank(PlayState* play, ObjectContext* objectCtx) {
PlayState* play2 = play; // Needs to be a new variable to match (possibly a sub struct?)
size_t spaceSize;
s32 i;
if (globalCtx2->sceneNum == SCENE_SPOT00) {
if (play2->sceneNum == SCENE_SPOT00) {
spaceSize = 1024000;
} else if (globalCtx2->sceneNum == SCENE_GANON_DEMO) {
} else if (play2->sceneNum == SCENE_GANON_DEMO) {
if (gSaveContext.sceneSetupIndex != 4) {
spaceSize = 1177600;
} else {
spaceSize = 1024000;
}
} else if (globalCtx2->sceneNum == SCENE_JYASINBOSS) {
} else if (play2->sceneNum == SCENE_JYASINBOSS) {
spaceSize = 1075200;
} else if (globalCtx2->sceneNum == SCENE_KENJYANOMA) {
} else if (play2->sceneNum == SCENE_KENJYANOMA) {
spaceSize = 1075200;
} else if (globalCtx2->sceneNum == SCENE_GANON_BOSS) {
} else if (play2->sceneNum == SCENE_GANON_BOSS) {
spaceSize = 1075200;
} else {
spaceSize = 1024000;
@ -68,7 +68,7 @@ void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx) {
osSyncPrintf(VT_RST);
objectCtx->spaceStart = objectCtx->status[0].segment =
GAMESTATE_ALLOC_MC(&globalCtx->state, spaceSize);
GAMESTATE_ALLOC_MC(&play->state, spaceSize);
objectCtx->spaceEnd = (void*)((uintptr_t)objectCtx->spaceStart + spaceSize);
objectCtx->mainKeepIndex = Object_Spawn(objectCtx, OBJECT_GAMEPLAY_KEEP);
@ -160,7 +160,7 @@ void* func_800982FC(ObjectContext* objectCtx, s32 bankIndex, s16 objectId) {
return nextPtr;
}
s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) {
s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd) {
u32 cmdCode;
while (true) {
@ -173,7 +173,7 @@ s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) {
}
if (cmdCode < ARRAY_COUNT(gSceneCmdHandlers)) {
gSceneCmdHandlers[cmdCode](globalCtx, sceneCmd);
gSceneCmdHandlers[cmdCode](play, sceneCmd);
} else {
osSyncPrintf(VT_FGCOL(RED));
osSyncPrintf("code の値が異常です\n"); // "code variable is abnormal"
@ -184,29 +184,29 @@ s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) {
return 0;
}
void Scene_CommandSpawnList(GlobalContext* globalCtx, SceneCmd* cmd) {
ActorEntry* linkEntry = globalCtx->linkActorEntry = (ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->spawnList.segment) +
globalCtx->setupEntranceList[globalCtx->curSpawn].spawn;
void Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) {
ActorEntry* linkEntry = play->linkActorEntry = (ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->spawnList.segment) +
play->setupEntranceList[play->curSpawn].spawn;
s16 linkObjectId;
globalCtx->linkAgeOnLoad = ((void)0, gSaveContext.linkAge);
play->linkAgeOnLoad = ((void)0, gSaveContext.linkAge);
linkObjectId = gLinkObjectIds[((void)0, gSaveContext.linkAge)];
gActorOverlayTable[linkEntry->id].initInfo->objectId = linkObjectId;
Object_Spawn(&globalCtx->objectCtx, linkObjectId);
Object_Spawn(&play->objectCtx, linkObjectId);
}
void Scene_CommandActorList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->numSetupActors = cmd->actorList.num;
globalCtx->setupActorList = SEGMENTED_TO_VIRTUAL(cmd->actorList.segment);
void Scene_CommandActorList(PlayState* play, SceneCmd* cmd) {
play->numSetupActors = cmd->actorList.num;
play->setupActorList = SEGMENTED_TO_VIRTUAL(cmd->actorList.segment);
}
void Scene_CommandUnused2(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment);
void Scene_CommandUnused2(PlayState* play, SceneCmd* cmd) {
play->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment);
}
void Scene_CommandCollisionHeader(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandCollisionHeader(PlayState* play, SceneCmd* cmd) {
CollisionHeader* colHeader = SEGMENTED_TO_VIRTUAL(cmd->colHeader.segment);
colHeader->vtxList = SEGMENTED_TO_VIRTUAL(colHeader->vtxList);
@ -215,41 +215,41 @@ void Scene_CommandCollisionHeader(GlobalContext* globalCtx, SceneCmd* cmd) {
colHeader->cameraDataList = SEGMENTED_TO_VIRTUAL(colHeader->cameraDataList);
colHeader->waterBoxes = SEGMENTED_TO_VIRTUAL(colHeader->waterBoxes);
BgCheck_Allocate(&globalCtx->colCtx, globalCtx, colHeader);
BgCheck_Allocate(&play->colCtx, play, colHeader);
}
void Scene_CommandRoomList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->numRooms = cmd->roomList.num;
globalCtx->roomList = SEGMENTED_TO_VIRTUAL(cmd->roomList.segment);
void Scene_CommandRoomList(PlayState* play, SceneCmd* cmd) {
play->numRooms = cmd->roomList.num;
play->roomList = SEGMENTED_TO_VIRTUAL(cmd->roomList.segment);
}
void Scene_CommandEntranceList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->setupEntranceList = SEGMENTED_TO_VIRTUAL(cmd->entranceList.segment);
void Scene_CommandEntranceList(PlayState* play, SceneCmd* cmd) {
play->setupEntranceList = SEGMENTED_TO_VIRTUAL(cmd->entranceList.segment);
}
void Scene_CommandSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) {
if (cmd->specialFiles.keepObjectId != OBJECT_INVALID) {
globalCtx->objectCtx.subKeepIndex = Object_Spawn(&globalCtx->objectCtx, cmd->specialFiles.keepObjectId);
gSegments[5] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment);
play->objectCtx.subKeepIndex = Object_Spawn(&play->objectCtx, cmd->specialFiles.keepObjectId);
gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment);
}
if (cmd->specialFiles.cUpElfMsgNum != 0) {
globalCtx->cUpElfMsgs = Gameplay_LoadFile(globalCtx, &sNaviMsgFiles[cmd->specialFiles.cUpElfMsgNum - 1]);
play->cUpElfMsgs = Play_LoadFile(play, &sNaviMsgFiles[cmd->specialFiles.cUpElfMsgNum - 1]);
}
}
void Scene_CommandRoomBehavior(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->roomCtx.curRoom.behaviorType1 = cmd->roomBehavior.gpFlag1;
globalCtx->roomCtx.curRoom.behaviorType2 = cmd->roomBehavior.gpFlag2 & 0xFF;
globalCtx->roomCtx.curRoom.lensMode = (cmd->roomBehavior.gpFlag2 >> 8) & 1;
globalCtx->msgCtx.disableWarpSongs = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1;
void Scene_CommandRoomBehavior(PlayState* play, SceneCmd* cmd) {
play->roomCtx.curRoom.behaviorType1 = cmd->roomBehavior.gpFlag1;
play->roomCtx.curRoom.behaviorType2 = cmd->roomBehavior.gpFlag2 & 0xFF;
play->roomCtx.curRoom.lensMode = (cmd->roomBehavior.gpFlag2 >> 8) & 1;
play->msgCtx.disableWarpSongs = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1;
}
void Scene_CommandMeshHeader(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->roomCtx.curRoom.meshHeader = SEGMENTED_TO_VIRTUAL(cmd->mesh.segment);
void Scene_CommandMeshHeader(PlayState* play, SceneCmd* cmd) {
play->roomCtx.curRoom.meshHeader = SEGMENTED_TO_VIRTUAL(cmd->mesh.segment);
}
void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) {
s32 i;
s32 j;
s32 k;
@ -260,19 +260,19 @@ void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) {
void* nextPtr;
k = 0;
i = globalCtx->objectCtx.unk_09;
firstStatus = &globalCtx->objectCtx.status[0];
status = &globalCtx->objectCtx.status[i];
i = play->objectCtx.unk_09;
firstStatus = &play->objectCtx.status[0];
status = &play->objectCtx.status[i];
while (i < globalCtx->objectCtx.num) {
while (i < play->objectCtx.num) {
if (status->id != *objectEntry) {
status2 = &globalCtx->objectCtx.status[i];
for (j = i; j < globalCtx->objectCtx.num; j++) {
status2 = &play->objectCtx.status[i];
for (j = i; j < play->objectCtx.num; j++) {
status2->id = OBJECT_INVALID;
status2++;
}
globalCtx->objectCtx.num = i;
func_80031A28(globalCtx, &globalCtx->actorCtx);
play->objectCtx.num = i;
func_80031A28(play, &play->actorCtx);
continue;
}
@ -286,7 +286,7 @@ void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) {
ASSERT(cmd->objectList.num <= OBJECT_EXCHANGE_BANK_MAX);
while (k < cmd->objectList.num) {
nextPtr = func_800982FC(&globalCtx->objectCtx, i, *objectEntry);
nextPtr = func_800982FC(&play->objectCtx, i, *objectEntry);
if (i < OBJECT_EXCHANGE_BANK_MAX - 1) {
firstStatus[i + 1].segment = nextPtr;
}
@ -295,69 +295,69 @@ void Scene_CommandObjectList(GlobalContext* globalCtx, SceneCmd* cmd) {
objectEntry++;
}
globalCtx->objectCtx.num = i;
play->objectCtx.num = i;
}
void Scene_CommandLightList(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandLightList(PlayState* play, SceneCmd* cmd) {
s32 i;
LightInfo* lightInfo = SEGMENTED_TO_VIRTUAL(cmd->lightList.segment);
for (i = 0; i < cmd->lightList.num; i++) {
LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, lightInfo);
LightContext_InsertLight(play, &play->lightCtx, lightInfo);
lightInfo++;
}
}
void Scene_CommandPathList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->setupPathList = SEGMENTED_TO_VIRTUAL(cmd->pathList.segment);
void Scene_CommandPathList(PlayState* play, SceneCmd* cmd) {
play->setupPathList = SEGMENTED_TO_VIRTUAL(cmd->pathList.segment);
}
void Scene_CommandTransitionActorList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->transiActorCtx.numActors = cmd->transiActorList.num;
globalCtx->transiActorCtx.list = SEGMENTED_TO_VIRTUAL(cmd->transiActorList.segment);
void Scene_CommandTransitionActorList(PlayState* play, SceneCmd* cmd) {
play->transiActorCtx.numActors = cmd->transiActorList.num;
play->transiActorCtx.list = SEGMENTED_TO_VIRTUAL(cmd->transiActorList.segment);
}
void TransitionActor_InitContext(GameState* state, TransitionActorContext* transiActorCtx) {
transiActorCtx->numActors = 0;
}
void Scene_CommandLightSettingsList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->envCtx.numLightSettings = cmd->lightSettingList.num;
globalCtx->envCtx.lightSettingsList = SEGMENTED_TO_VIRTUAL(cmd->lightSettingList.segment);
void Scene_CommandLightSettingsList(PlayState* play, SceneCmd* cmd) {
play->envCtx.numLightSettings = cmd->lightSettingList.num;
play->envCtx.lightSettingsList = SEGMENTED_TO_VIRTUAL(cmd->lightSettingList.segment);
}
void Scene_CommandSkyboxSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->skyboxId = cmd->skyboxSettings.skyboxId;
globalCtx->envCtx.unk_17 = globalCtx->envCtx.unk_18 = cmd->skyboxSettings.unk_05;
globalCtx->envCtx.indoors = cmd->skyboxSettings.unk_06;
void Scene_CommandSkyboxSettings(PlayState* play, SceneCmd* cmd) {
play->skyboxId = cmd->skyboxSettings.skyboxId;
play->envCtx.unk_17 = play->envCtx.unk_18 = cmd->skyboxSettings.unk_05;
play->envCtx.indoors = cmd->skyboxSettings.unk_06;
}
void Scene_CommandSkyboxDisables(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->envCtx.skyboxDisabled = cmd->skyboxDisables.unk_04;
globalCtx->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk_05;
void Scene_CommandSkyboxDisables(PlayState* play, SceneCmd* cmd) {
play->envCtx.skyboxDisabled = cmd->skyboxDisables.unk_04;
play->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk_05;
}
void Scene_CommandTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) {
if ((cmd->timeSettings.hour != 0xFF) && (cmd->timeSettings.min != 0xFF)) {
gSaveContext.skyboxTime = gSaveContext.dayTime =
((cmd->timeSettings.hour + (cmd->timeSettings.min / 60.0f)) * 60.0f) / ((f32)(24 * 60) / 0x10000);
}
if (cmd->timeSettings.unk_06 != 0xFF) {
globalCtx->envCtx.timeIncrement = cmd->timeSettings.unk_06;
play->envCtx.timeIncrement = cmd->timeSettings.unk_06;
} else {
globalCtx->envCtx.timeIncrement = 0;
play->envCtx.timeIncrement = 0;
}
if (gSaveContext.sunsSongState == SUNSSONG_INACTIVE) {
gTimeIncrement = globalCtx->envCtx.timeIncrement;
gTimeIncrement = play->envCtx.timeIncrement;
}
globalCtx->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f;
globalCtx->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f;
globalCtx->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 20.0f) * 25.0f;
play->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f;
play->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f;
play->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 20.0f) * 25.0f;
if (((globalCtx->envCtx.timeIncrement == 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) ||
if (((play->envCtx.timeIncrement == 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) ||
(gSaveContext.entranceIndex == 0x0604)) {
gSaveContext.skyboxTime = ((void)0, gSaveContext.dayTime);
if ((gSaveContext.skyboxTime >= 0x2AAC) && (gSaveContext.skyboxTime < 0x4555)) {
@ -372,39 +372,39 @@ void Scene_CommandTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
}
}
void Scene_CommandWindSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandWindSettings(PlayState* play, SceneCmd* cmd) {
s8 x = cmd->windSettings.x;
s8 y = cmd->windSettings.y;
s8 z = cmd->windSettings.z;
globalCtx->envCtx.windDirection.x = x;
globalCtx->envCtx.windDirection.y = y;
globalCtx->envCtx.windDirection.z = z;
play->envCtx.windDirection.x = x;
play->envCtx.windDirection.y = y;
play->envCtx.windDirection.z = z;
globalCtx->envCtx.windSpeed = cmd->windSettings.unk_07;
play->envCtx.windSpeed = cmd->windSettings.unk_07;
}
void Scene_CommandExitList(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->setupExitList = SEGMENTED_TO_VIRTUAL(cmd->exitList.segment);
void Scene_CommandExitList(PlayState* play, SceneCmd* cmd) {
play->setupExitList = SEGMENTED_TO_VIRTUAL(cmd->exitList.segment);
}
void Scene_CommandUndefined9(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandUndefined9(PlayState* play, SceneCmd* cmd) {
}
void Scene_CommandSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->sequenceCtx.seqId = cmd->soundSettings.seqId;
globalCtx->sequenceCtx.natureAmbienceId = cmd->soundSettings.natureAmbienceId;
void Scene_CommandSoundSettings(PlayState* play, SceneCmd* cmd) {
play->sequenceCtx.seqId = cmd->soundSettings.seqId;
play->sequenceCtx.natureAmbienceId = cmd->soundSettings.natureAmbienceId;
if (gSaveContext.seqId == (u8)NA_BGM_DISABLED) {
Audio_QueueSeqCmd(cmd->soundSettings.specId | 0xF0000000);
}
}
void Scene_CommandEchoSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
globalCtx->roomCtx.curRoom.echo = cmd->echoSettings.echo;
void Scene_CommandEchoSettings(PlayState* play, SceneCmd* cmd) {
play->roomCtx.curRoom.echo = cmd->echoSettings.echo;
}
void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandAlternateHeaderList(PlayState* play, SceneCmd* cmd) {
s32 pad;
SceneCmd* altHeader;
@ -416,7 +416,7 @@ void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) {
altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(cmd->altHeaders.segment))[gSaveContext.sceneSetupIndex - 1];
if (altHeader != NULL) {
Scene_ExecuteCommands(globalCtx, SEGMENTED_TO_VIRTUAL(altHeader));
Scene_ExecuteCommands(play, SEGMENTED_TO_VIRTUAL(altHeader));
(cmd + 1)->base.code = SCENE_CMD_ID_END;
} else {
// "Coughh! There is no specified dataaaaa!"
@ -430,7 +430,7 @@ void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) {
osSyncPrintf("\nそこで、大人の昼データを使用するでええっす!!");
if (altHeader != NULL) {
Scene_ExecuteCommands(globalCtx, SEGMENTED_TO_VIRTUAL(altHeader));
Scene_ExecuteCommands(play, SEGMENTED_TO_VIRTUAL(altHeader));
(cmd + 1)->base.code = SCENE_CMD_ID_END;
}
}
@ -438,24 +438,24 @@ void Scene_CommandAlternateHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) {
}
}
void Scene_CommandCutsceneData(GlobalContext* globalCtx, SceneCmd* cmd) {
osSyncPrintf("\ngame_play->demo_play.data=[%x]", globalCtx->csCtx.segment);
globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(cmd->cutsceneData.segment);
void Scene_CommandCutsceneData(PlayState* play, SceneCmd* cmd) {
osSyncPrintf("\ngame_play->demo_play.data=[%x]", play->csCtx.segment);
play->csCtx.segment = SEGMENTED_TO_VIRTUAL(cmd->cutsceneData.segment);
}
// Camera & World Map Area
void Scene_CommandMiscSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
void Scene_CommandMiscSettings(PlayState* play, SceneCmd* cmd) {
YREG(15) = cmd->miscSettings.cameraMovement;
gSaveContext.worldMapArea = cmd->miscSettings.area;
if ((globalCtx->sceneNum == SCENE_SHOP1) || (globalCtx->sceneNum == SCENE_SYATEKIJYOU)) {
if ((play->sceneNum == SCENE_SHOP1) || (play->sceneNum == SCENE_SYATEKIJYOU)) {
if (LINK_AGE_IN_YEARS == YEARS_ADULT) {
gSaveContext.worldMapArea = 1;
}
}
if (((globalCtx->sceneNum >= SCENE_SPOT00) && (globalCtx->sceneNum <= SCENE_GANON_TOU)) ||
((globalCtx->sceneNum >= SCENE_ENTRA) && (globalCtx->sceneNum <= SCENE_SHRINE_R))) {
if (((play->sceneNum >= SCENE_SPOT00) && (play->sceneNum <= SCENE_GANON_TOU)) ||
((play->sceneNum >= SCENE_ENTRA) && (play->sceneNum <= SCENE_SHRINE_R))) {
if (gSaveContext.cutsceneIndex < 0xFFF0) {
gSaveContext.worldMapAreaData |= gBitFlags[gSaveContext.worldMapArea];
osSyncPrintf(" _%x (%d)\n", gSaveContext.worldMapAreaData,
@ -464,7 +464,7 @@ void Scene_CommandMiscSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
}
}
void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(GlobalContext*, SceneCmd*) = {
void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(PlayState*, SceneCmd*) = {
Scene_CommandSpawnList, // SCENE_CMD_ID_SPAWN_LIST
Scene_CommandActorList, // SCENE_CMD_ID_ACTOR_LIST
Scene_CommandUnused2, // SCENE_CMD_ID_UNUSED_2

File diff suppressed because it is too large Load Diff

View File

@ -3,8 +3,8 @@
#define ANIM_INTERP 1
s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime);
s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime);
s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime);
s32 LinkAnimation_Once(PlayState* play, SkelAnime* skelAnime);
s32 SkelAnime_LoopFull(SkelAnime* skelAnime);
s32 SkelAnime_Once(SkelAnime* skelAnime);
s32 SkelAnime_LoopPartial(SkelAnime* skelAnime);
@ -18,14 +18,14 @@ static u32 sAnimQueueFlags;
* Draw a limb of type `LodLimb`
* Near or far display list is specified via `lod`
*/
void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
void SkelAnime_DrawLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod) {
LodLimb* limb;
Gfx* dList;
Vec3f pos;
Vec3s rot;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
Matrix_Push();
limb = (LodLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]);
@ -38,36 +38,36 @@ void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skele
dList = limb->dLists[lod];
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, arg)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (dList != NULL) {
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, dList);
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, limbIndex, &dList, &rot, arg);
postLimbDraw(play, limbIndex, &dList, &rot, arg);
}
if (limb->child != LIMB_DONE) {
SkelAnime_DrawLimbLod(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod);
SkelAnime_DrawLimbLod(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod);
}
Matrix_Pop();
if (limb->sibling != LIMB_DONE) {
SkelAnime_DrawLimbLod(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod);
SkelAnime_DrawLimbLod(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, lod);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* Draw all limbs of type `LodLimb` in a given skeleton
* Near or far display list is specified via `lod`
*/
void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod) {
LodLimb* rootLimb;
s32 pad;
@ -82,7 +82,7 @@ void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa
return;
}
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
Matrix_Push();
@ -94,32 +94,32 @@ void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa
rot = jointTable[1];
dList = rootLimb->dLists[lod];
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, arg)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (dList != NULL) {
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, dList);
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, 1, &dList, &rot, arg);
postLimbDraw(play, 1, &dList, &rot, arg);
}
if (rootLimb->child != LIMB_DONE) {
SkelAnime_DrawLimbLod(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
SkelAnime_DrawLimbLod(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
lod);
}
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* Draw a limb of type `LodLimb` contained within a flexible skeleton
* Near or far display list is specified via `lod`
*/
void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
void SkelAnime_DrawFlexLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod,
Mtx** mtx) {
LodLimb* limb;
@ -141,15 +141,15 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s
newDList = limbDList = limb->dLists[lod];
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, arg)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (newDList != NULL) {
MATRIX_TOMTX(*mtx);
{
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, *mtx, G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, newDList);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
(*mtx)++;
} else if (limbDList != NULL) {
@ -158,17 +158,17 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, arg);
postLimbDraw(play, limbIndex, &limbDList, &rot, arg);
}
if (limb->child != LIMB_DONE) {
SkelAnime_DrawFlexLimbLod(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
SkelAnime_DrawFlexLimbLod(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
lod, mtx);
}
Matrix_Pop();
if (limb->sibling != LIMB_DONE) {
SkelAnime_DrawFlexLimbLod(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
SkelAnime_DrawFlexLimbLod(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
lod, mtx);
}
}
@ -178,7 +178,7 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s
* Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs.
* An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up.
*/
void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
void SkelAnime_DrawFlexLod(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg, s32 lod) {
LodLimb* rootLimb;
s32 pad;
@ -186,7 +186,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
Gfx* limbDList;
Vec3f pos;
Vec3s rot;
Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, dListCount * sizeof(Mtx));
Mtx* mtx = Graph_Alloc(play->state.gfxCtx, dListCount * sizeof(Mtx));
if (skeleton == NULL) {
osSyncPrintf(VT_FGCOL(RED));
@ -195,7 +195,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
return;
}
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0xD, mtx);
Matrix_Push();
@ -209,7 +209,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
newDList = limbDList = rootLimb->dLists[lod];
if ((overrideLimbDraw == 0) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, arg)) {
if ((overrideLimbDraw == 0) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (newDList != NULL) {
MATRIX_TOMTX(mtx);
@ -224,29 +224,29 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, 1, &limbDList, &rot, arg);
postLimbDraw(play, 1, &limbDList, &rot, arg);
}
if (rootLimb->child != LIMB_DONE) {
SkelAnime_DrawFlexLimbLod(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
SkelAnime_DrawFlexLimbLod(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
lod, &mtx);
}
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* Draw a limb of type `StandardLimb` to the polyOpa buffer
*/
void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
void SkelAnime_DrawLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg) {
StandardLimb* limb;
Gfx* dList;
Vec3f pos;
Vec3s rot;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
Matrix_Push();
limb = (StandardLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]);
@ -257,34 +257,34 @@ void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skele
pos.z = limb->jointPos.z;
dList = limb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, arg)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (dList != NULL) {
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, dList);
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, limbIndex, &dList, &rot, arg);
postLimbDraw(play, limbIndex, &dList, &rot, arg);
}
if (limb->child != LIMB_DONE) {
SkelAnime_DrawLimbOpa(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg);
SkelAnime_DrawLimbOpa(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg);
}
Matrix_Pop();
if (limb->sibling != LIMB_DONE) {
SkelAnime_DrawLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg);
SkelAnime_DrawLimbOpa(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* Draw all limbs of type `StandardLimb` in a given skeleton to the polyOpa buffer
*/
void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
void SkelAnime_DrawOpa(PlayState* play, void** skeleton, Vec3s* jointTable,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg) {
StandardLimb* rootLimb;
s32 pad;
@ -299,7 +299,7 @@ void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa
return;
}
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
Matrix_Push();
rootLimb = (StandardLimb*)SEGMENTED_TO_VIRTUAL(skeleton[0]);
@ -311,31 +311,31 @@ void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa
rot = jointTable[1];
dList = rootLimb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, arg)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (dList != NULL) {
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, dList);
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, 1, &dList, &rot, arg);
postLimbDraw(play, 1, &dList, &rot, arg);
}
if (rootLimb->child != LIMB_DONE) {
SkelAnime_DrawLimbOpa(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg);
SkelAnime_DrawLimbOpa(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg);
}
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
* Draw a limb of type `StandardLimb` contained within a flexible skeleton to the polyOpa buffer
*/
void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
void SkelAnime_DrawFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg,
Mtx** limbMatricies) {
StandardLimb* limb;
@ -344,7 +344,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s
Vec3f pos;
Vec3s rot;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
Matrix_Push();
@ -358,7 +358,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s
newDList = limbDList = limb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, arg)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (newDList != NULL) {
MATRIX_TOMTX(*limbMatricies);
@ -372,21 +372,21 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, arg);
postLimbDraw(play, limbIndex, &limbDList, &rot, arg);
}
if (limb->child != LIMB_DONE) {
SkelAnime_DrawFlexLimbOpa(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
SkelAnime_DrawFlexLimbOpa(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
limbMatricies);
}
Matrix_Pop();
if (limb->sibling != LIMB_DONE) {
SkelAnime_DrawFlexLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
SkelAnime_DrawFlexLimbOpa(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
limbMatricies);
}
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
@ -394,7 +394,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s
* Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs.
* An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up.
*/
void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
void SkelAnime_DrawFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount,
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg) {
StandardLimb* rootLimb;
s32 pad;
@ -402,7 +402,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
Gfx* limbDList;
Vec3f pos;
Vec3s rot;
Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, dListCount * sizeof(Mtx));
Mtx* mtx = Graph_Alloc(play->state.gfxCtx, dListCount * sizeof(Mtx));
if (skeleton == NULL) {
osSyncPrintf(VT_FGCOL(RED));
@ -411,7 +411,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
return;
}
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0xD, mtx);
@ -427,7 +427,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
newDList = limbDList = rootLimb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, arg)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, arg)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (newDList != NULL) {
MATRIX_TOMTX(mtx);
@ -441,16 +441,16 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, 1, &limbDList, &rot, arg);
postLimbDraw(play, 1, &limbDList, &rot, arg);
}
if (rootLimb->child != LIMB_DONE) {
SkelAnime_DrawFlexLimbOpa(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
SkelAnime_DrawFlexLimbOpa(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
&mtx);
}
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
/**
@ -507,7 +507,7 @@ s16 Animation_GetLastFrame(void* animation) {
/**
* Draw a limb of type `StandardLimb` to the specified display buffer
*/
Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
Gfx* SkelAnime_DrawLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Gfx* gfx) {
StandardLimb* limb;
Gfx* dList;
@ -527,27 +527,27 @@ Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton
dList = limb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, arg, &gfx)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, arg, &gfx)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (dList != NULL) {
gSPMatrix(gfx++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPMatrix(gfx++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD);
gSPDisplayList(gfx++, dList);
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, limbIndex, &dList, &rot, arg, &gfx);
postLimbDraw(play, limbIndex, &dList, &rot, arg, &gfx);
}
if (limb->child != LIMB_DONE) {
gfx =
SkelAnime_DrawLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, gfx);
SkelAnime_DrawLimb(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg, gfx);
}
Matrix_Pop();
if (limb->sibling != LIMB_DONE) {
gfx = SkelAnime_DrawLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
gfx = SkelAnime_DrawLimb(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
gfx);
}
@ -557,7 +557,7 @@ Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton
/**
* Draw all limbs of type `StandardLimb` in a given skeleton to the specified display buffer
*/
Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw,
Gfx* SkelAnime_Draw(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw,
PostLimbDraw postLimbDraw, void* arg, Gfx* gfx) {
StandardLimb* rootLimb;
s32 pad;
@ -585,20 +585,20 @@ Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable
dList = rootLimb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, arg, &gfx)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, arg, &gfx)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (dList != NULL) {
gSPMatrix(gfx++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_LOAD);
gSPMatrix(gfx++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD);
gSPDisplayList(gfx++, dList);
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, 1, &dList, &rot, arg, &gfx);
postLimbDraw(play, 1, &dList, &rot, arg, &gfx);
}
if (rootLimb->child != LIMB_DONE) {
gfx = SkelAnime_DrawLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
gfx = SkelAnime_DrawLimb(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
gfx);
}
@ -610,7 +610,7 @@ Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable
/**
* Draw a limb of type `StandardLimb` contained within a flexible skeleton to the specified display buffer
*/
Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable,
Gfx* SkelAnime_DrawFlexLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Mtx** mtx,
Gfx* gfx) {
StandardLimb* limb;
@ -630,7 +630,7 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel
pos.z = limb->jointPos.z;
newDList = limbDList = limb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, arg, &gfx)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, arg, &gfx)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (newDList != NULL) {
MATRIX_TOMTX(*mtx);
@ -643,17 +643,17 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, arg, &gfx);
postLimbDraw(play, limbIndex, &limbDList, &rot, arg, &gfx);
}
if (limb->child != LIMB_DONE) {
gfx = SkelAnime_DrawFlexLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
gfx = SkelAnime_DrawFlexLimb(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, arg,
mtx, gfx);
}
Matrix_Pop();
if (limb->sibling != LIMB_DONE) {
gfx = SkelAnime_DrawFlexLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
gfx = SkelAnime_DrawFlexLimb(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
arg, mtx, gfx);
}
@ -665,7 +665,7 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel
* Limbs in a flexible skeleton have meshes that can stretch to line up with other limbs.
* An array of matrices is dynamically allocated so each limb can access any transform to ensure its meshes line up.
*/
Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
Gfx* SkelAnime_DrawFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount,
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Gfx* gfx) {
StandardLimb* rootLimb;
s32 pad;
@ -673,7 +673,7 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT
Gfx* limbDList;
Vec3f pos;
Vec3s rot;
Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, dListCount * sizeof(*mtx));
Mtx* mtx = Graph_Alloc(play->state.gfxCtx, dListCount * sizeof(*mtx));
if (skeleton == NULL) {
osSyncPrintf(VT_FGCOL(RED));
@ -695,7 +695,7 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT
newDList = limbDList = rootLimb->dList;
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, arg, &gfx)) {
if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, arg, &gfx)) {
Matrix_TranslateRotateZYX(&pos, &rot);
if (newDList != NULL) {
MATRIX_TOMTX(mtx);
@ -708,10 +708,10 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT
}
}
if (postLimbDraw != NULL) {
postLimbDraw(globalCtx, 1, &limbDList, &rot, arg, &gfx);
postLimbDraw(play, 1, &limbDList, &rot, arg, &gfx);
}
if (rootLimb->child != LIMB_DONE) {
gfx = SkelAnime_DrawFlexLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
gfx = SkelAnime_DrawFlexLimb(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw,
arg, &mtx, gfx);
}
@ -815,14 +815,14 @@ void AnimationContext_Reset(AnimationContext* animationCtx) {
/**
* Shifts the queue flag to the next queue
*/
void AnimationContext_SetNextQueue(GlobalContext* globalCtx) {
void AnimationContext_SetNextQueue(PlayState* play) {
sAnimQueueFlags <<= 1;
}
/**
* Disables the current animation queue. Only load and move actor requests will be processed for that queue.
*/
void AnimationContext_DisableQueue(GlobalContext* globalCtx) {
void AnimationContext_DisableQueue(PlayState* play) {
sDisableAnimQueueFlags |= sAnimQueueFlags;
}
@ -843,7 +843,7 @@ AnimationEntry* AnimationContext_AddEntry(AnimationContext* animationCtx, Animat
/**
* Requests loading frame data from the Link animation into frameTable
*/
void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, LinkAnimationHeader* animation, s32 frame, s32 limbCount,
void AnimationContext_SetLoadFrame(PlayState* play, LinkAnimationHeader* animation, s32 frame, s32 limbCount,
Vec3s* frameTable) {
if (CVar_GetS32("gN64WeirdFrames", 0) && frame < 0) {
Vec3s* src = (Vec3s*)getN64WeirdFrame((sizeof(Vec3s) * limbCount + 2) * frame);
@ -851,7 +851,7 @@ void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, LinkAnimationHeader
return;
}
AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_LOADFRAME);
AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_LOADFRAME);
if (entry != NULL)
{
@ -891,8 +891,8 @@ void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, LinkAnimationHeader
/**
* Requests copying all vectors from src frame table into dst frame table
*/
void AnimationContext_SetCopyAll(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src) {
AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_COPYALL);
void AnimationContext_SetCopyAll(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src) {
AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_COPYALL);
if (entry != NULL) {
entry->data.copy.queueFlag = sAnimQueueFlags;
@ -905,8 +905,8 @@ void AnimationContext_SetCopyAll(GlobalContext* globalCtx, s32 vecCount, Vec3s*
/**
* Requests interpolating between base and mod frame tables with the given weight, placing the result in base
*/
void AnimationContext_SetInterp(GlobalContext* globalCtx, s32 vecCount, Vec3s* base, Vec3s* mod, f32 weight) {
AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_INTERP);
void AnimationContext_SetInterp(PlayState* play, s32 vecCount, Vec3s* base, Vec3s* mod, f32 weight) {
AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_INTERP);
if (entry != NULL) {
entry->data.interp.queueFlag = sAnimQueueFlags;
@ -920,8 +920,8 @@ void AnimationContext_SetInterp(GlobalContext* globalCtx, s32 vecCount, Vec3s* b
/**
* Requests copying vectors from src frame table to dst frame table whose copy flag is true
*/
void AnimationContext_SetCopyTrue(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) {
AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_COPYTRUE);
void AnimationContext_SetCopyTrue(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) {
AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_COPYTRUE);
if (entry != NULL) {
entry->data.copy1.queueFlag = sAnimQueueFlags;
@ -935,8 +935,8 @@ void AnimationContext_SetCopyTrue(GlobalContext* globalCtx, s32 vecCount, Vec3s*
/**
* Requests copying vectors from src frame table to dst frame table whose copy flag is false
*/
void AnimationContext_SetCopyFalse(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) {
AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_COPYFALSE);
void AnimationContext_SetCopyFalse(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag) {
AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_COPYFALSE);
if (entry != NULL) {
entry->data.copy0.queueFlag = sAnimQueueFlags;
@ -950,8 +950,8 @@ void AnimationContext_SetCopyFalse(GlobalContext* globalCtx, s32 vecCount, Vec3s
/**
* Requests moving an actor according to the translation of its root limb
*/
void AnimationContext_SetMoveActor(GlobalContext* globalCtx, Actor* actor, SkelAnime* skelAnime, f32 arg3) {
AnimationEntry* entry = AnimationContext_AddEntry(&globalCtx->animationCtx, ANIMENTRY_MOVEACTOR);
void AnimationContext_SetMoveActor(PlayState* play, Actor* actor, SkelAnime* skelAnime, f32 arg3) {
AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMENTRY_MOVEACTOR);
if (entry != NULL) {
entry->data.move.actor = actor;
@ -963,7 +963,7 @@ void AnimationContext_SetMoveActor(GlobalContext* globalCtx, Actor* actor, SkelA
/**
* Receives the request for Link's animation frame data
*/
void AnimationContext_LoadFrame(GlobalContext* globalCtx, AnimationEntryData* data) {
void AnimationContext_LoadFrame(PlayState* play, AnimationEntryData* data) {
AnimEntryLoadFrame* entry = &data->load;
osRecvMesg(&entry->msgQueue, NULL, OS_MESG_BLOCK);
@ -972,7 +972,7 @@ void AnimationContext_LoadFrame(GlobalContext* globalCtx, AnimationEntryData* da
/**
* If the entry's queue is enabled, copies all vectors from src frame table to dst frame table
*/
void AnimationContext_CopyAll(GlobalContext* globalCtx, AnimationEntryData* data) {
void AnimationContext_CopyAll(PlayState* play, AnimationEntryData* data) {
AnimEntryCopyAll* entry = &data->copy;
if (!(entry->queueFlag & sDisableAnimQueueFlags)) {
@ -989,7 +989,7 @@ void AnimationContext_CopyAll(GlobalContext* globalCtx, AnimationEntryData* data
/**
* If the entry's queue is enabled, interpolates between the base and mod frame tables, placing the result in base
*/
void AnimationContext_Interp(GlobalContext* globalCtx, AnimationEntryData* data) {
void AnimationContext_Interp(PlayState* play, AnimationEntryData* data) {
AnimEntryInterp* entry = &data->interp;
if (!(entry->queueFlag & sDisableAnimQueueFlags)) {
@ -1000,7 +1000,7 @@ void AnimationContext_Interp(GlobalContext* globalCtx, AnimationEntryData* data)
/**
* If the entry's queue is enabled, copies all vectors from src frame table to dst frame table whose copy flag is true
*/
void AnimationContext_CopyTrue(GlobalContext* globalCtx, AnimationEntryData* data) {
void AnimationContext_CopyTrue(PlayState* play, AnimationEntryData* data) {
AnimEntryCopyTrue* entry = &data->copy1;
if (!(entry->queueFlag & sDisableAnimQueueFlags)) {
@ -1020,7 +1020,7 @@ void AnimationContext_CopyTrue(GlobalContext* globalCtx, AnimationEntryData* dat
/**
* If the entry's queue is enabled, copies all vectors from src frame table to dst frame table whose copy flag is false
*/
void AnimationContext_CopyFalse(GlobalContext* globalCtx, AnimationEntryData* data) {
void AnimationContext_CopyFalse(PlayState* play, AnimationEntryData* data) {
AnimEntryCopyFalse* entry = &data->copy0;
if (!(entry->queueFlag & sDisableAnimQueueFlags)) {
@ -1040,7 +1040,7 @@ void AnimationContext_CopyFalse(GlobalContext* globalCtx, AnimationEntryData* da
/**
* Moves an actor according to the translation of its root limb
*/
void AnimationContext_MoveActor(GlobalContext* globalCtx, AnimationEntryData* data) {
void AnimationContext_MoveActor(PlayState* play, AnimationEntryData* data) {
AnimEntryMoveActor* entry = &data->move;
Actor* actor = entry->actor;
Vec3f diff;
@ -1054,7 +1054,7 @@ void AnimationContext_MoveActor(GlobalContext* globalCtx, AnimationEntryData* da
/**
* Performs all requests in the animation queue, then resets the queue flags.
*/
void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animationCtx) {
void AnimationContext_Update(PlayState* play, AnimationContext* animationCtx) {
static AnimationEntryCallback animFuncs[] = {
AnimationContext_LoadFrame, AnimationContext_CopyAll, AnimationContext_Interp,
AnimationContext_CopyTrue, AnimationContext_CopyFalse, AnimationContext_MoveActor,
@ -1062,7 +1062,7 @@ void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animati
AnimationEntry* entry;
for (entry = animationCtx->entries; animationCtx->animationCount != 0; entry++, animationCtx->animationCount--) {
animFuncs[entry->type](globalCtx, &entry->data);
animFuncs[entry->type](play, &entry->data);
}
sAnimQueueFlags = 1;
@ -1073,7 +1073,7 @@ void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animati
* Initializes a skeleton to be used with Link animations to a looping animation, dynamically allocating the frame
* tables if not given.
*/
void SkelAnime_InitLink(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
void SkelAnime_InitLink(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
LinkAnimationHeader* animation, s32 flags, Vec3s* jointTable, Vec3s* morphTable,
s32 limbBufCount) {
if (ResourceMgr_OTRSigCheck(skeletonHeaderSeg) != 0)
@ -1121,7 +1121,7 @@ void SkelAnime_InitLink(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkel
osSyncPrintf(VT_RST);
}
LinkAnimation_Change(globalCtx, skelAnime, animation, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f);
LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f);
}
/**
@ -1140,15 +1140,15 @@ void LinkAnimation_SetUpdateFunction(SkelAnime* skelAnime) {
* Advances the current Link animation and updates all frame tables. If the animation plays once, returns true when it
* finishes.
*/
s32 LinkAnimation_Update(GlobalContext* globalCtx, SkelAnime* skelAnime) {
return skelAnime->update(globalCtx, skelAnime);
s32 LinkAnimation_Update(PlayState* play, SkelAnime* skelAnime) {
return skelAnime->update(play, skelAnime);
}
/**
* Requests an interpolation between the pose in jointTable to the one in morphTable, advancing the morph but not the
* animation frame
*/
s32 LinkAnimation_Morph(GlobalContext* globalCtx, SkelAnime* skelAnime) {
s32 LinkAnimation_Morph(PlayState* play, SkelAnime* skelAnime) {
f32 prevMorphWeight = skelAnime->morphWeight;
f32 updateRate = R_UPDATE_RATE * 0.5f;
@ -1158,7 +1158,7 @@ s32 LinkAnimation_Morph(GlobalContext* globalCtx, SkelAnime* skelAnime) {
LinkAnimation_SetUpdateFunction(skelAnime);
}
AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable,
AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable,
1.0f - (skelAnime->morphWeight / prevMorphWeight));
return 0;
}
@ -1167,8 +1167,8 @@ s32 LinkAnimation_Morph(GlobalContext* globalCtx, SkelAnime* skelAnime) {
* Requests a load of the next frame of a Link animation, advances the morph, and requests an interpolation between
* jointTable and morphTable
*/
void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime) {
AnimationContext_SetLoadFrame(globalCtx, skelAnime->animation, skelAnime->curFrame, skelAnime->limbCount,
void LinkAnimation_AnimateFrame(PlayState* play, SkelAnime* skelAnime) {
AnimationContext_SetLoadFrame(play, skelAnime->animation, skelAnime->curFrame, skelAnime->limbCount,
skelAnime->jointTable);
if (skelAnime->morphWeight != 0) {
f32 updateRate = R_UPDATE_RATE * 0.5f;
@ -1177,7 +1177,7 @@ void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime)
if (skelAnime->morphWeight <= 0.0f) {
skelAnime->morphWeight = 0.0f;
} else {
AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable,
AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable,
skelAnime->morphWeight);
}
}
@ -1186,7 +1186,7 @@ void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime)
/**
* Advances a Link animation that loops over its full length
*/
s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime) {
s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime) {
f32 updateRate = R_UPDATE_RATE * 0.5f;
skelAnime->curFrame += skelAnime->playSpeed * updateRate;
@ -1195,18 +1195,18 @@ s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime) {
} else if (skelAnime->animLength <= skelAnime->curFrame) {
skelAnime->curFrame -= skelAnime->animLength;
}
LinkAnimation_AnimateFrame(globalCtx, skelAnime);
LinkAnimation_AnimateFrame(play, skelAnime);
return 0;
}
/**
* Advances a Link animation that stops at endFrame and returns true when it is reached.
*/
s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime) {
s32 LinkAnimation_Once(PlayState* play, SkelAnime* skelAnime) {
f32 updateRate = R_UPDATE_RATE * 0.5f;
if (skelAnime->curFrame == skelAnime->endFrame) {
LinkAnimation_AnimateFrame(globalCtx, skelAnime);
LinkAnimation_AnimateFrame(play, skelAnime);
return 1;
}
skelAnime->curFrame += skelAnime->playSpeed * updateRate;
@ -1217,14 +1217,14 @@ s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime) {
} else if (skelAnime->animLength <= skelAnime->curFrame) {
skelAnime->curFrame -= skelAnime->animLength;
}
LinkAnimation_AnimateFrame(globalCtx, skelAnime);
LinkAnimation_AnimateFrame(play, skelAnime);
return 0;
}
/**
* Sets a new morph and resets the morph weight for the current animation.
*/
void Animation_SetMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 morphFrames) {
void Animation_SetMorph(PlayState* play, SkelAnime* skelAnime, f32 morphFrames) {
skelAnime->morphWeight = 1.0f;
skelAnime->morphRate = 1.0f / morphFrames;
}
@ -1235,7 +1235,7 @@ void Animation_SetMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 morp
* animation, then start the new animation. Negative morph frames start the new animation immediately, modified by the
* pose immediately before the animation change.
*/
void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed,
void LinkAnimation_Change(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed,
f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames) {
LinkAnimationHeader* ogAnim = animation;
@ -1254,14 +1254,14 @@ void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAn
morphFrames = -morphFrames;
} else {
skelAnime->update = LinkAnimation_Morph;
AnimationContext_SetLoadFrame(globalCtx, animation, (s32)startFrame, skelAnime->limbCount,
AnimationContext_SetLoadFrame(play, animation, (s32)startFrame, skelAnime->limbCount,
skelAnime->morphTable);
}
skelAnime->morphWeight = 1.0f;
skelAnime->morphRate = 1.0f / morphFrames;
} else {
LinkAnimation_SetUpdateFunction(skelAnime);
AnimationContext_SetLoadFrame(globalCtx, animation, (s32)startFrame, skelAnime->limbCount,
AnimationContext_SetLoadFrame(play, animation, (s32)startFrame, skelAnime->limbCount,
skelAnime->jointTable);
skelAnime->morphWeight = 0.0f;
}
@ -1278,105 +1278,105 @@ void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAn
/**
* Immediately changes to a Link animation that plays once at the default speed.
*/
void LinkAnimation_PlayOnce(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation) {
LinkAnimation_Change(globalCtx, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE,
void LinkAnimation_PlayOnce(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation) {
LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE,
0.0f);
}
/**
* Immediately changes to a Link animation that plays once at the specified speed.
*/
void LinkAnimation_PlayOnceSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation,
void LinkAnimation_PlayOnceSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation,
f32 playSpeed) {
LinkAnimation_Change(globalCtx, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation),
LinkAnimation_Change(play, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation),
ANIMMODE_ONCE, 0.0f);
}
/**
* Immediately changes to a Link animation that loops at the default speed.
*/
void LinkAnimation_PlayLoop(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation) {
LinkAnimation_Change(globalCtx, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP,
void LinkAnimation_PlayLoop(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation) {
LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP,
0.0f);
}
/**
* Immediately changes to a Link animation that loops at the specified speed.
*/
void LinkAnimation_PlayLoopSetSpeed(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation,
void LinkAnimation_PlayLoopSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation,
f32 playSpeed) {
LinkAnimation_Change(globalCtx, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation),
LinkAnimation_Change(play, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(animation),
ANIMMODE_LOOP, 0.0f);
}
/**
* Requests copying jointTable to morphTable
*/
void LinkAnimation_CopyJointToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime) {
AnimationContext_SetCopyAll(globalCtx, skelAnime->limbCount, skelAnime->morphTable, skelAnime->jointTable);
void LinkAnimation_CopyJointToMorph(PlayState* play, SkelAnime* skelAnime) {
AnimationContext_SetCopyAll(play, skelAnime->limbCount, skelAnime->morphTable, skelAnime->jointTable);
}
/**
* Requests copying morphTable to jointTable
* unused
*/
void LinkAnimation_CopyMorphToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime) {
AnimationContext_SetCopyAll(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable);
void LinkAnimation_CopyMorphToJoint(PlayState* play, SkelAnime* skelAnime) {
AnimationContext_SetCopyAll(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable);
}
/**
* Requests loading frame data from the Link animation into morphTable
*/
void LinkAnimation_LoadToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation,
void LinkAnimation_LoadToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation,
f32 frame) {
AnimationContext_SetLoadFrame(globalCtx, animation, (s32)frame, skelAnime->limbCount, skelAnime->morphTable);
AnimationContext_SetLoadFrame(play, animation, (s32)frame, skelAnime->limbCount, skelAnime->morphTable);
}
/**
* Requests loading frame data from the Link animation into jointTable
*/
void LinkAnimation_LoadToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation,
void LinkAnimation_LoadToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation,
f32 frame) {
AnimationContext_SetLoadFrame(globalCtx, animation, (s32)frame, skelAnime->limbCount, skelAnime->jointTable);
AnimationContext_SetLoadFrame(play, animation, (s32)frame, skelAnime->limbCount, skelAnime->jointTable);
}
/**
* Requests interpolating between jointTable and morphTable, placing the result in jointTable
*/
void LinkAnimation_InterpJointMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 weight) {
AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, weight);
void LinkAnimation_InterpJointMorph(PlayState* play, SkelAnime* skelAnime, f32 weight) {
AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, weight);
}
/**
* Requests loading frame data from the Link animations and blending them, placing the result in jointTable
*/
void LinkAnimation_BlendToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation1,
void LinkAnimation_BlendToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1,
f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight,
Vec3s* blendTable) {
Vec3s* alignedBlendTable;
AnimationContext_SetLoadFrame(globalCtx, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->jointTable);
AnimationContext_SetLoadFrame(play, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->jointTable);
alignedBlendTable = (Vec3s*)ALIGN16((uintptr_t)blendTable);
AnimationContext_SetLoadFrame(globalCtx, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable);
AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->jointTable, alignedBlendTable, blendWeight);
AnimationContext_SetLoadFrame(play, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable);
AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, alignedBlendTable, blendWeight);
}
/**
* Requests loading frame data from the Link animations and blending them, placing the result in morphTable
*/
void LinkAnimation_BlendToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation1,
void LinkAnimation_BlendToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1,
f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight,
Vec3s* blendTable) {
Vec3s* alignedBlendTable;
AnimationContext_SetLoadFrame(globalCtx, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->morphTable);
AnimationContext_SetLoadFrame(play, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->morphTable);
alignedBlendTable = (Vec3s*)ALIGN16((uintptr_t)blendTable);
AnimationContext_SetLoadFrame(globalCtx, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable);
AnimationContext_SetInterp(globalCtx, skelAnime->limbCount, skelAnime->morphTable, alignedBlendTable, blendWeight);
AnimationContext_SetLoadFrame(play, animation2, (s32)frame2, skelAnime->limbCount, alignedBlendTable);
AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->morphTable, alignedBlendTable, blendWeight);
}
/**
@ -1426,7 +1426,7 @@ s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame) {
/**
* Initializes a normal skeleton to a looping animation, dynamically allocating the frame tables if not provided.
*/
s32 SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg,
s32 SkelAnime_Init(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg,
AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) {
if (ResourceMgr_OTRSigCheck(skeletonHeaderSeg))
skeletonHeaderSeg = ResourceMgr_LoadSkeletonByName(skeletonHeaderSeg);
@ -1459,7 +1459,7 @@ s32 SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeade
/**
* Initializes a flex skeleton to a looping animation, dynamically allocating the frame tables if not given.
*/
s32 SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
s32 SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) {
if (ResourceMgr_OTRSigCheck(skeletonHeaderSeg) != 0)
skeletonHeaderSeg = ResourceMgr_LoadSkeletonByName(skeletonHeaderSeg);
@ -1496,7 +1496,7 @@ s32 SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkele
/**
* Initializes a skeleton with SkinLimbs to a looping animation, dynamically allocating the frame tables.
*/
s32 SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg,
s32 SkelAnime_InitSkin(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg,
AnimationHeader* animation) {
if (ResourceMgr_OTRSigCheck(skeletonHeaderSeg) != 0)
animation = ResourceMgr_LoadAnimByName(skeletonHeaderSeg);
@ -1909,7 +1909,7 @@ s32 Animation_OnFrame(SkelAnime* skelAnime, f32 frame) {
/**
* Frees the frame tables for a skelAnime with dynamically allocated tables.
*/
void SkelAnime_Free(SkelAnime* skelAnime, GlobalContext* globalCtx) {
void SkelAnime_Free(SkelAnime* skelAnime, PlayState* play) {
if (skelAnime->jointTable != NULL) {
ZELDA_ARENA_FREE_DEBUG(skelAnime->jointTable);
} else {

View File

@ -185,12 +185,12 @@ 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;
s32 segmentType;
SkinLimb** skeleton;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
GraphicsContext* gfxCtx = play->state.gfxCtx;
s32 pad;
OPEN_DISPS(gfxCtx);
@ -218,7 +218,7 @@ void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostD
s32 shouldDraw = true;
if (overrideLimbDraw != NULL) {
shouldDraw = overrideLimbDraw(actor, globalCtx, i, skin);
shouldDraw = overrideLimbDraw(actor, play, i, skin);
}
segmentType = ((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[i]))->segmentType;
@ -231,7 +231,7 @@ void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostD
}
if (postDraw != NULL) {
postDraw(actor, globalCtx, skin);
postDraw(actor, play, skin);
}
close_disps:
@ -239,26 +239,26 @@ close_disps:
}
// allows specifying PostLimbDraw and setTranslation
void func_800A6330(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, s32 setTranslation) {
Skin_DrawImpl(actor, globalCtx, skin, postDraw, NULL, setTranslation, false, 0);
void func_800A6330(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, s32 setTranslation) {
Skin_DrawImpl(actor, play, skin, postDraw, NULL, setTranslation, false, 0);
}
// allows specifying OverrideLimbDraw, PostLimbDraw and setTranslation
void func_800A6360(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
void func_800A6360(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, PostLimbDraw, setTranslation, and arg6
void func_800A6394(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
void func_800A6394(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_800A63CC(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
void func_800A63CC(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) {

View File

@ -4,7 +4,7 @@
/**
* Initialises the Vtx buffers used for limb at index `limbIndex`
*/
void Skin_InitAnimatedLimb(GlobalContext* globalCtx, Skin* skin, s32 limbIndex) {
void Skin_InitAnimatedLimb(PlayState* play, Skin* skin, s32 limbIndex) {
s32 i;
SkinLimb** skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
SkinAnimatedLimbData* animatedLimbData =
@ -36,7 +36,7 @@ void Skin_InitAnimatedLimb(GlobalContext* globalCtx, Skin* skin, s32 limbIndex)
* Initializes a skin skeleton to looping animation, dynamically allocating the frame tables,
* and dynamically allocating and initializing the Vtx and SkinLimbVtx buffers for its animated limbs
*/
void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader) {
void Skin_Init(PlayState* play, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader) {
if (ResourceMgr_OTRSigCheck(skeletonHeader))
skeletonHeader = ResourceMgr_LoadSkeletonByName(skeletonHeader);
@ -77,17 +77,17 @@ void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHea
ZELDA_ARENA_MALLOC_DEBUG(animatedLimbData->totalVtxCount * sizeof(Vtx));
ASSERT(vtxEntry->buf[1] != NULL);
Skin_InitAnimatedLimb(globalCtx, skin, i);
Skin_InitAnimatedLimb(play, skin, i);
}
}
SkelAnime_InitSkin(globalCtx, &skin->skelAnime, skeletonHeader, animationHeader);
SkelAnime_InitSkin(play, &skin->skelAnime, skeletonHeader, animationHeader);
}
/**
* Frees the dynamically allocated Vtx and SkinLimbVtx buffers and tables
*/
void Skin_Free(GlobalContext* globalCtx, Skin* skin) {
void Skin_Free(PlayState* play, Skin* skin) {
if (skin->vtxTable != NULL) {
s32 i;
@ -106,7 +106,7 @@ void Skin_Free(GlobalContext* globalCtx, Skin* skin) {
ZELDA_ARENA_FREE_DEBUG(skin->vtxTable);
}
SkelAnime_Free(&skin->skelAnime, globalCtx);
SkelAnime_Free(&skin->skelAnime, play);
}
}

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);
}
}
@ -26,15 +26,15 @@ void SoundSource_UpdateAll(GlobalContext* globalCtx) {
}
}
void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, s32 duration, u16 sfxId) {
void SoundSource_PlaySfxAtFixedWorldPos(PlayState* play, Vec3f* worldPos, s32 duration, u16 sfxId) {
s32 countdown;
SoundSource* source;
s32 smallestCountdown = 0xFFFF;
SoundSource* backupSource;
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;
}
@ -49,7 +49,7 @@ void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPo
}
// 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);
}
@ -57,6 +57,6 @@ void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPo
source->worldPos = *worldPos;
source->countdown = duration;
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &source->worldPos, &source->projectedPos);
Audio_PlaySoundGeneral(sfxId, &source->projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}

View File

@ -32,7 +32,7 @@ void Sram_InitDebugSave(void) {
// RANDOTODO replace most of these GiveLink functions with calls to
// Item_Give in z_parameter, we'll need to update Item_Give to ensure
// nothing breaks when calling it without a valid globalCtx first
// nothing breaks when calling it without a valid play first
void GiveLinkRupees(int numOfRupees) {
int maxRupeeCount;
if (CUR_UPG_VALUE(UPG_WALLET) == 0) {

View File

@ -592,7 +592,7 @@ SkyboxTableEntry sSkyboxTable[] =
},
};
void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyboxId) {
void Skybox_Setup(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) {
size_t size;
s16 i;
u8 sp41; // imageIdx
@ -613,16 +613,16 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
if (gSaveContext.skyboxTime >= D_8011FC1C[phi_v1][i].startTime &&
(gSaveContext.skyboxTime < D_8011FC1C[phi_v1][i].endTime ||
D_8011FC1C[phi_v1][i].endTime == 0xFFFF)) {
globalCtx->envCtx.skybox1Index = sp41 = D_8011FC1C[phi_v1][i].skybox1Index;
globalCtx->envCtx.skybox2Index = sp40 = D_8011FC1C[phi_v1][i].skybox2Index;
play->envCtx.skybox1Index = sp41 = D_8011FC1C[phi_v1][i].skybox1Index;
play->envCtx.skybox2Index = sp40 = D_8011FC1C[phi_v1][i].skybox2Index;
if (D_8011FC1C[phi_v1][i].blend != 0) {
globalCtx->envCtx.skyboxBlend =
play->envCtx.skyboxBlend =
Environment_LerpWeight(D_8011FC1C[phi_v1][i].endTime, D_8011FC1C[phi_v1][i].startTime,
((void)0, gSaveContext.skyboxTime)) *
255.0f;
}
else {
globalCtx->envCtx.skyboxBlend = 0;
play->envCtx.skyboxBlend = 0;
}
break;
}
@ -944,13 +944,13 @@ void Skybox_Setup(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skybox
}
void Skybox_Init(GameState* state, SkyboxContext* skyboxCtx, s16 skyboxId) {
GlobalContext* globalCtx = (GlobalContext*)state;
PlayState* play = (PlayState*)state;
skyboxCtx->skyboxId = skyboxId;
skyboxCtx->unk_140 = 0;
skyboxCtx->rot.x = skyboxCtx->rot.y = skyboxCtx->rot.z = 0.0f;
Skybox_Setup(globalCtx, skyboxCtx, skyboxId);
Skybox_Setup(play, skyboxCtx, skyboxId);
osSyncPrintf("\n\n\n\n\n\n"
"%d"
"\n\n\n\n\n\n",

View File

@ -3,13 +3,13 @@
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
void ArmsHook_Init(Actor* thisx, GlobalContext* globalCtx);
void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx);
void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx);
void ArmsHook_Init(Actor* thisx, PlayState* play);
void ArmsHook_Destroy(Actor* thisx, PlayState* play);
void ArmsHook_Update(Actor* thisx, PlayState* play);
void ArmsHook_Draw(Actor* thisx, PlayState* play);
void ArmsHook_Wait(ArmsHook* this, GlobalContext* globalCtx);
void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx);
void ArmsHook_Wait(ArmsHook* this, PlayState* play);
void ArmsHook_Shoot(ArmsHook* this, PlayState* play);
const ActorInit Arms_Hook_InitVars = {
ACTOR_ARMS_HOOK,
@ -63,33 +63,33 @@ void ArmsHook_SetupAction(ArmsHook* this, ArmsHookActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void ArmsHook_Init(Actor* thisx, GlobalContext* globalCtx) {
void ArmsHook_Init(Actor* thisx, PlayState* play) {
ArmsHook* this = (ArmsHook*)thisx;
Collider_InitQuad(globalCtx, &this->collider);
Collider_SetQuad(globalCtx, &this->collider, &this->actor, &sQuadInit);
Collider_InitQuad(play, &this->collider);
Collider_SetQuad(play, &this->collider, &this->actor, &sQuadInit);
ArmsHook_SetupAction(this, ArmsHook_Wait);
this->unk_1E8 = this->actor.world.pos;
}
void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void ArmsHook_Destroy(Actor* thisx, PlayState* play) {
ArmsHook* this = (ArmsHook*)thisx;
if (this->grabbed != NULL) {
this->grabbed->flags &= ~ACTOR_FLAG_13;
}
Collider_DestroyQuad(globalCtx, &this->collider);
Collider_DestroyQuad(play, &this->collider);
}
void ArmsHook_Wait(ArmsHook* this, GlobalContext* globalCtx) {
void ArmsHook_Wait(ArmsHook* this, PlayState* play) {
if (this->actor.parent == NULL) {
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
// get correct timer length for hookshot or longshot
s32 length = (player->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 13 : 26;
ArmsHook_SetupAction(this, ArmsHook_Shoot);
func_8002D9A4(&this->actor, 20.0f);
this->actor.parent = &GET_PLAYER(globalCtx)->actor;
this->actor.parent = &GET_PLAYER(play)->actor;
this->timer = length;
}
}
@ -138,8 +138,8 @@ void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) {
Math_Vec3f_Diff(&actor->world.pos, &this->actor.world.pos, &this->grabbedDistDiff);
}
void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
Player* player = GET_PLAYER(play);
Actor* touchedActor;
Actor* grabbed;
Vec3f bodyDistDiffVec;
@ -257,18 +257,18 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
sp60.x = this->unk_1F4.x - (this->unk_1E8.x - this->unk_1F4.x);
sp60.y = this->unk_1F4.y - (this->unk_1E8.y - this->unk_1F4.y);
sp60.z = this->unk_1F4.z - (this->unk_1E8.z - this->unk_1F4.z);
if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp60, &this->unk_1E8, &sp78, &poly, true, true, true, true,
if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &this->unk_1E8, &sp78, &poly, true, true, true, true,
&bgId) &&
!func_8002F9EC(globalCtx, &this->actor, poly, bgId, &sp78)) {
!func_8002F9EC(play, &this->actor, poly, bgId, &sp78)) {
sp5C = COLPOLY_GET_NORMAL(poly->normal.x);
sp58 = COLPOLY_GET_NORMAL(poly->normal.z);
Math_Vec3f_Copy(&this->actor.world.pos, &sp78);
this->actor.world.pos.x += 10.0f * sp5C;
this->actor.world.pos.z += 10.0f * sp58;
this->timer = 0;
if (SurfaceType_IsHookshotSurface(&globalCtx->colCtx, poly, bgId)) {
if (SurfaceType_IsHookshotSurface(&play->colCtx, poly, bgId)) {
if (bgId != BGCHECK_SCENE) {
dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId);
dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId);
if (dynaPolyActor != NULL) {
ArmsHook_AttachHookToActor(this, &dynaPolyActor->actor);
}
@ -277,28 +277,28 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
Audio_PlaySoundGeneral(NA_SE_IT_HOOKSHOT_STICK_OBJ, &this->actor.projectedPos, 4, &D_801333E0,
&D_801333E0, &D_801333E8);
} else {
CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &this->actor.world.pos);
CollisionCheck_SpawnShieldParticlesMetal(play, &this->actor.world.pos);
Audio_PlaySoundGeneral(NA_SE_IT_HOOKSHOT_REFLECT, &this->actor.projectedPos, 4, &D_801333E0,
&D_801333E0, &D_801333E8);
}
} else if (CHECK_BTN_ANY(globalCtx->state.input[0].press.button,
} else if (CHECK_BTN_ANY(play->state.input[0].press.button,
(BTN_A | BTN_B | BTN_R | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN))) {
this->timer = 0;
}
}
}
void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx) {
void ArmsHook_Update(Actor* thisx, PlayState* play) {
ArmsHook* this = (ArmsHook*)thisx;
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
this->unk_1F4 = this->unk_1E8;
}
void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
void ArmsHook_Draw(Actor* thisx, PlayState* play) {
s32 pad;
ArmsHook* this = (ArmsHook*)thisx;
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
Vec3f sp78;
Vec3f sp6C;
Vec3f sp60;
@ -306,7 +306,7 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
f32 sp58;
if ((player->actor.draw != NULL) && (player->rightHandType == 15)) {
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) {
Matrix_MultVec3f(&D_80865B70, &this->unk_1E8);
@ -319,9 +319,9 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
Matrix_MultVec3f(&D_80865BAC, &sp60);
}
func_80090480(globalCtx, &this->collider, &this->hookInfo, &sp6C, &sp60);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
func_80090480(play, &this->collider, &this->hookInfo, &sp6C, &sp60);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultHookshotTipDL);
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
@ -331,10 +331,10 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
Matrix_RotateY(Math_FAtan2F(sp78.x, sp78.z), MTXMODE_APPLY);
Matrix_RotateX(Math_FAtan2F(-sp78.y, sp5C), MTXMODE_APPLY);
Matrix_Scale(0.015f, 0.015f, sqrtf(SQ(sp78.y) + sp58) * 0.01f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultHookshotChainDL);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
}

View File

@ -6,7 +6,7 @@
struct ArmsHook;
typedef void (*ArmsHookActionFunc)(struct ArmsHook*, GlobalContext*);
typedef void (*ArmsHookActionFunc)(struct ArmsHook*, PlayState*);
typedef struct ArmsHook {
/* 0x0000 */ Actor actor;

View File

@ -9,14 +9,14 @@
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25)
void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx);
void ArrowFire_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ArrowFire_Update(Actor* thisx, GlobalContext* globalCtx);
void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx);
void ArrowFire_Init(Actor* thisx, PlayState* play);
void ArrowFire_Destroy(Actor* thisx, PlayState* play);
void ArrowFire_Update(Actor* thisx, PlayState* play);
void ArrowFire_Draw(Actor* thisx, PlayState* play);
void ArrowFire_Charge(ArrowFire* this, GlobalContext* globalCtx);
void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx);
void ArrowFire_Hit(ArrowFire* this, GlobalContext* globalCtx);
void ArrowFire_Charge(ArrowFire* this, PlayState* play);
void ArrowFire_Fly(ArrowFire* this, PlayState* play);
void ArrowFire_Hit(ArrowFire* this, PlayState* play);
#include "overlays/ovl_Arrow_Fire/ovl_Arrow_Fire.h"
@ -41,7 +41,7 @@ void ArrowFire_SetupAction(ArrowFire* this, ArrowFireActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx) {
void ArrowFire_Init(Actor* thisx, PlayState* play) {
ArrowFire* this = (ArrowFire*)thisx;
Actor_ProcessInitChain(&this->actor, sInitChain);
@ -54,12 +54,12 @@ void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx) {
this->unk_15C = 0.0f;
}
void ArrowFire_Destroy(Actor* thisx, GlobalContext* globalCtx) {
func_800876C8(globalCtx);
void ArrowFire_Destroy(Actor* thisx, PlayState* play) {
func_800876C8(play);
LOG_STRING("消滅"); // "Disappearance"
}
void ArrowFire_Charge(ArrowFire* this, GlobalContext* globalCtx) {
void ArrowFire_Charge(ArrowFire* this, PlayState* play) {
EnArrow* arrow;
arrow = (EnArrow*)this->actor.parent;
@ -92,7 +92,7 @@ void func_80865ECC(Vec3f* unkPos, Vec3f* firePos, f32 scale) {
unkPos->z += ((firePos->z - unkPos->z) * scale);
}
void ArrowFire_Hit(ArrowFire* this, GlobalContext* globalCtx) {
void ArrowFire_Hit(ArrowFire* this, PlayState* play) {
f32 scale;
f32 offset;
u16 timer;
@ -143,7 +143,7 @@ void ArrowFire_Hit(ArrowFire* this, GlobalContext* globalCtx) {
}
}
void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx) {
void ArrowFire_Fly(ArrowFire* this, PlayState* play) {
EnArrow* arrow;
f32 distanceScaled;
s32 pad;
@ -177,20 +177,20 @@ void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx) {
}
}
void ArrowFire_Update(Actor* thisx, GlobalContext* globalCtx) {
void ArrowFire_Update(Actor* thisx, PlayState* play) {
ArrowFire* this = (ArrowFire*)thisx;
if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK ||
globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) {
if (play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK ||
play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) {
Actor_Kill(&this->actor);
} else {
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
}
void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) {
void ArrowFire_Draw(Actor* thisx, PlayState* play2) {
ArrowFire* this = (ArrowFire*)thisx;
GlobalContext* globalCtx = globalCtx2;
PlayState* play = play2;
u32 stateFrames;
EnArrow* arrow;
Actor* tranform;
@ -199,13 +199,13 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) {
Color_RGB8 Arrow_env = CVar_GetRGB("gFireArrowColEnv", Arrow_env_ori);
Color_RGB8 Arrow_col = CVar_GetRGB("gFireArrowCol", Arrow_col_ori);
stateFrames = globalCtx->state.frames;
stateFrames = play->state.frames;
arrow = (EnArrow*)this->actor.parent;
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {
tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
Matrix_Translate(tranform->world.pos.x, tranform->world.pos.y, tranform->world.pos.z, MTXMODE_NEW);
Matrix_RotateY(tranform->shape.rot.y * (M_PI / 0x8000), MTXMODE_APPLY);
@ -232,7 +232,7 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) {
}
// Draw fire on the arrow
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
if (CVar_GetS32("gUseArrowsCol", 0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col.r, Arrow_col.g, Arrow_col.b, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env.r, Arrow_env.g, Arrow_env.b, 128);
@ -248,14 +248,14 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) {
}
Matrix_Scale(this->radius * 0.2f, this->unk_158 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY);
Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, sMaterialDL);
gSPDisplayList(POLY_XLU_DISP++,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 255 - (stateFrames * 2) % 256, 0, 64, 32, 1,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 255 - (stateFrames * 2) % 256, 0, 64, 32, 1,
255 - stateFrames % 256, 511 - (stateFrames * 10) % 512, 64, 64));
gSPDisplayList(POLY_XLU_DISP++, sModelDL);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
}

View File

@ -6,7 +6,7 @@
struct ArrowFire;
typedef void (*ArrowFireActionFunc)(struct ArrowFire*, GlobalContext*);
typedef void (*ArrowFireActionFunc)(struct ArrowFire*, PlayState*);
typedef struct ArrowFire {
/* 0x0000 */ Actor actor;

View File

@ -10,14 +10,14 @@
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25)
void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx);
void ArrowIce_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ArrowIce_Update(Actor* thisx, GlobalContext* globalCtx);
void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx);
void ArrowIce_Init(Actor* thisx, PlayState* play);
void ArrowIce_Destroy(Actor* thisx, PlayState* play);
void ArrowIce_Update(Actor* thisx, PlayState* play);
void ArrowIce_Draw(Actor* thisx, PlayState* play);
void ArrowIce_Charge(ArrowIce* this, GlobalContext* globalCtx);
void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx);
void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx);
void ArrowIce_Charge(ArrowIce* this, PlayState* play);
void ArrowIce_Fly(ArrowIce* this, PlayState* play);
void ArrowIce_Hit(ArrowIce* this, PlayState* play);
#include "overlays/ovl_Arrow_Ice/ovl_Arrow_Ice.h"
@ -42,7 +42,7 @@ void ArrowIce_SetupAction(ArrowIce* this, ArrowIceActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx) {
void ArrowIce_Init(Actor* thisx, PlayState* play) {
ArrowIce* this = (ArrowIce*)thisx;
Actor_ProcessInitChain(&this->actor, sInitChain);
@ -55,12 +55,12 @@ void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx) {
this->unk_164 = 0.0f;
}
void ArrowIce_Destroy(Actor* thisx, GlobalContext* globalCtx) {
func_800876C8(globalCtx);
void ArrowIce_Destroy(Actor* thisx, PlayState* play) {
func_800876C8(play);
LOG_STRING("消滅"); // "Disappearance"
}
void ArrowIce_Charge(ArrowIce* this, GlobalContext* globalCtx) {
void ArrowIce_Charge(ArrowIce* this, PlayState* play) {
EnArrow* arrow;
arrow = (EnArrow*)this->actor.parent;
@ -93,7 +93,7 @@ void func_80867E8C(Vec3f* unkPos, Vec3f* icePos, f32 scale) {
unkPos->z += ((icePos->z - unkPos->z) * scale);
}
void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx) {
void ArrowIce_Hit(ArrowIce* this, PlayState* play) {
f32 scale;
f32 offset;
u16 timer;
@ -144,7 +144,7 @@ void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx) {
}
}
void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) {
void ArrowIce_Fly(ArrowIce* this, PlayState* play) {
EnArrow* arrow;
f32 distanceScaled;
s32 pad;
@ -178,22 +178,22 @@ void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) {
}
}
void ArrowIce_Update(Actor* thisx, GlobalContext* globalCtx) {
void ArrowIce_Update(Actor* thisx, PlayState* play) {
ArrowIce* this = (ArrowIce*)thisx;
if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK ||
globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) {
if (play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK ||
play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) {
Actor_Kill(&this->actor);
} else {
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
}
void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
void ArrowIce_Draw(Actor* thisx, PlayState* play) {
ArrowIce* this = (ArrowIce*)thisx;
s32 pad;
Actor* tranform;
u32 stateFrames = globalCtx->state.frames;
u32 stateFrames = play->state.frames;
EnArrow* arrow = (EnArrow*)this->actor.parent;
Color_RGB8 Arrow_env_ori = {0,0,255};
Color_RGB8 Arrow_col_ori = {170, 255, 255};
@ -203,7 +203,7 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {
tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
Matrix_Translate(tranform->world.pos.x, tranform->world.pos.y, tranform->world.pos.z, MTXMODE_NEW);
Matrix_RotateY(tranform->shape.rot.y * (M_PI / 0x8000), MTXMODE_APPLY);
@ -230,7 +230,7 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
// Draw ice on the arrow
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
if (CVar_GetS32("gUseArrowsCol", 0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col.r, Arrow_col.g, Arrow_col.b, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env.r, Arrow_env.g, Arrow_env.b, 128);
@ -246,14 +246,14 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
Matrix_Scale(this->radius * 0.2f, this->unk_160 * 3.0f, this->radius * 0.2f, MTXMODE_APPLY);
Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, sMaterialDL);
gSPDisplayList(POLY_XLU_DISP++,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 128, 32, 1,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 128, 32, 1,
511 - (stateFrames * 10) % 512, 511 - (stateFrames * 10) % 512, 4, 16));
gSPDisplayList(POLY_XLU_DISP++, sModelDL);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
}

View File

@ -6,7 +6,7 @@
struct ArrowIce;
typedef void (*ArrowIceActionFunc)(struct ArrowIce*, GlobalContext*);
typedef void (*ArrowIceActionFunc)(struct ArrowIce*, PlayState*);
typedef struct ArrowIce {
/* 0x0000 */ Actor actor;

View File

@ -10,14 +10,14 @@
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25)
void ArrowLight_Init(Actor* thisx, GlobalContext* globalCtx);
void ArrowLight_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ArrowLight_Update(Actor* thisx, GlobalContext* globalCtx);
void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx);
void ArrowLight_Init(Actor* thisx, PlayState* play);
void ArrowLight_Destroy(Actor* thisx, PlayState* play);
void ArrowLight_Update(Actor* thisx, PlayState* play);
void ArrowLight_Draw(Actor* thisx, PlayState* play);
void ArrowLight_Charge(ArrowLight* this, GlobalContext* globalCtx);
void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx);
void ArrowLight_Hit(ArrowLight* this, GlobalContext* globalCtx);
void ArrowLight_Charge(ArrowLight* this, PlayState* play);
void ArrowLight_Fly(ArrowLight* this, PlayState* play);
void ArrowLight_Hit(ArrowLight* this, PlayState* play);
#include "overlays/ovl_Arrow_Light/ovl_Arrow_Light.h"
@ -42,7 +42,7 @@ void ArrowLight_SetupAction(ArrowLight* this, ArrowLightActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void ArrowLight_Init(Actor* thisx, GlobalContext* globalCtx) {
void ArrowLight_Init(Actor* thisx, PlayState* play) {
ArrowLight* this = (ArrowLight*)thisx;
Actor_ProcessInitChain(&this->actor, sInitChain);
@ -55,12 +55,12 @@ void ArrowLight_Init(Actor* thisx, GlobalContext* globalCtx) {
this->unk_164 = 0.0f;
}
void ArrowLight_Destroy(Actor* thisx, GlobalContext* globalCtx) {
func_800876C8(globalCtx);
void ArrowLight_Destroy(Actor* thisx, PlayState* play) {
func_800876C8(play);
LOG_STRING("消滅"); // "Disappearance"
}
void ArrowLight_Charge(ArrowLight* this, GlobalContext* globalCtx) {
void ArrowLight_Charge(ArrowLight* this, PlayState* play) {
EnArrow* arrow = (EnArrow*)this->actor.parent;
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
@ -92,7 +92,7 @@ void func_80869E6C(Vec3f* unkPos, Vec3f* lightPos, f32 scale) {
unkPos->z += ((lightPos->z - unkPos->z) * scale);
}
void ArrowLight_Hit(ArrowLight* this, GlobalContext* globalCtx) {
void ArrowLight_Hit(ArrowLight* this, PlayState* play) {
f32 scale;
f32 offset;
u16 timer;
@ -143,7 +143,7 @@ void ArrowLight_Hit(ArrowLight* this, GlobalContext* globalCtx) {
}
}
void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx) {
void ArrowLight_Fly(ArrowLight* this, PlayState* play) {
EnArrow* arrow = (EnArrow*)this->actor.parent;
f32 distanceScaled;
s32 pad;
@ -176,21 +176,21 @@ void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx) {
}
}
void ArrowLight_Update(Actor* thisx, GlobalContext* globalCtx) {
void ArrowLight_Update(Actor* thisx, PlayState* play) {
ArrowLight* this = (ArrowLight*)thisx;
if (globalCtx->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK ||
globalCtx->msgCtx.msgMode == MSGMODE_SONG_PLAYED) {
if (play->msgCtx.msgMode == MSGMODE_OCARINA_CORRECT_PLAYBACK ||
play->msgCtx.msgMode == MSGMODE_SONG_PLAYED) {
Actor_Kill(&this->actor);
} else {
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
}
void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
void ArrowLight_Draw(Actor* thisx, PlayState* play) {
ArrowLight* this = (ArrowLight*)thisx;
s32 pad;
u32 stateFrames = globalCtx->state.frames;
u32 stateFrames = play->state.frames;
EnArrow* arrow = (EnArrow*)this->actor.parent;
Actor* tranform;
Color_RGB8 Arrow_env_ori = {255, 255, 0};
@ -201,7 +201,7 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {
tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
OPEN_DISPS(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
Matrix_Translate(tranform->world.pos.x, tranform->world.pos.y, tranform->world.pos.z, MTXMODE_NEW);
Matrix_RotateY(tranform->shape.rot.y * (M_PI / 0x8000), MTXMODE_APPLY);
@ -228,7 +228,7 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
// Draw light on the arrow
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
if (CVar_GetS32("gUseArrowsCol", 0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col.r, Arrow_col.g, Arrow_col.b, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env.r, Arrow_env.g, Arrow_env.b, 128);
@ -244,14 +244,14 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
Matrix_Scale(this->radius * 0.2f, this->unk_160 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY);
Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, sMaterialDL);
gSPDisplayList(POLY_XLU_DISP++,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 4, 32, 1,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 4, 32, 1,
511 - (stateFrames * 10) % 512, 511 - (stateFrames * 30) % 512, 8, 16));
gSPDisplayList(POLY_XLU_DISP++, sModelDL);
CLOSE_DISPS(globalCtx->state.gfxCtx);
CLOSE_DISPS(play->state.gfxCtx);
}
}

View File

@ -6,7 +6,7 @@
struct ArrowLight;
typedef void (*ArrowLightActionFunc)(struct ArrowLight*, GlobalContext*);
typedef void (*ArrowLightActionFunc)(struct ArrowLight*, PlayState*);
typedef struct ArrowLight {
/* 0x0000 */ Actor actor;

View File

@ -9,27 +9,27 @@
#define FLAGS ACTOR_FLAG_4
void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx);
void BgBdanObjects_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgBdanObjects_Update(Actor* thisx, GlobalContext* globalCtx);
void BgBdanObjects_Draw(Actor* thisx, GlobalContext* globalCtx);
void BgBdanObjects_Init(Actor* thisx, PlayState* play);
void BgBdanObjects_Destroy(Actor* thisx, PlayState* play);
void BgBdanObjects_Update(Actor* thisx, PlayState* play);
void BgBdanObjects_Draw(Actor* thisx, PlayState* play);
void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C55C(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C6EC(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C76C(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C7D0(BgBdanObjects* this, GlobalContext* globalCtx);
void BgBdanObjects_DoNothing(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C9A8(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C9F0(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086CABC(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086CB10(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx);
void func_8086C054(BgBdanObjects* this, PlayState* play);
void func_8086C1A0(BgBdanObjects* this, PlayState* play);
void func_8086C29C(BgBdanObjects* this, PlayState* play);
void func_8086C55C(BgBdanObjects* this, PlayState* play);
void func_8086C5BC(BgBdanObjects* this, PlayState* play);
void func_8086C618(BgBdanObjects* this, PlayState* play);
void func_8086C6EC(BgBdanObjects* this, PlayState* play);
void func_8086C76C(BgBdanObjects* this, PlayState* play);
void func_8086C7D0(BgBdanObjects* this, PlayState* play);
void BgBdanObjects_DoNothing(BgBdanObjects* this, PlayState* play);
void func_8086C874(BgBdanObjects* this, PlayState* play);
void func_8086C9A8(BgBdanObjects* this, PlayState* play);
void func_8086C9F0(BgBdanObjects* this, PlayState* play);
void func_8086CABC(BgBdanObjects* this, PlayState* play);
void func_8086CB10(BgBdanObjects* this, PlayState* play);
void func_8086CB8C(BgBdanObjects* this, PlayState* play);
const ActorInit Bg_Bdan_Objects_InitVars = {
ACTOR_BG_BDAN_OBJECTS,
@ -105,7 +105,7 @@ void BgBdanObjects_SetContactRu1(BgBdanObjects* this, s32 arg1) {
}
}
void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
void BgBdanObjects_Init(Actor* thisx, PlayState* play) {
s32 pad;
BgBdanObjects* this = (BgBdanObjects*)thisx;
CollisionHeader* colHeader = NULL;
@ -116,21 +116,21 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
thisx->params &= 0xFF;
if (thisx->params == 2) {
thisx->flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5;
globalCtx->colCtx.colHeader->waterBoxes[7].ySurface = thisx->world.pos.y;
play->colCtx.colHeader->waterBoxes[7].ySurface = thisx->world.pos.y;
this->actionFunc = func_8086C9A8;
return;
}
if (thisx->params == 0) {
CollisionHeader_GetVirtual(&gJabuBigOctoPlatformCol, &colHeader);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit);
thisx->world.pos.y += -79.0f;
if (Flags_GetClear(globalCtx, thisx->room)) {
Flags_SetSwitch(globalCtx, this->switchFlag);
if (Flags_GetClear(play, thisx->room)) {
Flags_SetSwitch(play, this->switchFlag);
this->actionFunc = func_8086C6EC;
} else {
if (BgBdanObjects_GetContactRu1(this, 4)) {
if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_BIGOKUTA,
if (Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_BIGOKUTA,
thisx->home.pos.x, thisx->home.pos.y, thisx->home.pos.z, 0,
thisx->shape.rot.y + 0x8000, 0, 3) != NULL) {
thisx->child->world.pos.z = thisx->child->home.pos.z + 263.0f;
@ -139,7 +139,7 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc = func_8086C618;
thisx->world.pos.y = thisx->home.pos.y + -70.0f;
} else {
Flags_SetSwitch(globalCtx, this->switchFlag);
Flags_SetSwitch(play, this->switchFlag);
this->timer = 0;
this->actionFunc = func_8086C054;
}
@ -152,7 +152,7 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc = func_8086C874;
} else {
CollisionHeader_GetVirtual(&gJabuLoweringPlatformCol, &colHeader);
if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
if (Flags_GetSwitch(play, this->switchFlag)) {
this->actionFunc = BgBdanObjects_DoNothing;
thisx->world.pos.y = thisx->home.pos.y - 400.0f;
} else {
@ -160,26 +160,26 @@ void BgBdanObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
}
}
}
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
}
void BgBdanObjects_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgBdanObjects_Destroy(Actor* thisx, PlayState* play) {
BgBdanObjects* this = (BgBdanObjects*)thisx;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
if (thisx->params == 0) {
Collider_DestroyCylinder(globalCtx, &this->collider);
Collider_DestroyCylinder(play, &this->collider);
}
}
void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void func_8086C054(BgBdanObjects* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (BgBdanObjects_GetContactRu1(this, 0)) {
if (this->dyna.actor.xzDistToPlayer < 250.0f) {
BgBdanObjects_SetContactRu1(this, 1);
this->timer = 20;
OnePointCutscene_Init(globalCtx, 3070, -99, &this->dyna.actor, MAIN_CAM);
OnePointCutscene_Init(play, 3070, -99, &this->dyna.actor, MAIN_CAM);
player->actor.world.pos.x = -1130.0f;
player->actor.world.pos.y = -1025.0f;
player->actor.world.pos.z = -3300.0f;
@ -194,14 +194,14 @@ void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
if (!Gameplay_InCsMode(globalCtx) && !BgBdanObjects_GetContactRu1(this, 0)) {
if (!Play_InCsMode(play) && !BgBdanObjects_GetContactRu1(this, 0)) {
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + -79.0f;
} else {
this->dyna.actor.world.pos.y = (this->dyna.actor.home.pos.y + -79.0f) - 5.0f;
}
}
void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C1A0(BgBdanObjects* this, PlayState* play) {
if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 500.0f, 0.5f, 7.5f, 1.0f) <
0.1f) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A);
@ -221,13 +221,13 @@ void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C29C(BgBdanObjects* this, PlayState* play) {
s32 temp;
if (this->timer != 0) {
this->timer--;
if (this->timer == 0) {
temp = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1);
temp = Quake_Add(GET_ACTIVE_CAM(play), 1);
Quake_SetSpeed(temp, 0x3A98);
Quake_SetQuakeValues(temp, 0, 1, 0xFA, 1);
Quake_SetCountdown(temp, 0xA);
@ -235,18 +235,18 @@ void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) {
}
if (BgBdanObjects_GetContactRu1(this, 3)) {
Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_BIGOKUTA,
Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_BIGOKUTA,
this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 140.0f,
this->dyna.actor.world.pos.z, 0, this->dyna.actor.shape.rot.y + 0x8000, 0, 0);
BgBdanObjects_SetContactRu1(this, 4);
this->timer = 10;
this->actionFunc = func_8086C55C;
func_8005B1A4(GET_ACTIVE_CAM(globalCtx));
func_8005B1A4(GET_ACTIVE_CAM(play));
}
}
void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void func_8086C3D8(BgBdanObjects* this, PlayState* play) {
Player* player = GET_PLAYER(play);
this->dyna.actor.velocity.y += 0.5f;
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + -70.0f,
@ -256,7 +256,7 @@ void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U);
this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + 140.0f;
this->actionFunc = func_8086C5BC;
OnePointCutscene_Init(globalCtx, 3080, -99, this->dyna.actor.child, MAIN_CAM);
OnePointCutscene_Init(play, 3080, -99, this->dyna.actor.child, MAIN_CAM);
player->actor.world.pos.x = -1130.0f;
player->actor.world.pos.y = -1025.0f;
player->actor.world.pos.z = -3500.0f;
@ -278,18 +278,18 @@ void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void func_8086C55C(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C55C(BgBdanObjects* this, PlayState* play) {
this->timer--;
if (this->timer == 0) {
Flags_UnsetSwitch(globalCtx, this->switchFlag);
Flags_UnsetSwitch(play, this->switchFlag);
} else if (this->timer == -40) {
this->timer = 0;
this->actionFunc = func_8086C3D8;
}
}
void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C5BC(BgBdanObjects* this, PlayState* play) {
if (this->timer != 0) {
this->timer--;
}
@ -302,11 +302,11 @@ void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C618(BgBdanObjects* this, PlayState* play) {
Collider_UpdateCylinder(&this->dyna.actor, &this->collider);
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
if (Flags_GetClear(globalCtx, this->dyna.actor.room)) {
Flags_SetSwitch(globalCtx, this->switchFlag);
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
if (Flags_GetClear(play, this->dyna.actor.room)) {
Flags_SetSwitch(play, this->switchFlag);
this->dyna.actor.home.rot.y = (s16)(this->dyna.actor.shape.rot.y + 0x2000) & 0xC000;
this->actionFunc = func_8086C6EC;
} else {
@ -315,7 +315,7 @@ void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void func_8086C6EC(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C6EC(BgBdanObjects* this, PlayState* play) {
s32 cond = Math_ScaledStepToS(&this->dyna.actor.shape.rot.y, this->dyna.actor.home.rot.y, 0x200);
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + -125.0f, 3.0f)) {
@ -325,16 +325,16 @@ void func_8086C6EC(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void func_8086C76C(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C76C(BgBdanObjects* this, PlayState* play) {
if (func_8004356C(&this->dyna)) {
if (this->dyna.actor.xzDistToPlayer < 120.0f) {
this->actionFunc = func_8086C7D0;
OnePointCutscene_Init(globalCtx, 3090, -99, &this->dyna.actor, MAIN_CAM);
OnePointCutscene_Init(play, 3090, -99, &this->dyna.actor, MAIN_CAM);
}
}
}
void func_8086C7D0(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C7D0(BgBdanObjects* this, PlayState* play) {
if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 965.0f, 0.5f, 15.0f, 0.2f) <
0.01f) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A);
@ -344,30 +344,30 @@ void func_8086C7D0(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void BgBdanObjects_DoNothing(BgBdanObjects* this, GlobalContext* globalCtx) {
void BgBdanObjects_DoNothing(BgBdanObjects* this, PlayState* play) {
}
void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C874(BgBdanObjects* this, PlayState* play) {
if (this->timer != 0) {
this->timer--;
}
if (this->switchFlag == 0) {
if (func_8004356C(&this->dyna)) {
this->cameraSetting = globalCtx->cameraPtrs[MAIN_CAM]->setting;
Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_NORMAL2);
func_8005AD1C(globalCtx->cameraPtrs[MAIN_CAM], 4);
this->cameraSetting = play->cameraPtrs[MAIN_CAM]->setting;
Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_NORMAL2);
func_8005AD1C(play->cameraPtrs[MAIN_CAM], 4);
this->switchFlag = 10;
}
} else {
Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_NORMAL2);
Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_NORMAL2);
if (!func_8004356C(&this->dyna)) {
if (this->switchFlag != 0) {
this->switchFlag--;
}
}
if (this->switchFlag == 0) {
Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], this->cameraSetting);
func_8005ACFC(globalCtx->cameraPtrs[MAIN_CAM], 4);
Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], this->cameraSetting);
func_8005ACFC(play->cameraPtrs[MAIN_CAM], 4);
}
}
this->dyna.actor.world.pos.y =
@ -377,17 +377,17 @@ void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void func_8086C9A8(BgBdanObjects* this, GlobalContext* globalCtx) {
if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
void func_8086C9A8(BgBdanObjects* this, PlayState* play) {
if (Flags_GetSwitch(play, this->switchFlag)) {
this->timer = 100;
this->actionFunc = func_8086C9F0;
}
}
void func_8086C9F0(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C9F0(BgBdanObjects* this, PlayState* play) {
if (this->timer == 0) {
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 0.5f)) {
Flags_UnsetSwitch(globalCtx, this->switchFlag);
Flags_UnsetSwitch(play, this->switchFlag);
this->actionFunc = func_8086C9A8;
}
func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
@ -397,10 +397,10 @@ void func_8086C9F0(BgBdanObjects* this, GlobalContext* globalCtx) {
}
func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
}
globalCtx->colCtx.colHeader->waterBoxes[7].ySurface = this->dyna.actor.world.pos.y;
play->colCtx.colHeader->waterBoxes[7].ySurface = this->dyna.actor.world.pos.y;
}
void func_8086CABC(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086CABC(BgBdanObjects* this, PlayState* play) {
if (this->timer != 0) {
this->timer--;
}
@ -410,17 +410,17 @@ void func_8086CABC(BgBdanObjects* this, GlobalContext* globalCtx) {
}
}
void func_8086CB10(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086CB10(BgBdanObjects* this, PlayState* play) {
if (func_8004356C(&this->dyna)) {
Flags_SetSwitch(globalCtx, this->switchFlag);
Flags_SetSwitch(play, this->switchFlag);
this->timer = 50;
this->actionFunc = func_8086CB8C;
this->dyna.actor.home.pos.y -= 200.0f;
OnePointCutscene_Init(globalCtx, 3100, 51, &this->dyna.actor, MAIN_CAM);
OnePointCutscene_Init(play, 3100, 51, &this->dyna.actor, MAIN_CAM);
}
}
void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086CB8C(BgBdanObjects* this, PlayState* play) {
if (this->timer != 0) {
this->timer--;
}
@ -430,20 +430,20 @@ void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx) {
if (this->timer == 0) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U);
this->actionFunc = BgBdanObjects_DoNothing;
Gameplay_CopyCamera(globalCtx, MAIN_CAM, SUBCAM_ACTIVE);
Play_CopyCamera(play, MAIN_CAM, SUBCAM_ACTIVE);
} else {
func_8002F974(&this->dyna.actor, NA_SE_EV_BUYOSTAND_FALL - SFX_FLAG);
}
}
void BgBdanObjects_Update(Actor* thisx, GlobalContext* globalCtx) {
void BgBdanObjects_Update(Actor* thisx, PlayState* play) {
BgBdanObjects* this = (BgBdanObjects*)thisx;
Actor_SetFocus(thisx, 50.0f);
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
void BgBdanObjects_Draw(Actor* thisx, GlobalContext* globalCtx) {
void BgBdanObjects_Draw(Actor* thisx, PlayState* play) {
BgBdanObjects* this = (BgBdanObjects*)thisx;
if (thisx->params == 0) {
@ -455,8 +455,8 @@ void BgBdanObjects_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
if (thisx->params == 2) {
Gfx_DrawDListXlu(globalCtx, gJabuWaterDL);
Gfx_DrawDListXlu(play, gJabuWaterDL);
} else {
Gfx_DrawDListOpa(globalCtx, sDLists[thisx->params]);
Gfx_DrawDListOpa(play, sDLists[thisx->params]);
}
}

Some files were not shown because too many files have changed in this diff Show More