diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 0e9ce614..abc94f59 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1132,8 +1132,6 @@ static void HU_DrawDemoInfo(void) // void HU_Drawer(void) { - K_drawMinimap(); - // draw chat string plus cursor if (chat_on) HU_DrawChat(); diff --git a/src/k_kart.c b/src/k_kart.c index 446b226a..fe525dc8 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4888,111 +4888,108 @@ static void K_UnLoadIconGraphics(INT32 skinnum) } #endif -void K_drawMinimap(void) +void K_drawKartMinimap(void) { - INT32 amnumxpos; - INT32 amnumypos; + fixed_t amnumxpos; + fixed_t amnumypos; INT32 amxpos; INT32 amypos; INT32 lumpnum; patch_t *AutomapPic; INT32 i = 0; + INT32 x, y; // Draw the HUD only when playing in a level. // hu_stuff needs this, unlike st_stuff. - if (Playing() && gamestate == GS_LEVEL) + if (!(Playing() && gamestate == GS_LEVEL)) + return; + + 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) { - 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++) { - for (i = 0; i < MAXPLAYERS; i++) + if (players[i].mo && !players[i].spectator) { - 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))<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))<width/4 + (iconprefix[players[i].skin]->width/4))<width) - SHORT(patch->leftoffset))<