- function separators and minor cleanup in ripper*.cpp

This commit is contained in:
Christoph Oelckers 2022-09-05 21:05:57 +02:00
parent a55b7f950e
commit 735d82e8d3
3 changed files with 184 additions and 12 deletions

View file

@ -724,7 +724,7 @@ int InitCoolgCircle(DSWActor* actor)
// set to really fast
actor->vel.Z = 400 / 256.;
// angle adjuster
actor->user.Counter2 = actor->vel.X * (16. / 3);
actor->user.Counter2 = int(actor->vel.X * (16. / 3));
// random angle direction
if (RANDOM_P2(1024) < 512)
actor->user.Counter2 = -actor->user.Counter2;

View file

@ -814,6 +814,12 @@ ACTOR_ACTION_SET RipperBrownActionSet =
nullptr
};
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int SetupRipper(DSWActor* actor)
{
ANIMATOR DoActorDecide;
@ -853,6 +859,12 @@ int SetupRipper(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int GetJumpHeight(int jump_speed, int jump_grav)
{
int jump_iterations;
@ -867,6 +879,12 @@ int GetJumpHeight(int jump_speed, int jump_grav)
return height >> 9;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int PickJumpSpeed(DSWActor* actor, int pix_height)
{
actor->user.jump_speed = -600;
@ -886,6 +904,12 @@ int PickJumpSpeed(DSWActor* actor, int pix_height)
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int PickJumpMaxSpeed(DSWActor* actor, short max_speed)
{
ASSERT(max_speed < 0);
@ -910,18 +934,20 @@ int PickJumpMaxSpeed(DSWActor* actor, short max_speed)
}
//---------------------------------------------------------------------------
//
// HANGING - Jumping/Falling/Stationary
//
//---------------------------------------------------------------------------
int InitRipperHang(DSWActor* actor)
{
HitInfo hit{};
bool Found = false;
for (int dang = 0; dang < 2048; dang += 128)
for (auto dang = nullAngle; dang < DAngle360; dang += DAngle22_5)
{
auto tang = actor->spr.angle + DAngle::fromBuild(dang);
auto tang = actor->spr.angle + dang;
FAFhitscan(actor->spr.pos.plusZ(-ActorSizeZ(actor)), actor->sector(), DVector3(tang.ToVector() * 1024, 0), hit, CLIPMASK_MISSILE);
@ -963,6 +989,12 @@ int InitRipperHang(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipperHang(DSWActor* actor)
{
if ((actor->user.WaitTics -= ACTORMOVETICS) > 0)
@ -974,6 +1006,12 @@ int DoRipperHang(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipperMoveHang(DSWActor* actor)
{
// if cannot move the sprite
@ -995,6 +1033,12 @@ int DoRipperMoveHang(DSWActor* actor)
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipperHangJF(DSWActor* actor)
{
if (actor->user.Flags & (SPR_JUMPING | SPR_FALLING))
@ -1019,9 +1063,11 @@ int DoRipperHangJF(DSWActor* actor)
}
//---------------------------------------------------------------------------
//
// JUMP ATTACK
//
//---------------------------------------------------------------------------
int DoRipperBeginJumpAttack(DSWActor* actor)
{
@ -1053,6 +1099,12 @@ int DoRipperBeginJumpAttack(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipperMoveJump(DSWActor* actor)
{
if (actor->user.Flags & (SPR_JUMPING | SPR_FALLING))
@ -1075,9 +1127,11 @@ int DoRipperMoveJump(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
// STD MOVEMENT
//
//---------------------------------------------------------------------------
int DoRipperQuickJump(DSWActor* actor)
{
@ -1099,6 +1153,12 @@ int DoRipperQuickJump(DSWActor* actor)
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int NullRipper(DSWActor* actor)
{
if (actor->user.Flags & (SPR_SLIDING))
@ -1110,6 +1170,12 @@ int NullRipper(DSWActor* actor)
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipperPain(DSWActor* actor)
{
NullRipper(actor);
@ -1120,6 +1186,12 @@ int DoRipperPain(DSWActor* actor)
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipperRipHeart(DSWActor* actor)
{
DSWActor* target = actor->user.targetActor;
@ -1133,6 +1205,12 @@ int DoRipperRipHeart(DSWActor* actor)
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipperStandHeart(DSWActor* actor)
{
NullRipper(actor);
@ -1142,12 +1220,15 @@ int DoRipperStandHeart(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void RipperHatch(DSWActor* actor)
{
const int MAX_RIPPERS = 1;
short rip_ang[MAX_RIPPERS];
rip_ang[0] = RANDOM_P2(2048);
for (int i = 0; i < MAX_RIPPERS; i++)
{
@ -1155,7 +1236,7 @@ void RipperHatch(DSWActor* actor)
ClearOwner(actorNew);
actorNew->spr.pos = actor->spr.pos;
actorNew->spr.xrepeat = actorNew->spr.yrepeat = 64;
actorNew->set_int_ang(rip_ang[i]);
actorNew->spr.angle = RandomAngle();
actorNew->spr.pal = 0;
SetupRipper(actorNew);
@ -1179,6 +1260,12 @@ void RipperHatch(DSWActor* actor)
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipperMove(DSWActor* actor)
{
if (actor->user.scale_speed)
@ -1215,6 +1302,11 @@ int DoRipperMove(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
#include "saveable.h"

View file

@ -882,6 +882,12 @@ ACTOR_ACTION_SET Ripper2BrownActionSet =
nullptr
};
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int SetupRipper2(DSWActor* actor)
{
ANIMATOR DoActorDecide;
@ -921,9 +927,11 @@ int SetupRipper2(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
// HANGING - Jumping/Falling/Stationary
//
//---------------------------------------------------------------------------
int InitRipper2Hang(DSWActor* actor)
{
@ -976,6 +984,12 @@ int InitRipper2Hang(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipper2Hang(DSWActor* actor)
{
if ((actor->user.WaitTics -= ACTORMOVETICS) > 0)
@ -988,6 +1002,12 @@ int DoRipper2Hang(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipper2MoveHang(DSWActor* actor)
{
// if cannot move the sprite
@ -1018,6 +1038,11 @@ int DoRipper2MoveHang(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipper2HangJF(DSWActor* actor)
{
@ -1043,9 +1068,11 @@ int DoRipper2HangJF(DSWActor* actor)
}
//---------------------------------------------------------------------------
//
// JUMP ATTACK
//
//---------------------------------------------------------------------------
int DoRipper2BeginJumpAttack(DSWActor* actor)
{
@ -1079,6 +1106,12 @@ int DoRipper2BeginJumpAttack(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipper2MoveJump(DSWActor* actor)
{
if (actor->user.Flags & (SPR_JUMPING | SPR_FALLING))
@ -1101,9 +1134,11 @@ int DoRipper2MoveJump(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
// STD MOVEMENT
//
//---------------------------------------------------------------------------
int DoRipper2QuickJump(DSWActor* actor)
{
@ -1125,6 +1160,11 @@ int DoRipper2QuickJump(DSWActor* actor)
return false;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int NullRipper2(DSWActor* actor)
{
@ -1136,6 +1176,11 @@ int NullRipper2(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipper2Pain(DSWActor* actor)
{
@ -1146,6 +1191,11 @@ int DoRipper2Pain(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipper2RipHeart(DSWActor* actor)
{
@ -1158,6 +1208,12 @@ int DoRipper2RipHeart(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipper2StandHeart(DSWActor* actor)
{
NullRipper2(actor);
@ -1170,13 +1226,15 @@ int DoRipper2StandHeart(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void Ripper2Hatch(DSWActor* actor)
{
const int MAX_RIPPER2S = 1;
short rip_ang[MAX_RIPPER2S];
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_RIPPER2S; i++)
{
@ -1185,7 +1243,7 @@ void Ripper2Hatch(DSWActor* actor)
actorNew->spr.pos = actor->spr.pos;
actorNew->spr.xrepeat = actorNew->spr.yrepeat = 64;
actorNew->set_int_ang(rip_ang[i]);
actorNew->spr.angle = RandomAngle();
actorNew->spr.pal = 0;
actorNew->spr.shade = -10;
SetupRipper2(actorNew);
@ -1210,6 +1268,12 @@ void Ripper2Hatch(DSWActor* actor)
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int DoRipper2Move(DSWActor* actor)
{
if (actor->spr.hitag == TAG_SWARMSPOT && actor->spr.lotag == 1)
@ -1250,6 +1314,11 @@ int DoRipper2Move(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int InitRipper2Charge(DSWActor* actor)
{
@ -1262,12 +1331,23 @@ int InitRipper2Charge(DSWActor* actor)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int ChestRipper2(DSWActor* actor)
{
PlaySound(DIGI_RIPPER2CHEST, actor, v3df_follow);
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
#include "saveable.h"