From 7e737da913d7dd502568fa32f3d72d30a971738d Mon Sep 17 00:00:00 2001 From: vortex Date: Sun, 31 Oct 2010 23:04:24 +0000 Subject: [PATCH] new m_newmap() MenuQC function which gets executed each time client goes new level. +Option for Blood Omnicide which lets menu QC to control keys while playing video. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10576 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_parse.c | 4 ++++ keys.c | 5 ++++- menu.c | 16 ++++++++++++++++ menu.h | 1 + progsvm.h | 1 + prvm_edict.c | 1 + 6 files changed, 27 insertions(+), 1 deletion(-) diff --git a/cl_parse.c b/cl_parse.c index 72e377da..eacfa7bf 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "csprogs.h" #include "libcurl.h" #include "utf8lib.h" +#include "menu.h" const char *svc_strings[128] = { @@ -486,6 +487,9 @@ static void CL_SetupWorldModel(void) // check memory integrity Mem_CheckSentinelsGlobal(); + // make menu know + MR_NewMap(); + // load the csqc now if (cl.loadcsqc) { diff --git a/keys.c b/keys.c index 8fe972c4..87663328 100644 --- a/keys.c +++ b/keys.c @@ -1887,7 +1887,10 @@ Key_Event (int key, int ascii, qboolean down) // ignore binds while a video is played, let the video system handle the key event if (cl_videoplaying) { - CL_Video_KeyEvent (key, ascii, keydown[key] != 0); + if (gamemode == GAME_BLOODOMNICIDE) // menu controls key events + MR_KeyEvent(key, ascii, down); + else + CL_Video_KeyEvent (key, ascii, keydown[key] != 0); return; } diff --git a/menu.c b/menu.c index a2f24779..90a85ba6 100644 --- a/menu.c +++ b/menu.c @@ -5016,6 +5016,10 @@ void M_KeyEvent (int key, int ascii, qboolean downevent) } +void M_NewMap(void) +{ +} + void M_Shutdown(void) { // reset key_dest @@ -5136,6 +5140,15 @@ void MP_ToggleMenu(int mode) PRVM_End; } +void MP_NewMap(void) +{ + PRVM_Begin; + PRVM_SetProg(PRVM_MENUPROG); + if (prog->funcoffsets.m_newmap) + PRVM_ExecuteProgram(prog->funcoffsets.m_newmap,"m_newmap() required"); + PRVM_End; +} + void MP_Shutdown (void) { PRVM_Begin; @@ -5198,6 +5211,7 @@ void (*MR_KeyEvent) (int key, int ascii, qboolean downevent); void (*MR_Draw) (void); void (*MR_ToggleMenu) (int mode); void (*MR_Shutdown) (void); +void (*MR_NewMap) (void); void MR_SetRouting(qboolean forceold) { @@ -5211,6 +5225,7 @@ void MR_SetRouting(qboolean forceold) MR_Draw = M_Draw; MR_ToggleMenu = M_ToggleMenu; MR_Shutdown = M_Shutdown; + MR_NewMap = M_NewMap; // init if(!m_init) @@ -5228,6 +5243,7 @@ void MR_SetRouting(qboolean forceold) MR_Draw = MP_Draw; MR_ToggleMenu = MP_ToggleMenu; MR_Shutdown = MP_Shutdown; + MR_NewMap = MP_NewMap; if(!mp_init) { diff --git a/menu.h b/menu.h index b9e4cb10..1ca8799b 100644 --- a/menu.h +++ b/menu.h @@ -83,6 +83,7 @@ extern void (*MR_KeyEvent) (int key, int ascii, qboolean downevent); extern void (*MR_Draw) (void); extern void (*MR_ToggleMenu) (int mode); extern void (*MR_Shutdown) (void); +extern void (*MR_NewMap) (void); typedef struct video_resolution_s { diff --git a/progsvm.h b/progsvm.h index ee738fe0..6d11e350 100644 --- a/progsvm.h +++ b/progsvm.h @@ -378,6 +378,7 @@ typedef struct prvm_prog_funcoffsets_s func_t m_keyup; // mqc func_t m_shutdown; // mqc func_t m_toggle; // mqc + func_t m_newmap; // mqc } prvm_prog_funcoffsets_t; diff --git a/prvm_edict.c b/prvm_edict.c index 1d97bb37..a0dc14a2 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -1751,6 +1751,7 @@ void PRVM_FindOffsets(void) prog->funcoffsets.m_keyup = PRVM_ED_FindFunctionOffset("m_keyup"); prog->funcoffsets.m_shutdown = PRVM_ED_FindFunctionOffset("m_shutdown"); prog->funcoffsets.m_toggle = PRVM_ED_FindFunctionOffset("m_toggle"); + prog->funcoffsets.m_newmap = PRVM_ED_FindFunctionOffset("m_newmap"); } // not used -- 2.39.2