- re-tabified several files that got mangled by repeated merging

This commit is contained in:
Christoph Oelckers 2021-12-29 19:41:41 +01:00
parent 3fcecedf32
commit e670cf2786
28 changed files with 551 additions and 551 deletions

View file

@ -64,14 +64,14 @@ extern TArray<walltype> wall;
// Names taken from DukeGDX
enum EHitBits
{
kHitNone = 0,
kHitTypeMask = 0xC000,
kHitTypeMaskSW = 0x1C000, // SW has one more relevant bit
kHitIndexMask = 0x3FFF,
kHitSector = 0x4000,
kHitWall = 0x8000,
kHitSprite = 0xC000,
kHitVoid = 0x10000, // SW only
kHitNone = 0,
kHitTypeMask = 0xC000,
kHitTypeMaskSW = 0x1C000, // SW has one more relevant bit
kHitIndexMask = 0x3FFF,
kHitSector = 0x4000,
kHitWall = 0x8000,
kHitSprite = 0xC000,
kHitVoid = 0x10000, // SW only
};
@ -83,7 +83,7 @@ struct HitInfoBase
vec3_t hitpos;
sectortype* hitSector;
walltype* hitWall;
DCoreActor* hitActor;
DCoreActor* hitActor;
void clearObj()
{

View file

@ -750,10 +750,10 @@ static TArray<GrpEntry> SetupGame()
groupno = pick;
}
}
else if (groups.Size() == 1)
{
groupno = 0;
}
else if (groups.Size() == 1)
{
groupno = 0;
}
}
if (groupno == -1) return TArray<GrpEntry>();

View file

@ -183,42 +183,42 @@ inline double RenderY(int y)
inline double WallStartX(int wallnum)
{
return wall[wallnum].pos.X * (1 / 16.);
return wall[wallnum].pos.X * (1 / 16.);
}
inline double WallStartY(int wallnum)
{
return wall[wallnum].pos.Y * (1 / -16.);
return wall[wallnum].pos.Y * (1 / -16.);
}
inline double WallEndX(int wallnum)
{
return wall[wallnum].point2Wall()->pos.X * (1 / 16.);
return wall[wallnum].point2Wall()->pos.X * (1 / 16.);
}
inline double WallEndY(int wallnum)
{
return wall[wallnum].point2Wall()->pos.Y * (1 / -16.);
return wall[wallnum].point2Wall()->pos.Y * (1 / -16.);
}
inline double WallStartX(const walltype* wallnum)
{
return wallnum->pos.X * (1 / 16.);
return wallnum->pos.X * (1 / 16.);
}
inline double WallStartY(const walltype* wallnum)
{
return wallnum->pos.Y * (1 / -16.);
return wallnum->pos.Y * (1 / -16.);
}
inline DVector2 WallStart(const walltype* wallnum)
{
return { WallStartX(wallnum), WallStartY(wallnum) };
return { WallStartX(wallnum), WallStartY(wallnum) };
}
inline double WallEndX(const walltype* wallnum)
{
return wallnum->point2Wall()->pos.X * (1 / 16.);
return wallnum->point2Wall()->pos.X * (1 / 16.);
}
inline double WallEndY(const walltype* wallnum)
@ -228,28 +228,28 @@ inline double WallEndY(const walltype* wallnum)
inline DVector2 WallEnd(const walltype* wallnum)
{
return { WallEndX(wallnum), WallEndY(wallnum) };
return { WallEndX(wallnum), WallEndY(wallnum) };
}
inline DVector2 WallDelta(const walltype* wallnum)
{
return WallEnd(wallnum) - WallStart(wallnum);
return WallEnd(wallnum) - WallStart(wallnum);
}
inline double PointOnLineSide(double x, double y, double linex, double liney, double deltax, double deltay)
{
return (x - linex) * deltay - (y - liney) * deltax;
return (x - linex) * deltay - (y - liney) * deltax;
}
inline double PointOnLineSide(const DVector2 &pos, const walltype *line)
{
return (pos.X - WallStartX(line)) * WallDelta(line).Y - (pos.Y - WallStartY(line)) * WallDelta(line).X;
return (pos.X - WallStartX(line)) * WallDelta(line).Y - (pos.Y - WallStartY(line)) * WallDelta(line).X;
}
template<class T>
inline double PointOnLineSide(const TVector2<T>& pos, const TVector2<T>& linestart, const TVector2<T>& lineend)
{
return (pos.X - linestart.X) * (lineend.Y - linestart.Y) - (pos.Y - linestart.Y) * (lineend.X - linestart.X);
return (pos.X - linestart.X) * (lineend.Y - linestart.Y) - (pos.Y - linestart.Y) * (lineend.X - linestart.X);
}
extern int numshades;
@ -257,14 +257,14 @@ extern int numshades;
// Return type is int because this gets passed to variadic functions where structs may produce undefined behavior.
inline int shadeToLight(int shade)
{
shade = clamp(shade, 0, numshades - 1);
int light = Scale(numshades - 1 - shade, 255, numshades - 1);
return PalEntry(255, light, light, light);
shade = clamp(shade, 0, numshades - 1);
int light = Scale(numshades - 1 - shade, 255, numshades - 1);
return PalEntry(255, light, light, light);
}
inline void copyfloorpal(spritetype* spr, const sectortype* sect)
{
if (!lookups.noFloorPal(sect->floorpal)) spr->pal = sect->floorpal;
if (!lookups.noFloorPal(sect->floorpal)) spr->pal = sect->floorpal;
}
inline void copyfloorpal(tspritetype* spr, const sectortype* sect)
@ -274,17 +274,17 @@ inline void copyfloorpal(tspritetype* spr, const sectortype* sect)
inline void spriteSetSlope(spritetype* spr, int heinum)
{
if (spr->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)
{
spr->xoffset = heinum & 255;
spr->yoffset = (heinum >> 8) & 255;
spr->cstat = (spr->cstat & ~CSTAT_SPRITE_ALIGNMENT_MASK) | (heinum != 0 ? CSTAT_SPRITE_ALIGNMENT_SLOPE : CSTAT_SPRITE_ALIGNMENT_FLOOR);
}
if (spr->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)
{
spr->xoffset = heinum & 255;
spr->yoffset = (heinum >> 8) & 255;
spr->cstat = (spr->cstat & ~CSTAT_SPRITE_ALIGNMENT_MASK) | (heinum != 0 ? CSTAT_SPRITE_ALIGNMENT_SLOPE : CSTAT_SPRITE_ALIGNMENT_FLOOR);
}
}
inline int spriteGetSlope(const spritetype* spr)
{
return ((spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_SLOPE) ? 0 : uint8_t(spr->xoffset) + (uint8_t(spr->yoffset) << 8);
return ((spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_SLOPE) ? 0 : uint8_t(spr->xoffset) + (uint8_t(spr->yoffset) << 8);
}
// same stuff, different flag...
@ -305,24 +305,24 @@ inline int32_t tspriteGetZOfSlope(const tspritetype* tspr, int dax, int day)
inline int I_GetBuildTime()
{
return I_GetTime(120);
return I_GetTime(120);
}
inline int32_t getangle(walltype* wal)
{
return getangle(
wal->point2Wall()->pos.X - wal->pos.X,
wal->point2Wall()->pos.Y - wal->pos.Y);
return getangle(
wal->point2Wall()->pos.X - wal->pos.X,
wal->point2Wall()->pos.Y - wal->pos.Y);
}
inline TArrayView<walltype> wallsofsector(const sectortype* sec)
{
return TArrayView<walltype>(sec->firstWall(), sec->wallnum);
return TArrayView<walltype>(sec->firstWall(), sec->wallnum);
}
inline TArrayView<walltype> wallsofsector(int sec)
{
return wallsofsector(&sector[sec]);
return wallsofsector(&sector[sec]);
}
// these are mainly meant as refactoring aids to mark function calls to work on.

View file

@ -4,44 +4,44 @@ class FSerializer;
struct vec2_16_t
{
int16_t X, Y;
int16_t X, Y;
};
struct vec2_t
{
int32_t X, Y;
int32_t X, Y;
vec2_t() = default;
vec2_t(const vec2_t&) = default;
vec2_t(int x, int y) : X(x), Y(y) {}
vec2_t operator+(const vec2_t& other) const { return { X + other.X, Y + other.Y }; }
vec2_t operator-(const vec2_t& other) const { return { X - other.X, Y - other.Y }; }
vec2_t& operator+=(const vec2_t& other) { X += other.X; Y += other.Y; return *this; };
vec2_t& operator-=(const vec2_t& other) { X -= other.X; Y -= other.Y; return *this; };
vec2_t() = default;
vec2_t(const vec2_t&) = default;
vec2_t(int x, int y) : X(x), Y(y) {}
vec2_t operator+(const vec2_t& other) const { return { X + other.X, Y + other.Y }; }
vec2_t operator-(const vec2_t& other) const { return { X - other.X, Y - other.Y }; }
vec2_t& operator+=(const vec2_t& other) { X += other.X; Y += other.Y; return *this; };
vec2_t& operator-=(const vec2_t& other) { X -= other.X; Y -= other.Y; return *this; };
vec2_t& operator/= (int other) { X /= other; Y /= other; return *this; }
bool operator == (const vec2_t& other) const { return X == other.X && Y == other.Y; };
bool operator == (const vec2_t& other) const { return X == other.X && Y == other.Y; };
};
inline vec2_t operator/ (const vec2_t& vec, int other) { return { vec.X / other, vec.Y / other }; }
struct vec3_t
{
union
{
struct
{
int32_t X, Y, Z;
};
vec2_t vec2;
};
union
{
struct
{
int32_t X, Y, Z;
};
vec2_t vec2;
};
vec3_t() = default;
vec3_t(const vec3_t&) = default;
vec3_t(int x, int y, int z) : X(x), Y(y), Z(z) {}
vec3_t operator+(const vec3_t& other) const { return { X + other.X, Y + other.Y, Z + other.Z }; }
vec3_t operator-(const vec3_t& other) const { return { X - other.X, Y - other.Y, Z - other.Z }; }
vec3_t& operator+=(const vec3_t& other) { X += other.X; Y += other.Y; Z += other.Z; return *this; };
vec3_t& operator-=(const vec3_t& other) { X -= other.X; Y -= other.Y; Z += other.Z; return *this; };
vec3_t withZOffset(int ofs) { return { X, Y, Z + ofs }; }
vec3_t() = default;
vec3_t(const vec3_t&) = default;
vec3_t(int x, int y, int z) : X(x), Y(y), Z(z) {}
vec3_t operator+(const vec3_t& other) const { return { X + other.X, Y + other.Y, Z + other.Z }; }
vec3_t operator-(const vec3_t& other) const { return { X - other.X, Y - other.Y, Z - other.Z }; }
vec3_t& operator+=(const vec3_t& other) { X += other.X; Y += other.Y; Z += other.Z; return *this; };
vec3_t& operator-=(const vec3_t& other) { X -= other.X; Y -= other.Y; Z += other.Z; return *this; };
vec3_t withZOffset(int ofs) { return { X, Y, Z + ofs }; }
};

View file

@ -8,59 +8,59 @@ class Clipper;
struct FBunch
{
int sectornum;
int startline;
int endline;
bool portal;
binangle startangle;
binangle endangle;
int sectornum;
int startline;
int endline;
bool portal;
binangle startangle;
binangle endangle;
};
class BunchDrawer
{
HWDrawInfo *di;
Clipper *clipper;
int LastBunch;
int StartTime;
TArray<FBunch> Bunches;
TArray<int> CompareData;
double viewx, viewy;
vec2_t iview;
float gcosang, gsinang;
BitArray gotsector;
BitArray gotsection2;
BitArray gotwall;
BitArray blockwall;
binangle ang1, ang2, angrange;
float viewz;
Clipper *clipper;
int LastBunch;
int StartTime;
TArray<FBunch> Bunches;
TArray<int> CompareData;
double viewx, viewy;
vec2_t iview;
float gcosang, gsinang;
BitArray gotsector;
BitArray gotsection2;
BitArray gotwall;
BitArray blockwall;
binangle ang1, ang2, angrange;
float viewz;
TArray<int> sectionstartang, sectionendang;
TArray<int> sectionstartang, sectionendang;
private:
enum
{
CL_Skip = 0,
CL_Draw = 1,
CL_Pass = 2,
};
enum
{
CL_Skip = 0,
CL_Draw = 1,
CL_Pass = 2,
};
binangle ClipAngle(int wal) { return wall[wal].clipangle - ang1; }
void StartScene();
bool StartBunch(int sectnum, int linenum, binangle startan, binangle endan, bool portal);
bool AddLineToBunch(int line, binangle newan);
void DeleteBunch(int index);
bool CheckClip(walltype* wal, float* topclip, float* bottomclip);
int ClipLine(int line, bool portal);
void ProcessBunch(int bnch);
int WallInFront(int wall1, int wall2);
int ColinearBunchInFront(FBunch* b1, FBunch* b2);
int BunchInFront(FBunch* b1, FBunch* b2);
int FindClosestBunch();
void ProcessSection(int sectnum, bool portal);
binangle ClipAngle(int wal) { return wall[wal].clipangle - ang1; }
void StartScene();
bool StartBunch(int sectnum, int linenum, binangle startan, binangle endan, bool portal);
bool AddLineToBunch(int line, binangle newan);
void DeleteBunch(int index);
bool CheckClip(walltype* wal, float* topclip, float* bottomclip);
int ClipLine(int line, bool portal);
void ProcessBunch(int bnch);
int WallInFront(int wall1, int wall2);
int ColinearBunchInFront(FBunch* b1, FBunch* b2);
int BunchInFront(FBunch* b1, FBunch* b2);
int FindClosestBunch();
void ProcessSection(int sectnum, bool portal);
public:
void Init(HWDrawInfo* _di, Clipper* c, vec2_t& view, binangle a1, binangle a2);
void RenderScene(const int* viewsectors, unsigned sectcount, bool portal);
const BitArray& GotSector() const { return gotsector; }
void Init(HWDrawInfo* _di, Clipper* c, vec2_t& view, binangle a1, binangle a2);
void RenderScene(const int* viewsectors, unsigned sectcount, bool portal);
const BitArray& GotSector() const { return gotsector; }
};

View file

@ -53,12 +53,12 @@ struct FRenderViewpoint
enum SectorRenderFlags
{
// This is used to merge several subsectors into a single draw item
SSRF_RENDERFLOOR = 1,
SSRF_RENDERCEILING = 2,
SSRF_RENDERALL = 7,
SSRF_PROCESSED = 8,
SSRF_SEEN = 16,
// This is used to merge several subsectors into a single draw item
SSRF_RENDERFLOOR = 1,
SSRF_RENDERCEILING = 2,
SSRF_RENDERALL = 7,
SSRF_PROCESSED = 8,
SSRF_SEEN = 16,
};
enum EPortalClip
@ -117,7 +117,7 @@ struct HWDrawInfo
FVector2 geoofs;
private:
bool inview;
bool inview;
sectortype *currentsector;
void WorkerThread();
@ -177,10 +177,10 @@ public:
void DrawPlayerSprites(bool hudModelStep, FRenderState &state);
//void AddSubsectorToPortal(FSectorPortalGroup *portal, sectortype *sub);
void AddWall(HWWall *w);
void AddMirrorSurface(HWWall *w);
//void AddSubsectorToPortal(FSectorPortalGroup *portal, sectortype *sub);
void AddWall(HWWall *w);
void AddMirrorSurface(HWWall *w);
void AddFlat(HWFlat *flat);
void AddSprite(HWSprite *sprite, bool translucent);

View file

@ -708,7 +708,7 @@ SortNode * HWDrawList::DoSort(HWDrawInfo *di, SortNode * head)
void HWDrawList::Sort(HWDrawInfo *di)
{
reverseSort = false;
SortZ = di->Viewpoint.Pos.Z;
SortZ = di->Viewpoint.Pos.Z;
MakeSortList();
sorted = DoSort(di, SortNodes[SortNodeStart]);
}

View file

@ -66,7 +66,7 @@ struct HWDrawList
TArray<HWSprite*> sprites;
TArray<HWDrawItem> drawitems;
int SortNodeStart;
float SortZ;
float SortZ;
SortNode * sorted;
bool reverseSort;

View file

@ -290,7 +290,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int section
dynlightindex = -1;
const auto &vp = di->Viewpoint;
const auto &vp = di->Viewpoint;
float florz, ceilz;
PlanesAtPoint(frontsector, float(vp.Pos.X) * 16.f, float(vp.Pos.Y) * -16.f, &ceilz, &florz);

View file

@ -145,14 +145,14 @@ public:
BoundingRect boundingBox;
int planesused = 0;
HWPortal(FPortalSceneState *s, bool local = false) : mState(s), boundingBox(false)
{
}
virtual ~HWPortal() {}
virtual int ClipSeg(walltype *seg, const DVector3 &viewpos) { return PClip_Inside; }
virtual int ClipSector(sectortype *sub) { return PClip_Inside; }
virtual int ClipPoint(const DVector2 &pos) { return PClip_Inside; }
virtual walltype *ClipLine() { return nullptr; }
HWPortal(FPortalSceneState *s, bool local = false) : mState(s), boundingBox(false)
{
}
virtual ~HWPortal() {}
virtual int ClipSeg(walltype *seg, const DVector3 &viewpos) { return PClip_Inside; }
virtual int ClipSector(sectortype *sub) { return PClip_Inside; }
virtual int ClipPoint(const DVector2 &pos) { return PClip_Inside; }
virtual walltype *ClipLine() { return nullptr; }
virtual void * GetSource() const = 0; // GetSource MUST be implemented!
virtual const char *GetName() = 0;
virtual bool AllowSSAO() { return true; }
@ -212,14 +212,14 @@ struct FPortalSceneState
extern FPortalSceneState portalState;
class HWScenePortalBase : public HWPortal
{
protected:
HWScenePortalBase(FPortalSceneState *state) : HWPortal(state, false)
{
}
HWScenePortalBase(FPortalSceneState *state) : HWPortal(state, false)
{
}
public:
void ClearClipper(HWDrawInfo *di, Clipper *clipper);
virtual bool NeedDepthBuffer() { return true; }

View file

@ -4112,7 +4112,7 @@ static void actKickObject(DBloodActor* kicker, DBloodActor* kicked)
static void actTouchFloor(DBloodActor* actor, sectortype* pSector)
{
XSECTOR* pXSector = pSector->hasX()? &pSector->xs() : nullptr;
XSECTOR* pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
bool doDamage = (pXSector && (pSector->type == kSectorDamage || pXSector->damageType > 0));
// don't allow damage for damage sectors if they are not enabled
@ -4456,7 +4456,7 @@ static void ProcessTouchObjects(DBloodActor* actor)
if (gModernMap && actor->IsDudeActor())
{
DBloodActor* actor2 = nullptr;
for (auto* coll : { &actor->hit.hit, &actor->hit.florhit, &actor->hit.ceilhit})
for (auto* coll : { &actor->hit.hit, &actor->hit.florhit, &actor->hit.ceilhit })
{
if (coll->type == kHitSprite)
{
@ -4555,7 +4555,7 @@ static Collision MoveThing(DBloodActor* actor)
ChangeActorSect(actor, pSector);
}
auto &coll = actor->hit.hit;
auto& coll = actor->hit.hit;
if (coll.type == kHitWall)
{
actWallBounceVector(&actor->xvel, &actor->yvel, coll.hitWall, pThingInfo->elastic);
@ -4824,7 +4824,7 @@ void MoveDude(DBloodActor* actor)
if (pHitWall->twoSided())
{
sectortype* pHitSector = pHitWall->nextSector();
XSECTOR* pHitXSector = pHitSector->hasX()? &pHitSector->xs() : nullptr;
XSECTOR* pHitXSector = pHitSector->hasX() ? &pHitSector->xs() : nullptr;
if (pDudeInfo->lockOut && pHitXSector && pHitXSector->Wallpush && !pHitXSector->Key && !pHitXSector->dudeLockout && !pHitXSector->state && !pHitXSector->busy && !pPlayer)
trTriggerSector(pHitSector, kCmdSectorPush);
@ -4851,7 +4851,7 @@ void MoveDude(DBloodActor* actor)
{
assert(actor->spr.sector());
auto pOldSector = actor->spr.sector();
XSECTOR* pXOldSector = pOldSector->hasX()? &pOldSector->xs() : nullptr;
XSECTOR* pXOldSector = pOldSector->hasX() ? &pOldSector->xs() : nullptr;
if (pXOldSector && pXOldSector->Exit && (pPlayer || !pXOldSector->dudeLockout))
trTriggerSector(pOldSector, kCmdSectorExit);
@ -5074,7 +5074,7 @@ void MoveDude(DBloodActor* actor)
if (actor->spr.type == kDudeModernCustom) {
evPostActor(actor, 0, kCallbackEnemeyBubble);
if (!canSwim(actor)) actKillDude(actor, actor, kDamageFall, 1000 << 4);
if (!canSwim(actor)) actKillDude(actor, actor, kDamageFall, 1000 << 4);
break;
}
@ -5657,7 +5657,7 @@ static void actCheckThings()
auto pSector = actor->spr.sector();
XSECTOR* pXSector = pSector->hasX()? &pSector->xs() : nullptr;
XSECTOR* pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
if (pXSector && pXSector->panVel && (pXSector->panAlways || pXSector->state || pXSector->busy))
{
int nType = actor->spr.type - kThingBase;
@ -6091,7 +6091,7 @@ static void actCheckDudes()
auto pSector = actor->spr.sector();
viewBackupSpriteLoc(actor);
XSECTOR* pXSector = pSector->hasX()? &pSector->xs() : nullptr;
XSECTOR* pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
if (pXSector)
{
@ -6261,7 +6261,7 @@ DBloodActor* actSpawnDude(DBloodActor* source, int nType, int a3, int a4)
spawned->spr.type = nType;
spawned->spr.ang = angle;
vec3_t pos = { x, y, z };
SetActor(spawned, &pos);
SetActor(spawned, &pos);
spawned->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL | CSTAT_SPRITE_BLOOD_BIT1;
spawned->spr.clipdist = getDudeInfo(nDude + kDudeBase)->clipdist;
spawned->xspr.health = getDudeInfo(nDude + kDudeBase)->startHealth << 4;
@ -6439,10 +6439,10 @@ void actBuildMissile(DBloodActor* spawned, DBloodActor* actor)
switch (spawned->spr.type)
{
case kMissileLifeLeechRegular:
evPostActor(spawned, 0, kCallbackFXFlameLick);
evPostActor(spawned, 0, kCallbackFXFlameLick);
break;
case kMissileTeslaAlt:
evPostActor(spawned, 0, kCallbackFXTeslaAlt);
evPostActor(spawned, 0, kCallbackFXTeslaAlt);
break;
case kMissilePukeGreen:
seqSpawn(29, spawned, -1);
@ -6693,7 +6693,7 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
assert(vectorType >= 0 && vectorType < kVectorMax);
const VECTORDATA* pVectorData = &gVectorData[vectorType];
int nRange = pVectorData->maxDist;
int hit = VectorScan(shooter, a2, a3, a4, a5, a6, nRange, 1);
int hit = VectorScan(shooter, a2, a3, a4, a5, a6, nRange, 1);
if (hit == 3)
{
auto hitactor = gHitInfo.actor();
@ -6808,7 +6808,7 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
{
case kDudeModernCustom:
case kDudeModernCustomBurning:
t = getSpriteMassBySize(actor);
t = getSpriteMassBySize(actor);
break;
}
}
@ -6874,13 +6874,13 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
{
if (actor->xspr.physAttr & kPhysDebrisVector) {
int impulse = DivScale(pVectorData->impulse, ClipLow(actor->spriteMass.mass, 10), 6);
actor->xvel += MulScale(a4, impulse, 16);
int impulse = DivScale(pVectorData->impulse, ClipLow(actor->spriteMass.mass, 10), 6);
actor->xvel += MulScale(a4, impulse, 16);
actor->yvel += MulScale(a5, impulse, 16);
actor->zvel += MulScale(a6, impulse, 16);
if (pVectorData->burnTime != 0) {
if (!actor->xspr.burnTime) evPostActor(actor, 0, kCallbackFXFlameLick);
if (!actor->xspr.burnTime) evPostActor(actor, 0, kCallbackFXFlameLick);
actBurnSprite(shooter->GetOwner(), actor, pVectorData->burnTime);
}
@ -6909,14 +6909,14 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
if (pVectorData->surfHit[nSurf].fx2 >= 0) {
auto pFX2 = gFX.fxSpawnActor(pVectorData->surfHit[nSurf].fx2, pSector, x, y, z, 0);
auto pFX2 = gFX.fxSpawnActor(pVectorData->surfHit[nSurf].fx2, pSector, x, y, z, 0);
if (pFX2 && gModernMap)
pFX2->SetOwner(shooter);
}
if (pVectorData->surfHit[nSurf].fx3 >= 0) {
auto pFX3 = gFX.fxSpawnActor(pVectorData->surfHit[nSurf].fx3, pSector, x, y, z, 0);
auto pFX3 = gFX.fxSpawnActor(pVectorData->surfHit[nSurf].fx3, pSector, x, y, z, 0);
if (pFX3 && gModernMap)
pFX3->SetOwner(shooter);
@ -6924,9 +6924,9 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
#else
if (pVectorData->surfHit[nSurf].fx2 >= 0)
gFX.fxSpawnActor(pVectorData->surfHit[nSurf].fx2, pSector, x, y, z, 0);
gFX.fxSpawnActor(pVectorData->surfHit[nSurf].fx2, pSector, x, y, z, 0);
if (pVectorData->surfHit[nSurf].fx3 >= 0)
gFX.fxSpawnActor(pVectorData->surfHit[nSurf].fx3, pSector, x, y, z, 0);
gFX.fxSpawnActor(pVectorData->surfHit[nSurf].fx3, pSector, x, y, z, 0);
#endif
if (pVectorData->surfHit[nSurf].fxSnd >= 0)
@ -7126,9 +7126,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, SPRITEHIT& w, SPRI
{
if (arc.BeginObject(keyname))
{
arc("hit", w.hit)
("ceilhit", w.ceilhit)
("florhit", w.florhit)
arc("hit", w.hit)
("ceilhit", w.ceilhit)
("florhit", w.florhit)
.EndObject();
}
return arc;

View file

@ -25,140 +25,140 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS
enum DAMAGE_TYPE {
kDamageFall = 0,
kDamageBurn,
kDamageBullet,
kDamageExplode,
kDamageDrown,
kDamageSpirit,
kDamageTesla,
kDamageMax = 7,
kDamageFall = 0,
kDamageBurn,
kDamageBullet,
kDamageExplode,
kDamageDrown,
kDamageSpirit,
kDamageTesla,
kDamageMax = 7,
};
enum VECTOR_TYPE {
kVectorTine = 0,
kVectorShell,
kVectorBullet,
kVectorTommyAP,
kVectorShellAP,
kVectorTommyRegular,
kVectorBatBite,
kVectorBoneelBite,
kVectorGillBite,
kVectorBeastSlash,
kVectorAxe,
kVectorCleaver,
kVectorGhost,
kVectorGargSlash,
kVectorCerberusHack,
kVectorHoundBite,
kVectorRatBite,
kVectorSpiderBite,
VECTOR_TYPE_18,
VECTOR_TYPE_19,
kVectorTchernobogBurn,
kVectorVoodoo10,
#ifdef NOONE_EXTENSIONS
kVectorGenDudePunch,
#endif
kVectorMax,
kVectorTine = 0,
kVectorShell,
kVectorBullet,
kVectorTommyAP,
kVectorShellAP,
kVectorTommyRegular,
kVectorBatBite,
kVectorBoneelBite,
kVectorGillBite,
kVectorBeastSlash,
kVectorAxe,
kVectorCleaver,
kVectorGhost,
kVectorGargSlash,
kVectorCerberusHack,
kVectorHoundBite,
kVectorRatBite,
kVectorSpiderBite,
VECTOR_TYPE_18,
VECTOR_TYPE_19,
kVectorTchernobogBurn,
kVectorVoodoo10,
#ifdef NOONE_EXTENSIONS
kVectorGenDudePunch,
#endif
kVectorMax,
};
struct THINGINFO
{
int16_t startHealth;
int16_t mass;
uint8_t clipdist;
int16_t flags;
int32_t elastic; // elasticity
int32_t dmgResist; // damage resistance
ESpriteFlags cstat;
int16_t picnum;
int8_t shade;
uint8_t pal;
uint8_t xrepeat; // xrepeat
uint8_t yrepeat; // yrepeat
int dmgControl[kDamageMax]; // damage
int16_t startHealth;
int16_t mass;
uint8_t clipdist;
int16_t flags;
int32_t elastic; // elasticity
int32_t dmgResist; // damage resistance
ESpriteFlags cstat;
int16_t picnum;
int8_t shade;
uint8_t pal;
uint8_t xrepeat; // xrepeat
uint8_t yrepeat; // yrepeat
int dmgControl[kDamageMax]; // damage
};
struct AMMOITEMDATA
{
int16_t cstat;
int16_t picnum;
int8_t shade;
uint8_t pal;
uint8_t xrepeat;
uint8_t yrepeat;
int16_t count;
uint8_t type;
uint8_t weaponType;
int16_t cstat;
int16_t picnum;
int8_t shade;
uint8_t pal;
uint8_t xrepeat;
uint8_t yrepeat;
int16_t count;
uint8_t type;
uint8_t weaponType;
};
struct WEAPONITEMDATA
{
int16_t cstat;
int16_t picnum;
int8_t shade;
uint8_t pal;
uint8_t xrepeat;
uint8_t yrepeat;
int16_t type;
int16_t ammoType;
int16_t count;
int16_t cstat;
int16_t picnum;
int8_t shade;
uint8_t pal;
uint8_t xrepeat;
uint8_t yrepeat;
int16_t type;
int16_t ammoType;
int16_t count;
};
struct ITEMDATA
{
int16_t cstat;
int16_t picnum;
int8_t shade;
uint8_t pal;
uint8_t xrepeat;
uint8_t yrepeat;
int16_t packSlot;
int16_t cstat;
int16_t picnum;
int8_t shade;
uint8_t pal;
uint8_t xrepeat;
uint8_t yrepeat;
int16_t packSlot;
};
struct MissileType
{
int16_t picnum;
int velocity;
int angleOfs;
uint8_t xrepeat;
uint8_t yrepeat;
int8_t shade;
uint8_t clipDist;
int16_t picnum;
int velocity;
int angleOfs;
uint8_t xrepeat;
uint8_t yrepeat;
int8_t shade;
uint8_t clipDist;
};
struct EXPLOSION
{
uint8_t repeat;
uint8_t dmg;
uint8_t dmgRng;
int radius;
int dmgType;
int burnTime;
int ticks;
int quakeEffect;
int flashEffect;
uint8_t repeat;
uint8_t dmg;
uint8_t dmgRng;
int radius;
int dmgType;
int burnTime;
int ticks;
int quakeEffect;
int flashEffect;
};
struct SURFHIT {
FX_ID fx1;
FX_ID fx2;
FX_ID fx3;
int fxSnd;
FX_ID fx1;
FX_ID fx2;
FX_ID fx3;
int fxSnd;
};
struct VECTORDATA {
DAMAGE_TYPE dmgType;
int dmg; // damage
int impulse;
int maxDist;
int fxChance;
int burnTime; // burn
int bloodSplats; // blood splats
int splatChance; // blood splat chance
SURFHIT surfHit[15];
DAMAGE_TYPE dmgType;
int dmg; // damage
int impulse;
int maxDist;
int fxChance;
int burnTime; // burn
int bloodSplats; // blood splats
int splatChance; // blood splat chance
SURFHIT surfHit[15];
};
extern const AMMOITEMDATA gAmmoItemData[];
@ -173,27 +173,27 @@ const int gDudeDrag = 0x2a00;
template<typename T> bool IsPlayerSprite(T const * const pSprite)
{
return pSprite->type >= kDudePlayer1 && pSprite->type <= kDudePlayer8;
return pSprite->type >= kDudePlayer1 && pSprite->type <= kDudePlayer8;
}
template<typename T> bool IsDudeSprite(T const * const pSprite)
{
return pSprite->type >= kDudeBase && pSprite->type < kDudeMax;
return pSprite->type >= kDudeBase && pSprite->type < kDudeMax;
}
template<typename T> bool IsItemSprite(T const * const pSprite)
{
return pSprite->type >= kItemBase && pSprite->type < kItemMax;
return pSprite->type >= kItemBase && pSprite->type < kItemMax;
}
template<typename T> bool IsWeaponSprite(T const * const pSprite)
{
return pSprite->type >= kItemWeaponBase && pSprite->type < kItemWeaponMax;
return pSprite->type >= kItemWeaponBase && pSprite->type < kItemWeaponMax;
}
template<typename T> bool IsAmmoSprite(T const * const pSprite)
{
return pSprite->type >= kItemAmmoBase && pSprite->type < kItemAmmoMax;
return pSprite->type >= kItemAmmoBase && pSprite->type < kItemAmmoMax;
}

View file

@ -48,7 +48,7 @@ bool dudeIsPlayingSeq(DBloodActor* actor, int nSeq)
if (actor->spr.statnum == kStatDude && actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax)
{
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
if (seqGetID(actor) == pDudeInfo->seqStartID + nSeq && seqGetStatus(actor) >= 0)
if (seqGetID(actor) == pDudeInfo->seqStartID + nSeq && seqGetStatus(actor) >= 0)
return true;
}
return false;
@ -150,10 +150,10 @@ bool CanMove(DBloodActor* actor, DBloodActor* target, int nAngle, int nRange)
return false;
int floorZ = getflorzofslopeptr(pSector, x, y);
auto pXSector = pSector->hasX()? &pSector->xs() : nullptr;
bool Underwater = 0;
bool Water = 0;
bool Depth = 0;
bool Crusher = 0;
bool Underwater = 0;
bool Water = 0;
bool Depth = 0;
bool Crusher = 0;
if (pXSector)
{
if (pXSector->Underwater)
@ -303,8 +303,8 @@ void aiMoveForward(DBloodActor* actor)
actor->spr.ang = (actor->spr.ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
if (abs(nAng) > 341)
return;
actor->xvel += MulScale(pDudeInfo->frontSpeed, Cos(actor->spr.ang), 30);
actor->yvel += MulScale(pDudeInfo->frontSpeed, Sin(actor->spr.ang), 30);
actor->xvel += MulScale(pDudeInfo->frontSpeed, Cos(actor->spr.ang), 30);
actor->yvel += MulScale(pDudeInfo->frontSpeed, Sin(actor->spr.ang), 30);
}
//---------------------------------------------------------------------------
@ -339,8 +339,8 @@ void aiMoveDodge(DBloodActor* actor)
{
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int dx = actor->xvel;
int dy = actor->yvel;
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (actor->xspr.dodgeDir > 0)
@ -348,8 +348,8 @@ void aiMoveDodge(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
}
}
@ -983,7 +983,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
// for enemies in patrol mode
if (aiInPatrolState(actor->xspr.aiState))
{
aiPatrolStop(actor, source, actor->xspr.dudeAmbush);
aiPatrolStop(actor, source, actor->xspr.dudeAmbush);
PLAYER* pPlayer = getPlayerById(source->spr.type);
if (!pPlayer) return nDamage;
@ -997,11 +997,11 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
if (((100 * actor->xspr.health) / fullHp) <= 75)
{
actor->cumulDamage += nDamage << 4; // to be sure any enemy will play the recoil animation
RecoilDude(actor);
RecoilDude(actor);
}
}
DPrintf(DMSG_SPAMMY, "Player #%d does the critical damage to patrol dude #%d!", pPlayer->nPlayer + 1, actor->GetIndex());
DPrintf(DMSG_SPAMMY, "Player #%d does the critical damage to patrol dude #%d!", pPlayer->nPlayer + 1, actor->GetIndex());
}
return nDamage;
@ -1506,7 +1506,7 @@ void aiThinkTarget(DBloodActor* actor)
for (int p = connecthead; p >= 0; p = connectpoint2[p])
{
PLAYER* pPlayer = &gPlayer[p];
if (actor->GetOwner() == pPlayer->actor || pPlayer->actor->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
if (actor->GetOwner() == pPlayer->actor || pPlayer->actor->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
continue;
int x = pPlayer->actor->spr.pos.X;
int y = pPlayer->actor->spr.pos.Y;
@ -1523,7 +1523,7 @@ void aiThinkTarget(DBloodActor* actor)
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(actor, pPlayer->actor);
aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor);
return;
}
@ -1552,7 +1552,7 @@ void aiLookForTarget(DBloodActor* actor)
for (int p = connecthead; p >= 0; p = connectpoint2[p])
{
PLAYER* pPlayer = &gPlayer[p];
if (actor->GetOwner() == pPlayer->actor || pPlayer->actor->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
if (actor->GetOwner() == pPlayer->actor || pPlayer->actor->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
continue;
int x = pPlayer->actor->spr.pos.X;
int y = pPlayer->actor->spr.pos.Y;
@ -1568,7 +1568,7 @@ void aiLookForTarget(DBloodActor* actor)
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(actor, pPlayer->actor);
aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor);
return;
}
@ -1936,22 +1936,22 @@ void aiInitSprite(DBloodActor* actor)
// make dude follow the markers
bool uwater = spriteIsUnderwater(actor);
if (actor->GetTarget() == nullptr || actor->GetTarget()->spr.type != kMarkerPath)
{
actor->SetTarget(nullptr);
aiPatrolSetMarker(actor);
if (actor->GetTarget() == nullptr || actor->GetTarget()->spr.type != kMarkerPath)
{
actor->SetTarget(nullptr);
aiPatrolSetMarker(actor);
}
if (stateTimer > 0)
{
if (uwater) aiPatrolState(actor, kAiStatePatrolWaitW);
else if (actor->xspr.unused1 & kDudeFlagCrouch) aiPatrolState(actor, kAiStatePatrolWaitC);
else aiPatrolState(actor, kAiStatePatrolWaitL);
if (stateTimer > 0)
{
if (uwater) aiPatrolState(actor, kAiStatePatrolWaitW);
else if (actor->xspr.unused1 & kDudeFlagCrouch) aiPatrolState(actor, kAiStatePatrolWaitC);
else aiPatrolState(actor, kAiStatePatrolWaitL);
actor->xspr.stateTimer = stateTimer; // restore state timer
}
else if (uwater) aiPatrolState(actor, kAiStatePatrolMoveW);
else if (actor->xspr.unused1 & kDudeFlagCrouch) aiPatrolState(actor, kAiStatePatrolMoveC);
else aiPatrolState(actor, kAiStatePatrolMoveL);
else if (uwater) aiPatrolState(actor, kAiStatePatrolMoveW);
else if (actor->xspr.unused1 & kDudeFlagCrouch) aiPatrolState(actor, kAiStatePatrolMoveC);
else aiPatrolState(actor, kAiStatePatrolMoveL);
}
}
#endif

View file

@ -30,49 +30,49 @@ BEGIN_BLD_NS
struct AISTATE {
int stateType; // By NoOne: current type of state. Basically required for kModernDudeTargetChanger, but can be used for something else.
int seqId;
int funcId; // seq callback
int stateTicks;
void(*enterFunc)(DBloodActor *);
void(*moveFunc)(DBloodActor *);
void(*thinkFunc)(DBloodActor *);
AISTATE *nextState;
int stateType; // By NoOne: current type of state. Basically required for kModernDudeTargetChanger, but can be used for something else.
int seqId;
int funcId; // seq callback
int stateTicks;
void(*enterFunc)(DBloodActor *);
void(*moveFunc)(DBloodActor *);
void(*thinkFunc)(DBloodActor *);
AISTATE *nextState;
};
extern AISTATE aiState[];
extern AISTATE genIdle;
extern AISTATE genRecoil;
enum AI_SFX_PRIORITY {
AI_SFX_PRIORITY_0 = 0,
AI_SFX_PRIORITY_1,
AI_SFX_PRIORITY_2,
AI_SFX_PRIORITY_0 = 0,
AI_SFX_PRIORITY_1,
AI_SFX_PRIORITY_2,
};
struct DUDEEXTRA_STATS
{
union {
int thinkTime;
int birthCounter;
};
union {
int thinkTime;
int birthCounter;
};
uint8_t active;
};
struct DUDEEXTRA
{
int time;
uint8_t teslaHit;
int prio;
DUDEEXTRA_STATS stats;
int time;
uint8_t teslaHit;
int prio;
DUDEEXTRA_STATS stats;
};
struct TARGETTRACK {
int TotalKills;
int Kills;
int at8; // view angle
int atc;
int at10; // Move predict
int TotalKills;
int Kills;
int at8; // view angle
int atc;
int at10; // Move predict
};
extern const int dword_138BB0[5];

View file

@ -112,7 +112,7 @@ static void batThinkTarget(DBloodActor* actor)
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(actor, pPlayer->actor);
aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor);
}
else if (nDist < pDudeInfo->hearDist)
@ -209,8 +209,8 @@ static void batMoveDodgeUp(DBloodActor* actor)
actor->spr.ang = (actor->spr.ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int dx = actor->xvel;
int dy = actor->yvel;
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (actor->xspr.dodgeDir > 0)
@ -218,9 +218,9 @@ static void batMoveDodgeUp(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x52aaa;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x52aaa;
}
static void batMoveDodgeDown(DBloodActor* actor)
@ -234,8 +234,8 @@ static void batMoveDodgeDown(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int dx = actor->xvel;
int dy = actor->yvel;
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (actor->xspr.dodgeDir > 0)
@ -243,9 +243,9 @@ static void batMoveDodgeDown(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x44444;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x44444;
}
static void batThinkChase(DBloodActor* actor)
@ -326,16 +326,16 @@ static void batMoveForward(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (actor->GetTarget() == nullptr)
t1 += nAccel;
else
t1 += nAccel >> 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
}
static void batMoveSwoop(DBloodActor* actor)
@ -358,14 +358,14 @@ static void batMoveSwoop(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel >> 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x44444;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x44444;
}
static void batMoveFly(DBloodActor* actor)
@ -388,14 +388,14 @@ static void batMoveFly(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel >> 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x2d555;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x2d555;
}
void batMoveToCeil(DBloodActor* actor)

View file

@ -101,13 +101,13 @@ void StompSeqCallback(int, DBloodActor* actor)
{
if (actor != actor2)
{
if (actor2->hasX())
if (actor2->hasX())
{
if (actor2->spr.type == kDudeBeast)
continue;
if (actor2->spr.flags & 32)
continue;
if (CheckSector(sectorMap, actor2) && CheckProximity(actor2, x, y, z, pSector, vc))
if (CheckSector(sectorMap, actor2) && CheckProximity(actor2, x, y, z, pSector, vc))
{
int top, bottom;
GetActorExtents(actor, &top, &bottom);
@ -211,7 +211,7 @@ static void beastThinkChase(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
if (!actor->ValidateTarget(__FUNCTION__)) return;
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));
@ -245,7 +245,7 @@ static void beastThinkChase(DBloodActor* actor)
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(actor, actor->GetTarget());
actor->dudeSlope = nDist == 0? 0 : DivScale(target->spr.pos.Z - actor->spr.pos.Z, nDist, 10);
actor->dudeSlope = nDist == 0 ? 0 : DivScale(target->spr.pos.Z - actor->spr.pos.Z, nDist, 10);
if (nDist < 0x1400 && nDist > 0xa00 && abs(nDeltaAngle) < 85 && (target->spr.flags & 2)
&& target->IsPlayerActor() && Chance(0x8000))
{
@ -351,7 +351,7 @@ static void beastThinkSwimChase(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
if (!actor->ValidateTarget(__FUNCTION__)) return;
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));
@ -408,8 +408,8 @@ static void beastMoveForward(DBloodActor* actor)
int nDist = approxDist(dx, dy);
if (nDist <= 0x400 && Random(64) < 32)
return;
actor->xvel += MulScale(pDudeInfo->frontSpeed, Cos(actor->spr.ang), 30);
actor->yvel += MulScale(pDudeInfo->frontSpeed, Sin(actor->spr.ang), 30);
actor->xvel += MulScale(pDudeInfo->frontSpeed, Cos(actor->spr.ang), 30);
actor->yvel += MulScale(pDudeInfo->frontSpeed, Sin(actor->spr.ang), 30);
}
static void sub_628A0(DBloodActor* actor)
@ -431,16 +431,16 @@ static void sub_628A0(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (actor->GetTarget() == nullptr)
t1 += nAccel;
else
t1 += nAccel >> 2;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
}
static void sub_62AE0(DBloodActor* actor)
@ -468,14 +468,14 @@ static void sub_62AE0(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -dz;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -dz;
}
static void sub_62D7C(DBloodActor* actor)
@ -503,14 +503,14 @@ static void sub_62D7C(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel >> 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = dz;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = dz;
}
END_BLD_NS

View file

@ -98,7 +98,7 @@ static void eelThinkTarget(DBloodActor* actor)
{
pDudeExtraE->thinkTime = 0;
actor->xspr.goalAng += 256;
POINT3D* pTarget = &actor->basePoint;
POINT3D* pTarget = &actor->basePoint;
aiSetTarget(actor, pTarget->X, pTarget->Y, pTarget->Z);
aiNewState(actor, &eelTurn);
return;
@ -125,7 +125,7 @@ static void eelThinkTarget(DBloodActor* actor)
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
pDudeExtraE->thinkTime = 0;
aiSetTarget(actor, pPlayer->actor);
aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor);
}
else if (nDist < pDudeInfo->hearDist)
@ -171,7 +171,7 @@ static void eelThinkPonder(DBloodActor* actor)
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));
@ -223,8 +223,8 @@ static void eelMoveDodgeUp(DBloodActor* actor)
actor->spr.ang = (actor->spr.ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int dx = actor->xvel;
int dy = actor->yvel;
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (actor->xspr.dodgeDir > 0)
@ -232,9 +232,9 @@ static void eelMoveDodgeUp(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x8000;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x8000;
}
static void eelMoveDodgeDown(DBloodActor* actor)
@ -248,8 +248,8 @@ static void eelMoveDodgeDown(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int dx = actor->xvel;
int dy = actor->yvel;
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (actor->xspr.dodgeDir > 0)
@ -257,9 +257,9 @@ static void eelMoveDodgeDown(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x44444;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x44444;
}
static void eelThinkChase(DBloodActor* actor)
@ -272,7 +272,7 @@ static void eelThinkChase(DBloodActor* actor)
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));
@ -336,16 +336,16 @@ static void eelMoveForward(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (actor->GetTarget() == nullptr)
t1 += nAccel;
else
t1 += nAccel >> 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
}
static void eelMoveSwoop(DBloodActor* actor)
@ -365,14 +365,14 @@ static void eelMoveSwoop(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel >> 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x22222;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x22222;
}
static void eelMoveAscend(DBloodActor* actor)
@ -392,14 +392,14 @@ static void eelMoveAscend(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel >> 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x8000;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x8000;
}
void eelMoveToCeil(DBloodActor* actor)

View file

@ -125,7 +125,7 @@ static void calebThinkChase(DBloodActor* actor)
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));
@ -158,7 +158,7 @@ static void calebThinkChase(DBloodActor* actor)
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(actor, actor->GetTarget());
actor->dudeSlope = nDist == 0 ? 0 : DivScale(target->spr.pos.Z-actor->spr.pos.Z, nDist, 10);
actor->dudeSlope = nDist == 0 ? 0 : DivScale(target->spr.pos.Z - actor->spr.pos.Z, nDist, 10);
if (nDist < 0x599 && abs(nDeltaAngle) < 28)
{
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
@ -232,7 +232,7 @@ static void calebThinkSwimChase(DBloodActor* actor)
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));
@ -289,16 +289,16 @@ static void sub_65D04(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (actor->GetTarget() == nullptr)
t1 += nAccel;
else
t1 += nAccel >> 2;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
}
static void sub_65F44(DBloodActor* actor)
@ -327,14 +327,14 @@ static void sub_65F44(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -dz;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -dz;
}
static void sub_661E0(DBloodActor* actor)
@ -363,14 +363,14 @@ static void sub_661E0(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel >> 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = dz;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = dz;
}
END_BLD_NS

View file

@ -100,9 +100,9 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
if (tt1.at10)
{
int t = DivScale(nDist, tt1.at10, 12);
x2 += (actor2->xvel * t) >> 12;
y2 += (actor2->yvel * t) >> 12;
z2 += (actor2->zvel * t) >> 8;
x2 += (actor2->xvel * t) >> 12;
y2 += (actor2->yvel * t) >> 12;
z2 += (actor2->zvel * t) >> 8;
}
int tx = x + MulScale(Cos(actor->spr.ang), nDist, 30);
int ty = y + MulScale(Sin(actor->spr.ang), nDist, 30);
@ -137,11 +137,11 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
}
switch (actor->spr.type) {
case kDudeCerberusTwoHead:
actFireMissile(actor, -350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballCerberus);
actFireMissile(actor, 350, -100, aim.dx, aim.dy, aim.dz, kMissileFireballCerberus);
actFireMissile(actor, -350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballCerberus);
actFireMissile(actor, 350, -100, aim.dx, aim.dy, aim.dz, kMissileFireballCerberus);
break;
case kDudeCerberusOneHead:
actFireMissile(actor, 350, -100, aim.dx, aim.dy, aim.dz, kMissileFireballCerberus);
actFireMissile(actor, 350, -100, aim.dx, aim.dy, aim.dz, kMissileFireballCerberus);
break;
}
}
@ -177,9 +177,9 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor)
if (tt1.at10)
{
int t = DivScale(nDist, tt1.at10, 12);
x2 += (actor->xvel * t) >> 12;
y2 += (actor->yvel * t) >> 12;
z2 += (actor->zvel * t) >> 8;
x2 += (actor->xvel * t) >> 12;
y2 += (actor->yvel * t) >> 12;
z2 += (actor->zvel * t) >> 8;
}
int tx = x + MulScale(Cos(actor->spr.ang), nDist, 30);
int ty = y + MulScale(Sin(actor->spr.ang), nDist, 30);
@ -216,11 +216,11 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor)
}
switch (actor->spr.type) {
case kDudeCerberusTwoHead:
actFireMissile(actor, 350, -100, aim.dx, aim.dy, -aim.dz, kMissileFlameHound);
actFireMissile(actor, -350, 0, ax, ay, az, kMissileFlameHound);
actFireMissile(actor, 350, -100, aim.dx, aim.dy, -aim.dz, kMissileFlameHound);
actFireMissile(actor, -350, 0, ax, ay, az, kMissileFlameHound);
break;
case kDudeCerberusOneHead:
actFireMissile(actor, 350, -100, aim.dx, aim.dy, -aim.dz, kMissileFlameHound);
actFireMissile(actor, 350, -100, aim.dx, aim.dy, -aim.dz, kMissileFlameHound);
break;
}
}
@ -244,7 +244,7 @@ static void cerberusThinkTarget(DBloodActor* actor)
else if (pDudeExtraE->thinkTime >= 10 && pDudeExtraE->active)
{
actor->xspr.goalAng += 256;
POINT3D* pTarget = &actor->basePoint;
POINT3D* pTarget = &actor->basePoint;
aiSetTarget(actor, pTarget->X, pTarget->Y, pTarget->Z);
if (actor->spr.type == kDudeCerberusTwoHead)
aiNewState(actor, &cerberus139890);
@ -274,7 +274,7 @@ static void cerberusThinkTarget(DBloodActor* actor)
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
pDudeExtraE->thinkTime = 0;
aiSetTarget(actor, pPlayer->actor);
aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor);
}
else if (nDist < pDudeInfo->hearDist)
@ -340,7 +340,7 @@ static void cerberusThinkChase(DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return;
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));

View file

@ -129,9 +129,9 @@ void BlastSSeqCallback(int, DBloodActor* actor)
if (tt.at10)
{
int t = DivScale(nDist, tt.at10, 12);
x2 += (actor->xvel * t) >> 12;
y2 += (actor->yvel * t) >> 12;
z2 += (actor->zvel * t) >> 8;
x2 += (actor->xvel * t) >> 12;
y2 += (actor->yvel * t) >> 12;
z2 += (actor->zvel * t) >> 8;
}
int tx = x + MulScale(Cos(actor->spr.ang), nDist, 30);
int ty = y + MulScale(Sin(actor->spr.ang), nDist, 30);
@ -177,13 +177,13 @@ void BlastSSeqCallback(int, DBloodActor* actor)
#ifdef NOONE_EXTENSIONS
// allow to fire missile in non-player targets
if (target->IsPlayerActor() || gModernMap) {
actFireMissile(actor, -120, 0, aim.dx, aim.dy, aim.dz, kMissileArcGargoyle);
actFireMissile(actor, 120, 0, aim.dx, aim.dy, aim.dz, kMissileArcGargoyle);
actFireMissile(actor, -120, 0, aim.dx, aim.dy, aim.dz, kMissileArcGargoyle);
actFireMissile(actor, 120, 0, aim.dx, aim.dy, aim.dz, kMissileArcGargoyle);
}
#else
if (target->IsPlayerActor()) {
actFireMissile(actor, -120, 0, aim.dx, aim.dy, aim.dz, kMissileArcGargoyle);
actFireMissile(actor, 120, 0, aim.dx, aim.dy, aim.dz, kMissileArcGargoyle);
actFireMissile(actor, -120, 0, aim.dx, aim.dy, aim.dz, kMissileArcGargoyle);
actFireMissile(actor, 120, 0, aim.dx, aim.dy, aim.dz, kMissileArcGargoyle);
}
#endif
@ -207,7 +207,7 @@ static void gargThinkTarget(DBloodActor* actor)
else if (pDudeExtraE->thinkTime >= 10 && pDudeExtraE->active)
{
actor->xspr.goalAng += 256;
POINT3D* pTarget = &actor->basePoint;
POINT3D* pTarget = &actor->basePoint;
aiSetTarget(actor, pTarget->X, pTarget->Y, pTarget->Z);
aiNewState(actor, &gargoyleTurn);
return;
@ -234,7 +234,7 @@ static void gargThinkTarget(DBloodActor* actor)
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
pDudeExtraE->thinkTime = 0;
aiSetTarget(actor, pPlayer->actor);
aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor);
}
else if (nDist < pDudeInfo->hearDist)
@ -285,8 +285,8 @@ static void gargMoveDodgeUp(DBloodActor* actor)
actor->spr.ang = (actor->spr.ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int dx = actor->xvel;
int dy = actor->yvel;
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (actor->xspr.dodgeDir > 0)
@ -294,9 +294,9 @@ static void gargMoveDodgeUp(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x1d555;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x1d555;
}
static void gargMoveDodgeDown(DBloodActor* actor)
@ -313,8 +313,8 @@ static void gargMoveDodgeDown(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int dx = actor->xvel;
int dy = actor->yvel;
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (actor->xspr.dodgeDir > 0)
@ -322,9 +322,9 @@ static void gargMoveDodgeDown(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x44444;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x44444;
}
static void gargThinkChase(DBloodActor* actor)
@ -341,7 +341,7 @@ static void gargThinkChase(DBloodActor* actor)
}
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));
@ -375,7 +375,7 @@ static void gargThinkChase(DBloodActor* actor)
case kDudeGargoyleFlesh:
if (nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
{
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit)
{
case -1:
@ -400,7 +400,7 @@ static void gargThinkChase(DBloodActor* actor)
}
else if (nDist < 0x400 && abs(nDeltaAngle) < 85)
{
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit)
{
case -1:
@ -434,7 +434,7 @@ static void gargThinkChase(DBloodActor* actor)
case kDudeGargoyleStone:
if (nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
{
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit)
{
case -1:
@ -459,7 +459,7 @@ static void gargThinkChase(DBloodActor* actor)
}
else if (nDist < 0x400 && abs(nDeltaAngle) < 85)
{
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit)
{
case -1:
@ -539,16 +539,16 @@ static void gargMoveForward(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (actor->GetTarget() == nullptr)
t1 += nAccel;
else
t1 += nAccel >> 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
}
static void gargMoveSlow(DBloodActor* actor)
@ -574,20 +574,20 @@ static void gargMoveSlow(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 = nAccel >> 1;
t2 >>= 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
switch (actor->spr.type) {
case kDudeGargoyleFlesh:
actor->zvel = 0x44444;
actor->zvel = 0x44444;
break;
case kDudeGargoyleStone:
actor->zvel = 0x35555;
actor->zvel = 0x35555;
break;
}
}
@ -615,19 +615,19 @@ static void gargMoveSwoop(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel >> 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
switch (actor->spr.type) {
case kDudeGargoyleFlesh:
actor->zvel = t1;
actor->zvel = t1;
break;
case kDudeGargoyleStone:
actor->zvel = t1;
actor->zvel = t1;
break;
}
}
@ -655,19 +655,19 @@ static void gargMoveFly(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel >> 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
switch (actor->spr.type) {
case kDudeGargoyleFlesh:
actor->zvel = -t1;
actor->zvel = -t1;
break;
case kDudeGargoyleStone:
actor->zvel = -t1;
actor->zvel = -t1;
break;
}
}

View file

@ -115,9 +115,9 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
if (tt.at10)
{
int t = DivScale(nDist, tt.at10, 12);
x2 += (actor->xvel * t) >> 12;
y2 += (actor->yvel * t) >> 12;
z2 += (actor->zvel * t) >> 8;
x2 += (actor->xvel * t) >> 12;
y2 += (actor->yvel * t) >> 12;
z2 += (actor->zvel * t) >> 8;
}
int tx = x + MulScale(Cos(actor->spr.ang), nDist, 30);
int ty = y + MulScale(Sin(actor->spr.ang), nDist, 30);
@ -164,12 +164,12 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
// allow fire missile in non-player targets if not a demo
if (target->IsPlayerActor() || gModernMap) {
sfxPlay3DSound(actor, 489, 0, 0);
actFireMissile(actor, 0, 0, aim.dx, aim.dy, aim.dz, kMissileEctoSkull);
actFireMissile(actor, 0, 0, aim.dx, aim.dy, aim.dz, kMissileEctoSkull);
}
#else
if (target->IsPlayerActor()) {
sfxPlay3DSound(actor, 489, 0, 0);
actFireMissile(actor, 0, 0, aim.dx, aim.dy, aim.dz, kMissileEctoSkull);
actFireMissile(actor, 0, 0, aim.dx, aim.dy, aim.dz, kMissileEctoSkull);
}
#endif
}
@ -187,7 +187,7 @@ static void ghostThinkTarget(DBloodActor* actor)
else if (pDudeExtraE->thinkTime >= 10 && pDudeExtraE->active)
{
actor->xspr.goalAng += 256;
POINT3D* pTarget = &actor->basePoint;
POINT3D* pTarget = &actor->basePoint;
aiSetTarget(actor, pTarget->X, pTarget->Y, pTarget->Z);
aiNewState(actor, &ghostTurn);
return;
@ -214,7 +214,7 @@ static void ghostThinkTarget(DBloodActor* actor)
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
pDudeExtraE->thinkTime = 0;
aiSetTarget(actor, pPlayer->actor);
aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor);
return;
}
@ -264,8 +264,8 @@ static void ghostMoveDodgeUp(DBloodActor* actor)
actor->spr.ang = (actor->spr.ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int dx = actor->xvel;
int dy = actor->yvel;
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (actor->xspr.dodgeDir > 0)
@ -273,9 +273,9 @@ static void ghostMoveDodgeUp(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x1d555;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x1d555;
}
static void ghostMoveDodgeDown(DBloodActor* actor)
@ -292,8 +292,8 @@ static void ghostMoveDodgeDown(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int dx = actor->xvel;
int dy = actor->yvel;
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (actor->xspr.dodgeDir > 0)
@ -301,9 +301,9 @@ static void ghostMoveDodgeDown(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x44444;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x44444;
}
static void ghostThinkChase(DBloodActor* actor)
@ -320,7 +320,7 @@ static void ghostThinkChase(DBloodActor* actor)
}
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));
@ -352,7 +352,7 @@ static void ghostThinkChase(DBloodActor* actor)
switch (actor->spr.type) {
case kDudePhantasm:
if (nDist < 0x2000 && nDist > 0x1000 && abs(nDeltaAngle) < 85) {
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit)
{
case -1:
@ -372,7 +372,7 @@ static void ghostThinkChase(DBloodActor* actor)
}
else if (nDist < 0x400 && abs(nDeltaAngle) < 85)
{
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit)
{
case -1:
@ -435,16 +435,16 @@ static void ghostMoveForward(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (actor->GetTarget() == nullptr)
t1 += nAccel;
else
t1 += nAccel >> 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
}
static void ghostMoveSlow(DBloodActor* actor)
@ -470,17 +470,17 @@ static void ghostMoveSlow(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 = nAccel >> 1;
t2 >>= 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
switch (actor->spr.type) {
case kDudePhantasm:
actor->zvel = 0x44444;
actor->zvel = 0x44444;
break;
}
}
@ -508,16 +508,16 @@ static void ghostMoveSwoop(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel >> 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
switch (actor->spr.type) {
case kDudePhantasm:
actor->zvel = t1;
actor->zvel = t1;
break;
}
}
@ -545,16 +545,16 @@ static void ghostMoveFly(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel >> 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
switch (actor->spr.type) {
case kDudePhantasm:
actor->zvel = -t1;
actor->zvel = -t1;
break;
}
}

View file

@ -281,16 +281,16 @@ static void sub_6CB00(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (actor->GetTarget() == nullptr)
t1 += nAccel;
else
t1 += nAccel >> 2;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
}
static void sub_6CD74(DBloodActor* actor)
@ -318,14 +318,14 @@ static void sub_6CD74(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -dz;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -dz;
}
static void sub_6D03C(DBloodActor* actor)
@ -353,14 +353,14 @@ static void sub_6D03C(DBloodActor* actor)
return;
int nCos = Cos(actor->spr.ang);
int nSin = Sin(actor->spr.ang);
int vx = actor->xvel;
int vy = actor->yvel;
int vx = actor->xvel;
int vy = actor->yvel;
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel >> 1;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = dz;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = dz;
}
END_BLD_NS

View file

@ -64,7 +64,7 @@ void houndBiteSeqCallback(int, DBloodActor* actor)
void houndBurnSeqCallback(int, DBloodActor* actor)
{
actFireMissile(actor, 0, 0, bcos(actor->spr.ang), bsin(actor->spr.ang), 0, kMissileFlameHound);
actFireMissile(actor, 0, 0, bcos(actor->spr.ang), bsin(actor->spr.ang), 0, kMissileFlameHound);
}
static void houndThinkSearch(DBloodActor* actor)
@ -104,7 +104,7 @@ static void houndThinkChase(DBloodActor* actor)
}
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));

View file

@ -101,7 +101,7 @@ void podAttack(int, DBloodActor* actor)
break;
}
for (int i = 0; i < 4; i++)
fxSpawnPodStuff(actor, 240);
fxSpawnPodStuff(actor, 240);
}
void sub_70284(int, DBloodActor* actor)
@ -180,7 +180,7 @@ static void aiPodChase(DBloodActor* actor)
}
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));

View file

@ -70,7 +70,7 @@ void SpidBiteSeqCallback(int, DBloodActor* actor)
auto const target = actor->GetTarget();
if (target->IsPlayerActor())
{
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
if (hit == 3 && gHitInfo.actor()->IsPlayerActor())
{
dz += target->spr.pos.Z - actor->spr.pos.Z;
@ -121,9 +121,9 @@ void SpidJumpSeqCallback(int, DBloodActor* actor)
case kDudeSpiderBrown:
case kDudeSpiderRed:
case kDudeSpiderBlack:
actor->xvel = IntToFixed(dx);
actor->yvel = IntToFixed(dy);
actor->zvel = IntToFixed(dz);
actor->xvel = IntToFixed(dx);
actor->yvel = IntToFixed(dy);
actor->zvel = IntToFixed(dz);
break;
}
}
@ -191,7 +191,7 @@ static void spidThinkChase(DBloodActor* actor)
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));

View file

@ -119,8 +119,8 @@ void sub_71BD4(int, DBloodActor* actor)
}
}
}
actFireMissile(actor, -350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballTchernobog);
actFireMissile(actor, 350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballTchernobog);
actFireMissile(actor, -350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballTchernobog);
actFireMissile(actor, 350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballTchernobog);
}
void sub_720AC(int, DBloodActor* actor)
@ -191,8 +191,8 @@ void sub_720AC(int, DBloodActor* actor)
}
}
}
actFireMissile(actor, 350, 0, aim.dx, aim.dy, -aim.dz, kMissileFireballTchernobog);
actFireMissile(actor, -350, 0, ax, ay, az, kMissileFireballTchernobog);
actFireMissile(actor, 350, 0, aim.dx, aim.dy, -aim.dz, kMissileFireballTchernobog);
actFireMissile(actor, -350, 0, ax, ay, az, kMissileFireballTchernobog);
}
static void sub_72580(DBloodActor* actor)
@ -288,7 +288,7 @@ static void sub_72934(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
if (!actor->ValidateTarget(__FUNCTION__)) return;
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));

View file

@ -112,7 +112,7 @@ static void zombaThinkChase(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
if (!actor->ValidateTarget(__FUNCTION__)) return;
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));
@ -162,7 +162,7 @@ static void zombaThinkPonder(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
if (!actor->ValidateTarget(__FUNCTION__)) return;
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));
@ -209,8 +209,8 @@ static void myThinkTarget(DBloodActor* actor)
for (int p = connecthead; p >= 0; p = connectpoint2[p])
{
PLAYER* pPlayer = &gPlayer[p];
auto owneractor = actor->GetOwner();
if (owneractor == nullptr || owneractor == pPlayer->actor || pPlayer->actor->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
auto owneractor = actor->GetOwner();
if (owneractor == nullptr || owneractor == pPlayer->actor || pPlayer->actor->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
continue;
int x = pPlayer->actor->spr.pos.X;
int y = pPlayer->actor->spr.pos.Y;
@ -226,7 +226,7 @@ static void myThinkTarget(DBloodActor* actor)
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(actor, pPlayer->actor);
aiSetTarget(actor, pPlayer->actor);
aiActivateDude(actor);
}
else if (nDist < pDudeInfo->hearDist)

View file

@ -77,7 +77,7 @@ void PukeSeqCallback(int, DBloodActor* actor)
void ThrowSeqCallback(int, DBloodActor* actor)
{
actFireMissile(actor, 0, -getDudeInfo(actor->spr.type)->eyeHeight, bcos(actor->spr.ang), bsin(actor->spr.ang), 0, kMissileButcherKnife);
actFireMissile(actor, 0, -getDudeInfo(actor->spr.type)->eyeHeight, bcos(actor->spr.ang), bsin(actor->spr.ang), 0, kMissileButcherKnife);
}
static void zombfThinkSearch(DBloodActor* actor)
@ -111,7 +111,7 @@ static void zombfThinkChase(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
if (!actor->ValidateTarget(__FUNCTION__)) return;
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
aiChooseDirection(actor, getangle(dx, dy));
@ -137,7 +137,7 @@ static void zombfThinkChase(DBloodActor* actor)
aiSetTarget(actor, actor->GetTarget());
if (nDist < 0x1400 && nDist > 0xe00 && abs(nDeltaAngle) < 85)
{
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit)
{
case -1:
@ -156,7 +156,7 @@ static void zombfThinkChase(DBloodActor* actor)
}
else if (nDist < 0x1400 && nDist > 0x600 && abs(nDeltaAngle) < 85)
{
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit)
{
case -1:
@ -175,7 +175,7 @@ static void zombfThinkChase(DBloodActor* actor)
}
else if (nDist < 0x400 && abs(nDeltaAngle) < 85)
{
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit)
{
case -1: