mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-05-17 09:11:21 +00:00
Code cleanup and corrections
This commit is contained in:
parent
28ca7c388c
commit
353dbadfe9
@ -501,7 +501,8 @@ void ProjectResourceFactoryBase::AsyncTask::CookComplete()
|
|||||||
/* Ready for buffer transaction at this point */
|
/* Ready for buffer transaction at this point */
|
||||||
u32 availSz = std::max(0, s32(fr.length()) - s32(x14_resOffset));
|
u32 availSz = std::max(0, s32(fr.length()) - s32(x14_resOffset));
|
||||||
x14_resSize = std::min(x14_resSize, availSz);
|
x14_resSize = std::min(x14_resSize, availSz);
|
||||||
x10_loadBuffer.reset(new u8[x14_resSize]);
|
u8* derp = new u8[x14_resSize];
|
||||||
|
x10_loadBuffer.reset(std::move(derp));
|
||||||
m_bufTransaction = m_parent.m_clientProc.addBufferTransaction(m_cookedPath,
|
m_bufTransaction = m_parent.m_clientProc.addBufferTransaction(m_cookedPath,
|
||||||
x10_loadBuffer.get(),
|
x10_loadBuffer.get(),
|
||||||
x14_resSize, x14_resOffset);
|
x14_resSize, x14_resOffset);
|
||||||
|
@ -19,7 +19,7 @@ CMapWorldInfo::CMapWorldInfo(CBitStreamReader& reader, const CSaveWorld& saveWor
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMapWorldInfo::PutTo(CBitStreamWriter& writer, const CSaveWorld& savw) const
|
void CMapWorldInfo::PutTo(CBitStreamWriter& writer, const CSaveWorld& savw, ResId mlvlId) const
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ class CMapWorldInfo
|
|||||||
public:
|
public:
|
||||||
CMapWorldInfo()=default;
|
CMapWorldInfo()=default;
|
||||||
CMapWorldInfo(CBitStreamReader&, const CSaveWorld& saveWorld, ResId mlvlId);
|
CMapWorldInfo(CBitStreamReader&, const CSaveWorld& saveWorld, ResId mlvlId);
|
||||||
void PutTo(CBitStreamWriter& writer, const CSaveWorld& savw) const;
|
void PutTo(CBitStreamWriter& writer, const CSaveWorld& savw, ResId mlvlId) const;
|
||||||
bool IsMapped() const;
|
bool IsMapped() const;
|
||||||
void SetIsMapped(bool) const;
|
void SetIsMapped(bool) const;
|
||||||
void SetDoorVisited(TEditorId eid, bool val);
|
void SetDoorVisited(TEditorId eid, bool val);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "CSimplePool.hpp"
|
#include "CSimplePool.hpp"
|
||||||
#include "CSaveWorld.hpp"
|
#include "CSaveWorld.hpp"
|
||||||
#include "CGameHintInfo.hpp"
|
#include "CGameHintInfo.hpp"
|
||||||
|
//#include "Audio/CStreamedAudioManager.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
@ -118,19 +119,39 @@ CGameOptions::CGameOptions(CBitStreamReader& stream)
|
|||||||
x44_soundMode = ESoundMode(stream.ReadEncoded(2));
|
x44_soundMode = ESoundMode(stream.ReadEncoded(2));
|
||||||
x48_ = stream.ReadEncoded(4);
|
x48_ = stream.ReadEncoded(4);
|
||||||
|
|
||||||
x4c_ = stream.ReadEncoded(6);
|
x4c_screenXOffset = stream.ReadEncoded(6);
|
||||||
x50_ = stream.ReadEncoded(6);
|
x50_screenYOffset = stream.ReadEncoded(6);
|
||||||
x54_ = stream.ReadEncoded(5);
|
x54_screenStretch = stream.ReadEncoded(5);
|
||||||
x58_ = stream.ReadEncoded(7);
|
x58_sfxVol = stream.ReadEncoded(7);
|
||||||
x5c_musicVol = stream.ReadEncoded(7);
|
x5c_musicVol = stream.ReadEncoded(7);
|
||||||
x60_ = stream.ReadEncoded(8);
|
x60_helmetAlpha = stream.ReadEncoded(8);
|
||||||
x64_ = stream.ReadEncoded(8);
|
x64_hudAlpha = stream.ReadEncoded(8);
|
||||||
|
|
||||||
x68_24_ = stream.ReadEncoded(1);
|
x68_24_hudLag = stream.ReadEncoded(1);
|
||||||
x68_28_ = stream.ReadEncoded(1);
|
x68_28_hintSystem = stream.ReadEncoded(1);
|
||||||
x68_25_ = stream.ReadEncoded(1);
|
x68_25_invertY = stream.ReadEncoded(1);
|
||||||
x68_26_ = stream.ReadEncoded(1);
|
x68_26_rumble = stream.ReadEncoded(1);
|
||||||
x68_27_ = stream.ReadEncoded(1);
|
x68_27_swapBeamsControls = stream.ReadEncoded(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::ResetToDefaults()
|
||||||
|
{
|
||||||
|
x48_ = 4;
|
||||||
|
x4c_screenXOffset = 0;
|
||||||
|
x50_screenYOffset = 0;
|
||||||
|
x54_screenStretch = 0;
|
||||||
|
x58_sfxVol = 0x7f;
|
||||||
|
x5c_musicVol = 0x7f;
|
||||||
|
x44_soundMode = ESoundMode::Stereo;
|
||||||
|
x60_helmetAlpha = 0xFF;
|
||||||
|
x64_hudAlpha = 0xFF;
|
||||||
|
x68_24_hudLag = true;
|
||||||
|
x68_25_invertY = false;
|
||||||
|
x68_26_rumble = true;
|
||||||
|
x68_27_swapBeamsControls = false;
|
||||||
|
x68_28_hintSystem = true;
|
||||||
|
InitSoundMode();
|
||||||
|
EnsureSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameOptions::PutTo(CBitStreamWriter& writer) const
|
void CGameOptions::PutTo(CBitStreamWriter& writer) const
|
||||||
@ -141,33 +162,199 @@ void CGameOptions::PutTo(CBitStreamWriter& writer) const
|
|||||||
writer.WriteEncoded(u32(x44_soundMode), 2);
|
writer.WriteEncoded(u32(x44_soundMode), 2);
|
||||||
writer.WriteEncoded(x48_, 4);
|
writer.WriteEncoded(x48_, 4);
|
||||||
|
|
||||||
writer.WriteEncoded(x4c_, 6);
|
writer.WriteEncoded(x4c_screenXOffset, 6);
|
||||||
writer.WriteEncoded(x50_, 6);
|
writer.WriteEncoded(x50_screenYOffset, 6);
|
||||||
writer.WriteEncoded(x54_, 5);
|
writer.WriteEncoded(x54_screenStretch, 5);
|
||||||
writer.WriteEncoded(x58_, 7);
|
writer.WriteEncoded(x58_sfxVol, 7);
|
||||||
writer.WriteEncoded(x5c_musicVol, 7);
|
writer.WriteEncoded(x5c_musicVol, 7);
|
||||||
writer.WriteEncoded(x60_, 8);
|
writer.WriteEncoded(x60_helmetAlpha, 8);
|
||||||
writer.WriteEncoded(x64_, 8);
|
writer.WriteEncoded(x64_hudAlpha, 8);
|
||||||
|
|
||||||
writer.WriteEncoded(x68_24_, 1);
|
writer.WriteEncoded(x68_24_hudLag, 1);
|
||||||
writer.WriteEncoded(x68_28_, 1);
|
writer.WriteEncoded(x68_28_hintSystem, 1);
|
||||||
writer.WriteEncoded(x68_25_, 1);
|
writer.WriteEncoded(x68_25_invertY, 1);
|
||||||
writer.WriteEncoded(x68_26_, 1);
|
writer.WriteEncoded(x68_26_rumble, 1);
|
||||||
writer.WriteEncoded(x68_27_, 1);
|
writer.WriteEncoded(x68_27_swapBeamsControls, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGameOptions::CGameOptions()
|
CGameOptions::CGameOptions()
|
||||||
{
|
{
|
||||||
x68_24_ = true;
|
x68_24_hudLag = true;
|
||||||
x68_26_ = true;
|
x68_26_rumble = true;
|
||||||
x68_28_ = true;
|
x68_28_hintSystem = true;
|
||||||
InitSoundMode();
|
InitSoundMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CGameOptions::sub8020F054()
|
||||||
|
{
|
||||||
|
return (0.375f * 1.f) + (float(x48_) * 0.25f);
|
||||||
|
}
|
||||||
|
|
||||||
void CGameOptions::InitSoundMode()
|
void CGameOptions::InitSoundMode()
|
||||||
{
|
{
|
||||||
/* If system is mono, force x44 to mono, otherwise honor user preference */
|
/* If system is mono, force x44 to mono, otherwise honor user preference */
|
||||||
}
|
}
|
||||||
|
static float flt805A8844 = 0.f;
|
||||||
|
void CGameOptions::sub8020F098(int val, bool b)
|
||||||
|
{
|
||||||
|
x48_ = zeus::clamp(0, val, 8);
|
||||||
|
|
||||||
|
if (b)
|
||||||
|
flt805A8844 = sub8020F054();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::SetScreenPositionX(s32 pos, bool apply)
|
||||||
|
{
|
||||||
|
x4c_screenXOffset = zeus::clamp(-30, pos, 30);
|
||||||
|
|
||||||
|
if (apply)
|
||||||
|
{
|
||||||
|
/* TOOD: CGraphics related funcs */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::SetScreenPositionY(s32 pos, bool apply)
|
||||||
|
{
|
||||||
|
x50_screenYOffset = zeus::clamp(-30, pos, 30);
|
||||||
|
|
||||||
|
if (apply)
|
||||||
|
{
|
||||||
|
/* TOOD: CGraphics related funcs */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::SetScreenStretch(s32 st, bool apply)
|
||||||
|
{
|
||||||
|
x54_screenStretch = zeus::clamp(-10, st, 10);
|
||||||
|
|
||||||
|
if (apply)
|
||||||
|
{
|
||||||
|
/* TOOD: CGraphics related funcs */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::SetSfxVolume(s32 vol, bool apply)
|
||||||
|
{
|
||||||
|
x58_sfxVol = zeus::clamp(0, vol, 0x7f);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if (apply)
|
||||||
|
{
|
||||||
|
CAudioSys::SysSetSfxVolume(x58_sfxVol, 1, 1, 1);
|
||||||
|
CStreamedAudioManager::SetSfxVolume(x58_sfxVol);
|
||||||
|
CMoviePlayer::SetSfxVolume(x58_sfxVol);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::SetMusicVolume(s32 vol, bool apply)
|
||||||
|
{
|
||||||
|
x5c_musicVol = zeus::clamp(0, vol, 0x7f);
|
||||||
|
# if 0
|
||||||
|
if (apply)
|
||||||
|
CStreamedAudioManager::SetGlobalVolume(x5c_musicVol);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::SetHUDAlpha(u32 alpha)
|
||||||
|
{
|
||||||
|
x64_hudAlpha = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CGameOptions::GetHUDAlpha() const
|
||||||
|
{
|
||||||
|
return x64_hudAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::SetHelmetAlpha(u32 alpha)
|
||||||
|
{
|
||||||
|
x60_helmetAlpha = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CGameOptions::GetHelmetAlpha() const
|
||||||
|
{
|
||||||
|
return x60_helmetAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::SetHUDLag(bool lag)
|
||||||
|
{
|
||||||
|
x68_24_hudLag = lag;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CGameOptions::GetHUDLag() const
|
||||||
|
{
|
||||||
|
return x68_24_hudLag;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::SetInvertYAxis(bool invert)
|
||||||
|
{
|
||||||
|
x68_25_invertY = invert;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CGameOptions::GetInvertYAxis() const
|
||||||
|
{
|
||||||
|
return x68_25_invertY;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::SetIsRumbleEnabled(bool rumble)
|
||||||
|
{
|
||||||
|
x68_26_rumble = rumble;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CGameOptions::IsRumbleEnabled() const
|
||||||
|
{
|
||||||
|
return x68_26_rumble;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::ToggleControls(bool swap)
|
||||||
|
{
|
||||||
|
x68_27_swapBeamsControls = swap;
|
||||||
|
if (!swap)
|
||||||
|
SetControls(0);
|
||||||
|
else
|
||||||
|
SetControls(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::SetIsHintSystemEnabled(bool hints)
|
||||||
|
{
|
||||||
|
x68_28_hintSystem = hints;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CGameOptions::IsHintSystemEnabled() const
|
||||||
|
{
|
||||||
|
return x68_28_hintSystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::SetControls(s32 controls)
|
||||||
|
{
|
||||||
|
if (controls == 0)
|
||||||
|
g_currentPlayerControl = g_tweakPlayerControl;
|
||||||
|
else
|
||||||
|
g_currentPlayerControl = g_tweakPlayerControlAlt;
|
||||||
|
|
||||||
|
ResetControllerAssets();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::ResetControllerAssets()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGameOptions::EnsureSettings()
|
||||||
|
{
|
||||||
|
sub8020F098(x48_, true);
|
||||||
|
SetScreenPositionX(x4c_screenXOffset, true);
|
||||||
|
SetScreenPositionY(x50_screenYOffset, true);
|
||||||
|
SetScreenStretch(x54_screenStretch, true);
|
||||||
|
SetSfxVolume(x58_sfxVol, true);
|
||||||
|
SetMusicVolume(x5c_musicVol, true);
|
||||||
|
//SetSurroundMode(x44_soundMode, true);
|
||||||
|
SetHUDAlpha(x64_hudAlpha);
|
||||||
|
SetHUDLag(x68_24_hudLag);
|
||||||
|
SetInvertYAxis(x68_25_invertY);
|
||||||
|
SetIsRumbleEnabled(x68_26_rumble);
|
||||||
|
SetIsHintSystemEnabled(x68_28_hintSystem);
|
||||||
|
ToggleControls(x68_27_swapBeamsControls);
|
||||||
|
}
|
||||||
|
|
||||||
CHintOptions::CHintOptions(CBitStreamReader& stream)
|
CHintOptions::CHintOptions(CBitStreamReader& stream)
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define __URDE_CGAMEOPTIONS_HPP__
|
#define __URDE_CGAMEOPTIONS_HPP__
|
||||||
|
|
||||||
#include "RetroTypes.hpp"
|
#include "RetroTypes.hpp"
|
||||||
|
#include "Audio/CAudioSys.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
@ -73,23 +74,23 @@ private:
|
|||||||
bool x0_[64] = {};
|
bool x0_[64] = {};
|
||||||
ESoundMode x44_soundMode = ESoundMode::Stereo;
|
ESoundMode x44_soundMode = ESoundMode::Stereo;
|
||||||
u32 x48_ = 4;
|
u32 x48_ = 4;
|
||||||
u32 x4c_ = 0;
|
s32 x4c_screenXOffset = 0;
|
||||||
u32 x50_ = 0;
|
s32 x50_screenYOffset = 0;
|
||||||
u32 x54_ = 0;
|
s32 x54_screenStretch = 0;
|
||||||
u32 x58_ = 0x7f;
|
u32 x58_sfxVol = 0x7f;
|
||||||
u32 x5c_musicVol = 0x7f;
|
u32 x5c_musicVol = 0x7f;
|
||||||
u32 x60_ = 0xff;
|
u32 x60_helmetAlpha = 0xff;
|
||||||
u32 x64_ = 0xff;
|
u32 x64_hudAlpha = 0xff;
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool x68_24_ : 1;
|
bool x68_24_hudLag : 1;
|
||||||
bool x68_25_ : 1;
|
bool x68_25_invertY : 1;
|
||||||
bool x68_26_ : 1;
|
bool x68_26_rumble : 1;
|
||||||
bool x68_27_ : 1;
|
bool x68_27_swapBeamsControls : 1;
|
||||||
bool x68_28_ : 1;
|
bool x68_28_hintSystem : 1;
|
||||||
};
|
};
|
||||||
u16 _dummy = 0;
|
u16 _dummy = 0;
|
||||||
};
|
};
|
||||||
@ -101,9 +102,35 @@ private:
|
|||||||
public:
|
public:
|
||||||
CGameOptions();
|
CGameOptions();
|
||||||
CGameOptions(CBitStreamReader& stream);
|
CGameOptions(CBitStreamReader& stream);
|
||||||
|
void ResetToDefaults();
|
||||||
void InitSoundMode();
|
void InitSoundMode();
|
||||||
|
void EnsureSettings();
|
||||||
void PutTo(CBitStreamWriter& writer) const;
|
void PutTo(CBitStreamWriter& writer) const;
|
||||||
u32 GetMusicVolume() const { return x5c_musicVol; }
|
u32 GetMusicVolume() const { return x5c_musicVol; }
|
||||||
|
|
||||||
|
float sub8020F054();
|
||||||
|
void sub8020F098(int, bool);
|
||||||
|
void SetScreenPositionX(s32, bool);
|
||||||
|
void SetScreenPositionY(s32, bool);
|
||||||
|
void SetScreenStretch(s32, bool);
|
||||||
|
void SetSfxVolume(s32, bool);
|
||||||
|
void SetMusicVolume(s32, bool);
|
||||||
|
//void SetSurroundMode(CAudioSys::ESurroundModes, int);
|
||||||
|
void SetHUDAlpha(u32);
|
||||||
|
u32 GetHUDAlpha() const;
|
||||||
|
void SetHelmetAlpha(u32);
|
||||||
|
u32 GetHelmetAlpha() const;
|
||||||
|
void SetHUDLag(bool);
|
||||||
|
bool GetHUDLag() const;
|
||||||
|
void SetInvertYAxis(bool);
|
||||||
|
bool GetInvertYAxis() const;
|
||||||
|
void SetIsRumbleEnabled(bool);
|
||||||
|
bool IsRumbleEnabled() const;
|
||||||
|
void ToggleControls(bool);
|
||||||
|
void SetIsHintSystemEnabled(bool);
|
||||||
|
bool IsHintSystemEnabled() const;
|
||||||
|
void SetControls(s32);
|
||||||
|
void ResetControllerAssets();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CHintOptions
|
class CHintOptions
|
||||||
|
@ -84,7 +84,7 @@ void CWorldState::PutTo(CBitStreamWriter& writer, const CSaveWorld& savw) const
|
|||||||
writer.WriteEncoded(x4_areaId, 32);
|
writer.WriteEncoded(x4_areaId, 32);
|
||||||
writer.WriteEncoded(x10_, 32);
|
writer.WriteEncoded(x10_, 32);
|
||||||
x8_relayTracker->PutTo(writer, savw);
|
x8_relayTracker->PutTo(writer, savw);
|
||||||
xc_mapWorldInfo->PutTo(writer, savw);
|
xc_mapWorldInfo->PutTo(writer, savw, x0_mlvlId);
|
||||||
x14_layerState->PutTo(writer);
|
x14_layerState->PutTo(writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,14 +20,12 @@ class CWorldLayerState
|
|||||||
friend class CSaveWorldIntermediate;
|
friend class CSaveWorldIntermediate;
|
||||||
std::vector<CWorldLayers::Area> x0_areaLayers;
|
std::vector<CWorldLayers::Area> x0_areaLayers;
|
||||||
DataSpec::WordBitmap x10_saveLayers;
|
DataSpec::WordBitmap x10_saveLayers;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CWorldLayerState() = default;
|
CWorldLayerState() = default;
|
||||||
CWorldLayerState(CBitStreamReader& reader, const CSaveWorld& saveWorld);
|
CWorldLayerState(CBitStreamReader& reader, const CSaveWorld& saveWorld);
|
||||||
|
|
||||||
bool IsLayerActive(int areaIdx, int layerIdx) const
|
bool IsLayerActive(int areaIdx, int layerIdx) const { return (x0_areaLayers[areaIdx].m_layerBits >> layerIdx) & 1; }
|
||||||
{
|
|
||||||
return (x0_areaLayers[areaIdx].m_layerBits >> layerIdx) & 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetLayerActive(int areaIdx, int layerIdx, bool active)
|
void SetLayerActive(int areaIdx, int layerIdx, bool active)
|
||||||
{
|
{
|
||||||
@ -39,10 +37,7 @@ public:
|
|||||||
|
|
||||||
void InitializeWorldLayers(const std::vector<CWorldLayers::Area>& layers);
|
void InitializeWorldLayers(const std::vector<CWorldLayers::Area>& layers);
|
||||||
|
|
||||||
u32 GetAreaLayerCount(int areaIdx) const
|
u32 GetAreaLayerCount(int areaIdx) const { return x0_areaLayers[areaIdx].m_layerCount; }
|
||||||
{
|
|
||||||
return x0_areaLayers[areaIdx].m_layerCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PutTo(CBitStreamWriter& writer) const;
|
void PutTo(CBitStreamWriter& writer) const;
|
||||||
};
|
};
|
||||||
@ -55,10 +50,11 @@ class CWorldState
|
|||||||
std::shared_ptr<CMapWorldInfo> xc_mapWorldInfo;
|
std::shared_ptr<CMapWorldInfo> xc_mapWorldInfo;
|
||||||
u32 x10_;
|
u32 x10_;
|
||||||
std::shared_ptr<CWorldLayerState> x14_layerState;
|
std::shared_ptr<CWorldLayerState> x14_layerState;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CWorldState(ResId id);
|
CWorldState(ResId id);
|
||||||
CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorld& saveWorld);
|
CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorld& saveWorld);
|
||||||
ResId GetWorldAssetId() const {return x0_mlvlId;}
|
ResId GetWorldAssetId() const { return x0_mlvlId; }
|
||||||
void SetAreaId(TAreaId aid) { x4_areaId = aid; }
|
void SetAreaId(TAreaId aid) { x4_areaId = aid; }
|
||||||
TAreaId GetCurrentAreaId() const { return x4_areaId; }
|
TAreaId GetCurrentAreaId() const { return x4_areaId; }
|
||||||
const std::shared_ptr<CRelayTracker>& RelayTracker() const { return x8_relayTracker; }
|
const std::shared_ptr<CRelayTracker>& RelayTracker() const { return x8_relayTracker; }
|
||||||
@ -101,8 +97,8 @@ public:
|
|||||||
CGameState();
|
CGameState();
|
||||||
CGameState(CBitStreamReader& stream, u32 saveIdx);
|
CGameState(CBitStreamReader& stream, u32 saveIdx);
|
||||||
void SetCurrentWorldId(ResId id);
|
void SetCurrentWorldId(ResId id);
|
||||||
std::shared_ptr<CPlayerState> GetPlayerState() {return x98_playerState;}
|
std::shared_ptr<CPlayerState> GetPlayerState() { return x98_playerState; }
|
||||||
std::shared_ptr<CWorldTransManager> GetWorldTransitionManager() {return x9c_transManager;}
|
std::shared_ptr<CWorldTransManager> GetWorldTransitionManager() { return x9c_transManager; }
|
||||||
void SetTotalPlayTime(float time);
|
void SetTotalPlayTime(float time);
|
||||||
CPersistentOptions& SystemOptions() { return xa8_systemOptions; }
|
CPersistentOptions& SystemOptions() { return xa8_systemOptions; }
|
||||||
CGameOptions& GameOptions() { return x17c_gameOptions; }
|
CGameOptions& GameOptions() { return x17c_gameOptions; }
|
||||||
@ -137,7 +133,6 @@ public:
|
|||||||
};
|
};
|
||||||
static GameFileStateInfo LoadGameFileState(const u8* data);
|
static GameFileStateInfo LoadGameFileState(const u8* data);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __URDE_CGAMESTATE_HPP__
|
#endif // __URDE_CGAMESTATE_HPP__
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
const CMaterialFilter CMaterialFilter::skPassEverything({0x00000000FFFFFFFF}, {0}, CMaterialFilter::EFilterType::Zero);
|
const CMaterialFilter CMaterialFilter::skPassEverything({0x00000000FFFFFFFF}, {0}, CMaterialFilter::EFilterType::Include);
|
||||||
|
|
||||||
CMaterialFilter::CMaterialFilter(const CMaterialList& include, const CMaterialList& exclude, CMaterialFilter::EFilterType type)
|
CMaterialFilter::CMaterialFilter(const CMaterialList& include, const CMaterialList& exclude, CMaterialFilter::EFilterType type)
|
||||||
: x0_include(include),
|
: x0_include(include),
|
||||||
@ -13,17 +13,17 @@ CMaterialFilter::CMaterialFilter(const CMaterialList& include, const CMaterialLi
|
|||||||
|
|
||||||
CMaterialFilter CMaterialFilter::MakeInclude(const CMaterialList& include)
|
CMaterialFilter CMaterialFilter::MakeInclude(const CMaterialList& include)
|
||||||
{
|
{
|
||||||
return CMaterialFilter(include, {EMaterialTypes::Unknown}, EFilterType::Zero);
|
return CMaterialFilter(include, {0ull}, EFilterType::Include);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMaterialFilter CMaterialFilter::MakeExclude(const CMaterialList& exclude)
|
CMaterialFilter CMaterialFilter::MakeExclude(const CMaterialList& exclude)
|
||||||
{
|
{
|
||||||
return CMaterialFilter({u64(0x00000000FFFFFFFF)}, exclude, EFilterType::Two);
|
return CMaterialFilter({u64(0x00000000FFFFFFFF)}, exclude, EFilterType::Exclude);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMaterialFilter CMaterialFilter::MakeIncludeExclude(const CMaterialList& include, const CMaterialList& exclude)
|
CMaterialFilter CMaterialFilter::MakeIncludeExclude(const CMaterialList& include, const CMaterialList& exclude)
|
||||||
{
|
{
|
||||||
return CMaterialFilter(include, exclude, EFilterType::Three);
|
return CMaterialFilter(include, exclude, EFilterType::IncludeExclude);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,15 +10,15 @@ class CMaterialFilter
|
|||||||
public:
|
public:
|
||||||
enum class EFilterType
|
enum class EFilterType
|
||||||
{
|
{
|
||||||
Zero,
|
Include,
|
||||||
One,
|
One,
|
||||||
Two,
|
Exclude,
|
||||||
Three
|
IncludeExclude
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
CMaterialList x0_include;
|
CMaterialList x0_include;
|
||||||
CMaterialList x8_exclude;
|
CMaterialList x8_exclude;
|
||||||
EFilterType x10_type = EFilterType::Three;
|
EFilterType x10_type = EFilterType::IncludeExclude;
|
||||||
public:
|
public:
|
||||||
static const CMaterialFilter skPassEverything;
|
static const CMaterialFilter skPassEverything;
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ class CStringTable* g_MainStringTable = nullptr;
|
|||||||
DataSpec::ITweakGame* g_tweakGame = nullptr;
|
DataSpec::ITweakGame* g_tweakGame = nullptr;
|
||||||
DataSpec::ITweakPlayer* g_tweakPlayer = nullptr;
|
DataSpec::ITweakPlayer* g_tweakPlayer = nullptr;
|
||||||
DataSpec::ITweakPlayerControl* g_tweakPlayerControl = nullptr;
|
DataSpec::ITweakPlayerControl* g_tweakPlayerControl = nullptr;
|
||||||
|
DataSpec::ITweakPlayerControl* g_tweakPlayerControlAlt = nullptr;
|
||||||
|
DataSpec::ITweakPlayerControl* g_currentPlayerControl = nullptr;
|
||||||
DataSpec::ITweakPlayerGun* g_tweakPlayerGun = nullptr;
|
DataSpec::ITweakPlayerGun* g_tweakPlayerGun = nullptr;
|
||||||
DataSpec::ITweakGunRes* g_tweakGunRes = nullptr;
|
DataSpec::ITweakGunRes* g_tweakGunRes = nullptr;
|
||||||
DataSpec::ITweakPlayerRes* g_tweakPlayerRes = nullptr;
|
DataSpec::ITweakPlayerRes* g_tweakPlayerRes = nullptr;
|
||||||
|
@ -32,6 +32,8 @@ extern class CStringTable* g_MainStringTable;
|
|||||||
extern DataSpec::ITweakGame* g_tweakGame;
|
extern DataSpec::ITweakGame* g_tweakGame;
|
||||||
extern DataSpec::ITweakPlayer* g_tweakPlayer;
|
extern DataSpec::ITweakPlayer* g_tweakPlayer;
|
||||||
extern DataSpec::ITweakPlayerControl* g_tweakPlayerControl;
|
extern DataSpec::ITweakPlayerControl* g_tweakPlayerControl;
|
||||||
|
extern DataSpec::ITweakPlayerControl* g_tweakPlayerControlAlt;
|
||||||
|
extern DataSpec::ITweakPlayerControl* g_currentPlayerControl;
|
||||||
extern DataSpec::ITweakPlayerGun* g_tweakPlayerGun;
|
extern DataSpec::ITweakPlayerGun* g_tweakPlayerGun;
|
||||||
extern DataSpec::ITweakGunRes* g_tweakGunRes;
|
extern DataSpec::ITweakGunRes* g_tweakGunRes;
|
||||||
extern DataSpec::ITweakPlayerRes* g_tweakPlayerRes;
|
extern DataSpec::ITweakPlayerRes* g_tweakPlayerRes;
|
||||||
|
@ -206,7 +206,7 @@ bool ControlMapper::GetPressInput(ECommands cmd, const CFinalInput& input)
|
|||||||
{
|
{
|
||||||
if (!skCommandFilterFlag[int(cmd)])
|
if (!skCommandFilterFlag[int(cmd)])
|
||||||
return false;
|
return false;
|
||||||
EFunctionList func = EFunctionList(g_tweakPlayerControl->GetMapping(atUint32(cmd)));
|
EFunctionList func = EFunctionList(g_currentPlayerControl->GetMapping(atUint32(cmd)));
|
||||||
if (func > EFunctionList::MAX)
|
if (func > EFunctionList::MAX)
|
||||||
return false;
|
return false;
|
||||||
BoolReturnFn fn = skPressFuncs[int(func)];
|
BoolReturnFn fn = skPressFuncs[int(func)];
|
||||||
@ -219,7 +219,7 @@ bool ControlMapper::GetDigitalInput(ECommands cmd, const CFinalInput& input)
|
|||||||
{
|
{
|
||||||
if (!skCommandFilterFlag[int(cmd)])
|
if (!skCommandFilterFlag[int(cmd)])
|
||||||
return false;
|
return false;
|
||||||
EFunctionList func = EFunctionList(g_tweakPlayerControl->GetMapping(atUint32(cmd)));
|
EFunctionList func = EFunctionList(g_currentPlayerControl->GetMapping(atUint32(cmd)));
|
||||||
if (func > EFunctionList::MAX)
|
if (func > EFunctionList::MAX)
|
||||||
return false;
|
return false;
|
||||||
BoolReturnFn fn = skDigitalFuncs[int(func)];
|
BoolReturnFn fn = skDigitalFuncs[int(func)];
|
||||||
@ -232,7 +232,7 @@ float ControlMapper::GetAnalogInput(ECommands cmd, const CFinalInput& input)
|
|||||||
{
|
{
|
||||||
if (!skCommandFilterFlag[int(cmd)])
|
if (!skCommandFilterFlag[int(cmd)])
|
||||||
return 0.0;
|
return 0.0;
|
||||||
EFunctionList func = EFunctionList(g_tweakPlayerControl->GetMapping(atUint32(cmd)));
|
EFunctionList func = EFunctionList(g_currentPlayerControl->GetMapping(atUint32(cmd)));
|
||||||
if (func > EFunctionList::MAX)
|
if (func > EFunctionList::MAX)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
FloatReturnFn fn = skAnalogFuncs[int(func)];
|
FloatReturnFn fn = skAnalogFuncs[int(func)];
|
||||||
|
@ -8,10 +8,9 @@ CGameProjectile::CGameProjectile(bool active, const TToken<CWeaponDescription>&,
|
|||||||
u32 w1, bool b2, const zeus::CVector3f&,
|
u32 w1, bool b2, const zeus::CVector3f&,
|
||||||
const rstl::optional_object<TLockedToken<CGenDescription>>&, s16, bool b3)
|
const rstl::optional_object<TLockedToken<CGenDescription>>&, s16, bool b3)
|
||||||
: CWeapon(owner, aid, uid, active, wType, name, xf,
|
: CWeapon(owner, aid, uid, active, wType, name, xf,
|
||||||
CMaterialFilter(CMaterialList(EMaterialTypes::NonSolidDamageable, matType),
|
CMaterialFilter::MakeIncludeExclude(
|
||||||
CMaterialList(EMaterialTypes::Projectile, EMaterialTypes::ProjectilePassthrough, matType,
|
{EMaterialTypes::NonSolidDamageable, matType},
|
||||||
EMaterialTypes::Solid),
|
{EMaterialTypes::Projectile, EMaterialTypes::ProjectilePassthrough, matType, EMaterialTypes::Solid}),
|
||||||
CMaterialFilter::EFilterType::Three),
|
|
||||||
CMaterialList(), dInfo, EProjectileAttrib(w1) | GetBeamAttribType(wType), CModelData::CModelDataNull())
|
CMaterialList(), dInfo, EProjectileAttrib(w1) | GetBeamAttribType(wType), CModelData::CModelDataNull())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ CActor::CActor(TUniqueId uid, bool active, const std::string& name, const CEntit
|
|||||||
CModelData&& mData, const CMaterialList& list, const CActorParameters& params, TUniqueId otherUid)
|
CModelData&& mData, const CMaterialList& list, const CActorParameters& params, TUniqueId otherUid)
|
||||||
: CEntity(uid, info, active, name)
|
: CEntity(uid, info, active, name)
|
||||||
, x68_material(MakeActorMaterialList(list, params))
|
, x68_material(MakeActorMaterialList(list, params))
|
||||||
, x70_materialFilter(CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::Unknown}))
|
, x70_materialFilter(CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {0ull}))
|
||||||
, xc6_(otherUid)
|
, xc6_(otherUid)
|
||||||
{
|
{
|
||||||
if (mData.x10_animData || mData.x1c_normalModel)
|
if (mData.x10_animData || mData.x1c_normalModel)
|
||||||
|
@ -654,6 +654,11 @@ void CGameArea::ReloadAllUnloadedTextures()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGameArea::PrepTokens()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
u32 CGameArea::GetNumPartSizes() const
|
u32 CGameArea::GetNumPartSizes() const
|
||||||
{
|
{
|
||||||
return hecl::SBig(*reinterpret_cast<u32*>(x110_mreaSecBufs[0].first.get() + 60));
|
return hecl::SBig(*reinterpret_cast<u32*>(x110_mreaSecBufs[0].first.get() + 60));
|
||||||
|
@ -274,6 +274,7 @@ public:
|
|||||||
void PreRender();
|
void PreRender();
|
||||||
void AliveUpdate(float dt);
|
void AliveUpdate(float dt);
|
||||||
void SetOcclusionState(EOcclusionState state);
|
void SetOcclusionState(EOcclusionState state);
|
||||||
|
EOcclusionState GetOcclusionState() const { return GetPostConstructed()->x10dc_occlusionState; }
|
||||||
void RemoveStaticGeometry();
|
void RemoveStaticGeometry();
|
||||||
void AddStaticGeometry();
|
void AddStaticGeometry();
|
||||||
//void TransferTokensToARAM();
|
//void TransferTokensToARAM();
|
||||||
@ -283,6 +284,7 @@ public:
|
|||||||
//void UnloadAllLoadedTextures();
|
//void UnloadAllLoadedTextures();
|
||||||
//void ReloadAllLoadedTextures();
|
//void ReloadAllLoadedTextures();
|
||||||
void ReloadAllUnloadedTextures();
|
void ReloadAllUnloadedTextures();
|
||||||
|
void PrepTokens();
|
||||||
u32 GetNumPartSizes() const;
|
u32 GetNumPartSizes() const;
|
||||||
void AllocNewAreaData(int, int);
|
void AllocNewAreaData(int, int);
|
||||||
bool Invalidate(CStateManager& mgr);
|
bool Invalidate(CStateManager& mgr);
|
||||||
|
@ -133,7 +133,7 @@ u16 CPlayer::GetMaterialSoundUnderPlayer(CStateManager& mgr, const u16*, int, u1
|
|||||||
u16 CPlayer::SfxIdFromMaterial(const CMaterialList& mat, const u16* idList, u32 tableLen, u16 defId)
|
u16 CPlayer::SfxIdFromMaterial(const CMaterialList& mat, const u16* idList, u32 tableLen, u16 defId)
|
||||||
{
|
{
|
||||||
u16 id = defId;
|
u16 id = defId;
|
||||||
for (u32 i = 0 ; i < tableLen; ++i)
|
for (u32 i = 0; i < tableLen; ++i)
|
||||||
{
|
{
|
||||||
if (mat.HasMaterial(EMaterialTypes(i)) && idList[i] != 0xFFFF)
|
if (mat.HasMaterial(EMaterialTypes(i)) && idList[i] != 0xFFFF)
|
||||||
id = idList[i];
|
id = idList[i];
|
||||||
@ -359,4 +359,6 @@ void CPlayer::CVisorSteam::Update(float dt)
|
|||||||
|
|
||||||
x24_ = 0.1f;
|
x24_ = 0.1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPlayer::SetSpawnedMorphBallState(CPlayer::EPlayerMorphBallState, CStateManager&) {}
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,14 @@ public:
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class EPlayerMorphBallState
|
||||||
|
{
|
||||||
|
Unmorphed,
|
||||||
|
Morphed,
|
||||||
|
Morphing,
|
||||||
|
UnMorphing
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct CVisorSteam
|
struct CVisorSteam
|
||||||
{
|
{
|
||||||
@ -210,6 +218,7 @@ public:
|
|||||||
void UpdateScanningState(const CFinalInput& input, CStateManager& mgr, float);
|
void UpdateScanningState(const CFinalInput& input, CStateManager& mgr, float);
|
||||||
void ValidateScanning(const CFinalInput& input, CStateManager& mgr);
|
void ValidateScanning(const CFinalInput& input, CStateManager& mgr);
|
||||||
void SetScanningState(EPlayerScanState, CStateManager& mgr);
|
void SetScanningState(EPlayerScanState, CStateManager& mgr);
|
||||||
|
void SetSpawnedMorphBallState(EPlayerMorphBallState, CStateManager&);
|
||||||
bool GetExplorationMode() const;
|
bool GetExplorationMode() const;
|
||||||
bool GetCombatMode() const;
|
bool GetCombatMode() const;
|
||||||
void RenderGun(CStateManager& mgr, const zeus::CVector3f&) const;
|
void RenderGun(CStateManager& mgr, const zeus::CVector3f&) const;
|
||||||
|
@ -105,7 +105,7 @@ void CScriptDock::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
|||||||
CMaterialList exclude = GetMaterialFilter().GetExcludeList();
|
CMaterialList exclude = GetMaterialFilter().GetExcludeList();
|
||||||
CMaterialList include = GetMaterialFilter().GetIncludeList();
|
CMaterialList include = GetMaterialFilter().GetIncludeList();
|
||||||
include.Add(EMaterialTypes::AIBlock);
|
include.Add(EMaterialTypes::AIBlock);
|
||||||
SetMaterialFilter({include, exclude, CMaterialFilter::EFilterType::Three});
|
SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(include, exclude));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EScriptObjectMessage::SetToZero:
|
case EScriptObjectMessage::SetToZero:
|
||||||
@ -147,10 +147,8 @@ void CScriptDock::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
|||||||
}
|
}
|
||||||
else if (aid == 0 || (mgr.GetWorld()->GetNumAreas() <= aid || !mgr.WorldNC()->GetArea(aid)->GetActive()))
|
else if (aid == 0 || (mgr.GetWorld()->GetNumAreas() <= aid || !mgr.WorldNC()->GetArea(aid)->GetActive()))
|
||||||
return;
|
return;
|
||||||
#if 0
|
CWorld::PropogateAreaChain(CGameArea::EOcclusionState(msg == EScriptObjectMessage::Increment),
|
||||||
/* Propogate through area chain */
|
mgr.WorldNC()->GetArea(aid), mgr.WorldNC());
|
||||||
sub800C40DC((msg == EScriptObjectMessage::Increment), mgr.GetWorld()->GetAreaAlways(aid), mgr.WorldNC());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1,15 +1,69 @@
|
|||||||
#include "CScriptSpawnPoint.hpp"
|
#include "CScriptSpawnPoint.hpp"
|
||||||
|
#include "CStateManager.hpp"
|
||||||
|
#include "CWorld.hpp"
|
||||||
|
#include "CPlayer.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
CScriptSpawnPoint::CScriptSpawnPoint(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
CScriptSpawnPoint::CScriptSpawnPoint(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||||
const zeus::CTransform& xf, const std::vector<u32>& itemCounts,
|
const zeus::CTransform& xf, const std::vector<u32>& itemCounts, bool defaultSpawn,
|
||||||
bool defaultSpawn, bool active, bool b3)
|
bool active, bool morphed)
|
||||||
: CEntity(uid, info, active, name), x34_xf(xf), x64_itemCounts(itemCounts)
|
: CEntity(uid, info, active, name), x34_xf(xf), x64_itemCounts(itemCounts)
|
||||||
{
|
{
|
||||||
x10c_24_firstSpawn = defaultSpawn;
|
x10c_24_firstSpawn = defaultSpawn;
|
||||||
x10c_25_ = b3;
|
x10c_25_morphed = morphed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptSpawnPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
|
||||||
|
{
|
||||||
|
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
||||||
|
|
||||||
|
if (msg == EScriptObjectMessage::SetToZero || msg == EScriptObjectMessage::Reset)
|
||||||
|
{
|
||||||
|
if (msg == EScriptObjectMessage::Reset)
|
||||||
|
{
|
||||||
|
using EPlayerItemType = CPlayerState::EItemType;
|
||||||
|
const std::shared_ptr<CPlayerState>& plState = stateMgr.GetPlayerState();
|
||||||
|
for (u32 i = 0; i < u32(EPlayerItemType::Max); ++i)
|
||||||
|
{
|
||||||
|
plState->ReInitalizePowerUp(EPlayerItemType(i), GetPowerup(EPlayerItemType(i)));
|
||||||
|
plState->ResetAndIncrPickUp(EPlayerItemType(i), GetPowerup(EPlayerItemType(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetActive())
|
||||||
|
{
|
||||||
|
CPlayer* player = stateMgr.Player();
|
||||||
|
|
||||||
|
if (x4_areaId != stateMgr.GetNextAreaId())
|
||||||
|
{
|
||||||
|
CGameArea* area = stateMgr.WorldNC()->GetArea(x4_areaId);
|
||||||
|
if (area->IsPostConstructed() && area->GetOcclusionState() == CGameArea::EOcclusionState::NotOccluded)
|
||||||
|
{
|
||||||
|
/* while (!area->TryTakingOutOfARAM()) {} */
|
||||||
|
CWorld::PropogateAreaChain(CGameArea::EOcclusionState::Occluded, area, stateMgr.WorldNC());
|
||||||
|
}
|
||||||
|
|
||||||
|
stateMgr.SetCurrentAreaId(x4_areaId);
|
||||||
|
stateMgr.SetActorAreaId(*stateMgr.Player(), x4_areaId);
|
||||||
|
player->Teleport(GetTransform(), stateMgr, true);
|
||||||
|
player->SetSpawnedMorphBallState(CPlayer::EPlayerMorphBallState(x10c_25_morphed), stateMgr);
|
||||||
|
|
||||||
|
if (area->IsPostConstructed() && area->GetOcclusionState() == CGameArea::EOcclusionState::Occluded)
|
||||||
|
CWorld::PropogateAreaChain(CGameArea::EOcclusionState::NotOccluded,
|
||||||
|
stateMgr.WorldNC()->GetArea(stateMgr.GetNextAreaId()),
|
||||||
|
stateMgr.WorldNC());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player->Teleport(GetTransform(), stateMgr, true);
|
||||||
|
player->SetSpawnedMorphBallState(CPlayer::EPlayerMorphBallState(x10c_25_morphed), stateMgr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CEntity::SendScriptMsgs(EScriptObjectState::Zero, stateMgr, EScriptObjectMessage::None);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 CScriptSpawnPoint::GetPowerup(CPlayerState::EItemType item) const
|
u32 CScriptSpawnPoint::GetPowerup(CPlayerState::EItemType item) const
|
||||||
@ -19,5 +73,4 @@ u32 CScriptSpawnPoint::GetPowerup(CPlayerState::EItemType item) const
|
|||||||
return x64_itemCounts.front();
|
return x64_itemCounts.front();
|
||||||
return x64_itemCounts[idx];
|
return x64_itemCounts[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class CScriptSpawnPoint : public CEntity
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool x10c_24_firstSpawn : 1;
|
bool x10c_24_firstSpawn : 1;
|
||||||
bool x10c_25_ : 1;
|
bool x10c_25_morphed : 1;
|
||||||
};
|
};
|
||||||
u8 _dummy = 0;
|
u8 _dummy = 0;
|
||||||
};
|
};
|
||||||
@ -26,6 +26,7 @@ public:
|
|||||||
const zeus::CTransform& xf, const std::vector<u32>& itemCounts,
|
const zeus::CTransform& xf, const std::vector<u32>& itemCounts,
|
||||||
bool, bool, bool);
|
bool, bool, bool);
|
||||||
|
|
||||||
|
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr);
|
||||||
bool FirstSpawn() const { return x10c_24_firstSpawn; }
|
bool FirstSpawn() const { return x10c_24_firstSpawn; }
|
||||||
const zeus::CTransform& GetTransform() const { return x34_xf; }
|
const zeus::CTransform& GetTransform() const { return x34_xf; }
|
||||||
u32 GetPowerup(CPlayerState::EItemType item) const;
|
u32 GetPowerup(CPlayerState::EItemType item) const;
|
||||||
|
@ -10,53 +10,30 @@
|
|||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
CWorld::CSoundGroupData::CSoundGroupData(int grpId, ResId agsc)
|
CWorld::CSoundGroupData::CSoundGroupData(int grpId, ResId agsc) : x0_groupId(grpId), x4_agscId(agsc)
|
||||||
: x0_groupId(grpId), x4_agscId(agsc)
|
|
||||||
{
|
{
|
||||||
x1c_groupData = g_SimplePool->GetObj(SObjectTag{FOURCC('AGSC'), agsc});
|
x1c_groupData = g_SimplePool->GetObj(SObjectTag{FOURCC('AGSC'), agsc});
|
||||||
}
|
}
|
||||||
|
|
||||||
CDummyWorld::CDummyWorld(ResId mlvlId, bool loadMap)
|
CDummyWorld::CDummyWorld(ResId mlvlId, bool loadMap) : x4_loadMap(loadMap), xc_mlvlId(mlvlId)
|
||||||
: x4_loadMap(loadMap), xc_mlvlId(mlvlId)
|
|
||||||
{
|
{
|
||||||
SObjectTag tag{FOURCC('MLVL'), mlvlId};
|
SObjectTag tag{FOURCC('MLVL'), mlvlId};
|
||||||
static_cast<ProjectResourceFactoryBase*>(g_ResFactory)->LoadResourceAsync(tag, x34_loadBuf);
|
static_cast<ProjectResourceFactoryBase*>(g_ResFactory)->LoadResourceAsync(tag, x34_loadBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResId CDummyWorld::IGetWorldAssetId() const
|
ResId CDummyWorld::IGetWorldAssetId() const { return xc_mlvlId; }
|
||||||
{
|
|
||||||
return xc_mlvlId;
|
|
||||||
}
|
|
||||||
|
|
||||||
ResId CDummyWorld::IGetStringTableAssetId() const
|
ResId CDummyWorld::IGetStringTableAssetId() const { return x10_strgId; }
|
||||||
{
|
|
||||||
return x10_strgId;
|
|
||||||
}
|
|
||||||
|
|
||||||
ResId CDummyWorld::IGetSaveWorldAssetId() const
|
ResId CDummyWorld::IGetSaveWorldAssetId() const { return x14_savwId; }
|
||||||
{
|
|
||||||
return x14_savwId;
|
|
||||||
}
|
|
||||||
|
|
||||||
const CMapWorld* CDummyWorld::IGetMapWorld() const
|
const CMapWorld* CDummyWorld::IGetMapWorld() const { return x2c_mapWorld.GetObj(); }
|
||||||
{
|
|
||||||
return x2c_mapWorld.GetObj();
|
|
||||||
}
|
|
||||||
|
|
||||||
CMapWorld* CDummyWorld::IMapWorld()
|
CMapWorld* CDummyWorld::IMapWorld() { return x2c_mapWorld.GetObj(); }
|
||||||
{
|
|
||||||
return x2c_mapWorld.GetObj();
|
|
||||||
}
|
|
||||||
|
|
||||||
const IGameArea* CDummyWorld::IGetAreaAlways(TAreaId id) const
|
const IGameArea* CDummyWorld::IGetAreaAlways(TAreaId id) const { return &x18_areas.at(id); }
|
||||||
{
|
|
||||||
return &x18_areas.at(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
TAreaId CDummyWorld::IGetCurrentAreaId() const
|
TAreaId CDummyWorld::IGetCurrentAreaId() const { return x3c_curAreaId; }
|
||||||
{
|
|
||||||
return x3c_curAreaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
TAreaId CDummyWorld::IGetAreaId(ResId id) const
|
TAreaId CDummyWorld::IGetAreaId(ResId id) const
|
||||||
{
|
{
|
||||||
@ -85,7 +62,7 @@ std::vector<CWorld::CRelay> CWorld::CRelay::ReadMemoryRelays(athena::io::MemoryR
|
|||||||
std::vector<CWorld::CRelay> ret;
|
std::vector<CWorld::CRelay> ret;
|
||||||
u32 count = r.readUint32Big();
|
u32 count = r.readUint32Big();
|
||||||
ret.reserve(count);
|
ret.reserve(count);
|
||||||
for (u32 i=0 ; i<count ; ++i)
|
for (u32 i = 0; i < count; ++i)
|
||||||
ret.emplace_back(r);
|
ret.emplace_back(r);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -96,7 +73,7 @@ CWorldLayers CWorldLayers::ReadWorldLayers(athena::io::MemoryReader& r)
|
|||||||
|
|
||||||
u32 areaCount = r.readUint32Big();
|
u32 areaCount = r.readUint32Big();
|
||||||
ret.m_areas.reserve(areaCount);
|
ret.m_areas.reserve(areaCount);
|
||||||
for (u32 i=0 ; i<areaCount ; ++i)
|
for (u32 i = 0; i < areaCount; ++i)
|
||||||
{
|
{
|
||||||
ret.m_areas.emplace_back();
|
ret.m_areas.emplace_back();
|
||||||
ret.m_areas.back().m_layerCount = r.readUint32Big();
|
ret.m_areas.back().m_layerCount = r.readUint32Big();
|
||||||
@ -105,11 +82,11 @@ CWorldLayers CWorldLayers::ReadWorldLayers(athena::io::MemoryReader& r)
|
|||||||
|
|
||||||
u32 nameCount = r.readUint32Big();
|
u32 nameCount = r.readUint32Big();
|
||||||
ret.m_names.reserve(areaCount);
|
ret.m_names.reserve(areaCount);
|
||||||
for (u32 i=0 ; i<nameCount ; ++i)
|
for (u32 i = 0; i < nameCount; ++i)
|
||||||
ret.m_names.push_back(r.readString());
|
ret.m_names.push_back(r.readString());
|
||||||
|
|
||||||
areaCount = r.readUint32Big();
|
areaCount = r.readUint32Big();
|
||||||
for (u32 i=0 ; i<areaCount ; ++i)
|
for (u32 i = 0; i < areaCount; ++i)
|
||||||
ret.m_areas[i].m_startNameIdx = r.readUint32Big();
|
ret.m_areas[i].m_startNameIdx = r.readUint32Big();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -139,7 +116,7 @@ bool CDummyWorld::ICheckWorldComplete()
|
|||||||
r.readUint32Big();
|
r.readUint32Big();
|
||||||
|
|
||||||
x18_areas.reserve(areaCount);
|
x18_areas.reserve(areaCount);
|
||||||
for (u32 i=0 ; i<areaCount ; ++i)
|
for (u32 i = 0; i < areaCount; ++i)
|
||||||
x18_areas.emplace_back(r, i, version);
|
x18_areas.emplace_back(r, i, version);
|
||||||
|
|
||||||
x28_mapWorldId = r.readUint32Big();
|
x28_mapWorldId = r.readUint32Big();
|
||||||
@ -152,7 +129,7 @@ bool CDummyWorld::ICheckWorldComplete()
|
|||||||
if (version > 10)
|
if (version > 10)
|
||||||
{
|
{
|
||||||
u32 audioGroupCount = r.readUint32Big();
|
u32 audioGroupCount = r.readUint32Big();
|
||||||
for (u32 i=0 ; i<audioGroupCount ; ++i)
|
for (u32 i = 0; i < audioGroupCount; ++i)
|
||||||
{
|
{
|
||||||
r.readUint32Big();
|
r.readUint32Big();
|
||||||
r.readUint32Big();
|
r.readUint32Big();
|
||||||
@ -196,15 +173,9 @@ bool CDummyWorld::ICheckWorldComplete()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CDummyWorld::IGetDefaultAudioTrack() const
|
std::string CDummyWorld::IGetDefaultAudioTrack() const { return {}; }
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
int CDummyWorld::IGetAreaCount() const
|
int CDummyWorld::IGetAreaCount() const { return x18_areas.size(); }
|
||||||
{
|
|
||||||
return x18_areas.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
CWorld::CWorld(IObjectStore& objStore, IFactory& resFactory, ResId mlvlId)
|
CWorld::CWorld(IObjectStore& objStore, IFactory& resFactory, ResId mlvlId)
|
||||||
: x60_objectStore(objStore), x64_resFactory(resFactory)
|
: x60_objectStore(objStore), x64_resFactory(resFactory)
|
||||||
@ -213,50 +184,23 @@ CWorld::CWorld(IObjectStore& objStore, IFactory& resFactory, ResId mlvlId)
|
|||||||
static_cast<ProjectResourceFactoryBase&>(resFactory).LoadResourceAsync(tag, x40_loadBuf);
|
static_cast<ProjectResourceFactoryBase&>(resFactory).LoadResourceAsync(tag, x40_loadBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResId CWorld::IGetWorldAssetId() const
|
ResId CWorld::IGetWorldAssetId() const { return x8_mlvlId; }
|
||||||
{
|
|
||||||
return x8_mlvlId;
|
|
||||||
}
|
|
||||||
|
|
||||||
ResId CWorld::IGetStringTableAssetId() const
|
ResId CWorld::IGetStringTableAssetId() const { return xc_strgId; }
|
||||||
{
|
|
||||||
return xc_strgId;
|
|
||||||
}
|
|
||||||
|
|
||||||
ResId CWorld::IGetSaveWorldAssetId() const
|
ResId CWorld::IGetSaveWorldAssetId() const { return x10_savwId; }
|
||||||
{
|
|
||||||
return x10_savwId;
|
|
||||||
}
|
|
||||||
|
|
||||||
const CMapWorld* CWorld::IGetMapWorld() const
|
const CMapWorld* CWorld::IGetMapWorld() const { return const_cast<CWorld*>(this)->GetMapWorld(); }
|
||||||
{
|
|
||||||
return const_cast<CWorld*>(this)->GetMapWorld();
|
|
||||||
}
|
|
||||||
|
|
||||||
CMapWorld* CWorld::IMapWorld()
|
CMapWorld* CWorld::IMapWorld() { return const_cast<CMapWorld*>(GetMapWorld()); }
|
||||||
{
|
|
||||||
return const_cast<CMapWorld*>(GetMapWorld());
|
|
||||||
}
|
|
||||||
|
|
||||||
const CGameArea* CWorld::GetAreaAlways(TAreaId id) const
|
const CGameArea* CWorld::GetAreaAlways(TAreaId id) const { return x18_areas.at(id).get(); }
|
||||||
{
|
|
||||||
return x18_areas.at(id).get();
|
|
||||||
}
|
|
||||||
|
|
||||||
CGameArea* CWorld::GetArea(TAreaId id)
|
CGameArea* CWorld::GetArea(TAreaId id) { return const_cast<CGameArea*>(GetAreaAlways(id)); }
|
||||||
{
|
|
||||||
return const_cast<CGameArea*>(GetAreaAlways(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
const IGameArea* CWorld::IGetAreaAlways(TAreaId id) const
|
const IGameArea* CWorld::IGetAreaAlways(TAreaId id) const { return GetAreaAlways(id); }
|
||||||
{
|
|
||||||
return GetAreaAlways(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
TAreaId CWorld::IGetCurrentAreaId() const
|
TAreaId CWorld::IGetCurrentAreaId() const { return x68_curAreaId; }
|
||||||
{
|
|
||||||
return x68_curAreaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
TAreaId CWorld::IGetAreaId(ResId id) const
|
TAreaId CWorld::IGetAreaId(ResId id) const
|
||||||
{
|
{
|
||||||
@ -285,13 +229,9 @@ void CWorld::MoveToChain(CGameArea* area, EChain chain)
|
|||||||
x4c_chainHeads[int(chain)] = area;
|
x4c_chainHeads[int(chain)] = area;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorld::LoadSoundGroup(int groupId, ResId agscId, CSoundGroupData& data)
|
void CWorld::LoadSoundGroup(int groupId, ResId agscId, CSoundGroupData& data) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWorld::LoadSoundGroups()
|
void CWorld::LoadSoundGroups() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CWorld::CheckWorldComplete(CStateManager* mgr, TAreaId id, ResId mreaId)
|
bool CWorld::CheckWorldComplete(CStateManager* mgr, TAreaId id, ResId mreaId)
|
||||||
{
|
{
|
||||||
@ -338,12 +278,12 @@ bool CWorld::CheckWorldComplete(CStateManager* mgr, TAreaId id, ResId mreaId)
|
|||||||
r.readUint32Big();
|
r.readUint32Big();
|
||||||
|
|
||||||
x18_areas.reserve(areaCount);
|
x18_areas.reserve(areaCount);
|
||||||
for (u32 i=0 ; i<areaCount ; ++i)
|
for (u32 i = 0; i < areaCount; ++i)
|
||||||
x18_areas.push_back(std::make_unique<CGameArea>(r, i, version));
|
x18_areas.push_back(std::make_unique<CGameArea>(r, i, version));
|
||||||
|
|
||||||
if (x48_chainCount < 5)
|
if (x48_chainCount < 5)
|
||||||
{
|
{
|
||||||
for (int i=x48_chainCount ; i<5 ; ++i)
|
for (int i = x48_chainCount; i < 5; ++i)
|
||||||
x4c_chainHeads[i] = nullptr;
|
x4c_chainHeads[i] = nullptr;
|
||||||
x48_chainCount = 5;
|
x48_chainCount = 5;
|
||||||
}
|
}
|
||||||
@ -365,7 +305,7 @@ bool CWorld::CheckWorldComplete(CStateManager* mgr, TAreaId id, ResId mreaId)
|
|||||||
{
|
{
|
||||||
u32 audioGroupCount = r.readUint32Big();
|
u32 audioGroupCount = r.readUint32Big();
|
||||||
x74_soundGroupData.reserve(audioGroupCount);
|
x74_soundGroupData.reserve(audioGroupCount);
|
||||||
for (u32 i=0 ; i<audioGroupCount ; ++i)
|
for (u32 i = 0; i < audioGroupCount; ++i)
|
||||||
{
|
{
|
||||||
int grpId = r.readUint32Big();
|
int grpId = r.readUint32Big();
|
||||||
ResId agscId = r.readUint32Big();
|
ResId agscId = r.readUint32Big();
|
||||||
@ -523,7 +463,7 @@ void CWorld::TravelToArea(TAreaId aid, CStateManager& mgr, bool skipLoadOther)
|
|||||||
for (CGameArea::Dock& dock : area->xcc_docks)
|
for (CGameArea::Dock& dock : area->xcc_docks)
|
||||||
{
|
{
|
||||||
u32 dockRefCount = dock.GetDockRefs().size();
|
u32 dockRefCount = dock.GetDockRefs().size();
|
||||||
for (u32 i=0 ; i<dockRefCount ; ++i)
|
for (u32 i = 0; i < dockRefCount; ++i)
|
||||||
{
|
{
|
||||||
if (!dock.ShouldLoadOtherArea(i))
|
if (!dock.ShouldLoadOtherArea(i))
|
||||||
continue;
|
continue;
|
||||||
@ -541,7 +481,6 @@ void CWorld::TravelToArea(TAreaId aid, CStateManager& mgr, bool skipLoadOther)
|
|||||||
else
|
else
|
||||||
ScheduleAreaToLoad(cArea, mgr);
|
ScheduleAreaToLoad(cArea, mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,24 +506,53 @@ void CWorld::TravelToArea(TAreaId aid, CStateManager& mgr, bool skipLoadOther)
|
|||||||
GetMapWorld()->SetWhichMapAreasLoaded(*this, aid, 3);
|
GetMapWorld()->SetWhichMapAreasLoaded(*this, aid, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWorld::ICheckWorldComplete()
|
bool CWorld::ICheckWorldComplete() { return CheckWorldComplete(nullptr, kInvalidAreaId, -1); }
|
||||||
{
|
|
||||||
return CheckWorldComplete(nullptr, kInvalidAreaId, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CWorld::IGetDefaultAudioTrack() const
|
std::string CWorld::IGetDefaultAudioTrack() const { return x84_defAudioTrack; }
|
||||||
{
|
|
||||||
return x84_defAudioTrack;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CWorld::IGetAreaCount() const
|
int CWorld::IGetAreaCount() const { return x18_areas.size(); }
|
||||||
{
|
|
||||||
return x18_areas.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CWorld::DoesAreaExist(TAreaId area) const
|
bool CWorld::DoesAreaExist(TAreaId area) const { return (area >= 0 && area < x18_areas.size()); }
|
||||||
{
|
|
||||||
return (area >= 0 && area < x18_areas.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
void CWorld::PropogateAreaChain(CGameArea::EOcclusionState occlusionState, CGameArea* area, CWorld* world)
|
||||||
|
{
|
||||||
|
if (!area->GetPostConstructed() || occlusionState == area->GetOcclusionState())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (occlusionState == CGameArea::EOcclusionState::Occluded)
|
||||||
|
area->SetOcclusionState(CGameArea::EOcclusionState::Occluded);
|
||||||
|
|
||||||
|
CGameArea* areaItr = world->x4c_chainHeads[3];
|
||||||
|
|
||||||
|
while (areaItr != skGlobalNonConstEnd)
|
||||||
|
{
|
||||||
|
if (areaItr == area)
|
||||||
|
{
|
||||||
|
areaItr = areaItr->x130_next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (areaItr->IsPostConstructed() && areaItr->GetOcclusionState() == CGameArea::EOcclusionState::Occluded)
|
||||||
|
areaItr->PrepTokens();
|
||||||
|
areaItr = areaItr->x130_next;
|
||||||
|
}
|
||||||
|
|
||||||
|
areaItr = world->x4c_chainHeads[3];
|
||||||
|
|
||||||
|
while (areaItr != skGlobalNonConstEnd)
|
||||||
|
{
|
||||||
|
if (areaItr == area)
|
||||||
|
{
|
||||||
|
areaItr = areaItr->x130_next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (area->IsPostConstructed() && areaItr->GetOcclusionState() == CGameArea::EOcclusionState::NotOccluded)
|
||||||
|
areaItr->PrepTokens();
|
||||||
|
areaItr = areaItr->x130_next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (occlusionState == CGameArea::EOcclusionState::NotOccluded)
|
||||||
|
area->SetOcclusionState(CGameArea::EOcclusionState::NotOccluded);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static constexpr CGameArea* skGlobalEnd = nullptr;
|
||||||
|
static constexpr CGameArea* skGlobalNonConstEnd = nullptr;
|
||||||
enum class Phase
|
enum class Phase
|
||||||
{
|
{
|
||||||
Loading,
|
Loading,
|
||||||
@ -177,6 +178,10 @@ public:
|
|||||||
bool ICheckWorldComplete();
|
bool ICheckWorldComplete();
|
||||||
std::string IGetDefaultAudioTrack() const;
|
std::string IGetDefaultAudioTrack() const;
|
||||||
int IGetAreaCount() const;
|
int IGetAreaCount() const;
|
||||||
|
|
||||||
|
static void PropogateAreaChain(CGameArea::EOcclusionState, CGameArea*, CWorld*);
|
||||||
|
static const CGameArea* GetAliveAreasEnd() { return skGlobalEnd; }
|
||||||
|
static CGameArea* AliveAreasEnd() { return skGlobalNonConstEnd; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CWorldLayers
|
struct CWorldLayers
|
||||||
|
@ -827,14 +827,14 @@ CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, int
|
|||||||
for (int i = 0; i < propCount - 6; ++i)
|
for (int i = 0; i < propCount - 6; ++i)
|
||||||
itemCounts.push_back(in.readUint32Big());
|
itemCounts.push_back(in.readUint32Big());
|
||||||
|
|
||||||
bool b1 = in.readBool();
|
bool defaultSpawn = in.readBool();
|
||||||
bool b2 = in.readBool();
|
bool active = in.readBool();
|
||||||
bool b3 = false;
|
bool morphed = false;
|
||||||
if (propCount > 34)
|
if (propCount > 34)
|
||||||
b3 = in.readBool();
|
morphed = in.readBool();
|
||||||
|
|
||||||
return new CScriptSpawnPoint(mgr.AllocateUniqueId(), *name, info,
|
return new CScriptSpawnPoint(mgr.AllocateUniqueId(), *name, info,
|
||||||
ConvertEditorEulerToTransform4f(rotation, position), itemCounts, b1, b2, b3);
|
ConvertEditorEulerToTransform4f(rotation, position), itemCounts, defaultSpawn, active, morphed);
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntity* ScriptLoader::LoadCameraHint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
CEntity* ScriptLoader::LoadCameraHint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||||
|
@ -18,10 +18,30 @@ template <class T, size_t N>
|
|||||||
class reserved_vector : public std::vector<T>
|
class reserved_vector : public std::vector<T>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
reserved_vector() {this->reserve(N);}
|
reserved_vector() { this->reserve(N); }
|
||||||
reserved_vector(size_t n, const T& val) : std::vector<T>(n, val) { }
|
reserved_vector(size_t n, const T& val) : std::vector<T>(n, val) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T, size_t N>
|
||||||
|
class prereserved_vector
|
||||||
|
{
|
||||||
|
size_t x0_size = 1;
|
||||||
|
T x4_data[N];
|
||||||
|
|
||||||
|
public:
|
||||||
|
void set_size(size_t n)
|
||||||
|
{
|
||||||
|
if (n <= N)
|
||||||
|
x0_size = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_data(const T* data) { memmove(x4_data, data, sizeof(T) * x0_size); }
|
||||||
|
|
||||||
|
size_t size() const { return x0_size; }
|
||||||
|
|
||||||
|
T& back() const { x4_data[(x0_size == 0) ? 0 : x0_size - 1]; }
|
||||||
|
T& front() const { return x4_data[0]; }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __RSTL_HPP__
|
#endif // __RSTL_HPP__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user