mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-14 00:10:46 +00:00
2e1a70e319
maplist command now generates links. implemented skin objects for q3. added a csqc builtin for it. also supports compositing skins. playing demos inside zips/pk3s/paks should now work. bumped default rate cvar. added cl_transfer to attempt to connect to a new server without disconnecting first. rewrote fog command. alpha and mindist arguments are now supported. fog change also happens over a short time period. added new args to the showpic console command. can now create clickable items for touchscreen/absmouse users. fixed menus to properly support right-aligned text. this finally fixes variable-width fonts. rewrote console tab completion suggestions display. now clickable links. strings obtained from qc are now marked as const. this has required quite a few added consts all over the place. probably crappy attempt at adding joypad support to the sdl port. no idea if it works. changed key bind event code. buttons now track which event they should trigger when released, instead of being the same one the whole time. this allows +forward etc clickable buttons on screen. Also simplified modifier keys - they no longer trigger random events when pressing the modifier key itself. Right modifiers can now be bound separately from left modifiers. Right will use left's binding if not otherwise bound. Bind assumes left if there's no prefix. multiplayer->setup->network menu no longer crashes. added rgb colours to the translation view (but not to the colour-changing keys). added modelviewer command to view models. added menu_mods menu to switch mods in a more friendly way. will be shown by default if multiple manifests exist in the binarydir. clamped classic tracer density. scrag particles no longer look quite so buggy. added ifdefs to facilitate a potential winrt port. the engine should now have no extra dependencies, but still needs system code+audio drivers to be written. if it can't set a renderer, it'll now try to use *every* renderer until it finds one that works. added experimental mapcluster server mode (that console command). New maps will be started up as required. rewrote skeletal blending code a bit. added cylinder geomtypes. fix cfg_save writing to the wrong path bug. VFS_CLOSE now returns a boolean. false means there was some sort of fatal error (either crc when reading was bad, or the write got corrupted or something). Typically ignorable, depends how robust you want to be. win32 tls code now supports running as a server. added connect tls://address support, as well as equivalent sv_addport support. exposed basic model loading api to plugins. d3d11 backend now optionally supports tessellation hlsl. no suitable hlsl provided by default. !!tess to enable. attempted to add gamma ramp support for d3d11. added support for shader blobs to speed up load times. r_shaderblobs 1 to enable. almost vital for d3d11. added vid_srgb cvar. shadowless lights are no longer disabled if shadows are not supported. attempt to add support for touchscreens in win7/8. Wrote gimmicky lua support, using lua instead of ssqc. define VM_LUA to enable. updated saved game code. can again load saved games from vanilla-like engines. changed scale clamping. 0.0001 should no longer appear as 1. changed default mintic from 0.03 to 0.013 to match vanilla qw. I don't know why it was at 0.03. probably a typo. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4623 fc73d0e0-1445-4013-8a0c-d673dee63da5
126 lines
4.5 KiB
C
126 lines
4.5 KiB
C
#ifndef SV_SQL_H
|
|
#define SV_SQL_H
|
|
|
|
#ifdef USE_MYSQL
|
|
#ifdef _WIN32
|
|
#include <windows.h>
|
|
#endif
|
|
#include <mysql/mysql.h>
|
|
#endif
|
|
#ifdef USE_SQLITE
|
|
typedef struct
|
|
{
|
|
char *ptr;
|
|
int len;
|
|
} sqliteresult_t;
|
|
#endif
|
|
|
|
#define SQL_CONNECT_STRUCTPARAMS 2
|
|
#define SQL_CONNECT_PARAMS 4
|
|
|
|
typedef enum
|
|
{
|
|
SQLDRV_MYSQL,
|
|
SQLDRV_SQLITE, /* NOT IN YET */
|
|
SQLDRV_INVALID
|
|
} sqldrv_t;
|
|
|
|
typedef struct queryrequest_s
|
|
{
|
|
int srvid;
|
|
int num; /* query number reference */
|
|
struct queryrequest_s *nextqueue; /* next request in queue */
|
|
struct queryrequest_s *nextreq; /* next request in queue */
|
|
struct queryresult_s *results; /* chain of received results */
|
|
enum
|
|
{
|
|
SR_NEW,
|
|
SR_PENDING,
|
|
SR_PARTIAL, //
|
|
SR_FINISHED, //waiting for close
|
|
SR_ABORTED //don't notify. destroy on finish.
|
|
} state; //maintained by main thread. worker *may* check for aborted state as a way to quickly generate an error.
|
|
qboolean (*callback)(struct queryrequest_s *req, int firstrow, int numrows, int numcols, qboolean eof); /* called on main thread once complete */
|
|
struct
|
|
{
|
|
qboolean persistant; /* persistant query */
|
|
int qccallback; /* callback function reference */
|
|
int selfent; /* self entity on call */
|
|
float selfid; /* self entity id on call */
|
|
int otherent; /* other entity on call */
|
|
float otherid; /* other entity id on call */
|
|
void *thread;
|
|
} user; /* sql code does not write anything in this struct */
|
|
char query[1]; /* query to run */
|
|
} queryrequest_t;
|
|
|
|
typedef struct queryresult_s
|
|
{
|
|
struct queryrequest_s *request; /* corresponding request */
|
|
struct queryresult_s *next; /* next result in queue */
|
|
int rows; /* rows contained in single result set */
|
|
int firstrow; /* 0 on first result block */
|
|
int columns; /* fields */
|
|
qboolean eof; /* end of query reached */
|
|
void *result; /* result set from mysql */
|
|
#if 0
|
|
char **resultset; /* stored result set from partial fetch */
|
|
#endif
|
|
char error[1]; /* error string, "" if none */
|
|
} queryresult_t;
|
|
|
|
typedef struct sqlserver_s
|
|
{
|
|
void *thread; /* worker thread for server */
|
|
sqldrv_t driver; /* driver type */
|
|
#ifdef USE_MYSQL
|
|
MYSQL *mysql; /* mysql server */
|
|
#endif
|
|
#ifdef USE_SQLITE
|
|
struct sqlite3 *sqlite;
|
|
#endif
|
|
volatile qboolean active; /* set to false to kill thread */
|
|
volatile qboolean terminated; /* set by the worker to say that it won't block (for long) and can be joined */
|
|
void *requestcondv; /* lock and conditional variable for queue read/write */
|
|
void *resultlock; /* mutex for queue read/write */
|
|
int querynum; /* next reference number for queries */
|
|
queryrequest_t *requests; /* list of pending and persistant requests */
|
|
queryrequest_t *requestqueue; /* query requests queue */
|
|
queryrequest_t *requestslast; /* query requests queue last link */
|
|
queryresult_t *results; /* query results queue */
|
|
queryresult_t *resultslast; /* query results queue last link */
|
|
queryresult_t *serverresult; /* most recent (orphaned) server error result */
|
|
char **connectparams; /* connect parameters (0 = host, 1 = user, 2 = pass, 3 = defaultdb) */
|
|
} sqlserver_t;
|
|
|
|
/* prototypes */
|
|
void SQL_Init(void);
|
|
void SQL_KillServers(void);
|
|
void SQL_DeInit(void);
|
|
|
|
sqlserver_t *SQL_GetServer (int serveridx, qboolean inactives);
|
|
queryrequest_t *SQL_GetQueryRequest (sqlserver_t *server, int queryidx);
|
|
queryresult_t *SQL_GetQueryResult (sqlserver_t *server, int queryidx, int row);
|
|
//void SQL_DeallocResult(sqlserver_t *server, queryresult_t *qres);
|
|
void SQL_ClosePersistantResult(sqlserver_t *server, queryresult_t *qres);
|
|
void SQL_CloseResult(sqlserver_t *server, queryresult_t *qres);
|
|
void SQL_CloseRequest(sqlserver_t *server, queryrequest_t *qres, qboolean force);
|
|
void SQL_CloseAllResults(sqlserver_t *server);
|
|
char *SQL_ReadField (sqlserver_t *server, queryresult_t *qres, int row, int col, qboolean fields, size_t *resultsize);
|
|
int SQL_NewServer(const char *driver, const char **paramstr);
|
|
int SQL_NewQuery(sqlserver_t *server, qboolean (*callback)(queryrequest_t *req, int firstrow, int numrows, int numcols, qboolean eof), char *str, queryrequest_t **reqout); //callback will be called on the main thread once the result is back
|
|
void SQL_Disconnect(sqlserver_t *server);
|
|
void SQL_Escape(sqlserver_t *server, const char *src, char *dst, int dstlen);
|
|
const char *SQL_Info(sqlserver_t *server);
|
|
qboolean SQL_Available(void);
|
|
void SQL_ServerCycle (void);
|
|
|
|
extern cvar_t sql_driver;
|
|
extern cvar_t sql_host;
|
|
extern cvar_t sql_username;
|
|
extern cvar_t sql_password;
|
|
extern cvar_t sql_defaultdb;
|
|
|
|
#define SQLCVAROPTIONS "SQL Defaults"
|
|
|
|
#endif
|