CTweakPlayerGun rep (THE FINAL ONE YAY!!!)

This commit is contained in:
Phillip Stephens 2017-01-26 18:58:21 -08:00
parent b103ae3943
commit 933e731817
15 changed files with 178 additions and 47 deletions

View File

@ -3,7 +3,8 @@ make_dnalist(liblist DNACommon
MAPA MAPA
EGMC EGMC
SAVWCommon SAVWCommon
ParticleCommon) ParticleCommon
Tweaks/ITweakPlayerGun)
set(DNACOMMON_SOURCES set(DNACOMMON_SOURCES
DNACommon.hpp DNACommon.cpp DNACommon.hpp DNACommon.cpp
@ -37,7 +38,6 @@ set(DNACOMMON_SOURCES
Tweaks/ITweakParticle.hpp Tweaks/ITweakParticle.hpp
Tweaks/ITweakPlayer.hpp Tweaks/ITweakPlayer.hpp
Tweaks/ITweakPlayerControl.hpp Tweaks/ITweakPlayerControl.hpp
Tweaks/ITweakPlayerGun.hpp
Tweaks/ITweakGunRes.hpp Tweaks/ITweakGunRes.hpp
Tweaks/ITweakPlayerRes.hpp Tweaks/ITweakPlayerRes.hpp
Tweaks/ITweakGui.hpp Tweaks/ITweakGui.hpp

View File

@ -6,17 +6,41 @@
namespace DataSpec namespace DataSpec
{ {
struct SShotParam : BigYAML
{
DECL_YAML
Value<atUint32> weaponType = -1;
Value<float> damage = 0.f;
Value<float> radiusDamage = 0.f;
Value<float> radius = 0.f;
Value<float> knockback = 0.f;
virtual bool Charged() const { return false; }
virtual bool Comboed() const { return false; }
virtual bool InstaKill() const { return false; }
};
struct SComboShotParam : SShotParam
{
DECL_YAML
bool Comboed() const { return true; }
};
struct SChargedShotParam : SShotParam
{
DECL_YAML
bool Charged() const { return true; }
};
struct ITweakPlayerGun : ITweak struct ITweakPlayerGun : ITweak
{ {
virtual float GetSomething1() const=0; // x24 DECL_YAML
virtual float GetSomething2() const=0; // x28 virtual float GetX24() const = 0; // x24
virtual float GetSomething3() const=0; // x2c virtual float GetX28() const = 0; // x28
virtual float GetSomething4() const=0; // x30 virtual float GetX2c() const = 0; // x2c
virtual float GetSomething5() const=0; // x34 virtual float GetX30() const = 0; // x30
virtual float GetSomething6() const=0; // x38 virtual float GetX34() const = 0; // x34
virtual float GetX38() const = 0; // x38
}; };
} }
#endif // __DNACOMMON_ITWEAKPLAYERGUN_HPP__ #endif // __DNACOMMON_ITWEAKPLAYERGUN_HPP__

View File

@ -40,6 +40,7 @@
#include "Tweaks/CTweakBall.hpp" #include "Tweaks/CTweakBall.hpp"
#include "Tweaks/CTweakParticle.hpp" #include "Tweaks/CTweakParticle.hpp"
#include "Tweaks/CTweakGuiColors.hpp" #include "Tweaks/CTweakGuiColors.hpp"
#include "Tweaks/CTweakPlayerGun.hpp"
namespace DataSpec namespace DataSpec
{ {
@ -406,6 +407,8 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
return {ExtractTweak<CTweakParticle>, {_S(".yaml")}}; return {ExtractTweak<CTweakParticle>, {_S(".yaml")}};
if (!name.compare("GuiColors")) if (!name.compare("GuiColors"))
return {ExtractTweak<CTweakGuiColors>, {_S(".yaml")}}; return {ExtractTweak<CTweakGuiColors>, {_S(".yaml")}};
if (!name.compare("PlayerGun"))
return {ExtractTweak<CTweakPlayerGun>, {_S(".yaml")}};
} }
break; break;
} }

View File

@ -58,6 +58,12 @@ struct CTweakBall : public ITweakBall
float x128_ = 40000.f; float x128_ = 40000.f;
float x12c_ = 10000.f; float x12c_ = 10000.f;
float x130_ = 10000.f; float x130_ = 10000.f;
float x134_ = 1000.f;
float x138_ = 10000.f;
float x13c_ = 2000.f;
float x140_ = 2000.f;
float x144_ = 2000.f;
float x148_ = 2000.f;
Value<float> x14c_; Value<float> x14c_;
Value<float> x150_; Value<float> x150_;
Value<float> x158_; Value<float> x158_;
@ -114,7 +120,22 @@ struct CTweakBall : public ITweakBall
Value<float> x234_; Value<float> x234_;
CTweakBall()=default; CTweakBall()=default;
CTweakBall(athena::io::IStreamReader& r) { this->read(r); } CTweakBall(athena::io::IStreamReader& r)
{
this->read(r);
x74_ = zeus::degToRad(x74_);
x90_ = zeus::degToRad(x90_);
x15c_ = zeus::degToRad(x15c_);
x16c_ = zeus::degToRad(x16c_);
x174_ = zeus::degToRad(x174_);
x17c_ = zeus::degToRad(x17c_);
x184_ = zeus::degToRad(x184_);
x188_ = zeus::degToRad(x188_);
x1a8_ = zeus::degToRad(x1a8_);
x1b0_ = zeus::degToRad(x1b0_);
x1b4_ = zeus::degToRad(x1b4_);
x1ec_ = zeus::degToRad(x1ec_);
}
}; };
} }
} }

View File

@ -11,8 +11,55 @@ namespace DNAMP1
struct CTweakPlayerGun : ITweakPlayerGun struct CTweakPlayerGun : ITweakPlayerGun
{ {
DECL_YAML DECL_YAML
}; Value<float> x4_;
Value<float> x8_;
Value<float> xc_;
Value<float> x10_;
Value<float> x14_;
Value<float> x18_;
Value<float> x1c_;
Value<float> x20_;
Value<float> x24_;
Value<float> x28_;
Value<float> x2c_;
Value<float> x30_;
Value<float> x34_;
Value<float> x38_;
Value<float> x3c_;
Value<float> x40_;
Value<float> x44_;
Value<float> x48_;
Value<zeus::CVector3f> x4c_;
Value<zeus::CVector3f> x58_;
Value<zeus::CVector3f> x64_;
SShotParam x70_bomb;
SShotParam x8c_powerBomb;
SShotParam x1d4_missile;
struct SWeaponInfo : BigYAML
{
DECL_YAML
Value<float> x0_coolDown = 0.1f;
SShotParam x4_normal;
SChargedShotParam x20_charged;
};
SWeaponInfo xa8_beams[5];
SComboShotParam x1f0_combos[5]; // Originally rstl::prereserved_vector<SShotParam,5>
Value<float> x280_ricochetData[5]; // Originally rstl::prereserved_vector<float,5>
Value<float> unused; // Kept for consistency
CTweakPlayerGun() = default;
CTweakPlayerGun(athena::io::IStreamReader& r)
{
this->read(r);
x44_ = zeus::degToRad(x44_);
}
float GetX24() const { return x24_; }
float GetX28() const { return x28_; }
float GetX2c() const { return x2c_; }
float GetX30() const { return x30_; }
float GetX34() const { return x34_; }
float GetX38() const { return x38_; }
};
} }
} }

View File

@ -36,6 +36,7 @@
#include "DNAMP1/Tweaks/CTweakBall.hpp" #include "DNAMP1/Tweaks/CTweakBall.hpp"
#include "DNAMP1/Tweaks/CTweakParticle.hpp" #include "DNAMP1/Tweaks/CTweakParticle.hpp"
#include "DNAMP1/Tweaks/CTweakGuiColors.hpp" #include "DNAMP1/Tweaks/CTweakGuiColors.hpp"
#include "DNAMP1/Tweaks/CTweakPlayerGun.hpp"
#include "hecl/ClientProcess.hpp" #include "hecl/ClientProcess.hpp"
@ -393,6 +394,8 @@ struct SpecMP1 : SpecBase
return true; return true;
else if (!strcmp(classType, DNAMP1::CTweakGuiColors::DNAType())) else if (!strcmp(classType, DNAMP1::CTweakGuiColors::DNAType()))
return true; return true;
else if (!strcmp(classType, DNAMP1::CTweakPlayerGun::DNAType()))
return true;
else if (!strcmp(classType, DNAMP1::HINT::DNAType())) else if (!strcmp(classType, DNAMP1::HINT::DNAType()))
return true; return true;
else if (!strcmp(classType, "ATBL")) else if (!strcmp(classType, "ATBL"))
@ -552,7 +555,8 @@ struct SpecMP1 : SpecBase
!strcmp(className, "DataSpec::DNAMP1::CTweakPlayerControl") || !strcmp(className, "DataSpec::DNAMP1::CTweakPlayerControl") ||
!strcmp(className, "DataSpec::DNAMP1::CTweakBall") || !strcmp(className, "DataSpec::DNAMP1::CTweakBall") ||
!strcmp(className, "DataSpec::DNAMP1::CTweakParticle") || !strcmp(className, "DataSpec::DNAMP1::CTweakParticle") ||
!strcmp(className, "DataSpec::DNAMP1::CTweakGuiColors")) !strcmp(className, "DataSpec::DNAMP1::CTweakGuiColors") ||
!strcmp(className, "DataSpec::DNAMP1::CTweakPlayerGun"))
{ {
resTag.type = SBIG('CTWK'); resTag.type = SBIG('CTWK');
return true; return true;
@ -809,6 +813,18 @@ struct SpecMP1 : SpecBase
gColors.read(reader); gColors.read(reader);
WriteTweak(gColors, out); WriteTweak(gColors, out);
} }
else if (!classStr.compare(DNAMP1::CTweakPlayerGun::DNAType()))
{
DNAMP1::CTweakPlayerGun pGun;
pGun.read(reader);
WriteTweak(pGun, out);
}
else if (!classStr.compare(DNAMP1::CTweakPlayerControl::DNAType()))
{
DNAMP1::CTweakPlayerControl pControl;
pControl.read(reader);
WriteTweak(pControl, out);
}
else if (!classStr.compare(DNAMP1::HINT::DNAType())) else if (!classStr.compare(DNAMP1::HINT::DNAType()))
{ {
DNAMP1::HINT::Cook(in, out); DNAMP1::HINT::Cook(in, out);

View File

@ -138,6 +138,7 @@ void CGuiTextSupport::ClearRenderBuffer()
void CGuiTextSupport::CheckAndRebuildTextBuffer() void CGuiTextSupport::CheckAndRebuildTextBuffer()
{ {
#if 0
g_TextExecuteBuf->Clear(); g_TextExecuteBuf->Clear();
g_TextExecuteBuf->x18_textState.x7c_enableWordWrap = x14_props.x0_wordWrap; g_TextExecuteBuf->x18_textState.x7c_enableWordWrap = x14_props.x0_wordWrap;
g_TextExecuteBuf->BeginBlock(0, 0, x34_extentX, x38_extentY, x14_props.xc_direction, g_TextExecuteBuf->BeginBlock(0, 0, x34_extentX, x38_extentY, x14_props.xc_direction,
@ -153,6 +154,7 @@ void CGuiTextSupport::CheckAndRebuildTextBuffer()
g_TextParser->ParseText(*g_TextExecuteBuf, initStr.c_str(), initStr.size()); g_TextParser->ParseText(*g_TextExecuteBuf, initStr.c_str(), initStr.size());
g_TextExecuteBuf->EndBlock(); g_TextExecuteBuf->EndBlock();
#endif
} }
bool CGuiTextSupport::CheckAndRebuildRenderBuffer() bool CGuiTextSupport::CheckAndRebuildRenderBuffer()

View File

@ -17,6 +17,7 @@
#include "DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp"
#include "DataSpec/DNAMP1/Tweaks/CTweakBall.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakBall.hpp"
#include "DataSpec/DNAMP1/Tweaks/CTweakGuiColors.hpp" #include "DataSpec/DNAMP1/Tweaks/CTweakGuiColors.hpp"
#include "DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp"
#include "World/CPlayerCameraBob.hpp" #include "World/CPlayerCameraBob.hpp"
namespace urde namespace urde
@ -62,6 +63,9 @@ void CTweaks::RegisterTweaks()
g_tweakBall = new DataSpec::DNAMP1::CTweakBall(*strm); g_tweakBall = new DataSpec::DNAMP1::CTweakBall(*strm);
/* PlayerGun */ /* PlayerGun */
tag = factory.GetResourceIdByName("PlayerGun");
strm.emplace(factory.LoadResourceSync(*tag).release(), factory.ResourceSize(*tag));
g_tweakPlayerGun = new DataSpec::DNAMP1::CTweakPlayerGun(*strm);
/* Targeting */ /* Targeting */
tag = factory.GetResourceIdByName("Targeting"); tag = factory.GetResourceIdByName("Targeting");

View File

@ -9,12 +9,12 @@ CPlayerGun::CPlayerGun(TUniqueId id)
: x0_lights(8, zeus::CVector3f{-30.f, 0.f, 30.f}, 4, 4, 0, 0, 0, 0.1f), x538_thisId(id), : x0_lights(8, zeus::CVector3f{-30.f, 0.f, 30.f}, 4, 4, 0, 0, 0, 0.1f), x538_thisId(id),
x550_camBob(CPlayerCameraBob::ECameraBobType::One, x550_camBob(CPlayerCameraBob::ECameraBobType::One,
zeus::CVector2f(0.071f, 0.141f), 0.47f), zeus::CVector2f(0.071f, 0.141f), 0.47f),
x678_morph(g_tweakPlayerGun->GetSomething6(), g_tweakPlayerGun->GetSomething5()) x678_morph(g_tweakPlayerGun->GetX38(), g_tweakPlayerGun->GetX34())
{ {
x354_ = g_tweakPlayerGun->GetSomething3(); x354_ = g_tweakPlayerGun->GetX2c();
x358_ = g_tweakPlayerGun->GetSomething4(); x358_ = g_tweakPlayerGun->GetX30();
x668_ = g_tweakPlayerGun->GetSomething1(); x668_ = g_tweakPlayerGun->GetX24();
x66c_ = g_tweakPlayerGun->GetSomething2(); x66c_ = g_tweakPlayerGun->GetX28();
x832_31_ = true; x832_31_ = true;
x833_24_ = true; x833_24_ = true;

View File

@ -1,12 +1,13 @@
#include "CWeaponMode.hpp" #include "CWeaponMode.hpp"
#include "DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp"
namespace urde namespace urde
{ {
CWeaponMode::CWeaponMode(EWeaponType type, bool b1, bool b2, bool b3) CWeaponMode::CWeaponMode(EWeaponType type, bool charged, bool comboed, bool instaKill)
: x0_weaponType(type) : x0_weaponType(type)
, x4_24_(b1) , x4_24_charged(charged)
, x4_25_(b2) , x4_25_comboed(comboed)
, x4_26_instantKill(b3) , x4_26_instantKill(instaKill)
{ {
} }

View File

@ -8,25 +8,18 @@ namespace urde
class CWeaponMode class CWeaponMode
{ {
EWeaponType x0_weaponType = EWeaponType::None; EWeaponType x0_weaponType = EWeaponType::None;
union bool x4_24_charged : 1;
{ bool x4_25_comboed : 1;
struct
{
bool x4_24_ : 1;
bool x4_25_ : 1;
bool x4_26_instantKill : 1; bool x4_26_instantKill : 1;
};
u8 dummy = 0;
};
public: public:
CWeaponMode() = default; CWeaponMode() = default;
CWeaponMode(EWeaponType, bool = false, bool = false, bool instaKill = false); CWeaponMode(EWeaponType, bool charged = false, bool comboed = false, bool instaKill = false);
EWeaponType GetType() const; EWeaponType GetType() const;
bool IsCharged() const; bool IsCharged() const { return x4_24_charged; }
bool IsComboed() const; bool IsComboed() const { return x4_25_comboed; }
bool IsInstantKill() const; bool IsInstantKill() const { return x4_26_instantKill; }
static CWeaponMode Invalid(); static CWeaponMode Invalid();
static CWeaponMode Phazon(); static CWeaponMode Phazon();

View File

@ -2,10 +2,10 @@
#define __URDE_WEAPONCOMMON_HPP__ #define __URDE_WEAPONCOMMON_HPP__
#include "RetroTypes.hpp" #include "RetroTypes.hpp"
#include "DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp"
namespace urde namespace urde
{ {
enum class EWeaponType enum class EWeaponType
{ {
None = -1, None = -1,

View File

@ -1,12 +1,29 @@
#include "CDamageInfo.hpp" #include "CDamageInfo.hpp"
#include "CDamageVulnerability.hpp" #include "CDamageVulnerability.hpp"
#include "DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp"
namespace urde namespace urde
{ {
float CDamageInfo::GetRadiusDamage(const CDamageVulnerability& dVuln) float CDamageInfo::GetRadiusDamage(const CDamageVulnerability& dVuln) { return 0.f; }
CDamageInfo::CDamageInfo(const DataSpec::SShotParam& other)
: x0_weaponMode(CWeaponMode(EWeaponType(other.weaponType), other.Charged(), other.Comboed(), other.InstaKill()))
, x8_damage(other.damage)
, xc_radiusDamage(other.radiusDamage)
, x10_radius(other.radius)
, x14_knockback(other.knockback)
{ {
return 0.f;
} }
CDamageInfo& CDamageInfo::operator=(const DataSpec::SShotParam& other)
{
x0_weaponMode = CWeaponMode(EWeaponType(other.weaponType), other.Charged(), other.Comboed(), other.InstaKill());
x8_damage = other.damage;
xc_radiusDamage = x8_damage;
x10_radius = other.radius;
x14_knockback = other.knockback;
x18_ = false;
return *this;
}
} }

View File

@ -5,9 +5,13 @@
#include "Weapon/CWeaponMgr.hpp" #include "Weapon/CWeaponMgr.hpp"
#include "Weapon/CWeaponMode.hpp" #include "Weapon/CWeaponMode.hpp"
namespace DataSpec
{
struct SShotParam;
}
namespace urde namespace urde
{ {
class CDamageVulnerability; class CDamageVulnerability;
class CDamageInfo class CDamageInfo
{ {
@ -17,6 +21,7 @@ class CDamageInfo
float x10_radius; float x10_radius;
float x14_knockback; float x14_knockback;
bool x18_ = false; bool x18_ = false;
public: public:
CDamageInfo() = default; CDamageInfo() = default;
CDamageInfo(CInputStream& in) CDamageInfo(CInputStream& in)
@ -29,14 +34,13 @@ public:
x14_knockback = in.readFloatBig(); x14_knockback = in.readFloatBig();
} }
CDamageInfo(const CWeaponMode& mode, float damage, float radius, float knockback) CDamageInfo(const CWeaponMode& mode, float damage, float radius, float knockback)
: x0_weaponMode(mode) : x0_weaponMode(mode), x8_damage(damage), xc_radiusDamage(damage), x10_radius(radius), x14_knockback(knockback)
, x8_damage(damage) {
, xc_radiusDamage(damage) }
, x10_radius(radius)
, x14_knockback(knockback)
{}
CDamageInfo(const CDamageInfo& other) = default; CDamageInfo(const CDamageInfo& other) = default;
CDamageInfo(const DataSpec::SShotParam& other);
CDamageInfo& operator=(const DataSpec::SShotParam& other);
const CWeaponMode& GetWeaponMode() const { return x0_weaponMode; } const CWeaponMode& GetWeaponMode() const { return x0_weaponMode; }
float GetRadius() const { return x10_radius; } float GetRadius() const { return x10_radius; }
@ -47,7 +51,6 @@ public:
float GetRadiusDamage() const { return xc_radiusDamage; } float GetRadiusDamage() const { return xc_radiusDamage; }
float GetRadiusDamage(const CDamageVulnerability& dVuln); float GetRadiusDamage(const CDamageVulnerability& dVuln);
}; };
} }
#endif // __URDE_CDAMAGEINFO_HPP__ #endif // __URDE_CDAMAGEINFO_HPP__

View File

@ -92,7 +92,7 @@ set(WORLD_SOURCES
CScannableParameters.hpp CScannableParameters.hpp
CVisorParameters.hpp CVisorParameters.hpp
CAnimationParameters.hpp CAnimationParameters.hpp
CDamageInfo.hpp CDamageInfo.hpp CDamageInfo.cpp
CDamageVulnerability.hpp CDamageVulnerability.hpp
CFluidUVMotion.hpp CFluidUVMotion.cpp CFluidUVMotion.hpp CFluidUVMotion.cpp
CPatternedInfo.hpp CPatternedInfo.cpp CPatternedInfo.hpp CPatternedInfo.cpp