mirror of https://github.com/AxioDL/metaforce.git
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 */
|
||||
u32 availSz = std::max(0, s32(fr.length()) - s32(x14_resOffset));
|
||||
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,
|
||||
x10_loadBuffer.get(),
|
||||
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:
|
||||
CMapWorldInfo()=default;
|
||||
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;
|
||||
void SetIsMapped(bool) const;
|
||||
void SetDoorVisited(TEditorId eid, bool val);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "CSimplePool.hpp"
|
||||
#include "CSaveWorld.hpp"
|
||||
#include "CGameHintInfo.hpp"
|
||||
//#include "Audio/CStreamedAudioManager.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -118,19 +119,39 @@ CGameOptions::CGameOptions(CBitStreamReader& stream)
|
|||
x44_soundMode = ESoundMode(stream.ReadEncoded(2));
|
||||
x48_ = stream.ReadEncoded(4);
|
||||
|
||||
x4c_ = stream.ReadEncoded(6);
|
||||
x50_ = stream.ReadEncoded(6);
|
||||
x54_ = stream.ReadEncoded(5);
|
||||
x58_ = stream.ReadEncoded(7);
|
||||
x4c_screenXOffset = stream.ReadEncoded(6);
|
||||
x50_screenYOffset = stream.ReadEncoded(6);
|
||||
x54_screenStretch = stream.ReadEncoded(5);
|
||||
x58_sfxVol = stream.ReadEncoded(7);
|
||||
x5c_musicVol = stream.ReadEncoded(7);
|
||||
x60_ = stream.ReadEncoded(8);
|
||||
x64_ = stream.ReadEncoded(8);
|
||||
x60_helmetAlpha = stream.ReadEncoded(8);
|
||||
x64_hudAlpha = stream.ReadEncoded(8);
|
||||
|
||||
x68_24_ = stream.ReadEncoded(1);
|
||||
x68_28_ = stream.ReadEncoded(1);
|
||||
x68_25_ = stream.ReadEncoded(1);
|
||||
x68_26_ = stream.ReadEncoded(1);
|
||||
x68_27_ = stream.ReadEncoded(1);
|
||||
x68_24_hudLag = stream.ReadEncoded(1);
|
||||
x68_28_hintSystem = stream.ReadEncoded(1);
|
||||
x68_25_invertY = stream.ReadEncoded(1);
|
||||
x68_26_rumble = 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
|
||||
|
@ -141,33 +162,199 @@ void CGameOptions::PutTo(CBitStreamWriter& writer) const
|
|||
writer.WriteEncoded(u32(x44_soundMode), 2);
|
||||
writer.WriteEncoded(x48_, 4);
|
||||
|
||||
writer.WriteEncoded(x4c_, 6);
|
||||
writer.WriteEncoded(x50_, 6);
|
||||
writer.WriteEncoded(x54_, 5);
|
||||
writer.WriteEncoded(x58_, 7);
|
||||
writer.WriteEncoded(x4c_screenXOffset, 6);
|
||||
writer.WriteEncoded(x50_screenYOffset, 6);
|
||||
writer.WriteEncoded(x54_screenStretch, 5);
|
||||
writer.WriteEncoded(x58_sfxVol, 7);
|
||||
writer.WriteEncoded(x5c_musicVol, 7);
|
||||
writer.WriteEncoded(x60_, 8);
|
||||
writer.WriteEncoded(x64_, 8);
|
||||
writer.WriteEncoded(x60_helmetAlpha, 8);
|
||||
writer.WriteEncoded(x64_hudAlpha, 8);
|
||||
|
||||
writer.WriteEncoded(x68_24_, 1);
|
||||
writer.WriteEncoded(x68_28_, 1);
|
||||
writer.WriteEncoded(x68_25_, 1);
|
||||
writer.WriteEncoded(x68_26_, 1);
|
||||
writer.WriteEncoded(x68_27_, 1);
|
||||
writer.WriteEncoded(x68_24_hudLag, 1);
|
||||
writer.WriteEncoded(x68_28_hintSystem, 1);
|
||||
writer.WriteEncoded(x68_25_invertY, 1);
|
||||
writer.WriteEncoded(x68_26_rumble, 1);
|
||||
writer.WriteEncoded(x68_27_swapBeamsControls, 1);
|
||||
}
|
||||
|
||||
CGameOptions::CGameOptions()
|
||||
{
|
||||
x68_24_ = true;
|
||||
x68_26_ = true;
|
||||
x68_28_ = true;
|
||||
x68_24_hudLag = true;
|
||||
x68_26_rumble = true;
|
||||
x68_28_hintSystem = true;
|
||||
InitSoundMode();
|
||||
}
|
||||
|
||||
float CGameOptions::sub8020F054()
|
||||
{
|
||||
return (0.375f * 1.f) + (float(x48_) * 0.25f);
|
||||
}
|
||||
|
||||
void CGameOptions::InitSoundMode()
|
||||
{
|
||||
/* 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)
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define __URDE_CGAMEOPTIONS_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
#include "Audio/CAudioSys.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -73,23 +74,23 @@ private:
|
|||
bool x0_[64] = {};
|
||||
ESoundMode x44_soundMode = ESoundMode::Stereo;
|
||||
u32 x48_ = 4;
|
||||
u32 x4c_ = 0;
|
||||
u32 x50_ = 0;
|
||||
u32 x54_ = 0;
|
||||
u32 x58_ = 0x7f;
|
||||
s32 x4c_screenXOffset = 0;
|
||||
s32 x50_screenYOffset = 0;
|
||||
s32 x54_screenStretch = 0;
|
||||
u32 x58_sfxVol = 0x7f;
|
||||
u32 x5c_musicVol = 0x7f;
|
||||
u32 x60_ = 0xff;
|
||||
u32 x64_ = 0xff;
|
||||
u32 x60_helmetAlpha = 0xff;
|
||||
u32 x64_hudAlpha = 0xff;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x68_24_ : 1;
|
||||
bool x68_25_ : 1;
|
||||
bool x68_26_ : 1;
|
||||
bool x68_27_ : 1;
|
||||
bool x68_28_ : 1;
|
||||
bool x68_24_hudLag : 1;
|
||||
bool x68_25_invertY : 1;
|
||||
bool x68_26_rumble : 1;
|
||||
bool x68_27_swapBeamsControls : 1;
|
||||
bool x68_28_hintSystem : 1;
|
||||
};
|
||||
u16 _dummy = 0;
|
||||
};
|
||||
|
@ -101,9 +102,35 @@ private:
|
|||
public:
|
||||
CGameOptions();
|
||||
CGameOptions(CBitStreamReader& stream);
|
||||
void ResetToDefaults();
|
||||
void InitSoundMode();
|
||||
void EnsureSettings();
|
||||
void PutTo(CBitStreamWriter& writer) const;
|
||||
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
|
||||
|
|
|
@ -84,7 +84,7 @@ void CWorldState::PutTo(CBitStreamWriter& writer, const CSaveWorld& savw) const
|
|||
writer.WriteEncoded(x4_areaId, 32);
|
||||
writer.WriteEncoded(x10_, 32);
|
||||
x8_relayTracker->PutTo(writer, savw);
|
||||
xc_mapWorldInfo->PutTo(writer, savw);
|
||||
xc_mapWorldInfo->PutTo(writer, savw, x0_mlvlId);
|
||||
x14_layerState->PutTo(writer);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,14 +20,12 @@ class CWorldLayerState
|
|||
friend class CSaveWorldIntermediate;
|
||||
std::vector<CWorldLayers::Area> x0_areaLayers;
|
||||
DataSpec::WordBitmap x10_saveLayers;
|
||||
|
||||
public:
|
||||
CWorldLayerState() = default;
|
||||
CWorldLayerState(CBitStreamReader& reader, const CSaveWorld& saveWorld);
|
||||
|
||||
bool IsLayerActive(int areaIdx, int layerIdx) const
|
||||
{
|
||||
return (x0_areaLayers[areaIdx].m_layerBits >> layerIdx) & 1;
|
||||
}
|
||||
bool IsLayerActive(int areaIdx, int layerIdx) const { return (x0_areaLayers[areaIdx].m_layerBits >> layerIdx) & 1; }
|
||||
|
||||
void SetLayerActive(int areaIdx, int layerIdx, bool active)
|
||||
{
|
||||
|
@ -39,10 +37,7 @@ public:
|
|||
|
||||
void InitializeWorldLayers(const std::vector<CWorldLayers::Area>& layers);
|
||||
|
||||
u32 GetAreaLayerCount(int areaIdx) const
|
||||
{
|
||||
return x0_areaLayers[areaIdx].m_layerCount;
|
||||
}
|
||||
u32 GetAreaLayerCount(int areaIdx) const { return x0_areaLayers[areaIdx].m_layerCount; }
|
||||
|
||||
void PutTo(CBitStreamWriter& writer) const;
|
||||
};
|
||||
|
@ -55,6 +50,7 @@ class CWorldState
|
|||
std::shared_ptr<CMapWorldInfo> xc_mapWorldInfo;
|
||||
u32 x10_;
|
||||
std::shared_ptr<CWorldLayerState> x14_layerState;
|
||||
|
||||
public:
|
||||
CWorldState(ResId id);
|
||||
CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorld& saveWorld);
|
||||
|
@ -137,7 +133,6 @@ public:
|
|||
};
|
||||
static GameFileStateInfo LoadGameFileState(const u8* data);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CGAMESTATE_HPP__
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
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)
|
||||
: x0_include(include),
|
||||
|
@ -13,17 +13,17 @@ CMaterialFilter::CMaterialFilter(const CMaterialList& include, const CMaterialLi
|
|||
|
||||
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)
|
||||
{
|
||||
return CMaterialFilter({u64(0x00000000FFFFFFFF)}, exclude, EFilterType::Two);
|
||||
return CMaterialFilter({u64(0x00000000FFFFFFFF)}, exclude, EFilterType::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:
|
||||
enum class EFilterType
|
||||
{
|
||||
Zero,
|
||||
Include,
|
||||
One,
|
||||
Two,
|
||||
Three
|
||||
Exclude,
|
||||
IncludeExclude
|
||||
};
|
||||
private:
|
||||
CMaterialList x0_include;
|
||||
CMaterialList x8_exclude;
|
||||
EFilterType x10_type = EFilterType::Three;
|
||||
EFilterType x10_type = EFilterType::IncludeExclude;
|
||||
public:
|
||||
static const CMaterialFilter skPassEverything;
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ class CStringTable* g_MainStringTable = nullptr;
|
|||
DataSpec::ITweakGame* g_tweakGame = nullptr;
|
||||
DataSpec::ITweakPlayer* g_tweakPlayer = nullptr;
|
||||
DataSpec::ITweakPlayerControl* g_tweakPlayerControl = nullptr;
|
||||
DataSpec::ITweakPlayerControl* g_tweakPlayerControlAlt = nullptr;
|
||||
DataSpec::ITweakPlayerControl* g_currentPlayerControl = nullptr;
|
||||
DataSpec::ITweakPlayerGun* g_tweakPlayerGun = nullptr;
|
||||
DataSpec::ITweakGunRes* g_tweakGunRes = nullptr;
|
||||
DataSpec::ITweakPlayerRes* g_tweakPlayerRes = nullptr;
|
||||
|
|
|
@ -32,6 +32,8 @@ extern class CStringTable* g_MainStringTable;
|
|||
extern DataSpec::ITweakGame* g_tweakGame;
|
||||
extern DataSpec::ITweakPlayer* g_tweakPlayer;
|
||||
extern DataSpec::ITweakPlayerControl* g_tweakPlayerControl;
|
||||
extern DataSpec::ITweakPlayerControl* g_tweakPlayerControlAlt;
|
||||
extern DataSpec::ITweakPlayerControl* g_currentPlayerControl;
|
||||
extern DataSpec::ITweakPlayerGun* g_tweakPlayerGun;
|
||||
extern DataSpec::ITweakGunRes* g_tweakGunRes;
|
||||
extern DataSpec::ITweakPlayerRes* g_tweakPlayerRes;
|
||||
|
|
|
@ -206,7 +206,7 @@ bool ControlMapper::GetPressInput(ECommands cmd, const CFinalInput& input)
|
|||
{
|
||||
if (!skCommandFilterFlag[int(cmd)])
|
||||
return false;
|
||||
EFunctionList func = EFunctionList(g_tweakPlayerControl->GetMapping(atUint32(cmd)));
|
||||
EFunctionList func = EFunctionList(g_currentPlayerControl->GetMapping(atUint32(cmd)));
|
||||
if (func > EFunctionList::MAX)
|
||||
return false;
|
||||
BoolReturnFn fn = skPressFuncs[int(func)];
|
||||
|
@ -219,7 +219,7 @@ bool ControlMapper::GetDigitalInput(ECommands cmd, const CFinalInput& input)
|
|||
{
|
||||
if (!skCommandFilterFlag[int(cmd)])
|
||||
return false;
|
||||
EFunctionList func = EFunctionList(g_tweakPlayerControl->GetMapping(atUint32(cmd)));
|
||||
EFunctionList func = EFunctionList(g_currentPlayerControl->GetMapping(atUint32(cmd)));
|
||||
if (func > EFunctionList::MAX)
|
||||
return false;
|
||||
BoolReturnFn fn = skDigitalFuncs[int(func)];
|
||||
|
@ -232,7 +232,7 @@ float ControlMapper::GetAnalogInput(ECommands cmd, const CFinalInput& input)
|
|||
{
|
||||
if (!skCommandFilterFlag[int(cmd)])
|
||||
return 0.0;
|
||||
EFunctionList func = EFunctionList(g_tweakPlayerControl->GetMapping(atUint32(cmd)));
|
||||
EFunctionList func = EFunctionList(g_currentPlayerControl->GetMapping(atUint32(cmd)));
|
||||
if (func > EFunctionList::MAX)
|
||||
return 0.0;
|
||||
FloatReturnFn fn = skAnalogFuncs[int(func)];
|
||||
|
|
|
@ -8,10 +8,9 @@ CGameProjectile::CGameProjectile(bool active, const TToken<CWeaponDescription>&,
|
|||
u32 w1, bool b2, const zeus::CVector3f&,
|
||||
const rstl::optional_object<TLockedToken<CGenDescription>>&, s16, bool b3)
|
||||
: CWeapon(owner, aid, uid, active, wType, name, xf,
|
||||
CMaterialFilter(CMaterialList(EMaterialTypes::NonSolidDamageable, matType),
|
||||
CMaterialList(EMaterialTypes::Projectile, EMaterialTypes::ProjectilePassthrough, matType,
|
||||
EMaterialTypes::Solid),
|
||||
CMaterialFilter::EFilterType::Three),
|
||||
CMaterialFilter::MakeIncludeExclude(
|
||||
{EMaterialTypes::NonSolidDamageable, matType},
|
||||
{EMaterialTypes::Projectile, EMaterialTypes::ProjectilePassthrough, matType, EMaterialTypes::Solid}),
|
||||
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)
|
||||
: CEntity(uid, info, active, name)
|
||||
, x68_material(MakeActorMaterialList(list, params))
|
||||
, x70_materialFilter(CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::Unknown}))
|
||||
, x70_materialFilter(CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {0ull}))
|
||||
, xc6_(otherUid)
|
||||
{
|
||||
if (mData.x10_animData || mData.x1c_normalModel)
|
||||
|
|
|
@ -654,6 +654,11 @@ void CGameArea::ReloadAllUnloadedTextures()
|
|||
{
|
||||
}
|
||||
|
||||
void CGameArea::PrepTokens()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
u32 CGameArea::GetNumPartSizes() const
|
||||
{
|
||||
return hecl::SBig(*reinterpret_cast<u32*>(x110_mreaSecBufs[0].first.get() + 60));
|
||||
|
|
|
@ -274,6 +274,7 @@ public:
|
|||
void PreRender();
|
||||
void AliveUpdate(float dt);
|
||||
void SetOcclusionState(EOcclusionState state);
|
||||
EOcclusionState GetOcclusionState() const { return GetPostConstructed()->x10dc_occlusionState; }
|
||||
void RemoveStaticGeometry();
|
||||
void AddStaticGeometry();
|
||||
//void TransferTokensToARAM();
|
||||
|
@ -283,6 +284,7 @@ public:
|
|||
//void UnloadAllLoadedTextures();
|
||||
//void ReloadAllLoadedTextures();
|
||||
void ReloadAllUnloadedTextures();
|
||||
void PrepTokens();
|
||||
u32 GetNumPartSizes() const;
|
||||
void AllocNewAreaData(int, int);
|
||||
bool Invalidate(CStateManager& mgr);
|
||||
|
|
|
@ -359,4 +359,6 @@ void CPlayer::CVisorSteam::Update(float dt)
|
|||
|
||||
x24_ = 0.1f;
|
||||
}
|
||||
|
||||
void CPlayer::SetSpawnedMorphBallState(CPlayer::EPlayerMorphBallState, CStateManager&) {}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,14 @@ public:
|
|||
{
|
||||
};
|
||||
|
||||
enum class EPlayerMorphBallState
|
||||
{
|
||||
Unmorphed,
|
||||
Morphed,
|
||||
Morphing,
|
||||
UnMorphing
|
||||
};
|
||||
|
||||
private:
|
||||
struct CVisorSteam
|
||||
{
|
||||
|
@ -210,6 +218,7 @@ public:
|
|||
void UpdateScanningState(const CFinalInput& input, CStateManager& mgr, float);
|
||||
void ValidateScanning(const CFinalInput& input, CStateManager& mgr);
|
||||
void SetScanningState(EPlayerScanState, CStateManager& mgr);
|
||||
void SetSpawnedMorphBallState(EPlayerMorphBallState, CStateManager&);
|
||||
bool GetExplorationMode() const;
|
||||
bool GetCombatMode() 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 include = GetMaterialFilter().GetIncludeList();
|
||||
include.Add(EMaterialTypes::AIBlock);
|
||||
SetMaterialFilter({include, exclude, CMaterialFilter::EFilterType::Three});
|
||||
SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(include, exclude));
|
||||
}
|
||||
break;
|
||||
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()))
|
||||
return;
|
||||
#if 0
|
||||
/* Propogate through area chain */
|
||||
sub800C40DC((msg == EScriptObjectMessage::Increment), mgr.GetWorld()->GetAreaAlways(aid), mgr.WorldNC());
|
||||
#endif
|
||||
CWorld::PropogateAreaChain(CGameArea::EOcclusionState(msg == EScriptObjectMessage::Increment),
|
||||
mgr.WorldNC()->GetArea(aid), mgr.WorldNC());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1,15 +1,69 @@
|
|||
#include "CScriptSpawnPoint.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
#include "CWorld.hpp"
|
||||
#include "CPlayer.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CScriptSpawnPoint::CScriptSpawnPoint(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, const std::vector<u32>& itemCounts,
|
||||
bool defaultSpawn, bool active, bool b3)
|
||||
const zeus::CTransform& xf, const std::vector<u32>& itemCounts, bool defaultSpawn,
|
||||
bool active, bool morphed)
|
||||
: CEntity(uid, info, active, name), x34_xf(xf), x64_itemCounts(itemCounts)
|
||||
{
|
||||
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
|
||||
|
@ -19,5 +73,4 @@ u32 CScriptSpawnPoint::GetPowerup(CPlayerState::EItemType item) const
|
|||
return x64_itemCounts.front();
|
||||
return x64_itemCounts[idx];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class CScriptSpawnPoint : public CEntity
|
|||
struct
|
||||
{
|
||||
bool x10c_24_firstSpawn : 1;
|
||||
bool x10c_25_ : 1;
|
||||
bool x10c_25_morphed : 1;
|
||||
};
|
||||
u8 _dummy = 0;
|
||||
};
|
||||
|
@ -26,6 +26,7 @@ public:
|
|||
const zeus::CTransform& xf, const std::vector<u32>& itemCounts,
|
||||
bool, bool, bool);
|
||||
|
||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr);
|
||||
bool FirstSpawn() const { return x10c_24_firstSpawn; }
|
||||
const zeus::CTransform& GetTransform() const { return x34_xf; }
|
||||
u32 GetPowerup(CPlayerState::EItemType item) const;
|
||||
|
|
|
@ -10,53 +10,30 @@
|
|||
namespace urde
|
||||
{
|
||||
|
||||
CWorld::CSoundGroupData::CSoundGroupData(int grpId, ResId agsc)
|
||||
: x0_groupId(grpId), x4_agscId(agsc)
|
||||
CWorld::CSoundGroupData::CSoundGroupData(int grpId, ResId agsc) : x0_groupId(grpId), x4_agscId(agsc)
|
||||
{
|
||||
x1c_groupData = g_SimplePool->GetObj(SObjectTag{FOURCC('AGSC'), agsc});
|
||||
}
|
||||
|
||||
CDummyWorld::CDummyWorld(ResId mlvlId, bool loadMap)
|
||||
: x4_loadMap(loadMap), xc_mlvlId(mlvlId)
|
||||
CDummyWorld::CDummyWorld(ResId mlvlId, bool loadMap) : x4_loadMap(loadMap), xc_mlvlId(mlvlId)
|
||||
{
|
||||
SObjectTag tag{FOURCC('MLVL'), mlvlId};
|
||||
static_cast<ProjectResourceFactoryBase*>(g_ResFactory)->LoadResourceAsync(tag, x34_loadBuf);
|
||||
}
|
||||
|
||||
ResId CDummyWorld::IGetWorldAssetId() const
|
||||
{
|
||||
return xc_mlvlId;
|
||||
}
|
||||
ResId CDummyWorld::IGetWorldAssetId() const { return xc_mlvlId; }
|
||||
|
||||
ResId CDummyWorld::IGetStringTableAssetId() const
|
||||
{
|
||||
return x10_strgId;
|
||||
}
|
||||
ResId CDummyWorld::IGetStringTableAssetId() const { return x10_strgId; }
|
||||
|
||||
ResId CDummyWorld::IGetSaveWorldAssetId() const
|
||||
{
|
||||
return x14_savwId;
|
||||
}
|
||||
ResId CDummyWorld::IGetSaveWorldAssetId() const { return x14_savwId; }
|
||||
|
||||
const CMapWorld* CDummyWorld::IGetMapWorld() const
|
||||
{
|
||||
return x2c_mapWorld.GetObj();
|
||||
}
|
||||
const CMapWorld* CDummyWorld::IGetMapWorld() const { return x2c_mapWorld.GetObj(); }
|
||||
|
||||
CMapWorld* CDummyWorld::IMapWorld()
|
||||
{
|
||||
return x2c_mapWorld.GetObj();
|
||||
}
|
||||
CMapWorld* CDummyWorld::IMapWorld() { return x2c_mapWorld.GetObj(); }
|
||||
|
||||
const IGameArea* CDummyWorld::IGetAreaAlways(TAreaId id) const
|
||||
{
|
||||
return &x18_areas.at(id);
|
||||
}
|
||||
const IGameArea* CDummyWorld::IGetAreaAlways(TAreaId id) const { return &x18_areas.at(id); }
|
||||
|
||||
TAreaId CDummyWorld::IGetCurrentAreaId() const
|
||||
{
|
||||
return x3c_curAreaId;
|
||||
}
|
||||
TAreaId CDummyWorld::IGetCurrentAreaId() const { return x3c_curAreaId; }
|
||||
|
||||
TAreaId CDummyWorld::IGetAreaId(ResId id) const
|
||||
{
|
||||
|
@ -196,15 +173,9 @@ bool CDummyWorld::ICheckWorldComplete()
|
|||
return false;
|
||||
}
|
||||
|
||||
std::string CDummyWorld::IGetDefaultAudioTrack() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
std::string CDummyWorld::IGetDefaultAudioTrack() const { return {}; }
|
||||
|
||||
int CDummyWorld::IGetAreaCount() const
|
||||
{
|
||||
return x18_areas.size();
|
||||
}
|
||||
int CDummyWorld::IGetAreaCount() const { return x18_areas.size(); }
|
||||
|
||||
CWorld::CWorld(IObjectStore& objStore, IFactory& resFactory, ResId mlvlId)
|
||||
: 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);
|
||||
}
|
||||
|
||||
ResId CWorld::IGetWorldAssetId() const
|
||||
{
|
||||
return x8_mlvlId;
|
||||
}
|
||||
ResId CWorld::IGetWorldAssetId() const { return x8_mlvlId; }
|
||||
|
||||
ResId CWorld::IGetStringTableAssetId() const
|
||||
{
|
||||
return xc_strgId;
|
||||
}
|
||||
ResId CWorld::IGetStringTableAssetId() const { return xc_strgId; }
|
||||
|
||||
ResId CWorld::IGetSaveWorldAssetId() const
|
||||
{
|
||||
return x10_savwId;
|
||||
}
|
||||
ResId CWorld::IGetSaveWorldAssetId() const { return x10_savwId; }
|
||||
|
||||
const CMapWorld* CWorld::IGetMapWorld() const
|
||||
{
|
||||
return const_cast<CWorld*>(this)->GetMapWorld();
|
||||
}
|
||||
const CMapWorld* CWorld::IGetMapWorld() const { return const_cast<CWorld*>(this)->GetMapWorld(); }
|
||||
|
||||
CMapWorld* CWorld::IMapWorld()
|
||||
{
|
||||
return const_cast<CMapWorld*>(GetMapWorld());
|
||||
}
|
||||
CMapWorld* CWorld::IMapWorld() { return const_cast<CMapWorld*>(GetMapWorld()); }
|
||||
|
||||
const CGameArea* CWorld::GetAreaAlways(TAreaId id) const
|
||||
{
|
||||
return x18_areas.at(id).get();
|
||||
}
|
||||
const CGameArea* CWorld::GetAreaAlways(TAreaId id) const { return x18_areas.at(id).get(); }
|
||||
|
||||
CGameArea* CWorld::GetArea(TAreaId id)
|
||||
{
|
||||
return const_cast<CGameArea*>(GetAreaAlways(id));
|
||||
}
|
||||
CGameArea* CWorld::GetArea(TAreaId id) { return const_cast<CGameArea*>(GetAreaAlways(id)); }
|
||||
|
||||
const IGameArea* CWorld::IGetAreaAlways(TAreaId id) const
|
||||
{
|
||||
return GetAreaAlways(id);
|
||||
}
|
||||
const IGameArea* CWorld::IGetAreaAlways(TAreaId id) const { return GetAreaAlways(id); }
|
||||
|
||||
TAreaId CWorld::IGetCurrentAreaId() const
|
||||
{
|
||||
return x68_curAreaId;
|
||||
}
|
||||
TAreaId CWorld::IGetCurrentAreaId() const { return x68_curAreaId; }
|
||||
|
||||
TAreaId CWorld::IGetAreaId(ResId id) const
|
||||
{
|
||||
|
@ -285,13 +229,9 @@ void CWorld::MoveToChain(CGameArea* area, EChain chain)
|
|||
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)
|
||||
{
|
||||
|
@ -541,7 +481,6 @@ void CWorld::TravelToArea(TAreaId aid, CStateManager& mgr, bool skipLoadOther)
|
|||
else
|
||||
ScheduleAreaToLoad(cArea, mgr);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -567,24 +506,53 @@ void CWorld::TravelToArea(TAreaId aid, CStateManager& mgr, bool skipLoadOther)
|
|||
GetMapWorld()->SetWhichMapAreasLoaded(*this, aid, 3);
|
||||
}
|
||||
|
||||
bool CWorld::ICheckWorldComplete()
|
||||
bool CWorld::ICheckWorldComplete() { return CheckWorldComplete(nullptr, kInvalidAreaId, -1); }
|
||||
|
||||
std::string CWorld::IGetDefaultAudioTrack() const { return x84_defAudioTrack; }
|
||||
|
||||
int CWorld::IGetAreaCount() const { return x18_areas.size(); }
|
||||
|
||||
bool CWorld::DoesAreaExist(TAreaId area) const { return (area >= 0 && area < x18_areas.size()); }
|
||||
|
||||
void CWorld::PropogateAreaChain(CGameArea::EOcclusionState occlusionState, CGameArea* area, CWorld* world)
|
||||
{
|
||||
return CheckWorldComplete(nullptr, kInvalidAreaId, -1);
|
||||
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;
|
||||
}
|
||||
|
||||
std::string CWorld::IGetDefaultAudioTrack() const
|
||||
areaItr = world->x4c_chainHeads[3];
|
||||
|
||||
while (areaItr != skGlobalNonConstEnd)
|
||||
{
|
||||
return x84_defAudioTrack;
|
||||
if (areaItr == area)
|
||||
{
|
||||
areaItr = areaItr->x130_next;
|
||||
continue;
|
||||
}
|
||||
|
||||
int CWorld::IGetAreaCount() const
|
||||
{
|
||||
return x18_areas.size();
|
||||
|
||||
if (area->IsPostConstructed() && areaItr->GetOcclusionState() == CGameArea::EOcclusionState::NotOccluded)
|
||||
areaItr->PrepTokens();
|
||||
areaItr = areaItr->x130_next;
|
||||
}
|
||||
|
||||
bool CWorld::DoesAreaExist(TAreaId area) const
|
||||
{
|
||||
return (area >= 0 && area < x18_areas.size());
|
||||
if (occlusionState == CGameArea::EOcclusionState::NotOccluded)
|
||||
area->SetOcclusionState(CGameArea::EOcclusionState::NotOccluded);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -101,7 +101,8 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
|
||||
static constexpr CGameArea* skGlobalEnd = nullptr;
|
||||
static constexpr CGameArea* skGlobalNonConstEnd = nullptr;
|
||||
enum class Phase
|
||||
{
|
||||
Loading,
|
||||
|
@ -177,6 +178,10 @@ public:
|
|||
bool ICheckWorldComplete();
|
||||
std::string IGetDefaultAudioTrack() const;
|
||||
int IGetAreaCount() const;
|
||||
|
||||
static void PropogateAreaChain(CGameArea::EOcclusionState, CGameArea*, CWorld*);
|
||||
static const CGameArea* GetAliveAreasEnd() { return skGlobalEnd; }
|
||||
static CGameArea* AliveAreasEnd() { return skGlobalNonConstEnd; }
|
||||
};
|
||||
|
||||
struct CWorldLayers
|
||||
|
|
|
@ -827,14 +827,14 @@ CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, int
|
|||
for (int i = 0; i < propCount - 6; ++i)
|
||||
itemCounts.push_back(in.readUint32Big());
|
||||
|
||||
bool b1 = in.readBool();
|
||||
bool b2 = in.readBool();
|
||||
bool b3 = false;
|
||||
bool defaultSpawn = in.readBool();
|
||||
bool active = in.readBool();
|
||||
bool morphed = false;
|
||||
if (propCount > 34)
|
||||
b3 = in.readBool();
|
||||
morphed = in.readBool();
|
||||
|
||||
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)
|
||||
|
|
|
@ -22,6 +22,26 @@ public:
|
|||
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__
|
||||
|
|
Loading…
Reference in New Issue