mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-31 21:20:39 +00:00
- several smaller Shrap functions.
This commit is contained in:
parent
10b18d8a9b
commit
57fc6ce53a
5 changed files with 43 additions and 80 deletions
|
@ -1107,7 +1107,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, int *tsectnum, binangle *
|
||||||
|
|
||||||
FAFcansee_test =
|
FAFcansee_test =
|
||||||
(FAFcansee(sp->x, sp->y, sp->z, sp->sectnum, *tx, *ty, *tz, pp->cursectnum) ||
|
(FAFcansee(sp->x, sp->y, sp->z, sp->sectnum, *tx, *ty, *tz, pp->cursectnum) ||
|
||||||
FAFcansee(sp->x, sp->y, sp->z, sp->sectnum, *tx, *ty, *tz + SPRITEp_SIZE_Z(pp->SpriteP), pp->cursectnum));
|
FAFcansee(sp->x, sp->y, sp->z, sp->sectnum, *tx, *ty, *tz + SPRITEp_SIZE_Z(&pp->Actor()->s()), pp->cursectnum));
|
||||||
|
|
||||||
player_in_camera = ang_test && FAFcansee_test;
|
player_in_camera = ang_test && FAFcansee_test;
|
||||||
|
|
||||||
|
@ -1593,7 +1593,7 @@ drawscreen(PLAYERp pp, double smoothratio)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateWallPortalState();
|
UpdateWallPortalState();
|
||||||
render_drawrooms(pp->SpriteP, { tx, ty, tz }, tsectnum, tang, thoriz, trotscrnang, smoothratio);
|
render_drawrooms(&pp->Actor()->s(), { tx, ty, tz }, tsectnum, tang, thoriz, trotscrnang, smoothratio);
|
||||||
RestorePortalState();
|
RestorePortalState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2386,7 +2386,7 @@ void PlayerOperateEnv(PLAYERp pp)
|
||||||
{
|
{
|
||||||
bool found;
|
bool found;
|
||||||
|
|
||||||
if (Prediction || !pp->SpriteP)
|
if (Prediction || !pp->Actor())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -2527,14 +2527,14 @@ void PlayerOperateEnv(PLAYERp pp)
|
||||||
{
|
{
|
||||||
PlayerTakeSectorDamage(pp);
|
PlayerTakeSectorDamage(pp);
|
||||||
}
|
}
|
||||||
else if ((SPRITEp_BOS(pp->SpriteP) >= sectp->floorz) && !TEST(pp->Flags, PF_DIVING))
|
else if ((SPRITEp_BOS(&pp->Actor()->s()) >= sectp->floorz) && !TEST(pp->Flags, PF_DIVING))
|
||||||
{
|
{
|
||||||
PlayerTakeSectorDamage(pp);
|
PlayerTakeSectorDamage(pp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
USERp u = User[pp->PlayerSprite].Data();
|
USERp u = pp->Actor()->u();
|
||||||
u->DamageTics = 0;
|
u->DamageTics = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -421,8 +421,7 @@ int DoSpike(DSWActor* actor)
|
||||||
int DoSpikeAuto(DSWActor* actor)
|
int DoSpikeAuto(DSWActor* actor)
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp sp = u->SpriteP;
|
|
||||||
int *lptr;
|
int *lptr;
|
||||||
|
|
||||||
lptr = &u->zclip;
|
lptr = &u->zclip;
|
||||||
|
|
|
@ -576,8 +576,7 @@ int DoVator(DSWActor* actor)
|
||||||
int DoVatorAuto(DSWActor* actor)
|
int DoVatorAuto(DSWActor* actor)
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp sp = u->SpriteP;
|
|
||||||
SECTORp sectp = §or[sp->sectnum];
|
SECTORp sectp = §or[sp->sectnum];
|
||||||
int *lptr;
|
int *lptr;
|
||||||
int amt;
|
int amt;
|
||||||
|
|
|
@ -3798,23 +3798,17 @@ AutoShrap:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
void DoShrapMove(DSWActor* actor)
|
||||||
DoShrapMove(int16_t SpriteNum)
|
|
||||||
{
|
{
|
||||||
USERp u = User[SpriteNum].Data();
|
USERp u = actor->u();
|
||||||
|
|
||||||
SetCollision(u, move_missile(SpriteNum, u->xchange, u->ychange, 0, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS*2));
|
SetCollision(u, move_missile(actor->GetSpriteIndex(), u->xchange, u->ychange, 0, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS*2));
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
int DoVomit(DSWActor* actor)
|
||||||
int
|
|
||||||
DoVomit(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp sp = &sprite[SpriteNum];
|
|
||||||
|
|
||||||
u->Counter = NORM_ANGLE(u->Counter + (30*MISSILEMOVETICS));
|
u->Counter = NORM_ANGLE(u->Counter + (30*MISSILEMOVETICS));
|
||||||
sp->xrepeat = u->sx + MulScale(12, bcos(u->Counter), 14);
|
sp->xrepeat = u->sx + MulScale(12, bcos(u->Counter), 14);
|
||||||
|
@ -3823,13 +3817,13 @@ DoVomit(DSWActor* actor)
|
||||||
{
|
{
|
||||||
DoJump(actor);
|
DoJump(actor);
|
||||||
DoJump(actor);
|
DoJump(actor);
|
||||||
DoShrapMove(SpriteNum);
|
DoShrapMove(actor);
|
||||||
}
|
}
|
||||||
else if (TEST(u->Flags, SPR_FALLING))
|
else if (TEST(u->Flags, SPR_FALLING))
|
||||||
{
|
{
|
||||||
DoFall(actor);
|
DoFall(actor);
|
||||||
DoFall(actor);
|
DoFall(actor);
|
||||||
DoShrapMove(SpriteNum);
|
DoShrapMove(actor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3843,46 +3837,33 @@ DoVomit(DSWActor* actor)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TEST(u->ret, HIT_MASK) == HIT_SPRITE)
|
if (u->coll.type == kHitSprite)
|
||||||
{
|
{
|
||||||
short hit_sprite = NORM_SPRITE(u->ret);
|
if (TEST(u->coll.actor->s().extra, SPRX_PLAYER_OR_ENEMY))
|
||||||
if (TEST(sprite[hit_sprite].extra, SPRX_PLAYER_OR_ENEMY))
|
|
||||||
{
|
{
|
||||||
DoDamage(hit_sprite, SpriteNum);
|
DoDamage(u->coll.actor->GetSpriteIndex(), actor->GetSpriteIndex());
|
||||||
//KillActor(actor);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (u->ID)
|
|
||||||
// DoDamageTest(SpriteNum);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int DoVomitSplash(DSWActor* actor)
|
||||||
DoVomitSplash(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
|
||||||
|
|
||||||
if ((u->WaitTics-=MISSILEMOVETICS) < 0)
|
if ((u->WaitTics-=MISSILEMOVETICS) < 0)
|
||||||
{
|
{
|
||||||
KillActor(actor);
|
KillActor(actor);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int DoFastShrapJumpFall(DSWActor* actor)
|
||||||
DoFastShrapJumpFall(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp sp = &sprite[SpriteNum];
|
|
||||||
|
|
||||||
sp->x += u->xchange*2;
|
sp->x += u->xchange*2;
|
||||||
sp->y += u->ychange*2;
|
sp->y += u->ychange*2;
|
||||||
|
@ -3895,12 +3876,10 @@ DoFastShrapJumpFall(DSWActor* actor)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int DoTracerShrap(DSWActor* actor)
|
||||||
DoTracerShrap(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp sp = &sprite[SpriteNum];
|
|
||||||
|
|
||||||
sp->x += u->xchange;
|
sp->x += u->xchange;
|
||||||
sp->y += u->ychange;
|
sp->y += u->ychange;
|
||||||
|
@ -3913,11 +3892,9 @@ DoTracerShrap(DSWActor* actor)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int DoShrapJumpFall(DSWActor* actor)
|
||||||
DoShrapJumpFall(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
|
||||||
|
|
||||||
if (TEST(u->Flags, SPR_JUMPING))
|
if (TEST(u->Flags, SPR_JUMPING))
|
||||||
{
|
{
|
||||||
|
@ -3940,27 +3917,23 @@ DoShrapJumpFall(DSWActor* actor)
|
||||||
else
|
else
|
||||||
ShrapKillSprite(actor);
|
ShrapKillSprite(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int DoShrapDamage(DSWActor* actor)
|
||||||
DoShrapDamage(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp sp = &sprite[SpriteNum];
|
|
||||||
|
|
||||||
if (TEST(u->Flags, SPR_JUMPING))
|
if (TEST(u->Flags, SPR_JUMPING))
|
||||||
{
|
{
|
||||||
DoJump(actor);
|
DoJump(actor);
|
||||||
DoShrapMove(SpriteNum);
|
DoShrapMove(actor);
|
||||||
}
|
}
|
||||||
else if (TEST(u->Flags, SPR_FALLING))
|
else if (TEST(u->Flags, SPR_FALLING))
|
||||||
{
|
{
|
||||||
DoFall(actor);
|
DoFall(actor);
|
||||||
DoShrapMove(SpriteNum);
|
DoShrapMove(actor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3977,17 +3950,10 @@ DoShrapDamage(DSWActor* actor)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u->ret)
|
if (u->coll.type == kHitSprite)
|
||||||
{
|
{
|
||||||
switch (TEST(u->ret, HIT_MASK))
|
WeaponMoveHit(actor->GetSpriteIndex());
|
||||||
{
|
KillActor(actor);
|
||||||
case HIT_SPRITE:
|
|
||||||
{
|
|
||||||
WeaponMoveHit(SpriteNum);
|
|
||||||
KillActor(actor);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -3999,7 +3965,7 @@ int SpawnBlood(DSWActor* actor, DSWActor* weapActor, short hit_ang, int hit_x, i
|
||||||
SPRITEp sp = &actor->s();
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp np;
|
SPRITEp np;
|
||||||
USERp nu;
|
USERp nu;
|
||||||
short i,New;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
// state, id, num, zlevel, min_jspeed, max_jspeed, min_vel, max_vel,
|
// state, id, num, zlevel, min_jspeed, max_jspeed, min_vel, max_vel,
|
||||||
|
@ -4165,9 +4131,8 @@ int SpawnBlood(DSWActor* actor, DSWActor* weapActor, short hit_ang, int hit_x, i
|
||||||
|
|
||||||
for (i = 0; i < p->num; i++)
|
for (i = 0; i < p->num; i++)
|
||||||
{
|
{
|
||||||
New = SpawnSprite(STAT_SKIP4, p->id, p->state, sp->sectnum,
|
auto actorNew = SpawnActor(STAT_SKIP4, p->id, p->state, sp->sectnum,
|
||||||
hit_x, hit_y, hit_z, hit_ang, 0);
|
hit_x, hit_y, hit_z, hit_ang, 0);
|
||||||
auto actorNew = &swActors[New];
|
|
||||||
np = &actorNew->s();
|
np = &actorNew->s();
|
||||||
nu = actorNew->u();
|
nu = actorNew->u();
|
||||||
|
|
||||||
|
@ -4238,7 +4203,6 @@ int SpawnBlood(DSWActor* actor, DSWActor* weapActor, short hit_ang, int hit_x, i
|
||||||
DoBeginJump(actorNew);
|
DoBeginJump(actorNew);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5585,8 +5549,8 @@ RadiusGetDamage(short SpriteNum, short Weapon, int max_damage)
|
||||||
int
|
int
|
||||||
PlayerCheckDeath(PLAYERp pp, short Weapon)
|
PlayerCheckDeath(PLAYERp pp, short Weapon)
|
||||||
{
|
{
|
||||||
SPRITEp sp = pp->SpriteP;
|
SPRITEp sp = &pp->Actor()->s();
|
||||||
USERp u = User[pp->PlayerSprite].Data();
|
USERp u = pp->Actor()->u();
|
||||||
|
|
||||||
|
|
||||||
// Store off what player was struck by
|
// Store off what player was struck by
|
||||||
|
@ -12895,15 +12859,16 @@ int InitSpellMirv(PLAYERp pp)
|
||||||
u->ceiling_dist = Z(16);
|
u->ceiling_dist = Z(16);
|
||||||
u->Dist = 200;
|
u->Dist = 200;
|
||||||
|
|
||||||
auto oclipdist = pp->SpriteP->clipdist;
|
auto psp = &pp->Actor()->s();
|
||||||
pp->SpriteP->clipdist = 0;
|
auto oclipdist = psp->clipdist;
|
||||||
|
psp->clipdist = 0;
|
||||||
|
|
||||||
u->xchange = MOVEx(sp->xvel, sp->ang);
|
u->xchange = MOVEx(sp->xvel, sp->ang);
|
||||||
u->ychange = MOVEy(sp->xvel, sp->ang);
|
u->ychange = MOVEy(sp->xvel, sp->ang);
|
||||||
u->zchange = sp->zvel;
|
u->zchange = sp->zvel;
|
||||||
|
|
||||||
MissileSetPos(actorNew, DoMirv, 600);
|
MissileSetPos(actorNew, DoMirv, 600);
|
||||||
pp->SpriteP->clipdist = oclipdist;
|
psp->clipdist = oclipdist;
|
||||||
|
|
||||||
u->Counter = 0;
|
u->Counter = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -14811,8 +14776,8 @@ int InitNuke(PLAYERp pp)
|
||||||
|
|
||||||
// at certain angles the clipping box was big enough to block the
|
// at certain angles the clipping box was big enough to block the
|
||||||
// initial positioning of the fireball.
|
// initial positioning of the fireball.
|
||||||
auto oclipdist = pp->SpriteP->clipdist;
|
auto oclipdist = sp->clipdist;
|
||||||
pp->SpriteP->clipdist = 0;
|
sp->clipdist = 0;
|
||||||
|
|
||||||
wp->ang = NORM_ANGLE(wp->ang + 512);
|
wp->ang = NORM_ANGLE(wp->ang + 512);
|
||||||
HelpMissileLateral(actorNew, 900);
|
HelpMissileLateral(actorNew, 900);
|
||||||
|
@ -16368,7 +16333,7 @@ int InitTracerUzi(PLAYERp pp)
|
||||||
|
|
||||||
wp->zvel = xs_CRoundToInt(-MulScaleF(pp->horizon.horiz.asq16(), wp->xvel / 8., 16));
|
wp->zvel = xs_CRoundToInt(-MulScaleF(pp->horizon.horiz.asq16(), wp->xvel / 8., 16));
|
||||||
|
|
||||||
pp->SpriteP->clipdist = oclipdist;
|
psp->clipdist = oclipdist;
|
||||||
|
|
||||||
WeaponAutoAim(pp->Actor(), actorNew, 32, false);
|
WeaponAutoAim(pp->Actor(), actorNew, 32, false);
|
||||||
|
|
||||||
|
@ -17964,8 +17929,8 @@ int InitGrenade(PLAYERp pp)
|
||||||
|
|
||||||
wp->zvel = -pp->horizon.horiz.asq16() >> 9;
|
wp->zvel = -pp->horizon.horiz.asq16() >> 9;
|
||||||
|
|
||||||
auto oclipdist = pp->SpriteP->clipdist;
|
auto oclipdist = sp->clipdist;
|
||||||
pp->SpriteP->clipdist = 0;
|
sp->clipdist = 0;
|
||||||
|
|
||||||
wp->ang = NORM_ANGLE(wp->ang + 512);
|
wp->ang = NORM_ANGLE(wp->ang + 512);
|
||||||
HelpMissileLateral(actorNew, 800);
|
HelpMissileLateral(actorNew, 800);
|
||||||
|
|
Loading…
Reference in a new issue