From c168b4066171fd8f0ede18e8e605b4298039a9a6 Mon Sep 17 00:00:00 2001 From: Brian Koropoff Date: Sun, 13 Apr 2003 20:31:06 +0000 Subject: [PATCH] Added map::current and map::timeElapsed GIB builtins. --- qw/include/server.h | 2 ++ qw/source/sv_ccmds.c | 6 ++++++ qw/source/sv_gib.c | 16 ++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/qw/include/server.h b/qw/include/server.h index fd386b20a..9936b4458 100644 --- a/qw/include/server.h +++ b/qw/include/server.h @@ -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 diff --git a/qw/source/sv_ccmds.c b/qw/source/sv_ccmds.c index d5d2f60f4..4e83002b5 100644 --- a/qw/source/sv_ccmds.c +++ b/qw/source/sv_ccmds.c @@ -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) { diff --git a/qw/source/sv_gib.c b/qw/source/sv_gib.c index d68a76763..cf3e7ca80 100644 --- a/qw/source/sv_gib.c +++ b/qw/source/sv_gib.c @@ -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");