------------------------------------------------------------------------

r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines

removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen. 
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2013-03-12 22:29:40 +00:00
parent 4519fe7035
commit 8d5b217266
144 changed files with 11468 additions and 8491 deletions

View file

@ -356,7 +356,7 @@ PROFILE_CFLAGS=-pg
DX7SDK=-I./libs/dxsdk7/include/
GLCFLAGS=-DGLQUAKE
D3DCFLAGS=-DD3D9QUAKE -DD3D11QUAKE
D3DCFLAGS=-DD3D9QUAKE
NPFTECFLAGS=-DNPFTE
SPEEXCFLAGS=-DSPEEX_STATIC -I$(BASE_DIR)/libs/speex/include -DFIXED_POINT -DUSE_KISS_FFT -DEXPORT=""
@ -780,7 +780,7 @@ ifeq ($(FTE_TARGET),vc)
RELEASE_LDFLAGS = /LTCG:PGOPTIMIZE
DO_CC=@$(CC) /nologo $(ALL_CFLAGS) -Fo$@ -c $<
DO_LD=@"$(MSVCPATH)link" /nologo /out:"$@" /nodefaultlib:libc.lib /nodefaultlib:MSVCRT $(MSVCLIB) /manifest:no /OPT:REF wsock32.lib user32.lib advapi32.lib winmm.lib libs/zlib$(BITS).lib shell32.lib
DO_LD=@"$(MSVCPATH)link" /nologo /out:"$@" /nodefaultlib:libc.lib /LARGEADDRESSAWARE /nodefaultlib:MSVCRT $(MSVCLIB) /manifest:no /OPT:REF wsock32.lib user32.lib advapi32.lib winmm.lib libs/zlib$(BITS).lib shell32.lib
PRECOMPHEADERS =
NODEPS = 1
@ -804,6 +804,9 @@ ifeq ($(FTE_TARGET),vc)
GLCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SPEEX_OBJS) gl_vidnt.o snd_win.o snd_directx.o cd_win.o fs_win32.o in_win.o sys_win.o sys_win_threads.o resources.o
GL_OBJS=
MINGL_DIR=mingl_vc$(BITS)
MINGL_EXE_NAME=../fteminglqw$(BITS).exe
D3DCL_OBJS=$(D3DQUAKE_OBJS) $(SPEEX_OBJS) snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o sys_win_threads.o $(D3DGL_OBJS) fs_win32.o $(LTO_END) resources.o $(LTO_START)
D3D_EXE_NAME=../fted3dqw$(BITS).exe
D3DCL_EXE_NAME=../fted3dclqw$(BITS).exe

View file

@ -571,22 +571,25 @@ void Cam_FinishMove(int pnum, usercmd_t *cmd)
nb |= (cmd->forwardmove>0)?32:0;
nb |= (cmd->upmove<0)?64:0;
nb |= (cmd->upmove>0)?128:0;
if (nb & (nb ^ oldbuttons[pnum]) & 4)
Cvar_SetValue(&cl_demospeed, max(cl_demospeed.value - 0.1, 0));
if (nb & (nb ^ oldbuttons[pnum]) & 8)
Cvar_SetValue(&cl_demospeed, min(cl_demospeed.value + 0.1, 10));
if (nb & (nb ^ oldbuttons[pnum]) & (4|8))
Con_Printf("playback speed: %g%%\n", cl_demospeed.value*100);
if (nb & (nb ^ oldbuttons[pnum]) & 16)
Cbuf_AddText("demo_jump +10", RESTRICT_LOCAL);
if (nb & (nb ^ oldbuttons[pnum]) & 32)
Cbuf_AddText("demo_jump -10", RESTRICT_LOCAL);
if (nb & (nb ^ oldbuttons[pnum]) & (4|8))
Con_Printf("playback speed: %g%%\n", cl_demospeed.value*100);
if (nb & (nb ^ oldbuttons[pnum]) & 64)
Cvar_SetValue(&cl_splitscreen, max(cl_splitscreen.ival - 1, 0));
if (nb & (nb ^ oldbuttons[pnum]) & 128)
Cvar_SetValue(&cl_splitscreen, min(cl_splitscreen.ival + 1, MAX_SPLITS-1));
if (Cam_TrackNum(pnum) >= 0)
{
if (nb & (nb ^ oldbuttons[pnum]) & 4)
Cvar_SetValue(&cl_demospeed, max(cl_demospeed.value - 0.1, 0));
if (nb & (nb ^ oldbuttons[pnum]) & 8)
Cvar_SetValue(&cl_demospeed, min(cl_demospeed.value + 0.1, 10));
if (nb & (nb ^ oldbuttons[pnum]) & (4|8))
Con_Printf("playback speed: %g%%\n", cl_demospeed.value*100);
if (nb & (nb ^ oldbuttons[pnum]) & 16)
Cbuf_AddText("demo_jump +10", RESTRICT_LOCAL);
if (nb & (nb ^ oldbuttons[pnum]) & 32)
Cbuf_AddText("demo_jump -10", RESTRICT_LOCAL);
if (nb & (nb ^ oldbuttons[pnum]) & (4|8))
Con_Printf("playback speed: %g%%\n", cl_demospeed.value*100);
if (nb & (nb ^ oldbuttons[pnum]) & 64)
Cvar_SetValue(&cl_splitscreen, max(cl_splitscreen.ival - 1, 0));
if (nb & (nb ^ oldbuttons[pnum]) & 128)
Cvar_SetValue(&cl_splitscreen, min(cl_splitscreen.ival + 1, MAX_SPLITS-1));
}
oldbuttons[pnum] = (oldbuttons[pnum] & 3) | (nb & ~3);
if (cmd->impulse)
{

View file

@ -784,10 +784,7 @@ static qintptr_t CG_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
break;
case CG_R_CLEARSCENE: //clear scene (not rtlights, only dynamic ones)
cl_numvisedicts = 0;
cl_numstrisidx = 0;
cl_numstrisvert = 0;
cl_numstris = 0;
CL_ClearEntityLists();
rtlights_first = RTL_FIRST;
break;
case CG_R_ADDPOLYTOSCENE:

View file

@ -72,6 +72,7 @@ void CL_StopPlayback (void)
cls.demoinfile = NULL;
cls.state = ca_disconnected;
cls.demoplayback = DPB_NONE;
cls.demoseeking = false; //just in case
if (cls.timedemo)
CL_FinishTimeDemo ();
@ -310,7 +311,7 @@ void CL_ProgressDemoTime(void)
return;
}
if (cl_demospeed.value >= 0)
if (cl_demospeed.value >= 0 && cls.state == ca_active)
demtime += host_frametime*cl_demospeed.value;
else
demtime += host_frametime;
@ -347,17 +348,20 @@ void CL_DemoJump_f(void)
else
newtime = atoi(s);
}
if (newtime < 0)
newtime = 0;
if (newtime >= demtime)
demtime = newtime;
cls.demoseektime = newtime;
else
{
Con_Printf("Rewinding demo\n");
CL_PlayDemo(lastdemoname);
//now fastparse it.
demtime = newtime;
cls.demoseektime = newtime;
}
cls.demoseeking = true;
}
/*
@ -544,7 +548,13 @@ readnext:
// decide if it is time to grab the next message
if (cls.timedemo)
if (cls.demoseeking)
{
demtime = demotime; //warp
if (demtime >= cls.demoseektime)
cls.demoseeking = false;
}
else if (cls.timedemo)
{
if (cls.td_lastframe < 0)
cls.td_lastframe = demotime;
@ -1226,7 +1236,7 @@ void CL_Record_f (void)
if (memcmp(es, &nullentitystate, sizeof(nullentitystate)))
{
MSG_WriteByte (&buf,svc_spawnbaseline);
MSG_WriteShort (&buf, i);
MSG_WriteEntity (&buf, i);
MSG_WriteByte (&buf, es->modelindex);
MSG_WriteByte (&buf, es->frame);

File diff suppressed because it is too large Load diff

View file

@ -854,8 +854,6 @@ void CL_UpdatePrydonCursor(usercmd_t *from, float cursor_screen[2], vec3_t curso
vec3_t temp;
vec3_t cursor_impact_normal;
extern int mousecursor_x, mousecursor_y;
cursor_active = true;
if (!cl_prydoncursor.ival)
@ -982,7 +980,7 @@ void CLNQ_SendMove (usercmd_t *cmd, int pnum, sizebuf_t *buf)
MSG_WriteFloat (buf, cursor_impact[0]);
MSG_WriteFloat (buf, cursor_impact[1]);
MSG_WriteFloat (buf, cursor_impact[2]);
MSG_WriteShort (buf, cursor_entitynumber);
MSG_WriteEntity (buf, cursor_entitynumber);
}
}
@ -1425,7 +1423,7 @@ qboolean CL_SendCmdQW (sizebuf_t *buf)
MSG_WriteFloat(buf, cursor_impact[0]);
MSG_WriteFloat(buf, cursor_impact[1]);
MSG_WriteFloat(buf, cursor_impact[2]);
MSG_WriteShort(buf, cursor_entitynumber);
MSG_WriteEntity(buf, cursor_entitynumber);
}
else
cursor_active = false;
@ -1527,7 +1525,7 @@ void CL_SendCmd (double frametime, qboolean mainloop)
}
for (plnum = 0; plnum < cl.splitclients; plnum++)
{
cmd = &cl.frames[i].cmd[0];
cmd = &cl.frames[i].cmd[plnum];
memset(cmd, 0, sizeof(*cmd));
msecs += frametime*1000;

View file

@ -77,23 +77,23 @@ cvar_t m_side = CVARF("m_side","0.8", CVAR_ARCHIVE);
cvar_t cl_lerp_players = CVARD("cl_lerp_players", "0", "Set this to make other players smoother, though it may increase effective latency. Affects only QuakeWorld.");
cvar_t cl_predict_players = CVARD("cl_predict_players", "1", "Clear this cvar to see ents exactly how they are on the server.");
cvar_t cl_predict_players_frac = CVARD("cl_predict_players_frac", "0.9", "How much of other players to predict. Values less than 1 will help minimize overruns.");
cvar_t cl_solid_players = CVAR("cl_solid_players", "1");
cvar_t cl_solid_players = CVARD("cl_solid_players", "1", "Consider other players as solid for player prediction.");
cvar_t cl_noblink = CVARD("cl_noblink", "0", "Disable the ^^b text blinking feature.");
cvar_t cl_servername = CVAR("cl_servername", "none");
cvar_t cl_serveraddress = CVAR("cl_serveraddress", "none");
cvar_t cl_servername = CVARD("cl_servername", "none", "The hostname of the last server you connected to");
cvar_t cl_serveraddress = CVARD("cl_serveraddress", "none", "The address of the last server you connected to");
cvar_t qtvcl_forceversion1 = CVAR("qtvcl_forceversion1", "0");
cvar_t qtvcl_eztvextensions = CVAR("qtvcl_eztvextensions", "0");
cvar_t cl_demospeed = CVARAF("cl_demospeed", "1", "demo_setspeed", 0);
cvar_t cl_loopbackprotocol = CVAR("cl_loopbackprotocol", "qw");
cvar_t cl_loopbackprotocol = CVARD("cl_loopbackprotocol", "qw", "Which protocol to use for single-player/the internal client. Should be one of: qw, nqid, nq, fitz, dp6, dp7.");
cvar_t cl_threadedphysics = CVAR("cl_threadedphysics", "0");
cvar_t localid = SCVAR("localid", "");
cvar_t r_drawflame = CVAR("r_drawflame", "1");
cvar_t r_drawflame = CVARD("r_drawflame", "1", "Set to -1 to disable ALL static entities. Set to 0 to disable only wall torches and standing flame. Set to 1 for everything drawn as normal.");
static qboolean allowremotecmd = true;
@ -110,10 +110,10 @@ cvar_t skin = CVARF("skin", "", CVAR_ARCHIVE | CVAR_USERINFO);
cvar_t model = CVARF("model", "", CVAR_ARCHIVE | CVAR_USERINFO);
cvar_t topcolor = CVARF("topcolor", "", CVAR_ARCHIVE | CVAR_USERINFO);
cvar_t bottomcolor = CVARF("bottomcolor", "", CVAR_ARCHIVE | CVAR_USERINFO);
cvar_t rate = CVARF("rate", "10000"/*"6480"*/, CVAR_ARCHIVE | CVAR_USERINFO);
cvar_t drate = CVARF("drate", "100000", CVAR_ARCHIVE | CVAR_USERINFO); // :)
cvar_t rate = CVARFD("rate", "10000"/*"6480"*/, CVAR_ARCHIVE | CVAR_USERINFO, "A rough measure of the bandwidth to try to use while playing. Too high a value may result in 'buffer bloat'.");
cvar_t drate = CVARFD("drate", "100000", CVAR_ARCHIVE | CVAR_USERINFO, "A rough measure of the bandwidth to try to use while downloading."); // :)
cvar_t noaim = CVARF("noaim", "", CVAR_ARCHIVE | CVAR_USERINFO);
cvar_t msg = CVARF("msg", "1", CVAR_ARCHIVE | CVAR_USERINFO);
cvar_t msg = CVARFD("msg", "1", CVAR_ARCHIVE | CVAR_USERINFO, "Filter console prints/messages. Only functions on QuakeWorld servers. 0=pickup messages. 1=death messages. 2=critical messages. 3=chat.");
cvar_t b_switch = CVARF("b_switch", "", CVAR_ARCHIVE | CVAR_USERINFO);
cvar_t w_switch = CVARF("w_switch", "", CVAR_ARCHIVE | CVAR_USERINFO);
cvar_t cl_nofake = CVARD("cl_nofake", "2", "value 0: permits \\r chars in chat messages\nvalue 1: blocks all \\r chars\nvalue 2: allows \\r chars, but only from teammates");
@ -149,12 +149,12 @@ cvar_t cl_muzzleflash = SCVAR("cl_muzzleflash", "1");
cvar_t cl_item_bobbing = CVARF("cl_model_bobbing", "0", CVAR_ARCHIVE);
cvar_t cl_countpendingpl = SCVAR("cl_countpendingpl", "0");
cvar_t cl_standardchat = SCVARF("cl_standardchat", "0", CVAR_ARCHIVE);
cvar_t msg_filter = SCVAR("msg_filter", "0"); //0 for neither, 1 for mm1, 2 for mm2, 3 for both
cvar_t cl_standardmsg = SCVARF("cl_standardmsg", "0", CVAR_ARCHIVE);
cvar_t cl_standardchat = CVARFD("cl_standardchat", "0", CVAR_ARCHIVE, "Disables auto colour coding in chat messages.");
cvar_t msg_filter = CVARD("msg_filter", "0", "Filter out chat messages: 0=neither. 1=broadcast chat. 2=team chat. 3=all chat.");
cvar_t cl_standardmsg = CVARFD("cl_standardmsg", "0", CVAR_ARCHIVE, "Disables auto colour coding in console prints.");
cvar_t cl_parsewhitetext = CVARD("cl_parsewhitetext", "1", "When parsing chat messages, enable support for messages like: red{white}red");
cvar_t cl_dlemptyterminate = SCVAR("cl_dlemptyterminate", "1");
cvar_t cl_dlemptyterminate = CVAR("cl_dlemptyterminate", "1");
cvar_t host_mapname = CVARAF("mapname", "",
"host_mapname", 0);
@ -200,7 +200,8 @@ int rtlights_first, rtlights_max;
// this is double buffered so the last frame
// can be scanned for oldorigins of trailing objects
int cl_numvisedicts;
entity_t cl_visedicts[MAX_VISEDICTS];
int cl_maxvisedicts;
entity_t *cl_visedicts;
scenetris_t *cl_stris;
vecV_t *cl_strisvertv;
@ -344,8 +345,8 @@ void CL_SupportedFTEExtensions(int *pext1, int *pext2)
unsigned int fteprotextsupported = 0;
unsigned int fteprotextsupported2 = 0;
fteprotextsupported = Net_PextMask(1);
fteprotextsupported2 = Net_PextMask(2);
fteprotextsupported = Net_PextMask(1, false);
fteprotextsupported2 = Net_PextMask(2, false);
fteprotextsupported &= strtoul(cl_pext_mask.string, NULL, 16);
// fteprotextsupported2 &= strtoul(cl_pext2_mask.string, NULL, 16);
@ -642,6 +643,11 @@ void CL_CheckForResend (void)
cl.movemessages = 0;
if (!strcmp(cl_loopbackprotocol.string, "qw"))
cls.protocol = CP_QUAKEWORLD;
else if (!strcmp(cl_loopbackprotocol.string, "fitz")) //actually proquake, because we might as well use the extra angles
{
cls.protocol = CP_NETQUAKE;
cls.protocol_nq = CPNQ_FITZ666;
}
else if (!strcmp(cl_loopbackprotocol.string, "nq")) //actually proquake, because we might as well use the extra angles
{
cls.protocol = CP_NETQUAKE;
@ -687,6 +693,8 @@ void CL_CheckForResend (void)
while(NET_GetPacket (NS_SERVER, 0) >= 0)
{
}
net_message.packing = SZ_RAWBYTES;
net_message.cursize = 0;
if (cls.protocol_nq == CPNQ_ID)
{
@ -695,6 +703,13 @@ void CL_CheckForResend (void)
SVC_DirectConnect();
}
else if (cls.protocol_nq == CPNQ_FITZ666)
{
net_from = adr;
Cmd_TokenizeString (va("connect %i %i %i \"\\name\\unconnected\\mod\\666\"", NET_PROTOCOL_VERSION, 0, SV_NewChallenge()), false, false);
SVC_DirectConnect();
}
else if (cls.protocol_nq == CPNQ_PROQUAKE3_4)
{
net_from = adr;
@ -706,7 +721,7 @@ void CL_CheckForResend (void)
CL_ConnectToDarkPlaces("", adr);
}
else
CL_SendConnectPacket (8192-16, Net_PextMask(1), Net_PextMask(2), false);
CL_SendConnectPacket (8192-16, Net_PextMask(1, false), Net_PextMask(2, false), false);
return;
}
#endif
@ -3685,8 +3700,8 @@ double Host_Frame (double time)
SV_Frame();
RSpeedEnd(RSPEED_SERVER);
host_frametime = ohft;
if (cls.protocol != CP_QUAKE3 && cls.protocol != CP_QUAKE2)
CL_ReadPackets (); //q3's cgame cannot cope with input commands with the same time as the most recent snapshot value
// if (cls.protocol != CP_QUAKE3 && cls.protocol != CP_QUAKE2)
// CL_ReadPackets (); //q3's cgame cannot cope with input commands with the same time as the most recent snapshot value
}
#endif
CL_CalcClientTime();
@ -3968,6 +3983,9 @@ void Host_Init (quakeparms_t *parms)
COM_Init ();
#ifdef Q2BSPS
CM_Init();
#endif
#ifdef TERRAIN
Terr_Init();
#endif
Host_FixupModelNames();
@ -4095,6 +4113,7 @@ void Host_Shutdown(void)
MasterInfo_Shutdown();
#endif
CL_FreeDlights();
CL_FreeVisEdicts();
M_Shutdown();
#ifndef CLIENTONLY
SV_Shutdown();

View file

@ -1222,7 +1222,8 @@ int CL_LoadModels(int stage, qboolean dontactuallyload)
SCR_SetLoadingFile("csqc init");
if (CSQC_Inited())
{
CL_SendClientCommand(true, "enablecsqc");
if (cls.fteprotocolextensions & PEXT_CSQC)
CL_SendClientCommand(true, "enablecsqc");
}
else
{
@ -1451,7 +1452,7 @@ void CL_RequestNextDownload (void)
if (cls.demoplayback == DPB_EZTV)
{
if (CL_RemoveClientCommands("qtvspawn"))
Con_Printf("Multiple prespawns\n");
Con_DPrintf("Multiple prespawns\n");
CL_SendClientCommand(true, "qtvspawn %i 0 %i", cl.servercount, COM_RemapMapChecksum(LittleLong(cl.worldmodel->checksum2)));
SCR_SetLoadingStage(LS_NONE);
}
@ -1459,9 +1460,14 @@ void CL_RequestNextDownload (void)
{
// done with modellist, request first of static signon messages
if (CL_RemoveClientCommands("prespawn"))
Con_Printf("Multiple prespawns\n");
// CL_SendClientCommand("prespawn %i 0 %i", cl.servercount, cl.worldmodel->checksum2);
CL_SendClientCommand(true, prespawn_name, cl.servercount, COM_RemapMapChecksum(LittleLong(cl.worldmodel->checksum2)));
Con_DPrintf("Multiple prespawns\n");
if (cls.protocol == CP_NETQUAKE)
CL_SendClientCommand(true, "prespawn");
else
{
// CL_SendClientCommand("prespawn %i 0 %i", cl.servercount, cl.worldmodel->checksum2);
CL_SendClientCommand(true, prespawn_name, cl.servercount, COM_RemapMapChecksum(LittleLong(cl.worldmodel->checksum2)));
}
}
}
@ -2532,7 +2538,7 @@ void CLQW_ParseServerData (void)
if (cls.fteprotocolextensions & PEXT_PK3DOWNLOADS) //instead of going for a soundlist, go for the pk3 list instead. The server will make us go for the soundlist after.
{
if (CL_RemoveClientCommands("pk3list"))
Con_Printf("Multiple pk3lists\n");
Con_DPrintf("Multiple pk3lists\n");
CL_SendClientCommand ("pk3list %i 0", cl.servercount, 0);
}
else
@ -2541,13 +2547,13 @@ void CLQW_ParseServerData (void)
if (cls.demoplayback == DPB_EZTV)
{
if (CL_RemoveClientCommands("qtvsoundlist"))
Con_Printf("Multiple soundlists\n");
Con_DPrintf("Multiple soundlists\n");
CL_SendClientCommand (true, "qtvsoundlist %i 0", cl.servercount);
}
else
{
if (CL_RemoveClientCommands("soundlist"))
Con_Printf("Multiple soundlists\n");
Con_DPrintf("Multiple soundlists\n");
// ask for the sound list next
// CL_SendClientCommand ("soundlist %i 0", cl.servercount);
CL_SendClientCommand (true, soundlist_name, cl.servercount, 0);
@ -3161,7 +3167,7 @@ void CL_ParseSoundlist (qboolean lots)
if (cls.demoplayback != DPB_EZTV)
{
if (CL_RemoveClientCommands("soundlist"))
Con_Printf("Multiple soundlists\n");
Con_DPrintf("Multiple soundlists\n");
// CL_SendClientCommand("soundlist %i %i", cl.servercount, n);
CL_SendClientCommand(true, soundlist_name, cl.servercount, (numsounds&0xff00) + n);
}
@ -3183,13 +3189,13 @@ void CL_ParseSoundlist (qboolean lots)
if (cls.demoplayback == DPB_EZTV)
{
if (CL_RemoveClientCommands("qtvmodellist"))
Con_Printf("Multiple modellists\n");
Con_DPrintf("Multiple modellists\n");
CL_SendClientCommand (true, "qtvmodellist %i 0", cl.servercount);
}
else
{
if (CL_RemoveClientCommands("modellist"))
Con_Printf("Multiple modellists\n");
Con_DPrintf("Multiple modellists\n");
// CL_SendClientCommand ("modellist %i 0", cl.servercount);
CL_SendClientCommand (true, modellist_name, cl.servercount, 0);
}
@ -3256,7 +3262,7 @@ void CL_ParseModellist (qboolean lots)
if (cls.demoplayback != DPB_EZTV)
{
if (CL_RemoveClientCommands("modellist"))
Con_Printf("Multiple modellists\n");
Con_DPrintf("Multiple modellists\n");
// CL_SendClientCommand("modellist %i %i", cl.servercount, n);
CL_SendClientCommand(true, modellist_name, cl.servercount, (nummodels&0xff00) + n);
}
@ -3497,8 +3503,8 @@ void CLFitz_ParseBaseline2 (entity_state_t *es)
memcpy(es, &nullentitystate, sizeof(entity_state_t));
bits = MSG_ReadByte();
es->modelindex = (bits & FITZB_LARGEMODEL) ? MSG_ReadShort() : MSG_ReadByte();
es->frame = (bits & FITZB_LARGEFRAME) ? MSG_ReadShort() : MSG_ReadByte();
es->modelindex = (bits & FITZ_B_LARGEMODEL) ? MSG_ReadShort() : MSG_ReadByte();
es->frame = (bits & FITZ_B_LARGEFRAME) ? MSG_ReadShort() : MSG_ReadByte();
es->colormap = MSG_ReadByte();
es->skinnum = MSG_ReadByte();
@ -3508,7 +3514,8 @@ void CLFitz_ParseBaseline2 (entity_state_t *es)
es->angles[i] = MSG_ReadAngle ();
}
es->trans = (bits & FITZB_ALPHA) ? MSG_ReadByte() : 255;
es->trans = (bits & FITZ_B_ALPHA) ? MSG_ReadByte() : 255;
es->scale = (bits & RMQFITZ_B_SCALE) ? MSG_ReadByte() : 16;
}
void CLQ2_Precache_f (void)
@ -3552,7 +3559,7 @@ void CL_ParseStatic (int version)
if (cls.fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS)
CLFTE_ParseBaseline(&es, false);
else
CLQW_ParseDelta(&nullentitystate, &es, MSG_ReadShort(), true);
CLQW_ParseDelta(&nullentitystate, &es, (unsigned short)MSG_ReadShort(), true);
if (!es.number)
i = cl.num_statics++;
@ -3582,7 +3589,7 @@ void CL_ParseStatic (int version)
cl_static_entities[i].emit = NULL;
ent = &cl_static_entities[i].ent;
memset(ent, 0, sizeof(*ent));
V_ClearEntity(ent);
memset(&cl_static_entities[i].pvscache, 0, sizeof(cl_static_entities[i].pvscache));
ent->keynum = es.number;
@ -3604,7 +3611,11 @@ void CL_ParseStatic (int version)
ent->fatness = es.fatness/16.0;
ent->abslight = es.abslight;
ent->flags = es.flags;
ent->flags = 0;
if (es.dpflags & RENDER_VIEWMODEL)
ent->flags |= Q2RF_WEAPONMODEL|Q2RF_MINLIGHT|Q2RF_DEPTHHACK;
if (es.dpflags & RENDER_EXTERIORMODEL)
ent->flags |= Q2RF_EXTERNALMODEL;
if (es.effects & NQEF_ADDITIVE)
ent->flags |= Q2RF_ADDITIVE;
if (es.effects & EF_NODEPTHTEST)
@ -3682,7 +3693,7 @@ ACTION MESSAGES
CL_ParseStartSoundPacket
==================
*/
void CL_ParseStartSoundPacket(void)
void CLQW_ParseStartSoundPacket(void)
{
vec3_t pos;
int channel, ent;
@ -3838,7 +3849,7 @@ void CLNQ_ParseStartSoundPacket(void)
if (field_mask & DPSND_LARGEENTITY)
{
ent = (unsigned short)MSG_ReadShort();
ent = MSGCL_ReadEntity();
channel = MSG_ReadByte();
}
else
@ -4269,7 +4280,7 @@ void CL_MuzzleFlash (int destsplit)
extern cvar_t cl_muzzleflash;
i = MSG_ReadShort ();
i = MSGCL_ReadEntity ();
//was it us?
if (!cl_muzzleflash.ival) // remove all muzzleflashes
@ -4606,10 +4617,12 @@ char *CL_ParseChat(char *text, player_info_t **player)
if (flags == 2 || (!cl.teamplay && flags))
suppress_talksound = TP_CheckSoundTrigger (text + offset);
if (!cl_chatsound.value || // no sound at all
if (cls.demoseeking ||
!cl_chatsound.value || // no sound at all
(cl_chatsound.value == 2 && flags != 2)) // only play sound in mm2
suppress_talksound = true;
if (!suppress_talksound)
{
if (flags & (TPM_OBSERVEDTEAM|TPM_TEAM) && cl.teamplay)
@ -5297,7 +5310,8 @@ void CLQW_ParseServerMessage (void)
if ((msg = CL_ParseChat(s, &plr)))
{
CL_ParsePrint(s, i);
CL_PrintChat(plr, s, msg, msgflags);
if (!cls.demoseeking)
CL_PrintChat(plr, s, msg, msgflags);
}
}
else
@ -5307,7 +5321,8 @@ void CLQW_ParseServerMessage (void)
#endif
{
CL_ParsePrint(s, i);
CL_PrintStandardMessage(s, i);
if (!cls.demoseeking)
CL_PrintStandardMessage(s, i);
}
}
break;
@ -5340,7 +5355,7 @@ void CLQW_ParseServerMessage (void)
case svc_setview:
if (!(cls.fteprotocolextensions & PEXT_SETVIEW))
Con_Printf("^1PEXT_SETVIEW is meant to be disabled\n");
cl.viewentity[destsplit]=MSG_ReadShort();
cl.viewentity[destsplit]=MSGCL_ReadEntity();
if (cl.viewentity[destsplit] == cl.playernum[destsplit]+1)
cl.viewentity[destsplit] = 0;
break;
@ -5399,7 +5414,7 @@ void CLQW_ParseServerMessage (void)
#endif
case svc_sound:
CL_ParseStartSoundPacket();
CLQW_ParseStartSoundPacket();
break;
#ifdef PEXT_SOUNDDBL
case svcfte_soundextended:
@ -5449,7 +5464,7 @@ void CLQW_ParseServerMessage (void)
break;
case svc_spawnbaseline:
i = MSG_ReadShort ();
i = MSGCL_ReadEntity ();
if (!CL_CheckBaselines(i))
Host_EndGame("CL_ParseServerMessage: svc_spawnbaseline failed with size %i", i);
CL_ParseBaseline (cl_baselines + i);
@ -5620,12 +5635,12 @@ void CLQW_ParseServerMessage (void)
#endif
case svc_packetentities:
CL_ParsePacketEntities (false);
CLQW_ParsePacketEntities (false);
cl.ackedinputsequence = cl.validsequence;
break;
case svc_deltapacketentities:
CL_ParsePacketEntities (true);
CLQW_ParsePacketEntities (true);
cl.ackedinputsequence = cl.validsequence;
break;
case svcfte_updateentities:
@ -5648,9 +5663,9 @@ void CLQW_ParseServerMessage (void)
CDAudio_Resume ();
break;
case svc_ftesetclientpersist:
CL_ParseClientPersist();
break;
// case svc_ftesetclientpersist:
// CL_ParseClientPersist();
// break;
#ifdef Q2BSPS
case svc_setportalstate:
i = MSG_ReadByte();
@ -6176,7 +6191,7 @@ void CLNQ_ParseServerMessage (void)
case svc_setview:
if (!cl.viewentity[0])
{
cl.playernum[0] = (cl.viewentity[0] = MSG_ReadShort())-1;
cl.playernum[0] = (cl.viewentity[0] = MSGCL_ReadEntity())-1;
if (cl.playernum[0] >= cl.allocated_client_slots)
{
Con_Printf(CON_WARNING "WARNING: Server put us in slot %i. We are not on the scoreboard.\n", cl.playernum[0]);
@ -6184,7 +6199,7 @@ void CLNQ_ParseServerMessage (void)
}
}
else
cl.viewentity[0]=MSG_ReadShort();
cl.viewentity[0]=MSGCL_ReadEntity();
break;
case svc_signonnum:
@ -6212,7 +6227,7 @@ void CLNQ_ParseServerMessage (void)
break;
case svc_spawnbaseline:
i = MSG_ReadShort ();
i = MSGCL_ReadEntity ();
if (!CL_CheckBaselines(i))
Host_EndGame("CLNQ_ParseServerMessage: svc_spawnbaseline failed with size %i", i);
CL_ParseBaseline (cl_baselines + i);
@ -6235,6 +6250,8 @@ void CLNQ_ParseServerMessage (void)
cl.gametime = MSG_ReadFloat();
cl.gametimemark = realtime;
cl.frames[cl.validsequence&UPDATE_MASK].receivedtime = realtime;
if (CPNQ_IS_DP)
{
int n = cls.netchan.incoming_sequence&UPDATE_MASK, o = (cls.netchan.incoming_sequence-1)&UPDATE_MASK;
@ -6406,7 +6423,7 @@ void CLNQ_ParseServerMessage (void)
cl.fog_locked = !!cl.fog_density;
break;
case svcfitz_spawnbaseline2:
i = MSG_ReadShort ();
i = MSGCL_ReadEntity ();
if (!CL_CheckBaselines(i))
Host_EndGame("CLNQ_ParseServerMessage: svcfitz_spawnbaseline2 failed with ent %i", i);
CLFitz_ParseBaseline2 (cl_baselines + i);

View file

@ -162,8 +162,11 @@ extern cvar_t scr_chatmodecvar;
int mouseusedforgui;
int mousecursor_x, mousecursor_y;
int mousemove_x, mousemove_y;
float mousecursor_x, mousecursor_y;
float mousemove_x, mousemove_y;
float multicursor_x[8], multicursor_y[8];
qboolean multicursor_active[8];
float scr_con_current;
float scr_conlines; // lines of console to display
@ -415,7 +418,7 @@ void SCR_EraseCenterString (void)
}
#define MAX_CPRINT_LINES 128
void SCR_DrawCenterString (vrect_t *rect, cprint_t *p)
void SCR_DrawCenterString (vrect_t *rect, cprint_t *p, struct font_s *font)
{
int l;
int y, x;
@ -483,8 +486,8 @@ void SCR_DrawCenterString (vrect_t *rect, cprint_t *p)
}
}
Font_BeginString(font_conchar, rect->x, y, &left, &top);
Font_BeginString(font_conchar, rect->x+rect->width, rect->y+rect->height, &right, &bottom);
Font_BeginString(font, rect->x, y, &left, &top);
Font_BeginString(font, rect->x+rect->width, rect->y+rect->height, &right, &bottom);
linecount = Font_LineBreaks(p->string, p->string + p->charcount, right - left, MAX_CPRINT_LINES, line_start, line_end);
if (p->flags & CPRINT_TALIGN)
@ -542,7 +545,7 @@ void SCR_DrawCenterString (vrect_t *rect, cprint_t *p)
}
Font_LineDraw(x, y, line_start[l], line_end[l]);
}
Font_EndString(font_conchar);
Font_EndString(font);
}
void SCR_CheckDrawCenterString (void)
@ -568,7 +571,7 @@ extern qboolean sb_showscores;
continue;
SCR_VRectForPlayer(&rect, pnum);
SCR_DrawCenterString(&rect, p);
SCR_DrawCenterString(&rect, p, font_conchar);
}
}
@ -587,13 +590,12 @@ void R_DrawTextField(int x, int y, int w, int h, char *text, unsigned int defaul
p.time_off = scr_centertime.value;
p.time_start = cl.time;
SCR_DrawCenterString(&r, &p);
SCR_DrawCenterString(&r, &p, font_conchar);
}
void SCR_DrawCursor(int prydoncursornum)
{
extern cvar_t cl_cursor, cl_cursorbias, cl_cursorsize;
extern int mousecursor_x, mousecursor_y;
mpic_t *p;
if (!*cl_cursor.string || prydoncursornum>1)
p = R2D_SafeCachePic(va("gfx/prydoncursor%03i.lmp", prydoncursornum));
@ -608,14 +610,29 @@ void SCR_DrawCursor(int prydoncursornum)
}
else
{
int x, y;
Font_BeginString(font_conchar, mousecursor_x, mousecursor_y, &x, &y);
float x, y;
Font_BeginScaledString(font_conchar, mousecursor_x, mousecursor_y, 8, 8, &x, &y);
x -= Font_CharWidth('+' | 0xe000 | CON_WHITEMASK)/2;
y -= Font_CharHeight()/2;
Font_DrawChar(x, y, '+' | 0xe000 | CON_WHITEMASK);
Font_DrawScaleChar(x, y, '+' | 0xe000 | CON_WHITEMASK);
Font_EndString(font_conchar);
}
}
static void SCR_DrawSimMTouchCursor(void)
{
int i;
float x, y;
for (i = 0; i < 8; i++)
{
if (multicursor_active[i])
{
Font_BeginScaledString(font_conchar, multicursor_x[i], multicursor_y[i], 8, 8, &x, &y);
x -= Font_CharWidth('+' | 0xe000 | CON_WHITEMASK)/2;
y -= Font_CharHeight()/2;
Font_DrawScaleChar(x, y, '+' | 0xe000 | CON_WHITEMASK);
Font_EndString(font_conchar);
}
}
}
////////////////////////////////////////////////////////////////
@ -2367,5 +2384,9 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
if (key_dest == key_console)
SCR_DrawConsole (false);
if (Key_MouseShouldBeFree())
SCR_DrawCursor(0);
SCR_DrawSimMTouchCursor();
RSpeedEnd(RSPEED_2D);
}

View file

@ -773,7 +773,7 @@ void CL_ParseBeam (int tent)
int ent;
vec3_t start, end;
ent = MSG_ReadShort ();
ent = MSGCL_ReadEntity ();
start[0] = MSG_ReadCoord ();
start[1] = MSG_ReadCoord ();
@ -795,7 +795,7 @@ void CL_ParseStream (int type)
float duration;
int skin;
ent = MSG_ReadShort();
ent = MSGCL_ReadEntity();
flags = MSG_ReadByte();
tag = flags&15;
flags-=tag;
@ -1336,6 +1336,10 @@ void CL_ParseTEnt (void)
break;
case TEQW_BEAM:
CL_ParseBeam (5);
break;
case TE_RAILTRAIL:
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
@ -1914,7 +1918,7 @@ void CL_ParseTrailParticles(void)
vec3_t start, end;
trailstate_t **ts;
entityindex = (unsigned short)MSG_ReadShort();
entityindex = MSGCL_ReadEntity();
effectindex = (unsigned short)MSG_ReadShort();
start[0] = MSG_ReadCoord();
@ -2972,13 +2976,17 @@ entity_t *CL_NewTempEntity (void)
{
entity_t *ent;
if (cl_numvisedicts == MAX_VISEDICTS)
if (cl_numvisedicts == cl_maxvisedicts)
return NULL;
ent = &cl_visedicts[cl_numvisedicts];
cl_numvisedicts++;
ent->keynum = 0;
memset (ent, 0, sizeof(*ent));
ent->playerindex = -1;
ent->topcolour = TOP_DEFAULT;
ent->bottomcolour = BOTTOM_DEFAULT;
ent->h2playerclass = 0;
#ifdef PEXT_SCALE
ent->scale = 1;

View file

@ -420,7 +420,7 @@ void VQ3_AddPoly(shader_t *s, int num, q3polyvert_t *verts)
unsigned int v;
scenetris_t *t;
/*reuse the previous trigroup if its the same shader*/
if (cl_numstris && cl_stris[cl_numstris-1].shader == s)
if (cl_numstris && cl_stris[cl_numstris-1].shader == s && cl_stris[cl_numstris-1].flags == (BEF_NODLIGHT|BEF_NOSHADOWS))
t = &cl_stris[cl_numstris-1];
else
{
@ -431,6 +431,7 @@ void VQ3_AddPoly(shader_t *s, int num, q3polyvert_t *verts)
}
t = &cl_stris[cl_numstris++];
t->shader = s;
t->flags = BEF_NODLIGHT|BEF_NOSHADOWS;
t->numidx = 0;
t->numvert = 0;
t->firstidx = cl_numstrisidx;
@ -856,10 +857,7 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
break;
case UI_R_CLEARSCENE: //clear scene
cl_numvisedicts = 0;
cl_numstrisidx = 0;
cl_numstrisvert = 0;
cl_numstris = 0;
CL_ClearEntityLists();
break;
case UI_R_ADDREFENTITYTOSCENE: //add ent to scene
VQ3_AddEntity(VM_POINTER(arg[0]));

View file

@ -175,7 +175,7 @@ typedef struct player_info_s
struct model_s *model;
unsigned short vweapindex;
// unsigned short vweapindex;
unsigned char h2playerclass;
int prevcount;
@ -403,6 +403,8 @@ typedef struct
DPB_QUAKE2
#endif
} demoplayback;
qboolean demoseeking;
float demoseektime;
qboolean timedemo;
vfsfile_t *demoinfile;
float td_lastframe; // to meter out one message a frame
@ -483,7 +485,8 @@ typedef struct {
vec3_t oldangle;
//for further info
int sequence;
int skeletalobject;
int sequence; /*so csqc code knows that the ent is still valid*/
entity_state_t *entstate;
} lerpents_t;
//
@ -829,9 +832,9 @@ char *CL_TryingToConnect(void);
void CL_ExecInitialConfigs(void);
qboolean CL_CheckBootDownloads(void);
#define MAX_VISEDICTS 2048
extern int cl_numvisedicts;
extern entity_t cl_visedicts[];
extern int cl_maxvisedicts;
extern entity_t *cl_visedicts;
/*these are for q3 really*/
typedef struct {
@ -840,6 +843,7 @@ typedef struct {
int firstidx;
int numvert;
int numidx;
unsigned int flags;
} scenetris_t;
extern scenetris_t *cl_stris;
extern vecV_t *cl_strisvertv;
@ -1042,14 +1046,15 @@ void CL_TransitionEntities (void); /*call at the start of the frame*/
void CL_EmitEntities (void);
void CL_ClearProjectiles (void);
void CL_ParseProjectiles (int modelindex, qboolean nails2);
void CL_ParsePacketEntities (qboolean delta);
void CLQW_ParsePacketEntities (qboolean delta);
void CLFTE_ParseEntities (void);
void CLFTE_ParseBaseline(entity_state_t *es, qboolean numberisimportant);
void CL_SetSolidEntities (void);
void CL_ParsePlayerinfo (void);
void CL_ParseClientPersist(void);
//these last ones are needed for csqc handling of engine-bound ents.
void CL_SwapEntityLists(void);
void CL_ClearEntityLists(void);
void CL_FreeVisEdicts(void);
void CL_LinkViewModel(void);
void CL_LinkPlayers (void);
void CL_LinkPacketEntities (void);
@ -1283,8 +1288,8 @@ extern qboolean editoractive;
extern qboolean editormodal;
void Editor_Draw(void);
void Editor_Init(void);
struct progfuncs_s;
void Editor_ProgsKilled(struct progfuncs_s *dead);
struct pubprogfuncs_s;
void Editor_ProgsKilled(struct pubprogfuncs_s *dead);
#endif
void SCR_StringToRGB (char *rgbstring, float *rgb, float rgbinputscale);

View file

@ -1211,7 +1211,10 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
ent.glowmod[1] = 1;
ent.glowmod[2] = 1;
ent.fatness = 0;
ent.scoreboard = NULL;
ent.topcolour = 1;
ent.bottomcolour = 1;
ent.h2playerclass = 0;
ent.playerindex = -1;
// set frame
if (effects & Q2EF_ANIM01)
@ -1305,7 +1308,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
if (!ent.model || ent.model->needload)
ent.model = Mod_ForName("players/male/tris.md2", false);
}
ent.scoreboard = player;
ent.playerindex = s1->skinnum%MAX_CLIENTS;
player->model = ent.model;
/* ci = &cl.clientinfo[s1->skinnum & 0xff];
// ent.skin = ci->skin;
@ -1920,10 +1923,6 @@ void CLQ2_AddEntities (void)
r_refdef.currentplayernum = 0;
cl_numvisedicts = 0;
cl_numstrisidx = 0;
cl_numstrisvert = 0;
cl_numstris = 0;
if (cl.time*1000 > cl.q2frame.servertime)
{
@ -1954,7 +1953,7 @@ void CL_GetNumberedEntityInfo (int num, float *org, float *ang)
{
q2centity_t *ent;
if (num < 0 || num >= MAX_EDICTS)
if (num < 0 || num >= MAX_Q2EDICTS)
Host_EndGame ("CL_GetNumberedEntityInfo: bad ent");
ent = &cl_entities[num];

View file

@ -988,11 +988,11 @@ void CLQ3_SendAuthPacket(netadr_t gameserver)
{
char *key = Cvar_Get("cl_cdkey", "", 0, "Quake3 auth")->string;
netadr_t authaddr;
#define AUTHORIZE_SERVER_NAME "authorize.quake3arena.com:27952"
#define Q3_AUTHORIZE_SERVER_NAME "authorize.quake3arena.com:27952"
if (*key)
{
Con_Printf("Resolving %s\n", AUTHORIZE_SERVER_NAME);
if (NET_StringToAdr(AUTHORIZE_SERVER_NAME, &authaddr))
Con_Printf("Resolving %s\n", Q3_AUTHORIZE_SERVER_NAME);
if (NET_StringToAdr(Q3_AUTHORIZE_SERVER_NAME, &authaddr))
{
msg.data = data;
msg.cursize = 0;

View file

@ -1220,12 +1220,30 @@ void Con_PrintToSys(void)
conline_t *l;
int i;
conchar_t *t;
char buf[16];
extern cvar_t com_parseutf8;
for (l = curcon->oldest; l; l = l->newer)
{
t = (conchar_t*)(l+1);
//fixme: utf8?
for (i = 0; i < l->length; i++)
Sys_Printf("%c", t[i]&0xff);
{
if (!(t[i] & CON_HIDDEN))
{
if (com_parseutf8.ival>0)
{
int cl = utf8_encode(buf, t[i]&CON_CHARMASK, sizeof(buf)-1);
if (cl)
{
buf[cl] = 0;
Sys_Printf("%s", buf);
}
}
else
Sys_Printf("%c", t[i]&0xff);
}
}
Sys_Printf("\n");
}
}

View file

@ -3,23 +3,20 @@
#include "quakedef.h"
extern qboolean mouse_active;
static cvar_t m_filter = CVARF("m_filter", "0", CVAR_ARCHIVE);
static cvar_t m_accel = CVARF("m_accel", "0", CVAR_ARCHIVE);
extern qboolean mouse_active;
static cvar_t m_filter = CVARF("m_filter", "0", CVAR_ARCHIVE);
static cvar_t m_accel = CVARF("m_accel", "0", CVAR_ARCHIVE);
static cvar_t m_forcewheel = CVARD("m_forcewheel", "1", "0: ignore mousewheels in apis where it is abiguous.\n1: Use mousewheel when it is treated as a third axis. Motion above a threshold is ignored, to avoid issues with an unknown threshold.\n2: Like 1, but excess motion is retained. The threshold specifies exact z-axis distance per notice.");
static cvar_t m_forcewheel_threshold = CVARD("m_forcewheel_threshold", "32", "Mousewheel graduations smaller than this will not trigger mousewheel deltas.");
static cvar_t m_strafeonright = CVARFD("m_strafeonright", "1", CVAR_ARCHIVE, "If 1, touching the right half of the touchscreen will strafe/move, while the left side will turn.");
static cvar_t m_fatpressthreshold = CVARFD("m_fatpressthreshold", "0.5", CVAR_ARCHIVE, "How fat your thumb has to be to register a fat press (touchscreens).");
static cvar_t m_slidethreshold = CVARFD("m_slidethreshold", "5", CVAR_ARCHIVE, "How far your finger needs to move to be considered a slide event (touchscreens).");
extern cvar_t cl_forcesplitclient; //all devices claim to be a single player
extern cvar_t _windowed_mouse;
int mousecursor_x, mousecursor_y; /*absolute position*/
extern int mousemove_x, mousemove_y;
static cvar_t m_forcewheel_threshold = CVARD("m_forcewheel_threshold", "32", "Mousewheel graduations smaller than this will not trigger mousewheel deltas.");
static cvar_t m_strafeonright = CVARFD("m_strafeonright", "1", CVAR_ARCHIVE, "If 1, touching the right half of the touchscreen will strafe/move, while the left side will turn.");
static cvar_t m_fatpressthreshold = CVARFD("m_fatpressthreshold", "0.5", CVAR_ARCHIVE, "How fat your thumb has to be to register a fat press (touchscreens).");
static cvar_t m_slidethreshold = CVARFD("m_slidethreshold", "5", CVAR_ARCHIVE, "How far your finger needs to move to be considered a slide event (touchscreens).");
extern cvar_t cl_forcesplitclient; //all devices claim to be a single player
extern cvar_t _windowed_mouse;
#define EVENTQUEUELENGTH 128
struct eventlist_s
{
@ -77,48 +74,48 @@ struct mouse_s
vec2_t old_delta; //how far its moved previously, for mouse smoothing
float wheeldelta;
int down;
} ptr[MAXPOINTERS];
void IN_Shutdown(void)
{
INS_Shutdown();
}
void IN_ReInit(void)
{
int i;
} ptr[MAXPOINTERS];
void IN_Shutdown(void)
{
INS_Shutdown();
}
void IN_ReInit(void)
{
int i;
events_avail = 0;
events_used = 0;
for (i = 0; i < MAXPOINTERS; i++)
{
ptr[i].type = M_INVALID;
ptr[i].qdeviceid = i;
}
INS_ReInit();
}
void IN_Init(void)
{
Cvar_Register (&m_filter, "input controls");
Cvar_Register (&m_accel, "input controls");
events_used = 0;
for (i = 0; i < MAXPOINTERS; i++)
{
ptr[i].type = M_INVALID;
ptr[i].qdeviceid = i;
}
INS_ReInit();
}
void IN_Init(void)
{
Cvar_Register (&m_filter, "input controls");
Cvar_Register (&m_accel, "input controls");
Cvar_Register (&m_forcewheel, "Input Controls");
Cvar_Register (&m_forcewheel_threshold, "Input Controls");
Cvar_Register (&m_strafeonright, "input controls");
Cvar_Register (&m_fatpressthreshold, "input controls");
Cvar_Register (&m_slidethreshold, "input controls");
INS_Init();
}
/*a 'pointer' is either a multitouch pointer, or a separate device
note that mice use the keyboard button api, but separate devices*/
void IN_Commands(void)
{
Cvar_Register (&m_forcewheel_threshold, "Input Controls");
Cvar_Register (&m_strafeonright, "input controls");
Cvar_Register (&m_fatpressthreshold, "input controls");
Cvar_Register (&m_slidethreshold, "input controls");
INS_Init();
}
/*a 'pointer' is either a multitouch pointer, or a separate device
note that mice use the keyboard button api, but separate devices*/
void IN_Commands(void)
{
struct eventlist_s *ev;
INS_Commands();
@ -252,14 +249,11 @@ void IN_Commands(void)
break;
}
events_used++;
}
}
void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum)
}
}
void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum)
{
extern int mousecursor_x, mousecursor_y;
extern int mousemove_x, mousemove_y;
int mx, my;
double mouse_x, mouse_y, mouse_deltadist;
int mfwt;
@ -318,20 +312,23 @@ void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum)
if (Key_MouseShouldBeFree())
{
mousecursor_x += mx;
mousecursor_y += my;
if (mx || my)
{
mousecursor_x += mx;
mousecursor_y += my;
if (mousecursor_y<0)
mousecursor_y=0;
if (mousecursor_x<0)
mousecursor_x=0;
if (mousecursor_y<0)
mousecursor_y=0;
if (mousecursor_x<0)
mousecursor_x=0;
if (mousecursor_x >= vid.width)
mousecursor_x = vid.width - 1;
if (mousecursor_x >= vid.width)
mousecursor_x = vid.width - 1;
if (mousecursor_y >= vid.height)
mousecursor_y = vid.height - 1;
mx=my=0;
if (mousecursor_y >= vid.height)
mousecursor_y = vid.height - 1;
mx=my=0;
}
#ifdef PEXT_CSQC
CSQC_MousePosition(mousecursor_x, mousecursor_y, mouse->qdeviceid);
@ -350,25 +347,25 @@ void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum)
if (mouse->type == M_TOUCH)
{
if (m_strafeonright.ival && mouse->downpos[0] > vid.pixelwidth/2 && movements != NULL && (key_dest == key_game))
{
//if they're strafing, calculate the speed to move at based upon their displacement
if (mouse->down)
{
mx = (mouse->oldpos[0] - mouse->downpos[0])*0.1;
my = (mouse->oldpos[1] - mouse->downpos[1])*0.1;
}
else
{
mx = 0;
my = 0;
}
strafe_x = true;
strafe_y = true;
}
else
{
strafe_x = false;
if (m_strafeonright.ival && mouse->downpos[0] > vid.pixelwidth/2 && movements != NULL && (key_dest == key_game))
{
//if they're strafing, calculate the speed to move at based upon their displacement
if (mouse->down)
{
mx = (mouse->oldpos[0] - mouse->downpos[0])*0.1;
my = (mouse->oldpos[1] - mouse->downpos[1])*0.1;
}
else
{
mx = 0;
my = 0;
}
strafe_x = true;
strafe_y = true;
}
else
{
strafe_x = false;
strafe_y = false;
}
}
@ -449,15 +446,15 @@ void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum)
else
movements[0] -= m_forward.value * mouse_y;
}
}
void IN_Move (float *movements, int pnum)
{
int i;
INS_Move(movements, pnum);
for (i = 0; i < MAXPOINTERS; i++)
IN_MoveMouse(&ptr[i], movements, pnum);
}
}
void IN_Move (float *movements, int pnum)
{
int i;
INS_Move(movements, pnum);
for (i = 0; i < MAXPOINTERS; i++)
IN_MoveMouse(&ptr[i], movements, pnum);
}
void IN_KeyEvent(int devid, int down, int keycode, int unicode)
{

View file

@ -56,6 +56,7 @@ static cvar_t m_filter = CVAR("m_filter","0");
static cvar_t m_accel = CVAR("m_accel", "0");
static cvar_t in_dinput = CVARF("in_dinput","0", CVAR_ARCHIVE);
static cvar_t in_builtinkeymap = CVARF("in_builtinkeymap", "0", CVAR_ARCHIVE);
static cvar_t in_simulatemultitouch = CVAR("in_simulatemultitouch", "0");
static cvar_t m_accel_noforce = CVAR("m_accel_noforce", "0");
static cvar_t m_threshold_noforce = CVAR("m_threshold_noforce", "0");
@ -63,6 +64,9 @@ static cvar_t m_threshold_noforce = CVAR("m_threshold_noforce", "0");
static cvar_t cl_keypad = CVAR("cl_keypad", "0");
extern cvar_t cl_forcesplitclient;
extern float multicursor_x[8], multicursor_y[8];
extern qboolean multicursor_active[8];
typedef struct {
union {
HANDLE rawinputhandle;
@ -509,7 +513,7 @@ void INS_UpdateGrabs(int fullscreen, int activeapp)
if (!activeapp)
grabmouse = false;
else if (fullscreen)
else if (fullscreen || in_simulatemultitouch.ival)
grabmouse = true;
else if (_windowed_mouse.value)
{
@ -781,6 +785,7 @@ void INS_RawInput_DeInit(void)
Z_Free(rawkbd);
rawkbdcount = 0;
}
memset(multicursor_active, 0, sizeof(multicursor_active));
}
#endif
@ -1089,6 +1094,7 @@ void INS_Init (void)
Cvar_Register (&in_dinput, "Input Controls");
Cvar_Register (&in_builtinkeymap, "Input Controls");
Cvar_Register (&in_simulatemultitouch, "Input Controls");
Cvar_Register (&m_accel_noforce, "Input Controls");
Cvar_Register (&m_threshold_noforce, "Input Controls");
@ -1214,7 +1220,6 @@ INS_MouseMove
*/
void INS_MouseMove (float *movements, int pnum)
{
extern int mousecursor_x, mousecursor_y;
extern int window_x, window_y;
#ifdef AVAIL_DINPUT
@ -1327,7 +1332,7 @@ potentially called multiple times per frame.
*/
void INS_Accumulate (void)
{
POINT current_pos;
static POINT current_pos; //static to avoid bugs in vista with largeaddressaware (this is fixed in win7). fixed exe base address prevents this from going above 2gb.
if (mouseactive && !dinput)
{
@ -1372,14 +1377,32 @@ void INS_RawInput_MouseRead(void)
return;
mouse = &rawmice[i];
multicursor_active[mouse->qdeviceid&7] = 0;
// movement
if (raw->data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE)
{
if (in_simulatemultitouch.ival)
{
multicursor_active[mouse->qdeviceid&7] = true;
multicursor_x[mouse->qdeviceid&7] = raw->data.mouse.lLastX;
multicursor_y[mouse->qdeviceid&7] = raw->data.mouse.lLastY;
}
IN_MouseMove(mouse->qdeviceid, true, raw->data.mouse.lLastX, raw->data.mouse.lLastY, 0, 0);
}
else // RELATIVE
{
IN_MouseMove(mouse->qdeviceid, false, raw->data.mouse.lLastX, raw->data.mouse.lLastY, 0, 0);
if (in_simulatemultitouch.ival)
{
multicursor_active[mouse->qdeviceid&7] = true;
multicursor_x[mouse->qdeviceid&7] += raw->data.mouse.lLastX;
multicursor_y[mouse->qdeviceid&7] += raw->data.mouse.lLastY;
multicursor_x[mouse->qdeviceid&7] = bound(0, multicursor_x[mouse->qdeviceid&7], vid.pixelwidth);
multicursor_y[mouse->qdeviceid&7] = bound(0, multicursor_y[mouse->qdeviceid&7], vid.pixelheight);
IN_MouseMove(mouse->qdeviceid, true, multicursor_x[mouse->qdeviceid&7], multicursor_y[mouse->qdeviceid&7], 0, 0);
}
else
IN_MouseMove(mouse->qdeviceid, false, raw->data.mouse.lLastX, raw->data.mouse.lLastY, 0, 0);
}
// buttons

View file

@ -33,6 +33,9 @@ void IN_Move (float *movements, int pnum);
extern cvar_t in_xflip;
extern float mousecursor_x, mousecursor_y;
extern float mousemove_x, mousemove_y;
#ifdef _SDL
void IN_ActivateMouse(void);
void IN_DeactivateMouse(void);

View file

@ -411,8 +411,6 @@ void Con_Selectioncolour_Callback(struct cvar_s *var, char *oldvalue)
qboolean Key_GetConsoleSelectionBox(int *sx, int *sy, int *ex, int *ey)
{
extern int mousecursor_x, mousecursor_y;
*sx = *sy = *ex = *ey = 0;
if (con_mousedown[2] == 1)
@ -641,6 +639,12 @@ void Key_DefaultLinkClicked(char *text, char *info)
Cbuf_AddText(va("\ncmd %s\n", c), RESTRICT_LOCAL);
return;
}
c = Info_ValueForKey(info, "edit");
if (*c && !strchr(c, ';') && !strchr(c, '\n'))
{
Cbuf_AddText(va("\nedit %s\n", c), RESTRICT_LOCAL);
return;
}
c = Info_ValueForKey(info, "impulse");
if (*c && !strchr(c, ';') && !strchr(c, '\n'))
{
@ -657,7 +661,6 @@ void Key_DefaultLinkClicked(char *text, char *info)
void Key_ConsoleRelease(int key, int unicode)
{
extern int mousecursor_x, mousecursor_y;
char *buffer;
if (key == K_MOUSE1)
{
@ -860,7 +863,6 @@ void Key_Console (unsigned int unicode, int key)
if ((key == K_MOUSE1 || key == K_MOUSE2))
{
extern cvar_t vid_conwidth, vid_conheight;
extern int mousecursor_x, mousecursor_y;
int xpos, ypos;
xpos = (int)((mousecursor_x*vid.width)/(vid.pixelwidth*8));
ypos = (int)((mousecursor_y*vid.height)/(vid.pixelheight*8));

View file

@ -336,13 +336,12 @@ static qboolean MI_Selectable(menuoption_t *op)
static void M_CheckMouseMove(void)
{
extern int mousecursor_x, mousecursor_y;
qboolean foundexclusive = false;
int mgt;
menu_t *menu;
menuoption_t *option;
if (omousex != mousecursor_x || omousey != mousecursor_y)
if (omousex != (int)mousecursor_x || omousey != (int)mousecursor_y)
mousemoved = true;
else
mousemoved = false;
@ -1514,31 +1513,6 @@ void M_MenuPop_f (void)
M_RemoveMenu(firstmenu);
}
void DrawCursor(int prydoncursornum)
{
extern int mousecursor_x, mousecursor_y;
mpic_t *p;
if (!*cl_cursor.string)
p = NULL;
else
p = R2D_SafeCachePic(cl_cursor.string);
if (p)
{
R2D_ImageColours(1, 1, 1, 1);
R2D_Image(mousecursor_x-cl_cursorbias.value, mousecursor_y-cl_cursorbias.value, cl_cursorsize.value, cl_cursorsize.value, 0, 0, 1, 1, p);
}
else
{
int x, y;
Font_BeginString(font_conchar, mousecursor_x, mousecursor_y, &x, &y);
x -= Font_CharWidth('+' | 0xe000 | CON_WHITEMASK)/2;
y -= Font_CharHeight()/2;
Font_DrawChar(x, y, '+' | 0xe000 | CON_WHITEMASK);
Font_EndString(font_conchar);
}
}
void M_Complex_Draw(void)
{
menu_t *menu, *cmenu;

View file

@ -92,7 +92,6 @@ static void SL_DrawColumnTitle (int *x, int y, int xlen, int mx, char *str, qboo
static void SL_TitlesDraw (int x, int y, menucustom_t *ths, menu_t *menu)
{
int sf = Master_GetSortField();
extern int mousecursor_x, mousecursor_y;
int mx = mousecursor_x;
qboolean filldraw = false;
qbyte clr;
@ -117,7 +116,6 @@ static void SL_TitlesDraw (int x, int y, menucustom_t *ths, menu_t *menu)
static qboolean SL_TitlesKey (menucustom_t *ths, menu_t *menu, int key)
{
int x;
extern int mousecursor_x, mousecursor_y;
int mx = mousecursor_x/8;
int sortkey;
@ -215,7 +213,6 @@ static servertypes_t flagstoservertype(int flags)
static void SL_ServerDraw (int x, int y, menucustom_t *ths, menu_t *menu)
{
extern int mousecursor_x, mousecursor_y;
serverlist_t *info = (serverlist_t*)(menu + 1);
serverinfo_t *si;
int thisone = (int)ths->data + info->scrollpos;
@ -264,7 +261,6 @@ static qboolean SL_ServerKey (menucustom_t *ths, menu_t *menu, int key)
static int lastclick;
int curtime;
int oldselection;
extern int mousecursor_x, mousecursor_y;
serverlist_t *info = (serverlist_t*)(menu + 1);
serverinfo_t *server;
char adr[MAX_ADR_SIZE];
@ -465,7 +461,6 @@ static void SL_SliderDraw (int x, int y, menucustom_t *ths, menu_t *menu)
extern qboolean keydown[K_MAX];
if (keydown[K_MOUSE1])
{
extern int mousecursor_x, mousecursor_y;
float my;
serverlist_t *info = (serverlist_t*)(menu + 1);
@ -495,7 +490,6 @@ static qboolean SL_SliderKey (menucustom_t *ths, menu_t *menu, int key)
{
if (key == K_MOUSE1)
{
extern int mousecursor_x, mousecursor_y;
float my;
serverlist_t *info = (serverlist_t*)(menu + 1);
@ -658,10 +652,16 @@ void M_Menu_ServerList2_f(void)
MC_AddCheckBox(menu, 0, vid.height - 64+8*6, "Fraglimit", &sb_showfraglimit, 1);
MC_AddCheckBox(menu, 0, vid.height - 64+8*7, "Timelimit", &sb_showtimelimit, 1);
#ifdef NQPROT
MC_AddCheckBoxFunc(menu, 128, vid.height - 64+8*1, "List NQ ", SL_ReFilter, 1);
#endif
MC_AddCheckBoxFunc(menu, 128, vid.height - 64+8*2, "List QW ", SL_ReFilter, 2);
#ifdef Q2CLIENT
MC_AddCheckBoxFunc(menu, 128, vid.height - 64+8*3, "List Q2 ", SL_ReFilter, 3);
#endif
#ifdef Q3CLIENT
MC_AddCheckBoxFunc(menu, 128, vid.height - 64+8*4, "List Q3 ", SL_ReFilter, 4);
#endif
MC_AddCheckBoxFunc(menu, 128, vid.height - 64+8*5, "Only Favs ", SL_ReFilter, 5);
MC_AddCheckBoxFunc(menu, 128, vid.height - 64+8*6, "Hide Empty", SL_ReFilter, 6);
MC_AddCheckBoxFunc(menu, 128, vid.height - 64+8*7, "Hide Full ", SL_ReFilter, 7);

View file

@ -2241,10 +2241,7 @@ qboolean Media_ShowFilm(void)
else
{
if (cin->cursormove)
{
extern int mousecursor_x, mousecursor_y;
cin->cursormove(cin, mousecursor_x/(float)vid.width, mousecursor_y/(float)vid.height);
}
if (cin->setsize)
cin->setsize(cin, vid.pixelwidth, vid.pixelheight);
@ -3794,7 +3791,7 @@ void Media_Init(void)
Cvar_Register(&capturesoundbits, "AVI capture controls");
Cvar_Register(&capturesoundchannels, "AVI capture controls");
// S_RegisterSoundInputPlugin(S_LoadMP3Sound);
S_RegisterSoundInputPlugin(S_LoadMP3Sound);
#endif
#endif

View file

@ -87,6 +87,7 @@ void M_Menu_Options_f (void)
MB_SPACING(4),
// removed hud options (cl_sbar, cl_hudswap, old-style chat, old-style msg)
MB_CONSOLECMD("Video Options", "menu_video\n", "Set video resolution, color depth, refresh rate, and anti-aliasing options."),
MB_CONSOLECMD("Graphics Presets", "fps_preset\n", "Choose a different graphical preset to use."),
MB_CONSOLECMD("Audio Options", "menu_audio\n", "Set audio quality and speaker setup options."),
MB_SPACING(4),
MB_CONSOLECMD("FPS Options", "menu_fps\n", "Set model filtering and graphical profile options."),

View file

@ -215,11 +215,11 @@ void M_MenuS_TextBig_f (void)
Con_Printf("%s with no active menu\n", Cmd_Argv(0));
return;
}
if (*command)
if (!*command)
MC_AddConsoleCommandQBigFont(menu_script, x, y, text, command);
else
{
option = (menuoption_t *)MC_AddConsoleCommand(menu_script, x, y, text, va("set option %s\n%s\n", command, menualias.string));
option = (menuoption_t *)MC_AddConsoleCommandQBigFont(menu_script, x, y, text, va("set option %s\n%s\n", command, menualias.string));
if (selectitem-- == 0)
menu_script->selecteditem = option;
}

View file

@ -1076,7 +1076,11 @@ void M_Draw (int uimenu)
if ((!menu_script || scr_con_current) && !m_recursiveDraw)
{
R2D_FadeScreen ();
extern menu_t *firstmenu;
if (m_state == m_complex && firstmenu && firstmenu->selecteditem && firstmenu->selecteditem->common.type == mt_slider && (firstmenu->selecteditem->slider.var == &v_gamma || firstmenu->selecteditem->slider.var == &v_contrast))
/*no menu tint if we're trying to adjust gamma*/;
else
R2D_FadeScreen ();
}
else
{

View file

@ -1,5 +1,5 @@
//These are defined later in the source tree. This file should probably be moved to a later spot.
struct progfuncs_s;
struct pubprogfuncs_s;
struct globalvars_s;
struct texture_s;
struct texnums_s;
@ -30,7 +30,7 @@ typedef struct {
#endif
int endbone;
} g[2];
} g[FS_COUNT];
float *bonestate;
int bonecount;

View file

@ -1550,7 +1550,6 @@ void MasterInfo_Refresh(void)
//Master_AddMaster("telefrag.me:27000",MT_MASTERQW, "Telefrag.ME");
//Master_AddMaster("master.teamdamage.com:27000", MT_MASTERQW, "TeamDamage");
Master_AddMaster("master.quakeservers.net:27000", MT_MASTERQW, "QuakeServers.net");
Master_AddMaster("qwmaster.fodquake.net:27000", MT_MASTERQW, "Fodquake.net");
Master_AddMaster("masterserver.exhale.de:27000", MT_MASTERQW, "team exhale");
Master_AddMaster("qwmaster.fodquake.net:27000", MT_MASTERQW, "Fodquake master server.");
Master_AddMaster("qwmaster.ocrana.de:27000", MT_MASTERQW, "Ocrana2 master server.");

View file

@ -380,7 +380,7 @@ static void PClassic_DrawParticles(void)
dvel = 4 * frametime;
#ifdef POLYS
if (cl_numstris && cl_stris[cl_numstris-1].shader == classicshader)
if (cl_numstris && cl_stris[cl_numstris-1].shader == classicshader && cl_stris[cl_numstris-1].numvert + 8 <= MAX_INDICIES)
scenetri = &cl_stris[cl_numstris-1];
else
{
@ -391,6 +391,7 @@ static void PClassic_DrawParticles(void)
}
scenetri = &cl_stris[cl_numstris++];
scenetri->shader = classicshader;
scenetri->flags = BEF_NODLIGHT|BEF_NOSHADOWS;
scenetri->firstidx = cl_numstrisidx;
scenetri->firstvert = cl_numstrisvert;
scenetri->numvert = 0;

View file

@ -67,6 +67,7 @@ static int pe_default = P_INVALID;
static int pe_size2 = P_INVALID;
static int pe_size3 = P_INVALID;
static int pe_defaulttrail = P_INVALID;
static qboolean pe_script_enabled;
static float psintable[256];
@ -481,7 +482,7 @@ static int PScript_FindParticleType(char *name)
static void P_SetModified(void) //called when the particle system changes (from console).
{
if (Cmd_FromGamecode())
if (Cmd_IsInsecure())
return; //server stuffed particle descriptions don't count.
f_modified_particles = true;
@ -698,6 +699,28 @@ static void P_ParticleEffect_f(void)
return;
}
if (!pe_script_enabled)
{
int depth = 1;
while(1)
{
buf = Cbuf_GetNext(Cmd_ExecLevel, false);
if (!*buf)
return;
while (*buf && *buf <= ' ')
buf++; //no whitespace please.
if (*buf == '{')
depth++;
else if (*buf == '}')
{
if (--depth == 0)
break;
}
}
return;
}
var = Cmd_Argv(1);
if (*var == '+')
{
@ -2124,6 +2147,7 @@ static qboolean PScript_InitParticles (void)
Cmd_AddCommand("pointfile", P_ReadPointFile_f); //load the leak info produced from qbsp into the particle system to show a line. :)
Cmd_AddCommand("r_part", P_ParticleEffect_f);
pe_script_enabled = true;
Cmd_AddCommand("r_exportbuiltinparticles", P_ExportBuiltinSet_f);
Cmd_AddCommand("r_importeffectinfo", P_ImportEffectInfo_f);
@ -2174,6 +2198,8 @@ static qboolean PScript_InitParticles (void)
static void PScript_Shutdown (void)
{
pe_script_enabled = false;
if (fallback)
fallback->ShutdownParticles();
@ -2181,8 +2207,6 @@ static void PScript_Shutdown (void)
Cmd_RemoveCommand("pointfile"); //load the leak info produced from qbsp into the particle system to show a line. :)
Cmd_RemoveCommand("r_part");
Cmd_RemoveCommand("r_exportbuiltinparticles");
Cmd_RemoveCommand("r_importeffectinfo");
@ -4456,37 +4480,40 @@ static void GL_DrawTrifanParticle(int count, particle_t **plist, plooks_t *type)
}
}
static void GL_DrawLineSparkParticle(int count, particle_t **plist, plooks_t *type)
static void R_AddLineSparkParticle(scenetris_t *t, particle_t *p, plooks_t *type)
{
#ifdef warningmsg
#pragma warningmsg("fixme: no line sparks")
#endif
#if 0
particle_t *p;
vec3_t v, cr, o2;
float scale;
qglDisable(GL_TEXTURE_2D);
APPLYBLEND(type->blendmode);
qglShadeModel(GL_SMOOTH);
qglBegin(GL_LINES);
while (count--)
if (cl_numstrisvert+2 > cl_maxstrisvert)
{
p = *plist++;
qglColor4f (p->rgb[0],
p->rgb[1],
p->rgb[2],
p->alpha);
qglVertex3f (p->org[0], p->org[1], p->org[2]);
qglColor4f (p->rgb[0],
p->rgb[1],
p->rgb[2],
0);
qglVertex3f (p->org[0]-p->vel[0]/10, p->org[1]-p->vel[1]/10, p->org[2]-p->vel[2]/10);
cl_maxstrisvert+=64*2;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
qglEnd();
#endif
Vector4Copy(p->rgba, cl_strisvertc[cl_numstrisvert+0]);
VectorCopy(p->rgba, cl_strisvertc[cl_numstrisvert+1]);
cl_strisvertc[cl_numstrisvert+1][3] = 0;
Vector2Set(cl_strisvertt[cl_numstrisvert+0], p->s1, p->t1);
Vector2Set(cl_strisvertt[cl_numstrisvert+1], p->s2, p->t2);
VectorCopy(p->org, cl_strisvertv[cl_numstrisvert+0]);
VectorMA(p->org, -1/10, p->vel, cl_strisvertv[cl_numstrisvert+1]);
if (cl_numstrisidx+2 > cl_maxstrisidx)
{
cl_maxstrisidx += 64*2;
cl_strisidx = BZ_Realloc(cl_strisidx, sizeof(*cl_strisidx)*cl_maxstrisidx);
}
cl_strisidx[cl_numstrisidx++] = (cl_numstrisvert - t->firstvert) + 0;
cl_strisidx[cl_numstrisidx++] = (cl_numstrisvert - t->firstvert) + 1;
cl_numstrisvert += 2;
t->numvert += 2;
t->numidx += 2;
}
static void R_AddTSparkParticle(scenetris_t *t, particle_t *p, plooks_t *type)
@ -4892,9 +4919,9 @@ static void R_AddTexturedParticle(scenetris_t *t, particle_t *p, plooks_t *type)
static void PScript_DrawParticleTypes (void)
{
void (*sparklineparticles)(int count, particle_t **,plooks_t*)=GL_DrawLineSparkParticle;
void (*sparkfanparticles)(int count, particle_t **,plooks_t*)=GL_DrawTrifanParticle;
void (*sparktexturedparticles)(int count, particle_t **,plooks_t*)=GL_DrawTexturedSparkParticle;
void (*sparklineparticles)(scenetris_t *t, particle_t *p, plooks_t *type)=R_AddLineSparkParticle;
void (*sparkfanparticles)(scenetris_t *t, particle_t *p, plooks_t *type)=GL_DrawTrifanParticle;
void (*sparktexturedparticles)(scenetris_t *t, particle_t *p, plooks_t *type)=GL_DrawTexturedSparkParticle;
qboolean (*tr) (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal);
void *pdraw, *bdraw;
@ -4984,7 +5011,7 @@ static void PScript_DrawParticleTypes (void)
{
if (type->clippeddecals)
{
if (cl_numstris && cl_stris[cl_numstris-1].shader == type->looks.shader)
if (cl_numstris && cl_stris[cl_numstris-1].shader == type->looks.shader && cl_stris[cl_numstris-1].flags == (BEF_NODLIGHT|BEF_NOSHADOWS))
scenetri = &cl_stris[cl_numstris-1];
else
{
@ -4995,6 +5022,7 @@ static void PScript_DrawParticleTypes (void)
}
scenetri = &cl_stris[cl_numstris++];
scenetri->shader = type->looks.shader;
scenetri->flags = BEF_NODLIGHT|BEF_NOSHADOWS;
scenetri->firstidx = cl_numstrisidx;
scenetri->firstvert = cl_numstrisvert;
scenetri->numvert = 0;
@ -5096,7 +5124,7 @@ static void PScript_DrawParticleTypes (void)
if (!tdraw || type->looks.shader->sort == SHADER_SORT_BLEND)
scenetri = NULL;
else if (cl_numstris && cl_stris[cl_numstris-1].shader == type->looks.shader)
else if (cl_numstris && cl_stris[cl_numstris-1].shader == type->looks.shader && cl_stris[cl_numstris-1].flags == (BEF_NODLIGHT|BEF_NOSHADOWS))
scenetri = &cl_stris[cl_numstris-1];
else
{
@ -5109,6 +5137,7 @@ static void PScript_DrawParticleTypes (void)
scenetri->shader = type->looks.shader;
scenetri->firstidx = cl_numstrisidx;
scenetri->firstvert = cl_numstrisvert;
scenetri->flags = BEF_NODLIGHT|BEF_NOSHADOWS;
scenetri->numvert = 0;
scenetri->numidx = 0;
}

File diff suppressed because it is too large Load diff

View file

@ -222,7 +222,7 @@ int MP_TranslateDPtoFTECodes(int code)
}
//string findkeysforcommand(string command) = #610;
void QCBUILTIN PF_cl_findkeysforcommand (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_findkeysforcommand (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *cmdname = PR_GetStringOfs(prinst, OFS_PARM0);
int keynums[2];
@ -238,13 +238,13 @@ void QCBUILTIN PF_cl_findkeysforcommand (progfuncs_t *prinst, struct globalvars_
RETURN_TSTRING(keyname);
}
void QCBUILTIN PF_cl_getkeybind (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_getkeybind (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *binding = Key_GetBinding(G_FLOAT(OFS_PARM0));
RETURN_TSTRING(binding);
}
void QCBUILTIN PF_cl_stringtokeynum(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_stringtokeynum(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i;
int modifier;
@ -262,7 +262,7 @@ void QCBUILTIN PF_cl_stringtokeynum(progfuncs_t *prinst, struct globalvars_s *pr
}
//string keynumtostring(float keynum) = #609;
void QCBUILTIN PF_cl_keynumtostring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_keynumtostring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int code = G_FLOAT(OFS_PARM0);
@ -279,7 +279,7 @@ void QCBUILTIN PF_cl_keynumtostring (progfuncs_t *prinst, struct globalvars_s *p
//float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;
void QCBUILTIN PF_CL_drawfill (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawfill (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
float *size = G_VECTOR(OFS_PARM1);
@ -292,7 +292,7 @@ void QCBUILTIN PF_CL_drawfill (progfuncs_t *prinst, struct globalvars_s *pr_glob
G_FLOAT(OFS_RETURN) = 1;
}
//void drawsetcliparea(float x, float y, float width, float height) = #458;
void QCBUILTIN PF_CL_drawsetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawsetcliparea (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float x = G_FLOAT(OFS_PARM0), y = G_FLOAT(OFS_PARM1), w = G_FLOAT(OFS_PARM2), h = G_FLOAT(OFS_PARM3);
@ -322,7 +322,7 @@ void QCBUILTIN PF_CL_drawsetcliparea (progfuncs_t *prinst, struct globalvars_s *
G_FLOAT(OFS_RETURN) = 0;
}
//void drawresetcliparea(void) = #459;
void QCBUILTIN PF_CL_drawresetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawresetcliparea (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
#ifdef GLQUAKE
if (qrenderer == QR_OPENGL)
@ -335,7 +335,172 @@ void QCBUILTIN PF_CL_drawresetcliparea (progfuncs_t *prinst, struct globalvars_s
G_FLOAT(OFS_RETURN) = 0;
}
void QCBUILTIN PF_CL_DrawTextField (progfuncs_t *prinst, struct globalvars_s *pr_globals)
#define FONT_SLOTS 16
#define FONT_SIZES 4
struct {
char slotname[16];
char facename[64];
int sizes;
int size[4];
struct font_s *font[4];
} fontslot[FONT_SLOTS];
void PR_CL_BeginString(pubprogfuncs_t *prinst, float vx, float vy, float szx, float szy, float *px, float *py)
{
int fontidx = 0; //default by default...
world_t *world = prinst->parms->user;
struct font_s *font = font_conchar;
if (!world)
{
//menu progs.
if (mp_globs.drawfontscale)
{
szx *= mp_globs.drawfontscale[0];
szy *= mp_globs.drawfontscale[1];
}
if (mp_globs.drawfont)
{
fontidx = *mp_globs.drawfont;
}
}
else
{
if (world->g.drawfontscale)
{
szx *= world->g.drawfontscale[0];
szy *= world->g.drawfontscale[1];
}
if (world->g.drawfont)
{
fontidx = *world->g.drawfont;
}
}
fontidx--;
if (fontidx >= 0 && fontidx < FONT_SLOTS)
{
int i, j;
int fontdiff = 10000;
for (i = 0; i < fontslot[fontidx].sizes; i++)
{
j = abs(szy - fontslot[fontidx].size[i]);
if (j < fontdiff && fontslot[fontidx].font)
{
fontdiff = j;
font = fontslot[fontidx].font[i];
}
}
}
Font_BeginScaledString(font, vx, vy, szx, szy, px, py);
}
int PR_findnamedfont(char *name, qboolean isslotname)
{
int i;
if (isslotname)
{
for (i = 0; i < FONT_SLOTS; i++)
{
if (!stricmp(fontslot[i].slotname, name))
return i;
}
}
else
{
for (i = 0; i < FONT_SLOTS; i++)
{
if (!stricmp(fontslot[i].facename, name))
return i;
}
}
return -1;
}
void PR_ResetFonts(qboolean purge)
{
int i, j;
for (i = 0; i < FONT_SLOTS; i++)
{
for (j = 0; j < fontslot[i].sizes; j++)
{
Font_Free(fontslot[i].font[j]);
fontslot[i].font[j] = NULL;
}
if (purge)
{
fontslot[i].sizes = 0;
fontslot[i].slotname[0] = '\0';
fontslot[i].facename[0] = '\0';
}
else
{
for (j = 0; j < fontslot[i].sizes; j++)
fontslot[i].font[j] = Font_LoadFont(fontslot[i].size[j], fontslot[i].facename);
}
}
}
void QCBUILTIN PF_CL_findfont (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *slotname = PR_GetStringOfs(prinst, OFS_PARM0);
G_FLOAT(OFS_RETURN) = PR_findnamedfont(slotname, true) + 1; //return default on failure.
}
void QCBUILTIN PF_CL_loadfont (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *slotname = PR_GetStringOfs(prinst, OFS_PARM0);
char *facename = PR_GetStringOfs(prinst, OFS_PARM1);
char *sizestr = PR_GetStringOfs(prinst, OFS_PARM2);
int slotnum = G_FLOAT(OFS_PARM3);
//float fix_scale = G_FLOAT(OFS_PARM4);
//float fix_voffset = G_FLOAT(OFS_PARM5);
int i, sz;
G_FLOAT(OFS_RETURN) = 0; //return default on failure.
if (slotnum == -1 && *slotname)
slotnum = PR_findnamedfont(slotname, true);
else if (slotnum == -1)
slotnum = PR_findnamedfont(facename, false);
if (slotnum == -1)
slotnum = PR_findnamedfont("", true);
if (slotnum == -1)
return; //eep.
if ((unsigned)slotnum >= FONT_SLOTS)
return;
//if its changed, purge it.
if (stricmp(fontslot[slotnum].slotname, slotname) || stricmp(fontslot[slotnum].facename, facename))
{
Q_strncpyz(fontslot[slotnum].slotname, slotname, sizeof(fontslot[slotnum].slotname));
Q_strncpyz(fontslot[slotnum].facename, facename, sizeof(fontslot[slotnum].facename));
for (i = 0; i < fontslot[slotnum].sizes; i++)
{
Font_Free(fontslot[slotnum].font[i]);
fontslot[slotnum].font[i] = NULL;
}
}
while(*sizestr)
{
sizestr = COM_Parse(sizestr);
sz = atoi(com_token);
for (i = 0; i < fontslot[slotnum].sizes; i++)
{
if (fontslot[slotnum].size[i] == sz)
break;
}
if (i == fontslot[slotnum].sizes)
{
if (i >= FONT_SIZES)
break;
fontslot[slotnum].size[i] = sz;
fontslot[slotnum].font[i] = Font_LoadFont(fontslot[slotnum].size[i], facename);
fontslot[slotnum].sizes++;
}
}
G_FLOAT(OFS_RETURN) = slotnum + 1;
}
void QCBUILTIN PF_CL_DrawTextField (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
float *size = G_VECTOR(OFS_PARM1);
@ -345,7 +510,7 @@ void QCBUILTIN PF_CL_DrawTextField (progfuncs_t *prinst, struct globalvars_s *pr
}
//float drawstring(vector position, string text, vector scale, float alpha, float flag) = #455;
void QCBUILTIN PF_CL_drawcolouredstring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawcolouredstring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
char *text = PR_GetStringOfs(prinst, OFS_PARM1);
@ -353,11 +518,11 @@ void QCBUILTIN PF_CL_drawcolouredstring (progfuncs_t *prinst, struct globalvars_
float alpha = 0;
float flag = 0;
float r, g, b;
conchar_t buffer[2048], *str;
float px, py, ipx;
if (*prinst->callargc >= 6)
conchar_t buffer[2048], *str;
if (prinst->callargc >= 6)
{
r = G_FLOAT(OFS_PARM3 + 0);
g = G_FLOAT(OFS_PARM3 + 1);
@ -383,7 +548,7 @@ void QCBUILTIN PF_CL_drawcolouredstring (progfuncs_t *prinst, struct globalvars_
COM_ParseFunString(CON_WHITEMASK, text, buffer, sizeof(buffer), false);
str = buffer;
Font_BeginScaledString(font_conchar, pos[0], pos[1], &px, &py);
PR_CL_BeginString(prinst, pos[0], pos[1], size[0], size[1], &px, &py);
ipx = px;
Font_ForceColour(r, g, b, alpha);
while(*str)
@ -393,39 +558,28 @@ void QCBUILTIN PF_CL_drawcolouredstring (progfuncs_t *prinst, struct globalvars_
else if ((*str & CON_CHARMASK) == '\r')
px = ipx;
else
px = Font_DrawScaleChar(px, py, size[0], size[1], *str);
px = Font_DrawScaleChar(px, py, *str);
str++;
}
Font_InvalidateColour();
Font_EndString(font_conchar);
Font_EndString(NULL);
}
void QCBUILTIN PF_CL_stringwidth(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_stringwidth(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
conchar_t buffer[2048], *end;
float px, py;
char *text = PR_GetStringOfs(prinst, OFS_PARM0);
int usecolours = G_FLOAT(OFS_PARM1);
float fontsize;
if (*prinst->callargc > 2)
fontsize = G_FLOAT(OFS_PARM2+1);
else
fontsize = 8;
if (mp_globs.drawfontscale && !prinst->parms->user)
fontsize *= mp_globs.drawfontscale[1];
float *size = (prinst->callargc > 2)?G_VECTOR(OFS_PARM2):NULL;
end = COM_ParseFunString(CON_WHITEMASK, text, buffer, sizeof(buffer), !usecolours);
Font_BeginScaledString(font_conchar, 0, 0, &px, &py);
fontsize /= Font_CharHeight();
PR_CL_BeginString(prinst, 0, 0, size?size[0]:8, size?size[1]:8, &px, &py);
px = Font_LineWidth(buffer, end);
Font_EndString(font_conchar);
Font_EndString(NULL);
if (mp_globs.drawfontscale && !prinst->parms->user)
px *= mp_globs.drawfontscale[1];
G_FLOAT(OFS_RETURN) = px * fontsize;
G_FLOAT(OFS_RETURN) = (px * vid.width) / vid.rotpixelwidth;
}
#define DRAWFLAG_NORMAL 0
@ -448,7 +602,7 @@ static unsigned int PF_SelectDPDrawFlag(int flag)
}
//float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
void QCBUILTIN PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawpic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
char *picname = PR_GetStringOfs(prinst, OFS_PARM1);
@ -471,7 +625,7 @@ void QCBUILTIN PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globa
G_FLOAT(OFS_RETURN) = 1;
}
void QCBUILTIN PF_CL_drawsubpic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawsubpic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
float *size = G_VECTOR(OFS_PARM1);
@ -485,6 +639,8 @@ void QCBUILTIN PF_CL_drawsubpic (progfuncs_t *prinst, struct globalvars_s *pr_gl
mpic_t *p;
p = R2D_SafeCachePic(picname);
if (!p)
p = R2D_SafePicFromWad(picname);
r2d_be_flags = PF_SelectDPDrawFlag(flag);
R2D_ImageColours(rgb[0], rgb[1], rgb[2], alpha);
@ -501,7 +657,7 @@ void QCBUILTIN PF_CL_drawsubpic (progfuncs_t *prinst, struct globalvars_s *pr_gl
void QCBUILTIN PF_CL_is_cached_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_is_cached_pic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str;
@ -513,14 +669,14 @@ void QCBUILTIN PF_CL_is_cached_pic (progfuncs_t *prinst, struct globalvars_s *pr
G_FLOAT(OFS_RETURN) = 1;
}
void QCBUILTIN PF_CL_precache_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_precache_pic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str;
mpic_t *pic;
float fromwad;
str = PR_GetStringOfs(prinst, OFS_PARM0);
if (*prinst->callargc > 1)
if (prinst->callargc > 1)
fromwad = G_FLOAT(OFS_PARM1);
else
fromwad = false;
@ -545,7 +701,7 @@ void QCBUILTIN PF_CL_precache_pic (progfuncs_t *prinst, struct globalvars_s *pr_
G_INT(OFS_RETURN) = 0;
}
void QCBUILTIN PF_CL_free_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_free_pic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str;
@ -554,9 +710,8 @@ void QCBUILTIN PF_CL_free_pic (progfuncs_t *prinst, struct globalvars_s *pr_glob
//we don't support this.
}
//float drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454;
void QCBUILTIN PF_CL_drawcharacter (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawcharacter (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
int chara = G_FLOAT(OFS_PARM1);
@ -577,16 +732,17 @@ void QCBUILTIN PF_CL_drawcharacter (progfuncs_t *prinst, struct globalvars_s *pr
if (chara < 32 && chara != '\t')
chara |= 0xe000;
Font_BeginScaledString(font_conchar, pos[0], pos[1], &x, &y);
PR_CL_BeginString(prinst, pos[0], pos[1], size[0], size[1], &x, &y);
Font_ForceColour(rgb[0], rgb[1], rgb[2], alpha);
Font_DrawScaleChar(x, y, size[0], size[1], CON_WHITEMASK | /*0xe000|*/chara);
Font_DrawScaleChar(x, y, CON_WHITEMASK | /*0xe000|*/chara);
Font_InvalidateColour();
Font_EndString(font_conchar);
Font_EndString(NULL);
G_FLOAT(OFS_RETURN) = 1;
}
//float drawrawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #455;
void QCBUILTIN PF_CL_drawrawstring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawrawstring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
char *text = PR_GetStringOfs(prinst, OFS_PARM1);
@ -603,16 +759,9 @@ void QCBUILTIN PF_CL_drawrawstring (progfuncs_t *prinst, struct globalvars_s *pr
return;
}
Font_BeginScaledString(font_conchar, pos[0], pos[1], &x, &y);
x = pos[0];
y = pos[1];
PR_CL_BeginString(prinst, pos[0], pos[1], size[0], size[1], &x, &y);
Font_ForceColour(rgb[0], rgb[1], rgb[2], alpha);
if (mp_globs.drawfontscale && !prinst->parms->user)
{
size[0] *= mp_globs.drawfontscale[0];
size[1] *= mp_globs.drawfontscale[1];
}
while(*text)
{
//FIXME: which charset is this meant to be using?
@ -622,19 +771,19 @@ void QCBUILTIN PF_CL_drawrawstring (progfuncs_t *prinst, struct globalvars_s *pr
c |= 0xe000; //if its a control char, just use the quake range instead.
else if (c & 0x80)
c |= 0xe000; //if its a high char, just use the quake range instead. we could colour it, but why bother
x = Font_DrawScaleChar(x, y, size[0], size[1], CON_WHITEMASK|/*0xe000|*/c);
x = Font_DrawScaleChar(x, y, CON_WHITEMASK|/*0xe000|*/c);
}
Font_InvalidateColour();
Font_EndString(font_conchar);
Font_EndString(NULL);
}
//void (float width, vector rgb, float alpha, float flags, vector pos1, ...) drawline;
void QCBUILTIN PF_CL_drawline (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawline (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *rgb = G_VECTOR(OFS_PARM1);
float alpha = G_FLOAT(OFS_PARM2);
float *pos = G_VECTOR(OFS_PARM4);
int numpoints = *prinst->callargc-4;
int numpoints = prinst->callargc-4;
#ifdef GLQUAKE // :(
@ -654,7 +803,7 @@ void QCBUILTIN PF_CL_drawline (progfuncs_t *prinst, struct globalvars_s *pr_glob
}
//vector drawgetimagesize(string pic) = #460;
void QCBUILTIN PF_CL_drawgetimagesize (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_drawgetimagesize (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *picname = PR_GetStringOfs(prinst, OFS_PARM0);
mpic_t *p = R2D_SafeCachePic(picname);
@ -675,6 +824,30 @@ void QCBUILTIN PF_CL_drawgetimagesize (progfuncs_t *prinst, struct globalvars_s
}
}
//vector getmousepos(void) = #66;
void QCBUILTIN PF_cl_getmousepos (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *ret = G_VECTOR(OFS_RETURN);
if (Key_MouseShouldBeFree())
{
ret[0] = mousecursor_x;
ret[1] = mousecursor_y;
}
else
{
ret[0] = mousemove_x;
ret[1] = mousemove_y;
}
mousemove_x=0;
mousemove_y=0;
// extern int mousecursor_x, mousecursor_y;
// ret[0] = mousecursor_x;
// ret[1] = mousecursor_y;
ret[2] = 0;
}
#endif
@ -708,14 +881,14 @@ cvar_t pr_menuqc_coreonerror = SCVAR("pr_menuqc_coreonerror", "1");
//new generic functions.
void QCBUILTIN PF_mod (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_mod (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int a = G_FLOAT(OFS_PARM0);
int b = G_FLOAT(OFS_PARM1);
if (b == 0)
{
Con_Printf("mod by zero\n");
*prinst->pr_trace = 1;
prinst->pr_trace = 1;
G_FLOAT(OFS_RETURN) = 0;
}
else
@ -747,7 +920,7 @@ char *RemapCvarNameFromDPToFTE(char *name)
return name;
}
static void QCBUILTIN PF_menu_cvar (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void QCBUILTIN PF_menu_cvar (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
cvar_t *var;
char *str;
@ -773,7 +946,7 @@ static void QCBUILTIN PF_menu_cvar (progfuncs_t *prinst, struct globalvars_s *pr
G_FLOAT(OFS_RETURN) = 0;
}
}
static void QCBUILTIN PF_menu_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void QCBUILTIN PF_menu_cvar_set (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *var_name, *val;
cvar_t *var;
@ -785,7 +958,7 @@ static void QCBUILTIN PF_menu_cvar_set (progfuncs_t *prinst, struct globalvars_s
var = Cvar_Get(var_name, val, 0, "QC variables");
Cvar_Set (var, val);
}
static void QCBUILTIN PF_menu_cvar_string (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void QCBUILTIN PF_menu_cvar_string (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str = PR_GetStringOfs(prinst, OFS_PARM0);
cvar_t *cv = Cvar_Get(RemapCvarNameFromDPToFTE(str), "", 0, "QC variables");
@ -794,7 +967,7 @@ static void QCBUILTIN PF_menu_cvar_string (progfuncs_t *prinst, struct globalvar
qboolean M_Vid_GetMode(int num, int *w, int *h);
//a bit pointless really
void QCBUILTIN PF_cl_getresolution (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_getresolution (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float mode = G_FLOAT(OFS_PARM0);
float *ret = G_VECTOR(OFS_RETURN);
@ -811,7 +984,7 @@ void QCBUILTIN PF_cl_getresolution (progfuncs_t *prinst, struct globalvars_s *pr
void QCBUILTIN PF_nonfatalobjerror (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_nonfatalobjerror (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *s;
struct edict_s *ed;
@ -830,7 +1003,7 @@ void QCBUILTIN PF_nonfatalobjerror (progfuncs_t *prinst, struct globalvars_s *pr
if (developer.value)
*prinst->pr_trace = 2;
prinst->pr_trace = 2;
else
{
ED_Free (prinst, ed);
@ -846,7 +1019,7 @@ void QCBUILTIN PF_nonfatalobjerror (progfuncs_t *prinst, struct globalvars_s *pr
//float isserver(void) = #60;
void QCBUILTIN PF_isserver (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_isserver (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
#ifdef CLIENTONLY
G_FLOAT(OFS_RETURN) = false;
@ -854,19 +1027,19 @@ void QCBUILTIN PF_isserver (progfuncs_t *prinst, struct globalvars_s *pr_globals
G_FLOAT(OFS_RETURN) = sv.state != ss_dead;
#endif
}
void QCBUILTIN PF_isdemo (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_isdemo (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = !!cls.demoplayback;
}
//float clientstate(void) = #62;
void QCBUILTIN PF_clientstate (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_clientstate (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = cls.state >= ca_connected ? 2 : 1; //fit in with netquake (we never run a menu.dat dedicated)
}
//too specific to the prinst's builtins.
static void QCBUILTIN PF_Fixme (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void QCBUILTIN PF_Fixme (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
Con_Printf("\n");
@ -876,7 +1049,7 @@ static void QCBUILTIN PF_Fixme (progfuncs_t *prinst, struct globalvars_s *pr_glo
void QCBUILTIN PF_CL_precache_sound (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_precache_sound (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str;
@ -889,7 +1062,7 @@ void QCBUILTIN PF_CL_precache_sound (progfuncs_t *prinst, struct globalvars_s *p
}
//void setkeydest(float dest) = #601;
void QCBUILTIN PF_cl_setkeydest (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_setkeydest (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
switch((int)G_FLOAT(OFS_PARM0))
{
@ -911,7 +1084,7 @@ void QCBUILTIN PF_cl_setkeydest (progfuncs_t *prinst, struct globalvars_s *pr_gl
}
}
//float getkeydest(void) = #602;
void QCBUILTIN PF_cl_getkeydest (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_getkeydest (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
switch(key_dest)
{
@ -934,7 +1107,7 @@ void QCBUILTIN PF_cl_getkeydest (progfuncs_t *prinst, struct globalvars_s *pr_gl
}
//void setmousetarget(float trg) = #603;
void QCBUILTIN PF_cl_setmousetarget (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_setmousetarget (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
extern int mouseusedforgui;
switch ((int)G_FLOAT(OFS_PARM0))
@ -951,41 +1124,13 @@ void QCBUILTIN PF_cl_setmousetarget (progfuncs_t *prinst, struct globalvars_s *p
}
//float getmousetarget(void) = #604;
void QCBUILTIN PF_cl_getmousetarget (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_cl_getmousetarget (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
extern int mouseusedforgui;
G_FLOAT(OFS_RETURN) = mouseusedforgui?2:1;
}
//vector getmousepos(void) = #66;
void QCBUILTIN PF_cl_getmousepos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *ret = G_VECTOR(OFS_RETURN);
extern int mousemove_x, mousemove_y;
extern int mousecursor_x, mousecursor_y;
if (Key_MouseShouldBeFree())
{
ret[0] = mousecursor_x;
ret[1] = mousecursor_y;
}
else
{
ret[0] = mousemove_x;
ret[1] = mousemove_y;
}
mousemove_x=0;
mousemove_y=0;
// extern int mousecursor_x, mousecursor_y;
// ret[0] = mousecursor_x;
// ret[1] = mousecursor_y;
ret[2] = 0;
}
static void QCBUILTIN PF_Remove_ (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void QCBUILTIN PF_Remove_ (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
menuedict_t *ed;
@ -1000,7 +1145,7 @@ static void QCBUILTIN PF_Remove_ (progfuncs_t *prinst, struct globalvars_s *pr_g
ED_Free (prinst, (void*)ed);
}
static void QCBUILTIN PF_CopyEntity (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void QCBUILTIN PF_CopyEntity (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
menuedict_t *in, *out;
@ -1024,7 +1169,7 @@ typedef enum{
SLIST_SORTDESCENDING
} hostcacheglobal_t;
void QCBUILTIN PF_M_gethostcachevalue (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_gethostcachevalue (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
hostcacheglobal_t hcg = G_FLOAT(OFS_PARM0);
G_FLOAT(OFS_RETURN) = 0;
@ -1060,12 +1205,12 @@ void QCBUILTIN PF_M_gethostcachevalue (progfuncs_t *prinst, struct globalvars_s
}
//void resethostcachemasks(void) = #615;
void QCBUILTIN PF_M_resethostcachemasks(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_resethostcachemasks(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
Master_ClearMasks();
}
//void sethostcachemaskstring(float mask, float fld, string str, float op) = #616;
void QCBUILTIN PF_M_sethostcachemaskstring(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_sethostcachemaskstring(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int mask = G_FLOAT(OFS_PARM0);
int field = G_FLOAT(OFS_PARM1);
@ -1075,7 +1220,7 @@ void QCBUILTIN PF_M_sethostcachemaskstring(progfuncs_t *prinst, struct globalvar
Master_SetMaskString(mask, field, str, op);
}
//void sethostcachemasknumber(float mask, float fld, float num, float op) = #617;
void QCBUILTIN PF_M_sethostcachemasknumber(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_sethostcachemasknumber(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int mask = G_FLOAT(OFS_PARM0);
int field = G_FLOAT(OFS_PARM1);
@ -1085,22 +1230,22 @@ void QCBUILTIN PF_M_sethostcachemasknumber(progfuncs_t *prinst, struct globalvar
Master_SetMaskInteger(mask, field, str, op);
}
//void resorthostcache(void) = #618;
void QCBUILTIN PF_M_resorthostcache(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_resorthostcache(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
Master_SortServers();
}
//void sethostcachesort(float fld, float descending) = #619;
void QCBUILTIN PF_M_sethostcachesort(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_sethostcachesort(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
Master_SetSortField(G_FLOAT(OFS_PARM0), G_FLOAT(OFS_PARM1));
}
//void refreshhostcache(void) = #620;
void QCBUILTIN PF_M_refreshhostcache(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_refreshhostcache(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
MasterInfo_Refresh();
}
//float gethostcachenumber(float fld, float hostnr) = #621;
void QCBUILTIN PF_M_gethostcachenumber(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_gethostcachenumber(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float ret = 0;
int keynum = G_FLOAT(OFS_PARM0);
@ -1112,7 +1257,7 @@ void QCBUILTIN PF_M_gethostcachenumber(progfuncs_t *prinst, struct globalvars_s
G_FLOAT(OFS_RETURN) = ret;
}
void QCBUILTIN PF_M_gethostcachestring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_gethostcachestring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *ret;
int keynum = G_FLOAT(OFS_PARM0);
@ -1126,25 +1271,25 @@ void QCBUILTIN PF_M_gethostcachestring (progfuncs_t *prinst, struct globalvars_s
}
//float gethostcacheindexforkey(string key) = #622;
void QCBUILTIN PF_M_gethostcacheindexforkey(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_gethostcacheindexforkey(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *keyname = PR_GetStringOfs(prinst, OFS_PARM0);
G_FLOAT(OFS_RETURN) = Master_KeyForName(keyname);
}
//void addwantedhostcachekey(string key) = #623;
void QCBUILTIN PF_M_addwantedhostcachekey(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_addwantedhostcachekey(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
PF_M_gethostcacheindexforkey(prinst, pr_globals);
}
void QCBUILTIN PF_M_getextresponse(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_M_getextresponse(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
//this does something weird
G_INT(OFS_RETURN) = 0;
}
void QCBUILTIN PF_netaddress_resolve(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_netaddress_resolve(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *address = PR_GetStringOfs(prinst, OFS_PARM0);
netadr_t adr;
@ -1156,30 +1301,30 @@ void QCBUILTIN PF_netaddress_resolve(progfuncs_t *prinst, struct globalvars_s *p
}
#else
void PF_gethostcachevalue (progfuncs_t *prinst, struct globalvars_s *pr_globals){G_FLOAT(OFS_RETURN) = 0;}
void PF_gethostcachestring (progfuncs_t *prinst, struct globalvars_s *pr_globals) {G_INT(OFS_RETURN) = 0;}
void PF_gethostcachevalue (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){G_FLOAT(OFS_RETURN) = 0;}
void PF_gethostcachestring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) {G_INT(OFS_RETURN) = 0;}
//void resethostcachemasks(void) = #615;
void PF_M_resethostcachemasks(progfuncs_t *prinst, struct globalvars_s *pr_globals){}
void PF_M_resethostcachemasks(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
//void sethostcachemaskstring(float mask, float fld, string str, float op) = #616;
void PF_M_sethostcachemaskstring(progfuncs_t *prinst, struct globalvars_s *pr_globals){}
void PF_M_sethostcachemaskstring(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
//void sethostcachemasknumber(float mask, float fld, float num, float op) = #617;
void PF_M_sethostcachemasknumber(progfuncs_t *prinst, struct globalvars_s *pr_globals){}
void PF_M_sethostcachemasknumber(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
//void resorthostcache(void) = #618;
void PF_M_resorthostcache(progfuncs_t *prinst, struct globalvars_s *pr_globals){}
void PF_M_resorthostcache(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
//void sethostcachesort(float fld, float descending) = #619;
void PF_M_sethostcachesort(progfuncs_t *prinst, struct globalvars_s *pr_globals){}
void PF_M_sethostcachesort(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
//void refreshhostcache(void) = #620;
void PF_M_refreshhostcache(progfuncs_t *prinst, struct globalvars_s *pr_globals) {}
void PF_M_refreshhostcache(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) {}
//float gethostcachenumber(float fld, float hostnr) = #621;
void PF_M_gethostcachenumber(progfuncs_t *prinst, struct globalvars_s *pr_globals){G_FLOAT(OFS_RETURN) = 0;}
void PF_M_gethostcachenumber(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){G_FLOAT(OFS_RETURN) = 0;}
//float gethostcacheindexforkey(string key) = #622;
void PF_M_gethostcacheindexforkey(progfuncs_t *prinst, struct globalvars_s *pr_globals){G_FLOAT(OFS_RETURN) = 0;}
void PF_M_gethostcacheindexforkey(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){G_FLOAT(OFS_RETURN) = 0;}
//void addwantedhostcachekey(string key) = #623;
void PF_M_addwantedhostcachekey(progfuncs_t *prinst, struct globalvars_s *pr_globals){}
void PF_M_addwantedhostcachekey(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
#endif
void QCBUILTIN PF_localsound (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_localsound (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *soundname = PR_GetStringOfs(prinst, OFS_PARM0);
S_LocalSound (soundname);
@ -1191,24 +1336,24 @@ void QCBUILTIN PF_localsound (progfuncs_t *prinst, struct globalvars_s *pr_globa
#define skip50 skip10 skip10 skip10 skip10 skip10
#define skip100 skip50 skip50
void QCBUILTIN PF_menu_checkextension (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_menu_checkextension (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
//yeah, this is a stub... not sure what form extex
G_FLOAT(OFS_RETURN) = 0;
}
void QCBUILTIN PF_gettime (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_gettime (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = *prinst->parms->gametime;
}
void QCBUILTIN PF_CL_precache_file (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_CL_precache_file (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_INT(OFS_RETURN) = G_INT(OFS_PARM0);
}
//entity findchainstring(.string _field, string match) = #26;
void QCBUILTIN PF_menu_findchain (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_menu_findchain (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i, f;
char *s;
@ -1241,7 +1386,7 @@ void QCBUILTIN PF_menu_findchain (progfuncs_t *prinst, struct globalvars_s *pr_g
RETURN_EDICT(prinst, (void*)chain);
}
//entity findchainfloat(.float _field, float match) = #27;
void QCBUILTIN PF_menu_findchainfloat (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_menu_findchainfloat (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i, f;
float s;
@ -1270,18 +1415,18 @@ void QCBUILTIN PF_menu_findchainfloat (progfuncs_t *prinst, struct globalvars_s
RETURN_EDICT(prinst, (void*)chain);
}
void QCBUILTIN PF_etof(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_etof(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = G_EDICTNUM(prinst, OFS_PARM0);
}
void QCBUILTIN PF_ftoe(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_ftoe(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int entnum = G_FLOAT(OFS_PARM0);
RETURN_EDICT(prinst, EDICT_NUM(prinst, entnum));
}
void QCBUILTIN PF_IsNotNull(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_IsNotNull(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int str = G_INT(OFS_PARM0);
G_FLOAT(OFS_RETURN) = !!str;
@ -1289,7 +1434,7 @@ void QCBUILTIN PF_IsNotNull(progfuncs_t *prinst, struct globalvars_s *pr_globals
//float altstr_count(string str) = #82;
//returns number of single quoted strings in the string.
void QCBUILTIN PF_altstr_count(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_altstr_count(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *s;
int count = 0;
@ -1307,7 +1452,7 @@ void QCBUILTIN PF_altstr_count(progfuncs_t *prinst, struct globalvars_s *pr_glob
G_FLOAT(OFS_RETURN) = count/2;
}
//string altstr_prepare(string str) = #83;
void QCBUILTIN PF_altstr_prepare(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_altstr_prepare(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char outstr[8192], *out;
char *instr, *in;
@ -1334,7 +1479,7 @@ void QCBUILTIN PF_altstr_prepare(progfuncs_t *prinst, struct globalvars_s *pr_gl
G_INT( OFS_RETURN ) = (int)PR_TempString( prinst, outstr );
}
//string altstr_get(string str, float num) = #84;
void QCBUILTIN PF_altstr_get(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_altstr_get(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *altstr, *pos, outstr[8192], *out;
int count, size;
@ -1380,7 +1525,7 @@ void QCBUILTIN PF_altstr_get(progfuncs_t *prinst, struct globalvars_s *pr_global
G_INT( OFS_RETURN ) = (int)PR_SetString( prinst, outstr );
}
//string altstr_set(string str, float num, string set) = #85
void QCBUILTIN PF_altstr_set(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_altstr_set(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int num;
char *altstr, *str;
@ -1432,31 +1577,31 @@ void QCBUILTIN PF_altstr_set(progfuncs_t *prinst, struct globalvars_s *pr_global
}
//string(string serveraddress) crypto_getkeyfp
void QCBUILTIN PF_crypto_getkeyfp(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_crypto_getkeyfp(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
//not supported.
G_INT(OFS_RETURN) = 0;
}
//string(string serveraddress) crypto_getidfp
void QCBUILTIN PF_crypto_getidfp(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_crypto_getidfp(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
//not supported.
G_INT(OFS_RETURN) = 0;
}
//string(string serveraddress) crypto_getencryptlevel
void QCBUILTIN PF_crypto_getencryptlevel(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_crypto_getencryptlevel(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
//not supported.
G_INT(OFS_RETURN) = 0;
}
//string(float i) crypto_getmykeyfp
void QCBUILTIN PF_crypto_getmykeyfp(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_crypto_getmykeyfp(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
//not supported.
G_INT(OFS_RETURN) = 0;
}
//string(float i) crypto_getmyidfp
void QCBUILTIN PF_crypto_getmyidfp(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_crypto_getmyidfp(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
//not supported.
G_INT(OFS_RETURN) = 0;
@ -1656,6 +1801,7 @@ builtin_t menu_builtins[] = {
//470
skip1 // #470
//MERGES WITH CLIENT+SERVER BUILTIN MAPPINGS BELOW
PF_asin, // #471
PF_acos, // #472
PF_atan, // #473
@ -1779,7 +1925,7 @@ int menu_numbuiltins = sizeof(menu_builtins)/sizeof(menu_builtins[0]);
void M_DeInit_Internal (void);
int inmenuprogs;
progfuncs_t *menuprogs;
pubprogfuncs_t *menuprogs;
progparms_t menuprogparms;
menuedict_t *menu_edicts;
int num_menu_edicts;
@ -1817,26 +1963,21 @@ void MP_Shutdown (void)
if (temp && !inmenuprogs)
PR_ExecuteProgram(menuprogs, temp);
PR_fclose_progs(menuprogs);
search_close_progs(menuprogs, true);
PR_Common_Shutdown(menuprogs, false);
menuprogs->CloseProgs(menuprogs);
menuprogs = NULL;
PR_ResetFonts(true);
#ifdef CL_MASTER
Master_ClearMasks();
#endif
CloseProgs(menuprogs);
#ifdef TEXTEDITOR
Editor_ProgsKilled(menuprogs);
#endif
menuprogs = NULL;
key_dest = key_game;
m_state = 0;
mouseusedforgui = false;
}
pbool QC_WriteFile(const char *name, void *data, int len);
void *VARGS PR_CB_Malloc(int size); //these functions should be tracked by the library reliably, so there should be no need to track them ourselves.
void VARGS PR_CB_Free(void *mem);
@ -1899,7 +2040,7 @@ qboolean MP_Init (void)
menuprogparms.ReadFile = COM_LoadStackFile;//char *(*ReadFile) (char *fname, void *buffer, int *len);
menuprogparms.FileSize = COM_FileSize;//int (*FileSize) (char *fname); //-1 if file does not exist
menuprogparms.WriteFile = QC_WriteFile;//bool (*WriteFile) (char *name, void *data, int len);
menuprogparms.printf = (void *)Con_Printf;//Con_Printf;//void (*printf) (char *, ...);
menuprogparms.Printf = (void *)Con_Printf;//Con_Printf;//void (*printf) (char *, ...);
menuprogparms.Sys_Error = Sys_Error;
menuprogparms.Abort = Menu_Abort;
menuprogparms.edictsize = sizeof(menuedict_t);

File diff suppressed because it is too large Load diff

View file

@ -183,7 +183,8 @@ void R2D_Init(void)
"program defaultfill\n"
"{\n"
"map $whiteimage\n"
"rgbgen vertex\n"
"rgbgen exactvertex\n"
"alphagen vertex\n"
"}\n"
"}\n");
shader_draw_fill_trans = R_RegisterShader("fill_trans",
@ -247,44 +248,7 @@ void R2D_Init(void)
"{\n"
"if $glsl && gl_menutint_shader != 0\n"
"[\n"
"glslprogram\n"
"{\n"
"#ifdef VERTEX_SHADER\n"
"\
attribute vec2 v_texcoord;\
varying vec2 texcoord;\
uniform vec3 rendertexturescale;\
void main(void)\
{\
texcoord.x = v_texcoord.x*rendertexturescale.x;\
texcoord.y = (1.0-v_texcoord.y)*rendertexturescale.y;\
gl_Position = ftetransform();\
}\
\n"
"#endif\n"
"#ifdef FRAGMENT_SHADER\n"
"\
varying vec2 texcoord;\
uniform vec3 colorparam;\
uniform sampler2D s_t0;\
uniform int invert;\
const vec3 lumfactors = vec3(0.299, 0.587, 0.114);\
const vec3 invertvec = vec3(1.0, 1.0, 1.0);\
void main(void)\
{\
vec3 texcolor = texture2D(s_t0, texcoord).rgb;\
float luminance = dot(lumfactors, texcolor);\
texcolor = vec3(luminance, luminance, luminance);\
texcolor *= colorparam;\
texcolor = (invert > 0) ? (invertvec - texcolor) : texcolor;\
gl_FragColor = vec4(texcolor, 1.0);\
}\n"
"#endif\n"
"}\n"
"param cvari r_menutint_inverse invert\n"
"param cvar3f r_menutint colorparam\n"
"param rendertexturescale rendertexturescale\n"
"program menutint\n"
"{\n"
"map $currentrender\n"
"}\n"
@ -631,20 +595,58 @@ void R2D_Conback_Callback(struct cvar_s *var, char *oldvalue)
}
}
#ifdef _WIN32
#include <windows.h>
#endif
void R2D_Font_Callback(struct cvar_s *var, char *oldvalue)
{
if (font_conchar)
Font_Free(font_conchar);
font_conchar = NULL;
if (qrenderer == QR_NONE)
return;
#ifdef _WIN32
if (!strcmp(var->string, "?"))
{
font_conchar = NULL;
LOGFONT lf = {0};
CHOOSEFONT cf = {sizeof(cf)};
extern HWND mainwindow;
extern qboolean WinNT;
font_conchar = Font_LoadFont(8, "");
cf.hwndOwner = mainwindow;
cf.iPointSize = (8 * vid.rotpixelheight)/vid.height;
cf.Flags = CF_FORCEFONTEXIST | CF_TTONLY;
cf.lpLogFont = &lf;
if (ChooseFont(&cf))
{
char fname[MAX_OSPATH];
DWORD bufsz = sizeof(fname);
char *keyname;
keyname = va("%s%s%s (TrueType)", lf.lfFaceName, lf.lfWeight>=FW_BOLD?" Bold":"", lf.lfItalic?" Italic":"");
if (ERROR_SUCCESS == RegGetValue(HKEY_LOCAL_MACHINE, WinNT?"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts":"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Fonts", keyname, RRF_RT_REG_SZ, NULL, fname, &bufsz))
{
Cvar_Set(var, fname);
return;
}
keyname = va("%s (OpenType)", lf.lfFaceName);
if (ERROR_SUCCESS == RegGetValue(HKEY_LOCAL_MACHINE, WinNT?"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts":"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Fonts", keyname, RRF_RT_REG_SZ, NULL, fname, &bufsz))
{
Cvar_Set(var, fname);
return;
}
}
Cvar_Set(var, "");
return;
}
#endif
font_conchar = Font_LoadFont(8*vid.rotpixelheight/vid.height, var->string);
font_conchar = Font_LoadFont(8, var->string);
if (!font_conchar && *var->string)
font_conchar = Font_LoadFont(8*vid.rotpixelheight/vid.height, "");
font_conchar = Font_LoadFont(8, "");
}
// console size manipulation callbacks
@ -726,6 +728,10 @@ void R2D_Console_Resize(void)
Cvar_ForceCallback(&gl_font);
#if defined(MENU_DAT) || defined(CSQC_DAT)
PR_ResetFonts(false);
#endif
#ifdef PLUGINS
Plug_ResChanged();
#endif
@ -1106,13 +1112,11 @@ void R2D_DrawCrosshair(void)
for (sc = 0; sc < cl.splitclients; sc++)
{
SCR_CrosshairPosition(sc, &x, &y);
Font_BeginScaledString(font_conchar, x, y, &sx, &sy);
sizex = Font_CharWidth('+' | 0xe000 | CON_WHITEMASK) * size;
sizey = Font_CharHeight() * size;
sx -= sizex/2;
sy -= sizey/2;
Font_BeginScaledString(font_conchar, x, y, size, size, &sx, &sy);
sx -= Font_CharWidth('+' | 0xe000 | CON_WHITEMASK)/2;
sy -= Font_CharHeight()/2;
Font_ForceColour(ch_color[0], ch_color[1], ch_color[2], crosshairalpha.value);
Font_DrawScaleChar(sx, sy, sizex, sizey, '+' | 0xe000 | CON_WHITEMASK);
Font_DrawScaleChar(sx, sy, '+' | 0xe000 | CON_WHITEMASK);
Font_InvalidateColour();
Font_EndString(font_conchar);
}

View file

@ -2380,6 +2380,10 @@ void Surf_LightmapMode(void)
switch(qrenderer)
{
case QR_SOFTWARE:
lightmap_bytes = 4;
lightmap_bgra = true;
break;
#ifdef D3DQUAKE
case QR_DIRECT3D9:
case QR_DIRECT3D11:

View file

@ -98,7 +98,10 @@ typedef struct entity_s
struct model_s *model; // NULL = no model
int skinnum; // for Alias models
struct player_info_s *scoreboard; // identify player
int playerindex; //for qw skins
int topcolour; //colourmapping
int bottomcolour; //colourmapping
int h2playerclass; //hexen2's quirky colourmapping
// struct efrag_s *efrag; // linked list of efrags (FIXME)
// int visframe; // last frame this entity was
@ -427,6 +430,7 @@ extern cvar_t r_shadow_realtime_dlight_ambient;
extern cvar_t r_shadow_realtime_dlight_diffuse;
extern cvar_t r_shadow_realtime_dlight_specular;
extern cvar_t r_shadow_realtime_world, r_shadow_realtime_world_shadows;
extern cvar_t r_shadow_shadowmapping;
extern cvar_t r_editlights_import_radius;
extern cvar_t r_editlights_import_ambient;
extern cvar_t r_editlights_import_diffuse;

View file

@ -16,6 +16,8 @@ int sh_shadowframe; //index for msurf->shadowframe
int r_framecount;
struct texture_s *r_notexture_mip;
r_config_t r_config;
qboolean r_blockvidrestart;
void R_InitParticleTexture (void);
@ -1060,6 +1062,8 @@ qboolean R_ApplyRenderer_Load (rendererstate_t *newr)
pmove.numphysent = 0;
memset(&r_config, 0, sizeof(r_config));
if (qrenderer != QR_NONE) //graphics stuff only when not dedicated
{
qbyte *data;
@ -1269,10 +1273,7 @@ TRACE(("dbg: R_ApplyRenderer: starting on client state\n"));
if (cl.worldmodel)
{
cl.worldmodel = NULL;
cl_numvisedicts = 0;
cl_numstrisidx = 0;
cl_numstrisvert = 0;
cl_numstris = 0;
CL_ClearEntityLists(); //shouldn't really be needed, but we're paranoid
TRACE(("dbg: R_ApplyRenderer: reloading ALL models\n"));
for (i=1 ; i<MAX_MODELS ; i++)
@ -2504,7 +2505,7 @@ void R_InitParticleTexture (void)
data[y*PARTICLETEXTURESIZE+x][3] = (qbyte) d;
}
}
balltexture = R_LoadTexture32("", PARTICLETEXTURESIZE, PARTICLETEXTURESIZE, data, IF_NOMIPMAP|IF_NOPICMIP);
balltexture = R_LoadTexture32("balltexture", PARTICLETEXTURESIZE, PARTICLETEXTURESIZE, data, IF_NOMIPMAP|IF_NOPICMIP);
memset(data, 255, sizeof(data));
for (y = 0;y < PARTICLETEXTURESIZE;y++)

View file

@ -123,7 +123,7 @@ int sb_lines; // scan lines to draw
void Sbar_DeathmatchOverlay (int start);
void Sbar_TeamOverlay (void);
void Sbar_MiniDeathmatchOverlay (void);
static void Sbar_MiniDeathmatchOverlay (int pnum);
void Sbar_ChatModeOverlay(void);
int Sbar_PlayerNum(void)
@ -1028,7 +1028,7 @@ void Draw_TinyString (int x, int y, const qbyte *str)
if (!font_tiny)
{
font_tiny = Font_LoadFont(6*vid.pixelheight/vid.height, "gfx/tinyfont");
font_tiny = Font_LoadFont(6, "gfx/tinyfont");
if (!font_tiny)
return;
}
@ -2176,7 +2176,7 @@ void Sbar_Hexen2DrawMinimal(int pnum)
}
void Sbar_DrawTeamStatus(void)
static void Sbar_DrawTeamStatus(int pnum)
{
int p;
int y;
@ -2186,13 +2186,13 @@ void Sbar_DrawTeamStatus(void)
return;
y = -32;
track = Cam_TrackNum(0);
track = Cam_TrackNum(pnum);
if (track == -1 || !cl.spectator)
track = cl.playernum[0];
track = cl.playernum[pnum];
for (p = 0; p < MAX_CLIENTS; p++)
{
if (cl.playernum[0] == p) //self is not shown
if (cl.playernum[pnum] == p) //self is not shown
continue;
if (track == p) //nor is the person you are tracking
continue;
@ -2346,6 +2346,9 @@ void Sbar_Draw (void)
qboolean headsup;
char st[512];
int pnum;
int sbarwidth;
qboolean minidmoverlay;
extern cvar_t scr_centersbar;
@ -2382,29 +2385,40 @@ void Sbar_Draw (void)
for (pnum = 0; pnum < cl.splitclients; pnum++)
{
minidmoverlay = cl.deathmatch;
if (cl.splitclients>1 || scr_chatmode)
{
SCR_VRectForPlayer(&sbar_rect, pnum);
}
else
{ //single player sbar takes full screen
extern cvar_t scr_centersbar;
sbar_rect.width = vid.width;
sbar_rect.height = vid.height;
sbar_rect.x = 0;
sbar_rect.y = 0;
if (scr_centersbar.ival || (scr_centersbar.ival == 2 && !cl.deathmatch))
{
sbar_rect.x = (vid.width - 320)/2;
sbar_rect.width -= sbar_rect.x;
}
}
sbarwidth = 320;
if (minidmoverlay && vid.width >= 640 && cl.teamplay)
sbarwidth += 320;
else if (minidmoverlay && vid.width >= 512)
sbarwidth += 192;
else
minidmoverlay = 0;
if (scr_centersbar.ival)
{
int ofs = (sbar_rect.width - sbarwidth)/2;
sbar_rect.x += ofs;
sbar_rect.width -= ofs;
}
sb_updates++;
if (sbar_hexen2)
{
//hexen2 hud
if (sb_lines > 24 || sb_hexen2_extra_info[pnum])
{
Sbar_Hexen2DrawExtra(pnum);
@ -2415,12 +2429,12 @@ void Sbar_Draw (void)
Sbar_Hexen2DrawInventory(pnum);
if (cl.deathmatch)
Sbar_MiniDeathmatchOverlay ();
Sbar_MiniDeathmatchOverlay (pnum);
continue;
}
if (sbarfailed) //files failed to load.
else if (sbarfailed) //files failed to load.
{
//fallback hud
if (cl.playerview[pnum].stats[STAT_HEALTH] <= 0) //when dead, show nothing
continue;
@ -2433,66 +2447,74 @@ void Sbar_Draw (void)
Sbar_Voice(-24);
continue;
}
sb_updates++;
// top line
if (sb_lines > 24)
else
{
if (!cl.spectator || autocam[pnum] == CAM_TRACK)
Sbar_DrawInventory (pnum);
if ((!headsup || sbar_rect.width<512) && cl.deathmatch)
Sbar_DrawFrags ();
}
// main area
if (sb_lines > 0)
{
if (cl.spectator)
//standard quake(world) hud.
// top line
if (sb_lines > 24)
{
if (autocam[pnum] != CAM_TRACK)
{
Sbar_DrawPic (0, 0, 320, 24, sb_scorebar);
Sbar_DrawString (160-7*8,4, "SPECTATOR MODE");
Sbar_DrawString(160-14*8+4, 12, "Press [ATTACK] for AutoCamera");
}
else
{
if (sb_showscores || sb_showteamscores || cl.playerview[pnum].stats[STAT_HEALTH] <= 0)
Sbar_SoloScoreboard ();
// else if (cls.gamemode != GAME_DEATHMATCH)
// Sbar_CoopScoreboard ();
else
Sbar_DrawNormal (pnum);
if (!cl.spectator || autocam[pnum] == CAM_TRACK)
Sbar_DrawInventory (pnum);
if ((!headsup || sbar_rect.width<512) && cl.deathmatch)
Sbar_DrawFrags ();
}
if (hud_tracking_show.ival)
// main area
if (sb_lines > 0)
{
if (cl.spectator)
{
if (autocam[pnum] != CAM_TRACK)
{
Q_snprintfz(st, sizeof(st), "Tracking %-.64s",
cl.players[spec_track[pnum]].name);
Sbar_DrawString(0, -8, st);
Sbar_DrawPic (0, 0, 320, 24, sb_scorebar);
Sbar_DrawString (160-7*8,4, "SPECTATOR MODE");
Sbar_DrawString(160-14*8+4, 12, "Press [ATTACK] for AutoCamera");
}
else
{
if (sb_showscores || sb_showteamscores || cl.playerview[pnum].stats[STAT_HEALTH] <= 0)
Sbar_SoloScoreboard ();
// else if (cls.gamemode != GAME_DEATHMATCH)
// Sbar_CoopScoreboard ();
else
Sbar_DrawNormal (pnum);
if (hud_tracking_show.ival)
{
Q_snprintfz(st, sizeof(st), "Tracking %-.64s",
cl.players[spec_track[pnum]].name);
Sbar_DrawString(0, -8, st);
}
}
}
}
else if (sb_showscores || sb_showteamscores || (cl.playerview[pnum].stats[STAT_HEALTH] <= 0 && cl.splitclients == 1))
{
if (!pnum)
else if (sb_showscores || sb_showteamscores || (cl.playerview[pnum].stats[STAT_HEALTH] <= 0 && cl.splitclients == 1))
{
if (cls.gamemode != GAME_DEATHMATCH)
Sbar_CoopScoreboard ();
else
Sbar_SoloScoreboard ();
if (!pnum)
{
if (cls.gamemode != GAME_DEATHMATCH)
Sbar_CoopScoreboard ();
else
Sbar_SoloScoreboard ();
}
}
else
Sbar_DrawNormal (pnum);
}
else
Sbar_DrawNormal (pnum);
}
if (sb_lines > 24)
Sbar_Voice(-32);
else if (sb_lines > 0)
Sbar_Voice(-8);
else
Sbar_Voice(16);
if (sb_lines > 24)
Sbar_Voice(-32);
else if (sb_lines > 0)
Sbar_Voice(-8);
else
Sbar_Voice(16);
if (minidmoverlay)
Sbar_MiniDeathmatchOverlay (pnum);
if (sb_lines > 0)
Sbar_DrawTeamStatus(pnum);
R2D_ImageColours (1, 1, 1, 1);
}
}
if (cl_sbar.value == 1 || scr_viewsize.value<100)
@ -2505,13 +2527,6 @@ void Sbar_Draw (void)
R2D_TileClear (sbar_rect.x + 320, sbar_rect.height - sb_lines, sbar_rect.width - (320), sb_lines);
}
if (sb_lines > 0)
Sbar_DrawTeamStatus();
if (sb_lines > 0 && cl.deathmatch)
Sbar_MiniDeathmatchOverlay ();
{
extern int scr_chatmode;
if (scr_chatmode)
@ -3115,7 +3130,7 @@ frags team name
displayed to right of status bar if there's room
==================
*/
void Sbar_MiniDeathmatchOverlay (void)
static void Sbar_MiniDeathmatchOverlay (int pnum)
{
int i, k;
int top, bottom;
@ -3126,9 +3141,6 @@ void Sbar_MiniDeathmatchOverlay (void)
char name[64+1];
team_t *tm;
if (sbar_rect.width < 512 || !sb_lines)
return; // not enuff room
// scores
Sbar_SortFrags (false, false);
if (sbar_rect.width >= 640)
@ -3138,14 +3150,14 @@ void Sbar_MiniDeathmatchOverlay (void)
return; // no one there?
// draw the text
y = sbar_rect.height - sb_lines - 1;
y = sbar_rect.y + sbar_rect.height - sb_lines - 1;
numlines = sb_lines/8;
if (numlines < 3)
return; // not enough room
// find us
for (i=0 ; i < scoreboardlines; i++)
if (fragsort[i] == cl.playernum[0])
if (fragsort[i] == cl.playernum[pnum])
break;
if (i == scoreboardlines) // we're not there, we are probably a spectator, just display top
@ -3158,9 +3170,9 @@ void Sbar_MiniDeathmatchOverlay (void)
if (i < 0)
i = 0;
x = 324;
x = sbar_rect.x + 320 + 4;
for (/* */ ; i < scoreboardlines && y < sbar_rect.height - 8 + 1; i++)
for (/* */ ; i < scoreboardlines && y < sbar_rect.y + sbar_rect.height - 8 + 1; i++)
{
k = fragsort[i];
s = &cl.players[k];
@ -3185,8 +3197,8 @@ void Sbar_MiniDeathmatchOverlay (void)
Font_BeginString(font_conchar, x+24, y, &px, &py);
Font_DrawChar ( px, py, num[2] | 0xe000 | CON_WHITEMASK);
if ((cl.spectator && k == spec_track[0]) ||
(!cl.spectator && k == cl.playernum[0]))
if ((cl.spectator && k == spec_track[pnum]) ||
(!cl.spectator && k == cl.playernum[pnum]))
{
Font_BeginString(font_conchar, x, y, &px, &py);
Font_DrawChar ( px, py, 16 | 0xe000 | CON_WHITEMASK);
@ -3230,7 +3242,7 @@ void Sbar_MiniDeathmatchOverlay (void)
sprintf (num, "%5i", tm->frags);
Draw_FunString(x + 40, y, num);
if (!strncmp(cl.players[cl.playernum[0]].team, tm->team, 16))
if (!strncmp(cl.players[cl.playernum[pnum]].team, tm->team, 16))
{
Font_BeginString(font_conchar, x-8, y, &px, &py);
Font_DrawChar(px, py, 16|0xe000|CON_WHITEMASK);

View file

@ -96,20 +96,19 @@ int SCR_GetLoadingStage(void);
void SCR_SetLoadingStage(int stage);
void SCR_SetLoadingFile(char *str);
/*fonts*/
void Font_Init(void);
void Font_Shutdown(void);
struct font_s *Font_LoadFont(int height, char *fontfilename);
void Font_Free(struct font_s *f);
void Font_BeginString(struct font_s *font, int vx, int vy, int *px, int *py);
void Font_BeginScaledString(struct font_s *font, float vx, float vy, float *px, float *py); /*avoid using*/
void Font_BeginScaledString(struct font_s *font, float vx, float vy, float szx, float szy, float *px, float *py); /*avoid using*/
void Font_Transform(int vx, int vy, int *px, int *py);
int Font_CharHeight(void);
int Font_CharWidth(unsigned int charcode);
int Font_CharEndCoord(struct font_s *font, int x, unsigned int charcode);
int Font_DrawChar(int px, int py, unsigned int charcode);
float Font_DrawScaleChar(float px, float py, float cw, float ch, unsigned int charcode); /*avoid using*/
float Font_DrawScaleChar(float px, float py, unsigned int charcode); /*avoid using*/
void Font_EndString(struct font_s *font);
void Font_ForceColour(float r, float g, float b, float a); //This colour will be applied while the char mask remains WHITE. If you print char by char, make sure to include the mask.
void Font_InvalidateColour(void);
@ -119,6 +118,7 @@ int Font_LineWidth(conchar_t *start, conchar_t *end);
void Font_LineDraw(int x, int y, conchar_t *start, conchar_t *end);
extern struct font_s *font_conchar;
extern struct font_s *font_tiny;
void PR_ResetFonts(qboolean purge); //for menu/csqc
/*end fonts*/
void R_NetgraphInit(void);

View file

@ -1548,6 +1548,9 @@ void S_StartSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float f
if (!sfx || !*sfx->name) //no named sounds would need specific starting.
return;
if (cls.demoseeking)
return;
S_LockMixer();
for (sc = sndcardinfo; sc; sc = sc->next)
S_StartSoundCard(sc, entnum, entchannel, sfx, origin, fvol, attenuation, -(int)(timeofs * sc->sn.speed), pitchadj);

View file

@ -689,10 +689,10 @@ NPError OSCALL NP_GetValue(void *instance, NPPVariable variable, void *value)
switch(variable)
{
case NPPVpluginNameString:
*(char**)value = "FTE QuakeWorld";
*(char**)value = FULLENGINENAME;
break;
case NPPVpluginDescriptionString:
*(char**)value = "FTE QuakeWorld";
*(char**)value = FULLENGINENAME;
break;
default:
return NPERR_INVALID_PARAM;

View file

@ -305,7 +305,7 @@ void *Sys_GetGameAPI (void *parms)
#endif
#define MINIMUM_WIN_MEMORY 0x0800000
#define MINIMUM_WIN_MEMORY MINIMUM_MEMORY
#define MAXIMUM_WIN_MEMORY 0x8000000
int starttime;
@ -1143,11 +1143,47 @@ double Sys_DoubleTime (void)
/////////////////////////////////////////////////////////////
//clipboard
HANDLE clipboardhandle;
char *cliputf8;
char *Sys_GetClipboard(void)
{
char *clipText;
unsigned short *clipWText;
if (OpenClipboard(NULL))
{
extern cvar_t com_parseutf8;
//windows programs interpret CF_TEXT as ansi (aka: gibberish)
//so grab utf-16 text and convert it to utf-8 if our console parsing is set to accept that.
if (com_parseutf8.ival > 0)
{
clipboardhandle = GetClipboardData(CF_UNICODETEXT);
if (clipboardhandle)
{
clipWText = GlobalLock(clipboardhandle);
if (clipWText)
{
unsigned int l, c;
for (l = 0; clipWText[l]; l++)
;
l = l*4 + 1;
clipText = cliputf8 = malloc(l);
while(*clipWText)
{
c = utf8_encode(clipText, *clipWText++, l);
if (!c)
break;
l -= c;
clipText += c;
}
*clipText = 0;
return cliputf8;
}
//failed at the last hurdle
GlobalUnlock(clipboardhandle);
}
}
clipboardhandle = GetClipboardData(CF_TEXT);
if (clipboardhandle)
{
@ -1170,6 +1206,8 @@ void Sys_CloseClipboard(char *bf)
{
if (clipboardhandle)
{
free(cliputf8);
cliputf8 = NULL;
GlobalUnlock(clipboardhandle);
CloseClipboard();
clipboardhandle = NULL;
@ -1179,6 +1217,8 @@ void Sys_SaveClipboard(char *text)
{
HANDLE glob;
char *temp;
unsigned short *tempw;
extern cvar_t com_parseutf8;
if (!OpenClipboard(NULL))
return;
EmptyClipboard();
@ -1190,15 +1230,40 @@ void Sys_SaveClipboard(char *text)
return;
}
temp = GlobalLock(glob);
if (temp != NULL)
if (com_parseutf8.ival > 0)
{
strcpy(temp, text);
GlobalUnlock(glob);
SetClipboardData(CF_TEXT, glob);
glob = GlobalAlloc(GMEM_MOVEABLE, (strlen(text) + 1)*2);
if (glob)
{
tempw = GlobalLock(glob);
if (tempw != NULL)
{
int error;
while(*text)
{
*tempw++ = utf8_decode(&error, text, &text);
}
*tempw = 0;
GlobalUnlock(glob);
SetClipboardData(CF_UNICODETEXT, glob);
}
else
GlobalFree(glob);
}
}
else
GlobalFree(glob);
{
//yes, quake chars will get mangled horribly.
temp = GlobalLock(glob);
if (temp != NULL)
{
strcpy(temp, text);
GlobalUnlock(glob);
SetClipboardData(CF_TEXT, glob);
}
else
GlobalFree(glob);
}
CloseClipboard();
}
@ -1236,8 +1301,16 @@ char *Sys_ConsoleInput (void)
if (numevents <= 0)
break;
if (!ReadConsoleInput(hinput, recs, 1, &numread))
Sys_Error ("Error reading console input");
if (WinNT)
{
if (!ReadConsoleInputW(hinput, recs, 1, &numread))
Sys_Error ("Error reading console input");
}
else
{
if (!ReadConsoleInputA(hinput, recs, 1, &numread))
Sys_Error ("Error reading console input");
}
if (numread != 1)
Sys_Error ("Couldn't read console input");
@ -1246,7 +1319,7 @@ char *Sys_ConsoleInput (void)
{
if (recs[0].Event.KeyEvent.bKeyDown)
{
ch = recs[0].Event.KeyEvent.uChar.AsciiChar;
ch = recs[0].Event.KeyEvent.uChar.UnicodeChar;
switch (ch)
{
@ -1300,9 +1373,9 @@ char *Sys_ConsoleInput (void)
}
} else if (ch >= ' ')
{
WriteFile(houtput, &ch, 1, &dummy, NULL);
text[len] = ch;
len = (len + 1) & 0xff;
i = utf8_encode(text+len, ch, sizeof(text)-1-len);
WriteFile(houtput, text+len, i, &dummy, NULL);
len += i;
}
break;
@ -1331,8 +1404,12 @@ BOOL WINAPI HandlerRoutine (DWORD dwCtrlType)
return false;
}
#ifndef CP_UTF8
#define CP_UTF8 65001
#endif
qboolean Sys_InitTerminal (void)
{
DWORD m;
if (!AllocConsole())
return false;
@ -1345,10 +1422,15 @@ qboolean Sys_InitTerminal (void)
#endif
SetConsoleCtrlHandler (HandlerRoutine, TRUE);
SetConsoleCP(CP_UTF8);
SetConsoleOutputCP(CP_UTF8);
SetConsoleTitle (FULLENGINENAME " dedicated server");
hinput = GetStdHandle (STD_INPUT_HANDLE);
houtput = GetStdHandle (STD_OUTPUT_HANDLE);
GetConsoleMode(hinput, &m);
SetConsoleMode(hinput, m | 0x40 | 0x80);
return true;
}
void Sys_CloseTerminal (void)
@ -1896,6 +1978,212 @@ void Win7_TaskListInit(void)
}
#endif
#if defined(SVNREVISION)
#if defined(OFFICIAL_RELEASE)
#define BUILDTYPE "dev"
#define UPDATE_URL "http://triptohell.info/moodles/"
#define UPDATE_URL_VERSION UPDATE_URL "version.txt"
#ifdef _WIN64
#define UPDATE_URL_BUILD UPDATE_URL "win64/fte" EXETYPE ".exe"
#else
#define UPDATE_URL_BUILD UPDATE_URL "win32/fte" EXETYPE ".exe"
#endif
#else
#define BUILDTYPE "rel"
#endif
#endif
#if defined(SERVERONLY)
#define EXETYPE "qwsv" //not gonna happen, but whatever.
#elif defined(GLQUAKE) && defined(D3DQUAKE)
#define EXETYPE "qw"
#elif defined(GLQUAKE)
#ifdef MINIMAL
#define EXETYPE "minglqw"
#else
#define EXETYPE "glqw"
#endif
#elif defiend(D3DQUAKE)
#define EXETYPE "d3dqw"
#elif defiend(SWQUAKE)
#define EXETYPE "swqw"
#else
//erm...
#define EXETYPE "qw"
#endif
#ifdef UPDATE_URL
void MyRegSetValue(HKEY base, char *keyname, char *valuename, int type, void *data, int datalen)
{
HKEY subkey;
RegOpenKeyEx(HKEY_CURRENT_USER,keyname, 0, KEY_WRITE, &subkey);
RegSetValueEx(subkey, valuename, 0, type, data, datalen);
RegCloseKey (subkey);
}
void MyRegDeleteKeyValue(HKEY base, char *keyname, char *valuename)
{
HKEY subkey;
RegOpenKeyEx(HKEY_CURRENT_USER,keyname, 0, KEY_WRITE, &subkey);
RegDeleteValue(subkey, valuename);
RegCloseKey (subkey);
}
qboolean Update_GetHomeDirectory(char *homedir, int homedirsize)
{
HMODULE shfolder = LoadLibrary("shfolder.dll");
DWORD winver = (DWORD)LOBYTE(LOWORD(GetVersion()));
if (shfolder)
{
HRESULT (WINAPI *dSHGetFolderPath) (HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPTSTR pszPath);
dSHGetFolderPath = (void *)GetProcAddress(shfolder, "SHGetFolderPathA");
if (dSHGetFolderPath)
{
char folder[MAX_PATH];
// 0x5 == CSIDL_PERSONAL
if (dSHGetFolderPath(NULL, 0x5, NULL, 0, folder) == S_OK)
{
Q_snprintfz(homedir, homedirsize, "%s/My Games/%s/", folder, FULLENGINENAME);
return true;
}
}
// FreeLibrary(shfolder);
}
return false;
}
#include "fs.h"
void Update_Version_Updated(struct dl_download *dl)
{
//happens in a thread, avoid va
if (dl->file)
{
if (dl->status == DL_FINISHED)
{
char buf[8192];
unsigned int size = 0, chunk;
char pendingname[MAX_OSPATH];
vfsfile_t *pending;
Update_GetHomeDirectory(pendingname, sizeof(pendingname));
Q_strncatz(pendingname, DISTRIBUTION BUILDTYPE EXETYPE".tmp", sizeof(pendingname));
pending = VFSOS_Open(pendingname, "wb");
if (pending)
{
while(1)
{
chunk = VFS_READ(dl->file, buf, sizeof(buf));
if (!chunk)
break;
size += VFS_WRITE(pending, buf, chunk);
}
VFS_CLOSE(pending);
if (VFS_GETLEN(dl->file) == size)
{
MyRegSetValue(HKEY_CURRENT_USER, "Software\\"FULLENGINENAME, "pending" BUILDTYPE EXETYPE, REG_SZ, pendingname, strlen(pendingname)+1);
}
}
}
}
}
void Update_Versioninfo_Available(struct dl_download *dl)
{
if (dl->file)
{
if (dl->status == DL_FINISHED)
{
char linebuf[1024];
while(VFS_GETS(dl->file, linebuf, sizeof(linebuf)))
{
if (!strnicmp(linebuf, "Revision: ", 10))
{
if (atoi(linebuf+10) > atoi(SVNREVISION))
{
struct dl_download *dl;
Con_Printf("Downloading update: revision %i\n", atoi(linebuf+10));
dl = HTTP_CL_Get(UPDATE_URL_BUILD, NULL, Update_Version_Updated);
dl->file = FS_OpenTemp();
#ifdef MULTITHREAD
DL_CreateThread(dl, NULL, NULL);
#endif
}
}
}
}
}
}
static qboolean doupdatecheck;
void Update_Check(void)
{
struct dl_download *dl;
if (doupdatecheck)
{
doupdatecheck = false;
dl = HTTP_CL_Get(UPDATE_URL_VERSION, NULL, Update_Versioninfo_Available);
dl->file = FS_OpenTemp();
#ifdef MULTITHREAD
DL_CreateThread(dl, NULL, NULL);
#endif
}
}
qboolean Sys_CheckUpdated(void)
{
if (!strcmp(SVNREVISION, "-"))
return false; //no revision info in this build, meaning its custom built and thus cannot check against the available updated versions.
else if (COM_CheckParm("-noupdate") || COM_CheckParm("--noupdate"))
return false;
else if (!COM_CheckParm("-autoupdate") && !COM_CheckParm("--autoupdate"))
return false;
else if (!COM_CheckParm("--fromfrontend"))
{
char pendingpath[MAX_OSPATH];
char updatedpath[MAX_QPATH];
DWORD bufsz;
PROCESS_INFORMATION childinfo;
STARTUPINFO startinfo;
char *cmdline = GetCommandLineA();
memset(&startinfo, 0, sizeof(startinfo));
startinfo.cb = sizeof(startinfo);
bufsz = sizeof(pendingpath);
*pendingpath = 0;
RegGetValue(HKEY_CURRENT_USER, "Software\\"FULLENGINENAME, "pending" BUILDTYPE EXETYPE, RRF_RT_REG_SZ, NULL, pendingpath, &bufsz);
if (*pendingpath)
{
MyRegDeleteKeyValue(HKEY_CURRENT_USER, "Software\\"FULLENGINENAME, "pending" BUILDTYPE EXETYPE);
Update_GetHomeDirectory(updatedpath, sizeof(updatedpath));
Q_strncatz(updatedpath, "cur" BUILDTYPE EXETYPE".exe", sizeof(updatedpath));
if (MoveFile(pendingpath, updatedpath))
MyRegSetValue(HKEY_CURRENT_USER, "Software\\"FULLENGINENAME, BUILDTYPE EXETYPE, REG_SZ, updatedpath, strlen(updatedpath)+1);
}
bufsz = sizeof(updatedpath);
*updatedpath = 0;
RegGetValue(HKEY_CURRENT_USER, "Software\\"FULLENGINENAME, BUILDTYPE EXETYPE, RRF_RT_REG_SZ, NULL, updatedpath, &bufsz);
if (*updatedpath)
{
if (CreateProcess(updatedpath, va("%s --fromfrontend", COM_Parse(cmdline)), NULL, NULL, TRUE, 0, NULL, NULL, &startinfo, &childinfo))
return true;
}
}
doupdatecheck = true;
return false;
}
#else
qboolean Sys_CheckUpdated(void)
{
return false;
}
void Update_Check(void)
{
}
#endif
/*
#ifdef _MSC_VER
#include <signal.h>
@ -2027,6 +2315,9 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
COM_InitArgv (parms.argc, parms.argv);
if (Sys_CheckUpdated())
return true;
isPlugin = !!COM_CheckParm("-plugin");
if (isPlugin)
{
@ -2036,7 +2327,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
if (COM_CheckParm("--version") || COM_CheckParm("-v"))
{
printf("version " DISTRIBUTION " " __TIME__ " " __DATE__ "\n");
printf("version: %s\n", version_string());
return true;
}
if (COM_CheckParm("-outputdebugstring"))
@ -2148,6 +2439,8 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
fflush(stdout);
}
Update_Check();
/* main window message loop */
while (1)
{

View file

@ -33,9 +33,7 @@ static cvar_t editaddcr = CVARD("edit_addcr", editaddcr_default, "make sure that
static cvar_t edittabspacing = CVARD("edit_tabsize", "4", "How wide tab alignment is");
cvar_t debugger = CVARD("debugger", debugger_default, "When enabled, QC errors and debug events will enable step-by-step tracing.");
#undef pr_trace
static progfuncs_t *editprogfuncs;
static pubprogfuncs_t *editprogfuncs;
typedef struct fileblock_s {
struct fileblock_s *next;
@ -64,13 +62,14 @@ static void E_Free(void *mem)
#define GETBLOCK(s, ret) ret = (void *)E_Malloc(sizeof(fileblock_t) + s);ret->allocatedlength = s;ret->data = (char *)ret + sizeof(fileblock_t)
void PR_GenerateStatementString (progfuncs_t *progfuncs, int statementnum, char *out, int outlen);
fileblock_t *GenAsm(int statement)
{
char linebuf[256];
fileblock_t *b;
int l;
PR_GenerateStatementString(editprogfuncs, statement, linebuf, sizeof(linebuf));
if (!editprogfuncs)
return NULL;
editprogfuncs->GenerateStatementString(editprogfuncs, statement, linebuf, sizeof(linebuf));
l = strlen(linebuf);
b = E_Malloc(sizeof(fileblock_t) + l);
b->allocatedlength = l;
@ -221,6 +220,12 @@ static qboolean EditorSaveFile(char *s) //returns true if succesful
int len=0;
int pos=0;
char *data;
char native[MAX_OSPATH];
if (!FS_NativePath(s, FS_GAMEONLY, native, sizeof(native)))
Con_Printf("Not saving.\n");
Con_Printf("Saving to \"%s\"\n", native);
for (b = firstblock; b; b = b->next) //find total length required.
{
@ -244,16 +249,7 @@ static qboolean EditorSaveFile(char *s) //returns true if succesful
}
COM_WriteFile(s, data, len);
/*
F = fopen(s, "wt");
if (!F)
return false;
for (b = firstblock; b; b = b->next)
{
fprintf(F, "%s\n", b->data);
}
fclose(F);
*/
madechanges = false;
editenabled = true;
executionlinenum = -1;
@ -447,7 +443,7 @@ void Editor_Key(int key, int unicode)
{
case K_ESCAPE:
if (editprogfuncs)
*editprogfuncs->pr_trace = 0;
editprogfuncs->pr_trace = 0;
useeval = false;
return;
case K_F3:
@ -552,11 +548,14 @@ void Editor_Key(int key, int unicode)
}
else
{
cursorlinenum++;
nb = GenAsm(cursorlinenum);
nb->prev = cursorblock;
cursorblock->next = nb;
cursorblock = nb;
nb = GenAsm(cursorlinenum+1);
if (nb)
{
cursorlinenum++;
nb->prev = cursorblock;
cursorblock->next = nb;
cursorblock = nb;
}
}
}
}
@ -565,7 +564,23 @@ void Editor_Key(int key, int unicode)
// case K_BACK:
case K_F1:
// Editor_f();
Con_Printf(
"Editor help:\n"
"F1: Show help\n"
"F2: Open file named on cursor line\n"
"F3: Toggle expression evaluator\n"
"F4: Save file\n"
"F5: Stop tracing (run)\n"
"F6: Print stack trace\n"
"F7: Save file and recompile\n"
"F8: Change current point of execution\n"
"F9: Set breakpoint\n"
"F10: Save file, recompile, reload vm\n"
"F11: Single step\n"
"F12: \n"
"Escape: Abort call, close editor\n"
);
Cbuf_AddText("toggleconsole\n", RESTRICT_LOCAL);
break;
// case K_FORWARD:
case K_F2:
@ -597,7 +612,7 @@ void Editor_Key(int key, int unicode)
case K_F5: /*stop debugging*/
editormodal = false;
if (editprogfuncs)
*editprogfuncs->pr_trace = false;
editprogfuncs->pr_trace = false;
break;
case K_F6:
if (editprogfuncs)
@ -605,8 +620,8 @@ void Editor_Key(int key, int unicode)
break;
case K_F7: /*save+recompile*/
EditorSaveFile(OpenEditorFile);
if (editprogfuncs)
Cbuf_AddText("compile\n", RESTRICT_LOCAL);
if (!editprogfuncs)
Cbuf_AddText("compile; toggleconsole\n", RESTRICT_LOCAL);
break;
case K_F8: /*move execution point to here - I hope you move to the same function!*/
executionlinenum = cursorlinenum;
@ -850,12 +865,11 @@ static void Draw_Line(int vy, fileblock_t *b, int cursorx)
{
int nx = 0;
int y;
char *tooltip = NULL;
char *tooltip = NULL, *t;
int nnx;
qbyte *d = b->data;
qbyte *c;
int i;
extern int mousecursor_x, mousecursor_y;
int smx = (mousecursor_x * vid.pixelwidth) / vid.width, smy = (mousecursor_y * vid.pixelheight) / vid.height;
unsigned int colour;
@ -999,16 +1013,28 @@ static void Draw_Line(int vy, fileblock_t *b, int cursorx)
if (tooltip)
{
nx = ((mousecursor_x+16) * vid.pixelwidth) / vid.width;
while(*tooltip)
{
if (*tooltip == '\n')
for (t = tooltip, smx = nx; *tooltip; tooltip++)
{
smy += Font_CharHeight();
smx = (mousecursor_x * vid.pixelwidth) / vid.width;
tooltip++;
if (*tooltip == '\n')
break;
smx = Font_CharEndCoord(font_conchar, smx, *tooltip);
}
else
smx = Font_DrawChar(smx, smy, (COLOR_CYAN<<CON_FGSHIFT) | (COLOR_BLACK<<CON_BGSHIFT) | CON_NONCLEARBG | *tooltip++);
y = Font_CharHeight();
Font_EndString(font_conchar);
R2D_ImageColours(0, 0, 0, 1);
R2D_FillBlock(((nx)*vid.width) / vid.pixelwidth, ((smy)*vid.height) / vid.pixelheight, ((smx - nx)*vid.width) / vid.pixelwidth, (y*vid.height) / vid.pixelheight);
R2D_ImageColours(1, 1, 1, 1);
Font_BeginString(font_conchar, nx, vy, &y, &y);
for(smx = nx; t < tooltip; t++)
{
smx = Font_DrawChar(smx, smy, (COLOR_CYAN<<CON_FGSHIFT) | *t);
}
if (*tooltip == '\n')
tooltip++;
smy += Font_CharHeight();
}
}
Font_EndString(font_conchar);
@ -1145,7 +1171,7 @@ void Editor_Draw(void)
*/
}
int QCLibEditor(progfuncs_t *prfncs, char *filename, int line, int statement, int nump, char **parms)
int QCLibEditor(pubprogfuncs_t *prfncs, char *filename, int line, int statement, int nump, char **parms)
{
char *f1, *f2;
if (editormodal || (line < 0 && !statement) || !debugger.ival)
@ -1264,7 +1290,7 @@ int QCLibEditor(progfuncs_t *prfncs, char *filename, int line, int statement, in
return executionlinenum;
}
void Editor_ProgsKilled(progfuncs_t *dead)
void Editor_ProgsKilled(pubprogfuncs_t *dead)
{
if (editprogfuncs == dead)
{
@ -1275,9 +1301,10 @@ void Editor_ProgsKilled(progfuncs_t *dead)
static void Editor_f(void)
{
if (Cmd_Argc() != 2)
int argc = Cmd_Argc();
if (argc != 2 && argc != 3)
{
Con_Printf("edit <filename>\n");
Con_Printf("edit <filename> [line]\n");
return;
}
@ -1288,6 +1315,13 @@ static void Editor_f(void)
EditorSaveFile(OpenEditorFile);
EditorOpenFile(Cmd_Argv(1), false);
// EditorNewFile();
if (argc == 3)
{
int line = atoi(Cmd_Argv(2));
for (cursorlinenum = 1, cursorblock = firstblock; cursorlinenum < line && cursorblock->next; cursorlinenum++)
cursorblock=cursorblock->next;
}
}
void Editor_Init(void)

View file

@ -1316,6 +1316,7 @@ void R2D_PolyBlend (void);
void V_RenderPlayerViews(int plnum)
{
int oldnuments;
int oldstris;
#ifdef SIDEVIEWS
int viewnum;
#endif
@ -1335,6 +1336,7 @@ void V_RenderPlayerViews(int plnum)
}
oldnuments = cl_numvisedicts;
oldstris = cl_numstris;
CL_LinkViewModel ();
Cam_SelfTrack(plnum);
@ -1343,6 +1345,7 @@ void V_RenderPlayerViews(int plnum)
R_DrawNameTags();
cl_numvisedicts = oldnuments;
cl_numstris = oldstris;
if (scr_chatmode == 2)
{

View file

@ -32,7 +32,9 @@ void V_RenderView (void);
float V_CalcRoll (vec3_t angles, vec3_t velocity);
void V_UpdatePalette (qboolean force);
void V_ClearCShifts (void);
void V_ClearEntity(entity_t *e);
entity_t *V_AddEntity(entity_t *in);
void VQ2_AddLerpEntity(entity_t *in);
void V_AddAxisEntity(entity_t *in);
void CLQ1_AddShadow(entity_t *ent);
int V_AddLight (int entsource, vec3_t org, float quant, float r, float g, float b);

View file

@ -59,8 +59,8 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS
EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
FONT 16, "Times New Roman", 0, 0, 0x1
BEGIN
CTEXT "FTE QuakeWorld",IDC_STATIC,0,0,67,21,SS_CENTERIMAGE
CTEXT "http://www.fteqw.com",IDC_STATIC,0,23,66,17,SS_CENTERIMAGE
CTEXT FULLENGINENAME,IDC_STATIC,0,0,67,21,SS_CENTERIMAGE
CTEXT ENGINEWEBSITE,IDC_STATIC,0,23,66,17,SS_CENTERIMAGE
END

View file

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// release version
#define FTE_VER_MAJOR 1
#define FTE_VER_MINOR 1
#define FTE_VER_MINOR 2
//#define VERSION 2.56
#ifndef DISTRIBUTION
@ -191,6 +191,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PSKMODELS //PSK model format (ActorX stuff from UT, though not the format the game itself uses)
#define HALFLIFEMODELS //halflife model support (experimental)
#define INTERQUAKEMODELS
#define RAGDOLL
#define HUFFNETWORK //huffman network compression
#define DOOMWADS //doom wad/sprite support
@ -331,6 +332,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef SQL
#endif
#if defined(CSQC_DAT) || !defined(CLIENTONLY) //use ode only if we have a constant world state, and the library is enbled in some form.
#define USEODE 1
#if !(defined(ODE_STATIC) || defined(ODE_DYNAMIC))
#undef USEODE
#endif
#endif
#if defined(ZYMOTICMODELS) || defined(MD5MODELS) || defined(DPMMODELS) || defined(PSKMODELS) || defined(INTERQUAKEMODELS)
#define SKELETALMODELS //defined if we have a skeletal model.
#endif
#if (defined(CSQC_DAT) || !defined(CLIENTONLY)) && defined(SKELETALMODELS)
#define SKELETALOBJECTS //the skeletal objects API is only used if we actually have skeletal models, and gamecode that uses the builtins.
#endif
#if !defined(USEODE) || !defined(SKELETALMODELS)
#undef RAGDOLL //not possible to ragdoll if we don't have certain other features.
#endif
//remove any options that depend upon GL.
#ifndef SERVERONLY
// undefine things not supported yet for D3D
@ -495,7 +514,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// per-level limits
//
#define MAX_EDICTS 32767 // FIXME: ouch! ouch! ouch!
//#define MAX_EDICTS ((1<<22)-1) // expandable up to 22 bits
#define MAX_EDICTS ((1<<18)-1) // expandable up to 22 bits
#define MAX_LIGHTSTYLES 255
#define MAX_STANDARDLIGHTSTYLES 64
#define MAX_MODELS 1024 // these are sent over the net as bytes
@ -508,6 +528,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MAX_STYLESTRING 64
#define MAX_Q2EDICTS 1024
//
// stats are integers communicated to the client by the server
//

View file

@ -498,7 +498,7 @@ Cmd_Exec_f
*/
void Cmd_Exec_f (void)
{
char *f;
char *f, *s;
char name[256];
if (Cmd_Argc () != 2)
@ -531,8 +531,14 @@ void Cmd_Exec_f (void)
if (cl_warncmd.ival || developer.ival)
Con_TPrintf (TL_EXECING,name);
s = f;
if (s[0] == '\xef' && s[1] == '\xbb' && s[2] == '\xbf')
{
Con_DPrintf("Ignoring UTF-8 BOM\n");
s+=3;
}
// don't execute anything as if it was from server
Cbuf_InsertText (f, Cmd_FromGamecode() ? RESTRICT_INSECURE : Cmd_ExecLevel, true);
Cbuf_InsertText (s, Cmd_FromGamecode() ? RESTRICT_INSECURE : Cmd_ExecLevel, true);
FS_FreeFile(f);
}
@ -638,7 +644,7 @@ void Cmd_Alias_f (void)
{
if (Cvar_FindVar (s))
{
if (Cmd_FromGamecode())
if (Cmd_IsInsecure())
{
snprintf(cmd, sizeof(cmd), "%s_a", s);
Con_Printf ("Can't register alias, %s is a cvar\nAlias has been named %s instead\n", s, cmd);
@ -654,7 +660,7 @@ void Cmd_Alias_f (void)
// check for overlap with a command
if (Cmd_Exists (s))
{
if (Cmd_FromGamecode())
if (Cmd_IsInsecure())
{
snprintf(cmd, sizeof(cmd), "%s_a", s);
Con_Printf ("Can't register alias, %s is a command\nAlias has been named %s instead\n", s, cmd);
@ -1117,9 +1123,6 @@ char *Cmd_ExpandCvar(char *cvarname, int maxaccesslevel, int *len)
result = strtol(cvarname, &end, 10); // do something with result
if (result == 0)
Con_DPrintf("Cmd_ExpandCvar() strtol returned zero cvar: %s\n", cvarname);
if (fixval && *end == '\0') //only expand $0 if its actually ${0} - this avoids conflicting with the $0 macro
{ //purely numerical
ret = Cmd_Argv(atoi(cvarname));
@ -1288,6 +1291,11 @@ char *Cmd_ExpandStringArguments (char *data, char *dest, int destlen)
str = "%";
old_len = 2;
}
else if (data[1] == '#')
{
str = va("\"%s\"", Cmd_Args());
old_len = 2;
}
else if (data[1] == '*')
{
str = Cmd_Args();
@ -1817,7 +1825,8 @@ void Cmd_ForwardToServer (void)
{
if (cls.state == ca_disconnected)
{
Con_TPrintf (TL_CANTXNOTCONNECTED, Cmd_Argv(0));
if (cl_warncmd.ival)
Con_TPrintf (TL_CANTXNOTCONNECTED, Cmd_Argv(0));
return;
}
@ -2618,16 +2627,29 @@ void Cmd_set_f(void)
Q_strncpyz(name, Cmd_Argv(1), sizeof(name));
if (Cmd_FromGamecode()) //AAHHHH!!! Q2 set command is different
if (!strcmp(Cmd_Argv(0), "setfl") || Cmd_FromGamecode()) //AAHHHH!!! Q2 set command is different
{
text = Cmd_Argv(3);
if (!strcmp(text, "u"))
forceflags = CVAR_USERINFO;
else if (!strcmp(text, "s"))
forceflags = CVAR_SERVERINFO;
else if (*text) //err
return;
while(*text)
{
switch(*text++)
{
case 'u':
forceflags |= CVAR_USERINFO;
break;
case 's':
forceflags |= CVAR_SERVERINFO;
break;
case 'a':
forceflags |= CVAR_ARCHIVE;
break;
default:
return;
}
}
text = Cmd_Argv(2);
/*desc = Cmd_Argv(4)*/
}
else if (dpcompat_set.ival && !docalc)
{
@ -2667,7 +2689,7 @@ void Cmd_set_f(void)
if (var)
{
if (var->flags & CVAR_NOTFROMSERVER && Cmd_FromGamecode())
if (var->flags & CVAR_NOTFROMSERVER && Cmd_IsInsecure())
{
Con_Printf ("Server tried setting %s cvar\n", var->name);
return;
@ -2687,7 +2709,7 @@ void Cmd_set_f(void)
if (docalc)
text = If_Token(text, &end);
Cvar_Set(var, text);
var->flags |= CVAR_USERCREATED;
var->flags |= CVAR_USERCREATED | forceflags;
if (!stricmp(Cmd_Argv(0), "seta"))
var->flags |= CVAR_ARCHIVE;
@ -2733,7 +2755,7 @@ void Cvar_Inc_f (void)
Con_Printf ("Unknown variable \"%s\"\n", Cmd_Argv(1));
return;
}
if (var->flags & CVAR_NOTFROMSERVER && Cmd_FromGamecode())
if (var->flags & CVAR_NOTFROMSERVER && Cmd_IsInsecure())
{
Con_Printf ("Server tried setting %s cvar\n", var->name);
return;
@ -2985,6 +3007,7 @@ void Cmd_Init (void)
Cmd_AddCommand ("toggle", Cmd_toggle_f);
Cmd_AddCommand ("set", Cmd_set_f);
Cmd_AddCommand ("setfl", Cmd_set_f);
Cmd_AddCommand ("set_calc", Cmd_set_f);
Cmd_AddCommand ("seta", Cmd_set_f);
Cmd_AddCommand ("seta_calc", Cmd_set_f);

View file

@ -1924,6 +1924,48 @@ void Mod_CompileTriangleNeighbours(galiasinfo_t *galias)
#endif
}
typedef struct
{
int firstpose;
int posecount;
float fps;
qboolean loop;
char name[MAX_QPATH];
} frameinfo_t;
static frameinfo_t *ParseFrameInfo(char *modelname, int *numgroups)
{
int count = 0;
int maxcount = 0;
char *line, *file;
frameinfo_t *frames = NULL;
line = file = FS_LoadMallocFile(va("%s.framegroups", modelname));
if (!file)
return NULL;
while(line && *line)
{
line = Cmd_TokenizeString(line, false, false);
if (Cmd_Argc())
{
if (count == maxcount)
{
maxcount += 32;
frames = realloc(frames, sizeof(*frames)*maxcount);
}
frames[count].firstpose = atoi(Cmd_Argv(0));
frames[count].posecount = atoi(Cmd_Argv(1));
frames[count].fps = atof(Cmd_Argv(2));
frames[count].loop = !!atoi(Cmd_Argv(3));
Q_strncpyz(frames[count].name, Cmd_Argv(4), sizeof(frames[count].name));
count++;
}
}
BZ_Free(file);
*numgroups = count;
return frames;
}
void Mod_BuildTextureVectors(galiasinfo_t *galias)
//vec3_t *vc, vec2_t *tc, vec3_t *nv, vec3_t *sv, vec3_t *tv, index_t *idx, int numidx, int numverts)
{
@ -2455,6 +2497,7 @@ static void *Q1_LoadSkins_SV (daliasskintype_t *pskintype, qboolean alpha)
static void *Q1_LoadSkins_GL (daliasskintype_t *pskintype, unsigned int skintranstype)
{
shader_t **shaders;
int *ofstexels;
char skinname[MAX_QPATH];
int i;
int s, t;
@ -2515,9 +2558,11 @@ static void *Q1_LoadSkins_GL (daliasskintype_t *pskintype, unsigned int skintran
if (!TEXVALID(texture) || (loadmodel->engineflags & MDLF_NOTREPLACEMENTS))
{
//we're not using 24bits
shaders = Hunk_Alloc(sizeof(*shaders)+s);
saved = (qbyte*)(shaders+1);
outskin->ofstexels = (qbyte *)(saved) - (qbyte *)outskin;
shaders = Hunk_Alloc(sizeof(*shaders)+sizeof(*ofstexels)+s);
ofstexels = (int*)(shaders+1);
saved = (qbyte*)(ofstexels+1);
outskin->ofstexels = (qbyte *)ofstexels - (qbyte *)outskin;
ofstexels[0] = (qbyte *)saved - (qbyte *)ofstexels;
memcpy(saved, pskintype+1, s);
Mod_FloodFillSkin(saved, outskin->skinwidth, outskin->skinheight);
@ -2621,9 +2666,10 @@ static void *Q1_LoadSkins_GL (daliasskintype_t *pskintype, unsigned int skintran
intervals = (daliasskininterval_t *)(count+1);
outskin->numshaders = LittleLong(count->numskins);
data = (qbyte *)(intervals + outskin->numshaders);
shaders = Hunk_Alloc(sizeof(*shaders)*outskin->numshaders);
shaders = Hunk_Alloc(sizeof(*shaders)*outskin->numshaders + sizeof(*ofstexels)*outskin->numshaders);
ofstexels = (int*)(shaders+outskin->numshaders);
outskin->ofsshaders = (char *)shaders - (char *)outskin;
outskin->ofstexels = 0;
outskin->ofstexels = (char *)ofstexels - (char *)outskin;
sinter = LittleFloat(intervals[0].interval);
if (sinter <= 0)
sinter = 0.1;
@ -2660,13 +2706,8 @@ static void *Q1_LoadSkins_GL (daliasskintype_t *pskintype, unsigned int skintran
if (!TEXVALID(texture) || (!TEXVALID(fbtexture) && r_fb_models.ival))
{
if (t == 0)
{
saved = Hunk_Alloc(s);
outskin->ofstexels = (qbyte *)(saved) - (qbyte *)outskin;
}
else
saved = BZ_Malloc(s);
saved = Hunk_Alloc(s);
ofstexels[t] = (qbyte *)(saved) - (qbyte *)ofstexels;
memcpy(saved, data, s);
Mod_FloodFillSkin(saved, outskin->skinwidth, outskin->skinheight);
if (!TEXVALID(texture))
@ -2681,9 +2722,6 @@ static void *Q1_LoadSkins_GL (daliasskintype_t *pskintype, unsigned int skintran
Q_snprintfz(skinname, sizeof(skinname), "%s_%i_%i_luma", loadname, i, t);
fbtexture = R_LoadTextureFB(skinname, outskin->skinwidth, outskin->skinheight, saved, IF_NOGAMMA);
}
if (t != 0) //only keep the first.
BZ_Free(saved);
}
Q_snprintfz(skinname, sizeof(skinname), "%s_%i_%i", loadname, i, t);
@ -2810,7 +2848,7 @@ qboolean Mod_LoadQ1Model (model_t *mod, void *buffer)
switch(qrenderer)
{
default:
#if defined(GLQUAKE) || defined(D3DQUAKE)
#ifndef SERVERONLY
pinstverts = (dstvert_t *)Q1_LoadSkins_GL(skinstart, skintranstype);
break;
#endif
@ -4631,10 +4669,11 @@ qboolean Mod_LoadPSKModel(model_t *mod, void *buffer)
#endif
galiasbone_t *bones;
galiasgroup_t *group;
float *animmatrix, *basematrix, *basematrix_inverse;
float *animmatrix, *basematrix;
index_t *indexes;
float vrad;
int bonemap[MAX_BONES];
char *e;
pskpnts_t *pnts = NULL;
pskvtxw_t *vtxw = NULL;
@ -4904,6 +4943,9 @@ qboolean Mod_LoadPSKModel(model_t *mod, void *buffer)
for (i = 0; i < num_boneinfo; i++)
{
Q_strncpyz(bones[i].name, boneinfo[i].name, sizeof(bones[i].name));
e = bones[i].name + strlen(bones[i].name);
while(e > bones[i].name && e[-1] == ' ')
*--e = 0;
bones[i].parent = boneinfo[i].parent;
if (i == 0 && bones[i].parent == 0)
bones[i].parent = -1;
@ -4928,10 +4970,9 @@ qboolean Mod_LoadPSKModel(model_t *mod, void *buffer)
R_ConcatTransforms((void*)(basematrix + bones[i].parent*12), (void*)tmp, (void*)(basematrix+i*12));
}
basematrix_inverse = Hunk_TempAllocMore(num_boneinfo*sizeof(float)*16);
for (i = 0; i < num_boneinfo; i++)
{
Matrix3x4_InvertTo4x4_Simple(basematrix+i*12, basematrix_inverse+i*16);
Matrix3x4_Invert_Simple(basematrix+i*12, bones[i].inverse);
}
@ -4960,7 +5001,7 @@ qboolean Mod_LoadPSKModel(model_t *mod, void *buffer)
vec3_t tmp;
trans[num_trans].vertexindex = i;
trans[num_trans].boneindex = rawweights[j].boneindex;
VectorTransform(pnts[rawweights[j].pntsindex].origin, (void*)(basematrix_inverse + rawweights[j].boneindex*16), tmp);
VectorTransform(pnts[rawweights[j].pntsindex].origin, (void*)bones[rawweights[j].boneindex].inverse, tmp);
VectorScale(tmp, rawweights[j].weight, trans[num_trans].org);
trans[num_trans].org[3] = rawweights[j].weight;
num_trans++;
@ -5028,7 +5069,29 @@ qboolean Mod_LoadPSKModel(model_t *mod, void *buffer)
if (animinfo && animkeys)
{
if (dpcompat_psa_ungroup.ival)
int numgroups = 0;
frameinfo_t *frameinfo = ParseFrameInfo(mod->name, &numgroups);
if (numgroups)
{
/*externally supplied listing of frames. ignore all framegroups in the model and use only the pose info*/
group = Hunk_Alloc(sizeof(galiasgroup_t)*numgroups + num_animkeys*sizeof(float)*12);
animmatrix = (float*)(group+numgroups);
for (j = 0; j < numgroups; j++)
{
//FIXME: bound check
group[j].poseofs = ((char*)animmatrix - (char*)&group[j]) + sizeof(float)*12*num_boneinfo*frameinfo[j].firstpose;
group[j].numposes = frameinfo[j].posecount;
if (*frameinfo[j].name)
snprintf(group[j].name, sizeof(group[j].name), "%s", frameinfo[j].name);
else
snprintf(group[j].name, sizeof(group[j].name), "frame_%i", j);
group[j].loop = frameinfo[j].loop;
group[j].rate = frameinfo[j].fps;
group[j].isheirachical = true;
}
num_animinfo = numgroups;
}
else if (dpcompat_psa_ungroup.ival)
{
/*unpack each frame of each animation to be a separate framegroup*/
unsigned int iframe; /*individual frame count*/
@ -5552,8 +5615,6 @@ qboolean Mod_LoadDarkPlacesModel(model_t *mod, void *buffer)
#endif //DPMMODELS
#ifdef INTERQUAKEMODELS
#define IQM_MAGIC "INTERQUAKEMODEL"
#define IQM_VERSION1 1
@ -5721,7 +5782,7 @@ galiasinfo_t *Mod_ParseIQMMeshModel(model_t *mod, char *buffer)
vec3_t *onorm1, *onorm2, *onorm3;
vec4_t *oweight;
byte_vec4_t *oindex;
float *opose;
float *opose,*oposebase;
vec2_t *otcoords;
@ -5734,8 +5795,9 @@ galiasinfo_t *Mod_ParseIQMMeshModel(model_t *mod, char *buffer)
galiasbone_t *bones;
index_t *idx;
float basepose[12 * MAX_BONES];
qboolean baseposeonly;
qboolean noweights;
frameinfo_t *framegroups;
int numgroups;
if (memcmp(h->magic, IQM_MAGIC, sizeof(h->magic)))
{
@ -5779,6 +5841,10 @@ galiasinfo_t *Mod_ParseIQMMeshModel(model_t *mod, char *buffer)
if (!h->num_meshes)
return NULL;
//a mesh must contain vertex coords or its not much of a mesh.
//we also require texcoords because we can.
//we don't require normals
//we don't require weights, but such models won't animate.
if (h->num_vertexes > 0 && (!vpos || !tcoord))
{
Con_Printf("%s is missing vertex array data\n", loadmodel->name);
@ -5791,10 +5857,40 @@ galiasinfo_t *Mod_ParseIQMMeshModel(model_t *mod, char *buffer)
return NULL;
}
baseposeonly = !h->num_anims;
strings = buffer + h->ofs_text;
/*try to completely disregard all the info the creator carefully added to their model...*/
numgroups = 0;
framegroups = NULL;
if (!numgroups)
framegroups = ParseFrameInfo(loadmodel->name, &numgroups);
if (!numgroups && h->num_anims)
{
/*use the model's framegroups*/
numgroups = h->num_anims;
framegroups = malloc(sizeof(*framegroups)*numgroups);
anim = (struct iqmanim*)(buffer + h->ofs_anims);
for (i = 0; i < numgroups; i++)
{
framegroups[i].firstpose = LittleLong(anim[i].first_frame);
framegroups[i].posecount = LittleLong(anim[i].num_frames);
framegroups[i].fps = LittleFloat(anim[i].framerate);
framegroups[i].loop = !!(LittleLong(anim[i].flags) & IQM_LOOP);
Q_strncpyz(framegroups[i].name, strings+anim[i].name, sizeof(fgroup[i].name));
}
}
if (!numgroups)
{ /*base frame only*/
numgroups = 1;
framegroups = malloc(sizeof(*framegroups));
framegroups->firstpose = -1;
framegroups->posecount = 1;
framegroups->fps = 10;
framegroups->loop = 1;
strcpy(framegroups->name, "base");
}
mesh = (struct iqmmesh*)(buffer + h->ofs_meshes);
/*allocate a nice big block of memory and figure out where stuff is*/
@ -5802,7 +5898,7 @@ galiasinfo_t *Mod_ParseIQMMeshModel(model_t *mod, char *buffer)
#ifndef SERVERONLY
sizeof(*skin)*h->num_meshes + sizeof(*shaders)*h->num_meshes +
#endif
sizeof(*fgroup)*(baseposeonly?1:h->num_anims) + sizeof(float)*12*(baseposeonly?h->num_joints:(h->num_poses*h->num_frames)) + sizeof(*bones)*h->num_joints +
sizeof(*fgroup)*numgroups + sizeof(float)*12*(h->num_joints + (h->num_poses*h->num_frames)) + sizeof(*bones)*h->num_joints +
(sizeof(*opos) + sizeof(*onorm1) + sizeof(*onorm2) + sizeof(*onorm3) + sizeof(*otcoords) + (noweights?0:(sizeof(*oindex)+sizeof(*oweight)))) * h->num_vertexes);
bones = (galiasbone_t*)(gai + h->num_meshes);
opos = (vecV_t*)(bones + h->num_joints);
@ -5822,9 +5918,10 @@ galiasinfo_t *Mod_ParseIQMMeshModel(model_t *mod, char *buffer)
otcoords = (vec2_t*)(oweight + h->num_vertexes);
}
fgroup = (galiasgroup_t*)(otcoords + h->num_vertexes);
opose = (float*)(fgroup + (baseposeonly?1:h->num_anims));
oposebase = (float*)(fgroup + numgroups);
opose = oposebase + 12*h->num_joints;
#ifndef SERVERONLY
skin = (galiasskin_t*)(opose + 12*(baseposeonly?h->num_joints:h->num_poses*h->num_frames));
skin = (galiasskin_t*)(opose + 12*(h->num_poses*h->num_frames));
shaders = (shader_t**)(skin + h->num_meshes);
#endif
@ -5841,6 +5938,7 @@ galiasinfo_t *Mod_ParseIQMMeshModel(model_t *mod, char *buffer)
vec3_t scale;
float mat[12];
//joint info (mesh)
for (i = 0; i < h->num_joints; i++)
{
Q_strncpyz(bones[i].name, strings+ijoint[i].name, sizeof(bones[i].name));
@ -5855,6 +5953,7 @@ galiasinfo_t *Mod_ParseIQMMeshModel(model_t *mod, char *buffer)
Matrix3x4_Invert_Simple(&basepose[i*12], bones[i].inverse);
}
//pose info (anim)
for (i = 0; i < h->num_frames; i++)
{
for (j = 0, p = ipose; j < h->num_poses; j++, p++)
@ -5884,6 +5983,7 @@ galiasinfo_t *Mod_ParseIQMMeshModel(model_t *mod, char *buffer)
vec3_t scale;
float mat[12];
//joint info (mesh)
for (i = 0; i < h->num_joints; i++)
{
Q_strncpyz(bones[i].name, strings+ijoint[i].name, sizeof(bones[i].name));
@ -5898,6 +5998,7 @@ galiasinfo_t *Mod_ParseIQMMeshModel(model_t *mod, char *buffer)
Matrix3x4_Invert_Simple(&basepose[i*12], bones[i].inverse);
}
//pose info (anim)
for (i = 0; i < h->num_frames; i++)
{
for (j = 0, p = ipose; j < h->num_poses; j++, p++)
@ -5917,34 +6018,33 @@ galiasinfo_t *Mod_ParseIQMMeshModel(model_t *mod, char *buffer)
}
}
}
//basepose
memcpy(oposebase, basepose, sizeof(float)*12 * h->num_joints);
if (baseposeonly)
//now generate the animations.
for (i = 0; i < numgroups; i++)
{
fgroup->isheirachical = false;
fgroup->loop = true;
Q_strncpyz(fgroup->name, "base", sizeof(fgroup->name));
fgroup->numposes = 1;
fgroup->poseofs = (char*)opose - (char*)fgroup;
fgroup->rate = 10;
memcpy(opose, basepose, sizeof(float)*12 * h->num_joints);
}
else
{
/*load the framegroup info*/
anim = (struct iqmanim*)(buffer + h->ofs_anims);
for (i = 0; i < h->num_anims; i++)
if ((unsigned)framegroups[i].firstpose >= h->num_frames)
{
//invalid/basepose
fgroup[i].isheirachical = false;
fgroup[i].poseofs = (char*)oposebase - (char*)&fgroup[i];
fgroup[i].numposes = 1;
}
else
{
fgroup[i].isheirachical = true;
fgroup[i].loop = !!(LittleLong(anim[i].flags) & IQM_LOOP);
Q_strncpyz(fgroup[i].name, strings+anim[i].name, sizeof(fgroup[i].name));
fgroup[i].numposes = LittleLong(anim[i].num_frames);
fgroup[i].poseofs = (char*)(opose+LittleLong(anim[i].first_frame)*12*h->num_poses) - (char*)&fgroup[i];
fgroup[i].rate = LittleFloat(anim[i].framerate);
if (!fgroup[i].rate)
fgroup[i].rate = 10;
fgroup[i].poseofs = (char*)(opose + framegroups[i].firstpose*12*h->num_poses) - (char*)&fgroup[i];
fgroup[i].numposes = framegroups[i].posecount;
}
fgroup[i].loop = framegroups[i].loop;
fgroup[i].rate = framegroups[i].fps;
Q_strncpyz(fgroup[i].name, framegroups[i].name, sizeof(fgroup[i].name));
if (fgroup[i].rate <= 0)
fgroup[i].rate = 10;
}
free(framegroups);
for (i = 0; i < h->num_meshes; i++)
{
@ -5954,7 +6054,7 @@ galiasinfo_t *Mod_ParseIQMMeshModel(model_t *mod, char *buffer)
gai[i].shares_bones = 0;
gai[i].numbones = h->num_joints;
gai[i].ofsbones = (char*)bones - (char*)&gai[i];
gai[i].groups = baseposeonly?1:h->num_anims;
gai[i].groups = numgroups;
gai[i].groupofs = (char*)fgroup - (char*)&gai[i];
offset = LittleLong(mesh[i].first_vertex);
@ -6006,6 +6106,10 @@ galiasinfo_t *Mod_ParseIQMMeshModel(model_t *mod, char *buffer)
{
Vector4Copy(vbone+i*4, oindex[i]);
Vector4Scale(vweight+i*4, 1/255.0, oweight[i]);
//FIXME: should we be normalising?
if (!oweight[i][0] && !oweight[i][1] && !oweight[i][2] && !oweight[i][3])
oweight[i][0] = 1;
}
}
for (i = 0; i < h->num_vertexes; i++)
@ -6698,7 +6802,7 @@ qboolean Mod_LoadMD5MeshModel(model_t *mod, void *buffer)
/*
EXTERNALANIM
//File what specifies md5 model/anim stuff.
//File that specifies md5 model/anim stuff.
model test/imp.md5mesh

View file

@ -2,8 +2,7 @@
#include "hash.h"
#include "shader.h"
#if defined(ZYMOTICMODELS) || defined(MD5MODELS)
#define SKELETALMODELS
#ifdef SKELETALMODELS
#include <stdlib.h>
#endif

View file

@ -270,7 +270,7 @@ void (ODE_API *dMassSetSphereTotal)(dMass *, dReal total_mass, dReal
//void (ODE_API *dMassSetCapsule)(dMass *, dReal density, int direction, dReal radius, dReal length);
void (ODE_API *dMassSetCapsuleTotal)(dMass *, dReal total_mass, int direction, dReal radius, dReal length);
//void (ODE_API *dMassSetCylinder)(dMass *, dReal density, int direction, dReal radius, dReal length);
//void (ODE_API *dMassSetCylinderTotal)(dMass *, dReal total_mass, int direction, dReal radius, dReal length);
void (ODE_API *dMassSetCylinderTotal)(dMass *, dReal total_mass, int direction, dReal radius, dReal length);
//void (ODE_API *dMassSetBox)(dMass *, dReal density, dReal lx, dReal ly, dReal lz);
void (ODE_API *dMassSetBoxTotal)(dMass *, dReal total_mass, dReal lx, dReal ly, dReal lz);
//void (ODE_API *dMassSetTrimesh)(dMass *, dReal density, dGeomID g);
@ -431,8 +431,8 @@ void (ODE_API *dJointGroupDestroy)(dJointGroupID);
void (ODE_API *dJointGroupEmpty)(dJointGroupID);
//int (ODE_API *dJointGetNumBodies)(dJointID);
void (ODE_API *dJointAttach)(dJointID, dBodyID body1, dBodyID body2);
//void (ODE_API *dJointEnable)(dJointID);
//void (ODE_API *dJointDisable)(dJointID);
void (ODE_API *dJointEnable)(dJointID);
void (ODE_API *dJointDisable)(dJointID);
//int (ODE_API *dJointIsEnabled)(dJointID);
void (ODE_API *dJointSetData)(dJointID, void *data);
void * (ODE_API *dJointGetData)(dJointID);
@ -496,31 +496,31 @@ void (ODE_API *dJointSetFixed)(dJointID);
//void (ODE_API *dJointSetPlane2DXParam)(dJointID, int parameter, dReal value);
//void (ODE_API *dJointSetPlane2DYParam)(dJointID, int parameter, dReal value);
//void (ODE_API *dJointSetPlane2DAngleParam)(dJointID, int parameter, dReal value);
//void (ODE_API *dJointGetBallAnchor)(dJointID, dVector3 result);
void (ODE_API *dJointGetBallAnchor)(dJointID, dVector3 result);
//void (ODE_API *dJointGetBallAnchor2)(dJointID, dVector3 result);
//dReal (ODE_API *dJointGetBallParam)(dJointID, int parameter);
//void (ODE_API *dJointGetHingeAnchor)(dJointID, dVector3 result);
void (ODE_API *dJointGetHingeAnchor)(dJointID, dVector3 result);
//void (ODE_API *dJointGetHingeAnchor2)(dJointID, dVector3 result);
//void (ODE_API *dJointGetHingeAxis)(dJointID, dVector3 result);
void (ODE_API *dJointGetHingeAxis)(dJointID, dVector3 result);
//dReal (ODE_API *dJointGetHingeParam)(dJointID, int parameter);
//dReal (ODE_API *dJointGetHingeAngle)(dJointID);
//dReal (ODE_API *dJointGetHingeAngleRate)(dJointID);
//dReal (ODE_API *dJointGetSliderPosition)(dJointID);
//dReal (ODE_API *dJointGetSliderPositionRate)(dJointID);
//void (ODE_API *dJointGetSliderAxis)(dJointID, dVector3 result);
void (ODE_API *dJointGetSliderAxis)(dJointID, dVector3 result);
//dReal (ODE_API *dJointGetSliderParam)(dJointID, int parameter);
//void (ODE_API *dJointGetHinge2Anchor)(dJointID, dVector3 result);
void (ODE_API *dJointGetHinge2Anchor)(dJointID, dVector3 result);
//void (ODE_API *dJointGetHinge2Anchor2)(dJointID, dVector3 result);
//void (ODE_API *dJointGetHinge2Axis1)(dJointID, dVector3 result);
//void (ODE_API *dJointGetHinge2Axis2)(dJointID, dVector3 result);
void (ODE_API *dJointGetHinge2Axis1)(dJointID, dVector3 result);
void (ODE_API *dJointGetHinge2Axis2)(dJointID, dVector3 result);
//dReal (ODE_API *dJointGetHinge2Param)(dJointID, int parameter);
//dReal (ODE_API *dJointGetHinge2Angle1)(dJointID);
//dReal (ODE_API *dJointGetHinge2Angle1Rate)(dJointID);
//dReal (ODE_API *dJointGetHinge2Angle2Rate)(dJointID);
//void (ODE_API *dJointGetUniversalAnchor)(dJointID, dVector3 result);
void (ODE_API *dJointGetUniversalAnchor)(dJointID, dVector3 result);
//void (ODE_API *dJointGetUniversalAnchor2)(dJointID, dVector3 result);
//void (ODE_API *dJointGetUniversalAxis1)(dJointID, dVector3 result);
//void (ODE_API *dJointGetUniversalAxis2)(dJointID, dVector3 result);
void (ODE_API *dJointGetUniversalAxis1)(dJointID, dVector3 result);
void (ODE_API *dJointGetUniversalAxis2)(dJointID, dVector3 result);
//dReal (ODE_API *dJointGetUniversalParam)(dJointID, int parameter);
//void (ODE_API *dJointGetUniversalAngles)(dJointID, dReal *angle1, dReal *angle2);
//dReal (ODE_API *dJointGetUniversalAngle1)(dJointID);
@ -659,7 +659,7 @@ dGeomID (ODE_API *dCreateCapsule)(dSpaceID space, dReal radius, dReal le
//void (ODE_API *dGeomCapsuleGetParams)(dGeomID ccylinder, dReal *radius, dReal *length);
//dReal (ODE_API *dGeomCapsulePointDepth)(dGeomID ccylinder, dReal x, dReal y, dReal z);
//
//dGeomID (ODE_API *dCreateCylinder)(dSpaceID space, dReal radius, dReal length);
dGeomID (ODE_API *dCreateCylinder)(dSpaceID space, dReal radius, dReal length);
//void (ODE_API *dGeomCylinderSetParams)(dGeomID cylinder, dReal radius, dReal length);
//void (ODE_API *dGeomCylinderGetParams)(dGeomID cylinder, dReal *radius, dReal *length);
//
@ -735,7 +735,7 @@ static dllfunction_t odefuncs[] =
// {"dMassSetCapsule", (void **) &dMassSetCapsule},
{(void **) &dMassSetCapsuleTotal, "dMassSetCapsuleTotal"},
// {"dMassSetCylinder", (void **) &dMassSetCylinder},
// {"dMassSetCylinderTotal", (void **) &dMassSetCylinderTotal},
{(void **) &dMassSetCylinderTotal, "dMassSetCylinderTotal"},
// {"dMassSetBox", (void **) &dMassSetBox},
{(void **) &dMassSetBoxTotal, "dMassSetBoxTotal"},
// {"dMassSetTrimesh", (void **) &dMassSetTrimesh},
@ -896,8 +896,8 @@ static dllfunction_t odefuncs[] =
{(void **) &dJointGroupEmpty, "dJointGroupEmpty"},
// {"dJointGetNumBodies", (void **) &dJointGetNumBodies},
{(void **) &dJointAttach, "dJointAttach"},
// {"dJointEnable", (void **) &dJointEnable},
// {"dJointDisable", (void **) &dJointDisable},
{(void **) &dJointEnable, "dJointEnable"},
{(void **) &dJointDisable, "dJointDisable"},
// {"dJointIsEnabled", (void **) &dJointIsEnabled},
{(void **) &dJointSetData, "dJointSetData"},
{(void **) &dJointGetData, "dJointGetData"},
@ -961,31 +961,31 @@ static dllfunction_t odefuncs[] =
// {"dJointSetPlane2DXParam", (void **) &dJointSetPlane2DXParam},
// {"dJointSetPlane2DYParam", (void **) &dJointSetPlane2DYParam},
// {"dJointSetPlane2DAngleParam", (void **) &dJointSetPlane2DAngleParam},
// {"dJointGetBallAnchor", (void **) &dJointGetBallAnchor},
{(void **) &dJointGetBallAnchor, "dJointGetBallAnchor"},
// {"dJointGetBallAnchor2", (void **) &dJointGetBallAnchor2},
// {"dJointGetBallParam", (void **) &dJointGetBallParam},
// {"dJointGetHingeAnchor", (void **) &dJointGetHingeAnchor},
{(void **) &dJointGetHingeAnchor, "dJointGetHingeAnchor"},
// {"dJointGetHingeAnchor2", (void **) &dJointGetHingeAnchor2},
// {"dJointGetHingeAxis", (void **) &dJointGetHingeAxis},
{(void **) &dJointGetHingeAxis, "dJointGetHingeAxis"},
// {"dJointGetHingeParam", (void **) &dJointGetHingeParam},
// {"dJointGetHingeAngle", (void **) &dJointGetHingeAngle},
// {"dJointGetHingeAngleRate", (void **) &dJointGetHingeAngleRate},
// {"dJointGetSliderPosition", (void **) &dJointGetSliderPosition},
// {"dJointGetSliderPositionRate", (void **) &dJointGetSliderPositionRate},
// {"dJointGetSliderAxis", (void **) &dJointGetSliderAxis},
{(void **) &dJointGetSliderAxis, "dJointGetSliderAxis"},
// {"dJointGetSliderParam", (void **) &dJointGetSliderParam},
// {"dJointGetHinge2Anchor", (void **) &dJointGetHinge2Anchor},
// {"dJointGetHinge2Anchor2", (void **) &dJointGetHinge2Anchor2},
// {"dJointGetHinge2Axis1", (void **) &dJointGetHinge2Axis1},
// {"dJointGetHinge2Axis2", (void **) &dJointGetHinge2Axis2},
{(void **) &dJointGetHinge2Axis1, "dJointGetHinge2Axis1"},
{(void **) &dJointGetHinge2Axis2, "dJointGetHinge2Axis2"},
// {"dJointGetHinge2Param", (void **) &dJointGetHinge2Param},
// {"dJointGetHinge2Angle1", (void **) &dJointGetHinge2Angle1},
// {"dJointGetHinge2Angle1Rate", (void **) &dJointGetHinge2Angle1Rate},
// {"dJointGetHinge2Angle2Rate", (void **) &dJointGetHinge2Angle2Rate},
// {"dJointGetUniversalAnchor", (void **) &dJointGetUniversalAnchor},
{(void **) &dJointGetUniversalAnchor, "dJointGetUniversalAnchor"},
// {"dJointGetUniversalAnchor2", (void **) &dJointGetUniversalAnchor2},
// {"dJointGetUniversalAxis1", (void **) &dJointGetUniversalAxis1},
// {"dJointGetUniversalAxis2", (void **) &dJointGetUniversalAxis2},
{(void **) &dJointGetUniversalAxis1, "dJointGetUniversalAxis1"},
{(void **) &dJointGetUniversalAxis2, "dJointGetUniversalAxis2"},
// {"dJointGetUniversalParam", (void **) &dJointGetUniversalParam},
// {"dJointGetUniversalAngles", (void **) &dJointGetUniversalAngles},
// {"dJointGetUniversalAngle1", (void **) &dJointGetUniversalAngle1},
@ -1115,7 +1115,7 @@ static dllfunction_t odefuncs[] =
// {"dGeomCapsuleSetParams", (void **) &dGeomCapsuleSetParams},
// {"dGeomCapsuleGetParams", (void **) &dGeomCapsuleGetParams},
// {"dGeomCapsulePointDepth", (void **) &dGeomCapsulePointDepth},
// {"dCreateCylinder", (void **) &dCreateCylinder},
{(void **) &dCreateCylinder, "dCreateCylinder"},
// {"dGeomCylinderSetParams", (void **) &dGeomCylinderSetParams},
// {"dGeomCylinderGetParams", (void **) &dGeomCylinderGetParams},
// {"dCreateRay", (void **) &dCreateRay},
@ -1771,17 +1771,10 @@ static qboolean GenerateCollisionMesh(world_t *world, model_t *mod, wedict_t *ed
return true;
}
qboolean World_ODE_RagCreateBody(world_t *world, odebody_t *bodyptr, float *mat, wedict_t *ent)
qboolean World_ODE_RagMatrixToBody(odebody_t *bodyptr, float *mat)
{
dVector3 r[3];
if (!world->ode.ode_space)
return false;
bodyptr->ode_geom = dCreateBox(world->ode.ode_space, 3, 3, 3);
bodyptr->ode_body = dBodyCreate(world->ode.ode_world);
dGeomSetBody(bodyptr->ode_geom, bodyptr->ode_body);
dGeomSetData(bodyptr->ode_geom, (void*)ent);
r[0][0] = mat[0];
r[0][1] = mat[1];
r[0][2] = mat[2];
@ -1796,8 +1789,141 @@ qboolean World_ODE_RagCreateBody(world_t *world, odebody_t *bodyptr, float *mat,
dBodySetRotation(bodyptr->ode_body, r[0]);
dBodySetLinearVel(bodyptr->ode_body, 0, 0, 0);
dBodySetAngularVel(bodyptr->ode_body, 0, 0, 0);
return true;
}
qboolean World_ODE_RagCreateBody(world_t *world, odebody_t *bodyptr, odebodyinfo_t *bodyinfo, float *mat, wedict_t *ent)
{
dMass mass;
float radius;
if (!world->ode.ode_space)
return false;
world->ode.hasodeents = true; //I don't like this, but we need the world etc to be solid.
world->ode.hasextraobjs = true;
switch(bodyinfo->shape)
{
case SOLID_PHYSICS_CAPSULE:
radius = (bodyinfo->dimensions[0] + bodyinfo->dimensions[1]) * 0.5;
bodyptr->ode_geom = (void *)dCreateCapsule(world->ode.ode_space, radius, bodyinfo->dimensions[2]);
dMassSetCapsuleTotal(&mass, bodyinfo->mass, 3, radius, bodyinfo->dimensions[2]);
//aligned along the geom's local z axis
break;
case SOLID_PHYSICS_SPHERE:
//radius
radius = (bodyinfo->dimensions[0] + bodyinfo->dimensions[1] + bodyinfo->dimensions[2]) / 3;
bodyptr->ode_geom = dCreateSphere(world->ode.ode_space, radius);
dMassSetSphereTotal(&mass, bodyinfo->mass, radius);
//aligned along the geom's local z axis
break;
case SOLID_PHYSICS_CYLINDER:
//radius, length
radius = (bodyinfo->dimensions[0] + bodyinfo->dimensions[1]) * 0.5;
bodyptr->ode_geom = dCreateCylinder(world->ode.ode_space, radius, bodyinfo->dimensions[2]);
dMassSetCylinderTotal(&mass, bodyinfo->mass, 3, radius, bodyinfo->dimensions[2]);
//alignment is irreleevnt, thouse I suppose it might be scaled wierdly.
break;
default:
case SOLID_PHYSICS_BOX:
//diameter
bodyptr->ode_geom = dCreateBox(world->ode.ode_space, bodyinfo->dimensions[0], bodyinfo->dimensions[1], bodyinfo->dimensions[2]);
dMassSetBoxTotal(&mass, bodyinfo->mass, bodyinfo->dimensions[0], bodyinfo->dimensions[1], bodyinfo->dimensions[2]);
//monkey
break;
}
bodyptr->ode_body = dBodyCreate(world->ode.ode_world);
dBodySetMass(bodyptr->ode_body, &mass);
dGeomSetBody(bodyptr->ode_geom, bodyptr->ode_body);
dGeomSetData(bodyptr->ode_geom, (void*)ent);
return World_ODE_RagMatrixToBody(bodyptr, mat);
}
void World_ODE_RagMatrixFromJoint(odejoint_t *joint, odejointinfo_t *info, float *mat)
{
dVector3 dr3;
switch(info->type)
{
case JOINTTYPE_POINT:
dJointGetBallAnchor(joint->ode_joint, dr3);
mat[3] = dr3[0];
mat[7] = dr3[1];
mat[11] = dr3[2];
VectorClear(mat+4);
VectorClear(mat+8);
break;
case JOINTTYPE_HINGE:
dJointGetHingeAnchor(joint->ode_joint, dr3);
mat[3] = dr3[0];
mat[7] = dr3[1];
mat[11] = dr3[2];
dJointGetHingeAxis(joint->ode_joint, dr3);
VectorCopy(dr3, mat+4);
VectorClear(mat+8);
CrossProduct(mat+4, mat+8, mat+0);
return;
break;
case JOINTTYPE_HINGE2:
dJointGetHinge2Anchor(joint->ode_joint, dr3);
mat[3] = dr3[0];
mat[7] = dr3[1];
mat[11] = dr3[2];
dJointGetHinge2Axis1(joint->ode_joint, dr3);
VectorCopy(dr3, mat+4);
dJointGetHinge2Axis2(joint->ode_joint, dr3);
VectorCopy(dr3, mat+8);
break;
case JOINTTYPE_SLIDER:
//no anchor point...
//get the two bodies and average their origin for a somewhat usable representation of an anchor.
{
const dReal *p1, *p2;
dReal n[3];
dBodyID b1 = dJointGetBody(joint->ode_joint, 0), b2 = dJointGetBody(joint->ode_joint, 1);
if (b1)
p1 = dBodyGetPosition(b1);
else
{
p1 = n;
VectorClear(n);
}
if (b2)
p2 = dBodyGetPosition(b2);
else
p2 = p1;
dJointGetSliderAxis(joint->ode_joint, dr3 + 0);
VectorInterpolate(p1, 0.5, p2, dr3);
mat[3] = dr3[0];
mat[7] = dr3[1];
mat[11] = dr3[2];
VectorClear(mat+4);
VectorClear(mat+8);
}
break;
case JOINTTYPE_UNIVERSAL:
dJointGetUniversalAnchor(joint->ode_joint, dr3);
mat[3] = dr3[0];
mat[7] = dr3[1];
mat[11] = dr3[2];
dJointGetUniversalAxis1(joint->ode_joint, dr3);
VectorCopy(dr3, mat+4);
dJointGetUniversalAxis2(joint->ode_joint, dr3);
VectorCopy(dr3, mat+8);
CrossProduct(mat+4, mat+8, mat+0);
return;
break;
}
AngleVectorsFLU(vec3_origin, mat+0, mat+4, mat+8);
}
void World_ODE_RagMatrixFromBody(world_t *world, odebody_t *bodyptr, float *mat)
{
@ -1818,7 +1944,13 @@ void World_ODE_RagMatrixFromBody(world_t *world, odebody_t *bodyptr, float *mat)
mat[10] = r[10];
mat[11] = o[2];
}
void World_ODE_RagEnableJoint(odejoint_t *joint, qboolean enabled)
{
if (enabled)
dJointEnable(joint->ode_joint);
else
dJointDisable(joint->ode_joint);
}
void World_ODE_RagCreateJoint(world_t *world, odejoint_t *joint, odejointinfo_t *info, odebody_t *body1, odebody_t *body2, vec3_t aaa2[3])
{
switch(info->type)
@ -2023,12 +2155,6 @@ static void World_ODE_Frame_BodyFromEntity(world_t *world, wedict_t *ed)
if (movetype != MOVETYPE_PHYSICS)
massval = 1.0f;
// get friction from entity
if (ed->xv->friction)
ed->ode.ode_friction = ed->xv->friction;
else
ed->ode.ode_friction = 1.0;
// check if we need to create or replace the geom
if (!ed->ode.ode_physics
|| !VectorCompare(ed->ode.ode_mins, entmins)
@ -2380,9 +2506,17 @@ static void VARGS nearCallback (void *data, dGeomID o1, dGeomID o2)
return;
ed1 = (wedict_t *) dGeomGetData(o1);
ed2 = (wedict_t *) dGeomGetData(o2);
if (ed1 == ed2 && ed1)
{
//ragdolls don't make contact with the bbox of the doll entity
//the origional entity should probably not be solid anyway.
//these bodies should probably not collide against bboxes of other entities with ragdolls either, but meh.
if (ed1->ode.ode_body == b1 || ed2->ode.ode_body == b2)
return;
}
if(!ed1 || ed1->isfree)
ed1 = world->edicts;
ed2 = (wedict_t *) dGeomGetData(o2);
if(!ed2 || ed2->isfree)
ed2 = world->edicts;
@ -2454,7 +2588,12 @@ static void VARGS nearCallback (void *data, dGeomID o1, dGeomID o2)
(physics_ode_contact_erp.value != -1 ? dContactSoftERP : 0) |
(physics_ode_contact_cfm.value != -1 ? dContactSoftCFM : 0) |
(bouncefactor1 > 0 ? dContactBounce : 0);
contact[i].surface.mu = physics_ode_contact_mu.value * ed1->ode.ode_friction * ed2->ode.ode_friction;
contact[i].surface.mu = physics_ode_contact_mu.value;
if (ed1->xv->friction)
contact[i].surface.mu *= ed1->xv->friction;
if (ed2->xv->friction)
contact[i].surface.mu *= ed2->xv->friction;
contact[i].surface.mu2 = 0;
contact[i].surface.soft_erp = physics_ode_contact_erp.value + erp;
contact[i].surface.soft_cfm = physics_ode_contact_cfm.value;
contact[i].surface.bounce = bouncefactor1;
@ -2475,7 +2614,7 @@ void World_ODE_Frame(world_t *world, double frametime, double gravity)
world->ode.ode_step = frametime / world->ode.ode_iterations;
world->ode.ode_movelimit = physics_ode_movelimit.value / world->ode.ode_step;
if (world->ode.hasodeents)
if (world->ode.hasodeents || world->ode.hasextraobjs)
{
// copy physics properties from entities to physics engine
for (i = 0;i < world->num_edicts;i++)
@ -2495,6 +2634,12 @@ void World_ODE_Frame(world_t *world, double frametime, double gravity)
for (i = 0;i < world->ode.ode_iterations;i++)
{
if (world->ode.hasextraobjs)
{
#ifdef RAGDOLL
rag_doallanimations(world);
#endif
}
// set the gravity
dWorldSetGravity(world->ode.ode_world, 0, 0, -gravity);
// set the tolerance for closeness of objects

View file

@ -957,6 +957,79 @@ void MSG_WriteAngle (sizebuf_t *sb, float f)
MSG_WriteAngle8 (sb, f);
}
static unsigned int MSG_ReadEntity(void)
{
unsigned int num;
num = MSG_ReadShort();
if (num & 0x8000)
{
num = (num & 0x7fff) << 8;
num |= MSG_ReadByte();
}
return num;
}
//we use the high bit of the entity number to state that this is a large entity.
#ifndef CLIENTONLY
unsigned int MSGSV_ReadEntity(client_t *fromclient)
{
unsigned int num;
if (fromclient->fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS)
num = MSG_ReadEntity();
else
num = (unsigned short)(short)MSG_ReadEntity();
if (num >= sv.world.max_edicts)
{
Con_Printf("client %s sent invalid entity\n", fromclient->name);
fromclient->drop = true;
return 0;
}
return num;
}
#endif
#ifndef SERVERONLY
unsigned int MSGCL_ReadEntity(void)
{
unsigned int num;
if (cls.fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS)
num = MSG_ReadEntity();
else
num = (unsigned short)(short)MSG_ReadShort();
return num;
}
//compat for ktx/ezquake's railgun
unsigned int MSGCLF_ReadEntity(qboolean *flagged)
{
int s;
*flagged = false;
if (cls.fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS)
return MSG_ReadEntity();
else
{
s = MSG_ReadShort();
if (s < 0)
{
*flagged = true;
return -1 -s;
}
else
return s;
}
}
#endif
void MSG_WriteEntity(sizebuf_t *sb, unsigned int entnum)
{
if (entnum > MAX_EDICTS)
Host_EndGame("index %#x is not a valid entity\n", entnum);
if (entnum >= 0x8000)
{
MSG_WriteShort(sb, (entnum>>8) | 0x8000);
MSG_WriteByte(sb, entnum & 0xff);
}
else
MSG_WriteShort(sb, entnum);
}
void MSG_WriteDeltaUsercmd (sizebuf_t *buf, usercmd_t *from, usercmd_t *cmd)
{
int bits;
@ -1617,6 +1690,23 @@ void SZ_Print (sizebuf_t *buf, const char *data)
//============================================================================
char *COM_TrimString(char *str)
{
int i;
static char buffer[256];
while (*str <= ' ' && *str>'\0')
str++;
for (i = 0; i < 255; i++)
{
if (*str <= ' ')
break;
buffer[i] = *str++;
}
buffer[i] = '\0';
return buffer;
}
/*
============
COM_SkipPath
@ -1826,6 +1916,199 @@ void COM_DefaultExtension (char *path, char *extension, int maxlen)
//errors:
//1 sequence error
//2 over-long
//3 invalid unicode char
//4 invalid utf-16 lead/high surrogate
//5 invalid utf-16 tail/low surrogate
unsigned int utf8_decode(int *error, const void *in, void **out)
{
//uc is the output unicode char
unsigned int uc = 0xfffdu; //replacement character
//l is the length
unsigned int l = 1;
const unsigned char *str = in;
if ((*str & 0xe0) == 0xc0)
{
if ((str[1] & 0xc0) == 0x80)
{
l = 2;
uc = ((str[0] & 0x1f)<<6) | (str[1] & 0x3f);
if (uc >= (1u<<7))
*error = 0;
else
*error = 2;
}
else *error = 1;
}
else if ((*str & 0xf0) == 0xe0)
{
if ((str[1] & 0xc0) == 0x80 && (str[2] & 0xc0) == 0x80)
{
l = 3;
uc = ((str[0] & 0x0f)<<12) | ((str[1] & 0x3f)<<6) | ((str[2] & 0x3f)<<0);
if (uc >= (1u<<11))
*error = 0;
else
*error = 2;
}
else *error = 1;
}
else if ((*str & 0xf8) == 0xf0)
{
if ((str[1] & 0xc0) == 0x80 && (str[2] & 0xc0) == 0x80 && (str[3] & 0xc0) == 0x80)
{
l = 4;
uc = ((str[0] & 0x07)<<18) | ((str[1] & 0x3f)<<12) | ((str[2] & 0x3f)<<6) | ((str[3] & 0x3f)<<0);
if (uc >= (1u<<16))
*error = 0;
else
*error = 2;
}
else *error = 1;
}
else if ((*str & 0xfc) == 0xf8)
{
if ((str[1] & 0xc0) == 0x80 && (str[2] & 0xc0) == 0x80 && (str[3] & 0xc0) == 0x80 && (str[4] & 0xc0) == 0x80)
{
l = 5;
uc = ((str[0] & 0x03)<<24) | ((str[1] & 0x3f)<<18) | ((str[2] & 0x3f)<<12) | ((str[3] & 0x3f)<<6) | ((str[4] & 0x3f)<<0);
if (uc >= (1u<<21))
*error = 0;
else
*error = 2;
}
else *error = 1;
}
else if ((*str & 0xfe) == 0xfc)
{
//six bytes
if ((str[1] & 0xc0) == 0x80 && (str[2] & 0xc0) == 0x80 && (str[3] & 0xc0) == 0x80 && (str[4] & 0xc0) == 0x80)
{
l = 6;
uc = ((str[0] & 0x01)<<30) | ((str[1] & 0x3f)<<24) | ((str[2] & 0x3f)<<18) | ((str[3] & 0x3f)<<12) | ((str[4] & 0x3f)<<6) | ((str[5] & 0x3f)<<0);
if (uc >= (1u<<26))
*error = 0;
else
*error = 2;
}
else *error = 1;
}
//0xfe and 0xff, while plausable leading bytes, are not permitted.
#if 0
else if ((*str & 0xff) == 0xfe)
{
if ((str[1] & 0xc0) == 0x80 && (str[2] & 0xc0) == 0x80 && (str[3] & 0xc0) == 0x80 && (str[4] & 0xc0) == 0x80)
{
l = 7;
uc = 0 | ((str[1] & 0x3f)<<30) | ((str[2] & 0x3f)<<24) | ((str[3] & 0x3f)<<18) | ((str[4] & 0x3f)<<12) | ((str[5] & 0x3f)<<6) | ((str[6] & 0x3f)<<0);
if (uc >= (1u<<31))
*error = 0;
else
*error = 2;
}
else *error = 1;
}
else if ((*str & 0xff) == 0xff)
{
if ((str[1] & 0xc0) == 0x80 && (str[2] & 0xc0) == 0x80 && (str[3] & 0xc0) == 0x80 && (str[4] & 0xc0) == 0x80)
{
l = 8;
uc = 0 | ((str[1] & 0x3f)<<36) | ((str[2] & 0x3f)<<30) | ((str[3] & 0x3f)<<24) | ((str[4] & 0x3f)<<18) | ((str[5] & 0x3f)<<12) | ((str[6] & 0x3f)<<6) | ((str[7] & 0x3f)<<0);
if (uc >= (1llu<<36))
*error = false;
else
*error = 2;
}
else *error = 1;
}
#endif
else if (*str & 0x80)
{
//sequence error
*error = 1;
uc = 0xe000u + *str;
}
else
{
//ascii char
*error = 0;
uc = *str;
}
*out = (void*)(str + l);
if (!*error)
{
//try to deal with surrogates by decoding the low if we see a high.
if (uc >= 0xd800u && uc < 0xdc00u)
{
#if 0
//cesu-8
void *lowend;
unsigned int lowsur = utf_decode(&error, str + l, &lowend);
if (*error == 4 && lowsur >= 0xdc00u && lowsur < 0xe000u)
{
*out = lowend;
uc = (((uc&0x3ff) << 10) || (lowsur&0x3ff)) + 0x10000;
*error = false;
}
else
#endif
{
*error = 3; //bad lead surrogate.
}
}
if (uc >= 0xd800u && uc < 0xdc00u)
*error = 4; //bad tail surrogate
//these are meant to be illegal too
if (uc == 0xfffeu || uc == 0xffffu || uc > 0x10ffff)
*error = 2; //illegal code
}
return uc;
}
unsigned int utf8_encode(void *out, unsigned int unicode, int maxlen)
{
unsigned int bcount = 1;
unsigned int lim = 0x80;
unsigned int shift;
while (unicode >= lim)
{
if (bcount == 1)
lim <<= 4;
else if (bcount < 7)
lim <<= 5;
else
lim <<= 6;
bcount++;
}
//error if needed
if (maxlen < bcount)
return 0;
//output it.
if (bcount == 1)
*((unsigned char *)out)++ = (unsigned char)(unicode&0x7f);
else
{
shift = bcount*6;
shift = shift-6;
*((unsigned char *)out)++ = (unsigned char)((unicode>>shift)&(0x0000007f>>bcount)) | (0xffffff00 >> bcount);
do
{
shift = shift-6;
*((unsigned char *)out)++ = (unsigned char)((unicode>>shift)&0x3f) | 0x80;
}
while(shift);
}
return bcount;
}
///=====================================
@ -2007,33 +2290,11 @@ char *COM_DeFunString(conchar_t *str, conchar_t *stop, char *out, int outsize, q
c = *str++ & 0xffff;
if (com_parseutf8.ival > 0)
{
//utf-8
if (c > 0x7ff)
{
if (outsize<=3)
break;
outsize -= 3;
*out++ = (unsigned char)((c>>12)&0x0f) | 0xe0;
*out++ = (unsigned char)((c>>6)&0x3f) | 0x80;
*out++ = (unsigned char)(c&0x3f) | 0x80;
}
else if (c > 0x7f)
{
if (outsize<=2)
break;
outsize -= 2;
*out++ = (unsigned char)((c>>6)&0x1f) | 0xc0;
*out++ = (unsigned char)(c&0x3f) | 0x80;
}
else
{
if (outsize<=1)
break;
outsize -= 1;
*out++ = (unsigned char)(c&0x7f);
}
c = utf8_encode(out, c, outsize);
if (!c)
break;
outsize -= c;
out += c;
}
else if (com_parseutf8.ival)
{
@ -2044,7 +2305,7 @@ char *COM_DeFunString(conchar_t *str, conchar_t *stop, char *out, int outsize, q
break;
*out++ = (unsigned char)(c&255);
}
else //any other quake char is not iso8859-1
else //any other (quake?) char is not iso8859-1
{
const char hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
if (outsize<=6)
@ -2103,7 +2364,7 @@ conchar_t *COM_ParseFunString(conchar_t defaultflags, const char *str, conchar_t
{
conchar_t extstack[4];
int extstackdepth = 0;
unsigned int uc, l;
unsigned int uc;
int utf8 = com_parseutf8.ival;
conchar_t linkinitflags = CON_WHITEMASK;/*doesn't need the init, but msvc is stupid*/
qboolean linkkeep = keepmarkup;
@ -2140,107 +2401,41 @@ conchar_t *COM_ParseFunString(conchar_t defaultflags, const char *str, conchar_t
{
if (*str & 0x80 && utf8 > 0)
{ //check for utf-8
//uc is the output unicode char
uc = 0;
//l is the length
l = 0;
if ((*str & 0xc0) == 0x80)
int decodeerror;
void *end;
uc = utf8_decode(&decodeerror, str, &end);
if (decodeerror)
{
//one byte... malformed
uc = '?';
}
else if ((*str & 0xe0) == 0xc0)
{
//two bytes
if ((str[1] & 0xc0) == 0x80)
{
uc = ((str[0] & 0x1f)<<6) | (str[1] & 0x3f);
if (uc > 0x7f)
l = 2;
}
}
else if ((*str & 0xf0) == 0xe0)
{
//three bytes
if ((str[1] & 0xc0) == 0x80 && (str[2] & 0xc0) == 0x80)
{
uc = ((str[0] & 0x0f)<<12) | ((str[1] & 0x3f)<<6) | ((str[2] & 0x3f)<<0);
if (uc > 0x7ff)
l = 3;
}
}
else if ((*str & 0xf8) == 0xf0)
{
//four bytes
if ((str[1] & 0xc0) == 0x80 && (str[2] & 0xc0) == 0x80 && (str[3] & 0xc0) == 0x80)
{
uc = ((str[0] & 0x07)<<18) | ((str[1] & 0x3f)<<12) | ((str[2] & 0x3f)<<6) | ((str[3] & 0x3f)<<0);
if (uc > 0xffff)
l = 4;
}
}
else if ((*str & 0xfc) == 0xf8)
{
//five bytes
if ((str[1] & 0xc0) == 0x80 && (str[2] & 0xc0) == 0x80 && (str[3] & 0xc0) == 0x80 && (str[4] & 0xc0) == 0x80)
{
uc = ((str[0] & 0x03)<<24) | ((str[1] & 0x3f)<<18) | ((str[2] & 0x3f)<<12) | ((str[3] & 0x3f)<<6) | ((str[4] & 0x3f)<<0);
if (uc > 0x1fffff)
l = 5;
}
}
else if ((*str & 0xfe) == 0xfc)
{
//six bytes
if ((str[1] & 0xc0) == 0x80 && (str[2] & 0xc0) == 0x80 && (str[3] & 0xc0) == 0x80 && (str[4] & 0xc0) == 0x80)
{
uc = ((str[0] & 0x01)<<30) | ((str[1] & 0x3f)<<24) | ((str[2] & 0x3f)<<18) | ((str[3] & 0x3f)<<12) | ((str[4] & 0x3f)<<6) | ((str[5] & 0x3f)<<0);
if (uc > 0x3ffffff)
l = 6;
}
}
//0xfe and 0xff, while plausable leading bytes, are not permitted.
if (l)
{
//note that we don't support utf-16 surrogates
if (uc == 0xd800 || uc == 0xdb7f || uc == 0xdb80 || uc == 0xdbff || uc == 0xdc00 || uc == 0xdf80 || uc == 0xdfff)
l = 0;
//these are meant to be illegal too
else if (uc == 0xfffe || uc == 0xffff)
uc = '?';
//too big for our data types
else if (uc & ~CON_CHARMASK)
l = 0;
utf8 &= ~1;
//malformed encoding we just drop through and stop trying to decode.
//if its just a malformed or overlong string, we end up with a chunk of 'red' chars.
}
else
utf8 &= ~1;
//l is set if we got a valid utf-8 byte sequence
if (l)
{
if (uc > 0xffff)
uc = 0xfffd;
if (!--outsize)
break;
*out++ = uc | ext;
str += l;
str = end;
continue;
}
//malformed encoding we just drop through
//if its just a malformed or overlong string, we end up with a chunk of 'red' chars.
}
if (*str == '^')
{
if (str[1] >= '0' && str[1] <= '9')
{
if (ext & CON_RICHFORECOLOUR)
ext = (COLOR_WHITE << CON_FGSHIFT) | (ext&~(CON_RICHFOREMASK|CON_RICHFORECOLOUR));
ext = q3codemasks[str[1]-'0'] | (ext&~CON_Q3MASK); //change colour only.
}
else if (str[1] == '&') // extended code
{
if (isextendedcode(str[2]) && isextendedcode(str[3]))
{
if (ext & CON_RICHFORECOLOUR)
ext = (COLOR_WHITE << CON_FGSHIFT) | (ext&~(CON_RICHFOREMASK|CON_RICHFORECOLOUR));
// foreground char
if (str[2] == '-') // default for FG
ext = (COLOR_WHITE << CON_FGSHIFT) | (ext&~CON_FGMASK);
@ -2403,38 +2598,30 @@ conchar_t *COM_ParseFunString(conchar_t defaultflags, const char *str, conchar_t
int best = 1;
float bd = 255*255*255, d;
int c;
float r, g, b;
int r, g, b;
if (str[2] >= '0' && str[2] <= '9')
r = (str[2]-'0') / (float)0xf;
r = (str[2]-'0');
else if (str[2] >= 'A' && str[2] <= 'F')
r = (str[2]-'A'+10) / (float)0xf;
r = (str[2]-'A'+10);
else
r = (str[2]-'a'+10) / (float)0xf;
r = (str[2]-'a'+10);
if (str[3] >= '0' && str[3] <= '9')
g = (str[3]-'0') / (float)0xf;
g = (str[3]-'0');
else if (str[3] >= 'A' && str[3] <= 'F')
g = (str[3]-'A'+10) / (float)0xf;
g = (str[3]-'A'+10);
else
g = (str[3]-'a'+10) / (float)0xf;
g = (str[3]-'a'+10);
if (str[4] >= '0' && str[4] <= '9')
b = (str[4]-'0') / (float)0xf;
b = (str[4]-'0');
else if (str[4] >= 'A' && str[4] <= 'F')
b = (str[4]-'A'+10) / (float)0xf;
b = (str[4]-'A'+10);
else
b = (str[4]-'a'+10) / (float)0xf;
b = (str[4]-'a'+10);
for (c = 0; c < sizeof(consolecolours)/sizeof(consolecolours[0]); c++)
{
d = (consolecolours[c].fr-r)*(consolecolours[c].fr-r) +
(consolecolours[c].fg-g)*(consolecolours[c].fg-g) +
(consolecolours[c].fb-b)*(consolecolours[c].fb-b);
if (d < bd)
{
best = c;
bd = d;
}
}
ext = (best << CON_FGSHIFT) | (ext&~CON_FGMASK);
ext = (ext & ~CON_RICHFOREMASK) | CON_RICHFORECOLOUR;
ext |= r<<CON_RICHRSHIFT;
ext |= g<<CON_RICHGSHIFT;
ext |= b<<CON_RICHBSHIFT;
if (!keepmarkup)
{
@ -2445,7 +2632,7 @@ conchar_t *COM_ParseFunString(conchar_t defaultflags, const char *str, conchar_t
}
else if (*str == '&' && str[1] == 'r')
{
ext = (COLOR_WHITE << CON_FGSHIFT) | (ext&~CON_FGMASK);
ext = (COLOR_WHITE << CON_FGSHIFT) | (ext&~(CON_RICHFOREMASK|CON_RICHFORECOLOUR));
if (!keepmarkup)
{
str+=2;
@ -2767,13 +2954,14 @@ skipwhite:
token[len] = 0;
return (char*)data;
}
while (c=='\"')
data++;
/* while (c=='\"')
{
token[len] = c;
len++;
data++;
c = *(data+1);
c = *++data;
}
*/
}
if (!c)
{
@ -3303,7 +3491,8 @@ void COM_Version_f (void)
Con_TPrintf (TL_EXEDATETIME, __DATE__, __TIME__);
#ifdef SVNREVISION
Con_Printf("SVN Revision: %s\n",STRINGIFY(SVNREVISION));
if (strcmp(STRINGIFY(SVNREVISION), "-"))
Con_Printf("SVN Revision: %s\n",STRINGIFY(SVNREVISION));
#endif
#ifdef _DEBUG
@ -4591,9 +4780,12 @@ char *version_string(void)
{
#ifdef OFFICIAL_RELEASE
Q_snprintfz(s, sizeof(s), "%s v%i.%02i", DISTRIBUTION, FTE_VER_MAJOR, FTE_VER_MINOR);
#elif defined(SVNREVISION)
Q_snprintfz(s, sizeof(s), "%s SVN %s", DISTRIBUTION, STRINGIFY(SVNREVISION));
#else
#if defined(SVNREVISION)
if (strcmp(STRINGIFY(SVNREVISION), "-"))
Q_snprintfz(s, sizeof(s), "%s SVN %s", DISTRIBUTION, STRINGIFY(SVNREVISION));
else
#endif
Q_snprintfz(s, sizeof(s), "%s build %s", DISTRIBUTION, __DATE__);
#endif
done = true;

View file

@ -52,6 +52,18 @@ typedef enum {false, true} qboolean;
#define MAX_SERVERINFO_STRING 1024 //standard quake has 512 here.
#define MAX_LOCALINFO_STRING 32768
#ifdef SERVERONLY
#define cls_state 0
#else
#define cls_state cls.state
#endif
#ifdef CLIENTONLY
#define sv_state 0
#else
#define sv_state sv.state
#endif
struct netprim_s
{
int coordsize;
@ -156,6 +168,7 @@ void MSG_WriteChar (sizebuf_t *sb, int c);
void MSG_WriteByte (sizebuf_t *sb, int c);
void MSG_WriteShort (sizebuf_t *sb, int c);
void MSG_WriteLong (sizebuf_t *sb, int c);
void MSG_WriteEntity (sizebuf_t *sb, unsigned int e);
void MSG_WriteFloat (sizebuf_t *sb, float f);
void MSG_WriteString (sizebuf_t *sb, const char *s);
void MSG_WriteCoord (sizebuf_t *sb, float f);
@ -178,6 +191,8 @@ int MSG_ReadBits(int bits);
int MSG_ReadByte (void);
int MSG_ReadShort (void);
int MSG_ReadLong (void);
unsigned int MSGSV_ReadEntity (struct client_s *fromclient);
unsigned int MSGCL_ReadEntity (void);
float MSG_ReadFloat (void);
char *MSG_ReadString (void);
char *MSG_ReadStringLine (void);
@ -277,12 +292,14 @@ void COM_ParsePlusSets (void);
typedef unsigned int conchar_t;
char *COM_DeFunString(conchar_t *str, conchar_t *stop, char *out, int outsize, qboolean ignoreflags);
conchar_t *COM_ParseFunString(conchar_t defaultflags, const char *str, conchar_t *out, int outsize, qboolean keepmarkup); //ext is usually CON_WHITEMASK, returns its null terminator
unsigned int utf8_decode(int *error, void *in, void **out);
unsigned int utf8_encode(void *out, unsigned int unicode, int maxlen);
char *COM_SkipPath (const char *pathname);
void COM_StripExtension (const char *in, char *out, int outlen);
void COM_StripAllExtensions (char *in, char *out, int outlen);
void COM_FileBase (const char *in, char *out, int outlen);
int COM_FileSize(const char *path);
int QDECL COM_FileSize(const char *path);
void COM_DefaultExtension (char *path, char *extension, int maxlen);
char *COM_FileExtension (const char *in);
void COM_CleanUpPath(char *str);
@ -390,7 +407,7 @@ void FS_ReloadPackFiles(void);
char *FSQ3_GenerateClientPacksList(char *buffer, int maxlen, int basechecksum);
qbyte *COM_LoadStackFile (const char *path, void *buffer, int bufsize);
qbyte *QDECL COM_LoadStackFile (const char *path, void *buffer, int bufsize);
qbyte *COM_LoadTempFile (const char *path);
qbyte *COM_LoadTempMoreFile (const char *path); //allocates a little bit more without freeing old temp
qbyte *COM_LoadHunkFile (const char *path);

View file

@ -31,20 +31,27 @@ extern consolecolours_t consolecolours[MAXCONCOLOURS];
#define MAXQ3COLOURS 10
extern conchar_t q3codemasks[MAXQ3COLOURS];
#define CON_NONCLEARBG 0x00800000
#define CON_BLINKTEXT 0x00400000
#define CON_2NDCHARSETTEXT 0x00200000
#define CON_HALFALPHA 0x00100000
#define CON_NONCLEARBG 0x00800000 //disabled if CON_RICHFORECOLOUR
#define CON_HALFALPHA 0x00400000 //disabled if CON_RICHFORECOLOUR
#define CON_UNUSED2 0x00200000 //disabled if CON_RICHFORECOLOUR
#define CON_UNUSED1 0x00100000 //disabled if CON_RICHFORECOLOUR
#define CON_HIDDEN 0x00080000
#define CON_BLINKTEXT 0x00040000
#define CON_2NDCHARSETTEXT 0x00020000
#define CON_RICHFORECOLOUR 0x00010000 //
#define CON_HIGHCHARSMASK 0x00000080 // Quake's alternative mask
#define CON_FLAGSMASK 0xFFF00000
#define CON_HIDDEN 0x000F0000
#define CON_FLAGSMASK 0xFFFF0000
#define CON_CHARMASK 0x0000FFFF
#define CON_FGMASK 0x0F000000
#define CON_BGMASK 0xF0000000
#define CON_FGSHIFT 24
#define CON_BGSHIFT 28
#define CON_RICHFOREMASK 0xFFF00000
#define CON_RICHBSHIFT 20
#define CON_RICHGSHIFT 24
#define CON_RICHRSHIFT 28
#define CON_Q3MASK 0x0F100000
#define CON_WHITEMASK 0x0F000000 // must be constant. things assume this

View file

@ -620,7 +620,7 @@ cvar_t *Cvar_SetCore (cvar_t *var, const char *value, qboolean force)
if (var->flags & CVAR_SERVEROVERRIDE && !force)
latch = "variable %s is under server control - latched\n";
else if (var->flags & CVAR_LATCH)
else if (var->flags & CVAR_LATCH && (sv_state || cls_state))
latch = "variable %s is latched and will be applied for the start of the next map\n";
// else if (var->flags & CVAR_LATCHFLUSH)
// latch = "variable %s is latched (type flush)\n";
@ -1110,7 +1110,7 @@ qboolean Cvar_Command (int level)
return true;
}
if (v->flags & CVAR_NOTFROMSERVER && Cmd_FromGamecode())
if (v->flags & CVAR_NOTFROMSERVER && Cmd_IsInsecure())
{
Con_Printf ("Server tried setting %s cvar\n", v->name);
return true;
@ -1118,10 +1118,35 @@ qboolean Cvar_Command (int level)
// perform a variable print or set
if (Cmd_Argc() == 1)
{
Con_Printf ("\"%s\" is \"%s\"\n", v->name, v->string);
if (v->latched_string)
Con_Printf ("Latched as \"%s\"\n", v->latched_string);
Con_Printf("Default: \"%s\"\n", v->defaultstr);
{
if (v->flags & CVAR_LATCH)
{
Con_Printf ("\"%s\" is currently \"%s\"\n", v->name, v->string);
Con_Printf ("Will be changed to \"%s\" on the next map\n", v->latched_string);
}
else if (v->flags & CVAR_RENDERERLATCH)
{
Con_Printf ("\"%s\" is \"%s\"\n", v->name, v->string);
Con_Printf ("Will be changed to \"%s\" on vid_restart\n", v->latched_string);
}
else
{
Con_Printf ("\"%s\" is \"%s\"\n", v->name, v->latched_string);
Con_Printf ("Effective value is \"%s\"\n", v->string);
}
Con_Printf("Default: \"%s\"\n", v->defaultstr);
}
else
{
if (!strcmp(v->string, v->defaultstr))
Con_Printf ("\"%s\" is \"%s\" (default)\n", v->name, v->string);
else
{
Con_Printf ("\"%s\" is \"%s\"\n", v->name, v->string);
Con_Printf("Default: \"%s\"\n", v->defaultstr);
}
}
return true;
}

View file

@ -176,7 +176,7 @@ searchpath_t *com_searchpaths;
searchpath_t *com_purepaths;
searchpath_t *com_base_searchpaths; // without gamedirs
int COM_FileSize(const char *path)
int QDECL COM_FileSize(const char *path)
{
int len;
flocation_t loc;
@ -192,6 +192,7 @@ COM_Path_f
*/
void COM_Path_f (void)
{
char path[MAX_OSPATH];
searchpath_t *s;
Con_TPrintf (TL_CURRENTSEARCHPATH);
@ -201,9 +202,8 @@ void COM_Path_f (void)
Con_Printf ("Pure paths:\n");
for (s=com_purepaths ; s ; s=s->nextpure)
{
if (s->referenced)
Con_Printf("*");
s->funcs->PrintPath(s->handle);
s->funcs->GetDisplayPath(s->handle, path, sizeof(path));
Con_Printf("%s %s%s%s\n", path, s->referenced?"(ref)":"", s->istemporary?"(temp)":"", s->copyprotected?"(c)":"");
}
Con_Printf ("----------\n");
Con_Printf ("Impure paths:\n");
@ -215,9 +215,8 @@ void COM_Path_f (void)
if (s == com_base_searchpaths)
Con_Printf ("----------\n");
if (s->referenced)
Con_Printf("*");
s->funcs->PrintPath(s->handle);
s->funcs->GetDisplayPath(s->handle, path, sizeof(path));
Con_Printf("%s %s%s%s\n", path, s->referenced?"(ref)":"", s->istemporary?"(temp)":"", s->copyprotected?"(c)":"");
}
}
@ -260,18 +259,18 @@ COM_Locate_f
*/
void COM_Locate_f (void)
{
char path[MAX_OSPATH];
flocation_t loc;
if (FS_FLocateFile(Cmd_Argv(1), FSLFRT_LENGTH, &loc)>=0)
{
loc.search->funcs->GetDisplayPath(loc.search->handle, path, sizeof(path));
if (!*loc.rawname)
{
Con_Printf("File is %i bytes compressed inside ", loc.len);
loc.search->funcs->PrintPath(loc.search->handle);
Con_Printf("File is %i bytes compressed inside %s\n", loc.len, path);
}
else
{
Con_Printf("Inside %s (%i bytes)\n", loc.rawname, loc.len);
loc.search->funcs->PrintPath(loc.search->handle);
Con_Printf("Inside %s (%i bytes)\n %s\n", loc.rawname, loc.len, path);
}
}
else
@ -608,12 +607,11 @@ qboolean FS_GetPackageDownloadable(const char *package)
{
searchpath_t *search;
for (search = com_purepaths ; search ; search = search->nextpure)
for (search = com_searchpaths ; search ; search = search->next)
{
if (!strcmp(package, search->purepath))
return !search->copyprotected;
}
return false;
}
@ -691,7 +689,13 @@ char *FS_GetPackNames(char *buffer, int buffersize, int referencedonly, qboolean
if (referencedonly == 0 && !search->referenced)
continue;
if (referencedonly == 2 && search->referenced)
Q_strncatz(buffer, "*", buffersize);
{
// '*' prefix is meant to mean 'referenced'.
//really all that means to the client is that it definitely wants to download it.
//if its copyrighted, the client shouldn't try to do so, as it won't be allowed.
if (search->copyprotected)
Q_strncatz(buffer, "*", buffersize);
}
if (!ext)
{
@ -1183,7 +1187,7 @@ void COM_LoadCacheFile (const char *path, struct cache_user_s *cu)
}
// uses temp hunk if larger than bufsize
qbyte *COM_LoadStackFile (const char *path, void *buffer, int bufsize)
qbyte *QDECL COM_LoadStackFile (const char *path, void *buffer, int bufsize)
{
qbyte *buf;
@ -1375,7 +1379,7 @@ static int FS_AddWildDataFiles (const char *descriptor, int size, void *vparam)
snprintf (purefile, sizeof(purefile), "%s/%s", param->puredesc, descriptor);
else
Q_strncpyz(purefile, descriptor, sizeof(purefile));
FS_AddPathHandle(purefile, pakfile, funcs, pak, true, false, false, (unsigned int)-1);
FS_AddPathHandle(purefile, pakfile, funcs, pak, !Q_strcasecmp(descriptor, "pak"), false, false, (unsigned int)-1);
return true;
}
@ -1802,12 +1806,15 @@ const gamemode_info_t gamemode_info[] = {
//note that there is no basic 'fte' gamemode, this is because we aim for network compatability. Darkplaces-Quake is the closest we get.
//this is to avoid having too many gamemodes anyway.
//rogue/hipnotic have no special files - the detection conflicts and stops us from running regular quake
//mission packs should generally come after the main game to avoid prefering the main game. we violate this for hexen2 as the mission pack is mostly a superset.
//whereas the quake mission packs replace start.bsp making the original episodes unreachable.
//for quake, we also allow extracting all files from paks. some people think it loads faster that way or something.
//cmdline switch exename protocol name(dpmaster) identifying file exec dir1 dir2 dir3 dir(fte) full name
{"-quake", "q1", "DarkPlaces-Quake", {"id1/pak0.pak",
"id1/quake.rc"}, NULL, {"id1", "qw", "fte"}, "Quake"/*, "id1/pak0.pak|http://quakeservers.nquake.com/qsw106.zip|http://nquake.localghost.net/qsw106.zip|http://qw.quakephil.com/nquake/qsw106.zip|http://fnu.nquake.com/qsw106.zip"*/},
{"-hipnotic", "hipnotic", "Darkplaces-Hipnotic", {NULL}, NULL, {"id1", "qw", "hipnotic", "fte"}, "Quake: Scourge of Armagon"},
{"-rogue", "rogue", "Darkplaces-Rogue", {NULL}, NULL, {"id1", "qw", "rogue", "fte"}, "Quake: Dissolution of Eternity"},
{"-hipnotic", "hipnotic", "Darkplaces-Hipnotic", {"hipnotic/pak0.pak"}, NULL, {"id1", "qw", "hipnotic", "fte"}, "Quake: Scourge of Armagon"},
{"-rogue", "rogue", "Darkplaces-Rogue", {"rogue/pak0.pak"}, NULL, {"id1", "qw", "rogue", "fte"}, "Quake: Dissolution of Eternity"},
{"-nexuiz", "nexuiz", "Nexuiz", {"nexuiz.exe"}, NEXCFG, {"data", "ftedata"}, "Nexuiz"},
{"-xonotic", "xonotic", "Xonotic", {"xonotic.exe"}, NEXCFG, {"data", "ftedata"}, "Xonotic", "data/xonotic-20120308-data.pk3|http://localhost/xonotic-0.6.0.zip"},
{"-spark", "spark", "Spark", {"base/src/progs.src",

View file

@ -10,7 +10,7 @@ extern int fs_hash_files; //for tracking efficiency. no functional use.
typedef struct {
void (*PrintPath)(void *handle);
void (*GetDisplayPath)(void *handle, char *outpath, unsigned int pathsize);
void (*ClosePath)(void *handle);
void (*BuildHash)(void *handle, int depth);
qboolean (*FindFile)(void *handle, flocation_t *loc, const char *name, void *hashedresult); //true if found (hashedresult can be NULL)

View file

@ -54,14 +54,14 @@ typedef struct
#define MAX_FILES_IN_PACK 2048
void FSPAK_PrintPath(void *handle)
void FSPAK_GetDisplayPath(void *handle, char *out, unsigned int outlen)
{
pack_t *pak = handle;
if (pak->references != 1)
Con_Printf("%s (%i)\n", pak->descname, pak->references-1);
Q_snprintfz(out, outlen, "%s (%i)", pak->descname, pak->references-1);
else
Con_Printf("%s\n", pak->descname);
Q_snprintfz(out, outlen, "%s", pak->descname);
}
void FSPAK_ClosePath(void *handle)
{
@ -373,7 +373,7 @@ void FSPAK_ReadFile(void *handle, flocation_t *loc, char *buffer)
}
searchpathfuncs_t packfilefuncs = {
FSPAK_PrintPath,
FSPAK_GetDisplayPath,
FSPAK_ClosePath,
FSPAK_BuildHash,
FSPAK_FLocate,
@ -559,7 +559,7 @@ newsection:
return pack;
}
searchpathfuncs_t doomwadfilefuncs = {
FSPAK_PrintPath,
FSPAK_GetDisplayPath,
FSPAK_ClosePath,
FSPAK_BuildHash,
FSPAK_FLocate,

View file

@ -212,10 +212,10 @@ static vfsfile_t *FSSTDIO_OpenVFS(void *handle, flocation_t *loc, const char *mo
return f;
}
static void FSSTDIO_PrintPath(void *handle)
static void FSSTDIO_GetDisplayPath(void *handle, char *out, unsigned int outlen)
{
stdiopath_t *np = handle;
Con_Printf("%s\n", np->rootpath);
Q_strncpyz(out, np->rootpath, outlen);
}
static void FSSTDIO_ClosePath(void *handle)
{
@ -333,7 +333,7 @@ static int FSSTDIO_EnumerateFiles (void *handle, const char *match, int (*func)(
}
searchpathfuncs_t stdiofilefuncs = {
FSSTDIO_PrintPath,
FSSTDIO_GetDisplayPath,
FSSTDIO_ClosePath,
FSSTDIO_BuildHash,
FSSTDIO_FLocate,

View file

@ -191,10 +191,10 @@ static vfsfile_t *VFSW32_OpenVFS(void *handle, flocation_t *loc, const char *mod
return VFSW32_Open(loc->rawname, mode);
}
static void VFSW32_PrintPath(void *handle)
static void VFSW32_GetDisplayPath(void *handle, char *out, unsigned int outlen)
{
vfsw32path_t *wp = handle;
Con_Printf("%s\n", wp->rootpath);
Q_strncpyz(out, wp->rootpath, outlen);
}
static void VFSW32_ClosePath(void *handle)
{
@ -323,7 +323,7 @@ static int VFSW32_EnumerateFiles (void *handle, const char *match, int (*func)(c
searchpathfuncs_t w32filefuncs = {
VFSW32_PrintPath,
VFSW32_GetDisplayPath,
VFSW32_ClosePath,
VFSW32_BuildHash,
VFSW32_FLocate,

View file

@ -239,14 +239,14 @@ typedef struct zipfile_s
} zipfile_t;
static void FSZIP_PrintPath(void *handle)
static void FSZIP_GetDisplayPath(void *handle, char *out, unsigned int outlen)
{
zipfile_t *zip = handle;
if (zip->references != 1)
Con_Printf("%s (%i)\n", zip->filename, zip->references-1);
Q_snprintfz(out, outlen, "%s (%i)\n", zip->filename, zip->references-1);
else
Con_Printf("%s\n", zip->filename);
Q_strncpyz(out, zip->filename, outlen);
}
static void FSZIP_ClosePath(void *handle)
{
@ -696,7 +696,7 @@ vfsfile_t *FSZIP_OpenVFS(void *handle, flocation_t *loc, const char *mode)
}
searchpathfuncs_t zipfilefuncs = {
FSZIP_PrintPath,
FSZIP_GetDisplayPath,
FSZIP_ClosePath,
FSZIP_BuildHash,
FSZIP_FLocate,

View file

@ -96,6 +96,7 @@ void Log_String (logtype_t lognum, char *s)
char *t;
char logbuf[1024];
int i;
char fname[MAX_QPATH];
if (!log_enable[lognum].value)
return;
@ -179,7 +180,7 @@ void Log_String (logtype_t lognum, char *s)
*t = 0;
f = va("%s/%s.log",d,f); // temp string in va()
Q_snprintfz(fname, sizeof(fname), "%s/%s.log",d,f);
// file rotation
if (log_rotate_size.value >= 4096 && log_rotate_files.value >= 1)
@ -188,7 +189,7 @@ void Log_String (logtype_t lognum, char *s)
vfsfile_t *fi;
// check file size, use x as temp
if ((fi = FS_OpenVFS(f, "rb", FS_ROOT)))
if ((fi = FS_OpenVFS(fname, "rb", FS_ROOT)))
{
x = VFS_GETLEN(fi);
VFS_CLOSE(fi);

View file

@ -64,6 +64,7 @@ extern vec3_t vec3_origin;
#define FloatInterpolate(a, bness, b, c) ((c) = (a) + (b - a)*bness)
#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
#define DotProduct2(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1])
#define DotProduct4(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]+(x)[3]*(y)[3])
#define VectorSubtract(a,b,c) do{(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}while(0)
#define VectorAdd(a,b,c) do{(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}while(0)

View file

@ -192,7 +192,7 @@ void VARGS Netchan_OutOfBandPrint (netsrc_t sock, netadr_t adr, char *format, ..
void VARGS Netchan_OutOfBandTPrintf (netsrc_t sock, netadr_t adr, int language, translation_t text, ...);
qboolean Netchan_Process (netchan_t *chan);
void Netchan_Setup (netsrc_t sock, netchan_t *chan, netadr_t adr, int qport);
unsigned int Net_PextMask(int maskset);
unsigned int Net_PextMask(int maskset, qboolean fornq);
extern cvar_t net_mtu;
qboolean Netchan_CanPacket (netchan_t *chan, int rate);

View file

@ -89,12 +89,12 @@ cvar_t net_mtu = CVARD("net_mtu", "1450", "Specifies a maximum udp payload size,
cvar_t pext_replacementdeltas = CVAR("debug_pext_replacementdeltas", "0"); /*rename once the extension is finalized*/
/*returns the entire bitmask of supported+enabled extensions*/
unsigned int Net_PextMask(int maskset)
unsigned int Net_PextMask(int maskset, qboolean fornq)
{
unsigned int mask = 0;
if (maskset == 1) /*FTEX*/
{
#ifdef PEXT_SCALE //dmw - protocol extensions
#ifdef PEXT_SCALE
mask |= PEXT_SCALE;
#endif
#ifdef PEXT_LIGHTSTYLECOL
@ -166,6 +166,15 @@ unsigned int Net_PextMask(int maskset)
#ifdef PEXT_DPFLAGS
mask |= PEXT_DPFLAGS;
#endif
if (fornq)
{
//only ones that are tested
mask &= PEXT_CSQC | PEXT_FLOATCOORDS | PEXT_HLBSP | PEXT_Q2BSP | PEXT_Q3BSP;
//these all depend fully upon the player/entity deltas, and don't make sense for NQ. Implement PEXT2_REPLACEMENTDELTAS instead.
mask &= ~(PEXT_SCALE|PEXT_TRANS|PEXT_ACCURATETIMINGS|PEXT_FATNESS|PEXT_HULLSIZE|PEXT_MODELDBL|PEXT_ENTITYDBL|PEXT_ENTITYDBL2|PEXT_COLOURMOD|PEXT_SPAWNSTATIC2|PEXT_256PACKETENTITIES|PEXT_SETATTACHMENT|PEXT_DPFLAGS);
}
}
else if (maskset == 2)
{
@ -180,6 +189,12 @@ unsigned int Net_PextMask(int maskset)
if (MAX_CLIENTS != QWMAX_CLIENTS)
mask |= PEXT2_MAXPLAYERS;
if (fornq)
{
//only ones that are tested
mask &= PEXT2_VOICECHAT | PEXT2_REPLACEMENTDELTAS;
}
}
return mask;

View file

@ -1477,6 +1477,7 @@ void Plug_Init(void)
Plug_RegisterBuiltin("Plug_GetEngineFunction", Plug_GetBuiltin, 0);//plugin wishes to find a builtin number.
Plug_RegisterBuiltin("Plug_ExportToEngine", Plug_ExportToEngine, 0); //plugin has a call back that we might be interested in.
Plug_RegisterBuiltin("Plug_ExportNative", Plug_ExportNative, PLUG_BIF_DLLONLY);
Plug_RegisterBuiltin("Plug_GetPluginName", Plug_GetPluginName, 0);
Plug_RegisterBuiltin("Con_Print", Plug_Con_Print, 0); //printf is not possible - qvm floats are never doubles, vararg floats in a cdecl call are always converted to doubles.
Plug_RegisterBuiltin("Sys_Error", Plug_Sys_Error, 0);
Plug_RegisterBuiltin("Sys_Milliseconds", Plug_Sys_Milliseconds, 0);
@ -1622,13 +1623,12 @@ qboolean Plug_Menu_Event(int eventtype, int param) //eventtype = draw/keydown/ke
{
plugin_t *oc=currentplug;
qboolean ret;
extern int mousecursor_x, mousecursor_y;
if (!menuplug)
return false;
currentplug = menuplug;
ret = VM_Call(menuplug->vm, menuplug->menufunction, eventtype, param, mousecursor_x, mousecursor_y);
ret = VM_Call(menuplug->vm, menuplug->menufunction, eventtype, param, (int)mousecursor_x, (int)mousecursor_y);
currentplug=oc;
return ret;
}

File diff suppressed because it is too large Load diff

View file

@ -71,14 +71,14 @@ typedef struct lh_extension_s {
extern lh_extension_t QSG_Extensions[];
extern unsigned int QSG_Extensions_count;
pbool QC_WriteFile(const char *name, void *data, int len);
pbool QDECL QC_WriteFile(const char *name, void *data, int len);
void *VARGS PR_CB_Malloc(int size); //these functions should be tracked by the library reliably, so there should be no need to track them ourselves.
void VARGS PR_CB_Free(void *mem);
void PF_InitTempStrings(progfuncs_t *prinst);
string_t PR_TempString(progfuncs_t *prinst, const char *str); //returns a tempstring containing str
char *PF_TempStr(progfuncs_t *prinst); //returns a tempstring which can be filled in with whatever junk you want.
int PR_Printf (const char *fmt, ...);
void PF_InitTempStrings(pubprogfuncs_t *prinst);
string_t PR_TempString(pubprogfuncs_t *prinst, const char *str); //returns a tempstring containing str
char *PF_TempStr(pubprogfuncs_t *prinst); //returns a tempstring which can be filled in with whatever junk you want.
#define RETURN_SSTRING(s) (((int *)pr_globals)[OFS_RETURN] = PR_SetString(prinst, s)) //static - exe will not change it.
#define RETURN_TSTRING(s) (((int *)pr_globals)[OFS_RETURN] = PR_TempString(prinst, s)) //temp (static but cycle buffers)
@ -89,233 +89,274 @@ int MP_TranslateFTEtoDPCodes(int code);
int MP_TranslateDPtoFTECodes(int code);
//pr_cmds.c builtins that need to be moved to a common.
void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...) LIKEPRINTF(2);
void QCBUILTIN PF_print (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_dprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_error (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_rint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_floor (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ceil (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Tokenize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_tokenizebyseparator (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_tokenize_console (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ArgV (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_argv_start_index (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_argv_end_index (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_FindString (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_nextent (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Sin (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Cos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Sqrt (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bound (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strlen(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strcat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ftos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_fabs (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_vtos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_etos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_stof (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_mod (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_substring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_stov (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_dupstring(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_forgetstring(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Spawn (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_min (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_max (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_registercvar (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_pow (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_asin (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_acos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_atan (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_atan2 (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_tan (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_localcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_sprintf (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_random (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_fclose (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_fputs (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_fgets (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_normalize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_vlen (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_vectoyaw (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_vectoangles (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_rotatevectorsbyangles (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_rotatevectorsbymatrix (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchain (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchainfloat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_coredump (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_traceon (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_traceoff (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_eprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void search_close_progs(progfuncs_t *prinst, qboolean complain);
void QCBUILTIN PF_search_begin (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_search_end (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_search_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_search_getfilename (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_isfunction (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_callfunction (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_writetofile(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_loadfromfile (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_loadfromdata (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_parseentitydata(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WasFreed (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_break (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_crc16 (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_type (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_uri_escape (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_uri_unescape (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_uri_get (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_itos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_stoi (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_stoh (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_htos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PR_fclose_progs (progfuncs_t *prinst);
char *PF_VarString (progfuncs_t *prinst, int first, struct globalvars_s *pr_globals);
void PR_AutoCvarSetup(progfuncs_t *prinst);
void PR_AutoCvar(progfuncs_t *prinst, cvar_t *var);
void QCBUILTIN PF_numentityfields (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_entityfieldname (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_entityfieldtype (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getentityfieldstring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_putentityfieldstring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void VARGS PR_BIError(pubprogfuncs_t *progfuncs, char *format, ...) LIKEPRINTF(2);
void QCBUILTIN PF_print (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_dprint (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_error (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_rint (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_floor (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ceil (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Tokenize (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_tokenizebyseparator (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_tokenize_console (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ArgV (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_argv_start_index (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_argv_end_index (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_FindString (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_nextent (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Sin (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Cos (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Sqrt (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bound (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strlen(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strcat (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ftos (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_fabs (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_vtos (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_etos (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_stof (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_mod (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_substring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_stov (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_dupstring(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_forgetstring(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Spawn (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_min (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_max (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_registercvar (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_pow (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_asin (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_acos (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_atan (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_atan2 (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_tan (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_localcmd (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_sprintf (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_random (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_fclose (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_fputs (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_fgets (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_normalize (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_vlen (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_vectoyaw (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_vectoangles (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_rotatevectorsbyangles (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_rotatevectorsbymatrix (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchain (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchainfloat (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_coredump (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_traceon (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_traceoff (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_eprint (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_search_begin (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_search_end (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_search_getsize (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_search_getfilename (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_isfunction (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_callfunction (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_writetofile(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_loadfromfile (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_loadfromdata (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_parseentitydata(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WasFreed (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_break (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_crc16 (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_type (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_uri_escape (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_uri_unescape (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_uri_get (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_itos (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_stoi (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_stoh (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_htos (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void PR_fclose_progs (pubprogfuncs_t *prinst);
char *PF_VarString (pubprogfuncs_t *prinst, int first, struct globalvars_s *pr_globals);
void PR_AutoCvarSetup(pubprogfuncs_t *prinst);
void PR_AutoCvar(pubprogfuncs_t *prinst, cvar_t *var);
void QCBUILTIN PF_numentityfields (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_entityfieldname (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_entityfieldtype (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getentityfieldstring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_putentityfieldstring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacenumpoints(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacepoint(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacenormal(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacetexture(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacenearpoint(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfaceclippedpoint(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacenumtriangles(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacetriangle(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacepointattribute(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_set_bone_world (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_mmap(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_ragedit(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_create (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_build (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_get_numbones (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_get_bonename (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_get_boneparent (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_find_bone (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_get_bonerel (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_get_boneabs (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_set_bone (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_mul_bone (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_mul_bones (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_copybones (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_delete (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_frametoname (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skintoname (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_frameforname (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_frameduration (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skinforname (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void skel_lookup(progfuncs_t *prinst, int skelidx, framestate_t *out);
void skel_dodelete(progfuncs_t *prinst);
void skel_reset(progfuncs_t *prinst);
void QCBUILTIN PF_gettaginfo (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_gettagindex (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_terrain_edit(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_touchtriggers(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacenumpoints(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacepoint(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacenormal(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacetexture(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacenearpoint(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfaceclippedpoint(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacenumtriangles(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacetriangle(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsurfacepointattribute(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
#ifndef SKELETALOBJECTS
#define PF_gettaginfo PF_Fixme
#define PF_gettagindex PF_Fixme
#define PF_skintoname PF_Fixme
#define PF_frametoname PF_Fixme
#define PF_skel_set_bone_world PF_Fixme
#define PF_skel_mmap PF_Fixme
#define PF_skel_ragedit PF_Fixme
#define PF_frameduration PF_Fixme
#define PF_frameforname PF_Fixme
#define PF_skel_delete PF_Fixme
#define PF_skel_copybones PF_Fixme
#define PF_skel_mul_bones PF_Fixme
#define PF_skel_mul_bone PF_Fixme
#define PF_skel_set_bone PF_Fixme
#define PF_skel_get_boneabs PF_Fixme
#define PF_skel_get_bonerel PF_Fixme
#define PF_skel_find_bone PF_Fixme
#define PF_skel_get_boneparent PF_Fixme
#define PF_skel_get_bonename PF_Fixme
#define PF_skel_get_numbones PF_Fixme
#define PF_skel_build PF_Fixme
#define PF_skel_create PF_Fixme
#define PF_skinforname PF_Fixme
#else
void QCBUILTIN PF_skel_set_bone_world (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_mmap(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_ragedit(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_create (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_build (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_get_numbones (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_get_bonename (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_get_boneparent (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_find_bone (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_get_bonerel (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_get_boneabs (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_set_bone (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_mul_bone (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_mul_bones (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_copybones (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skel_delete (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_frametoname (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skintoname (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_frameforname (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_frameduration (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_skinforname (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_gettaginfo (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_gettagindex (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
#endif
#if defined(SKELETALOBJECTS) || defined(RAGDOLL)
void skel_lookup(pubprogfuncs_t *prinst, int skelidx, framestate_t *out);
void skel_dodelete(pubprogfuncs_t *prinst);
void skel_reset(pubprogfuncs_t *prinst);
#endif
void QCBUILTIN PF_terrain_edit(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_touchtriggers(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
//pr_cmds.c builtins that need to be moved to a common.
void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...) LIKEPRINTF(2);
void QCBUILTIN PF_cvar_string (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_setf (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ArgC (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_randomvec (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strreplace (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strireplace (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_randomvector (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_fopen (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void VARGS PR_BIError(pubprogfuncs_t *progfuncs, char *format, ...) LIKEPRINTF(2);
void QCBUILTIN PF_cvar_string (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_set (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_setf (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ArgC (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_randomvec (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strreplace (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strireplace (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_randomvector (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_fopen (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_FindString (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_FindFloat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_FindFlags (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchain (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchainfloat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchainflags (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bitshift(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_FindString (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_FindFloat (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_FindFlags (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchain (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchainfloat (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchainflags (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bitshift(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Abort(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_externcall (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_externrefcall (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_externvalue (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_externset (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_instr (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Abort(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_externcall (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_externrefcall (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_externvalue (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_externset (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_instr (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strlennocol (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strdecolorize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strtolower (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strtoupper (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strftime (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strlennocol (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strdecolorize (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strtolower (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strtoupper (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strftime (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strstrofs (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_str2chr (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_chr2str (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strconv (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_infoadd (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_infoget (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strncmp (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strcasecmp (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strncasecmp (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strpad (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strstrofs (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_str2chr (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_chr2str (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strconv (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_infoadd (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_infoget (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strncmp (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strcasecmp (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strncasecmp (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strpad (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_edict_for_num (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_num_for_edict (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_defstring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_description (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_digest_hex (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_edict_for_num (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_num_for_edict (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_defstring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cvar_description (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
//these functions are from pr_menu.dat
void QCBUILTIN PF_CL_is_cached_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_precache_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_free_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawcharacter (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawrawstring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawcolouredstring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawline (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawfill (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawsetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawresetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawgetimagesize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_stringwidth (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawsubpic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_is_cached_pic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_precache_pic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_free_pic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawcharacter (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawrawstring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawcolouredstring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawpic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawline (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawfill (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawsetcliparea (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawresetcliparea (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawgetimagesize (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_stringwidth (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_drawsubpic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_findfont (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_CL_loadfont (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
#if defined(CSQC_DAT) && !defined(SERVERONLY)
void QCBUILTIN PF_R_PolygonBegin(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_R_PolygonVertex(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_R_PolygonEnd(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
#else
#define PF_R_PolygonBegin PF_Fixme
#define PF_R_PolygonVertex PF_Fixme
#define PF_R_PolygonEnd PF_Fixme
#endif
void QCBUILTIN PF_cl_getmousepos (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cl_getmousepos (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cl_keynumtostring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cl_findkeysforcommand (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cl_stringtokeynum(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cl_getkeybind (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cl_keynumtostring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cl_findkeysforcommand (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cl_stringtokeynum(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_cl_getkeybind (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void search_close_progs(progfuncs_t *prinst, qboolean complain);
void search_close_progs(pubprogfuncs_t *prinst, qboolean complain);
void QCBUILTIN PF_buf_create (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_del (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_getsize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_copy (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_sort (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_implode (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bufstr_get (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bufstr_set (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bufstr_add (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bufstr_free (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_cvarlist (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_create (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_del (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_getsize (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_copy (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_sort (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_implode (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bufstr_get (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bufstr_set (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bufstr_add (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_bufstr_free (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_buf_cvarlist (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_memalloc (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_memfree (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_memcpy (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_memset (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_memalloc (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_memfree (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_memcpy (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_memset (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_calltimeofday (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_calltimeofday (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_whichpack (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_whichpack (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_fclose_progs (progfuncs_t *prinst);
int QCEditor (progfuncs_t *prinst, char *filename, int line, int statement, int nump, char **parms);
int QDECL QCEditor (pubprogfuncs_t *prinst, char *filename, int line, int statement, int nump, char **parms);
void PR_Common_Shutdown(pubprogfuncs_t *progs, qboolean errored);
@ -325,33 +366,33 @@ int QCEditor (progfuncs_t *prinst, char *filename, int line, int statement, int
#ifdef VM_Q1
model_t *SVPR_GetCModel(world_t *w, int modelindex);
void SVPR_Event_Touch(world_t *w, wedict_t *s, wedict_t *o);
void QCBUILTIN PF_WriteByte (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteChar (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteShort (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteLong (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteAngle (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteCoord (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteFloat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteEntity (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_multicast (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_svtraceline (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_changelevel (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteByte (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteChar (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteShort (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteLong (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteAngle (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteCoord (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteFloat (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_WriteEntity (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_multicast (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_svtraceline (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_changelevel (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_applylightstyle(int style, char *val, int col);
void PF_ambientsound_Internal (float *pos, char *samp, float vol, float attenuation);
void QCBUILTIN PF_makestatic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_logfrag (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ExecuteCommand (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_setspawnparms (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ForceInfoKey(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_precache_vwep_model(progfuncs_t *prinst, struct globalvars_s *pr_globals);
int PF_checkclient_Internal (progfuncs_t *prinst);
void PF_precache_sound_Internal (progfuncs_t *prinst, char *s);
int PF_precache_model_Internal (progfuncs_t *prinst, char *s, qboolean queryonly);
void PF_setmodel_Internal (progfuncs_t *prinst, edict_t *e, char *m);
void QCBUILTIN PF_makestatic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_logfrag (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ExecuteCommand (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_setspawnparms (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_ForceInfoKey(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_precache_vwep_model(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
int PF_checkclient_Internal (pubprogfuncs_t *prinst);
void PF_precache_sound_Internal (pubprogfuncs_t *prinst, char *s);
int PF_precache_model_Internal (pubprogfuncs_t *prinst, char *s, qboolean queryonly);
void PF_setmodel_Internal (pubprogfuncs_t *prinst, edict_t *e, char *m);
char *PF_infokey_Internal (int entnum, char *value);
void PF_centerprint_Internal (int entnum, qboolean plaque, char *s);
void PF_WriteString_Internal (int target, char *str);
pbool ED_CanFree (edict_t *ed);
pbool QDECL ED_CanFree (edict_t *ed);
#endif
#define MOVETYPE_NONE 0 // never moves
@ -384,6 +425,7 @@ pbool ED_CanFree (edict_t *ed);
#define SOLID_PHYSICS_BOX 32 ///< physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)
#define SOLID_PHYSICS_SPHERE 33 ///< physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)
#define SOLID_PHYSICS_CAPSULE 34 ///< physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)
#define SOLID_PHYSICS_CYLINDER 35
#define JOINTTYPE_POINT 1
@ -397,6 +439,11 @@ pbool ED_CanFree (edict_t *ed);
#define DAMAGE_YES 1
#define DAMAGE_AIM 2
#define CLIENTTYPE_DISCONNECTED 0
#define CLIENTTYPE_REAL 1
#define CLIENTTYPE_BOT 2
#define CLIENTTYPE_NOTACLIENT 3
//shared constants
typedef enum
{

View file

@ -243,7 +243,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svcfte_modellistshort 60 // [strings]
#endif
#define svc_ftesetclientpersist 61 //ushort DATA
//#define svc_ftesetclientpersist 61 //ushort DATA
#define svc_setportalstate 62
@ -517,12 +517,13 @@ enum clcq2_ops_e
#endif
//first byte contains the stuff that's most likely to change constantly*/
//FTE Replacement Deltas
//first byte contains the stuff that's most likely to change constantly
#define UF_FRAME (1u<<0)
#define UF_ORIGINXY (1u<<1)
#define UF_ORIGINZ (1u<<2)
#define UF_ANGLESXZ (1u<<4)
#define UF_ANGLESY (1u<<3)
#define UF_ANGLESXZ (1u<<3)
#define UF_ANGLESY (1u<<4)
#define UF_EFFECTS (1u<<5)
#define UF_PREDINFO (1u<<6) /*ent is predicted, probably a player*/
#define UF_EXTEND1 (1u<<7)
@ -548,7 +549,7 @@ enum clcq2_ops_e
#define UF_EXTEND3 (1u<<23)
#define UF_COLORMOD (1u<<24)
#define UF_GLOWMOD (1u<<25)
#define UF_GLOW (1u<<25)
#define UF_FATNESS (1u<<26)
#define UF_MODELINDEX2 (1u<<27)
#define UF_GRAVITYDIR (1u<<28)
@ -674,6 +675,12 @@ enum clcq2_ops_e
#define DEFAULT_SOUND_PACKET_VOLUME 255
#define DEFAULT_SOUND_PACKET_ATTENUATION 1.0
//baseline flags
#define FITZ_B_LARGEMODEL (1<<0)
#define FITZ_B_LARGEFRAME (1<<1)
#define FITZ_B_ALPHA (1<<2)
#define RMQFITZ_B_SCALE (1<<3)
#define DEFAULT_VIEWHEIGHT 22
@ -701,17 +708,19 @@ enum {
TE_LAVASPLASH = 10,
TE_TELEPORT = 11,
TEQW_BLOOD = 12,
TENQ_EXPLOSION2 = 12,
TEQW_LIGHTNINGBLOOD = 13,
TENQ_BEAM = 13,
TEQW_BLOOD = 12, //implemented as a particle() in nq
TENQ_EXPLOSION2 = 12, //remapped to TEQW_EXPLOSION2 for qw
TEQW_LIGHTNINGBLOOD = 13, //implemented as a particle() in nq
TENQ_BEAM = 13, //remapped to TEQW_BEAM for qw
#ifdef PEXT_TE_BULLET
TE_BULLET = 14,
TE_SUPERBULLET = 15,
#endif
TE_RAILTRAIL = 17,
TE_RAILTRAIL = 17, //use the builtin, luke.
TEQW_BEAM = 18, //use the builtin, luke.
TEQW_EXPLOSION2 = 19, //use the builtin, luke.
// hexen 2
TEH2_STREAM_LIGHTNING_SMALL = 24,
@ -796,10 +805,12 @@ enum {
typedef struct entity_state_s
{
unsigned short number; // edict index
unsigned short modelindex;
unsigned int number; // edict index
unsigned int flags; // nolerp, etc
unsigned short modelindex;
unsigned short inactiveflag;
// unsigned int eflags; // nolerp, etc
unsigned int effects;
@ -812,6 +823,7 @@ typedef struct entity_state_s
{
int renderfx; //q2
vec3_t old_origin; //q2/q3
qbyte modelindex3; //q2
qbyte modelindex4; //q2
qbyte sound; //q2
@ -824,8 +836,10 @@ typedef struct entity_state_s
qbyte pmovetype;
qbyte msec;
unsigned short weaponframe;
short movement[3];
short velocity[3]; // 1/8th
unsigned char gravitydir[2]; //pitch/yaw, no roll
unsigned short traileffectnum;
} q1;
@ -1441,7 +1455,3 @@ typedef struct q1usercmd_s
#define E5_EXTEND4 (1<<31)
#define E5_ALLUNUSED (E5_UNUSED25|E5_UNUSED26|E5_UNUSED27|E5_UNUSED28|E5_UNUSED29|E5_UNUSED30)
#define FITZB_LARGEMODEL (1<<0) // modelindex is short instead of byte
#define FITZB_LARGEFRAME (1<<1) // frame is short instead of byte
#define FITZB_ALPHA (1<<2) // 1 byte, uses ENTALPHA_ENCODE, not sent if ENTALPHA_DEFAULT

View file

@ -1529,12 +1529,13 @@ static void Q3BSP_ClipDecalToNodes (fragmentdecal_t *dec, mnode_t *node)
int Q1BSP_ClipDecal(vec3_t center, vec3_t normal, vec3_t tangent1, vec3_t tangent2, float size, float **out)
{ //quad marks a full, independant quad
int p;
float r;
fragmentdecal_t dec;
VectorCopy(center, dec.center);
VectorCopy(normal, dec.normal);
dec.radius = size/2;
dec.numtris = 0;
dec.radius = 0;
VectorCopy(tangent1, dec.planenorm[0]);
VectorNegate(tangent1, dec.planenorm[1]);
@ -1543,7 +1544,14 @@ int Q1BSP_ClipDecal(vec3_t center, vec3_t normal, vec3_t tangent1, vec3_t tangen
VectorCopy(dec.normal, dec.planenorm[4]);
VectorNegate(dec.normal, dec.planenorm[5]);
for (p = 0; p < 6; p++)
dec.planedist[p] = -(dec.radius - DotProduct(dec.center, dec.planenorm[p]));
{
r = sqrt(DotProduct(dec.planenorm[p], dec.planenorm[p]));
VectorScale(dec.planenorm[p], 1/r, dec.planenorm[p]);
r*= size/2;
if (r > dec.radius)
dec.radius = r;
dec.planedist[p] = -(r - DotProduct(dec.center, dec.planenorm[p]));
}
dec.numplanes = 6;
sh_shadowframe++;

View file

@ -159,7 +159,7 @@ struct world_s
unsigned int num_edicts; // increases towards MAX_EDICTS
/*FTE_DEPRECATED*/ unsigned int edict_size; //still used in copyentity
wedict_t *edicts; // can NOT be array indexed.
struct progfuncs_s *progs;
struct pubprogfuncs_s *progs;
qboolean usesolidcorpse; //to disable SOLID_CORPSE when running hexen2 due to conflict.
model_t *worldmodel;
areanode_t areanodes[AREA_NODES];
@ -189,6 +189,10 @@ struct world_s
float *v_forward;
float *v_right;
float *v_up;
//used by menu+csqc.
float *drawfont;
float *drawfontscale;
} g;
#ifdef USEODE
@ -208,10 +212,13 @@ void World_ODE_Start(world_t *world);
void World_ODE_End(world_t *world);
void World_ODE_Shutdown(void);
qboolean World_ODE_RagCreateBody(world_t *world, odebody_t *bodyptr, float *mat, wedict_t *ed);
void World_ODE_RagDestroyBody(world_t *world, odebody_t *bodyptr);
qboolean World_ODE_RagCreateBody(world_t *world, odebody_t *bodyptr, odebodyinfo_t *bodyinfo, float *mat, wedict_t *ent);
qboolean World_ODE_RagMatrixToBody(odebody_t *bodyptr, float *mat);
void World_ODE_RagMatrixFromBody(world_t *world, odebody_t *bodyptr, float *mat);
void World_ODE_RagDestroyBody(world_t *world, odebody_t *bodyptr);
void World_ODE_RagCreateJoint(world_t *world, odejoint_t *joint, odejointinfo_t *info, odebody_t *body1, odebody_t *body2, vec3_t aaa2[3]);
void World_ODE_RagEnableJoint(odejoint_t *joint, qboolean enabled);
void World_ODE_RagMatrixFromJoint(odejoint_t *joint, odejointinfo_t *info, float *mat);
void World_ODE_RagDestroyJoint(world_t *world, odejoint_t *joint);
#endif
@ -275,3 +282,5 @@ qboolean World_CheckBottom (world_t *world, wedict_t *ent);
qboolean World_movestep (world_t *world, wedict_t *ent, vec3_t move, qboolean relink, qboolean noenemy, void (*set_move_trace)(trace_t *trace, struct globalvars_s *pr_globals), struct globalvars_s *set_trace_globs);
qboolean World_MoveToGoal (world_t *world, wedict_t *ent, float dist);
void WPhys_Init(void);
void World_Physics_Frame(world_t *w);

View file

@ -29,9 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define NOZONE
#define NOCACHE
#ifdef _WIN32
#define NOHIGH
#endif
void Cache_FreeLow (int new_low_hunk);
void Cache_FreeHigh (int new_high_hunk);
@ -1204,15 +1201,24 @@ typedef struct
int size; // including sizeof(hunk_t), -1 = not allocated
char name[8];
} hunk_t;
typedef struct hunkoverflow_s
{
struct hunkoverflow_s *prev;
struct hunkoverflow_s *next;
hunk_t hunk[0];
} hunkoverflow_t;
qbyte *hunk_base;
int hunk_size;
static hunkoverflow_t *hunkoverflow_first;
static hunkoverflow_t *hunkoverflow_top;
int hunk_low_used;
int hunk_high_used;
static qbyte *hunk_base;
static int hunk_size;
qboolean hunk_tempactive;
int hunk_tempmark;
static int hunk_low_used;
static int hunk_high_used;
static qboolean hunk_tempactive;
static int hunk_tempmark;
void R_FreeTextures (void);
@ -1363,10 +1369,8 @@ Hunk_AllocName
*/
void *Hunk_AllocName (int size, char *name)
{
#ifdef NOHIGH
int roundup;
int roundupold;
#endif
hunk_t *h;
#ifdef PARANOID
@ -1375,39 +1379,54 @@ void *Hunk_AllocName (int size, char *name)
if (size < 0)
Sys_Error ("Hunk_Alloc: bad size: %i", size);
size = sizeof(hunk_t) + HUNKDEBUG*2 + ((size+15)&~15);
size = sizeof(hunk_t) + HUNKDEBUG*2 + size;
size = (size + 15) & ~15;
#ifndef _WIN32
if (hunk_size - hunk_low_used - hunk_high_used < size)
// Sys_Error ("Hunk_Alloc: failed on %i bytes",size);
#ifdef _WIN32
Sys_Error ("Not enough RAM allocated on allocation of \"%s\". Try starting using \"-heapsize 16000\" on the QuakeWorld command line.", name);
#else
Sys_Error ("Not enough RAM allocated. Try starting using \"-mem %u\" on the QuakeWorld command line.", (hunk_size + 8*1024*1024) / 1024*1024);
#endif
#endif
{
Sys_Error ("Not enough RAM allocated. Try starting using \"-mem %u\" on the " FULLENGINENAME " command line.", (hunk_size + 8*1024*1024) / 1024*1024);
}
h = (hunk_t *)(hunk_base + hunk_low_used);
#ifdef NOHIGH
roundupold = hunk_low_used+sizeof(hunk_t);
roundupold = hunk_low_used;
roundupold += 1024*128;
roundupold &= ~(1024*128 - 1);
roundup = hunk_low_used+size+sizeof(hunk_t);
roundup = hunk_low_used+size;
roundup += 1024*128;
roundup &= ~(1024*128 - 1);
if (!hunk_low_used || roundup != roundupold)
if (!VirtualAlloc (hunk_base, roundup, MEM_COMMIT, PAGE_READWRITE))
if (hunkoverflow_top || roundup > hunk_size)
{
char *buf;
Hunk_Print(true);
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &buf, 0, NULL);
Sys_Error ("VirtualCommit failed\nNot enough RAM allocated on allocation of \"%s\". Try starting using \"-heapsize %i\" on the QuakeWorld command line.", name, roundupold/512);
hunkoverflow_t *newtop;
newtop = BZ_Malloc(sizeof(*newtop)+size);
newtop->next = NULL;
if (!hunkoverflow_top)
{
hunkoverflow_top = hunkoverflow_first = newtop;
newtop->prev = NULL;
}
else
{
hunkoverflow_top->next = newtop;
newtop->prev = hunkoverflow_top;
hunkoverflow_top = newtop;
}
h = newtop->hunk;
}
#ifdef _WIN32
else
{
if (!hunk_low_used || roundup != roundupold)
if (!VirtualAlloc (hunk_base, roundup, MEM_COMMIT, PAGE_READWRITE))
{
char *buf;
Hunk_Print(true);
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &buf, 0, NULL);
Sys_Error ("VirtualCommit failed\nNot enough RAM allocated on allocation of \"%s\". Try starting using \"-heapsize %i\" on the " FULLENGINENAME " command line.", name, roundupold/512);
}
}
#endif
@ -1453,10 +1472,26 @@ void Hunk_FreeToLowMark (int mark)
{
if (mark < 0 || mark > hunk_low_used)
Sys_Error ("Hunk_FreeToLowMark: bad mark %i", mark);
while(hunkoverflow_top)
{
if (mark > hunk_size)
{
hunkoverflow_t *top = hunkoverflow_top;
mark -= top->hunk[0].size;
hunk_low_used -= top->hunk[0].size;
hunkoverflow_top = top->prev;
hunkoverflow_top->next = NULL;
BZ_Free(top);
}
else
return;
}
memset (hunk_base + mark, 0, hunk_low_used - mark);
hunk_low_used = mark;
#ifdef NOHIGH
#ifdef _WIN32
if (!VirtualAlloc (hunk_base, hunk_low_used+sizeof(hunk_t), MEM_COMMIT, PAGE_READWRITE))
{
char *buf;
@ -1466,81 +1501,6 @@ void Hunk_FreeToLowMark (int mark)
#endif
}
int Hunk_HighMark (void)
{
if (hunk_tempactive)
{
hunk_tempactive = false;
Hunk_FreeToHighMark (hunk_tempmark);
}
return hunk_high_used;
}
void Hunk_FreeToHighMark (int mark)
{
if (hunk_tempactive)
{
hunk_tempactive = false;
Hunk_FreeToHighMark (hunk_tempmark);
}
if (mark < 0 || mark > hunk_high_used)
Sys_Error ("Hunk_FreeToHighMark: bad mark %i", mark);
memset (hunk_base + hunk_size - hunk_high_used, 0, hunk_high_used - mark);
hunk_high_used = mark;
}
/*
===================
Hunk_HighAllocName
===================
*/
void *Hunk_HighAllocName (int size, char *name)
{
#ifdef NOHIGH
Sys_Error("High hunk was disabled");
return NULL;
#else
hunk_t *h;
if (size < 0)
Sys_Error ("Hunk_HighAllocName: bad size: %i", size);
if (hunk_tempactive)
{
Hunk_FreeToHighMark (hunk_tempmark);
hunk_tempactive = false;
}
#ifdef PARANOID
Hunk_Check ();
#endif
size = sizeof(hunk_t) + ((size+15)&~15);
if (hunk_size - hunk_low_used - hunk_high_used < size)
{
Con_Printf ("Hunk_HighAlloc: failed on %i bytes\n",size);
return NULL;
}
hunk_high_used += size;
Cache_FreeHigh (hunk_high_used);
h = (hunk_t *)(hunk_base + hunk_size - hunk_high_used);
memset (h, 0, size);
h->size = size;
h->sentinal = HUNK_SENTINAL;
Q_strncpyz (h->name, name, sizeof(h->name));
return (void *)(h+1);
#endif
}
/*
=================
Hunk_TempAlloc
@ -1549,7 +1509,6 @@ Return space from the top of the hunk
clears old temp.
=================
*/
#ifdef NOHIGH
typedef struct hnktemps_s {
struct hnktemps_s *next;
#if TEMPDEBUG>0
@ -1589,7 +1548,6 @@ void Hunk_TempFree(void)
hnktemps = nt;
}
}
#endif
//allocates without clearing previous temp.
@ -1597,7 +1555,6 @@ void Hunk_TempFree(void)
void *Hunk_TempAllocMore (int size)
{
void *buf;
#ifdef NOHIGH
#if TEMPDEBUG>0
hnktemps_t *nt;
nt = (hnktemps_t*)malloc(size + sizeof(hnktemps_t) + TEMPDEBUG*2);
@ -1623,48 +1580,14 @@ void *Hunk_TempAllocMore (int size)
memset(buf, 0, size);
return buf;
#endif
#else
if (!hunk_tempactive)
return Hunk_TempAlloc(size);
size = (size+15)&~15;
hunk_tempactive = false; //so it doesn't wipe old temp.
buf = Hunk_HighAllocName (size, "mtmp");
hunk_tempactive = true;
return buf;
#endif
}
void *Hunk_TempAlloc (int size)
{
#ifdef NOHIGH
Hunk_TempFree();
return Hunk_TempAllocMore(size);
#else
void *buf;
size = (size+15)&~15;
if (hunk_tempactive)
{
Hunk_FreeToHighMark (hunk_tempmark);
hunk_tempactive = false;
}
hunk_tempmark = Hunk_HighMark ();
buf = Hunk_HighAllocName (size, "temp");
hunk_tempactive = true;
return buf;
#endif
}
/*
@ -1743,6 +1666,10 @@ void *Cache_Check(cache_user_t *c)
void Cache_Flush(void)
{
//this generically named function is hyjacked to flush models and sounds, as well as ragdolls etc
#ifdef RAGDOLL
rag_flushdolls(true);
#endif
#ifndef SERVERONLY
S_Purge(false);
#endif
@ -1756,31 +1683,57 @@ void *Cache_Alloc (cache_user_t *c, int size, char *name)
{
void *buf;
cache_system_t *nt;
if (c->data)
Sys_Error ("Cache_Alloc: already allocated");
qboolean resize = false;
if (size <= 0)
Sys_Error ("Cache_Alloc: size %i", size);
// size = (size + 15) & ~15;
if (c->data)
{
Sys_Error ("Cache_Alloc: %s already allocated", name);
/*
//resize instead
nt = c->data;
nt--;
nt = (cache_system_t*)BZ_Realloc(nt, size + sizeof(cache_system_t) + CACHEDEBUG*2);
resize = true;*/
}
else
{
// size = (size + 15) & ~15;
nt = (cache_system_t*)BZ_Malloc(size + sizeof(cache_system_t) + CACHEDEBUG*2);
}
nt = (cache_system_t*)BZ_Malloc(size + sizeof(cache_system_t) + CACHEDEBUG*2);
if (!nt)
Sys_Error("Cache_Alloc: failed on allocation of %i bytes", size);
nt->next = cache_head;
nt->prev = NULL;
if (resize)
{
if (nt->next)
nt->next->prev = nt;
if (nt->prev)
nt->prev->next = nt;
else
cache_head = nt;
}
else
{
nt->next = cache_head;
nt->prev = NULL;
if (cache_head)
cache_head->prev = nt;
cache_head = nt;
}
nt->user = c;
nt->size = size;
Q_strncpyz(nt->name, name, sizeof(nt->name));
if (cache_head)
cache_head->prev = nt;
cache_head = nt;
nt->user->fake = false;
buf = (void *)(nt+1);
memset(buf, sentinalkey, CACHEDEBUG);
buf = (char*)buf+CACHEDEBUG;
memset(buf, 0, size);
if (!resize)
memset(buf, 0, size);
memset((char *)buf+size, sentinalkey, CACHEDEBUG);
c->data = buf;
return c->data;
@ -2258,9 +2211,7 @@ void Memory_Init (void *buf, int size)
void Memory_DeInit(void)
{
#ifdef NOHIGH
Hunk_TempFree();
#endif
Cache_Flush();
#ifdef MULTITHREAD

View file

@ -121,15 +121,10 @@ void BZ_Free(void *ptr);
void *Hunk_Alloc (int size); // returns 0 filled memory
void *Hunk_AllocName (int size, char *name);
void *Hunk_HighAllocName (int size, char *name);
int Hunk_LowMark (void);
void Hunk_FreeToLowMark (int mark);
int Hunk_LowMemAvailable(void);
int Hunk_HighMark (void);
void Hunk_FreeToHighMark (int mark);
void *Hunk_TempAlloc (int size);
void *Hunk_TempAllocMore (int size); //Don't clear old temp

View file

@ -33,7 +33,7 @@ Things to improve:
#define FORCESTATE
//#define FORCESTATE
#ifdef FORCESTATE
#pragma warningmsg("D3D9 FORCESTATE is active")
@ -156,6 +156,7 @@ typedef struct
float curtime;
const entity_t *curentity;
const dlight_t *curdlight;
batch_t *curbatch, dummybatch;
vec3_t curdlight_colours;
shader_t *curshader;
texnums_t *curtexnums;
@ -193,6 +194,10 @@ typedef struct
unsigned int dyncol_offs;
unsigned int dyncol_size;
IDirect3DVertexBuffer9 *dynnorm_buff;
unsigned int dynnorm_offs;
unsigned int dynnorm_size;
IDirect3DIndexBuffer9 *dynidx_buff;
unsigned int dynidx_offs;
unsigned int dynidx_size;
@ -449,6 +454,9 @@ void D3D9BE_Reset(qboolean before)
IDirect3DVertexBuffer9_Release(shaderstate.dynst_buff[tmu]);
shaderstate.dynst_buff[tmu] = NULL;
}
if (shaderstate.dynnorm_buff)
IDirect3DVertexBuffer9_Release(shaderstate.dynnorm_buff);
shaderstate.dynnorm_buff = NULL;
if (shaderstate.dyncol_buff)
IDirect3DVertexBuffer9_Release(shaderstate.dyncol_buff);
shaderstate.dyncol_buff = NULL;
@ -559,6 +567,7 @@ void D3D9BE_Reset(qboolean before)
IDirect3DDevice9_CreateVertexBuffer(pD3DDev9, shaderstate.dynxyz_size, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &shaderstate.dynxyz_buff, NULL);
for (tmu = 0; tmu < D3D_VDEC_ST0; tmu++)
IDirect3DDevice9_CreateVertexBuffer(pD3DDev9, shaderstate.dynst_size, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &shaderstate.dynst_buff[tmu], NULL);
IDirect3DDevice9_CreateVertexBuffer(pD3DDev9, shaderstate.dynnorm_size, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &shaderstate.dynnorm_buff, NULL);
IDirect3DDevice9_CreateVertexBuffer(pD3DDev9, shaderstate.dyncol_size, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &shaderstate.dyncol_buff, NULL);
IDirect3DDevice9_CreateIndexBuffer(pD3DDev9, shaderstate.dynidx_size, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, D3DFMT_QINDEX, D3DPOOL_DEFAULT, &shaderstate.dynidx_buff, NULL);
@ -599,6 +608,7 @@ void D3D9BE_Init(void)
shaderstate.dynxyz_size = sizeof(vecV_t) * DYNVBUFFSIZE;
shaderstate.dyncol_size = sizeof(byte_vec4_t) * DYNVBUFFSIZE;
shaderstate.dynnorm_size = sizeof(vec3_t)*3 * DYNVBUFFSIZE;
shaderstate.dynst_size = sizeof(vec2_t) * DYNVBUFFSIZE;
shaderstate.dynidx_size = sizeof(index_t) * DYNIBUFFSIZE;
@ -1680,9 +1690,9 @@ static void BE_ApplyUniforms(program_t *prog, int permu)
case SP_M_VIEW:
IDirect3DDevice9_SetVertexShaderConstantF(pD3DDev9, h, r_refdef.m_view, 4);
break;
// case SP_M_MODEL:
// IDirect3DDevice9_SetVertexShaderConstantF(pD3DDev9, h, r_refdef.m_view, 4);
// break;
case SP_M_MODEL:
IDirect3DDevice9_SetVertexShaderConstantF(pD3DDev9, h, shaderstate.m_model, 4);
break;
case SP_V_EYEPOS:
IDirect3DDevice9_SetPixelShaderConstantF(pD3DDev9, h, r_origin, 1);
@ -1720,7 +1730,7 @@ static void BE_ApplyUniforms(program_t *prog, int permu)
Matrix4_Invert(shaderstate.m_model, inv);
Matrix4x4_CM_Transform3(inv, shaderstate.curdlight->origin, t2);
IDirect3DDevice9_SetVertexShaderConstantF(pD3DDev9, h, t2, 3);
IDirect3DDevice9_SetVertexShaderConstantF(pD3DDev9, h, t2, 1);
break;
}
@ -1728,19 +1738,35 @@ static void BE_ApplyUniforms(program_t *prog, int permu)
IDirect3DDevice9_SetPixelShaderConstantF(pD3DDev9, h, &shaderstate.curdlight->radius, 1);
break;
case SP_LIGHTCOLOUR:
IDirect3DDevice9_SetPixelShaderConstantF(pD3DDev9, h, shaderstate.curdlight_colours, 3);
IDirect3DDevice9_SetPixelShaderConstantF(pD3DDev9, h, shaderstate.curdlight_colours, 1);
break;
case SP_E_L_DIR:
IDirect3DDevice9_SetVertexShaderConstantF(pD3DDev9, h, shaderstate.curentity->light_dir, 1);
break;
case SP_E_L_MUL:
IDirect3DDevice9_SetVertexShaderConstantF(pD3DDev9, h, shaderstate.curentity->light_range, 1);
break;
case SP_E_L_AMBIENT:
IDirect3DDevice9_SetVertexShaderConstantF(pD3DDev9, h, shaderstate.curentity->light_avg, 1);
break;
case SP_E_COLOURS:
IDirect3DDevice9_SetPixelShaderConstantF(pD3DDev9, h, shaderstate.curentity->shaderRGBAf, 1);
break;
case SP_E_COLOURSIDENT:
if (shaderstate.flags & BEF_FORCECOLOURMOD)
{
vec4_t tmp = {1, 1, 1, shaderstate.curentity->shaderRGBAf[3]};
IDirect3DDevice9_SetPixelShaderConstantF(pD3DDev9, h, tmp, 1);
}
else
IDirect3DDevice9_SetPixelShaderConstantF(pD3DDev9, h, shaderstate.curentity->shaderRGBAf, 1);
break;
case SP_E_TOPCOLOURS:
case SP_E_BOTTOMCOLOURS:
case SP_E_L_DIR:
case SP_E_L_MUL:
case SP_E_L_AMBIENT:
case SP_M_ENTBONES:
case SP_M_MODEL:
case SP_M_MODELVIEW:
case SP_RENDERTEXTURESCALE:
@ -1766,6 +1792,13 @@ static void BE_RenderMeshProgram(shader_t *s, unsigned int vertcount, unsigned i
program_t *p = s->prog;
if (shaderstate.batchvbo && shaderstate.batchvbo->numbones)
{
if (p->permu[perm|PERMUTATION_SKELETAL].handle.glsl)
perm |= PERMUTATION_SKELETAL;
else
return;
}
if (TEXVALID(shaderstate.curtexnums->bump) && p->permu[perm|PERMUTATION_BUMPMAP].handle.hlsl.vert)
perm |= PERMUTATION_BUMPMAP;
if (TEXVALID(shaderstate.curtexnums->fullbright) && p->permu[perm|PERMUTATION_FULLBRIGHT].handle.hlsl.vert)
@ -1774,8 +1807,12 @@ static void BE_RenderMeshProgram(shader_t *s, unsigned int vertcount, unsigned i
perm |= PERMUTATION_UPPERLOWER;
if (r_refdef.gfog_rgbd[3] && p->permu[perm|PERMUTATION_FOG].handle.hlsl.vert)
perm |= PERMUTATION_FOG;
// if (r_glsl_offsetmapping.ival && TEXVALID(shaderstate.curtexnums->bump) && p->handle[perm|PERMUTATION_OFFSET.hlsl.vert)
// perm |= PERMUTATION_OFFSET;
if (p->permu[perm|PERMUTATION_FRAMEBLEND].handle.hlsl.vert && shaderstate.batchvbo && shaderstate.batchvbo->coord2.d3d.buff)
perm |= PERMUTATION_FRAMEBLEND;
if (p->permu[perm|PERMUTATION_DELUXE].handle.hlsl.vert && TEXVALID(shaderstate.curtexnums->bump) && shaderstate.curbatch->lightmap[0] >= 0 && lightmap[shaderstate.curbatch->lightmap[0]]->hasdeluxe)
perm |= PERMUTATION_DELUXE;
if (shaderstate.curbatch->lightmap[1] >= 0 && p->permu[perm|PERMUTATION_LIGHTSTYLES].handle.hlsl.vert)
perm |= PERMUTATION_LIGHTSTYLES;
BE_ApplyUniforms(p, perm);
@ -1885,18 +1922,44 @@ static void BE_RenderMeshProgram(shader_t *s, unsigned int vertcount, unsigned i
d3dcheck(IDirect3DDevice9_SetStreamSource(pD3DDev9, STRM_NORMS, shaderstate.batchvbo->svector.d3d.buff, shaderstate.batchvbo->svector.d3d.offs, sizeof(vbovdata_t)));
d3dcheck(IDirect3DDevice9_SetStreamSource(pD3DDev9, STRM_NORMT, shaderstate.batchvbo->tvector.d3d.buff, shaderstate.batchvbo->tvector.d3d.offs, sizeof(vbovdata_t)));
}
else
else if (shaderstate.meshlist[0]->normals_array && shaderstate.meshlist[0]->snormals_array && shaderstate.meshlist[0]->tnormals_array)
{
/*FIXME*/
vdec &= ~D3D_VDEC_NORM;
int mno;
void *map;
mesh_t *m;
int tv = vertcount;
allocvertexbuffer(shaderstate.dynnorm_buff, shaderstate.dynnorm_size, &shaderstate.dynnorm_offs, &map, vertcount*3*sizeof(vec3_t));
for (mno = 0, vertcount = 0; mno < shaderstate.nummeshes; mno++)
{
float *dest;
m = shaderstate.meshlist[mno];
dest = (float*)((char*)map+vertcount*sizeof(vec3_t));
memcpy(dest, m->normals_array, m->numvertexes*sizeof(vec3_t));
dest += tv*3;
memcpy(dest, m->snormals_array, m->numvertexes*sizeof(vec3_t));
dest += tv*3;
memcpy(dest, m->tnormals_array, m->numvertexes*sizeof(vec3_t));
vertcount += m->numvertexes;
}
d3dcheck(IDirect3DVertexBuffer9_Unlock(shaderstate.dynnorm_buff));
d3dcheck(IDirect3DDevice9_SetStreamSource(pD3DDev9, STRM_NORM, shaderstate.dynnorm_buff, shaderstate.dynnorm_offs - vertcount*sizeof(vec3_t)*3, sizeof(vec3_t)));
d3dcheck(IDirect3DDevice9_SetStreamSource(pD3DDev9, STRM_NORMS, shaderstate.dynnorm_buff, shaderstate.dynnorm_offs - vertcount*sizeof(vec3_t)*2, sizeof(vec3_t)));
d3dcheck(IDirect3DDevice9_SetStreamSource(pD3DDev9, STRM_NORMT, shaderstate.dynnorm_buff, shaderstate.dynnorm_offs - vertcount*sizeof(vec3_t)*1, sizeof(vec3_t)));
}
else
vdec &= ~D3D_VDEC_NORM;
}
/*bone weights+indexes*/
if (vdec & D3D_VDEC_SKEL)
{
/*FIXME*/
vdec &= ~D3D_VDEC_NORM;
vdec &= ~D3D_VDEC_SKEL;
}
if (vdec != shaderstate.curvertdecl)
@ -2599,9 +2662,9 @@ static void BE_RotateForEntity (const entity_t *e, const model_t *mod)
Matrix4x4_CM_NewRotation(90, 1, 0, 0);
Matrix4_Multiply(iv, m, mv);
Matrix4_Multiply(mv, Matrix4x4_CM_NewRotation(-90, 1, 0, 0), iv);
Matrix4_Multiply(iv, Matrix4x4_CM_NewRotation(90, 0, 0, 1), mv);
Matrix4_Multiply(iv, Matrix4x4_CM_NewRotation(90, 0, 0, 1), m);
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_WORLD, (D3DMATRIX*)mv);
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_WORLD, (D3DMATRIX*)m);
}
else
{
@ -2630,6 +2693,7 @@ void D3D9BE_SubmitBatch(batch_t *batch)
shaderstate.meshlist = batch->mesh + batch->firstmesh;
shaderstate.curshader = batch->shader;
shaderstate.curtexnums = batch->skin;
shaderstate.curbatch = batch;
shaderstate.flags = batch->flags;
if (batch->lightmap[0] < 0)
shaderstate.curlightmap = r_nulltex;
@ -2645,6 +2709,7 @@ void D3D9BE_DrawMesh_List(shader_t *shader, int nummeshes, mesh_t **meshlist, vb
shaderstate.curshader = shader;
shaderstate.curtexnums = texnums;
shaderstate.curlightmap = r_nulltex;
shaderstate.curbatch = &shaderstate.dummybatch;
shaderstate.meshlist = meshlist;
shaderstate.nummeshes = nummeshes;
shaderstate.flags = beflags;

View file

@ -167,8 +167,9 @@ qboolean D3D9Shader_CreateProgram (program_t *prog, char *sname, int permu, char
if (pD3DXCompileShader)
{
int consts;
for (consts = 2; precompilerconstants[consts]; consts++)
for (consts = 0; precompilerconstants[consts]; consts++)
;
consts+=2;
if (consts >= sizeof(defines) / sizeof(defines[0]))
return success;

View file

@ -1091,9 +1091,6 @@ static void (D3D9_SCR_UpdateScreen) (void)
Media_RecordFrame();
#endif
if (Key_MouseShouldBeFree())
SCR_DrawCursor(0);
RSpeedEnd(RSPEED_TOTALREFRESH);
RSpeedShow();

View file

@ -1159,8 +1159,6 @@ static void (D3D11_SCR_UpdateScreen) (void)
V_UpdatePalette (false);
if (Key_MouseShouldBeFree())
SCR_DrawCursor(0);
#if defined(_WIN32) && defined(GLQUAKE)
Media_RecordFrame();
#endif

View file

@ -40,7 +40,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../libs/speex,..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
PreprocessorDefinitions="BOTLIB"
PreprocessorDefinitions="BOTLIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
SmallerTypeCheck="true"
@ -104,7 +104,7 @@
Name="VCCLCompilerTool"
FavorSizeOrSpeed="0"
OmitFramePointers="true"
PreprocessorDefinitions="BOTLIB"
PreprocessorDefinitions="BOTLIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
RuntimeLibrary="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"

View file

@ -71,8 +71,8 @@ Global
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug Dedicated Server|x64.ActiveCfg = Debug Dedicated Server|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug Dedicated Server|x64.Build.0 = Debug Dedicated Server|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug|Win32.ActiveCfg = MDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug|x64.ActiveCfg = Debug Dedicated Server|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug|x64.Build.0 = Debug Dedicated Server|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug|x64.ActiveCfg = D3DRelease|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Debug|x64.Build.0 = D3DRelease|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLDebug|Win32.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLDebug|Win32.Build.0 = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLDebug|x64.ActiveCfg = GLDebug|x64
@ -95,12 +95,12 @@ Global
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MinGLRelease|x64.Build.0 = MinGLDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MRelease|Win32.ActiveCfg = MRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MRelease|Win32.Build.0 = MRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MRelease|x64.ActiveCfg = MRelease|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MRelease|x64.Build.0 = MRelease|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MRelease|x64.ActiveCfg = MinGLDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MRelease|x64.Build.0 = MinGLDebug|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release Dedicated Server|Win32.ActiveCfg = Release Dedicated Server|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release Dedicated Server|Win32.Build.0 = Release Dedicated Server|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release Dedicated Server|x64.ActiveCfg = Release Dedicated Server|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release Dedicated Server|x64.Build.0 = Release Dedicated Server|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release Dedicated Server|x64.ActiveCfg = GLRelease|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release Dedicated Server|x64.Build.0 = GLRelease|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release|Win32.ActiveCfg = MRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release|Win32.Build.0 = MRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release|x64.ActiveCfg = GLRelease|x64
@ -137,7 +137,7 @@ Global
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.Release|x64.Build.0 = Release Dedicated Server_SDL|x64
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.D3DDebug|Win32.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.D3DDebug|Win32.Build.0 = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.D3DDebug|x64.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.D3DDebug|x64.ActiveCfg = GLRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.D3DRelease|Win32.ActiveCfg = GLRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.D3DRelease|x64.ActiveCfg = GLRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug Dedicated Server|Win32.ActiveCfg = GLDebug|Win32
@ -145,21 +145,18 @@ Global
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug Dedicated Server|x64.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|Win32.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|Win32.Build.0 = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|x64.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|x64.ActiveCfg = GLRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLDebug|Win32.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLDebug|Win32.Build.0 = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLDebug|x64.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|Win32.ActiveCfg = GLRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|x64.ActiveCfg = GLRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MDebug|Win32.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MDebug|Win32.Build.0 = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MDebug|x64.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|Win32.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|Win32.Build.0 = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|x64.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|Win32.ActiveCfg = GLRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|Win32.Build.0 = GLRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|x64.ActiveCfg = GLRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|x64.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MRelease|Win32.ActiveCfg = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MRelease|Win32.Build.0 = GLDebug|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MRelease|x64.ActiveCfg = GLDebug|Win32
@ -170,14 +167,15 @@ Global
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|Win32.Build.0 = GLRelease|Win32
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|x64.ActiveCfg = GLDebug|Win32
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.D3DDebug|Win32.ActiveCfg = Release
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.D3DDebug|x64.ActiveCfg = Debug
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.D3DDebug|x64.ActiveCfg = Release
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.D3DRelease|Win32.ActiveCfg = Release
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.D3DRelease|x64.ActiveCfg = Release
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.D3DRelease|x64.Build.0 = Release
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.Debug Dedicated Server|Win32.ActiveCfg = Debug
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.Debug Dedicated Server|x64.ActiveCfg = Debug
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.Debug|Win32.ActiveCfg = Debug
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.Debug|x64.ActiveCfg = Debug
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.Debug|x64.ActiveCfg = Release
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.Debug|x64.Build.0 = Release
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.GLDebug|Win32.ActiveCfg = Debug
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.GLDebug|x64.ActiveCfg = Debug
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.GLRelease|Win32.ActiveCfg = Release
@ -187,16 +185,16 @@ Global
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.MinGLDebug|Win32.ActiveCfg = Debug
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.MinGLDebug|x64.ActiveCfg = Debug
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.MinGLRelease|Win32.ActiveCfg = Release
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.MinGLRelease|x64.ActiveCfg = Release
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.MinGLRelease|x64.ActiveCfg = Debug
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.MRelease|Win32.ActiveCfg = Release
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.MRelease|x64.ActiveCfg = Release
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.MRelease|x64.ActiveCfg = Debug
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.Release Dedicated Server|Win32.ActiveCfg = Release
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.Release Dedicated Server|x64.ActiveCfg = Release
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.Release|Win32.ActiveCfg = Release
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.Release|x64.ActiveCfg = Release
{0018E098-B12A-4E4D-9B22-6772DA287080}.D3DDebug|Win32.ActiveCfg = Release|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.D3DDebug|Win32.Build.0 = Release|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.D3DDebug|x64.ActiveCfg = Debug|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.D3DDebug|x64.ActiveCfg = Release|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.D3DRelease|Win32.ActiveCfg = Release|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.D3DRelease|Win32.Build.0 = Release|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.D3DRelease|x64.ActiveCfg = Release|Win32
@ -205,7 +203,7 @@ Global
{0018E098-B12A-4E4D-9B22-6772DA287080}.Debug Dedicated Server|x64.ActiveCfg = Debug|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.Debug|Win32.ActiveCfg = Debug|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.Debug|Win32.Build.0 = Debug|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.Debug|x64.ActiveCfg = Debug|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.Debug|x64.ActiveCfg = Release|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.GLDebug|Win32.ActiveCfg = Debug|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.GLDebug|Win32.Build.0 = Debug|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.GLDebug|x64.ActiveCfg = Debug|Win32
@ -218,10 +216,10 @@ Global
{0018E098-B12A-4E4D-9B22-6772DA287080}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.MinGLDebug|x64.ActiveCfg = Debug|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.MinGLRelease|Win32.ActiveCfg = Release|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.MinGLRelease|x64.ActiveCfg = Release|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.MinGLRelease|x64.ActiveCfg = Debug|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.MRelease|Win32.ActiveCfg = Release|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.MRelease|Win32.Build.0 = Release|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.MRelease|x64.ActiveCfg = Release|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.MRelease|x64.ActiveCfg = Debug|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.Release Dedicated Server|Win32.ActiveCfg = Release|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.Release Dedicated Server|Win32.Build.0 = Release|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.Release Dedicated Server|x64.ActiveCfg = Release|Win32
@ -229,7 +227,7 @@ Global
{0018E098-B12A-4E4D-9B22-6772DA287080}.Release|Win32.Build.0 = Release|Win32
{0018E098-B12A-4E4D-9B22-6772DA287080}.Release|x64.ActiveCfg = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.D3DDebug|Win32.ActiveCfg = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.D3DDebug|x64.ActiveCfg = Debug|Win32
{2866F783-6B44-4655-A38D-D53874037454}.D3DDebug|x64.ActiveCfg = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.D3DRelease|Win32.ActiveCfg = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.D3DRelease|x64.ActiveCfg = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.Debug Dedicated Server|Win32.ActiveCfg = Debug|Win32
@ -237,9 +235,8 @@ Global
{2866F783-6B44-4655-A38D-D53874037454}.Debug Dedicated Server|x64.ActiveCfg = Debug|Win32
{2866F783-6B44-4655-A38D-D53874037454}.Debug|Win32.ActiveCfg = Debug|Win32
{2866F783-6B44-4655-A38D-D53874037454}.Debug|Win32.Build.0 = Debug|Win32
{2866F783-6B44-4655-A38D-D53874037454}.Debug|x64.ActiveCfg = Debug|Win32
{2866F783-6B44-4655-A38D-D53874037454}.Debug|x64.ActiveCfg = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.GLDebug|Win32.ActiveCfg = Debug|Win32
{2866F783-6B44-4655-A38D-D53874037454}.GLDebug|Win32.Build.0 = Debug|Win32
{2866F783-6B44-4655-A38D-D53874037454}.GLDebug|x64.ActiveCfg = Debug|Win32
{2866F783-6B44-4655-A38D-D53874037454}.GLRelease|Win32.ActiveCfg = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.GLRelease|x64.ActiveCfg = Release|Win32
@ -251,10 +248,10 @@ Global
{2866F783-6B44-4655-A38D-D53874037454}.MinGLDebug|x64.ActiveCfg = Debug|Win32
{2866F783-6B44-4655-A38D-D53874037454}.MinGLRelease|Win32.ActiveCfg = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.MinGLRelease|Win32.Build.0 = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.MinGLRelease|x64.ActiveCfg = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.MinGLRelease|x64.ActiveCfg = Debug|Win32
{2866F783-6B44-4655-A38D-D53874037454}.MRelease|Win32.ActiveCfg = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.MRelease|Win32.Build.0 = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.MRelease|x64.ActiveCfg = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.MRelease|x64.ActiveCfg = Debug|Win32
{2866F783-6B44-4655-A38D-D53874037454}.Release Dedicated Server|Win32.ActiveCfg = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.Release Dedicated Server|Win32.Build.0 = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.Release Dedicated Server|x64.ActiveCfg = Release|Win32
@ -262,7 +259,7 @@ Global
{2866F783-6B44-4655-A38D-D53874037454}.Release|Win32.Build.0 = Release|Win32
{2866F783-6B44-4655-A38D-D53874037454}.Release|x64.ActiveCfg = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.D3DDebug|Win32.ActiveCfg = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.D3DDebug|x64.ActiveCfg = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.D3DDebug|x64.ActiveCfg = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.D3DRelease|Win32.ActiveCfg = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.D3DRelease|x64.ActiveCfg = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.Debug Dedicated Server|Win32.ActiveCfg = Debug|Win32
@ -270,24 +267,21 @@ Global
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.Debug Dedicated Server|x64.ActiveCfg = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.Debug|Win32.ActiveCfg = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.Debug|Win32.Build.0 = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.Debug|x64.ActiveCfg = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.Debug|x64.ActiveCfg = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.GLDebug|Win32.ActiveCfg = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.GLDebug|Win32.Build.0 = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.GLDebug|x64.ActiveCfg = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.GLRelease|Win32.ActiveCfg = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.GLRelease|x64.ActiveCfg = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MDebug|Win32.ActiveCfg = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MDebug|Win32.Build.0 = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MDebug|x64.ActiveCfg = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MinGLDebug|Win32.Build.0 = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MinGLDebug|x64.ActiveCfg = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MinGLRelease|Win32.ActiveCfg = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MinGLRelease|Win32.Build.0 = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MinGLRelease|x64.ActiveCfg = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MinGLRelease|x64.ActiveCfg = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MRelease|Win32.ActiveCfg = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MRelease|Win32.Build.0 = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MRelease|x64.ActiveCfg = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MRelease|x64.ActiveCfg = Debug|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.Release Dedicated Server|Win32.ActiveCfg = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.Release Dedicated Server|Win32.Build.0 = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.Release Dedicated Server|x64.ActiveCfg = Release|Win32
@ -295,13 +289,13 @@ Global
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.Release|Win32.Build.0 = Release|Win32
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.Release|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.D3DDebug|Win32.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.D3DDebug|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.D3DDebug|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.D3DRelease|Win32.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.D3DRelease|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.Debug Dedicated Server|Win32.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.Debug Dedicated Server|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.Debug|Win32.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.Debug|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.Debug|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.GLDebug|Win32.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.GLDebug|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.GLRelease|Win32.ActiveCfg = Release|Win32
@ -311,15 +305,15 @@ Global
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.MinGLDebug|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.MinGLRelease|Win32.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.MinGLRelease|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.MinGLRelease|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.MRelease|Win32.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.MRelease|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.MRelease|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.Release Dedicated Server|Win32.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.Release Dedicated Server|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.Release|Win32.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.Release|x64.ActiveCfg = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.D3DDebug|Win32.ActiveCfg = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.D3DDebug|x64.ActiveCfg = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.D3DDebug|x64.ActiveCfg = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.D3DRelease|Win32.ActiveCfg = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.D3DRelease|x64.ActiveCfg = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.Debug Dedicated Server|Win32.ActiveCfg = Debug|Win32
@ -327,22 +321,21 @@ Global
{873CCE24-3549-49D4-A4B4-653F91B1532A}.Debug Dedicated Server|x64.ActiveCfg = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.Debug|Win32.ActiveCfg = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.Debug|Win32.Build.0 = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.Debug|x64.ActiveCfg = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.Debug|x64.ActiveCfg = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.GLDebug|Win32.ActiveCfg = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.GLDebug|x64.ActiveCfg = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.GLRelease|Win32.ActiveCfg = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.GLRelease|x64.ActiveCfg = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MDebug|Win32.ActiveCfg = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MDebug|Win32.Build.0 = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MDebug|x64.ActiveCfg = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MinGLDebug|x64.ActiveCfg = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MinGLRelease|Win32.ActiveCfg = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MinGLRelease|Win32.Build.0 = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MinGLRelease|x64.ActiveCfg = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MinGLRelease|x64.ActiveCfg = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MRelease|Win32.ActiveCfg = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MRelease|Win32.Build.0 = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MRelease|x64.ActiveCfg = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MRelease|x64.ActiveCfg = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.Release Dedicated Server|Win32.ActiveCfg = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.Release Dedicated Server|Win32.Build.0 = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.Release Dedicated Server|x64.ActiveCfg = Release|Win32
@ -351,7 +344,7 @@ Global
{873CCE24-3549-49D4-A4B4-653F91B1532A}.Release|x64.ActiveCfg = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.D3DDebug|Win32.ActiveCfg = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.D3DDebug|Win32.Build.0 = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.D3DDebug|x64.ActiveCfg = Debug|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.D3DDebug|x64.ActiveCfg = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.D3DRelease|Win32.ActiveCfg = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.D3DRelease|Win32.Build.0 = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.D3DRelease|x64.ActiveCfg = Release|Win32
@ -360,23 +353,21 @@ Global
{4877586B-E85B-4DF8-BCCE-59D31514D240}.Debug Dedicated Server|x64.ActiveCfg = Debug|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.Debug|Win32.ActiveCfg = Debug|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.Debug|Win32.Build.0 = Debug|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.Debug|x64.ActiveCfg = Debug|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.Debug|x64.ActiveCfg = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLDebug|Win32.ActiveCfg = Debug|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLDebug|x64.ActiveCfg = Debug|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLRelease|Win32.ActiveCfg = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLRelease|x64.ActiveCfg = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MDebug|Win32.ActiveCfg = Debug|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MDebug|Win32.Build.0 = Debug|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MDebug|x64.ActiveCfg = Debug|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MinGLDebug|Win32.Build.0 = Debug|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MinGLDebug|x64.ActiveCfg = Debug|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MinGLRelease|Win32.ActiveCfg = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MinGLRelease|Win32.Build.0 = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MinGLRelease|x64.ActiveCfg = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MinGLRelease|x64.ActiveCfg = Debug|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MRelease|Win32.ActiveCfg = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MRelease|Win32.Build.0 = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MRelease|x64.ActiveCfg = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MRelease|x64.ActiveCfg = Debug|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.Release Dedicated Server|Win32.ActiveCfg = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.Release Dedicated Server|Win32.Build.0 = Release|Win32
{4877586B-E85B-4DF8-BCCE-59D31514D240}.Release Dedicated Server|x64.ActiveCfg = Release|Win32
@ -385,7 +376,7 @@ Global
{4877586B-E85B-4DF8-BCCE-59D31514D240}.Release|x64.ActiveCfg = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.D3DDebug|Win32.ActiveCfg = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.D3DDebug|Win32.Build.0 = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.D3DDebug|x64.ActiveCfg = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.D3DDebug|x64.ActiveCfg = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.D3DRelease|Win32.ActiveCfg = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.D3DRelease|Win32.Build.0 = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.D3DRelease|x64.ActiveCfg = Release|Win32
@ -394,24 +385,22 @@ Global
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.Debug Dedicated Server|x64.ActiveCfg = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.Debug|Win32.ActiveCfg = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.Debug|Win32.Build.0 = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.Debug|x64.ActiveCfg = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.Debug|x64.ActiveCfg = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.GLDebug|Win32.ActiveCfg = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.GLDebug|x64.ActiveCfg = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.GLRelease|Win32.ActiveCfg = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.GLRelease|Win32.Build.0 = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.GLRelease|x64.ActiveCfg = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MDebug|Win32.ActiveCfg = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MDebug|Win32.Build.0 = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MDebug|x64.ActiveCfg = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MinGLDebug|Win32.Build.0 = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MinGLDebug|x64.ActiveCfg = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MinGLRelease|Win32.ActiveCfg = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MinGLRelease|Win32.Build.0 = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MinGLRelease|x64.ActiveCfg = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MinGLRelease|x64.ActiveCfg = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MRelease|Win32.ActiveCfg = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MRelease|Win32.Build.0 = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MRelease|x64.ActiveCfg = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MRelease|x64.ActiveCfg = Debug|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.Release Dedicated Server|Win32.ActiveCfg = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.Release Dedicated Server|Win32.Build.0 = Release|Win32
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.Release Dedicated Server|x64.ActiveCfg = Release|Win32
@ -420,7 +409,7 @@ Global
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.Release|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DDebug|Win32.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DDebug|Win32.Build.0 = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DDebug|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DDebug|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DRelease|Win32.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DRelease|Win32.Build.0 = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.D3DRelease|x64.ActiveCfg = Release|Win32
@ -429,25 +418,22 @@ Global
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.Debug Dedicated Server|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.Debug|Win32.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.Debug|Win32.Build.0 = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.Debug|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.Debug|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLDebug|Win32.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLDebug|Win32.Build.0 = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLDebug|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLRelease|Win32.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLRelease|Win32.Build.0 = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLRelease|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MDebug|Win32.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MDebug|Win32.Build.0 = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MDebug|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MinGLDebug|Win32.Build.0 = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MinGLDebug|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MinGLRelease|Win32.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MinGLRelease|Win32.Build.0 = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MinGLRelease|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MinGLRelease|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MRelease|Win32.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MRelease|Win32.Build.0 = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MRelease|x64.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MRelease|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.Release Dedicated Server|Win32.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.Release Dedicated Server|Win32.Build.0 = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.Release Dedicated Server|x64.ActiveCfg = Release|Win32

File diff suppressed because it is too large Load diff

View file

@ -191,6 +191,7 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
{
galiasskin_t *skins;
shader_t *shader;
skin_t *plskin;
int frame;
unsigned int subframe;
extern int cl_playerindex; //so I don't have to strcmp
@ -218,22 +219,19 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
if (!gl_nocolors.ival || forced)
{
if (e->scoreboard)
if (e->playerindex >= 0 && e->playerindex <= MAX_CLIENTS)
{
if (!e->scoreboard->skin)
Skin_Find(e->scoreboard);
tc = e->scoreboard->ttopcolor;
bc = e->scoreboard->tbottomcolor;
pc = e->scoreboard->h2playerclass;
if (!cl.players[e->playerindex].skin)
Skin_Find(&cl.players[e->playerindex]);
plskin = cl.players[e->playerindex].skin;
}
else
{
tc = 1;
bc = 1;
pc = 0;
}
plskin = NULL;
tc = e->topcolour;
bc = e->bottomcolour;
pc = e->h2playerclass;
if (forced || tc != 1 || bc != 1 || (e->scoreboard && e->scoreboard->skin))
if (forced || tc != 1 || bc != 1 || plskin)
{
int inwidth, inheight;
int tinwidth, tinheight;
@ -242,9 +240,9 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
galiascolourmapped_t *cm;
char hashname[512];
if (e->scoreboard && e->scoreboard->skin)
if (plskin)
{
snprintf(hashname, sizeof(hashname), "%s$%s$%i", model->name, e->scoreboard->skin->name, surfnum);
snprintf(hashname, sizeof(hashname), "%s$%s$%i", model->name, plskin->name, surfnum);
skinname = hashname;
}
else if (surfnum)
@ -314,6 +312,8 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
cm->subframe = subframe;
cm->texnum.fullbright = r_nulltex;
cm->texnum.base = r_nulltex;
cm->texnum.bump = r_nulltex;
cm->texnum.specular = r_nulltex;
cm->texnum.loweroverlay = r_nulltex;
cm->texnum.upperoverlay = r_nulltex;
@ -321,58 +321,58 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
{ //model has no shaders, so just the skin directly
shader = R_RegisterSkin(skinname, NULL);
if (e->scoreboard && e->scoreboard->skin)
if (plskin)
{
if (cls.protocol == CP_QUAKE2)
{
original = Skin_Cache32(e->scoreboard->skin);
original = Skin_Cache32(plskin);
if (original)
{
inwidth = e->scoreboard->skin->width;
inheight = e->scoreboard->skin->height;
cm->texnum.base = R_LoadTexture32(e->scoreboard->skin->name, inwidth, inheight, (unsigned int*)original, IF_NOALPHA|IF_NOGAMMA);
inwidth = plskin->width;
inheight = plskin->height;
cm->texnum.base = R_LoadTexture32(plskin->name, inwidth, inheight, (unsigned int*)original, IF_NOALPHA|IF_NOGAMMA);
return shader;
}
}
else
{
original = Skin_Cache8(e->scoreboard->skin);
original = Skin_Cache8(plskin);
if (original)
{
inwidth = e->scoreboard->skin->width;
inheight = e->scoreboard->skin->height;
cm->texnum.base = R_LoadTexture8(e->scoreboard->skin->name, inwidth, inheight, original, IF_NOALPHA|IF_NOGAMMA, 1);
inwidth = plskin->width;
inheight = plskin->height;
cm->texnum.base = R_LoadTexture8(plskin->name, inwidth, inheight, original, IF_NOALPHA|IF_NOGAMMA, 1);
return shader;
}
}
if (TEXVALID(e->scoreboard->skin->tex_base))
if (TEXVALID(plskin->tex_base))
{
cm->texnum.loweroverlay = e->scoreboard->skin->tex_lower;
cm->texnum.upperoverlay = e->scoreboard->skin->tex_upper;
cm->texnum.base = e->scoreboard->skin->tex_base;
cm->texnum.loweroverlay = plskin->tex_lower;
cm->texnum.upperoverlay = plskin->tex_upper;
cm->texnum.base = plskin->tex_base;
return shader;
}
cm->texnum.base = R_LoadHiResTexture(e->scoreboard->skin->name, "skins", IF_NOALPHA);
cm->texnum.base = R_LoadHiResTexture(plskin->name, "skins", IF_NOALPHA);
return shader;
}
return shader;
}
cm->texnum.bump = shader->defaulttextures.bump; //can't colour bumpmapping
if (cls.protocol != CP_QUAKE2 && ((model==cl.model_precache[cl_playerindex] || model==cl.model_precache_vwep[0]) && e->scoreboard && e->scoreboard->skin))
if (cls.protocol != CP_QUAKE2 && ((model==cl.model_precache[cl_playerindex] || model==cl.model_precache_vwep[0]) && plskin))
{
/*q1 only reskins the player model, not gibbed heads (which have the same colourmap)*/
original = Skin_Cache8(e->scoreboard->skin);
inwidth = e->scoreboard->skin->width;
inheight = e->scoreboard->skin->height;
original = Skin_Cache8(plskin);
inwidth = plskin->width;
inheight = plskin->height;
if (!original && TEXVALID(e->scoreboard->skin->tex_base))
if (!original && TEXVALID(plskin->tex_base))
{
cm->texnum.loweroverlay = e->scoreboard->skin->tex_lower;
cm->texnum.upperoverlay = e->scoreboard->skin->tex_upper;
cm->texnum.base = e->scoreboard->skin->tex_base;
cm->texnum.loweroverlay = plskin->tex_lower;
cm->texnum.upperoverlay = plskin->tex_upper;
cm->texnum.base = plskin->tex_base;
return shader;
}
}
@ -386,7 +386,9 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
{
if (skins->ofstexels)
{
original = (qbyte *)skins + skins->ofstexels;
int *offsets;
offsets = (int*)((qbyte *)skins + skins->ofstexels);
original = (qbyte*)offsets + offsets[subframe];
inwidth = skins->skinwidth;
inheight = skins->skinheight;
}
@ -424,21 +426,29 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
tinheight = inheight;
//don't make scaled width any larger than it needs to be
for (i = 0; i < 10; i++)
if (r_config.texture_non_power_of_two)
{
scaled_width = (1<<i);
if (scaled_width >= tinwidth)
break; //its covered
scaled_width = tinwidth;
scaled_height = tinheight;
}
else
{
for (i = 0; i < 10; i++)
{
scaled_width = (1<<i);
if (scaled_width >= tinwidth)
break; //its covered
}
for (i = 0; i < 10; i++)
{
scaled_height = (1<<i);
if (scaled_height >= tinheight)
break; //its covered
}
}
if (scaled_width > gl_max_size.value)
scaled_width = gl_max_size.value; //whoops, we made it too big
for (i = 0; i < 10; i++)
{
scaled_height = (1<<i);
if (scaled_height >= tinheight)
break; //its covered
}
if (scaled_height > gl_max_size.value)
scaled_height = gl_max_size.value; //whoops, we made it too big
@ -966,9 +976,9 @@ void R_GAlias_GenerateBatches(entity_t *e, batch_t **batches)
/*switch model if we're the player model, and the player skin says a new model*/
{
extern int cl_playerindex;
if (e->scoreboard && e->model == cl.model_precache[cl_playerindex])
if (e->playerindex >= 0 && e->model == cl.model_precache[cl_playerindex])
{
clmodel = e->scoreboard->model;
clmodel = cl.players[e->playerindex].model;
if (clmodel && clmodel->type == mod_alias)
e->model = clmodel;
}
@ -1930,7 +1940,7 @@ void BE_GenPolyBatches(batch_t **batches)
b->lightmap[2] = -1;
b->lightmap[3] = -1;
b->surf_first = i;
b->flags = BEF_NODLIGHT|BEF_NOSHADOWS;
b->flags = BEF_NODLIGHT|BEF_NOSHADOWS | cl_stris[i].flags;
b->vbo = 0;
b->next = batches[shader->sort];
batches[shader->sort] = b;
@ -1942,19 +1952,25 @@ void BE_GenModelBatches(batch_t **batches)
{
int i;
entity_t *ent;
unsigned int orig_numstris = cl_numstris;
unsigned int orig_numvisedicts = cl_numvisedicts;
/*clear the batch list*/
for (i = 0; i < SHADER_SORT_COUNT; i++)
batches[i] = NULL;
#if defined(TERRAIN)
if (cl.worldmodel && cl.worldmodel->terrain)
if (cl.worldmodel && cl.worldmodel->terrain && !(r_refdef.flags & Q2RDF_NOWORLDMODEL))
Terr_DrawTerrainModel(batches, &r_worldentity);
#endif
if (!r_drawentities.ival)
return;
#ifndef CLIENTONLY
SV_AddDebugPolygons();
#endif
Alias_FlushCache();
// draw sprites seperately, because of alpha blending
@ -2042,6 +2058,9 @@ void BE_GenModelBatches(batch_t **batches)
if (cl_numstris)
BE_GenPolyBatches(batches);
cl_numstris = orig_numstris;
cl_numvisedicts = orig_numvisedicts;
}
#endif // defined(GLQUAKE)

View file

@ -49,6 +49,12 @@ static const char LIGHTPASS_SHADER[] = "\
{\n\
map $shadowmap\n\
}\n\
{\n\
map $loweroverlay\n\
}\n\
{\n\
map $upperoverlay\n\
}\n\
}";
@ -66,6 +72,7 @@ extern cvar_t r_glsl_offsetmapping, r_noportals;
static void BE_SendPassBlendDepthMask(unsigned int sbits);
void GLBE_RenderToTexture(texid_t sourcecol, texid_t sourcedepth, texid_t destcol, qboolean usedepth);
void GLBE_SubmitBatch(batch_t *batch);
static qboolean GLBE_RegisterLightShader(int mode);
struct {
//internal state
@ -399,19 +406,29 @@ void GL_LazyBind(int tmu, int target, texid_t texnum)
GL_SelectTexture(tmu);
shaderstate.currenttextures[shaderstate.currenttmu] = texnum.num;
if (target)
bindTexFunc (target, texnum.num);
#ifndef FORCESTATE
if (shaderstate.curtexturetype[tmu] != target && !gl_config.nofixedfunc)
if (shaderstate.curtexturetype[tmu] != target)
#endif
{
if (shaderstate.curtexturetype[tmu])
qglDisable(shaderstate.curtexturetype[tmu]);
shaderstate.curtexturetype[tmu] = target;
if (target)
qglEnable(target);
bindTexFunc (shaderstate.curtexturetype[tmu], texnum.num);
if (gl_config.nofixedfunc)
{
shaderstate.curtexturetype[tmu] = target;
}
else
{
if (shaderstate.curtexturetype[tmu])
qglDisable(shaderstate.curtexturetype[tmu]);
shaderstate.curtexturetype[tmu] = target;
if (target)
qglEnable(target);
}
}
if (target)
bindTexFunc (target, texnum.num);
}
}
@ -804,11 +821,17 @@ void GL_CullFace(unsigned int sflags)
void R_FetchTopColour(int *retred, int *retgreen, int *retblue)
{
int i;
unsigned int cv = shaderstate.curentity->topcolour;
if (shaderstate.curentity->scoreboard)
if (cv >= 16)
{
i = shaderstate.curentity->scoreboard->ttopcolor;
*retred = (((cv&0xff0000)>>16)**((unsigned char*)&d_8to24rgbtable[15]+0))>>8;
*retgreen = (((cv&0x00ff00)>>8)**((unsigned char*)&d_8to24rgbtable[15]+1))>>8;
*retblue = (((cv&0x0000ff)>>0)**((unsigned char*)&d_8to24rgbtable[15]+2))>>8;
return;
}
if (cv >= 0)
i = cv;
else
i = TOP_RANGE>>4;
if (i > 8)
@ -834,11 +857,17 @@ void R_FetchTopColour(int *retred, int *retgreen, int *retblue)
void R_FetchBottomColour(int *retred, int *retgreen, int *retblue)
{
int i;
unsigned int cv = shaderstate.curentity->bottomcolour;
if (shaderstate.curentity->scoreboard)
if (cv >= 16)
{
i = shaderstate.curentity->scoreboard->tbottomcolor;
*retred = (((cv&0xff0000)>>16)**((unsigned char*)&d_8to24rgbtable[15]+0))>>8;
*retgreen = (((cv&0x00ff00)>>8)**((unsigned char*)&d_8to24rgbtable[15]+1))>>8;
*retblue = (((cv&0x0000ff)>>0)**((unsigned char*)&d_8to24rgbtable[15]+2))>>8;
return;
}
if (cv >= 0)
i = cv;
else
i = BOTTOM_RANGE>>4;
if (i > 8)
@ -935,7 +964,7 @@ static void T_Gen_CurrentRender(int tmu)
if (r_refdef.recurse)
return;
if (gl_config.arb_texture_non_power_of_two)
if (r_config.texture_non_power_of_two)
{
vwidth = vid.pixelwidth;
vheight = vid.pixelheight;
@ -1240,17 +1269,13 @@ void GLBE_Init(void)
for (i = 0; i < MAXLIGHTMAPS; i++)
shaderstate.dummybatch.lightmap[i] = -1;
#if FIXME
/*normally we load these lazily, but if they're probably going to be used anyway, load them now to avoid stalls.*/
if (r_shadow_realtime_dlight.ival && !shaderstate.inited_shader_rtlight && gl_config.arb_shader_objects)
#ifdef RTLIGHTS
if (r_shadow_realtime_dlight.ival || r_shadow_realtime_world.ival)
{
shaderstate.inited_shader_rtlight = true;
shaderstate.shader_rtlight = R_RegisterCustom("rtlight", Shader_LightPass_Std, NULL);
}
if (r_shadow_realtime_dlight.ival && !shaderstate.inited_shader_cubeproj && gl_config.arb_shader_objects)
{
shaderstate.inited_shader_cubeproj = true;
shaderstate.shader_cubeproj = R_RegisterCustom("rtlight_cubeproj", Shader_LightPass_CubeProj, NULL);
if (r_shadow_shadowmapping.ival)
GLBE_RegisterLightShader(LSHADER_SMAP);
else
GLBE_RegisterLightShader(0);
}
#endif
@ -2405,6 +2430,10 @@ static void BE_SubmitMeshChain(void)
int startv, starti, endv, endi;
int m;
mesh_t *mesh;
int batchtype = GL_TRIANGLES;
if (shaderstate.flags & BEF_LINES)
batchtype = GL_LINES;
#if 0
if (!shaderstate.currentebo)
@ -2412,7 +2441,7 @@ static void BE_SubmitMeshChain(void)
if (shaderstate.meshcount == 1)
{
mesh = shaderstate.meshes[0];
qglDrawRangeElements(GL_TRIANGLES, mesh->vbofirstvert, mesh->vbofirstvert+mesh->numvertexes, mesh->numindexes, GL_INDEX_TYPE, shaderstate.sourcevbo->indicies + mesh->vbofirstelement);
qglDrawRangeElements(batchtype, mesh->vbofirstvert, mesh->vbofirstvert+mesh->numvertexes, mesh->numindexes, GL_INDEX_TYPE, shaderstate.sourcevbo->indicies + mesh->vbofirstelement);
RQuantAdd(RQUANT_DRAWS, 1);
return;
}
@ -2443,7 +2472,7 @@ static void BE_SubmitMeshChain(void)
for (starti = 0; starti < mesh->numindexes; )
ilst[endi++] = mesh->vbofirstvert + mesh->indexes[starti++];
}
qglDrawRangeElements(GL_TRIANGLES, startv, endv, endi, GL_INDEX_TYPE, ilst);
qglDrawRangeElements(batchtype, startv, endv, endi, GL_INDEX_TYPE, ilst);
RQuantAdd(RQUANT_DRAWS, 1);
}
@ -2494,7 +2523,7 @@ static void BE_SubmitMeshChain(void)
}
}
qglDrawRangeElements(GL_TRIANGLES, startv, endv, endi-starti, GL_INDEX_TYPE, (index_t*)shaderstate.sourcevbo->indicies.gl.addr + starti);
qglDrawRangeElements(batchtype, startv, endv, endi-starti, GL_INDEX_TYPE, (index_t*)shaderstate.sourcevbo->indicies.gl.addr + starti);
RQuantAdd(RQUANT_DRAWS, 1);
}
/*
@ -2627,7 +2656,7 @@ static void DrawPass(const shaderpass_t *pass)
static void BE_Program_Set_Attributes(const program_t *prog, unsigned int perm, qboolean entunchanged)
{
vec3_t param3;
vec4_t param4;
int r, g, b;
int i;
unsigned int ph;
@ -2762,24 +2791,24 @@ static void BE_Program_Set_Attributes(const program_t *prog, unsigned int perm,
break;
case SP_E_TOPCOLOURS:
R_FetchTopColour(&r, &g, &b);
param3[0] = r/255.0f;
param3[1] = g/255.0f;
param3[2] = b/255.0f;
qglUniform3fvARB(ph, 1, param3);
param4[0] = r/255.0f;
param4[1] = g/255.0f;
param4[2] = b/255.0f;
qglUniform3fvARB(ph, 1, param4);
break;
case SP_E_BOTTOMCOLOURS:
R_FetchBottomColour(&r, &g, &b);
param3[0] = r/255.0f;
param3[1] = g/255.0f;
param3[2] = b/255.0f;
qglUniform3fvARB(ph, 1, param3);
param4[0] = r/255.0f;
param4[1] = g/255.0f;
param4[2] = b/255.0f;
qglUniform3fvARB(ph, 1, param4);
break;
case SP_RENDERTEXTURESCALE:
if (gl_config.arb_texture_non_power_of_two)
if (r_config.texture_non_power_of_two)
{
param3[0] = 1;
param3[1] = 1;
param4[0] = 1;
param4[1] = 1;
}
else
{
@ -2789,11 +2818,12 @@ static void BE_Program_Set_Attributes(const program_t *prog, unsigned int perm,
r *= 2;
while (g < vid.pixelheight)
g *= 2;
param3[0] = vid.pixelwidth/(float)r;
param3[1] = vid.pixelheight/(float)g;
param4[0] = vid.pixelwidth/(float)r;
param4[1] = vid.pixelheight/(float)g;
}
param3[2] = 1;
qglUniform3fvARB(ph, 1, param3);
param4[2] = 0;
param4[3] = 0;
qglUniform4fvARB(ph, 1, param4);
break;
case SP_LIGHTSCREEN:
@ -2895,12 +2925,12 @@ static void BE_Program_Set_Attributes(const program_t *prog, unsigned int perm,
cvar_t *var = (cvar_t*)p->pval;
char *vs = var->string;
vs = COM_Parse(vs);
param3[0] = atof(com_token);
param4[0] = atof(com_token);
vs = COM_Parse(vs);
param3[1] = atof(com_token);
param4[1] = atof(com_token);
vs = COM_Parse(vs);
param3[2] = atof(com_token);
qglUniform3fvARB(ph, 1, param3);
param4[2] = atof(com_token);
qglUniform3fvARB(ph, 1, param4);
}
break;
@ -3004,7 +3034,7 @@ static void BE_RenderMeshProgram(const shader_t *shader, const shaderpass_t *pas
qboolean GLBE_LightCullModel(vec3_t org, model_t *model)
{
#ifdef RTLIGHTS
if ((shaderstate.mode == BEM_LIGHT || shaderstate.mode == BEM_STENCIL))
if ((shaderstate.mode == BEM_LIGHT || shaderstate.mode == BEM_STENCIL || shaderstate.mode == BEM_DEPTHONLY))
{
float dist;
vec3_t disp;
@ -3805,7 +3835,7 @@ static void GLBE_SubmitMeshesSortList(batch_t *sortlist)
if (shaderstate.mode == BEM_LIGHT || shaderstate.mode == BEM_SMAPLIGHT)
continue;
if (batch->flags & BEF_NOSHADOWS)
if (shaderstate.mode == BEM_STENCIL)
if (shaderstate.mode == BEM_STENCIL || shaderstate.mode == BEM_DEPTHONLY) //fixme: depthonly is not just shadows.
continue;
if (batch->buildmeshes)

View file

@ -179,7 +179,7 @@ void R_BloomBlend (void)
return;
if (!gl_config.arb_shader_objects)
return;
if (!gl_config.arb_texture_non_power_of_two)
if (!r_config.texture_non_power_of_two)
return;
/*whu?*/

View file

@ -312,7 +312,7 @@ void GL_Texturemode_Callback (struct cvar_s *var, char *oldvalue)
}
if (i == sizeof(modes)/sizeof(modes[0]))
{
Con_Printf ("bad gl_texturemode name\n");
Con_Printf ("bad gl_texturemode name - %s\n", var->string);
return;
}
@ -574,6 +574,10 @@ void GL_Set2D (qboolean flipped)
Matrix4x4_CM_Orthographic(r_refdef.m_projection, 0, vid.width, vid.height, 0, -99999, 99999);
Matrix4x4_Identity(r_refdef.m_view);
}
r_refdef.pxrect.x = 0;
r_refdef.pxrect.y = 0;
r_refdef.pxrect.width = vid.width;
r_refdef.pxrect.height = vid.height;
r_refdef.time = realtime;
/*flush that gl state*/
qglViewport (0, 0, vid.pixelwidth, vid.pixelheight);
@ -1030,7 +1034,7 @@ qboolean GL_UploadCompressed (qbyte *file, int *out_width, int *out_height, unsi
void GL_RoundDimensions(int *scaled_width, int *scaled_height, qboolean mipmap)
{
if (gl_config.arb_texture_non_power_of_two) //NPOT is a simple extension that relaxes errors.
if (r_config.texture_non_power_of_two) //NPOT is a simple extension that relaxes errors.
{
TRACE(("dbg: GL_RoundDimensions: GL_ARB_texture_non_power_of_two\n"));
}

View file

@ -12,13 +12,13 @@ void Font_Shutdown(void);
struct font_s *Font_LoadFont(int height, char *fontfilename);
void Font_Free(struct font_s *f);
void Font_BeginString(struct font_s *font, int vx, int vy, int *px, int *py);
void Font_BeginScaledString(struct font_s *font, float vx, float vy, float *px, float *py); /*avoid using*/
void Font_BeginScaledString(struct font_s *font, float vx, float vy, float szx, float szy, float *px, float *py); /*avoid using*/
void Font_Transform(int vx, int vy, int *px, int *py);
int Font_CharHeight(void);
int Font_CharWidth(unsigned int charcode);
int Font_CharEndCoord(struct font_s *font, int x, unsigned int charcode);
int Font_DrawChar(int px, int py, unsigned int charcode);
float Font_DrawScaleChar(float px, float py, float cw, float ch, unsigned int charcode); /*avoid using*/
float Font_DrawScaleChar(float px, float py, unsigned int charcode); /*avoid using*/
void Font_EndString(struct font_s *font);
int Font_LineBreaks(conchar_t *start, conchar_t *end, int maxpixelwidth, int maxlines, conchar_t **starts, conchar_t **ends);
struct font_s *font_conchar;
@ -225,6 +225,8 @@ static byte_vec4_t font_forecolour;
static byte_vec4_t font_backcolour;
static struct font_s *curfont;
static float curfont_scale[2];
static qboolean curfont_scaled;
//called at load time - initalises font buffers
void Font_Init(void)
@ -656,7 +658,7 @@ qboolean Font_LoadFreeTypeFont(struct font_s *f, int height, char *fontfilename)
f = FS_OpenReadLocation(&loc);
if (f && loc.len > 0)
{
fbase = malloc(loc.len);
fbase = BZ_Malloc(loc.len);
VFS_READ(f, fbase, loc.len);
VFS_CLOSE(f);
@ -708,7 +710,7 @@ qboolean Font_LoadFreeTypeFont(struct font_s *f, int height, char *fontfilename)
}
}
if (fbase)
free(fbase);
BZ_Free(fbase);
#endif
return false;
@ -927,12 +929,13 @@ void Doom_ExpandPatch(doompatch_t *p, unsigned char *b, int stride)
//creates a new font object from the given file, with each text row with the given height.
//width is implicit and scales with height and choice of font.
struct font_s *Font_LoadFont(int height, char *fontfilename)
struct font_s *Font_LoadFont(int vheight, char *fontfilename)
{
struct font_s *f;
int i = 0;
int defaultplane;
char *aname;
int height = (vheight * vid.rotpixelheight)/vid.height;
f = Z_Malloc(sizeof(*f));
f->charheight = height;
@ -1062,7 +1065,7 @@ struct font_s *Font_LoadFont(int height, char *fontfilename)
if (aname)
{
*aname = 0;
f->alt = Font_LoadFont(height, aname+1);
f->alt = Font_LoadFont(vheight, aname+1);
}
if (!Font_LoadFreeTypeFont(f, height, fontfilename))
{
@ -1129,11 +1132,13 @@ void Font_Free(struct font_s *f)
{
struct charcache_s **link;
//kill the alt font first.
if (f->alt)
{
Font_Free(f->alt);
f->alt = NULL;
}
//walk all chars, unlinking any that appear to be within this font's char cache
for (link = &fontplanes.oldestchar; *link; )
{
if (*link >= f->chars && *link <= f->chars + FONTCHARS)
@ -1150,9 +1155,9 @@ void Font_Free(struct font_s *f)
if (f->face)
pFT_Done_Face(f->face);
if (f->membuf)
free(f->membuf);
BZ_Free(f->membuf);
#endif
free(f);
Z_Free(f);
}
//maps a given virtual screen coord to a pixel coord, which matches the font's height/width values
@ -1161,6 +1166,10 @@ void Font_BeginString(struct font_s *font, int vx, int vy, int *px, int *py)
curfont = font;
*px = (vx*(int)vid.rotpixelwidth) / (float)vid.width;
*py = (vy*(int)vid.rotpixelheight) / (float)vid.height;
curfont_scale[0] = curfont->charheight;
curfont_scale[1] = curfont->charheight;
curfont_scaled = false;
}
void Font_Transform(int vx, int vy, int *px, int *py)
{
@ -1169,11 +1178,24 @@ void Font_Transform(int vx, int vy, int *px, int *py)
if (py)
*py = (vy*(int)vid.rotpixelheight) / (float)vid.height;
}
void Font_BeginScaledString(struct font_s *font, float vx, float vy, float *px, float *py)
void Font_BeginScaledString(struct font_s *font, float vx, float vy, float szx, float szy, float *px, float *py)
{
curfont = font;
*px = vx;
*py = vy;
*px = (vx*(float)vid.rotpixelwidth) / (float)vid.width;
*py = (vy*(float)vid.rotpixelheight) / (float)vid.height;
//now that its in pixels, clamp it so the text is at least consistant with its position.
//an individual char may end straddling a pixel boundary, but at least the pixels won't jiggle around as the text moves.
*px = (int)*px;
*py = (int)*py;
if ((int)(szx * vid.rotpixelheight/vid.height) == curfont->charheight && (int)(szy * vid.rotpixelheight/vid.height) == curfont->charheight)
curfont_scaled = false;
else
curfont_scaled = true;
curfont_scale[0] = (szx * (float)vid.rotpixelheight) / (curfont->charheight * (float)vid.height);
curfont_scale[1] = (szy * (float)vid.rotpixelheight) / (curfont->charheight * (float)vid.height);
}
void Font_EndString(struct font_s *font)
@ -1392,24 +1414,47 @@ int Font_DrawChar(int px, int py, unsigned int charcode)
return nextx;
}
col = charcode & (CON_NONCLEARBG|CON_BGMASK|CON_FGMASK|CON_HALFALPHA);
if (col != font_colourmask)
if (charcode & CON_RICHFORECOLOUR)
{
if ((col ^ font_colourmask) & CON_NONCLEARBG)
Font_Flush();
font_colourmask = col;
col = charcode & (CON_RICHFORECOLOUR|(0xfff<<CON_RICHBSHIFT));
if (col != font_colourmask)
{
if (font_colourmask & CON_NONCLEARBG)
Font_Flush();
font_colourmask = col;
col = (charcode&CON_FGMASK)>>CON_FGSHIFT;
font_forecolour[0] = consolecolours[col].fr*255;
font_forecolour[1] = consolecolours[col].fg*255;
font_forecolour[2] = consolecolours[col].fb*255;
font_forecolour[3] = (charcode & CON_HALFALPHA)?127:255;
font_forecolour[0] = ((col>>CON_RICHRSHIFT)&0xf)*0x11;
font_forecolour[1] = ((col>>CON_RICHGSHIFT)&0xf)*0x11;
font_forecolour[2] = ((col>>CON_RICHBSHIFT)&0xf)*0x11;
font_forecolour[3] = 255;
col = (charcode&CON_BGMASK)>>CON_BGSHIFT;
font_backcolour[0] = consolecolours[col].fr*255;
font_backcolour[1] = consolecolours[col].fg*255;
font_backcolour[2] = consolecolours[col].fb*255;
font_backcolour[3] = (charcode & CON_NONCLEARBG)?127:0;
font_backcolour[0] = 0;
font_backcolour[1] = 0;
font_backcolour[2] = 0;
font_backcolour[3] = 0;
}
}
else
{
col = charcode & (CON_NONCLEARBG|CON_BGMASK|CON_FGMASK|CON_HALFALPHA);
if (col != font_colourmask)
{
if ((col ^ font_colourmask) & CON_NONCLEARBG)
Font_Flush();
font_colourmask = col;
col = (charcode&CON_FGMASK)>>CON_FGSHIFT;
font_forecolour[0] = consolecolours[col].fr*255;
font_forecolour[1] = consolecolours[col].fg*255;
font_forecolour[2] = consolecolours[col].fb*255;
font_forecolour[3] = (charcode & CON_HALFALPHA)?127:255;
col = (charcode&CON_BGMASK)>>CON_BGSHIFT;
font_backcolour[0] = consolecolours[col].fr*255;
font_backcolour[1] = consolecolours[col].fg*255;
font_backcolour[2] = consolecolours[col].fb*255;
font_backcolour[3] = (charcode & CON_NONCLEARBG)?127:0;
}
}
s0 = (float)c->bmx/PLANEWIDTH;
@ -1480,7 +1525,7 @@ int Font_DrawChar(int px, int py, unsigned int charcode)
}
/*there is no sane way to make this pixel-correct*/
float Font_DrawScaleChar(float px, float py, float cw, float ch, unsigned int charcode)
float Font_DrawScaleChar(float px, float py, unsigned int charcode)
{
struct charcache_s *c;
float s0, s1;
@ -1490,6 +1535,11 @@ float Font_DrawScaleChar(float px, float py, float cw, float ch, unsigned int ch
int col;
int v;
struct font_s *font = curfont;
float cw, ch;
// if (!curfont_scaled)
// return Font_DrawChar(px, py, charcode);
if (charcode & CON_2NDCHARSETTEXT)
{
if (font->alt)
@ -1498,9 +1548,8 @@ float Font_DrawScaleChar(float px, float py, float cw, float ch, unsigned int ch
charcode |= 0xe000;
}
cw /= font->charheight;
ch /= font->charheight;
cw = curfont_scale[0];
ch = curfont_scale[1];
//crash if there is no current font.
c = Font_GetChar(font, (CHARIDXTYPE)(charcode&CON_CHARMASK));
@ -1523,24 +1572,47 @@ float Font_DrawScaleChar(float px, float py, float cw, float ch, unsigned int ch
return nextx;
}
col = charcode & (CON_NONCLEARBG|CON_BGMASK|CON_FGMASK|CON_HALFALPHA);
if (col != font_colourmask)
if (charcode & CON_RICHFORECOLOUR)
{
if ((col ^ font_colourmask) & CON_NONCLEARBG)
Font_Flush();
font_colourmask = col;
col = charcode & (CON_RICHFORECOLOUR|(0xfff<<CON_RICHBSHIFT));
if (col != font_colourmask)
{
if (font_backcolour[3])
Font_Flush();
font_colourmask = col;
col = (charcode&CON_FGMASK)>>CON_FGSHIFT;
font_forecolour[0] = consolecolours[col].fr*255;
font_forecolour[1] = consolecolours[col].fg*255;
font_forecolour[2] = consolecolours[col].fb*255;
font_forecolour[3] = (charcode & CON_HALFALPHA)?127:255;
font_forecolour[0] = ((col>>CON_RICHRSHIFT)&0xf)*0x11;
font_forecolour[1] = ((col>>CON_RICHGSHIFT)&0xf)*0x11;
font_forecolour[2] = ((col>>CON_RICHBSHIFT)&0xf)*0x11;
font_forecolour[3] = 255;
col = (charcode&CON_BGMASK)>>CON_BGSHIFT;
font_backcolour[0] = consolecolours[col].fr*255;
font_backcolour[1] = consolecolours[col].fg*255;
font_backcolour[2] = consolecolours[col].fb*255;
font_backcolour[3] = (charcode & CON_NONCLEARBG)?127:0;
font_backcolour[0] = 0;
font_backcolour[1] = 0;
font_backcolour[2] = 0;
font_backcolour[3] = 0;
}
}
else
{
col = charcode & (CON_NONCLEARBG|CON_BGMASK|CON_FGMASK|CON_HALFALPHA);
if (col != font_colourmask)
{
if (font_backcolour[3] != ((charcode & CON_NONCLEARBG)?127:0))
Font_Flush();
font_colourmask = col;
col = (charcode&CON_FGMASK)>>CON_FGSHIFT;
font_forecolour[0] = consolecolours[col].fr*255;
font_forecolour[1] = consolecolours[col].fg*255;
font_forecolour[2] = consolecolours[col].fb*255;
font_forecolour[3] = (charcode & CON_HALFALPHA)?127:255;
col = (charcode&CON_BGMASK)>>CON_BGSHIFT;
font_backcolour[0] = consolecolours[col].fr*255;
font_backcolour[1] = consolecolours[col].fg*255;
font_backcolour[2] = consolecolours[col].fb*255;
font_backcolour[3] = (charcode & CON_NONCLEARBG)?127:0;
}
}
s0 = (float)c->bmx/PLANEWIDTH;
@ -1550,8 +1622,8 @@ float Font_DrawScaleChar(float px, float py, float cw, float ch, unsigned int ch
if (c->texplane >= DEFAULTPLANE)
{
sx = ((px+c->left));
sy = ((py+c->top));
sx = ((px+c->left*cw));
sy = ((py+c->top*ch));
sw = ((font->charheight*cw));
sh = ((font->charheight*ch));
@ -1562,13 +1634,18 @@ float Font_DrawScaleChar(float px, float py, float cw, float ch, unsigned int ch
}
else
{
sx = ((px+(c->left*(int)vid.width) / (float)vid.rotpixelwidth));
sy = ((py+(c->top*(int)vid.height) / (float)vid.rotpixelheight));
sx = (px+c->left*cw);
sy = (py+c->top*ch);
sw = ((c->bmw*cw));
sh = ((c->bmh*ch));
v = Font_BeginChar(fontplanes.texnum[c->texplane]);
}
sx *= (int)vid.width / (float)vid.rotpixelwidth;
sy *= (int)vid.height / (float)vid.rotpixelheight;
sw *= (int)vid.width / (float)vid.rotpixelwidth;
sh *= (int)vid.height / (float)vid.rotpixelheight;
font_texcoord[v+0][0] = s0;
font_texcoord[v+0][1] = t0;
font_texcoord[v+1][0] = s1;

View file

@ -729,7 +729,7 @@ static qboolean Terr_SaveSection(heightmap_t *hm, hmsection_t *s, int sx, int sy
//kill the haswater flag if its entirely above any possible water anyway.
if (s->waterheight < s->minh)
ds.flags &= ~TSF_HASWATER;
ds.flags &= TSF_HASCOLOURS; //recalculate
ds.flags &= ~TSF_HASCOLOURS; //recalculated
Q_strncpyz(ds.texname[0], s->texname[0], sizeof(ds.texname[0]));
Q_strncpyz(ds.texname[1], s->texname[1], sizeof(ds.texname[1]));
@ -832,8 +832,8 @@ static hmsection_t *Terr_GetSection(heightmap_t *hm, int x, int y, qboolean dolo
{
if (doload)
{
while (hm->activesections > TERRAINACTIVESECTIONS)
Terr_Collect(hm);
// while (hm->activesections > TERRAINACTIVESECTIONS)
// Terr_Collect(hm);
section = cluster->section[sx + sy*MAXSECTIONS] = Terr_LoadSection(hm, section, x, y);
}
}
@ -972,17 +972,22 @@ static void Terr_Collect(heightmap_t *hm)
for (ln = &hm->recycle; ln->next != &hm->recycle; )
{
s = (hmsection_t*)ln->next;
cx = s->sx/MAXSECTIONS;
cy = s->sy/MAXSECTIONS;
c = hm->cluster[cx + cy*MAXSECTIONS];
sx = s->sx & (MAXSECTIONS-1);
sy = s->sy & (MAXSECTIONS-1);
if (c->section[sx+sy*MAXSECTIONS] != s)
Sys_Error("invalid section collection");
c->section[sx+sy*MAXSECTIONS] = NULL;
if (s->flags & TSF_EDITED)
ln = &s->recycle;
else
{
cx = s->sx/MAXSECTIONS;
cy = s->sy/MAXSECTIONS;
c = hm->cluster[cx + cy*MAXSECTIONS];
sx = s->sx & (MAXSECTIONS-1);
sy = s->sy & (MAXSECTIONS-1);
if (c->section[sx+sy*MAXSECTIONS] != s)
Sys_Error("invalid section collection");
c->section[sx+sy*MAXSECTIONS] = NULL;
Terr_DestroySection(hm, s, true);
return;
Terr_DestroySection(hm, s, true);
return;
}
}
}
@ -1049,8 +1054,9 @@ void Terr_PurgeTerrainModel(model_t *mod, qboolean lightmapsonly, qboolean light
void Terr_DrawTerrainWater(heightmap_t *hm, float *mins, float *maxs, float waterz, float r, float g, float b, float a)
{
scenetris_t *t;
int flags = BEF_NOSHADOWS;
if (cl_numstris && cl_stris[cl_numstris-1].shader == hm->watershader)
if (cl_numstris && cl_stris[cl_numstris-1].shader == hm->watershader && cl_stris[cl_numstris-1].flags == flags)
{
t = &cl_stris[cl_numstris-1];
}
@ -1063,6 +1069,7 @@ void Terr_DrawTerrainWater(heightmap_t *hm, float *mins, float *maxs, float wate
}
t = &cl_stris[cl_numstris++];
t->shader = hm->watershader;
t->flags = flags;
t->firstidx = cl_numstrisidx;
t->firstvert = cl_numstrisvert;
t->numvert = 0;
@ -1504,7 +1511,6 @@ void Terr_DrawInBounds(struct tdibctx *ctx, int x, int y, int w, int h)
{
vec3_t mins, maxs;
hmsection_t *s;
mesh_t *mesh;
int i;
batch_t *b;
heightmap_t *hm = ctx->hm;
@ -1539,7 +1545,6 @@ void Terr_DrawInBounds(struct tdibctx *ctx, int x, int y, int w, int h)
}
}
mesh = &s->mesh;
if (s->flags & TSF_DIRTY)
{
s->flags &= ~TSF_DIRTY;
@ -1580,7 +1585,7 @@ void Terr_DrawInBounds(struct tdibctx *ctx, int x, int y, int w, int h)
b->shader = hm->shader;
b->flags = 0;
b->mesh = &s->amesh;
b->mesh[0] = mesh;
b->mesh[0] = &s->mesh;
b->meshes = 1;
b->buildmeshes = NULL;
b->skin = &s->textures;
@ -1637,6 +1642,10 @@ void Terr_DrawTerrainModel (batch_t **batches, entity_t *e)
batch_t *b;
int bounds[4];
struct tdibctx tdibctx;
if (!r_refdef.recurse)
while (hm->activesections > TERRAINACTIVESECTIONS)
Terr_Collect(hm);
if (hm->relight)
ted_dorelight(hm);
@ -2136,11 +2145,14 @@ static void Heightmap_Trace_Square(hmtrace_t *tr, int tx, int ty)
hmsection_t *s;
unsigned int holebit;
if (tx < 0 || tx >= CHUNKLIMIT*(SECTHEIGHTSIZE-1))
return;
if (ty < 0 || ty >= CHUNKLIMIT*(SECTHEIGHTSIZE-1))
return;
s = Terr_GetSection(tr->hm, tx/(SECTHEIGHTSIZE-1), ty/(SECTHEIGHTSIZE-1), true);
sx = tx/(SECTHEIGHTSIZE-1);
sy = ty/(SECTHEIGHTSIZE-1);
if (sx < tr->hm->firstsegx || sx >= tr->hm->maxsegx)
s = NULL;
else if (sy < tr->hm->firstsegy || sy >= tr->hm->maxsegy)
s = NULL;
else
s = Terr_GetSection(tr->hm, sx, sy, true);
if (!s)
{
@ -2853,7 +2865,7 @@ static void ted_itterate(heightmap_t *hm, int distribution, float *pos, float ra
}
}
void QCBUILTIN PF_terrain_edit(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_terrain_edit(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
world_t *vmw = prinst->parms->user;
int action = G_FLOAT(OFS_PARM0);
@ -3107,7 +3119,7 @@ void QCBUILTIN PF_terrain_edit(progfuncs_t *prinst, struct globalvars_s *pr_glob
}
}
#else
void QCBUILTIN PF_terrain_edit(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_terrain_edit(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN) = 0;
}

View file

@ -430,10 +430,6 @@ void RMod_Init (void)
Cmd_AddCommand("mod_batchlist", RMod_BatchList_f);
Cmd_AddCommand("mod_texturelist", RMod_TextureList_f);
Cmd_AddCommand("mod_usetexture", RMod_BlockTextureColour_f);
#ifdef TERRAIN
Terr_Init();
#endif
}
void RMod_Shutdown (void)
@ -618,6 +614,14 @@ model_t *RMod_LoadModel (model_t *mod, qboolean crash)
return mod;
}
#ifdef RAGDOLL
if (mod->dollinfo)
{
rag_freedoll(mod->dollinfo);
mod->dollinfo = NULL;
}
#endif
//
// load the file
//
@ -878,6 +882,19 @@ model_t *RMod_LoadModel (model_t *mod, qboolean crash)
TRACE(("RMod_LoadModel: Loaded\n"));
#ifdef RAGDOLL
{
int numbones = Mod_GetNumBones(mod, false);
if (numbones)
{
char *dollname = va("%s.doll", mod->name);
buf = (unsigned *)COM_LoadStackFile (dollname, stackbuf, sizeof(stackbuf));
if (buf)
mod->dollinfo = rag_createdollfromstring(mod, dollname, numbones, (char*)buf);
}
}
#endif
return mod;
}
@ -1721,9 +1738,15 @@ void RMod_LoadLighting (lump_t *l)
else if (litdata[0] == 'Q' && litdata[1] == 'L' && litdata[2] == 'I' && litdata[3] == 'T')
{
if (LittleLong(*(int *)&litdata[4]) == 1 && l->filelen && samples*3 != (com_filesize-8))
{
litdata = NULL;
Con_Printf("lit \"%s\" doesn't match level. Ignored.\n", litname);
}
else if (LittleLong(*(int *)&litdata[4]) != 1)
{
Con_Printf("lit \"%s\" isn't version 1.\n", litname);
litdata = NULL;
}
else if (lumdata)
{
float prop;
@ -2788,6 +2811,9 @@ void RMod_Batches_Build(mesh_t *meshlist, model_t *mod, void (*build)(model_t *m
currentmodel = mod;
if (!mod->textures)
return;
if (meshlist)
meshlist += mod->firstmodelsurface;
else if (!build)

View file

@ -50,6 +50,14 @@ typedef enum {
} shadersort_t;
#define MAX_BONES 128
struct doll_s;
void rag_flushdolls(qboolean force);
void rag_freedoll(struct doll_s *doll);
struct doll_s *rag_createdollfromstring(struct model_s *mod, char *fname, int numbones, char *file);
struct world_s;
void rag_doallanimations(struct world_s *world);
void rag_removedeltaent(lerpents_t *le);
void rag_updatedeltaent(entity_t *ent, lerpents_t *le);
typedef struct mesh_s
{
@ -955,6 +963,8 @@ typedef struct model_s
q3lightgridinfo_t *lightgrid;
char *entities;
struct doll_s *dollinfo;
struct {
texture_t *tex;
vbo_t *vbo;

View file

@ -987,7 +987,7 @@ void R_Clear (void)
/*tbh, this entire function should be in the backend*/
GL_ForceDepthWritable();
{
if (r_clear.ival && !r_secondaryview && !(r_refdef.flags & Q2RDF_NOWORLDMODEL))
if (r_clear.ival && !r_secondaryview && !r_refdef.currentplayernum && !(r_refdef.flags & Q2RDF_NOWORLDMODEL))
{
qglClearColor(1, 0, 0, 0);
qglClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@ -1065,7 +1065,7 @@ static void R_RenderMotionBlur(void)
#if !defined(ANDROID) && !defined(NACL)
//figure out the size of our texture.
if (gl_config.arb_texture_non_power_of_two)
if (r_config.texture_non_power_of_two)
{ //we can use any size, supposedly
vwidth = vid.pixelwidth;
vheight = vid.pixelheight;
@ -1181,7 +1181,7 @@ qboolean R_RenderScene_Cubemap(void)
prect.y = (vrect.y * vid.pixelheight)/vid.height;
prect.height = (vrect.height * vid.pixelheight)/vid.height;
if (gl_config.arb_texture_non_power_of_two)
if (r_config.texture_non_power_of_two)
{
if (prect.width < prect.height)
cmapsize = prect.width;
@ -1369,11 +1369,11 @@ void GLR_RenderView (void)
checkglerror();
GL_Set2D (false);
if (r_refdef.flags & Q2RDF_NOWORLDMODEL)
return;
GL_Set2D (false);
if (r_bloom.value)
R_BloomBlend();

View file

@ -198,9 +198,6 @@ void GLSCR_UpdateScreen (void)
SCR_DrawTwoDimensional(uimenu, nohud);
if (Key_MouseShouldBeFree())
SCR_DrawCursor(0);
V_UpdatePalette (false);
R2D_BrightenScreen();

View file

@ -76,9 +76,9 @@ qbyte FloatToByte( float x )
cvar_t r_detailtextures;
#define MAX_TOKEN_CHARS 1024
#define MAX_TOKEN_CHARS sizeof(com_token)
char *COM_ParseExt (char **data_p, qboolean nl)
char *COM_ParseExt (char **data_p, qboolean nl, qboolean comma)
{
int c;
int len;
@ -154,13 +154,13 @@ skipwhite:
}
data++;
c = *data;
if (c == ',' && len)
if (c == ',' && len && comma)
break;
} while (c>32);
if (len == MAX_TOKEN_CHARS)
{
// Com_Printf ("Token exceeded %i chars, discarded.\n", MAX_TOKEN_CHARS);
Con_DPrintf ("Token exceeded %i chars, discarded.\n", MAX_TOKEN_CHARS);
len = 0;
}
com_token[len] = 0;
@ -216,12 +216,12 @@ static void Shader_ReadShader(shader_t *s, char *shadersource, int parsemode);
//===========================================================================
static qboolean Shader_EvaluateCondition(char **ptr)
static qboolean Shader_EvaluateCondition(shader_t *shader, char **ptr)
{
char *token;
cvar_t *cv;
qboolean conditiontrue = true;
token = COM_ParseExt ( ptr, false );
token = COM_ParseExt(ptr, false, false);
if (*token == '!')
{
conditiontrue = false;
@ -300,9 +300,34 @@ static qboolean Shader_EvaluateCondition(char **ptr)
conditiontrue = conditiontrue == false;
break;
}
#ifdef warningmsg
#pragma warningmsg("shader fixme")
}
else if (!Q_stricmp(token, "haveprogram") )
{
conditiontrue = conditiontrue == !!shader->prog;
}
else if (!Q_stricmp(token, "programs") )
{
switch(qrenderer)
{
#ifdef GLQUAKE
case QR_OPENGL:
conditiontrue = conditiontrue == gl_config.arb_shader_objects; //FIXME
break;
#endif
#ifdef D3D9QUAKE
case QR_DIRECT3D9:
conditiontrue = conditiontrue == true; //FIXME
break;
#endif
#ifdef D3D11QUAKE
case QR_DIRECT3D11:
conditiontrue = conditiontrue == true;
break;
#endif
default:
conditiontrue = conditiontrue == false;
break;
}
}
else if (!Q_stricmp(token, "diffuse") )
conditiontrue = conditiontrue == true;
@ -328,14 +353,14 @@ static qboolean Shader_EvaluateCondition(char **ptr)
Con_Printf("Shader_EvaluateCondition: '%s' is not a cvar\n", token);
return conditiontrue;
}
token = COM_ParseExt ( ptr, false );
token = COM_ParseExt(ptr, false, false);
cv->flags |= CVAR_SHADERSYSTEM;
if (*token)
{
float rhs;
char cmp[4];
memcpy(cmp, token, 4);
token = COM_ParseExt ( ptr, false );
token = COM_ParseExt(ptr, false, false);
rhs = atof(token);
if (!strcmp(cmp, "!="))
conditiontrue = cv->value != rhs;
@ -358,15 +383,30 @@ static qboolean Shader_EvaluateCondition(char **ptr)
conditiontrue = conditiontrue == !!cv->value;
}
}
token = COM_ParseExt ( ptr, false );
token = COM_ParseExt(ptr, false, false);
if (!strcmp(token, "&&"))
return Shader_EvaluateCondition(ptr) && conditiontrue;
return Shader_EvaluateCondition(shader, ptr) && conditiontrue;
if (!strcmp(token, "||"))
return Shader_EvaluateCondition(ptr) || conditiontrue;
return Shader_EvaluateCondition(shader, ptr) || conditiontrue;
return conditiontrue;
}
static char *Shader_ParseExactString(char **ptr)
{
char *token;
if ( !ptr || !(*ptr) ) {
return "";
}
if ( !**ptr || **ptr == '}' ) {
return "";
}
token = COM_ParseExt(ptr, false, false);
return token;
}
static char *Shader_ParseString ( char **ptr )
{
char *token;
@ -378,7 +418,7 @@ static char *Shader_ParseString ( char **ptr )
return "";
}
token = COM_ParseExt ( ptr, false );
token = COM_ParseExt(ptr, false, true);
Q_strlwr ( token );
return token;
@ -395,7 +435,7 @@ static char *Shader_ParseSensString ( char **ptr )
return "";
}
token = COM_ParseExt ( ptr, false );
token = COM_ParseExt(ptr, false, true);
return token;
}
@ -412,7 +452,7 @@ static float Shader_ParseFloat(char **ptr)
return 0;
}
token = COM_ParseExt(ptr, false);
token = COM_ParseExt(ptr, false, true);
if (*token == '$')
{
cvar_t *var;
@ -885,6 +925,22 @@ static qboolean Shader_LoadPermutations(char *name, program_t *prog, char *scrip
}
script = end;
}
else if (!strncmp(script, "!!cvari", 7))
{
script += 7;
while (*script == ' ' || *script == '\t')
script++;
end = script;
while ((*end >= 'A' && *end <= 'Z') || (*end >= 'a' && *end <= 'z') || (*end >= '0' && *end <= '9') || *end == '_')
end++;
if (cvarcount+1 != sizeof(cvarnames)/sizeof(cvarnames[0]))
{
cvartypes[cvarcount] = SP_CVARI;
cvarnames[cvarcount++] = script;
cvarnames[cvarcount] = NULL;
}
script = end;
}
else if (!strncmp(script, "!!cvarv", 7))
{
script += 7;
@ -1539,8 +1595,8 @@ struct shader_field_names_s shader_unif_names[] =
{"e_colour", SP_E_COLOURS},
{"e_colourident", SP_E_COLOURSIDENT},
{"e_glowmod", SP_E_GLOWMOD},
{"e_topcolour", SP_E_TOPCOLOURS},
{"e_bottomcolour", SP_E_BOTTOMCOLOURS},
{"e_uppercolour", SP_E_TOPCOLOURS},
{"e_lowercolour", SP_E_BOTTOMCOLOURS},
{"e_light_dir", SP_E_L_DIR},
{"e_light_mul", SP_E_L_MUL},
{"e_light_ambient", SP_E_L_AMBIENT},
@ -1648,7 +1704,7 @@ static void Shader_ProgAutoFields(program_t *prog, char **cvarnames, int *cvarty
uniformloc = qglGetUniformLocationARB(prog->permu[p].handle.glsl, va("cvar_%s", tmpname));
if (uniformloc != -1)
{
qglUniform1fARB(uniformloc, cvar->value);
//qglUniform1fARB(uniformloc, cvar->value);
found = true;
}
prog->permu[p].parm[prog->numparams] = uniformloc;
@ -1813,11 +1869,11 @@ static void Shader_SLProgramName (shader_t *shader, shaderpass_t *pass, char **p
{
//pass the # postfixes from the shader name onto the generic glsl to use
char newname[512];
Q_snprintfz(newname, sizeof(newname), "%s%s", Shader_ParseString(ptr), hash);
Q_snprintfz(newname, sizeof(newname), "%s%s", Shader_ParseExactString(ptr), hash);
shader->prog = Shader_FindGeneric(newname, qrtype);
}
else
shader->prog = Shader_FindGeneric(Shader_ParseString(ptr), qrtype);
shader->prog = Shader_FindGeneric(Shader_ParseExactString(ptr), qrtype);
}
static void Shader_GLSLProgramName (shader_t *shader, shaderpass_t *pass, char **ptr)
@ -2947,7 +3003,7 @@ static void Shader_MakeCache ( char *path )
if ( ptr - buf >= size )
break;
token = COM_ParseExt ( &ptr, true );
token = COM_ParseExt (&ptr, true, true);
if ( !token[0] || ptr - buf >= size )
break;
@ -2982,19 +3038,19 @@ char *Shader_Skip ( char *ptr )
int brace_count;
// Opening brace
tok = COM_ParseExt ( &ptr, true );
tok = COM_ParseExt(&ptr, true, true);
if (!ptr)
return NULL;
if ( tok[0] != '{' )
{
tok = COM_ParseExt ( &ptr, true );
tok = COM_ParseExt (&ptr, true, true);
}
for (brace_count = 1; brace_count > 0 ; ptr++)
{
tok = COM_ParseExt ( &ptr, true );
tok = COM_ParseExt (&ptr, true, true);
if ( !tok[0] )
return NULL;
@ -3177,7 +3233,7 @@ void Shader_Readpass (shader_t *shader, char **ptr)
while ( *ptr )
{
token = COM_ParseExt (ptr, true);
token = COM_ParseExt (ptr, true, true);
if ( !token[0] )
{
@ -3190,11 +3246,11 @@ void Shader_Readpass (shader_t *shader, char **ptr)
else if (!Q_stricmp(token, "if"))
{
int nest = 0;
qboolean conditionistrue = Shader_EvaluateCondition(ptr);
qboolean conditionistrue = Shader_EvaluateCondition(shader, ptr);
while (*ptr)
{
token = COM_ParseExt (ptr, true);
token = COM_ParseExt (ptr, true, true);
if ( !token[0] )
continue;
else if (token[0] == ']')
@ -3293,7 +3349,7 @@ static qboolean Shader_Parsetok (shader_t *shader, shaderpass_t *pass, shaderkey
// Next Line
while (ptr)
{
token = COM_ParseExt ( ptr, false );
token = COM_ParseExt(ptr, false, true);
if ( !token[0] )
{
break;
@ -4563,6 +4619,15 @@ void Shader_DefaultSkin(char *shortname, shader_t *s, const void *args)
"map $fullbright\n"
"blendfunc add\n"
"}\n"
"if $haveprogram\n"
"[\n"
"{\n"
"map $normalmap\n"
"}\n"
"{\n"
"map $specular\n"
"}\n"
"]\n"
"}\n"
);
}
@ -4628,7 +4693,7 @@ static void Shader_ReadShader(shader_t *s, char *shadersource, int parsemode)
while (shadersource)
{
token = COM_ParseExt (&shadersource, true);
token = COM_ParseExt (&shadersource, true, true);
if ( !token[0] )
continue;
@ -4637,11 +4702,11 @@ static void Shader_ReadShader(shader_t *s, char *shadersource, int parsemode)
else if (!Q_stricmp(token, "if"))
{
int nest = 0;
qboolean conditionistrue = Shader_EvaluateCondition(&shadersource);
qboolean conditionistrue = Shader_EvaluateCondition(s, &shadersource);
while (shadersource)
{
token = COM_ParseExt (&shadersource, true);
token = COM_ParseExt (&shadersource, true, true);
if ( !token[0] )
continue;
else if (token[0] == ']')
@ -4702,7 +4767,7 @@ static qboolean Shader_ParseShader(char *shortname, char *usename, shader_t *s)
file = buf + offset;
token = COM_ParseExt (&file, true);
token = COM_ParseExt (&file, true, true);
if ( !file || token[0] != '{' )
{
FS_FreeFile(buf);

View file

@ -1002,6 +1002,9 @@ static struct {
static void SHM_Shutdown(void)
{
SH_FreeShadowMesh_(&sh_tempshmesh);
BZ_Free(sh_tempshmesh.litleaves);
sh_tempshmesh.litleaves = NULL;
sh_tempshmesh.leafbytes = 0;
free(cv.tris);
free(cv.edges);
free(cv.points);
@ -1417,20 +1420,25 @@ static qboolean Sh_LeafInView(qbyte *lightvis, qbyte *vvis)
typedef struct
{
int x;
int y;
int width;
int height;
float x;
float y;
float width;
float height;
double dmin;
double dmax;
} srect_t;
static void Sh_Scissor (srect_t r)
{
float xs = vid.pixelwidth / (float)vid.width, ys = vid.pixelheight / (float)vid.height;
switch(qrenderer)
{
#ifdef GLQUAKE
case QR_OPENGL:
qglScissor(r.x, r.y, r.width, r.height);
qglScissor(
floor(r_refdef.pxrect.x + r.x*r_refdef.pxrect.width),
floor((r_refdef.pxrect.y + r.y*r_refdef.pxrect.height) - r_refdef.pxrect.height),
ceil(r.width * r_refdef.pxrect.width),
ceil(r.height * r_refdef.pxrect.height));
qglEnable(GL_SCISSOR_TEST);
if (qglDepthBoundsEXT)
@ -1548,8 +1556,8 @@ static qboolean Sh_ScissorForBox(vec3_t mins, vec3_t maxs, srect_t *r)
r->x = 0;
r->y = 0;
r->width = vid.pixelwidth;
r->height = vid.pixelheight;
r->width = 1;
r->height = 1;
r->dmin = 0;
r->dmax = 1;
if (0)//!r_shadow_scissor.integer)
@ -1616,10 +1624,10 @@ static qboolean Sh_ScissorForBox(vec3_t mins, vec3_t maxs, srect_t *r)
if (z < z1) z1 = z;
if (z > z2) z2 = z;
}
x1 = ((1+x1) * r_refdef.vrect.width * vid.pixelwidth) / (vid.width * 2);
x2 = ((1+x2) * r_refdef.vrect.width * vid.pixelwidth) / (vid.width * 2);
y1 = ((1+y1) * r_refdef.vrect.height * vid.pixelheight) / (vid.height * 2);
y2 = ((1+y2) * r_refdef.vrect.height * vid.pixelheight) / (vid.height * 2);
x1 = (1+x1) / 2;
x2 = (1+x2) / 2;
y1 = (1+y1) / 2;
y2 = (1+y2) / 2;
z1 = (1+z1) / 2;
z2 = (1+z2) / 2;
@ -1631,21 +1639,21 @@ static qboolean Sh_ScissorForBox(vec3_t mins, vec3_t maxs, srect_t *r)
x2 = 0;
if (y2 < 0)
y2 = 0;
if (x1 > r_refdef.vrect.width * vid.pixelwidth / vid.width)
x1 = r_refdef.vrect.width * vid.pixelwidth / vid.width;
if (y1 > r_refdef.vrect.height * vid.pixelheight / vid.height)
y1 = r_refdef.vrect.height * vid.pixelheight / vid.height;
if (x2 > r_refdef.vrect.width * vid.pixelwidth / vid.width)
x2 = r_refdef.vrect.width * vid.pixelwidth / vid.width;
if (y2 > r_refdef.vrect.height * vid.pixelheight / vid.height)
y2 = r_refdef.vrect.height * vid.pixelheight / vid.height;
r->x = floor(x1);
r->y = floor(y1);
r->width = ceil(x2) - r->x;
r->height = ceil(y2) - r->y;
if (x1 > 1)
x1 = 1;
if (y1 > 1)
y1 = 1;
if (x2 > 1)
x2 = 1;
if (y2 > 1)
y2 = 1;
r->x = x1;
r->y = y1;
r->width = x2 - r->x;
r->height = y2 - r->y;
if (r->width == 0 || r->height == 0)
return true; //meh
r->x += r_refdef.vrect.x;
r->y += r_refdef.vrect.y;
r->dmin = z1;
r->dmax = z2;
return false;
@ -1910,13 +1918,7 @@ static void Sh_GenShadowFace(dlight_t *l, shadowmesh_t *smesh, int face, float p
int smsize = SHADOWMAP_SIZE;
if (l->fov)
qglViewport (0, 0, smsize, smsize);
else
{
qglViewport ((face%3 * smsize), ((face>=3)*smsize), smsize, smsize);
}
//FIXME: figure out the four lines bounding the light cone by just adding its +forward+/-right+/-up values. if any point towards a plane (and starts outside that plane), and the point of intersection with that line and the frustum side plane is infront of the near clip plane, then that light frustum needs to be rendered...
switch(face)
{
case 0:
@ -1960,6 +1962,14 @@ static void Sh_GenShadowFace(dlight_t *l, shadowmesh_t *smesh, int face, float p
r_refdef.flipcull = false;
break;
}
if (l->fov)
qglViewport (0, 0, smsize, smsize);
else
{
qglViewport ((face%3 * smsize), ((face>=3)*smsize), smsize, smsize);
}
//fixme
GL_CullFace(0);
R_SetFrustum(proj, r_refdef.m_view);

View file

@ -525,7 +525,7 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name))
qglRenderbufferStorageEXT = NULL;
qglFramebufferTexture2DEXT = NULL;
gl_config.arb_texture_non_power_of_two = false;
r_config.texture_non_power_of_two = false;
gl_config.sgis_generate_mipmap = false;
gl_config.tex_env_combine = false;
@ -551,7 +551,7 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name))
}
if (GL_CheckExtension("GL_ARB_texture_non_power_of_two") || GL_CheckExtension("GL_OES_texture_npot"))
gl_config.arb_texture_non_power_of_two = true;
r_config.texture_non_power_of_two = true;
// if (GL_CheckExtension("GL_SGIS_generate_mipmap")) //a suprising number of implementations have this broken.
// gl_config.sgis_generate_mipmap = true;

View file

@ -939,7 +939,7 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette)
prots[0] = XInternAtom(vid_dpy, "WM_DELETE_WINDOW", False);
XSetWMProtocols(vid_dpy, vid_window, prots, sizeof(prots)/sizeof(prots[0]));
/*set caption*/
XStoreName(vid_dpy, vid_window, "FTE QuakeWorld");
XStoreName(vid_dpy, vid_window, FULLENGINENAME);
/*make it visibl*/
XMapWindow(vid_dpy, vid_window);
/*put it somewhere*/

View file

@ -1540,18 +1540,20 @@ BOOL CheckForcePixelFormat(rendererstate_t *info)
float fAttributes[] = {0,0};
UINT numFormats;
int pixelformat;
int iAttributes[] = { WGL_DRAW_TO_WINDOW_ARB,GL_TRUE,
WGL_SUPPORT_OPENGL_ARB,GL_TRUE,
WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB,
WGL_COLOR_BITS_ARB,info->bpp,
WGL_ALPHA_BITS_ARB,8,
WGL_DEPTH_BITS_ARB,16,
WGL_STENCIL_BITS_ARB,8,
WGL_DOUBLE_BUFFER_ARB,GL_TRUE,
WGL_SAMPLE_BUFFERS_ARB,GL_TRUE,
WGL_SAMPLES_ARB, info->multisample, // Check For 4x Multisampling
WGL_STEREO_ARB, info->stereo,
0,0};
int iAttributes[] = {
WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
WGL_COLOR_BITS_ARB, info->bpp,
WGL_ALPHA_BITS_ARB, 8,
WGL_DEPTH_BITS_ARB, 16,
WGL_STENCIL_BITS_ARB, 8,
WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
WGL_SAMPLE_BUFFERS_ARB, GL_TRUE,
WGL_SAMPLES_ARB, info->multisample, // Check For 4x Multisampling
WGL_STEREO_ARB, info->stereo,
0, 0
};
TRACE(("dbg: bSetupPixelFormat: attempting wglChoosePixelFormatARB (multisample 4)\n"));
hDC = GetDC(mainwindow);
@ -1642,7 +1644,7 @@ void FixPaletteInDescriptor(HDC hDC, PIXELFORMATDESCRIPTOR *pfd)
BOOL bSetupPixelFormat(HDC hDC, rendererstate_t *info)
{
static PIXELFORMATDESCRIPTOR pfd = {
PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
1, // version number
PFD_DRAW_TO_WINDOW // support window
@ -1713,6 +1715,8 @@ BOOL bSetupPixelFormat(HDC hDC, rendererstate_t *info)
}
}
qDescribePixelFormat(hDC, pixelformat, sizeof(pfd), &pfd);
if (qSetPixelFormat(hDC, pixelformat, &pfd) == FALSE)
{
Con_Printf("bSetupPixelFormat: SetPixelFormat failed (%i)\n", (int)GetLastError());

View file

@ -44,6 +44,12 @@ void AddPointToBounds (vec3_t v, vec3_t mins, vec3_t maxs);
qboolean BoundsIntersect (vec3_t mins1, vec3_t maxs1, vec3_t mins2, vec3_t maxs2);
void ClearBounds (vec3_t mins, vec3_t maxs);
//optional features common to all renderers, so I don't have to check to see which one it is all the time.
typedef struct {
qboolean texture_non_power_of_two;
} r_config_t;
extern r_config_t r_config;
#ifdef GLQUAKE
#if defined(ANDROID) /*FIXME: actually just to use standard GLES headers instead of full GL*/
#if 1
@ -185,7 +191,6 @@ typedef struct {
qboolean nv_tex_env_combine4;
qboolean env_add;
qboolean arb_texture_non_power_of_two;
qboolean sgis_generate_mipmap;
qboolean arb_texture_env_combine;

View file

@ -492,6 +492,7 @@ mfog_t *CM_FogForOrigin(vec3_t org);
#define BEF_NODLIGHT 64 //don't use a dlight pass
#define BEF_NOSHADOWS 128 //don't appear in shadows
#define BEF_FORCECOLOURMOD 256 //q3 shaders default to 'rgbgen identity', and ignore ent colours. this forces ent colours to be considered
#define BEF_LINES 512 //draw line pairs instead of triangles.
#ifdef GLQUAKE
void GLBE_Init(void);

View file

@ -20,11 +20,9 @@
#include "netinc.h"
int ftpfilelistsocket;
static iwboolean ftpserverinitied = false;
iwboolean ftpserverfailed = false;
static int ftpserversocket;
static int ftpserversocket = INVALID_SOCKET;
qboolean ftpserverfailed;
typedef struct FTPclient_s{
@ -51,55 +49,75 @@ typedef struct FTPclient_s{
FTPclient_t *FTPclient;
qboolean FTP_ServerInit(int port)
int FTP_BeginListening(int aftype, int port)
{
struct sockaddr_in address;
struct sockaddr_qstorage address;
unsigned long _true = true;
unsigned long _false = false;
int i;
int sock;
if ((ftpserversocket = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1)
if ((sock = socket ((aftype!=1)?PF_INET6:PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1)
{
IWebPrintf ("FTP_TCP_OpenSocket: socket: %s\n", strerror(qerrno));
ftpserverfailed = true;
return false;
IWebPrintf ("FTP_BeginListening: socket: %s\n", strerror(qerrno));
return INVALID_SOCKET;
}
if (ioctlsocket (ftpserversocket, FIONBIO, &_true) == -1)
if (ioctlsocket (sock, FIONBIO, &_true) == -1)
{
IWebPrintf ("FTP_TCP_OpenSocket: ioctl FIONBIO: %s", strerror(qerrno));
ftpserverfailed = true;
return false;
IWebPrintf ("FTP_BeginListening: ioctl FIONBIO: %s", strerror(qerrno));
return INVALID_SOCKET;
}
address.sin_family = AF_INET;
//ZOID -- check for interface binding option
if ((i = COM_CheckParm("-ip")) != 0 && i < com_argc) {
address.sin_addr.s_addr = inet_addr(com_argv[i+1]);
Con_TPrintf(TL_NETBINDINTERFACE,
inet_ntoa(address.sin_addr));
} else
address.sin_addr.s_addr = INADDR_ANY;
if (aftype == 1)
{
//1=ipv4 only
((struct sockaddr_in*)&address)->sin_family = AF_INET;
//ZOID -- check for interface binding option
if ((i = COM_CheckParm("-ip")) != 0 && i < com_argc) {
((struct sockaddr_in*)&address)->sin_addr.s_addr = inet_addr(com_argv[i+1]);
Con_TPrintf(TL_NETBINDINTERFACE,
inet_ntoa(((struct sockaddr_in*)&address)->sin_addr));
} else
((struct sockaddr_in*)&address)->sin_addr.s_addr = INADDR_ANY;
if (port == PORT_ANY)
address.sin_port = 0;
if (port == PORT_ANY)
((struct sockaddr_in*)&address)->sin_port = 0;
else
((struct sockaddr_in*)&address)->sin_port = htons((short)port);
}
else
address.sin_port = htons((short)port);
if( bind (ftpserversocket, (void *)&address, sizeof(address)) == -1)
{
IWebPrintf("FTP_ServerInit: failed to bind socket\n");
closesocket(ftpserversocket);
ftpserverfailed = true;
return false;
//0=ipv4+ipv6
//2=ipv6 only
if (aftype == 0)
{
if (0 > setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&_false, sizeof(_false)))
{
//abort and do ipv4 only if hybrid sockets don't work.
closesocket(sock);
return FTP_BeginListening(1, port);
}
}
memset(&address, 0, sizeof(address));
((struct sockaddr_in6*)&address)->sin6_family = AF_INET6;
if (port == PORT_ANY)
((struct sockaddr_in6*)&address)->sin6_port = 0;
else
((struct sockaddr_in6*)&address)->sin6_port = htons((short)port);
}
listen(ftpserversocket, 3);
if( bind (sock, (void *)&address, sizeof(address)) == -1)
{
IWebPrintf("FTP_BeginListening: failed to bind socket\n");
closesocket(ftpserversocket);
return INVALID_SOCKET;
}
ftpserverinitied = true;
ftpserverfailed = false;
listen(sock, 3);
IWebPrintf("FTP server is running\n");
return true;
return sock;
}
void FTP_ServerShutdown(void)
@ -109,9 +127,10 @@ void FTP_ServerShutdown(void)
IWebPrintf("FTP server is deactivated\n");
}
//we ought to filter this to remove duplicates.
static int SendFileNameTo(const char *rawname, int size, void *param)
{
int socket = ftpfilelistsocket; //64->32... this is safe due to where it's called from. It's just not so portable.
int socket = *(int*)param;
// int i;
char buffer[256+1];
char *slash;
@ -186,27 +205,65 @@ int FTP_SV_makelistensocket(unsigned long nblocking)
return sock;
}
iwboolean FTP_SVSocketToString (int socket, char *s)
iwboolean FTP_SVSocketPortToString (int socket, char *s)
{
struct sockaddr_in addr;
struct sockaddr_qstorage addr;
int adrlen = sizeof(addr);
if (getsockname(socket, (struct sockaddr*)&addr, &adrlen) == -1)
return false;
sprintf(s, "%i,%i,%i,%i,%i,%i", ((qbyte *)&addr.sin_addr)[0], ((qbyte *)&addr.sin_addr)[1], ((qbyte *)&addr.sin_addr)[2], ((qbyte *)&addr.sin_addr)[3], ((qbyte *)&addr.sin_port)[0], ((qbyte *)&addr.sin_port)[1]);
if (((struct sockaddr_in*)&addr)->sin_family == AF_INET6)
sprintf(s, "%i", ntohs(((struct sockaddr_in6*)&addr)->sin6_port));
else
sprintf(s, "%i", ntohs(((struct sockaddr_in*)&addr)->sin_port));
return true;
}
iwboolean FTP_SVRemoteSocketToString (int socket, char *s)
//only to be used for ipv4 sockets.
iwboolean FTP_SVSocketToString (int socket, char *s)
{
struct sockaddr_in addr;
qbyte *baddr;
int adrlen = sizeof(addr);
char name[256];
addr.sin_family = AF_INET;
if (getpeername(socket, (struct sockaddr*)&addr, &adrlen) == -1)
//get the port.
if (getsockname(socket, (struct sockaddr*)&addr, &adrlen) == -1)
return false;
sprintf(s, "%i,%i,%i,%i,%i,%i", ((qbyte *)&addr.sin_addr)[0], ((qbyte *)&addr.sin_addr)[1], ((qbyte *)&addr.sin_addr)[2], ((qbyte *)&addr.sin_addr)[3], ((qbyte *)&addr.sin_port)[0], ((qbyte *)&addr.sin_port)[1]);
baddr = (qbyte *)&addr.sin_addr;
if (gethostname(name, sizeof(name)) != -1)
{
struct hostent *hent = gethostbyname(name);
if (hent)
baddr = hent->h_addr_list[0];
}
sprintf(s, "%i,%i,%i,%i,%i,%i", baddr[0], baddr[1], baddr[2], baddr[3], ((qbyte *)&addr.sin_port)[0], ((qbyte *)&addr.sin_port)[1]);
return true;
}
iwboolean FTP_SVRemoteSocketToString (int socket, char *s, int slen)
{
struct sockaddr_qstorage addr;
netadr_t na;
int adrlen = sizeof(addr);
// addr.sin_family = AF_INET;
if (getpeername(socket, (struct sockaddr*)&addr, &adrlen) == -1)
{
*s = 0;
return false;
}
SockadrToNetadr(&addr, &na);
NET_AdrToString(s, slen, na);
// if (((struct sockaddr_in*)&addr)->sin_family == AF_INET6)
// {
// }
// else
// sprintf(s, "%i,%i,%i,%i,%i,%i", ((qbyte *)&addr.sin_addr)[0], ((qbyte *)&addr.sin_addr)[1], ((qbyte *)&addr.sin_addr)[2], ((qbyte *)&addr.sin_addr)[3], ((qbyte *)&addr.sin_port)[0], ((qbyte *)&addr.sin_port)[1]);
return true;
}
/*
@ -249,7 +306,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl)
char *msg, *line;
char mode[64];
static char resource[8192];
char resource[8192];
int _true = true;
if (cl->datadir == 1)
@ -444,6 +501,33 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl)
*p = '\0';
QueueMessage (cl, "200 directory changed.\r\n");
}
else if (!stricmp(mode, "EPSV"))
{
int aftype = 0;
//one argument, "1"=ipv4, "2"=ipv6. if not present, use same as control connection
//reply: "229 Entering Extended Passive Mode (|||$PORTNUM|)\r\n"
if (!cl->auth)
{
QueueMessage (cl, "530 Not logged in.\r\n");
continue;
}
if (cl->datasock != INVALID_SOCKET)
{
closesocket(cl->datasock);
cl->datasock = INVALID_SOCKET;
}
cl->datasock = FTP_BeginListening(aftype, 0);
if (cl->datasock == INVALID_SOCKET)
QueueMessage (cl, "425 server was unable to make a listen socket\r\n");
else
{
FTP_SVSocketPortToString(cl->datasock, resource);
QueueMessageva (cl, "229 Entering Extended Passive Mode (|||%s|).\r\n", resource);
}
cl->dataislisten = true;
}
else if (!stricmp(mode, "PASV"))
{
if (!cl->auth)
@ -457,7 +541,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl)
cl->datasock = INVALID_SOCKET;
}
cl->datasock = FTP_SV_makelistensocket(true);
cl->datasock = FTP_BeginListening(1, 0);
if (cl->datasock == INVALID_SOCKET)
QueueMessage (cl, "425 server was unable to make a listen socket\r\n");
else
@ -467,6 +551,14 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl)
}
cl->dataislisten = true;
}
// else if (!stricmp(mode, "EPRT"))
// {
//eg: one of:
//EPRT |1|132.235.1.2|6275|
//EPRT |2|1080::8:800:200C:417A|5282|
//reply: 522 Network protocol not supported, use (1,2)
// }
else if (!stricmp(mode, "PORT"))
{
if (!cl->auth)
@ -528,7 +620,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl)
int err;
int _true = true;
int temp;
struct sockaddr_in adr;
struct sockaddr_qstorage adr;
int adrlen = sizeof(adr);
temp = accept(cl->datasock, (struct sockaddr *)&adr, &adrlen);
err = qerrno;
@ -538,7 +630,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl)
if (cl->datasock == INVALID_SOCKET)
{
QueueMessageva (cl, "425 Your client connected too slowly - %i.\r\n", err);
QueueMessageva (cl, "425 Can't accept pasv data connection - %i.\r\n", err);
continue;
}
else
@ -561,8 +653,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl)
strcat(buffer, "*");
QueueMessage (cl, "125 Opening FAKE ASCII mode data connection for file.\r\n");
ftpfilelistsocket = cl->datasock;
COM_EnumerateFiles(buffer, SendFileNameTo, NULL);
COM_EnumerateFiles(buffer, SendFileNameTo, &cl->datasock);
QueueMessage (cl, "226 Transfer complete.\r\n");
@ -593,7 +684,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl)
if (cl->datasock == INVALID_SOCKET)
{
QueueMessageva (cl, "425 Your client connected too slowly - %i.\r\n", qerrno);
QueueMessageva (cl, "425 Can't accept pasv data connection - %i.\r\n", qerrno);
continue;
}
else
@ -672,7 +763,7 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl)
if (cl->datasock == INVALID_SOCKET)
{
QueueMessageva (cl, "425 Your client connected too slowly - %i.\r\n", qerrno);
QueueMessageva (cl, "425 Can't accept pasv data connection - %i.\r\n", qerrno);
continue;
}
else
@ -776,7 +867,7 @@ unsigned int WINAPI BlockingClient(FTPclient_t *cl)
iwboolean FTP_ServerRun(iwboolean ftpserverwanted, int port)
{
FTPclient_t *cl, *prevcl;
struct sockaddr_in from;
struct sockaddr_qstorage from;
int fromlen;
int clientsock;
unsigned long _true = true;
@ -784,7 +875,15 @@ unsigned long _true = true;
if (!ftpserverinitied)
{
if (ftpserverwanted)
return FTP_ServerInit(port);
{
ftpserversocket = FTP_BeginListening(0, port);
if (ftpserversocket == INVALID_SOCKET)
{
ftpserverfailed = true;
IWebPrintf("Unable to establish listening FTP socket\n");
}
ftpserverinitied = true;
}
return false;
}
else if (!ftpserverwanted)
@ -827,9 +926,12 @@ unsigned long _true = true;
}
fromlen = sizeof(from);
clientsock = accept(ftpserversocket, (struct sockaddr *)&from, &fromlen);
if (ftpserversocket == INVALID_SOCKET)
clientsock = INVALID_SOCKET;
else
clientsock = accept(ftpserversocket, (struct sockaddr *)&from, &fromlen);
if (clientsock == -1)
if (clientsock == INVALID_SOCKET)
{
if (qerrno == EWOULDBLOCK)
return false;
@ -860,7 +962,7 @@ unsigned long _true = true;
}
{
char resource[256];
FTP_SVRemoteSocketToString(clientsock, resource);
FTP_SVRemoteSocketToString(clientsock, resource, sizeof(resource));
IWebPrintf("FTP connect from %s\n", resource);
}
cl->controlsock = clientsock;
@ -869,7 +971,7 @@ unsigned long _true = true;
cl->blocking = false;
strcpy(cl->path, "/");
QueueMessage(cl, "220-QuakeWorld FTP Server.\r\n220 Welcomes all new users.\r\n");
QueueMessage(cl, "220-" FULLENGINENAME " FTP Server.\r\n220 Welcomes all new users.\r\n");
#if defined(WEBSVONLY) && defined(_WIN32)
if (!CreateThread(NULL, 128, BlockingClient, cl, 0, NULL))

View file

@ -513,8 +513,10 @@ qboolean DL_CreateThread(struct dl_download *dl, vfsfile_t *file, void (*NotifyF
if (!dl)
return false;
dl->file = file;
dl->notify = NotifyFunction;
if (file)
dl->file = file;
if (NotifyFunction)
dl->notify = NotifyFunction;
dl->threadctx = Sys_CreateThread("download", DL_Thread_Work, dl, THREADP_NORMAL, 0);
if (!dl->threadctx)
@ -599,11 +601,11 @@ void HTTP_CL_Think(void)
#endif
if (!con->poll(con))
{
*link = con->next;
if (con->file)
VFS_SEEK(con->file, 0);
if (con->notify)
con->notify(con);
*link = con->next;
DL_Close(con);
if (cls.downloadmethod == DL_HTTP)

View file

@ -86,5 +86,7 @@ test.o: test.c
testapp.bin: qcvm.so test.o
$(CC) $(BASE_CFLAGS) -o testapp.bin -O3 $(BASE_LDFLAGS) qcvm.so test.o
regressiontest: testapp.bin
./testapp.bin regression.dat -srcfile regression.src
tests: testapp.bin
@$(foreach a,$(wildcard tests/*.src), echo TEST: $a; ./testapp.bin progs.dat -srcfile $a; echo; echo)
.PHONY: tests

View file

@ -89,5 +89,8 @@ extern char qcc_token[1024];
extern int qcc_eof;
#define qcc_iswhite(c) ((c) == ' ' || (c) == '\r' || (c) == '\n' || (c) == '\t' || (c) == '\v')
#define qcc_iswhitesameline(c) ((c) == ' ' || (c) == '\t')
#endif

Some files were not shown because too many files have changed in this diff Show more