Redid how karma bombs/items work. Again

The overlay object now has a hitbox which handles all of the item giving/bombing code, and no longer takes up the player's tracer. This is to give them a bigger hitbox without any bad side-effects of changing the player's hitbox directly (shadow size). Should make bombing more useful, and just sliiiightly less missed high-fives from items.
This commit is contained in:
TehRealSalt 2018-06-16 00:00:46 -04:00
parent b71471d1ba
commit 98c6d0f6d9
7 changed files with 153 additions and 125 deletions

View file

@ -7212,6 +7212,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_FIREDITEM",
"MT_PLAYERARROW",
"MT_KARMAHITBOX",
#ifdef SEENAMES
"MT_NAMECHECK",

View file

@ -16560,6 +16560,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
{ // MT_KARMAHITBOX
-1, // doomednum
S_PLAYERBOMB, // spawnstate
1000, // spawnhealth
S_PLAYERITEM, // seestate
sfx_kc2e, // seesound
8, // reactiontime
sfx_s3k4e, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
26*FRACUNIT, // radius
52*FRACUNIT, // height
-1, // display offset
0, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_NOCLIPHEIGHT|MF_NOGRAVITY, // flags
S_NULL // raisestate
},
// ============================================================================================================================//
#ifdef SEENAMES

View file

@ -4071,6 +4071,7 @@ typedef enum mobj_type
MT_FIREDITEM,
MT_PLAYERARROW,
MT_KARMAHITBOX,
#ifdef SEENAMES
MT_NAMECHECK,

View file

@ -1379,7 +1379,13 @@ void K_SpinPlayer(player_t *player, mobj_t *source)
if (player->kartstuff[k_balloon] > 0)
{
if (player->kartstuff[k_balloon] == 1)
{
mobj_t *karmahitbox = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_KARMAHITBOX); // Player hitbox is too small!!
P_SetTarget(&karmahitbox->target, player->mo);
karmahitbox->destscale = player->mo->scale;
P_SetScale(karmahitbox, player->mo->scale);
CONS_Printf(M_GetText("%s lost all of their balloons!\n"), player_names[player-players]);
}
player->kartstuff[k_balloon]--;
}
@ -1437,7 +1443,13 @@ void K_SquishPlayer(player_t *player, mobj_t *source)
if (player->kartstuff[k_balloon] > 0)
{
if (player->kartstuff[k_balloon] == 1)
{
mobj_t *karmahitbox = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_KARMAHITBOX); // Player hitbox is too small!!
P_SetTarget(&karmahitbox->target, player->mo);
karmahitbox->destscale = player->mo->scale;
P_SetScale(karmahitbox, player->mo->scale);
CONS_Printf(M_GetText("%s lost all of their balloons!\n"), player_names[player-players]);
}
player->kartstuff[k_balloon]--;
}
@ -1479,22 +1491,18 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju
if (G_BattleGametype())
{
if (source && source->player && player != source->player)
{
if (source->player->kartstuff[k_balloon] <= 0)
{
source->player->kartstuff[k_comebackpoints] += 2;
if (netgame && cv_hazardlog.value)
CONS_Printf(M_GetText("%s bombed %s!\n"), player_names[source->player-players], player_names[player-players]);
if (source->player->kartstuff[k_comebackpoints] >= 3)
K_StealBalloon(source->player, player, true);
}
P_AddPlayerScore(source->player, 1);
}
if (player->kartstuff[k_balloon] > 0)
{
if (player->kartstuff[k_balloon] == 1)
{
mobj_t *karmahitbox = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_KARMAHITBOX); // Player hitbox is too small!!
P_SetTarget(&karmahitbox->target, player->mo);
karmahitbox->destscale = player->mo->scale;
P_SetScale(karmahitbox, player->mo->scale);
CONS_Printf(M_GetText("%s lost all of their balloons!\n"), player_names[player-players]);
}
player->kartstuff[k_balloon]--;
}
@ -3419,51 +3427,11 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
{
K_StripItems(player);
player->mo->flags2 |= MF2_SHADOW;
if (!(player->mo->tracer))
{
player->mo->tracer = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_OVERLAY);
P_SetMobjState(player->mo->tracer, S_PLAYERBOMB);
}
P_SetTarget(&player->mo->tracer->target, player->mo);
player->mo->tracer->color = player->mo->color;
player->mo->tracer->colorized = (player->kartstuff[k_comebackmode] == 1);
if (player->kartstuff[k_comebacktimer] > 0)
{
if (player->mo->tracer->state != &states[S_PLAYERBOMB])
P_SetMobjState(player->mo->tracer, S_PLAYERBOMB);
if (player->kartstuff[k_comebacktimer] < TICRATE && (leveltime & 1))
player->mo->tracer->flags2 &= ~MF2_DONTDRAW;
else
player->mo->tracer->flags2 |= MF2_DONTDRAW;
player->powers[pw_flashing] = player->kartstuff[k_comebacktimer];
}
else
{
if (player->kartstuff[k_comebackmode] == 0
&& player->mo->tracer->state != &states[S_PLAYERBOMB])
P_SetMobjState(player->mo->tracer, S_PLAYERBOMB);
else if (player->kartstuff[k_comebackmode] == 1
&& player->mo->tracer->state != &states[S_PLAYERITEM])
P_SetMobjState(player->mo->tracer, S_PLAYERITEM);
if ((player->powers[pw_flashing] || player->kartstuff[k_spinouttimer]) && (leveltime & 1))
player->mo->tracer->flags2 |= MF2_DONTDRAW;
else
player->mo->tracer->flags2 &= ~MF2_DONTDRAW;
}
player->powers[pw_flashing] = player->kartstuff[k_comebacktimer];
}
else if (G_RaceGametype() || player->kartstuff[k_balloon] > 0)
{
player->mo->flags2 &= ~MF2_SHADOW;
if (player->mo->tracer
&& (player->mo->tracer->state == &states[S_PLAYERBOMB]
|| player->mo->tracer->state == &states[S_PLAYERITEM]))
P_RemoveMobj(player->mo->tracer);
}
}

View file

@ -422,6 +422,61 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
P_SetTarget(&special->target, toucher);
P_KillMobj(special, toucher, toucher);
break;
case MT_KARMAHITBOX:
if (!special->target->player)
return;
if (player == special->target->player)
return;
if (player->kartstuff[k_growshrinktimer] || player->kartstuff[k_squishedtimer]
|| player->kartstuff[k_hyudorotimer] || player->kartstuff[k_spinouttimer]
|| player->kartstuff[k_invincibilitytimer] || player->powers[pw_flashing]
|| player->kartstuff[k_balloon] <= 0)
return;
if (special->target->player->kartstuff[k_comebacktimer]
|| special->target->player->kartstuff[k_spinouttimer]
|| special->target->player->kartstuff[k_squishedtimer])
return;
if (special->target->player->kartstuff[k_comebackmode] == 0)
{
mobj_t *boom = P_SpawnMobj(special->target->x, special->target->y, special->target->z, MT_BOOMPARTICLE);
boom->scale = special->target->scale;
boom->destscale = special->target->scale;
boom->momz = 5*FRACUNIT;
if (special->target->color)
boom->color = special->target->color;
else
boom->color = SKINCOLOR_RED;
S_StartSound(boom, special->info->attacksound);
K_ExplodePlayer(player, special->target);
special->target->player->kartstuff[k_comebackpoints] += 2;
if (netgame && cv_hazardlog.value)
CONS_Printf(M_GetText("%s bombed %s!\n"), player_names[special->target->player-players], player_names[player-players]);
if (special->target->player->kartstuff[k_comebackpoints] >= 3)
K_StealBalloon(special->target->player, player, true);
special->target->player->kartstuff[k_comebacktimer] = comebacktime;
}
else if (special->target->player->kartstuff[k_comebackmode] == 1 && P_CanPickupItem(player, true))
{
mobj_t *poof = P_SpawnMobj(tmthing->x, tmthing->y, tmthing->z, MT_EXPLODE);
S_StartSound(poof, special->info->seesound);
player->kartstuff[k_itemroulette] = 1;
player->kartstuff[k_roulettetype] = 1;
special->target->player->kartstuff[k_comebackmode] = 0;
special->target->player->kartstuff[k_comebackpoints]++;
if (netgame && cv_hazardlog.value)
CONS_Printf(M_GetText("%s gave an item to %s.\n"), player_names[special->target->player-players], player_names[player-players]);
if (special->target->player->kartstuff[k_comebackpoints] >= 3)
K_StealBalloon(special->target->player, player, true);
special->target->player->kartstuff[k_comebacktimer] = comebacktime;
}
return;
// ***************************************** //
// Rings, coins, spheres, weapon panels, etc //
// ***************************************** //
@ -2755,7 +2810,13 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
if (player->kartstuff[k_balloon] > 0)
{
if (player->kartstuff[k_balloon] == 1)
{
mobj_t *karmahitbox = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_KARMAHITBOX); // Player hitbox is too small!!
P_SetTarget(&karmahitbox->target, player->mo);
karmahitbox->destscale = player->mo->scale;
P_SetScale(karmahitbox, player->mo->scale);
CONS_Printf(M_GetText("%s lost all of their balloons!\n"), player_names[player-players]);
}
player->kartstuff[k_balloon]--;
}

View file

@ -1644,79 +1644,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true;
}
if (G_BattleGametype())
{
if (thing->player->kartstuff[k_balloon] <= 0 || tmthing->player->kartstuff[k_balloon] <= 0)
{
if (thing->player->kartstuff[k_comebackmode] == 0
&& (tmthing->player->kartstuff[k_balloon] > 0
&& !tmthing->player->powers[pw_flashing]))
{
mobj_t *boom = P_SpawnMobj(thing->x, thing->y, thing->z, MT_BOOMPARTICLE);
boom->scale = thing->scale;
boom->destscale = thing->scale;
boom->momz = 5*FRACUNIT;
if (thing->player->skincolor)
boom->color = thing->player->skincolor;
else
boom->color = SKINCOLOR_RED;
S_StartSound(boom, sfx_s3k4e);
K_ExplodePlayer(tmthing->player, thing);
thing->player->kartstuff[k_comebacktimer] = comebacktime;
return true;
}
else if (tmthing->player->kartstuff[k_comebackmode] == 0
&& (thing->player->kartstuff[k_balloon] > 0
&& !thing->player->powers[pw_flashing]))
{
mobj_t *boom = P_SpawnMobj(tmthing->x, tmthing->y, tmthing->z, MT_BOOMPARTICLE);
boom->scale = tmthing->scale;
boom->destscale = tmthing->scale;
boom->momz = 5*FRACUNIT;
if (tmthing->player->skincolor)
boom->color = tmthing->player->skincolor;
else
boom->color = SKINCOLOR_RED;
S_StartSound(boom, sfx_s3k4e);
K_ExplodePlayer(thing->player, tmthing);
tmthing->player->kartstuff[k_comebacktimer] = comebacktime;
return true;
}
else if (thing->player->kartstuff[k_comebackmode] == 1
&& (tmthing->player->kartstuff[k_balloon] > 0
&& P_CanPickupItem(tmthing->player, true)))
{
thing->player->kartstuff[k_comebackmode] = 0;
thing->player->kartstuff[k_comebackpoints]++;
if (netgame && cv_hazardlog.value)
CONS_Printf(M_GetText("%s gave an item to %s.\n"), player_names[thing->player-players], player_names[tmthing->player-players]);
tmthing->player->kartstuff[k_itemroulette] = 1;
tmthing->player->kartstuff[k_roulettetype] = 1;
P_SpawnMobj(tmthing->x, tmthing->y, tmthing->z, MT_EXPLODE);
if (thing->player->kartstuff[k_comebackpoints] >= 3)
K_StealBalloon(thing->player, tmthing->player, true);
thing->player->kartstuff[k_comebacktimer] = comebacktime;
return true;
}
else if (tmthing->player->kartstuff[k_comebackmode] == 1
&& (thing->player->kartstuff[k_balloon] > 0
&& P_CanPickupItem(thing->player, true)))
{
tmthing->player->kartstuff[k_comebackmode] = 0;
tmthing->player->kartstuff[k_comebackpoints]++;
if (netgame && cv_hazardlog.value)
CONS_Printf(M_GetText("%s gave an item to %s.\n"), player_names[tmthing->player-players], player_names[thing->player-players]);
thing->player->kartstuff[k_itemroulette] = 1;
thing->player->kartstuff[k_roulettetype] = 1;
P_SpawnMobj(thing->x, thing->y, thing->z, MT_EXPLODE);
if (tmthing->player->kartstuff[k_comebackpoints] >= 3)
K_StealBalloon(tmthing->player, thing->player, true);
tmthing->player->kartstuff[k_comebacktimer] = comebacktime;
return true;
}
}
}
if (P_IsObjectOnGround(thing) && tmthing->momz < 0)
{
K_KartBouncing(tmthing, thing, true, false);

View file

@ -8141,6 +8141,43 @@ void P_MobjThinker(mobj_t *mobj)
}
P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
break;
case MT_KARMAHITBOX:
if (!mobj->target || !mobj->target->health || !mobj->target->player
|| (G_RaceGametype() || mobj->target->player->kartstuff[k_balloon]))
{
P_RemoveMobj(mobj);
return;
}
P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
mobj->color = mobj->target->color;
mobj->colorized = (mobj->target->player->kartstuff[k_comebackmode] == 1);
if (mobj->target->player->kartstuff[k_comebacktimer] > 0)
{
if (mobj->state != &states[mobj->info->spawnstate])
P_SetMobjState(mobj, mobj->info->spawnstate);
if (mobj->target->player->kartstuff[k_comebacktimer] < TICRATE && (leveltime & 1))
mobj->flags2 &= ~MF2_DONTDRAW;
else
mobj->flags2 |= MF2_DONTDRAW;
}
else
{
if (mobj->target->player->kartstuff[k_comebackmode] == 0
&& mobj->state != &states[mobj->info->spawnstate])
P_SetMobjState(mobj, mobj->info->spawnstate);
else if (mobj->target->player->kartstuff[k_comebackmode] == 1
&& mobj->state != &states[mobj->info->seestate])
P_SetMobjState(mobj, mobj->info->seestate);
if (mobj->target->player->powers[pw_flashing] && (leveltime & 1))
mobj->flags2 |= MF2_DONTDRAW;
else
mobj->flags2 &= ~MF2_DONTDRAW;
}
break;
//}
case MT_TURRET:
P_MobjCheckWater(mobj);
@ -9721,7 +9758,6 @@ void P_SpawnPlayer(INT32 playernum)
if (G_BattleGametype()) // SRB2kart
{
mobj_t *overheadarrow = P_SpawnMobj(mobj->x, mobj->y, mobj->z + P_GetPlayerHeight(p)+16*FRACUNIT, MT_PLAYERARROW);
P_SetTarget(&overheadarrow->target, mobj);
overheadarrow->flags2 |= MF2_DONTDRAW;
P_SetScale(overheadarrow, mobj->destscale);
@ -9772,6 +9808,13 @@ void P_SpawnPlayer(INT32 playernum)
mo->flags2 &= ~MF2_DONTDRAW;
}
}
else if (p->kartstuff[k_balloon] <= 0)
{
mobj_t *karmahitbox = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_KARMAHITBOX); // Player hitbox is too small!!
P_SetTarget(&karmahitbox->target, mobj);
karmahitbox->destscale = mobj->scale;
P_SetScale(karmahitbox, mobj->scale);
}
}
}