Add "horn" state for followers
This commit is contained in:
parent
055a93b654
commit
2221d6b027
4 changed files with 34 additions and 1 deletions
|
|
@ -3762,6 +3762,7 @@ void readfollower(MYFILE *f)
|
|||
followers[numfollowers].bobspeed = TICRATE*2;
|
||||
followers[numfollowers].bobamp = 4*FRACUNIT;
|
||||
followers[numfollowers].hitconfirmtime = TICRATE;
|
||||
followers[numfollowers].horntime = TICRATE;
|
||||
followers[numfollowers].defaultcolor = FOLLOWERCOLOR_MATCH;
|
||||
followers[numfollowers].hornsound = sfx_horn00;
|
||||
strcpy(followers[numfollowers].icon, "MISSING");
|
||||
|
|
@ -3919,6 +3920,16 @@ void readfollower(MYFILE *f)
|
|||
{
|
||||
followers[numfollowers].hitconfirmtime = (tic_t)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "HORNSTATE"))
|
||||
{
|
||||
if (word2)
|
||||
strupr(word2);
|
||||
followers[numfollowers].hornstate = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "HORNTIME"))
|
||||
{
|
||||
followers[numfollowers].horntime = (tic_t)get_number(word2);
|
||||
}
|
||||
else
|
||||
{
|
||||
deh_warning("Follower %d: unknown word '%s'", numfollowers, word);
|
||||
|
|
@ -3985,6 +3996,7 @@ if ((signed)followers[numfollowers].field < threshold) \
|
|||
FALLBACK(bobamp, "BOBAMP", 0, 0);
|
||||
FALLBACK(bobspeed, "BOBSPEED", 0, 0);
|
||||
FALLBACK(hitconfirmtime, "HITCONFIRMTIME", 1, 1);
|
||||
FALLBACK(horntime, "HORNTIME", 1, 1);
|
||||
FALLBACK(scale, "SCALE", 1, 1); // No null/negative scale
|
||||
FALLBACK(bubblescale, "BUBBLESCALE", 0, 0); // No negative scale
|
||||
|
||||
|
|
@ -4016,6 +4028,7 @@ if (!followers[numfollowers].field) \
|
|||
NOSTATE(losestate, "LOSESTATE");
|
||||
NOSTATE(winstate, "WINSTATE");
|
||||
NOSTATE(hitconfirmstate, "HITCONFIRMSTATE");
|
||||
NOSTATE(hornstate, "HORNSTATE");
|
||||
#undef NOSTATE
|
||||
|
||||
CONS_Printf("Added follower '%s'\n", dname);
|
||||
|
|
|
|||
|
|
@ -571,8 +571,9 @@ void K_HandleFollower(player_t *player)
|
|||
// hurt or dead
|
||||
if (P_PlayerInPain(player) == true || player->mo->state == &states[S_KART_SPINOUT] || player->mo->health <= 0)
|
||||
{
|
||||
// cancel hit confirm.
|
||||
// cancel hit confirm / horn
|
||||
player->follower->movecount = 0;
|
||||
player->follower->reactiontime = 0;
|
||||
|
||||
// spin out
|
||||
player->follower->angle = player->drawangle;
|
||||
|
|
@ -604,6 +605,11 @@ void K_HandleFollower(player_t *player)
|
|||
K_UpdateFollowerState(player->follower, fl.hitconfirmstate, FOLLOWERSTATE_HITCONFIRM);
|
||||
player->follower->movecount--;
|
||||
}
|
||||
else if (player->follower->reactiontime)
|
||||
{
|
||||
K_UpdateFollowerState(player->follower, fl.hornstate, FOLLOWERSTATE_HORN);
|
||||
player->follower->reactiontime--;
|
||||
}
|
||||
else if (player->speed > 10*player->mo->scale) // animation for moving fast enough
|
||||
{
|
||||
K_UpdateFollowerState(player->follower, fl.followstate, FOLLOWERSTATE_FOLLOW);
|
||||
|
|
@ -725,6 +731,7 @@ void K_FollowerHornTaunt(player_t *taunter, player_t *victim)
|
|||
P_SetScale(honk, (11*desiredscale)/10);
|
||||
honk->fuse = TICRATE/2;
|
||||
honk->renderflags |= RF_DONTDRAW;
|
||||
taunter->follower->reactiontime = fl->horntime; // reactiontime is used to play the horn animation for followers.
|
||||
|
||||
S_StartSound(taunter->follower, fl->hornsound);
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ typedef enum
|
|||
FOLLOWERSTATE_WIN,
|
||||
FOLLOWERSTATE_LOSE,
|
||||
FOLLOWERSTATE_HITCONFIRM, // Uses movecount as a timer for how long to play this state.
|
||||
FOLLOWERSTATE_HORN, // Uses reactiontime as a timer for how long to play this state.
|
||||
FOLLOWERSTATE__MAX
|
||||
} followerstate_t;
|
||||
|
||||
|
|
@ -89,6 +90,8 @@ struct follower_t
|
|||
statenum_t losestate; // state when the player has lost
|
||||
statenum_t hitconfirmstate; // state for hit confirm
|
||||
tic_t hitconfirmtime; // time to keep the above playing for
|
||||
statenum_t hornstate; // state for pressing horn
|
||||
tic_t horntime; // time to keep the above playing for
|
||||
|
||||
sfxenum_t hornsound; // Press (B) to announce you are pressing (B)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ enum follower {
|
|||
follower_losestate,
|
||||
follower_hitconfirmstate,
|
||||
follower_hitconfirmtime,
|
||||
follower_hornstate,
|
||||
follower_horntime,
|
||||
//
|
||||
};
|
||||
static const char *const follower_opt[] = {
|
||||
|
|
@ -69,6 +71,8 @@ static const char *const follower_opt[] = {
|
|||
"losestate",
|
||||
"hitconfirmstate",
|
||||
"hitconfirmtime",
|
||||
"hornstate",
|
||||
"horntime",
|
||||
//
|
||||
NULL
|
||||
};
|
||||
|
|
@ -151,6 +155,12 @@ static int follower_get(lua_State *L)
|
|||
case follower_hitconfirmtime:
|
||||
lua_pushinteger(L, follower->hitconfirmtime);
|
||||
break;
|
||||
case follower_hornstate:
|
||||
lua_pushinteger(L, follower->hornstate);
|
||||
break;
|
||||
case follower_horntime:
|
||||
lua_pushinteger(L, follower->horntime);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue