Merge branch 'master' into terrain-lump

This commit is contained in:
Sally Coolatta 2021-12-09 03:46:01 -05:00
commit bf4b47a2cf
22 changed files with 293 additions and 53 deletions

View file

@ -396,6 +396,8 @@ typedef struct player_s
INT32 aizdrifttilt;
INT32 aizdriftturn;
INT32 underwatertilt;
fixed_t offroad; // In Super Mario Kart, going offroad has lee-way of about 1 second before you start losing speed
UINT8 waterskip; // Water skipping counter

View file

@ -323,6 +323,7 @@ actionpointer_t actionpointers[] =
{{A_SPBChase}, "A_SPBCHASE"},
{{A_SSMineSearch}, "A_SSMINESEARCH"},
{{A_SSMineExplode}, "A_SSMINEEXPLODE"},
{{A_LandMineExplode}, "A_LANDMINEEXPLODE"},
{{A_BallhogExplode}, "A_BALLHOGEXPLODE"},
{{A_LightningFollowPlayer}, "A_LIGHTNINGFOLLOWPLAYER"},
{{A_FZBoomFlash}, "A_FZBOOMFLASH"},

View file

@ -284,7 +284,7 @@ struct FSurfaceInfo
typedef struct FSurfaceInfo FSurfaceInfo;
#define GL_DEFAULTMIX 0x00000000
#define GL_DEFAULTFOG 0xFF000000
#define GL_DEFAULTFOG 0x19000000
//Hurdler: added for backward compatibility
enum hwdsetspecialstate

View file

@ -40,6 +40,7 @@
#include "../r_things.h" // R_GetShadowZ
#include "../d_main.h"
#include "../p_slopes.h"
#include "../k_kart.h" // HITLAGJITTERS
#include "hw_md2.h"
#ifdef NEWCLIP
@ -3655,7 +3656,7 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale)
// hitlag vibrating (todo: interp somehow?)
if (thing->hitlag > 0 && (thing->eflags & MFE_DAMAGEHITLAG))
{
fixed_t mul = thing->hitlag * (FRACUNIT / 10);
fixed_t mul = thing->hitlag * HITLAGJITTERS;
if (leveltime & 1)
{
@ -5103,7 +5104,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
// hitlag vibrating (todo: interp somehow?)
if (thing->hitlag > 0 && (thing->eflags & MFE_DAMAGEHITLAG))
{
fixed_t mul = thing->hitlag * (FRACUNIT / 10);
fixed_t mul = thing->hitlag * HITLAGJITTERS;
if (leveltime & 1)
{

View file

@ -45,6 +45,7 @@
// SRB2Kart
#include "../k_color.h"
#include "../k_kart.h" // HITLAGJITTERS
#ifdef HAVE_PNG
@ -1382,7 +1383,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
// hitlag vibrating
if (spr->mobj->hitlag > 0 && (spr->mobj->eflags & MFE_DAMAGEHITLAG))
{
fixed_t mul = spr->mobj->hitlag * (FRACUNIT / 10);
fixed_t mul = spr->mobj->hitlag * HITLAGJITTERS;
if (leveltime & 1)
{

View file

@ -715,14 +715,15 @@ static GLRGBAFloat shader_defaultcolor = {1.0f, 1.0f, 1.0f, 1.0f};
"float colorBrightness = sqrt((final_color.r * final_color.r) + (final_color.g * final_color.g) + (final_color.b * final_color.b));\n" \
"float fogBrightness = sqrt((fade_color.r * fade_color.r) + (fade_color.g * fade_color.g) + (fade_color.b * fade_color.b));\n" \
"float colorIntensity = 0.0;\n" \
"if (fogBrightness > colorBrightness) {\n" \
"if (colorBrightness < fogBrightness) {\n" \
"colorIntensity = 1.0 - min(final_color.r, min(final_color.g, final_color.b));\n" \
"colorIntensity = abs(colorIntensity - (1.0 - fogBrightness));\n" \
"colorIntensity = abs(colorIntensity - (1.0 - max(fade_color.r, max(fade_color.g, fade_color.b))));\n" \
"} else {\n" \
"colorIntensity = max(final_color.r, max(final_color.g, final_color.b));\n" \
"colorIntensity = abs(colorIntensity - (fogBrightness));\n" \
"colorIntensity = abs(colorIntensity - min(fade_color.r, min(fade_color.g, fade_color.b)));\n" \
"}\n" \
"colorIntensity *= darkness;\n" \
"colorIntensity *= fade_color.a * 10.0;\n" \
"if (abs(final_color.r - fade_color.r) <= colorIntensity) {\n" \
"final_color.r = fade_color.r;\n" \
"} else if (final_color.r < fade_color.r) {\n" \

View file

@ -4358,7 +4358,7 @@ state_t states[NUMSTATES] =
{SPR_KRBM, FF_FULLBRIGHT|9, 5, {NULL}, 0, 0, S_NULL}, // S_SLOWBOOM10
{SPR_LNDM, 0, -1, {NULL}, 0, 0, S_LANDMINE}, // S_LANDMINE
{SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_LANDMINE_EXPLODE
{SPR_NULL, 0, 1, {A_LandMineExplode}, 0, 0, S_NULL}, // S_LANDMINE_EXPLODE
{SPR_BHOG, 0, 3, {A_PlaySound}, sfx_s1bd, 1, S_BALLHOG2}, // S_BALLHOG1
{SPR_BHOG, FF_FULLBRIGHT|1, 1, {NULL}, 0, 0, S_BALLHOG3}, // S_BALLHOG2

View file

@ -276,6 +276,7 @@ enum actionnum
A_SPBCHASE,
A_SSMINESEARCH,
A_SSMINEEXPLODE,
A_LANDMINEEXPLODE,
A_BALLHOGEXPLODE,
A_LIGHTNINGFOLLOWPLAYER,
A_FZBOOMFLASH,
@ -546,6 +547,8 @@ void A_JawzExplode();
void A_SPBChase();
void A_SSMineSearch();
void A_SSMineExplode();
void A_LandMineExplode();
void A_LandMineExplode();
void A_BallhogExplode();
void A_LightningFollowPlayer();
void A_FZBoomFlash();

View file

@ -3861,7 +3861,7 @@ static void K_drawKartFirstPerson(void)
// hitlag vibrating
if (stplyr->mo->hitlag > 0 && (stplyr->mo->eflags & MFE_DAMAGEHITLAG))
{
fixed_t mul = stplyr->mo->hitlag * (FRACUNIT / 10);
fixed_t mul = stplyr->mo->hitlag * HITLAGJITTERS;
if (r_splitscreen && mul > FRACUNIT)
mul = FRACUNIT;

View file

@ -2712,6 +2712,19 @@ boolean K_TripwirePass(player_t *player)
return false;
}
boolean K_WaterRun(player_t *player)
{
if (
player->invincibilitytimer ||
player->sneakertimer ||
player->tiregrease ||
player->flamedash ||
player->speed > 2 * K_GetKartSpeed(player, false)
)
return true;
return false;
}
static fixed_t K_FlameShieldDashVar(INT32 val)
{
// 1 second = 75% + 50% top speed
@ -3635,14 +3648,9 @@ void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32
#define MINEQUAKEDIST 4096
// Spawns the purely visual explosion
void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
// Does the proximity screen flash and quake for explosions
void K_MineFlashScreen(mobj_t *source)
{
INT32 i, radius, height;
mobj_t *smoldering = P_SpawnMobj(source->x, source->y, source->z, MT_SMOLDERING);
mobj_t *dust;
mobj_t *truc;
INT32 speed, speed2;
INT32 pnum;
player_t *p;
@ -3665,6 +3673,18 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
break; // we can break right now because quakes are global to all split players somehow.
}
}
}
// Spawns the purely visual explosion
void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
{
INT32 i, radius, height;
mobj_t *smoldering = P_SpawnMobj(source->x, source->y, source->z, MT_SMOLDERING);
mobj_t *dust;
mobj_t *truc;
INT32 speed, speed2;
K_MineFlashScreen(source);
K_MatchGenericExtraFlags(smoldering, source);
smoldering->tics = TICRATE*3;
@ -7578,10 +7598,12 @@ static INT16 K_GetKartDriftValue(player_t *player, fixed_t countersteer)
basedrift += (basedrift / greasetics) * player->tiregrease;
}
if (player->mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER))
#if 0
if (player->mo->eflags & MFE_UNDERWATER)
{
countersteer = FixedMul(countersteer, 3*FRACUNIT/2);
}
#endif
return basedrift + (FixedMul(driftadjust * FRACUNIT, countersteer) / FRACUNIT);
}
@ -7685,9 +7707,10 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
turnfixed = FixedMul(turnfixed, FRACUNIT + player->handleboost);
}
if (player->mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER))
if ((player->mo->eflags & MFE_UNDERWATER) &&
player->speed > 11 * player->mo->scale)
{
turnfixed = FixedMul(turnfixed, 3*FRACUNIT/2);
turnfixed /= 2;
}
// Weight has a small effect on turning
@ -7696,6 +7719,24 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
return (turnfixed / FRACUNIT);
}
INT32 K_GetUnderwaterTurnAdjust(player_t *player)
{
if ((player->mo->eflags & MFE_UNDERWATER) &&
player->speed > 11 * player->mo->scale)
{
INT32 steer = (K_GetKartTurnValue(player,
player->steering) << TICCMD_REDUCE);
if (!player->drift)
steer = 9 * steer / 5;
return FixedMul(steer, 8 * FixedDiv(player->speed,
2 * K_GetKartSpeed(player, false) / 3));
}
else
return 0;
}
INT32 K_GetKartDriftSparkValue(player_t *player)
{
return (26*4 + player->kartspeed*2 + (9 - player->kartweight))*8;
@ -8462,10 +8503,15 @@ void K_AdjustPlayerFriction(player_t *player)
*/
// Water gets ice physics too
if (player->mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER))
if ((player->mo->eflags & MFE_TOUCHWATER) &&
!player->offroad)
{
player->mo->friction += 614;
}
else if (player->mo->eflags & MFE_UNDERWATER)
{
player->mo->friction += 312;
}
// Wipeout slowdown
if (player->spinouttimer && player->wipeoutslow)

View file

@ -20,6 +20,7 @@ Make sure this matches the actual number of states
#define KART_NUMINVSPARKLESANIM 12
#define MAXHITLAGTICS 18 //12
#define HITLAGJITTERS (FRACUNIT / 20)
player_t *K_GetItemBoxPlayer(mobj_t *mobj);
angle_t K_ReflectAngle(angle_t angle, angle_t against, fixed_t maxspeed, fixed_t yourspeed);
@ -69,6 +70,7 @@ void K_HandleBumperChanges(player_t *player, UINT8 prevBumpers);
void K_DestroyBumpers(player_t *player, UINT8 amount);
void K_TakeBumpersFromPlayer(player_t *player, player_t *victim, UINT8 amount);
void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit, mobj_t *source);
void K_MineFlashScreen(mobj_t *source);
void K_SpawnMineExplosion(mobj_t *source, UINT8 color);
void K_RunFinishLineBeam(void);
UINT16 K_DriftSparkColor(player_t *player, INT32 charge);
@ -92,6 +94,7 @@ void K_UpdateDistanceFromFinishLine(player_t *const player);
boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y);
void K_UpdateSteeringValue(player_t *player, INT16 destSteering);
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue);
INT32 K_GetUnderwaterTurnAdjust(player_t *player);
INT32 K_GetKartDriftSparkValue(player_t *player);
INT32 K_StairJankFlip(INT32 value);
INT32 K_GetKartDriftSparkValueForStage(player_t *player, UINT8 stage);
@ -108,6 +111,7 @@ void K_MomentumToFacing(player_t *player);
boolean K_ApplyOffroad(player_t *player);
boolean K_SlopeResistance(player_t *player);
boolean K_TripwirePass(player_t *player);
boolean K_WaterRun(player_t *player);
void K_ApplyTripWire(player_t *player, tripwirestate_t state);
INT16 K_GetSpindashChargeTime(player_t *player);
fixed_t K_GetSpindashChargeSpeed(player_t *player);

View file

@ -310,6 +310,7 @@ void A_JawzExplode(mobj_t *actor);
void A_SPBChase(mobj_t *actor);
void A_SSMineSearch(mobj_t *actor);
void A_SSMineExplode(mobj_t *actor);
void A_LandMineExplode(mobj_t *actor);
void A_BallhogExplode(mobj_t *actor);
void A_LightningFollowPlayer(mobj_t *actor);
void A_FZBoomFlash(mobj_t *actor);
@ -11194,10 +11195,13 @@ void A_MineExplode(mobj_t *actor)
A_Scream(actor);
actor->flags = MF_NOGRAVITY|MF_NOCLIP;
/*
quake.epicenter = NULL;
quake.radius = 512*FRACUNIT;
quake.intensity = 8*FRACUNIT;
quake.time = TICRATE/3;
*/
P_StartQuake(8<<FRACBITS, TICRATE/3);
P_RadiusAttack(actor, actor->tracer, 192*FRACUNIT, 0, true);
P_MobjCheckWater(actor);
@ -12204,9 +12208,9 @@ void A_Boss5BombExplode(mobj_t *actor)
P_DustRing(locvar1, 4, actor->x, actor->y, actor->z+actor->height, 2*actor->radius, 0, FRACUNIT, actor->scale);
P_DustRing(locvar1, 6, actor->x, actor->y, actor->z+actor->height/2, 3*actor->radius, FRACUNIT, FRACUNIT, actor->scale);
//P_StartQuake(9*actor->scale, TICRATE/6, {actor->x, actor->y, actor->z}, 20*actor->radius);
//P_StartQuake(9*FRACUNIT, TICRATE/6, {actor->x, actor->y, actor->z}, 20*actor->radius);
// the above does not exist, so we set the quake values directly instead
quake.intensity = 9*actor->scale;
quake.intensity = 9*FRACUNIT;
quake.time = TICRATE/6;
// the following quake values have no effect atm? ah well, may as well set them anyway
{
@ -14132,6 +14136,63 @@ void A_SSMineExplode(mobj_t *actor)
actor->flags2 |= MF2_DEBRIS; // Set this flag to ensure that the explosion won't be effective more than 1 frame.
}
void A_LandMineExplode(mobj_t *actor)
{
mobj_t *expl;
INT32 colour = SKINCOLOR_KETCHUP; // we spell words properly here
INT32 i;
mobj_t *smoldering;
mobj_t *dust;
if (LUA_CallAction(A_LANDMINEEXPLODE, actor))
return;
// we'll base the explosion "timer" off of some stupid variable like uh... cvmem!
// Yeah let's use cvmem since nobody uses that
if (actor->target && !P_MobjWasRemoved(actor->target))
colour = actor->target->color;
K_MineFlashScreen(actor);
// Spawn smoke remains:
smoldering = P_SpawnMobj(actor->x, actor->y, actor->z, MT_SMOLDERING);
P_SetScale(smoldering, actor->scale);
smoldering->tics = TICRATE*3;
// Spawn a ring:
for (i = 0; i < 32; i++)
{
dust = P_SpawnMobj(actor->x, actor->y, actor->z, MT_SMOKE);
P_SetMobjState(dust, S_OPAQUESMOKE1);
dust->angle = (ANGLE_180/16) * i;
P_SetScale(dust, actor->scale);
dust->destscale = actor->scale*4;
dust->scalespeed = actor->scale/4;
P_InstaThrust(dust, dust->angle, FixedMul(20*FRACUNIT, actor->scale));
}
actor->fuse = actor->tics; // disappear when this state ends.
// spawn a few physics explosions
for (i = 0; i < 15; i++)
{
expl = P_SpawnMobj(actor->x, actor->y, actor->z + actor->scale, MT_BOOMEXPLODE);
expl->color = colour;
expl->tics = (i+1);
//K_MatchGenericExtraFlags(expl, actor);
P_SetScale(expl, actor->scale*4);
expl->momx = P_RandomRange(-3, 3)*actor->scale/2;
expl->momy = P_RandomRange(-3, 3)*actor->scale/2;
// 100/45 = 2.22 fu/t
expl->momz = ((i+1)*actor->scale*5/2)*P_MobjFlip(expl);
}
}
void A_BallhogExplode(mobj_t *actor)
{
mobj_t *mo2;

View file

@ -333,6 +333,7 @@ void P_Attract(mobj_t *source, mobj_t *enemy, boolean nightsgrab);
mobj_t *P_GetClosestAxis(mobj_t *source);
boolean P_CanRunOnWater(player_t *player, ffloor_t *rover);
boolean P_CheckSolidFFloorSurface(player_t *player, ffloor_t *rover);
void P_MaceRotate(mobj_t *center, INT32 baserot, INT32 baseprevrot);

View file

@ -1864,7 +1864,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
continue;
}
if (thing->player && P_CheckSolidLava(rover))
if (thing->player && P_CheckSolidFFloorSurface(thing->player, rover))
;
else if (thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE))
;
@ -2439,6 +2439,20 @@ boolean PIT_PushableMoved(mobj_t *thing)
return true;
}
static boolean P_WaterRunning(mobj_t *thing)
{
ffloor_t *rover = thing->floorrover;
return rover && (rover->flags & FF_SWIMMABLE) &&
P_IsObjectOnGround(thing);
}
static boolean P_WaterStepUp(mobj_t *thing)
{
player_t *player = thing->player;
return (player && player->waterskip) ||
P_WaterRunning(thing);
}
//
// P_TryMove
// Attempt to move to a new position.
@ -2503,7 +2517,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
const fixed_t maxstepmove = FixedMul(MAXSTEPMOVE, mapobjectscale);
fixed_t maxstep = maxstepmove;
if (thing->player && thing->player->waterskip)
if (thing->player && P_WaterStepUp(thing))
maxstep += maxstepmove; // Add some extra stepmove when waterskipping
// If using type Section1:13, double the maxstep.

View file

@ -734,7 +734,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
if (!(rover->flags & FF_EXISTS))
continue;
if (mobj->player && P_CheckSolidLava(rover))
if (mobj->player && P_CheckSolidFFloorSurface(mobj->player, rover))
;
else if (!((rover->flags & FF_BLOCKPLAYER && mobj->player)
|| (rover->flags & FF_BLOCKOTHERS && !mobj->player)))
@ -778,7 +778,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
if (!(rover->flags & FF_EXISTS))
continue;
if (mobj->player && P_CheckSolidLava(rover))
if (mobj->player && P_CheckSolidFFloorSurface(mobj->player, rover))
;
else if (!((rover->flags & FF_BLOCKPLAYER && mobj->player)
|| (rover->flags & FF_BLOCKOTHERS && !mobj->player)))

View file

@ -1885,7 +1885,7 @@ void P_AdjustMobjFloorZ_FFloors(mobj_t *mo, sector_t *sector, UINT8 motype)
topheight = P_GetFOFTopZ(mo, sector, rover, mo->x, mo->y, NULL);
bottomheight = P_GetFOFBottomZ(mo, sector, rover, mo->x, mo->y, NULL);
if (mo->player && P_CheckSolidLava(rover)) // only the player should stand on lava
if (mo->player && P_CheckSolidFFloorSurface(mo->player, rover)) // only the player should stand on lava or run on water
;
else if (motype != 0 && rover->flags & FF_SWIMMABLE) // "scenery" only
continue;
@ -2971,6 +2971,33 @@ boolean P_SceneryZMovement(mobj_t *mo)
return true;
}
// P_CanRunOnWater
//
// Returns true if player can waterrun on the 3D floor
//
boolean P_CanRunOnWater(player_t *player, ffloor_t *rover)
{
boolean flip = player->mo->eflags & MFE_VERTICALFLIP;
fixed_t surfaceheight = flip ? player->mo->waterbottom : player->mo->watertop;
fixed_t playerbottom = flip ? (player->mo->z + player->mo->height) : player->mo->z;
fixed_t clip = flip ? (surfaceheight - playerbottom) : (playerbottom - surfaceheight);
fixed_t span = player->mo->watertop - player->mo->waterbottom;
return
clip > -(player->mo->height / 2) &&
span > player->mo->height &&
player->speed / 5 > abs(player->mo->momz) &&
player->speed > K_GetKartSpeed(player, false) &&
K_WaterRun(player) &&
(rover->flags & FF_SWIMMABLE);
}
boolean P_CheckSolidFFloorSurface(player_t *player, ffloor_t *rover)
{
return P_CheckSolidLava(rover) ||
P_CanRunOnWater(player, rover);
}
//
// P_MobjCheckWater
//
@ -2986,7 +3013,10 @@ void P_MobjCheckWater(mobj_t *mobj)
ffloor_t *rover;
player_t *p = mobj->player; // Will just be null if not a player.
fixed_t height = mobj->height;
fixed_t halfheight = height / 2;
boolean wasgroundpounding = false;
fixed_t top2 = P_GetSectorCeilingZAt(sector, mobj->x, mobj->y);
fixed_t bot2 = P_GetSectorFloorZAt(sector, mobj->x, mobj->y);
// Default if no water exists.
mobj->watertop = mobj->waterbottom = mobj->z - 1000*FRACUNIT;
@ -2997,24 +3027,31 @@ void P_MobjCheckWater(mobj_t *mobj)
for (rover = sector->ffloors; rover; rover = rover->next)
{
fixed_t topheight, bottomheight;
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE)
|| (((rover->flags & FF_BLOCKPLAYER) && mobj->player)
|| ((rover->flags & FF_BLOCKOTHERS) && !mobj->player)))
continue;
topheight = P_GetFFloorTopZAt (rover, mobj->x, mobj->y);
bottomheight = P_GetFFloorBottomZAt(rover, mobj->x, mobj->y);
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE)
|| (((rover->flags & FF_BLOCKPLAYER) && mobj->player)
|| ((rover->flags & FF_BLOCKOTHERS) && !mobj->player)))
{
if (topheight < top2 && topheight > thingtop)
top2 = topheight;
if (bottomheight > bot2 && bottomheight < mobj->z)
bot2 = bottomheight;
continue;
}
if (mobj->eflags & MFE_VERTICALFLIP)
{
if (topheight < (thingtop - (height>>1))
|| bottomheight > thingtop)
if (topheight < (thingtop - halfheight)
|| bottomheight > (thingtop + halfheight))
continue;
}
else
{
if (topheight < mobj->z
|| bottomheight > (mobj->z + (height>>1)))
if (topheight < (mobj->z - halfheight)
|| bottomheight > (mobj->z + halfheight))
continue;
}
@ -3062,6 +3099,12 @@ void P_MobjCheckWater(mobj_t *mobj)
}
}
if (mobj->watertop > top2)
mobj->watertop = top2;
if (mobj->waterbottom < bot2)
mobj->waterbottom = bot2;
// Spectators and dead players don't get to do any of the things after this.
if (p && (p->spectator || p->playerstate != PST_LIVE))
{

View file

@ -239,6 +239,8 @@ static void P_NetArchivePlayers(void)
WRITEINT32(save_p, players[i].aizdrifttilt);
WRITEINT32(save_p, players[i].aizdriftturn);
WRITEINT32(save_p, players[i].underwatertilt);
WRITEFIXED(save_p, players[i].offroad);
WRITEUINT8(save_p, players[i].waterskip);
@ -495,6 +497,8 @@ static void P_NetUnArchivePlayers(void)
players[i].aizdrifttilt = READINT32(save_p);
players[i].aizdriftturn = READINT32(save_p);
players[i].underwatertilt = READINT32(save_p);
players[i].offroad = READFIXED(save_p);
players[i].waterskip = READUINT8(save_p);

View file

@ -2983,9 +2983,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
// reasonable defaults.
if (!quake.intensity)
quake.intensity = 8<<FRACBITS;
quake.intensity = 8*mapobjectscale;
if (!quake.radius)
quake.radius = 512<<FRACBITS;
quake.radius = 512*mapobjectscale;
break;
}
@ -8756,6 +8756,6 @@ static void P_SpawnPushers(void)
// epicenter and radius are not yet used.
void P_StartQuake(fixed_t intensity, tic_t time)
{
quake.intensity = intensity;
quake.intensity = FixedMul(intensity, mapobjectscale);
quake.time = time;
}

View file

@ -1772,6 +1772,55 @@ static void P_3dMovement(player_t *player)
if (player->mo->movefactor != FRACUNIT) // Friction-scaled acceleration...
movepushforward = FixedMul(movepushforward, player->mo->movefactor);
{
INT32 a = K_GetUnderwaterTurnAdjust(player);
INT32 adj = 0;
if (a)
{
const fixed_t maxadj = ANG10/4;
adj = a / 4;
if (adj > 0)
{
if (adj > maxadj)
adj = maxadj;
}
else if (adj < 0)
{
if (adj < -(maxadj))
adj = -(maxadj);
}
if (abs(player->underwatertilt + adj) > abs(a))
adj = (a - player->underwatertilt);
if (abs(a) < abs(player->underwatertilt))
adj = 0;
movepushangle += a;
}
if (adj)
{
player->underwatertilt += adj;
if (abs(player->underwatertilt) > ANG30)
{
player->underwatertilt =
player->underwatertilt > 0 ? ANG30
: -(ANG30);
}
}
else
{
player->underwatertilt =
FixedMul(player->underwatertilt,
7*FRACUNIT/8);
}
}
totalthrust.x += P_ReturnThrustX(player->mo, movepushangle, movepushforward);
totalthrust.y += P_ReturnThrustY(player->mo, movepushangle, movepushforward);
}
@ -2058,6 +2107,10 @@ void P_MovePlayer(player_t *player)
else if (player->drift != 0)
{
INT32 a = (ANGLE_45 / 5) * player->drift;
if (player->mo->eflags & MFE_UNDERWATER)
a /= 2;
player->drawangle += a;
}
}

View file

@ -615,6 +615,7 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
{
double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb, cdestbright;
double maskamt = 0, othermask = 0;
double fmaskamt = 0, fothermask = 0;
UINT8 cr = R_GetRgbaR(extra_colormap->rgba),
cg = R_GetRgbaG(extra_colormap->rgba),
@ -622,8 +623,8 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
ca = R_GetRgbaA(extra_colormap->rgba),
cfr = R_GetRgbaR(extra_colormap->fadergba),
cfg = R_GetRgbaG(extra_colormap->fadergba),
cfb = R_GetRgbaB(extra_colormap->fadergba);
// cfa = R_GetRgbaA(extra_colormap->fadergba); // unused in software
cfb = R_GetRgbaB(extra_colormap->fadergba),
cfa = R_GetRgbaA(extra_colormap->fadergba);
UINT8 fadestart = extra_colormap->fadestart,
fadedist = extra_colormap->fadeend - extra_colormap->fadestart;
@ -654,14 +655,11 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
cdestb = cfb;
cdestbright = sqrt((cfr*cfr) + (cfg*cfg) + (cfb*cfb));
// fade alpha unused in software
// maskamt = (double)(cfa/24.0l);
// othermask = 1 - maskamt;
// maskamt /= 0xff;
fmaskamt = (double)(cfa/24.0l);
fothermask = 1 - fmaskamt;
//fmaskamt /= 0xff;
// cdestr *= maskamt;
// cdestg *= maskamt;
// cdestb *= maskamt;
(void)fothermask; // unused, but don't feel like commenting it out
/////////////////////
// This code creates the colormap array used by software renderer
@ -701,16 +699,16 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
if (cbrightness < cdestbright)
{
cbest = 255.0l - min(r, min(g, b));
cdist = 255.0l - cdestbright;
cdist = 255.0l - max(cdestr, max(cdestg, cdestb));
}
else
{
cbest = max(r, max(g, b));
cdist = cdestbright;
cdist = min(cdestr, min(cdestg, cdestb));
}
// Add/subtract this value during fading.
brightChange[i] = fabs(cbest - cdist) / (double)fadedist;
brightChange[i] = (fabs(cbest - cdist) / (double)fadedist) * fmaskamt;
}
// Now allocate memory for the actual colormap array itself!

View file

@ -42,7 +42,11 @@ static angle_t R_PlayerSpriteRotation(player_t *player, player_t *viewPlayer)
angle_t rollAngle = 0;
if (sliptideLift)
if (player->mo->eflags & MFE_UNDERWATER)
{
rollAngle -= player->underwatertilt;
}
else if (sliptideLift)
{
/* (from side) tilt downward if turning
toward camera, upward if away. */

View file

@ -35,7 +35,6 @@
#include "p_slopes.h"
#include "d_netfil.h" // blargh. for nameonly().
#include "m_cheat.h" // objectplace
#include "k_color.h" // SRB2kart
#include "p_local.h" // stplyr
#ifdef HWRENDER
#include "hardware/hw_md2.h"
@ -44,6 +43,10 @@
#include "hardware/hw_drv.h"
#endif
// SRB2kart
#include "k_color.h"
#include "k_kart.h" // HITLAGJITTERS
#define MINZ (FRACUNIT*4)
#define BASEYCENTER (BASEVIDHEIGHT/2)
@ -1453,7 +1456,7 @@ static void R_ProjectSprite(mobj_t *thing)
// hitlag vibrating (todo: interp somehow?)
if (thing->hitlag > 0 && (thing->eflags & MFE_DAMAGEHITLAG))
{
fixed_t mul = thing->hitlag * (FRACUNIT / 10);
fixed_t mul = thing->hitlag * HITLAGJITTERS;
if (leveltime & 1)
{