Update submodules, initial CTextureCache

This commit is contained in:
Phillip Stephens 2019-12-10 20:51:33 -08:00
parent 4e5921c952
commit 1a13f7e4ee
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
20 changed files with 213 additions and 114 deletions

View File

@ -6,7 +6,7 @@
*/
#define GRPgroup0027 39
#define GRPmisc 39
#define SFXdor_x_close_00 1128

View File

@ -6,7 +6,7 @@
*/
#define GRPgroup0029 41
#define GRPmiscSamus 41
#define SFXsam_wlkstone_00 1465

View File

@ -6,7 +6,7 @@
*/
#define GRPgroup0028 40
#define GRPui 40
#define SFXui_map_rotate 1375

View File

@ -6,7 +6,7 @@
*/
#define GRPgroup002B 43
#define GRPweapons 43
#define SFXwpn_bomb_drop 1756

View File

@ -6,7 +6,7 @@
*/
#define GRPgroup0041 65
#define GRPzzz 65
#define SFXsfx0C16 3094

View File

@ -1,5 +1,4 @@
#include "ViewManager.hpp"
#include "specter/Control.hpp"
#include "specter/Space.hpp"
#include "specter/Menu.hpp"
#include "SplashScreen.hpp"
@ -7,16 +6,12 @@
#include "ResourceBrowser.hpp"
#include "icons/icons.hpp"
#include "badging/Badging.hpp"
#include "Runtime/Particle/CGenDescription.hpp"
#include "Runtime/Particle/CElectricDescription.hpp"
#include "Runtime/Particle/CSwooshDescription.hpp"
#include "Runtime/Graphics/CModel.hpp"
#include "Runtime/Graphics/CGraphics.hpp"
#include "Runtime/Character/CSkinRules.hpp"
#include "Graphics/CMetroidModelInstance.hpp"
#include "World/CWorldTransManager.hpp"
#include "Graphics/Shaders/CColoredQuadFilter.hpp"
#include "Graphics/Shaders/CTexturedQuadFilter.hpp"
#include "Audio/CStreamAudioManager.hpp"
#include "Runtime/CStateManager.hpp"
#include "Runtime/World/CPlayer.hpp"
@ -71,27 +66,34 @@ void ViewManager::TestGameView::think() {
const hecl::CVar* playerInfo = hecl::CVarManager::instance()->findCVar("debugOverlay.playerInfo");
const hecl::CVar* worldInfo = hecl::CVarManager::instance()->findCVar("debugOverlay.worldInfo");
const hecl::CVar* areaInfo = hecl::CVarManager::instance()->findCVar("debugOverlay.areaInfo");
const hecl::CVar* showInGameTime = hecl::CVarManager::instance()->findCVar("debugOverlay.showInGameTime");
if (showFrameIdx && showFrameIdx->toBoolean())
overlayText += fmt::format(fmt("Frame: {}\n"), g_StateManager->GetUpdateFrameIndex());
if (showInGameTime && showInGameTime->toBoolean()) {
double igt = g_GameState->GetTotalPlayTime();
u32 ms = u64(igt * 1000) % 1000;
auto pt = std::div(igt, 3600);
overlayText += fmt::format(fmt("PlayTime: {:02d}:{:02d}:{:02d}.{:03d}\n"), pt.quot, pt.rem / 60, pt.rem % 60,
ms);
}
if (g_StateManager->Player() && playerInfo && playerInfo->toBoolean()) {
const CPlayer& pl = g_StateManager->GetPlayer();
const zeus::CQuaternion plQ = zeus::CQuaternion(pl.GetTransform().getRotation().buildMatrix3f());
const zeus::CTransform camXf = g_StateManager->GetCameraManager()->GetCurrentCameraTransform(*g_StateManager);
const zeus::CQuaternion camQ = zeus::CQuaternion(camXf.getRotation().buildMatrix3f());
overlayText += fmt::format(fmt(
"Player Position: x {}, y {}, z {}\n"
" Roll: {}, Pitch: {}, Yaw: {}\n"
" Momentum: x {}, y: {}, z: {}\n"
" Velocity: x {}, y: {}, z: {}\n"
"Camera Position: x {}, y {}, z {}\n"
" Roll: {}, Pitch: {}, Yaw: {}\n"),
pl.GetTranslation().x(), pl.GetTranslation().y(), pl.GetTranslation().z(),
zeus::radToDeg(plQ.roll()), zeus::radToDeg(plQ.pitch()), zeus::radToDeg(plQ.yaw()),
pl.GetMomentum().x(), pl.GetMomentum().y(), pl.GetMomentum().z(),
pl.GetVelocity().x(), pl.GetVelocity().y(), pl.GetVelocity().z(),
camXf.origin.x(), camXf.origin.y(), camXf.origin.z(),
zeus::radToDeg(camQ.roll()), zeus::radToDeg(camQ.pitch()), zeus::radToDeg(camQ.yaw()));
overlayText +=
fmt::format(fmt("Player Position: x {}, y {}, z {}\n"
" Roll: {}, Pitch: {}, Yaw: {}\n"
" Momentum: x {}, y: {}, z: {}\n"
" Velocity: x {}, y: {}, z: {}\n"
"Camera Position: x {}, y {}, z {}\n"
" Roll: {}, Pitch: {}, Yaw: {}\n"),
pl.GetTranslation().x(), pl.GetTranslation().y(), pl.GetTranslation().z(),
zeus::radToDeg(plQ.roll()), zeus::radToDeg(plQ.pitch()), zeus::radToDeg(plQ.yaw()),
pl.GetMomentum().x(), pl.GetMomentum().y(), pl.GetMomentum().z(), pl.GetVelocity().x(),
pl.GetVelocity().y(), pl.GetVelocity().z(), camXf.origin.x(), camXf.origin.y(), camXf.origin.z(),
zeus::radToDeg(camQ.roll()), zeus::radToDeg(camQ.pitch()), zeus::radToDeg(camQ.yaw()));
}
if (worldInfo && worldInfo->toBoolean()) {
TLockedToken<CStringTable> tbl =
@ -114,11 +116,10 @@ void ViewManager::TestGameView::think() {
} else
layerBits += "0";
}
overlayText += fmt::format(fmt(
"Area AssetId: 0x{}, Total Objects: {}\n"
"Active Layer bits: {}\n"),
g_StateManager->GetWorld()->GetArea(aId)->GetAreaAssetId(),
g_StateManager->GetAllObjectList().size(), layerBits);
overlayText += fmt::format(fmt("Area AssetId: 0x{}, Total Objects: {}\n"
"Active Layer bits: {}\n"),
g_StateManager->GetWorld()->GetArea(aId)->GetAreaAssetId(),
g_StateManager->GetAllObjectList().size(), layerBits);
}
if (!overlayText.empty())
@ -297,8 +298,8 @@ void ViewManager::init(boo::IApplication* app) {
if (m_deferedProject.empty()) {
/* Default behavior - search upwards for packaged project containing the program */
if (hecl::ProjectRootPath root = hecl::SearchForProject(ExeDir)) {
hecl::SystemString rootPath(root.getAbsolutePath());
if (hecl::ProjectRootPath projRoot = hecl::SearchForProject(ExeDir)) {
hecl::SystemString rootPath(projRoot.getAbsolutePath());
hecl::Sstat theStat;
if (!hecl::Stat((rootPath + _SYS_STR("/out/files/Metroid1.upak")).c_str(), &theStat) && S_ISREG(theStat.st_mode))
m_deferedProject = rootPath + _SYS_STR("/out");

View File

@ -125,6 +125,8 @@ struct Application : boo::IApplicationCallback {
false, hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly);
m_cvarManager.findOrMakeCVar("debugOverlay.showFrameCounter"sv, "Displays the current frame index"sv, false,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly);
m_cvarManager.findOrMakeCVar("debugOverlay.showInGameTime"sv, "Displays the current in game time"sv, false,
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly);
}
};

View File

@ -235,7 +235,7 @@ void CGameState::SetCurrentWorldId(CAssetId id) {
MP1::CMain::EnsureWorldPakReady(x84_mlvlId);
}
void CGameState::SetTotalPlayTime(float time) { xa0_playTime = zeus::clamp<double>(0.0, time, 359999.0); }
void CGameState::SetTotalPlayTime(double time) { xa0_playTime = zeus::clamp(0.0, time, 359999.0); }
CWorldState& CGameState::StateForWorld(CAssetId mlvlId) {
auto it = x88_worldStates.begin();

View File

@ -95,7 +95,8 @@ public:
void SetCurrentWorldId(CAssetId id);
std::shared_ptr<CPlayerState> GetPlayerState() const { return x98_playerState; }
std::shared_ptr<CWorldTransManager> GetWorldTransitionManager() const { return x9c_transManager; }
void SetTotalPlayTime(float time);
void SetTotalPlayTime(double time);
double GetTotalPlayTime() const { return xa0_playTime; }
CPersistentOptions& SystemOptions() { return xa8_systemOptions; }
CGameOptions& GameOptions() { return x17c_gameOptions; }
CHintOptions& HintOptions() { return x1f8_hintOptions; }

View File

@ -117,6 +117,7 @@ set(RUNTIME_SOURCES_B
MkCastTo.py
TCastTo.hpp TCastTo.cpp
GCNTypes.hpp
CTextureCache.hpp CTextureCache.cpp
${PLAT_SRCS})
function(add_runtime_common_library name)

View File

@ -1859,7 +1859,7 @@ void CStateManager::Update(float dt) {
if (x904_gameState == EGameState::Running) {
if (!TCastToPtr<CCinematicCamera>(x870_cameraManager->GetCurrentCamera(*this))) {
g_GameState->SetTotalPlayTime(g_GameState->xa0_playTime + dt);
g_GameState->SetTotalPlayTime(g_GameState->GetTotalPlayTime() + dt);
UpdateHintState(dt);
}

View File

@ -1,5 +1,25 @@
//
// Created by antidote on 12/3/19.
//
#include "Runtime/CTextureCache.hpp"
#include "Runtime/CToken.hpp"
#include "CTextureCache.hpp"
namespace urde {
CTextureCache::CTextureCache(CInputStream& in) {
u32 textureCount = in.readUint32Big();
for (u32 i = 0; i < textureCount; ++i) {
CAssetId uid(in);
if (m_textureInfo.find(uid) == m_textureInfo.end())
m_textureInfo.emplace(uid, CTextureInfo(in));
}
}
const CTextureInfo* CTextureCache::GetTextureInfo(CAssetId id) const {
auto it = m_textureInfo.find(id);
if (it == m_textureInfo.end())
return nullptr;
return &it->second;
}
CFactoryFnReturn FTextureCacheFactory(const SObjectTag& tag, CInputStream& in,
const CVParamTransfer& vparms, CObjectReference* selfRef) {
return TToken<CTextureCache>::GetIObjObjectFor(std::make_unique<CTextureCache>(in));
}
}

View File

@ -1,10 +1,47 @@
//
// Created by antidote on 12/3/19.
//
#pragma once
#include "Runtime/RetroTypes.hpp"
#include "Runtime/Graphics/CTexture.hpp"
namespace urde {
class CPaletteInfo {
u32 m_format;
u32 m_elementCount;
u64 m_dolphinHash;
#ifndef URDE_CTEXTURECACHE_HPP
#define URDE_CTEXTURECACHE_HPP
public:
CPaletteInfo(CInputStream& in)
: m_format(in.readUint32Big()), m_elementCount(in.readUint32Big()), m_dolphinHash(in.readUint64Big()) {}
};
class CTextureInfo {
ETexelFormat m_format;
u32 m_mipCount;
u16 m_width;
u16 m_height;
u64 m_dolphinHash;
std::optional<CPaletteInfo> m_paletteInfo;
class CTextureCache {};
public:
CTextureInfo(CInputStream& in)
: m_format(ETexelFormat(in.readUint32Big()))
, m_mipCount(in.readUint32Big())
, m_width(in.readUint16Big())
, m_height(in.readUint16Big())
, m_dolphinHash(in.readUint64Big()) {
bool hasPal = in.readBool();
if (hasPal)
m_paletteInfo.emplace(in);
}
};
class CTextureCache {
public:
std::map<CAssetId, CTextureInfo> m_textureInfo;
#endif // URDE_CTEXTURECACHE_HPP
public:
CTextureCache(CInputStream& in);
const CTextureInfo* GetTextureInfo(CAssetId id) const;
};
CFactoryFnReturn FTextureCacheFactory(const urde::SObjectTag& tag, CInputStream& in,
const urde::CVParamTransfer& vparms, CObjectReference* selfRef);
}

View File

@ -15,6 +15,7 @@ class CGameState* g_GameState = nullptr;
class CInGameTweakManagerBase* g_TweakManager = nullptr;
class CBooRenderer* g_Renderer = nullptr;
class CStringTable* g_MainStringTable = nullptr;
class CTextureCache* g_TextureCache = nullptr;
class CInputGenerator* g_InputGenerator = nullptr;
class CStateManager* g_StateManager = nullptr;

View File

@ -48,6 +48,7 @@ extern class CGameState* g_GameState;
extern class CInGameTweakManagerBase* g_TweakManager;
extern class CBooRenderer* g_Renderer;
extern class CStringTable* g_MainStringTable;
extern class CTextureCache* g_TextureCache;
extern class CInputGenerator* g_InputGenerator;
extern class CStateManager* g_StateManager;

View File

@ -13,6 +13,7 @@
namespace urde {
class CVParamTransfer;
class CTextureInfo;
class CTexture {
public:
@ -35,7 +36,7 @@ private:
boo::ObjToken<boo::ITexture> m_paletteTex;
std::unique_ptr<u8[]> m_otex;
EFontType m_ftype = EFontType::None;
std::string m_dolphinName;
const CTextureInfo* m_textureInfo;
size_t ComputeMippedTexelCount() const;
size_t ComputeMippedBlockCountDXT1() const;
@ -73,8 +74,7 @@ public:
std::unique_ptr<u8[]> BuildMemoryCardTex(u32& sizeOut, ETexelFormat& fmtOut, std::unique_ptr<u8[]>& paletteOut) const;
const boo::ObjToken<boo::ITexture>& GetFontTexture(EFontType tp);
std::string_view GetDolphinName() const { return m_dolphinName; }
bool HasDolphinName() const { return !m_dolphinName.empty(); }
const CTextureInfo* GetTextureInfo() const { return m_textureInfo; }
};
CFactoryFnReturn FTextureFactory(const urde::SObjectTag& tag, std::unique_ptr<u8[]>&& in, u32 len,

View File

@ -2,6 +2,7 @@
#include "CSimplePool.hpp"
#include "CToken.hpp"
#include "Graphics/CGraphics.hpp"
#include "Runtime/CTextureCache.hpp"
namespace urde {
static logvisor::Module Log("urde::CTextureBoo");

View File

@ -1,64 +1,69 @@
#include "MP1.hpp"
#include "Graphics/Shaders/CModelShaders.hpp"
#include "Graphics/Shaders/CThermalColdFilter.hpp"
#include "Graphics/Shaders/CThermalHotFilter.hpp"
#include "Graphics/Shaders/CSpaceWarpFilter.hpp"
#include "Graphics/Shaders/CColoredQuadFilter.hpp"
#include "Graphics/Shaders/CColoredStripShader.hpp"
#include "Graphics/Shaders/CTexturedQuadFilter.hpp"
#include "Graphics/Shaders/CCameraBlurFilter.hpp"
#include "Graphics/Shaders/CXRayBlurFilter.hpp"
#include "Graphics/Shaders/CTextSupportShader.hpp"
#include "Graphics/Shaders/CEnergyBarShader.hpp"
#include "Graphics/Shaders/CRadarPaintShader.hpp"
#include "Graphics/Shaders/CMapSurfaceShader.hpp"
#include "Graphics/Shaders/CPhazonSuitFilter.hpp"
#include "Graphics/Shaders/CScanLinesFilter.hpp"
#include "Graphics/Shaders/CRandomStaticFilter.hpp"
#include "Graphics/Shaders/CFluidPlaneShader.hpp"
#include "Graphics/Shaders/CAABoxShader.hpp"
#include "Graphics/Shaders/CWorldShadowShader.hpp"
#include "Graphics/Shaders/CParticleSwooshShaders.hpp"
#include "Graphics/Shaders/CEnvFxShaders.hpp"
#include "NESEmulator/CNESShader.hpp"
#include "Audio/CStreamAudioManager.hpp"
#include "CGBASupport.hpp"
#include "Runtime/MP1/MP1.hpp"
#include "CGameHintInfo.hpp"
#include "Particle/CParticleDataFactory.hpp"
#include "Particle/CGenDescription.hpp"
#include "Particle/CElectricDescription.hpp"
#include "Particle/CSwooshDescription.hpp"
#include "Particle/CParticleElectricDataFactory.hpp"
#include "Particle/CParticleSwooshDataFactory.hpp"
#include "Particle/CWeaponDescription.hpp"
#include "Particle/CProjectileWeaponDataFactory.hpp"
#include "Particle/CDecalDataFactory.hpp"
#include "GuiSys/CGuiFrame.hpp"
#include "GuiSys/CRasterFont.hpp"
#include "GuiSys/CStringTable.hpp"
#include "Graphics/CModel.hpp"
#include "Graphics/CTexture.hpp"
#include "Character/CCharLayoutInfo.hpp"
#include "Character/CSkinRules.hpp"
#include "Character/CAnimCharacterSet.hpp"
#include "Character/CAllFormatsAnimSource.hpp"
#include "Character/CAnimPOIData.hpp"
#include "Collision/CCollidableOBBTreeGroup.hpp"
#include "Collision/CCollisionResponseData.hpp"
#include "CSaveWorld.hpp"
#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"
#include "Audio/CMidiManager.hpp"
#include "CDependencyGroup.hpp"
#include "CStateManager.hpp"
#include "World/CPlayer.hpp"
#include "CStopwatch.hpp"
#include "Runtime/Graphics/Shaders/CModelShaders.hpp"
#include "Runtime/Graphics/Shaders/CThermalColdFilter.hpp"
#include "Runtime/Graphics/Shaders/CThermalHotFilter.hpp"
#include "Runtime/Graphics/Shaders/CSpaceWarpFilter.hpp"
#include "Runtime/Graphics/Shaders/CColoredQuadFilter.hpp"
#include "Runtime/Graphics/Shaders/CColoredStripShader.hpp"
#include "Runtime/Graphics/Shaders/CTexturedQuadFilter.hpp"
#include "Runtime/Graphics/Shaders/CCameraBlurFilter.hpp"
#include "Runtime/Graphics/Shaders/CXRayBlurFilter.hpp"
#include "Runtime/Graphics/Shaders/CTextSupportShader.hpp"
#include "Runtime/Graphics/Shaders/CEnergyBarShader.hpp"
#include "Runtime/Graphics/Shaders/CRadarPaintShader.hpp"
#include "Runtime/Graphics/Shaders/CMapSurfaceShader.hpp"
#include "Runtime/Graphics/Shaders/CPhazonSuitFilter.hpp"
#include "Runtime/Graphics/Shaders/CScanLinesFilter.hpp"
#include "Runtime/Graphics/Shaders/CRandomStaticFilter.hpp"
#include "Runtime/Graphics/Shaders/CFluidPlaneShader.hpp"
#include "Runtime/Graphics/Shaders/CAABoxShader.hpp"
#include "Runtime/Graphics/Shaders/CWorldShadowShader.hpp"
#include "Runtime/Graphics/Shaders/CParticleSwooshShaders.hpp"
#include "Runtime/Graphics/Shaders/CEnvFxShaders.hpp"
#include "NESEmulator/CNESShader.hpp"
#include "Runtime/Audio/CStreamAudioManager.hpp"
#include "Runtime/MP1/CGBASupport.hpp"
#include "Runtime/CGameHintInfo.hpp"
#include "Runtime/Particle/CParticleDataFactory.hpp"
#include "Runtime/Particle/CParticleElectricDataFactory.hpp"
#include "Runtime/Particle/CParticleSwooshDataFactory.hpp"
#include "Runtime/Particle/CWeaponDescription.hpp"
#include "Runtime/Particle/CProjectileWeaponDataFactory.hpp"
#include "Runtime/Particle/CDecalDataFactory.hpp"
#include "Runtime/GuiSys/CGuiFrame.hpp"
#include "Runtime/GuiSys/CRasterFont.hpp"
#include "Runtime/GuiSys/CStringTable.hpp"
#include "Runtime/Graphics/CModel.hpp"
#include "Runtime/Graphics/CTexture.hpp"
#include "Runtime/Character/CCharLayoutInfo.hpp"
#include "Runtime/Character/CSkinRules.hpp"
#include "Runtime/Character/CAnimCharacterSet.hpp"
#include "Runtime/Character/CAllFormatsAnimSource.hpp"
#include "Runtime/Character/CAnimPOIData.hpp"
#include "Runtime/Collision/CCollidableOBBTreeGroup.hpp"
#include "Runtime/Collision/CCollisionResponseData.hpp"
#include "Runtime/CTextureCache.hpp"
#include "Runtime/CSaveWorld.hpp"
#include "Runtime/AutoMapper/CMapWorld.hpp"
#include "Runtime/AutoMapper/CMapArea.hpp"
#include "Runtime/AutoMapper/CMapUniverse.hpp"
#include "Runtime/World/CStateMachine.hpp"
#include "Runtime/CScannableObjectInfo.hpp"
#include "Runtime/Audio/CAudioGroupSet.hpp"
#include "Runtime/Audio/CSfxManager.hpp"
#include "Runtime/Audio/CMidiManager.hpp"
#include "Runtime/CDependencyGroup.hpp"
#include "Runtime/CStateManager.hpp"
#include "Runtime/World/CPlayer.hpp"
#include "Runtime/CStopwatch.hpp"
#include <DataSpec/DNAMP1/SFX/Misc.h>
#include <DataSpec/DNAMP1/SFX/MiscSamus.h>
#include <DataSpec/DNAMP1/SFX/UI.h>
#include <DataSpec/DNAMP1/SFX/Weapons.h>
#include <DataSpec/DNAMP1/SFX/ZZZ.h>
#include <discord_rpc.h>
namespace hecl {
@ -126,8 +131,11 @@ struct AudioGroupInfo {
u32 id;
};
static const AudioGroupInfo StaticAudioGroups[] = {
{"Misc_AGSC", 39}, {"MiscSamus_AGSC", 41}, {"UI_AGSC", 40}, {"Weapons_AGSC", 43}, {"ZZZ_AGSC", 65}};
static const AudioGroupInfo StaticAudioGroups[] = {{"Misc_AGSC", GRPmisc},
{"MiscSamus_AGSC", GRPmiscSamus},
{"UI_AGSC", GRPui},
{"Weapons_AGSC", GRPweapons},
{"ZZZ_AGSC", GRPzzz}};
bool CGameArchitectureSupport::LoadAudio() {
if (x88_audioLoadStatus == EAudioLoadStatus::Loaded)
@ -270,7 +278,6 @@ void CGameGlobalObjects::AddPaksAndFactories() {
loader->AddPakFileAsync("SamGunFx", true, false);
loader->AddPakFileAsync("MidiData", false, false);
loader->AddPakFileAsync("GGuiSys", false, false);
loader->AddPakFileAsync("!original_ids", false, false);
loader->WaitForPakFileLoadingComplete();
}
@ -304,6 +311,7 @@ void CGameGlobalObjects::AddPaksAndFactories() {
fmgr->AddFactory(FOURCC('MAPU'), FFactoryFunc(FMapUniverseFactory));
fmgr->AddFactory(FOURCC('AFSM'), FFactoryFunc(FAiFiniteStateMachineFactory));
fmgr->AddFactory(FOURCC('PATH'), FMemFactoryFunc(FPathFindAreaFactory));
fmgr->AddFactory(FOURCC('TMET'), FFactoryFunc(FTextureCacheFactory));
}
}
@ -338,12 +346,20 @@ void CMain::AddOverridePaks() {
if (!loader)
return;
/* Inversely load each pak starting at 999, to ensure proper priority order
* the higher the number the higer the priority, e.g: Override0 has less priority than Override1 etc.
*/
for (size_t i = 999; i > 0; --i) {
std::string path = fmt::format(fmt("Override{}"), i);
if (CDvdFile::FileExists((path + ".upak").c_str()))
loader->AddPakFileAsync(path, false, false, true);
}
/* Make sure all Override paks are ready before attempting to load URDE.upak */
loader->WaitForPakFileLoadingComplete();
/* Attempt to load URDE.upak
* NOTE(phil): Should we fatal here if it's not found?
*/
if (CDvdFile::FileExists("URDE.upak"))
loader->AddPakFile("URDE", false, false, true);
}

View File

@ -61,11 +61,16 @@ class CGameGlobalObjects {
TLockedToken<CStringTable> x13c_mainStringTable;
CInGameTweakManager x150_tweakManager;
std::unique_ptr<IRenderer> m_renderer;
TLockedToken<CTextureCache> m_textureCache;
void LoadStringTable() {
x13c_mainStringTable = g_SimplePool->GetObj("STRG_Main");
g_MainStringTable = x13c_mainStringTable.GetObj();
}
void LoadTextureCache() {
m_textureCache = g_SimplePool->GetObj("TextureCache"sv);
g_TextureCache = m_textureCache.GetObj();
}
void AddPaksAndFactories();
static IRenderer* AllocateRenderer(IObjectStore& store, IFactory& resFactory) {
g_Renderer = new CBooRenderer(store, resFactory);
@ -96,6 +101,7 @@ public:
void PostInitialize() {
AddPaksAndFactories();
LoadTextureCache();
LoadStringTable();
m_renderer.reset(AllocateRenderer(*xcc_simplePool, *x4_resFactory));
CEnvFxManager::Initialize();

View File

@ -50,7 +50,7 @@ void CJellyZap::Think(float dt, CStateManager& mgr) {
if (!GetActive())
return;
if (x5b8_24_)
x450_bodyController->FaceDirection(GetTranslation() - mgr.GetPlayer().GetTranslation(), dt);
x450_bodyController->FaceDirection(mgr.GetPlayer().GetTranslation() - GetTranslation(), dt);
float fv = (x5b8_25_ && x450_bodyController->GetPercentageFrozen() == 0.f ? x50c_baseDamageMag + (dt / 0.3f)
: x50c_baseDamageMag - (dt / 0.75f));
@ -96,9 +96,21 @@ void CJellyZap::Suck(CStateManager& mgr, EStateMsg msg, float arg) {
x32c_animState = EAnimState::Ready;
RemoveAllAttractors(mgr);
} else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::LoopReaction, &CPatterned::TryLoopReaction, 0);
x450_bodyController->GetCommandMgr().SetTargetVector(
(mgr.GetPlayer().GetTranslation() + zeus::CVector3f(0.f, 0.f, 1.f)) - GetTranslation());
zeus::CVector3f diff = (mgr.GetPlayer().GetTranslation() - GetTranslation());
float f1 = diff.magnitude();
float f3 = 5.f;
float f2 = x58c_;
if (mgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed)
f2 = x594_;
else if (mgr.GetPlayerState()->GetCurrentSuitRaw() == CPlayerState::EPlayerSuit::Gravity)
f2 = x590_;
float f4 = f3 * f2;
float f5 = 1.f / f1;
} else if (msg == EStateMsg::Deactivate) {
}
}
@ -110,7 +122,7 @@ void CJellyZap::Active(CStateManager& mgr, EStateMsg msg, float arg) {
x330_stateMachineState.SetDelay(x3d0_playerLeashTime);
} else if (msg == EStateMsg::Update) {
zeus::CVector3f targetVector =
GetTranslation() - (zeus::CVector3f(0.f, 0.f, 1.f) + mgr.GetPlayer().GetTranslation());
GetTranslation() - (zeus::CVector3f(0.f, 0.f, 1.f) + mgr.GetPlayer().GetTranslation());
x450_bodyController->GetCommandMgr().SetTargetVector(targetVector);
if (x5b8_26_) {
zeus::CVector3f moveToImpulse =