]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - mvm_cmds.c
Remove FS_FIX_PATHS again and disable model rendering in the menu until someone can...
[xonotic/darkplaces.git] / mvm_cmds.c
index fda7feae551fa84ca2d4e4ddae4cc2a59736c811..391076f520dd38c9235d218ee540f09682114c7d 100644 (file)
 char *vm_m_extensions =
 "BX_WAL_SUPPORT "
 "DP_CINEMATIC_DPV "
+"DP_FONT_VARIABLEWIDTH "
+"DP_GECKO_SUPPORT "
 "DP_MENU_EXTRESPONSEPACKET "
 "DP_QC_ASINACOSATANATAN2TAN "
+"DP_QC_CMD "
+"DP_QC_CRC16 "
+"DP_QC_CVAR_TYPE "
+"DP_QC_RENDER_SCENE "
 "DP_QC_STRFTIME "
-"DP_QC_STRING_CASE_FUNCTIONS "
+"DP_QC_STRINGBUFFERS "
 "DP_QC_STRINGCOLORFUNCTIONS "
+"DP_QC_STRING_CASE_FUNCTIONS "
+"DP_QC_STRREPLACE "
 "DP_QC_TOKENIZEBYSEPARATOR "
 "DP_QC_UNLIMITEDTEMPSTRINGS "
-"DP_QC_CMD "
-"DP_QC_STRREPLACE "
-"DP_FONT_VARIABLEWIDTH "
-// FIXME: rename this extension maybe? [12/5/2007 Black]
-#ifdef SUPPORT_GECKO
-"DP_GECKO_SUPPORT "
-#endif
-"DP_QC_RENDER_SCENE"
+"DP_QC_URI_ESCAPE "
+"FTE_STRINGS "
 ;
 
 /*
@@ -168,7 +170,7 @@ void VM_M_callfunction(void)
                if (builtinnumber < prog->numbuiltins && prog->builtins[builtinnumber])
                        prog->builtins[builtinnumber]();
                else
-                       PRVM_ERROR("No such builtin #%i in %s", builtinnumber, PRVM_NAME);
+                       PRVM_ERROR("No such builtin #%i in %s; most likely cause: outdated engine build. Try updating!", builtinnumber, PRVM_NAME);
        }
        else if(func - prog->functions > 0)
        {
@@ -874,9 +876,16 @@ VM_altstr_ins,                                             //  #86
 VM_findflags,                                          //  #87
 VM_findchainflags,                             //  #88
 VM_cvar_defstring,                             //  #89
+// deactivate support for model rendering in the menu until someone has time to do it right [3/2/2008 Andreas]
+#if 0
 VM_CL_setmodel,                                        // #90 void(entity e, string m) setmodel (QUAKE)
 VM_CL_precache_model,                  // #91 void(string s) precache_model (QUAKE)
 VM_CL_setorigin,                               // #92 void(entity e, vector o) setorigin (QUAKE)
+#else
+NULL,
+NULL,
+NULL,
+#endif
 NULL,                                                                  //  #93
 NULL,                                                                  //  #94
 NULL,                                                                  //  #95
@@ -1006,12 +1015,12 @@ NULL,                                                                   // #218
 NULL,                                                                  // #219
 NULL,                                                                  // #220
 VM_strstrofs,                                          // #221 float(string str, string sub[, float startpos]) strstrofs (FTE_STRINGS)
-NULL,                                                                  // #222
-NULL,                                                                  // #223
-NULL,                                                                  // #224
-NULL,                                                                  // #225
-NULL,                                                                  // #226
-NULL,                                                                  // #227
+VM_str2chr,                                            // #222 float(string str, float ofs) str2chr (FTE_STRINGS)
+VM_chr2str,                                            // #223 string(float c, ...) chr2str (FTE_STRINGS)
+VM_strconv,                                            // #224 string(float ccase, float calpha, float cnum, string s, ...) strconv (FTE_STRINGS)
+VM_strpad,                                             // #225 string(float chars, string s, ...) strpad (FTE_STRINGS)
+VM_infoadd,                                            // #226 string(string info, string key, string value, ...) infoadd (FTE_STRINGS)
+VM_infoget,                                            // #227 string(string info, string key) infoget (FTE_STRINGS)
 VM_strncmp,                                                    // #228 float(string s1, string s2, float len) strncmp (FTE_STRINGS)
 VM_strncasecmp,                                        // #229 float(string s1, string s2) strcasecmp (FTE_STRINGS)
 VM_strncasecmp,                                        // #230 float(string s1, string s2, float len) strncasecmp (FTE_STRINGS)
@@ -1084,6 +1093,8 @@ NULL,                                                                     // #296
 NULL,                                                                  // #297
 NULL,                                                                  // #298
 NULL,                                                                  // #299
+// deactivate support for model rendering in the menu until someone has time to do it right [3/2/2008 Andreas]
+#if 0
 // CSQC range #300-#399
 VM_CL_R_ClearScene,                            // #300 void() clearscene (DP_QC_RENDER_SCENE)
 VM_CL_R_AddEntities,                   // #301 void(float mask) addentities (DP_QC_RENDER_SCENE)
@@ -1091,13 +1102,30 @@ VM_CL_R_AddEntity,                              // #302 void(entity ent) addentity (DP_QC_RENDER_SCENE)
 VM_CL_R_SetView,                               // #303 float(float property, ...) setproperty (DP_QC_RENDER_SCENE)
 VM_CL_R_RenderScene,                   // #304 void() renderscene (DP_QC_RENDER_SCENE)
 VM_CL_R_AddDynamicLight,               // #305 void(vector org, float radius, vector lightcolours) adddynamiclight (DP_QC_RENDER_SCENE)
-VM_CL_R_PolygonBegin,                  // #306 void(string texturename, float flag[, float is2d, float lines]) R_BeginPolygon
-VM_CL_R_PolygonVertex,                 // #307 void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex
+VM_CL_R_PolygonBegin,                  // #306 void(string texturename, float flag[, float is2d, float lines]) R_BeginPolygon (DP_QC_RENDER_SCENE)
+VM_CL_R_PolygonVertex,                 // #307 void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex (DP_QC_RENDER_SCENE)
 VM_CL_R_PolygonEnd,                            // #308 void() R_EndPolygon
 NULL/*VM_CL_R_LoadWorldModel*/,                                // #309 void(string modelname) R_LoadWorldModel
-NULL,                                                                  // #310
-NULL,                                                                  // #311
-NULL,                                                                  // #312
+// TODO: rearrange and merge all builtin lists and share as many extensions as possible between all VM instances [1/27/2008 Andreas]
+VM_CL_setattachment,                           // #310 void(entity e, entity tagentity, string tagname) setattachment (DP_GFX_QUAKE3MODELTAGS) (DP_QC_RENDER_SCENE)
+VM_CL_gettagindex,                             // #311 float(entity ent, string tagname) gettagindex (DP_QC_GETTAGINFO) (DP_QC_RENDER_SCENE)
+VM_CL_gettaginfo,                                      // #312 vector(entity ent, float tagindex) gettaginfo (DP_QC_GETTAGINFO) (DP_QC_RENDER_SCENE)
+#else
+// CSQC range #300-#399
+NULL,          
+NULL,          
+NULL,          
+NULL,          
+NULL,          
+NULL,          
+NULL,          
+NULL,  
+NULL,  
+NULL,
+NULL,  
+NULL,  
+NULL,  
+#endif
 NULL,                                                                  // #313
 NULL,                                                                  // #314
 NULL,                                                                  // #315
@@ -1225,16 +1253,16 @@ NULL,                                                                   // #436
 NULL,                                                                  // #437
 NULL,                                                                  // #438
 NULL,                                                                  // #439
-NULL,                                                                  // #440
-NULL,                                                                  // #441
-NULL,                                                                  // #442
-NULL,                                                                  // #443
-NULL,                                                                  // #444
-NULL,                                                                  // #445
-NULL,                                                                  // #446
-NULL,                                                                  // #447
-NULL,                                                                  // #448
-NULL,                                                                  // #449
+VM_buf_create,                                 // #440 float() buf_create (DP_QC_STRINGBUFFERS)
+VM_buf_del,                                            // #441 void(float bufhandle) buf_del (DP_QC_STRINGBUFFERS)
+VM_buf_getsize,                                        // #442 float(float bufhandle) buf_getsize (DP_QC_STRINGBUFFERS)
+VM_buf_copy,                                   // #443 void(float bufhandle_from, float bufhandle_to) buf_copy (DP_QC_STRINGBUFFERS)
+VM_buf_sort,                                   // #444 void(float bufhandle, float sortpower, float backward) buf_sort (DP_QC_STRINGBUFFERS)
+VM_buf_implode,                                        // #445 string(float bufhandle, string glue) buf_implode (DP_QC_STRINGBUFFERS)
+VM_bufstr_get,                                 // #446 string(float bufhandle, float string_index) bufstr_get (DP_QC_STRINGBUFFERS)
+VM_bufstr_set,                                 // #447 void(float bufhandle, float string_index, string str) bufstr_set (DP_QC_STRINGBUFFERS)
+VM_bufstr_add,                                 // #448 float(float bufhandle, string str, float order) bufstr_add (DP_QC_STRINGBUFFERS)
+VM_bufstr_free,                                        // #449 void(float bufhandle, float string_index) bufstr_free (DP_QC_STRINGBUFFERS)
 NULL,                                                                  // #450
 VM_iscachedpic,                                        // #451 draw functions...
 VM_precache_pic,                                       // #452
@@ -1272,7 +1300,6 @@ NULL,                                                                     // #483
 VM_strreplace,                                         // #484 string(string search, string replace, string subject) strreplace (DP_QC_STRREPLACE)
 VM_strireplace,                                        // #485 string(string search, string replace, string subject) strireplace (DP_QC_STRREPLACE)
 NULL,                                                                  // #486
-#ifdef SUPPORT_GECKO
 VM_gecko_create,                                       // #487 float gecko_create( string name )
 VM_gecko_destroy,                                      // #488 void gecko_destroy( string name )
 VM_gecko_navigate,                             // #489 void gecko_navigate( string name, string URI )
@@ -1280,17 +1307,8 @@ VM_gecko_keyevent,                               // #490 float gecko_keyevent( string name, float key, floa
 VM_gecko_movemouse,                            // #491 void gecko_mousemove( string name, float x, float y )
 VM_gecko_resize,                                       // #492 void gecko_resize( string name, float w, float h )
 VM_gecko_get_texture_extent,   // #493 vector gecko_get_texture_extent( string name )
-#else
-NULL,                                                                  // #487
-NULL,                                                                  // #488
-NULL,                                                                  // #489
-NULL,                                                                  // #490
-NULL,                                                                  // #491
-NULL,                                                                  // #492
-NULL,                                                                  // #493
-#endif
-NULL,                                                                  // #494
-NULL,                                                                  // #495
+VM_crc16,                                              // #494 float(float caseinsensitive, string s, ...) crc16 = #494 (DP_QC_CRC16)
+VM_cvar_type,                                  // #495 float(string name) cvar_type = #495; (DP_QC_CVAR_TYPE)
 NULL,                                                                  // #496
 NULL,                                                                  // #497
 NULL,                                                                  // #498
@@ -1305,9 +1323,9 @@ NULL,                                                                     // #506
 NULL,                                                                  // #507
 NULL,                                                                  // #508
 NULL,                                                                  // #509
-NULL,                                                                  // #510
-NULL,                                                                  // #511
-NULL,                                                                  // #512
+VM_uri_escape,                                 // #510 string(string in) uri_escape = #510;
+VM_uri_unescape,                               // #511 string(string in) uri_unescape = #511;
+VM_etof,                                       // #512 float(entity ent) num_for_edict = #512 (DP_QC_NUM_FOR_EDICT)
 NULL,                                                                  // #513
 NULL,                                                                  // #514
 NULL,                                                                  // #515
@@ -1424,24 +1442,30 @@ VM_M_getextresponse                             // #624 string getextresponse(void)
 
 const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t);
 
-r_refdef_scene_t menu_scene;
-
 void VM_M_Cmd_Init(void)
 {
+       r_refdef_scene_t *scene;
+
        VM_Cmd_Init();
        VM_Polygons_Reset();
 
-       memset (&menu_scene, 0, sizeof (menu_scene));
+       scene = R_GetScenePointer( RST_MENU );
+
+       memset (scene, 0, sizeof (*scene));
 
-       menu_scene.maxtempentities = 128;
-       menu_scene.tempentities = (entity_render_t*) Mem_Alloc(prog->progs_mempool, sizeof(entity_render_t) * menu_scene.maxtempentities);
+       scene->maxtempentities = 128;
+       scene->tempentities = (entity_render_t*) Mem_Alloc(prog->progs_mempool, sizeof(entity_render_t) * scene->maxtempentities);
 
-       menu_scene.maxentities = MAX_EDICTS + 256 + 512;
-       menu_scene.entities = (entity_render_t **)Mem_Alloc(cls.permanentmempool, sizeof(entity_render_t *) * menu_scene.maxentities);
+       scene->maxentities = MAX_EDICTS + 256 + 512;
+       scene->entities = (entity_render_t **)Mem_Alloc(prog->progs_mempool, sizeof(entity_render_t *) * scene->maxentities);
+
+       scene->ambient = 32.0f;
 }
 
 void VM_M_Cmd_Reset(void)
 {
+       // note: the menu's render entities are automatically freed when the prog's pool is freed
+
        //VM_Cmd_Init();
        VM_Cmd_Reset();
        VM_Polygons_Reset();