diff --git a/src/k_kart.c b/src/k_kart.c index e3af250d..254bd063 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3067,8 +3067,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) K_KartUpdatePosition(player); - // Position Taunt - // If you were behind someone but just passed them, taunt at them! + // Previously was position taunt, now is used for growing the number while passing people! if (!player->kartstuff[k_positiondelay] && !player->exiting) { if (player->kartstuff[k_oldposition] <= player->kartstuff[k_position]) // But first, if you lost a place, @@ -3077,7 +3076,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { //S_StartSound(player->mo, sfx_slow); // Say "YOU'RE TOO SLOW!" player->kartstuff[k_oldposition] = player->kartstuff[k_position]; // Restore the old position, - player->kartstuff[k_positiondelay] = 5*TICRATE; // and set up a timer. + player->kartstuff[k_positiondelay] = 15; // and set up a timer. } } if (player->kartstuff[k_positiondelay]) @@ -4028,6 +4027,7 @@ INT32 FACE_X, FACE_Y; // Top-four Faces INT32 METE_X, METE_Y; // Speed Meter INT32 LAKI_X, LAKI_Y; // Lakitu INT32 CHEK_Y; // CHECK graphic +INT32 MINI_X, MINI_Y; // Minimap static void K_initKartHUD(void) { @@ -4083,7 +4083,7 @@ static void K_initKartHUD(void) SPDM_Y = BASEVIDHEIGHT- 45; // 155 // Position Number POSI_X = BASEVIDWIDTH - 52; // 268 - POSI_Y = BASEVIDHEIGHT- 62; // 138 + POSI_Y = BASEVIDHEIGHT- 4; // 138 // Top-Four Faces FACE_X = 9; // 9 FACE_Y = 92; // 92 @@ -4092,6 +4092,9 @@ static void K_initKartHUD(void) LAKI_Y = 58 - 200; // 58 // CHECK graphic CHEK_Y = BASEVIDHEIGHT; // 200 + // Minimap + MINI_X = 158; // 158 + MINI_Y = 50; // 50 if (splitscreen) // Splitscreen { @@ -4102,7 +4105,9 @@ static void K_initKartHUD(void) LAPS_Y = (BASEVIDHEIGHT/2)-24; - POSI_Y = (BASEVIDHEIGHT/2)-56; + POSI_Y = (BASEVIDHEIGHT/2)- 2; + + MINI_Y = (BASEVIDHEIGHT/2); if (splitscreen > 1) // 3P/4P Small Splitscreen { @@ -4112,8 +4117,16 @@ static void K_initKartHUD(void) LAPS_X = 2; LAPS_Y = (BASEVIDHEIGHT/2)-22; - POSI_X = (BASEVIDWIDTH/2) -46; - POSI_Y = (BASEVIDHEIGHT/2)-56; + POSI_X = (BASEVIDWIDTH/2) - 45; + + MINI_X = (3*BASEVIDWIDTH/4); + MINI_Y = (3*BASEVIDHEIGHT/4); + + if (splitscreen > 2) + { + MINI_X = (BASEVIDWIDTH/2); + MINI_Y = (BASEVIDHEIGHT/2); + } } } @@ -4193,130 +4206,6 @@ static void K_drawKartItemClose(void) V_DrawScaledPatch(ITEM_X, ITEM_Y, splitflags, localpatch); } -void K_LoadIconGraphics(char *facestr, INT32 skinnum) -{ - char namelump[9]; - - // hack: make sure base face name is no more than 8 chars - if (strlen(facestr) > 8) - facestr[8] = '\0'; - strcpy(namelump, facestr); // copy base name - - iconprefix[skinnum] = W_CachePatchName(namelump, PU_HUDGFX); - iconfreed[skinnum] = false; -} - -#if 0 //unused -static void K_UnLoadIconGraphics(INT32 skinnum) -{ - Z_Free(iconprefix[skinnum]); - iconfreed[skinnum] = true; -} -#endif - -void K_drawMinimap(void) -{ - // SRB2kart 12/18/17 - Automap HUD - - INT32 amnumxpos; - INT32 amnumypos; - INT32 amxpos; - INT32 amypos; - INT32 lumpnum; - patch_t *AutomapPic; - INT32 i = 0; - - // Draw the HUD only when playing in a level. - // hu_stuff needs this, unlike st_stuff. - if (Playing() && gamestate == GS_LEVEL) - { - INT32 x, y; - - lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap))); - - if (lumpnum != -1) - AutomapPic = W_CachePatchName(va("%sR", G_BuildMapName(gamemap)), PU_CACHE); - else - AutomapPic = W_CachePatchName(va("NOMAPR"), PU_CACHE); - - if (splitscreen) - { - x = 160 - (AutomapPic->width/4); - y = 100 - (AutomapPic->height/4); - } - else - { - x = 310 - (AutomapPic->width/2); - y = 50; - } - - V_DrawSmallScaledPatch(x, y, V_TRANSLUCENT|V_SNAPTORIGHT, AutomapPic); - - // Player's tiny icons on the Automap. - if (lumpnum != -1) - { - for (i = 0; i < MAXPLAYERS; i++) - { - if (players[i].mo && !players[i].spectator) - { - // amnum xpos & ypos are the icon's speed around the HUD. - // The number being divided by is for how fast it moves. - // The higher the number, the slower it moves. - - // am xpos & ypos are the icon's starting position. Withouht - // it, they wouldn't 'spawn' on the top-right side of the HUD. - - node_t *bsp = &nodes[numnodes-1]; - fixed_t maxx, minx, maxy, miny; - maxx = maxy = INT32_MAX; - minx = miny = INT32_MIN; - minx = bsp->bbox[0][BOXLEFT]; - maxx = bsp->bbox[0][BOXRIGHT]; - miny = bsp->bbox[0][BOXBOTTOM]; - maxy = bsp->bbox[0][BOXTOP]; - - if (bsp->bbox[1][BOXLEFT] < minx) - minx = bsp->bbox[1][BOXLEFT]; - if (bsp->bbox[1][BOXRIGHT] > maxx) - maxx = bsp->bbox[1][BOXRIGHT]; - if (bsp->bbox[1][BOXBOTTOM] < miny) - miny = bsp->bbox[1][BOXBOTTOM]; - if (bsp->bbox[1][BOXTOP] > maxy) - miny = bsp->bbox[1][BOXTOP]; - - fixed_t mapwidth = maxx - minx; - fixed_t mapheight = maxy - miny; - - fixed_t xoffset = minx + mapwidth/2; - fixed_t yoffset = miny + mapheight/2; - - fixed_t xscale = FixedDiv((AutomapPic->width<height<x, zoom) - FixedMul(xoffset, zoom)); - amnumypos = -(FixedMul(players[i].mo->y, zoom) - FixedMul(yoffset, zoom)); - - amxpos = amnumxpos + ((x + AutomapPic->width/4 - (iconprefix[players[i].skin]->width/4))<height/4 - (iconprefix[players[i].skin]->height/4))<width); + fixed_t scale = FRACUNIT; patch_t *localpatch = kp_positionnum[0][0]; - INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT); + if (splitscreen > 1) + scale = FRACUNIT/2; + // Special case for 0 if (!num) { - V_DrawTranslucentPatch(X-W, POSI_Y, V_TRANSLUCENT|splitflags, kp_positionnum[0][0]); + V_DrawFixedPatch(X<exiting && num == 1) // 1st place winner? You get rainbows!! { // Alternate frame every three frames @@ -4676,7 +4566,12 @@ static void K_DrawKartPositionNum(INT32 num) else localpatch = kp_positionnum[num % 10][0]; - V_DrawTranslucentPatch(X, POSI_Y, V_TRANSLUCENT|splitflags, localpatch); + if (stplyr->kartstuff[k_positiondelay] || stplyr->exiting) + scale *= 2; + + V_DrawFixedPatch(X< 8) + facestr[8] = '\0'; + strcpy(namelump, facestr); // copy base name + + iconprefix[skinnum] = W_CachePatchName(namelump, PU_HUDGFX); + iconfreed[skinnum] = false; +} + +#if 0 //unused +static void K_UnLoadIconGraphics(INT32 skinnum) +{ + Z_Free(iconprefix[skinnum]); + iconfreed[skinnum] = true; +} +#endif + +void K_drawMinimap(void) +{ + INT32 amnumxpos; + INT32 amnumypos; + INT32 amxpos; + INT32 amypos; + INT32 lumpnum; + patch_t *AutomapPic; + INT32 i = 0; + + // Draw the HUD only when playing in a level. + // hu_stuff needs this, unlike st_stuff. + if (Playing() && gamestate == GS_LEVEL) + { + INT32 x, y; + + lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap))); + + if (lumpnum != -1) + AutomapPic = W_CachePatchName(va("%sR", G_BuildMapName(gamemap)), PU_CACHE); + else + return; // no pic, just get outta here + + x = MINI_X - (AutomapPic->width/4); + y = MINI_Y - (AutomapPic->height/4); + + if (cv_kartmirror.value) + V_DrawSmallScaledPatch(x+(AutomapPic->width/2), y, V_TRANSLUCENT|V_SNAPTORIGHT|V_FLIP, AutomapPic); + else + V_DrawSmallScaledPatch(x, y, V_TRANSLUCENT|V_SNAPTORIGHT, AutomapPic); + + // Player's tiny icons on the Automap. + if (lumpnum != -1) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (players[i].mo && !players[i].spectator) + { + // amnum xpos & ypos are the icon's speed around the HUD. + // The number being divided by is for how fast it moves. + // The higher the number, the slower it moves. + + // am xpos & ypos are the icon's starting position. Withouht + // it, they wouldn't 'spawn' on the top-right side of the HUD. + + node_t *bsp = &nodes[numnodes-1]; + fixed_t maxx, minx, maxy, miny; + maxx = maxy = INT32_MAX; + minx = miny = INT32_MIN; + minx = bsp->bbox[0][BOXLEFT]; + maxx = bsp->bbox[0][BOXRIGHT]; + miny = bsp->bbox[0][BOXBOTTOM]; + maxy = bsp->bbox[0][BOXTOP]; + + if (bsp->bbox[1][BOXLEFT] < minx) + minx = bsp->bbox[1][BOXLEFT]; + if (bsp->bbox[1][BOXRIGHT] > maxx) + maxx = bsp->bbox[1][BOXRIGHT]; + if (bsp->bbox[1][BOXBOTTOM] < miny) + miny = bsp->bbox[1][BOXBOTTOM]; + if (bsp->bbox[1][BOXTOP] > maxy) + miny = bsp->bbox[1][BOXTOP]; + + fixed_t mapwidth = maxx - minx; + fixed_t mapheight = maxy - miny; + + fixed_t xoffset = minx + mapwidth/2; + fixed_t yoffset = miny + mapheight/2; + + fixed_t xscale = FixedDiv((AutomapPic->width<height<x, zoom) - FixedMul(xoffset, zoom)); + amnumypos = -(FixedMul(players[i].mo->y, zoom) - FixedMul(yoffset, zoom)); + + amxpos = amnumxpos + ((x + AutomapPic->width/4 - (iconprefix[players[i].skin]->width/4))<height/4 - (iconprefix[players[i].skin]->height/4))<width/4 + (iconprefix[players[i].skin]->width/4))<kartstuff[k_cardanimation]); // card animation goes from 0 to 164, 164 is the middle of the screen @@ -5199,11 +5223,11 @@ void K_drawKartHUD(void) if (gametype == GT_RACE) // Race-only elements { - // Draw the numerical position - K_DrawKartPositionNum(stplyr->kartstuff[k_position]); - // Draw the lap counter K_drawKartLaps(); + + // Draw the numerical position + K_DrawKartPositionNum(stplyr->kartstuff[k_position]); } else if (gametype == GT_MATCH) // Battle-only { diff --git a/src/m_menu.c b/src/m_menu.c index c0309f8d..2d9ed8d5 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -5122,7 +5122,7 @@ static void M_ChoosePlayer(INT32 choice) lastmapsaved = 0; gamecomplete = false; - G_DeferedInitNew(ultmode, G_BuildMapName(startmap), (UINT8)skinnum, 1, fromlevelselect); + G_DeferedInitNew(ultmode, G_BuildMapName(startmap), (UINT8)skinnum, 0, fromlevelselect); COM_BufAddText("dummyconsvar 1\n"); // G_DeferedInitNew doesn't do this } @@ -5712,7 +5712,7 @@ static void M_ChooseNightsAttack(INT32 choice) else G_RecordDemo(nameofdemo); - G_DeferedInitNew(false, G_BuildMapName(cv_nextmap.value), 0, 1, false); + G_DeferedInitNew(false, G_BuildMapName(cv_nextmap.value), 0, 0, false); } // Player has selected the "START" from the time attack screen @@ -5740,7 +5740,7 @@ static void M_ChooseTimeAttack(INT32 choice) else G_RecordDemo(nameofdemo); - G_DeferedInitNew(false, G_BuildMapName(cv_nextmap.value), (UINT8)(cv_chooseskin.value-1), 1, false); + G_DeferedInitNew(false, G_BuildMapName(cv_nextmap.value), (UINT8)(cv_chooseskin.value-1), 0, false); } static void M_HandleStaffReplay(INT32 choice) diff --git a/src/p_saveg.c b/src/p_saveg.c index 4ae5175a..53ab044d 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3374,7 +3374,7 @@ boolean P_LoadGame(INT16 mapoverride) return false; // Only do this after confirming savegame is ok - G_DeferedInitNew(false, G_BuildMapName(gamemap), savedata.skin, 1, true); + G_DeferedInitNew(false, G_BuildMapName(gamemap), savedata.skin, 0, true); COM_BufAddText("dummyconsvar 1\n"); // G_DeferedInitNew doesn't do this return true; diff --git a/src/v_video.c b/src/v_video.c index e615a1dd..ba8b2bf5 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1982,7 +1982,7 @@ void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param) return; #endif - if (view < 0 || view >= 3 || (view > splitscreen)) + if (view < 0 || view > 3 || view > splitscreen) return; if ((view == 1 && splitscreen == 1) || view >= 2) @@ -1990,7 +1990,7 @@ void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param) else yoffset = 0; - if (view & 1 && splitscreen > 1) + if ((view == 1 || view == 3) && splitscreen > 1) xoffset = viewwidth; else xoffset = 0; @@ -2012,23 +2012,23 @@ void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param) if (sine < 0) { - M_Memcpy(&tmpscr[y*vid.width+newpix], &srcscr[y*vid.width], vid.width-newpix); + M_Memcpy(&tmpscr[(y*vid.width)+xoffset+newpix], &srcscr[(y*vid.width)+xoffset], viewwidth-newpix); // Cleanup edge while (newpix) { - tmpscr[y*vid.width+newpix] = srcscr[y*vid.width]; + tmpscr[(y*vid.width)+xoffset+newpix] = srcscr[(y*vid.width)+xoffset]; newpix--; } } else { - M_Memcpy(&tmpscr[y*vid.width+0], &srcscr[y*vid.width+sine], vid.width-newpix); + M_Memcpy(&tmpscr[(y*vid.width)+xoffset+0], &srcscr[(y*vid.width)+xoffset+sine], viewwidth-newpix); // Cleanup edge while (newpix) { - tmpscr[y*vid.width+vid.width-newpix] = srcscr[y*vid.width+(vid.width-1)]; + tmpscr[(y*vid.width)+xoffset+viewwidth-newpix] = srcscr[(y*vid.width)+xoffset+(viewwidth-1)]; newpix--; } } @@ -2050,8 +2050,8 @@ Unoptimized version disStart &= FINEMASK; //clip it to FINEMASK } - VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset, screens[0]+vid.width*vid.bpp*yoffset, - vid.width*vid.bpp, viewheight, vid.width*vid.bpp, vid.width); + VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset+xoffset, screens[0]+vid.width*vid.bpp*yoffset+xoffset, + viewwidth*vid.bpp, viewheight, vid.width*vid.bpp, vid.width); } else if (type == postimg_motion) // Motion Blur! { @@ -2064,14 +2064,14 @@ Unoptimized version for (y = yoffset; y < yoffset+viewheight; y++) { - for (x = 0; x < vid.width; x++) + for (x = xoffset; x < xoffset+viewwidth; x++) { tmpscr[y*vid.width + x] - = colormaps[*(transme + (srcscr [y*vid.width+x ] <<8) + (tmpscr[y*vid.width+x]))]; + = colormaps[*(transme + (srcscr [(y*vid.width)+x ] <<8) + (tmpscr[(y*vid.width)+x]))]; } } - VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset, screens[0]+vid.width*vid.bpp*yoffset, - vid.width*vid.bpp, viewheight, vid.width*vid.bpp, vid.width); + VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset+xoffset, screens[0]+vid.width*vid.bpp*yoffset+xoffset, + viewwidth*vid.bpp, viewheight, vid.width*vid.bpp, vid.width); } else if (type == postimg_flip) // Flip the screen upside-down { @@ -2080,7 +2080,7 @@ Unoptimized version INT32 y, y2; for (y = yoffset, y2 = yoffset+viewheight - 1; y < yoffset+viewheight; y++, y2--) - M_Memcpy(&tmpscr[y2*vid.width+xoffset], &srcscr[y*vid.width+xoffset], viewwidth); + M_Memcpy(&tmpscr[(y2*vid.width)+xoffset], &srcscr[(y*vid.width)+xoffset], viewwidth); VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset+xoffset, screens[0]+vid.width*vid.bpp*yoffset+xoffset, viewwidth*vid.bpp, viewheight, vid.width*vid.bpp, vid.width); @@ -2091,6 +2091,9 @@ Unoptimized version UINT8 *srcscr = screens[0]; INT32 y; + if (splitscreen > 1) // 3P/4P has trouble supporting this, anyone want to fix it? :p + return; + // Make sure table is built if (heatshifter == NULL || lastheight != viewheight) { @@ -2114,11 +2117,11 @@ Unoptimized version if (heatshifter[heatindex[view]++]) { // Shift this row of pixels to the right by 2 - tmpscr[y*vid.width] = srcscr[y*vid.width]; - M_Memcpy(&tmpscr[y*vid.width+vid.dupx], &srcscr[y*vid.width], vid.width-vid.dupx); + tmpscr[(y*vid.width)+xoffset] = srcscr[(y*vid.width)+xoffset]; + M_Memcpy(&tmpscr[(y*vid.width)+xoffset], &srcscr[(y*vid.width)+xoffset+vid.dupx], viewwidth-vid.dupx); } else - M_Memcpy(&tmpscr[y*vid.width], &srcscr[y*vid.width], vid.width); + M_Memcpy(&tmpscr[(y*vid.width)+xoffset], &srcscr[(y*vid.width)+xoffset], viewwidth); heatindex[view] %= viewheight; } @@ -2126,8 +2129,8 @@ Unoptimized version heatindex[view]++; heatindex[view] %= vid.height; - VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset, screens[0]+vid.width*vid.bpp*yoffset, - vid.width*vid.bpp, viewheight, vid.width*vid.bpp, vid.width); + VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset+xoffset, screens[0]+vid.width*vid.bpp*yoffset+xoffset, + viewwidth*vid.bpp, viewheight, vid.width*vid.bpp, vid.width); } else if (type == postimg_mirror) // Flip the screen on the x axis { @@ -2137,8 +2140,8 @@ Unoptimized version for (y = yoffset; y < yoffset+viewheight; y++) { - for (x = 0, x2 = (viewwidth*vid.bpp)-1; x < (viewwidth*vid.bpp); x++, x2--) - tmpscr[y*vid.width+xoffset + x2] = srcscr[y*vid.width+xoffset + x]; + for (x = xoffset, x2 = xoffset+((viewwidth*vid.bpp)-1); x < xoffset+(viewwidth*vid.bpp); x++, x2--) + tmpscr[y*vid.width + x2] = srcscr[y*vid.width + x]; } VID_BlitLinearScreen(tmpscr+vid.width*vid.bpp*yoffset+xoffset, screens[0]+vid.width*vid.bpp*yoffset+xoffset,