// Like drawstring, but wrapping words to fit maxwidth
// returns the size of the drawn area
// align selects the string alignment (0 = left, 0.5 = center, 1 = right)
-vector minigame_drawstring_wrapped( float maxwidth, vector pos, string text,
+vector minigame_drawstring_wrapped( float maxwidth, vector pos, string text,
vector fontsize, vector color, float theAlpha, int drawflags, float align );
// Like drawcolorcodedstring, but wrapping words to fit maxwidth
// returns the size of the drawn area
// align selects the string alignment (0 = left, 0.5 = center, 1 = right)
-vector minigame_drawcolorcodedstring_wrapped( float maxwidth, vector pos,
+vector minigame_drawcolorcodedstring_wrapped( float maxwidth, vector pos,
string text, vector fontsize, float theAlpha, int drawflags, float align );
// Like drawstring but truncates the text to fit maxwidth
-void minigame_drawstring_trunc(float maxwidth, vector pos, string text,
+void minigame_drawstring_trunc(float maxwidth, vector pos, string text,
vector fontsize, vector color, float theAlpha, int drawflags );
// Like drawcolorcodedstring but truncates the text to fit maxwidth
-void minigame_drawcolorcodedstring_trunc(float maxwidth, vector pos, string text,
+void minigame_drawcolorcodedstring_trunc(float maxwidth, vector pos, string text,
vector fontsize, float theAlpha, int drawflags );
// like drawpic but pos represent the center rather than the topleft corner
-void minigame_drawpic_centered( vector pos, string texture, vector sz,
+void minigame_drawpic_centered( vector pos, string texture, vector sz,
vector color, float thealpha, int drawflags );
// Get full path of a minigame texture
// For minigame_player: player server slot, don't use for anything else
.float minigame_playerslot;
-// register all minigames
-void initialize_minigames();
-
// client-side minigame session cleanup
void deactivate_minigame();
// Read a minigame entity from the server
void ent_read_minigame();
-// Prompt the player to play in the current minigame
+// Prompt the player to play in the current minigame
// (ie: it's their turn and they should get back to the minigame)
void minigame_prompt();
#define FOREACH_MINIGAME_ENTITY(entityvar) \
entityvar=world; \
- while( (entityvar = findentity(entityvar,owner,active_minigame)) )
+ while( (entityvar = findentity(entityvar,owner,active_minigame)) )
+
+
+REGISTRY(Minigames, BITS(3))
+REGISTER_REGISTRY(RegisterMinigames)
+#define REGISTER_MINIGAME(name,nicename) \
+ REGISTER(RegisterMinigames, MINIGAME, Minigames, name, m_id, spawn()); \
+ void name##_hud_board(vector, vector); \
+ void name##_hud_status(vector, vector); \
+ int name##_client_event(entity, string, ...); \
+ REGISTER_INIT_POST(MINIGAME, name) { \
+ this.classname = "minigame_descriptor"; \
+ this.netname = strzone(strtolower(#name)); \
+ this.message = nicename; \
+ this.minigame_hud_board = name##_hud_board; \
+ this.minigame_hud_status = name##_hud_status; \
+ this.minigame_event = name##_client_event; \
+ } \
+ REGISTER_INIT(MINIGAME, name)
#endif