mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-26 05:51:30 +00:00
- second half of AI code complete (again, without owner)
This commit is contained in:
parent
758bf78c81
commit
d9ad0661f7
12 changed files with 28 additions and 51 deletions
|
@ -360,8 +360,6 @@ static void goblinWar(PLAYER& plr, DWHActor* actor)
|
|||
{
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
short k;
|
||||
|
||||
if (spr.lotag > 256) {
|
||||
spr.lotag = 100;
|
||||
spr.extra = 0;
|
||||
|
@ -405,8 +403,7 @@ static void goblinWar(PLAYER& plr, DWHActor* actor)
|
|||
}
|
||||
case 1: // chase
|
||||
{
|
||||
k = spr.owner;
|
||||
auto owneractor = &whActors[k];
|
||||
auto owneractor = &whActors[spr.owner];
|
||||
auto ownerspr = owneractor->s();
|
||||
|
||||
auto moveStat = aimove(actor);
|
||||
|
@ -419,7 +416,7 @@ static void goblinWar(PLAYER& plr, DWHActor* actor)
|
|||
}
|
||||
else if (moveStat.type == kHitSprite) {
|
||||
int sprnum = moveStat.actor->GetSpriteIndex();
|
||||
if (sprnum != k) {
|
||||
if (sprnum != spr.owner) {
|
||||
spr.extra = 3;
|
||||
spr.ang = (short)((spr.ang + (krand() & 256 - 128)) & 2047);
|
||||
spr.lotag = 60;
|
||||
|
@ -443,8 +440,7 @@ static void goblinWar(PLAYER& plr, DWHActor* actor)
|
|||
}
|
||||
case 2: // attack
|
||||
{
|
||||
k = spr.owner;
|
||||
auto owneractor = &whActors[k];
|
||||
auto owneractor = &whActors[spr.owner];
|
||||
auto& ownerspr = owneractor->s();
|
||||
if (checkdist(actor, ownerspr.x, ownerspr.y, ownerspr.z)) {
|
||||
if ((krand() & 1) != 0) {
|
||||
|
|
|
@ -256,7 +256,6 @@ static void castkatie(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void diekatie(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
spr.lotag -= TICSPERFRAME;
|
||||
|
|
|
@ -7,7 +7,6 @@ static void checkexplkobold(PLAYER& plr, DWHActor* actor);
|
|||
|
||||
static void chasekobold(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
spr.lotag -= TICSPERFRAME;
|
||||
|
@ -203,7 +202,6 @@ static void fleekobold(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void attackkobold(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0);
|
||||
|
@ -255,8 +253,6 @@ static void resurectkobold(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void searchkobold(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
|
||||
if ((krand() % 100) > 98)
|
||||
spritesound(S_KSNARL1 + (krand() % 4), actor);
|
||||
aisearch(plr, actor, false);
|
||||
|
@ -328,7 +324,6 @@ static void skirmishkobold(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void checkexplkobold(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
WHSectIterator it(spr.sectnum);
|
||||
|
|
|
@ -32,7 +32,6 @@ static void nukedkurt(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void kurtExplo(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
spr.lotag -= TICSPERFRAME;
|
||||
|
|
|
@ -205,7 +205,6 @@ static void faceminotaur(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void attackminotaur(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0);
|
||||
|
@ -322,7 +321,6 @@ static void searchminotaur(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void checkexplminotaur(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
WHSectIterator it(spr.sectnum);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
BEGIN_WH_NS
|
||||
|
||||
static void newguyarrow(short s, PLAYER& plr);
|
||||
static void newguyarrow(DWHActor* s, PLAYER& plr);
|
||||
|
||||
static void standnewguy(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
|
@ -259,7 +259,6 @@ static void fleenewguy(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void attacknewguy(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0);
|
||||
|
@ -335,7 +334,6 @@ static void dienewguy(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void castnewguy(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
spr.lotag -= TICSPERFRAME;
|
||||
|
@ -355,41 +353,42 @@ static void castnewguy(PLAYER& plr, DWHActor* actor)
|
|||
spr.extra--;
|
||||
spr.picnum = NEWGUY;
|
||||
spritesound(S_PLRWEAPON3, actor);
|
||||
newguyarrow(i, plr);
|
||||
newguyarrow(actor, plr);
|
||||
SetNewStatus(actor, CHASE);
|
||||
}
|
||||
checksector6(actor);
|
||||
}
|
||||
|
||||
static void newguyarrow(short s, PLAYER& plr) {
|
||||
auto spawnedactor = InsertActor(sprite[s].sectnum, JAVLIN);
|
||||
auto& spr = spawnedactor->s();
|
||||
static void newguyarrow(DWHActor* actor, PLAYER& plr) {
|
||||
auto& spr = actor->s();
|
||||
auto spawnedactor = InsertActor(spr.sectnum, JAVLIN);
|
||||
auto& spawned = spawnedactor->s();
|
||||
|
||||
spr.x = sprite[s].x;
|
||||
spr.y = sprite[s].y;
|
||||
spr.z = sprite[s].z - (40 << 8);
|
||||
spawned.x = spr.x;
|
||||
spawned.y = spr.y;
|
||||
spawned.z = spr.z - (40 << 8);
|
||||
|
||||
spr.cstat = 21;
|
||||
spawned.cstat = 21;
|
||||
|
||||
spr.picnum = WALLARROW;
|
||||
spr.ang = (short)(((sprite[s].ang + 2048 + 96) - 512) & 2047);
|
||||
spr.xrepeat = 24;
|
||||
spr.yrepeat = 24;
|
||||
spr.clipdist = 32;
|
||||
spawned.picnum = WALLARROW;
|
||||
spawned.ang = (short)(((spr.ang + 2048 + 96) - 512) & 2047);
|
||||
spawned.xrepeat = 24;
|
||||
spawned.yrepeat = 24;
|
||||
spawned.clipdist = 32;
|
||||
|
||||
spr.extra = sprite[s].ang;
|
||||
spr.shade = -15;
|
||||
spr.xvel = (short)((krand() & 256) - 128);
|
||||
spr.yvel = (short)((krand() & 256) - 128);
|
||||
spawned.extra = spr.ang;
|
||||
spawned.shade = -15;
|
||||
spawned.xvel = (short)((krand() & 256) - 128);
|
||||
spawned.yvel = (short)((krand() & 256) - 128);
|
||||
|
||||
spr.zvel = (short)(((plr.z + (8 << 8) - sprite[s].z) << 7) / ksqrt((plr.x - sprite[s].x) * (plr.x - sprite[s].x) + (plr.y - sprite[s].y) * (plr.y - sprite[s].y)));
|
||||
spawned.zvel = (short)(((plr.z + (8 << 8) - spr.z) << 7) / ksqrt((plr.x - spr.x) * (plr.x - spr.x) + (plr.y - spr.y) * (plr.y - spr.y)));
|
||||
|
||||
spr.zvel += ((krand() % 256) - 128);
|
||||
spawned.zvel += ((krand() % 256) - 128);
|
||||
|
||||
spr.owner = s;
|
||||
spr.lotag = 1024;
|
||||
spr.hitag = 0;
|
||||
spr.pal = 0;
|
||||
spawned.owner = actor->GetSpriteIndex();
|
||||
spawned.lotag = 1024;
|
||||
spawned.hitag = 0;
|
||||
spawned.pal = 0;
|
||||
spr.backuploc();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ static void dierat(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void fleerat(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
spr.lotag -= TICSPERFRAME;
|
||||
|
|
|
@ -211,7 +211,6 @@ static void standskeleton(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void attackskeleton(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0);
|
||||
|
@ -346,7 +345,6 @@ void skeletonChill(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void checkexplskeleton(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
WHSectIterator it(spr.sectnum);
|
||||
|
|
|
@ -204,7 +204,6 @@ static void fleeskully(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void castskully(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
spr.lotag -= TICSPERFRAME;
|
||||
|
@ -224,7 +223,6 @@ static void castskully(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void dieskully(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
spr.lotag -= TICSPERFRAME;
|
||||
|
|
|
@ -184,7 +184,6 @@ static void facespider(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void attackspider(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0);
|
||||
|
@ -288,7 +287,6 @@ static void diespider(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
static void checkexplspider(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
WHSectIterator it(spr.sectnum);
|
||||
|
|
|
@ -263,7 +263,6 @@ void willowProcess(PLAYER& plr)
|
|||
|
||||
static void willowDrain(PLAYER& plr, DWHActor* actor)
|
||||
{
|
||||
int i = actor->GetSpriteIndex();
|
||||
SPRITE& spr = actor->s();
|
||||
|
||||
spr.lotag -= TICSPERFRAME;
|
||||
|
|
|
@ -553,7 +553,6 @@ struct GameInterface : public ::GameInterface
|
|||
|
||||
inline void SetNewStatus(DWHActor* actor, const int seq)
|
||||
{
|
||||
void newstatus(short sn, int seq);
|
||||
newstatus(actor->GetSpriteIndex(), seq);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue