Initial CFlameThrower imps

This commit is contained in:
Phillip Stephens 2019-04-16 01:00:46 -07:00
parent 1f10769af3
commit 28071851ad
9 changed files with 87 additions and 15 deletions

View File

@ -49,7 +49,9 @@ struct CTweakGame final : ITweakGame {
CTweakGame() = default;
CTweakGame(athena::io::IStreamReader& in) {
this->read(in);
#ifdef NDEBUG
x2b_splashScreensDisabled = false;
#endif
}
void initCVars(hecl::CVarManager* mgr);

View File

@ -88,7 +88,7 @@ CGameArchitectureSupport::CGameArchitectureSupport(CMain& parent, boo::IAudioVoi
CStreamAudioManager::SetMusicVolume(0x7f);
m->ResetGameState();
if (false && !g_tweakGame->GetSplashScreensDisabled()) {
if (!g_tweakGame->GetSplashScreensDisabled()) {
std::shared_ptr<CIOWin> splash = std::make_shared<CSplashScreen>(CSplashScreen::ESplashScreen::Nintendo);
x58_ioWinManager.AddIOWin(splash, 1000, 10000);
}

View File

@ -223,6 +223,7 @@ public:
CParticleGen& GetActiveChildParticle(size_t idx) const { return *x290_activePartChildren[idx]; }
bool IsIndirectTextured() const { return x28_loadedGenDesc->x54_x40_TEXR && x28_loadedGenDesc->x58_x44_TIND; }
void SetModelsUseLights(bool v) { x26d_26_modelsUseLights = v; }
void SetZTest(bool z) { x26c_28_zTest = z; }
static void SetMoveRedToAlphaBuffer(bool);
s32 GetMaxParticles() const { return x90_MAXP; }

View File

@ -3,6 +3,6 @@
namespace urde {
CFlameInfo::CFlameInfo(s32 w1, s32 w2, CAssetId flameFxId, s32 w3, float f1, float f2, float f3)
: x0_(w1), x4_(w2), x8_flameFxId(flameFxId), xc_(w3), x10_(f1), x18_(f2), x1c_(f3) {}
: x0_(w1), x4_attributes(w2), x8_flameFxId(flameFxId), xc_length(w3), x10_(f1), x18_(f2), x1c_(f3) {}
} // namespace urde

View File

@ -4,10 +4,11 @@
namespace urde {
class CFlameInfo {
friend class CFlameThrower;
s32 x0_;
s32 x4_;
s32 x4_attributes;
CAssetId x8_flameFxId;
s32 xc_;
s32 xc_length;
float x10_;
float x18_;
float x1c_;
@ -15,8 +16,8 @@ class CFlameInfo {
public:
CFlameInfo(s32, s32, CAssetId, s32, float, float, float);
void GetAttributes() const;
float GetLength() const;
s32 GetAttributes() const { return x4_attributes; }
s32 GetLength() const { return xc_length; }
CAssetId GetFlameFxId() const { return x8_flameFxId; }
};
} // namespace urde

View File

@ -1,21 +1,35 @@
#include "Weapon/CFlameThrower.hpp"
#include "Weapon/CFlameInfo.hpp"
#include "Particle/CElementGen.hpp"
#include "Graphics/CBooRenderer.hpp"
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
#include "TCastTo.hpp"
#include "CFlameThrower.hpp"
namespace urde {
const zeus::CVector3f CFlameThrower::kLightOffset(0, 3.f, 2.f);
CFlameThrower::CFlameThrower(const TToken<CWeaponDescription>& wDesc, std::string_view name, EWeaponType wType,
const CFlameInfo& flameInfo, const zeus::CTransform& xf, EMaterialTypes matType,
const CDamageInfo& dInfo, TUniqueId uid, TAreaId aId, TUniqueId owner,
EProjectileAttrib attribs, CAssetId w2, s16 sId, CAssetId w3)
EProjectileAttrib attribs, CAssetId assetId1, s16 sId, CAssetId assetId2)
: CGameProjectile(false, wDesc, name, wType, xf, matType, dInfo, uid, aId, owner, kInvalidUniqueId, attribs, false,
zeus::CVector3f(1.f), {}, -1, false)
, x2e8_(xf)
, x338_(flameInfo.x10_)
, x33c_flameDesc(g_SimplePool->GetObj({FOURCC('PART'), flameInfo.GetFlameFxId()}))
, x348_flameGen(new CElementGen(x33c_flameDesc)) {}
, x348_flameGen(new CElementGen(x33c_flameDesc))
, x34c_(176.f - float(flameInfo.GetLength()), xf.origin, bool(flameInfo.GetAttributes() & 0x4))
, x3f4_(assetId1)
, x3f8_(sId)
, x3fc_(assetId2)
, x400_24_(false)
, x400_25_(false)
, x400_26_(!(flameInfo.GetAttributes() & 1))
, x400_27_((flameInfo.GetAttributes() & 0x2) != 0) {
}
void CFlameThrower::Accept(IVisitor& visitor) { visitor.Visit(this); }
@ -23,5 +37,26 @@ void CFlameThrower::SetTransform(const zeus::CTransform& xf, float) { x2e8_ = xf
void CFlameThrower::Reset(CStateManager&, bool) {}
void CFlameThrower::Fire(const zeus::CTransform&, CStateManager&, bool) {}
void CFlameThrower::Fire(const zeus::CTransform&, CStateManager& mgr, bool) {
SetActive(true);
x400_25_ = true;
x400_24_ = true;
x3f0_ = 1;
CreateFlameParticles(mgr);
}
void CFlameThrower::CreateFlameParticles(CStateManager& mgr) {
DeleteProjectileLight(mgr);
x348_flameGen.reset(new CElementGen(x33c_flameDesc));
x348_flameGen->SetParticleEmission(true);
x348_flameGen->SetZTest(x400_27_);
x348_flameGen->AddModifier(&x34c_);
if (x348_flameGen->SystemHasLight() && x2c8_projectileLight == kInvalidUniqueId)
CreateProjectileLight("FlameThrower_Light"sv, x348_flameGen->GetLight(), mgr);
}
void CFlameThrower::AddToRenderer(const zeus::CFrustum&, const CStateManager& mgr) const {
g_Renderer->AddParticleGen(*x348_flameGen);
EnsureRendered(mgr, x2e8_.origin, GetRenderBounds());
}
} // namespace urde

View File

@ -1,6 +1,7 @@
#pragma once
#include "Weapon/CGameProjectile.hpp"
#include "Particle/CFlameWarp.hpp"
namespace urde {
class CFlameInfo;
@ -9,16 +10,29 @@ class CFlameThrower : public CGameProjectile {
static const zeus::CVector3f kLightOffset;
zeus::CTransform x2e8_;
zeus::CAABox x318_ = zeus::skNullBox;
float x32c_ = 0.f;
float x330_ = 0.f;
float x334_ = 0.f;
float x338_;
TToken<CGenDescription> x33c_flameDesc;
std::unique_ptr<CElementGen> x348_flameGen;
CFlameWarp x34c_;
u32 x3f0_;
CAssetId x3f4_;
s16 x3f8_;
CAssetId x3fc_;
union {
struct {
bool x400_25 : 1;
bool x400_24_ : 1;
bool x400_25_ : 1;
bool x400_26_ : 1;
bool x400_27_ : 1;
};
u32 _dummy = 0;
};
void CreateFlameParticles(CStateManager&);
public:
CFlameThrower(const TToken<CWeaponDescription>& wDesc, std::string_view name, EWeaponType wType,
const CFlameInfo& flameInfo, const zeus::CTransform& xf, EMaterialTypes matType,
@ -26,9 +40,10 @@ public:
CAssetId w2, s16 sId, CAssetId w3);
void Accept(IVisitor& visitor);
void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const;
void SetTransform(const zeus::CTransform& xf, float);
void Reset(CStateManager&, bool);
void Fire(const zeus::CTransform&, CStateManager&, bool);
bool GetX400_25() const { return x400_25; }
bool GetX400_25() const { return x400_25_; }
};
} // namespace urde

View File

@ -542,10 +542,28 @@ void CScriptSpecialFunction::ThinkIntroBossRingController(float dt, CStateManage
}
}
void CScriptSpecialFunction::ThinkPlayerFollowLocator(float, CStateManager&) {}
void CScriptSpecialFunction::ThinkPlayerFollowLocator(float, CStateManager& mgr) {
for (const SConnection& conn : GetConnectionList()) {
if (conn.x0_state == EScriptObjectState::Play && conn.x4_msg == EScriptObjectMessage::Activate) {
auto search = mgr.GetIdListForScript(conn.x8_objId);
for (auto it = search.first; it != search.second; ++it) {
if (TCastToConstPtr<CActor> act = mgr.GetObjectById(it->second)) {
zeus::CTransform xf = act->GetTransform() * act->GetLocatorTransform(xec_locatorName);
CPlayer& pl = mgr.GetPlayer();
pl.SetTransform(xf);
pl.SetVelocityWR({});
pl.SetAngularVelocityWR({});
pl.ClearForcesAndTorques();
return;
}
}
}
}
}
void CScriptSpecialFunction::ThinkSpinnerController(float, CStateManager&,
CScriptSpecialFunction::ESpinnerControllerMode) {}
void CScriptSpecialFunction::ThinkSpinnerController(float, CStateManager&, ESpinnerControllerMode) {
}
void CScriptSpecialFunction::ThinkObjectFollowLocator(float, CStateManager& mgr) {
TUniqueId followerAct = kInvalidUniqueId;

View File

@ -18,7 +18,7 @@ CScriptSteam::CScriptSteam(TUniqueId uid, std::string_view name, const CEntityIn
float r3 = (aabb.max.z() < aabb.max.y() ? aabb.max.z() : aabb.max.y());
r3 = (r3 < aabb.max.x() ? r3 : aabb.max.x());
if (f4 - 0.f >= 0.000009999999747378752f)
if (zeus::close_enough(f4, 0.f))
r3 = (r3 < f2 ? r3 : f4);
x164_ = r3;