CActorContraption fixes, better CMake dependency handling

This commit is contained in:
Jack Andersen 2019-06-11 16:05:17 -10:00
parent 77d0ef942d
commit e218b8aeb5
295 changed files with 942 additions and 2219 deletions

3
.gitmodules vendored
View File

@ -25,9 +25,6 @@
[submodule "sanitizers-cmake"]
path = sanitizers-cmake
url = https://github.com/arsenm/sanitizers-cmake.git
[submodule "cotire"]
path = cotire
url = https://github.com/sakra/cotire.git
[submodule "discord-rpc"]
path = discord-rpc
url = https://github.com/discordapp/discord-rpc.git

View File

@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
cmake_policy(SET CMP0079 NEW)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries)
@ -33,7 +34,7 @@ if(CMAKE_CROSSCOMPILING)
set(HAVE_WORDS_BIGENDIAN_EXITCODE 0 CACHE INTEGER "Makes soxr happy" FORCE)
endif()
project(urde)
project(urde VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -43,11 +44,6 @@ set(BUILD_STATIC_LIBS ON CACHE BOOL "Force static libs on" FORCE)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sanitizers-cmake/cmake" "${CMAKE_SOURCE_DIR}/cotire/CMake" ${CMAKE_MODULE_PATH})
find_package(Sanitizers)
# Don't cotire when using clang-cl
if(NOT URDE_MSAN AND (NOT MSVC OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC"))
include(cotire)
endif()
if (NX)
set(URDE_VECTOR_ISA "neon")
else()
@ -56,16 +52,15 @@ endif()
if(MSVC)
if(${URDE_VECTOR_ISA} STREQUAL "avx2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2 -D__SSE4_1__=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:AVX2 -D__SSE4_1__=1")
add_compile_options(/arch:AVX2)
add_definitions(-D__SSE4_1__=1)
message(STATUS "Building with AVX2 Vector ISA")
elseif(${URDE_VECTOR_ISA} STREQUAL "avx")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX -D__SSE4_1__=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:AVX -D__SSE4_1__=1")
add_compile_options(/arch:AVX)
add_definitions(-D__SSE4_1__=1)
message(STATUS "Building with AVX Vector ISA")
elseif(${URDE_VECTOR_ISA} STREQUAL "sse41")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__SSE4_1__=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__SSE4_1__=1")
add_definitions(-D__SSE4_1__=1)
message(STATUS "Building with SSE4.1 Vector ISA")
else()
message(STATUS "Building with SSE2 Vector ISA")
@ -105,24 +100,19 @@ if(MSVC)
else()
if(${URDE_VECTOR_ISA} STREQUAL "avx2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2")
add_compile_options(-mavx2)
message(STATUS "Building with AVX2 Vector ISA")
elseif(${URDE_VECTOR_ISA} STREQUAL "avx")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx")
add_compile_options(-mavx)
message(STATUS "Building with AVX Vector ISA")
elseif(${URDE_VECTOR_ISA} STREQUAL "sse41")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1")
add_compile_options(-msse4.1)
message(STATUS "Building with SSE4.1 Vector ISA")
elseif(${URDE_VECTOR_ISA} STREQUAL "sse3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse3")
add_compile_options(-msse3)
message(STATUS "Building with SSE3 Vector ISA")
elseif(${URDE_VECTOR_ISA} STREQUAL "sse2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2")
add_compile_options(-msse2)
message(STATUS "Building with SSE2 Vector ISA")
elseif(${URDE_VECTOR_ISA} STREQUAL "neon")
message(STATUS "Building with NEON Vector ISA")
@ -133,19 +123,17 @@ else()
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fno-plt HAS_NO_PLT)
if (HAS_NO_PLT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-plt")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-plt")
add_compile_options(-fno-plt)
endif()
if(URDE_MSAN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-stdlib=libc++ -fsanitize=memory -fsanitize-memory-track-origins -fsanitize-recover=all")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
-fsanitize=memory -fsanitize-memory-track-origins -fsanitize-recover=all")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
add_compile_options(-fsanitize=memory -fsanitize-memory-track-origins -fsanitize-recover=all)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-multichar -Werror=implicit-fallthrough \
-Wno-unknown-warning-option -Wno-lto-type-mismatch -Wno-unused-variable -Wno-unused-private-field \
-Wno-unused-function -fno-exceptions -fno-rtti -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
add_compile_options(-Wall -Wno-multichar -Werror=implicit-fallthrough -Wno-unknown-warning-option
-Wno-lto-type-mismatch -Wno-unused-variable -Wno-unused-private-field
-Wno-unused-function -Wno-sign-compare -Wno-unknown-pragmas -fno-exceptions -Werror)
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-declarations")
@ -158,8 +146,8 @@ else()
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
include_directories(/usr/local/include)
link_directories(/usr/local/lib)
include_directories(/usr/local/include)
link_directories(/usr/local/lib)
endif()
if(("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
@ -173,8 +161,7 @@ if(USE_LD_GOLD AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_
if("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto=thin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto=thin")
add_compile_options(-flto=thin)
message(STATUS "GNU gold linker enabled.")
else()
message(WARNING "GNU gold linker isn't available, using the default system linker.")
@ -184,27 +171,19 @@ endif()
# Add discord-rpc here
if(NOT GEKKO AND NOT NX)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/include)
set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/discord-rpc)
if (NOT CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR ${CMAKE_BINARY_DIR}/fake-prefix)
endif()
add_subdirectory(discord-rpc/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/discord-rpc/include)
target_include_directories(discord-rpc PRIVATE rapidjson/include PUBLIC discord-rpc/include)
endif()
add_subdirectory(nod)
set(NOD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/nod/include)
set(HECL_DLPACKAGE ${URDE_DLPACKAGE})
set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hecl/extern/boo/include)
set(HECL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hecl/include
${CMAKE_CURRENT_SOURCE_DIR}/hecl/blender)
set(SPECTER_INCLUDE_DIR specter/include specter/freetype2/include)
set(ZEUS_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/specter/zeus/include)
set(DATA_SPEC_LIBS RetroDataSpec amuse)
set(DATA_SPEC_LIBS RetroDataSpec)
set(HECL_DATASPEC_DECLS
"/* RetroCommon specs */
namespace DataSpec
@ -231,14 +210,16 @@ set(HECL_DATASPEC_PUSHES
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3);
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3PC);
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3ORIG);")
add_definitions(-DZE_ATHENA_TYPES=1)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${SPECTER_INCLUDE_DIR} ${NOD_INCLUDE_DIR}
${ZEUS_INCLUDE_DIR})
add_subdirectory(hecl/shaderc)
include(hecl/ApplicationTools.cmake)
add_subdirectory(specter/shaders)
add_subdirectory(Shaders)
add_subdirectory(hecl)
target_include_directories(hecl-full PRIVATE ${CMAKE_SOURCE_DIR})
target_include_directories(hecl-light PRIVATE ${CMAKE_SOURCE_DIR})
target_link_libraries(hecl-full PRIVATE zeus nod)
target_link_libraries(hecl-light PRIVATE zeus nod)
if(NOT TARGET bintoc)
# Use native if cross compiling
@ -258,6 +239,7 @@ add_library(CModelShaders
CModelShaders.common.glsl.cpp CModelShaders.vert.glsl.cpp CModelShaders.frag.glsl.cpp
CModelShaders.common.hlsl.cpp CModelShaders.vert.hlsl.cpp CModelShaders.frag.hlsl.cpp
CModelShaders.common.metal.cpp CModelShaders.vert.metal.cpp CModelShaders.frag.metal.cpp)
target_link_libraries(shader_CModelShaders PUBLIC CModelShaders)
if(NOT TARGET atdna)
# Import native atdna if cross-compiling
@ -267,19 +249,14 @@ if(NOT TARGET atdna)
endif()
endif()
add_definitions(${BOO_SYS_DEFINES})
include_directories(${BOO_SYS_INCLUDES})
add_subdirectory(amuse)
add_subdirectory(specter)
target_include_directories(specter PRIVATE ${CMAKE_SOURCE_DIR})
target_link_libraries(specter PRIVATE nod)
add_subdirectory(assetnameparser)
include_directories(${ATHENA_INCLUDE_DIR} ${LOGVISOR_INCLUDE_DIR} ${HECL_INCLUDE_DIR}
${BOO_INCLUDE_DIR} ${AMUSE_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/NESEmulator
${ZLIB_INCLUDE_DIR})
add_definitions(-DURDE_ZIP_INPUT_STREAM=1) # Enable CZipInputStream now that zlib header is known
add_subdirectory(NESEmulator)
add_subdirectory(DataSpec)
add_subdirectory(kabufuda)
include_directories(${KABUFUDA_INCLUDE_DIR})
add_subdirectory(Editor)
add_subdirectory(jbus)
@ -290,6 +267,7 @@ set(CLIENT_SOURCES
${CMAKE_SOURCE_DIR}/Editor/ProjectResourceFactoryBase.cpp
${CMAKE_SOURCE_DIR}/Editor/ProjectResourceFactoryMP1.hpp
${CMAKE_SOURCE_DIR}/Editor/ProjectResourceFactoryMP1.cpp)
add_subdirectory(NESEmulator)
add_subdirectory(Runtime)
add_subdirectory(mpcksum)
add_subdirectory(gbalink)
@ -311,7 +289,7 @@ unset(GIT_EXECUTABLE CACHE)
find_package(Git)
if(GIT_FOUND)
# Get the current working branch
execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
execute_process(COMMAND "${GIT_EXECUTABLE}" regiv-parse --abbrev-ref HEAD WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE )
# Get the latest abbreviated commit hash of the working branch
@ -329,4 +307,4 @@ else()
set(GIT_COMMIT_DATE "")
endif()
configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_SOURCE_DIR}/version.h)
configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_BINARY_DIR}/version.h)

View File

@ -1,19 +1,17 @@
include_directories(${LIBPNG_INCLUDE_DIR} ${SQUISH_INCLUDE_DIR})
# Assembles a source/header pair list for use in a DNA library
macro(make_dnalist outlist subdir)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${subdir}")
macro(make_dnalist)
file(RELATIVE_PATH subdir "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_LIST_DIR}")
set(CMAKE_CURRENT_LIST_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${subdir}")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_LIST_BINARY_DIR}")
foreach(type ${ARGN})
get_filename_component(dir ${type} DIRECTORY)
if(dir)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${subdir}/${dir}")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_LIST_BINARY_DIR}/${dir}")
set(dir "${dir}/")
endif()
get_filename_component(name ${type} NAME)
atdna("${subdir}/${dir}atdna_${name}.cpp" "${subdir}/${dir}${name}.hpp")
list(APPEND ${outlist}
${subdir}/${dir}atdna_${name}.cpp
${subdir}/${dir}${name}.hpp)
list(APPEND DNA_SOURCES "${subdir}/${dir}atdna_${name}.cpp")
list(APPEND DNA_HEADERS "${subdir}/${dir}${name}.hpp")
endforeach()
endmacro()
@ -30,9 +28,9 @@ macro(dataspec_add_list rel_path a_list)
set(${a_list} "${tmp_list}")
endmacro(dataspec_add_list)
include_directories(${ZLIB_INCLUDE_DIR} ${LZOKAY_INCLUDE_DIR})
# Each game's DNA library
unset(DNA_SOURCES)
unset(DNA_HEADERS)
include(DNACommon/CMakeLists.txt)
include(DNAMP1/CMakeLists.txt)
include(DNAMP2/CMakeLists.txt)
@ -70,10 +68,22 @@ add_library(RetroDataSpec
AssetNameMap32.bin AssetNameMap32.cpp
AssetNameMap64.bin AssetNameMap64.cpp
RetroMasterShader.cpp)
get_target_property(HECL_INCLUDES hecl-full INCLUDE_DIRECTORIES)
target_include_directories(RetroDataSpec PUBLIC ${LIBPNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}
${HECL_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR})
target_link_libraries(RetroDataSpec PUBLIC amuse zeus nod specter squish ${PNG_LIB} ${ZLIB_LIBRARIES} lzokay logvisor)
if(COMMAND add_sanitizers)
add_sanitizers(RetroDataSpec)
endif()
if(COMMAND cotire)
set_target_properties(RetroDataSpec PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
cotire(RetroDataSpec)
endif()
# Resolve all DNA sources into target
list(LENGTH DNA_SOURCES count)
math(EXPR count "${count}-1")
foreach(i RANGE ${count})
list(GET DNA_SOURCES ${i} src)
list(GET DNA_HEADERS ${i} header)
target_atdna(RetroDataSpec ${src} ${header})
endforeach()
add_custom_target(genexdebug COMMAND ${CMAKE_COMMAND} -E echo "$<TARGET_PROPERTY:RetroDataSpec,INCLUDE_DIRECTORIES>")

View File

@ -101,8 +101,8 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
"bpy.context.scene.hecl_mesh_obj = bpy.context.scene.name\n"
"\n"
"# Clear Scene\n"
"if 'Collection 1' in bpy.data.collections:\n"
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n"
"if len(bpy.data.collections):\n"
" bpy.data.collections.remove(bpy.data.collections[0])\n"
"\n"
"actor_data = bpy.context.scene.hecl_sact_data\n"
"arm_obj = None\n",

View File

@ -59,7 +59,7 @@ bool AROTBuilder::Node::compareSets(int a, int b) const {
void AROTBuilder::Node::addChild(int level, int minChildren, const std::vector<zeus::CAABox>& triBoxes,
const zeus::CAABox& curAABB, BspNodeType& typeOut) {
/* Gather intersecting faces */
for (int i = 0; i < triBoxes.size(); ++i)
for (size_t i = 0; i < triBoxes.size(); ++i)
if (triBoxes[i].intersects(curAABB))
childIndices.insert(i);
@ -343,7 +343,7 @@ void AROTBuilder::build(std::vector<std::vector<uint8_t>>& secs, const zeus::CAA
auto bmpIt = bmp.cbegin();
if (bmpIt != bmp.cend()) {
int curIdx = 0;
for (int w = 0; w < bmpWordCount; ++w) {
for (size_t w = 0; w < bmpWordCount; ++w) {
for (int b = 0; b < 32; ++b) {
if (*bmpIt == curIdx) {
bmpWords[w] |= 1 << b;

View File

@ -75,7 +75,7 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os, const BabeDeadLi
"lamp_obj.location = (%f,%f,%f)\n"
"bpy.context.scene.collection.objects.link(lamp_obj)\n"
"\n",
s, light.lightType, light.q / 8.f, light.color.simd[0], light.color.simd[1], light.color.simd[2],
s, unsigned(light.lightType), light.q / 8.f, light.color.simd[0], light.color.simd[1], light.color.simd[2],
light.position.simd[0], light.position.simd[1], light.position.simd[2]);
switch (light.falloff) {

View File

@ -377,8 +377,8 @@ void InitGeomBlenderContext(hecl::blender::PyOutStream& os, const hecl::ProjectP
"from mathutils import Vector\n"
"\n"
"# Clear Scene\n"
"if 'Collection 1' in bpy.data.collections:\n"
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n"
"if len(bpy.data.collections):\n"
" bpy.data.collections.remove(bpy.data.collections[0])\n"
"\n"
"def loop_from_facevert(bm, face, vert_idx):\n"
" for loop in face.loops:\n"

View File

@ -1,5 +1,4 @@
make_dnalist(liblist DNACommon
CMDL
make_dnalist(CMDL
FONT
DGRP
FSM2
@ -54,4 +53,3 @@ set(DNACOMMON_SOURCES
Tweaks/ITweakGuiColors.hpp)
dataspec_add_list(DNACommon DNACOMMON_SOURCES)
list(APPEND DNACOMMON_SOURCES ${liblist})

View File

@ -91,7 +91,7 @@ void CRSM<IDType>::_write(athena::io::YAMLDocWriter& w) const {
pair.second.write(w);
for (const auto& pair : x10_sfx)
if (pair.second != ~0)
if (pair.second != UINT32_MAX)
w.writeUint32(pair.first.toString().c_str(), pair.second);
for (const auto& pair : x20_decals)
@ -115,7 +115,7 @@ void CRSM<IDType>::_binarySize(size_t& __isz) const {
}
}
for (const auto& pair : x10_sfx) {
if (pair.second != ~0)
if (pair.second != UINT32_MAX)
__isz += 12;
}
@ -193,7 +193,7 @@ void CRSM<IDType>::_write(athena::io::IStreamWriter& w) const {
for (const auto& pair : x10_sfx) {
w.writeBytes(pair.first.getChars(), 4);
if (pair.second != ~0) {
if (pair.second != UINT32_MAX) {
w.writeBytes("CNST", 4);
w.writeUint32Big(pair.second);
} else {

View File

@ -3,7 +3,7 @@
#include "ParticleCommon.hpp"
#include "PAK.hpp"
#include "athena/FileWriter.hpp"
#include "optional.hpp"
#include <optional>
namespace DataSpec::DNAParticle {
template <class IDType>

View File

@ -121,8 +121,8 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
"name='Retro: Map Object Visibility Mode')\n"
"\n"
"# Clear Scene\n"
"if 'Collection 1' in bpy.data.collections:\n"
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n"
"if len(bpy.data.collections):\n"
" bpy.data.collections.remove(bpy.data.collections[0])\n"
"\n"
"def add_triangle(bm, verts):\n"
" verts = [bm.verts[vi] for vi in verts]\n"
@ -167,8 +167,9 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
"obj.location = mtxd[0]\n"
"obj.rotation_quaternion = mtxd[1]\n"
"obj.scale = mtxd[2]\n",
moIdx, moMP12->type, RetroMapObjVisModes[moMP12->visMode], moMP12->sclyId, mtxF[0][0], mtxF[0][1], mtxF[0][2],
mtxF[0][3], mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], mtxF[2][0], mtxF[2][1], mtxF[2][2], mtxF[2][3]);
moIdx, int(moMP12->type), RetroMapObjVisModes[moMP12->visMode], moMP12->sclyId, mtxF[0][0], mtxF[0][1],
mtxF[0][2], mtxF[0][3], mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], mtxF[2][0], mtxF[2][1], mtxF[2][2],
mtxF[2][3]);
++moIdx;
continue;
} else {
@ -188,8 +189,9 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
"obj.location = mtxd[0]\n"
"obj.rotation_quaternion = mtxd[1]\n"
"obj.scale = mtxd[2]\n",
moIdx, moMP3->type, RetroMapObjVisModes[moMP3->visMode], moMP3->sclyId, mtxF[0][0], mtxF[0][1], mtxF[0][2],
mtxF[0][3], mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], mtxF[2][0], mtxF[2][1], mtxF[2][2], mtxF[2][3]);
moIdx, int(moMP3->type), RetroMapObjVisModes[moMP3->visMode], moMP3->sclyId, mtxF[0][0], mtxF[0][1],
mtxF[0][2], mtxF[0][3], mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], mtxF[2][0], mtxF[2][1], mtxF[2][2],
mtxF[2][3]);
++moIdx;
continue;
}

View File

@ -21,8 +21,8 @@ bool ReadMAPUToBlender(hecl::blender::Connection& conn, const MAPU& mapu, const
"from mathutils import Matrix\n"
"\n"
"# Clear Scene\n"
"if 'Collection 1' in bpy.data.collections:\n"
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n"
"if len(bpy.data.collections):\n"
" bpy.data.collections.remove(bpy.data.collections[0])\n"
"\n"
"bpy.types.Object.retro_mapworld_color = bpy.props.FloatVectorProperty(name='Retro: MapWorld Color',"
" description='Sets map world color', subtype='COLOR', size=4, min=0.0, max=1.0)\n"

View File

@ -25,8 +25,8 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn, const MLVL& mlvl, const
"bpy.context.scene.name = 'World'\n"
"\n"
"# Clear Scene\n"
"if 'Collection 1' in bpy.data.collections:\n"
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n";
"if len(bpy.data.collections):\n"
" bpy.data.collections.remove(bpy.data.collections[0])\n";
/* Insert area empties */
int areaIdx = 0;

View File

@ -17,7 +17,7 @@ struct FittedOBB {
static std::vector<int> MakeRootTriangleIndex(const ColMesh& mesh) {
std::vector<int> ret;
ret.reserve(mesh.trianges.size());
for (int i = 0; i < mesh.trianges.size(); ++i)
for (size_t i = 0; i < mesh.trianges.size(); ++i)
ret.push_back(i);
return ret;
}

View File

@ -370,7 +370,7 @@ hecl::SystemString PAKRouter<BRIDGETYPE>::getResourceRelativePath(const EntryTyp
return hecl::SystemString();
hecl::ProjectPath aPath = getWorking(&a, BRIDGETYPE::LookupExtractor(*node, *pak, a));
hecl::SystemString ret;
for (int i = 0; i < aPath.levelCount(); ++i)
for (size_t i = 0; i < aPath.levelCount(); ++i)
ret += _SYS_STR("../");
hecl::ProjectPath bPath = getWorking(be, BRIDGETYPE::LookupExtractor(*node, *pak, *be));
ret += bPath.getRelativePath();

View File

@ -49,7 +49,7 @@ template <>
void VEConstant::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r) {
size_t elemCount;
if (auto v = r.enterSubVector(nullptr, elemCount)) {
for (int i = 0; i < 3 && i < elemCount; ++i) {
for (size_t i = 0; i < 3 && i < elemCount; ++i) {
if (auto rec = r.enterSubRecord(nullptr))
comps[i].read(r);
}

View File

@ -12,7 +12,7 @@ RigInverter<CINFType>::Bone::Bone(const CINFType& cinf, const typename CINFType:
atUint32 parentIdx = cinf.getInternalBoneIdxFromId(origBone.parentId);
zeus::CVector3f boneOrigin(origBone.origin);
zeus::CVector3f naturalTail = boneOrigin + zeus::CVector3f{0.f, 0.5f, 0.f};
if (parentIdx != -1) {
if (parentIdx != UINT32_MAX) {
const typename CINFType::Bone& pBone = cinf.bones[parentIdx];
m_parentDelta = boneOrigin - zeus::CVector3f(pBone.origin);
}
@ -22,7 +22,7 @@ RigInverter<CINFType>::Bone::Bone(const CINFType& cinf, const typename CINFType:
if (chId == origBone.parentId)
continue;
atUint32 chIdx = cinf.getInternalBoneIdxFromId(chId);
if (chIdx != -1)
if (chIdx != UINT32_MAX)
++actualChildren;
}
@ -31,7 +31,7 @@ RigInverter<CINFType>::Bone::Bone(const CINFType& cinf, const typename CINFType:
if (bName)
isLCTR = bName->find("_LCTR") != std::string::npos;
if (parentIdx == -1) {
if (parentIdx == UINT32_MAX) {
/* Root will always use +Y tail */
m_tail = naturalTail;
} else if (actualChildren) {
@ -40,7 +40,7 @@ RigInverter<CINFType>::Bone::Bone(const CINFType& cinf, const typename CINFType:
if (chId == origBone.parentId)
continue;
atUint32 chIdx = cinf.getInternalBoneIdxFromId(chId);
if (chIdx != -1) {
if (chIdx != UINT32_MAX) {
const typename CINFType::Bone& chBone = cinf.bones[chIdx];
m_tail += chBone.origin;
}
@ -50,7 +50,7 @@ RigInverter<CINFType>::Bone::Bone(const CINFType& cinf, const typename CINFType:
m_tail = naturalTail;
else if (isLCTR)
m_tail = boneOrigin + zeus::CVector3f{0.f, 1.0f, 0.f} * (m_tail - boneOrigin).magnitude();
} else if (parentIdx != -1) {
} else if (parentIdx != UINT32_MAX) {
/* Extrapolate by delta with parent */
m_tail = boneOrigin + m_parentDelta;
float deltaMag = m_parentDelta.magnitude();
@ -91,8 +91,8 @@ RigInverter<CINFType>::RigInverter(const CINFType& cinf,
auto search = matrices.find(*name);
if (search != matrices.cend()) {
zeus::CMatrix3f boneMtx(search->second[0], search->second[1], search->second[2]);
m_bones.back().m_inverter = boneMtx.transposed();
m_bones.back().m_restorer = boneMtx;
m_bones.back().m_inverter = m_bones.back().m_restorer.inverse();
}
}
}
@ -102,7 +102,7 @@ template <class CINFType>
zeus::CQuaternion RigInverter<CINFType>::invertRotation(atUint32 boneId, const zeus::CQuaternion& origRot) const {
for (const Bone& b : m_bones)
if (b.m_origBone.id == boneId)
return b.m_restorer * zeus::CMatrix3f(origRot) * b.m_inverter;
return b.m_restorer * origRot * b.m_inverter;
return origRot;
}
@ -114,7 +114,7 @@ zeus::CVector3f RigInverter<CINFType>::invertPosition(atUint32 boneId, const zeu
zeus::CVector3f localPos = origPos;
if (subDelta)
localPos -= b.m_parentDelta;
return b.m_restorer * localPos;
return b.m_restorer.transform(localPos);
}
return origPos;
}
@ -123,7 +123,7 @@ template <class CINFType>
zeus::CQuaternion RigInverter<CINFType>::restoreRotation(atUint32 boneId, const zeus::CQuaternion& origRot) const {
for (const Bone& b : m_bones)
if (b.m_origBone.id == boneId)
return b.m_inverter * zeus::CMatrix3f(origRot) * b.m_restorer;
return b.m_inverter * origRot * b.m_restorer;
return origRot;
}
@ -132,7 +132,7 @@ zeus::CVector3f RigInverter<CINFType>::restorePosition(atUint32 boneId, const ze
bool subDelta) const {
for (const Bone& b : m_bones)
if (b.m_origBone.id == boneId) {
zeus::CVector3f localPos = b.m_inverter * origPos;
zeus::CVector3f localPos = b.m_inverter.transform(origPos);
if (subDelta)
localPos += b.m_parentDelta;
return localPos;

View File

@ -15,8 +15,8 @@ class RigInverter {
public:
struct Bone {
const typename CINFType::Bone& m_origBone;
zeus::CMatrix3f m_inverter;
zeus::CMatrix3f m_restorer;
zeus::CQuaternion m_inverter;
zeus::CQuaternion m_restorer;
zeus::CVector3f m_tail;
zeus::CVector3f m_parentDelta;
Bone(const CINFType& cinf, const typename CINFType::Bone& origBone);

View File

@ -1148,7 +1148,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
bool doDXT1 = (colorType == PNG_COLOR_TYPE_RGB || colorType == PNG_COLOR_TYPE_RGB_ALPHA) && width >= 4 && height >= 4;
/* Read into mip0 image buffer */
for (int r = 0; r < height; ++r) {
for (png_uint_32 r = 0; r < height; ++r) {
if (colorType == PNG_COLOR_TYPE_RGB) {
png_read_row(pngRead, rowBuf.get(), nullptr);
for (unsigned i = 0; i < width; ++i) {
@ -1175,7 +1175,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
fclose(inf);
/* Reduce mipmaps to minimum allowed dimensions */
int minDimX, minDimY;
unsigned minDimX, minDimY;
if (doDXT1) {
minDimX = minDimY = 4;
} else {
@ -1601,7 +1601,7 @@ static const atInt32 RetroToDol[11] {
std::string TXTR::CalculateDolphinName(DataSpec::PAKEntryReadStream& rs) {
atUint32 format = RetroToDol[rs.readUint32Big()];
if (format == -1)
if (format == UINT32_MAX)
return {};
atUint16 width = rs.readUint16Big();

View File

@ -205,7 +205,7 @@ void WPSM<IDType>::_write(athena::io::YAMLDocWriter& w) const {
if (!xa6_SWTR)
if (auto rec = w.enterSubRecord("SWTR"))
xa6_SWTR.write(w);
if (xa8_PJFX != ~0)
if (xa8_PJFX != UINT32_MAX)
w.writeUint32("PJFX", xa8_PJFX);
if (xac_RNGE)
if (auto rec = w.enterSubRecord("RNGE"))
@ -339,7 +339,7 @@ void WPSM<IDType>::_binarySize(size_t& __isz) const {
__isz += 4;
xa6_SWTR.binarySize(__isz);
}
if (xa8_PJFX != ~0)
if (xa8_PJFX != UINT32_MAX)
__isz += 12;
if (xac_RNGE) {
__isz += 4;
@ -606,7 +606,7 @@ void WPSM<IDType>::_write(athena::io::IStreamWriter& w) const {
w.writeBytes("SWTR", 4);
xa6_SWTR.write(w);
}
if (xa8_PJFX != ~0) {
if (xa8_PJFX != UINT32_MAX) {
w.writeBytes("PJFXCNST", 8);
w.writeUint32(xa8_PJFX);
}

View File

@ -1376,8 +1376,8 @@ bool ANCS::CookANIM(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i
/* Build bone ID map */
std::unordered_map<std::string, atInt32> boneIdMap;
std::experimental::optional<CINF> rigCinf;
std::experimental::optional<DNAANIM::RigInverter<CINF>> rigInv;
std::optional<CINF> rigCinf;
std::optional<DNAANIM::RigInverter<CINF>> rigInv;
for (const DNAANCS::Armature& arm : actor.armatures) {
if (!rigInv) {
rigCinf.emplace(arm, boneIdMap);

View File

@ -256,7 +256,7 @@ template <class MAT>
static uint32_t _HashTextureConfig(const MAT& mat) {
XXH32_state_t xxHash;
XXH32_reset(&xxHash, 0);
for (int i = 0; i < mat.tevStageCount; ++i) {
for (uint32_t i = 0; i < mat.tevStageCount; ++i) {
const auto& stage = mat.tevStages[i];
XXH32_update(&xxHash, &stage.ciFlags, sizeof(stage.ciFlags));
XXH32_update(&xxHash, &stage.aiFlags, sizeof(stage.aiFlags));
@ -352,7 +352,7 @@ static const char* ToString(GX::TevRegID arg) {
template <class MAT>
static void _DescribeTEV(const MAT& mat) {
for (int i = 0; i < mat.tevStageCount; ++i) {
for (uint32_t i = 0; i < mat.tevStageCount; ++i) {
const auto& stage = mat.tevStages[i];
fprintf(stderr, "A:%s B:%s C:%s D:%s -> %s | A:%s B:%s C:%s D:%s -> %s\n",
ToString(stage.colorInA()), ToString(stage.colorInB()),

View File

@ -1,8 +1,7 @@
include(DNAMP1/ScriptObjects/CMakeLists.txt)
include(DNAMP1/SFX/CMakeLists.txt)
make_dnalist(liblist DNAMP1
PAK
make_dnalist(PAK
MLVL
AGSC
CSNG
@ -68,4 +67,3 @@ set(DNAMP1_SOURCES
Tweaks/CTweakGame.cpp)
dataspec_add_list(DNAMP1 DNAMP1_SOURCES)
list(APPEND DNAMP1_SOURCES ${liblist})

View File

@ -39,11 +39,11 @@ bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
hecl::ProjectPath audGrp(outPath.getParentPath().getParentPath(), _SYS_STR("AudioGrp"));
audGrp.makeDirChain(true);
hecl::ProjectPath songsPath(audGrp, _SYS_STR("!songs.yaml"));
std::experimental::optional<athena::io::FileReader> r;
std::optional<athena::io::FileReader> r;
if (songsPath.isFile())
r.emplace(songsPath.getAbsolutePath());
athena::io::YAMLDocWriter ydw("amuse::Songs", r ? &*r : nullptr);
r = std::experimental::nullopt;
r = std::nullopt;
char id[16];
snprintf(id, 16, "%04X", head.midiSetupId);
ydw.writeString(id, hecl::Format("../MidiData/%s", midPath.getLastComponentUTF8().data()));

View File

@ -37,8 +37,8 @@ void DCLN::sendToBlender(hecl::blender::Connection& conn, std::string_view entry
"\n"
"bpy.context.scene.name = '%s'\n"
"# Clear Scene\n"
"if 'Collection 1' in bpy.data.collections:\n"
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n",
"if len(bpy.data.collections):\n"
" bpy.data.collections.remove(bpy.data.collections[0])\n",
entryName.data());
DeafBabe::BlenderInit(os);

View File

@ -292,8 +292,8 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
os << "import bpy, math, bmesh\n"
"from mathutils import Matrix, Quaternion\n"
"# Clear Scene\n"
"if 'Collection 1' in bpy.data.collections:\n"
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n"
"if len(bpy.data.collections):\n"
" bpy.data.collections.remove(bpy.data.collections[0])\n"
"\n"
"def duplicateObject(copy_obj):\n"
" # Create new mesh\n"
@ -438,7 +438,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
"verts = []\n",
w.header.name.c_str());
for (int i = 0; i < info->quadCoordCount; ++i) {
for (uint32_t i = 0; i < info->quadCoordCount; ++i) {
int ti;
if (i == 2)
ti = 3;
@ -452,7 +452,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
os << "bm.faces.new(verts)\n"
"bm.loops.layers.uv.new('UV')\n"
"bm.verts.ensure_lookup_table()\n";
for (int i = 0; i < info->uvCoordCount; ++i) {
for (uint32_t i = 0; i < info->uvCoordCount; ++i) {
int ti;
if (i == 2)
ti = 3;

View File

@ -202,7 +202,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
areaOut.docks.emplace_back();
MLVL::Area::Dock& dockOut = areaOut.docks.back();
if (dock.targetArea != -1 && dock.targetDock != -1) {
if (dock.targetArea != UINT32_MAX && dock.targetDock != UINT32_MAX) {
dockOut.endpointCount = 1;
dockOut.endpoints.emplace_back();
MLVL::Area::Dock::Endpoint& ep = dockOut.endpoints.back();

View File

@ -207,8 +207,8 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath());
MaterialSet::RegisterMaterialProps(os);
os << "# Clear Scene\n"
"if 'Collection 1' in bpy.data.collections:\n"
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n"
"if len(bpy.data.collections):\n"
" bpy.data.collections.remove(bpy.data.collections[0])\n"
"\n"
"bpy.types.Light.retro_layer = bpy.props.IntProperty(name='Retro: Light Layer')\n"
"bpy.types.Light.retro_origtype = bpy.props.IntProperty(name='Retro: Original Type')\n"
@ -296,7 +296,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
rs.seek(18, athena::Current);
uint32_t entityCount = rs.readUint32Big();
rs.seek(8, athena::Current);
for (int i = 0; i < entityCount; ++i) {
for (uint32_t i = 0; i < entityCount; ++i) {
uint32_t entityId = rs.readUint32Big();
visiWriter.writeUint32(nullptr, entityId);
}
@ -584,7 +584,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
athena::io::MemoryWriter w(secs.back().data(), secs.back().size());
w.writeUint32Big(0xBABEDEAD);
for (int lay = 0; lay < 2; ++lay) {
for (uint32_t lay = 0; lay < 2; ++lay) {
int lightCount = 0;
for (const Light& l : lights) {
if (l.layer == lay)

View File

@ -71,8 +71,8 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry
"\n"
"bpy.context.scene.name = '%s'\n"
"# Clear Scene\n"
"if 'Collection 1' in bpy.data.collections:\n"
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n"
"if len(bpy.data.collections):\n"
" bpy.data.collections.remove(bpy.data.collections[0])\n"
"\n"
"bm = bmesh.new()\n"
"height_lay = bm.faces.layers.float.new('Height')\n",
@ -87,7 +87,7 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry
for (const Region& r : regions) {
os << "tri_verts = []\n";
for (int i = 0; i < r.nodeCount; ++i)
for (atUint32 i = 0; i < r.nodeCount; ++i)
os.format("tri_verts.append(bm.verts[%u])\n", r.nodeStart + i);
os.format(

View File

@ -1,4 +1,4 @@
make_dnalist(liblist DNAMP1/ScriptObjects
make_dnalist(
IScriptObject
Parameters
Actor
@ -141,4 +141,3 @@ set(ScriptObjectsMP1_SOURCES
WorldTeleporter.cpp)
dataspec_add_list(DNAMP1/ScriptObjects ScriptObjectsMP1_SOURCES)
list(APPEND ScriptObjectsMP1_SOURCES ${liblist})

View File

@ -303,7 +303,7 @@ struct CTweakGui final : ITweakGui {
float GetHudLightAttMulQuadratic() const { return x2c0_hudLightAttMulQuadratic; }
float GetScanSpeed(int idx) const {
if (idx < 0 || idx >= x2c4_scanSpeeds.size())
if (idx < 0 || size_t(idx) >= x2c4_scanSpeeds.size())
return 0.f;
return x2c4_scanSpeeds[idx];
}

View File

@ -1,5 +1,4 @@
make_dnalist(liblist DNAMP2
MLVL
make_dnalist(MLVL
ANIM
AGSC
ANCS
@ -28,4 +27,3 @@ set(DNAMP2_SOURCES
STRG.hpp STRG.cpp)
dataspec_add_list(DNAMP2 DNAMP2_SOURCES)
list(APPEND DNAMP2_SOURCES ${liblist})

View File

@ -200,8 +200,8 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath());
MaterialSet::RegisterMaterialProps(os);
os << "# Clear Scene\n"
"if 'Collection 1' in bpy.data.collections:\n"
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n"
"if len(bpy.data.collections):\n"
" bpy.data.collections.remove(bpy.data.collections[0])\n"
"\n"
"bpy.types.Light.retro_layer = bpy.props.IntProperty(name='Retro: Light Layer')\n"
"bpy.types.Light.retro_origtype = bpy.props.IntProperty(name='Retro: Original Type')\n"

View File

@ -1,5 +1,4 @@
make_dnalist(liblist DNAMP3
PAK
make_dnalist(PAK
MLVL
ANIM
CHAR
@ -26,4 +25,3 @@ set(DNAMP3_SOURCES
MREA.cpp)
dataspec_add_list(DNAMP3 DNAMP3_SOURCES)
list(APPEND DNAMP3_SOURCES ${liblist})

View File

@ -103,8 +103,8 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath());
MaterialSet::RegisterMaterialProps(os);
os << "# Clear Scene\n"
"if 'Collection 1' in bpy.data.collections:\n"
" bpy.data.collections.remove(bpy.data.collections['Collection 1'])\n"
"if len(bpy.data.collections):\n"
" bpy.data.collections.remove(bpy.data.collections[0])\n"
"\n"
"bpy.types.Light.retro_layer = bpy.props.IntProperty(name='Retro: Light Layer')\n"
"bpy.types.Light.retro_origtype = bpy.props.IntProperty(name='Retro: Original Type')\n"

View File

@ -735,7 +735,7 @@ struct SpecMP1 : SpecBase {
std::vector<Mesh> meshCompiles;
meshCompiles.reserve(meshes.size());
std::experimental::optional<ColMesh> colMesh;
std::optional<ColMesh> colMesh;
for (const std::string& mesh : meshes) {
hecl::SystemStringConv meshSys(mesh);
@ -1110,7 +1110,7 @@ struct SpecMP1 : SpecBase {
Log.report(logvisor::Fatal, _SYS_STR("Corrupt MAPW %s"), mapCookedPath.getRelativePath().data());
r.readUint32Big();
atUint32 mapaCount = r.readUint32Big();
for (int i = 0; i < mapaCount; ++i) {
for (atUint32 i = 0; i < mapaCount; ++i) {
UniqueID32 id;
id.read(r);
listOut.push_back({FOURCC('MAPA'), originalToNew(id)});

View File

@ -1,15 +1,7 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/DataSpec ${CMAKE_SOURCE_DIR}/Runtime)
add_subdirectory(locale)
add_subdirectory(icons)
add_subdirectory(badging)
atdna(atdna_Space.cpp Space.hpp)
atdna(atdna_ResourceBrowser.cpp ResourceBrowser.hpp)
atdna(atdna_ModelViewer.cpp ModelViewer.hpp)
atdna(atdna_ParticleEditor.cpp ParticleEditor.hpp)
atdna(atdna_InformationCenter.cpp InformationCenter.hpp)
atdna(atdna_GameMode.cpp GameMode.hpp)
if(URDE_DLPACKAGE)
set(METADATA_VERSION_STRING ${URDE_DLPACKAGE})
else()
@ -82,40 +74,37 @@ endif()
add_executable(urde WIN32 MACOSX_BUNDLE
main.cpp ${PLAT_SRCS}
Space.hpp Space.cpp atdna_Space.cpp
Space.hpp Space.cpp
SplashScreen.hpp SplashScreen.cpp
ResourceBrowser.hpp ResourceBrowser.cpp atdna_ResourceBrowser.cpp
ModelViewer.hpp ModelViewer.cpp atdna_ModelViewer.cpp
ParticleEditor.hpp ParticleEditor.cpp atdna_ParticleEditor.cpp
InformationCenter.hpp InformationCenter.hpp atdna_InformationCenter.cpp
ResourceBrowser.hpp ResourceBrowser.cpp
ModelViewer.hpp ModelViewer.cpp
ParticleEditor.hpp ParticleEditor.cpp
InformationCenter.hpp InformationCenter.hpp
ProjectManager.hpp ProjectManager.cpp
ViewManager.hpp ViewManager.cpp
Resource.hpp Resource.cpp
Camera.hpp Camera.cpp
GameMode.hpp GameMode.cpp atdna_GameMode.cpp)
GameMode.hpp GameMode.cpp)
target_atdna(urde atdna_Space.cpp Space.hpp)
target_atdna(urde atdna_ResourceBrowser.cpp ResourceBrowser.hpp)
target_atdna(urde atdna_ModelViewer.cpp ModelViewer.hpp)
target_atdna(urde atdna_ParticleEditor.cpp ParticleEditor.hpp)
target_atdna(urde atdna_InformationCenter.cpp InformationCenter.hpp)
target_atdna(urde atdna_GameMode.cpp GameMode.hpp)
set_target_properties(urde PROPERTIES COMPILE_DEFINITIONS URDE_DLPACKAGE="${URDE_DLPACKAGE}")
target_compile_definitions(urde PUBLIC URDE_DLPACKAGE="${URDE_DLPACKAGE}")
target_include_directories(urde PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR})
target_link_libraries(urde
UrdeLocales
UrdeIcons
UrdeBadging
RuntimeCommon NESEmulator
specter specter-fonts
${HECL_APPLICATION_REPS_TARGETS_LIST}
freetype ${DATA_SPEC_LIBS}
hecl-full hecl-blender-addon
athena-core nod logvisor athena-libyaml amuse boo
${PNG_LIB} libjpeg-turbo squish xxhash zeus
kabufuda jbus discord-rpc ${ZLIB_LIBRARIES} lzokay
${BOO_SYS_LIBS} ${URDE_PLAT_LIBS})
RuntimeCommon
${URDE_PLAT_LIBS})
if(COMMAND add_sanitizers)
add_sanitizers(urde)
endif()
if(COMMAND cotire)
set_target_properties(urde PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
cotire(urde)
endif()
set_target_properties(urde PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_BINARY_DIR}/Info.plist"

View File

@ -1,6 +1,6 @@
#include "ProjectManager.hpp"
#include "ViewManager.hpp"
#include "../DataSpecRegistry.hpp"
#include "DataSpecRegistry.hpp"
#include "hecl/Blender/Connection.hpp"
namespace urde {
@ -174,7 +174,7 @@ void ProjectManager::mainUpdate() {
if (m_mainMP1) {
if (m_mainMP1->Proc()) {
m_mainMP1->Shutdown();
m_mainMP1 = std::experimental::nullopt;
m_mainMP1 = std::nullopt;
}
}
}

View File

@ -29,7 +29,7 @@ class ProjectManager {
hecl::ClientProcess m_clientProc;
ProjectResourceFactoryMP1 m_factoryMP1;
ProjectResourcePool m_objStore;
std::experimental::optional<MP1::CMain> m_mainMP1;
std::optional<MP1::CMain> m_mainMP1;
bool m_precooking = false;
public:

View File

@ -26,7 +26,7 @@ bool ProjectResourceFactoryBase::SyncCook(const hecl::ProjectPath& working) {
CFactoryFnReturn ProjectResourceFactoryBase::BuildSync(const SObjectTag& tag, const hecl::ProjectPath& path,
const CVParamTransfer& paramXfer, CObjectReference* selfRef) {
/* Ensure cooked rep is on the filesystem */
std::experimental::optional<athena::io::FileReader> fr;
std::optional<athena::io::FileReader> fr;
if (!PrepForReadSync(tag, path, fr))
return {};
@ -166,7 +166,7 @@ ProjectResourceFactoryBase::_RemoveTask(const SObjectTag& tag) {
};
bool ProjectResourceFactoryBase::PrepForReadSync(const SObjectTag& tag, const hecl::ProjectPath& path,
std::experimental::optional<athena::io::FileReader>& fr) {
std::optional<athena::io::FileReader>& fr) {
/* Ensure requested resource is on the filesystem */
if (!path.isFileOrGlob()) {
Log.report(logvisor::Error, _SYS_STR("unable to find resource path '%s'"), path.getAbsolutePath().data());
@ -288,7 +288,7 @@ u32 ProjectResourceFactoryBase::ResourceSize(const SObjectTag& tag) {
return {};
/* Ensure cooked rep is on the filesystem */
std::experimental::optional<athena::io::FileReader> fr;
std::optional<athena::io::FileReader> fr;
if (!PrepForReadSync(tag, *resPath, fr))
return {};
@ -325,7 +325,7 @@ std::unique_ptr<u8[]> ProjectResourceFactoryBase::LoadResourceSync(const urde::S
return {};
/* Ensure cooked rep is on the filesystem */
std::experimental::optional<athena::io::FileReader> fr;
std::optional<athena::io::FileReader> fr;
if (!PrepForReadSync(tag, *resPath, fr))
return {};
@ -343,7 +343,7 @@ std::unique_ptr<u8[]> ProjectResourceFactoryBase::LoadNewResourcePartSync(const
return {};
/* Ensure cooked rep is on the filesystem */
std::experimental::optional<athena::io::FileReader> fr;
std::optional<athena::io::FileReader> fr;
if (!PrepForReadSync(tag, *resPath, fr))
return {};

View File

@ -6,7 +6,7 @@
#include "Runtime/CFactoryMgr.hpp"
#include "Runtime/CResFactory.hpp"
#include "DataSpec/SpecBase.hpp"
#include "optional.hpp"
#include <optional>
#include <thread>
#include <mutex>
@ -91,7 +91,7 @@ protected:
}
bool PrepForReadSync(const SObjectTag& tag, const hecl::ProjectPath& path,
std::experimental::optional<athena::io::FileReader>& fr);
std::optional<athena::io::FileReader>& fr);
bool WaitForTagReady(const urde::SObjectTag& tag, const hecl::ProjectPath*& pathOut) {
return static_cast<DataSpec::SpecBase&>(*m_cookSpec).waitForTagReady(tag, pathOut);

View File

@ -121,7 +121,7 @@ class ViewManager final : public specter::IViewManager {
std::unique_ptr<TestGameView> m_testGameView;
std::unique_ptr<boo::IAudioVoiceEngine> m_voiceEngine;
std::unique_ptr<boo::IAudioVoice> m_videoVoice;
std::experimental::optional<amuse::BooBackendVoiceAllocator> m_amuseAllocWrapper;
std::optional<amuse::BooBackendVoiceAllocator> m_amuseAllocWrapper;
hecl::SystemString m_recentProjectsPath;
std::vector<hecl::SystemString> m_recentProjects;

View File

@ -1,12 +1,12 @@
if(NOT CMAKE_CROSSCOMPILING)
include_directories(${LIBPNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
add_executable(packbadge packbadge.c)
find_library(M_LIB m)
if(NOT M_LIB)
unset(M_LIB CACHE)
endif()
target_link_libraries(packbadge ${PNG_LIB} ${ZLIB_LIBRARIES} ${M_LIB})
target_include_directories(packbadge PRIVATE ${LIBPNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
##################
# Package Export #
@ -40,3 +40,4 @@ bintoc(badge.cpp ${CMAKE_CURRENT_BINARY_DIR}/badge.bin URDE_BADGE)
add_library(UrdeBadging
badge.cpp badge.bin
Badging.hpp Badging.cpp)
target_link_libraries(UrdeBadging PUBLIC specter)

View File

@ -1,11 +1,11 @@
if(NOT CMAKE_CROSSCOMPILING)
include_directories(${LIBPNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
add_executable(packicons packicons.c)
find_library(M_LIB m)
if(NOT M_LIB)
unset(M_LIB CACHE)
endif()
target_link_libraries(packicons ${PNG_LIB} ${ZLIB_LIBRARIES} ${M_LIB})
target_include_directories(packicons PRIVATE ${LIBPNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
##################
# Package Export #
@ -60,3 +60,4 @@ endif()
bintoc(icons_dat.cpp ${CMAKE_CURRENT_BINARY_DIR}/icons.bin URDE_ICONS)
add_library(UrdeIcons icons.cpp icons.hpp icons.bin icons_dat.cpp)
target_link_libraries(UrdeIcons PUBLIC specter)

@ -1 +1 @@
Subproject commit c649fe216d3ca3c10c518812e61591316fe0ad22
Subproject commit 39c8fcddd6d91303097008920bd1764a37bdb926

View File

@ -1,5 +1,5 @@
include_directories(${LIBPNG_INCLUDE_DIR})
add_executable(mkwmicon mkwmicon.c)
target_include_directories(mkwmicon PRIVATE ${LIBPNG_INCLUDE_DIR})
target_link_libraries(mkwmicon ${PNG_LIB} ${ZLIB_LIBRARIES})
macro(declare_wmicon_target)

View File

@ -1,7 +1,13 @@
include_directories(${CMAKE_SOURCE_DIR}/DataSpec ${CMAKE_SOURCE_DIR}/Runtime ${CMAKE_CURRENT_SOURCE_DIR})
file(GLOB MAPPER_SRCS fixNES/mapper/*.c)
add_library(NESEmulator CNESEmulator.hpp CNESEmulator.cpp CNESShader.hpp CNESShader.cpp malloc.h
apu.c fixNES/audio_fds.c fixNES/audio_mmc5.c fixNES/audio_vrc6.c fixNES/audio_vrc7.c
fixNES/audio_n163.c fixNES/audio_s5b.c fixNES/cpu.c ppu.c fixNES/mem.c fixNES/input.c
fixNES/mapper.c fixNES/mapperList.c fixNES/fm2play.c fixNES/vrc_irq.c ${MAPPER_SRCS})
add_dependencies(NESEmulator ${HECL_APPLICATION_REPS_TARGETS_LIST})
target_include_directories(NESEmulator PRIVATE ${CMAKE_SOURCE_DIR}/DataSpec ${CMAKE_SOURCE_DIR}/Runtime
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(NESEmulator PRIVATE COL_32BIT=1)
target_link_libraries(NESEmulator boo hecl-full RuntimeCommon ${HECL_APPLICATION_REPS_TARGETS_LIST})
if (NOT MSVC)
target_compile_options(NESEmulator PRIVATE -Wno-implicit-fallthrough -Wno-format -Wno-pointer-compare
-Wno-memset-elt-size)
endif()

View File

@ -30,7 +30,7 @@ extern "C" {
#include "fixNES/mapper_h/nsf.h"
/*
* Portions Copyright (C) 2017 FIX94
* Portions Copyright (C) 2017 - 2019 FIX94
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
@ -50,7 +50,7 @@ static std::chrono::milliseconds::rep GetTickCount() {
#endif
#endif
static const char* VERSION_STRING = "fixNES Alpha v1.0.5";
const char *VERSION_STRING = "fixNES Alpha v1.2.7";
static char window_title[256];
static char window_title_pause[256];
@ -65,22 +65,39 @@ enum {
#endif
};
// static void nesEmuFdsSetup(uint8_t *src, uint8_t *dst);
static int emuFileType = FTYPE_UNK;
static char emuFileName[1024];
static uint8_t* emuNesROM = NULL;
static uint32_t emuNesROMsize = 0;
uint8_t *emuNesROM = NULL;
uint32_t emuNesROMsize = 0;
#ifndef __LIBRETRO__
static char emuSaveName[1024];
static uint8_t* emuPrgRAM = NULL;
static uint32_t emuPrgRAMsize = 0;
// used externally
#endif
uint8_t *emuPrgRAM = NULL;
uint32_t emuPrgRAMsize = 0;
//used externally
#ifdef COL_32BIT
uint32_t textureImage[0xF000];
#define TEXIMAGE_LEN VISIBLE_DOTS*VISIBLE_LINES*4
#ifdef COL_GL_BSWAP
#define GL_TEX_FMT GL_UNSIGNED_INT_8_8_8_8_REV
#else //no REVerse
#define GL_TEX_FMT GL_UNSIGNED_INT_8_8_8_8
#endif
#else //COL_16BIT
uint16_t textureImage[0xF000];
#define TEXIMAGE_LEN VISIBLE_DOTS*VISIBLE_LINES*2
#ifdef COL_GL_BSWAP
#define GL_TEX_FMT GL_UNSIGNED_SHORT_5_6_5_REV
#else //no REVerse
#define GL_TEX_FMT GL_UNSIGNED_SHORT_5_6_5
#endif
#endif
bool nesPause = false;
bool ppuDebugPauseFrame = false;
bool doOverscan = false;
bool nesPAL = false;
bool nesEmuNSFPlayback = false;
uint8_t emuInitialNT = NT_UNKNOWN;
// static bool inPause = false;
// static bool inOverscanToggle = false;
@ -112,14 +129,20 @@ static bool emuSaveEnabled = false;
static bool emuFdsHasSideB = false;
// static uint16_t ppuCycleTimer;
//static uint16_t ppuCycleTimer;
uint32_t cpuCycleTimer;
uint32_t vrc7CycleTimer;
// from input.c
//from input.c
extern uint8_t inValReads[8];
// from mapper.c
extern bool mapperUse78A;
// from m32.c
//from m30.c
extern bool m30_flashable;
extern bool m30_singlescreen;
//from m32.c
extern bool m32_singlescreen;
//from p16c8.c
extern bool m78_m78a;
//from ppu.c
extern bool ppuMapper5;
static volatile bool emuRenderFrame = false;
extern uint8_t audioExpansion;
@ -507,7 +530,7 @@ struct BitstreamState {
// Based on https://gist.github.com/FIX94/7593640c5cee6c37e3b23e7fcf8fe5b7
void CNESEmulator::DecryptMetroid(u8* dataIn, u8* dataOut, u32 decLen, u8 decByte, u32 xorLen, u32 xorVal) {
int i, j;
u32 i, j;
// simple add obfuscation
for (i = 0; i < 0x100; i++) {
dataIn[i] += decByte;

@ -1 +1 @@
Subproject commit cc08b110f945cdfb3f78d1bb35908f1c23faf5ce
Subproject commit 09f320439e11276e200c85e7e5f60cfbbdef78e6

File diff suppressed because it is too large Load Diff

View File

@ -587,7 +587,7 @@ void CSfxManager::Update(float dt) {
std::sort(rankedSfx.begin(), rankedSfx.end(),
[](const CSfxHandle& a, const CSfxHandle& b) -> bool { return a->GetRank() < b->GetRank(); });
for (int i = 48; i < rankedSfx.size(); ++i) {
for (size_t i = 48; i < rankedSfx.size(); ++i) {
const CSfxHandle& handle = rankedSfx[i];
if (handle->IsPlaying()) {
handle->Stop();

View File

@ -46,7 +46,7 @@ bool CStaticAudioPlayer::IsReady() {
void CStaticAudioPlayer::DecodeMonoAndMix(s16* bufOut, u32 numSamples, u32 cur, u32 loopEndCur, u32 loopStartCur,
int vol, g72x_state& state,
rstl::optional<g72x_state>& loopState) const {
std::optional<g72x_state>& loopState) const {
for (u32 remBytes = numSamples / 2; remBytes;) {
u32 curBuf = cur / RSF_BUFFER_SIZE;
u32 thisBytes = (curBuf + 1) * RSF_BUFFER_SIZE - cur;

View File

@ -23,8 +23,8 @@ class CStaticAudioPlayer {
std::vector<std::unique_ptr<u8[]>> x48_buffers;
g72x_state x58_leftState;
g72x_state x8c_rightState;
rstl::optional<g72x_state> m_leftStateLoop;
rstl::optional<g72x_state> m_rightStateLoop;
std::optional<g72x_state> m_leftStateLoop;
std::optional<g72x_state> m_rightStateLoop;
u32 xc0_volume = 32768; // Out of 32768
static int16_t SampClamp(int32_t val) {
@ -57,7 +57,7 @@ public:
bool IsReady();
void DecodeMonoAndMix(s16* bufOut, u32 numSamples, u32 cur, u32 loopEndCur, u32 loopStartCur, int vol,
g72x_state& state, rstl::optional<g72x_state>& loopState) const;
g72x_state& state, std::optional<g72x_state>& loopState) const;
void Decode(s16* bufOut, u32 numSamples);
void SetVolume(float vol) { xc0_volume = zeus::clamp(0.f, vol, 1.f) * 32768.f; }

View File

@ -67,7 +67,7 @@ struct SDSPStream : boo::IAudioVoiceCallback {
bool xe8_silent = true;
u8 xec_readState = 0; // 0: NoRead 1: Read 2: ReadWrap
rstl::optional<CDvdFile> m_file;
std::optional<CDvdFile> m_file;
std::shared_ptr<IDvdRequest> m_readReqs[2];
void ReadBuffer(int buf) {
@ -262,7 +262,7 @@ struct SDSPStream : boo::IAudioVoiceCallback {
stream.m_readReqs[j].reset();
}
stream.xd4_ringBuffer.reset();
stream.m_file = rstl::nullopt;
stream.m_file = std::nullopt;
}
}
@ -340,7 +340,7 @@ struct SDSPStream : boo::IAudioVoiceCallback {
void StopStream() {
x0_active = false;
m_booVoice->stop();
m_file = rstl::nullopt;
m_file = std::nullopt;
}
static bool IsStreamActive(s32 id) {
@ -472,7 +472,7 @@ public:
static bool FindUnclaimedStereoPair(s32& left, s32& right) {
s32 idx = FindUnclaimedStreamIdx();
for (u32 i = 0; i < 4; ++i) {
for (s32 i = 0; i < 4; ++i) {
CDSPStreamManager& stream = g_Streams[i];
if (stream.x70_24_unclaimed && idx != i) {
left = idx;

View File

@ -172,7 +172,7 @@ private:
u32 x328_ = 0;
bool x32c_loadingDummyWorld = false;
rstl::optional<zeus::CVector2f> m_lastMouseCoord;
std::optional<zeus::CVector2f> m_lastMouseCoord;
zeus::CVector2f m_mouseDelta;
boo::SScrollDelta m_lastAccumScroll;
boo::SScrollDelta m_mapScroll;

View File

@ -49,7 +49,7 @@ void CMapUniverse::Draw(const CMapUniverseDrawParms& parms, const zeus::CVector3
std::vector<CMapObjectSortInfo> sortInfos;
sortInfos.reserve(totalSurfaceCount);
for (int w = 0; w < x10_worldDatas.size(); ++w) {
for (size_t w = 0; w < x10_worldDatas.size(); ++w) {
const CMapWorldData& data = x10_worldDatas[w];
const CMapWorldInfo& mwInfo = *g_GameState->StateForWorld(data.GetWorldAssetId()).MapWorldInfo();
if (!mwInfo.IsAnythingSet())
@ -67,9 +67,9 @@ void CMapUniverse::Draw(const CMapUniverseDrawParms& parms, const zeus::CVector3
outlineColor.a() *= parms.GetAlpha();
}
for (int h = 0; h < data.GetNumMapAreaDatas(); ++h) {
for (u32 h = 0; h < data.GetNumMapAreaDatas(); ++h) {
zeus::CTransform hexXf = parms.GetCameraTransform().inverse() * data.GetMapAreaData(h);
for (int s = 0; s < x4_hexagonToken->GetNumSurfaces(); ++s) {
for (u32 s = 0; s < x4_hexagonToken->GetNumSurfaces(); ++s) {
const CMapArea::CMapAreaSurface& surf = x4_hexagonToken->GetSurface(s);
zeus::CVector3f centerPos = hexXf * surf.GetCenterPosition();
sortInfos.emplace_back(centerPos.y(), w, h, s, surfColor, outlineColor);

View File

@ -105,7 +105,7 @@ s32 CMapWorld::GetCurrentMapAreaDepth(const IWorld& wld, TAreaId aid) const {
std::vector<int> CMapWorld::GetVisibleAreas(const IWorld& wld, const CMapWorldInfo& mwInfo) const {
std::vector<int> ret;
ret.reserve(x0_areas.size());
for (int i = 0; i < x0_areas.size(); ++i) {
for (size_t i = 0; i < x0_areas.size(); ++i) {
if (!IsMapAreaValid(wld, i, true))
continue;
const CMapArea* area = GetMapArea(i);
@ -163,7 +163,7 @@ void CMapWorld::DoBFS(const IWorld& wld, int startArea, int areaCount, float sur
if (areaCount <= 0 || !IsMapAreaValid(wld, startArea, checkLoad))
return;
int size = bfsInfos.size();
size_t size = bfsInfos.size();
bfsInfos.emplace_back(startArea, 1, surfDepth, outlineDepth);
const_cast<CMapWorld*>(this)->x20_traversed[startArea] = true;
@ -176,7 +176,7 @@ void CMapWorld::DoBFS(const IWorld& wld, int startArea, int areaCount, float sur
outlineDepth = testInfo.GetOutlineDrawDepth() - 1.f;
const IGameArea* area = wld.IGetAreaAlways(testInfo.GetAreaIndex());
for (int i = 0; i < area->IGetNumAttachedAreas(); ++i) {
for (u32 i = 0; i < area->IGetNumAttachedAreas(); ++i) {
TAreaId attId = area->IGetAttachedAreaId(i);
if (IsMapAreaValid(wld, attId, checkLoad) && !x20_traversed[attId]) {
bfsInfos.emplace_back(attId, testInfo.GetDepth() + 1, surfDepth, outlineDepth);
@ -282,15 +282,15 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre
zeus::CTransform modelView =
parms.GetCameraTransform().inverse() * mapa->GetAreaPostTransform(parms.GetWorld(), thisArea);
for (int i = 0; i < mapa->GetNumSurfaces(); ++i) {
for (u32 i = 0; i < mapa->GetNumSurfaces(); ++i) {
const CMapArea::CMapAreaSurface& surf = mapa->GetSurface(i);
zeus::CVector3f pos = modelView * surf.GetCenterPosition();
sortInfos.emplace_back(pos.y(), thisArea, CMapObjectSortInfo::EObjectCode::Surface, i, finalSurfColor,
finalOutlineColor);
}
int i = 0;
int si = 0;
u32 i = 0;
u32 si = 0;
for (; i < mapa->GetNumMappableObjects(); ++i, si += 6) {
const CMappableObject& obj = mapa->GetMappableObject(i);
if (!obj.IsVisibleToAutoMapper(mwInfo.IsWorldVisible(thisArea), mwInfo))
@ -301,7 +301,7 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre
if (!mwInfo.IsAreaVisible(thisArea))
continue;
if (parms.GetIsSortDoorSurfaces()) {
for (int s = 0; s < 6; ++s) {
for (u32 s = 0; s < 6; ++s) {
zeus::CVector3f center = obj.BuildSurfaceCenterPoint(s);
zeus::CVector3f pos = modelView * (CMapArea::GetAreaPostTranslate(parms.GetWorld(), thisArea) + center);
sortInfos.emplace_back(pos.y(), thisArea, CMapObjectSortInfo::EObjectCode::DoorSurface, si + s,
@ -323,7 +323,7 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre
return a.GetZDistance() > b.GetZDistance();
});
int lastAreaIdx = -1;
u32 lastAreaIdx = UINT32_MAX;
CMapObjectSortInfo::EObjectCode lastType = CMapObjectSortInfo::EObjectCode::Invalid;
for (const CMapObjectSortInfo& info : sortInfos) {
const CMapArea* mapa = GetMapArea(info.GetAreaIndex());
@ -582,7 +582,7 @@ static Circle MinCircle(const std::vector<zeus::CVector2f>& coords) {
Circle2 ret = {};
if (coords.size() >= 1) {
std::unique_ptr<const zeus::CVector2f*[]> randArr(new const zeus::CVector2f*[coords.size()]);
for (int i = 0; i < coords.size(); ++i)
for (size_t i = 0; i < coords.size(); ++i)
randArr[i] = &coords[i];
for (int i = coords.size() - 1; i >= 0; --i) {
int shuf = rand() % (i + 1);
@ -593,7 +593,7 @@ static Circle MinCircle(const std::vector<zeus::CVector2f>& coords) {
Support support = {};
support.x0_ = 1;
for (int i = 1; i < coords.size();) {
for (size_t i = 1; i < coords.size();) {
bool broke = false;
for (int j = 0; j < support.x0_; ++j) {
if ((*randArr[i] - *randArr[support.x4_[j]]).magSquared() < 0.01f) {
@ -621,7 +621,7 @@ void CMapWorld::RecalculateWorldSphere(const CMapWorldInfo& mwInfo, const IWorld
coords.reserve(x0_areas.size() * 8);
float zMin = FLT_MAX;
float zMax = -FLT_MAX;
for (int i = 0; i < x0_areas.size(); ++i) {
for (size_t i = 0; i < x0_areas.size(); ++i) {
if (IsMapAreaValid(wld, i, true)) {
const CMapArea* mapa = GetMapArea(i);
if (mapa->GetIsVisibleToAutoMapper(mwInfo.IsWorldVisible(i), mwInfo.IsAreaVisible(i))) {
@ -670,7 +670,7 @@ zeus::CVector3f CMapWorld::ConstrainToWorldVolume(const zeus::CVector3f& point,
void CMapWorld::ClearTraversedFlags() const {
std::vector<bool>& flags = const_cast<CMapWorld*>(this)->x20_traversed;
for (int i = 0; i < flags.size(); ++i)
for (size_t i = 0; i < flags.size(); ++i)
flags[i] = false;
}

View File

@ -8,13 +8,13 @@ CMapWorldInfo::CMapWorldInfo(CBitStreamReader& reader, const CSaveWorld& savw, C
const CSaveWorldMemory& worldMem = g_MemoryCardSys->GetSaveWorldMemory(mlvlId);
x4_visitedAreas.reserve((worldMem.GetAreaCount() + 31) / 32);
for (int i = 0; i < worldMem.GetAreaCount(); ++i) {
for (u32 i = 0; i < worldMem.GetAreaCount(); ++i) {
bool visited = reader.ReadEncoded(1);
SetAreaVisited(i, visited);
}
x18_mappedAreas.reserve((worldMem.GetAreaCount() + 31) / 32);
for (int i = 0; i < worldMem.GetAreaCount(); ++i) {
for (u32 i = 0; i < worldMem.GetAreaCount(); ++i) {
bool mapped = reader.ReadEncoded(1);
SetIsMapped(i, mapped);
}
@ -28,14 +28,14 @@ CMapWorldInfo::CMapWorldInfo(CBitStreamReader& reader, const CSaveWorld& savw, C
void CMapWorldInfo::PutTo(CBitStreamWriter& writer, const CSaveWorld& savw, CAssetId mlvlId) const {
const CSaveWorldMemory& worldMem = g_MemoryCardSys->GetSaveWorldMemory(mlvlId);
for (int i = 0; i < worldMem.GetAreaCount(); ++i) {
for (u32 i = 0; i < worldMem.GetAreaCount(); ++i) {
if (i < x0_visitedAreasAllocated)
writer.WriteEncoded(IsAreaVisted(i), 1);
else
writer.WriteEncoded(0, 1);
}
for (int i = 0; i < worldMem.GetAreaCount(); ++i) {
for (u32 i = 0; i < worldMem.GetAreaCount(); ++i) {
if (i < x14_mappedAreasAllocated)
writer.WriteEncoded(IsMapped(i), 1);
else
@ -95,10 +95,10 @@ bool CMapWorldInfo::IsWorldVisible(TAreaId aid) const { return x38_mapStationUse
bool CMapWorldInfo::IsAreaVisible(TAreaId aid) const { return IsAreaVisted(aid) || IsMapped(aid); }
bool CMapWorldInfo::IsAnythingSet() const {
for (int i = 0; i < x0_visitedAreasAllocated; ++i)
for (u32 i = 0; i < x0_visitedAreasAllocated; ++i)
if (x4_visitedAreas[i / 32] & (1 << (i % 32)))
return true;
for (int i = 0; i < x14_mappedAreasAllocated; ++i)
for (u32 i = 0; i < x14_mappedAreasAllocated; ++i)
if (x18_mappedAreas[i / 32] & (1 << (i % 32)))
return true;
return x38_mapStationUsed;

View File

@ -64,8 +64,8 @@ private:
: m_surface(ctx, g_doorVbo, g_doorIbo)
, m_outline(ctx, CLineRenderer::EPrimitiveMode::LineLoop, 5, nullptr, false, false, true) {}
};
rstl::optional<DoorSurface> m_doorSurface;
rstl::optional<CTexturedQuadFilter> m_texQuadFilter;
std::optional<DoorSurface> m_doorSurface;
std::optional<CTexturedQuadFilter> m_texQuadFilter;
zeus::CTransform AdjustTransformForType();
std::pair<zeus::CColor, zeus::CColor> GetDoorColors(int idx, const CMapWorldInfo& mwInfo, float alpha) const;

View File

@ -3,6 +3,8 @@
namespace urde {
logvisor::Module AllocLog("urde::CGameAllocator");
#pragma GCC diagnostic ignored "-Wclass-memaccess"
std::vector<CGameAllocator::SAllocationDescription> CGameAllocator::m_allocations;
u8* CGameAllocator::Alloc(size_t len) {

View File

@ -513,8 +513,8 @@ CHintOptions::CHintOptions(CBitStreamReader& stream) {
for (const auto& hint : hints) {
(void)hint;
EHintState state = EHintState(stream.ReadEncoded(2));
u32 timeBits = stream.ReadEncoded(32);
float time = reinterpret_cast<float&>(timeBits);
union { s32 i; float f; } timeBits = {stream.ReadEncoded(32)};
float time = timeBits.f;
if (state == EHintState::Zero)
time = 0.f;
@ -529,7 +529,8 @@ CHintOptions::CHintOptions(CBitStreamReader& stream) {
void CHintOptions::PutTo(CBitStreamWriter& writer) const {
for (const SHintState& hint : x0_hintStates) {
writer.WriteEncoded(u32(hint.x0_state), 2);
writer.WriteEncoded(reinterpret_cast<const u32&>(hint.x4_time), 32);
union { float f; u32 i; } timeBits = {hint.x4_time};
writer.WriteEncoded(timeBits.i, 32);
}
}

View File

@ -1,7 +1,3 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${BOO_INCLUDE_DIR} ${LIBJPEG_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/DataSpec ${JBUS_INCLUDE_DIR})
macro(runtime_add_list rel_path a_list)
unset(tmp_list)
foreach(path IN LISTS ${a_list})
@ -128,25 +124,26 @@ add_library(${name} ${ARGN})
if(COMMAND add_sanitizers)
add_sanitizers(${name})
endif()
if(COMMAND cotire)
set_target_properties(${name} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
cotire(${name})
endif()
add_dependencies(${name} ${HECL_APPLICATION_REPS_TARGETS_LIST})
if(WINDOWS_STORE)
set_property(TARGET ${name} PROPERTY VS_WINRT_COMPONENT TRUE)
endif()
endfunction()
set(RUNTIME_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
set(RUNTIME_LIBRARIES ${HECL_APPLICATION_REPS_TARGETS_LIST} RetroDataSpec NESEmulator
libjpeg-turbo jbus kabufuda discord-rpc logvisor)
if(MSVC)
# WTF MS???? LINK.EXE is unable to address static libraries larger than 4GB.
# This is a hack to split this large library in two.
add_runtime_common_library(RuntimeCommon ${RUNTIME_SOURCES_A})
add_runtime_common_library(RuntimeCommonB ${RUNTIME_SOURCES_B})
target_link_libraries(RuntimeCommon RuntimeCommonB)
target_include_directories(RuntimeCommonB PUBLIC ${RUNTIME_INCLUDES})
target_link_libraries(RuntimeCommonB PUBLIC ${RUNTIME_LIBRARIES})
target_link_libraries(RuntimeCommon PUBLIC RuntimeCommonB)
else()
add_runtime_common_library(RuntimeCommon ${RUNTIME_SOURCES_A} ${RUNTIME_SOURCES_B})
target_include_directories(RuntimeCommon PUBLIC ${RUNTIME_INCLUDES})
target_link_libraries(RuntimeCommon PUBLIC ${RUNTIME_LIBRARIES})
endif()
target_link_libraries(RuntimeCommon CModelShaders)

View File

@ -146,7 +146,7 @@ bool CMemoryCardSys::InitializePump() {
std::sort(x20_scanStates.begin(), x20_scanStates.end(), [&](const auto& a, const auto& b) -> bool {
return g_ResFactory->TranslateNewToOriginal(a.first) < g_ResFactory->TranslateNewToOriginal(b.first);
});
x1c_worldInter = rstl::nullopt;
x1c_worldInter = std::nullopt;
}
return false;

View File

@ -56,7 +56,7 @@ public:
class CMemoryCardSys {
TLockedToken<CGameHintInfo> x0_hints;
std::vector<std::pair<CAssetId, CSaveWorldMemory>> xc_memoryWorlds; /* MLVL as key */
rstl::optional<std::vector<CSaveWorldIntermediate>> x1c_worldInter; /* used to be auto_ptr of vector */
std::optional<std::vector<CSaveWorldIntermediate>> x1c_worldInter; /* used to be auto_ptr of vector */
std::vector<std::pair<CAssetId, CSaveWorld::EScanCategory>> x20_scanStates;
rstl::reserved_vector<u32, 6> x30_scanCategoryCounts;
@ -113,7 +113,7 @@ public:
std::string x18_fileName;
std::string x28_comment;
CAssetId x3c_bannerTex;
rstl::optional<TLockedToken<CTexture>> x40_bannerTok;
std::optional<TLockedToken<CTexture>> x40_bannerTok;
rstl::reserved_vector<Icon, 8> x50_iconToks;
std::vector<u8> xf4_saveBuffer;
std::vector<u8> x104_cardBuffer;

View File

@ -1,6 +1,7 @@
#include "CSimplePool.hpp"
#include "IVParamObj.hpp"
#include "CToken.hpp"
#include <cassert>
namespace urde {

View File

@ -1498,7 +1498,7 @@ void CStateManager::ProcessRadiusDamage(const CActor& damager, CActor& damagee,
void CStateManager::ApplyRadiusDamage(const CActor& a1, const zeus::CVector3f& pos, CActor& a2,
const CDamageInfo& info) {
zeus::CVector3f delta = a2.GetTranslation() - pos;
rstl::optional<zeus::CAABox> bounds;
std::optional<zeus::CAABox> bounds;
if (delta.magSquared() < info.GetRadius() * info.GetRadius() ||
((bounds = a2.GetTouchBounds()) &&
CCollidableSphere::Sphere_AABox_Bool(zeus::CSphere{pos, info.GetRadius()}, *bounds))) {
@ -1548,7 +1548,7 @@ bool CStateManager::TestRayDamage(const zeus::CVector3f& pos, const CActor& dama
EMaterialTypes::Occluder, EMaterialTypes::Character);
static const CMaterialFilter filter(incList, exList, CMaterialFilter::EFilterType::IncludeExclude);
rstl::optional<zeus::CAABox> bounds = damagee.GetTouchBounds();
std::optional<zeus::CAABox> bounds = damagee.GetTouchBounds();
if (!bounds)
return false;
@ -2052,7 +2052,7 @@ void CStateManager::CrossTouchActors() {
CActor& actor = static_cast<CActor&>(*ent);
if (!actor.GetActive() || !actor.GetCallTouch())
continue;
rstl::optional<zeus::CAABox> touchAABB = actor.GetTouchBounds();
std::optional<zeus::CAABox> touchAABB = actor.GetTouchBounds();
if (!touchAABB)
continue;
@ -2068,7 +2068,7 @@ void CStateManager::CrossTouchActors() {
if (!ent2)
continue;
rstl::optional<zeus::CAABox> touchAABB2 = ent2->GetTouchBounds();
std::optional<zeus::CAABox> touchAABB2 = ent2->GetTouchBounds();
if (!ent2->GetActive() || !touchAABB2)
continue;
@ -2339,7 +2339,7 @@ void CStateManager::UpdateActorInSortedLists(CActor& act) {
if (!act.GetUseInSortedLists() || !act.xe4_27_notInSortedLists)
return;
rstl::optional<zeus::CAABox> aabb = CalculateObjectBounds(act);
std::optional<zeus::CAABox> aabb = CalculateObjectBounds(act);
bool actorInLists = x874_sortedListManager->ActorInLists(&act);
if (actorInLists || aabb) {
act.xe4_27_notInSortedLists = false;
@ -2362,8 +2362,8 @@ void CStateManager::UpdateSortedLists() {
UpdateActorInSortedLists(static_cast<CActor&>(*actor));
}
rstl::optional<zeus::CAABox> CStateManager::CalculateObjectBounds(const CActor& actor) {
rstl::optional<zeus::CAABox> bounds = actor.GetTouchBounds();
std::optional<zeus::CAABox> CStateManager::CalculateObjectBounds(const CActor& actor) {
std::optional<zeus::CAABox> bounds = actor.GetTouchBounds();
if (bounds) {
zeus::CAABox aabb;
aabb.accumulateBounds(bounds->min);

View File

@ -338,7 +338,7 @@ public:
const CActor*) const;
void UpdateActorInSortedLists(CActor&);
void UpdateSortedLists();
rstl::optional<zeus::CAABox> CalculateObjectBounds(const CActor&);
std::optional<zeus::CAABox> CalculateObjectBounds(const CActor&);
void AddObject(CEntity&);
void AddObject(CEntity*);
CRayCastResult RayStaticIntersection(const zeus::CVector3f& pos, const zeus::CVector3f& dir, float length,

View File

@ -1069,7 +1069,7 @@ void CBallCamera::UpdateUsingColliders(float dt, CStateManager& mgr) {
}
} else if (mgr.GetPlayer().GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Unmorphed ||
x18d_25_avoidGeometryFull) {
zeus::CTransform oldXf = x34_transform;
//zeus::CTransform oldXf = x34_transform;
zeus::CVector3f oldPos = GetTranslation();
x2c4_smallCollidersObsCount = CountObscuredColliders(x264_smallColliders);
x2c8_mediumCollidersObsCount = CountObscuredColliders(x274_mediumColliders);
@ -1486,7 +1486,7 @@ bool CBallCamera::CheckFailsafeFromMorphBallState(CStateManager& mgr) const {
}
curT += 1.f;
}
for (int i = 0; i < resultsA.size(); ++i) {
for (size_t i = 0; i < resultsA.size(); ++i) {
const CRayCastResult& resA = resultsA[i];
const CRayCastResult& resB = resultsB[i];
if (resA.IsValid()) {
@ -1523,7 +1523,7 @@ bool CBallCamera::SplineIntersectTest(CMaterialList& intersectMat, CStateManager
}
curT += 1.f;
}
for (int i = 0; i < xacc.size(); ++i) {
for (size_t i = 0; i < xacc.size(); ++i) {
const CRayCastResult& resA = xacc[i];
const CRayCastResult& resB = xd10[i];
if (resA.IsValid()) {

View File

@ -29,7 +29,7 @@ void CCameraFilterPass<S>::Update(float dt) {
}
if (x0_curType == EFilterType::Passthru)
m_shader = rstl::nullopt;
m_shader = std::nullopt;
else if (x0_curType != origType)
m_shader.emplace(x0_curType, x24_texObj);
}
@ -44,7 +44,7 @@ void CCameraFilterPass<S>::SetFilter(EFilterType type, EFilterShape shape, float
if (txtr.IsValid())
x24_texObj = g_SimplePool->GetObj({FOURCC('TXTR'), txtr});
if (type == EFilterType::Passthru)
m_shader = rstl::nullopt;
m_shader = std::nullopt;
else if (x0_curType != type || (x20_nextTxtr != txtr && txtr.IsValid()))
m_shader.emplace(type, x24_texObj);
@ -88,7 +88,7 @@ void CCameraFilterPass<S>::SetFilter(EFilterType type, EFilterShape shape, float
}
if (x0_curType == EFilterType::Passthru)
m_shader = rstl::nullopt;
m_shader = std::nullopt;
else if (x0_curType != origType || (x20_nextTxtr != origTxtr && x20_nextTxtr.IsValid()))
m_shader.emplace(x0_curType, x24_texObj);
}

View File

@ -59,7 +59,7 @@ public:
template <class S>
class CCameraFilterPass final : public CCameraFilterPassBase {
rstl::optional<S> m_shader;
std::optional<S> m_shader;
public:
void Update(float dt);
@ -103,8 +103,8 @@ class CCameraBlurPass {
// bool x2d_noPersistentCopy = false;
// u32 x30_persistentBuf = 0;
mutable rstl::optional<CCameraBlurFilter> m_shader;
mutable rstl::optional<CXRayBlurFilter> m_xrayShader;
mutable std::optional<CCameraBlurFilter> m_shader;
mutable std::optional<CXRayBlurFilter> m_xrayShader;
public:
void Draw(bool clearDepth = false);

View File

@ -88,7 +88,7 @@ float CCameraSpline::CalculateSplineLength() {
if (x4_positions.size() > 0) {
zeus::CVector3f prevPoint = x4_positions[0];
float tDiv = 1.f / float(x4_positions.size() - 1);
for (int i = 0; i < x4_positions.size(); ++i) {
for (size_t i = 0; i < x4_positions.size(); ++i) {
float subT = 0.f;
float baseT = i * tDiv;
x24_t.push_back(ret);
@ -169,8 +169,8 @@ zeus::CTransform CCameraSpline::GetInterpolatedSplinePointByLength(float pos) co
if (x4_positions.empty())
return zeus::CTransform();
int baseIdx = 0;
int i;
size_t baseIdx = 0;
size_t i;
for (i = 1; i < x4_positions.size(); ++i) {
if (x24_t[i] > pos) {
baseIdx = i - 1;

View File

@ -191,9 +191,9 @@ void CCinematicCamera::Think(float dt, CStateManager& mgr) {
x1ec_t += dt;
if (x1ec_t > x1e8_duration) {
for (int i = x1f4_passedViewPoint + 1; i < x1a8_viewPointArrivals.size(); ++i)
for (size_t i = x1f4_passedViewPoint + 1; i < x1a8_viewPointArrivals.size(); ++i)
SendArrivedMsg(x1a8_viewPointArrivals[i], mgr);
for (int i = x1f8_passedTarget + 1; i < x1c8_targetArrivals.size(); ++i)
for (size_t i = x1f8_passedTarget + 1; i < x1c8_targetArrivals.size(); ++i)
SendArrivedMsg(x1c8_targetArrivals[i], mgr);
DeactivateSelf(mgr);
}

View File

@ -312,7 +312,7 @@ bool CActorLights::BuildAreaLightList(const CStateManager& mgr, const CGameArea&
u32 mostSigLightIdx = 0;
/* Narrowphase test candidates starting with most intense */
for (int i = 0; i < valList.size(); ++i) {
for (size_t i = 0; i < valList.size(); ++i) {
const SLightValue& value = valList[i];
const CLight& light = gfxLightList[value.x0_areaLightIdx];
if (x0_areaLights.size() < maxAreaLights) {

View File

@ -37,7 +37,7 @@ void CAnimData::InitializeCache() {}
CAnimData::CAnimData(CAssetId id, const CCharacterInfo& character, int defaultAnim, int charIdx, bool loop,
const TLockedToken<CCharLayoutInfo>& layout, const TToken<CSkinnedModel>& model,
const rstl::optional<TToken<CMorphableSkinnedModel>>& iceModel,
const std::optional<TToken<CMorphableSkinnedModel>>& iceModel,
const std::weak_ptr<CAnimSysContext>& ctx, const std::shared_ptr<CAnimationManager>& animMgr,
const std::shared_ptr<CTransitionManager>& transMgr,
const TLockedToken<CCharacterFactory>& charFactory, int drawInstCount)
@ -265,7 +265,7 @@ SAdvancementDeltas CAnimData::GetAdvancementDeltas(const CCharAnimTime& a, const
CCharAnimTime CAnimData::GetTimeOfUserEvent(EUserEventType type, const CCharAnimTime& time) const {
u32 count = x1f8_animRoot->GetInt32POIList(time, g_TransientInt32POINodes.data(), 16, 0, 64);
for (int i = 0; i < count; ++i) {
for (u32 i = 0; i < count; ++i) {
CInt32POINode& poi = g_TransientInt32POINodes[i];
if (poi.GetPoiType() == EPOIType::UserEvent && EUserEventType(poi.GetValue()) == type) {
CCharAnimTime ret = poi.GetTime();
@ -284,7 +284,7 @@ void CAnimData::MultiplyPlaybackRate(float mul) { x200_speedScale *= mul; }
void CAnimData::SetPlaybackRate(float set) { x200_speedScale = set; }
void CAnimData::SetRandomPlaybackRate(CRandom16& r) {
for (int i = 0; i < x210_passedIntCount; ++i) {
for (u32 i = 0; i < x210_passedIntCount; ++i) {
CInt32POINode& poi = g_Int32POINodes[i];
if (poi.GetPoiType() == EPOIType::RandRate) {
float tmp = (r.Next() % poi.GetValue()) / 100.f;
@ -307,7 +307,7 @@ void CAnimData::CalcPlaybackAlignmentParms(const CAnimPlaybackParms& parms,
ResetPOILists();
x210_passedIntCount +=
node->GetInt32POIList(CCharAnimTime::Infinity(), g_Int32POINodes.data(), 16, x210_passedIntCount, 64);
for (int i = 0; i < x210_passedIntCount; ++i) {
for (u32 i = 0; i < x210_passedIntCount; ++i) {
CInt32POINode& poi = g_Int32POINodes[i];
if (poi.GetPoiType() == EPOIType::UserEvent && EUserEventType(poi.GetValue()) == EUserEventType::AlignTargetRot) {
SAdvancementResults res = node->VGetAdvancementResults(poi.GetTime(), 0.f);
@ -331,7 +331,7 @@ void CAnimData::CalcPlaybackAlignmentParms(const CAnimPlaybackParms& parms,
ResetPOILists();
x210_passedIntCount +=
node->GetInt32POIList(CCharAnimTime::Infinity(), g_Int32POINodes.data(), 16, x210_passedIntCount, 64);
for (int i = 0; i < x210_passedIntCount; ++i) {
for (u32 i = 0; i < x210_passedIntCount; ++i) {
CInt32POINode& poi = g_Int32POINodes[i];
if (poi.GetPoiType() == EPOIType::UserEvent) {
if (EUserEventType(poi.GetValue()) == EUserEventType::AlignTargetPosStart) {
@ -383,7 +383,7 @@ void CAnimData::CalcPlaybackAlignmentParms(const CAnimPlaybackParms& parms,
ResetPOILists();
x210_passedIntCount +=
node->GetInt32POIList(CCharAnimTime::Infinity(), g_Int32POINodes.data(), 16, x210_passedIntCount, 64);
for (int i = 0; i < x210_passedIntCount; ++i) {
for (u32 i = 0; i < x210_passedIntCount; ++i) {
CInt32POINode& poi = g_Int32POINodes[i];
if (poi.GetPoiType() == EPOIType::UserEvent) {
if (EUserEventType(poi.GetValue()) == EUserEventType::AlignTargetPosStart) {
@ -541,14 +541,14 @@ void CAnimData::RecalcPoseBuilder(const CCharAnimTime* time) {
void CAnimData::RenderAuxiliary(const zeus::CFrustum& frustum) const { x120_particleDB.AddToRendererClipped(frustum); }
void CAnimData::Render(CSkinnedModel& model, const CModelFlags& drawFlags,
const rstl::optional<CVertexMorphEffect>& morphEffect,
const std::optional<CVertexMorphEffect>& morphEffect,
const float* morphMagnitudes) {
SetupRender(model, drawFlags, morphEffect, morphMagnitudes);
DrawSkinnedModel(model, drawFlags);
}
void CAnimData::SetupRender(CSkinnedModel& model, const CModelFlags& drawFlags,
const rstl::optional<CVertexMorphEffect>& morphEffect,
const std::optional<CVertexMorphEffect>& morphEffect,
const float* morphMagnitudes) {
if (!x220_30_poseBuilt) {
x2fc_poseBuilder.BuildNoScale(x224_pose);
@ -723,7 +723,7 @@ SAdvancementDeltas CAnimData::Advance(float dt, const zeus::CVector3f& scale, CS
if (suspendParticles)
x120_particleDB.SuspendAllActiveEffects(stateMgr);
for (int i = 0; i < x214_passedParticleCount; ++i) {
for (u32 i = 0; i < x214_passedParticleCount; ++i) {
CParticlePOINode& node = g_ParticlePOINodes[i];
if (node.GetCharacterIndex() == -1 || node.GetCharacterIndex() == x204_charIdx) {
x120_particleDB.AddParticleEffect(node.GetString(), node.GetFlags(), node.GetParticleData(), scale, stateMgr, aid,
@ -741,7 +741,7 @@ SAdvancementDeltas CAnimData::AdvanceIgnoreParticles(float dt, CRandom16& random
void CAnimData::AdvanceAnim(CCharAnimTime& time, zeus::CVector3f& offset, zeus::CQuaternion& quat) {
SAdvancementResults results;
rstl::optional<std::unique_ptr<IAnimReader>> simplified;
std::optional<std::unique_ptr<IAnimReader>> simplified;
if (x104_animDir == EAnimDir::Forward) {
results = x1f8_animRoot->VAdvanceView(time);
@ -752,7 +752,7 @@ void CAnimData::AdvanceAnim(CCharAnimTime& time, zeus::CVector3f& offset, zeus::
x1f8_animRoot = CAnimTreeNode::Cast(std::move(*simplified));
if ((x220_28_ || x220_27_) && x210_passedIntCount > 0) {
for (int i = 0; i < x210_passedIntCount; ++i) {
for (u32 i = 0; i < x210_passedIntCount; ++i) {
CInt32POINode& node = g_Int32POINodes[i];
if (node.GetPoiType() == EPOIType::UserEvent) {
switch (EUserEventType(node.GetValue())) {
@ -798,7 +798,7 @@ void CAnimData::SetInfraModel(const TLockedToken<CModel>& model, const TLockedTo
}
void CAnimData::PoseSkinnedModel(CSkinnedModel& model, const CPoseAsTransforms& pose, const CModelFlags& drawFlags,
const rstl::optional<CVertexMorphEffect>& morphEffect,
const std::optional<CVertexMorphEffect>& morphEffect,
const float* morphMagnitudes) {
model.Calculate(pose, drawFlags, morphEffect, morphMagnitudes);
}

View File

@ -147,7 +147,7 @@ private:
public:
CAnimData(CAssetId, const CCharacterInfo& character, int defaultAnim, int charIdx, bool loop,
const TLockedToken<CCharLayoutInfo>& layout, const TToken<CSkinnedModel>& model,
const rstl::optional<TToken<CMorphableSkinnedModel>>& iceModel,
const std::optional<TToken<CMorphableSkinnedModel>>& iceModel,
const std::weak_ptr<CAnimSysContext>& ctx, const std::shared_ptr<CAnimationManager>& animMgr,
const std::shared_ptr<CTransitionManager>& transMgr, const TLockedToken<CCharacterFactory>& charFactory,
int drawInstCount);
@ -196,9 +196,9 @@ public:
void RecalcPoseBuilder(const CCharAnimTime*);
void RenderAuxiliary(const zeus::CFrustum& frustum) const;
void Render(CSkinnedModel& model, const CModelFlags& drawFlags,
const rstl::optional<CVertexMorphEffect>& morphEffect, const float* morphMagnitudes);
const std::optional<CVertexMorphEffect>& morphEffect, const float* morphMagnitudes);
void SetupRender(CSkinnedModel& model, const CModelFlags& drawFlags,
const rstl::optional<CVertexMorphEffect>& morphEffect, const float* morphMagnitudes);
const std::optional<CVertexMorphEffect>& morphEffect, const float* morphMagnitudes);
static void DrawSkinnedModel(CSkinnedModel& model, const CModelFlags& flags);
void PreRender();
void BuildPose();
@ -218,7 +218,7 @@ public:
const TLockedToken<CSkinnedModel>& GetModelData() const { return xd8_modelData; }
static void PoseSkinnedModel(CSkinnedModel& model, const CPoseAsTransforms& pose, const CModelFlags& drawFlags,
const rstl::optional<CVertexMorphEffect>& morphEffect,
const std::optional<CVertexMorphEffect>& morphEffect,
const float* morphMagnitudes);
void AdvanceParticles(const zeus::CTransform& xf, float dt, const zeus::CVector3f&, CStateManager& stateMgr);
float GetAverageVelocity(int animIn) const;

View File

@ -82,7 +82,7 @@ std::unique_ptr<IAnimReader> CAnimTreeAnimReaderContainer::VClone() const {
return std::make_unique<CAnimTreeAnimReaderContainer>(x4_name, x14_reader->Clone(), x1c_animDbIdx);
}
rstl::optional<std::unique_ptr<IAnimReader>> CAnimTreeAnimReaderContainer::VSimplified() { return {}; }
std::optional<std::unique_ptr<IAnimReader>> CAnimTreeAnimReaderContainer::VSimplified() { return {}; }
void CAnimTreeAnimReaderContainer::VSetPhase(float ph) { x14_reader->VSetPhase(ph); }

View File

@ -33,7 +33,7 @@ public:
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const;
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut, const CCharAnimTime& time) const;
std::unique_ptr<IAnimReader> VClone() const;
rstl::optional<std::unique_ptr<IAnimReader>> VSimplified();
std::optional<std::unique_ptr<IAnimReader>> VSimplified();
void VSetPhase(float);
SAdvancementResults VGetAdvancementResults(const CCharAnimTime& a, const CCharAnimTime& b) const;
};

View File

@ -31,7 +31,7 @@ CAnimTreeEffectiveContribution CAnimTreeLoopIn::VGetContributionOfHighestInfluen
return x14_child->GetContributionOfHighestInfluence();
}
rstl::optional<std::unique_ptr<IAnimReader>> CAnimTreeLoopIn::VSimplified() {
std::optional<std::unique_ptr<IAnimReader>> CAnimTreeLoopIn::VSimplified() {
CCharAnimTime remTime = x14_child->VGetTimeRemaining();
if (remTime.GreaterThanZero() && !remTime.EpsilonZero()) {
auto simp = x14_child->Simplified();

View File

@ -23,7 +23,7 @@ public:
const CCharAnimTime& time);
CAnimTreeEffectiveContribution VGetContributionOfHighestInfluence() const;
bool VSupportsReverseView() const { return false; }
rstl::optional<std::unique_ptr<IAnimReader>> VSimplified();
std::optional<std::unique_ptr<IAnimReader>> VSimplified();
std::shared_ptr<IAnimReader> VGetBestUnblendedChild() const;
std::unique_ptr<IAnimReader> VClone() const;
u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const;

View File

@ -43,7 +43,7 @@ CCharAnimTime CAnimTreeTimeScale::GetRealLifeTime(const CCharAnimTime& time) con
void CAnimTreeTimeScale::VSetPhase(float phase) { x14_child->VSetPhase(phase); }
rstl::optional<std::unique_ptr<IAnimReader>> CAnimTreeTimeScale::VSimplified() {
std::optional<std::unique_ptr<IAnimReader>> CAnimTreeTimeScale::VSimplified() {
if (auto simp = x14_child->Simplified()) {
CAnimTreeTimeScale* newNode = new CAnimTreeTimeScale(CAnimTreeNode::Cast(std::move(*simp)), x18_timeScale->Clone(),
x28_targetAccelTime, x4_name);
@ -61,7 +61,7 @@ u32 CAnimTreeTimeScale::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode*
CCharAnimTime useTime = (time == CCharAnimTime::Infinity()) ? x14_child->VGetTimeRemaining() : GetRealLifeTime(time);
u32 ret = x14_child->GetBoolPOIList(useTime, listOut, capacity, iterator, unk);
if (x28_targetAccelTime > CCharAnimTime())
for (int i = 0; i < ret; ++i)
for (u32 i = 0; i < ret; ++i)
listOut[iterator + i].SetTime(GetRealLifeTime(listOut[i].GetTime()));
return ret;
}
@ -71,7 +71,7 @@ u32 CAnimTreeTimeScale::VGetInt32POIList(const CCharAnimTime& time, CInt32POINod
CCharAnimTime useTime = (time == CCharAnimTime::Infinity()) ? x14_child->VGetTimeRemaining() : GetRealLifeTime(time);
u32 ret = x14_child->GetInt32POIList(useTime, listOut, capacity, iterator, unk);
if (x28_targetAccelTime > CCharAnimTime())
for (int i = 0; i < ret; ++i)
for (u32 i = 0; i < ret; ++i)
listOut[iterator + i].SetTime(GetRealLifeTime(listOut[i].GetTime()));
return ret;
}
@ -81,7 +81,7 @@ u32 CAnimTreeTimeScale::VGetParticlePOIList(const CCharAnimTime& time, CParticle
CCharAnimTime useTime = (time == CCharAnimTime::Infinity()) ? x14_child->VGetTimeRemaining() : GetRealLifeTime(time);
u32 ret = x14_child->GetParticlePOIList(useTime, listOut, capacity, iterator, unk);
if (x28_targetAccelTime > CCharAnimTime())
for (int i = 0; i < ret; ++i)
for (u32 i = 0; i < ret; ++i)
listOut[iterator + i].SetTime(GetRealLifeTime(listOut[i].GetTime()));
return ret;
}
@ -91,7 +91,7 @@ u32 CAnimTreeTimeScale::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINod
CCharAnimTime useTime = (time == CCharAnimTime::Infinity()) ? x14_child->VGetTimeRemaining() : GetRealLifeTime(time);
u32 ret = x14_child->GetSoundPOIList(useTime, listOut, capacity, iterator, unk);
if (x28_targetAccelTime > CCharAnimTime())
for (int i = 0; i < ret; ++i)
for (u32 i = 0; i < ret; ++i)
listOut[iterator + i].SetTime(GetRealLifeTime(listOut[i].GetTime()));
return ret;
}

View File

@ -20,7 +20,7 @@ public:
CCharAnimTime GetRealLifeTime(const CCharAnimTime&) const;
void VSetPhase(float);
rstl::optional<std::unique_ptr<IAnimReader>> VSimplified();
std::optional<std::unique_ptr<IAnimReader>> VSimplified();
u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const;
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;

View File

@ -52,7 +52,7 @@ std::unique_ptr<IAnimReader> CAnimTreeTransition::VClone() const {
x2c_timeInTrans, x34_runA, x35_loopA, x1c_flags, x4_name, x36_initialized);
}
rstl::optional<std::unique_ptr<IAnimReader>> CAnimTreeTransition::VSimplified() {
std::optional<std::unique_ptr<IAnimReader>> CAnimTreeTransition::VSimplified() {
if (zeus::close_enough(GetBlendingWeight(), 1.f)) {
if (auto simp = x18_b->Simplified())
return simp;
@ -61,7 +61,7 @@ rstl::optional<std::unique_ptr<IAnimReader>> CAnimTreeTransition::VSimplified()
return CAnimTreeTweenBase::VSimplified();
}
rstl::optional<std::unique_ptr<IAnimReader>> CAnimTreeTransition::VReverseSimplified() {
std::optional<std::unique_ptr<IAnimReader>> CAnimTreeTransition::VReverseSimplified() {
if (zeus::close_enough(GetBlendingWeight(), 0.f))
return {x14_a->Clone()};
return CAnimTreeTweenBase::VReverseSimplified();

View File

@ -27,8 +27,8 @@ public:
CCharAnimTime VGetTimeRemaining() const;
CSteadyStateAnimInfo VGetSteadyStateAnimInfo() const;
std::unique_ptr<IAnimReader> VClone() const;
rstl::optional<std::unique_ptr<IAnimReader>> VSimplified();
rstl::optional<std::unique_ptr<IAnimReader>> VReverseSimplified();
std::optional<std::unique_ptr<IAnimReader>> VSimplified();
std::optional<std::unique_ptr<IAnimReader>> VReverseSimplified();
SAdvancementResults VAdvanceView(const CCharAnimTime& a);
void SetBlendingWeight(float w);
float VGetBlendingWeight() const;

View File

@ -104,7 +104,7 @@ zeus::CQuaternion CAnimTreeTweenBase::VGetRotation(const CSegId& seg) const {
return zeus::CQuaternion::slerp(qA, qB, weight);
}
rstl::optional<std::unique_ptr<IAnimReader>> CAnimTreeTweenBase::VSimplified() {
std::optional<std::unique_ptr<IAnimReader>> CAnimTreeTweenBase::VSimplified() {
if (x20_25_cullSelector == 0) {
auto simpA = x14_a->Simplified();
auto simpB = x18_b->Simplified();

View File

@ -30,8 +30,8 @@ public:
zeus::CVector3f VGetOffset(const CSegId& seg) const;
zeus::CQuaternion VGetRotation(const CSegId& seg) const;
rstl::optional<std::unique_ptr<IAnimReader>> VSimplified();
virtual rstl::optional<std::unique_ptr<IAnimReader>> VReverseSimplified() {
std::optional<std::unique_ptr<IAnimReader>> VSimplified();
virtual std::optional<std::unique_ptr<IAnimReader>> VReverseSimplified() {
return CAnimTreeTweenBase::VSimplified();
}

View File

@ -28,7 +28,7 @@ class CBoneTracking {
float x18_time = 0.f;
float x1c_maxTrackingAngle;
float x20_angSpeed;
rstl::optional<zeus::CVector3f> x24_targetPosition;
std::optional<zeus::CVector3f> x24_targetPosition;
TUniqueId x34_target = kInvalidUniqueId;
union {
struct {

View File

@ -82,7 +82,7 @@ std::unique_ptr<CAnimData> CCharacterFactory::CreateCharacter(int charIdx, bool
TToken<CSkinnedModel> skinnedModel = const_cast<CCharacterFactory*>(this)->x70_cacheResPool.GetObj(
{FourCC(drawInsts << 16), charInfo.GetModelId()}, charParm);
rstl::optional<TToken<CMorphableSkinnedModel>> iceModel;
std::optional<TToken<CMorphableSkinnedModel>> iceModel;
if (charInfo.GetIceModelId().IsValid() && charInfo.GetIceSkinRulesId().IsValid())
iceModel.emplace(const_cast<CCharacterFactory*>(this)->x70_cacheResPool.GetObj(
{FourCC((drawInsts << 16) | 1), charInfo.GetIceModelId()}, charParm));

View File

@ -445,7 +445,7 @@ void CGroundMovement::MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor&
} else {
float maxFloat = -1.0e10f;
int maxIdx = -1;
for (int i = 0; i < physStateList.size(); ++i) {
for (size_t i = 0; i < physStateList.size(); ++i) {
if (maxFloat < stepDeltaList[i]) {
maxFloat = stepDeltaList[i];
maxIdx = i;
@ -613,7 +613,7 @@ CMaterialList CGroundMovement::MoveObjectAnalytical(CStateManager& mgr, CPhysics
zeus::CVector3f floorPlaneNormal = opts.x3c_floorPlaneNormal ? *opts.x3c_floorPlaneNormal : zeus::skZero3f;
bool floorCollision = opts.x3c_floorPlaneNormal.operator bool();
float remDt = dt;
for (int i = 0; remDt > 0.f; ++i) {
for (size_t i = 0; remDt > 0.f; ++i) {
float collideDt = remDt;
CMotionState mState = actor.PredictMotion_Internal(remDt);

View File

@ -30,12 +30,12 @@ public:
float x30_wallElasticConstant;
float x34_wallElasticLinear;
float x38_maxPositiveVerticalVelocity;
rstl::optional<zeus::CVector3f> x3c_floorPlaneNormal;
std::optional<zeus::CVector3f> x3c_floorPlaneNormal;
};
struct SMoveObjectResult {
rstl::optional<TUniqueId> x0_id;
rstl::optional<CCollisionInfo> x8_collision;
std::optional<TUniqueId> x0_id;
std::optional<CCollisionInfo> x8_collision;
u32 x6c_processedCollisions;
float x70_processedDt;
};

View File

@ -1,6 +1,7 @@
#include "CHierarchyPoseBuilder.hpp"
#include "CAnimData.hpp"
#include "CCharLayoutInfo.hpp"
#include "zeus/CEulerAngles.hpp"
namespace urde {
@ -54,6 +55,15 @@ void CHierarchyPoseBuilder::RecursivelyBuild(const CSegId& boneId, const CTreeNo
const zeus::CQuaternion& parentRot, const zeus::CMatrix3f& parentXf,
const zeus::CVector3f& parentOffset) const {
zeus::CQuaternion quat = parentRot * node.x4_rotation;
if (boneId == 4 && x0_layoutDesc.GetCharLayoutInfo().GetObjectTag()->id == 1683497588) {
zeus::CQuaternion rootq(CGraphics::g_GXModelMatrix.basis);
printf("WTF3 %f\n", zeus::radToDeg(zeus::CEulerAngles(rootq).z()));
printf("WTF4 %f\n", zeus::radToDeg(zeus::CEulerAngles(node.x4_rotation).z()));
}
if (boneId == 6 && x0_layoutDesc.GetCharLayoutInfo().GetObjectTag()->id == 1683497588)
printf("WTF6 %f %f %f %f\n",
float(node.x4_rotation.w()), float(node.x4_rotation.x()),
float(node.x4_rotation.y()), float(node.x4_rotation.z()));
float scale;
zeus::CVector3f bindOffset;

View File

@ -1,6 +1,6 @@
#pragma once
#include "optional.hpp"
#include <optional>
#include "CToken.hpp"
#include "zeus/CVector3f.hpp"
@ -12,22 +12,22 @@ public:
class CScaledLayoutDescription {
TLockedToken<CCharLayoutInfo> x0_layoutToken;
float xc_scale;
rstl::optional<zeus::CVector3f> x10_scaleVec;
std::optional<zeus::CVector3f> x10_scaleVec;
public:
const TLockedToken<CCharLayoutInfo>& ScaledLayout() const { return x0_layoutToken; }
float GlobalScale() const { return xc_scale; }
const rstl::optional<zeus::CVector3f>& GetScaleVec() const { return x10_scaleVec; }
const std::optional<zeus::CVector3f>& GetScaleVec() const { return x10_scaleVec; }
};
private:
TLockedToken<CCharLayoutInfo> x0_layoutToken;
rstl::optional<CScaledLayoutDescription> xc_scaled;
std::optional<CScaledLayoutDescription> xc_scaled;
public:
CLayoutDescription(const TLockedToken<CCharLayoutInfo>& token) : x0_layoutToken(token) {}
const rstl::optional<CScaledLayoutDescription>& GetScaledLayoutDescription() const { return xc_scaled; }
const std::optional<CScaledLayoutDescription>& GetScaledLayoutDescription() const { return xc_scaled; }
const TLockedToken<CCharLayoutInfo>& GetCharLayoutInfo() const { return x0_layoutToken; }
bool UsesScale() const { return bool(xc_scaled); }

View File

@ -26,7 +26,7 @@ void CMetaAnimRandom::GetUniquePrimitives(std::set<CPrimitive>& primsOut) const
std::shared_ptr<CAnimTreeNode> CMetaAnimRandom::VGetAnimationTree(const CAnimSysContext& animSys,
const CMetaAnimTreeBuildOrders& orders) const {
s32 r = animSys.x8_random->Range(1, 100);
u32 r = animSys.x8_random->Range(1, 100);
const std::pair<std::shared_ptr<IMetaAnim>, u32>* useRd = nullptr;
for (auto& rd : x4_randomData) {
useRd = &rd;

View File

@ -113,7 +113,7 @@ void CParticleGenInfoGeneric::SetParticleEmission(bool emission, CStateManager&
bool CParticleGenInfoGeneric::IsSystemDeletable() const { return x84_system->IsSystemDeletable(); }
rstl::optional<zeus::CAABox> CParticleGenInfoGeneric::GetBounds() const { return x84_system->GetBounds(); }
std::optional<zeus::CAABox> CParticleGenInfoGeneric::GetBounds() const { return x84_system->GetBounds(); }
bool CParticleGenInfoGeneric::HasActiveParticles() const { return x84_system->GetParticleCount() != 0; }

View File

@ -42,7 +42,7 @@ public:
virtual void SetGlobalScale(const zeus::CVector3f& scale) = 0;
virtual void SetParticleEmission(bool, CStateManager& stateMgr) = 0;
virtual bool IsSystemDeletable() const = 0;
virtual rstl::optional<zeus::CAABox> GetBounds() const = 0;
virtual std::optional<zeus::CAABox> GetBounds() const = 0;
virtual bool HasActiveParticles() const = 0;
virtual void DestroyParticles() = 0;
virtual bool HasLight() const = 0;
@ -95,7 +95,7 @@ public:
void SetGlobalScale(const zeus::CVector3f& scale);
void SetParticleEmission(bool, CStateManager& stateMgr);
bool IsSystemDeletable() const;
rstl::optional<zeus::CAABox> GetBounds() const;
std::optional<zeus::CAABox> GetBounds() const;
bool HasActiveParticles() const;
void DestroyParticles();
bool HasLight() const;

View File

@ -44,11 +44,11 @@ CSequenceFundamentals CSequenceHelper::ComputeSequenceFundamentals() {
std::vector<CSoundPOINode> soundNodes;
if (x10_treeNodes.size() > 0) {
std::shared_ptr<CAnimTreeNode> node = CAnimTreeNode::Cast(x10_treeNodes[0]->Clone());
for (int i = 0; i < x10_treeNodes.size(); ++i) {
for (size_t i = 0; i < x10_treeNodes.size(); ++i) {
CBoolPOINode boolNodeArr[64];
u32 numBools = node->GetBoolPOIList(CCharAnimTime::Infinity(), boolNodeArr, 64, 0, 0);
boolNodes.reserve(boolNodes.size() + numBools);
for (int j = 0; j < numBools; ++j) {
for (u32 j = 0; j < numBools; ++j) {
CBoolPOINode& n = boolNodeArr[j];
n.SetTime(n.GetTime() + duration);
boolNodes.push_back(n);
@ -57,7 +57,7 @@ CSequenceFundamentals CSequenceHelper::ComputeSequenceFundamentals() {
CInt32POINode int32NodeArr[64];
u32 numInt32s = node->GetInt32POIList(CCharAnimTime::Infinity(), int32NodeArr, 64, 0, 0);
int32Nodes.reserve(int32Nodes.size() + numInt32s);
for (int j = 0; j < numInt32s; ++j) {
for (u32 j = 0; j < numInt32s; ++j) {
CInt32POINode& n = int32NodeArr[j];
n.SetTime(n.GetTime() + duration);
int32Nodes.push_back(n);
@ -66,7 +66,7 @@ CSequenceFundamentals CSequenceHelper::ComputeSequenceFundamentals() {
CParticlePOINode particleNodeArr[64];
u32 numParticles = node->GetParticlePOIList(CCharAnimTime::Infinity(), particleNodeArr, 64, 0, 0);
particleNodes.reserve(particleNodes.size() + numParticles);
for (int j = 0; j < numParticles; ++j) {
for (u32 j = 0; j < numParticles; ++j) {
CParticlePOINode& n = particleNodeArr[j];
n.SetTime(n.GetTime() + duration);
particleNodes.push_back(n);
@ -75,7 +75,7 @@ CSequenceFundamentals CSequenceHelper::ComputeSequenceFundamentals() {
CSoundPOINode soundNodeArr[64];
u32 numSounds = node->GetSoundPOIList(CCharAnimTime::Infinity(), soundNodeArr, 64, 0, 0);
soundNodes.reserve(soundNodes.size() + numSounds);
for (int j = 0; j < numSounds; ++j) {
for (u32 j = 0; j < numSounds; ++j) {
CSoundPOINode& n = soundNodeArr[j];
n.SetTime(n.GetTime() + duration);
soundNodes.push_back(n);

View File

@ -119,7 +119,7 @@ public:
virtual void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut,
const CCharAnimTime& time) const = 0;
virtual std::unique_ptr<IAnimReader> VClone() const = 0;
virtual rstl::optional<std::unique_ptr<IAnimReader>> VSimplified() { return {}; }
virtual std::optional<std::unique_ptr<IAnimReader>> VSimplified() { return {}; }
virtual void VSetPhase(float) = 0;
virtual SAdvancementResults VGetAdvancementResults(const CCharAnimTime& a, const CCharAnimTime& b) const;
@ -128,7 +128,7 @@ public:
u32 GetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator, u32) const;
u32 GetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator, u32) const;
rstl::optional<std::unique_ptr<IAnimReader>> Simplified() { return VSimplified(); }
std::optional<std::unique_ptr<IAnimReader>> Simplified() { return VSimplified(); }
std::unique_ptr<IAnimReader> Clone() const { return VClone(); }
};

View File

@ -41,8 +41,8 @@ public:
};
struct CMetaAnimTreeBuildOrders {
rstl::optional<CPreAdvanceIndicator> x0_recursiveAdvance;
rstl::optional<CPreAdvanceIndicator> x44_singleAdvance;
std::optional<CPreAdvanceIndicator> x0_recursiveAdvance;
std::optional<CPreAdvanceIndicator> x44_singleAdvance;
static CMetaAnimTreeBuildOrders NoSpecialOrders() { return {}; }
static CMetaAnimTreeBuildOrders PreAdvanceForAll(const CPreAdvanceIndicator& ind) {
CMetaAnimTreeBuildOrders ret;

View File

@ -14,7 +14,7 @@ class CAreaOctTree {
public:
struct SRayResult {
zeus::CPlane x0_plane;
rstl::optional<CCollisionSurface> x10_surface;
std::optional<CCollisionSurface> x10_surface;
float x3c_t;
};

View File

@ -14,7 +14,7 @@ CCollidableOBBTree::CCollidableOBBTree(const COBBTree* tree, const urde::CMateri
bool CCollidableOBBTree::LineIntersectsLeaf(const COBBTree::CLeafData& leaf, CRayCastInfo& info) const {
bool ret = false;
u16 intersectIdx = 0;
for (int i = 0; i < leaf.GetSurfaceVector().size(); ++i) {
for (size_t i = 0; i < leaf.GetSurfaceVector().size(); ++i) {
u16 surfIdx = leaf.GetSurfaceVector()[i];
CCollisionSurface surface = x10_tree->GetSurface(surfIdx);
CMaterialList matList = GetMaterial();

View File

@ -139,8 +139,8 @@ zeus::CTransform CCollisionActor::GetPrimitiveTransform() const {
return xf;
}
rstl::optional<zeus::CAABox> CCollisionActor::GetTouchBounds() const {
rstl::optional<zeus::CAABox> aabox;
std::optional<zeus::CAABox> CCollisionActor::GetTouchBounds() const {
std::optional<zeus::CAABox> aabox;
if (x258_primitiveType == EPrimitiveType::OBBTreeGroup)
aabox = {x27c_obbTreeGroupPrimitive->CalculateAABox(x34_transform)};
else if (x258_primitiveType == EPrimitiveType::AABox)

Some files were not shown because too many files have changed in this diff Show More