mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-22 02:00:11 +00:00
Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart.git into hannushadow
This commit is contained in:
commit
171cc75607
3 changed files with 55 additions and 13 deletions
|
|
@ -3732,7 +3732,7 @@ stairstep:
|
|||
tmymove = 0;
|
||||
}
|
||||
if (!P_TryMove(mo, newx, newy, true)) {
|
||||
if (success)
|
||||
if (success || P_MobjWasRemoved(mo))
|
||||
return; // Good enough!!
|
||||
else
|
||||
goto retry;
|
||||
|
|
@ -3856,6 +3856,9 @@ void P_BounceMove(mobj_t *mo)
|
|||
INT32 hitcount;
|
||||
fixed_t mmomx = 0, mmomy = 0;
|
||||
|
||||
if (P_MobjWasRemoved(mo))
|
||||
return;
|
||||
|
||||
if (mo->player)
|
||||
{
|
||||
P_BouncePlayerMove(mo);
|
||||
|
|
@ -3979,7 +3982,11 @@ bounceback:
|
|||
mo->momy = tmymove;
|
||||
|
||||
if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true))
|
||||
{
|
||||
if (P_MobjWasRemoved(mo))
|
||||
return;
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
50
src/p_mobj.c
50
src/p_mobj.c
|
|
@ -1694,6 +1694,8 @@ void P_XYMovement(mobj_t *mo)
|
|||
else
|
||||
{
|
||||
P_BounceMove(mo);
|
||||
if (P_MobjWasRemoved(mo))
|
||||
return;
|
||||
xmove = ymove = 0;
|
||||
S_StartSound(mo, mo->info->activesound);
|
||||
|
||||
|
|
@ -1843,6 +1845,9 @@ void P_SceneryXYMovement(mobj_t *mo)
|
|||
if (!P_SceneryTryMove(mo, mo->x + mo->momx, mo->y + mo->momy))
|
||||
P_BounceMove(mo);
|
||||
|
||||
if (P_MobjWasRemoved(mo))
|
||||
return;
|
||||
|
||||
if ((!(mo->eflags & MFE_VERTICALFLIP) && mo->z > mo->floorz) || (mo->eflags & MFE_VERTICALFLIP && mo->z+mo->height < mo->ceilingz))
|
||||
return; // no friction when airborne
|
||||
|
||||
|
|
@ -10488,6 +10493,8 @@ void P_PrecipitationEffects(void)
|
|||
boolean effects_lightning = (precipprops[curWeather].effects & PRECIPFX_LIGHTNING);
|
||||
boolean lightningStrike = false;
|
||||
|
||||
boolean sounds_rain = (rainsfx != sfx_None && (!leveltime || leveltime % rainfreq == 1));
|
||||
|
||||
// No thunder except every other tic.
|
||||
if (!(leveltime & 1))
|
||||
{
|
||||
|
|
@ -10532,29 +10539,48 @@ void P_PrecipitationEffects(void)
|
|||
if (sound_disabled)
|
||||
return; // Sound off? D'aw, no fun.
|
||||
|
||||
if (!sounds_rain && !sounds_thunder)
|
||||
return; // no need to calculate volume at ALL
|
||||
|
||||
if (players[g_localplayers[0]].mo->subsector->sector->ceilingpic == skyflatnum)
|
||||
volume = 255; // Sky above? We get it full blast.
|
||||
else
|
||||
{
|
||||
fixed_t x, y, yl, yh, xl, xh;
|
||||
INT64 x, y, yl, yh, xl, xh;
|
||||
fixed_t closedist, newdist;
|
||||
|
||||
// Essentially check in a 1024 unit radius of the player for an outdoor area.
|
||||
yl = players[g_localplayers[0]].mo->y - 1024*FRACUNIT;
|
||||
yh = players[g_localplayers[0]].mo->y + 1024*FRACUNIT;
|
||||
xl = players[g_localplayers[0]].mo->x - 1024*FRACUNIT;
|
||||
xh = players[g_localplayers[0]].mo->x + 1024*FRACUNIT;
|
||||
closedist = 2048*FRACUNIT;
|
||||
for (y = yl; y <= yh; y += FRACUNIT*64)
|
||||
for (x = xl; x <= xh; x += FRACUNIT*64)
|
||||
#define RADIUSSTEP (64*FRACUNIT)
|
||||
#define SEARCHRADIUS (16*RADIUSSTEP)
|
||||
yl = yh = players[g_localplayers[0]].mo->y;
|
||||
yl -= SEARCHRADIUS;
|
||||
while (yl < INT32_MIN)
|
||||
yl += RADIUSSTEP;
|
||||
yh += SEARCHRADIUS;
|
||||
while (yh > INT32_MAX)
|
||||
yh -= RADIUSSTEP;
|
||||
|
||||
xl = xh = players[g_localplayers[0]].mo->x;
|
||||
xl -= SEARCHRADIUS;
|
||||
while (xl < INT32_MIN)
|
||||
xl += RADIUSSTEP;
|
||||
xh += SEARCHRADIUS;
|
||||
while (xh > INT32_MAX)
|
||||
xh -= RADIUSSTEP;
|
||||
|
||||
closedist = SEARCHRADIUS*2;
|
||||
#undef SEARCHRADIUS
|
||||
for (y = yl; y <= yh; y += RADIUSSTEP)
|
||||
for (x = xl; x <= xh; x += RADIUSSTEP)
|
||||
{
|
||||
if (R_PointInSubsector(x, y)->sector->ceilingpic == skyflatnum) // Found the outdoors!
|
||||
if (R_PointInSubsector((fixed_t)x, (fixed_t)y)->sector->ceilingpic == skyflatnum) // Found the outdoors!
|
||||
{
|
||||
newdist = S_CalculateSoundDistance(players[g_localplayers[0]].mo->x, players[g_localplayers[0]].mo->y, 0, x, y, 0);
|
||||
newdist = S_CalculateSoundDistance(players[g_localplayers[0]].mo->x, players[g_localplayers[0]].mo->y, 0, (fixed_t)x, (fixed_t)y, 0);
|
||||
if (newdist < closedist)
|
||||
closedist = newdist;
|
||||
}
|
||||
}
|
||||
#undef RADIUSSTEP
|
||||
|
||||
volume = 255 - (closedist>>(FRACBITS+2));
|
||||
}
|
||||
|
|
@ -10564,7 +10590,7 @@ void P_PrecipitationEffects(void)
|
|||
else if (volume > 255)
|
||||
volume = 255;
|
||||
|
||||
if (rainsfx != sfx_None && (!leveltime || leveltime % rainfreq == 1))
|
||||
if (sounds_rain)
|
||||
S_StartSoundAtVolume(players[g_localplayers[0]].mo, rainsfx, volume);
|
||||
|
||||
if (!sounds_thunder)
|
||||
|
|
@ -13316,4 +13342,4 @@ fixed_t P_GetMobjZMovement(mobj_t *mo)
|
|||
speed = FixedHypot(mo->momx, mo->momy);
|
||||
|
||||
return P_ReturnThrustY(mo, slope->zangle, P_ReturnThrustX(mo, angDiff, speed));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4119,6 +4119,15 @@ static void P_RelinkPointers(void)
|
|||
if (!(mobj->itnext = P_FindNewPosition(temp)))
|
||||
CONS_Debug(DBG_GAMELOGIC, "itnext not found on %d\n", mobj->type);
|
||||
}
|
||||
if (mobj->terrain)
|
||||
{
|
||||
temp = (UINT32)(size_t)mobj->terrain;
|
||||
mobj->terrain = K_GetTerrainByIndex(temp);
|
||||
if (mobj->terrain == NULL)
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "terrain not found on %d\n", mobj->type);
|
||||
}
|
||||
}
|
||||
if (mobj->player)
|
||||
{
|
||||
if ( mobj->player->awayviewmobj)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue