]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - mvm_cmds.c
Gecko: load OffscreenGecko dynamically
[xonotic/darkplaces.git] / mvm_cmds.c
index 2947ebfa88b36f137f0f06ee06b3d3a93a58eee5..71e59ab20e1e72918542a0bda2d678decf1540b7 100644 (file)
@@ -1,6 +1,7 @@
 #include "quakedef.h"
 
 #include "prvm_cmds.h"
+#include "clvm_cmds.h"
 #include "menu.h"
 
 //============================================================================
@@ -20,9 +21,8 @@ char *vm_m_extensions =
 "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"
 ;
 
 /*
@@ -89,6 +89,10 @@ void VM_M_setkeydest(void)
                // key_menu
                key_dest = key_menu;
                break;
+       case 3:
+               // key_menu_grabbed
+               key_dest = key_menu_grabbed;
+               break;
        case 1:
                // key_message
                // key_dest = key_message
@@ -109,7 +113,7 @@ void VM_M_getkeydest(void)
 {
        VM_SAFEPARMCOUNT(0,VM_M_getkeydest);
 
-       // key_game = 0, key_message = 1, key_menu = 2, unknown = 3
+       // key_game = 0, key_message = 1, key_menu = 2, key_menu_grabbed = 3, unknown = -1
        switch(key_dest)
        {
        case key_game:
@@ -118,12 +122,15 @@ void VM_M_getkeydest(void)
        case key_menu:
                PRVM_G_FLOAT(OFS_RETURN) = 2;
                break;
+       case key_menu_grabbed:
+               PRVM_G_FLOAT(OFS_RETURN) = 3;
+               break;
        case key_message:
                // not supported
                // PRVM_G_FLOAT(OFS_RETURN) = 1;
                // break;
        default:
-               PRVM_G_FLOAT(OFS_RETURN) = 3;
+               PRVM_G_FLOAT(OFS_RETURN) = -1;
        }
 }
 
@@ -865,9 +872,9 @@ VM_altstr_ins,                                              //  #86
 VM_findflags,                                          //  #87
 VM_findchainflags,                             //  #88
 VM_cvar_defstring,                             //  #89
-NULL,                                                                  //  #90
-NULL,                                                                  //  #91
-NULL,                                                                  //  #92
+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)
 NULL,                                                                  //  #93
 NULL,                                                                  //  #94
 NULL,                                                                  //  #95
@@ -1075,16 +1082,17 @@ NULL,                                                                   // #296
 NULL,                                                                  // #297
 NULL,                                                                  // #298
 NULL,                                                                  // #299
-NULL,                                                                  // #300
-NULL,                                                                  // #301
-NULL,                                                                  // #302
-NULL,                                                                  // #303
-NULL,                                                                  // #304
-NULL,                                                                  // #305
-NULL,                                                                  // #306
-NULL,                                                                  // #307
-NULL,                                                                  // #308
-NULL,                                                                  // #309
+// 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)
+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_PolygonEnd,                            // #308 void() R_EndPolygon
+NULL/*VM_CL_R_LoadWorldModel*/,                                // #309 void(string modelname) R_LoadWorldModel
 NULL,                                                                  // #310
 NULL,                                                                  // #311
 NULL,                                                                  // #312
@@ -1262,23 +1270,13 @@ 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
-VM_gecko_destroy,                                      // #488
-VM_gecko_navigate,                             // #489
-VM_gecko_keyevent,                             // #490
-VM_gecko_movemouse,                            // #491
-VM_gecko_resize,                                                                       // #492
-VM_gecko_get_texture_extent,                                                                   // #493
-#else
-NULL,                                                                  // #487
-NULL,                                                                  // #488
-NULL,                                                                  // #489
-NULL,                                                                  // #490
-NULL,                                                                  // #491
-NULL,                                                                  // #492
-NULL,                                                                  // #493
-#endif
+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 )
+VM_gecko_keyevent,                             // #490 float gecko_keyevent( string name, float key, float eventtype )
+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 )
 NULL,                                                                  // #494
 NULL,                                                                  // #495
 NULL,                                                                  // #496
@@ -1386,41 +1384,53 @@ NULL,                                                                   // #597
 NULL,                                                                  // #598
 NULL,                                                                  // #599
 NULL,                                                                  // #600
-VM_M_setkeydest,                                       // #601 menu functions...
-VM_M_getkeydest,                                       // #602
-VM_M_setmousetarget,                           // #603
-VM_M_getmousetarget,                           // #604
-VM_M_callfunction,                             // #605
-VM_writetofile,                                        // #606
-VM_M_isfunction,                                       // #607
-VM_M_getresolution,                            // #608
-VM_keynumtostring,                             // #609
-VM_M_findkeysforcommand,               // #610
-VM_M_getserverliststat,                        // #611
-VM_M_getserverliststring,              // #612
-VM_parseentitydata,                            // #613
-VM_stringtokeynum,                             // #614
-VM_M_resetserverlistmasks,             // #615
-VM_M_setserverlistmaskstring,  // #616
-VM_M_setserverlistmasknumber,  // #617
-VM_M_resortserverlist,                 // #618
-VM_M_setserverlistsort,                        // #619
-VM_M_refreshserverlist,                        // #620
-VM_M_getserverlistnumber,              // #621
-VM_M_getserverlistindexforkey,// #622
-VM_M_addwantedserverlistkey,   // #623
-VM_M_getextresponse                            // #624
+VM_M_setkeydest,                                       // #601 void setkeydest(float dest)
+VM_M_getkeydest,                                       // #602 float getkeydest(void)
+VM_M_setmousetarget,                           // #603 void setmousetarget(float trg)
+VM_M_getmousetarget,                           // #604 float getmousetarget(void)
+VM_M_callfunction,                             // #605 void callfunction(...)
+VM_writetofile,                                        // #606 void writetofile(float fhandle, entity ent)
+VM_M_isfunction,                                       // #607 float isfunction(string function_name)
+VM_M_getresolution,                            // #608 vector getresolution(float number)
+VM_keynumtostring,                             // #609 string keynumtostring(float keynum)
+VM_M_findkeysforcommand,               // #610 string findkeysforcommand(string command)
+VM_M_getserverliststat,                        // #611 float gethostcachevalue(float type)
+VM_M_getserverliststring,              // #612 string gethostcachestring(float type, float hostnr)
+VM_parseentitydata,                            // #613 void parseentitydata(entity ent, string data)
+VM_stringtokeynum,                             // #614 float stringtokeynum(string key)
+VM_M_resetserverlistmasks,             // #615 void resethostcachemasks(void)
+VM_M_setserverlistmaskstring,  // #616 void sethostcachemaskstring(float mask, float fld, string str, float op)
+VM_M_setserverlistmasknumber,  // #617 void sethostcachemasknumber(float mask, float fld, float num, float op)
+VM_M_resortserverlist,                 // #618 void resorthostcache(void)
+VM_M_setserverlistsort,                        // #619 void sethostcachesort(float fld, float descending)
+VM_M_refreshserverlist,                        // #620 void refreshhostcache(void)
+VM_M_getserverlistnumber,              // #621 float gethostcachenumber(float fld, float hostnr)
+VM_M_getserverlistindexforkey,// #622 float gethostcacheindexforkey(string key)
+VM_M_addwantedserverlistkey,   // #623 void addwantedhostcachekey(string key)
+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)
 {
        VM_Cmd_Init();
+       VM_Polygons_Reset();
+
+       memset (&menu_scene, 0, sizeof (menu_scene));
+
+       menu_scene.maxtempentities = 128;
+       menu_scene.tempentities = (entity_render_t*) Mem_Alloc(prog->progs_mempool, sizeof(entity_render_t) * menu_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);
 }
 
 void VM_M_Cmd_Reset(void)
 {
        //VM_Cmd_Init();
        VM_Cmd_Reset();
+       VM_Polygons_Reset();
 }