Added optional float global sb_showscores to CSQC that represents the engine's +shows...
authordresk <dresk@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 8 Sep 2007 02:40:20 +0000 (02:40 +0000)
committerdresk <dresk@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 8 Sep 2007 02:40:20 +0000 (02:40 +0000)
float sb_showscores;

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7562 d7cf8633-e32d-0410-b094-e92efae38249

csprogs.c
progsvm.h
prvm_edict.c
sbar.c

index 116381f..518f28e 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -436,6 +436,18 @@ void CL_VM_UpdateIntermissionState (int intermission)
                CSQC_END
        }
 }
+void CL_VM_UpdateShowingScoresState (int showingscores)
+{
+       prvm_eval_t *val;
+       if(cl.csqc_loaded)
+       {
+               CSQC_BEGIN
+               val = PRVM_GLOBALFIELDVALUE(prog->globaloffsets.sb_showscores);
+               if(val)
+                       val->_float = showingscores;
+               CSQC_END
+       }
+}
 void CL_VM_UpdateCoopDeathmatchGlobals (int gametype)
 {
        // Avoid global names for clean(er) coding
index 52dfd03..43b34be 100644 (file)
--- a/progsvm.h
+++ b/progsvm.h
@@ -242,6 +242,7 @@ typedef struct prvm_prog_globaloffsets_s
        int dmg_take; // csqc
        int dmg_save; // csqc
        int dmg_origin; // csqc
+       int sb_showscores; // csqc
        
 }
 prvm_prog_globaloffsets_t;
index 947d897..02d15db 100644 (file)
@@ -1459,6 +1459,7 @@ void PRVM_FindOffsets(void)
        prog->globaloffsets.dmg_take                      = PRVM_ED_FindGlobalOffset("dmg_take");
        prog->globaloffsets.dmg_save                      = PRVM_ED_FindGlobalOffset("dmg_save");
        prog->globaloffsets.dmg_origin                    = PRVM_ED_FindGlobalOffset("dmg_origin");
+       prog->globaloffsets.sb_showscores                 = PRVM_ED_FindGlobalOffset("sb_showscores");
 
        // menu qc only uses some functions, nothing else
        prog->funcoffsets.m_display                       = PRVM_ED_FindFunctionOffset("m_display");
diff --git a/sbar.c b/sbar.c
index 0e67357..e0c7ec8 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -110,6 +110,8 @@ void Sbar_DeathmatchOverlay (void);
 void Sbar_IntermissionOverlay (void);
 void Sbar_FinaleOverlay (void);
 
+void CL_VM_UpdateShowingScoresState (int showingscores);
+
 
 /*
 ===============
@@ -123,6 +125,7 @@ void Sbar_ShowScores (void)
        if (sb_showscores)
                return;
        sb_showscores = true;
+       CL_VM_UpdateShowingScoresState(sb_showscores);
 }
 
 /*
@@ -135,6 +138,7 @@ Tab key up
 void Sbar_DontShowScores (void)
 {
        sb_showscores = false;
+       CL_VM_UpdateShowingScoresState(sb_showscores);
 }
 
 void sbar_start(void)