Merge branch 'master' into grow-shrink-shoe-polish

This commit is contained in:
Sally Coolatta 2022-01-18 02:55:56 -05:00
commit 8acdbf7df8
26 changed files with 250 additions and 93 deletions

View file

@ -8,6 +8,11 @@ else
EXENAME?=srb2kart64.exe EXENAME?=srb2kart64.exe
endif endif
# disable dynamicbase if under msys2
ifdef MSYSTEM
libs+=-Wl,--disable-dynamicbase
endif
sources+=win32/Srb2win.rc sources+=win32/Srb2win.rc
opts+=-DSTDC_HEADERS opts+=-DSTDC_HEADERS
libs+=-ladvapi32 -lkernel32 -lmsvcrt -luser32 libs+=-ladvapi32 -lkernel32 -lmsvcrt -luser32

View file

@ -5235,8 +5235,10 @@ static void SV_Maketic(void)
maketic++; maketic++;
} }
void TryRunTics(tic_t realtics) boolean TryRunTics(tic_t realtics)
{ {
boolean ticking;
// the machine has lagged but it is not so bad // the machine has lagged but it is not so bad
if (realtics > TICRATE/7) // FIXME: consistency failure!! if (realtics > TICRATE/7) // FIXME: consistency failure!!
{ {
@ -5280,7 +5282,9 @@ void TryRunTics(tic_t realtics)
} }
#endif #endif
if (neededtic > gametic) ticking = neededtic > gametic;
if (ticking)
{ {
if (realtics) if (realtics)
hu_stopped = false; hu_stopped = false;
@ -5290,10 +5294,10 @@ void TryRunTics(tic_t realtics)
{ {
if (realtics) if (realtics)
hu_stopped = true; hu_stopped = true;
return; return false;
} }
if (neededtic > gametic) if (ticking)
{ {
if (advancedemo) if (advancedemo)
{ {
@ -5330,6 +5334,8 @@ void TryRunTics(tic_t realtics)
if (realtics) if (realtics)
hu_stopped = true; hu_stopped = true;
} }
return ticking;
} }

View file

@ -488,7 +488,7 @@ boolean Playing(void);
void D_QuitNetGame(void); void D_QuitNetGame(void);
//? How many ticks to run? //? How many ticks to run?
void TryRunTics(tic_t realtic); boolean TryRunTics(tic_t realtic);
// extra data for lmps // extra data for lmps
// these functions scare me. they contain magic. // these functions scare me. they contain magic.

View file

@ -685,6 +685,7 @@ tic_t rendergametic;
void D_SRB2Loop(void) void D_SRB2Loop(void)
{ {
tic_t oldentertics = 0, entertic = 0, realtics = 0, rendertimeout = INFTICS; tic_t oldentertics = 0, entertic = 0, realtics = 0, rendertimeout = INFTICS;
boolean ticked;
if (dedicated) if (dedicated)
server = true; server = true;
@ -772,11 +773,23 @@ void D_SRB2Loop(void)
realtics = 1; realtics = 1;
// process tics (but maybe not if realtic == 0) // process tics (but maybe not if realtic == 0)
TryRunTics(realtics); ticked = TryRunTics(realtics);
if (cv_frameinterpolation.value == 1 && !(paused || P_AutoPause() || hu_stopped)) if (cv_frameinterpolation.value == 1 && !(paused || P_AutoPause()))
{ {
fixed_t entertimefrac = I_GetTimeFrac(); static float tictime;
float entertime = I_GetTimeFrac();
fixed_t entertimefrac;
if (ticked)
tictime = entertime;
if (aproxfps < 35.0)
entertimefrac = FRACUNIT;
else
entertimefrac = FLOAT_TO_FIXED(entertime - tictime);
// renderdeltatics is a bit awkard to evaluate, since the system time interface is whole tic-based // renderdeltatics is a bit awkard to evaluate, since the system time interface is whole tic-based
renderdeltatics = realtics * FRACUNIT; renderdeltatics = realtics * FRACUNIT;
if (entertimefrac > rendertimefrac) if (entertimefrac > rendertimefrac)

View file

@ -345,16 +345,6 @@ static void F_IntroDrawScene(void)
// DRAW A FULL PIC INSTEAD OF FLAT! // DRAW A FULL PIC INSTEAD OF FLAT!
if (intro_scenenum == 0) if (intro_scenenum == 0)
{ {
if (finalecount == 8)
S_StartSound(NULL, sfx_vroom);
else if (finalecount == 47)
{
// Need to use M_Random otherwise it always uses the same sound
INT32 rskin = M_RandomKey(numskins);
UINT8 rtaunt = M_RandomKey(2);
sfxenum_t rsound = skins[rskin].soundsid[SKSKBST1+rtaunt];
S_StartSound(NULL, rsound);
}
background = W_CachePatchName("KARTKREW", PU_CACHE); background = W_CachePatchName("KARTKREW", PU_CACHE);
highres = true; highres = true;
} }
@ -453,6 +443,20 @@ void F_IntroTicker(void)
timetonext--; timetonext--;
if (intro_scenenum == 0)
{
if (finalecount == 8)
S_StartSound(NULL, sfx_vroom);
else if (finalecount == 47)
{
// Need to use M_Random otherwise it always uses the same sound
INT32 rskin = M_RandomKey(numskins);
UINT8 rtaunt = M_RandomKey(2);
sfxenum_t rsound = skins[rskin].soundsid[SKSKBST1+rtaunt];
S_StartSound(NULL, rsound);
}
}
F_WriteText(); F_WriteText();
// check for skipping // check for skipping

View file

@ -6751,7 +6751,6 @@ void HWR_DoPostProcessor(player_t *player)
// 10 by 10 grid. 2 coordinates (xy) // 10 by 10 grid. 2 coordinates (xy)
float v[SCREENVERTS][SCREENVERTS][2]; float v[SCREENVERTS][SCREENVERTS][2];
static double disStart = 0; static double disStart = 0;
static fixed_t last_fractime = 0;
UINT8 x, y; UINT8 x, y;
INT32 WAVELENGTH; INT32 WAVELENGTH;
@ -6761,15 +6760,15 @@ void HWR_DoPostProcessor(player_t *player)
// Modifies the wave. // Modifies the wave.
if (*type == postimg_water) if (*type == postimg_water)
{ {
WAVELENGTH = 20; // Lower is longer WAVELENGTH = 5;
AMPLITUDE = 20; // Lower is bigger AMPLITUDE = 20;
FREQUENCY = 16; // Lower is faster FREQUENCY = 8;
} }
else else
{ {
WAVELENGTH = 10; // Lower is longer WAVELENGTH = 10;
AMPLITUDE = 30; // Lower is bigger AMPLITUDE = 60;
FREQUENCY = 4; // Lower is faster FREQUENCY = 4;
} }
for (x = 0; x < SCREENVERTS; x++) for (x = 0; x < SCREENVERTS; x++)
@ -6783,16 +6782,7 @@ void HWR_DoPostProcessor(player_t *player)
} }
HWD.pfnPostImgRedraw(v); HWD.pfnPostImgRedraw(v);
if (!(paused || P_AutoPause())) if (!(paused || P_AutoPause()))
disStart += 1; disStart += FIXED_TO_FLOAT(renderdeltatics);
if (renderdeltatics > FRACUNIT)
{
disStart = disStart - FIXED_TO_FLOAT(last_fractime) + 1 + FIXED_TO_FLOAT(rendertimefrac);
}
else
{
disStart = disStart - FIXED_TO_FLOAT(last_fractime) + FIXED_TO_FLOAT(rendertimefrac);
}
last_fractime = rendertimefrac;
// Capture the screen again for screen waving on the intermission // Capture the screen again for screen waving on the intermission
if(gamestate != GS_INTERMISSION) if(gamestate != GS_INTERMISSION)

View file

@ -46,9 +46,9 @@ UINT32 I_GetFreeMem(UINT32 *total);
*/ */
tic_t I_GetTime(void); tic_t I_GetTime(void);
/** \brief Get the current time as a fraction of a tic since the last tic. /** \brief Get the current time in tics including fractions.
*/ */
fixed_t I_GetTimeFrac(void); float I_GetTimeFrac(void);
/** \brief Returns precise time value for performance measurement. /** \brief Returns precise time value for performance measurement.
*/ */

View file

@ -662,7 +662,10 @@ fixed_t K_DistanceOfLineFromPoint(fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t
--------------------------------------------------*/ --------------------------------------------------*/
static botprediction_t *K_CreateBotPrediction(player_t *player) static botprediction_t *K_CreateBotPrediction(player_t *player)
{ {
const INT16 handling = K_GetKartTurnValue(player, KART_FULLTURN); // Reduce prediction based on how fast you can turn // Stair janking makes it harder to steer, so attempt to steer harder.
const UINT8 jankDiv = (player->stairjank > 0 ? 2 : 1);
const INT16 handling = K_GetKartTurnValue(player, KART_FULLTURN) / jankDiv; // Reduce prediction based on how fast you can turn
const INT16 normal = KART_FULLTURN; // "Standard" handling to compare to const INT16 normal = KART_FULLTURN; // "Standard" handling to compare to
const tic_t futuresight = (TICRATE * normal) / max(1, handling); // How far ahead into the future to try and predict const tic_t futuresight = (TICRATE * normal) / max(1, handling); // How far ahead into the future to try and predict

View file

@ -382,6 +382,8 @@ static void K_BotItemGenericTap(player_t *player, ticcmd_t *cmd)
--------------------------------------------------*/ --------------------------------------------------*/
static boolean K_BotRevealsGenericTrap(player_t *player, INT16 turnamt, boolean mine) static boolean K_BotRevealsGenericTrap(player_t *player, INT16 turnamt, boolean mine)
{ {
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
if (abs(turnamt) >= KART_FULLTURN/2) if (abs(turnamt) >= KART_FULLTURN/2)
{ {
// DON'T reveal on turns, we can place bananas on turns whenever we have multiple to spare, // DON'T reveal on turns, we can place bananas on turns whenever we have multiple to spare,
@ -404,7 +406,7 @@ static boolean K_BotRevealsGenericTrap(player_t *player, INT16 turnamt, boolean
} }
// Check your behind. // Check your behind.
if (K_PlayerInCone(player, player->mo->radius * 16, 10, true) != NULL) if (K_PlayerInCone(player, coneDist, 15, true) != NULL)
{ {
return true; return true;
} }
@ -536,16 +538,19 @@ static void K_BotItemRocketSneaker(player_t *player, ticcmd_t *cmd)
--------------------------------------------------*/ --------------------------------------------------*/
static void K_BotItemBanana(player_t *player, ticcmd_t *cmd, INT16 turnamt) static void K_BotItemBanana(player_t *player, ticcmd_t *cmd, INT16 turnamt)
{ {
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
SINT8 throwdir = -1; SINT8 throwdir = -1;
boolean tryLookback = false;
player_t *target = NULL; player_t *target = NULL;
player->botvars.itemconfirm++; player->botvars.itemconfirm++;
target = K_PlayerInCone(player, player->mo->radius * 16, 10, true); target = K_PlayerInCone(player, coneDist, 15, true);
if (target != NULL) if (target != NULL)
{ {
K_ItemConfirmForTarget(player, target, player->botvars.difficulty); K_ItemConfirmForTarget(player, target, player->botvars.difficulty);
throwdir = -1; throwdir = -1;
tryLookback = true;
} }
if (abs(turnamt) >= KART_FULLTURN/2) if (abs(turnamt) >= KART_FULLTURN/2)
@ -564,7 +569,12 @@ static void K_BotItemBanana(player_t *player, ticcmd_t *cmd, INT16 turnamt)
} }
} }
if (player->botvars.itemconfirm > 2*TICRATE || player->bananadrag >= TICRATE) if (tryLookback == true && throwdir == -1)
{
cmd->buttons |= BT_LOOKBACK;
}
if (player->botvars.itemconfirm > 10*TICRATE || player->bananadrag >= TICRATE)
{ {
K_BotGenericPressItem(player, cmd, throwdir); K_BotGenericPressItem(player, cmd, throwdir);
} }
@ -585,12 +595,14 @@ static void K_BotItemBanana(player_t *player, ticcmd_t *cmd, INT16 turnamt)
--------------------------------------------------*/ --------------------------------------------------*/
static void K_BotItemMine(player_t *player, ticcmd_t *cmd, INT16 turnamt) static void K_BotItemMine(player_t *player, ticcmd_t *cmd, INT16 turnamt)
{ {
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
SINT8 throwdir = 0; SINT8 throwdir = 0;
boolean tryLookback = false;
player_t *target = NULL; player_t *target = NULL;
player->botvars.itemconfirm++; player->botvars.itemconfirm++;
target = K_PlayerInCone(player, player->mo->radius * 16, 10, true); target = K_PlayerInCone(player, coneDist, 15, true);
if (target != NULL) if (target != NULL)
{ {
K_ItemConfirmForTarget(player, target, player->botvars.difficulty); K_ItemConfirmForTarget(player, target, player->botvars.difficulty);
@ -601,6 +613,7 @@ static void K_BotItemMine(player_t *player, ticcmd_t *cmd, INT16 turnamt)
{ {
player->botvars.itemconfirm += player->botvars.difficulty / 2; player->botvars.itemconfirm += player->botvars.difficulty / 2;
throwdir = -1; throwdir = -1;
tryLookback = true;
} }
else else
{ {
@ -619,7 +632,12 @@ static void K_BotItemMine(player_t *player, ticcmd_t *cmd, INT16 turnamt)
} }
} }
if (player->botvars.itemconfirm > 2*TICRATE || player->bananadrag >= TICRATE) if (tryLookback == true && throwdir == -1)
{
cmd->buttons |= BT_LOOKBACK;
}
if (player->botvars.itemconfirm > 10*TICRATE || player->bananadrag >= TICRATE)
{ {
K_BotGenericPressItem(player, cmd, throwdir); K_BotGenericPressItem(player, cmd, throwdir);
} }
@ -640,6 +658,7 @@ static void K_BotItemMine(player_t *player, ticcmd_t *cmd, INT16 turnamt)
--------------------------------------------------*/ --------------------------------------------------*/
static void K_BotItemLandmine(player_t *player, ticcmd_t *cmd, INT16 turnamt) static void K_BotItemLandmine(player_t *player, ticcmd_t *cmd, INT16 turnamt)
{ {
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
player_t *target = NULL; player_t *target = NULL;
player->botvars.itemconfirm++; player->botvars.itemconfirm++;
@ -649,13 +668,14 @@ static void K_BotItemLandmine(player_t *player, ticcmd_t *cmd, INT16 turnamt)
player->botvars.itemconfirm += player->botvars.difficulty / 2; player->botvars.itemconfirm += player->botvars.difficulty / 2;
} }
target = K_PlayerInCone(player, player->mo->radius * 16, 10, true); target = K_PlayerInCone(player, coneDist, 15, true);
if (target != NULL) if (target != NULL)
{ {
K_ItemConfirmForTarget(player, target, player->botvars.difficulty); K_ItemConfirmForTarget(player, target, player->botvars.difficulty);
cmd->buttons |= BT_LOOKBACK;
} }
if (player->botvars.itemconfirm > 2*TICRATE) if (player->botvars.itemconfirm > 10*TICRATE)
{ {
K_BotGenericPressItem(player, cmd, -1); K_BotGenericPressItem(player, cmd, -1);
} }
@ -675,8 +695,10 @@ static void K_BotItemLandmine(player_t *player, ticcmd_t *cmd, INT16 turnamt)
--------------------------------------------------*/ --------------------------------------------------*/
static void K_BotItemEggman(player_t *player, ticcmd_t *cmd) static void K_BotItemEggman(player_t *player, ticcmd_t *cmd)
{ {
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
const UINT8 stealth = K_EggboxStealth(player->mo->x, player->mo->y); const UINT8 stealth = K_EggboxStealth(player->mo->x, player->mo->y);
SINT8 throwdir = -1; SINT8 throwdir = -1;
boolean tryLookback = false;
player_t *target = NULL; player_t *target = NULL;
player->botvars.itemconfirm++; player->botvars.itemconfirm++;
@ -688,11 +710,12 @@ static void K_BotItemEggman(player_t *player, ticcmd_t *cmd)
throwdir = 1; throwdir = 1;
} }
target = K_PlayerInCone(player, player->mo->radius * 16, 10, true); target = K_PlayerInCone(player, coneDist, 15, true);
if (target != NULL) if (target != NULL)
{ {
K_ItemConfirmForTarget(player, target, player->botvars.difficulty); K_ItemConfirmForTarget(player, target, player->botvars.difficulty);
throwdir = -1; throwdir = -1;
tryLookback = true;
} }
if (stealth > 1 || player->itemroulette > 0) if (stealth > 1 || player->itemroulette > 0)
@ -701,7 +724,12 @@ static void K_BotItemEggman(player_t *player, ticcmd_t *cmd)
throwdir = -1; throwdir = -1;
} }
if (player->botvars.itemconfirm > 2*TICRATE || player->bananadrag >= TICRATE) if (tryLookback == true && throwdir == -1)
{
cmd->buttons |= BT_LOOKBACK;
}
if (player->botvars.itemconfirm > 10*TICRATE || player->bananadrag >= TICRATE)
{ {
K_BotGenericPressItem(player, cmd, throwdir); K_BotGenericPressItem(player, cmd, throwdir);
} }
@ -720,6 +748,7 @@ static void K_BotItemEggman(player_t *player, ticcmd_t *cmd)
--------------------------------------------------*/ --------------------------------------------------*/
static boolean K_BotRevealsEggbox(player_t *player) static boolean K_BotRevealsEggbox(player_t *player)
{ {
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
const UINT8 stealth = K_EggboxStealth(player->mo->x, player->mo->y); const UINT8 stealth = K_EggboxStealth(player->mo->x, player->mo->y);
player_t *target = NULL; player_t *target = NULL;
@ -737,7 +766,7 @@ static boolean K_BotRevealsEggbox(player_t *player)
} }
// Check your behind. // Check your behind.
target = K_PlayerInCone(player, player->mo->radius * 16, 10, true); target = K_PlayerInCone(player, coneDist, 15, true);
if (target != NULL) if (target != NULL)
{ {
return true; return true;
@ -810,8 +839,9 @@ static void K_BotItemEggmanExplosion(player_t *player, ticcmd_t *cmd)
static void K_BotItemOrbinaut(player_t *player, ticcmd_t *cmd) static void K_BotItemOrbinaut(player_t *player, ticcmd_t *cmd)
{ {
const fixed_t topspeed = K_GetKartSpeed(player, false); const fixed_t topspeed = K_GetKartSpeed(player, false);
fixed_t radius = (player->mo->radius * 32); fixed_t radius = FixedMul(2560 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
SINT8 throwdir = -1; SINT8 throwdir = -1;
boolean tryLookback = false;
UINT8 snipeMul = 2; UINT8 snipeMul = 2;
player_t *target = NULL; player_t *target = NULL;
@ -823,24 +853,30 @@ static void K_BotItemOrbinaut(player_t *player, ticcmd_t *cmd)
player->botvars.itemconfirm++; player->botvars.itemconfirm++;
target = K_PlayerInCone(player, radius, 10, false); target = K_PlayerInCone(player, radius, 15, false);
if (target != NULL) if (target != NULL)
{ {
K_ItemConfirmForTarget(player, target, player->botvars.difficulty * snipeMul); K_ItemConfirmForTarget(player, target, player->botvars.difficulty * snipeMul);
throwdir = 1; throwdir = 1;
} }
else if (K_PlayerInCone(player, radius, 10, true)) else
{ {
target = K_PlayerInCone(player, radius, 10, true); target = K_PlayerInCone(player, radius, 15, true);
if (target != NULL) if (target != NULL)
{ {
K_ItemConfirmForTarget(player, target, player->botvars.difficulty); K_ItemConfirmForTarget(player, target, player->botvars.difficulty);
throwdir = -1; throwdir = -1;
tryLookback = true;
} }
} }
if (player->botvars.itemconfirm > 5*TICRATE) if (tryLookback == true && throwdir == -1)
{
cmd->buttons |= BT_LOOKBACK;
}
if (player->botvars.itemconfirm > 25*TICRATE)
{ {
K_BotGenericPressItem(player, cmd, throwdir); K_BotGenericPressItem(player, cmd, throwdir);
} }
@ -861,8 +897,9 @@ static void K_BotItemOrbinaut(player_t *player, ticcmd_t *cmd)
static void K_BotItemJawz(player_t *player, ticcmd_t *cmd) static void K_BotItemJawz(player_t *player, ticcmd_t *cmd)
{ {
const fixed_t topspeed = K_GetKartSpeed(player, false); const fixed_t topspeed = K_GetKartSpeed(player, false);
fixed_t radius = (player->mo->radius * 32); fixed_t radius = FixedMul(2560 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
SINT8 throwdir = 1; SINT8 throwdir = 1;
boolean tryLookback = false;
UINT8 snipeMul = 2; UINT8 snipeMul = 2;
INT32 lastTarg = player->lastjawztarget; INT32 lastTarg = player->lastjawztarget;
player_t *target = NULL; player_t *target = NULL;
@ -875,11 +912,12 @@ static void K_BotItemJawz(player_t *player, ticcmd_t *cmd)
player->botvars.itemconfirm++; player->botvars.itemconfirm++;
target = K_PlayerInCone(player, radius, 10, true); target = K_PlayerInCone(player, radius, 15, true);
if (target != NULL) if (target != NULL)
{ {
K_ItemConfirmForTarget(player, target, player->botvars.difficulty); K_ItemConfirmForTarget(player, target, player->botvars.difficulty);
throwdir = -1; throwdir = -1;
tryLookback = true;
} }
if (lastTarg != -1 if (lastTarg != -1
@ -913,7 +951,12 @@ static void K_BotItemJawz(player_t *player, ticcmd_t *cmd)
} }
} }
if (player->botvars.itemconfirm > 5*TICRATE) if (tryLookback == true && throwdir == -1)
{
cmd->buttons |= BT_LOOKBACK;
}
if (player->botvars.itemconfirm > 25*TICRATE)
{ {
K_BotGenericPressItem(player, cmd, throwdir); K_BotGenericPressItem(player, cmd, throwdir);
} }
@ -1007,7 +1050,7 @@ static void K_BotItemBubble(player_t *player, ticcmd_t *cmd)
} }
else if (player->bubbleblowup >= bubbletime) else if (player->bubbleblowup >= bubbletime)
{ {
if (player->botvars.itemconfirm >= 10*TICRATE) if (player->botvars.itemconfirm > 10*TICRATE)
{ {
hold = true; hold = true;
} }

View file

@ -619,7 +619,7 @@ void K_NudgePredictionTowardsObjects(botprediction_t *predict, player_t *player)
fixed_t avgX = 0, avgY = 0; fixed_t avgX = 0, avgY = 0;
fixed_t avgDist = 0; fixed_t avgDist = 0;
const fixed_t baseNudge = 128 * mapobjectscale; const fixed_t baseNudge = predict->radius;
fixed_t maxNudge = distToPredict; fixed_t maxNudge = distToPredict;
fixed_t nudgeDist = 0; fixed_t nudgeDist = 0;
angle_t nudgeDir = 0; angle_t nudgeDir = 0;

View file

@ -2850,8 +2850,8 @@ static void K_drawKartNameTags(void)
} }
v.x = R_InterpolateFixed(ntplayer->mo->old_x, ntplayer->mo->x); v.x = R_InterpolateFixed(ntplayer->mo->old_x, ntplayer->mo->x);
v.y = R_InterpolateFixed(ntplayer->mo->old_x, ntplayer->mo->x); v.y = R_InterpolateFixed(ntplayer->mo->old_y, ntplayer->mo->y);
v.z = R_InterpolateFixed(ntplayer->mo->old_x, ntplayer->mo->x); v.z = R_InterpolateFixed(ntplayer->mo->old_z, ntplayer->mo->z);
if (!(ntplayer->mo->eflags & MFE_VERTICALFLIP)) if (!(ntplayer->mo->eflags & MFE_VERTICALFLIP))
{ {

View file

@ -2230,19 +2230,19 @@ void K_KartMoveAnimation(player_t *player)
SINT8 destGlanceDir = 0; SINT8 destGlanceDir = 0;
SINT8 drift = player->drift; SINT8 drift = player->drift;
// Uses turning over steering -- it's important to show player feedback immediately.
if (player->cmd.turning < -minturn)
{
turndir = -1;
}
else if (player->cmd.turning > minturn)
{
turndir = 1;
}
if (!lookback) if (!lookback)
{ {
player->pflags &= ~PF_LOOKDOWN; player->pflags &= ~PF_LOOKDOWN;
// Uses turning over steering -- it's important to show player feedback immediately.
if (player->cmd.turning < -minturn)
{
turndir = -1;
}
else if (player->cmd.turning > minturn)
{
turndir = 1;
}
} }
else if (drift == 0) else if (drift == 0)
{ {

View file

@ -312,16 +312,13 @@ terrain_t *K_GetTerrainForTextureNum(INT32 textureNum)
--------------------------------------------------*/ --------------------------------------------------*/
terrain_t *K_GetTerrainForFlatNum(INT32 flatID) terrain_t *K_GetTerrainForFlatNum(INT32 flatID)
{ {
levelflat_t *levelFlat = NULL;
if (flatID < 0 || flatID >= (signed)numlevelflats) if (flatID < 0 || flatID >= (signed)numlevelflats)
{ {
// Clearly invalid floor... // Clearly invalid floor...
return NULL; return NULL;
} }
levelFlat = &levelflats[flatID]; return levelflats[flatID].terrain;
return K_GetTerrainForTextureName(levelFlat->name);
} }
/*-------------------------------------------------- /*--------------------------------------------------

View file

@ -3732,7 +3732,7 @@ stairstep:
tmymove = 0; tmymove = 0;
} }
if (!P_TryMove(mo, newx, newy, true)) { if (!P_TryMove(mo, newx, newy, true)) {
if (success) if (success || P_MobjWasRemoved(mo))
return; // Good enough!! return; // Good enough!!
else else
goto retry; goto retry;
@ -3856,6 +3856,9 @@ void P_BounceMove(mobj_t *mo)
INT32 hitcount; INT32 hitcount;
fixed_t mmomx = 0, mmomy = 0; fixed_t mmomx = 0, mmomy = 0;
if (P_MobjWasRemoved(mo))
return;
if (mo->player) if (mo->player)
{ {
P_BouncePlayerMove(mo); P_BouncePlayerMove(mo);
@ -3979,7 +3982,11 @@ bounceback:
mo->momy = tmymove; mo->momy = tmymove;
if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true)) if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true))
{
if (P_MobjWasRemoved(mo))
return;
goto retry; goto retry;
}
} }
// //

View file

@ -1694,6 +1694,8 @@ void P_XYMovement(mobj_t *mo)
else else
{ {
P_BounceMove(mo); P_BounceMove(mo);
if (P_MobjWasRemoved(mo))
return;
xmove = ymove = 0; xmove = ymove = 0;
S_StartSound(mo, mo->info->activesound); 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)) if (!P_SceneryTryMove(mo, mo->x + mo->momx, mo->y + mo->momy))
P_BounceMove(mo); 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)) if ((!(mo->eflags & MFE_VERTICALFLIP) && mo->z > mo->floorz) || (mo->eflags & MFE_VERTICALFLIP && mo->z+mo->height < mo->ceilingz))
return; // no friction when airborne return; // no friction when airborne
@ -10488,6 +10493,8 @@ void P_PrecipitationEffects(void)
boolean effects_lightning = (precipprops[curWeather].effects & PRECIPFX_LIGHTNING); boolean effects_lightning = (precipprops[curWeather].effects & PRECIPFX_LIGHTNING);
boolean lightningStrike = false; boolean lightningStrike = false;
boolean sounds_rain = (rainsfx != sfx_None && (!leveltime || leveltime % rainfreq == 1));
// No thunder except every other tic. // No thunder except every other tic.
if (!(leveltime & 1)) if (!(leveltime & 1))
{ {
@ -10532,29 +10539,48 @@ void P_PrecipitationEffects(void)
if (sound_disabled) if (sound_disabled)
return; // Sound off? D'aw, no fun. 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) if (players[g_localplayers[0]].mo->subsector->sector->ceilingpic == skyflatnum)
volume = 255; // Sky above? We get it full blast. volume = 255; // Sky above? We get it full blast.
else else
{ {
fixed_t x, y, yl, yh, xl, xh; INT64 x, y, yl, yh, xl, xh;
fixed_t closedist, newdist; fixed_t closedist, newdist;
// Essentially check in a 1024 unit radius of the player for an outdoor area. // Essentially check in a 1024 unit radius of the player for an outdoor area.
yl = players[g_localplayers[0]].mo->y - 1024*FRACUNIT; #define RADIUSSTEP (64*FRACUNIT)
yh = players[g_localplayers[0]].mo->y + 1024*FRACUNIT; #define SEARCHRADIUS (16*RADIUSSTEP)
xl = players[g_localplayers[0]].mo->x - 1024*FRACUNIT; yl = yh = players[g_localplayers[0]].mo->y;
xh = players[g_localplayers[0]].mo->x + 1024*FRACUNIT; yl -= SEARCHRADIUS;
closedist = 2048*FRACUNIT; while (yl < INT32_MIN)
for (y = yl; y <= yh; y += FRACUNIT*64) yl += RADIUSSTEP;
for (x = xl; x <= xh; x += FRACUNIT*64) 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) if (newdist < closedist)
closedist = newdist; closedist = newdist;
} }
} }
#undef RADIUSSTEP
volume = 255 - (closedist>>(FRACBITS+2)); volume = 255 - (closedist>>(FRACBITS+2));
} }
@ -10564,7 +10590,7 @@ void P_PrecipitationEffects(void)
else if (volume > 255) else if (volume > 255)
volume = 255; volume = 255;
if (rainsfx != sfx_None && (!leveltime || leveltime % rainfreq == 1)) if (sounds_rain)
S_StartSoundAtVolume(players[g_localplayers[0]].mo, rainsfx, volume); S_StartSoundAtVolume(players[g_localplayers[0]].mo, rainsfx, volume);
if (!sounds_thunder) if (!sounds_thunder)
@ -13319,4 +13345,4 @@ fixed_t P_GetMobjZMovement(mobj_t *mo)
speed = FixedHypot(mo->momx, mo->momy); speed = FixedHypot(mo->momx, mo->momy);
return P_ReturnThrustY(mo, slope->zangle, P_ReturnThrustX(mo, angDiff, speed)); return P_ReturnThrustY(mo, slope->zangle, P_ReturnThrustX(mo, angDiff, speed));
} }

View file

@ -4119,6 +4119,15 @@ static void P_RelinkPointers(void)
if (!(mobj->itnext = P_FindNewPosition(temp))) if (!(mobj->itnext = P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "itnext not found on %d\n", mobj->type); 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)
{ {
if ( mobj->player->awayviewmobj) if ( mobj->player->awayviewmobj)

View file

@ -661,6 +661,9 @@ flatfound:
levelflat->u.flat.baselumpnum = LUMPERROR; levelflat->u.flat.baselumpnum = LUMPERROR;
} }
levelflat->terrain =
K_GetTerrainForTextureName(levelflat->name);
CONS_Debug(DBG_SETUP, "flat #%03d: %s\n", atoi(sizeu1(numlevelflats)), levelflat->name); CONS_Debug(DBG_SETUP, "flat #%03d: %s\n", atoi(sizeu1(numlevelflats)), levelflat->name);
return ( numlevelflats++ ); return ( numlevelflats++ );

View file

@ -17,6 +17,7 @@
#include "doomdata.h" #include "doomdata.h"
#include "doomstat.h" #include "doomstat.h"
#include "r_defs.h" #include "r_defs.h"
#include "k_terrain.h"
// map md5, sent to players via PT_SERVERINFO // map md5, sent to players via PT_SERVERINFO
extern unsigned char mapmd5[16]; extern unsigned char mapmd5[16];
@ -71,6 +72,8 @@ typedef struct
UINT16 width, height; UINT16 width, height;
terrain_t *terrain;
// for flat animation // for flat animation
INT32 animseq; // start pos. in the anim sequence INT32 animseq; // start pos. in the anim sequence
INT32 numpics; INT32 numpics;

View file

@ -180,6 +180,7 @@ void R_DrawViewBorder(void);
void R_DrawColumn_8(void); void R_DrawColumn_8(void);
void R_DrawShadeColumn_8(void); void R_DrawShadeColumn_8(void);
void R_DrawTranslucentColumn_8(void); void R_DrawTranslucentColumn_8(void);
void R_DrawDropShadowColumn_8(void);
void R_DrawTranslatedColumn_8(void); void R_DrawTranslatedColumn_8(void);
void R_DrawTranslatedTranslucentColumn_8(void); void R_DrawTranslatedTranslucentColumn_8(void);
void R_Draw2sMultiPatchColumn_8(void); void R_Draw2sMultiPatchColumn_8(void);

View file

@ -566,6 +566,39 @@ void R_DrawTranslucentColumn_8(void)
} }
} }
// Hack: A cut-down copy of R_DrawTranslucentColumn_8 that does not read texture
// data since something about calculating the texture reading address for drop shadows is broken.
// dc_texturemid and dc_iscale get wrong values for drop shadows, however those are not strictly
// needed for the current design of the shadows, so this function bypasses the issue
// by not using those variables at all.
void R_DrawDropShadowColumn_8(void)
{
register INT32 count;
register UINT8 *dest;
count = dc_yh - dc_yl + 1;
if (count <= 0) // Zero length, column does not exceed a pixel.
return;
dest = &topleft[dc_yl*vid.width + dc_x];
{
#define DSCOLOR 15 // palette index for the color of the shadow
register const UINT8 *transmap_offset = dc_transmap + (dc_colormap[DSCOLOR] << 8);
#undef DSCOLOR
while ((count -= 2) >= 0)
{
*dest = *(transmap_offset + (*dest));
dest += vid.width;
*dest = *(transmap_offset + (*dest));
dest += vid.width;
}
if (count & 1)
*dest = *(transmap_offset + (*dest));
}
}
/** \brief The R_DrawTranslatedTranslucentColumn_8 function /** \brief The R_DrawTranslatedTranslucentColumn_8 function
Spiffy function. Not only does it colormap a sprite, but does translucency as well. Spiffy function. Not only does it colormap a sprite, but does translucency as well.
Uber-kudos to Cyan Helkaraxe Uber-kudos to Cyan Helkaraxe

View file

@ -84,8 +84,10 @@ void R_InterpolateView(fixed_t frac)
{ {
if (frac < 0) if (frac < 0)
frac = 0; frac = 0;
#if 0
if (frac > FRACUNIT) if (frac > FRACUNIT)
frac = FRACUNIT; frac = FRACUNIT;
#endif
viewx = oldview->x + R_LerpFixed(oldview->x, newview->x, frac); viewx = oldview->x + R_LerpFixed(oldview->x, newview->x, frac);
viewy = oldview->y + R_LerpFixed(oldview->y, newview->y, frac); viewy = oldview->y + R_LerpFixed(oldview->y, newview->y, frac);

View file

@ -836,7 +836,15 @@ static void R_DrawVisSprite(vissprite_t *vis)
dc_fullbright = colormaps; dc_fullbright = colormaps;
dc_translation = R_GetSpriteTranslation(vis); dc_translation = R_GetSpriteTranslation(vis);
if (R_SpriteIsFlashing(vis)) // Bosses "flash" // Hack: Use a special column function for drop shadows that bypasses
// invalid memory access crashes caused by R_ProjectDropShadow putting wrong values
// in dc_texturemid and dc_iscale when the shadow is sloped.
if (vis->cut & SC_SHADOW)
{
R_SetColumnFunc(COLDRAWFUNC_DROPSHADOW, false);
dc_transmap = vis->transmap;
}
else if (R_SpriteIsFlashing(vis)) // Bosses "flash"
R_SetColumnFunc(COLDRAWFUNC_TRANS, false); // translate certain pixels to white R_SetColumnFunc(COLDRAWFUNC_TRANS, false); // translate certain pixels to white
else if (vis->mobj->color && vis->transmap) // Color mapping else if (vis->mobj->color && vis->transmap) // Color mapping
{ {

View file

@ -133,6 +133,7 @@ void SCR_SetDrawFuncs(void)
colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumn_8; colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumn_8;
colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS] = R_Draw2sMultiPatchTranslucentColumn_8; colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS] = R_Draw2sMultiPatchTranslucentColumn_8;
colfuncs[COLDRAWFUNC_FOG] = R_DrawFogColumn_8; colfuncs[COLDRAWFUNC_FOG] = R_DrawFogColumn_8;
colfuncs[COLDRAWFUNC_DROPSHADOW] = R_DrawDropShadowColumn_8;
spanfuncs[SPANDRAWFUNC_TRANS] = R_DrawTranslucentSpan_8; spanfuncs[SPANDRAWFUNC_TRANS] = R_DrawTranslucentSpan_8;
spanfuncs[SPANDRAWFUNC_TILTED] = R_DrawTiltedSpan_8; spanfuncs[SPANDRAWFUNC_TILTED] = R_DrawTiltedSpan_8;

View file

@ -131,6 +131,7 @@ enum
COLDRAWFUNC_TWOSMULTIPATCH, COLDRAWFUNC_TWOSMULTIPATCH,
COLDRAWFUNC_TWOSMULTIPATCHTRANS, COLDRAWFUNC_TWOSMULTIPATCHTRANS,
COLDRAWFUNC_FOG, COLDRAWFUNC_FOG,
COLDRAWFUNC_DROPSHADOW,
COLDRAWFUNC_MAX COLDRAWFUNC_MAX
}; };

View file

@ -1658,11 +1658,10 @@ tic_t I_GetTime(void)
return (tic_t)f; return (tic_t)f;
} }
fixed_t I_GetTimeFrac(void) float I_GetTimeFrac(void)
{ {
UpdateElapsedTics(); UpdateElapsedTics();
return elapsed_tics;
return FLOAT_TO_FIXED((float) (elapsed_tics - floor(elapsed_tics)));
} }
precise_t I_GetPreciseTime(void) precise_t I_GetPreciseTime(void)

View file

@ -517,7 +517,7 @@ static inline void I_SetChannels(void)
} }
} }
void I_SetSfxVolume(UINT8 volume) void I_SetSfxVolume(int volume)
{ {
INT32 i; INT32 i;
@ -1466,7 +1466,7 @@ void I_ResumeSong(void)
#endif #endif
} }
void I_SetMusicVolume(UINT8 volume) void I_SetMusicVolume(int volume)
{ {
(void)volume; (void)volume;
} }
@ -1477,6 +1477,9 @@ boolean I_SetSongTrack(int track)
return false; return false;
} }
void I_UpdateSongLagThreshold(void){}
void I_UpdateSongLagConditions(void){}
/// ------------------------ /// ------------------------
/// MUSIC FADING /// MUSIC FADING
/// ------------------------ /// ------------------------