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