From f5c4b9bd7016a1380eaf2cafbf0c0cb628886f89 Mon Sep 17 00:00:00 2001 From: Mark Langen Date: Tue, 20 May 2025 19:07:29 -0700 Subject: [PATCH] Undo externing of floats / variables / strings --- .../MSL/MSL_C/MSL_Common/Include/cmath | 2 + .../MSL/MSL_C/MSL_Common/Include/math.h | 4 +- src/SB/Core/gc/iFile.cpp | 2 +- src/SB/Core/gc/iMath3.cpp | 168 +++++----- src/SB/Core/gc/iMemMgr.cpp | 12 +- src/SB/Core/gc/iSystem.cpp | 38 +-- src/SB/Core/x/containers.h | 2 + src/SB/Core/x/xAnim.cpp | 2 +- src/SB/Core/x/xBound.cpp | 86 ++--- src/SB/Core/x/xCamera.cpp | 310 ++++++++--------- src/SB/Core/x/xCutscene.cpp | 52 ++- src/SB/Core/x/xCutscene.h | 3 + src/SB/Core/x/xEntMotion.cpp | 106 +++++- src/SB/Core/x/xFFX.cpp | 26 +- src/SB/Core/x/xGrid.cpp | 2 + src/SB/Core/x/xMath.cpp | 16 +- src/SB/Core/x/xMemMgr.cpp | 8 +- src/SB/Core/x/xPad.cpp | 2 + src/SB/Core/x/xSnd.cpp | 36 +- src/SB/Core/x/xordarray.cpp | 5 +- src/SB/Core/x/xpkrsvc.cpp | 8 +- src/SB/Game/zCamera.cpp | 1 + src/SB/Game/zEntCruiseBubble.cpp | 314 +++++++++--------- src/SB/Game/zGame.cpp | 307 ++++++++--------- src/SB/Game/zLight.cpp | 25 +- src/SB/Game/zLightning.cpp | 108 +++--- src/SB/Game/zMain.cpp | 4 + src/SB/Game/zMenu.cpp | 2 + src/SB/Game/zMenu.h | 2 - src/SB/Game/zNPCTypeAmbient.cpp | 30 +- src/SB/Game/zNPCTypeDutchman.cpp | 2 +- src/SB/Game/zNPCTypeTiki.cpp | 16 +- src/SB/Game/zNPCTypeVillager.cpp | 230 ++++++------- src/SB/Game/zScene.cpp | 60 ++-- 34 files changed, 1065 insertions(+), 926 deletions(-) diff --git a/include/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath b/include/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath index 003fd1576..48173d423 100644 --- a/include/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath +++ b/include/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath @@ -17,6 +17,8 @@ namespace std float acosf(float x); float expf(float x); float floorf(float x); + float logf(float x); + float sqrtf(float x); #else inline float atan2f(float y, float x) { diff --git a/include/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h b/include/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h index 5c1ed6eb5..f2e4cd41a 100644 --- a/include/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h +++ b/include/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h @@ -31,9 +31,11 @@ double asin(double); double acos(double); double exp(double); double floor(double); +double log(double); +double sqrt(double); #ifdef __cplusplus } #endif -#endif \ No newline at end of file +#endif diff --git a/src/SB/Core/gc/iFile.cpp b/src/SB/Core/gc/iFile.cpp index c774766b9..bf38850a6 100644 --- a/src/SB/Core/gc/iFile.cpp +++ b/src/SB/Core/gc/iFile.cpp @@ -19,7 +19,7 @@ struct file_queue_entry U32 asynckey; }; -extern file_queue_entry file_queue[4]; +file_queue_entry file_queue[4]; static U32 tbuffer[1024 + 8]; static U32* buffer32; diff --git a/src/SB/Core/gc/iMath3.cpp b/src/SB/Core/gc/iMath3.cpp index 0539117a3..d3a0f9959 100644 --- a/src/SB/Core/gc/iMath3.cpp +++ b/src/SB/Core/gc/iMath3.cpp @@ -6,16 +6,6 @@ #include -extern F32 _555_1; // 0.5f -extern F32 _557_1; // 0.0f -extern F32 _558_3; // 1.0f -extern F32 _560_2; // 0.00001f -extern F32 _607; // 2.0f -extern F32 _608_0; // -1.0f -extern F32 _1060; // -9.9999997e37f -extern F32 _1061; // 9.9999997e37f -extern F32 _1062; // -0.5f - void iMath3Init() { } @@ -35,37 +25,37 @@ void iSphereIsectRay(const xSphere* s, const xRay3* r, xIsect* isx) if (!(r->flags & 0x400)) { - ((xRay3*)r)->min_t = _557_1; // wait, that's illegal + ((xRay3*)r)->min_t = 0.0f; // wait, that's illegal } if (!(r->flags & 0x800)) { - ((xRay3*)r)->max_t = _558_3; + ((xRay3*)r)->max_t = 1.0f; } xVec3Sub(&isx->norm, &r->origin, &s->center); - num = xMathSolveQuadratic(xVec3Dot(&r->dir, &r->dir), _607 * xVec3Dot(&isx->norm, &r->dir), + num = xMathSolveQuadratic(xVec3Dot(&r->dir, &r->dir), 2.0f * xVec3Dot(&isx->norm, &r->dir), xVec3Dot(&isx->norm, &isx->norm) - s->r * s->r, &t_in, &t_out); if (num == 0) { - isx->penned = _558_3; - isx->contained = _558_3; + isx->penned = 1.0f; + isx->contained = 1.0f; } else if (num == 1) { if (t_in < r->min_t || t_in > r->max_t) { isx->dist = t_in; - isx->penned = _558_3; - isx->contained = _558_3; + isx->penned = 1.0f; + isx->contained = 1.0f; } else { isx->dist = t_in; - isx->penned = _608_0; - isx->contained = _558_3; + isx->penned = -1.0f; + isx->contained = 1.0f; } } else if (t_in < r->min_t) @@ -73,14 +63,14 @@ void iSphereIsectRay(const xSphere* s, const xRay3* r, xIsect* isx) if (t_out < r->min_t) { isx->dist = t_out; - isx->penned = _558_3; - isx->contained = _558_3; + isx->penned = 1.0f; + isx->contained = 1.0f; } else { isx->dist = t_out; - isx->penned = _608_0; - isx->contained = _608_0; + isx->penned = -1.0f; + isx->contained = -1.0f; } } else @@ -88,14 +78,14 @@ void iSphereIsectRay(const xSphere* s, const xRay3* r, xIsect* isx) if (t_in <= r->max_t) { isx->dist = t_in; - isx->penned = _608_0; - isx->contained = _558_3; + isx->penned = -1.0f; + isx->contained = 1.0f; } else { isx->dist = t_in; - isx->penned = _558_3; - isx->contained = _558_3; + isx->penned = 1.0f; + isx->contained = 1.0f; } } } @@ -113,7 +103,7 @@ void iSphereInitBoundVec(xSphere* s, const xVec3* v) { xVec3Copy(&s->center, v); - s->r = _560_2; + s->r = 0.00001f; } void iSphereBoundVec(xSphere* o, const xSphere* s, const xVec3* v) @@ -128,7 +118,7 @@ void iSphereBoundVec(xSphere* o, const xSphere* s, const xVec3* v) iSphereIsectVec(s, v, &isx); - if (isx.penned <= _557_1) + if (isx.penned <= 0.0f) { if (!usetemp) { @@ -148,12 +138,12 @@ void iSphereBoundVec(xSphere* o, const xSphere* s, const xVec3* v) xVec3Copy(&tp->center, &isx.norm); - scale = (isx.dist - s->r) / (_607 * isx.dist); + scale = (isx.dist - s->r) / (2.0f * isx.dist); xVec3SMul(&tp->center, &tp->center, scale); xVec3Add(&tp->center, &tp->center, &s->center); - tp->r = _555_1 * (isx.dist + s->r); + tp->r = 0.5f * (isx.dist + s->r); if (usetemp) { @@ -169,11 +159,11 @@ void iCylinderIsectVec(const xCylinder* c, const xVec3* v, xIsect* isx) if (v->y >= c->center.y - c->h && v->y <= b && xVec2Dist(c->center.x, c->center.z, v->x, v->z) <= c->r) { - isx->penned = _608_0; + isx->penned = -1.0f; } else { - isx->penned = _558_3; + isx->penned = 1.0f; } } @@ -195,7 +185,7 @@ void iBoxVecDist(const xBox* box, const xVec3* v, xIsect* isx) { isx->norm.x = box->lower.x - v->x; isx->norm.y = box->lower.y - v->y; - isx->norm.z = _557_1; + isx->norm.z = 0.0f; isx->flags = isx->flags & ~0x1F000000 | 0x01000000; isx->flags |= 0x40000000; } @@ -213,7 +203,7 @@ void iBoxVecDist(const xBox* box, const xVec3* v, xIsect* isx) if (v->z < box->lower.z) { isx->norm.x = box->lower.x - v->x; - isx->norm.y = _557_1; + isx->norm.y = 0.0f; isx->norm.z = box->lower.z - v->z; isx->flags = isx->flags & ~0x1F000000 | 0x03000000; isx->flags |= 0x40000000; @@ -221,15 +211,15 @@ void iBoxVecDist(const xBox* box, const xVec3* v, xIsect* isx) else if (v->z <= box->upper.z) { isx->norm.x = box->lower.x - v->x; - isx->norm.y = _557_1; - isx->norm.z = _557_1; + isx->norm.y = 0.0f; + isx->norm.z = 0.0f; isx->flags = isx->flags & ~0x1F000000 | 0x04000000; isx->flags |= 0x20000000; } else { isx->norm.x = box->lower.x - v->x; - isx->norm.y = _557_1; + isx->norm.y = 0.0f; isx->norm.z = box->upper.z - v->z; isx->flags = isx->flags & ~0x1F000000 | 0x05000000; isx->flags |= 0x40000000; @@ -249,7 +239,7 @@ void iBoxVecDist(const xBox* box, const xVec3* v, xIsect* isx) { isx->norm.x = box->lower.x - v->x; isx->norm.y = box->upper.y - v->y; - isx->norm.z = _557_1; + isx->norm.z = 0.0f; isx->flags = isx->flags & ~0x1F000000 | 0x07000000; isx->flags |= 0x40000000; } @@ -269,7 +259,7 @@ void iBoxVecDist(const xBox* box, const xVec3* v, xIsect* isx) { if (v->z < box->lower.z) { - isx->norm.x = _557_1; + isx->norm.x = 0.0f; isx->norm.y = box->lower.y - v->y; isx->norm.z = box->lower.z - v->z; isx->flags = isx->flags & ~0x1F000000 | 0x09000000; @@ -277,15 +267,15 @@ void iBoxVecDist(const xBox* box, const xVec3* v, xIsect* isx) } else if (v->z <= box->upper.z) { - isx->norm.x = _557_1; + isx->norm.x = 0.0f; isx->norm.y = box->lower.y - v->y; - isx->norm.z = _557_1; + isx->norm.z = 0.0f; isx->flags = isx->flags & ~0x1F000000 | 0x0A000000; isx->flags |= 0x20000000; } else { - isx->norm.x = _557_1; + isx->norm.x = 0.0f; isx->norm.y = box->lower.y - v->y; isx->norm.z = box->upper.z - v->z; isx->flags = isx->flags & ~0x1F000000 | 0x0B000000; @@ -296,8 +286,8 @@ void iBoxVecDist(const xBox* box, const xVec3* v, xIsect* isx) { if (v->z < box->lower.z) { - isx->norm.x = _557_1; - isx->norm.y = _557_1; + isx->norm.x = 0.0f; + isx->norm.y = 0.0f; isx->norm.z = box->lower.z - v->z; isx->flags = isx->flags & ~0x1F000000 | 0x0C000000; isx->flags |= 0x20000000; @@ -307,8 +297,8 @@ void iBoxVecDist(const xBox* box, const xVec3* v, xIsect* isx) } else { - isx->norm.x = _557_1; - isx->norm.y = _557_1; + isx->norm.x = 0.0f; + isx->norm.y = 0.0f; isx->norm.z = box->upper.z - v->z; isx->flags = isx->flags & ~0x1F000000 | 0x0E000000; isx->flags |= 0x20000000; @@ -318,7 +308,7 @@ void iBoxVecDist(const xBox* box, const xVec3* v, xIsect* isx) { if (v->z < box->lower.z) { - isx->norm.x = _557_1; + isx->norm.x = 0.0f; isx->norm.y = box->upper.y - v->y; isx->norm.z = box->lower.z - v->z; isx->flags = isx->flags & ~0x1F000000 | 0x0F000000; @@ -326,15 +316,15 @@ void iBoxVecDist(const xBox* box, const xVec3* v, xIsect* isx) } else if (v->z <= box->upper.z) { - isx->norm.x = _557_1; + isx->norm.x = 0.0f; isx->norm.y = box->upper.y - v->y; - isx->norm.z = _557_1; + isx->norm.z = 0.0f; isx->flags = isx->flags & ~0x1F000000 | 0x10000000; isx->flags |= 0x20000000; } else { - isx->norm.x = _557_1; + isx->norm.x = 0.0f; isx->norm.y = box->upper.y - v->y; isx->norm.z = box->upper.z - v->z; isx->flags = isx->flags & ~0x1F000000 | 0x11000000; @@ -358,7 +348,7 @@ void iBoxVecDist(const xBox* box, const xVec3* v, xIsect* isx) { isx->norm.x = box->upper.x - v->x; isx->norm.y = box->lower.y - v->y; - isx->norm.z = _557_1; + isx->norm.z = 0.0f; isx->flags = isx->flags & ~0x1F000000 | 0x13000000; isx->flags |= 0x40000000; } @@ -376,7 +366,7 @@ void iBoxVecDist(const xBox* box, const xVec3* v, xIsect* isx) if (v->z < box->lower.z) { isx->norm.x = box->upper.x - v->x; - isx->norm.y = _557_1; + isx->norm.y = 0.0f; isx->norm.z = box->lower.z - v->z; isx->flags = isx->flags & ~0x1F000000 | 0x15000000; isx->flags |= 0x40000000; @@ -384,15 +374,15 @@ void iBoxVecDist(const xBox* box, const xVec3* v, xIsect* isx) else if (v->z <= box->upper.z) { isx->norm.x = box->upper.x - v->x; - isx->norm.y = _557_1; - isx->norm.z = _557_1; + isx->norm.y = 0.0f; + isx->norm.z = 0.0f; isx->flags = isx->flags & ~0x1F000000 | 0x16000000; isx->flags |= 0x20000000; } else { isx->norm.x = box->upper.x - v->x; - isx->norm.y = _557_1; + isx->norm.y = 0.0f; isx->norm.z = box->upper.z - v->z; isx->flags = isx->flags & ~0x1F000000 | 0x17000000; isx->flags |= 0x40000000; @@ -412,7 +402,7 @@ void iBoxVecDist(const xBox* box, const xVec3* v, xIsect* isx) { isx->norm.x = box->upper.x - v->x; isx->norm.y = box->upper.y - v->y; - isx->norm.z = _557_1; + isx->norm.z = 0.0f; isx->flags = isx->flags & ~0x1F000000 | 0x19000000; isx->flags |= 0x40000000; } @@ -435,17 +425,17 @@ void iBoxIsectVec(const xBox* b, const xVec3* v, xIsect* isx) if (v->x >= b->lower.x && v->x <= b->upper.x && v->y >= b->lower.y && v->y <= b->upper.y && v->z >= b->lower.z && v->z <= b->upper.z) { - isx->penned = _608_0; + isx->penned = -1.0f; } else { - isx->penned = _558_3; + isx->penned = 1.0f; } } static U32 ClipPlane(F32 denom, F32 numer, F32* t_in, F32* t_out) { - if (denom > _557_1) + if (denom > 0.0f) { if (numer > denom * (*t_out)) { @@ -459,7 +449,7 @@ static U32 ClipPlane(F32 denom, F32 numer, F32* t_in, F32* t_out) return 1; } - else if (denom < _557_1) + else if (denom < 0.0f) { if (numer > denom * (*t_in)) { @@ -474,7 +464,7 @@ static U32 ClipPlane(F32 denom, F32 numer, F32* t_in, F32* t_out) return 1; } - return (numer <= _557_1); + return (numer <= 0.0f); } static U32 ClipBox(const xVec3* r3, const xVec3* r4, const xVec3* r5, F32* t_in, F32* t_out) @@ -494,18 +484,18 @@ void iBoxIsectRay(const xBox* b, const xRay3* r, xIsect* isx) if (!(r->flags & 0x400)) { - ((xRay3*)r)->min_t = _557_1; // wait, that's illegal + ((xRay3*)r)->min_t = 0.0f; // wait, that's illegal } if (!(r->flags & 0x800)) { - ((xRay3*)r)->max_t = _558_3; + ((xRay3*)r)->max_t = 1.0f; } // non-matching: incorrect instruction order - t_in = _1060; - t_out = _1061; + t_in = -9.9999997e37f; + t_out = 9.9999997e37f; var_14.x = b->upper.x - b->lower.x; var_14.y = b->upper.y - b->lower.y; @@ -514,15 +504,15 @@ void iBoxIsectRay(const xBox* b, const xRay3* r, xIsect* isx) var_20.x = b->lower.x + b->upper.x; var_20.y = b->lower.y + b->upper.y; - var_14.x *= _555_1; - var_14.y *= _555_1; - var_14.z *= _555_1; + var_14.x *= 0.5f; + var_14.y *= 0.5f; + var_14.z *= 0.5f; var_20.z = b->lower.z + b->upper.z; - var_20.x *= _1062; - var_20.y *= _1062; - var_20.z *= _1062; + var_20.x *= -0.5f; + var_20.y *= -0.5f; + var_20.z *= -0.5f; var_20.x += r->origin.x; var_20.y += r->origin.y; @@ -535,14 +525,14 @@ void iBoxIsectRay(const xBox* b, const xRay3* r, xIsect* isx) if (t_out < r->min_t) { isx->dist = t_out; - isx->penned = _558_3; - isx->contained = _558_3; + isx->penned = 1.0f; + isx->contained = 1.0f; } else { isx->dist = t_out; - isx->penned = _608_0; - isx->contained = _608_0; + isx->penned = -1.0f; + isx->contained = -1.0f; } } else @@ -550,21 +540,21 @@ void iBoxIsectRay(const xBox* b, const xRay3* r, xIsect* isx) if (t_in <= r->max_t) { isx->dist = t_in; - isx->penned = _608_0; - isx->contained = _558_3; + isx->penned = -1.0f; + isx->contained = 1.0f; } else { isx->dist = t_in; - isx->penned = _558_3; - isx->contained = _558_3; + isx->penned = 1.0f; + isx->contained = 1.0f; } } } else { - isx->penned = _558_3; - isx->contained = _558_3; + isx->penned = 1.0f; + isx->contained = 1.0f; } } @@ -609,7 +599,7 @@ void iBoxIsectSphere(const xBox* box, const xSphere* p, xIsect* isx) if (xcode / 3 == 2) { - isx->penned = _558_3; + isx->penned = 1.0f; return; } @@ -650,7 +640,7 @@ void iBoxIsectSphere(const xBox* box, const xSphere* p, xIsect* isx) if (ycode / 3 == 2) { - isx->penned = _558_3; + isx->penned = 1.0f; return; } @@ -691,22 +681,22 @@ void iBoxIsectSphere(const xBox* box, const xSphere* p, xIsect* isx) if (zcode / 3 == 2) { - isx->penned = _558_3; + isx->penned = 1.0f; return; } iBoxIsectVec(box, &p->center, isx); - if (isx->penned < _557_1) + if (isx->penned < 0.0f) { xVec3 var_28; xVec3Add(&var_28, &box->lower, &box->upper); - xVec3SMulBy(&var_28, _555_1); + xVec3SMulBy(&var_28, 0.5f); xVec3Sub(&isx->norm, &p->center, &var_28); isx->dist = xVec3Length(&isx->norm); - isx->contained = _608_0; + isx->contained = -1.0f; } else { @@ -715,7 +705,7 @@ void iBoxIsectSphere(const xBox* box, const xSphere* p, xIsect* isx) iBoxVecDist(box, &p->center, isx); isx->penned = isx->dist - p->r; - isx->contained = _558_3; + isx->contained = 1.0f; } } diff --git a/src/SB/Core/gc/iMemMgr.cpp b/src/SB/Core/gc/iMemMgr.cpp index 91665e9f1..ec7aaf201 100644 --- a/src/SB/Core/gc/iMemMgr.cpp +++ b/src/SB/Core/gc/iMemMgr.cpp @@ -6,14 +6,14 @@ #include #include +U32 mem_top_alloc; +U32 mem_base_alloc; +volatile OSHeapHandle the_heap; +OSHeapHandle hs; +OSHeapHandle he; +U32 HeapSize; extern xMemInfo_tag gMemInfo; -extern OSHeapHandle he; -extern OSHeapHandle hs; -extern volatile OSHeapHandle the_heap; extern unsigned char _stack_addr[]; -extern U32 HeapSize; -extern U32 mem_top_alloc; -extern U32 mem_base_alloc; // Starts going wrong after the if and else statement, everything else before looks fine. void iMemInit() diff --git a/src/SB/Core/gc/iSystem.cpp b/src/SB/Core/gc/iSystem.cpp index d22679336..967189b30 100644 --- a/src/SB/Core/gc/iSystem.cpp +++ b/src/SB/Core/gc/iSystem.cpp @@ -27,25 +27,25 @@ extern OSContext* last_context; // Taken from iSystem.s // Defining these here makes the stringBase0 offsets match in the later functions. -char* str1 = "Level %d, Warning $03d: %s\n"; -char* str2 = "FPE: Invalid operation: "; -char* str3 = "SNaN\n"; -char* str4 = "Infinity - Infinity\n"; -char* str5 = "Infinity / Infinity\n"; -char* str6 = "0 / 0\n"; -char* str7 = "Infinity * 0\n"; -char* str8 = "Invalid compare\n"; -char* str9 = "Software request\n"; -char* str10 = "Invalid square root\n"; -char* str11 = "Invalid integer convert\n"; -char* str12 = "FPE: Overflow\n"; -char* str13 = "FPE: Underflow\n"; -char* str14 = "FPE: Zero division\n"; -char* str15 = "FPE: Inexact result\n"; -char* str16 = "iSystem.cpp"; -char* str17 = "Unable to initialize memory system.\n"; -char* str18 = "(With apologies to Jim Morrison) This the end, my only friend, The End."; -char* str19 = "%s.rw3"; +static char* str1 = "Level %d, Warning $03d: %s\n"; +static char* str2 = "FPE: Invalid operation: "; +static char* str3 = "SNaN\n"; +static char* str4 = "Infinity - Infinity\n"; +static char* str5 = "Infinity / Infinity\n"; +static char* str6 = "0 / 0\n"; +static char* str7 = "Infinity * 0\n"; +static char* str8 = "Invalid compare\n"; +static char* str9 = "Software request\n"; +static char* str10 = "Invalid square root\n"; +static char* str11 = "Invalid integer convert\n"; +static char* str12 = "FPE: Overflow\n"; +static char* str13 = "FPE: Underflow\n"; +static char* str14 = "FPE: Zero division\n"; +static char* str15 = "FPE: Inexact result\n"; +static char* str16 = "iSystem.cpp"; +static char* str17 = "Unable to initialize memory system.\n"; +static char* str18 = "(With apologies to Jim Morrison) This the end, my only friend, The End."; +static char* str19 = "%s.rw3"; void** psGetMemoryFunctions() { diff --git a/src/SB/Core/x/containers.h b/src/SB/Core/x/containers.h index 05b894acf..ff9688cb8 100644 --- a/src/SB/Core/x/containers.h +++ b/src/SB/Core/x/containers.h @@ -29,6 +29,8 @@ template struct tier_queue U32 wrap_mask; tier_queue_allocator* alloc; U8 blocks[256]; + + void clear(); }; template struct static_queue diff --git a/src/SB/Core/x/xAnim.cpp b/src/SB/Core/x/xAnim.cpp index 18a2f2ce3..f08f07bf1 100644 --- a/src/SB/Core/x/xAnim.cpp +++ b/src/SB/Core/x/xAnim.cpp @@ -361,7 +361,7 @@ void xAnimTempTransitionInit(U32 count) } // TODO: move to xMathInlines.h -static F32 xatan2(F32 y, F32 x) +F32 xatan2(F32 y, F32 x) { return xAngleClampFast(std::atan2f(y, x)); } diff --git a/src/SB/Core/x/xBound.cpp b/src/SB/Core/x/xBound.cpp index 132111bfd..91e1e79da 100644 --- a/src/SB/Core/x/xBound.cpp +++ b/src/SB/Core/x/xBound.cpp @@ -6,24 +6,17 @@ #include "iMath.h" -extern F32 _571; -extern F32 _640; -extern F32 _641; -extern F32 _642; -extern F32 _643; -extern F32 _644; - void xBoundUpdate(xBound* b) { if (b->type == XBOUND_TYPE_BOX) { xVec3Add(&b->box.center, &b->box.box.lower, &b->box.box.upper); - xVec3SMul(&b->box.center, &b->box.center, _571); + xVec3SMul(&b->box.center, &b->box.center, 0.5f); } else if (b->type == XBOUND_TYPE_OBB) { xVec3Add(&b->box.center, &b->box.box.lower, &b->box.box.upper); - xVec3SMul(&b->box.center, &b->box.center, _571); + xVec3SMul(&b->box.center, &b->box.center, 0.5f); xMat4x3Toworld(&b->box.center, b->mat, &b->box.center); } @@ -81,7 +74,7 @@ void xBoundGetSphere(xSphere& o, const xBound& bound) case XBOUND_TYPE_OBB: { const xMat4x3& mat = *bound.mat; - xVec3 v = (bound.box.box.upper - bound.box.box.lower) * _571; + xVec3 v = (bound.box.box.upper - bound.box.box.lower) * 0.5f; o.r = xsqrt(SQR(v.x) * mat.right.length2() + SQR(v.y) * mat.up.length2() + SQR(v.z) * mat.at.length2()); @@ -94,10 +87,10 @@ void xBoundGetSphere(xSphere& o, const xBound& bound) F32 xsqrt(F32 x) { - const F32 half = _571; - const F32 three = _640; + const F32 half = 0.5f; + const F32 three = 3.0f; - if (x <= _641 || isinf(x)) + if (x <= 0.0f || isinf(x)) { return x; } @@ -107,12 +100,12 @@ F32 xsqrt(F32 x) F32 guess = __frsqrte(x); guess = half * guess * (three - guess * guess * x); - if (guess > _644) + if (guess > 0.0000099999997f) { - return _642 / guess; + return 1.0f / guess; } - return _643; + return 100000.0f; } U32 xBoundSphereHitsOBB(const xSphere* s, const xBox* b, const xMat4x3* m, xCollis* coll) @@ -175,31 +168,31 @@ static void xBoundOBBIsectRay(const xBox* b, const xMat4x3* m, const xRay3* r, x { F32 len2 = SQR(m->right.x) + SQR(m->right.y) + SQR(m->right.z); - if ((F32)iabs(len2 - _642) <= _644) + if ((F32)iabs(len2 - 1.0f) <= 0.0000099999997f) { // non-matching: incorrect instruction + order - scale.x = *(const F32*)&_642; + scale.x = 1.0f; mnormal.right.x = m->right.x; mnormal.right.y = m->right.y; mnormal.right.z = m->right.z; } - else if ((F32)iabs(len2) <= _644) + else if ((F32)iabs(len2) <= 0.0000099999997f) { // non-matching: incorrect order - scale.x = _641; + scale.x = 0.0f; - mnormal.right.x = _641; - mnormal.right.y = _642; - mnormal.right.z = _641; + mnormal.right.x = 0.0f; + mnormal.right.y = 1.0f; + mnormal.right.z = 0.0f; } else { scale.x = xsqrt(len2); - F32 len_inv = _642 / scale.x; + F32 len_inv = 1.0f / scale.x; mnormal.right.x = m->right.x * len_inv; mnormal.right.y = m->right.y * len_inv; @@ -210,31 +203,31 @@ static void xBoundOBBIsectRay(const xBox* b, const xMat4x3* m, const xRay3* r, x { F32 len2 = SQR(m->up.x) + SQR(m->up.y) + SQR(m->up.z); - if ((F32)iabs(len2 - _642) <= _644) + if ((F32)iabs(len2 - 1.0f) <= 0.0000099999997f) { // non-matching: incorrect instruction + order - scale.y = *(const F32*)&_642; + scale.y = 1.0f; mnormal.up.x = m->up.x; mnormal.up.y = m->up.y; mnormal.up.z = m->up.z; } - else if ((F32)iabs(len2) <= _644) + else if ((F32)iabs(len2) <= 0.0000099999997f) { // non-matching: incorrect order - scale.y = _641; + scale.y = 0.0f; - mnormal.up.x = _641; - mnormal.up.y = _642; - mnormal.up.z = _641; + mnormal.up.x = 0.0f; + mnormal.up.y = 1.0f; + mnormal.up.z = 0.0f; } else { scale.y = xsqrt(len2); - F32 len_inv = _642 / scale.y; + F32 len_inv = 1.0f / scale.y; mnormal.up.x = m->up.x * len_inv; mnormal.up.y = m->up.y * len_inv; @@ -245,31 +238,31 @@ static void xBoundOBBIsectRay(const xBox* b, const xMat4x3* m, const xRay3* r, x { F32 len2 = SQR(m->at.x) + SQR(m->at.y) + SQR(m->at.z); - if ((F32)iabs(len2 - _642) <= _644) + if ((F32)iabs(len2 - 1.0f) <= 0.0000099999997f) { // non-matching: incorrect instruction + order - scale.z = *(const F32*)&_642; + scale.z = 1.0f; mnormal.at.x = m->at.x; mnormal.at.y = m->at.y; mnormal.at.z = m->at.z; } - else if ((F32)iabs(len2) <= _644) + else if ((F32)iabs(len2) <= 0.0000099999997f) { // non-matching: incorrect order - scale.z = _641; + scale.z = 0.0f; - mnormal.at.x = _641; - mnormal.at.y = _642; - mnormal.at.z = _641; + mnormal.at.x = 0.0f; + mnormal.at.y = 1.0f; + mnormal.at.z = 0.0f; } else { scale.z = xsqrt(len2); - F32 len_inv = _642 / scale.z; + F32 len_inv = 1.0f / scale.z; mnormal.at.x = m->at.x * len_inv; mnormal.at.y = m->at.y * len_inv; @@ -313,7 +306,7 @@ void xRayHitsBound(const xRay3* r, const xBound* b, xCollis* c) iBoxIsectRay(&b->box.box, r, &isect); } - if (isect.penned <= _641) + if (isect.penned <= 0.0f) { c->flags |= 0x1; c->dist = isect.dist; @@ -366,7 +359,7 @@ void xVecHitsBound(const xVec3* v, const xBound* b, xCollis* c) iBoxIsectVec(&b->box.box, v, &isect); } - if (isect.penned <= _641) + if (isect.penned <= 0.0f) { c->flags |= 0x1; } @@ -482,6 +475,15 @@ xVec3& xVec3::operator-=(const xVec3& v) return *this; } +xVec3& xVec3::operator=(const xVec3& v) +{ + this->x = v.x; + this->y = v.y; + this->z = v.z; + + return *this; +} + void xDrawBox(const xBox*) { } diff --git a/src/SB/Core/x/xCamera.cpp b/src/SB/Core/x/xCamera.cpp index 8b448d509..b3e6ca00b 100644 --- a/src/SB/Core/x/xCamera.cpp +++ b/src/SB/Core/x/xCamera.cpp @@ -25,44 +25,15 @@ -extern F32 _764; -extern F32 _765; -extern F32 _766; -extern F32 _785; -extern F32 _786; -extern F32 _787; -extern F32 _788; -extern F32 _789; -extern F32 _790; -extern F32 _830; -extern F32 _831; -extern F32 _873; -extern F32 _874; -extern F32 _880; -extern F32 _888; -extern F32 _895; -extern F32 _1234; -extern F32 _1235; -extern F32 _1236; -extern F32 _1237; -extern F32 _1238; -extern F32 _1239; -extern F32 _1240; -extern F32 _1241; -extern F32 _1242; -extern F32 _1283; -extern F64 _1286; -extern F32 _1404; -extern F32 _1405; -extern F32 _1534; -extern F32 _1584; -extern F32 _1585; -extern F32 _1586; -extern F32 _1757; -extern F32 _1758; -extern F32 _1766; -extern F32 _1772; - +S32 sCamCollis; +volatile S32 xcam_collis_owner_disable; +S32 xcam_do_collis = 1; +F32 xcam_collis_radius = 0.4f; +F32 xcam_collis_stiffness = 0.3f; +RpAtomic* sInvisWallHack; +static xMat4x3 sCameraFXMatOld; +cameraFX sCameraFX[10]; +cameraFXTableEntry sCameraFXTable[3] = {}; static void xCameraFXInit(); void add_camera_tweaks(); @@ -73,19 +44,19 @@ void xCameraInit(xCamera* cam, U32 width, U32 height) cam->lo_cam = iCameraCreate(width, height, 1); - xCameraSetFOV(cam, _764); + xCameraSetFOV(cam, 75.0f); - cam->bound.sph.center.x = _765; - cam->bound.sph.center.y = _765; - cam->bound.sph.center.z = _765; - cam->bound.sph.r = _766; + cam->bound.sph.center.x = 0.0f; + cam->bound.sph.center.y = 0.0f; + cam->bound.sph.center.z = 0.0f; + cam->bound.sph.r = 0.5f; cam->tgt_mat = NULL; cam->tgt_omat = NULL; cam->tgt_bound = NULL; cam->sc = NULL; - cam->tran_accum.x = _765; - cam->tran_accum.y = _765; - cam->tran_accum.z = _765; + cam->tran_accum.x = 0.0f; + cam->tran_accum.y = 0.0f; + cam->tran_accum.z = 0.0f; add_camera_tweaks(); } @@ -110,42 +81,42 @@ void xCameraReset(xCamera* cam, F32 d, F32 h, F32 pitch) xMat4x3Identity(&cam->mat); cam->omat = cam->mat; - cam->focus.x = _765; - cam->focus.y = _765; - cam->focus.z = _785; - cam->tran_accum.x = _765; - cam->tran_accum.y = _765; - cam->tran_accum.z = _765; + cam->focus.x = 0.0f; + cam->focus.y = 0.0f; + cam->focus.z = 10.0f; + cam->tran_accum.x = 0.0f; + cam->tran_accum.y = 0.0f; + cam->tran_accum.z = 0.0f; cam->flags = 0; - F32 goal_p = _786; + F32 goal_p = 3.1415927f; if (cam->tgt_mat) { goal_p += xatan2(cam->tgt_mat->at.x, cam->tgt_mat->at.z); } - xCameraMove(cam, 0x2E, d, h, goal_p, _765, _787, _787); + xCameraMove(cam, 0x2E, d, h, goal_p, 0.0f, 0.66666669f, 0.66666669f); cam->pitch_goal = pitch; cam->pitch_cur = pitch; - cam->roll_cur = _765; + cam->roll_cur = 0.0f; xMat3x3Euler(&cam->mat, cam->yaw_cur, cam->pitch_cur, cam->roll_cur); cam->omat = cam->mat; - cam->yaw_ct = _788; - cam->yaw_cd = _788; - cam->yaw_ccv = _789; - cam->yaw_csv = _788; - cam->pitch_ct = _788; - cam->pitch_cd = _788; - cam->pitch_ccv = _790; - cam->pitch_csv = _788; - cam->roll_ct = _788; - cam->roll_cd = _788; - cam->roll_ccv = _790; - cam->roll_csv = _788; + cam->yaw_ct = 1.0f; + cam->yaw_cd = 1.0f; + cam->yaw_ccv = 0.64999998f; + cam->yaw_csv = 1.0f; + cam->pitch_ct = 1.0f; + cam->pitch_cd = 1.0f; + cam->pitch_ccv = 0.7f; + cam->pitch_csv = 1.0f; + cam->roll_ct = 1.0f; + cam->roll_cd = 1.0f; + cam->roll_ccv = 0.7f; + cam->roll_csv = 1.0f; cam->flags |= 0x80; xcam_do_collis = 1; @@ -163,40 +134,40 @@ static void xCam_buildbasis(xCamera* cam) F32 dist2 = SQR(dx__) + SQR(dz__); F32 dist_inv; - if ((F32)iabs(dist2 - _788) <= _830) + if ((F32)iabs(dist2 - 1.0f) <= 0.0000099999997f) { cam->mbasis.at.x = dx__; cam->mbasis.at.z = dz__; - d2d = _788; + d2d = 1.0f; } - else if ((F32)iabs(dist2) <= _830) + else if ((F32)iabs(dist2) <= 0.0000099999997f) { - cam->mbasis.at.x = _765; - cam->mbasis.at.z = _765; + cam->mbasis.at.x = 0.0f; + cam->mbasis.at.z = 0.0f; - d2d = _765; + d2d = 0.0f; } else { d2d = xsqrt(dist2); - dist_inv = _788 / d2d; + dist_inv = 1.0f / d2d; cam->mbasis.at.x = dx__ * dist_inv; cam->mbasis.at.z = dz__ * dist_inv; } - if (d2d < _830) + if (d2d < 0.0000099999997f) { cam->mbasis.at.x = cam->mat.at.x; cam->mbasis.at.z = cam->mat.at.z; dist2 = xsqrt(SQR(cam->mbasis.at.x) + SQR(cam->mbasis.at.z)); - if (dist2 > _831) + if (dist2 > 0.001f) { // non-matching: wrong registers - dist_inv = _788 / dist2; + dist_inv = 1.0f / dist2; cam->mbasis.at.x *= dist_inv; cam->mbasis.at.z *= dist_inv; @@ -208,12 +179,12 @@ static void xCam_buildbasis(xCamera* cam) } } - cam->mbasis.at.y = _765; - cam->mbasis.up.x = _765; - cam->mbasis.up.y = _788; - cam->mbasis.up.z = _765; + cam->mbasis.at.y = 0.0f; + cam->mbasis.up.x = 0.0f; + cam->mbasis.up.y = 1.0f; + cam->mbasis.up.z = 0.0f; cam->mbasis.right.x = cam->mbasis.at.z; - cam->mbasis.right.y = _765; + cam->mbasis.right.y = 0.0f; cam->mbasis.right.z = -cam->mbasis.at.x; } } @@ -254,21 +225,21 @@ static void xCam_worldtocyl(F32& d, F32& h, F32& p, const xMat4x3* tgt_mat, cons F32 dist2 = SQR(dx__) + SQR(dz__); F32 dist_inv; - if ((F32)iabs(dist2 - _788) <= _830) + if ((F32)iabs(dist2 - 1.0f) <= 0.0000099999997f) { lx = dx__; lz = dz__; - d = _788; + d = 1.0f; } - else if ((F32)iabs(dist2) <= _830) + else if ((F32)iabs(dist2) <= 0.0000099999997f) { - d = lz = lx = _765; + d = lz = lx = 0.0f; } else { d = xsqrt(dist2); - dist_inv = _788 / d; + dist_inv = 1.0f / d; lx = dx__ * dist_inv; lz = dz__ * dist_inv; @@ -299,7 +270,7 @@ static void xCam_CorrectD(xCamera* r3, F32 f1, F32 f2, F32 f3) F32 tmp1, tmp2, tmp3; - tmp1 = _873 * (_874 * f1 - f2 * f3); + tmp1 = 1.4285715f * (2.0f * f1 - f2 * f3); tmp1 -= f2; tmp1 *= f3; @@ -314,9 +285,9 @@ static void xCam_CorrectH(xCamera* r3, F32 f1, F32 f2, F32 f3) { F32 tmp; - f2 = _880 * f2; + f2 = 0.15f * f2; - tmp = _873 * -(f2 * f3 - f1); + tmp = 1.4285715f * -(f2 * f3 - f1); tmp -= f2; tmp *= f3; @@ -327,9 +298,9 @@ static void xCam_CorrectP(xCamera* r3, F32 f1, F32 f2, F32 f3) { F32 tmp1, tmp2, tmp3; - f2 = _880 * f2; + f2 = 0.15f * f2; - tmp1 = _888 * (_874 * f1 - f2 * f3); + tmp1 = 2.5f * (2.0f * f1 - f2 * f3); tmp1 -= f2; tmp1 *= f3; @@ -344,7 +315,7 @@ static void xCam_DampP(xCamera* r3, F32 f1, F32 f2) { F32 tmp1, tmp2; - f1 = _895 * f1; + f1 = -6.0f * f1; f2 = f1 * f2 * f2; tmp1 = r3->mbasis.right.x * f2; @@ -359,9 +330,9 @@ static void xCam_CorrectYaw(xCamera* r3, F32 f1, F32 f2, F32 f3) F32 tmp1, tmp2; - tmp1 = _788 / r3->yaw_ct; + tmp1 = 1.0f / r3->yaw_ct; - tmp2 = _874 * r3->yaw_cd * f1 - f2 * f3; + tmp2 = 2.0f * r3->yaw_cd * f1 - f2 * f3; tmp2 = tmp1 * tmp2; tmp2 -= f2; tmp2 *= r3->yaw_csv * f3; @@ -374,9 +345,9 @@ static void xCam_CorrectPitch(xCamera* r3, F32 f1, F32 f2, F32 f3) F32 tmp1, tmp2; - tmp1 = _788 / r3->pitch_ct; + tmp1 = 1.0f / r3->pitch_ct; - tmp2 = _874 * r3->pitch_cd * f1 - f2 * f3; + tmp2 = 2.0f * r3->pitch_cd * f1 - f2 * f3; tmp2 = tmp1 * tmp2; tmp2 -= f2; tmp2 *= r3->pitch_csv * f3; @@ -390,9 +361,9 @@ static void xCam_CorrectRoll(xCamera* r3, F32 f1, F32 f2, F32 f3) F32 tmp1, tmp2; - tmp1 = _788 / r3->roll_ct; + tmp1 = 1.0f / r3->roll_ct; - tmp2 = _874 * r3->roll_cd * f1 - f2 * f3; + tmp2 = 2.0f * r3->roll_cd * f1 - f2 * f3; tmp2 = tmp1 * tmp2; tmp2 -= f2; tmp2 *= r3->roll_csv * f3; @@ -511,7 +482,7 @@ void xCameraUpdate(xCamera* cam, F32 dt) S32 num_updates; F32 sdt; - num_updates = std::ceilf(_1283 * dt); + num_updates = std::ceilf(144.0f * dt); sdt = dt / num_updates; @@ -570,11 +541,11 @@ cameraFX* xCameraFXAlloc() if (f->flags == 0) { - // non-matching: _765 is only loaded once + // non-matching: 0.0f is only loaded once f->flags = 0x1; - f->elapsedTime = _765; - f->maxTime = _765; + f->elapsedTime = 0.0f; + f->maxTime = 0.0f; return f; } @@ -596,7 +567,7 @@ void xCameraFXZoomUpdate(cameraFX* f, F32 dt, const xMat4x3*, xMat4x3* m) { f->zoom.distanceCur = f->zoom.distance; f->zoom.mode = CAMERAFX_ZOOM_MODE_2; - f->zoom.holdTimeCur = _765; + f->zoom.holdTimeCur = 0.0f; } xMat4x3MoveLocalAt(m, f->zoom.distanceCur); @@ -651,12 +622,12 @@ void xCameraFXShake(F32 maxTime, F32 magnitude, F32 cycleMax, F32 rotate_magnitu f->type = CAMERAFX_TYPE_SHAKE; f->maxTime = maxTime; f->shake.magnitude = magnitude; - f->shake.dir.x = _788; - f->shake.dir.y = _788; + f->shake.dir.x = 1.0f; + f->shake.dir.y = 1.0f; f->shake.cycleMax = cycleMax; - f->shake.cycleTime = _765; - f->shake.dampen = _765; - f->shake.dampenRate = _788 / maxTime; + f->shake.cycleTime = 0.0f; + f->shake.dampen = 0.0f; + f->shake.dampenRate = 1.0f / maxTime; f->shake.rotate_magnitude = rotate_magnitude; f->shake.radius = radius; f->shake.epicenterP = epicenter; @@ -685,9 +656,9 @@ void xCameraFXShakeUpdate(cameraFX* f, F32 dt, const xMat4x3*, xMat4x3* m) } scale = f->shake.dampenRate * (f->maxTime - f->elapsedTime); - noise = _1404 * (xurand() - _766); + noise = 0.1f * (xurand() - 0.5f); - if (f->shake.radius > _765 && f->shake.player) + if (f->shake.radius > 0.0f && f->shake.player) { xVec3Sub(&var_4C, f->shake.player, &f->shake.epicenter); @@ -695,21 +666,21 @@ void xCameraFXShakeUpdate(cameraFX* f, F32 dt, const xMat4x3*, xMat4x3* m) if (f1 > f->shake.radius) { - scale = _765; + scale = 0.0f; } else { - scale *= icos(f1 / f->shake.radius * _786 * _766); + scale *= icos(f1 / f->shake.radius * 3.1415927f * 0.5f); } } x = (f->shake.magnitude + noise) * f->shake.dir.x * scale / f->shake.cycleMax * - f->shake.cycleTime * isin(f->shake.cycleTime / f->shake.cycleMax * _786); + f->shake.cycleTime * isin(f->shake.cycleTime / f->shake.cycleMax * 3.1415927f); - noise = _1404 * (xurand() - _766); + noise = 0.1f * (xurand() - 0.5f); y = (f->shake.magnitude + noise) * f->shake.dir.y * scale / f->shake.cycleMax * - f->shake.cycleTime * isin(f->shake.cycleTime / f->shake.cycleMax * _786); + f->shake.cycleTime * isin(f->shake.cycleTime / f->shake.cycleMax * 3.1415927f); xMat4x3MoveLocalRight(m, x); xMat4x3MoveLocalUp(m, y); @@ -717,7 +688,7 @@ void xCameraFXShakeUpdate(cameraFX* f, F32 dt, const xMat4x3*, xMat4x3* m) xMat3x3GetEuler(m, &e); e.z += - f->shake.cycleTime / f->shake.cycleMax * _1405 * _1404 * scale * f->shake.rotate_magnitude; + f->shake.cycleTime / f->shake.cycleMax * 0.63661975f * 0.1f * scale * f->shake.rotate_magnitude; xMat3x3Euler(m, &e); } @@ -736,9 +707,9 @@ void xCameraFXUpdate(xCamera* cam, F32 dt) { f->elapsedTime += dt; - // non-matching: _765 is loaded too early + // non-matching: 0.0f is loaded too early - if ((f->maxTime > _765 && f->elapsedTime > f->maxTime) || f->flags & 0x2) + if ((f->maxTime > 0.0f && f->elapsedTime > f->maxTime) || f->flags & 0x2) { f->flags = 0; @@ -818,7 +789,7 @@ void xCameraMove(xCamera* cam, U32 flags, F32 dgoal, F32 hgoal, F32 pgoal, F32 t cam->hgoal = hgoal; cam->pgoal = pgoal; - if (tm <= _765) + if (tm <= 0.0f) { if (cam->tgt_mat) { @@ -829,7 +800,7 @@ void xCameraMove(xCamera* cam, U32 flags, F32 dgoal, F32 hgoal, F32 pgoal, F32 t xCam_cyltoworld(&cam->mat.pos, cam->tgt_mat, dgoal, hgoal, pgoal, cam->flags); cam->omat.pos = cam->mat.pos; - cam->yaw_cur = cam->yaw_goal = cam->pcur + ((cam->pcur >= _786) ? _1534 : _786); + cam->yaw_cur = cam->yaw_goal = cam->pcur + ((cam->pcur >= 3.1415927f) ? -3.1415927f : 3.1415927f); } } else @@ -839,11 +810,11 @@ void xCameraMove(xCamera* cam, U32 flags, F32 dgoal, F32 hgoal, F32 pgoal, F32 t cam->tm_dec = tm_dec; cam->tmr = tm; - F32 s = _788 / (tm - _766 * (tm_acc - tm_dec)); + F32 s = 1.0f / (tm - 0.5f * (tm_acc - tm_dec)); cam->depv = s * (dgoal - cam->dcur); cam->hepv = s * (hgoal - cam->hcur); - cam->pepv = xDangleClamp(pgoal - cam->pcur) * s * _766 * (dgoal + cam->dcur); + cam->pepv = xDangleClamp(pgoal - cam->pcur) * s * 0.5f * (dgoal + cam->dcur); } } @@ -851,7 +822,7 @@ void xCameraMove(xCamera* cam, const xVec3& loc) { cam->omat.pos = cam->mat.pos = loc; cam->flags &= ~0x3E; - cam->tm_acc = cam->tm_dec = cam->tmr = _765; + cam->tm_acc = cam->tm_dec = cam->tmr = 0.0f; } void xCameraMove(xCamera* cam, const xVec3& loc, F32 maxSpeed) @@ -875,7 +846,7 @@ void xCameraMove(xCamera* cam, const xVec3& loc, F32 maxSpeed) cam->omat.pos = cam->mat.pos; cam->flags &= ~0x3E; - cam->tm_acc = cam->tm_dec = cam->tmr = _765; + cam->tm_acc = cam->tm_dec = cam->tmr = 0.0f; } void xCameraFOV(xCamera* cam, F32 fov, F32 maxSpeed, F32 dt) @@ -885,7 +856,7 @@ void xCameraFOV(xCamera* cam, F32 fov, F32 maxSpeed, F32 dt) if (currentFOV != fov) { - if (speed != _765) + if (speed != 0.0f) { F32 len = fov - currentFOV; @@ -913,7 +884,7 @@ void xCameraLook(xCamera* cam, U32 flags, const xQuat* orn_goal, F32 tm, F32 tm_ cam->flags = (cam->flags & ~0xF80) | (flags & 0xF80); cam->orn_goal = *orn_goal; - if (tm <= _765) + if (tm <= 0.0f) { if (cam->tgt_mat) { @@ -931,7 +902,7 @@ void xCameraLook(xCamera* cam, U32 flags, const xQuat* orn_goal, F32 tm, F32 tm_ xQuatDiff(&cam->orn_diff, &cam->orn_cur, orn_goal); - cam->orn_epv = _788 / (tm - _766 * (tm_acc - tm_dec)) * xQuatGetAngle(&cam->orn_diff); + cam->orn_epv = 1.0f / (tm - 0.5f * (tm_acc - tm_dec)) * xQuatGetAngle(&cam->orn_diff); } } @@ -943,7 +914,7 @@ void xCameraLookYPR(xCamera* cam, U32 flags, F32 yaw, F32 pitch, F32 roll, F32 t cam->pitch_goal = pitch; cam->roll_goal = roll; - if (tm <= _765) + if (tm <= 0.0f) { if (cam->tgt_mat) { @@ -963,7 +934,7 @@ void xCameraLookYPR(xCamera* cam, U32 flags, F32 yaw, F32 pitch, F32 roll, F32 t cam->ltm_dec = tm_dec; cam->ltmr = tm; - F32 s = _788 / (tm - _766 * (tm_acc - tm_dec)); + F32 s = 1.0f / (tm - 0.5f * (tm_acc - tm_dec)); cam->yaw_epv = s * xDangleClamp(yaw - cam->yaw_cur); cam->pitch_epv = s * xDangleClamp(pitch - cam->pitch_cur); @@ -983,7 +954,7 @@ void xCameraRotate(xCamera* cam, const xMat3x3& m, F32 time, F32 accel, F32 decl cam->pitch_goal = eu.y; cam->roll_goal = eu.z; - if (_765 == time) + if (0.0f == time) { cam->yaw_cur = eu.x; cam->pitch_cur = eu.y; @@ -992,14 +963,14 @@ void xCameraRotate(xCamera* cam, const xMat3x3& m, F32 time, F32 accel, F32 decl *(xMat3x3*)&cam->mat = m; - if (_765 == time) + if (0.0f == time) { *(xMat3x3*)&cam->omat = m; } - if (_765 == time) + if (0.0f == time) { - cam->ltm_acc = cam->ltm_dec = cam->ltmr = _765; + cam->ltm_acc = cam->ltm_dec = cam->ltmr = 0.0f; } else { @@ -1008,7 +979,7 @@ void xCameraRotate(xCamera* cam, const xMat3x3& m, F32 time, F32 accel, F32 decl cam->ltmr = time; } - cam->yaw_epv = cam->pitch_epv = cam->roll_epv = _765; + cam->yaw_epv = cam->pitch_epv = cam->roll_epv = 0.0f; } void xCameraRotate(xCamera* cam, const xVec3& v, F32 roll, F32 time, F32 accel, F32 decl) @@ -1017,7 +988,7 @@ void xCameraRotate(xCamera* cam, const xVec3& v, F32 roll, F32 time, F32 accel, cam->pitch_goal = -xasin(v.y); cam->roll_goal = roll; - if (_765 == time) + if (0.0f == time) { cam->yaw_cur = cam->yaw_goal; cam->pitch_cur = cam->pitch_goal; @@ -1028,14 +999,14 @@ void xCameraRotate(xCamera* cam, const xVec3& v, F32 roll, F32 time, F32 accel, xMat3x3Euler(&cam->mat, cam->yaw_goal, cam->pitch_goal, cam->roll_goal); - if (_765 == time) + if (0.0f == time) { *(xMat3x3*)&cam->omat = *(xMat3x3*)&cam->mat; } - if (_765 == time) + if (0.0f == time) { - cam->ltm_acc = cam->ltm_dec = cam->ltmr = _765; + cam->ltm_acc = cam->ltm_dec = cam->ltmr = 0.0f; } else { @@ -1044,7 +1015,7 @@ void xCameraRotate(xCamera* cam, const xVec3& v, F32 roll, F32 time, F32 accel, cam->ltmr = time; } - cam->yaw_epv = cam->pitch_epv = cam->roll_epv = _765; + cam->yaw_epv = cam->pitch_epv = cam->roll_epv = 0.0f; } F32 xasin(F32 x) @@ -1059,6 +1030,37 @@ float std::asinf(float x) } #endif +// xBound& xBound::operator=(const xBound& b) +// { +// qcd.xmin = b.qcd.xmin; +// qcd.ymin = b.qcd.ymin; +// qcd.zmin = b.qcd.zmin; +// qcd.zmin_dup = b.qcd.zmin_dup; +// qcd.xmax = b.qcd.xmax; +// qcd.ymax = b.qcd.ymax; +// qcd.zmax = b.qcd.zmax; +// qcd.zmax_dup = b.qcd.zmax_dup; +// qcd.min.x = b.qcd.min.x; +// qcd.min.y = b.qcd.min.y; +// qcd.min.z = b.qcd.min.z; +// qcd.max.x = b.qcd.max.x; +// qcd.max.y = b.qcd.max.y; +// qcd.max.z = b.qcd.max.z; +// pad = b.pad; +// box.center.x = b.box.center.x; +// box.center.y = b.box.center.y; +// box.center.z = b.box.center.z; +// box.box.upper.x = b.box.box.upper.x; +// box.box.upper.y = b.box.box.upper.y; +// box.box.upper.z = b.box.box.upper.z; +// box.box.lower.x = b.box.box.lower.x; +// box.box.lower.y = b.box.box.lower.y; +// box.box.lower.z = b.box.box.lower.z; +// mat = b.mat; + +// return *this; +// } + static void bound_sphere_xz(xVec3& r3, xVec3& r4, const xVec3& r5, F32 f1, const xVec3& r6, F32 f2) { // non-matching: incorrect registers and out-of-order instructions @@ -1092,7 +1094,7 @@ void xBinaryCamera::start(xCamera& camera) xQuatFromMat(&this->cam_dir, &camera.mat); - this->stick_offset = _765; + this->stick_offset = 0.0f; } void xBinaryCamera::stop() @@ -1147,17 +1149,17 @@ void xMat3x3LookAt(xMat3x3* m, const xVec3* pos, const xVec3* at) F32 xQuatGetAngle(const xQuat* q) { - if (q->s > _1584) + if (q->s > 0.99998999f) { - return _765; + return 0.0f; } - else if (q->s < _1586) + else if (q->s < -0.99998999f) { - return _1585; + return 6.2831855f; } else { - return _874 * xacos(q->s); + return 2.0f * xacos(q->s); } } @@ -1227,15 +1229,15 @@ float std::expf(float x) F32 xrmod(F32 ang) { - F32 frac = _1766 * ang; + F32 frac = 0.15915494f * ang; - if (frac < _765) + if (frac < 0.0f) { - return (frac - std::ceilf(frac) + _788) * _1585; + return (frac - std::ceilf(frac) + 1.0f) * 6.2831855f; } - else if (frac >= _788) + else if (frac >= 1.0f) { - return (frac - std::floorf(frac)) * _1585; + return (frac - std::floorf(frac)) * 6.2831855f; } return ang; @@ -1243,7 +1245,7 @@ F32 xrmod(F32 ang) xVec3& xVec3::operator/=(F32 f) { - F32 f2 = _788; + F32 f2 = 1.0f; this->x *= f2 / f; this->y *= f2 / f; @@ -1261,13 +1263,13 @@ xVec3& xVec3::safe_normalize(const xVec3& val) { F32 len = this->length2(); - if (len < _1772) + if (len < 0.000099999997f) { return (*this = val); } else { - return (*this *= _788 / xsqrt(len)); + return (*this *= 1.0f / xsqrt(len)); } } diff --git a/src/SB/Core/x/xCutscene.cpp b/src/SB/Core/x/xCutscene.cpp index a75e62177..45e0e63c0 100644 --- a/src/SB/Core/x/xCutscene.cpp +++ b/src/SB/Core/x/xCutscene.cpp @@ -11,16 +11,11 @@ #include #include -extern xCutscene sActiveCutscene; -extern xCutsceneInfo* sCutTocInfo; -extern U32 sCutTocCount; +xCutscene sActiveCutscene; +U32 sCutTocCount; +xCutsceneInfo* sCutTocInfo; extern void* RwEngineInstance; -extern xModelInstance sCutsceneFakeModel[8]; - -extern F32 _672; // 1.0 - -extern F32 lbl_803CCB3C; // 0.0 -extern F32 lbl_803CCB40; // 0.033333335 +static xModelInstance sCutsceneFakeModel[8]; // Non-matching: scheduling void xCutscene_Init(void* toc) @@ -60,7 +55,7 @@ xCutscene* xCutscene_Create(U32 id) xSndPauseAll(1, 1); memset(&sActiveCutscene, 0, 0x198); - sActiveCutscene.PlaybackSpeed = _672; + sActiveCutscene.PlaybackSpeed = 1.0f; for (int i = 0; i < sCutTocCount; i++) { @@ -165,7 +160,7 @@ S32 xCutscene_Update(xCutscene *csn, F32 dt) csn->Time = csn->PlaybackSpeed * dt + csn->Time; csn->CamTime = xCutsceneConvertBreak(csn->Time, csn->BreakList, csn->Info->BreakCount, -1); - + if (csn->Time > csn->Play->EndTime || csn->BadReadPause) { if (csn->PlayIndex == csn->Info->NumTime - 1) @@ -247,6 +242,23 @@ void xCutscene_SetSpeed(xCutscene* csn, F32 speed) } } +F32 xlog(F32 x) +{ + return std::logf(x); +} + +float std::logf(float x) +{ + return (float)log((double)x); +} + +void xVec3Lerp(xVec3* out, const xVec3* a, const xVec3* b, float alpha) +{ + out->x = a->x + (b->x - a->x) * alpha; + out->y = a->y + (b->y - a->y) * alpha; + out->z = a->z + (b->z - a->z) * alpha; +} + F32 xCutsceneConvertBreak(float param_1, xCutsceneBreak* param_2, U32 param_3, int param_4) { int i = 0; @@ -260,11 +272,11 @@ F32 xCutsceneConvertBreak(float param_1, xCutsceneBreak* param_2, U32 param_3, i { break; } - if (param_2[i].Time - param_1 <= lbl_803CCB3C) + if (param_2[i].Time - param_1 <= 0.0f) { break; } - if (lbl_803CCB40 <= param_2[i].Time - param_1) + if (0.03333333f <= param_2[i].Time - param_1) { break; } @@ -275,7 +287,7 @@ F32 xCutsceneConvertBreak(float param_1, xCutsceneBreak* param_2, U32 param_3, i return param_1; } } - return param_2[i].Time - lbl_803CCB40; + return param_2[i].Time - 0.03333333f; } void CutsceneShadowRender(CutsceneShadowModel* smod) @@ -294,7 +306,19 @@ void CutsceneShadowRender(CutsceneShadowModel* smod) } } +void xCutscene_Render(xCutscene*, xEnt**, S32*, F32*) +{ +} + xCutscene* xCutscene_CurrentCutscene() { return &sActiveCutscene; } + +void XCSNNosey::CanRenderNow() +{ +} + +void XCSNNosey::UpdatedAnimated(RpAtomic*, RwMatrixTag*, U32, U32) +{ +} diff --git a/src/SB/Core/x/xCutscene.h b/src/SB/Core/x/xCutscene.h index dc9c9abfe..c9f9352ad 100644 --- a/src/SB/Core/x/xCutscene.h +++ b/src/SB/Core/x/xCutscene.h @@ -55,6 +55,9 @@ struct XCSNNosey { void* userdata; S32 flg_nosey; + + void CanRenderNow(); + void UpdatedAnimated(RpAtomic*, RwMatrixTag*, U32, U32); }; struct xCutscene diff --git a/src/SB/Core/x/xEntMotion.cpp b/src/SB/Core/x/xEntMotion.cpp index 8b512208d..39a84b177 100644 --- a/src/SB/Core/x/xEntMotion.cpp +++ b/src/SB/Core/x/xEntMotion.cpp @@ -188,7 +188,7 @@ void xEntMechReverse(xEntMotion* motion) static xEntMotion** dbg_xems; static U16 dbg_num; static U16 dbg_num_allocd; -static S16 dbg_idx; +static S16 dbg_idx = -1; void xEntMotionDebugCB(); @@ -222,3 +222,107 @@ void xEntMotionDebugExit() dbg_num_allocd = 0; dbg_idx = -1; } + +void xEntMotionDebugCB() +{ +} + +S32 xDebugModeAdd(char*, void*) +{ + return 0; +} + +void xEntMotionRun(xEntMotion* motion) +{ + motion->flags &= 0xFFFB; +} + +void xEntMotionStop(xEntMotion* motion) +{ + motion->flags |= 0x4; +} + +void xEntMotionReset(xEntMotion*, xScene*) +{ +} + +U32 xEntMotionIsStopped(const xEntMotion* motion) +{ + return motion->flags & 0x4; +} + +U32 xEntERIsExtending(const xEntMotion* motion) +{ + return motion->t < motion->er.et; +} + +U32 xEntERIsExtended(const xEntMotion* motion) +{ + return motion->t >= motion->er.et && motion->t < motion->er.brt; +} + +U32 xEntERIsRetracted(const xEntMotion* motion) +{ + return motion->t >= motion->er.ert; +} + +U32 xEntERIsRetracting(const xEntMotion* motion) +{ + return motion->t >= motion->er.brt && motion->t < motion->er.ert; +} + +void xEntMPSetSpeed(xEntMotion* motion, F32 speed) +{ + motion->mp.speed = MAX(0.0f, speed); +} + +void xEntMotionTranslate(xEntMotion*, const xVec3*, xMat4x3*) +{ +} + +void xEntMotionMove(xEntMotion*, xScene*, F32, xEntFrame*) +{ +} + +F32 xSpline3_ArcTotal(xSpline3*) +{ + return 0.0f; +} + +void xQuatCopy(xQuat* a, const xQuat* b) +{ + a->s = b->s; + a->v.x = b->v.x; + a->v.y = b->v.y; + a->v.z = b->v.z; +} + +U32 xVec3Equals(const xVec3* a, const xVec3* b) +{ + // Epsilon test with epsilon of... 0.0f lol. + return xabs(a->x - b->x) <= 0.0f && xabs(a->y - b->y) <= 0.0f && xabs(a->z - b->z) <= 0.0f; +} + +U32 xQuatEquals(const xQuat* a, const xQuat* b) +{ + return (a->s == b->s) && xVec3Equals(&a->v, &b->v); +} + +void xQuatFlip(xQuat* a, const xQuat* b) +{ + a->s = -b->s; + xVec3Inv(&a->v, &b->v); +} + +F32 xQuatDot(const xQuat* a, const xQuat* b) +{ + return xVec3Dot(&a->v, &b->v) + a->s * b->s; +} + +void xDrawLine(const xVec3* start, const xVec3* end) +{ +} + +void xDrawSetColor(iColor_tag color) +{ +} diff --git a/src/SB/Core/x/xFFX.cpp b/src/SB/Core/x/xFFX.cpp index 8ac64659d..3c5a1e262 100644 --- a/src/SB/Core/x/xFFX.cpp +++ b/src/SB/Core/x/xFFX.cpp @@ -4,11 +4,15 @@ #include -extern xFFX* alist; -extern xFFXShakeState* shake_alist; -extern U32 rot_match_psize; -extern xFFXRotMatchState* rot_match_pool; -extern xFFXRotMatchState* rot_match_alist; +U32 psize; +xFFX* pool; +xFFX* alist; +U32 shake_psize; +void* shake_pool; +xFFXShakeState* shake_alist; +U32 rot_match_psize; +xFFXRotMatchState* rot_match_pool; +xFFXRotMatchState* rot_match_alist; // Structure same as the bottom function, get that one, you get this one. //void xFFXPoolInit(U32 num_ffx); @@ -114,8 +118,18 @@ void xFFXApply(xEnt* ent, xScene* sc, F32 dt) } } +void xFFXShakeUpdateEnt(xEnt* ent, xScene* scene, float value, void*) +{ +} + +void xFFXPoolInit(U32 num) +{ +} + // The structure of this is identical to the pool init below. Figure out that one, you get this one as well. -//void xFFXShakePoolInit(U32 num); +void xFFXShakePoolInit(U32 num) +{ +} xFFXShakeState* xFFXShakeAlloc() { diff --git a/src/SB/Core/x/xGrid.cpp b/src/SB/Core/x/xGrid.cpp index 7ec9746c2..bf38021a9 100644 --- a/src/SB/Core/x/xGrid.cpp +++ b/src/SB/Core/x/xGrid.cpp @@ -10,6 +10,8 @@ extern float xGrid_float_0p001; extern float xGrid_float_one; extern float xGrid_float_one_quarter; +volatile S32 gGridIterActive = 0; + void xGridBoundInit(xGridBound* bound, void* data) { bound->data = data; diff --git a/src/SB/Core/x/xMath.cpp b/src/SB/Core/x/xMath.cpp index 60f23b24f..ed37d17c2 100644 --- a/src/SB/Core/x/xMath.cpp +++ b/src/SB/Core/x/xMath.cpp @@ -5,9 +5,9 @@ #include "xMathInlines.h" -extern S32 xmath_inited; -extern S32 xmath_exited; -extern volatile U32 rndseed; // made this volatile so xrand() matches +S32 xmath_inited; +S32 xmath_exited; +volatile U32 rndseed; // made this volatile so xrand() matches void xMathInit() { @@ -110,14 +110,14 @@ U32 xMathSolveCubic(F32 a, F32 b, F32 c, F32 d, F32* x1, F32* x2, F32* x3) { F32 fAngle; F32 fCos; // F32 fSin; // - + F32 temp_f1; F32 temp_f1_2; F32 temp_f1_3; F32 temp_f28_2; F32 temp_f29; F32 var_f1; - + if (a == 0.0f) { return xMathSolveQuadratic(b, c, d, x1, x2); } @@ -188,7 +188,7 @@ F32 xAngleClamp(F32 a) F32 xAngleClampFast(F32 a) { F32 rad360 = (2 * PI); - + if (a < 0.0f) { return a + rad360; @@ -206,7 +206,7 @@ F32 xDangleClamp(F32 a) { F32 rad360 = 2 * PI; F32 rem = xfmod(a, rad360); - + if (rem >= PI) { return rem - rad360; @@ -365,7 +365,7 @@ void xAccelMove(F32& x, F32& v, F32 a, F32 dt, F32 maxv) { U32 aa; // r29+0xC F32 diff; F32 dv; - + if ((F32) __fabs(v) > (F32) __fabs(maxv)) { if (v < 0.0f) { if (a > 0.0f) { diff --git a/src/SB/Core/x/xMemMgr.cpp b/src/SB/Core/x/xMemMgr.cpp index f9cae4e5c..9f628989f 100644 --- a/src/SB/Core/x/xMemMgr.cpp +++ b/src/SB/Core/x/xMemMgr.cpp @@ -7,9 +7,11 @@ #include "iSystem.h" #include "iMemMgr.h" -extern xMemInfo_tag gMemInfo; -extern xMemHeap_tag gxHeap[3]; -extern void (*sMemBaseNotifyFunc)(); +xMemInfo_tag gMemInfo; +xMemHeap_tag gxHeap[3]; + +U32 gActiveHeap; +void (*sMemBaseNotifyFunc)(); void xMemDebug_SoakLog(const char*) { diff --git a/src/SB/Core/x/xPad.cpp b/src/SB/Core/x/xPad.cpp index 81b34d648..7786ae06f 100644 --- a/src/SB/Core/x/xPad.cpp +++ b/src/SB/Core/x/xPad.cpp @@ -3,6 +3,8 @@ #include #include +_tagxPad mPad[4]; + S32 xPadInit() { memset(mPad, 0, sizeof(mPad)); diff --git a/src/SB/Core/x/xSnd.cpp b/src/SB/Core/x/xSnd.cpp index 44db85071..4e25b70bb 100644 --- a/src/SB/Core/x/xSnd.cpp +++ b/src/SB/Core/x/xSnd.cpp @@ -7,13 +7,9 @@ extern _xSndDelayed sDelayedSnd[16]; extern U32 sDelayedPaused; - extern F32 sTimeElapsed; -extern F32 _585; -extern F32 _586; -extern F32 _598; -extern F32 _599; -extern xSndGlobals gSnd; + +xSndGlobals gSnd; static S32 faders_active; @@ -29,13 +25,13 @@ void xSndInit() xSndSceneInit(); - //Need this to only use f0 instead of f1 for _585 + //Need this to only use f0 instead of f1 for 1.0f for (int i = 0; i < 5; i++) { - gSnd.categoryVolFader[i] = _585; + gSnd.categoryVolFader[i] = 1.0f; } - gSnd.categoryVolFader[2] = _586; + gSnd.categoryVolFader[2] = 0.7f; gSnd.stereo = 1; iSndSuspendCD(1); @@ -48,15 +44,15 @@ void xSndSceneInit() gSnd.listenerMode = SND_LISTENER_MODE_PLAYER; for (U32 i = 0; i < 2; i++) { - gSnd.listenerMat[i].at.assign(_585, _598, _598); - gSnd.listenerMat[i].right.assign(_598, _585, _598); - gSnd.listenerMat[i].up.assign(_598, _598, _585); - gSnd.listenerMat[i].pos.assign(_599, _599, _599); + gSnd.listenerMat[i].at.assign(1.0f, 0.0f, 0.0f); + gSnd.listenerMat[i].right.assign(0.0f, 1.0f, 0.0f); + gSnd.listenerMat[i].up.assign(0.0f, 0.0f, 1.0f); + gSnd.listenerMat[i].pos.assign(999999.0f, 999999.0f, 999999.0f); } - gSnd.at.assign(_585, _598, _598); - gSnd.right.assign(_598, _585, _598); - gSnd.up.assign(_598, _598, _585); - gSnd.pos.assign(_599, _599, _599); + gSnd.at.assign(1.0f, 0.0f, 0.0f); + gSnd.right.assign(0.0f, 1.0f, 0.0f); + gSnd.up.assign(0.0f, 0.0f, 1.0f); + gSnd.pos.assign(999999.0f, 999999.0f, 999999.0f); iSndUpdate(); } @@ -141,7 +137,7 @@ void xSndDelayedInit() for (int i = 0; i < 16; i++) { //Alternates between f1 and f0 - sDelayedSnd[i].delay = *(volatile F32*)&_598; + sDelayedSnd[i].delay = 0.0f; } sDelayedPaused = 0; } @@ -184,7 +180,7 @@ void xSndCalculateListenerPosition() gSnd.up = pMat->up; gSnd.at = pMat->at; gSnd.pos = gSnd.listenerMat[1].pos; - gSnd.pos.y += _585; + gSnd.pos.y += 1.0f; break; case SND_LISTENER_MODE_CAMERA: pMat = &gSnd.listenerMat[0]; @@ -268,7 +264,7 @@ void xSndExit() U32 xSndPlay(U32 id, F32 vol, F32 pitch, U32 priority, U32 flags, U32 parentID, sound_category category, F32 delay) { - return xSndPlayInternal(id, vol, pitch, priority, flags, parentID, NULL, NULL, _598, _598, + return xSndPlayInternal(id, vol, pitch, priority, flags, parentID, NULL, NULL, 0.0f, 0.0f, category, delay); } diff --git a/src/SB/Core/x/xordarray.cpp b/src/SB/Core/x/xordarray.cpp index 85f8b4108..d3c405837 100644 --- a/src/SB/Core/x/xordarray.cpp +++ b/src/SB/Core/x/xordarray.cpp @@ -3,9 +3,6 @@ #include -extern F32 lbl_803CCEE8; // 0.95f -extern F32 lbl_803CCEF0; // 176f - void XOrdInit(st_XORDEREDARRAY* array, S32 size, S32 tempAlloc) { U32 cnt = 1; @@ -23,7 +20,7 @@ void XOrdInit(st_XORDEREDARRAY* array, S32 size, S32 tempAlloc) } array->cnt = 0; array->max = cnt; - array->warnlvl = lbl_803CCEE8 * (cnt ^ 0x80000000); + array->warnlvl = 0.95f * (cnt ^ 0x80000000); if (array->warnlvl == array->max) { cnt = array->max - 1; diff --git a/src/SB/Core/x/xpkrsvc.cpp b/src/SB/Core/x/xpkrsvc.cpp index 12b7d381b..18fb512a2 100644 --- a/src/SB/Core/x/xpkrsvc.cpp +++ b/src/SB/Core/x/xpkrsvc.cpp @@ -9,8 +9,6 @@ #include "xMath.h" #include "xMemMgr.h" -extern char xpkrsvc_strings[]; - // Square and JESway: Function relocation issues will resolve themselves when all the functions // here 100% match, as it is apparently related to the instruction size of each function static st_PACKER_READ_FUNCS g_pkr_read_funcmap_original = { 1, @@ -1200,7 +1198,7 @@ S32 ValidatePlatform(st_HIPLOADDATA* pkg, st_PACKER_READ_DATA* pr, S32 plattag, sprintf(fullname, "%s %s %s %s", plat, vid, lang, title); bool rc = false; - if ((strcmp(plat, "Game Cube") == 0 || strcmp(plat, "Xbox") == 0 || + if ((strcmp(plat, "GameCube") == 0 || strcmp(plat, "Xbox") == 0 || strcmp(plat, "PlayStation 2") == 0)) { rc = true; @@ -1242,7 +1240,7 @@ S32 ValidatePlatform(st_HIPLOADDATA* pkg, st_PACKER_READ_DATA* pr, S32 plattag, return 0; } - rc = !(bool)(strcmp(plat, "Game Cube")); + rc = !(bool)(strcmp(plat, "GameCube")); if (!rc) { return 0; @@ -1764,5 +1762,5 @@ void PKR_pop_memmark() char* st_PACKER_ATOC_NODE::Name() const { - return xpkrsvc_strings + 82; + return ""; } diff --git a/src/SB/Game/zCamera.cpp b/src/SB/Game/zCamera.cpp index b3b63c3ca..015e97611 100644 --- a/src/SB/Game/zCamera.cpp +++ b/src/SB/Game/zCamera.cpp @@ -95,6 +95,7 @@ static F32 rewardTiltAmount = -0.22f; extern zGlobals globals; extern const xVec3 g_O3; +F32 gCameraLastFov; namespace diff --git a/src/SB/Game/zEntCruiseBubble.cpp b/src/SB/Game/zEntCruiseBubble.cpp index bcf9b6864..2e68af6fb 100644 --- a/src/SB/Game/zEntCruiseBubble.cpp +++ b/src/SB/Game/zEntCruiseBubble.cpp @@ -33,163 +33,163 @@ // Taken from zEntCruiseBubble.s // Defining these here makes the stringBase0 offsets match in the later functions. -char* str1 = "Idle01"; -char* str2 = "Idle02"; -char* str3 = "Idle03"; -char* str4 = "Idle04"; -char* str5 = "Idle05"; -char* str6 = "Idle06"; -char* str7 = "Idle07"; -char* str8 = "Idle08"; -char* str9 = "Idle09"; -char* str10 = "Idle10"; -char* str11 = "Idle11"; -char* str12 = "Idle12"; -char* str13 = "Idle13"; -char* str14 = "SlipIdle01"; -char* str15 = "Inactive01"; -char* str16 = "Inactive02"; -char* str17 = "Inactive03"; -char* str18 = "Inactive04"; -char* str19 = "Inactive05"; -char* str20 = "Inactive06"; -char* str21 = "Inactive07"; -char* str22 = "Inactive08"; -char* str23 = "Inactive09"; -char* str24 = "Inactive10"; -char* str25 = "Walk01"; -char* str26 = "Run01"; -char* str27 = "Run02"; -char* str28 = "Run03"; -char* str29 = "Land01"; -char* str30 = "LandRun01"; -char* str31 = "LandHigh01"; -char* str32 = "WallLand01"; -char* str33 = "Hit01"; -char* str34 = "Hit02"; -char* str35 = "Hit03"; -char* str36 = "Hit04"; -char* str37 = "Hit05"; -char* str38 = "SB_cruise_start"; -char* str39 = "SB_cruise_hit"; -char* str40 = "SB_cruise_nav_loop"; -char* str41 = "cruise_bubble_bind.MINF"; -char* str42 = "lightning"; -char* str43 = "Wake Ribbon 0"; -char* str44 = "Player|Cruise Bubble|Wake Ribbon 0|"; -char* str45 = "Wake Ribbon 1"; -char* str46 = "Player|Cruise Bubble|Wake Ribbon 1|"; -char* str47 = "par_cruise_explode"; -char* str48 = "Cruise Bubble Explosion"; -char* str49 = "cruise_bubble_droplet_shrapnel"; -char* str50 = ".minf"; -char* str51 = ".dff"; -char* str52 = "ui_3dicon_reticle"; -char* str53 = "ui_3dicon_target_lock"; -char* str54 = "ui_3dicon_missile_frame02"; -char* str55 = "%02d:%02d"; -char* str56 = "aura2"; -char* str57 = "aim_delay"; -char* str58 = "player.halt_time"; -char* str59 = "player.aim.turn_speed"; -char* str60 = "player.aim.anim_delta"; -char* str61 = "player.fire.delay_wand"; -char* str62 = "missle.life"; -char* str63 = "missle.hit_dist"; -char* str64 = "missle.crash_angle"; -char* str65 = "missle.collide_twist"; -char* str66 = "missle.hit_tests"; -char* str67 = "missle.appear.delay_show"; -char* str68 = "missle.appear.delay_fly"; -char* str69 = "missle.appear.offset"; -char* str70 = "missle.fly.accel"; -char* str71 = "missle.fly.max_vel"; -char* str72 = "missle.fly.engine_pitch_max"; -char* str73 = "missle.fly.engine_pitch_sensitivity"; -char* str74 = "missle.fly.flash_interval"; -char* str75 = "missle.fly.turn.xdelta"; -char* str76 = "missle.fly.turn.ydelta"; -char* str77 = "missle.fly.turn.xdecay"; -char* str78 = "missle.fly.turn.ydecay"; -char* str79 = "missle.fly.turn.ybound"; -char* str80 = "missle.fly.turn.roll_frac"; -char* str81 = "missle.explode.hit_radius"; -char* str82 = "missle.explode.hit_duration"; -char* str83 = "camera.aim.dist"; -char* str84 = "camera.aim.height"; -char* str85 = "camera.aim.pitch"; -char* str86 = "camera.aim.accel"; -char* str87 = "camera.aim.max_vel"; -char* str88 = "camera.aim.stick_decel"; -char* str89 = "camera.aim.stick_accel"; -char* str90 = "camera.aim.stick_max_vel"; -char* str91 = "camera.aim.turn_speed"; -char* str92 = "camera.seize.delay"; -char* str93 = "camera.seize.blend_time"; -char* str94 = "camera.seize.fade_dist"; -char* str95 = "camera.seize.hide_dist"; -char* str96 = "camera.seize.fov"; -char* str97 = "camera.survey.duration"; -char* str98 = "camera.survey.min_duration"; -char* str99 = "camera.survey.min_dist"; -char* str100 = "camera.survey.cut_dist"; -char* str101 = "camera.survey.drift_dist"; -char* str102 = "camera.survey.drift_softness"; -char* str103 = "camera.survey.jerk_offset"; -char* str104 = "camera.survey.jerk_deflect"; -char* str105 = "camera.restore.control_delay"; -char* str106 = "material.env_alpha"; -char* str107 = "material.env_coeff"; -char* str108 = "material.fresnel_alpha"; -char* str109 = "material.fresnel_coeff"; -char* str110 = "reticle.dist_min"; -char* str111 = "reticle.dist_max"; -char* str112 = "reticle.ang_show"; -char* str113 = "reticle.ang_hide"; -char* str114 = "reticle.delay_retarget"; -char* str115 = "trail.sample_rate"; -char* str116 = "trail.bubble_rate"; -char* str117 = "trail.bubble_emit_radius"; -char* str118 = "trail.wake_emit_radius"; -char* str119 = "blast.emit"; -char* str120 = "blast.radius"; -char* str121 = "blast.vel"; -char* str122 = "blast.rand_vel"; -char* str123 = "droplet.dist_min"; -char* str124 = "droplet.dist_max"; -char* str125 = "droplet.emit_min"; -char* str126 = "droplet.emit_max"; -char* str127 = "droplet.vel_min"; -char* str128 = "droplet.vel_max"; -char* str129 = "droplet.vel_perturb"; -char* str130 = "droplet.vel_angle"; -char* str131 = "droplet.rot_vel_max"; -char* str132 = "hud.glow_size"; -char* str133 = "hud.time_fade"; -char* str134 = "hud.time_glow"; -char* str135 = "hud.wind.size"; -char* str136 = "hud.wind.du"; -char* str137 = "hud.wind.dv"; -char* str138 = "hud.reticle.size"; -char* str139 = "hud.target.size"; -char* str140 = "hud.timer.font"; -char* str141 = "hud.timer.font_width"; -char* str142 = "hud.timer.font_height"; -char* str143 = "hud.timer.x"; -char* str144 = "hud.timer.y"; -char* str145 = "hud.timer.glow_size"; -char* str146 = "dialog.freq"; -char* str147 = "dialog.decay"; -char* str148 = "dialog.min_freq"; -char* str149 = "gloss_edge"; -char* str150 = "rainbowfilm_smooth32"; -char* str151 = "cruise_bubble_aim"; -char* str152 = "cruise_bubble_fire"; -char* str153 = "cruise_bubble_idle"; -char* str154 = "cruise_bubble_aim cruise_bubble_fire cruise_bubble_idle"; -char* str155 = "Cruise Bubble"; -char* str156 = "fire"; -char* str157 = "fly"; +static char* str1 = "Idle01"; +static char* str2 = "Idle02"; +static char* str3 = "Idle03"; +static char* str4 = "Idle04"; +static char* str5 = "Idle05"; +static char* str6 = "Idle06"; +static char* str7 = "Idle07"; +static char* str8 = "Idle08"; +static char* str9 = "Idle09"; +static char* str10 = "Idle10"; +static char* str11 = "Idle11"; +static char* str12 = "Idle12"; +static char* str13 = "Idle13"; +static char* str14 = "SlipIdle01"; +static char* str15 = "Inactive01"; +static char* str16 = "Inactive02"; +static char* str17 = "Inactive03"; +static char* str18 = "Inactive04"; +static char* str19 = "Inactive05"; +static char* str20 = "Inactive06"; +static char* str21 = "Inactive07"; +static char* str22 = "Inactive08"; +static char* str23 = "Inactive09"; +static char* str24 = "Inactive10"; +static char* str25 = "Walk01"; +static char* str26 = "Run01"; +static char* str27 = "Run02"; +static char* str28 = "Run03"; +static char* str29 = "Land01"; +static char* str30 = "LandRun01"; +static char* str31 = "LandHigh01"; +static char* str32 = "WallLand01"; +static char* str33 = "Hit01"; +static char* str34 = "Hit02"; +static char* str35 = "Hit03"; +static char* str36 = "Hit04"; +static char* str37 = "Hit05"; +static char* str38 = "SB_cruise_start"; +static char* str39 = "SB_cruise_hit"; +static char* str40 = "SB_cruise_nav_loop"; +static char* str41 = "cruise_bubble_bind.MINF"; +static char* str42 = "lightning"; +static char* str43 = "Wake Ribbon 0"; +static char* str44 = "Player|Cruise Bubble|Wake Ribbon 0|"; +static char* str45 = "Wake Ribbon 1"; +static char* str46 = "Player|Cruise Bubble|Wake Ribbon 1|"; +static char* str47 = "par_cruise_explode"; +static char* str48 = "Cruise Bubble Explosion"; +static char* str49 = "cruise_bubble_droplet_shrapnel"; +static char* str50 = ".minf"; +static char* str51 = ".dff"; +static char* str52 = "ui_3dicon_reticle"; +static char* str53 = "ui_3dicon_target_lock"; +static char* str54 = "ui_3dicon_missile_frame02"; +static char* str55 = "%02d:%02d"; +static char* str56 = "aura2"; +static char* str57 = "aim_delay"; +static char* str58 = "player.halt_time"; +static char* str59 = "player.aim.turn_speed"; +static char* str60 = "player.aim.anim_delta"; +static char* str61 = "player.fire.delay_wand"; +static char* str62 = "missle.life"; +static char* str63 = "missle.hit_dist"; +static char* str64 = "missle.crash_angle"; +static char* str65 = "missle.collide_twist"; +static char* str66 = "missle.hit_tests"; +static char* str67 = "missle.appear.delay_show"; +static char* str68 = "missle.appear.delay_fly"; +static char* str69 = "missle.appear.offset"; +static char* str70 = "missle.fly.accel"; +static char* str71 = "missle.fly.max_vel"; +static char* str72 = "missle.fly.engine_pitch_max"; +static char* str73 = "missle.fly.engine_pitch_sensitivity"; +static char* str74 = "missle.fly.flash_interval"; +static char* str75 = "missle.fly.turn.xdelta"; +static char* str76 = "missle.fly.turn.ydelta"; +static char* str77 = "missle.fly.turn.xdecay"; +static char* str78 = "missle.fly.turn.ydecay"; +static char* str79 = "missle.fly.turn.ybound"; +static char* str80 = "missle.fly.turn.roll_frac"; +static char* str81 = "missle.explode.hit_radius"; +static char* str82 = "missle.explode.hit_duration"; +static char* str83 = "camera.aim.dist"; +static char* str84 = "camera.aim.height"; +static char* str85 = "camera.aim.pitch"; +static char* str86 = "camera.aim.accel"; +static char* str87 = "camera.aim.max_vel"; +static char* str88 = "camera.aim.stick_decel"; +static char* str89 = "camera.aim.stick_accel"; +static char* str90 = "camera.aim.stick_max_vel"; +static char* str91 = "camera.aim.turn_speed"; +static char* str92 = "camera.seize.delay"; +static char* str93 = "camera.seize.blend_time"; +static char* str94 = "camera.seize.fade_dist"; +static char* str95 = "camera.seize.hide_dist"; +static char* str96 = "camera.seize.fov"; +static char* str97 = "camera.survey.duration"; +static char* str98 = "camera.survey.min_duration"; +static char* str99 = "camera.survey.min_dist"; +static char* str100 = "camera.survey.cut_dist"; +static char* str101 = "camera.survey.drift_dist"; +static char* str102 = "camera.survey.drift_softness"; +static char* str103 = "camera.survey.jerk_offset"; +static char* str104 = "camera.survey.jerk_deflect"; +static char* str105 = "camera.restore.control_delay"; +static char* str106 = "material.env_alpha"; +static char* str107 = "material.env_coeff"; +static char* str108 = "material.fresnel_alpha"; +static char* str109 = "material.fresnel_coeff"; +static char* str110 = "reticle.dist_min"; +static char* str111 = "reticle.dist_max"; +static char* str112 = "reticle.ang_show"; +static char* str113 = "reticle.ang_hide"; +static char* str114 = "reticle.delay_retarget"; +static char* str115 = "trail.sample_rate"; +static char* str116 = "trail.bubble_rate"; +static char* str117 = "trail.bubble_emit_radius"; +static char* str118 = "trail.wake_emit_radius"; +static char* str119 = "blast.emit"; +static char* str120 = "blast.radius"; +static char* str121 = "blast.vel"; +static char* str122 = "blast.rand_vel"; +static char* str123 = "droplet.dist_min"; +static char* str124 = "droplet.dist_max"; +static char* str125 = "droplet.emit_min"; +static char* str126 = "droplet.emit_max"; +static char* str127 = "droplet.vel_min"; +static char* str128 = "droplet.vel_max"; +static char* str129 = "droplet.vel_perturb"; +static char* str130 = "droplet.vel_angle"; +static char* str131 = "droplet.rot_vel_max"; +static char* str132 = "hud.glow_size"; +static char* str133 = "hud.time_fade"; +static char* str134 = "hud.time_glow"; +static char* str135 = "hud.wind.size"; +static char* str136 = "hud.wind.du"; +static char* str137 = "hud.wind.dv"; +static char* str138 = "hud.reticle.size"; +static char* str139 = "hud.target.size"; +static char* str140 = "hud.timer.font"; +static char* str141 = "hud.timer.font_width"; +static char* str142 = "hud.timer.font_height"; +static char* str143 = "hud.timer.x"; +static char* str144 = "hud.timer.y"; +static char* str145 = "hud.timer.glow_size"; +static char* str146 = "dialog.freq"; +static char* str147 = "dialog.decay"; +static char* str148 = "dialog.min_freq"; +static char* str149 = "gloss_edge"; +static char* str150 = "rainbowfilm_smooth32"; +static char* str151 = "cruise_bubble_aim"; +static char* str152 = "cruise_bubble_fire"; +static char* str153 = "cruise_bubble_idle"; +static char* str154 = "cruise_bubble_aim cruise_bubble_fire cruise_bubble_idle"; +static char* str155 = "Cruise Bubble"; +static char* str156 = "fire"; +static char* str157 = "fly"; namespace cruise_bubble { diff --git a/src/SB/Game/zGame.cpp b/src/SB/Game/zGame.cpp index 9b38c9dce..0f3418aac 100644 --- a/src/SB/Game/zGame.cpp +++ b/src/SB/Game/zGame.cpp @@ -31,6 +31,11 @@ extern _tagTRCPadInfo gTrcPad[4]; extern S32 g_hiphopReloadHIP; extern S32 g_hiphopForcePortal; +static S32 sGameOverTimer; +float sTimeElapsed; +S64 sTimeLast; +S64 sTimeCurrent; + extern F32 lbl_803CDA28; extern F32 lbl_803CDA10; // R, G, B @@ -41,157 +46,157 @@ extern F32 lbl_803CDA58; // Taken from zGame.s // Defining these here makes the stringBase0 offsets match in the later functions. -char* str1 = "HB02"; -char* str2 = "HB01"; -char* str3 = "HB03"; -char* str4 = "HB04"; -char* str5 = "JF01"; -char* str6 = "JF02"; -char* str7 = "JF03"; -char* str8 = "JF04"; -char* str9 = "BB01"; -char* str10 = "BB02"; -char* str11 = "BB03"; -char* str12 = "BB04"; -char* str13 = "GL01"; -char* str14 = "GL02"; -char* str15 = "GL03"; -char* str16 = "B101"; -char* str17 = "HB05"; -char* str18 = "HB06"; -char* str19 = "HB09"; -char* str20 = "BC01"; -char* str21 = "BC02"; -char* str22 = "BC03"; -char* str23 = "BC04"; -char* str24 = "BC05"; -char* str25 = "RB01"; -char* str26 = "RB02"; -char* str27 = "RB03"; -char* str28 = "SM01"; -char* str29 = "SM02"; -char* str30 = "SM03"; -char* str31 = "SM04"; -char* str32 = "B201"; -char* str33 = "DB01"; -char* str34 = "DB02"; -char* str35 = "DB03"; -char* str36 = "DB04"; -char* str37 = "DB06"; -char* str38 = "KF01"; -char* str39 = "KF02"; -char* str40 = "KF04"; -char* str41 = "KF05"; -char* str42 = "GY01"; -char* str43 = "GY02"; -char* str44 = "GY03"; -char* str45 = "GY04"; -char* str46 = "HB07"; -char* str47 = "HB08"; -char* str48 = "B302"; -char* str49 = "B303"; -char* str50 = "HB10"; -char* str51 = "PG12"; -char* str52 = "techbutton6_click"; -char* str53 = "SAVING GAME ICON UI"; -char* str54 = "MNU4 AUTO SAVE FAILED"; -char* str55 = "MNU4 SAVE COMPLETED"; -char* str56 = "{font=0}{i:MNU4 AUTO SAVE TXT}"; -char* str57 = "fx_boomball_smoke.RW3"; -char* str58 = "ui_savinggame"; -char* str59 = "ui_savinggame.RW3"; -char* str60 = "GAME OVER (%f secs)\n"; -char* str61 = "Loading... %3.2f\n"; -char* str62 = " "; -char* str63 = ". "; -char* str64 = ".. "; -char* str65 = "..."; -char* str66 = "loading screen bg"; -char* str67 = "eGameWhere_NA"; -char* str68 = "eGameWhere_InitStart"; -char* str69 = "eGameWhere_InitScene"; -char* str70 = "eGameWhere_InitCamera"; -char* str71 = "eGameWhere_InitMusic"; -char* str72 = "eGameWhere_InitOther"; -char* str73 = "eGameWhere_InitEnd"; -char* str74 = "eGameWhere_ExitStart"; -char* str75 = "eGameWhere_ExitRumble"; -char* str76 = "eGameWhere_ExitHUD"; -char* str77 = "eGameWhere_ExitSound"; -char* str78 = "eGameWhere_ExitCamera"; -char* str79 = "eGameWhere_ExitScene"; -char* str80 = "eGameWhere_ExitEnd"; -char* str81 = "eGameWhere_SetupScene"; -char* str82 = "eGameWhere_SetupZFX"; -char* str83 = "eGameWhere_SetupPlayer"; -char* str84 = "eGameWhere_SetupCamera"; -char* str85 = "eGameWhere_SetupScrFX"; -char* str86 = "eGameWhere_SetupSceneLoad"; -char* str87 = "eGameWhere_SetupMusicNotify"; -char* str88 = "eGameWhere_SetupHudSetup"; -char* str89 = "eGameWhere_SetupSkydome"; -char* str90 = "eGameWhere_SetupSceneEvents"; -char* str91 = "eGameWhere_SetupUpdateCull"; -char* str92 = "eGameWhere_SetupLOD"; -char* str93 = "eGameWhere_SetupExtras"; -char* str94 = "eGameWhere_SetupEnd"; -char* str95 = "eGameWhere_LoopStart"; -char* str96 = "eGameWhere_CutsceneFinish"; -char* str97 = "eGameWhere_LoopDo"; -char* str98 = "eGameWhere_LoopCalcTime"; -char* str99 = "eGameWhere_LoopPadUpdate"; -char* str100 = "eGameWhere_LoopTRCCheck"; -char* str101 = "eGameWhere_LoopCheats"; -char* str102 = "eGameWhere_LoopSceneUpdate"; -char* str103 = "eGameWhere_LoopPlayerUpdate"; -char* str104 = "eGameWhere_LoopSoundUpdate"; -char* str105 = "eGameWhere_LoopSFXWidgets"; -char* str106 = "eGameWhere_LoopHUDUpdate"; -char* str107 = "eGameWhere_LoopCameraUpdate"; -char* str108 = "eGameWhere_LoopCameraFXUpdate"; -char* str109 = "eGameWhere_LoopFlyToInterface"; -char* str110 = "eGameWhere_LoopCameraBegin"; -char* str111 = "eGameWhere_LoopSceneRender"; -char* str112 = "eGameWhere_LoopCameraEnd"; -char* str113 = "eGameWhere_LoopCameraShowRaster"; -char* str114 = "eGameWhere_LoopCameraFXEnd"; -char* str115 = "eGameWhere_LoopMusicUpdate"; -char* str116 = "eGameWhere_LoopUpdateMode"; -char* str117 = "eGameWhere_LoopContinue"; -char* str118 = "eGameWhere_LoopEndGameLoop"; -char* str119 = "eGameWhere_SaveLoop"; -char* str120 = "eGameWhere_ModeSceneSwitch"; -char* str121 = "eGameWhere_ModeCutsceneFinish"; -char* str122 = "eGameWhere_ModeGameExit"; -char* str123 = "eGameWhere_ModeGameInit"; -char* str124 = "eGameWhere_ModeGameSetup"; -char* str125 = "eGameWhere_ModeSwitchAutoSave"; -char* str126 = "eGameWhere_ModeSwitchCutsceneFinish"; -char* str127 = "eGameWhere_ModeStoreCheckpoint"; -char* str128 = "eGameWhere_LoseChanceReset"; -char* str129 = "eGameWhere_LoseChanceResetDone"; -char* str130 = "eGameWhere_TransitionBubbles"; -char* str131 = "eGameWhere_TransitionBegin"; -char* str132 = "eGameWhere_TransitionSnapShot"; -char* str133 = "eGameWhere_TransitionUpdate"; -char* str134 = "eGameWhere_TransitionPadUpdate"; -char* str135 = "eGameWhere_TransitionTRCCheck"; -char* str136 = "eGameWhere_TransitionCameraClear"; -char* str137 = "eGameWhere_TransitionCameraBegin"; -char* str138 = "eGameWhere_TransitionRenderBackground"; -char* str139 = "eGameWhere_TransitionSpawnBubbles"; -char* str140 = "eGameWhere_TransitionDrawEnd"; -char* str141 = "eGameWhere_TransitionUpdateBubbles"; -char* str142 = "eGameWhere_TransitionCameraEnd"; -char* str143 = "eGameWhere_TransitionCameraShowRaster"; -char* str144 = "eGameWhere_TransitionUpdateEnd"; -char* str145 = "eGameWhere_TransitionUIRender"; -char* str146 = "eGameWhere_TransitionUIRenderEnd"; -char* str147 = "eGameWhere_TransitionEnd"; -char* str148 = "eGameWhere_TransitionEnded"; -char* str149 = "eGameWhere_SetupPlayerInit"; -char* str150 = "eGameWhere_SetupPlayerCamera"; -char* str151 = "eGameWhere_SetupPlayerEnd"; +static char* str1 = "HB02"; +static char* str2 = "HB01"; +static char* str3 = "HB03"; +static char* str4 = "HB04"; +static char* str5 = "JF01"; +static char* str6 = "JF02"; +static char* str7 = "JF03"; +static char* str8 = "JF04"; +static char* str9 = "BB01"; +static char* str10 = "BB02"; +static char* str11 = "BB03"; +static char* str12 = "BB04"; +static char* str13 = "GL01"; +static char* str14 = "GL02"; +static char* str15 = "GL03"; +static char* str16 = "B101"; +static char* str17 = "HB05"; +static char* str18 = "HB06"; +static char* str19 = "HB09"; +static char* str20 = "BC01"; +static char* str21 = "BC02"; +static char* str22 = "BC03"; +static char* str23 = "BC04"; +static char* str24 = "BC05"; +static char* str25 = "RB01"; +static char* str26 = "RB02"; +static char* str27 = "RB03"; +static char* str28 = "SM01"; +static char* str29 = "SM02"; +static char* str30 = "SM03"; +static char* str31 = "SM04"; +static char* str32 = "B201"; +static char* str33 = "DB01"; +static char* str34 = "DB02"; +static char* str35 = "DB03"; +static char* str36 = "DB04"; +static char* str37 = "DB06"; +static char* str38 = "KF01"; +static char* str39 = "KF02"; +static char* str40 = "KF04"; +static char* str41 = "KF05"; +static char* str42 = "GY01"; +static char* str43 = "GY02"; +static char* str44 = "GY03"; +static char* str45 = "GY04"; +static char* str46 = "HB07"; +static char* str47 = "HB08"; +static char* str48 = "B302"; +static char* str49 = "B303"; +static char* str50 = "HB10"; +static char* str51 = "PG12"; +static char* str52 = "techbutton6_click"; +static char* str53 = "SAVING GAME ICON UI"; +static char* str54 = "MNU4 AUTO SAVE FAILED"; +static char* str55 = "MNU4 SAVE COMPLETED"; +static char* str56 = "{font=0}{i:MNU4 AUTO SAVE TXT}"; +static char* str57 = "fx_boomball_smoke.RW3"; +static char* str58 = "ui_savinggame"; +static char* str59 = "ui_savinggame.RW3"; +static char* str60 = "GAME OVER (%f secs)\n"; +static char* str61 = "Loading... %3.2f\n"; +static char* str62 = " "; +static char* str63 = ". "; +static char* str64 = ".. "; +static char* str65 = "..."; +static char* str66 = "loading screen bg"; +static char* str67 = "eGameWhere_NA"; +static char* str68 = "eGameWhere_InitStart"; +static char* str69 = "eGameWhere_InitScene"; +static char* str70 = "eGameWhere_InitCamera"; +static char* str71 = "eGameWhere_InitMusic"; +static char* str72 = "eGameWhere_InitOther"; +static char* str73 = "eGameWhere_InitEnd"; +static char* str74 = "eGameWhere_ExitStart"; +static char* str75 = "eGameWhere_ExitRumble"; +static char* str76 = "eGameWhere_ExitHUD"; +static char* str77 = "eGameWhere_ExitSound"; +static char* str78 = "eGameWhere_ExitCamera"; +static char* str79 = "eGameWhere_ExitScene"; +static char* str80 = "eGameWhere_ExitEnd"; +static char* str81 = "eGameWhere_SetupScene"; +static char* str82 = "eGameWhere_SetupZFX"; +static char* str83 = "eGameWhere_SetupPlayer"; +static char* str84 = "eGameWhere_SetupCamera"; +static char* str85 = "eGameWhere_SetupScrFX"; +static char* str86 = "eGameWhere_SetupSceneLoad"; +static char* str87 = "eGameWhere_SetupMusicNotify"; +static char* str88 = "eGameWhere_SetupHudSetup"; +static char* str89 = "eGameWhere_SetupSkydome"; +static char* str90 = "eGameWhere_SetupSceneEvents"; +static char* str91 = "eGameWhere_SetupUpdateCull"; +static char* str92 = "eGameWhere_SetupLOD"; +static char* str93 = "eGameWhere_SetupExtras"; +static char* str94 = "eGameWhere_SetupEnd"; +static char* str95 = "eGameWhere_LoopStart"; +static char* str96 = "eGameWhere_CutsceneFinish"; +static char* str97 = "eGameWhere_LoopDo"; +static char* str98 = "eGameWhere_LoopCalcTime"; +static char* str99 = "eGameWhere_LoopPadUpdate"; +static char* str100 = "eGameWhere_LoopTRCCheck"; +static char* str101 = "eGameWhere_LoopCheats"; +static char* str102 = "eGameWhere_LoopSceneUpdate"; +static char* str103 = "eGameWhere_LoopPlayerUpdate"; +static char* str104 = "eGameWhere_LoopSoundUpdate"; +static char* str105 = "eGameWhere_LoopSFXWidgets"; +static char* str106 = "eGameWhere_LoopHUDUpdate"; +static char* str107 = "eGameWhere_LoopCameraUpdate"; +static char* str108 = "eGameWhere_LoopCameraFXUpdate"; +static char* str109 = "eGameWhere_LoopFlyToInterface"; +static char* str110 = "eGameWhere_LoopCameraBegin"; +static char* str111 = "eGameWhere_LoopSceneRender"; +static char* str112 = "eGameWhere_LoopCameraEnd"; +static char* str113 = "eGameWhere_LoopCameraShowRaster"; +static char* str114 = "eGameWhere_LoopCameraFXEnd"; +static char* str115 = "eGameWhere_LoopMusicUpdate"; +static char* str116 = "eGameWhere_LoopUpdateMode"; +static char* str117 = "eGameWhere_LoopContinue"; +static char* str118 = "eGameWhere_LoopEndGameLoop"; +static char* str119 = "eGameWhere_SaveLoop"; +static char* str120 = "eGameWhere_ModeSceneSwitch"; +static char* str121 = "eGameWhere_ModeCutsceneFinish"; +static char* str122 = "eGameWhere_ModeGameExit"; +static char* str123 = "eGameWhere_ModeGameInit"; +static char* str124 = "eGameWhere_ModeGameSetup"; +static char* str125 = "eGameWhere_ModeSwitchAutoSave"; +static char* str126 = "eGameWhere_ModeSwitchCutsceneFinish"; +static char* str127 = "eGameWhere_ModeStoreCheckpoint"; +static char* str128 = "eGameWhere_LoseChanceReset"; +static char* str129 = "eGameWhere_LoseChanceResetDone"; +static char* str130 = "eGameWhere_TransitionBubbles"; +static char* str131 = "eGameWhere_TransitionBegin"; +static char* str132 = "eGameWhere_TransitionSnapShot"; +static char* str133 = "eGameWhere_TransitionUpdate"; +static char* str134 = "eGameWhere_TransitionPadUpdate"; +static char* str135 = "eGameWhere_TransitionTRCCheck"; +static char* str136 = "eGameWhere_TransitionCameraClear"; +static char* str137 = "eGameWhere_TransitionCameraBegin"; +static char* str138 = "eGameWhere_TransitionRenderBackground"; +static char* str139 = "eGameWhere_TransitionSpawnBubbles"; +static char* str140 = "eGameWhere_TransitionDrawEnd"; +static char* str141 = "eGameWhere_TransitionUpdateBubbles"; +static char* str142 = "eGameWhere_TransitionCameraEnd"; +static char* str143 = "eGameWhere_TransitionCameraShowRaster"; +static char* str144 = "eGameWhere_TransitionUpdateEnd"; +static char* str145 = "eGameWhere_TransitionUIRender"; +static char* str146 = "eGameWhere_TransitionUIRenderEnd"; +static char* str147 = "eGameWhere_TransitionEnd"; +static char* str148 = "eGameWhere_TransitionEnded"; +static char* str149 = "eGameWhere_SetupPlayerInit"; +static char* str150 = "eGameWhere_SetupPlayerCamera"; +static char* str151 = "eGameWhere_SetupPlayerEnd"; // Scheduling, I guess void zGameInit(U32 theSceneID) diff --git a/src/SB/Game/zLight.cpp b/src/SB/Game/zLight.cpp index 7ab272b7f..c01f44123 100644 --- a/src/SB/Game/zLight.cpp +++ b/src/SB/Game/zLight.cpp @@ -10,17 +10,16 @@ #include #include -extern _zLight* sLight[32]; -extern S32 sLightTotal; -extern _tagPartition sLightPart; -extern zVolume* sPartitionVolume; +static _zLight* sLight[32]; +S32 sLightTotal; +static _tagPartition sLightPart; +zVolume* sPartitionVolume; extern char zLight_strings[]; -extern S32 gNumTemporaryLights; -extern _zLight* gTemporaryLights[32]; -extern F32 zLight_float; -extern xVec3 sDefaultShadowVec; -extern void (*sEffectFuncs[18])(_zLight*, F32); -extern lightInitFunc sEffectInitFuncs[18]; +S32 gNumTemporaryLights; +static _zLight* gTemporaryLights[32]; +void (*sEffectFuncs[18])(_zLight*, F32) = {}; +lightInitFunc sEffectInitFuncs[18] = {}; +static xVec3 sDefaultShadowVec = { 0, 1.0f, 0 }; void zLightEffectSet(_zLight* zlight, S32 idx) { @@ -213,7 +212,7 @@ void zLightUpdate(xBase* to, xScene* param_2, F32 dt) if (t->flags & 1 && t->attached_to) { xVec3 pos = *xEntGetPos((xEnt*)t->attached_to); - pos.y += zLight_float; + pos.y += 1.0f; iLightSetPos(&t->light, &pos); t->light.sph.center = pos; t->true_idx = xPartitionUpdate(&sLightPart, t, t->true_idx, &pos); @@ -249,7 +248,7 @@ void zLightAddLocalEnv() void zLightAddLocal(xEnt* ent) { xVec3 default_light_pos = *xEntGetPos(ent); - default_light_pos.y += zLight_float; + default_light_pos.y += 1.0f; if (!ent->entShadow) { ent->entShadow = (xEntShadow*)xMemAlloc(gActiveHeap, 40, 0); @@ -257,7 +256,7 @@ void zLightAddLocal(xEnt* ent) ent->entShadow->pos = default_light_pos; ent->entShadow->vec = sDefaultShadowVec; } - xShadowSetLight(&ent->entShadow->pos, &ent->entShadow->vec, zLight_float); + xShadowSetLight(&ent->entShadow->pos, &ent->entShadow->vec, 1.0f); } void zLightRemoveLocalEnv() diff --git a/src/SB/Game/zLightning.cpp b/src/SB/Game/zLightning.cpp index 0483fb21d..d749b8b88 100644 --- a/src/SB/Game/zLightning.cpp +++ b/src/SB/Game/zLightning.cpp @@ -14,60 +14,60 @@ extern xVec3 sTweakEnd; // Taken from zLightning.s // Defining these here makes the stringBase0 offsets match in the later functions. -char* str1 = "Line"; -char* str2 = "Rotating"; -char* str3 = "Zeus"; -char* str4 = "Func"; -char* str5 = "Lightning|\x01Type Info"; -char* str6 = "Lightning|\x01Type Info|Setup Degrees"; -char* str7 = "Lightning|\x01Type Info|Move Degrees"; -char* str8 = "Lightning|\x01Type Info|Normal Offset"; -char* str9 = "Lightning|\x01Type Info|Back Offset"; -char* str10 = "Lightning|\x01Type Info|Side Offset"; -char* str11 = "PAREMIT_EG_SPARK"; -char* str12 = "LIGHTNING"; -char* str13 = "Lightning|\x01\x01Go"; -char* str14 = "Start Lightning"; -char* str15 = "Lightning|\x01Globals|\x01\x01JerkFrequency"; -char* str16 = "Lightning|\x01Globals|\x01\x02ShiftSpeed"; -char* str17 = "Lightning|\x01Globals|\x01\x03MinPStep"; -char* str18 = "Lightning|\x01Globals|\x01\x03MaxPStep"; -char* str19 = "Lightning|\x01Globals|\x02\x01MinScale"; -char* str20 = "Lightning|\x01Globals|\x02\x01MaxScale"; -char* str21 = "Lightning|\x01Globals|\x02\x01ScalePerLength"; -char* str22 = "Lightning|\x01Globals|\x02\x02MinSpan"; -char* str23 = "Lightning|\x01Globals|\x02\x02SpanPerLength"; -char* str24 = "Lightning|\x01Globals|\x02\x03SlopeRange"; -char* str25 = "Lightning|\x01Globals|\x02\x03UVSpeed"; -char* str26 = "Lightning|\x01Time"; -char* str27 = "Lightning|\x01Total Points"; -char* str28 = "Lightning|\x01Type"; -char* str29 = "Lightning|\x02Flag|Rot Scalar"; -char* str30 = "Lightning|\x02Flag|No Fade Out"; -char* str31 = "Lightning|\x02Flag|Arc"; -char* str32 = "Lightning|\x02Flag|Vertical Orientation"; -char* str33 = "Lightning|\x02Flag|Taper Thickness At End"; -char* str34 = "Lightning|\x02Flag|Taper Thickness At Start"; -char* str35 = "Lightning|\x02Start|x"; -char* str36 = "Lightning|\x02Start|y"; -char* str37 = "Lightning|\x02Start|z"; -char* str38 = "Lightning|\x03End|x"; -char* str39 = "Lightning|\x03End|y"; -char* str40 = "Lightning|\x03End|z"; -char* str41 = "Lightning|\x04Color|\x01R"; -char* str42 = "Lightning|\x04Color|\x02G"; -char* str43 = "Lightning|\x04Color|\x03B"; -char* str44 = "Lightning|\x04Color|\x04A"; -char* str45 = "Lightning|Lengths|Rot Radius"; -char* str46 = "Lightning|Lengths|Arc Height"; -char* str47 = "Lightning|Lengths|Thickness"; -char* str48 = "Lightning|Randomness|Rand Radius"; -char* str49 = "X to test lightning\n"; -char* str50 = " "; -char* str51 = "1"; -char* str52 = "0"; -char* str53 = "-"; -char* str54 = "\n"; +static char* str1 = "Line"; +static char* str2 = "Rotating"; +static char* str3 = "Zeus"; +static char* str4 = "Func"; +static char* str5 = "Lightning|\x01Type Info"; +static char* str6 = "Lightning|\x01Type Info|Setup Degrees"; +static char* str7 = "Lightning|\x01Type Info|Move Degrees"; +static char* str8 = "Lightning|\x01Type Info|Normal Offset"; +static char* str9 = "Lightning|\x01Type Info|Back Offset"; +static char* str10 = "Lightning|\x01Type Info|Side Offset"; +static char* str11 = "PAREMIT_EG_SPARK"; +static char* str12 = "LIGHTNING"; +static char* str13 = "Lightning|\x01\x01Go"; +static char* str14 = "Start Lightning"; +static char* str15 = "Lightning|\x01Globals|\x01\x01JerkFrequency"; +static char* str16 = "Lightning|\x01Globals|\x01\x02ShiftSpeed"; +static char* str17 = "Lightning|\x01Globals|\x01\x03MinPStep"; +static char* str18 = "Lightning|\x01Globals|\x01\x03MaxPStep"; +static char* str19 = "Lightning|\x01Globals|\x02\x01MinScale"; +static char* str20 = "Lightning|\x01Globals|\x02\x01MaxScale"; +static char* str21 = "Lightning|\x01Globals|\x02\x01ScalePerLength"; +static char* str22 = "Lightning|\x01Globals|\x02\x02MinSpan"; +static char* str23 = "Lightning|\x01Globals|\x02\x02SpanPerLength"; +static char* str24 = "Lightning|\x01Globals|\x02\x03SlopeRange"; +static char* str25 = "Lightning|\x01Globals|\x02\x03UVSpeed"; +static char* str26 = "Lightning|\x01Time"; +static char* str27 = "Lightning|\x01Total Points"; +static char* str28 = "Lightning|\x01Type"; +static char* str29 = "Lightning|\x02Flag|Rot Scalar"; +static char* str30 = "Lightning|\x02Flag|No Fade Out"; +static char* str31 = "Lightning|\x02Flag|Arc"; +static char* str32 = "Lightning|\x02Flag|Vertical Orientation"; +static char* str33 = "Lightning|\x02Flag|Taper Thickness At End"; +static char* str34 = "Lightning|\x02Flag|Taper Thickness At Start"; +static char* str35 = "Lightning|\x02Start|x"; +static char* str36 = "Lightning|\x02Start|y"; +static char* str37 = "Lightning|\x02Start|z"; +static char* str38 = "Lightning|\x03End|x"; +static char* str39 = "Lightning|\x03End|y"; +static char* str40 = "Lightning|\x03End|z"; +static char* str41 = "Lightning|\x04Color|\x01R"; +static char* str42 = "Lightning|\x04Color|\x02G"; +static char* str43 = "Lightning|\x04Color|\x03B"; +static char* str44 = "Lightning|\x04Color|\x04A"; +static char* str45 = "Lightning|Lengths|Rot Radius"; +static char* str46 = "Lightning|Lengths|Arc Height"; +static char* str47 = "Lightning|Lengths|Thickness"; +static char* str48 = "Lightning|Randomness|Rand Radius"; +static char* str49 = "X to test lightning\n"; +static char* str50 = " "; +static char* str51 = "1"; +static char* str52 = "0"; +static char* str53 = "-"; +static char* str54 = "\n"; void xDebugAddTweak(const char*, F32*, F32, F32, const tweak_callback*, void*, U32) { diff --git a/src/SB/Game/zMain.cpp b/src/SB/Game/zMain.cpp index 882c0a69e..cfd9a98d0 100644 --- a/src/SB/Game/zMain.cpp +++ b/src/SB/Game/zMain.cpp @@ -25,6 +25,9 @@ #include "zCutsceneMgr.h" #include "zEntPlayerBungeeState.h" +zGlobals globals; +xGlobals* xglobals; + S32 percentageDone; _tagxPad* gDebugPad; S32 sShowMenuOnBoot; @@ -585,6 +588,7 @@ void zMainMemLvlChkCB() void zLedgeAdjust(zLedgeGrabParams* params) { + params->animGrab *= (1.0f/30); params->animGrab *= (1.0f / 30); } diff --git a/src/SB/Game/zMenu.cpp b/src/SB/Game/zMenu.cpp index b54b0162d..13983de96 100644 --- a/src/SB/Game/zMenu.cpp +++ b/src/SB/Game/zMenu.cpp @@ -29,6 +29,8 @@ #include "zMusic.h" #include "zSaveLoad.h" +bool menu_fmv_played; + static S32 sFirstBoot = 1; // TODO: This probably wasn't volatile in the original code, but we have 100% diff --git a/src/SB/Game/zMenu.h b/src/SB/Game/zMenu.h index fd444b7a7..94efeea52 100644 --- a/src/SB/Game/zMenu.h +++ b/src/SB/Game/zMenu.h @@ -3,8 +3,6 @@ #include -bool menu_fmv_played; - U32 zMenuUpdateMode(); U32 zMenuIsPaused(); S32 zMenuLoopContinue(); diff --git a/src/SB/Game/zNPCTypeAmbient.cpp b/src/SB/Game/zNPCTypeAmbient.cpp index dc822a446..4ca50eabe 100644 --- a/src/SB/Game/zNPCTypeAmbient.cpp +++ b/src/SB/Game/zNPCTypeAmbient.cpp @@ -26,21 +26,21 @@ extern F32 _883; // Taken from zNPCTypeAmbient.s. // Defining these here makes the stringBase0 offsets match in the later functions. -char* str1 = "Unknown"; -char* str2 = "Idle01"; -char* str3 = "Idle02"; -char* str4 = "Idle03"; -char* str5 = "Fidget01"; -char* str6 = "Fidget02"; -char* str7 = "Fidget03"; -char* str8 = "Move01"; -char* str9 = "Bumped01"; -char* str10 = "Dance01"; -char* str11 = "Pray01"; -char* str12 = "Attack01"; -char* str13 = "zNPCAmbient"; -char* str14 = "zNPCJelly"; -char* str15 = "zNPCNeptune"; +static char* str1 = "Unknown"; +static char* str2 = "Idle01"; +static char* str3 = "Idle02"; +static char* str4 = "Idle03"; +static char* str5 = "Fidget01"; +static char* str6 = "Fidget02"; +static char* str7 = "Fidget03"; +static char* str8 = "Move01"; +static char* str9 = "Bumped01"; +static char* str10 = "Dance01"; +static char* str11 = "Pray01"; +static char* str12 = "Attack01"; +static char* str13 = "zNPCAmbient"; +static char* str14 = "zNPCJelly"; +static char* str15 = "zNPCNeptune"; void ZNPC_Ambient_Startup() { diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index 780574740..2ad1285e7 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -30,7 +30,7 @@ namespace #define ANIM_Attack02End01 18 //0x48 #define ANIM_LassoGrab01 19 //0x4c -U32 dutchman_count; +static U32 dutchman_count; //13 new states //8 new transitions diff --git a/src/SB/Game/zNPCTypeTiki.cpp b/src/SB/Game/zNPCTypeTiki.cpp index 074cc64e9..c8c4021d0 100644 --- a/src/SB/Game/zNPCTypeTiki.cpp +++ b/src/SB/Game/zNPCTypeTiki.cpp @@ -25,14 +25,14 @@ static zNPCTiki* orphanList; // Taken from zNPCTypeTiki.s // Defining these here makes the stringBase0 offsets match in the later functions. -char* str1 = "Unknown"; -char* str2 = "Idle01"; -char* str3 = "PAREMIT_THUNDER_CLOUD"; -char* str4 = "PAREMIT_CLOUD"; -char* str5 = "target"; -char* str6 = "zNPCTiki"; -char* str7 = "what the ...\n"; -char* str8 = "Idle"; +static char* str1 = "Unknown"; +static char* str2 = "Idle01"; +static char* str3 = "PAREMIT_THUNDER_CLOUD"; +static char* str4 = "PAREMIT_CLOUD"; +static char* str5 = "target"; +static char* str6 = "zNPCTiki"; +static char* str7 = "what the ...\n"; +static char* str8 = "Idle"; void ZNPC_Tiki_Startup() { diff --git a/src/SB/Game/zNPCTypeVillager.cpp b/src/SB/Game/zNPCTypeVillager.cpp index 16104d65b..00ba67893 100644 --- a/src/SB/Game/zNPCTypeVillager.cpp +++ b/src/SB/Game/zNPCTypeVillager.cpp @@ -25,121 +25,121 @@ extern const xVec3 g_O3; // Taken from zNPCTypeVillager.s // Defining these here makes the stringBase0 offsets match in the later functions. -char* str1 = "Unknown"; -char* str2 = "Idle01"; -char* str3 = "Move01"; -char* str4 = "Hurt01"; -char* str5 = "Yawn01"; -char* str6 = "Talk01"; -char* str7 = "Flee01"; -char* str8 = "Fear01"; -char* str9 = "Pray01"; -char* str10 = "Clap01"; -char* str11 = "Special01"; -char* str12 = "Ride01"; -char* str13 = "Bump01"; -char* str14 = "Fall01"; -char* str15 = "Land01"; -char* str16 = "Weep01"; -char* str17 = "Swim01"; -char* str18 = "Idle02"; -char* str19 = "Idle03"; -char* str20 = "Idle04"; -char* str21 = "Yawn02"; -char* str22 = "Yawn03"; -char* str23 = "Yawn04"; -char* str24 = "Talk02"; -char* str25 = "Talk03"; -char* str26 = "Talk04"; -char* str27 = "fish_d_balloon_move"; -char* str28 = "fish_d_balloon_hit"; -char* str29 = "zNPCVillager"; -char* str30 = "zNPCBallonBoy"; -char* str31 = "zNPCSuperFriend"; -char* str32 = "NonRandomTalkAnims"; -char* str33 = "FAB1001"; -char* str34 = "FAB1002"; -char* str35 = "FAB1003"; -char* str36 = "FAB1004"; -char* str37 = "FAB1011"; -char* str38 = "FAB1017"; -char* str39 = "FAB1018"; -char* str40 = "FAB1019"; -char* str41 = "FAB1020"; -char* str42 = "FAB1021"; -char* str43 = "FAB1022"; -char* str44 = "FAB1023"; -char* str45 = "FAB1025"; -char* str46 = "FAB1029"; -char* str47 = "FAB1030"; -char* str48 = "FAB1032"; -char* str49 = "FAB1033"; -char* str50 = "FAB1034"; -char* str51 = "FAB1035"; -char* str52 = "FAB1038"; -char* str53 = "FAB1046"; -char* str54 = "FAB1047"; -char* str55 = "FAB1049"; -char* str56 = "FAB1073"; -char* str57 = "FAB1074"; -char* str58 = "FAB1076"; -char* str59 = "FAB1077"; -char* str60 = "FAB1078"; -char* str61 = "FAB1079"; -char* str62 = "FAB1080"; -char* str63 = "FAB1006"; -char* str64 = "FAB1012"; -char* str65 = "FAB1016"; -char* str66 = "FAB1024"; -char* str67 = "FAB1026"; -char* str68 = "FAB1065"; -char* str69 = "FAB1039_a"; -char* str70 = "FAB1039_b"; -char* str71 = "FAB1039_c"; -char* str72 = "FAB1055"; -char* str73 = "FAB1040"; -char* str74 = "FAB1053"; -char* str75 = "FAB1081_a"; -char* str76 = "FAB1081_b"; -char* str77 = "FAB1042"; -char* str78 = "FAB1045"; -char* str79 = "FAB1056"; -char* str80 = "FAB1064"; -char* str81 = "FAB1050"; -char* str82 = "FAB1007"; -char* str83 = "FAB1007_b"; -char* str84 = "FAB1031"; -char* str85 = "FAB1082_a"; -char* str86 = "FAB1082_b"; -char* str87 = "FAB1010"; -char* str88 = "FAB1027"; -char* str89 = "FAB1037"; -char* str90 = "FAB1052"; -char* str91 = "FAB1067"; -char* str92 = "FAB1014"; -char* str93 = "FAB1008"; -char* str94 = "FAB1036"; -char* str95 = "FAB1041_a"; -char* str96 = "FAB1041_b"; -char* str97 = "FAB1054"; -char* str98 = "FAB1013"; -char* str99 = "FAB1009"; -char* str100 = "FAB1028"; -char* str101 = "FAB1051"; -char* str102 = "FAB1072"; -char* str103 = "FAB1083"; -char* str104 = "NPC|zNPCNewsFish|screen|on screen|x"; -char* str105 = "NPC|zNPCNewsFish|screen|on screen|y"; -char* str106 = "NPC|zNPCNewsFish|screen|off screen|x"; -char* str107 = "NPC|zNPCNewsFish|screen|off screen|y"; -char* str108 = "NPC|zNPCNewsFish|screen|size"; -char* str109 = "NPC|zNPCNewsFish|screen|rotation"; -char* str110 = "NPC|zNPCNewsFish|screen|appearSpeed"; -char* str111 = "NPC|zNPCNewsFish|screen|disappearSpeed"; -char* str112 = "shadow_balloons"; -char* str113 = "gloss_edge"; -char* str114 = "rainbowfilm_smooth32"; -char* str115 = "PAREMIT_FOLK_SANDYB_LEAK"; +static char* str1 = "Unknown"; +static char* str2 = "Idle01"; +static char* str3 = "Move01"; +static char* str4 = "Hurt01"; +static char* str5 = "Yawn01"; +static char* str6 = "Talk01"; +static char* str7 = "Flee01"; +static char* str8 = "Fear01"; +static char* str9 = "Pray01"; +static char* str10 = "Clap01"; +static char* str11 = "Special01"; +static char* str12 = "Ride01"; +static char* str13 = "Bump01"; +static char* str14 = "Fall01"; +static char* str15 = "Land01"; +static char* str16 = "Weep01"; +static char* str17 = "Swim01"; +static char* str18 = "Idle02"; +static char* str19 = "Idle03"; +static char* str20 = "Idle04"; +static char* str21 = "Yawn02"; +static char* str22 = "Yawn03"; +static char* str23 = "Yawn04"; +static char* str24 = "Talk02"; +static char* str25 = "Talk03"; +static char* str26 = "Talk04"; +static char* str27 = "fish_d_balloon_move"; +static char* str28 = "fish_d_balloon_hit"; +static char* str29 = "zNPCVillager"; +static char* str30 = "zNPCBallonBoy"; +static char* str31 = "zNPCSuperFriend"; +static char* str32 = "NonRandomTalkAnims"; +static char* str33 = "FAB1001"; +static char* str34 = "FAB1002"; +static char* str35 = "FAB1003"; +static char* str36 = "FAB1004"; +static char* str37 = "FAB1011"; +static char* str38 = "FAB1017"; +static char* str39 = "FAB1018"; +static char* str40 = "FAB1019"; +static char* str41 = "FAB1020"; +static char* str42 = "FAB1021"; +static char* str43 = "FAB1022"; +static char* str44 = "FAB1023"; +static char* str45 = "FAB1025"; +static char* str46 = "FAB1029"; +static char* str47 = "FAB1030"; +static char* str48 = "FAB1032"; +static char* str49 = "FAB1033"; +static char* str50 = "FAB1034"; +static char* str51 = "FAB1035"; +static char* str52 = "FAB1038"; +static char* str53 = "FAB1046"; +static char* str54 = "FAB1047"; +static char* str55 = "FAB1049"; +static char* str56 = "FAB1073"; +static char* str57 = "FAB1074"; +static char* str58 = "FAB1076"; +static char* str59 = "FAB1077"; +static char* str60 = "FAB1078"; +static char* str61 = "FAB1079"; +static char* str62 = "FAB1080"; +static char* str63 = "FAB1006"; +static char* str64 = "FAB1012"; +static char* str65 = "FAB1016"; +static char* str66 = "FAB1024"; +static char* str67 = "FAB1026"; +static char* str68 = "FAB1065"; +static char* str69 = "FAB1039_a"; +static char* str70 = "FAB1039_b"; +static char* str71 = "FAB1039_c"; +static char* str72 = "FAB1055"; +static char* str73 = "FAB1040"; +static char* str74 = "FAB1053"; +static char* str75 = "FAB1081_a"; +static char* str76 = "FAB1081_b"; +static char* str77 = "FAB1042"; +static char* str78 = "FAB1045"; +static char* str79 = "FAB1056"; +static char* str80 = "FAB1064"; +static char* str81 = "FAB1050"; +static char* str82 = "FAB1007"; +static char* str83 = "FAB1007_b"; +static char* str84 = "FAB1031"; +static char* str85 = "FAB1082_a"; +static char* str86 = "FAB1082_b"; +static char* str87 = "FAB1010"; +static char* str88 = "FAB1027"; +static char* str89 = "FAB1037"; +static char* str90 = "FAB1052"; +static char* str91 = "FAB1067"; +static char* str92 = "FAB1014"; +static char* str93 = "FAB1008"; +static char* str94 = "FAB1036"; +static char* str95 = "FAB1041_a"; +static char* str96 = "FAB1041_b"; +static char* str97 = "FAB1054"; +static char* str98 = "FAB1013"; +static char* str99 = "FAB1009"; +static char* str100 = "FAB1028"; +static char* str101 = "FAB1051"; +static char* str102 = "FAB1072"; +static char* str103 = "FAB1083"; +static char* str104 = "NPC|zNPCNewsFish|screen|on screen|x"; +static char* str105 = "NPC|zNPCNewsFish|screen|on screen|y"; +static char* str106 = "NPC|zNPCNewsFish|screen|off screen|x"; +static char* str107 = "NPC|zNPCNewsFish|screen|off screen|y"; +static char* str108 = "NPC|zNPCNewsFish|screen|size"; +static char* str109 = "NPC|zNPCNewsFish|screen|rotation"; +static char* str110 = "NPC|zNPCNewsFish|screen|appearSpeed"; +static char* str111 = "NPC|zNPCNewsFish|screen|disappearSpeed"; +static char* str112 = "shadow_balloons"; +static char* str113 = "gloss_edge"; +static char* str114 = "rainbowfilm_smooth32"; +static char* str115 = "PAREMIT_FOLK_SANDYB_LEAK"; void ZNPC_Villager_Startup() { diff --git a/src/SB/Game/zScene.cpp b/src/SB/Game/zScene.cpp index 5a9b78947..1aa7485af 100644 --- a/src/SB/Game/zScene.cpp +++ b/src/SB/Game/zScene.cpp @@ -214,24 +214,12 @@ static zSceneObjectInstanceDesc sInitTable[] = }; // clang-format on -extern U32 _1251; extern char byte_803D0884; -extern U32 _2014; extern U32 _1250; -extern F32 _1373; -extern F32 _1374; -extern F32 _1375; -extern F32 _1493; -extern F32 _1494; -extern F32 _1495; -extern F32 _1496_0; +extern U32 _1251; extern U32 _2013; -extern F32 _2094; -extern F32 _2095_0; -extern F32 _2096_0; -extern F32 _2097_0; -extern F32 _2242; +extern U32 _2014; static void zSceneObjHashtableInit(S32 count); static void zSceneObjHashtableExit(); @@ -876,7 +864,7 @@ void zSceneInit(U32 theSceneID, S32 reloadInProgress) zGameScreenTransitionBegin(); zParPTankInit(); - pdone = _1373; + pdone = 2.0f; if (globals.useHIPHOP && !reloadInProgress) { @@ -895,10 +883,10 @@ void zSceneInit(U32 theSceneID, S32 reloadInProgress) rgba_bkgrd[2] = 0; rgba_bkgrd[3] = 0; - pdone += _1373; + pdone += 2.0f; zGameScreenTransitionUpdate(pdone, "... scene loading ...\n", rgba_bkgrd); - } while (xSTLoadStep(theSceneID) < _1374); + } while (xSTLoadStep(theSceneID) < 1.0f); xSTDisconnect(theSceneID, 0x2); } @@ -932,7 +920,7 @@ void zSceneInit(U32 theSceneID, S32 reloadInProgress) xUtil_idtag2string(theSceneID, 0); iTimeDiffSec(time); - pdone += _1373; + pdone += 2.0f; zGameScreenTransitionUpdate(pdone, "... scene asset queue ...\n"); @@ -947,10 +935,10 @@ void zSceneInit(U32 theSceneID, S32 reloadInProgress) rgba_bkgrd[2] = 0; rgba_bkgrd[3] = 0; - pdone += _1373; + pdone += 2.0f; zGameScreenTransitionUpdate(pdone, "... scene loading ...\n", rgba_bkgrd); - } while (xSTLoadStep(theSceneID) < _1374); + } while (xSTLoadStep(theSceneID) < 1.0f); xSTDisconnect(theSceneID, 0x1); @@ -958,7 +946,7 @@ void zSceneInit(U32 theSceneID, S32 reloadInProgress) xUtil_idtag2string(theSceneID, 0); iTimeDiffSec(time); - pdone += _1373; + pdone += 2.0f; zGameScreenTransitionUpdate(pdone, "...initializing scene - sound\n"); @@ -1019,7 +1007,7 @@ void zSceneInit(U32 theSceneID, S32 reloadInProgress) zAnimListInit(); zGooInit(24); - zGameScreenTransitionUpdate(_1375, "...initializing scene - base types\n"); + zGameScreenTransitionUpdate(100.0f, "...initializing scene - base types\n"); for (i = 0; i < eBaseTypeCount; i++) { @@ -1315,7 +1303,7 @@ void zSceneSwitch(_zPortal* p, S32 forceSameScene) globals.player.cp.initCamID = PlayerMarkerStartCamID; } - if (PlayerStartAngle >= _1493) + if (PlayerStartAngle >= 1000.0f) { xMarkerAsset* marker = (xMarkerAsset*)xSTFindAsset(PlayerMarkerStartID, NULL); @@ -1346,10 +1334,10 @@ void zSceneSwitch(_zPortal* p, S32 forceSameScene) xEntFrame* frame = globals.player.ent.frame; - frame->rot.angle = _1494 * PlayerStartAngle / _1495; - frame->rot.axis = xVec3::create(_1496_0, _1374, _1496_0); + frame->rot.angle = 3.1415927f * PlayerStartAngle / 180.0f; + frame->rot.axis = xVec3::create(0.0f, 1.0f, 0.0f); - xMat3x3Euler(&frame->mat, frame->rot.angle, _1496_0, _1496_0); + xMat3x3Euler(&frame->mat, frame->rot.angle, 0.0f, 0.0f); *(xMat3x3*)globals.player.ent.model->Mat = frame->mat; @@ -2089,8 +2077,8 @@ void zSceneSetup() xSceneSetup(s); gUIMgr.Setup(s); - s->gravity = _2094; - s->drag = _2095_0; + s->gravity = -50.0f; + s->drag = 0.079999998f; s->flags = 0x5; zNPCMgr_scenePostInit(); @@ -2633,10 +2621,10 @@ void zSceneSetup() globals.updateMgr->deactivateCB = (xUpdateCullDeactivateCallback)DeactivateCB; FloatAndVoid defaultDist; - defaultDist.f = _2096_0; + defaultDist.f = 4900.0f; FloatAndVoid lodDist; - lodDist.f = _1496_0; + lodDist.f = 0.0f; for (i = 0; i < entCount; i++) { @@ -2644,13 +2632,13 @@ void zSceneSetup() if (lod) { - if (lod->noRenderDist == _1496_0) + if (lod->noRenderDist == 0.0f) { lod = NULL; } else { - lodDist.f = SQR(_2097_0 + xsqrt(lod->noRenderDist)); + lodDist.f = SQR(10.0f + xsqrt(lod->noRenderDist)); } } @@ -2686,7 +2674,7 @@ void zSceneSetup() iColor_tag clear; *(U32*)&clear = _2014; - xScrFxFade(&black, &clear, _1374, NULL, 0); + xScrFxFade(&black, &clear, 1.0f, NULL, 0); } S32 zSceneSetup_serialTraverseCB(U32 clientID, xSerial* xser) @@ -2725,7 +2713,7 @@ void zSceneUpdate(F32 dt) zScene* s; xBase** b; - if (_1496_0 == dt) + if (0.0f == dt) { return; } @@ -2779,8 +2767,8 @@ void zSceneUpdate(F32 dt) gUIMgr.Update(s, dt); - if (xVec3Dist(&sOldPosPlayer, (xVec3*)&globals.player.ent.model->Mat->pos) > _2242 || - xVec3Dist(&sOldPosCamera, &globals.camera.mat.pos) > _2242) + if (xVec3Dist(&sOldPosPlayer, (xVec3*)&globals.player.ent.model->Mat->pos) > 5.0f || + xVec3Dist(&sOldPosCamera, &globals.camera.mat.pos) > 5.0f) { sSuddenMove = 1; }