File: adv_player.h

package info (click to toggle)
scummvm 2.9.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 450,580 kB
  • sloc: cpp: 4,299,825; asm: 28,322; python: 12,901; sh: 11,302; java: 9,289; xml: 7,895; perl: 2,639; ansic: 2,465; yacc: 1,670; javascript: 1,020; makefile: 933; lex: 578; awk: 275; objc: 82; sed: 11; php: 1
file content (128 lines) | stat: -rw-r--r-- 4,749 bytes parent folder | download | duplicates (2)
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

/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * 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 3 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, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef M4_ADV_R_ADV_PLAYER_H
#define M4_ADV_R_ADV_PLAYER_H

#include "common/serializer.h"
#include "m4/m4_types.h"
#include "m4/wscript/ws_machine.h"

namespace M4 {

#define MAX_PLYR_STRING_LEN     40

struct Player {
	int32 x = 0, y = 0;			// Player's current screen location
	int32 facing = 0;			// Player's current directional facing

	char verb[MAX_PLYR_STRING_LEN] = { 0 };
	char noun[MAX_PLYR_STRING_LEN] = { 0 };
	char prep[MAX_PLYR_STRING_LEN] = { 0 };
	char object[MAX_PLYR_STRING_LEN];
	char ws_asset_name[32] = { 0 };		// Name of the walker sprite series holder
	char ws_shadow_name[32] = { 0 };	// Name of the walker sprite series shadow holder
	int16 walker_type = 0;		// Type of walker (ripley, mei_chin, safari, etc.)
	int16 shadow_type = 0;		// Type of walker (ripley shadow, candleman shadow, etc.)

	// If he walks off edge, this holds the number of the room he goes to
	int32 walk_off_edge_to_room = 0;	// Player should walk off edge unless told otherwise

	// If False player won't walk - totally aborts a walk
	bool need_to_walk = false;			// Player needs to walk somewhere

	// If False player won't walk yet - walk suspended until TRUE
	bool ready_to_walk = false;			// Player is ready to perform that walk

	bool waiting_for_walk = false;

	// Default True for every room
	// Flag if accepting player input
	bool comm_allowed = false;

	// Means a parser command is ready. When apps programmer finishes
	// parsing command, the programmer must set this to FALSE. If this
	// doesn't get set, the command falls through to the error handling code.
	int32 command_ready = 0;

	// Default True, if set to FALSE walker disappears instantly, and vv
	bool walker_visible = false;		// Flag if player's sprite is visible

	// If True, then apps programmer must display look messages
	bool look_around = false;			// Flag for special "look around" command

	// Tested by the apps programmer to check if player has been here before
	bool been_here_before = false;

	// Walker sprites dumped on switching scenes if TRUE in room preload code
	bool walker_reload_palette = false;
	bool disable_hyperwalk = false;
	bool walker_loads_first = false;
	bool walker_in_this_scene = false;

	int32 walker_trigger = 0;

	int32 walk_x = 0, walk_y = 0;		// Where to walk to when player.ready_to_walk
	int32 walk_facing = 0;

	int32 click_x = 0, click_y = 0;

	void syncGame(Common::Serializer &s);

	void resetWalk();
};

struct PlayerInfo {
	int32 x = 0, y = 0, facing = 0;
	int32 scale = 0, depth = 0;
	int32 camera_x = 0, camera_y = 0;

	void syncGame(Common::Serializer &s);
};

bool player_said(const char *w0, const char *w1 = nullptr, const char *w2 = nullptr);
bool player_said_any(const char *w0, const char *w1 = nullptr, const char *w2 = nullptr,
	const char *w3 = nullptr, const char *w4 = nullptr, const char *w5 = nullptr, const char *w6 = nullptr,
	const char *w7 = nullptr, const char *w8 = nullptr, const char *w9 = nullptr);

void player_inform_walker_new_scale(int32 frontY, int32 backY, int32 frontS, int32 backS);

bool player_load_series(const char *walkerName, const char *shadowName, bool load_palette);
void player_first_walk(int32 x1, int32 y1, int32 f1, int32 x2, int32 y2, int32 f2, bool enable_commands_at_destination);
void player_set_defaults();
void player_noun_becomes_verb(int32 spriteNum);

void player_hotspot_walk_override(int32 x, int32 y, int32 facing = -1, int32 trigger = -1);
void player_hotspot_walk_override_just_face(int32 facing, int32 trigger = -1);

bool player_commands_allowed();
PlayerInfo *player_update_info(machine *myWalker, PlayerInfo *player_info);
PlayerInfo *player_update_info();
void adv_kill_digi_between_rooms(bool true_or_false);

void player_set_facing_hotspot(int trigger = -1);
void player_set_facing_at(int x, int y, int trigger = -1);
int calc_facing(int x, int y);

} // End of namespace M4

#endif