| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #ifndef GAMEEVENT_H |
| 20 | #define GAMEEVENT_Hcxx . . $ `Descent3/gameevent.h:20:9`! |
| 21 | |
| 22 | #include "game.h"cxx . . $ `<file>/Descent3/game.h`/ |
| 23 | #include "object.h"cxx . . $ `<file>/Descent3/object.h`/ |
| 24 | |
| 25 | #define MAX_EVENTScxx . . $ `Descent3/gameevent.h:25:9`! 500 |
| 26 | |
| 27 | // Game event types |
| 28 | #define OBJECT_EVENTcxx . . $ `Descent3/gameevent.h:28:9`! 1 |
| 29 | #define RENDER_EVENTcxx . . $ `Descent3/gameevent.h:29:9`! 2 |
| 30 | |
| 31 | // IDs |
| 32 | #define UNKNOWN_EVENTcxx . . $ `Descent3/gameevent.h:32:9`! 0 |
| 33 | #define FUSION_EFFECTcxx . . $ `Descent3/gameevent.h:33:9`! 1 |
| 34 | #define DAMAGE_EFFECTcxx . . $ `Descent3/gameevent.h:34:9`! 2 |
| 35 | #define SCREEN_BLENDcxx . . $ `Descent3/gameevent.h:35:9`! 3 |
| 36 | #define BLAST_RING_EVENTcxx . . $ `Descent3/gameevent.h:36:9`! 4 |
| 37 | #define FOV_CHANGE_EVENTcxx . . $ `Descent3/gameevent.h:37:9`! 5 |
| 38 | #define EDRAIN_EFFECTcxx . . $ `Descent3/gameevent.h:38:9`! 6 |
| 39 | |
| 40 | #define D3X_TIMED_EVENTcxx . . $ `Descent3/gameevent.h:40:9`! 256 |
| 41 | |
| 42 | struct game_eventcxx . . $ game_event# { |
| 43 | int typecxx . . $ game_event#type.; |
| 44 | int idcxx . . $ game_event#id.; |
| 45 | int objhandle_detonatorcxx . . $ game_event#objhandle_detonator.; // watch this object, if it dies/gets killed than cancel this game event |
| 46 | uint8_tcxx . . $ uint8_t# usedcxx . . $ game_event#used.; |
| 47 | float start_timecxx . . $ game_event#start_time., end_timecxx . . $ game_event#end_time.; |
| 48 | int frame_borncxx . . $ game_event#frame_born.; |
| 49 | |
| 50 | void *datacxx . . $ game_event#data.; |
| 51 | |
| 52 | void (*subfunctioncxx . . $ game_event#subfunction.)(int, void *); |
| 53 | }; |
| 54 | |
| 55 | // Adds and event to the list. The event will trigger at Gametime+length |
| 56 | int CreateNewEventcxx . . $ CreateNewEvent(85af21da76cb0316).(int type, int id, float length, void *data, int size, void (*subfunction)(int eventnum, void *data), |
| 57 | int objhandle_detonator = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!); |
| 58 | |
| 59 | // Processes all pending events, removing the ones that are expired |
| 60 | void ProcessNormalEventscxx . . $ ProcessNormalEvents(49f6e7a06ebc5aa8).(); |
| 61 | void ProcessRenderEventscxx . . $ ProcessRenderEvents(49f6e7a06ebc5aa8).(); |
| 62 | |
| 63 | // Does a specific action according to an event |
| 64 | void HandleEventcxx . . $ HandleEvent(48320f9021c27e4d).(game_eventcxx . . $ game_event# *); |
| 65 | |
| 66 | // Clears the event list |
| 67 | void ClearAllEventscxx . . $ ClearAllEvents(49f6e7a06ebc5aa8).(); |
| 68 | |
| 69 | // Returns -1 if can't find event, else index of event int GameEvent array |
| 70 | int FindEventIDcxx . . $ FindEventID(7864480464b09eea).(int id); |
| 71 | |
| 72 | // Frees an event for use by others |
| 73 | void FreeEventcxx . . $ FreeEvent(d4f767463ce0a6b3).(int index); |
| 74 | |
| 75 | extern game_eventcxx . . $ game_event# GameEventcxx . . $ GameEvent.[MAX_EVENTScxx . . $ `Descent3/gameevent.h:25:9`!]; |
| 76 | extern int Num_eventscxx . . $ Num_events.; |
| 77 | |
| 78 | #endif |