forked from enigma-dev/enigma-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
events.res
572 lines (500 loc) · 13.3 KB
/
events.res
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
# This file contains a list of all events in ENIGMA and the order in which they are executed.
#
# By "contains," I actually mean to imply "dictates." This file will let you re-order events,
# change the behavior of existing events, and even define new events with new behaviours,
# so long as the IDE supports adding them.
#
# That said, DO NOT MODIFY THE CONTENTS OF THIS FILE, UNLESS YOU HAVE READ THE DOCUMENTATION.
# Modifying this file CAN screw up ENIGMA's behavior.
#
# These events are executed outside the main event source at special moments
gamestart: 7 # This event is executed from within code at the start of the game
Name: Game Start
Mode: Spec-sys
Case: 2
roomstart: 7 # This event is executed from within the code that loads a new room
Name: Room Start
Mode: Spec-sys
Case: 4
create: 0 # This event is performed as a ctor: immedaitely as the instance is created
Name: Create
Mode: System
destroy: 1 # This event is performed as a dtor: immediately as the instance is "destroyed"
Name: Destroy
Mode: System
# Here marks the start of events that are actually executed in place
beginstep: 3
Group: Step
Name: Begin Step
Mode: Special
Case: 1
Constant: {xprevious = x; yprevious = y; if (sprite_index != -1) image_index = fmod(image_index + image_speed, sprite_get_number(sprite_index));}
alarm: 2
Group: Alarm
Name: Alarm %1
Mode: Stacked
Sub Check: {alarm[%1] = (int)alarm[%1]; if ((alarm[%1] == -1) or (alarm[%1]--)) return 0; }
# Keyboard events. These are simple enough.
keyboard: 5
Group: Keyboard
Name: Keyboard <%1>
Type: Key
Mode: Stacked
Super Check: keyboard_check(%1)
keypress: 9
Group: Key Press
Name: Press <%1>
Type: Key
Mode: Stacked
Super Check: keyboard_check_pressed(%1)
keyrelease: 10
Group: Key Release
Name: Release <%1>
Type: Key
Mode: Stacked
Super Check: keyboard_check_released(%1)
# There are a million different specialized mouse events.
leftbutton: 6
Group: Mouse
Name: Left Button
Mode: Special
Case: 0
Super Check: mouse_check_button(mb_left)
Sub Check: mouse_x > bbox_left and mouse_x < bbox_right and mouse_y > bbox_top and mouse_y < bbox_bottom
rightbutton: 6
Name: Right Button
Mode: Special
Case: 1
Super Check: mouse_check_button(mb_right)
Sub Check: mouse_x > bbox_left and mouse_x < bbox_right and mouse_y > bbox_top and mouse_y < bbox_bottom
middlebutton: 6
Name: Middle Button
Mode: Special
Case: 2
Super Check: mouse_check_button(mb_middle)
Sub Check: mouse_x > bbox_left and mouse_x < bbox_right and mouse_y > bbox_top and mouse_y < bbox_bottom
nobutton: 6
Name: No Button
Mode: Special
Case: 3
Sub Check: mouse_check_button(mb_none) && !(mouse_x > bbox_left and mouse_x < bbox_right and mouse_y > bbox_top and mouse_y < bbox_bottom)
leftpress: 6
Name: Left Press
Mode: Special
Case: 4
Super Check: mouse_check_button_pressed(mb_left)
Sub Check: mouse_x > bbox_left and mouse_x < bbox_right and mouse_y > bbox_top and mouse_y < bbox_bottom
rightpress: 6
Name: Right Press
Mode: Special
Case: 5
Super Check: mouse_check_button_pressed(mb_right)
Sub Check: mouse_x > bbox_left and mouse_x < bbox_right and mouse_y > bbox_top and mouse_y < bbox_bottom
middlepress: 6
Name: Middle Press
Mode: Special
Case: 6
Super Check: mouse_check_button_pressed(mb_middle)
Sub Check: mouse_x > bbox_left and mouse_x < bbox_right and mouse_y > bbox_top and mouse_y < bbox_bottom
leftrelease: 6
Name: Left Release
Mode: Special
Case: 7
Super Check: mouse_check_button_released(mb_left)
Sub Check: mouse_x > bbox_left and mouse_x < bbox_right and mouse_y > bbox_top and mouse_y < bbox_bottom
rightrelease: 6
Name: Right Release
Mode: Special
Case: 8
Super Check: mouse_check_button_released(mb_right)
Sub Check: mouse_x > bbox_left and mouse_x < bbox_right and mouse_y > bbox_top and mouse_y < bbox_bottom
middlerelease: 6
Name: Middle Release
Mode: Special
Case: 9
Super Check: mouse_check_button_released(mb_middle)
Sub Check: mouse_x > bbox_left and mouse_x < bbox_right and mouse_y > bbox_top and mouse_y < bbox_bottom
mouseenter: 6
Name: Mouse Enter
Mode: Special
Case: 10
Locals: bool $innowEnter = false;
Sub Check: { const bool wasin = $innowEnter; $innowEnter = mouse_x > bbox_left and mouse_x < bbox_right and mouse_y > bbox_top and mouse_y < bbox_bottom; if (!$innowEnter or wasin) return 0; }
mouseleave: 6
Name: Mouse Leave
Mode: Special
Case: 11
Locals: bool $innowLeave = false;
Sub Check: { const bool wasin = $innowLeave; $innowLeave = mouse_x > bbox_left and mouse_x < bbox_right and mouse_y > bbox_top and mouse_y < bbox_bottom; if ($innowLeave or !wasin) return 0; }
mouseunknown: 6
Name: Mouse Unknown (old? LGM doesn't even know!)
Mode: Special
Case: 12
Super Check:
mouseunknowntwo: 6
Name: Mouse Unknown (old? LGM doesn't even know!)
Mode: Special
Case: 13
Super Check:
mousewheelup: 6
Name: Mouse Wheel Up
Mode: Special
Case: 60
Super Check: mouse_vscrolls > 0
mousewheeldown: 6
Name: Mouse Wheel Down
Mode: Special
Case: 61
Super Check: mouse_vscrolls < 0
globalleftbutton: 6
Name: Global Left Button
Mode: Special
Case: 50
Super Check: mouse_check_button(mb_left)
globalrightbutton: 6
Name: Global Right Button
Mode: Special
Case: 51
Super Check: mouse_check_button(mb_right)
globalmiddlebutton: 6
Name: Global Middle Button
Mode: Special
Case: 52
Super Check: mouse_check_button(mb_middle)
globalleftpress: 6
Name: Global Left Press
Mode: Special
Case: 53
Super Check: mouse_check_button_pressed(mb_left)
globalrightpress: 6
Name: Global Right Press
Mode: Special
Case: 54
Super Check: mouse_check_button_pressed(mb_right)
globalmiddlepress: 6
Name: Global Middle press
Mode: Special
Case: 55
Super Check: mouse_check_button_pressed(mb_middle)
globalleftrelease: 6
Name: Global Left Release
Mode: Special
Case: 56
Super Check: mouse_check_button_released(mb_left)
globalrightrelease: 6
Name: Global Right Release
Mode: Special
Case: 57
Super Check: mouse_check_button_released(mb_right)
globalmiddlerelease: 6
Name: Global Middle Release
Mode: Special
Case: 58
Super Check: mouse_check_button_released(mb_middle)
# Finally, some general-purpose events
step: 3
Name: Step
Mode: Special
Case: 0
localsweep: 100000
Name: Locals sweep
Mode: Inline
Constant: if (enigma_user::path_update()) {speed = 0; return 0;} enigma::propagate_locals(this);
# Lump of "Other" events.
pathend: 7
Name: Path End
Mode: Special
Case: 8
Super Check: false #Paths are not yet implemented.
outsideroom: 7
Name: Outside Room
Mode: Special
Case: 0
Sub Check: (bbox_right < 0) || (bbox_left > room_width) || (bbox_bottom < 0) || (bbox_top > room_height)
boundary: 7
Name: Intersect Boundary
Mode: Special
Case: 1
Sub Check: (bbox_left < 0) or (bbox_right > room_width) or (bbox_top < 0) or (bbox_bottom > room_height)
# Collisions stuck here for some reason, possibly so that you
# can deduct lives/health right before the "No more Lives" event
beforecollisionautomaticcollisionhandling: 100000
Name: Before collision automatic collision handling
Mode: None
Default: ;
Instead: enigma::perform_callbacks_before_collision_event();
collision: 4
Group: Collision
Name: %1
Type: Object
Mode: Stacked
Super Check: instance_number(%1)
Sub Check: (instance_other = enigma::place_meeting_inst(x,y,%1)) # Parenthesize assignment used as truth
prefix: for (enigma::iterator it = enigma::fetch_inst_iter_by_int(%1); it; ++it) {int $$$internal$$$ = %1; instance_other = *it; if (enigma::place_meeting_inst(x,y,instance_other->id)) {if(enigma::glaccess(int(other))->solid && enigma::place_meeting_inst(x,y,instance_other->id)) x = xprevious, y = yprevious;
suffix: if (enigma::glaccess(int(other))->solid) {x += hspeed; y += vspeed; if (enigma::place_meeting_inst(x, y, $$$internal$$$)) {x = xprevious; y = yprevious;}}}}
# Check for detriment from collision events above
nomorelives: 7
Name: No More Lives
Mode: Special
Case: 6
Super Check: enigma::update_lives_status_and_return_zeroless()
nomorehealth: 7
Name: No More Health
Mode: Special
Case: 9
Sub Check: health <= 0
# General purpose once again!
endstep: 3
Name: End Step
Mode: Special
Case: 2
particlesystemsupdate: 100000
Name: Particle Systems Update
Mode: None
Default: ;
Instead: enigma::perform_callbacks_particle_updating();
# Fun fact: Draw comes after End Step.
draw: 8
Name: Draw
Mode: Inline
Sub Check: visible
Iterator-declare: /* Draw is handled by depth */
Iterator-initialize: /* Draw is initialized in the constructor */
Iterator-remove: depth.remove();
Iterator-delete: /* Draw will destruct with this */
Default: if (visible && sprite_index != -1) draw_sprite_ext(sprite_index,image_index,x,y,image_xscale,image_yscale,image_angle,image_blend,image_alpha);
Instead: if (automatic_redraw) screen_redraw(); # We never want to iterate draw; we let screen_redraw() handle it.
# Why this comes after "end step," I do not know. One would think it'd be back there with pathend.
animationend: 7
Name: Animation End
Mode: Special
Case: 7
Sub Check: {if (image_index + image_speed < sprite_get_number(sprite_index)) return 0; }
# End of in-linked events
# These are later-executed, special-triggered events that are also not listed for iteration
roomend: 7
Name: Room End
Mode: Spec-sys
Case: 5n
gameend: 7
Name: Game End
Mode: Spec-sys
Case: 3
# user events
userzero: 7
Name: User defined 0
Mode: Special
Case: 10
userone: 7
Name: User defined 1
Mode: Special
Case: 11
usertwo: 7
Name: User defined 2
Mode: Special
Case: 12
userthree: 7
Name: User defined 3
Mode: Special
Case: 13
userfour: 7
Name: User defined 4
Mode: Special
Case: 14
userfive: 7
Name: User defined 5
Mode: Special
Case: 15
usersix: 7
Name: User defined 6
Mode: Special
Case: 16
userseven: 7
Name: User defined 7
Mode: Special
Case: 17
usereight: 7
Name: User defined 8
Mode: Special
Case: 18
usernine: 7
Name: User defined 9
Mode: Special
Case: 19
userten: 7
Name: User defined 10
Mode: Special
Case: 20
usereleven: 7
Name: User defined 11
Mode: Special
Case: 21
usertwelve: 7
Name: User defined 12
Mode: Special
Case: 22
userthirteen: 7
Name: User defined 13
Mode: Special
Case: 23
userfourteen: 7
Name: User defined 14
Mode: Special
Case: 24
userfifteen: 7
Name: User defined 15
Mode: Special
Case: 25
#other mouse events
joystickoneleft: 6
Name: Joystick 1 Left
Mode: Special
Case: 16
Super Check:
joystickoneright: 6
Name: Joystick 1 Right
Mode: Special
Case: 17
Super Check:
joystickoneup: 6
Name: Joystick 1 Up
Mode: Special
Case: 18
Super Check:
joystickonedown: 6
Name: Joystick 1 Down
Mode: Special
Case: 19
Super Check:
joystickonebuttonone: 6
Name: Joystick 1 Button 1
Mode: Special
Case: 21
Super Check:
joystickonebuttontwo: 6
Name: Joystick 1 Button 2
Mode: Special
Case: 22
Super Check:
joystickonebuttonthree: 6
Name: Joystick 1 Button 3
Mode: Special
Case: 23
Super Check:
joystickonebuttonfour: 6
Name: Joystick 1 Button 4
Mode: Special
Case: 24
Super Check:
joystickonebuttonfive: 6
Name: Joystick 1 Button 5
Mode: Special
Case: 25
Super Check:
joystickonebuttonsix: 6
Name: Joystick 1 Button 6
Mode: Special
Case: 26
Super Check:
joystickonebuttonseven: 6
Name: Joystick 1 Button 7
Mode: Special
Case: 27
Super Check:
joystickonebuttoneight: 6
Name: Joystick 1 Button 8
Mode: Special
Case: 28
Super Check:
#joystick 2
joysticktwoleft: 6
Name: Joystick 2 Left
Mode: Special
Case: 31
Super Check:
joysticktworight: 6
Name: Joystick 2 Right
Mode: Special
Case: 32
Super Check:
joysticktwoup: 6
Name: Joystick 2 Up
Mode: Special
Case: 33
Super Check:
joysticktwodown: 6
Name: Joystick 2 Down
Mode: Special
Case: 34
Super Check:
joysticktwobuttonone: 6
Name: Joystick 2 Button 1
Mode: Special
Case: 36
Super Check:
joysticktwobuttontwo: 6
Name: Joystick 2 Button 2
Mode: Special
Case: 37
Super Check:
joysticktwobuttonthree: 6
Name: Joystick 2 Button 3
Mode: Special
Case: 38
Super Check:
joysticktwobuttonfour: 6
Name: Joystick 2 Button 4
Mode: Special
Case: 39
Super Check:
joysticktwobuttonfive: 6
Name: Joystick 2 Button 5
Mode: Special
Case: 40
Super Check:
joysticktwobuttonsix: 6
Name: Joystick 2 Button 6
Mode: Special
Case: 41
Super Check:
joysticktwobuttonseven: 6
Name: Joystick 2 Button 7
Mode: Special
Case: 42
Super Check:
joysticktwobuttoneight: 6
Name: Joystick 2 Button 8
Mode: Special
Case: 43
Super Check:
# EV_BOUNDARY = 1,
# EV_GAME_START = 2,
# EV_GAME_END = 3,
# EV_ROOM_START = 4,
# EV_ROOM_END = 5,
# EV_NO_MORE_LIVES = 6,
# EV_NO_MORE_HEALTH = 9,
# EV_ANIMATION_END = 7,
# EV_END_OF_PATH = 8,
#
#keyboard
#keypress
#keyrelease
#
#mouse
#
#step
#pathend
#outsideroom
#boundary
#collision
#nomorelives
#nomorehealth
#endstep
#screen_redraw
#screen_refresh
#endanimation
#roomend
#gameend
#
#parent_endstep