Skip to content

Commit b014145

Browse files
authored
Completed and Linked xUpdateCull, and xPtankPool (#677)
* Completed and Linked xUpdateCull, and xPtankPool * Review Fixes
1 parent f44886d commit b014145

File tree

7 files changed

+434
-84
lines changed

7 files changed

+434
-84
lines changed

configure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ def MatchingFor(*versions):
602602
Object(NonMatching, "SB/Game/zNPCGoalVillager.cpp", extra_cflags=["-sym on"]),
603603
Object(Matching, "SB/Game/zNPCGoalSubBoss.cpp", extra_cflags=["-sym on"]),
604604
Object(NonMatching, "SB/Core/x/xShadowSimple.cpp"),
605-
Object(NonMatching, "SB/Core/x/xUpdateCull.cpp"),
605+
Object(Matching, "SB/Core/x/xUpdateCull.cpp"),
606606
Object(NonMatching, "SB/Game/zDiscoFloor.cpp"),
607607
Object(NonMatching, "SB/Game/zNPCTypeBossSandy.cpp"),
608608
Object(NonMatching, "SB/Game/zNPCTypeKingJelly.cpp"),
@@ -621,7 +621,7 @@ def MatchingFor(*versions):
621621
Object(NonMatching, "SB/Core/x/xDecal.cpp", extra_cflags=["-sym on"]),
622622
Object(NonMatching, "SB/Core/x/xLaserBolt.cpp", extra_cflags=["-sym on"]),
623623
Object(NonMatching, "SB/Game/zCameraTweak.cpp"),
624-
Object(NonMatching, "SB/Core/x/xPtankPool.cpp"),
624+
Object(Matching, "SB/Core/x/xPtankPool.cpp"),
625625
Object(Equivalent, "SB/Core/gc/iTRC.cpp"),
626626
Object(NonMatching, "SB/Game/zNPCSupplement.cpp"),
627627
Object(NonMatching, "SB/Game/zNPCGlyph.cpp", extra_cflags=["-sym on"]),

include/rwsdk/rwplcore.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ struct RwStringFunctions
485485
};
486486

487487
#define RwMalloc(_s) ((RWSRCGLOBAL(memoryFuncs).rwmalloc)((_s)))
488+
#define RwMallocL(_s, _h, _l) ((RWSRCGLOBAL(memoryFuncs).rwmalloc)((_s), (_h)))
488489
#define RwFree(_p) ((RWSRCGLOBAL(memoryFuncs).rwfree)((_p)))
489490
#define RwCalloc(_n, _s) ((RWSRCGLOBAL(memoryFuncs).rwcalloc)((_n), (_s)))
490491
#define RwRealloc(_p, _s) ((RWSRCGLOBAL(memoryFuncs).rwrealloc)((_p), (_s)))
@@ -796,22 +797,22 @@ struct rwGameCube2DVertex
796797
RwReal u;
797798
RwReal v;
798799

799-
rwGameCube2DVertex& operator=(const rwGameCube2DVertex& rhs)
800-
{
801-
this->x = rhs.x;
802-
this->y = rhs.y;
803-
this->z = rhs.z;
800+
rwGameCube2DVertex& operator=(const rwGameCube2DVertex& rhs)
801+
{
802+
this->x = rhs.x;
803+
this->y = rhs.y;
804+
this->z = rhs.z;
804805

805-
this->emissiveColor.red = rhs.emissiveColor.red;
806-
this->emissiveColor.green = rhs.emissiveColor.green;
807-
this->emissiveColor.blue = rhs.emissiveColor.blue;
808-
this->emissiveColor.alpha = rhs.emissiveColor.alpha;
806+
this->emissiveColor.red = rhs.emissiveColor.red;
807+
this->emissiveColor.green = rhs.emissiveColor.green;
808+
this->emissiveColor.blue = rhs.emissiveColor.blue;
809+
this->emissiveColor.alpha = rhs.emissiveColor.alpha;
809810

810-
this->u = rhs.u;
811-
this->v = rhs.v;
811+
this->u = rhs.u;
812+
this->v = rhs.v;
812813

813-
return *this;
814-
}
814+
return *this;
815+
}
815816
};
816817

817818
typedef rwGameCube2DVertex RwIm2DVertex;

src/SB/Core/x/xPtankPool.cpp

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -152,22 +152,14 @@ namespace
152152
}
153153

154154
const F32 f1 = 1.0f;
155-
frame->modelling.at.z = f1;
156-
frame->modelling.up.y = f1;
157-
frame->modelling.right.x = f1;
155+
frame->modelling.right.x = frame->modelling.up.y = frame->modelling.at.z = f1;
158156

159157
const F32 f0 = 0.0f;
160-
frame->modelling.up.x = f0;
161-
frame->modelling.right.z = f0;
162-
frame->modelling.right.y = f0;
158+
frame->modelling.right.y = frame->modelling.right.z = frame->modelling.up.x = f0;
163159

164-
frame->modelling.at.y = f0;
165-
frame->modelling.at.x = f0;
166-
frame->modelling.up.z = f0;
160+
frame->modelling.up.z = frame->modelling.at.x = frame->modelling.at.y = f0;
167161

168-
frame->modelling.pos.z = f0;
169-
frame->modelling.pos.y = f0;
170-
frame->modelling.pos.x = f0;
162+
frame->modelling.pos.x = frame->modelling.pos.y = frame->modelling.pos.z = f0;
171163

172164
frame->modelling.flags = frame->modelling.flags | rpPTANKDFLAGCNS2DROTATE |
173165
rpPTANKDFLAGCOLOR | rpPTANKDFLAGPOSITION;
@@ -243,7 +235,29 @@ namespace
243235
return 0;
244236
}
245237

246-
U32 create_ptanks(group_data& group, unsigned long count)
238+
U32 create_ptanks(group_data& group, u32 count);
239+
} // namespace
240+
241+
void xPTankPoolSceneEnter()
242+
{
243+
inited = 1;
244+
init_groups();
245+
246+
group_data* it = groups;
247+
group_data* end = groups + MAX_PGT;
248+
while (it != end)
249+
{
250+
F64 f = it->max_size - 0.f;
251+
F32 scaled = F32(f) * 0.25f + 0.5f;
252+
create_ptanks(*it, (U32)scaled);
253+
254+
it++;
255+
}
256+
}
257+
258+
namespace
259+
{
260+
U32 create_ptanks(group_data& group, u32 count)
247261
{
248262
U32 initial_size = group.size;
249263
if (initial_size + count > group.max_size)
@@ -275,23 +289,6 @@ namespace
275289

276290
} // namespace
277291

278-
void xPTankPoolSceneEnter()
279-
{
280-
inited = 1;
281-
init_groups();
282-
283-
group_data* it = groups;
284-
group_data* end = groups + MAX_PGT;
285-
while (it != end)
286-
{
287-
double f = it->max_size - 0.f;
288-
float scaled = float(f) * 0.25f + 0.5f;
289-
create_ptanks(*it, (unsigned long)scaled);
290-
291-
it++;
292-
}
293-
}
294-
295292
void xPTankPoolSceneExit()
296293
{
297294
inited = 0;

0 commit comments

Comments
 (0)