From 34e49e85302c4c84e2dbb42092bba02262d14714 Mon Sep 17 00:00:00 2001 From: black Date: Tue, 11 Nov 2003 20:18:37 +0000 Subject: [PATCH] Added 2 builtins. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3636 d7cf8633-e32d-0410-b094-e92efae38249 --- prvm_cmds.c | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/prvm_cmds.c b/prvm_cmds.c index 6adb8be7..fc0396a0 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -88,6 +88,7 @@ float gettime() float mod(float val, float m) const string str_cvar (string) crash() + stackdump() perhaps only : Menu : WriteMsg =============================== @@ -127,6 +128,8 @@ float getmousetarget(void) callfunction(...,string function_name) writetofile(float fhandle, entity ent) +float isfunction(string function_name) +vector getresolution(float number) */ #include "quakedef.h" @@ -1112,6 +1115,21 @@ void VM_coredump (void) Cbuf_AddText("\n"); } +/* +========= +VM_stackdump + +stackdump() +========= +*/ +void PRVM_StackTrace(void); +void VM_stackdump (void) +{ + VM_SAFEPARMCOUNT(0, VM_stackdump); + + PRVM_StackTrace(); +} + /* ========= VM_crash @@ -2835,6 +2853,27 @@ void VM_M_writetofile(void) PRVM_ED_Write (VM_FILES[filenum], ent); } +/* +========= +VM_M_getresolution + +vector getresolution(float number) +========= +*/ +extern unsigned short video_resolutions[][2]; +void VM_M_getresolution(void) +{ + int nr; + VM_SAFEPARMCOUNT(1, VM_getresolution); + + nr = PRVM_G_FLOAT(OFS_PARM0); + + + PRVM_G_VECTOR(OFS_RETURN)[0] = video_resolutions[nr][0]; + PRVM_G_VECTOR(OFS_RETURN)[1] = video_resolutions[nr][1]; + PRVM_G_VECTOR(OFS_RETURN)[2] = 0; +} + prvm_builtin_t vm_m_builtins[] = { 0, // to be consistent with the old vm // common builtings (mostly) @@ -2909,8 +2948,9 @@ prvm_builtin_t vm_m_builtins[] = { VM_loadfromfile, VM_modulo, // 70 VM_str_cvar, - VM_crash, // 72 - 0,0,0,0,0,0,0,0,// 80 + VM_crash, + VM_stackdump, // 73 + 0,0,0,0,0,0,0,// 80 e10, // 90 e10, // 100 e100, // 200 @@ -2954,7 +2994,8 @@ prvm_builtin_t vm_m_builtins[] = { VM_M_getmousetarget, VM_M_callfunction, VM_M_writetofile, - VM_M_isfunction // 607 + VM_M_isfunction, + VM_M_getresolution // 608 }; const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t); -- 2.39.2