2019-11-20 16:21:32 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 sirlemonhead, Nuke.YKT
|
|
|
|
This file is part of PCExhumed.
|
|
|
|
PCExhumed is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
2019-11-22 23:11:37 +00:00
|
|
|
#include "ns.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include "exhumed.h"
|
|
|
|
#include "aistuff.h"
|
|
|
|
#include "engine.h"
|
|
|
|
#include "queen.h"
|
|
|
|
#include "move.h"
|
|
|
|
#include "sequence.h"
|
|
|
|
#include "runlist.h"
|
|
|
|
#include "random.h"
|
|
|
|
#include "wasp.h"
|
|
|
|
#include "trigdat.h"
|
|
|
|
#include "anims.h"
|
|
|
|
#include "player.h"
|
2019-09-21 15:47:55 +00:00
|
|
|
#include "sound.h"
|
2019-11-16 22:32:12 +00:00
|
|
|
#include "names.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
#include <assert.h>
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
BEGIN_PS_NS
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
#define kMaxQueens 1
|
|
|
|
#define kMaxEggs 10
|
|
|
|
#define kMaxTails 7
|
|
|
|
|
|
|
|
short QueenCount = 0;
|
|
|
|
|
|
|
|
static actionSeq ActionSeq[] = {
|
2019-08-31 07:47:15 +00:00
|
|
|
{ 0, 0 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 9, 0 },
|
|
|
|
{ 36, 0 },
|
|
|
|
{ 18, 0 },
|
|
|
|
{ 27, 0 },
|
|
|
|
{ 45, 0 },
|
|
|
|
{ 45, 0 },
|
|
|
|
{ 54, 1 },
|
|
|
|
{ 53, 1 },
|
|
|
|
{ 55, 1 }
|
2019-08-26 03:59:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static actionSeq HeadSeq[] = {
|
2019-08-31 07:47:15 +00:00
|
|
|
{ 56, 1 },
|
|
|
|
{ 65, 0 },
|
|
|
|
{ 65, 0 },
|
|
|
|
{ 65, 0 },
|
|
|
|
{ 65, 0 },
|
|
|
|
{ 65, 0 },
|
|
|
|
{ 74, 0 },
|
|
|
|
{ 82, 0 },
|
|
|
|
{ 90, 0 }
|
2019-08-26 03:59:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static actionSeq EggSeq[] = {
|
2019-08-31 07:47:15 +00:00
|
|
|
{ 19, 1 },
|
|
|
|
{ 18, 1 },
|
|
|
|
{ 0, 0 },
|
|
|
|
{ 9, 0 },
|
|
|
|
{ 23, 1 },
|
2019-08-26 03:59:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int nQHead = 0;
|
|
|
|
|
|
|
|
short nEggsFree;
|
|
|
|
short nHeadVel;
|
|
|
|
short nVelShift;
|
|
|
|
|
|
|
|
short tailspr[kMaxTails];
|
|
|
|
short nEggFree[kMaxEggs];
|
|
|
|
|
|
|
|
short QueenChan[kMaxQueens];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Queen
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nHealth;
|
|
|
|
short field_2;
|
|
|
|
short nAction;
|
|
|
|
short nSprite;
|
|
|
|
short nTarget;
|
|
|
|
short field_A;
|
|
|
|
short field_C;
|
|
|
|
short pad;
|
|
|
|
short field_10;
|
|
|
|
short field_12;
|
2019-08-26 03:59:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Egg
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nHealth;
|
|
|
|
short field_2;
|
|
|
|
short nAction;
|
|
|
|
short nSprite;
|
|
|
|
short field_8;
|
|
|
|
short nTarget;
|
|
|
|
short field_C;
|
|
|
|
short field_E;
|
2019-08-26 03:59:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Head
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nHealth;
|
|
|
|
short field_2;
|
|
|
|
short nAction;
|
|
|
|
short nSprite;
|
|
|
|
short field_8;
|
|
|
|
short nTarget;
|
|
|
|
short field_C;
|
|
|
|
short field_E;
|
2019-08-26 03:59:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Egg QueenEgg[kMaxEggs];
|
|
|
|
Queen QueenList[kMaxQueens];
|
|
|
|
Head QueenHead;
|
|
|
|
|
|
|
|
int MoveQX[25];
|
|
|
|
int MoveQY[25];
|
|
|
|
int MoveQZ[25];
|
|
|
|
short MoveQS[25];
|
|
|
|
short MoveQA[25];
|
|
|
|
|
|
|
|
|
|
|
|
void InitQueens()
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
QueenCount = 1;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
for (int i = 0; i < kMaxEggs; i++)
|
|
|
|
{
|
|
|
|
nEggFree[i] = i;
|
|
|
|
QueenEgg[i].field_8 = -1;
|
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
|
|
|
|
nEggsFree = kMaxEggs;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int GrabEgg()
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
if (!nEggsFree) {
|
|
|
|
return -1;
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
nEggsFree--;
|
|
|
|
return nEggFree[nEggsFree];
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BlowChunks(int nSprite)
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
BuildCreatureChunk(nSprite, seq_GetSeqPicnum(16, i + 41, 0));
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DestroyEgg(short nEgg)
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nSprite = QueenEgg[nEgg].nSprite;
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (QueenEgg[nEgg].nAction != 4)
|
|
|
|
{
|
|
|
|
BuildAnim(-1, 34, 0, sprite[nSprite].x, sprite[nSprite].y, sprite[nSprite].z, sprite[nSprite].sectnum, sprite[nSprite].xrepeat, 4);
|
|
|
|
}
|
|
|
|
else
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
BuildCreatureChunk(nSprite, seq_GetSeqPicnum(kSeqQueenEgg, (i % 2) + 24, 0));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
runlist_DoSubRunRec(sprite[nSprite].owner);
|
|
|
|
runlist_DoSubRunRec(sprite[nSprite].lotag - 1);
|
|
|
|
runlist_SubRunRec(QueenEgg[nEgg].field_8);
|
|
|
|
|
|
|
|
QueenEgg[nEgg].field_8 = -1;
|
|
|
|
|
|
|
|
mydeletesprite(nSprite);
|
|
|
|
|
|
|
|
nEggFree[nEggsFree] = nEgg;
|
|
|
|
nEggsFree++;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DestroyAllEggs()
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
for (int i = 0; i < kMaxEggs; i++)
|
|
|
|
{
|
|
|
|
if (QueenEgg[i].field_8 > -1)
|
|
|
|
{
|
|
|
|
DestroyEgg(i);
|
|
|
|
}
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SetHeadVel(short nSprite)
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nAngle = sprite[nSprite].ang;
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (nVelShift >= 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
sprite[nSprite].xvel = Cos(nAngle) >> (int8_t)(nVelShift);
|
|
|
|
sprite[nSprite].yvel = Sin(nAngle) >> (int8_t)(nVelShift);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
sprite[nSprite].xvel = Cos(nAngle) << (int8_t)(-nVelShift);
|
|
|
|
sprite[nSprite].yvel = Sin(nAngle) << (int8_t)(-nVelShift);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int QueenAngleChase(short nSprite, short nSprite2, int val1, int val2)
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nAngle;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
2019-08-31 07:47:15 +00:00
|
|
|
if (nSprite2 < 0)
|
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
pSprite->zvel = 0;
|
|
|
|
nAngle = pSprite->ang;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
spritetype *pSprite2 = &sprite[nSprite2];
|
|
|
|
int nTileY = (tilesiz[pSprite2->picnum].y * pSprite2->yrepeat) * 2;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
int nMyAngle = GetMyAngle(pSprite2->x - pSprite->x, pSprite2->y - pSprite->y);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
int edx = ((pSprite2->z - nTileY) - pSprite->z) >> 8;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
int x = pSprite2->x - pSprite->x;
|
|
|
|
int y = pSprite2->y - pSprite->y;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
int nSqrt = ksqrt(x * x + y * y);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
int var_14 = GetMyAngle(nSqrt, edx);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
int nAngDelta = AngleDelta(pSprite->ang, nMyAngle, 1024);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (klabs(nAngDelta) > 127)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
val1 /= klabs(nAngDelta>>7);
|
|
|
|
if (val1 < 256)
|
2019-08-31 07:47:15 +00:00
|
|
|
val1 = 256;
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (klabs(nAngDelta) > val2)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
if (nAngDelta < 0)
|
|
|
|
nAngDelta = -val2;
|
2019-08-31 07:47:15 +00:00
|
|
|
else
|
2019-11-17 18:48:56 +00:00
|
|
|
nAngDelta = val2;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
nAngle = (nAngDelta + sprite[nSprite].ang) & kAngleMask;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
pSprite->zvel = (AngleDelta(pSprite->zvel, var_14, 24) + pSprite->zvel) & kAngleMask;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
pSprite->ang = nAngle;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
int da = pSprite->zvel;
|
|
|
|
int x = klabs(Cos(da));
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
int v26 = x * ((val1 * Cos(nAngle)) >> 14);
|
2019-08-31 07:47:15 +00:00
|
|
|
int v27 = x * ((val1 * Sin(nAngle)) >> 14);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
int nSqrt = ksqrt(((v26 >> 8) * (v26 >> 8)) + ((v27 >> 8) * (v27 >> 8))) * Sin(da);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
return movesprite(nSprite, v26 >> 2, v27 >> 2, (Sin(bobangle) >> 5) + (nSqrt >> 13), 0, 0, CLIPMASK1);
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int DestroyTailPart()
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
if (!QueenHead.field_E) {
|
|
|
|
return 0;
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
short nSprite = tailspr[--QueenHead.field_E];
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
BlowChunks(nSprite);
|
|
|
|
BuildExplosion(nSprite);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
short nHeight = GetSpriteHeight(nSprite);
|
|
|
|
BuildLavaLimb(nSprite, i, nHeight);
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
mydeletesprite(nSprite);
|
|
|
|
return 1;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BuildTail()
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nSprite = QueenHead.nSprite;
|
|
|
|
|
|
|
|
int x = sprite[nSprite].x;
|
|
|
|
int y = sprite[nSprite].x;
|
|
|
|
int z = sprite[nSprite].x;
|
|
|
|
short nSector = sprite[nSprite].sectnum;
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < kMaxTails; i++)
|
|
|
|
{
|
|
|
|
short nTailSprite = insertsprite(nSector, 121);
|
|
|
|
tailspr[i] = nTailSprite;
|
|
|
|
|
|
|
|
if (nTailSprite < 0) {
|
2019-11-24 09:03:19 +00:00
|
|
|
I_Error("Can't create queen's tail!\n");
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sprite[nTailSprite].lotag = runlist_HeadRun() + 1;
|
|
|
|
sprite[nTailSprite].owner = runlist_AddRunRec(sprite[nTailSprite].lotag - 1, (i + 1) | 0x1B0000);
|
|
|
|
sprite[nTailSprite].shade = -12;
|
|
|
|
sprite[nTailSprite].x = x;
|
|
|
|
sprite[nTailSprite].y = y;
|
|
|
|
sprite[nTailSprite].hitag = 0;
|
|
|
|
sprite[nTailSprite].cstat = 0;
|
|
|
|
sprite[nTailSprite].clipdist = 100;
|
|
|
|
sprite[nTailSprite].xrepeat = 80;
|
|
|
|
sprite[nTailSprite].yrepeat = 80;
|
|
|
|
sprite[nTailSprite].picnum = 1;
|
|
|
|
sprite[nTailSprite].pal = sector[sprite[nTailSprite].sectnum].ceilingpal;
|
|
|
|
sprite[nTailSprite].xoffset = 0;
|
|
|
|
sprite[nTailSprite].yoffset = 0;
|
|
|
|
sprite[nTailSprite].z = z;
|
|
|
|
sprite[nTailSprite].extra = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 24 + 1; i++)
|
|
|
|
{
|
|
|
|
MoveQX[i] = x;
|
|
|
|
MoveQZ[i] = z;
|
|
|
|
MoveQY[i] = y;
|
|
|
|
assert(nSector >= 0 && nSector < kMaxSectors);
|
|
|
|
MoveQS[i] = nSector;
|
|
|
|
}
|
|
|
|
|
|
|
|
nQHead = 0;
|
|
|
|
QueenHead.field_E = 7;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int BuildQueenEgg(short nQueen, int nVal)
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
int nEgg = GrabEgg();
|
|
|
|
if (nEgg < 0) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
short nSprite = QueenList[nQueen].nSprite;
|
|
|
|
|
|
|
|
int x = sprite[nSprite].x;
|
|
|
|
int y = sprite[nSprite].y;
|
|
|
|
short nSector = sprite[nSprite].sectnum;
|
|
|
|
int nFloorZ = sector[nSector].floorz;
|
|
|
|
short nAngle = sprite[nSprite].ang;
|
|
|
|
|
|
|
|
int nSprite2 = insertsprite(nSector, 121);
|
|
|
|
assert(nSprite2 >= 0 && nSprite2 < kMaxSprites);
|
|
|
|
|
|
|
|
sprite[nSprite2].x = x;
|
|
|
|
sprite[nSprite2].y = y;
|
|
|
|
sprite[nSprite2].z = nFloorZ;
|
|
|
|
sprite[nSprite2].pal = 0;
|
|
|
|
sprite[nSprite2].clipdist = 50;
|
|
|
|
sprite[nSprite2].xoffset = 0;
|
|
|
|
sprite[nSprite2].yoffset = 0;
|
|
|
|
sprite[nSprite2].shade = -12;
|
|
|
|
sprite[nSprite2].picnum = 1;
|
|
|
|
sprite[nSprite2].ang = (RandomSize(9) + (nAngle - 256)) & kAngleMask;
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (!nVal)
|
|
|
|
{
|
|
|
|
sprite[nSprite2].xrepeat = 30;
|
|
|
|
sprite[nSprite2].yrepeat = 30;
|
|
|
|
sprite[nSprite2].xvel = Cos(sprite[nSprite2].ang);
|
|
|
|
sprite[nSprite2].yvel = Sin(sprite[nSprite2].ang);
|
|
|
|
sprite[nSprite2].zvel = -6000;
|
|
|
|
sprite[nSprite2].cstat = 0;
|
|
|
|
}
|
|
|
|
else
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
sprite[nSprite2].xrepeat = 60;
|
|
|
|
sprite[nSprite2].yrepeat = 60;
|
|
|
|
sprite[nSprite2].xvel = 0;
|
|
|
|
sprite[nSprite2].yvel = 0;
|
|
|
|
sprite[nSprite2].zvel = -2000;
|
|
|
|
sprite[nSprite2].cstat = 0x101;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite[nSprite2].lotag = runlist_HeadRun() + 1;
|
|
|
|
sprite[nSprite2].extra = -1;
|
|
|
|
sprite[nSprite2].hitag = 0;
|
|
|
|
|
|
|
|
GrabTimeSlot(3);
|
|
|
|
|
|
|
|
QueenEgg[nEgg].nHealth = 200;
|
|
|
|
QueenEgg[nEgg].field_2 = 0;
|
|
|
|
QueenEgg[nEgg].nSprite = nSprite2;
|
|
|
|
QueenEgg[nEgg].field_E = nVal;
|
|
|
|
QueenEgg[nEgg].nTarget = QueenList[nQueen].nTarget;
|
|
|
|
|
|
|
|
if (nVal)
|
|
|
|
{
|
|
|
|
nVal = 4;
|
|
|
|
QueenEgg[nEgg].field_C = 200;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueenEgg[nEgg].nAction = nVal;
|
|
|
|
|
|
|
|
sprite[nSprite2].owner = runlist_AddRunRec(sprite[nSprite2].lotag - 1, nEgg | 0x1D0000);
|
|
|
|
QueenEgg[nEgg].field_8 = runlist_AddRunRec(NewRun, nEgg | 0x1D0000);
|
|
|
|
|
|
|
|
return 0;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FuncQueenEgg(int a, int nDamage, int nRun)
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nEgg = RunData[nRun].nVal;
|
|
|
|
|
|
|
|
int var_14 = 0;
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
Egg *pEgg = &QueenEgg[nEgg];
|
|
|
|
short nSprite = pEgg->nSprite;
|
|
|
|
short nAction = pEgg->nAction;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
short nTarget;
|
|
|
|
|
|
|
|
int nMessage = a & 0x7F0000;
|
|
|
|
|
|
|
|
switch (nMessage)
|
|
|
|
{
|
|
|
|
case 0x20000:
|
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
if (pEgg->nHealth <= 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
DestroyEgg(nEgg);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (nAction == 0 || nAction == 4) {
|
2019-08-31 07:47:15 +00:00
|
|
|
Gravity(nSprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
short nSeq = SeqOffsets[kSeqQueenEgg] + EggSeq[nAction].a;
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
sprite[nSprite].picnum = seq_GetSeqPicnum2(nSeq, pEgg->field_2);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
if (nAction != 4)
|
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
seq_MoveSequence(nSprite, nSeq, pEgg->field_2);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
pEgg->field_2++;
|
|
|
|
if (pEgg->field_2 >= SeqSize[nSeq])
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
pEgg->field_2 = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
var_14 = 1;
|
|
|
|
}
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
nTarget = UpdateEnemy(&pEgg->nTarget);
|
|
|
|
pEgg->nTarget = nTarget;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (nTarget >= 0 && (sprite[nTarget].cstat & 0x101) == 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
pEgg->nTarget = -1;
|
|
|
|
pEgg->nAction = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
nTarget = FindPlayer(-nSprite, 1000);
|
|
|
|
pEgg->nTarget = nTarget;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (nAction)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
int nMov = MoveCreature(nSprite);
|
|
|
|
if (!nMov) {
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (nMov & 0x20000)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
if (!RandomSize(1))
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
pEgg->nAction = 1;
|
|
|
|
pEgg->field_2 = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
else
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
DestroyEgg(nEgg);
|
2019-10-29 22:24:31 +00:00
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
short nAngle;
|
|
|
|
|
|
|
|
switch (nMov & 0xC000)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
default:
|
|
|
|
return;
|
|
|
|
case 0x8000:
|
|
|
|
nAngle = GetWallNormal(nMov & 0x3FFF);
|
|
|
|
break;
|
|
|
|
case 0xC000:
|
|
|
|
nAngle = sprite[nMov & 0x3FFF].ang;
|
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
|
|
|
|
sprite[nSprite].ang = nAngle;
|
|
|
|
sprite[nSprite].xvel = Cos(nAngle) >> 1;
|
|
|
|
sprite[nSprite].yvel = Sin(nAngle) >> 1;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
if (var_14)
|
|
|
|
{
|
|
|
|
pEgg->nAction = 3;
|
|
|
|
sprite[nSprite].cstat = 0x101;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
case 3:
|
|
|
|
{
|
|
|
|
int nMov = QueenAngleChase(nSprite, nTarget, nHeadVel, 64);
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
switch (nMov & 0xC000)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
case 0xC000:
|
2019-08-31 07:47:15 +00:00
|
|
|
if (sprite[nMov & 0x3FFF].statnum != 121)
|
|
|
|
{
|
|
|
|
runlist_DamageEnemy(nMov & 0x3FFF, nSprite, 5);
|
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
fallthrough__;
|
|
|
|
case 0x8000:
|
2019-08-31 07:47:15 +00:00
|
|
|
sprite[nSprite].ang += (RandomSize(9) + 768);
|
|
|
|
sprite[nSprite].ang &= kAngleMask;
|
2019-11-17 18:48:56 +00:00
|
|
|
sprite[nSprite].xvel = Cos(sprite[nSprite].ang) >> 3;
|
2019-08-31 07:47:15 +00:00
|
|
|
sprite[nSprite].yvel = Sin(sprite[nSprite].ang) >> 3;
|
|
|
|
sprite[nSprite].zvel = -RandomSize(5);
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
{
|
|
|
|
int nMov = MoveCreature(nSprite);
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (nMov & 0x20000)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
sprite[nSprite].zvel = -(sprite[nSprite].zvel - 256);
|
|
|
|
if (sprite[nSprite].zvel < -512)
|
|
|
|
{
|
|
|
|
sprite[nSprite].zvel = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
pEgg->field_C--;
|
|
|
|
if (pEgg->field_C <= 0)
|
|
|
|
{
|
|
|
|
short nWaspSprite = BuildWasp(-2, sprite[nSprite].x, sprite[nSprite].y, sprite[nSprite].z, sprite[nSprite].sectnum, sprite[nSprite].ang);
|
|
|
|
sprite[nSprite].z = sprite[nWaspSprite].z;
|
|
|
|
|
|
|
|
DestroyEgg(nEgg);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 0xA0000:
|
|
|
|
{
|
|
|
|
if (sprite[nRadialSpr].statnum != 121 && (sprite[nSprite].cstat & 0x101) != 0)
|
|
|
|
{
|
|
|
|
nDamage = runlist_CheckRadialDamage(nSprite);
|
|
|
|
|
|
|
|
pEgg->nHealth -= nDamage;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
case 0x80000:
|
|
|
|
{
|
|
|
|
if (nDamage != 0 && pEgg->nHealth > 0)
|
|
|
|
{
|
|
|
|
QueenEgg[nEgg].nHealth -= nDamage;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (QueenEgg[nEgg].nHealth <= 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
DestroyEgg(nEgg);
|
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 0x90000:
|
|
|
|
{
|
|
|
|
seq_PlotSequence(a & 0xFFFF, SeqOffsets[kSeqQueenEgg] + EggSeq[nAction].a, pEgg->field_2, EggSeq[nAction].b);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
DebugOut("unknown msg %d for Queenhead\n", a & 0x7F0000);
|
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int BuildQueenHead(short nQueen)
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nSprite = QueenList[nQueen].nSprite;
|
|
|
|
|
|
|
|
int x = sprite[nSprite].x;
|
|
|
|
int y = sprite[nSprite].y;
|
|
|
|
short nAngle = sprite[nSprite].ang;
|
|
|
|
short nSector = sprite[nSprite].sectnum;
|
|
|
|
int z = sector[nSector].floorz;
|
|
|
|
|
|
|
|
int nSprite2 = insertsprite(nSector, 121);
|
|
|
|
assert(nSprite2 >= 0 && nSprite2 < kMaxSprites);
|
|
|
|
|
|
|
|
sprite[nSprite2].x = x;
|
|
|
|
sprite[nSprite2].y = y;
|
|
|
|
sprite[nSprite2].z = z;
|
|
|
|
sprite[nSprite2].clipdist = 70;
|
|
|
|
sprite[nSprite2].xrepeat = 80;
|
|
|
|
sprite[nSprite2].yrepeat = 80;
|
|
|
|
sprite[nSprite2].cstat = 0;
|
|
|
|
sprite[nSprite2].picnum = 1;
|
|
|
|
sprite[nSprite2].shade = -12;
|
|
|
|
sprite[nSprite2].pal = 0;
|
|
|
|
sprite[nSprite2].xoffset = 0;
|
|
|
|
sprite[nSprite2].yoffset = 0;
|
|
|
|
sprite[nSprite2].ang = nAngle;
|
|
|
|
|
|
|
|
nVelShift = 2;
|
|
|
|
SetHeadVel(nSprite2);
|
2019-11-20 16:21:32 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
sprite[nSprite2].zvel = -8192;
|
|
|
|
sprite[nSprite2].lotag = runlist_HeadRun() + 1;
|
|
|
|
sprite[nSprite2].hitag = 0;
|
|
|
|
sprite[nSprite2].extra = -1;
|
|
|
|
|
|
|
|
GrabTimeSlot(3);
|
|
|
|
|
2019-10-22 22:46:29 +00:00
|
|
|
QueenHead.nHealth = 800;
|
2019-08-31 07:47:15 +00:00
|
|
|
QueenHead.nAction = 0;
|
|
|
|
QueenHead.nTarget = QueenList[nQueen].nTarget;
|
|
|
|
QueenHead.field_2 = 0;
|
|
|
|
QueenHead.nSprite = nSprite2;
|
|
|
|
QueenHead.field_C = 0;
|
|
|
|
|
|
|
|
sprite[nSprite2].owner = runlist_AddRunRec(sprite[nSprite2].lotag - 1, 0x1B0000);
|
|
|
|
|
|
|
|
QueenHead.field_8 = runlist_AddRunRec(NewRun, 0x1B0000);
|
|
|
|
QueenHead.field_E = 0;
|
|
|
|
|
|
|
|
return 0;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FuncQueenHead(int a, int nDamage, int nRun)
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
short nHead = RunData[nRun].nVal;
|
|
|
|
|
|
|
|
short nSprite = QueenHead.nSprite;
|
|
|
|
int nSector = sprite[nSprite].sectnum;
|
|
|
|
assert(nSector >= 0 && nSector < kMaxSectors);
|
|
|
|
|
|
|
|
short nAction = QueenHead.nAction;
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
short nTarget, nHd;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
int var_14 = 0;
|
|
|
|
|
|
|
|
int nMessage = a & 0x7F0000;
|
|
|
|
|
|
|
|
switch (nMessage)
|
|
|
|
{
|
|
|
|
case 0x20000:
|
|
|
|
{
|
|
|
|
if (nAction == 0) {
|
|
|
|
Gravity(nSprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
short nSeq = SeqOffsets[kSeqQueen] + HeadSeq[QueenHead.nAction].a;
|
|
|
|
|
|
|
|
seq_MoveSequence(nSprite, nSeq, QueenHead.field_2);
|
|
|
|
|
|
|
|
sprite[nSprite].picnum = seq_GetSeqPicnum2(nSeq, QueenHead.field_2);
|
|
|
|
|
|
|
|
QueenHead.field_2++;
|
|
|
|
if (QueenHead.field_2 >= SeqSize[nSeq])
|
|
|
|
{
|
|
|
|
QueenHead.field_2 = 0;
|
|
|
|
var_14 = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
nTarget = QueenHead.nTarget;
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (nTarget > -1)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
if (!(sprite[nTarget].cstat & 0x101))
|
|
|
|
{
|
|
|
|
nTarget = -1;
|
|
|
|
QueenHead.nTarget = nTarget;
|
|
|
|
}
|
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
nTarget = FindPlayer(nSprite, 1000);
|
|
|
|
QueenHead.nTarget = nTarget;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
switch (nAction)
|
|
|
|
{
|
2019-11-20 16:21:32 +00:00
|
|
|
case 0:
|
2019-08-31 07:47:15 +00:00
|
|
|
if (QueenHead.field_C > 0)
|
|
|
|
{
|
|
|
|
QueenHead.field_C--;
|
|
|
|
if (QueenHead.field_C == 0)
|
|
|
|
{
|
|
|
|
BuildTail();
|
|
|
|
|
|
|
|
QueenHead.nAction = 6;
|
|
|
|
nHeadVel = 800;
|
|
|
|
sprite[nSprite].cstat = 0x101;
|
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
else if (QueenHead.field_C < 60)
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
sprite[nSprite].shade--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int nMov = MoveCreature(nSprite);
|
|
|
|
|
|
|
|
// original BUG - this line doesn't exist in original code?
|
|
|
|
short nNewAng = sprite[nSprite].ang;
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
switch (nMov & 0xFC000)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
default:
|
|
|
|
return;
|
|
|
|
case 0xC000:
|
2019-08-31 07:47:15 +00:00
|
|
|
nNewAng = sprite[nMov & 0x3FFF].ang;
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
|
|
|
case 0x8000:
|
2019-08-31 07:47:15 +00:00
|
|
|
nNewAng = GetWallNormal(nMov & 0x3FFF);
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
|
|
|
case 0x20000:
|
2019-08-31 07:47:15 +00:00
|
|
|
sprite[nSprite].zvel = -(sprite[nSprite].zvel >> 1);
|
|
|
|
|
|
|
|
if (sprite[nSprite].zvel > -256)
|
|
|
|
{
|
|
|
|
nVelShift = 100;
|
|
|
|
sprite[nSprite].zvel = 0;
|
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// original BUG - var_18 isn't being set if the check above == 0x20000 ?
|
|
|
|
sprite[nSprite].ang = nNewAng;
|
|
|
|
nVelShift++;
|
|
|
|
|
|
|
|
if (nVelShift < 5)
|
|
|
|
{
|
|
|
|
SetHeadVel(nSprite);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite[nSprite].xvel = 0;
|
|
|
|
sprite[nSprite].yvel = 0;
|
|
|
|
|
|
|
|
if (sprite[nSprite].zvel == 0)
|
|
|
|
{
|
|
|
|
QueenHead.field_C = 120;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
case 6:
|
|
|
|
if (var_14)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
QueenHead.nAction = 1;
|
|
|
|
QueenHead.field_2 = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
break;
|
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
fallthrough__;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
if ((sprite[nTarget].z - 51200) > sprite[nSprite].z)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
QueenHead.nAction = 4;
|
|
|
|
QueenHead.field_2 = 0;
|
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite[nSprite].z -= 2048;
|
|
|
|
goto __MOVEQS;
|
|
|
|
}
|
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
|
|
|
case 4:
|
|
|
|
case 7:
|
|
|
|
case 8:
|
|
|
|
if (var_14)
|
|
|
|
{
|
|
|
|
int nRnd = RandomSize(2);
|
|
|
|
|
|
|
|
if (nRnd == 0)
|
|
|
|
{
|
|
|
|
QueenHead.nAction = 4;
|
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
else if (nRnd == 1)
|
|
|
|
{
|
|
|
|
QueenHead.nAction = 7;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
else
|
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
QueenHead.nAction = 8;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nTarget > -1)
|
|
|
|
{
|
|
|
|
int nMov = QueenAngleChase(nSprite, nTarget, nHeadVel, 64);
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
switch (nMov & 0xC000)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
case 0x8000:
|
|
|
|
break;
|
|
|
|
case 0xC000:
|
2019-08-31 07:47:15 +00:00
|
|
|
if ((nMov & 0x3FFF) == nTarget)
|
|
|
|
{
|
|
|
|
runlist_DamageEnemy(nTarget, nSprite, 10);
|
2019-11-17 18:48:56 +00:00
|
|
|
D3PlayFX(StaticSound[kSoundQTail] | 0x2000, nSprite);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-08-31 07:47:15 +00:00
|
|
|
sprite[nSprite].ang += RandomSize(9) + 768;
|
|
|
|
sprite[nSprite].ang &= kAngleMask;
|
|
|
|
|
|
|
|
sprite[nSprite].zvel = (-20) - RandomSize(6);
|
|
|
|
|
|
|
|
SetHeadVel(nSprite);
|
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
// switch break. MoveQS stuff?
|
|
|
|
__MOVEQS:
|
|
|
|
MoveQX[nQHead] = sprite[nSprite].x;
|
|
|
|
MoveQY[nQHead] = sprite[nSprite].y;
|
|
|
|
MoveQZ[nQHead] = sprite[nSprite].z;
|
|
|
|
assert(sprite[nSprite].sectnum >= 0 && sprite[nSprite].sectnum < kMaxSectors);
|
|
|
|
MoveQS[nQHead] = sprite[nSprite].sectnum;
|
|
|
|
MoveQA[nQHead] = sprite[nSprite].ang;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
nHd = nQHead;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
for (int i = 0; i < QueenHead.field_E; i++)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
nHd -= 3;
|
|
|
|
if (nHd < 0) {
|
|
|
|
nHd += (24 + 1); // TODO - enum/define for these
|
|
|
|
//assert(nHd < 24 && nHd >= 0);
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
int var_20 = MoveQS[nHd];
|
|
|
|
short nTSprite = tailspr[i];
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (var_20 != sprite[nTSprite].sectnum)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
assert(var_20 >= 0 && var_20 < kMaxSectors);
|
|
|
|
mychangespritesect(nTSprite, var_20);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
sprite[nTSprite].x = MoveQX[nHd];
|
|
|
|
sprite[nTSprite].y = MoveQY[nHd];
|
|
|
|
sprite[nTSprite].z = MoveQZ[nHd];
|
|
|
|
sprite[nTSprite].ang = MoveQA[nHd];
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
nQHead++;
|
|
|
|
if (nQHead >= 25)
|
|
|
|
{
|
|
|
|
nQHead = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
QueenHead.field_C--;
|
|
|
|
if (QueenHead.field_C <= 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
QueenHead.field_C = 3;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:56:53 +00:00
|
|
|
if (QueenHead.field_E--)
|
2019-11-17 18:48:56 +00:00
|
|
|
{
|
|
|
|
if (QueenHead.field_E >= 15 || QueenHead.field_E < 10)
|
|
|
|
{
|
|
|
|
int x = sprite[nSprite].x;
|
|
|
|
int y = sprite[nSprite].y;
|
|
|
|
int z = sprite[nSprite].z;
|
|
|
|
short nSector = sprite[nSprite].sectnum;
|
|
|
|
int nAngle = RandomSize(11) & kAngleMask;
|
|
|
|
|
|
|
|
sprite[nSprite].xrepeat = 127 - QueenHead.field_E;
|
|
|
|
sprite[nSprite].yrepeat = 127 - QueenHead.field_E;
|
2019-11-20 16:21:32 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
sprite[nSprite].cstat = 0x8000;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
// DEMO-TODO: in disassembly angle was used without masking and thus causing OOB issue.
|
|
|
|
// This behavior probably would be needed emulated for demo compatibility
|
|
|
|
// int dx = sintable[nAngle + 512] << 10;
|
|
|
|
int dx = Cos(nAngle) << 10;
|
|
|
|
int dy = Sin(nAngle) << 10;
|
|
|
|
int dz = (RandomSize(5) - RandomSize(5)) << 7;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-12-02 16:34:59 +00:00
|
|
|
movesprite(nSprite, dx, dy, dz, 0, 0, CLIPMASK1);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
BlowChunks(nSprite);
|
|
|
|
BuildExplosion(nSprite);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
mychangespritesect(nSprite, nSector);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
sprite[nSprite].x = x;
|
|
|
|
sprite[nSprite].y = y;
|
|
|
|
sprite[nSprite].z = z;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (QueenHead.field_E < 10) {
|
|
|
|
for (int i = (10 - QueenHead.field_E) * 2; i > 0; i--)
|
|
|
|
{
|
|
|
|
BuildLavaLimb(nSprite, i, GetSpriteHeight(nSprite));
|
|
|
|
}
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
BuildExplosion(nSprite);
|
|
|
|
|
|
|
|
int i;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
for (i = 0; i < 10; i++)
|
|
|
|
{
|
|
|
|
BlowChunks(nSprite);
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
for (i = 0; i < 20; i++)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
BuildLavaLimb(nSprite, i, GetSpriteHeight(nSprite));
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
|
|
|
|
runlist_SubRunRec(sprite[nSprite].owner);
|
|
|
|
runlist_SubRunRec(QueenHead.field_8);
|
|
|
|
mydeletesprite(nSprite);
|
|
|
|
runlist_ChangeChannel(QueenChan[0], 1);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
case 0xA0000:
|
|
|
|
if (sprite[nRadialSpr].statnum != 121 && (sprite[nSprite].cstat & 0x101) != 0)
|
|
|
|
{
|
|
|
|
nDamage = runlist_CheckRadialDamage(nSprite);
|
|
|
|
if (!nDamage)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
// fall through to case 0x80000
|
|
|
|
fallthrough__;
|
|
|
|
|
|
|
|
case 0x80000:
|
|
|
|
if (QueenHead.nHealth > 0 && nDamage != 0)
|
|
|
|
{
|
|
|
|
QueenHead.nHealth -= nDamage;
|
|
|
|
|
|
|
|
if (!RandomSize(4))
|
|
|
|
{
|
|
|
|
QueenHead.nTarget = a & 0xFFFF;
|
|
|
|
QueenHead.nAction = 7;
|
|
|
|
QueenHead.field_2 = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (QueenHead.nHealth <= 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
if (DestroyTailPart())
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
QueenHead.nHealth = 200;
|
|
|
|
nHeadVel += 100;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
QueenHead.nAction = 5;
|
|
|
|
QueenHead.field_2 = 0;
|
|
|
|
QueenHead.field_C = 0;
|
|
|
|
QueenHead.field_E = 80;
|
|
|
|
sprite[nSprite].cstat = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
case 0x90000:
|
|
|
|
{
|
|
|
|
short nSeq = SeqOffsets[kSeqQueen];
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
int edx;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (nHead == 0)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
edx = HeadSeq[nAction].b;
|
|
|
|
nSeq += HeadSeq[nAction].a;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
else
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
edx = 1;
|
|
|
|
nSeq += 73;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
seq_PlotSequence(a & 0xFFFF, nSeq, QueenHead.field_2, edx);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
DebugOut("unknown msg %d for Queenhead\n", a & 0x7F0000);
|
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int BuildQueen(int nSprite, int x, int y, int z, int nSector, int nAngle, int nChannel)
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
QueenCount--;
|
|
|
|
|
|
|
|
short nQueen = QueenCount;
|
|
|
|
if (nQueen < 0) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nSprite == -1)
|
|
|
|
{
|
|
|
|
nSprite = insertsprite(nSector, 121);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
changespritestat(nSprite, 121);
|
2019-11-16 22:32:12 +00:00
|
|
|
x = sprite[nSprite].x;
|
|
|
|
y = sprite[nSprite].y;
|
|
|
|
z = sector[sprite[nSprite].sectnum].floorz;
|
2019-08-31 07:47:15 +00:00
|
|
|
nAngle = sprite[nSprite].ang;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(nSprite >= 0 && nSprite < kMaxSprites);
|
|
|
|
|
2019-11-16 22:32:12 +00:00
|
|
|
sprite[nSprite].x = x;
|
|
|
|
sprite[nSprite].y = y;
|
|
|
|
sprite[nSprite].z = z;
|
2019-08-31 07:47:15 +00:00
|
|
|
sprite[nSprite].cstat = 0x101;
|
|
|
|
sprite[nSprite].pal = 0;
|
|
|
|
sprite[nSprite].shade = -12;
|
|
|
|
sprite[nSprite].clipdist = 100;
|
|
|
|
sprite[nSprite].xrepeat = 80;
|
|
|
|
sprite[nSprite].yrepeat = 80;
|
|
|
|
sprite[nSprite].xoffset = 0;
|
|
|
|
sprite[nSprite].yoffset = 0;
|
|
|
|
sprite[nSprite].picnum = 1;
|
|
|
|
sprite[nSprite].ang = nAngle;
|
|
|
|
sprite[nSprite].xvel = 0;
|
2019-11-16 22:32:12 +00:00
|
|
|
sprite[nSprite].yvel = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
sprite[nSprite].zvel = 0;
|
|
|
|
sprite[nSprite].lotag = runlist_HeadRun() + 1;
|
|
|
|
sprite[nSprite].extra = -1;
|
|
|
|
sprite[nSprite].hitag = 0;
|
|
|
|
|
|
|
|
GrabTimeSlot(3);
|
|
|
|
|
|
|
|
QueenList[nQueen].nAction = 0;
|
2019-10-22 22:46:29 +00:00
|
|
|
QueenList[nQueen].nHealth = 4000;
|
2019-08-31 07:47:15 +00:00
|
|
|
QueenList[nQueen].field_2 = 0;
|
|
|
|
QueenList[nQueen].nSprite = nSprite;
|
|
|
|
QueenList[nQueen].nTarget = -1;
|
|
|
|
QueenList[nQueen].field_A = 0;
|
|
|
|
QueenList[nQueen].field_10 = 5;
|
|
|
|
QueenList[nQueen].field_C = 0;
|
|
|
|
|
|
|
|
QueenChan[nQueen] = nChannel;
|
|
|
|
|
|
|
|
nHeadVel = 800;
|
|
|
|
|
|
|
|
sprite[nSprite].owner = runlist_AddRunRec(sprite[nSprite].lotag - 1, nQueen | 0x1A0000);
|
|
|
|
|
|
|
|
runlist_AddRunRec(NewRun, nQueen | 0x1A0000);
|
|
|
|
|
|
|
|
nCreaturesLeft++;
|
|
|
|
|
|
|
|
return nQueen | 0x1A0000;
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SetQueenSpeed(short nSprite, int nSpeed)
|
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
sprite[nSprite].xvel = Cos(sprite[nSprite].ang) >> (2 - nSpeed);
|
2019-08-31 07:47:15 +00:00
|
|
|
sprite[nSprite].yvel = Sin(sprite[nSprite].ang) >> (2 - nSpeed);
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FuncQueen(int a, int nDamage, int nRun)
|
|
|
|
{
|
2019-08-31 07:47:15 +00:00
|
|
|
int var_18 = 0;
|
|
|
|
|
|
|
|
short nQueen = RunData[nRun].nVal;
|
|
|
|
assert(nQueen >= 0 && nQueen < kMaxQueens);
|
|
|
|
|
|
|
|
int nMessage = a & 0x7F0000;
|
|
|
|
|
|
|
|
short nSprite = QueenList[nQueen].nSprite;
|
|
|
|
short nAction = QueenList[nQueen].nAction;
|
|
|
|
short si = QueenList[nQueen].field_A;
|
|
|
|
short nTarget = QueenList[nQueen].nTarget;
|
|
|
|
|
|
|
|
switch (nMessage)
|
|
|
|
{
|
|
|
|
case 0x20000:
|
|
|
|
{
|
|
|
|
if (si < 3) {
|
|
|
|
Gravity(nSprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
short nSeq = SeqOffsets[kSeqQueen] + ActionSeq[nAction].a;
|
|
|
|
|
|
|
|
sprite[nSprite].picnum = seq_GetSeqPicnum2(nSeq, QueenList[nQueen].field_2);
|
|
|
|
|
|
|
|
seq_MoveSequence(nSprite, nSeq, QueenList[nQueen].field_2);
|
|
|
|
|
|
|
|
QueenList[nQueen].field_2++;
|
|
|
|
if (QueenList[nQueen].field_2 >= SeqSize[nSeq])
|
|
|
|
{
|
|
|
|
QueenList[nQueen].field_2 = 0;
|
|
|
|
var_18 = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
short nFlag = FrameFlag[SeqBase[nSeq] + QueenList[nQueen].field_2];
|
|
|
|
|
|
|
|
if (nTarget > -1)
|
|
|
|
{
|
|
|
|
if (nAction < 7)
|
|
|
|
{
|
|
|
|
if (!(sprite[nSprite].cstat & 0x101))
|
|
|
|
{
|
|
|
|
nTarget = -1;
|
|
|
|
QueenList[nQueen].nTarget = -1;
|
|
|
|
QueenList[nQueen].nAction = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
switch (nAction)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
if (nTarget < 0)
|
|
|
|
{
|
|
|
|
nTarget = FindPlayer(nSprite, 60);
|
|
|
|
}
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (nTarget >= 0)
|
|
|
|
{
|
|
|
|
QueenList[nQueen].nAction = QueenList[nQueen].field_A + 1;
|
|
|
|
QueenList[nQueen].field_2 = 0;
|
|
|
|
QueenList[nQueen].nTarget = nTarget;
|
|
|
|
QueenList[nQueen].field_C = RandomSize(7);
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
SetQueenSpeed(nSprite, si);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
case 6:
|
|
|
|
{
|
|
|
|
if (var_18)
|
|
|
|
{
|
|
|
|
BuildQueenEgg(nQueen, 1);
|
|
|
|
QueenList[nQueen].nAction = 3;
|
|
|
|
QueenList[nQueen].field_C = RandomSize(6) + 60;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
case 3:
|
|
|
|
{
|
|
|
|
QueenList[nQueen].field_C--;
|
|
|
|
|
|
|
|
if ((nQueen & 0x1F) == (totalmoves & 0x1F))
|
|
|
|
{
|
|
|
|
if (si < 2)
|
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
if (QueenList[nQueen].field_C <= 0)
|
|
|
|
{
|
|
|
|
QueenList[nQueen].field_2 = 0;
|
|
|
|
sprite[nSprite].xvel = 0;
|
|
|
|
sprite[nSprite].yvel = 0;
|
|
|
|
QueenList[nQueen].nAction = si + 4;
|
|
|
|
QueenList[nQueen].field_C = RandomSize(6) + 30;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
|
|
|
if (QueenList[nQueen].field_10 < 5)
|
|
|
|
{
|
|
|
|
QueenList[nQueen].field_10++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// then to PLOTSPRITE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (QueenList[nQueen].field_C <= 0)
|
|
|
|
{
|
|
|
|
if (nWaspCount < 100)
|
|
|
|
{
|
|
|
|
QueenList[nQueen].nAction = 6;
|
|
|
|
QueenList[nQueen].field_2 = 0;
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QueenList[nQueen].field_C = 30000;
|
|
|
|
// then to PLOTSPRITE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// loc_35B4B
|
|
|
|
PlotCourseToSprite(nSprite, nTarget);
|
|
|
|
SetQueenSpeed(nSprite, si);
|
|
|
|
}
|
|
|
|
|
|
|
|
int nMov = MoveCreatureWithCaution(nSprite);
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
switch (nMov & 0xC000)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
case 0xC000:
|
|
|
|
if ((si == 2) && ((nMov & 0x3FFF) == nTarget))
|
|
|
|
{
|
|
|
|
runlist_DamageEnemy(nTarget, nSprite, 5);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
fallthrough__;
|
|
|
|
case 0x8000:
|
2019-08-31 07:47:15 +00:00
|
|
|
sprite[nSprite].ang += 256;
|
|
|
|
sprite[nSprite].ang &= kAngleMask;
|
|
|
|
|
|
|
|
SetQueenSpeed(nSprite, si);
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// loc_35BD2
|
|
|
|
if (nAction && nTarget != -1)
|
|
|
|
{
|
|
|
|
if (!(sprite[nTarget].cstat & 0x101))
|
|
|
|
{
|
|
|
|
QueenList[nQueen].nAction = 0;
|
|
|
|
QueenList[nQueen].field_2 = 0;
|
|
|
|
QueenList[nQueen].field_C = 100;
|
|
|
|
QueenList[nQueen].nTarget = -1;
|
|
|
|
|
|
|
|
sprite[nSprite].xvel = 0;
|
|
|
|
sprite[nSprite].yvel = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
{
|
|
|
|
if (var_18 && QueenList[nQueen].field_10 <= 0)
|
|
|
|
{
|
|
|
|
QueenList[nQueen].nAction = 0;
|
|
|
|
QueenList[nQueen].field_C = 15;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (nFlag & 0x80)
|
|
|
|
{
|
|
|
|
QueenList[nQueen].field_10--;
|
|
|
|
|
|
|
|
PlotCourseToSprite(nSprite, nTarget);
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
if (!si)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
BuildBullet(nSprite, 12, 0, 0, -1, sprite[nSprite].ang, nTarget + 10000, 1);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
BuildQueenEgg(nQueen, 0);
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case 7:
|
|
|
|
{
|
|
|
|
if (var_18)
|
|
|
|
{
|
|
|
|
QueenList[nQueen].nAction = 0;
|
|
|
|
QueenList[nQueen].field_2 = 0;
|
|
|
|
}
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
case 9:
|
|
|
|
{
|
|
|
|
if (var_18)
|
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
if (nAction == 9)
|
2019-08-31 07:47:15 +00:00
|
|
|
{
|
2019-11-17 18:48:56 +00:00
|
|
|
QueenList[nQueen].field_C--;
|
|
|
|
if (QueenList[nQueen].field_C <= 0)
|
|
|
|
{
|
|
|
|
sprite[nSprite].cstat = 0;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
for (int i = 0; i < 20; i++)
|
|
|
|
{
|
|
|
|
short nChunkSprite = BuildCreatureChunk(nSprite, seq_GetSeqPicnum(kSeqQueen, 57, 0)) & 0xFFFF;
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
sprite[nChunkSprite].picnum = kTile3117 + (i % 3);
|
|
|
|
sprite[nChunkSprite].yrepeat = 100;
|
|
|
|
sprite[nChunkSprite].xrepeat = 100;
|
|
|
|
}
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
short nChunkSprite = BuildCreatureChunk(nSprite, seq_GetSeqPicnum(kSeqQueen, 57, 0));
|
|
|
|
|
|
|
|
sprite[nChunkSprite].picnum = kTile3126;
|
2019-08-31 07:47:15 +00:00
|
|
|
sprite[nChunkSprite].yrepeat = 100;
|
|
|
|
sprite[nChunkSprite].xrepeat = 100;
|
2019-11-17 18:48:56 +00:00
|
|
|
PlayFXAtXYZ(
|
|
|
|
StaticSound[kSound40],
|
|
|
|
sprite[nSprite].x,
|
|
|
|
sprite[nSprite].y,
|
|
|
|
sprite[nSprite].z,
|
|
|
|
sprite[nSprite].sectnum);
|
|
|
|
BuildQueenHead(nQueen);
|
|
|
|
|
|
|
|
QueenList[nQueen].nAction++;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
else
|
|
|
|
QueenList[nQueen].nAction++;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case 10:
|
|
|
|
{
|
|
|
|
sprite[nSprite].cstat &= 0xFEFE;
|
2019-11-17 18:48:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 0xA0000:
|
|
|
|
{
|
|
|
|
if (sprite[nRadialSpr].statnum != 121 && (sprite[nSprite].cstat & 0x101) != 0)
|
|
|
|
{
|
|
|
|
nDamage = runlist_CheckRadialDamage(nSprite);
|
|
|
|
|
|
|
|
if (!nDamage) {
|
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
2019-11-17 18:48:56 +00:00
|
|
|
else
|
|
|
|
break;
|
|
|
|
|
|
|
|
fallthrough__;
|
|
|
|
} // fall through to case 0x80000
|
|
|
|
|
|
|
|
case 0x80000:
|
|
|
|
{
|
|
|
|
if (QueenList[nQueen].nHealth > 0)
|
|
|
|
{
|
|
|
|
QueenList[nQueen].nHealth -= nDamage;
|
|
|
|
|
|
|
|
if (QueenList[nQueen].nHealth <= 0)
|
|
|
|
{
|
|
|
|
sprite[nSprite].xvel = 0;
|
|
|
|
sprite[nSprite].yvel = 0;
|
|
|
|
sprite[nSprite].zvel = 0;
|
|
|
|
|
|
|
|
QueenList[nQueen].field_A++;
|
|
|
|
|
|
|
|
switch (QueenList[nQueen].field_A)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
QueenList[nQueen].nHealth = 4000;
|
|
|
|
QueenList[nQueen].nAction = 7;
|
|
|
|
|
|
|
|
BuildAnim(-1, 36, 0, sprite[nSprite].x, sprite[nSprite].y, sprite[nSprite].z - 7680, sprite[nSprite].sectnum, sprite[nSprite].xrepeat, 4);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
QueenList[nQueen].nHealth = 4000;
|
|
|
|
QueenList[nQueen].nAction = 7;
|
|
|
|
|
|
|
|
DestroyAllEggs();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
QueenList[nQueen].nAction = 8;
|
|
|
|
QueenList[nQueen].nHealth = 0;
|
|
|
|
QueenList[nQueen].field_C = 5;
|
|
|
|
|
|
|
|
nCreaturesLeft--;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
QueenList[nQueen].field_2 = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (si > 0 && !RandomSize(4))
|
|
|
|
{
|
|
|
|
QueenList[nQueen].nAction = 7;
|
|
|
|
QueenList[nQueen].field_2 = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 0x90000:
|
|
|
|
{
|
|
|
|
seq_PlotSequence(a & 0xFFFF, SeqOffsets[kSeqQueen] + ActionSeq[nAction].a, QueenList[nQueen].field_2, ActionSeq[nAction].b);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
DebugOut("unknown msg %d for Queen\n", a & 0x7F0000);
|
|
|
|
break;
|
2019-08-31 07:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
2019-08-26 03:59:14 +00:00
|
|
|
}
|
2019-11-22 23:11:37 +00:00
|
|
|
END_PS_NS
|