From 61ea58d2545c8773e737ac81a641e29a7ec7614d Mon Sep 17 00:00:00 2001 From: penta3 Date: Wed, 6 Aug 2025 01:45:53 -0300 Subject: [PATCH 1/7] bugfix tokens --- decompile/General/221/221_Full.c | 5 ++--- decompile/General/222/222_Full.c | 11 ++++------- decompile/General/223/223_Full.c | 3 +-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/decompile/General/221/221_Full.c b/decompile/General/221/221_Full.c index c9447ef6f..0e4f6c440 100644 --- a/decompile/General/221/221_Full.c +++ b/decompile/General/221/221_Full.c @@ -30,7 +30,6 @@ void DECOMP_CC_EndEvent_DrawMenu() int levelID; int elapsedFrames; - unsigned char prize = 0x6f; gGT = sdata->gGT; levelID = gGT->levelID; @@ -45,10 +44,10 @@ void DECOMP_CC_EndEvent_DrawMenu() else if(levelID == BLIZZARD_BLUFF) bitIndex = -1; // default logic - else bitIndex = hub[gGT->levelID-TURBO_TRACK]; //0x12 + else bitIndex = hub[gGT->levelID-NITRO_COURT]; //0x12 // first purple token at 0x6f - bitIndex += prize; + bitIndex += 0x6f; adv = &sdata->advProgress; boolLose = driver->numCrystals < gGT->numCrystalsInLEV; diff --git a/decompile/General/222/222_Full.c b/decompile/General/222/222_Full.c index 797d1c8ad..bffc04951 100644 --- a/decompile/General/222/222_Full.c +++ b/decompile/General/222/222_Full.c @@ -41,7 +41,6 @@ void DECOMP_AA_EndEvent_DrawMenu(void) u_int txtColor; int bitIndex; - unsigned char prize; bitIndex = -1; gGT = sdata->gGT; @@ -95,10 +94,10 @@ void DECOMP_AA_EndEvent_DrawMenu(void) lerpEndY = lerpStartY + 0x10; lerpFrames = FPS_DOUBLE(8); - prize = 0x4c; + // If you have not unlocked this CTR Token - bitIndex = gGT->levelID + prize; + bitIndex = gGT->levelID + 0x4c; *(int *)&letterPos[0] = *(int *)&hudCTR[0]; if (CHECK_ADV_BIT(adv->rewards, bitIndex) == 0) { @@ -442,10 +441,9 @@ void DECOMP_AA_EndEvent_DrawMenu(void) // If you are in boss mode if (gGT->gameMode1 < 0) { - prize = 0x5e; // bitIndex of keys unlocked, and boss beaten - bitIndex = gGT->bossID + prize; + bitIndex = gGT->bossID + 0x5e; // If the number of keys you have is less than 4 if (gGT->bossID < 4) @@ -494,8 +492,7 @@ void DECOMP_AA_EndEvent_DrawMenu(void) // if trophy is not won, // Dingo Bingo needs to win trophy and token in the same race - prize = 6; - bitIndex = gGT->levelID + prize; + bitIndex = gGT->levelID + 6; if (CHECK_ADV_BIT(adv->rewards, bitIndex) == 0) { // unlock tropy diff --git a/decompile/General/223/223_Full.c b/decompile/General/223/223_Full.c index 07395f8ce..de36d6ad4 100644 --- a/decompile/General/223/223_Full.c +++ b/decompile/General/223/223_Full.c @@ -130,8 +130,7 @@ void DECOMP_RR_EndEvent_DrawMenu(void) // 0x3a is the bit index of where platinum // relics start in adventure progress - unsigned char prize = 0x3a; - bitIndex = gGT->levelID + prize; + bitIndex = gGT->levelID + 0x3a; // set color of relic in Instance relic->colorRGBA = From 95e4bc69f71098fe283579a78efc2019a1f5543e Mon Sep 17 00:00:00 2001 From: penta3 Date: Sun, 5 Oct 2025 02:47:55 -0300 Subject: [PATCH 2/7] QOL fixes --- config.json | 3 +- decompile/General/221/221_Full.c | 2 +- decompile/General/222/222_Full.c | 14 +- decompile/General/223/223_Full.c | 7 +- decompile/General/225/225_Full.c | 12 +- .../231/231_006_RB_Hazard_HurtDriver.c | 3 +- .../General/231/231_048_RB_Blowup_Init.c | 2 +- decompile/General/231/231_122_126_RB_Teeth.c | 121 +++++++++--------- .../General/232/232_06_AH_WarpPad_LInB.c | 40 +++--- .../General/232/232_09_AH_Garage_ThTick.c | 4 +- decompile/General/232/232_15_AH_Door_ThTick.c | 2 +- decompile/General/232/232_25_AH_Pause_Draw.c | 10 +- decompile/General/232/R232.c | 4 +- .../General/BOTS/BOTS_16_Driver_Convert.c | 2 +- decompile/General/CAMERA/CAM_19_ThTick.c | 2 +- .../GAMEPAD/GAMEPAD_08_ProcessMotors.c | 2 +- .../General/GAMEPAD/GAMEPAD_12_ShockFreq.c | 2 +- .../General/GAMEPAD/GAMEPAD_13_ShockForce1.c | 2 +- .../General/GAMEPAD/GAMEPAD_14_ShockForce2.c | 2 +- .../General/GHOST/GhostReplay_01_Init1.c | 2 +- .../General/HOWL/h106_Audio_SetReverbMode.c | 2 +- decompile/General/HOWL/h108_Music_LoadBanks.c | 2 +- .../General/HOWL/h109_Music_AsyncParseBanks.c | 4 +- decompile/General/LOAD/LOAD_31_DriverMPK.c | 2 +- decompile/General/LOAD/LOAD_44_TenStages.c | 2 +- .../MAIN/MainStats_01_RestartRaceCountLoss.c | 2 +- .../PlayLevel/PlayLevel_0_UpdateLapStats.c | 8 +- decompile/General/UI/UI_09_Map_DrawMap.c | 2 +- .../General/UI/UI_43_DrawRankedDrivers.c | 2 +- decompile/General/UI/UI_52_VsWaitForPressX.c | 2 +- decompile/General/UI/UI_55_RaceEnd_MenuProc.c | 2 +- .../General/Vehicle/VehBirth_7_NonGhost.c | 4 +- .../Vehicle/VehPhysGeneral_5_SetHeldItem.c | 2 +- .../Vehicle/VehPickupItem_4_ShootNow.c | 2 +- include/ovr_232.h | 32 +++++ 35 files changed, 173 insertions(+), 135 deletions(-) diff --git a/config.json b/config.json index a64523a2c..d5b72ce85 100644 --- a/config.json +++ b/config.json @@ -6,7 +6,8 @@ "optimization": 4, "debug": 1, "psyq": 0, - "mininoob": 0, + "mininoob": 0, + "pch": "common.h", "8mb": 1 }, "versions": diff --git a/decompile/General/221/221_Full.c b/decompile/General/221/221_Full.c index 0e4f6c440..35dabcd21 100644 --- a/decompile/General/221/221_Full.c +++ b/decompile/General/221/221_Full.c @@ -47,7 +47,7 @@ void DECOMP_CC_EndEvent_DrawMenu() else bitIndex = hub[gGT->levelID-NITRO_COURT]; //0x12 // first purple token at 0x6f - bitIndex += 0x6f; + bitIndex += PRIZE_CRYSTAL_CH; adv = &sdata->advProgress; boolLose = driver->numCrystals < gGT->numCrystalsInLEV; diff --git a/decompile/General/222/222_Full.c b/decompile/General/222/222_Full.c index bffc04951..f268ac3de 100644 --- a/decompile/General/222/222_Full.c +++ b/decompile/General/222/222_Full.c @@ -97,7 +97,7 @@ void DECOMP_AA_EndEvent_DrawMenu(void) // If you have not unlocked this CTR Token - bitIndex = gGT->levelID + 0x4c; + bitIndex = gGT->levelID + PRIZE_TOKEN_RACE; *(int *)&letterPos[0] = *(int *)&hudCTR[0]; if (CHECK_ADV_BIT(adv->rewards, bitIndex) == 0) { @@ -418,7 +418,7 @@ void DECOMP_AA_EndEvent_DrawMenu(void) sdata->Loading.OnBegin.RemBitsConfig0 |= (ADVENTURE_BOSS | TOKEN_RACE); // If you are in boss mode - if (gGT->gameMode1 < 0) + if ((gGT->gameMode1 & ADVENTURE_BOSS) != 0) { sdata->Loading.OnBegin.AddBitsConfig8 |= SPAWN_AT_BOSS; } @@ -439,14 +439,14 @@ void DECOMP_AA_EndEvent_DrawMenu(void) levSpawn = gGT->prevLEV; // If you are in boss mode - if (gGT->gameMode1 < 0) + if ((gGT->gameMode1 & ADVENTURE_BOSS) != 0) { // bitIndex of keys unlocked, and boss beaten - bitIndex = gGT->bossID + 0x5e; + bitIndex = gGT->bossID + PRIZE_BOSS_KEY; // If the number of keys you have is less than 4 - if (gGT->bossID < 4) + if (gGT->bossID < BOSS_OXIDE) { // only if first time beating boss if (CHECK_ADV_BIT(adv->rewards, bitIndex) == 0) @@ -475,7 +475,7 @@ void DECOMP_AA_EndEvent_DrawMenu(void) adv->rewards[3] |= 0x80004; // if beaten oxide 2nd time - if(gGT->bossID == 5) + if(gGT->bossID == BOSS_OXIDEFINAL) { // beat 2nd time adv->rewards[3] |= 0x100008; @@ -492,7 +492,7 @@ void DECOMP_AA_EndEvent_DrawMenu(void) // if trophy is not won, // Dingo Bingo needs to win trophy and token in the same race - bitIndex = gGT->levelID + 6; + bitIndex = gGT->levelID + PRIZE_TROPHY_RACE; if (CHECK_ADV_BIT(adv->rewards, bitIndex) == 0) { // unlock tropy diff --git a/decompile/General/223/223_Full.c b/decompile/General/223/223_Full.c index de36d6ad4..1433f47e9 100644 --- a/decompile/General/223/223_Full.c +++ b/decompile/General/223/223_Full.c @@ -1,8 +1,9 @@ #include // copy/paste from GameProg +//is thisbeing used or is it needed for another compiler optimization? #define NO_ADV_BIT(rewards, bitIndex) \ - ((rewards[bitIndex >> 5] >> (bitIndex & 0x1f)) & 1) != 0 + ((rewards[bitIndex >> 5] >> (bitIndex & 0x1f)) & 1) != 0 // this goes to footer static int str_number = 0x20; // " \0" @@ -130,7 +131,7 @@ void DECOMP_RR_EndEvent_DrawMenu(void) // 0x3a is the bit index of where platinum // relics start in adventure progress - bitIndex = gGT->levelID + 0x3a; + bitIndex = gGT->levelID + PRIZE_PLATINUM; // set color of relic in Instance relic->colorRGBA = @@ -139,7 +140,7 @@ void DECOMP_RR_EndEvent_DrawMenu(void) (CHECK_ADV_BIT(adv->rewards, bitIndex)) ? 0xffede90 : // check if gold is unlocked, set gold color - (CHECK_ADV_BIT(adv->rewards, (bitIndex - 0x12) )) ? 0xd8d2090 : + (CHECK_ADV_BIT(adv->rewards, PRIZE_GOLD)) ? 0xd8d2090 : // if sapphire, keep original color relic->colorRGBA; diff --git a/decompile/General/225/225_Full.c b/decompile/General/225/225_Full.c index 388ca68c5..21024059a 100644 --- a/decompile/General/225/225_Full.c +++ b/decompile/General/225/225_Full.c @@ -75,8 +75,8 @@ void DECOMP_VB_EndEvent_DrawMenu(void) iVar10 = 0x50; short yCoord; - // if you are not in battle mode - if ((gGT->gameMode1 & 0x20) == 0) + + if ((gGT->gameMode1 & BATTLE_MODE) == 0) { // lng index for VERSUS iVar10 = 0x14f; @@ -178,7 +178,7 @@ void DECOMP_VB_EndEvent_DrawMenu(void) sVar9 = 0; // If you are not in battle mode - if ((gGT->gameMode1 & 0x20) == 0) + if ((gGT->gameMode1 & BATTLE_MODE) == 0) { uStack112 = VsPosY_Config[VsPosY_NUM*VsConfigIndex + uStack88]; @@ -242,7 +242,7 @@ void DECOMP_VB_EndEvent_DrawMenu(void) for (iVar10 = 0; iVar10 < iVar6; iVar10++) { // If you are not in Battle Mode - if ((gGT->gameMode1 & 0x20) == 0) + if ((gGT->gameMode1 & BATTLE_MODE) == 0) { // get position player finished in race iVar2 = gGT->drivers[gGT->battleSetup.unk1dc8[iVar11]]->driverRank; @@ -322,7 +322,7 @@ void DECOMP_VB_EndEvent_DrawMenu(void) if (sStack104 == 0) { // if this is not battle mode, get first place racer, else get battle winner - uVar3 = ((gGT->gameMode1 & 0x20) == 0) ? gGT->driversInRaceOrder[0]->driverID : gGT->winnerIndex[0]; + uVar3 = ((gGT->gameMode1 & BATTLE_MODE) == 0) ? gGT->driversInRaceOrder[0]->driverID : gGT->winnerIndex[0]; if (uVar3 != plCount) goto LAB_8009ff4c; @@ -407,7 +407,7 @@ void DECOMP_VB_EndEvent_DrawMenu(void) if (((sdata->menuReadyToPass & 1) == 0) && (FPS_DOUBLE(25) < sdata->framesSinceRaceEnded)) { // if you're in battle mode. - endMenu = ((gGT->gameMode1 & 0x20) == 0) ? &menuVS : &menuBattle; + endMenu = ((gGT->gameMode1 & BATTLE_MODE) == 0) ? &menuVS : &menuBattle; // Make Menu Box appear based on the game mode RECTMENU_Show(endMenu); diff --git a/decompile/General/231/231_006_RB_Hazard_HurtDriver.c b/decompile/General/231/231_006_RB_Hazard_HurtDriver.c index e20328e93..9cee5e27b 100644 --- a/decompile/General/231/231_006_RB_Hazard_HurtDriver.c +++ b/decompile/General/231/231_006_RB_Hazard_HurtDriver.c @@ -19,7 +19,8 @@ int DECOMP_RB_Hazard_HurtDriver( { //decomp attempt 1 had the second condition of this if statement as: ((gGT->gameMode1 & ADVENTURE_BOSS) != 0) //currently using ((int)gGT->gameMode1 < 0) bc that's what ghidra says (it might be equivalent idk) - if ((gGT->levelID == OXIDE_STATION) && (gGT->gameMode1 < 0)) + //if this was really < 0 then i will reconsider if gameMode 1 should really be a signed int + if ((gGT->levelID == OXIDE_STATION) && ((gGT->gameMode1 & ADVENTURE_BOSS) != 0)) damageType = 1; #ifndef REBUILD_PS1 //this ifndef should be removed at some point? diff --git a/decompile/General/231/231_048_RB_Blowup_Init.c b/decompile/General/231/231_048_RB_Blowup_Init.c index be2760bf1..95038b870 100644 --- a/decompile/General/231/231_048_RB_Blowup_Init.c +++ b/decompile/General/231/231_048_RB_Blowup_Init.c @@ -94,7 +94,7 @@ void DECOMP_RB_Blowup_Init(struct Instance* weaponInst) sps->Input1.pos[2] = weaponInst->matrix.t[2]; // if you're in boss mode - if (gGT->gameMode1 < 0) + if ((gGT->gameMode1 & ADVENTURE_BOSS) != 0) { // hitRadius and hitRadiusSquared sps->Input1.hitRadius = 0x100; diff --git a/decompile/General/231/231_122_126_RB_Teeth.c b/decompile/General/231/231_122_126_RB_Teeth.c index fec9c43f3..32413fc83 100644 --- a/decompile/General/231/231_122_126_RB_Teeth.c +++ b/decompile/General/231/231_122_126_RB_Teeth.c @@ -11,7 +11,7 @@ void DECOMP_RB_Teeth_LInB(struct Instance* inst) sdata->doorAccessFlags |= 1; // Make invisible - inst->flags |= 0x80; + inst->flags |= HIDE_MODEL; } return; } @@ -22,24 +22,24 @@ void DECOMP_RB_Teeth_BSP_Callback(struct ScratchpadStruct* sps,struct Thread* we struct Thread* teethTh; struct Instance* weaponInst; struct Instance* teethInst; - int iVar5; + int distance; model = weaponThread->modelIndex; // if not driver - if (model != 0x18) + if (model != DYNAMIC_PLAYER) { - if (model < 0x19) + if (model < DYNAMIC_SMALL_BOMB) { // if not nitro - if (model != 6) { + if (model != PU_EXPLOSIVE_CRATE) { return; } } else { // if not potion or tnt - if ((model != 0x1d) && (model != 0x27)) { + if ((model != DYNAMIC_POISON) && (model != STATIC_CRATE_TNT)) { return; } } @@ -52,15 +52,15 @@ void DECOMP_RB_Teeth_BSP_Callback(struct ScratchpadStruct* sps,struct Thread* we teethInst = teethTh->inst; if ((weaponInst != NULL) && (teethInst != NULL)) { - iVar5 = ((int)sps->Input1.pos[0] - weaponInst->matrix.t[0]) * (int)teethInst->matrix.m[0][2] + + distance = ((int)sps->Input1.pos[0] - weaponInst->matrix.t[0]) * (int)teethInst->matrix.m[0][2] + ((int)sps->Input1.pos[2] - weaponInst->matrix.t[2]) * (int)teethInst->matrix.m[2][2]; - // catch negative value - if (iVar5 < 0) { - iVar5 = -iVar5; + // catch negative value + if (distance < 0) { + distance = -distance; } - if (0x100 < iVar5 >> 0xc) { + if ((distance >> 0xc) > 0x100) { return; } } @@ -73,18 +73,16 @@ void DECOMP_RB_Teeth_BSP_Callback(struct ScratchpadStruct* sps,struct Thread* we void DECOMP_RB_Teeth_ThTick(struct Thread* t) { - int iVar1; - u_int flags; + int doorTimeCount; struct Teeth* teeth; - struct Instance* inst; + struct Instance* doorInst; struct GameTracker* gGT; gGT = sdata->gGT; teeth = t->object; - inst = t->inst; - - #define SPS \ - ((struct ScratchpadStruct*)0x1f800108) + doorInst = t->inst; + + struct ScratchpadStruct* SPS = (struct ScratchpadStruct*)0x1f800108; // if door is not moving if (teeth->direction == 0) @@ -93,17 +91,17 @@ void DECOMP_RB_Teeth_ThTick(struct Thread* t) if (teeth->timeOpen == 0) goto LAB_800b9ff8; // reduce timer by milliseconds - iVar1 = teeth->timeOpen - gGT->elapsedTimeMS; + doorTimeCount = teeth->timeOpen - gGT->elapsedTimeMS; // set new timer - teeth->timeOpen = iVar1; + teeth->timeOpen = doorTimeCount; // if timer is up - if (iVar1 < 1) + if (doorTimeCount < 1) { // play sound // teeth closing - PlaySound3D(0x75,inst); + PlaySound3D(0x75,doorInst); // timer is zero teeth->timeOpen = 0; @@ -119,18 +117,18 @@ void DECOMP_RB_Teeth_ThTick(struct Thread* t) else { // modify animation index by direction - inst->animFrame = inst->animFrame + teeth->direction; + doorInst->animFrame += teeth->direction; - iVar1 = VehFrameInst_GetNumAnimFrames((struct Driver*)inst, 0); + doorTimeCount = VehFrameInst_GetNumAnimFrames((struct Driver*)doorInst, 0); // if animation is not on last frame - if ((int)inst->animFrame < iVar1) + if ((int)doorInst->animFrame < doorTimeCount) { // if animation when backwards past beginning - if ((int)inst->animFrame < 0) + if ((int)doorInst->animFrame < 0) { // set animation to beginning - inst->animFrame = 0; + doorInst->animFrame = 0; // door is not moving teeth->direction = 0; @@ -147,25 +145,25 @@ void DECOMP_RB_Teeth_ThTick(struct Thread* t) else { // set animation to last frame - inst->animFrame = (short)iVar1 + -1; + doorInst->animFrame = FPS_DOUBLE((short)(doorTimeCount -1)); // door is not moving (fully open) teeth->direction = 0; - // timer, 2 seconds - teeth->timeOpen = 0x780; + // timer + teeth->timeOpen = SECONDS(2); } LAB_800b9fe8: if (teeth->timeOpen == 0) { LAB_800b9ff8: - if (-1 < teeth->direction) goto LAB_800ba084; + if (teeth->direction > -1) goto LAB_800ba084; } } // Teeth instance position - SPS->Input1.pos[0] = inst->matrix.t[0]; - SPS->Input1.pos[1] = inst->matrix.t[1]; - SPS->Input1.pos[2] = inst->matrix.t[2]; + SPS->Input1.pos[0] = doorInst->matrix.t[0]; + SPS->Input1.pos[1] = doorInst->matrix.t[1]; + SPS->Input1.pos[2] = doorInst->matrix.t[2]; SPS->Input1.hitRadius = 0x300; SPS->Input1.hitRadiusSquared = 0x90000; @@ -189,7 +187,7 @@ void DECOMP_RB_Teeth_ThTick(struct Thread* t) if (teeth->timeOpen == 0) { // make visible - flags = inst->flags & 0xffffff7f; + doorInst->flags &= ~(HIDE_MODEL); } // if a timer is active @@ -197,17 +195,15 @@ void DECOMP_RB_Teeth_ThTick(struct Thread* t) else { // make invisible - flags = inst->flags | 0x80; + doorInst->flags |= HIDE_MODEL; } - - inst->flags = flags; return; } int DECOMP_RB_Teeth_LInC(struct Instance *teethInst, struct Thread *t, struct ScratchpadStruct* sps) { - int iVar1; + int distance; struct Thread *teethTh; struct Teeth *teeth; struct Driver *d; @@ -224,11 +220,14 @@ int DECOMP_RB_Teeth_LInC(struct Instance *teethInst, struct Thread *t, struct Sc if (teethTh == NULL) { - // 0x8 = size - // 0 = no relation to param4 - // 0x300 = SmallStackPool - // 0x3 = "static" thread bucket - teethTh = PROC_BirthWithObject(0x80303, DECOMP_RB_Teeth_ThTick, 0, 0); + + teethTh = PROC_BirthWithObject( + SIZE_RELATIVE_POOL_BUCKET( + sizeof(struct Teeth), + NONE, + SMALL, + STATIC), + DECOMP_RB_Teeth_ThTick, 0, 0); teethInst->thread = teethTh; @@ -268,15 +267,15 @@ int DECOMP_RB_Teeth_LInC(struct Instance *teethInst, struct Thread *t, struct Sc // time to close if (teeth->timeOpen == 0) { - iVar1 = + distance = ((int)sps->Input1.pos[0] - teethInst->matrix.t[0]) * (int)teethInst->matrix.m[0][2] + ((int)sps->Input1.pos[2] - teethInst->matrix.t[2]) * (int)teethInst->matrix.m[2][2]; - if (iVar1 < 0) + if (distance < 0) { - iVar1 = -iVar1; + distance = -distance; } - if (iVar1 >> 0xc < 0x81) + if ((distance >> 0xc) < 0x81) { return 1; } @@ -288,24 +287,32 @@ int DECOMP_RB_Teeth_LInC(struct Instance *teethInst, struct Thread *t, struct Sc struct InstDef* DECOMP_RB_Teeth_OpenDoor(struct Instance* inst) { struct Thread* teethTh = inst->thread; + struct Teeth* templeDoor = (struct Teeth*)teethTh->object; + if (teethTh == NULL) { - // 0x8 = size - // 0 = no relation to param4 - // 0x300 flag = SmallStackPool - // 0x3 = "static" thread bucket - u_int creationFlags = 0x80000 | 0x300 | 0x3; - + //ghidra output says third arg to PROC_BirthWithObject is s_teeth_OVR_231__800b9de8, idk the equivalent. - teethTh = PROC_BirthWithObject(creationFlags, DECOMP_RB_Teeth_ThTick, NULL, NULL); + teethTh = PROC_BirthWithObject( + SIZE_RELATIVE_POOL_BUCKET( + sizeof(struct Teeth), + NONE, + SMALL, + STATIC), + DECOMP_RB_Teeth_ThTick, NULL, NULL); + inst->thread = teethTh; if (teethTh == NULL) return NULL; + teethTh->inst = inst; - *(int*)((int)teethTh->object + 4) = 0; //idk what this line does + + templeDoor->timeOpen = 0; } + PlaySound3D(0x75, inst); // play sound, teeth opening - ((struct Teeth*)teethTh->object)->direction = 1; // door is open + templeDoor->direction = 1; // door is open sdata->doorAccessFlags |= 1; // enable access through a door (disable collision) + //return (struct Instance*)&DAT_80090000; return (struct InstDef*)0x80090000; //todo: make this a reference to named memory } \ No newline at end of file diff --git a/decompile/General/232/232_06_AH_WarpPad_LInB.c b/decompile/General/232/232_06_AH_WarpPad_LInB.c index 487e88fc2..c407fdea5 100644 --- a/decompile/General/232/232_06_AH_WarpPad_LInB.c +++ b/decompile/General/232/232_06_AH_WarpPad_LInB.c @@ -37,7 +37,7 @@ void DECOMP_AH_WarpPad_LInB(struct Instance* inst) 0 // thread relative ); - if(t == 0) return; + if(t == NULL) return; inst->thread = t; t->inst = inst; @@ -50,7 +50,7 @@ void DECOMP_AH_WarpPad_LInB(struct Instance* inst) // 4 - purple token or SlideCol/TurboTrack // locked - t->modelIndex = 0; + t->modelIndex = WARPPAD_LOCKED; // make invisible // this is the red triangle @@ -219,13 +219,13 @@ void DECOMP_AH_WarpPad_LInB(struct Instance* inst) if(levelID < SLIDE_COLISEUM) { // unlocked all - t->modelIndex = 2; + t->modelIndex = WARPPAD_EMPTY; // if trophy not owned - if(CHECK_ADV_BIT(sdata->advProgress.rewards, (levelID + 6)) == 0) + if(CHECK_ADV_BIT(sdata->advProgress.rewards, (levelID + PRIZE_TROPHY_RACE)) == 0) { // open for trophy - t->modelIndex = 1; + t->modelIndex = WARPPAD_TROPHY; newInst = DECOMP_INSTANCE_Birth3D(gGT->modelPtr[STATIC_TROPHY], 0, t); @@ -237,13 +237,13 @@ void DECOMP_AH_WarpPad_LInB(struct Instance* inst) } // if token not owned - if(CHECK_ADV_BIT(sdata->advProgress.rewards, (levelID + 0x4c)) == 0) + if(CHECK_ADV_BIT(sdata->advProgress.rewards, (levelID + PRIZE_TOKEN_RACE)) == 0) { // not open for trophy - if(t->modelIndex != 1) + if(t->modelIndex != WARPPAD_TROPHY) { // open for relic/token - t->modelIndex = 3; + t->modelIndex = WARPPAD_TOKEN; } BattleTrack: newInst = DECOMP_INSTANCE_Birth3D(gGT->modelPtr[STATIC_TOKEN], 0, t); @@ -284,15 +284,15 @@ void DECOMP_AH_WarpPad_LInB(struct Instance* inst) // if relic not owned if(levelID < NITRO_COURT) // check this cause of "goto BattleTrack" - if(CHECK_ADV_BIT(sdata->advProgress.rewards, (levelID + 0x16)) == 0) + if(CHECK_ADV_BIT(sdata->advProgress.rewards, (levelID + PRIZE_RELIC_RACE)) == 0) { // SlideCol/TurboTrack if(levelID>=SLIDE_COLISEUM) - t->modelIndex = 4; + t->modelIndex = WARPPAD_GEMSTONE_ACTIVE; - // open for token/relic - else if(t->modelIndex != 1) - t->modelIndex = 3; + // if not open for token/relic + else if(t->modelIndex != WARPPAD_TROPHY) + t->modelIndex = WARPPAD_RELIC; newInst = DECOMP_INSTANCE_Birth3D(gGT->modelPtr[STATIC_RELIC], 0, t); @@ -331,7 +331,7 @@ void DECOMP_AH_WarpPad_LInB(struct Instance* inst) else if(levelID < NITRO_COURT) { // already unlocked - t->modelIndex = 2; + t->modelIndex = WARPPAD_EMPTY; goto SlideColTurboTrack; } @@ -339,15 +339,15 @@ void DECOMP_AH_WarpPad_LInB(struct Instance* inst) // battle tracks else if(levelID < GEM_STONE_VALLEY) { - i = R232.battleTrackArr[levelID - NITRO_COURT] + 0x6f; + i = R232.battleTrackArr[levelID - NITRO_COURT] + PRIZE_CRYSTAL_CH; // already unlocked - t->modelIndex = 2; + t->modelIndex = WARPPAD_EMPTY; if(CHECK_ADV_BIT(sdata->advProgress.rewards, i) == 0) { // rainbow - t->modelIndex = 4; + t->modelIndex = WARPPAD_CRYSTALCH; goto BattleTrack; } @@ -357,19 +357,19 @@ void DECOMP_AH_WarpPad_LInB(struct Instance* inst) else { // bit index of gem - i = (levelID - ADV_CUP) + 0x6a; + i = (levelID - ADV_CUP) + PRIZE_GEM_CUP; // if gem is already unlocked, quit if(CHECK_ADV_BIT(sdata->advProgress.rewards, i) != 0) { // beaten - t->modelIndex = 2; + t->modelIndex = WARPPAD_EMPTY; return; } // rainbow color - t->modelIndex = 4; + t->modelIndex = WARPPAD_GEMSTONE_ACTIVE; newInst = DECOMP_INSTANCE_Birth3D(gGT->modelPtr[STATIC_GEM], 0, t); diff --git a/decompile/General/232/232_09_AH_Garage_ThTick.c b/decompile/General/232/232_09_AH_Garage_ThTick.c index 564b087d1..4f6feb6fc 100644 --- a/decompile/General/232/232_09_AH_Garage_ThTick.c +++ b/decompile/General/232/232_09_AH_Garage_ThTick.c @@ -265,8 +265,8 @@ void DECOMP_AH_Garage_ThTick(struct Thread *t) (levelID == GEM_STONE_VALLEY) && (gGT->currAdvProfile.numRelics == 18)) { - // set string index (0-5) to "N Oxide's Final Challenge" - gGT->bossID = 5; + //"N Oxide's Final Challenge" + gGT->bossID = BOSS_OXIDEFINAL; } else diff --git a/decompile/General/232/232_15_AH_Door_ThTick.c b/decompile/General/232/232_15_AH_Door_ThTick.c index 62b6d6ccb..7dd46d55e 100644 --- a/decompile/General/232/232_15_AH_Door_ThTick.c +++ b/decompile/General/232/232_15_AH_Door_ThTick.c @@ -188,7 +188,7 @@ void DECOMP_AH_Door_ThTick(struct Thread* t) if ((door->camFlags & WdCam_FlyingOut) == 0) { // If the game is paused - if ((gGT->gameMode1 & 0xf) != 0) + if ((gGT->gameMode1 & PAUSE_ALL) != 0) { return; } diff --git a/decompile/General/232/232_25_AH_Pause_Draw.c b/decompile/General/232/232_25_AH_Pause_Draw.c index 9ba310172..314a42c6e 100644 --- a/decompile/General/232/232_25_AH_Pause_Draw.c +++ b/decompile/General/232/232_25_AH_Pause_Draw.c @@ -132,12 +132,12 @@ void DECOMP_AH_Pause_Draw(int pageID, int posX) CHECK_ADV_BIT(adv->rewards, (0x10+i+0x3a)); } - char bossID = 0xf; + char boss_charID = NITROS_OXIDE; DECOMP_DecalFont_DrawLine( sdata->lngStrings[ data.MetaDataCharacters[ - bossID + boss_charID ].name_LNG_long ], posX + 0x6e, 2*0x10 + 4 + 0x26, @@ -256,14 +256,12 @@ void DECOMP_AH_Pause_Draw(int pageID, int posX) } // roo, papu, joe, pinstripe - // 10, 9, 11, 8 - int bossArr = 0x080b090a; - char bossID = bossArr >> (8*(hubID-1)); + char boss_charID = data.metaDataLEV[R232.bossTracks[hubID]].characterID_Boss; DECOMP_DecalFont_DrawLine( sdata->lngStrings[ data.MetaDataCharacters[ - bossID + boss_charID ].name_LNG_long ], posX + 0x50, 4*0x10 + 0 + 0x26, diff --git a/decompile/General/232/R232.c b/decompile/General/232/R232.c index 5fb404371..9450ba7e7 100644 --- a/decompile/General/232/R232.c +++ b/decompile/General/232/R232.c @@ -20,8 +20,8 @@ struct OverlayRDATA_232 R232 = .bossIDs = { - 4, 0, 1, 2, 3, - 0 + BOSS_OXIDE, BOSS_ROO, BOSS_PAPU, BOSS_KOMODO, BOSS_PINSTRIPE, + 0 //this should be BOSS_OXIDEFINAL but decomp doesnt use this array for gGT->bossID == 5 }, .keyFrame = diff --git a/decompile/General/BOTS/BOTS_16_Driver_Convert.c b/decompile/General/BOTS/BOTS_16_Driver_Convert.c index 93a3612e7..49c73257d 100644 --- a/decompile/General/BOTS/BOTS_16_Driver_Convert.c +++ b/decompile/General/BOTS/BOTS_16_Driver_Convert.c @@ -59,7 +59,7 @@ void DECOMP_BOTS_Driver_Convert(struct Driver* d) d->instSelf->thread->funcThTick = BOTS_ThTick_Drive; - if ((sdata->gGT->gameMode1 & 0x20) != 0) + if ((sdata->gGT->gameMode1 & BATTLE_MODE) != 0) { // you are in battle mode struct NavFrame* nf = NAVHEADER_GETFRAME(sdata->NavPath_ptrHeader[navPathIndex]); d->posCurr.x = nf->pos[0] << 8; diff --git a/decompile/General/CAMERA/CAM_19_ThTick.c b/decompile/General/CAMERA/CAM_19_ThTick.c index d9569a551..976660b93 100644 --- a/decompile/General/CAMERA/CAM_19_ThTick.c +++ b/decompile/General/CAMERA/CAM_19_ThTick.c @@ -441,7 +441,7 @@ void DECOMP_CAM_ThTick(struct Thread *t) } if ((cDC->cameraMode == 9) || (psVar21 = (short *)0x1f800108, cDC->cameraMode == 0xd)) { - if ((gGT->level1->cnt_restart_points != 0) && ((gGT->gameMode1 & 0xf) == 0)) + if ((gGT->level1->cnt_restart_points != 0) && ((gGT->gameMode1 & PAUSE_ALL) == 0)) { uVar9 = CAM_FollowDriver_TrackPath( cDC, (short *)0x1f800390, diff --git a/decompile/General/GAMEPAD/GAMEPAD_08_ProcessMotors.c b/decompile/General/GAMEPAD/GAMEPAD_08_ProcessMotors.c index 548ed0f14..55fa2c066 100644 --- a/decompile/General/GAMEPAD/GAMEPAD_08_ProcessMotors.c +++ b/decompile/General/GAMEPAD/GAMEPAD_08_ProcessMotors.c @@ -13,7 +13,7 @@ void DECOMP_GAMEPAD_ProcessMotors(struct GamepadSystem *gGS) if( (packet != 0) && (gGT->boolDemoMode == 0) && - ((gGT->gameMode1 & 0xf) == 0) && + ((gGT->gameMode1 & PAUSE_ALL) == 0) && (DECOMP_RaceFlag_IsTransitioning() == 0) ) { diff --git a/decompile/General/GAMEPAD/GAMEPAD_12_ShockFreq.c b/decompile/General/GAMEPAD/GAMEPAD_12_ShockFreq.c index e6d12928a..19fe9b4b8 100644 --- a/decompile/General/GAMEPAD/GAMEPAD_12_ShockFreq.c +++ b/decompile/General/GAMEPAD/GAMEPAD_12_ShockFreq.c @@ -8,7 +8,7 @@ void DECOMP_GAMEPAD_ShockFreq(struct Driver* d, int frame, int val) // 0 for enabled, // 1 for disabled - if((sdata->gGT->gameMode1 & (0x100 << d->driverID)) != 0) + if((sdata->gGT->gameMode1 & (P1_VIBRATE << d->driverID)) != 0) return; struct GamepadBuffer* gb = diff --git a/decompile/General/GAMEPAD/GAMEPAD_13_ShockForce1.c b/decompile/General/GAMEPAD/GAMEPAD_13_ShockForce1.c index 93c898d80..a0142a327 100644 --- a/decompile/General/GAMEPAD/GAMEPAD_13_ShockForce1.c +++ b/decompile/General/GAMEPAD/GAMEPAD_13_ShockForce1.c @@ -8,7 +8,7 @@ void DECOMP_GAMEPAD_ShockForce1(struct Driver* d, int frame, int val) // 0 for enabled, // 1 for disabled - if((sdata->gGT->gameMode1 & (0x100 << d->driverID)) != 0) + if((sdata->gGT->gameMode1 & (P1_VIBRATE << d->driverID)) != 0) return; struct GamepadBuffer* gb = diff --git a/decompile/General/GAMEPAD/GAMEPAD_14_ShockForce2.c b/decompile/General/GAMEPAD/GAMEPAD_14_ShockForce2.c index 143b307bb..033accfab 100644 --- a/decompile/General/GAMEPAD/GAMEPAD_14_ShockForce2.c +++ b/decompile/General/GAMEPAD/GAMEPAD_14_ShockForce2.c @@ -8,7 +8,7 @@ void DECOMP_GAMEPAD_ShockForce2(struct Driver* d, int frame, int val) // 0 for enabled, // 1 for disabled - if((sdata->gGT->gameMode1 & (0x100 << d->driverID)) != 0) + if((sdata->gGT->gameMode1 & (P1_VIBRATE << d->driverID)) != 0) return; struct GamepadBuffer* gb = diff --git a/decompile/General/GHOST/GhostReplay_01_Init1.c b/decompile/General/GHOST/GhostReplay_01_Init1.c index 0a7a4d78d..dd8ea0b5f 100644 --- a/decompile/General/GHOST/GhostReplay_01_Init1.c +++ b/decompile/General/GHOST/GhostReplay_01_Init1.c @@ -29,7 +29,7 @@ void DECOMP_GhostReplay_Init1(void) sdata->boolGhostsDrawing = 0; // only continue if you're in time trial, not main menu, and not cutscene - if ((gGT->gameMode1 & 0x20022000) != 0x20000) return; + if ((gGT->gameMode1 & TIME_TRIAL) == 0) return; // === Record Buffer === diff --git a/decompile/General/HOWL/h106_Audio_SetReverbMode.c b/decompile/General/HOWL/h106_Audio_SetReverbMode.c index 5d60dfdf1..408f0ce61 100644 --- a/decompile/General/HOWL/h106_Audio_SetReverbMode.c +++ b/decompile/General/HOWL/h106_Audio_SetReverbMode.c @@ -30,7 +30,7 @@ void DECOMP_Audio_SetReverbMode(int levelID, u_int isBossRace, int bossID) else { // if invalid bossID - if (5 < bossID) + if (bossID > BOSS_OXIDEFINAL) { // quit return; diff --git a/decompile/General/HOWL/h108_Music_LoadBanks.c b/decompile/General/HOWL/h108_Music_LoadBanks.c index 439514e7c..112e56736 100644 --- a/decompile/General/HOWL/h108_Music_LoadBanks.c +++ b/decompile/General/HOWL/h108_Music_LoadBanks.c @@ -13,7 +13,7 @@ void DECOMP_Music_LoadBanks(void) level, // Check to see if this is a boss race - (gGT->gameMode1 < 0), + ((gGT->gameMode1 & ADVENTURE_BOSS) != 0), // Boss ID gGT->bossID); diff --git a/decompile/General/HOWL/h109_Music_AsyncParseBanks.c b/decompile/General/HOWL/h109_Music_AsyncParseBanks.c index c3104728c..d6158ceb2 100644 --- a/decompile/General/HOWL/h109_Music_AsyncParseBanks.c +++ b/decompile/General/HOWL/h109_Music_AsyncParseBanks.c @@ -21,7 +21,7 @@ u_int DECOMP_Music_AsyncParseBanks(void) goto PARSE_FINISH; // If you're in a Boss Race - if (gGT->gameMode1 < 0) + if ((gGT->gameMode1 & ADVENTURE_BOSS) != 0) { index = sdata->songBankBossID[gGT->bossID]; } @@ -210,7 +210,7 @@ u_int DECOMP_Music_AsyncParseBanks(void) // If you're in a Boss Race // 0x80000000 - if (gGT->gameMode1 < 0) + if ((gGT->gameMode1 & ADVENTURE_BOSS) != 0) { index = 0x19; } diff --git a/decompile/General/LOAD/LOAD_31_DriverMPK.c b/decompile/General/LOAD/LOAD_31_DriverMPK.c index 490be38fc..13e45d3fc 100644 --- a/decompile/General/LOAD/LOAD_31_DriverMPK.c +++ b/decompile/General/LOAD/LOAD_31_DriverMPK.c @@ -133,7 +133,7 @@ void DECOMP_LOAD_DriverMPK(unsigned int param_1,int levelLOD) // high lod model (temporary workaround) DECOMP_LOAD_AppendQueue( 0, LT_GETADDR, - BI_RACERMODELHI + 0xF, + BI_RACERMODELHI + NITROS_OXIDE, &data.driverModelExtras[0],cbDRAM); lastFileIndexMPK = BI_ADVENTUREPACK + data.characterIDs[0]; diff --git a/decompile/General/LOAD/LOAD_44_TenStages.c b/decompile/General/LOAD/LOAD_44_TenStages.c index 7147fd346..4e48589f5 100644 --- a/decompile/General/LOAD/LOAD_44_TenStages.c +++ b/decompile/General/LOAD/LOAD_44_TenStages.c @@ -367,7 +367,7 @@ int DECOMP_LOAD_TenStages(struct GameTracker* gGT, int loadingStage, struct BigH // Time Trial MPK DECOMP_LOAD_AppendQueue(0, LT_GETADDR, - BI_TIMETRIALPACK + 0xF, + BI_TIMETRIALPACK + NITROS_OXIDE, &sdata->ptrMPK, cbDRAM); break; #endif diff --git a/decompile/General/MAIN/MainStats_01_RestartRaceCountLoss.c b/decompile/General/MAIN/MainStats_01_RestartRaceCountLoss.c index 5515699ed..8da51da47 100644 --- a/decompile/General/MAIN/MainStats_01_RestartRaceCountLoss.c +++ b/decompile/General/MAIN/MainStats_01_RestartRaceCountLoss.c @@ -53,7 +53,7 @@ void DECOMP_MainStats_RestartRaceCountLoss(void) countPtr = &sdata->advProgress.timesLostRacePerLev[0]; // if you're in boss mode - if (gameMode1 < 0) + if ((gameMode1 & ADVENTURE_BOSS) != 0) { // in boss index = gGT->bossID; diff --git a/decompile/General/PlayLevel/PlayLevel_0_UpdateLapStats.c b/decompile/General/PlayLevel/PlayLevel_0_UpdateLapStats.c index e7d2de3af..d6431124a 100644 --- a/decompile/General/PlayLevel/PlayLevel_0_UpdateLapStats.c +++ b/decompile/General/PlayLevel/PlayLevel_0_UpdateLapStats.c @@ -132,10 +132,8 @@ void DECOMP_PlayLevel_UpdateLapStats(void) { #ifndef USE_ONLINE if ( - // If you're in Arcade, or - // If you're in Adventure, or - // If you're in Time Trial - ((gGT->gameMode1 & 0x4a0000) != 0) && + + ((gGT->gameMode1 & (ARCADE_MODE | ADVENTURE_MODE | TIME_TRIAL)) != 0) && //player of any kind (currDriver->instSelf->thread->modelIndex == DYNAMIC_PLAYER) @@ -198,7 +196,7 @@ void DECOMP_PlayLevel_UpdateLapStats(void) // === Run on first frame that race ends === // if total event hasn't finished (gGT->gameMode1) - if ((gGT->gameMode1 & 0x200000) == 0) + if ((gGT->gameMode1 & END_OF_RACE) == 0) { // set driver placement rank, based on // how many drivers have finished the race diff --git a/decompile/General/UI/UI_09_Map_DrawMap.c b/decompile/General/UI/UI_09_Map_DrawMap.c index d9578b0e5..7acd77feb 100644 --- a/decompile/General/UI/UI_09_Map_DrawMap.c +++ b/decompile/General/UI/UI_09_Map_DrawMap.c @@ -98,7 +98,7 @@ void UI_Map_DrawMap_ExtraFunc(struct Icon* icon, POLY_FT4* p, short posX, short // 12% size short len = (sizeX * 125) / 1000; - if((sdata->gGT->gameMode1 & 0x2000) != 0) + if((sdata->gGT->gameMode1 & MAIN_MENU) != 0) { // 12% from each side leftX += len; diff --git a/decompile/General/UI/UI_43_DrawRankedDrivers.c b/decompile/General/UI/UI_43_DrawRankedDrivers.c index a42784693..d3ce6921c 100644 --- a/decompile/General/UI/UI_43_DrawRankedDrivers.c +++ b/decompile/General/UI/UI_43_DrawRankedDrivers.c @@ -120,7 +120,7 @@ void DECOMP_UI_DrawRankedDrivers(void) iVar14 = 4; // If you're in a Boss Race - if (gGT->gameMode1 < 0) + if ((gGT->gameMode1 & ADVENTURE_BOSS)!= 0) { // Show 2 racers iVar14 = 2; diff --git a/decompile/General/UI/UI_52_VsWaitForPressX.c b/decompile/General/UI/UI_52_VsWaitForPressX.c index 503791ff4..bceaf6aad 100644 --- a/decompile/General/UI/UI_52_VsWaitForPressX.c +++ b/decompile/General/UI/UI_52_VsWaitForPressX.c @@ -57,7 +57,7 @@ void DECOMP_UI_VsWaitForPressX(void) } // If you're in Battle Mode - if ((gGT->gameMode1 & 0x20) != 0) + if ((gGT->gameMode1 & BATTLE_MODE) != 0) { // ivar9 0x157: YOU HIT // ivar9 0x158: HIT YOU diff --git a/decompile/General/UI/UI_55_RaceEnd_MenuProc.c b/decompile/General/UI/UI_55_RaceEnd_MenuProc.c index 67159b104..c401459dd 100644 --- a/decompile/General/UI/UI_55_RaceEnd_MenuProc.c +++ b/decompile/General/UI/UI_55_RaceEnd_MenuProc.c @@ -169,7 +169,7 @@ void DECOMP_UI_RaceEnd_MenuProc(struct RectMenu* menu) } // If you're in a Boss Race - if (gGT->gameMode1 < 0) + if ((gGT->gameMode1 & ADVENTURE_BOSS) != 0) sdata->Loading.OnBegin.AddBitsConfig8 |= SPAWN_AT_BOSS; DECOMP_MainRaceTrack_RequestLoad(gGT->prevLEV); diff --git a/decompile/General/Vehicle/VehBirth_7_NonGhost.c b/decompile/General/Vehicle/VehBirth_7_NonGhost.c index 7e9e2014b..0ae212ce2 100644 --- a/decompile/General/Vehicle/VehBirth_7_NonGhost.c +++ b/decompile/General/Vehicle/VehBirth_7_NonGhost.c @@ -19,7 +19,7 @@ void DECOMP_VehBirth_NonGhost(struct Thread* t, int index) struct GameTracker* gGT = sdata->gGT; int id = data.characterIDs[0]; - if((gGT->gameMode1 & 0x2000) == 0) + if((gGT->gameMode1 & MAIN_MENU) == 0) { id = data.characterIDs[index]; } @@ -85,7 +85,7 @@ void DECOMP_VehBirth_NonGhost(struct Thread* t, int index) DECOMP_VehBirth_SetConsts(d); // if you are in cutscene or in main menu - if((gGT->gameMode1 & 0x20002000) != 0) + if((gGT->gameMode1 & (GAME_CUTSCENE | MAIN_MENU)) != 0) { // dont update, make invisible t->funcThTick = DECOMP_VehBirth_NullThread; diff --git a/decompile/General/Vehicle/VehPhysGeneral_5_SetHeldItem.c b/decompile/General/Vehicle/VehPhysGeneral_5_SetHeldItem.c index 714fa59b0..eb4c5d266 100644 --- a/decompile/General/Vehicle/VehPhysGeneral_5_SetHeldItem.c +++ b/decompile/General/Vehicle/VehPhysGeneral_5_SetHeldItem.c @@ -191,7 +191,7 @@ void DECOMP_VehPhysGeneral_SetHeldItem(struct Driver* driver) { } // In Boss race - if (gGT->gameMode1 & ADVENTURE_BOSS) + if ((gGT->gameMode1 & ADVENTURE_BOSS) != 0) { bossFails = sdata->advProgress.timesLostBossRace[gGT->bossID]; diff --git a/decompile/General/Vehicle/VehPickupItem_4_ShootNow.c b/decompile/General/Vehicle/VehPickupItem_4_ShootNow.c index c430f546b..01d5e39e5 100644 --- a/decompile/General/Vehicle/VehPickupItem_4_ShootNow.c +++ b/decompile/General/Vehicle/VehPickupItem_4_ShootNow.c @@ -63,7 +63,7 @@ void DECOMP_VehPickupItem_ShootNow(struct Driver* d, int weaponID, int flags) if(victim == 0) { // if not battle mode - if((gGT->gameMode1 & 0x20) == 0) + if((gGT->gameMode1 & BATTLE_MODE) == 0) { if(gGT->elapsedEventTime & 1) { diff --git a/include/ovr_232.h b/include/ovr_232.h index 72fd5ac31..c88144844 100644 --- a/include/ovr_232.h +++ b/include/ovr_232.h @@ -1,3 +1,35 @@ +#define PRIZE_TROPHY_RACE 6 +#define PRIZE_BOSS_KEY 0x5e +#define PRIZE_TOKEN_RACE 0x4c +#define PRIZE_RELIC_RACE 0x16 +#define PRIZE_CRYSTAL_CH 0x6f +#define PRIZE_GEM_CUP 0x6a +#define PRIZE_PLATINUM 0x3a +#define PRIZE_GOLD 0x28 + + +//gGT->bossID +enum BOSS_IDS +{ + BOSS_ROO = 0, + BOSS_PAPU, + BOSS_KOMODO, + BOSS_PINSTRIPE, + BOSS_OXIDE, + BOSS_OXIDEFINAL +}; + +enum WARPPAD_TYPE +{ + WARPPAD_LOCKED = 0, + WARPPAD_TROPHY, + WARPPAD_EMPTY, + WARPPAD_TOKEN, + WARPPAD_RELIC = 3, + WARPPAD_CRYSTALCH, + WARPPAD_GEMSTONE_ACTIVE = 4 +}; + struct MaskHint { From fa01d453a17f9ee1f53bdf36f7cfceecd1d9bf5f Mon Sep 17 00:00:00 2001 From: penta3 Date: Sun, 5 Oct 2025 02:50:32 -0300 Subject: [PATCH 3/7] lol --- config.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config.json b/config.json index d5b72ce85..b8405fc2d 100644 --- a/config.json +++ b/config.json @@ -6,8 +6,7 @@ "optimization": 4, "debug": 1, "psyq": 0, - "mininoob": 0, - "pch": "common.h", + "mininoob": 0, "8mb": 1 }, "versions": From 1db176bef97b627aa35b6c6432644e9665f5101f Mon Sep 17 00:00:00 2001 From: penta3 Date: Sun, 5 Oct 2025 21:55:36 -0300 Subject: [PATCH 4/7] big refactor plus mistakes --- decompile/General/221/221_Full.c | 8 +- decompile/General/222/222_Full.c | 18 +-- decompile/General/223/223_Full.c | 8 +- decompile/General/230/230_06_MM_Title_Init.c | 6 +- .../230/230_44_MM_Characters_DrawWindows.c | 8 +- .../230/230_56_MM_TrackSelect_MenuProc.c | 33 +++--- .../231_007_RB_Hazard_CollideWithDrivers.c | 12 +- .../231/231_008_RB_Hazard_CollideWithBucket.c | 3 +- .../231_013_RB_Potion_OnShatter_TeethSearch.c | 6 +- .../231/231_014_RB_Potion_ThTick_InAir.c | 34 +++--- .../General/231/231_015_RB_GenericMine_LInB.c | 2 +- .../231/231_016_RB_GenericMine_ThTick.c | 14 +-- .../231/231_018_RB_TNT_ThTick_ThrowOffHead.c | 6 +- .../231/231_024_RB_MovingExplosive_ThTick.c | 50 ++++---- .../231/231_026_RB_Warpball_FadeAway.c | 2 +- .../General/231/231_027_RB_Warpball_Death.c | 2 +- .../231/231_033_RB_Warpball_TurnAround.c | 10 +- .../231/231_035_RB_MaskWeapon_FadeAway.c | 8 +- .../231/231_036_RB_MaskWeapon_ThTick.c | 12 +- .../231/231_038_RB_ShieldDark_ThTick_Grow.c | 6 +- .../231/231_041_RB_RainCloud_FadeAway.c | 17 ++- .../General/231/231_042_RB_RainCloud_ThTick.c | 19 +-- .../General/231/231_043_RB_RainCloud_Init.c | 12 +- .../231/231_044_RB_Explosion_InitPotion.c | 11 +- .../231/231_045_RB_Explosion_InitGeneric.c | 6 +- .../General/231/231_048_RB_Blowup_Init.c | 18 +-- decompile/General/231/231_053_RB_Burst_Init.c | 12 +- .../231/231_055_RB_GetThread_ClosestTracker.c | 4 +- .../General/231/231_056_RB_Baron_ThTick.c | 12 +- decompile/General/231/231_061_068_RB_Crate.c | 6 +- .../General/231/231_069_072_RB_Crystal.c | 2 +- .../General/231/231_073_RB_Default_LInB.c | 6 +- .../General/231/231_082_085_RB_Armadillo.c | 8 +- .../General/231/231_086_088_RB_Fireball.c | 12 +- .../General/231/231_089_091_RB_FlameJet.c | 6 +- .../General/231/231_092_094_RB_Follower.c | 50 ++++---- decompile/General/231/231_095_098_RB_Fruit.c | 6 +- .../General/231/231_099_100_RB_Minecart.c | 4 +- decompile/General/231/231_104_109_RB_Plant.c | 6 +- decompile/General/231/231_110_113_RB_Seal.c | 2 +- .../General/231/231_114_115_RB_Snowball.c | 12 +- decompile/General/231/231_116_119_RB_Spider.c | 12 +- decompile/General/231/231_122_126_RB_Teeth.c | 14 +-- .../232/232_00_AH_WarpPad_GetSpawnPosRot.c | 6 +- .../232/232_03_AH_WarpPad_SpinRewards.c | 6 +- .../General/232/232_04_AH_WarpPad_ThTick.c | 52 ++++---- .../General/232/232_06_AH_WarpPad_LInB.c | 42 +++---- decompile/General/232/232_08_AH_Garage_Open.c | 2 +- .../General/232/232_09_AH_Garage_ThTick.c | 20 ++-- decompile/General/232/232_10_AH_Garage_LInB.c | 12 +- .../General/232/232_12_AH_SaveObj_ThTick.c | 6 +- .../General/232/232_13_AH_SaveObj_LInB.c | 12 +- decompile/General/232/232_15_AH_Door_ThTick.c | 82 +++++++------ decompile/General/232/232_16_AH_Door_LInB.c | 42 +++---- .../General/232/232_18_AH_Map_LoadSave_Full.c | 6 +- .../General/232/232_19_AH_Map_HubArrow.c | 20 ++-- .../232/232_20_AH_Map_HubArrowOutter.c | 16 +-- .../General/232/232_21_AH_Map_HubItems.c | 111 +++++++++--------- .../General/232/232_22_AH_Map_Warppads.c | 40 +++---- decompile/General/232/232_23_AH_Map_Main.c | 24 ++-- decompile/General/232/232_25_AH_Pause_Draw.c | 38 +++--- .../General/232/232_26_AH_Pause_Update.c | 2 +- .../232/232_27_AH_HintMenu_FiveArrows.c | 13 +- .../232/232_28_AH_HintMenu_MaskPosRot.c | 12 +- .../General/232/232_30_AH_MaskHint_Start.c | 14 +-- .../General/232/232_32_AH_MaskHint_SetAnim.c | 14 +-- .../232/232_33_AH_MaskHint_SpawnParticles.c | 2 +- .../General/232/232_35_AH_MaskHint_Update.c | 6 +- decompile/General/232/D232.c | 66 +++++------ decompile/General/232/R232.c | 2 +- .../233/233_22_CS_Camera_BoolGotoBoss.c | 4 +- .../General/233/233_32_CS_Podium_Stand_Init.c | 6 +- decompile/General/AltMods/16BY9/mods2.c | 4 +- .../General/BOTS/BOTS_08_ThTick_RevEngine.c | 8 +- decompile/General/BOTS/BOTS_09_MaskGrab.c | 4 +- decompile/General/CAMERA/CAM_19_ThTick.c | 6 +- .../General/GHOST/GhostReplay_00_ThTick.c | 12 +- .../General/GHOST/GhostTape_02_WriteMoves.c | 6 +- .../General/INSTANCE/INSTANCE_06_LevInitAll.c | 6 +- .../LinkedCollide/LinkedCollide_0_Radius.c | 6 +- .../LinkedCollide/LinkedCollide_2_Hitbox.c | 8 +- .../PROC/PROC_08_CollidePointWithSelf.c | 6 +- .../Particle/Particle_1_FuncPtr_SpitTire.c | 2 +- .../Particle_2_FuncPtr_ExhaustUnderwater.c | 2 +- .../PushBuffer/PushBuffer_04_SetMatrixVP.c | 20 ++-- .../UI/UI_07_INSTANCE_BirthWithThread.c | 16 +-- decompile/General/UI/UI_08_INSTANCE_InitAll.c | 6 +- decompile/General/UI/UI_09_Map_DrawMap.c | 41 ++++--- decompile/General/UI/UI_10_Map_GetIconPos.c | 47 +++----- .../General/UI/UI_11_Map_DrawAdvPlayer.c | 17 ++- decompile/General/UI/UI_12_Map_DrawRawIcon.c | 18 +-- decompile/General/UI/UI_13_Map_DrawDrivers.c | 10 +- decompile/General/UI/UI_14_Map_DrawGhosts.c | 11 +- decompile/General/UI/UI_15_Map_DrawTracking.c | 20 ++-- .../General/UI/UI_25_BattleDrawHeadArrows.c | 10 +- decompile/General/UI/UI_26_TrackerSelf.c | 6 +- decompile/General/UI/UI_27_DrawPosSuffix.c | 2 +- .../General/UI/UI_43_DrawRankedDrivers.c | 6 +- .../General/UI/UI_44_RenderFrame_Racing.c | 38 +++--- .../General/UI/UI_46_RenderFrame_CrystChall.c | 6 +- .../General/Vehicle/VehBirth_0_TeleportSelf.c | 6 +- .../Vehicle/VehPhysForce_2_OnApplyForces.c | 2 +- .../Vehicle/VehPickupItem_1_MaskUseWeapon.c | 13 +- .../Vehicle/VehPickupItem_4_ShootNow.c | 40 +++---- .../Vehicle/VehStuckProc_02_MaskGrab_Update.c | 4 +- .../VehStuckProc_04_MaskGrab_Animate.c | 16 +-- .../Vehicle/VehStuckProc_05_MaskGrab_Init.c | 14 +-- .../VehStuckProc_08_PlantEaten_Animate.c | 8 +- .../VehStuckProc_12_RevEngine_PhysLinear.c | 2 +- decompile/General/Vehicle/VehTurbo_2_ThTick.c | 4 +- include/ctr_math.h | 2 + include/decomp_functions.h | 28 ++--- include/gpu.h | 2 +- include/namespace_Level.h | 17 +++ include/ovr_231.h | 6 +- include/ovr_232.h | 71 +++++------ include/psn00bsdk/include/psxgte.h | 9 +- 117 files changed, 901 insertions(+), 870 deletions(-) diff --git a/decompile/General/221/221_Full.c b/decompile/General/221/221_Full.c index 35dabcd21..e7e04d55d 100644 --- a/decompile/General/221/221_Full.c +++ b/decompile/General/221/221_Full.c @@ -74,8 +74,8 @@ void DECOMP_CC_EndEvent_DrawMenu() elapsedFrames, FPS_DOUBLE(0x14)); - sdata->ptrMenuCrystal->matrix.t[0] = DECOMP_UI_ConvertX_2(posXY[0], 0x200); - sdata->ptrMenuCrystal->matrix.t[1] = DECOMP_UI_ConvertY_2(posXY[1], 0x200); + sdata->ptrMenuCrystal->matrix.t.x = DECOMP_UI_ConvertX_2(posXY[0], 0x200); + sdata->ptrMenuCrystal->matrix.t.y = DECOMP_UI_ConvertY_2(posXY[1], 0x200); DECOMP_UI_DrawNumCrystal(posXY[0]+0xf, posXY[1]-0x10, driver); @@ -163,8 +163,8 @@ void DECOMP_CC_EndEvent_DrawMenu() // make token visible tokenInst->flags &= ~(HIDE_MODEL); - tokenInst->matrix.t[0] = DECOMP_UI_ConvertX_2(posXY[0], 0x200); - tokenInst->matrix.t[1] = DECOMP_UI_ConvertY_2(0xA2-0x18, 0x200); + tokenInst->matrix.t.x = DECOMP_UI_ConvertX_2(posXY[0], 0x200); + tokenInst->matrix.t.y = DECOMP_UI_ConvertY_2(0xA2-0x18, 0x200); // grow token after first second if(elapsedFrames > FPS_DOUBLE(30)) diff --git a/decompile/General/222/222_Full.c b/decompile/General/222/222_Full.c index f268ac3de..9ae7deb79 100644 --- a/decompile/General/222/222_Full.c +++ b/decompile/General/222/222_Full.c @@ -181,8 +181,8 @@ void DECOMP_AA_EndEvent_DrawMenu(void) elapsedFrames, FPS_DOUBLE(8)); hudToken->flags &= ~HIDE_MODEL; - hudToken->matrix.t[0] = hudT->matrix.t[0]; - hudToken->matrix.t[1] = DECOMP_UI_ConvertY_2(letterPos[1] + 0x18, 0x200); + hudToken->matrix.t.x = hudT->matrix.t.x; + hudToken->matrix.t.y = DECOMP_UI_ConvertY_2(letterPos[1] + 0x18, 0x200); // variable reuse, frame timers lerpStartY = FPS_DOUBLE(120); @@ -218,8 +218,8 @@ void DECOMP_AA_EndEvent_DrawMenu(void) for (i = 0; i < 3; i++) { - hudLetters[i]->matrix.t[0] = DECOMP_UI_ConvertX_2(letterPos[0] + (scaleDown * (i * 12)) + (i * 29), 0x200); - hudLetters[i]->matrix.t[1] = DECOMP_UI_ConvertY_2(letterPos[1] - (i & 1), 0x200); + hudLetters[i]->matrix.t.x = DECOMP_UI_ConvertX_2(letterPos[0] + (scaleDown * (i * 12)) + (i * 29), 0x200); + hudLetters[i]->matrix.t.y = DECOMP_UI_ConvertY_2(letterPos[1] - (i & 1), 0x200); } } @@ -239,16 +239,16 @@ void DECOMP_AA_EndEvent_DrawMenu(void) (elapsedFrames > FPS_DOUBLE(6*i)) && // letter not fully off-screen - (-300 < hudLetters[i]->matrix.t[1]) + (-300 < hudLetters[i]->matrix.t.y) ) { letter = hudLetters[i]->thread->object; // move X position (yes, C-Letter only, Naughty Dog bug?) - hudLetters[0]->matrix.t[0] += letter->vel[0]; + hudLetters[0]->matrix.t.x += letter->vel[0]; // make the letter fall off the screen - hudLetters[i]->matrix.t[1] -= letter->vel[1]; + hudLetters[i]->matrix.t.y -= letter->vel[1]; if (FPS_HALF(-0x14) < letter->vel[1]) { @@ -633,8 +633,8 @@ void DECOMP_AA_EndEvent_DisplayTime(short driverId, short param_2) lerpEndX, lerpEndY, currFrame, endFrame); - bigNum->matrix.t[0] = posXY[0]; - bigNum->matrix.t[1] = posXY[1]; + bigNum->matrix.t.x = posXY[0]; + bigNum->matrix.t.y = posXY[1]; // interpolate scale to 0x1e00 DECOMP_UI_Lerp2D_Linear( diff --git a/decompile/General/223/223_Full.c b/decompile/General/223/223_Full.c index 1433f47e9..5216eff46 100644 --- a/decompile/General/223/223_Full.c +++ b/decompile/General/223/223_Full.c @@ -261,8 +261,8 @@ void DECOMP_RR_EndEvent_DrawMenu(void) } } - relic->matrix.t[0] = DECOMP_UI_ConvertX_2(pos[0], 0x100); - relic->matrix.t[1] = DECOMP_UI_ConvertY_2(0xa2, 0x100); + relic->matrix.t.x = DECOMP_UI_ConvertX_2(pos[0], 0x100); + relic->matrix.t.y = DECOMP_UI_ConvertY_2(0xa2, 0x100); } @@ -289,8 +289,8 @@ void DECOMP_RR_EndEvent_DrawMenu(void) pos[1] = 0x79; - sdata->ptrTimebox1->matrix.t[0] = DECOMP_UI_ConvertX_2(pos[0], 0x100); - sdata->ptrTimebox1->matrix.t[1] = DECOMP_UI_ConvertY_2(pos[1], 0x100); + sdata->ptrTimebox1->matrix.t.x = DECOMP_UI_ConvertX_2(pos[0], 0x100); + sdata->ptrTimebox1->matrix.t.y = DECOMP_UI_ConvertY_2(pos[1], 0x100); // Draw 'x' before number of crates DecalFont_DrawLine("x", pos[0] + 0x14, pos[1] - 10, 2, 0); diff --git a/decompile/General/230/230_06_MM_Title_Init.c b/decompile/General/230/230_06_MM_Title_Init.c index e65221042..6d56271bb 100644 --- a/decompile/General/230/230_06_MM_Title_Init.c +++ b/decompile/General/230/230_06_MM_Title_Init.c @@ -71,9 +71,9 @@ void DECOMP_MM_Title_Init(void) *(int*)&inst->matrix.m[2][0] = 0; *(int*)&inst->matrix.m[2][2] = 0x5000; - inst->matrix.t[0] = 0; - inst->matrix.t[1] = 0; - inst->matrix.t[2] = 0; + inst->matrix.t.x = 0; + inst->matrix.t.y = 0; + inst->matrix.t.z = 0; inst->flags |= HIDE_MODEL; diff --git a/decompile/General/230/230_44_MM_Characters_DrawWindows.c b/decompile/General/230/230_44_MM_Characters_DrawWindows.c index 11382dbf1..f2c857437 100644 --- a/decompile/General/230/230_44_MM_Characters_DrawWindows.c +++ b/decompile/General/230/230_44_MM_Characters_DrawWindows.c @@ -162,9 +162,9 @@ void DECOMP_MM_Characters_DrawWindows(int boolShowDrivers) gGT->cameraDC[iVar6].cameraMode = 3; // Set position of player - iVar10->matrix.t[0] = D230.csm_instPos[0]; - iVar10->matrix.t[1] = D230.csm_instPos[1]; - iVar10->matrix.t[2] = D230.csm_instPos[2]; + iVar10->matrix.t.x = D230.csm_instPos[0]; + iVar10->matrix.t.y = D230.csm_instPos[1]; + iVar10->matrix.t.z = D230.csm_instPos[2]; psVar11 = &D230.timerPerPlayer[iVar6]; sVar9 = *psVar11 + -1; @@ -205,7 +205,7 @@ void DECOMP_MM_Characters_DrawWindows(int boolShowDrivers) iVar6 = (0x1000 - iVar5) * (int)D230.unkCharacterWindows >> 0xc; } - iVar10->matrix.t[0] += iVar6 * iVar8; + iVar10->matrix.t.x += iVar6 * iVar8; } // driver rotation diff --git a/decompile/General/230/230_56_MM_TrackSelect_MenuProc.c b/decompile/General/230/230_56_MM_TrackSelect_MenuProc.c index 1b70b3313..1727419bf 100644 --- a/decompile/General/230/230_56_MM_TrackSelect_MenuProc.c +++ b/decompile/General/230/230_56_MM_TrackSelect_MenuProc.c @@ -623,32 +623,37 @@ void DECOMP_MM_TrackSelect_MenuProc(struct RectMenu* menu) // map 4 is blue and shifted 1px downwards // map 5 is blue and shifted 1px upwards // map 6 is black and shifted 6px downwards and 12px to the right + + for (iVar18 = 0; iVar18 < 6; iVar18++) { iVar10 = ((((u_int)bVar1 - (u_int)bVar2) + (u_int)bVar3) - (u_int)bVar4); - - DECOMP_UI_Map_DrawMap - ( - // top half - iconMap0, - - // bottom half - iconMap1, - - // X + + SVec2 mapPos; + + mapPos.x = // X D230.drawMapOffset[iVar18].offsetX + p.x + (D230.transitionMeta_trackSel[2].currX - D230.transitionMeta_trackSel[1].currX) + (0xb0 >> 1) + - (iVar9 >> 1), - - // Y + (iVar9 >> 1); + mapPos.y = // Y D230.drawMapOffset[iVar18].offsetY + p.y + (D230.transitionMeta_trackSel[2].currY - D230.transitionMeta_trackSel[1].currY) + 0x49+0x22+ 0x10 + // idk how bitshifting pulls 0x10 in ghidra, but that's it - (iVar10 >> 1), + (iVar10 >> 1); + + DECOMP_UI_Map_DrawMap + ( + // top half + iconMap0, + + // bottom half + iconMap1, + + &mapPos, // pointer to PrimMem struct &gGT->backBuffer->primMem, diff --git a/decompile/General/231/231_007_RB_Hazard_CollideWithDrivers.c b/decompile/General/231/231_007_RB_Hazard_CollideWithDrivers.c index ca10c02db..ec1b32aa0 100644 --- a/decompile/General/231/231_007_RB_Hazard_CollideWithDrivers.c +++ b/decompile/General/231/231_007_RB_Hazard_CollideWithDrivers.c @@ -10,7 +10,7 @@ struct Instance* DECOMP_RB_Hazard_CollideWithDrivers( struct Driver* driver; struct Instance* driverInst; - int dist[3]; + Vec3 dist; int modelID; int distCheck; @@ -37,14 +37,14 @@ struct Instance* DECOMP_RB_Hazard_CollideWithDrivers( for(j = 0; j < 3; j++) { - dist[j] = driverInst->matrix.t[j] - weaponInst->matrix.t[j]; - dist[j] *= dist[j]; + dist.v[j] = driverInst->matrix.t.v[j] - weaponInst->matrix.t.v[j]; + dist.v[j] *= dist.v[j]; } modelID = weaponInst->model->id; // 2D collision (barrel, warpball) - distCheck = dist[0] + dist[2]; + distCheck = dist.x + dist.z; // to be more optimal, just do weaponInst->thread->funcThTick == GenericMine_ThTick if ( @@ -54,7 +54,7 @@ struct Instance* DECOMP_RB_Hazard_CollideWithDrivers( ) { // upgrade to 2D collision to 3D sphere - distCheck += dist[1]; + distCheck += dist.y; } // 2D collision, or 3D sphere @@ -62,7 +62,7 @@ struct Instance* DECOMP_RB_Hazard_CollideWithDrivers( { // wasted check for 3D sphere, // also upgrades 2D collision to 3D cylinder - if( dist[1] < ( hitRadius << 2 ) ) + if( dist.y < ( hitRadius << 2 ) ) { return driverInst; } diff --git a/decompile/General/231/231_008_RB_Hazard_CollideWithBucket.c b/decompile/General/231/231_008_RB_Hazard_CollideWithBucket.c index 8c2ecf464..bba7b5440 100644 --- a/decompile/General/231/231_008_RB_Hazard_CollideWithBucket.c +++ b/decompile/General/231/231_008_RB_Hazard_CollideWithBucket.c @@ -31,7 +31,8 @@ struct Instance* DECOMP_RB_Hazard_CollideWithBucket( for(i = 0; i < 3; i++) { - distComponent = threadInst->matrix.t[i] - weaponInst->matrix.t[i]; + + distComponent = threadInst->matrix.t.v[i] - weaponInst->matrix.t.v[i]; distComponent *= distComponent; distCheck += distComponent; } diff --git a/decompile/General/231/231_013_RB_Potion_OnShatter_TeethSearch.c b/decompile/General/231/231_013_RB_Potion_OnShatter_TeethSearch.c index 32e6bd503..32e3b31b3 100644 --- a/decompile/General/231/231_013_RB_Potion_OnShatter_TeethSearch.c +++ b/decompile/General/231/231_013_RB_Potion_OnShatter_TeethSearch.c @@ -10,9 +10,9 @@ void DECOMP_RB_Potion_OnShatter_TeethSearch(struct Instance* inst) #define SPS \ ((struct ScratchpadStruct*)0x1f800108) - SPS->Input1.pos[0] = (short)inst->matrix.t[0]; - SPS->Input1.pos[1] = (short)inst->matrix.t[1]; - SPS->Input1.pos[2] = (short)inst->matrix.t[2]; + SPS->Input1.pos[0] = (short)inst->matrix.t.x; + SPS->Input1.pos[1] = (short)inst->matrix.t.y; + SPS->Input1.pos[2] = (short)inst->matrix.t.z; SPS->Input1.hitRadius = 0x140; SPS->Input1.hitRadiusSquared = 0x19000; SPS->Input1.modelID = inst->model->id; diff --git a/decompile/General/231/231_014_RB_Potion_ThTick_InAir.c b/decompile/General/231/231_014_RB_Potion_ThTick_InAir.c index 7bc48305b..61a40e1a1 100644 --- a/decompile/General/231/231_014_RB_Potion_ThTick_InAir.c +++ b/decompile/General/231/231_014_RB_Potion_ThTick_InAir.c @@ -20,9 +20,9 @@ void DECOMP_RB_Potion_ThTick_InAir(struct Thread* t) mw = t->object; // adjust position, by velocity, do NOT use parenthesis - inst->matrix.t[0] += mw->velocity[0] * gGT->elapsedTimeMS >> 5; - inst->matrix.t[1] += mw->velocity[1] * gGT->elapsedTimeMS >> 5; - inst->matrix.t[2] += mw->velocity[2] * gGT->elapsedTimeMS >> 5; + inst->matrix.t.x += mw->velocity[0] * gGT->elapsedTimeMS >> 5; + inst->matrix.t.y += mw->velocity[1] * gGT->elapsedTimeMS >> 5; + inst->matrix.t.z += mw->velocity[2] * gGT->elapsedTimeMS >> 5; // gravity, decrease velocity over time mw->velocity[1] -= ((gGT->elapsedTimeMS << 2) >> 5); @@ -36,13 +36,13 @@ void DECOMP_RB_Potion_ThTick_InAir(struct Thread* t) if(mw->cooldown < 0) mw->cooldown = 0; - posBottom[0] = inst->matrix.t[0]; - posBottom[1] = inst->matrix.t[1] - 0x40; - posBottom[2] = inst->matrix.t[2]; + posBottom[0] = inst->matrix.t.x; + posBottom[1] = inst->matrix.t.y - 0x40; + posBottom[2] = inst->matrix.t.z; - posTop[0] = inst->matrix.t[0]; - posTop[1] = inst->matrix.t[1] + 0x100; - posTop[2] = inst->matrix.t[2]; + posTop[0] = inst->matrix.t.x; + posTop[1] = inst->matrix.t.y + 0x100; + posTop[2] = inst->matrix.t.z; SPS->Union.QuadBlockColl.searchFlags = 0x41; SPS->Union.QuadBlockColl.qbFlagsWanted = 0x1040; @@ -74,7 +74,7 @@ void DECOMP_RB_Potion_ThTick_InAir(struct Thread* t) VehPhysForce_RotAxisAngle(&inst->matrix, &SPS->Set2.normalVec[0], 0); iVar4 = SPS->Union.QuadBlockColl.hitPos[1]; - iVar5 = inst->matrix.t[1]; + iVar5 = inst->matrix.t.y; if (iVar4 + 0x30 < iVar5) return; @@ -83,7 +83,7 @@ void DECOMP_RB_Potion_ThTick_InAir(struct Thread* t) if (mw->cooldown == 0) { // set position to where quadblock was hit - inst->matrix.t[1] = iVar4; + inst->matrix.t.y = iVar4; mw->stopFallAtY = iVar4; mw->cooldown = 0xf00; // 3.84s @@ -98,11 +98,11 @@ void DECOMP_RB_Potion_ThTick_InAir(struct Thread* t) // if instance is under hitPos, move up if (iVar5 <= iVar4) - inst->matrix.t[1] = iVar4; + inst->matrix.t.y = iVar4; // if distance to move back to quadblock < velocity - if (mw->velocity[1] < (inst->matrix.t[1] - iVar5) + 0x28) - mw->velocity[1] = (inst->matrix.t[1] - iVar5) + 0x28; + if (mw->velocity[1] < (inst->matrix.t.y - iVar5) + 0x28) + mw->velocity[1] = (inst->matrix.t.y - iVar5) + 0x28; return; } @@ -111,9 +111,9 @@ void DECOMP_RB_Potion_ThTick_InAir(struct Thread* t) // check again with range [-0x900, 0x100] // posBottom - posBottom[0] = inst->matrix.t[0]; - posBottom[1] = inst->matrix.t[1] - 0x900; - posBottom[2] = inst->matrix.t[2]; + posBottom[0] = inst->matrix.t.x; + posBottom[1] = inst->matrix.t.y - 0x900; + posBottom[2] = inst->matrix.t.z; COLL_SearchBSP_CallbackQUADBLK((u_int*)&posBottom, (u_int*)&posTop, SPS, 0); diff --git a/decompile/General/231/231_015_RB_GenericMine_LInB.c b/decompile/General/231/231_015_RB_GenericMine_LInB.c index eb1d4cc6d..94e45d30b 100644 --- a/decompile/General/231/231_015_RB_GenericMine_LInB.c +++ b/decompile/General/231/231_015_RB_GenericMine_LInB.c @@ -53,7 +53,7 @@ void DECOMP_RB_GenericMine_LInB(struct Instance *inst) mw->boolDestroyed = 0; mw->frameCount_DontHurtParent = 0; mw->extraFlags = 0; - mw->stopFallAtY = inst->matrix.t[1]; + mw->stopFallAtY = inst->matrix.t.y; DECOMP_RB_MinePool_Add(mw); diff --git a/decompile/General/231/231_016_RB_GenericMine_ThTick.c b/decompile/General/231/231_016_RB_GenericMine_ThTick.c index 49bb5684f..a3e812971 100644 --- a/decompile/General/231/231_016_RB_GenericMine_ThTick.c +++ b/decompile/General/231/231_016_RB_GenericMine_ThTick.c @@ -76,10 +76,10 @@ void DECOMP_RB_GenericMine_ThTick(struct Thread* t) // increment posY by velY * time // do NOT use parenthesis - inst->matrix.t[1] += (mw->velocity[1] * gGT->elapsedTimeMS) >> 5; + inst->matrix.t.y += (mw->velocity[1] * gGT->elapsedTimeMS) >> 5; - if (inst->matrix.t[1] < mw->stopFallAtY) { - inst->matrix.t[1] = mw->stopFallAtY; + if (inst->matrix.t.y < mw->stopFallAtY) { + inst->matrix.t.y = mw->stopFallAtY; } // decrease velocity by time, this is artificial gravity (negative acceleration) @@ -291,9 +291,9 @@ void DECOMP_RB_GenericMine_ThTick(struct Thread* t) instCrate->matrix.m[2][1] = inst->matrix.m[2][1]; // X, Y, Z positions of TNT instanece - instCrate->matrix.t[0] = inst->matrix.t[0]; - instCrate->matrix.t[1] = inst->matrix.t[1]; - instCrate->matrix.t[2] = inst->matrix.t[2]; + instCrate->matrix.t.x = inst->matrix.t.x; + instCrate->matrix.t.y = inst->matrix.t.y; + instCrate->matrix.t.z = inst->matrix.t.z; instCrate->thread->funcThDestroy = PROC_DestroyInstance; @@ -314,7 +314,7 @@ void DECOMP_RB_GenericMine_ThTick(struct Thread* t) tnt->driverTarget = d; // stopFallAtY (where it explodes) - tnt->stopFallAtY = inst->matrix.t[1]; + tnt->stopFallAtY = inst->matrix.t.y; // driver -> instTntRecv d->instTntRecv = instCrate; diff --git a/decompile/General/231/231_018_RB_TNT_ThTick_ThrowOffHead.c b/decompile/General/231/231_018_RB_TNT_ThTick_ThrowOffHead.c index e0b7a2284..9cd531297 100644 --- a/decompile/General/231/231_018_RB_TNT_ThTick_ThrowOffHead.c +++ b/decompile/General/231/231_018_RB_TNT_ThTick_ThrowOffHead.c @@ -13,12 +13,12 @@ void DECOMP_RB_TNT_ThTick_ThrowOffHead(struct Thread* t) mw = t->object; // do NOT use parenthesis - inst->matrix.t[1] += (mw->velocity[1] * gGT->elapsedTimeMS) >> 5; + inst->matrix.t.y += (mw->velocity[1] * gGT->elapsedTimeMS) >> 5; if (mw->stopFallAtY == 0x3fff) - mw->stopFallAtY = mw->driverTarget->instSelf->matrix.t[1]; + mw->stopFallAtY = mw->driverTarget->instSelf->matrix.t.y; - if (inst->matrix.t[1] <= mw->stopFallAtY) + if (inst->matrix.t.y <= mw->stopFallAtY) { // plays tnt explosion sound 3D PlaySound3D(0x3d,inst); diff --git a/decompile/General/231/231_024_RB_MovingExplosive_ThTick.c b/decompile/General/231/231_024_RB_MovingExplosive_ThTick.c index 10e589ebc..8a3c2128c 100644 --- a/decompile/General/231/231_024_RB_MovingExplosive_ThTick.c +++ b/decompile/General/231/231_024_RB_MovingExplosive_ThTick.c @@ -108,8 +108,8 @@ LAB_800adc08:; if (tw->framesSeekMine == 0) { // get distance between tracker and the driver being chased - iVar6 = (driverTarget->posCurr.x >> 8) - inst->matrix.t[0]; - iVar8 = (driverTarget->posCurr.z >> 8) - inst->matrix.t[2]; + iVar6 = (driverTarget->posCurr.x >> 8) - inst->matrix.t.x; + iVar8 = (driverTarget->posCurr.z >> 8) - inst->matrix.t.z; tw->distanceToTarget = iVar6 * iVar6 + iVar8 * iVar8; LAB_800add14: @@ -130,8 +130,8 @@ LAB_800adc08:; if (instTNT != 0) { // Get X and Y differences between two instances - iVar6 = instTNT->matrix.t[0] - inst->matrix.t[0]; - iVar8 = instTNT->matrix.t[1] - inst->matrix.t[2]; + iVar6 = instTNT->matrix.t.x - inst->matrix.t.x; + iVar8 = instTNT->matrix.t.y - inst->matrix.t.z; goto LAB_800add14; } @@ -226,17 +226,17 @@ LAB_800adc08:; if(p!=0) { - p->axis[0].startVal = inst->matrix.t[0] << 8; - p->axis[1].startVal = inst->matrix.t[1] << 8; - p->axis[2].startVal = inst->matrix.t[2] << 8; + p->axis[0].startVal = inst->matrix.t.x << 8; + p->axis[1].startVal = inst->matrix.t.y << 8; + p->axis[2].startVal = inst->matrix.t.z << 8; } } #endif int elapsedTime = gGT->elapsedTimeMS; - inst->matrix.t[0] += (((int)tw->vel[0] * elapsedTime) >> 5); - inst->matrix.t[1] += (((int)tw->vel[1] * elapsedTime) >> 5); - inst->matrix.t[2] += (((int)tw->vel[2] * elapsedTime) >> 5); + inst->matrix.t.x += (((int)tw->vel[0] * elapsedTime) >> 5); + inst->matrix.t.y += (((int)tw->vel[1] * elapsedTime) >> 5); + inst->matrix.t.z += (((int)tw->vel[2] * elapsedTime) >> 5); // If this is bomb if (modelID == DYNAMIC_BOMB) @@ -257,13 +257,13 @@ LAB_800adc08:; ConvertRotToMatrix(&inst->matrix,(short*)&tw->dir); } - posA[0] = inst->matrix.t[0]; - posA[1] = inst->matrix.t[1] + -0x40; - posA[2] = inst->matrix.t[2]; + posA[0] = inst->matrix.t.x; + posA[1] = inst->matrix.t.y + -0x40; + posA[2] = inst->matrix.t.z; - posB[0] = inst->matrix.t[0]; - posB[1] = inst->matrix.t[1] + 0x100; - posB[2] = inst->matrix.t[2]; + posB[0] = inst->matrix.t.x; + posB[1] = inst->matrix.t.y + 0x100; + posB[2] = inst->matrix.t.z; #ifndef REBUILD_PC struct ScratchpadStruct* sps = (struct ScratchpadStruct*)0x1f800108; @@ -289,9 +289,9 @@ LAB_800adc08:; tw->vel[1] = -tw->vel[1]; tw->vel[2] = -tw->vel[2]; - inst->matrix.t[0] += ((int)tw->vel[0] * elapsedTime) >> 5; - inst->matrix.t[1] += ((int)tw->vel[1] * elapsedTime) >> 5; - inst->matrix.t[2] += ((int)tw->vel[2] * elapsedTime) >> 5; + inst->matrix.t.x += ((int)tw->vel[0] * elapsedTime) >> 5; + inst->matrix.t.y += ((int)tw->vel[1] * elapsedTime) >> 5; + inst->matrix.t.z += ((int)tw->vel[2] * elapsedTime) >> 5; DECOMP_RB_MovingExplosive_Explode(t,inst,tw); return; @@ -305,9 +305,9 @@ LAB_800adc08:; // look again for another quadblock LOWER inst->vertSplit = 0; - posA[0] = inst->matrix.t[0]; - posA[1] = inst->matrix.t[1] - 0x900; - posA[2] = inst->matrix.t[2]; + posA[0] = inst->matrix.t.x; + posA[1] = inst->matrix.t.y - 0x900; + posA[2] = inst->matrix.t.z; COLL_SearchBSP_CallbackQUADBLK((u_int*)&posA, (u_int*)&posB, sps, 0); @@ -349,9 +349,9 @@ LAB_800adc08:; } // position - inst->matrix.t[0] = sps->Union.QuadBlockColl.hitPos[0]; - inst->matrix.t[1] = sps->Union.QuadBlockColl.hitPos[1] + 0x30; - inst->matrix.t[2] = sps->Union.QuadBlockColl.hitPos[2]; + inst->matrix.t.x = sps->Union.QuadBlockColl.hitPos[0]; + inst->matrix.t.y = sps->Union.QuadBlockColl.hitPos[1] + 0x30; + inst->matrix.t.z = sps->Union.QuadBlockColl.hitPos[2]; } } else diff --git a/decompile/General/231/231_026_RB_Warpball_FadeAway.c b/decompile/General/231/231_026_RB_Warpball_FadeAway.c index 4fecf877d..771e06671 100644 --- a/decompile/General/231/231_026_RB_Warpball_FadeAway.c +++ b/decompile/General/231/231_026_RB_Warpball_FadeAway.c @@ -38,7 +38,7 @@ void DECOMP_RB_Warpball_FadeAway(struct Thread* t) inst->scale[1] = ((short*)0x800b2c88)[(frameId*3)+1]; inst->scale[2] = ((short*)0x800b2c88)[(frameId*3)+2]; - inst->matrix.t[1] = tw->distFromGround + ((int *)0x800b2cac)[frameId]; + inst->matrix.t.y = tw->distFromGround + ((int *)0x800b2cac)[frameId]; #ifdef USE_60FPS if(gGT->timer&1) diff --git a/decompile/General/231/231_027_RB_Warpball_Death.c b/decompile/General/231/231_027_RB_Warpball_Death.c index c6f7ae01f..f2483032e 100644 --- a/decompile/General/231/231_027_RB_Warpball_Death.c +++ b/decompile/General/231/231_027_RB_Warpball_Death.c @@ -10,7 +10,7 @@ void DECOMP_RB_Warpball_Death(struct Thread* t) // play sound of warpball death struct Instance* inst = t->inst; - tw->distFromGround = inst->matrix.t[1]; + tw->distFromGround = inst->matrix.t.y; PlaySound3D(0x4f, inst); // stop audio of moving diff --git a/decompile/General/231/231_033_RB_Warpball_TurnAround.c b/decompile/General/231/231_033_RB_Warpball_TurnAround.c index 028f405f2..a8c854060 100644 --- a/decompile/General/231/231_033_RB_Warpball_TurnAround.c +++ b/decompile/General/231/231_033_RB_Warpball_TurnAround.c @@ -30,9 +30,9 @@ void DECOMP_RB_Warpball_TurnAround(struct Thread* t) tw->vel[1] = -tw->vel[1]; tw->vel[2] = -tw->vel[2]; - inst->matrix.t[0] += ((int)tw->vel[0] * gGT->elapsedTimeMS) >> 5; - inst->matrix.t[1] += ((int)tw->vel[1] * gGT->elapsedTimeMS) >> 5; - inst->matrix.t[2] += ((int)tw->vel[2] * gGT->elapsedTimeMS) >> 5; + inst->matrix.t.x += ((int)tw->vel[0] * gGT->elapsedTimeMS) >> 5; + inst->matrix.t.y += ((int)tw->vel[1] * gGT->elapsedTimeMS) >> 5; + inst->matrix.t.z += ((int)tw->vel[2] * gGT->elapsedTimeMS) >> 5; // increment counter sVar3 = tw->turnAround++; @@ -71,8 +71,8 @@ void DECOMP_RB_Warpball_TurnAround(struct Thread* t) // rotation rot = ratan2( - cn->pos[0] - inst->matrix.t[0], - cn->pos[2] - inst->matrix.t[2] + cn->pos[0] - inst->matrix.t.x, + cn->pos[2] - inst->matrix.t.z ); // rotation diff --git a/decompile/General/231/231_035_RB_MaskWeapon_FadeAway.c b/decompile/General/231/231_035_RB_MaskWeapon_FadeAway.c index 457120527..8ec87e295 100644 --- a/decompile/General/231/231_035_RB_MaskWeapon_FadeAway.c +++ b/decompile/General/231/231_035_RB_MaskWeapon_FadeAway.c @@ -21,11 +21,11 @@ void DECOMP_RB_MaskWeapon_FadeAway(struct Thread* t) // Set up First pass (maskInst) int durationAdjusted = ((int)(mask->duration >> 5) * -4 + 0x40); - mhs->posOffset[0] = ((durationAdjusted * DECOMP_MATH_Sin(mask->rot[1])) >> 0xc); - mhs->posOffset[2] = ((durationAdjusted * DECOMP_MATH_Cos(mask->rot[1])) >> 0xc); + mhs->posOffset[0] = ((durationAdjusted * DECOMP_MATH_Sin(mask->rot.y)) >> 0xc); + mhs->posOffset[2] = ((durationAdjusted * DECOMP_MATH_Cos(mask->rot.y)) >> 0xc); mhs->posOffset[1] = 0x40; - mask->rot[1] += FPS_HALF(-0x100); + mask->rot.y += FPS_HALF(-0x100); struct Instance* instCurr; instCurr = inst; @@ -48,7 +48,7 @@ void DECOMP_RB_MaskWeapon_FadeAway(struct Thread* t) } mhs->rot[0] = 0; - mhs->rot[1] = mask->rot[1]; + mhs->rot[1] = mask->rot.y; mhs->rot[2] = 0; ConvertRotToMatrix(&mhs->m, &mhs->rot[0]); diff --git a/decompile/General/231/231_036_RB_MaskWeapon_ThTick.c b/decompile/General/231/231_036_RB_MaskWeapon_ThTick.c index 515cd080f..e32c0ecea 100644 --- a/decompile/General/231/231_036_RB_MaskWeapon_ThTick.c +++ b/decompile/General/231/231_036_RB_MaskWeapon_ThTick.c @@ -82,7 +82,7 @@ void DECOMP_RB_MaskWeapon_ThTick(struct Thread* maskTh) // Set up the First pass (MaskInst) - rot = mask->rot[1]; + rot = mask->rot.y; mhs->posOffset[0] = (((DECOMP_MATH_Sin(rot) << 6) >> 0xc) * mask->scale) >> 0xc; mhs->posOffset[2] = (((DECOMP_MATH_Cos(rot) << 6) >> 0xc) * mask->scale) >> 0xc; @@ -102,7 +102,7 @@ void DECOMP_RB_MaskWeapon_ThTick(struct Thread* maskTh) // Second time is BeamInst for(int i = 0; i < 2; i++) { - if ((mask->rot[2] & 1) == 0) + if ((mask->rot.y & 1) == 0) { LHMatrix_Parent(instCurr, driverInst, (SVECTOR*)&mhs->posOffset[0]); ConvertRotToMatrix(&mhs->m, &mhs->rot[0]); @@ -110,9 +110,9 @@ void DECOMP_RB_MaskWeapon_ThTick(struct Thread* maskTh) } else { - instCurr->matrix.t[0] = (int)mask->pos[0] + mhs->posOffset[0]; - instCurr->matrix.t[1] = (int)mask->pos[1] + mhs->posOffset[1]; - instCurr->matrix.t[2] = (int)mask->pos[2] + mhs->posOffset[2]; + instCurr->matrix.t.x = (int)mask->pos.x + mhs->posOffset[0]; + instCurr->matrix.t.y = (int)mask->pos.y + mhs->posOffset[1]; + instCurr->matrix.t.z = (int)mask->pos.z + mhs->posOffset[2]; ConvertRotToMatrix(&instCurr->matrix, &mhs->rot[0]); } @@ -144,7 +144,7 @@ void DECOMP_RB_MaskWeapon_ThTick(struct Thread* maskTh) } // adjust rotation - mask->rot[1] += FPS_HALF(-0x100); + mask->rot.y += FPS_HALF(-0x100); // If duration is over if (mask->duration == 0) diff --git a/decompile/General/231/231_038_RB_ShieldDark_ThTick_Grow.c b/decompile/General/231/231_038_RB_ShieldDark_ThTick_Grow.c index a01194861..8fd8518b0 100644 --- a/decompile/General/231/231_038_RB_ShieldDark_ThTick_Grow.c +++ b/decompile/General/231/231_038_RB_ShieldDark_ThTick_Grow.c @@ -286,9 +286,9 @@ void DECOMP_RB_ShieldDark_ThTick_Grow(struct Thread *th) *(int*)&bombInst->matrix.m[1][1] = *(int*)&shieldInst->matrix.m[1][1]; *(int*)&bombInst->matrix.m[2][0] = *(int*)&shieldInst->matrix.m[2][0]; bombInst->matrix.m[2][2] = shieldInst->matrix.m[2][2]; - bombInst->matrix.t[0] = shieldInst->matrix.t[0]; - bombInst->matrix.t[1] = shieldInst->matrix.t[1]; - bombInst->matrix.t[2] = shieldInst->matrix.t[2]; + bombInst->matrix.t.x = shieldInst->matrix.t.x; + bombInst->matrix.t.y = shieldInst->matrix.t.y; + bombInst->matrix.t.z = shieldInst->matrix.t.z; // set scale (x, y, z) and transparency bombInst->scale[0] = 0x400; diff --git a/decompile/General/231/231_041_RB_RainCloud_FadeAway.c b/decompile/General/231/231_041_RB_RainCloud_FadeAway.c index af70491b8..81b5d3a3a 100644 --- a/decompile/General/231/231_041_RB_RainCloud_FadeAway.c +++ b/decompile/General/231/231_041_RB_RainCloud_FadeAway.c @@ -13,15 +13,20 @@ void DECOMP_RB_RainCloud_FadeAway(struct Thread* t) parentInst = t->parentThread->inst; // offset upward before averaging - inst->matrix.t[1] += 0x80; + inst->matrix.t.y += 0x80; // X, Y, Z - for(int i = 0; i < 3; i++) - { // get average between instance and driver - inst->matrix.t[i] += parentInst->matrix.t[i]; - inst->matrix.t[i] = inst->matrix.t[i] >> 1; - } + inst->matrix.t.x += parentInst->matrix.t.x; + inst->matrix.t.x = parentInst->matrix.t.x >> 1; + + inst->matrix.t.y += parentInst->matrix.t.y; + inst->matrix.t.y = parentInst->matrix.t.y >> 1; + + inst->matrix.t.z += parentInst->matrix.t.z; + inst->matrix.t.z = parentInst->matrix.t.z >> 1; + + struct RainLocal* rainLocal = rcloud->rainLocal; rainLocal->frameCount -= FPS_HALF(2); diff --git a/decompile/General/231/231_042_RB_RainCloud_ThTick.c b/decompile/General/231/231_042_RB_RainCloud_ThTick.c index df95666c1..5b2dcc011 100644 --- a/decompile/General/231/231_042_RB_RainCloud_ThTick.c +++ b/decompile/General/231/231_042_RB_RainCloud_ThTick.c @@ -49,15 +49,20 @@ void DECOMP_RB_RainCloud_ThTick(struct Thread* t) } // offset upward before averaging - inst->matrix.t[1] += (inst->scale[1] * 5 >> 7); + inst->matrix.t.y += (inst->scale[1] * 5 >> 7); - // X, Y, Z - for(int i = 0; i < 3; i++) - { + // get average between instance and driver - inst->matrix.t[i] += dInst->matrix.t[i]; - inst->matrix.t[i] = inst->matrix.t[i] >> 1; - } + inst->matrix.t.x += dInst->matrix.t.x; + inst->matrix.t.x = dInst->matrix.t.x >> 1; + + inst->matrix.t.y += dInst->matrix.t.y; + inst->matrix.t.y = dInst->matrix.t.y >> 1; + + inst->matrix.t.z += dInst->matrix.t.z; + inst->matrix.t.z = dInst->matrix.t.z >> 1; + + // if driver is not using mask weapon if ((d->actionsFlagSet & 0x800000) == 0) diff --git a/decompile/General/231/231_043_RB_RainCloud_Init.c b/decompile/General/231/231_043_RB_RainCloud_Init.c index 4abd61c1c..42cd38d54 100644 --- a/decompile/General/231/231_043_RB_RainCloud_Init.c +++ b/decompile/General/231/231_043_RB_RainCloud_Init.c @@ -25,9 +25,9 @@ void DECOMP_RB_RainCloud_Init(struct Driver* d) cloudInst->matrix.m[2][2] = 0x1000; // cloud->posX = driver->posX - cloudInst->matrix.t[0] = d->instSelf->matrix.t[0]; - cloudInst->matrix.t[1] = d->instSelf->matrix.t[1] + 0x80; - cloudInst->matrix.t[2] = d->instSelf->matrix.t[2]; + cloudInst->matrix.t.x = d->instSelf->matrix.t.x; + cloudInst->matrix.t.y = d->instSelf->matrix.t.y + 0x80; + cloudInst->matrix.t.z = d->instSelf->matrix.t.z; cloudInst->alphaScale = 0x800; @@ -50,9 +50,9 @@ void DECOMP_RB_RainCloud_Init(struct Driver* d) rlocal->vel[1] = FPS_HALF(-0x28); rlocal->vel[2] = 0; - rlocal->pos[0] = d->instSelf->matrix.t[0]; - rlocal->pos[1] = d->instSelf->matrix.t[1] + 0x80; - rlocal->pos[2] = d->instSelf->matrix.t[2]; + rlocal->pos[0] = d->instSelf->matrix.t.x; + rlocal->pos[1] = d->instSelf->matrix.t.y + 0x80; + rlocal->pos[2] = d->instSelf->matrix.t.z; rlocal->cloudInst = cloudInst; } diff --git a/decompile/General/231/231_044_RB_Explosion_InitPotion.c b/decompile/General/231/231_044_RB_Explosion_InitPotion.c index 13787fd78..5827c366e 100644 --- a/decompile/General/231/231_044_RB_Explosion_InitPotion.c +++ b/decompile/General/231/231_044_RB_Explosion_InitPotion.c @@ -35,9 +35,12 @@ void DECOMP_RB_Explosion_InitPotion(struct Instance* inst) for(int i = 0; i < 3; i++) { shatterInst->scale[i] = 0x800; - shatterInst->matrix.t[i] = inst->matrix.t[i]; + } + //copy XYZ + shatterInst->matrix.t = inst->matrix.t; + // particles for potion shatter for (int i = 0; i < 5; i++) { @@ -47,9 +50,9 @@ void DECOMP_RB_Explosion_InitPotion(struct Instance* inst) if (p == NULL) continue; - p->axis[0].startVal += shatterInst->matrix.t[0] * 0x100; - p->axis[1].startVal += shatterInst->matrix.t[1] * 0x100; - p->axis[2].startVal += shatterInst->matrix.t[2] * 0x100; + p->axis[0].startVal += shatterInst->matrix.t.x * 0x100; + p->axis[1].startVal += shatterInst->matrix.t.y * 0x100; + p->axis[2].startVal += shatterInst->matrix.t.z * 0x100; p->modelID = shatterColor; diff --git a/decompile/General/231/231_045_RB_Explosion_InitGeneric.c b/decompile/General/231/231_045_RB_Explosion_InitGeneric.c index cb35c7228..54e4483a7 100644 --- a/decompile/General/231/231_045_RB_Explosion_InitGeneric.c +++ b/decompile/General/231/231_045_RB_Explosion_InitGeneric.c @@ -19,9 +19,9 @@ void DECOMP_RB_Explosion_InitGeneric(struct Instance* inst) *(int*)&explosion->matrix.m[2][0] = *(int*)&inst->matrix.m[2][0]; explosion->matrix.m[2][2] = inst->matrix.m[2][2]; - explosion->matrix.t[0] = inst->matrix.t[0]; - explosion->matrix.t[1] = inst->matrix.t[1]; - explosion->matrix.t[2] = inst->matrix.t[2]; + explosion->matrix.t.x = inst->matrix.t.x; + explosion->matrix.t.y = inst->matrix.t.y; + explosion->matrix.t.z = inst->matrix.t.z; // green color = 0x1eac000; diff --git a/decompile/General/231/231_048_RB_Blowup_Init.c b/decompile/General/231/231_048_RB_Blowup_Init.c index 95038b870..d64ab7c1e 100644 --- a/decompile/General/231/231_048_RB_Blowup_Init.c +++ b/decompile/General/231/231_048_RB_Blowup_Init.c @@ -33,9 +33,9 @@ void DECOMP_RB_Blowup_Init(struct Instance* weaponInst) *(int*)&explosionInst->matrix.m[1][1] = *(int*)&weaponInst->matrix.m[1][1]; *(int*)&explosionInst->matrix.m[2][0] = *(int*)&weaponInst->matrix.m[2][0]; explosionInst->matrix.m[2][2] = weaponInst->matrix.m[2][2]; - explosionInst->matrix.t[0] = weaponInst->matrix.t[0]; - explosionInst->matrix.t[1] = weaponInst->matrix.t[1]; - explosionInst->matrix.t[2] = weaponInst->matrix.t[2]; + explosionInst->matrix.t.x = weaponInst->matrix.t.x; + explosionInst->matrix.t.y = weaponInst->matrix.t.y; + explosionInst->matrix.t.z = weaponInst->matrix.t.z; // green color = 0x1eac000; @@ -74,9 +74,9 @@ void DECOMP_RB_Blowup_Init(struct Instance* weaponInst) *(int*)&shockwaveInst->matrix.m[1][1] = 0x1000; *(int*)&shockwaveInst->matrix.m[2][0] = 0; shockwaveInst->matrix.m[2][2] = 0x1000; - shockwaveInst->matrix.t[0] = weaponInst->matrix.t[0]; - shockwaveInst->matrix.t[1] = weaponInst->matrix.t[1]; - shockwaveInst->matrix.t[2] = weaponInst->matrix.t[2]; + shockwaveInst->matrix.t.x = weaponInst->matrix.t.x; + shockwaveInst->matrix.t.y = weaponInst->matrix.t.y; + shockwaveInst->matrix.t.z = weaponInst->matrix.t.z; headers = shockwaveInst->model->headers; @@ -89,9 +89,9 @@ void DECOMP_RB_Blowup_Init(struct Instance* weaponInst) struct ScratchpadStruct* sps = 0x1f800108; // put weapon position on scratchpad - sps->Input1.pos[0] = weaponInst->matrix.t[0]; - sps->Input1.pos[1] = weaponInst->matrix.t[1]; - sps->Input1.pos[2] = weaponInst->matrix.t[2]; + sps->Input1.pos[0] = weaponInst->matrix.t.x; + sps->Input1.pos[1] = weaponInst->matrix.t.y; + sps->Input1.pos[2] = weaponInst->matrix.t.z; // if you're in boss mode if ((gGT->gameMode1 & ADVENTURE_BOSS) != 0) diff --git a/decompile/General/231/231_053_RB_Burst_Init.c b/decompile/General/231/231_053_RB_Burst_Init.c index f1b79eafb..877a45df8 100644 --- a/decompile/General/231/231_053_RB_Burst_Init.c +++ b/decompile/General/231/231_053_RB_Burst_Init.c @@ -84,9 +84,9 @@ void DECOMP_RB_Burst_Init(struct Instance* weaponInst) { currInst = (struct Instance*)burst[i]; - currInst->matrix.t[0] = weaponInst->matrix.t[0]; - currInst->matrix.t[1] = weaponInst->matrix.t[1] + -0x30; - currInst->matrix.t[2] = weaponInst->matrix.t[2]; + currInst->matrix.t.x = weaponInst->matrix.t.x; + currInst->matrix.t.y = weaponInst->matrix.t.y + -0x30; + currInst->matrix.t.z = weaponInst->matrix.t.z; // if more than two screens if (2 < gGT->numPlyrCurrGame) @@ -126,9 +126,9 @@ void DECOMP_RB_Burst_Init(struct Instance* weaponInst) struct ScratchpadStruct* sps = (struct ScratchpadStruct*)0x1f800108; // put weapon position on scratchpad - sps->Input1.pos[0] = weaponInst->matrix.t[0]; - sps->Input1.pos[1] = weaponInst->matrix.t[1]; - sps->Input1.pos[2] = weaponInst->matrix.t[2]; + sps->Input1.pos[0] = weaponInst->matrix.t.x; + sps->Input1.pos[1] = weaponInst->matrix.t.y; + sps->Input1.pos[2] = weaponInst->matrix.t.z; struct TrackerWeapon* tw = weaponInst->thread->object; diff --git a/decompile/General/231/231_055_RB_GetThread_ClosestTracker.c b/decompile/General/231/231_055_RB_GetThread_ClosestTracker.c index 9b31bf3d6..b54469465 100644 --- a/decompile/General/231/231_055_RB_GetThread_ClosestTracker.c +++ b/decompile/General/231/231_055_RB_GetThread_ClosestTracker.c @@ -30,8 +30,8 @@ struct Thread* DECOMP_RB_GetThread_ClosestTracker(struct Driver* d) if( // get distance between posX and posZ of // driver->instSelf->position, and tracker's position, - distX = dInst->matrix.t[0] - currInst->matrix.t[0], - distZ = dInst->matrix.t[2] - currInst->matrix.t[2], + distX = dInst->matrix.t.x - currInst->matrix.t.x, + distZ = dInst->matrix.t.z - currInst->matrix.t.z, // if this is a new closest distance distX = distX * distX + distZ * distZ, distX < smallestDist diff --git a/decompile/General/231/231_056_RB_Baron_ThTick.c b/decompile/General/231/231_056_RB_Baron_ThTick.c index 923e5e94d..c96a71c08 100644 --- a/decompile/General/231/231_056_RB_Baron_ThTick.c +++ b/decompile/General/231/231_056_RB_Baron_ThTick.c @@ -103,9 +103,9 @@ void DECOMP_RB_Baron_ThTick(struct Thread* t) // converted to TEST in rebuildPS1 ConvertRotToMatrix(&baronInst->matrix, &rot[0]); - baronInst->matrix.t[0] = pos[0] + 0x111; - baronInst->matrix.t[1] = pos[1]; - baronInst->matrix.t[2] = pos[2] - 0x110; + baronInst->matrix.t.x = pos[0] + 0x111; + baronInst->matrix.t.y = pos[1]; + baronInst->matrix.t.z = pos[2] - 0x110; // 30FPS #else @@ -115,9 +115,9 @@ void DECOMP_RB_Baron_ThTick(struct Thread* t) &baronInst->matrix, &ptrSpawnType2->posCoords[baseShort+3]); - baronInst->matrix.t[0] = ptrSpawnType2->posCoords[baseShort+0] + 0x111; - baronInst->matrix.t[1] = ptrSpawnType2->posCoords[baseShort+1]; - baronInst->matrix.t[2] = ptrSpawnType2->posCoords[baseShort+2] - 0x110; + baronInst->matrix.t.x = ptrSpawnType2->posCoords[baseShort+0] + 0x111; + baronInst->matrix.t.y = ptrSpawnType2->posCoords[baseShort+1]; + baronInst->matrix.t.z = ptrSpawnType2->posCoords[baseShort+2] - 0x110; baronObj->pointIndex = (baronObj->pointIndex + 1) % (ptrSpawnType2->numCoords); diff --git a/decompile/General/231/231_061_068_RB_Crate.c b/decompile/General/231/231_061_068_RB_Crate.c index 2d06cc7cb..98136cd06 100644 --- a/decompile/General/231/231_061_068_RB_Crate.c +++ b/decompile/General/231/231_061_068_RB_Crate.c @@ -126,9 +126,9 @@ void RB_CrateAny_ExplodeInit(struct Instance* crateInst, int color) explosionInst->alphaScale = 0x1000; // position - explosionInst->matrix.t[0] = crateInst->matrix.t[0]; - explosionInst->matrix.t[1] = crateInst->matrix.t[1]; - explosionInst->matrix.t[2] = crateInst->matrix.t[2]; + explosionInst->matrix.t.x = crateInst->matrix.t.x; + explosionInst->matrix.t.y = crateInst->matrix.t.y; + explosionInst->matrix.t.z = crateInst->matrix.t.z; // rotation matrix rot[0] = 0; diff --git a/decompile/General/231/231_069_072_RB_Crystal.c b/decompile/General/231/231_069_072_RB_Crystal.c index 3c4f84020..03e04b3af 100644 --- a/decompile/General/231/231_069_072_RB_Crystal.c +++ b/decompile/General/231/231_069_072_RB_Crystal.c @@ -22,7 +22,7 @@ void DECOMP_RB_Crystal_ThTick(struct Thread* t) sine = DECOMP_MATH_Sin(crystalObj->rot[1]); // set posY - crystalInst->matrix.t[1] = + crystalInst->matrix.t.y = crystalInst->instDef->pos[1] + // original posY ((sine << 4) >> 0xc) + // sine (bounce up/down) 0x30; // airborne bump diff --git a/decompile/General/231/231_073_RB_Default_LInB.c b/decompile/General/231/231_073_RB_Default_LInB.c index a8d0ea7d3..ea2ce7bc6 100644 --- a/decompile/General/231/231_073_RB_Default_LInB.c +++ b/decompile/General/231/231_073_RB_Default_LInB.c @@ -16,13 +16,13 @@ void DECOMP_RB_Default_LInB(struct Instance* inst) *(int*)&scratch[0x144] = (int)sdata->gGT->level1->ptr_mesh_info; // Make a hitbox - var = inst->matrix.t[0]; + var = inst->matrix.t.x; *(short*)&scratch[0x108] = var; *(short*)&scratch[0x110] = var; - var = inst->matrix.t[2]; + var = inst->matrix.t.z; *(short*)&scratch[0x10c] = var; *(short*)&scratch[0x114] = var; - var = inst->matrix.t[1]; + var = inst->matrix.t.y; *(short*)&scratch[0x10a] = var - 0x180; *(short*)&scratch[0x112] = var + 0x80; diff --git a/decompile/General/231/231_082_085_RB_Armadillo.c b/decompile/General/231/231_082_085_RB_Armadillo.c index c32d04447..6186099b5 100644 --- a/decompile/General/231/231_082_085_RB_Armadillo.c +++ b/decompile/General/231/231_082_085_RB_Armadillo.c @@ -106,8 +106,8 @@ void DECOMP_RB_Armadillo_ThTick_Rolling(struct Thread* t) // 32ms, 30fps armObj->timeRolling += FPS_HALF(0x20); - armInst->matrix.t[0] += armObj->velX; - armInst->matrix.t[2] += armObj->velZ; + armInst->matrix.t.x += armObj->velX; + armInst->matrix.t.z += armObj->velZ; // if 1.333 seconds passed, (40 frames) // could be >= if using accurate ms clock @@ -170,8 +170,8 @@ void DECOMP_RB_Armadillo_LInB(struct Instance* inst) armObj->timeRolling = 0; armObj->timeAtEdge = 0; - armObj->spawnPosX = inst->matrix.t[0]; - armObj->spawnPosZ = inst->matrix.t[2]; + armObj->spawnPosX = inst->matrix.t.x; + armObj->spawnPosZ = inst->matrix.t.z; armObj->velX = inst->matrix.m[0][2] >> FPS_RIGHTSHIFT(7); armObj->velZ = inst->matrix.m[2][2] >> FPS_RIGHTSHIFT(7); diff --git a/decompile/General/231/231_086_088_RB_Fireball.c b/decompile/General/231/231_086_088_RB_Fireball.c index e16233198..2ef82a8d5 100644 --- a/decompile/General/231/231_086_088_RB_Fireball.c +++ b/decompile/General/231/231_086_088_RB_Fireball.c @@ -203,11 +203,11 @@ void DECOMP_RB_Fireball_ThTick(struct Thread* t) // if fireball isn't below the lava, // handle all particle spawning - if(fireInst->matrix.t[1] >= resetPosY) + if(fireInst->matrix.t.y >= resetPosY) { // move based on velocity velY = fireObj->velY; - fireInst->matrix.t[1] += (velY * elapsedTimeMS) >> 5; + fireInst->matrix.t.y += (velY * elapsedTimeMS) >> 5; // reduce velocity (gravity) velY -= ((elapsedTimeMS * 10) >> 5); @@ -249,9 +249,9 @@ void DECOMP_RB_Fireball_ThTick(struct Thread* t) { // adjust positions, // dont bitshift, must multiply, or negatives break - particle->axis[0].startVal += fireInst->matrix.t[0] * 0x100; - particle->axis[1].startVal += fireInst->matrix.t[1] * 0x100; - particle->axis[2].startVal += fireInst->matrix.t[2] * 0x100; + particle->axis[0].startVal += fireInst->matrix.t.x * 0x100; + particle->axis[1].startVal += fireInst->matrix.t.y * 0x100; + particle->axis[2].startVal += fireInst->matrix.t.z * 0x100; particle->unk1A = 0x1e00; @@ -306,7 +306,7 @@ void DECOMP_RB_Fireball_ThTick(struct Thread* t) fireObj->velY = 200; // reset position under lava - fireInst->matrix.t[1] = resetPosY; + fireInst->matrix.t.y = resetPosY; #if 0 // reset animation diff --git a/decompile/General/231/231_089_091_RB_FlameJet.c b/decompile/General/231/231_089_091_RB_FlameJet.c index 437288771..f6f6ce2b4 100644 --- a/decompile/General/231/231_089_091_RB_FlameJet.c +++ b/decompile/General/231/231_089_091_RB_FlameJet.c @@ -249,9 +249,9 @@ void DECOMP_RB_FlameJet_Particles(struct Instance* inst, struct FlameJet* fjObj) // fire particle if(particle1 != 0) { - particle1->axis[0].startVal += (inst->matrix.t[0]) * 0x100; - particle1->axis[1].startVal += (inst->matrix.t[1] + 0x32) * 0x100; - particle1->axis[2].startVal += (inst->matrix.t[2]) * 0x100; + particle1->axis[0].startVal += (inst->matrix.t.x) * 0x100; + particle1->axis[1].startVal += (inst->matrix.t.y + 0x32) * 0x100; + particle1->axis[2].startVal += (inst->matrix.t.z) * 0x100; particle1->axis[0].velocity = (short)fjObj->dirX; particle1->axis[1].velocity = 0; diff --git a/decompile/General/231/231_092_094_RB_Follower.c b/decompile/General/231/231_092_094_RB_Follower.c index 58c0cba9f..a7ba611e8 100644 --- a/decompile/General/231/231_092_094_RB_Follower.c +++ b/decompile/General/231/231_092_094_RB_Follower.c @@ -71,9 +71,9 @@ void DECOMP_RB_Follower_ThTick(struct Thread* t) } // midpoint between real mine position, and driver position - inst->matrix.t[0] = (fObj->realPos[0] + (d->posCurr.x>>8)) >> 1; - inst->matrix.t[1] = (fObj->realPos[1] + (d->posCurr.y>>8)) >> 1; - inst->matrix.t[2] = (fObj->realPos[2] + (d->posCurr.z>>8)) >> 1; + inst->matrix.t.x = (fObj->realPos.x + (d->posCurr.x>>8)) >> 1; + inst->matrix.t.y = (fObj->realPos.y + (d->posCurr.y>>8)) >> 1; + inst->matrix.t.z = (fObj->realPos.z + (d->posCurr.z>>8)) >> 1; return; } @@ -85,9 +85,9 @@ void DECOMP_RB_Follower_ThTick(struct Thread* t) void DECOMP_RB_Follower_Init(struct Driver* d, struct Thread* mineTh) { struct Thread* t; - struct Instance* iVar1; + struct Instance* followerInst; struct Follower* fObj; - struct Instance* iVar3; + struct Instance* mineInst; // disable for slow speed if (d->speedApprox <= 0x1e00) return; @@ -96,35 +96,35 @@ void DECOMP_RB_Follower_Init(struct Driver* d, struct Thread* mineTh) if ((d->actionsFlagSet & 0x100000) != 0) return; #ifdef USE_ONLINE - if(d->driverID != 0) return; + if(d->driverID != NULL) return; #endif // disable for airborne camera if (((sdata->gGT->cameraDC[d->driverID].flags) & 0x10000) != 0) return; // create a thread and an Instance - iVar1 = INSTANCE_BirthWithThread( + followerInst = INSTANCE_BirthWithThread( mineTh->modelIndex, 0, SMALL, FOLLOWER, DECOMP_RB_Follower_ThTick, sizeof(struct Follower), 0); - if (iVar1 == NULL) return; + if (followerInst == NULL) return; // followerInst scale - iVar1->scale[0] = 0x200; - iVar1->scale[1] = 0x200; - iVar1->scale[2] = 0x200; + followerInst->scale[0] = 0x200; + followerInst->scale[1] = 0x200; + followerInst->scale[2] = 0x200; // mineInst - iVar3 = mineTh->inst; + mineInst = mineTh->inst; // copy position and rotation from one instance to another - *(int*)&iVar1->matrix.m[0][0] = *(int*)&iVar3->matrix.m[0][0]; - *(int*)&iVar1->matrix.m[0][2] = *(int*)&iVar3->matrix.m[0][2]; - *(int*)&iVar1->matrix.m[1][1] = *(int*)&iVar3->matrix.m[1][1]; - *(int*)&iVar1->matrix.m[2][0] = *(int*)&iVar3->matrix.m[2][0]; - iVar1->matrix.m[2][2] = iVar3->matrix.m[2][2]; + *(int*)&followerInst->matrix.m[0][0] = *(int*)&mineInst->matrix.m[0][0]; + *(int*)&followerInst->matrix.m[0][2] = *(int*)&mineInst->matrix.m[0][2]; + *(int*)&followerInst->matrix.m[1][1] = *(int*)&mineInst->matrix.m[1][1]; + *(int*)&followerInst->matrix.m[2][0] = *(int*)&mineInst->matrix.m[2][0]; + followerInst->matrix.m[2][2] = mineInst->matrix.m[2][2]; - t = iVar1->thread; + t = followerInst->thread; t->funcThDestroy = PROC_DestroyInstance; fObj = t->object; @@ -134,10 +134,12 @@ void DECOMP_RB_Follower_Init(struct Driver* d, struct Thread* mineTh) fObj->backupTimesDestroyed = mineTh->timesDestroyed; // backup original position - for(int i = 0; i < 3; i++) - { - int pos = iVar3->matrix.t[i]; - iVar1->matrix.t[i] = pos; - fObj->realPos[i] = pos; - } + + + followerInst->matrix.t = mineInst->matrix.t; + + fObj->realPos.x = mineInst->matrix.t.x; + fObj->realPos.y = mineInst->matrix.t.y; + fObj->realPos.z = mineInst->matrix.t.z; + } \ No newline at end of file diff --git a/decompile/General/231/231_095_098_RB_Fruit.c b/decompile/General/231/231_095_098_RB_Fruit.c index b2ee17796..ffdf00a2e 100644 --- a/decompile/General/231/231_095_098_RB_Fruit.c +++ b/decompile/General/231/231_095_098_RB_Fruit.c @@ -11,9 +11,9 @@ void RB_Fruit_GetScreenCoords(struct PushBuffer* pb, struct Instance* inst, shor gte_SetTransMatrix(m); // load input vector, each int casts to short - posWorld[0] = (short)inst->matrix.t[0]; - posWorld[1] = (short)inst->matrix.t[1]; - posWorld[2] = (short)inst->matrix.t[2]; + posWorld[0] = (short)inst->matrix.t.x; + posWorld[1] = (short)inst->matrix.t.y; + posWorld[2] = (short)inst->matrix.t.z; posWorld[3] = 0; gte_ldv0(&posWorld[0]); diff --git a/decompile/General/231/231_099_100_RB_Minecart.c b/decompile/General/231/231_099_100_RB_Minecart.c index 479b13a44..9633c345b 100644 --- a/decompile/General/231/231_099_100_RB_Minecart.c +++ b/decompile/General/231/231_099_100_RB_Minecart.c @@ -58,7 +58,7 @@ void RB_Minecart_NewPoint( int start = spawnType2->posCoords[pointIndex+i-3]; int end = spawnType2->posCoords[pointIndex+i]; - minecartInst->matrix.t[i] = start; + minecartInst->matrix.t.v[i] = start; minecartObj->dir[i] = start - end; } @@ -167,7 +167,7 @@ void DECOMP_RB_Minecart_ThTick(struct Thread* t) for(i = 0; i < 3; i++) { // skip safety tests, assume no division by zero - minecartInst->matrix.t[i] -= + minecartInst->matrix.t.v[i] -= minecartObj->dir[i] / minecartObj->betweenPoints_numFrames; } diff --git a/decompile/General/231/231_104_109_RB_Plant.c b/decompile/General/231/231_104_109_RB_Plant.c index 00dbdce95..6b89a2f9e 100644 --- a/decompile/General/231/231_104_109_RB_Plant.c +++ b/decompile/General/231/231_104_109_RB_Plant.c @@ -149,19 +149,19 @@ void DECOMP_RB_Plant_ThTick_Eat(struct Thread* t) particle->axis[0].startVal += ( - plantInst->matrix.t[0] + + plantInst->matrix.t.x + (plantInst->matrix.m[0][2] * 9 >> 7) ) * 0x100; particle->axis[1].startVal += ( - plantInst->matrix.t[1] + plantInst->matrix.t.y + 0x20 ) * 0x100; particle->axis[2].startVal += ( - plantInst->matrix.t[2] + + plantInst->matrix.t.z + (plantInst->matrix.m[2][2] * 9 >> 7) ) * 0x100; diff --git a/decompile/General/231/231_110_113_RB_Seal.c b/decompile/General/231/231_110_113_RB_Seal.c index 691fd8daf..8c723d101 100644 --- a/decompile/General/231/231_110_113_RB_Seal.c +++ b/decompile/General/231/231_110_113_RB_Seal.c @@ -186,7 +186,7 @@ void DECOMP_RB_Seal_ThTick_Move(struct Thread* t) // move seal for(i = 0; i < 3; i++) { - sealInst->matrix.t[i] = + sealInst->matrix.t.v[i] = (int)sealObj->spawnPos[i] - (sealObj->distFromSpawn * (int)sealObj->vel[i]) / FPS_DOUBLE(0x2d); } diff --git a/decompile/General/231/231_114_115_RB_Snowball.c b/decompile/General/231/231_114_115_RB_Snowball.c index 6c636da1e..dbcc5c036 100644 --- a/decompile/General/231/231_114_115_RB_Snowball.c +++ b/decompile/General/231/231_114_115_RB_Snowball.c @@ -93,9 +93,9 @@ void DECOMP_RB_Snowball_ThTick(struct Thread* t) // converted to TEST in rebuildPS1 ConvertRotToMatrix(&snowInst->matrix, &rot[0]); - snowInst->matrix.t[0] = pos[0]; - snowInst->matrix.t[1] = pos[1]; - snowInst->matrix.t[2] = pos[2]; + snowInst->matrix.t.x = pos[0]; + snowInst->matrix.t.y = pos[1]; + snowInst->matrix.t.z = pos[2]; // original 30fps #else @@ -105,9 +105,9 @@ void DECOMP_RB_Snowball_ThTick(struct Thread* t) &snowInst->matrix, &ptrSpawnType2->posCoords[baseShort+3]); - snowInst->matrix.t[0] = ptrSpawnType2->posCoords[baseShort+0]; - snowInst->matrix.t[1] = ptrSpawnType2->posCoords[baseShort+1]; - snowInst->matrix.t[2] = ptrSpawnType2->posCoords[baseShort+2]; + snowInst->matrix.t.x = ptrSpawnType2->posCoords[baseShort+0]; + snowInst->matrix.t.y = ptrSpawnType2->posCoords[baseShort+1]; + snowInst->matrix.t.z = ptrSpawnType2->posCoords[baseShort+2]; // [skip safety checks] snowObj->pointIndex = (snowObj->pointIndex + 1) % (snowObj->numPoints*2); diff --git a/decompile/General/231/231_116_119_RB_Spider.c b/decompile/General/231/231_116_119_RB_Spider.c index 2e7475ae0..5f524db2a 100644 --- a/decompile/General/231/231_116_119_RB_Spider.c +++ b/decompile/General/231/231_116_119_RB_Spider.c @@ -52,7 +52,7 @@ void DECOMP_RB_Spider_DrawWebs(struct Thread *t, struct PushBuffer* pb) scratchpad[3] = 0; scratchpad[4] = uVar2; - scratchpad[5] = t->inst->matrix.t[1] + 0x60; + scratchpad[5] = t->inst->matrix.t.y + 0x60; scratchpad[6] = sVar1; scratchpad[7] = 0; @@ -298,7 +298,7 @@ void DECOMP_RB_Spider_ThTick(struct Thread* t) } - spiderInst->matrix.t[1] = + spiderInst->matrix.t.y = (int)spiderInst->instDef->pos[1] + spiderArr[sVar2]; @@ -376,10 +376,10 @@ void DECOMP_RB_Spider_LInB(struct Instance* inst) *(int*)&shadowInst->matrix.m[2][0] = *(int*)&inst->matrix.m[2][0]; shadowInst->matrix.m[2][2] = inst->matrix.m[2][2]; - shadowInst->matrix.t[0] = inst->matrix.t[0]; - shadowInst->matrix.t[1] = inst->matrix.t[1] - 8; - shadowInst->matrix.t[2] = inst->matrix.t[2]; - inst->matrix.t[1] += 0x4c0; + shadowInst->matrix.t.x = inst->matrix.t.x; + shadowInst->matrix.t.y = inst->matrix.t.y - 8; + shadowInst->matrix.t.z = inst->matrix.t.z; + inst->matrix.t.y += 0x4c0; shadowInst->scale[0] = 0x2000; shadowInst->scale[1] = 0x2000; diff --git a/decompile/General/231/231_122_126_RB_Teeth.c b/decompile/General/231/231_122_126_RB_Teeth.c index 32413fc83..ce8a43000 100644 --- a/decompile/General/231/231_122_126_RB_Teeth.c +++ b/decompile/General/231/231_122_126_RB_Teeth.c @@ -52,8 +52,8 @@ void DECOMP_RB_Teeth_BSP_Callback(struct ScratchpadStruct* sps,struct Thread* we teethInst = teethTh->inst; if ((weaponInst != NULL) && (teethInst != NULL)) { - distance = ((int)sps->Input1.pos[0] - weaponInst->matrix.t[0]) * (int)teethInst->matrix.m[0][2] + - ((int)sps->Input1.pos[2] - weaponInst->matrix.t[2]) * (int)teethInst->matrix.m[2][2]; + distance = ((int)sps->Input1.pos[0] - weaponInst->matrix.t.x) * (int)teethInst->matrix.m[0][2] + + ((int)sps->Input1.pos[2] - weaponInst->matrix.t.z) * (int)teethInst->matrix.m[2][2]; // catch negative value if (distance < 0) { @@ -161,9 +161,9 @@ void DECOMP_RB_Teeth_ThTick(struct Thread* t) } // Teeth instance position - SPS->Input1.pos[0] = doorInst->matrix.t[0]; - SPS->Input1.pos[1] = doorInst->matrix.t[1]; - SPS->Input1.pos[2] = doorInst->matrix.t[2]; + SPS->Input1.pos[0] = doorInst->matrix.t.x; + SPS->Input1.pos[1] = doorInst->matrix.t.y; + SPS->Input1.pos[2] = doorInst->matrix.t.z; SPS->Input1.hitRadius = 0x300; SPS->Input1.hitRadiusSquared = 0x90000; @@ -268,8 +268,8 @@ int DECOMP_RB_Teeth_LInC(struct Instance *teethInst, struct Thread *t, struct Sc if (teeth->timeOpen == 0) { distance = - ((int)sps->Input1.pos[0] - teethInst->matrix.t[0]) * (int)teethInst->matrix.m[0][2] + - ((int)sps->Input1.pos[2] - teethInst->matrix.t[2]) * (int)teethInst->matrix.m[2][2]; + ((int)sps->Input1.pos[0] - teethInst->matrix.t.x) * (int)teethInst->matrix.m[0][2] + + ((int)sps->Input1.pos[2] - teethInst->matrix.t.z) * (int)teethInst->matrix.m[2][2]; if (distance < 0) { diff --git a/decompile/General/232/232_00_AH_WarpPad_GetSpawnPosRot.c b/decompile/General/232/232_00_AH_WarpPad_GetSpawnPosRot.c index 205f18c94..f60cb4b24 100644 --- a/decompile/General/232/232_00_AH_WarpPad_GetSpawnPosRot.c +++ b/decompile/General/232/232_00_AH_WarpPad_GetSpawnPosRot.c @@ -37,13 +37,13 @@ short* DECOMP_AH_WarpPad_GetSpawnPosRot(short* posData) instDef = inst->instDef; posData[0] = - inst->matrix.t[0] + + inst->matrix.t.x + ((DECOMP_MATH_Cos(instDef->rot[1]) << 0xA) >> 0xC); - posData[1] = inst->matrix.t[1]; + posData[1] = inst->matrix.t.y; posData[2] = - inst->matrix.t[2] + + inst->matrix.t.z + ((DECOMP_MATH_Sin(instDef->rot[1]) * -0x400) >> 0xC); return &instDef->rot[0]; diff --git a/decompile/General/232/232_03_AH_WarpPad_SpinRewards.c b/decompile/General/232/232_03_AH_WarpPad_SpinRewards.c index 88a4b02f5..c9e474fc6 100644 --- a/decompile/General/232/232_03_AH_WarpPad_SpinRewards.c +++ b/decompile/General/232/232_03_AH_WarpPad_SpinRewards.c @@ -53,15 +53,15 @@ void DECOMP_AH_WarpPad_SpinRewards( thirds = warppadObj->thirds[index]; trig = DECOMP_MATH_Sin(thirds); - prizeInst->matrix.t[1] = y + ((trig<<6)>>0xc) + 0x100; + prizeInst->matrix.t.y = y + ((trig<<6)>>0xc) + 0x100; // do not use original "thirds", // set new value without "+=" thirds = 0x555*index + warppadObj->spinRot_Rewards[1]; trig = DECOMP_MATH_Sin(thirds); - prizeInst->matrix.t[0] = x + (trig * 0xA0 >> 0xc); + prizeInst->matrix.t.x = x + (trig * 0xA0 >> 0xc); trig = DECOMP_MATH_Cos(thirds); - prizeInst->matrix.t[2] = z + (trig * 0xA0 >> 0xc); + prizeInst->matrix.t.z = z + (trig * 0xA0 >> 0xc); } \ No newline at end of file diff --git a/decompile/General/232/232_04_AH_WarpPad_ThTick.c b/decompile/General/232/232_04_AH_WarpPad_ThTick.c index ea0a24018..6acd45efd 100644 --- a/decompile/General/232/232_04_AH_WarpPad_ThTick.c +++ b/decompile/General/232/232_04_AH_WarpPad_ThTick.c @@ -88,9 +88,9 @@ void DECOMP_AH_WarpPad_ThTick(struct Thread* t) driver = gGT->drivers[0]; driverInst = driver->instSelf; - x = warppadMatrix->t[0] - driverInst->matrix.t[0]; - y = warppadMatrix->t[1] - driverInst->matrix.t[1]; - z = warppadMatrix->t[2] - driverInst->matrix.t[2]; + x = warppadMatrix->t.x - driverInst->matrix.t.x; + y = warppadMatrix->t.y - driverInst->matrix.t.y; + z = warppadMatrix->t.z - driverInst->matrix.t.z; dist = x*x + y*y + z*z; levelID = warppadObj->levelID; @@ -211,8 +211,8 @@ void DECOMP_AH_WarpPad_ThTick(struct Thread* t) { angleCamToWarppad = ratan2( - warppadMatrix->t[0] - gGT->pushBuffer[0].pos[0], - warppadMatrix->t[2] - gGT->pushBuffer[0].pos[2] + warppadMatrix->t.x - gGT->pushBuffer[0].pos[0], + warppadMatrix->t.z - gGT->pushBuffer[0].pos[2] ); angleCamToWarppad = -angleCamToWarppad; @@ -223,27 +223,27 @@ void DECOMP_AH_WarpPad_ThTick(struct Thread* t) // no 10s digit if(instArr[WPIS_CLOSED_10S] == 0) { - instArr[WPIS_CLOSED_1S]->matrix.t[0] = warppadMatrix->t[0] + (angleCos * -0x80 >> 0xC); - instArr[WPIS_CLOSED_1S]->matrix.t[2] = warppadMatrix->t[2] + (angleSin * -0x80 >> 0xC); + instArr[WPIS_CLOSED_1S]->matrix.t.x = warppadMatrix->t.x + (angleCos * -0x80 >> 0xC); + instArr[WPIS_CLOSED_1S]->matrix.t.z = warppadMatrix->t.z + (angleSin * -0x80 >> 0xC); - instArr[WPIS_CLOSED_ITEM]->matrix.t[0] = warppadMatrix->t[0] + ((angleCos << 7) >> 0xC); - instArr[WPIS_CLOSED_ITEM]->matrix.t[2] = warppadMatrix->t[2] + ((angleSin << 7) >> 0xC); + instArr[WPIS_CLOSED_ITEM]->matrix.t.x = warppadMatrix->t.x + ((angleCos << 7) >> 0xC); + instArr[WPIS_CLOSED_ITEM]->matrix.t.z = warppadMatrix->t.z + ((angleSin << 7) >> 0xC); } // 10s digit else { - instArr[WPIS_CLOSED_ITEM]->matrix.t[0] = warppadMatrix->t[0] + (angleCos * 0xC0 >> 0xC); - instArr[WPIS_CLOSED_ITEM]->matrix.t[2] = warppadMatrix->t[2] + (angleSin * 0xC0 >> 0xC); + instArr[WPIS_CLOSED_ITEM]->matrix.t.x = warppadMatrix->t.x + (angleCos * 0xC0 >> 0xC); + instArr[WPIS_CLOSED_ITEM]->matrix.t.z = warppadMatrix->t.z + (angleSin * 0xC0 >> 0xC); - instArr[WPIS_CLOSED_X]->matrix.t[0] = warppadMatrix->t[0] + ((angleCos << 6) >> 0xC); - instArr[WPIS_CLOSED_X]->matrix.t[2] = warppadMatrix->t[2] + ((angleSin << 6) >> 0xC); + instArr[WPIS_CLOSED_X]->matrix.t.x = warppadMatrix->t.x + ((angleCos << 6) >> 0xC); + instArr[WPIS_CLOSED_X]->matrix.t.z = warppadMatrix->t.z + ((angleSin << 6) >> 0xC); - instArr[WPIS_CLOSED_10S]->matrix.t[0] = warppadMatrix->t[0] + (angleCos * -0x40 >> 0xC); - instArr[WPIS_CLOSED_10S]->matrix.t[2] = warppadMatrix->t[2] + (angleSin * -0x40 >> 0xC); + instArr[WPIS_CLOSED_10S]->matrix.t.x = warppadMatrix->t.x + (angleCos * -0x40 >> 0xC); + instArr[WPIS_CLOSED_10S]->matrix.t.z = warppadMatrix->t.z + (angleSin * -0x40 >> 0xC); - instArr[WPIS_CLOSED_1S]->matrix.t[0] = warppadMatrix->t[0] + (angleCos * -0xa0 >> 0xC); - instArr[WPIS_CLOSED_1S]->matrix.t[2] = warppadMatrix->t[2] + (angleSin * -0xa0 >> 0xC); + instArr[WPIS_CLOSED_1S]->matrix.t.x = warppadMatrix->t.x + (angleCos * -0xa0 >> 0xC); + instArr[WPIS_CLOSED_1S]->matrix.t.z = warppadMatrix->t.z + (angleSin * -0xa0 >> 0xC); } warppadObj->spinRot_Prize[0] = 0; @@ -348,17 +348,17 @@ void DECOMP_AH_WarpPad_ThTick(struct Thread* t) // if height hasn't reached max height if( - instArr[WPIS_OPEN_RING1+i]->matrix.t[1] < - (warppadInst->matrix.t[1] + wispMaxHeight) + instArr[WPIS_OPEN_RING1+i]->matrix.t.y < + (warppadInst->matrix.t.y + wispMaxHeight) ) { - instArr[WPIS_OPEN_RING1+i]->matrix.t[1] += wispRiseRate; + instArr[WPIS_OPEN_RING1+i]->matrix.t.y += wispRiseRate; // if height hasn't reached 4x RiseRate, // first 4 frames of rising if( - instArr[WPIS_OPEN_RING1+i]->matrix.t[1] < - (warppadInst->matrix.t[1] + wispRiseRate*4) + instArr[WPIS_OPEN_RING1+i]->matrix.t.y < + (warppadInst->matrix.t.y + wispRiseRate*4) ) { // reduce transparency @@ -377,7 +377,7 @@ void DECOMP_AH_WarpPad_ThTick(struct Thread* t) else { // reset height - instArr[WPIS_OPEN_RING1+i]->matrix.t[1] = warppadInst->matrix.t[1]; + instArr[WPIS_OPEN_RING1+i]->matrix.t.y = warppadInst->matrix.t.y; // full transparency instArr[WPIS_OPEN_RING1+i]->alphaScale = 0x1000; @@ -419,9 +419,9 @@ void DECOMP_AH_WarpPad_ThTick(struct Thread* t) DECOMP_AH_WarpPad_SpinRewards( instArr[WPIS_OPEN_PRIZE1+i], warppadObj, i, - warppadInst->matrix.t[0], - warppadInst->matrix.t[1], - warppadInst->matrix.t[2]); + warppadInst->matrix.t.x, + warppadInst->matrix.t.y, + warppadInst->matrix.t.z); modelID = instArr[WPIS_OPEN_PRIZE1+i]->model->id; diff --git a/decompile/General/232/232_06_AH_WarpPad_LInB.c b/decompile/General/232/232_06_AH_WarpPad_LInB.c index c407fdea5..49c9f9ced 100644 --- a/decompile/General/232/232_06_AH_WarpPad_LInB.c +++ b/decompile/General/232/232_06_AH_WarpPad_LInB.c @@ -166,9 +166,9 @@ void DECOMP_AH_WarpPad_LInB(struct Instance* inst) *(int*)((int)&newInst->matrix + 0x8) = *(int*)((int)&inst->matrix + 0x8); *(int*)((int)&newInst->matrix + 0xC) = *(int*)((int)&inst->matrix + 0xC); *(short*)((int)&newInst->matrix + 0x10) = *(short*)((int)&inst->matrix + 0x10); - newInst->matrix.t[0] = inst->matrix.t[0]; - newInst->matrix.t[1] = inst->matrix.t[1]; - newInst->matrix.t[2] = inst->matrix.t[2]; + newInst->matrix.t.x = inst->matrix.t.x; + newInst->matrix.t.y = inst->matrix.t.y; + newInst->matrix.t.z = inst->matrix.t.z; newInst->alphaScale = 0xc00; @@ -188,9 +188,9 @@ void DECOMP_AH_WarpPad_LInB(struct Instance* inst) *(int*)((int)&newInst->matrix + 0x8) = *(int*)((int)&inst->matrix + 0x8); *(int*)((int)&newInst->matrix + 0xC) = *(int*)((int)&inst->matrix + 0xC); *(short*)((int)&newInst->matrix + 0x10) = *(short*)((int)&inst->matrix + 0x10); - newInst->matrix.t[0] = inst->matrix.t[0]; - newInst->matrix.t[1] = inst->matrix.t[1] + i * 0x400; - newInst->matrix.t[2] = inst->matrix.t[2]; + newInst->matrix.t.x = inst->matrix.t.x; + newInst->matrix.t.y = inst->matrix.t.y + i * 0x400; + newInst->matrix.t.z = inst->matrix.t.z; newInst->alphaScale = 0x400; @@ -321,9 +321,9 @@ void DECOMP_AH_WarpPad_LInB(struct Instance* inst) *(int*)((int)&newInst->matrix + 0x8) = *(int*)((int)&inst->matrix + 0x8); *(int*)((int)&newInst->matrix + 0xC) = *(int*)((int)&inst->matrix + 0xC); *(short*)((int)&newInst->matrix + 0x10) = *(short*)((int)&inst->matrix + 0x10); - newInst->matrix.t[0] = inst->matrix.t[0]; - newInst->matrix.t[1] = inst->matrix.t[1] + 0x100; - newInst->matrix.t[2] = inst->matrix.t[2]; + newInst->matrix.t.x = inst->matrix.t.x; + newInst->matrix.t.y = inst->matrix.t.y + 0x100; + newInst->matrix.t.z = inst->matrix.t.z; } } @@ -425,9 +425,9 @@ void DECOMP_AH_WarpPad_LInB(struct Instance* inst) *(int*)((int)&newInst->matrix + 0x8) = *(int*)((int)&inst->matrix + 0x8); *(int*)((int)&newInst->matrix + 0xC) = *(int*)((int)&inst->matrix + 0xC); *(short*)((int)&newInst->matrix + 0x10) = *(short*)((int)&inst->matrix + 0x10); - newInst->matrix.t[0] = inst->matrix.t[0]; - newInst->matrix.t[1] = inst->matrix.t[1] + 0x100; - newInst->matrix.t[2] = inst->matrix.t[2]; + newInst->matrix.t.x = inst->matrix.t.x; + newInst->matrix.t.y = inst->matrix.t.y + 0x100; + newInst->matrix.t.z = inst->matrix.t.z; newInst->scale[0] = 0x2000; newInst->scale[1] = 0x2000; @@ -516,9 +516,9 @@ void DECOMP_AH_WarpPad_LInB(struct Instance* inst) *(int*)((int)&newInst->matrix + 0x8) = 0x1000; *(int*)((int)&newInst->matrix + 0xC) = 0; *(short*)((int)&newInst->matrix + 0x10) = 0x1000; - newInst->matrix.t[0] = inst->matrix.t[0]; - newInst->matrix.t[1] = inst->matrix.t[1] + 0x100; - newInst->matrix.t[2] = inst->matrix.t[2]; + newInst->matrix.t.x = inst->matrix.t.x; + newInst->matrix.t.y = inst->matrix.t.y + 0x100; + newInst->matrix.t.z = inst->matrix.t.z; newInst->scale[0] = 0x2000; newInst->scale[1] = 0x2000; @@ -542,9 +542,9 @@ void DECOMP_AH_WarpPad_LInB(struct Instance* inst) *(int*)((int)&newInst->matrix + 0x8) = 0x1000; *(int*)((int)&newInst->matrix + 0xC) = 0; *(short*)((int)&newInst->matrix + 0x10) = 0x1000; - newInst->matrix.t[0] = inst->matrix.t[0]; - newInst->matrix.t[1] = inst->matrix.t[1] + 0x100; - newInst->matrix.t[2] = inst->matrix.t[2]; + newInst->matrix.t.x = inst->matrix.t.x; + newInst->matrix.t.y = inst->matrix.t.y + 0x100; + newInst->matrix.t.z = inst->matrix.t.z; newInst->scale[0] = 0x2000; newInst->scale[1] = 0x2000; @@ -573,9 +573,9 @@ void DECOMP_AH_WarpPad_LInB(struct Instance* inst) *(int*)((int)&newInst->matrix + 0x8) = 0x1000; *(int*)((int)&newInst->matrix + 0xC) = 0; *(short*)((int)&newInst->matrix + 0x10) = 0x1000; - newInst->matrix.t[0] = inst->matrix.t[0]; - newInst->matrix.t[1] = inst->matrix.t[1] + 0x100; - newInst->matrix.t[2] = inst->matrix.t[2]; + newInst->matrix.t.x = inst->matrix.t.x; + newInst->matrix.t.y = inst->matrix.t.y + 0x100; + newInst->matrix.t.z = inst->matrix.t.z; newInst->scale[0] = 0x2000; newInst->scale[1] = 0x2000; diff --git a/decompile/General/232/232_08_AH_Garage_Open.c b/decompile/General/232/232_08_AH_Garage_Open.c index 48afeb515..bb3dacc6b 100644 --- a/decompile/General/232/232_08_AH_Garage_Open.c +++ b/decompile/General/232/232_08_AH_Garage_Open.c @@ -25,7 +25,7 @@ void DECOMP_AH_Garage_Open(struct ScratchpadStruct* sps,struct Thread* otherTh) // if door is closed, // if posY is the same as instDef posY - (garageInst->matrix.t[1] == garageInst->instDef->pos[1]) + (garageInst->matrix.t.y == garageInst->instDef->pos[1]) ) { // if you are not in gemstone valley diff --git a/decompile/General/232/232_09_AH_Garage_ThTick.c b/decompile/General/232/232_09_AH_Garage_ThTick.c index 4f6feb6fc..f26246a1c 100644 --- a/decompile/General/232/232_09_AH_Garage_ThTick.c +++ b/decompile/General/232/232_09_AH_Garage_ThTick.c @@ -70,8 +70,8 @@ void DECOMP_AH_Garage_ThTick(struct Thread *t) else { // Increment animation by 0x20 in either direction - move = inst->matrix.t[1] + garage->direction * FPS_HALF(0x20); - inst->matrix.t[1] = move; + move = inst->matrix.t.y + garage->direction * FPS_HALF(0x20); + inst->matrix.t.y = move; top = inst->instDef->pos[1] + 0x300; bottom = inst->instDef->pos[1]; @@ -80,7 +80,7 @@ void DECOMP_AH_Garage_ThTick(struct Thread *t) if (move > top) { // Set position to the top - inst->matrix.t[1] = top; + inst->matrix.t.y = top; // Door is now open (not moving) garage->direction = 0; @@ -95,7 +95,7 @@ void DECOMP_AH_Garage_ThTick(struct Thread *t) else if (move < bottom) { // Set position to the bottom - inst->matrix.t[1] = bottom; + inst->matrix.t.y = bottom; garage->direction = 0; @@ -155,9 +155,9 @@ void DECOMP_AH_Garage_ThTick(struct Thread *t) bossIsOpen = false; LAB_800aec34: - dist[0] = drv_inst->matrix.t[0] - inst->instDef->pos[0]; - dist[1] = drv_inst->matrix.t[1] - inst->instDef->pos[1]; - dist[2] = drv_inst->matrix.t[2] - inst->instDef->pos[2]; + dist[0] = drv_inst->matrix.t.x - inst->instDef->pos[0]; + dist[1] = drv_inst->matrix.t.y - inst->instDef->pos[1]; + dist[2] = drv_inst->matrix.t.z - inst->instDef->pos[2]; // if in a state where you're seeing the boss key open an adv door, // or some other kind of cutscene where you can't move @@ -243,9 +243,9 @@ void DECOMP_AH_Garage_ThTick(struct Thread *t) pos[2] = (int)inst->instDef->pos[2] + (ratio * -0x280 >> 0xc); // DriverPos - DoorPos - dist[0] = drv_inst->matrix.t[0] - pos[0]; - dist[1] = drv_inst->matrix.t[1] - pos[1]; - dist[2] = drv_inst->matrix.t[2] - pos[2]; + dist[0] = drv_inst->matrix.t.x - pos[0]; + dist[1] = drv_inst->matrix.t.y - pos[1]; + dist[2] = drv_inst->matrix.t.z - pos[2]; // If small distance (inside garage) if (dist[0] * dist[0] + dist[1] * dist[1] + dist[2] * dist[2] < 0x40000) diff --git a/decompile/General/232/232_10_AH_Garage_LInB.c b/decompile/General/232/232_10_AH_Garage_LInB.c index 6d6c5117e..f6564e299 100644 --- a/decompile/General/232/232_10_AH_Garage_LInB.c +++ b/decompile/General/232/232_10_AH_Garage_LInB.c @@ -67,20 +67,20 @@ void DECOMP_AH_Garage_LInB(struct Instance *inst) *(int*)&garageTop->matrix.m[1][1] = *(int*)&inst->matrix.m[1][1]; *(int*)&garageTop->matrix.m[2][0] = *(int*)&inst->matrix.m[2][0]; garageTop->matrix.m[2][2] = inst->matrix.m[2][2]; - garageTop->matrix.t[0] = inst->matrix.t[0]; - garageTop->matrix.t[1] = inst->matrix.t[1]; - garageTop->matrix.t[2] = inst->matrix.t[2]; + garageTop->matrix.t.x = inst->matrix.t.x; + garageTop->matrix.t.y = inst->matrix.t.y; + garageTop->matrix.t.z = inst->matrix.t.z; ratio = DECOMP_MATH_Sin((int)inst->instDef->rot[1]); // continue setting GarageTop position - garageTop->matrix.t[0] = inst->matrix.t[0] + (ratio * 0x4c >> 0xc); - garageTop->matrix.t[1] = inst->matrix.t[1] + 0x300; + garageTop->matrix.t.x = inst->matrix.t.x + (ratio * 0x4c >> 0xc); + garageTop->matrix.t.y = inst->matrix.t.y + 0x300; ratio = DECOMP_MATH_Cos((int)inst->instDef->rot[1]); // continue setting GarageTop position - garageTop->matrix.t[2] = inst->matrix.t[2] + (ratio * 0x4c >> 0xc); + garageTop->matrix.t.z = inst->matrix.t.z + (ratio * 0x4c >> 0xc); garageTop->unk50 = 0xfe; diff --git a/decompile/General/232/232_12_AH_SaveObj_ThTick.c b/decompile/General/232/232_12_AH_SaveObj_ThTick.c index 1acf8476e..1213b5f95 100644 --- a/decompile/General/232/232_12_AH_SaveObj_ThTick.c +++ b/decompile/General/232/232_12_AH_SaveObj_ThTick.c @@ -28,9 +28,9 @@ void DECOMP_AH_SaveObj_ThTick(struct Thread* t) driverInst = driver->instSelf; // Get difference in positions between instances - distX = saveInst->matrix.t[0] - driverInst->matrix.t[0]; - distY = saveInst->matrix.t[1] - driverInst->matrix.t[1]; - distZ = saveInst->matrix.t[2] - driverInst->matrix.t[2]; + distX = saveInst->matrix.t.x - driverInst->matrix.t.x; + distY = saveInst->matrix.t.y - driverInst->matrix.t.y; + distZ = saveInst->matrix.t.z - driverInst->matrix.t.z; save = t->object; diff --git a/decompile/General/232/232_13_AH_SaveObj_LInB.c b/decompile/General/232/232_13_AH_SaveObj_LInB.c index 7e591e027..b20c3d260 100644 --- a/decompile/General/232/232_13_AH_SaveObj_LInB.c +++ b/decompile/General/232/232_13_AH_SaveObj_LInB.c @@ -63,9 +63,9 @@ void DECOMP_AH_SaveObj_LInB(struct Instance* savInst) inst->matrix.m[2][0] = savInst->matrix.m[2][0]; inst->matrix.m[2][2] = savInst->matrix.m[2][2]; - inst->matrix.t[0] = savInst->matrix.t[0]; - inst->matrix.t[1] = savInst->matrix.t[1]; - inst->matrix.t[2] = savInst->matrix.t[2]; + inst->matrix.t.x = savInst->matrix.t.x; + inst->matrix.t.y = savInst->matrix.t.y; + inst->matrix.t.z = savInst->matrix.t.z; rot[0] = gGT->level1->ptrSpawnType2_PosRot->posCoords[3]; rot[1] = gGT->level1->ptrSpawnType2_PosRot->posCoords[4]; @@ -74,9 +74,9 @@ void DECOMP_AH_SaveObj_LInB(struct Instance* savInst) // converted to TEST in rebuildPS1 ConvertRotToMatrix(&inst->matrix, (short*)&rot); - inst->matrix.t[0] = (int)gGT->level1->ptrSpawnType2_PosRot->posCoords[0]; - inst->matrix.t[1] = (int)gGT->level1->ptrSpawnType2_PosRot->posCoords[1]; - inst->matrix.t[2] = (int)gGT->level1->ptrSpawnType2_PosRot->posCoords[2]; + inst->matrix.t.x = (int)gGT->level1->ptrSpawnType2_PosRot->posCoords[0]; + inst->matrix.t.y = (int)gGT->level1->ptrSpawnType2_PosRot->posCoords[1]; + inst->matrix.t.z = (int)gGT->level1->ptrSpawnType2_PosRot->posCoords[2]; inst->unk50 = 0xf8; diff --git a/decompile/General/232/232_15_AH_Door_ThTick.c b/decompile/General/232/232_15_AH_Door_ThTick.c index 7dd46d55e..ab98090f3 100644 --- a/decompile/General/232/232_15_AH_Door_ThTick.c +++ b/decompile/General/232/232_15_AH_Door_ThTick.c @@ -13,14 +13,12 @@ void DECOMP_AH_Door_ThTick(struct Thread* t) u_int chkRewards; int i; int ratio; - int distX; - int distY; - int distZ; + Vec3 distance; int dist; int iVar17; int iVar18; - short desiredPos[3]; - short desiredRot[3]; + SVec3 desiredPos; + SVec3 desiredRot; short* scaler; struct GameTracker* gGT = sdata->gGT; @@ -39,7 +37,7 @@ void DECOMP_AH_Door_ThTick(struct Thread* t) lev = gGT->levelID; // check if the door that the player approached is open - if (door->doorRot[1] == 0x400) + if (door->doorRot.y == 0x400) { // door is open doorIsOpen = true; @@ -49,19 +47,19 @@ void DECOMP_AH_Door_ThTick(struct Thread* t) ratio = DECOMP_MATH_Cos((int)doorInst->instDef->rot[1]); // X distance of player and door - distX = doorInst->matrix.t[0] + (ratio * 0x300 >> 0xc) - driver->instSelf->matrix.t[0]; + distance.x = doorInst->matrix.t.x + (ratio * 0x300 >> 0xc) - driver->instSelf->matrix.t.x; // Y distance of player and door - distY = doorInst->matrix.t[1] - driver->instSelf->matrix.t[1]; + distance.y = doorInst->matrix.t.y - driver->instSelf->matrix.t.y; // Sine(angle) ratio = DECOMP_MATH_Sin((int)doorInst->instDef->rot[1]); // Z distance of player and door - distZ = doorInst->matrix.t[2] + (ratio * 0x300 >> 0xc) - driver->instSelf->matrix.t[2]; + distance.z = doorInst->matrix.t.z + (ratio * 0x300 >> 0xc) - driver->instSelf->matrix.t.z; // distance from player and door - dist = distX * distX + distY * distY + distZ * distZ; + dist = distance.x * distance.x + distance.y * distance.y + distance.z * distance.z; // If player is close to a door if (dist < 0x90000) @@ -205,10 +203,10 @@ void DECOMP_AH_Door_ThTick(struct Thread* t) if (driver->speedApprox < 0x80) { // Actually, specLightDir - desiredPos[0] = -0xc98; - desiredPos[1] = 0x99f; - desiredPos[2] = 0x232; - + desiredPos.x = -0xc98; + desiredPos.y = 0x99f; + desiredPos.z = 0x232; + // if keys are not spawned, create them if (door->keyInst[0] == NULL) { @@ -238,9 +236,9 @@ void DECOMP_AH_Door_ThTick(struct Thread* t) keyInst->matrix.m[2][2] = driverInst->matrix.m[2][2]; // copy position for key from driver - keyInst->matrix.t[0] = driverInst->matrix.t[0]; - keyInst->matrix.t[1] = driverInst->matrix.t[1]; - keyInst->matrix.t[2] = driverInst->matrix.t[2]; + keyInst->matrix.t.x = driverInst->matrix.t.x; + keyInst->matrix.t.y = driverInst->matrix.t.y; + keyInst->matrix.t.z = driverInst->matrix.t.z; // set scale to zero keyInst->scale[0] = 0; @@ -279,10 +277,10 @@ void DECOMP_AH_Door_ThTick(struct Thread* t) } // if key posY is less than (player posY + 0xa0) - if (keyInst->matrix.t[1] < (driver->instSelf->matrix.t[1] + 0xa0)) + if (keyInst->matrix.t.y < (driver->instSelf->matrix.t.y + 0xa0)) { // increase key posY - keyInst->matrix.t[1] += FPS_HALF(4); + keyInst->matrix.t.y += FPS_HALF(4); } if (1 < numKeys) @@ -298,30 +296,30 @@ void DECOMP_AH_Door_ThTick(struct Thread* t) ratio = DECOMP_MATH_Sin(door->keyOrbit + iVar18); - keyInst->matrix.t[0] = driver->instSelf->matrix.t[0] + ((iVar17 >> 5) * ratio >> 0xc); + keyInst->matrix.t.x = driver->instSelf->matrix.t.x + ((iVar17 >> 5) * ratio >> 0xc); ratio = DECOMP_MATH_Cos(door->keyOrbit + iVar18); - keyInst->matrix.t[2] = driver->instSelf->matrix.t[2] + ((iVar17 >> 5) * ratio >> 0xc); + keyInst->matrix.t.z = driver->instSelf->matrix.t.z + ((iVar17 >> 5) * ratio >> 0xc); } #ifndef REBUILD_PS1 - short* kr = &door->keyRot[0]; + // desiredPos is actually specLightDir in this case, variable re-use - Vector_SpecLightSpin3D(keyInst, kr, &desiredPos[0]); + Vector_SpecLightSpin3D(keyInst, (short*)&door->keyRot, (short*)&desiredPos); // convert 3 rotation shorts into rotation matrix - ConvertRotToMatrix(&keyInst->matrix, kr); + ConvertRotToMatrix(&keyInst->matrix, (short*)&door->keyRot); #endif } door->keyInst[i] = keyInst; } } - door->keyRot[0] = 0; - door->keyRot[1] += FPS_HALF(0x40); - door->keyRot[2] = 0; + door->keyRot.x = 0; + door->keyRot.y += FPS_HALF(0x40); + door->keyRot.z = 0; door->keyOrbit += 0x10; @@ -366,26 +364,26 @@ void DECOMP_AH_Door_ThTick(struct Thread* t) i = DECOMP_MATH_Cos((int)doorInst->instDef->rot[1] + 0x400); // desired posX for transition - desiredPos[0] = doorInst->matrix.t[0] + (short)(ratio * 0x312 >> 0xc) + + desiredPos.x = doorInst->matrix.t.x + (short)(ratio * 0x312 >> 0xc) + (short)(i * 0x600 >> 0xc); // desired posY for transition - desiredPos[1] = doorInst->matrix.t[1] + 0x17a; + desiredPos.y = doorInst->matrix.t.y + 0x17a; ratio = DECOMP_MATH_Sin((int)doorInst->instDef->rot[1]); i = DECOMP_MATH_Sin((int)doorInst->instDef->rot[1] + 0x400); // desired posZ for transition - desiredPos[2] = doorInst->matrix.t[2] + (short)(ratio * 0x312 >> 0xc) + + desiredPos.z = doorInst->matrix.t.z + (short)(ratio * 0x312 >> 0xc) + (short)(i * 0x600 >> 0xc); // desired rotation for transition - desiredRot[0] = doorInst->instDef->rot[0] + 0x800; - desiredRot[1] = doorInst->instDef->rot[1]; - desiredRot[2] = doorInst->instDef->rot[2]; + desiredRot.x = doorInst->instDef->rot[0] + 0x800; + desiredRot.y = doorInst->instDef->rot[1]; + desiredRot.z = doorInst->instDef->rot[2]; // set desired position and rotation for CamerDC transition - DECOMP_CAM_SetDesiredPosRot(&gGT->cameraDC[0], &desiredPos[0], &desiredRot[0]); + DECOMP_CAM_SetDesiredPosRot(&gGT->cameraDC[0], (short*)&desiredPos, (short*)&desiredRot); #ifndef REBUILD_PS1 GAMEPAD_JogCon2(driver, 0, 0); @@ -399,21 +397,21 @@ void DECOMP_AH_Door_ThTick(struct Thread* t) // == door is opening == - door->doorRot[1] += FPS_HALF(0x10); + door->doorRot.y += FPS_HALF(0x10); // right-hand door rot[x,y,z] - desiredRot[0] = door->doorRot[0]; - desiredRot[1] = doorInst->instDef->rot[1] - door->doorRot[1]; - desiredRot[2] = door->doorRot[2]; + desiredRot.x = door->doorRot.x; + desiredRot.y = doorInst->instDef->rot[1] - door->doorRot.y; + desiredRot.z = door->doorRot.z; // converted to TEST in rebuildPS1 - ConvertRotToMatrix(&door->otherDoor->matrix, &desiredRot[0]); + ConvertRotToMatrix(&door->otherDoor->matrix, (short*)&desiredRot); // left-hand door rot[x,y,z] - desiredRot[1] = doorInst->instDef->rot[1] + door->doorRot[1]; + desiredRot.y = doorInst->instDef->rot[1] + door->doorRot.y; // converted to TEST in rebuildPS1 - ConvertRotToMatrix(&doorInst->matrix, &desiredRot[0]); + ConvertRotToMatrix(&doorInst->matrix, (short*)&desiredRot); // if less than 11 frames have passed, // decrease key scale, then quit function @@ -451,7 +449,7 @@ void DECOMP_AH_Door_ThTick(struct Thread* t) } // if not last frame of opening door - if(door->doorRot[1] < 0x400) return; + if(door->doorRot.y < 0x400) return; // == Door is fully open == diff --git a/decompile/General/232/232_16_AH_Door_LInB.c b/decompile/General/232/232_16_AH_Door_LInB.c index 0ea740439..0379d0055 100644 --- a/decompile/General/232/232_16_AH_Door_LInB.c +++ b/decompile/General/232/232_16_AH_Door_LInB.c @@ -7,8 +7,8 @@ void DECOMP_AH_Door_LInB(struct Instance *inst) short sVar2; int levelID; int ratio; - short leftRot[3]; - short rightRot[3]; + SVec3 leftRot; + SVec3 rightRot; struct GameTracker *gGT; struct Thread *t; @@ -30,7 +30,7 @@ void DECOMP_AH_Door_LInB(struct Instance *inst) ( SIZE_RELATIVE_POOL_BUCKET ( - 0x38, + sizeof(struct WoodDoor), NONE, SMALL, STATIC @@ -69,9 +69,9 @@ void DECOMP_AH_Door_LInB(struct Instance *inst) woodDoor->frameCount_doorOpenAnim = 0; woodDoor->keyShrinkFrame = 0; - woodDoor->doorRot[0] = 0; - woodDoor->doorRot[1] = 0; - woodDoor->doorRot[2] = 0; + woodDoor->doorRot.x = 0; + woodDoor->doorRot.y = 0; + woodDoor->doorRot.z = 0; // Level ID is Glacier Park if (levelID == GLACIER_PARK) @@ -120,22 +120,22 @@ void DECOMP_AH_Door_LInB(struct Instance *inst) *(int*)&otherDoorInst->matrix.m[1][1] = *(int*)&inst->matrix.m[1][1]; *(int*)&otherDoorInst->matrix.m[2][0] = *(int*)&inst->matrix.m[2][0]; otherDoorInst->matrix.m[2][2] = inst->matrix.m[2][2]; - otherDoorInst->matrix.t[0] = inst->matrix.t[0]; - otherDoorInst->matrix.t[1] = inst->matrix.t[1]; - otherDoorInst->matrix.t[2] = inst->matrix.t[2]; + otherDoorInst->matrix.t.x = inst->matrix.t.x; + otherDoorInst->matrix.t.y = inst->matrix.t.y; + otherDoorInst->matrix.t.z = inst->matrix.t.z; // set scaleX to -0x1000 otherDoorInst->scale[0] = 0xf000; ratio = DECOMP_MATH_Cos((int)inst->instDef->rot[1]); - otherDoorInst->matrix.t[0] += (ratio * 0x600 >> 0xc); + otherDoorInst->matrix.t.x += (ratio * 0x600 >> 0xc); - otherDoorInst->matrix.t[1] = inst->matrix.t[1]; + otherDoorInst->matrix.t.y = inst->matrix.t.y; ratio = DECOMP_MATH_Sin((int)(int)inst->instDef->rot[1]); - otherDoorInst->matrix.t[2] += (ratio * 0x600 >> 0xc); + otherDoorInst->matrix.t.z += (ratio * 0x600 >> 0xc); // both doors always face camera headers = inst->model->headers; @@ -163,21 +163,21 @@ void DECOMP_AH_Door_LInB(struct Instance *inst) (levelID == GLACIER_PARK) && ((sdata->advProgress.rewards[3] & 0x100) != 0)) { // rotation = 90 degrees - woodDoor->doorRot[1] = 0x400; + woodDoor->doorRot.y = 0x400; - leftRot[0] = woodDoor->doorRot[0]; - leftRot[1] = inst->instDef->rot[1] + woodDoor->doorRot[1]; - leftRot[2] = woodDoor->doorRot[2]; + leftRot.x = woodDoor->doorRot.x; + leftRot.y = inst->instDef->rot[1] + woodDoor->doorRot.y; + leftRot.z = woodDoor->doorRot.z; - rightRot[0] = woodDoor->doorRot[0]; - rightRot[1] = inst->instDef->rot[1] - woodDoor->doorRot[1]; - rightRot[2] = woodDoor->doorRot[2]; + rightRot.x = woodDoor->doorRot.x; + rightRot.y = inst->instDef->rot[1] - woodDoor->doorRot.y; + rightRot.z = woodDoor->doorRot.z; // make matrices for both doors rotated open // converted to TEST in rebuildPS1 - ConvertRotToMatrix(&inst->matrix, &leftRot[0]); - ConvertRotToMatrix(&otherDoorInst->matrix, &rightRot[0]); + ConvertRotToMatrix(&inst->matrix, (short*)&leftRot); + ConvertRotToMatrix(&otherDoorInst->matrix, (short*)&rightRot); } return; } \ No newline at end of file diff --git a/decompile/General/232/232_18_AH_Map_LoadSave_Full.c b/decompile/General/232/232_18_AH_Map_LoadSave_Full.c index 60d7d92bb..8d6e46595 100644 --- a/decompile/General/232/232_18_AH_Map_LoadSave_Full.c +++ b/decompile/General/232/232_18_AH_Map_LoadSave_Full.c @@ -1,7 +1,7 @@ #include void DECOMP_AH_Map_LoadSave_Full( - int posX, int posY, + Vec2* pos, short* vertPos, char* vertCol, int unk800, int angle) { @@ -16,7 +16,7 @@ void DECOMP_AH_Map_LoadSave_Full( for(int i = 0; i < 4; i++) { local_30[i*2+0] = - posX + 6 + + pos->x + 6 + (short)(( ( ((vertPos[2*i+0] * cos) >> 0xc) + @@ -26,7 +26,7 @@ void DECOMP_AH_Map_LoadSave_Full( ) >> 0xc); local_30[i*2+1] = - posY + 4 + + pos->y + 4 + (short)(( ( ((vertPos[2*i+1] * cos) >> 0xc) - diff --git a/decompile/General/232/232_19_AH_Map_HubArrow.c b/decompile/General/232/232_19_AH_Map_HubArrow.c index a43b604e5..38ce24332 100644 --- a/decompile/General/232/232_19_AH_Map_HubArrow.c +++ b/decompile/General/232/232_19_AH_Map_HubArrow.c @@ -1,8 +1,8 @@ #include void DECOMP_AH_Map_HubArrow( - int posX, int posY, - short* vertPos, char* vertCol, + Vec2* pos, + short* arrowPos, char* arrowCol, int unk800, int angle) { short local_30 [6]; @@ -16,21 +16,21 @@ void DECOMP_AH_Map_HubArrow( for(int i = 0; i < 3; i++) { local_30[i*2+0] = - posX + 6 + + pos->x + 6 + (short)(( ( - ((vertPos[2*i+0] * cos) >> 0xc) + - ((vertPos[2*i+1] * sin) >> 0xc) + ((arrowPos[2*i+0] * cos) >> 0xc) + + ((arrowPos[2*i+1] * sin) >> 0xc) ) * ((unk800 * 8) / 5) ) >> 0xc); local_30[i*2+1] = - posY + 4 + + pos->y + 4 + (short)(( ( - ((vertPos[2*i+1] * cos) >> 0xc) - - ((vertPos[2*i+0] * sin) >> 0xc) + ((arrowPos[2*i+1] * cos) >> 0xc) - + ((arrowPos[2*i+0] * sin) >> 0xc) ) * unk800 ) >> 0xc); @@ -50,10 +50,10 @@ void DECOMP_AH_Map_HubArrow( } DECOMP_RECTMENU_DrawRwdTriangle( - &local_20[0], vertCol, + &local_20[0], arrowCol, gGT->pushBuffer_UI.ptrOT, &gGT->backBuffer->primMem); - vertCol = (char*)&D232.colorTri[0]; + arrowCol = (char*)&D232.colorTri[0]; } } \ No newline at end of file diff --git a/decompile/General/232/232_20_AH_Map_HubArrowOutter.c b/decompile/General/232/232_20_AH_Map_HubArrowOutter.c index e0d4254e2..9ffae84c9 100644 --- a/decompile/General/232/232_20_AH_Map_HubArrowOutter.c +++ b/decompile/General/232/232_20_AH_Map_HubArrowOutter.c @@ -1,15 +1,15 @@ #include void DECOMP_AH_Map_HubArrowOutter( - void* hubPtrs, int arrowIndex, - int posX, int posY, + struct Map* hubPtrs, int arrowIndex, + Vec2* pos, int inputAngle, int type) { struct GameTracker* gGT; gGT = sdata->gGT; - posX += D232.hubArrowXY_Inner[2*type+0]; - posY += D232.hubArrowXY_Inner[2*type+1]; + pos->x += D232.hubArrowXY_Inner[2*type+0]; + pos->y += D232.hubArrowXY_Inner[2*type+1]; int timer = gGT->timer >> FPS_RIGHTSHIFT(0); @@ -32,8 +32,8 @@ void DECOMP_AH_Map_HubArrowOutter( var14 = 0xff; var8 = 0x555; - posX += D232.hubArrowXY_Outter[2*(((inputAngle>>0x8)&0xc)>>2)+0]; - posY += D232.hubArrowXY_Outter[2*(((inputAngle>>0x8)&0xc)>>2)+1]; + pos->x += D232.hubArrowXY_Outter[2*(((inputAngle>>0x8)&0xc)>>2)+0]; + pos->y += D232.hubArrowXY_Outter[2*(((inputAngle>>0x8)&0xc)>>2)+1]; } else @@ -76,8 +76,8 @@ void DECOMP_AH_Map_HubArrowOutter( int iVar4 = (var5 & 1) + 0xc; - sin = posX + ((((iVar16 << 3) / 5) * sin) >> iVar4); - cos = posY - ((((iVar16 ) ) * cos) >> iVar4); + sin = pos->x + ((((iVar16 << 3) / 5) * sin) >> iVar4); + cos = pos->y - ((((iVar16 ) ) * cos) >> iVar4); if(!bVar1) { diff --git a/decompile/General/232/232_21_AH_Map_HubItems.c b/decompile/General/232/232_21_AH_Map_HubItems.c index 97480cf11..607302196 100644 --- a/decompile/General/232/232_21_AH_Map_HubItems.c +++ b/decompile/General/232/232_21_AH_Map_HubItems.c @@ -1,39 +1,35 @@ #include -void DECOMP_AH_Map_HubItems(void* hubPtrs, short *param_2) +void DECOMP_AH_Map_HubItems(struct Map* hubPtrs, short* type) { struct GameTracker *gGT; struct AdvProgress *adv; short levelID; short hubID; - short sVar1; + short iconType; short *trophies; bool open; - int iVar3; + int menu_TrackIndex; u_int bit; int iVar5; int uVar6; short sVar7; short sVar8; - short *psVar9; - short *psVar10; - int pos3D[3]; - int local_40; - int local_3c; - int local_38; - int local_34; - int local_30; - int local_2c; + struct HubItem* hubItems; + SVec2 pos; + Vec3 pos3D; gGT = sdata->gGT; adv = &sdata->advProgress; levelID = gGT->levelID; - psVar10 = D232.hubItemsXY_ptrArray[levelID - GEM_STONE_VALLEY]; - if (*psVar10 != -1) + hubItems = D232.hubItemsXY_ptrArray[levelID - GEM_STONE_VALLEY]; + pos = hubItems->pos; + + if (pos.x != -1) { - psVar9 = psVar10 + 1; + do { sVar8 = -1; @@ -43,12 +39,12 @@ void DECOMP_AH_Map_HubItems(void* hubPtrs, short *param_2) sVar7 = -1; // iconType - sVar1 = psVar9[2]; + iconType = hubItems->iconType; open = true; // Arrow beach->gemstone - if (sVar1 == -1) + if (iconType == -1) { sVar7 = 0; @@ -67,20 +63,19 @@ void DECOMP_AH_Map_HubItems(void* hubPtrs, short *param_2) } else { - if (-1 < sVar1) + if (iconType > -1) { - sVar7 = sVar7; // gemstone valley - if (sVar1 == 4) + if (iconType == 4) { - iVar3 = 0; + menu_TrackIndex = 0; iVar5 = 0; // check 4 boss keys - for (iVar3 = 0; iVar3 < 4; iVar3++) + for (menu_TrackIndex = 0; menu_TrackIndex < 4; menu_TrackIndex++) { - bit = iVar3 + 0x5e; + bit = menu_TrackIndex + PRIZE_BOSS_KEY; if (CHECK_ADV_BIT(adv->rewards, bit) == 0) { @@ -102,23 +97,24 @@ void DECOMP_AH_Map_HubItems(void* hubPtrs, short *param_2) { iVar5 = 0; - if (3 < sVar1) + if (3 < iconType) { iVar5 = -0x10000; sVar8 = sVar8; // saveLoad screen (0x64) - if (sVar1 == 100) + if (iconType == 100) { - local_40 = (int)*psVar10 + -0x200; - local_3c = (int)*psVar9 + -0x100; + Vec2 newPos; + newPos.x = (int)hubItems->pos.x -0x200; + newPos.y = (int)hubItems->pos.y -0x100; - DECOMP_UI_Map_GetIconPos(hubPtrs, &local_40, &local_3c); + DECOMP_UI_Map_GetIconPos(hubPtrs, &newPos); DECOMP_AH_Map_LoadSave_Full( - local_40, local_3c, + &newPos, &D232.loadSave_pos[0], (char*)&D232.loadSave_col[0], - 0x800, (int)psVar9[1] + 0x800, (int)hubItems->angle ); iVar5 = -0x10000; @@ -131,11 +127,11 @@ void DECOMP_AH_Map_HubItems(void* hubPtrs, short *param_2) int base = levelID - N_SANITY_BEACH; - for (iVar3 = 0; iVar3 < 4; iVar3++) + for (menu_TrackIndex = 0; menu_TrackIndex < 4; menu_TrackIndex++) { trophies = &data.advHubTrackIDs[base * 4]; - if (CHECK_ADV_BIT(adv->rewards, (trophies[iVar3]+6)) == 0) + if (CHECK_ADV_BIT(adv->rewards, (trophies[menu_TrackIndex]+PRIZE_TROPHY_RACE)) == 0) { open = false; break; @@ -145,7 +141,7 @@ void DECOMP_AH_Map_HubItems(void* hubPtrs, short *param_2) goto LAB_800b17e4; // check if key is unlocked - sVar7 = CHECK_ADV_BIT(adv->rewards, (base+0x5e)); + sVar7 = CHECK_ADV_BIT(adv->rewards, (base+PRIZE_BOSS_KEY)); } // open, not beaten @@ -162,16 +158,16 @@ void DECOMP_AH_Map_HubItems(void* hubPtrs, short *param_2) } // Arrow beach->glacier - if (sVar1 == -4) + if (iconType == -4) { // locked if keys < 2 sVar7 = ((gGT->currAdvProfile.numKeys) < 2); goto LAB_800b17e8; } - if (sVar1 < -3) + if (iconType < -3) { // Arrow glacier->citadel - if (sVar1 == -5) + if (iconType == -5) { // locked if keys < 3 sVar7 = ((gGT->currAdvProfile.numKeys) < 3); @@ -184,7 +180,7 @@ void DECOMP_AH_Map_HubItems(void* hubPtrs, short *param_2) { // either arrow on Gemstone hub, // pointing to beach or to ruins - if ((sVar1 == -3) || (sVar1 == -2)) + if ((iconType == -3) || (iconType == -2)) { // never locked sVar7 = 0; @@ -195,17 +191,19 @@ void DECOMP_AH_Map_HubItems(void* hubPtrs, short *param_2) } } - if (-1 < iVar5) + if (iVar5 > -1) { - local_38 = (int)*psVar10 + -0x200; - local_34 = (int)*psVar9 + -0x100; - DECOMP_UI_Map_GetIconPos(hubPtrs, &local_38, &local_34); + Vec2 newPos; + + newPos.x = (int)hubItems->pos.x -0x200; + newPos.y = (int)hubItems->pos.y -0x100; + DECOMP_UI_Map_GetIconPos(hubPtrs, &newPos); if ((iVar5 == 0) && (D232.unkModeHubItems == 0)) { DECOMP_AH_Map_HubArrowOutter( - hubPtrs, (int)*param_2, local_38, local_34, - (0x1000 - (u_short)psVar9[1]), 1); - *param_2 = *param_2 + 1; + hubPtrs, (int)*type, &newPos, + (0x1000 - hubItems->angle), 1); + *type++; } // if even frame @@ -219,16 +217,16 @@ void DECOMP_AH_Map_HubItems(void* hubPtrs, short *param_2) } DECOMP_AH_Map_HubArrow( - local_38, local_34, + &newPos, &D232.hubArrow_pos[0], (char*)&D232.hubArrow_col1[iVar5], - 0x800, (int)psVar9[1]); + 0x800, (int)hubItems->angle); } if (-1 < sVar8) { - pos3D[0] = (int)*psVar10; - pos3D[1] = 0; - pos3D[2] = (int)*psVar9; + pos3D.x = (int)hubItems->pos.x; + pos3D.y = 0; + pos3D.z = (int)hubItems->pos.y; // if beat boss race if (sVar8 == 2) @@ -259,22 +257,19 @@ void DECOMP_AH_Map_HubItems(void* hubPtrs, short *param_2) if (sVar8 == 1) { D232.unkModeHubItems = sVar8; - local_30 = pos3D[0]; - local_2c = pos3D[2]; - DECOMP_UI_Map_GetIconPos(hubPtrs, &local_30, &local_2c); + DECOMP_UI_Map_GetIconPos(hubPtrs, &pos3D); - DECOMP_AH_Map_HubArrowOutter(hubPtrs, (int)*param_2, local_30, local_2c, 0, 2); + DECOMP_AH_Map_HubArrowOutter(hubPtrs, (int)*type, &pos3D, 0, 2); - *param_2 = *param_2 + 1; + *type++; } // draw star icon for boss - DECOMP_UI_Map_DrawRawIcon((int)hubPtrs, &pos3D[0], 0x37, uVar6, 0, 0x1000); + DECOMP_UI_Map_DrawRawIcon(hubPtrs, &pos3D, 0x37, uVar6, 0, 0x1000); } - psVar10 = psVar10 + 4; - psVar9 = psVar9 + 4; - } while (*psVar10 != -1); + + } while (hubItems->angle != -1); } return; } diff --git a/decompile/General/232/232_22_AH_Map_Warppads.c b/decompile/General/232/232_22_AH_Map_Warppads.c index 416342747..250d33a7b 100644 --- a/decompile/General/232/232_22_AH_Map_Warppads.c +++ b/decompile/General/232/232_22_AH_Map_Warppads.c @@ -18,19 +18,16 @@ static char warppadColor[8] = [4] = 0, }; -void DECOMP_AH_Map_Warppads(short* ptrMap, struct Thread* warppadThread, short *param_3) +void DECOMP_AH_Map_Warppads(struct Map* ptrMap, struct Thread* warppadThread, short* type) { struct GameTracker* gGT = sdata->gGT; struct Instance* warppadInst; char bVar1; - int distX; - int distY; - int distZ; int color; + Vec3 distance; int currDistance; int minDistance; - int posX; - int posY; + Vec2 pos; // find minDistance, set to max minDistance = 0x7fffffff; @@ -43,7 +40,7 @@ void DECOMP_AH_Map_Warppads(short* ptrMap, struct Thread* warppadThread, short * warppadThread = warppadThread->siblingThread ) { - int index = warppadThread->modelIndex; + unsigned char warppad_state = warppadThread->modelIndex; warppadInst = warppadThread->inst; // Trophy: blue/white @@ -56,42 +53,43 @@ void DECOMP_AH_Map_Warppads(short* ptrMap, struct Thread* warppadThread, short * // each color should last two frames, so use timer>>1 warppadColor[4] = ((gGT->timer >> FPS_RIGHTSHIFT(1)) & 7) + 5; - color = warppadColor[index]; + color = warppadColor[warppad_state]; // only for trophy - if (index == 1) + if (warppad_state == WARPPAD_TROPHY) { // get posZ in 3D, turns into posY in 2D - posX = warppadInst->matrix.t[0]; - posY = warppadInst->matrix.t[2]; + pos.x = warppadInst->matrix.t.x; + pos.y = warppadInst->matrix.t.z; D232.unkModeHubItems = 1; // Get Icon Dimensions - DECOMP_UI_Map_GetIconPos(ptrMap,&posX,&posY); + DECOMP_UI_Map_GetIconPos(ptrMap, &pos); - DECOMP_AH_Map_HubArrowOutter(ptrMap,(int)*param_3,posX,posY,0,0); + DECOMP_AH_Map_HubArrowOutter(ptrMap,(int)*type,&pos,0,0); - *param_3 = *param_3 + 1; + *type++; } DECOMP_UI_Map_DrawRawIcon( - (int)ptrMap, (int*)&warppadInst->matrix.t[0], + ptrMap, &warppadInst->matrix.t, 0x31, color, 0, 0x1000); // if locked - if(index == 0) + if(warppad_state == WARPPAD_LOCKED) { // skip distance check continue; } - - distX = warppadInst->matrix.t[0] - dMat->t[0]; - distY = warppadInst->matrix.t[1] - dMat->t[1]; - distZ = warppadInst->matrix.t[2] - dMat->t[2]; + + distance = warppadInst->matrix.t; + distance.x -= dMat->t.x; + distance.y -= dMat->t.y; + distance.z -= dMat->t.z; #if (!defined(REBUILD_PS1) || defined(REBUILD_PC)) - currDistance = SquareRoot0_stub(distX * distX + distY * distY + distZ * distZ); + currDistance = SquareRoot0_stub(distance.x * distance.x + distance.y * distance.y + distance.z * distance.z); if (minDistance > currDistance) minDistance = currDistance; diff --git a/decompile/General/232/232_23_AH_Map_Main.c b/decompile/General/232/232_23_AH_Map_Main.c index 06fec1764..7f03a96ee 100644 --- a/decompile/General/232/232_23_AH_Map_Main.c +++ b/decompile/General/232/232_23_AH_Map_Main.c @@ -6,14 +6,13 @@ void DECOMP_AH_Map_Main(void) struct Driver* advDriver; struct UiElement2D* ptrHudData; int iVar1; - int hubPtrs; //int*? - short local_20; - short local_1e[3]; + struct Map* hubPtrs; + short type; // force disable speedometer sdata->HudAndDebugFlags &= 0xfffffff7; - local_20 = 0; + advDriver = gGT->drivers[0]; ptrHudData = data.hudStructPtr[0]; hubPtrs = 0; @@ -55,7 +54,7 @@ void DECOMP_AH_Map_Main(void) if (gGT->level1->ptrSpawnType1->count != 0) { void** pointers = ST1_GETPOINTERS(gGT->level1->ptrSpawnType1); - hubPtrs = (int)pointers[ST1_MAP]; //cast as int*? + hubPtrs = (struct Map*)pointers[ST1_MAP]; } // if game is not paused @@ -68,21 +67,26 @@ void DECOMP_AH_Map_Main(void) // Check a HUD flag if ((gGT->hudFlags & 0x10) == 0) { - local_1e[0] = 0; + type = 0; D232.unkModeHubItems = 0; - DECOMP_UI_Map_DrawDrivers(hubPtrs,gGT->threadBuckets[0].thread,&local_20); + DECOMP_UI_Map_DrawDrivers(hubPtrs,gGT->threadBuckets[0].thread, 0); - DECOMP_AH_Map_Warppads((short*)hubPtrs,gGT->threadBuckets[5].thread,(short*)&local_1e[0]); //local_1e index 1 and 2 are never assigned to, so garbage data? + DECOMP_AH_Map_Warppads(hubPtrs,gGT->threadBuckets[5].thread, &type); //local_1e index 1 and 2 are never assigned to, so garbage data? - DECOMP_AH_Map_HubItems((void*)hubPtrs,&local_1e[0]); + DECOMP_AH_Map_HubItems(hubPtrs,&type); + SVec2 mapPos; + + mapPos.x = 500; + mapPos.y = 195; + DECOMP_UI_Map_DrawMap( gGT->ptrIcons[3], gGT->ptrIcons[4], - 500,195, + &mapPos, &gGT->backBuffer->primMem, gGT->pushBuffer_UI.ptrOT, 1); diff --git a/decompile/General/232/232_25_AH_Pause_Draw.c b/decompile/General/232/232_25_AH_Pause_Draw.c index 314a42c6e..9de0e32d3 100644 --- a/decompile/General/232/232_25_AH_Pause_Draw.c +++ b/decompile/General/232/232_25_AH_Pause_Draw.c @@ -84,6 +84,9 @@ void DECOMP_AH_Pause_Draw(int pageID, int posX) if(type == 0) { int hubID = levelID - GEM_STONE_VALLEY; + + // oxide, roo, papu, joe, pinstripe + char boss_charID = D232.advPausePages[hubID].characterID_Boss; // gemstone if(hubID == 0) @@ -107,10 +110,10 @@ void DECOMP_AH_Pause_Draw(int pageID, int posX) ptrPauseObject->PauseMember[i].inst; // Remove SelectProfile with regular UI variant - inst->matrix.t[0] = + inst->matrix.t.x = DECOMP_UI_ConvertX_2(posX + 0x16d + 1*0x1e, 0x100); - inst->matrix.t[1] = + inst->matrix.t.y = DECOMP_UI_ConvertY_2(i*0x10 + 4 + 0x2f, 0x100); // 6, 7, 8, @@ -132,7 +135,6 @@ void DECOMP_AH_Pause_Draw(int pageID, int posX) CHECK_ADV_BIT(adv->rewards, (0x10+i+0x3a)); } - char boss_charID = NITROS_OXIDE; DECOMP_DecalFont_DrawLine( sdata->lngStrings[ @@ -181,10 +183,10 @@ void DECOMP_AH_Pause_Draw(int pageID, int posX) ptrPauseObject->PauseMember[2+i].inst; // Remove SelectProfile with regular UI variant - inst->matrix.t[0] = + inst->matrix.t.x = DECOMP_UI_ConvertX_2(posX + 0x100 + (i-2)*60, 0x100); - inst->matrix.t[1] = + inst->matrix.t.y = DECOMP_UI_ConvertY_2(((i&1)<<4)|0x6a, 0x100); // gem color @@ -219,10 +221,10 @@ void DECOMP_AH_Pause_Draw(int pageID, int posX) ptrPauseObject->PauseMember[3*i+j].inst; // Remove SelectProfile with regular UI variant - inst->matrix.t[0] = + inst->matrix.t.x = DECOMP_UI_ConvertX_2(posX + 0x15e + j*0x1e, 0x100); - inst->matrix.t[1] = + inst->matrix.t.y = DECOMP_UI_ConvertY_2(i*0x10 + 0 + 0x2f, 0x100); } @@ -255,8 +257,6 @@ void DECOMP_AH_Pause_Draw(int pageID, int posX) CHECK_ADV_BIT(adv->rewards, (check[i]+0x4c)); } - // roo, papu, joe, pinstripe - char boss_charID = data.metaDataLEV[R232.bossTracks[hubID]].characterID_Boss; DECOMP_DecalFont_DrawLine( sdata->lngStrings[ @@ -271,10 +271,10 @@ void DECOMP_AH_Pause_Draw(int pageID, int posX) ptrPauseObject->PauseMember[12].inst; // Remove SelectProfile with regular UI variant - inst->matrix.t[0] = + inst->matrix.t.x = DECOMP_UI_ConvertX_2(posX + 0x15e + 1*0x1e, 0x100); - inst->matrix.t[1] = + inst->matrix.t.y = DECOMP_UI_ConvertY_2(4*0x10 + 0 + 0x2f, 0x100); ptrPauseObject->PauseMember[12].indexAdvPauseInst = 5; @@ -300,10 +300,10 @@ void DECOMP_AH_Pause_Draw(int pageID, int posX) ptrPauseObject->PauseMember[13].inst; // Remove SelectProfile with regular UI variant - inst->matrix.t[0] = + inst->matrix.t.x = DECOMP_UI_ConvertX_2(posX + 0x15e + 1*0x1e, 0x100); - inst->matrix.t[1] = + inst->matrix.t.y = DECOMP_UI_ConvertY_2(5*0x10 + 0 + 0x2f, 0x100); ptrPauseObject->PauseMember[13].indexAdvPauseInst = 13; @@ -329,10 +329,10 @@ void DECOMP_AH_Pause_Draw(int pageID, int posX) ptrPauseObject->PauseMember[i].inst; // Remove SelectProfile with regular UI variant - inst->matrix.t[0] = + inst->matrix.t.x = DECOMP_UI_ConvertX_2(instPosX, 0x100); - inst->matrix.t[1] = + inst->matrix.t.y = DECOMP_UI_ConvertY_2(instPosY + 0x41, 0x100); #ifndef REBUILD_PS1 @@ -385,10 +385,10 @@ void DECOMP_AH_Pause_Draw(int pageID, int posX) ptrPauseObject->PauseMember[i].inst; // Remove SelectProfile with regular UI variant - inst->matrix.t[0] = + inst->matrix.t.x = DECOMP_UI_ConvertX_2(instPosX, 0x100); - inst->matrix.t[1] = + inst->matrix.t.y = DECOMP_UI_ConvertY_2(0x49, 0x100); #ifndef REBUILD_PS1 @@ -524,8 +524,8 @@ void DECOMP_AH_Pause_Draw(int pageID, int posX) } rotArr[1] = - inst->matrix.t[0] * 0x10 + - inst->matrix.t[1] * 0x20 + + inst->matrix.t.x * 0x10 + + inst->matrix.t.y * 0x20 + sdata->frameCounter * FPS_HALF(0x40); rotArr[1] &= 0xfff; diff --git a/decompile/General/232/232_26_AH_Pause_Update.c b/decompile/General/232/232_26_AH_Pause_Update.c index b589f46d8..0a34da816 100644 --- a/decompile/General/232/232_26_AH_Pause_Update.c +++ b/decompile/General/232/232_26_AH_Pause_Update.c @@ -51,7 +51,7 @@ void DECOMP_AH_Pause_Update() *(int*)&inst->matrix.m[1][1] = 0x1000; *(int*)&inst->matrix.m[2][0] = 0; inst->matrix.m[2][2] = 0x1000; - inst->matrix.t[2] = 0x100; + inst->matrix.t.z = 0x100; } } diff --git a/decompile/General/232/232_27_AH_HintMenu_FiveArrows.c b/decompile/General/232/232_27_AH_HintMenu_FiveArrows.c index c4b86c4bc..aafabeea0 100644 --- a/decompile/General/232/232_27_AH_HintMenu_FiveArrows.c +++ b/decompile/General/232/232_27_AH_HintMenu_FiveArrows.c @@ -1,6 +1,6 @@ #include -void DECOMP_AH_HintMenu_FiveArrows(int param_1,short rotation) +void DECOMP_AH_HintMenu_FiveArrows(int posY,short rotation) { int *ptrColor; char i; @@ -8,15 +8,16 @@ void DECOMP_AH_HintMenu_FiveArrows(int param_1,short rotation) ptrColor = &D232.fiveArrow_col1[0]; if ((sdata->frameCounter & FPS_DOUBLE(2)) != 0) ptrColor = &D232.fiveArrow_col2[0]; + +Vec2* arrowPos; for (i = 0; i < 5; i++) { + arrowPos->x = (i * 0x32 + 0x95); + arrowPos->y = posY + 4; + DECOMP_AH_Map_HubArrow( - // posX - (i * 0x32 + 0x95), - - // posY - (param_1 + 4), + arrowPos, &D232.fiveArrow_pos[0], diff --git a/decompile/General/232/232_28_AH_HintMenu_MaskPosRot.c b/decompile/General/232/232_28_AH_HintMenu_MaskPosRot.c index 3ae554a2a..1485b3fc2 100644 --- a/decompile/General/232/232_28_AH_HintMenu_MaskPosRot.c +++ b/decompile/General/232/232_28_AH_HintMenu_MaskPosRot.c @@ -5,15 +5,17 @@ void DECOMP_AH_HintMenu_MaskPosRot(void) struct Instance* mask = sdata->instMaskHints3D; - ConvertRotToMatrix(&mask->matrix, &D232.maskRot[0]); + ConvertRotToMatrix(&mask->matrix, (short*)&D232.maskRot); // Set position - mask->matrix.t[0] = D232.maskPos[0]; - mask->matrix.t[1] = D232.maskPos[1]; - mask->matrix.t[2] = D232.maskPos[2]; + mask->matrix.t.x = D232.maskPos.x; + mask->matrix.t.y = D232.maskPos.y; + mask->matrix.t.z = D232.maskPos.z; + + struct MaskHint* hint = (struct MaskHint*)mask->thread->object; // always 0x1000 ??? - ((struct MaskHint*)mask->thread->object)->scale = + hint->scale = D232.maskScale; return; diff --git a/decompile/General/232/232_30_AH_MaskHint_Start.c b/decompile/General/232/232_30_AH_MaskHint_Start.c index 0248833ac..cb95c2051 100644 --- a/decompile/General/232/232_30_AH_MaskHint_Start.c +++ b/decompile/General/232/232_30_AH_MaskHint_Start.c @@ -48,15 +48,15 @@ void DECOMP_AH_MaskHint_Start(short hintId, u_short bool_interruptWarppad) iVar3 = (bool_interruptWarppad & 1) * 3; - short* input = &D232.maskVars[0]; + short* maskPosRotArray = &D232.maskVars[0]; - D232.maskOffsetPos[0] = input[iVar3 + 0]; - D232.maskOffsetPos[1] = input[iVar3 + 1]; - D232.maskOffsetPos[2] = input[iVar3 + 2]; + D232.maskOffsetPos.x = maskPosRotArray[iVar3 + 0]; + D232.maskOffsetPos.y = maskPosRotArray[iVar3 + 1]; + D232.maskOffsetPos.z = maskPosRotArray[iVar3 + 2]; - D232.maskOffsetRot[0] = input[iVar3 + 6]; - D232.maskOffsetRot[1] = input[iVar3 + 7]; - D232.maskOffsetRot[2] = input[iVar3 + 8]; + D232.maskOffsetRot.x = maskPosRotArray[iVar3 + 6]; + D232.maskOffsetRot.y = maskPosRotArray[iVar3 + 7]; + D232.maskOffsetRot.z = maskPosRotArray[iVar3 + 8]; for (int i = 0; i < 3; i++) { diff --git a/decompile/General/232/232_32_AH_MaskHint_SetAnim.c b/decompile/General/232/232_32_AH_MaskHint_SetAnim.c index 9b240a885..0432537c3 100644 --- a/decompile/General/232/232_32_AH_MaskHint_SetAnim.c +++ b/decompile/General/232/232_32_AH_MaskHint_SetAnim.c @@ -10,7 +10,7 @@ void DECOMP_AH_MaskHint_SetAnim(int scale) gte_SetRotMatrix(m); gte_SetTransMatrix(m); - gte_ldv0(&D232.maskOffsetPos[0]); + gte_ldv0((short*)&D232.maskOffsetPos); gte_rt(); int posEndINT[3]; @@ -23,9 +23,9 @@ void DECOMP_AH_MaskHint_SetAnim(int scale) posEnd[2] = posEndINT[2]; short rotEnd[3]; - rotEnd[0] = pb->rot[0] - D232.maskOffsetRot[0]; - rotEnd[1] = pb->rot[1] + D232.maskOffsetRot[1]; - rotEnd[2] = pb->rot[2] - D232.maskOffsetRot[2]; + rotEnd[0] = pb->rot[0] - D232.maskOffsetRot.x; + rotEnd[1] = pb->rot[1] + D232.maskOffsetRot.y; + rotEnd[2] = pb->rot[2] - D232.maskOffsetRot.z; short posCurr[3]; short rotCurr[3]; @@ -51,8 +51,8 @@ void DECOMP_AH_MaskHint_SetAnim(int scale) int cos = DECOMP_MATH_Cos(angle); struct Instance* mhInst = sdata->instMaskHints3D; - mhInst->matrix.t[0] = posCurr[0] + (short)((sin*rot)>>0xc); - mhInst->matrix.t[2] = posCurr[2] + (short)((cos*rot)>>0xc); + mhInst->matrix.t.x = posCurr[0] + (short)((sin*rot)>>0xc); + mhInst->matrix.t.z = posCurr[2] + (short)((cos*rot)>>0xc); rotCurr[1] += angle; ConvertRotToMatrix(&mhInst->matrix, rotCurr); @@ -61,5 +61,5 @@ void DECOMP_AH_MaskHint_SetAnim(int scale) angle = (sdata->frameCounter + gGT->timer) * FPS_HALF(0x20); sin = DECOMP_MATH_Sin(angle); - mhInst->matrix.t[1] = posCurr[1] + (short)(((sin << 4) >> 0xc) * scale >> 0xc); + mhInst->matrix.t.y = posCurr[1] + (short)(((sin << 4) >> 0xc) * scale >> 0xc); } \ No newline at end of file diff --git a/decompile/General/232/232_33_AH_MaskHint_SpawnParticles.c b/decompile/General/232/232_33_AH_MaskHint_SpawnParticles.c index 49f399dc4..0f393b968 100644 --- a/decompile/General/232/232_33_AH_MaskHint_SpawnParticles.c +++ b/decompile/General/232/232_33_AH_MaskHint_SpawnParticles.c @@ -44,7 +44,7 @@ void DECOMP_AH_MaskHint_SpawnParticles( #endif for(j = 0; j < 3; j++) - particle->axis[j].startVal += maskInst->matrix.t[j] * 0x100; + particle->axis[j].startVal += maskInst->matrix.t.v[j] * 0x100; particle->axis[5].startVal = (particle->axis[5].startVal * maskAnim) >> 0xc; particle->axis[5].velocity = (particle->axis[5].velocity * maskAnim) >> 0xc; diff --git a/decompile/General/232/232_35_AH_MaskHint_Update.c b/decompile/General/232/232_35_AH_MaskHint_Update.c index 099460df8..d671ab436 100644 --- a/decompile/General/232/232_35_AH_MaskHint_Update.c +++ b/decompile/General/232/232_35_AH_MaskHint_Update.c @@ -95,9 +95,9 @@ void DECOMP_AH_MaskHint_Update() D232.maskCamRotStart[2] = rot[2] & 0xfff; D232.maskCamRotStart[1] = rot[0] & 0xfff; - D232.maskCamPosStart[0] = dInst->matrix.t[0]; - D232.maskCamPosStart[1] = dInst->matrix.t[1]; - D232.maskCamPosStart[2] = dInst->matrix.t[2]; + D232.maskCamPosStart[0] = dInst->matrix.t.x; + D232.maskCamPosStart[1] = dInst->matrix.t.y; + D232.maskCamPosStart[2] = dInst->matrix.t.z; sdata->instMaskHints3D = DECOMP_VehTalkMask_Init(); struct Instance* mhInst = sdata->instMaskHints3D; diff --git a/decompile/General/232/D232.c b/decompile/General/232/D232.c index 8ff1d5eca..a73bc7afb 100644 --- a/decompile/General/232/D232.c +++ b/decompile/General/232/D232.c @@ -68,13 +68,13 @@ struct OverlayDATA_232 D232 = // 800b4e88 .timeCrystalChallenge = { - 0x1c200, // NITRO_COURT - 0x13ec0, // RAMPAGE_RUINS - 0xe100, // PARKING_LOT (null) - 0x13740, // SKULL_ROCK - 0xe100, // THE_NORTH_BOWL (null) - 0x12c00, // ROCKY_ROAD - 0xe100, // LAB_BASEMENT (null) + MINUTES(2), // NITRO_COURT + MINUTES(1) + SECONDS(25), // RAMPAGE_RUINS + MINUTES(1), // PARKING_LOT (null) + MINUTES(1) + SECONDS(23), // SKULL_ROCK + MINUTES(1), // THE_NORTH_BOWL (null) + MINUTES(1) + SECONDS(20), // ROCKY_ROAD + MINUTES(1), // LAB_BASEMENT (null) }, // 800b4ea4 @@ -155,11 +155,11 @@ struct OverlayDATA_232 D232 = .hubItemsXY_ptrArray = { - &D232.hubItems_hub1[0].posX, - &D232.hubItems_hub2[0].posX, - &D232.hubItems_hub3[0].posX, - &D232.hubItems_hub4[0].posX, - &D232.hubItems_hub5[0].posX, + &D232.hubItems_hub1[0].pos, + &D232.hubItems_hub2[0].pos, + &D232.hubItems_hub3[0].pos, + &D232.hubItems_hub4[0].pos, + &D232.hubItems_hub5[0].pos, }, .hubArrowXY_Inner = @@ -231,11 +231,11 @@ struct OverlayDATA_232 D232 = .advPausePages = { // hubs and bosses - {0x19, -1, 0, 0xF}, - {0x1A, -1, 0, 0xA}, - {0x1B, -1, 0, 0x9}, - {0x1C, -1, 0, 0xB}, - {0x1D, -1, 0, 0x8}, + {GEM_STONE_VALLEY, -1, 0, NITROS_OXIDE}, + {N_SANITY_BEACH, -1, 0, RIPPER_ROO}, + {THE_LOST_RUINS, -1, 0, PAPU_PAPU}, + {GLACIER_PARK, -1, 0, KOMODO_JOE}, + {CITADEL_CITY, -1, 0, PINSTRIPE}, // gems and relics {-1, 0x10, 1, 0}, @@ -245,29 +245,29 @@ struct OverlayDATA_232 D232 = .advPauseInst = { // gems: red, green, blue, yellow, purple - {0x5F, 0xAF0, 0x8086c, USE_SPECULAR_LIGHT, {0xfa5b, 0xf0f, 0xfe1f, 0}}, - {0x5F, 0xAF0, 0x86c08, USE_SPECULAR_LIGHT, {0xfa5b, 0xf0f, 0xfe1f, 0}}, - {0x5F, 0xAF0, 0x808000, USE_SPECULAR_LIGHT, {0xfa5b, 0xf0f, 0xfe1f, 0}}, - {0x5F, 0xAF0, 0x8080, USE_SPECULAR_LIGHT, {0xfa5b, 0xf0f, 0xfe1f, 0}}, - {0x5F, 0xAF0, 0x6c086c, USE_SPECULAR_LIGHT, {0xfa5b, 0xf0f, 0xfe1f, 0}}, + {STATIC_GEM, 0xAF0, 0x8086c, USE_SPECULAR_LIGHT, {0xfa5b, 0xf0f, 0xfe1f, 0}}, + {STATIC_GEM, 0xAF0, 0x86c08, USE_SPECULAR_LIGHT, {0xfa5b, 0xf0f, 0xfe1f, 0}}, + {STATIC_GEM, 0xAF0, 0x808000, USE_SPECULAR_LIGHT, {0xfa5b, 0xf0f, 0xfe1f, 0}}, + {STATIC_GEM, 0xAF0, 0x8080, USE_SPECULAR_LIGHT, {0xfa5b, 0xf0f, 0xfe1f, 0}}, + {STATIC_GEM, 0xAF0, 0x6c086c, USE_SPECULAR_LIGHT, {0xfa5b, 0xf0f, 0xfe1f, 0}}, // key - {0x63, 0x30D, 0xA6DC, USE_SPECULAR_LIGHT, {0xf368, 0x99f, 0xfd28}}, + {STATIC_KEY, 0x30D, 0xA6DC, USE_SPECULAR_LIGHT, {0xf368, 0x99f, 0xfd28}}, // relic: blue, gold, platinum - {0x61, 0x30D, 0xFFA560, USE_SPECULAR_LIGHT, {0xf368, 0x99f, 0x232}}, - {0x61, 0x30D, 0x9d2d8, USE_SPECULAR_LIGHT, {0xf368, 0x99f, 0x232}}, - {0x61, 0x30D, 0xe9edff, USE_SPECULAR_LIGHT, {0xf368, 0x99f, 0x232}}, + {STATIC_RELIC, 0x30D, 0xFFA560, USE_SPECULAR_LIGHT, {0xf368, 0x99f, 0x232}}, + {STATIC_RELIC, 0x30D, 0x9d2d8, USE_SPECULAR_LIGHT, {0xf368, 0x99f, 0x232}}, + {STATIC_RELIC, 0x30D, 0xe9edff, USE_SPECULAR_LIGHT, {0xf368, 0x99f, 0x232}}, // token: red, green, blue, yellow, purple - {0x7d, 0x500, 0x8086c, USE_SPECULAR_LIGHT, {0xf5f6, 0x787, 0xa0a, 0}}, - {0x7d, 0x500, 0x86c08, USE_SPECULAR_LIGHT, {0xf5f6, 0x787, 0xa0a, 0}}, - {0x7d, 0x500, 0x800000, USE_SPECULAR_LIGHT, {0xf5f6, 0x787, 0xa0a, 0}}, - {0x7d, 0x500, 0x8080, USE_SPECULAR_LIGHT, {0xf5f6, 0x787, 0xa0a, 0}}, - {0x7d, 0x500, 0x6c086c, USE_SPECULAR_LIGHT, {0xf5f6, 0x787, 0xa0a, 0}}, + {STATIC_TOKEN, 0x500, 0x8086c, USE_SPECULAR_LIGHT, {0xf5f6, 0x787, 0xa0a, 0}}, + {STATIC_TOKEN, 0x500, 0x86c08, USE_SPECULAR_LIGHT, {0xf5f6, 0x787, 0xa0a, 0}}, + {STATIC_TOKEN, 0x500, 0x800000, USE_SPECULAR_LIGHT, {0xf5f6, 0x787, 0xa0a, 0}}, + {STATIC_TOKEN, 0x500, 0x8080, USE_SPECULAR_LIGHT, {0xf5f6, 0x787, 0xa0a, 0}}, + {STATIC_TOKEN, 0x500, 0x6c086c, USE_SPECULAR_LIGHT, {0xf5f6, 0x787, 0xa0a, 0}}, // trophy - {0x62, 0x500, 0x808080, 0, {0xf368, 0x99f, 0x232}} + {STATIC_TROPHY, 0x500, 0x808080, 0, {0xf368, 0x99f, 0x232}} }, .menuHintMenu = @@ -313,7 +313,7 @@ struct OverlayDATA_232 D232 = 0, 0x180, 0 }, - .maskScale = 0x1000, + .maskScale = FP(1), .maskOffsetPos = { diff --git a/decompile/General/232/R232.c b/decompile/General/232/R232.c index 9450ba7e7..aa5f3f43e 100644 --- a/decompile/General/232/R232.c +++ b/decompile/General/232/R232.c @@ -21,7 +21,7 @@ struct OverlayRDATA_232 R232 = .bossIDs = { BOSS_OXIDE, BOSS_ROO, BOSS_PAPU, BOSS_KOMODO, BOSS_PINSTRIPE, - 0 //this should be BOSS_OXIDEFINAL but decomp doesnt use this array for gGT->bossID == 5 + 0 //this should be BOSS_OXIDEFINAL but decomp is not using this array for gGT->bossID == 5 }, .keyFrame = diff --git a/decompile/General/233/233_22_CS_Camera_BoolGotoBoss.c b/decompile/General/233/233_22_CS_Camera_BoolGotoBoss.c index 40922af3b..623fa0eff 100644 --- a/decompile/General/233/233_22_CS_Camera_BoolGotoBoss.c +++ b/decompile/General/233/233_22_CS_Camera_BoolGotoBoss.c @@ -23,6 +23,6 @@ u_char DECOMP_CS_Camera_BoolGotoBoss(void) // TRUE if TeleportSelf did NOT spawn on podium (goto boss door) return - (inst->matrix.t[0] != posCoords[0]) && - (inst->matrix.t[2] != posCoords[2]); + (inst->matrix.t.x != posCoords[0]) && + (inst->matrix.t.z != posCoords[2]); } diff --git a/decompile/General/233/233_32_CS_Podium_Stand_Init.c b/decompile/General/233/233_32_CS_Podium_Stand_Init.c index ccd0c14d9..cd88b6ff8 100644 --- a/decompile/General/233/233_32_CS_Podium_Stand_Init.c +++ b/decompile/General/233/233_32_CS_Podium_Stand_Init.c @@ -17,9 +17,9 @@ void DECOMP_CS_Podium_Stand_Init(short *podiumData) // set funcThDestroy to remove instance from instance pool inst->thread->funcThDestroy = PROC_DestroyInstance; - inst->matrix.t[0] = podiumData[0]; - inst->matrix.t[1] = podiumData[1]; - inst->matrix.t[2] = podiumData[2]; + inst->matrix.t.x = podiumData[0]; + inst->matrix.t.y = podiumData[1]; + inst->matrix.t.z = podiumData[2]; inst->unk51 += 2; inst->unk50 += 2; diff --git a/decompile/General/AltMods/16BY9/mods2.c b/decompile/General/AltMods/16BY9/mods2.c index 57722eb45..d2f3f6f0c 100644 --- a/decompile/General/AltMods/16BY9/mods2.c +++ b/decompile/General/AltMods/16BY9/mods2.c @@ -8,8 +8,8 @@ void ui16by9_ViewProj(struct PushBuffer* pb) // 750 / 1000 for 16x9 // 1000 / 1000 for 4x3 - pb->matrix_ViewProj.t[0] = - pb->matrix_ViewProj.t[0] * 750 / 1000; + pb->matrix_ViewProjmatrix.t.x = + pb->matrix_ViewProjmatrix.t.x * 750 / 1000; pb->matrix_ViewProj.m[0][0] = pb->matrix_ViewProj.m[0][0] * 750 / 1000; diff --git a/decompile/General/BOTS/BOTS_08_ThTick_RevEngine.c b/decompile/General/BOTS/BOTS_08_ThTick_RevEngine.c index 1fd397a65..eb81f7b95 100644 --- a/decompile/General/BOTS/BOTS_08_ThTick_RevEngine.c +++ b/decompile/General/BOTS/BOTS_08_ThTick_RevEngine.c @@ -11,9 +11,9 @@ void DECOMP_BOTS_ThTick_RevEngine(struct Thread* botThread) if (mask != NULL) { - mask->pos[0] = (short)(botDriver->posCurr.x >> 8); - mask->pos[1] = (short)(botDriver->posCurr.y >> 8); - mask->pos[2] = (short)(botDriver->posCurr.z >> 8); + mask->pos.x = (short)(botDriver->posCurr.x >> 8); + mask->pos.y = (short)(botDriver->posCurr.y >> 8); + mask->pos.z = (short)(botDriver->posCurr.z >> 8); } VehPhysForce_TranslateMatrix(botThread, botDriver); @@ -26,7 +26,7 @@ void DECOMP_BOTS_ThTick_RevEngine(struct Thread* botThread) { mask->scale = 0x1000; mask->duration = 0; - mask->rot[2] &= 0xfffe; + mask->rot.y &= 0xfffe; } botDriver->botData.maskObj = NULL; diff --git a/decompile/General/BOTS/BOTS_09_MaskGrab.c b/decompile/General/BOTS/BOTS_09_MaskGrab.c index 8325fcd74..904152905 100644 --- a/decompile/General/BOTS/BOTS_09_MaskGrab.c +++ b/decompile/General/BOTS/BOTS_09_MaskGrab.c @@ -86,8 +86,8 @@ void DECOMP_BOTS_MaskGrab(struct Thread* botThread) if (mask != 0) { - mask->duration = 0x1e00; - mask->rot[2] |= 1; + mask->duration = SECONDS(8); + mask->rot.y |= 1; } // execute, then assign per-frame to BOTS_ThTick_RevEngine diff --git a/decompile/General/CAMERA/CAM_19_ThTick.c b/decompile/General/CAMERA/CAM_19_ThTick.c index 976660b93..a5911e880 100644 --- a/decompile/General/CAMERA/CAM_19_ThTick.c +++ b/decompile/General/CAMERA/CAM_19_ThTick.c @@ -171,9 +171,9 @@ void DECOMP_CAM_ThTick(struct Thread *t) switch(cDC->cameraMode) { case 0: - pb->pos[0] = *(short *)(&d->instSelf->matrix.t[0]); - pb->pos[1] = *(short *)(&d->instSelf->matrix.t[1]); - pb->pos[2] = *(short *)(&d->instSelf->matrix.t[2]); + pb->pos[0] = *(short *)(&d->instSelf->matrix.t.x); + pb->pos[1] = *(short *)(&d->instSelf->matrix.t.y); + pb->pos[2] = *(short *)(&d->instSelf->matrix.t.z); pb->rot[0] = d->rotCurr.x; pb->rot[1] = d->rotCurr.y; pb->rot[2] = d->rotCurr.z; diff --git a/decompile/General/GHOST/GhostReplay_00_ThTick.c b/decompile/General/GHOST/GhostReplay_00_ThTick.c index 156ba5c9b..16f49e7fd 100644 --- a/decompile/General/GHOST/GhostReplay_00_ThTick.c +++ b/decompile/General/GHOST/GhostReplay_00_ThTick.c @@ -271,9 +271,9 @@ void DECOMP_GhostReplay_ThTick(struct Thread *t) vel[1] = (int)nextPacket->pos[1] - (int)currPacket->pos[1]; vel[2] = (int)nextPacket->pos[2] - (int)currPacket->pos[2]; - inst->matrix.t[0] = currPacket->pos[0] + ((vel[0] * lerp4096) >> 0xC); - inst->matrix.t[1] = currPacket->pos[1] + ((vel[1] * lerp4096) >> 0xC); - inst->matrix.t[2] = currPacket->pos[2] + ((vel[2] * lerp4096) >> 0xC); + inst->matrix.t.x = currPacket->pos[0] + ((vel[0] * lerp4096) >> 0xC); + inst->matrix.t.y = currPacket->pos[1] + ((vel[1] * lerp4096) >> 0xC); + inst->matrix.t.z = currPacket->pos[2] + ((vel[2] * lerp4096) >> 0xC); // Calculate delta + perform 12-bit wrapping and lerp delta = ((int)nextPacket->rot[0] - (int)currPacket->rot[0]) & 0xFFF; @@ -294,9 +294,9 @@ void DECOMP_GhostReplay_ThTick(struct Thread *t) // converted to TEST in rebuildPS1 ConvertRotToMatrix(&inst->matrix, local_rot); - d->posCurr.x = inst->matrix.t[0] << 8; - d->posCurr.y = inst->matrix.t[1] << 8; - d->posCurr.z = inst->matrix.t[2] << 8; + d->posCurr.x = inst->matrix.t.x << 8; + d->posCurr.y = inst->matrix.t.y << 8; + d->posCurr.z = inst->matrix.t.z << 8; d->rotCurr.x = local_rot[0]; d->rotCurr.y = local_rot[1]; diff --git a/decompile/General/GHOST/GhostTape_02_WriteMoves.c b/decompile/General/GHOST/GhostTape_02_WriteMoves.c index d0d4521da..ca1efc1b1 100644 --- a/decompile/General/GHOST/GhostTape_02_WriteMoves.c +++ b/decompile/General/GHOST/GhostTape_02_WriteMoves.c @@ -65,9 +65,9 @@ void DECOMP_GhostTape_WriteMoves(short raceFinished) iVar7 = iVar8->instSelf; // compress position (x, y, z) with bitshifting - iVar4 = iVar7->matrix.t[0] >> 3; - iVar3 = iVar7->matrix.t[1] >> 3; - iVar6 = iVar7->matrix.t[2] >> 3; + iVar4 = iVar7->matrix.t.x >> 3; + iVar3 = iVar7->matrix.t.y >> 3; + iVar6 = iVar7->matrix.t.z >> 3; // get change in position (x, y, z) sdata->GhostRecording.VelX = (short)iVar4 - sdata->GhostRecording.VelX; diff --git a/decompile/General/INSTANCE/INSTANCE_06_LevInitAll.c b/decompile/General/INSTANCE/INSTANCE_06_LevInitAll.c index 020d2bf58..074304352 100644 --- a/decompile/General/INSTANCE/INSTANCE_06_LevInitAll.c +++ b/decompile/General/INSTANCE/INSTANCE_06_LevInitAll.c @@ -75,9 +75,9 @@ void DECOMP_INSTANCE_LevInitAll(struct InstDef *levInstDef, int numInst) ConvertRotToMatrix(&inst->matrix, &levInstDef->rot[0]); // instance posX and posY - inst->matrix.t[0] = levInstDef->pos[0]; - inst->matrix.t[1] = levInstDef->pos[1]; - inst->matrix.t[2] = levInstDef->pos[2]; + inst->matrix.t.x = levInstDef->pos[0]; + inst->matrix.t.y = levInstDef->pos[1]; + inst->matrix.t.z = levInstDef->pos[2]; inst->thread = NULL; struct InstDrawPerPlayer* idpp = INST_GETIDPP(inst); diff --git a/decompile/General/LinkedCollide/LinkedCollide_0_Radius.c b/decompile/General/LinkedCollide/LinkedCollide_0_Radius.c index 9c4bcf398..e15202822 100644 --- a/decompile/General/LinkedCollide/LinkedCollide_0_Radius.c +++ b/decompile/General/LinkedCollide/LinkedCollide_0_Radius.c @@ -12,9 +12,9 @@ struct Instance* DECOMP_LinkedCollide_Radius(struct Instance* objInst,struct Thr thInst = thBucket->inst; // get difference in X, Y, and Z, from both instances - diff_x = thInst->matrix.t[0] - objInst->matrix.t[0]; - diff_y = thInst->matrix.t[1] - objInst->matrix.t[1]; - diff_z = thInst->matrix.t[2] - objInst->matrix.t[2]; + diff_x = thInst->matrix.t.x - objInst->matrix.t.x; + diff_y = thInst->matrix.t.y - objInst->matrix.t.y; + diff_z = thInst->matrix.t.z - objInst->matrix.t.z; diff_dist = diff_x*diff_x + diff_z*diff_z; diff --git a/decompile/General/LinkedCollide/LinkedCollide_2_Hitbox.c b/decompile/General/LinkedCollide/LinkedCollide_2_Hitbox.c index 1f31dd20e..bad74f589 100644 --- a/decompile/General/LinkedCollide/LinkedCollide_2_Hitbox.c +++ b/decompile/General/LinkedCollide/LinkedCollide_2_Hitbox.c @@ -13,11 +13,11 @@ struct Instance* DECOMP_LinkedCollide_Hitbox(struct HitboxDesc* objBoxDesc) { { thInst = thBucket->inst; - thInstPos.vx = thInst->matrix.t[0]; - thInstPos.vy = thInst->matrix.t[1]; - thInstPos.vz = thInst->matrix.t[2]; + thInstPos.vx = thInst->matrix.t.x; + thInstPos.vy = thInst->matrix.t.y; + thInstPos.vz = thInst->matrix.t.z; - diff_y = thInst->matrix.t[1] - objBoxDesc->inst->matrix.t[1] ; + diff_y = thInst->matrix.t.y - objBoxDesc->inst->matrix.t.y ; #ifndef REBUILD_PS1 MATH_HitboxMatrix(&thInstMatrix, &objBoxDesc->inst->matrix); diff --git a/decompile/General/PROC/PROC_08_CollidePointWithSelf.c b/decompile/General/PROC/PROC_08_CollidePointWithSelf.c index 19e142972..45fbf7466 100644 --- a/decompile/General/PROC/PROC_08_CollidePointWithSelf.c +++ b/decompile/General/PROC/PROC_08_CollidePointWithSelf.c @@ -17,9 +17,9 @@ void DECOMP_PROC_CollidePointWithSelf(struct Thread* th, struct BucketSearchPara // it will not compile to less assembly, // 180 bytes is as low as this will go - distX = (int)buf->pos[0]-(int)inst->matrix.t[0]; - distY = (int)buf->pos[1]-(int)inst->matrix.t[1]; - distZ = (int)buf->pos[2]-(int)inst->matrix.t[2]; + distX = (int)buf->pos[0]-(int)inst->matrix.t.x; + distY = (int)buf->pos[1]-(int)inst->matrix.t.y; + distZ = (int)buf->pos[2]-(int)inst->matrix.t.z; if(distX*distX >= 0x10000000) return; if(distY*distY >= 0x10000000) return; diff --git a/decompile/General/Particle/Particle_1_FuncPtr_SpitTire.c b/decompile/General/Particle/Particle_1_FuncPtr_SpitTire.c index 47757a64a..16ad0241d 100644 --- a/decompile/General/Particle/Particle_1_FuncPtr_SpitTire.c +++ b/decompile/General/Particle/Particle_1_FuncPtr_SpitTire.c @@ -8,7 +8,7 @@ void DECOMP_Particle_FuncPtr_SpitTire(struct Particle *p) // Wait until tires are 0x10 units above // the ground, which is where the plant // actually "spits" tires from the mouth - iVar2 = p->plantInst->matrix.t[1] + 0x10; + iVar2 = p->plantInst->matrix.t.y + 0x10; if ((p->axis[1].startVal >> 8) >= iVar2) { diff --git a/decompile/General/Particle/Particle_2_FuncPtr_ExhaustUnderwater.c b/decompile/General/Particle/Particle_2_FuncPtr_ExhaustUnderwater.c index 2ec2729d2..54d1a2773 100644 --- a/decompile/General/Particle/Particle_2_FuncPtr_ExhaustUnderwater.c +++ b/decompile/General/Particle/Particle_2_FuncPtr_ExhaustUnderwater.c @@ -6,7 +6,7 @@ void DECOMP_Particle_FuncPtr_ExhaustUnderwater(struct Particle *p) struct Icon** iconPtrArray; if ( - (3 < ((p->axis[1].startVal >> 8) + p->driverInst->matrix.t[1])) && + (3 < ((p->axis[1].startVal >> 8) + p->driverInst->matrix.t.y)) && (p->framesLeftInLife < FPS_DOUBLE(27)) ) { diff --git a/decompile/General/PushBuffer/PushBuffer_04_SetMatrixVP.c b/decompile/General/PushBuffer/PushBuffer_04_SetMatrixVP.c index 195f36d27..c8279b074 100644 --- a/decompile/General/PushBuffer/PushBuffer_04_SetMatrixVP.c +++ b/decompile/General/PushBuffer/PushBuffer_04_SetMatrixVP.c @@ -64,9 +64,9 @@ void DECOMP_PushBuffer_SetMatrixVP(struct PushBuffer* pb) // assuming pb->pos resets next frame, // do not use this with freecam mods cause // it will increment infinitely into the skybox - pb->pos[0] += matrixDST->t[0]; - pb->pos[1] += matrixDST->t[1]; - pb->pos[2] += matrixDST->t[2]; + pb->pos[0] += matrixDST->t.x; + pb->pos[1] += matrixDST->t.y; + pb->pos[2] += matrixDST->t.z; #endif @@ -76,9 +76,9 @@ void DECOMP_PushBuffer_SetMatrixVP(struct PushBuffer* pb) *(int*)&t[0] = *(int*)&pb->pos[0]; t[2] = pb->pos[2]; - pb->matrix_Camera.t[0] = t[0]; - pb->matrix_Camera.t[1] = t[1]; - pb->matrix_Camera.t[2] = t[2]; + pb->matrix_Camera.t.x = t[0]; + pb->matrix_Camera.t.y = t[1]; + pb->matrix_Camera.t.z = t[2]; // bit-hack, negate two u16s as one u32 *(int*)&t[0] = -*(int*)&t[0]+0x10000; @@ -148,8 +148,8 @@ void DECOMP_PushBuffer_SetMatrixVP(struct PushBuffer* pb) // by transpose camera matrix gte_llv0(); - gte_stlvnl(&pb->matrix_CameraTranspose.t[0]); - gte_stlvnl(&pb->matrix_ViewProj.t[0]); + gte_stlvnl(&pb->matrix_CameraTranspose.t.x); + gte_stlvnl(&pb->matrix_ViewProj.t.x); // start with transpose camera matrix *(int*)((int)&pb->matrix_ViewProj + 0x0) = view0; @@ -181,8 +181,8 @@ void DECOMP_PushBuffer_SetMatrixVP(struct PushBuffer* pb) #define r600 0x600 // scale position - pb->matrix_ViewProj.t[1] = - pb->matrix_ViewProj.t[1] * r360 / r600; + pb->matrix_ViewProj.t.y = + pb->matrix_ViewProj.t.y * r360 / r600; // scale Y axis (1) pb->matrix_ViewProj.m[1][0] = diff --git a/decompile/General/UI/UI_07_INSTANCE_BirthWithThread.c b/decompile/General/UI/UI_07_INSTANCE_BirthWithThread.c index e93955f7d..4efc2ad3a 100644 --- a/decompile/General/UI/UI_07_INSTANCE_BirthWithThread.c +++ b/decompile/General/UI/UI_07_INSTANCE_BirthWithThread.c @@ -151,9 +151,9 @@ struct Instance* DECOMP_UI_INSTANCE_BirthWithThread(int param_1,int param_2,int struct UiElement2D* currUI2D; currUI2D = &hudStruct[param_3]; - inst->matrix.t[0] = DECOMP_UI_ConvertX_2(currUI2D->x,currUI2D->z); - inst->matrix.t[1] = DECOMP_UI_ConvertY_2(currUI2D->y,currUI2D->z); - inst->matrix.t[2] = currUI2D->z; + inst->matrix.t.x = DECOMP_UI_ConvertX_2(currUI2D->x,currUI2D->z); + inst->matrix.t.y = DECOMP_UI_ConvertY_2(currUI2D->y,currUI2D->z); + inst->matrix.t.z = currUI2D->z; } // if pushBuffer is supplied, @@ -166,9 +166,9 @@ struct Instance* DECOMP_UI_INSTANCE_BirthWithThread(int param_1,int param_2,int // record that pushBuffer is present inst->flags |= 0x100; - inst->matrix.t[0] = 0; - inst->matrix.t[1] = 0; - inst->matrix.t[2] = 0x200; + inst->matrix.t.x = 0; + inst->matrix.t.y = 0; + inst->matrix.t.z = 0x200; } uVar5 = hudStruct[param_3].scale; @@ -185,11 +185,11 @@ struct Instance* DECOMP_UI_INSTANCE_BirthWithThread(int param_1,int param_2,int { #ifdef USE_NEW2P if(gGT->numPlyrCurrGame == 2) - lVar7 = ratan2((inst->matrix.t[1]*4)/3,inst->matrix.t[2]); + lVar7 = ratan2((inst->matrix.t.y*4)/3,inst->matrix.t.z); else #endif - lVar7 = ratan2(inst->matrix.t[1],inst->matrix.t[2]); + lVar7 = ratan2(inst->matrix.t.y,inst->matrix.t.z); rot[0] = -(short)lVar7; } rot[1] = 0; diff --git a/decompile/General/UI/UI_08_INSTANCE_InitAll.c b/decompile/General/UI/UI_08_INSTANCE_InitAll.c index ec8dee48d..4e42a0fe2 100644 --- a/decompile/General/UI/UI_08_INSTANCE_InitAll.c +++ b/decompile/General/UI/UI_08_INSTANCE_InitAll.c @@ -130,9 +130,9 @@ void DECOMP_UI_INSTANCE_InitAll(void) *(int*)&pb->matrix_ViewProj.m[1][1] = *(int*)&ui->matrix_ViewProj.m[1][1]; *(int*)&pb->matrix_ViewProj.m[2][0] = *(int*)&ui->matrix_ViewProj.m[2][0]; *(int*)&pb->matrix_ViewProj.m[2][2] = *(int*)&ui->matrix_ViewProj.m[2][2]; - pb->matrix_ViewProj.t[0] = ui->matrix_ViewProj.t[0]; - pb->matrix_ViewProj.t[1] = ui->matrix_ViewProj.t[1]; - pb->matrix_ViewProj.t[2] = ui->matrix_ViewProj.t[2]; + pb->matrix_ViewProjmatrix.t.x = ui->matrix_ViewProj.t.x; + pb->matrix_ViewProj.t.y = ui->matrix_ViewProj.t.y; + pb->matrix_ViewProj.t.z = ui->matrix_ViewProj.t.z; // first half of pixel-LOD pushBuffer, copy from PushBuffer_UI pb->pos[0] = ui->pos[0]; diff --git a/decompile/General/UI/UI_09_Map_DrawMap.c b/decompile/General/UI/UI_09_Map_DrawMap.c index 7acd77feb..f454a3573 100644 --- a/decompile/General/UI/UI_09_Map_DrawMap.c +++ b/decompile/General/UI/UI_09_Map_DrawMap.c @@ -2,18 +2,17 @@ void UI_Map_DrawMap_ExtraFunc(struct Icon* icon, POLY_FT4* p, short posX, short empty, struct PrimMem* primMem, u_long* otMem, u_int colorID); -void DECOMP_UI_Map_DrawMap(struct Icon* mapTop, struct Icon* mapBottom, short posX, short posY, struct PrimMem* primMem, u_long* otMem, u_int colorID) +void DECOMP_UI_Map_DrawMap(struct Icon* mapTop, struct Icon* mapBottom, SVec2* pos, struct PrimMem* primMem, u_long* otMem, u_int colorID) { short mapBottomHeight; short mapTopHeight; - int iVar9; + struct Map* minimap; POLY_FT4* p; u_int color; struct GameTracker* gGT; gGT = sdata->gGT; - iVar9 = 0; // draw minimap with neutral/none vertex color, minimap's regular color is white color = 0x808080; @@ -35,7 +34,7 @@ void DECOMP_UI_Map_DrawMap(struct Icon* mapTop, struct Icon* mapBottom, short po if (gGT->level1->ptrSpawnType1 != 0) { void** pointers = ST1_GETPOINTERS(gGT->level1->ptrSpawnType1); - iVar9 = (int)pointers[ST1_MAP]; + minimap = (struct Map*)pointers[ST1_MAP]; } // position of the bottom margin of the primitive for the bottom half of the minimap @@ -47,7 +46,7 @@ void DECOMP_UI_Map_DrawMap(struct Icon* mapTop, struct Icon* mapBottom, short po // not sure when the game ever draws only the bottom half if ( - ((iVar9 != 0) && (*(short *)(iVar9 + 0x12) == 0)) || + ((minimap != 0) && (minimap->mode == 0)) || // if in main menu (character selection, track selection, any part of it) ((gGT->gameMode1 & MAIN_MENU) != 0) @@ -57,14 +56,14 @@ void DECOMP_UI_Map_DrawMap(struct Icon* mapTop, struct Icon* mapBottom, short po *(int*)&p->r0 = color; // position of the top margin of the primitive for the top half of the minimap - mapTopHeight = posY - (((u_short)mapTop->texLayout.v2 - (u_short)mapTop->texLayout.v0) + mapBottomHeight); + mapTopHeight = pos->y - (((u_short)mapTop->texLayout.v2 - (u_short)mapTop->texLayout.v0) + mapBottomHeight); p->y0 = mapTopHeight; p->y1 = mapTopHeight; - p->y2 = posY - mapBottomHeight; - p->y3 = posY - mapBottomHeight; + p->y2 = pos->y - mapBottomHeight; + p->y3 = pos->y - mapBottomHeight; - UI_Map_DrawMap_ExtraFunc(mapTop, p, posX, 0, primMem, otMem, colorID); + UI_Map_DrawMap_ExtraFunc(mapTop, p, pos->x, 0, primMem, otMem, colorID); p = p + 1; } @@ -72,12 +71,12 @@ void DECOMP_UI_Map_DrawMap(struct Icon* mapTop, struct Icon* mapBottom, short po // r0, g0, b0 (vertex color) *(int*)&p->r0 = color; - p->y0 = posY - mapBottomHeight; - p->y1 = posY - mapBottomHeight; - p->y2 = posY; - p->y3 = posY; + p->y0 = pos->y - mapBottomHeight; + p->y1 = pos->y - mapBottomHeight; + p->y2 = pos->y; + p->y3 = pos->y; - UI_Map_DrawMap_ExtraFunc(mapBottom, p, posX, 0, primMem, otMem, colorID); + UI_Map_DrawMap_ExtraFunc(mapBottom, p, pos->x, 0, primMem, otMem, colorID); primMem->curr = p + 1; } @@ -114,18 +113,18 @@ void UI_Map_DrawMap_ExtraFunc(struct Icon* icon, POLY_FT4* p, short posX, short void** pointers = ST1_GETPOINTERS(sdata->gGT->level1->ptrSpawnType1); void* levPtrMap = pointers[ST1_MAP]; - int midX = 0; - int midY = 0; - DECOMP_UI_Map_GetIconPos(levPtrMap, &midX, &midY); + Vec2 mid; - leftX += ((midX-leftX) * 250) / 1000; - posX -= ((posX-midX) * 250) / 1000; + DECOMP_UI_Map_GetIconPos(levPtrMap, &mid); + + leftX += ((mid.x-leftX) * 250) / 1000; + posX -= ((posX-mid.x) * 250) / 1000; if (sdata->gGT->numPlyrCurrGame == 1) { // 462 is midX of Crash Cove - leftX += ((462 - midX) / 4) + 5; - posX += ((462 - midX) / 4) + 5; + leftX += ((462 - mid.x) / 4) + 5; + posX += ((462 - mid.x) / 4) + 5; } } diff --git a/decompile/General/UI/UI_10_Map_GetIconPos.c b/decompile/General/UI/UI_10_Map_GetIconPos.c index af95d2cd8..9a37012b8 100644 --- a/decompile/General/UI/UI_10_Map_GetIconPos.c +++ b/decompile/General/UI/UI_10_Map_GetIconPos.c @@ -2,23 +2,9 @@ // 488 / 760 -// move to headers later -struct Map -{ - short worldEndX; - short worldEndY; - short worldStartX; - short worldStartY; - - short iconSizeX; - short iconSizeY; - short iconStartX; - short iconStartY; - - short mode; -}; -void DECOMP_UI_Map_GetIconPos(short* m,int* posX,int* posY) + +void DECOMP_UI_Map_GetIconPos(struct Map* minimap, Vec2* pos) { short mode; @@ -27,7 +13,6 @@ void DECOMP_UI_Map_GetIconPos(short* m,int* posX,int* posY) int worldRangeX; int worldRangeY; - struct Map* map = (struct Map*)m; #if 0 // trap() functions were removed from original, @@ -35,37 +20,37 @@ void DECOMP_UI_Map_GetIconPos(short* m,int* posX,int* posY) #endif // rendering mode (forward, sideways, etc) - mode = map->mode; + mode = minimap->mode; - worldRangeX = map->worldEndX - map->worldStartX; - worldRangeY = map->worldEndY - map->worldStartY; + worldRangeX = minimap->worldEndX - minimap->worldStartX; + worldRangeY = minimap->worldEndY - minimap->worldStartY; if (mode == 0) { // 0 degrees - addX = (*posX * map->iconSizeX ) / worldRangeX; - addY = (*posY * map->iconSizeY * 2) / worldRangeY; + addX = (pos->x * minimap->iconSizeX ) / worldRangeX; + addY = (pos->y * minimap->iconSizeY * 2) / worldRangeY; } else if (mode == 1) { // 90 degrees - addX = -(*posY * map->iconSizeX ) / worldRangeY; - addY = (*posX * map->iconSizeY * 2) / worldRangeX; + addX = -(pos->y * minimap->iconSizeX ) / worldRangeY; + addY = (pos->x * minimap->iconSizeY * 2) / worldRangeX; } else if (mode == 2) { // 180 degrees - addX = -(*posX * map->iconSizeX ) / worldRangeX; - addY = -(*posY * map->iconSizeY * 2) / worldRangeY; + addX = -(pos->x * minimap->iconSizeX ) / worldRangeX; + addY = -(pos->y * minimap->iconSizeY * 2) / worldRangeY; } else { // 270 degrees - addX = (*posY * map->iconSizeX ) / worldRangeY; - addY = -(*posX * map->iconSizeY * 2) / worldRangeX; + addX = (pos->x * minimap->iconSizeX ) / worldRangeY; + addY = -(pos->y * minimap->iconSizeY * 2) / worldRangeX; } #ifdef USE_16BY9 @@ -73,7 +58,7 @@ void DECOMP_UI_Map_GetIconPos(short* m,int* posX,int* posY) if (sdata->gGT->numPlyrCurrGame == 1) { - addX += ((462 - map->iconStartX) / 4) + 5; + addX += ((462 - minimap->iconStartX) / 4) + 5; } #endif @@ -83,7 +68,7 @@ void DECOMP_UI_Map_GetIconPos(short* m,int* posX,int* posY) addY += 10; } - *posX = map->iconStartX + addX; - *posY = map->iconStartY + addY - 0x10; + pos->x = minimap->iconStartX + addX; + pos->y = minimap->iconStartY + addY - 0x10; return; } \ No newline at end of file diff --git a/decompile/General/UI/UI_11_Map_DrawAdvPlayer.c b/decompile/General/UI/UI_11_Map_DrawAdvPlayer.c index 1030f0970..625e8fa59 100644 --- a/decompile/General/UI/UI_11_Map_DrawAdvPlayer.c +++ b/decompile/General/UI/UI_11_Map_DrawAdvPlayer.c @@ -1,27 +1,26 @@ #include // Draw dot for Player on 2D Adv Map -void DECOMP_UI_Map_DrawAdvPlayer(int ptrMap,int *matrix,int unused1,int unused2, - short param_5,short param_6) +void DECOMP_UI_Map_DrawAdvPlayer(struct Map* ptrMap,Vec3 *pos,int unused1,int unused2, + short angle, short unk800) { int* arrowColor; - int posX; - int posY; + Vec2 iconPos; - posX = *matrix; - posY = matrix[2]; + iconPos.x = pos->x; + iconPos.y = pos->z; - DECOMP_UI_Map_GetIconPos((short*)ptrMap,&posX,&posY); + DECOMP_UI_Map_GetIconPos(ptrMap, &iconPos); arrowColor = &data.playerIconAdvMap.vertCol1[0]; if ((sdata->gGT->timer & FPS_DOUBLE(2)) != 0) { arrowColor = &data.playerIconAdvMap.vertCol2[0]; } - DECOMP_AH_Map_HubArrow(posX,posY, + DECOMP_AH_Map_HubArrow(&iconPos, &data.playerIconAdvMap.unk_playerAdvMap[0], - (char*)arrowColor,(int)param_6, (int)param_5); + (char*)arrowColor,(int)unk800, (int)angle); return; } \ No newline at end of file diff --git a/decompile/General/UI/UI_12_Map_DrawRawIcon.c b/decompile/General/UI/UI_12_Map_DrawRawIcon.c index ebd182fef..ddc49d727 100644 --- a/decompile/General/UI/UI_12_Map_DrawRawIcon.c +++ b/decompile/General/UI/UI_12_Map_DrawRawIcon.c @@ -2,21 +2,21 @@ // Draw icon on map void DECOMP_UI_Map_DrawRawIcon( - int ptrMap,int *param_2, + struct Map* ptrMap, Vec3* pos, int iconID,int colorID,int unused, short scale) { - int posX; - int posY; + int *ptrColor; struct GameTracker* gGT = sdata->gGT; + + Vec2 iconPos; + iconPos.x = pos->x; + iconPos.y = pos->z; - posX = param_2[0]; - posY = param_2[2]; - - DECOMP_UI_Map_GetIconPos((short*)ptrMap,&posX,&posY); + DECOMP_UI_Map_GetIconPos(ptrMap,&iconPos); #ifdef USE_ONLINE - posY -= 50; + iconPos.y -= 50; #endif ptrColor = data.ptrColor[colorID]; @@ -26,7 +26,7 @@ void DECOMP_UI_Map_DrawRawIcon( DECOMP_DecalHUD_DrawPolyGT4( iconPtrArray[iconID], - posX, posY, + iconPos.x, iconPos.y, &gGT->backBuffer->primMem, gGT->pushBuffer_UI.ptrOT, ptrColor[0], ptrColor[1], ptrColor[2], ptrColor[3], diff --git a/decompile/General/UI/UI_13_Map_DrawDrivers.c b/decompile/General/UI/UI_13_Map_DrawDrivers.c index f13e8eb15..5f0c976b6 100644 --- a/decompile/General/UI/UI_13_Map_DrawDrivers.c +++ b/decompile/General/UI/UI_13_Map_DrawDrivers.c @@ -1,6 +1,6 @@ #include -void DECOMP_UI_Map_DrawDrivers(int ptrMap,struct Thread* bucket,short *param_3) +void DECOMP_UI_Map_DrawDrivers(struct Map* ptrMap,struct Thread* bucket, short unused) { int kartColor; @@ -17,8 +17,8 @@ void DECOMP_UI_Map_DrawDrivers(int ptrMap,struct Thread* bucket,short *param_3) for( /* bucket */ ; bucket != 0; - bucket = bucket->siblingThread, - *param_3 = *param_3 + 1 + bucket = bucket->siblingThread + //, unused++; ) { // Player structure @@ -52,7 +52,7 @@ void DECOMP_UI_Map_DrawDrivers(int ptrMap,struct Thread* bucket,short *param_3) if ((gGT->gameMode1 & ADVENTURE_ARENA) != 0) { // Draw dot for Player on 2D Adv Map - DECOMP_UI_Map_DrawAdvPlayer(ptrMap,(int*)&bucket->inst->matrix.t[0], 0x32, kartColor, + DECOMP_UI_Map_DrawAdvPlayer(ptrMap,(int*)&bucket->inst->matrix.t.x, 0x32, kartColor, (d->rotCurr.y + 0x800U) | 0x1000,0x800); continue; @@ -63,7 +63,7 @@ void DECOMP_UI_Map_DrawDrivers(int ptrMap,struct Thread* bucket,short *param_3) } DECOMP_UI_Map_DrawRawIcon( - ptrMap, (int*)&bucket->inst->matrix.t[0], + ptrMap, &bucket->inst->matrix.t, iconID, (short)kartColor, 0, 0x1000); } return; diff --git a/decompile/General/UI/UI_14_Map_DrawGhosts.c b/decompile/General/UI/UI_14_Map_DrawGhosts.c index 6681d2d60..ffa14856f 100644 --- a/decompile/General/UI/UI_14_Map_DrawGhosts.c +++ b/decompile/General/UI/UI_14_Map_DrawGhosts.c @@ -1,6 +1,6 @@ #include -void DECOMP_UI_Map_DrawGhosts(int ptrMap,struct Thread* bucket) +void DECOMP_UI_Map_DrawGhosts(struct Map* ptrMap,struct Thread* bucket) { int color; struct Driver* d; @@ -11,15 +11,14 @@ void DECOMP_UI_Map_DrawGhosts(int ptrMap,struct Thread* bucket) bucket = bucket->siblingThread ) { - d = bucket->object; + d = (struct Driver*)bucket->object; - // Need to finish Driver struct // if ghost not initialized - if (*(short*)((int)d + 0x632) == 0) continue; + if (!d->ghostBoolInit) continue; // ghost made by player - if (*(short*)((int)d + 0x630) == 0) + if (d->ghostID == 0) { // flash red and blue @@ -46,7 +45,7 @@ void DECOMP_UI_Map_DrawGhosts(int ptrMap,struct Thread* bucket) } DECOMP_UI_Map_DrawRawIcon( - ptrMap, (int*)&bucket->inst->matrix.t[0], + ptrMap, &bucket->inst->matrix.t, 0x31, color, 0, 0x1000); } return; diff --git a/decompile/General/UI/UI_15_Map_DrawTracking.c b/decompile/General/UI/UI_15_Map_DrawTracking.c index 73fc48ed5..05928c068 100644 --- a/decompile/General/UI/UI_15_Map_DrawTracking.c +++ b/decompile/General/UI/UI_15_Map_DrawTracking.c @@ -1,9 +1,9 @@ #include -void DECOMP_UI_Map_DrawTracking(int ptrMap,struct Thread* bucket) +void DECOMP_UI_Map_DrawTracking(struct Map* ptrMap,struct Thread* bucket) { - int uVar1; + unsigned char iconColor; struct Instance* inst; struct Driver* d; @@ -22,25 +22,27 @@ void DECOMP_UI_Map_DrawTracking(int ptrMap,struct Thread* bucket) // draw warpball DECOMP_UI_Map_DrawRawIcon( - ptrMap,(int*)&inst->matrix.t[0], + ptrMap,&inst->matrix.t, 0x20,0,0,0x1000); + struct TrackerWeapon* tracker = (struct TrackerWeapon*)bucket->object; + // driver target - d = ((struct TrackerWeapon*)bucket->object)->driverTarget; + d = (struct Driver*)tracker->driverTarget; // check if target exists - if(d == 0) continue; + if(d == NULL) continue; // == only draw target if target exists == // flicker - uVar1 = 4; + iconColor = 4; if ((sdata->gGT->timer & 1) != 0) - uVar1 = 3; + iconColor = 3; DECOMP_UI_Map_DrawRawIcon( - ptrMap,(int*)&d->instSelf->matrix.t[0], - 0x21,uVar1,0,0x1000); + ptrMap,&d->instSelf->matrix.t, + 0x21,iconColor,0,0x1000); } return; } \ No newline at end of file diff --git a/decompile/General/UI/UI_25_BattleDrawHeadArrows.c b/decompile/General/UI/UI_25_BattleDrawHeadArrows.c index 2999625a7..802b92db4 100644 --- a/decompile/General/UI/UI_25_BattleDrawHeadArrows.c +++ b/decompile/General/UI/UI_25_BattleDrawHeadArrows.c @@ -68,8 +68,8 @@ void DECOMP_UI_BattleDrawHeadArrows(struct Driver *player) struct Instance* playerInst = player->instSelf; // Get X distance and Z distance between two players - int xDistance = playerInst->matrix.t[0] - currInst->matrix.t[0]; - int zDistance = playerInst->matrix.t[2] - currInst->matrix.t[2]; + int xDistance = playerInst->matrix.t.x - currInst->matrix.t.x; + int zDistance = playerInst->matrix.t.z - currInst->matrix.t.z; int playerDistance = ((xDistance * xDistance) + (zDistance * zDistance)); // sqrt(0x90000) is 768 @@ -80,9 +80,9 @@ void DECOMP_UI_BattleDrawHeadArrows(struct Driver *player) continue; // load input vector - pos.vx = currInst->matrix.t[0]; - pos.vy = currInst->matrix.t[1]; - pos.vz = currInst->matrix.t[2]; + pos.vx = currInst->matrix.t.x; + pos.vy = currInst->matrix.t.y; + pos.vz = currInst->matrix.t.z; gte_ldv0(&pos); // xyz diff --git a/decompile/General/UI/UI_26_TrackerSelf.c b/decompile/General/UI/UI_26_TrackerSelf.c index 430cfb6ae..fc992cee6 100644 --- a/decompile/General/UI/UI_26_TrackerSelf.c +++ b/decompile/General/UI/UI_26_TrackerSelf.c @@ -118,9 +118,9 @@ void DECOMP_UI_TrackerSelf(struct Driver * d) gte_SetRotMatrix(m); gte_SetTransMatrix(m); - pos.vx = (short) d->instSelf->matrix.t[0]; - pos.vy = (short) d->instSelf->matrix.t[1]; - pos.vz = (short) d->instSelf->matrix.t[2]; + pos.vx = (short) d->instSelf->matrix.t.x; + pos.vy = (short) d->instSelf->matrix.t.y; + pos.vz = (short) d->instSelf->matrix.t.z; gte_ldv0(&pos); gte_rtps(); diff --git a/decompile/General/UI/UI_27_DrawPosSuffix.c b/decompile/General/UI/UI_27_DrawPosSuffix.c index 594132f01..00ab65a64 100644 --- a/decompile/General/UI/UI_27_DrawPosSuffix.c +++ b/decompile/General/UI/UI_27_DrawPosSuffix.c @@ -18,7 +18,7 @@ void DECOMP_UI_DrawPosSuffix(short posX, short posY, struct Driver *d, short fla // setting posZ changes which number draws if (d->instBigNum != 0) - d->instBigNum->matrix.t[2] = (d->driverRank + 0x100); + d->instBigNum->matrix.t.z = (d->driverRank + 0x100); return; } diff --git a/decompile/General/UI/UI_43_DrawRankedDrivers.c b/decompile/General/UI/UI_43_DrawRankedDrivers.c index d3ce6921c..656344baf 100644 --- a/decompile/General/UI/UI_43_DrawRankedDrivers.c +++ b/decompile/General/UI/UI_43_DrawRankedDrivers.c @@ -416,9 +416,9 @@ void DECOMP_UI_DrawRankedDrivers(void) if (iVar4 < 0) continue; int pos[4]; - pos[0] = warpballInst->matrix.t[0]; - pos[1] = warpballInst->matrix.t[1]; - pos[2] = warpballInst->matrix.t[2]; + pos[0] = warpballInst->matrix.t.x; + pos[1] = warpballInst->matrix.t.y; + pos[2] = warpballInst->matrix.t.z; struct CheckpointNode* cn1 = &cn[tw->ptrNodeCurr->nextIndex_forward]; struct CheckpointNode* cn2 = &cn[cn1->nextIndex_forward]; diff --git a/decompile/General/UI/UI_44_RenderFrame_Racing.c b/decompile/General/UI/UI_44_RenderFrame_Racing.c index 51ff801ba..81541e5fb 100644 --- a/decompile/General/UI/UI_44_RenderFrame_Racing.c +++ b/decompile/General/UI/UI_44_RenderFrame_Racing.c @@ -25,21 +25,19 @@ void DECOMP_UI_RenderFrame_Racing() u_int local_70; struct Driver* playerStruct; struct UiElement2D *hudStructPtr; - void* levPtrMap; + struct Map* levPtrMap; char cVar22; short wumpaModel_Pos[2]; short LetterCTR_Pos[2]; char string [8]; short turboCount_Pos[2]; - u_short local_30 [2]; struct Thread* playerThread; u_long *ptrOT; struct DB *backBuffer; struct Thread* turboThread; struct Turbo* turboThreadObject; int offset; - u_int mapPosX; - u_int mapPosY; + SVec2 mapPos; #ifdef USE_ONLINE offset = WIDE_PICK(-19, -27); @@ -117,7 +115,7 @@ void DECOMP_UI_RenderFrame_Racing() if (gGT->level1->ptrSpawnType1 != 0) { void** pointers = ST1_GETPOINTERS(gGT->level1->ptrSpawnType1); - levPtrMap = pointers[ST1_MAP]; + levPtrMap = (struct Map*)pointers[ST1_MAP]; } // If you are not in Relic Race, and not in battle mode, @@ -373,9 +371,9 @@ void DECOMP_UI_RenderFrame_Racing() FPS_DOUBLE(10) ); - curr->matrix.t[0] = DECOMP_UI_ConvertX_2((int)LetterCTR_Pos[0],0x200); - curr->matrix.t[1] = DECOMP_UI_ConvertY_2((int)LetterCTR_Pos[1],0x200); - curr->matrix.t[2] = 0x200; + curr->matrix.t.x = DECOMP_UI_ConvertX_2((int)LetterCTR_Pos[0],0x200); + curr->matrix.t.y = DECOMP_UI_ConvertY_2((int)LetterCTR_Pos[1],0x200); + curr->matrix.t.z = 0x200; } } @@ -850,7 +848,7 @@ void DECOMP_UI_RenderFrame_Racing() } if( - (levPtrMap != 0) && + (levPtrMap != NULL) && ((gameMode1 & BATTLE_MODE) == 0) // if loaded battle map in arcade, @@ -874,28 +872,28 @@ void DECOMP_UI_RenderFrame_Racing() (numPlyr == 3) ) { - local_30[0] = 0; - DECOMP_UI_Map_DrawDrivers ((int)levPtrMap, gGT->threadBuckets[PLAYER].thread, local_30); - DECOMP_UI_Map_DrawDrivers ((int)levPtrMap, gGT->threadBuckets[ROBOT].thread, local_30); + + DECOMP_UI_Map_DrawDrivers (levPtrMap, gGT->threadBuckets[PLAYER].thread, 0); + DECOMP_UI_Map_DrawDrivers (levPtrMap, gGT->threadBuckets[ROBOT].thread, 0); #ifndef USE_ONLINE - DECOMP_UI_Map_DrawGhosts ((int)levPtrMap, gGT->threadBuckets[GHOST].thread); + DECOMP_UI_Map_DrawGhosts (levPtrMap, gGT->threadBuckets[GHOST].thread); #endif - DECOMP_UI_Map_DrawTracking ((int)levPtrMap, gGT->threadBuckets[TRACKING].thread); + DECOMP_UI_Map_DrawTracking (levPtrMap, gGT->threadBuckets[TRACKING].thread); - mapPosX = 500; + mapPos.x = 500; #ifdef USE_ONLINE - mapPosY = 145; + mapPos.y = 145; #else - mapPosY = 195; + mapPos.y = 195; #endif if (numPlyr == 3) { - mapPosX -= 60; - mapPosY += 10; + mapPos.x -= 60; + mapPos.y += 10; } // Draw the map @@ -906,7 +904,7 @@ void DECOMP_UI_RenderFrame_Racing() gGT->ptrIcons[4], // X and Y - mapPosX, mapPosY, + &mapPos, // Pointer to primary memory &gGT->backBuffer->primMem, diff --git a/decompile/General/UI/UI_46_RenderFrame_CrystChall.c b/decompile/General/UI/UI_46_RenderFrame_CrystChall.c index d2d414266..3f734384a 100644 --- a/decompile/General/UI/UI_46_RenderFrame_CrystChall.c +++ b/decompile/General/UI/UI_46_RenderFrame_CrystChall.c @@ -120,17 +120,17 @@ void DECOMP_UI_RenderFrame_CrystChall(void) if (iVar5 < 0) { iVar5 = iVar5 + 0xff; } - hudCrystal->matrix.t[0] = iVar5 >> 8; + hudCrystal->matrix.t.x = iVar5 >> 8; // posY iVar5 = (local_18[1] + -0x6c) * hudStructPtr[0x11].z; if (iVar5 < 0) { iVar5 = iVar5 + 0xff; } - hudCrystal->matrix.t[1] = iVar5 >> 8; + hudCrystal->matrix.t.y = iVar5 >> 8; // posZ - hudCrystal->matrix.t[2] = hudStructPtr[0x11].z; + hudCrystal->matrix.t.z = hudStructPtr[0x11].z; LAB_800545e8: diff --git a/decompile/General/Vehicle/VehBirth_0_TeleportSelf.c b/decompile/General/Vehicle/VehBirth_0_TeleportSelf.c index 106678499..8be1ba090 100644 --- a/decompile/General/Vehicle/VehBirth_0_TeleportSelf.c +++ b/decompile/General/Vehicle/VehBirth_0_TeleportSelf.c @@ -218,9 +218,9 @@ void DECOMP_VehBirth_TeleportSelf(struct Driver *d, u_char spawnFlag, int spawnP d->posCurr.y = (posRot->pos[1]-0x40) << 8; d->posCurr.z = posRot->pos[2] << 8; - dInst->matrix.t[0] = posRot->pos[0]; - dInst->matrix.t[1] = (posRot->pos[1]-0x40); - dInst->matrix.t[2] = posRot->pos[2]; + dInst->matrix.t.x = posRot->pos[0]; + dInst->matrix.t.y = (posRot->pos[1]-0x40); + dInst->matrix.t.z = posRot->pos[2]; ConvertRotToMatrix(&dInst->matrix.m, &d->rotCurr.x); diff --git a/decompile/General/Vehicle/VehPhysForce_2_OnApplyForces.c b/decompile/General/Vehicle/VehPhysForce_2_OnApplyForces.c index 9b9fef871..3958659da 100644 --- a/decompile/General/Vehicle/VehPhysForce_2_OnApplyForces.c +++ b/decompile/General/Vehicle/VehPhysForce_2_OnApplyForces.c @@ -50,7 +50,7 @@ void DECOMP_VehPhysForce_OnApplyForces(struct Thread * thread, struct Driver * d // COLL (which does velocity) and // VehPhysForce_TranslateMatrix (which does matrix) driver->posCurr.v[i] += driver->velocity.v[i]; - driver->instSelf->matrix.t[i] = driver->posCurr.v[i] >> 8; + driver->instSelf->matrix.t.v[i] = driver->posCurr.v[i] >> 8; #endif } } \ No newline at end of file diff --git a/decompile/General/Vehicle/VehPickupItem_1_MaskUseWeapon.c b/decompile/General/Vehicle/VehPickupItem_1_MaskUseWeapon.c index 94efd3770..9c0621802 100644 --- a/decompile/General/Vehicle/VehPickupItem_1_MaskUseWeapon.c +++ b/decompile/General/Vehicle/VehPickupItem_1_MaskUseWeapon.c @@ -41,7 +41,8 @@ struct MaskHeadWeapon* DECOMP_VehPickupItem_MaskUseWeapon(struct Driver *driver, currThread->funcThTick = DECOMP_RB_MaskWeapon_ThTick; maskObj = currThread->object; - maskObj->duration = (driver->numWumpas < 10) ? 0x2d00 : 0x1e00; + //for some reason this is flipped + maskObj->duration = (driver->numWumpas < 10) ? SECONDS(12) : SECONDS(8); if ( #ifdef USE_ONLINE @@ -137,11 +138,11 @@ struct MaskHeadWeapon* DECOMP_VehPickupItem_MaskUseWeapon(struct Driver *driver, t->flags |= 0x1000; // disable collision instance->flags |= 0x80; // make mask head invisible maskObj->maskBeamInst->flags |= 0x80; // make mask beam invisible - maskObj->duration = (driver->numWumpas > 9) ? 0x2d00 : 0x1e00; - maskObj->rot[0] = 0x40; // rotX - maskObj->rot[1] = 0; // rotY - maskObj->rot[2] = 0; // rotZ - maskObj->scale = 0x1000; // scale + maskObj->duration = (driver->numWumpas > 9) ? SECONDS(12) : SECONDS(8); + maskObj->rot.x = 0x40; // rotX + maskObj->rot.y = 0; // rotY + maskObj->rot.z = 0; // rotZ + maskObj->scale = FP(1); // scale return maskObj; } \ No newline at end of file diff --git a/decompile/General/Vehicle/VehPickupItem_4_ShootNow.c b/decompile/General/Vehicle/VehPickupItem_4_ShootNow.c index 01d5e39e5..3921bb5ec 100644 --- a/decompile/General/Vehicle/VehPickupItem_4_ShootNow.c +++ b/decompile/General/Vehicle/VehPickupItem_4_ShootNow.c @@ -140,9 +140,9 @@ void DECOMP_VehPickupItem_ShootNow(struct Driver* d, int weaponID, int flags) *(int*)&weaponInst->matrix.m[1][1] = *(int*)&dInst->matrix.m[1][1]; *(int*)&weaponInst->matrix.m[2][0] = *(int*)&dInst->matrix.m[2][0]; weaponInst->matrix.m[2][2] = dInst->matrix.m[2][2]; - weaponInst->matrix.t[0] = dInst->matrix.t[0]; - weaponInst->matrix.t[1] = dInst->matrix.t[1]; - weaponInst->matrix.t[2] = dInst->matrix.t[2]; + weaponInst->matrix.t.x = dInst->matrix.t.x; + weaponInst->matrix.t.y = dInst->matrix.t.y; + weaponInst->matrix.t.z = dInst->matrix.t.z; #ifndef REBUILD_PS1 VehPhysForce_RotAxisAngle(&weaponInst->matrix, (short*)&d->AxisAngle1_normalVec, d->rotCurr.y); @@ -290,9 +290,9 @@ void DECOMP_VehPickupItem_ShootNow(struct Driver* d, int weaponID, int flags) *(int*)&weaponInst->matrix.m[1][1] = *(int*)&dInst->matrix.m[1][1]; *(int*)&weaponInst->matrix.m[2][0] = *(int*)&dInst->matrix.m[2][0]; weaponInst->matrix.m[2][2] = dInst->matrix.m[2][2]; - weaponInst->matrix.t[0] = dInst->matrix.t[0]; - weaponInst->matrix.t[1] = dInst->matrix.t[1]; - weaponInst->matrix.t[2] = dInst->matrix.t[2]; + weaponInst->matrix.t.x = dInst->matrix.t.x; + weaponInst->matrix.t.y = dInst->matrix.t.y; + weaponInst->matrix.t.z = dInst->matrix.t.z; weaponInst->scale[0] = 0; weaponInst->scale[1] = 0; @@ -329,13 +329,13 @@ void DECOMP_VehPickupItem_ShootNow(struct Driver* d, int weaponID, int flags) short pos1[3]; short pos2[3]; - pos1[0] = weaponInst->matrix.t[0]; - pos1[1] = weaponInst->matrix.t[1] - 400; - pos1[2] = weaponInst->matrix.t[2]; + pos1[0] = weaponInst->matrix.t.x; + pos1[1] = weaponInst->matrix.t.y - 400; + pos1[2] = weaponInst->matrix.t.z; - pos2[0] = weaponInst->matrix.t[0]; - pos2[1] = weaponInst->matrix.t[1] + 64; - pos2[2] = weaponInst->matrix.t[2]; + pos2[0] = weaponInst->matrix.t.x; + pos2[1] = weaponInst->matrix.t.y + 64; + pos2[2] = weaponInst->matrix.t.z; struct ScratchpadStruct *sps = (struct ScratchpadStruct*)0x1f800108; @@ -389,7 +389,7 @@ void DECOMP_VehPickupItem_ShootNow(struct Driver* d, int weaponID, int flags) rotPtr[2] = 0; rotPtr[3] = 0; - mw->stopFallAtY = weaponInst->matrix.t[1]; + mw->stopFallAtY = weaponInst->matrix.t.y; } else @@ -430,9 +430,9 @@ void DECOMP_VehPickupItem_ShootNow(struct Driver* d, int weaponID, int flags) *(int*)&weaponInst->matrix.m[1][1] = *(int*)&dInst->matrix.m[1][1]; *(int*)&weaponInst->matrix.m[2][0] = *(int*)&dInst->matrix.m[2][0]; weaponInst->matrix.m[2][2] = dInst->matrix.m[2][2]; - weaponInst->matrix.t[0] = dInst->matrix.t[0]; - weaponInst->matrix.t[1] = dInst->matrix.t[1]; - weaponInst->matrix.t[2] = dInst->matrix.t[2]; + weaponInst->matrix.t.x = dInst->matrix.t.x; + weaponInst->matrix.t.y = dInst->matrix.t.y; + weaponInst->matrix.t.z = dInst->matrix.t.z; // potion always faces camera weaponInst->model->headers[0].flags |= 2; @@ -526,7 +526,7 @@ void DECOMP_VehPickupItem_ShootNow(struct Driver* d, int weaponID, int flags) struct Shield* shieldObj = weaponTh->object; shieldObj->animFrame = 0; shieldObj->flags = 0; - shieldObj->duration = 0x2d00; + shieldObj->duration = SECONDS(12); shieldObj->instColor = instColor; shieldObj->instHighlight = instHighlight; shieldObj->highlightRot[0] = 0; @@ -608,9 +608,9 @@ void DECOMP_VehPickupItem_ShootNow(struct Driver* d, int weaponID, int flags) *(int*)&weaponInst->matrix.m[2][0] = 0; weaponInst->matrix.m[2][2] = 0x1000; - weaponInst->matrix.t[0] = dInst->matrix.t[0]; - weaponInst->matrix.t[1] = dInst->matrix.t[1]; - weaponInst->matrix.t[2] = dInst->matrix.t[2]; + weaponInst->matrix.t.x = dInst->matrix.t.x; + weaponInst->matrix.t.y = dInst->matrix.t.y; + weaponInst->matrix.t.z = dInst->matrix.t.z; weaponTh = weaponInst->thread; weaponTh->funcThDestroy = DECOMP_PROC_DestroyInstance; diff --git a/decompile/General/Vehicle/VehStuckProc_02_MaskGrab_Update.c b/decompile/General/Vehicle/VehStuckProc_02_MaskGrab_Update.c index 715ee8f6c..2b58c24d7 100644 --- a/decompile/General/Vehicle/VehStuckProc_02_MaskGrab_Update.c +++ b/decompile/General/Vehicle/VehStuckProc_02_MaskGrab_Update.c @@ -20,10 +20,10 @@ void DECOMP_VehStuckProc_MaskGrab_Update(struct Thread* t, struct Driver* d) if (mask != NULL) { // mask rotZ - mask->rot[2] &= ~(1); + mask->rot.z &= ~(1); // scale = 100% - mask->scale = 0x1000; + mask->scale = FP(1); } diff --git a/decompile/General/Vehicle/VehStuckProc_04_MaskGrab_Animate.c b/decompile/General/Vehicle/VehStuckProc_04_MaskGrab_Animate.c index 98640dc0c..1d6dd6d13 100644 --- a/decompile/General/Vehicle/VehStuckProc_04_MaskGrab_Animate.c +++ b/decompile/General/Vehicle/VehStuckProc_04_MaskGrab_Animate.c @@ -136,14 +136,14 @@ void DECOMP_VehStuckProc_MaskGrab_Animate(struct Thread* t, struct Driver* d) struct MaskHeadWeapon* mask = d->KartStates.MaskGrab.maskObj; // if maskObj - if (mask == 0) + if (mask == NULL) return; // set mask duration - mask->duration = 7680; + mask->duration = SECONDS(8); // less than 0.5s after player fell - if (d->NoInputTimer > 960) + if (d->NoInputTimer > SECONDS(1)) { // scale = 0% mask->scale = 0; @@ -156,7 +156,7 @@ void DECOMP_VehStuckProc_MaskGrab_Animate(struct Thread* t, struct Driver* d) if (d->KartStates.MaskGrab.boolLiftingPlayer == false) { // decrease mask posY by elapsed time - mask->pos[1] -= gGT->elapsedTimeMS; + mask->pos.y -= gGT->elapsedTimeMS; } // if lifting player (if driver isn't falling infinitely) @@ -170,16 +170,16 @@ void DECOMP_VehStuckProc_MaskGrab_Animate(struct Thread* t, struct Driver* d) } // maskPosX = driverPosX - mask->pos[0] = (short)(d->posCurr.x >> 8); + mask->pos.x = (short)(d->posCurr.x >> 8); // set mask posZ - mask->pos[2] = (short)(d->posCurr.z >> 8); + mask->pos.z = (short)(d->posCurr.z >> 8); // if mask posY < driver posY - if (mask->pos[1] < (short)(d->posCurr.y >> 8)) + if (mask->pos.x < (short)(d->posCurr.y >> 8)) { // mask posY = driver posY - mask->pos[1] = (short)(d->posCurr.y >> 8); + mask->pos.y = (short)(d->posCurr.y >> 8); d->KartStates.MaskGrab.boolLiftingPlayer = true; } diff --git a/decompile/General/Vehicle/VehStuckProc_05_MaskGrab_Init.c b/decompile/General/Vehicle/VehStuckProc_05_MaskGrab_Init.c index d7c3481eb..4bd52e257 100644 --- a/decompile/General/Vehicle/VehStuckProc_05_MaskGrab_Init.c +++ b/decompile/General/Vehicle/VehStuckProc_05_MaskGrab_Init.c @@ -111,9 +111,9 @@ void DECOMP_VehStuckProc_MaskGrab_Init(struct Thread* t, struct Driver *d) } // edits position - d->posCurr.x = inst->matrix.t[0] << 8; - d->posCurr.y = inst->matrix.t[1] << 8; - d->posCurr.z = inst->matrix.t[2] << 8; + d->posCurr.x = inst->matrix.t.x << 8; + d->posCurr.y = inst->matrix.t.y << 8; + d->posCurr.z = inst->matrix.t.z << 8; // set previous frame velocity to the same as current frame velocity d->posCurr.x = d->posPrev.x; @@ -129,11 +129,11 @@ void DECOMP_VehStuckProc_MaskGrab_Init(struct Thread* t, struct Driver *d) if (mask == NULL) return; - mask->rot[2] |= 1; + mask->rot.z |= 1; - mask->pos[0] = d->posCurr.x >> 8; - mask->pos[1] = (d->posCurr.y >> 8) + 0x140; - mask->pos[2] = d->posCurr.z >> 8; + mask->pos.x = d->posCurr.x >> 8; + mask->pos.y = (d->posCurr.y >> 8) + 0x140; + mask->pos.z = d->posCurr.z >> 8; } void DECOMP_VehStuckProc_MaskGrab_Particles(struct Driver *d); diff --git a/decompile/General/Vehicle/VehStuckProc_08_PlantEaten_Animate.c b/decompile/General/Vehicle/VehStuckProc_08_PlantEaten_Animate.c index 9b0262435..842ab4443 100644 --- a/decompile/General/Vehicle/VehStuckProc_08_PlantEaten_Animate.c +++ b/decompile/General/Vehicle/VehStuckProc_08_PlantEaten_Animate.c @@ -52,18 +52,18 @@ void DECOMP_VehStuckProc_PlantEaten_Animate(struct Thread* t, struct Driver* d) struct PushBuffer* pb = &gGT->pushBuffer[d->driverID]; pb->pos[0] = camVec.vx; - pb->pos[1] = inst->matrix.t[1] + 0xc0; + pb->pos[1] = inst->matrix.t.y + 0xc0; pb->pos[2] = camVec.vz; - int camX = camVec.vx - inst->matrix.t[0]; - int camZ = camVec.vz - inst->matrix.t[2]; + int camX = camVec.vx - inst->matrix.t.x; + int camZ = camVec.vz - inst->matrix.t.z; pb->rot[1] = (short)ratan2(camX, camZ); // get distance between car and camera dist = SquareRoot0_stub(camX * camX + camZ * camZ); - pb->rot[0] = (short)0x800 - ratan2(pb->pos[1] - inst->matrix.t[1], dist); + pb->rot[0] = (short)0x800 - ratan2(pb->pos[1] - inst->matrix.t.y, dist); pb->rot[2] = 0; } diff --git a/decompile/General/Vehicle/VehStuckProc_12_RevEngine_PhysLinear.c b/decompile/General/Vehicle/VehStuckProc_12_RevEngine_PhysLinear.c index bdbc7a51a..c7c6da2e1 100644 --- a/decompile/General/Vehicle/VehStuckProc_12_RevEngine_PhysLinear.c +++ b/decompile/General/Vehicle/VehStuckProc_12_RevEngine_PhysLinear.c @@ -25,7 +25,7 @@ void DECOMP_VehStuckProc_RevEngine_PhysLinear(struct Thread* t, struct Driver* d // if maskObj exists if (d->KartStates.RevEngine.maskObj != 0) - d->KartStates.RevEngine.maskObj->duration = 7680; + d->KartStates.RevEngine.maskObj->duration = SECONDS(8); #ifdef USE_ONLINE if (d->driverID != 0) diff --git a/decompile/General/Vehicle/VehTurbo_2_ThTick.c b/decompile/General/Vehicle/VehTurbo_2_ThTick.c index f3a47c650..f04b49593 100644 --- a/decompile/General/Vehicle/VehTurbo_2_ThTick.c +++ b/decompile/General/Vehicle/VehTurbo_2_ThTick.c @@ -110,7 +110,7 @@ void DECOMP_VehTurbo_ThTick(struct Thread* turboThread) gte_rt(); // set translation vector - gte_stlvl((VECTOR *)&instance->matrix.t[0]); + gte_stlvl((VECTOR *)&instance->matrix.t.x); // matrix of second turbo instance, negate X axis turbo->inst->matrix.m[0][0] = (short)(-(int)instanceDriver->matrix.m[0][0] * fireSize >> 3); @@ -128,7 +128,7 @@ void DECOMP_VehTurbo_ThTick(struct Thread* turboThread) gte_rt(); // set translation vector - gte_stlvl((VECTOR *)&turbo->inst->matrix.t[0]); + gte_stlvl((VECTOR *)&turbo->inst->matrix.t.x); // decrease turbo visibility cooldown by elapsed milliseconds per frame, ~32 elapsedTime = turbo->fireVisibilityCooldown - gGT->elapsedTimeMS; diff --git a/include/ctr_math.h b/include/ctr_math.h index 94b8530d0..e65bcffa0 100644 --- a/include/ctr_math.h +++ b/include/ctr_math.h @@ -76,6 +76,8 @@ typedef struct Matrix { Vec3 t; } Matrix; +typedef Matrix MATRIX; //fix decompile duplicated + // trigonometry // struct TrigTable diff --git a/include/decomp_functions.h b/include/decomp_functions.h index ade680273..17d987ca5 100644 --- a/include/decomp_functions.h +++ b/include/decomp_functions.h @@ -472,8 +472,8 @@ void DECOMP_UI_RenderFrame_Racing(void); void DECOMP_UI_SaveLapTime(int numLaps, int lapTime, short driverID); -void DECOMP_UI_Map_GetIconPos(short* m,int* posX,int* posY); -void DECOMP_UI_Map_DrawMap(struct Icon* mapTop, struct Icon* mapBottom, short posX, short posY, struct PrimMem* primMem, u_long* otMem, u_int colorID); +void DECOMP_UI_Map_GetIconPos(struct Map* minimap, Vec2* pos); +void DECOMP_UI_Map_DrawMap(struct Icon* mapTop, struct Icon* mapBottom, SVec2* pos, struct PrimMem* primMem, u_long* otMem, u_int colorID); void DECOMP_UI_Lerp2D_Linear(short* ptrPos, short startX, short startY, short endX, short endY, int curFrame, short endFrame); @@ -722,22 +722,22 @@ void DECOMP_AH_Map_LoadSave_Prim( void* ot, struct PrimMem* primMem); void DECOMP_AH_Map_LoadSave_Full( - int posX, int posY, + Vec2* pos, short* vertPos, char* vertCol, int unk800, int angle); void DECOMP_AH_Map_HubArrow( - int posX, int posY, - short* vertPos, char* vertCol, + Vec2* pos, + short* arrowPos, char* arrorCol, int unk800, int angle); void DECOMP_AH_Map_HubArrowOutter( - void* hubPtrs, int arrowIndex, - int posX, int posY, + struct Map* hubPtrs, int arrowIndex, + Vec2* pos, int inputAngle, int type); -void DECOMP_AH_Map_HubItems(void* hubPtrs, short *param_2); -void DECOMP_AH_Map_Warppads(short* ptrMap, struct Thread* warppadThread, short *param_3); +void DECOMP_AH_Map_HubItems(struct Map* hubPtrs, short *type); +void DECOMP_AH_Map_Warppads(struct Map* ptrMap, struct Thread* warppadThread, short *type); void DECOMP_AH_Map_Main(void); void DECOMP_AH_Pause_Destroy(void); void DECOMP_AH_Pause_Draw(int pageID, int posX); @@ -820,11 +820,11 @@ int DECOMP_RaceFlag_IsTransitioning(void); void DECOMP_LOAD_Robots1P(int characterID); void DECOMP_CTR_Box_DrawWirePrims(Point p1, Point p2, Color color, void* ot); void DECOMP_UI_Map_DrawRawIcon( //1st param is probably a ptr type of some sort (maybe short*)?, could maybe do `void*` for now - int ptrMap, int* param_2, + struct Map* ptrMap, Vec3* pos, int iconID, int colorID, int unused, short scale); int DECOMP_RaceFlag_GetCanDraw(void); -void DECOMP_UI_Map_DrawDrivers(int ptrMap, struct Thread* bucket, short* param_3); +void DECOMP_UI_Map_DrawDrivers(struct Map* ptrMap, struct Thread* bucket, short unused); int DECOMP_VehTalkMask_boolNoXA(void); void DECOMP_VehTalkMask_End(void); struct Instance* DECOMP_VehTalkMask_Init(void); @@ -864,12 +864,12 @@ int DECOMP_LOAD_IsOpen_MainMenu(void); int DECOMP_Particle_BitwiseClampByte(int* value); void DECOMP_PROC_DestroyBloodline(struct Thread* t); void DECOMP_RECTMENU_DrawFullRect(struct RectMenu* menu, RECT* inner); -void DECOMP_UI_Map_DrawAdvPlayer(int ptrMap, int* matrix, int unused1, int unused2, short param_5, short param_6); +void DECOMP_UI_Map_DrawAdvPlayer(struct Map* ptrMap, Vec3* pos, int unused1, int unused2, short unk800, short angle); void DECOMP_DecalHUD_DrawWeapon(struct Icon* icon, short posX, short posY, struct PrimMem* primMem, u_long* ot, char transparency, short scale, char rot); void DECOMP_DebugFont_DrawNumbers(int index, int screenPosX, int screenPosY); void DECOMP_UI_RenderFrame_CrystChall(void); -void DECOMP_UI_Map_DrawGhosts(int ptrMap, struct Thread* bucket); -void DECOMP_UI_Map_DrawTracking(int ptrMap, struct Thread* bucket); +void DECOMP_UI_Map_DrawGhosts(struct Map* ptrMap, struct Thread* bucket); +void DECOMP_UI_Map_DrawTracking(struct Map* ptrMap, struct Thread* bucket); void DECOMP_LOAD_Callback_Podiums(struct LoadQueueSlot* lqs); void DECOMP_LOAD_Callback_LEV(struct LoadQueueSlot* lqs); void DECOMP_LOAD_Callback_PatchMem(); diff --git a/include/gpu.h b/include/gpu.h index 6398d9528..bc35bd30f 100644 --- a/include/gpu.h +++ b/include/gpu.h @@ -202,4 +202,4 @@ force_inline void addFill(u_long* ot, FILL* p) (((P_COLOR *) &((p)->r0))->color = (rgb0)), \ (((P_COLOR *) &((p)->r1))->color = (rgb1)), \ (((P_COLOR *) &((p)->r2))->color = (rgb2)), \ - (((P_COLOR *) &((p)->r3))->color = (rgb3)) + (((P_COLOR *) &((p)->r3))->color = (rgb3)) \ No newline at end of file diff --git a/include/namespace_Level.h b/include/namespace_Level.h index 7e383334b..b71f8dd57 100644 --- a/include/namespace_Level.h +++ b/include/namespace_Level.h @@ -468,6 +468,23 @@ enum ST1 ST1_CREDITS }; + +//minimap +struct Map +{ + short worldEndX; + short worldEndY; + short worldStartX; + short worldStartY; + + short iconSizeX; + short iconSizeY; + short iconStartX; + short iconStartY; + + short mode; +}; + struct SpawnType1 { int count; diff --git a/include/ovr_231.h b/include/ovr_231.h index 8526fe0ba..2e192821d 100644 --- a/include/ovr_231.h +++ b/include/ovr_231.h @@ -29,7 +29,7 @@ struct MaskHeadScratch struct MaskHeadWeapon { // 0x0 - short rot[3]; + SVec3 rot; // 0x6 short duration; @@ -38,7 +38,7 @@ struct MaskHeadWeapon struct Instance* maskBeamInst; // 0xC - short pos[3]; + SVec3 pos; // 0x12 short scale; @@ -430,7 +430,7 @@ struct Follower struct Thread* mineTh; int backupTimesDestroyed; - short realPos[4]; + SVec4 realPos; }; #if 0 diff --git a/include/ovr_232.h b/include/ovr_232.h index c88144844..b0ea77792 100644 --- a/include/ovr_232.h +++ b/include/ovr_232.h @@ -73,7 +73,7 @@ struct WoodDoor struct Instance* keyInst[4]; // 0x14 (5) - short doorRot[4]; + SVec4 doorRot; // 0x1c (7) short camFlags; @@ -87,7 +87,7 @@ struct WoodDoor short frameCount_doorOpenAnim; // 0x28 (10) - short keyRot[4]; + SVec4 keyRot; // 0x30 (12) short keyOrbit; @@ -207,6 +207,29 @@ struct OverlayRDATA_232 short keyFrame[0xc]; }; +struct HubItem +{ + // 0x0 + SVec2 pos; + + // 0x4 + short angle; + + // 0x6 + // 0x03: boss + // 0x04: warppad + // 0x64: saveload + // -1: (1 key) Arrow beach->gemstone + // -2: (0 key) Arrow gemstone->beach + // -3: (0 key) Arrow gemstone->ruins + // -4: (2 key) Arrow beach->glacier + // -5: (3 key) Arrow glacier->citadel + short iconType; + + // 0x8 -- size +}; + + struct OverlayDATA_232 { // 800b4ddc (3*5 plus padding) @@ -242,44 +265,23 @@ struct OverlayDATA_232 // 800b4ec0 short primOffsetXY_HubArrow[5*2]; - struct HubItem - { - // 0x0 - short posX; - short posY; - - // 0x4 - short angle; - - // 0x6 - // 0x03: boss - // 0x04: warppad - // 0x64: saveload - // -1: (1 key) Arrow beach->gemstone - // -2: (0 key) Arrow gemstone->beach - // -3: (0 key) Arrow gemstone->ruins - // -4: (2 key) Arrow beach->glacier - // -5: (3 key) Arrow glacier->citadel - short iconType; - - // 0x8 -- size - } + // 800b4ed4 // 2 arrows, boss, save/load, null(0xFFFF) - hubItems_hub1[5], + struct HubItem hubItems_hub1[5]; // 800b4efc - hubItems_hub2[5], + struct HubItem hubItems_hub2[5]; // 800b4f24 - hubItems_hub3[5], + struct HubItem hubItems_hub3[5]; // 800b4f4c (3 arrows) - hubItems_hub4[6], + struct HubItem hubItems_hub4[6]; // 800b4f7c (1 arrow) - hubItems_hub5[4]; + struct HubItem hubItems_hub5[4]; // 800b4f9c -- array of pointers: // 800b4ed4 800b4efc 800b4f24 // 800b4f4c 800b4f7c - short* hubItemsXY_ptrArray[5]; + struct HubItem* hubItemsXY_ptrArray[5]; // 800b4fb0 short hubArrowXY_Inner[2*3]; @@ -323,6 +325,7 @@ struct OverlayDATA_232 short type; short characterID_Boss; + } advPausePages[7]; // 0x800B5060 @@ -365,10 +368,10 @@ struct OverlayDATA_232 int fiveArrow_col2[3]; // 0x800b51dc - short maskPos[4]; + SVec4 maskPos; // 0x800b51e4 - short maskRot[4]; + SVec4 maskRot; // 0x800b51ec short maskScale; @@ -377,10 +380,10 @@ struct OverlayDATA_232 short maskCooldown; // 0x800b51f0 - short maskOffsetPos[4]; + SVec4 maskOffsetPos; // 0x800b51f8 - short maskOffsetRot[4]; + SVec4 maskOffsetRot; // 0x800b5200 short maskVars[12]; diff --git a/include/psn00bsdk/include/psxgte.h b/include/psn00bsdk/include/psxgte.h index c2ac36352..459d4884b 100644 --- a/include/psn00bsdk/include/psxgte.h +++ b/include/psn00bsdk/include/psxgte.h @@ -20,16 +20,23 @@ #include #else #include + #endif +#include "ctr_math.h" #define ONE (1 << 12) /* Structure definitions */ +//this is duplicated +/* typedef struct _MATRIX { int16_t m[3][3]; - int32_t t[3]; + int32_t t; } MATRIX; +*/ + + typedef struct _VECTOR { int32_t vx, vy, vz; From 3c08eaa393df26d611c3c908c8e689eb60469a2f Mon Sep 17 00:00:00 2001 From: penta3 Date: Tue, 7 Oct 2025 03:10:01 -0300 Subject: [PATCH 5/7] minimap working --- .../General/231/231_042_RB_RainCloud_ThTick.c | 6 +- .../232/232_20_AH_Map_HubArrowOutter.c | 29 +-- .../General/232/232_21_AH_Map_HubItems.c | 196 +++++++++--------- .../General/232/232_22_AH_Map_Warppads.c | 4 +- decompile/General/232/232_23_AH_Map_Main.c | 6 +- decompile/General/UI/UI_09_Map_DrawMap.c | 5 +- decompile/General/UI/UI_10_Map_GetIconPos.c | 4 +- decompile/General/UI/UI_12_Map_DrawRawIcon.c | 3 +- decompile/General/UI/UI_13_Map_DrawDrivers.c | 5 +- include/ctr_math.h | 2 +- include/namespace_Level.h | 13 +- include/psn00bsdk/include/psxgte.h | 4 +- 12 files changed, 153 insertions(+), 124 deletions(-) diff --git a/decompile/General/231/231_042_RB_RainCloud_ThTick.c b/decompile/General/231/231_042_RB_RainCloud_ThTick.c index 5b2dcc011..4466311a1 100644 --- a/decompile/General/231/231_042_RB_RainCloud_ThTick.c +++ b/decompile/General/231/231_042_RB_RainCloud_ThTick.c @@ -54,13 +54,13 @@ void DECOMP_RB_RainCloud_ThTick(struct Thread* t) // get average between instance and driver inst->matrix.t.x += dInst->matrix.t.x; - inst->matrix.t.x = dInst->matrix.t.x >> 1; + inst->matrix.t.x = inst->matrix.t.x >> 1; inst->matrix.t.y += dInst->matrix.t.y; - inst->matrix.t.y = dInst->matrix.t.y >> 1; + inst->matrix.t.y = inst->matrix.t.y >> 1; inst->matrix.t.z += dInst->matrix.t.z; - inst->matrix.t.z = dInst->matrix.t.z >> 1; + inst->matrix.t.z = inst->matrix.t.z >> 1; diff --git a/decompile/General/232/232_20_AH_Map_HubArrowOutter.c b/decompile/General/232/232_20_AH_Map_HubArrowOutter.c index 9ffae84c9..d29c6b507 100644 --- a/decompile/General/232/232_20_AH_Map_HubArrowOutter.c +++ b/decompile/General/232/232_20_AH_Map_HubArrowOutter.c @@ -13,23 +13,23 @@ void DECOMP_AH_Map_HubArrowOutter( int timer = gGT->timer >> FPS_RIGHTSHIFT(0); - int var14; - int var15; + int colorR; + int colorG; int var8; - var15 = 0x40; + colorG = 0x40; if((timer & 1) != 0) - var15 = 0xe0; + colorG = 0xe0; if(type == 0) { - var14 = var15; + colorR = colorG; var8 = 0x200; } else if(type == 1) { - var14 = 0xff; + colorR = 0xff; var8 = 0x555; pos->x += D232.hubArrowXY_Outter[2*(((inputAngle>>0x8)&0xc)>>2)+0]; @@ -38,7 +38,7 @@ void DECOMP_AH_Map_HubArrowOutter( else { - var14 = var15; + colorR = colorG; var8 = 0x199; // needed? @@ -56,10 +56,11 @@ void DECOMP_AH_Map_HubArrowOutter( int iVar16 = ((var5 * 0x2aa + 0x1000) * 0x10000) >> 0x1a; - + + #if 0 int bVar1 = 1; + #endif - var5 = 0; int iVar6 = 0; int iVar9 = 0; @@ -78,16 +79,20 @@ void DECOMP_AH_Map_HubArrowOutter( sin = pos->x + ((((iVar16 << 3) / 5) * sin) >> iVar4); cos = pos->y - ((((iVar16 ) ) * cos) >> iVar4); - + + #if 0 //unused ? if(!bVar1) { DECOMP_CTR_Box_DrawWirePrims( (Point){iVar9, iVar6}, (Point){sin, cos}, - MakeColor(var14, var15, 0xff), + MakeColor(colorR, colorG, 0xff), (void*)gGT->pushBuffer_UI.ptrOT); } - + + bVar1 = 0; + #endif + iVar9 = sin; iVar6 = cos; var5++; diff --git a/decompile/General/232/232_21_AH_Map_HubItems.c b/decompile/General/232/232_21_AH_Map_HubItems.c index 607302196..4a6686a64 100644 --- a/decompile/General/232/232_21_AH_Map_HubItems.c +++ b/decompile/General/232/232_21_AH_Map_HubItems.c @@ -1,6 +1,6 @@ #include -void DECOMP_AH_Map_HubItems(struct Map* hubPtrs, short* type) +void DECOMP_AH_Map_HubItems(struct Map* hubPtrs, short *type) { struct GameTracker *gGT; @@ -10,72 +10,75 @@ void DECOMP_AH_Map_HubItems(struct Map* hubPtrs, short* type) short iconType; short *trophies; bool open; - int menu_TrackIndex; + unsigned char i; u_int bit; - int iVar5; - int uVar6; - short sVar7; - short sVar8; - struct HubItem* hubItems; - SVec2 pos; - Vec3 pos3D; + int arrowColIndex; + unsigned char itemColorID; //must be for data.ptrColor[itemColorID] + short boolKey; + short itemMode; + short typeCount; + Vec3 rawIconPos; + + //load/save instance on minimap + Vec2 saveObjpos; + + //most likely the arrows for hub doors + Vec2 arrow1; + Vec2 arrow2; + + gGT = sdata->gGT; adv = &sdata->advProgress; levelID = gGT->levelID; - - hubItems = D232.hubItemsXY_ptrArray[levelID - GEM_STONE_VALLEY]; - pos = hubItems->pos; + hubID = levelID - GEM_STONE_VALLEY; + typeCount = *type; - if (pos.x != -1) - { - do + + for(struct HubItem* hubitem = D232.hubItemsXY_ptrArray[hubID]; + hubitem->pos.x != -1; hubitem++) //hubitem[lastIndex +1]->pos.x is always -1 { - sVar8 = -1; - sVar8 = -1; - sVar7 = (short)0xffffffff; //??? - sVar7 = -1; - sVar7 = -1; + itemMode = -1; + boolKey = -1; // iconType - iconType = hubItems->iconType; + iconType = hubitem->iconType; open = true; // Arrow beach->gemstone if (iconType == -1) { - sVar7 = 0; + boolKey = 0; if (levelID == N_SANITY_BEACH) { // locked if key < 1 - sVar7 = (gGT->currAdvProfile.numKeys < 1); + boolKey = (gGT->currAdvProfile.numKeys < 1); } LAB_800b17e8: - iVar5 = sVar7 << 0x10; - sVar8 = sVar8; - sVar7 = (short)sVar7; + arrowColIndex = boolKey << 0x10; LAB_800b17ec: - iVar5 = iVar5 >> 0x10; + arrowColIndex = arrowColIndex >> 0x10; } else { if (iconType > -1) { + boolKey = boolKey; // gemstone valley if (iconType == 4) { - menu_TrackIndex = 0; - iVar5 = 0; + i = 0; + arrowColIndex = 0; // check 4 boss keys - for (menu_TrackIndex = 0; menu_TrackIndex < 4; menu_TrackIndex++) + for (i = 0; i < 4; i++) { - bit = menu_TrackIndex + PRIZE_BOSS_KEY; + bit = i + PRIZE_BOSS_KEY; if (CHECK_ADV_BIT(adv->rewards, bit) == 0) { @@ -86,38 +89,38 @@ void DECOMP_AH_Map_HubItems(struct Map* hubPtrs, short* type) if (!open) { LAB_800b17e4: - sVar8 = 0; + itemMode = 0; goto LAB_800b17e8; } - sVar7 = sdata->advProgress.rewards[3] & 4; + boolKey = sdata->advProgress.rewards[3] & 4; } // not gemstone valley else { - iVar5 = 0; + arrowColIndex = 0; - if (3 < iconType) + if (iconType > 3) { - iVar5 = -0x10000; - sVar8 = sVar8; + arrowColIndex = -0x10000; + itemMode = itemMode; // saveLoad screen (0x64) if (iconType == 100) { - Vec2 newPos; - newPos.x = (int)hubItems->pos.x -0x200; - newPos.y = (int)hubItems->pos.y -0x100; - DECOMP_UI_Map_GetIconPos(hubPtrs, &newPos); + saveObjpos.x = hubitem->pos.x -0x200; + saveObjpos.y = hubitem->pos.y -0x100; + + DECOMP_UI_Map_GetIconPos(hubPtrs, &saveObjpos); DECOMP_AH_Map_LoadSave_Full( - &newPos, + &saveObjpos, &D232.loadSave_pos[0], (char*)&D232.loadSave_col[0], - 0x800, (int)hubItems->angle + 0x800, hubitem->angle ); - iVar5 = -0x10000; + arrowColIndex = -0x10000; } goto LAB_800b17ec; } @@ -125,13 +128,13 @@ void DECOMP_AH_Map_HubItems(struct Map* hubPtrs, short* type) // did not use GOTO, // must be == 3, for Boss Garage - int base = levelID - N_SANITY_BEACH; - for (menu_TrackIndex = 0; menu_TrackIndex < 4; menu_TrackIndex++) + for (i = 0; i < 4; i++) { - trophies = &data.advHubTrackIDs[base * 4]; + //should skip gemstone valley + trophies = &data.advHubTrackIDs[(hubID + 1) * 4]; - if (CHECK_ADV_BIT(adv->rewards, (trophies[menu_TrackIndex]+PRIZE_TROPHY_RACE)) == 0) + if (CHECK_ADV_BIT(adv->rewards, (trophies[i]+PRIZE_TROPHY_RACE)) == 0) { open = false; break; @@ -141,18 +144,19 @@ void DECOMP_AH_Map_HubItems(struct Map* hubPtrs, short* type) goto LAB_800b17e4; // check if key is unlocked - sVar7 = CHECK_ADV_BIT(adv->rewards, (base+PRIZE_BOSS_KEY)); + //should skip gem stone valley + boolKey = CHECK_ADV_BIT(adv->rewards, ((hubID +1)+PRIZE_BOSS_KEY)); } // open, not beaten - sVar8 = 1; + itemMode = 1; - iVar5 = -0x10000; + arrowColIndex = -0x10000; // boss is beaten - if (sVar7 != 0) + if (boolKey != 0) { - sVar8 = 2; + itemMode = 2; } goto LAB_800b17ec; } @@ -161,7 +165,7 @@ void DECOMP_AH_Map_HubItems(struct Map* hubPtrs, short* type) if (iconType == -4) { // locked if keys < 2 - sVar7 = ((gGT->currAdvProfile.numKeys) < 2); + boolKey = ((gGT->currAdvProfile.numKeys) < 2); goto LAB_800b17e8; } if (iconType < -3) @@ -170,10 +174,10 @@ void DECOMP_AH_Map_HubItems(struct Map* hubPtrs, short* type) if (iconType == -5) { // locked if keys < 3 - sVar7 = ((gGT->currAdvProfile.numKeys) < 3); + boolKey = ((gGT->currAdvProfile.numKeys) < 3); goto LAB_800b17e8; } - iVar5 = -1; + arrowColIndex = -1; } else @@ -183,93 +187,99 @@ void DECOMP_AH_Map_HubItems(struct Map* hubPtrs, short* type) if ((iconType == -3) || (iconType == -2)) { // never locked - sVar7 = 0; + boolKey = 0; goto LAB_800b17e8; } - iVar5 = -1; + arrowColIndex = -1; } } - if (iVar5 > -1) + if (arrowColIndex > -1) { - Vec2 newPos; - newPos.x = (int)hubItems->pos.x -0x200; - newPos.y = (int)hubItems->pos.y -0x100; - DECOMP_UI_Map_GetIconPos(hubPtrs, &newPos); - if ((iVar5 == 0) && (D232.unkModeHubItems == 0)) + arrow1.x = hubitem->pos.x -0x200; + arrow1.y = hubitem->pos.y -0x100; + + DECOMP_UI_Map_GetIconPos(hubPtrs, &arrow1); + if ((arrowColIndex == 0) && (D232.unkModeHubItems == 0)) { DECOMP_AH_Map_HubArrowOutter( - hubPtrs, (int)*type, &newPos, - (0x1000 - hubItems->angle), 1); - *type++; + hubPtrs, typeCount, &arrow1, + (0x1000 - hubitem->angle), 1); + + typeCount++; } // if even frame if ((gGT->timer & FPS_DOUBLE(2)) == 0) { - iVar5 = (int)sVar7 * 6; + arrowColIndex = (int)boolKey * 6; } else { - iVar5 = ((int)sVar7 * 2 + 1) * 3; + arrowColIndex = ((int)boolKey * 2 + 1) * 3; } DECOMP_AH_Map_HubArrow( - &newPos, - &D232.hubArrow_pos[0], (char*)&D232.hubArrow_col1[iVar5], - 0x800, (int)hubItems->angle); + &arrow1, + &D232.hubArrow_pos[0], (char*)&D232.hubArrow_col1[arrowColIndex], + 0x800, hubitem->angle); } - if (-1 < sVar8) + if (itemMode > -1) { - pos3D.x = (int)hubItems->pos.x; - pos3D.y = 0; - pos3D.z = (int)hubItems->pos.y; + rawIconPos.x = hubitem->pos.x; + rawIconPos.y = 0; + rawIconPos.z = hubitem->pos.y; // if beat boss race - if (sVar8 == 2) + if (itemMode == 2) { // red - uVar6 = 3; + itemColorID = 3; } else { // locked boss race - // sVar6 == 0 + // grey - uVar6 = 0x17; + itemColorID = 0x17; // open, not beaten - if (sVar8 == 1) + if (itemMode == 1) { // blue and white // depending on frames - uVar6 = 5; + itemColorID = 5; if ((gGT->timer & FPS_DOUBLE(2)) != 0) - uVar6 = 4; + itemColorID = 4; } } // open, not beaten - if (sVar8 == 1) + if (itemMode == 1) { - D232.unkModeHubItems = sVar8; + D232.unkModeHubItems = itemMode; + + arrow2.x = hubitem->pos.x; + arrow2.y = hubitem->pos.y; + + DECOMP_UI_Map_GetIconPos(hubPtrs, &arrow2); - DECOMP_UI_Map_GetIconPos(hubPtrs, &pos3D); + DECOMP_AH_Map_HubArrowOutter(hubPtrs, typeCount, &arrow2, 0, 2); - DECOMP_AH_Map_HubArrowOutter(hubPtrs, (int)*type, &pos3D, 0, 2); + typeCount++; - *type++; } // draw star icon for boss - DECOMP_UI_Map_DrawRawIcon(hubPtrs, &pos3D, 0x37, uVar6, 0, 0x1000); + DECOMP_UI_Map_DrawRawIcon(hubPtrs, &rawIconPos, 0x37, itemColorID, 0, 0x1000); } - - } while (hubItems->angle != -1); - } + + *type = typeCount; + } + return; -} +} \ No newline at end of file diff --git a/decompile/General/232/232_22_AH_Map_Warppads.c b/decompile/General/232/232_22_AH_Map_Warppads.c index 250d33a7b..2696104c0 100644 --- a/decompile/General/232/232_22_AH_Map_Warppads.c +++ b/decompile/General/232/232_22_AH_Map_Warppads.c @@ -67,9 +67,9 @@ void DECOMP_AH_Map_Warppads(struct Map* ptrMap, struct Thread* warppadThread, sh // Get Icon Dimensions DECOMP_UI_Map_GetIconPos(ptrMap, &pos); - DECOMP_AH_Map_HubArrowOutter(ptrMap,(int)*type,&pos,0,0); + DECOMP_AH_Map_HubArrowOutter(ptrMap,(int)(*type),&pos,0,0); - *type++; + (*type)++; } DECOMP_UI_Map_DrawRawIcon( diff --git a/decompile/General/232/232_23_AH_Map_Main.c b/decompile/General/232/232_23_AH_Map_Main.c index 7f03a96ee..056d27d93 100644 --- a/decompile/General/232/232_23_AH_Map_Main.c +++ b/decompile/General/232/232_23_AH_Map_Main.c @@ -12,10 +12,12 @@ void DECOMP_AH_Map_Main(void) // force disable speedometer sdata->HudAndDebugFlags &= 0xfffffff7; + + advDriver = gGT->drivers[0]; ptrHudData = data.hudStructPtr[0]; - hubPtrs = 0; + iVar1 = DECOMP_RaceFlag_GetCanDraw(); if (iVar1 == 0) { @@ -73,7 +75,7 @@ void DECOMP_AH_Map_Main(void) DECOMP_UI_Map_DrawDrivers(hubPtrs,gGT->threadBuckets[0].thread, 0); - DECOMP_AH_Map_Warppads(hubPtrs,gGT->threadBuckets[5].thread, &type); //local_1e index 1 and 2 are never assigned to, so garbage data? + DECOMP_AH_Map_Warppads(hubPtrs,gGT->threadBuckets[5].thread, (short*)&type); //local_1e index 1 and 2 are never assigned to, so garbage data? DECOMP_AH_Map_HubItems(hubPtrs,&type); diff --git a/decompile/General/UI/UI_09_Map_DrawMap.c b/decompile/General/UI/UI_09_Map_DrawMap.c index f454a3573..d9675e6f7 100644 --- a/decompile/General/UI/UI_09_Map_DrawMap.c +++ b/decompile/General/UI/UI_09_Map_DrawMap.c @@ -14,6 +14,7 @@ void DECOMP_UI_Map_DrawMap(struct Icon* mapTop, struct Icon* mapBottom, SVec2* p gGT = sdata->gGT; + // draw minimap with neutral/none vertex color, minimap's regular color is white color = 0x808080; @@ -46,7 +47,7 @@ void DECOMP_UI_Map_DrawMap(struct Icon* mapTop, struct Icon* mapBottom, SVec2* p // not sure when the game ever draws only the bottom half if ( - ((minimap != 0) && (minimap->mode == 0)) || + ((minimap != 0) && (minimap->unk == 0)) || // if in main menu (character selection, track selection, any part of it) ((gGT->gameMode1 & MAIN_MENU) != 0) @@ -111,7 +112,7 @@ void UI_Map_DrawMap_ExtraFunc(struct Icon* icon, POLY_FT4* p, short posX, short // and icons to scale together void** pointers = ST1_GETPOINTERS(sdata->gGT->level1->ptrSpawnType1); - void* levPtrMap = pointers[ST1_MAP]; + void* levPtrMap = (struct Map*)pointers[ST1_MAP]; Vec2 mid; diff --git a/decompile/General/UI/UI_10_Map_GetIconPos.c b/decompile/General/UI/UI_10_Map_GetIconPos.c index 9a37012b8..9a353af89 100644 --- a/decompile/General/UI/UI_10_Map_GetIconPos.c +++ b/decompile/General/UI/UI_10_Map_GetIconPos.c @@ -49,8 +49,8 @@ void DECOMP_UI_Map_GetIconPos(struct Map* minimap, Vec2* pos) else { // 270 degrees - addX = (pos->x * minimap->iconSizeX ) / worldRangeY; - addY = -(pos->y * minimap->iconSizeY * 2) / worldRangeX; + addX = (pos->y * minimap->iconSizeX ) / worldRangeY; + addY = -(pos->x * minimap->iconSizeY * 2) / worldRangeX; } #ifdef USE_16BY9 diff --git a/decompile/General/UI/UI_12_Map_DrawRawIcon.c b/decompile/General/UI/UI_12_Map_DrawRawIcon.c index ddc49d727..042733795 100644 --- a/decompile/General/UI/UI_12_Map_DrawRawIcon.c +++ b/decompile/General/UI/UI_12_Map_DrawRawIcon.c @@ -10,6 +10,7 @@ void DECOMP_UI_Map_DrawRawIcon( int *ptrColor; struct GameTracker* gGT = sdata->gGT; + Vec2 iconPos; iconPos.x = pos->x; iconPos.y = pos->z; @@ -26,7 +27,7 @@ void DECOMP_UI_Map_DrawRawIcon( DECOMP_DecalHUD_DrawPolyGT4( iconPtrArray[iconID], - iconPos.x, iconPos.y, + (int)iconPos.x, (int)iconPos.y, &gGT->backBuffer->primMem, gGT->pushBuffer_UI.ptrOT, ptrColor[0], ptrColor[1], ptrColor[2], ptrColor[3], diff --git a/decompile/General/UI/UI_13_Map_DrawDrivers.c b/decompile/General/UI/UI_13_Map_DrawDrivers.c index 5f0c976b6..b5ed657f3 100644 --- a/decompile/General/UI/UI_13_Map_DrawDrivers.c +++ b/decompile/General/UI/UI_13_Map_DrawDrivers.c @@ -1,5 +1,6 @@ #include +//unused was a short*, but it literally didnt had any use on code void DECOMP_UI_Map_DrawDrivers(struct Map* ptrMap,struct Thread* bucket, short unused) { @@ -18,7 +19,7 @@ void DECOMP_UI_Map_DrawDrivers(struct Map* ptrMap,struct Thread* bucket, short u for( /* bucket */ ; bucket != 0; bucket = bucket->siblingThread - //, unused++; + //, unused++ ) { // Player structure @@ -52,7 +53,7 @@ void DECOMP_UI_Map_DrawDrivers(struct Map* ptrMap,struct Thread* bucket, short u if ((gGT->gameMode1 & ADVENTURE_ARENA) != 0) { // Draw dot for Player on 2D Adv Map - DECOMP_UI_Map_DrawAdvPlayer(ptrMap,(int*)&bucket->inst->matrix.t.x, 0x32, kartColor, + DECOMP_UI_Map_DrawAdvPlayer(ptrMap,&bucket->inst->matrix.t, 0x32, kartColor, (d->rotCurr.y + 0x800U) | 0x1000,0x800); continue; diff --git a/include/ctr_math.h b/include/ctr_math.h index e65bcffa0..3571d5b1a 100644 --- a/include/ctr_math.h +++ b/include/ctr_math.h @@ -76,7 +76,7 @@ typedef struct Matrix { Vec3 t; } Matrix; -typedef Matrix MATRIX; //fix decompile duplicated +typedef Matrix MATRIX; //fix psn00b duplicate // trigonometry // diff --git a/include/namespace_Level.h b/include/namespace_Level.h index b71f8dd57..216854871 100644 --- a/include/namespace_Level.h +++ b/include/namespace_Level.h @@ -472,17 +472,26 @@ enum ST1 //minimap struct Map { + //0x0 short worldEndX; + //0x2 short worldEndY; + //0x4 short worldStartX; + //0x6 short worldStartY; - + //0x8 short iconSizeX; + //0xA short iconSizeY; + //0xC short iconStartX; + //0xE short iconStartY; - + //0x10 short mode; + //0x12 + short unk; //this is not padding, this is used to draw minimap, needed for crash cove }; struct SpawnType1 diff --git a/include/psn00bsdk/include/psxgte.h b/include/psn00bsdk/include/psxgte.h index 459d4884b..485254a59 100644 --- a/include/psn00bsdk/include/psxgte.h +++ b/include/psn00bsdk/include/psxgte.h @@ -28,11 +28,11 @@ /* Structure definitions */ -//this is duplicated +//decomp already have a matrix declaration /* typedef struct _MATRIX { int16_t m[3][3]; - int32_t t; + int32_t t[3]; } MATRIX; */ From 64bf48e48bb97998536c9bb97f76075738c2d650 Mon Sep 17 00:00:00 2001 From: penta3 Date: Tue, 7 Oct 2025 07:57:29 -0300 Subject: [PATCH 6/7] scratchpad progress --- decompile/General/223/223_Full.c | 160 ++++++----- decompile/General/225/225_Full.c | 19 +- .../230/230_50_MM_Characters_MenuProc.c | 6 +- .../General/232/232_21_AH_Map_HubItems.c | 10 +- .../PushBuffer/PushBuffer_06_UpdateFrustum.c | 76 +++--- decompile/General/gte.c | 11 +- include/common.h | 4 +- include/ctr_math.h | 1 - include/namespace_Decal.h | 7 + include/namespace_PushBuffer.h | 9 +- include/namespace_RectMenu.h | 6 + include/namespace_gte.h | 257 ++++++++++++++++++ include/psn00b_Headers.h | 14 + include/psn00bsdk/include/psxgte.h | 6 +- 14 files changed, 444 insertions(+), 142 deletions(-) create mode 100644 include/namespace_gte.h create mode 100644 include/psn00b_Headers.h diff --git a/decompile/General/223/223_Full.c b/decompile/General/223/223_Full.c index 5216eff46..738ec96f7 100644 --- a/decompile/General/223/223_Full.c +++ b/decompile/General/223/223_Full.c @@ -100,21 +100,17 @@ void DECOMP_RR_EndEvent_DrawMenu(void) struct Instance *relic; char boolEarly; - short pos[2]; + SVec2 pos; u_int elapsedFrames; u_int bitIndex; u_int txtColor; RECT box; - int iVar2; - short sVar3; - short startY; - short endX; - short sVar6; - int startX; - int endY; - int uVar11; - char auStack72[16]; + //start.y is never assigned. + SVec2 start; + SVec2 end; + + char numCrates[16]; gGT = sdata->gGT; d = gGT->drivers[0]; @@ -198,26 +194,26 @@ void DECOMP_RR_EndEvent_DrawMenu(void) { elapsedFrames -= FPS_DOUBLE(490); - startX = 0x100; - endY = -0x32; + start.x = 0x100; + end.y = -0x32; } // 0 - 489 else { - startX = -0x96; - endY = 0x32; + start.x = -0x96; + end.y = 0x32; } // interpolate fly-in DECOMP_UI_Lerp2D_Linear( - &pos[0], - startX, 0x32, - 0x100, endY, + &pos.x, + start.x, 0x32, + 0x100, end.y, elapsedFrames, FPS_DOUBLE(0x14)); - DECOMP_UI_DrawRaceClock(pos[0], pos[1] - 8, 1, d); + DECOMP_UI_DrawRaceClock(pos.x, pos.y - 8, 1, d); } @@ -229,14 +225,14 @@ void DECOMP_RR_EndEvent_DrawMenu(void) if ((gGT->gameModeEnd & NEW_RELIC) != 0) { // default - pos[0] = 0x100; + pos.x = 0x100; if (elapsedFrames >= FPS_DOUBLE(490)) { elapsedFrames -= FPS_DOUBLE(490); DECOMP_UI_Lerp2D_Linear( - &pos[0], + &pos.x, 0x100, 0, -0x64, 0, elapsedFrames, FPS_DOUBLE(0x14)); @@ -261,7 +257,7 @@ void DECOMP_RR_EndEvent_DrawMenu(void) } } - relic->matrix.t.x = DECOMP_UI_ConvertX_2(pos[0], 0x100); + relic->matrix.t.x = DECOMP_UI_ConvertX_2(pos.x, 0x100); relic->matrix.t.y = DECOMP_UI_ConvertY_2(0xa2, 0x100); } @@ -276,7 +272,7 @@ void DECOMP_RR_EndEvent_DrawMenu(void) // interpolate fly-in DECOMP_UI_Lerp2D_Linear( - &pos[0], + &pos.x, 200, 0x79, 0x264, 0x79, elapsedFrames, FPS_DOUBLE(0x14)); @@ -284,22 +280,22 @@ void DECOMP_RR_EndEvent_DrawMenu(void) else { - pos[0] = 200; + pos.x = 200; } - pos[1] = 0x79; + pos.y = 0x79; - sdata->ptrTimebox1->matrix.t.x = DECOMP_UI_ConvertX_2(pos[0], 0x100); - sdata->ptrTimebox1->matrix.t.y = DECOMP_UI_ConvertY_2(pos[1], 0x100); + sdata->ptrTimebox1->matrix.t.x = DECOMP_UI_ConvertX_2(pos.x, 0x100); + sdata->ptrTimebox1->matrix.t.y = DECOMP_UI_ConvertY_2(pos.y, 0x100); // Draw 'x' before number of crates - DecalFont_DrawLine("x", pos[0] + 0x14, pos[1] - 10, 2, 0); + DecalFont_DrawLine("x", pos.x + 0x14, pos.y - 10, 2, 0); // %2.02d/%ld: Amount of crates you collected / Total number of crates - sprintf(auStack72, "%2.02d/%ld", d->numTimeCrates, gGT->timeCratesInLEV); + sprintf(numCrates, "%2.02d/%ld", d->numTimeCrates, gGT->timeCratesInLEV); // Draw amount of crates collected - DecalFont_DrawLine(auStack72, pos[0] + 0x21, pos[1] - 0xe, 1, 0); + DecalFont_DrawLine(numCrates, pos.x + 0x21, pos.y - 0xe, 1, 0); } @@ -319,15 +315,15 @@ void DECOMP_RR_EndEvent_DrawMenu(void) // 170 frames after the first 80 if (elapsedFrames >= FPS_DOUBLE(170)) { - startX = 0x100; - endX = 0x296; + start.x = 0x100; + end.x = 0x296; } // === fade-in PERFECT >=80 === else { - startX = -0x96; - endX = 0x100; + start.x = -0x96; + end.x = 0x100; // 0 frames after the first 80 if (elapsedFrames == 0) @@ -337,34 +333,39 @@ void DECOMP_RR_EndEvent_DrawMenu(void) } DECOMP_UI_Lerp2D_Linear( - &pos[0], - startX, 0, - endX, 0, + &pos.x, + start.x, 0, + end.x, 0, elapsedFrames, FPS_DOUBLE(0x14)); // "PERFECT" DecalFont_DrawLine( - sdata->lngStrings[0x162], pos[0], 0x8a, 1, txtColor); + sdata->lngStrings[0x162], pos.x, 0x8a, 1, txtColor); } // copy to local frame counter elapsedFrames = sdata->framesSinceRaceEnded; // fade-in COUNTDOWN (-10, -9, -8...) - if (elapsedFrames >= FPS_DOUBLE(140)) + //fix relic time count not vanishing + if + ( + elapsedFrames >= FPS_DOUBLE(140) && + sdata->framesSinceRaceEnded < FPS_DOUBLE(250) + ) { + + unsigned char timeCount = 10; + elapsedFrames -= FPS_DOUBLE(140); - // -10 - char* str = (char*)0x1f800000; - str[0] = '-'; - str[1] = '1'; - str[2] = '0'; - str[3] = 0; + + struct ScratchpadString* scpt = (struct ScratchpadString*)0x1f800000; + // interpolate fly-in DECOMP_UI_Lerp2D_Linear( - &pos[0], + &pos.x, 0x296, 0, 0x199, 0, elapsedFrames, FPS_DOUBLE(0x14)); @@ -372,6 +373,10 @@ void DECOMP_RR_EndEvent_DrawMenu(void) // 20 frames after fly-in starts, do the countdown if (elapsedFrames >= FPS_DOUBLE(20)) { + + + + elapsedFrames -= FPS_DOUBLE(20); // 10, 9, 8, 7... @@ -379,8 +384,13 @@ void DECOMP_RR_EndEvent_DrawMenu(void) int minusSeconds = elapsedFrames / FPS_DOUBLE(5); // -3, -2, -1, -0... (dont go past 0) - if (minusSeconds > 10) + //dont allow the counter to go back to -10 + if (minusSeconds >= 10) + { minusSeconds = 10; + timeCount = 0; + } + // "if != 0" means // "if text is not -10" @@ -395,13 +405,17 @@ void DECOMP_RR_EndEvent_DrawMenu(void) } // change string to match new -X - str[1] = '0' + (10-minusSeconds); - str[2] = 0; + timeCount = 10 - minusSeconds; + + } + } + + sprintf(scpt->str, "%s%d", "-", timeCount); // Draw String - DecalFont_DrawLine(str, pos[0], 0x2a, 1, txtColor); + DecalFont_DrawLine(scpt->str, pos.x, 0x2a, 1, txtColor); } } @@ -421,8 +435,8 @@ void DECOMP_RR_EndEvent_DrawMenu(void) { elapsedFrames -= FPS_DOUBLE(370); - startX = 0x100; - endX = 0x296; + start.x = 0x100; + end.x = 0x296; } // Fade-In @@ -430,20 +444,20 @@ void DECOMP_RR_EndEvent_DrawMenu(void) { elapsedFrames -= FPS_DOUBLE(250); - startX = -0x96; - endX = 0x100; + start.x = -0x96; + end.x = 0x100; } // interpolate fly-in DECOMP_UI_Lerp2D_Linear( - &pos[0], - startX, 0x50, - endX, 0x50, + &pos.x, + start.x, 0x50, + end.x, 0x50, elapsedFrames, FPS_DOUBLE(0x14)); // "RELIC AWARDED!" DecalFont_DrawLine( - sdata->lngStrings[0x160], pos[0], pos[1], 1, txtColor); + sdata->lngStrings[0x160], pos.x, pos.y, 1, txtColor); } @@ -464,26 +478,26 @@ void DECOMP_RR_EndEvent_DrawMenu(void) { elapsedFrames -= FPS_DOUBLE(120); - startX = 0x100; - endX = 0x296; + start.x = 0x100; + end.x = 0x296; } else { - startX = -0x96; - endX = 0x100; + start.x = -0x96; + end.x = 0x100; } // Interpolate fly-in DECOMP_UI_Lerp2D_Linear( - &pos[0], - startX, 0x50, - endX, 0x50, + &pos.x, + start.x, 0x50, + end.x, 0x50, elapsedFrames, FPS_DOUBLE(0x14)); // "NEW HIGH SCORE!" DecalFont_DrawLine( - sdata->lngStrings[0x161], pos[0], pos[1], 1, txtColor); + sdata->lngStrings[0x161], pos.x, pos.y, 1, txtColor); } @@ -492,7 +506,7 @@ void DECOMP_RR_EndEvent_DrawMenu(void) // copy to local frame counter elapsedFrames = sdata->framesSinceRaceEnded; - pos[1] = 0xc; + pos.y = 0xc; // if race ended more than 490 frames ago if (elapsedFrames >= FPS_DOUBLE(490)) @@ -501,7 +515,7 @@ void DECOMP_RR_EndEvent_DrawMenu(void) // Interpolate, vertical fly-out DECOMP_UI_Lerp2D_Linear( - &pos[0], + &pos.x, -0xa, 0xc, -0xa, -0x58, elapsedFrames, FPS_DOUBLE(0x14)); @@ -512,7 +526,7 @@ void DECOMP_RR_EndEvent_DrawMenu(void) // This is actually a RECT on the stack box.x = -0xa; - box.y = pos[1]; + box.y = pos.y; box.w = 0x214; box.h = 0x3b; @@ -558,7 +572,7 @@ void DECOMP_RR_EndEvent_DrawHighScore(short startX, int startY) char *timeString; short nameColor; u_int timeColor; - short pos[2]; + SVec2 pos; short timebox_X; short timebox_Y; u_short currRowY; @@ -576,13 +590,13 @@ void DECOMP_RR_EndEvent_DrawHighScore(short startX, int startY) // interpolate fly-in DECOMP_UI_Lerp2D_Linear( - &pos[0], + (short*)&pos, startX, startY, startX, startY, sdata->framesSinceRaceEnded, FPS_DOUBLE(0x14)); // "BEST TIMES" - DecalFont_DrawLine(sdata->lngStrings[0x171], pos[0], pos[1], 1, 0xffff8000); + DecalFont_DrawLine(sdata->lngStrings[0x171], pos.x, pos.y, 1, 0xffff8000); // Draw icon, name, and time of the // 5 best times in Time Trial @@ -667,8 +681,8 @@ void DECOMP_RR_EndEvent_DrawHighScore(short startX, int startY) // Print amount of time, for whichever purpose DecalFont_DrawLine(timeString, startX, startY + 0xa6, 2, timeColor); - box.x = pos[0] - 0x60; - box.y = pos[1] - 4; + box.x = pos.x - 0x60; + box.y = pos.y - 4; box.w = 0xc0; box.h = 0xb4; diff --git a/decompile/General/225/225_Full.c b/decompile/General/225/225_Full.c index 21024059a..de3b2cb27 100644 --- a/decompile/General/225/225_Full.c +++ b/decompile/General/225/225_Full.c @@ -27,6 +27,7 @@ void DECOMP_VB_EndEvent_DrawMenu(void) struct Instance *bigNum; struct PushBuffer* view; struct RectMenu *endMenu; + struct ScratchpadString* scpt; char numPlyr; short pos[2]; RECT box; @@ -65,6 +66,7 @@ void DECOMP_VB_EndEvent_DrawMenu(void) gGT = sdata->gGT; numPlyr = gGT->numPlyrCurrGame; VsConfigIndex = numPlyr-2; + scpt = (struct ScratchpadString*)0x1f800000; if (sdata->framesSinceRaceEnded < FPS_DOUBLE(0xf0)) { @@ -237,7 +239,7 @@ void DECOMP_VB_EndEvent_DrawMenu(void) sVar1 = uStack96 - 1; } iVar6 = sVar1; - if (0 < iVar6) + if (iVar6 > 0) { for (iVar10 = 0; iVar10 < iVar6; iVar10++) { @@ -264,15 +266,15 @@ void DECOMP_VB_EndEvent_DrawMenu(void) } iVar2 = iVar10 + 1; - + + // string for each player rank and count from standings (0x1e80) - sprintf((char*)0x1f800000, "%d%s-%2.02ld", iVar2, //todo: replace 0x1f800000 with reference to scratchpad + sprintf(scpt->str, "%d%s-%2.02ld", iVar2, sdata->lngStrings[0x19+iVar10], (gGT->standingsPoints[gGT->battleSetup.unk1dc8[iVar11] * 3 + iVar10])); // Draw string - //todo: replace 0x1f800000 with reference to scratchpad - DecalFont_DrawLine((char*)0x1f800000, (pos[0] + 0x79), ((uStack112 - (iVar6 * 4 + -0xd)) + iVar10 * 8), 2, uVar7); + DecalFont_DrawLine(scpt->str, (pos[0] + 0x79), ((uStack112 - (iVar6 * 4 + -0xd)) + iVar10 * 8), 2, uVar7); } } @@ -294,12 +296,11 @@ void DECOMP_VB_EndEvent_DrawMenu(void) iStack48 = iStack48 + FPS_DOUBLE(5); sStack80 = gGT->battleSetup.unk_afterTeams[gGT->battleSetup.unk1dc8[iVar11]]; - //todo: replace 0x1f800000 with reference to scratchpad - sprintf((char*)0x1f800000, "%d%s", sVar1 + 1, sdata->lngStrings[0x19+sVar1]); + + sprintf(scpt->str, "%d%s", sVar1 + 1, sdata->lngStrings[0x19+sVar1]); // Draw String - //todo: replace 0x1f800000 with reference to scratchpad - DecalFont_DrawLine((char*)0x1f800000, (pos[0] - 0x24), (uStack112 + 5), 1, 0xffff8000); + DecalFont_DrawLine(scpt->str, (pos[0] - 0x24), (uStack112 + 5), 1, 0xffff8000); } } diff --git a/decompile/General/230/230_50_MM_Characters_MenuProc.c b/decompile/General/230/230_50_MM_Characters_MenuProc.c index 0fff514a0..8458c4885 100644 --- a/decompile/General/230/230_50_MM_Characters_MenuProc.c +++ b/decompile/General/230/230_50_MM_Characters_MenuProc.c @@ -31,12 +31,16 @@ void DECOMP_MM_Characters_MenuProc(struct RectMenu* unused) Color color; u_char colorRGBA[4]; + + + #ifdef REBUILD_PC RECT r1; RECT* r = &r1; #else - RECT* r = (RECT*)0x1f800000; //todo: replace 0x1f800000 with reference to scratchpad + struct ScratchpadRect* scpr = (struct ScratchpadRect*)0x1f800000; + RECT* r = (RECT*)&scpr->rect; #endif RECT r58; diff --git a/decompile/General/232/232_21_AH_Map_HubItems.c b/decompile/General/232/232_21_AH_Map_HubItems.c index 4a6686a64..95744cea9 100644 --- a/decompile/General/232/232_21_AH_Map_HubItems.c +++ b/decompile/General/232/232_21_AH_Map_HubItems.c @@ -17,7 +17,7 @@ void DECOMP_AH_Map_HubItems(struct Map* hubPtrs, short *type) short boolKey; short itemMode; short typeCount; - Vec3 rawIconPos; + Vec3 boss_StarPos; //load/save instance on minimap Vec2 saveObjpos; @@ -229,9 +229,9 @@ void DECOMP_AH_Map_HubItems(struct Map* hubPtrs, short *type) if (itemMode > -1) { - rawIconPos.x = hubitem->pos.x; - rawIconPos.y = 0; - rawIconPos.z = hubitem->pos.y; + boss_StarPos.x = hubitem->pos.x; + boss_StarPos.y = 0; + boss_StarPos.z = hubitem->pos.y; // if beat boss race if (itemMode == 2) @@ -275,7 +275,7 @@ void DECOMP_AH_Map_HubItems(struct Map* hubPtrs, short *type) } // draw star icon for boss - DECOMP_UI_Map_DrawRawIcon(hubPtrs, &rawIconPos, 0x37, itemColorID, 0, 0x1000); + DECOMP_UI_Map_DrawRawIcon(hubPtrs, &boss_StarPos, 0x37, itemColorID, 0, 0x1000); } *type = typeCount; diff --git a/decompile/General/PushBuffer/PushBuffer_06_UpdateFrustum.c b/decompile/General/PushBuffer/PushBuffer_06_UpdateFrustum.c index b862c060e..6b05cd21d 100644 --- a/decompile/General/PushBuffer/PushBuffer_06_UpdateFrustum.c +++ b/decompile/General/PushBuffer/PushBuffer_06_UpdateFrustum.c @@ -30,7 +30,7 @@ void DECOMP_PushBuffer_UpdateFrustum(struct PushBuffer* pb) int max_Y; int max_Z; - struct ScratchpadFrustum* spf = 0x1f800000; + struct ScratchpadFrustum* spf = (struct ScratchpadFrustum*)0x1f800000; #if 0 // TRAP checks removed @@ -120,14 +120,14 @@ void DECOMP_PushBuffer_UpdateFrustum(struct PushBuffer* pb) iVar19 = 0x1000; - fcOUT->pos[0] = (short)tx + cameraPosX; - fcOUT->pos[1] = (short)ty + cameraPosY; - fcOUT->pos[2] = (short)tz + cameraPosZ; + fcOUT->pos.x = (short)tx + cameraPosX; + fcOUT->pos.y = (short)ty + cameraPosY; + fcOUT->pos.z = (short)tz + cameraPosZ; // far clip: pos + dir*100 - spf->pos[0] = posX; - spf->pos[1] = posY; - spf->pos[2] = posZ; + spf->pos.x = posX; + spf->pos.y = posY; + spf->pos.z = posZ; // === X Axis === if (((cameraPosX < -0x8000) && (-0x8000 < posX)) || ((-0x8000 < cameraPosX && (posX < -0x8000)))) { @@ -136,9 +136,9 @@ void DECOMP_PushBuffer_UpdateFrustum(struct PushBuffer* pb) tz = ty / tx; if (tz < 0x1000) { - spf->pos[0] = -0x8000; - spf->pos[1] = cameraPosY + (tz * (posY - cameraPosY) >> 0xc); - spf->pos[2] = cameraPosZ + (tz * (posZ - cameraPosZ) >> 0xc); + spf->pos.x = -0x8000; + spf->pos.y = cameraPosY + (tz * (posY - cameraPosY) >> 0xc); + spf->pos.z = cameraPosZ + (tz * (posZ - cameraPosZ) >> 0xc); iVar19 = tz; } } @@ -150,9 +150,9 @@ void DECOMP_PushBuffer_UpdateFrustum(struct PushBuffer* pb) tz = ty / tx; if (tz < iVar19) { - spf->pos[1] = -0x8000; - spf->pos[0] = cameraPosX + (tz * (posX - cameraPosX) >> 0xc); - spf->pos[2] = cameraPosZ + (tz * (posZ - cameraPosZ) >> 0xc); + spf->pos.y = -0x8000; + spf->pos.x = cameraPosX + (tz * (posX - cameraPosX) >> 0xc); + spf->pos.z = cameraPosZ + (tz * (posZ - cameraPosZ) >> 0xc); iVar19 = tz; } } @@ -164,9 +164,9 @@ void DECOMP_PushBuffer_UpdateFrustum(struct PushBuffer* pb) tz = ty / tx; if (tz < iVar19) { - spf->pos[2] = -0x8000; - spf->pos[0] = cameraPosX + (tz * (posX - cameraPosX) >> 0xc); - spf->pos[1] = cameraPosY + (tz * (posY - cameraPosY) >> 0xc); + spf->pos.z = -0x8000; + spf->pos.x = cameraPosX + (tz * (posX - cameraPosX) >> 0xc); + spf->pos.y = cameraPosY + (tz * (posY - cameraPosY) >> 0xc); iVar19 = tz; } } @@ -178,9 +178,9 @@ void DECOMP_PushBuffer_UpdateFrustum(struct PushBuffer* pb) tz = ty / tx; if (tz < iVar19) { - spf->pos[0] = 0x7fff; - spf->pos[1] = cameraPosY + (tz * (posY - cameraPosY) >> 0xc); - spf->pos[2] = cameraPosZ + (tz * (posZ - cameraPosZ) >> 0xc); + spf->pos.x = 0x7fff; + spf->pos.y = cameraPosY + (tz * (posY - cameraPosY) >> 0xc); + spf->pos.z = cameraPosZ + (tz * (posZ - cameraPosZ) >> 0xc); iVar19 = tz; } } @@ -192,9 +192,9 @@ void DECOMP_PushBuffer_UpdateFrustum(struct PushBuffer* pb) tz = ty / tx; if (tz < iVar19) { - spf->pos[1] = 0x7fff; - spf->pos[0] = cameraPosX + (tz * (posX - cameraPosX) >> 0xc); - spf->pos[2] = cameraPosZ + (tz * (posZ - cameraPosZ) >> 0xc); + spf->pos.y = 0x7fff; + spf->pos.x = cameraPosX + (tz * (posX - cameraPosX) >> 0xc); + spf->pos.z = cameraPosZ + (tz * (posZ - cameraPosZ) >> 0xc); iVar19 = tz; } } @@ -206,21 +206,21 @@ void DECOMP_PushBuffer_UpdateFrustum(struct PushBuffer* pb) ty = tx / posZ; if (ty < iVar19) { - spf->pos[2] = 0x7fff; - spf->pos[0] = cameraPosX + (ty * (posX - cameraPosX) >> 0xc); - spf->pos[1] = cameraPosY + (ty * (posY - cameraPosY) >> 0xc); + spf->pos.z = 0x7fff; + spf->pos.x = cameraPosX + (ty * (posX - cameraPosX) >> 0xc); + spf->pos.y = cameraPosY + (ty * (posY - cameraPosY) >> 0xc); } } // === Set 6 Min/Max X,Y,Z variables === - if (min_X > spf->pos[0]) min_X = spf->pos[0]; - if (min_Y > spf->pos[1]) min_Y = spf->pos[1]; - if (min_Z > spf->pos[2]) min_Z = spf->pos[2]; + if (min_X > spf->pos.x) min_X = spf->pos.x; + if (min_Y > spf->pos.y) min_Y = spf->pos.y; + if (min_Z > spf->pos.z) min_Z = spf->pos.z; - if (max_X < spf->pos[0]) max_X = spf->pos[0]; - if (max_Y < spf->pos[1]) max_Y = spf->pos[1]; - if (max_Z < spf->pos[2]) max_Z = spf->pos[2]; + if (max_X < spf->pos.x) max_X = spf->pos.x; + if (max_Y < spf->pos.y) max_Y = spf->pos.y; + if (max_Z < spf->pos.z) max_Z = spf->pos.z; // next corner to write fcOUT--; @@ -235,21 +235,21 @@ void DECOMP_PushBuffer_UpdateFrustum(struct PushBuffer* pb) pb->bbox.max[2] = (short)max_Z; // cameraPos (x,y,z) - spf->camPos[0] = cameraPosX; - spf->camPos[1] = cameraPosY; - spf->camPos[2] = cameraPosZ; + spf->camPos.x = cameraPosX; + spf->camPos.y = cameraPosY; + spf->camPos.z = cameraPosZ; // PushBuffer_SetFrustumPlane (x4) - val_Y = PushBuffer_SetFrustumPlane(&pb->frustumData[0],&spf->fc[0],&spf->camPos[0],&spf->fc[1]); + val_Y = PushBuffer_SetFrustumPlane(&pb->frustumData[0],&spf->fc[0],&spf->camPos.x,&spf->fc[1]); pb->RenderListJmpIndex[0] = ~val_Y & 7; - val_Y = PushBuffer_SetFrustumPlane(&pb->frustumData[0x8],&spf->fc[1],&spf->camPos[0],&spf->fc[3]); + val_Y = PushBuffer_SetFrustumPlane(&pb->frustumData[0x8],&spf->fc[1],&spf->camPos.x,&spf->fc[3]); pb->RenderListJmpIndex[1] = ~val_Y & 7; - val_Y = PushBuffer_SetFrustumPlane(&pb->frustumData[0x10],&spf->fc[3],&spf->camPos[0],&spf->fc[2]); + val_Y = PushBuffer_SetFrustumPlane(&pb->frustumData[0x10],&spf->fc[3],&spf->camPos.x,&spf->fc[2]); pb->RenderListJmpIndex[2] = ~val_Y & 7; - val_Y = PushBuffer_SetFrustumPlane(&pb->frustumData[0x18],&spf->fc[2],&spf->camPos[0],&spf->fc[0]); + val_Y = PushBuffer_SetFrustumPlane(&pb->frustumData[0x18],&spf->fc[2],&spf->camPos.x,&spf->fc[0]); pb->RenderListJmpIndex[3] = ~val_Y & 7; gte_ldVXY0(0); diff --git a/decompile/General/gte.c b/decompile/General/gte.c index f125f305e..7fe8f0f2e 100644 --- a/decompile/General/gte.c +++ b/decompile/General/gte.c @@ -1,15 +1,16 @@ -#include +#include void RotateVector(SVec3 * out, const SVec3 * in) { #ifndef REBUILD_PC + struct ScratchpadFrustum* scpf = (struct ScratchpadFrustum*)0x1f800000; gte_ldv0(in); gte_rtv0(); - gte_stlvnl(0x1f800000); + gte_stlvnl(scpf); - out->x = *(short*)0x1f800000; - out->y = *(short*)0x1f800004; - out->z = *(short*)0x1f800008; + out->x = scpf->pos.x; + out->y = scpf->pos.y; + out->z = scpf->pos.z; #endif } diff --git a/include/common.h b/include/common.h index 35188dfc1..2e7a043e1 100644 --- a/include/common.h +++ b/include/common.h @@ -143,8 +143,8 @@ enum HotReloadSteps // Not PC #ifndef REBUILD_PC -#include -#include +#include +#include #endif diff --git a/include/ctr_math.h b/include/ctr_math.h index 3571d5b1a..29ea745f3 100644 --- a/include/ctr_math.h +++ b/include/ctr_math.h @@ -76,7 +76,6 @@ typedef struct Matrix { Vec3 t; } Matrix; -typedef Matrix MATRIX; //fix psn00b duplicate // trigonometry // diff --git a/include/namespace_Decal.h b/include/namespace_Decal.h index a288cf255..5fa0f5912 100644 --- a/include/namespace_Decal.h +++ b/include/namespace_Decal.h @@ -167,6 +167,13 @@ struct IconGroup // 0x14 //struct Icon* icons[0]; }; + +//0x1f800000 +struct ScratchpadString +{ + char str[20]; +}; + #define ICONGROUP_GETICONS(x) (struct Icon **)((unsigned int)x + sizeof(struct IconGroup)) _Static_assert(sizeof(struct TextureLayout) == 0xC); diff --git a/include/namespace_PushBuffer.h b/include/namespace_PushBuffer.h index 58f721686..5eb0db87c 100644 --- a/include/namespace_PushBuffer.h +++ b/include/namespace_PushBuffer.h @@ -1,18 +1,19 @@ struct FrustumCornerOUT { - short pos[3]; + SVec3 pos; }; -struct ScratchpadFrustum + +struct ScratchpadFrustum { // 1f800000 - int pos[3]; + Vec3 pos; // 1f80000C struct FrustumCornerOUT fc[4]; // 1f800024 - short camPos[3]; + SVec3 camPos; // 1f80002A // -- end -- diff --git a/include/namespace_RectMenu.h b/include/namespace_RectMenu.h index a92d2aa45..e539265ee 100644 --- a/include/namespace_RectMenu.h +++ b/include/namespace_RectMenu.h @@ -151,6 +151,12 @@ struct RectMenu #endif }; +//0x1f800000 +struct ScratchpadRect +{ + RECT rect; +}; + _Static_assert(sizeof(struct MenuRow) == 6); #if BUILD != SepReview _Static_assert(sizeof(struct RectMenu) == 0x2C); diff --git a/include/namespace_gte.h b/include/namespace_gte.h new file mode 100644 index 000000000..345abd310 --- /dev/null +++ b/include/namespace_gte.h @@ -0,0 +1,257 @@ +#ifndef CTR_GTE_H +#define CTR_GTE_H + +// where is this included //its on common.h -penta3 +// that's not ifndef guarded? +#ifndef REBUILD_PC + +#include +#include + +#ifdef INTELLISENSE_HINT +#include +#else +#include + +#endif + +#define ONE (1 << 12) + +void RotateVector(SVec3 * out, const SVec3 * in); +void MulMatrixVec(Vec3 * out, const Matrix * m, const SVec3 * in); + + +typedef Matrix MATRIX; //check ctr_math.h + +//all of these copied from psn00b/psxgte.h +typedef struct _VECTOR { + int32_t vx, vy, vz; +} VECTOR; + +typedef struct _SVECTOR { + int16_t vx, vy, vz, pad; +} SVECTOR; + +typedef struct _CVECTOR { + uint8_t r, g, b, cd; +} CVECTOR; + +typedef struct _DVECTOR { + int16_t vx, vy; +} DVECTOR; + +#define csin(a) isin(a) +#define ccos(a) icos(a) +#define rsin(a) isin(a) +#define rcos(a) icos(a) + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @brief Gets sine of angle (fixed-point) + * + * @details Returns the sine of angle a. + * + * @param a Angle in fixed-point format (131072 = 360 degrees) + * @return Sine value in 20.12 fixed-point format (4096 = 1.0). + */ +int isin(int a); + +/** + * @brief Gets cosine of angle (fixed-point) + * + * @details Returns the cosine of angle a. + * + * @param a Angle in fixed-point format (131072 = 360 degrees) + * @return Cosine value in 20.12 fixed-point format (4096 = 1.0). + */ +int icos(int a); + +/** + * @brief Gets sine of angle (fixed-point, high precision version) + * + * @details Returns the sine of angle a. + * + * @param a Angle in fixed-point format (4194304 = 360 degrees) + * @return Sine value in 20.12 fixed-point format (4096 = 1.0). + */ +int hisin(int a); + +/** + * @brief Gets cosine of angle (fixed-point, high precision version) + * + * @details Returns the cosine of angle a. + * + * @param a Angle in fixed-point format (4194304 = 360 degrees) + * @return Cosine value in 20.12 fixed-point format (4096 = 1.0). + */ +int hicos(int a); + +/** + * @brief Initializes the GTE + * + * @details Resets, enables and initializes the GTE. Must be called prior to + * using any GTE function or macro. + */ +void InitGeom(void); + +/** + * @brief Gets square root (fixed-point) + * + * @details Returns the square root of value v. + * + * @param v Value in 20.12 fixed-point format (4096 = 1.0) + * @return Square root in 20.12 fixed-point format (4096 = 1.0). + */ +int SquareRoot12(int v); + +/** + * @brief Gets square root (integer) + * + * @details Returns the square root of value v. + * + * @param v Value in integer format + * @return Square root in integer format. + */ +int SquareRoot0(int v); + +/** + * @brief Pushes the current GTE matrix to the matrix stack + * + * @details Pushes the current GTE rotation matrix and translation vector to + * the internal matrix stack. Only one matrix stack level is currently + * supported. + */ +void PushMatrix(void); + +/** + * @brief Pops the last matrix pushed into the matrix stack back to the GTE + * + * @details Pops the last inserted matrix in the internal matrix stack back to + * the GTE. Only one matrix stack level is currently supported. + */ +void PopMatrix(void); + +/** + * @brief Defines the rotation matrix of a MATRIX + * + * @details Defines the rotation matrix of m from rotation coordinates of r. + * The matrix is computed as follows: + * + * [ 1 0 0 ] [ cy 0 sy] [ cz -sz 0 ] + * [ 0 cx -sx] * [ 0 1 0 ] * [ sz cz 0 ] + * [ 0 sx cx] [-sy 0 cy] [ 0 0 1 ] + * + * where: + * + * sx = sin(r.x) sy = sin(r.y) sz = sin(r.z) + * cx = cos(r.x) cy = cos(r.y) cz = cos(r.z) + * + * @param r Rotation vector (input) + * @param m Matrix (output) + * @return Pointer to m. + * + * @see TransMatrix(), CompMatrixLV() + */ +MATRIX *RotMatrix(SVECTOR *r, MATRIX *m); + +/** + * @brief Defines the rotation matrix of a MATRIX (high precision version) + * + * @details Defines the rotation matrix of m from rotation coordinates of r. + * This function is a variant of RotMatrix() that uses hisin()/hicos() instead + * of isin()/icos(). + * + * See RotMatrix() for more details. + * + * @param r Rotation vector (input) + * @param m Matrix (output) + * @return Pointer to m. + * + * @see RotMatrix() + */ +MATRIX *HiRotMatrix(VECTOR *r, MATRIX *m); + +/** + * @brief Defines the translation vector of a MATRIX + * + * @details Simply sets the translation vector of MATRIX m. To perform + * accumulative translation operations, see CompMatrixLV(). + * + * @param m Matrix (output) + * @param r Translation vector (input) + * @return Pointer to m. + * + * @see RotMatrix(), CompMatrixLV() + */ +MATRIX *TransMatrix(MATRIX *m, VECTOR *r); + +MATRIX *ScaleMatrix(MATRIX *m, VECTOR *s); +MATRIX *ScaleMatrixL(MATRIX *m, VECTOR *s); + +MATRIX *MulMatrix(MATRIX *m0, MATRIX *m1); +MATRIX *MulMatrix0(MATRIX *m0, MATRIX *m1, MATRIX *m2); + +/** + * @brief Composite coordinate matrix transform + * + * @details Performs vector multiply by matrix with vector addition from v0 to + * the translation vector of v1. Then, multiples the rotation matrix of v0 by + * the rotation matrix of v1. The result of both operations is then stored in + * v2. Replaces the current GTE rotation matrix and translation vector with v0. + * + * Often used to adjust the matrix (includes rotation and translation) of an + * object relative to a world matrix, so the object would render relative to + * the world matrix. + * + * @param v0 Input matrix A + * @param v1 Input matrix B + * @param v2 Output matrix + * @return Pointer to v2. + */ +MATRIX *CompMatrixLV(MATRIX *v0, MATRIX *v1, MATRIX *v2); + +/** + * @brief Multiplies a vector by a matrix + * + * @details Multiplies vector v0 with matrix m, result is stored to v1. + * Replaces the current GTE rotation matrix and translation vector with m. + * + * Often used to calculate a translation vector in relation to the rotation + * matrix for first person or vector camera perspectives. + * + * @param m Input matrix + * @param v0 Input vector + * @param v1 Output vector + * @return Pointer to v1. + */ +VECTOR *ApplyMatrixLV(MATRIX *m, VECTOR *v0, VECTOR *v1); + +/** + * @brief Normalizes a VECTOR into SVECTOR format + * + * Normalizes a 32-bit vector into a 16-bit vector in 4.12 fixed-point format + * (4096 = 1.0, 2048 = 0.5). + * + * @param v0 Input (raw) 32-bit vector + * @param v1 Output (normalized) 16-bit vector + */ +void VectorNormalS(VECTOR *v0, SVECTOR *v1); + +/** + * @brief Calculates the square of a VECTOR + * + * @details Calculates the square of vector v0 and stores the result to v1. + * + * @param v0 Input vector + * @param v1 Output vector + */ +void Square0(VECTOR *v0, VECTOR *v1); + + +#endif + +#endif \ No newline at end of file diff --git a/include/psn00b_Headers.h b/include/psn00b_Headers.h new file mode 100644 index 000000000..466b89008 --- /dev/null +++ b/include/psn00b_Headers.h @@ -0,0 +1,14 @@ +#include +#include +#include +//#include //check namespace_gte.h instead +#include +#include +#include +#include +#include +#include +#include +#include +#include + diff --git a/include/psn00bsdk/include/psxgte.h b/include/psn00bsdk/include/psxgte.h index 485254a59..2d68e8179 100644 --- a/include/psn00bsdk/include/psxgte.h +++ b/include/psn00bsdk/include/psxgte.h @@ -23,18 +23,16 @@ #endif -#include "ctr_math.h" #define ONE (1 << 12) /* Structure definitions */ -//decomp already have a matrix declaration -/* + typedef struct _MATRIX { int16_t m[3][3]; int32_t t[3]; } MATRIX; -*/ + From 5737db3c1f9184eb51c59991e3738c84f631a8c4 Mon Sep 17 00:00:00 2001 From: penta3 Date: Tue, 7 Oct 2025 08:00:08 -0300 Subject: [PATCH 7/7] update file names --- include/ctr_gte.h | 16 ---------------- include/gccHeaders.h | 14 -------------- 2 files changed, 30 deletions(-) delete mode 100644 include/ctr_gte.h delete mode 100644 include/gccHeaders.h diff --git a/include/ctr_gte.h b/include/ctr_gte.h deleted file mode 100644 index a5c95c150..000000000 --- a/include/ctr_gte.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef CTR_GTE_H -#define CTR_GTE_H - -// where is this included -// that's not ifndef guarded? -#ifndef REBUILD_PC - -#include -#include - -void RotateVector(SVec3 * out, const SVec3 * in); -void MulMatrixVec(Vec3 * out, const Matrix * m, const SVec3 * in); - -#endif - -#endif \ No newline at end of file diff --git a/include/gccHeaders.h b/include/gccHeaders.h deleted file mode 100644 index ea49c7935..000000000 --- a/include/gccHeaders.h +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -