remove now unnecessary mobj skin_t casts

no more void pointers for this stuff!
This commit is contained in:
alufolie91 committed 2026-10-12 15:52:52 +02:00
1 parent fb61c474e8
commit 8a49388bba
10 files changed
+25 -21

No files matched your search

+1 -1
View File
@@ -4128,7 +4128,7 @@ static void Got_KickCmd(const UINT8 **p, INT32 playernum)
if (!players[i].mo->skin)
CONS_Printf("Mobj skin: NULL!\n");
else
CONS_Printf("Mobj skin: %s\n", ((skin_t *)players[i].mo->skin)->name);
CONS_Printf("Mobj skin: %s\n", players[i].mo->skin->name);
CONS_Printf("Position: %d, %d, %d\n", players[i].mo->x, players[i].mo->y, players[i].mo->z);
if (!players[i].mo->state)
CONS_Printf("State: S_NULL\n");
+2 -2
View File
@@ -4749,7 +4749,7 @@ static void HWR_DrawSprites(void)
/* fuck you */
if (spr->mobj->localskin)
{
skinnum = ((skin_t *)(spr->mobj->localskin))->skinnum;
skinnum = spr->mobj->localskin->skinnum;
if (spr->mobj->skinlocal)
{
@@ -4762,7 +4762,7 @@ static void HWR_DrawSprites(void)
}
else
{
skinnum = ((skin_t *)(spr->mobj->skin))->skinnum;
skinnum = spr->mobj->skin->skinnum;
md2 = &skins[skinnum]->playermodel;
}
+13 -10
View File
@@ -1229,24 +1229,27 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
// before: polygons models are not sorted
/* fuck you */
if (spr->mobj->localskin)
if (spr->mobj->skin)
{
skinnum = ((skin_t *)(spr->mobj->localskin))->skinnum;
if (spr->mobj->skinlocal)
if (spr->mobj->localskin)
{
md2s = &localskins[skinnum]->playermodel;
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;
}
}
else if (spr->mobj->skin)
{
skinnum = ((skin_t *)(spr->mobj->skin))->skinnum;
md2s = &skins[skinnum]->playermodel;
}
// 1. load model+texture if not already loaded
// 2. draw model with correct position, rotation,...
+2 -1
View File
@@ -2633,7 +2633,8 @@ static int lib_kLossSound(lua_State *L)
if (!mobj->player)
return luaL_error(L, "K_PlayLossSound: mobj_t isn't a player object.");
sfx_id = ((skin_t *)mobj->skin)->soundsid[S_sfx[sfx_klose].skinsound];
// FIXME: shouldnt this also account for localskins?
sfx_id = mobj->skin->soundsid[S_sfx[sfx_klose].skinsound];
S_StartSound(mobj, sfx_id);
return 0;
}
+1 -1
View File
@@ -962,7 +962,7 @@ static void res_botai(Hook_State *hook)
int LUA_HookBotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
{
const char *skin = ((skin_t *)tails->skin)->name;
const char *skin = tails->skin->name;
Hook_State hook = {};
BotAI_State botai = {};
+2 -2
View File
@@ -398,7 +398,7 @@ int mobj_skin_getter(lua_State *L)
}
else
{
lua_pushstring(L, ((skin_t *)mo->skin)->name);
lua_pushstring(L, mo->skin->name);
}
return 1;
@@ -429,7 +429,7 @@ int mobj_localskin_getter(lua_State *L)
mobj_t *mo = GETMO();
if (mo->localskin)
lua_pushstring(L, ((skin_t *)mo->localskin)->name);
lua_pushstring(L, mo->localskin->name);
else
lua_pushnil(L);
+1 -1
View File
@@ -2436,7 +2436,7 @@ void A_MonitorPop(void *thing)
if (actor->tracer) // Remove the old lives icon.
P_RemoveMobj(actor->tracer);
if (!newmobj->target->skin || ((skin_t *)newmobj->target->skin)->spritedef.numframes <= states[S_PLAY_BOX1].frame)
if (!newmobj->target->skin || newmobj->target->skin->spritedef.numframes <= states[S_PLAY_BOX1].frame)
newmobj->frame -= 2; // No lives icon for this player, use the default.
else
{ // Spawn the lives icon.
+1 -1
View File
@@ -6219,7 +6219,7 @@ angle_t P_MobjPitchAndRoll(mobj_t *mobj)
if (mobj->skin && mobj->sprite == SPR_PLAY)
{
sprdef = &((skin_t *)mobj->skin)->spritedef;
sprdef = &mobj->skin->spritedef;
if (rot >= sprdef->numframes)
sprdef = &sprites[mobj->sprite];
+1 -1
View File
@@ -1324,7 +1324,7 @@ static void SaveMobjThinker(savebuffer_t *save, const thinker_t *th, const UINT8
if (diff2 & MD2_CVMEM)
WRITEINT32(save->p, mobj->cvmem);
if (diff2 & MD2_SKIN)
WRITESKIN(save->p, (skinnum_t)((skin_t *)mobj->skin)->skinnum);
WRITESKIN(save->p, (skinnum_t)mobj->skin->skinnum);
if (diff2 & MD2_COLOR)
WRITEUINT8(save->p, mobj->color);
if (diff2 & MD2_EXTVAL1)
+1 -1
View File
@@ -389,7 +389,7 @@ angle_t R_PlayerSliptideAngle(player_t *player)
if (mo->skin && mo->sprite == SPR_PLAY)
{
sprdef = &((skin_t *)mo->skin)->spritedef;
sprdef = &mo->skin->spritedef;
if (rot >= sprdef->numframes)
sprdef = &sprites[mo->sprite];