Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into conditions-cascading

This commit is contained in:
toaster 2023-03-11 12:42:55 +00:00
commit c67412f6ef
11 changed files with 151 additions and 34 deletions

View file

@ -1168,6 +1168,7 @@ static void IdentifyVersion(void)
MUSICTEST("sounds.pk3")
MUSICTEST("music.pk3")
MUSICTEST("altmusic.pk3")
#undef MUSICTEST

View file

@ -1628,7 +1628,11 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
#ifdef PARANOIA
if (snacpending[i] < 0)
{
S_StartSound(NULL, sfx_monch);
I_Sleep(1000); // let the monch play out for 1 second
I_Error("snacpending[%d] negative!", i);
}
#endif
localplayer = i;

View file

@ -8880,8 +8880,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_SPIKED2, // xdeathstate
sfx_mspogo, // deathsound
2*TICRATE, // speed
8*FRACUNIT, // radius
32*FRACUNIT, // height
14*FRACUNIT, // radius
64*FRACUNIT, // height
0, // display offset
4, // mass
0, // damage

View file

@ -624,6 +624,60 @@ fixed_t K_DistanceOfLineFromPoint(fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t
return R_PointToDist2(px, py, startx + vx, starty + vy);
}
/*--------------------------------------------------
static fixed_t K_GetBotWaypointRadius(waypoint_t *waypoint)
Calculates a new waypoint radius size to use, making it
thinner depending on how harsh the turn is.
Input Arguments:-
waypoint - Waypoint to retrieve the radius of.
Return:-
New radius value.
--------------------------------------------------*/
static fixed_t K_GetBotWaypointRadius(waypoint_t *const waypoint)
{
static const fixed_t maxReduce = FRACUNIT/32;
static const angle_t maxDelta = ANGLE_45;
fixed_t radius = waypoint->mobj->radius;
fixed_t reduce = FRACUNIT;
angle_t delta = 0;
size_t i, j;
for (i = 0; i < waypoint->numnextwaypoints; i++)
{
const waypoint_t *next = waypoint->nextwaypoints[i];
const angle_t nextAngle = R_PointToAngle2(
waypoint->mobj->x, waypoint->mobj->y,
next->mobj->x, next->mobj->y
);
for (j = 0; j < waypoint->numprevwaypoints; j++)
{
const waypoint_t *prev = waypoint->prevwaypoints[j];
const angle_t prevAngle = R_PointToAngle2(
prev->mobj->x, prev->mobj->y,
waypoint->mobj->x, waypoint->mobj->y
);
delta = max(delta, AngleDelta(nextAngle, prevAngle));
}
}
if (delta > maxDelta)
{
delta = maxDelta;
}
reduce = FixedDiv(delta, maxDelta);
reduce = FRACUNIT + FixedMul(reduce, maxReduce - FRACUNIT);
return FixedMul(radius, reduce);
}
/*--------------------------------------------------
static botprediction_t *K_CreateBotPrediction(player_t *player)
@ -685,6 +739,8 @@ static botprediction_t *K_CreateBotPrediction(player_t *player)
{
for (i = 0; i < pathtofinish.numnodes; i++)
{
fixed_t radius = 0;
wp = (waypoint_t *)pathtofinish.array[i].nodedata;
if (i == 0)
@ -706,9 +762,10 @@ static botprediction_t *K_CreateBotPrediction(player_t *player)
radreduce = FRACUNIT >> 1;
}
if (wp->mobj->radius < smallestradius)
radius = K_GetBotWaypointRadius(wp);
if (radius < smallestradius)
{
smallestradius = wp->mobj->radius;
smallestradius = radius;
}
distanceleft -= disttonext;
@ -1376,7 +1433,7 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
return;
}
if (botController != NULL && (botController->args[1] & TMBOT_NOCONTROL)) // FIXME: UDMF-ify
if (botController != NULL && (botController->args[1] & TMBOT_NOCONTROL))
{
// Disable bot controls entirely.
return;
@ -1384,7 +1441,7 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
destangle = player->mo->angle;
if (botController != NULL && (botController->args[1] & TMBOT_FORCEDIR)) // FIXME: UDMF-ify
if (botController != NULL && (botController->args[1] & TMBOT_FORCEDIR))
{
const fixed_t dist = DEFAULT_WAYPOINT_RADIUS * player->mo->scale;

View file

@ -4865,7 +4865,7 @@ static void K_DrawGPRankDebugger(void)
default: { break; }
}
V_DrawThinString(0, 80, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE|V_YELLOWMAP,
V_DrawThinString(0, 90, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE|V_YELLOWMAP,
va(" ** FINAL GRADE: %c", gradeChar));
}

View file

@ -3113,7 +3113,7 @@ static void K_GetKartBoostPower(player_t *player)
if (player->sliptideZipBoost)
{
// NB: This is intentionally under the 25% threshold required to initiate a sliptide
ADDBOOST(13*FRACUNIT/20, 4*FRACUNIT, 2*SLIPTIDEHANDLING/5); // + 65% top speed, + 400% acceleration, +20% handling
ADDBOOST(8*FRACUNIT/10, 4*FRACUNIT, 2*SLIPTIDEHANDLING/5); // + 80% top speed, + 400% acceleration, +20% handling
}
if (player->spindashboost) // Spindash boost
@ -3470,7 +3470,7 @@ fixed_t K_GetNewSpeed(player_t *player)
// Don't calculate the acceleration as ever being above top speed
if (oldspeed > p_speed)
oldspeed = p_speed;
newspeed = FixedDiv(FixedDiv(FixedMul(oldspeed, accelmax - p_accel) + FixedMul(p_speed, p_accel), accelmax), K_PlayerBaseFriction(ORIG_FRICTION));
newspeed = FixedDiv(FixedDiv(FixedMul(oldspeed, accelmax - p_accel) + FixedMul(p_speed, p_accel), accelmax), K_PlayerBaseFriction(player, ORIG_FRICTION));
finalspeed = newspeed - oldspeed;
@ -4071,7 +4071,9 @@ static boolean K_IsLosingSliptideZip(player_t *player)
{
if (player->mo == NULL || P_MobjWasRemoved(player->mo) == true)
return true;
if (!K_Sliptiding(player) && player->drift == 0 && P_IsObjectOnGround(player->mo) && player->sneakertimer == 0)
if (!K_Sliptiding(player) && player->drift == 0
&& P_IsObjectOnGround(player->mo) && player->sneakertimer == 0
&& player->driftboost == 0)
return true;
return false;
}
@ -4116,7 +4118,7 @@ void K_UpdateSliptideZipIndicator(player_t *player)
mobj->renderflags &= ~RF_DONTDRAW;
UINT32 chargeFrame = 7 - min(7, player->sliptideZip / 10);
UINT32 decayFrame = min(7, player->sliptideZipDelay / 5);
UINT32 decayFrame = min(7, player->sliptideZipDelay / 2);
if (max(chargeFrame, decayFrame) > mobj->frame)
mobj->frame++;
else if (max(chargeFrame, decayFrame) < mobj->frame)
@ -9421,8 +9423,12 @@ static void K_KartDrift(player_t *player, boolean onground)
{
if (K_IsLosingSliptideZip(player) && player->sliptideZip > 0)
{
if (!S_SoundPlaying(player->mo, sfx_waved2))
S_StartSoundAtVolume(player->mo, sfx_waved2, 255/2); // Losing combo time, going to boost
S_StopSoundByID(player->mo, sfx_waved1);
S_StopSoundByID(player->mo, sfx_waved4);
player->sliptideZipDelay++;
if (player->sliptideZipDelay > TICRATE)
if (player->sliptideZipDelay > TICRATE/2)
{
fixed_t maxZipPower = 2*FRACUNIT;
fixed_t minZipPower = 1*FRACUNIT;
@ -9449,9 +9455,19 @@ static void K_KartDrift(player_t *player, boolean onground)
K_SpawnDriftBoostExplosion(player, 0);
player->sliptideZip = 0;
player->sliptideZipDelay = 0;
S_StartSound(player->mo, sfx_s3kb6);
S_StopSoundByID(player->mo, sfx_waved1);
S_StopSoundByID(player->mo, sfx_waved2);
S_StopSoundByID(player->mo, sfx_waved4);
S_StartSoundAtVolume(player->mo, sfx_waved3, 2*255/3); // Boost
}
}
else
{
S_StopSoundByID(player->mo, sfx_waved1);
S_StopSoundByID(player->mo, sfx_waved2);
if (player->sliptideZip > 0 && !S_SoundPlaying(player->mo, sfx_waved4))
S_StartSoundAtVolume(player->mo, sfx_waved4, 2*255/5); // Passive woosh
}
player->aizdrifttilt -= player->aizdrifttilt / 4;
player->aizdriftturn -= player->aizdriftturn / 4;
@ -9464,6 +9480,10 @@ static void K_KartDrift(player_t *player, boolean onground)
else
{
player->sliptideZipDelay = 0;
S_StopSoundByID(player->mo, sfx_waved2);
S_StopSoundByID(player->mo, sfx_waved4);
if (!S_SoundPlaying(player->mo, sfx_waved1))
S_StartSoundAtVolume(player->mo, sfx_waved1, 255/2); // Charging
}
if (player->drift
@ -10199,7 +10219,7 @@ static void K_AirFailsafe(player_t *player)
//
// K_PlayerBaseFriction
//
fixed_t K_PlayerBaseFriction(fixed_t original)
fixed_t K_PlayerBaseFriction(player_t *player, fixed_t original)
{
fixed_t frict = original;
@ -10207,6 +10227,20 @@ fixed_t K_PlayerBaseFriction(fixed_t original)
{
frict -= FRACUNIT >> 4;
}
else if (K_PlayerUsesBotMovement(player) == true)
{
// A bit extra friction to help them without drifting.
// Remove this line once they can drift.
frict -= FRACUNIT >> 5;
// Bots gain more traction as they rubberband.
if (player->botvars.rubberband > FRACUNIT)
{
static const fixed_t extraFriction = FRACUNIT >> 5;
const fixed_t mul = player->botvars.rubberband - FRACUNIT;
frict -= FixedMul(extraFriction, mul);
}
}
if (frict > FRACUNIT) { frict = FRACUNIT; }
if (frict < 0) { frict = 0; }
@ -10219,7 +10253,7 @@ fixed_t K_PlayerBaseFriction(fixed_t original)
//
void K_AdjustPlayerFriction(player_t *player)
{
const fixed_t prevfriction = K_PlayerBaseFriction(player->mo->friction);
const fixed_t prevfriction = K_PlayerBaseFriction(player, player->mo->friction);
if (P_IsObjectOnGround(player->mo) == false)
{

View file

@ -179,7 +179,7 @@ fixed_t K_3dKartMovement(player_t *player);
boolean K_PlayerEBrake(player_t *player);
SINT8 K_Sliptiding(player_t *player);
boolean K_FastFallBounce(player_t *player);
fixed_t K_PlayerBaseFriction(fixed_t original);
fixed_t K_PlayerBaseFriction(player_t *player, fixed_t original);
void K_AdjustPlayerFriction(player_t *player);
void K_MoveKartPlayer(player_t *player, boolean onground);
void K_CheckSpectateStatus(void);

View file

@ -1257,11 +1257,11 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
{
if (thing->z + thing->height <= tm.thing->z + FixedMul(FRACUNIT, tm.thing->scale)
&& thing->z + thing->height + thing->momz >= tm.thing->z + FixedMul(FRACUNIT, tm.thing->scale) + tm.thing->momz)
P_DamageMobj(thing, tm.thing, tm.thing, 1, DMG_NORMAL);
P_DamageMobj(thing, tm.thing, tm.thing, 1, DMG_TUMBLE);
}
else if (thing->z >= tm.thing->z + tm.thing->height - FixedMul(FRACUNIT, tm.thing->scale)
&& thing->z + thing->momz <= tm.thing->z + tm.thing->height - FixedMul(FRACUNIT, tm.thing->scale) + tm.thing->momz)
P_DamageMobj(thing, tm.thing, tm.thing, 1, DMG_NORMAL);
P_DamageMobj(thing, tm.thing, tm.thing, 1, DMG_TUMBLE);
}
else if (thing->type == MT_SPIKE && thing->flags & MF_SOLID && tm.thing->player) // unfortunate player falls into spike?!
{
@ -1269,11 +1269,11 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
{
if (tm.thing->z + tm.thing->height <= thing->z - FixedMul(FRACUNIT, thing->scale)
&& tm.thing->z + tm.thing->height + tm.thing->momz >= thing->z - FixedMul(FRACUNIT, thing->scale))
P_DamageMobj(tm.thing, thing, thing, 1, DMG_NORMAL);
P_DamageMobj(tm.thing, thing, thing, 1, DMG_TUMBLE);
}
else if (tm.thing->z >= thing->z + thing->height + FixedMul(FRACUNIT, thing->scale)
&& tm.thing->z + tm.thing->momz <= thing->z + thing->height + FixedMul(FRACUNIT, thing->scale))
P_DamageMobj(tm.thing, thing, thing, 1, DMG_NORMAL);
P_DamageMobj(tm.thing, thing, thing, 1, DMG_TUMBLE);
}
if (tm.thing->type == MT_WALLSPIKE && tm.thing->flags & MF_SOLID && thing->player) // wall spike impales player
@ -1397,6 +1397,17 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
return BMIT_CONTINUE;
}
if (!P_MobjWasRemoved(thing) && !P_MobjWasRemoved(tm.thing))
{
if (thing->player->eggmanexplode)
{
K_EggmanTransfer(thing->player, tm.thing->player);
} else if (tm.thing->player->eggmanexplode)
{
K_EggmanTransfer(tm.thing->player, thing->player);
}
}
// The bump has to happen last
if (P_IsObjectOnGround(thing) && tm.thing->momz < 0 && tm.thing->player->trickpanel)
{
@ -1412,14 +1423,6 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
K_PvPTouchDamage(tm.thing, thing);
}
if (thing->player->eggmanexplode)
{
K_EggmanTransfer(thing->player, tm.thing->player);
} else if (tm.thing->player->eggmanexplode)
{
K_EggmanTransfer(tm.thing->player, thing->player);
}
return BMIT_CONTINUE;
}
else if (thing->type == MT_SPECIAL_UFO)

View file

@ -202,14 +202,17 @@ static void InitLogging(void)
static void init_exchndl()
{
HMODULE exchndl_module = LoadLibraryA("exchndl.dll");
if (exchndl_module != NULL)
if (exchndl_module == NULL)
{
using PFN_ExcHndlInit = void(*)(void);
PFN_ExcHndlInit pfnExcHndlInit = reinterpret_cast<PFN_ExcHndlInit>(
GetProcAddress(exchndl_module, "ExcHndlInit"));
if (pfnExcHndlInit != NULL)
(pfnExcHndlInit)();
I_Error("exchndl.dll or mgwhelp.dll is missing");
}
using PFN_ExcHndlInit = void(*)(void);
PFN_ExcHndlInit pfnExcHndlInit = reinterpret_cast<PFN_ExcHndlInit>(
GetProcAddress(exchndl_module, "ExcHndlInit"));
if (pfnExcHndlInit != NULL)
(pfnExcHndlInit)();
}
#endif

View file

@ -1131,6 +1131,11 @@ sfxinfo_t S_sfx[NUMSFX] =
{"gate04", false, 32, 64, -1, NULL, 0, -1, -1, LUMPERROR, ""},
{"gate05", false, 32, 64, -1, NULL, 0, -1, -1, LUMPERROR, ""},
{"waved1", false, 32, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
{"waved2", false, 32, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
{"waved3", false, 32, 64, -1, NULL, 0, -1, -1, LUMPERROR, ""},
{"waved4", false, 32, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
// Passing sounds
{"pass01", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
{"pass02", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
@ -1175,6 +1180,8 @@ sfxinfo_t S_sfx[NUMSFX] =
{"clawk1", false, 64, 16, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // SF_X8AWAYSOUND
{"clawk2", false, 64, 16, -1, NULL, 0, -1, -1, LUMPERROR, ""}, // SF_X8AWAYSOUND
{"monch", false, 255, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
// SRB2Kart - Engine sounds
// Engine class A
{"krta00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR, ""},

View file

@ -1199,6 +1199,12 @@ typedef enum
sfx_gate04,
sfx_gate05,
// Wavedashing
sfx_waved1,
sfx_waved2,
sfx_waved3,
sfx_waved4,
// Passing sounds
sfx_pass01,
sfx_pass02,
@ -1243,6 +1249,8 @@ typedef enum
sfx_clawk1,
sfx_clawk2,
sfx_monch,
// Next up: UNIQUE ENGINE SOUNDS! Hoooooo boy...
// Engine class A - Low Speed, Low Weight
sfx_krta00,