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_GAME_H 24 #define ULTIMA4_GAME_GAME_H 25 26 #include "ultima/ultima4/events/event_handler.h" 27 #include "ultima/ultima4/controllers/game_controller.h" 28 #include "ultima/ultima4/core/observer.h" 29 #include "ultima/ultima4/core/types.h" 30 #include "ultima/ultima4/map/map.h" 31 #include "ultima/ultima4/views/tileview.h" 32 #include "ultima/ultima4/sound/sound.h" 33 34 namespace Ultima { 35 namespace Ultima4 { 36 37 class Map; 38 struct Portal; 39 class Creature; 40 class Location; 41 class MoveEvent; 42 class Party; 43 class PartyEvent; 44 class PartyMember; 45 46 typedef enum { 47 VIEW_NORMAL, 48 VIEW_GEM, 49 VIEW_RUNE, 50 VIEW_DUNGEON, 51 VIEW_DEAD, 52 VIEW_CODEX, 53 VIEW_MIXTURES 54 } ViewMode; 55 56 /* map and screen functions */ 57 58 /** 59 * Sets the view mode. 60 */ 61 void gameSetViewMode(ViewMode newMode); 62 void gameUpdateScreen(); 63 64 /* spell functions */ 65 void gameSpellEffect(int spell, int player, Sound sound); 66 67 /* action functions */ 68 /** 69 * Peers at a city from A-P (Lycaeum telescope) and functions like a gem 70 */ 71 bool gamePeerCity(int city, void *data); 72 73 /** 74 * Peers at a gem 75 */ 76 void peer(bool useGem = true); 77 bool fireAt(const Coords &coords, bool originAvatar); 78 Direction gameGetDirection(); 79 uint32 gameTimeSinceLastCommand(); 80 81 /* checking functions */ 82 /** 83 * Checks the hull integrity of the ship and handles 84 * the ship sinking, if necessary 85 */ 86 void gameCheckHullIntegrity(); 87 88 /* creature functions */ 89 /** 90 * Performs a ranged attack for the creature at x,y on the world map 91 */ 92 bool creatureRangeAttack(const Coords &coords, Creature *m); 93 void gameCreatureCleanup(); 94 95 /** 96 * Spawns a creature (m) just offscreen of the avatar. 97 * If (m==nullptr) then it finds its own creature to spawn and spawns it. 98 */ 99 bool gameSpawnCreature(const class Creature *m); 100 101 /** 102 * Fixes objects initially loaded by saveGameMonstersRead, 103 * and alters movement behavior accordingly to match the creature 104 */ 105 void gameFixupObjects(Map *map); 106 107 /** 108 * Destroys all creatures on the current map. 109 */ 110 void gameDestroyAllCreatures(); 111 112 /** 113 * Handles what happens when a creature attacks you 114 */ 115 void gameCreatureAttack(Creature *obj); 116 117 /* etc */ 118 Common::String gameGetInput(int maxlen = 32); 119 int gameGetPlayer(bool canBeDisabled, bool canBeActivePlayer); 120 void gameGetPlayerForCommand(bool (*commandFn)(int player), bool canBeDisabled, bool canBeActivePlayer); 121 122 /** 123 * Deals an amount of damage between 'minDamage' and 'maxDamage' 124 * to each party member, with a 50% chance for each member to 125 * avoid the damage. If (minDamage == -1) or (minDamage >= maxDamage), 126 * deals 'maxDamage' damage to each member. 127 */ 128 void gameDamageParty(int minDamage, int maxDamage); 129 130 /** 131 * Deals an amount of damage between 'minDamage' and 'maxDamage' 132 * to the ship. If (minDamage == -1) or (minDamage >= maxDamage), 133 * deals 'maxDamage' damage to the ship. 134 */ 135 void gameDamageShip(int minDamage, int maxDamage); 136 137 /** 138 * Sets (or unsets) the active player 139 */ 140 void gameSetActivePlayer(int player); 141 142 /** 143 * Gets the path of coordinates for an action. Each tile in the 144 * direction specified by dirmask, between the minimum and maximum 145 * distances given, is included in the path, until blockedPredicate 146 * fails. If a tile is blocked, that tile is included in the path 147 * only if includeBlocked is true. 148 */ 149 Std::vector<Coords> gameGetDirectionalActionPath(int dirmask, int validDirections, const Coords &origin, int minDistance, int maxDistance, bool (*blockedPredicate)(const Tile *tile), bool includeBlocked); 150 151 } // End of namespace Ultima4 152 } // End of namespace Ultima 153 154 #endif 155