2019-09-19 22:42:45 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 Nuke.YKT
|
|
|
|
Copyright (C) NoOne
|
|
|
|
|
|
|
|
This file is part of NBlood.
|
|
|
|
|
|
|
|
NBlood 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.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
#pragma once
|
2020-02-07 19:47:43 +00:00
|
|
|
#include "nnexts.h"
|
2019-09-19 22:42:45 +00:00
|
|
|
#include "ai.h"
|
|
|
|
#include "eventq.h"
|
|
|
|
|
2020-07-31 19:03:23 +00:00
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
BEGIN_BLD_NS
|
2020-07-31 19:03:23 +00:00
|
|
|
#ifdef NOONE_EXTENSIONS
|
2020-10-11 10:18:25 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
kGenDudeDefaultSeq = 11520,
|
|
|
|
kGenDudeMaxSlaves = 7,
|
|
|
|
kGenDudeTransformStatus = -222,
|
|
|
|
kGenDudeUpdTimeRate = 10,
|
|
|
|
kGenDudeMaxMeleeDist = 2048,
|
|
|
|
kGenDudeMinDispesion = 200,
|
|
|
|
kGenDudeMaxDispersion = 3500,
|
|
|
|
kGenDudeKlabsAng = 56
|
|
|
|
};
|
2019-11-24 20:53:51 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
kGenDudeSeqIdleL = 0,
|
|
|
|
kGenDudeSeqDeathDefault = 1,
|
|
|
|
kGenDudeSeqDeathExplode = 2,
|
|
|
|
kGenDudeSeqBurning = 3,
|
|
|
|
kGenDudeSeqElectocuted = 4,
|
|
|
|
kGenDudeSeqRecoil = 5,
|
|
|
|
kGenDudeSeqAttackNormalL = 6,
|
|
|
|
kGenDudeSeqAttackThrow = 7,
|
|
|
|
kGenDudeSeqAttackNormalDW = 8,
|
|
|
|
kGenDudeSeqMoveL = 9,
|
|
|
|
kGenDudeSeqAttackPunch = 10,
|
|
|
|
kGenDudeSeqReserved1 = 11,
|
|
|
|
kGenDudeSeqReserved2 = 12,
|
|
|
|
kGenDudeSeqMoveW = 13,
|
|
|
|
kGenDudeSeqMoveD = 14,
|
|
|
|
kGenDudeSeqDeathBurn1 = 15,
|
|
|
|
kGenDudeSeqDeathBurn2 = 16,
|
|
|
|
kGenDudeSeqIdleW = 17,
|
|
|
|
kGenDudeSeqTransform = 18,
|
|
|
|
kGenDudeSeqReserved3 = 19,
|
|
|
|
kGenDudeSeqReserved4 = 20,
|
|
|
|
kGenDudeSeqReserved5 = 21,
|
|
|
|
kGenDudeSeqReserved6 = 22,
|
|
|
|
kGenDudeSeqReserved7 = 23,
|
|
|
|
kGenDudeSeqReserved8 = 24,
|
|
|
|
kGenDudeSeqMax ,
|
|
|
|
};
|
2019-11-08 19:57:01 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
kGenDudeSndTargetSpot = 0,
|
|
|
|
kGenDudeSndGotHit = 1,
|
|
|
|
kGenDudeSndDeathNormal = 2,
|
|
|
|
kGenDudeSndBurning = 3,
|
|
|
|
kGenDudeSndDeathExplode = 4,
|
|
|
|
kGenDudeSndTargetDead = 5,
|
|
|
|
kGenDudeSndChasing = 6,
|
|
|
|
kGenDudeSndAttackNormal = 7,
|
|
|
|
kGenDudeSndAttackThrow = 8,
|
|
|
|
kGenDudeSndAttackMelee = 9,
|
|
|
|
kGenDudeSndTransforming = 10,
|
|
|
|
kGenDudeSndMax ,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
kGenDudePropertyAll = 0,
|
|
|
|
kGenDudePropertyWeapon = 1,
|
2019-11-24 20:53:51 +00:00
|
|
|
kGenDudePropertyDmgScale = 2,
|
2019-11-08 19:57:01 +00:00
|
|
|
kGenDudePropertyMass = 3,
|
|
|
|
kGenDudePropertyAttack = 4,
|
|
|
|
kGenDudePropertyStates = 5,
|
|
|
|
kGenDudePropertyLeech = 6,
|
|
|
|
kGenDudePropertySlaves = 7,
|
2019-11-24 20:53:51 +00:00
|
|
|
kGenDudePropertySpriteSize = 8,
|
|
|
|
kGenDudePropertyInitVals = 9,
|
2019-11-08 19:57:01 +00:00
|
|
|
kGenDudePropertyMax ,
|
|
|
|
};
|
2019-09-21 11:02:17 +00:00
|
|
|
|
2019-12-05 20:42:35 +00:00
|
|
|
enum {
|
|
|
|
kGenDudeWeaponNone = -1,
|
|
|
|
kGenDudeWeaponHitscan = 0,
|
|
|
|
kGenDudeWeaponMissile = 1,
|
|
|
|
kGenDudeWeaponThrow = 2,
|
|
|
|
kGenDudeWeaponSummon = 3,
|
|
|
|
kGenDudeWeaponKamikaze = 4,
|
|
|
|
kGenDudeWeaponMax ,
|
|
|
|
};
|
|
|
|
|
2019-11-24 20:53:51 +00:00
|
|
|
extern AISTATE genDudeIdleL;
|
|
|
|
extern AISTATE genDudeIdleW;
|
|
|
|
extern AISTATE genDudeSearchL;
|
|
|
|
extern AISTATE genDudeSearchW;
|
|
|
|
extern AISTATE genDudeGotoL;
|
|
|
|
extern AISTATE genDudeGotoW;
|
|
|
|
extern AISTATE genDudeDodgeL;
|
|
|
|
extern AISTATE genDudeDodgeD;
|
|
|
|
extern AISTATE genDudeDodgeW;
|
|
|
|
extern AISTATE genDudeDodgeShortL;
|
|
|
|
extern AISTATE genDudeDodgeShortD;
|
|
|
|
extern AISTATE genDudeDodgeShortW;
|
2019-12-05 20:42:35 +00:00
|
|
|
extern AISTATE genDudeDodgeShorterL;
|
|
|
|
extern AISTATE genDudeDodgeShorterD;
|
|
|
|
extern AISTATE genDudeDodgeShorterW;
|
2019-11-24 20:53:51 +00:00
|
|
|
extern AISTATE genDudeChaseL;
|
|
|
|
extern AISTATE genDudeChaseD;
|
|
|
|
extern AISTATE genDudeChaseW;
|
|
|
|
extern AISTATE genDudeFireL;
|
|
|
|
extern AISTATE genDudeFireD;
|
|
|
|
extern AISTATE genDudeFireW;
|
|
|
|
extern AISTATE genDudeRecoilL;
|
|
|
|
extern AISTATE genDudeRecoilD;
|
|
|
|
extern AISTATE genDudeRecoilW;
|
|
|
|
extern AISTATE genDudeThrow;
|
|
|
|
extern AISTATE genDudeThrow2;
|
|
|
|
extern AISTATE genDudePunch;
|
|
|
|
extern AISTATE genDudeRecoilTesla;
|
|
|
|
extern AISTATE genDudeSearchNoWalkL;
|
|
|
|
extern AISTATE genDudeSearchNoWalkW;
|
|
|
|
extern AISTATE genDudeChaseNoWalkL;
|
|
|
|
extern AISTATE genDudeChaseNoWalkD;
|
|
|
|
extern AISTATE genDudeChaseNoWalkW;
|
2020-02-11 23:22:11 +00:00
|
|
|
extern AISTATE genDudeSearchShortL;
|
|
|
|
extern AISTATE genDudeSearchShortW;
|
2019-09-21 11:02:17 +00:00
|
|
|
|
|
|
|
struct GENDUDESND
|
|
|
|
{
|
|
|
|
int defaultSndId;
|
|
|
|
int randomRange;
|
|
|
|
int sndIdOffset; // relative to data3
|
|
|
|
bool aiPlaySound; // false = sfxStart3DSound();
|
2019-11-24 20:53:51 +00:00
|
|
|
bool interruptable;
|
2019-09-21 11:02:17 +00:00
|
|
|
};
|
|
|
|
|
2020-02-11 23:22:11 +00:00
|
|
|
extern const GENDUDESND gCustomDudeSnd[];
|
2019-09-19 22:42:45 +00:00
|
|
|
|
2019-11-08 19:57:01 +00:00
|
|
|
// temporary, until normal DUDEEXTRA gets refactored
|
|
|
|
struct GENDUDEEXTRA {
|
2019-12-05 20:42:35 +00:00
|
|
|
unsigned short initVals[3]; // xrepeat, yrepeat, clipdist
|
|
|
|
unsigned short availDeaths[kDamageMax]; // list of seqs with deaths for each damage type
|
|
|
|
unsigned int moveSpeed;
|
2019-11-08 19:57:01 +00:00
|
|
|
unsigned int fireDist; // counts from sprite size
|
|
|
|
unsigned int throwDist; // counts from sprite size
|
|
|
|
unsigned short curWeapon; // data1 duplicate to avoid potential problems when changing data dynamically
|
2019-12-05 20:42:35 +00:00
|
|
|
unsigned short weaponType;
|
2019-11-08 19:57:01 +00:00
|
|
|
unsigned short baseDispersion;
|
2019-12-05 20:42:35 +00:00
|
|
|
unsigned short slaveCount; // how many dudes is summoned
|
2020-04-04 19:48:23 +00:00
|
|
|
//unsigned short incarnationsCount;
|
2019-11-08 19:57:01 +00:00
|
|
|
signed short nLifeLeech; // spritenum of dropped dude's leech
|
2019-12-05 20:42:35 +00:00
|
|
|
signed short slave[kGenDudeMaxSlaves]; // index of the ones dude is summon
|
2020-03-01 20:36:28 +00:00
|
|
|
signed short dmgControl[kDamageMax]; // depends of current weapon, drop armor item, sprite yrepeat and surface type
|
2019-11-08 19:57:01 +00:00
|
|
|
bool updReq[kGenDudePropertyMax]; // update requests
|
2019-11-24 20:53:51 +00:00
|
|
|
bool sndPlaying; // indicate if sound of AISTATE currently playing
|
2019-12-05 20:42:35 +00:00
|
|
|
bool forcePunch; // indicate if there is no fire trigger in punch state seq
|
2019-11-08 19:57:01 +00:00
|
|
|
bool isMelee;
|
2019-11-24 20:53:51 +00:00
|
|
|
bool canBurn; // can turn in Burning dude or not
|
|
|
|
bool canElectrocute;
|
|
|
|
bool canAttack;
|
|
|
|
bool canRecoil;
|
2019-11-08 19:57:01 +00:00
|
|
|
bool canWalk;
|
|
|
|
bool canDuck;
|
|
|
|
bool canSwim;
|
|
|
|
bool canFly;
|
|
|
|
};
|
|
|
|
|
2020-02-07 19:47:43 +00:00
|
|
|
extern GENDUDEEXTRA gGenDudeExtra[kMaxSprites];
|
2019-11-24 20:53:51 +00:00
|
|
|
|
2020-02-07 19:47:43 +00:00
|
|
|
GENDUDEEXTRA* genDudeExtra(spritetype* pGenDude);
|
2019-09-19 22:42:45 +00:00
|
|
|
XSPRITE* getNextIncarnation(XSPRITE* pXSprite);
|
|
|
|
void killDudeLeech(spritetype* pLeech);
|
|
|
|
void removeLeech(spritetype* pLeech, bool delSprite = true);
|
|
|
|
void removeDudeStuff(spritetype* pSprite);
|
|
|
|
spritetype* leechIsDropped(spritetype* pSprite);
|
2019-11-24 20:53:51 +00:00
|
|
|
bool spriteIsUnderwater(spritetype* pSprite, bool oldWay = false);
|
2019-12-05 20:42:35 +00:00
|
|
|
bool playGenDudeSound(spritetype* pSprite, int mode);
|
2019-09-19 22:42:45 +00:00
|
|
|
void aiGenDudeMoveForward(spritetype* pSprite, XSPRITE* pXSprite);
|
2019-11-08 19:57:01 +00:00
|
|
|
void aiGenDudeChooseDirection(spritetype* pSprite, XSPRITE* pXSprite, int a3, int aXvel = -1, int aYvel = -1);
|
2019-11-24 20:53:51 +00:00
|
|
|
void aiGenDudeNewState(spritetype* pSprite, AISTATE* pAIState);
|
2019-09-19 22:42:45 +00:00
|
|
|
int getGenDudeMoveSpeed(spritetype* pSprite, int which, bool mul, bool shift);
|
|
|
|
int checkAttackState(spritetype* pSprite, XSPRITE* pXSprite);
|
|
|
|
bool doExplosion(spritetype* pSprite, int nType);
|
2020-02-07 19:47:43 +00:00
|
|
|
spritetype* genDudeSpawn(spritetype* pSprite, int nDist);
|
|
|
|
void genDudeTransform(spritetype* pSprite);
|
2019-09-19 22:42:45 +00:00
|
|
|
void dudeLeechOperate(spritetype* pSprite, XSPRITE* pXSprite, EVENT a3);
|
|
|
|
int getDodgeChance(spritetype* pSprite);
|
|
|
|
int getRecoilChance(spritetype* pSprite);
|
|
|
|
bool dudeIsMelee(XSPRITE* pXSprite);
|
2019-09-21 11:02:17 +00:00
|
|
|
void updateTargetOfSlaves(spritetype* pSprite);
|
2019-11-08 19:57:01 +00:00
|
|
|
void updateTargetOfLeech(spritetype* pSprite);
|
2019-09-21 11:02:17 +00:00
|
|
|
bool canSwim(spritetype* pSprite);
|
|
|
|
bool canDuck(spritetype* pSprite);
|
2019-11-08 19:57:01 +00:00
|
|
|
bool canWalk(spritetype* pSprite);
|
2019-12-05 20:42:35 +00:00
|
|
|
short inDodge(AISTATE* aiState);
|
2019-09-21 11:02:17 +00:00
|
|
|
bool inIdle(AISTATE* aiState);
|
2019-11-24 20:53:51 +00:00
|
|
|
bool inAttack(AISTATE* aiState);
|
|
|
|
short inRecoil(AISTATE* aiState);
|
|
|
|
short inSearch(AISTATE* aiState);
|
2019-12-05 20:42:35 +00:00
|
|
|
short inChase(AISTATE* aiState);
|
2019-11-24 20:53:51 +00:00
|
|
|
short inDuck(AISTATE* aiState);
|
|
|
|
int genDudeSeqStartId(XSPRITE* pXSprite);
|
2020-05-05 18:50:14 +00:00
|
|
|
int getRangeAttackDist(spritetype* pSprite, int minDist = 3000, int maxDist = 80000);
|
2019-11-08 19:57:01 +00:00
|
|
|
int getDispersionModifier(spritetype* pSprite, int minDisp, int maxDisp);
|
|
|
|
void scaleDamage(XSPRITE* pXSprite);
|
2020-04-04 19:48:23 +00:00
|
|
|
bool genDudePrepare(spritetype* pSprite, int propId);
|
2019-11-08 19:57:01 +00:00
|
|
|
void genDudeUpdate(spritetype* pSprite);
|
2019-12-05 20:42:35 +00:00
|
|
|
bool genDudeAdjustSlope(spritetype* pSprite, XSPRITE* pXSprite, int dist, int weaponType, int by = 64);
|
2020-04-04 19:48:23 +00:00
|
|
|
void genDudePostDeath(spritetype* pSprite, DAMAGE_TYPE damageType, int damage);
|
|
|
|
void aiGenDudeInitSprite(spritetype* pSprite, XSPRITE* pXSprite);
|
2020-01-26 20:01:22 +00:00
|
|
|
#endif
|
|
|
|
END_BLD_NS
|