mirror of https://github.com/PrimeDecomp/prime.git
parent
1c3d63ed98
commit
5580c42dc6
|
@ -8,7 +8,6 @@
|
|||
],
|
||||
"cStandard": "c99",
|
||||
"cppStandard": "c++98",
|
||||
"defines": ["__MWERKS__=1"],
|
||||
"intelliSenseMode": "linux-clang-x86",
|
||||
"compilerPath": ""
|
||||
}
|
||||
|
|
69
configure.py
69
configure.py
|
@ -26,6 +26,7 @@ LIBS = [
|
|||
"lib": "TRK_MINNOW_DOLPHIN",
|
||||
"mwcc_version": "1.2.5",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
["MetroTRK/mslsupp", True],
|
||||
],
|
||||
|
@ -34,6 +35,7 @@ LIBS = [
|
|||
"lib": "MetroidPrimeCW",
|
||||
"cflags": "$cflags_retro",
|
||||
"mwcc_version": "1.3.2",
|
||||
"host": True,
|
||||
"objects": [
|
||||
["MetroidPrime/main", False],
|
||||
"MetroidPrime/IRenderer",
|
||||
|
@ -86,7 +88,7 @@ LIBS = [
|
|||
"MetroidPrime/CPauseScreen",
|
||||
"MetroidPrime/Tweaks/CTweakGui",
|
||||
"MetroidPrime/ScriptObjects/CScriptActor",
|
||||
"MetroidPrime/ScriptObjects/CScriptTrigger",
|
||||
["MetroidPrime/ScriptObjects/CScriptTrigger", False],
|
||||
"MetroidPrime/ScriptObjects/CScriptWaypoint",
|
||||
"MetroidPrime/Enemies/CPatterned",
|
||||
"MetroidPrime/ScriptObjects/CScriptDoor",
|
||||
|
@ -231,7 +233,7 @@ LIBS = [
|
|||
"MetroidPrime/Factories/CScannableObjectInfo",
|
||||
"MetroidPrime/Enemies/CMetroid",
|
||||
"MetroidPrime/Player/CScanDisplay",
|
||||
"MetroidPrime/ScriptObjects/CScriptSteam",
|
||||
["MetroidPrime/ScriptObjects/CScriptSteam", False],
|
||||
["MetroidPrime/ScriptObjects/CScriptRipple", False],
|
||||
"MetroidPrime/CBoneTracking",
|
||||
"MetroidPrime/Player/CFaceplateDecoration",
|
||||
|
@ -395,6 +397,7 @@ LIBS = [
|
|||
"lib": "WorldFormatCW",
|
||||
"mwcc_version": "1.3.2",
|
||||
"cflags": "$cflags_retro",
|
||||
"host": True,
|
||||
"objects": [
|
||||
"WorldFormat/CAreaOctTree_Tests",
|
||||
["WorldFormat/CCollisionSurface", True],
|
||||
|
@ -414,6 +417,7 @@ LIBS = [
|
|||
"lib": "WeaponsCW",
|
||||
"mwcc_version": "1.3.2",
|
||||
"cflags": "$cflags_retro",
|
||||
"host": True,
|
||||
"objects": [
|
||||
"Weapons/CProjectileWeapon",
|
||||
"Weapons/CProjectileWeaponDataFactory",
|
||||
|
@ -429,12 +433,14 @@ LIBS = [
|
|||
"lib": "MetaRenderCW",
|
||||
"mwcc_version": "1.3.2",
|
||||
"cflags": "$cflags_retro",
|
||||
"host": True,
|
||||
"objects": ["MetaRender/CCubeRenderer"],
|
||||
},
|
||||
{
|
||||
"lib": "GuiSysCW",
|
||||
"mwcc_version": "1.3.2",
|
||||
"cflags": "$cflags_retro",
|
||||
"host": True,
|
||||
"objects": [
|
||||
"GuiSys/CAuiMain",
|
||||
"GuiSys/CAuiMeter",
|
||||
|
@ -461,6 +467,7 @@ LIBS = [
|
|||
"lib": "CollisionCW",
|
||||
"mwcc_version": "1.3.2",
|
||||
"cflags": "$cflags_retro",
|
||||
"host": True,
|
||||
"objects": [
|
||||
"Collision/CCollidableAABox",
|
||||
"Collision/CCollidableCollisionSurface",
|
||||
|
@ -479,6 +486,7 @@ LIBS = [
|
|||
"lib": "Kyoto_CW1",
|
||||
"mwcc_version": "1.3.2",
|
||||
"cflags": "$cflags_retro",
|
||||
"host": True,
|
||||
"objects": [
|
||||
"Kyoto/Basics/CBasics",
|
||||
["Kyoto/Basics/CStopwatch", True],
|
||||
|
@ -632,6 +640,7 @@ LIBS = [
|
|||
"lib": "zlib",
|
||||
"mwcc_version": "1.3.2",
|
||||
"cflags": "$cflags_runtime",
|
||||
"host": True,
|
||||
"objects": [
|
||||
["Kyoto/zlib/adler32", True],
|
||||
["Kyoto/zlib/infblock", True],
|
||||
|
@ -647,6 +656,7 @@ LIBS = [
|
|||
"lib": "Kyoto_CW2",
|
||||
"mwcc_version": "1.3.2",
|
||||
"cflags": "$cflags_retro",
|
||||
"host": True,
|
||||
"objects": [
|
||||
"Kyoto/CARAMManager",
|
||||
"Kyoto/Math/CFrustumPlanes",
|
||||
|
@ -708,6 +718,7 @@ LIBS = [
|
|||
"lib": "ai",
|
||||
"mwcc_version": "1.2.5",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
["Dolphin/ai", False],
|
||||
],
|
||||
|
@ -716,6 +727,7 @@ LIBS = [
|
|||
"lib": "ar",
|
||||
"mwcc_version": "1.2.5",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
"Dolphin/ar/ar",
|
||||
"Dolphin/ar/arq",
|
||||
|
@ -725,6 +737,7 @@ LIBS = [
|
|||
"lib": "base",
|
||||
"mwcc_version": "1.2.5",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
["Dolphin/PPCArch", True],
|
||||
],
|
||||
|
@ -733,6 +746,7 @@ LIBS = [
|
|||
"lib": "db",
|
||||
"mwcc_version": "1.2.5",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
["Dolphin/db", True],
|
||||
],
|
||||
|
@ -741,6 +755,7 @@ LIBS = [
|
|||
"lib": "dsp",
|
||||
"mwcc_version": "1.2.5",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
["Dolphin/dsp/dsp", False],
|
||||
["Dolphin/dsp/dsp_debug", True],
|
||||
|
@ -751,6 +766,7 @@ LIBS = [
|
|||
"lib": "dvd",
|
||||
"mwcc_version": "1.2.5",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
"Dolphin/dvd/dvdlow",
|
||||
"Dolphin/dvd/dvdfs",
|
||||
|
@ -766,6 +782,7 @@ LIBS = [
|
|||
"lib": "gx",
|
||||
"mwcc_version": "1.2.5",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
"Dolphin/gx/GXInit",
|
||||
"Dolphin/gx/GXFifo",
|
||||
|
@ -788,6 +805,7 @@ LIBS = [
|
|||
"lib": "mtx",
|
||||
"mwcc_version": "1.2.5",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
"Dolphin/mtx/mtx",
|
||||
"Dolphin/mtx/mtx44vec",
|
||||
|
@ -800,6 +818,7 @@ LIBS = [
|
|||
"lib": "os",
|
||||
"mwcc_version": "1.2.5e",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
["Dolphin/os/__start", True],
|
||||
"Dolphin/os/OS",
|
||||
|
@ -829,6 +848,7 @@ LIBS = [
|
|||
"lib": "pad",
|
||||
"mwcc_version": "1.2.5e",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
["Dolphin/pad/PadClamp", True],
|
||||
["Dolphin/pad/pad", False],
|
||||
|
@ -838,12 +858,16 @@ LIBS = [
|
|||
"lib": "vi",
|
||||
"mwcc_version": "1.2.5",
|
||||
"cflags": "$cflags_base",
|
||||
"objects": ["Dolphin/vi"],
|
||||
"host": False,
|
||||
"objects": [
|
||||
"Dolphin/vi"
|
||||
],
|
||||
},
|
||||
{
|
||||
"lib": "MSL_C.PPCEABI.bare.H",
|
||||
"mwcc_version": "1.3.2",
|
||||
"cflags": "$cflags_runtime",
|
||||
"host": False,
|
||||
"objects": [
|
||||
["Runtime/__mem", True],
|
||||
["Runtime/__va_arg", True],
|
||||
|
@ -915,6 +939,7 @@ LIBS = [
|
|||
"lib": "musyx",
|
||||
"mwcc_version": "1.3.2",
|
||||
"cflags": "$cflags_musyx",
|
||||
"host": False,
|
||||
"objects": [
|
||||
"musyx/seq",
|
||||
"musyx/synth",
|
||||
|
@ -953,6 +978,7 @@ LIBS = [
|
|||
"lib": "dtk",
|
||||
"mwcc_version": "1.2.5",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
["Dolphin/dtk", True],
|
||||
],
|
||||
|
@ -961,6 +987,7 @@ LIBS = [
|
|||
"lib": "card",
|
||||
"mwcc_version": "1.2.5e",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
["Dolphin/card/CARDBios", False],
|
||||
["Dolphin/card/CARDUnlock", True],
|
||||
|
@ -984,6 +1011,7 @@ LIBS = [
|
|||
"lib": "si",
|
||||
"mwcc_version": "1.2.5e",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
["Dolphin/si/SIBios", False],
|
||||
["Dolphin/si/SISamplingRate", True],
|
||||
|
@ -993,6 +1021,7 @@ LIBS = [
|
|||
"lib": "exi",
|
||||
"mwcc_version": "1.2.5",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
"Dolphin/exi/EXIBios",
|
||||
"Dolphin/exi/EXIUart",
|
||||
|
@ -1002,6 +1031,7 @@ LIBS = [
|
|||
"lib": "thp",
|
||||
"mwcc_version": "1.2.5",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
"Dolphin/thp/THPDec",
|
||||
"Dolphin/thp/THPAudio",
|
||||
|
@ -1011,6 +1041,7 @@ LIBS = [
|
|||
"lib": "gba",
|
||||
"mwcc_version": "1.2.5e",
|
||||
"cflags": "$cflags_base",
|
||||
"host": False,
|
||||
"objects": [
|
||||
["Dolphin/GBA/GBA", True],
|
||||
["Dolphin/GBA/GBAGetProcessStatus", False],
|
||||
|
@ -1092,6 +1123,9 @@ else:
|
|||
n.variable("wine", "wine ")
|
||||
n.variable("exe", "")
|
||||
n.newline()
|
||||
n.variable("host_cflags", "-I include/ -Wno-trigraphs")
|
||||
n.variable("host_cppflags",
|
||||
"-std=c++98 -I include/ -fno-exceptions -fno-rtti -Wno-trigraphs")
|
||||
|
||||
###
|
||||
# Rules
|
||||
|
@ -1133,17 +1167,17 @@ else:
|
|||
n.rule(name="ar", command="$devkitppc/bin/powerpc-eabi-ar crs $out $in",
|
||||
description="AR $out")
|
||||
n.newline()
|
||||
|
||||
n.rule(name="host_cc", command="clang -I include/ -Wno-trigraphs -o $out $in",
|
||||
description="host_cc $out")
|
||||
n.rule(name="host_cpp", command="clang++ -std=c++03 -I include/ -Wno-trigraphs -o $out $in",
|
||||
description="host_c++ $out")
|
||||
n.rule(name="host_cc", command="clang $host_cflags -c -o $out $in",
|
||||
description="host_cc $out")
|
||||
n.rule(name="host_cpp", command="clang++ $host_cppflags -c -o $out $in",
|
||||
description="host_c++ $out")
|
||||
n.newline()
|
||||
|
||||
###
|
||||
# Build
|
||||
###
|
||||
all_source_files = []
|
||||
all_host_source_files = []
|
||||
for lib in LIBS:
|
||||
inputs = []
|
||||
if "lib" in lib:
|
||||
|
@ -1152,7 +1186,7 @@ for lib in LIBS:
|
|||
else:
|
||||
n.comment("Loose files")
|
||||
for object in lib["objects"]:
|
||||
completed = False
|
||||
completed = None
|
||||
add_to_all = True
|
||||
if type(object) is list:
|
||||
if len(object) > 2:
|
||||
|
@ -1167,6 +1201,8 @@ for lib in LIBS:
|
|||
elif os.path.exists(os.path.join("src", f"{object}.c")):
|
||||
c_file = os.path.join("src", f"{object}.c")
|
||||
if c_file is not None:
|
||||
if completed is None:
|
||||
print(f"Mark as incomplete: {c_file}")
|
||||
rule = "mwcc"
|
||||
if mwcc_version == "1.2.5e":
|
||||
mwcc_version = "1.2.5"
|
||||
|
@ -1178,11 +1214,14 @@ for lib in LIBS:
|
|||
"basedir": os.path.dirname(f"$builddir/src/{object}"),
|
||||
"basefile": f"$builddir/src/{object}"
|
||||
})
|
||||
n.build(f"$builddir/host/{object}.o", "host_cc" if c_file.endswith(".c") else "host_cpp", c_file,
|
||||
variables={
|
||||
"basedir": os.path.dirname(f"$builddir/src/{object}"),
|
||||
"basefile": f"$builddir/src/{object}"
|
||||
})
|
||||
if lib["host"]:
|
||||
n.build(f"$builddir/host/{object}.o", "host_cc" if c_file.endswith(".c") else "host_cpp", c_file,
|
||||
variables={
|
||||
"basedir": os.path.dirname(f"$builddir/src/{object}"),
|
||||
"basefile": f"$builddir/src/{object}"
|
||||
})
|
||||
if add_to_all:
|
||||
all_host_source_files.append(f"$builddir/host/{object}.o")
|
||||
if add_to_all:
|
||||
all_source_files.append(f"$builddir/src/{object}.o")
|
||||
if os.path.exists(os.path.join("asm", f"{object}.s")):
|
||||
|
@ -1232,7 +1271,7 @@ n.newline()
|
|||
# Helper rule for building all source files, with a host compiler
|
||||
###
|
||||
n.comment("Adds a command for building all source files with a host compiler")
|
||||
n.build("all_source_host", "phony", [s.replace("/src/", "/host/") for s in all_source_files])
|
||||
n.build("all_source_host", "phony", all_host_source_files)
|
||||
n.newline()
|
||||
|
||||
###
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef _CMEMORY
|
||||
#define _CMEMORY
|
||||
|
||||
#include "types.h"
|
||||
#include "Kyoto/Alloc/IAllocator.hpp"
|
||||
#include "Kyoto/Alloc/CCallStack.hpp"
|
||||
#include "Kyoto/Alloc/IAllocator.hpp"
|
||||
#include "types.h"
|
||||
|
||||
class COsContext;
|
||||
class CMemory {
|
||||
|
@ -16,7 +16,8 @@ public:
|
|||
static void SetAllocator(COsContext& ctx, IAllocator& allocator);
|
||||
static IAllocator* GetAllocator();
|
||||
static void* Alloc(size_t len, IAllocator::EHint hint = IAllocator::kHI_None,
|
||||
IAllocator::EScope scope = IAllocator::kSC_Unk1, IAllocator::EType type = IAllocator::kTP_Heap,
|
||||
IAllocator::EScope scope = IAllocator::kSC_Unk1,
|
||||
IAllocator::EType type = IAllocator::kTP_Heap,
|
||||
const CCallStack& callstack = CCallStack(-1, "??(??)"));
|
||||
static void Free(const void* ptr);
|
||||
static void SetOutOfMemoryCallback(IAllocator::FOutOfMemoryCb callback, const void* context);
|
||||
|
@ -26,13 +27,25 @@ public:
|
|||
void* operator new(size_t sz, const char*, const char*);
|
||||
void* operator new[](size_t sz, const char*, const char*);
|
||||
// TODO remove
|
||||
#ifdef __MWERKS__
|
||||
inline void* operator new(size_t sz) { return operator new(sz, "??(??)", nullptr); }
|
||||
inline void* operator new[](size_t sz) { return operator new[](sz, "??(??)", nullptr); }
|
||||
#else
|
||||
__attribute__((weak)) void* operator new(size_t sz) { return operator new(sz, "??(??)", nullptr); }
|
||||
__attribute__((weak)) void* operator new[](size_t sz) {
|
||||
return operator new[](sz, "??(??)", nullptr);
|
||||
}
|
||||
#endif
|
||||
// placement new
|
||||
inline void* operator new(size_t n, void* ptr) { return ptr; };
|
||||
|
||||
#ifdef __MWERKS__
|
||||
inline void operator delete(void* ptr) { CMemory::Free(ptr); }
|
||||
inline void operator delete[](void* ptr) { CMemory::Free(ptr); }
|
||||
#else
|
||||
__attribute__((weak)) void operator delete(void* ptr) { CMemory::Free(ptr); }
|
||||
__attribute__((weak)) void operator delete[](void* ptr) { CMemory::Free(ptr); }
|
||||
#endif
|
||||
|
||||
#define NEW new ("??(??)", nullptr)
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "Kyoto/CResLoader.hpp"
|
||||
#include "Kyoto/IObjectStore.hpp"
|
||||
|
||||
class IDvdRequest;
|
||||
|
||||
class CPakFile : CDvdFile {
|
||||
public:
|
||||
bool IsWorldPak() const { return x28_26_worldPak; }
|
||||
|
@ -23,8 +25,8 @@ private:
|
|||
bool x28_25_aramFile : 1;
|
||||
bool x28_26_worldPak : 1;
|
||||
bool x28_27_stashedInARAM : 1;
|
||||
int x2c_asyncLoadPhase; // EAsyncPhase
|
||||
rstl::auto_ptr< void > x30_dvdReq; // IDvdRequest
|
||||
int x2c_asyncLoadPhase; // EAsyncPhase
|
||||
rstl::auto_ptr< IDvdRequest > x30_dvdReq;
|
||||
rstl::vector< uchar > x38_headerData;
|
||||
uint x48_resTableOffset;
|
||||
uint x4c_resTableCount;
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
static float SqrtF(float v);
|
||||
static inline float Limit(float v, float h) { return fabs(v) > h ? h * Sign(v) : v; }
|
||||
static inline float Sign(float v) { return FastFSel(v, 1.f, -1.f); }
|
||||
#ifdef __MWERKS__
|
||||
static inline float FastFSel(register float v, register float h, register float l) {
|
||||
register float out;
|
||||
asm {
|
||||
|
@ -28,6 +29,11 @@ public:
|
|||
}
|
||||
return out;
|
||||
}
|
||||
#else
|
||||
static inline float FastFSel(float v, float h, float l) {
|
||||
return v >= 0.f ? h : l;
|
||||
}
|
||||
#endif
|
||||
static inline float AbsF(float v) { return fabs(v); }
|
||||
static inline double AbsD(double v) { return fabs(v); }
|
||||
static inline int AbsI(int v) { return abs(v); }
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "types.h"
|
||||
|
||||
#include "stddef.h"
|
||||
|
||||
class CInputStream;
|
||||
template < typename T >
|
||||
struct TType {};
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "types.h"
|
||||
|
||||
#include "stddef.h"
|
||||
|
||||
class COutputStream;
|
||||
|
||||
|
|
|
@ -6,36 +6,37 @@
|
|||
#include "rstl/optional_object.hpp"
|
||||
#include "rstl/vector.hpp"
|
||||
|
||||
template < typename T >
|
||||
T GetAverageValue(const T* ptr, int count); // TODO
|
||||
|
||||
template < typename T >
|
||||
class TAverage : rstl::vector< T > {
|
||||
public:
|
||||
TAverage() {}
|
||||
TAverage(int capacity, const T& value);
|
||||
|
||||
void AddValue(const T& value);
|
||||
rstl::optional_object< T > GetAverage() const {
|
||||
if (empty()) {
|
||||
if (this->empty()) {
|
||||
return rstl::optional_object_null();
|
||||
} else {
|
||||
return GetAverageValue(data(), size());
|
||||
return GetAverageValue(this->data(), this->size());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
TAverage< T >::TAverage(int capacity, const T& value) {
|
||||
resize(capacity, value);
|
||||
this->resize(capacity, value);
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
void TAverage< T >::AddValue(const T& value) {
|
||||
if (size() == capacity()) {
|
||||
if (this->size() == this->capacity()) {
|
||||
// TODO ?
|
||||
x4_count -= 1;
|
||||
this->x4_count -= 1;
|
||||
}
|
||||
insert(begin(), value);
|
||||
this->insert(this->begin(), value);
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
T GetAverageValue(const T* ptr, int count); // TODO
|
||||
|
||||
#endif // _TAVERAGE
|
||||
|
|
|
@ -16,11 +16,11 @@ public:
|
|||
// resize(value, N); TODO
|
||||
}
|
||||
void AddValue(const T& value) {
|
||||
push_back(value);
|
||||
for (int i = size() - 1; i > 0; --i) {
|
||||
operator[](i) = operator[](i - 1);
|
||||
this->push_back(value);
|
||||
for (int i = this->size() - 1; i > 0; --i) {
|
||||
this->operator[](i) = this->operator[](i - 1);
|
||||
}
|
||||
operator[](0) = value;
|
||||
this->operator[](0) = value;
|
||||
}
|
||||
rstl::optional_object< T > GetAverage() const;
|
||||
};
|
||||
|
|
|
@ -51,8 +51,9 @@ public:
|
|||
CTransform4f CalculateCameraBobTransformation() const;
|
||||
static void ReadTweaks(CInputStream& in);
|
||||
|
||||
static const CVector2f& GetCameraBobExtent() { return CVector2f(kCameraBobExtentX, kCameraBobExtentY); }
|
||||
static float GetCameraBobPeriod() { return kCameraBobPeriod; }
|
||||
// static float GetCameraBobExtentX() { return kCameraBobExtentX; }
|
||||
// static float GetCameraBobExtentY() { return kCameraBobExtentY; }
|
||||
// static float GetCameraBobPeriod() { return kCameraBobPeriod; }
|
||||
static float GetOrbitBobScale() { return kOrbitBobScale; }
|
||||
static float GetMaxOrbitBobScale() { return kMaxOrbitBobScale; }
|
||||
static float GetSlowSpeedPeriodScale() { return kSlowSpeedPeriodScale; }
|
||||
|
@ -85,6 +86,7 @@ private:
|
|||
float x100_wanderMagnitude;
|
||||
float x104_targetWanderMagnitude;
|
||||
|
||||
public:
|
||||
static float kCameraBobExtentX;
|
||||
static float kCameraBobExtentY;
|
||||
static float kCameraBobPeriod;
|
||||
|
|
|
@ -17,7 +17,6 @@ private:
|
|||
typedef red_black_tree< K, value_type, 1, select1st< value_type >, Cmp, Alloc > rep_type;
|
||||
|
||||
public:
|
||||
typedef pair< K, V > value_type;
|
||||
// typedef typename rep_type::iterator iterator;
|
||||
typedef typename rep_type::const_iterator const_iterator;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ void rc_ptr< T >::ReleaseData() {
|
|||
template < typename T >
|
||||
class ncrc_ptr : public rc_ptr< T > {
|
||||
public:
|
||||
ncrc_ptr(T* ptr) : rc_ptr(ptr) {}
|
||||
ncrc_ptr(T* ptr) : rc_ptr< T >(ptr) {}
|
||||
};
|
||||
} // namespace rstl
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ void vector< T, Alloc >::reserve(int newSize) {
|
|||
if (newSize <= x8_capacity) {
|
||||
return;
|
||||
}
|
||||
T* newData = x0_allocator.allocate2< T >(newSize);
|
||||
T* newData = x0_allocator.template allocate2< T >(newSize);
|
||||
uninitialized_copy(begin(), end(), newData);
|
||||
destroy(xc_items, xc_items + x4_count);
|
||||
x0_allocator.deallocate(xc_items);
|
||||
|
@ -154,7 +154,7 @@ void vector< T, Alloc >::reserve(int newSize) {
|
|||
|
||||
template < typename T, typename Alloc >
|
||||
typename vector< T, Alloc >::iterator vector< T, Alloc >::insert(iterator it, const T& value) {
|
||||
iterator::difference_type diff = it - begin(); // distance(begin(), it);
|
||||
typename iterator::difference_type diff = it - begin(); // distance(begin(), it);
|
||||
const_counting_iterator< T > in(&value, 0);
|
||||
insert_into(it, 1, in);
|
||||
return begin() + diff;
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
#include "Kyoto/Streams/COutputStream.hpp"
|
||||
#include "types.h"
|
||||
|
||||
#ifndef __MWERKS__
|
||||
// TODO
|
||||
#define __HI(x) (*(int*)&x)
|
||||
#endif
|
||||
|
||||
CVector3f CVector3f::sZeroVector(0.f, 0.f, 0.f);
|
||||
CVector3f CVector3f::sUpVector(0.f, 0.f, 1.f);
|
||||
CVector3f CVector3f::sDownVector(0.f, 0.f, -1.f);
|
||||
|
@ -26,8 +31,8 @@ void CVector3f::PutTo(COutputStream& out) const {
|
|||
CVector3f CVector3f::Slerp(const CVector3f& a, const CVector3f& b, const CRelAngle& angle) {
|
||||
CVector3f ab = CVector3f::Cross(a, b);
|
||||
CVector3f vec = CVector3f::Cross(ab.AsNormalized(), a);
|
||||
float sinAngle = sin(angle.AsRadians());
|
||||
float cosAngle = cos(angle.AsRadians());
|
||||
float sinAngle = sine(angle);
|
||||
float cosAngle = cosine(angle);
|
||||
return cosAngle * a + vec * sinAngle;
|
||||
}
|
||||
|
||||
|
@ -79,16 +84,16 @@ bool CVector3f::IsMagnitudeSafe() const {
|
|||
}
|
||||
|
||||
bool CVector3f::CanBeNormalized() const {
|
||||
int x = *(int*)&mX;
|
||||
int y = *(int*)&mY;
|
||||
int z = *(int*)&mZ;
|
||||
int x = __HI(mX);
|
||||
int y = __HI(mY);
|
||||
int z = __HI(mZ);
|
||||
if ((x & 0x7f800000) == 0x7f800000 || (y & 0x7f800000) == 0x7f800000 ||
|
||||
(z & 0x7f800000) == 0x7f800000) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((float)fabs(mX) < FLT_EPSILON && (float)fabs(mY) < FLT_EPSILON &&
|
||||
(float)fabs(mZ) < FLT_EPSILON) {
|
||||
if (CMath::AbsF(mX) < FLT_EPSILON && CMath::AbsF(mY) < FLT_EPSILON &&
|
||||
CMath::AbsF(mZ) < FLT_EPSILON) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -113,6 +118,6 @@ float CVector3f::GetAngleDiff(const CVector3f& a, const CVector3f& b) {
|
|||
}
|
||||
|
||||
bool CVector3f::IsEqu(const CVector3f& vec, float epsilon) const {
|
||||
return (float)fabs(mX - vec.mX) <= epsilon && (float)fabs(mY - vec.mY) <= epsilon &&
|
||||
(float)fabs(mZ - vec.mZ) <= epsilon;
|
||||
return CMath::AbsF(mX - vec.mX) <= epsilon && CMath::AbsF(mY - vec.mY) <= epsilon &&
|
||||
CMath::AbsF(mZ - vec.mZ) <= epsilon;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
#include "string.h"
|
||||
|
||||
#include "Kyoto/Streams/StreamSupport.hpp"
|
||||
#include "Kyoto/Alloc/CMemory.hpp"
|
||||
#include "Kyoto/Streams/StreamSupport.hpp"
|
||||
|
||||
CInputStream::CInputStream(int len)
|
||||
: x4_blockOffset(0)
|
||||
|
|
|
@ -12,7 +12,7 @@ void joyboot_callback(s32 chan, s32 ret) {}
|
|||
const uint MAGIC = 0x414d5445;
|
||||
#endif
|
||||
|
||||
static CGBASupport* g_GBA;
|
||||
CGBASupport* g_GBA;
|
||||
|
||||
inline bool GetFontEncoding() { return OSGetFontEncode() == 1; }
|
||||
|
||||
|
@ -87,16 +87,16 @@ bool CGBASupport::IsReady() { return CheckReadyStatus(); }
|
|||
|
||||
void CGBASupport::Update(float dt) {
|
||||
switch (x34_phase) {
|
||||
case kP_LoadClientPad:
|
||||
case kP_LoadClientPad: {
|
||||
CheckReadyStatus();
|
||||
break;
|
||||
|
||||
case kP_StartProbeTimeout:
|
||||
}
|
||||
case kP_StartProbeTimeout: {
|
||||
x38_timeout = 4.f;
|
||||
x34_phase = kP_PollProbe;
|
||||
// [[fallthrough]];
|
||||
|
||||
case kP_PollProbe:
|
||||
}
|
||||
case kP_PollProbe: {
|
||||
int channel = 1;
|
||||
do {
|
||||
uint result = SIProbe(channel);
|
||||
|
@ -114,14 +114,14 @@ void CGBASupport::Update(float dt) {
|
|||
x34_phase = kP_Failed;
|
||||
}
|
||||
break;
|
||||
|
||||
case kP_StartJoyBusBoot:
|
||||
}
|
||||
case kP_StartJoyBusBoot: {
|
||||
x34_phase = kP_PollJoyBusBoot;
|
||||
GBAJoyBootAsync(x40_siChan, x40_siChan << 1, 2, x2c_buffer.get(), x0_file.Length(), &x3c_status,
|
||||
&joyboot_callback);
|
||||
break;
|
||||
|
||||
case kP_PollJoyBusBoot:
|
||||
}
|
||||
case kP_PollJoyBusBoot: {
|
||||
int status = GBAGetProcessStatus(x40_siChan, &x3c_status);
|
||||
if (status != GBA_BUSY) {
|
||||
if (GBAGetStatus(x40_siChan, &x3c_status) == GBA_NOT_READY) {
|
||||
|
@ -132,7 +132,8 @@ void CGBASupport::Update(float dt) {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case kP_DataTransfer:
|
||||
}
|
||||
case kP_DataTransfer: {
|
||||
if (PollResponse()) {
|
||||
x34_phase = kP_Complete;
|
||||
break;
|
||||
|
@ -141,6 +142,8 @@ void CGBASupport::Update(float dt) {
|
|||
if (x38_timeout == 0.f)
|
||||
x34_phase = kP_Failed;
|
||||
break;
|
||||
}
|
||||
case kP_Standby:
|
||||
case kP_Complete:
|
||||
case kP_Failed:
|
||||
break;
|
||||
|
@ -229,25 +232,27 @@ bool CGBASupport::PollResponse() {
|
|||
} while ((GBAGetStatus(x40_siChan, &gbaStatus) == GBA_NOT_READY || (gbaStatus & 0x8) == 0) ||
|
||||
(GBAGetStatus(x40_siChan, &gbaStatus) != GBA_READY || gbaStatus != 0x38));
|
||||
|
||||
uint read;
|
||||
uchar fusionStatus[4];
|
||||
if (GBARead(x40_siChan, reinterpret_cast< uchar* >(&read), &gbaStatus) != GBA_READY) {
|
||||
return false;
|
||||
}
|
||||
fusionStatus[0] = read >> 24;
|
||||
fusionStatus[1] = read >> 16;
|
||||
fusionStatus[2] = read >> 8;
|
||||
fusionStatus[3] = read;
|
||||
if (fusionStatus[3] != CalculateFusionJBusChecksum(fusionStatus, 3)) {
|
||||
return false;
|
||||
}
|
||||
{
|
||||
uint read;
|
||||
uchar fusionStatus[4];
|
||||
if (GBARead(x40_siChan, reinterpret_cast< uchar* >(&read), &gbaStatus) != GBA_READY) {
|
||||
return false;
|
||||
}
|
||||
fusionStatus[0] = read >> 24;
|
||||
fusionStatus[1] = read >> 16;
|
||||
fusionStatus[2] = read >> 8;
|
||||
fusionStatus[3] = read;
|
||||
if (fusionStatus[3] != CalculateFusionJBusChecksum(fusionStatus, 3)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
x44_fusionLinked = (fusionStatus[2] & 0x2) == 0;
|
||||
bool fusionBeat = false;
|
||||
if (x44_fusionLinked != false && (fusionStatus[2] & 0x1) > 0) {
|
||||
fusionBeat = true;
|
||||
x44_fusionLinked = (fusionStatus[2] & 0x2) == 0;
|
||||
bool fusionBeat = false;
|
||||
if (x44_fusionLinked != false && (fusionStatus[2] & 0x1) > 0) {
|
||||
fusionBeat = true;
|
||||
}
|
||||
x45_fusionBeat = fusionBeat;
|
||||
}
|
||||
x45_fusionBeat = fusionBeat;
|
||||
|
||||
end:
|
||||
return true;
|
||||
|
|
|
@ -215,8 +215,8 @@ CPlayerGun::CPlayerGun(TUniqueId playerId)
|
|||
, x538_playerId(playerId)
|
||||
, x53a_powerBomb(kInvalidUniqueId)
|
||||
, x53c_lightId(kInvalidUniqueId)
|
||||
, x550_camBob(CPlayerCameraBob::kCBT_One, CPlayerCameraBob::GetCameraBobPeriod(),
|
||||
CPlayerCameraBob::GetCameraBobExtent())
|
||||
, x550_camBob(CPlayerCameraBob::kCBT_One, CPlayerCameraBob::kCameraBobPeriod,
|
||||
CVector2f(CPlayerCameraBob::kCameraBobExtentX, CPlayerCameraBob::kCameraBobExtentY))
|
||||
, x658_(1)
|
||||
, x65c_(0.f)
|
||||
, x660_(0.f)
|
||||
|
@ -311,24 +311,26 @@ CPlayerGun::~CPlayerGun() {}
|
|||
|
||||
void CPlayerGun::AddToRenderer(const CFrustumPlanes& frustum, const CStateManager&) const {
|
||||
rstl::optional_object< CModelData >& model = x72c_currentBeam->SolidModelData();
|
||||
if (model)
|
||||
if (model) {
|
||||
model->RenderParticles(frustum);
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayerGun::PreRender(CStateManager& mgr, const CFrustumPlanes& frustum,
|
||||
const CVector3f& camPos) {
|
||||
const CPlayerState& playerState = *mgr.GetPlayerState();
|
||||
if (playerState.GetCurrentVisor() == CPlayerState::kPV_Scan)
|
||||
if (playerState.GetCurrentVisor() == CPlayerState::kPV_Scan) {
|
||||
return;
|
||||
}
|
||||
|
||||
CPlayerState::EPlayerVisor activeVisor = playerState.GetActiveVisor(mgr);
|
||||
switch (activeVisor) {
|
||||
case CPlayerState::kPV_Thermal:
|
||||
case CPlayerState::kPV_Thermal: {
|
||||
float rgb =
|
||||
CMath::Clamp(0.6f, 0.5f * x380_shotSmokeTimer + 0.6f - x378_shotSmokeStartTimer, 1.f);
|
||||
x0_lights.BuildConstantAmbientLighting(CColor(rgb, rgb, rgb, 1.f));
|
||||
break;
|
||||
|
||||
}
|
||||
case CPlayerState::kPV_Combat: {
|
||||
CAABox aabb = x72c_currentBeam->GetBounds(CTransform4f::Translate(camPos) * x4a8_gunWorldXf);
|
||||
if (mgr.GetNextAreaId() != kInvalidAreaId) {
|
||||
|
@ -351,15 +353,18 @@ void CPlayerGun::PreRender(CStateManager& mgr, const CFrustumPlanes& frustum,
|
|||
break;
|
||||
}
|
||||
|
||||
if (x740_grappleArm->GetActive())
|
||||
if (x740_grappleArm->GetActive()) {
|
||||
x740_grappleArm->PreRender(mgr, frustum, camPos);
|
||||
}
|
||||
|
||||
if (x678_morph.GetGunState() != CGunMorph::kGS_OutWipeDone ||
|
||||
activeVisor == CPlayerState::kPV_XRay)
|
||||
activeVisor == CPlayerState::kPV_XRay) {
|
||||
x6e0_rightHandModel.AnimationData()->PreRender();
|
||||
}
|
||||
|
||||
if (x833_28_phazonBeamActive)
|
||||
if (x833_28_phazonBeamActive) {
|
||||
gpRender->AllocatePhazonSuitMaskTexture();
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayerGun::TouchModel(const CStateManager&) const {}
|
||||
|
|
|
@ -24,7 +24,7 @@ void CScriptRelay::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId,
|
|||
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
||||
|
||||
switch (msg) {
|
||||
case kSM_SetToZero:
|
||||
case kSM_SetToZero: {
|
||||
if (!x30_24_active) {
|
||||
return;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ void CScriptRelay::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId,
|
|||
stateMgr.SetLastRelayId(GetUniqueId());
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
case kSM_Deleted:
|
||||
UpdateObjectRef(stateMgr);
|
||||
break;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "MetroidPrime/CStateManager.hpp"
|
||||
#include "MetroidPrime/ScriptObjects/CScriptWater.hpp"
|
||||
|
||||
|
||||
CScriptRipple::CScriptRipple(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
|
||||
const CVector3f& vec, bool active, float f1)
|
||||
: CEntity(uid, info, active, name), x34_magnitude(f1 >= 0.f ? f1 : 0.5f), x38_center(vec) {}
|
||||
|
@ -13,7 +12,7 @@ CScriptRipple::~CScriptRipple() {}
|
|||
|
||||
void CScriptRipple::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
||||
switch (msg) {
|
||||
case (kSM_Play):
|
||||
case (kSM_Play): {
|
||||
if (!GetActive()) {
|
||||
return;
|
||||
}
|
||||
|
@ -33,6 +32,7 @@ void CScriptRipple::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt
|
|||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
CEntity::AcceptScriptMsg(msg, uid, mgr);
|
||||
break;
|
||||
|
|
|
@ -196,6 +196,8 @@ void CScriptSpecialFunction::PreRender(CStateManager&, const CFrustumPlanes& fru
|
|||
x1e4_30_ = val;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -476,7 +478,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId
|
|||
}
|
||||
break;
|
||||
}
|
||||
case kSF_RumbleEffect:
|
||||
case kSF_RumbleEffect: {
|
||||
if (msg != kSM_Action) {
|
||||
break;
|
||||
}
|
||||
|
@ -498,6 +500,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId
|
|||
mgr.GetRumbleManager()->Rumble(mgr, pos, rumbFx, xfc_float1, kRP_One);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case kSF_InventoryActivator: {
|
||||
if (msg == kSM_Action && mgr.GetPlayerState()->HasPowerUp(x1c4_item)) {
|
||||
SendScriptMsgs(kSS_Zero, mgr, kSM_None);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue