mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 06:13:45 -07:00
Camera data
This commit is contained in:
parent
75ccabe198
commit
70be62d566
5 changed files with 1400 additions and 3781 deletions
|
@ -95,7 +95,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<PreprocessorDefinitions>NOINCLUDE_GAME_PRINTF;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -27,6 +27,38 @@ typedef struct {
|
|||
/* 0x008 */ LightNode buf[LIGHTS_BUFFER_SIZE];
|
||||
} LightsBuffer; // size = 0x188
|
||||
|
||||
|
||||
extern "C" MtxF* sMatrixStack;
|
||||
extern "C" MtxF* sCurrentMatrix;
|
||||
extern "C" LightsBuffer sLightsBuffer;
|
||||
extern "C" s16 sWarpTimerTarget;
|
||||
extern "C" MapMarkData** sLoadedMarkDataTable;
|
||||
extern "C" int32_t sInitRegs; // Camera
|
||||
extern "C" int32_t gDbgCamEnabled; //Camera
|
||||
extern "C" int32_t sDbgModeIdx; //Camera
|
||||
extern "C" int16_t sNextUID; // Camera
|
||||
extern "C" int32_t sCameraInterfaceFlags; //Camera
|
||||
extern "C" int32_t sCameraInterfaceAlpha;
|
||||
extern "C" int32_t sCameraShrinkWindowVal;
|
||||
extern "C" int32_t D_8011D3AC;
|
||||
extern "C" int32_t sDemo5PrevAction12Frame;
|
||||
extern "C" int32_t sDemo5PrevSfxFrame;
|
||||
extern "C" int32_t D_8011D3F0;
|
||||
extern "C" OnePointCsFull D_8011D6AC[];
|
||||
extern "C" OnePointCsFull D_8011D724[];
|
||||
extern "C" OnePointCsFull D_8011D79C[];
|
||||
extern "C" OnePointCsFull D_8011D83C[];
|
||||
extern "C" OnePointCsFull D_8011D88C[];
|
||||
extern "C" OnePointCsFull D_8011D8DC[];
|
||||
extern "C" OnePointCsFull D_8011D954[];
|
||||
extern "C" OnePointCsFull D_8011D9F4[];
|
||||
extern "C" int16_t D_8011DB08;
|
||||
extern "C" int16_t D_8011DB0C;
|
||||
extern "C" int32_t sOOBTimer;
|
||||
extern "C" f32 D_8015CE50;
|
||||
extern "C" f32 D_8015CE54;
|
||||
extern "C" CamColChk D_8015CE58;
|
||||
|
||||
typedef struct SaveStateInfo {
|
||||
SaveStateHeader stateHeader;
|
||||
|
||||
|
@ -37,24 +69,58 @@ typedef struct SaveStateInfo {
|
|||
GameInfo gameInfoCopy;
|
||||
LightsBuffer lightBufferCopy;
|
||||
AudioContext audioContextCopy;
|
||||
std::array<MtxF, 20> mtxStackCopy; // always 20 matricies
|
||||
MtxF mtxStackCopy[20]; // always 20 matricies
|
||||
MtxF currentMtxCopy;
|
||||
uint32_t rngSeed;
|
||||
int16_t blueWarpTimerCopy; /* From door_warp_1 */
|
||||
|
||||
std::array<SeqScriptState, 4> seqScriptStateCopy; // Unrelocated
|
||||
// std::array<u8, 4> seqIdCopy;
|
||||
std::array<unk_D_8016E750, 4> unk_D_8016E750Copy;
|
||||
SeqScriptState seqScriptStateCopy[4];// Unrelocated
|
||||
unk_D_8016E750 unk_D_8016E750Copy[4];
|
||||
|
||||
ActiveSound gActiveSoundsCopy[7][MAX_CHANNELS_PER_BANK];
|
||||
std::array<u8, 7> gSoundBankMutedCopy;
|
||||
uint8_t gSoundBankMutedCopy[7];
|
||||
|
||||
u8 D_801333F0_copy;
|
||||
u8 gAudioSfxSwapOff_copy;
|
||||
std::array<u16, 10> gAudioSfxSwapSource_copy;
|
||||
std::array<u16, 10> gAudioSfxSwapTarget_copy;
|
||||
std::array<u8, 10> gAudioSfxSwapMode_copy;
|
||||
uint16_t gAudioSfxSwapSource_copy[10];
|
||||
uint16_t gAudioSfxSwapTarget_copy[10];
|
||||
uint8_t gAudioSfxSwapMode_copy[10];
|
||||
void (*D_801755D0_copy)(void);
|
||||
MapMarkData** sLoadedMarkDataTableCopy;
|
||||
|
||||
//Static Data
|
||||
|
||||
//Camera data
|
||||
int32_t sInitRegs_copy;
|
||||
int32_t gDbgCamEnabled_copy;
|
||||
int32_t sDbgModeIdx_copy;
|
||||
int16_t sNextUID_copy;
|
||||
int32_t sCameraInterfaceFlags_copy;
|
||||
int32_t sCameraInterfaceAlpha_copy;
|
||||
int32_t sCameraShrinkWindowVal_copy;
|
||||
int32_t D_8011D3AC_copy;
|
||||
int32_t sDemo5PrevAction12Frame_copy;
|
||||
int32_t sDemo5PrevSfxFrame_copy;
|
||||
int32_t D_8011D3F0_copy;
|
||||
OnePointCsFull D_8011D6AC_copy[3];
|
||||
OnePointCsFull D_8011D724_copy[3];
|
||||
OnePointCsFull D_8011D79C_copy[3];
|
||||
OnePointCsFull D_8011D83C_copy[2];
|
||||
OnePointCsFull D_8011D88C_copy[2];
|
||||
OnePointCsFull D_8011D8DC_copy[3];
|
||||
OnePointCsFull D_8011D954_copy[4];
|
||||
OnePointCsFull D_8011D9F4_copy[3];
|
||||
int16_t D_8011DB08_copy;
|
||||
int16_t D_8011DB0C_copy;
|
||||
int32_t sOOBTimer_copy;
|
||||
f32 D_8015CE50_copy;
|
||||
f32 D_8015CE54_copy;
|
||||
CamColChk D_8015CE58_copy;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} SaveStateInfo;
|
||||
|
||||
class SaveState {
|
||||
|
@ -72,6 +138,8 @@ class SaveState {
|
|||
void Load(void);
|
||||
void BackupSeqScriptState(void);
|
||||
void LoadSeqScriptState(void);
|
||||
void BackupCameraData(void);
|
||||
void LoadCameraData(void);
|
||||
|
||||
SaveStateInfo* GetSaveStateInfo(void);
|
||||
};
|
||||
|
@ -136,11 +204,94 @@ void SaveState::LoadSeqScriptState(void) {
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" MtxF* sMatrixStack;
|
||||
extern "C" MtxF* sCurrentMatrix;
|
||||
extern "C" LightsBuffer sLightsBuffer;
|
||||
extern "C" s16 sWarpTimerTarget;
|
||||
extern "C" MapMarkData** sLoadedMarkDataTable;
|
||||
void SaveState::BackupCameraData(void) {
|
||||
info->sInitRegs_copy = sInitRegs;
|
||||
info->gDbgCamEnabled_copy = gDbgCamEnabled;
|
||||
info->sNextUID_copy = sNextUID;
|
||||
info->sCameraInterfaceFlags_copy = sCameraInterfaceFlags;
|
||||
info->sCameraInterfaceAlpha_copy = sCameraInterfaceAlpha;
|
||||
info->sCameraShrinkWindowVal_copy = sCameraShrinkWindowVal;
|
||||
info->D_8011D3AC_copy = D_8011D3AC;
|
||||
info->sDemo5PrevAction12Frame_copy = sDemo5PrevAction12Frame;
|
||||
info->sDemo5PrevSfxFrame_copy = sDemo5PrevSfxFrame;
|
||||
info->D_8011D3F0_copy = D_8011D3F0;
|
||||
memcpy(info->D_8011D6AC_copy, D_8011D6AC, sizeof(info->D_8011D6AC_copy));
|
||||
memcpy(info->D_8011D724_copy, D_8011D724, sizeof(info->D_8011D724_copy));
|
||||
memcpy(info->D_8011D79C_copy, D_8011D79C, sizeof(info->D_8011D79C_copy));
|
||||
memcpy(info->D_8011D83C_copy, D_8011D83C, sizeof(info->D_8011D83C_copy));
|
||||
memcpy(info->D_8011D88C_copy, D_8011D88C, sizeof(info->D_8011D88C_copy));
|
||||
memcpy(info->D_8011D8DC_copy, D_8011D8DC, sizeof(info->D_8011D8DC_copy));
|
||||
memcpy(info->D_8011D954_copy, D_8011D954, sizeof(info->D_8011D954_copy));
|
||||
memcpy(info->D_8011D9F4_copy, D_8011D9F4, sizeof(info->D_8011D9F4_copy));
|
||||
info->D_8011DB08_copy = D_8011DB08;
|
||||
info->D_8011DB0C_copy = D_8011DB0C;
|
||||
info->sOOBTimer_copy = sOOBTimer;
|
||||
info->D_8015CE50_copy = D_8015CE50;
|
||||
info->D_8015CE54_copy = D_8015CE54;
|
||||
memcpy(&info->D_8015CE58_copy, &D_8015CE58, sizeof(info->D_8015CE58_copy));
|
||||
}
|
||||
|
||||
/* int32_t sInitRegs_copy;
|
||||
int32_t gDbgCamEnabled_copy;
|
||||
int32_t sDbgModeIdx_copy;
|
||||
int16_t sNextUID_copy;
|
||||
int32_t sCameraInterfaceFlags_copy;
|
||||
int32_t sCameraInterfaceAlpha_copy;
|
||||
int32_t sCameraShrinkWindowVal_copy;
|
||||
int32_t D_8011D3AC_copy;
|
||||
int32_t sDemo5PrevAction12Frame_copy;
|
||||
int32_t sDemo5PrevSfxFrame_copy;
|
||||
int32_t D_8011D3F0_copy;
|
||||
OnePointCsFull D_8011D6AC_copy[3];
|
||||
OnePointCsFull D_8011D724_copy[3];
|
||||
OnePointCsFull D_8011D79C_copy[3];
|
||||
OnePointCsFull D_8011D83C_copy[2];
|
||||
OnePointCsFull D_8011D88C_copy[2];
|
||||
OnePointCsFull D_8011D8DC_copy[3];
|
||||
OnePointCsFull D_8011D954_copy[4];
|
||||
OnePointCsFull D_8011D9F4_copy[3];
|
||||
int16_t D_8011DB08_copy;
|
||||
int16_t D_8011DB0C_copy;
|
||||
int32_t sOOBTimer_copy;
|
||||
f32 D_8015CE50_copy;
|
||||
f32 D_8015CE54_copy;
|
||||
CamColChk D_8015CE58_copy;
|
||||
*/
|
||||
|
||||
|
||||
void SaveState::LoadCameraData(void) {
|
||||
sInitRegs = info->sInitRegs_copy;
|
||||
gDbgCamEnabled = info->gDbgCamEnabled_copy;
|
||||
sDbgModeIdx = info->sDbgModeIdx_copy;
|
||||
sNextUID = info->sNextUID_copy;
|
||||
sCameraInterfaceAlpha = info->sCameraInterfaceAlpha_copy;
|
||||
sCameraInterfaceFlags = info->sCameraInterfaceFlags_copy;
|
||||
sCameraShrinkWindowVal = info->sCameraShrinkWindowVal_copy;
|
||||
D_8011D3AC = info->D_8011D3AC_copy;
|
||||
sDemo5PrevAction12Frame = info->sDemo5PrevAction12Frame_copy;
|
||||
sDemo5PrevSfxFrame = info->sDemo5PrevSfxFrame_copy;
|
||||
D_8011D3F0 = info->D_8011D3F0_copy;
|
||||
memcpy(D_8011D6AC, info->D_8011D6AC_copy, sizeof(info->D_8011D6AC_copy));
|
||||
memcpy(D_8011D724, info->D_8011D724_copy, sizeof(info->D_8011D724_copy));
|
||||
memcpy(D_8011D79C, info->D_8011D79C_copy, sizeof(info->D_8011D79C_copy));
|
||||
memcpy(D_8011D83C, info->D_8011D83C_copy, sizeof(info->D_8011D83C_copy));
|
||||
memcpy(D_8011D88C, info->D_8011D88C_copy, sizeof(info->D_8011D88C_copy));
|
||||
memcpy(D_8011D8DC, info->D_8011D8DC_copy, sizeof(info->D_8011D8DC_copy));
|
||||
memcpy(D_8011D954, info->D_8011D954_copy, sizeof(info->D_8011D954_copy));
|
||||
memcpy(D_8011D9F4, info->D_8011D9F4_copy, sizeof(info->D_8011D9F4_copy));
|
||||
D_8011DB08 = info->D_8011DB08_copy;
|
||||
D_8011DB0C = info->D_8011DB0C_copy;
|
||||
sOOBTimer = info->sOOBTimer_copy;
|
||||
D_8015CE50 = info->D_8015CE50_copy;
|
||||
D_8015CE54 = info->D_8015CE54_copy;
|
||||
memcpy(&D_8015CE58, &info->D_8015CE58_copy, sizeof(info->D_8015CE58_copy));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
extern "C" void ProcessSaveStateRequests(void) {
|
||||
OTRGlobals::Instance->gSaveStateMgr->ProcessSaveStateRequests();
|
||||
|
@ -238,6 +389,7 @@ void SaveState::Save(void) {
|
|||
//Various static data
|
||||
info->blueWarpTimerCopy = sWarpTimerTarget;
|
||||
info->sLoadedMarkDataTableCopy = sLoadedMarkDataTable;
|
||||
BackupCameraData();
|
||||
|
||||
}
|
||||
|
||||
|
@ -273,4 +425,6 @@ void SaveState::Load(void) {
|
|||
//Various static data
|
||||
D_801755D0 = info->D_801755D0_copy;
|
||||
sLoadedMarkDataTable = info->sLoadedMarkDataTableCopy;
|
||||
LoadCameraData();
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define SAVE_STATES_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <array>
|
||||
#include <queue>
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
|
|
|
@ -565,10 +565,10 @@ s16 Camera_XZAngle(Vec3f* to, Vec3f* from) {
|
|||
return DEGF_TO_BINANG(RADF_TO_DEGF(Math_FAtan2F(from->x - to->x, from->z - to->z)));
|
||||
}
|
||||
|
||||
f32 D_8015CE50;
|
||||
f32 D_8015CE54;
|
||||
CamColChk D_8015CE58;
|
||||
s16 func_80044ADC(Camera* camera, s16 yaw, s16 arg2) {
|
||||
static f32 D_8015CE50;
|
||||
static f32 D_8015CE54;
|
||||
static CamColChk D_8015CE58;
|
||||
Vec3f playerPos;
|
||||
Vec3f rotatedPos;
|
||||
Vec3f floorNorm;
|
||||
|
@ -7221,9 +7221,9 @@ s32 Camera_DbgChangeMode(Camera* camera) {
|
|||
return true;
|
||||
}
|
||||
|
||||
s16 D_8011DB08 = 0x3F0;
|
||||
s16 D_8011DB0C = 0x156;
|
||||
void func_80058E8C(Camera* camera) {
|
||||
static s16 D_8011DB08 = 0x3F0;
|
||||
static s16 D_8011DB0C = 0x156;
|
||||
s32 pad3;
|
||||
f32 sp60;
|
||||
s32 pad;
|
||||
|
@ -7299,8 +7299,8 @@ void func_80058E8C(Camera* camera) {
|
|||
}
|
||||
}
|
||||
|
||||
s32 sOOBTimer = 0;
|
||||
Vec3s Camera_Update(Camera* camera) {
|
||||
static s32 sOOBTimer = 0;
|
||||
Vec3f viewAt;
|
||||
Vec3f viewEye;
|
||||
Vec3f viewUp;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue