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
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)