Smiles follow-mobj initial support! Still using a Lua hook to follow closely behind, but now it doesn't need to be a generic thinkframe. Woo!

This commit is contained in:
toasterbabe 2017-10-02 14:08:58 +01:00
parent de4ea022c0
commit 844416855f
12 changed files with 127 additions and 0 deletions

View file

@ -2525,6 +2525,7 @@ static void Sk_SetDefaultValue(skin_t *skin)
skin->thokitem = -1;
skin->spinitem = -1;
skin->revitem = -1;
skin->followitem = 0;
skin->highresscale = FRACUNIT;
@ -2638,6 +2639,7 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
player->thokitem = skin->thokitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].painchance : (UINT32)skin->thokitem;
player->spinitem = skin->spinitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].damage : (UINT32)skin->spinitem;
player->revitem = skin->revitem < 0 ? (mobjtype_t)mobjinfo[MT_PLAYER].raisestate : (UINT32)skin->revitem;
player->followitem = skin->followitem;
player->actionspd = skin->actionspd;
player->mindash = skin->mindash;
@ -2663,6 +2665,12 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
player->skincolor = newcolor = skin->prefcolor;
}
if (player->followmobj)
{
P_RemoveMobj(player->followmobj);
player->followmobj = NULL;
}
if (player->mo)
{
fixed_t radius = FixedMul(skin->radius, player->mo->scale);
@ -2670,6 +2678,7 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
{
skin = &skins[DEFAULTNIGHTSSKIN];
newcolor = skin->prefcolor; // will be updated in thinker to flashing
player->followitem = skin->followitem;
}
player->mo->skin = skin;
if (newcolor)
@ -2803,6 +2812,7 @@ static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value)
FULLPROCESS(thokitem)
FULLPROCESS(spinitem)
FULLPROCESS(revitem)
FULLPROCESS(followitem)
#undef FULLPROCESS
#define GETFRACBITS(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value)<<FRACBITS;