ScummVM API documentation
event.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef AGS_ENGINE_AC_EVENT_H
23 #define AGS_ENGINE_AC_EVENT_H
24 
25 #include "ags/engine/ac/runtime_defines.h"
26 #include "ags/engine/script/runtime_script_value.h"
27 
28 namespace AGS3 {
29 
30 // parameters to run_on_event
31 #define GE_LEAVE_ROOM 1
32 #define GE_ENTER_ROOM 2
33 //#define GE_MAN_DIES 3 // ancient obsolete event
34 #define GE_GOT_SCORE 4
35 #define GE_GUI_MOUSEDOWN 5
36 #define GE_GUI_MOUSEUP 6
37 #define GE_ADD_INV 7
38 #define GE_LOSE_INV 8
39 #define GE_RESTORE_GAME 9
40 #define GE_ENTER_ROOM_AFTERFADE 10
41 #define GE_LEAVE_ROOM_AFTERFADE 11
42 #define GE_SAVE_GAME 12
43 
44 // Game event types:
45 // common script callback
46 #define EV_TEXTSCRIPT 1
47 // room event
48 #define EV_RUNEVBLOCK 2
49 // fade-in event
50 #define EV_FADEIN 3
51 // gui click
52 #define EV_IFACECLICK 4
53 // new room event
54 #define EV_NEWROOM 5
55 // Text script callback types:
56 enum kTS_CallbackTypes {
57  kTS_None = 0,
58 // repeatedly execute
59  kTS_Repeat,
60 // on key press
61  kTS_KeyPress,
62 // mouse click
63  kTS_MouseClick,
64 // on text input
65  kTS_TextInput,
66 // script callback types number
67  kTS_Num
68 };
69 
70 // Room event types:
71 // hotspot event
72 #define EVB_HOTSPOT 1
73 // room own event
74 #define EVB_ROOM 2
75 // Room event sub-types:
76 // room edge crossing
77 #define EVROM_EDGELEFT 0
78 #define EVROM_EDGERIGHT 1
79 #define EVROM_EDGEBOTTOM 2
80 #define EVROM_EDGETOP 3
81 // first time enters room
82 #define EVROM_FIRSTENTER 4
83 // load room; aka before fade-in
84 #define EVROM_BEFOREFADEIN 5
85 // room's rep-exec
86 #define EVROM_REPEXEC 6
87 // after fade-in
88 #define EVROM_AFTERFADEIN 7
89 // leave room (before fade-out)
90 #define EVROM_LEAVE 8
91 // unload room; aka after fade-out
92 #define EVROM_AFTERFADEOUT 9
93 // Hotspot event types:
94 // player stands on hotspot
95 #define EVHOT_STANDSON 0
96 // cursor is over hotspot
97 #define EVHOT_MOUSEOVER 6
98 
99 struct EventHappened {
100  int type = 0;
101  int data1 = 0, data2 = 0, data3 = 0;
102  int player = -1;
103 
104  EventHappened() = default;
105  EventHappened(int type_, int data1_, int data2_, int data3_, int player_)
106  : type(type_), data1(data1_), data2(data2_), data3(data3_), player(player_) {}
107 };
108 
109 int run_claimable_event(const char *tsname, bool includeRoom, int numParams, const RuntimeScriptValue *params, bool *eventWasClaimed);
110 // runs the global script on_event fnuction
111 void run_on_event(int evtype, RuntimeScriptValue &wparam);
112 void run_room_event(int id);
113 // event list functions
114 void setevent(int evtyp, int ev1 = 0, int ev2 = -1000, int ev3 = -1000);
115 void force_event(int evtyp, int ev1 = 0, int ev2 = -1000, int ev3 = -1000);
116 void process_event(const EventHappened *evp);
117 void runevent_now(int evtyp, int ev1, int ev2, int ev3);
118 void processallevents();
119 // end event list functions
120 void ClaimEvent();
121 
122 } // namespace AGS3
123 
124 #endif
Definition: runtime_script_value.h:63
Definition: event.h:99
Definition: ags.h:40