From 734b25cad3ba1cd250d62e58d338f9cec2aeb1eb Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Tue, 1 May 2018 17:43:31 -0700 Subject: [PATCH] Fix doors and various area streaming bugs --- .gitmodules | 3 + Editor/locale | 1 + Editor/locale/CMakeLists.txt | 8 -- Editor/locale/en_GB.yaml | 18 ---- Editor/locale/en_US.yaml | 18 ---- Editor/locale/ja_JP.yaml | 18 ---- Editor/locale/locale.cpp | 69 -------------- Editor/locale/locale.hpp | 15 --- Runtime/CStateManager.cpp | 2 +- Runtime/Camera/CBallCamera.cpp | 12 +-- Runtime/Character/CAnimData.hpp | 6 +- Runtime/Character/CCharacterInfo.cpp | 4 +- Runtime/Character/CCharacterInfo.hpp | 4 +- Runtime/Character/CPOINode.cpp | 6 +- Runtime/Character/CPOINode.hpp | 10 +- Runtime/Graphics/CModelBoo.cpp | 4 + Runtime/MP1/CFrontEndUI.cpp | 1 + Runtime/MP1/MP1.cpp | 2 + Runtime/MP1/World/CParasite.cpp | 18 ++++ Runtime/MP1/World/CParasite.hpp | 9 +- Runtime/World/CGameArea.cpp | 2 +- Runtime/World/CGameArea.hpp | 2 +- Runtime/World/CScriptDock.cpp | 12 ++- Runtime/World/CScriptDock.hpp | 2 +- Runtime/World/CScriptDockAreaChange.cpp | 2 +- Runtime/World/CScriptDockAreaChange.hpp | 1 + Runtime/World/CScriptDoor.cpp | 116 +++++++++++++----------- Runtime/World/CScriptDoor.hpp | 41 +++------ Runtime/World/CScriptPlayerActor.cpp | 11 ++- Runtime/World/CStateMachine.cpp | 6 ++ Runtime/World/CStateMachine.hpp | 8 +- Runtime/World/CWorld.cpp | 18 ++-- Runtime/World/IGameArea.cpp | 6 +- Runtime/World/ScriptLoader.cpp | 16 ++-- hecl | 2 +- 35 files changed, 189 insertions(+), 284 deletions(-) create mode 160000 Editor/locale delete mode 100644 Editor/locale/CMakeLists.txt delete mode 100644 Editor/locale/en_GB.yaml delete mode 100644 Editor/locale/en_US.yaml delete mode 100644 Editor/locale/ja_JP.yaml delete mode 100644 Editor/locale/locale.cpp delete mode 100644 Editor/locale/locale.hpp diff --git a/.gitmodules b/.gitmodules index 2634cfc1d..e04b11a1b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -37,3 +37,6 @@ [submodule "NESEmulator/fixNES"] path = NESEmulator/fixNES url = https://github.com/jackoalan/fixNES.git +[submodule "Editor/locale"] + path = Editor/locale + url = ssh://gitlab@git.axiodl.com/AxioDL/urde-translations.git diff --git a/Editor/locale b/Editor/locale new file mode 160000 index 000000000..b2436bbd0 --- /dev/null +++ b/Editor/locale @@ -0,0 +1 @@ +Subproject commit b2436bbd0331d15df34b68345770d295513cbd9d diff --git a/Editor/locale/CMakeLists.txt b/Editor/locale/CMakeLists.txt deleted file mode 100644 index fc4666043..000000000 --- a/Editor/locale/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -bintoc(en_US.cpp en_US.yaml L_en_US) -bintoc(en_GB.cpp en_GB.yaml L_en_GB) -bintoc(ja_JP.cpp ja_JP.yaml L_ja_JP) -add_library(UrdeLocales - en_US.yaml en_US.cpp - en_GB.yaml en_GB.cpp - ja_JP.yaml ja_JP.cpp - locale.hpp locale.cpp) diff --git a/Editor/locale/en_GB.yaml b/Editor/locale/en_GB.yaml deleted file mode 100644 index 595f29f28..000000000 --- a/Editor/locale/en_GB.yaml +++ /dev/null @@ -1,18 +0,0 @@ -en_GB: - color: "Colour" - branch: "Branch" - commit: "Commit" - date: "Date" - new_project: "New Project" - open_project: "Open Project" - extract_game: "Extract Game" - name: "Name" - type: "Type" - size: "Size" - directory: "Directory" - file: "File" - file_name: "File Name" - cancel: "Cancel" - system_locations: "System Locations" - recent_projects: "Recent Projects" - recent_files: "Recent Files" diff --git a/Editor/locale/en_US.yaml b/Editor/locale/en_US.yaml deleted file mode 100644 index a66066a8d..000000000 --- a/Editor/locale/en_US.yaml +++ /dev/null @@ -1,18 +0,0 @@ -en_US: - color: "Color" - branch: "Branch" - commit: "Commit" - date: "Date" - new_project: "New Project" - open_project: "Open Project" - extract_game: "Extract Game" - name: "Name" - type: "Type" - size: "Size" - directory: "Directory" - file: "File" - file_name: "File Name" - cancel: "Cancel" - system_locations: "System Locations" - recent_projects: "Recent Projects" - recent_files: "Recent Files" diff --git a/Editor/locale/ja_JP.yaml b/Editor/locale/ja_JP.yaml deleted file mode 100644 index 144468948..000000000 --- a/Editor/locale/ja_JP.yaml +++ /dev/null @@ -1,18 +0,0 @@ -ja_JP: - color: "色" - branch: "分派" - commit: "預ける" - date: "年月日" - new_project: "新しいプロジェクト" - open_project: "プロジェクトを開きます" - extract_game: "ビデオゲームを抽出" - name: "名" - type: "タイプ" - size: "サイズ" - directory: "ディレクトリ" - file: "ファイル" - file_name: "ファイル名" - cancel: "キャンセル" - system_locations: "システムの場所" - recent_projects: "最近使ったプロジェクト" - recent_files: "最近使用したファイル" diff --git a/Editor/locale/locale.cpp b/Editor/locale/locale.cpp deleted file mode 100644 index c979e4dce..000000000 --- a/Editor/locale/locale.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "locale.hpp" -#include -#include -#include - -#undef min -#undef max - -extern "C" const uint8_t L_en_US[]; -extern "C" size_t L_en_US_SZ; - -extern "C" const uint8_t L_en_GB[]; -extern "C" size_t L_en_GB_SZ; - -extern "C" const uint8_t L_ja_JP[]; -extern "C" size_t L_ja_JP_SZ; - -namespace urde -{ - -using namespace std::literals; - -static const specter::Locale Locales[] = -{ - {"en_US"sv, "US English"sv, L_en_US, L_en_US_SZ}, - {"en_GB"sv, "British English"sv, L_en_GB, L_en_GB_SZ}, - {"ja_JP"sv, "Japanese"sv, L_ja_JP, L_ja_JP_SZ} -}; - -std::vector> ListLocales() -{ - constexpr size_t localeCount = std::extent::value; - std::vector> ret; - ret.reserve(localeCount); - for (size_t i=0 ; i::value; - for (size_t i=0 ; i::value; - for (size_t i=0 ; i - -namespace urde -{ - -std::vector> ListLocales(); -const specter::Locale* LookupLocale(std::string_view name); -const specter::Locale* SystemLocaleOrEnglish(); - -} - -#endif // URDE_LOCALE_HPP diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index 6222772f8..1ce0d505a 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -360,7 +360,7 @@ TAreaId CStateManager::GetVisAreaId() const CMaterialFilter::EFilterType::Include), nullptr); for (TUniqueId id : nearList) if (TCastToConstPtr dock = GetObjectById(id)) - if (dock->GetDestinationAreaId() == curArea && dock->HasPointCrossedDock(*this, camTranslation)) + if (dock->GetAreaId() == curArea && dock->HasPointCrossedDock(*this, camTranslation)) return dock->GetCurrentConnectedAreaId(*this); return curArea; diff --git a/Runtime/Camera/CBallCamera.cpp b/Runtime/Camera/CBallCamera.cpp index 1d86e6085..907237e64 100644 --- a/Runtime/Camera/CBallCamera.cpp +++ b/Runtime/Camera/CBallCamera.cpp @@ -551,7 +551,7 @@ zeus::CVector3f CBallCamera::ConstrainYawAngle(const CPlayer& player, float dist { lookDir = player.GetMoveDir(); TCastToConstPtr door = mgr.GetObjectById(x3dc_tooCloseActorId); - if ((!door || !door->x2a8_26_useConservativeCameraDistance) && + if ((!door || !door->x2a8_26_isOpen) && (x400_state == EBallCameraState::Boost || x400_state == EBallCameraState::Chase)) lookDir = player.GetLeaveMorphDir(); } @@ -1294,7 +1294,7 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr) if (TCastToConstPtr door = mgr.GetObjectById(x3dc_tooCloseActorId)) { - if (!door->x2a8_26_useConservativeCameraDistance) + if (!door->x2a8_26_isOpen) { if (x400_state == EBallCameraState::Boost) { @@ -1454,7 +1454,7 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr) finalPos = ClampElevationToWater(finalPos, mgr); if (ballToCam2.magnitude() < 2.f && x3dc_tooCloseActorId != kInvalidUniqueId && x3e0_tooCloseActorDist < 5.f) if (TCastToConstPtr door = mgr.GetObjectById(x3dc_tooCloseActorId)) - if (!door->x2a8_26_useConservativeCameraDistance) + if (!door->x2a8_26_isOpen) finalPos = GetTranslation(); float backupZ = finalPos.z; @@ -1770,7 +1770,7 @@ bool CBallCamera::IsBallNearDoor(const zeus::CVector3f& pos, CStateManager& mgr) { TCastToConstPtr door = mgr.GetObjectById(mgr.GetCameraManager()->GetBallCamera()->x3dc_tooCloseActorId); - if (!door || door->x2a8_26_useConservativeCameraDistance) + if (!door || door->x2a8_26_isOpen) return false; auto tb = door->GetTouchBounds(); @@ -1820,14 +1820,14 @@ bool CBallCamera::ConstrainElevationAndDistance(float& elevation, float& distanc stretchFac = zeus::clamp(-1.f, std::fabs(x3e0_tooCloseActorDist / (3.f * distance)), 1.f); if (x3e0_tooCloseActorDist < 3.f * distance) doorClose = true; - if (door->x2a8_26_useConservativeCameraDistance) + if (door->x2a8_26_isOpen) newDistance = stretchFac * (distance - x468_conservativeDoorCamDistance) + x468_conservativeDoorCamDistance; else newDistance = stretchFac * (distance - 5.f) + 5.f; if (x18d_28_obtuseDirection) newDistance *= 1.f + x308_speedFactor; - baseElevation = door->x2a8_26_useConservativeCameraDistance ? 0.75f : 1.5f; + baseElevation = door->x2a8_26_isOpen ? 0.75f : 1.5f; springSpeed = 4.f; } } diff --git a/Runtime/Character/CAnimData.hpp b/Runtime/Character/CAnimData.hpp index 6bfed9d2f..99ae9290d 100644 --- a/Runtime/Character/CAnimData.hpp +++ b/Runtime/Character/CAnimData.hpp @@ -114,13 +114,13 @@ private: std::shared_ptr x1fc_transMgr; float x200_speedScale = 1.f; - u32 x204_charIdx; + s32 x204_charIdx; u16 x208_defaultAnim; u32 x20c_passedBoolCount = 0; u32 x210_passedIntCount = 0; u32 x214_passedParticleCount = 0; u32 x218_passedSoundCount = 0; - u32 x21c_particleLightIdx = 0; + s32 x21c_particleLightIdx = 0; union { @@ -251,7 +251,7 @@ public: u32 GetPassedParticlePOICount() const { return x214_passedParticleCount; } u32 GetPassedSoundPOICount() const { return x218_passedSoundCount; } - u32 GetCharacterIndex() const { return x204_charIdx; } + s32 GetCharacterIndex() const { return x204_charIdx; } }; } diff --git a/Runtime/Character/CCharacterInfo.cpp b/Runtime/Character/CCharacterInfo.cpp index 8aa1391b6..31ad5fa5f 100644 --- a/Runtime/Character/CCharacterInfo.cpp +++ b/Runtime/Character/CCharacterInfo.cpp @@ -79,7 +79,7 @@ CCharacterInfo::CCharacterInfo(CInputStream& in) std::vector& comps = x98_effects.back().second; u32 compCount = in.readUint32Big(); comps.reserve(compCount); - for (u32 j=0 ; j xb0_animIdxs; + std::vector xb0_animIdxs; public: CCharacterInfo(CInputStream& in); @@ -59,7 +59,7 @@ public: CAssetId GetIceSkinRulesId() const { return xac_cskrOverlay; } const CParticleResData& GetParticleResData() const { return x44_partRes; } - u32 GetAnimationIndex(u32 idx) const { return xb0_animIdxs.at(idx); } + s32 GetAnimationIndex(s32 idx) const { return xb0_animIdxs.at(idx); } const CPASDatabase& GetPASDatabase() const { return x30_pasDatabase; } }; } diff --git a/Runtime/Character/CPOINode.cpp b/Runtime/Character/CPOINode.cpp index aaa9fc723..00e4a6243 100644 --- a/Runtime/Character/CPOINode.cpp +++ b/Runtime/Character/CPOINode.cpp @@ -9,7 +9,7 @@ namespace urde { CPOINode::CPOINode(std::string_view name, EPOIType type, const CCharAnimTime& time, - u32 index, bool c, float weight, u32 e, u32 f) + u32 index, bool c, float weight, s32 e, s32 f) : x4_(1), x8_name(name), x18_type(type), @@ -29,8 +29,8 @@ CPOINode::CPOINode(CInputStream& in) x24_index(in.readUint32Big()), x28_(in.readBool()), x2c_weight(in.readFloatBig()), - x30_charIdx(in.readUint32Big()), - x34_flags(in.readUint32Big()) + x30_charIdx(in.readInt32Big()), + x34_flags(in.readInt32Big()) {} bool CPOINode::operator>(const CPOINode& other) const diff --git a/Runtime/Character/CPOINode.hpp b/Runtime/Character/CPOINode.hpp index 91e65a76e..eafa20b6f 100644 --- a/Runtime/Character/CPOINode.hpp +++ b/Runtime/Character/CPOINode.hpp @@ -30,11 +30,11 @@ protected: u32 x24_index; bool x28_; float x2c_weight; - u32 x30_charIdx = -1; - u32 x34_flags; + s32 x30_charIdx = -1; + s32 x34_flags; public: CPOINode(std::string_view name, EPOIType type, const CCharAnimTime& time, - u32 index, bool, float weight, u32 charIdx, u32 flags); + u32 index, bool, float weight, s32 charIdx, s32 flags); CPOINode(CInputStream& in); virtual ~CPOINode() = default; @@ -44,8 +44,8 @@ public: EPOIType GetPoiType() const { return x18_type; } u32 GetIndex() const {return x24_index;} float GetWeight() const { return x2c_weight; } - u32 GetCharacterIndex() const { return x30_charIdx; } - u32 GetFlags() const { return x34_flags; } + s32 GetCharacterIndex() const { return x30_charIdx; } + s32 GetFlags() const { return x34_flags; } bool operator>(const CPOINode& other) const; bool operator<(const CPOINode& other) const; diff --git a/Runtime/Graphics/CModelBoo.cpp b/Runtime/Graphics/CModelBoo.cpp index 368cf6694..dada760a0 100644 --- a/Runtime/Graphics/CModelBoo.cpp +++ b/Runtime/Graphics/CModelBoo.cpp @@ -495,6 +495,8 @@ void CBooModel::DisableAllLights() void CBooModel::RemapMaterialData(SShader& shader) { + if (!shader.m_geomLayout) + return; x4_matSet = &shader.m_matSet; m_geomLayout = &*shader.m_geomLayout; m_matSetIdx = shader.m_matSetIdx; @@ -507,6 +509,8 @@ void CBooModel::RemapMaterialData(SShader& shader) void CBooModel::RemapMaterialData(SShader& shader, const std::unordered_map>& pipelines) { + if (!shader.m_geomLayout) + return; x4_matSet = &shader.m_matSet; m_geomLayout = &*shader.m_geomLayout; m_matSetIdx = shader.m_matSetIdx; diff --git a/Runtime/MP1/CFrontEndUI.cpp b/Runtime/MP1/CFrontEndUI.cpp index 13b324f64..ccea78d6d 100644 --- a/Runtime/MP1/CFrontEndUI.cpp +++ b/Runtime/MP1/CFrontEndUI.cpp @@ -2006,6 +2006,7 @@ CFrontEndUI::CFrontEndUI() m->ResetGameState(); g_GameState->SetCurrentWorldId(g_ResFactory->TranslateOriginalToNew(g_DefaultWorldTag.id)); + g_GameState->CurrentWorldState().SetAreaId(2); g_GameState->GameOptions().ResetToDefaults(); g_GameState->WriteBackupBuf(); diff --git a/Runtime/MP1/MP1.cpp b/Runtime/MP1/MP1.cpp index b20e73008..187d90e0e 100644 --- a/Runtime/MP1/MP1.cpp +++ b/Runtime/MP1/MP1.cpp @@ -48,6 +48,7 @@ #include "AutoMapper/CMapWorld.hpp" #include "AutoMapper/CMapArea.hpp" #include "AutoMapper/CMapUniverse.hpp" +#include "World/CStateMachine.hpp" #include "CScannableObjectInfo.hpp" #include "Audio/CAudioGroupSet.hpp" #include "Audio/CSfxManager.hpp" @@ -361,6 +362,7 @@ void CGameGlobalObjects::AddPaksAndFactories() fmgr->AddFactory(FOURCC('DPSC'), FFactoryFunc(FDecalDataFactory)); fmgr->AddFactory(FOURCC('MAPA'), FFactoryFunc(FMapAreaFactory)); fmgr->AddFactory(FOURCC('MAPU'), FFactoryFunc(FMapUniverseFactory)); + fmgr->AddFactory(FOURCC('AFSM'), FFactoryFunc(FAiFiniteStateMachineFactory)); } } diff --git a/Runtime/MP1/World/CParasite.cpp b/Runtime/MP1/World/CParasite.cpp index 77174b57f..adb728d2e 100644 --- a/Runtime/MP1/World/CParasite.cpp +++ b/Runtime/MP1/World/CParasite.cpp @@ -1 +1,19 @@ #include "CParasite.hpp" +#include "World/CActorParameters.hpp" +#include "Character/CModelData.hpp" +#include "World/CPatternedInfo.hpp" +#include "TCastTo.hpp" + +namespace urde::MP1 +{ +CParasite::CParasite(TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo) + : CWallWalker(ECharacter::Parasite, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Ground, EColliderType::One, EBodyType::WallWalker, CActorParameters::None(), -1, false) +{ + +} + +void CParasite::Accept(IVisitor& visitor) +{ + visitor.Visit(this); +} +} diff --git a/Runtime/MP1/World/CParasite.hpp b/Runtime/MP1/World/CParasite.hpp index 6b325411a..cab8dc121 100644 --- a/Runtime/MP1/World/CParasite.hpp +++ b/Runtime/MP1/World/CParasite.hpp @@ -3,12 +3,19 @@ #include "World/CWallWalker.hpp" +namespace urde +{ +class CModelData; +} + namespace urde::MP1 { class CParasite : public CWallWalker { public: - CParasite(); + CParasite(TUniqueId, std::string_view, EFlavorType, const CEntityInfo&, const zeus::CTransform&, CModelData&&, const CPatternedInfo&); + + void Accept(IVisitor&); }; } #endif // __URDE_MP1_CPARASITE_HPP__ diff --git a/Runtime/World/CGameArea.cpp b/Runtime/World/CGameArea.cpp index d1447b05c..cb06d3823 100644 --- a/Runtime/World/CGameArea.cpp +++ b/Runtime/World/CGameArea.cpp @@ -450,7 +450,7 @@ CGameArea::CGameArea(CInputStream& in, int idx, int mlvlVersion) u32 dockCount = in.readUint32Big(); xcc_docks.reserve(dockCount); for (u32 i=0 ; ix10c0_areaObjs.get(); } + CObjectList* GetAreaObjects() const { return GetPostConstructed() ? GetPostConstructed()->x10c0_areaObjs.get() : nullptr; } CGameArea* GetNext() const { return x130_next; } diff --git a/Runtime/World/CScriptDock.cpp b/Runtime/World/CScriptDock.cpp index 4c52cc66d..ca85a1d9f 100644 --- a/Runtime/World/CScriptDock.cpp +++ b/Runtime/World/CScriptDock.cpp @@ -23,7 +23,7 @@ CMaterialList MakeDockMaterialList() CScriptDock::CScriptDock(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CVector3f position, const zeus::CVector3f& extents, s32 dock, TAreaId area, bool active, s32 dockReferenceCount, bool loadConnected) -: CPhysicsActor(uid, active, name, info, zeus::CTransform(zeus::CMatrix3f::skIdentityMatrix3f, position), +: CPhysicsActor(uid, true/*active*/, name, info, zeus::CTransform(zeus::CMatrix3f::skIdentityMatrix3f, position), CModelData::CModelDataNull(), MakeDockMaterialList(), zeus::CAABox(-extents * 0.5f, extents * 0.5f), SMoverData(1.f), CActorParameters::None(), 0.3f, 0.1f) , x258_dockReferenceCount(dockReferenceCount) @@ -40,6 +40,7 @@ void CScriptDock::Accept(IVisitor& visitor) void CScriptDock::Think(float dt, CStateManager& mgr) { + x30_24_active = true; if (!GetActive()) { UpdateAreaActivateFlags(mgr); @@ -96,7 +97,7 @@ void CScriptDock::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat case EScriptObjectMessage::Registered: { CGameArea* area = mgr.WorldNC()->GetArea(x260_area); - if (area->GetDockCount() <= x25c_dock) + if (area->GetDockCount() < x25c_dock) return; IGameArea::Dock* dock = area->DockNC(x25c_dock); if (!dock->IsReferenced()) @@ -147,6 +148,7 @@ void CScriptDock::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat break; case EScriptObjectMessage::Increment: SetLoadConnected(mgr, true); + [[fallthrough]]; case EScriptObjectMessage::Decrement: { TAreaId aid = x260_area; @@ -155,7 +157,7 @@ void CScriptDock::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat IGameArea::Dock* dock = mgr.WorldNC()->GetArea(x260_area)->DockNC(x25c_dock); aid = dock->GetConnectedAreaId(dock->GetReferenceCount()); } - else if (aid == 0 || (mgr.GetWorld()->GetNumAreas() <= aid || !mgr.WorldNC()->GetArea(aid)->GetActive())) + else if (aid == 0 || (aid >= mgr.GetWorld()->GetNumAreas() || !mgr.WorldNC()->GetArea(aid)->GetActive())) return; CWorld::PropogateAreaChain(CGameArea::EOcclusionState(msg == EScriptObjectMessage::Increment), mgr.WorldNC()->GetArea(aid), mgr.WorldNC()); @@ -203,10 +205,10 @@ s32 CScriptDock::GetDockReference(const CStateManager& mgr) const TAreaId CScriptDock::GetCurrentConnectedAreaId(const CStateManager& mgr) const { - if (mgr.GetWorld()->GetNumAreas() < x260_area) + if (x260_area >= mgr.GetWorld()->GetNumAreas()) return kInvalidAreaId; const CGameArea* area = mgr.GetWorld()->GetAreaAlways(x260_area); - if (area->GetDockCount() < x25c_dock) + if (x25c_dock >= area->GetDockCount()) return kInvalidAreaId; const IGameArea::Dock* dock = area->GetDock(x25c_dock); diff --git a/Runtime/World/CScriptDock.hpp b/Runtime/World/CScriptDock.hpp index 582e5c498..d9d744f7b 100644 --- a/Runtime/World/CScriptDock.hpp +++ b/Runtime/World/CScriptDock.hpp @@ -43,7 +43,7 @@ public: void Touch(CActor&, CStateManager&); void CleanUp() {} zeus::CPlane GetPlane(const CStateManager&) const; - TAreaId GetDestinationAreaId() const { return x260_area; } + TAreaId GetAreaId() const { return x260_area; } s32 GetDockId() const { return x25c_dock; } void SetDockReference(CStateManager& mgr, s32); s32 GetDockReference(const CStateManager& mgr) const; diff --git a/Runtime/World/CScriptDockAreaChange.cpp b/Runtime/World/CScriptDockAreaChange.cpp index 861686356..6ee3635b4 100644 --- a/Runtime/World/CScriptDockAreaChange.cpp +++ b/Runtime/World/CScriptDockAreaChange.cpp @@ -7,7 +7,7 @@ namespace urde { CScriptDockAreaChange::CScriptDockAreaChange(TUniqueId uid, std::string_view name, const CEntityInfo& info, s32 w1, bool active) -: CEntity(uid, info, active, name), x34_dockReference(w1) +: CEntity(uid, info, true/*active*/, name), x34_dockReference(w1) { } diff --git a/Runtime/World/CScriptDockAreaChange.hpp b/Runtime/World/CScriptDockAreaChange.hpp index f541e6263..8330b9c54 100644 --- a/Runtime/World/CScriptDockAreaChange.hpp +++ b/Runtime/World/CScriptDockAreaChange.hpp @@ -11,6 +11,7 @@ class CScriptDockAreaChange : public CEntity public: CScriptDockAreaChange(TUniqueId, std::string_view, const CEntityInfo&, s32, bool); + void Think(float dt, CStateManager& mgr) { x30_24_active = true; CEntity::Think(dt, mgr); } void Accept(IVisitor& visitor); void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr); }; diff --git a/Runtime/World/CScriptDoor.cpp b/Runtime/World/CScriptDoor.cpp index 6b8fc28e1..7dc210b7a 100644 --- a/Runtime/World/CScriptDoor.cpp +++ b/Runtime/World/CScriptDoor.cpp @@ -16,7 +16,7 @@ namespace urde static CMaterialList MakeDoorMaterialList(bool open) { CMaterialList ret; - ret.Add(EMaterialTypes::Solid); + //ret.Add(EMaterialTypes::Solid); ret.Add(EMaterialTypes::Immovable); ret.Add(EMaterialTypes::Orbit); if (!open) @@ -27,20 +27,24 @@ static CMaterialList MakeDoorMaterialList(bool open) CScriptDoor::CScriptDoor(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms, - const zeus::CVector3f&, const zeus::CAABox& aabb, bool active, - bool open, bool b2, float f1, bool ballDoor) + const zeus::CVector3f& vec, const zeus::CAABox& aabb, bool active, + bool open, bool b2, float animLen, bool ballDoor) : CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakeDoorMaterialList(open), aabb, SMoverData(1.f), actParms, 0.3f, 0.1f) { - x258_ = f1; - x2a8_29_ballDoor = ballDoor; + x258_animLen = animLen; + x2a8_24_ = false; x2a8_25_ = open; - x2a8_26_useConservativeCameraDistance = open; + x2a8_26_isOpen = open; + x2a8_27_ = false; x2a8_28_ = b2; - x2a8_27_ = true; + x2a8_29_ballDoor = ballDoor; + x2a8_30_ = false; x264_ = GetBoundingBox(); x284_modelBounds = x64_modelData->GetBounds(xf.getRotation()); + x29c_ = vec; + xe6_27_thermalVisorFlags = 1; if (open) SetDoorAnimation(EDoorAnimType::Open); @@ -68,17 +72,17 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat if (!GetActive()) return; - if (x27c_partner1 == kInvalidUniqueId || uid != x27c_partner1) + if (x27c_partner1 != kInvalidUniqueId && x27c_partner1 != uid) return; - if (x2a8_26_useConservativeCameraDistance) + if (x2a8_26_isOpen) { if (x27e_partner2 != kInvalidUniqueId) { if (CEntity* ent = mgr.ObjectById(x27e_partner2)) mgr.SendScriptMsg(ent, GetUniqueId(), EScriptObjectMessage::Close); } - x2a8_26_useConservativeCameraDistance = false; + x2a8_26_isOpen = false; SetDoorAnimation(EDoorAnimType::Close); mgr.GetCameraManager()->GetBallCamera()->DoorClosing(GetUniqueId()); } @@ -95,13 +99,13 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat { if (TCastToPtr door = mgr.ObjectById(x27c_partner1)) { - if (x2a8_26_useConservativeCameraDistance) + if (x2a8_26_isOpen) return; x2a8_30_ = true; mgr.SendScriptMsg(door, GetUniqueId(), EScriptObjectMessage::Close); } } - else if (x2a8_26_useConservativeCameraDistance) + else if (x2a8_26_isOpen) { x2a8_30_ = true; if (TCastToPtr door = mgr.ObjectById(x27e_partner2)) @@ -109,7 +113,7 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat mgr.SendScriptMsg(door, GetUniqueId(), EScriptObjectMessage::Close); x2a8_30_ = true; } - x2a8_26_useConservativeCameraDistance = false; + x2a8_26_isOpen = false; SetDoorAnimation(EDoorAnimType::Close); mgr.GetCameraManager()->GetBallCamera()->DoorClosing(GetUniqueId()); } @@ -117,7 +121,7 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat } case EScriptObjectMessage::Open: { - if (!GetActive() || x2a8_26_useConservativeCameraDistance) + if (!GetActive() || x2a8_26_isOpen) return; u32 doorCond = TCastToConstPtr(mgr.GetObjectById(uid)) ? 2 : GetDoorOpenCondition(mgr); @@ -172,11 +176,8 @@ void CScriptDoor::Think(float dt, CStateManager& mgr) if (!GetActive()) return; - if (!x2a8_26_useConservativeCameraDistance) - { - if (x25c_ < 0.5f) - x25c_ += dt; - } + if (!x2a8_26_isOpen && x25c_animTime < 0.5f) + x25c_animTime += dt; if (x2a8_27_ && GetDoorOpenCondition(mgr) == 2) { @@ -191,33 +192,42 @@ void CScriptDoor::Think(float dt, CStateManager& mgr) x2a8_28_ = false; x2a8_24_ = false; SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::Decrement); + x25c_animTime = 0.f; x2a8_30_ = false; - x25c_ = 0.f; } - if (x2a8_26_useConservativeCameraDistance && x64_modelData->IsAnimating()) + if (x2a8_26_isOpen && !x64_modelData->IsAnimating()) RemoveMaterial(EMaterialTypes::Solid, EMaterialTypes::Occluder, EMaterialTypes::Orbit, EMaterialTypes::Scannable, mgr); - else if (x2a8_25_ && x64_modelData->IsAnimating()) - { - x2a8_25_ = false; - mgr.GetCameraManager()->GetBallCamera()->DoorClosed(GetUniqueId()); - x2a8_28_ = false; - x2a8_27_ = false; - SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None); - } - - if (GetScannableObjectInfo()) - AddMaterial(EMaterialTypes::Solid, EMaterialTypes::Metal, EMaterialTypes::Occluder, EMaterialTypes::Orbit, EMaterialTypes::Scannable, mgr); else - AddMaterial(EMaterialTypes::Solid, EMaterialTypes::Metal, EMaterialTypes::Occluder, EMaterialTypes::Orbit, mgr); + { + if (x2a8_25_ && !x64_modelData->IsAnimating()) + { + x2a8_25_ = false; + mgr.GetCameraManager()->GetBallCamera()->DoorClosed(GetUniqueId()); + x2a8_28_ = false; + x2a8_27_ = false; + SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None); + } + + if (GetScannableObjectInfo()) + AddMaterial(/*EMaterialTypes::Solid, */EMaterialTypes::Metal, EMaterialTypes::Occluder, EMaterialTypes::Orbit, EMaterialTypes::Scannable, mgr); + else + AddMaterial(/*EMaterialTypes::Solid, */EMaterialTypes::Metal, EMaterialTypes::Occluder, EMaterialTypes::Orbit, mgr); + } if (x64_modelData->IsAnimating()) - UpdateAnimation((x64_modelData->GetAnimationDuration(s32(x260_doorState)) / x258_) * dt, mgr, true); + { + float f1 = x64_modelData->GetAnimationDuration(s32(x260_doorState)); + float f0 = x258_animLen; + f0 = f1 / f0; + f1 = f0 * dt; + UpdateAnimation(f1, mgr, true); + } xe7_31_targetable = mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan; } -void CScriptDoor::AddToRenderer(const zeus::CFrustum& /*frustum*/, CStateManager &mgr) +void CScriptDoor::AddToRenderer(const zeus::CFrustum& /*frustum*/, const CStateManager &mgr) const { if (!xe4_30_outOfFrustum) CPhysicsActor::Render(mgr); @@ -226,9 +236,9 @@ void CScriptDoor::AddToRenderer(const zeus::CFrustum& /*frustum*/, CStateManager /* ORIGINAL 0-00 OFFSET: 8007E0BC */ void CScriptDoor::ForceClosed(CStateManager & mgr) { - if (x2a8_26_useConservativeCameraDistance) + if (x2a8_26_isOpen) { - x2a8_26_useConservativeCameraDistance = false; + x2a8_26_isOpen = false; x2a8_25_ = false; mgr.GetCameraManager()->GetBallCamera()->DoorClosing(x8_uid); @@ -237,7 +247,7 @@ void CScriptDoor::ForceClosed(CStateManager & mgr) SetDoorAnimation(EDoorAnimType::Close); SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None); - x25c_ = 0.f; + x25c_animTime = 0.f; x2a8_27_ = false; x2a8_30_ = false; } @@ -252,14 +262,16 @@ void CScriptDoor::ForceClosed(CStateManager & mgr) /* ORIGINAL 0-00 OFFSET: 8007E1C4 */ bool CScriptDoor::IsConnectedToArea(const CStateManager& mgr, TAreaId areaId) { - const CScriptDock* dock = TCastToConstPtr(mgr.GetObjectById(x282_dockId)); - if (dock) + const CScriptDock* dockEnt = TCastToConstPtr(mgr.GetObjectById(x282_dockId)); + if (dockEnt) { - if (dock->GetDestinationAreaId() == areaId) + if (dockEnt->GetAreaId() == areaId) return true; - const CGameArea* area = mgr.GetWorld()->GetAreaAlways(areaId); - if (area->GetDock(dock->GetDockId())->GetConnectedAreaId(dock->GetDockReference(mgr)) == areaId) + const CWorld* world = mgr.GetWorld(); + const CGameArea* area = world->GetAreaAlways(dockEnt->GetAreaId()); + const CGameArea::Dock* dock = area->GetDock(dockEnt->GetDockId()); + if (dock->GetConnectedAreaId(dockEnt->GetDockReference(mgr)) == areaId) return true; } return false; @@ -270,13 +282,11 @@ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr) { TEditorId eid = mgr.GetEditorIdForUniqueId(uid); mgr.MapWorldInfo()->SetDoorVisited(eid, true); - x2a8_26_useConservativeCameraDistance = true; + x2a8_26_isOpen = true; x2a8_25_ = true; x2a8_27_ = false; - const CScriptDoor* door = TCastToConstPtr(mgr.GetObjectById(uid)); - - if (door) + if (const CScriptDoor* door = TCastToConstPtr(mgr.GetObjectById(uid))) x27c_partner1 = door->GetUniqueId(); SetDoorAnimation(EDoorAnimType::Open); @@ -295,7 +305,7 @@ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr) if(TCastToConstPtr dock2 = mgr.GetObjectById(door->x282_dockId)) { - if (dock1->GetCurrentConnectedAreaId(mgr) == dock2->GetDestinationAreaId() && dock2->GetCurrentConnectedAreaId(mgr) == dock1->GetDestinationAreaId()) + if (dock1->GetCurrentConnectedAreaId(mgr) == dock2->GetAreaId() && dock2->GetCurrentConnectedAreaId(mgr) == dock1->GetAreaId()) { x27e_partner2 = door->GetUniqueId(); mgr.SendScriptMsg(ent, GetUniqueId(), EScriptObjectMessage::Open); @@ -323,18 +333,18 @@ u32 CScriptDoor::GetDoorOpenCondition(CStateManager& mgr) if (!dock) return 2; - if (x25c_ < 0.05f || x2a8_30_) + if (x25c_animTime < 0.05f || x2a8_30_) return 1; - TAreaId destArea = dock->GetDestinationAreaId(); - if (destArea < 0 || destArea > mgr.GetWorld()->GetNumAreas()) + TAreaId destArea = dock->GetAreaId(); + if (destArea < 0 || destArea >= mgr.GetWorld()->GetNumAreas()) return 0; if (!mgr.GetWorld()->AreSkyNeedsMet()) return 1; TAreaId connArea = mgr.GetWorld()->GetAreaAlways( - dock->GetDestinationAreaId())->GetDock( + dock->GetAreaId())->GetDock( dock->GetDockId())->GetConnectedAreaId(dock->GetDockReference(mgr)); if (connArea == kInvalidAreaId) @@ -370,7 +380,7 @@ u32 CScriptDoor::GetDoorOpenCondition(CStateManager& mgr) if (aliveArea->GetAreaId() == area->GetAreaId()) continue; - if (aliveArea->IsFinishedOccluding()) + if (!aliveArea->IsFinishedOccluding()) return 1; } diff --git a/Runtime/World/CScriptDoor.hpp b/Runtime/World/CScriptDoor.hpp index e242e231f..2b4157226 100644 --- a/Runtime/World/CScriptDoor.hpp +++ b/Runtime/World/CScriptDoor.hpp @@ -11,14 +11,13 @@ class CScriptDoor : public CPhysicsActor public: enum class EDoorAnimType { - None = -1, Open, Close, Ready, }; - float x258_; - float x25c_; + float x258_animLen; + float x25c_animTime; EDoorAnimType x260_doorState = EDoorAnimType::Open; zeus::CAABox x264_; TUniqueId x27c_partner1 = kInvalidUniqueId; @@ -26,32 +25,15 @@ public: TUniqueId x280_ = kInvalidUniqueId; TUniqueId x282_dockId = kInvalidUniqueId; zeus::CAABox x284_modelBounds; - zeus::CVector3f x29c_; - union - { - struct - { - bool x2a0_25_ : 1; - bool x2a0_26_ : 1; - }; - u32 dummy1 = 0; - }; - union - { - struct - { - bool x2a8_24_ : 1; - bool x2a8_25_ : 1; - bool x2a8_26_useConservativeCameraDistance : 1; - bool x2a8_27_ : 1; - bool x2a8_28_ : 1; - bool x2a8_29_ballDoor : 1; - bool x2a8_30_ : 1; - }; - u32 dummy2 = 0; - }; + bool x2a8_24_ : 1; + bool x2a8_25_ : 1; + bool x2a8_26_isOpen : 1; + bool x2a8_27_ : 1; + bool x2a8_28_ : 1; + bool x2a8_29_ballDoor : 1; + bool x2a8_30_ : 1; public: CScriptDoor(TUniqueId, std::string_view name, const CEntityInfo& info, const zeus::CTransform&, CModelData&&, const CActorParameters&, @@ -62,14 +44,15 @@ public: void Accept(IVisitor& visitor); void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr); void Think(float, CStateManager& mgr); - void AddToRenderer(const zeus::CFrustum&, CStateManager& mgr); - void Render(const CStateManager&) {} + void AddToRenderer(const zeus::CFrustum&, const CStateManager& mgr) const; + void Render(const CStateManager&) const {} void ForceClosed(CStateManager&); bool IsConnectedToArea(const CStateManager& mgr, TAreaId area); void OpenDoor(TUniqueId, CStateManager&); u32 GetDoorOpenCondition(CStateManager& mgr); void SetDoorAnimation(EDoorAnimType); std::experimental::optional GetProjectileBounds() const; + bool IsOpen() const { return x2a8_26_isOpen; } }; } diff --git a/Runtime/World/CScriptPlayerActor.cpp b/Runtime/World/CScriptPlayerActor.cpp index df5f91371..022243f07 100644 --- a/Runtime/World/CScriptPlayerActor.cpp +++ b/Runtime/World/CScriptPlayerActor.cpp @@ -1,6 +1,8 @@ #include "World/CScriptPlayerActor.hpp" #include "World/CActorParameters.hpp" #include "World/CLightParameters.hpp" +#include "GameGlobalObjects.hpp" +#include "Graphics/CBooRenderer.hpp" namespace urde { @@ -24,6 +26,8 @@ CScriptPlayerActor::CScriptPlayerActor(TUniqueId uid, std::string_view name, con SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(include, exclude)); SetActorLights(aParams.GetLightParameters().MakeActorLights()); + xe7_29_actorActive = true; + x2e3_24_cameraMoveIntoAlpha = true; } void CScriptPlayerActor::Think(float, CStateManager&) @@ -41,9 +45,11 @@ void CScriptPlayerActor::SetActive(bool active) xe7_29_actorActive = true; } -void CScriptPlayerActor::PreRender(CStateManager&, const zeus::CFrustum&) +void CScriptPlayerActor::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) { - + if (x2e8_.GetCharacterNodeId() == 3) + g_Renderer->AllocatePhazonSuitMaskTexture(); + CScriptActor::PreRender(mgr, frustum); } void CScriptPlayerActor::AddToRenderer(const zeus::CFrustum&, const CStateManager&) const @@ -53,7 +59,6 @@ void CScriptPlayerActor::AddToRenderer(const zeus::CFrustum&, const CStateManage void CScriptPlayerActor::Render(const CStateManager& mgr) const { - } void CScriptPlayerActor::TouchModels() diff --git a/Runtime/World/CStateMachine.cpp b/Runtime/World/CStateMachine.cpp index 2dbb53379..c6d197006 100644 --- a/Runtime/World/CStateMachine.cpp +++ b/Runtime/World/CStateMachine.cpp @@ -91,4 +91,10 @@ void CStateMachineState::Setup(const CStateMachine* machine) } std::string CStateMachineState::GetName() const { return {}; } + +CFactoryFnReturn FAiFiniteStateMachineFactory(const SObjectTag &tag, CInputStream &in, const CVParamTransfer &vparms, CObjectReference *) +{ + return TToken::GetIObjObjectFor(std::make_unique(in)); +} + } diff --git a/Runtime/World/CStateMachine.hpp b/Runtime/World/CStateMachine.hpp index 6ad5da2b6..a6aa25e04 100644 --- a/Runtime/World/CStateMachine.hpp +++ b/Runtime/World/CStateMachine.hpp @@ -1,8 +1,11 @@ #ifndef CSTATEMACHINE_HPP #define CSTATEMACHINE_HPP -#include "RetroTypes.hpp" #include "CAiFuncMap.hpp" +#include "IObj.hpp" +#include "CToken.hpp" +#include "IOStreams.hpp" +#include "IObjFactory.hpp" namespace urde { @@ -109,6 +112,9 @@ public: float GetDelay() const; }; +CFactoryFnReturn FAiFiniteStateMachineFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms, + CObjectReference*); + } #endif // CSTATEMACHINE_HPP diff --git a/Runtime/World/CWorld.cpp b/Runtime/World/CWorld.cpp index 8aa87817b..122240561 100644 --- a/Runtime/World/CWorld.cpp +++ b/Runtime/World/CWorld.cpp @@ -474,8 +474,8 @@ void CWorld::TravelToArea(TAreaId aid, CStateManager& mgr, bool skipLoadOther) return; x70_24_currentAreaNeedsAllocation = false; x68_curAreaId = aid; - - while (CGameArea* toDeallocateAreas = x4c_chainHeads[0]) + CGameArea* toDeallocateAreas = x4c_chainHeads[0]; + while (toDeallocateAreas) { if (toDeallocateAreas->Invalidate(&mgr)) { @@ -485,13 +485,14 @@ void CWorld::TravelToArea(TAreaId aid, CStateManager& mgr, bool skipLoadOther) toDeallocateAreas = toDeallocateAreas->x130_next; } - while (CGameArea* aliveAreas = x4c_chainHeads[3]) + CGameArea* aliveAreas = x4c_chainHeads[3]; + while (aliveAreas) { MoveToChain(aliveAreas, EChain::AliveJudgement); aliveAreas = aliveAreas->x130_next; } - - while (CGameArea* loadingAreas = x4c_chainHeads[2]) + CGameArea* loadingAreas = x4c_chainHeads[2]; + while (loadingAreas) { MoveToChain(loadingAreas, EChain::ToDeallocate); loadingAreas = loadingAreas->x130_next; @@ -531,15 +532,16 @@ void CWorld::TravelToArea(TAreaId aid, CStateManager& mgr, bool skipLoadOther) } } } - - while (CGameArea* judgementArea = x4c_chainHeads[4]) + CGameArea* judgementArea = x4c_chainHeads[4]; + while (judgementArea) { MoveToChain(judgementArea, EChain::ToDeallocate); judgementArea = judgementArea->x130_next; } size_t toStreamCount = 0; - while (CGameArea* toDeallocateAreas = x4c_chainHeads[0]) + toDeallocateAreas = x4c_chainHeads[0]; + while (toDeallocateAreas) { toDeallocateAreas->RemoveStaticGeometry(); toDeallocateAreas = toDeallocateAreas->x130_next; diff --git a/Runtime/World/IGameArea.cpp b/Runtime/World/IGameArea.cpp index 669b3af4e..39dbfe868 100644 --- a/Runtime/World/IGameArea.cpp +++ b/Runtime/World/IGameArea.cpp @@ -26,7 +26,7 @@ IGameArea::Dock::Dock(urde::CInputStream& in, const zeus::CTransform& xf) TAreaId IGameArea::Dock::GetConnectedAreaId(s32 other) const { - if (other >= x4_dockReferences.size() || other < 0) + if (u32(other) >= x4_dockReferences.size() || other < 0) return kInvalidAreaId; return x4_dockReferences[other].x0_area; @@ -34,8 +34,8 @@ TAreaId IGameArea::Dock::GetConnectedAreaId(s32 other) const s16 IGameArea::Dock::GetOtherDockNumber(s32 other) const { - if (other >= x4_dockReferences.size() || other < 0) - return kInvalidAreaId; + if (u32(other) >= x4_dockReferences.size() || other < 0) + return -1; return x4_dockReferences[other].x4_dock; } diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 58c4e5470..49f3ac049 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -422,7 +422,7 @@ CEntity* ScriptLoader::LoadActor(CStateManager& mgr, CInputStream& in, int propC CModelData data; if (animType == SBIG('ANCS')) - data = CAnimRes(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, aParms.GetInitialAnimation(), true); + data = CAnimRes(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, aParms.GetInitialAnimation(), false); else data = CStaticRes(staticId, head.x40_scale); @@ -483,7 +483,7 @@ CEntity* ScriptLoader::LoadDoor(CStateManager& mgr, CInputStream& in, int propCo return nullptr; CModelData mData = - CAnimRes(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, true, aParms.GetInitialAnimation()); + CAnimRes(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, aParms.GetInitialAnimation(), false); if (collisionExtent.isZero()) aabb = mData.GetBounds(head.x10_transform.getRotation()); @@ -648,7 +648,7 @@ CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in, int pr CModelData data; if (animType == SBIG('ANCS')) - data = CAnimRes(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, true, aParms.GetInitialAnimation()); + data = CAnimRes(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, aParms.GetInitialAnimation(), true); else data = CStaticRes(staticId, head.x40_scale); @@ -681,7 +681,7 @@ CEntity* ScriptLoader::LoadSound(CStateManager& mgr, CInputStream& in, int propC bool acoustics = in.readBool(); bool worldSfx = in.readBool(); bool allowDuplicates = in.readBool(); - u32 pitch = in.readUint32Big(); + s32 pitch = in.readInt32Big(); if (soundId < 0) return nullptr; @@ -804,7 +804,7 @@ CEntity* ScriptLoader::LoadNewIntroBoss(CStateManager& mgr, CInputStream& in, in if (animType != SBIG('ANCS')) return nullptr; - CAnimRes res(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, true, aParms.GetInitialAnimation()); + CAnimRes res(aParms.GetACSFile(), aParms.GetCharacter(), head.x40_scale, aParms.GetInitialAnimation(), true); return new MP1::CNewIntroBoss(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, res, pInfo, actParms, f1, w1, dInfo, w2, w3, w4, w5); @@ -1335,7 +1335,7 @@ CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in, int pro if (animType != SBIG('ANCS')) return nullptr; - CAnimRes res(aParms.GetACSFile(), aParms.GetCharacter(), scale, true, aParms.GetInitialAnimation()); + CAnimRes res(aParms.GetACSFile(), aParms.GetCharacter(), scale, aParms.GetInitialAnimation(), true); CModelData mData(res); return new MP1::CWarWasp(mgr.AllocateUniqueId(), name, info, xf, std::move(mData), pInfo, flavor, collider, damageInfo1, actorParms, weaponDesc, damageInfo2, particle, w1); @@ -1592,7 +1592,7 @@ CEntity* ScriptLoader::LoadSpankWeed(CStateManager& mgr, CInputStream& in, int p CEntity* ScriptLoader::LoadParasite(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { - if (!EnsurePropertyCount(propCount, 6, "Parasite")) + if (!EnsurePropertyCount(propCount, 25, "Parasite")) return nullptr; std::string name = mgr.HashInstanceName(in); @@ -1629,7 +1629,7 @@ CEntity* ScriptLoader::LoadParasite(CStateManager& mgr, CInputStream& in, int pr return nullptr; const CAnimationParameters& animParms = pInfo.GetAnimationParameters(); CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), scale, animParms.GetInitialAnimation(), true)); - return nullptr; //return new MP1::CParasite(mgr.AllocateUniqueId(), name, flavor, info, xf, std::move(mData), pInfo, ) + return new MP1::CParasite(mgr.AllocateUniqueId(), name, flavor, info, xf, std::move(mData), pInfo /*TODO: Finish */); } CEntity* ScriptLoader::LoadPlayerHint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) diff --git a/hecl b/hecl index 71e620386..5fc99fe58 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 71e620386d46b4208968e0bb61d9687775359880 +Subproject commit 5fc99fe58c1257fce8f2d74517e23b2ae40d788a