aboutsummaryrefslogtreecommitdiff
path: root/engines/tinsel/events.h
blob: 38fbb6971506876ac3f1e96c5324ad04ec3b30c2 (plain)
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
136
137
138
139
140
141
142
143
144
/* 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * $URL$
 * $Id$
 *
 * User events processing and utility functions
 */

#ifndef TINSEL_EVENTS_H
#define TINSEL_EVENTS_H

#include "tinsel/dw.h"
#include "tinsel/coroutine.h"
#include "common/rect.h"

namespace Tinsel {

/*
enum BUTEVENT {
	PLR_NOEVENT, PLR_SLEFT, PLR_DLEFT, PLR_SRIGHT, PLR_DRIGHT,
	PLR_DRAG1_START, PLR_DRAG1_END, PLR_DRAG2_START, PLR_DRAG2_END,
	PLR_UNKNOWN
};

enum KEYEVENT {
	PLR_ESCAPE, PLR_QUIT, PLR_SAVE, PLR_LOAD, PLR_MENU,
	PLR_PGUP, PLR_PGDN, PLR_HOME, PLR_END,
	PLR_WALKTO, PLR_ACTION, PLR_LOOK,
	NOEVENT_KEY
};*/

enum PLR_EVENT {
	// action list
	PLR_PROV_WALKTO = 0,	// Provisional WALKTO !
	PLR_WALKTO = 1,
	PLR_LOOK = 2,
	PLR_ACTION = 3,
	PLR_ESCAPE = 4,
	PLR_MENU = 5,
	PLR_QUIT = 6,
	PLR_PGUP = 7,
	PLR_PGDN = 8,
	PLR_HOME = 9,
	PLR_END = 10,
	PLR_DRAG1_START = 11,
	PLR_DRAG1_END = 12,
	PLR_DRAG2_START = 13,
	PLR_DRAG2_END = 14,
	PLR_JUMP = 15,		// Call up scene hopper
	PLR_NOEVENT = 16,
	PLR_SAVE = 17,
	PLR_LOAD = 18,

	// Aliases used for DW1 actions
	PLR_SLEFT = PLR_WALKTO,
	PLR_DLEFT = PLR_ACTION,
	PLR_SRIGHT = PLR_LOOK,
	PLR_DRIGHT = PLR_NOEVENT,
	PLR_UNKNOWN = PLR_NOEVENT
} ;



/**
 * Reasons for running Glitter code.
 * Do not re-order these as equivalent CONSTs are defined in the master
 * scene Glitter source file for testing against the event() library function.
 *
 * Note: DW2 renames ENTER & LEAVE to WALKIN & WALKOUT, and has a new LEAVE event
 */
enum TINSEL_EVENT {
	NOEVENT, STARTUP, CLOSEDOWN, POINTED, UNPOINT, WALKIN, WALKOUT,
	PICKUP,	PUTDOWN, WALKTO, LOOK, ACTION, CONVERSE, SHOWEVENT,
	HIDEEVENT, TALKING, ENDTALK, LEAVE_T2, RESTORE, PROV_WALKTO
};

enum TINSEL1_EVENT {
	T1_POINTED, T1_WALKTO, T1_ACTION, T1_LOOK, T1_ENTER, T1_LEAVE, T1_STARTUP, T1_CONVERSE,
	T1_UNPOINT, T1_PUTDOWN, T1_NOEVENT
};

const TINSEL1_EVENT TINSEL1_EVENT_MAP[] = {
	T1_NOEVENT, T1_STARTUP, T1_NOEVENT, T1_POINTED, T1_UNPOINT, T1_ENTER, T1_LEAVE,
	T1_NOEVENT, T1_PUTDOWN, T1_WALKTO, T1_LOOK, T1_ACTION, T1_CONVERSE, T1_NOEVENT,
	T1_NOEVENT, T1_NOEVENT, T1_NOEVENT, T1_NOEVENT, T1_NOEVENT, T1_NOEVENT
};

void AllowDclick(CORO_PARAM, PLR_EVENT be);
bool GetControl(int param);
bool GetControl(void);
bool ControlIsOn(void);
void ControlOn(void);
void ControlOff(void);
void ControlStartOff(void);

void RunPolyTinselCode(HPOLYGON hPoly, TINSEL_EVENT event, PLR_EVENT be, bool tc);
void effRunPolyTinselCode(HPOLYGON hPoly, TINSEL_EVENT event, int actor);

void ProcessButEvent(PLR_EVENT be);
void ProcessKeyEvent(PLR_EVENT ke);


int GetEscEvents(void);
int GetLeftEvents(void);
bool LeftEventChange(int myleftEvent);

int getUserEvents(void);

uint32 getUserEventTime(void);
void resetUserEventTime(void);

void ResetEcount(void);

void PolygonEvent(CORO_PARAM, HPOLYGON hPoly, TINSEL_EVENT tEvent, int actor, bool bWait,
				int myEscape, bool *result = NULL);


void PlayerEvent(PLR_EVENT pEvent, const Common::Point &coOrds);

void ProcessedProvisional(void);
void ProvNotProcessed(void);
bool GetProvNotProcessed();

} // End of namespace Tinsel

#endif /* TINSEL_EVENTS_H */