mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-21 16:19:12 +00:00
Merge branch 'master' into omegapirate
This commit is contained in:
@@ -22,6 +22,7 @@ s16 s_DefaultVolumeScale = 0x7f;
|
||||
CAudioSys* CAudioSys::g_SharedSys = nullptr;
|
||||
|
||||
TLockedToken<CAudioGroupSet> CAudioSys::FindGroupSet(std::string_view name) {
|
||||
// TODO: Heterogeneous lookup when C++20 available
|
||||
auto search = mpGroupSetDB.find(name.data());
|
||||
if (search == mpGroupSetDB.cend())
|
||||
return {};
|
||||
|
||||
@@ -446,14 +446,9 @@ public:
|
||||
private:
|
||||
dspadpcm_header x0_header;
|
||||
std::string x60_fileName; // arg1
|
||||
union {
|
||||
u32 dummy = 0;
|
||||
struct {
|
||||
bool x70_24_unclaimed : 1;
|
||||
bool x70_25_headerReadCancelled : 1;
|
||||
u8 x70_26_headerReadState : 2; // 0: not read 1: reading 2: read
|
||||
};
|
||||
};
|
||||
bool x70_24_unclaimed : 1;
|
||||
bool x70_25_headerReadCancelled : 1;
|
||||
u8 x70_26_headerReadState : 2; // 0: not read 1: reading 2: read
|
||||
s8 x71_companionRight = -1;
|
||||
s8 x72_companionLeft = -1;
|
||||
float x73_volume = 0.f;
|
||||
@@ -465,13 +460,16 @@ private:
|
||||
static std::array<CDSPStreamManager, 4> g_Streams;
|
||||
|
||||
public:
|
||||
CDSPStreamManager() { x70_24_unclaimed = true; }
|
||||
CDSPStreamManager() : x70_24_unclaimed(true), x70_25_headerReadCancelled(false), x70_26_headerReadState(0) {}
|
||||
|
||||
CDSPStreamManager(std::string_view fileName, s32 handle, float volume, bool oneshot)
|
||||
: x60_fileName(fileName), x73_volume(volume), x74_oneshot(oneshot), x78_handleId(handle) {
|
||||
if (!CDvdFile::FileExists(fileName))
|
||||
x70_24_unclaimed = true;
|
||||
}
|
||||
: x60_fileName(fileName)
|
||||
, x70_24_unclaimed(!CDvdFile::FileExists(fileName))
|
||||
, x70_25_headerReadCancelled(false)
|
||||
, x70_26_headerReadState(0)
|
||||
, x73_volume(volume)
|
||||
, x74_oneshot(oneshot)
|
||||
, x78_handleId(handle) {}
|
||||
|
||||
static s32 FindUnclaimedStreamIdx() {
|
||||
for (size_t i = 0; i < g_Streams.size(); ++i) {
|
||||
|
||||
@@ -1048,15 +1048,15 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager
|
||||
x308_textpane_instructions2->TextSupport().SetText(u"");
|
||||
} else {
|
||||
x2fc_textpane_hint->TextSupport().SetText(u"");
|
||||
std::u16string str = fmt::format(fmt(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x24_lStick[x2e4_lStickPos]);
|
||||
str += g_MainStringTable->GetString(46); // Rotate
|
||||
std::u16string str = fmt::format(FMT_STRING(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x24_lStick[x2e4_lStickPos]);
|
||||
str += g_MainStringTable->GetString(46 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Rotate
|
||||
x300_textpane_instructions->TextSupport().SetText(str);
|
||||
str = fmt::format(fmt(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x4c_cStick[x2e8_rStickPos]);
|
||||
str += g_MainStringTable->GetString(47); // Move
|
||||
str = fmt::format(FMT_STRING(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x4c_cStick[x2e8_rStickPos]);
|
||||
str += g_MainStringTable->GetString(47 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Move
|
||||
x304_textpane_instructions1->TextSupport().SetText(str);
|
||||
str = fmt::format(fmt(u"&image={};"), g_tweakPlayerRes->x74_lTrigger[x2ec_lTriggerPos]);
|
||||
str += g_MainStringTable->GetString(48); // Zoom
|
||||
str += fmt::format(fmt(u"&image={};"), g_tweakPlayerRes->x80_rTrigger[x2f0_rTriggerPos]);
|
||||
str = fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->x74_lTrigger[x2ec_lTriggerPos]);
|
||||
str += g_MainStringTable->GetString(48 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Zoom
|
||||
str += fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->x80_rTrigger[x2f0_rTriggerPos]);
|
||||
x308_textpane_instructions2->TextSupport().SetText(str);
|
||||
}
|
||||
}
|
||||
@@ -1104,10 +1104,10 @@ void CAutoMapper::Update(float dt, CStateManager& mgr) {
|
||||
m_frmeInitialized = true;
|
||||
static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_left"))
|
||||
->TextSupport()
|
||||
.SetText(g_MainStringTable->GetString(42));
|
||||
.SetText(g_MainStringTable->GetString(42 + (!g_Main->IsUSA() || g_Main->IsTrilogy())));
|
||||
static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_yicon"))
|
||||
->TextSupport()
|
||||
.SetText(g_MainStringTable->GetString(43));
|
||||
.SetText(g_MainStringTable->GetString(43 + (!g_Main->IsUSA() || g_Main->IsTrilogy())));
|
||||
x2fc_textpane_hint = static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_hint"));
|
||||
x300_textpane_instructions = static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_instructions"));
|
||||
x304_textpane_instructions1 = static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_instructions1"));
|
||||
@@ -1115,7 +1115,7 @@ void CAutoMapper::Update(float dt, CStateManager& mgr) {
|
||||
CGuiTextPane* mapLegend = static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_mapLegend"));
|
||||
mapLegend->TextSupport().ClearRenderBuffer();
|
||||
mapLegend->TextSupport().SetImageBaseline(true);
|
||||
mapLegend->TextSupport().SetText(g_MainStringTable->GetString(49));
|
||||
mapLegend->TextSupport().SetText(g_MainStringTable->GetString(49 + (!g_Main->IsUSA() || g_Main->IsTrilogy())));
|
||||
x30c_basewidget_leftPane = x28_frmeMapScreen->FindWidget("basewidget_leftPane");
|
||||
x310_basewidget_yButtonPane = x28_frmeMapScreen->FindWidget("basewidget_yButtonPane");
|
||||
x314_basewidget_bottomPane = x28_frmeMapScreen->FindWidget("basewidget_bottomPane");
|
||||
@@ -1129,7 +1129,7 @@ void CAutoMapper::Update(float dt, CStateManager& mgr) {
|
||||
std::u16string string;
|
||||
if (x1bc_state == EAutoMapperState::MapScreenUniverse ||
|
||||
(x1bc_state == EAutoMapperState::MapScreen && HasCurrentMapUniverseWorld()))
|
||||
string = fmt::format(fmt(u"&image={};"), g_tweakPlayerRes->x98_aButton[x2f4_aButtonPos]);
|
||||
string = fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->x98_aButton[x2f4_aButtonPos]);
|
||||
right1->TextSupport().SetText(string);
|
||||
CGuiTextPane* right = static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_right"));
|
||||
if (x1bc_state == EAutoMapperState::MapScreenUniverse)
|
||||
|
||||
@@ -18,17 +18,17 @@ class CMapWorldInfo {
|
||||
|
||||
public:
|
||||
CMapWorldInfo() = default;
|
||||
explicit CMapWorldInfo(CBitStreamReader&, const CSaveWorld& saveWorld, CAssetId mlvlId);
|
||||
explicit CMapWorldInfo(CBitStreamReader& reader, const CSaveWorld& saveWorld, CAssetId mlvlId);
|
||||
void PutTo(CBitStreamWriter& writer, const CSaveWorld& savw, CAssetId mlvlId) const;
|
||||
bool IsMapped(TAreaId) const;
|
||||
void SetIsMapped(TAreaId, bool);
|
||||
bool IsMapped(TAreaId aid) const;
|
||||
void SetIsMapped(TAreaId aid, bool mapped);
|
||||
void SetDoorVisited(TEditorId eid, bool val);
|
||||
bool IsDoorVisited(TEditorId eid) const;
|
||||
bool IsAreaVisited(TAreaId) const;
|
||||
void SetAreaVisited(TAreaId, bool);
|
||||
bool IsWorldVisible(TAreaId) const;
|
||||
bool IsAreaVisible(TAreaId) const;
|
||||
bool IsAreaVisited(TAreaId aid) const;
|
||||
void SetAreaVisited(TAreaId aid, bool visited);
|
||||
bool IsWorldVisible(TAreaId aid) const;
|
||||
bool IsAreaVisible(TAreaId aid) const;
|
||||
bool IsAnythingSet() const;
|
||||
void SetMapStationUsed(bool val) { x38_mapStationUsed = val; }
|
||||
void SetMapStationUsed(bool isUsed) { x38_mapStationUsed = isUsed; }
|
||||
};
|
||||
} // namespace urde
|
||||
|
||||
@@ -19,7 +19,7 @@ class CFileDvdRequest : public IDvdRequest {
|
||||
std::function<void(u32)> m_callback;
|
||||
|
||||
public:
|
||||
~CFileDvdRequest() override { PostCancelRequest(); }
|
||||
~CFileDvdRequest() override { CFileDvdRequest::PostCancelRequest(); }
|
||||
|
||||
void WaitUntilComplete() override {
|
||||
while (!m_complete.load() && !m_cancel.load()) {
|
||||
@@ -32,14 +32,15 @@ public:
|
||||
m_cancel.store(true);
|
||||
}
|
||||
|
||||
EMediaType GetMediaType() const override { return EMediaType::File; }
|
||||
[[nodiscard]] EMediaType GetMediaType() const override { return EMediaType::File; }
|
||||
|
||||
CFileDvdRequest(CDvdFile& file, void* buf, u32 len, ESeekOrigin whence, int off, std::function<void(u32)>&& cb)
|
||||
: m_reader(file.m_reader), m_buf(buf), m_len(len), m_whence(whence), m_offset(off), m_callback(std::move(cb)) {}
|
||||
|
||||
void DoRequest() {
|
||||
if (m_cancel.load())
|
||||
if (m_cancel.load()) {
|
||||
return;
|
||||
}
|
||||
u32 readLen;
|
||||
if (m_whence == ESeekOrigin::Cur && m_offset == 0) {
|
||||
readLen = m_reader->readBytesToBuf(m_buf, m_len);
|
||||
@@ -47,8 +48,9 @@ public:
|
||||
m_reader->seek(m_offset, athena::SeekOrigin(m_whence));
|
||||
readLen = m_reader->readBytesToBuf(m_buf, m_len);
|
||||
}
|
||||
if (m_callback)
|
||||
if (m_callback) {
|
||||
m_callback(readLen);
|
||||
}
|
||||
m_complete.store(true);
|
||||
}
|
||||
};
|
||||
@@ -63,21 +65,22 @@ void CDvdFile::WorkerProc() {
|
||||
logvisor::RegisterThreadName("CDvdFile");
|
||||
while (m_WorkerRun.load()) {
|
||||
std::unique_lock<std::mutex> lk(CDvdFile::m_WorkerMutex);
|
||||
while (CDvdFile::m_RequestQueue.size()) {
|
||||
while (!CDvdFile::m_RequestQueue.empty()) {
|
||||
std::vector<std::shared_ptr<IDvdRequest>> swapQueue;
|
||||
swapQueue.swap(CDvdFile::m_RequestQueue);
|
||||
lk.unlock();
|
||||
std::unique_lock<std::mutex> waitlk(CDvdFile::m_WaitMutex);
|
||||
for (std::shared_ptr<IDvdRequest>& req : swapQueue) {
|
||||
CFileDvdRequest& concreteReq = static_cast<CFileDvdRequest&>(*req);
|
||||
auto& concreteReq = static_cast<CFileDvdRequest&>(*req);
|
||||
concreteReq.DoRequest();
|
||||
}
|
||||
waitlk.unlock();
|
||||
swapQueue.clear();
|
||||
lk.lock();
|
||||
}
|
||||
if (!m_WorkerRun.load())
|
||||
if (!m_WorkerRun.load()) {
|
||||
break;
|
||||
}
|
||||
m_WorkerCV.wait(lk);
|
||||
}
|
||||
}
|
||||
@@ -94,12 +97,15 @@ std::shared_ptr<IDvdRequest> CDvdFile::AsyncSeekRead(void* buf, u32 len, ESeekOr
|
||||
|
||||
hecl::ProjectPath CDvdFile::ResolvePath(std::string_view path) {
|
||||
auto start = path.begin();
|
||||
while (*start == '/') ++start;
|
||||
while (*start == '/') {
|
||||
++start;
|
||||
}
|
||||
std::string lowerChStr(start, path.end());
|
||||
std::transform(lowerChStr.begin(), lowerChStr.end(), lowerChStr.begin(), ::tolower);
|
||||
auto search = m_caseInsensitiveMap.find(lowerChStr);
|
||||
if (search == m_caseInsensitiveMap.end())
|
||||
if (search == m_caseInsensitiveMap.end()) {
|
||||
return {};
|
||||
}
|
||||
return hecl::ProjectPath(m_DvdRoot, search->second);
|
||||
}
|
||||
|
||||
@@ -120,19 +126,22 @@ void CDvdFile::RecursiveBuildCaseInsensitiveMap(const hecl::ProjectPath& path, s
|
||||
void CDvdFile::Initialize(const hecl::ProjectPath& path) {
|
||||
m_DvdRoot = path;
|
||||
RecursiveBuildCaseInsensitiveMap(path, path.getAbsolutePathUTF8().length() + 1);
|
||||
if (m_WorkerRun.load())
|
||||
if (m_WorkerRun.load()) {
|
||||
return;
|
||||
}
|
||||
m_WorkerRun.store(true);
|
||||
m_WorkerThread = std::thread(WorkerProc);
|
||||
}
|
||||
|
||||
void CDvdFile::Shutdown() {
|
||||
if (!m_WorkerRun.load())
|
||||
if (!m_WorkerRun.load()) {
|
||||
return;
|
||||
}
|
||||
m_WorkerRun.store(false);
|
||||
m_WorkerCV.notify_one();
|
||||
if (m_WorkerThread.joinable())
|
||||
if (m_WorkerThread.joinable()) {
|
||||
m_WorkerThread.join();
|
||||
}
|
||||
m_RequestQueue.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ u8* CGameAllocator::Alloc(size_t len) {
|
||||
void CGameAllocator::Free(u8* ptr) {
|
||||
SChunkDescription* info = reinterpret_cast<SChunkDescription*>(ptr - sizeof(SChunkDescription));
|
||||
if (info->magic != 0xE8E8E8E8 || info->sentinal != 0xEFEFEFEF) {
|
||||
AllocLog.report(logvisor::Fatal, fmt(_SYS_STR("Invalid chunk description, memory corruption!")));
|
||||
AllocLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Invalid chunk description, memory corruption!")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,38 @@ constexpr std::array<SGameOption, 4> ControllerOpts{{
|
||||
{EGameOption::RestoreDefaults, 35, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults},
|
||||
}};
|
||||
|
||||
const std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistry{{
|
||||
constexpr std::array<SGameOption, 5> VisorOptsNew{{
|
||||
{EGameOption::VisorOpacity, 23, 0.f, 255.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::HelmetOpacity, 24, 0.f, 255.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::HUDLag, 25, 0.f, 1.f, 1.f, EOptionType::DoubleEnum},
|
||||
{EGameOption::HintSystem, 26, 0.f, 1.f, 1.f, EOptionType::DoubleEnum},
|
||||
{EGameOption::RestoreDefaults, 38, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults},
|
||||
}};
|
||||
|
||||
constexpr std::array<SGameOption, 5> DisplayOptsNew{{
|
||||
//{EGameOption::ScreenBrightness, 25, 0.f, 8.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::ScreenBrightness, 28, -100.f, 100.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::ScreenOffsetX, 29, -30.f, 30.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::ScreenOffsetY, 30, -30.f, 30.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::ScreenStretch, 31, -10.f, 10.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::RestoreDefaults, 38, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults},
|
||||
}};
|
||||
|
||||
constexpr std::array<SGameOption, 4> SoundOptsNew{{
|
||||
{EGameOption::SFXVolume, 32, 0.f, 127.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::MusicVolume, 33, 0.f, 127.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::SoundMode, 34, 0.f, 1.f, 1.f, EOptionType::TripleEnum},
|
||||
{EGameOption::RestoreDefaults, 38, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults},
|
||||
}};
|
||||
|
||||
constexpr std::array<SGameOption, 4> ControllerOptsNew{{
|
||||
{EGameOption::ReverseYAxis, 35, 0.f, 1.f, 1.f, EOptionType::DoubleEnum},
|
||||
{EGameOption::Rumble, 37, 0.f, 1.f, 1.f, EOptionType::DoubleEnum},
|
||||
{EGameOption::SwapBeamControls, 37, 0.f, 1.f, 1.f, EOptionType::DoubleEnum},
|
||||
{EGameOption::RestoreDefaults, 38, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults},
|
||||
}};
|
||||
|
||||
constexpr std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistry{{
|
||||
{VisorOpts.size(), VisorOpts.data()},
|
||||
{DisplayOpts.size(), DisplayOpts.data()},
|
||||
{SoundOpts.size(), SoundOpts.data()},
|
||||
@@ -57,23 +88,33 @@ const std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistry{{
|
||||
{0, nullptr},
|
||||
}};
|
||||
|
||||
CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) {
|
||||
for (u8& entry : x0_nesState)
|
||||
entry = stream.ReadEncoded(8);
|
||||
constexpr std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistryNew{{
|
||||
{VisorOptsNew.size(), VisorOptsNew.data()},
|
||||
{DisplayOptsNew.size(), DisplayOptsNew.data()},
|
||||
{SoundOptsNew.size(), SoundOptsNew.data()},
|
||||
{ControllerOptsNew.size(), ControllerOptsNew.data()},
|
||||
{0, nullptr},
|
||||
}};
|
||||
|
||||
for (bool& entry : x68_)
|
||||
CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) {
|
||||
for (u8& entry : x0_nesState) {
|
||||
entry = stream.ReadEncoded(8);
|
||||
}
|
||||
|
||||
for (bool& entry : x68_) {
|
||||
entry = stream.ReadEncoded(8) != 0;
|
||||
}
|
||||
|
||||
xc0_frozenFpsCount = stream.ReadEncoded(2);
|
||||
xc4_frozenBallCount = stream.ReadEncoded(2);
|
||||
xc8_powerBombAmmoCount = stream.ReadEncoded(1);
|
||||
xcc_logScanPercent = stream.ReadEncoded(7);
|
||||
xd0_24_fusionLinked = stream.ReadEncoded(1);
|
||||
xd0_25_normalModeBeat = stream.ReadEncoded(1);
|
||||
xd0_26_hardModeBeat = stream.ReadEncoded(1);
|
||||
xd0_27_fusionBeat = stream.ReadEncoded(1);
|
||||
xd0_24_fusionLinked = stream.ReadEncoded(1) != 0;
|
||||
xd0_25_normalModeBeat = stream.ReadEncoded(1) != 0;
|
||||
xd0_26_hardModeBeat = stream.ReadEncoded(1) != 0;
|
||||
xd0_27_fusionBeat = stream.ReadEncoded(1) != 0;
|
||||
xd0_28_fusionSuitActive = false;
|
||||
xd0_29_allItemsCollected = stream.ReadEncoded(1);
|
||||
xd0_29_allItemsCollected = stream.ReadEncoded(1) != 0;
|
||||
xbc_autoMapperKeyState = stream.ReadEncoded(2);
|
||||
|
||||
auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds();
|
||||
@@ -86,8 +127,9 @@ CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) {
|
||||
|
||||
std::vector<bool> cinematicStates;
|
||||
cinematicStates.reserve(cinematicCount);
|
||||
for (size_t i = 0; i < cinematicCount; ++i)
|
||||
cinematicStates.push_back(stream.ReadEncoded(1));
|
||||
for (size_t i = 0; i < cinematicCount; ++i) {
|
||||
cinematicStates.push_back(stream.ReadEncoded(1) != 0);
|
||||
}
|
||||
|
||||
for (const auto& world : memWorlds) {
|
||||
TLockedToken<CSaveWorld> saveWorld =
|
||||
@@ -101,11 +143,13 @@ CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) {
|
||||
}
|
||||
|
||||
void CPersistentOptions::PutTo(CBitStreamWriter& w) const {
|
||||
for (const u8 entry : x0_nesState)
|
||||
for (const u8 entry : x0_nesState) {
|
||||
w.WriteEncoded(entry, 8);
|
||||
}
|
||||
|
||||
for (const bool entry : x68_)
|
||||
w.WriteEncoded(entry, 8);
|
||||
for (const bool entry : x68_) {
|
||||
w.WriteEncoded(u32(entry), 8);
|
||||
}
|
||||
|
||||
w.WriteEncoded(xc0_frozenFpsCount, 2);
|
||||
w.WriteEncoded(xc4_frozenBallCount, 2);
|
||||
@@ -120,11 +164,12 @@ void CPersistentOptions::PutTo(CBitStreamWriter& w) const {
|
||||
|
||||
auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds();
|
||||
for (const auto& world : memWorlds) {
|
||||
TLockedToken<CSaveWorld> saveWorld =
|
||||
const TLockedToken<CSaveWorld> saveWorld =
|
||||
g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), world.second.GetSaveWorldAssetId()});
|
||||
|
||||
for (TEditorId cineId : saveWorld->GetCinematics())
|
||||
w.WriteEncoded(GetCinematicState(world.first, cineId), 1);
|
||||
for (const TEditorId cineId : saveWorld->GetCinematics()) {
|
||||
w.WriteEncoded(u32(GetCinematicState(world.first, cineId)), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,11 +209,11 @@ CGameOptions::CGameOptions(CBitStreamReader& stream) {
|
||||
x60_hudAlpha = stream.ReadEncoded(8);
|
||||
x64_helmetAlpha = stream.ReadEncoded(8);
|
||||
|
||||
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);
|
||||
x68_24_hudLag = stream.ReadEncoded(1) != 0;
|
||||
x68_28_hintSystem = stream.ReadEncoded(1) != 0;
|
||||
x68_25_invertY = stream.ReadEncoded(1) != 0;
|
||||
x68_26_rumble = stream.ReadEncoded(1) != 0;
|
||||
x68_27_swapBeamsControls = stream.ReadEncoded(1) != 0;
|
||||
}
|
||||
|
||||
void CGameOptions::ResetToDefaults() {
|
||||
@@ -212,22 +257,28 @@ void CGameOptions::PutTo(CBitStreamWriter& writer) const {
|
||||
writer.WriteEncoded(x68_27_swapBeamsControls, 1);
|
||||
}
|
||||
|
||||
CGameOptions::CGameOptions() {
|
||||
x68_24_hudLag = true;
|
||||
x68_26_rumble = true;
|
||||
x68_28_hintSystem = true;
|
||||
CGameOptions::CGameOptions()
|
||||
: x68_24_hudLag(true)
|
||||
, x68_25_invertY(false)
|
||||
, x68_26_rumble(true)
|
||||
, x68_27_swapBeamsControls(false)
|
||||
, x68_28_hintSystem(true) {
|
||||
InitSoundMode();
|
||||
}
|
||||
|
||||
float CGameOptions::TuneScreenBrightness() { return (0.375f * 1.f) + (float(x48_screenBrightness) * 0.25f); }
|
||||
float CGameOptions::TuneScreenBrightness() const { return (0.375f * 1.f) + (float(x48_screenBrightness) * 0.25f); }
|
||||
|
||||
void CGameOptions::InitSoundMode() { /* If system is mono, force x44 to mono, otherwise honor user preference */ }
|
||||
void CGameOptions::InitSoundMode() { /* If system is mono, force x44 to mono, otherwise honor user preference */
|
||||
}
|
||||
static float BrightnessCopyFilter = 0.f;
|
||||
void CGameOptions::SetScreenBrightness(s32 val, bool apply) {
|
||||
x48_screenBrightness = zeus::clamp(0, val, 8);
|
||||
void CGameOptions::SetScreenBrightness(s32 value, bool apply) {
|
||||
x48_screenBrightness = zeus::clamp(0, value, 8);
|
||||
|
||||
if (apply)
|
||||
BrightnessCopyFilter = TuneScreenBrightness();
|
||||
if (!apply) {
|
||||
return;
|
||||
}
|
||||
|
||||
BrightnessCopyFilter = TuneScreenBrightness();
|
||||
}
|
||||
|
||||
void CGameOptions::ApplyGamma() {
|
||||
@@ -239,51 +290,60 @@ void CGameOptions::ApplyGamma() {
|
||||
CGraphics::g_BooFactory->setDisplayGamma(gammaT);
|
||||
}
|
||||
|
||||
void CGameOptions::SetGamma(s32 val, bool apply) {
|
||||
m_gamma = zeus::clamp(-100, val, 100);
|
||||
void CGameOptions::SetGamma(s32 value, bool apply) {
|
||||
m_gamma = zeus::clamp(-100, value, 100);
|
||||
|
||||
if (apply)
|
||||
ApplyGamma();
|
||||
if (!apply) {
|
||||
return;
|
||||
}
|
||||
|
||||
ApplyGamma();
|
||||
}
|
||||
|
||||
void CGameOptions::SetScreenPositionX(s32 pos, bool apply) {
|
||||
x4c_screenXOffset = zeus::clamp(-30, pos, 30);
|
||||
void CGameOptions::SetScreenPositionX(s32 position, bool apply) {
|
||||
x4c_screenXOffset = zeus::clamp(-30, position, 30);
|
||||
|
||||
if (apply) {
|
||||
/* TOOD: CGraphics related funcs */
|
||||
}
|
||||
}
|
||||
|
||||
void CGameOptions::SetScreenPositionY(s32 pos, bool apply) {
|
||||
x50_screenYOffset = zeus::clamp(-30, pos, 30);
|
||||
void CGameOptions::SetScreenPositionY(s32 position, bool apply) {
|
||||
x50_screenYOffset = zeus::clamp(-30, position, 30);
|
||||
|
||||
if (apply) {
|
||||
/* TOOD: CGraphics related funcs */
|
||||
}
|
||||
}
|
||||
|
||||
void CGameOptions::SetScreenStretch(s32 st, bool apply) {
|
||||
x54_screenStretch = zeus::clamp(-10, st, 10);
|
||||
void CGameOptions::SetScreenStretch(s32 stretch, bool apply) {
|
||||
x54_screenStretch = zeus::clamp(-10, stretch, 10);
|
||||
|
||||
if (apply) {
|
||||
/* TOOD: CGraphics related funcs */
|
||||
}
|
||||
}
|
||||
|
||||
void CGameOptions::SetSfxVolume(s32 vol, bool apply) {
|
||||
x58_sfxVol = zeus::clamp(0, vol, 0x7f);
|
||||
void CGameOptions::SetSfxVolume(s32 volume, bool apply) {
|
||||
x58_sfxVol = zeus::clamp(0, volume, 0x7f);
|
||||
|
||||
if (apply) {
|
||||
CAudioSys::SysSetSfxVolume(x58_sfxVol, 1, 1, 1);
|
||||
CStreamAudioManager::SetSfxVolume(x58_sfxVol);
|
||||
CMoviePlayer::SetSfxVolume(x58_sfxVol);
|
||||
if (!apply) {
|
||||
return;
|
||||
}
|
||||
|
||||
CAudioSys::SysSetSfxVolume(x58_sfxVol, 1, true, true);
|
||||
CStreamAudioManager::SetSfxVolume(x58_sfxVol);
|
||||
CMoviePlayer::SetSfxVolume(x58_sfxVol);
|
||||
}
|
||||
|
||||
void CGameOptions::SetMusicVolume(s32 vol, bool apply) {
|
||||
x5c_musicVol = zeus::clamp(0, vol, 0x7f);
|
||||
if (apply)
|
||||
CStreamAudioManager::SetMusicVolume(x5c_musicVol);
|
||||
void CGameOptions::SetMusicVolume(s32 volume, bool apply) {
|
||||
x5c_musicVol = zeus::clamp(0, volume, 0x7f);
|
||||
|
||||
if (!apply) {
|
||||
return;
|
||||
}
|
||||
|
||||
CStreamAudioManager::SetMusicVolume(x5c_musicVol);
|
||||
}
|
||||
|
||||
void CGameOptions::SetHUDAlpha(u32 alpha) { x60_hudAlpha = alpha; }
|
||||
@@ -323,7 +383,7 @@ void CGameOptions::SetControls(int controls) {
|
||||
ResetControllerAssets(controls);
|
||||
}
|
||||
|
||||
const std::array<std::pair<CAssetId, CAssetId>, 5> CStickToDPadRemap{{
|
||||
constexpr std::array<std::pair<CAssetId, CAssetId>, 5> CStickToDPadRemap{{
|
||||
{0x2A13C23E, 0xF13452F8},
|
||||
{0xA91A7703, 0xC042EC91},
|
||||
{0x12A12131, 0x5F556002},
|
||||
@@ -331,7 +391,7 @@ const std::array<std::pair<CAssetId, CAssetId>, 5> CStickToDPadRemap{{
|
||||
{0xCD7B1ACA, 0x8ADA8184},
|
||||
}};
|
||||
|
||||
const std::array<std::pair<CAssetId, CAssetId>, 5> CStickOutlineToDPadRemap{{
|
||||
constexpr std::array<std::pair<CAssetId, CAssetId>, 5> CStickOutlineToDPadRemap{{
|
||||
{0x1A29C0E6, 0xF13452F8},
|
||||
{0x5D9F9796, 0xC042EC91},
|
||||
{0x951546A8, 0x5F556002},
|
||||
@@ -440,10 +500,10 @@ void CGameOptions::SetOption(EGameOption option, int value) {
|
||||
options.SetHelmetAlpha(value);
|
||||
break;
|
||||
case EGameOption::HUDLag:
|
||||
options.SetHUDLag(value);
|
||||
options.SetHUDLag(value != 0);
|
||||
break;
|
||||
case EGameOption::HintSystem:
|
||||
options.SetIsHintSystemEnabled(value);
|
||||
options.SetIsHintSystemEnabled(value != 0);
|
||||
break;
|
||||
case EGameOption::ScreenBrightness:
|
||||
options.SetGamma(value, true);
|
||||
@@ -467,13 +527,13 @@ void CGameOptions::SetOption(EGameOption option, int value) {
|
||||
options.SetSurroundMode(value, true);
|
||||
break;
|
||||
case EGameOption::ReverseYAxis:
|
||||
options.SetInvertYAxis(value);
|
||||
options.SetInvertYAxis(value != 0);
|
||||
break;
|
||||
case EGameOption::Rumble:
|
||||
options.SetIsRumbleEnabled(value);
|
||||
options.SetIsRumbleEnabled(value != 0);
|
||||
break;
|
||||
case EGameOption::SwapBeamControls:
|
||||
options.SetSwapBeamControls(value);
|
||||
options.SetSwapBeamControls(value != 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -489,9 +549,9 @@ int CGameOptions::GetOption(EGameOption option) {
|
||||
case EGameOption::HelmetOpacity:
|
||||
return options.GetHelmetAlpha();
|
||||
case EGameOption::HUDLag:
|
||||
return options.GetHUDLag();
|
||||
return int(options.GetHUDLag());
|
||||
case EGameOption::HintSystem:
|
||||
return options.GetIsHintSystemEnabled();
|
||||
return int(options.GetIsHintSystemEnabled());
|
||||
case EGameOption::ScreenBrightness:
|
||||
return options.GetGamma();
|
||||
case EGameOption::ScreenOffsetX:
|
||||
@@ -507,11 +567,11 @@ int CGameOptions::GetOption(EGameOption option) {
|
||||
case EGameOption::SoundMode:
|
||||
return int(options.GetSurroundMode());
|
||||
case EGameOption::ReverseYAxis:
|
||||
return options.GetInvertYAxis();
|
||||
return int(options.GetInvertYAxis());
|
||||
case EGameOption::Rumble:
|
||||
return options.GetIsRumbleEnabled();
|
||||
return int(options.GetIsRumbleEnabled());
|
||||
case EGameOption::SwapBeamControls:
|
||||
return options.GetSwapBeamControls();
|
||||
return int(options.GetSwapBeamControls());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ struct SGameOption {
|
||||
|
||||
/** Static registry of Option UI presentation information */
|
||||
extern const std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistry;
|
||||
extern const std::array<std::pair<size_t, const SGameOption*>, 5> GameOptionsRegistryNew;
|
||||
|
||||
/** Options tracked persistently between game sessions */
|
||||
class CPersistentOptions {
|
||||
@@ -56,41 +57,41 @@ class CPersistentOptions {
|
||||
u32 xc4_frozenBallCount = 0;
|
||||
u32 xc8_powerBombAmmoCount = 0;
|
||||
u32 xcc_logScanPercent = 0;
|
||||
|
||||
union {
|
||||
struct {
|
||||
bool xd0_24_fusionLinked : 1;
|
||||
bool xd0_25_normalModeBeat : 1;
|
||||
bool xd0_26_hardModeBeat : 1;
|
||||
bool xd0_27_fusionBeat : 1;
|
||||
bool xd0_28_fusionSuitActive : 1;
|
||||
bool xd0_29_allItemsCollected : 1;
|
||||
};
|
||||
u16 _dummy = 0;
|
||||
};
|
||||
bool xd0_24_fusionLinked : 1;
|
||||
bool xd0_25_normalModeBeat : 1;
|
||||
bool xd0_26_hardModeBeat : 1;
|
||||
bool xd0_27_fusionBeat : 1;
|
||||
bool xd0_28_fusionSuitActive : 1;
|
||||
bool xd0_29_allItemsCollected : 1;
|
||||
|
||||
public:
|
||||
CPersistentOptions() = default;
|
||||
CPersistentOptions()
|
||||
: xd0_24_fusionLinked(false)
|
||||
, xd0_25_normalModeBeat(false)
|
||||
, xd0_26_hardModeBeat(false)
|
||||
, xd0_27_fusionBeat(false)
|
||||
, xd0_28_fusionSuitActive(false)
|
||||
, xd0_29_allItemsCollected(false) {}
|
||||
explicit CPersistentOptions(CBitStreamReader& stream);
|
||||
|
||||
bool GetCinematicState(CAssetId mlvlId, TEditorId cineId) const;
|
||||
void SetCinematicState(CAssetId mlvlId, TEditorId cineId, bool state);
|
||||
u32 GetAutoMapperKeyState() const { return xbc_autoMapperKeyState; }
|
||||
void SetAutoMapperKeyState(u32 s) { xbc_autoMapperKeyState = s; }
|
||||
void SetAutoMapperKeyState(u32 state) { xbc_autoMapperKeyState = state; }
|
||||
bool GetPlayerLinkedFusion() const { return xd0_24_fusionLinked; }
|
||||
void SetPlayerLinkedFusion(bool v) { xd0_24_fusionLinked = v; }
|
||||
void SetPlayerLinkedFusion(bool fusionLinked) { xd0_24_fusionLinked = fusionLinked; }
|
||||
bool GetPlayerBeatNormalMode() const { return xd0_25_normalModeBeat; }
|
||||
void SetPlayerBeatNormalMode(bool v) { xd0_25_normalModeBeat = v; }
|
||||
void SetPlayerBeatNormalMode(bool normalModeBeat) { xd0_25_normalModeBeat = normalModeBeat; }
|
||||
bool GetPlayerBeatHardMode() const { return xd0_26_hardModeBeat; }
|
||||
void SetPlayerBeatHardMode(bool v) { xd0_26_hardModeBeat = v; }
|
||||
void SetPlayerBeatHardMode(bool hardModeBeat) { xd0_26_hardModeBeat = hardModeBeat; }
|
||||
bool GetPlayerBeatFusion() const { return xd0_27_fusionBeat; }
|
||||
void SetPlayerBeatFusion(bool v) { xd0_27_fusionBeat = v; }
|
||||
void SetPlayerBeatFusion(bool fusionBeat) { xd0_27_fusionBeat = fusionBeat; }
|
||||
bool GetPlayerFusionSuitActive() const { return xd0_28_fusionSuitActive; }
|
||||
void SetPlayerFusionSuitActive(bool v) { xd0_28_fusionSuitActive = v; }
|
||||
void SetPlayerFusionSuitActive(bool fusionSuitActive) { xd0_28_fusionSuitActive = fusionSuitActive; }
|
||||
bool GetAllItemsCollected() const { return xd0_29_allItemsCollected; }
|
||||
void SetAllItemsCollected(bool v) { xd0_29_allItemsCollected = v; }
|
||||
void SetAllItemsCollected(bool allItemsCollected) { xd0_29_allItemsCollected = allItemsCollected; }
|
||||
u32 GetLogScanPercent() const { return xcc_logScanPercent; }
|
||||
void SetLogScanPercent(u32 v) { xcc_logScanPercent = v; }
|
||||
void SetLogScanPercent(u32 percent) { xcc_logScanPercent = percent; }
|
||||
void IncrementFrozenFpsCount() { xc0_frozenFpsCount = std::min(int(xc0_frozenFpsCount + 1), 3); }
|
||||
bool GetShowFrozenFpsMessage() const { return xc0_frozenFpsCount != 3; }
|
||||
void IncrementFrozenBallCount() { xc4_frozenBallCount = std::min(int(xc4_frozenBallCount + 1), 3); }
|
||||
@@ -116,22 +117,15 @@ class CGameOptions {
|
||||
u32 x5c_musicVol = 0x7f;
|
||||
u32 x60_hudAlpha = 0xff;
|
||||
u32 x64_helmetAlpha = 0xff;
|
||||
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;
|
||||
std::vector<std::pair<CAssetId, CAssetId>> x6c_controlTxtrMap;
|
||||
|
||||
s32 m_gamma = 0;
|
||||
|
||||
union {
|
||||
struct {
|
||||
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;
|
||||
};
|
||||
|
||||
std::vector<std::pair<CAssetId, CAssetId>> x6c_controlTxtrMap;
|
||||
|
||||
public:
|
||||
CGameOptions();
|
||||
explicit CGameOptions(CBitStreamReader& stream);
|
||||
@@ -140,37 +134,37 @@ public:
|
||||
void EnsureSettings();
|
||||
void PutTo(CBitStreamWriter& writer) const;
|
||||
|
||||
float TuneScreenBrightness();
|
||||
void SetScreenBrightness(s32, bool);
|
||||
float TuneScreenBrightness() const;
|
||||
void SetScreenBrightness(s32 value, bool apply);
|
||||
s32 GetScreenBrightness() const { return x48_screenBrightness; }
|
||||
void ApplyGamma();
|
||||
void SetGamma(s32, bool);
|
||||
void SetGamma(s32 value, bool apply);
|
||||
s32 GetGamma() const { return m_gamma; }
|
||||
void SetScreenPositionX(s32, bool);
|
||||
void SetScreenPositionX(s32 position, bool apply);
|
||||
s32 GetScreenPositionX() const { return x4c_screenXOffset; }
|
||||
void SetScreenPositionY(s32, bool);
|
||||
void SetScreenPositionY(s32 position, bool apply);
|
||||
s32 GetScreenPositionY() const { return x50_screenYOffset; }
|
||||
void SetScreenStretch(s32, bool);
|
||||
void SetScreenStretch(s32 stretch, bool apply);
|
||||
s32 GetScreenStretch() const { return x54_screenStretch; }
|
||||
void SetSfxVolume(s32, bool);
|
||||
void SetSfxVolume(s32 volume, bool apply);
|
||||
s32 GetSfxVolume() const { return x58_sfxVol; }
|
||||
void SetMusicVolume(s32, bool);
|
||||
void SetMusicVolume(s32 volume, bool apply);
|
||||
s32 GetMusicVolume() const { return x5c_musicVol; }
|
||||
void SetHUDAlpha(u32);
|
||||
void SetHUDAlpha(u32 alpha);
|
||||
u32 GetHUDAlpha() const { return x60_hudAlpha; }
|
||||
void SetHelmetAlpha(u32);
|
||||
void SetHelmetAlpha(u32 alpha);
|
||||
u32 GetHelmetAlpha() const { return x64_helmetAlpha; }
|
||||
void SetHUDLag(bool);
|
||||
void SetHUDLag(bool lag);
|
||||
bool GetHUDLag() const { return x68_24_hudLag; }
|
||||
void SetSurroundMode(int mode, bool apply);
|
||||
CAudioSys::ESurroundModes GetSurroundMode() const;
|
||||
void SetInvertYAxis(bool);
|
||||
void SetInvertYAxis(bool invert);
|
||||
bool GetInvertYAxis() const { return x68_25_invertY; }
|
||||
void SetIsRumbleEnabled(bool);
|
||||
void SetIsRumbleEnabled(bool rumble);
|
||||
bool GetIsRumbleEnabled() const { return x68_26_rumble; }
|
||||
void SetSwapBeamControls(bool);
|
||||
void SetSwapBeamControls(bool swap);
|
||||
bool GetSwapBeamControls() const { return x68_27_swapBeamsControls; }
|
||||
void SetIsHintSystemEnabled(bool);
|
||||
void SetIsHintSystemEnabled(bool hints);
|
||||
bool GetIsHintSystemEnabled() const { return x68_28_hintSystem; }
|
||||
void SetControls(int controls);
|
||||
void ResetControllerAssets(int controls);
|
||||
|
||||
@@ -24,15 +24,16 @@ union BitsToDouble {
|
||||
};
|
||||
|
||||
CWorldLayerState::CWorldLayerState(CBitStreamReader& reader, const CSaveWorld& saveWorld) {
|
||||
u32 bitCount = reader.ReadEncoded(10);
|
||||
const u32 bitCount = reader.ReadEncoded(10);
|
||||
x10_saveLayers.reserve(bitCount);
|
||||
|
||||
for (u32 i = 0; i < bitCount; ++i) {
|
||||
bool bit = reader.ReadEncoded(1);
|
||||
if (bit)
|
||||
const bool bit = reader.ReadEncoded(1) != 0;
|
||||
if (bit) {
|
||||
x10_saveLayers.setBit(i);
|
||||
else
|
||||
} else {
|
||||
x10_saveLayers.unsetBit(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,11 +54,14 @@ void CWorldLayerState::PutTo(CBitStreamWriter& writer) const {
|
||||
}
|
||||
|
||||
void CWorldLayerState::InitializeWorldLayers(const std::vector<CWorldLayers::Area>& layers) {
|
||||
if (x0_areaLayers.size())
|
||||
if (!x0_areaLayers.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
x0_areaLayers = layers;
|
||||
if (x10_saveLayers.getBitCount() == 0)
|
||||
if (x10_saveLayers.getBitCount() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
u32 a = 0;
|
||||
u32 b = 0;
|
||||
@@ -102,9 +106,9 @@ CGameState::GameFileStateInfo CGameState::LoadGameFileState(const u8* data) {
|
||||
}
|
||||
ret.x14_timestamp = stream.ReadEncoded(32);
|
||||
|
||||
ret.x20_hardMode = stream.ReadEncoded(1);
|
||||
ret.x20_hardMode = stream.ReadEncoded(1) != 0;
|
||||
stream.ReadEncoded(1);
|
||||
CAssetId origMLVL = u32(stream.ReadEncoded(32));
|
||||
const CAssetId origMLVL = u32(stream.ReadEncoded(32));
|
||||
ret.x8_mlvlId = origMLVL;
|
||||
|
||||
BitsToDouble conv;
|
||||
@@ -137,13 +141,17 @@ CGameState::GameFileStateInfo CGameState::LoadGameFileState(const u8* data) {
|
||||
CGameState::CGameState() {
|
||||
x98_playerState = std::make_shared<CPlayerState>();
|
||||
x9c_transManager = std::make_shared<CWorldTransManager>();
|
||||
x228_24_hardMode = false;
|
||||
x228_25_initPowerupsAtFirstSpawn = true;
|
||||
if (g_MemoryCardSys)
|
||||
|
||||
if (g_MemoryCardSys != nullptr) {
|
||||
InitializeMemoryStates();
|
||||
}
|
||||
}
|
||||
|
||||
CGameState::CGameState(CBitStreamReader& stream, u32 saveIdx) : x20c_saveFileIdx(saveIdx) {
|
||||
x9c_transManager = std::make_shared<CWorldTransManager>();
|
||||
x228_24_hardMode = false;
|
||||
x228_25_initPowerupsAtFirstSpawn = true;
|
||||
|
||||
for (bool& value : x0_) {
|
||||
@@ -151,8 +159,8 @@ CGameState::CGameState(CBitStreamReader& stream, u32 saveIdx) : x20c_saveFileIdx
|
||||
}
|
||||
stream.ReadEncoded(32);
|
||||
|
||||
x228_24_hardMode = stream.ReadEncoded(1);
|
||||
x228_25_initPowerupsAtFirstSpawn = stream.ReadEncoded(1);
|
||||
x228_24_hardMode = stream.ReadEncoded(1) != 0;
|
||||
x228_25_initPowerupsAtFirstSpawn = stream.ReadEncoded(1) != 0;
|
||||
x84_mlvlId = u32(stream.ReadEncoded(32));
|
||||
MP1::CMain::EnsureWorldPakReady(x84_mlvlId);
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ class CGameState {
|
||||
friend class CStateManager;
|
||||
|
||||
std::array<bool, 128> x0_{};
|
||||
u32 x80_;
|
||||
u32 x80_ = 0;
|
||||
CAssetId x84_mlvlId;
|
||||
std::vector<CWorldState> x88_worldStates;
|
||||
std::shared_ptr<CPlayerState> x98_playerState;
|
||||
@@ -81,14 +81,8 @@ class CGameState {
|
||||
u32 x20c_saveFileIdx = 0;
|
||||
u64 x210_cardSerial = 0;
|
||||
std::vector<u8> x218_backupBuf;
|
||||
|
||||
union {
|
||||
struct {
|
||||
bool x228_24_hardMode : 1;
|
||||
bool x228_25_initPowerupsAtFirstSpawn : 1;
|
||||
};
|
||||
u8 _dummy = 0;
|
||||
};
|
||||
bool x228_24_hardMode : 1;
|
||||
bool x228_25_initPowerupsAtFirstSpawn : 1;
|
||||
|
||||
public:
|
||||
CGameState();
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
bool ReadFromMemoryCard(std::string_view name) { return true; }
|
||||
|
||||
static std::string GetIdentifierForMidiEvent(CAssetId world, CAssetId area, std::string_view midiObj) {
|
||||
return fmt::format(fmt("World {} Area {} MidiObject: {}"), world, area, midiObj);
|
||||
return fmt::format(FMT_STRING("World {} Area {} MidiObject: {}"), world, area, midiObj);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -525,7 +525,10 @@ void CMemoryCardSys::CommitToDisk(kabufuda::ECardSlot port) {
|
||||
|
||||
kabufuda::SystemString CMemoryCardSys::CreateDolphinCard(kabufuda::ECardSlot slot) {
|
||||
kabufuda::SystemString path = _CreateDolphinCard(slot);
|
||||
CardProbe(slot);
|
||||
if (CardProbe(slot).x0_error != ECardResult::READY) {
|
||||
return {};
|
||||
}
|
||||
|
||||
MountCard(slot);
|
||||
FormatCard(slot);
|
||||
kabufuda::Card& card = g_CardStates[int(slot)];
|
||||
|
||||
@@ -1,50 +1,59 @@
|
||||
#include "CMemoryCardSys.hpp"
|
||||
#include "Runtime/GameGlobalObjects.hpp"
|
||||
#include "Runtime/IMain.hpp"
|
||||
|
||||
namespace urde {
|
||||
|
||||
kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) {
|
||||
const char* home = getenv("HOME");
|
||||
if (!home || home[0] != '/')
|
||||
return {};
|
||||
const char* dataHome = getenv("XDG_DATA_HOME");
|
||||
|
||||
/* XDG-selected data path */
|
||||
kabufuda::SystemString path =
|
||||
((dataHome && dataHome[0] == '/') ? dataHome : hecl::SystemString(home)) + "/.local/share/dolphin-emu";
|
||||
path += fmt::format(fmt("/GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||
|
||||
hecl::Sstat theStat;
|
||||
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode)) {
|
||||
/* legacy case for older dolphin versions */
|
||||
path = home;
|
||||
path += fmt::format(fmt("/.dolphin-emu/GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
|
||||
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
|
||||
const char* home = getenv("HOME");
|
||||
if (!home || home[0] != '/')
|
||||
return {};
|
||||
}
|
||||
const char* dataHome = getenv("XDG_DATA_HOME");
|
||||
|
||||
return path;
|
||||
/* XDG-selected data path */
|
||||
kabufuda::SystemString path =
|
||||
((dataHome && dataHome[0] == '/') ? dataHome : hecl::SystemString(home)) + "/.local/share/dolphin-emu";
|
||||
path += fmt::format(FMT_STRING("/GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||
|
||||
hecl::Sstat theStat;
|
||||
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode)) {
|
||||
/* legacy case for older dolphin versions */
|
||||
path = home;
|
||||
path += fmt::format(FMT_STRING("/.dolphin-emu/GC/MemoryCard{:c}.USA.raw"),
|
||||
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
|
||||
return {};
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot) {
|
||||
const char* home = getenv("HOME");
|
||||
if (!home || home[0] != '/')
|
||||
return {};
|
||||
const char* dataHome = getenv("XDG_DATA_HOME");
|
||||
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
|
||||
const char* home = getenv("HOME");
|
||||
if (!home || home[0] != '/')
|
||||
return {};
|
||||
const char* dataHome = getenv("XDG_DATA_HOME");
|
||||
|
||||
/* XDG-selected data path */
|
||||
kabufuda::SystemString path =
|
||||
((dataHome && dataHome[0] == '/') ? dataHome : hecl::SystemString(home)) + "/.local/share/dolphin-emu/GC";
|
||||
/* XDG-selected data path */
|
||||
kabufuda::SystemString path =
|
||||
((dataHome && dataHome[0] == '/') ? dataHome : hecl::SystemString(home)) + "/.local/share/dolphin-emu/GC";
|
||||
|
||||
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
||||
return {};
|
||||
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
||||
return {};
|
||||
|
||||
path += fmt::format(fmt("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
|
||||
if (fp == nullptr) {
|
||||
return {};
|
||||
path += fmt::format(FMT_STRING("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
|
||||
if (fp == nullptr) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
return path;
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
||||
@@ -1,40 +1,47 @@
|
||||
#include "CMemoryCardSys.hpp"
|
||||
|
||||
#include "Runtime/GameGlobalObjects.hpp"
|
||||
#include "Runtime/IMain.hpp"
|
||||
namespace urde {
|
||||
|
||||
kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) {
|
||||
const char* home = getenv("HOME");
|
||||
if (!home)
|
||||
return {};
|
||||
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
|
||||
const char* home = getenv("HOME");
|
||||
if (!home)
|
||||
return {};
|
||||
|
||||
kabufuda::SystemString path = home;
|
||||
path += fmt::format(fmt("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw"),
|
||||
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||
kabufuda::SystemString path = home;
|
||||
path += fmt::format(FMT_STRING("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw"),
|
||||
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||
|
||||
hecl::Sstat theStat;
|
||||
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
|
||||
return {};
|
||||
hecl::Sstat theStat;
|
||||
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
|
||||
return {};
|
||||
|
||||
return path;
|
||||
return path;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot) {
|
||||
const char* home = getenv("HOME");
|
||||
if (!home)
|
||||
return {};
|
||||
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
|
||||
const char* home = getenv("HOME");
|
||||
if (!home)
|
||||
return {};
|
||||
|
||||
kabufuda::SystemString path = home;
|
||||
path += "/Library/Application Support/Dolphin/GC";
|
||||
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
||||
return {};
|
||||
kabufuda::SystemString path = home;
|
||||
path += "/Library/Application Support/Dolphin/GC";
|
||||
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
||||
return {};
|
||||
|
||||
path += fmt::format(fmt("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
|
||||
if (fp == nullptr) {
|
||||
return {};
|
||||
path += fmt::format(FMT_STRING("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
|
||||
if (fp == nullptr) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
return path;
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include "Runtime/CMemoryCardSys.hpp"
|
||||
|
||||
#include "Runtime/GameGlobalObjects.hpp"
|
||||
#include "Runtime/IMain.hpp"
|
||||
|
||||
#include <shlobj.h>
|
||||
|
||||
namespace urde {
|
||||
@@ -12,101 +15,109 @@ using namespace Windows::Storage;
|
||||
* https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/UICommon/UICommon.cpp
|
||||
* Modified to not use dolphin-binary-relative paths. */
|
||||
kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) {
|
||||
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
|
||||
#if !WINDOWS_STORE
|
||||
/* Detect where the User directory is. There are two different cases
|
||||
/* Detect where the User directory is. There are two different cases
|
||||
* 1. HKCU\Software\Dolphin Emulator\UserConfigPath exists
|
||||
* -> Use this as the user directory path
|
||||
* 2. My Documents exists
|
||||
* -> Use My Documents\Dolphin Emulator as the User directory path
|
||||
*/
|
||||
*/
|
||||
|
||||
/* Check our registry keys */
|
||||
HKEY hkey;
|
||||
kabufuda::SystemChar configPath[MAX_PATH] = {0};
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, _SYS_STR("Software\\Dolphin Emulator"), 0, KEY_QUERY_VALUE, &hkey) ==
|
||||
ERROR_SUCCESS) {
|
||||
DWORD size = MAX_PATH;
|
||||
if (RegQueryValueEx(hkey, _SYS_STR("UserConfigPath"), nullptr, nullptr, (LPBYTE)configPath, &size) != ERROR_SUCCESS)
|
||||
configPath[0] = 0;
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
/* Check our registry keys */
|
||||
HKEY hkey;
|
||||
kabufuda::SystemChar configPath[MAX_PATH] = {0};
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, _SYS_STR("Software\\Dolphin Emulator"), 0, KEY_QUERY_VALUE, &hkey) ==
|
||||
ERROR_SUCCESS) {
|
||||
DWORD size = MAX_PATH;
|
||||
if (RegQueryValueEx(hkey, _SYS_STR("UserConfigPath"), nullptr, nullptr, (LPBYTE)configPath, &size) !=
|
||||
ERROR_SUCCESS)
|
||||
configPath[0] = 0;
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
/* Get My Documents path in case we need it. */
|
||||
kabufuda::SystemChar my_documents[MAX_PATH];
|
||||
bool my_documents_found =
|
||||
SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_MYDOCUMENTS, nullptr, SHGFP_TYPE_CURRENT, my_documents));
|
||||
/* Get My Documents path in case we need it. */
|
||||
kabufuda::SystemChar my_documents[MAX_PATH];
|
||||
bool my_documents_found =
|
||||
SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_MYDOCUMENTS, nullptr, SHGFP_TYPE_CURRENT, my_documents));
|
||||
|
||||
kabufuda::SystemString path;
|
||||
if (configPath[0]) /* Case 1 */
|
||||
path = configPath;
|
||||
else if (my_documents_found) /* Case 2 */
|
||||
path = kabufuda::SystemString(my_documents) + _SYS_STR("/Dolphin Emulator");
|
||||
else /* Unable to find */
|
||||
return {};
|
||||
kabufuda::SystemString path;
|
||||
if (configPath[0]) /* Case 1 */
|
||||
path = configPath;
|
||||
else if (my_documents_found) /* Case 2 */
|
||||
path = kabufuda::SystemString(my_documents) + _SYS_STR("/Dolphin Emulator");
|
||||
else /* Unable to find */
|
||||
return {};
|
||||
#else
|
||||
StorageFolder ^ localFolder = ApplicationData::Current->LocalFolder;
|
||||
kabufuda::SystemString path(localFolder->Path->Data());
|
||||
StorageFolder ^ localFolder = ApplicationData::Current->LocalFolder;
|
||||
kabufuda::SystemString path(localFolder->Path->Data());
|
||||
#endif
|
||||
|
||||
path += fmt::format(fmt(_SYS_STR("/GC/MemoryCard{}.USA.raw")),
|
||||
slot == kabufuda::ECardSlot::SlotA ? _SYS_STR('A') : _SYS_STR('B'));
|
||||
path += fmt::format(FMT_STRING(_SYS_STR("/GC/MemoryCard{}.USA.raw")),
|
||||
slot == kabufuda::ECardSlot::SlotA ? _SYS_STR('A') : _SYS_STR('B'));
|
||||
|
||||
hecl::Sstat theStat;
|
||||
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
|
||||
return {};
|
||||
hecl::Sstat theStat;
|
||||
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
|
||||
return {};
|
||||
|
||||
return path;
|
||||
return path;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot) {
|
||||
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
|
||||
#if !WINDOWS_STORE
|
||||
/* Detect where the User directory is. There are two different cases
|
||||
/* Detect where the User directory is. There are two different cases
|
||||
* 1. HKCU\Software\Dolphin Emulator\UserConfigPath exists
|
||||
* -> Use this as the user directory path
|
||||
* 2. My Documents exists
|
||||
* -> Use My Documents\Dolphin Emulator as the User directory path
|
||||
*/
|
||||
*/
|
||||
|
||||
/* Check our registry keys */
|
||||
HKEY hkey;
|
||||
kabufuda::SystemChar configPath[MAX_PATH] = {0};
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, _SYS_STR("Software\\Dolphin Emulator"), 0, KEY_QUERY_VALUE, &hkey) ==
|
||||
ERROR_SUCCESS) {
|
||||
DWORD size = MAX_PATH;
|
||||
if (RegQueryValueEx(hkey, _SYS_STR("UserConfigPath"), nullptr, nullptr, (LPBYTE)configPath, &size) != ERROR_SUCCESS)
|
||||
configPath[0] = 0;
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
/* Check our registry keys */
|
||||
HKEY hkey;
|
||||
kabufuda::SystemChar configPath[MAX_PATH] = {0};
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, _SYS_STR("Software\\Dolphin Emulator"), 0, KEY_QUERY_VALUE, &hkey) ==
|
||||
ERROR_SUCCESS) {
|
||||
DWORD size = MAX_PATH;
|
||||
if (RegQueryValueEx(hkey, _SYS_STR("UserConfigPath"), nullptr, nullptr, (LPBYTE)configPath, &size) !=
|
||||
ERROR_SUCCESS)
|
||||
configPath[0] = 0;
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
/* Get My Documents path in case we need it. */
|
||||
kabufuda::SystemChar my_documents[MAX_PATH];
|
||||
bool my_documents_found =
|
||||
SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_MYDOCUMENTS, nullptr, SHGFP_TYPE_CURRENT, my_documents));
|
||||
/* Get My Documents path in case we need it. */
|
||||
kabufuda::SystemChar my_documents[MAX_PATH];
|
||||
bool my_documents_found =
|
||||
SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_MYDOCUMENTS, nullptr, SHGFP_TYPE_CURRENT, my_documents));
|
||||
|
||||
kabufuda::SystemString path;
|
||||
if (configPath[0]) /* Case 1 */
|
||||
path = configPath;
|
||||
else if (my_documents_found) /* Case 2 */
|
||||
path = kabufuda::SystemString(my_documents) + _SYS_STR("/Dolphin Emulator");
|
||||
else /* Unable to find */
|
||||
return {};
|
||||
kabufuda::SystemString path;
|
||||
if (configPath[0]) /* Case 1 */
|
||||
path = configPath;
|
||||
else if (my_documents_found) /* Case 2 */
|
||||
path = kabufuda::SystemString(my_documents) + _SYS_STR("/Dolphin Emulator");
|
||||
else /* Unable to find */
|
||||
return {};
|
||||
#else
|
||||
StorageFolder ^ localFolder = ApplicationData::Current->LocalFolder;
|
||||
kabufuda::SystemString path(localFolder->Path->Data());
|
||||
StorageFolder ^ localFolder = ApplicationData::Current->LocalFolder;
|
||||
kabufuda::SystemString path(localFolder->Path->Data());
|
||||
#endif
|
||||
|
||||
path += _SYS_STR("/GC");
|
||||
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
||||
return {};
|
||||
path += _SYS_STR("/GC");
|
||||
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
||||
return {};
|
||||
|
||||
path += fmt::format(fmt(_SYS_STR("/MemoryCard{}.USA.raw")),
|
||||
slot == kabufuda::ECardSlot::SlotA ? _SYS_STR('A') : _SYS_STR('B'));
|
||||
const auto fp = hecl::FopenUnique(path.c_str(), _SYS_STR("wb"));
|
||||
if (fp == nullptr) {
|
||||
return {};
|
||||
path += fmt::format(FMT_STRING(_SYS_STR("/MemoryCard{}.USA.raw")),
|
||||
slot == kabufuda::ECardSlot::SlotA ? _SYS_STR('A') : _SYS_STR('B'));
|
||||
const auto fp = hecl::FopenUnique(path.c_str(), _SYS_STR("wb"));
|
||||
if (fp == nullptr) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
return path;
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
||||
@@ -13,7 +13,7 @@ void CObjectList::AddObject(CEntity& entity) {
|
||||
#ifndef NDEBUG
|
||||
if (x0_list[entity.GetUniqueId().Value()].entity != nullptr &&
|
||||
x0_list[entity.GetUniqueId().Value()].entity != &entity)
|
||||
Log.report(logvisor::Level::Fatal, fmt("INVALID USAGE DETECTED: Attempting to assign entity '{} ({})' to existing node '{}'!!!"),
|
||||
Log.report(logvisor::Level::Fatal, FMT_STRING("INVALID USAGE DETECTED: Attempting to assign entity '{} ({})' to existing node '{}'!!!"),
|
||||
entity.GetName(), entity.GetEditorId(), entity.GetUniqueId().Value());
|
||||
#endif
|
||||
s16 prevFirst = -1;
|
||||
|
||||
@@ -5,9 +5,10 @@ static logvisor::Module Log("urde::CPakFile");
|
||||
|
||||
CPakFile::CPakFile(std::string_view filename, bool buildDepList, bool worldPak, bool override) : CDvdFile(filename) {
|
||||
if (!CDvdFile::operator bool())
|
||||
Log.report(logvisor::Fatal, fmt("{}: Unable to open"), GetPath());
|
||||
Log.report(logvisor::Fatal, FMT_STRING("{}: Unable to open"), GetPath());
|
||||
x28_24_buildDepList = buildDepList;
|
||||
//x28_24_buildDepList = true; // Always do this so URDE can rapidly pre-warm shaders
|
||||
x28_25_aramFile = false;
|
||||
x28_26_worldPak = worldPak;
|
||||
x28_27_stashedInARAM = false;
|
||||
m_override = override;
|
||||
@@ -66,7 +67,7 @@ void CPakFile::InitialHeaderLoad() {
|
||||
u32 version = r.readUint32Big();
|
||||
if (version != 0x80030005) {
|
||||
Log.report(logvisor::Fatal,
|
||||
fmt("{}: Incompatible pak file version -- Current version is {:08X}, you're using {:08X}"),
|
||||
FMT_STRING("{}: Incompatible pak file version -- Current version is {:08X}, you're using {:08X}"),
|
||||
GetPath(), 0x80030005, version);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,16 +36,11 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
union {
|
||||
struct {
|
||||
bool x28_24_buildDepList : 1;
|
||||
bool x28_25_aramFile : 1;
|
||||
bool x28_26_worldPak : 1;
|
||||
bool x28_27_stashedInARAM : 1;
|
||||
bool m_override : 1;
|
||||
};
|
||||
u32 _dummy = 0;
|
||||
};
|
||||
bool x28_24_buildDepList : 1;
|
||||
bool x28_25_aramFile : 1;
|
||||
bool x28_26_worldPak : 1;
|
||||
bool x28_27_stashedInARAM : 1;
|
||||
bool m_override : 1;
|
||||
enum class EAsyncPhase {
|
||||
Warmup = 0,
|
||||
InitialHeader = 1,
|
||||
|
||||
@@ -74,13 +74,13 @@ constexpr std::array<float, 5> ComboAmmoPeriods{
|
||||
};
|
||||
} // Anonymous namespace
|
||||
|
||||
CPlayerState::CPlayerState() : x188_staticIntf(5) {
|
||||
x0_24_alive = true;
|
||||
CPlayerState::CPlayerState()
|
||||
: x0_24_alive(true), x0_25_firingComboBeam(false), x0_26_fusion(false), x188_staticIntf(5) {
|
||||
x24_powerups.resize(41);
|
||||
}
|
||||
|
||||
CPlayerState::CPlayerState(CBitStreamReader& stream) : x188_staticIntf(5) {
|
||||
x0_24_alive = true;
|
||||
CPlayerState::CPlayerState(CBitStreamReader& stream)
|
||||
: x0_24_alive(true), x0_25_firingComboBeam(false), x0_26_fusion(false), x188_staticIntf(5) {
|
||||
x4_enabledItems = u32(stream.ReadEncoded(32));
|
||||
|
||||
const u32 integralHP = u32(stream.ReadEncoded(32));
|
||||
|
||||
@@ -94,15 +94,9 @@ private:
|
||||
constexpr CPowerUp() = default;
|
||||
constexpr CPowerUp(u32 amount, u32 capacity) : x0_amount(amount), x4_capacity(capacity) {}
|
||||
};
|
||||
union {
|
||||
struct {
|
||||
bool x0_24_alive : 1;
|
||||
bool x0_25_firingComboBeam : 1;
|
||||
bool x0_26_fusion : 1;
|
||||
};
|
||||
u32 dummy = 0;
|
||||
};
|
||||
|
||||
bool x0_24_alive : 1;
|
||||
bool x0_25_firingComboBeam : 1;
|
||||
bool x0_26_fusion : 1;
|
||||
u32 x4_enabledItems = 0;
|
||||
EBeamId x8_currentBeam = EBeamId::Power;
|
||||
CHealthInfo xc_health = {99.f, 50.f};
|
||||
|
||||
@@ -9,7 +9,7 @@ class CRandom16 {
|
||||
static CRandom16* g_randomNumber;
|
||||
|
||||
public:
|
||||
CRandom16(s32 p = 99) : m_seed(p) {}
|
||||
explicit CRandom16(s32 seed = 99) : m_seed(seed) {}
|
||||
|
||||
s32 Next() {
|
||||
m_seed = (m_seed * 0x41c64e6d) + 0x00003039;
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
|
||||
s32 GetSeed() const { return m_seed; }
|
||||
|
||||
void SetSeed(s32 p) { m_seed = p; }
|
||||
void SetSeed(s32 seed) { m_seed = seed; }
|
||||
|
||||
float Float() { return Next() * 0.000015259022f; }
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ CFactoryFnReturn CResFactory::BuildSync(const SObjectTag& tag, const CVParamTran
|
||||
else
|
||||
ret = std::make_unique<TObjOwnerDerivedFromIObjUntyped>(nullptr);
|
||||
}
|
||||
Log.report(logvisor::Warning, fmt("sync-built {}"), tag);
|
||||
Log.report(logvisor::Warning, FMT_STRING("sync-built {}"), tag);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ bool CResFactory::PumpResource(SLoadingData& data) {
|
||||
*data.xc_targetPtr =
|
||||
x5c_factoryMgr.MakeObjectFromMemory(data.x0_tag, std::move(data.x10_loadBuffer), data.x14_resSize,
|
||||
data.m_compressed, data.x18_cvXfer, data.m_selfRef);
|
||||
Log.report(logvisor::Info, fmt("async-built {}"), data.x0_tag);
|
||||
Log.report(logvisor::Info, FMT_STRING("async-built {}"), data.x0_tag);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -210,7 +210,7 @@ bool CResLoader::FindResource(CAssetId id) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
Log.report(logvisor::Warning, fmt("Unable to find asset {}"), id);
|
||||
Log.report(logvisor::Warning, FMT_STRING("Unable to find asset {}"), id);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ CPakFile* CResLoader::FindResourceForLoad(CAssetId id) {
|
||||
}
|
||||
}
|
||||
|
||||
Log.report(logvisor::Error, fmt("Unable to find asset {}"), id);
|
||||
Log.report(logvisor::Error, FMT_STRING("Unable to find asset {}"), id);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,26 +4,30 @@
|
||||
|
||||
namespace urde {
|
||||
CScannableObjectInfo::CScannableObjectInfo(CInputStream& in, CAssetId resId) : x0_scannableObjectId(resId) {
|
||||
u32 version = in.readUint32Big();
|
||||
const u32 version = in.readUint32Big();
|
||||
Load(in, version);
|
||||
|
||||
for (u32 i = 0; i < x14_buckets.size(); ++i) {
|
||||
x14_buckets[i].x4_appearanceRange *= x8_totalDownloadTime;
|
||||
for (auto& bucket : x14_buckets) {
|
||||
bucket.x4_appearanceRange *= x8_totalDownloadTime;
|
||||
}
|
||||
|
||||
float appearanceOffset = g_tweakGui->GetScanAppearanceDuration();
|
||||
for (u32 i = 0; i < x14_buckets.size(); ++i) {
|
||||
if (x14_buckets[i].x8_imagePos != -1) {
|
||||
x8_totalDownloadTime += appearanceOffset;
|
||||
for (u32 j = i; j < x14_buckets.size(); j++)
|
||||
x14_buckets[j].x4_appearanceRange += appearanceOffset;
|
||||
const float appearanceOffset = g_tweakGui->GetScanAppearanceDuration();
|
||||
for (size_t i = 0; i < x14_buckets.size(); ++i) {
|
||||
if (x14_buckets[i].x8_imagePos == UINT32_MAX) {
|
||||
continue;
|
||||
}
|
||||
|
||||
x8_totalDownloadTime += appearanceOffset;
|
||||
for (size_t j = i; j < x14_buckets.size(); j++) {
|
||||
x14_buckets[j].x4_appearanceRange += appearanceOffset;
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < x14_buckets.size() - 1; ++i) {
|
||||
for (u32 j = i + 1; j < x14_buckets.size(); ++j) {
|
||||
if (x14_buckets[i].x8_imagePos == x14_buckets[j].x8_imagePos && x14_buckets[i].x8_imagePos != -1)
|
||||
x14_buckets[j].x8_imagePos = -1;
|
||||
for (size_t i = 0; i < x14_buckets.size() - 1; ++i) {
|
||||
for (size_t j = i + 1; j < x14_buckets.size(); ++j) {
|
||||
if (x14_buckets[i].x8_imagePos == x14_buckets[j].x8_imagePos && x14_buckets[i].x8_imagePos != UINT32_MAX) {
|
||||
x14_buckets[j].x8_imagePos = UINT32_MAX;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,18 +36,20 @@ void CScannableObjectInfo::Load(CInputStream& in, u32 version) {
|
||||
in.readUint32Big();
|
||||
in.readUint32Big();
|
||||
x4_stringId = in.readUint32Big();
|
||||
if (version < 4)
|
||||
if (version < 4) {
|
||||
x8_totalDownloadTime = in.readFloatBig();
|
||||
else {
|
||||
u32 scanSpeed = in.readUint32Big();
|
||||
} else {
|
||||
const u32 scanSpeed = in.readUint32Big();
|
||||
x8_totalDownloadTime = g_tweakGui->GetScanSpeed(scanSpeed);
|
||||
}
|
||||
xc_category = in.readUint32Big();
|
||||
if (version > 4)
|
||||
if (version > 4) {
|
||||
x10_important = in.readBool();
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < 4; i++)
|
||||
for (size_t i = 0; i < x14_buckets.capacity(); i++) {
|
||||
x14_buckets.emplace_back(in, version);
|
||||
}
|
||||
}
|
||||
|
||||
CScannableObjectInfo::SBucket::SBucket(CInputStream& in, u32 version) {
|
||||
|
||||
@@ -12,6 +12,8 @@ class CScannableObjectInfo {
|
||||
public:
|
||||
enum class EPanelType {};
|
||||
|
||||
static constexpr size_t NumBuckets = 4;
|
||||
|
||||
struct SBucket {
|
||||
CAssetId x0_texture;
|
||||
float x4_appearanceRange = 0.f;
|
||||
@@ -29,14 +31,14 @@ private:
|
||||
float x8_totalDownloadTime = 0.f;
|
||||
u32 xc_category = 0;
|
||||
bool x10_important = false;
|
||||
rstl::reserved_vector<SBucket, 4> x14_buckets;
|
||||
rstl::reserved_vector<SBucket, NumBuckets> x14_buckets;
|
||||
|
||||
public:
|
||||
CScannableObjectInfo(CInputStream&, CAssetId);
|
||||
CAssetId GetScannableObjectId() const { return x0_scannableObjectId; }
|
||||
CAssetId GetStringTableId() const { return x4_stringId; }
|
||||
float GetTotalDownloadTime() const { return x8_totalDownloadTime; }
|
||||
const SBucket& GetBucket(s32 idx) const { return x14_buckets[idx]; }
|
||||
const SBucket& GetBucket(size_t idx) const { return x14_buckets[idx]; }
|
||||
u32 GetCategory() const { return xc_category; }
|
||||
bool IsImportant() const { return x10_important; }
|
||||
};
|
||||
|
||||
@@ -62,7 +62,14 @@ CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>& relayTracker,
|
||||
, x8bc_relayTracker(relayTracker)
|
||||
, x8c0_mapWorldInfo(mwInfo)
|
||||
, x8c4_worldTransManager(wtMgr)
|
||||
, x8c8_worldLayerState(layerState) {
|
||||
, x8c8_worldLayerState(layerState)
|
||||
, xf94_24_readyToRender(false)
|
||||
, xf94_25_quitGame(false)
|
||||
, xf94_26_generatingObject(false)
|
||||
, xf94_27_inMapScreen(false)
|
||||
, xf94_28_inSaveUI(false)
|
||||
, xf94_29_cinematicPause(false)
|
||||
, xf94_30_fullThreat(false) {
|
||||
x86c_stateManagerContainer = std::make_unique<CStateManagerContainer>();
|
||||
x870_cameraManager = &x86c_stateManagerContainer->x0_cameraManager;
|
||||
x874_sortedListManager = &x86c_stateManagerContainer->x3c0_sortedListManager;
|
||||
@@ -410,12 +417,7 @@ void CStateManager::SetupParticleHook(const CActor& actor) const {
|
||||
void CStateManager::MurderScriptInstanceNames() { xb40_uniqueInstanceNames.clear(); }
|
||||
|
||||
std::string CStateManager::HashInstanceName(CInputStream& in) {
|
||||
if (hecl::com_developer && hecl::com_developer->toBoolean()) {
|
||||
return in.readString();
|
||||
} else {
|
||||
while (in.readByte() != 0) {};
|
||||
return "";
|
||||
}
|
||||
return in.readString();
|
||||
}
|
||||
|
||||
void CStateManager::SetActorAreaId(CActor& actor, TAreaId aid) {
|
||||
@@ -510,6 +512,7 @@ void CStateManager::BuildDynamicLightListForWorld() {
|
||||
}
|
||||
|
||||
void CStateManager::DrawDebugStuff() const {
|
||||
#ifndef NDEBUG
|
||||
for (CEntity* ent : GetActorObjectList()) {
|
||||
if (TCastToPtr<CPatterned> ai = ent) {
|
||||
if (CPathFindSearch* path = ai->GetSearchPath()) {
|
||||
@@ -517,6 +520,7 @@ void CStateManager::DrawDebugStuff() const {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CStateManager::RenderCamerasAndAreaLights() {
|
||||
@@ -909,7 +913,7 @@ void CStateManager::DrawActorCubeFaces(CActor& actor, int& cubeInst) const {
|
||||
}
|
||||
|
||||
for (int f = 0; f < 6; ++f) {
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CStateManager::DrawActorCubeFaces [{}] {} {} {}"), f,
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CStateManager::DrawActorCubeFaces [{}] {} {} {}"), f,
|
||||
actor.GetUniqueId(), actor.GetEditorId(), actor.GetName())
|
||||
.c_str(),
|
||||
zeus::skOrange);
|
||||
@@ -1204,7 +1208,7 @@ void CStateManager::RecursiveDrawTree(TUniqueId node) {
|
||||
void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMessage msg) {
|
||||
if (dest && !dest->x30_26_scriptingBlocked) {
|
||||
if (sm_logScripting && sm_logScripting->toBoolean())
|
||||
LogModule.report(logvisor::Info, fmt("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
|
||||
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
|
||||
dest->GetName(), dest->GetUniqueId());
|
||||
dest->AcceptScriptMsg(msg, src, *this);
|
||||
}
|
||||
@@ -1219,7 +1223,7 @@ void CStateManager::SendScriptMsgAlways(TUniqueId dest, TUniqueId src, EScriptOb
|
||||
CEntity* dst = ObjectById(dest);
|
||||
if (dst) {
|
||||
if (sm_logScripting && sm_logScripting->toBoolean())
|
||||
LogModule.report(logvisor::Info, fmt("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
|
||||
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
|
||||
dst->GetName(), dst->GetUniqueId());
|
||||
dst->AcceptScriptMsg(msg, src, *this);
|
||||
}
|
||||
@@ -1275,7 +1279,7 @@ void CStateManager::FreeScriptObject(TUniqueId id) {
|
||||
}
|
||||
|
||||
if (sm_logScripting && sm_logScripting->toBoolean())
|
||||
LogModule.report(logvisor::Info, fmt("Removed '{}'"), ent->GetName());
|
||||
LogModule.report(logvisor::Info, FMT_STRING("Removed '{}'"), ent->GetName());
|
||||
}
|
||||
|
||||
std::pair<const SScriptObjectStream*, TEditorId> CStateManager::GetBuildForScript(TEditorId id) const {
|
||||
@@ -1367,16 +1371,16 @@ std::pair<TEditorId, TUniqueId> CStateManager::LoadScriptObject(TAreaId aid, ESc
|
||||
|
||||
u32 readAmt = in.position() - startPos;
|
||||
if (readAmt > length)
|
||||
LogModule.report(logvisor::Fatal, fmt("Script object overread while reading {}"), ScriptObjectTypeToStr(type));
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING("Script object overread while reading {}"), ScriptObjectTypeToStr(type));
|
||||
u32 leftover = length - readAmt;
|
||||
for (u32 i = 0; i < leftover; ++i)
|
||||
in.readByte();
|
||||
|
||||
if (error || ent == nullptr) {
|
||||
LogModule.report(logvisor::Error, fmt("Script load error while loading {}"), ScriptObjectTypeToStr(type));
|
||||
LogModule.report(logvisor::Error, FMT_STRING("Script load error while loading {}"), ScriptObjectTypeToStr(type));
|
||||
return {kInvalidEditorId, kInvalidUniqueId};
|
||||
} else {
|
||||
LogModule.report(logvisor::Info, fmt("Loaded {} in area {}"), ent->GetName(), ent->GetAreaIdAlways());
|
||||
LogModule.report(logvisor::Info, FMT_STRING("Loaded {} in area {}"), ent->GetName(), ent->GetAreaIdAlways());
|
||||
return {id, ent->GetUniqueId()};
|
||||
}
|
||||
}
|
||||
@@ -1421,11 +1425,14 @@ void CStateManager::InformListeners(const zeus::CVector3f& pos, EListenNoiseType
|
||||
|
||||
void CStateManager::ApplyKnockBack(CActor& actor, const CDamageInfo& info, const CDamageVulnerability& vuln,
|
||||
const zeus::CVector3f& pos, float dampen) {
|
||||
if (vuln.GetVulnerability(info.GetWeaponMode(), false) == EVulnerability::Deflect)
|
||||
if (vuln.GetVulnerability(info.GetWeaponMode(), false) == EVulnerability::Deflect) {
|
||||
return;
|
||||
}
|
||||
|
||||
CHealthInfo* hInfo = actor.HealthInfo(*this);
|
||||
if (!hInfo)
|
||||
if (hInfo == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
float dampedPower = (1.f - dampen) * info.GetKnockBackPower();
|
||||
if (TCastToPtr<CPlayer> player = actor) {
|
||||
@@ -1439,30 +1446,34 @@ void CStateManager::ApplyKnockBack(CActor& actor, const CDamageInfo& info, const
|
||||
if (TCastToPtr<CPhysicsActor> physActor = actor) {
|
||||
zeus::CVector3f kbVec = pos * (dampedPower - hInfo->GetKnockbackResistance()) * physActor->GetMass() * 1.5f;
|
||||
if (physActor->GetMaterialList().HasMaterial(EMaterialTypes::Immovable) ||
|
||||
!physActor->GetMaterialList().HasMaterial(EMaterialTypes::Grass))
|
||||
!physActor->GetMaterialList().HasMaterial(EMaterialTypes::Solid)) {
|
||||
return;
|
||||
}
|
||||
physActor->ApplyImpulseWR(kbVec, zeus::CAxisAngle());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ai)
|
||||
if (ai) {
|
||||
ai->KnockBack(pos, *this, info, dampen == 0.f ? EKnockBackType::Direct : EKnockBackType::Radius, false,
|
||||
dampedPower);
|
||||
}
|
||||
}
|
||||
|
||||
void CStateManager::KnockBackPlayer(CPlayer& player, const zeus::CVector3f& pos, float power, float resistance) {
|
||||
if (player.GetMaterialList().HasMaterial(EMaterialTypes::Immovable))
|
||||
if (player.GetMaterialList().HasMaterial(EMaterialTypes::Immovable)) {
|
||||
return;
|
||||
}
|
||||
|
||||
float usePower;
|
||||
if (player.GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed) {
|
||||
usePower = power * 1000.f;
|
||||
CPlayer::ESurfaceRestraints surface =
|
||||
player.x2b0_outOfWaterTicks == 2 ? player.x2ac_surfaceRestraint : CPlayer::ESurfaceRestraints::Water;
|
||||
if (surface != CPlayer::ESurfaceRestraints::Normal && player.GetOrbitState() == CPlayer::EPlayerOrbitState::NoOrbit)
|
||||
if (surface != CPlayer::ESurfaceRestraints::Normal && player.GetOrbitState() == CPlayer::EPlayerOrbitState::NoOrbit) {
|
||||
usePower /= 7.f;
|
||||
}
|
||||
} else {
|
||||
usePower = power * 500.f;
|
||||
}
|
||||
@@ -1489,15 +1500,17 @@ void CStateManager::ApplyDamageToWorld(TUniqueId damager, const CActor& actor, c
|
||||
|
||||
bool bomb = false;
|
||||
TCastToConstPtr<CWeapon> weapon = actor;
|
||||
if (weapon)
|
||||
if (weapon) {
|
||||
bomb = True(weapon->GetAttribField() & (EProjectileAttrib::Bombs | EProjectileAttrib::PowerBombs));
|
||||
}
|
||||
|
||||
rstl::reserved_vector<TUniqueId, 1024> nearList;
|
||||
BuildNearList(nearList, aabb, filter, &actor);
|
||||
for (TUniqueId id : nearList) {
|
||||
CEntity* ent = ObjectById(id);
|
||||
if (!ent)
|
||||
if (ent == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
TCastToPtr<CPlayer> player = ent;
|
||||
if (bomb && player) {
|
||||
@@ -1506,20 +1519,24 @@ void CStateManager::ApplyDamageToWorld(TUniqueId damager, const CActor& actor, c
|
||||
MP1::CSamusHud::DisplayHudMemo(u"", CHUDMemoParms{0.f, true, true, true});
|
||||
player->UnFreeze(*this);
|
||||
} else {
|
||||
if ((weapon->GetAttribField() & EProjectileAttrib::Bombs) == EProjectileAttrib::Bombs)
|
||||
if ((weapon->GetAttribField() & EProjectileAttrib::Bombs) == EProjectileAttrib::Bombs) {
|
||||
player->BombJump(pos, *this);
|
||||
}
|
||||
}
|
||||
} else if (ent->GetUniqueId() != damager) {
|
||||
TestBombHittingWater(actor, pos, static_cast<CActor&>(*ent));
|
||||
if (TestRayDamage(pos, static_cast<CActor&>(*ent), nearList))
|
||||
if (TestRayDamage(pos, static_cast<CActor&>(*ent), nearList)) {
|
||||
ApplyRadiusDamage(actor, pos, static_cast<CActor&>(*ent), info);
|
||||
}
|
||||
}
|
||||
|
||||
if (TCastToPtr<CWallCrawlerSwarm> swarm = ent)
|
||||
if (TCastToPtr<CWallCrawlerSwarm> swarm = ent) {
|
||||
swarm->ApplyRadiusDamage(pos, info, *this);
|
||||
}
|
||||
|
||||
if (TCastToPtr<CSnakeWeedSwarm> swarm = ent)
|
||||
if (TCastToPtr<CSnakeWeedSwarm> swarm = ent) {
|
||||
swarm->ApplyRadiusDamage(pos, info, *this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1548,28 +1565,29 @@ void CStateManager::ApplyRadiusDamage(const CActor& a1, const zeus::CVector3f& p
|
||||
((bounds = a2.GetTouchBounds()) &&
|
||||
CCollidableSphere::Sphere_AABox_Bool(zeus::CSphere{pos, info.GetRadius()}, *bounds))) {
|
||||
float rad = info.GetRadius();
|
||||
if (rad > FLT_EPSILON)
|
||||
if (rad > FLT_EPSILON) {
|
||||
rad = delta.magnitude() / rad;
|
||||
else
|
||||
} else {
|
||||
rad = 0.f;
|
||||
if (rad > 0.f)
|
||||
}
|
||||
if (rad > 0.f) {
|
||||
delta.normalize();
|
||||
}
|
||||
|
||||
bool alive = false;
|
||||
if (CHealthInfo* hInfo = a2.HealthInfo(*this))
|
||||
if (hInfo->GetHP() > 0.f)
|
||||
if (CHealthInfo* hInfo = a2.HealthInfo(*this)) {
|
||||
if (hInfo->GetHP() > 0.f) {
|
||||
alive = true;
|
||||
}
|
||||
}
|
||||
|
||||
const CDamageVulnerability* vuln;
|
||||
if (rad > 0.f)
|
||||
vuln = a2.GetDamageVulnerability(pos, delta, info);
|
||||
else
|
||||
vuln = a2.GetDamageVulnerability();
|
||||
const CDamageVulnerability* vuln = rad > 0.f ? a2.GetDamageVulnerability(pos, delta, info) : a2.GetDamageVulnerability();
|
||||
|
||||
if (vuln->WeaponHurts(info.GetWeaponMode(), true)) {
|
||||
float dam = info.GetRadiusDamage(*vuln);
|
||||
if (dam > 0.f)
|
||||
if (dam > 0.f) {
|
||||
ApplyLocalDamage(pos, delta, a2, dam, info.GetWeaponMode());
|
||||
}
|
||||
a2.SendScriptMsgs(EScriptObjectState::Damage, *this, EScriptObjectMessage::None);
|
||||
SendScriptMsg(&a2, a1.GetUniqueId(), EScriptObjectMessage::Damage);
|
||||
} else {
|
||||
@@ -1577,8 +1595,9 @@ void CStateManager::ApplyRadiusDamage(const CActor& a1, const zeus::CVector3f& p
|
||||
SendScriptMsg(&a2, a1.GetUniqueId(), EScriptObjectMessage::InvulnDamage);
|
||||
}
|
||||
|
||||
if (alive && info.GetKnockBackPower() > 0.f)
|
||||
if (alive && info.GetKnockBackPower() > 0.f) {
|
||||
ApplyKnockBack(a2, info, *vuln, (a2.GetTranslation() - a1.GetTranslation()).normalized(), rad);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2464,7 +2483,7 @@ void CStateManager::AddObject(CEntity& ent) {
|
||||
}
|
||||
|
||||
if (sm_logScripting && sm_logScripting->toBoolean())
|
||||
LogModule.report(logvisor::Info, fmt("Added '{}'"), ent.GetName());
|
||||
LogModule.report(logvisor::Info, FMT_STRING("Added '{}'"), ent.GetName());
|
||||
}
|
||||
|
||||
void CStateManager::AddObject(CEntity* ent) {
|
||||
@@ -2509,7 +2528,7 @@ TUniqueId CStateManager::AllocateUniqueId() {
|
||||
ourIndex = x0_nextFreeIndex;
|
||||
x0_nextFreeIndex = (x0_nextFreeIndex + 1) & 0x3ff;
|
||||
if (x0_nextFreeIndex == lastIndex)
|
||||
LogModule.report(logvisor::Fatal, fmt("Object List Full!"));
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING("Object List Full!"));
|
||||
} while (GetAllObjectList().GetObjectByIndex(ourIndex) != nullptr);
|
||||
|
||||
x8_idArr[ourIndex] = (x8_idArr[ourIndex] + 1) & 0x3f;
|
||||
@@ -2558,7 +2577,7 @@ std::pair<u32, u32> CStateManager::CalculateScanCompletionRate() const {
|
||||
void CStateManager::SetBossParams(TUniqueId bossId, float maxEnergy, u32 stringIdx) {
|
||||
xf18_bossId = bossId;
|
||||
xf1c_totalBossEnergy = maxEnergy;
|
||||
xf20_bossStringIdx = stringIdx;
|
||||
xf20_bossStringIdx = stringIdx - (g_Main->IsUSA() && !g_Main->IsTrilogy() ? 0 : 6);
|
||||
}
|
||||
|
||||
float CStateManager::IntegrateVisorFog(float f) const {
|
||||
|
||||
@@ -202,19 +202,13 @@ private:
|
||||
CAssetId xf88_;
|
||||
float xf8c_ = 0.f;
|
||||
EStateManagerTransition xf90_deferredTransition = EStateManagerTransition::InGame;
|
||||
|
||||
union {
|
||||
struct {
|
||||
bool xf94_24_readyToRender : 1;
|
||||
bool xf94_25_quitGame : 1;
|
||||
bool xf94_26_generatingObject : 1;
|
||||
bool xf94_27_inMapScreen : 1;
|
||||
bool xf94_28_inSaveUI : 1;
|
||||
bool xf94_29_cinematicPause : 1;
|
||||
bool xf94_30_fullThreat : 1;
|
||||
};
|
||||
u32 xf94_ = 0;
|
||||
};
|
||||
bool xf94_24_readyToRender : 1;
|
||||
bool xf94_25_quitGame : 1;
|
||||
bool xf94_26_generatingObject : 1;
|
||||
bool xf94_27_inMapScreen : 1;
|
||||
bool xf94_28_inSaveUI : 1;
|
||||
bool xf94_29_cinematicPause : 1;
|
||||
bool xf94_30_fullThreat : 1;
|
||||
|
||||
CColoredQuadFilter m_deathWhiteout{EFilterType::Add};
|
||||
CColoredQuadFilter m_escapeWhiteout{EFilterType::Add};
|
||||
|
||||
@@ -12,13 +12,17 @@ public:
|
||||
double report(const char* name) const {
|
||||
double t = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - m_start).count() / 1000000.0;
|
||||
fmt::print(fmt("{} {}\n"), name, t);
|
||||
#ifndef NDEBUG
|
||||
fmt::print(FMT_STRING("{} {}\n"), name, t);
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
double reportReset(const char* name) {
|
||||
std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
|
||||
double t = std::chrono::duration_cast<std::chrono::microseconds>(now - m_start).count() / 1000000.0;
|
||||
fmt::print(fmt("{} {}\n"), name, t);
|
||||
#ifndef NDEBUG
|
||||
fmt::print(FMT_STRING("{} {}\n"), name, t);
|
||||
#endif
|
||||
m_start = now;
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ void CBallCamera::SetState(EBallCameraState state, CStateManager& mgr) {
|
||||
x400_state = state;
|
||||
}
|
||||
|
||||
static const CMaterialFilter BallCameraFilter = CMaterialFilter::MakeIncludeExclude(
|
||||
constexpr CMaterialFilter BallCameraFilter = CMaterialFilter::MakeIncludeExclude(
|
||||
{EMaterialTypes::Solid}, {EMaterialTypes::ProjectilePassthrough, EMaterialTypes::Player, EMaterialTypes::Character,
|
||||
EMaterialTypes::CameraPassthrough});
|
||||
|
||||
|
||||
@@ -21,9 +21,15 @@
|
||||
namespace urde {
|
||||
float CCameraManager::sFirstPersonFOV = 55.f;
|
||||
|
||||
CCameraManager::CCameraManager(TUniqueId curCameraId) : x0_curCameraId(curCameraId) {
|
||||
CSfxManager::AddListener(CSfxManager::ESfxChannels::Game, zeus::skZero3f, zeus::skZero3f,
|
||||
{1.f, 0.f, 0.f}, {0.f, 0.f, 1.f}, 50.f, 50.f, 1000.f, 1, 1.f);
|
||||
CCameraManager::CCameraManager(TUniqueId curCameraId)
|
||||
: x0_curCameraId(curCameraId)
|
||||
, xa0_24_pendingRumble(false)
|
||||
, xa0_25_rumbling(false)
|
||||
, xa0_26_inWater(false)
|
||||
, x3b8_24_(false)
|
||||
, x3b8_25_(false) {
|
||||
CSfxManager::AddListener(CSfxManager::ESfxChannels::Game, zeus::skZero3f, zeus::skZero3f, {1.f, 0.f, 0.f},
|
||||
{0.f, 0.f, 1.f}, 50.f, 50.f, 1000.f, 1, 1.f);
|
||||
sFirstPersonFOV = g_tweakGame->GetFirstPersonFOV();
|
||||
}
|
||||
|
||||
@@ -398,8 +404,7 @@ void CCameraManager::UpdateCameraHints(float, CStateManager& mgr) {
|
||||
}
|
||||
} else {
|
||||
if (const TCastToConstPtr<CActor> act = mgr.GetObjectById(bestHint->GetFirstHelper())) {
|
||||
zeus::CVector3f ballPos = mgr.GetPlayer().GetBallPosition();
|
||||
zeus::CVector3f f26 = act->GetTranslation() - ballPos;
|
||||
const zeus::CVector3f f26 = act->GetTranslation() - mgr.GetPlayer().GetBallPosition();
|
||||
zeus::CVector3f ballToHelper = f26;
|
||||
if (ballToHelper.canBeNormalized()) {
|
||||
ballToHelper.normalize();
|
||||
|
||||
@@ -40,16 +40,9 @@ class CCameraManager {
|
||||
float x94_fogDensityFactor = 1.f;
|
||||
float x98_fogDensitySpeed = 0.f;
|
||||
float x9c_fogDensityFactorTarget = 1.f;
|
||||
|
||||
union {
|
||||
struct {
|
||||
bool xa0_24_pendingRumble : 1;
|
||||
bool xa0_25_rumbling : 1;
|
||||
bool xa0_26_inWater : 1;
|
||||
};
|
||||
u8 _dummy1 = 0;
|
||||
};
|
||||
|
||||
bool xa0_24_pendingRumble : 1;
|
||||
bool xa0_25_rumbling : 1;
|
||||
bool xa0_26_inWater : 1;
|
||||
TUniqueId xa2_spindleCamId = kInvalidUniqueId;
|
||||
TUniqueId xa4_pathCamId = kInvalidUniqueId;
|
||||
TUniqueId xa6_camHintId = kInvalidUniqueId;
|
||||
@@ -57,15 +50,8 @@ class CCameraManager {
|
||||
rstl::reserved_vector<std::pair<s32, TUniqueId>, 64> xac_cameraHints;
|
||||
rstl::reserved_vector<TUniqueId, 64> x2b0_inactiveCameraHints;
|
||||
rstl::reserved_vector<TUniqueId, 64> x334_activeCameraHints;
|
||||
|
||||
union {
|
||||
struct {
|
||||
bool x3b8_24_ : 1;
|
||||
bool x3b8_25_ : 1;
|
||||
};
|
||||
u8 _dummy2;
|
||||
};
|
||||
|
||||
bool x3b8_24_ : 1;
|
||||
bool x3b8_25_ : 1;
|
||||
float x3bc_curFov = 60.f;
|
||||
|
||||
void SetPathCamera(TUniqueId id, CStateManager& mgr);
|
||||
|
||||
@@ -100,29 +100,29 @@ float CCameraShakeData::GetMaxFMComponent() const {
|
||||
}
|
||||
|
||||
CCameraShakeData CCameraShakeData::LoadCameraShakeData(CInputStream& in) {
|
||||
float xMag = in.readFloatBig();
|
||||
const float xMag = in.readFloatBig();
|
||||
in.readFloatBig();
|
||||
float yMag = in.readFloatBig();
|
||||
const float yMag = in.readFloatBig();
|
||||
in.readFloatBig();
|
||||
float zMag = in.readFloatBig();
|
||||
const float zMag = in.readFloatBig();
|
||||
in.readFloatBig();
|
||||
float duration = in.readFloatBig();
|
||||
const float duration = in.readFloatBig();
|
||||
|
||||
SCameraShakePoint xAM(0, 0.f, 0.f, duration, 2.f * xMag);
|
||||
SCameraShakePoint yAM(0, 0.f, 0.f, duration, 2.f * yMag);
|
||||
SCameraShakePoint zAM(0, 0.f, 0.f, duration, 2.f * zMag);
|
||||
SCameraShakePoint xFM(0, 0.f, 0.f, 0.5f * duration, 3.f);
|
||||
SCameraShakePoint yFM(0, 0.f, 0.f, 0.5f * duration, 0.f);
|
||||
SCameraShakePoint zFM(0, 0.f, 0.f, 0.5f * duration, 3.f);
|
||||
const SCameraShakePoint xAM(false, 0.f, 0.f, duration, 2.f * xMag);
|
||||
const SCameraShakePoint yAM(false, 0.f, 0.f, duration, 2.f * yMag);
|
||||
const SCameraShakePoint zAM(false, 0.f, 0.f, duration, 2.f * zMag);
|
||||
const SCameraShakePoint xFM(false, 0.f, 0.f, 0.5f * duration, 3.f);
|
||||
const SCameraShakePoint yFM(false, 0.f, 0.f, 0.5f * duration, 0.f);
|
||||
const SCameraShakePoint zFM(false, 0.f, 0.f, 0.5f * duration, 3.f);
|
||||
|
||||
CCameraShakerComponent shakerX(1, xAM, xFM);
|
||||
CCameraShakerComponent shakerY;
|
||||
CCameraShakerComponent shakerZ(1, zAM, zFM);
|
||||
const CCameraShakerComponent shakerX(true, xAM, xFM);
|
||||
const CCameraShakerComponent shakerY;
|
||||
const CCameraShakerComponent shakerZ(true, zAM, zFM);
|
||||
|
||||
return {duration, 100.f, 0, zeus::skZero3f, shakerX, shakerY, shakerZ};
|
||||
}
|
||||
|
||||
const CCameraShakeData CCameraShakeData::skChargedShotCameraShakeData{
|
||||
constexpr CCameraShakeData CCameraShakeData::skChargedShotCameraShakeData{
|
||||
0.3f,
|
||||
100.f,
|
||||
0,
|
||||
|
||||
@@ -79,7 +79,7 @@ void CPathCamera::ProcessInput(const CFinalInput&, CStateManager& mgr) {
|
||||
// Empty
|
||||
}
|
||||
|
||||
static const CMaterialFilter kLineOfSightFilter =
|
||||
constexpr CMaterialFilter kLineOfSightFilter =
|
||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::ProjectilePassthrough});
|
||||
|
||||
void CPathCamera::Reset(const zeus::CTransform&, CStateManager& mgr) {
|
||||
|
||||
@@ -18,20 +18,22 @@ s32 CActorLights::sFrameSchedulerCount = 0;
|
||||
CActorLights::CActorLights(u32 areaUpdateFramePeriod, const zeus::CVector3f& actorPosBias, int maxDynamicLights,
|
||||
int maxAreaLights, bool ambientChannelOverflow, bool layer2, bool disableWorldLights,
|
||||
float positionUpdateThreshold)
|
||||
: x2a8_areaUpdateFramePeriod(areaUpdateFramePeriod)
|
||||
: x298_24_dirty(true)
|
||||
, x298_25_castShadows(true)
|
||||
, x298_26_hasAreaLights(false)
|
||||
, x298_27_findShadowLight(false)
|
||||
, x298_28_inArea(!disableWorldLights && maxAreaLights > 0)
|
||||
, x298_29_ambienceGenerated(ambientChannelOverflow)
|
||||
, x298_30_layer2(layer2)
|
||||
, x298_31_disableWorldLights(disableWorldLights)
|
||||
, x299_24_inBrightLight(true)
|
||||
, x299_25_useBrightLightLag(false)
|
||||
, x299_26_ambientOnly(false)
|
||||
, x2a8_areaUpdateFramePeriod(areaUpdateFramePeriod)
|
||||
, x2ac_actorPosBias(actorPosBias)
|
||||
, x2b8_maxAreaLights(maxAreaLights)
|
||||
, x2bc_maxDynamicLights(maxDynamicLights)
|
||||
, x2cc_actorPositionDeltaUpdateThreshold(positionUpdateThreshold * positionUpdateThreshold) {
|
||||
x298_24_dirty = true;
|
||||
x298_25_castShadows = true;
|
||||
|
||||
x298_28_inArea = !disableWorldLights && maxAreaLights > 0;
|
||||
x298_29_ambienceGenerated = ambientChannelOverflow;
|
||||
x298_30_layer2 = layer2;
|
||||
x298_31_disableWorldLights = disableWorldLights;
|
||||
x299_24_inBrightLight = true;
|
||||
|
||||
sFrameSchedulerCount++;
|
||||
sFrameSchedulerCount &= 7;
|
||||
}
|
||||
|
||||
@@ -20,23 +20,17 @@ class CActorLights {
|
||||
std::vector<CLight> x144_dynamicLights;
|
||||
zeus::CColor x288_ambientColor = zeus::skBlack;
|
||||
TAreaId x294_aid = kInvalidAreaId;
|
||||
|
||||
union {
|
||||
struct {
|
||||
bool x298_24_dirty : 1;
|
||||
bool x298_25_castShadows : 1;
|
||||
bool x298_26_hasAreaLights : 1;
|
||||
bool x298_27_findShadowLight : 1;
|
||||
bool x298_28_inArea : 1;
|
||||
bool x298_29_ambienceGenerated : 1;
|
||||
bool x298_30_layer2 : 1;
|
||||
bool x298_31_disableWorldLights : 1;
|
||||
bool x299_24_inBrightLight : 1;
|
||||
bool x299_25_useBrightLightLag : 1;
|
||||
bool x299_26_ambientOnly : 1;
|
||||
};
|
||||
u16 _dummy = 0;
|
||||
};
|
||||
bool x298_24_dirty : 1;
|
||||
bool x298_25_castShadows : 1;
|
||||
bool x298_26_hasAreaLights : 1;
|
||||
bool x298_27_findShadowLight : 1;
|
||||
bool x298_28_inArea : 1;
|
||||
bool x298_29_ambienceGenerated : 1;
|
||||
bool x298_30_layer2 : 1;
|
||||
bool x298_31_disableWorldLights : 1;
|
||||
bool x299_24_inBrightLight : 1;
|
||||
bool x299_25_useBrightLightLag : 1;
|
||||
bool x299_26_ambientOnly : 1;
|
||||
bool x29a_findNearestDynamicLights = false;
|
||||
s32 x29c_shadowLightArrIdx = -1;
|
||||
s32 x2a0_shadowLightIdx = -1;
|
||||
|
||||
@@ -21,7 +21,7 @@ void CAnimFormatUnion::SubConstruct(u8* storage, EAnimFormat fmt, CInputStream&
|
||||
new (storage) CFBStreamedCompression(in, store, true);
|
||||
break;
|
||||
default:
|
||||
Log.report(logvisor::Fatal, fmt("unable to read ANIM format {}"), int(fmt));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable to read ANIM format {}"), int(fmt));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,9 +45,9 @@ CAnimData::CAnimData(CAssetId id, const CCharacterInfo& character, int defaultAn
|
||||
const std::weak_ptr<CAnimSysContext>& ctx, std::shared_ptr<CAnimationManager> animMgr,
|
||||
std::shared_ptr<CTransitionManager> transMgr, TLockedToken<CCharacterFactory> charFactory,
|
||||
int drawInstCount)
|
||||
: x0_charFactory(std::move(charFactory))
|
||||
: x0_charFactory(charFactory)
|
||||
, xc_charInfo(character)
|
||||
, xcc_layoutData(std::move(layout))
|
||||
, xcc_layoutData(layout)
|
||||
, xd8_modelData(std::move(model))
|
||||
, xfc_animCtx(ctx.lock())
|
||||
, x100_animMgr(std::move(animMgr))
|
||||
@@ -55,6 +55,14 @@ CAnimData::CAnimData(CAssetId id, const CCharacterInfo& character, int defaultAn
|
||||
, x1fc_transMgr(std::move(transMgr))
|
||||
, x204_charIdx(charIdx)
|
||||
, x208_defaultAnim(defaultAnim)
|
||||
, x220_24_animating(false)
|
||||
, x220_25_loop(false)
|
||||
, x220_26_aligningPos(false)
|
||||
, x220_27_(false)
|
||||
, x220_28_(false)
|
||||
, x220_29_animationJustStarted(false)
|
||||
, x220_30_poseBuilt(false)
|
||||
, x220_31_poseCached(false)
|
||||
, x224_pose(layout->GetSegIdList().GetList().size())
|
||||
, x2fc_poseBuilder(CLayoutDescription{layout})
|
||||
, m_drawInstCount(drawInstCount) {
|
||||
@@ -78,7 +86,7 @@ CAnimData::CAnimData(CAssetId id, const CCharacterInfo& character, int defaultAn
|
||||
|
||||
if (defaultAnim == -1) {
|
||||
defaultAnim = 0;
|
||||
Log.report(logvisor::Warning, fmt("Character {} has invalid initial animation, so defaulting to first."),
|
||||
Log.report(logvisor::Warning, FMT_STRING("Character {} has invalid initial animation, so defaulting to first."),
|
||||
character.GetCharacterName());
|
||||
}
|
||||
|
||||
@@ -135,11 +143,13 @@ SAdvancementDeltas CAnimData::AdvanceAdditiveAnims(float dt) {
|
||||
std::shared_ptr<CAnimTreeNode>& anim = additive.second.GetAnim();
|
||||
if (additive.second.IsActive()) {
|
||||
while (time.GreaterThanZero() && std::fabs(time.GetSeconds()) >= 0.00001f) {
|
||||
x210_passedIntCount += anim->GetInt32POIList(time, g_Int32POINodes.data(), 16, x210_passedIntCount, 0);
|
||||
x20c_passedBoolCount += anim->GetBoolPOIList(time, g_BoolPOINodes.data(), 8, x20c_passedBoolCount, 0);
|
||||
x210_passedIntCount +=
|
||||
u32(anim->GetInt32POIList(time, g_Int32POINodes.data(), g_Int32POINodes.size(), x210_passedIntCount, 0));
|
||||
x20c_passedBoolCount +=
|
||||
u32(anim->GetBoolPOIList(time, g_BoolPOINodes.data(), g_BoolPOINodes.size(), x20c_passedBoolCount, 0));
|
||||
x214_passedParticleCount +=
|
||||
anim->GetParticlePOIList(time, g_ParticlePOINodes.data(), 8, x214_passedParticleCount, 0);
|
||||
x218_passedSoundCount += anim->GetSoundPOIList(time, g_SoundPOINodes.data(), 8, x218_passedSoundCount, 0);
|
||||
u32(anim->GetParticlePOIList(time, g_ParticlePOINodes.data(), 8, x214_passedParticleCount, 0));
|
||||
x218_passedSoundCount += u32(anim->GetSoundPOIList(time, g_SoundPOINodes.data(), 8, x218_passedSoundCount, 0));
|
||||
|
||||
SAdvancementResults results = AdvanceAdditiveAnim(anim, time);
|
||||
deltas.x0_posDelta += results.x8_deltas.x0_posDelta;
|
||||
@@ -149,11 +159,13 @@ SAdvancementDeltas CAnimData::AdvanceAdditiveAnims(float dt) {
|
||||
} else {
|
||||
CCharAnimTime remTime = anim->VGetTimeRemaining();
|
||||
while (remTime.GreaterThanZero() && std::fabs(remTime.GetSeconds()) >= 0.00001f) {
|
||||
x210_passedIntCount += anim->GetInt32POIList(time, g_Int32POINodes.data(), 16, x210_passedIntCount, 0);
|
||||
x20c_passedBoolCount += anim->GetBoolPOIList(time, g_BoolPOINodes.data(), 8, x20c_passedBoolCount, 0);
|
||||
x210_passedIntCount +=
|
||||
u32(anim->GetInt32POIList(time, g_Int32POINodes.data(), g_Int32POINodes.size(), x210_passedIntCount, 0));
|
||||
x20c_passedBoolCount +=
|
||||
u32(anim->GetBoolPOIList(time, g_BoolPOINodes.data(), g_BoolPOINodes.size(), x20c_passedBoolCount, 0));
|
||||
x214_passedParticleCount +=
|
||||
anim->GetParticlePOIList(time, g_ParticlePOINodes.data(), 8, x214_passedParticleCount, 0);
|
||||
x218_passedSoundCount += anim->GetSoundPOIList(time, g_SoundPOINodes.data(), 8, x218_passedSoundCount, 0);
|
||||
u32(anim->GetParticlePOIList(time, g_ParticlePOINodes.data(), 8, x214_passedParticleCount, 0));
|
||||
x218_passedSoundCount += u32(anim->GetSoundPOIList(time, g_SoundPOINodes.data(), 8, x218_passedSoundCount, 0));
|
||||
|
||||
SAdvancementResults results = AdvanceAdditiveAnim(anim, time);
|
||||
deltas.x0_posDelta += results.x8_deltas.x0_posDelta;
|
||||
@@ -263,8 +275,9 @@ SAdvancementDeltas CAnimData::GetAdvancementDeltas(const CCharAnimTime& a, const
|
||||
}
|
||||
|
||||
CCharAnimTime CAnimData::GetTimeOfUserEvent(EUserEventType type, const CCharAnimTime& time) const {
|
||||
u32 count = x1f8_animRoot->GetInt32POIList(time, g_TransientInt32POINodes.data(), 16, 0, 64);
|
||||
for (u32 i = 0; i < count; ++i) {
|
||||
const size_t count =
|
||||
x1f8_animRoot->GetInt32POIList(time, g_TransientInt32POINodes.data(), g_TransientInt32POINodes.size(), 0, 64);
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
CInt32POINode& poi = g_TransientInt32POINodes[i];
|
||||
if (poi.GetPoiType() == EPOIType::UserEvent && EUserEventType(poi.GetValue()) == type) {
|
||||
CCharAnimTime ret = poi.GetTime();
|
||||
@@ -283,8 +296,8 @@ void CAnimData::MultiplyPlaybackRate(float mul) { x200_speedScale *= mul; }
|
||||
void CAnimData::SetPlaybackRate(float set) { x200_speedScale = set; }
|
||||
|
||||
void CAnimData::SetRandomPlaybackRate(CRandom16& r) {
|
||||
for (u32 i = 0; i < x210_passedIntCount; ++i) {
|
||||
CInt32POINode& poi = g_Int32POINodes[i];
|
||||
for (size_t i = 0; i < x210_passedIntCount; ++i) {
|
||||
const CInt32POINode& poi = g_Int32POINodes[i];
|
||||
if (poi.GetPoiType() == EPOIType::RandRate) {
|
||||
float tmp = (r.Next() % poi.GetValue()) / 100.f;
|
||||
if ((r.Next() % 100) < 50)
|
||||
@@ -304,10 +317,10 @@ void CAnimData::CalcPlaybackAlignmentParms(const CAnimPlaybackParms& parms,
|
||||
x220_27_ = false;
|
||||
if (parms.GetDeltaOrient() && parms.GetObjectXform()) {
|
||||
ResetPOILists();
|
||||
x210_passedIntCount +=
|
||||
node->GetInt32POIList(CCharAnimTime::Infinity(), g_Int32POINodes.data(), 16, x210_passedIntCount, 64);
|
||||
for (u32 i = 0; i < x210_passedIntCount; ++i) {
|
||||
CInt32POINode& poi = g_Int32POINodes[i];
|
||||
x210_passedIntCount += u32(node->GetInt32POIList(CCharAnimTime::Infinity(), g_Int32POINodes.data(),
|
||||
g_Int32POINodes.size(), x210_passedIntCount, 64));
|
||||
for (size_t i = 0; i < x210_passedIntCount; ++i) {
|
||||
const CInt32POINode& poi = g_Int32POINodes[i];
|
||||
if (poi.GetPoiType() == EPOIType::UserEvent && EUserEventType(poi.GetValue()) == EUserEventType::AlignTargetRot) {
|
||||
SAdvancementResults res = node->VGetAdvancementResults(poi.GetTime(), 0.f);
|
||||
orient = zeus::CQuaternion::slerp(zeus::CQuaternion(),
|
||||
@@ -328,10 +341,10 @@ void CAnimData::CalcPlaybackAlignmentParms(const CAnimPlaybackParms& parms,
|
||||
CCharAnimTime timeStart, timeAlign;
|
||||
if (parms.GetTargetPos() && parms.GetObjectXform()) {
|
||||
ResetPOILists();
|
||||
x210_passedIntCount +=
|
||||
node->GetInt32POIList(CCharAnimTime::Infinity(), g_Int32POINodes.data(), 16, x210_passedIntCount, 64);
|
||||
for (u32 i = 0; i < x210_passedIntCount; ++i) {
|
||||
CInt32POINode& poi = g_Int32POINodes[i];
|
||||
x210_passedIntCount += u32(node->GetInt32POIList(CCharAnimTime::Infinity(), g_Int32POINodes.data(),
|
||||
g_Int32POINodes.size(), x210_passedIntCount, 64));
|
||||
for (size_t i = 0; i < x210_passedIntCount; ++i) {
|
||||
const CInt32POINode& poi = g_Int32POINodes[i];
|
||||
if (poi.GetPoiType() == EPOIType::UserEvent) {
|
||||
if (EUserEventType(poi.GetValue()) == EUserEventType::AlignTargetPosStart) {
|
||||
didStart = true;
|
||||
@@ -380,9 +393,9 @@ void CAnimData::CalcPlaybackAlignmentParms(const CAnimPlaybackParms& parms,
|
||||
zeus::CVector3f startPos;
|
||||
if (parms.GetTargetPos() && parms.GetObjectXform()) {
|
||||
ResetPOILists();
|
||||
x210_passedIntCount +=
|
||||
node->GetInt32POIList(CCharAnimTime::Infinity(), g_Int32POINodes.data(), 16, x210_passedIntCount, 64);
|
||||
for (u32 i = 0; i < x210_passedIntCount; ++i) {
|
||||
x210_passedIntCount += u32(node->GetInt32POIList(CCharAnimTime::Infinity(), g_Int32POINodes.data(),
|
||||
g_Int32POINodes.size(), x210_passedIntCount, 64));
|
||||
for (size_t i = 0; i < x210_passedIntCount; ++i) {
|
||||
CInt32POINode& poi = g_Int32POINodes[i];
|
||||
if (poi.GetPoiType() == EPOIType::UserEvent) {
|
||||
if (EUserEventType(poi.GetValue()) == EUserEventType::AlignTargetPosStart) {
|
||||
@@ -678,23 +691,27 @@ SAdvancementDeltas CAnimData::DoAdvance(float dt, bool& suspendParticles, CRando
|
||||
CCharAnimTime time(scaleDt);
|
||||
if (x220_25_loop) {
|
||||
while (time.GreaterThanZero() && !time.EpsilonZero()) {
|
||||
x210_passedIntCount += x1f8_animRoot->GetInt32POIList(time, g_Int32POINodes.data(), 16, x210_passedIntCount, 0);
|
||||
x20c_passedBoolCount += x1f8_animRoot->GetBoolPOIList(time, g_BoolPOINodes.data(), 16, x20c_passedBoolCount, 0);
|
||||
x210_passedIntCount += u32(x1f8_animRoot->GetInt32POIList(time, g_Int32POINodes.data(), g_Int32POINodes.size(),
|
||||
x210_passedIntCount, 0));
|
||||
x20c_passedBoolCount += u32(
|
||||
x1f8_animRoot->GetBoolPOIList(time, g_BoolPOINodes.data(), g_BoolPOINodes.size(), x20c_passedBoolCount, 0));
|
||||
x214_passedParticleCount +=
|
||||
x1f8_animRoot->GetParticlePOIList(time, g_ParticlePOINodes.data(), 16, x214_passedParticleCount, 0);
|
||||
u32(x1f8_animRoot->GetParticlePOIList(time, g_ParticlePOINodes.data(), 16, x214_passedParticleCount, 0));
|
||||
x218_passedSoundCount +=
|
||||
x1f8_animRoot->GetSoundPOIList(time, g_SoundPOINodes.data(), 16, x218_passedSoundCount, 0);
|
||||
u32(x1f8_animRoot->GetSoundPOIList(time, g_SoundPOINodes.data(), 16, x218_passedSoundCount, 0));
|
||||
AdvanceAnim(time, offsetPost, quatPost);
|
||||
}
|
||||
} else {
|
||||
CCharAnimTime remTime = x1f8_animRoot->VGetTimeRemaining();
|
||||
while (!remTime.EpsilonZero() && !time.EpsilonZero()) {
|
||||
x210_passedIntCount += x1f8_animRoot->GetInt32POIList(time, g_Int32POINodes.data(), 16, x210_passedIntCount, 0);
|
||||
x20c_passedBoolCount += x1f8_animRoot->GetBoolPOIList(time, g_BoolPOINodes.data(), 16, x20c_passedBoolCount, 0);
|
||||
x210_passedIntCount += u32(x1f8_animRoot->GetInt32POIList(time, g_Int32POINodes.data(), g_Int32POINodes.size(),
|
||||
x210_passedIntCount, 0));
|
||||
x20c_passedBoolCount += u32(
|
||||
x1f8_animRoot->GetBoolPOIList(time, g_BoolPOINodes.data(), g_BoolPOINodes.size(), x20c_passedBoolCount, 0));
|
||||
x214_passedParticleCount +=
|
||||
x1f8_animRoot->GetParticlePOIList(time, g_ParticlePOINodes.data(), 16, x214_passedParticleCount, 0);
|
||||
u32(x1f8_animRoot->GetParticlePOIList(time, g_ParticlePOINodes.data(), 16, x214_passedParticleCount, 0));
|
||||
x218_passedSoundCount +=
|
||||
x1f8_animRoot->GetSoundPOIList(time, g_SoundPOINodes.data(), 16, x218_passedSoundCount, 0);
|
||||
u32(x1f8_animRoot->GetSoundPOIList(time, g_SoundPOINodes.data(), 16, x218_passedSoundCount, 0));
|
||||
AdvanceAnim(time, offsetPost, quatPost);
|
||||
remTime = x1f8_animRoot->VGetTimeRemaining();
|
||||
time = std::max(0.f, std::min(remTime.GetSeconds(), time.GetSeconds()));
|
||||
@@ -721,8 +738,8 @@ SAdvancementDeltas CAnimData::Advance(float dt, const zeus::CVector3f& scale, CS
|
||||
if (suspendParticles)
|
||||
x120_particleDB.SuspendAllActiveEffects(stateMgr);
|
||||
|
||||
for (u32 i = 0; i < x214_passedParticleCount; ++i) {
|
||||
CParticlePOINode& node = g_ParticlePOINodes[i];
|
||||
for (size_t i = 0; i < x214_passedParticleCount; ++i) {
|
||||
const CParticlePOINode& node = g_ParticlePOINodes[i];
|
||||
if (node.GetCharacterIndex() == -1 || node.GetCharacterIndex() == x204_charIdx) {
|
||||
x120_particleDB.AddParticleEffect(node.GetString(), node.GetFlags(), node.GetParticleData(), scale, stateMgr, aid,
|
||||
false, x21c_particleLightIdx);
|
||||
@@ -750,8 +767,8 @@ void CAnimData::AdvanceAnim(CCharAnimTime& time, zeus::CVector3f& offset, zeus::
|
||||
x1f8_animRoot = CAnimTreeNode::Cast(std::move(*simplified));
|
||||
|
||||
if ((x220_28_ || x220_27_) && x210_passedIntCount > 0) {
|
||||
for (u32 i = 0; i < x210_passedIntCount; ++i) {
|
||||
CInt32POINode& node = g_Int32POINodes[i];
|
||||
for (size_t i = 0; i < x210_passedIntCount; ++i) {
|
||||
const CInt32POINode& node = g_Int32POINodes[i];
|
||||
if (node.GetPoiType() == EPOIType::UserEvent) {
|
||||
switch (EUserEventType(node.GetValue())) {
|
||||
case EUserEventType::AlignTargetPosStart: {
|
||||
|
||||
@@ -124,21 +124,14 @@ private:
|
||||
u32 x214_passedParticleCount = 0;
|
||||
u32 x218_passedSoundCount = 0;
|
||||
s32 x21c_particleLightIdx = 0;
|
||||
|
||||
union {
|
||||
u32 x220_flags = 0;
|
||||
struct {
|
||||
bool x220_24_animating : 1;
|
||||
bool x220_25_loop : 1;
|
||||
bool x220_26_aligningPos : 1;
|
||||
bool x220_27_ : 1;
|
||||
bool x220_28_ : 1;
|
||||
bool x220_29_animationJustStarted : 1;
|
||||
bool x220_30_poseBuilt : 1;
|
||||
bool x220_31_poseCached : 1;
|
||||
};
|
||||
};
|
||||
|
||||
bool x220_24_animating : 1;
|
||||
bool x220_25_loop : 1;
|
||||
bool x220_26_aligningPos : 1;
|
||||
bool x220_27_ : 1;
|
||||
bool x220_28_ : 1;
|
||||
bool x220_29_animationJustStarted : 1;
|
||||
bool x220_30_poseBuilt : 1;
|
||||
bool x220_31_poseCached : 1;
|
||||
CPoseAsTransforms x224_pose;
|
||||
CHierarchyPoseBuilder x2fc_poseBuilder;
|
||||
|
||||
|
||||
@@ -20,28 +20,29 @@ class CAnimPlaybackParms {
|
||||
const zeus::CVector3f* x24_objectScale = nullptr;
|
||||
|
||||
public:
|
||||
CAnimPlaybackParms() = default;
|
||||
CAnimPlaybackParms(s32 animA, s32 animB, float blendWeight, bool animating)
|
||||
constexpr CAnimPlaybackParms() = default;
|
||||
constexpr CAnimPlaybackParms(s32 animA, s32 animB, float blendWeight, bool animating)
|
||||
: x0_animA(animA), x4_animB(animB), x8_blendWeight(blendWeight), xc_animating(animating) {}
|
||||
CAnimPlaybackParms(s32 anim, const zeus::CQuaternion* deltaOrient, const zeus::CVector3f* targetPos,
|
||||
const zeus::CTransform* xf, const zeus::CVector3f* scale, bool useLocator)
|
||||
constexpr CAnimPlaybackParms(s32 anim, const zeus::CQuaternion* deltaOrient, const zeus::CVector3f* targetPos,
|
||||
const zeus::CTransform* xf, const zeus::CVector3f* scale, bool useLocator)
|
||||
: x0_animA(anim)
|
||||
, x14_targetPos(targetPos)
|
||||
, x18_useLocator(useLocator)
|
||||
, x1c_deltaOrient(deltaOrient)
|
||||
, x20_objectXf(xf)
|
||||
, x24_objectScale(scale) {}
|
||||
const zeus::CTransform* GetObjectXform() const { return x20_objectXf; }
|
||||
const zeus::CQuaternion* GetDeltaOrient() const { return x1c_deltaOrient; }
|
||||
const zeus::CVector3f* GetTargetPos() const { return x14_targetPos; }
|
||||
bool GetIsUseLocator() const { return x18_useLocator; }
|
||||
const zeus::CVector3f* GetObjectScale() const { return x24_objectScale; }
|
||||
s32 GetAnimationId() const { return x0_animA; }
|
||||
s32 GetSecondAnimationId() const { return x4_animB; }
|
||||
float GetBlendFactor() const { return x8_blendWeight; }
|
||||
void SetAnimationId(s32 id) { x0_animA = id; }
|
||||
void SetSecondAnimationId(s32 id) { x4_animB = id; }
|
||||
void SetBlendFactor(float f) { x8_blendWeight = f; }
|
||||
bool GetIsPlayAnimation() const { return xc_animating; }
|
||||
|
||||
constexpr const zeus::CTransform* GetObjectXform() const { return x20_objectXf; }
|
||||
constexpr const zeus::CQuaternion* GetDeltaOrient() const { return x1c_deltaOrient; }
|
||||
constexpr const zeus::CVector3f* GetTargetPos() const { return x14_targetPos; }
|
||||
constexpr bool GetIsUseLocator() const { return x18_useLocator; }
|
||||
constexpr const zeus::CVector3f* GetObjectScale() const { return x24_objectScale; }
|
||||
constexpr s32 GetAnimationId() const { return x0_animA; }
|
||||
constexpr s32 GetSecondAnimationId() const { return x4_animB; }
|
||||
constexpr float GetBlendFactor() const { return x8_blendWeight; }
|
||||
constexpr void SetAnimationId(s32 id) { x0_animA = id; }
|
||||
constexpr void SetSecondAnimationId(s32 id) { x4_animB = id; }
|
||||
constexpr void SetBlendFactor(float f) { x8_blendWeight = f; }
|
||||
constexpr bool GetIsPlayAnimation() const { return xc_animating; }
|
||||
};
|
||||
} // namespace urde
|
||||
|
||||
@@ -132,8 +132,8 @@ void CAnimSourceReaderBase::UpdatePOIStates() {
|
||||
}
|
||||
}
|
||||
|
||||
u32 CAnimSourceReaderBase::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk) const {
|
||||
size_t CAnimSourceReaderBase::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
if (x4_sourceInfo->HasPOIData()) {
|
||||
const std::vector<CBoolPOINode>& boolNodes = x4_sourceInfo->GetBoolPOIStream();
|
||||
return _getPOIList(time, listOut, capacity, iterator, unk, boolNodes, xc_curTime, *x4_sourceInfo,
|
||||
@@ -142,8 +142,8 @@ u32 CAnimSourceReaderBase::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINo
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 CAnimSourceReaderBase::VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk) const {
|
||||
size_t CAnimSourceReaderBase::VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
if (x4_sourceInfo->HasPOIData()) {
|
||||
const std::vector<CInt32POINode>& int32Nodes = x4_sourceInfo->GetInt32POIStream();
|
||||
return _getPOIList(time, listOut, capacity, iterator, unk, int32Nodes, xc_curTime, *x4_sourceInfo,
|
||||
@@ -152,8 +152,8 @@ u32 CAnimSourceReaderBase::VGetInt32POIList(const CCharAnimTime& time, CInt32POI
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 CAnimSourceReaderBase::VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk) const {
|
||||
size_t CAnimSourceReaderBase::VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
if (x4_sourceInfo->HasPOIData()) {
|
||||
const std::vector<CParticlePOINode>& particleNodes = x4_sourceInfo->GetParticlePOIStream();
|
||||
return _getPOIList(time, listOut, capacity, iterator, unk, particleNodes, xc_curTime, *x4_sourceInfo,
|
||||
@@ -162,8 +162,8 @@ u32 CAnimSourceReaderBase::VGetParticlePOIList(const CCharAnimTime& time, CParti
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 CAnimSourceReaderBase::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk) const {
|
||||
size_t CAnimSourceReaderBase::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
if (x4_sourceInfo->HasPOIData()) {
|
||||
const std::vector<CSoundPOINode>& soundNodes = x4_sourceInfo->GetSoundPOIStream();
|
||||
return _getPOIList(time, listOut, capacity, iterator, unk, soundNodes, xc_curTime, *x4_sourceInfo,
|
||||
|
||||
@@ -61,13 +61,13 @@ protected:
|
||||
public:
|
||||
CAnimSourceReaderBase(std::unique_ptr<IAnimSourceInfo>&& sourceInfo, const CCharAnimTime& time);
|
||||
|
||||
u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const override;
|
||||
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const override;
|
||||
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator,
|
||||
size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, u32) const override;
|
||||
size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
size_t VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const override;
|
||||
bool VGetBoolPOIState(std::string_view name) const override;
|
||||
s32 VGetInt32POIState(std::string_view name) const override;
|
||||
CParticleData::EParentedMode VGetParticlePOIState(std::string_view name) const override;
|
||||
|
||||
@@ -38,23 +38,23 @@ zeus::CQuaternion CAnimTreeAnimReaderContainer::VGetRotation(const CSegId& seg)
|
||||
return x14_reader->VGetRotation(seg);
|
||||
}
|
||||
|
||||
u32 CAnimTreeAnimReaderContainer::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk) const {
|
||||
size_t CAnimTreeAnimReaderContainer::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
return x14_reader->GetBoolPOIList(time, listOut, capacity, iterator, unk);
|
||||
}
|
||||
|
||||
u32 CAnimTreeAnimReaderContainer::VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk) const {
|
||||
size_t CAnimTreeAnimReaderContainer::VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut,
|
||||
size_t capacity, size_t iterator, u32 unk) const {
|
||||
return x14_reader->GetInt32POIList(time, listOut, capacity, iterator, unk);
|
||||
}
|
||||
|
||||
u32 CAnimTreeAnimReaderContainer::VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut,
|
||||
u32 capacity, u32 iterator, u32 unk) const {
|
||||
size_t CAnimTreeAnimReaderContainer::VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut,
|
||||
size_t capacity, size_t iterator, u32 unk) const {
|
||||
return x14_reader->GetParticlePOIList(time, listOut, capacity, iterator, unk);
|
||||
}
|
||||
|
||||
u32 CAnimTreeAnimReaderContainer::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk) const {
|
||||
size_t CAnimTreeAnimReaderContainer::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut,
|
||||
size_t capacity, size_t iterator, u32 unk) const {
|
||||
return x14_reader->GetSoundPOIList(time, listOut, capacity, iterator, unk);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,13 +30,13 @@ public:
|
||||
bool VHasOffset(const CSegId& seg) const override;
|
||||
zeus::CVector3f VGetOffset(const CSegId& seg) const override;
|
||||
zeus::CQuaternion VGetRotation(const CSegId& seg) const override;
|
||||
u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const override;
|
||||
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const override;
|
||||
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator,
|
||||
size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, u32) const override;
|
||||
size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
size_t VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const override;
|
||||
bool VGetBoolPOIState(std::string_view name) const override;
|
||||
s32 VGetInt32POIState(std::string_view name) const override;
|
||||
CParticleData::EParentedMode VGetParticlePOIState(std::string_view name) const override;
|
||||
|
||||
@@ -53,48 +53,52 @@ SAdvancementResults CAnimTreeDoubleChild::VAdvanceView(const CCharAnimTime& a) {
|
||||
return (resA.x0_remTime > resB.x0_remTime) ? resA : resB;
|
||||
}
|
||||
|
||||
u32 CAnimTreeDoubleChild::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk) const {
|
||||
u32 newCapacity = x14_a->GetBoolPOIList(time, listOut, capacity, iterator, unk);
|
||||
size_t CAnimTreeDoubleChild::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
size_t newCapacity = x14_a->GetBoolPOIList(time, listOut, capacity, iterator, unk);
|
||||
newCapacity += x18_b->GetBoolPOIList(time, listOut, capacity, newCapacity + iterator, unk);
|
||||
if (newCapacity > capacity)
|
||||
if (newCapacity > capacity) {
|
||||
newCapacity = capacity;
|
||||
}
|
||||
|
||||
std::sort(listOut, listOut + newCapacity);
|
||||
|
||||
return newCapacity;
|
||||
}
|
||||
|
||||
u32 CAnimTreeDoubleChild::VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk) const {
|
||||
u32 newCapacity = x14_a->GetInt32POIList(time, listOut, capacity, iterator, unk);
|
||||
size_t CAnimTreeDoubleChild::VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
size_t newCapacity = x14_a->GetInt32POIList(time, listOut, capacity, iterator, unk);
|
||||
newCapacity += x18_b->GetInt32POIList(time, listOut, capacity, newCapacity + iterator, unk);
|
||||
if (newCapacity > capacity)
|
||||
if (newCapacity > capacity) {
|
||||
newCapacity = capacity;
|
||||
}
|
||||
|
||||
std::sort(listOut, listOut + newCapacity);
|
||||
|
||||
return newCapacity;
|
||||
}
|
||||
|
||||
u32 CAnimTreeDoubleChild::VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk) const {
|
||||
u32 newCapacity = x14_a->GetParticlePOIList(time, listOut, capacity, iterator, unk);
|
||||
size_t CAnimTreeDoubleChild::VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
size_t newCapacity = x14_a->GetParticlePOIList(time, listOut, capacity, iterator, unk);
|
||||
newCapacity += x18_b->GetParticlePOIList(time, listOut, capacity, newCapacity + iterator, unk);
|
||||
if (newCapacity > capacity)
|
||||
if (newCapacity > capacity) {
|
||||
newCapacity = capacity;
|
||||
}
|
||||
|
||||
std::sort(listOut, listOut + newCapacity);
|
||||
|
||||
return newCapacity;
|
||||
}
|
||||
|
||||
u32 CAnimTreeDoubleChild::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk) const {
|
||||
u32 newCapacity = x14_a->GetSoundPOIList(time, listOut, capacity, iterator, unk);
|
||||
size_t CAnimTreeDoubleChild::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
size_t newCapacity = x14_a->GetSoundPOIList(time, listOut, capacity, iterator, unk);
|
||||
newCapacity += x18_b->GetSoundPOIList(time, listOut, capacity, newCapacity + iterator, unk);
|
||||
if (newCapacity > capacity)
|
||||
if (newCapacity > capacity) {
|
||||
newCapacity = capacity;
|
||||
}
|
||||
|
||||
std::sort(listOut, listOut + newCapacity);
|
||||
|
||||
|
||||
@@ -34,13 +34,13 @@ public:
|
||||
CAnimTreeDoubleChild(const std::weak_ptr<CAnimTreeNode>& a, const std::weak_ptr<CAnimTreeNode>& b,
|
||||
std::string_view name);
|
||||
SAdvancementResults VAdvanceView(const CCharAnimTime& a) override;
|
||||
u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const override;
|
||||
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const override;
|
||||
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator,
|
||||
size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, u32) const override;
|
||||
size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
size_t VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const override;
|
||||
bool VGetBoolPOIState(std::string_view name) const override;
|
||||
s32 VGetInt32POIState(std::string_view name) const override;
|
||||
CParticleData::EParentedMode VGetParticlePOIState(std::string_view name) const override;
|
||||
|
||||
@@ -57,26 +57,26 @@ std::unique_ptr<IAnimReader> CAnimTreeLoopIn::VClone() const {
|
||||
x20_animCtx, x4_name, x30_fundamentals, x88_curTime);
|
||||
}
|
||||
|
||||
u32 CAnimTreeLoopIn::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk) const {
|
||||
size_t CAnimTreeLoopIn::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
return _getPOIList<CBoolPOINode>(time, listOut, capacity, iterator, unk, x30_fundamentals.GetBoolPointsOfInterest(),
|
||||
x88_curTime);
|
||||
}
|
||||
|
||||
u32 CAnimTreeLoopIn::VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk) const {
|
||||
size_t CAnimTreeLoopIn::VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
return _getPOIList<CInt32POINode>(time, listOut, capacity, iterator, unk, x30_fundamentals.GetInt32PointsOfInterest(),
|
||||
x88_curTime);
|
||||
}
|
||||
|
||||
u32 CAnimTreeLoopIn::VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk) const {
|
||||
size_t CAnimTreeLoopIn::VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
return _getPOIList<CParticlePOINode>(time, listOut, capacity, iterator, unk,
|
||||
x30_fundamentals.GetParticlePointsOfInterest(), x88_curTime);
|
||||
}
|
||||
|
||||
u32 CAnimTreeLoopIn::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk) const {
|
||||
size_t CAnimTreeLoopIn::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
return _getPOIList<CSoundPOINode>(time, listOut, capacity, iterator, unk, x30_fundamentals.GetSoundPointsOfInterest(),
|
||||
x88_curTime);
|
||||
}
|
||||
|
||||
@@ -30,13 +30,13 @@ public:
|
||||
std::optional<std::unique_ptr<IAnimReader>> VSimplified() override;
|
||||
std::shared_ptr<IAnimReader> VGetBestUnblendedChild() const override;
|
||||
std::unique_ptr<IAnimReader> VClone() const override;
|
||||
u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const override;
|
||||
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const override;
|
||||
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator,
|
||||
size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, u32) const override;
|
||||
size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
size_t VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const override;
|
||||
CSteadyStateAnimInfo VGetSteadyStateAnimInfo() const override;
|
||||
CCharAnimTime VGetTimeRemaining() const override;
|
||||
SAdvancementResults VAdvanceView(const CCharAnimTime& dt) override;
|
||||
|
||||
@@ -93,24 +93,24 @@ CSteadyStateAnimInfo CAnimTreeSequence::VGetSteadyStateAnimInfo() const {
|
||||
return x3c_fundamentals.GetSteadyStateAnimInfo();
|
||||
}
|
||||
|
||||
u32 CAnimTreeSequence::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk) const {
|
||||
size_t CAnimTreeSequence::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
return _getPOIList(time, listOut, capacity, iterator, unk, x3c_fundamentals.GetBoolPointsOfInterest(), x94_curTime);
|
||||
}
|
||||
|
||||
u32 CAnimTreeSequence::VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk) const {
|
||||
size_t CAnimTreeSequence::VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
return _getPOIList(time, listOut, capacity, iterator, unk, x3c_fundamentals.GetInt32PointsOfInterest(), x94_curTime);
|
||||
}
|
||||
|
||||
u32 CAnimTreeSequence::VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk) const {
|
||||
size_t CAnimTreeSequence::VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
return _getPOIList(time, listOut, capacity, iterator, unk, x3c_fundamentals.GetParticlePointsOfInterest(),
|
||||
x94_curTime);
|
||||
}
|
||||
|
||||
u32 CAnimTreeSequence::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk) const {
|
||||
size_t CAnimTreeSequence::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
return _getPOIList(time, listOut, capacity, iterator, unk, x3c_fundamentals.GetSoundPointsOfInterest(), x94_curTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,13 +32,13 @@ public:
|
||||
SAdvancementResults VAdvanceView(const CCharAnimTime& dt) override;
|
||||
CCharAnimTime VGetTimeRemaining() const override;
|
||||
CSteadyStateAnimInfo VGetSteadyStateAnimInfo() const override;
|
||||
u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const override;
|
||||
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const override;
|
||||
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator,
|
||||
size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, u32) const override;
|
||||
size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
size_t VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const override;
|
||||
std::unique_ptr<IAnimReader> VClone() const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -15,23 +15,23 @@ zeus::CVector3f CAnimTreeSingleChild::VGetOffset(const CSegId& seg) const { retu
|
||||
|
||||
zeus::CQuaternion CAnimTreeSingleChild::VGetRotation(const CSegId& seg) const { return x14_child->VGetRotation(seg); }
|
||||
|
||||
u32 CAnimTreeSingleChild::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk) const {
|
||||
size_t CAnimTreeSingleChild::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
return x14_child->GetBoolPOIList(time, listOut, capacity, iterator, unk);
|
||||
}
|
||||
|
||||
u32 CAnimTreeSingleChild::VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk) const {
|
||||
size_t CAnimTreeSingleChild::VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
return x14_child->GetInt32POIList(time, listOut, capacity, iterator, unk);
|
||||
}
|
||||
|
||||
u32 CAnimTreeSingleChild::VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk) const {
|
||||
size_t CAnimTreeSingleChild::VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
return x14_child->GetParticlePOIList(time, listOut, capacity, iterator, unk);
|
||||
}
|
||||
|
||||
u32 CAnimTreeSingleChild::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk) const {
|
||||
size_t CAnimTreeSingleChild::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
return x14_child->GetSoundPOIList(time, listOut, capacity, iterator, unk);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@ public:
|
||||
bool VHasOffset(const CSegId& seg) const override;
|
||||
zeus::CVector3f VGetOffset(const CSegId& seg) const override;
|
||||
zeus::CQuaternion VGetRotation(const CSegId& seg) const override;
|
||||
u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const override;
|
||||
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const override;
|
||||
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator,
|
||||
size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, u32) const override;
|
||||
size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
size_t VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const override;
|
||||
bool VGetBoolPOIState(std::string_view name) const override;
|
||||
s32 VGetInt32POIState(std::string_view name) const override;
|
||||
CParticleData::EParentedMode VGetParticlePOIState(std::string_view name) const override;
|
||||
|
||||
@@ -59,43 +59,55 @@ std::optional<std::unique_ptr<IAnimReader>> CAnimTreeTimeScale::VSimplified() {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
u32 CAnimTreeTimeScale::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk) const {
|
||||
CCharAnimTime useTime = (time == CCharAnimTime::Infinity()) ? x14_child->VGetTimeRemaining() : GetRealLifeTime(time);
|
||||
u32 ret = x14_child->GetBoolPOIList(useTime, listOut, capacity, iterator, unk);
|
||||
if (x28_targetAccelTime > CCharAnimTime())
|
||||
for (u32 i = 0; i < ret; ++i)
|
||||
size_t CAnimTreeTimeScale::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
const CCharAnimTime useTime =
|
||||
time == CCharAnimTime::Infinity() ? x14_child->VGetTimeRemaining() : GetRealLifeTime(time);
|
||||
const size_t ret = x14_child->GetBoolPOIList(useTime, listOut, capacity, iterator, unk);
|
||||
if (x28_targetAccelTime > CCharAnimTime()) {
|
||||
for (size_t i = 0; i < ret; ++i) {
|
||||
listOut[iterator + i].SetTime(GetRealLifeTime(listOut[i].GetTime()));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 CAnimTreeTimeScale::VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk) const {
|
||||
CCharAnimTime useTime = (time == CCharAnimTime::Infinity()) ? x14_child->VGetTimeRemaining() : GetRealLifeTime(time);
|
||||
u32 ret = x14_child->GetInt32POIList(useTime, listOut, capacity, iterator, unk);
|
||||
if (x28_targetAccelTime > CCharAnimTime())
|
||||
for (u32 i = 0; i < ret; ++i)
|
||||
size_t CAnimTreeTimeScale::VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
const CCharAnimTime useTime =
|
||||
time == CCharAnimTime::Infinity() ? x14_child->VGetTimeRemaining() : GetRealLifeTime(time);
|
||||
const size_t ret = x14_child->GetInt32POIList(useTime, listOut, capacity, iterator, unk);
|
||||
if (x28_targetAccelTime > CCharAnimTime()) {
|
||||
for (size_t i = 0; i < ret; ++i) {
|
||||
listOut[iterator + i].SetTime(GetRealLifeTime(listOut[i].GetTime()));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 CAnimTreeTimeScale::VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk) const {
|
||||
CCharAnimTime useTime = (time == CCharAnimTime::Infinity()) ? x14_child->VGetTimeRemaining() : GetRealLifeTime(time);
|
||||
u32 ret = x14_child->GetParticlePOIList(useTime, listOut, capacity, iterator, unk);
|
||||
if (x28_targetAccelTime > CCharAnimTime())
|
||||
for (u32 i = 0; i < ret; ++i)
|
||||
size_t CAnimTreeTimeScale::VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
const CCharAnimTime useTime =
|
||||
time == CCharAnimTime::Infinity() ? x14_child->VGetTimeRemaining() : GetRealLifeTime(time);
|
||||
const size_t ret = x14_child->GetParticlePOIList(useTime, listOut, capacity, iterator, unk);
|
||||
if (x28_targetAccelTime > CCharAnimTime()) {
|
||||
for (size_t i = 0; i < ret; ++i) {
|
||||
listOut[iterator + i].SetTime(GetRealLifeTime(listOut[i].GetTime()));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 CAnimTreeTimeScale::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk) const {
|
||||
CCharAnimTime useTime = (time == CCharAnimTime::Infinity()) ? x14_child->VGetTimeRemaining() : GetRealLifeTime(time);
|
||||
u32 ret = x14_child->GetSoundPOIList(useTime, listOut, capacity, iterator, unk);
|
||||
if (x28_targetAccelTime > CCharAnimTime())
|
||||
for (u32 i = 0; i < ret; ++i)
|
||||
size_t CAnimTreeTimeScale::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
const CCharAnimTime useTime =
|
||||
(time == CCharAnimTime::Infinity()) ? x14_child->VGetTimeRemaining() : GetRealLifeTime(time);
|
||||
const size_t ret = x14_child->GetSoundPOIList(useTime, listOut, capacity, iterator, unk);
|
||||
if (x28_targetAccelTime > CCharAnimTime()) {
|
||||
for (size_t i = 0; i < ret; ++i) {
|
||||
listOut[iterator + i].SetTime(GetRealLifeTime(listOut[i].GetTime()));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,13 +27,13 @@ public:
|
||||
void VSetPhase(float) override;
|
||||
std::optional<std::unique_ptr<IAnimReader>> VSimplified() override;
|
||||
|
||||
u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const override;
|
||||
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const override;
|
||||
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator,
|
||||
size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, u32) const override;
|
||||
size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
size_t VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const override;
|
||||
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const override;
|
||||
bool VGetBoolPOIState(std::string_view name) const override;
|
||||
s32 VGetInt32POIState(std::string_view name) const override;
|
||||
CParticleData::EParentedMode VGetParticlePOIState(std::string_view name) const override;
|
||||
|
||||
@@ -12,8 +12,15 @@
|
||||
namespace urde {
|
||||
|
||||
CBodyController::CBodyController(CActor& actor, float turnSpeed, EBodyType bodyType)
|
||||
: x0_actor(actor), x2a4_bodyStateInfo(actor, bodyType), x2f4_bodyType(bodyType), x2fc_turnSpeed(turnSpeed) {
|
||||
x300_28_playDeathAnims = true;
|
||||
: x0_actor(actor)
|
||||
, x2a4_bodyStateInfo(actor, bodyType)
|
||||
, x2f4_bodyType(bodyType)
|
||||
, x2fc_turnSpeed(turnSpeed)
|
||||
, x300_24_animationOver(false)
|
||||
, x300_25_active(false)
|
||||
, x300_26_frozen(false)
|
||||
, x300_27_hasBeenFrozen(false)
|
||||
, x300_28_playDeathAnims(true) {
|
||||
x2a4_bodyStateInfo.x18_bodyController = this;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,16 +28,11 @@ class CBodyController {
|
||||
EBodyType x2f4_bodyType;
|
||||
s32 x2f8_curAnim = -1;
|
||||
float x2fc_turnSpeed;
|
||||
union {
|
||||
struct {
|
||||
bool x300_24_animationOver : 1;
|
||||
bool x300_25_active : 1;
|
||||
bool x300_26_frozen : 1;
|
||||
bool x300_27_hasBeenFrozen : 1;
|
||||
bool x300_28_playDeathAnims : 1;
|
||||
};
|
||||
u32 _dummy = 0;
|
||||
};
|
||||
bool x300_24_animationOver : 1;
|
||||
bool x300_25_active : 1;
|
||||
bool x300_26_frozen : 1;
|
||||
bool x300_27_hasBeenFrozen : 1;
|
||||
bool x300_28_playDeathAnims : 1;
|
||||
float x304_intoFreezeDur = 0.f;
|
||||
float x308_frozenDur = 0.f;
|
||||
float x30c_breakoutDur = 0.f;
|
||||
|
||||
@@ -202,22 +202,23 @@ class CBSJump : public CBodyState {
|
||||
zeus::CVector3f xc_waypoint1;
|
||||
zeus::CVector3f x18_velocity;
|
||||
zeus::CVector3f x24_waypoint2;
|
||||
union {
|
||||
struct {
|
||||
bool x30_24_bodyForceSet : 1;
|
||||
bool x30_25_wallJump : 1;
|
||||
bool x30_26_wallBounceRight : 1;
|
||||
bool x30_27_wallBounceComplete : 1;
|
||||
bool x30_28_startInJumpLoop : 1;
|
||||
};
|
||||
u32 _dummy = 0;
|
||||
};
|
||||
bool x30_24_bodyForceSet : 1;
|
||||
bool x30_25_wallJump : 1;
|
||||
bool x30_26_wallBounceRight : 1;
|
||||
bool x30_27_wallBounceComplete : 1;
|
||||
bool x30_28_startInJumpLoop : 1;
|
||||
pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
|
||||
bool CheckForWallJump(CBodyController& bc, CStateManager& mgr);
|
||||
void CheckForLand(CBodyController& bc, CStateManager& mgr);
|
||||
void PlayJumpLoop(CStateManager& mgr, CBodyController& bc);
|
||||
|
||||
public:
|
||||
CBSJump()
|
||||
: x30_24_bodyForceSet(false)
|
||||
, x30_25_wallJump(false)
|
||||
, x30_26_wallBounceRight(false)
|
||||
, x30_27_wallBounceComplete(false)
|
||||
, x30_28_startInJumpLoop(false) {}
|
||||
bool IsMoving() const override { return true; }
|
||||
bool ApplyHeadTracking() const override { return false; }
|
||||
bool CanShoot() const override;
|
||||
@@ -277,17 +278,13 @@ public:
|
||||
};
|
||||
|
||||
class CBSScripted : public CBodyState {
|
||||
union {
|
||||
struct {
|
||||
bool x4_24_loopAnim : 1;
|
||||
bool x4_25_timedLoop : 1;
|
||||
};
|
||||
u32 _dummy = 0;
|
||||
};
|
||||
bool x4_24_loopAnim : 1;
|
||||
bool x4_25_timedLoop : 1;
|
||||
float x8_remTime = 0.f;
|
||||
pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
|
||||
|
||||
public:
|
||||
CBSScripted() : x4_24_loopAnim(false), x4_25_timedLoop(false) {}
|
||||
bool ApplyHeadTracking() const override { return false; }
|
||||
void Start(CBodyController& bc, CStateManager& mgr) override;
|
||||
pas::EAnimationState UpdateBody(float dt, CBodyController& bc, CStateManager& mgr) override;
|
||||
@@ -313,13 +310,8 @@ class CBSWallHang : public CBodyState {
|
||||
pas::EWallHangState x4_state = pas::EWallHangState::Invalid;
|
||||
TUniqueId x8_wpId = kInvalidUniqueId;
|
||||
zeus::CVector3f xc_launchVel;
|
||||
union {
|
||||
struct {
|
||||
bool x18_24_launched : 1;
|
||||
bool x18_25_needsExit : 1;
|
||||
};
|
||||
u32 _dummy = 0;
|
||||
};
|
||||
bool x18_24_launched : 1;
|
||||
bool x18_25_needsExit : 1;
|
||||
pas::EAnimationState GetBodyStateTransition(float dt, const CBodyController& bc) const;
|
||||
void FixInPlace(CBodyController& bc);
|
||||
bool CheckForLand(CBodyController& bc, CStateManager& mgr);
|
||||
@@ -327,6 +319,7 @@ class CBSWallHang : public CBodyState {
|
||||
void SetLaunchVelocity(CBodyController& bc);
|
||||
|
||||
public:
|
||||
CBSWallHang() : x18_24_launched(false), x18_25_needsExit(false) {}
|
||||
bool IsMoving() const override { return true; }
|
||||
bool CanShoot() const override { return x4_state == pas::EWallHangState::WallHang; }
|
||||
bool IsInAir(const CBodyController& bc) const override;
|
||||
|
||||
@@ -15,6 +15,8 @@ CBoneTracking::CBoneTracking(const CAnimData& animData, std::string_view bone,
|
||||
: x14_segId(animData.GetCharLayoutInfo().GetSegIdFromString(bone))
|
||||
, x1c_maxTrackingAngle(maxTrackingAngle)
|
||||
, x20_angSpeed(angSpeed)
|
||||
, x36_24_active(false)
|
||||
, x36_25_hasTrackedRotation(false)
|
||||
, x36_26_noParent(True(flags & EBoneTrackingFlags::NoParent))
|
||||
, x36_27_noParentOrigin(True(flags & EBoneTrackingFlags::NoParentOrigin))
|
||||
, x36_28_noHorizontalAim(True(flags & EBoneTrackingFlags::NoHorizontalAim))
|
||||
@@ -107,4 +109,4 @@ void CBoneTracking::UnsetTarget() { x34_target = kInvalidUniqueId; }
|
||||
void CBoneTracking::SetTargetPosition(const zeus::CVector3f& targetPos) { x24_targetPosition = targetPos; }
|
||||
|
||||
void CBoneTracking::SetNoHorizontalAim(bool b) { x36_28_noHorizontalAim = b; }
|
||||
} // namespace urde
|
||||
} // namespace urde
|
||||
|
||||
@@ -33,17 +33,12 @@ class CBoneTracking {
|
||||
float x20_angSpeed;
|
||||
std::optional<zeus::CVector3f> x24_targetPosition;
|
||||
TUniqueId x34_target = kInvalidUniqueId;
|
||||
union {
|
||||
struct {
|
||||
bool x36_24_active : 1;
|
||||
bool x36_25_hasTrackedRotation : 1;
|
||||
bool x36_26_noParent : 1;
|
||||
bool x36_27_noParentOrigin : 1;
|
||||
bool x36_28_noHorizontalAim : 1;
|
||||
bool x36_29_parentIk : 1;
|
||||
};
|
||||
u32 _dummy = 0;
|
||||
};
|
||||
bool x36_24_active : 1;
|
||||
bool x36_25_hasTrackedRotation : 1;
|
||||
bool x36_26_noParent : 1;
|
||||
bool x36_27_noParentOrigin : 1;
|
||||
bool x36_28_noHorizontalAim : 1;
|
||||
bool x36_29_parentIk : 1;
|
||||
|
||||
public:
|
||||
CBoneTracking(const CAnimData& animData, std::string_view bone,
|
||||
@@ -60,4 +55,4 @@ public:
|
||||
void SetNoHorizontalAim(bool b);
|
||||
};
|
||||
|
||||
} // namespace urde
|
||||
} // namespace urde
|
||||
|
||||
@@ -21,16 +21,10 @@ class CIkChain {
|
||||
zeus::CQuaternion x24_holdRot;
|
||||
zeus::CVector3f x34_holdPos;
|
||||
float x40_time = 0.f;
|
||||
|
||||
union {
|
||||
struct {
|
||||
bool x44_24_activated : 1;
|
||||
};
|
||||
u32 x44_dummy = 0;
|
||||
};
|
||||
bool x44_24_activated : 1;
|
||||
|
||||
public:
|
||||
CIkChain() = default;
|
||||
CIkChain() : x44_24_activated(false) {}
|
||||
|
||||
bool GetActive() const { return x44_24_activated; }
|
||||
void Update(float);
|
||||
|
||||
@@ -25,14 +25,16 @@ CModelData::~CModelData() = default;
|
||||
CModelData::CModelData() {}
|
||||
CModelData CModelData::CModelDataNull() { return CModelData(); }
|
||||
|
||||
CModelData::CModelData(const CStaticRes& res, int instCount) : x0_scale(res.GetScale()), m_drawInstCount(instCount) {
|
||||
CModelData::CModelData(const CStaticRes& res, int instCount)
|
||||
: x0_scale(res.GetScale()), x14_24_renderSorted(false), x14_25_sortThermal(false), m_drawInstCount(instCount) {
|
||||
x1c_normalModel = g_SimplePool->GetObj({SBIG('CMDL'), res.GetId()});
|
||||
if (!x1c_normalModel)
|
||||
Log.report(logvisor::Fatal, fmt("unable to find CMDL {}"), res.GetId());
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable to find CMDL {}"), res.GetId());
|
||||
m_normalModelInst = x1c_normalModel->MakeNewInstance(0, instCount);
|
||||
}
|
||||
|
||||
CModelData::CModelData(const CAnimRes& res, int instCount) : x0_scale(res.GetScale()), m_drawInstCount(instCount) {
|
||||
CModelData::CModelData(const CAnimRes& res, int instCount)
|
||||
: x0_scale(res.GetScale()), x14_24_renderSorted(false), x14_25_sortThermal(false), m_drawInstCount(instCount) {
|
||||
TToken<CCharacterFactory> factory = g_CharFactoryBuilder->GetFactory(res);
|
||||
x10_animData =
|
||||
factory->CreateCharacter(res.GetCharacterNodeId(), res.CanLoop(), factory, res.GetDefaultAnim(), instCount);
|
||||
@@ -76,13 +78,13 @@ bool CModelData::IsLoaded(int shaderIdx) const {
|
||||
}
|
||||
|
||||
u32 CModelData::GetNumMaterialSets() const {
|
||||
if (x10_animData)
|
||||
return x10_animData->GetModelData()->GetModel()->GetNumMaterialSets();
|
||||
if (x10_animData)
|
||||
return x10_animData->GetModelData()->GetModel()->GetNumMaterialSets();
|
||||
|
||||
if (x1c_normalModel)
|
||||
return x1c_normalModel->GetNumMaterialSets();
|
||||
if (x1c_normalModel)
|
||||
return x1c_normalModel->GetNumMaterialSets();
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
CModelData::EWhichModel CModelData::GetRenderingModel(const CStateManager& stateMgr) {
|
||||
@@ -144,7 +146,7 @@ void CModelData::SetXRayModel(const std::pair<CAssetId, CAssetId>& modelSkin) {
|
||||
} else {
|
||||
x2c_xrayModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first});
|
||||
if (!x2c_xrayModel)
|
||||
Log.report(logvisor::Fatal, fmt("unable to find CMDL {}"), modelSkin.first);
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable to find CMDL {}"), modelSkin.first);
|
||||
m_xrayModelInst = x2c_xrayModel->MakeNewInstance(0, m_drawInstCount);
|
||||
}
|
||||
}
|
||||
@@ -161,7 +163,7 @@ void CModelData::SetInfraModel(const std::pair<CAssetId, CAssetId>& modelSkin) {
|
||||
} else {
|
||||
x3c_infraModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first});
|
||||
if (!x3c_infraModel)
|
||||
Log.report(logvisor::Fatal, fmt("unable to find CMDL {}"), modelSkin.first);
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable to find CMDL {}"), modelSkin.first);
|
||||
m_infraModelInst = x3c_infraModel->MakeNewInstance(0, m_drawInstCount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,13 +62,8 @@ class CModelData {
|
||||
zeus::CVector3f x0_scale;
|
||||
bool xc_ = false;
|
||||
std::unique_ptr<CAnimData> x10_animData;
|
||||
union {
|
||||
struct {
|
||||
bool x14_24_renderSorted : 1;
|
||||
bool x14_25_sortThermal : 1;
|
||||
};
|
||||
u32 _flags = 0;
|
||||
};
|
||||
bool x14_24_renderSorted : 1;
|
||||
bool x14_25_sortThermal : 1;
|
||||
zeus::CColor x18_ambientColor;
|
||||
|
||||
TLockedToken<CModel> x1c_normalModel;
|
||||
|
||||
@@ -36,22 +36,24 @@ bool CPOINode::operator>(const CPOINode& other) const { return x1c_time < other.
|
||||
bool CPOINode::operator<(const CPOINode& other) const { return x1c_time > other.x1c_time; }
|
||||
|
||||
template <class T>
|
||||
u32 _getPOIList(const CCharAnimTime& time, T* listOut, u32 capacity, u32 iterator, u32 unk1,
|
||||
const std::vector<T>& stream, const CCharAnimTime& curTime, const IAnimSourceInfo& animInfo,
|
||||
u32 passedCount) {
|
||||
u32 ret = 0;
|
||||
size_t _getPOIList(const CCharAnimTime& time, T* listOut, size_t capacity, size_t iterator, u32 unk1,
|
||||
const std::vector<T>& stream, const CCharAnimTime& curTime, const IAnimSourceInfo& animInfo,
|
||||
size_t passedCount) {
|
||||
size_t ret = 0;
|
||||
if (animInfo.HasPOIData() && stream.size()) {
|
||||
CCharAnimTime dur = animInfo.GetAnimationDuration();
|
||||
const CCharAnimTime dur = animInfo.GetAnimationDuration();
|
||||
CCharAnimTime targetTime = curTime + time;
|
||||
if (targetTime >= dur)
|
||||
if (targetTime >= dur) {
|
||||
targetTime = dur;
|
||||
}
|
||||
|
||||
if (passedCount >= stream.size())
|
||||
if (passedCount >= stream.size()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
CCharAnimTime nodeTime = stream[passedCount].GetTime();
|
||||
while (passedCount < stream.size() && nodeTime <= targetTime) {
|
||||
u32 idx = iterator + ret;
|
||||
const size_t idx = iterator + ret;
|
||||
if (idx < capacity) {
|
||||
listOut[idx] = T::CopyNodeMinusStartTime(stream[passedCount], curTime);
|
||||
++ret;
|
||||
@@ -65,17 +67,18 @@ u32 _getPOIList(const CCharAnimTime& time, T* listOut, u32 capacity, u32 iterato
|
||||
}
|
||||
|
||||
template <class T>
|
||||
u32 _getPOIList(const CCharAnimTime& time, T* listOut, u32 capacity, u32 iterator, u32 unk1,
|
||||
const std::vector<T>& stream, const CCharAnimTime& curTime) {
|
||||
u32 ret = 0;
|
||||
size_t _getPOIList(const CCharAnimTime& time, T* listOut, size_t capacity, size_t iterator, u32 unk1,
|
||||
const std::vector<T>& stream, const CCharAnimTime& curTime) {
|
||||
size_t ret = 0;
|
||||
|
||||
CCharAnimTime targetTime = curTime + time;
|
||||
const CCharAnimTime targetTime = curTime + time;
|
||||
|
||||
for (u32 it = iterator; it < stream.size(); ++it) {
|
||||
CCharAnimTime nodeTime = stream[it].GetTime();
|
||||
if (nodeTime > targetTime)
|
||||
for (size_t it = iterator; it < stream.size(); ++it) {
|
||||
const CCharAnimTime nodeTime = stream[it].GetTime();
|
||||
if (nodeTime > targetTime) {
|
||||
return ret;
|
||||
u32 idx = iterator + ret;
|
||||
}
|
||||
const size_t idx = iterator + ret;
|
||||
if (nodeTime >= curTime && idx < capacity) {
|
||||
listOut[idx] = T::CopyNodeMinusStartTime(stream[it], curTime);
|
||||
++ret;
|
||||
@@ -85,32 +88,36 @@ u32 _getPOIList(const CCharAnimTime& time, T* listOut, u32 capacity, u32 iterato
|
||||
return ret;
|
||||
}
|
||||
|
||||
template u32 _getPOIList<CBoolPOINode>(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk1, const std::vector<CBoolPOINode>& stream, const CCharAnimTime& curTime,
|
||||
const IAnimSourceInfo& animInfo, u32 passedCount);
|
||||
template u32 _getPOIList<CBoolPOINode>(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk1, const std::vector<CBoolPOINode>& stream, const CCharAnimTime& curTime);
|
||||
template size_t _getPOIList<CBoolPOINode>(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk1, const std::vector<CBoolPOINode>& stream,
|
||||
const CCharAnimTime& curTime, const IAnimSourceInfo& animInfo,
|
||||
size_t passedCount);
|
||||
template size_t _getPOIList<CBoolPOINode>(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk1, const std::vector<CBoolPOINode>& stream,
|
||||
const CCharAnimTime& curTime);
|
||||
|
||||
template u32 _getPOIList<CInt32POINode>(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk1, const std::vector<CInt32POINode>& stream,
|
||||
const CCharAnimTime& curTime, const IAnimSourceInfo& animInfo, u32 passedCount);
|
||||
template u32 _getPOIList<CInt32POINode>(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk1, const std::vector<CInt32POINode>& stream,
|
||||
const CCharAnimTime& curTime);
|
||||
|
||||
template u32 _getPOIList<CParticlePOINode>(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk1, const std::vector<CParticlePOINode>& stream,
|
||||
template size_t _getPOIList<CInt32POINode>(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk1, const std::vector<CInt32POINode>& stream,
|
||||
const CCharAnimTime& curTime, const IAnimSourceInfo& animInfo,
|
||||
u32 passedCount);
|
||||
template u32 _getPOIList<CParticlePOINode>(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity,
|
||||
u32 iterator, u32 unk1, const std::vector<CParticlePOINode>& stream,
|
||||
size_t passedCount);
|
||||
template size_t _getPOIList<CInt32POINode>(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk1, const std::vector<CInt32POINode>& stream,
|
||||
const CCharAnimTime& curTime);
|
||||
|
||||
template u32 _getPOIList<CSoundPOINode>(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk1, const std::vector<CSoundPOINode>& stream,
|
||||
const CCharAnimTime& curTime, const IAnimSourceInfo& animInfo, u32 passedCount);
|
||||
template u32 _getPOIList<CSoundPOINode>(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk1, const std::vector<CSoundPOINode>& stream,
|
||||
const CCharAnimTime& curTime);
|
||||
template size_t _getPOIList<CParticlePOINode>(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk1, const std::vector<CParticlePOINode>& stream,
|
||||
const CCharAnimTime& curTime, const IAnimSourceInfo& animInfo,
|
||||
size_t passedCount);
|
||||
template size_t _getPOIList<CParticlePOINode>(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk1, const std::vector<CParticlePOINode>& stream,
|
||||
const CCharAnimTime& curTime);
|
||||
|
||||
template size_t _getPOIList<CSoundPOINode>(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk1, const std::vector<CSoundPOINode>& stream,
|
||||
const CCharAnimTime& curTime, const IAnimSourceInfo& animInfo,
|
||||
size_t passedCount);
|
||||
template size_t _getPOIList<CSoundPOINode>(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk1, const std::vector<CSoundPOINode>& stream,
|
||||
const CCharAnimTime& curTime);
|
||||
|
||||
} // namespace urde
|
||||
|
||||
@@ -53,12 +53,12 @@ public:
|
||||
};
|
||||
|
||||
template <class T>
|
||||
u32 _getPOIList(const CCharAnimTime& time, T* listOut, u32 capacity, u32 iterator, u32 unk1,
|
||||
const std::vector<T>& stream, const CCharAnimTime& curTime, const IAnimSourceInfo& animInfo,
|
||||
u32 passedCount);
|
||||
size_t _getPOIList(const CCharAnimTime& time, T* listOut, size_t capacity, size_t iterator, u32 unk1,
|
||||
const std::vector<T>& stream, const CCharAnimTime& curTime, const IAnimSourceInfo& animInfo,
|
||||
size_t passedCount);
|
||||
|
||||
template <class T>
|
||||
u32 _getPOIList(const CCharAnimTime& time, T* listOut, u32 capacity, u32 iterator, u32 unk1,
|
||||
const std::vector<T>& stream, const CCharAnimTime& curTime);
|
||||
size_t _getPOIList(const CCharAnimTime& time, T* listOut, size_t capacity, size_t iterator, u32 unk1,
|
||||
const std::vector<T>& stream, const CCharAnimTime& curTime);
|
||||
|
||||
} // namespace urde
|
||||
|
||||
@@ -273,6 +273,7 @@ void CParticleDatabase::AddToRendererClipped(const zeus::CFrustum& frustum) cons
|
||||
}
|
||||
|
||||
CParticleGenInfo* CParticleDatabase::GetParticleEffect(std::string_view name) const {
|
||||
// TODO: Heterogeneous lookup when C++20 available
|
||||
auto search = x3c_rendererDrawLoop.find(name.data());
|
||||
if (search != x3c_rendererDrawLoop.end())
|
||||
return search->second.get();
|
||||
|
||||
@@ -59,11 +59,15 @@ void CRagDoll::CRagDollPlaneConstraint::Update() {
|
||||
}
|
||||
|
||||
CRagDoll::CRagDoll(float normalGravity, float floatingGravity, float overTime, u32 flags)
|
||||
: x44_normalGravity(normalGravity), x48_floatingGravity(floatingGravity), x50_overTimer(overTime) {
|
||||
x68_27_continueSmallMovements = bool(flags & 0x1);
|
||||
x68_28_noOverTimer = bool(flags & 0x2);
|
||||
x68_29_noAiCollision = bool(flags & 0x4);
|
||||
}
|
||||
: x44_normalGravity(normalGravity)
|
||||
, x48_floatingGravity(floatingGravity)
|
||||
, x50_overTimer(overTime)
|
||||
, x68_24_prevMovingSlowly(false)
|
||||
, x68_25_over(false)
|
||||
, x68_26_primed(false)
|
||||
, x68_27_continueSmallMovements(bool(flags & 0x1))
|
||||
, x68_28_noOverTimer(bool(flags & 0x2))
|
||||
, x68_29_noAiCollision(bool(flags & 0x4)) {}
|
||||
|
||||
void CRagDoll::AccumulateForces(float dt, float waterTop) {
|
||||
float fps = 1.f / dt;
|
||||
|
||||
@@ -94,17 +94,12 @@ protected:
|
||||
float x54_impactVel = 0.f;
|
||||
zeus::CVector3f x58_averageVel;
|
||||
float x64_angTimer = 0.f;
|
||||
union {
|
||||
struct {
|
||||
bool x68_24_prevMovingSlowly : 1;
|
||||
bool x68_25_over : 1;
|
||||
bool x68_26_primed : 1;
|
||||
bool x68_27_continueSmallMovements : 1;
|
||||
bool x68_28_noOverTimer : 1;
|
||||
bool x68_29_noAiCollision : 1;
|
||||
};
|
||||
u32 _dummy = 0;
|
||||
};
|
||||
bool x68_24_prevMovingSlowly : 1;
|
||||
bool x68_25_over : 1;
|
||||
bool x68_26_primed : 1;
|
||||
bool x68_27_continueSmallMovements : 1;
|
||||
bool x68_28_noOverTimer : 1;
|
||||
bool x68_29_noAiCollision : 1;
|
||||
void AccumulateForces(float dt, float waterTop);
|
||||
void SetNumParticles(int num) { x4_particles.reserve(num); }
|
||||
void AddParticle(CSegId id, const zeus::CVector3f& prevPos, const zeus::CVector3f& curPos, float radius);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "Runtime/Character/CSequenceHelper.hpp"
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "Runtime/Character/CAnimSysContext.hpp"
|
||||
#include "Runtime/Character/CBoolPOINode.hpp"
|
||||
#include "Runtime/Character/CInt32POINode.hpp"
|
||||
@@ -45,37 +47,41 @@ CSequenceFundamentals CSequenceHelper::ComputeSequenceFundamentals() {
|
||||
if (x10_treeNodes.size() > 0) {
|
||||
std::shared_ptr<CAnimTreeNode> node = CAnimTreeNode::Cast(x10_treeNodes[0]->Clone());
|
||||
for (size_t i = 0; i < x10_treeNodes.size(); ++i) {
|
||||
CBoolPOINode boolNodeArr[64];
|
||||
u32 numBools = node->GetBoolPOIList(CCharAnimTime::Infinity(), boolNodeArr, 64, 0, 0);
|
||||
std::array<CBoolPOINode, 64> boolNodeArr;
|
||||
const size_t numBools =
|
||||
node->GetBoolPOIList(CCharAnimTime::Infinity(), boolNodeArr.data(), boolNodeArr.size(), 0, 0);
|
||||
boolNodes.reserve(boolNodes.size() + numBools);
|
||||
for (u32 j = 0; j < numBools; ++j) {
|
||||
for (size_t j = 0; j < numBools; ++j) {
|
||||
CBoolPOINode& n = boolNodeArr[j];
|
||||
n.SetTime(n.GetTime() + duration);
|
||||
boolNodes.push_back(n);
|
||||
}
|
||||
|
||||
CInt32POINode int32NodeArr[64];
|
||||
u32 numInt32s = node->GetInt32POIList(CCharAnimTime::Infinity(), int32NodeArr, 64, 0, 0);
|
||||
std::array<CInt32POINode, 64> int32NodeArr;
|
||||
const size_t numInt32s =
|
||||
node->GetInt32POIList(CCharAnimTime::Infinity(), int32NodeArr.data(), int32NodeArr.size(), 0, 0);
|
||||
int32Nodes.reserve(int32Nodes.size() + numInt32s);
|
||||
for (u32 j = 0; j < numInt32s; ++j) {
|
||||
for (size_t j = 0; j < numInt32s; ++j) {
|
||||
CInt32POINode& n = int32NodeArr[j];
|
||||
n.SetTime(n.GetTime() + duration);
|
||||
int32Nodes.push_back(n);
|
||||
}
|
||||
|
||||
CParticlePOINode particleNodeArr[64];
|
||||
u32 numParticles = node->GetParticlePOIList(CCharAnimTime::Infinity(), particleNodeArr, 64, 0, 0);
|
||||
std::array<CParticlePOINode, 64> particleNodeArr;
|
||||
const size_t numParticles =
|
||||
node->GetParticlePOIList(CCharAnimTime::Infinity(), particleNodeArr.data(), particleNodeArr.size(), 0, 0);
|
||||
particleNodes.reserve(particleNodes.size() + numParticles);
|
||||
for (u32 j = 0; j < numParticles; ++j) {
|
||||
for (size_t j = 0; j < numParticles; ++j) {
|
||||
CParticlePOINode& n = particleNodeArr[j];
|
||||
n.SetTime(n.GetTime() + duration);
|
||||
particleNodes.push_back(n);
|
||||
}
|
||||
|
||||
CSoundPOINode soundNodeArr[64];
|
||||
u32 numSounds = node->GetSoundPOIList(CCharAnimTime::Infinity(), soundNodeArr, 64, 0, 0);
|
||||
std::array<CSoundPOINode, 64> soundNodeArr;
|
||||
const size_t numSounds =
|
||||
node->GetSoundPOIList(CCharAnimTime::Infinity(), soundNodeArr.data(), soundNodeArr.size(), 0, 0);
|
||||
soundNodes.reserve(soundNodes.size() + numSounds);
|
||||
for (u32 j = 0; j < numSounds; ++j) {
|
||||
for (size_t j = 0; j < numSounds; ++j) {
|
||||
CSoundPOINode& n = soundNodeArr[j];
|
||||
n.SetTime(n.GetTime() + duration);
|
||||
soundNodes.push_back(n);
|
||||
|
||||
@@ -27,14 +27,18 @@ CTransitionDatabaseGame::CTransitionDatabaseGame(const std::vector<CTransition>&
|
||||
}
|
||||
|
||||
const std::shared_ptr<IMetaTrans>& CTransitionDatabaseGame::GetMetaTrans(u32 a, u32 b) const {
|
||||
auto it = rstl::binary_find(x14_transitions.cbegin(), x14_transitions.cend(), std::make_pair(a, b),
|
||||
[](const std::pair<std::pair<u32, u32>, std::shared_ptr<IMetaTrans>>& p) { return p.first; });
|
||||
if (it != x14_transitions.cend())
|
||||
const auto it = rstl::binary_find(x14_transitions.cbegin(), x14_transitions.cend(), std::make_pair(a, b),
|
||||
[](const auto& p) { return p.first; });
|
||||
if (it != x14_transitions.cend()) {
|
||||
return it->second;
|
||||
auto it2 = rstl::binary_find(x24_halfTransitions.cbegin(), x24_halfTransitions.cend(), b,
|
||||
[](const std::pair<u32, std::shared_ptr<IMetaTrans>>& p) { return p.first; });
|
||||
if (it2 != x24_halfTransitions.cend())
|
||||
}
|
||||
|
||||
const auto it2 = rstl::binary_find(x24_halfTransitions.cbegin(), x24_halfTransitions.cend(), b,
|
||||
[](const auto& p) { return p.first; });
|
||||
if (it2 != x24_halfTransitions.cend()) {
|
||||
return it2->second;
|
||||
}
|
||||
|
||||
return x10_defaultTrans;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,31 +22,35 @@ SAdvancementResults IAnimReader::VGetAdvancementResults(const CCharAnimTime& a,
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 IAnimReader::GetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk) const {
|
||||
if (time.GreaterThanZero())
|
||||
size_t IAnimReader::GetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32 unk) const {
|
||||
if (time.GreaterThanZero()) {
|
||||
return VGetBoolPOIList(time, listOut, capacity, iterator, unk);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 IAnimReader::GetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk) const {
|
||||
if (time.GreaterThanZero())
|
||||
return VGetInt32POIList(time, listOut, capacity, iterator, unk);
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 IAnimReader::GetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator,
|
||||
size_t IAnimReader::GetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator,
|
||||
u32 unk) const {
|
||||
if (time.GreaterThanZero())
|
||||
return VGetParticlePOIList(time, listOut, capacity, iterator, unk);
|
||||
if (time.GreaterThanZero()) {
|
||||
return VGetInt32POIList(time, listOut, capacity, iterator, unk);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 IAnimReader::GetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32 unk) const {
|
||||
if (time.GreaterThanZero())
|
||||
size_t IAnimReader::GetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity,
|
||||
size_t iterator, u32 unk) const {
|
||||
if (time.GreaterThanZero()) {
|
||||
return VGetParticlePOIList(time, listOut, capacity, iterator, unk);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t IAnimReader::GetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32 unk) const {
|
||||
if (time.GreaterThanZero()) {
|
||||
return VGetSoundPOIList(time, listOut, capacity, iterator, unk);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,14 +114,14 @@ public:
|
||||
virtual bool VHasOffset(const CSegId& seg) const = 0;
|
||||
virtual zeus::CVector3f VGetOffset(const CSegId& seg) const = 0;
|
||||
virtual zeus::CQuaternion VGetRotation(const CSegId& seg) const = 0;
|
||||
virtual u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const = 0;
|
||||
virtual u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const = 0;
|
||||
virtual u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator,
|
||||
virtual size_t VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const = 0;
|
||||
virtual size_t VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const = 0;
|
||||
virtual size_t VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const = 0;
|
||||
virtual size_t VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const = 0;
|
||||
virtual u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator,
|
||||
u32) const = 0;
|
||||
virtual bool VGetBoolPOIState(std::string_view name) const = 0;
|
||||
virtual s32 VGetInt32POIState(std::string_view name) const = 0;
|
||||
virtual CParticleData::EParentedMode VGetParticlePOIState(std::string_view name) const = 0;
|
||||
@@ -133,10 +133,13 @@ public:
|
||||
virtual void VSetPhase(float) = 0;
|
||||
virtual SAdvancementResults VGetAdvancementResults(const CCharAnimTime& a, const CCharAnimTime& b) const;
|
||||
|
||||
u32 GetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||
u32 GetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||
u32 GetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||
u32 GetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||
size_t GetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, size_t capacity, size_t iterator, u32) const;
|
||||
size_t GetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const;
|
||||
size_t GetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const;
|
||||
size_t GetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, size_t capacity, size_t iterator,
|
||||
u32) const;
|
||||
|
||||
std::optional<std::unique_ptr<IAnimReader>> Simplified() { return VSimplified(); }
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "Runtime/Character/IMetaAnim.hpp"
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "Runtime/Character/CAnimTreeNode.hpp"
|
||||
#include "Runtime/Character/CBoolPOINode.hpp"
|
||||
#include "Runtime/Character/CCharAnimTime.hpp"
|
||||
@@ -29,17 +31,19 @@ void IMetaAnim::AdvanceAnim(IAnimReader& anim, const CCharAnimTime& dt) {
|
||||
}
|
||||
|
||||
CCharAnimTime IMetaAnim::GetTime(const CPreAdvanceIndicator& ind, const IAnimReader& anim) {
|
||||
if (ind.IsTime())
|
||||
if (ind.IsTime()) {
|
||||
return ind.GetTime();
|
||||
}
|
||||
|
||||
CBoolPOINode nodes[64];
|
||||
CCharAnimTime rem = anim.VGetTimeRemaining();
|
||||
u32 count = anim.VGetBoolPOIList(rem, nodes, 64, 0, 0);
|
||||
std::array<CBoolPOINode, 64> nodes;
|
||||
const CCharAnimTime rem = anim.VGetTimeRemaining();
|
||||
const size_t count = anim.VGetBoolPOIList(rem, nodes.data(), nodes.size(), 0, 0);
|
||||
const char* cmpStr = ind.GetString();
|
||||
for (u32 i = 0; i < count; ++i) {
|
||||
CBoolPOINode& node = nodes[i];
|
||||
if (node.GetString() != cmpStr || !node.GetValue())
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
const CBoolPOINode& node = nodes[i];
|
||||
if (node.GetString() != cmpStr || !node.GetValue()) {
|
||||
continue;
|
||||
}
|
||||
return node.GetTime();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,18 +52,39 @@ static bool BoxLineTest(const zeus::CAABox& aabb, const zeus::CLine& line, float
|
||||
return lT <= hT;
|
||||
}
|
||||
|
||||
static const int SomeIndexA[] = {1, 2, 4};
|
||||
constexpr std::array SomeIndexA{1, 2, 4};
|
||||
|
||||
static const int SomeIndexB[] = {1, 2, 0};
|
||||
constexpr std::array SomeIndexB{1, 2, 0};
|
||||
|
||||
static const int SomeIndexC[8][8] = {{0, 1, 2, 4, 5, 6, 8, 0xA}, {0, 1, 2, 3, 5, 6, 8, 0xA}, {0, 1, 2, 4, 5, 6, 9, 0xB},
|
||||
{0, 1, 2, 3, 5, 6, 9, 0xC}, {0, 1, 2, 4, 5, 7, 8, 0xD}, {0, 1, 2, 3, 5, 7, 8, 0xE},
|
||||
{0, 1, 2, 4, 5, 7, 9, 0xF}, {0, 1, 2, 3, 5, 7, 9, 0xF}};
|
||||
constexpr std::array<std::array<int, 8>, 8> SomeIndexC{{
|
||||
{0, 1, 2, 4, 5, 6, 8, 0xA},
|
||||
{0, 1, 2, 3, 5, 6, 8, 0xA},
|
||||
{0, 1, 2, 4, 5, 6, 9, 0xB},
|
||||
{0, 1, 2, 3, 5, 6, 9, 0xC},
|
||||
{0, 1, 2, 4, 5, 7, 8, 0xD},
|
||||
{0, 1, 2, 3, 5, 7, 8, 0xE},
|
||||
{0, 1, 2, 4, 5, 7, 9, 0xF},
|
||||
{0, 1, 2, 3, 5, 7, 9, 0xF},
|
||||
}};
|
||||
|
||||
static const std::pair<int, std::array<int, 3>> SubdivIndex[16] = {
|
||||
{0, {0, 0, 0}}, {1, {0, 0, 0}}, {1, {1, 0, 0}}, {2, {0, 1, 0}}, {2, {1, 0, 0}}, {1, {2, 0, 0}},
|
||||
{2, {0, 2, 0}}, {2, {2, 0, 0}}, {2, {2, 1, 0}}, {2, {1, 2, 0}}, {3, {0, 2, 1}}, {3, {1, 0, 2}},
|
||||
{3, {0, 1, 2}}, {3, {2, 1, 0}}, {3, {2, 0, 1}}, {3, {1, 2, 0}}};
|
||||
constexpr std::array<std::pair<int, std::array<int, 3>>, 16> SubdivIndex{{
|
||||
{0, {0, 0, 0}},
|
||||
{1, {0, 0, 0}},
|
||||
{1, {1, 0, 0}},
|
||||
{2, {0, 1, 0}},
|
||||
{2, {1, 0, 0}},
|
||||
{1, {2, 0, 0}},
|
||||
{2, {0, 2, 0}},
|
||||
{2, {2, 0, 0}},
|
||||
{2, {2, 1, 0}},
|
||||
{2, {1, 2, 0}},
|
||||
{3, {0, 2, 1}},
|
||||
{3, {1, 0, 2}},
|
||||
{3, {0, 1, 2}},
|
||||
{3, {2, 1, 0}},
|
||||
{3, {2, 0, 1}},
|
||||
{3, {1, 2, 0}},
|
||||
}};
|
||||
|
||||
bool CAreaOctTree::Node::LineTestInternal(const zeus::CLine& line, const CMaterialFilter& filter, float lT, float hT,
|
||||
float maxT, const zeus::CVector3f& vec) const {
|
||||
@@ -149,7 +170,7 @@ bool CAreaOctTree::Node::LineTestInternal(const zeus::CLine& line, const CMateri
|
||||
int r28 = 0;
|
||||
int r25 = 0;
|
||||
int r26 = 0;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (size_t i = 0; i < 3; ++i) {
|
||||
if (r6[i] >= center[i])
|
||||
r28 |= SomeIndexA[i];
|
||||
if (r7[i] >= center[i])
|
||||
|
||||
@@ -122,12 +122,12 @@ CCollisionActorManager::CCollisionActorManager(CStateManager& mgr, TUniqueId own
|
||||
}
|
||||
}
|
||||
|
||||
void CCollisionActorManager::Destroy(CStateManager& mgr) const {
|
||||
void CCollisionActorManager::Destroy(CStateManager& mgr) {
|
||||
for (const CJointCollisionDescription& desc : x0_jointDescriptions) {
|
||||
mgr.FreeScriptObject(desc.GetCollisionActorId());
|
||||
}
|
||||
|
||||
const_cast<CCollisionActorManager&>(*this).x13_destroyed = true;
|
||||
x13_destroyed = true;
|
||||
}
|
||||
|
||||
void CCollisionActorManager::SetActive(CStateManager& mgr, bool active) {
|
||||
|
||||
@@ -30,8 +30,8 @@ public:
|
||||
CCollisionActorManager(CStateManager& mgr, TUniqueId owner, TAreaId area,
|
||||
const std::vector<CJointCollisionDescription>& descs, bool active);
|
||||
|
||||
void Update(float dt, CStateManager& mgr, CCollisionActorManager::EUpdateOptions opts);
|
||||
void Destroy(CStateManager& mgr) const;
|
||||
void Update(float dt, CStateManager& mgr, EUpdateOptions opts);
|
||||
void Destroy(CStateManager& mgr);
|
||||
void SetActive(CStateManager& mgr, bool active);
|
||||
bool GetActive() const { return x12_active; }
|
||||
void AddMaterial(CStateManager& mgr, const CMaterialList& list);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "Runtime/Collision/CMaterialFilter.hpp"
|
||||
|
||||
namespace urde {
|
||||
const CMaterialFilter CMaterialFilter::skPassEverything({0x00000000FFFFFFFF}, {0},
|
||||
CMaterialFilter::EFilterType::Always);
|
||||
constexpr CMaterialFilter CMaterialFilter::skPassEverything({0x00000000FFFFFFFF}, {0}, EFilterType::Always);
|
||||
} // namespace urde
|
||||
|
||||
@@ -173,16 +173,12 @@ public:
|
||||
class CAreaCollisionCache {
|
||||
zeus::CAABox x0_aabb;
|
||||
rstl::reserved_vector<CMetroidAreaCollider::COctreeLeafCache, 3> x18_leafCaches;
|
||||
union {
|
||||
struct {
|
||||
bool x1b40_24_leafOverflow : 1;
|
||||
bool x1b40_25_cacheOverflow : 1;
|
||||
};
|
||||
u32 _dummy = 0;
|
||||
};
|
||||
bool x1b40_24_leafOverflow : 1;
|
||||
bool x1b40_25_cacheOverflow : 1;
|
||||
|
||||
public:
|
||||
explicit CAreaCollisionCache(const zeus::CAABox& aabb) : x0_aabb(aabb) {}
|
||||
explicit CAreaCollisionCache(const zeus::CAABox& aabb)
|
||||
: x0_aabb(aabb), x1b40_24_leafOverflow(false), x1b40_25_cacheOverflow(false) {}
|
||||
void ClearCache();
|
||||
const zeus::CAABox& GetCacheBounds() const { return x0_aabb; }
|
||||
void SetCacheBounds(const zeus::CAABox& aabb) { x0_aabb = aabb; }
|
||||
|
||||
@@ -57,11 +57,9 @@ extern class CStateManager* g_StateManager;
|
||||
#if USE_DOWNCAST_TWEAKS
|
||||
using ITweakGame = DataSpec::DNAMP1::CTweakGame;
|
||||
using ITweakPlayer = DataSpec::DNAMP1::CTweakPlayer;
|
||||
using ITweakPlayerRes = DataSpec::DNAMP1::CTweakPlayerRes;
|
||||
using ITweakPlayerControl = DataSpec::DNAMP1::CTweakPlayerControl;
|
||||
using ITweakPlayerGun = DataSpec::DNAMP1::CTweakPlayerGun;
|
||||
using ITweakGunRes = DataSpec::DNAMP1::CTweakGunRes;
|
||||
using ITweakTargeting = DataSpec::DNAMP1::CTweakTargeting;
|
||||
using ITweakAutoMapper = DataSpec::DNAMP1::CTweakAutoMapper;
|
||||
using ITweakGui = DataSpec::DNAMP1::CTweakGui;
|
||||
using ITweakSlideShow = DataSpec::DNAMP1::CTweakSlideShow;
|
||||
@@ -71,11 +69,9 @@ using ITweakGuiColors = DataSpec::DNAMP1::CTweakGuiColors;
|
||||
#else
|
||||
using ITweakGame = DataSpec::ITweakGame;
|
||||
using ITweakPlayer = DataSpec::ITweakPlayer;
|
||||
using ITweakPlayerRes = DataSpec::ITweakPlayerRes;
|
||||
using ITweakPlayerControl = DataSpec::ITweakPlayerControl;
|
||||
using ITweakPlayerGun = DataSpec::ITweakPlayerGun;
|
||||
using ITweakGunRes = DataSpec::ITweakGunRes;
|
||||
using ITweakTargeting = DataSpec::ITweakTargeting;
|
||||
using ITweakAutoMapper = DataSpec::ITweakAutoMapper;
|
||||
using ITweakGui = DataSpec::ITweakGui;
|
||||
using ITweakSlideShow = DataSpec::ITweakSlideShow;
|
||||
@@ -83,6 +79,8 @@ using ITweakParticle = DataSpec::ITweakParticle;
|
||||
using ITweakBall = DataSpec::ITweakBall;
|
||||
using ITweakGuiColors = DataSpec::ITweakGuiColors;
|
||||
#endif
|
||||
using ITweakPlayerRes = DataSpec::ITweakPlayerRes;
|
||||
using ITweakTargeting = DataSpec::ITweakTargeting;
|
||||
|
||||
extern ITweakGame* g_tweakGame;
|
||||
extern ITweakPlayer* g_tweakPlayer;
|
||||
|
||||
@@ -148,7 +148,7 @@ void Buckets::Sort() {
|
||||
if (bucket.size() < bucket.capacity())
|
||||
bucket.push_back(&drawable);
|
||||
// else
|
||||
// Log.report(logvisor::Fatal, fmt("Full bucket!!!"));
|
||||
// Log.report(logvisor::Fatal, FMT_STRING("Full bucket!!!"));
|
||||
}
|
||||
|
||||
u16 bucketIdx = u16(sBuckets->size());
|
||||
@@ -183,7 +183,7 @@ void Buckets::InsertPlaneObject(float closeDist, float farDist, const zeus::CAAB
|
||||
void Buckets::Insert(const zeus::CVector3f& pos, const zeus::CAABox& aabb, EDrawableType dtype, void* data,
|
||||
const zeus::CPlane& plane, u16 extraSort) {
|
||||
if (sData->size() == sData->capacity()) {
|
||||
Log.report(logvisor::Fatal, fmt("Rendering buckets filled to capacity"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("Rendering buckets filled to capacity"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -681,7 +681,16 @@ void CBooRenderer::LoadBallFade() {
|
||||
}
|
||||
|
||||
CBooRenderer::CBooRenderer(IObjectStore& store, IFactory& resFac)
|
||||
: x8_factory(resFac), xc_store(store), x2a8_thermalRand(20) {
|
||||
: x8_factory(resFac), xc_store(store), x2a8_thermalRand(20)
|
||||
, x318_24_refectionDirty(false)
|
||||
, x318_25_drawWireframe(false)
|
||||
, x318_26_requestRGBA6(false)
|
||||
, x318_27_currentRGBA6(false)
|
||||
, x318_28_disableFog(false)
|
||||
, x318_29_thermalVisor(false)
|
||||
, x318_30_inAreaDraw(false)
|
||||
, x318_31_persistRGBA6(false)
|
||||
, m_thermalHotPass(false) {
|
||||
g_Renderer = this;
|
||||
xee_24_ = true;
|
||||
|
||||
@@ -1397,9 +1406,9 @@ void CBooRenderer::DrawOverlappingWorldModelShadows(int alphaVal, const std::vec
|
||||
return;
|
||||
|
||||
flags.x4_color.r() = alphaVal / 255.f;
|
||||
const CBooModel& model = *item.x10_models[wordModel + j];
|
||||
const_cast<CBooModel&>(model).UpdateUniformData(flags, nullptr, nullptr, 2);
|
||||
const_cast<CBooModel&>(model).VerifyCurrentShader(0);
|
||||
CBooModel& model = *item.x10_models[wordModel + j];
|
||||
model.UpdateUniformData(flags, nullptr, nullptr, 2);
|
||||
model.VerifyCurrentShader(0);
|
||||
for (const CBooSurface* surf = model.x38_firstUnsortedSurface; surf; surf = surf->m_next)
|
||||
if (surf->GetBounds().intersects(aabb))
|
||||
model.DrawSurface(*surf, flags);
|
||||
|
||||
@@ -152,20 +152,15 @@ class CBooRenderer final : public IRenderer {
|
||||
// std::unique_ptr<CTexture> x314_phazonSuitMask;
|
||||
CPhazonSuitFilter m_phazonSuitFilter;
|
||||
|
||||
union {
|
||||
struct {
|
||||
bool x318_24_refectionDirty : 1;
|
||||
bool x318_25_drawWireframe : 1;
|
||||
bool x318_26_requestRGBA6 : 1;
|
||||
bool x318_27_currentRGBA6 : 1;
|
||||
bool x318_28_disableFog : 1;
|
||||
bool x318_29_thermalVisor : 1;
|
||||
bool x318_30_inAreaDraw : 1;
|
||||
bool x318_31_persistRGBA6 : 1;
|
||||
bool m_thermalHotPass : 1;
|
||||
};
|
||||
u16 dummy = 0;
|
||||
};
|
||||
bool x318_24_refectionDirty : 1;
|
||||
bool x318_25_drawWireframe : 1;
|
||||
bool x318_26_requestRGBA6 : 1;
|
||||
bool x318_27_currentRGBA6 : 1;
|
||||
bool x318_28_disableFog : 1;
|
||||
bool x318_29_thermalVisor : 1;
|
||||
bool x318_30_inAreaDraw : 1;
|
||||
bool x318_31_persistRGBA6 : 1;
|
||||
bool m_thermalHotPass : 1;
|
||||
|
||||
void GenerateFogVolumeRampTex(boo::IGraphicsDataFactory::Context& ctx);
|
||||
void GenerateSphereRampTex(boo::IGraphicsDataFactory::Context& ctx);
|
||||
|
||||
@@ -35,7 +35,7 @@ SViewport g_Viewport = {
|
||||
};
|
||||
u32 CGraphics::g_FrameCounter = 0;
|
||||
|
||||
const std::array<zeus::CMatrix3f, 6> CGraphics::skCubeBasisMats{{
|
||||
constexpr std::array<zeus::CMatrix3f, 6> CGraphics::skCubeBasisMats{{
|
||||
/* Right */
|
||||
{0.f, 1.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, -1.f},
|
||||
/* Left */
|
||||
|
||||
@@ -24,7 +24,7 @@ CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, EPrimitive
|
||||
const boo::ObjToken<boo::ITexture>& texture, bool additive, bool zTest, bool zGEqual)
|
||||
: m_mode(mode), m_maxVerts(maxVerts) {
|
||||
if (maxVerts < 2) {
|
||||
LineRendererLog.report(logvisor::Fatal, fmt(_SYS_STR("maxVerts < 2, maxVerts = {}")), maxVerts);
|
||||
LineRendererLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("maxVerts < 2, maxVerts = {}")), maxVerts);
|
||||
return;
|
||||
}
|
||||
m_textured = bool(texture);
|
||||
@@ -55,7 +55,7 @@ CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const boo::ObjTo
|
||||
bool additive, bool zTest, bool zGEqual)
|
||||
: m_mode(mode), m_maxVerts(maxVerts) {
|
||||
if (maxVerts < 2) {
|
||||
LineRendererLog.report(logvisor::Fatal, fmt(_SYS_STR("maxVerts < 2, maxVerts = {}")), maxVerts);
|
||||
LineRendererLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("maxVerts < 2, maxVerts = {}")), maxVerts);
|
||||
return;
|
||||
}
|
||||
m_textured = bool(texture);
|
||||
|
||||
@@ -37,12 +37,12 @@ struct CModelFlags {
|
||||
zeus::CColor addColor = zeus::skClear;
|
||||
zeus::CAABox mbShadowBox;
|
||||
|
||||
CModelFlags() = default;
|
||||
CModelFlags(u8 blendMode, u8 shadIdx, u16 flags, const zeus::CColor& col)
|
||||
constexpr CModelFlags() = default;
|
||||
constexpr CModelFlags(u8 blendMode, u8 shadIdx, u16 flags, const zeus::CColor& col)
|
||||
: x0_blendMode(blendMode), x1_matSetIdx(shadIdx), x2_flags(flags), x4_color(col) {
|
||||
/* Blend mode will override this if the surface's original material is opaque */
|
||||
m_noZWrite = !(x2_flags & 0x2);
|
||||
m_depthGreater = (x2_flags & 0x8);
|
||||
m_noZWrite = (x2_flags & 0x2) == 0;
|
||||
m_depthGreater = (x2_flags & 0x8) != 0;
|
||||
}
|
||||
|
||||
/* Flags
|
||||
|
||||
@@ -268,7 +268,7 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf) {
|
||||
}
|
||||
|
||||
if (m_instances.size() >= 512) {
|
||||
Log.report(logvisor::Fatal, fmt("Model buffer overflow"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("Model buffer overflow"));
|
||||
}
|
||||
|
||||
ModelInstance& newInst = m_instances.emplace_back();
|
||||
@@ -309,29 +309,37 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf) {
|
||||
m_uniformDataSize = uniBufSize;
|
||||
newInst.m_uniformBuffer = ctx.newDynamicBuffer(boo::BufferUse::Uniform, uniBufSize, 1);
|
||||
|
||||
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {geomUniformBuf.get(), geomUniformBuf.get(),
|
||||
newInst.m_uniformBuffer.get(), newInst.m_uniformBuffer.get()};
|
||||
const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 4> bufs{
|
||||
geomUniformBuf.get(),
|
||||
geomUniformBuf.get(),
|
||||
newInst.m_uniformBuffer.get(),
|
||||
newInst.m_uniformBuffer.get(),
|
||||
};
|
||||
|
||||
/* Binding for each surface */
|
||||
newInst.m_shaderDataBindings.reserve(x0_surfaces->size());
|
||||
|
||||
size_t thisOffs[4];
|
||||
size_t thisSizes[4];
|
||||
std::array<size_t, 4> thisOffs;
|
||||
std::array<size_t, 4> thisSizes;
|
||||
|
||||
static const boo::PipelineStage stages[4] = {boo::PipelineStage::Vertex, boo::PipelineStage::Vertex,
|
||||
boo::PipelineStage::Fragment, boo::PipelineStage::Vertex};
|
||||
static constexpr std::array stages{
|
||||
boo::PipelineStage::Vertex,
|
||||
boo::PipelineStage::Vertex,
|
||||
boo::PipelineStage::Fragment,
|
||||
boo::PipelineStage::Vertex,
|
||||
};
|
||||
|
||||
/* Enumerate surfaces and build data bindings */
|
||||
size_t curReflect = reflectOff + 256;
|
||||
for (const CBooSurface& surf : *x0_surfaces) {
|
||||
const MaterialSet::Material& mat = x4_matSet->materials.at(surf.m_data.matIdx);
|
||||
|
||||
boo::ObjToken<boo::ITexture> texs[12] = {g_Renderer->m_clearTexture.get(), g_Renderer->m_clearTexture.get(),
|
||||
g_Renderer->m_clearTexture.get(), g_Renderer->m_clearTexture.get(),
|
||||
g_Renderer->m_clearTexture.get(), g_Renderer->m_clearTexture.get(),
|
||||
g_Renderer->m_clearTexture.get(), g_Renderer->m_clearTexture.get(),
|
||||
g_Renderer->x220_sphereRamp.get(), g_Renderer->x220_sphereRamp.get(),
|
||||
g_Renderer->x220_sphereRamp.get(), g_Renderer->x220_sphereRamp.get()};
|
||||
std::array<boo::ObjToken<boo::ITexture>, 12> texs{
|
||||
g_Renderer->m_clearTexture.get(), g_Renderer->m_clearTexture.get(), g_Renderer->m_clearTexture.get(),
|
||||
g_Renderer->m_clearTexture.get(), g_Renderer->m_clearTexture.get(), g_Renderer->m_clearTexture.get(),
|
||||
g_Renderer->m_whiteTexture.get(), g_Renderer->m_clearTexture.get(), g_Renderer->x220_sphereRamp.get(),
|
||||
g_Renderer->x220_sphereRamp.get(), g_Renderer->x220_sphereRamp.get(), g_Renderer->x220_sphereRamp.get(),
|
||||
};
|
||||
if (!g_DummyTextures) {
|
||||
for (const auto& ch : mat.chunks) {
|
||||
if (auto pass = ch.get_if<MaterialSet::Material::PASS>()) {
|
||||
@@ -401,9 +409,9 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf) {
|
||||
else
|
||||
texs[11] = g_Renderer->x220_sphereRamp.get();
|
||||
}
|
||||
extendeds.push_back(ctx.newShaderDataBinding(pipeline, newInst.GetBooVBO(*this, ctx), nullptr,
|
||||
m_staticIbo.get(), 4, bufs, stages, thisOffs, thisSizes, 12, texs,
|
||||
nullptr, nullptr));
|
||||
extendeds.push_back(ctx.newShaderDataBinding(
|
||||
pipeline, newInst.GetBooVBO(*this, ctx), nullptr, m_staticIbo.get(), bufs.size(), bufs.data(),
|
||||
stages.data(), thisOffs.data(), thisSizes.data(), texs.size(), texs.data(), nullptr, nullptr));
|
||||
idx = EExtendedShader(size_t(idx) + 1);
|
||||
}
|
||||
}
|
||||
@@ -640,7 +648,7 @@ static EExtendedShader ResolveExtendedShader(const MaterialSet::Material& data,
|
||||
|
||||
void CBooModel::DrawSurface(const CBooSurface& surf, const CModelFlags& flags) const {
|
||||
// if (m_uniUpdateCount == 0)
|
||||
// Log.report(logvisor::Fatal, fmt("UpdateUniformData() not called"));
|
||||
// Log.report(logvisor::Fatal, FMT_STRING("UpdateUniformData() not called"));
|
||||
if (m_uniUpdateCount == 0 || m_uniUpdateCount > m_instances.size())
|
||||
return;
|
||||
const ModelInstance& inst = m_instances[m_uniUpdateCount - 1];
|
||||
@@ -1175,7 +1183,7 @@ CModel::CModel(std::unique_ptr<u8[]>&& in, u32 /* dataLen */, IObjectStore* stor
|
||||
u32 version = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x4));
|
||||
m_flags = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x8));
|
||||
if (version != 0x10002)
|
||||
Log.report(logvisor::Fatal, fmt("invalid CMDL for loading with boo"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("invalid CMDL for loading with boo"));
|
||||
|
||||
u32 secCount = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x24));
|
||||
u32 matSetCount = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x28));
|
||||
|
||||
@@ -140,10 +140,12 @@ u32 CMoviePlayer::THPAudioDecode(s16* buffer, const u8* audioFrame, bool stereo)
|
||||
}
|
||||
|
||||
CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bool deinterlace)
|
||||
: CDvdFile(path), xec_preLoadSeconds(preLoadSeconds) {
|
||||
xf4_24_loop = loop;
|
||||
m_deinterlace = deinterlace;
|
||||
|
||||
: CDvdFile(path)
|
||||
, xec_preLoadSeconds(preLoadSeconds)
|
||||
, xf4_24_loop(loop)
|
||||
, xf4_25_hasAudio(false)
|
||||
, xf4_26_fieldFlip(false)
|
||||
, m_deinterlace(deinterlace) {
|
||||
/* Read THP header information */
|
||||
u8 buf[64];
|
||||
SyncRead(buf, 64);
|
||||
|
||||
@@ -99,21 +99,15 @@ private:
|
||||
float xe8_curSeconds = 0.f;
|
||||
float xec_preLoadSeconds;
|
||||
u32 xf0_preLoadFrames = 0;
|
||||
bool xf4_24_loop : 1;
|
||||
bool xf4_25_hasAudio : 1;
|
||||
bool xf4_26_fieldFlip : 1;
|
||||
bool m_deinterlace : 1;
|
||||
u32 xf8_ = 0;
|
||||
u32 xfc_fieldIndex = 0;
|
||||
|
||||
std::unique_ptr<uint8_t[]> m_yuvBuf;
|
||||
|
||||
union {
|
||||
u32 m_dummy = 0;
|
||||
struct {
|
||||
bool xf4_24_loop : 1;
|
||||
bool xf4_25_hasAudio : 1;
|
||||
bool xf4_26_fieldFlip : 1;
|
||||
bool m_deinterlace : 1;
|
||||
};
|
||||
};
|
||||
|
||||
specter::View::ViewBlock m_viewVertBlock;
|
||||
boo::ObjToken<boo::IGraphicsBufferD> m_blockBuf;
|
||||
boo::ObjToken<boo::IGraphicsBufferD> m_vertBuf;
|
||||
|
||||
@@ -22,7 +22,7 @@ CRainSplashGenerator::CRainSplashGenerator(const zeus::CVector3f& scale, u32 max
|
||||
} BooTrace);
|
||||
}
|
||||
|
||||
void CRainSplashGenerator::SSplashLine::Draw(float alpha, float dt, const zeus::CVector3f& pos) const {
|
||||
void CRainSplashGenerator::SSplashLine::Draw(float alpha, float dt, const zeus::CVector3f& pos) {
|
||||
if (x0_t > 0.f) {
|
||||
float delta = dt * xc_speed;
|
||||
float vt = std::max(0.f, x0_t - delta * x15_length);
|
||||
@@ -39,36 +39,40 @@ void CRainSplashGenerator::SSplashLine::Draw(float alpha, float dt, const zeus::
|
||||
}
|
||||
}
|
||||
|
||||
void CRainSplashGenerator::SRainSplash::Draw(float alpha, float dt, const zeus::CVector3f& pos) const {
|
||||
for (const SSplashLine& line : x0_lines)
|
||||
void CRainSplashGenerator::SRainSplash::Draw(float alpha, float dt, const zeus::CVector3f& pos) {
|
||||
for (SSplashLine& line : x0_lines) {
|
||||
line.Draw(alpha, dt, pos);
|
||||
}
|
||||
}
|
||||
|
||||
void CRainSplashGenerator::DoDraw(const zeus::CTransform& xf) const {
|
||||
void CRainSplashGenerator::DoDraw(const zeus::CTransform& xf) {
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP("CRainSplashGenerator::DoDraw", zeus::skYellow);
|
||||
CGraphics::SetModelMatrix(xf);
|
||||
if (x40_queueSize > 0) {
|
||||
if (x38_queueTail <= x3c_queueHead) {
|
||||
for (size_t i = x3c_queueHead; i < x0_rainSplashes.size(); ++i) {
|
||||
const SRainSplash& splash = x0_rainSplashes[i];
|
||||
SRainSplash& splash = x0_rainSplashes[i];
|
||||
splash.Draw(x30_alpha, x28_dt, splash.x64_pos);
|
||||
}
|
||||
for (size_t i = 0; i < x38_queueTail; ++i) {
|
||||
const SRainSplash& splash = x0_rainSplashes[i];
|
||||
SRainSplash& splash = x0_rainSplashes[i];
|
||||
splash.Draw(x30_alpha, x28_dt, splash.x64_pos);
|
||||
}
|
||||
} else {
|
||||
for (size_t i = x3c_queueHead; i < x38_queueTail; ++i) {
|
||||
const SRainSplash& splash = x0_rainSplashes[i];
|
||||
SRainSplash& splash = x0_rainSplashes[i];
|
||||
splash.Draw(x30_alpha, x28_dt, splash.x64_pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CRainSplashGenerator::Draw(const zeus::CTransform& xf) const {
|
||||
if (x48_25_raining)
|
||||
DoDraw(xf);
|
||||
void CRainSplashGenerator::Draw(const zeus::CTransform& xf) {
|
||||
if (!x48_25_raining) {
|
||||
return;
|
||||
}
|
||||
|
||||
DoDraw(xf);
|
||||
}
|
||||
|
||||
CRainSplashGenerator::SSplashLine::SSplashLine(boo::IGraphicsDataFactory::Context& ctx)
|
||||
|
||||
@@ -23,10 +23,10 @@ class CRainSplashGenerator {
|
||||
u8 x14_ = 3;
|
||||
u8 x15_length = 1;
|
||||
bool x16_active = true; // used to be one-bit bitfield
|
||||
mutable CLineRenderer m_renderer;
|
||||
CLineRenderer m_renderer;
|
||||
explicit SSplashLine(boo::IGraphicsDataFactory::Context& ctx);
|
||||
void Update(float dt, CStateManager& mgr);
|
||||
void Draw(float alpha, float dt, const zeus::CVector3f& pos) const;
|
||||
void Draw(float alpha, float dt, const zeus::CVector3f& pos);
|
||||
void SetActive() { x16_active = true; }
|
||||
};
|
||||
struct SRainSplash {
|
||||
@@ -40,11 +40,11 @@ class CRainSplashGenerator {
|
||||
SRainSplash& operator=(SRainSplash&&) = default;
|
||||
void Update(float dt, CStateManager& mgr);
|
||||
bool IsActive() const;
|
||||
void Draw(float alpha, float dt, const zeus::CVector3f& pos) const;
|
||||
void Draw(float alpha, float dt, const zeus::CVector3f& pos);
|
||||
void SetPoint(const zeus::CVector3f& pos);
|
||||
};
|
||||
std::vector<SRainSplash> x0_rainSplashes;
|
||||
CRandom16 x10_random = {99};
|
||||
CRandom16 x10_random{99};
|
||||
zeus::CVector3f x14_scale;
|
||||
float x20_generateTimer = 0.0f;
|
||||
float x24_generateInterval = 0.0f;
|
||||
@@ -60,7 +60,7 @@ class CRainSplashGenerator {
|
||||
bool x48_25_raining : 1;
|
||||
void UpdateRainSplashRange(CStateManager& mgr, int start, int end, float dt);
|
||||
void UpdateRainSplashes(CStateManager& mgr, float magnitude, float dt);
|
||||
void DoDraw(const zeus::CTransform& xf) const;
|
||||
void DoDraw(const zeus::CTransform& xf);
|
||||
static u32 GetNextBestPt(u32 pt, const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn, CRandom16& rand,
|
||||
float minZ);
|
||||
void AddPoint(const zeus::CVector3f& pos);
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
CRainSplashGenerator(const zeus::CVector3f& scale, u32 maxSplashes, u32 genRate, float minZ, float alpha);
|
||||
void Update(float dt, CStateManager& mgr);
|
||||
void GeneratePoints(const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn);
|
||||
void Draw(const zeus::CTransform& xf) const;
|
||||
void Draw(const zeus::CTransform& xf);
|
||||
bool IsRaining() const { return x48_25_raining; }
|
||||
};
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ zeus::CAABox CSimpleShadow::GetBounds() const {
|
||||
{x0_xf.origin.x() + extent, x0_xf.origin.y() + extent, x0_xf.origin.z() + extent}};
|
||||
}
|
||||
|
||||
void CSimpleShadow::Render(const TLockedToken<CTexture>& tex) const {
|
||||
void CSimpleShadow::Render(const TLockedToken<CTexture>& tex) {
|
||||
if (!x48_24_collision)
|
||||
return;
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP("CSimpleShadow::Render", zeus::skGrey);
|
||||
|
||||
@@ -22,7 +22,7 @@ class CSimpleShadow {
|
||||
bool x48_24_collision : 1;
|
||||
bool x48_25_alwaysCalculateRadius : 1;
|
||||
bool x48_26_radiusCalculated : 1;
|
||||
mutable std::optional<CTexturedQuadFilter> m_filter;
|
||||
std::optional<CTexturedQuadFilter> m_filter;
|
||||
|
||||
public:
|
||||
CSimpleShadow(float scale, float userAlpha, float maxObjHeight, float displacement);
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
float GetMaxObjectHeight() const { return x40_maxObjHeight; }
|
||||
void SetUserAlpha(float a) { x38_userAlpha = a; }
|
||||
const zeus::CTransform& GetTransform() const { return x0_xf; }
|
||||
void Render(const TLockedToken<CTexture>& tex) const;
|
||||
void Render(const TLockedToken<CTexture>& tex);
|
||||
void Calculate(const zeus::CAABox& aabb, const zeus::CTransform& xf, const CStateManager& mgr);
|
||||
};
|
||||
} // namespace urde
|
||||
|
||||
@@ -12,13 +12,13 @@ CSkinnedModel::CSkinnedModel(TLockedToken<CModel> model, TLockedToken<CSkinRules
|
||||
TLockedToken<CCharLayoutInfo> layoutInfo, int shaderIdx, int drawInsts)
|
||||
: x4_model(std::move(model)), x10_skinRules(std::move(skinRules)), x1c_layoutInfo(std::move(layoutInfo)) {
|
||||
if (!x4_model) {
|
||||
Log.report(logvisor::Fatal, fmt("bad model token provided to CSkinnedModel"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("bad model token provided to CSkinnedModel"));
|
||||
}
|
||||
if (!x10_skinRules) {
|
||||
Log.report(logvisor::Fatal, fmt("bad skin token provided to CSkinnedModel"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("bad skin token provided to CSkinnedModel"));
|
||||
}
|
||||
if (!x1c_layoutInfo) {
|
||||
Log.report(logvisor::Fatal, fmt("bad character layout token provided to CSkinnedModel"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("bad character layout token provided to CSkinnedModel"));
|
||||
}
|
||||
m_modelInst = x4_model->MakeNewInstance(shaderIdx, drawInsts);
|
||||
}
|
||||
|
||||
@@ -552,7 +552,7 @@ void CTexture::BuildRGBA8(const void* data, size_t length) {
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
size_t expectedSize = texelCount * 4;
|
||||
if (expectedSize > length)
|
||||
Log.report(logvisor::Fatal, fmt("insufficient TXTR length ({}/{})"), length, expectedSize);
|
||||
Log.report(logvisor::Fatal, FMT_STRING("insufficient TXTR length ({}/{})"), length, expectedSize);
|
||||
|
||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat, data,
|
||||
@@ -565,7 +565,7 @@ void CTexture::BuildRGBA8(const void* data, size_t length) {
|
||||
void CTexture::BuildC8(const void* data, size_t length) {
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
if (texelCount > length)
|
||||
Log.report(logvisor::Fatal, fmt("insufficient TXTR length ({}/{})"), length, texelCount);
|
||||
Log.report(logvisor::Fatal, FMT_STRING("insufficient TXTR length ({}/{})"), length, texelCount);
|
||||
|
||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
uint32_t nentries = hecl::SBig(*reinterpret_cast<const uint32_t*>(data));
|
||||
@@ -763,7 +763,7 @@ CTexture::CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex, const CTex
|
||||
BuildDXT3(owned.get() + 12, length - 12);
|
||||
break;
|
||||
default:
|
||||
Log.report(logvisor::Fatal, fmt("invalid texture type {} for boo"), int(x0_fmt));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("invalid texture type {} for boo"), int(x0_fmt));
|
||||
}
|
||||
|
||||
if (otex)
|
||||
@@ -775,7 +775,7 @@ void CTexture::Load(int slot, EClampMode clamp) const {}
|
||||
std::unique_ptr<u8[]> CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& fmtOut,
|
||||
std::unique_ptr<u8[]>& paletteOut) const {
|
||||
if (!m_otex)
|
||||
Log.report(logvisor::Fatal, fmt("MemoryCard TXTR not loaded with 'otex'"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("MemoryCard TXTR not loaded with 'otex'"));
|
||||
|
||||
size_t texelCount = x4_w * x6_h;
|
||||
std::unique_ptr<u8[]> ret;
|
||||
@@ -851,7 +851,7 @@ std::unique_ptr<u8[]> CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& f
|
||||
}
|
||||
}
|
||||
} else
|
||||
Log.report(logvisor::Fatal, fmt("MemoryCard texture may only use RGBA8PC or C8PC format"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("MemoryCard texture may only use RGBA8PC or C8PC format"));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type) {
|
||||
case EFilterType::Multiply:
|
||||
return s_MultPipeline;
|
||||
default:
|
||||
return {};
|
||||
return s_AlphaPipeline;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +115,6 @@ void CWideScreenFilter::SetViewportToFull() {
|
||||
CGraphics::g_BooMainCommandQueue->setViewport(rect);
|
||||
}
|
||||
|
||||
const zeus::CRectangle CColoredQuadFilter::DefaultRect = {0.f, 0.f, 1.f, 1.f};
|
||||
constexpr zeus::CRectangle CColoredQuadFilter::DefaultRect{0.f, 0.f, 1.f, 1.f};
|
||||
|
||||
} // namespace urde
|
||||
|
||||
@@ -96,7 +96,7 @@ void CParticleSwooshShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::C
|
||||
};
|
||||
|
||||
const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> uniforms{gen.m_uniformBuf.get()};
|
||||
for (size_t i = 0; i < std::size(gen.m_dataBind); ++i) {
|
||||
for (size_t i = 0; i < gen.m_dataBind.size(); ++i) {
|
||||
gen.m_dataBind[i] =
|
||||
ctx.newShaderDataBinding((*pipeline)[i], gen.m_vertBuf.get(), nullptr, nullptr, uniforms.size(),
|
||||
uniforms.data(), nullptr, texr ? 1 : 0, textures.data(), nullptr, nullptr);
|
||||
|
||||
@@ -322,7 +322,7 @@ void CTexturedQuadFilter::DrawFilter(EFilterShape shape, const zeus::CColor& col
|
||||
}
|
||||
}
|
||||
|
||||
const zeus::CRectangle CTexturedQuadFilter::DefaultRect = {0.f, 0.f, 1.f, 1.f};
|
||||
constexpr zeus::CRectangle CTexturedQuadFilter::DefaultRect{0.f, 0.f, 1.f, 1.f};
|
||||
|
||||
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(EFilterType type, const boo::ObjToken<boo::ITexture>& tex)
|
||||
: CTexturedQuadFilter(tex) {
|
||||
|
||||
@@ -57,7 +57,7 @@ void CAuiEnergyBarT01::Draw(const CGuiWidgetDrawParms& drawParms) {
|
||||
if (!xbc_tex || !xbc_tex.IsLoaded() || !xd8_coordFunc) {
|
||||
return;
|
||||
}
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CAuiEnergyBarT01::Draw {}"), m_name).c_str(), zeus::skCyan);
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CAuiEnergyBarT01::Draw {}"), m_name).c_str(), zeus::skCyan);
|
||||
|
||||
CGraphics::SetModelMatrix(x34_worldXF);
|
||||
m_energyBarShader.updateModelMatrix();
|
||||
|
||||
@@ -106,7 +106,7 @@ void CAuiImagePane::Draw(const CGuiWidgetDrawParms& params) {
|
||||
if (!GetIsVisible() || !xb8_tex0Tok.IsLoaded()) {
|
||||
return;
|
||||
}
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CAuiImagePane::Draw {}"), m_name).c_str(), zeus::skCyan);
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CAuiImagePane::Draw {}"), m_name).c_str(), zeus::skCyan);
|
||||
GetIsFinishedLoadingWidgetSpecific();
|
||||
if (!m_filters || m_filters->m_texId != xb8_tex0Tok.GetObjectTag()->id) {
|
||||
m_filters.emplace(xb8_tex0Tok);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
#include "Runtime/CPlayerState.hpp"
|
||||
@@ -27,26 +28,26 @@ class CTargetReticleRenderState {
|
||||
public:
|
||||
static const CTargetReticleRenderState skZeroRenderState;
|
||||
|
||||
CTargetReticleRenderState(TUniqueId target, float radiusWorld, const zeus::CVector3f& positionWorld, float factor,
|
||||
float minVpClampScale, bool orbitZoneIdlePosition)
|
||||
constexpr CTargetReticleRenderState(TUniqueId target, float radiusWorld, const zeus::CVector3f& positionWorld,
|
||||
float factor, float minVpClampScale, bool orbitZoneIdlePosition)
|
||||
: x0_target(target)
|
||||
, x4_radiusWorld(radiusWorld)
|
||||
, x8_positionWorld(positionWorld)
|
||||
, x14_factor(factor)
|
||||
, x18_minVpClampScale(minVpClampScale)
|
||||
, x1c_orbitZoneIdlePosition(orbitZoneIdlePosition) {}
|
||||
void SetTargetId(TUniqueId id) { x0_target = id; }
|
||||
void SetFactor(float f) { x14_factor = f; }
|
||||
void SetIsOrbitZoneIdlePosition(bool b) { x1c_orbitZoneIdlePosition = b; }
|
||||
float GetMinViewportClampScale() const { return x18_minVpClampScale; }
|
||||
float GetFactor() const { return x14_factor; }
|
||||
float GetRadiusWorld() const { return x4_radiusWorld; }
|
||||
const zeus::CVector3f& GetTargetPositionWorld() const { return x8_positionWorld; }
|
||||
bool GetIsOrbitZoneIdlePosition() const { return x1c_orbitZoneIdlePosition; }
|
||||
void SetTargetPositionWorld(const zeus::CVector3f& pos) { x8_positionWorld = pos; }
|
||||
void SetRadiusWorld(float r) { x4_radiusWorld = r; }
|
||||
TUniqueId GetTargetId() const { return x0_target; }
|
||||
void SetMinViewportClampScale(float s) { x18_minVpClampScale = s; }
|
||||
constexpr void SetTargetId(TUniqueId id) { x0_target = id; }
|
||||
constexpr void SetFactor(float factor) { x14_factor = factor; }
|
||||
constexpr void SetIsOrbitZoneIdlePosition(bool orbit) { x1c_orbitZoneIdlePosition = orbit; }
|
||||
constexpr float GetMinViewportClampScale() const { return x18_minVpClampScale; }
|
||||
constexpr float GetFactor() const { return x14_factor; }
|
||||
constexpr float GetRadiusWorld() const { return x4_radiusWorld; }
|
||||
constexpr const zeus::CVector3f& GetTargetPositionWorld() const { return x8_positionWorld; }
|
||||
constexpr bool GetIsOrbitZoneIdlePosition() const { return x1c_orbitZoneIdlePosition; }
|
||||
constexpr void SetTargetPositionWorld(const zeus::CVector3f& position) { x8_positionWorld = position; }
|
||||
constexpr void SetRadiusWorld(float radius) { x4_radiusWorld = radius; }
|
||||
constexpr TUniqueId GetTargetId() const { return x0_target; }
|
||||
constexpr void SetMinViewportClampScale(float scale) { x18_minVpClampScale = scale; }
|
||||
static void InterpolateWithClamp(const CTargetReticleRenderState& a, CTargetReticleRenderState& out,
|
||||
const CTargetReticleRenderState& b, float t);
|
||||
};
|
||||
@@ -69,7 +70,7 @@ private:
|
||||
zeus::CQuaternion x10_laggingOrientation;
|
||||
EReticleState x20_prevState = EReticleState::Unspecified;
|
||||
EReticleState x24_nextState = EReticleState::Unspecified;
|
||||
mutable u32 x28_noDrawTicks = 0;
|
||||
u32 x28_noDrawTicks = 0;
|
||||
float x2c_overshootOffsetHalf;
|
||||
float x30_premultOvershootOffset;
|
||||
TCachedToken<CModel> x34_crosshairs;
|
||||
@@ -120,16 +121,16 @@ private:
|
||||
bool x219_missileShot = false;
|
||||
bool x21a_fullyCharged = false;
|
||||
u8 x21b_ = 0;
|
||||
u32 x21c_;
|
||||
u32 x220_;
|
||||
u32 x228_;
|
||||
u32 x21c_ = 0;
|
||||
u32 x220_ = 0;
|
||||
u32 x228_ = 0;
|
||||
|
||||
struct SScanReticuleRenderer {
|
||||
std::optional<CLineRenderer> m_lineRenderers[2];
|
||||
std::optional<CLineRenderer> m_stripRenderers[2][4];
|
||||
std::array<std::optional<CLineRenderer>, 2> m_lineRenderers;
|
||||
std::array<std::array<std::optional<CLineRenderer>, 4>, 2> m_stripRenderers;
|
||||
SScanReticuleRenderer();
|
||||
};
|
||||
mutable SScanReticuleRenderer m_scanRetRenderer;
|
||||
SScanReticuleRenderer m_scanRetRenderer;
|
||||
|
||||
void DrawGrapplePoint(const CScriptGrapplePoint& point, float t, const CStateManager& mgr, const zeus::CMatrix3f& rot,
|
||||
bool zEqual) const;
|
||||
@@ -144,10 +145,10 @@ public:
|
||||
void UpdateCurrLockOnGroup(float, const CStateManager&);
|
||||
void UpdateNextLockOnGroup(float, const CStateManager&);
|
||||
void UpdateOrbitZoneGroup(float, const CStateManager&);
|
||||
void Draw(const CStateManager&, bool hideLockon) const;
|
||||
void Draw(const CStateManager&, bool hideLockon);
|
||||
void DrawGrappleGroup(const zeus::CMatrix3f& rot, const CStateManager&, bool) const;
|
||||
void DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, const CStateManager&) const;
|
||||
void DrawNextLockOnGroup(const zeus::CMatrix3f& rot, const CStateManager&) const;
|
||||
void DrawNextLockOnGroup(const zeus::CMatrix3f& rot, const CStateManager&);
|
||||
void DrawOrbitZoneGroup(const zeus::CMatrix3f& rot, const CStateManager&) const;
|
||||
void UpdateTargetParameters(CTargetReticleRenderState&, const CStateManager&);
|
||||
float CalculateRadiusWorld(const CActor&, const CStateManager&) const;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
namespace urde {
|
||||
|
||||
CErrorOutputWindow::CErrorOutputWindow(bool flag) : CIOWin("Error Output Window") {
|
||||
x18_24_ = false;
|
||||
x18_25_ = true;
|
||||
x18_26_ = true;
|
||||
x18_27_ = true;
|
||||
|
||||
@@ -11,16 +11,11 @@ public:
|
||||
|
||||
private:
|
||||
State x14_state = State::Zero;
|
||||
union {
|
||||
struct {
|
||||
bool x18_24_;
|
||||
bool x18_25_;
|
||||
bool x18_26_;
|
||||
bool x18_27_;
|
||||
bool x18_28_;
|
||||
};
|
||||
u16 dummy = 0;
|
||||
};
|
||||
bool x18_24_;
|
||||
bool x18_25_;
|
||||
bool x18_26_;
|
||||
bool x18_27_;
|
||||
bool x18_28_;
|
||||
const wchar_t* x1c_msg;
|
||||
|
||||
public:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user