diff --git a/src/k_kart.c b/src/k_kart.c index 320105ef..89a974cf 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5828,6 +5828,8 @@ static patch_t *kp_battlelose; static patch_t *kp_battlewait; static patch_t *kp_battleinfo; static patch_t *kp_wanted; +static patch_t *kp_wantedsplit; +static patch_t *kp_wantedreticle; static patch_t *kp_itembg[4]; static patch_t *kp_itemtimer[2]; @@ -5967,6 +5969,8 @@ void K_LoadKartHUDGraphics(void) kp_battlewait = W_CachePatchName("K_BWAIT", PU_HUDGFX); kp_battleinfo = W_CachePatchName("K_BINFO", PU_HUDGFX); kp_wanted = W_CachePatchName("K_WANTED", PU_HUDGFX); + kp_wantedsplit = W_CachePatchName("4PWANTED", PU_HUDGFX); + kp_wantedreticle = W_CachePatchName("MMAPWANT", PU_HUDGFX); // Kart Item Windows kp_itembg[0] = W_CachePatchName("K_ITBG", PU_HUDGFX); @@ -6178,6 +6182,12 @@ INT32 CHEK_Y; // CHECK graphic INT32 MINI_X, MINI_Y; // Minimap INT32 WANT_X, WANT_Y; // Battle WANTED poster +// This is for the P2 and P4 side of splitscreen. Then we'll flip P1's and P2's to the bottom with V_SPLITSCREEN. +INT32 ITEM2_X, ITEM2_Y; +INT32 LAPS2_X, LAPS2_Y; +INT32 POSI2_X, POSI2_Y; + + static void K_initKartHUD(void) { /* @@ -6258,26 +6268,35 @@ static void K_initKartHUD(void) MINI_Y = (BASEVIDHEIGHT/2); - WANT_X = BASEVIDWIDTH-8; - WANT_Y = (BASEVIDHEIGHT/2)-12; - if (splitscreen > 1) // 3P/4P Small Splitscreen { + // 1P (top left) ITEM_X = -9; ITEM_Y = -8; LAPS_X = 3; LAPS_Y = (BASEVIDHEIGHT/2)-13; - POSI_X = (BASEVIDWIDTH/2)-3; + POSI_X = 24; + POSI_Y = (BASEVIDHEIGHT/2)- 16; + + // 2P (top right) + ITEM2_X = BASEVIDWIDTH-39; + ITEM2_Y = -8; + + LAPS2_X = BASEVIDWIDTH-40; + LAPS2_Y = (BASEVIDHEIGHT/2)-13; + + POSI2_X = BASEVIDWIDTH -4; + POSI2_Y = (BASEVIDHEIGHT/2)- 16; + + // Reminder that 3P and 4P are just 1P and 2P splitscreen'd to the bottom. STCD_X = BASEVIDWIDTH/4; MINI_X = (3*BASEVIDWIDTH/4); MINI_Y = (3*BASEVIDHEIGHT/4); - WANT_X = (BASEVIDWIDTH/2)-8; - if (splitscreen > 2) // 4P-only { MINI_X = (BASEVIDWIDTH/2); @@ -6343,12 +6362,14 @@ static void K_drawKartItem(void) patch_t *localpatch = kp_nodraw; patch_t *localbg = ((offset) ? kp_itembg[2] : kp_itembg[0]); patch_t *localinv = ((offset) ? kp_invincibility[((leveltime % (6*3)) / 3) + 7] : kp_invincibility[(leveltime % (7*3)) / 3]); - INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT); + INT32 fx = 0, fy = 0, fflags = 0; // final coords for hud and flags... + //INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT); const INT32 numberdisplaymin = ((!offset && stplyr->kartstuff[k_itemtype] == KITEM_ORBINAUT) ? 5 : 2); INT32 itembar = 0; UINT8 localcolor = SKINCOLOR_NONE; SINT8 colormode = TC_RAINBOW; UINT8 *colmap = NULL; + boolean flipamount = false; // Used for 3P/4P splitscreen to flip item amount stuff if (stplyr->kartstuff[k_itemroulette]) { @@ -6560,26 +6581,53 @@ static void K_drawKartItem(void) } } + // pain and suffering defined below + if (splitscreen < 2) // don't change shit for THIS splitscreen. + { + fx = ITEM_X; + fy = ITEM_Y; + fflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT); + } + else // now we're having a fun game. + { + if (stplyr == &players[displayplayer] || stplyr == &players[thirddisplayplayer]) // If we are P1 or P3... + { + fx = ITEM_X; + fy = ITEM_Y; + fflags = V_SNAPTOLEFT|((stplyr == &players[thirddisplayplayer]) ? V_SPLITSCREEN : V_SNAPTOTOP); // flip P3 to the bottom. + } + else // else, that means we're P2 or P4. + { + fx = ITEM2_X; + fy = ITEM2_Y; + fflags = V_SNAPTORIGHT|((stplyr == &players[fourthdisplayplayer]) ? V_SPLITSCREEN : V_SNAPTOTOP); // flip P4 to the bottom + flipamount = true; + } + } + if (localcolor != SKINCOLOR_NONE) colmap = R_GetTranslationColormap(colormode, localcolor, 0); - V_DrawScaledPatch(ITEM_X, ITEM_Y, V_HUDTRANS|splitflags, localbg); + V_DrawScaledPatch(fx, fy, V_HUDTRANS|fflags, localbg); // Then, the numbers: if (stplyr->kartstuff[k_itemamount] >= numberdisplaymin && !stplyr->kartstuff[k_itemroulette]) { - V_DrawScaledPatch(ITEM_X, ITEM_Y, V_HUDTRANS|splitflags, kp_itemmulsticker[offset]); - V_DrawFixedPatch(ITEM_X<kartstuff[k_itemamount])); + if (flipamount) // reminder that this is for 3/4p's right end of the screen. + V_DrawString(fx+2, fy+31, V_ALLOWLOWERCASE|V_HUDTRANS|fflags, va("x%d", stplyr->kartstuff[k_itemamount])); + else + V_DrawString(fx+24, fy+31, V_ALLOWLOWERCASE|V_HUDTRANS|fflags, va("x%d", stplyr->kartstuff[k_itemamount])); else { - V_DrawScaledPatch(ITEM_X+28, ITEM_Y+41, V_HUDTRANS|splitflags, kp_itemx); - V_DrawKartString(ITEM_X+38, ITEM_Y+36, V_HUDTRANS|splitflags, va("%d", stplyr->kartstuff[k_itemamount])); + V_DrawScaledPatch(fy+28, fy+41, V_HUDTRANS|fflags, kp_itemx); + V_DrawKartString(fx+38, fy+36, V_HUDTRANS|fflags, va("%d", stplyr->kartstuff[k_itemamount])); } } else - V_DrawFixedPatch(ITEM_X< 2) { - V_DrawFill(ITEM_X+x+length, ITEM_Y+y+1, 1, height, 12|splitflags); // the right one + V_DrawFill(fx+x+length, fy+y+1, 1, height, 12|fflags); // the right one if (height == 2) - V_DrawFill(ITEM_X+x+2, ITEM_Y+y+2, length-2, 1, 8|splitflags); // the dulled underside - V_DrawFill(ITEM_X+x+2, ITEM_Y+y+1, length-2, 1, 120|splitflags); // the shine + V_DrawFill(fx+x+2, fy+y+2, length-2, 1, 8|fflags); // the dulled underside + V_DrawFill(fx+x+2, fy+y+1, length-2, 1, 120|fflags); // the shine } } // Quick Eggman numbers if (stplyr->kartstuff[k_eggmanexplode] > 1 /*&& stplyr->kartstuff[k_eggmanexplode] <= 3*TICRATE*/) - V_DrawScaledPatch(ITEM_X+17, ITEM_Y+13-offset, V_HUDTRANS|splitflags, kp_eggnum[min(3, G_TicsToSeconds(stplyr->kartstuff[k_eggmanexplode]))]); + V_DrawScaledPatch(fx+17, fy+13-offset, V_HUDTRANS|fflags, kp_eggnum[min(3, G_TicsToSeconds(stplyr->kartstuff[k_eggmanexplode]))]); + } void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UINT8 mode) @@ -6766,23 +6815,66 @@ static void K_DrawKartPositionNum(INT32 num) // POSI_Y = BASEVIDHEIGHT- 64; // 136 boolean win = (stplyr->exiting && num == 1); - INT32 X = POSI_X; + //INT32 X = POSI_X; INT32 W = SHORT(kp_positionnum[0][0]->width); fixed_t scale = FRACUNIT; patch_t *localpatch = kp_positionnum[0][0]; - INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT); + //INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT); + INT32 fx = 0, fy = 0, fflags = 0; + boolean flipdraw = false; // flip the order we draw it in for MORE splitscreen bs. fun. + boolean flipvdraw = false; // used only for 2p splitscreen so overtaking doesn't make 1P's position fly off the screen. + boolean overtake = false; if (stplyr->kartstuff[k_positiondelay] || stplyr->exiting) + { scale *= 2; + overtake = true; // this is used for splitscreen stuff in conjunction with flipdraw. + } if (splitscreen) scale /= 2; W = FixedMul(W<>FRACBITS; + // pain and suffering defined below + if (splitscreen < 2) // for this splitscreen, we'll use case by case because it's a bit different. + { + fx = POSI_X; + if (stplyr == &players[displayplayer]) // for player 1: display this at the top right, above the minimap. + { + fy = 30; + fflags = V_SNAPTOTOP|V_SNAPTORIGHT; + if (overtake) + flipvdraw = true; // make sure overtaking doesn't explode us + } + else // if we're not p1, that means we're p2. display this at the bottom right, below the minimap. + { + fy = BASEVIDHEIGHT - 8; + fflags = V_SNAPTOBOTTOM|V_SNAPTORIGHT; + } + } + else + { + if (stplyr == &players[displayplayer] || stplyr == &players[thirddisplayplayer]) // If we are P1 or P3... + { + fx = POSI_X; + fy = POSI_Y; + fflags = V_SNAPTOLEFT|((stplyr == &players[thirddisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom. + flipdraw = true; + if (num && num >= 10) + fx += W; // this seems dumb, but we need to do this in order for positions above 10 going off screen. + } + else // else, that means we're P2 or P4. + { + fx = POSI2_X; + fy = POSI2_Y; + fflags = V_SNAPTORIGHT|((stplyr == &players[fourthdisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom + } + } + // Special case for 0 if (!num) { - V_DrawFixedPatch(X<width*scale/2) : 0), (fy<height*scale/2) : 0), scale, V_HUDTRANSHALF|fflags, localpatch, NULL); + // ^ if we overtake as p1 or p3 in splitscren, we shift it so that it doesn't go off screen. + // ^ if we overtake as p1 in 2p splits, shift vertically so that this doesn't happen either. - X -= W; + fx -= W; num /= 10; } } @@ -7067,15 +7161,57 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I static void K_drawKartLaps(void) { INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT); + INT32 fx = 0, fy = 0, fflags = 0; // stuff for 3p / 4p splitscreen. + boolean flipstring = false; // used for 3p or 4p + INT32 stringw = 0; // used with the above if (splitscreen > 1) { - V_DrawScaledPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_splitlapflag); - if (stplyr->exiting) - V_DrawString(LAPS_X+13, LAPS_Y+1, V_HUDTRANS|splitflags, "FIN"); + // pain and suffering defined below + if (splitscreen < 2) // don't change shit for THIS splitscreen. + { + fx = LAPS_X; + fy = LAPS_Y; + fflags = splitflags; + } else - V_DrawString(LAPS_X+13, LAPS_Y+1, V_HUDTRANS|splitflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value)); + { + if (stplyr == &players[displayplayer] || stplyr == &players[thirddisplayplayer]) // If we are P1 or P3... + { + fx = LAPS_X; + fy = LAPS_Y; + fflags = V_SNAPTOLEFT|((stplyr == &players[thirddisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom. + } + else // else, that means we're P2 or P4. + { + fx = LAPS2_X; + fy = LAPS2_Y; + fflags = V_SNAPTORIGHT|((stplyr == &players[fourthdisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom + flipstring = true; // make the string right aligned and other shit + } + } + + + + if (stplyr->exiting) // draw stuff as god intended. + { + V_DrawScaledPatch(fx, fy, V_HUDTRANS|fflags, kp_splitlapflag); + V_DrawString(fx+13, fy+1, V_HUDTRANS|fflags, "FIN"); + } + else // take flipstring into account here since we may have more laps than just 10 + if (flipstring) + { + stringw = V_StringWidth(va("%d/%d", stplyr->laps+1, cv_numlaps.value), 0); + + V_DrawScaledPatch(BASEVIDWIDTH-stringw-16, fy, V_HUDTRANS|fflags, kp_splitlapflag); + V_DrawRightAlignedString(BASEVIDWIDTH-3, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value)); + } + else // draw stuff NORMALLY. + { + V_DrawScaledPatch(fx, fy, V_HUDTRANS|fflags, kp_splitlapflag); + V_DrawString(fx+13, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value)); + } } else { @@ -7114,18 +7250,48 @@ static void K_drawKartBumpersOrKarma(void) { UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, 0); INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT); + INT32 fx = 0, fy = 0, fflags = 0; + boolean flipstring = false; // same as laps, used for splitscreen + INT32 stringw = 0; // used with the above if (splitscreen > 1) { + + // we will reuse lap coords here since it's essentially the same shit. + + if (stplyr == &players[displayplayer] || stplyr == &players[thirddisplayplayer]) // If we are P1 or P3... + { + fx = LAPS_X; + fy = LAPS_Y; + fflags = V_SNAPTOLEFT|((stplyr == &players[thirddisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom. + } + else // else, that means we're P2 or P4. + { + fx = LAPS2_X; + fy = LAPS2_Y; + fflags = V_SNAPTORIGHT|((stplyr == &players[fourthdisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom + flipstring = true; + } + if (stplyr->kartstuff[k_bumper] <= 0) { - V_DrawMappedPatch(LAPS_X, LAPS_Y-1, V_HUDTRANS|splitflags, kp_splitkarmabomb, colormap); - V_DrawString(LAPS_X+13, LAPS_Y+1, V_HUDTRANS|splitflags, va("%d/2", stplyr->kartstuff[k_comebackpoints])); + V_DrawMappedPatch(fx, fy-1, V_HUDTRANS|fflags, kp_splitkarmabomb, colormap); + V_DrawString(fx+13, fy+1, V_HUDTRANS|fflags, va("%d/2", stplyr->kartstuff[k_comebackpoints])); } - else + else // the above doesn't need to account for weird stuff since the max amount of karma necessary is always 2 ^^^^ { - V_DrawMappedPatch(LAPS_X, LAPS_Y-1, V_HUDTRANS|splitflags, kp_rankbumper, colormap); - V_DrawString(LAPS_X+13, LAPS_Y+1, V_HUDTRANS|splitflags, va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value)); + if (flipstring) // for p2 and p4, assume we can have more than 10 bumpers. It's retarded but who knows. + { + stringw = V_StringWidth(va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value), 0); + + V_DrawMappedPatch(BASEVIDWIDTH-stringw-16, fy-1, V_HUDTRANS|fflags, kp_rankbumper, colormap); + V_DrawRightAlignedString(BASEVIDWIDTH-3, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value)); + } + else // draw bumpers normally. + { + V_DrawMappedPatch(fx, fy-1, V_HUDTRANS|fflags, kp_rankbumper, colormap); + V_DrawString(fx+13, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value)); + } } } else @@ -7178,13 +7344,10 @@ static void K_drawKartWanted(void) { UINT8 i, numwanted = 0; UINT8 *colormap = NULL; + INT32 basex = 0, basey = 0; - if (splitscreen) // Can't fit the poster on screen, sadly - { - if (K_IsPlayerWanted(stplyr) && leveltime % 10 > 3) - V_DrawRightAlignedString(WANT_X, WANT_Y, K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS|V_ORANGEMAP), "WANTED"); + if (stplyr != &players[displayplayer]) return; - } for (i = 0; i < 4; i++) { @@ -7196,13 +7359,33 @@ static void K_drawKartWanted(void) if (numwanted <= 0) return; + // set X/Y coords depending on splitscreen. + if (splitscreen < 3) // 1P and 2P use the same code. + { + basex = WANT_X; + basey = WANT_Y; + if (splitscreen == 2) + { + basey += 16; // slight adjust for 3P + basex -= 6; + } + } + else if (splitscreen == 3) // 4P splitscreen... + { + basex = BASEVIDWIDTH/2 - (SHORT)(kp_wantedsplit->width/2); // center on screen + basey = BASEVIDHEIGHT - 55; + //basey2 = 4; + } + if (battlewanted[0] != -1) colormap = R_GetTranslationColormap(0, players[battlewanted[0]].skincolor, GTC_CACHE); - V_DrawFixedPatch(WANT_X< 1 ? kp_wantedsplit : kp_wanted), colormap); + /*if (basey2) + V_DrawFixedPatch(basex< 1 ? 13 : 8), y = basey+(splitscreen > 1 ? 16 : 21); fixed_t scale = FRACUNIT/2; player_t *p = &players[battlewanted[i]]; @@ -7222,7 +7405,9 @@ static void K_drawKartWanted(void) if (players[battlewanted[i]].skincolor) { colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE); - V_DrawFixedPatch(x<skin] : facerankprefix[p->skin]), colormap); + V_DrawFixedPatch(x<skin] : facerankprefix[p->skin]), colormap); + /*if (basey2) // again with 4p stuff + V_DrawFixedPatch(x<skin] : facerankprefix[p->skin]), colormap);*/ } } } @@ -7363,6 +7548,8 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat else colormap = R_GetTranslationColormap(skin, mo->color, GTC_CACHE); V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, facemmapprefix[skin], colormap); + if (mo->player && K_IsPlayerWanted(mo->player)) + V_DrawFixedPatch(amxpos - (4< 105) { - minimaptrans = (splitscreen ? 10 : cv_kartminimap.value); + minimaptrans = cv_kartminimap.value; if (timeinmap <= 113) minimaptrans = ((((INT32)timeinmap) - 105)*minimaptrans)/(113-105); if (!minimaptrans) @@ -7412,7 +7599,7 @@ static void K_drawKartMinimap(void) else V_DrawScaledPatch(x, y, splitflags, AutomapPic); - if (!splitscreen) + if (!(splitscreen == 2)) { splitflags &= ~minimaptrans; splitflags |= V_HUDTRANSHALF; @@ -7447,7 +7634,7 @@ static void K_drawKartMinimap(void) if (!players[i].mo || players[i].spectator) continue; - if (!splitscreen && i == displayplayer) + if (i == displayplayer || i == secondarydisplayplayer || i == thirddisplayplayer || i == fourthdisplayplayer) // don't draw our local players. { dop1later = true; // Do displayplayer later continue; @@ -7470,9 +7657,31 @@ static void K_drawKartMinimap(void) if (!dop1later) return; // Don't need this + // draw our local players here, opaque. splitflags &= ~V_HUDTRANSHALF; splitflags |= V_HUDTRANS; - K_drawKartMinimapHead(stplyr->mo, x, y, splitflags, AutomapPic); + for (i = MAXPLAYERS-1; i >= 0; i--) + { + if (!(i == displayplayer || i == secondarydisplayplayer || i == thirddisplayplayer || i == fourthdisplayplayer)) + continue; // this doesn't interrest us + + if (splitscreen > 1) // this only applies to splitscreen. When we play alone, we should always get drawn reguardless of what we're doing. + { + if (G_BattleGametype() && players[i].kartstuff[k_bumper] <= 0) + continue; + if (players[i].kartstuff[k_hyudorotimer] > 0) + { + if (!((players[i].kartstuff[k_hyudorotimer] < 1*TICRATE/2 + || players[i].kartstuff[k_hyudorotimer] > hyudorotime-(1*TICRATE/2)) + && !(leveltime & 1))) + continue; + } + + K_drawKartMinimapHead(players[i].mo, x, y, splitflags, AutomapPic); + } + else + K_drawKartMinimapHead(players[i].mo, x, y, splitflags, AutomapPic); + } } static void K_drawKartStartCountdown(void) @@ -8104,13 +8313,13 @@ void K_drawKartHUD(void) || ((splitscreen > 2 && stplyr == &players[fourthdisplayplayer]) && !camera4.chase)) K_drawKartFirstPerson(); - if (splitscreen == 2) // Player 4 in 3P is the minimap :p +/* if (splitscreen == 2) // Player 4 in 3P is the minimap :p { #ifdef HAVE_BLUA if (LUA_HudEnabled(hud_minimap)) #endif K_drawKartMinimap(); - } + }*/ // Draw full screen stuff that turns off the rest of the HUD if (mapreset && stplyr == &players[displayplayer]) @@ -8134,7 +8343,16 @@ void K_drawKartHUD(void) if (cv_kartcheck.value && !splitscreen && !players[displayplayer].exiting) K_drawKartPlayerCheck(); - if (splitscreen == 0 && cv_kartminimap.value && !titledemo) + // Draw WANTED status + if (G_BattleGametype()) + { +#ifdef HAVE_BLUA + if (LUA_HudEnabled(hud_wanted)) +#endif + K_drawKartWanted(); + } + + if (cv_kartminimap.value && !titledemo) { #ifdef HAVE_BLUA if (LUA_HudEnabled(hud_minimap)) @@ -8149,15 +8367,6 @@ void K_drawKartHUD(void) #endif K_drawKartItem(); - // Draw WANTED status - if (G_BattleGametype()) - { -#ifdef HAVE_BLUA - if (LUA_HudEnabled(hud_wanted)) -#endif - K_drawKartWanted(); - } - // If not splitscreen, draw... if (!splitscreen && !titledemo) {