From 2b4a76bbbddffabbb9e3eface9909fa145f9bdee Mon Sep 17 00:00:00 2001 From: mateusfavarin Date: Fri, 28 Jun 2024 22:30:11 -0300 Subject: [PATCH] fix saffi, changereserve counter to second counter --- decompile/General/AltMods/Mods2.c | 26 ++- decompile/General/Vehicle/VehFire_Increment.c | 102 ++++---- .../Vehicle/VehPhysProc_Driving_PhysLinear.c | 219 ++++++++++-------- include/common.h | 2 +- include/namespace_Vehicle.h | 6 +- 5 files changed, 194 insertions(+), 161 deletions(-) diff --git a/decompile/General/AltMods/Mods2.c b/decompile/General/AltMods/Mods2.c index f2e6c6c9..11c9e03e 100644 --- a/decompile/General/AltMods/Mods2.c +++ b/decompile/General/AltMods/Mods2.c @@ -18,9 +18,10 @@ void DrawBoostBar(short posX, short posY, struct Driver* driver) short fullHeight = 3; #ifdef USE_ONLINE short fullWidth = WIDE_34(96); - int numBarsFilled = driver->reserves / SECONDS(1); - int numFullBarsFilled = driver->reserves / SECONDS(5); - int reserveLength = driver->reserves % SECONDS(5); + int reserves = driver->reserves + driver->uncappedReserves; + int numFullBarsFilled = reserves / SECONDS(5); + int numBarsFilled = reserves / SECONDS(1); + int reserveLength = reserves % SECONDS(5); int meterLength = (fullWidth * reserveLength) / SECONDS(5); posX += 35; #else @@ -66,19 +67,22 @@ void DrawBoostBar(short posX, short posY, struct Driver* driver) const PrimCode primCode = { .poly = { .quad = 1, .renderCode = RenderCode_Polygon } }; #ifdef USE_ONLINE - char barNumberStr[2]; - int strLen = 2; - if (numFullBarsFilled < 10) + char barNumberStr[3]; + barNumberStr[0] = (numBarsFilled / 100) + '0'; + barNumberStr[1] = (numBarsFilled / 10) + '0'; + barNumberStr[2] = (numBarsFilled % 10) + '0'; + if (numBarsFilled < 10) { - barNumberStr[0] = (numFullBarsFilled % 10) + '0'; - strLen--; + DECOMP_DecalFont_DrawLineStrlen(&barNumberStr[2], 1, topX - 2, topY - 3, FONT_SMALL, PENTA_WHITE | JUSTIFY_RIGHT); + } + else if (numBarsFilled < 100) + { + DECOMP_DecalFont_DrawLineStrlen(&barNumberStr[1], 2, topX - 2, topY - 3, FONT_SMALL, PENTA_WHITE | JUSTIFY_RIGHT); } else { - barNumberStr[0] = (numFullBarsFilled / 10) + '0'; - barNumberStr[1] = (numFullBarsFilled % 10) + '0'; + DECOMP_DecalFont_DrawLineStrlen(barNumberStr, 3, topX - 2, topY - 3, FONT_SMALL, PENTA_WHITE | JUSTIFY_RIGHT); } - DECOMP_DecalFont_DrawLineStrlen(barNumberStr, strLen, topX - 2, topY - 3, FONT_SMALL, PENTA_WHITE | JUSTIFY_RIGHT); ColorCode colorCode; ColorCode bgBarColor = barEmptyColor; diff --git a/decompile/General/Vehicle/VehFire_Increment.c b/decompile/General/Vehicle/VehFire_Increment.c index 564b2749..f5a78841 100644 --- a/decompile/General/Vehicle/VehFire_Increment.c +++ b/decompile/General/Vehicle/VehFire_Increment.c @@ -8,24 +8,24 @@ void DECOMP_VehFire_Increment(struct Driver* driver, int reserves, u_int type, i { char kartState; u_char count; - + int newFireSpeedCap; int newFireSize; int oldOTT; - + u_int addFlags; struct Turbo* turboObj; struct Thread* turboThread; struct Instance* turboInst1; struct Instance* turboInst2; - - struct GameTracker* gGT = sdata->gGT; + struct GameTracker* gGT = sdata->gGT; + printf("reserves: %d %X\n", reserves, &driver->reserves); if ( // if this is a turbo pad ((type & 4) != 0) && - + // racer is in accel prevention (holding square) ((driver->actionsFlagSet & 8) != 0) ) @@ -64,7 +64,7 @@ void DECOMP_VehFire_Increment(struct Driver* driver, int reserves, u_int type, i // check all turbo threads while(turboThread != 0) - { + { // if this turbo thread is owned by this driver if (((struct Turbo*)turboThread->object)->driver == driver) { @@ -75,7 +75,7 @@ void DECOMP_VehFire_Increment(struct Driver* driver, int reserves, u_int type, i // next turbo thread in bucket turboThread = turboThread->siblingThread; } - + // if no turbo exists, create one if(turboThread == 0) { @@ -104,64 +104,64 @@ void DECOMP_VehFire_Increment(struct Driver* driver, int reserves, u_int type, i } #endif - + #ifndef REBUILD_PS1 turboInst1 = INSTANCE_BirthWithThread( - 0x2c, 0, SMALL, TURBO, + 0x2c, 0, SMALL, TURBO, DECOMP_VehTurbo_ThTick, sizeof(struct Turbo), 0 ); - + turboObj = 0; - + if (turboInst1 != 0) { // get thread, ignore all collisions turboThread = turboInst1->thread; turboThread->flags |= 0x1000; turboThread->funcThDestroy = DECOMP_VehTurbo_ThDestroy; - + // turbo #2 turboInst2 = INSTANCE_Birth3D( gGT->modelPtr[0x2C], // model &sdata->s_turbo2[0], // name turboThread // parent thread ); - + // get object, set essentials turboObj = turboThread->object; turboObj->inst = turboInst2; turboObj->driver = driver; turboObj->fireAnimIndex = 0; turboObj->fireVisibilityCooldown = 0x60; - + // make flame disappear after // - powerslide: two frames (quick death) // - all others: -1 frames (255 = 'no' death) if (type & 2) count = FPS_DOUBLE(2); else count = -1; turboObj->fireDisappearCountdown = count; - + // if modelIndex == "player" of any kind if (driver->instSelf->thread->modelIndex == 0x18) { turboObj->fireAudioDistort = 0; - + if(driver->kartState != KS_CRASHING) { DECOMP_VehFire_Audio(driver, fireLevel); } } - + // 2P 3P 4P flags addFlags = 0; - + // 1P flags if (gGT->numPlyrCurrGame == 1) { addFlags = 0x2000000; } - + // make turbos invisible, and transparent. // why does numPlyrCurrGame alter pause-menu invisible toggle? turboInst1->flags = turboInst1->flags | addFlags | 0x1040080; @@ -178,37 +178,37 @@ void DECOMP_VehFire_Increment(struct Driver* driver, int reserves, u_int type, i { // get the turbo's object turboObj = turboThread->object; - + // get the turbo's instances turboInst1 = turboThread->inst; turboInst2 = turboObj->inst; - + // remove "dead thread" flag turboThread->flags &= 0xfffff7ff; - + // turbo pad if ((type & 4) != 0) { // only increase counter on the first frame of turbo pad - + if ((driver->actionsFlagSetPrevFrame & 0x200000) == 0) { driver->numTurbos++; - + #if BUILD == JpnRetail // the japanese version of the game keeps track of your highest turbo chain in a race if (driver->numTurbosHighScore < driver->numTurbos && (gGT->gameMode1 & END_OF_RACE) == 0) driver->numTurbosHighScore = driver->numTurbos; #endif } } - + // all other boosts else { // make fire invisible for the sake of the visibility cooldown as explained in common.h turboInst1->flags |= 0x1000080; turboInst2->flags |= 0x1000080; - + turboObj->fireVisibilityCooldown = 0x60; driver->numTurbos++; #if BUILD == JpnRetail @@ -216,22 +216,22 @@ void DECOMP_VehFire_Increment(struct Driver* driver, int reserves, u_int type, i if (driver->numTurbosHighScore < driver->numTurbos && (gGT->gameMode1 & END_OF_RACE) == 0) driver->numTurbosHighScore = driver->numTurbos; #endif } - + turboObj->fireDisappearCountdown = -1; turboInst1->alphaScale = 0; turboInst2->alphaScale = 0; - + // driver -> instance -> thread -> modelIndex == "player" of any kind if(*(short *)&driver->instSelf->thread->modelIndex == 0x18) { if ( - // if racer is not getting an Outside turbo (turbo pad or powerup), - // this prevents audio-spam from multiple boosts + // if racer is not getting an Outside turbo (turbo pad or powerup), + // this prevents audio-spam from multiple boosts ((driver->actionsFlagSet & 0x200000) == 0) || ((driver->actionsFlagSetPrevFrame & 0x200000) == 0) ) - + { turboObj->fireAudioDistort = 0; DECOMP_VehFire_Audio(driver, fireLevel); @@ -239,23 +239,23 @@ void DECOMP_VehFire_Increment(struct Driver* driver, int reserves, u_int type, i } } - newFireSpeedCap = - + newFireSpeedCap = + (int)driver->const_SingleTurboSpeed + - + // fireLevel * 8 ( - fireLevel * - + fireLevel * + #if 1 - + 8 - + #else - + // this can all be simplified to: 8 ((int)driver->const_SacredFireSpeed - (int)driver->const_SingleTurboSpeed) >> 8 - + #endif ); @@ -283,7 +283,7 @@ void DECOMP_VehFire_Increment(struct Driver* driver, int reserves, u_int type, i ((driver->stepFlagSet & 2) == 0) ) ) - + { driver->fireSpeedCap = (short)newFireSpeedCap; @@ -317,22 +317,32 @@ void DECOMP_VehFire_Increment(struct Driver* driver, int reserves, u_int type, i else if (!(type & 1)) { // increase reserves BY param2 + #ifdef USE_ONLINE + if (driver->reserves > 30000) { driver->uncappedReserves += reserves; } + else { driver->reserves += reserves; } + #else driver->reserves += reserves; + #endif } - + // turbo pad, boost powerup else { // this adds reserves on the first frame you touch the turbo pad, - // then prevent reserves from decreasing until the first frame + // then prevent reserves from decreasing until the first frame // you leave the turbo pad - + oldOTT = driver->turbo_outsideTimer; - + if (oldOTT < reserves) { - driver->turbo_outsideTimer += (reserves - oldOTT); + #ifdef USE_ONLINE + if (driver->reserves > 30000) { driver->uncappedReserves += (reserves - oldOTT); } + else { driver->reserves += (reserves - oldOTT); } + #else driver->reserves += (reserves - oldOTT); + #endif + driver->turbo_outsideTimer += (reserves - oldOTT); } } diff --git a/decompile/General/Vehicle/VehPhysProc_Driving_PhysLinear.c b/decompile/General/Vehicle/VehPhysProc_Driving_PhysLinear.c index d1fc1126..3312fbf0 100644 --- a/decompile/General/Vehicle/VehPhysProc_Driving_PhysLinear.c +++ b/decompile/General/Vehicle/VehPhysProc_Driving_PhysLinear.c @@ -10,7 +10,7 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver* { struct GameTracker* gGT; int gameMode2; - + char kartState; char heldItemID; short noItemTimer; @@ -84,17 +84,32 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver* for(i = 0; i < 14; i++) { short* val = (short*)((int)driver + (int)PhysLinear_DriverOffsets[i]); + #ifdef USE_ONLINE + if (i == 0) + { + if (driver->reserves == 0) { driver->uncappedReserves = 0; } + + if (driver->uncappedReserves > 0) { driver->uncappedReserves = max(driver->uncappedReserves - msPerFrame, 0); } + else if (driver->reserves > 0) { driver->reserves = max(driver->reserves - msPerFrame, 0); } + } + else if (*val > 0) + { + *val -= msPerFrame; + if(*val < 0) *val = 0; + } + #else if(*val > 0) { *val -= msPerFrame; if(*val < 0) *val = 0; } + #endif } - + if(driver->reserves > 0) driver->timeSpentUsingReserves += msPerFrame; if(driver->set_0xF0_OnWallRub > 0) driver->timeSpentAgainstWall += msPerFrame; if(driver->burnTimer > 0) driver->timeSpentBurnt += msPerFrame; - if(driver->squishTimer > 0) driver->timeSpentSquished += msPerFrame; + if(driver->squishTimer > 0) driver->timeSpentSquished += msPerFrame; // If Super Engine Cheat is not enabled if (!(gameMode2 & CHEAT_ENGINE)) @@ -111,11 +126,11 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver* (driver->invisibleTimer != 0) && ((gameMode2 & CHEAT_INVISIBLE) == 0) ) - { + { driver->invisibleTimer -= msPerFrame; - + // if newly visible - if(driver->invisibleTimer <= 0) + if(driver->invisibleTimer <= 0) { driver->invisibleTimer = 0; driver->instSelf->flags = driver->instFlagsBackup; @@ -178,13 +193,13 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver* // === Determine Hazard === - + driverRankItemValue = 4; // if you have a raincloud over your head from potion - if (driver->thCloud != 0) - driverRankItemValue = + if (driver->thCloud != 0) + driverRankItemValue = ((struct RainCloud*)driver->thCloud->object)->boolScrollItem; // get approximate speed @@ -317,10 +332,10 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver* } driver->hazardTimer = driverTimerNegativeFinal; } - - + + // === Item Roll === - + // if Held Item = None (rolling) if (driver->heldItemID == 0x10) @@ -358,7 +373,7 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver* // === Item Used By Player === - + // Make Item fade away from icon if (driver->noItemTimer > 0) driver->noItemTimer--; @@ -382,52 +397,52 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver* // take away weapon *(u_char*)&driver->heldItemID = 0xf; } - - + + // === Normal Vector === - - + + // action flags driver->actionsFlagSetPrevFrame = actionsFlagSetCopy; - + // backup rotation *(u_int*)&driver->rotPrev.x = *(u_int*)&driver->rotCurr.x; driver->rotPrev.z = driver->rotCurr.z; - + // backup position driver->posPrev[0] = driver->posCurr[0]; driver->posPrev[1] = driver->posCurr[1]; driver->posPrev[2] = driver->posCurr[2]; - + // unknown driver->jumpHeightPrev = driver->jumpHeightCurr; driver->turnAnglePrev = driver->turnAngleCurr; // ??? --Super uVar20 = actionsFlagSetCopy & 0x7f1f83d5; - + // disable input if opening adv hub door with key if ((gameMode2 & 0x4004) != 0) { driver->actionsFlagSet = uVar20; return; } - + // destination normDst = &driver->AxisAngle4_normalVec[0]; if(driver->normalVecID == -1) normDst = &driver->AxisAngle3_normalVec[0]; driver->normalVecID = 0; - + // source normSrc = &driver->AxisAngle2_normalVec[0]; if ((actionsFlagSetCopy & 1) != 0) normSrc = &driver->AxisAngle1_normalVec[0]; - + // copy *(u_int*)&normDst[0] = *(u_int*)&normSrc[0]; normDst[2] = normSrc[2]; - - - + + + // === Check Mask Weapon === @@ -438,7 +453,7 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver* // If thread->modelIndex is Aku or Uka if ( - (*(short*)&driverItemThread->modelIndex == 0x3a) || + (*(short*)&driverItemThread->modelIndex == 0x3a) || (*(short*)&driverItemThread->modelIndex == 0x39) ) { @@ -453,7 +468,7 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver* // === Check Buttons === - + // pointer to gamepad input of current player (driver) ptrgamepad = &sdata->gGamepads->gamepad[(u_int)driver->driverID]; @@ -474,10 +489,10 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver* // state of kart kartState = driver->kartState; - - + + // === Check Weapons === - + if ( @@ -514,15 +529,15 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver* driver->instBubbleHold = 0; goto CheckJumpButtons; } - + // item is rolling if (driver->itemRollTimer != 0) { - // circle button ends timer, if + // circle button ends timer, if // less than 70 frames (2.3s) remain if (driver->itemRollTimer < FPS_DOUBLE(70)) driver->itemRollTimer = 0; - + // skip weapon firing check goto CheckJumpButtons; } @@ -536,7 +551,7 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver* heldItemID = driver->heldItemID; if ( - (heldItemID != 0xF) && + (heldItemID != 0xF) && (heldItemID != 0x10) && (driver->noItemTimer == 0) && (driverRankItemValue != 1) && @@ -545,7 +560,7 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver* { // This driver wants to fire a weapon actionsFlagSetCopy |= 0x8000; - + // if numHeldItems == 0 // wait a full second before next weapon driver->noItemTimer = FPS_DOUBLE(0x1e); @@ -556,17 +571,17 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver* // if numHeldItems > 0, // wait 5 frames before next weapon use driver->noItemTimer = FPS_DOUBLE(5); - + // not spring weapon if (heldItemID != 5) { // only reduce numHeldItem if not using item cheats if ((gameMode2 & (CHEAT_BOMBS | CHEAT_TURBO | CHEAT_MASK)) == 0) driver->numHeldItems--; } - + // no spring in final game #if 0 - + // If you have the Spring weapon else { @@ -578,16 +593,16 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver* driver->numHeldItems--; } } - + #endif } } } - + // === Drift Section === - - + + CheckJumpButtons: // Check for Tapping L1 and R1 @@ -678,8 +693,8 @@ CheckJumpButtons: // If you are not holding Cross if(cross == 0) { - unk0x80 = DECOMP_VehPhysJoystick_ReturnToRest(stickRY, 0x80, 0); - + unk0x80 = DECOMP_VehPhysJoystick_ReturnToRest(stickRY, 0x80, 0); + if(unk0x80 > -1) { actionsFlagSetCopy |= 0x400000; @@ -704,19 +719,19 @@ CheckJumpButtons: // you have Reserves and you aren't slowing down cross = 0x10; } - - + + // === Gas/Brake section === - + stickLY = 0x80; // If you're not in End-Of-Race menu - if ((gGT->gameMode1 & END_OF_RACE) == 0) + if ((gGT->gameMode1 & END_OF_RACE) == 0) { stickLY = ptrgamepad->stickLY; } - + if ( (driver->simpTurnState < 0) || @@ -735,12 +750,12 @@ CheckJumpButtons: actionsFlagSetCopy &= 0x9fffffff; } approximateSpeed2 = 0; - + // with zero wumpa, should be const_Speed_ClassStat (13140 for Crash Bandicoot) // this works for both decomp and original - - // with one wumpa, (25600 in rewrite, 13169 in original) - + + // with one wumpa, (25600 in rewrite, 13169 in original) + #ifdef REBUILD_PC // buggy, experimental //driverBaseSpeed = DECOMP_VehPhysGeneral_GetBaseSpeed(driver); @@ -749,7 +764,7 @@ CheckJumpButtons: // original, for decomp driverBaseSpeed = VehPhysGeneral_GetBaseSpeed(driver); #endif - + driverBaseSpeedUshort = driverBaseSpeed; // If you are not holding Square @@ -775,16 +790,16 @@ CheckJumpButtons: if (driverSpeedSmth2 < 1) { if - ( + ( (driverSpeedOrSmth == 0) && ( ( - unk0x80 = DECOMP_VehPhysJoystick_ReturnToRest(stickLY, 0x80, 0), - + unk0x80 = DECOMP_VehPhysJoystick_ReturnToRest(stickLY, 0x80, 0), + (unk0x80 > 99) || ( - (unk0x80 > 0) && + (unk0x80 > 0) && ((actionsFlagSetCopy & 0x20000) != 0) ) ) @@ -793,15 +808,15 @@ CheckJumpButtons: { // driver is steering? actionsFlagSetCopy |= 0x20000; - + driverSpeedSmth2 = -driver->const_BackwardSpeed; goto LAB_80062548; } - + driverSpeedOrSmth = driverBaseSpeed * driverSpeedOrSmth; driverSpeedSmth2 = driverSpeedOrSmth >> 7; if (driverSpeedOrSmth < 0) driverSpeedSmth2 = (driverSpeedOrSmth + 0x7f) >> 7; - + // remove flag for reversing goto LAB_8006253c; } @@ -843,29 +858,29 @@ CheckJumpButtons: driverSpeedOrSmth = driverBaseSpeed * -driverSpeedOrSmth; if (driverSpeedOrSmth < 0) driverSpeedOrSmth += 0xff; driverSpeedSmth2 = driverSpeedOrSmth >> 8; - + // gas and brake together actionsFlagSetCopy |= 0x20; - + goto LAB_80062548; } - + if (0 < driverSpeedOrSmth) { driverSpeedOrSmth = driver->const_BackwardSpeed * -driverSpeedOrSmth; if (driverSpeedOrSmth < 0) driverSpeedOrSmth += 0xff; driverSpeedSmth2 = driverSpeedOrSmth >> 8; - + // reversing, and gas+brake goto LAB_8006248c; } - + // driverSpeedOrSmth == 0, // no gas, only brake - + // using the brake actionsFlagSetCopy |= 8; - + driverSpeedSmth2 = approximateSpeed2; } // If you are holding cross, or you have Reserves @@ -873,7 +888,7 @@ CheckJumpButtons: { // gas and brake together actionsFlagSetCopy |= 0x20; - + driverSpeedSmth2 = driverBaseSpeed / 2; } goto LAB_8006253c; @@ -881,11 +896,11 @@ CheckJumpButtons: driverSpeedOrSmth = driver->const_BackwardSpeed * -3; driverSpeedSmth2 = driverSpeedOrSmth >> 2; if (driverSpeedOrSmth < 0) driverSpeedSmth2 = (driverSpeedOrSmth + 3) >> 2; - + LAB_8006248c: // reversing engine, and brakes actionsFlagSetCopy |= 0x20020; - + LAB_80062548: uVar20 = actionsFlagSetCopy & 0x9fffffff; approximateSpeed2 = driverSpeedSmth2; @@ -896,7 +911,7 @@ CheckJumpButtons: { driver->timeSpentReversing += gGT->elapsedTimeMS; } - + // not driving backwards else { @@ -906,13 +921,13 @@ CheckJumpButtons: if (0 < approximateSpeed2) { // not holding brake - if ((uVar20 & 0x400020) == 0) + if ((uVar20 & 0x400020) == 0) { driver->actionsFlagSet = uVar20; // fire level, depending on numWumpa superEngineFireLevel = 0x80; - if (driver->numWumpas > 9) + if (driver->numWumpas > 9) superEngineFireLevel = 0x100; // add 0.12s reserves @@ -927,12 +942,12 @@ CheckJumpButtons: // if accel prevention (hold square) actionsFlagSetCopy = uVar20 & 8; if (actionsFlagSetCopy != 0) - { + { // high speed if ( - (driver->speedApprox > 0x300) || + (driver->speedApprox > 0x300) || (driver->speedApprox < -0x300) - ) + ) { // record amount of time with high speed driver->timeSpentWithHighSpeed += msPerFrame; @@ -944,7 +959,7 @@ CheckJumpButtons: (driver->mashingXMakesItBig == 0) || ( - (driver->kartState != KS_NORMAL) && + (driver->kartState != KS_NORMAL) && (driver->kartState != KS_ANTIVSHIFT) ) ) @@ -973,12 +988,12 @@ CheckJumpButtons: //Racer struct + 0x39E = Racer's Base Speed *(u_short*)&driver->fireSpeed = approximateSpeed2; } - + // brakes if ((uVar20 & 0x800020) == 0) { #ifdef REBUILD_PC - // no collision, no "found" quadblock, no "known" + // no collision, no "found" quadblock, no "known" // terrain, so for now, assume asphalt driver->terrainMeta1 = &data.MetaDataTerrain[0]; driver->terrainMeta2 = &data.MetaDataTerrain[0]; @@ -1012,7 +1027,7 @@ CheckJumpButtons: // default steer strength from class stats iVar14 = driver->const_TurnRate + (driver->turnConst << 1) / 5; - + // if mashing X button if ((driver->mashXUnknown > 6) && (approximateSpeed < 0x2600)) { @@ -1020,7 +1035,7 @@ CheckJumpButtons: iVar14 = 0x5a; goto UseTurnRate; } - + // rubbing on wall now, or recently if (driver->set_0xF0_OnWallRub != 0) { @@ -1028,7 +1043,7 @@ CheckJumpButtons: iVar14 = 0x30; goto UseTurnRate; } - + // === not rubbing on wall now, or recently === // if not holding Square (& 0x8) @@ -1038,7 +1053,7 @@ CheckJumpButtons: // use const_TurnRate + turnConst<<1/5 goto UseTurnRate; } - + // if only holding Square if (cross == 0) { @@ -1048,7 +1063,7 @@ CheckJumpButtons: } // === if holding Square + Cross === - + // absolute value driver speed driverSpeedCopy = driver->speed; if (driverSpeedCopy < 0) driverSpeedCopy = -driverSpeedCopy; @@ -1056,22 +1071,22 @@ CheckJumpButtons: // As speed increases, turn rate decreases iVar14 = DECOMP_VehCalc_MapToRange ( - driverSpeedCopy, - 0x300, driver->const_Speed_ClassStat / 2, + driverSpeedCopy, + 0x300, driver->const_Speed_ClassStat / 2, 0x40, iVar14 ); - + UseTurnRate: // Steer, based on strength, and LeftStickX iVar14 = DECOMP_VehPhysJoystick_GetStrengthAbsolute(driverSpeedOrSmth, iVar14, ptrgamepad->rwd); // no desired steer - if (-iVar14 == 0) + if (-iVar14 == 0) { driver->numFramesSpentSteering = 10000; } - + // desired steer else { @@ -1079,24 +1094,24 @@ UseTurnRate: if ((iVar14 < 1) || (driver->simpTurnState < 0)) { // desired steer right, or active steer right - if ((-1 < iVar14) || (0 < driver->simpTurnState)) + if ((-1 < iVar14) || (0 < driver->simpTurnState)) { // active steer has not changed goto SkipSetSteer; } - + // active steer left uVar20 = uVar20 | 0x10; } - - else + + else { // active steer right uVar20 = uVar20 & 0xffffffef; } driver->numFramesSpentSteering = 0; } - + SkipSetSteer: *(u_char*)&driver->simpTurnState = (char)-iVar14; @@ -1132,29 +1147,29 @@ SkipSetSteer: driver->unkSpeedValue1 -= sVar13; } } - + // alternate tire colors each frame, // if 2e808080 is detected (&1==0), // if not RevEngine, and if unkSpeedVal if ( - (driver->unkSpeedValue1 < 1) && + (driver->unkSpeedValue1 < 1) && ((driver->tireColor & 1) == 0) && (kartState != KS_ENGINE_REVVING) ) { //reset 0x3BC driver->unkSpeedValue1 = 0x1e00; - + driver->tireColor = 0x2e606061; } - + // default tire color else { driver->tireColor = 0x2e808080; } - + driver->actionsFlagSet = uVar20; return; } diff --git a/include/common.h b/include/common.h index 435614eb..06bd672a 100644 --- a/include/common.h +++ b/include/common.h @@ -16,7 +16,7 @@ //#define USE_BIGQUEUE // Requires RAMEX: Extended loading queue //#define USE_HIGH1P // Requires BIGQUEUE: All high model drivers //#define USE_RANDOM // Requires HIGH1P: Character Randomizer -//#define USE_ONLINE // Requires HIGH1P: Online Multiplayer +#define USE_ONLINE // Requires HIGH1P: Online Multiplayer //#define USE_HIGHMP // Requires RAMEX: Multiplayer Maxed mod //#define USE_VR // Virtual Reality diff --git a/include/namespace_Vehicle.h b/include/namespace_Vehicle.h index 2e6dcfcb..895ad4fe 100644 --- a/include/namespace_Vehicle.h +++ b/include/namespace_Vehicle.h @@ -1548,6 +1548,10 @@ struct Driver short ghostBoolStarted; short unk636; + #ifdef USE_ONLINE + int uncappedReserves; + #endif + // 0x638 // end of ghost struct (as determined by memset) @@ -1565,6 +1569,6 @@ _Static_assert(sizeof(struct MetaPhys) == 0x20); _Static_assert(sizeof(struct MetaPhys) == 0x1C); #endif -#if BUILD == UsaRetail +#if BUILD == UsaRetail && !defined(USE_ONLINE) _Static_assert(sizeof(struct Driver) == 0x638); #endif \ No newline at end of file