mirror of https://github.com/AxioDL/metaforce.git
More script object imps
This commit is contained in:
parent
bce1df236b
commit
0fa395f9e1
|
@ -1,3 +1,4 @@
|
|||
.directory
|
||||
version.h
|
||||
*.user
|
||||
.DS_Store
|
||||
|
|
|
@ -56,7 +56,7 @@ void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
|
|||
TLockedToken<CTexture> xrayPalette = objStore.GetObj("TXTR_XRayPalette");
|
||||
m_particleView.reset(new ParticleView(*this, m_viewResources, *m_rootView, xrayPalette));
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
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");
|
||||
|
|
|
@ -17,7 +17,7 @@ CGameHintInfo::CGameHint::CGameHint(CInputStream& in, s32 version)
|
|||
, x10_(in.readFloatBig())
|
||||
, x14_fadeInTime(in.readFloatBig())
|
||||
, x18_stringId(in.readUint32Big())
|
||||
, x1c_(3.f * float(version <= 0 ? 1 : in.readUint32Big()))
|
||||
, x1c_time(3.f * float(version <= 0 ? 1 : in.readUint32Big()))
|
||||
{
|
||||
u32 locationCount = in.readUint32Big();
|
||||
x20_locations.reserve(locationCount);
|
||||
|
|
|
@ -24,10 +24,17 @@ public:
|
|||
float x10_;
|
||||
float x14_fadeInTime;
|
||||
ResId x18_stringId;
|
||||
float x1c_;
|
||||
float x1c_time;
|
||||
std::vector<SHintLocation> x20_locations;
|
||||
public:
|
||||
CGameHint(CInputStream&, s32);
|
||||
|
||||
float GetTime() const { return x1c_time; }
|
||||
float GetFadeInTime() const { return x14_fadeInTime; }
|
||||
float GetX10() const { return x10_; }
|
||||
const std::string& GetName() const { return x0_name; }
|
||||
ResId GetStringID() const { return x18_stringId; }
|
||||
const std::vector<SHintLocation>& GetLocations() const { return x20_locations; }
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -158,4 +158,11 @@ void CHintOptions::PutTo(CBitStreamWriter& writer) const
|
|||
}
|
||||
}
|
||||
|
||||
void CHintOptions::SetNextHintTime()
|
||||
{
|
||||
if (x10_nextHintIdx == -1)
|
||||
return;
|
||||
x0_hintStates[x10_nextHintIdx].x4_time = g_MemoryCardSys->GetHints()[x10_nextHintIdx].GetTime();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -127,6 +127,7 @@ public:
|
|||
CHintOptions() = default;
|
||||
CHintOptions(CBitStreamReader& stream);
|
||||
void PutTo(CBitStreamWriter& writer) const;
|
||||
void SetNextHintTime();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -301,6 +301,7 @@ public:
|
|||
const zeus::CAABox& GetAABB() const {return x6c_aabb;}
|
||||
|
||||
const std::vector<Dock> GetDocks() const {return xcc_docks;}
|
||||
Dock* DockNC(s32 dock) { return &xcc_docks[dock]; }
|
||||
|
||||
bool IsPostConstructed() const {return xf0_24_postConstructed;}
|
||||
const CPostConstructed* GetPostConstructed() const {return x12c_postConstructed.get();}
|
||||
|
|
|
@ -59,12 +59,14 @@ set(WORLD_SOURCES
|
|||
CScriptDamageableTrigger.hpp CScriptDamageableTrigger.cpp
|
||||
CScriptDebris.hpp CScriptDebris.cpp
|
||||
CScriptDistanceFog.hpp CScriptDistanceFog.cpp
|
||||
CScriptDockAreaChange.hpp CScriptDockAreaChange.cpp
|
||||
CScriptActorRotate.hpp CScriptActorRotate.cpp
|
||||
CScriptSpecialFunction.hpp CScriptSpecialFunction.cpp
|
||||
CScriptPlayerActor.hpp CScriptPlayerActor.cpp
|
||||
CScriptSwitch.hpp CScriptSwitch.cpp
|
||||
CScriptAiJumpPoint.hpp CScriptAiJumpPoint.cpp
|
||||
CScriptColorModulate.hpp CScriptColorModulate.cpp
|
||||
CRepulsor.hpp CRepulsor.cpp
|
||||
CScriptCameraPitchVolume.hpp CScriptCameraPitchVolume.cpp
|
||||
CScriptCameraHintTrigger.hpp CScriptCameraHintTrigger.cpp
|
||||
CGrappleParameters.hpp
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#include "CRepulsor.hpp"
|
||||
#include "CActorParameters.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
CRepulsor::CRepulsor(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CVector3f& pos, float radius)
|
||||
: CActor(uid, active, name, info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(), CMaterialList(),
|
||||
CActorParameters::None(), kInvalidUniqueId)
|
||||
, xe8_affectRadius(radius)
|
||||
{
|
||||
}
|
||||
|
||||
void CRepulsor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
|
||||
{
|
||||
CActor::AcceptScriptMsg(msg, objId, stateMgr);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __URDE_CREPULSOR_HPP__
|
||||
#define __URDE_CREPULSOR_HPP__
|
||||
|
||||
#include "CActor.hpp"
|
||||
namespace urde
|
||||
{
|
||||
class CRepulsor : public CActor
|
||||
{
|
||||
float xe8_affectRadius;
|
||||
|
||||
public:
|
||||
CRepulsor(TUniqueId, bool, const std::string&, const CEntityInfo&, const zeus::CVector3f&, float);
|
||||
|
||||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||
|
||||
float GetAffectRadius() const { return xe8_affectRadius; }
|
||||
};
|
||||
}
|
||||
#endif // __URDE_CREPULSOR_HPP__
|
|
@ -32,14 +32,14 @@ void CScriptDistanceFog::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId obj
|
|||
{
|
||||
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
||||
|
||||
if (GetAreaId() == kInvalidAreaId || !x30_24_active)
|
||||
if (x4_areaId == kInvalidAreaId || !GetActive())
|
||||
return;
|
||||
|
||||
if (msg == EScriptObjectMessage::InternalMessage13)
|
||||
{
|
||||
if (!x60_explicit)
|
||||
return;
|
||||
CGameArea::CAreaFog* fog = stateMgr.GetWorld()->GetArea(GetAreaId())->AreaFog();
|
||||
CGameArea::CAreaFog* fog = stateMgr.GetWorld()->GetArea(x4_areaId)->AreaFog();
|
||||
if (x34_mode == ERglFogMode::None)
|
||||
fog->DisableFog();
|
||||
else
|
||||
|
@ -50,7 +50,7 @@ void CScriptDistanceFog::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId obj
|
|||
if (!x61_nonZero)
|
||||
return;
|
||||
|
||||
CGameArea::CAreaFog* fog = stateMgr.GetWorld()->GetArea(GetAreaId())->AreaFog();
|
||||
CGameArea::CAreaFog* fog = stateMgr.GetWorld()->GetArea(x4_areaId)->AreaFog();
|
||||
if (x34_mode == ERglFogMode::None)
|
||||
fog->RollFogOut(x48_rangeDelta.x, x44_colorDelta, x38_color);
|
||||
else
|
||||
|
@ -59,13 +59,13 @@ void CScriptDistanceFog::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId obj
|
|||
if (zeus::close_enough(x54_thermalSpeed, 0.f) && !zeus::close_enough(x5c_xraySpeed, 0.f))
|
||||
{
|
||||
CWorld* world = stateMgr.GetWorld();
|
||||
CGameArea* area = world->GetArea(GetAreaId());
|
||||
CGameArea* area = world->GetArea(x4_areaId);
|
||||
area->SetXRaySpeedAndTarget(x5c_xraySpeed, x58_xrayTarget);
|
||||
}
|
||||
else
|
||||
{
|
||||
CWorld* world = stateMgr.GetWorld();
|
||||
CGameArea* area = world->GetArea(GetAreaId());
|
||||
CGameArea* area = world->GetArea(x4_areaId);
|
||||
area->SetThermalSpeedAndTarget(x54_thermalSpeed, x50_thermalTarget);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include "CActorParameters.hpp"
|
||||
#include "Character/CModelData.hpp"
|
||||
#include "Collision/CMaterialList.hpp"
|
||||
#include "CWorld.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -29,4 +31,14 @@ CScriptDock::CScriptDock(TUniqueId uid, const std::string &name, const CEntityIn
|
|||
x268_25_ = b1;
|
||||
x268_26_ = false;
|
||||
}
|
||||
|
||||
void CScriptDock::AreaLoaded(CStateManager & mgr)
|
||||
{
|
||||
SetLoadConnected(mgr, x268_25_);
|
||||
}
|
||||
|
||||
void CScriptDock::SetLoadConnected(CStateManager& mgr, bool loadOther)
|
||||
{
|
||||
IGameArea::Dock* dock = mgr.GetWorld()->GetArea(x260_area)->DockNC(x25c_dock);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,16 @@ public:
|
|||
CScriptDock(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CVector3f position,
|
||||
const zeus::CVector3f& extent, s32, TAreaId, bool active, s32 w1, bool b1);
|
||||
|
||||
TAreaId GetAreaId() const { return x260_area; }
|
||||
s32 GetDockId() const { return x25c_dock; }
|
||||
void SetDockReference(s32) {}
|
||||
void GetDockReference(s32) {}
|
||||
TAreaId GetCurrentConnectedAreaId(const CStateManager&) const;
|
||||
void UpdateAreaActivateFlags(CStateManager&);
|
||||
bool HasPointCrossedDock(const CStateManager&, const zeus::CVector3f&) const;
|
||||
void AreaLoaded(CStateManager&);
|
||||
void AreaUnloaded(CStateManager&);
|
||||
void SetLoadConnected(CStateManager&, bool);
|
||||
};
|
||||
}
|
||||
#endif // __URDE_CSCRIPTDOCK_HPP__
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
#include "CScriptDockAreaChange.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
#include "World/CScriptDock.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
CScriptDockAreaChange::CScriptDockAreaChange(TUniqueId uid, const std::string& name, const CEntityInfo& info, s32 w1,
|
||||
bool active)
|
||||
: CEntity(uid, info, active, name), x34_dockReference(w1)
|
||||
{
|
||||
}
|
||||
|
||||
void CScriptDockAreaChange::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
|
||||
{
|
||||
if (msg == EScriptObjectMessage::Action && GetActive())
|
||||
{
|
||||
for (SConnection conn : x20_conns)
|
||||
{
|
||||
if (conn.x0_state != EScriptObjectState::Play)
|
||||
continue;
|
||||
|
||||
auto search = stateMgr.GetIdListForScript(conn.x8_objId);
|
||||
for (auto it = search.first ; it != search.second ; ++it)
|
||||
{
|
||||
TUniqueId id = it->second;
|
||||
CScriptDock* dock = dynamic_cast<CScriptDock*>(stateMgr.ObjectById(id));
|
||||
if (dock)
|
||||
dock->SetDockReference(x34_dockReference);
|
||||
}
|
||||
}
|
||||
|
||||
SendScriptMsgs(EScriptObjectState::Play, stateMgr, EScriptObjectMessage::None);
|
||||
}
|
||||
|
||||
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef __URDE_CSCRIPTDOCKAREACHANGE_HPP__
|
||||
#define __URDE_CSCRIPTDOCKAREACHANGE_HPP__
|
||||
|
||||
#include "CEntity.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CScriptDockAreaChange : public CEntity
|
||||
{
|
||||
s32 x34_dockReference;
|
||||
public:
|
||||
CScriptDockAreaChange(TUniqueId, const std::string&, const CEntityInfo&, s32, bool);
|
||||
|
||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //__URDE_CSCRIPTDOCKAREACHANGE_HPP__
|
|
@ -1,4 +1,5 @@
|
|||
#include "CScriptGenerator.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -17,9 +18,8 @@ CScriptGenerator::CScriptGenerator(TUniqueId uid, const std::string& name, const
|
|||
|
||||
void CScriptGenerator::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
|
||||
{
|
||||
if (msg == EScriptObjectMessage::SetToZero)
|
||||
if (msg == EScriptObjectMessage::SetToZero && GetActive())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
||||
|
|
|
@ -10,25 +10,24 @@ namespace urde
|
|||
class CScriptGenerator : public CEntity
|
||||
{
|
||||
u32 x34_;
|
||||
union
|
||||
{
|
||||
union {
|
||||
struct
|
||||
{
|
||||
bool x38_24_ : 1;
|
||||
bool x38_25_ : 1;
|
||||
};
|
||||
u8 dummy1 =0;
|
||||
u8 dummy1 = 0;
|
||||
};
|
||||
zeus::CVector3f x3c_;
|
||||
float x48_minScale;
|
||||
float x4c_maxScale;
|
||||
|
||||
public:
|
||||
CScriptGenerator(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||
u32, bool, const zeus::CVector3f&, bool, bool, float, float);
|
||||
CScriptGenerator(TUniqueId uid, const std::string& name, const CEntityInfo& info, u32, bool, const zeus::CVector3f&,
|
||||
bool, bool, float, float);
|
||||
|
||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr);
|
||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CSCRIPTGENERATOR_HPP__
|
||||
|
|
|
@ -42,7 +42,10 @@ s16 IGameArea::Dock::GetOtherDockNumber(s32 other) const
|
|||
|
||||
bool IGameArea::Dock::GetShouldLoadOther(s32 other) const
|
||||
{
|
||||
return false;
|
||||
if (other >= x4_dockReferences.size())
|
||||
return false;
|
||||
|
||||
return false; //return x4_dockReferences[other].GetShouldLoad();
|
||||
}
|
||||
|
||||
void IGameArea::Dock::SetShouldLoadOther(s32 other, bool should)
|
||||
|
|
|
@ -29,14 +29,14 @@ public:
|
|||
SDockReference() = default;
|
||||
};
|
||||
private:
|
||||
u32 x0_ = 0;
|
||||
u32 x0_referenceCount = 0;
|
||||
std::vector<SDockReference> x4_dockReferences;
|
||||
rstl::reserved_vector<zeus::CVector3f, 4> x14_planeVertices;
|
||||
bool x48_;
|
||||
public:
|
||||
|
||||
const rstl::reserved_vector<zeus::CVector3f, 4>& GetPlaneVertices() const {return x14_planeVertices;}
|
||||
u32 GetReferenceCount() const { return x0_; }
|
||||
u32 GetReferenceCount() const { return x0_referenceCount; }
|
||||
const std::vector<SDockReference>& GetDockRefs() const { return x4_dockReferences; }
|
||||
Dock(CInputStream& in, const zeus::CTransform& xf);
|
||||
TAreaId GetConnectedAreaId(s32 other) const;
|
||||
|
|
|
@ -43,11 +43,13 @@
|
|||
#include "CScriptDamageableTrigger.hpp"
|
||||
#include "CScriptDebris.hpp"
|
||||
#include "CScriptDistanceFog.hpp"
|
||||
#include "CScriptDockAreaChange.hpp"
|
||||
#include "CScriptActorRotate.hpp"
|
||||
#include "CScriptSpecialFunction.hpp"
|
||||
#include "CScriptSwitch.hpp"
|
||||
#include "CScriptAiJumpPoint.hpp"
|
||||
#include "CScriptColorModulate.hpp"
|
||||
#include "CRepulsor.hpp"
|
||||
#include "CScriptCameraPitchVolume.hpp"
|
||||
#include "CScriptCameraHintTrigger.hpp"
|
||||
#include "Camera/CCinematicCamera.hpp"
|
||||
|
@ -1486,7 +1488,14 @@ CEntity* ScriptLoader::LoadMetareeAlpha(CStateManager& mgr, CInputStream& in, in
|
|||
|
||||
CEntity* ScriptLoader::LoadDockAreaChange(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
{
|
||||
return nullptr;
|
||||
if (!EnsurePropertyCount(propCount, 3, "DockAreaChange"))
|
||||
return nullptr;
|
||||
|
||||
const std::string* name = mgr.HashInstanceName(in);
|
||||
s32 w1 = in.readInt32Big();
|
||||
bool active = in.readBool();
|
||||
|
||||
return new CScriptDockAreaChange(mgr.AllocateUniqueId(), *name, info, w1, active);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadActorRotate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
|
@ -1792,7 +1801,15 @@ CEntity* ScriptLoader::LoadStreamedAudio(CStateManager& mgr, CInputStream& in, i
|
|||
|
||||
CEntity* ScriptLoader::LoadRepulsor(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
{
|
||||
return nullptr;
|
||||
if (!EnsurePropertyCount(propCount, 4, "Repulsor"))
|
||||
return nullptr;
|
||||
|
||||
const std::string* name = mgr.HashInstanceName(in);
|
||||
zeus::CVector3f center = in.readVec3fBig();
|
||||
bool active = in.readBool();
|
||||
float radius = in.readFloatBig();
|
||||
|
||||
return new CRepulsor(mgr.AllocateUniqueId(), active, *name, info, center, radius);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadGunTurret(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
|
|
Loading…
Reference in New Issue