forked from nuvie/nuvie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.h
135 lines (108 loc) · 3.83 KB
/
Player.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#ifndef __Player_h__
#define __Player_h__
/*
* player.h
* Nuvie
*
* Created by Eric Fry on Sun Mar 23 2003.
* Copyright (c) 2003. All rights reserved.
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include "ObjManager.h"
#include "Actor.h"
#define MOVE_COST_USE 5
class Configuration;
class GameClock;
class Actor;
class ActorManager;
class MapWindow;
class Party;
class NuvieIO;
class Player
{
Configuration *config;
int game_type;
GameClock *clock;
Party *party;
bool party_mode;
bool mapwindow_centered;
Actor *actor;
ActorManager *actor_manager;
ObjManager *obj_manager;
// char name[14]; We can get the name from the player actor. --SB-X
uint8 gender;
uint8 questf;
uint8 karma;
uint8 gargishf; // learned Gargish
uint8 alcohol; // number of alcoholic drinks consumed
MapWindow *map_window;
sint8 current_weapon;
public:
Player(Configuration *cfg);
bool init(ObjManager *om, ActorManager *am, MapWindow *mw, GameClock *c, Party *p);
void init();
bool load(NuvieIO *objlist);
bool save(NuvieIO *objlist);
Actor *find_actor();
void update_player(Actor *next_player);
bool is_mapwindow_centered() { return(mapwindow_centered); }
void set_mapwindow_centered(bool state);
bool is_in_vehicle() { return (get_actor()->get_actor_num() == 0); }
Party *get_party() { return(party); }
bool set_party_mode(Actor *new_actor);
bool set_solo_mode(Actor *new_actor);
bool in_party_mode() { return(party_mode); }
void set_karma(uint8 val) { karma = val; }
uint8 get_karma() { return(karma); }
void add_karma(uint8 val = 1);
void subtract_karma(uint8 val = 1);
void subtract_movement_points(uint8 points);
void add_alcohol(uint8 val = 1) { alcohol = clamp_max(alcohol+val, 255); }
void dec_alcohol(uint8 val = 1) { if(alcohol > val) { alcohol -= val; } else { alcohol = 0; } }
void set_quest_flag(uint8 val) { questf = val; }
uint8 get_quest_flag() { return(questf); }
void set_gargish_flag(uint8 val) { gargishf = val; }
uint8 get_gargish_flag() { return(gargishf); }
void set_actor(Actor *new_actor);
Actor *get_actor();
void get_location(uint16 *ret_x, uint16 *ret_y, uint8 *ret_level);
uint8 get_location_level();
const char *get_name();
void set_gender(uint8 val) { gender = val; }
const char *get_gender_title();
uint8 get_gender() { return(gender); }
bool check_moveRelative(sint16 rel_x, sint16 rel_y);
void moveRelative(sint16 rel_x, sint16 rel_y, bool mouse_movement = false);
void try_open_door(uint16 x, uint16 y, uint8 z);
void move(sint16 new_x, sint16 new_y, uint8 new_level, bool teleport);
void moveLeft();
void moveRight();
void moveUp();
void moveDown();
void pass();
void repairShip();
uint32 get_walk_delay();
bool check_walk_delay();
bool weapon_can_hit(uint16 x, uint16 y);
void attack_select_init(bool use_attack_text = true);
bool attack_select_next_weapon(bool add_newline = false, bool use_attack_text = true);
void attack(MapCoord target, Actor *target_actor);
sint8 get_current_weapon() { return current_weapon; }
protected:
bool attack_select_weapon_at_location(sint8 location, bool add_newline = false, bool use_attack_text = true);
};
#endif /* __Player_h__ */