ScummVM API documentation
adv_player.h
1 
2 /* ScummVM - Graphic Adventure Engine
3  *
4  * ScummVM is the legal property of its developers, whose names
5  * are too numerous to list here. Please refer to the COPYRIGHT
6  * file distributed with this source distribution.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef M4_ADV_R_ADV_PLAYER_H
24 #define M4_ADV_R_ADV_PLAYER_H
25 
26 #include "common/serializer.h"
27 #include "m4/m4_types.h"
28 #include "m4/wscript/ws_machine.h"
29 
30 namespace M4 {
31 
32 #define MAX_PLYR_STRING_LEN 40
33 
34 struct Player {
35  int32 x = 0, y = 0; // Player's current screen location
36  int32 facing = 0; // Player's current directional facing
37 
38  char verb[MAX_PLYR_STRING_LEN] = { 0 };
39  char noun[MAX_PLYR_STRING_LEN] = { 0 };
40  char prep[MAX_PLYR_STRING_LEN] = { 0 };
41  char object[MAX_PLYR_STRING_LEN];
42  char ws_asset_name[32] = { 0 }; // Name of the walker sprite series holder
43  char ws_shadow_name[32] = { 0 }; // Name of the walker sprite series shadow holder
44  int16 walker_type = 0; // Type of walker (ripley, mei_chin, safari, etc.)
45  int16 shadow_type = 0; // Type of walker (ripley shadow, candleman shadow, etc.)
46 
47  // If he walks off edge, this holds the number of the room he goes to
48  int32 walk_off_edge_to_room = 0; // Player should walk off edge unless told otherwise
49 
50  // If False player won't walk - totally aborts a walk
51  bool need_to_walk = false; // Player needs to walk somewhere
52 
53  // If False player won't walk yet - walk suspended until TRUE
54  bool ready_to_walk = false; // Player is ready to perform that walk
55 
56  bool waiting_for_walk = false;
57 
58  // Default True for every room
59  // Flag if accepting player input
60  bool comm_allowed = false;
61 
62  // Means a parser command is ready. When apps programmer finishes
63  // parsing command, the programmer must set this to FALSE. If this
64  // doesn't get set, the command falls through to the error handling code.
65  int32 command_ready = 0;
66 
67  // Default True, if set to FALSE walker disappears instantly, and vv
68  bool walker_visible = false; // Flag if player's sprite is visible
69 
70  // If True, then apps programmer must display look messages
71  bool look_around = false; // Flag for special "look around" command
72 
73  // Tested by the apps programmer to check if player has been here before
74  bool been_here_before = false;
75 
76  // Walker sprites dumped on switching scenes if TRUE in room preload code
77  bool walker_reload_palette = false;
78  bool disable_hyperwalk = false;
79  bool walker_loads_first = false;
80  bool walker_in_this_scene = false;
81 
82  int32 walker_trigger = 0;
83 
84  int32 walk_x = 0, walk_y = 0; // Where to walk to when player.ready_to_walk
85  int32 walk_facing = 0;
86 
87  int32 click_x = 0, click_y = 0;
88 
89  void syncGame(Common::Serializer &s);
90 
91  void resetWalk();
92 };
93 
94 struct PlayerInfo {
95  int32 x = 0, y = 0, facing = 0;
96  int32 scale = 0, depth = 0;
97  int32 camera_x = 0, camera_y = 0;
98 
99  void syncGame(Common::Serializer &s);
100 };
101 
102 bool player_said(const char *w0, const char *w1 = nullptr, const char *w2 = nullptr);
103 bool player_said_any(const char *w0, const char *w1 = nullptr, const char *w2 = nullptr,
104  const char *w3 = nullptr, const char *w4 = nullptr, const char *w5 = nullptr, const char *w6 = nullptr,
105  const char *w7 = nullptr, const char *w8 = nullptr, const char *w9 = nullptr);
106 
107 void player_inform_walker_new_scale(int32 frontY, int32 backY, int32 frontS, int32 backS);
108 
109 bool player_load_series(const char *walkerName, const char *shadowName, bool load_palette);
110 void player_first_walk(int32 x1, int32 y1, int32 f1, int32 x2, int32 y2, int32 f2, bool enable_commands_at_destination);
111 void player_set_defaults();
112 void player_noun_becomes_verb(int32 spriteNum);
113 
114 void player_hotspot_walk_override(int32 x, int32 y, int32 facing = -1, int32 trigger = -1);
115 void player_hotspot_walk_override_just_face(int32 facing, int32 trigger = -1);
116 
117 bool player_commands_allowed();
118 PlayerInfo *player_update_info(machine *myWalker, PlayerInfo *player_info);
119 PlayerInfo *player_update_info();
120 void adv_kill_digi_between_rooms(bool true_or_false);
121 
122 void player_set_facing_hotspot(int trigger = -1);
123 void player_set_facing_at(int x, int y, int trigger = -1);
124 int calc_facing(int x, int y);
125 
126 } // End of namespace M4
127 
128 #endif
Definition: ws_machine.h:153
Definition: serializer.h:79
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: adv_player.h:94
Definition: database.h:28
Definition: adv_player.h:34