Fix visigen/hecl dependencies; Cleanup ViewManager; Various implementations

This commit is contained in:
Phillip Stephens 2017-08-29 06:17:52 -07:00
parent 1f7e8e1033
commit 9b5ec8f86d
41 changed files with 379 additions and 379 deletions

View File

@ -65,6 +65,8 @@ struct ITweakPlayerGun : ITweak
virtual float GetRichochetDamage(atUint32) const = 0; virtual float GetRichochetDamage(atUint32) const = 0;
virtual const SWeaponInfo& GetBeamInfo(atInt32 beam) const = 0; virtual const SWeaponInfo& GetBeamInfo(atInt32 beam) const = 0;
virtual const SComboShotParam& GetComboShotInfo(atInt32 beam) const = 0; virtual const SComboShotParam& GetComboShotInfo(atInt32 beam) const = 0;
virtual const SShotParam& GetBombInfo() const=0;
virtual const SShotParam& GetPowerBombInfo() const=0;
}; };
} }

View File

@ -41,7 +41,7 @@ struct ITweakPlayerRes : ITweak
ResId xc8_ballTransitions[5]; ResId xc8_ballTransitions[5];
ResId xc8_cineGun[5]; ResId xc8_cineGun[5];
float xf0_unkFloat; float xf0_cinematicMoveOutofIntoPlayerDistance;
ResId GetBeamBallTransitionModel(EBeamId beam) const ResId GetBeamBallTransitionModel(EBeamId beam) const
{ {
@ -131,7 +131,7 @@ struct ITweakPlayerRes : ITweak
for (int i=0 ; i<5 ; ++i) for (int i=0 ; i<5 ; ++i)
xc8_cineGun[i] = factory.GetResourceIdByName(_GetBeamCineModel(i).c_str())->id; xc8_cineGun[i] = factory.GetResourceIdByName(_GetBeamCineModel(i).c_str())->id;
xf0_unkFloat = _GetUnkFloat(); xf0_cinematicMoveOutofIntoPlayerDistance = _GetCinematicMoveOutofIntoPlayerDistance();
} }
protected: protected:
@ -160,7 +160,7 @@ protected:
virtual const std::string& _GetBallTransitionBeamRes(size_t idx) const=0; virtual const std::string& _GetBallTransitionBeamRes(size_t idx) const=0;
virtual const std::string& _GetBeamCineModel(size_t idx) const=0; virtual const std::string& _GetBeamCineModel(size_t idx) const=0;
virtual float _GetUnkFloat() const=0; virtual float _GetCinematicMoveOutofIntoPlayerDistance() const=0;
}; };
} }

View File

@ -15,16 +15,16 @@ struct Camera : IScriptObject
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;
Value<bool> unknown1; Value<bool> active;
Value<float> unknown2; Value<float> shotDuration;
Value<bool> unknown3; Value<bool> unknown3;
Value<bool> unknown4; Value<bool> unknown4;
Value<bool> unknown5; Value<bool> unknown5;
Value<bool> unknown6; Value<bool> unknown6;
Value<bool> unknown7; Value<bool> unknown7;
Value<bool> unknown8; Value<bool> disableInput;
Value<bool> unknown9; Value<bool> unknown9;
Value<float> unknown10; Value<float> fov;
Value<bool> unknown11; Value<bool> unknown11;
Value<bool> unknown12; Value<bool> unknown12;
}; };

View File

@ -15,7 +15,7 @@ struct CameraWaypoint : IScriptObject
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;
Value<bool> unknown1; Value<bool> active;
Value<float> unknown2; Value<float> unknown2;
Value<atUint32> unknown3; Value<atUint32> unknown3;
}; };

View File

@ -109,6 +109,9 @@ struct CTweakPlayerGun final : ITweakPlayerGun
return x1f0_combos[0]; return x1f0_combos[0];
return x1f0_combos[beam]; return x1f0_combos[beam];
} }
const SShotParam& GetBombInfo() const { return x70_bomb; }
const SShotParam& GetPowerBombInfo() const { return x8c_powerBomb; }
}; };
} }
} }

View File

@ -70,7 +70,7 @@ struct CTweakPlayerRes final : ITweakPlayerRes
String<-1> m_cinePlasma; String<-1> m_cinePlasma;
String<-1> m_cinePhazon; String<-1> m_cinePhazon;
Value<float> m_unkFloat; Value<float> m_cinematicMoveOutofIntoPlayerDistance;
const std::string& _GetSaveStationIcon() const { return m_saveStationIcon; } const std::string& _GetSaveStationIcon() const { return m_saveStationIcon; }
const std::string& _GetMissileStationIcon() const { return m_missileStationIcon; } const std::string& _GetMissileStationIcon() const { return m_missileStationIcon; }
@ -97,7 +97,7 @@ struct CTweakPlayerRes final : ITweakPlayerRes
const std::string& _GetBallTransitionBeamRes(size_t idx) const { return (&m_ballTransitionsPower)[idx]; } const std::string& _GetBallTransitionBeamRes(size_t idx) const { return (&m_ballTransitionsPower)[idx]; }
const std::string& _GetBeamCineModel(size_t idx) const { return (&m_cinePower)[idx]; } const std::string& _GetBeamCineModel(size_t idx) const { return (&m_cinePower)[idx]; }
float _GetUnkFloat() const { return m_unkFloat; } float _GetCinematicMoveOutofIntoPlayerDistance() const { return m_cinematicMoveOutofIntoPlayerDistance; }
CTweakPlayerRes() = default; CTweakPlayerRes() = default;
CTweakPlayerRes(athena::io::IStreamReader& in) { read(in); } CTweakPlayerRes(athena::io::IStreamReader& in) { read(in); }

View File

@ -11,7 +11,6 @@ struct PTLA : BigDNA
{ {
DECL_DNA DECL_DNA
Value<atUint32> magic; Value<atUint32> magic;
Value<atUint32> version;
struct UnknownStruct1 : BigDNA struct UnknownStruct1 : BigDNA
{ {
DECL_DNA DECL_DNA
@ -27,7 +26,8 @@ struct PTLA : BigDNA
Value<atUint16> unknown6; Value<atUint16> unknown6;
}; };
Vector<Entry, DNA_COUNT(count)> entries; Vector<Entry, DNA_COUNT(count)> entries;
Value<atVec3f> unknown[2]; Value<atUint16> unknown1;
Value<atVec3f> unknown2[2];
}; };
Value<atUint32> count1; Value<atUint32> count1;
Vector<UnknownStruct1, DNA_COUNT(count1)> entries1; Vector<UnknownStruct1, DNA_COUNT(count1)> entries1;

View File

@ -50,3 +50,10 @@ target_link_libraries(urde
set_target_properties(urde PROPERTIES set_target_properties(urde PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist") MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist")
add_dependencies(urde visigen hecl)
add_custom_command(TARGET urde POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:visigen> $<TARGET_FILE_DIR:urde>)
add_custom_command(TARGET urde POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:hecl> $<TARGET_FILE_DIR:urde>)

View File

@ -27,52 +27,9 @@ namespace urde
void ViewManager::BuildTestPART(urde::IObjectStore& objStore) void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
{ {
m_modelTest = objStore.GetObj("MP1/Shared/CMDL_B2B41738.blend");
#if 0
SObjectTag samusCharSet = m_projManager.TagFromPath(_S("MP1/Shared/ANCS_77289A4A.*"));
SObjectTag platModel = m_projManager.TagFromPath(_S("MP1/Shared/CMDL_6FA561D0.blend"));
SObjectTag bgModel = m_projManager.TagFromPath(_S("MP1/Shared/CMDL_BC34D54C.blend"));
CAnimRes samusAnimRes(samusCharSet.id, 2, zeus::CVector3f{2.f, 2.f, 2.f}, 1, true);
g_GameState->GetWorldTransitionManager()->EnableTransition(samusAnimRes,
platModel.id, zeus::CVector3f::skOne,
bgModel.id, zeus::CVector3f::skOne, true);
SObjectTag areaTag = m_projManager.TagFromPath(
_S("MP1/Metroid1/!1IntroLevel1027/00 Exterior Docking Hangar/!area.blend"));
auto areaData = m_projManager.resourceFactoryMP1().LoadResourceSync(areaTag);
#endif
//m_modelTest = objStore.GetObj("gun_cmdl");
//m_modelTest = objStore.GetObj("CMDL_GameCube");
//m_partGenDesc = objStore.GetObj({hecl::FOURCC('PART'), 0x0deb9456});
//m_partGenDesc = objStore.GetObj("PowerCharge");
//m_partGen.reset(new urde::CElementGen(m_partGenDesc,
// urde::CElementGen::EModelOrientationType::Normal,
// urde::CElementGen::EOptionalSystemFlags::None));
//m_partGen->SetGlobalScale({5.f, 5.f, 5.f});
m_lineRenderer.reset(new urde::CLineRenderer(urde::CLineRenderer::EPrimitiveMode::LineStrip, 4, nullptr, true));
TLockedToken<CTexture> xrayPalette = objStore.GetObj("TXTR_XRayPalette"); TLockedToken<CTexture> xrayPalette = objStore.GetObj("TXTR_XRayPalette");
m_testGameView.reset(new TestGameView(*this, m_viewResources, *m_rootView, xrayPalette)); m_testGameView.reset(new TestGameView(*this, m_viewResources, *m_rootView, xrayPalette));
#if 0
m_moviePlayer.reset(new CMoviePlayer("Video/SpecialEnding.thp", 1.f, false, true));
m_moviePlayer->SetFrame({-1.0f, 1.0f, 0.f}, {-1.0f, -1.0f, 0.f}, {1.0f, -1.0f, 0.f}, {1.0f, 1.0f, 0.f});
CDvdFile testRSF("Audio/frontend_1.rsf");
u64 rsfLen = testRSF.Length();
m_rsfBuf.reset(new u8[rsfLen]);
testRSF.SyncRead(m_rsfBuf.get(), rsfLen);
CMoviePlayer::SetStaticAudio(m_rsfBuf.get(), rsfLen, 416480, 1973664);
m_videoVoice = m_voiceEngine->allocateNewStereoVoice(32000, &m_voiceCallback);
m_videoVoice->start();
#endif
//m_newAudioPlayer.emplace(*m_voiceEngine, "Audio/frontend_1.rsf", 416480, 1973664);
//m_newAudioPlayer->StartMixing();
m_rootView->accessContentViews().clear(); m_rootView->accessContentViews().clear();
m_rootView->accessContentViews().push_back(m_testGameView.get()); m_rootView->accessContentViews().push_back(m_testGameView.get());
m_rootView->updateSize(); m_rootView->updateSize();
@ -92,93 +49,7 @@ void ViewManager::TestGameView::resized(const boo::SWindowRect& root, const boo:
void ViewManager::TestGameView::draw(boo::IGraphicsCommandQueue* gfxQ) void ViewManager::TestGameView::draw(boo::IGraphicsCommandQueue* gfxQ)
{ {
gfxQ->clearTarget(true, true); gfxQ->clearTarget(true, true);
//g_GameState->GetWorldTransitionManager()->Update(1.f / 60.f);
//g_GameState->GetWorldTransitionManager()->Draw();
if (m_vm.m_modelTest.IsLoaded())
{
#if 0
CModelFlags flags;
flags.m_extendedShader = EExtendedShader::Flat;
//flags.m_extendedShaderIdx = 2;
//if (std::fmod(m_theta, M_PIF) < M_PIF / 2.f)
// flags.m_extendedShaderIdx = 1;
m_theta += 0.01f;
CGraphics::SetModelMatrix(zeus::CTransform::RotateZ(m_theta));
g_Renderer->SetWorldViewpoint(zeus::lookAt(zeus::CVector3f{0.f, -20.f, 7.f},
{0.f, 0.f, 3.f}));
boo::SWindowRect windowRect = m_vm.m_mainWindow->getWindowFrame();
float aspect = windowRect.size[0] / float(windowRect.size[1]);
CGraphics::SetPerspective(55.0, aspect, 0.2f, 50.f);
//CGraphics::SetFog(ERglFogMode::PerspExp, 7.f, 15.f, zeus::CColor::skRed);
//CGraphics::SetFog(ERglFogMode::PerspExp, 10.f + std::sin(m_theta) * 5.f, 15.f + std::sin(m_theta) * 5.f, zeus::CColor::skRed);
zeus::CFrustum frustum;
frustum.updatePlanes(CGraphics::g_GXModelView, zeus::SProjPersp(55.0, aspect, 0.2f, 50.f));
g_Renderer->SetClippingPlanes(frustum);
std::vector<CLight> lights = {CLight::BuildLocalAmbient({}, {0.05f, 0.05f, 0.05f, 1.f}),
CLight::BuildCustom({5.f, -20.f, 10.f}, {0.f, 1.f, 0.f},
{200.f, 200.f, 200.f}, 0.f, 0.f, 1.f, 1.f, 0.f, 0.f)};
lights = {CLight::BuildLocalAmbient({}, {0.5f, 0.5f, 0.5f, 1.f})};
m_vm.m_modelTest->GetInstance().ActivateLights(lights);
//g_Renderer->SetThermal(true, 1.f, zeus::CColor::skWhite);
//g_Renderer->SetThermalColdScale(std::sin(m_theta) * 0.5f + 0.5f);
//g_Renderer->DoThermalBlendCold();
flags.m_extendedShader = EExtendedShader::Lighting;
//m_widescreen.draw(zeus::CColor::skBlack, std::sin(m_theta * 3.f) / 2.f + 0.5f);
m_vm.m_modelTest->Draw(flags);
g_Renderer->ReallyRenderFogVolume(zeus::CColor::skRed, m_vm.m_modelTest->GetAABB(),
nullptr, nullptr);
//m_xrayBlur.draw(25.f);
//m_camBlur.draw((std::sin(m_theta * 3.f) / 2.f + 0.5f) * 3.f);
//g_Renderer->DoThermalBlendHot();
//m_spaceWarpFilter.setStrength(std::sin(m_theta * 5.f) * 0.5f + 0.5f);
//m_spaceWarpFilter.draw(zeus::CVector2f{0.f, 0.f});
#endif
}
if (m_vm.m_partGen)
{
m_vm.m_partGen->Update(1.0 / 60.0);
if (m_vm.m_partGen->IsSystemDeletable())
m_vm.m_partGen->Reset();
CGraphics::SetModelMatrix(zeus::CTransform::Identity());
CGraphics::SetViewPointMatrix(zeus::CTransform::Identity() + zeus::CVector3f(0.f, -10.f, 0.f));
boo::SWindowRect windowRect = m_vm.m_mainWindow->getWindowFrame();
float aspect = windowRect.size[0] / float(windowRect.size[1]);
CGraphics::SetPerspective(55.0, aspect, 0.1f, 1000.f);
//gfxQ->clearTarget(false, true);
m_vm.m_partGen->Render();
/*
m_vm.m_lineRenderer->Reset();
m_vm.m_lineRenderer->AddVertex({-0.5f, 0.f, -0.5f}, zeus::CColor::skBlue, 1.f);
m_vm.m_lineRenderer->AddVertex({-0.5f, 0.f, 0.5f}, zeus::CColor::skBlue, 1.f);
m_vm.m_lineRenderer->AddVertex({0.5f, 10.f, 0.5f}, zeus::CColor::skRed, 3.f);
m_vm.m_lineRenderer->AddVertex({0.5f, 0.f, -0.5f}, zeus::CColor::skBlue, 1.f);
m_vm.m_lineRenderer->Render();
*/
}
if (m_vm.m_moviePlayer)
{
if (m_vm.m_moviePlayer->GetIsMovieFinishedPlaying())
{
m_vm.m_moviePlayer.reset(new CMoviePlayer("Video/01_startloop.thp", -1.f, true, false));
m_vm.m_moviePlayer->SetFrame({-1.0f, 1.0f, 0.f}, {-1.0f, -1.0f, 0.f}, {1.0f, -1.0f, 0.f}, {1.0f, 1.0f, 0.f});
}
m_vm.m_moviePlayer->Update(1.f / 60.f);
m_vm.m_moviePlayer->DrawFrame();
}
m_vm.m_projManager.mainDraw(); m_vm.m_projManager.mainDraw();
++m_frame; ++m_frame;
} }
@ -253,7 +124,7 @@ void ViewManager::DismissSplash()
ViewManager::ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarManager& cvarMgr) ViewManager::ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarManager& cvarMgr)
: m_fileStoreManager(fileMgr), m_cvarManager(cvarMgr), m_projManager(*this), : m_fileStoreManager(fileMgr), m_cvarManager(cvarMgr), m_projManager(*this),
m_fontCache(fileMgr), m_translator(urde::SystemLocaleOrEnglish()), m_voiceCallback(*this), m_fontCache(fileMgr), m_translator(urde::SystemLocaleOrEnglish()),
m_recentProjectsPath(hecl::SysFormat(_S("%s/recent_projects.txt"), fileMgr.getStoreRoot().c_str())), m_recentProjectsPath(hecl::SysFormat(_S("%s/recent_projects.txt"), fileMgr.getStoreRoot().c_str())),
m_recentFilesPath(hecl::SysFormat(_S("%s/recent_files.txt"), fileMgr.getStoreRoot().c_str())) m_recentFilesPath(hecl::SysFormat(_S("%s/recent_files.txt"), fileMgr.getStoreRoot().c_str()))
{ {

View File

@ -124,31 +124,9 @@ class ViewManager : public specter::IViewManager
} }
}; };
std::unique_ptr<TestGameView> m_testGameView; std::unique_ptr<TestGameView> m_testGameView;
urde::TLockedToken<CModel> m_modelTest;
urde::TLockedToken<CGenDescription> m_partGenDesc;
TLockedToken<CGameHintInfo> m_hints;
std::unique_ptr<CElementGen> m_partGen;
std::unique_ptr<CLineRenderer> m_lineRenderer;
std::unique_ptr<CMoviePlayer> m_moviePlayer;
std::unique_ptr<u8[]> m_rsfBuf;
std::unique_ptr<boo::IAudioVoiceEngine> m_voiceEngine; std::unique_ptr<boo::IAudioVoiceEngine> m_voiceEngine;
std::unique_ptr<boo::IAudioVoice> m_videoVoice; std::unique_ptr<boo::IAudioVoice> m_videoVoice;
std::experimental::optional<amuse::BooBackendVoiceAllocator> m_amuseAllocWrapper; std::experimental::optional<amuse::BooBackendVoiceAllocator> m_amuseAllocWrapper;
struct AudioVoiceCallback : boo::IAudioVoiceCallback
{
ViewManager& m_vm;
void preSupplyAudio(boo::IAudioVoice&, double) {}
size_t supplyAudio(boo::IAudioVoice& voice, size_t frames, int16_t* data)
{
if (m_vm.m_moviePlayer)
m_vm.m_moviePlayer->MixAudio(data, nullptr, frames);
CMoviePlayer::MixStaticAudio(data, data, frames);
return frames;
}
AudioVoiceCallback(ViewManager& vm) : m_vm(vm) {}
} m_voiceCallback;
std::experimental::optional<CStaticAudioPlayer> m_newAudioPlayer;
hecl::SystemString m_recentProjectsPath; hecl::SystemString m_recentProjectsPath;
std::vector<hecl::SystemString> m_recentProjects; std::vector<hecl::SystemString> m_recentProjects;

View File

@ -361,6 +361,11 @@ u16 CSfxManager::TranslateSFXID(u16 id)
return ret; return ret;
} }
bool CSfxManager::PlaySound(const CSfxManager::CSfxHandle &handle)
{
return false;
}
void CSfxManager::StopSound(const CSfxHandle& handle) void CSfxManager::StopSound(const CSfxHandle& handle)
{ {
if (!handle) if (!handle)

View File

@ -211,6 +211,7 @@ public:
const zeus::CVector3f& heading, const zeus::CVector3f& up, const zeus::CVector3f& heading, const zeus::CVector3f& up,
u8 vol); u8 vol);
static bool PlaySound(const CSfxHandle& handle);
static void StopSound(const CSfxHandle& handle); static void StopSound(const CSfxHandle& handle);
static s16 GetRank(CBaseSfxWrapper* sfx); static s16 GetRank(CBaseSfxWrapper* sfx);
static void ApplyReverb(); static void ApplyReverb();

View File

@ -37,14 +37,12 @@ CGameHintInfo::SHintLocation::SHintLocation(CInputStream& in, s32)
int CGameHintInfo::FindHintIndex(const char* str) int CGameHintInfo::FindHintIndex(const char* str)
{ {
int idx = 0; const std::vector<CGameHint>& gameHints = g_MemoryCardSys->GetHints();
for (const CGameHintInfo::CGameHint& hint : g_MemoryCardSys->GetHints()) const auto& it = std::find_if(gameHints.begin(), gameHints.end(), [&str](const CGameHint& gh) -> bool {
{ return !gh.GetName().compare(str);
if (!hint.GetName().compare(str)) });
return idx;
++idx; return (it != gameHints.end() ? it - gameHints.begin() : -1);
}
return -1;
} }
CFactoryFnReturn FHintFactory(const SObjectTag&, CInputStream& in, const CVParamTransfer, CObjectReference*) CFactoryFnReturn FHintFactory(const SObjectTag&, CInputStream& in, const CVParamTransfer, CObjectReference*)

View File

@ -385,6 +385,7 @@ public:
bool ShouldQuitGame() const { return xf94_25_quitGame; } bool ShouldQuitGame() const { return xf94_25_quitGame; }
void SetShouldQuitGame(bool should) { xf94_25_quitGame = should; } void SetShouldQuitGame(bool should) { xf94_25_quitGame = should; }
void SetInSaveUI(bool b) { xf94_28_inSaveUI = b; } void SetInSaveUI(bool b) { xf94_28_inSaveUI = b; }
bool GetInSaveUI() const { return xf94_28_inSaveUI; }
void SetInMapScreen(bool b) { xf94_27_inMapScreen = b; } void SetInMapScreen(bool b) { xf94_27_inMapScreen = b; }
bool GetInMapScreen() const { return xf94_27_inMapScreen; } bool GetInMapScreen() const { return xf94_27_inMapScreen; }
bool IsFullThreat() const { return xf94_30_fullThreat; } bool IsFullThreat() const { return xf94_30_fullThreat; }

View File

@ -330,4 +330,9 @@ bool CCameraManager::HasBallCameraInitialPositionHint(CStateManager& mgr) const
{ {
return false; return false;
} }
void CCameraManager::RemoveCinemaCamera(TUniqueId uid, CStateManager& mgr)
{
x4_cineCameras.erase(std::remove(x4_cineCameras.begin(), x4_cineCameras.end(), uid));
}
} }

View File

@ -86,6 +86,7 @@ public:
void RemoveCameraShaker(int id); void RemoveCameraShaker(int id);
int AddCameraShaker(const CCameraShakeData& data, bool sfx); int AddCameraShaker(const CCameraShakeData& data, bool sfx);
void AddCinemaCamera(TUniqueId, CStateManager& stateMgr); void AddCinemaCamera(TUniqueId, CStateManager& stateMgr);
void RemoveCinemaCamera(TUniqueId, CStateManager&);
void SetInsideFluid(bool, TUniqueId); void SetInsideFluid(bool, TUniqueId);
void Update(float dt, CStateManager& stateMgr); void Update(float dt, CStateManager& stateMgr);
CGameCamera* GetCurrentCamera(CStateManager& stateMgr) const; CGameCamera* GetCurrentCamera(CStateManager& stateMgr) const;

View File

@ -1,13 +1,15 @@
#include "CCinematicCamera.hpp" #include "CCinematicCamera.hpp"
#include "CStateManager.hpp"
#include "Camera/CCameraManager.hpp"
#include "TCastTo.hpp" #include "TCastTo.hpp"
namespace urde namespace urde
{ {
CCinematicCamera::CCinematicCamera(TUniqueId uid, const std::string& name, const CEntityInfo& info, CCinematicCamera::CCinematicCamera(TUniqueId uid, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, bool active, float, float a, float b, float c, float d, const zeus::CTransform& xf, bool active, float shotDuration, float fovy, float znear,
u32 w1) float zfar, float aspect, u32 w1)
: CGameCamera(uid, active, name, info, xf, a, b, c, d, kInvalidUniqueId, w1 & 0x20, 0), x21c_w1(w1) : CGameCamera(uid, active, name, info, xf, fovy, znear, zfar, aspect, kInvalidUniqueId, w1 & 0x20, 0), x21c_w1(w1)
{ {
} }
@ -21,7 +23,38 @@ void CCinematicCamera::ProcessInput(const CFinalInput&, CStateManager& mgr) {}
void CCinematicCamera::Reset(const zeus::CTransform&, CStateManager& mgr) {} void CCinematicCamera::Reset(const zeus::CTransform&, CStateManager& mgr) {}
void CCinematicCamera::WasDeactivated(CStateManager& mgr) void CCinematicCamera::WasDeactivated(CStateManager& mgr)
{
mgr.GetCameraManager()->RemoveCinemaCamera(GetUniqueId(), mgr);
}
void CCinematicCamera::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
{
CGameCamera::AcceptScriptMsg(msg, uid, mgr);
if (msg == EScriptObjectMessage::Activate)
{
CalculateWaypoints(mgr);
if (x21c_w1 & 1)
{ {
} }
} }
else if (msg == EScriptObjectMessage::Deactivate)
{
WasDeactivated(mgr);
}
else if (msg == EScriptObjectMessage::InitializedInArea)
{
}
}
void CCinematicCamera::CalculateWaypoints(CStateManager& mgr)
{
}
void CCinematicCamera::SendArrivedMsg(TUniqueId reciever, CStateManager& mgr)
{
mgr.SendScriptMsgAlways(reciever, GetUniqueId(), EScriptObjectMessage::Arrived);
}
}

View File

@ -14,10 +14,13 @@ public:
const zeus::CTransform& xf, bool, float, float, float, float, float, u32 w1); const zeus::CTransform& xf, bool, float, float, float, float, float, u32 w1);
void Accept(IVisitor& visitor); void Accept(IVisitor& visitor);
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr);
void ProcessInput(const CFinalInput&, CStateManager& mgr); void ProcessInput(const CFinalInput&, CStateManager& mgr);
void Reset(const zeus::CTransform&, CStateManager& mgr); void Reset(const zeus::CTransform&, CStateManager& mgr);
u32 GetW1() const { return x21c_w1; } u32 GetW1() const { return x21c_w1; }
void WasDeactivated(CStateManager& mgr); void WasDeactivated(CStateManager& mgr);
void CalculateWaypoints(CStateManager& mgr);
void SendArrivedMsg(TUniqueId reciever, CStateManager& mgr);
}; };
} }

View File

@ -8,7 +8,7 @@ namespace urde
CGameCamera::CGameCamera(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info, CGameCamera::CGameCamera(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, float fovy, float znear, float zfar, float aspect, TUniqueId uid2, const zeus::CTransform& xf, float fovy, float znear, float zfar, float aspect, TUniqueId uid2,
bool b1, u32 controllerIdx) bool disableInput, u32 controllerIdx)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Unknown), : CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Unknown),
CActorParameters::None(), kInvalidUniqueId) CActorParameters::None(), kInvalidUniqueId)
, xe8_watchedObject(uid2) , xe8_watchedObject(uid2)
@ -19,7 +19,7 @@ CGameCamera::CGameCamera(TUniqueId uid, bool active, const std::string& name, co
, x168_aspect(aspect) , x168_aspect(aspect)
, x16c_controllerIdx(controllerIdx) , x16c_controllerIdx(controllerIdx)
, x170_24_perspDirty(true) , x170_24_perspDirty(true)
, x170_25_disablesInput(b1) , x170_25_disablesInput(disableInput)
, x180_(fovy) , x180_(fovy)
, x184_fov(fovy) , x184_fov(fovy)
{ {

View File

@ -37,7 +37,7 @@ class CMetaree : public CPatterned
u32 x5cc_; u32 x5cc_;
public: public:
static constexpr ECharacter CharacterType = ECharacter::MetroidPrimeExo; static constexpr ECharacter CharacterType = ECharacter::Metaree;
CMetaree(TUniqueId, const std::string&, EFlavorType, const CEntityInfo&, const zeus::CTransform&, CModelData&&, CMetaree(TUniqueId, const std::string&, EFlavorType, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CPatternedInfo&, const CDamageInfo&, float, const zeus::CVector3f&, float, EBodyType, float, float, const CPatternedInfo&, const CDamageInfo&, float, const zeus::CVector3f&, float, EBodyType, float, float,
const CActorParameters&); const CActorParameters&);

View File

@ -45,14 +45,14 @@ struct SObjectTag
bool operator<(const SObjectTag& other) const { return id < other.id; } bool operator<(const SObjectTag& other) const { return id < other.id; }
SObjectTag() = default; SObjectTag() = default;
SObjectTag(FourCC tp, CAssetId rid) : type(tp), id(rid) {} SObjectTag(FourCC tp, CAssetId rid) : type(tp), id(rid) {}
SObjectTag(CInputStream& in, bool _64bit = false) SObjectTag(CInputStream& in)
{ {
in.readBytesToBuf(&type, 4); in.readBytesToBuf(&type, 4);
id = (_64bit ? in.readUint64Big() : in.readUint32Big()); id = CAssetId(in);
} }
void readMLVL(CInputStream& in, bool _64bit = false) void readMLVL(CInputStream& in)
{ {
id = (_64bit ? in.readUint64Big() : in.readUint32Big()); id = CAssetId(in);
in.readBytesToBuf(&type, 4); in.readBytesToBuf(&type, 4);
} }
}; };

View File

@ -8,6 +8,7 @@
#include "MP1/World/CMetroid.hpp" #include "MP1/World/CMetroid.hpp"
#include "World/CScriptWater.hpp" #include "World/CScriptWater.hpp"
#include "World/CGameLight.hpp" #include "World/CGameLight.hpp"
#include "World/CScriptPlatform.hpp"
#include "Input/ControlMapper.hpp" #include "Input/ControlMapper.hpp"
#include "CBomb.hpp" #include "CBomb.hpp"
#include "CPowerBomb.hpp" #include "CPowerBomb.hpp"
@ -1052,7 +1053,7 @@ void CPlayerGun::UpdateWeaponFire(float dt, const CPlayerState& playerState, CSt
mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::MorphBallBombs)) mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::MorphBallBombs))
{ {
if (x835_28_bombReady) if (x835_28_bombReady)
DropBomb(EBWeapon::Zero, mgr); DropBomb(EBWeapon::Bomb, mgr);
} }
else if (mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::PowerBombs) && else if (mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::PowerBombs) &&
mgr.GetPlayerState()->GetItemAmount(CPlayerState::EItemType::PowerBombs) > 0) mgr.GetPlayerState()->GetItemAmount(CPlayerState::EItemType::PowerBombs) > 0)
@ -1060,7 +1061,7 @@ void CPlayerGun::UpdateWeaponFire(float dt, const CPlayerState& playerState, CSt
x835_29_powerBombReady = mgr.CanCreateProjectile(x538_playerId, EWeaponType::PowerBomb, 1) && x835_29_powerBombReady = mgr.CanCreateProjectile(x538_playerId, EWeaponType::PowerBomb, 1) &&
mgr.CanCreateProjectile(x538_playerId, EWeaponType::Bomb, 1); mgr.CanCreateProjectile(x538_playerId, EWeaponType::Bomb, 1);
if ((pressedStates & 0x2) != 0 && x835_29_powerBombReady) if ((pressedStates & 0x2) != 0 && x835_29_powerBombReady)
DropBomb(EBWeapon::One, mgr); DropBomb(EBWeapon::PowerBomb, mgr);
} }
} }
} }
@ -1675,12 +1676,50 @@ void CPlayerGun::AddToRenderer(const zeus::CFrustum& frustum, const CStateManage
void CPlayerGun::DropBomb(EBWeapon weapon, CStateManager& mgr) void CPlayerGun::DropBomb(EBWeapon weapon, CStateManager& mgr)
{ {
if (weapon == EBWeapon::Bomb)
{
if (x32c_ != 0)
{
x32c_ = 0xA;
return;
}
if (x308_bombCount <= 0)
return;
CBomb* bomb =
new CBomb(x784_bombEffects[u32(weapon)][0], x784_bombEffects[u32(weapon)][1], mgr.AllocateUniqueId(),
mgr.GetPlayer().GetAreaId(), x538_playerId, x354_bombFuseTime,
zeus::CTransform::Translate(zeus::CVector3f{0.f, g_tweakPlayer->GetPlayerBallHalfExtent(), 0.f}),
g_tweakPlayerGun->GetBombInfo());
mgr.AddObject(bomb);
if (x308_bombCount == 3)
x35c_bombTime = x358_bombDropDelayTime;
--x308_bombCount;
if (TCastToPtr<CScriptPlatform> plat = mgr.ObjectById(mgr.GetPlayer().GetRidingPlatformId()))
plat->AddSlave(bomb->GetUniqueId(), mgr);
}
else if (weapon == EBWeapon::PowerBomb)
{
mgr.GetPlayerState()->DecrPickup(CPlayerState::EItemType::PowerBombs, 1);
x53a_powerBomb = DropPowerBomb(mgr);
}
} }
TUniqueId CPlayerGun::DropPowerBomb(CStateManager& mgr) TUniqueId CPlayerGun::DropPowerBomb(CStateManager& mgr)
{ {
return {}; CDamageInfo dInfo = (mgr.GetPlayer().GetDeathTime() <= 0.f ? g_tweakPlayerGun->GetPowerBombInfo()
} : CDamageInfo(CWeaponMode::PowerBomb(), 0.f, 0.f, 0.f));
TUniqueId uid = mgr.AllocateUniqueId();
CPowerBomb* pBomb =
new CPowerBomb(x784_bombEffects[1][0], uid, kInvalidAreaId, x538_playerId,
zeus::CTransform::Translate(mgr.GetPlayer().GetTranslation() +
zeus::CVector3f{0.f, g_tweakPlayer->GetPlayerBallHalfExtent(), 0.f}),
dInfo);
mgr.AddObject(*pBomb);
return uid;
}
} }

View File

@ -35,8 +35,8 @@ public:
}; };
enum class EBWeapon enum class EBWeapon
{ {
Zero, Bomb,
One PowerBomb
}; };
enum class EGunOverrideMode enum class EGunOverrideMode
{ {

View File

@ -4,56 +4,27 @@
namespace urde namespace urde
{ {
CWeaponMode::CWeaponMode(EWeaponType type, bool charged, bool comboed, bool instaKill) CWeaponMode::CWeaponMode(EWeaponType type, bool charged, bool comboed, bool instaKill)
: x0_weaponType(type) : x0_weaponType(type), x4_24_charged(charged), x4_25_comboed(comboed), x4_26_instantKill(instaKill)
, x4_24_charged(charged)
, x4_25_comboed(comboed)
, x4_26_instantKill(instaKill)
{ {
} }
EWeaponType CWeaponMode::GetType() const EWeaponType CWeaponMode::GetType() const { return x0_weaponType; }
{
return x0_weaponType;
}
CWeaponMode CWeaponMode::Invalid() CWeaponMode CWeaponMode::Invalid() { return CWeaponMode(EWeaponType::None); }
{
return CWeaponMode(EWeaponType::None);
}
CWeaponMode CWeaponMode::Phazon() CWeaponMode CWeaponMode::Phazon() { return CWeaponMode(EWeaponType::Phazon); }
{
return CWeaponMode(EWeaponType::Phazon);
}
CWeaponMode CWeaponMode::Plasma() CWeaponMode CWeaponMode::Plasma() { return CWeaponMode(EWeaponType::Plasma); }
{
return CWeaponMode(EWeaponType::Plasma);
}
CWeaponMode CWeaponMode::Wave() CWeaponMode CWeaponMode::Wave() { return CWeaponMode(EWeaponType::Wave); }
{
return CWeaponMode(EWeaponType::Wave);
}
CWeaponMode CWeaponMode::BoostBall() CWeaponMode CWeaponMode::BoostBall() { return CWeaponMode(EWeaponType::BoostBall); }
{
return CWeaponMode(EWeaponType::BoostBall);
}
CWeaponMode CWeaponMode::Ice() CWeaponMode CWeaponMode::Ice() { return CWeaponMode(EWeaponType::Ice); }
{
return CWeaponMode(EWeaponType::Ice);
}
CWeaponMode CWeaponMode::Power() CWeaponMode CWeaponMode::Power() { return CWeaponMode(EWeaponType::Power); }
{
return CWeaponMode(EWeaponType::Power);
}
CWeaponMode CWeaponMode::Bomb() CWeaponMode CWeaponMode::Bomb() { return CWeaponMode(EWeaponType::Bomb); }
{
return CWeaponMode(EWeaponType::Bomb);
}
CWeaponMode CWeaponMode::PowerBomb() { return CWeaponMode(EWeaponType::PowerBomb); }
} }

View File

@ -11,12 +11,12 @@ class CWeaponMode
bool x4_24_charged : 1; bool x4_24_charged : 1;
bool x4_25_comboed : 1; bool x4_25_comboed : 1;
bool x4_26_instantKill : 1; bool x4_26_instantKill : 1;
public: public:
CWeaponMode() = default; CWeaponMode() = default;
CWeaponMode(EWeaponType, bool charged = false, bool comboed = false, bool instaKill = false); CWeaponMode(EWeaponType, bool charged = false, bool comboed = false, bool instaKill = false);
EWeaponType GetType() const; EWeaponType GetType() const;
bool IsCharged() const { return x4_24_charged; } bool IsCharged() const { return x4_24_charged; }
bool IsComboed() const { return x4_25_comboed; } bool IsComboed() const { return x4_25_comboed; }
bool IsInstantKill() const { return x4_26_instantKill; } bool IsInstantKill() const { return x4_26_instantKill; }
@ -29,6 +29,7 @@ public:
static CWeaponMode Ice(); static CWeaponMode Ice();
static CWeaponMode Power(); static CWeaponMode Power();
static CWeaponMode Bomb(); static CWeaponMode Bomb();
static CWeaponMode PowerBomb();
}; };
} }
#endif // __URDE_CWEAPONMODE_HPP__ #endif // __URDE_CWEAPONMODE_HPP__

View File

@ -46,5 +46,4 @@ float CDamageInfo::GetRadiusDamage(const CDamageVulnerability& dVuln) const
return xc_radiusDamage; return xc_radiusDamage;
} }
} }

View File

@ -669,6 +669,7 @@ public:
TUniqueId GetAttachedActor() const { return x26c_attachedActor; } TUniqueId GetAttachedActor() const { return x26c_attachedActor; }
float GetAttachedActorStruggle() const { return xa28_attachedActorStruggle; } float GetAttachedActorStruggle() const { return xa28_attachedActorStruggle; }
float GetDistanceUnderWater() const { return x828_distanceUnderWater; } float GetDistanceUnderWater() const { return x828_distanceUnderWater; }
TUniqueId GetRidingPlatformId() const { return x82e_ridingPlatform; }
}; };
} }

View File

@ -7,14 +7,15 @@
namespace urde namespace urde
{ {
CScriptActorRotate::CScriptActorRotate(TUniqueId uid, const std::string& name, const CEntityInfo& info, CScriptActorRotate::CScriptActorRotate(TUniqueId uid, const std::string& name, const CEntityInfo& info,
const zeus::CVector3f& rotation, float f1, bool b1, bool b2, bool active) const zeus::CVector3f& rotation, float maxTime, bool updateActors,
bool updateOnCreation, bool active)
: CEntity(uid, info, active, name) : CEntity(uid, info, active, name)
, x34_rotation(rotation) , x34_rotation(rotation)
, x40_maxTime(f1) , x40_maxTime(maxTime)
, x58_24_updateRotation(false) , x58_24_updateRotation(false)
, x58_25_skipSpiderBallWaypoints(false) , x58_25_skipSpiderBallWaypoints(false)
, x58_26_updateActors(b1) , x58_26_updateActors(updateActors)
, x58_27_updateOnCreation(b2) , x58_27_updateOnCreation(updateOnCreation)
{ {
} }

View File

@ -32,7 +32,7 @@ void CScriptCameraPitchVolume::Accept(IVisitor& visitor)
void CScriptCameraPitchVolume::Think(float, CStateManager& mgr) void CScriptCameraPitchVolume::Think(float, CStateManager& mgr)
{ {
if (!x30_24_active) if (!GetActive())
return; return;
if (x13c_24_entered && !x13c_25_occupied) if (x13c_24_entered && !x13c_25_occupied)

View File

@ -6,9 +6,11 @@ namespace urde
{ {
CScriptCameraWaypoint::CScriptCameraWaypoint(TUniqueId uid, const std::string& name, const CEntityInfo& info, CScriptCameraWaypoint::CScriptCameraWaypoint(TUniqueId uid, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, bool active, float, u32) const zeus::CTransform& xf, bool active, float f1, u32 w1)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Unknown), : CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Unknown),
CActorParameters::None(), kInvalidUniqueId) CActorParameters::None(), kInvalidUniqueId)
, xe8_(f1)
, xec_(w1)
{ {
} }
@ -18,4 +20,11 @@ void CScriptCameraWaypoint::Accept(IVisitor& visitor)
visitor.Visit(this); visitor.Visit(this);
} }
void CScriptCameraWaypoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
{
CActor::AcceptScriptMsg(msg, uid, mgr);
if (!GetActive() && msg == EScriptObjectMessage::Arrived)
SendScriptMsgs(EScriptObjectState::Arrived, mgr, EScriptObjectMessage::None);
}
} }

View File

@ -8,11 +8,16 @@ namespace urde
class CScriptCameraWaypoint : public CActor class CScriptCameraWaypoint : public CActor
{ {
float xe8_;
u32 xec_;
public: public:
CScriptCameraWaypoint(TUniqueId uid, const std::string& name, const CEntityInfo& info, CScriptCameraWaypoint(TUniqueId uid, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, bool active, float, u32); const zeus::CTransform& xf, bool active, float, u32);
void Accept(IVisitor& visitor); void Accept(IVisitor& visitor);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const {}
void Render(const CStateManager&) const {}
}; };
} }

View File

@ -6,11 +6,12 @@
namespace urde namespace urde
{ {
CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, const std::string& name, const CEntityInfo& info, bool b1, bool b2, bool b3) CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, const std::string& name, const CEntityInfo& info, bool b1,
bool skipSendActive, bool ignoreMessages)
: CEntity(uid, info, true, name), : CEntity(uid, info, true, name),
x34_24_(b1), x34_24_(b1),
x34_25_skipSendActive(b2), x34_25_skipSendActive(skipSendActive),
x34_26_ignoreMessages(b3) x34_26_ignoreMessages(ignoreMessages)
{ {
} }

View File

@ -72,6 +72,7 @@ public:
const std::vector<SRiders>& GetX328() const { return x328_; } const std::vector<SRiders>& GetX328() const { return x328_; }
std::vector<SRiders>& GetX338() { return x338_; } std::vector<SRiders>& GetX338() { return x338_; }
const std::vector<SRiders>& GetX338() const { return x338_; } const std::vector<SRiders>& GetX338() const { return x338_; }
void AddSlave(TUniqueId, CStateManager&) {}
}; };
} }

View File

@ -12,7 +12,7 @@ bool CScriptSound::sFirstInFrame = false;
CScriptSound::CScriptSound(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf, CScriptSound::CScriptSound(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
s16 soundId, bool active, float f1, float f2, float f3, u32 w1, u32 w2, u32 w3, u32 w4, s16 soundId, bool active, float f1, float f2, float f3, u32 w1, u32 w2, u32 w3, u32 w4,
u32 w5, u32 w6, bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7, u32 w7) u32 w5, u32 w6, bool b1, bool b2, bool autoStart, bool b4, bool b5, bool b6, bool b7, u32 w7)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Unknown), : CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Unknown),
CActorParameters::None(), kInvalidUniqueId) CActorParameters::None(), kInvalidUniqueId)
, xfc_(f3) , xfc_(f3)
@ -29,7 +29,7 @@ CScriptSound::CScriptSound(TUniqueId uid, const std::string& name, const CEntity
{ {
x11c_25_ = b1; x11c_25_ = b1;
x11c_26_ = b2; x11c_26_ = b2;
x11c_27_ = b3; x11c_27_autoStart = autoStart;
x11c_28_ = b4; x11c_28_ = b4;
x11c_29_ = b5; x11c_29_ = b5;
x11c_30_ = b6; x11c_30_ = b6;
@ -59,37 +59,52 @@ void CScriptSound::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta
{ {
case EScriptObjectMessage::Registered: case EScriptObjectMessage::Registered:
{ {
if (GetActive() && x11c_27_autoStart)
x11c_24_ = true;
x11c_31_ = mgr.GetIsGeneratingObject();
} }
break; break;
case EScriptObjectMessage::Play: case EScriptObjectMessage::Play:
{ {
if (GetActive())
PlaySound(mgr);
} }
break; break;
case EScriptObjectMessage::Stop: case EScriptObjectMessage::Stop:
{ {
if (GetActive())
StopSound(mgr);
} }
break; break;
case EScriptObjectMessage::Deactivate: case EScriptObjectMessage::Deactivate:
{ {
if (GetActive())
StopSound(mgr);
} }
break; break;
case EScriptObjectMessage::Activate: case EScriptObjectMessage::Activate:
{ {
if(GetActive())
x11c_24_ = true;
} }
break; break;
case EScriptObjectMessage::Deleted: case EScriptObjectMessage::Deleted:
{ {
if (!x11c_30_)
StopSound(mgr);
} }
break; break;
default:break; default:break;
} }
} }
void CScriptSound::PlaySound(CStateManager&) {} void CScriptSound::PlaySound(CStateManager&)
{
}
void CScriptSound::StopSound(CStateManager& mgr) void CScriptSound::StopSound(CStateManager& mgr)
{ {
x11c_24_playing = false; x11c_24_ = false;
if (x11c_30_ && x11c_26_) if (x11c_30_ && x11c_26_)
{ {
mgr.WorldNC()->StopSound(x100_soundId); mgr.WorldNC()->StopSound(x100_soundId);

View File

@ -30,10 +30,10 @@ class CScriptSound : public CActor
{ {
struct struct
{ {
bool x11c_24_playing : 1; bool x11c_24_ : 1;
bool x11c_25_ : 1; bool x11c_25_ : 1;
bool x11c_26_ : 1; bool x11c_26_ : 1;
bool x11c_27_ : 1; bool x11c_27_autoStart : 1;
bool x11c_28_ : 1; bool x11c_28_ : 1;
bool x11c_29_ : 1; bool x11c_29_ : 1;
bool x11c_30_ : 1; bool x11c_30_ : 1;

View File

@ -12,15 +12,15 @@ namespace urde
CScriptSpecialFunction::CScriptSpecialFunction(TUniqueId uid, const std::string& name, const CEntityInfo& info, CScriptSpecialFunction::CScriptSpecialFunction(TUniqueId uid, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, ESpecialFunction func, const zeus::CTransform& xf, ESpecialFunction func,
const std::string& lcName, float radius, float f2, float f3, float f4, const std::string& lcName, float f1, float f2, float f3, float f4,
const zeus::CVector3f& vec, const zeus::CColor& col, bool active, const zeus::CVector3f& vec, const zeus::CColor& col, bool active,
const CDamageInfo& dInfo, CAssetId aId1, CAssetId aId2, CAssetId aId3, s16 sId1, const CDamageInfo& dInfo, CAssetId aId1, CAssetId aId2, CAssetId aId3,
s16 sId2, s16 sId3) s16 sId1, s16 sId2, s16 sId3)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(), CActorParameters::None(), : CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(), CActorParameters::None(),
kInvalidUniqueId) kInvalidUniqueId)
, xe8_function(func) , xe8_function(func)
, xec_locatorName(lcName) , xec_locatorName(lcName)
, xfc_radius(radius) , xfc_(f1)
, x100_(f2) , x100_(f2)
, x104_(f3) , x104_(f3)
, x108_(f4) , x108_(f4)
@ -39,35 +39,19 @@ CScriptSpecialFunction::CScriptSpecialFunction(TUniqueId uid, const std::string&
x1c8_ = {{zeus::CVector3f(-1.f), zeus::CVector3f(1.f)}}; x1c8_ = {{zeus::CVector3f(-1.f), zeus::CVector3f(1.f)}};
} }
void CScriptSpecialFunction::Accept(IVisitor& visitor) void CScriptSpecialFunction::Accept(IVisitor& visitor) { visitor.Visit(this); }
void CScriptSpecialFunction::Think(float, CStateManager&) {}
void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
{ {
visitor.Visit(this);
} }
void CScriptSpecialFunction::Think(float, CStateManager &) void CScriptSpecialFunction::PreRender(CStateManager&, const zeus::CFrustum&) {}
{
} void CScriptSpecialFunction::AddToRenderer(const zeus::CFrustum&, const CStateManager&) const {}
void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager &) void CScriptSpecialFunction::Render(const CStateManager&) const {}
{
}
void CScriptSpecialFunction::PreRender(CStateManager &, const zeus::CFrustum &)
{
}
void CScriptSpecialFunction::AddToRenderer(const zeus::CFrustum &, const CStateManager &) const
{
}
void CScriptSpecialFunction::Render(const CStateManager &) const
{
}
void CScriptSpecialFunction::SkipCinematic(CStateManager& stateMgr) void CScriptSpecialFunction::SkipCinematic(CStateManager& stateMgr)
{ {
@ -75,9 +59,46 @@ void CScriptSpecialFunction::SkipCinematic(CStateManager& stateMgr)
stateMgr.SetSkipCinematicSpecialFunction(kInvalidUniqueId); stateMgr.SetSkipCinematicSpecialFunction(kInvalidUniqueId);
} }
void CScriptSpecialFunction::ThinkActorScale(float dt, CStateManager& mgr)
{
float deltaScale = dt * xfc_;
for (const SConnection& conn : x20_conns)
{
if (conn.x0_state != EScriptObjectState::Play || conn.x4_msg != EScriptObjectMessage::Activate)
continue;
if (TCastToPtr<CActor> act = mgr.ObjectById(mgr.GetIdForScript(conn.x8_objId)))
{
CModelData* mData = act->ModelData();
if (mData && (mData->HasAnimData() || mData->HasNormalModel()))
{
zeus::CVector3f scale = mData->GetScale();
if (deltaScale > 0.f)
scale = zeus::min(deltaScale + scale, {x100_});
else
scale = zeus::max(deltaScale + scale, {x100_});
mData->SetScale(scale);
}
}
}
}
void CScriptSpecialFunction::ThinkSaveStation(float, CStateManager& mgr)
{
if (x1e5_24_doSave && mgr.GetDeferredStateTransition() != EStateManagerTransition::SaveGame)
{
x1e5_24_doSave = false;
if (mgr.GetInSaveUI())
SendScriptMsgs(EScriptObjectState::MaxReached, mgr, EScriptObjectMessage::None);
else
SendScriptMsgs(EScriptObjectState::Zero, mgr, EScriptObjectMessage::None);
}
}
bool CScriptSpecialFunction::ShouldSkipCinematic(CStateManager& stateMgr) const bool CScriptSpecialFunction::ShouldSkipCinematic(CStateManager& stateMgr) const
{ {
return g_GameState->SystemOptions().GetCinematicState(stateMgr.GetWorld()->IGetWorldAssetId(), GetEditorId()); return g_GameState->SystemOptions().GetCinematicState(stateMgr.GetWorld()->IGetWorldAssetId(), GetEditorId());
} }
} }

View File

@ -17,7 +17,7 @@ public:
PlayerFollowLocator = 1, PlayerFollowLocator = 1,
SpinnerController = 2, SpinnerController = 2,
ObjectFollowLocator = 3, ObjectFollowLocator = 3,
Four = 4, ChaffTarget = 4,
InventoryActivator = 5, InventoryActivator = 5,
MapStation = 6, MapStation = 6,
SaveStation = 7, SaveStation = 7,
@ -35,7 +35,7 @@ public:
ObjectFollowObject = 19, ObjectFollowObject = 19,
RedundantHintSystem = 20, RedundantHintSystem = 20,
DropBomb = 21, DropBomb = 21,
TwentyTwo = 22, ScaleActor = 22,
MissileStation = 23, MissileStation = 23,
Billboard = 24, Billboard = 24,
PlayerInAreaRelay = 25, PlayerInAreaRelay = 25,
@ -64,7 +64,7 @@ public:
private: private:
ESpecialFunction xe8_function; ESpecialFunction xe8_function;
std::string xec_locatorName; std::string xec_locatorName;
float xfc_radius; float xfc_;
float x100_; float x100_;
float x104_; float x104_;
float x108_; float x108_;
@ -101,7 +101,7 @@ private:
bool x1e4_26_ : 1; bool x1e4_26_ : 1;
bool x1e4_27_ : 1; bool x1e4_27_ : 1;
bool x1e4_31_ : 1; bool x1e4_31_ : 1;
bool x1e5_24_ : 1; bool x1e5_24_doSave : 1;
bool x1e5_25_ : 1; bool x1e5_25_ : 1;
bool x1e5_26_ : 1; bool x1e5_26_ : 1;
}; };
@ -130,6 +130,8 @@ public:
void ThinkSpinnerController(float, CStateManager&, ESpinnerControllerMode); void ThinkSpinnerController(float, CStateManager&, ESpinnerControllerMode);
void ThinkObjectFollowLocator(float, CStateManager&); void ThinkObjectFollowLocator(float, CStateManager&);
void ThinkChaffTarget(float, CStateManager&); void ThinkChaffTarget(float, CStateManager&);
void ThinkActorScale(float, CStateManager&);
void ThinkSaveStation(float, CStateManager&);
bool ShouldSkipCinematic(CStateManager& stateMgr) const; bool ShouldSkipCinematic(CStateManager& stateMgr) const;
}; };

View File

@ -25,7 +25,7 @@ void CScriptSpiderBallWaypoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqu
if (msg == EScriptObjectMessage::InitializedInArea) if (msg == EScriptObjectMessage::InitializedInArea)
BuildWaypointListAndBounds(mgr); BuildWaypointListAndBounds(mgr);
else if (msg == EScriptObjectMessage::UNKM2) else if (msg == EScriptObjectMessage::Arrived)
SendScriptMsgs(EScriptObjectState::Arrived, mgr, EScriptObjectMessage::None); SendScriptMsgs(EScriptObjectState::Arrived, mgr, EScriptObjectMessage::None);
} }

View File

@ -1,82 +1,82 @@
#include "ScriptLoader.hpp" #include "ScriptLoader.hpp"
#include "CStateManager.hpp"
#include "CGrappleParameters.hpp"
#include "CActorParameters.hpp" #include "CActorParameters.hpp"
#include "CVisorParameters.hpp"
#include "CScannableParameters.hpp"
#include "CLightParameters.hpp"
#include "CAnimationParameters.hpp" #include "CAnimationParameters.hpp"
#include "CFluidUVMotion.hpp"
#include "GameGlobalObjects.hpp"
#include "CWorld.hpp"
#include "Particle/CWeaponDescription.hpp"
#include "CDamageInfo.hpp" #include "CDamageInfo.hpp"
#include "CFluidUVMotion.hpp"
#include "CGrappleParameters.hpp"
#include "CLightParameters.hpp"
#include "CPatternedInfo.hpp"
#include "CRepulsor.hpp"
#include "CScannableParameters.hpp"
#include "CScriptActor.hpp" #include "CScriptActor.hpp"
#include "CScriptWaypoint.hpp"
#include "CScriptDoor.hpp"
#include "CScriptTrigger.hpp"
#include "CScriptTimer.hpp"
#include "CScriptCounter.hpp"
#include "CScriptDock.hpp"
#include "CScriptActorKeyframe.hpp" #include "CScriptActorKeyframe.hpp"
#include "CScriptWater.hpp" #include "CScriptActorRotate.hpp"
#include "CScriptEffect.hpp" #include "CScriptAiJumpPoint.hpp"
#include "CScriptPlatform.hpp"
#include "CScriptSound.hpp"
#include "CScriptGenerator.hpp"
#include "CScriptGrapplePoint.hpp"
#include "CScriptPickupGenerator.hpp"
#include "CScriptPointOfInterest.hpp"
#include "CScriptPlayerActor.hpp"
#include "CScriptAreaAttributes.hpp" #include "CScriptAreaAttributes.hpp"
#include "CScriptCameraWaypoint.hpp" #include "CScriptBeam.hpp"
#include "CScriptCoverPoint.hpp"
#include "CScriptSpawnPoint.hpp"
#include "CScriptCameraHint.hpp"
#include "CScriptPickup.hpp"
#include "CScriptMemoryRelay.hpp"
#include "CScriptRandomRelay.hpp"
#include "CScriptRelay.hpp"
#include "CScriptHUDMemo.hpp"
#include "CScriptCameraFilterKeyframe.hpp"
#include "CScriptCameraBlurKeyframe.hpp" #include "CScriptCameraBlurKeyframe.hpp"
#include "CScriptCameraFilterKeyframe.hpp"
#include "CScriptCameraHint.hpp"
#include "CScriptCameraHintTrigger.hpp"
#include "CScriptCameraPitchVolume.hpp"
#include "CScriptCameraShaker.hpp"
#include "CScriptCameraWaypoint.hpp"
#include "CScriptColorModulate.hpp"
#include "CScriptControllerAction.hpp"
#include "CScriptCounter.hpp"
#include "CScriptCoverPoint.hpp"
#include "CScriptDamageableTrigger.hpp" #include "CScriptDamageableTrigger.hpp"
#include "CScriptDebris.hpp" #include "CScriptDebris.hpp"
#include "CScriptSteam.hpp"
#include "CScriptDistanceFog.hpp" #include "CScriptDistanceFog.hpp"
#include "CScriptDock.hpp"
#include "CScriptDockAreaChange.hpp" #include "CScriptDockAreaChange.hpp"
#include "CScriptActorRotate.hpp" #include "CScriptDoor.hpp"
#include "CScriptSpecialFunction.hpp" #include "CScriptEffect.hpp"
#include "CScriptSwitch.hpp" #include "CScriptGenerator.hpp"
#include "CScriptPlayerStateChange.hpp" #include "CScriptGrapplePoint.hpp"
#include "CWallCrawlerSwarm.hpp" #include "CScriptHUDMemo.hpp"
#include "CScriptAiJumpPoint.hpp"
#include "CScriptColorModulate.hpp"
#include "CScriptCameraShaker.hpp"
#include "CRepulsor.hpp"
#include "CScriptCameraPitchVolume.hpp"
#include "CScriptCameraHintTrigger.hpp"
#include "CScriptVisorFlare.hpp"
#include "CScriptWorldTeleporter.hpp"
#include "CScriptBeam.hpp"
#include "CScriptMazeNode.hpp" #include "CScriptMazeNode.hpp"
#include "Camera/CCinematicCamera.hpp" #include "CScriptMemoryRelay.hpp"
#include "MP1/World/CNewIntroBoss.hpp"
#include "MP1/World/CBeetle.hpp"
#include "MP1/World/CWarWasp.hpp"
#include "MP1/World/CSpacePirate.hpp"
#include "MP1/World/CActorContraption.hpp"
#include "CScriptShadowProjector.hpp"
#include "CScriptStreamedMusic.hpp"
#include "CScriptMidi.hpp" #include "CScriptMidi.hpp"
#include "CScriptRoomAcoustics.hpp" #include "CScriptPickup.hpp"
#include "CScriptControllerAction.hpp" #include "CScriptPickupGenerator.hpp"
#include "CScriptPlatform.hpp"
#include "CScriptPlayerActor.hpp"
#include "CScriptPlayerHint.hpp" #include "CScriptPlayerHint.hpp"
#include "MP1/World/CMetroidPrimeRelay.hpp" #include "CScriptPlayerStateChange.hpp"
#include "CPatternedInfo.hpp" #include "CScriptPointOfInterest.hpp"
#include "CScriptRandomRelay.hpp"
#include "CScriptRelay.hpp"
#include "CScriptRoomAcoustics.hpp"
#include "CScriptShadowProjector.hpp"
#include "CScriptSound.hpp"
#include "CScriptSpawnPoint.hpp"
#include "CScriptSpecialFunction.hpp"
#include "CScriptSteam.hpp"
#include "CScriptStreamedMusic.hpp"
#include "CScriptSwitch.hpp"
#include "CScriptTimer.hpp"
#include "CScriptTrigger.hpp"
#include "CScriptVisorFlare.hpp"
#include "CScriptWater.hpp"
#include "CScriptWaypoint.hpp"
#include "CScriptWorldTeleporter.hpp"
#include "CSimplePool.hpp" #include "CSimplePool.hpp"
#include "CStateManager.hpp"
#include "CVisorParameters.hpp"
#include "CWallCrawlerSwarm.hpp"
#include "CWorld.hpp"
#include "Camera/CCinematicCamera.hpp"
#include "Collision/CCollidableOBBTreeGroup.hpp" #include "Collision/CCollidableOBBTreeGroup.hpp"
#include "Editor/ProjectResourceFactoryMP1.hpp" #include "Editor/ProjectResourceFactoryMP1.hpp"
#include "GameGlobalObjects.hpp"
#include "MP1/World/CActorContraption.hpp"
#include "MP1/World/CBeetle.hpp"
#include "MP1/World/CMetroidPrimeRelay.hpp"
#include "MP1/World/CNewIntroBoss.hpp"
#include "MP1/World/CSpacePirate.hpp"
#include "MP1/World/CWarWasp.hpp"
#include "Particle/CWeaponDescription.hpp"
namespace urde namespace urde
{ {
@ -736,27 +736,27 @@ CEntity* ScriptLoader::LoadCamera(CStateManager& mgr, CInputStream& in, int prop
SActorHead head = LoadActorHead(in, mgr); SActorHead head = LoadActorHead(in, mgr);
bool b1 = in.readBool(); bool active = in.readBool();
float f1 = in.readFloatBig(); float shotDuration = in.readFloatBig();
bool b2 = in.readBool(); bool b2 = in.readBool();
bool b3 = in.readBool(); bool b3 = in.readBool();
bool b4 = in.readBool(); bool b4 = in.readBool();
bool b5 = in.readBool(); bool b5 = in.readBool();
bool b6 = in.readBool(); bool b6 = in.readBool();
bool b7 = in.readBool(); bool disableInput = in.readBool();
bool b8 = in.readBool(); bool b8 = in.readBool();
float f2 = in.readFloatBig(); float fov = in.readFloatBig();
bool b9 = in.readBool(); bool b9 = in.readBool();
bool b10 = false; bool b10 = false;
if (propCount > 14) if (propCount > 14)
b10 = in.readBool(); b10 = in.readBool();
u32 flags = u32(b2) | u32(b3) << 1 | u32(b4) << 2 | u32(b5) << 3 | u32(b6) << 4 | u32(b7) << 5 | u32(b8) << 6 | u32 flags = u32(b2) | u32(b3) << 1 | u32(b4) << 2 | u32(b5) << 3 | u32(b6) << 4 | u32(disableInput) << 5 |
u32(b9) << 8; u32(b8) << 6 | u32(b9) << 8;
return new CCinematicCamera(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, b1, f1, return new CCinematicCamera(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, active, shotDuration,
f2 / CCameraManager::Aspect(), CCameraManager::NearPlane(), CCameraManager::FarPlane(), fov / CCameraManager::Aspect(), CCameraManager::NearPlane(), CCameraManager::FarPlane(),
CCameraManager::Aspect(), flags); CCameraManager::Aspect(), flags);
} }
@ -767,11 +767,11 @@ CEntity* ScriptLoader::LoadCameraWaypoint(CStateManager& mgr, CInputStream& in,
SActorHead head = LoadActorHead(in, mgr); SActorHead head = LoadActorHead(in, mgr);
bool b1 = in.readBool(); bool active = in.readBool();
float f1 = in.readFloatBig(); float f1 = in.readFloatBig();
u32 w1 = in.readUint32Big(); u32 w1 = in.readUint32Big();
return new CScriptCameraWaypoint(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, b1, f1, w1); return new CScriptCameraWaypoint(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, active, f1, w1);
} }
CEntity* ScriptLoader::LoadNewIntroBoss(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) CEntity* ScriptLoader::LoadNewIntroBoss(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -1037,8 +1037,8 @@ CEntity* ScriptLoader::LoadCameraFilterKeyframe(CStateManager& mgr, CInputStream
float timeOut = in.readFloatBig(); float timeOut = in.readFloatBig();
CAssetId txtr = in.readUint32Big(); CAssetId txtr = in.readUint32Big();
return new CScriptCameraFilterKeyframe(mgr.AllocateUniqueId(), name, info, type, shape, filterIdx, unk, return new CScriptCameraFilterKeyframe(mgr.AllocateUniqueId(), name, info, type, shape, filterIdx, unk, color,
color, timeIn, timeOut, txtr, active); timeIn, timeOut, txtr, active);
} }
CEntity* ScriptLoader::LoadCameraBlurKeyframe(CStateManager& mgr, CInputStream& in, int propCount, CEntity* ScriptLoader::LoadCameraBlurKeyframe(CStateManager& mgr, CInputStream& in, int propCount,
@ -1055,8 +1055,8 @@ CEntity* ScriptLoader::LoadCameraBlurKeyframe(CStateManager& mgr, CInputStream&
float timeIn = in.readFloatBig(); float timeIn = in.readFloatBig();
float timeOut = in.readFloatBig(); float timeOut = in.readFloatBig();
return new CScriptCameraBlurKeyframe(mgr.AllocateUniqueId(), name, info, type, amount, return new CScriptCameraBlurKeyframe(mgr.AllocateUniqueId(), name, info, type, amount, unk, timeIn, timeOut,
unk, timeIn, timeOut, active); active);
} }
u32 ClassifyVector(const zeus::CVector3f& dir) u32 ClassifyVector(const zeus::CVector3f& dir)
@ -1288,16 +1288,16 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, int propC
if (bumpMap == -1) if (bumpMap == -1)
envMap = _envMap; envMap = _envMap;
return new CScriptWater( return new CScriptWater(mgr, mgr.AllocateUniqueId(), name, info, position, box, dInfo, orientedForce, triggerFlags,
mgr, mgr.AllocateUniqueId(), name, info, position, box, dInfo, orientedForce, triggerFlags, thermalCold, thermalCold, displaySurface, patternMap1, patternMap2, colorMap, bumpMap, envMap,
displaySurface, patternMap1, patternMap2, colorMap, bumpMap, envMap, envBumpMap, {}, bumpLightDir, bumpScale, envBumpMap, {}, bumpLightDir, bumpScale, morphInTime, morphOutTime, active, fluidType, b4,
morphInTime, morphOutTime, active, fluidType, b4, alpha, uvMotion, turbSpeed, turbDistance, turbFreqMax, alpha, uvMotion, turbSpeed, turbDistance, turbFreqMax, turbFreqMin, turbPhaseMax,
turbFreqMin, turbPhaseMax, turbPhaseMin, turbAmplitudeMax, turbAmplitudeMin, splashColor, unkColor, turbPhaseMin, turbAmplitudeMax, turbAmplitudeMin, splashColor, unkColor, splashParticle1,
splashParticle1, splashParticle2, splashParticle3, visorRunoffParticle, unmorphVisorRunoffParticle, splashParticle2, splashParticle3, visorRunoffParticle, unmorphVisorRunoffParticle,
visorRunoffSfx, unmorphVisorRunoffSfx, splashSfx1, splashSfx2, splashSfx3, tileSize, tileSubdivisions, visorRunoffSfx, unmorphVisorRunoffSfx, splashSfx1, splashSfx2, splashSfx3, tileSize,
specularMin, specularMax, reflectionSize, rippleIntensity, reflectionBlend, fogBias, fogMagnitude, fogSpeed, tileSubdivisions, specularMin, specularMax, reflectionSize, rippleIntensity,
fogColor, lightmap, unitsPerLightmapTexel, alphaInTime, alphaOutTime, w21, w22, b5, bitVal0, bitVal1, reflectionBlend, fogBias, fogMagnitude, fogSpeed, fogColor, lightmap, unitsPerLightmapTexel,
std::move(bitset)); alphaInTime, alphaOutTime, w21, w22, b5, bitVal0, bitVal1, std::move(bitset));
} }
CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -1523,11 +1523,11 @@ CEntity* ScriptLoader::LoadActorRotate(CStateManager& mgr, CInputStream& in, int
std::string name = mgr.HashInstanceName(in); std::string name = mgr.HashInstanceName(in);
zeus::CVector3f rotation = zeus::CVector3f::ReadBig(in); zeus::CVector3f rotation = zeus::CVector3f::ReadBig(in);
float scale = in.readFloatBig(); float scale = in.readFloatBig();
bool b1 = in.readBool(); bool updateActors = in.readBool();
bool b2 = in.readBool(); bool b2 = in.readBool();
bool active = in.readBool(); bool active = in.readBool();
return new CScriptActorRotate(mgr.AllocateUniqueId(), name, info, rotation, scale, b1, b2, active); return new CScriptActorRotate(mgr.AllocateUniqueId(), name, info, rotation, scale, updateActors, b2, active);
} }
CEntity* ScriptLoader::LoadSpecialFunction(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) CEntity* ScriptLoader::LoadSpecialFunction(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -1892,9 +1892,9 @@ CEntity* ScriptLoader::LoadWorldTeleporter(CStateManager& mgr, CInputStream& in,
showDelay); showDelay);
return new CScriptWorldTeleporter(mgr.AllocateUniqueId(), name, info, active, worldId, areaId, return new CScriptWorldTeleporter(mgr.AllocateUniqueId(), name, info, active, worldId, areaId,
animParms.GetACSFile(), animParms.GetCharacter(), animParms.GetACSFile(), animParms.GetCharacter(), animParms.GetInitialAnimation(),
animParms.GetInitialAnimation(), playerScale, platformModel, platformScale, playerScale, platformModel, platformScale, backgroundModel, backgroundScale,
backgroundModel, backgroundScale, upElevator, elevatorSound, volume, panning); upElevator, elevatorSound, volume, panning);
} }
CEntity* ScriptLoader::LoadVisorGoo(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) CEntity* ScriptLoader::LoadVisorGoo(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -2156,7 +2156,25 @@ CEntity* ScriptLoader::LoadGunTurret(CStateManager& mgr, CInputStream& in, int p
CEntity* ScriptLoader::LoadFogVolume(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) CEntity* ScriptLoader::LoadFogVolume(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{ {
if (!EnsurePropertyCount(propCount, 7, "FogVolume"))
return nullptr; return nullptr;
std::string name = mgr.HashInstanceName(in);
zeus::CVector3f center = zeus::CVector3f::ReadBig(in);
zeus::CVector3f volume = zeus::CVector3f::ReadBig(in);
float flickerSpeed = in.readFloatBig();
float f2 = in.readFloatBig();
zeus::CColor fogColor = zeus::CColor::ReadRGBABig(in);
bool active = in.readBool();
volume.x = std::fabs(volume.x);
volume.y = std::fabs(volume.y);
volume.z = std::fabs(volume.z);
return new CScriptSpecialFunction(mgr.AllocateUniqueId(), name, info, ConvertEditorEulerToTransform4f(center, {}),
CScriptSpecialFunction::ESpecialFunction::FogVolume, "", flickerSpeed, f2, 0.f,
0.f, volume, fogColor, active, CDamageInfo(), CAssetId(), CAssetId(), CAssetId(),
-1, -1, -1);
} }
CEntity* ScriptLoader::LoadBabygoth(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) CEntity* ScriptLoader::LoadBabygoth(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -2205,7 +2223,18 @@ CEntity* ScriptLoader::LoadCameraPitchVolume(CStateManager& mgr, CInputStream& i
CEntity* ScriptLoader::LoadEnvFxDensityController(CStateManager& mgr, CInputStream& in, int propCount, CEntity* ScriptLoader::LoadEnvFxDensityController(CStateManager& mgr, CInputStream& in, int propCount,
const CEntityInfo& info) const CEntityInfo& info)
{ {
if (!EnsurePropertyCount(propCount, 4, "EnvFxDensityController"))
return nullptr; return nullptr;
std::string name = mgr.HashInstanceName(in);
bool active = in.readBool();
float density = in.readFloatBig();
u32 w1 = in.readUint32Big();
return new CScriptSpecialFunction(mgr.AllocateUniqueId(), name, info, zeus::CTransform::Identity(),
CScriptSpecialFunction::ESpecialFunction::EnvFxDensityController, "", density,
w1, 0.f, 0.f, zeus::CVector3f::skZero, zeus::CColor::skBlack, active,
CDamageInfo(), CAssetId(), CAssetId(), CAssetId(), -1, -1, -1);
} }
CEntity* ScriptLoader::LoadMagdolite(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) CEntity* ScriptLoader::LoadMagdolite(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -2421,9 +2450,9 @@ CEntity* ScriptLoader::LoadMetroidPrimeStage1(CStateManager& mgr, CInputStream&
u32 w5 = in.readUint32Big(); u32 w5 = in.readUint32Big();
MP1::SPrimeExoParameters primeParms(in); MP1::SPrimeExoParameters primeParms(in);
return new MP1::CMetroidPrimeRelay(mgr.AllocateUniqueId(), aHead.x0_name, info, active, return new MP1::CMetroidPrimeRelay(mgr.AllocateUniqueId(), aHead.x0_name, info, active, aHead.x10_transform,
aHead.x10_transform, aHead.x40_scale, std::move(primeParms), aHead.x40_scale, std::move(primeParms), f1, f2, f3, w1, b1, w2, hInfo1, hInfo2,
f1, f2, f3, w1, b1, w2, hInfo1, hInfo2, w3, w4, w5, std::move(roomParms)); w3, w4, w5, std::move(roomParms));
} }
CEntity* ScriptLoader::LoadMazeNode(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) CEntity* ScriptLoader::LoadMazeNode(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)

View File

@ -179,7 +179,7 @@ enum class EScriptObjectMessage
None = -1, None = -1,
UNKM0 = 0, UNKM0 = 0,
Activate = 1, Activate = 1,
UNKM2 = 2, Arrived = 2,
Close = 3, Close = 3,
Deactivate = 4, Deactivate = 4,
Decrement = 5, Decrement = 5,

View File

@ -24,6 +24,3 @@ add_executable(visigen ${PLAT_SRCS}
VISIRenderer.cpp VISIRenderer.hpp VISIRenderer.cpp VISIRenderer.hpp
VISIBuilder.cpp VISIBuilder.hpp) VISIBuilder.cpp VISIBuilder.hpp)
target_link_libraries(visigen logvisor athena-core athena-libyaml zeus glew xxhash ${ZLIB_LIBRARIES} ${LZO_LIB} ${BOO_SYS_LIBS}) target_link_libraries(visigen logvisor athena-core athena-libyaml zeus glew xxhash ${ZLIB_LIBRARIES} ${LZO_LIB} ${BOO_SYS_LIBS})
add_custom_command(TARGET visigen POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:visigen> $<TARGET_FILE_DIR:urde>)