From 6acdc9670add32049cad8142b54d00556c2b4414 Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Tue, 18 Jun 2019 04:19:36 +0530 Subject: HDB: Add the AI class The Cinematic variables are defined. cineSetCamera, cineMoveCamera and cineResetCamera are defined. cineStart is stubbed out --- engines/hdb/ai.cpp | 62 +++++++++++++++++++++++++++++ engines/hdb/ai.h | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++ engines/hdb/hdb.h | 1 + engines/hdb/module.mk | 1 + 4 files changed, 172 insertions(+) create mode 100644 engines/hdb/ai.cpp create mode 100644 engines/hdb/ai.h diff --git a/engines/hdb/ai.cpp b/engines/hdb/ai.cpp new file mode 100644 index 0000000000..358631d53e --- /dev/null +++ b/engines/hdb/ai.cpp @@ -0,0 +1,62 @@ +/* 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. + * + */ + +#include "hdb/hdb.h" + +namespace HDB { + +AI::AI() { + _cine = new Common::Array; +} + +AI::~AI() { + delete _cine; +} + +void AI::cineStart(bool abortable, char *abortFunc) { + warning("STUB: AI::cineStart"); +} + +void AI::cineSetCamera(int x, int y) { + CineCommand *cmd = new CineCommand; + cmd->x = x * kTileWidth; + cmd->y = y * kTileHeight; + cmd->cmdType = C_SETCAMERA; + _cine->push_back(cmd); +} + +void AI::cineResetCamera() { + CineCommand *cmd = new CineCommand; + cmd->cmdType = C_RESETCAMERA; + _cine->push_back(cmd); +} + +void AI::cineMoveCamera(int x, int y, int speed) { + CineCommand *cmd = new CineCommand; + cmd->start = 0; + cmd->x = x * kTileWidth; + cmd->y = y * kTileHeight; + cmd->cmdType = C_MOVECAMERA; + _cine->push_back(cmd); +} + +} // End of Namespace diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h new file mode 100644 index 0000000000..d5aa926573 --- /dev/null +++ b/engines/hdb/ai.h @@ -0,0 +1,108 @@ +/* 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 { + +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 +}; + +struct CineCommand { + CineType cmdType; + double x, y; + double x2, y2; + double xv, yv; + int start, end; + uint32 delay; + int speed; + char *title; + char *string; + char *id; + // AIEntity *entity +}; + +class AI { +public: + + AI(); + ~AI(); + + // Cinematic Functions + void cineStart(bool abortable, char *abortFunc); + void cineSetCamera(int x, int y); + void cineResetCamera(); + void cineMoveCamera(int x, int y, int speed); + + Common::Array *_cine; + +private: + // Cinematics Variables + bool _cineAbortable; + bool _cineActive; + bool _playerLock; + bool _cameraLock; + double _cameraX, _cameraY; + +}; + +} // End of Namespace + +#endif // !HDB_AI_H diff --git a/engines/hdb/hdb.h b/engines/hdb/hdb.h index fdb4887563..613a1cdf39 100644 --- a/engines/hdb/hdb.h +++ b/engines/hdb/hdb.h @@ -41,6 +41,7 @@ #include "hdb/draw-manager.h" #include "hdb/lua-script.h" #include "hdb/map-loader.h" +#include "hdb/ai.h" #define MAX_SNDCACHE_MEM 0x400000 // 4Mb of sounds in memory #define MAX_TILES_CACHED 3500 // Max no of tiles in memory at once diff --git a/engines/hdb/module.mk b/engines/hdb/module.mk index ca2af8a10e..24bd20238d 100644 --- a/engines/hdb/module.mk +++ b/engines/hdb/module.mk @@ -7,6 +7,7 @@ MODULE_OBJS := \ hdb.o \ lua-script.o \ map-loader.o \ + ai.o \ console.o MODULE_DIRS += \ -- cgit v1.2.3