simplify skin helper functions a bit
This commit is contained in:
1 parent
c6f9458e4f
commit
a061d72a8d
5 files changed
+28
-44
No files matched your search
+4
-1
@@ -2654,9 +2654,12 @@ static inline void HU_DrawSpectatorTicker(void)
|
||||
|
||||
if (player->mo && player->mo->color)
|
||||
{
|
||||
const UINT8 *colormap = R_GetTranslationColormap(player->skin, player->mo->color, GTC_CACHE);
|
||||
const UINT8 *colormap = NULL;
|
||||
|
||||
if (player->mo->colorized)
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, player->mo->color, GTC_CACHE);
|
||||
else
|
||||
colormap = R_GetTranslationColormap(player->skin, player->mo->color, GTC_CACHE);
|
||||
|
||||
if (K_UseHighResPortraits())
|
||||
V_DrawSmallMappedPatch((templength - duptweak), height+10, V_TRANSLUCENT, R_GetSkinFaceWant(player), colormap);
|
||||
|
||||
+1
-1
@@ -9909,7 +9909,7 @@ static void M_DrawLocalSkinMenu(void)
|
||||
V_DrawFill(mx + 220 - (charw/2), my+54, charw, 84, 239);
|
||||
#undef charw
|
||||
|
||||
// FIXME: is skins[displayskin.localnum] even correct?
|
||||
// FIXME: is using just "skins" array even correct?
|
||||
UINT8 *colormap = R_GetLocalTranslationColormap(skins[displayskin->skinnum], (displayskin->localskin ? localskins[displayskin->skinnum] : NULL), cv_playercolor.value, GTC_MENUCACHE, displayskin->localskin);
|
||||
|
||||
V_DrawMappedPatch(mx, my+50, 0, (patch_t *)W_CachePatchName(displayskin->facewant, PU_PATCH), colormap);
|
||||
|
||||
+10
-31
@@ -441,47 +441,26 @@ UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags)
|
||||
|
||||
UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors_t color, UINT8 flags, boolean local)
|
||||
{
|
||||
const INT32 skinnum = (INT32)((localskin && local) ? localskin->skinnum : skin->skinnum);
|
||||
const INT32 skinnum = (INT32)((localskin && local) ? localskin->skinnum : (skin != NULL ? skin->skinnum : 0));
|
||||
return RGetTranslationColormap(skinnum, color, flags, (localskin && local));
|
||||
}
|
||||
|
||||
patch_t* R_GetSkinFaceRank(player_t* ply)
|
||||
patch_t* R_GetSkinFaceRank(player_t* player)
|
||||
{
|
||||
if (ply->localskin)
|
||||
{
|
||||
if (ply->skinlocal)
|
||||
return localskins[ply->localskin - 1]->facerankprefix;
|
||||
|
||||
return skins[ply->localskin - 1]->facerankprefix;
|
||||
}
|
||||
|
||||
return skins[ply->skin]->facerankprefix;
|
||||
const skin_t *skin = R_GetPlayerSkin(player);
|
||||
return skin->facerankprefix;
|
||||
}
|
||||
|
||||
patch_t* R_GetSkinFaceWant(player_t* ply)
|
||||
patch_t* R_GetSkinFaceWant(player_t* player)
|
||||
{
|
||||
if (ply->localskin)
|
||||
{
|
||||
if (ply->skinlocal)
|
||||
return localskins[ply->localskin - 1]->facewantprefix;
|
||||
|
||||
return skins[ply->localskin - 1]->facewantprefix;
|
||||
}
|
||||
|
||||
return skins[ply->skin]->facewantprefix;
|
||||
const skin_t *skin = R_GetPlayerSkin(player);
|
||||
return skin->facewantprefix;
|
||||
}
|
||||
|
||||
patch_t* R_GetSkinFaceMini(player_t* ply)
|
||||
patch_t* R_GetSkinFaceMini(player_t* player)
|
||||
{
|
||||
if (ply->localskin)
|
||||
{
|
||||
if (ply->skinlocal)
|
||||
return localskins[ply->localskin - 1]->facemmapprefix;
|
||||
|
||||
return skins[ply->localskin - 1]->facemmapprefix;
|
||||
}
|
||||
|
||||
return skins[ply->skin]->facemmapprefix;
|
||||
const skin_t *skin = R_GetPlayerSkin(player);
|
||||
return skin->facemmapprefix;
|
||||
}
|
||||
|
||||
/** \brief Flushes cache of translation colormaps.
|
||||
|
||||
+12
-10
@@ -812,6 +812,8 @@ void R_AddSkins(UINT16 wadnum, boolean local)
|
||||
return;
|
||||
}
|
||||
|
||||
// Helper functions for skin stuff
|
||||
|
||||
//
|
||||
// returns the skin array to use
|
||||
// accounts for localskins
|
||||
@@ -821,15 +823,6 @@ skin_t **R_GetSkinArray(boolean local)
|
||||
return local ? localskins : skins;
|
||||
}
|
||||
|
||||
//
|
||||
// returns the players skin
|
||||
// accounts for localskins
|
||||
//
|
||||
skin_t *R_GetPlayerSkin(player_t *player)
|
||||
{
|
||||
return R_GetSkinArray(player->skinlocal)[R_GetPlayerSkinNum(player)];
|
||||
}
|
||||
|
||||
//
|
||||
// returns the players skinnumber
|
||||
// accounts for localskins
|
||||
@@ -839,11 +832,20 @@ INT32 R_GetPlayerSkinNum(player_t *player)
|
||||
return player->localskin ? (player->localskin - 1) : player->skin;
|
||||
}
|
||||
|
||||
//
|
||||
// returns the players skin
|
||||
// accounts for localskins
|
||||
//
|
||||
skin_t *R_GetPlayerSkin(player_t *player)
|
||||
{
|
||||
return R_GetSkinArray(player->skinlocal)[R_GetPlayerSkinNum(player)];
|
||||
}
|
||||
|
||||
//
|
||||
// returns the mobj skinnumber
|
||||
// accounts for localskins
|
||||
//
|
||||
INT32 R_GetMobjLocalSkinNum(const mobj_t *mobj)
|
||||
INT32 R_GetMobjSkinNum(const mobj_t *mobj)
|
||||
{
|
||||
return (mobj->localskin && mobj->skinlocal) ? mobj->localskin->skinnum : mobj->skin->skinnum;
|
||||
}
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ INT32 R_LocalSkinAvailable(const char *name, boolean local);
|
||||
skin_t **R_GetSkinArray(boolean local);
|
||||
skin_t *R_GetPlayerSkin(player_t *player);
|
||||
INT32 R_GetPlayerSkinNum(player_t *player);
|
||||
INT32 R_GetMobjLocalSkinNum(const mobj_t *mobj);
|
||||
INT32 R_GetMobjSkinNum(const mobj_t *mobj);
|
||||
skin_t *R_GetMobjSkin(const mobj_t *mobj);
|
||||
|
||||
void sortSkinGrid(void);
|
||||
|
||||
Reference in new issue
Block a user