This commit is contained in:
Jack Andersen 2017-01-29 18:16:52 -10:00
commit e276bd3be9
9 changed files with 127 additions and 25 deletions

View File

@ -40,6 +40,7 @@ struct ITweakPlayerGun : ITweak
virtual float GetX30() const = 0; // x30 virtual float GetX30() const = 0; // x30
virtual float GetX34() const = 0; // x34 virtual float GetX34() const = 0; // x34
virtual float GetX38() const = 0; // x38 virtual float GetX38() const = 0; // x38
virtual float GetRichochetDamage(atUint32) const = 0;
}; };
} }

View File

@ -44,8 +44,8 @@ struct CTweakPlayerGun : ITweakPlayerGun
}; };
SWeaponInfo xa8_beams[5]; SWeaponInfo xa8_beams[5];
SComboShotParam x1f0_combos[5]; // Originally rstl::prereserved_vector<SShotParam,5> SComboShotParam x1f0_combos[5]; // Originally rstl::prereserved_vector<SShotParam,5>
Value<float> x280_ricochetData[5]; // Originally rstl::prereserved_vector<float,5> Value<float> x280_ricochetData[6]; // Originally rstl::prereserved_vector<float,5>, extended to 6 to capture
Value<float> unused; // Kept for consistency // PhazonBeam's value
CTweakPlayerGun() = default; CTweakPlayerGun() = default;
CTweakPlayerGun(athena::io::IStreamReader& r) CTweakPlayerGun(athena::io::IStreamReader& r)
{ {
@ -59,6 +59,42 @@ struct CTweakPlayerGun : ITweakPlayerGun
float GetX30() const { return x30_; } float GetX30() const { return x30_; }
float GetX34() const { return x34_; } float GetX34() const { return x34_; }
float GetX38() const { return x38_; } float GetX38() const { return x38_; }
float GetRichochetDamage(atUint32 type) const
{
switch (type)
{
case 0: // Power
return x280_ricochetData[0];
case 1: // Ice
return x280_ricochetData[1];
case 2: // Wave
return x280_ricochetData[2];
case 3: // Plasma
return x280_ricochetData[3];
case 6: // Missile
return x280_ricochetData[4];
case 8: // Phazon
/* Note: In order to return the same value as retail we have to do a bit of a hack
* Retro accidentally forgot to load in PhazonBeam's richochet value, as a result, it loads the
* pointer to CTweakParticle's vtable.
*/
#if MP_v1088
return float(0x803D9CC4);
#else
return x280_ricochetData[5];
#endif
default:
return 1.f;
}
}
SWeaponInfo GetBeamInfo(atInt32 beam) const
{
if (beam < 0 || beam > 5)
return xa8_beams[0];
return xa8_beams[beam];
}
}; };
} }
} }

View File

@ -0,0 +1,26 @@
#include "Camera/CCameraSpline.hpp"
#include "CStateManager.hpp"
#include "World/CScriptCameraWaypoint.hpp"
#include "TCastTo.hpp"
namespace urde
{
CCameraSpline::CCameraSpline(bool b) : x48_(b) {}
void CCameraSpline::CalculateKnots(TUniqueId cameraId, const std::vector<SConnection>& connections, CStateManager& mgr)
{
const SConnection* lastConn = nullptr;
for (const SConnection& conn : connections)
{
if (conn.x0_state == EScriptObjectState::CameraPath && conn.x4_msg == EScriptObjectMessage::Follow)
lastConn = &conn;
}
if (lastConn)
{
TCastToPtr<CScriptCameraWaypoint> waypoint = mgr.ObjectById(mgr.GetIdForScript(lastConn->x8_objId));
//if (waypoint)
}
}
}

View File

@ -0,0 +1,24 @@
#ifndef __URDE_CCAMERASPLINE_HPP__
#define __URDE_CCAMERASPLINE_HPP__
#include "World/CEntityInfo.hpp"
namespace urde
{
class CStateManager;
class CCameraSpline
{
std::vector<zeus::CVector3f> x4_;
std::vector<TUniqueId> x14_;
std::vector<float> x24_;
std::vector<zeus::CVector3f> x34_;
float x44_ = 0.f;
bool x48_ = false;
public:
CCameraSpline(bool);
void CalculateKnots(TUniqueId, const std::vector<SConnection>&, CStateManager&);
void Initialize(TUniqueId, const std::vector<SConnection>&, CStateManager&);
};
}
#endif // __URDE_CCAMERASPLINE_HPP__

View File

@ -6,6 +6,7 @@ set(CAMERA_SOURCES
CPathCamera.hpp CPathCamera.cpp CPathCamera.hpp CPathCamera.cpp
CCinematicCamera.hpp CCinematicCamera.cpp CCinematicCamera.hpp CCinematicCamera.cpp
CCameraShakeData.hpp CCameraShakeData.cpp CCameraShakeData.hpp CCameraShakeData.cpp
CCameraFilter.hpp CCameraFilter.cpp) CCameraFilter.hpp CCameraFilter.cpp
CCameraSpline.hpp CCameraSpline.cpp)
runtime_add_list(Camera CAMERA_SOURCES) runtime_add_list(Camera CAMERA_SOURCES)

View File

@ -3,32 +3,13 @@
#include "RetroTypes.hpp" #include "RetroTypes.hpp"
#include "ScriptObjectSupport.hpp" #include "ScriptObjectSupport.hpp"
#include "CEntityInfo.hpp"
namespace urde namespace urde
{ {
class CStateManager; class CStateManager;
class IVisitor; class IVisitor;
struct SConnection
{
EScriptObjectState x0_state;
EScriptObjectMessage x4_msg;
TEditorId x8_objId;
};
class CEntityInfo
{
TAreaId x0_areaId;
std::vector<SConnection> x4_conns;
TEditorId x14_editorId;
public:
CEntityInfo(TAreaId aid, const std::vector<SConnection>& conns, TEditorId eid = kInvalidEditorId)
: x0_areaId(aid), x4_conns(conns), x14_editorId(eid) {}
TAreaId GetAreaId() const {return x0_areaId;}
std::vector<SConnection> GetConnectionList() const { return x4_conns; }
TEditorId GetEditorId() const { return x14_editorId; }
};
class CEntity class CEntity
{ {
friend class CStateManager; friend class CStateManager;

View File

@ -0,0 +1,32 @@
#ifndef __URDE_CENTITYINFO_HPP__
#define __URDE_CENTITYINFO_HPP__
#include <vector>
#include <string>
#include "RetroTypes.hpp"
#include "World/ScriptObjectSupport.hpp"
namespace urde
{
struct SConnection
{
EScriptObjectState x0_state;
EScriptObjectMessage x4_msg;
TEditorId x8_objId;
};
class CEntityInfo
{
TAreaId x0_areaId;
std::vector<SConnection> x4_conns;
TEditorId x14_editorId;
public:
CEntityInfo(TAreaId aid, const std::vector<SConnection>& conns, TEditorId eid = kInvalidEditorId)
: x0_areaId(aid), x4_conns(conns), x14_editorId(eid) {}
TAreaId GetAreaId() const {return x0_areaId;}
std::vector<SConnection> GetConnectionList() const { return x4_conns; }
TEditorId GetEditorId() const { return x14_editorId; }
};
}
#endif // __URDE_CENTITYINFO_HPP__

View File

@ -108,6 +108,7 @@ set(WORLD_SOURCES
CRippleManager.hpp CRippleManager.cpp CRippleManager.hpp CRippleManager.cpp
CRipple.hpp CRipple.cpp CRipple.hpp CRipple.cpp
CDestroyableRock.hpp CDestroyableRock.cpp CDestroyableRock.hpp CDestroyableRock.cpp
CHUDBillboardEffect.hpp CHUDBillboardEffect.cpp) CHUDBillboardEffect.hpp CHUDBillboardEffect.cpp
CEntityInfo.hpp)
runtime_add_list(World WORLD_SOURCES) runtime_add_list(World WORLD_SOURCES)

@ -1 +1 @@
Subproject commit 408ac735b4741d2d4b27e1cf985c3f69098025be Subproject commit 8ed773d16ff83e5885315db5382d7f8f8517a8b9