Merge branch 'master' of ssh://git.axiodl.com:6431/AxioDL/urde

This commit is contained in:
Jack Andersen 2018-05-09 21:25:40 -10:00
commit 3911a2873d
10 changed files with 130 additions and 14 deletions

View File

@ -18,6 +18,8 @@
#include "Graphics/Shaders/CColoredQuadFilter.hpp" #include "Graphics/Shaders/CColoredQuadFilter.hpp"
#include "Graphics/Shaders/CTexturedQuadFilter.hpp" #include "Graphics/Shaders/CTexturedQuadFilter.hpp"
#include "Audio/CStreamAudioManager.hpp" #include "Audio/CStreamAudioManager.hpp"
#include "Runtime/CStateManager.hpp"
#include "Runtime/World/CPlayer.hpp"
#include <cstdio> #include <cstdio>
using YAMLNode = athena::io::YAMLNode; using YAMLNode = athena::io::YAMLNode;
@ -44,11 +46,30 @@ void ViewManager::TestGameView::resized(const boo::SWindowRect& root, const boo:
{ {
specter::View::resized(root, sub); specter::View::resized(root, sub);
urde::CGraphics::SetViewportResolution({sub.size[0], sub.size[1]}); urde::CGraphics::SetViewportResolution({sub.size[0], sub.size[1]});
if (m_debugText)
m_debugText->resized(root, sub);
} }
void ViewManager::TestGameView::draw(boo::IGraphicsCommandQueue* gfxQ) void ViewManager::TestGameView::draw(boo::IGraphicsCommandQueue* gfxQ)
{ {
m_vm.m_projManager.mainDraw(); m_vm.m_projManager.mainDraw();
if (m_debugText && g_StateManager && g_StateManager->Player())
m_debugText->draw(gfxQ);
}
void ViewManager::TestGameView::think()
{
if (!m_debugText)
m_debugText.reset(new specter::MultiLineTextView(m_vm.m_viewResources, *this, m_vm.m_viewResources.m_heading18));
if (m_debugText && g_StateManager && g_StateManager->Player())
{
const CPlayer& pl = g_StateManager->GetPlayer();
zeus::CQuaternion plQ = zeus::CQuaternion(pl.GetTransform().getRotation().buildMatrix3f());
m_debugText->typesetGlyphs(hecl::Format("Player Position: x %f, y %f, z %f\n"
" Quaternion: w %f, x %f, y %f, z %f\n", pl.GetTranslation().x, pl.GetTranslation().y, pl.GetTranslation().z,
plQ.w, plQ.x, plQ.y, plQ.z));
}
} }
specter::View* ViewManager::BuildSpaceViews() specter::View* ViewManager::BuildSpaceViews()
@ -275,6 +296,8 @@ bool ViewManager::proc()
m_rootView->internalThink(); m_rootView->internalThink();
if (m_rootSpace) if (m_rootSpace)
m_rootSpace->think(); m_rootSpace->think();
if (m_testGameView)
m_testGameView->think();
if (m_splash) if (m_splash)
m_splash->think(); m_splash->think();

View File

@ -55,11 +55,13 @@ class ViewManager : public specter::IViewManager
class TestGameView : public specter::View class TestGameView : public specter::View
{ {
ViewManager& m_vm; ViewManager& m_vm;
std::unique_ptr<specter::MultiLineTextView> m_debugText;
public: public:
TestGameView(ViewManager& vm, specter::ViewResources& res, specter::View& parent) TestGameView(ViewManager& vm, specter::ViewResources& res, specter::View& parent)
: View(res, parent), m_vm(vm) {} : View(res, parent), m_vm(vm) {}
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub); void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
void draw(boo::IGraphicsCommandQueue* gfxQ); void draw(boo::IGraphicsCommandQueue* gfxQ);
void think();
void mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mkey) void mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mkey)
{ {

View File

@ -22,13 +22,13 @@ namespace urde
static logvisor::Module Log("CBooRenderer"); static logvisor::Module Log("CBooRenderer");
static rstl::reserved_vector<CDrawable, 512> sDataHolder; static rstl::reserved_vector<CDrawable, 4096> sDataHolder;
static rstl::reserved_vector<rstl::reserved_vector<CDrawable*, 128>, 50> sBucketsHolder; static rstl::reserved_vector<rstl::reserved_vector<CDrawable*, 128>, 50> sBucketsHolder;
static rstl::reserved_vector<CDrawablePlaneObject, 8> sPlaneObjectDataHolder; static rstl::reserved_vector<CDrawablePlaneObject, 8> sPlaneObjectDataHolder;
static rstl::reserved_vector<u16, 8> sPlaneObjectBucketHolder; static rstl::reserved_vector<u16, 8> sPlaneObjectBucketHolder;
rstl::reserved_vector<u16, 50> Buckets::sBucketIndex; rstl::reserved_vector<u16, 50> Buckets::sBucketIndex;
rstl::reserved_vector<CDrawable, 512>* Buckets::sData = nullptr; rstl::reserved_vector<CDrawable, 4096>* Buckets::sData = nullptr;
rstl::reserved_vector<rstl::reserved_vector<CDrawable*, 128>, 50>* Buckets::sBuckets = nullptr; rstl::reserved_vector<rstl::reserved_vector<CDrawable*, 128>, 50>* Buckets::sBuckets = nullptr;
rstl::reserved_vector<CDrawablePlaneObject, 8>* Buckets::sPlaneObjectData = nullptr; rstl::reserved_vector<CDrawablePlaneObject, 8>* Buckets::sPlaneObjectData = nullptr;
rstl::reserved_vector<u16, 8>* Buckets::sPlaneObjectBucket = nullptr; rstl::reserved_vector<u16, 8>* Buckets::sPlaneObjectBucket = nullptr;
@ -283,7 +283,7 @@ void CBooRenderer::RenderBucketItems(CAreaListItem* item)
CBooModel* model = surf->m_parent; CBooModel* model = surf->m_parent;
if (model) if (model)
{ {
//ActivateLightsForModel(item, *model); ActivateLightsForModel(item, *model);
model->DrawSurface(*surf, flags); model->DrawSurface(*surf, flags);
} }
break; break;

View File

@ -32,7 +32,7 @@ class Buckets
friend class CBooRenderer; friend class CBooRenderer;
static rstl::reserved_vector<u16, 50> sBucketIndex; static rstl::reserved_vector<u16, 50> sBucketIndex;
static rstl::reserved_vector<CDrawable, 512>* sData; static rstl::reserved_vector<CDrawable, 4096>* sData;
static rstl::reserved_vector<rstl::reserved_vector<CDrawable*, 128>, 50>* sBuckets; static rstl::reserved_vector<rstl::reserved_vector<CDrawable*, 128>, 50>* sBuckets;
static rstl::reserved_vector<CDrawablePlaneObject, 8>* sPlaneObjectData; static rstl::reserved_vector<CDrawablePlaneObject, 8>* sPlaneObjectData;
static rstl::reserved_vector<u16, 8>* sPlaneObjectBucket; static rstl::reserved_vector<u16, 8>* sPlaneObjectBucket;

View File

@ -696,7 +696,7 @@ void CGameArea::UpdateThermalVisor(float dt)
void CGameArea::UpdateWeaponWorldLighting(float dt) void CGameArea::UpdateWeaponWorldLighting(float dt)
{ {
float newLightingLevel = x12c_postConstructed->x1128_worldLightingLevel; float newLightingLevel = x12c_postConstructed->x1128_worldLightingLevel;
if (x12c_postConstructed->x112c_xraySpeed != 0) if (x12c_postConstructed->x112c_xraySpeed != 0.f)
{ {
float speed = dt * x12c_postConstructed->x112c_xraySpeed; float speed = dt * x12c_postConstructed->x112c_xraySpeed;
if (std::fabs(x12c_postConstructed->x1130_xrayTarget - newLightingLevel) < speed) if (std::fabs(x12c_postConstructed->x1130_xrayTarget - newLightingLevel) < speed)

View File

@ -1,13 +1,22 @@
#include "CScriptHUDMemo.hpp" #include "CScriptHUDMemo.hpp"
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
#include "GuiSys/CStringTable.hpp"
#include "MP1/CSamusHud.hpp"
#include "TCastTo.hpp" #include "TCastTo.hpp"
namespace urde namespace urde
{ {
CScriptHUDMemo::CScriptHUDMemo(TUniqueId uid, std::string_view name, const CEntityInfo& info, const CHUDMemoParms&, CScriptHUDMemo::CScriptHUDMemo(TUniqueId uid, std::string_view name, const CEntityInfo& info,
CScriptHUDMemo::EDisplayType, CAssetId, bool active) const CHUDMemoParms& parms, EDisplayType disp, CAssetId msg, bool active)
: CEntity(uid, info, active, name) : CEntity(uid, info, active, name)
, x34_parms(parms)
, x3c_dispType(disp)
, x40_stringTableId(msg)
{ {
if (msg.IsValid())
x44_stringTable.emplace(g_SimplePool->GetObj({FOURCC('STRG'), msg}));
} }
void CScriptHUDMemo::Accept(IVisitor& visitor) void CScriptHUDMemo::Accept(IVisitor& visitor)
@ -15,4 +24,27 @@ void CScriptHUDMemo::Accept(IVisitor& visitor)
visitor.Visit(this); visitor.Visit(this);
} }
void CScriptHUDMemo::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
{
if (msg == EScriptObjectMessage::SetToZero)
{
if (GetActive())
{
if (x3c_dispType == EDisplayType::MessageBox)
mgr.ShowPausedHUDMemo(x40_stringTableId, x34_parms.GetDisplayTime());
else if (x3c_dispType == EDisplayType::StatusMessage)
{
if (x44_stringTable)
MP1::CSamusHud::DisplayHudMemo((*x44_stringTable)->GetString(0), x34_parms);
else
MP1::CSamusHud::DisplayHudMemo(u"", x34_parms);
}
}
}
else if (msg == EScriptObjectMessage::Deactivate && GetActive() && x3c_dispType == EDisplayType::StatusMessage)
MP1::CSamusHud::DisplayHudMemo(u"", CHUDMemoParms(0.f, false, true, false));
CEntity::AcceptScriptMsg(msg, uid, mgr);
}
} }

View File

@ -3,9 +3,10 @@
#include "CEntity.hpp" #include "CEntity.hpp"
#include "CHUDMemoParms.hpp" #include "CHUDMemoParms.hpp"
#include "CToken.hpp"
namespace urde namespace urde
{ {
class CStringTable;
class CScriptHUDMemo : public CEntity class CScriptHUDMemo : public CEntity
{ {
public: public:
@ -14,13 +15,17 @@ public:
StatusMessage, StatusMessage,
MessageBox, MessageBox,
}; };
CHUDMemoParms x34_parms;
EDisplayType x3c_dispType;
CAssetId x40_stringTableId;
std::experimental::optional<TLockedToken<CStringTable>> x44_stringTable;
private: private:
public: public:
CScriptHUDMemo(TUniqueId, std::string_view, const CEntityInfo&, const CHUDMemoParms&, CScriptHUDMemo(TUniqueId, std::string_view, const CEntityInfo&, const CHUDMemoParms&,
CScriptHUDMemo::EDisplayType, CAssetId, bool); CScriptHUDMemo::EDisplayType, CAssetId, bool);
void Accept(IVisitor& visitor); void Accept(IVisitor& visitor);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
}; };
} }

View File

@ -0,0 +1,28 @@
#include "CTeamAiMgr.hpp"
#include "TCastTo.hpp"
namespace urde
{
CTeamAiData::CTeamAiData(CInputStream& in, s32 propCount)
: x0_(in.readUint32Big())
, x4_(in.readUint32Big())
, x8_(in.readUint32Big())
, xc_(in.readUint32Big())
, x10_(in.readUint32Big())
, x14_(in.readUint32Big())
, x18_(in.readUint32Big())
, x1c_(propCount > 8 ? in.readFloatBig() : 0.f)
, x20_(propCount > 8 ? in.readFloatBig() : 0.f)
{
}
CTeamAiMgr::CTeamAiMgr(TUniqueId uid, std::string_view name, const CEntityInfo& info, const CTeamAiData& data)
: CEntity(uid, info, true, name)
{
}
void CTeamAiMgr::Accept(IVisitor& visitor)
{
visitor.Visit(this);
}
}

View File

@ -1,13 +1,33 @@
#ifndef __URDE_CTEAMAIMGR_HPP__ #ifndef __URDE_CTEAMAIMGR_HPP__
#define __URDE_CTEAMAIMGR_HPP__ #define __URDE_CTEAMAIMGR_HPP__
#include "CEntity.hpp"
namespace urde namespace urde
{ {
class CTeamAiMgr
{
class CTeamAiData
{
u32 x0_;
u32 x4_;
u32 x8_;
u32 xc_;
u32 x10_;
u32 x14_;
u32 x18_;
float x1c_;
float x20_;
public:
CTeamAiData(CInputStream& in, s32 propCount);
};
class CTeamAiMgr : public CEntity
{
public:
CTeamAiMgr(TUniqueId, std::string_view name, const CEntityInfo&, const CTeamAiData& data);
void Accept(IVisitor&);
}; };
} }
#endif // __URDE_CTEAMAIMGR_HPP__ #endif // __URDE_CTEAMAIMGR_HPP__

View File

@ -17,6 +17,7 @@
#include "CScriptCameraHint.hpp" #include "CScriptCameraHint.hpp"
#include "CScriptCameraHintTrigger.hpp" #include "CScriptCameraHintTrigger.hpp"
#include "CScriptCameraPitchVolume.hpp" #include "CScriptCameraPitchVolume.hpp"
#include "CTeamAiMgr.hpp"
#include "CScriptCameraShaker.hpp" #include "CScriptCameraShaker.hpp"
#include "CScriptCameraWaypoint.hpp" #include "CScriptCameraWaypoint.hpp"
#include "CScriptColorModulate.hpp" #include "CScriptColorModulate.hpp"
@ -2440,7 +2441,12 @@ CEntity* ScriptLoader::LoadMagdolite(CStateManager& mgr, CInputStream& in, int p
CEntity* ScriptLoader::LoadTeamAIMgr(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) CEntity* ScriptLoader::LoadTeamAIMgr(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{ {
return nullptr; if (!EnsurePropertyCount(propCount, 8, "TeamAiMgr"))
return nullptr;
std::string_view name = mgr.HashInstanceName(in);
CTeamAiData data(in, propCount);
return new CTeamAiMgr(mgr.AllocateUniqueId(), name, info, data);
} }
CEntity* ScriptLoader::LoadSnakeWeedSwarm(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) CEntity* ScriptLoader::LoadSnakeWeedSwarm(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)