diff --git a/src/Makefile.d/win32.mk b/src/Makefile.d/win32.mk index ec66107d4..83edc3c45 100644 --- a/src/Makefile.d/win32.mk +++ b/src/Makefile.d/win32.mk @@ -8,6 +8,11 @@ else EXENAME?=srb2kart64.exe endif +# disable dynamicbase if under msys2 +ifdef MSYSTEM +libs+=-Wl,--disable-dynamicbase +endif + sources+=win32/Srb2win.rc opts+=-DSTDC_HEADERS libs+=-ladvapi32 -lkernel32 -lmsvcrt -luser32 diff --git a/src/f_finale.c b/src/f_finale.c index eff9ed3f7..0fc575e8e 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -345,16 +345,6 @@ static void F_IntroDrawScene(void) // DRAW A FULL PIC INSTEAD OF FLAT! 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); highres = true; } @@ -453,6 +443,20 @@ void F_IntroTicker(void) 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(); // check for skipping diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 13d31dc14..74f13ff0e 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -6751,7 +6751,6 @@ void HWR_DoPostProcessor(player_t *player) // 10 by 10 grid. 2 coordinates (xy) float v[SCREENVERTS][SCREENVERTS][2]; static double disStart = 0; - static fixed_t last_fractime = 0; UINT8 x, y; INT32 WAVELENGTH; @@ -6761,15 +6760,15 @@ void HWR_DoPostProcessor(player_t *player) // Modifies the wave. if (*type == postimg_water) { - WAVELENGTH = 20; // Lower is longer - AMPLITUDE = 20; // Lower is bigger - FREQUENCY = 16; // Lower is faster + WAVELENGTH = 5; + AMPLITUDE = 20; + FREQUENCY = 8; } else { - WAVELENGTH = 10; // Lower is longer - AMPLITUDE = 30; // Lower is bigger - FREQUENCY = 4; // Lower is faster + WAVELENGTH = 10; + AMPLITUDE = 60; + FREQUENCY = 4; } for (x = 0; x < SCREENVERTS; x++) @@ -6783,16 +6782,7 @@ void HWR_DoPostProcessor(player_t *player) } HWD.pfnPostImgRedraw(v); if (!(paused || P_AutoPause())) - disStart += 1; - 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; + disStart += FIXED_TO_FLOAT(renderdeltatics); // Capture the screen again for screen waving on the intermission if(gamestate != GS_INTERMISSION) diff --git a/src/k_bot.c b/src/k_bot.c index 24f3517a2..44f9c27c2 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -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) { - 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 tic_t futuresight = (TICRATE * normal) / max(1, handling); // How far ahead into the future to try and predict diff --git a/src/k_botitem.c b/src/k_botitem.c index 4bb83931c..90e3d8172 100644 --- a/src/k_botitem.c +++ b/src/k_botitem.c @@ -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) { + const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed)); + if (abs(turnamt) >= KART_FULLTURN/2) { // 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. - if (K_PlayerInCone(player, player->mo->radius * 16, 10, true) != NULL) + if (K_PlayerInCone(player, coneDist, 15, true) != NULL) { 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) { + const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed)); SINT8 throwdir = -1; + boolean tryLookback = false; player_t *target = NULL; player->botvars.itemconfirm++; - target = K_PlayerInCone(player, player->mo->radius * 16, 10, true); + target = K_PlayerInCone(player, coneDist, 15, true); if (target != NULL) { K_ItemConfirmForTarget(player, target, player->botvars.difficulty); throwdir = -1; + tryLookback = true; } 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); } @@ -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) { + const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed)); SINT8 throwdir = 0; + boolean tryLookback = false; player_t *target = NULL; player->botvars.itemconfirm++; - target = K_PlayerInCone(player, player->mo->radius * 16, 10, true); + target = K_PlayerInCone(player, coneDist, 15, true); if (target != NULL) { 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; throwdir = -1; + tryLookback = true; } 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); } @@ -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) { + const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed)); player_t *target = NULL; 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; } - target = K_PlayerInCone(player, player->mo->radius * 16, 10, true); + target = K_PlayerInCone(player, coneDist, 15, true); if (target != NULL) { 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); } @@ -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) { + const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed)); const UINT8 stealth = K_EggboxStealth(player->mo->x, player->mo->y); SINT8 throwdir = -1; + boolean tryLookback = false; player_t *target = NULL; player->botvars.itemconfirm++; @@ -688,11 +710,12 @@ static void K_BotItemEggman(player_t *player, ticcmd_t *cmd) throwdir = 1; } - target = K_PlayerInCone(player, player->mo->radius * 16, 10, true); + target = K_PlayerInCone(player, coneDist, 15, true); if (target != NULL) { K_ItemConfirmForTarget(player, target, player->botvars.difficulty); throwdir = -1; + tryLookback = true; } if (stealth > 1 || player->itemroulette > 0) @@ -701,7 +724,12 @@ static void K_BotItemEggman(player_t *player, ticcmd_t *cmd) 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); } @@ -720,6 +748,7 @@ static void K_BotItemEggman(player_t *player, ticcmd_t *cmd) --------------------------------------------------*/ 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); player_t *target = NULL; @@ -737,7 +766,7 @@ static boolean K_BotRevealsEggbox(player_t *player) } // Check your behind. - target = K_PlayerInCone(player, player->mo->radius * 16, 10, true); + target = K_PlayerInCone(player, coneDist, 15, true); if (target != NULL) { 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) { 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; + boolean tryLookback = false; UINT8 snipeMul = 2; player_t *target = NULL; @@ -823,24 +853,30 @@ static void K_BotItemOrbinaut(player_t *player, ticcmd_t *cmd) player->botvars.itemconfirm++; - target = K_PlayerInCone(player, radius, 10, false); + target = K_PlayerInCone(player, radius, 15, false); if (target != NULL) { K_ItemConfirmForTarget(player, target, player->botvars.difficulty * snipeMul); 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) { K_ItemConfirmForTarget(player, target, player->botvars.difficulty); 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); } @@ -861,8 +897,9 @@ static void K_BotItemOrbinaut(player_t *player, ticcmd_t *cmd) static void K_BotItemJawz(player_t *player, ticcmd_t *cmd) { 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; + boolean tryLookback = false; UINT8 snipeMul = 2; INT32 lastTarg = player->lastjawztarget; player_t *target = NULL; @@ -875,11 +912,12 @@ static void K_BotItemJawz(player_t *player, ticcmd_t *cmd) player->botvars.itemconfirm++; - target = K_PlayerInCone(player, radius, 10, true); + target = K_PlayerInCone(player, radius, 15, true); if (target != NULL) { K_ItemConfirmForTarget(player, target, player->botvars.difficulty); throwdir = -1; + tryLookback = true; } 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); } @@ -1007,7 +1050,7 @@ static void K_BotItemBubble(player_t *player, ticcmd_t *cmd) } else if (player->bubbleblowup >= bubbletime) { - if (player->botvars.itemconfirm >= 10*TICRATE) + if (player->botvars.itemconfirm > 10*TICRATE) { hold = true; } diff --git a/src/k_botsearch.c b/src/k_botsearch.c index 846521e6f..a06eb55f1 100644 --- a/src/k_botsearch.c +++ b/src/k_botsearch.c @@ -619,7 +619,7 @@ void K_NudgePredictionTowardsObjects(botprediction_t *predict, player_t *player) fixed_t avgX = 0, avgY = 0; fixed_t avgDist = 0; - const fixed_t baseNudge = 128 * mapobjectscale; + const fixed_t baseNudge = predict->radius; fixed_t maxNudge = distToPredict; fixed_t nudgeDist = 0; angle_t nudgeDir = 0; diff --git a/src/k_kart.c b/src/k_kart.c index bd6924e12..b9fff95ba 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2231,19 +2231,19 @@ void K_KartMoveAnimation(player_t *player) SINT8 destGlanceDir = 0; 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) { 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) { diff --git a/src/p_map.c b/src/p_map.c index 8fb58cd0a..fb79b6677 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -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; + } } // diff --git a/src/p_mobj.c b/src/p_mobj.c index f3d326862..25f4f0fe6 100644 --- a/src/p_mobj.c +++ b/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)); -} \ No newline at end of file +} diff --git a/src/p_saveg.c b/src/p_saveg.c index 7710ee0de..6aff9a33f 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -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) diff --git a/src/r_draw.h b/src/r_draw.h index 7b44d6185..741ddcc2a 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -180,6 +180,7 @@ void R_DrawViewBorder(void); void R_DrawColumn_8(void); void R_DrawShadeColumn_8(void); void R_DrawTranslucentColumn_8(void); +void R_DrawDropShadowColumn_8(void); void R_DrawTranslatedColumn_8(void); void R_DrawTranslatedTranslucentColumn_8(void); void R_Draw2sMultiPatchColumn_8(void); diff --git a/src/r_draw8.c b/src/r_draw8.c index 0dd8463f6..61b22bc66 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -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 Spiffy function. Not only does it colormap a sprite, but does translucency as well. Uber-kudos to Cyan Helkaraxe diff --git a/src/r_things.c b/src/r_things.c index 97d45d62d..4779e4df8 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -836,7 +836,15 @@ static void R_DrawVisSprite(vissprite_t *vis) dc_fullbright = colormaps; 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 else if (vis->mobj->color && vis->transmap) // Color mapping { diff --git a/src/screen.c b/src/screen.c index 25dcbb1f7..5ca870cfe 100644 --- a/src/screen.c +++ b/src/screen.c @@ -133,6 +133,7 @@ void SCR_SetDrawFuncs(void) colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumn_8; colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS] = R_Draw2sMultiPatchTranslucentColumn_8; colfuncs[COLDRAWFUNC_FOG] = R_DrawFogColumn_8; + colfuncs[COLDRAWFUNC_DROPSHADOW] = R_DrawDropShadowColumn_8; spanfuncs[SPANDRAWFUNC_TRANS] = R_DrawTranslucentSpan_8; spanfuncs[SPANDRAWFUNC_TILTED] = R_DrawTiltedSpan_8; diff --git a/src/screen.h b/src/screen.h index 66c52dd67..f279e8444 100644 --- a/src/screen.h +++ b/src/screen.h @@ -131,6 +131,7 @@ enum COLDRAWFUNC_TWOSMULTIPATCH, COLDRAWFUNC_TWOSMULTIPATCHTRANS, COLDRAWFUNC_FOG, + COLDRAWFUNC_DROPSHADOW, COLDRAWFUNC_MAX };