]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/minigames/minigames.qh
Remove some bInputType checks that now are redundant in HUD_Minigame_InputEvent
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / minigames / minigames.qh
index 3b8bbafb465b033da7513d8e1b922df5b7d64962..de0baf6b388e4eba2d49dc718f5a2f7eb340ca1c 100644 (file)
@@ -1,7 +1,4 @@
-#ifndef MINIGAMES_H
-#define MINIGAMES_H
-
-entity minigame_descriptors;
+#pragma once
 
 // previous node in a doubly linked list
 .entity list_prev;
@@ -11,35 +8,38 @@ entity minigame_descriptors;
 entity minigame_get_descriptor(string id);
 
 // Get letter index of a tile name
-float minigame_tile_letter(string id);
+int minigame_tile_letter(string id);
 
 // Get number index of a tile name
 // Note: this is 0 based, useful for mathematical operations
-// Note: Since the tile notation starts from the bottom left, 
+// Note: Since the tile notation starts from the bottom left,
 //     you may want to do number_of_rows - what_this_function_returns or something
-float minigame_tile_number(string id);
+int minigame_tile_number(string id);
 
 // Get relative position of the center of a given tile
-vector minigame_tile_pos(string id, float rows, float columns);
+vector minigame_tile_pos(string id, int rows, int columns);
 
 // Get a tile name from indices
-string minigame_tile_buildname(float letter, float number);
+string minigame_tile_buildname(int letter, int number);
 
 // Get the id of a tile relative to the given one
-string minigame_relative_tile(string start_id, float dx, float dy, float rows, float columns);
+string minigame_relative_tile(string start_id, int dx, int dy, int rows, int columns);
 
 // Get tile name from a relative position (matches the tile covering a square area)
-string minigame_tile_name(vector pos, float rows, float columns);
+string minigame_tile_name(vector pos, int rows, int columns);
 
 // Get the next team number (note: team numbers are between 1 and n_teams, inclusive)
-float minigame_next_team(float curr_team, float n_teams);
+int minigame_next_team(int curr_team, int n_teams);
+
+// Get the previous team number
+int minigame_prev_team(int curr_team, int n_teams);
 
 // set send flags only when on server
 // (for example in game logic which can be used both in client and server
-void minigame_server_sendflags(entity ent, float mgflags);
+void minigame_server_sendflags(entity ent, int mgflags);
 
 // count the number of players in a minigame session
-float minigame_count_players(entity minigame);
+int minigame_count_players(entity minigame);
 
 /// For minigame sessions: minigame descriptor object
 .entity descriptor;
@@ -48,17 +48,17 @@ float minigame_count_players(entity minigame);
 /// Client events:
 ///    mouse_moved(vector mouse_pos)
 ///                    return 1 to handle input, 0 to discard
-///    mouse_pressed/released(float K_Keycode)
+///    mouse_pressed/released(int K_Keycode)
 ///                    return 1 to handle input, 0 to discard
 ///            note: see dpdefs/keycodes.qc for values
-///    key_pressed/released(float K_Keycode)
+///    key_pressed/released(int K_Keycode)
 ///            return 1 to handle input, 0 to discard
 ///            note: see dpdefs/keycodes.qc for values
 ///    activate()
 ///            executed when the minigame is activated for the current client
 ///    deactivate()
 ///            executed when the minigame is deactivated for the current client
-///    network_receive(entity received,float flags)
+///    network_receive(entity received,int flags)
 ///            executed each time a networked entity is received
 ///            note: when this is called self == ...(0,entity)
 ///            You can use the MINIG_SF_ constants to check the send flags
@@ -78,47 +78,45 @@ float minigame_count_players(entity minigame);
 ///            return the player team number to accept the new player, 0 to discard
 ///    part(entity player)
 ///            executed when a player is going to leave the session
-///    network_send(entity sent,float flags)
+///    network_send(entity sent,int flags)
 ///            executed each time a networked entity is sent
 ///            note: when this is called self == ...(0,entity)
 ///            You can use the MINIG_SF_ constants to check the send flags
 ///            IMPORTANT: always read in client everything you send from the server!
-///    cmd(entity minigame_player, float argc, string command)
+///    cmd(entity minigame_player, int argc, string command)
 ///            self = client entity triggering this
-///            argv(n) = console token 
+///            argv(n) = console token
 ///            argc: number of console tokens
 ///            command: full command string
 ///            triggered when a player does "cmd minigame ..." with some unrecognized command
 ///            return 1 if the minigame has handled the command
-///    impulse(entity minigame_player,float impulse)
+///    impulse(entity minigame_player,int impulse)
 ///            self = client entity triggering this
 ///            triggered when a player does "impulse ..."
 ///            return 1 if the minigame has handled the impulse
-.float(entity,string,...)   minigame_event;
+.int(entity,string,...)   minigame_event;
 
 // For run-time gameplay entities: Whether to be removed when the game is deactivated
-.float minigame_autoclean;
+.bool minigame_autoclean;
 
 // For run-time gameplay entities: some place to store flags safely
-.float minigame_flags;
+.int minigame_flags;
 
 // Send flags, set to .SendFlags on networked entities to send entity information
 // Flag values for customized events must be powers of 2 in the range
 // [MINIG_SF_CUSTOM, MINIG_SF_MAX] (inclusive)
-const float MINIG_SF_CREATE  = 0x01; // Create a new object
-const float MINIG_SF_UPDATE  = 0x02; // miscellaneous entity update
-const float MINIG_SF_CUSTOM  = 0x10; // a customized networked event
-const float MINIG_SF_MAX     = 0x80; // maximum flag value sent over the network
-const float MINIG_SF_ALL     = 0xff; // use to resend everything
+const int MINIG_SF_CREATE  = 0x01; // Create a new object
+const int MINIG_SF_UPDATE  = 0x02; // miscellaneous entity update
+const int MINIG_SF_CUSTOM  = 0x10; // a customized networked event
+const int MINIG_SF_MAX     = 0x80; // maximum flag value sent over the network
+const int MINIG_SF_ALL     = 0xff; // use to resend everything
 
 
 // Spawn linked entity on the server or local entity on the client
 // This entity will be removed automatically when the minigame ends
-entity msle_spawn(entity minigame_session, string class_name);
+entity msle_spawn(entity minigame_session, entity e);
 
 #include "minigame/all.qh"
 
-float msle_id(string class_name);
-string msle_classname(float id);
-
-#endif
+int msle_id(string class_name);
+string msle_classname(int id);