diff --git a/plugins/plugin.c b/plugins/plugin.c index e5af19e03..969c1bc6d 100644 --- a/plugins/plugin.c +++ b/plugins/plugin.c @@ -215,6 +215,13 @@ BUILTINR(int, Net_Send, (qhandle_t socket, void *buffer, int len)); BUILTIN(void, Net_Close, (qhandle_t socket)); #undef ARGNAMES +#define ARGNAMES ,inputbuffer,buffersize +BUILTINR(int, ReadInputBuffer, (void *inputbuffer, int buffersize)); +#undef ARGNAMES +#define ARGNAMES ,inputbuffer,bytes +BUILTINR(int, UpdateInputBuffer, (void *inputbuffer, int bytes)); +#undef ARGNAMES + #ifdef Q3_VM #define ARGNAMES ,out,in,len BUILTIN(void, memcpy, (void *out, void *in, int len)); @@ -232,6 +239,7 @@ BUILTINR(float, cos, (float f)); #undef ARGNAMES #endif + char *va(char *format, ...) //Identical in function to the one in Quake, though I can assure you that I wrote it... { //It's not exactly hard, just easy to use, so gets duplicated lots. va_list argptr; @@ -280,6 +288,9 @@ void Plug_InitStandardBuiltins(void) CHECKBUILTIN(Plug_ExportToEngine); CHECKBUILTIN(Sys_Error); + CHECKBUILTIN(ReadInputBuffer); + CHECKBUILTIN(UpdateInputBuffer); + #ifdef Q3_VM CHECKBUILTIN(memcpy); CHECKBUILTIN(memmove); diff --git a/plugins/plugin.h b/plugins/plugin.h index a083a594f..41518fdef 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -133,6 +133,7 @@ EBUILTIN(void, GetPluginName, (int plugnum, char *buffer, int bufsize)); EBUILTIN(void, LocalSound, (char *soundname)); EBUILTIN(void, CL_GetStats, (int pnum, unsigned int *stats, int maxstats)); EBUILTIN(int, GetPlayerInfo, (int pnum, plugclientinfo_t *info)); + EBUILTIN(int, LocalPlayerNumber, (void)); EBUILTIN(void, GetServerInfo, (char *info, int infolen)); EBUILTIN(void, SetUserInfo, (char *key, char *value)); @@ -154,6 +155,9 @@ EBUILTIN(void, Draw_Colour3f, (float r, float g, float b)); EBUILTIN(void, Draw_Colour4f, (float r, float g, float b, float a)); EBUILTIN(void, SCR_CenterPrint, (char *s)); +EBUILTIN(int, ReadInputBuffer, (void *inputbuffer, int buffersize)); +EBUILTIN(int, UpdateInputBuffer, (void *inputbuffer, int bytes)); + EBUILTIN(int, FS_Open, (char *name, qhandle_t *handle, int mode)); EBUILTIN(void, FS_Close, (qhandle_t handle)); EBUILTIN(int, FS_Write, (qhandle_t handle, void *data, int len)); @@ -170,6 +174,9 @@ EBUILTIN(void, Net_Close, (qhandle_t socket)); #define NET_SERVERPORT -2 +#if defined(_WIN32) || defined(Q3_VM) +int vsnprintf(char *buffer, int maxlen, char *format, va_list vargs); +#endif #ifdef Q3_VM EBUILTIN(void, memcpy, (void *, void *, int len)); @@ -189,6 +196,21 @@ void Sys_Errorf(char *format, ...); typedef unsigned char qbyte; void Q_strncpyz(char *d, const char *s, int n); + + + +#define PLUG_SHARED_BEGIN(t,p,b) \ + { \ + t *p; \ + char inputbuffer[8192]; \ + *(b) = ReadInputBuffer(inputbuffer, sizeof(inputbuffer)); \ + if (*(b)) \ + p = (t*)inputbuffer; \ + else \ + p = NULL; +#define PLUG_SHARED_END(p,b) UpdateInputBuffer(inputbuffer, b);} + + // // qvm_api.c //