1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 05:19:36 +00:00
oot/include/z64scene.h
krimtonz 321388673b
decompile z_camera (#398)
* cleanup

* name camera action functions

* decompile a few small functions, name a few Camera struct members

* decompile camera data, decompile a few camera functions

* Split ASM for code_800BB0A0

* removing code_800BB0A0.s

* PR Requests, Camera WIP

* remove #define NON_MATCHING from db_camera

* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c

* camera wip

* rename some struct memebers, some decomp wip

* pr updates

* camera wip

* name some fields in Camera Struct, being making sense of Camera_Update

* Camera WIP

* wip

* wip

* add z64camera.h header, begin creating CameraSetting macros

* wip

* wip

* wip

* wip

* migrate camera bss to c

* match a couple functions in db_camera

* match some small db_camera functions

* wip

* migrate db_camera rodata, match a few functions

* remote db_camera.rodata.s

* match some of db_camera

* identify types of some unknown data pieces

* some small wip

* Match Camera_Init, some function changes, some struct name changes.  Change unk_C0 and unk_CC to floats from Vec3fs

* add naming for a few more Camera struct members

* wip

* match func_80043F94

* Match Camera_Jump1

* document some of Camera_Jump1

* wip

* match Camera_Jump3

* Match Camera_Update, FeelsAmazing

* wip

* wip

* match Camera_SetParam

* minor cleanup

* wip

* wip

* match Camera_KeepOn0

* some documentation, modify some matching functions to match style of others.

* match Camera_Demo1

* match camera_demo9

* document Camera_Demo1 and Camera_Demo9

* wip

* Match camera_battle4

* match camera_unique2

* Match Camera_Unique3

* match camera_special6

* match Camera_Special5

* wip

* document camera_special6

* naming updates

* match camera_Unique1

* match Camera_Unique0

* wip

* Match Camera_CalcUpFromPitchYawRoll

* match func_80045508

* document Camera_Battle4

* document several camera functions, move camera data to separate file

* rename phi/theta to pitch/yaw

* wip

* uniq9 wip

* Camera_Unqiue9 OK

* document Camera_Unique9

* name unk_160 in camera struct

* wip

* wip

* minor updates

* fix conflicts

* wip

* wip

* Olib updates

* wip

* wip

* rename most Math3D functions, few matches, documentation

* wip

* document most of math3d

* wip

* wip

* wip

* pr updates

* Match Camera_Fixed4

* match func_80058E8C

* pr updates

* add missing comment block finalizer

* Merge math3dupdates

* match Camera_ChangeSetting

* Match Camera_ChangeMode

* match func_80058148

* Match Camera_Special9

* decompile the rest of camera data

* match Camera_Demo5

* name a few camera functions in z_play

* match func_80046CB4, some work on other fucntions

* wip

* impove some non matchings

* fix function rename

* match func_800588B4

* match Camera_Subj4

* wip

* Camera_Demo3 matching, Camera_Battle1 big progress

* Camera_Normal2 OK

* wip

* match Camera_Parallel1

* normalize some things across functions

* match Camera_Normal1

* Match Camera_Normal3

* some cleanup

* more cleanup

* more cleanup , match Camera_CalcDefaultPitch

* data formatting

* Match Camera_Jump2

* document Camera_Jump2

* Match Camera_KeepOn3

* document some of Camera_KeepOn3

* improve some non_matchings

* match func_80045C74 and func_800460A8

* code cleanup, documentation

* match Camera_KeepOn1

* Match Camera_Subj3

* Match Camera_Battle1

* remove non_matching from func_80044adc and func_80046e20

* name several members of Battle1

* more documentation on Battle1

* cleanup

* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector

* reorganize update structs, remove final references to params, remove CameraParams union

* implement camera enums into player

* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player

* remove non-global camera variables from variables.h

* clean up some variable declarations

* finish pr comment updates

* fix some warnings

* data formatting

* finish commenting on data

* delete unused asm

* remove asm

Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 17:39:47 -05:00

481 lines
11 KiB
C

#ifndef _Z64SCENE_H_
#define _Z64SCENE_H_
typedef struct {
/* 0x00 */ u32 vromStart;
/* 0x04 */ u32 vromEnd;
} RomFile; // size = 0x8
typedef struct {
/* 0x00 */ RomFile sceneFile;
/* 0x08 */ RomFile titleFile;
/* 0x10 */ u8 unk_10;
/* 0x11 */ u8 config;
/* 0x12 */ u8 unk_12;
/* 0x13 */ u8 unk_13;
} Scene; // size = 0x14
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ u32 data2;
} SCmdBase;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ u32 segment;
} SCmdSpawnList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 num;
/* 0x04 */ u32 segment;
} SCmdActorList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ u32 segment;
} SCmdCsCameraList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ u32 segment;
} SCmdColHeader;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 num;
/* 0x04 */ u32 segment;
} SCmdRoomList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x02 */ char pad[2];
/* 0x04 */ s8 unk_04;
/* 0x05 */ s8 unk_05;
/* 0x06 */ s8 unk_06;
/* 0x07 */ u8 unk_07;
} SCmdWindSettings;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ u32 segment;
} SCmdEntranceList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 cUpElfMsgNum;
/* 0x04 */ u32 keepObjectId;
} SCmdSpecialFiles;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 gpFlag1;
/* 0x04 */ u32 gpFlag2;
} SCmdRoomBehavior;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ u32 segment;
} SCmdMesh;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 num;
/* 0x04 */ u32 segment;
} SCmdObjectList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 num;
/* 0x04 */ u32 segment;
} SCmdLightList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ u32 segment;
} SCmdPathList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 num;
/* 0x04 */ u32 segment;
} SCmdTransiActorList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 num;
/* 0x04 */ u32 segment;
} SCmdLightSettingList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x02 */ char pad[2];
/* 0x04 */ u8 hour;
/* 0x05 */ u8 min;
/* 0x06 */ u8 unk_06;
} SCmdTimeSettings;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x02 */ char pad[2];
/* 0x04 */ u8 skyboxId;
/* 0x05 */ u8 unk_05;
/* 0x06 */ u8 unk_06;
} SCmdSkyboxSettings;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x02 */ char pad[2];
/* 0x04 */ u8 unk_04;
/* 0x05 */ u8 unk_05;
} SCmdSkyboxDisables;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ u32 data2;
} SCmdEndMarker;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ u32 segment;
} SCmdExitList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 bgmId;
/* 0x02 */ char pad[4];
/* 0x06 */ u8 nightSeqIndex;
/* 0x07 */ u8 seqIndex;
} SCmdSoundSettings;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x02 */ char pad[5];
/* 0x07 */ u8 echo;
} SCmdEchoSettings;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ u32 segment;
} SCmdCutsceneData;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ u32 segment;
} SCmdAltHeaders;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 cameraMovement;
/* 0x04 */ u32 area;
} SCmdMiscSettings;
typedef struct {
u8 headerType;
} MeshHeaderBase;
typedef struct {
MeshHeaderBase base;
u8 numEntries;
u32 dListStart;
u32 dListEnd;
} MeshHeader0;
typedef struct {
u32 opaqueDList;
u32 translucentDList;
} MeshEntry0;
typedef struct {
MeshHeaderBase base;
u8 format;
u32 entryRecord;
} MeshHeader1Base;
typedef struct {
MeshHeader1Base base;
u32 imagePtr; // 0x08
u32 unknown; // 0x0C
u32 unknown2; // 0x10
u16 bgWidth; // 0x14
u16 bgHeight; // 0x16
u8 imageFormat; // 0x18
u8 imageSize; // 0x19
u16 imagePal; // 0x1A
u16 imageFlip; // 0x1C
} MeshHeader1Single;
typedef struct {
MeshHeader1Base base;
u8 bgCnt;
u32 bgRecordPtr;
} MeshHeader1Multi;
typedef struct {
u16 unknown; // 0x00
s8 bgID; // 0x02
u32 imagePtr; // 0x04
u32 unknown2; // 0x08
u32 unknown3; // 0x0C
u16 bgWidth; // 0x10
u16 bgHeight; // 0x12
u8 imageFmt; // 0x14
u8 imageSize; // 0x15
u16 imagePal; // 0x16
u16 imageFlip; // 0x18
} BackgroundRecord;
typedef struct {
s16 playerXMax, playerZMax;
s16 playerXMin, playerZMin;
u32 opaqueDList;
u32 translucentDList;
} MeshEntry2;
typedef struct {
MeshHeaderBase base;
u8 numEntries;
u32 dListStart;
u32 dListEnd;
} MeshHeader2;
typedef struct {
u8 ambientClrR, ambientClrG, ambientClrB;
u8 diffuseClrA_R, diffuseClrA_G, diffuseClrA_B;
u8 diffuseDirA_X, diffuseDirA_Y, diffuseDirA_Z;
u8 diffuseClrB_R, diffuseClrB_G, diffuseClrB_B;
u8 diffuseDirB_X, diffuseDirB_Y, diffuseDirB_Z;
u8 fogClrR, fogClrG, fogClrB;
u16 unk;
u16 drawDistance;
} LightSettings;
typedef struct {
s16 absMinX, absMinY, absMinZ;
s16 absMaxX, absMaxY, absMaxZ;
s16 numVerts;
s32 vtxSegmentOffset;
s16 numPolygons;
s32 polySegmentOffset;
s32 polyTypeDefSegmentOffset;
s32 camDataSegmentOffset;
s16 numWaterBoxes;
s32 waterBoxSegmentOffset;
} ColHeader;
typedef struct {
/* 0x0000 */ Vec3s pos;
/* 0x0006 */ Vec3s rot;
/* 0x000C */ s16 fov;
/* 0x000E */ s16 jfifId;
/* 0x0010 */ s16 unk_10;
} CamPosData; // size = 0x12
typedef struct {
/* 0x0000 */ s16 cameraSType;
/* 0x0002 */ s16 numCameras;
/* 0x0004 */ CamPosData* camPosDataSeg;
} CamData; // size = 0x08
typedef struct {
u32 unknown;
u32 camPosDataSeg;
} CamPosDataEntry;
/*
typedef union {
_CamData data;
long long int forceStructAlignment;
} CamData;
*/
/*
typedef union {
_CamPosData data;
long long int forceStructAlignment;
} CamPosData;
*/
typedef struct {
s16 type;
s16 vtxA, vtxB, vtxC;
s16 a, b, c, d;
} RoomPoly;
typedef struct {
s16 xMin;
s16 ySurface;
s16 zMin;
s16 xLength;
s16 zLength;
s32 properties;
} WaterBoxHeader;
typedef struct {
/* 0x00 */ u8 count; // number of points in the path
/* 0x04 */ Vec3s* points; // Segment Address to the array of points
} Path; // size = 0x8
typedef union {
SCmdBase base;
SCmdSpawnList spawnList;
SCmdActorList actorList;
SCmdCsCameraList csCameraList;
SCmdRoomList roomList;
SCmdEntranceList entranceList;
SCmdObjectList objectList;
SCmdLightList lightList;
SCmdPathList pathList;
SCmdTransiActorList transiActorList;
SCmdLightSettingList lightSettingList;
SCmdExitList exitList;
SCmdColHeader colHeader;
SCmdMesh mesh;
SCmdSpecialFiles specialFiles;
SCmdCutsceneData cutsceneData;
SCmdRoomBehavior roomBehavior;
SCmdWindSettings windSettings;
SCmdTimeSettings timeSettings;
SCmdSkyboxSettings skyboxSettings;
SCmdSkyboxDisables skyboxDisables;
SCmdEndMarker endMarker;
SCmdSoundSettings soundSettings;
SCmdEchoSettings echoSettings;
SCmdMiscSettings miscSettings;
SCmdAltHeaders altHeaders;
} SceneCmd; // size = 0x8
typedef enum {
/* 0x00 */ SCENE_YDAN,
/* 0x01 */ SCENE_DDAN,
/* 0x02 */ SCENE_BDAN,
/* 0x03 */ SCENE_BMORI1,
/* 0x04 */ SCENE_HIDAN,
/* 0x05 */ SCENE_MIZUSIN,
/* 0x06 */ SCENE_JYASINZOU,
/* 0x07 */ SCENE_HAKADAN,
/* 0x08 */ SCENE_HAKADANCH,
/* 0x09 */ SCENE_ICE_DOUKUTO,
/* 0x0A */ SCENE_GANON,
/* 0x0B */ SCENE_MEN,
/* 0x0C */ SCENE_GERUDOWAY,
/* 0x0D */ SCENE_GANONTIKA,
/* 0x0E */ SCENE_GANON_SONOGO,
/* 0x0F */ SCENE_GANONTIKA_SONOGO,
/* 0x10 */ SCENE_TAKARAYA,
/* 0x11 */ SCENE_YDAN_BOSS,
/* 0x12 */ SCENE_DDAN_BOSS,
/* 0x13 */ SCENE_BDAN_BOSS,
/* 0x14 */ SCENE_MORIBOSSROOM,
/* 0x15 */ SCENE_FIRE_BS,
/* 0x16 */ SCENE_MIZUSIN_BS,
/* 0x17 */ SCENE_JYASINBOSS,
/* 0x18 */ SCENE_HAKADAN_BS,
/* 0x19 */ SCENE_GANON_BOSS,
/* 0x1A */ SCENE_GANON_FINAL,
/* 0x1B */ SCENE_ENTRA,
/* 0x1C */ SCENE_ENTRA_N,
/* 0x1D */ SCENE_ENRUI,
/* 0x1E */ SCENE_MARKET_ALLEY,
/* 0x1F */ SCENE_MARKET_ALLEY_N,
/* 0x20 */ SCENE_MARKET_DAY,
/* 0x21 */ SCENE_MARKET_NIGHT,
/* 0x22 */ SCENE_MARKET_RUINS,
/* 0x23 */ SCENE_SHRINE,
/* 0x24 */ SCENE_SHRINE_N,
/* 0x25 */ SCENE_SHRINE_R,
/* 0x26 */ SCENE_KOKIRI_HOME,
/* 0x27 */ SCENE_KOKIRI_HOME3,
/* 0x28 */ SCENE_KOKIRI_HOME4,
/* 0x29 */ SCENE_KOKIRI_HOME5,
/* 0x2A */ SCENE_KAKARIKO,
/* 0x2B */ SCENE_KAKARIKO3,
/* 0x2C */ SCENE_SHOP1,
/* 0x2D */ SCENE_KOKIRI_SHOP,
/* 0x2E */ SCENE_GOLON,
/* 0x2F */ SCENE_ZOORA,
/* 0x30 */ SCENE_DRAG,
/* 0x31 */ SCENE_ALLEY_SHOP,
/* 0x32 */ SCENE_NIGHT_SHOP,
/* 0x33 */ SCENE_FACE_SHOP,
/* 0x34 */ SCENE_LINK_HOME,
/* 0x35 */ SCENE_IMPA,
/* 0x36 */ SCENE_MALON_STABLE,
/* 0x37 */ SCENE_LABO,
/* 0x38 */ SCENE_HYLIA_LABO,
/* 0x39 */ SCENE_TENT,
/* 0x3A */ SCENE_HUT,
/* 0x3B */ SCENE_DAIYOUSEI_IZUMI,
/* 0x3C */ SCENE_YOUSEI_IZUMI_TATE,
/* 0x3D */ SCENE_YOUSEI_IZUMI_YOKO,
/* 0x3E */ SCENE_KAKUSIANA,
/* 0x3F */ SCENE_HAKAANA,
/* 0x40 */ SCENE_HAKAANA2,
/* 0x41 */ SCENE_HAKAANA_OUKE,
/* 0x42 */ SCENE_SYATEKIJYOU,
/* 0x43 */ SCENE_TOKINOMA,
/* 0x44 */ SCENE_KENJYANOMA,
/* 0x45 */ SCENE_HAIRAL_NIWA,
/* 0x46 */ SCENE_HAIRAL_NIWA_N,
/* 0x47 */ SCENE_HIRAL_DEMO,
/* 0x48 */ SCENE_HAKASITARELAY,
/* 0x49 */ SCENE_TURIBORI,
/* 0x4A */ SCENE_NAKANIWA,
/* 0x4B */ SCENE_BOWLING,
/* 0x4C */ SCENE_SOUKO,
/* 0x4D */ SCENE_MIHARIGOYA,
/* 0x4E */ SCENE_MAHOUYA,
/* 0x4F */ SCENE_GANON_DEMO,
/* 0x50 */ SCENE_KINSUTA,
/* 0x51 */ SCENE_SPOT00,
/* 0x52 */ SCENE_SPOT01,
/* 0x53 */ SCENE_SPOT02,
/* 0x54 */ SCENE_SPOT03,
/* 0x55 */ SCENE_SPOT04,
/* 0x56 */ SCENE_SPOT05,
/* 0x57 */ SCENE_SPOT06,
/* 0x58 */ SCENE_SPOT07,
/* 0x59 */ SCENE_SPOT08,
/* 0x5A */ SCENE_SPOT09,
/* 0x5B */ SCENE_SPOT10,
/* 0x5C */ SCENE_SPOT11,
/* 0x5D */ SCENE_SPOT12,
/* 0x5E */ SCENE_SPOT13,
/* 0x5F */ SCENE_SPOT15,
/* 0x60 */ SCENE_SPOT16,
/* 0x61 */ SCENE_SPOT17,
/* 0x62 */ SCENE_SPOT18,
/* 0x63 */ SCENE_SPOT20,
/* 0x64 */ SCENE_GANON_TOU,
// Debug only scenes
/* 0x65 */ SCENE_TEST01,
/* 0x66 */ SCENE_BESITU,
/* 0x67 */ SCENE_DEPTH_TEST,
/* 0x68 */ SCENE_SYOTES,
/* 0x69 */ SCENE_SYOTES2,
/* 0x6A */ SCENE_SUTARU,
/* 0x6B */ SCENE_HAIRAL_NIWA2,
/* 0x6C */ SCENE_SASATEST,
/* 0x6D */ SCENE_TESTROOM
} SceneID;
#endif