1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef ULTIMA4_GAME_PORTAL_H 24 #define ULTIMA4_GAME_PORTAL_H 25 26 #include "ultima/ultima4/game/context.h" 27 #include "ultima/ultima4/map/map.h" 28 29 namespace Ultima { 30 namespace Ultima4 { 31 32 class Map; 33 class Location; 34 struct Portal; 35 36 typedef enum { 37 ACTION_NONE = 0x0, 38 ACTION_ENTER = 0x1, 39 ACTION_KLIMB = 0x2, 40 ACTION_DESCEND = 0x4, 41 ACTION_EXIT_NORTH = 0x8, 42 ACTION_EXIT_EAST = 0x10, 43 ACTION_EXIT_SOUTH = 0x20, 44 ACTION_EXIT_WEST = 0x40 45 } PortalTriggerAction; 46 47 typedef bool (*PortalConditionsMet)(const Portal *p); 48 49 struct PortalDestination { 50 MapCoords _coords; 51 MapId _mapid; 52 }; 53 54 struct Portal { 55 MapCoords _coords; 56 MapId _destid; 57 MapCoords _start; 58 PortalTriggerAction _triggerAction; 59 PortalConditionsMet _portalConditionsMet; 60 PortalDestination *_retroActiveDest; 61 bool _saveLocation; 62 Common::String _message; 63 TransportContext _portalTransportRequisites; 64 bool _exitPortal; 65 int _tile; 66 }; 67 68 /** 69 * Creates a dungeon ladder portal based on the action given 70 */ 71 void createDngLadder(Location *location, PortalTriggerAction action, Portal *p); 72 73 /** 74 * Finds a portal at the given (x,y,z) coords that will work with the action given 75 * and uses it. If in a dungeon and trying to use a ladder, it creates a portal 76 * based on the ladder and uses it. 77 */ 78 int usePortalAt(Location *location, MapCoords coords, PortalTriggerAction action); 79 80 } // End of namespace Ultima4 81 } // End of namespace Ultima 82 83 #endif 84