4 entity minigame_descriptors;
6 // previous node in a doubly linked list
8 // next node in a linked list
11 entity minigame_get_descriptor(string id);
13 // Get letter index of a tile name
14 int minigame_tile_letter(string id);
16 // Get number index of a tile name
17 // Note: this is 0 based, useful for mathematical operations
18 // Note: Since the tile notation starts from the bottom left,
19 // you may want to do number_of_rows - what_this_function_returns or something
20 int minigame_tile_number(string id);
22 // Get relative position of the center of a given tile
23 vector minigame_tile_pos(string id, int rows, int columns);
25 // Get a tile name from indices
26 string minigame_tile_buildname(int letter, int number);
28 // Get the id of a tile relative to the given one
29 string minigame_relative_tile(string start_id, int dx, int dy, int rows, int columns);
31 // Get tile name from a relative position (matches the tile covering a square area)
32 string minigame_tile_name(vector pos, int rows, int columns);
34 // Get the next team number (note: team numbers are between 1 and n_teams, inclusive)
35 int minigame_next_team(int curr_team, int n_teams);
37 // Get the previous team number
38 int minigame_prev_team(int curr_team, int n_teams);
40 // set send flags only when on server
41 // (for example in game logic which can be used both in client and server
42 void minigame_server_sendflags(entity ent, int mgflags);
44 // count the number of players in a minigame session
45 int minigame_count_players(entity minigame);
47 /// For minigame sessions: minigame descriptor object
50 /// For minigame sessions/descriptors: execute the given event
52 /// mouse_moved(vector mouse_pos)
53 /// return 1 to handle input, 0 to discard
54 /// mouse_pressed/released(int K_Keycode)
55 /// return 1 to handle input, 0 to discard
56 /// note: see dpdefs/keycodes.qc for values
57 /// key_pressed/released(int K_Keycode)
58 /// return 1 to handle input, 0 to discard
59 /// note: see dpdefs/keycodes.qc for values
61 /// executed when the minigame is activated for the current client
63 /// executed when the minigame is deactivated for the current client
64 /// network_receive(entity received,int flags)
65 /// executed each time a networked entity is received
66 /// note: when this is called self == ...(0,entity)
67 /// You can use the MINIG_SF_ constants to check the send flags
68 /// IMPORTANT: always read in client everything you send from the server!
69 /// menu_show(entity parent_menu_item)
70 /// executed when the Current Game menu is shown, used to add custom entries
71 /// Call HUD_MinigameMenu_CustomEntry to do so (pass ...(0,entity) as first argument)
72 /// menu_click(string arg)
73 /// executed when a custom menu entry is clicked
76 /// executed when the minigame session is starting
78 /// executed when the minigame session is shutting down
79 /// join(entity player)
80 /// executed when a player wants to join the session
81 /// return the player team number to accept the new player, 0 to discard
82 /// part(entity player)
83 /// executed when a player is going to leave the session
84 /// network_send(entity sent,int flags)
85 /// executed each time a networked entity is sent
86 /// note: when this is called self == ...(0,entity)
87 /// You can use the MINIG_SF_ constants to check the send flags
88 /// IMPORTANT: always read in client everything you send from the server!
89 /// cmd(entity minigame_player, int argc, string command)
90 /// self = client entity triggering this
91 /// argv(n) = console token
92 /// argc: number of console tokens
93 /// command: full command string
94 /// triggered when a player does "cmd minigame ..." with some unrecognized command
95 /// return 1 if the minigame has handled the command
96 /// impulse(entity minigame_player,int impulse)
97 /// self = client entity triggering this
98 /// triggered when a player does "impulse ..."
99 /// return 1 if the minigame has handled the impulse
100 .int(entity,string,...) minigame_event;
102 // For run-time gameplay entities: Whether to be removed when the game is deactivated
103 .bool minigame_autoclean;
105 // For run-time gameplay entities: some place to store flags safely
108 // Send flags, set to .SendFlags on networked entities to send entity information
109 // Flag values for customized events must be powers of 2 in the range
110 // [MINIG_SF_CUSTOM, MINIG_SF_MAX] (inclusive)
111 const int MINIG_SF_CREATE = 0x01; // Create a new object
112 const int MINIG_SF_UPDATE = 0x02; // miscellaneous entity update
113 const int MINIG_SF_CUSTOM = 0x10; // a customized networked event
114 const int MINIG_SF_MAX = 0x80; // maximum flag value sent over the network
115 const int MINIG_SF_ALL = 0xff; // use to resend everything
118 // Spawn linked entity on the server or local entity on the client
119 // This entity will be removed automatically when the minigame ends
120 entity msle_spawn(entity minigame_session, string class_name);
122 #include "minigame/all.qh"
124 int msle_id(string class_name);
125 string msle_classname(int id);