{
prvm_edict_private_t *e;
void *vp;
- //add other types as you desire
+ // add other private structs as you desire
+ // new structs have to start with the elements of prvm_edit_private_t
+ // e.g. a new struct has to either look like this:
+ // typedef struct server_edict_private_s {
+ // prvm_edict_private_t base;
+ // vec3_t moved_from;
+ // vec3_t moved_fromangles;
+ // ... } server_edict_private_t;
+ // or:
+ // typedef struct server_edict_private_s {
+ // qboolean free;
+ // float freetime;
+ // vec3_t moved_from;
+ // vec3_t moved_fromangles;
+ // ... } server_edict_private_t;
+ // However, the first one should be preferred.
} p;
// QuakeC fields (stored in dynamically resized array)
//entvars_t *v;
string search_getfilename(float handle, float num)
string chr(float ascii)
+
+float etof(entity ent)
+entity ftoe(float num)
perhaps only : Menu : WriteMsg
===============================
float gethostcachevalue(float type)
string gethostcachestring(float type, float hostnr)
-
+ parseentitydata(entity ent, string data)
*/
#include "quakedef.h"
PRVM_G_FLOAT(OFS_RETURN) = atof(string);
}
+/*
+========================
+VM_etof
+
+float etof(entity ent)
+========================
+*/
+void VM_etof(void)
+{
+ VM_SAFEPARMCOUNT(1, VM_etof);
+ PRVM_G_FLOAT(OFS_RETURN) = PRVM_G_INT(OFS_PARM0);
+}
+
+/*
+========================
+VM_ftoe
+
+entity ftoe(float num)
+========================
+*/
+void VM_ftoe(void)
+{
+ int ent;
+ VM_SAFEPARMCOUNT(1, VM_ftoe);
+
+ ent = PRVM_G_FLOAT(OFS_PARM0);
+ if(PRVM_PROG_TO_EDICT(ent)->p.e->free)
+ PRVM_ERROR ("VM_ftoe: %s tried to access a freed entity (entity %i)!\n", PRVM_NAME, ent);
+
+ PRVM_G_INT(OFS_RETURN) = ent;
+}
+
/*
=========
VM_spawn
PRVM_ED_LoadFromFile(PRVM_G_STRING(OFS_PARM0));
}
+/*
+========================
+VM_M_parseentitydata
+
+parseentitydata(entity ent, string data)
+========================
+*/
+void VM_M_parseentitydata(void)
+{
+ prvm_edict_t *ent;
+ const char *data;
+
+ VM_SAFEPARMCOUNT(2, VM_parseentitydata);
+
+ // get edict and test it
+ ent = PRVM_G_EDICT(OFS_PARM0);
+ if (ent->p.e->free)
+ PRVM_ERROR ("VM_parseentitydata: %s: Can only set already spawned entities (entity %i is free)!\n", PRVM_NAME, PRVM_NUM_FOR_EDICT(ent));
+
+ data = PRVM_G_STRING(OFS_PARM1);
+
+ // parse the opening brace
+ if (!COM_ParseToken(&data, false) || com_token[0] != '{' )
+ PRVM_ERROR ("VM_parseentitydata: %s: Couldn't parse entity data:\n%s\n", PRVM_NAME, data );
+
+ PRVM_ED_ParseEdict (data, ent);
+}
+
/*
=========
VM_loadfromfile
VM_search_end,
VM_search_getsize,
VM_search_getfilename, // 77
- VM_chr, //78
- 0,0,// 80
+ VM_chr,
+ VM_etof,
+ VM_ftoe,// 80
e10, // 90
e10, // 100
e100, // 200
VM_M_keynumtostring,
VM_M_findkeysforcommand,// 610
VM_M_gethostcachevalue,
- VM_M_gethostcachestring // 612
+ VM_M_gethostcachestring,
+ VM_M_parseentitydata // 613
};
const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t);
{
if (r_speeds.integer || gl_finish.integer)
qglFinish();
- hdc = GetDC(mainwindow);
- SwapBuffers(hdc);
- ReleaseDC(mainwindow, hdc);
+ if (qwglGetCurrentDC)
+ SwapBuffers(qwglGetCurrentDC());
+ else {
+ hdc = GetDC(mainwindow);
+ SwapBuffers(hdc);
+ ReleaseDC(mainwindow, hdc);
+ }
}
// handle the mouse state when windowed if that's changed
// COMMANDLINEOPTION: Windows WGL: -novideosync disables WGL_EXT_swap_control
gl_videosyncavailable = GL_CheckExtension("WGL_EXT_swap_control", wglswapintervalfuncs, "-novideosync", false);
- ReleaseDC(mainwindow, hdc);
+ //ReleaseDC(mainwindow, hdc);
GL_Init ();