]> icculus.org git repositories - divverent/darkplaces.git/blob - prvm_cmds.c
a stab in the dark at supporting unlit q3bsp maps
[divverent/darkplaces.git] / prvm_cmds.c
1 // AK
2 // Basically every vm builtin cmd should be in here.
3 // All 3 builtin list and extension lists can be found here
4
5 #include "quakedef.h"
6 #include "progdefs.h"
7 #include "clprogdefs.h"
8 #include "mprogdefs.h"
9
10 //============================================================================
11 // nice helper macros
12
13 #define VM_SAFEPARMCOUNT(p,f)   if(prog->argc != p) PRVM_ERROR(#f "wrong parameter count (" #p "expected ) !\n") 
14
15 #define e10 0,0,0,0,0,0,0,0,0,0
16 #define e100 e10,e10,e10,e10,e10,e10,e10,e10,e10,e10
17 #define e1000 e100,e100,e100,e100,e100,e100,e100,e100,e100,e100
18
19 //============================================================================
20 // Common 
21
22 void VM_Cmd_Init(void)
23 {
24 }
25
26 void VM_Cmd_Reset(void)
27 {
28 }
29
30 //============================================================================
31 // Server 
32
33 char *vm_sv_extensions = 
34 ""; 
35
36 prvm_builtin_t vm_sv_builtins[] = {
37 0  // to be consistent with the old vm
38 };
39
40 const int vm_sv_numbuiltins = sizeof(vm_sv_builtins) / sizeof(prvm_builtin_t);
41
42 void VM_SV_Cmd_Init(void)
43 {
44 }
45
46 void VM_SV_Cmd_Reset(void)
47 {
48 }
49
50 //============================================================================
51 // Client 
52
53 char *vm_cl_extensions = 
54 "";
55
56 prvm_builtin_t vm_cl_builtins[] = {
57 0  // to be consistent with the old vm
58 };
59
60 const int vm_cl_numbuiltins = sizeof(vm_cl_builtins) / sizeof(prvm_builtin_t);
61
62 void VM_CL_Cmd_Init(void)
63 {
64 }
65
66 void VM_CL_Cmd_Reset(void)
67 {
68 }
69
70 //============================================================================
71 // Menu 
72
73 char *vm_m_extensions = 
74 "";
75
76 // void setkeydest(float dest)
77 void VM_M_SetKeyDest(void)
78 {
79         VM_SAFEPARMCOUNT(1,VM_M_SetKeyDest);
80
81         switch((int)PRVM_G_FLOAT(OFS_PARM0))
82         {
83         case 0:
84                 // key_game
85                 key_dest = key_game;
86                 break;
87         case 2:
88                 // key_menu
89                 key_dest = key_menu;
90                 break;
91         case 1:
92                 // key_message
93                 // key_dest = key_message
94                 // break;
95         default:
96                 PRVM_ERROR("VM_M_SetKeyDest: wrong destination %i !\n",prog->globals[OFS_PARM0]);
97         }
98
99         return;
100 }
101
102 // float getkeydest(void)
103 void VM_M_GetKeyDest(void)
104 {
105         VM_SAFEPARMCOUNT(0,VM_M_GetKeyDest);
106
107         // key_game = 0, key_message = 1, key_menu = 2, unknown = 3
108         switch(key_dest)
109         {
110         case key_game:
111                 PRVM_G_FLOAT(OFS_RETURN) = 0;
112                 break;
113         case key_menu:
114                 PRVM_G_FLOAT(OFS_RETURN) = 2;
115                 break;
116         case key_message:
117                 // not supported
118                 // PRVM_G_FLOAT(OFS_RETURN) = 1;
119                 // break;
120         default:
121                 PRVM_G_FLOAT(OFS_RETURN) = 3;
122         }               
123 }
124
125 prvm_builtin_t vm_m_builtins[] = {
126 0, // to be consistent with the old vm
127 e1000,
128 VM_M_SetKeyDest,
129 VM_M_GetKeyDest
130 };
131
132 const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t);
133
134 void VM_M_Cmd_Init(void)
135 {
136 }
137
138 void VM_M_Cmd_Reset(void)
139 {
140 }
141