mirror of https://github.com/AxioDL/metaforce.git
Work on memory card sys; CMake fixes
This commit is contained in:
parent
f7f5066038
commit
545fccc4cc
|
@ -1,18 +1,19 @@
|
||||||
include_directories(${LIBPNG_INCLUDE_DIR} ${SQUISH_INCLUDE_DIR})
|
include_directories(${LIBPNG_INCLUDE_DIR} ${SQUISH_INCLUDE_DIR})
|
||||||
|
|
||||||
# Assembles a source/header pair list for use in a DNA library
|
# Assembles a source/header pair list for use in a DNA library
|
||||||
macro(make_dnalist outlist)
|
macro(make_dnalist outlist subdir)
|
||||||
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${subdir}")
|
||||||
foreach(type ${ARGN})
|
foreach(type ${ARGN})
|
||||||
get_filename_component(dir ${type} DIRECTORY)
|
get_filename_component(dir ${type} DIRECTORY)
|
||||||
if(dir)
|
if(dir)
|
||||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${dir}")
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${subdir}/${dir}")
|
||||||
set(dir "${dir}/")
|
set(dir "${dir}/")
|
||||||
endif()
|
endif()
|
||||||
get_filename_component(name ${type} NAME)
|
get_filename_component(name ${type} NAME)
|
||||||
atdna(${dir}atdna_${name}.cpp ${dir}/${name}.hpp)
|
atdna("${subdir}/${dir}atdna_${name}.cpp" "${subdir}/${dir}${name}.hpp")
|
||||||
list(APPEND ${outlist}
|
list(APPEND ${outlist}
|
||||||
${dir}atdna_${name}.cpp
|
${subdir}/${dir}atdna_${name}.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/${dir}/${name}.hpp)
|
${subdir}/${dir}${name}.hpp)
|
||||||
endforeach()
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
@ -26,16 +27,16 @@ macro(dataspec_add_list rel_path a_list)
|
||||||
list(APPEND tmp_list "${rel_path}/${path}")
|
list(APPEND tmp_list "${rel_path}/${path}")
|
||||||
endif()
|
endif()
|
||||||
endforeach(path)
|
endforeach(path)
|
||||||
set(${a_list} "${tmp_list}" PARENT_SCOPE)
|
set(${a_list} "${tmp_list}")
|
||||||
endmacro(dataspec_add_list)
|
endmacro(dataspec_add_list)
|
||||||
|
|
||||||
include_directories(${ZLIB_INCLUDE_DIR} ${LZO_INCLUDE_DIR})
|
include_directories(${ZLIB_INCLUDE_DIR} ${LZO_INCLUDE_DIR})
|
||||||
|
|
||||||
# Each game's DNA library
|
# Each game's DNA library
|
||||||
add_subdirectory(DNACommon)
|
include(DNACommon/CMakeLists.txt)
|
||||||
add_subdirectory(DNAMP1)
|
include(DNAMP1/CMakeLists.txt)
|
||||||
add_subdirectory(DNAMP2)
|
include(DNAMP2/CMakeLists.txt)
|
||||||
add_subdirectory(DNAMP3)
|
include(DNAMP3/CMakeLists.txt)
|
||||||
|
|
||||||
# Embed master shader script
|
# Embed master shader script
|
||||||
bintoc(RetroMasterShader.c Blender/RetroMasterShader.py RETRO_MASTER_SHADER)
|
bintoc(RetroMasterShader.c Blender/RetroMasterShader.py RETRO_MASTER_SHADER)
|
||||||
|
@ -46,6 +47,7 @@ add_library(RetroDataSpec
|
||||||
${DNACOMMON_SOURCES}
|
${DNACOMMON_SOURCES}
|
||||||
SpecMP1.cpp
|
SpecMP1.cpp
|
||||||
${DNAMP1_SOURCES}
|
${DNAMP1_SOURCES}
|
||||||
|
${ScriptObjectsMP1_SOURCES}
|
||||||
SpecMP2.cpp
|
SpecMP2.cpp
|
||||||
${DNAMP2_SOURCES}
|
${DNAMP2_SOURCES}
|
||||||
SpecMP3.cpp
|
SpecMP3.cpp
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
make_dnalist(liblist
|
make_dnalist(liblist DNACommon
|
||||||
CMDL
|
CMDL
|
||||||
MAPA
|
MAPA
|
||||||
EGMC
|
EGMC
|
||||||
|
@ -7,7 +7,6 @@ make_dnalist(liblist
|
||||||
|
|
||||||
set(DNACOMMON_SOURCES
|
set(DNACOMMON_SOURCES
|
||||||
DNACommon.hpp DNACommon.cpp
|
DNACommon.hpp DNACommon.cpp
|
||||||
${liblist}
|
|
||||||
PAK.hpp PAK.cpp
|
PAK.hpp PAK.cpp
|
||||||
GX.hpp
|
GX.hpp
|
||||||
FSM2.hpp FSM2.cpp
|
FSM2.hpp FSM2.cpp
|
||||||
|
@ -44,3 +43,4 @@ set(DNACOMMON_SOURCES
|
||||||
Tweaks/ITweakSlideShow.hpp)
|
Tweaks/ITweakSlideShow.hpp)
|
||||||
|
|
||||||
dataspec_add_list(DNACommon DNACOMMON_SOURCES)
|
dataspec_add_list(DNACommon DNACOMMON_SOURCES)
|
||||||
|
list(APPEND DNACOMMON_SOURCES ${liblist})
|
||||||
|
|
|
@ -318,6 +318,7 @@ class WordBitmap
|
||||||
public:
|
public:
|
||||||
void read(athena::io::IStreamReader& reader, size_t bitCount);
|
void read(athena::io::IStreamReader& reader, size_t bitCount);
|
||||||
void write(athena::io::IStreamWriter& writer) const;
|
void write(athena::io::IStreamWriter& writer) const;
|
||||||
|
void reserve(size_t bitCount) { m_words.reserve((bitCount + 31) / 32); }
|
||||||
size_t binarySize(size_t __isz) const;
|
size_t binarySize(size_t __isz) const;
|
||||||
size_t getBitCount() const {return m_bitCount;}
|
size_t getBitCount() const {return m_bitCount;}
|
||||||
bool getBit(size_t idx) const
|
bool getBit(size_t idx) const
|
||||||
|
@ -335,6 +336,7 @@ public:
|
||||||
m_words.push_back(0);
|
m_words.push_back(0);
|
||||||
size_t wordCur = idx % 32;
|
size_t wordCur = idx % 32;
|
||||||
m_words[wordIdx] |= (1 << wordCur);
|
m_words[wordIdx] |= (1 << wordCur);
|
||||||
|
m_bitCount = std::max(m_bitCount, idx + 1);
|
||||||
}
|
}
|
||||||
void unsetBit(size_t idx)
|
void unsetBit(size_t idx)
|
||||||
{
|
{
|
||||||
|
@ -343,8 +345,9 @@ public:
|
||||||
m_words.push_back(0);
|
m_words.push_back(0);
|
||||||
size_t wordCur = idx % 32;
|
size_t wordCur = idx % 32;
|
||||||
m_words[wordIdx] &= ~(1 << wordCur);
|
m_words[wordIdx] &= ~(1 << wordCur);
|
||||||
|
m_bitCount = std::max(m_bitCount, idx + 1);
|
||||||
}
|
}
|
||||||
void clear() {m_words.clear();}
|
void clear() { m_words.clear(); m_bitCount = 0; }
|
||||||
|
|
||||||
class Iterator : public std::iterator<std::forward_iterator_tag, bool>
|
class Iterator : public std::iterator<std::forward_iterator_tag, bool>
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
add_subdirectory(ScriptObjects)
|
include(DNAMP1/ScriptObjects/CMakeLists.txt)
|
||||||
|
|
||||||
make_dnalist(liblist
|
make_dnalist(liblist DNAMP1
|
||||||
PAK
|
PAK
|
||||||
MLVL
|
MLVL
|
||||||
AGSC
|
AGSC
|
||||||
|
@ -32,7 +32,6 @@ make_dnalist(liblist
|
||||||
|
|
||||||
set(DNAMP1_SOURCES
|
set(DNAMP1_SOURCES
|
||||||
DNAMP1.hpp DNAMP1.cpp
|
DNAMP1.hpp DNAMP1.cpp
|
||||||
${liblist}
|
|
||||||
PAK.cpp
|
PAK.cpp
|
||||||
MLVL.cpp
|
MLVL.cpp
|
||||||
STRG.hpp STRG.cpp
|
STRG.hpp STRG.cpp
|
||||||
|
@ -49,7 +48,7 @@ set(DNAMP1_SOURCES
|
||||||
SCLY.hpp SCLY.cpp
|
SCLY.hpp SCLY.cpp
|
||||||
FRME.cpp
|
FRME.cpp
|
||||||
DeafBabe.cpp
|
DeafBabe.cpp
|
||||||
Tweaks/CTweakPlayer.cpp
|
Tweaks/CTweakPlayer.cpp)
|
||||||
${ScriptObjectsMP1_SOURCES})
|
|
||||||
|
|
||||||
dataspec_add_list(DNAMP1 DNAMP1_SOURCES)
|
dataspec_add_list(DNAMP1 DNAMP1_SOURCES)
|
||||||
|
list(APPEND DNAMP1_SOURCES ${liblist})
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
make_dnalist(liblist
|
make_dnalist(liblist DNAMP1/ScriptObjects
|
||||||
IScriptObject
|
IScriptObject
|
||||||
Parameters
|
Parameters
|
||||||
Actor
|
Actor
|
||||||
|
@ -129,9 +129,9 @@ make_dnalist(liblist
|
||||||
WorldTeleporter)
|
WorldTeleporter)
|
||||||
|
|
||||||
set(ScriptObjectsMP1_SOURCES
|
set(ScriptObjectsMP1_SOURCES
|
||||||
${liblist}
|
|
||||||
ScriptTypes.hpp
|
ScriptTypes.hpp
|
||||||
IScriptObject.cpp
|
IScriptObject.cpp
|
||||||
Parameters.cpp)
|
Parameters.cpp)
|
||||||
|
|
||||||
dataspec_add_list(ScriptObjects ScriptObjectsMP1_SOURCES)
|
dataspec_add_list(DNAMP1/ScriptObjects ScriptObjectsMP1_SOURCES)
|
||||||
|
list(APPEND ScriptObjectsMP1_SOURCES ${liblist})
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
make_dnalist(liblist
|
make_dnalist(liblist DNAMP2
|
||||||
MLVL
|
MLVL
|
||||||
ANIM
|
ANIM
|
||||||
AGSC
|
AGSC
|
||||||
|
@ -12,7 +12,6 @@ make_dnalist(liblist
|
||||||
DeafBabe)
|
DeafBabe)
|
||||||
set(DNAMP2_SOURCES
|
set(DNAMP2_SOURCES
|
||||||
DNAMP2.hpp DNAMP2.cpp
|
DNAMP2.hpp DNAMP2.cpp
|
||||||
${liblist}
|
|
||||||
ANIM.cpp
|
ANIM.cpp
|
||||||
AGSC.cpp
|
AGSC.cpp
|
||||||
CINF.cpp
|
CINF.cpp
|
||||||
|
@ -24,3 +23,4 @@ set(DNAMP2_SOURCES
|
||||||
STRG.hpp STRG.cpp)
|
STRG.hpp STRG.cpp)
|
||||||
|
|
||||||
dataspec_add_list(DNAMP2 DNAMP2_SOURCES)
|
dataspec_add_list(DNAMP2 DNAMP2_SOURCES)
|
||||||
|
list(APPEND DNAMP2_SOURCES ${liblist})
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
make_dnalist(liblist
|
make_dnalist(liblist DNAMP3
|
||||||
PAK
|
PAK
|
||||||
MLVL
|
MLVL
|
||||||
ANIM
|
ANIM
|
||||||
|
@ -12,7 +12,6 @@ make_dnalist(liblist
|
||||||
HINT)
|
HINT)
|
||||||
set(DNAMP3_SOURCES
|
set(DNAMP3_SOURCES
|
||||||
DNAMP3.hpp DNAMP3.cpp
|
DNAMP3.hpp DNAMP3.cpp
|
||||||
${liblist}
|
|
||||||
PAK.cpp
|
PAK.cpp
|
||||||
ANIM.cpp
|
ANIM.cpp
|
||||||
CINF.cpp
|
CINF.cpp
|
||||||
|
@ -24,3 +23,4 @@ set(DNAMP3_SOURCES
|
||||||
MREA.cpp)
|
MREA.cpp)
|
||||||
|
|
||||||
dataspec_add_list(DNAMP3 DNAMP3_SOURCES)
|
dataspec_add_list(DNAMP3 DNAMP3_SOURCES)
|
||||||
|
list(APPEND DNAMP3_SOURCES ${liblist})
|
||||||
|
|
|
@ -9,13 +9,48 @@
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
|
CWorldLayerState::CWorldLayerState(CBitStreamReader& reader, const CSaveWorld& saveWorld)
|
||||||
|
{
|
||||||
|
u32 bitCount = reader.ReadEncoded(10);
|
||||||
|
x10_saveLayers.reserve(bitCount);
|
||||||
|
|
||||||
|
for (u32 i=0 ; i<bitCount ; ++i)
|
||||||
|
{
|
||||||
|
bool bit = reader.ReadEncoded(1);
|
||||||
|
if (bit)
|
||||||
|
x10_saveLayers.setBit(i);
|
||||||
|
else
|
||||||
|
x10_saveLayers.unsetBit(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWorldLayerState::InitializeWorldLayers(const std::vector<CWorldLayers::Area>& layers)
|
||||||
|
{
|
||||||
|
if (x0_areaLayers.size())
|
||||||
|
return;
|
||||||
|
x0_areaLayers = layers;
|
||||||
|
if (x10_saveLayers.getBitCount() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
u32 a = 0;
|
||||||
|
u32 b = 0;
|
||||||
|
for (const CWorldLayers::Area& area : x0_areaLayers)
|
||||||
|
{
|
||||||
|
for (u32 l=0 ; l<area.m_layerCount ; ++l)
|
||||||
|
SetLayerActive(a, l, x10_saveLayers.getBit(b++));
|
||||||
|
++a;
|
||||||
|
}
|
||||||
|
|
||||||
|
x10_saveLayers.clear();
|
||||||
|
}
|
||||||
|
|
||||||
CWorldState::CWorldState(ResId id)
|
CWorldState::CWorldState(ResId id)
|
||||||
: x0_mlvlId(id), x4_areaId(0)
|
: x0_mlvlId(id), x4_areaId(0)
|
||||||
{
|
{
|
||||||
x8_relayTracker = std::make_shared<CRelayTracker>();
|
x8_relayTracker = std::make_shared<CRelayTracker>();
|
||||||
xc_mapWorldInfo = std::make_shared<CMapWorldInfo>();
|
xc_mapWorldInfo = std::make_shared<CMapWorldInfo>();
|
||||||
x10_ = -1;
|
x10_ = -1;
|
||||||
x14_ = std::make_shared<CWorldSomethingState>();
|
x14_layerState = std::make_shared<CWorldLayerState>();
|
||||||
}
|
}
|
||||||
|
|
||||||
CWorldState::CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorld& saveWorld)
|
CWorldState::CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorld& saveWorld)
|
||||||
|
@ -25,7 +60,7 @@ CWorldState::CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorl
|
||||||
x10_ = reader.ReadEncoded(32);
|
x10_ = reader.ReadEncoded(32);
|
||||||
x8_relayTracker = std::make_shared<CRelayTracker>(reader, saveWorld);
|
x8_relayTracker = std::make_shared<CRelayTracker>(reader, saveWorld);
|
||||||
xc_mapWorldInfo = std::make_shared<CMapWorldInfo>(reader, saveWorld, mlvlId);
|
xc_mapWorldInfo = std::make_shared<CMapWorldInfo>(reader, saveWorld, mlvlId);
|
||||||
x14_ = std::make_shared<CWorldSomethingState>(reader, saveWorld);
|
x14_layerState = std::make_shared<CWorldLayerState>(reader, saveWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGameState::CGameState()
|
CGameState::CGameState()
|
||||||
|
|
|
@ -8,35 +8,36 @@
|
||||||
#include "CRelayTracker.hpp"
|
#include "CRelayTracker.hpp"
|
||||||
#include "World/CWorldTransManager.hpp"
|
#include "World/CWorldTransManager.hpp"
|
||||||
#include "AutoMapper/CMapWorldInfo.hpp"
|
#include "AutoMapper/CMapWorldInfo.hpp"
|
||||||
|
#include "World/CWorld.hpp"
|
||||||
|
#include "DataSpec/DNACommon/DNACommon.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
class CSaveWorldMemory;
|
class CSaveWorldMemory;
|
||||||
|
|
||||||
/* TODO: Figure out */
|
class CWorldLayerState
|
||||||
class CWorldSomethingState
|
|
||||||
{
|
{
|
||||||
friend class CSaveWorldIntermediate;
|
friend class CSaveWorldIntermediate;
|
||||||
std::vector<u32> x0_;
|
std::vector<CWorldLayers::Area> x0_areaLayers;
|
||||||
u32 x10_bitCount = 0;
|
DataSpec::WordBitmap x10_saveLayers;
|
||||||
std::vector<u32> x14_;
|
|
||||||
public:
|
public:
|
||||||
CWorldSomethingState() = default;
|
CWorldLayerState() = default;
|
||||||
CWorldSomethingState(CBitStreamReader& reader, const CSaveWorld& saveWorld)
|
CWorldLayerState(CBitStreamReader& reader, const CSaveWorld& saveWorld);
|
||||||
{
|
|
||||||
u32 bitCount = reader.ReadEncoded(10);
|
|
||||||
u32 wordCount = (bitCount + 31) / 32;
|
|
||||||
x14_.resize(wordCount);
|
|
||||||
|
|
||||||
for (u32 i=0 ; i<bitCount ; ++i)
|
bool IsLayerActive(int areaIdx, int layerIdx) const
|
||||||
{
|
{
|
||||||
++x10_bitCount;
|
return (x0_areaLayers[areaIdx].m_layerBits >> layerIdx) & 1;
|
||||||
bool bit = reader.ReadEncoded(1);
|
|
||||||
if (bit)
|
|
||||||
x14_[i / 32] |= 1 << (i % 32);
|
|
||||||
else
|
|
||||||
x14_[i / 32] &= ~(1 << (i % 32));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetLayerActive(int areaIdx, int layerIdx, bool active)
|
||||||
|
{
|
||||||
|
if (active)
|
||||||
|
x0_areaLayers[areaIdx].m_layerBits |= 1 << layerIdx;
|
||||||
|
else
|
||||||
|
x0_areaLayers[areaIdx].m_layerBits &= ~(1 << layerIdx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitializeWorldLayers(const std::vector<CWorldLayers::Area>& layers);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CWorldState
|
class CWorldState
|
||||||
|
@ -46,7 +47,7 @@ class CWorldState
|
||||||
std::shared_ptr<CRelayTracker> x8_relayTracker;
|
std::shared_ptr<CRelayTracker> x8_relayTracker;
|
||||||
std::shared_ptr<CMapWorldInfo> xc_mapWorldInfo;
|
std::shared_ptr<CMapWorldInfo> xc_mapWorldInfo;
|
||||||
u32 x10_;
|
u32 x10_;
|
||||||
std::shared_ptr<CWorldSomethingState> x14_;
|
std::shared_ptr<CWorldLayerState> x14_layerState;
|
||||||
public:
|
public:
|
||||||
CWorldState(ResId id);
|
CWorldState(ResId id);
|
||||||
CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorld& saveWorld);
|
CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorld& saveWorld);
|
||||||
|
@ -55,7 +56,7 @@ public:
|
||||||
TAreaId GetCurrentAreaId() const { return x4_areaId; }
|
TAreaId GetCurrentAreaId() const { return x4_areaId; }
|
||||||
const std::shared_ptr<CRelayTracker>& RelayTracker() const { return x8_relayTracker; }
|
const std::shared_ptr<CRelayTracker>& RelayTracker() const { return x8_relayTracker; }
|
||||||
const std::shared_ptr<CMapWorldInfo>& MapWorldInfo() const { return xc_mapWorldInfo; }
|
const std::shared_ptr<CMapWorldInfo>& MapWorldInfo() const { return xc_mapWorldInfo; }
|
||||||
const std::shared_ptr<CWorldSomethingState>& GetSomethingElse() const { return x14_; }
|
const std::shared_ptr<CWorldLayerState>& GetLayerState() const { return x14_layerState; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class CGameState
|
class CGameState
|
||||||
|
|
|
@ -36,7 +36,7 @@ bool CSaveWorldIntermediate::InitializePump()
|
||||||
|
|
||||||
ResId mlvlId = wld.IGetWorldAssetId();
|
ResId mlvlId = wld.IGetWorldAssetId();
|
||||||
CWorldState& mlvlState = g_GameState->StateForWorld(mlvlId);
|
CWorldState& mlvlState = g_GameState->StateForWorld(mlvlId);
|
||||||
x1c_ = mlvlState.GetSomethingElse()->x0_;
|
x1c_defaultLayerStates = mlvlState.GetLayerState()->x0_areaLayers;
|
||||||
|
|
||||||
x34_saveWorld = g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), x8_savwId});
|
x34_saveWorld = g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), x8_savwId});
|
||||||
x2c_dummyWorld.reset();
|
x2c_dummyWorld.reset();
|
||||||
|
@ -109,7 +109,7 @@ bool CMemoryCardSys::InitializePump()
|
||||||
wldMemOut.x4_savwId = world.x8_savwId;
|
wldMemOut.x4_savwId = world.x8_savwId;
|
||||||
wldMemOut.x0_strgId = world.x4_strgId;
|
wldMemOut.x0_strgId = world.x4_strgId;
|
||||||
wldMemOut.xc_areaIds = world.xc_areaIds;
|
wldMemOut.xc_areaIds = world.xc_areaIds;
|
||||||
wldMemOut.x1c_ = world.x1c_;
|
wldMemOut.x1c_defaultLayerStates = world.x1c_defaultLayerStates;
|
||||||
|
|
||||||
CSaveWorld& savw = *world.x34_saveWorld;
|
CSaveWorld& savw = *world.x34_saveWorld;
|
||||||
wldMemOut.x8_areaCount = savw.GetAreaCount();
|
wldMemOut.x8_areaCount = savw.GetAreaCount();
|
||||||
|
|
|
@ -18,8 +18,8 @@ class CSaveWorldMemory
|
||||||
ResId x0_strgId = -1;
|
ResId x0_strgId = -1;
|
||||||
ResId x4_savwId = -1;
|
ResId x4_savwId = -1;
|
||||||
u32 x8_areaCount;
|
u32 x8_areaCount;
|
||||||
std::vector<ResId> xc_areaIds; /* 4 byte element */
|
std::vector<ResId> xc_areaIds;
|
||||||
std::vector<u32> x1c_; /* 16 byte element */
|
std::vector<CWorldLayers::Area> x1c_defaultLayerStates;
|
||||||
TLockedToken<CStringTable> x2c_worldName; /* used to be optional */
|
TLockedToken<CStringTable> x2c_worldName; /* used to be optional */
|
||||||
TLockedToken<CSaveWorld> x3c_saveWorld; /* used to be optional */
|
TLockedToken<CSaveWorld> x3c_saveWorld; /* used to be optional */
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class CSaveWorldIntermediate
|
||||||
ResId x4_strgId;
|
ResId x4_strgId;
|
||||||
ResId x8_savwId;
|
ResId x8_savwId;
|
||||||
std::vector<ResId> xc_areaIds;
|
std::vector<ResId> xc_areaIds;
|
||||||
std::vector<u32> x1c_;
|
std::vector<CWorldLayers::Area> x1c_defaultLayerStates;
|
||||||
std::unique_ptr<CDummyWorld> x2c_dummyWorld;
|
std::unique_ptr<CDummyWorld> x2c_dummyWorld;
|
||||||
TLockedToken<CSaveWorld> x34_saveWorld; /* Used to be auto_ptr */
|
TLockedToken<CSaveWorld> x34_saveWorld; /* Used to be auto_ptr */
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,11 @@
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>&,
|
CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>& relayTracker,
|
||||||
const std::weak_ptr<CMapWorldInfo>&,
|
const std::weak_ptr<CMapWorldInfo>& mwInfo,
|
||||||
const std::weak_ptr<CPlayerState>&,
|
const std::weak_ptr<CPlayerState>& playerState,
|
||||||
const std::weak_ptr<CWorldTransManager>&)
|
const std::weak_ptr<CWorldTransManager>& wtMgr,
|
||||||
|
const std::weak_ptr<CWorldLayerState>& layerState)
|
||||||
: x80c_allObjs(new CObjectList(EGameObjectList::All)),
|
: x80c_allObjs(new CObjectList(EGameObjectList::All)),
|
||||||
x814_actorObjs(new CActorList()),
|
x814_actorObjs(new CActorList()),
|
||||||
x81c_physActorObjs(new CPhysicsActorList()),
|
x81c_physActorObjs(new CPhysicsActorList()),
|
||||||
|
@ -39,7 +40,12 @@ CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>&,
|
||||||
x82c_lightObjs(new CGameLightList()),
|
x82c_lightObjs(new CGameLightList()),
|
||||||
x834_listenAiObjs(new CListeningAiList()),
|
x834_listenAiObjs(new CListeningAiList()),
|
||||||
x83c_aiWaypointObjs(new CAiWaypointList()),
|
x83c_aiWaypointObjs(new CAiWaypointList()),
|
||||||
x844_platformAndDoorObjs(new CPlatformAndDoorList())
|
x844_platformAndDoorObjs(new CPlatformAndDoorList()),
|
||||||
|
x8b8_playerState(playerState),
|
||||||
|
x8bc_relayTracker(relayTracker),
|
||||||
|
x8c0_mapWorldInfo(mwInfo),
|
||||||
|
x8c4_worldTransManager(wtMgr),
|
||||||
|
x8c8_worldLayerState(layerState)
|
||||||
{
|
{
|
||||||
x86c_stateManagerContainer.reset(new CStateManagerContainer);
|
x86c_stateManagerContainer.reset(new CStateManagerContainer);
|
||||||
x870_cameraManager = &x86c_stateManagerContainer->x0_cameraManager;
|
x870_cameraManager = &x86c_stateManagerContainer->x0_cameraManager;
|
||||||
|
|
|
@ -42,6 +42,7 @@ class CFinalInput;
|
||||||
class CPlayer;
|
class CPlayer;
|
||||||
class CWorld;
|
class CWorld;
|
||||||
class CTexture;
|
class CTexture;
|
||||||
|
class CWorldLayerState;
|
||||||
|
|
||||||
struct SScriptObjectStream
|
struct SScriptObjectStream
|
||||||
{
|
{
|
||||||
|
@ -99,10 +100,10 @@ class CStateManager
|
||||||
std::shared_ptr<CRelayTracker> x8bc_relayTracker;
|
std::shared_ptr<CRelayTracker> x8bc_relayTracker;
|
||||||
std::shared_ptr<CMapWorldInfo> x8c0_mapWorldInfo;
|
std::shared_ptr<CMapWorldInfo> x8c0_mapWorldInfo;
|
||||||
std::shared_ptr<CWorldTransManager> x8c4_worldTransManager;
|
std::shared_ptr<CWorldTransManager> x8c4_worldTransManager;
|
||||||
|
std::shared_ptr<CWorldLayerState> x8c8_worldLayerState;
|
||||||
|
|
||||||
TAreaId x8c8_currentAreaId;
|
TAreaId x8cc_nextAreaId = 0;
|
||||||
TAreaId x8cc_nextAreaId;
|
TAreaId x8d0_prevAreaId = kInvalidAreaId;
|
||||||
TAreaId x8d0_prevAreaId;
|
|
||||||
//u32 x8d0_extFrameIdx = 0;
|
//u32 x8d0_extFrameIdx = 0;
|
||||||
//u32 x8d4_updateFrameIdx = 0;
|
//u32 x8d4_updateFrameIdx = 0;
|
||||||
//u32 x8d8_drawFrameIdx = 0;
|
//u32 x8d8_drawFrameIdx = 0;
|
||||||
|
@ -172,7 +173,8 @@ public:
|
||||||
CStateManager(const std::weak_ptr<CRelayTracker>&,
|
CStateManager(const std::weak_ptr<CRelayTracker>&,
|
||||||
const std::weak_ptr<CMapWorldInfo>&,
|
const std::weak_ptr<CMapWorldInfo>&,
|
||||||
const std::weak_ptr<CPlayerState>&,
|
const std::weak_ptr<CPlayerState>&,
|
||||||
const std::weak_ptr<CWorldTransManager>&);
|
const std::weak_ptr<CWorldTransManager>&,
|
||||||
|
const std::weak_ptr<CWorldLayerState>&);
|
||||||
|
|
||||||
bool RenderLast(TUniqueId);
|
bool RenderLast(TUniqueId);
|
||||||
void AddDrawableActor(const CActor& actor, const zeus::CVector3f& vec, const zeus::CAABox& aabb) const;
|
void AddDrawableActor(const CActor& actor, const zeus::CVector3f& vec, const zeus::CAABox& aabb) const;
|
||||||
|
@ -286,7 +288,8 @@ public:
|
||||||
CRelayTracker* GetRelayTracker() { return x8bc_relayTracker.get(); }
|
CRelayTracker* GetRelayTracker() { return x8bc_relayTracker.get(); }
|
||||||
CCameraManager* GetCameraManager() const { return x870_cameraManager; }
|
CCameraManager* GetCameraManager() const { return x870_cameraManager; }
|
||||||
|
|
||||||
std::shared_ptr<CMapWorldInfo> MapWorldInfo() { return x8c0_mapWorldInfo; }
|
const std::shared_ptr<CMapWorldInfo>& MapWorldInfo() const { return x8c0_mapWorldInfo; }
|
||||||
|
const std::shared_ptr<CWorldLayerState>& LayerState() const { return x8c8_worldLayerState; }
|
||||||
|
|
||||||
bool IsLayerActive(TAreaId area, int layerIdx) { return false; }
|
bool IsLayerActive(TAreaId area, int layerIdx) { return false; }
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,11 @@ CMFGameLoader::CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMFGameLoader::MakeLoadDependencyList()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
|
CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
|
||||||
{
|
{
|
||||||
std::shared_ptr<CWorldTransManager> wtMgr = g_GameState->GetWorldTransitionManager();
|
std::shared_ptr<CWorldTransManager> wtMgr = g_GameState->GetWorldTransitionManager();
|
||||||
|
@ -55,6 +60,17 @@ CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg,
|
||||||
case EArchMsgType::TimerTick:
|
case EArchMsgType::TimerTick:
|
||||||
{
|
{
|
||||||
const CArchMsgParmReal32& tick = MakeMsg::GetParmTimerTick(msg);
|
const CArchMsgParmReal32& tick = MakeMsg::GetParmTimerTick(msg);
|
||||||
|
float dt = tick.x4_parm;
|
||||||
|
if (!x2c_24_initialized)
|
||||||
|
{
|
||||||
|
if (x1c_.empty())
|
||||||
|
MakeLoadDependencyList();
|
||||||
|
wtMgr->StartTransition();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wtMgr->Update(dt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -45,12 +45,14 @@ class CMFGameLoader : public CMFGameLoaderBase
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool x2c_24_ : 1;
|
bool x2c_24_initialized : 1;
|
||||||
bool x2c_25_ : 1;
|
bool x2c_25_ : 1;
|
||||||
};
|
};
|
||||||
u8 _dummy = 0;
|
u8 _dummy = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void MakeLoadDependencyList();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMFGameLoader();
|
CMFGameLoader();
|
||||||
EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue);
|
EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue);
|
||||||
|
|
|
@ -367,7 +367,6 @@ void CWorldTransManager::EnableTransition(const CAnimRes& samusRes,
|
||||||
else
|
else
|
||||||
x1c_bgHeight = 0.f;
|
x1c_bgHeight = 0.f;
|
||||||
|
|
||||||
StartTransition();
|
|
||||||
TouchModels();
|
TouchModels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +390,6 @@ void CWorldTransManager::EnableTransition(ResId fontId, ResId stringId, bool b1,
|
||||||
x8_textData->SetTypeWriteEffectOptions(true, chFadeTime, chFadeRate);
|
x8_textData->SetTypeWriteEffectOptions(true, chFadeTime, chFadeRate);
|
||||||
xc_strTable = g_SimplePool->GetObj(SObjectTag{FOURCC('STRG'), stringId});
|
xc_strTable = g_SimplePool->GetObj(SObjectTag{FOURCC('STRG'), stringId});
|
||||||
x8_textData->SetText(L"");
|
x8_textData->SetText(L"");
|
||||||
StartTransition();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorldTransManager::DisableTransition()
|
void CWorldTransManager::DisableTransition()
|
||||||
|
|
2
amuse
2
amuse
|
@ -1 +1 @@
|
||||||
Subproject commit 7cb7ed73ea2b91227b55fae206ffbc86a82a4844
|
Subproject commit 3fd3f3edc51e1d1de74bdb62907cb4ff333995ad
|
Loading…
Reference in New Issue