mirror of
https://github.com/HarbourMasters/2ship2harkinian.git
synced 2024-11-23 22:19:53 +00:00
Decompile/Document bgCam and actorCsCam (combination of Camera/BgCheck/Play) (#932)
* Document bgCam and actorCsCam * index * Small PR suggestions * small suggestions * player stateflags * Fix bss * Fix BSS * Fix bss * Fix bss
This commit is contained in:
parent
6fc12c3a70
commit
04dd8d7b62
@ -894,11 +894,15 @@ void DynaPoly_UpdateBgActorTransforms(PlayState* play, DynaCollisionContext* dyn
|
||||
void CollisionHeader_SegmentedToVirtual(CollisionHeader* header);
|
||||
void CollisionHeader_GetVirtual(CollisionHeader* meshSegPtr, CollisionHeader** param_2);
|
||||
void BgCheck_InitCollisionHeaders(CollisionContext* colCtx, PlayState* play);
|
||||
u32 SurfaceType_GetData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId, s32 dataIdx);
|
||||
u32 SurfaceType_GetCamDataIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
u16 SurfaceType_GetCameraSType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
u16 SurfaceType_GetNumCameras(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
Vec3s* SurfaceType_GetCamPosData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
|
||||
u32 SurfaceType_GetBgCamIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
u16 BgCheck_GetBgCamSettingImpl(CollisionContext* colCtx, u32 bgCamIndex, s32 bgId);
|
||||
u16 BgCheck_GetBgCamSetting(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
u16 BgCheck_GetBgCamCountImpl(CollisionContext* colCtx, u32 bgCamIndex, s32 bgId);
|
||||
u16 BgCheck_GetBgCamCount(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
Vec3s* BgCheck_GetBgCamFuncDataImpl(CollisionContext* colCtx, s32 bgCamIndex, s32 bgId);
|
||||
Vec3s* BgCheck_GetBgCamFuncData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
|
||||
u32 SurfaceType_GetSceneExitIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
u32 func_800C99D4(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
u32 func_800C99FC(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
|
||||
@ -930,8 +934,8 @@ s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z
|
||||
s32 WaterBox_GetSurface1_2(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox);
|
||||
s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist, WaterBox** outWaterBox, s32* bgId);
|
||||
f32 func_800CA568(CollisionContext* colCtx, s32 waterBoxId, s32 bgId);
|
||||
u16 WaterBox_GetCameraSType(CollisionContext* colCtx, WaterBox* waterBox, s32 bgId);
|
||||
void func_800CA6B8(CollisionContext* colCtx, WaterBox* waterBox);
|
||||
u16 WaterBox_GetBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox, s32 bgId);
|
||||
void WaterBox_GetSceneBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox);
|
||||
u32 WaterBox_GetLightSettingIndex(CollisionContext* colCtx, WaterBox* waterBox);
|
||||
s32 func_800CA6F0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox, s32* bgId);
|
||||
s32 func_800CA9D0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox);
|
||||
@ -975,7 +979,7 @@ f32 func_800CB700(Camera* camera);
|
||||
// void func_800CB7F8(void);
|
||||
// void func_800CB828(void);
|
||||
// void func_800CB854(void);
|
||||
// void func_800CB880(void);
|
||||
// void Camera_IsSwimming(void);
|
||||
// void func_800CB8C8(void);
|
||||
// void func_800CB8F4(void);
|
||||
// void func_800CB924(void);
|
||||
@ -998,10 +1002,10 @@ f32 func_800CB700(Camera* camera);
|
||||
// void func_800CC488(void);
|
||||
// void func_800CC56C(void);
|
||||
// void func_800CC5C8(void);
|
||||
// void func_800CC740(void);
|
||||
// void func_800CC7A8(void);
|
||||
// void func_800CC804(void);
|
||||
// void func_800CC874(void);
|
||||
// void Camera_GetBgCamOrActorCsCamSetting(void);
|
||||
// void Camera_GetBgCamOrActorCsCamFuncData(void);
|
||||
// void Camera_GetBgCamIndex(void);
|
||||
// void Camera_GetWaterBoxBgCamSetting(void);
|
||||
// void func_800CC938(void);
|
||||
// void func_800CC958(void);
|
||||
// void func_800CC9C0(void);
|
||||
@ -2611,8 +2615,8 @@ void Play_CopyCamera(PlayState* play, s16 dstCamId, s16 srcCamId);
|
||||
// void func_80169A50(void);
|
||||
void Play_CameraChangeSetting(PlayState* play, s16 camId, s16 setting);
|
||||
void func_80169AFC(PlayState* play, s16 camId, s16 arg2);
|
||||
s16 Play_GetCsCamDataSetting(PlayState* play, s32 camId);
|
||||
Vec3s* Play_GetCsCamDataVec3s(PlayState* play, s32 camId);
|
||||
u16 Play_GetActorCsCamSetting(PlayState* play, s32 csCamDataIndex);
|
||||
Vec3s* Play_GetActorCsCamFuncData(PlayState* play, s32 csCamDataIndex);
|
||||
s16 Play_GetOriginalSceneNumber(s16 sceneNum);
|
||||
void Play_SaveCycleSceneFlags(GameState* gameState);
|
||||
void Play_SetRespawnData(GameState* gameState, s32 respawnNumber, u16 sceneSetup, s32 roomIndex, s32 playerParams, Vec3f* pos, s16 yaw);
|
||||
|
@ -1147,7 +1147,7 @@ struct PlayState {
|
||||
/* 0x1884C */ RomFile* roomList;
|
||||
/* 0x18850 */ ActorEntry* linkActorEntry;
|
||||
/* 0x18854 */ ActorEntry* setupActorList;
|
||||
/* 0x18858 */ CsCamData* csCamData;
|
||||
/* 0x18858 */ ActorCsCamInfo* actorCsCamList;
|
||||
/* 0x1885C */ EntranceEntry* setupEntranceList;
|
||||
/* 0x18860 */ u16* setupExitList;
|
||||
/* 0x18864 */ Path* setupPathList;
|
||||
|
@ -89,10 +89,21 @@ typedef struct CollisionPoly {
|
||||
} CollisionPoly; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ u16 setting;
|
||||
/* 0x2 */ s16 numData;
|
||||
/* 0x4 */ Vec3s* data;
|
||||
} CamData; // size = 0x8 (BgCamData)
|
||||
/* 0x0 */ u16 setting; // camera setting described by CameraSettingType enum
|
||||
/* 0x2 */ s16 count; // only used when `bgCamFuncData` is a list of points used for crawlspaces (unused oot legacy)
|
||||
/* 0x4 */ Vec3s* bgCamFuncData; // s16 data grouped in threes (ex. Vec3s), is usually of type `BgCamFuncData`
|
||||
} BgCamInfo; // size = 0x8
|
||||
|
||||
typedef BgCamInfo CamData; // TODO: ZAPD compatibility
|
||||
|
||||
// The structure used for all instances of s16 data from `BgCamInfo`.
|
||||
typedef struct {
|
||||
/* 0x00 */ Vec3s pos;
|
||||
/* 0x06 */ Vec3s rot;
|
||||
/* 0x0C */ s16 fov;
|
||||
/* 0x0E */ s16 unk_0E;
|
||||
/* 0x10 */ s16 unk_10;
|
||||
} BgCamFuncData; // size = 0x12
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ Vec3s minPos;
|
||||
@ -137,7 +148,7 @@ typedef struct {
|
||||
/* 0x14 */ u16 numPolygons;
|
||||
/* 0x18 */ CollisionPoly* polyList;
|
||||
/* 0x1C */ SurfaceType* surfaceTypeList;
|
||||
/* 0x20 */ CamData* cameraDataList;
|
||||
/* 0x20 */ CamData* bgCamList;
|
||||
/* 0x24 */ u16 numWaterBoxes;
|
||||
/* 0x28 */ WaterBox* waterBoxes;
|
||||
} CollisionHeader; // size = 0x2C
|
||||
|
@ -489,19 +489,20 @@ typedef struct {
|
||||
/* 0x08 */ UNK_TYPE2 unk8;
|
||||
} MinimapChest; // size = 0xA
|
||||
|
||||
// TODO: consider merging with bgCamInfo?
|
||||
typedef struct {
|
||||
/* 0x0 */ s16 setting;
|
||||
/* 0x2 */ s16 numData;
|
||||
/* 0x4 */ Vec3s* data;
|
||||
} CsCamData; // size = 0x8
|
||||
/* 0x0 */ s16 setting; // camera setting described by CameraSettingType enum
|
||||
/* 0x2 */ s16 count;
|
||||
/* 0x4 */ Vec3s* actorCsCamFuncData; // s16 data grouped in threes
|
||||
} ActorCsCamInfo; // size = 0x8
|
||||
|
||||
typedef CsCamData CsCameraEntry; // TODO: Remove once ZAPD updates its structs
|
||||
typedef ActorCsCamInfo CsCameraEntry; // TODO: Remove once ZAPD updates its structs
|
||||
|
||||
typedef union {
|
||||
/* Command: N/A */ SCmdBase base;
|
||||
/* Command: 0x00 */ SCmdSpawnList spawnList;
|
||||
/* Command: 0x01 */ SCmdActorList actorList;
|
||||
/* Command: 0x02 */ SCmdCsCameraList csCameraList;
|
||||
/* Command: 0x02 */ SCmdCsCameraList actorCsCamList;
|
||||
/* Command: 0x03 */ SCmdColHeader colHeader;
|
||||
/* Command: 0x04 */ SCmdRoomList roomList;
|
||||
/* Command: 0x05 */ SCmdWindSettings windSettings;
|
||||
|
@ -3962,8 +3962,8 @@ void CollisionHeader_SegmentedToVirtual(CollisionHeader* colHeader) {
|
||||
if (colHeader->surfaceTypeList) {
|
||||
colHeader->surfaceTypeList = Lib_SegmentedToVirtual(colHeader->surfaceTypeList);
|
||||
}
|
||||
if (colHeader->cameraDataList) {
|
||||
colHeader->cameraDataList = Lib_SegmentedToVirtual(colHeader->cameraDataList);
|
||||
if (colHeader->bgCamList) {
|
||||
colHeader->bgCamList = Lib_SegmentedToVirtual(colHeader->bgCamList);
|
||||
}
|
||||
if (colHeader->waterBoxes) {
|
||||
colHeader->waterBoxes = Lib_SegmentedToVirtual(colHeader->waterBoxes);
|
||||
@ -4026,128 +4026,142 @@ u32 SurfaceType_GetData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId,
|
||||
}
|
||||
|
||||
/**
|
||||
* SurfaceType return CamData Index
|
||||
* SurfaceType get index of bgCam
|
||||
*/
|
||||
u32 SurfaceType_GetCamDataIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
||||
u32 SurfaceType_GetBgCamIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
||||
return SurfaceType_GetData(colCtx, poly, bgId, 0) & 0xFF;
|
||||
}
|
||||
|
||||
/**
|
||||
* CamData return camera setting
|
||||
* BgCam get setting of bgCam
|
||||
*/
|
||||
u16 func_800C9728(CollisionContext* colCtx, u32 camId, s32 bgId) {
|
||||
u16 result;
|
||||
u16 BgCheck_GetBgCamSettingImpl(CollisionContext* colCtx, u32 bgCamIndex, s32 bgId) {
|
||||
u16 camSetting;
|
||||
CollisionHeader* colHeader;
|
||||
CamData* camData;
|
||||
BgCamInfo* bgCamList;
|
||||
|
||||
colHeader = BgCheck_GetCollisionHeader(colCtx, bgId);
|
||||
if (colHeader == NULL) {
|
||||
return 0;
|
||||
return CAM_SET_NONE;
|
||||
}
|
||||
camData = colHeader->cameraDataList;
|
||||
result = camData[camId].setting;
|
||||
return result;
|
||||
|
||||
bgCamList = colHeader->bgCamList;
|
||||
camSetting = bgCamList[bgCamIndex].setting;
|
||||
|
||||
return camSetting;
|
||||
}
|
||||
|
||||
/**
|
||||
* SurfaceType return camera setting
|
||||
* BgCam Get the camera setting of bgCam
|
||||
*/
|
||||
u16 SurfaceType_GetCameraSetting(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
||||
u16 BgCheck_GetBgCamSetting(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
||||
CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId);
|
||||
CamData* camData;
|
||||
BgCamInfo* bgCamList;
|
||||
SurfaceType* surfaceTypes;
|
||||
|
||||
if (colHeader == NULL) {
|
||||
return CAM_SET_NONE;
|
||||
}
|
||||
|
||||
bgCamList = colHeader->bgCamList;
|
||||
if (bgCamList == NULL) {
|
||||
return CAM_SET_NONE;
|
||||
}
|
||||
|
||||
surfaceTypes = colHeader->surfaceTypeList;
|
||||
if (surfaceTypes == NULL) {
|
||||
return CAM_SET_NONE;
|
||||
}
|
||||
|
||||
return BgCheck_GetBgCamSettingImpl(colCtx, SurfaceType_GetBgCamIndex(colCtx, poly, bgId), bgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* BgCam Get the total count of Vec3s data from bgCamFuncData
|
||||
*/
|
||||
u16 BgCheck_GetBgCamCountImpl(CollisionContext* colCtx, u32 bgCamIndex, s32 bgId) {
|
||||
CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId);
|
||||
BgCamInfo* bgCamList;
|
||||
|
||||
if (colHeader == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bgCamList = colHeader->bgCamList;
|
||||
if (bgCamList == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return bgCamList[bgCamIndex].count;
|
||||
}
|
||||
|
||||
/**
|
||||
* BgCam Get the total count of Vec3s data from bgCamFuncData
|
||||
*/
|
||||
u16 BgCheck_GetBgCamCount(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
||||
CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId);
|
||||
BgCamInfo* bgCamList;
|
||||
SurfaceType* surfaceTypes;
|
||||
|
||||
if (colHeader == NULL) {
|
||||
return 0;
|
||||
}
|
||||
camData = colHeader->cameraDataList;
|
||||
if (camData == NULL) {
|
||||
|
||||
bgCamList = colHeader->bgCamList;
|
||||
if (bgCamList == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
surfaceTypes = colHeader->surfaceTypeList;
|
||||
if (surfaceTypes == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return func_800C9728(colCtx, SurfaceType_GetCamDataIndex(colCtx, poly, bgId), bgId);
|
||||
|
||||
return BgCheck_GetBgCamCountImpl(colCtx, SurfaceType_GetBgCamIndex(colCtx, poly, bgId), bgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* CamData get number of camera data blocks
|
||||
* BgCam Get Vec3s data from bgCamFuncData
|
||||
*/
|
||||
u16 func_800C97F8(CollisionContext* colCtx, u32 camId, s32 bgId) {
|
||||
Vec3s* BgCheck_GetBgCamFuncDataImpl(CollisionContext* colCtx, s32 bgCamIndex, s32 bgId) {
|
||||
CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId);
|
||||
CamData* camData;
|
||||
|
||||
if (colHeader == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
camData = colHeader->cameraDataList;
|
||||
if (camData == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return camData[camId].numData;
|
||||
}
|
||||
|
||||
/**
|
||||
* SurfaceType get number of camera data blocks
|
||||
*/
|
||||
u16 func_800C9844(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
||||
CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId);
|
||||
CamData* camData;
|
||||
SurfaceType* surfaceTypes;
|
||||
|
||||
if (colHeader == NULL) {
|
||||
return 0;
|
||||
}
|
||||
camData = colHeader->cameraDataList;
|
||||
if (camData == NULL) {
|
||||
return 0;
|
||||
}
|
||||
surfaceTypes = colHeader->surfaceTypeList;
|
||||
if (surfaceTypes == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return func_800C97F8(colCtx, SurfaceType_GetCamDataIndex(colCtx, poly, bgId), bgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* CamData get data
|
||||
*/
|
||||
Vec3s* func_800C98CC(CollisionContext* colCtx, s32 camId, s32 bgId) {
|
||||
CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId);
|
||||
CamData* cameraDataList;
|
||||
BgCamInfo* bgCamList;
|
||||
|
||||
if (colHeader == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
cameraDataList = colHeader->cameraDataList;
|
||||
if (cameraDataList == NULL) {
|
||||
|
||||
bgCamList = colHeader->bgCamList;
|
||||
if (bgCamList == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return Lib_SegmentedToVirtual(cameraDataList[camId].data);
|
||||
|
||||
return Lib_SegmentedToVirtual(bgCamList[bgCamIndex].bgCamFuncData);
|
||||
}
|
||||
|
||||
/**
|
||||
* SurfaceType Get data
|
||||
* BgCam Get Vec3s data from bgCamFuncData
|
||||
*/
|
||||
Vec3s* SurfaceType_GetCamPosData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
||||
Vec3s* BgCheck_GetBgCamFuncData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
||||
CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId);
|
||||
CamData* camData;
|
||||
BgCamInfo* bgCamList;
|
||||
SurfaceType* surfaceTypes;
|
||||
|
||||
if (colHeader == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
camData = colHeader->cameraDataList;
|
||||
if (camData == NULL) {
|
||||
|
||||
bgCamList = colHeader->bgCamList;
|
||||
if (bgCamList == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
surfaceTypes = colHeader->surfaceTypeList;
|
||||
if (surfaceTypes == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return func_800C98CC(colCtx, SurfaceType_GetCamDataIndex(colCtx, poly, bgId), bgId);
|
||||
|
||||
return BgCheck_GetBgCamFuncDataImpl(colCtx, SurfaceType_GetBgCamIndex(colCtx, poly, bgId), bgId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4541,41 +4555,46 @@ f32 func_800CA568(CollisionContext* colCtx, s32 waterBoxId, s32 bgId) {
|
||||
}
|
||||
|
||||
/**
|
||||
* WaterBox get CamData index
|
||||
* WaterBox get BgCam index
|
||||
*/
|
||||
u32 WaterBox_GetCamDataIndex(CollisionContext* colCtx, WaterBox* waterBox) {
|
||||
u32 WaterBox_GetBgCamIndex(CollisionContext* colCtx, WaterBox* waterBox) {
|
||||
u32 prop = waterBox->properties >> 0;
|
||||
|
||||
return prop & 0xFF;
|
||||
}
|
||||
|
||||
/**
|
||||
* WaterBox get CamData camera setting
|
||||
* WaterBox get BgCam setting
|
||||
*/
|
||||
u16 WaterBox_GetCameraSetting(CollisionContext* colCtx, WaterBox* waterBox, s32 bgId) {
|
||||
u16 WaterBox_GetBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox, s32 bgId) {
|
||||
s32 pad[2];
|
||||
u16 result = 0;
|
||||
u16 camSetting = CAM_SET_NONE;
|
||||
CollisionHeader* colHeader;
|
||||
CamData* camData;
|
||||
s32 camId;
|
||||
BgCamInfo* bgCamList;
|
||||
s32 bgCamIndex;
|
||||
|
||||
colHeader = BgCheck_GetCollisionHeader(colCtx, bgId);
|
||||
if (colHeader == NULL) {
|
||||
return result;
|
||||
}
|
||||
camId = WaterBox_GetCamDataIndex(colCtx, waterBox);
|
||||
camData = colHeader->cameraDataList;
|
||||
|
||||
if (camData == NULL) {
|
||||
return result;
|
||||
return camSetting;
|
||||
}
|
||||
|
||||
result = camData[camId].setting;
|
||||
return result;
|
||||
bgCamIndex = WaterBox_GetBgCamIndex(colCtx, waterBox);
|
||||
bgCamList = colHeader->bgCamList;
|
||||
|
||||
if (bgCamList == NULL) {
|
||||
return camSetting;
|
||||
}
|
||||
|
||||
camSetting = bgCamList[bgCamIndex].setting;
|
||||
|
||||
return camSetting;
|
||||
}
|
||||
|
||||
void func_800CA6B8(CollisionContext* colCtx, WaterBox* waterBox) {
|
||||
WaterBox_GetCameraSetting(colCtx, waterBox, BGCHECK_SCENE);
|
||||
/**
|
||||
* WaterBox get scene BgCam setting
|
||||
*/
|
||||
void WaterBox_GetSceneBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox) {
|
||||
WaterBox_GetBgCamSetting(colCtx, waterBox, BGCHECK_SCENE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,22 @@
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB854.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB880.s")
|
||||
s32 Camera_IsSwimming(Camera* camera) {
|
||||
Actor* focalActor = camera->focalActor;
|
||||
|
||||
if (focalActor == &GET_PLAYER(camera->play)->actor) {
|
||||
if (((Player*)focalActor)->stateFlags3 & PLAYER_STATE3_8000) {
|
||||
// Swimming as Zora
|
||||
return 999;
|
||||
} else {
|
||||
// Swimming as Human or Fierce Deity
|
||||
return ((Player*)focalActor)->stateFlags1 & PLAYER_STATE1_8000000;
|
||||
}
|
||||
} else {
|
||||
// Camera not focused on player
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB8C8.s")
|
||||
|
||||
@ -84,13 +99,78 @@
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CC5C8.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CC740.s")
|
||||
#define CAM_DATA_IS_BG (1 << 12) // if not set, then cam data is for actor cutscenes
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CC7A8.s")
|
||||
/**
|
||||
* Returns the CameraSettingType of the camera from either the bgCam or the actorCsCam at index `camDataId`
|
||||
*/
|
||||
s16 Camera_GetBgCamOrActorCsCamSetting(Camera* camera, u32 camDataId) {
|
||||
if (camDataId & CAM_DATA_IS_BG) {
|
||||
return BgCheck_GetBgCamSettingImpl(&camera->play->colCtx, camDataId & ~CAM_DATA_IS_BG, BGCHECK_SCENE);
|
||||
} else {
|
||||
return Play_GetActorCsCamSetting(camera->play, camDataId);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CC804.s")
|
||||
/**
|
||||
* Returns either the bgCam data or the actorCsCam data at index `camDataId`
|
||||
*/
|
||||
Vec3s* Camera_GetBgCamOrActorCsCamFuncData(Camera* camera, u32 camDataId) {
|
||||
if (camDataId & CAM_DATA_IS_BG) {
|
||||
return BgCheck_GetBgCamFuncDataImpl(&camera->play->colCtx, camDataId & ~CAM_DATA_IS_BG, BGCHECK_SCENE);
|
||||
} else {
|
||||
return Play_GetActorCsCamFuncData(camera->play, camDataId);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CC874.s")
|
||||
/**
|
||||
* Gets the bgCam index for the poly `poly`, returns -1 if
|
||||
* there is no camera data for that poly.
|
||||
*/
|
||||
s32 Camera_GetBgCamIndex(Camera* camera, s32* bgId, CollisionPoly* poly) {
|
||||
s32 bgCamIndex = SurfaceType_GetBgCamIndex(&camera->play->colCtx, poly, *bgId);
|
||||
s32 ret;
|
||||
|
||||
if (BgCheck_GetBgCamSettingImpl(&camera->play->colCtx, bgCamIndex, *bgId) == CAM_SET_NONE) {
|
||||
ret = -1;
|
||||
} else {
|
||||
ret = bgCamIndex;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Camera setting for the water box the player is in.
|
||||
* Returns -1 if the player is not in a water box, or does not have a swimming state.
|
||||
* Returns -2 if there is no bgCam index for the water box.
|
||||
* Returns the camera setting otherwise.
|
||||
*/
|
||||
s32 Camera_GetWaterBoxBgCamSetting(Camera* camera, f32* waterY) {
|
||||
PosRot playerPosShape;
|
||||
WaterBox* waterBox;
|
||||
s32 camSetting;
|
||||
s32 bgId;
|
||||
|
||||
Actor_GetWorldPosShapeRot(&playerPosShape, camera->focalActor);
|
||||
*waterY = playerPosShape.pos.y;
|
||||
|
||||
if (!WaterBox_GetSurfaceImpl(camera->play, &camera->play->colCtx, playerPosShape.pos.x, playerPosShape.pos.z,
|
||||
waterY, &waterBox, &bgId)) {
|
||||
// player's position is not in a waterbox
|
||||
*waterY = playerPosShape.pos.y;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!Camera_IsSwimming(camera)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
camSetting = WaterBox_GetBgCamSetting(&camera->play->colCtx, waterBox, bgId);
|
||||
|
||||
// -2: no bgCam index
|
||||
return (camSetting == CAM_SET_NONE) ? -2 : camSetting;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CC938.s")
|
||||
|
||||
|
@ -108,9 +108,17 @@ s32 Play_InCsMode(PlayState* this) {
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169BF8.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetCsCamDataSetting.s")
|
||||
u16 Play_GetActorCsCamSetting(PlayState* this, s32 csCamDataIndex) {
|
||||
ActorCsCamInfo* actorCsCamList = &this->actorCsCamList[csCamDataIndex];
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetCsCamDataVec3s.s")
|
||||
return actorCsCamList->setting;
|
||||
}
|
||||
|
||||
Vec3s* Play_GetActorCsCamFuncData(PlayState* this, s32 csCamDataIndex) {
|
||||
ActorCsCamInfo* actorCsCamList = &this->actorCsCamList[csCamDataIndex];
|
||||
|
||||
return Lib_SegmentedToVirtual(actorCsCamList->actorCsCamFuncData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the number of a scene to its "original" equivalent, the default version of the area which the player first
|
||||
|
@ -173,9 +173,9 @@ void Scene_HeaderCmdActorList(PlayState* play, SceneCmd* cmd) {
|
||||
play->actorCtx.unkC = 0;
|
||||
}
|
||||
|
||||
// SceneTableEntry Header Command 0x02: List of cameras for actor cutscenes
|
||||
// SceneTableEntry Header Command 0x02: List of camera data for actor cutscenes
|
||||
void Scene_HeaderCmdActorCutsceneCamList(PlayState* play, SceneCmd* cmd) {
|
||||
play->csCamData = Lib_SegmentedToVirtual(cmd->csCameraList.segment);
|
||||
play->actorCsCamList = Lib_SegmentedToVirtual(cmd->actorCsCamList.segment);
|
||||
}
|
||||
|
||||
// SceneTableEntry Header Command 0x03: Collision Header
|
||||
@ -192,8 +192,8 @@ void Scene_HeaderCmdColHeader(PlayState* play, SceneCmd* cmd) {
|
||||
colHeader->surfaceTypeList = Lib_SegmentedToVirtual(colHeader->surfaceTypeList);
|
||||
}
|
||||
|
||||
if (colHeader->cameraDataList != NULL) {
|
||||
colHeader->cameraDataList = Lib_SegmentedToVirtual(colHeader->cameraDataList);
|
||||
if (colHeader->bgCamList != NULL) {
|
||||
colHeader->bgCamList = Lib_SegmentedToVirtual(colHeader->bgCamList);
|
||||
}
|
||||
|
||||
if (colHeader->waterBoxes != NULL) {
|
||||
|
@ -4,6 +4,7 @@
|
||||
* Description: Great Bay Temple - See-Saw
|
||||
*/
|
||||
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "z_bg_dblue_balance.h"
|
||||
#include "objects/object_dblue_object/object_dblue_object.h"
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "z_obj_nozoki.h"
|
||||
#include "objects/object_secom_obj/object_secom_obj.h"
|
||||
#include "prevent_bss_reordering.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10)
|
||||
|
||||
|
@ -1047,13 +1047,13 @@
|
||||
0x800C9598:("BgCheck_InitCollisionHeaders",),
|
||||
0x800C9640:("BgCheck_ResetPolyCheckTbl",),
|
||||
0x800C9694:("SurfaceType_GetData",),
|
||||
0x800C9704:("SurfaceType_GetCamDataIndex",),
|
||||
0x800C9728:("func_800C9728",),
|
||||
0x800C9770:("SurfaceType_GetCameraSetting",),
|
||||
0x800C97F8:("func_800C97F8",),
|
||||
0x800C9844:("func_800C9844",),
|
||||
0x800C98CC:("func_800C98CC",),
|
||||
0x800C9924:("SurfaceType_GetCamPosData",),
|
||||
0x800C9704:("SurfaceType_GetBgCamIndex",),
|
||||
0x800C9728:("BgCheck_GetBgCamSettingImpl",),
|
||||
0x800C9770:("BgCheck_GetBgCamSetting",),
|
||||
0x800C97F8:("BgCheck_GetBgCamCountImpl",),
|
||||
0x800C9844:("BgCheck_GetBgCamCount",),
|
||||
0x800C98CC:("BgCheck_GetBgCamFuncDataImpl",),
|
||||
0x800C9924:("BgCheck_GetBgCamFuncData",),
|
||||
0x800C99AC:("SurfaceType_GetSceneExitIndex",),
|
||||
0x800C99D4:("func_800C99D4",),
|
||||
0x800C99FC:("func_800C99FC",),
|
||||
@ -1085,9 +1085,9 @@
|
||||
0x800CA1E8:("WaterBox_GetSurface1_2",),
|
||||
0x800CA22C:("WaterBox_GetSurface2",),
|
||||
0x800CA568:("func_800CA568",),
|
||||
0x800CA634:("WaterBox_GetCamDataIndex",),
|
||||
0x800CA648:("WaterBox_GetCameraSetting",),
|
||||
0x800CA6B8:("func_800CA6B8",),
|
||||
0x800CA634:("WaterBox_GetBgCamIndex",),
|
||||
0x800CA648:("WaterBox_GetBgCamSetting",),
|
||||
0x800CA6B8:("WaterBox_GetSceneBgCamSetting",),
|
||||
0x800CA6D8:("WaterBox_GetLightSettingIndex",),
|
||||
0x800CA6F0:("func_800CA6F0",),
|
||||
0x800CA9D0:("func_800CA9D0",),
|
||||
@ -1131,7 +1131,7 @@
|
||||
0x800CB7F8:("func_800CB7F8",),
|
||||
0x800CB828:("func_800CB828",),
|
||||
0x800CB854:("func_800CB854",),
|
||||
0x800CB880:("func_800CB880",),
|
||||
0x800CB880:("Camera_IsSwimming",),
|
||||
0x800CB8C8:("func_800CB8C8",),
|
||||
0x800CB8F4:("func_800CB8F4",),
|
||||
0x800CB924:("func_800CB924",),
|
||||
@ -1154,10 +1154,10 @@
|
||||
0x800CC488:("func_800CC488",),
|
||||
0x800CC56C:("func_800CC56C",),
|
||||
0x800CC5C8:("func_800CC5C8",),
|
||||
0x800CC740:("func_800CC740",),
|
||||
0x800CC7A8:("func_800CC7A8",),
|
||||
0x800CC804:("func_800CC804",),
|
||||
0x800CC874:("func_800CC874",),
|
||||
0x800CC740:("Camera_GetBgCamOrActorCsCamSetting",),
|
||||
0x800CC7A8:("Camera_GetBgCamOrActorCsCamFuncData",),
|
||||
0x800CC804:("Camera_GetBgCamIndex",),
|
||||
0x800CC874:("Camera_GetWaterBoxBgCamSetting",),
|
||||
0x800CC938:("func_800CC938",),
|
||||
0x800CC958:("func_800CC958",),
|
||||
0x800CC9C0:("func_800CC9C0",),
|
||||
@ -3022,8 +3022,8 @@
|
||||
0x80169AFC:("func_80169AFC",),
|
||||
0x80169BC4:("Play_CameraGetUID",),
|
||||
0x80169BF8:("func_80169BF8",),
|
||||
0x80169C64:("Play_GetCsCamDataSetting",),
|
||||
0x80169C84:("Play_GetCsCamDataVec3s",),
|
||||
0x80169C64:("Play_GetActorCsCamSetting",),
|
||||
0x80169C84:("Play_GetActorCsCamFuncData",),
|
||||
0x80169CBC:("Play_GetOriginalSceneNumber",),
|
||||
0x80169D40:("Play_SaveCycleSceneFlags",),
|
||||
0x80169DCC:("Play_SetRespawnData",),
|
||||
|
@ -393,8 +393,8 @@ wordReplace = {
|
||||
"BgCheck_RelocateMeshHeader": "CollisionHeader_GetVirtual",
|
||||
"BgCheck_RelocateAllMeshHeaders": "BgCheck_InitCollisionHeaders",
|
||||
"BgCheck_GetPolygonAttributes": "SurfaceType_GetData",
|
||||
"func_800C9704": "SurfaceType_GetCamDataIndex",
|
||||
"func_800C9924": "SurfaceType_GetCamPosData",
|
||||
"func_800C9704": "SurfaceType_GetBgCamIndex",
|
||||
"func_800C9924": "BgCheck_GetBgCamFuncData",
|
||||
"func_800C99AC": "SurfaceType_GetSceneExitIndex",
|
||||
"func_800C9B90": "SurfaceType_IsHorseBlocked",
|
||||
"func_800C9BDC": "SurfaceType_GetSfx",
|
||||
@ -460,8 +460,8 @@ wordReplace = {
|
||||
"func_801699D4": "Play_CopyCamera",
|
||||
"func_80169AC0": "Play_CameraChangeSetting",
|
||||
"func_80169BC4": "Play_CameraGetUID",
|
||||
"func_80169C64": "Play_GetCsCamDataSetting",
|
||||
"func_80169C84": "Play_GetCsCamDataVec3s",
|
||||
"func_80169C64": "Play_GetActorCsCamSetting",
|
||||
"func_80169C84": "Play_GetActorCsCamFuncData",
|
||||
"convert_scene_number_among_shared_scenes": "Play_GetOriginalSceneNumber",
|
||||
"func_80169D40": "Play_SaveCycleSceneFlags",
|
||||
"func_80169DCC": "Play_SetRespawnData",
|
||||
|
@ -561,13 +561,13 @@ asm/non_matchings/code/z_bgcheck/CollisionHeader_GetVirtual.s,CollisionHeader_Ge
|
||||
asm/non_matchings/code/z_bgcheck/BgCheck_InitCollisionHeaders.s,BgCheck_InitCollisionHeaders,0x800C9598,0x2A
|
||||
asm/non_matchings/code/z_bgcheck/func_800C9640.s,func_800C9640,0x800C9640,0x15
|
||||
asm/non_matchings/code/z_bgcheck/SurfaceType_GetData.s,SurfaceType_GetData,0x800C9694,0x1C
|
||||
asm/non_matchings/code/z_bgcheck/SurfaceType_GetCamDataIndex.s,SurfaceType_GetCamDataIndex,0x800C9704,0x9
|
||||
asm/non_matchings/code/z_bgcheck/func_800C9728.s,func_800C9728,0x800C9728,0x12
|
||||
asm/non_matchings/code/z_bgcheck/SurfaceType_GetBgCamIndex.s,SurfaceType_GetBgCamIndex,0x800C9704,0x9
|
||||
asm/non_matchings/code/z_bgcheck/BgCheck_GetBgCamSettingImpl.s,BgCheck_GetBgCamSettingImpl,0x800C9728,0x12
|
||||
asm/non_matchings/code/z_bgcheck/func_800C9770.s,func_800C9770,0x800C9770,0x22
|
||||
asm/non_matchings/code/z_bgcheck/func_800C97F8.s,func_800C97F8,0x800C97F8,0x13
|
||||
asm/non_matchings/code/z_bgcheck/func_800C9844.s,func_800C9844,0x800C9844,0x22
|
||||
asm/non_matchings/code/z_bgcheck/func_800C98CC.s,func_800C98CC,0x800C98CC,0x16
|
||||
asm/non_matchings/code/z_bgcheck/SurfaceType_GetCamPosData.s,SurfaceType_GetCamPosData,0x800C9924,0x22
|
||||
asm/non_matchings/code/z_bgcheck/BgCheck_GetBgCamCountImpl.s,BgCheck_GetBgCamCountImpl,0x800C97F8,0x13
|
||||
asm/non_matchings/code/z_bgcheck/BgCheck_GetBgCamCount.s,BgCheck_GetBgCamCount,0x800C9844,0x22
|
||||
asm/non_matchings/code/z_bgcheck/BgCheck_GetBgCamFuncDataImpl.s,BgCheck_GetBgCamFuncDataImpl,0x800C98CC,0x16
|
||||
asm/non_matchings/code/z_bgcheck/BgCheck_GetBgCamFuncData.s,BgCheck_GetBgCamFuncData,0x800C9924,0x22
|
||||
asm/non_matchings/code/z_bgcheck/SurfaceType_GetSceneExitIndex.s,SurfaceType_GetSceneExitIndex,0x800C99AC,0xA
|
||||
asm/non_matchings/code/z_bgcheck/func_800C99D4.s,func_800C99D4,0x800C99D4,0xA
|
||||
asm/non_matchings/code/z_bgcheck/func_800C99FC.s,func_800C99FC,0x800C99FC,0xA
|
||||
@ -601,7 +601,7 @@ asm/non_matchings/code/z_bgcheck/WaterBox_GetSurface2.s,WaterBox_GetSurface2,0x8
|
||||
asm/non_matchings/code/z_bgcheck/func_800CA568.s,func_800CA568,0x800CA568,0x33
|
||||
asm/non_matchings/code/z_bgcheck/func_800CA634.s,func_800CA634,0x800CA634,0x5
|
||||
asm/non_matchings/code/z_bgcheck/func_800CA648.s,func_800CA648,0x800CA648,0x1C
|
||||
asm/non_matchings/code/z_bgcheck/func_800CA6B8.s,func_800CA6B8,0x800CA6B8,0x8
|
||||
asm/non_matchings/code/z_bgcheck/WaterBox_GetSceneBgCamSetting.s,WaterBox_GetSceneBgCamSetting,0x800CA6B8,0x8
|
||||
asm/non_matchings/code/z_bgcheck/WaterBox_GetLightSettingIndex.s,WaterBox_GetLightSettingIndex,0x800CA6D8,0x6
|
||||
asm/non_matchings/code/z_bgcheck/func_800CA6F0.s,func_800CA6F0,0x800CA6F0,0xB8
|
||||
asm/non_matchings/code/z_bgcheck/func_800CA9D0.s,func_800CA9D0,0x800CA9D0,0x11
|
||||
@ -645,7 +645,7 @@ asm/non_matchings/code/z_camera/func_800CB7CC.s,func_800CB7CC,0x800CB7CC,0xB
|
||||
asm/non_matchings/code/z_camera/func_800CB7F8.s,func_800CB7F8,0x800CB7F8,0xC
|
||||
asm/non_matchings/code/z_camera/func_800CB828.s,func_800CB828,0x800CB828,0xB
|
||||
asm/non_matchings/code/z_camera/func_800CB854.s,func_800CB854,0x800CB854,0xB
|
||||
asm/non_matchings/code/z_camera/func_800CB880.s,func_800CB880,0x800CB880,0x12
|
||||
asm/non_matchings/code/z_camera/Camera_IsSwimming.s,Camera_IsSwimming,0x800CB880,0x12
|
||||
asm/non_matchings/code/z_camera/func_800CB8C8.s,func_800CB8C8,0x800CB8C8,0xB
|
||||
asm/non_matchings/code/z_camera/func_800CB8F4.s,func_800CB8F4,0x800CB8F4,0xC
|
||||
asm/non_matchings/code/z_camera/func_800CB924.s,func_800CB924,0x800CB924,0xB
|
||||
@ -668,10 +668,10 @@ asm/non_matchings/code/z_camera/func_800CC260.s,func_800CC260,0x800CC260,0x8A
|
||||
asm/non_matchings/code/z_camera/func_800CC488.s,func_800CC488,0x800CC488,0x39
|
||||
asm/non_matchings/code/z_camera/func_800CC56C.s,func_800CC56C,0x800CC56C,0x17
|
||||
asm/non_matchings/code/z_camera/func_800CC5C8.s,func_800CC5C8,0x800CC5C8,0x5E
|
||||
asm/non_matchings/code/z_camera/func_800CC740.s,func_800CC740,0x800CC740,0x1A
|
||||
asm/non_matchings/code/z_camera/func_800CC7A8.s,func_800CC7A8,0x800CC7A8,0x17
|
||||
asm/non_matchings/code/z_camera/func_800CC804.s,func_800CC804,0x800CC804,0x1C
|
||||
asm/non_matchings/code/z_camera/func_800CC874.s,func_800CC874,0x800CC874,0x31
|
||||
asm/non_matchings/code/z_camera/Camera_GetBgCamOrActorCsCamSetting.s,Camera_GetBgCamOrActorCsCamSetting,0x800CC740,0x1A
|
||||
asm/non_matchings/code/z_camera/Camera_GetBgCamOrActorCsCamFuncData.s,Camera_GetBgCamOrActorCsCamFuncData,0x800CC7A8,0x17
|
||||
asm/non_matchings/code/z_camera/Camera_GetBgCamIndex.s,Camera_GetBgCamIndex,0x800CC804,0x1C
|
||||
asm/non_matchings/code/z_camera/Camera_GetWaterBoxBgCamSetting.s,Camera_GetWaterBoxBgCamSetting,0x800CC874,0x31
|
||||
asm/non_matchings/code/z_camera/func_800CC938.s,func_800CC938,0x800CC938,0x8
|
||||
asm/non_matchings/code/z_camera/func_800CC958.s,func_800CC958,0x800CC958,0x1A
|
||||
asm/non_matchings/code/z_camera/func_800CC9C0.s,func_800CC9C0,0x800CC9C0,0xCB
|
||||
@ -2536,8 +2536,8 @@ asm/non_matchings/code/z_play/Play_CameraChangeSetting.s,Play_CameraChangeSettin
|
||||
asm/non_matchings/code/z_play/func_80169AFC.s,func_80169AFC,0x80169AFC,0x32
|
||||
asm/non_matchings/code/z_play/Play_CameraGetUID.s,Play_CameraGetUID,0x80169BC4,0xD
|
||||
asm/non_matchings/code/z_play/func_80169BF8.s,func_80169BF8,0x80169BF8,0x1B
|
||||
asm/non_matchings/code/z_play/Play_GetCsCamDataSetting.s,Play_GetCsCamDataSetting,0x80169C64,0x8
|
||||
asm/non_matchings/code/z_play/Play_GetCsCamDataVec3s.s,Play_GetCsCamDataVec3s,0x80169C84,0xE
|
||||
asm/non_matchings/code/z_play/Play_GetActorCsCamSetting.s,Play_GetActorCsCamSetting,0x80169C64,0x8
|
||||
asm/non_matchings/code/z_play/Play_GetActorCsCamFuncData.s,Play_GetActorCsCamFuncData,0x80169C84,0xE
|
||||
asm/non_matchings/code/z_play/Play_GetOriginalSceneNumber.s,Play_GetOriginalSceneNumber,0x80169CBC,0x21
|
||||
asm/non_matchings/code/z_play/Play_SaveCycleSceneFlags.s,Play_SaveCycleSceneFlags,0x80169D40,0x23
|
||||
asm/non_matchings/code/z_play/Play_SetRespawnData.s,Play_SetRespawnData,0x80169DCC,0x28
|
||||
|
|
Loading…
Reference in New Issue
Block a user