From c5a4822df629264e41826076cc7da6a1f1e50952 Mon Sep 17 00:00:00 2001 From: Wolfy Date: Sun, 17 Dec 2017 23:12:51 -0600 Subject: [PATCH] Reorganize minimap code --- src/hu_stuff.c | 3 ++ src/k_kart.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/k_kart.h | 1 + 3 files changed, 79 insertions(+) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 69e2a9dd..22d802c0 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -51,6 +51,8 @@ #include "lua_hook.h" #endif +#include "k_kart.h" + // coords are scaled #define HU_INPUTX 0 #define HU_INPUTY 0 @@ -1067,6 +1069,7 @@ static void HU_DrawDemoInfo(void) // void HU_Drawer(void) { + K_drawMinimap(); // SRB2kart 010217 - Automap Hud (temporarily commented out) /* INT32 amnumxpos; diff --git a/src/k_kart.c b/src/k_kart.c index e9eb5afb..4787a002 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4209,6 +4209,81 @@ static void K_drawKartItemClose(void) V_DrawScaledPatch(ITEM_X, ITEM_Y, V_SNAPTORIGHT|V_SNAPTOTOP|splitflags, localpatch); } +void K_drawMinimap(void) +{ + // SRB2kart 010217 - Automap Hud (temporarily commented out) + /* + 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_BuildAutoMapName(gamemap))); + + if (lumpnum != -1 && (!modifiedgame || (modifiedgame && mapheaderinfo[gamemap-1].automap))) + AutomapPic = W_CachePatchName(va("%sR", G_BuildAutoMapName(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 = 312 - (AutomapPic->width/2); + y = 60; + } + + V_DrawSmallScaledPatch(x, y, 0, AutomapPic); + + // Player's tiny icons on the Automap. + if (lumpnum != -1 && (!modifiedgame || (modifiedgame && mapheaderinfo[gamemap-1].automap))) + { + 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. + amnumxpos = (players[i].mo->x / 320) >> FRACBITS; + amnumypos = (-players[i].mo->y / 340) >> FRACBITS; + + amxpos = (x + amnumxpos) - (iconprefix[players[i].skin]->width/4); + amypos = (y + amnumypos) - (iconprefix[players[i].skin]->height/4); + + if (!players[i].skincolor) // 'default' color + { + V_DrawSmallScaledPatch(amxpos, amypos, 0, iconprefix[players[i].skin]); + } + else + { + UINT8 *colormap = transtables[players[i].skin] - 256 + (players[i].skincolor<<8); + V_DrawSmallMappedPatch(amxpos, amypos, 0,iconprefix[players[i].skin], colormap); + } + } + } + } + if (!(splitscreen || splitscreen3 || splitscreen4) && maptol & TOL_KART && !hu_showscores) + HU_DrawRaceRankings(); + }*/ + ; +} + static void K_drawKartItemRoulette(void) { // ITEM_X = BASEVIDWIDTH-50; // 270 diff --git a/src/k_kart.h b/src/k_kart.h index c9ab9c0f..1c342979 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -44,6 +44,7 @@ void K_CheckBalloons(void); void K_LoadKartHUDGraphics(void); fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fixed_t my); void K_drawKartHUD(void); +void K_drawMinimap(void); // ========================================================================= #endif // __K_KART__