This commit is contained in:
Jack Andersen 2016-12-22 20:43:26 -10:00
commit 513d283bee
58 changed files with 730 additions and 104 deletions

67
.appveyor.yml Normal file
View File

@ -0,0 +1,67 @@
############################################################################
# URDE appveyor build configuration
############################################################################
clone_depth: 1
os:
- Visual Studio 2015
build:
verbosity: detailed
configuration:
- Debug
install:
############################################################################
# All external dependencies are installed in C:\projects\deps
############################################################################
- mkdir C:\projects\deps
- cd C:\projects\deps
############################################################################
# Install Ninja
############################################################################
- set NINJA_URL="https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip"
- appveyor DownloadFile %NINJA_URL% -FileName ninja.zip
- 7z x ninja.zip -oC:\projects\deps\ninja > nul
- set PATH=C:\projects\deps\ninja;%PATH%
- ninja --version
############################################################################
# Install a recent CMake
############################################################################
- set CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.1-win64-x64.zip"
- appveyor DownloadFile %CMAKE_URL% -FileName cmake.zip
- 7z x cmake.zip -oC:\projects\deps\cmake > nul
- set PATH=C:\projects\deps\cmake\bin;%PATH%
- cmake --version
############################################################################
# Install custom LLVM
############################################################################
- set LLVM_URL="https://www.dropbox.com/s/8vz8ogsxjhhxoi2/LLVM-4.0.0svn-win64-athena.exe?dl=1"
- appveyor DownloadFile %LLVM_URL% -FileName llvm.exe
- llvm.exe /S /D=C:\projects\deps\llvm
- set PATH=C:\projects\deps\llvm\bin;%PATH%
- llvm-config --version
before_build:
- call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
- cd C:\projects\urde
- git submodule update --init --recursive
build_script:
- mkdir build
- cd build
- cmake -GNinja ..
- ninja
notifications:
- provider: Slack
incoming_webhook:
secure: uoO0I0PWyCx0KLjBOG6d17aSVuEEvYztB/UiF8J0LmTb2O735mAdWcuZHTImDFUGZxeI34/qzOB2JKqF+h8dZA5yiprSTkWIookqQjUokAM=
# Uncomment this to debug AppVeyor failures.
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.directory
version.h
*.user
.DS_Store

View File

@ -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");

View File

@ -1,6 +1,8 @@
## URDE
**Status:** Extract Only
[![Build status](https://ci.appveyor.com/api/projects/status/avx3mpu1gd75ju1b?svg=true)](https://ci.appveyor.com/project/jackoalan/urde)
### Download
Precompiled builds of the command-line extraction utility (`hecl`) with embedded dataspec libraries are available at https://github.com/AxioDL/urde/releases. This will give you intermediate dumps of original formats as *blender* and *yaml* representations.
@ -19,7 +21,7 @@ Everything else is much too experimental to make portable/stable release builds
* [CMake 3+](https://cmake.org)
* [Python 3+](https://python.org)
* LLVM development package *(headers and libs)*
* [Specialized Windows Package](https://www.dropbox.com/s/vnxyzltd04xpikr/LLVM-3.9.0-win64-athena.exe?dl=1)
* [Specialized Windows Package](https://www.dropbox.com/s/8vz8ogsxjhhxoi2/LLVM-4.0.0svn-win64-athena.exe?dl=1)
* [OS X Package](http://llvm.org/releases/3.9.0/clang+llvm-3.9.0-x86_64-apple-darwin.tar.xz)
* **[Windows]** [Visual Studio 2015 and Windows SDK](https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx)
* **[OS X]** [Xcode Tools](https://developer.apple.com/xcode/download/)

View File

@ -61,7 +61,7 @@ void CStaticAudioPlayer::DecodeMonoAndMix(s16* bufOut, u32 numSamples,
const std::unique_ptr<u8[]>& buf = x48_buffers[curBuf];
const u8* byte = &buf[cur - curBuf * RSF_BUFFER_SIZE];
for (int i=0; i<remTillLoop; ++i, ++byte)
for (u32 i=0; i<remTillLoop; ++i, ++byte)
{
if (!loopState && cur + i == loopStartCur)
loopState.emplace(state);

View File

@ -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);

View File

@ -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:

View File

@ -200,4 +200,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();
}
}

View File

@ -129,6 +129,7 @@ public:
CHintOptions() = default;
CHintOptions(CBitStreamReader& stream);
void PutTo(CBitStreamWriter& writer) const;
void SetNextHintTime();
};
}

View File

@ -5,6 +5,7 @@
#include "World/CWorld.hpp"
#include "CGameHintInfo.hpp"
#include "CSaveWorld.hpp"
#include "GuiSys/CStringTable.hpp"
#include <vector>
// longest file name string excluding terminating zero

View File

@ -172,7 +172,7 @@ CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>& relayTracker,
x90c_loaderFuncs[int(EScriptObjectType::Seedling)] = ScriptLoader::LoadSeedling;
x90c_loaderFuncs[int(EScriptObjectType::ThermalHeatFader)] = ScriptLoader::LoadThermalHeatFader;
x90c_loaderFuncs[int(EScriptObjectType::Burrower)] = ScriptLoader::LoadBurrower;
x90c_loaderFuncs[int(EScriptObjectType::ScriptBeam)] = ScriptLoader::LoadScriptBeam;
x90c_loaderFuncs[int(EScriptObjectType::ScriptBeam)] = ScriptLoader::LoadBeam;
x90c_loaderFuncs[int(EScriptObjectType::WorldLightFader)] = ScriptLoader::LoadWorldLightFader;
x90c_loaderFuncs[int(EScriptObjectType::MetroidPrimeStage2)] = ScriptLoader::LoadMetroidPrimeStage2;
x90c_loaderFuncs[int(EScriptObjectType::MetroidPrimeStage1)] = ScriptLoader::LoadMetroidPrimeStage1;

View File

@ -23,11 +23,13 @@ enum class EMaterialTypes
Thirten = 13,
Fourteen = 14,
Fifteen = 15,
Eighteen = 18,
Nineteen = 19,
TwentyOne = 21,
ThirtyTwo = 32,
ThirtyThree = 33,
ThirtyFour = 34,
ThirtyFive = 35,
ThirtySeven = 37,
ThirtyEight = 38,
ThirtyNine = 39,

View File

@ -37,7 +37,7 @@ size_t CTexture::ComputeMippedTexelCount()
size_t w = x4_w;
size_t h = x6_h;
size_t ret = w * h;
for (int i=x8_mips ; i>1 ; --i)
for (u32 i=x8_mips ; i>1 ; --i)
{
if (w > 1)
w /= 2;
@ -53,7 +53,7 @@ size_t CTexture::ComputeMippedBlockCountDXT1()
size_t w = x4_w / 4;
size_t h = x6_h / 4;
size_t ret = w * h;
for (int i=x8_mips ; i>1 ; --i)
for (u32 i=x8_mips ; i>1 ; --i)
{
if (w > 1)
w /= 2;
@ -80,7 +80,7 @@ void CTexture::BuildI4FromGCN(CInputStream& in)
int w = x4_w;
int h = x6_h;
RGBA8* targetMip = buf.get();
for (int mip=0 ; mip<x8_mips ; ++mip)
for (u32 mip=0 ; mip<x8_mips ; ++mip)
{
int bwidth = (w + 7) / 8;
int bheight = (h + 7) / 8;
@ -128,7 +128,7 @@ void CTexture::BuildI8FromGCN(CInputStream& in)
int w = x4_w;
int h = x6_h;
RGBA8* targetMip = buf.get();
for (int mip=0 ; mip<x8_mips ; ++mip)
for (u32 mip=0 ; mip<x8_mips ; ++mip)
{
int bwidth = (w + 7) / 8;
int bheight = (h + 3) / 4;
@ -176,7 +176,7 @@ void CTexture::BuildIA4FromGCN(CInputStream& in)
int w = x4_w;
int h = x6_h;
RGBA8* targetMip = buf.get();
for (int mip=0 ; mip<x8_mips ; ++mip)
for (u32 mip=0 ; mip<x8_mips ; ++mip)
{
int bwidth = (w + 7) / 8;
int bheight = (h + 3) / 4;
@ -225,7 +225,7 @@ void CTexture::BuildIA8FromGCN(CInputStream& in)
int w = x4_w;
int h = x6_h;
RGBA8* targetMip = buf.get();
for (int mip=0 ; mip<x8_mips ; ++mip)
for (u32 mip=0 ; mip<x8_mips ; ++mip)
{
int bwidth = (w + 3) / 4;
int bheight = (h + 3) / 4;
@ -339,7 +339,7 @@ void CTexture::BuildC4FromGCN(CInputStream& in)
int w = x4_w;
int h = x6_h;
RGBA8* targetMip = buf.get();
for (int mip=0 ; mip<x8_mips ; ++mip)
for (u32 mip=0 ; mip<x8_mips ; ++mip)
{
int bwidth = (w + 7) / 8;
int bheight = (h + 7) / 8;
@ -383,7 +383,7 @@ void CTexture::BuildC8FromGCN(CInputStream& in)
int w = x4_w;
int h = x6_h;
RGBA8* targetMip = buf.get();
for (int mip=0 ; mip<x8_mips ; ++mip)
for (u32 mip=0 ; mip<x8_mips ; ++mip)
{
int bwidth = (w + 7) / 8;
int bheight = (h + 3) / 4;
@ -431,7 +431,7 @@ void CTexture::BuildRGB565FromGCN(CInputStream& in)
int w = x4_w;
int h = x6_h;
RGBA8* targetMip = buf.get();
for (int mip=0 ; mip<x8_mips ; ++mip)
for (u32 mip=0 ; mip<x8_mips ; ++mip)
{
int bwidth = (w + 3) / 4;
int bheight = (h + 3) / 4;
@ -478,7 +478,7 @@ void CTexture::BuildRGB5A3FromGCN(CInputStream& in)
int w = x4_w;
int h = x6_h;
RGBA8* targetMip = buf.get();
for (int mip=0 ; mip<x8_mips ; ++mip)
for (u32 mip=0 ; mip<x8_mips ; ++mip)
{
int bwidth = (w + 3) / 4;
int bheight = (h + 3) / 4;
@ -535,7 +535,7 @@ void CTexture::BuildRGBA8FromGCN(CInputStream& in)
int w = x4_w;
int h = x6_h;
RGBA8* targetMip = buf.get();
for (int mip=0 ; mip<x8_mips ; ++mip)
for (u32 mip=0 ; mip<x8_mips ; ++mip)
{
int bwidth = (w + 3) / 4;
int bheight = (h + 3) / 4;
@ -599,7 +599,7 @@ void CTexture::BuildDXT1FromGCN(CInputStream& in)
int w = x4_w / 4;
int h = x6_h / 4;
DXT1Block* targetMip = buf.get();
for (int mip=0 ; mip<x8_mips ; ++mip)
for (u32 mip=0 ; mip<x8_mips ; ++mip)
{
int bwidth = (w + 1) / 2;
int bheight = (h + 1) / 2;
@ -618,7 +618,7 @@ void CTexture::BuildDXT1FromGCN(CInputStream& in)
{
target[x].color1 = hecl::SBig(source[x].color1);
target[x].color2 = hecl::SBig(source[x].color2);
for (int i=0 ; i<4 ; ++i)
for (u32 i=0 ; i<4 ; ++i)
{
u8 ind[4];
u8 packed = source[x].lines[i];

View File

@ -76,13 +76,13 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const
}
case EGuiModelDrawFlags::Alpha:
{
CModelFlags flags(4, 0, (xb7_24_depthWrite << 1) | xb6_31_depthTest, moduCol);
CModelFlags flags(4, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol);
model->Draw(flags);
break;
}
case EGuiModelDrawFlags::Additive:
{
CModelFlags flags(3, 0, (xb7_24_depthWrite << 1) | xb6_31_depthTest, moduCol);
CModelFlags flags(3, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol);
model->Draw(flags);
break;
}
@ -93,7 +93,7 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const
flags.m_blendMode = 5;
flags.m_matSetIdx = 0;
flags.m_flags = (xb7_24_depthWrite << 1) | xb6_31_depthTest;
flags.m_flags = (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest);
flags.color = moduCol;
model->Draw(flags);
break;

View File

@ -93,7 +93,7 @@ void CGuiTextSupport::Update(float dt)
{
if (CTextRenderBuffer* buf = GetCurrentLineRenderBuffer())
{
for (int i=0 ; i<buf->GetPrimitiveCount() ; ++i)
for (s32 i=0 ; i<buf->GetPrimitiveCount() ; ++i)
{
float chStartTime = 0.f;
for (const std::pair<float, int>& p : x40_primStartTimes)

View File

@ -72,7 +72,7 @@ void CStringTable::LoadStringTable(CInputStream &in)
std::wstring CStringTable::GetString(s32 str) const
{
if (str < 0 || str >= x0_stringCount)
if (str < 0 || u32(str) >= x0_stringCount)
return L"Invalid";
u32 off = *(reinterpret_cast<u32*>(x4_data.get() + str * 4));

View File

@ -676,7 +676,7 @@ CFrontEndUI::SFusionBonusFrame::SFusionBonusFrame()
bool CFrontEndUI::SFusionBonusFrame::DoUpdateWithSaveUI(float dt, CSaveUI* saveUi)
{
bool flag = (saveUi && saveUi->x10_uiType != CSaveUI::UIType::Sixteen) ? false : true;
bool flag = (saveUi && saveUi->GetUIType() != CSaveUI::UIType::Sixteen) ? false : true;
x10_remTime = std::max(x10_remTime - dt, 0.f);
zeus::CColor geomCol(zeus::CColor::skWhite);
@ -686,6 +686,7 @@ bool CFrontEndUI::SFusionBonusFrame::DoUpdateWithSaveUI(float dt, CSaveUI* saveU
{
}
return false;
}
void CFrontEndUI::SFusionBonusFrame::Draw(CSaveUI* saveUi) const
@ -903,10 +904,10 @@ void CFrontEndUI::Draw() const
auto vidDimensions = xcc_curMoviePtr->GetVideoDimensions();
float aspectRatio = vidDimensions.first / float(vidDimensions.second);
float verticalOff = (CGraphics::g_ViewportResolution.x / aspectRatio - CGraphics::g_ViewportResolution.y) * 0.5f;
xcc_curMoviePtr->SetFrame({0.f, -verticalOff, 0.f},
{CGraphics::g_ViewportResolution.x, verticalOff, 0.f},
{0.f, CGraphics::g_ViewportResolution.y + verticalOff, 0.f},
{CGraphics::g_ViewportResolution.x, CGraphics::g_ViewportResolution.y + verticalOff, 0.f});
xcc_curMoviePtr->SetFrame(zeus::CVector3f(0.f, -verticalOff, 0.f),
zeus::CVector3f(CGraphics::g_ViewportResolution.x, verticalOff, 0.f),
zeus::CVector3f(0.f, CGraphics::g_ViewportResolution.y + verticalOff, 0.f),
zeus::CVector3f(CGraphics::g_ViewportResolution.x, CGraphics::g_ViewportResolution.y + verticalOff, 0.f));
xcc_curMoviePtr->DrawFrame();
}

View File

@ -15,7 +15,7 @@ using EState = CMemoryCardDriver::EState;
CIOWin::EMessageReturn CSaveUI::Update(float dt)
{
return CIOWin::EMessageReturn::Normal;
}
bool CSaveUI::PumpLoad()

View File

@ -19,8 +19,9 @@ class CGuiTableGroup;
namespace MP1
{
struct CSaveUI
class CSaveUI
{
public:
enum class UIType
{
Zero,
@ -56,6 +57,7 @@ struct CSaveUI
}
}
private:
u32 x0_instIdx;
u32 x8_a;
u32 xc_b;
@ -83,6 +85,7 @@ struct CSaveUI
bool x92_ = false;
bool x93_secondaryInst;
public:
static std::unique_ptr<CMemoryCardDriver> ConstructCardDriver(bool flag);
CIOWin::EMessageReturn Update(float dt);
bool PumpLoad();
@ -97,6 +100,7 @@ struct CSaveUI
void StartGame(int idx);
void EraseGame(int idx);
void* GetGameData(int idx) const;
UIType GetUIType() const { return x10_uiType; }
CSaveUI(u32 inst, u32 a, u32 b);
};

View File

@ -14,8 +14,8 @@ class CCEKeyframeEmitter : public CColorElement
u32 x8_unk1;
bool xc_loop;
bool xd_unk2;
u32 x10_loopEnd;
u32 x14_loopStart;
s32 x10_loopEnd;
s32 x14_loopStart;
std::vector<zeus::CColor> x18_keys;
public:
CCEKeyframeEmitter(CInputStream& in);

View File

View File

@ -0,0 +1,53 @@
#ifndef __URDE_CBEAMINFO_HPP__
#define __URDE_CBEAMINFO_HPP__
#include "RetroTypes.hpp"
#include "IOStreams.hpp"
#include "zeus/CColor.hpp"
namespace urde
{
struct CBeamInfo
{
u32 x0_;
u32 x4_;
ResId x8_;
ResId xc_;
ResId x10_;
ResId x14_;
u32 x18_;
float x1c_;
float x20_;
float x24_;
float x28_;
float x2c_;
float x30_;
float x34_;
float x38_;
zeus::CColor x3c_;
zeus::CColor x40_;
CBeamInfo(CInputStream& in)
: x0_(in.readUint32Big())
, x4_(in.readUint32Big())
, x8_(in.readUint32Big())
, xc_(in.readUint32Big())
, x10_(in.readUint32Big())
, x14_(in.readUint32Big())
, x18_(in.readFloatBig())
, x1c_(in.readFloatBig())
, x20_(in.readFloatBig())
, x24_(in.readFloatBig())
, x28_(in.readFloatBig())
, x2c_(in.readFloatBig())
, x30_(in.readFloatBig())
, x34_(in.readFloatBig())
, x38_(in.readFloatBig())
, x3c_(zeus::CColor::ReadRGBABig(in))
, x40_(zeus::CColor::ReadRGBABig(in))
{
}
};
}
#endif // __URDE_CBEAMINFO_HPP__

View File

@ -0,0 +1,38 @@
#include "Weapon/CBeamProjectile.hpp"
namespace urde
{
CBeamProjectile::CBeamProjectile(const TToken<CWeaponDescription>& wDesc, const std::string& name, EWeaponType wType,
const zeus::CTransform& xf, int attribs, float f1, float f2, EMaterialTypes matType,
const CDamageInfo& dInfo, TUniqueId owner, TAreaId aid, TUniqueId uid, u32 w1, bool b1)
: CGameProjectile(false, wDesc, name, wType, xf, matType, dInfo, owner, aid, uid, kInvalidUniqueId, w1, false,
zeus::CVector3f::skOne, {}, -1, false)
{
}
void CBeamProjectile::Think(float, CStateManager &)
{
}
rstl::optional_object<zeus::CAABox> CBeamProjectile::GetTouchBounds() const
{
return {};
}
void CBeamProjectile::Touch(CActor &, CStateManager &)
{
}
void CBeamProjectile::ResetBeam(CStateManager &, bool)
{
}
void CBeamProjectile::UpdateFX(const zeus::CTransform &, float, CStateManager &)
{
}
}

View File

@ -0,0 +1,33 @@
#ifndef __URDE_CBEAMPROJECTILE_HPP__
#define __URDE_CBEAMPROJECTILE_HPP__
#include "Weapon/CGameProjectile.hpp"
namespace urde
{
class CBeamProjectile : public CGameProjectile
{
public:
CBeamProjectile(const TToken<CWeaponDescription>&, const std::string&, EWeaponType, const zeus::CTransform&, int,
float, float, EMaterialTypes, const CDamageInfo&, TUniqueId, TAreaId, TUniqueId, u32, bool);
float GetMaxRadius() const;
zeus::CVector3f GetSurfaceNormal() const;
void GetDamageType() const;
void GetCurrentPos() const;
void PointCache();
void GetPointCache() const;
void CauseDamage(bool);
zeus::CVector3f GetBeamOrigin() const;
void GetInvMaxLength() const;
void GetCurrentLength();
void GetMaxLength();
s32 GetIntMaxLength();
void Think(float, CStateManager&);
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
void Touch(CActor&, CStateManager&);
virtual void ResetBeam(CStateManager&, bool);
virtual void UpdateFX(const zeus::CTransform&, float, CStateManager&);
};
}
#endif // __URDE_CBEAMPROJECTILE_HPP__

View File

@ -0,0 +1,32 @@
#include "Weapon/CGameProjectile.hpp"
namespace urde
{
CGameProjectile::CGameProjectile(bool active, const TToken<CWeaponDescription>&, const std::string& name,
EWeaponType wType, const zeus::CTransform& xf, EMaterialTypes matType,
const CDamageInfo& dInfo, TUniqueId owner, TAreaId aid, TUniqueId uid, TUniqueId,
u32 w1, bool b2, const zeus::CVector3f&,
const rstl::optional_object<TLockedToken<CGenDescription>>&, s16, bool b3)
: CWeapon(owner, aid, uid, active, wType, name, xf,
CMaterialFilter(
CMaterialList(EMaterialTypes::Fifty, matType),
CMaterialList(EMaterialTypes::ThirtyFive, EMaterialTypes::Eighteen, matType, EMaterialTypes::Nineteen),
CMaterialFilter::EFilterType::Three),
CMaterialList(), dInfo, EProjectileAttrib(w1) | GetBeamAttribType(wType), CModelData::CModelDataNull())
{
}
CWeapon::EProjectileAttrib CGameProjectile::GetBeamAttribType(EWeaponType wType)
{
if (wType == EWeaponType::Ice)
return EProjectileAttrib::Ice;
else if (wType == EWeaponType::Wave)
return EProjectileAttrib::Wave;
else if (wType == EWeaponType::Plasma)
return EProjectileAttrib::Plasma;
else if (wType == EWeaponType::Phazon)
return EProjectileAttrib::Phazon;
return EProjectileAttrib::None;
}
}

View File

@ -0,0 +1,26 @@
#ifndef __URDE_CGAMEPROJECTILE_HPP__
#define __URDE_CGAMEPROJECTILE_HPP__
#include "Collision/CMaterialList.hpp"
#include "Weapon/CWeaponMode.hpp"
#include "Weapon/CWeapon.hpp"
#include "World/CDamageInfo.hpp"
#include "RetroTypes.hpp"
#include "CToken.hpp"
namespace urde
{
class CGenDescription;
class CWeaponDescription;
class CGameProjectile : public CWeapon
{
public:
CGameProjectile(bool, const TToken<CWeaponDescription>&, const std::string&, EWeaponType, const zeus::CTransform&,
EMaterialTypes, const CDamageInfo&, TUniqueId, TAreaId, TUniqueId, TUniqueId, u32, bool,
const zeus::CVector3f&, const rstl::optional_object<TLockedToken<CGenDescription>>&, s16, bool);
static EProjectileAttrib GetBeamAttribType(EWeaponType wType);
};
}
#endif // __URDE_CGAMEPROJECTILE_HPP__

View File

@ -1,4 +1,5 @@
set(WEAPON_SOURCES
WeaponCommon.hpp
CWeaponMgr.hpp CWeaponMgr.cpp
CGunController.hpp CGunController.cpp
CGunMotion.hpp CGunMotion.cpp
@ -15,6 +16,11 @@ set(WEAPON_SOURCES
CGSFreeLook.hpp CGSFreeLook.cpp
CGSComboFire.hpp CGSComboFire.cpp
CGSFidget.hpp CGSFidget.cpp
CFidget.hpp CFidget.cpp)
CFidget.hpp CFidget.cpp
CWeapon.hpp CWeapon.cpp
CGameProjectile.hpp CGameProjectile.cpp
CBeamProjectile.hpp CBeamProjectile.cpp
CBeamInfo.hpp CBeamInfo.cpp
CPlasmaProjectile.hpp CPlasmaProjectile.cpp)
runtime_add_list(Weapon WEAPON_SOURCES)

View File

@ -0,0 +1,13 @@
#include "CPlasmaProjectile.hpp"
namespace urde
{
CPlasmaProjectile::CPlasmaProjectile(const TToken<CWeaponDescription>& wDesc, const std::string& name,
EWeaponType wType, const CBeamInfo& bInfo, const zeus::CTransform& xf,
EMaterialTypes matType, const CDamageInfo& dInfo, TUniqueId owner, TAreaId aid,
TUniqueId uid, u32 w1, bool b1, u32 w2)
: CBeamProjectile(wDesc, name, wType, xf, bInfo.x18_, bInfo.x1c_, bInfo.x38_, matType, dInfo, owner, aid, uid, w2, b1)
{
}
}

View File

@ -0,0 +1,19 @@
#ifndef __URDE_CPLASMAPROJECTILE_HPP__
#define __URDE_CPLASMAPROJECTILE_HPP__
#include "Weapon/CBeamProjectile.hpp"
#include "Weapon/CBeamInfo.hpp"
#include "World/CDamageInfo.hpp"
namespace urde
{
class CPlasmaProjectile : public CBeamProjectile
{
public:
CPlasmaProjectile(const TToken<CWeaponDescription>&, const std::string&, EWeaponType, const CBeamInfo&,
const zeus::CTransform&, EMaterialTypes, const CDamageInfo&, TUniqueId, TAreaId, TUniqueId, u32,
bool, u32);
};
}
#endif // __URDE_CPLASMAPROJECTILE_HPP__

View File

@ -0,0 +1,14 @@
#include "CWeapon.hpp"
#include "World/CActorParameters.hpp"
namespace urde
{
CWeapon::CWeapon(TUniqueId uid, TAreaId aid, bool active, TUniqueId, EWeaponType, const std::string& name,
const zeus::CTransform& xf, const CMaterialFilter&, const CMaterialList& mList, const CDamageInfo&,
EProjectileAttrib, CModelData&& mData)
: CActor(uid, active, name, CEntityInfo(aid, CEntity::NullConnectionList), xf, std::move(mData), mList,
CActorParameters::None(), kInvalidUniqueId)
{
}
}

View File

@ -0,0 +1,49 @@
#ifndef __URDE_CWEAPON_HPP__
#define __URDE_CWEAPON_HPP__
#include "World/CActor.hpp"
#include "Weapon/WeaponCommon.hpp"
#include "Collision/CMaterialFilter.hpp"
namespace urde
{
class CWeapon : public CActor
{
public:
enum class EProjectileAttrib
{
None = 0,
Ice = (1 << 3),
Wave = (1 << 4),
Plasma = (1 << 5),
Phazon = (1 << 6)
};
private:
public:
CWeapon(TUniqueId, TAreaId, bool, TUniqueId, EWeaponType, const std::string&, const zeus::CTransform&,
const CMaterialFilter&, const CMaterialList&, const CDamageInfo&, EProjectileAttrib, CModelData&&);
bool HasAttrib(EProjectileAttrib) const;
EProjectileAttrib GetAttribField() const;
const CMaterialFilter& GetFilter() const;
void SetFilter(const CMaterialFilter&);
TUniqueId GetOwnerId() const;
void SetOwnerId(TUniqueId);
EWeaponType GetType() const;
const CDamageInfo& GetDamageInfo() const;
CDamageInfo& DamageInfo();
void SetDamageInfo(const CDamageInfo&);
void Think(float, CStateManager &) {}
void Render(const CStateManager&) const {}
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&, CWeaponMode&,
int)
{
return EWeaponCollisionResponseTypes::Default;
}
void FluidFXThink(EFluidState, CScriptWater&, CStateManager&) {}
};
ENABLE_BITWISE_ENUM(CWeapon::EProjectileAttrib)
}
#endif // __URDE_CWEAPON_HPP__

View File

@ -2,30 +2,11 @@
#define __URDE_CWEAPONMGR_HPP__
#include "RetroTypes.hpp"
#include "WeaponCommon.hpp"
namespace urde
{
enum class EWeaponType
{
None = -1,
Power = 0,
Ice,
Wave,
Plasma,
Bomb,
PowerBomb,
Missile,
BoostBall,
Phazon,
AI,
PoisonWater,
Lava,
Hot,
Unused1,
Unused2
};
class CWeaponMgr
{
std::map<TUniqueId, rstl::reserved_vector<s32, 10>> x0_weapons;

View File

@ -7,6 +7,11 @@ CWeaponMode::CWeaponMode(EWeaponType type, bool, bool)
{
}
EWeaponType CWeaponMode::GetType() const
{
return x0_weaponType;
}
CWeaponMode CWeaponMode::Invalid()
{
return CWeaponMode(EWeaponType::None, false, false);

View File

@ -1,13 +1,13 @@
#ifndef __URDE_CWEAPONMODE_HPP__
#define __URDE_CWEAPONMODE_HPP__
#include "CWeaponMgr.hpp"
#include "WeaponCommon.hpp"
namespace urde
{
class CWeaponMode
{
EWeaponType x0_weaponType;
EWeaponType x0_weaponType = EWeaponType::None;
union
{
struct
@ -19,7 +19,8 @@ class CWeaponMode
u8 dummy = 0;
};
public:
CWeaponMode(EWeaponType, bool, bool);
CWeaponMode() = default;
CWeaponMode(EWeaponType, bool = false, bool = false);
EWeaponType GetType() const;

View File

@ -0,0 +1,29 @@
#ifndef __URDE_WEAPONCOMMON_HPP__
#define __URDE_WEAPONCOMMON_HPP__
#include "RetroTypes.hpp"
namespace urde
{
enum class EWeaponType
{
None = -1,
Power = 0,
Ice,
Wave,
Plasma,
Bomb,
PowerBomb,
Missile,
BoostBall,
Phazon,
AI,
PoisonWater,
Lava,
Hot,
Unused1,
Unused2
};
}
#endif // __URDE_WEAPONCOMMON_HPP__

View File

@ -3,6 +3,7 @@
#include "RetroTypes.hpp"
#include "Weapon/CWeaponMgr.hpp"
#include "Weapon/CWeaponMode.hpp"
namespace urde
{
@ -10,17 +11,7 @@ namespace urde
class CDamageVulnerability;
class CDamageInfo
{
EWeaponType x0_type = EWeaponType::None;
union
{
struct
{
bool x4_24_ : 1;
bool x4_25_ : 1;
bool x4_26_ : 1;
};
u8 _dummy = 0;
};
CWeaponMode x0_weaponMode;
float x8_damage;
float xc_radiusDamage;
float x10_radius;
@ -31,13 +22,21 @@ public:
CDamageInfo(CInputStream& in)
{
in.readUint32Big();
x0_type = EWeaponType(in.readUint32Big());
x0_weaponMode = CWeaponMode(EWeaponType(in.readUint32Big()));
x8_damage = in.readFloatBig();
xc_radiusDamage = x8_damage;
x10_radius = in.readFloatBig();
x14_knockback = in.readFloatBig();
}
CDamageInfo(const CWeaponMode&, float damage, float radius, float knockback);
CDamageInfo(const CDamageInfo& other) = default;
const CWeaponMode& GetWeaponMode() const { return x0_weaponMode; }
float GetRadius() const { return x10_radius; }
void SetRadius(float r) { x10_radius = r; }
float GetKnockBackPower() const { return x14_knockback; }
float GetDamage() const { return x8_damage; }
void GetDamage(const CDamageVulnerability& dVuln);
float GetRadiusDamage() const { return xc_radiusDamage; }
float GetRadiusDamage(const CDamageVulnerability& dVuln);
};

View File

@ -21,12 +21,12 @@ CAreaRenderOctTree::CAreaRenderOctTree(std::unique_ptr<u8[]>&& buf)
x30_bitmaps = reinterpret_cast<u32*>(x0_buf.get() + 64);
u32 wc = x14_bitmapWordCount * x8_bitmapCount;
for (int i=0 ; i<wc ; ++i)
for (u32 i=0 ; i<wc ; ++i)
x30_bitmaps[i] = hecl::SBig(x30_bitmaps[i]);
x34_indirectionTable = x30_bitmaps + wc;
x38_entries = reinterpret_cast<u8*>(x34_indirectionTable) + x10_nodeCount;
for (int i=0 ; i<x10_nodeCount ; ++i)
for (u32 i=0 ; i<x10_nodeCount ; ++i)
{
x34_indirectionTable[i] = hecl::SBig(x34_indirectionTable[i]);
Node* n = reinterpret_cast<Node*>(x38_entries + x34_indirectionTable[i]);
@ -189,7 +189,7 @@ void CGameArea::CAreaFog::Update(float dt)
float colorDelta = x34_colorDelta * dt;
zeus::CVector2f rangeDelta = x14_rangeDelta * dt;
for (int i=0 ; i<3 ; ++i)
for (u32 i=0 ; i<3 ; ++i)
{
float delta = x28_colorTarget[i] - x1c_colorCur[i];
if (std::fabs(delta) <= colorDelta)
@ -205,7 +205,7 @@ void CGameArea::CAreaFog::Update(float dt)
}
}
for (int i=0 ; i<2 ; ++i)
for (u32 i=0 ; i<2 ; ++i)
{
float delta = xc_rangeTarget[i] - x4_rangeCur[i];
if (std::fabs(delta) <= rangeDelta[i])
@ -617,7 +617,7 @@ bool CGameArea::StartStreamingMainArea()
u32 totalSz = 0;
u32 secCount = GetNumPartSizes();
for (int i=2 ; i<secCount ; ++i)
for (u32 i=2 ; i<secCount ; ++i)
totalSz += hecl::SBig(reinterpret_cast<u32*>(x110_mreaSecBufs[1].first.get())[i]);
AllocNewAreaData(x128_mreaDataOffset, totalSz);
@ -627,7 +627,7 @@ bool CGameArea::StartStreamingMainArea()
m_resolvedBufs.emplace_back(x110_mreaSecBufs[1].first.get(), x110_mreaSecBufs[1].second);
u32 curOff = 0;
for (int i=2 ; i<secCount ; ++i)
for (u32 i=2 ; i<secCount ; ++i)
{
u32 size = hecl::SBig(reinterpret_cast<u32*>(x110_mreaSecBufs[1].first.get())[i]);
m_resolvedBufs.emplace_back(x110_mreaSecBufs[2].first.get() + curOff, size);
@ -704,7 +704,7 @@ void CGameArea::PostConstructArea()
/* Models */
if (header.modelCount)
{
for (int i=0 ; i<header.modelCount ; ++i)
for (u32 i=0 ; i<header.modelCount ; ++i)
{
u32 surfCount = hecl::SBig(*reinterpret_cast<u32*>((secIt+6)->first.get()));
secIt += 7 + surfCount;
@ -899,7 +899,7 @@ CGameArea::MREAHeader CGameArea::VerifyHeader() const
header.arotSecIdx = r.readUint32Big();
header.secSizes.reserve(header.secCount);
for (int i=0 ; i<header.secCount ; ++i)
for (u32 i=0 ; i<header.secCount ; ++i)
header.secSizes.push_back(r.readUint32Big());
return header;

View File

@ -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();}

View File

@ -59,14 +59,17 @@ 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
CScriptBeam.hpp CScriptBeam.cpp
CGrappleParameters.hpp
CActorParameters.hpp
CLightParameters.hpp

View File

@ -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);
}
}

View File

@ -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__

View File

@ -0,0 +1,57 @@
#include "CScriptBeam.hpp"
#include "CActorParameters.hpp"
#include "Particle/CWeaponDescription.hpp"
#include "Weapon/CPlasmaProjectile.hpp"
#include "CStateManager.hpp"
namespace urde
{
CScriptBeam::CScriptBeam(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
bool active, const TToken<CWeaponDescription>& weaponDesc, const CBeamInfo& bInfo,
const CDamageInfo& dInfo)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(), CActorParameters::None(),
kInvalidUniqueId)
, xe8_weaponDescription(weaponDesc)
, xf4_beamInfo(bInfo)
, x138_damageInfo(dInfo)
{
}
void CScriptBeam::Think(float dt, CStateManager& mgr)
{
#if 0
CPlasmaProjectile* proj = static_cast<CPlasmaProjectile*>(mgr.GetObjectById(x154_projectileId));
if (proj)
{
if (proj->GetActive())
proj->UpdateFx(x34_transform, dt, mgr);
}
else
x154_projectileId = kInvalidUniqueId;
#endif
}
void CScriptBeam::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& mgr)
{
if (msg == EScriptObjectMessage::Increment)
{
}
else if (msg == EScriptObjectMessage::Decrement)
{
}
else if (msg == EScriptObjectMessage::InternalMessage11)
{
x154_projectileId = mgr.AllocateUniqueId();
mgr.AddObject(new CPlasmaProjectile(xe8_weaponDescription, x10_name + "-Projectile",
x138_damageInfo.GetWeaponMode().GetType(), xf4_beamInfo, x34_transform,
EMaterialTypes::ThirtyFive, x138_damageInfo, x8_uid, x4_areaId,
x154_projectileId, 8, false, 2));
}
else if (msg == EScriptObjectMessage::InternalMessage12)
{
}
CActor::AcceptScriptMsg(msg, objId, mgr);
}
}

View File

@ -0,0 +1,25 @@
#ifndef __URDE_CSCRIPTBEAM_HPP__
#define __URDE_CSCRIPTBEAM_HPP__
#include "CActor.hpp"
#include "Weapon/CBeamInfo.hpp"
#include "CDamageInfo.hpp"
namespace urde
{
class CWeaponDescription;
class CScriptBeam : public CActor
{
TCachedToken<CWeaponDescription> xe8_weaponDescription;
CBeamInfo xf4_beamInfo;
CDamageInfo x138_damageInfo;
TUniqueId x154_projectileId;
public:
CScriptBeam(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, bool,
const TToken<CWeaponDescription>&, const CBeamInfo&, const CDamageInfo&);
void Think(float, CStateManager &);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager &);
};
}
#endif // __URDE_CSCRIPTBEAM_HPP__

View File

@ -17,7 +17,7 @@ public:
};
private:
//TReservedAverage<float, 8> x2e0_;
TReservedAverage<float, 8> x2e0_;
public:
CScriptDebris(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const CActorParameters&, ResId, const zeus::CVector3f&, float, const zeus::CVector3f&,

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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__

View File

@ -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);
}
}

View File

@ -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__

View File

@ -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);

View File

@ -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__

View File

@ -42,7 +42,10 @@ s16 IGameArea::Dock::GetOtherDockNumber(s32 other) const
bool IGameArea::Dock::GetShouldLoadOther(s32 other) const
{
if (other >= x4_dockReferences.size())
return false;
return false; //return x4_dockReferences[other].GetShouldLoad();
}
void IGameArea::Dock::SetShouldLoadOther(s32 other, bool should)

View File

@ -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;

View File

@ -11,6 +11,7 @@
#include "CWorld.hpp"
#include "Character/CModelData.hpp"
#include "Collision/CMaterialList.hpp"
#include "Particle/CWeaponDescription.hpp"
#include "CDamageInfo.hpp"
#include "CScriptActor.hpp"
#include "CScriptWaypoint.hpp"
@ -43,13 +44,16 @@
#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 "CScriptBeam.hpp"
#include "Camera/CCinematicCamera.hpp"
#include "MP1/CNewIntroBoss.hpp"
#include "MP1/CBeetle.hpp"
@ -746,7 +750,8 @@ CEntity* ScriptLoader::LoadCamera(CStateManager& mgr, CInputStream& in, int prop
if (propCount > 14)
b10 = in.readBool();
u32 flags = b2 | b3 << 1 | b4 << 2 | b5 << 3 | b6 << 4 | b7 << 5 | b8 << 6 | b9 << 8;
u32 flags = u32(b2) | u32(b3) << 1 | u32(b4) << 2 | u32(b5) << 3 | u32(b6) << 4 | u32(b7) << 5 | u32(b8) << 6 |
u32(b9) << 8;
return new CCinematicCamera(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, b1, f1,
f2 / CCameraManager::Aspect(), CCameraManager::NearPlane(), CCameraManager::FarPlane(),
@ -1485,7 +1490,14 @@ CEntity* ScriptLoader::LoadMetareeAlpha(CStateManager& mgr, CInputStream& in, in
CEntity* ScriptLoader::LoadDockAreaChange(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
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)
@ -1791,7 +1803,15 @@ CEntity* ScriptLoader::LoadStreamedAudio(CStateManager& mgr, CInputStream& in, i
CEntity* ScriptLoader::LoadRepulsor(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
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)
@ -1975,9 +1995,23 @@ CEntity* ScriptLoader::LoadBurrower(CStateManager& mgr, CInputStream& in, int pr
return nullptr;
}
CEntity* ScriptLoader::LoadScriptBeam(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
CEntity* ScriptLoader::LoadBeam(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
if (!EnsurePropertyCount(propCount, 7, "Beam"))
return nullptr;
SActorHead aHead = LoadActorHead(in, mgr);
bool active = in.readBool();
u32 weaponDescId = in.readUint32Big();
if (!g_ResFactory->GetResourceTypeById(weaponDescId))
return nullptr;
CBeamInfo beamInfo(in);
CDamageInfo dInfo(in);
TToken<CWeaponDescription> weaponDesc = g_SimplePool->GetObj({SBIG('WPSC'), weaponDescId});
return new CScriptBeam(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active,
weaponDesc, beamInfo, dInfo);
}
CEntity* ScriptLoader::LoadWorldLightFader(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)

View File

@ -152,7 +152,7 @@ public:
static CEntity* LoadSeedling(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadThermalHeatFader(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadBurrower(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadScriptBeam(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadBeam(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadWorldLightFader(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadMetroidPrimeStage2(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadMetroidPrimeStage1(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);

2
amuse

@ -1 +1 @@
Subproject commit 1dfdf4c392a0389b1a37f0e9c2064a42dd47b63f
Subproject commit 72d0df7d461841b7fca2b3c38c3dd61ccb798fd6

2
hecl

@ -1 +1 @@
Subproject commit 0ebd4366a5ffbb97aca413dd55b3753b49f2e81c
Subproject commit c75c8c0a28c8bbe994c56047371414e5b8f394af

@ -1 +1 @@
Subproject commit 7236e59845cc0f99ec2bcf2774d739e60fd48bb5
Subproject commit ee942606b6b6f72f48a1e6c761b530500f0f2841