mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-04 07:03:13 +00:00
Use less confusing defines for ring shooter
This commit is contained in:
parent
319cee4afa
commit
d28601fd52
1 changed files with 47 additions and 40 deletions
|
|
@ -40,14 +40,29 @@ static void ActivateRingShooter(mobj_t *mo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define scaleSpeed mo->scalespeed
|
#define rs_base_scalespeed(o) ((o)->scalespeed)
|
||||||
#define scaleState mo->threshold
|
#define rs_base_scalestate(o) ((o)->threshold)
|
||||||
#define xScale mo->extravalue1
|
#define rs_base_xscale(o) ((o)->extravalue1)
|
||||||
#define yScale mo->extravalue2
|
#define rs_base_yscale(o) ((o)->extravalue2)
|
||||||
#define xOffset part->extravalue1
|
|
||||||
#define yOffset part->extravalue2
|
#define rs_part_xoffset(o) ((o)->extravalue1)
|
||||||
#define SCALEPART part->spritexscale = xScale; part->spriteyscale = yScale;
|
#define rs_part_yoffset(o) ((o)->extravalue2)
|
||||||
#define MOVEPART P_MoveOrigin(part, refNipple->x + FixedMul(xOffset, xScale), refNipple->y + FixedMul(yOffset, xScale), part->z);
|
|
||||||
|
static void ScalePart(mobj_t *part, mobj_t *base)
|
||||||
|
{
|
||||||
|
part->spritexscale = rs_base_xscale(base);
|
||||||
|
part->spriteyscale = rs_base_yscale(base);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MovePart(mobj_t *part, mobj_t *base, mobj_t *refNipple)
|
||||||
|
{
|
||||||
|
P_MoveOrigin(
|
||||||
|
part,
|
||||||
|
refNipple->x + FixedMul(rs_part_xoffset(part), rs_base_xscale(base)),
|
||||||
|
refNipple->y + FixedMul(rs_part_yoffset(part), rs_base_xscale(base)),
|
||||||
|
part->z
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// I've tried to reduce redundancy as much as I can,
|
// I've tried to reduce redundancy as much as I can,
|
||||||
// but check K_SpawnRingShooter if you edit this
|
// but check K_SpawnRingShooter if you edit this
|
||||||
|
|
@ -59,7 +74,7 @@ static void UpdateRingShooterParts(mobj_t *mo)
|
||||||
while (!P_MobjWasRemoved(part->hprev))
|
while (!P_MobjWasRemoved(part->hprev))
|
||||||
{
|
{
|
||||||
part = part->hprev;
|
part = part->hprev;
|
||||||
SCALEPART
|
ScalePart(part, mo);
|
||||||
}
|
}
|
||||||
refNipple = part;
|
refNipple = part;
|
||||||
|
|
||||||
|
|
@ -67,71 +82,63 @@ static void UpdateRingShooterParts(mobj_t *mo)
|
||||||
while (!P_MobjWasRemoved(part->hnext))
|
while (!P_MobjWasRemoved(part->hnext))
|
||||||
{
|
{
|
||||||
part = part->hnext;
|
part = part->hnext;
|
||||||
MOVEPART
|
MovePart(part, mo, refNipple);
|
||||||
SCALEPART
|
ScalePart(part, mo);
|
||||||
}
|
}
|
||||||
|
|
||||||
part = mo->tracer;
|
part = mo->tracer;
|
||||||
part->z = mo->z + FixedMul(refNipple->height, yScale);
|
part->z = mo->z + FixedMul(refNipple->height, rs_base_yscale(mo));
|
||||||
MOVEPART
|
MovePart(part, mo, refNipple);
|
||||||
SCALEPART
|
ScalePart(part, mo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean RingShooterInit(mobj_t *mo)
|
static boolean RingShooterInit(mobj_t *mo)
|
||||||
{
|
{
|
||||||
if (scaleState == -1)
|
if (rs_base_scalestate(mo) == -1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (scaleState)
|
switch (rs_base_scalestate(mo))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
yScale += scaleSpeed;
|
rs_base_yscale(mo) += rs_base_scalespeed(mo);
|
||||||
if (yScale >= FRACUNIT)
|
if (rs_base_yscale(mo) >= FRACUNIT)
|
||||||
{
|
{
|
||||||
//xScale -= scaleSpeed;
|
//rs_base_xscale(mo) -= rs_base_scalespeed(mo);
|
||||||
scaleState++;
|
rs_base_scalestate(mo)++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
scaleSpeed -= FRACUNIT/5;
|
rs_base_scalespeed(mo) -= FRACUNIT/5;
|
||||||
yScale += scaleSpeed;
|
rs_base_yscale(mo) += rs_base_scalespeed(mo);
|
||||||
xScale -= scaleSpeed;
|
rs_base_xscale(mo) -= rs_base_scalespeed(mo);
|
||||||
if (yScale < 3*FRACUNIT/4)
|
if (rs_base_yscale(mo) < 3*FRACUNIT/4)
|
||||||
{
|
{
|
||||||
scaleState ++;
|
rs_base_scalestate(mo)++;
|
||||||
scaleSpeed = FRACUNIT >> 2;
|
rs_base_scalespeed(mo) = FRACUNIT >> 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
yScale += scaleSpeed;
|
rs_base_yscale(mo) += rs_base_scalespeed(mo);
|
||||||
xScale -= scaleSpeed;
|
rs_base_xscale(mo) -= rs_base_scalespeed(mo);
|
||||||
if (yScale >= FRACUNIT)
|
if (rs_base_yscale(mo) >= FRACUNIT)
|
||||||
{
|
{
|
||||||
scaleState = -1;
|
rs_base_scalestate(mo) = -1;
|
||||||
xScale = yScale = FRACUNIT;
|
rs_base_xscale(mo) = rs_base_yscale(mo) = FRACUNIT;
|
||||||
ActivateRingShooter(mo);
|
ActivateRingShooter(mo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateRingShooterParts(mo);
|
UpdateRingShooterParts(mo);
|
||||||
return scaleState != -1;
|
return (rs_base_scalestate(mo) != -1);
|
||||||
}
|
}
|
||||||
#undef scaleSpeed
|
|
||||||
#undef scaleState
|
|
||||||
#undef xScale
|
|
||||||
#undef yScale
|
|
||||||
#undef xOffset
|
|
||||||
#undef yOffset
|
|
||||||
#undef MOVEPART
|
|
||||||
#undef SCALEPART
|
|
||||||
|
|
||||||
static void RingShooterCountdown(mobj_t *mo)
|
static void RingShooterCountdown(mobj_t *mo)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue