Add delayed hit em sound (like in DRRR), togglable via 'karthitemdialog' cvar
This commit is contained in:
1 parent
f6c170b53c
commit
35029e826f
11 files changed
+129
-16
No files matched your search
@@ -397,6 +397,7 @@ static CV_PossibleValue_t kartspeedometer_cons_t[] = {{0, "Off"}, {1, "Kilometer
|
||||
consvar_t cv_kartspeedometer = {"kartdisplayspeed", "Off", CV_SAVE, kartspeedometer_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // use tics in display
|
||||
static CV_PossibleValue_t kartvoices_cons_t[] = {{0, "Never"}, {1, "Tasteful"}, {2, "Meme"}, {0, NULL}};
|
||||
consvar_t cv_kartvoices = {"kartvoices", "Tasteful", CV_SAVE, kartvoices_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_karthitemdialog = {"karthitemdialog", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_karteliminatelast = {"karteliminatelast", "Yes", CV_NETVAR|CV_CHEAT|CV_CALL|CV_NOSHOWHELP, CV_YesNo, KartEliminateLast_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
||||
@@ -128,6 +128,7 @@ extern consvar_t cv_kartvoterulechanges;
|
||||
extern consvar_t cv_kartgametypepreference;
|
||||
extern consvar_t cv_kartspeedometer;
|
||||
extern consvar_t cv_kartvoices;
|
||||
extern consvar_t cv_karthitemdialog;
|
||||
|
||||
extern consvar_t cv_karteliminatelast;
|
||||
|
||||
|
||||
@@ -546,6 +546,9 @@ typedef struct player_s
|
||||
tic_t grieftime;
|
||||
UINT8 griefstrikes;
|
||||
|
||||
tic_t hitemtimer;
|
||||
UINT8 hitemvictim;
|
||||
|
||||
UINT8 splitscreenindex;
|
||||
#ifdef HWRENDER
|
||||
fixed_t fovadd; // adjust FOV for hw rendering
|
||||
|
||||
+74
-6
@@ -680,6 +680,7 @@ void K_RegisterKartStuff(void)
|
||||
CV_RegisterVar(&cv_kartgametypepreference);
|
||||
CV_RegisterVar(&cv_kartspeedometer);
|
||||
CV_RegisterVar(&cv_kartvoices);
|
||||
CV_RegisterVar(&cv_karthitemdialog);
|
||||
CV_RegisterVar(&cv_karteliminatelast);
|
||||
CV_RegisterVar(&cv_votetime);
|
||||
|
||||
@@ -1899,6 +1900,31 @@ static void K_RegularVoiceTimers(player_t *player)
|
||||
player->kartstuff[k_tauntvoices] = 4*TICRATE;
|
||||
}
|
||||
|
||||
static void K_PlayGenericCombatSound(mobj_t *source, mobj_t *other, sfxenum_t sfx_id)
|
||||
{
|
||||
skin_t *skin = NULL;
|
||||
|
||||
// I HATE LOCALSKINS! I HATE LOCALSKINS! :AAAAAAAAAA:
|
||||
if (source->player)
|
||||
{
|
||||
INT32 skinnum = source->player->skinlocal ? (source->player->localskin - 1) : source->player->skin;
|
||||
skin = &(source->player->skinlocal ? localskins : skins)[skinnum];
|
||||
}
|
||||
|
||||
if (!skin)
|
||||
return;
|
||||
|
||||
boolean alwaysHear = false;
|
||||
|
||||
if (other != NULL && P_MobjWasRemoved(other) == false && other->player != NULL)
|
||||
alwaysHear = P_IsDisplayPlayer(other->player);
|
||||
|
||||
if (cv_kartvoices.value)
|
||||
S_StartSound(alwaysHear ? NULL : source, skin->soundsid[S_sfx[sfx_id].skinsound]);
|
||||
|
||||
K_RegularVoiceTimers(source->player);
|
||||
}
|
||||
|
||||
void K_PlayAttackTaunt(mobj_t *source)
|
||||
{
|
||||
sfxenum_t pick = P_RandomKey(2); // Gotta roll the RNG every time this is called for sync reasons
|
||||
@@ -1947,10 +1973,22 @@ void K_PlayOvertakeSound(mobj_t *source)
|
||||
K_RegularVoiceTimers(source->player);
|
||||
}
|
||||
|
||||
void K_PlayHitEmSound(mobj_t *source)
|
||||
void K_PlayHitEmSound(mobj_t *source, mobj_t *victim)
|
||||
{
|
||||
if (cv_kartvoices.value)
|
||||
S_StartSound(source, sfx_khitem);
|
||||
{
|
||||
if (cv_karthitemdialog.value && victim && victim->player)
|
||||
{
|
||||
I_Assert(source->player != NULL);
|
||||
|
||||
source->player->hitemtimer = TICRATE/2;
|
||||
source->player->hitemvictim = victim->player - players;
|
||||
|
||||
return; // Don't call K_RegularVoiceTimers yet, we didn't do any sound
|
||||
}
|
||||
else
|
||||
S_StartSound(source, sfx_khitem);
|
||||
}
|
||||
else
|
||||
S_StartSound(source, sfx_s1c9); // The only lost gameplay functionality with voices disabled
|
||||
|
||||
@@ -1965,6 +2003,33 @@ void K_PlayPowerGloatSound(mobj_t *source)
|
||||
K_RegularVoiceTimers(source->player);
|
||||
}
|
||||
|
||||
static void K_HandleDelayedHitByEm(player_t *player)
|
||||
{
|
||||
if (player->hitemtimer == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player->hitemtimer--;
|
||||
|
||||
if (player->hitemtimer == 0)
|
||||
{
|
||||
mobj_t *victim = NULL;
|
||||
|
||||
if (player->hitemvictim < MAXPLAYERS && playeringame[player->hitemvictim])
|
||||
{
|
||||
player_t *victimPlayer = &players[player->hitemvictim];
|
||||
|
||||
if (victimPlayer != NULL && victimPlayer->spectator == false)
|
||||
{
|
||||
victim = victimPlayer->mo;
|
||||
}
|
||||
}
|
||||
|
||||
K_PlayGenericCombatSound(player->mo, victim, sfx_khitem);
|
||||
}
|
||||
}
|
||||
|
||||
void K_MomentumToFacing(player_t *player)
|
||||
{
|
||||
angle_t dangle = player->mo->angle - R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy);
|
||||
@@ -2272,7 +2337,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
|
||||
return;
|
||||
|
||||
if (source && source != player->mo && source->player)
|
||||
K_PlayHitEmSound(source);
|
||||
K_PlayHitEmSound(source, player->mo);
|
||||
|
||||
//player->kartstuff[k_sneakertimer] = 0;
|
||||
player->kartstuff[k_driftboost] = 0;
|
||||
@@ -2472,7 +2537,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
|
||||
if (player->mo->state != &states[S_KART_SQUISH]) // Squash
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SQUISH);
|
||||
|
||||
P_PlayRinglossSound(player->mo);
|
||||
P_PlayRinglossSound(player->mo, source);
|
||||
|
||||
player->kartstuff[k_instashield] = 15;
|
||||
if (cv_kartdebughuddrop.value && !modeattacking)
|
||||
@@ -2524,7 +2589,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
|
||||
return;
|
||||
|
||||
if (source && source != player->mo && source->player)
|
||||
K_PlayHitEmSound(source);
|
||||
K_PlayHitEmSound(source, player->mo);
|
||||
|
||||
player->kartstuff[k_sneakertimer] = 0;
|
||||
player->kartstuff[k_driftboost] = 0;
|
||||
@@ -2605,7 +2670,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
|
||||
if (player->mo->state != &states[S_KART_SPIN])
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SPIN);
|
||||
|
||||
P_PlayRinglossSound(player->mo);
|
||||
P_PlayRinglossSound(player->mo, source);
|
||||
|
||||
if (P_IsLocalPlayer(player))
|
||||
{
|
||||
@@ -5278,6 +5343,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
||||
// Roulette Code
|
||||
K_KartItemRoulette(player, cmd);
|
||||
|
||||
// Used when karthitemdialog is On
|
||||
K_HandleDelayedHitByEm(player);
|
||||
|
||||
// Handle invincibility sfx
|
||||
K_UpdateInvincibilitySounds(player); // Also thanks, VAda!
|
||||
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ void K_UpdateSpectateGrief(void);
|
||||
void K_PlayAttackTaunt(mobj_t *source);
|
||||
void K_PlayBoostTaunt(mobj_t *source);
|
||||
void K_PlayOvertakeSound(mobj_t *source);
|
||||
void K_PlayHitEmSound(mobj_t *source);
|
||||
void K_PlayHitEmSound(mobj_t *source, mobj_t *victim);
|
||||
void K_PlayPowerGloatSound(mobj_t *source);
|
||||
|
||||
const char *K_GetItemPatch(UINT8 item, boolean tiny);
|
||||
|
||||
+22
-2
@@ -1259,6 +1259,7 @@ static int lib_pPlayRinglossSound(lua_State *L)
|
||||
{
|
||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
player_t *player = NULL;
|
||||
mobj_t *damager = NULL;
|
||||
NOHUD
|
||||
if (!source)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
@@ -1268,8 +1269,15 @@ static int lib_pPlayRinglossSound(lua_State *L)
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!lua_isnoneornil(L, 3))
|
||||
{
|
||||
damager = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
|
||||
if (!damager)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
P_PlayRinglossSound(source);
|
||||
P_PlayRinglossSound(source, damager);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2557,10 +2565,22 @@ static int lib_kOvertakeSound(lua_State *L)
|
||||
static int lib_kHitEmSound(lua_State *L)
|
||||
{
|
||||
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
mobj_t *victim = NULL;
|
||||
|
||||
if (!lua_isnoneornil(L, 2))
|
||||
{
|
||||
victim = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
if (!victim)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
}
|
||||
|
||||
NOHUD
|
||||
if (!mobj->player)
|
||||
return luaL_error(L, "K_PlayHitEmSound: mobj_t isn't a player object."); //Nothing bad would happen if we let it run the func, but telling why it ain't doing anything is helpful.
|
||||
K_PlayHitEmSound(mobj);
|
||||
if (victim && !victim->player)
|
||||
return luaL_error(L, "K_PlayHitEmSound: mobj_t isn't a player object."); //Same as above
|
||||
|
||||
K_PlayHitEmSound(mobj, victim);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1310,7 +1310,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
}
|
||||
else
|
||||
{
|
||||
P_PlayRinglossSound(toucher);
|
||||
P_PlayRinglossSound(toucher, NULL);
|
||||
if (toucher->health > 10)
|
||||
toucher->health -= 10;
|
||||
else
|
||||
@@ -2206,7 +2206,7 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou
|
||||
}
|
||||
else if (target->health > 1) // Ring loss
|
||||
{
|
||||
P_PlayRinglossSound(target);
|
||||
P_PlayRinglossSound(target, source);
|
||||
P_PlayerRingBurst(player, player->mo->health - 1);
|
||||
}
|
||||
|
||||
@@ -2351,7 +2351,7 @@ static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, IN
|
||||
}
|
||||
|
||||
// Ring loss sound plays despite hitting spikes
|
||||
P_PlayRinglossSound(player->mo); // Ringledingle!
|
||||
P_PlayRinglossSound(player->mo, source); // Ringledingle!
|
||||
}
|
||||
|
||||
/** Damages an object, which may or may not be a player.
|
||||
|
||||
+1
-1
@@ -215,7 +215,7 @@ boolean P_PlayerMoving(INT32 pnum);
|
||||
void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range);
|
||||
|
||||
void P_PlayLivesJingle(player_t *player);
|
||||
void P_PlayRinglossSound(mobj_t *source);
|
||||
void P_PlayRinglossSound(mobj_t *source, mobj_t *damager);
|
||||
void P_PlayDeathSound(mobj_t *source);
|
||||
void P_PlayVictorySound(mobj_t *source);
|
||||
|
||||
|
||||
@@ -10639,6 +10639,8 @@ void P_SpawnPlayer(INT32 playernum)
|
||||
//P_DoPityCheck(p);
|
||||
|
||||
p->grieftime = 0;
|
||||
p->hitemtimer = 0;
|
||||
p->hitemvictim = 255;
|
||||
|
||||
if (G_BattleGametype()) // SRB2kart
|
||||
{
|
||||
|
||||
+1
-1
@@ -3375,7 +3375,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
||||
}
|
||||
else if (player->mo->health > 1)
|
||||
{
|
||||
P_PlayRinglossSound(player->mo);
|
||||
P_PlayRinglossSound(player->mo, NULL);
|
||||
if (player->mo->health > 10)
|
||||
player->mo->health -= 10;
|
||||
else
|
||||
|
||||
+20
-2
@@ -590,11 +590,29 @@ void P_PlayLivesJingle(player_t *player)
|
||||
}
|
||||
}
|
||||
|
||||
void P_PlayRinglossSound(mobj_t *source)
|
||||
void P_PlayRinglossSound(mobj_t *source, mobj_t *damager)
|
||||
{
|
||||
sfxenum_t key = P_RandomKey(2);
|
||||
if (cv_kartvoices.value)
|
||||
S_StartSound(source, (mariomode) ? sfx_mario8 : sfx_khurt1 + key);
|
||||
{
|
||||
if (cv_karthitemdialog.value && source != damager && damager && damager->player && P_IsLocalPlayer(damager->player))
|
||||
{
|
||||
sfxenum_t sfx = sfx_khurt1 + key;
|
||||
|
||||
INT32 skinnum = -1;
|
||||
|
||||
// I HATE LOCALSKINS! I HATE LOCALSKINS! :AAAAAAAAAA:
|
||||
if (source->player)
|
||||
skinnum = source->player->skinlocal ? (source->player->localskin - 1) : source->player->skin;
|
||||
|
||||
if (skinnum >= 0)
|
||||
sfx = (source->player->skinlocal ? localskins : skins)[skinnum].soundsid[SKSKPAN1 + key];
|
||||
|
||||
S_StartSound(NULL, sfx);
|
||||
}
|
||||
else
|
||||
S_StartSound(source, (mariomode) ? sfx_mario8 : sfx_khurt1 + key);
|
||||
}
|
||||
else
|
||||
S_StartSound(source, sfx_slip);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user