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 NUVIE_CORE_PLAYER_H 24 #define NUVIE_CORE_PLAYER_H 25 26 #include "ultima/nuvie/core/obj_manager.h" 27 #include "ultima/nuvie/actors/actor.h" 28 29 namespace Ultima { 30 namespace Nuvie { 31 32 #define MOVE_COST_USE 5 33 34 class Configuration; 35 class GameClock; 36 class Actor; 37 class ActorManager; 38 class MapWindow; 39 class Party; 40 class NuvieIO; 41 42 class Player { 43 Configuration *config; 44 int game_type; 45 GameClock *clock; 46 Party *party; 47 bool party_mode; 48 bool mapwindow_centered; 49 Actor *actor; 50 ActorManager *actor_manager; 51 ObjManager *obj_manager; 52 53 // char name[14]; We can get the name from the player actor. --SB-X 54 uint8 gender; 55 56 uint8 questf; 57 uint8 karma; 58 uint8 gargishf; // learned Gargish 59 uint8 alcohol; // number of alcoholic drinks consumed 60 61 MapWindow *map_window; 62 63 sint8 current_weapon; 64 65 public: 66 67 Player(Configuration *cfg); 68 69 bool init(ObjManager *om, ActorManager *am, MapWindow *mw, GameClock *c, Party *p); 70 void init(); 71 bool load(NuvieIO *objlist); 72 bool save(NuvieIO *objlist); 73 74 Actor *find_actor(); 75 void update_player(Actor *next_player); 76 is_mapwindow_centered()77 bool is_mapwindow_centered() { 78 return (mapwindow_centered); 79 } 80 void set_mapwindow_centered(bool state); 81 is_in_vehicle()82 bool is_in_vehicle() { 83 return (get_actor()->get_actor_num() == 0); 84 } 85 get_party()86 Party *get_party() { 87 return (party); 88 } 89 bool set_party_mode(Actor *new_actor); 90 bool set_solo_mode(Actor *new_actor); in_party_mode()91 bool in_party_mode() { 92 return (party_mode); 93 } 94 set_karma(uint8 val)95 void set_karma(uint8 val) { 96 karma = val; 97 } get_karma()98 uint8 get_karma() { 99 return (karma); 100 } 101 void add_karma(uint8 val = 1); 102 void subtract_karma(uint8 val = 1); 103 void subtract_movement_points(uint8 points); 104 void add_alcohol(uint8 val = 1) { 105 alcohol = clamp_max(alcohol + val, 255); 106 } 107 void dec_alcohol(uint8 val = 1) { 108 if (alcohol > val) { 109 alcohol -= val; 110 } else { 111 alcohol = 0; 112 } 113 } 114 set_quest_flag(uint8 val)115 void set_quest_flag(uint8 val) { 116 questf = val; 117 } get_quest_flag()118 uint8 get_quest_flag() { 119 return (questf); 120 } set_gargish_flag(uint8 val)121 void set_gargish_flag(uint8 val) { 122 gargishf = val; 123 } get_gargish_flag()124 uint8 get_gargish_flag() { 125 return (gargishf); 126 } 127 128 void set_actor(Actor *new_actor); 129 Actor *get_actor(); 130 void get_location(uint16 *ret_x, uint16 *ret_y, uint8 *ret_level); 131 uint8 get_location_level(); 132 133 const char *get_name(); set_gender(uint8 val)134 void set_gender(uint8 val) { 135 gender = val; 136 } 137 const char *get_gender_title(); get_gender()138 uint8 get_gender() { 139 return (gender); 140 } 141 142 bool check_moveRelative(sint16 rel_x, sint16 rel_y); 143 void moveRelative(sint16 rel_x, sint16 rel_y, bool mouse_movement = false); 144 void try_open_door(uint16 x, uint16 y, uint8 z); 145 void move(sint16 new_x, sint16 new_y, uint8 new_level, bool teleport); 146 void moveLeft(); 147 void moveRight(); 148 void moveUp(); 149 void moveDown(); 150 void pass(); 151 void repairShip(); 152 153 uint32 get_walk_delay(); 154 bool check_walk_delay(); 155 156 bool weapon_can_hit(uint16 x, uint16 y); 157 void attack_select_init(bool use_attack_text = true); 158 bool attack_select_next_weapon(bool add_newline = false, bool use_attack_text = true); 159 160 void attack(MapCoord target, Actor *target_actor); get_current_weapon()161 sint8 get_current_weapon() { 162 return current_weapon; 163 } 164 165 protected: 166 167 bool attack_select_weapon_at_location(sint8 location, bool add_newline = false, bool use_attack_text = true); 168 }; 169 170 } // End of namespace Nuvie 171 } // End of namespace Ultima 172 173 #endif 174