mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'shrinkscaler' into 'master'
Scale Shrink time to laser particle size See merge request KartKrew/Kart!2057
This commit is contained in:
commit
724b3a1a02
1 changed files with 15 additions and 2 deletions
|
|
@ -341,6 +341,7 @@ static void ShrinkLaserThinker(mobj_t *pohbee, mobj_t *gun, mobj_t *laser)
|
||||||
particle->color = laser->color;
|
particle->color = laser->color;
|
||||||
|
|
||||||
P_SetScale(particle, particle->scale * 2);
|
P_SetScale(particle, particle->scale * 2);
|
||||||
|
particle->cusval = particle->scale; // Store for later.
|
||||||
particle->destscale = 0;
|
particle->destscale = 0;
|
||||||
|
|
||||||
//particle->momz = 2 * particle->scale * P_MobjFlip(particle);
|
//particle->momz = 2 * particle->scale * P_MobjFlip(particle);
|
||||||
|
|
@ -535,6 +536,14 @@ boolean Obj_ShrinkLaserCollide(mobj_t *gun, mobj_t *victim)
|
||||||
owner = pohbee_owner(pohbee);
|
owner = pohbee_owner(pohbee);
|
||||||
prevTimer = victim->player->growshrinktimer;
|
prevTimer = victim->player->growshrinktimer;
|
||||||
|
|
||||||
|
fixed_t scale = FRACUNIT; // Used if you hit the gun/laser.
|
||||||
|
|
||||||
|
if (gun->type == MT_SHRINK_PARTICLE && gun->cusval != 0) // Hit the laser trail, scale the punishment down.
|
||||||
|
{
|
||||||
|
fixed_t normalizer = FixedDiv(FRACUNIT, gun->cusval); // cusval = original scale of the particle, as it eases down to 0
|
||||||
|
scale = FixedMul(gun->scale, normalizer);
|
||||||
|
}
|
||||||
|
|
||||||
if (owner != NULL && victim == owner)
|
if (owner != NULL && victim == owner)
|
||||||
{
|
{
|
||||||
// Belongs to us. Give us Grow!
|
// Belongs to us. Give us Grow!
|
||||||
|
|
@ -576,17 +585,21 @@ boolean Obj_ShrinkLaserCollide(mobj_t *gun, mobj_t *victim)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Bullshit contact. Let 'em off for free.
|
||||||
|
if (scale < FRACUNIT/4)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (prevTimer > 0)
|
if (prevTimer > 0)
|
||||||
{
|
{
|
||||||
// Dock some Grow time.
|
// Dock some Grow time.
|
||||||
// (Hack-adjacent: Always make sure there's a tic left so standard timer handling can remove the effect properly.)
|
// (Hack-adjacent: Always make sure there's a tic left so standard timer handling can remove the effect properly.)
|
||||||
victim->player->growshrinktimer -= min(3*TICRATE/2, victim->player->growshrinktimer - 1);
|
victim->player->growshrinktimer -= min(FixedInt(FixedMul(FRACUNIT*3*TICRATE/2, scale)), victim->player->growshrinktimer - 1);
|
||||||
S_StartSound(victim, sfx_s3k40);
|
S_StartSound(victim, sfx_s3k40);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Start shrinking!
|
// Start shrinking!
|
||||||
victim->player->growshrinktimer -= 5*TICRATE;
|
victim->player->growshrinktimer -= FixedInt(FixedMul(FRACUNIT*5*TICRATE, scale));
|
||||||
S_StartSound(victim, sfx_kc59); // I don't think you ever get to hear this while the pohbee laser is in your teeth, but best effort.
|
S_StartSound(victim, sfx_kc59); // I don't think you ever get to hear this while the pohbee laser is in your teeth, but best effort.
|
||||||
|
|
||||||
if (prevTimer >= 0)
|
if (prevTimer >= 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue