2019-06-18 04:19:36 +05:30
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HDB_AI_H
|
|
|
|
#define HDB_AI_H
|
|
|
|
|
|
|
|
#include "common/system.h"
|
|
|
|
|
|
|
|
namespace HDB {
|
|
|
|
|
2019-06-19 01:14:06 +05:30
|
|
|
enum AIType {
|
|
|
|
AI_NONE,
|
|
|
|
AI_GUY,
|
|
|
|
AI_DOLLY,
|
|
|
|
AI_SPACEDUDE,
|
|
|
|
AI_SERGEANT,
|
|
|
|
AI_SCIENTIST,
|
|
|
|
AI_WORKER,
|
|
|
|
AI_DEADWORKER,
|
|
|
|
AI_ACCOUNTANT,
|
|
|
|
AI_RAILRIDER,
|
|
|
|
AI_RAILRIDER_ON,
|
|
|
|
AI_VORTEXIAN,
|
|
|
|
AI_CHICKEN,
|
|
|
|
AI_GEM_ATTACK,
|
|
|
|
AI_SLUG_ATTACK,
|
|
|
|
|
|
|
|
AI_LASER,
|
|
|
|
AI_LASERBEAM,
|
|
|
|
AI_DIVERTER,
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,
|
|
|
|
INFO_TELEPORTER11,
|
|
|
|
INFO_TELEPORTER12,
|
|
|
|
INFO_TELEPORTER13,
|
|
|
|
INFO_TELEPORTER14,
|
|
|
|
INFO_TELEPORTER15,
|
|
|
|
INFO_TELEPORTER16,
|
|
|
|
INFO_TELEPORTER17,
|
|
|
|
INFO_TELEPORTER18,
|
|
|
|
INFO_TELEPORTER19,
|
|
|
|
INFO_TELEPORTER20,
|
|
|
|
INFO_LEVELEXIT,
|
|
|
|
INFO_ACTION1,
|
|
|
|
INFO_ACTION2,
|
|
|
|
INFO_ACTION3,
|
|
|
|
INFO_ACTION4,
|
|
|
|
INFO_ACTION5,
|
|
|
|
INFO_ACTION6,
|
|
|
|
INFO_ACTION7,
|
|
|
|
INFO_ACTION8,
|
|
|
|
INFO_ACTION9,
|
|
|
|
INFO_ACTION10,
|
|
|
|
INFO_ACTION11,
|
|
|
|
INFO_ACTION12,
|
|
|
|
INFO_ACTION13,
|
|
|
|
INFO_ACTION14,
|
|
|
|
INFO_ACTION15,
|
|
|
|
INFO_ACTION16,
|
|
|
|
INFO_ACTION17,
|
|
|
|
INFO_ACTION18,
|
|
|
|
INFO_ACTION19,
|
|
|
|
INFO_ACTION20,
|
|
|
|
INFO_ACTION_AUTO,
|
|
|
|
|
|
|
|
INFO_QMARK,
|
|
|
|
INFO_DEBUG,
|
|
|
|
END_AI_TYPES
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
enum AIDir {
|
|
|
|
DIR_NONE,
|
|
|
|
DIR_UP,
|
|
|
|
DIR_DOWN,
|
|
|
|
DIR_LEFT,
|
|
|
|
DIR_RIGHT
|
|
|
|
};
|
|
|
|
|
|
|
|
enum AIState {
|
|
|
|
STATE_NONE,
|
|
|
|
STATE_STANDDOWN,
|
|
|
|
STATE_STANDUP,
|
|
|
|
STATE_STANDLEFT,
|
|
|
|
STATE_STANDRIGHT,
|
|
|
|
STATE_BLINK,
|
|
|
|
STATE_MOVEUP,
|
|
|
|
STATE_MOVEDOWN,
|
|
|
|
STATE_MOVELEFT,
|
|
|
|
STATE_MOVERIGHT,
|
|
|
|
STATE_DYING,
|
|
|
|
STATE_DEAD,
|
|
|
|
STATE_HORRIBLE1,
|
|
|
|
STATE_HORRIBLE2,
|
|
|
|
STATE_HORRIBLE3,
|
|
|
|
STATE_HORRIBLE4,
|
|
|
|
STATE_GOODJOB,
|
|
|
|
STATE_PLUMMET,
|
|
|
|
|
|
|
|
STATE_PUSHUP, // these are only used for the player
|
|
|
|
STATE_PUSHDOWN,
|
|
|
|
STATE_PUSHLEFT,
|
|
|
|
STATE_PUSHRIGHT,
|
|
|
|
STATE_GRABUP, // player grabbing something
|
|
|
|
STATE_GRABDOWN,
|
|
|
|
STATE_GRABLEFT,
|
|
|
|
STATE_GRABRIGHT,
|
|
|
|
STATE_ATK_CLUB_UP, // player attacking frames
|
|
|
|
STATE_ATK_CLUB_DOWN,
|
|
|
|
STATE_ATK_CLUB_LEFT,
|
|
|
|
STATE_ATK_CLUB_RIGHT,
|
|
|
|
STATE_ATK_STUN_DOWN,
|
|
|
|
STATE_ATK_STUN_UP,
|
|
|
|
STATE_ATK_STUN_LEFT,
|
|
|
|
STATE_ATK_STUN_RIGHT,
|
|
|
|
STATE_ATK_SLUG_DOWN,
|
|
|
|
STATE_ATK_SLUG_UP,
|
|
|
|
STATE_ATK_SLUG_LEFT,
|
|
|
|
STATE_ATK_SLUG_RIGHT,
|
|
|
|
|
|
|
|
STATE_FLOATING, // floating in stuff (can walk on)
|
|
|
|
STATE_FLOATDOWN,
|
|
|
|
STATE_FLOATUP,
|
|
|
|
STATE_FLOATLEFT,
|
|
|
|
STATE_FLOATRIGHT,
|
|
|
|
STATE_MELTED, // melted into slag (can walk on)
|
|
|
|
STATE_SLIDING, // sliding across a floor
|
|
|
|
STATE_SHOCKING, // for Shockbot floor-shock anim
|
|
|
|
STATE_EXPLODING, // boom barrel explosion!
|
|
|
|
|
|
|
|
STATE_USEDOWN, // crazy maintenance bot!
|
|
|
|
STATE_USEUP,
|
|
|
|
STATE_USELEFT,
|
|
|
|
STATE_USERIGHT,
|
|
|
|
|
|
|
|
STATE_MEER_MOVE, // for the Meerkat
|
|
|
|
STATE_MEER_APPEAR,
|
|
|
|
STATE_MEER_BITE,
|
|
|
|
STATE_MEER_DISAPPEAR,
|
|
|
|
STATE_MEER_LOOK,
|
|
|
|
|
|
|
|
STATE_ICEP_PEEK, // for the Icepuff
|
|
|
|
STATE_ICEP_APPEAR,
|
|
|
|
STATE_ICEP_THROWDOWN,
|
|
|
|
STATE_ICEP_THROWRIGHT,
|
|
|
|
STATE_ICEP_THROWLEFT,
|
|
|
|
STATE_ICEP_DISAPPEAR,
|
|
|
|
|
|
|
|
STATE_LICKDOWN, // for the Fatfrog
|
|
|
|
STATE_LICKLEFT,
|
|
|
|
STATE_LICKRIGHT,
|
|
|
|
|
|
|
|
STATE_DIVERTER_BL, // for Diverters
|
|
|
|
STATE_DIVERTER_BR,
|
|
|
|
STATE_DIVERTER_TL,
|
|
|
|
STATE_DIVERTER_TR,
|
|
|
|
|
|
|
|
STATE_KISSRIGHT, // for Dolly
|
|
|
|
STATE_KISSLEFT,
|
|
|
|
STATE_ANGRY,
|
|
|
|
STATE_PANIC,
|
|
|
|
STATE_LAUGH,
|
|
|
|
STATE_DOLLYUSERIGHT,
|
|
|
|
|
|
|
|
STATE_YELL, // for Sarge
|
|
|
|
|
|
|
|
STATE_ENDSTATES
|
|
|
|
};
|
|
|
|
|
2019-06-18 04:19:36 +05:30
|
|
|
enum CineType {
|
|
|
|
C_NO_COMMAND,
|
|
|
|
C_STOPCINE,
|
|
|
|
C_LOCKPLAYER,
|
|
|
|
C_UNLOCKPLAYER,
|
|
|
|
C_SETCAMERA,
|
|
|
|
C_MOVECAMERA,
|
|
|
|
C_WAIT,
|
|
|
|
C_WAITUNTILDONE,
|
|
|
|
C_MOVEENTITY,
|
|
|
|
C_DIALOG,
|
|
|
|
C_ANIMENTITY,
|
|
|
|
C_RESETCAMERA,
|
|
|
|
C_SETENTITY,
|
|
|
|
C_STARTMAP,
|
|
|
|
C_MOVEPIC,
|
|
|
|
C_MOVEMASKEDPIC,
|
|
|
|
C_DRAWPIC,
|
|
|
|
C_DRAWMASKEDPIC,
|
|
|
|
C_FADEIN,
|
|
|
|
C_FADEOUT,
|
|
|
|
C_SPAWNENTITY,
|
|
|
|
C_PLAYSOUND,
|
|
|
|
C_CLEAR_FG,
|
|
|
|
C_SET_FG,
|
|
|
|
C_SET_BG,
|
|
|
|
C_FUNCTION,
|
|
|
|
C_ENTITYFACE,
|
|
|
|
C_USEENTITY,
|
|
|
|
C_REMOVEENTITY,
|
|
|
|
C_SETANIMFRAME,
|
|
|
|
C_TEXTOUT,
|
|
|
|
C_CENTERTEXTOUT,
|
|
|
|
C_PLAYVOICE,
|
|
|
|
|
|
|
|
C_ENDLIST
|
|
|
|
};
|
|
|
|
|
2019-06-19 01:14:54 +05:30
|
|
|
struct AIEntity {
|
|
|
|
AIType type;
|
|
|
|
AIState state;
|
|
|
|
AIDir dir;
|
|
|
|
|
|
|
|
void *draw; // Current frame to draw
|
|
|
|
|
|
|
|
void (*aiInit)(AIEntity *e); // func ptr to init routine
|
|
|
|
void (*aiInit2)(AIEntity *e); // func ptr to init2 routine - graphic init only (this for LoadGame functionality)
|
|
|
|
void (*aiAction)(AIEntity *e); // func ptr to action routine
|
|
|
|
void (*aiUse)(AIEntity *e); // func ptr to use routine
|
|
|
|
void (*aiDraw)(AIEntity *e, int x, int y); // func ptr to extra drawing routine (only for special stuff) - pass in mapx, mapy
|
|
|
|
|
|
|
|
char luaFuncInit[32]; // Lua function for Init (always called after entity's init). These are ptrs into the map header.
|
|
|
|
char luaFuncAction[32]; // Lua function for Action
|
|
|
|
char luaFuncUse[32]; // Lua function for Use
|
|
|
|
uint16 level; // which floor level we're on
|
|
|
|
uint16 value1, value2; // extra values we might need
|
|
|
|
AIDir dir2; // this is from TED
|
|
|
|
|
|
|
|
uint16 x, y;
|
|
|
|
uint16 drawXOff, drawYOoff; // might need a drawing offset
|
|
|
|
uint16 onScreen; // FLAG: is this entity onscreen?
|
|
|
|
uint16 moveSpeed; // movement speed of this entity
|
|
|
|
uint16 xVel, yVel; // movement values
|
|
|
|
uint16 tileX, tileY;
|
|
|
|
uint16 goalX, goalY; // where we're trying to go - TILE COORDS
|
|
|
|
uint16 touchpX, touchpY, touchpTile, touchpWait; // ACTION index a touchplate is using, which you're on
|
|
|
|
uint32 stunnedWait; // if we're stunned, this is the delay before being normal again
|
|
|
|
uint16 sequence; // to use for specially-coded sequences
|
|
|
|
char entityName[32]; // the name of the entity, as registered by the Lua init function for the entity
|
|
|
|
char printedName[32]; // the name of the entity/item, the way it should be printed
|
|
|
|
|
|
|
|
uint16 animFrame; // which frame we're on
|
|
|
|
uint16 animDelay; // changes every frame; based on anim_cycle at start
|
|
|
|
uint16 animCycle; // delay between frame animations
|
|
|
|
|
|
|
|
// TODO: Add the frame arrays needed
|
|
|
|
};
|
|
|
|
|
2019-06-18 04:19:36 +05:30
|
|
|
struct CineCommand {
|
|
|
|
CineType cmdType;
|
|
|
|
double x, y;
|
|
|
|
double x2, y2;
|
|
|
|
double xv, yv;
|
|
|
|
int start, end;
|
|
|
|
uint32 delay;
|
|
|
|
int speed;
|
|
|
|
char *title;
|
2019-06-19 01:14:54 +05:30
|
|
|
const char *string;
|
2019-06-18 04:19:36 +05:30
|
|
|
char *id;
|
2019-06-19 01:14:54 +05:30
|
|
|
AIEntity *e;
|
2019-06-18 18:53:49 +02:00
|
|
|
|
|
|
|
CineCommand() : cmdType(C_NO_COMMAND), x(0.0), y(0.0), x2(0.0), y2(0.0), xv(0.0), yv(0.0),
|
2019-06-19 01:14:54 +05:30
|
|
|
start(0), end(0), delay(0), speed(0), title(NULL), string(NULL), id(NULL), e(NULL) {}
|
2019-06-18 04:19:36 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
class AI {
|
|
|
|
public:
|
2019-06-18 06:02:04 +05:30
|
|
|
bool init();
|
|
|
|
|
2019-06-18 04:19:36 +05:30
|
|
|
// Cinematic Functions
|
2019-06-18 04:52:29 +05:30
|
|
|
void processCines();
|
2019-06-18 20:40:47 +05:30
|
|
|
void cineStart(bool abortable, const char *abortFunc);
|
2019-06-18 04:19:36 +05:30
|
|
|
void cineSetCamera(int x, int y);
|
|
|
|
void cineResetCamera();
|
|
|
|
void cineMoveCamera(int x, int y, int speed);
|
2019-06-18 04:56:16 +05:30
|
|
|
void cineWait(int seconds);
|
|
|
|
void cineWaitUntilDone();
|
2019-06-18 16:43:12 +05:30
|
|
|
void cineFadeIn(bool isBlack, int steps);
|
|
|
|
void cineFadeOut(bool isBlack, int steps);
|
2019-06-18 04:19:36 +05:30
|
|
|
|
2019-06-18 22:07:30 +05:30
|
|
|
Common::Array<CineCommand *> _cine;
|
2019-06-18 04:19:36 +05:30
|
|
|
|
|
|
|
private:
|
|
|
|
// Cinematics Variables
|
|
|
|
bool _cineAbortable;
|
2019-06-18 04:26:31 +05:30
|
|
|
bool _cineAborted;
|
2019-06-18 20:40:47 +05:30
|
|
|
const char *_cineAbortFunc;
|
2019-06-18 04:19:36 +05:30
|
|
|
bool _cineActive;
|
|
|
|
bool _playerLock;
|
|
|
|
bool _cameraLock;
|
|
|
|
double _cameraX, _cameraY;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // End of Namespace
|
|
|
|
|
|
|
|
#endif // !HDB_AI_H
|