This commit is contained in:
Jack Andersen 2016-07-24 12:53:47 -10:00
commit 37a2d81ff2
14 changed files with 170 additions and 19 deletions

View File

@ -7,7 +7,7 @@ if(MSVC)
endif() endif()
# Shaddup MSVC # Shaddup MSVC
add_definitions(-DUNICODE=1 -D_UNICODE=1 -D__SSE__=1 -D_CRT_SECURE_NO_WARNINGS=1 -DD_SCL_SECURE_NO_WARNINGS=1 /wd4267 /wd4244 /wd4305 ${VS_DEFINES}) add_definitions(-DUNICODE=1 -D_UNICODE=1 -D__SSE__=1 -D_CRT_SECURE_NO_WARNINGS=1 -DD_SCL_SECURE_NO_WARNINGS=1 /IGNORE:4221 /wd4800 /wd4005 /wd4311 /wd4267 /wd4244 /wd4305 ${VS_DEFINES})
# Link-time Code Generation for Release builds # Link-time Code Generation for Release builds
set(CMAKE_C_FLAGS_RELEASE "/DNDEBUG /O2 /Oy /GL /Gy /MD") set(CMAKE_C_FLAGS_RELEASE "/DNDEBUG /O2 /Oy /GL /Gy /MD")

View File

@ -29,7 +29,7 @@ static void BoxFilter(const uint8_t* input, unsigned chanCount,
if (inHeight > 1) if (inHeight > 1)
mipHeight = inHeight / 2; mipHeight = inHeight / 2;
int y,x,c; unsigned y,x,c;
for (y=0 ; y<mipHeight ; ++y) for (y=0 ; y<mipHeight ; ++y)
{ {
unsigned miplineBase = mipWidth * y; unsigned miplineBase = mipWidth * y;
@ -753,7 +753,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
} }
break; break;
case PNG_COLOR_TYPE_GRAY_ALPHA: case PNG_COLOR_TYPE_GRAY_ALPHA:
for (int i=0 ; i<width ; ++i) for (unsigned i=0 ; i<width ; ++i)
{ {
size_t inbase = i*2; size_t inbase = i*2;
size_t outbase = (r*width+i)*4; size_t outbase = (r*width+i)*4;
@ -764,7 +764,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
} }
break; break;
case PNG_COLOR_TYPE_RGB: case PNG_COLOR_TYPE_RGB:
for (int i=0 ; i<width ; ++i) for (unsigned i=0 ; i<width ; ++i)
{ {
size_t inbase = i*3; size_t inbase = i*3;
size_t outbase = (r*width+i)*4; size_t outbase = (r*width+i)*4;
@ -775,7 +775,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
} }
break; break;
case PNG_COLOR_TYPE_RGB_ALPHA: case PNG_COLOR_TYPE_RGB_ALPHA:
for (int i=0 ; i<width ; ++i) for (unsigned i=0 ; i<width ; ++i)
{ {
size_t inbase = i*4; size_t inbase = i*4;
size_t outbase = (r*width+i)*4; size_t outbase = (r*width+i)*4;

View File

@ -204,7 +204,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
/* Calculate offset to EGMC section */ /* Calculate offset to EGMC section */
atUint64 egmcOffset = 0; atUint64 egmcOffset = 0;
for (int i = 0; i < head.egmcSecIdx; i++) for (unsigned i = 0; i < head.egmcSecIdx; i++)
egmcOffset += head.secSizes[i]; egmcOffset += head.secSizes[i];
/* Load EGMC if possible so we can assign meshes to scanIds */ /* Load EGMC if possible so we can assign meshes to scanIds */

View File

@ -4,6 +4,96 @@ namespace urde
{ {
CSaveWorld::CSaveWorld(CInputStream &in) CSaveWorld::CSaveWorld(CInputStream &in)
{ {
in.readUint32Big();
u32 version = in.readUint32Big();
if (version > 1)
x0_areaCount = in.readUint32Big();
if (version > 2)
{
u32 cinematicCount = in.readUint32Big();
x4_cinematics.reserve(cinematicCount);
for (u32 i=0 ; i<cinematicCount ; ++i)
x4_cinematics.push_back(in.readUint32Big());
u32 relayCount = in.readUint32Big();
x14_relays.reserve(relayCount);
for (u32 i=0 ; i<relayCount ; ++i)
x14_relays.push_back(in.readUint32Big());
}
u32 layerCount = in.readUint32Big();
x24_layers.reserve(layerCount);
for (u32 i=0 ; i<layerCount ; ++i)
{
x24_layers.emplace_back();
SLayerState& st = x24_layers.back();
st.x0_area = in.readUint32Big();
st.x4_layer = in.readUint32Big();
}
u32 doorCount = in.readUint32Big();
x34_doors.reserve(doorCount);
for (u32 i=0 ; i<doorCount ; ++i)
x34_doors.push_back(in.readUint32Big());
if (version > 0)
{
u32 scanCount = in.readUint32Big();
x44_scans.reserve(scanCount);
for (u32 i=0 ; i<scanCount ; ++i)
{
x44_scans.emplace_back();
SScanState& st = x44_scans.back();
st.x0_id = in.readUint32Big();
st.x4_category = EScanCategory(in.readUint32Big());
}
}
}
u32 CSaveWorld::GetAreaCount() const
{
return x0_areaCount;
}
u32 CSaveWorld::GetCinematicCount() const
{
return x4_cinematics.size();
}
s32 CSaveWorld::GetCinematicIndex(const TEditorId &id) const
{
for (u32 i=0 ; i<x4_cinematics.size() ; ++i)
if (x4_cinematics.at(i) == id)
return i;
return -1;
}
u32 CSaveWorld::GetRelayCount() const
{
return x14_relays.size();
}
s32 CSaveWorld::GetRelayIndex(const TEditorId &id) const
{
for (u32 i=0 ; i<x14_relays.size() ; ++i)
if (x14_relays.at(i) == id)
return i;
return -1;
}
u32 CSaveWorld::GetDoorCount() const
{
return x34_doors.size();
}
s32 CSaveWorld::GetDoorIndex(const TEditorId &id) const
{
for (u32 i=0 ; i<x34_doors.size() ; ++i)
if (x34_doors.at(i) == id)
return i;
return -1;
} }
} }

View File

@ -2,12 +2,43 @@
#define __URDE_CSAVEWORLD_HPP__ #define __URDE_CSAVEWORLD_HPP__
#include "RetroTypes.hpp" #include "RetroTypes.hpp"
#include "DNACommon/SAVWCommon.hpp"
namespace urde namespace urde
{ {
class CSaveWorld class CSaveWorld
{ {
public:
using EScanCategory = DataSpec::SAVWCommon::EScanCategory;
struct SScanState
{
ResId x0_id;
EScanCategory x4_category;
};
struct SLayerState
{
TAreaId x0_area;
u32 x4_layer;
};
private:
u32 x0_areaCount;
std::vector<TEditorId> x4_cinematics;
std::vector<TEditorId> x14_relays;
std::vector<SLayerState> x24_layers;
std::vector<TEditorId> x34_doors;
std::vector<SScanState> x44_scans;
public:
CSaveWorld(CInputStream& in); CSaveWorld(CInputStream& in);
u32 GetAreaCount() const;
u32 GetCinematicCount() const;
s32 GetCinematicIndex(const TEditorId& id) const;
u32 GetRelayCount() const;
s32 GetRelayIndex(const TEditorId& id) const;
u32 GetDoorCount() const;
s32 GetDoorIndex(const TEditorId &id) const;
}; };
} }

View File

@ -1,3 +1,6 @@
#if _WIN32
#include <D3Dcommon.h>
#endif
#include "CBooRenderer.hpp" #include "CBooRenderer.hpp"
namespace urde namespace urde
@ -182,6 +185,7 @@ void CBooRenderer::DrawString(const char*, int, int)
u32 CBooRenderer::GetFPS() u32 CBooRenderer::GetFPS()
{ {
return 0;
} }
void CBooRenderer::CacheReflection(TReflectionCallback, void*, bool) void CBooRenderer::CacheReflection(TReflectionCallback, void*, bool)
@ -232,6 +236,7 @@ void CBooRenderer::DoThermalBlendHot()
u32 CBooRenderer::GetStaticWorldDataSize() u32 CBooRenderer::GetStaticWorldDataSize()
{ {
return 0;
} }
} }

View File

@ -1,7 +1,7 @@
if(WIN32) if(WIN32)
set(PLAT_SRCS Shaders/CLineRendererShadersHLSL.cpp Shaders/CModelShadersHLSL.cpp) set(PLAT_SRCS Shaders/CLineRendererShadersHLSL.cpp Shaders/CModelShadersHLSL.cpp Shaders/CThermalColdFilterHLSL.cpp)
elseif(APPLE) elseif(APPLE)
set(PLAT_SRCS Shaders/CLineRendererShadersMetal.cpp Shaders/CModelShadersMetal.cpp) set(PLAT_SRCS Shaders/CLineRendererShadersMetal.cpp Shaders/CModelShadersMetal.cpp Shaders/CThermalColdFilterMetal.cpp)
endif() endif()
set(GRAPHICS_SOURCES set(GRAPHICS_SOURCES

View File

@ -1,5 +1,5 @@
#include "CLineRendererShaders.hpp" #include "CLineRendererShaders.hpp"
#include "CLineRenderer.hpp" #include "Graphics/CLineRenderer.hpp"
namespace urde namespace urde
{ {

View File

@ -3,7 +3,7 @@
namespace urde namespace urde
{ {
TFilterShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize(boo::ID3DDataFactory::Context& ctx, TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize(boo::ID3DDataFactory::Context& ctx,
boo::IShaderPipeline*& pipeOut, boo::IShaderPipeline*& pipeOut,
boo::IVertexFormat*& vtxFmtOut) boo::IVertexFormat*& vtxFmtOut)
{ {

View File

@ -3,7 +3,7 @@
namespace urde namespace urde
{ {
TFilterShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize(boo::MetalDataFactory::Context& ctx, TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize(boo::MetalDataFactory::Context& ctx,
boo::IShaderPipeline*& pipeOut, boo::IShaderPipeline*& pipeOut,
boo::IVertexFormat*& vtxFmtOut) boo::IVertexFormat*& vtxFmtOut)
{ {

View File

@ -27,6 +27,7 @@ void CGameArea::CAreaFog::SetFogExplicit(ERglFogMode, const zeus::CColor& color,
bool CGameArea::CAreaFog::IsFogDisabled() const bool CGameArea::CAreaFog::IsFogDisabled() const
{ {
return true;
} }
void CGameArea::CAreaFog::DisableFog() void CGameArea::CAreaFog::DisableFog()
@ -45,49 +46,58 @@ CDummyGameArea::CDummyGameArea(CInputStream& in, int idx, int mlvlVersion)
u32 attachAreaCount = in.readUint32Big(); u32 attachAreaCount = in.readUint32Big();
x44_attachedAreaIndices.reserve(attachAreaCount); x44_attachedAreaIndices.reserve(attachAreaCount);
for (int i=0 ; i<attachAreaCount ; ++i) for (u32 i=0 ; i<attachAreaCount ; ++i)
x44_attachedAreaIndices.push_back(in.readUint16Big()); x44_attachedAreaIndices.push_back(in.readUint16Big());
u32 depCount = in.readUint32Big(); u32 depCount = in.readUint32Big();
for (int i=0 ; i<depCount ; ++i) for (u32 i=0 ; i<depCount ; ++i)
in.readUint32Big(); in.readUint32Big();
u32 dockCount = in.readUint32Big(); u32 dockCount = in.readUint32Big();
x54_docks.reserve(dockCount); x54_docks.reserve(dockCount);
for (int i=0 ; i<dockCount ; ++i) for (u32 i=0 ; i<dockCount ; ++i)
x54_docks.emplace_back(in, x14_transform); x54_docks.emplace_back(in, x14_transform);
} }
bool CDummyGameArea::IGetScriptingMemoryAlways() const bool CDummyGameArea::IGetScriptingMemoryAlways() const
{ {
return false;
} }
TAreaId CDummyGameArea::IGetAreaId() const TAreaId CDummyGameArea::IGetAreaId() const
{ {
return 0;
} }
ResId CDummyGameArea::IGetAreaAssetId() const ResId CDummyGameArea::IGetAreaAssetId() const
{ {
return 0;
} }
bool CDummyGameArea::IIsActive() const bool CDummyGameArea::IIsActive() const
{ {
return false;
} }
TAreaId CDummyGameArea::IGetAttachedAreaId(int) const TAreaId CDummyGameArea::IGetAttachedAreaId(int) const
{ {
return 0;
} }
u32 CDummyGameArea::IGetNumAttachedAreas() const u32 CDummyGameArea::IGetNumAttachedAreas() const
{ {
return 0;
} }
ResId CDummyGameArea::IGetStringTableAssetId() const ResId CDummyGameArea::IGetStringTableAssetId() const
{ {
return 0;
} }
static zeus::CTransform identityXf(zeus::CMatrix3f::skIdentityMatrix3f);
const zeus::CTransform& CDummyGameArea::IGetTM() const const zeus::CTransform& CDummyGameArea::IGetTM() const
{ {
return identityXf;
} }
static std::vector<SObjectTag> ReadDependencyList(CInputStream& in) static std::vector<SObjectTag> ReadDependencyList(CInputStream& in)
@ -95,7 +105,7 @@ static std::vector<SObjectTag> ReadDependencyList(CInputStream& in)
std::vector<SObjectTag> ret; std::vector<SObjectTag> ret;
u32 count = in.readUint32Big(); u32 count = in.readUint32Big();
ret.reserve(count); ret.reserve(count);
for (int i=0 ; i<count ; ++i) for (u32 i=0 ; i<count ; ++i)
{ {
ret.emplace_back(); ret.emplace_back();
ret.back().readMLVL(in); ret.back().readMLVL(in);
@ -119,7 +129,7 @@ CGameArea::CGameArea(CInputStream& in, int idx, int mlvlVersion)
u32 attachedCount = in.readUint32Big(); u32 attachedCount = in.readUint32Big();
x8c_attachedAreaIndices.reserve(attachedCount); x8c_attachedAreaIndices.reserve(attachedCount);
for (int i=0 ; i<attachedCount ; ++i) for (u32 i=0 ; i<attachedCount ; ++i)
x8c_attachedAreaIndices.push_back(in.readUint16Big()); x8c_attachedAreaIndices.push_back(in.readUint16Big());
x9c_deps1 = ::urde::ReadDependencyList(in); x9c_deps1 = ::urde::ReadDependencyList(in);
@ -129,42 +139,52 @@ CGameArea::CGameArea(CInputStream& in, int idx, int mlvlVersion)
bool CGameArea::IGetScriptingMemoryAlways() const bool CGameArea::IGetScriptingMemoryAlways() const
{ {
return false;
} }
TAreaId CGameArea::IGetAreaId() const TAreaId CGameArea::IGetAreaId() const
{ {
return 0;
} }
ResId CGameArea::IGetAreaAssetId() const ResId CGameArea::IGetAreaAssetId() const
{ {
return 0;
} }
bool CGameArea::IIsActive() const bool CGameArea::IIsActive() const
{ {
return false;
} }
TAreaId CGameArea::IGetAttachedAreaId(int) const TAreaId CGameArea::IGetAttachedAreaId(int) const
{ {
return 0;
} }
u32 CGameArea::IGetNumAttachedAreas() const u32 CGameArea::IGetNumAttachedAreas() const
{ {
return 0;
} }
ResId CGameArea::IGetStringTableAssetId() const ResId CGameArea::IGetStringTableAssetId() const
{ {
return 0;
} }
const zeus::CTransform& CGameArea::IGetTM() const const zeus::CTransform& CGameArea::IGetTM() const
{ {
return identityXf;
} }
bool CGameArea::DoesAreaNeedEnvFx() const bool CGameArea::DoesAreaNeedEnvFx() const
{ {
return false;
} }
bool CGameArea::DoesAreaNeedSkyNow() const bool CGameArea::DoesAreaNeedSkyNow() const
{ {
return false;
} }
void CGameArea::UpdateFog(float dt) void CGameArea::UpdateFog(float dt)
@ -173,6 +193,7 @@ void CGameArea::UpdateFog(float dt)
bool CGameArea::OtherAreaOcclusionChanged() bool CGameArea::OtherAreaOcclusionChanged()
{ {
return false;
} }
void CGameArea::PingOcclusionState() void CGameArea::PingOcclusionState()
@ -238,6 +259,7 @@ void CGameArea::StartStreamingMainArea()
u32 CGameArea::GetNumPartSizes() const u32 CGameArea::GetNumPartSizes() const
{ {
return 0;
} }
void CGameArea::AllocNewAreaData(int, int) void CGameArea::AllocNewAreaData(int, int)
@ -258,6 +280,7 @@ void CGameArea::StartStreamIn(CStateManager& mgr)
bool CGameArea::Validate(CStateManager& mgr) bool CGameArea::Validate(CStateManager& mgr)
{ {
return false;
} }
void CGameArea::PostConstructArea() void CGameArea::PostConstructArea()
@ -278,10 +301,12 @@ void CGameArea::ClearTokenList()
u32 CGameArea::GetPreConstructedSize() const u32 CGameArea::GetPreConstructedSize() const
{ {
return 0;
} }
bool CGameArea::VerifyHeader() const bool CGameArea::VerifyHeader() const
{ {
return false;
} }
} }

View File

@ -4,7 +4,6 @@
#include "CSimplePool.hpp" #include "CSimplePool.hpp"
#include "CStateManager.hpp" #include "CStateManager.hpp"
#include "CInGameTweakManagerBase.hpp" #include "CInGameTweakManagerBase.hpp"
#include "AutoMapper/CMapWorld.hpp"
namespace urde namespace urde
{ {

View File

@ -5,13 +5,14 @@
#include "ScriptObjectSupport.hpp" #include "ScriptObjectSupport.hpp"
#include "CGameArea.hpp" #include "CGameArea.hpp"
#include "Graphics/CModel.hpp" #include "Graphics/CModel.hpp"
#include "AutoMapper/CMapWorld.hpp"
namespace urde namespace urde
{ {
class CGameArea; class CGameArea;
class IObjectStore; class IObjectStore;
class CResFactory; class CResFactory;
class CMapWorld;
class IGameArea; class IGameArea;
class CAudioGroupSet; class CAudioGroupSet;

2
hecl

@ -1 +1 @@
Subproject commit c4bdd92138ccc5de801bb109f9761605e3b81f74 Subproject commit 3f867ce409fa74e6ec33135bf2d294d4fd1d198f