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  * User events processing and utility functions
22  */
23 
24 #ifndef TINSEL_EVENTS_H
25 #define TINSEL_EVENTS_H
26 
27 #include "common/coroutines.h"
28 #include "common/rect.h"
29 #include "tinsel/dw.h"
30 
31 namespace Tinsel {
32 
33 /*
34 enum BUTEVENT {
35 	PLR_NOEVENT, PLR_SLEFT, PLR_DLEFT, PLR_SRIGHT, PLR_DRIGHT,
36 	PLR_DRAG1_START, PLR_DRAG1_END, PLR_DRAG2_START, PLR_DRAG2_END,
37 	PLR_UNKNOWN
38 };
39 
40 enum KEYEVENT {
41 	PLR_ESCAPE, PLR_QUIT, PLR_SAVE, PLR_LOAD, PLR_MENU,
42 	PLR_PGUP, PLR_PGDN, PLR_HOME, PLR_END,
43 	PLR_WALKTO, PLR_ACTION, PLR_LOOK,
44 	NOEVENT_KEY
45 };*/
46 
47 enum PLR_EVENT {
48 	// action list
49 	PLR_PROV_WALKTO = 0,	// Provisional WALKTO !
50 	PLR_WALKTO = 1,
51 	PLR_LOOK = 2,
52 	PLR_ACTION = 3,
53 	PLR_ESCAPE = 4,
54 	PLR_MENU = 5,
55 	PLR_QUIT = 6,
56 	PLR_PGUP = 7,
57 	PLR_PGDN = 8,
58 	PLR_HOME = 9,
59 	PLR_END = 10,
60 	PLR_DRAG1_START = 11,
61 	PLR_DRAG1_END = 12,
62 	PLR_DRAG2_START = 13,
63 	PLR_DRAG2_END = 14,
64 	PLR_JUMP = 15,		// Call up scene hopper
65 	PLR_NOEVENT = 16,
66 	PLR_SAVE = 17,
67 	PLR_LOAD = 18,
68 	PLR_WHEEL_UP = 19,
69 	PLR_WHEEL_DOWN = 20,
70 
71 	// Aliases used for DW1 actions
72 	PLR_SLEFT = PLR_WALKTO,
73 	PLR_DLEFT = PLR_ACTION,
74 	PLR_SRIGHT = PLR_LOOK,
75 	PLR_DRIGHT = PLR_NOEVENT,
76 	PLR_UNKNOWN = PLR_NOEVENT
77 };
78 
79 
80 
81 /**
82  * Reasons for running Glitter code.
83  * Do not re-order these as equivalent CONSTs are defined in the master
84  * scene Glitter source file for testing against the event() library function.
85  *
86  * Note: DW2 renames ENTER & LEAVE to WALKIN & WALKOUT, and has a new LEAVE event
87  */
88 enum TINSEL_EVENT {
89 	NOEVENT, STARTUP, CLOSEDOWN, POINTED, UNPOINT, WALKIN, WALKOUT,
90 	PICKUP,	PUTDOWN, WALKTO, LOOK, ACTION, CONVERSE, SHOWEVENT,
91 	HIDEEVENT, TALKING, ENDTALK, LEAVE_T2, RESTORE, PROV_WALKTO
92 };
93 
94 enum TINSEL1_EVENT {
95 	T1_POINTED, T1_WALKTO, T1_ACTION, T1_LOOK, T1_ENTER, T1_LEAVE, T1_STARTUP, T1_CONVERSE,
96 	T1_UNPOINT, T1_PUTDOWN, T1_NOEVENT
97 };
98 
99 const TINSEL1_EVENT TINSEL1_EVENT_MAP[] = {
100 	T1_NOEVENT, T1_STARTUP, T1_NOEVENT, T1_POINTED, T1_UNPOINT, T1_ENTER, T1_LEAVE,
101 	T1_NOEVENT, T1_PUTDOWN, T1_WALKTO, T1_LOOK, T1_ACTION, T1_CONVERSE, T1_NOEVENT,
102 	T1_NOEVENT, T1_NOEVENT, T1_NOEVENT, T1_NOEVENT, T1_NOEVENT, T1_NOEVENT
103 };
104 
105 void AllowDclick(CORO_PARAM, PLR_EVENT be);
106 bool GetControl(int param);
107 bool GetControl();
108 bool ControlIsOn();
109 void ControlOn();
110 void ControlOff();
111 void ControlStartOff();
112 
113 void RunPolyTinselCode(HPOLYGON hPoly, TINSEL_EVENT event, PLR_EVENT be, bool tc);
114 void effRunPolyTinselCode(HPOLYGON hPoly, TINSEL_EVENT event, int actor);
115 
116 void ProcessButEvent(PLR_EVENT be);
117 void ProcessKeyEvent(PLR_EVENT ke);
118 
119 
120 int GetEscEvents();
121 int GetLeftEvents();
122 bool LeftEventChange(int myleftEvent);
123 
124 int getUserEvents();
125 
126 uint32 getUserEventTime();
127 void resetUserEventTime();
128 
129 void ResetEcount();
130 
131 void PolygonEvent(CORO_PARAM, HPOLYGON hPoly, TINSEL_EVENT tEvent, int actor, bool bWait,
132 				int myEscape, bool *result = NULL);
133 
134 
135 void PlayerEvent(PLR_EVENT pEvent, const Common::Point &coOrds);
136 
137 void ProcessedProvisional();
138 void ProvNotProcessed();
139 bool GetProvNotProcessed();
140 
141 } // End of namespace Tinsel
142 
143 #endif /* TINSEL_EVENTS_H */
144