mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-02 22:14:33 +00:00
Move PlayState
to a new z64play.h
(#1966)
* ActorContext * frameadvance * SfxSource * GameOverContext * RoomContext * TransitionActorContext * fix bss * Move PlayState * Move play functions to new header * SAC_ENABLE * no longer needed * SAC_ENABLE again * z_demo being silly * comment * format headers * fix retail bss * actually fix bss * Cutscene_ProcessScript comment * bss again * Update src/code/z_demo.c Co-authored-by: cadmic <cadmic24@gmail.com> * rename to frame_advance and remove it from z64.h * move macros too * review * Rename SequenceContext to SceneSequences --------- Co-authored-by: cadmic <cadmic24@gmail.com>
This commit is contained in:
parent
2ce4742bf6
commit
d8f2e9abc6
32 changed files with 443 additions and 329 deletions
250
include/z64.h
250
include/z64.h
|
@ -20,6 +20,7 @@
|
|||
#include "z64curve.h"
|
||||
#include "z64scene.h"
|
||||
#include "z64effect.h"
|
||||
#include "z64game_over.h"
|
||||
#include "z64item.h"
|
||||
#include "z64animation.h"
|
||||
#include "z64animation_legacy.h"
|
||||
|
@ -28,11 +29,13 @@
|
|||
#include "z64map_mark.h"
|
||||
#include "z64message.h"
|
||||
#include "z64pause.h"
|
||||
#include "z64play.h"
|
||||
#include "z64skin.h"
|
||||
#include "z64game.h"
|
||||
#include "z64transition.h"
|
||||
#include "z64transition_instances.h"
|
||||
#include "z64interface.h"
|
||||
#include "z64sfx_source.h"
|
||||
#include "z64skybox.h"
|
||||
#include "z64sram.h"
|
||||
#include "z64view.h"
|
||||
|
@ -104,90 +107,6 @@
|
|||
// NOTE: Once we start supporting other builds, this can be changed with an ifdef
|
||||
#define REGION_NATIVE REGION_EU
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 seqId;
|
||||
/* 0x01 */ u8 natureAmbienceId;
|
||||
} SequenceContext; // size = 0x2
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s32 enabled;
|
||||
/* 0x04 */ s32 timer;
|
||||
} FrameAdvanceContext; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Vec3f pos;
|
||||
/* 0x0C */ f32 unk_0C; // radius?
|
||||
/* 0x10 */ Color_RGB8 color;
|
||||
} TargetContextEntry; // size = 0x14
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Vec3f naviRefPos; // possibly wrong
|
||||
/* 0x0C */ Vec3f targetCenterPos;
|
||||
/* 0x18 */ Color_RGBAf naviInner;
|
||||
/* 0x28 */ Color_RGBAf naviOuter;
|
||||
/* 0x38 */ Actor* arrowPointedActor;
|
||||
/* 0x3C */ Actor* targetedActor;
|
||||
/* 0x40 */ f32 unk_40;
|
||||
/* 0x44 */ f32 unk_44;
|
||||
/* 0x48 */ s16 unk_48;
|
||||
/* 0x4A */ u8 activeCategory;
|
||||
/* 0x4B */ u8 unk_4B;
|
||||
/* 0x4C */ s8 unk_4C;
|
||||
/* 0x4D */ char unk_4D[0x03];
|
||||
/* 0x50 */ TargetContextEntry arr_50[3];
|
||||
/* 0x8C */ Actor* unk_8C;
|
||||
/* 0x90 */ Actor* bgmEnemy; // The nearest enemy to player with the right flags that will trigger NA_BGM_ENEMY
|
||||
/* 0x94 */ Actor* unk_94;
|
||||
} TargetContext; // size = 0x98
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ void* texture;
|
||||
/* 0x04 */ s16 x;
|
||||
/* 0x06 */ s16 y;
|
||||
/* 0x08 */ u8 width;
|
||||
/* 0x09 */ u8 height;
|
||||
/* 0x0A */ u8 durationTimer; // how long the title card appears for before fading
|
||||
/* 0x0B */ u8 delayTimer; // how long the title card waits to appear
|
||||
/* 0x0C */ s16 alpha;
|
||||
/* 0x0E */ s16 intensity;
|
||||
} TitleCardContext; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s32 length; // number of actors loaded of this category
|
||||
/* 0x04 */ Actor* head; // pointer to head of the linked list of this category (most recent actor added)
|
||||
} ActorListEntry; // size = 0x08
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ u8 freezeFlashTimer;
|
||||
/* 0x0001 */ char unk_01[0x01];
|
||||
/* 0x0002 */ u8 unk_02;
|
||||
/* 0x0003 */ u8 lensActive;
|
||||
/* 0x0004 */ char unk_04[0x04];
|
||||
/* 0x0008 */ u8 total; // total number of actors loaded
|
||||
/* 0x000C */ ActorListEntry actorLists[ACTORCAT_MAX];
|
||||
/* 0x006C */ TargetContext targetCtx;
|
||||
struct {
|
||||
/* 0x0104 */ u32 swch;
|
||||
/* 0x0108 */ u32 tempSwch;
|
||||
/* 0x010C */ u32 unk0;
|
||||
/* 0x0110 */ u32 unk1;
|
||||
/* 0x0114 */ u32 chest;
|
||||
/* 0x0118 */ u32 clear;
|
||||
/* 0x011C */ u32 tempClear;
|
||||
/* 0x0120 */ u32 collect;
|
||||
/* 0x0124 */ u32 tempCollect;
|
||||
} flags;
|
||||
/* 0x0128 */ TitleCardContext titleCtx;
|
||||
/* 0x0138 */ char unk_138[0x04];
|
||||
/* 0x013C */ void* absoluteSpace; // Space used to allocate actor overlays with alloc type ACTOROVL_ALLOC_ABSOLUTE
|
||||
} ActorContext; // size = 0x140
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u16 countdown;
|
||||
/* 0x04 */ Vec3f worldPos;
|
||||
/* 0x10 */ Vec3f projectedPos;
|
||||
} SfxSource; // size = 0x1C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ void* loadedRamAddr;
|
||||
/* 0x04 */ RomFile file;
|
||||
|
@ -203,86 +122,11 @@ typedef enum {
|
|||
/* 2 */ KALEIDO_OVL_MAX
|
||||
} KaleidoOverlayType;
|
||||
|
||||
typedef enum {
|
||||
/* 00 */ GAMEOVER_INACTIVE,
|
||||
/* 01 */ GAMEOVER_DEATH_START,
|
||||
/* 02 */ GAMEOVER_DEATH_WAIT_GROUND, // wait for link to fall and hit the ground
|
||||
/* 03 */ GAMEOVER_DEATH_DELAY_MENU, // wait for 1 second before showing the game over menu
|
||||
/* 04 */ GAMEOVER_DEATH_MENU, // do nothing while kaleidoscope handles the game over menu
|
||||
/* 20 */ GAMEOVER_REVIVE_START = 20,
|
||||
/* 21 */ GAMEOVER_REVIVE_RUMBLE,
|
||||
/* 22 */ GAMEOVER_REVIVE_WAIT_GROUND, // wait for link to fall and hit the ground
|
||||
/* 23 */ GAMEOVER_REVIVE_WAIT_FAIRY, // wait for the fairy to rise all the way up out of links body
|
||||
/* 24 */ GAMEOVER_REVIVE_FADE_OUT // fade out the game over lights as link is revived and gets back up
|
||||
} GameOverState;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u16 state;
|
||||
} GameOverContext; // size = 0x2
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ LENS_MODE_SHOW_ACTORS, // lens actors are invisible by default, and shown by using lens (for example, invisible enemies)
|
||||
/* 1 */ LENS_MODE_HIDE_ACTORS // lens actors are visible by default, and hidden by using lens (for example, fake walls)
|
||||
} LensMode;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ ROOM_BEHAVIOR_TYPE1_0,
|
||||
/* 1 */ ROOM_BEHAVIOR_TYPE1_1,
|
||||
/* 2 */ ROOM_BEHAVIOR_TYPE1_2,
|
||||
/* 3 */ ROOM_BEHAVIOR_TYPE1_3, // unused
|
||||
/* 4 */ ROOM_BEHAVIOR_TYPE1_4, // unused
|
||||
/* 5 */ ROOM_BEHAVIOR_TYPE1_5
|
||||
} RoomBehaviorType1;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ ROOM_BEHAVIOR_TYPE2_0,
|
||||
/* 1 */ ROOM_BEHAVIOR_TYPE2_1,
|
||||
/* 2 */ ROOM_BEHAVIOR_TYPE2_2,
|
||||
/* 3 */ ROOM_BEHAVIOR_TYPE2_3,
|
||||
/* 4 */ ROOM_BEHAVIOR_TYPE2_4,
|
||||
/* 5 */ ROOM_BEHAVIOR_TYPE2_5,
|
||||
/* 6 */ ROOM_BEHAVIOR_TYPE2_6
|
||||
} RoomBehaviorType2;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s8 num;
|
||||
/* 0x01 */ u8 unk_01;
|
||||
/* 0x02 */ u8 behaviorType2;
|
||||
/* 0x03 */ u8 behaviorType1;
|
||||
/* 0x04 */ s8 echo;
|
||||
/* 0x05 */ u8 lensMode;
|
||||
/* 0x08 */ RoomShape* roomShape; // original name: "ground_shape"
|
||||
/* 0x0C */ void* segment;
|
||||
/* 0x10 */ char unk_10[0x4];
|
||||
} Room; // size = 0x14
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Room curRoom;
|
||||
/* 0x14 */ Room prevRoom;
|
||||
/* 0x28 */ void* bufPtrs[2];
|
||||
/* 0x30 */ u8 unk_30;
|
||||
/* 0x31 */ s8 status;
|
||||
/* 0x34 */ void* unk_34;
|
||||
/* 0x38 */ DmaRequest dmaRequest;
|
||||
/* 0x58 */ OSMesgQueue loadQueue;
|
||||
/* 0x70 */ OSMesg loadMsg;
|
||||
/* 0x74 */ s16 unk_74[2]; // context-specific data used by the current scene draw config
|
||||
} RoomContext; // size = 0x78
|
||||
|
||||
#define SAC_ENABLE (1 << 0)
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ s16 colATCount;
|
||||
/* 0x002 */ u16 sacFlags;
|
||||
/* 0x004 */ Collider* colAT[COLLISION_CHECK_AT_MAX];
|
||||
/* 0x0CC */ s32 colACCount;
|
||||
/* 0x0D0 */ Collider* colAC[COLLISION_CHECK_AC_MAX];
|
||||
/* 0x1C0 */ s32 colOCCount;
|
||||
/* 0x1C4 */ Collider* colOC[COLLISION_CHECK_OC_MAX];
|
||||
/* 0x28C */ s32 colLineCount;
|
||||
/* 0x290 */ OcLine* colLine[COLLISION_CHECK_OC_LINE_MAX];
|
||||
} CollisionCheckContext; // size = 0x29C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ GameState state;
|
||||
} SetupState; // size = 0xA4
|
||||
|
@ -339,18 +183,13 @@ typedef struct {
|
|||
/* 0x00A8 */ View view;
|
||||
} SampleState; // size = 0x1D0
|
||||
|
||||
typedef struct {
|
||||
typedef struct QuestHintCmd {
|
||||
/* 0x00 */ u8 byte0;
|
||||
/* 0x01 */ u8 byte1;
|
||||
/* 0x02 */ u8 byte2;
|
||||
/* 0x03 */ u8 byte3;
|
||||
} QuestHintCmd; // size = 0x4
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 numActors;
|
||||
/* 0x04 */ TransitionActorEntry* list;
|
||||
} TransitionActorContext; // size = 0x8
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ PAUSE_BG_PRERENDER_OFF, // Inactive, do nothing.
|
||||
/* 1 */ PAUSE_BG_PRERENDER_SETUP, // The current frame is only drawn for the purpose of serving as the pause background.
|
||||
|
@ -366,87 +205,6 @@ typedef enum {
|
|||
/* 3 */ TRANS_TILE_READY // The transition is ready, so will update and draw each frame
|
||||
} TransitionTileState;
|
||||
|
||||
typedef struct PlayState {
|
||||
/* 0x00000 */ GameState state;
|
||||
/* 0x000A4 */ s16 sceneId;
|
||||
/* 0x000A6 */ u8 sceneDrawConfig;
|
||||
/* 0x000A7 */ char unk_A7[0x9];
|
||||
/* 0x000B0 */ void* sceneSegment;
|
||||
/* 0x000B8 */ View view;
|
||||
/* 0x001E0 */ Camera mainCamera;
|
||||
/* 0x0034C */ Camera subCameras[NUM_CAMS - CAM_ID_SUB_FIRST];
|
||||
/* 0x00790 */ Camera* cameraPtrs[NUM_CAMS];
|
||||
/* 0x007A0 */ s16 activeCamId;
|
||||
/* 0x007A2 */ s16 nextCamId;
|
||||
/* 0x007A4 */ SequenceContext sequenceCtx;
|
||||
/* 0x007A8 */ LightContext lightCtx;
|
||||
/* 0x007B8 */ FrameAdvanceContext frameAdvCtx;
|
||||
/* 0x007C0 */ CollisionContext colCtx;
|
||||
/* 0x01C24 */ ActorContext actorCtx;
|
||||
/* 0x01D64 */ CutsceneContext csCtx; // "demo_play"
|
||||
/* 0x01DB4 */ SfxSource sfxSources[16];
|
||||
/* 0x01F74 */ SramContext sramCtx;
|
||||
/* 0x01F78 */ SkyboxContext skyboxCtx;
|
||||
/* 0x020D8 */ MessageContext msgCtx; // "message"
|
||||
/* 0x104F0 */ InterfaceContext interfaceCtx; // "parameter"
|
||||
/* 0x10760 */ PauseContext pauseCtx;
|
||||
/* 0x10A20 */ GameOverContext gameOverCtx;
|
||||
/* 0x10A24 */ EnvironmentContext envCtx;
|
||||
/* 0x10B20 */ AnimTaskQueue animTaskQueue;
|
||||
/* 0x117A4 */ ObjectContext objectCtx;
|
||||
/* 0x11CBC */ RoomContext roomCtx;
|
||||
/* 0x11D34 */ TransitionActorContext transiActorCtx;
|
||||
/* 0x11D3C */ void (*playerInit)(Player* player, struct PlayState* play, FlexSkeletonHeader* skelHeader);
|
||||
/* 0x11D40 */ void (*playerUpdate)(Player* player, struct PlayState* play, Input* input);
|
||||
/* 0x11D44 */ int (*isPlayerDroppingFish)(struct PlayState* play);
|
||||
/* 0x11D48 */ s32 (*startPlayerFishing)(struct PlayState* play);
|
||||
/* 0x11D4C */ s32 (*grabPlayer)(struct PlayState* play, Player* player);
|
||||
/* 0x11D50 */ s32 (*tryPlayerCsAction)(struct PlayState* play, Actor* actor, s32 csAction);
|
||||
/* 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;
|
||||
/* 0x11DE4 */ u32 gameplayFrames;
|
||||
/* 0x11DE8 */ u8 linkAgeOnLoad;
|
||||
/* 0x11DE9 */ u8 haltAllActors;
|
||||
/* 0x11DEA */ u8 spawn;
|
||||
/* 0x11DEB */ u8 numActorEntries;
|
||||
/* 0x11DEC */ u8 numRooms;
|
||||
/* 0x11DF0 */ RomFile* roomList;
|
||||
/* 0x11DF4 */ ActorEntry* playerEntry;
|
||||
/* 0x11DF8 */ ActorEntry* actorEntryList;
|
||||
/* 0x11DFC */ void* unk_11DFC;
|
||||
/* 0x11E00 */ Spawn* spawnList;
|
||||
/* 0x11E04 */ s16* exitList;
|
||||
/* 0x11E08 */ Path* pathList;
|
||||
/* 0x11E0C */ QuestHintCmd* naviQuestHints;
|
||||
/* 0x11E10 */ void* specialEffects;
|
||||
/* 0x11E14 */ u8 skyboxId;
|
||||
/* 0x11E15 */ s8 transitionTrigger; // "fade_direction"
|
||||
/* 0x11E16 */ s16 unk_11E16;
|
||||
/* 0x11E18 */ s16 bgCoverAlpha;
|
||||
/* 0x11E1A */ s16 nextEntranceIndex;
|
||||
/* 0x11E1C */ char unk_11E1C[0x40];
|
||||
/* 0x11E5C */ s8 shootingGalleryStatus;
|
||||
/* 0x11E5D */ s8 bombchuBowlingStatus; // "bombchu_game_flag"
|
||||
/* 0x11E5E */ u8 transitionType;
|
||||
/* 0x11E60 */ CollisionCheckContext colChkCtx;
|
||||
/* 0x120FC */ u16 cutsceneFlags[20];
|
||||
/* 0x12124 */ PreRender pauseBgPreRender;
|
||||
/* 0x12174 */ char unk_12174[0x53];
|
||||
/* 0x121C7 */ s8 unk_121C7;
|
||||
/* 0x121C8 */ TransitionContext transitionCtx;
|
||||
/* 0x12418 */ char unk_12418[0x3];
|
||||
/* 0x1241B */ u8 transitionMode; // "fbdemo_wipe_modem"
|
||||
/* 0x1241C */ TransitionFade transitionFadeFlash; // Transition fade instance which flashes screen, see R_TRANS_FADE_FLASH_ALPHA_STEP
|
||||
/* 0x12428 */ char unk_12428[0x3];
|
||||
/* 0x1242B */ u8 viewpoint; // toggleable camera setting by shops or player. Is also equal to the bgCamIndex + 1
|
||||
/* 0x1242C */ SceneTableEntry* loadedScene;
|
||||
/* 0x12430 */ char unk_12430[0xE8];
|
||||
} PlayState; // size = 0x12518
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ GameState state;
|
||||
/* 0x00A8 */ View view;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue