mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-25 12:05:53 +00:00
195 lines
6.6 KiB
C++
195 lines
6.6 KiB
C++
/* 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 AI::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 {
|
|
|
|
bool AI::isClosedDoor(int x, int y) {
|
|
int tileIndex = g_hdb->_map->getMapBGTileIndex(x, y);
|
|
|
|
if ((tileIndex == _targetDoorN + 3) || // locked SILVER door?
|
|
(tileIndex == _targetDoorNv + 3) ||
|
|
(tileIndex == _targetDoorP + 3) || // locked BLUE door?
|
|
(tileIndex == _targetDoorPv + 3) ||
|
|
(tileIndex == _targetDoorS + 3) || // locked RED door?
|
|
(tileIndex == _targetDoorSv + 3) ||
|
|
(tileIndex == _targetDoor2N + 3) || // locked SILVER door?
|
|
(tileIndex == _targetDoor2Nv + 3) ||
|
|
(tileIndex == _targetDoor2P + 3) || // locked BLUE door?
|
|
(tileIndex == _targetDoor2Pv + 3) ||
|
|
(tileIndex == _targetDoor2S + 3) || // locked RED door?
|
|
(tileIndex == _targetDoor2Sv + 3) ||
|
|
(tileIndex == _target2DoorN + 3) || // locked SILVER door?
|
|
(tileIndex == _target2DoorNv + 3) ||
|
|
(tileIndex == _target2DoorP + 3) || // locked BLUE door?
|
|
(tileIndex == _target2DoorPv + 3) ||
|
|
(tileIndex == _target2DoorS + 3) || // locked RED door?
|
|
(tileIndex == _target2DoorSv + 3) ||
|
|
(tileIndex == _target3DoorN + 3) || // locked SILVER door?
|
|
(tileIndex == _target3DoorNv + 3) ||
|
|
(tileIndex == _target3DoorP + 3) || // locked BLUE door?
|
|
(tileIndex == _target3DoorPv + 3) ||
|
|
(tileIndex == _target3DoorS + 3) || // locked RED door?
|
|
(tileIndex == _target3DoorSv + 3) ||
|
|
(tileIndex == _blockpole + 3)) // blockpole UP?
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
bool AI::isOpenDoor(int x, int y) {
|
|
int tileIndex = g_hdb->_map->getMapBGTileIndex(x, y);
|
|
|
|
if ((tileIndex == _targetDoorN) || // open SILVER door?
|
|
(tileIndex == _targetDoorNv) ||
|
|
(tileIndex == _targetDoorP) || // open BLUE door?
|
|
(tileIndex == _targetDoorPv) ||
|
|
(tileIndex == _targetDoorS) || // open RED door?
|
|
(tileIndex == _targetDoorSv) ||
|
|
(tileIndex == _targetDoor2N) || // open SILVER door?
|
|
(tileIndex == _targetDoor2Nv) ||
|
|
(tileIndex == _targetDoor2P) || // open BLUE door?
|
|
(tileIndex == _targetDoor2Pv) ||
|
|
(tileIndex == _targetDoor2S) || // open RED door?
|
|
(tileIndex == _targetDoor2Sv) ||
|
|
(tileIndex == _target2DoorN) || // open SILVER door?
|
|
(tileIndex == _target2DoorNv) ||
|
|
(tileIndex == _target2DoorP) || // open BLUE door?
|
|
(tileIndex == _target2DoorPv) ||
|
|
(tileIndex == _target2DoorS) || // open RED door?
|
|
(tileIndex == _target2DoorSv) ||
|
|
(tileIndex == _target3DoorN) || // open SILVER door?
|
|
(tileIndex == _target3DoorNv) ||
|
|
(tileIndex == _target3DoorP) || // open BLUE door?
|
|
(tileIndex == _target3DoorPv) ||
|
|
(tileIndex == _target3DoorS) || // open RED door?
|
|
(tileIndex == _target3DoorSv) ||
|
|
(tileIndex == _blockpole)) // blockpole DOWN?
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
// Black Door Switch
|
|
bool AI::useSwitch(AIEntity *e, int x, int y, int targetX, int targetY, int onTile) {
|
|
warning("STUB: Define useSwitch");
|
|
return false;
|
|
}
|
|
|
|
bool AI::useSwitchOn(AIEntity *e, int x, int y, int targetX, int targetY, int offTile) {
|
|
warning("STUB: Define useSwitchOn");
|
|
return false;
|
|
}
|
|
|
|
bool AI::useSwitch2(AIEntity *e, int x, int y, int targetX, int targetY) {
|
|
warning("STUB: Define useSwitch2");
|
|
return false;
|
|
}
|
|
|
|
// Colored Keycard Switch
|
|
bool AI::useLockedSwitch(AIEntity *e, int x, int y, int targetX, int targetY, int onTile, AIType item, const char *keyerror) {
|
|
warning("STUB: Define useLockedSwitch");
|
|
return false;
|
|
}
|
|
|
|
bool AI::useLockedSwitchOn(AIEntity *e, int x, int y, int targetX, int targetY, int offTile, AIType item) {
|
|
warning("STUB: Define useLockedSwitchOn");
|
|
return false;
|
|
}
|
|
|
|
// Purple Cell Holder Switch
|
|
bool AI::useCellHolder(AIEntity *e, int x, int y, int targetX, int targetY) {
|
|
warning("STUB: Define useCellHolder");
|
|
return false;
|
|
}
|
|
|
|
// Touchplate
|
|
bool AI::useTouchplate(AIEntity *e, int x, int y, int targetX, int targetY, int type) {
|
|
warning("STUB: Define useTouchplate");
|
|
return false;
|
|
}
|
|
bool AI::useTouchplateOn(AIEntity *e, int x, int y, int targetX, int targetY, int type) {
|
|
warning("STUB: Define useTouchplateOn");
|
|
return false;
|
|
}
|
|
|
|
void callbackDoorOpenClose(int x, int y) {
|
|
int tileIndex = g_hdb->_map->getMapBGTileIndex(x, y);
|
|
|
|
// is the door gonna close on something? if so, wait again
|
|
if (!g_hdb->_ai->findEntity(x, y)) {
|
|
g_hdb->_ai->addCallback(CALLBACK_DOOR_OPEN_CLOSE, x, y, kDelay5Seconds);
|
|
return;
|
|
}
|
|
|
|
g_hdb->_ai->addAnimateTarget(x, y, tileIndex, tileIndex + 3, ANIM_SLOW, false, true, NULL);
|
|
if (g_hdb->_map->onScreen(x, y))
|
|
g_hdb->_sound->playSound(SND_DOOR_OPEN_CLOSE);
|
|
return;
|
|
}
|
|
|
|
// Normal Door
|
|
bool AI::useDoorOpenClose(AIEntity *e, int x, int y) {
|
|
int tileIndex = g_hdb->_map->getMapBGTileIndex(x, y);
|
|
|
|
addAnimateTarget(x, y, tileIndex, tileIndex - 3, ANIM_SLOW, false, true, NULL);
|
|
addCallback(CALLBACK_DOOR_OPEN_CLOSE, x, y, kDelay5Seconds);
|
|
if (g_hdb->_map->onScreen(x, y))
|
|
g_hdb->_sound->playSound(SND_DOOR_OPEN_CLOSE);
|
|
return true;
|
|
}
|
|
|
|
void callbackAutoDoorOpenClose(int x, int y) {
|
|
int tileIndex = g_hdb->_map->getMapBGTileIndex(x, y);
|
|
|
|
// Is the door going to close on something?
|
|
if (g_hdb->_ai->findEntity(x, y)) {
|
|
g_hdb->_ai->addCallback(CALLBACK_AUTODOOR_OPEN_CLOSE, x, y, kDelay5Seconds);
|
|
return;
|
|
}
|
|
|
|
g_hdb->_ai->addAnimateTarget(x, y, tileIndex, tileIndex + 3, ANIM_SLOW, true, true, NULL);
|
|
if (g_hdb->_map->onScreen(x, y))
|
|
g_hdb->_sound->playSound(SND_DOOR_OPEN_CLOSE);
|
|
return;
|
|
}
|
|
|
|
bool AI::useAutoDoorOpenClose(AIEntity *e, int x, int y) {
|
|
int tileIndex = g_hdb->_map->getMapBGTileIndex(x, y);
|
|
|
|
if (autoActive(x, y))
|
|
return false;
|
|
|
|
addAnimateTarget(x, y, tileIndex, tileIndex - 3, ANIM_SLOW, false, true, NULL);
|
|
addCallback(CALLBACK_AUTODOOR_OPEN_CLOSE, x, y, kDelay5Seconds);
|
|
if (g_hdb->_map->onScreen(x, y))
|
|
g_hdb->_sound->playSound(SND_DOOR_OPEN_CLOSE);
|
|
return false;
|
|
}
|
|
|
|
// Any Type Door
|
|
bool AI::useDoorOpenCloseBot(AIEntity *e, int x, int y) {
|
|
warning("STUB: Define useDoorOpenCloseBot");
|
|
return false;
|
|
}
|
|
|
|
} // End of Namespace
|