Skip to content

Commit

Permalink
- actImpactMissile.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Jun 2, 2021
1 parent f96521a commit a7572bc
Show file tree
Hide file tree
Showing 11 changed files with 376 additions and 375 deletions.
682 changes: 320 additions & 362 deletions source/games/blood/src/actor.cpp

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions source/games/blood/src/actor.h
Expand Up @@ -221,8 +221,7 @@ void actKillDude(DBloodActor* a1, DBloodActor* pSprite, DAMAGE_TYPE a3, int a4);
void actKillDude(int a1, spritetype *pSprite, DAMAGE_TYPE a3, int a4);
int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE a3, int a4);
int actDamageSprite(DBloodActor* pSource, DBloodActor* pTarget, DAMAGE_TYPE damageType, int damage);
void actHitcodeToData(int a1, HITINFO *pHitInfo, int *a3, spritetype **a4, XSPRITE **a5, int *a6, walltype **a7, XWALL **a8, int *a9, sectortype **a10, XSECTOR **a11);
void actImpactMissile(spritetype *pMissile, int hitCode);
void actHitcodeToData(int a1, HITINFO *pHitInfo, DBloodActor **actor, walltype **a7 = nullptr);
void actKickObject(spritetype *pSprite1, spritetype *pSprite2);
void actTouchFloor(spritetype *pSprite, int nSector);
void ProcessTouchObjects(spritetype *pSprite, int nXSprite);
Expand Down
16 changes: 8 additions & 8 deletions source/games/blood/src/aibeast.cpp
Expand Up @@ -80,12 +80,12 @@ void SlashSeqCallback(int, DBloodActor* actor)
sfxPlay3DSound(pSprite, 9012+Random(2), -1, 0);
}

void StompSeqCallback(int, DBloodActor* actor)
void StompSeqCallback(int, DBloodActor* actor1)
{
uint8_t vb8[(kMaxSectors+7)>>3];
XSPRITE* pXSprite = &actor->x();
XSPRITE* pXSprite = &actor1->x();
int nSprite = pXSprite->reference;
spritetype *pSprite = &actor->s();
spritetype *pSprite = &actor1->s();
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int x = pSprite->x;
Expand All @@ -97,12 +97,12 @@ void StompSeqCallback(int, DBloodActor* actor)
int v10 = 25+30*gGameOptions.nDifficulty;
GetClosestSpriteSectors(nSector, x, y, vc, vb8);
char v4 = 0;
int v34 = -1;
int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
actHitcodeToData(hit, &gHitInfo, &v34, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
if (hit == 3 && v34 >= 0)
DBloodActor* actor2 = nullptr;
actHitcodeToData(hit, &gHitInfo, &actor2);
if (hit == 3 && actor2)
{
if (sprite[v34].statnum == kStatDude)
if (actor2->s().statnum == kStatDude)
v4 = 0;
}
vc <<= 4;
Expand Down Expand Up @@ -178,7 +178,7 @@ static void MorphToBeast(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
actHealDude(pXSprite, dudeInfo[51].startHealth, dudeInfo[51].startHealth);
actHealDude(actor, dudeInfo[51].startHealth, dudeInfo[51].startHealth);
pSprite->type = kDudeBeast;
}

Expand Down
11 changes: 11 additions & 0 deletions source/games/blood/src/bloodactor.h
Expand Up @@ -50,6 +50,17 @@ class DBloodActor
return base() + s().owner;
}

void SetTarget(DBloodActor* own)
{
x().target = own ? own->s().index : -1;
}

DBloodActor* GetTarget()
{
if (x().target == -1 || x().target == kMaxSprites - 1) return nullptr;
return base() + x().target;
}

void SetSpecialOwner() // nnext hackery
{
s().owner = kMaxSprites - 1;
Expand Down
16 changes: 16 additions & 0 deletions source/games/blood/src/eventq.cpp
Expand Up @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "blood.h"
#include "secrets.h"
#include "serializer.h"
#include "bloodactor.h"

BEGIN_BLD_NS

Expand Down Expand Up @@ -525,6 +526,16 @@ void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback)
}


void evPost(DBloodActor* actor, unsigned int nDelta, COMMAND_ID command)
{
evPost(actor->s().index, 3, nDelta, command);
}

void evPost(DBloodActor* actor, unsigned int nDelta, CALLBACK_ID callback)
{
evPost(actor->s().index, 3, nDelta, callback);
}

//---------------------------------------------------------------------------
//
//
Expand All @@ -549,6 +560,11 @@ void evKill(int index, int type, CALLBACK_ID cb)
}
}

void evKill(DBloodActor* actor)
{
evKill(actor->s().index, 3);
}

//---------------------------------------------------------------------------
//
//
Expand Down
4 changes: 4 additions & 0 deletions source/games/blood/src/eventq.h
Expand Up @@ -158,8 +158,12 @@ void evInit(void);
void evSend(int nIndex, int nType, int rxId, COMMAND_ID command);
void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command);
void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback);
void evPost(DBloodActor*, unsigned int nDelta, COMMAND_ID command);
void evPost(DBloodActor*, unsigned int nDelta, CALLBACK_ID callback);

void evProcess(unsigned int nTime);
void evKill(int a1, int a2);
void evKill(int a1, int a2, CALLBACK_ID a3);
void evKill(DBloodActor*);

END_BLD_NS
6 changes: 6 additions & 0 deletions source/games/blood/src/gameutil.cpp
Expand Up @@ -321,6 +321,12 @@ int GetWallAngle(int nWall)
return getangle(wall[nWall2].x - wall[nWall].x, wall[nWall2].y - wall[nWall].y);
}

int GetWallAngle(walltype* pWall)
{
int nWall2 = pWall->point2;
return getangle(wall[nWall2].x - pWall->x, wall[nWall2].y - pWall->y);
}

void GetWallNormal(int nWall, int *pX, int *pY)
{
assert(nWall >= 0 && nWall < kMaxWalls);
Expand Down
1 change: 1 addition & 0 deletions source/games/blood/src/gameutil.h
Expand Up @@ -72,6 +72,7 @@ bool CheckProximity(spritetype *pSprite, int nX, int nY, int nZ, int nSector, in
bool CheckProximityPoint(int nX1, int nY1, int nZ1, int nX2, int nY2, int nZ2, int nDist);
bool CheckProximityWall(int nWall, int x, int y, int nDist);
int GetWallAngle(int nWall);
int GetWallAngle(walltype* pWall);
void GetWallNormal(int nWall, int *pX, int *pY);
bool IntersectRay(int wx, int wy, int wdx, int wdy, int x1, int y1, int z1, int x2, int y2, int z2, int *ix, int *iy, int *iz);
int HitScan(spritetype *pSprite, int z, int dx, int dy, int dz, unsigned int nMask, int a8);
Expand Down
4 changes: 4 additions & 0 deletions source/games/blood/src/triggers.cpp
Expand Up @@ -1802,6 +1802,10 @@ void trTriggerSprite(unsigned int nSprite, XSPRITE *pXSprite, int command) {
}
}

void trTriggerSprite(DBloodActor* actor, int command) {
trTriggerSprite(actor->s().index, &actor->x(), command);
}


void trMessageSector(unsigned int nSector, EVENT event) {
assert(nSector < (unsigned int)numsectors);
Expand Down
1 change: 1 addition & 0 deletions source/games/blood/src/triggers.h
Expand Up @@ -35,6 +35,7 @@ void trMessageSector(unsigned int nSector, EVENT event);
void trTriggerWall(unsigned int nWall, XWALL *pXWall, int command);
void trMessageWall(unsigned int nWall, EVENT event);
void trTriggerSprite(unsigned int nSprite, XSPRITE *pXSprite, int command);
void trTriggerSprite(DBloodActor* actor, int command);
void trMessageSprite(unsigned int nSprite, EVENT event);
void trProcessBusy(void);
void trInit(void);
Expand Down
7 changes: 4 additions & 3 deletions source/games/blood/src/weapon.cpp
Expand Up @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "build.h"

#include "blood.h"
#include "bloodactor.h"

BEGIN_BLD_NS

Expand Down Expand Up @@ -2591,9 +2592,9 @@ void teslaHit(spritetype *pMissile, int a2)
int nOwner = pMissile->owner;
GetClosestSpriteSectors(nSector, x, y, nDist, va4);
bool v4 = true;
int v24 = -1;
actHitcodeToData(a2, &gHitInfo, &v24, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
if (a2 == 3 && v24 >= 0 && sprite[v24].statnum == kStatDude)
DBloodActor* actor = nullptr;
actHitcodeToData(a2, &gHitInfo, &actor);
if (a2 == 3 && actor && actor->s().statnum == kStatDude)
v4 = false;
int nSprite;
StatIterator it(kStatDude);
Expand Down

0 comments on commit a7572bc

Please sign in to comment.