after much breaking, the webgl port now utilises the browser's ogg/mp3 decoder, and the browser's png decompresser. pngs/jpegs do not provide size information.
fixed non-browser ogg decoding and openal logic. should finally be fixed, I guess. wasted some time on an ezhud plugin, along with ensuring certain info is available to the plugin. this is still a work in progress however. non-web builds are now able to download images from urls. download progress does not display for uri_get/uri_post builtins, nor other non-saved things. q1qvm logic now uses pr_maxedicts cvar. the gamecode api still provides no way to tell how many are permissable, so set at own risk. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4852 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
2201b920c8
commit
906b705bf0
75 changed files with 14968 additions and 302 deletions
|
@ -789,7 +789,7 @@ readit:
|
|||
}
|
||||
break;
|
||||
|
||||
case dem_set :
|
||||
case dem_set:
|
||||
if (readdemobytes (&demopos, &j, 4) != 4)
|
||||
{
|
||||
olddemotime = demtime;
|
||||
|
@ -800,6 +800,7 @@ readit:
|
|||
olddemotime = demtime;
|
||||
return 0;
|
||||
}
|
||||
cls.demostarttime = demtime;
|
||||
cls.netchan.outgoing_sequence = LittleLong(j);
|
||||
cls.netchan.incoming_sequence = LittleLong(i);
|
||||
cl.movesequence = cls.netchan.outgoing_sequence;
|
||||
|
@ -1658,6 +1659,7 @@ void CL_PlayDemoStream(vfsfile_t *file, struct dl_download *dl, char *filename,
|
|||
Netchan_Setup (NS_CLIENT, &cls.netchan, &net_from, 0);
|
||||
|
||||
demtime = -bufferdelay;
|
||||
cls.demostarttime = 0;
|
||||
cl.gametime = -bufferdelay;
|
||||
cl.gametimemark = realtime;//demtime;
|
||||
if (demtime < -0.5)
|
||||
|
|
|
@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
float in_sensitivityscale = 1;
|
||||
|
||||
void CL_SpareMsec_Callback (struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL CL_SpareMsec_Callback (struct cvar_s *var, char *oldvalue);
|
||||
|
||||
cvar_t cl_nodelta = CVAR("cl_nodelta","0");
|
||||
|
||||
|
@ -1011,7 +1011,7 @@ void CLNQ_SendMove (usercmd_t *cmd, int pnum, sizebuf_t *buf)
|
|||
}
|
||||
}
|
||||
|
||||
void Name_Callback(struct cvar_s *var, char *oldvalue)
|
||||
void QDECL Name_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
if (cls.state <= ca_connected)
|
||||
return;
|
||||
|
@ -1301,7 +1301,7 @@ void CL_UseIndepPhysics(qboolean allow)
|
|||
}
|
||||
#endif
|
||||
|
||||
void CL_SpareMsec_Callback (struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL CL_SpareMsec_Callback (struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
if (var->value > 50)
|
||||
{
|
||||
|
|
|
@ -28,8 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "shader.h"
|
||||
#include <ctype.h>
|
||||
// callbacks
|
||||
void CL_Sbar_Callback(struct cvar_s *var, char *oldvalue);
|
||||
void Name_Callback(struct cvar_s *var, char *oldvalue);
|
||||
void QDECL CL_Sbar_Callback(struct cvar_s *var, char *oldvalue);
|
||||
void QDECL Name_Callback(struct cvar_s *var, char *oldvalue);
|
||||
|
||||
// we need to declare some mouse variables here, because the menu system
|
||||
// references them even when on a unix system.
|
||||
|
@ -57,7 +57,7 @@ cvar_t cl_nopext = CVARF("cl_nopext", "0", CVAR_ARCHIVE);
|
|||
cvar_t cl_pext_mask = CVAR("cl_pext_mask", "0xffffffff");
|
||||
cvar_t cl_nolerp = CVARD("cl_nolerp", "0", "Disables interpolation. If set, missiles/monsters will be smoother, but they may be more laggy. Does not affect players. A value of 2 means 'interpolate only in single-player/coop'.");
|
||||
cvar_t cl_nolerp_netquake = CVARD("cl_nolerp_netquake", "0", "Disables interpolation when connected to an NQ server. Does affect players, even the local player. You probably don't want to set this.");
|
||||
cvar_t hud_tracking_show = CVAR("hud_tracking_show", "1");
|
||||
cvar_t *hud_tracking_show;
|
||||
extern cvar_t net_compress;
|
||||
|
||||
cvar_t cl_defaultport = CVARAFD("cl_defaultport", STRINGIFY(PORT_QWSERVER), "port", 0, "The default port to connect to servers.\nQW: "STRINGIFY(PORT_QWSERVER)", NQ: "STRINGIFY(PORT_NQSERVER)", Q2: "STRINGIFY(PORT_Q2SERVER)".");
|
||||
|
@ -3656,7 +3656,7 @@ void CL_Init (void)
|
|||
#endif
|
||||
Cvar_Register (&cl_countpendingpl, cl_controlgroup);
|
||||
Cvar_Register (&cl_threadedphysics, cl_controlgroup);
|
||||
Cvar_Register (&hud_tracking_show, "statusbar");
|
||||
hud_tracking_show = Cvar_Get("hud_tracking_show", "1", 0, "statusbar");
|
||||
Cvar_Register (&cl_download_mapsrc, cl_controlgroup);
|
||||
|
||||
Cvar_Register (&cl_dlemptyterminate, cl_controlgroup);
|
||||
|
|
|
@ -357,6 +357,59 @@ int CL_CalcNet (float scale)
|
|||
return percent;
|
||||
}
|
||||
|
||||
float CL_CalcNet2 (float *ping, float *ping_min, float *ping_max, float *ping_stddev)
|
||||
{
|
||||
int i;
|
||||
outframe_t *frame;
|
||||
int lost = 0;
|
||||
int pending = 0;
|
||||
int sent;
|
||||
int valid = 0;
|
||||
// char st[80];
|
||||
|
||||
*ping = 0;
|
||||
*ping_max = 0;
|
||||
*ping_min = 1000000000000;
|
||||
|
||||
sent = NET_TIMINGS;
|
||||
|
||||
for (i=cl.movesequence-UPDATE_BACKUP+1
|
||||
; i <= cl.movesequence
|
||||
; i++)
|
||||
{
|
||||
frame = &cl.outframes[i&UPDATE_MASK];
|
||||
if (i > cl.lastackedmovesequence)
|
||||
{ // no response yet
|
||||
if (cl_countpendingpl.ival)
|
||||
lost++;
|
||||
}
|
||||
else if (frame->latency == -1)
|
||||
lost++; // lost
|
||||
else if (frame->latency == -2)
|
||||
; // choked
|
||||
else if (frame->latency == -3)
|
||||
sent--; // c2spps
|
||||
// else if (frame->invalid)
|
||||
// packet_latency[i&NET_TIMINGSMASK] = 9998; // invalid delta
|
||||
else
|
||||
{
|
||||
*ping += frame->latency;
|
||||
if (*ping_max < frame->latency)
|
||||
*ping_max = frame->latency;
|
||||
if (*ping_min > frame->latency)
|
||||
*ping_min = frame->latency;
|
||||
valid++;
|
||||
}
|
||||
}
|
||||
|
||||
*ping /= valid;
|
||||
|
||||
if (pending == sent || sent < 1)
|
||||
return 1; //shouldn't ever happen.
|
||||
else
|
||||
return lost / sent;
|
||||
}
|
||||
|
||||
void CL_AckedInputFrame(int inseq, int outseq, qboolean worldstateokay)
|
||||
{
|
||||
unsigned int i;
|
||||
|
@ -427,7 +480,7 @@ qboolean CL_EnqueDownload(const char *filename, const char *localname, unsigned
|
|||
downloadlist_t *dl;
|
||||
qboolean webdl = false;
|
||||
char ext[8];
|
||||
if (!strncmp(filename, "http://", 7))
|
||||
if (!strncmp(filename, "http://", 7) || !strncmp(filename, "https://", 8))
|
||||
{
|
||||
if (!localname)
|
||||
return false;
|
||||
|
@ -5741,37 +5794,41 @@ void CL_ParsePrecache(void)
|
|||
}
|
||||
}
|
||||
|
||||
void CL_DumpPacket(void)
|
||||
void Con_HexDump(qbyte *packet, size_t len)
|
||||
{
|
||||
int i;
|
||||
char *packet = net_message.data;
|
||||
int pos;
|
||||
|
||||
pos = 0;
|
||||
while(pos < net_message.cursize)
|
||||
while(pos < len)
|
||||
{
|
||||
Con_Printf("%5i ", pos);
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
if (pos >= net_message.cursize)
|
||||
if (pos >= len)
|
||||
Con_Printf(" - ");
|
||||
else
|
||||
Con_Printf("%2x ", (unsigned char)packet[pos]);
|
||||
Con_Printf("%2x ", packet[pos]);
|
||||
pos++;
|
||||
}
|
||||
pos-=16;
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
if (pos >= net_message.cursize)
|
||||
if (pos >= len)
|
||||
Con_Printf("X");
|
||||
else if (packet[pos] == 0 || packet[pos] == '\t' || packet[pos] == '\r' || packet[pos] == '\n')
|
||||
Con_Printf(".");
|
||||
else
|
||||
Con_Printf("%c", (unsigned char)packet[pos]);
|
||||
Con_Printf("%c", packet[pos]);
|
||||
pos++;
|
||||
}
|
||||
Con_Printf("\n");
|
||||
}
|
||||
|
||||
}
|
||||
void CL_DumpPacket(void)
|
||||
{
|
||||
Con_HexDump(net_message.data, net_message.cursize);
|
||||
}
|
||||
|
||||
void CL_ParsePortalState(void)
|
||||
|
|
|
@ -208,6 +208,45 @@ static void Plug_FreePlugImages(plugin_t *plug)
|
|||
}
|
||||
}
|
||||
|
||||
//int R2D_ImageSize (qhandle_t image, float *w, float *h)
|
||||
static qintptr_t VARGS Plug_Draw_ImageSize(void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
float *w = VM_POINTER(arg[1]), *h = VM_POINTER(arg[2]);
|
||||
int iw, ih, ret;
|
||||
mpic_t *pic;
|
||||
int i;
|
||||
|
||||
if (VM_OOB(arg[1], sizeof(*w)) || VM_OOB(arg[2], sizeof(*w)))
|
||||
return -1;
|
||||
*w = 0;
|
||||
*h = 0;
|
||||
if (qrenderer == QR_NONE)
|
||||
return 0;
|
||||
|
||||
i = VM_LONG(arg[0]);
|
||||
if (i <= 0 || i > pluginimagearraylen)
|
||||
return -1; // you fool
|
||||
i = i - 1;
|
||||
if (pluginimagearray[i].plugin != currentplug)
|
||||
return -1;
|
||||
|
||||
if (pluginimagearray[i].pic)
|
||||
pic = pluginimagearray[i].pic;
|
||||
else if (pluginimagearray[i].type == 1)
|
||||
return 0; //wasn't loaded.
|
||||
else
|
||||
{
|
||||
pic = R2D_SafeCachePic(pluginimagearray[i].name);
|
||||
if (!pic)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = R_GetShaderSizes(pic, &iw, &ih, true);
|
||||
*w = iw;
|
||||
*h = ih;
|
||||
return ret;
|
||||
}
|
||||
|
||||
//int R2D_Image (float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t image)
|
||||
static qintptr_t VARGS Plug_Draw_Image(void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
|
@ -240,21 +279,7 @@ static qintptr_t VARGS Plug_Draw_Image(void *offset, quintptr_t mask, const qint
|
|||
//x1,y1,x2,y2
|
||||
static qintptr_t VARGS Plug_Draw_Line(void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
switch(qrenderer) //FIXME: I don't want qrenderer seen outside the refresh
|
||||
{
|
||||
#ifdef GLQUAKE
|
||||
case QR_OPENGL:
|
||||
qglDisable(GL_TEXTURE_2D);
|
||||
qglBegin(GL_LINES);
|
||||
qglVertex2f(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]));
|
||||
qglVertex2f(VM_FLOAT(arg[2]), VM_FLOAT(arg[3]));
|
||||
qglEnd();
|
||||
qglEnable(GL_TEXTURE_2D);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
R2D_Line(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), NULL);
|
||||
return 1;
|
||||
}
|
||||
static qintptr_t VARGS Plug_Draw_Character(void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
|
@ -431,16 +456,61 @@ static qintptr_t VARGS Plug_LocalPlayerNumber(void *offset, quintptr_t mask, con
|
|||
{
|
||||
return cl.playerview[0].playernum;
|
||||
}
|
||||
static qintptr_t VARGS Plug_GetLocalPlayerNumbers(void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
int i;
|
||||
int first = VM_LONG(arg[0]);
|
||||
int count = VM_LONG(arg[1]);
|
||||
int *playernums = VM_POINTER(arg[2]);
|
||||
int *spectracks = VM_POINTER(arg[3]);
|
||||
if (count < 0 || count > 1000) count = 0;
|
||||
if (VM_OOB(arg[2], sizeof(*playernums)*count) || VM_OOB(arg[3], sizeof(*playernums)*count))
|
||||
return false;
|
||||
if (first < 0) first = 0;
|
||||
if (first > cl.splitclients) first = cl.splitclients;
|
||||
if (first+count > cl.splitclients) count = cl.splitclients-first;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
playernums[i] = cl.playerview[i].playernum;
|
||||
spectracks[i] = Cam_TrackNum(&cl.playerview[i]);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static qintptr_t VARGS Plug_GetServerInfo(void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
char *outptr = VM_POINTER(arg[0]);
|
||||
unsigned int outlen = VM_LONG(arg[1]);
|
||||
extern float demtime;
|
||||
|
||||
if (VM_OOB(arg[0], outlen))
|
||||
return false;
|
||||
|
||||
Q_strncpyz(outptr, cl.serverinfo, outlen);
|
||||
Q_strncatz(outptr, va("\\intermission\\%i", cl.intermission), outlen);
|
||||
switch(cls.demoplayback)
|
||||
{
|
||||
case DPB_NONE:
|
||||
break;
|
||||
case DPB_MVD:
|
||||
case DPB_EZTV:
|
||||
Q_strncatz(outptr, "\\demotype\\mvd", outlen);
|
||||
break;
|
||||
case DPB_QUAKEWORLD:
|
||||
Q_strncatz(outptr, "\\demotype\\qw", outlen);
|
||||
break;
|
||||
#ifdef NQPROT
|
||||
case DPB_NETQUAKE:
|
||||
Q_strncatz(outptr, "\\demotype\\nq", outlen);
|
||||
break;
|
||||
#endif
|
||||
#ifdef Q2CLIENT
|
||||
case DPB_QUAKE2:
|
||||
Q_strncatz(outptr, "\\demotype\\q2", outlen);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
Q_strncatz(outptr, va("\\demotime\\%f", demtime-cls.demostarttime), outlen);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -455,6 +525,75 @@ static qintptr_t VARGS Plug_SetUserInfo(void *offset, quintptr_t mask, const qin
|
|||
return true;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
int seats;
|
||||
struct
|
||||
{
|
||||
float avg;
|
||||
float mn;
|
||||
float mx;
|
||||
float stddev;
|
||||
float loss;
|
||||
} ping;
|
||||
float mlatency;
|
||||
float mrate;
|
||||
float vlatency;
|
||||
float vrate;
|
||||
vec3_t speed; //player speed
|
||||
|
||||
struct
|
||||
{
|
||||
float in_pps;
|
||||
float in_bps;
|
||||
float out_pps;
|
||||
float out_bps;
|
||||
} clrate;
|
||||
struct
|
||||
{
|
||||
float in_pps;
|
||||
float in_bps;
|
||||
float out_pps;
|
||||
float out_bps;
|
||||
} svrate;
|
||||
} vmnetinfo_t;
|
||||
#define has(x) (((quintptr_t)&((vmnetinfo_t*)NULL)->x + sizeof(((vmnetinfo_t*)NULL)->x)) <= outlen)
|
||||
//aka: misc other hud timing crap
|
||||
static qintptr_t VARGS Plug_GetNetworkInfo(void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
vmnetinfo_t *outptr = VM_POINTER(arg[0]);
|
||||
unsigned int outlen = VM_LONG(arg[1]);
|
||||
if (VM_OOB(arg[0], outlen))
|
||||
return false;
|
||||
|
||||
if (has(seats))
|
||||
outptr->seats = cl.splitclients;
|
||||
if (has(ping))
|
||||
outptr->ping.loss = CL_CalcNet2 (&outptr->ping.avg, &outptr->ping.mn, &outptr->ping.mx, &outptr->ping.stddev);
|
||||
|
||||
if (has(mlatency))
|
||||
outptr->mlatency = 0;
|
||||
if (has(mrate))
|
||||
outptr->mrate = 0;
|
||||
if (has(vlatency))
|
||||
outptr->vlatency = 0;
|
||||
|
||||
if (has(speed))
|
||||
VectorCopy(outptr->speed, r_refdef.playerview->simvel);
|
||||
|
||||
if (has(clrate))
|
||||
NET_GetRates(cls.sockets, &outptr->clrate.in_pps, &outptr->clrate.out_pps, &outptr->clrate.in_bps, &outptr->clrate.out_bps);
|
||||
if (has(svrate))
|
||||
{
|
||||
memset(&outptr->svrate, 0, sizeof(outptr->svrate));
|
||||
#ifndef CLIENTONLY
|
||||
NET_GetRates(svs.sockets, &outptr->svrate.in_pps, &outptr->svrate.out_pps, &outptr->svrate.in_bps, &outptr->svrate.out_bps);
|
||||
#endif
|
||||
}
|
||||
|
||||
return sizeof(vmnetinfo_t);
|
||||
}
|
||||
#undef has
|
||||
|
||||
static qintptr_t VARGS Plug_GetLocationName(void *offset, quintptr_t mask, const qintptr_t *arg)
|
||||
{
|
||||
float *locpoint = VM_POINTER(arg[0]);
|
||||
|
@ -807,6 +946,7 @@ void Plug_Client_Init(void)
|
|||
Plug_RegisterBuiltin("Draw_LoadImageShader", Plug_Draw_LoadImageShader, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_LoadImage", Plug_Draw_LoadImagePic, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_Image", Plug_Draw_Image, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_ImageSize", Plug_Draw_ImageSize, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_Character", Plug_Draw_Character, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_String", Plug_Draw_String, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("Draw_Fill", Plug_Draw_Fill, PLUG_BIF_NEEDSRENDERER);
|
||||
|
@ -832,8 +972,10 @@ void Plug_Client_Init(void)
|
|||
Plug_RegisterBuiltin("GetLocationName", Plug_GetLocationName, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("GetPlayerInfo", Plug_GetPlayerInfo, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("LocalPlayerNumber", Plug_LocalPlayerNumber, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("GetLocalPlayerNumbers", Plug_GetLocalPlayerNumbers, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("GetServerInfo", Plug_GetServerInfo, PLUG_BIF_NEEDSRENDERER);
|
||||
Plug_RegisterBuiltin("SetUserInfo", Plug_SetUserInfo, PLUG_BIF_NEEDSRENDERER);
|
||||
// Plug_RegisterBuiltin("GetNetworkInfo", Plug_GetNetworkInfo, PLUG_BIF_NEEDSRENDERER);
|
||||
|
||||
Plug_RegisterBuiltin("S_RawAudio", Plug_S_RawAudio, PLUG_BIF_NEEDSRENDERER);
|
||||
|
||||
|
|
|
@ -1080,7 +1080,7 @@ void SCR_ShowPic_Script_f(void)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
void SCR_Fov_Callback (struct cvar_s *var, char *oldvalue)
|
||||
void QDECL SCR_Fov_Callback (struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
if (var->value < 10)
|
||||
{
|
||||
|
@ -1094,7 +1094,7 @@ void SCR_Fov_Callback (struct cvar_s *var, char *oldvalue)
|
|||
}
|
||||
}
|
||||
|
||||
void SCR_Viewsize_Callback (struct cvar_s *var, char *oldvalue)
|
||||
void QDECL SCR_Viewsize_Callback (struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
if (var->value < 30)
|
||||
{
|
||||
|
@ -1108,7 +1108,7 @@ void SCR_Viewsize_Callback (struct cvar_s *var, char *oldvalue)
|
|||
}
|
||||
}
|
||||
|
||||
void CL_Sbar_Callback(struct cvar_s *var, char *oldvalue)
|
||||
void QDECL CL_Sbar_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -477,6 +477,7 @@ typedef struct
|
|||
float td_lastframe; // to meter out one message a frame
|
||||
int td_startframe; // host_framecount at start
|
||||
float td_starttime; // realtime at second frame of timedemo
|
||||
float demostarttime; // the time of the first frame, so we don't get weird results with qw demos
|
||||
|
||||
int challenge;
|
||||
|
||||
|
@ -1087,6 +1088,7 @@ void CL_ParseQTVFile(vfsfile_t *f, const char *fname, qtvfile_t *result);
|
|||
#define NET_TIMINGSMASK 255
|
||||
extern int packet_latency[NET_TIMINGS];
|
||||
int CL_CalcNet (float scale);
|
||||
float CL_CalcNet2 (float *ping, float *ping_min, float *ping_max, float *ping_stddev);
|
||||
void CL_ClearParseState(void);
|
||||
void CL_Parse_Disconnected(void);
|
||||
void CL_DumpPacket(void);
|
||||
|
|
|
@ -1136,8 +1136,9 @@ int Con_DrawInput (console_t *con, qboolean focused, int left, int right, int y,
|
|||
maskedtext[p+cmdstart] = (unsigned int)fname[p] | (COLOR_GREEN<<CON_FGSHIFT);
|
||||
if (p < key_linepos-cmdstart)
|
||||
p = key_linepos-cmdstart;
|
||||
maskedtext[p+cmdstart] = 0;
|
||||
maskedtext[p+cmdstart+1] = 0;
|
||||
p = min(p+cmdstart, sizeof(maskedtext)/sizeof(maskedtext[0]) - 2);
|
||||
maskedtext[p] = 0;
|
||||
maskedtext[p+1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,19 +19,16 @@ char *r_defaultimageextensions =
|
|||
"dds " //compressed or something
|
||||
#endif
|
||||
"tga" //fairly fast to load
|
||||
#ifdef AVAIL_PNGLIB
|
||||
#if defined(AVAIL_PNGLIB) || defined(FTE_TARGET_WEB)
|
||||
" png" //pngs, fairly common, but slow
|
||||
#endif
|
||||
//" bmp" //wtf? at least not lossy
|
||||
#ifdef AVAIL_JPEGLIB
|
||||
#if defined(AVAIL_JPEGLIB) || defined(FTE_TARGET_WEB)
|
||||
" jpg" //q3 uses some jpegs, for some reason
|
||||
#endif
|
||||
#ifdef IMAGEFMT_BLP
|
||||
//" blp" //blizzard picture, for the luls
|
||||
#endif
|
||||
" pcx" //pcxes are the original gamedata of q2. So we don't want them to override pngs.
|
||||
;
|
||||
void R_ImageExtensions_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL R_ImageExtensions_Callback(struct cvar_s *var, char *oldvalue);
|
||||
cvar_t r_imageexensions = CVARCD("r_imageexensions", NULL, R_ImageExtensions_Callback, "The list of image file extensions which fte should attempt to load.");
|
||||
extern cvar_t gl_lerpimages;
|
||||
extern cvar_t gl_picmip2d;
|
||||
|
@ -2708,7 +2705,7 @@ static struct
|
|||
{
|
||||
char name[6];
|
||||
} tex_extensions[tex_extensions_max];
|
||||
void R_ImageExtensions_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL R_ImageExtensions_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
char *v = var->string;
|
||||
tex_extensions_count = 0;
|
||||
|
@ -3831,7 +3828,7 @@ qboolean Image_LoadTextureFromMemory(texid_t tex, int flags, const char *iname,
|
|||
COM_FileExtension(fname, ext, sizeof(ext));
|
||||
Q_strncatz(aname, "_alpha.", sizeof(aname));
|
||||
Q_strncatz(aname, ext, sizeof(aname));
|
||||
if ((alph = COM_LoadFile (aname, 5, &alphsize)))
|
||||
if (!strchr(aname, ':') && (alph = COM_LoadFile (aname, 5, &alphsize)))
|
||||
{
|
||||
if ((alphadata = Read32BitImageFile(alph, alphsize, &alpha_width, &alpha_height, &hasalpha, aname)))
|
||||
{
|
||||
|
@ -3859,6 +3856,28 @@ qboolean Image_LoadTextureFromMemory(texid_t tex, int flags, const char *iname,
|
|||
}
|
||||
BZ_Free(rgbadata);
|
||||
}
|
||||
#ifdef FTE_TARGET_WEB
|
||||
else if (1)
|
||||
{
|
||||
struct pendingtextureinfo *mips;
|
||||
mips = Z_Malloc(sizeof(*mips));
|
||||
mips->type = (flags & IF_3DMAP)?PTI_3D:PTI_2D;
|
||||
mips->mipcount = 1;
|
||||
mips->encoding = PTI_WHOLEFILE;
|
||||
mips->extrafree = NULL;
|
||||
mips->mip[0].width = 1;
|
||||
mips->mip[0].height = 1;
|
||||
mips->mip[0].data = filedata;
|
||||
mips->mip[0].datasize = filesize;
|
||||
mips->mip[0].needfree = true;
|
||||
//width+height are not yet known. bah.
|
||||
if (flags & IF_NOWORKER)
|
||||
Image_LoadTextureMips(tex, mips, 0, 0);
|
||||
else
|
||||
COM_AddWork(0, Image_LoadTextureMips, tex, mips, 0, 0);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
Sys_Printf("Unable to read file %s (format unsupported)\n", fname);
|
||||
|
||||
|
@ -4250,6 +4269,32 @@ image_t *Image_CreateTexture (const char *identifier, const char *subdir, unsign
|
|||
return image;
|
||||
}
|
||||
|
||||
//called on main thread. oh well.
|
||||
void Image_Downloaded(struct dl_download *dl)
|
||||
{
|
||||
qboolean success = false;
|
||||
image_t *tex = dl->user_ctx;
|
||||
image_t *p;
|
||||
|
||||
//make sure the renderer wasn't restarted mid-download
|
||||
for (p = imagelist; p; p = p->next)
|
||||
if (p == tex)
|
||||
break;
|
||||
if (p)
|
||||
{
|
||||
if (dl->status == DL_FINISHED)
|
||||
{
|
||||
size_t fsize = VFS_GETLEN(dl->file);
|
||||
char *buf = BZ_Malloc(fsize);
|
||||
if (VFS_READ(dl->file, buf, fsize) == fsize)
|
||||
if (Image_LoadTextureFromMemory(tex, tex->flags, tex->ident, dl->url, buf, fsize))
|
||||
success = true;
|
||||
}
|
||||
if (!success)
|
||||
Image_LoadTexture_Failed(tex, NULL, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//find a texture. will try to load it from disk, using the fallback if it would fail.
|
||||
image_t *Image_GetTexture(const char *identifier, const char *subpath, unsigned int flags, void *fallbackdata, void *fallbackpalette, int fallbackwidth, int fallbackheight, uploadfmt_t fallbackfmt)
|
||||
{
|
||||
|
@ -4348,7 +4393,19 @@ image_t *Image_GetTexture(const char *identifier, const char *subpath, unsigned
|
|||
Image_LoadHiResTextureWorker(tex, NULL, 0, 0);
|
||||
else
|
||||
{
|
||||
if (lowpri)
|
||||
if (!strncmp(tex->ident, "http://", 7) || !strncmp(tex->ident, "https://", 8))
|
||||
{
|
||||
struct dl_download *dl = HTTP_CL_Get(tex->ident, NULL, Image_Downloaded);
|
||||
dl->user_ctx = tex;
|
||||
dl->file = VFSPIPE_Open();
|
||||
dl->isquery = true;
|
||||
#ifdef MULTITHREAD
|
||||
DL_CreateThread(dl, NULL, NULL);
|
||||
#else
|
||||
tex->status = TEX_FAILED; //HACK: so nothing waits for it.
|
||||
#endif
|
||||
}
|
||||
else if (lowpri)
|
||||
COM_AddWork(5, Image_LoadHiResTextureWorker, tex, NULL, 0, 0);
|
||||
else
|
||||
COM_AddWork(2+(seq++%3), Image_LoadHiResTextureWorker, tex, NULL, 0, 0);
|
||||
|
@ -4417,7 +4474,7 @@ static void Image_ParseTextureMode(char *cvarname, char *modename, int modes[3])
|
|||
}
|
||||
Con_Printf("%s: mode %s was not recognised\n", cvarname, modename);
|
||||
}
|
||||
void Image_TextureMode_Callback (struct cvar_s *var, char *oldvalue)
|
||||
void QDECL Image_TextureMode_Callback (struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
int mip[3]={1,0,1}, pic[3]={1,-1,1}, mipcap[2] = {0, 1000};
|
||||
float anis = 1;
|
||||
|
|
|
@ -1362,12 +1362,15 @@ void INS_Accumulate (void)
|
|||
#endif
|
||||
{
|
||||
GetCursorPos (¤t_mouse_pos);
|
||||
SetCursorPos (window_center_x, window_center_y);
|
||||
|
||||
IN_MouseMove(sysmouse.qdeviceid, false, current_mouse_pos.x - window_center_x, current_mouse_pos.y - window_center_y, 0, 0);
|
||||
}
|
||||
|
||||
// force the mouse to the center, so there's room to move (rawinput ignore this apparently)
|
||||
SetCursorPos (window_center_x, window_center_y);
|
||||
else
|
||||
{
|
||||
// force the mouse to the center, so there's room to move (rawinput ignore this apparently)
|
||||
SetCursorPos (window_center_x, window_center_y);
|
||||
}
|
||||
}
|
||||
|
||||
if (!mouseactive)
|
||||
|
|
|
@ -60,7 +60,7 @@ qboolean keydown[K_MAX];
|
|||
char *releasecommand[K_MAX][MAX_INDEVS]; //this is the console command to be invoked when the key is released. should free it.
|
||||
qbyte releasecommandlevel[K_MAX][MAX_INDEVS]; //and this is the cbuf level it is to be run at.
|
||||
|
||||
void Con_Selectioncolour_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL Con_Selectioncolour_Callback(struct cvar_s *var, char *oldvalue);
|
||||
|
||||
extern cvar_t con_displaypossibilities;
|
||||
cvar_t con_selectioncolour = CVARFC("con_selectioncolour", "0", CVAR_RENDERERCALLBACK, Con_Selectioncolour_Callback);
|
||||
|
@ -488,7 +488,7 @@ int Con_ExecuteLine(console_t *con, char *line)
|
|||
|
||||
vec3_t sccolor;
|
||||
|
||||
void Con_Selectioncolour_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL Con_Selectioncolour_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
if (qrenderer != QR_NONE)
|
||||
SCR_StringToRGB(var->string, sccolor, 1);
|
||||
|
|
|
@ -3978,6 +3978,8 @@ static void S_MP3_Purge(sfx_t *sfx)
|
|||
if (dec->dstdata)
|
||||
BZ_Free(dec->dstdata);
|
||||
BZ_Free(dec);
|
||||
|
||||
sfx->loadstate = SLS_NOTLOADED;
|
||||
}
|
||||
|
||||
/*must be thread safe*/
|
||||
|
|
|
@ -85,6 +85,7 @@ void R2D_Image2dQuad(vec2_t points[], vec2_t texcoords[], mpic_t *pic);
|
|||
void R2D_ImageColours(float r, float g, float b, float a);
|
||||
void R2D_ImagePaletteColour(unsigned int i, float a);
|
||||
void R2D_FillBlock(float x, float y, float w, float h);
|
||||
void R2D_Line(float x1, float y1, float x2, float y2, mpic_t *pic);
|
||||
|
||||
extern void (*Draw_Init) (void);
|
||||
|
||||
|
@ -203,7 +204,10 @@ typedef enum uploadfmt
|
|||
TF_DEPTH24,
|
||||
TF_DEPTH32,
|
||||
TF_RGBA16F,
|
||||
TF_RGBA32F
|
||||
TF_RGBA32F,
|
||||
|
||||
/*for weird systems where the gl driver needs to do the decode (read: webgl)*/
|
||||
TF_SYSTEMDECODE
|
||||
} uploadfmt_t;
|
||||
|
||||
enum
|
||||
|
@ -286,6 +290,8 @@ struct pendingtextureinfo
|
|||
PTI_S3RGBA1,
|
||||
PTI_S3RGBA3,
|
||||
PTI_S3RGBA5,
|
||||
//weird specialcase mess to take advantage of webgl so we don't need redundant bloat where we're already strugging with potential heap limits
|
||||
PTI_WHOLEFILE,
|
||||
//depth formats
|
||||
PTI_DEPTH16,
|
||||
PTI_DEPTH24,
|
||||
|
|
|
@ -45,7 +45,7 @@ void Master_DetermineMasterTypes(void)
|
|||
#define MAX_MASTER_ADDRESSES 4 //each master might have multiple dns addresses, typically both ipv4+ipv6. we want to report to both address families so we work with remote single-stack hosts.
|
||||
|
||||
#ifndef CLIENTONLY
|
||||
void Net_Masterlist_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL Net_Masterlist_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void SV_SetMaster_f (void);
|
||||
#else
|
||||
#define Net_Masterlist_Callback NULL
|
||||
|
@ -149,7 +149,7 @@ void Net_Master_Init(void)
|
|||
|
||||
#ifndef CLIENTONLY
|
||||
|
||||
void Net_Masterlist_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL Net_Masterlist_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -2000,7 +2000,10 @@ void MasterInfo_Request(master_t *mast)
|
|||
{
|
||||
mast->dl = HTTP_CL_Get(mast->address, NULL, MasterInfo_ProcessHTTPJSON);
|
||||
if (mast->dl)
|
||||
{
|
||||
mast->dl->user_ctx = mast;
|
||||
mast->dl->isquery = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MT_MASTERHTTP:
|
||||
|
@ -2008,7 +2011,10 @@ void MasterInfo_Request(master_t *mast)
|
|||
{
|
||||
mast->dl = HTTP_CL_Get(mast->address, NULL, MasterInfo_ProcessHTTP);
|
||||
if (mast->dl)
|
||||
{
|
||||
mast->dl->user_ctx = mast;
|
||||
mast->dl->isquery = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
|
|
@ -367,7 +367,7 @@ extern cvar_t r_bloodstains;
|
|||
extern cvar_t gl_part_flame;
|
||||
|
||||
// callbacks
|
||||
static void R_ParticleDesc_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL R_ParticleDesc_Callback(struct cvar_s *var, char *oldvalue);
|
||||
|
||||
extern cvar_t r_particledesc;
|
||||
extern cvar_t r_part_rain_quantity;
|
||||
|
@ -3027,7 +3027,7 @@ static void R_Particles_KillAllEffects(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void R_ParticleDesc_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL R_ParticleDesc_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
char token[256];
|
||||
qboolean first;
|
||||
|
|
|
@ -4146,7 +4146,7 @@ typedef struct
|
|||
unsigned int maxents; //buffer size
|
||||
struct
|
||||
{
|
||||
unsigned short n; //don't rely on the ent->v->entnum
|
||||
unsigned int n; //don't rely on the ent->v->entnum
|
||||
csqcedict_t *e; //the csqc ent
|
||||
} *e;
|
||||
} csqcdelta_pack_t;
|
||||
|
|
|
@ -43,20 +43,20 @@ extern cvar_t vid_conautoscale;
|
|||
extern cvar_t vid_conheight;
|
||||
extern cvar_t vid_conwidth;
|
||||
extern cvar_t con_textsize;
|
||||
void R2D_Font_Callback(struct cvar_s *var, char *oldvalue);
|
||||
void R2D_Conautoscale_Callback(struct cvar_s *var, char *oldvalue);
|
||||
void R2D_ScreenAngle_Callback(struct cvar_s *var, char *oldvalue);
|
||||
void R2D_Conheight_Callback(struct cvar_s *var, char *oldvalue);
|
||||
void R2D_Conwidth_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL R2D_Font_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL R2D_Conautoscale_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL R2D_ScreenAngle_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL R2D_Conheight_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL R2D_Conwidth_Callback(struct cvar_s *var, char *oldvalue);
|
||||
|
||||
extern cvar_t crosshair;
|
||||
extern cvar_t crosshaircolor;
|
||||
extern cvar_t crosshairsize;
|
||||
extern cvar_t crosshairimage;
|
||||
extern cvar_t crosshairalpha;
|
||||
void R2D_Crosshair_Callback(struct cvar_s *var, char *oldvalue);
|
||||
void R2D_CrosshairImage_Callback(struct cvar_s *var, char *oldvalue);
|
||||
void R2D_CrosshairColor_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL R2D_Crosshair_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL R2D_CrosshairImage_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL R2D_CrosshairColor_Callback(struct cvar_s *var, char *oldvalue);
|
||||
|
||||
|
||||
//We need this for minor things though, so we'll just use the slow accurate method.
|
||||
|
@ -487,6 +487,29 @@ void R2D_FillBlock(float x, float y, float w, float h)
|
|||
BE_DrawMesh_Single(shader_draw_fill, &draw_mesh, NULL, &shader_draw_fill->defaulttextures, r2d_be_flags);
|
||||
}
|
||||
|
||||
void R2D_Line(float x1, float y1, float x2, float y2, shader_t *shader)
|
||||
{
|
||||
VectorSet(draw_mesh_xyz[0], x1, y1, 0);
|
||||
Vector2Set(draw_mesh_st[0], 0, 0);
|
||||
|
||||
VectorSet(draw_mesh_xyz[1], x2, y2, 0);
|
||||
Vector2Set(draw_mesh_st[1], 1, 0);
|
||||
|
||||
if (!shader)
|
||||
{
|
||||
if (draw_mesh_colors[0][3] != 1)
|
||||
shader = shader_draw_fill_trans;
|
||||
else
|
||||
shader = shader_draw_fill;
|
||||
}
|
||||
|
||||
draw_mesh.numvertexes = 2;
|
||||
draw_mesh.numindexes = 2;
|
||||
BE_DrawMesh_Single(shader, &draw_mesh, NULL, &shader->defaulttextures, BEF_LINES);
|
||||
draw_mesh.numvertexes = 4;
|
||||
draw_mesh.numindexes = 6;
|
||||
}
|
||||
|
||||
void R2D_ScalePic (float x, float y, float width, float height, mpic_t *pic)
|
||||
{
|
||||
R2D_Image(x, y, width, height, 0, 0, 1, 1, pic);
|
||||
|
@ -642,7 +665,7 @@ void R2D_TileClear (float x, float y, float w, float h)
|
|||
BE_DrawMesh_Single(draw_backtile, &draw_mesh, NULL, &draw_backtile->defaulttextures, r2d_be_flags);
|
||||
}
|
||||
|
||||
void R2D_Conback_Callback(struct cvar_s *var, char *oldvalue)
|
||||
void QDECL R2D_Conback_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
if (qrenderer == QR_NONE || !strcmp(var->string, "none"))
|
||||
{
|
||||
|
@ -823,7 +846,7 @@ void R2D_Font_Changed(void)
|
|||
font_console = font_default;
|
||||
}
|
||||
|
||||
void R2D_Font_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL R2D_Font_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
con_textsize.modified = true;
|
||||
}
|
||||
|
@ -909,7 +932,7 @@ void R2D_Console_Resize(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
void R2D_Conheight_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL R2D_Conheight_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
if (var->value > 1536) //anything higher is unreadable.
|
||||
{
|
||||
|
@ -925,7 +948,7 @@ void R2D_Conheight_Callback(struct cvar_s *var, char *oldvalue)
|
|||
R2D_Console_Resize();
|
||||
}
|
||||
|
||||
void R2D_Conwidth_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL R2D_Conwidth_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
//let let the user be too crazy
|
||||
if (var->value > 2048) //anything higher is unreadable.
|
||||
|
@ -942,12 +965,12 @@ void R2D_Conwidth_Callback(struct cvar_s *var, char *oldvalue)
|
|||
R2D_Console_Resize();
|
||||
}
|
||||
|
||||
void R2D_Conautoscale_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL R2D_Conautoscale_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
R2D_Console_Resize();
|
||||
}
|
||||
|
||||
void R2D_ScreenAngle_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL R2D_ScreenAngle_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
R2D_Console_Resize();
|
||||
}
|
||||
|
@ -1258,17 +1281,17 @@ void R2D_Crosshair_Update(void)
|
|||
|
||||
}
|
||||
|
||||
void R2D_CrosshairImage_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL R2D_CrosshairImage_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
R2D_Crosshair_Update();
|
||||
}
|
||||
|
||||
void R2D_Crosshair_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL R2D_Crosshair_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
R2D_Crosshair_Update();
|
||||
}
|
||||
|
||||
void R2D_CrosshairColor_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL R2D_CrosshairColor_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
SCR_StringToRGB(var->string, ch_color, 255);
|
||||
|
||||
|
|
|
@ -483,7 +483,7 @@ void R_Clutter_Purge(void)
|
|||
|
||||
|
||||
|
||||
void R_Rockettrail_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL R_Rockettrail_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
int i;
|
||||
model_t *mod;
|
||||
|
@ -501,7 +501,7 @@ void R_Rockettrail_Callback(struct cvar_s *var, char *oldvalue)
|
|||
}
|
||||
}
|
||||
|
||||
void R_Grenadetrail_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL R_Grenadetrail_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
int i;
|
||||
model_t *mod;
|
||||
|
@ -543,7 +543,7 @@ particleengine_t *particlesystem[] =
|
|||
NULL,
|
||||
};
|
||||
|
||||
void R_ParticleSystem_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL R_ParticleSystem_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
int i;
|
||||
if (pe)
|
||||
|
|
|
@ -1,9 +1,30 @@
|
|||
/*
|
||||
WARNING: THIS FILE IS GENERATED BY 'generatebuiltin.c'.
|
||||
YOU SHOULD NOT EDIT THIS FILE BY HAND
|
||||
*/
|
||||
|
||||
extern char *particle_set_spikeset;
|
||||
#define R_PARTSET_BUILTINS_spikeset {"spikeset", &particle_set_spikeset},
|
||||
extern char *particle_set_faithful;
|
||||
#define R_PARTSET_BUILTINS_faithful {"faithful", &particle_set_faithful},
|
||||
extern char *particle_set_highfps;
|
||||
#define R_PARTSET_BUILTINS_highfps {"highfps", &particle_set_highfps},
|
||||
extern char *particle_set_high;
|
||||
#define R_PARTSET_BUILTINS_high {"high", &particle_set_high},
|
||||
extern char *particle_set_minimal;
|
||||
#define R_PARTSET_BUILTINS_minimal {"minimal", &particle_set_minimal},
|
||||
#ifdef HEXEN2
|
||||
extern char *particle_set_h2part;
|
||||
#define R_PARTSET_BUILTINS_h2part {"h2part", &particle_set_h2part},
|
||||
#else
|
||||
#define R_PARTSET_BUILTINS_h2part
|
||||
#endif
|
||||
#ifdef Q2CLIENT
|
||||
extern char *particle_set_q2part;
|
||||
#define R_PARTSET_BUILTINS_q2part {"q2part", &particle_set_q2part},
|
||||
#else
|
||||
#define R_PARTSET_BUILTINS_q2part
|
||||
#endif
|
||||
extern char *particle_set_tsshaft;
|
||||
#define R_PARTSET_BUILTINS {"spikeset", &particle_set_spikeset},{"faithful", &particle_set_faithful},{"highfps", &particle_set_highfps},{"high", &particle_set_high},{"minimal", &particle_set_minimal},{"h2part", &particle_set_h2part},{"q2part", &particle_set_q2part},{"tsshaft", &particle_set_tsshaft},
|
||||
#define R_PARTSET_BUILTINS_tsshaft {"tsshaft", &particle_set_tsshaft},
|
||||
#define R_PARTSET_BUILTINS R_PARTSET_BUILTINS_spikeset R_PARTSET_BUILTINS_faithful R_PARTSET_BUILTINS_highfps R_PARTSET_BUILTINS_high R_PARTSET_BUILTINS_minimal R_PARTSET_BUILTINS_h2part R_PARTSET_BUILTINS_q2part R_PARTSET_BUILTINS_tsshaft
|
||||
|
|
|
@ -64,7 +64,7 @@ int Surf_LightmapShift (model_t *model)
|
|||
return lightmap_shift;
|
||||
}
|
||||
|
||||
void Surf_RebuildLightmap_Callback (struct cvar_s *var, char *oldvalue)
|
||||
void QDECL Surf_RebuildLightmap_Callback (struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
Mod_RebuildLightmaps();
|
||||
}
|
||||
|
|
|
@ -327,7 +327,7 @@ extern int numlightmaps;
|
|||
extern int lightmap_bytes; // 1, 3, or 4
|
||||
extern qboolean lightmap_bgra; /*true=bgra, false=rgba*/
|
||||
|
||||
void Surf_RebuildLightmap_Callback (struct cvar_s *var, char *oldvalue);
|
||||
void QDECL Surf_RebuildLightmap_Callback (struct cvar_s *var, char *oldvalue);
|
||||
|
||||
|
||||
void R_SetSky(char *skyname); /*override all sky shaders*/
|
||||
|
|
|
@ -35,9 +35,9 @@ unsigned int d_8to24bgrtable[256];
|
|||
extern int gl_anisotropy_factor;
|
||||
|
||||
// callbacks used for cvars
|
||||
void SCR_Viewsize_Callback (struct cvar_s *var, char *oldvalue);
|
||||
void SCR_Fov_Callback (struct cvar_s *var, char *oldvalue);
|
||||
void Image_TextureMode_Callback (struct cvar_s *var, char *oldvalue);
|
||||
void QDECL SCR_Viewsize_Callback (struct cvar_s *var, char *oldvalue);
|
||||
void QDECL SCR_Fov_Callback (struct cvar_s *var, char *oldvalue);
|
||||
void QDECL Image_TextureMode_Callback (struct cvar_s *var, char *oldvalue);
|
||||
|
||||
cvar_t vid_vsync = CVARAF ("vid_wait", "0",
|
||||
"vid_vsync", CVAR_ARCHIVE);
|
||||
|
|
|
@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "quakedef.h"
|
||||
#include "shader.h"
|
||||
|
||||
extern cvar_t hud_tracking_show;
|
||||
extern cvar_t *hud_tracking_show;
|
||||
|
||||
#define CON_ALTMASK (CON_2NDCHARSETTEXT|CON_WHITEMASK)
|
||||
|
||||
|
@ -2734,7 +2734,7 @@ void Sbar_Draw (playerview_t *pv)
|
|||
{
|
||||
if (pv->cam_auto != CAM_TRACK)
|
||||
{
|
||||
if (hud_tracking_show.ival || cl_sbar.ival)
|
||||
if (hud_tracking_show->ival || cl_sbar.ival)
|
||||
{ //this is annoying.
|
||||
Sbar_DrawPic (0, 0, 320, 24, sb_scorebar);
|
||||
Sbar_DrawString (160-7*8,4, "SPECTATOR MODE");
|
||||
|
@ -2750,7 +2750,7 @@ void Sbar_Draw (playerview_t *pv)
|
|||
else
|
||||
Sbar_DrawNormal (pv);
|
||||
|
||||
if (hud_tracking_show.ival)
|
||||
if (hud_tracking_show->ival)
|
||||
{
|
||||
Q_snprintfz(st, sizeof(st), "Tracking %-.64s",
|
||||
cl.players[pv->cam_spec_track].name);
|
||||
|
|
|
@ -133,6 +133,7 @@ static AL_API void (AL_APIENTRY *palSourceUnqueueBuffers)(ALuint source, ALsizei
|
|||
#define AL_ORIENTATION 0x100F
|
||||
#define AL_SOURCE_STATE 0x1010
|
||||
#define AL_PLAYING 0x1012
|
||||
#define AL_BUFFERS_QUEUED 0x1015
|
||||
#define AL_BUFFERS_PROCESSED 0x1016
|
||||
#define AL_REFERENCE_DISTANCE 0x1020
|
||||
#define AL_ROLLOFF_FACTOR 0x1021
|
||||
|
@ -285,10 +286,10 @@ extern int loaded_sfx;
|
|||
extern int num_sfx;
|
||||
|
||||
|
||||
static void OnChangeALMaxDistance (cvar_t *var, char *value);
|
||||
static void OnChangeALSpeedOfSound (cvar_t *var, char *value);
|
||||
static void OnChangeALDopplerFactor (cvar_t *var, char *value);
|
||||
static void OnChangeALDistanceModel (cvar_t *var, char *value);
|
||||
static void QDECL OnChangeALMaxDistance (cvar_t *var, char *value);
|
||||
static void QDECL OnChangeALSpeedOfSound (cvar_t *var, char *value);
|
||||
static void QDECL OnChangeALDopplerFactor (cvar_t *var, char *value);
|
||||
static void QDECL OnChangeALDistanceModel (cvar_t *var, char *value);
|
||||
/*
|
||||
static void S_Init_f(void);
|
||||
static void S_Info(void);
|
||||
|
@ -358,12 +359,19 @@ static void PrintALError(char *string)
|
|||
Con_Printf("OpenAL - %s: %x: %s\n",string,err,text);
|
||||
}
|
||||
|
||||
void OpenAL_LoadCache(unsigned int *bufptr, sfxcache_t *sc, float volume)
|
||||
qboolean OpenAL_LoadCache(unsigned int *bufptr, sfxcache_t *sc, float volume)
|
||||
{
|
||||
unsigned int fmt;
|
||||
unsigned int size;
|
||||
switch(sc->width)
|
||||
{
|
||||
#ifdef FTE_TARGET_WEB
|
||||
case 0:
|
||||
palGenBuffers(1, bufptr);
|
||||
emscriptenfte_al_loadaudiofile(*bufptr, sc->data, sc->length);
|
||||
//not allowed to play it yet, because it (probably) doesn't exist yet.
|
||||
return false;
|
||||
#endif
|
||||
case 1:
|
||||
if (sc->numchannels == 2)
|
||||
{
|
||||
|
@ -389,7 +397,7 @@ void OpenAL_LoadCache(unsigned int *bufptr, sfxcache_t *sc, float volume)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
PrintALError("pre Buffer Data");
|
||||
palGenBuffers(1, bufptr);
|
||||
|
@ -436,12 +444,22 @@ void OpenAL_LoadCache(unsigned int *bufptr, sfxcache_t *sc, float volume)
|
|||
free(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
short *tmp = malloc(size);
|
||||
memcpy(tmp, sc->data, size);
|
||||
palBufferData(*bufptr, fmt, tmp, size, sc->speed);
|
||||
free(tmp);
|
||||
#else
|
||||
palBufferData(*bufptr, fmt, sc->data, size, sc->speed);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
//FIXME: we need to handle oal-oom error codes
|
||||
|
||||
PrintALError("Buffer Data");
|
||||
return true;
|
||||
}
|
||||
|
||||
void OpenAL_CvarInit(void)
|
||||
|
@ -519,16 +537,35 @@ static void OpenAL_ChannelUpdate(soundcardinfo_t *sc, channel_t *chan, unsigned
|
|||
palSourceStop(src);
|
||||
|
||||
//reclaim any queued buffers
|
||||
palGetSourcei(src, AL_SOURCE_TYPE, &buf);
|
||||
if (buf == AL_STREAMING)
|
||||
if (src)
|
||||
{
|
||||
for(;;)
|
||||
palGetSourcei(src, AL_SOURCE_TYPE, &buf);
|
||||
if (buf == AL_STREAMING)
|
||||
{
|
||||
palGetSourcei(src, AL_BUFFERS_PROCESSED, &buf);
|
||||
if (!buf)
|
||||
break;
|
||||
palSourceUnqueueBuffers(src, 1, &buf);
|
||||
palDeleteBuffers(1, &buf);
|
||||
for(;;)
|
||||
{
|
||||
palGetSourcei(src, AL_BUFFERS_PROCESSED, &buf);
|
||||
if (!buf)
|
||||
break;
|
||||
palSourceUnqueueBuffers(src, 1, &buf);
|
||||
palDeleteBuffers(1, &buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!schanged && sfx
|
||||
#ifndef FTE_TARGET_WEB
|
||||
&& (chan->looping || (!sfx->decoder.decodedata && sfx->decoder.buf && ((sfxcache_t*)sfx->decoder.buf)->loopstart))
|
||||
#endif
|
||||
)
|
||||
{
|
||||
palGetSourcei(src, AL_SOURCE_STATE, &buf);
|
||||
if (buf != AL_PLAYING)
|
||||
{
|
||||
schanged = true;
|
||||
if (chan->looping)
|
||||
chan->pos = 0;
|
||||
else
|
||||
sfx = chan->sfx = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -560,47 +597,82 @@ static void OpenAL_ChannelUpdate(soundcardinfo_t *sc, channel_t *chan, unsigned
|
|||
if (!S_LoadSound(sfx))
|
||||
return; //can't load it
|
||||
if (sfx->loadstate != SLS_LOADED)
|
||||
{
|
||||
if (sfx->loadstate == SLS_LOADING)
|
||||
{
|
||||
palDeleteSources(1, &src);
|
||||
oali->source[chnum] = 0;
|
||||
}
|
||||
return; //not available yet
|
||||
}
|
||||
if (sfx->decoder.decodedata)
|
||||
{
|
||||
int offset;
|
||||
sfxcache_t sbuf, *sc = sfx->decoder.decodedata(sfx, &sbuf, chan->pos>>PITCHSHIFT, 65536);
|
||||
memcpy(&sbuf, sc, sizeof(sbuf));
|
||||
sfxcache_t sbuf, *sc;
|
||||
palGetSourcei(src, AL_BUFFERS_QUEUED, &buf);
|
||||
if (buf <= 2)
|
||||
{ //decode periodically instead of all at the start.
|
||||
sc = sfx->decoder.decodedata(sfx, &sbuf, chan->pos>>PITCHSHIFT, 65536);
|
||||
memcpy(&sbuf, sc, sizeof(sbuf));
|
||||
|
||||
//hack up the sound to offset it correctly
|
||||
offset = (chan->pos>>PITCHSHIFT) - sbuf.soundoffset;
|
||||
sbuf.data += offset * sc->width*sc->numchannels;
|
||||
sbuf.length -= offset;
|
||||
//hack up the sound to offset it correctly
|
||||
offset = (chan->pos>>PITCHSHIFT) - sbuf.soundoffset;
|
||||
sbuf.data += offset * sc->width*sc->numchannels;
|
||||
sbuf.length -= offset;
|
||||
|
||||
if (!sbuf.length && (chan->pos>>PITCHSHIFT) == sbuf.soundoffset)
|
||||
{
|
||||
chan->sfx = NULL;
|
||||
if (sfx->decoder.ended)
|
||||
if (!sbuf.length)// && (chan->pos>>PITCHSHIFT) == sbuf.soundoffset)
|
||||
{
|
||||
if (!S_IsPlayingSomewhere(sfx))
|
||||
sfx->decoder.ended(sfx);
|
||||
palGetSourcei(src, AL_SOURCE_STATE, &buf);
|
||||
if (buf != AL_PLAYING)
|
||||
{
|
||||
if (chan->looping)
|
||||
chan->pos = 0;
|
||||
else if(sbuf.loopstart != -1)
|
||||
chan->pos = sbuf.loopstart<<PITCHSHIFT;
|
||||
else
|
||||
{
|
||||
chan->sfx = NULL;
|
||||
if (sfx->decoder.ended)
|
||||
{
|
||||
if (!S_IsPlayingSomewhere(sfx))
|
||||
sfx->decoder.ended(sfx);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sbuf.soundoffset = 0;
|
||||
|
||||
//build a buffer with it and queue it up.
|
||||
//buffer will be purged later on when its unqueued
|
||||
OpenAL_LoadCache(&buf, &sbuf, max(1,cvolume));
|
||||
palSourceQueueBuffers(src, 1, &buf);
|
||||
|
||||
//yay
|
||||
chan->pos += sbuf.length<<PITCHSHIFT;
|
||||
|
||||
palGetSourcei(src, AL_SOURCE_STATE, &buf);
|
||||
if (buf != AL_PLAYING)
|
||||
schanged = true;
|
||||
}
|
||||
}
|
||||
sbuf.soundoffset = 0;
|
||||
|
||||
//build a buffer with it and queue it up.
|
||||
//buffer will be purged later on when its unqueued
|
||||
OpenAL_LoadCache(&buf, &sbuf, max(1,cvolume));
|
||||
palSourceQueueBuffers(src, 1, &buf);
|
||||
|
||||
//yay
|
||||
chan->pos += sbuf.length<<PITCHSHIFT;
|
||||
|
||||
palGetSourcei(src, AL_SOURCE_STATE, &buf);
|
||||
if (buf != AL_PLAYING)
|
||||
schanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenAL_LoadCache(&sfx->openal_buffer, sfx->decoder.buf, 1);
|
||||
if (!sfx->decoder.buf)
|
||||
return;
|
||||
if (!OpenAL_LoadCache(&sfx->openal_buffer, sfx->decoder.buf, 1))
|
||||
return;
|
||||
palSourcei(src, AL_BUFFER, sfx->openal_buffer);
|
||||
}
|
||||
}
|
||||
#ifdef FTE_TARGET_WEB
|
||||
//loading an ogg is async, so we must wait until its valid.
|
||||
else if (!palIsBuffer(sfx->openal_buffer))
|
||||
return;
|
||||
#endif
|
||||
else
|
||||
palSourcei(src, AL_BUFFER, sfx->openal_buffer);
|
||||
}
|
||||
|
@ -788,20 +860,20 @@ static qboolean OpenAL_Init(soundcardinfo_t *sc, const char *devname)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void OnChangeALMaxDistance (cvar_t *var, char *oldvalue)
|
||||
static void QDECL OnChangeALMaxDistance (cvar_t *var, char *oldvalue)
|
||||
{
|
||||
}
|
||||
static void OnChangeALSpeedOfSound (cvar_t *var, char *value)
|
||||
static void QDECL OnChangeALSpeedOfSound (cvar_t *var, char *value)
|
||||
{
|
||||
if (palSpeedOfSound)
|
||||
palSpeedOfSound(var->value);
|
||||
}
|
||||
static void OnChangeALDopplerFactor (cvar_t *var, char *oldvalue)
|
||||
static void QDECL OnChangeALDopplerFactor (cvar_t *var, char *oldvalue)
|
||||
{
|
||||
if (palDopplerFactor)
|
||||
palDopplerFactor(var->value);
|
||||
}
|
||||
static void OnChangeALDistanceModel (cvar_t *var, char *value)
|
||||
static void QDECL OnChangeALDistanceModel (cvar_t *var, char *oldvalue)
|
||||
{
|
||||
if (!palDistanceModel)
|
||||
return;
|
||||
|
|
|
@ -117,7 +117,7 @@ cvar_t snd_device = CVARAF( "s_device", "",
|
|||
cvar_t snd_device_opts = CVARFD( "_s_device_opts", "", CVAR_NOSET, "The possible audio output devices, in \"value\" \"description\" pairs, for gamecode to read.");
|
||||
|
||||
#ifdef VOICECHAT
|
||||
static void S_Voip_Play_Callback(cvar_t *var, char *oldval);
|
||||
static void QDECL S_Voip_Play_Callback(cvar_t *var, char *oldval);
|
||||
cvar_t snd_voip_capturedevice = CVARF("cl_voip_capturedevice", "", CVAR_ARCHIVE);
|
||||
cvar_t snd_voip_capturedevice_opts = CVARFD("_cl_voip_capturedevice_opts", "", CVAR_NOSET, "The possible audio capture devices, in \"value\" \"description\" pairs, for gamecode to read.");
|
||||
int voipbutton; //+voip, no longer part of cl_voip_send to avoid it getting saved
|
||||
|
@ -1332,7 +1332,7 @@ static void S_Voip_f(void)
|
|||
qspeex_preprocess_ctl(s_voip.speexdsp.preproc, SPEEX_PREPROCESS_SET_AGC_MAX_GAIN, &i);
|
||||
}
|
||||
}
|
||||
static void S_Voip_Play_Callback(cvar_t *var, char *oldval)
|
||||
static void QDECL S_Voip_Play_Callback(cvar_t *var, char *oldval)
|
||||
{
|
||||
if (cls.fteprotocolextensions2 & PEXT2_VOICECHAT)
|
||||
{
|
||||
|
@ -2571,6 +2571,9 @@ void S_Music_Clear(sfx_t *onlyifsample)
|
|||
sc->channel[i].pos = 0;
|
||||
sc->channel[i].sfx = NULL;
|
||||
|
||||
if (sc->ChannelUpdate)
|
||||
sc->ChannelUpdate(sc, &sc->channel[i], true);
|
||||
|
||||
if (s && s->decoder.ended && !S_IsPlayingSomewhere(s)) //if we aint playing it elsewhere, free it compleatly.
|
||||
s->decoder.ended(s);
|
||||
}
|
||||
|
|
|
@ -730,8 +730,31 @@ qboolean S_LoadWavSound (sfx_t *s, qbyte *data, int datalen, int sndspeed)
|
|||
|
||||
qboolean S_LoadOVSound (sfx_t *s, qbyte *data, int datalen, int sndspeed);
|
||||
|
||||
#ifdef FTE_TARGET_WEB
|
||||
//web browsers contain their own decoding libraries that our openal stuff can use.
|
||||
qboolean S_LoadBrowserFile (sfx_t *s, qbyte *data, int datalen, int sndspeed)
|
||||
{
|
||||
sfxcache_t *sc;
|
||||
s->decoder.buf = sc = BZ_Malloc(sizeof(sfxcache_t) + datalen);
|
||||
sc->data = (qbyte*)(sc+1);
|
||||
sc->length = datalen;
|
||||
sc->width = 0; //ie: not pcm
|
||||
sc->loopstart = -1;
|
||||
sc->speed = sndspeed;
|
||||
sc->numchannels = 2;
|
||||
sc->soundoffset = 0;
|
||||
memcpy(sc->data, data, datalen);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
//highest priority is last.
|
||||
S_LoadSound_t AudioInputPlugins[10] =
|
||||
{
|
||||
#ifdef FTE_TARGET_WEB
|
||||
S_LoadBrowserFile,
|
||||
#endif
|
||||
#ifdef AVAIL_OGGVORBIS
|
||||
S_LoadOVSound,
|
||||
#endif
|
||||
|
|
|
@ -226,7 +226,7 @@ void S_PaintChannels(soundcardinfo_t *sc, int endtime)
|
|||
else
|
||||
SND_PaintChannel8_O8I1(ch, scache, count);
|
||||
}
|
||||
else
|
||||
else if (scache->width == 2)
|
||||
{
|
||||
if (scache->numchannels==2)
|
||||
SND_PaintChannel16_O2I2(ch, scache, ltime-sc->paintedtime, count);
|
||||
|
|
|
@ -235,7 +235,7 @@ sfxcache_t *OV_DecodeSome(struct sfx_s *sfx, struct sfxcache_s *buf, int start,
|
|||
{
|
||||
buf->data = dec->decodedbuffer;
|
||||
buf->soundoffset = dec->decodedbytestart / (2 * dec->srcchannels);
|
||||
buf->length = dec->decodedbytecount;
|
||||
buf->length = dec->decodedbytecount / (2 * dec->srcchannels);
|
||||
buf->loopstart = -1;
|
||||
buf->numchannels = dec->srcchannels;
|
||||
buf->speed = snd_speed;
|
||||
|
@ -264,6 +264,7 @@ void OV_CancelDecoder(sfx_t *s)
|
|||
dec->decodedbuffer = NULL;
|
||||
|
||||
BZ_Free(dec);
|
||||
s->loadstate = SLS_NOTLOADED;
|
||||
}
|
||||
|
||||
static size_t VARGS read_func (void *ptr, size_t size, size_t nmemb, void *datasource)
|
||||
|
|
|
@ -3870,7 +3870,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
|||
*COM_SkipPath(bindir) = 0;
|
||||
parms.argv = (const char **)sys_argv;
|
||||
|
||||
host_parms.binarydir = bindir;
|
||||
parms.binarydir = bindir;
|
||||
COM_InitArgv (parms.argc, parms.argv);
|
||||
|
||||
c = COM_CheckParm("-qcdebug");
|
||||
|
|
|
@ -299,7 +299,7 @@ void V_DriftPitch (playerview_t *pv)
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
void V_Gamma_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL V_Gamma_Callback(struct cvar_s *var, char *oldvalue);
|
||||
|
||||
cshift_t cshift_empty = { {130,80,50}, 0 };
|
||||
cshift_t cshift_water = { {130,80,50}, 128 };
|
||||
|
@ -372,7 +372,7 @@ void BuildGammaTable (float g, float c, float b)
|
|||
V_CheckGamma
|
||||
=================
|
||||
*/
|
||||
void V_Gamma_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL V_Gamma_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
BuildGammaTable (v_gamma.value, v_contrast.value, v_brightness.value);
|
||||
V_UpdatePalette (true);
|
||||
|
|
|
@ -67,7 +67,7 @@ qboolean suppress;
|
|||
#define Q_rint(f) ((int)((f)+0.5))
|
||||
|
||||
// callbacks used for TP cvars
|
||||
void TP_SkinCvar_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL TP_SkinCvar_Callback(struct cvar_s *var, char *oldvalue);
|
||||
|
||||
//a list of all the cvars
|
||||
//this is down to the fact that I keep defining them but forgetting to register. :/
|
||||
|
@ -3441,7 +3441,7 @@ static void TP_MsgFilter_f (void)
|
|||
}
|
||||
}
|
||||
|
||||
void TP_SkinCvar_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL TP_SkinCvar_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
Skin_FlushPlayers();
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define AVAIL_DSOUND
|
||||
#define AVAIL_D3D
|
||||
#endif
|
||||
//#define AVAIL_XZDEC
|
||||
|
||||
#if !defined(MINIMAL) && !defined(NPFTE) && !defined(NPQTV)
|
||||
#if defined(_WIN32) && !defined(FTE_SDL) && !defined(WINRT)
|
||||
|
@ -140,6 +141,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#endif
|
||||
#ifdef NO_ZLIB
|
||||
#undef AVAIL_ZLIB
|
||||
#undef AVAIL_XZDEC
|
||||
#endif
|
||||
#ifdef NO_OGG
|
||||
#undef AVAIL_OGGVORBIS
|
||||
|
@ -276,7 +278,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define FULLENGINENAME "FTE QuakeWorld" //the posh name for the engine
|
||||
#endif
|
||||
#ifndef ENGINEWEBSITE
|
||||
#define ENGINEWEBSITE "http://www.fteqw.com" //url for program
|
||||
#define ENGINEWEBSITE "http://fte.triptohell.info" //url for program
|
||||
#endif
|
||||
|
||||
#ifdef QUAKETC
|
||||
|
|
|
@ -596,8 +596,6 @@ typedef enum {
|
|||
LOG_RCON,
|
||||
LOG_TYPES
|
||||
} logtype_t;
|
||||
void Log_Dir_Callback (struct cvar_s *var, char *oldvalue);
|
||||
void Log_Name_Callback (struct cvar_s *var, char *oldvalue);
|
||||
void Log_String (logtype_t lognum, char *s);
|
||||
void Con_Log (char *s);
|
||||
void Log_Logfile_f (void);
|
||||
|
|
|
@ -801,6 +801,22 @@ cvar_t *Cvar_SetCore (cvar_t *var, const char *value, qboolean force)
|
|||
var->value = Q_atof (var->string);
|
||||
var->ival = Q_atoi (var->string);
|
||||
|
||||
{
|
||||
char *str = COM_Parse(var->string);
|
||||
var->vec4[0] = atof(com_token);
|
||||
str = COM_Parse(str);
|
||||
var->vec4[1] = atof(com_token);
|
||||
str = COM_Parse(str);
|
||||
var->vec4[2] = atof(com_token);
|
||||
if (!str || !*str)
|
||||
var->vec4[3] = 1;
|
||||
else
|
||||
{
|
||||
str = COM_Parse(str);
|
||||
var->vec4[3] = atof(com_token);
|
||||
}
|
||||
}
|
||||
|
||||
if (latch)
|
||||
{
|
||||
if (strcmp(latch, value))
|
||||
|
@ -1364,7 +1380,7 @@ void Cvar_WriteVariables (vfsfile_t *f, qboolean all)
|
|||
}
|
||||
}
|
||||
|
||||
void Cvar_Hook(cvar_t *cvar, void (*callback) (struct cvar_s *var, char *oldvalue))
|
||||
void Cvar_Hook(cvar_t *cvar, void (QDECL *callback) (struct cvar_s *var, char *oldvalue))
|
||||
{
|
||||
cvar->callback = callback;
|
||||
}
|
||||
|
@ -1398,7 +1414,7 @@ void Cvar_ApplyCallbacks(int callbackflag)
|
|||
}
|
||||
|
||||
// standard callbacks
|
||||
void Cvar_Limiter_ZeroToOne_Callback(struct cvar_s *var, char *oldvalue)
|
||||
void QDECL Cvar_Limiter_ZeroToOne_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
if (var->value > 1)
|
||||
{
|
||||
|
|
|
@ -69,13 +69,14 @@ typedef struct cvar_s
|
|||
//free style :)
|
||||
char *name2;
|
||||
|
||||
void (*callback) (struct cvar_s *var, char *oldvalue);
|
||||
void (QDECL *callback) (struct cvar_s *var, char *oldvalue);
|
||||
char *description;
|
||||
char *enginevalue; //when changing manifest dir, the cvar will be reset to this value. never freed.
|
||||
char *defaultstr; //this is the current mod's default value. set on first update.
|
||||
|
||||
|
||||
int ival;
|
||||
vec4_t vec4; //0,0,0,1 if something didn't parse.
|
||||
qbyte restriction;
|
||||
|
||||
#ifdef HLSERVER
|
||||
|
@ -174,7 +175,7 @@ void Cvar_ConfigChanged(void);
|
|||
int Cvar_ApplyLatches(int latchflag);
|
||||
//sets vars to their latched values
|
||||
|
||||
void Cvar_Hook(cvar_t *cvar, void (*callback) (struct cvar_s *var, char *oldvalue));
|
||||
void Cvar_Hook(cvar_t *cvar, void (QDECL *callback) (struct cvar_s *var, char *oldvalue));
|
||||
//hook a cvar with a given callback function at runtime
|
||||
|
||||
void Cvar_Unhook(cvar_t *cvar);
|
||||
|
@ -186,7 +187,7 @@ void Cvar_ForceCallback(cvar_t *cvar);
|
|||
void Cvar_ApplyCallbacks(int callbackflag);
|
||||
//forces callbacks to be ran for given flags
|
||||
|
||||
void Cvar_Limiter_ZeroToOne_Callback(struct cvar_s *var, char *oldvalue);
|
||||
void QDECL Cvar_Limiter_ZeroToOne_Callback(struct cvar_s *var, char *oldvalue);
|
||||
//cvar callback to limit cvar value to 0 or 1
|
||||
|
||||
float Cvar_VariableValue (const char *var_name);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "winquake.h"
|
||||
#endif
|
||||
|
||||
static void fs_game_callback(cvar_t *var, char *oldvalue);
|
||||
static void QDECL fs_game_callback(cvar_t *var, char *oldvalue);
|
||||
hashtable_t filesystemhash;
|
||||
qboolean com_fschanged = true;
|
||||
qboolean com_installer = false;
|
||||
|
@ -31,7 +31,7 @@ static int fs_referencetype;
|
|||
int fs_finds;
|
||||
void COM_CheckRegistered (void);
|
||||
|
||||
static void fs_game_callback(cvar_t *var, char *oldvalue)
|
||||
static void QDECL fs_game_callback(cvar_t *var, char *oldvalue)
|
||||
{
|
||||
static qboolean runaway = false;
|
||||
char buf[MAX_OSPATH];
|
||||
|
@ -4209,9 +4209,15 @@ qboolean FS_ChangeGame(ftemanifest_t *man, qboolean allowreloadconfigs, qboolean
|
|||
confpath[i] = loc.search?loc.search->handle:NULL;
|
||||
}
|
||||
|
||||
#if defined(NACL) || defined(FTE_TARGET_WEB) || defined(ANDROID) || defined(WINRT)
|
||||
//these targets are considered to be sandboxed already, and have their own app-based base directory which they will always use.
|
||||
Q_strncpyz (newbasedir, host_parms.basedir, sizeof(newbasedir));
|
||||
fixedbasedir = true;
|
||||
#else
|
||||
i = COM_CheckParm ("-basedir");
|
||||
fixedbasedir = i && i < com_argc-1;
|
||||
Q_strncpyz (newbasedir, fixedbasedir?com_argv[i+1]:host_parms.basedir, sizeof(newbasedir));
|
||||
#endif
|
||||
|
||||
//make sure it has a trailing slash, or is empty. woo.
|
||||
FS_CleanDir(newbasedir, sizeof(newbasedir));
|
||||
|
@ -4409,7 +4415,7 @@ qboolean FS_ChangeGame(ftemanifest_t *man, qboolean allowreloadconfigs, qboolean
|
|||
#endif
|
||||
|
||||
{
|
||||
void (*callback)(struct cvar_s *var, char *oldvalue) = fs_game.callback;
|
||||
void (QDECL *callback)(struct cvar_s *var, char *oldvalue) = fs_game.callback;
|
||||
fs_game.callback = NULL;
|
||||
Cvar_ForceSet(&fs_game, FS_GetGamedir(false));
|
||||
fs_game.callback = callback;
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#include "quakedef.h"
|
||||
|
||||
// cvar callbacks
|
||||
void Log_Dir_Callback (struct cvar_s *var, char *oldvalue);
|
||||
void Log_Name_Callback (struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL Log_Dir_Callback (struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL Log_Name_Callback (struct cvar_s *var, char *oldvalue);
|
||||
|
||||
// cvars
|
||||
#define CONLOGGROUP "Console logging"
|
||||
|
@ -32,7 +32,7 @@ qboolean log_newline[LOG_TYPES];
|
|||
extern char gamedirfile[];
|
||||
|
||||
// Log_Dir_Callback: called when a log_dir is changed
|
||||
void Log_Dir_Callback (struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL Log_Dir_Callback (struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
char *t = var->string;
|
||||
char *e = t + (*t?strlen(t):0);
|
||||
|
@ -47,7 +47,7 @@ void Log_Dir_Callback (struct cvar_s *var, char *oldvalue)
|
|||
}
|
||||
|
||||
// Log_Name_Callback: called when a log_name is changed
|
||||
void Log_Name_Callback (struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL Log_Name_Callback (struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
char *t = var->string;
|
||||
|
||||
|
|
|
@ -5540,7 +5540,7 @@ qboolean NET_WasSpecialPacket(netsrc_t netsrc)
|
|||
return false;
|
||||
}
|
||||
|
||||
void NET_UPNPIGP_Callback(cvar_t *var, char *oldval)
|
||||
static void QDECL NET_UPNPIGP_Callback(cvar_t *var, char *oldval)
|
||||
{
|
||||
}
|
||||
cvar_t net_upnpigp = CVARCD("net_upnpigp", "0", NET_UPNPIGP_Callback, "If set, enables the use of the upnp-igd protocol to punch holes in your local NAT box.");
|
||||
|
@ -5642,42 +5642,42 @@ void NET_InitClient(void)
|
|||
|
||||
#ifndef CLIENTONLY
|
||||
#ifdef HAVE_IPV4
|
||||
void SV_Tcpport_Callback(struct cvar_s *var, char *oldvalue)
|
||||
void QDECL SV_Tcpport_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
FTENET_AddToCollection(svs.sockets, var->name, var->string, NA_TCP, true);
|
||||
}
|
||||
cvar_t sv_port_tcp = CVARC("sv_port_tcp", "", SV_Tcpport_Callback);
|
||||
#endif
|
||||
#ifdef IPPROTO_IPV6
|
||||
void SV_Tcpport6_Callback(struct cvar_s *var, char *oldvalue)
|
||||
void QDECL SV_Tcpport6_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
FTENET_AddToCollection(svs.sockets, var->name, var->string, NA_TCPV6, true);
|
||||
}
|
||||
cvar_t sv_port_tcp6 = CVARC("sv_port_tcp6", "", SV_Tcpport6_Callback);
|
||||
#endif
|
||||
#ifdef HAVE_IPV4
|
||||
void SV_Port_Callback(struct cvar_s *var, char *oldvalue)
|
||||
void QDECL SV_Port_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
FTENET_AddToCollection(svs.sockets, var->name, var->string, NA_IP, true);
|
||||
}
|
||||
cvar_t sv_port_ipv4 = CVARC("sv_port", STRINGIFY(PORT_QWSERVER), SV_Port_Callback);
|
||||
#endif
|
||||
#ifdef IPPROTO_IPV6
|
||||
void SV_PortIPv6_Callback(struct cvar_s *var, char *oldvalue)
|
||||
void QDECL SV_PortIPv6_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
FTENET_AddToCollection(svs.sockets, var->name, var->string, NA_IPV6, true);
|
||||
}
|
||||
cvar_t sv_port_ipv6 = CVARC("sv_port_ipv6", "", SV_PortIPv6_Callback);
|
||||
#endif
|
||||
#ifdef USEIPX
|
||||
void SV_PortIPX_Callback(struct cvar_s *var, char *oldvalue)
|
||||
void QDECL SV_PortIPX_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
FTENET_AddToCollection(svs.sockets, var->name, var->string, NA_IPX, true);
|
||||
}
|
||||
cvar_t sv_port_ipx = CVARC("sv_port_ipx", "", SV_PortIPX_Callback);
|
||||
#endif
|
||||
#ifdef HAVE_NATPMP
|
||||
void SV_Port_NatPMP_Callback(struct cvar_s *var, char *oldvalue)
|
||||
void QDECL SV_Port_NatPMP_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
FTENET_AddToCollection(svs.sockets, var->name, va("natpmp://%s", var->string), NA_NATPMP, true);
|
||||
}
|
||||
|
|
|
@ -514,6 +514,8 @@ static qintptr_t VARGS Plug_Cvar_GetNVFDG(void *offset, quintptr_t mask, const q
|
|||
char *description = VM_POINTER(arg[3]);
|
||||
char *groupname = VM_POINTER(arg[4]);
|
||||
|
||||
if (!defaultvalue)
|
||||
return (qintptr_t)Cvar_FindVar(name);
|
||||
return (qintptr_t)Cvar_Get2(name, defaultvalue, flags&1, description, groupname);
|
||||
}
|
||||
|
||||
|
@ -1463,7 +1465,8 @@ void Plug_Tick(void)
|
|||
{
|
||||
if (currentplug->tick)
|
||||
{
|
||||
VM_Call(currentplug->vm, currentplug->tick, (int)(realtime*1000));
|
||||
float rt = realtime, st = cl.time;
|
||||
VM_Call(currentplug->vm, currentplug->tick, (int)(realtime*1000), *(int*)&(rt), *(int*)&(st));
|
||||
}
|
||||
}
|
||||
currentplug = oldplug;
|
||||
|
@ -1629,7 +1632,7 @@ void Plug_SBar(playerview_t *pv)
|
|||
return;
|
||||
|
||||
ret = 0;
|
||||
if (!plug_sbar.ival || cl.splitclients > 1)
|
||||
if (!plug_sbar.ival)
|
||||
currentplug = NULL;
|
||||
else
|
||||
{
|
||||
|
@ -1639,7 +1642,7 @@ void Plug_SBar(playerview_t *pv)
|
|||
{
|
||||
//if you don't use splitscreen, use a full videosize rect.
|
||||
R2D_ImageColours(1, 1, 1, 1); // ensure menu colors are reset
|
||||
ret |= VM_Call(currentplug->vm, currentplug->sbarlevel[0], pv-cl.playerview, r_refdef.vrect.x, r_refdef.vrect.y, r_refdef.vrect.width, r_refdef.vrect.height, sb_showscores+sb_showteamscores*2);
|
||||
ret |= VM_Call(currentplug->vm, currentplug->sbarlevel[0], pv-cl.playerview, (int)r_refdef.vrect.x, (int)r_refdef.vrect.y, (int)r_refdef.vrect.width, (int)r_refdef.vrect.height, sb_showscores+sb_showteamscores*2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4006,6 +4006,7 @@ void QCBUILTIN PF_uri_get (pubprogfuncs_t *prinst, struct globalvars_s *pr_glob
|
|||
dl->user_ctx = w;
|
||||
dl->user_float = id;
|
||||
dl->user_num = *w->g.self;
|
||||
dl->isquery = true;
|
||||
G_FLOAT(OFS_RETURN) = 1;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -128,9 +128,9 @@ int VM_FRead (char *dest, int quantity, int fnum, int owner)
|
|||
|
||||
return quantity;
|
||||
}
|
||||
/*
|
||||
void VM_fputs (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
int VM_FWrite (char *dest, int quantity, int fnum, int owner)
|
||||
{
|
||||
/*
|
||||
int fnum = G_FLOAT(OFS_PARM0);
|
||||
char *msg = PF_VarString(prinst, 1, pr_globals);
|
||||
int len = strlen(msg);
|
||||
|
@ -157,8 +157,49 @@ void VM_fputs (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
if (pf_fopen_files[fnum].len < pf_fopen_files[fnum].ofs + len)
|
||||
pf_fopen_files[fnum].len = pf_fopen_files[fnum].ofs + len;
|
||||
pf_fopen_files[fnum].ofs+=len;
|
||||
}
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
void VM_FSeek (int fnum, int offset, int seektype, int owner)
|
||||
{
|
||||
fnum--;
|
||||
if (fnum < 0 || fnum >= MAX_VM_FILES)
|
||||
return; //out of range
|
||||
if (vm_fopen_files[fnum].owner != owner)
|
||||
return; //cgs?
|
||||
if (!vm_fopen_files[fnum].data)
|
||||
return; //not open
|
||||
|
||||
switch(seektype)
|
||||
{
|
||||
case 0:
|
||||
offset = vm_fopen_files[fnum].ofs + offset;
|
||||
case 1:
|
||||
offset = vm_fopen_files[fnum].len + offset;
|
||||
break;
|
||||
default:
|
||||
case 2:
|
||||
offset = offset;
|
||||
break;
|
||||
}
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
if (offset > vm_fopen_files[fnum].len)
|
||||
offset = vm_fopen_files[fnum].len;
|
||||
vm_fopen_files[fnum].ofs = offset;
|
||||
}
|
||||
int VM_FTell (int fnum, int owner)
|
||||
{
|
||||
fnum--;
|
||||
if (fnum < 0 || fnum >= MAX_VM_FILES)
|
||||
return 0; //out of range
|
||||
if (vm_fopen_files[fnum].owner != owner)
|
||||
return 0; //cgs?
|
||||
if (!vm_fopen_files[fnum].data)
|
||||
return 0; //not open
|
||||
|
||||
return vm_fopen_files[fnum].ofs;
|
||||
}
|
||||
void VM_fcloseall (int owner)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
char sys_language[64] = "";
|
||||
struct language_s languages[MAX_LANGUAGES];
|
||||
|
||||
void TL_LanguageChanged(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL TL_LanguageChanged(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
#ifndef CLIENTONLY
|
||||
svs.language = TL_FindLanguage(var->string);
|
||||
|
|
|
@ -130,6 +130,9 @@ void Script_Get_File_And_Line(int handle, char *filename, int *line);
|
|||
#define VM_FS_APPEND2 3 //I don't know, don't ask me. look at q3 source
|
||||
int VM_fopen (char *name, int *handle, int fmode, int owner);
|
||||
int VM_FRead (char *dest, int quantity, int fnum, int owner);
|
||||
int VM_FWrite (char *dest, int quantity, int fnum, int owner);
|
||||
void VM_FSeek (int fnum, int offset, int seektype, int owner);
|
||||
int VM_FTell (int fnum, int owner);
|
||||
void VM_fclose (int fnum, int owner);
|
||||
void VM_fcloseall (int owner);
|
||||
int VM_GetFileList(char *path, char *ext, char *output, int buffersize);
|
||||
|
|
|
@ -56,6 +56,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bulletplug", "..\..\plugins
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "odeplug", "..\..\plugins\odeplug\odeplug.vcproj", "{ED16B405-BDCD-4EB8-BF70-761964301368}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ezhud", "..\..\plugins\ezhud\ezhud.vcproj", "{E475BFF0-6766-48BA-BE44-931C068AC5B0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
D3DDebug|Win32 = D3DDebug|Win32
|
||||
|
@ -736,6 +738,42 @@ Global
|
|||
{ED16B405-BDCD-4EB8-BF70-761964301368}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{ED16B405-BDCD-4EB8-BF70-761964301368}.Release|Win32.Build.0 = Release|Win32
|
||||
{ED16B405-BDCD-4EB8-BF70-761964301368}.Release|x64.ActiveCfg = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.D3DDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.D3DDebug|Win32.Build.0 = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.D3DDebug|x64.ActiveCfg = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.D3DRelease|Win32.ActiveCfg = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.D3DRelease|Win32.Build.0 = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.D3DRelease|x64.ActiveCfg = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.Debug Dedicated Server|Win32.ActiveCfg = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.Debug Dedicated Server|Win32.Build.0 = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.Debug Dedicated Server|x64.ActiveCfg = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.GLDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.GLDebug|Win32.Build.0 = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.GLDebug|x64.ActiveCfg = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.GLRelease|Win32.ActiveCfg = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.GLRelease|Win32.Build.0 = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.GLRelease|x64.ActiveCfg = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.MDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.MDebug|Win32.Build.0 = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.MDebug|x64.ActiveCfg = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.MinGLDebug|Win32.Build.0 = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.MinGLDebug|x64.ActiveCfg = Debug|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.MinGLRelease|Win32.ActiveCfg = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.MinGLRelease|Win32.Build.0 = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.MinGLRelease|x64.ActiveCfg = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.MRelease|Win32.ActiveCfg = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.MRelease|Win32.Build.0 = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.MRelease|x64.ActiveCfg = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.Release Dedicated Server|Win32.ActiveCfg = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.Release Dedicated Server|Win32.Build.0 = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.Release Dedicated Server|x64.ActiveCfg = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.Release|Win32.Build.0 = Release|Win32
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0}.Release|x64.ActiveCfg = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -755,6 +793,7 @@ Global
|
|||
{74542CA7-48C1-4664-9007-66F751131EA3} = {8CED01C6-2C61-4EC5-90B6-574D9756D773}
|
||||
{82285268-9C3B-44AD-BBE7-40670F9D2628} = {8CED01C6-2C61-4EC5-90B6-574D9756D773}
|
||||
{ED16B405-BDCD-4EB8-BF70-761964301368} = {8CED01C6-2C61-4EC5-90B6-574D9756D773}
|
||||
{E475BFF0-6766-48BA-BE44-931C068AC5B0} = {8CED01C6-2C61-4EC5-90B6-574D9756D773}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
AMDCaProjectFile = C:\Games\Quake\wip\engine\dotnet2005\CodeAnalyst\ftequake.caw
|
||||
|
|
|
@ -390,6 +390,12 @@ qboolean GL_LoadTextureMips(texid_t tex, struct pendingtextureinfo *mips)
|
|||
}
|
||||
switch(mips->encoding)
|
||||
{
|
||||
#ifdef FTE_TARGET_WEB
|
||||
case PTI_WHOLEFILE:
|
||||
if (!i)
|
||||
emscriptenfte_gl_loadtexturefile(tex->num, &tex->width, &tex->height, mips->mip[i].data, mips->mip[i].datasize);
|
||||
break;
|
||||
#endif
|
||||
case PTI_DEPTH16:
|
||||
qglTexImage2D(targface, j, gl_config.gles?GL_DEPTH_COMPONENT:GL_DEPTH_COMPONENT16_ARB, mips->mip[i].width, mips->mip[i].height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, mips->mip[i].data);
|
||||
break;
|
||||
|
|
|
@ -30,6 +30,7 @@ mpic_t *R2D_SafeCachePic (const char *path);
|
|||
mpic_t *R2D_SafePicFromWad (const char *name);
|
||||
void R2D_ImageColours(float r, float g, float b, float a);
|
||||
void R2D_Image(float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic);
|
||||
void R2D_Line(float x1, float y1, float x2, float y2, mpic_t *pic);
|
||||
void R2D_ScalePic (float x, float y, float width, float height, mpic_t *pic);
|
||||
void R2D_SubPic(float x, float y, float width, float height, mpic_t *pic, float srcx, float srcy, float srcwidth, float srcheight);
|
||||
void R2D_ConsoleBackground (int firstline, int lastline, qboolean forceopaque);
|
||||
|
@ -42,4 +43,4 @@ void R2D_Shutdown(void);
|
|||
void R2D_PolyBlend (void);
|
||||
void R2D_BrightenScreen (void);
|
||||
|
||||
void R2D_Conback_Callback(struct cvar_s *var, char *oldvalue);
|
||||
void QDECL R2D_Conback_Callback(struct cvar_s *var, char *oldvalue);
|
||||
|
|
|
@ -4345,7 +4345,7 @@ void QDECL R_BuildLegacyTexnums(shader_t *shader, const char *fallbackname, cons
|
|||
extern cvar_t r_shadow_bumpscale_basetexture;
|
||||
if (!TEXVALID(tex->bump) && *shader->mapname)
|
||||
tex->bump = R_LoadHiResTexture(va("%s_norm", shader->mapname), NULL, imageflags|IF_TRYBUMP);
|
||||
if (!TEXVALID(tex->bump))
|
||||
if (!TEXVALID(tex->bump) && (r_shadow_bumpscale_basetexture.ival||*imagename=='*'||gl_load24bit.ival))
|
||||
tex->bump = Image_GetTexture(va("%s_norm", imagename), subpath, imageflags|IF_TRYBUMP, (r_shadow_bumpscale_basetexture.ival||*imagename=='*')?mipdata[0]:NULL, palette, width, height, TF_HEIGHT8PAL);
|
||||
}
|
||||
|
||||
|
|
|
@ -1480,7 +1480,7 @@ qboolean VID_AttachGL (rendererstate_t *info)
|
|||
return true;
|
||||
}
|
||||
|
||||
void VID_Wait_Override_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL VID_Wait_Override_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
if (qwglSwapIntervalEXT && *vid_vsync.string)
|
||||
qwglSwapIntervalEXT(vid_vsync.value);
|
||||
|
@ -1524,7 +1524,7 @@ void GLVID_Recenter_f(void)
|
|||
}
|
||||
}
|
||||
|
||||
void VID_WndAlpha_Override_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL VID_WndAlpha_Override_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
//this code tells windows to use the alpha channel of the screen, but does really nasty things with the mouse such that its unplayable.
|
||||
//its not useful.
|
||||
|
@ -2109,6 +2109,7 @@ LONG WINAPI GLMainWndProc (
|
|||
{
|
||||
COPYDATASTRUCT *cds = (COPYDATASTRUCT*)lParam;
|
||||
Host_RunFile(cds->lpData, cds->cbData, NULL);
|
||||
lRet = 1;
|
||||
}
|
||||
break;
|
||||
case WM_KILLFOCUS:
|
||||
|
@ -2234,7 +2235,10 @@ LONG WINAPI GLMainWndProc (
|
|||
case WM_INPUT:
|
||||
// raw input handling
|
||||
if (!vid_initializing)
|
||||
{
|
||||
INS_RawInput_Read((HANDLE)lParam);
|
||||
lRet = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_USER:
|
||||
|
|
|
@ -1097,6 +1097,10 @@ qboolean DL_Decide(struct dl_download *dl)
|
|||
#endif /*!defined(NACL)*/
|
||||
|
||||
#ifdef MULTITHREAD
|
||||
static void HTTP_Wake_Think(void *ctx, void *data, size_t a, size_t b)
|
||||
{
|
||||
HTTP_CL_Think();
|
||||
}
|
||||
static int DL_Thread_Work(void *arg)
|
||||
{
|
||||
struct dl_download *dl = arg;
|
||||
|
@ -1118,6 +1122,9 @@ static int DL_Thread_Work(void *arg)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
COM_AddWork(0, HTTP_Wake_Think, NULL, NULL, 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1207,7 +1214,7 @@ struct dl_download *HTTP_CL_Get(const char *url, const char *localfile, void (*N
|
|||
activedownloads = newdl;
|
||||
|
||||
|
||||
if (!cls.download && localfile)
|
||||
if (!cls.download && localfile && !newdl->isquery)
|
||||
{
|
||||
cls.download = &newdl->qdownload;
|
||||
newdl->qdownload.method = DL_HTTP;
|
||||
|
@ -1269,7 +1276,7 @@ void HTTP_CL_Think(void)
|
|||
}
|
||||
link = &dl->next;
|
||||
|
||||
if (!cls.download)
|
||||
if (!cls.download && !dl->isquery)
|
||||
{
|
||||
cls.download = &dl->qdownload;
|
||||
dl->qdownload.method = DL_HTTP;
|
||||
|
|
|
@ -103,6 +103,7 @@ struct dl_download
|
|||
unsigned int user_num;
|
||||
float user_float;
|
||||
void *user_ctx;
|
||||
qboolean isquery; //will not be displayed in the download/progress bar stuff.
|
||||
|
||||
qdownload_t qdownload;
|
||||
|
||||
|
|
|
@ -2243,7 +2243,7 @@ int QCC_PR_FinishCompilation (void)
|
|||
{
|
||||
//not all of these will have a class defined, as some will be regular spawn functions, so don't error on that
|
||||
t = QCC_TypeForName(d->name+10);
|
||||
if (t)
|
||||
if (t && t->type == ev_entity)
|
||||
{
|
||||
QCC_PR_EmitClassFromFunction(d, t);
|
||||
pr_scope = NULL;
|
||||
|
@ -2354,7 +2354,7 @@ char *Sva(char *msg, ...)
|
|||
|
||||
#define PROGDEFS_MAX_SIZE 16384
|
||||
//write (to file buf) and add to the crc
|
||||
static void Add(char *p, unsigned short *crc, char *file)
|
||||
static void Add_WithCRC(char *p, unsigned short *crc, char *file)
|
||||
{
|
||||
char *s;
|
||||
int i = strlen(file);
|
||||
|
@ -2367,20 +2367,20 @@ static void Add(char *p, unsigned short *crc, char *file)
|
|||
}
|
||||
file[i]='\0';
|
||||
}
|
||||
#define ADD(p) Add(p, &crc, file)
|
||||
#define ADD_CRC(p) Add_WithCRC(p, &crc, file)
|
||||
//#define ADD(p) {char *s;int i = strlen(p);for(s=p;*s;s++,i++){QCC_CRC_ProcessByte(&crc, *s);file[i] = *s;}file[i]='\0';}
|
||||
|
||||
static void Add3(char *p, unsigned short *crc, char *file)
|
||||
static void Add_CrcOnly(char *p, unsigned short *crc, char *file)
|
||||
{
|
||||
char *s;
|
||||
for(s=p;*s;s++)
|
||||
QCC_CRC_ProcessByte(crc, *s);
|
||||
}
|
||||
#define ADD3(p) Add3(p, &crc, file)
|
||||
#define EAT_CRC(p) Add_CrcOnly(p, &crc, file)
|
||||
|
||||
unsigned short QCC_PR_WriteProgdefs (char *filename)
|
||||
{
|
||||
#define ADD2(p) QC_strlcat(file, p, sizeof(file)) //no crc (later changes)
|
||||
#define ADD_ONLY(p) QC_strlcat(file, p, sizeof(file)) //no crc (later changes)
|
||||
char file[PROGDEFS_MAX_SIZE];
|
||||
QCC_def_t *d;
|
||||
int f;
|
||||
|
@ -2393,20 +2393,16 @@ unsigned short QCC_PR_WriteProgdefs (char *filename)
|
|||
|
||||
// print global vars until the first field is defined
|
||||
|
||||
//ADD: crc and dump
|
||||
//ADD2: dump but don't crc
|
||||
//ADD3: crc but don't dump
|
||||
|
||||
ADD("\n/* ");
|
||||
ADD_CRC("\n/* ");
|
||||
if (qcc_targetformat == QCF_HEXEN2 || qcc_targetformat == QCF_FTEH2)
|
||||
ADD3("generated by hcc, do not modify");
|
||||
EAT_CRC("generated by hcc, do not modify");
|
||||
else
|
||||
ADD3("file generated by qcc, do not modify");
|
||||
ADD2("File generated by FTEQCC, relevent for engine modding only, the generated crc must be the same as your engine expects.");
|
||||
ADD(" */\n\ntypedef struct");
|
||||
ADD2(" globalvars_s");
|
||||
ADD(qcva("\n{"));
|
||||
ADD2("\tint pad;\n"
|
||||
EAT_CRC("file generated by qcc, do not modify");
|
||||
ADD_ONLY("File generated by FTEQCC, relevent for engine modding only, the generated crc must be the same as your engine expects.");
|
||||
ADD_CRC(" */\n\ntypedef struct");
|
||||
ADD_ONLY(" globalvars_s");
|
||||
ADD_CRC(qcva("\n{"));
|
||||
ADD_ONLY("\tint pad;\n"
|
||||
"\tint ofs_return[3];\n" //makes it easier with the get globals func
|
||||
"\tint ofs_parm0[3];\n"
|
||||
"\tint ofs_parm1[3];\n"
|
||||
|
@ -2416,7 +2412,7 @@ unsigned short QCC_PR_WriteProgdefs (char *filename)
|
|||
"\tint ofs_parm5[3];\n"
|
||||
"\tint ofs_parm6[3];\n"
|
||||
"\tint ofs_parm7[3];\n");
|
||||
ADD3(qcva("\tint\tpad[%i];\n", RESERVED_OFS));
|
||||
EAT_CRC(qcva("\tint\tpad[%i];\n", RESERVED_OFS));
|
||||
for (d=pr.def_head.next ; d ; d=d->next)
|
||||
{
|
||||
if (!strcmp (d->name, "end_sys_globals"))
|
||||
|
@ -2427,36 +2423,36 @@ unsigned short QCC_PR_WriteProgdefs (char *filename)
|
|||
switch (d->type->type)
|
||||
{
|
||||
case ev_float:
|
||||
ADD(qcva("\tfloat\t%s;\n",d->name));
|
||||
ADD_CRC(qcva("\tfloat\t%s;\n",d->name));
|
||||
break;
|
||||
case ev_vector:
|
||||
ADD(qcva("\tvec3_t\t%s;\n",d->name));
|
||||
ADD_CRC(qcva("\tvec3_t\t%s;\n",d->name));
|
||||
if (d->deftail)
|
||||
d=d->deftail; // skip the elements
|
||||
break;
|
||||
case ev_string:
|
||||
ADD(qcva("\tstring_t\t%s;\n",d->name));
|
||||
ADD_CRC(qcva("\tstring_t\t%s;\n",d->name));
|
||||
break;
|
||||
case ev_function:
|
||||
ADD(qcva("\tfunc_t\t%s;\n",d->name));
|
||||
ADD_CRC(qcva("\tfunc_t\t%s;\n",d->name));
|
||||
break;
|
||||
case ev_entity:
|
||||
ADD(qcva("\tint\t%s;\n",d->name));
|
||||
ADD_CRC(qcva("\tint\t%s;\n",d->name));
|
||||
break;
|
||||
case ev_integer:
|
||||
ADD(qcva("\tint\t%s;\n",d->name));
|
||||
ADD_CRC(qcva("\tint\t%s;\n",d->name));
|
||||
break;
|
||||
default:
|
||||
ADD(qcva("\tint\t%s;\n",d->name));
|
||||
ADD_CRC(qcva("\tint\t%s;\n",d->name));
|
||||
break;
|
||||
}
|
||||
}
|
||||
ADD("} globalvars_t;\n\n");
|
||||
ADD_CRC("} globalvars_t;\n\n");
|
||||
|
||||
// print all fields
|
||||
ADD("typedef struct");
|
||||
ADD2(" entvars_s");
|
||||
ADD("\n{\n");
|
||||
ADD_CRC("typedef struct");
|
||||
ADD_ONLY(" entvars_s");
|
||||
ADD_CRC("\n{\n");
|
||||
for (d=pr.def_head.next ; d ; d=d->next)
|
||||
{
|
||||
if (!strcmp (d->name, "end_sys_fields"))
|
||||
|
@ -2468,35 +2464,35 @@ unsigned short QCC_PR_WriteProgdefs (char *filename)
|
|||
switch (d->type->aux_type->type)
|
||||
{
|
||||
case ev_float:
|
||||
ADD(qcva("\tfloat\t%s;\n",d->name));
|
||||
ADD_CRC(qcva("\tfloat\t%s;\n",d->name));
|
||||
break;
|
||||
case ev_vector:
|
||||
ADD(qcva("\tvec3_t\t%s;\n",d->name));
|
||||
ADD_CRC(qcva("\tvec3_t\t%s;\n",d->name));
|
||||
if (d->deftail)
|
||||
d=d->deftail; // skip the elements
|
||||
break;
|
||||
case ev_string:
|
||||
ADD(qcva("\tstring_t\t%s;\n",d->name));
|
||||
ADD_CRC(qcva("\tstring_t\t%s;\n",d->name));
|
||||
break;
|
||||
case ev_function:
|
||||
ADD(qcva("\tfunc_t\t%s;\n",d->name));
|
||||
ADD_CRC(qcva("\tfunc_t\t%s;\n",d->name));
|
||||
break;
|
||||
case ev_entity:
|
||||
ADD(qcva("\tint\t%s;\n",d->name));
|
||||
ADD_CRC(qcva("\tint\t%s;\n",d->name));
|
||||
break;
|
||||
case ev_integer:
|
||||
ADD(qcva("\tint\t%s;\n",d->name));
|
||||
ADD_CRC(qcva("\tint\t%s;\n",d->name));
|
||||
break;
|
||||
default:
|
||||
ADD(qcva("\tint\t%s;\n",d->name));
|
||||
ADD_CRC(qcva("\tint\t%s;\n",d->name));
|
||||
break;
|
||||
}
|
||||
}
|
||||
ADD("} entvars_t;\n\n");
|
||||
ADD_CRC("} entvars_t;\n\n");
|
||||
|
||||
/*
|
||||
///temp
|
||||
ADD2("//with this the crc isn't needed for fields.\n#ifdef FIELDSSTRUCT\nstruct fieldvars_s {\n\tint ofs;\n\tint type;\n\tchar *name;\n} fieldvars[] = {\n");
|
||||
ADD_ONLY("//with this the crc isn't needed for fields.\n#ifdef FIELDSSTRUCT\nstruct fieldvars_s {\n\tint ofs;\n\tint type;\n\tchar *name;\n} fieldvars[] = {\n");
|
||||
f=0;
|
||||
for (d=pr.def_head.next ; d ; d=d->next)
|
||||
{
|
||||
|
@ -2506,15 +2502,15 @@ unsigned short QCC_PR_WriteProgdefs (char *filename)
|
|||
if (d->type->type != ev_field)
|
||||
continue;
|
||||
if (f)
|
||||
ADD2(",\n");
|
||||
ADD2(qcva("\t{%i,\t%i,\t\"%s\"}",G_INT(d->ofs), d->type->aux_type->type, d->name));
|
||||
ADD_ONLY(",\n");
|
||||
ADD_ONLY(qcva("\t{%i,\t%i,\t\"%s\"}",G_INT(d->ofs), d->type->aux_type->type, d->name));
|
||||
f = 1;
|
||||
}
|
||||
ADD2("\n};\n#endif\n\n");
|
||||
ADD_ONLY("\n};\n#endif\n\n");
|
||||
//end temp
|
||||
*/
|
||||
|
||||
ADD2(qcva("#define PROGHEADER_CRC %i\n", crc));
|
||||
ADD_ONLY(qcva("#define PROGHEADER_CRC %i\n", crc));
|
||||
|
||||
if (QCC_CheckParm("-progdefs"))
|
||||
{
|
||||
|
|
|
@ -132,7 +132,7 @@ typedef enum
|
|||
g_acos, //55
|
||||
G_CMD_ARGC,
|
||||
G_CMD_ARGV,
|
||||
G_TraceCapsule,
|
||||
G_TraceBox, //was G_TraceCapsule
|
||||
G_FS_OpenFile,
|
||||
G_FS_CloseFile, //60
|
||||
G_FS_ReadFile,
|
||||
|
@ -340,7 +340,7 @@ typedef enum {
|
|||
static const char *q1qvmentstring;
|
||||
static vm_t *q1qvm;
|
||||
static pubprogfuncs_t q1qvmprogfuncs;
|
||||
static edict_t *q1qvmedicts[MAX_Q1QVM_EDICTS];
|
||||
static edict_t **q1qvmedicttable;
|
||||
|
||||
|
||||
static void *evars; //pointer to the gamecodes idea of an edict_t
|
||||
|
@ -366,10 +366,10 @@ static edict_t *QDECL Q1QVMPF_EdictNum(pubprogfuncs_t *pf, unsigned int num)
|
|||
if (/*num < 0 ||*/ num >= sv.world.max_edicts)
|
||||
return NULL;
|
||||
|
||||
e = q1qvmedicts[num];
|
||||
e = q1qvmedicttable[num];
|
||||
if (!e)
|
||||
{
|
||||
e = q1qvmedicts[num] = Z_TagMalloc(sizeof(edict_t)+sizeof(extentvars_t), VMFSID_Q1QVM);
|
||||
e = q1qvmedicttable[num] = Z_TagMalloc(sizeof(edict_t)+sizeof(extentvars_t), VMFSID_Q1QVM);
|
||||
e->v = (stdentvars_t*)((char*)evars + (num * sv.world.edict_size) + WASTED_EDICT_T_SIZE);
|
||||
e->xv = (extentvars_t*)(e+1);
|
||||
e->entnum = num;
|
||||
|
@ -518,7 +518,7 @@ static int WrapQCBuiltin(builtin_t func, void *offset, quintptr_t mask, const qi
|
|||
gv.param[argnum++].f = VM_FLOAT(*arg++);
|
||||
break;
|
||||
case 'i':
|
||||
gv.param[argnum++].f = VM_LONG(*arg++);
|
||||
gv.param[argnum++].f = VM_LONG(*arg++); //vanilla qc does not support ints, but qvms do. this means ints need to be converted to floats for the builtin to understand them properly.
|
||||
break;
|
||||
case 'n': //ent num
|
||||
gv.param[argnum++].i = EDICT_TO_PROG(svprogfuncs, Q1QVMPF_EdictNum(svprogfuncs, VM_LONG(*arg++)));
|
||||
|
@ -583,7 +583,7 @@ static qintptr_t syscallhandle (void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
case G_REMOVE_ENT:
|
||||
if (arg[0] >= sv.world.max_edicts)
|
||||
return false;
|
||||
Q1QVMPF_EntRemove(svprogfuncs, q1qvmedicts[arg[0]]);
|
||||
Q1QVMPF_EntRemove(svprogfuncs, q1qvmedicttable[arg[0]]);
|
||||
return true;
|
||||
|
||||
case G_PRECACHE_SOUND:
|
||||
|
@ -949,7 +949,7 @@ static qintptr_t syscallhandle (void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
}
|
||||
break;
|
||||
|
||||
case G_TraceCapsule:
|
||||
case G_TraceBox:
|
||||
WrapQCBuiltin(PF_svtraceline, offset, mask, arg, "vvinvv");
|
||||
break;
|
||||
|
||||
|
@ -991,22 +991,17 @@ static qintptr_t syscallhandle (void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
if (VM_OOB(arg[0], arg[1]))
|
||||
return 0;
|
||||
return VM_FRead(VM_POINTER(arg[0]), VM_LONG(arg[1]), VM_LONG(arg[2]), VMFSID_Q1QVM);
|
||||
/*
|
||||
|
||||
//not supported, open will fail anyway
|
||||
case G_FS_WriteFile:
|
||||
if (VM_OOB(arg[0], arg[1]))
|
||||
return 0;
|
||||
return VM_FWrite(VM_POINTER(arg[0]), VM_LONG(arg[1]), VM_LONG(arg[2]), VMFSID_Q1QVM);
|
||||
break;
|
||||
*/
|
||||
/*
|
||||
case G_FS_SeekFile:
|
||||
// int trap_FS_SeekFile( fileHandle_t handle, int offset, int type )
|
||||
return VM_FSeek(VM_LONG(arg[0]), VM_LONG(arg[1]), VM_LONG(arg[2]));
|
||||
break;
|
||||
*/
|
||||
/*
|
||||
VM_FSeek(VM_LONG(arg[0]), VM_LONG(arg[1]), VM_LONG(arg[2]), VMFSID_Q1QVM);
|
||||
return 0;
|
||||
case G_FS_TellFile:
|
||||
break;
|
||||
*/
|
||||
return VM_FTell(VM_LONG(arg[0]), VMFSID_Q1QVM);
|
||||
|
||||
case G_FS_GetFileList:
|
||||
if (VM_OOB(arg[2], arg[3]))
|
||||
|
@ -1089,7 +1084,7 @@ static qintptr_t syscallhandle (void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
match = "";
|
||||
for (i = first+1; i < sv.world.num_edicts; i++)
|
||||
{
|
||||
e = q1qvmedicts[i];
|
||||
e = q1qvmedicttable[i];
|
||||
field = VM_POINTER(*((string_t*)e->v + ofs/4));
|
||||
if (field == NULL)
|
||||
{
|
||||
|
@ -1321,6 +1316,11 @@ void Q1QVM_Shutdown(void)
|
|||
if (svprogfuncs == &q1qvmprogfuncs)
|
||||
sv.world.progs = svprogfuncs = NULL;
|
||||
Z_FreeTags(VMFSID_Q1QVM);
|
||||
if (q1qvmedicttable)
|
||||
{
|
||||
Z_Free(q1qvmedicttable);
|
||||
q1qvmedicttable = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1368,9 +1368,16 @@ qboolean PR_LoadQ1QVM(void)
|
|||
gameDataN_t *gd, gdm;
|
||||
gameData32_t *gd32;
|
||||
qintptr_t ret;
|
||||
qintptr_t limit;
|
||||
extern cvar_t pr_maxedicts;
|
||||
|
||||
if (q1qvm)
|
||||
VM_Destroy(q1qvm);
|
||||
if (q1qvmedicttable)
|
||||
{
|
||||
Z_Free(q1qvmedicttable);
|
||||
q1qvmedicttable = NULL;
|
||||
}
|
||||
|
||||
q1qvm = VM_Create("qwprogs", com_nogamedirnativecode.ival?NULL:syscallnative, syscallqvm);
|
||||
if (!q1qvm)
|
||||
|
@ -1412,7 +1419,7 @@ qboolean PR_LoadQ1QVM(void)
|
|||
sv.world.max_edicts = 0; //so clear these out, just in case
|
||||
sv.world.edict_size = 0; //if we get a division by zero, then at least its a safe crash
|
||||
|
||||
memset(q1qvmedicts, 0, sizeof(q1qvmedicts));
|
||||
q1qvmedicttable = NULL;
|
||||
|
||||
q1qvmprogfuncs.stringtable = VM_MemoryBase(q1qvm);
|
||||
|
||||
|
@ -1441,14 +1448,26 @@ qboolean PR_LoadQ1QVM(void)
|
|||
gd = (gameDataN_t*)((char*)VM_MemoryBase(q1qvm) + ret); //qvm is 32bit
|
||||
}
|
||||
|
||||
sv.world.num_edicts = 1;
|
||||
sv.world.max_edicts = bound(64, pr_maxedicts.ival, MAX_EDICTS);
|
||||
q1qvmedicttable = Z_Malloc(sizeof(*q1qvmedicttable) * sv.world.max_edicts);
|
||||
|
||||
limit = VM_MemoryMask(q1qvm);
|
||||
if ((qintptr_t)gd->ents < 0 || (qintptr_t)gd->ents > limit)
|
||||
gd->ents = NULL;
|
||||
if (gd->sizeofent < 0 || gd->sizeofent > (0xffffffff-(qintptr_t)gd->ents) / sv.world.max_edicts)
|
||||
gd->sizeofent = 0xffffffff / MAX_EDICTS;
|
||||
if ((qintptr_t)gd->global < 0 || (qintptr_t)gd->global > limit)
|
||||
gd->global = NULL;
|
||||
if ((qintptr_t)gd->fields < 0 || (qintptr_t)gd->fields > limit)
|
||||
gd->fields = NULL;
|
||||
|
||||
sv.world.edict_size = gd->sizeofent;
|
||||
vevars = (qintptr_t)gd->ents;
|
||||
evars = ((char*)VM_MemoryBase(q1qvm) + vevars);
|
||||
//FIXME: range check this pointer
|
||||
//FIXME: range check the globals pointer
|
||||
|
||||
sv.world.num_edicts = 1;
|
||||
sv.world.max_edicts = sizeof(q1qvmedicts)/sizeof(q1qvmedicts[0]);
|
||||
|
||||
//WARNING: global is not remapped yet...
|
||||
//This code is written evilly, but works well enough
|
||||
|
|
|
@ -30,7 +30,7 @@ void SV_MVDStop_f (void);
|
|||
|
||||
#define demo_size_padding 0x1000
|
||||
|
||||
static void SV_DemoDir_Callback(struct cvar_s *var, char *oldvalue);
|
||||
static void QDECL SV_DemoDir_Callback(struct cvar_s *var, char *oldvalue);
|
||||
|
||||
cvar_t sv_demoUseCache = CVARD("sv_demoUseCache", "0", "If set, demo data will be flushed only periodically");
|
||||
cvar_t sv_demoCacheSize = CVAR("sv_demoCacheSize", "0x80000"); //half a meg
|
||||
|
@ -731,7 +731,7 @@ void Sys_freedir(dir_t *dir)
|
|||
|
||||
|
||||
// only one .. is allowed (so we can get to the same dir as the quake exe)
|
||||
static void SV_DemoDir_Callback(struct cvar_s *var, char *oldvalue)
|
||||
static void QDECL SV_DemoDir_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
char *value;
|
||||
|
||||
|
|
|
@ -26,6 +26,11 @@ void emscriptenfte_alert(const char *msg);
|
|||
void emscriptenfte_print(const char *msg);
|
||||
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);
|
||||
|
|
|
@ -649,5 +649,79 @@ console.log("onerror: " + _url + " status " + http.status);
|
|||
};
|
||||
|
||||
http.send(null);
|
||||
},
|
||||
|
||||
emscriptenfte_al_loadaudiofile : function(buf, dataptr, datasize)
|
||||
{
|
||||
//match emscripten's openal support.
|
||||
if (!buf)
|
||||
return;
|
||||
buf = buf - 1;
|
||||
|
||||
var ctx = AL.currentContext;
|
||||
try
|
||||
{
|
||||
//its async, so it needs its own copy of an arraybuffer
|
||||
var abuf = new ArrayBuffer(datasize);
|
||||
new Uint8Array(abuf).set(HEAPU8.subarray(dataptr, dataptr+datasize));
|
||||
AL.currentContext.ctx.decodeAudioData(abuf, function(buffer)
|
||||
{
|
||||
ctx.buf[buf] = buffer;
|
||||
}, function()
|
||||
{
|
||||
console.log("Audio Callback failed!");
|
||||
});
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
console.log("unable to decode audio data");
|
||||
console.log(e);
|
||||
}
|
||||
},
|
||||
|
||||
emscriptenfte_gl_loadtexturefile : function(texid, widthptr, heightptr, dataptr, datasize)
|
||||
{
|
||||
function encode64(data) {
|
||||
var BASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||
var PAD = '=';
|
||||
var ret = '';
|
||||
var leftchar = 0;
|
||||
var leftbits = 0;
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
leftchar = (leftchar << 8) | data[i];
|
||||
leftbits += 8;
|
||||
while (leftbits >= 6) {
|
||||
var curr = (leftchar >> (leftbits-6)) & 0x3f;
|
||||
leftbits -= 6;
|
||||
ret += BASE[curr];
|
||||
}
|
||||
}
|
||||
if (leftbits == 2) {
|
||||
ret += BASE[(leftchar&3) << 4];
|
||||
ret += PAD + PAD;
|
||||
} else if (leftbits == 4) {
|
||||
ret += BASE[(leftchar&0xf) << 2];
|
||||
ret += PAD;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//make sure the texture is defined before its loaded, so we get no errors
|
||||
GLctx.texImage2D(GLctx.TEXTURE_2D, 0, GLctx.RGBA, 1,1,0,GLctx.RGBA, GLctx.UNSIGNED_BYTE, null);
|
||||
|
||||
var img = new Image();
|
||||
var gltex = GL.textures[texid];
|
||||
img.onload = function()
|
||||
{
|
||||
console.log("Image Callback called!");
|
||||
var oldtex = GLctx.getParameter(GLctx.TEXTURE_BINDING_2D); //blurgh, try to avoid breaking anything in this unexpected event.
|
||||
GLctx.bindTexture(GLctx.TEXTURE_2D, gltex);
|
||||
GLctx.texImage2D(GLctx.TEXTURE_2D, 0, GLctx.RGBA, GLctx.RGBA, GLctx.UNSIGNED_BYTE, img);
|
||||
GLctx.generateMipmap(GLctx.TEXTURE_2D);
|
||||
GLctx.bindTexture(GLctx.TEXTURE_2D, oldtex);
|
||||
};
|
||||
img.crossorigin = true;
|
||||
img.src = "data:image/png;base64," + encode64(HEAPU8.subarray(dataptr, dataptr+datasize));
|
||||
img.onload();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -180,8 +180,8 @@ void Net_TryFlushProxyBuffer(cluster_t *cluster, oproxy_t *prox)
|
|||
int length;
|
||||
int bufpos;
|
||||
|
||||
if (prox->drop)
|
||||
return;
|
||||
// if (prox->drop)
|
||||
// return;
|
||||
|
||||
while (prox->bufferpos >= MAX_PROXY_BUFFER)
|
||||
{ //so we never get any issues with wrapping..
|
||||
|
@ -212,12 +212,14 @@ void Net_TryFlushProxyBuffer(cluster_t *cluster, oproxy_t *prox)
|
|||
{
|
||||
case 0: //eof / they disconnected
|
||||
prox->drop = true;
|
||||
prox->flushing = false;
|
||||
break;
|
||||
case -1:
|
||||
if (qerrno != EWOULDBLOCK && qerrno != EAGAIN) //not a problem, so long as we can flush it later.
|
||||
{
|
||||
Sys_Printf(cluster, "network error from client proxy\n");
|
||||
prox->drop = true; //drop them if we get any errors
|
||||
prox->flushing = false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -202,6 +202,7 @@ static void HTTPSV_SendHTMLHeader(cluster_t *cluster, oproxy_t *dest, char *titl
|
|||
|
||||
Net_ProxySend(cluster, dest, buffer, strlen(buffer));
|
||||
|
||||
#if 0
|
||||
if (plugin)
|
||||
{
|
||||
s =
|
||||
|
@ -225,6 +226,7 @@ static void HTTPSV_SendHTMLHeader(cluster_t *cluster, oproxy_t *dest, char *titl
|
|||
"</script>";
|
||||
Net_ProxySend(cluster, dest, s, strlen(s));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void HTTPSV_SendHTMLFooter(cluster_t *cluster, oproxy_t *dest)
|
||||
|
@ -233,12 +235,14 @@ static void HTTPSV_SendHTMLFooter(cluster_t *cluster, oproxy_t *dest)
|
|||
char buffer[2048];
|
||||
|
||||
/*Proxy version*/
|
||||
snprintf(buffer, sizeof(buffer), "<br/>Server Version: %i <a href=\"http://www.fteqw.com\" target=\"_blank\">www.fteqw.com</a>", cluster->buildnumber);
|
||||
snprintf(buffer, sizeof(buffer), "<br/>Server Version: %i <a href=\""PROXYWEBSITE"\" target=\"_blank\">"PROXYWEBSITE"</a>", cluster->buildnumber);
|
||||
Net_ProxySend(cluster, dest, buffer, strlen(buffer));
|
||||
|
||||
#if 0
|
||||
/*Plugin version*/
|
||||
s = "<script>if (parent.getplug != null) document.write(\"<br/>Plugin Version: \" + parent.getplug().build + parent.getplug().server);</script>";
|
||||
Net_ProxySend(cluster, dest, s, strlen(s));
|
||||
#endif
|
||||
|
||||
/*terminate html page*/
|
||||
s = "</body>\n"
|
||||
|
@ -790,11 +794,25 @@ static void HTTPSV_GeneratePlugin(cluster_t *cluster, oproxy_t *dest)
|
|||
"</iframe>"
|
||||
"</div>"
|
||||
"<div id=plugdiv style='position:fixed; left:50%; width:50%; top:0%; height:100%;'>"
|
||||
|
||||
#if 1
|
||||
#define EMBEDDEDWEBGLORIGIN "http://86.191.129.12:80"//127.0.0.1:80"
|
||||
#define EMBEDDEDWEBGLURL EMBEDDEDWEBGLORIGIN"/ftewebgl.html"
|
||||
#else
|
||||
#define EMBEDDEDWEBGLORIGIN "http://triptohell.info"
|
||||
#define EMBEDDEDWEBGLURL EMBEDDEDWEBGLORIGIN"/moodles/web/ftewebgl.html"
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
"<iframe frameborder=0 allowfullscreen=1 name=\"webgl\" src=\""EMBEDDEDWEBGLURL"\" width=\"100%\" height=\"100%\">"
|
||||
"oh dear. your browser doesn't support this site"
|
||||
"</iframe>"
|
||||
#else
|
||||
/*once for IE*/
|
||||
"<object name=\"ieplug\""
|
||||
" type=\"text/x-quaketvident\""
|
||||
" classid=\"clsid:7d676c9f-fb84-40b6-b3ff-e10831557eeb\""
|
||||
//" codebase=\"http://fteqw.com/test.cab\""
|
||||
//" codebase=\""PROXYWEBSITE"/test.cab\""
|
||||
" width=100%"
|
||||
" height=100%"
|
||||
" >"
|
||||
|
@ -833,9 +851,11 @@ static void HTTPSV_GeneratePlugin(cluster_t *cluster, oproxy_t *dest)
|
|||
"Plugin failed to load"
|
||||
"</object>"
|
||||
"</object>"
|
||||
#endif
|
||||
"</div>"
|
||||
|
||||
"<script>"
|
||||
#if 0
|
||||
"function getplugnp(d)\n"
|
||||
"{\n"
|
||||
"return document.npplug;\n"
|
||||
|
@ -851,6 +871,10 @@ static void HTTPSV_GeneratePlugin(cluster_t *cluster, oproxy_t *dest)
|
|||
html =
|
||||
"\";\n"
|
||||
|
||||
"if (getplugie() != undefined && getplugie().plugver != undefined)\n"
|
||||
"{\nparent.getplug = getplugie;\n}\n"
|
||||
"else\n"
|
||||
"{\nparent.getplug = getplugnp;\n}\n"
|
||||
|
||||
"function joinserver(d)\n"
|
||||
"{\n"
|
||||
|
@ -875,14 +899,33 @@ static void HTTPSV_GeneratePlugin(cluster_t *cluster, oproxy_t *dest)
|
|||
"\";\n"
|
||||
"getplug().running = 1;\n"
|
||||
"}\n"
|
||||
#else
|
||||
"function joinserver(d)"
|
||||
"{"
|
||||
// "webgl.postMessage({cmd:'mapsrc',url:\""
|
||||
// ;
|
||||
// Net_ProxySend(cluster, dest, html, strlen(html));
|
||||
// Net_ProxySend(cluster, dest, cluster->plugindatasource, strlen(cluster->plugindatasource));
|
||||
// html =
|
||||
// "\"}, \""EMBEDDEDWEBGLORIGIN"\");"
|
||||
"webgl.postMessage({'cmd':'observeurl','url':'ws://86.191.129.12:27500'}, \""EMBEDDEDWEBGLORIGIN"\");"
|
||||
"}\n"
|
||||
|
||||
"function playdemo(d)"
|
||||
"{"
|
||||
// "parent.webgl.postMessage({cmd:'mapsrc',url:\""
|
||||
// ;
|
||||
// Net_ProxySend(cluster, dest, html, strlen(html));
|
||||
// Net_ProxySend(cluster, dest, cluster->plugindatasource, strlen(cluster->plugindatasource));
|
||||
// html =
|
||||
// "\"}, \""EMBEDDEDWEBGLORIGIN"\");"
|
||||
"parent.webgl.postMessage({cmd:'demourl',url:d}, \""EMBEDDEDWEBGLORIGIN"\");"
|
||||
"}\n"
|
||||
#endif
|
||||
|
||||
"parent.joinserver = joinserver;\n"
|
||||
"parent.playdemo = playdemo;\n"
|
||||
|
||||
"if (getplugie() != undefined && getplugie().plugver != undefined)\n"
|
||||
"{\nparent.getplug = getplugie;\n}\n"
|
||||
"else\n"
|
||||
"{\nparent.getplug = getplugnp;\n}\n"
|
||||
/* "if (getplug().plugver == undefined)"
|
||||
"{"
|
||||
"document.getElementById('plugdiv').style.left = '75%';"
|
||||
|
@ -1207,7 +1250,8 @@ void HTTPSV_GetMethod(cluster_t *cluster, oproxy_t *pend)
|
|||
else REDIRECTIF("/", "/plugin.html")
|
||||
#endif
|
||||
else REDIRECTIF("/", "/nowplaying.html")
|
||||
else REDIRECTIF("/about.html", "http://www.fteqw.com/")
|
||||
else REDIRECTIF("/about.html", PROXYWEBSITE)
|
||||
#if 0
|
||||
else REDIRECTIF("/qtvsplash.jpg", "/file/qtvsplash.jpg") /*lame, very lame*/
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
else REDIRECTIF("/npfte.xpi", "/file/npfte_dbg.xpi") /*lame, very lame*/
|
||||
|
@ -1216,6 +1260,7 @@ void HTTPSV_GetMethod(cluster_t *cluster, oproxy_t *pend)
|
|||
#endif
|
||||
else REDIRECTIF("/npfte.exe", "/file/npfte.exe") /*lame, very lame*/
|
||||
else REDIRECTIF("/iefte.exe", "/file/iefte.exe") /*lame, very lame*/
|
||||
#endif
|
||||
else if (uriargmatch(uri, "/demos.html", urilen, &args))
|
||||
{
|
||||
HTTPSV_GenerateDemoListing(cluster, pend, args);
|
||||
|
|
|
@ -254,7 +254,7 @@ void Menu_Draw(cluster_t *cluster, viewer_t *viewer)
|
|||
|
||||
sprintf(str, "FTEQTV build %i\n", cluster->buildnumber);
|
||||
WriteString2(&m, str);
|
||||
WriteString2(&m, "www.FTEQW.com\n");
|
||||
WriteString2(&m, PROXYWEBSITE"\n");
|
||||
WriteString2(&m, "-------------\n");
|
||||
|
||||
if (strcmp(cluster->hostname, DEFAULT_HOSTNAME))
|
||||
|
|
|
@ -109,12 +109,29 @@ void NET_InitUDPSocket(cluster_t *cluster, int port, qboolean ipv6)
|
|||
Sys_Printf(cluster, "opened udp port %i\n", port);
|
||||
}
|
||||
|
||||
SOCKET NET_ChooseSocket(SOCKET sock[2], netadr_t *adr)
|
||||
SOCKET NET_ChooseSocket(SOCKET sock[2], netadr_t *toadr, netadr_t ina)
|
||||
{
|
||||
#ifdef AF_INET6
|
||||
if (((struct sockaddr *)adr->sockaddr)->sa_family == AF_INET6)
|
||||
if (((struct sockaddr *)ina.sockaddr)->sa_family == AF_INET6)
|
||||
{
|
||||
*toadr = ina;
|
||||
return sock[1];
|
||||
}
|
||||
if (sock[0] == INVALID_SOCKET && sock[1] != INVALID_SOCKET)
|
||||
{
|
||||
struct sockaddr_in6 *out = (struct sockaddr_in6*)toadr->sockaddr;
|
||||
struct sockaddr_in *in = (struct sockaddr_in*)ina.sockaddr;
|
||||
toadr->tcpcon = ina.tcpcon;
|
||||
|
||||
memset(out, 0, sizeof(*out));
|
||||
out->sin6_family = AF_INET6;
|
||||
*(short*)&out->sin6_addr.s6_addr[10] = 0xffff;
|
||||
*(int*)&out->sin6_addr.s6_addr[12] = in->sin_addr.s_addr;
|
||||
out->sin6_port = in->sin_port;
|
||||
return sock[1];
|
||||
}
|
||||
#endif
|
||||
*toadr = ina;
|
||||
return sock[0];
|
||||
}
|
||||
|
||||
|
@ -336,7 +353,7 @@ Netchan_OutOfBand
|
|||
Sends an out-of-band datagram
|
||||
================
|
||||
*/
|
||||
void Netchan_OutOfBand (cluster_t *cluster, SOCKET sock, netadr_t adr, int length, void *data)
|
||||
void Netchan_OutOfBandSocket (cluster_t *cluster, SOCKET sock, netadr_t *adr, int length, void *data)
|
||||
{
|
||||
netmsg_t send;
|
||||
unsigned char send_buf[MAX_MSGLEN + PACKET_HEADER];
|
||||
|
@ -348,9 +365,21 @@ void Netchan_OutOfBand (cluster_t *cluster, SOCKET sock, netadr_t adr, int lengt
|
|||
WriteData (&send, data, length);
|
||||
|
||||
// send the datagram
|
||||
NET_SendPacket (cluster, sock, send.cursize, send.data, adr);
|
||||
NET_SendPacket (cluster, sock, send.cursize, send.data, *adr);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Netchan_OutOfBand
|
||||
|
||||
Sends an out-of-band datagram
|
||||
================
|
||||
*/
|
||||
void Netchan_OutOfBand (cluster_t *cluster, netadr_t adr, int length, void *data)
|
||||
{
|
||||
netadr_t realadr;
|
||||
Netchan_OutOfBandSocket(cluster, NET_ChooseSocket(cluster->qwdsocket, &realadr, adr), &realadr, length, data);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
|
@ -373,7 +402,7 @@ void Netchan_OutOfBandPrint (cluster_t *cluster, netadr_t adr, char *format, ...
|
|||
#endif // _WIN32
|
||||
va_end (argptr);
|
||||
|
||||
Netchan_OutOfBand (cluster, NET_ChooseSocket(cluster->qwdsocket, &adr), adr, strlen(string), (unsigned char *)string);
|
||||
Netchan_OutOfBandSocket(cluster, NET_ChooseSocket(cluster->qwdsocket, &adr, adr), &adr, strlen(string), (unsigned char *)string);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -420,7 +420,7 @@ static void ParseStufftext(sv_t *tv, netmsg_t *m, int to, unsigned int mask)
|
|||
ptr = COM_ParseToken(ptr, arg[1], ARG_LEN, "");
|
||||
ptr = COM_ParseToken(ptr, arg[2], ARG_LEN, "");
|
||||
NET_StringToAddr(arg[1], &adr, PROX_DEFAULTSERVERPORT);
|
||||
Netchan_OutOfBand(tv->cluster, tv->sourcesock, adr, strlen(arg[2]), arg[2]);
|
||||
Netchan_OutOfBandSocket(tv->cluster, tv->sourcesock, &adr, strlen(arg[2]), arg[2]);
|
||||
|
||||
//this is an evil hack
|
||||
SendClientCommand(tv, "new\n");
|
||||
|
|
|
@ -241,6 +241,7 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
|
|||
#define PROX_DEFAULTSERVER "localhost:27500"
|
||||
|
||||
#define DEFAULT_HOSTNAME "FTEQTV"
|
||||
#define PROXYWEBSITE "http://fte.triptohell.info" //url for program
|
||||
|
||||
#define MAX_ENTITY_LEAFS 32
|
||||
|
||||
|
@ -867,12 +868,13 @@ void Netchan_OutOfBandPrint (cluster_t *cluster, netadr_t adr, char *format, ...
|
|||
//int Netchan_IsLocal (netadr_t adr);
|
||||
void NET_InitUDPSocket(cluster_t *cluster, int port, qboolean ipv6);
|
||||
void NET_SendPacket(cluster_t *cluster, SOCKET sock, int length, void *data, netadr_t adr);
|
||||
SOCKET NET_ChooseSocket(SOCKET sock[], netadr_t *adr);
|
||||
SOCKET NET_ChooseSocket(SOCKET sock[], netadr_t *toadr, netadr_t in);
|
||||
qboolean Net_CompareAddress(netadr_t *s1, netadr_t *s2, int qp1, int qp2);
|
||||
qboolean Netchan_Process (netchan_t *chan, netmsg_t *msg);
|
||||
qboolean NQNetchan_Process(cluster_t *cluster, netchan_t *chan, netmsg_t *msg);
|
||||
void Netchan_Transmit (cluster_t *cluster, netchan_t *chan, int length, const void *data);
|
||||
void Netchan_OutOfBand (cluster_t *cluster, SOCKET sock, netadr_t adr, int length, void *data);
|
||||
void Netchan_OutOfBandSocket (cluster_t *cluster, SOCKET sock, netadr_t *adr, int length, void *data);
|
||||
void Netchan_OutOfBand(cluster_t *cluster, netadr_t adr, int length, void *data);
|
||||
qboolean Netchan_CanPacket (netchan_t *chan);
|
||||
int NET_WebSocketRecv(SOCKET sock, wsrbuf_t *ws, unsigned char *out, unsigned int outlen, int *wslen);
|
||||
|
||||
|
|
24
fteqtv/qw.c
24
fteqtv/qw.c
|
@ -838,7 +838,7 @@ void NewNQClient(cluster_t *cluster, netadr_t *addr)
|
|||
header = (buffer[0]<<24) + (buffer[1]<<16) + (buffer[2]<<8) + buffer[3];
|
||||
*(int*)buffer = header;
|
||||
|
||||
NET_SendPacket (cluster, NET_ChooseSocket(cluster->qwdsocket, addr), len, buffer, *addr);
|
||||
NET_SendPacket (cluster, NET_ChooseSocket(cluster->qwdsocket, addr, *addr), len, buffer, *addr);
|
||||
|
||||
if (!viewer)
|
||||
return;
|
||||
|
@ -847,7 +847,7 @@ void NewNQClient(cluster_t *cluster, netadr_t *addr)
|
|||
memset(viewer, 0, sizeof(*viewer));
|
||||
|
||||
|
||||
Netchan_Setup (NET_ChooseSocket(cluster->qwdsocket, addr), &viewer->netchan, *addr, 0, false);
|
||||
Netchan_Setup (NET_ChooseSocket(cluster->qwdsocket, addr, *addr), &viewer->netchan, *addr, 0, false);
|
||||
viewer->netchan.isnqprotocol = true;
|
||||
viewer->netchan.maxdatagramlen = MAX_NQDATAGRAM;
|
||||
viewer->netchan.maxreliablelen = MAX_NQMSGLEN;
|
||||
|
@ -902,7 +902,7 @@ void NewQWClient(cluster_t *cluster, netadr_t *addr, char *connectmessage)
|
|||
}
|
||||
memset(viewer, 0, sizeof(viewer_t));
|
||||
|
||||
Netchan_Setup (NET_ChooseSocket(cluster->qwdsocket, addr), &viewer->netchan, *addr, atoi(qport), false);
|
||||
Netchan_Setup (NET_ChooseSocket(cluster->qwdsocket, addr, *addr), &viewer->netchan, *addr, atoi(qport), false);
|
||||
viewer->netchan.message.maxsize = MAX_QWMSGLEN;
|
||||
viewer->netchan.maxdatagramlen = MAX_QWMSGLEN;
|
||||
viewer->netchan.maxreliablelen = MAX_QWMSGLEN;
|
||||
|
@ -1110,7 +1110,7 @@ void QTV_Status(cluster_t *cluster, netadr_t *from)
|
|||
}
|
||||
|
||||
WriteByte(&msg, 0);
|
||||
NET_SendPacket(cluster, NET_ChooseSocket(cluster->qwdsocket, from), msg.cursize, msg.data, *from);
|
||||
NET_SendPacket(cluster, NET_ChooseSocket(cluster->qwdsocket, from, *from), msg.cursize, msg.data, *from);
|
||||
}
|
||||
|
||||
void QTV_StatusResponse(cluster_t *cluster, char *msg, netadr_t *from)
|
||||
|
@ -1219,7 +1219,7 @@ void ConnectionlessPacket(cluster_t *cluster, netadr_t *from, netmsg_t *m)
|
|||
}
|
||||
if (!strncmp(buffer, "ping", 4))
|
||||
{ //ack
|
||||
NET_SendPacket (cluster, NET_ChooseSocket(cluster->qwdsocket, from), 1, "l", *from);
|
||||
Netchan_OutOfBandPrint(cluster, *from, "l");
|
||||
return;
|
||||
}
|
||||
if (!strncmp(buffer, "status", 6))
|
||||
|
@ -1241,10 +1241,10 @@ void ConnectionlessPacket(cluster_t *cluster, netadr_t *from, netmsg_t *m)
|
|||
NewQWClient(cluster, from, buffer);
|
||||
return;
|
||||
}
|
||||
if (!strncmp(buffer, "l\n", 2))
|
||||
{
|
||||
Sys_Printf(cluster, "Ack\n");
|
||||
}
|
||||
// if (buffer[0] == 'l' && (!buffer[1] || buffer[1] == '\n'))
|
||||
// {
|
||||
// Sys_Printf(cluster, "Ack from %s\n", );
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
@ -2405,7 +2405,7 @@ void QTV_SayCommand(cluster_t *cluster, sv_t *qtv, viewer_t *v, char *fullcomman
|
|||
|
||||
if (!strcmp(command, "help"))
|
||||
{
|
||||
QW_PrintfToViewer(v, "Website: http://www.fteqw.com/\n"
|
||||
QW_PrintfToViewer(v, "Website: "PROXYWEBSITE"\n"
|
||||
"Commands:\n"
|
||||
".bind\n"
|
||||
" Bind your keys to drive the menu.\n"
|
||||
|
@ -4214,7 +4214,7 @@ void QW_ProcessUDPPacket(cluster_t *cluster, netmsg_t *m, netadr_t from)
|
|||
WriteByte(m, cluster->maxviewers>255?255:cluster->maxviewers);
|
||||
WriteByte(m, NQ_NETCHAN_VERSION);
|
||||
*(int*)m->data = BigLong(NETFLAG_CTL | m->cursize);
|
||||
NET_SendPacket(cluster, NET_ChooseSocket(cluster->qwdsocket, &from), m->cursize, m->data, from);
|
||||
NET_SendPacket(cluster, NET_ChooseSocket(cluster->qwdsocket, &from, from), m->cursize, m->data, from);
|
||||
}
|
||||
break;
|
||||
case CCREQ_CONNECT:
|
||||
|
@ -4300,7 +4300,7 @@ void QW_UpdateUDPStuff(cluster_t *cluster)
|
|||
{
|
||||
sprintf(buffer, "a\n%i\n0\n", cluster->mastersequence++); //fill buffer with a heartbeat
|
||||
//why is there no \xff\xff\xff\xff ?..
|
||||
NET_SendPacket(cluster, NET_ChooseSocket(cluster->qwdsocket, &from), strlen(buffer), buffer, from);
|
||||
NET_SendPacket(cluster, NET_ChooseSocket(cluster->qwdsocket, &from, from), strlen(buffer), buffer, from);
|
||||
}
|
||||
else
|
||||
Sys_Printf(cluster, "Cannot resolve master %s\n", cluster->master);
|
||||
|
|
|
@ -392,7 +392,7 @@ void Cmd_Master(cmdctxt_t *ctx)
|
|||
strlcpy(ctx->cluster->master, newval, sizeof(ctx->cluster->master));
|
||||
ctx->cluster->mastersendtime = ctx->cluster->curtime;
|
||||
|
||||
s = NET_ChooseSocket(ctx->cluster->qwdsocket, &addr);
|
||||
s = NET_ChooseSocket(ctx->cluster->qwdsocket, &addr, addr);
|
||||
if (s != INVALID_SOCKET)
|
||||
NET_SendPacket (ctx->cluster, s, 1, "k", addr);
|
||||
Cmd_Printf(ctx, "Master server set.\n");
|
||||
|
@ -821,7 +821,7 @@ void Cmd_Ping(cmdctxt_t *ctx)
|
|||
char *val = Cmd_Argv(ctx, 1);
|
||||
if (NET_StringToAddr(val, &addr, 27500))
|
||||
{
|
||||
NET_SendPacket (ctx->cluster, NET_ChooseSocket(ctx->cluster->qwdsocket, &addr), 1, "k", addr);
|
||||
NET_SendPacket (ctx->cluster, NET_ChooseSocket(ctx->cluster->qwdsocket, &addr, addr), 1, "k", addr);
|
||||
Cmd_Printf(ctx, "pinged\n");
|
||||
}
|
||||
Cmd_Printf(ctx, "couldn't resolve\n");
|
||||
|
@ -1249,6 +1249,7 @@ const rconcommands_t rconcommands[] =
|
|||
|
||||
{"help", 0, 1, Cmd_Help, "shows the brief intro help text"},
|
||||
{"commands", 0, 1, Cmd_Commands, "prints the list of commands"},
|
||||
{"apropos", 0, 1, Cmd_Commands, "prints all commands"},
|
||||
{"hostname", 0, 1, Cmd_Hostname, "changes the hostname seen in server browsers"},
|
||||
{"master", 0, 1, Cmd_Master, "specifies which master server to use"},
|
||||
{"udpport", 0, 1, Cmd_UDPPort, "specifies to listen on a provided udp port for regular qw clients"},
|
||||
|
|
|
@ -247,6 +247,7 @@ void Net_TCPListen(cluster_t *cluster, int port, qboolean ipv6)
|
|||
struct sockaddr *address;
|
||||
int prot;
|
||||
int addrsize;
|
||||
int _true = true;
|
||||
// int fromlen;
|
||||
|
||||
unsigned long nonblocking = true;
|
||||
|
@ -304,6 +305,13 @@ void Net_TCPListen(cluster_t *cluster, int port, qboolean ipv6)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
//win32 is so fucked up
|
||||
// setsockopt(newsocket, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char *)&_true, sizeof(_true));
|
||||
#endif
|
||||
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&_true, sizeof(_true));
|
||||
|
||||
|
||||
if (prot == AF_INET6)
|
||||
if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&v6only, sizeof(v6only)) == -1)
|
||||
v6only = true;
|
||||
|
@ -315,7 +323,7 @@ void Net_TCPListen(cluster_t *cluster, int port, qboolean ipv6)
|
|||
return;
|
||||
}
|
||||
|
||||
listen(sock, 2); //don't listen for too many clients.
|
||||
listen(sock, 2); //don't listen for too many clients at once.
|
||||
|
||||
if (v6only)
|
||||
Sys_Printf(cluster, "opened tcp%i port %i\n", ipv6?6:4, port);
|
||||
|
@ -1629,7 +1637,7 @@ void QTV_ParseQWStream(sv_t *qtv)
|
|||
sprintf(buffer, "connect %i %i %i \"%s\\name\\%s\"", 28, qtv->qport, qtv->challenge, "\\*ver\\fteqtv\\spectator\\0\\rate\\10000", qtv->cluster->hostname);
|
||||
else
|
||||
sprintf(buffer, "connect %i %i %i \"%s\\name\\%s\"", 28, qtv->qport, qtv->challenge, "\\*ver\\fteqtv\\spectator\\1\\rate\\10000", qtv->cluster->hostname);
|
||||
Netchan_OutOfBand(qtv->cluster, qtv->sourcesock, qtv->serveraddress, strlen(buffer), buffer);
|
||||
Netchan_OutOfBandSocket(qtv->cluster, qtv->sourcesock, &qtv->serveraddress, strlen(buffer), buffer);
|
||||
continue;
|
||||
}
|
||||
if (buffer[4] == 'n')
|
||||
|
@ -1874,7 +1882,7 @@ void QTV_Run(sv_t *qtv)
|
|||
else if (qtv->autodisconnect == AD_STATUSPOLL)
|
||||
{
|
||||
QTV_DisconnectFromSource(qtv);
|
||||
Netchan_OutOfBand(qtv->cluster, NET_ChooseSocket(qtv->cluster->qwdsocket, &qtv->serveraddress), qtv->serveraddress, 13, "status\n");
|
||||
Netchan_OutOfBand(qtv->cluster, qtv->serveraddress, 13, "status\n");
|
||||
qtv->nextconnectattempt = qtv->curtime + STATUSPOLL_TIME;
|
||||
return;
|
||||
}
|
||||
|
@ -1889,7 +1897,7 @@ void QTV_Run(sv_t *qtv)
|
|||
}
|
||||
}
|
||||
if (qtv->errored == ERR_NONE)
|
||||
Netchan_OutOfBand(qtv->cluster, qtv->sourcesock, qtv->serveraddress, 13, "getchallenge\n");
|
||||
Netchan_OutOfBandSocket(qtv->cluster, qtv->sourcesock, &qtv->serveraddress, 13, "getchallenge\n");
|
||||
}
|
||||
qtv->nextconnectattempt = qtv->curtime + UDPRECONNECT_TIME;
|
||||
}
|
||||
|
|
244
plugins/ezhud/ezhud.vcproj
Normal file
244
plugins/ezhud/ezhud.vcproj
Normal file
|
@ -0,0 +1,244 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="ezhud"
|
||||
ProjectGUID="{E475BFF0-6766-48BA-BE44-931C068AC5B0}"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../engine/server;../../engine/gl;../../engine/qclib;../../engine/client;../../engine/common"
|
||||
PreprocessorDefinitions="FTEPLUGIN"
|
||||
EnableFunctionLevelLinking="true"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="../../fteplug_$(ProjectName)_x86.dll"
|
||||
LinkIncremental="2"
|
||||
GenerateManifest="false"
|
||||
ModuleDefinitionFile="..\plugin.def"
|
||||
GenerateDebugInformation="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
EmbedManifest="false"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../engine/server;../../engine/gl;../../engine/qclib;../../engine/client;../../engine/common"
|
||||
PreprocessorDefinitions="FTEPLUGIN"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="../../fteplug_$(ProjectName)_x86.dll"
|
||||
GenerateManifest="false"
|
||||
ModuleDefinitionFile="..\plugin.def"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\ezquakeisms.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\hud.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\hud_common.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\hud_editor.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\plugin.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\qvm_api.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\ezquakeisms.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\hud.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\hud_common.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\hud_editor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\plugin.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="..\plugin.def"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
585
plugins/ezhud/ezquakeisms.c
Normal file
585
plugins/ezhud/ezquakeisms.c
Normal file
|
@ -0,0 +1,585 @@
|
|||
#include "../plugin.h"
|
||||
#include "ezquakeisms.h"
|
||||
#include "hud.h"
|
||||
#include "hud_editor.h"
|
||||
|
||||
int sb_lines;
|
||||
float scr_con_current;
|
||||
int sb_showteamscores;
|
||||
int sb_showscores;
|
||||
int host_screenupdatecount;
|
||||
|
||||
cvar_t *scr_newHud;
|
||||
|
||||
#define ARGNAMES ,name,defaultval,flags,description,groupname
|
||||
BUILTINR(cvar_t*, Cvar_GetNVFDG, (const char *name, const char *defaultval, unsigned int flags, const char *description, const char *groupname));
|
||||
#undef ARGNAMES
|
||||
|
||||
float infofloat(char *info, char *findkey, float def);
|
||||
|
||||
void Draw_SetOverallAlpha(float a)
|
||||
{
|
||||
}
|
||||
void Draw_AlphaFillRGB(float x, float y, float w, float h, qbyte r, qbyte g, qbyte b, qbyte a)
|
||||
{
|
||||
pDraw_Colour4f(r/255.0, g/255.0, b/255.0, a/255.0);
|
||||
pDraw_Fill(x, y, w, h);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
void Draw_Fill(float x, float y, float w, float h, qbyte pal)
|
||||
{
|
||||
pDraw_Colourp(pal);
|
||||
pDraw_Fill(x, y, w, h);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
char *ColorNameToRGBString (const char *newval)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
byte *StringToRGB(const char *str)
|
||||
{
|
||||
static byte rgba[4];
|
||||
int i;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
while(*str <= ' ')
|
||||
str++;
|
||||
if (!*str)
|
||||
rgba[i] = 255;
|
||||
else
|
||||
rgba[i] = strtoul(str, (char**)&str, 0);
|
||||
}
|
||||
return rgba;
|
||||
}
|
||||
void Draw_TextBox (int x, int y, int width, int lines)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Draw_SPic(float x, float y, mpic_t *pic, float scale)
|
||||
{
|
||||
qhandle_t image = (intptr_t)pic;
|
||||
float w, h;
|
||||
pDraw_ImageSize(image, &w, &h);
|
||||
pDraw_Image(x, y, w*scale, h*scale, 0, 0, 1, 1, image);
|
||||
}
|
||||
void Draw_SSubPic(float x, float y, mpic_t *pic, float s1, float t1, float s2, float t2, float scale)
|
||||
{
|
||||
qhandle_t image = (intptr_t)pic;
|
||||
float w, h;
|
||||
pDraw_ImageSize(image, &w, &h);
|
||||
pDraw_Image(x, y, (s2-s1)*scale, (t2-t1)*scale, s1/w, t1/h, s2/w, t2/h, image);
|
||||
}
|
||||
#define Draw_STransPic Draw_SPic
|
||||
void Draw_Character(float x, float y, unsigned int ch)
|
||||
{
|
||||
pDraw_Character(x, y, ch);
|
||||
}
|
||||
void Draw_SCharacter(float x, float y, unsigned int ch, float scale)
|
||||
{
|
||||
pDraw_Character(x, y, ch); //FIXME
|
||||
}
|
||||
|
||||
void SCR_DrawWadString(float x, float y, float scale, char *str)
|
||||
{
|
||||
pDraw_String(x, y, str); //FIXME
|
||||
}
|
||||
|
||||
void Draw_SAlphaSubPic2(float x, float y, mpic_t *pic, float s1, float t1, float s2, float t2, float sw, float sh, float alpha)
|
||||
{
|
||||
qhandle_t image = (intptr_t)pic;
|
||||
float w, h;
|
||||
pDraw_ImageSize(image, &w, &h);
|
||||
pDraw_Colour4f(1, 1, 1, alpha);
|
||||
pDraw_Image(x, y, (s2-s1)*sw, (t2-t1)*sh, s1/w, t1/h, s2/w, t2/h, image);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
void Draw_AlphaFill(float x, float y, float w, float h, qbyte pal, float alpha)
|
||||
{
|
||||
pDraw_Colour4f(1, 1, 1, alpha);
|
||||
pDraw_Colourp(pal);
|
||||
pDraw_Fill(x, y, w, h);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
void Draw_AlphaPic(float x, float y, mpic_t *pic, float alpha)
|
||||
{
|
||||
qhandle_t image = (intptr_t)pic;
|
||||
float w, h;
|
||||
pDraw_ImageSize(image, &w, &h);
|
||||
pDraw_Colour4f(1, 1, 1, alpha);
|
||||
pDraw_Image(x, y, w, h, 0, 0, 1, 1, image);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
void Draw_AlphaSubPic(float x, float y, mpic_t *pic, float s1, float t1, float s2, float t2, float alpha)
|
||||
{
|
||||
qhandle_t image = (intptr_t)pic;
|
||||
float w, h;
|
||||
pDraw_ImageSize(image, &w, &h);
|
||||
pDraw_Colour4f(1, 1, 1, alpha);
|
||||
pDraw_Image(x, y, s2-s1, t2-t1, s1/w, t1/h, s2/w, t2/h, image);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
void SCR_HUD_DrawBar(int direction, int value, float max_value, float *rgba, int x, int y, int width, int height)
|
||||
{
|
||||
int amount;
|
||||
|
||||
if(direction >= 2)
|
||||
// top-down
|
||||
amount = Q_rint(abs((height * value) / max_value));
|
||||
else// left-right
|
||||
amount = Q_rint(abs((width * value) / max_value));
|
||||
|
||||
pDraw_Colour4f(rgba[0]/255.0, rgba[1]/255.0, rgba[2]/255.0, rgba[3]/255.0);
|
||||
if(direction == 0)
|
||||
// left->right
|
||||
pDraw_Fill(x, y, amount, height);
|
||||
else if (direction == 1)
|
||||
// right->left
|
||||
pDraw_Fill(x + width - amount, y, amount, height);
|
||||
else if (direction == 2)
|
||||
// down -> up
|
||||
pDraw_Fill(x, y + height - amount, width, amount);
|
||||
else
|
||||
// up -> down
|
||||
pDraw_Fill(x, y, width, amount);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
void Draw_Polygon(int x, int y, vec3_t *vertices, int num_vertices, qbool fill, byte r, byte g, byte b, byte a)
|
||||
{
|
||||
pDraw_Colour4f(r/255.0, g/255.0, b/255.0, a/255.0);
|
||||
// pDraw_Line(x1, y1, x2, y1);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
void Draw_ColoredString3(float x, float y, const char *str, clrinfo_t *clr, int huh, int wut)
|
||||
{
|
||||
pDraw_Colour4f(clr->c[0]/255.0, clr->c[1]/255.0, clr->c[2]/255.0, clr->c[3]/255.0);
|
||||
pDraw_String(x, y, str);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
void UI_PrintTextBlock()
|
||||
{
|
||||
}
|
||||
void Draw_AlphaRectangleRGB(int x, int y, int w, int h, int foo, int bar, byte r, byte g, byte b, byte a)
|
||||
{
|
||||
float x1 = x;
|
||||
float x2 = x+w;
|
||||
float y1 = y;
|
||||
float y2 = y+h;
|
||||
pDraw_Colour4f(r/255.0, g/255.0, b/255.0, a/255.0);
|
||||
pDraw_Line(x1, y1, x2, y1);
|
||||
pDraw_Line(x2, y1, x2, y2);
|
||||
pDraw_Line(x1, y2, x2, y2);
|
||||
pDraw_Line(x1, y1, x1, y2);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
void Draw_AlphaLineRGB(float x1, float y1, float x2, float y2, float width, byte r, byte g, byte b, byte a)
|
||||
{
|
||||
pDraw_Colour4f(r/255.0, g/255.0, b/255.0, a/255.0);
|
||||
pDraw_Line(x1, y1, x2, y2);
|
||||
pDraw_Colour4f(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
mpic_t *Draw_CachePicSafe(const char *name, qbool crash, qbool ignorewad)
|
||||
{
|
||||
if (!*name)
|
||||
return NULL;
|
||||
return (mpic_t*)(qintptr_t)pDraw_LoadImage(name, false);
|
||||
}
|
||||
mpic_t *Draw_CacheWadPic(const char *name)
|
||||
{
|
||||
return (mpic_t*)(qintptr_t)pDraw_LoadImage(name, true);
|
||||
}
|
||||
|
||||
mpic_t *SCR_LoadCursorImage(char *cursorimage)
|
||||
{
|
||||
return Draw_CachePicSafe(cursorimage, false, true);
|
||||
}
|
||||
|
||||
unsigned int Sbar_ColorForMap (unsigned int m)
|
||||
{
|
||||
if (m >= 16)
|
||||
return m;
|
||||
m = (m < 0) ? 0 : ((m > 13) ? 13 : m);
|
||||
m *= 16;
|
||||
return m < 128 ? m + 8 : m + 8;
|
||||
}
|
||||
int Sbar_TopColor(player_info_t *pi)
|
||||
{
|
||||
return Sbar_ColorForMap(pi->topcolour);
|
||||
}
|
||||
int Sbar_BottomColor(player_info_t *pi)
|
||||
{
|
||||
return Sbar_ColorForMap(pi->bottomcolour);
|
||||
}
|
||||
char *TP_ParseFunChars(char *str, qbool chat)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
char *TP_ItemName(unsigned int itbit)
|
||||
{
|
||||
return "Dunno";
|
||||
}
|
||||
|
||||
void Replace_In_String(char *string, size_t strsize, char leadchar, int patterns, ...)
|
||||
{
|
||||
}
|
||||
|
||||
int SCR_GetClockStringWidth(const char *s, qbool big, float scale)
|
||||
{
|
||||
int w = 0;
|
||||
if (big)
|
||||
{
|
||||
while(*s)
|
||||
w += ((*s++==':')?16:24);
|
||||
}
|
||||
else
|
||||
w = strlen(s) * 8;
|
||||
return w * scale;
|
||||
}
|
||||
int SCR_GetClockStringHeight(qbool big, float scale)
|
||||
{
|
||||
return (big?24:8)*scale;
|
||||
}
|
||||
char *SecondsToMinutesString(int print_time, char *buffer, size_t buffersize) {
|
||||
int tens_minutes, minutes, tens_seconds, seconds;
|
||||
|
||||
tens_minutes = fmod (print_time / 600, 6);
|
||||
minutes = fmod (print_time / 60, 10);
|
||||
tens_seconds = fmod (print_time / 10, 6);
|
||||
seconds = fmod (print_time, 10);
|
||||
snprintf (buffer, buffersize, "%i%i:%i%i", tens_minutes, minutes, tens_seconds, seconds);
|
||||
return buffer;
|
||||
}
|
||||
char *SCR_GetGameTime(int t, char *buffer, size_t buffersize)
|
||||
{
|
||||
float timelimit;
|
||||
|
||||
timelimit = (t == TIMETYPE_GAMECLOCKINV) ? 60 * infofloat(cl.serverinfo, "timelimit", 0) + 1: 0;
|
||||
|
||||
if (cl.countdown || cl.standby)
|
||||
SecondsToMinutesString(timelimit, buffer, buffersize);
|
||||
else
|
||||
SecondsToMinutesString((int) abs(timelimit - (cl.time - cl.stats[STAT_MATCHSTARTTIME])), buffer, buffersize);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const char* SCR_GetTimeString(int timetype, const char *format)
|
||||
{
|
||||
static char buffer[256];
|
||||
switch(timetype)
|
||||
{
|
||||
case TIMETYPE_CLOCK:
|
||||
{
|
||||
time_t t;
|
||||
struct tm *ptm;
|
||||
time (&t);
|
||||
ptm = localtime (&t);
|
||||
if (!ptm) return "-:-";
|
||||
if (!strftime(buffer, sizeof(buffer)-1, format, ptm)) return "-:-";
|
||||
return buffer;
|
||||
}
|
||||
case TIMETYPE_GAMECLOCK:
|
||||
case TIMETYPE_GAMECLOCKINV:
|
||||
return SCR_GetGameTime(timetype, buffer, sizeof(buffer));
|
||||
|
||||
case TIMETYPE_DEMOCLOCK:
|
||||
return SecondsToMinutesString(infofloat(cl.serverinfo, "demotime", 0), buffer, sizeof(buffer));
|
||||
|
||||
default:
|
||||
return "01234";
|
||||
}
|
||||
}
|
||||
void SCR_DrawBigClock(int x, int y, int style, int blink, float scale, const char *t)
|
||||
{
|
||||
extern mpic_t *sb_nums[2][11];
|
||||
extern mpic_t *sb_colon/*, *sb_slash*/;
|
||||
qbool lblink = (int)(cls.realtime*2) & 1;
|
||||
|
||||
if (style > 1) style = 1;
|
||||
if (style < 0) style = 0;
|
||||
|
||||
while (*t)
|
||||
{
|
||||
if (*t >= '0' && *t <= '9')
|
||||
{
|
||||
Draw_STransPic(x, y, sb_nums[style][*t-'0'], scale);
|
||||
x += 24*scale;
|
||||
}
|
||||
else if (*t == ':')
|
||||
{
|
||||
if (lblink || !blink)
|
||||
Draw_STransPic (x, y, sb_colon, scale);
|
||||
|
||||
x += 16*scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
Draw_SCharacter(x, y, *t+(style?128:0), 3*scale);
|
||||
x += 24*scale;
|
||||
}
|
||||
t++;
|
||||
}
|
||||
}
|
||||
void SCR_DrawSmallClock(int x, int y, int style, int blink, float scale, const char *t)
|
||||
{
|
||||
qbool lblink = (int)(cls.realtime*2) & 1;
|
||||
int c;
|
||||
|
||||
if (style > 3) style = 3;
|
||||
if (style < 0) style = 0;
|
||||
|
||||
while (*t)
|
||||
{
|
||||
c = (int) *t;
|
||||
if (c >= '0' && c <= '9')
|
||||
{
|
||||
if (style == 1)
|
||||
c += 128;
|
||||
else if (style == 2 || style == 3)
|
||||
c -= 30;
|
||||
}
|
||||
else if (c == ':')
|
||||
{
|
||||
if (style == 1 || style == 3)
|
||||
c += 128;
|
||||
if (lblink || !blink)
|
||||
;
|
||||
else
|
||||
c = ' ';
|
||||
}
|
||||
Draw_SCharacter(x, y, c, scale);
|
||||
x+= 8*scale;
|
||||
t++;
|
||||
}
|
||||
}
|
||||
|
||||
struct
|
||||
{
|
||||
xcommand_t cmd;
|
||||
char *name;
|
||||
} concmds[128];
|
||||
int numconcmds;
|
||||
qboolean Cmd_AddCommand (char *funcname, xcommand_t function)
|
||||
{
|
||||
if (numconcmds < sizeof(concmds)/sizeof(concmds[0]))
|
||||
{
|
||||
concmds[numconcmds].cmd = function;
|
||||
concmds[numconcmds].name = funcname;
|
||||
numconcmds++;
|
||||
pCmd_AddCommand(funcname);
|
||||
return true;
|
||||
}
|
||||
Con_Printf("ezhud: too many console commands\n");
|
||||
return false;
|
||||
};
|
||||
qintptr_t EZHud_ExecuteCommand(qintptr_t *args)
|
||||
{
|
||||
char buffer[128];
|
||||
int i;
|
||||
pCmd_Argv(0, buffer, sizeof(buffer));
|
||||
for (i = 0; i < numconcmds; i++)
|
||||
{
|
||||
if (!strcmp(buffer, concmds[i].name))
|
||||
{
|
||||
concmds[i].cmd();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int IN_BestWeapon(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
qbool VID_VSyncIsOn(void){return false;}
|
||||
double vid_vsync_lag;
|
||||
|
||||
|
||||
vrect_t scr_vrect;
|
||||
|
||||
qintptr_t EZHud_Tick(qintptr_t *args)
|
||||
{
|
||||
static float lasttime, lasttime_min = 99999;
|
||||
static int framecount;
|
||||
|
||||
//realtime(ms), realtime(secs), servertime
|
||||
float oldtime = cls.realtime;
|
||||
cls.realtime = *(float*)&args[1];
|
||||
cls.frametime = cls.realtime - oldtime;
|
||||
|
||||
cl.time = *(float*)&args[2];
|
||||
|
||||
if (cls.realtime - lasttime > 1)
|
||||
{
|
||||
cls.fps = framecount/(cls.realtime - lasttime);
|
||||
lasttime = cls.realtime;
|
||||
framecount = 0;
|
||||
|
||||
if (cls.realtime - lasttime_min > 30)
|
||||
{
|
||||
cls.min_fps = cls.fps;
|
||||
lasttime_min = cls.realtime;
|
||||
}
|
||||
else if (cls.min_fps > cls.fps)
|
||||
cls.min_fps = cls.fps;
|
||||
}
|
||||
framecount++;
|
||||
|
||||
return 1;
|
||||
}
|
||||
char *findinfo(char *info, char *findkey)
|
||||
{
|
||||
int kl = strlen(findkey);
|
||||
char *key, *value;
|
||||
while(*info)
|
||||
{
|
||||
key = strchr(info, '\\');
|
||||
if (!key)
|
||||
break;
|
||||
key++;
|
||||
value = strchr(key, '\\');
|
||||
if (!value)
|
||||
break;
|
||||
info = value+1;
|
||||
if (!strncmp(key, findkey, kl) && key[kl] == '\\')
|
||||
return info;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
char *infostring(char *info, char *findkey, char *buffer, size_t bufsize)
|
||||
{
|
||||
char *value = findinfo(info, findkey);
|
||||
char *end;
|
||||
if (value)
|
||||
{
|
||||
end = strchr(value, '\\');
|
||||
if (!end)
|
||||
end = value + strlen(value);
|
||||
bufsize--;
|
||||
if (bufsize > (end - value))
|
||||
bufsize = (end - value);
|
||||
memcpy(buffer, value, bufsize);
|
||||
buffer[bufsize] = 0;
|
||||
return buffer;
|
||||
}
|
||||
*buffer = 0;
|
||||
return buffer;
|
||||
}
|
||||
float infofloat(char *info, char *findkey, float def)
|
||||
{
|
||||
char *value = findinfo(info, findkey);
|
||||
if (value)
|
||||
return atof(value);
|
||||
return def;
|
||||
}
|
||||
qintptr_t EZHud_Draw(qintptr_t *args)
|
||||
{
|
||||
char serverinfo[4096];
|
||||
char val[64];
|
||||
int i;
|
||||
cl.splitscreenview = args[0];
|
||||
scr_vrect.x = args[1];
|
||||
scr_vrect.y = args[2];
|
||||
scr_vrect.width = args[3];
|
||||
scr_vrect.height = args[4];
|
||||
sb_showscores = args[5] & 1;
|
||||
sb_showteamscores = args[5] & 2;
|
||||
|
||||
pCL_GetStats(0, cl.stats, sizeof(cl.stats)/sizeof(cl.stats[0]));
|
||||
for (i = 0; i < 32; i++)
|
||||
pGetPlayerInfo(i, &cl.players[i]);
|
||||
|
||||
pGetLocalPlayerNumbers(cl.splitscreenview, 1, &cl.playernum, &cl.tracknum);
|
||||
pGetServerInfo(cl.serverinfo, sizeof(serverinfo));
|
||||
cl.deathmatch = infofloat(cl.serverinfo, "deathmatch", 0);
|
||||
cl.teamplay = infofloat(cl.serverinfo, "teamplay", 0);
|
||||
cl.intermission = infofloat(cl.serverinfo, "intermission", 0);
|
||||
cl.spectator = (cl.playernum>=32)||cl.players[cl.playernum].spectator;
|
||||
infostring(cl.serverinfo, "status", val, sizeof(val));
|
||||
cl.standby = !strcmp(val, "standby");
|
||||
cl.countdown = !strcmp(val, "countdown");
|
||||
cls.state = ca_active;
|
||||
vid.width = pvid.width;
|
||||
vid.height = pvid.height;
|
||||
|
||||
infostring(cl.serverinfo, "demotype", val, sizeof(val));
|
||||
cls.mvdplayback = !strcmp(val, "mvd");
|
||||
cls.demoplayback = strcmp(val, "");
|
||||
|
||||
//cl.faceanimtime
|
||||
//cl.simvel
|
||||
//cl.item_gettime
|
||||
|
||||
//cls.state;
|
||||
//cls.min_fps;
|
||||
//cls.fps;
|
||||
////cls.realtime;
|
||||
////cls.trueframetime;
|
||||
//cls.mvdplayback;
|
||||
//cls.demoplayback;
|
||||
|
||||
host_screenupdatecount++;
|
||||
HUD_Draw();
|
||||
return true;
|
||||
}
|
||||
|
||||
int keydown[256];
|
||||
float cursor_x;
|
||||
float cursor_y;
|
||||
float mouse_x;
|
||||
float mouse_y;
|
||||
mpic_t *scr_cursor_icon = NULL;
|
||||
qintptr_t EZHud_MenuEvent(qintptr_t *args)
|
||||
{
|
||||
int eventtype = args[0];
|
||||
int param = args[1];
|
||||
mouse_x += args[2] - cursor_x; //FIXME: the hud editor should NOT need this sort of thing
|
||||
mouse_y += args[3] - cursor_y;
|
||||
cursor_x = args[2];
|
||||
cursor_y = args[3];
|
||||
|
||||
HUD_Editor_MouseEvent(cursor_x, cursor_y);
|
||||
|
||||
switch(eventtype)
|
||||
{
|
||||
case 0: //draw
|
||||
host_screenupdatecount++;
|
||||
HUD_Draw();
|
||||
HUD_Editor_Draw();
|
||||
|
||||
mouse_x = 0;
|
||||
mouse_y = 0;
|
||||
break;
|
||||
case 1:
|
||||
keydown[param] = true;
|
||||
HUD_Editor_Key(param, 0, true);
|
||||
break;
|
||||
case 2:
|
||||
keydown[param] = false;
|
||||
HUD_Editor_Key(param, 0, false);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
qintptr_t Plug_Init(qintptr_t *args)
|
||||
{
|
||||
CHECKBUILTIN(Cvar_GetNVFDG);
|
||||
if (BUILTINISVALID(Cvar_GetNVFDG) &&
|
||||
BUILTINISVALID(Draw_ImageSize) &&
|
||||
Plug_Export("SbarBase", EZHud_Draw) &&
|
||||
Plug_Export("MenuEvent", EZHud_MenuEvent) &&
|
||||
Plug_Export("Tick", EZHud_Tick) &&
|
||||
Plug_Export("ExecuteCommand", EZHud_ExecuteCommand))
|
||||
{
|
||||
HUD_Init();
|
||||
HUD_Editor_Init();
|
||||
return 1;
|
||||
}
|
||||
return false;
|
||||
}
|
153
plugins/ezhud/ezquakeisms.h
Normal file
153
plugins/ezhud/ezquakeisms.h
Normal file
|
@ -0,0 +1,153 @@
|
|||
//ezquake likes this
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
//ezquake types.
|
||||
#define byte qbyte
|
||||
#define qbool qboolean
|
||||
#define Com_Printf Con_Printf
|
||||
#define Com_DPrintf Con_DPrintf
|
||||
#define Cvar_Find(n) pCvar_GetNVFDG(n,NULL,0,NULL,NULL)
|
||||
#define Cvar_SetValue(var,val) pCvar_SetFloat(var->name,val)
|
||||
#define Cvar_Set(var,val) pCvar_SetString(var->name,val)
|
||||
#define Cmd_Argc pCmd_Argc
|
||||
#define Cmd_Argv(x) ""
|
||||
#define Cbuf_AddText(x) pCmd_AddText(x,false)
|
||||
#define Sys_Error(x) pSys_Error(x)
|
||||
#define Q_calloc calloc
|
||||
#define Q_malloc malloc
|
||||
#define Q_strdup strdup
|
||||
#define Q_free free
|
||||
#define Q_rint(x) ((int)(x+0.5))
|
||||
#define Q_atoi atoi
|
||||
#define strlcpy Q_strlcpy
|
||||
#define strlcat Q_strlcat
|
||||
#undef snprintf
|
||||
#define snprintf Q_snprintf
|
||||
|
||||
#undef mpic_t
|
||||
#define mpic_t void
|
||||
|
||||
|
||||
#define MV_VIEWS 4
|
||||
|
||||
|
||||
extern float cursor_x;
|
||||
extern float cursor_y;
|
||||
extern int host_screenupdatecount;
|
||||
extern cvar_t *scr_newHud;
|
||||
extern cvar_t *cl_multiview;
|
||||
|
||||
#define Cam_TrackNum() cl.tracknum
|
||||
#define spec_track cl.tracknum
|
||||
#define autocam ((spec_track==-1)?CAM_NONE:CAM_TRACK)
|
||||
//#define HAXX
|
||||
|
||||
#define vid plugvid
|
||||
#define cls plugcls
|
||||
#define cl plugcl
|
||||
#define player_info_t plugclientinfo_t
|
||||
|
||||
struct {
|
||||
int intermission;
|
||||
int teamplay;
|
||||
int deathmatch;
|
||||
int stats[MAX_CL_STATS];
|
||||
int item_gettime[32];
|
||||
char serverinfo[4096];
|
||||
player_info_t players[MAX_CLIENTS];
|
||||
int playernum;
|
||||
int tracknum;
|
||||
vec3_t simvel;
|
||||
float time;
|
||||
float faceanimtime;
|
||||
qboolean spectator;
|
||||
qboolean standby;
|
||||
qboolean countdown;
|
||||
|
||||
int splitscreenview;
|
||||
} cl;
|
||||
struct {
|
||||
int state;
|
||||
float min_fps;
|
||||
float fps;
|
||||
float realtime;
|
||||
float frametime;
|
||||
qbool mvdplayback;
|
||||
int demoplayback;
|
||||
} cls;
|
||||
struct {
|
||||
int width;
|
||||
int height;
|
||||
// float displayFrequency;
|
||||
} vid;
|
||||
|
||||
|
||||
//reimplementations of ezquake functions
|
||||
void Draw_SetOverallAlpha(float a);
|
||||
void Draw_AlphaFillRGB(float x, float y, float w, float h, qbyte r, qbyte g, qbyte b, qbyte a);
|
||||
void Draw_Fill(float x, float y, float w, float h, qbyte pal);
|
||||
char *ColorNameToRGBString (const char *newval);
|
||||
byte *StringToRGB(const char *str);
|
||||
|
||||
#define Draw_String pDraw_String
|
||||
#define Draw_Alt_String pDraw_String //FIXME
|
||||
#define Draw_ColoredString(x,y,str,alt) pDraw_String(x,y,str) //FIXME
|
||||
#define Draw_SString(x,y,str,sc) pDraw_String(x,y,str) //FIXME
|
||||
#define Draw_SAlt_String(x,y,str,sc) pDraw_String(x,y,str) //FIXME
|
||||
|
||||
void Draw_SPic(float x, float y, mpic_t *pic, float scale);
|
||||
void Draw_SSubPic(float x, float y, mpic_t *pic, float s1, float t1, float s2, float t2, float scale);
|
||||
#define Draw_STransPic Draw_SPic
|
||||
void Draw_Character(float x, float y, unsigned int ch);
|
||||
void Draw_SCharacter(float x, float y, unsigned int ch, float scale);
|
||||
|
||||
void SCR_DrawWadString(float x, float y, float scale, char *str);
|
||||
|
||||
void Draw_SAlphaSubPic2(float x, float y, mpic_t *pic, float s1, float t1, float s2, float t2, float w, float h, float alpha);
|
||||
|
||||
void Draw_AlphaFill(float x, float y, float w, float h, qbyte pal, float alpha);
|
||||
void Draw_AlphaPic(float x, float y, mpic_t *pic, float alpha);
|
||||
void Draw_AlphaSubPic(float x, float y, mpic_t *pic, float s1, float t1, float s2, float t2, float alpha);
|
||||
void SCR_HUD_DrawBar(int direction, int value, float max_value, float *rgba, int x, int y, int width, int height);
|
||||
|
||||
mpic_t *Draw_CachePicSafe(const char *name, qbool crash, qbool ignorewad);
|
||||
mpic_t *Draw_CacheWadPic(const char *name);
|
||||
|
||||
int Sbar_TopColor(player_info_t *pi);
|
||||
int Sbar_BottomColor(player_info_t *pi);
|
||||
char *TP_ParseFunChars(char*, qbool chat);
|
||||
char *TP_ItemName(unsigned int itbit);
|
||||
|
||||
#define Util_SkipChars(src,strip,dst,dstlen) strlcpy(dst,src,dstlen)
|
||||
#define Util_SkipEZColors(src,dst,dstlen) strlcpy(dst,src,dstlen)
|
||||
|
||||
void Replace_In_String(char *string, size_t strsize, char leadchar, int patterns, ...);
|
||||
static qbool Utils_RegExpMatch(char *regexp, char *term) {return true;}
|
||||
#define strlen_color strlen
|
||||
|
||||
#define clamp(v,min,max) v=bound(min,v,max)
|
||||
|
||||
|
||||
#define TIMETYPE_CLOCK 0
|
||||
#define TIMETYPE_GAMECLOCK 1
|
||||
#define TIMETYPE_GAMECLOCKINV 2
|
||||
#define TIMETYPE_DEMOCLOCK 3
|
||||
int SCR_GetClockStringWidth(const char *s, qbool big, float scale);
|
||||
int SCR_GetClockStringHeight(qbool big, float scale);
|
||||
const char* SCR_GetTimeString(int timetype, const char *format);
|
||||
void SCR_DrawBigClock(int x, int y, int style, int blink, float scale, const char *t);
|
||||
void SCR_DrawSmallClock(int x, int y, int style, int blink, float scale, const char *t);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
qbyte c[4];
|
||||
} clrinfo_t;
|
||||
void Draw_ColoredString3(float x, float y, const char *str, clrinfo_t *clr, int huh, int wut);
|
||||
void UI_PrintTextBlock();
|
||||
void Draw_AlphaRectangleRGB(int x, int y, int w, int h, int foo, int bar, byte r, byte g, byte b, byte a);
|
||||
void Draw_AlphaLineRGB(float x1, float y1, float x2, float y2, float width, byte r, byte g, byte b, byte a);
|
||||
void Draw_Polygon(int x, int y, vec3_t *vertices, int num_vertices, qbool fill, byte r, byte g, byte b, byte a);
|
||||
|
||||
//glue
|
||||
EBUILTIN(cvar_t*, Cvar_GetNVFDG, (const char *name, const char *defaultval, unsigned int flags, const char *description, const char *groupname));
|
1535
plugins/ezhud/hud.c
Normal file
1535
plugins/ezhud/hud.c
Normal file
File diff suppressed because it is too large
Load diff
177
plugins/ezhud/hud.h
Normal file
177
plugins/ezhud/hud.h
Normal file
|
@ -0,0 +1,177 @@
|
|||
/*
|
||||
Copyright (C) 2011 azazello and ezQuake team
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
//
|
||||
// HUD commands
|
||||
//
|
||||
|
||||
#ifndef __hud_h__
|
||||
#define __hud_h__
|
||||
|
||||
// flags
|
||||
#define HUD_NO_DRAW (1 << 0) // don't draw this automatically
|
||||
#define HUD_NO_SHOW (1 << 1) // doesn't support show/hide
|
||||
#define HUD_NO_POS_X (1 << 2) // doesn't support x positioning
|
||||
#define HUD_NO_POS_Y (1 << 3) // doesn't support y positioning
|
||||
#define HUD_NO_FRAME (1 << 4) // don't add frame
|
||||
#define HUD_ON_DIALOG (1 << 5) // draw on dialog too
|
||||
#define HUD_ON_INTERMISSION (1 << 6) // draw on intermission too
|
||||
#define HUD_ON_FINALE (1 << 7) // draw on finale too
|
||||
#define HUD_ON_SCORES (1 << 8) // draw on +showscores too
|
||||
#define HUD_NO_GROW (1 << 9) // no frame grow
|
||||
#define HUD_PLUSMINUS (1 << 10) // auto add +/- commands
|
||||
#define HUD_OPACITY (1 << 11)
|
||||
|
||||
#define HUD_INVENTORY (HUD_NO_GROW) // aply for sbar elements
|
||||
|
||||
#define HUD_MAX_PARAMS 24
|
||||
|
||||
#define HUD_REGEXP_OFFSET_COUNT 20
|
||||
|
||||
// Placement
|
||||
#define HUD_PLACE_SCREEN 1
|
||||
#define HUD_PLACE_TOP 2
|
||||
#define HUD_PLACE_VIEW 3
|
||||
#define HUD_PLACE_SBAR 4
|
||||
#define HUD_PLACE_IBAR 5
|
||||
#define HUD_PLACE_HBAR 6
|
||||
#define HUD_PLACE_SFREE 7
|
||||
#define HUD_PLACE_IFREE 8
|
||||
#define HUD_PLACE_HFREE 9
|
||||
|
||||
// Alignment
|
||||
#define HUD_ALIGN_LEFT 1
|
||||
#define HUD_ALIGN_TOP 1
|
||||
#define HUD_ALIGN_CENTER 2
|
||||
#define HUD_ALIGN_RIGHT 3
|
||||
#define HUD_ALIGN_BOTTOM 3
|
||||
#define HUD_ALIGN_BEFORE 4
|
||||
#define HUD_ALIGN_AFTER 5
|
||||
#define HUD_ALIGN_CONSOLE 6
|
||||
|
||||
typedef struct hud_s
|
||||
{
|
||||
char *name; // Element name.
|
||||
char *description; // Little help.
|
||||
|
||||
void (*draw_func) (struct hud_s *); // Drawing function.
|
||||
|
||||
cvar_t *order; // Higher it is, later this element will be drawn
|
||||
// and more probable that will be on top.
|
||||
|
||||
cvar_t *show; // Show cvar.
|
||||
cvar_t *frame; // Frame cvar.
|
||||
cvar_t *frame_color; // Frame color cvar.
|
||||
byte frame_color_cache[4]; // Cache for parsed frame color.
|
||||
|
||||
cvar_t *opacity; // The overall opacity of the entire HUD element.
|
||||
|
||||
// placement
|
||||
cvar_t *place; // Place string, parsed to:
|
||||
struct hud_s *place_hud; // if snapped to hud element
|
||||
qbool place_outside; // if hud: inside ot outside
|
||||
int place_num; // place number (our or parent if hud)
|
||||
// note: item is placed at another HUD element
|
||||
// if place_hud != NULL
|
||||
|
||||
cvar_t *align_x; // Alignment cvars (left, right, ...)
|
||||
cvar_t *align_y;
|
||||
int align_x_num; // Parsed alignment.
|
||||
int align_y_num;
|
||||
|
||||
cvar_t *pos_x; // Position cvars.
|
||||
cvar_t *pos_y;
|
||||
|
||||
cvar_t **params; // Registered parameters for the HUD element.
|
||||
int num_params;
|
||||
|
||||
cactive_t min_state; // At least this state is required
|
||||
// to draw this element.
|
||||
|
||||
unsigned flags;
|
||||
|
||||
// Last draw parameters (mostly used by children)
|
||||
int lx, ly, lw, lh; // Last position.
|
||||
int al, ar, at, ab; // Last frame params.
|
||||
|
||||
int last_try_sequence; // Sequence, at which object tried to draw itself.
|
||||
int last_draw_sequence; // Sequence, at which it was last drawn successfully.
|
||||
|
||||
struct hud_s *next; // Next HUD in the list.
|
||||
} hud_t;
|
||||
|
||||
typedef void (*hud_func_type) (struct hud_s *);
|
||||
|
||||
#define MAX_HUD_ELEMENTS 256
|
||||
|
||||
//
|
||||
// Initialize
|
||||
//
|
||||
void HUD_Init(void);
|
||||
|
||||
//
|
||||
// Add element to list
|
||||
// parameter format: "name1", "default1", ..., "nameX", "defaultX", NULL
|
||||
//
|
||||
hud_t * HUD_Register(char *name, char *var_alias, char *description,
|
||||
int flags, cactive_t min_state, int draw_order,
|
||||
hud_func_type draw_func,
|
||||
char *show, char *place, char *align_x, char *align_y,
|
||||
char *pos_x, char *pos_y, char *frame, char *frame_color,
|
||||
char *item_opacity, char *params, ...);
|
||||
|
||||
|
||||
//
|
||||
// Draw all active elements.
|
||||
//
|
||||
void HUD_Draw(void);
|
||||
|
||||
//
|
||||
// Retrieve hud cvar.
|
||||
//
|
||||
cvar_t *HUD_FindVar(hud_t *hud, char *subvar);
|
||||
|
||||
//
|
||||
// Find element in list.
|
||||
//
|
||||
hud_t * HUD_Find(char *name);
|
||||
|
||||
//
|
||||
// Calculate screen position of element.
|
||||
// return value:
|
||||
// true - draw it
|
||||
// false - don't draw, it is off screen (mayby partially)
|
||||
//
|
||||
qbool HUD_PrepareDraw(
|
||||
hud_t *hud, int width, int height, // In.
|
||||
int *ret_x, int *ret_y); // Out.
|
||||
|
||||
qbool HUD_PrepareDrawByName(
|
||||
char *element, int width, int height, // In.
|
||||
int *ret_x, int *ret_y); // Out.
|
||||
|
||||
|
||||
// Sort all HUD Elements.
|
||||
void HUD_Sort(void);
|
||||
|
||||
// Recalculate the position of all hud elements.
|
||||
void HUD_Recalculate(void);
|
||||
|
||||
// when show pre-selected weapon/ammo? 1) player uses this system 2) not dead 3) when playing
|
||||
#define ShowPreselectedWeap() (cl_weaponpreselect->value && cl.stats[STAT_HEALTH] > 0 && !cls.demoplayback && !cl.spectator)
|
||||
|
||||
#endif // __hud_h__
|
8250
plugins/ezhud/hud_common.c
Normal file
8250
plugins/ezhud/hud_common.c
Normal file
File diff suppressed because it is too large
Load diff
56
plugins/ezhud/hud_common.h
Normal file
56
plugins/ezhud/hud_common.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
Copyright (C) 2011 azazello and ezQuake team
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
//
|
||||
// common HUD elements
|
||||
// like clock etc..
|
||||
//
|
||||
|
||||
#ifndef __HUD_COMMON__H__
|
||||
#define __HUD_COMMON__H__
|
||||
|
||||
extern hud_t *hud_netgraph;
|
||||
|
||||
void SCR_HUD_Netgraph(hud_t *hud);
|
||||
void SCR_HUD_DrawFPS(hud_t *hud);
|
||||
void SCR_HUD_DrawNetStats(hud_t *hud);
|
||||
|
||||
void SCR_HUD_DrawGun2 (hud_t *hud);
|
||||
void SCR_HUD_DrawGun3 (hud_t *hud);
|
||||
void SCR_HUD_DrawGun4 (hud_t *hud);
|
||||
void SCR_HUD_DrawGun5 (hud_t *hud);
|
||||
void SCR_HUD_DrawGun6 (hud_t *hud);
|
||||
void SCR_HUD_DrawGun7 (hud_t *hud);
|
||||
void SCR_HUD_DrawGun8 (hud_t *hud);
|
||||
void SCR_HUD_DrawGunCurrent (hud_t *hud);
|
||||
|
||||
void HUD_NewMap();
|
||||
void HUD_NewRadarMap();
|
||||
void SCR_HUD_DrawRadar(hud_t *hud);
|
||||
|
||||
void HudCommon_Init(void);
|
||||
void SCR_HUD_DrawNum(hud_t *hud, int num, qbool low, float scale, int style, int digits, char *s_align);
|
||||
|
||||
extern qbool autohud_loaded;
|
||||
extern cvar_t *mvd_autohud;
|
||||
void HUD_AutoLoad_MVD(int autoload);
|
||||
|
||||
void HUD_BeforeDraw();
|
||||
void HUD_AfterDraw();
|
||||
void CommonDraw_Init(void);
|
||||
|
||||
#endif // __HUD_COMMON__H__
|
2800
plugins/ezhud/hud_editor.c
Normal file
2800
plugins/ezhud/hud_editor.c
Normal file
File diff suppressed because it is too large
Load diff
59
plugins/ezhud/hud_editor.h
Normal file
59
plugins/ezhud/hud_editor.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
HUD Editor module
|
||||
|
||||
Copyright (C) 2007 Cokeman
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __HUD_EDITOR_H__
|
||||
#define __HUD_EDITOR_H__
|
||||
|
||||
// hud editor drawing function
|
||||
void HUD_Editor_Draw(void);
|
||||
|
||||
// hud editor initialization
|
||||
void HUD_Editor_Init(void);
|
||||
|
||||
// Mouse processing.
|
||||
qbool HUD_Editor_MouseEvent (float x, float y);
|
||||
|
||||
// Key press processing function.
|
||||
void HUD_Editor_Key(int key, int unichar, qbool down);
|
||||
|
||||
//
|
||||
// Should this HUD element be fully drawn or not when in align mode
|
||||
// when using the HUD editor.
|
||||
//
|
||||
qbool HUD_Editor_ConfirmDraw(hud_t *hud);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
hud_editmode_off,
|
||||
hud_editmode_align,
|
||||
hud_editmode_place,
|
||||
hud_editmode_move_resize,
|
||||
hud_editmode_resize,
|
||||
hud_editmode_move_lockedaxis,
|
||||
hud_editmode_hudmenu,
|
||||
hud_editmode_menu,
|
||||
hud_editmode_hoverlist,
|
||||
hud_editmode_normal
|
||||
} hud_editor_mode_t;
|
||||
|
||||
extern hud_editor_mode_t hud_editor_mode;
|
||||
extern hud_t *selected_hud;
|
||||
|
||||
#endif // __HUD_EDITOR_H__
|
|
@ -59,20 +59,32 @@ BUILTIN(void, Con_Print, (const char *text)); //on to main console.
|
|||
BUILTIN(void, Con_SubPrint, (const char *conname, const char *text)); //on to named sub console (creating it too).
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,old,new
|
||||
BUILTIN(void, Con_RenameSub, (char *old, char *new)); //rename a subconsole
|
||||
BUILTIN(void, Con_RenameSub, (const char *old, const char *new)); //rename a subconsole
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,conname
|
||||
BUILTINR(int, Con_IsActive, (char *conname));
|
||||
BUILTINR(int, Con_IsActive, (const char *conname));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,conname
|
||||
BUILTIN(void, Con_SetActive, (char *conname));
|
||||
BUILTIN(void, Con_SetActive, (const char *conname));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,conname
|
||||
BUILTIN(void, Con_Destroy, (char *conname));
|
||||
BUILTIN(void, Con_Destroy, (const char *conname));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,connum,conname,connamelen
|
||||
BUILTIN(void, Con_NameForNum, (int connum, char *conname, int connamelen));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,conname,attribname
|
||||
BUILTINR(float, Con_GetConsoleFloat, (const char *conname, const char *attribname));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,conname,attribname,PASSFLOAT(newvalue)
|
||||
BUILTIN(void, Con_SetConsoleFloat, (const char *conname, const char *attribname, float newvalue));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,conname,attribname,value,valuesize
|
||||
BUILTINR(int, Con_GetConsoleString, (const char *conname, const char *attribname, const char *value, unsigned int valuesize));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,conname,attribname,newvalue
|
||||
BUILTIN(void, Con_SetConsoleString, (const char *conname, const char *attribname, const char *newvalue));
|
||||
#undef ARGNAMES
|
||||
|
||||
#define ARGNAMES ,message
|
||||
BUILTIN(void, Sys_Error, (char *message)); //abort the entire engine.
|
||||
|
@ -129,6 +141,9 @@ BUILTINR(int, GetPlayerInfo, (int pnum, plugclientinfo_t *info));
|
|||
#define ARGNAMES
|
||||
BUILTINR(int, LocalPlayerNumber, (void));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,firstseat,numseats,playernums,spectracks
|
||||
BUILTINR(int, GetLocalPlayerNumbers, (int firstseat, int numseats, int *playernums, int *spectracks));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,info,infolen
|
||||
BUILTIN(void, GetServerInfo, (char *info, int infolen));
|
||||
#undef ARGNAMES
|
||||
|
@ -148,18 +163,25 @@ BUILTIN(void, LocalSound, (char *soundname));
|
|||
BUILTIN(void, GetPluginName, (int plugnum, char *buffer, int bufsize));
|
||||
#undef ARGNAMES
|
||||
|
||||
#define ARGNAMES ,ni,sizeofni
|
||||
BUILTINR(int, GetNetworkInfo, (vmnetinfo_t *ni, unsigned int sizeofni));
|
||||
#undef ARGNAMES
|
||||
|
||||
#define ARGNAMES ,name,mime,data,datalen
|
||||
BUILTINR(qhandle_t, Draw_LoadImageData, (char *name, char *mime, void *data, unsigned int datalen)); //force-replace a texture.
|
||||
BUILTINR(qhandle_t, Draw_LoadImageData, (const char *name, const char *mime, const void *data, unsigned int datalen)); //force-replace a texture.
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,name,shaderscript
|
||||
BUILTINR(qhandle_t, Draw_LoadImageShader, (char *name, char *shaderscript)); //some shader script
|
||||
BUILTINR(qhandle_t, Draw_LoadImageShader, (const char *name, const char *shaderscript)); //some shader script
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,name,iswadimage
|
||||
BUILTINR(qhandle_t, Draw_LoadImage, (char *name, qboolean iswadimage)); //wad image is ONLY for loading out of q1 gfx.wad
|
||||
BUILTINR(qhandle_t, Draw_LoadImage, (const char *name, qboolean iswadimage)); //wad image is ONLY for loading out of q1 gfx.wad
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,PASSFLOAT(x),PASSFLOAT(y),PASSFLOAT(w),PASSFLOAT(h),PASSFLOAT(s1),PASSFLOAT(t1),PASSFLOAT(s2),PASSFLOAT(t2),image
|
||||
BUILTINR(int, Draw_Image, (float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t image));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,image,x,y
|
||||
BUILTINR(int, Draw_ImageSize, (qhandle_t image, float *x, float *y));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,PASSFLOAT(x1),PASSFLOAT(y1),PASSFLOAT(x2),PASSFLOAT(y2)
|
||||
BUILTIN(void, Draw_Line, (float x1, float y1, float x2, float y2));
|
||||
#undef ARGNAMES
|
||||
|
@ -170,7 +192,7 @@ BUILTIN(void, Draw_Fill, (float x, float y, float w, float h));
|
|||
BUILTIN(void, Draw_Character, (int x, int y, unsigned int character));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,PASSFLOAT(x),PASSFLOAT(y),string
|
||||
BUILTIN(void, Draw_String, (float x, float y, char *string));
|
||||
BUILTIN(void, Draw_String, (float x, float y, const char *string));
|
||||
#undef ARGNAMES
|
||||
#define ARGNAMES ,palcol
|
||||
BUILTIN(void, Draw_Colourp, (int palcol));
|
||||
|
@ -266,7 +288,17 @@ char *va(const char *format, ...) //Identical in function to the one in Quake, t
|
|||
static char string[1024];
|
||||
|
||||
va_start (argptr, format);
|
||||
#ifdef Q3_VM
|
||||
Q_vsnprintf (string, sizeof(string), format,argptr);
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
#undef _vsnprintf
|
||||
_vsnprintf (string, sizeof(string), format,argptr);
|
||||
string[sizeof(string)-1] = 0;
|
||||
#else
|
||||
vsnprintf (string, sizeof(string), format,argptr);
|
||||
#endif
|
||||
#endif
|
||||
va_end (argptr);
|
||||
|
||||
return string;
|
||||
|
@ -375,18 +407,21 @@ void Plug_InitStandardBuiltins(void)
|
|||
CHECKBUILTIN(CL_GetStats);
|
||||
CHECKBUILTIN(GetPlayerInfo);
|
||||
CHECKBUILTIN(LocalPlayerNumber);
|
||||
CHECKBUILTIN(GetLocalPlayerNumbers);
|
||||
CHECKBUILTIN(GetServerInfo);
|
||||
CHECKBUILTIN(SetUserInfo);
|
||||
CHECKBUILTIN(LocalSound);
|
||||
CHECKBUILTIN(Menu_Control);
|
||||
CHECKBUILTIN(Key_GetKeyCode);
|
||||
CHECKBUILTIN(GetLocationName);
|
||||
CHECKBUILTIN(GetNetworkInfo);
|
||||
|
||||
//drawing routines
|
||||
CHECKBUILTIN(Draw_LoadImageData);
|
||||
CHECKBUILTIN(Draw_LoadImageShader);
|
||||
CHECKBUILTIN(Draw_LoadImage);
|
||||
CHECKBUILTIN(Draw_Image);
|
||||
CHECKBUILTIN(Draw_ImageSize);
|
||||
CHECKBUILTIN(Draw_Line);
|
||||
CHECKBUILTIN(Draw_Fill);
|
||||
CHECKBUILTIN(Draw_Character);
|
||||
|
@ -405,6 +440,10 @@ void Plug_InitStandardBuiltins(void)
|
|||
CHECKBUILTIN(Con_SetActive);
|
||||
CHECKBUILTIN(Con_Destroy);
|
||||
CHECKBUILTIN(Con_NameForNum);
|
||||
CHECKBUILTIN(Con_GetConsoleFloat);
|
||||
CHECKBUILTIN(Con_SetConsoleFloat);
|
||||
CHECKBUILTIN(Con_GetConsoleString);
|
||||
CHECKBUILTIN(Con_SetConsoleString);
|
||||
}
|
||||
|
||||
#ifndef Q3_VM
|
||||
|
@ -414,11 +453,11 @@ void NATIVEEXPORT dllEntry(qintptr_t (QDECL *funcptr)(qintptr_t,...))
|
|||
}
|
||||
#endif
|
||||
|
||||
vmvideo_t vid;
|
||||
vmvideo_t pvid;
|
||||
qintptr_t QDECL Plug_UpdateVideo(qintptr_t *args)
|
||||
{
|
||||
vid.width = args[0];
|
||||
vid.height = args[1];
|
||||
pvid.width = args[0];
|
||||
pvid.height = args[1];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -196,11 +196,15 @@ EBUILTIN(qboolean, Plug_ExportNative, (const char *funcname, void *func)); //set
|
|||
EBUILTIN(void, Con_Print, (const char *text)); //on to main console.
|
||||
|
||||
EBUILTIN(void, Con_SubPrint, (const char *subname, const char *text)); //on to sub console.
|
||||
EBUILTIN(void, Con_RenameSub, (char *oldname, char *newname)); //rename a console.
|
||||
EBUILTIN(int, Con_IsActive, (char *conname));
|
||||
EBUILTIN(void, Con_SetActive, (char *conname));
|
||||
EBUILTIN(void, Con_Destroy, (char *conname));
|
||||
EBUILTIN(void, Con_RenameSub, (const char *oldname, const char *newname)); //rename a console.
|
||||
EBUILTIN(int, Con_IsActive, (const char *conname));
|
||||
EBUILTIN(void, Con_SetActive, (const char *conname));
|
||||
EBUILTIN(void, Con_Destroy, (const char *conname));
|
||||
EBUILTIN(void, Con_NameForNum, (int connum, char *conname, int connamelen));
|
||||
EBUILTIN(float, Con_GetConsoleFloat, (const char *conname, const char *attribname));
|
||||
EBUILTIN(void, Con_SetConsoleFloat, (const char *conname, const char *attribname, float newvalue));
|
||||
EBUILTIN(int, Con_GetConsoleString, (const char *conname, const char *attribname, const char *value, unsigned int valuesize));
|
||||
EBUILTIN(void, Con_SetConsoleString, (const char *conname, const char *attribname, const char *newvalue));
|
||||
|
||||
EBUILTIN(void, Sys_Error, (char *message)); //abort the entire engine.
|
||||
EBUILTIN(unsigned int, Sys_Milliseconds, ());
|
||||
|
@ -224,24 +228,61 @@ EBUILTIN(void, LocalSound, (char *soundname));
|
|||
EBUILTIN(int, CL_GetStats, (int pnum, unsigned int *stats, int maxstats));
|
||||
EBUILTIN(int, GetPlayerInfo, (int pnum, plugclientinfo_t *info));
|
||||
|
||||
EBUILTIN(int, LocalPlayerNumber, (void));
|
||||
EBUILTIN(int, LocalPlayerNumber, (void)); //deprecated
|
||||
EBUILTIN(int, GetLocalPlayerNumbers, (int firstseat, int numseats, int *playernums, int *spectracks));
|
||||
EBUILTIN(void, GetServerInfo, (char *info, int infolen));
|
||||
EBUILTIN(void, SetUserInfo, (char *key, char *value));
|
||||
EBUILTIN(void, GetLocationName, (float *pos, char *buffer, int bufferlen));
|
||||
EBUILTIN(void, GetLocationName, (float *pos, char *buffer, int bufferlen));
|
||||
|
||||
typedef struct {
|
||||
int seats;
|
||||
struct
|
||||
{
|
||||
float avg;
|
||||
float mn;
|
||||
float mx;
|
||||
float stddev;
|
||||
float loss;
|
||||
} ping;
|
||||
float mlatency;
|
||||
float mrate;
|
||||
float vlatency;
|
||||
float vrate;
|
||||
vec3_t speed; //player speed
|
||||
|
||||
struct
|
||||
{
|
||||
float in_pps;
|
||||
float in_bps;
|
||||
float out_pps;
|
||||
float out_bps;
|
||||
} clrate;
|
||||
struct
|
||||
{
|
||||
float in_pps;
|
||||
float in_bps;
|
||||
float out_pps;
|
||||
float out_bps;
|
||||
} svrate;
|
||||
} vmnetinfo_t;
|
||||
EBUILTIN(int, GetNetworkInfo, (vmnetinfo_t *ni, unsigned int sizeofni));
|
||||
|
||||
|
||||
EBUILTIN(void, Menu_Control, (int mnum));
|
||||
#define MENU_CLEAR 0
|
||||
#define MENU_GRAB 1
|
||||
EBUILTIN(int, Key_GetKeyCode, (char *keyname));
|
||||
|
||||
EBUILTIN(qhandle_t, Draw_LoadImageData, (char *name, char *mime, void *data, unsigned int datasize)); //load/replace a named texture
|
||||
EBUILTIN(qhandle_t, Draw_LoadImageShader, (char *name, char *defaultshader)); //loads a shader.
|
||||
EBUILTIN(qhandle_t, Draw_LoadImage, (char *name, qboolean iswadimage)); //wad image is ONLY for loading out of q1 gfx.wad. loads a shader.
|
||||
EBUILTIN(qhandle_t, Draw_LoadImageData, (const char *name, const char *mime, const void *data, unsigned int datasize)); //load/replace a named texture
|
||||
EBUILTIN(qhandle_t, Draw_LoadImageShader, (const char *name, const char *defaultshader)); //loads a shader.
|
||||
EBUILTIN(qhandle_t, Draw_LoadImage, (const char *name, qboolean iswadimage)); //wad image is ONLY for loading out of q1 gfx.wad. loads a shader.
|
||||
EBUILTIN(int, Draw_Image, (float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t image));
|
||||
EBUILTIN(int, Draw_ImageSize, (qhandle_t image, float *x, float *y));
|
||||
EBUILTIN(void, Draw_Fill, (float x, float y, float w, float h));
|
||||
EBUILTIN(void, Draw_Line, (float x1, float y1, float x2, float y2));
|
||||
EBUILTIN(void, Draw_Character, (int x, int y, unsigned int character));
|
||||
EBUILTIN(void, Draw_String, (float x, float y, char *string));
|
||||
EBUILTIN(void, Draw_String, (float x, float y, const char *string));
|
||||
EBUILTIN(void, Draw_Colourp, (int palcol));
|
||||
EBUILTIN(void, Draw_Colour3f, (float r, float g, float b));
|
||||
EBUILTIN(void, Draw_Colour4f, (float r, float g, float b, float a));
|
||||
|
@ -324,11 +365,7 @@ typedef struct {
|
|||
int width;
|
||||
int height;
|
||||
} vmvideo_t;
|
||||
#ifdef _VM_H
|
||||
#define vid ohnoes
|
||||
#else
|
||||
extern vmvideo_t vid;
|
||||
#endif
|
||||
extern vmvideo_t pvid;
|
||||
|
||||
#define VMCvar_SetString(c,v) \
|
||||
do{ \
|
||||
|
|
Loading…
Reference in a new issue