Added map::current and map::timeElapsed GIB builtins.

This commit is contained in:
Brian Koropoff 2003-04-13 20:31:06 +00:00
parent 1b2d7b79a6
commit c168b40661
3 changed files with 24 additions and 0 deletions

View file

@ -551,6 +551,8 @@ extern redirect_t sv_redirected;
// sv_ccmds.c
//
void SV_Status_f (void);
const char *SV_Current_Map (void);
//
// sv_ents.c

View file

@ -339,6 +339,12 @@ SV_Give_f (void)
// Use this to keep track of current level --KB
static char curlevel[MAX_QPATH] = "";
const char *
SV_Current_Map (void)
{
return curlevel;
}
static const char *
nice_time (float time)
{

View file

@ -141,6 +141,19 @@ SV_GIB_Client_Print_All_f (void)
SV_ClientPrintf (0, cl, level, "%s", GIB_Argv (1));
}
static void
SV_GIB_Map_Get_Current_f (void)
{
GIB_Return (SV_Current_Map());
}
static void
SV_GIB_Map_Time_Elapsed_f (void)
{
if (GIB_CanReturn ())
dsprintf (GIB_Return(0), "%f", sv.time);
}
void
SV_GIB_Init (void)
{
@ -153,6 +166,9 @@ SV_GIB_Init (void)
GIB_Builtin_Add ("client::printAll", SV_GIB_Client_Print_All_f);
GIB_Builtin_Add ("client::printAllChat", SV_GIB_Client_Print_All_f);
GIB_Builtin_Add ("map::getCurrent", SV_GIB_Map_Get_Current_f);
GIB_Builtin_Add ("map::timeElapsed", SV_GIB_Map_Time_Elapsed_f);
// Events
sv_chat_e = GIB_Event_New ("chat");
sv_client_connect_e = GIB_Event_New ("client.connect");