mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- sp cleanup of ripper.cpp, ripper2.cpp, serp.cpp, skel.cpp.
This commit is contained in:
parent
639613297d
commit
926b4f8ba9
5 changed files with 23 additions and 49 deletions
|
@ -2204,6 +2204,17 @@ inline int ActorLowerZ(DSWActor* actor)
|
|||
return (GetSpriteZOfBottom(&actor->spr) - (GetSpriteSizeZ(&actor->spr) >> 2));
|
||||
}
|
||||
|
||||
// Z size of top (TOS) and bottom (BOS) part of sprite
|
||||
inline int ActorSizeToTop(DSWActor* a)
|
||||
{
|
||||
return ((ActorSizeZ(a)) + (tileTopOffset(a->spr.picnum) << 8)) >> 1;
|
||||
}
|
||||
|
||||
inline int ActorSizeToBottom(DSWActor* a)
|
||||
{
|
||||
return ((ActorSizeZ(a)) - (tileTopOffset(a->spr.picnum) << 8)) >> 1;
|
||||
}
|
||||
|
||||
inline int ActorMid(DSWActor* actor)
|
||||
{
|
||||
return GetSpriteZOfMiddle(&actor->s());
|
||||
|
|
|
@ -816,7 +816,6 @@ ACTOR_ACTION_SET RipperBrownActionSet =
|
|||
|
||||
int SetupRipper(DSWActor* actor)
|
||||
{
|
||||
SPRITEp sp = &actor->s();
|
||||
USERp u;
|
||||
ANIMATOR DoActorDecide;
|
||||
|
||||
|
@ -899,7 +898,6 @@ int PickJumpSpeed(DSWActor* actor, int pix_height)
|
|||
|
||||
int PickJumpMaxSpeed(DSWActor* actor, short max_speed)
|
||||
{
|
||||
SPRITEp sp = &actor->s();
|
||||
USERp u = actor->u();
|
||||
int zh;
|
||||
|
||||
|
@ -908,7 +906,7 @@ int PickJumpMaxSpeed(DSWActor* actor, short max_speed)
|
|||
u->jump_speed = max_speed;
|
||||
u->jump_grav = 8;
|
||||
|
||||
zh = GetSpriteZOfTop(sp);
|
||||
zh = ActorZOfTop(actor);
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
@ -932,7 +930,6 @@ int PickJumpMaxSpeed(DSWActor* actor, short max_speed)
|
|||
int InitRipperHang(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
int dist;
|
||||
|
||||
HitInfo hit{};
|
||||
|
@ -944,7 +941,7 @@ int InitRipperHang(DSWActor* actor)
|
|||
{
|
||||
tang = NORM_ANGLE(actor->spr.ang + dang);
|
||||
|
||||
FAFhitscan(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - GetSpriteSizeZ(sp), actor->spr.sector(), // Start position
|
||||
FAFhitscan(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - ActorSizeZ(actor), actor->spr.sector(), // Start position
|
||||
bcos(tang), // X vector of 3D ang
|
||||
bsin(tang), // Y vector of 3D ang
|
||||
0, // Z vector of 3D ang
|
||||
|
@ -1005,7 +1002,6 @@ int DoRipperHang(DSWActor* actor)
|
|||
int DoRipperMoveHang(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
int nx, ny;
|
||||
|
||||
// Move while jumping
|
||||
|
@ -1064,7 +1060,6 @@ int DoRipperHangJF(DSWActor* actor)
|
|||
int DoRipperBeginJumpAttack(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
SPRITEp psp = &u->targetActor->s();
|
||||
short tang;
|
||||
|
||||
|
@ -1177,7 +1172,6 @@ int DoRipperPain(DSWActor* actor)
|
|||
int DoRipperRipHeart(DSWActor* actor)
|
||||
// CTW MODIFICATION END
|
||||
{
|
||||
SPRITEp sp = &actor->s();
|
||||
USERp u = actor->u();
|
||||
|
||||
SPRITEp tsp = &u->targetActor->s();
|
||||
|
@ -1204,25 +1198,22 @@ int DoRipperStandHeart(DSWActor* actor)
|
|||
|
||||
void RipperHatch(DSWActor* actor)
|
||||
{
|
||||
SPRITEp wp = &actor->s();
|
||||
|
||||
SPRITEp np;
|
||||
USERp nu;
|
||||
const int MAX_RIPPERS = 1;
|
||||
short rip_ang[MAX_RIPPERS];
|
||||
|
||||
rip_ang[0] = RANDOM_P2(2048);
|
||||
// rip_ang[1] = NORM_ANGLE(rip_ang[0] + 1024 + (RANDOM_P2(512) - 256));
|
||||
|
||||
for (int i = 0; i < MAX_RIPPERS; i++)
|
||||
{
|
||||
auto actorNew = insertActor(wp->sector(), STAT_DEFAULT);
|
||||
auto actorNew = insertActor(actor->spr.sector(), STAT_DEFAULT);
|
||||
np = &actorNew->s();
|
||||
np->clear();
|
||||
ClearOwner(actorNew);
|
||||
np->pos.X = wp->pos.X;
|
||||
np->pos.Y = wp->pos.Y;
|
||||
np->pos.Z = wp->pos.Z;
|
||||
np->pos.X = actor->spr.pos.X;
|
||||
np->pos.Y = actor->spr.pos.Y;
|
||||
np->pos.Z = actor->spr.pos.Z;
|
||||
np->xrepeat = np->yrepeat = 64;
|
||||
np->ang = rip_ang[i];
|
||||
np->pal = 0;
|
||||
|
|
|
@ -884,7 +884,6 @@ ACTOR_ACTION_SET Ripper2BrownActionSet =
|
|||
|
||||
int SetupRipper2(DSWActor* actor)
|
||||
{
|
||||
SPRITEp sp = &actor->s();
|
||||
USERp u;
|
||||
ANIMATOR DoActorDecide;
|
||||
|
||||
|
@ -935,7 +934,6 @@ int SetupRipper2(DSWActor* actor)
|
|||
int InitRipper2Hang(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
int dist;
|
||||
|
||||
HitInfo hit{};
|
||||
|
@ -947,7 +945,7 @@ int InitRipper2Hang(DSWActor* actor)
|
|||
{
|
||||
tang = NORM_ANGLE(actor->spr.ang + dang);
|
||||
|
||||
FAFhitscan(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - GetSpriteSizeZ(sp), actor->spr.sector(), // Start position
|
||||
FAFhitscan(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - ActorSizeZ(actor), actor->spr.sector(), // Start position
|
||||
bcos(tang), // X vector of 3D ang
|
||||
bsin(tang), // Y vector of 3D ang
|
||||
0, // Z vector of 3D ang
|
||||
|
@ -1009,7 +1007,6 @@ int DoRipper2Hang(DSWActor* actor)
|
|||
int DoRipper2MoveHang(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
int nx, ny;
|
||||
|
||||
// Move while jumping
|
||||
|
@ -1078,7 +1075,6 @@ int DoRipper2HangJF(DSWActor* actor)
|
|||
int DoRipper2BeginJumpAttack(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
SPRITEp psp = &u->targetActor->s();
|
||||
short tang;
|
||||
|
||||
|
@ -1191,7 +1187,6 @@ int DoRipper2Pain(DSWActor* actor)
|
|||
|
||||
int DoRipper2RipHeart(DSWActor* actor)
|
||||
{
|
||||
SPRITEp sp = &actor->s();
|
||||
USERp u = actor->u();
|
||||
|
||||
SPRITEp tsp = &u->targetActor->s();
|
||||
|
@ -1207,7 +1202,6 @@ int DoRipper2RipHeart(DSWActor* actor)
|
|||
int DoRipper2StandHeart(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
NullRipper2(actor);
|
||||
|
||||
|
@ -1221,8 +1215,6 @@ int DoRipper2StandHeart(DSWActor* actor)
|
|||
|
||||
void Ripper2Hatch(DSWActor* actor)
|
||||
{
|
||||
SPRITEp wp = &actor->s();
|
||||
|
||||
SPRITEp np;
|
||||
USERp nu;
|
||||
|
||||
|
@ -1234,13 +1226,13 @@ void Ripper2Hatch(DSWActor* actor)
|
|||
|
||||
for (int i = 0; i < MAX_RIPPER2S; i++)
|
||||
{
|
||||
auto actorNew = insertActor(wp->sector(), STAT_DEFAULT);
|
||||
auto actorNew = insertActor(actor->spr.sector(), STAT_DEFAULT);
|
||||
np = &actorNew->s();
|
||||
np->clear();
|
||||
ClearOwner(actorNew);
|
||||
np->pos.X = wp->pos.X;
|
||||
np->pos.Y = wp->pos.Y;
|
||||
np->pos.Z = wp->pos.Z;
|
||||
np->pos.X = actor->spr.pos.X;
|
||||
np->pos.Y = actor->spr.pos.Y;
|
||||
np->pos.Z = actor->spr.pos.Z;
|
||||
//np->xrepeat = np->yrepeat = 36;
|
||||
np->xrepeat = np->yrepeat = 64;
|
||||
np->ang = rip_ang[i];
|
||||
|
@ -1272,7 +1264,6 @@ void Ripper2Hatch(DSWActor* actor)
|
|||
int DoRipper2Move(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
if (actor->spr.hitag == TAG_SWARMSPOT && actor->spr.lotag == 1)
|
||||
DoCheckSwarm(actor);
|
||||
|
@ -1326,10 +1317,7 @@ int InitRipper2Charge(DSWActor* actor)
|
|||
|
||||
int ChestRipper2(DSWActor* actor)
|
||||
{
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
PlaySound(DIGI_RIPPER2CHEST, actor, v3df_follow);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -695,7 +695,6 @@ ACTOR_ACTION_SET SerpActionSet =
|
|||
|
||||
int SetupSerp(DSWActor* actor)
|
||||
{
|
||||
SPRITEp sp = &actor->s();
|
||||
USERp u;
|
||||
ANIMATOR DoActorDecide;
|
||||
|
||||
|
@ -745,7 +744,7 @@ int SetupSerp(DSWActor* actor)
|
|||
u->lo_step = Z(40);
|
||||
|
||||
u->floor_dist = u->zclip - u->lo_step;
|
||||
u->ceiling_dist = GetSpriteSizeZ(sp) - u->zclip;
|
||||
u->ceiling_dist = ActorSizeZ(actor) - u->zclip;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -766,7 +765,6 @@ int NullSerp(DSWActor* actor)
|
|||
int DoSerpMove(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
if (TEST(u->Flags,SPR_SLIDING))
|
||||
DoActorSlide(actor);
|
||||
|
@ -807,9 +805,6 @@ int DoSerpMove(DSWActor* actor)
|
|||
|
||||
int DoDeathSpecial(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
DoMatchEverything(nullptr, actor->spr.lotag, ON);
|
||||
|
||||
if (!SW_SHAREWARE)
|
||||
|
|
|
@ -502,7 +502,6 @@ ACTOR_ACTION_SET SkelActionSet =
|
|||
|
||||
int SetupSkel(DSWActor* actor)
|
||||
{
|
||||
SPRITEp sp = &actor->s();
|
||||
USERp u;
|
||||
ANIMATOR DoActorDecide;
|
||||
|
||||
|
@ -534,20 +533,14 @@ int SetupSkel(DSWActor* actor)
|
|||
|
||||
int DoSkelInitTeleport(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
RESET(actor->spr.cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
|
||||
PlaySpriteSound(actor,attr_extra3,v3df_follow);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DoSkelTeleport(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
int x,y;
|
||||
|
||||
x = actor->spr.pos.X;
|
||||
|
@ -579,11 +572,7 @@ int DoSkelTeleport(DSWActor* actor)
|
|||
|
||||
int DoSkelTermTeleport(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
SET(actor->spr.cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue