cleanup localskin md2 handling

This commit is contained in:
alufolie91 committed 2026-10-12 16:23:26 +02:00
1 parent 31d8ad1d1a
commit 5cc66172a4
3 files changed
+21 -53

No files matched your search

+1 -21
View File
@@ -4361,28 +4361,8 @@ static void HWR_DrawSprites(void)
{
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
{
md2_t *md2 = NULL;
skinnum_t skinnum = 0;
/* fuck you */
if (spr->mobj->localskin)
{
skinnum = spr->mobj->localskin->skinnum;
if (spr->mobj->skinlocal)
{
md2 = &localskins[skinnum]->playermodel;
}
else
{
md2 = &skins[skinnum]->playermodel;
}
}
else
{
skinnum = spr->mobj->skin->skinnum;
md2 = &skins[skinnum]->playermodel;
}
md2_t *md2 = &R_GetMobjSkin(spr->mobj)->playermodel;
// 8/1/19: Only don't display player models if no default SPR_PLAY is found.
if (((md2->notfound || md2->scale < 0.0f) && ((!cv_glfallbackplayermodel.value) || md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)) || spr->mobj->state == &states[S_PLAY_SIGN])
+19 -31
View File
@@ -1167,8 +1167,6 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
// Look at HWR_ProjectSprite for more
{
md2_t *md2s = NULL;
int skinnum = 0;
patch_t *gpatch, *blendgpatch;
GLPatch_t *hwrPatch = NULL, *hwrBlendPatch = NULL;
INT32 durs = spr->mobj->state->tics;
@@ -1228,39 +1226,29 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
// dont forget to enabled the depth test because we can't do this like
// before: polygons models are not sorted
/* fuck you */
if (spr->mobj->skin)
{
if (spr->mobj->localskin)
{
skinnum = spr->mobj->localskin->skinnum;
if (spr->mobj->skinlocal)
{
md2s = &localskins[skinnum]->playermodel;
}
else
{
md2s = &skins[skinnum]->playermodel;
}
}
else
{
skinnum = spr->mobj->skin->skinnum;
md2s = &skins[skinnum]->playermodel;
}
}
// 1. load model+texture if not already loaded
// 2. draw model with correct position, rotation,...
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY && !md2s->notfound) // Use the player MD2 list if the mobj has a skin and is using the player sprites
// Use the player MD2 list if the mobj has a skin and is using the player sprites
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
{
md2 = md2s;
md2->skinnum = skinnum;
sprinfo = &spriteinfo[spr->mobj->sprite];
/* fuck you */
md2_t *md2s = &R_GetMobjSkin(spr->mobj)->playermodel;
if (!md2s->notfound)
{
md2 = md2s;
md2->skinnum = R_GetMobjSkinNum(spr->mobj);
sprinfo = &spriteinfo[spr->mobj->sprite];
}
else // if we can't find the player md2, use SPR_PLAY's MD2.
{
md2 = &md2_models[spr->mobj->sprite];
sprinfo = &spriteinfo[spr->mobj->sprite];
}
}
else
{ // if we can't find the player md2, use SPR_PLAY's MD2.
{
md2 = &md2_models[spr->mobj->sprite];
sprinfo = &spriteinfo[spr->mobj->sprite];
}
@@ -1342,7 +1330,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
}
else
{
tcskinnum = (INT32)(R_GetMobjSkin(spr->mobj)->skinnum);
tcskinnum = (INT32)R_GetMobjSkinNum(spr->mobj);
}
}
else tcskinnum = TC_DEFAULT;
+1 -1
View File
@@ -847,7 +847,7 @@ skin_t *R_GetPlayerSkin(player_t *player)
//
INT32 R_GetMobjSkinNum(const mobj_t *mobj)
{
return (mobj->localskin && mobj->skinlocal) ? mobj->localskin->skinnum : mobj->skin->skinnum;
return mobj->localskin ? mobj->localskin->skinnum : mobj->skin->skinnum;
}
//