1
0
Fork 0
forked from fte/fteqw
fteqw/engine/web/ftejslib.h
Spoike e99354bd20 fix playdemo not working straight after record.
make a guess at the currently applied preset. fix issues with vid_reload on preset changes being buggy.
fix erroneous weapon flashes due to limited precision.
try to fix rogue finale.
fix issue with vid_restart crashing with directinput active.
work around emscripten rand entropy, at least as far as particles are concerned.
properly implement te_explosion2 (for rogue mission pack).
drastically reduce submodel polyoffsets in the webgl port, because firefox's depth precision is 16 bit or something stupid.
fix rogue ibar background not being used with qw hud.
added terrain editor feature to edit the bsp's entity lump. this also works with .bsps. added console command to reload the map/apply those ent changes but leaving the players how they were (lets hope enemy etc stuff doesn't bug out...)
force-enabled airstep when travelling fast. this is to partly replicate nq player physics in order to fix windtunnels on r1m5 iirc.
added some more effects to the 'high' particle effect, in order to make rogue feel a little more loved.
fix for rogue buzzsaws.
rework webgl pointer locks.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4965 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-08-20 03:17:47 +00:00

53 lines
3.4 KiB
C

//emscripten's download mechanism lacks usable progress indicators.
void emscriptenfte_async_wget_data2(const char *url, void *ctx, void (*onload)(void*ctx,void*buf,int sz), void (*onerror)(void*ctx,int code), void (*onprogress)(void*ctx,int prog,int total));
//filesystem buffers are implemented in javascript so that we are not bound by power-of-two heap limitations quite so much.
//also, we can't use emscripten's stdio because it reserves 16m file handles or something.
//these buffers do not track file offsets nor file access permissions.
int emscriptenfte_buf_create(void);
int emscriptenfte_buf_open(const char *name, int createifneeded); //open
int emscriptenfte_buf_rename(const char *oldname, const char *newname); //rename files (if it was open, the handle now refers to the new file instead)
int emscriptenfte_buf_delete(const char *fname); //delete the named file. there may be problems if its currently open
void emscriptenfte_buf_release(int handle); //close
void emscriptenfte_buf_pushtolocalstore(int handle); //make a copy in the browser's local storage, if possible.
unsigned int emscriptenfte_buf_getsize(int handle); //get the size of the file buffer
int emscriptenfte_buf_read(int handle, int offset, void *data, int len);//read data
int emscriptenfte_buf_write(int handle, int offset, const void *data, int len);//write data. no access checks.
//websocket is implemented in javascript because there is no usable C api (emscripten's javascript implementation is shite and has fatal errors).
int emscriptenfte_ws_connect(const char *url); //open a websocket connect to a specific host
void emscriptenfte_ws_close(int sockid); //close it again
int emscriptenfte_ws_cansend(int sockid, int extra, int maxpending); //returns false if we're blocking for some reason. avoids overflowing. everything is otherwise reliable.
int emscriptenfte_ws_send(int sockid, const void *data, int len); //send data to the peer. queues data. never dropped.
int emscriptenfte_ws_recv(int sockid, void *data, int len); //receive data from the peer.
//misc stuff for printf replacements
void emscriptenfte_alert(const char *msg);
void emscriptenfte_print(const char *msg);
void emscriptenfte_setupmainloop(int(*mainloop)(void));
void emscriptenfte_abortmainloop(const char *caller);
//we're trying to avoid including libpng+libjpeg+libogg in javascript due to it being redundant bloat.
//to use such textures/sounds, we can just 'directly' load them via webgl
void emscriptenfte_gl_loadtexturefile(int gltexid, int *width, int *height, void *data, int datasize);
void emscriptenfte_al_loadaudiofile(int al_buf, void *data, int datasize);
//avoid all of emscripten's sdl emulation.
//this resolves input etc issues.
unsigned long emscriptenfte_ticks_ms(void);
void emscriptenfte_updatepointerlock(int wantpointerlock, int hidecursor);
void emscriptenfte_polljoyevents(void);
void emscriptenfte_settitle(const char *text);
int emscriptenfte_setupcanvas(
int width,
int height,
void(*Resized)(int newwidth, int newheight),
void(*Mouse)(int devid,int abs,float x,float y,float z,float size),
void(*Button)(int devid, int down, int mbutton),
int(*Keyboard)(int devid, int down, int keycode, int unicode),
void(*LoadFile)(char *url, char *mime, int filehandle),
void(*buttonevent)(int joydev, int button, int ispressed),
void(*axisevent)(int joydev, int axis, float value),
int (*ShouldSwitchToFullscreen)(void)
);