Merge remote-tracking branch 'origin/master' into serverside-pwr

This commit is contained in:
AJ Martinez 2023-04-14 20:05:25 -07:00
commit b3e7eed018
11 changed files with 179 additions and 39 deletions

View file

@ -3885,10 +3885,7 @@ static void Command_Login_f(void)
boolean IsPlayerAdmin(INT32 playernum)
{
#if defined (TESTERS) || defined (HOSTTESTERS)
(void)playernum;
return false;
#elif defined (DEVELOP)
#if defined(DEVELOP) && !(defined(HOSTTESTERS) || defined(TESTERS))
return playernum != serverplayer;
#else
INT32 i;

View file

@ -444,15 +444,22 @@ boolean K_LandMineCollide(mobj_t *t1, mobj_t *t2)
else
t2->z += t2->height;
P_SpawnMobj(t2->x/2 + t1->x/2, t2->y/2 + t1->y/2, t2->z/2 + t1->z/2, MT_ITEMCLASH);
S_StartSound(t2, t2->info->deathsound);
P_KillMobj(t2, t1, t1, DMG_NORMAL);
P_SetObjectMomZ(t2, 24*FRACUNIT, false);
P_InstaThrust(t2, bounceangle, 16*FRACUNIT);
if (P_MobjWasRemoved(t2))
{
t2 = NULL; // handles the arguments to P_KillMobj
}
else
{
P_SetObjectMomZ(t2, 24*FRACUNIT, false);
P_InstaThrust(t2, bounceangle, 16*FRACUNIT);
P_SpawnMobj(t2->x/2 + t1->x/2, t2->y/2 + t1->y/2, t2->z/2 + t1->z/2, MT_ITEMCLASH);
t1->reactiontime = t2->hitlag;
t1->reactiontime = t2->hitlag;
}
P_KillMobj(t1, t2, t2, DMG_NORMAL);
}
else if (t2->type == MT_SSMINE_SHIELD || t2->type == MT_SSMINE || t2->type == MT_LANDMINE)
@ -466,7 +473,15 @@ boolean K_LandMineCollide(mobj_t *t1, mobj_t *t2)
// Shootable damage
P_DamageMobj(t2, t1, t1->target, 1, DMG_NORMAL);
t1->reactiontime = t2->hitlag;
if (P_MobjWasRemoved(t2))
{
t2 = NULL; // handles the arguments to P_KillMobj
}
else
{
t1->reactiontime = t2->hitlag;
}
P_KillMobj(t1, t2, t2, DMG_NORMAL);
}
@ -796,6 +811,10 @@ boolean K_KitchenSinkCollide(mobj_t *t1, mobj_t *t2)
{
// Shootable damage
P_KillMobj(t2, t2, t1->target, DMG_NORMAL);
if (P_MobjWasRemoved(t2))
{
t2 = NULL; // handles the arguments to P_KillMobj
}
// This item damage
P_KillMobj(t1, t2, t2, DMG_NORMAL);
}

View file

@ -6164,7 +6164,8 @@ void K_PopPlayerShield(player_t *player)
return; // everything is handled by Obj_GardenTopDestroy
case KSHIELD_LIGHTNING:
K_DoLightningShield(player);
S_StartSound(player->mo, sfx_s3k7c);
// K_DoLightningShield(player);
break;
}
@ -8855,10 +8856,21 @@ INT16 K_UpdateSteeringValue(INT16 inputSteering, INT16 destSteering)
// player->steering is the turning value, but with easing applied.
// Keeps micro-turning from old easing, but isn't controller dependent.
const INT16 amount = KART_FULLTURN/3;
INT16 amount = KART_FULLTURN/3;
INT16 diff = destSteering - inputSteering;
INT16 outputSteering = inputSteering;
// We switched steering directions, lighten up on easing for a more responsive countersteer.
// (Don't do this for steering 0, let digital inputs tap-adjust!)
if ((inputSteering > 0 && destSteering < 0) || (inputSteering < 0 && destSteering > 0))
{
// Don't let small turns in direction X allow instant turns in direction Y.
INT16 countersteer = min(KART_FULLTURN, abs(inputSteering)); // The farthest we should go is to 0 -- neutral.
amount = max(countersteer, amount); // But don't reduce turning strength from baseline either.
}
if (abs(diff) <= amount)
{
// Reached the intended value, set instantly.

View file

@ -584,7 +584,7 @@ void K_ProcessTerrainEffect(mobj_t *mo)
{
if (player->mo->floorrover != NULL)
{
slope = *player->mo->ceilingrover->t_slope;
slope = *player->mo->floorrover->t_slope;
}
else
{

View file

@ -490,7 +490,7 @@ static void M_DrawTickStats(void)
void M_DrawPerfStats(void)
{
char s[100];
char s[363];
PS_SetFrameTime();

View file

@ -260,14 +260,25 @@ boolean Obj_OrbinautJawzCollide(mobj_t *t1, mobj_t *t2)
damageitem = false;
}
if (damageitem)
if (damageitem && P_MobjWasRemoved(t1) == false)
{
angle_t bounceangle;
if (P_MobjWasRemoved(t2) == false)
{
bounceangle = K_GetCollideAngle(t2, t1);
}
else
{
bounceangle = K_MomentumAngle(t1) + ANGLE_90;
t2 = NULL; // handles the arguments to P_KillMobj
}
// This Item Damage
angle_t bounceangle = K_GetCollideAngle(t2, t1);
S_StartSound(t1, t1->info->deathsound);
P_KillMobj(t1, t2, t2, DMG_NORMAL);
P_SetObjectMomZ(t1, 24*FRACUNIT, false);
P_InstaThrust(t1, bounceangle, 16*FRACUNIT);
}

View file

@ -2232,7 +2232,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y, TryMoveResult_t *re
// with MF_NOCLIP enabled, but they won't be blocked
// regardless of the result. This allows for SPBs and
// the UFO to collide.
return true;
// ...but be careful about removed obj! ~toast 140423
return !P_MobjWasRemoved(thing);
}
validcount++;

View file

@ -4337,6 +4337,8 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save)
{
next = currentthinker->next;
currentthinker->references = 0; // Heinous but this is the only place the assertion in P_UnlinkThinkers is wrong
if (currentthinker->function.acp1 == (actionf_p1)P_MobjThinker || currentthinker->function.acp1 == (actionf_p1)P_NullPrecipThinker)
P_RemoveSavegameMobj((mobj_t *)currentthinker); // item isn't saved, don't remove it
else

View file

@ -782,7 +782,8 @@ void P_Ticker(boolean run)
low = 65536 / (3+player->numsneakers);
high = 65536 / (3+player->numsneakers);
}
else if (player->boostpower < FRACUNIT && P_IsObjectOnGround(player->mo))
else if (((player->boostpower < FRACUNIT) || (player->stairjank > 8))
&& P_IsObjectOnGround(player->mo))
{
low = 65536 / 32;
high = 65536 / 32;

View file

@ -2243,16 +2243,30 @@ static void P_UpdatePlayerAngle(player_t *player)
angle_t leniency = (4*ANG1/3) * min(player->cmd.latency, 6);
// Don't force another turning tic, just give them the desired angle!
if (targetDelta == angleChange || K_Sliptiding(player) || (maxTurnRight == 0 && maxTurnLeft == 0))
if (targetDelta == angleChange || (maxTurnRight == 0 && maxTurnLeft == 0))
{
// Either we're dead on, we can't steer, or we're in a special handling state.
// Stuff like sliptiding requires some blind-faith steering:
// if a camera correction stops our turn input, the sliptide randomly fails!
// Either we're dead on or we can't steer at all.
player->steering = targetsteering;
}
else
{
// We're off. Try to legally steer the player towards their camera.
if (K_Sliptiding(player) && P_IsObjectOnGround(player->mo) && (player->cmd.turning != 0) && ((player->cmd.turning > 0) == (player->aizdriftstrat > 0)))
{
// Don't change handling direction if someone's inputs are sliptiding, you'll break the sliptide!
if (player->cmd.turning > 0)
{
steeringLeft = max(steeringLeft, 1);
steeringRight = max(steeringRight, steeringLeft);
}
else
{
steeringRight = min(steeringRight, -1);
steeringLeft = min(steeringLeft, steeringRight);
}
}
player->steering = P_FindClosestTurningForAngle(player, targetDelta, steeringLeft, steeringRight);
angleChange = K_GetKartTurnValue(player, player->steering) << TICCMD_REDUCE;

View file

@ -268,6 +268,96 @@ static void write_backtrace(INT32 signal)
#undef CRASHLOG_STDERR_WRITE
#endif // UNIXBACKTRACE
static void I_ShowErrorMessageBox(const char *messagefordevelopers, boolean dumpmade)
{
static char finalmessage[2048];
size_t firstimpressionsline = 3; // "Dr Robotnik's Ring Racers" has encountered...
if (M_CheckParm("-dedicated"))
return;
snprintf(
finalmessage,
sizeof(finalmessage),
"Hee Ho!\n"
"\n"
"\"Dr. Robotnik's Ring Racers\" has encountered an unrecoverable error and needs to close.\n"
"This is (usually) not your fault, but we encourage you to report it in the community. This should be done alongside your "
"%s"
"log file (%s).\n"
"\n"
"The following information is for a programmer (please be nice to them!) but\n"
"may also be useful for server hosts and add-on creators.\n"
"\n"
"%s",
dumpmade ?
#if defined (UNIXBACKTRACE)
"crash-log.txt"
#elif defined (_WIN32)
".rpt crash dump"
#endif
" (very important!) and " : "",
#ifdef LOGMESSAGES
logfilename[0] ? logfilename :
#endif
"uh oh, one wasn't made!?",
messagefordevelopers);
// Rudementary word wrapping.
// Simple and effective. Does not handle nonuniform letter sizes, etc. but who cares.
{
size_t max = 0, maxatstart = 0, start = 0, width = 0, i;
for (i = 0; finalmessage[i]; i++)
{
if (finalmessage[i] == ' ')
{
start = i;
max += 4;
maxatstart = max;
}
else if (finalmessage[i] == '\n')
{
if (firstimpressionsline > 0)
{
firstimpressionsline--;
if (firstimpressionsline == 0)
{
width = max;
}
}
start = 0;
max = 0;
maxatstart = 0;
continue;
}
else
max += 8;
// Start trying to wrap if presumed length exceeds the space we want.
if (width > 0 && max >= width && start > 0)
{
finalmessage[start] = '\n';
max -= maxatstart;
start = 0;
}
}
}
// Implement message box with SDL_ShowSimpleMessageBox,
// which should fail gracefully if it can't put a message box up
// on the target system
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
"Dr. Robotnik's Ring Racers "VERSIONSTRING" Error",
finalmessage, NULL);
// Note that SDL_ShowSimpleMessageBox does *not* require SDL to be
// initialized at the time, so calling it after SDL_Quit() is
// perfectly okay! In addition, we do this on purpose so the
// fullscreen window is closed before displaying the error message
// in case the fullscreen window blocks it for some absurd reason.
}
static void I_ReportSignal(int num, int coredumped)
{
//static char msg[] = "oh no! back to reality!\r\n";
@ -317,10 +407,15 @@ static void I_ReportSignal(int num, int coredumped)
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg);
if (!M_CheckParm("-dedicated"))
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
"Process killed by signal",
sigmsg, NULL);
I_ShowErrorMessageBox(sigmsg,
#if defined (UNIXBACKTRACE)
true
#elif defined (_WIN32)
!M_CheckParm("-noexchndl")
#else
false
#endif
);
}
#ifndef NEWSIGNALHANDLER
@ -1712,13 +1807,7 @@ void I_Error(const char *error, ...)
I_ShutdownGraphics();
I_ShutdownInput();
// Implement message box with SDL_ShowSimpleMessageBox,
// which should fail gracefully if it can't put a message box up
// on the target system
if (!M_CheckParm("-dedicated"))
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
"Dr. Robotnik's Ring Racers "VERSIONSTRING" Error",
buffer, NULL);
I_ShowErrorMessageBox(buffer, false);
// We wait until now to do this so the funny sound can be heard
I_ShutdownSound();
@ -1726,12 +1815,6 @@ void I_Error(const char *error, ...)
I_ShutdownSystem();
SDL_Quit();
// Note that SDL_ShowSimpleMessageBox does *not* require SDL to be
// initialized at the time, so calling it after SDL_Quit() is
// perfectly okay! In addition, we do this on purpose so the
// fullscreen window is closed before displaying the error message
// in case the fullscreen window blocks it for some absurd reason.
W_Shutdown();
#if defined (PARANOIA) || defined (DEVELOP)