Skip to content

Commit f41cf65

Browse files
kkv0npenta3
andauthored
Small improvements for human readability (#222)
* use enums for better readibility * remove old comments * use color and terrain type enums * change comment * delete wrong comment * add known stats to phys enum --------- Co-authored-by: penta3 <thedragopenta9@gmail.com>
1 parent a368b70 commit f41cf65

File tree

88 files changed

+616
-525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+616
-525
lines changed

decompile/General/221/221_Full.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ void DECOMP_CC_EndEvent_DrawMenu()
3030
int levelID;
3131
int elapsedFrames;
3232

33+
unsigned char prize = 0x6f;
34+
3335
gGT = sdata->gGT;
3436
levelID = gGT->levelID;
3537
driver = gGT->drivers[0];
@@ -38,15 +40,15 @@ void DECOMP_CC_EndEvent_DrawMenu()
3840
// Dingo Canyon gives different item depending on
3941
// camera, Blizz Bluff gives Skull Rock token, and
4042
// Dragon Mines gives purple gem
41-
if(levelID == 0) bitIndex = gGT->pushBuffer[0].pos[2];
42-
else if(levelID == 1) bitIndex = 0;
43-
else if(levelID == 2) bitIndex = -1;
43+
if(levelID == DINGO_CANYON) bitIndex = gGT->pushBuffer[0].pos[2];
44+
else if(levelID == DRAGON_MINES) bitIndex = 0;
45+
else if(levelID == BLIZZARD_BLUFF) bitIndex = -1;
4446

4547
// default logic
46-
else bitIndex = hub[gGT->levelID-0x12];
48+
else bitIndex = hub[gGT->levelID-TURBO_TRACK]; //0x12
4749

4850
// first purple token at 0x6f
49-
bitIndex += 0x6f;
51+
bitIndex += prize;
5052

5153
adv = &sdata->advProgress;
5254
boolLose = driver->numCrystals < gGT->numCrystalsInLEV;

decompile/General/222/222_Full.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
4040
u_int scaleDown;
4141
u_int txtColor;
4242
int bitIndex;
43+
44+
unsigned char prize;
4345

4446
bitIndex = -1;
4547
gGT = sdata->gGT;
@@ -92,9 +94,11 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
9294
lerpEndX = lerpStartX + 0x10;
9395
lerpEndY = lerpStartY + 0x10;
9496
lerpFrames = FPS_DOUBLE(8);
95-
97+
98+
prize = 0x4c;
99+
96100
// If you have not unlocked this CTR Token
97-
bitIndex = gGT->levelID + 0x4C;
101+
bitIndex = gGT->levelID + prize;
98102
*(int *)&letterPos[0] = *(int *)&hudCTR[0];
99103
if (CHECK_ADV_BIT(adv->rewards, bitIndex) == 0)
100104
{
@@ -438,8 +442,10 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
438442
// If you are in boss mode
439443
if (gGT->gameMode1 < 0)
440444
{
445+
prize = 0x5e;
446+
441447
// bitIndex of keys unlocked, and boss beaten
442-
bitIndex = gGT->bossID + 0x5e;
448+
bitIndex = gGT->bossID + prize;
443449

444450
// If the number of keys you have is less than 4
445451
if (gGT->bossID < 4)
@@ -448,14 +454,14 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
448454
if (CHECK_ADV_BIT(adv->rewards, bitIndex) == 0)
449455
{
450456
// Go to Podium after returning to Adventure Hub
451-
gGT->podiumRewardID = 99; // key
457+
gGT->podiumRewardID = STATIC_KEY; // key
452458

453459
// hot air skyway
454-
if (gGT->levelID == 7)
460+
if (gGT->levelID == HOT_AIR_SKYWAY)
455461
{
456462
// If you just beat Pinstripe
457463
// Load gemstone valley
458-
levSpawn = 0x19;
464+
levSpawn = GEM_STONE_VALLEY;
459465
}
460466
}
461467
}
@@ -465,7 +471,7 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
465471
{
466472
// Always go to podium after oxide,
467473
// with no key (0x38 = empty)
468-
gGT->podiumRewardID = 0x38;
474+
gGT->podiumRewardID = STATIC_BIG1;
469475

470476
// assume oxide beaten 1st time
471477
adv->rewards[3] |= 0x80004;
@@ -488,14 +494,15 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
488494

489495
// if trophy is not won,
490496
// Dingo Bingo needs to win trophy and token in the same race
491-
bitIndex = gGT->levelID + 6;
497+
prize = 6;
498+
bitIndex = gGT->levelID + prize;
492499
if (CHECK_ADV_BIT(adv->rewards, bitIndex) == 0)
493500
{
494501
// unlock tropy
495502
UNLOCK_ADV_BIT(adv->rewards, bitIndex);
496503

497504
// go to podium with trophy
498-
gGT->podiumRewardID = 0x62;
505+
gGT->podiumRewardID = STATIC_TROPHY;
499506
}
500507

501508
MainRaceTrack_RequestLoad(levSpawn);

decompile/General/223/223_Full.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void DECOMP_RR_EndEvent_UnlockAward()
6060
UNLOCK_ADV_BIT(adv->rewards, bitIndex);
6161

6262
// relic model
63-
gGT->podiumRewardID = 0x61;
63+
gGT->podiumRewardID = STATIC_RELIC;
6464

6565
// won relic
6666
gGT->gameModeEnd |= NEW_RELIC;
@@ -130,7 +130,8 @@ void DECOMP_RR_EndEvent_DrawMenu(void)
130130

131131
// 0x3a is the bit index of where platinum
132132
// relics start in adventure progress
133-
bitIndex = gGT->levelID + 0x3a;
133+
unsigned char prize = 0x3a;
134+
bitIndex = gGT->levelID + prize;
134135

135136
// set color of relic in Instance
136137
relic->colorRGBA =

decompile/General/230/230_56_MM_TrackSelect_MenuProc.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ void DECOMP_MM_TrackSelect_MenuProc(struct RectMenu* menu)
134134

135135
#ifdef USE_HIGHMP
136136
numTracks = 23;
137-
D230.battleTracks[0].levID = 0x19;
138-
D230.battleTracks[1].levID = 0x1a;
139-
D230.battleTracks[2].levID = 0x1b;
140-
D230.battleTracks[3].levID = 0x1c;
141-
D230.battleTracks[4].levID = 0x1d;
137+
D230.battleTracks[0].levID = GEM_STONE_VALLEY;
138+
D230.battleTracks[1].levID = N_SANITY_BEACH;
139+
D230.battleTracks[2].levID = THE_LOST_RUINS;
140+
D230.battleTracks[3].levID = GLACIER_PARK;
141+
D230.battleTracks[4].levID = CITADEL_CITY;
142142
#endif
143143

144144
// if you are in battle mode
@@ -148,11 +148,11 @@ void DECOMP_MM_TrackSelect_MenuProc(struct RectMenu* menu)
148148
numTracks = 7;
149149

150150
#ifdef USE_HIGHMP
151-
D230.battleTracks[0].levID = 18;
152-
D230.battleTracks[1].levID = 19;
153-
D230.battleTracks[2].levID = 20;
154-
D230.battleTracks[3].levID = 21;
155-
D230.battleTracks[4].levID = 22;
151+
D230.battleTracks[0].levID = NITRO_COURT;
152+
D230.battleTracks[1].levID = RAMPAGE_RUINS;
153+
D230.battleTracks[2].levID = PARKING_LOT;
154+
D230.battleTracks[3].levID = SKULL_ROCK;
155+
D230.battleTracks[4].levID = THE_NORTH_BOWL;
156156
#endif
157157
}
158158

decompile/General/231/231_007_RB_Hazard_CollideWithDrivers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct Instance* DECOMP_RB_Hazard_CollideWithDrivers(
4848

4949
// to be more optimal, just do weaponInst->thread->funcThTick == GenericMine_ThTick
5050
if (
51-
((unsigned int)modelID - 0x46 < 2) || // red or green potion
51+
((unsigned int)modelID - STATIC_BEAKER_RED < 2) || // red or green potion
5252
(modelID == PU_EXPLOSIVE_CRATE) || // Nitro
5353
(modelID == STATIC_CRATE_TNT) // TNT
5454
)

decompile/General/231/231_010_RB_Hazard_ThCollide_Missile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void DECOMP_RB_Hazard_ThCollide_Missile(struct Thread* thread)
1010
inst = thread->inst;
1111

1212
// could I also just do thread->modelID?
13-
if (inst->model->id == 0x29)
13+
if (inst->model->id == DYNAMIC_ROCKET)
1414
{
1515
#ifndef REBUILD_PS1
1616
// play audio of explosion

decompile/General/231/231_011_RB_Hazard_ThCollide_Generic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void DECOMP_RB_Hazard_ThCollide_Generic(struct Thread* thread)
3636
modelID = inst->model->id;
3737

3838
// if red beaker or green beaker
39-
if ((unsigned int)(modelID - 0x46) < 2)
39+
if ((unsigned int)(modelID - STATIC_BEAKER_RED) < 2)
4040
{
4141
#ifndef REBUILD_PS1
4242
PlaySound3D(0x3f, inst);
@@ -57,7 +57,7 @@ void DECOMP_RB_Hazard_ThCollide_Generic(struct Thread* thread)
5757
else
5858
{
5959
// if not TNT
60-
if(modelID != 0x27)
60+
if(modelID != STATIC_CRATE_TNT)
6161
{
6262
return;
6363
}

decompile/General/231/231_012_RB_Potion_OnShatter_TeethCallback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ int RB_Potion_OnShatter_TeethCallback(int unk, struct BSP* bspHitbox)
1111
instDef = bspHitbox->data.hitbox.instDef;
1212
if (instDef != NULL)
1313
if (teethInst = instDef->ptrInstance, teethInst != NULL)
14-
if (instDef->modelID == 0x70) //STATIC_TEETH
14+
if (instDef->modelID == STATIC_TEETH) //tiger temple door
1515
instDef = DECOMP_RB_Teeth_OpenDoor(teethInst);
1616

1717
return (int)instDef;

decompile/General/231/231_016_RB_GenericMine_ThTick.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ void DECOMP_RB_GenericMine_ThTick(struct Thread* t)
383383
param = 0x3d;
384384

385385
// if model is Nitro
386-
if (model == 6)
386+
if (model == PU_EXPLOSIVE_CRATE)
387387
{
388388
// glass shatter
389389
param = 0x3f;

decompile/General/231/231_024_RB_MovingExplosive_ThTick.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ LAB_800adc08:;
239239
inst->matrix.t[2] += (((int)tw->vel[2] * elapsedTime) >> 5);
240240

241241
// If this is bomb
242-
if (modelID == 0x3b)
242+
if (modelID == DYNAMIC_BOMB)
243243
{
244244
// if bomb is forwards
245245
if ((tw->flags & 0x20) == 0)
@@ -321,7 +321,7 @@ LAB_800adc08:;
321321
int iVar8 = elapsedTime << 2;
322322

323323
// if missile
324-
if (modelID == 0x29)
324+
if (modelID == DYNAMIC_ROCKET)
325325
{
326326
iVar8 = elapsedTime << 3;
327327
}
@@ -338,9 +338,9 @@ LAB_800adc08:;
338338
else
339339
{
340340
tw->vel[1] = 0;
341-
342-
// DYNAMIC_ROCKET
343-
if (modelID == 0x29)
341+
342+
//missile model
343+
if (modelID == DYNAMIC_ROCKET)
344344
{
345345
VehPhysForce_RotAxisAngle(
346346
&inst->matrix,
@@ -380,7 +380,7 @@ LAB_800adc08:;
380380
(
381381
(
382382
(instDef->ptrInstance != 0) &&
383-
(instDef->modelID == 0x70)
383+
(instDef->modelID == STATIC_TEETH)
384384
)
385385
)
386386
)
@@ -418,7 +418,7 @@ LAB_800adc08:;
418418
if (hitInst == 0)
419419
{
420420
// instance -> model -> modelID is not bomb
421-
if (modelID != 0x3b) {
421+
if (modelID != DYNAMIC_BOMB) {
422422
LAB_800ae440:
423423
if (tw->frameCount_DontHurtParent != 0)
424424
tw->frameCount_DontHurtParent--;
@@ -445,7 +445,7 @@ LAB_800adc08:;
445445
else
446446
{
447447
// not a missile
448-
if (hitInst->model->id != 0x29)
448+
if (hitInst->model->id != DYNAMIC_ROCKET)
449449
{
450450
// quit, warpball collisions dont matter
451451
return;

0 commit comments

Comments
 (0)