diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 0f1a35c8..1018fbe0 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -86,6 +86,7 @@ patch_t *rmatcico; patch_t *bmatcico; patch_t *tagico; patch_t *tallminus; +patch_t *iconprefix[MAXSKINS]; // minimap icons //------------------------------------------- // coop hud @@ -1132,78 +1133,6 @@ static void HU_DrawDemoInfo(void) void HU_Drawer(void) { K_drawMinimap(); - // 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 = translationtables[players[i].skin] - 256 + (players[i].skincolor<<8); - V_DrawSmallMappedPatch(amxpos, amypos, 0,iconprefix[players[i].skin], colormap); - } - } - } - } - if (!splitscreen && maptol & TOL_KART && !hu_showscores) - HU_DrawRaceRankings(); - } - */ - // // draw chat string plus cursor if (chat_on) diff --git a/src/hu_stuff.h b/src/hu_stuff.h index a008d840..674e943f 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -78,6 +78,7 @@ extern patch_t *rmatcico; extern patch_t *bmatcico; extern patch_t *tagico; extern patch_t *tallminus; +extern patch_t *iconprefix[MAXSKINS]; // set true when entering a chat message extern boolean chat_on; diff --git a/src/k_kart.c b/src/k_kart.c index dde12b14..9993b493 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4175,10 +4175,31 @@ static void K_drawKartItemClose(void) V_DrawScaledPatch(ITEM_X, ITEM_Y, V_SNAPTORIGHT|V_SNAPTOTOP|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; @@ -4193,10 +4214,10 @@ void K_drawMinimap(void) { INT32 x, y; - lumpnum = W_CheckNumForName(va("%sR", G_BuildAutoMapName(gamemap))); + lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap))); - if (lumpnum != -1 && (!modifiedgame || (modifiedgame && mapheaderinfo[gamemap-1]->automap))) - AutomapPic = W_CachePatchName(va("%sR", G_BuildAutoMapName(gamemap)), PU_CACHE); + if (lumpnum != -1) + AutomapPic = W_CachePatchName(va("%sR", G_BuildMapName(gamemap)), PU_CACHE); else AutomapPic = W_CachePatchName(va("NOMAPR"), PU_CACHE); @@ -4214,7 +4235,7 @@ void K_drawMinimap(void) V_DrawSmallScaledPatch(x, y, 0, AutomapPic); // Player's tiny icons on the Automap. - if (lumpnum != -1 && (!modifiedgame || (modifiedgame && mapheaderinfo[gamemap-1]->automap))) + if (lumpnum != -1) { for (i = 0; i < MAXPLAYERS; i++) { @@ -4238,16 +4259,16 @@ void K_drawMinimap(void) } else { - UINT8 *colormap = transtables[players[i].skin] - 256 + (players[i].skincolor<<8); + UINT8 *colormap = R_GetTranslationColormap(players[i].skin, players[i].skincolor, 0); //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(); - }*/ - ; + /*if (!(splitscreen || splitscreen3 || splitscreen4) && maptol & TOL_RACE && !hu_showscores) + HU_DrawRaceRankings();*/ + } + //; } static void K_drawKartItemRoulette(void) diff --git a/src/k_kart.h b/src/k_kart.h index d1c7716d..24fccd37 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -43,6 +43,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_LoadIconGraphics(char *facestr, INT32 skinnum); void K_drawMinimap(void); // ========================================================================= diff --git a/src/r_things.c b/src/r_things.c index 5ecaf399..6f88367a 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2493,6 +2493,7 @@ static void Sk_SetDefaultValue(skin_t *skin) for (i = 0; i < sfx_skinsoundslot0; i++) if (S_sfx[i].skinsound != -1) skin->soundsid[S_sfx[i].skinsound] = i; + strncpy(skin->iconprefix, "SONICICN", 8); } // @@ -2542,6 +2543,8 @@ void R_InitSkins(void) skin->spritedef.numframes = sprites[SPR_PLAY].numframes; skin->spritedef.spriteframes = sprites[SPR_PLAY].spriteframes; ST_LoadFaceGraphics(skin->face, skin->superface, 0); + strncpy(skin->iconprefix, "SONICICN", 8); + K_LoadIconGraphics(skin->iconprefix, 0); //MD2 for sonic doesn't want to load in Linux. #ifdef HWRENDER @@ -2870,6 +2873,11 @@ void R_AddSkins(UINT16 wadnum) skin->jumpfactor = FLOAT_TO_FIXED(atof(value)); else if (!stricmp(stoken, "highresscale")) skin->highresscale = FLOAT_TO_FIXED(atof(value)); + else if (!stricmp(stoken, "faceicon")) + { + strupr(value); + strncpy(skin->iconprefix, value, sizeof skin->iconprefix); + } else { INT32 found = false; @@ -2971,6 +2979,9 @@ next_token: // add face graphics ST_LoadFaceGraphics(skin->face, skin->superface, numskins); + + // load minimap icons + K_LoadIconGraphics(skin->iconprefix, numskins); #ifdef HWRENDER if (rendermode == render_opengl) diff --git a/src/r_things.h b/src/r_things.h index 675579c8..7a9729a3 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -113,6 +113,9 @@ typedef struct // specific sounds per skin sfxenum_t soundsid[NUMSKINSOUNDS]; // sound # in S_sfx table + + // minimap icons + char iconprefix[9]; } skin_t; // ----------- diff --git a/src/st_stuff.c b/src/st_stuff.c index c3aee555..91fef419 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -129,6 +129,7 @@ static patch_t *gotbflag; // static boolean facefreed[MAXPLAYERS]; +boolean iconfreed[MAXPLAYERS]; hudinfo_t hudinfo[NUMHUDITEMS] = { @@ -412,7 +413,10 @@ void ST_Init(void) INT32 i; for (i = 0; i < MAXPLAYERS; i++) + { facefreed[i] = true; + iconfreed[i] = true; + } if (dedicated) return; diff --git a/src/st_stuff.h b/src/st_stuff.h index c11559d2..63bb89a1 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -70,6 +70,7 @@ extern patch_t *faceprefix[MAXSKINS]; // face status patches extern patch_t *superprefix[MAXSKINS]; // super face status patches extern patch_t *livesback; extern patch_t *ngradeletters[7]; +extern boolean iconfreed[MAXPLAYERS]; /** HUD location information (don't move this comment) */