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 // set send flags only when on server
38 // (for example in game logic which can be used both in client and server
39 void minigame_server_sendflags(entity ent, int mgflags);
41 // count the number of players in a minigame session
42 int minigame_count_players(entity minigame);
44 /// For minigame sessions: minigame descriptor object
47 /// For minigame sessions/descriptors: execute the given event
49 /// mouse_moved(vector mouse_pos)
50 /// return 1 to handle input, 0 to discard
51 /// mouse_pressed/released(int K_Keycode)
52 /// return 1 to handle input, 0 to discard
53 /// note: see dpdefs/keycodes.qc for values
54 /// key_pressed/released(int K_Keycode)
55 /// return 1 to handle input, 0 to discard
56 /// note: see dpdefs/keycodes.qc for values
58 /// executed when the minigame is activated for the current client
60 /// executed when the minigame is deactivated for the current client
61 /// network_receive(entity received,int flags)
62 /// executed each time a networked entity is received
63 /// note: when this is called self == ...(0,entity)
64 /// You can use the MINIG_SF_ constants to check the send flags
65 /// IMPORTANT: always read in client everything you send from the server!
66 /// menu_show(entity parent_menu_item)
67 /// executed when the Current Game menu is shown, used to add custom entries
68 /// Call HUD_MinigameMenu_CustomEntry to do so (pass ...(0,entity) as first argument)
69 /// menu_click(string arg)
70 /// executed when a custom menu entry is clicked
73 /// executed when the minigame session is starting
75 /// executed when the minigame session is shutting down
76 /// join(entity player)
77 /// executed when a player wants to join the session
78 /// return the player team number to accept the new player, 0 to discard
79 /// part(entity player)
80 /// executed when a player is going to leave the session
81 /// network_send(entity sent,int flags)
82 /// executed each time a networked entity is sent
83 /// note: when this is called self == ...(0,entity)
84 /// You can use the MINIG_SF_ constants to check the send flags
85 /// IMPORTANT: always read in client everything you send from the server!
86 /// cmd(entity minigame_player, int argc, string command)
87 /// self = client entity triggering this
88 /// argv(n) = console token
89 /// argc: number of console tokens
90 /// command: full command string
91 /// triggered when a player does "cmd minigame ..." with some unrecognized command
92 /// return 1 if the minigame has handled the command
93 /// impulse(entity minigame_player,int impulse)
94 /// self = client entity triggering this
95 /// triggered when a player does "impulse ..."
96 /// return 1 if the minigame has handled the impulse
97 .int(entity,string,...) minigame_event;
99 // For run-time gameplay entities: Whether to be removed when the game is deactivated
100 .bool minigame_autoclean;
102 // For run-time gameplay entities: some place to store flags safely
105 // Send flags, set to .SendFlags on networked entities to send entity information
106 // Flag values for customized events must be powers of 2 in the range
107 // [MINIG_SF_CUSTOM, MINIG_SF_MAX] (inclusive)
108 const int MINIG_SF_CREATE = 0x01; // Create a new object
109 const int MINIG_SF_UPDATE = 0x02; // miscellaneous entity update
110 const int MINIG_SF_CUSTOM = 0x10; // a customized networked event
111 const int MINIG_SF_MAX = 0x80; // maximum flag value sent over the network
112 const int MINIG_SF_ALL = 0xff; // use to resend everything
115 // Spawn linked entity on the server or local entity on the client
116 // This entity will be removed automatically when the minigame ends
117 entity msle_spawn(entity minigame_session, string class_name);
119 #include "minigame/all.qh"
121 int msle_id(string class_name);
122 string msle_classname(int id);