diff --git a/src/f_finale.c b/src/f_finale.c index 2d9a45e8c..cd72cc122 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -166,30 +166,31 @@ static void F_SkyScroll(INT32 scrollspeed) pat = W_CachePatchName("TITLEBG1", PU_CACHE); pat2 = W_CachePatchName("TITLEBG2", PU_CACHE); - w = vid.width / vid.dupx; + w = (vid.width / vid.dupx)<width); - anim2 = SHORT(pat2->width) - (((finalecount*scrollspeed)/16) % SHORT(pat2->width)); + // The scroll offset MUST be clamped before shifting by FRACBITS, or else it'll overflow in about 3 minutes + animtimer = ((((finalecount * scrollspeed) % (SHORT(pat->width)*16))<width)<width)*16))<width); + V_DrawFixedPatch(x, y, FRACUNIT, V_SNAPTOTOP|V_SNAPTOLEFT, pat, NULL); + x += SHORT(pat->width)<height); + y = (BASEVIDHEIGHT - SHORT(pat2->height))<width); + V_DrawFixedPatch(x, y, FRACUNIT, V_SNAPTOBOTTOM|V_SNAPTOLEFT, pat2, NULL); + x += SHORT(pat2->width)<= 20) V_DrawSmallScaledPatch(84, 87, 0, ttkart); else if (finalecount >= 10) - V_DrawSciencePatch((84<x = -1; - vec->y = -1; - // this should never happen but its also kart so ¯\_(ツ)_/¯ - if (!player || !target || !came) - return; - - if (player->awayviewtics) { - camx = player->awayviewmobj->x; - camy = player->awayviewmobj->y; - camz = player->awayviewmobj->z; - camangle = player->awayviewmobj->angle; - camaiming = player->awayviewaiming; - } - else if (came->chase) { - camx = came->x; - camy = came->y; - camz = came->z + (player->mo->eflags & MFE_VERTICALFLIP && came->height); - camangle = came->angle; - camaiming = came->aiming; - } - else { - camx = player->mo->x; - camy = player->mo->y; - camz = player->viewz; - camangle = player->mo->angle; - camaiming = player->aiming; - } + if (!player || !target) + return false; xres = vid.width<<(FRACBITS-1); yres = vid.height<<(FRACBITS-1); fov = FixedDiv(xres, FINETANGENT(((FixedAngle(cv_fov.value/2)+ANGLE_90)>>ANGLETOFINESHIFT) & 4095)); + fixed_t targx = lerp(target->old_x, target->x); + fixed_t targy = lerp(target->old_y, target->y); + fixed_t targz = lerp(target->old_z, target->z); + // X coordinate // get difference between camangle and angle towards target - x = (INT32)camangle - (INT32)R_PointToAngle2(camx, camy, target->x, target->y); + x = (INT32)viewangle - (INT32)R_PointToAngle(targx, targy); distfact = FINECOSINE((x>>ANGLETOFINESHIFT) & FINEMASK); if (!distfact) distfact = 1; @@ -9015,7 +8999,7 @@ static void K_GetScreenCoords(vector2_t *vec, player_t *player, camera_t *came, if (encoremode) x = -x; if (x < (fixed_t)ANGLE_270 || x > (fixed_t)ANGLE_90) - return; + return false; // flipping targflip = target->eflags & MFE_VERTICALFLIP; @@ -9024,12 +9008,12 @@ static void K_GetScreenCoords(vector2_t *vec, player_t *player, camera_t *came, // Y coordinate // getting the angle difference here is a bit more involved... // start by getting the height difference between the camera and target - y = camz - target->z - (targflip ? target->height/1.5 : 0); // for some reason needs to be divided by 1.5 idk + y = viewz - targz - (targflip ? target->height/1.5 : 0); // for some reason needs to be divided by 1.5 idk if (hofs) y = y - (targflip ? -hofs : hofs); // then get the distance between camera and target - dist = R_PointToDist2(camx, camy, target->x, target->y); + dist = R_PointToDist(targx, targy); #ifdef HWRENDER // NOW we can get the angle differnce @@ -9037,10 +9021,10 @@ static void K_GetScreenCoords(vector2_t *vec, player_t *player, camera_t *came, { angle_t yang = R_PointToAngle2(0, 0, dist, y); // not perspective x = FixedMul(x, FINECOSINE((yang>>ANGLETOFINESHIFT) & FINEMASK)); // perspective - y = -camaiming - FixedDiv(yang, distfact); + y = -aimingangle - FixedDiv(yang, distfact); if (y < (fixed_t)ANGLE_270 || y > (fixed_t)ANGLE_90) // clip points behind the camera - return; + return false; if (splitscreen == 1) // multiply by 1.25 for 2P splitscreen y = y + (y/4) ; if (srcflip) // flipcam @@ -9060,7 +9044,7 @@ static void K_GetScreenCoords(vector2_t *vec, player_t *player, camera_t *came, y = FixedMul(FixedDiv(y, fovratio), xres) + yres; //else print("NOPE!") - offset = FixedMul(FINETANGENT(((camaiming+ANGLE_90)>>ANGLETOFINESHIFT) & 4095), xres); + offset = FixedMul(FINETANGENT(((aimingangle+ANGLE_90)>>ANGLETOFINESHIFT) & 4095), xres); // this isn't fovtan... what am i even doing anymore if (splitscreen == 1) offset = 17*offset/10; @@ -9084,7 +9068,7 @@ static void K_GetScreenCoords(vector2_t *vec, player_t *player, camera_t *came, // now clip in screen-space if (!dontclip && (x < 0 || x > xres*2 || y < 0 || y > yres*2)) - return; + return false; // get splitscreen index int splitindex = stplyrnum; @@ -9106,6 +9090,7 @@ static void K_GetScreenCoords(vector2_t *vec, player_t *player, camera_t *came, vec->y = y; vec->x = x; + return true; } //Slighty fixed by Alug and further rewritten by NepDisk @@ -9128,7 +9113,7 @@ static void K_drawNameTags(void) INT32 hudtransflag = V_LocalTransFlag(); boolean flipcam; - if (!stplyr->mo || (stplyr->spectator && !cv_shownametagspectator.value) || splitscreen || (stplyr->exiting && !cv_shownametagfinish.value)) + if (!stplyr->mo || (stplyr->spectator && !cv_shownametagspectator.value) || (stplyr->exiting && !cv_shownametagfinish.value)) return; // True if currently viewed player is flipped and has flipcam on @@ -9146,9 +9131,9 @@ static void K_drawNameTags(void) continue; if (!players[i].mo || P_MobjWasRemoved(players[i].mo) || players[i].spectator || !playeringame[i]) continue; - if (i == displayplayers[0] && !cv_showownnametag.value && !(leveltime < 130)) + if (i == stplyrnum && !cv_showownnametag.value && !(leveltime < 130)) continue; - if (!(i == displayplayers[0]) && leveltime < starttime) + if (i != stplyrnum && leveltime < starttime) continue; if (players[i].kartstuff[k_hyudorotimer]) // player is invisible continue; @@ -9207,12 +9192,9 @@ static void K_drawNameTags(void) //Saltyhop hehe if (cv_saltyhop.value && cv_nametaghop.value) - z += players[i].mo->spriteyoffset; + z += lerp(players[i].mo->old_spriteyoffset, players[i].mo->spriteyoffset); - K_GetScreenCoords(&pos, stplyr, camera, players[i].mo, z, false); - - //Check for negative screencoords - if (pos.x == -1 || pos.y == -1) + if (!K_GetScreenCoords(&pos, stplyr, players[i].mo, z, false)) continue; tagsdisplayed += 1; @@ -9348,7 +9330,7 @@ static void K_drawDriftGauge(void) INT32 drifttrans = 0; INT32 hudtransflag = V_LocalTransFlag(); int dup = vid.dupx; - int i,j; + int i; UINT8 driftcolors[3][4] = { {0, 0, 10, 16}, // no drift @@ -9369,17 +9351,7 @@ static void K_drawDriftGauge(void) if (!stplyr->mo || !stplyr->kartstuff[k_drift] || (!splitscreen && !camera->chase)) return; - if (!splitscreen) - K_GetScreenCoords(&pos, stplyr, camera, stplyr->mo, FixedMul(cv_driftgaugeofs.value, cv_driftgaugeofs.value > 0 ? stplyr->mo->scale : mapobjectscale), false); - else - { - //Loop through each player camera for splitscreen. - for (j = 0; j <= stplyrnum; j++) - K_GetScreenCoords(&pos, stplyr, &camera[j], stplyr->mo, FixedMul(cv_driftgaugeofs.value, cv_driftgaugeofs.value > 0 ? stplyr->mo->scale : mapobjectscale), false); - } - - //Check for negative screencoords - if (pos.x == -1 || pos.y == -1) + if (!K_GetScreenCoords(&pos, stplyr, stplyr->mo, FixedMul(cv_driftgaugeofs.value, cv_driftgaugeofs.value > 0 ? stplyr->mo->scale : mapobjectscale), false)) return; basex = pos.x>>FRACBITS; @@ -9683,8 +9655,8 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat yscale = FixedDiv(AutomapPic->height, mapheight); zoom = FixedMul(min(xscale, yscale), FRACUNIT-FRACUNIT/20); - amnumxpos = (FixedMul(mo->x, zoom) - FixedMul(xoffset, zoom)); - amnumypos = -(FixedMul(mo->y, zoom) - FixedMul(yoffset, zoom)); + amnumxpos = (FixedMul(lerp(mo->old_x, mo->x), zoom) - FixedMul(xoffset, zoom)); + amnumypos = -(FixedMul(lerp(mo->old_y, mo->y), zoom) - FixedMul(yoffset, zoom)); if (encoremode) amnumxpos = -amnumxpos; @@ -9724,6 +9696,8 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat } } +#undef lerp + static void K_drawKartMinimap(void) { INT32 lumpnum; @@ -9899,7 +9873,7 @@ static void K_drawKartFinish(void) x = ((vid.width<width)<kartstuff[k_cardanimation])*(xval > x ? xval : x))/TICRATE; + x = (FixedMul(((TICRATE - stplyr->kartstuff[k_cardanimation])< x ? xval : x))/TICRATE; if (splitscreen && stplyr == &players[displayplayers[1]]) x = -x; @@ -9913,8 +9887,20 @@ static void K_drawKartFinish(void) static void K_drawBattleFullscreen(void) { + INT32 cardanim = stplyr->kartstuff[k_cardanimation] << FRACBITS; + + // fill in the fractional bits + if (cardanim && cardanim != 164*FRACUNIT) + { + INT32 frac = R_GetHudUncap() * ((164 - stplyr->kartstuff[k_cardanimation])/8 + 1); + if (stplyr->exiting) + cardanim += frac; + else + cardanim += stplyr->kartstuff[k_comebacktimer] < 6*TICRATE ? -frac : frac; + } + INT32 x = BASEVIDWIDTH/2; - INT32 y = -64+(stplyr->kartstuff[k_cardanimation]); // card animation goes from 0 to 164, 164 is the middle of the screen + INT32 y = (-64*FRACUNIT) + cardanim; // card animation goes from 0 to 164, 164 is the middle of the screen INT32 splitflags = V_SNAPTOTOP; // I don't feel like properly supporting non-green resolutions, so you can have a misuse of SNAPTO instead fixed_t scale = FRACUNIT; boolean drawcomebacktimer = true; // lazy hack because it's cleaner in the long run. @@ -9924,22 +9910,19 @@ static void K_drawBattleFullscreen(void) if (splitscreen) { - if ((splitscreen == 1 && stplyr == &players[displayplayers[1]]) - || (splitscreen > 1 && (stplyr == &players[displayplayers[2]] - || (stplyr == &players[displayplayers[3]] && splitscreen > 2)))) + if ((splitscreen == 1 && stplyrnum == 1) || (splitscreen > 1 && stplyrnum & 2)) { - y = 232-(stplyr->kartstuff[k_cardanimation]/2); + y = (232*FRACUNIT) - (cardanim/2); splitflags = V_SNAPTOBOTTOM; } else - y = -32+(stplyr->kartstuff[k_cardanimation]/2); + y = (-32*FRACUNIT) + (cardanim/2); if (splitscreen > 1) { scale /= 2; - if (stplyr == &players[displayplayers[1]] - || (stplyr == &players[displayplayers[3]] && splitscreen > 2)) + if (stplyrnum & 1) x = 3*BASEVIDWIDTH/4; else x = BASEVIDWIDTH/4; @@ -9948,7 +9931,7 @@ static void K_drawBattleFullscreen(void) { if (stplyr->exiting) { - if (stplyr == &players[displayplayers[1]]) + if (stplyrnum == 1) x = BASEVIDWIDTH-96; else x = 96; @@ -9960,14 +9943,14 @@ static void K_drawBattleFullscreen(void) if (stplyr->exiting) { - if (stplyr == &players[displayplayers[0]]) + if (stplyrnum == 0) V_DrawFadeScreen(0xFF00, 16); if (stplyr->exiting < 6*TICRATE && !stplyr->spectator) { if (stplyr->kartstuff[k_position] == 1) - V_DrawFixedPatch(x< 1) ty = (BASEVIDHEIGHT/4)+33; - if ((splitscreen == 1 && stplyr == &players[displayplayers[1]]) - || (stplyr == &players[displayplayers[2]] && splitscreen > 1) - || (stplyr == &players[displayplayers[3]] && splitscreen > 2)) + if ((splitscreen == 1 && stplyrnum == 1) || (splitscreen > 1 && stplyrnum & 2)) ty += (BASEVIDHEIGHT/2); } else V_DrawFadeScreen(0xFF00, 16); if (!comebackshowninfo) - V_DrawFixedPatch(x< 1) V_DrawString(x-txoff, ty, 0, va("%d", stplyr->kartstuff[k_comebacktimer]/TICRATE)); @@ -10197,7 +10178,8 @@ static void K_drawInput(void) static INT32 pn = 0; INT32 target = 0, splitflags = (V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS); - INT32 x = BASEVIDWIDTH - 32 + cv_posi_xoffset.value, y = BASEVIDHEIGHT-24 + cv_posi_yoffset.value, offs, col; + INT32 x = (BASEVIDWIDTH - 32 + cv_posi_xoffset.value)*FRACUNIT, y = (BASEVIDHEIGHT - 24 + cv_posi_yoffset.value)*FRACUNIT; + INT32 offs, col; const INT32 accent1 = splitflags|colortranslations[K_GetHudColor()][5]; const INT32 accent2 = splitflags|colortranslations[K_GetHudColor()][9]; ticcmd_t *cmd = &stplyr->cmd; @@ -10208,10 +10190,12 @@ static void K_drawInput(void) if (timeinmap < 113) { INT32 count = ((INT32)(timeinmap) - 105); - offs = 64; + INT32 frac = count > 0 && count < 6 ? R_GetHudUncap() << (FRACBITS - count - 11) : 0; + + offs = 64*FRACUNIT; while (count-- > 0) offs >>= 1; - x += offs; + x += (offs < FRACUNIT ? 0 : offs) - frac; } #define BUTTW 8 @@ -10220,17 +10204,17 @@ static void K_drawInput(void) #define drawbutt(xoffs, butt, symb)\ if (stplyr->cmd.buttons & butt)\ {\ - offs = 2;\ + offs = 2*FRACUNIT;\ col = accent1;\ }\ else\ {\ offs = 0;\ col = accent2;\ - V_DrawFill(x+(xoffs), y+BUTTH, BUTTW-1, 2, splitflags|31);\ + V_DrawFill((x + xoffs*FRACUNIT)>>FRACBITS, (y + BUTTH*FRACUNIT)>>FRACBITS, BUTTW-1, 2, splitflags|31);\ }\ - V_DrawFill(x+(xoffs), y+offs, BUTTW-1, BUTTH, col);\ - V_DrawFixedPatch((x+1+(xoffs))<>FRACBITS, (y+offs)>>FRACBITS, BUTTW-1, BUTTH, col);\ + V_DrawFixedPatch(x + FRACUNIT + xoffs*FRACUNIT, y + offs + FRACUNIT, FRACUNIT, splitflags, tny_font[symb-HU_FONTSTART], NULL) drawbutt(-2*BUTTW, BT_ACCELERATE, 'A'); drawbutt( -BUTTW, BT_BRAKE, 'B'); @@ -10242,7 +10226,7 @@ static void K_drawInput(void) #undef BUTTW #undef BUTTH - y -= 1; + y -= FRACUNIT; if (!cmd->driftturn) // no turn target = 0; @@ -10268,7 +10252,7 @@ static void K_drawInput(void) if (pn < 0) { splitflags |= V_FLIP; // right turn - x--; + x -= FRACUNIT; } target = abs(pn); @@ -10276,12 +10260,12 @@ static void K_drawInput(void) target = 4; if (!K_GetHudColor()) - V_DrawFixedPatch(x<kartstuff[k_lapanimation]; UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE); + INT32 vflags = V_SNAPTOTOP|V_HUDTRANS; - V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT, - (48 - (32*max(0, progress-76)))*FRACUNIT, - FRACUNIT, V_SNAPTOTOP|V_HUDTRANS, - (modeattacking ? kp_lapanim_emblem[1] : kp_lapanim_emblem[0]), colormap); + fixed_t slideout = max(0, 32*(((progress - 76)*FRACUNIT) + R_GetHudUncap())); + fixed_t slidein = max(0, 32*(((stplyr->kartstuff[k_lapanimation] - 76)*FRACUNIT) - R_GetHudUncap())); - if (stplyr->kartstuff[k_laphand] >= 1 && stplyr->kartstuff[k_laphand] <= 3) + // First, draw the emblem and hand + INT32 emblemx = (BASEVIDWIDTH << (FRACBITS - 1)) + slidein; + INT32 y = 48*FRACUNIT - slideout; + + V_DrawFixedPatch(emblemx, y, FRACUNIT, vflags, kp_lapanim_emblem[modeattacking ? 1 : 0], colormap); + + INT32 hand = stplyr->kartstuff[k_laphand]; + if (hand >= 1 && hand <= 3) { - V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT, - (48 - (32*max(0, progress-76)) - + 4 - abs((signed)((leveltime % 8) - 4)))*FRACUNIT, - FRACUNIT, V_SNAPTOTOP|V_HUDTRANS, - kp_lapanim_hand[stplyr->kartstuff[k_laphand]-1], NULL); + y += 4*FRACUNIT - abs((int)(leveltime % 8)*FRACUNIT + R_GetHudUncap() - 4*FRACUNIT); + V_DrawFixedPatch(emblemx, y, FRACUNIT, vflags, kp_lapanim_hand[hand - 1], NULL); } + // Then the text + INT32 leftx = 82*FRACUNIT - slideout; + INT32 rightx = 188*FRACUNIT + slideout; + y = 30*FRACUNIT; + if (stplyr->laps == (UINT8)(cv_numlaps.value - 1)) { - V_DrawFixedPatch((62 - (32*max(0, progress-76)))*FRACUNIT, // 27 - 30*FRACUNIT, // 24 - FRACUNIT, V_SNAPTOTOP|V_HUDTRANS, - kp_lapanim_final[min(progress/2, 10)], NULL); + // FINAL + V_DrawFixedPatch(leftx - 20*FRACUNIT, y, FRACUNIT, vflags, kp_lapanim_final[min(progress/2, 10)], NULL); - if (progress/2-12 >= 0) - { - V_DrawFixedPatch((188 + (32*max(0, progress-76)))*FRACUNIT, // 194 - 30*FRACUNIT, // 24 - FRACUNIT, V_SNAPTOTOP|V_HUDTRANS, - kp_lapanim_lap[min(progress/2-12, 6)], NULL); - } + // LAP + if (progress/2 - 12 >= 0) + V_DrawFixedPatch(rightx, y, FRACUNIT, vflags, kp_lapanim_lap[min(progress/2 - 12, 6)], NULL); } else { - V_DrawFixedPatch((82 - (32*max(0, progress-76)))*FRACUNIT, // 61 - 30*FRACUNIT, // 24 - FRACUNIT, V_SNAPTOTOP|V_HUDTRANS, - kp_lapanim_lap[min(progress/2, 6)], NULL); + // LAP + V_DrawFixedPatch(leftx, y, FRACUNIT, vflags, kp_lapanim_lap[min(progress/2, 6)], NULL); - if (progress/2-8 >= 0) + char *lapnum = va("%02d", stplyr->laps + 1); + for (int i = 0; i < (int)strlen(lapnum); i++) { - V_DrawFixedPatch((188 + (32*max(0, progress-76)))*FRACUNIT, // 194 - 30*FRACUNIT, // 24 - FRACUNIT, V_SNAPTOTOP|V_HUDTRANS, - kp_lapanim_number[(((UINT32)stplyr->laps+1) / 10)][min(progress/2-8, 2)], NULL); - - if (progress/2-10 >= 0) - { - V_DrawFixedPatch((208 + (32*max(0, progress-76)))*FRACUNIT, // 221 - 30*FRACUNIT, // 24 - FRACUNIT, V_SNAPTOTOP|V_HUDTRANS, - kp_lapanim_number[(((UINT32)stplyr->laps+1) % 10)][min(progress/2-10, 2)], NULL); - } + int digit = lapnum[i] - '0'; + int frame = min(2, progress/2 - 8 - (i*2)); + if (frame >= 0) + V_DrawFixedPatch(rightx + (i*20*FRACUNIT), y, FRACUNIT, vflags, kp_lapanim_number[digit][frame], NULL); } } } @@ -10594,7 +10571,7 @@ void K_drawKartHUD(void) if (demo.title) // Draw title logo instead in demo.titles { - INT32 x = BASEVIDWIDTH - 32, y = 128, offs; + INT32 x = (BASEVIDWIDTH - 32)*FRACUNIT, y = 128*FRACUNIT, offs; if (splitscreen == 3) { @@ -10605,14 +10582,16 @@ void K_drawKartHUD(void) if (timeinmap < 113) { INT32 count = ((INT32)(timeinmap) - 104); - offs = 256; + INT32 frac = count > 0 ? R_GetHudUncap() << max(0, FRACBITS - count - 9) : 0; + + offs = 256*FRACUNIT; while (count-- > 0) offs >>= 1; - x += offs; + x += offs - frac; } - V_DrawTinyScaledPatch(x-54, y, 0, W_CachePatchName("TTKBANNR", PU_CACHE)); - V_DrawTinyScaledPatch(x-54, y+25, 0, W_CachePatchName("TTKART", PU_CACHE)); + V_DrawSciencePatch(x - (54*FRACUNIT), y, 0, W_CachePatchName("TTKBANNR", PU_CACHE), FRACUNIT/4); + V_DrawSciencePatch(x - (54*FRACUNIT), y + (25*FRACUNIT), 0, W_CachePatchName("TTKART", PU_CACHE), FRACUNIT/4); } else if (G_RaceGametype()) // Race-only elements { diff --git a/src/m_menu.c b/src/m_menu.c index c6e75055d..a13c21c7f 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2004,6 +2004,8 @@ static menuitem_t OP_SaturnMenu[] = {IT_STRING | IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 90}, {IT_STRING | IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 95}, + {IT_STRING | IT_CVAR, NULL, "Uncapped HUD", &cv_uncappedhud, 105}, + {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 115}, {IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 125}, @@ -2031,7 +2033,7 @@ static const char* OP_SaturnTooltips[] = "Show Localskin Menus.", "Nametag Options.", "Driftgauge Options.", - "Use your native Keyboard Layout.", + "Uncaps the HUD framerate, making it appear smoother.", "Disables the flicker effect on Midnight Channel.", "Options for sprite distortion effects.", "Move position of HUD elements.", @@ -2057,7 +2059,7 @@ enum sm_showlocalskin, sm_nametagmen, sm_driftgaugemen, - sm_nativkey, + sm_uncappedhud, sm_pisschannel, sm_distortionmenu, sm_hudoffsets, diff --git a/src/r_fps.c b/src/r_fps.c index 14c75e8fd..44518ea4d 100644 --- a/src/r_fps.c +++ b/src/r_fps.c @@ -146,7 +146,7 @@ static void R_SetupFreelook(void) #undef AIMINGTODY -void R_InterpolateView(fixed_t frac) +void R_InterpolateView(fixed_t frac, boolean forceinvalid) { viewvars_t* prevview = oldview; UINT8 i; @@ -165,7 +165,7 @@ void R_InterpolateView(fixed_t frac) i = viewcontext - VIEWCONTEXT_PLAYER1; } - if (oldview_invalid[i] != 0) + if (oldview_invalid[i] != 0 || forceinvalid) { // interpolate from newview to newview prevview = newview; diff --git a/src/r_fps.h b/src/r_fps.h index 1c0f1f884..14b7b2157 100644 --- a/src/r_fps.h +++ b/src/r_fps.h @@ -118,7 +118,7 @@ typedef struct levelinterpolator_s { } levelinterpolator_t; // Interpolates the current view variables (r_state.h) against the selected view context in R_SetViewContext -void R_InterpolateView(fixed_t frac); +void R_InterpolateView(fixed_t frac, boolean forceinvalid); // Buffer the current new views into the old views. Call once after each real tic. void R_UpdateViewInterpolation(void); // Reset the view states (e.g. after level load) so R_InterpolateView doesn't interpolate invalid data diff --git a/src/r_main.c b/src/r_main.c index fd2707a2d..6ecf2c4c2 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -196,6 +196,7 @@ consvar_t cv_soniccd = {"soniccd", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NUL consvar_t cv_allowmlook = {"allowmlook", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_showhud = {"showhud", "Yes", CV_CALL, CV_YesNo, R_SetViewSize, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_translucenthud = {"translucenthud", "10", CV_SAVE, translucenthud_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_uncappedhud = {"uncappedhud", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_translucency = {"translucency", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_drawdist = {"drawdist", "Infinite", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -512,6 +513,11 @@ fixed_t R_PointToDist(fixed_t x, fixed_t y) return R_PointToDist2(viewx, viewy, x, y); } +INT32 R_GetHudUncap(void) +{ + return cv_uncappedhud.value ? rendertimefrac & FRACMASK : 0; +} + // // R_ScaleFromGlobalAngle // Returns the texture mapping scale for the current line (horizontal span) @@ -1340,7 +1346,7 @@ void R_SkyboxFrame(player_t *player) // newview->sin = FINESINE(viewangle>>ANGLETOFINESHIFT); // newview->cos = FINECOSINE(viewangle>>ANGLETOFINESHIFT); - R_InterpolateView(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT); + R_InterpolateView(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT, false); } void R_SetupFrame(player_t *player, boolean skybox) @@ -1489,7 +1495,7 @@ void R_SetupFrame(player_t *player, boolean skybox) // newview->sin = FINESINE(viewangle>>ANGLETOFINESHIFT); // newview->cos = FINECOSINE(viewangle>>ANGLETOFINESHIFT); - R_InterpolateView(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT); + R_InterpolateView(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT, false); } #define ANGLED_PORTALS @@ -1862,6 +1868,7 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_showhud); CV_RegisterVar(&cv_translucenthud); + CV_RegisterVar(&cv_uncappedhud); CV_RegisterVar(&cv_maxportals); diff --git a/src/r_main.h b/src/r_main.h index c8c3f4e8c..1cbcd58f0 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -106,7 +106,7 @@ extern ps_metric_t ps_numpolyobjects; // REFRESH - the actual rendering functions. // -extern consvar_t cv_showhud, cv_translucenthud; +extern consvar_t cv_showhud, cv_translucenthud, cv_uncappedhud; extern consvar_t cv_homremoval; extern consvar_t cv_chasecam, cv_chasecam2, cv_chasecam3, cv_chasecam4; extern consvar_t cv_flipcam, cv_flipcam2, cv_flipcam3, cv_flipcam4; @@ -140,4 +140,7 @@ void R_RenderPlayerView(player_t *player); // add commands related to engine, at game startup void R_RegisterEngineStuff(void); + +// return multiplier for HUD uncap +INT32 R_GetHudUncap(void); #endif diff --git a/src/st_stuff.c b/src/st_stuff.c index 06ce08c5e..036eabead 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -738,10 +738,15 @@ static void ST_drawLevelTitle(void) if (timeinmap > 105) { INT32 count = (113 - (INT32)(timeinmap)); + + // uh... "fill in the bits" of sub, or something... no idea what I came up with + // VERY janky, but doesn't require m_easing + INT32 frac = (FixedMul(R_GetHudUncap(), FixedDiv(dupcalc, BASEVIDWIDTH)) >> (count + 4))/13; // these two magic numbers seem to do the trick + sub = dupcalc; while (count-- > 0) sub >>= 1; - sub = -sub; + sub = -sub - frac; } { diff --git a/src/v_video.c b/src/v_video.c index 25d7a1dbd..180424934 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -18,6 +18,8 @@ #include "v_video.h" #include "hu_stuff.h" #include "r_draw.h" +#include "r_main.h" +#include "r_fps.h" #include "console.h" #include "i_video.h" // rendermode @@ -1391,7 +1393,7 @@ void V_DrawPatchFill(patch_t *pat) void V_DrawVhsEffect(boolean rewind) { - static fixed_t upbary = 100, downbary = 150; + static fixed_t upbary = 100*FRACUNIT, downbary = 150*FRACUNIT; UINT8 *buf = screens[0], *tmp = screens[4]; UINT16 y; @@ -1411,19 +1413,19 @@ void V_DrawVhsEffect(boolean rewind) if (rewind) V_DrawVhsEffect(false); // experimentation - if (renderisnewtic) - { - upbary -= (vid.dupy * (rewind ? 3 : 1.8f)); - downbary += (vid.dupy * (rewind ? 2 : 1)); - } + fixed_t frac = R_UsingFrameInterpolation() ? renderdeltatics : FRACUNIT; + upbary -= frac * (vid.dupy * (rewind ? 3 : 1.8f)); + downbary += frac * (vid.dupy * (rewind ? 2 : 1)); - if (upbary < -barsize) upbary = vid.height; - if (downbary > vid.height) downbary = -barsize; + if (upbary < -barsize*FRACUNIT) upbary = vid.height< vid.height<>FRACBITS, dby = downbary>>FRACBITS; #ifdef HWRENDER if (rendermode == render_opengl) { - HWR_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize); + HWR_RenderVhsEffect(uby, dby, updistort, downdistort, barsize); return; } #endif @@ -1433,15 +1435,15 @@ void V_DrawVhsEffect(boolean rewind) thismapstart = normalmapstart; offs = 0; - if (y >= upbary && y < upbary+barsize) + if (y >= uby && y < uby+barsize) { thismapstart -= (2<= downbary && y < downbary+barsize) + if (y >= dby && y < dby+barsize) { thismapstart -= (2< sorttic && !demo.playback) + if (sorttic != -1 && intertic >= sorttic && !demo.playback) { INT32 count = (intertic - sorttic); if (count < 8) - x -= ((count * vid.width) / (8 * vid.dupx)); - else if (count == 8) - goto dotimer; + x -= ((((count<>FRACBITS) / (8 * vid.dupx); else if (count < 16) - x += (((16 - count) * vid.width) / (8 * vid.dupx)); + x += (((((16 - count)<>FRACBITS) / (8 * vid.dupx); } // SRB2kart 290117 - compeltely replaced this block. @@ -632,7 +630,6 @@ void Y_IntermissionDrawer(void) } } -dotimer: if (timer) { char *string;