mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 22:51:57 +00:00
*** empty log message ***
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@906 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
2000d01334
commit
7e1ab9e29b
38 changed files with 1133 additions and 781 deletions
|
@ -927,9 +927,8 @@ unsigned long _stdcall CL_IndepPhysicsThread(void *param)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&indepcriticialsection);
|
EnterCriticalSection(&indepcriticialsection);
|
||||||
time = Sys_DoubleTime();
|
time = Sys_DoubleTime();
|
||||||
host_frametime = time - lasttime;
|
CL_SendCmd(time - lasttime);
|
||||||
lasttime = time;
|
lasttime = time;
|
||||||
CL_SendCmd();
|
|
||||||
LeaveCriticalSection(&indepcriticialsection);
|
LeaveCriticalSection(&indepcriticialsection);
|
||||||
|
|
||||||
fps = cl_netfps.value;
|
fps = cl_netfps.value;
|
||||||
|
@ -982,7 +981,7 @@ CL_SendCmd
|
||||||
*/
|
*/
|
||||||
usercmd_t independantphysics[MAX_SPLITS];
|
usercmd_t independantphysics[MAX_SPLITS];
|
||||||
vec3_t accum[MAX_SPLITS];
|
vec3_t accum[MAX_SPLITS];
|
||||||
void CL_SendCmd (void)
|
void CL_SendCmd (float frametime)
|
||||||
{
|
{
|
||||||
sizebuf_t buf;
|
sizebuf_t buf;
|
||||||
qbyte data[512];
|
qbyte data[512];
|
||||||
|
@ -1013,7 +1012,7 @@ void CL_SendCmd (void)
|
||||||
usercmd_t ncmd;
|
usercmd_t ncmd;
|
||||||
|
|
||||||
memset(&ncmd, 0, sizeof(ncmd));
|
memset(&ncmd, 0, sizeof(ncmd));
|
||||||
ncmd.msec = host_frametime*1000;
|
ncmd.msec = frametime*1000;
|
||||||
|
|
||||||
CL_BaseMove (&ncmd, 0);
|
CL_BaseMove (&ncmd, 0);
|
||||||
|
|
||||||
|
@ -1024,7 +1023,7 @@ void CL_SendCmd (void)
|
||||||
if (cl.spectator)
|
if (cl.spectator)
|
||||||
Cam_Track(0, &ncmd);
|
Cam_Track(0, &ncmd);
|
||||||
|
|
||||||
CL_FinishMove(&ncmd, (int)(host_frametime*1000), 0);
|
CL_FinishMove(&ncmd, (int)(frametime*1000), 0);
|
||||||
|
|
||||||
Cam_FinishMove(0, &ncmd);
|
Cam_FinishMove(0, &ncmd);
|
||||||
|
|
||||||
|
@ -1056,7 +1055,7 @@ void CL_SendCmd (void)
|
||||||
cmd = &cl.frames[i].cmd[0];
|
cmd = &cl.frames[i].cmd[0];
|
||||||
|
|
||||||
memset(cmd, 0, sizeof(*cmd));
|
memset(cmd, 0, sizeof(*cmd));
|
||||||
cmd->msec = host_frametime*1000;
|
cmd->msec = frametime*1000;
|
||||||
independantphysics[0].msec = 0;
|
independantphysics[0].msec = 0;
|
||||||
|
|
||||||
// get basic movement from keyboard
|
// get basic movement from keyboard
|
||||||
|
@ -1069,7 +1068,7 @@ void CL_SendCmd (void)
|
||||||
if (cl.spectator)
|
if (cl.spectator)
|
||||||
Cam_Track(0, cmd);
|
Cam_Track(0, cmd);
|
||||||
|
|
||||||
CL_FinishMove(cmd, (int)(host_frametime*1000), 0);
|
CL_FinishMove(cmd, (int)(frametime*1000), 0);
|
||||||
|
|
||||||
Cam_FinishMove(0, cmd);
|
Cam_FinishMove(0, cmd);
|
||||||
|
|
||||||
|
@ -1087,7 +1086,7 @@ void CL_SendCmd (void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
msecs += host_frametime*1000;
|
msecs += frametime*1000;
|
||||||
// Con_Printf("%f\n", msecs);
|
// Con_Printf("%f\n", msecs);
|
||||||
|
|
||||||
if (msecs>1000) //come on... That's just stupid.
|
if (msecs>1000) //come on... That's just stupid.
|
||||||
|
@ -1345,7 +1344,7 @@ void CL_SendCmd (void)
|
||||||
//shamelessly stolen from fuhquake
|
//shamelessly stolen from fuhquake
|
||||||
if (cl_c2spps.value>0)
|
if (cl_c2spps.value>0)
|
||||||
{
|
{
|
||||||
pps_balance += host_frametime;
|
pps_balance += frametime;
|
||||||
// never drop more than 2 messages in a row -- that'll cause PL
|
// never drop more than 2 messages in a row -- that'll cause PL
|
||||||
// and don't drop if one of the last two movemessages have an impulse
|
// and don't drop if one of the last two movemessages have an impulse
|
||||||
if (pps_balance > 0 || dropcount >= 2 || dontdrop)
|
if (pps_balance > 0 || dropcount >= 2 || dontdrop)
|
||||||
|
|
|
@ -1289,6 +1289,12 @@ void CL_FullServerinfo_f (void)
|
||||||
}
|
}
|
||||||
CL_CheckServerInfo();
|
CL_CheckServerInfo();
|
||||||
|
|
||||||
|
cl.gamespeed = atof(Info_ValueForKey(cl.serverinfo, "*gamespeed"))/100.f;
|
||||||
|
if (cl.gamespeed < 0.1)
|
||||||
|
cl.gamespeed = 1;
|
||||||
|
|
||||||
|
cl.csqcdebug = atoi(Info_ValueForKey(cl.serverinfo, "*csqcdebug"));
|
||||||
|
|
||||||
#ifdef CSQC_DAT
|
#ifdef CSQC_DAT
|
||||||
p = Info_ValueForKey(cl.serverinfo, "*csprogs");
|
p = Info_ValueForKey(cl.serverinfo, "*csprogs");
|
||||||
if (*p) //only allow csqc if the server says so, and the 'checksum' matches.
|
if (*p) //only allow csqc if the server says so, and the 'checksum' matches.
|
||||||
|
@ -2249,9 +2255,6 @@ void CL_Init (void)
|
||||||
Info_SetValueForStarKey (cls.userinfo, "*ver", st, MAX_INFO_STRING);
|
Info_SetValueForStarKey (cls.userinfo, "*ver", st, MAX_INFO_STRING);
|
||||||
|
|
||||||
InitValidation();
|
InitValidation();
|
||||||
#ifdef CLPROGS
|
|
||||||
CLPR_Init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CL_InitInput ();
|
CL_InitInput ();
|
||||||
CL_InitTEnts ();
|
CL_InitTEnts ();
|
||||||
|
@ -2264,7 +2267,9 @@ void CL_Init (void)
|
||||||
// register our commands
|
// register our commands
|
||||||
//
|
//
|
||||||
CLSCR_Init();
|
CLSCR_Init();
|
||||||
|
#ifdef CSQC_DAT
|
||||||
|
CSQC_RegisterCvarsAndThings();
|
||||||
|
#endif
|
||||||
Cvar_Register (&host_speeds, cl_controlgroup);
|
Cvar_Register (&host_speeds, cl_controlgroup);
|
||||||
Cvar_Register (&developer, cl_controlgroup);
|
Cvar_Register (&developer, cl_controlgroup);
|
||||||
|
|
||||||
|
@ -2587,12 +2592,15 @@ void Host_Frame (float time)
|
||||||
static double time3 = 0;
|
static double time3 = 0;
|
||||||
int pass1, pass2, pass3;
|
int pass1, pass2, pass3;
|
||||||
// float fps;
|
// float fps;
|
||||||
|
float realframetime;
|
||||||
|
|
||||||
RSpeedLocals();
|
RSpeedLocals();
|
||||||
|
|
||||||
if (setjmp (host_abort) )
|
if (setjmp (host_abort) )
|
||||||
return; // something bad happened, or the server disconnected
|
return; // something bad happened, or the server disconnected
|
||||||
|
|
||||||
|
realframetime = time;
|
||||||
|
|
||||||
#if defined(WINAVI) && !defined(NOMEDIA)
|
#if defined(WINAVI) && !defined(NOMEDIA)
|
||||||
if (cls.demoplayback && recordingdemo && recordavi_frametime>0.01)
|
if (cls.demoplayback && recordingdemo && recordavi_frametime>0.01)
|
||||||
time = recordavi_frametime;
|
time = recordavi_frametime;
|
||||||
|
@ -2606,6 +2614,9 @@ void Host_Frame (float time)
|
||||||
SV_Frame(time);
|
SV_Frame(time);
|
||||||
RSpeedEnd(RSPEED_SERVER);
|
RSpeedEnd(RSPEED_SERVER);
|
||||||
#endif
|
#endif
|
||||||
|
if (cl.gamespeed<0.1)
|
||||||
|
cl.gamespeed = 1;
|
||||||
|
time *= cl.gamespeed;
|
||||||
|
|
||||||
#ifdef WEBCLIENT
|
#ifdef WEBCLIENT
|
||||||
FTP_ClientThink();
|
FTP_ClientThink();
|
||||||
|
@ -2722,7 +2733,7 @@ void Host_Frame (float time)
|
||||||
{
|
{
|
||||||
extern qboolean runningindepphys;
|
extern qboolean runningindepphys;
|
||||||
if (!runningindepphys)
|
if (!runningindepphys)
|
||||||
CL_SendCmd ();
|
CL_SendCmd (realframetime);
|
||||||
|
|
||||||
if (cls.state == ca_onserver && cl.validsequence && cl.worldmodel)
|
if (cls.state == ca_onserver && cl.validsequence && cl.worldmodel)
|
||||||
{ // first update is the final signon stage
|
{ // first update is the final signon stage
|
||||||
|
@ -2918,15 +2929,15 @@ void Host_Init (quakeparms_t *parms)
|
||||||
|
|
||||||
Hunk_AllocName (0, "-HOST_HUNKLEVEL-");
|
Hunk_AllocName (0, "-HOST_HUNKLEVEL-");
|
||||||
host_hunklevel = Hunk_LowMark ();
|
host_hunklevel = Hunk_LowMark ();
|
||||||
BZ_CheckAllSentinals();
|
|
||||||
R_SetRenderer(0);//set the renderer stuff to 'none'...
|
R_SetRenderer(0);//set the renderer stuff to 'none'...
|
||||||
|
|
||||||
host_initialized = true;
|
host_initialized = true;
|
||||||
|
|
||||||
Cmd_StuffCmds();
|
Cmd_StuffCmds();
|
||||||
BZ_CheckAllSentinals();
|
|
||||||
Cbuf_Execute (); //if the server initialisation causes a problem, give it a place to abort to
|
Cbuf_Execute (); //if the server initialisation causes a problem, give it a place to abort to
|
||||||
BZ_CheckAllSentinals();
|
|
||||||
//assuming they didn't use any waits in thier config (fools)
|
//assuming they didn't use any waits in thier config (fools)
|
||||||
//the configs should be fully loaded.
|
//the configs should be fully loaded.
|
||||||
//so convert the backwards compable commandline parameters in cvar sets.
|
//so convert the backwards compable commandline parameters in cvar sets.
|
||||||
|
@ -2935,7 +2946,7 @@ BZ_CheckAllSentinals();
|
||||||
Cvar_Set(Cvar_FindVar("vid_fullscreen"), "0");
|
Cvar_Set(Cvar_FindVar("vid_fullscreen"), "0");
|
||||||
if (COM_CheckParm ("-fullscreen"))
|
if (COM_CheckParm ("-fullscreen"))
|
||||||
Cvar_Set(Cvar_FindVar("vid_fullscreen"), "1");
|
Cvar_Set(Cvar_FindVar("vid_fullscreen"), "1");
|
||||||
BZ_CheckAllSentinals();
|
|
||||||
if ((i = COM_CheckParm ("-width"))) //width on it's own also sets height
|
if ((i = COM_CheckParm ("-width"))) //width on it's own also sets height
|
||||||
{
|
{
|
||||||
Cvar_Set(Cvar_FindVar("vid_width"), com_argv[i+1]);
|
Cvar_Set(Cvar_FindVar("vid_width"), com_argv[i+1]);
|
||||||
|
|
|
@ -1857,7 +1857,7 @@ void CL_ParseModellist (qboolean lots)
|
||||||
void CL_ProcessUserInfo (int slot, player_info_t *player);
|
void CL_ProcessUserInfo (int slot, player_info_t *player);
|
||||||
void CLQ2_ParseClientinfo(int i, char *s)
|
void CLQ2_ParseClientinfo(int i, char *s)
|
||||||
{
|
{
|
||||||
char *skin, *model, *name;
|
char *model, *name;
|
||||||
player_info_t *player;
|
player_info_t *player;
|
||||||
//s contains "name\model/skin"
|
//s contains "name\model/skin"
|
||||||
|
|
||||||
|
@ -1877,7 +1877,7 @@ void CLQ2_ParseClientinfo(int i, char *s)
|
||||||
name = "Unnammed";
|
name = "Unnammed";
|
||||||
model = "male";
|
model = "male";
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
skin = strchr(model, '/');
|
skin = strchr(model, '/');
|
||||||
if (skin)
|
if (skin)
|
||||||
{
|
{
|
||||||
|
@ -1886,9 +1886,16 @@ void CLQ2_ParseClientinfo(int i, char *s)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
skin = "";
|
skin = "";
|
||||||
Info_SetValueForKey(player->userinfo, "name", name, MAX_INFO_STRING);
|
|
||||||
Info_SetValueForKey(player->userinfo, "model", model, MAX_INFO_STRING);
|
Info_SetValueForKey(player->userinfo, "model", model, MAX_INFO_STRING);
|
||||||
Info_SetValueForKey(player->userinfo, "skin", skin, MAX_INFO_STRING);
|
Info_SetValueForKey(player->userinfo, "skin", skin, MAX_INFO_STRING);
|
||||||
|
#else
|
||||||
|
Info_SetValueForKey(player->userinfo, "skin", model, MAX_INFO_STRING);
|
||||||
|
#endif
|
||||||
|
Info_SetValueForKey(player->userinfo, "name", name, MAX_INFO_STRING);
|
||||||
|
|
||||||
|
cl.players[i].userid = i;
|
||||||
|
cl.players[i].bottomcolor = 1;
|
||||||
|
cl.players[i].topcolor = 1;
|
||||||
CL_ProcessUserInfo (i, player);
|
CL_ProcessUserInfo (i, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -428,7 +428,7 @@ void CL_PredictUsercmd (int pnum, player_state_t *from, player_state_t *to, user
|
||||||
player_mins[2] = 0;
|
player_mins[2] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PM_PlayerMove ();
|
PM_PlayerMove (cl.gamespeed);
|
||||||
|
|
||||||
to->waterjumptime = pmove.waterjumptime;
|
to->waterjumptime = pmove.waterjumptime;
|
||||||
to->jump_held = pmove.jump_held;
|
to->jump_held = pmove.jump_held;
|
||||||
|
|
|
@ -386,6 +386,9 @@ typedef struct
|
||||||
int fpd;
|
int fpd;
|
||||||
int servercount; // server identification for prespawns
|
int servercount; // server identification for prespawns
|
||||||
|
|
||||||
|
float gamespeed;
|
||||||
|
qboolean csqcdebug;
|
||||||
|
|
||||||
char serverinfo[MAX_SERVERINFO_STRING];
|
char serverinfo[MAX_SERVERINFO_STRING];
|
||||||
|
|
||||||
int parsecount; // server message counter
|
int parsecount; // server message counter
|
||||||
|
@ -489,10 +492,6 @@ typedef struct
|
||||||
// all player information
|
// all player information
|
||||||
player_info_t players[MAX_CLIENTS];
|
player_info_t players[MAX_CLIENTS];
|
||||||
|
|
||||||
#ifdef CLPROGS
|
|
||||||
struct edict_s *edicts;
|
|
||||||
int num_edicts;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
downloadlist_t *downloadlist;
|
downloadlist_t *downloadlist;
|
||||||
downloadlist_t *faileddownloads;
|
downloadlist_t *faileddownloads;
|
||||||
|
@ -634,7 +633,7 @@ extern kbutton_t in_speed;
|
||||||
extern float in_sensitivityscale;
|
extern float in_sensitivityscale;
|
||||||
|
|
||||||
void CL_InitInput (void);
|
void CL_InitInput (void);
|
||||||
void CL_SendCmd (void);
|
void CL_SendCmd (float frametime);
|
||||||
void CL_SendMove (usercmd_t *cmd);
|
void CL_SendMove (usercmd_t *cmd);
|
||||||
#ifdef NQPROT
|
#ifdef NQPROT
|
||||||
void CL_ParseTEnt (qboolean nqprot);
|
void CL_ParseTEnt (qboolean nqprot);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "particles.h"
|
#include "particles.h"
|
||||||
|
|
||||||
#ifdef Q2CLIENT
|
#ifdef Q2CLIENT
|
||||||
|
#include "shader.h"
|
||||||
|
|
||||||
extern cvar_t r_drawviewmodel;
|
extern cvar_t r_drawviewmodel;
|
||||||
|
|
||||||
|
@ -1438,10 +1439,10 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
||||||
|
|
||||||
player = &cl.players[s1->skinnum%MAX_CLIENTS];
|
player = &cl.players[s1->skinnum%MAX_CLIENTS];
|
||||||
ent.model = player->model;
|
ent.model = player->model;
|
||||||
if (!ent.model)
|
if (!ent.model || ent.model->needload) //we need to do better than this
|
||||||
{
|
{
|
||||||
ent.model = Mod_ForName(va("players/%s/tris.md2", Info_ValueForKey(player->userinfo, "model")), false);
|
ent.model = Mod_ForName(va("players/%s/tris.md2", Info_ValueForKey(player->userinfo, "model")), false);
|
||||||
if (!ent.model)
|
if (!ent.model || ent.model->needload)
|
||||||
ent.model = Mod_ForName("players/male/tris.md2", false);
|
ent.model = Mod_ForName("players/male/tris.md2", false);
|
||||||
}
|
}
|
||||||
ent.scoreboard = player;
|
ent.scoreboard = player;
|
||||||
|
@ -1529,12 +1530,11 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ent.angles[0]*=-1;
|
ent.angles[0]*=-1; //q2 has it fixed.
|
||||||
|
|
||||||
if (s1->number == cl.playernum[0]+1)
|
if (s1->number == cl.playernum[0]+1) //woo! this is us!
|
||||||
{
|
{
|
||||||
ent.flags |= Q2RF_VIEWERMODEL; // only draw from mirrors
|
ent.flags |= Q2RF_VIEWERMODEL; // only draw from mirrors
|
||||||
// FIXME: still pass to refresh
|
|
||||||
|
|
||||||
if (effects & Q2EF_FLAG1)
|
if (effects & Q2EF_FLAG1)
|
||||||
V_AddLight (ent.origin, 225, 0.2, 0.05, 0.05);
|
V_AddLight (ent.origin, 225, 0.2, 0.05, 0.05);
|
||||||
|
@ -1544,8 +1544,6 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
||||||
V_AddLight (ent.origin, 225, 0.2, 0.2, 0.0); //PGM
|
V_AddLight (ent.origin, 225, 0.2, 0.2, 0.0); //PGM
|
||||||
else if (effects & Q2EF_TRACKERTRAIL) //PGM
|
else if (effects & Q2EF_TRACKERTRAIL) //PGM
|
||||||
V_AddLight (ent.origin, 225, -0.2, -0.2, -0.2); //PGM
|
V_AddLight (ent.origin, 225, -0.2, -0.2, -0.2); //PGM
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if set to invisible, skip
|
// if set to invisible, skip
|
||||||
|
@ -1589,7 +1587,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
||||||
|
|
||||||
// all of the solo colors are fine. we need to catch any of the combinations that look bad
|
// all of the solo colors are fine. we need to catch any of the combinations that look bad
|
||||||
// (double & half) and turn them into the appropriate color, and make double/quad something special
|
// (double & half) and turn them into the appropriate color, and make double/quad something special
|
||||||
/* if (renderfx & Q2RF_SHELL_HALF_DAM)
|
if (renderfx & Q2RF_SHELL_HALF_DAM)
|
||||||
{
|
{
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1617,13 +1615,22 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
||||||
else
|
else
|
||||||
renderfx |= Q2RF_SHELL_GREEN;
|
renderfx |= Q2RF_SHELL_GREEN;
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
// pmm
|
// pmm
|
||||||
ent.flags = renderfx | Q2RF_TRANSLUCENT;
|
ent.flags = renderfx | Q2RF_TRANSLUCENT;
|
||||||
ent.alpha = 0.30;
|
ent.alpha = 0.30;
|
||||||
ent.fatness = 10;
|
ent.fatness = 1;
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
//fixme: this is woefully gl specific. :(
|
||||||
|
ent.shaderRGBA[0] = (!!(renderfx & Q2RF_SHELL_RED)) * 255;
|
||||||
|
ent.shaderRGBA[1] = (!!(renderfx & Q2RF_SHELL_GREEN)) * 255;
|
||||||
|
ent.shaderRGBA[2] = (!!(renderfx & Q2RF_SHELL_BLUE)) * 255;
|
||||||
|
ent.shaderRGBA[3] = ent.alpha*255;
|
||||||
|
ent.forcedshader = R_RegisterCustom("q2/shell", Shader_DefaultSkinShell);
|
||||||
|
#endif
|
||||||
V_AddLerpEntity (&ent);
|
V_AddLerpEntity (&ent);
|
||||||
}
|
}
|
||||||
|
ent.forcedshader = NULL;
|
||||||
|
|
||||||
// ent.skin = NULL; // never use a custom skin on others
|
// ent.skin = NULL; // never use a custom skin on others
|
||||||
ent.skinnum = 0;
|
ent.skinnum = 0;
|
||||||
|
|
|
@ -10,6 +10,8 @@ progfuncs_t *csqcprogs;
|
||||||
|
|
||||||
unsigned int csqcchecksum;
|
unsigned int csqcchecksum;
|
||||||
|
|
||||||
|
cvar_t pr_csmaxedicts = {"pr_csmaxedicts", "3072"};
|
||||||
|
|
||||||
#define csqcglobals \
|
#define csqcglobals \
|
||||||
globalfunction(init_function, "CSQC_Init"); \
|
globalfunction(init_function, "CSQC_Init"); \
|
||||||
globalfunction(shutdown_function, "CSQC_Shutdown"); \
|
globalfunction(shutdown_function, "CSQC_Shutdown"); \
|
||||||
|
@ -1345,7 +1347,7 @@ qboolean CSQC_Init (unsigned int checksum)
|
||||||
|
|
||||||
memset(csqcent, 0, sizeof(csqcent));
|
memset(csqcent, 0, sizeof(csqcent));
|
||||||
|
|
||||||
csqcentsize = PR_InitEnts(csqcprogs, 3072);
|
csqcentsize = PR_InitEnts(csqcprogs, pr_csmaxedicts.value);
|
||||||
|
|
||||||
CSQC_FindGlobals();
|
CSQC_FindGlobals();
|
||||||
|
|
||||||
|
@ -1363,6 +1365,11 @@ qboolean CSQC_Init (unsigned int checksum)
|
||||||
return true; //success!
|
return true; //success!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSQC_RegisterCvarsAndThings(void)
|
||||||
|
{
|
||||||
|
Cvar_Register(&pr_csmaxedicts, "csqc");
|
||||||
|
}
|
||||||
|
|
||||||
qboolean CSQC_DrawView(void)
|
qboolean CSQC_DrawView(void)
|
||||||
{
|
{
|
||||||
if (!csqcg.draw_function || !csqcprogs || !cl.worldmodel)
|
if (!csqcg.draw_function || !csqcprogs || !cl.worldmodel)
|
||||||
|
@ -1421,6 +1428,8 @@ void CSQC_ParseEntities(void)
|
||||||
csqcedict_t *ent;
|
csqcedict_t *ent;
|
||||||
unsigned short entnum;
|
unsigned short entnum;
|
||||||
void *pr_globals;
|
void *pr_globals;
|
||||||
|
int packetsize;
|
||||||
|
int packetstart;
|
||||||
|
|
||||||
if (!csqcprogs)
|
if (!csqcprogs)
|
||||||
Host_EndGame("CSQC needs to be initialized for this server.\n");
|
Host_EndGame("CSQC needs to be initialized for this server.\n");
|
||||||
|
@ -1463,6 +1472,12 @@ void CSQC_ParseEntities(void)
|
||||||
if (entnum >= MAX_EDICTS)
|
if (entnum >= MAX_EDICTS)
|
||||||
Host_EndGame("CSQC recieved too many edicts!\n");
|
Host_EndGame("CSQC recieved too many edicts!\n");
|
||||||
|
|
||||||
|
if (cl.csqcdebug)
|
||||||
|
{
|
||||||
|
packetsize = MSG_ReadShort();
|
||||||
|
packetstart = msg_readcount;
|
||||||
|
}
|
||||||
|
|
||||||
ent = csqcent[entnum];
|
ent = csqcent[entnum];
|
||||||
if (!ent)
|
if (!ent)
|
||||||
{
|
{
|
||||||
|
@ -1475,6 +1490,25 @@ void CSQC_ParseEntities(void)
|
||||||
|
|
||||||
*csqcg.self = EDICT_TO_PROG(csqcprogs, (void*)ent);
|
*csqcg.self = EDICT_TO_PROG(csqcprogs, (void*)ent);
|
||||||
PR_ExecuteProgram(csqcprogs, csqcg.ent_update);
|
PR_ExecuteProgram(csqcprogs, csqcg.ent_update);
|
||||||
|
|
||||||
|
if (cl.csqcdebug)
|
||||||
|
{
|
||||||
|
if (msg_readcount != packetstart+packetsize)
|
||||||
|
{
|
||||||
|
if (msg_readcount > packetstart+packetsize)
|
||||||
|
Con_Printf("CSQC overread entity %i. Size %i, read %i\n", entnum, packetsize, msg_readcount - packetsize);
|
||||||
|
else
|
||||||
|
Con_Printf("CSQC underread entity %i. Size %i, read %i\n", entnum, packetsize, msg_readcount - packetsize);
|
||||||
|
Con_Printf("First byte is %i\n", net_message.data[msg_readcount]);
|
||||||
|
#ifndef CLIENTONLY
|
||||||
|
if (sv.state)
|
||||||
|
{
|
||||||
|
Con_Printf("Server classname: \"%s\"\n", svprogfuncs->stringtable+EDICT_NUM(svprogfuncs, entnum)->v.classname);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
msg_readcount = packetstart+packetsize; //leetism.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "bothdefs.h" //first thing included by ALL files.
|
#include "bothdefs.h" //first thing included by ALL files.
|
||||||
|
|
||||||
#pragma message("building quakedef.h")
|
|
||||||
|
|
||||||
#if _MSC_VER
|
#if _MSC_VER
|
||||||
#define MSVCDISABLEWARNINGS
|
#define MSVCDISABLEWARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2352,41 +2352,3 @@ void Sbar_FinaleOverlay (void)
|
||||||
Draw_TransPic ( (vid.width-pic->width)/2, 16, pic);
|
Draw_TransPic ( (vid.width-pic->width)/2, 16, pic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef CLPROGS
|
|
||||||
void PF_sbardrawsubpic(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|
||||||
{
|
|
||||||
Sbar_DrawSubPic(G_FLOAT(OFS_PARM0), G_FLOAT(OFS_PARM1), Draw_PicFromWad(PR_GetStringOfs(prinst, OFS_PARM2)), G_FLOAT(OFS_PARM3), G_FLOAT(OFS_PARM4), G_FLOAT(OFS_PARM5), G_FLOAT(OFS_PARM6));
|
|
||||||
}
|
|
||||||
void PF_sbardrawpic(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|
||||||
{
|
|
||||||
Sbar_DrawPic(G_FLOAT(OFS_PARM0), G_FLOAT(OFS_PARM1), Draw_PicFromWad(PR_GetStringOfs(prinst, OFS_PARM2)));
|
|
||||||
}
|
|
||||||
void PF_sbardrawnum(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|
||||||
{
|
|
||||||
Sbar_DrawNum(G_FLOAT(OFS_PARM0), G_FLOAT(OFS_PARM1), G_FLOAT(OFS_PARM2), G_FLOAT(OFS_PARM3), G_FLOAT(OFS_PARM4));
|
|
||||||
}
|
|
||||||
void PF_sbardrawint(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|
||||||
{
|
|
||||||
Sbar_DrawNum(G_FLOAT(OFS_PARM0), G_FLOAT(OFS_PARM1), G_INT(OFS_PARM2), G_FLOAT(OFS_PARM3), G_FLOAT(OFS_PARM4));
|
|
||||||
}
|
|
||||||
void PF_getstats(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|
||||||
{
|
|
||||||
G_FLOAT(OFS_RETURN) = cl.stats[(int)G_FLOAT(OFS_PARM0)];
|
|
||||||
}
|
|
||||||
void PF_getscreendim(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|
||||||
{
|
|
||||||
if (!G_FLOAT(OFS_PARM0))
|
|
||||||
G_FLOAT(OFS_RETURN) = vid.width;
|
|
||||||
else
|
|
||||||
G_FLOAT(OFS_RETURN) = vid.height;
|
|
||||||
}
|
|
||||||
void PF_getstatsi(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|
||||||
{
|
|
||||||
G_INT(OFS_RETURN) = cl.stats[(int)G_FLOAT(OFS_PARM0)];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -149,6 +149,9 @@ void Skin_Find (player_info_t *sc)
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
|
if (cls.q2server)
|
||||||
|
model = Mod_ForName(va("players/%s/tris.mdl", name), false);
|
||||||
|
else
|
||||||
model = Mod_ForName(va("models/players/%s.mdl", name), false);
|
model = Mod_ForName(va("models/players/%s.mdl", name), false);
|
||||||
if (model->type == mod_dummy)
|
if (model->type == mod_dummy)
|
||||||
model = NULL;
|
model = NULL;
|
||||||
|
@ -231,7 +234,6 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
||||||
//
|
//
|
||||||
// load the pic from disk
|
// load the pic from disk
|
||||||
//
|
//
|
||||||
// sprintf (name, "players/male/%s.pcx", skin->name);
|
|
||||||
if (strchr(skin->name, ' ')) //see if it's actually three colours
|
if (strchr(skin->name, ' ')) //see if it's actually three colours
|
||||||
{
|
{
|
||||||
qbyte bv;
|
qbyte bv;
|
||||||
|
@ -260,6 +262,9 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cls.q2server)
|
||||||
|
sprintf (name, "players/%s.pcx", skin->name);
|
||||||
|
else
|
||||||
sprintf (name, "skins/%s.pcx", skin->name);
|
sprintf (name, "skins/%s.pcx", skin->name);
|
||||||
raw = COM_LoadTempFile (name);
|
raw = COM_LoadTempFile (name);
|
||||||
if (!raw)
|
if (!raw)
|
||||||
|
@ -291,21 +296,29 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
||||||
Con_Printf ("Bad skin %s\n", name);
|
Con_Printf ("Bad skin %s\n", name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (qrenderer == QR_SOFTWARE)
|
||||||
|
{
|
||||||
skin->width = 320;
|
skin->width = 320;
|
||||||
skin->height = 200;
|
skin->height = 200;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
skin->width = pcx->xmax+1;
|
||||||
|
skin->height = pcx->ymax;
|
||||||
|
}
|
||||||
skin->cachedbpp = 8;
|
skin->cachedbpp = 8;
|
||||||
|
|
||||||
pcx->xmax = (unsigned short)LittleShort(pcx->xmax);
|
pcx->xmax = (unsigned short)LittleShort(pcx->xmax);
|
||||||
pcx->ymax = (unsigned short)LittleShort(pcx->ymax);
|
pcx->ymax = (unsigned short)LittleShort(pcx->ymax);
|
||||||
|
|
||||||
out = Cache_Alloc (&skin->cache, 320*200, skin->name);
|
out = Cache_Alloc (&skin->cache, skin->width*skin->height, skin->name);
|
||||||
if (!out)
|
if (!out)
|
||||||
Sys_Error ("Skin_Cache: couldn't allocate");
|
Sys_Error ("Skin_Cache: couldn't allocate");
|
||||||
|
|
||||||
pix = out;
|
pix = out;
|
||||||
memset (out, 0, 320*200);
|
memset (out, 0, skin->width*skin->height);
|
||||||
|
|
||||||
for (y=0 ; y<pcx->ymax ; y++, pix += 320)
|
for (y=0 ; y<pcx->ymax ; y++, pix += skin->width)
|
||||||
{
|
{
|
||||||
for (x=0 ; x<=pcx->xmax ; )
|
for (x=0 ; x<=pcx->xmax ; )
|
||||||
{
|
{
|
||||||
|
|
|
@ -309,41 +309,6 @@ void Sys_EditFile(char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//1 if match
|
|
||||||
//FIXME: make windows like - *.* becomes *
|
|
||||||
int wildcmp(char *wild, char *string) {
|
|
||||||
char *cp, *mp;
|
|
||||||
|
|
||||||
while ((*string) && (*wild != '*')) {
|
|
||||||
if ((*wild != *string) && (*wild != '?')) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
wild++;
|
|
||||||
string++;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (*string) {
|
|
||||||
if (*wild == '*') {
|
|
||||||
if (!*++wild) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
mp = wild;
|
|
||||||
cp = string+1;
|
|
||||||
} else if ((*wild == *string) || (*wild == '?')) {
|
|
||||||
wild++;
|
|
||||||
string++;
|
|
||||||
} else {
|
|
||||||
wild = mp;
|
|
||||||
string = cp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
while (*wild == '*') {
|
|
||||||
wild++;
|
|
||||||
}
|
|
||||||
return !*wild;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void *), void *parm)
|
int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void *), void *parm)
|
||||||
{
|
{
|
||||||
|
|
|
@ -357,40 +357,6 @@ qboolean Sys_remove (char *path)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//1 if match
|
|
||||||
int wildcmp(char *wild, char *string) {
|
|
||||||
char *cp=NULL, *mp=NULL;
|
|
||||||
|
|
||||||
while ((*string) && (*wild != '*')) {
|
|
||||||
if ((*wild != *string) && (*wild != '?')) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
wild++;
|
|
||||||
string++;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (*string) {
|
|
||||||
if (*wild == '*') {
|
|
||||||
if (!*++wild) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
mp = wild;
|
|
||||||
cp = string+1;
|
|
||||||
} else if ((*wild == *string) || (*wild == '?')) {
|
|
||||||
wild++;
|
|
||||||
string++;
|
|
||||||
} else {
|
|
||||||
wild = mp;
|
|
||||||
string = cp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
while (*wild == '*') {
|
|
||||||
wild++;
|
|
||||||
}
|
|
||||||
return !*wild;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void *), void *parm)
|
int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void *), void *parm)
|
||||||
{
|
{
|
||||||
HANDLE r;
|
HANDLE r;
|
||||||
|
|
|
@ -333,37 +333,48 @@ char *Q_strlwr(char *s)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wildcmp(char *wild, char *string)
|
||||||
int Q_strwildcmp(char *s1, char *s2) //2 is wild
|
|
||||||
{
|
{
|
||||||
return !wildcmp(s1, s2);
|
char *cp=NULL, *mp=NULL;
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
if (!*s1 && !*s2)
|
|
||||||
return 0; //yay, they are equivalent
|
|
||||||
if (!*s1 || !*s2)
|
|
||||||
return -1; //one ended too soon.
|
|
||||||
|
|
||||||
if (*s2 == '*')
|
while ((*string) && (*wild != '*'))
|
||||||
{
|
{
|
||||||
s2++;
|
if ((*wild != *string) && (*wild != '?'))
|
||||||
while (1)
|
|
||||||
{
|
{
|
||||||
if (!*s1 && *s2)
|
return 0;
|
||||||
return -1;
|
|
||||||
if (*s1 == '.' || *s1 == '/' || !*s1)
|
|
||||||
break;
|
|
||||||
s1++;
|
|
||||||
}
|
}
|
||||||
|
wild++;
|
||||||
|
string++;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (*string)
|
||||||
|
{
|
||||||
|
if (*wild == '*')
|
||||||
|
{
|
||||||
|
if (!*++wild)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
mp = wild;
|
||||||
|
cp = string+1;
|
||||||
|
}
|
||||||
|
else if ((*wild == *string) || (*wild == '?'))
|
||||||
|
{
|
||||||
|
wild++;
|
||||||
|
string++;
|
||||||
}
|
}
|
||||||
else if (*s2 != *s1 && *s2 != '?')
|
|
||||||
return -1;
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s1++;
|
wild = mp;
|
||||||
s2++;
|
string = cp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (*wild == '*')
|
||||||
|
{
|
||||||
|
wild++;
|
||||||
|
}
|
||||||
|
return !*wild;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Q_atoi (char *str)
|
int Q_atoi (char *str)
|
||||||
|
@ -3465,7 +3476,6 @@ qbyte *COM_LoadStackFile (char *path, void *buffer, int bufsize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Q_strwildcmp(char *s1, char *s2);
|
|
||||||
#ifdef ZLIB
|
#ifdef ZLIB
|
||||||
int COM_EnumerateZipFiles (zipfile_t *zip, char *match, int (*func)(char *, int, void *), void *parm);
|
int COM_EnumerateZipFiles (zipfile_t *zip, char *match, int (*func)(char *, int, void *), void *parm);
|
||||||
#endif
|
#endif
|
||||||
|
@ -3475,7 +3485,7 @@ int COM_EnumeratePackFiles (pack_t *zip, char *match, int (*func)(char *, int, v
|
||||||
|
|
||||||
for (num = 0; num<(int)zip->numfiles; num++)
|
for (num = 0; num<(int)zip->numfiles; num++)
|
||||||
{
|
{
|
||||||
if (!Q_strwildcmp(zip->files[num].name, match))
|
if (wildcmp(zip->files[num].name, match))
|
||||||
{
|
{
|
||||||
if (!func(zip->files[num].name, zip->files[num].filelen, parm))
|
if (!func(zip->files[num].name, zip->files[num].filelen, parm))
|
||||||
return false;
|
return false;
|
||||||
|
@ -4030,14 +4040,13 @@ char *Com_ReadFileInZip(zipfile_t *zip, int index, char *buffer)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Q_strwildcmp(char *s1, char *s2);
|
|
||||||
int COM_EnumerateZipFiles (zipfile_t *zip, char *match, int (*func)(char *, int, void *), void *parm)
|
int COM_EnumerateZipFiles (zipfile_t *zip, char *match, int (*func)(char *, int, void *), void *parm)
|
||||||
{
|
{
|
||||||
int num;
|
int num;
|
||||||
|
|
||||||
for (num = 0; num<(int)zip->numfiles; num++)
|
for (num = 0; num<(int)zip->numfiles; num++)
|
||||||
{
|
{
|
||||||
if (!Q_strwildcmp(zip->files[num].name, match))
|
if (wildcmp(zip->files[num].name, match))
|
||||||
{
|
{
|
||||||
if (!func(zip->files[num].name, zip->files[num].filelen, parm))
|
if (!func(zip->files[num].name, zip->files[num].filelen, parm))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -165,6 +165,7 @@ void MSG_ReadData (void *data, int len);
|
||||||
char *Q_strcpyline(char *out, char *in, int maxlen); //stops at '\n' (and '\r')
|
char *Q_strcpyline(char *out, char *in, int maxlen); //stops at '\n' (and '\r')
|
||||||
|
|
||||||
char *Q_strlwr(char *str);
|
char *Q_strlwr(char *str);
|
||||||
|
int wildcmp(char *wild, char *string); //1 if match
|
||||||
|
|
||||||
#define Q_memset(d, f, c) memset((d), (f), (c))
|
#define Q_memset(d, f, c) memset((d), (f), (c))
|
||||||
#define Q_memcpy(d, s, c) memcpy((d), (s), (c))
|
#define Q_memcpy(d, s, c) memcpy((d), (s), (c))
|
||||||
|
|
|
@ -881,7 +881,7 @@ int Plug_Net_TCPListen(void *offset, unsigned int mask, const long *arg)
|
||||||
if (((struct sockaddr_in*)&address)->sin_family == AF_INET && !((struct sockaddr_in*)&address)->sin_port)
|
if (((struct sockaddr_in*)&address)->sin_family == AF_INET && !((struct sockaddr_in*)&address)->sin_port)
|
||||||
((struct sockaddr_in*)&address)->sin_port = htons(localport);
|
((struct sockaddr_in*)&address)->sin_port = htons(localport);
|
||||||
#ifdef IPPROTO_IPV6
|
#ifdef IPPROTO_IPV6
|
||||||
else if (((struct sockaddr_in*)&address)->sin6_family == AF_INET6 && !((struct sockaddr_in6*)&address)->sin6_port)
|
else if (((struct sockaddr_in6*)&address)->sin6_family == AF_INET6 && !((struct sockaddr_in6*)&address)->sin6_port)
|
||||||
((struct sockaddr_in6*)&address)->sin6_port = htons(localport);
|
((struct sockaddr_in6*)&address)->sin6_port = htons(localport);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1004,9 +1004,9 @@ Numtouch and touchindex[] will be set if any of the physents
|
||||||
were contacted during the move.
|
were contacted during the move.
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void PM_PlayerMove (void)
|
void PM_PlayerMove (float gamespeed)
|
||||||
{
|
{
|
||||||
frametime = pmove.cmd.msec * 0.001;
|
frametime = pmove.cmd.msec * 0.001*gamespeed;
|
||||||
pmove.numtouch = 0;
|
pmove.numtouch = 0;
|
||||||
|
|
||||||
if (pmove.pm_type == PM_NONE || pmove.pm_type == PM_FREEZE) {
|
if (pmove.pm_type == PM_NONE || pmove.pm_type == PM_FREEZE) {
|
||||||
|
|
|
@ -130,7 +130,7 @@ typedef struct {
|
||||||
extern movevars_t movevars;
|
extern movevars_t movevars;
|
||||||
extern playermove_t pmove;
|
extern playermove_t pmove;
|
||||||
|
|
||||||
void PM_PlayerMove (void);
|
void PM_PlayerMove (float gamespeed);
|
||||||
void PM_Init (void);
|
void PM_Init (void);
|
||||||
void PM_InitBoxHull (void);
|
void PM_InitBoxHull (void);
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ struct vm_s {
|
||||||
void *hInst;
|
void *hInst;
|
||||||
|
|
||||||
// native
|
// native
|
||||||
int (*vmMain)(int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6);
|
int (VARGS *vmMain)(int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -221,6 +221,7 @@ void BZ_CheckSentinals(void *c)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/* //revive this function each time you get memory corruption and need to trace it.
|
||||||
void BZ_CheckAllSentinals(void)
|
void BZ_CheckAllSentinals(void)
|
||||||
{
|
{
|
||||||
zone_t *zone;
|
zone_t *zone;
|
||||||
|
@ -244,6 +245,7 @@ void BZ_CheckAllSentinals(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void VARGS Z_FreeTags(int tag)
|
void VARGS Z_FreeTags(int tag)
|
||||||
{
|
{
|
||||||
|
@ -309,7 +311,6 @@ void *Z_BaseTagMalloc (int size, int tag, qboolean clear)
|
||||||
#ifdef NAMEDMALLOCS
|
#ifdef NAMEDMALLOCS
|
||||||
strcpy((char *)(nt+1) + nt->size + ZONEDEBUG*2, buffer);
|
strcpy((char *)(nt+1) + nt->size + ZONEDEBUG*2, buffer);
|
||||||
#endif
|
#endif
|
||||||
BZ_CheckAllSentinals();
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
void *VARGS Z_TagMalloc (int size, int tag)
|
void *VARGS Z_TagMalloc (int size, int tag)
|
||||||
|
|
|
@ -106,7 +106,7 @@ LINK32=link.exe
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||||
# ADD CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "_DEBUG" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /D "AVAIL_OGGVORBIS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /Yu"quakedef.h" /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c
|
# ADD CPP /nologo /G5 /ML /W3 /Gm- /Gi- /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "_DEBUG" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /D "AVAIL_OGGVORBIS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /Yu"quakedef.h" /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c
|
||||||
# SUBTRACT CPP /X
|
# SUBTRACT CPP /X
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
|
@ -117,7 +117,8 @@ BSC32=bscmake.exe
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||||
# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /out:"../../fteglqw_dbg.exe"
|
# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /out:"../../fteglqw_dbg.exe"
|
||||||
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease"
|
!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease"
|
||||||
|
|
||||||
|
@ -145,6 +146,7 @@ BSC32=bscmake.exe
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 comctl32.lib ..\dxsdk\sdk\lib\dxguid.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /machine:I386 /out:"../../../fteqw.exe"
|
# ADD BASE LINK32 comctl32.lib ..\dxsdk\sdk\lib\dxguid.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /machine:I386 /out:"../../../fteqw.exe"
|
||||||
# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:none /map /machine:I386 /out:"../../fteglqw.exe"
|
# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:none /map /machine:I386 /out:"../../fteglqw.exe"
|
||||||
|
# SUBTRACT LINK32 /debug
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug"
|
!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug"
|
||||||
|
|
||||||
|
|
|
@ -591,7 +591,7 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, entity_
|
||||||
|
|
||||||
int tc, bc;
|
int tc, bc;
|
||||||
|
|
||||||
if (!gl_nocolors.value && !cls.q2server)
|
if (!gl_nocolors.value)
|
||||||
{
|
{
|
||||||
if (e->scoreboard)
|
if (e->scoreboard)
|
||||||
{
|
{
|
||||||
|
@ -633,17 +633,16 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, entity_
|
||||||
qbyte *original;
|
qbyte *original;
|
||||||
int cc;
|
int cc;
|
||||||
galiascolourmapped_t *cm;
|
galiascolourmapped_t *cm;
|
||||||
|
char hashname[512];
|
||||||
cc = (tc<<4)|bc;
|
cc = (tc<<4)|bc;
|
||||||
|
|
||||||
if (!strstr(modelname, "progs/player.mdl"))
|
|
||||||
skinname = modelname;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (e->scoreboard && e->scoreboard->skin && !gl_nocolors.value)
|
if (e->scoreboard && e->scoreboard->skin && !gl_nocolors.value)
|
||||||
skinname = e->scoreboard->skin->name;
|
{
|
||||||
|
sprintf(hashname, "%s$%s", modelname, e->scoreboard->skin->name);
|
||||||
|
skinname = hashname;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
skinname = modelname;
|
skinname = modelname;
|
||||||
}
|
|
||||||
|
|
||||||
if (!skincolourmapped.numbuckets)
|
if (!skincolourmapped.numbuckets)
|
||||||
Hash_InitTable(&skincolourmapped, 256, BZ_Malloc(Hash_BytesForBuckets(256)));
|
Hash_InitTable(&skincolourmapped, 256, BZ_Malloc(Hash_BytesForBuckets(256)));
|
||||||
|
@ -656,13 +655,20 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, entity_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!inf->numskins)
|
||||||
|
{
|
||||||
|
skins = NULL;
|
||||||
|
texnums = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
skins = (galiasskin_t*)((char *)inf + inf->ofsskins);
|
skins = (galiasskin_t*)((char *)inf + inf->ofsskins);
|
||||||
if (!skins->texnums)
|
if (!skins->texnums)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (e->skinnum >= 0 && e->skinnum < inf->numskins)
|
if (e->skinnum >= 0 && e->skinnum < inf->numskins)
|
||||||
skins += e->skinnum;
|
skins += e->skinnum;
|
||||||
texnums = (galiastexnum_t*)((char *)skins + skins->ofstexnums);
|
texnums = (galiastexnum_t*)((char *)skins + skins->ofstexnums);
|
||||||
|
}
|
||||||
|
|
||||||
//colourmap isn't present yet.
|
//colourmap isn't present yet.
|
||||||
cm = BZ_Malloc(sizeof(*cm));
|
cm = BZ_Malloc(sizeof(*cm));
|
||||||
|
@ -672,8 +678,25 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, entity_
|
||||||
cm->skinnum = e->skinnum;
|
cm->skinnum = e->skinnum;
|
||||||
cm->texnum.fullbright = 0;
|
cm->texnum.fullbright = 0;
|
||||||
cm->texnum.base = 0;
|
cm->texnum.base = 0;
|
||||||
|
|
||||||
|
if (!texnums)
|
||||||
|
{ //load just the skin
|
||||||
|
if (e->scoreboard && e->scoreboard->skin)
|
||||||
|
{
|
||||||
|
original = Skin_Cache8(e->scoreboard->skin);
|
||||||
|
if (!original)
|
||||||
|
return NULL;
|
||||||
|
inwidth = e->scoreboard->skin->width;
|
||||||
|
inheight = e->scoreboard->skin->height;
|
||||||
|
|
||||||
|
cm->texnum.base = cm->texnum.fullbright = GL_LoadTexture(e->scoreboard->skin->name, inwidth, inheight, original, true, false);
|
||||||
|
return &cm->texnum;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
cm->texnum.bump = texnums[cm->skinnum].bump; //can't colour bumpmapping
|
cm->texnum.bump = texnums[cm->skinnum].bump; //can't colour bumpmapping
|
||||||
if (skinname!=modelname && e->scoreboard && e->scoreboard->skin)
|
if ((!texnums || skinname!=modelname) && e->scoreboard && e->scoreboard->skin)
|
||||||
{
|
{
|
||||||
original = Skin_Cache8(e->scoreboard->skin);
|
original = Skin_Cache8(e->scoreboard->skin);
|
||||||
inwidth = e->scoreboard->skin->width;
|
inwidth = e->scoreboard->skin->width;
|
||||||
|
|
|
@ -3188,15 +3188,17 @@ void GL_Upload8 (qbyte *data, int width, int height, qboolean mipmap, qboolean
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (s&3)
|
for (i=(s&~3)-4 ; i>=0 ; i-=4)
|
||||||
Sys_Error ("GL_Upload8: s&3");
|
|
||||||
for (i=0 ; i<s ; i+=4)
|
|
||||||
{
|
{
|
||||||
trans[i] = d_8to24rgbtable[data[i]];
|
trans[i] = d_8to24rgbtable[data[i]];
|
||||||
trans[i+1] = d_8to24rgbtable[data[i+1]];
|
trans[i+1] = d_8to24rgbtable[data[i+1]];
|
||||||
trans[i+2] = d_8to24rgbtable[data[i+2]];
|
trans[i+2] = d_8to24rgbtable[data[i+2]];
|
||||||
trans[i+3] = d_8to24rgbtable[data[i+3]];
|
trans[i+3] = d_8to24rgbtable[data[i+3]];
|
||||||
}
|
}
|
||||||
|
for (i=s&~3 ; i<s ; i++) //wow, funky
|
||||||
|
{
|
||||||
|
trans[i] = d_8to24rgbtable[data[i]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GL_USE8BITTEX
|
#ifdef GL_USE8BITTEX
|
||||||
|
|
|
@ -419,6 +419,78 @@ static void PPL_BaseChain_NoBump_2TMU(msurface_t *s, texture_t *tex)
|
||||||
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void PPL_BaseChain_NoBump_2TMU_NoMerge(msurface_t *s, texture_t *tex)
|
||||||
|
{ //doesn't merge surfaces, but tells gl to do each vertex arrayed surface individually, which means no vertex copying.
|
||||||
|
int vi;
|
||||||
|
glRect_t *theRect;
|
||||||
|
|
||||||
|
PPL_EnableVertexArrays();
|
||||||
|
|
||||||
|
if (tex->alphaed)
|
||||||
|
{
|
||||||
|
qglEnable(GL_BLEND);
|
||||||
|
GL_TexEnv(GL_MODULATE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qglDisable(GL_BLEND);
|
||||||
|
GL_TexEnv(GL_REPLACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GL_MBind(GL_TEXTURE0_ARB, tex->gl_texturenum);
|
||||||
|
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
|
||||||
|
GL_SelectTexture(GL_TEXTURE1_ARB);
|
||||||
|
GL_TexEnv(GL_MODULATE);
|
||||||
|
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
|
||||||
|
vi = -1;
|
||||||
|
for (; s ; s=s->texturechain)
|
||||||
|
{
|
||||||
|
if (vi != s->lightmaptexturenum)
|
||||||
|
{
|
||||||
|
if (vi<0)
|
||||||
|
qglEnable(GL_TEXTURE_2D);
|
||||||
|
vi = s->lightmaptexturenum;
|
||||||
|
|
||||||
|
if (vi>=0)
|
||||||
|
{
|
||||||
|
GL_Bind(lightmap_textures[vi] );
|
||||||
|
if (lightmap[vi]->modified)
|
||||||
|
{
|
||||||
|
lightmap[vi]->modified = false;
|
||||||
|
theRect = &lightmap[vi]->rectchange;
|
||||||
|
qglTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t,
|
||||||
|
LMBLOCK_WIDTH, theRect->h, gl_lightmap_format, GL_UNSIGNED_BYTE,
|
||||||
|
lightmap[vi]->lightmaps+(theRect->t) *LMBLOCK_WIDTH*lightmap_bytes);
|
||||||
|
theRect->l = LMBLOCK_WIDTH;
|
||||||
|
theRect->t = LMBLOCK_HEIGHT;
|
||||||
|
theRect->h = 0;
|
||||||
|
theRect->w = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
qglDisable(GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
|
||||||
|
qglClientActiveTextureARB(GL_TEXTURE0_ARB);
|
||||||
|
qglTexCoordPointer(2, GL_FLOAT, VERTEXSIZE*sizeof(GL_FLOAT), s->polys[0].verts[0]+3);
|
||||||
|
qglClientActiveTextureARB(GL_TEXTURE1_ARB);
|
||||||
|
qglTexCoordPointer(2, GL_FLOAT, VERTEXSIZE*sizeof(GL_FLOAT), s->polys[0].verts[0]+5);
|
||||||
|
|
||||||
|
qglVertexPointer(3, GL_FLOAT, VERTEXSIZE*sizeof(GL_FLOAT), s->polys[0].verts[0]);
|
||||||
|
|
||||||
|
qglDrawElements(GL_TRIANGLES, (s->polys[0].numverts-2)*3, GL_UNSIGNED_INT, varray_i_polytotri);
|
||||||
|
}
|
||||||
|
|
||||||
|
qglDisable(GL_TEXTURE_2D);
|
||||||
|
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
|
||||||
|
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||||
|
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
}
|
||||||
|
|
||||||
static void PPL_BaseChain_Bump_2TMU(msurface_t *first, texture_t *tex)
|
static void PPL_BaseChain_Bump_2TMU(msurface_t *first, texture_t *tex)
|
||||||
{
|
{
|
||||||
int vi;
|
int vi;
|
||||||
|
@ -1617,7 +1689,8 @@ static void PPL_BaseTextureChain(msurface_t *first)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PPL_BaseChain_NoBump_2TMU(first, t);
|
PPL_BaseChain_NoBump_2TMU_NoMerge(first, t);
|
||||||
|
// PPL_BaseChain_NoBump_2TMU(first, t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1686,14 +1686,204 @@ void Shader_RunCinematic (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int R_LoadShader ( char *name, int type )
|
void Shader_DefaultBSP(char *shortname, shader_t *s)
|
||||||
|
{
|
||||||
|
shaderpass_t *pass;
|
||||||
|
pass = &s->passes[0];
|
||||||
|
pass->flags = SHADER_PASS_LIGHTMAP | SHADER_PASS_DEPTHWRITE | SHADER_PASS_NOCOLORARRAY;
|
||||||
|
pass->tcgen = TC_GEN_LIGHTMAP;
|
||||||
|
pass->anim_frames[0] = 0;
|
||||||
|
pass->depthfunc = GL_LEQUAL;
|
||||||
|
pass->blendmode = GL_REPLACE;
|
||||||
|
pass->alphagen = ALPHA_GEN_IDENTITY;
|
||||||
|
pass->rgbgen = RGB_GEN_IDENTITY;
|
||||||
|
pass->numMergedPasses = 2;
|
||||||
|
|
||||||
|
if ( qglMTexCoord2fSGIS )
|
||||||
|
{
|
||||||
|
pass->numMergedPasses = 2;
|
||||||
|
pass->flush = R_RenderMeshMultitextured;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pass->numMergedPasses = 1;
|
||||||
|
pass->flush = R_RenderMeshGeneric;
|
||||||
|
}
|
||||||
|
|
||||||
|
pass = &s->passes[1];
|
||||||
|
pass->flags = SHADER_PASS_BLEND | SHADER_PASS_NOCOLORARRAY;
|
||||||
|
pass->tcgen = TC_GEN_BASE;
|
||||||
|
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, true, false, true);//GL_FindImage (shortname, 0);
|
||||||
|
pass->blendsrc = GL_ZERO;
|
||||||
|
pass->blenddst = GL_SRC_COLOR;
|
||||||
|
pass->blendmode = GL_MODULATE;
|
||||||
|
pass->depthfunc = GL_LEQUAL;
|
||||||
|
pass->rgbgen = RGB_GEN_IDENTITY;
|
||||||
|
pass->alphagen = ALPHA_GEN_IDENTITY;
|
||||||
|
|
||||||
|
pass->numMergedPasses = 1;
|
||||||
|
pass->flush = R_RenderMeshGeneric;
|
||||||
|
|
||||||
|
if ( !pass->anim_frames[0] ) {
|
||||||
|
Con_DPrintf ( S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname );
|
||||||
|
pass->anim_frames[0] = 0;//fizme:r_notexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
s->numpasses = 2;
|
||||||
|
s->numdeforms = 0;
|
||||||
|
s->flags = SHADER_DEPTHWRITE|SHADER_CULL_FRONT;
|
||||||
|
s->features = MF_STCOORDS|MF_LMCOORDS|MF_TRNORMALS;
|
||||||
|
s->sort = SHADER_SORT_OPAQUE;
|
||||||
|
s->registration_sequence = 1;//fizme: registration_sequence;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Shader_DefaultBSPVertex(char *shortname, shader_t *s)
|
||||||
|
{
|
||||||
|
shaderpass_t *pass;
|
||||||
|
pass = &s->passes[0];
|
||||||
|
pass->tcgen = TC_GEN_BASE;
|
||||||
|
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, true, false, true);//GL_FindImage (shortname, 0);
|
||||||
|
pass->depthfunc = GL_LEQUAL;
|
||||||
|
pass->flags = SHADER_PASS_DEPTHWRITE;
|
||||||
|
pass->rgbgen = RGB_GEN_VERTEX;
|
||||||
|
pass->alphagen = ALPHA_GEN_IDENTITY;
|
||||||
|
pass->blendmode = GL_MODULATE;
|
||||||
|
pass->numMergedPasses = 1;
|
||||||
|
pass->flush = R_RenderMeshGeneric;
|
||||||
|
|
||||||
|
if ( !pass->anim_frames[0] ) {
|
||||||
|
Con_DPrintf ( S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname );
|
||||||
|
pass->anim_frames[0] = 0;//fizme:r_notexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
s->numpasses = 1;
|
||||||
|
s->numdeforms = 0;
|
||||||
|
s->flags = SHADER_DEPTHWRITE|SHADER_CULL_FRONT;
|
||||||
|
s->features = MF_STCOORDS|MF_COLORS|MF_TRNORMALS;
|
||||||
|
s->sort = SHADER_SORT_OPAQUE;
|
||||||
|
s->registration_sequence = 1;//fizme: registration_sequence;
|
||||||
|
}
|
||||||
|
void Shader_DefaultBSPFlare(char *shortname, shader_t *s)
|
||||||
|
{
|
||||||
|
shaderpass_t *pass;
|
||||||
|
pass = &s->passes[0];
|
||||||
|
pass->flags = SHADER_PASS_BLEND | SHADER_PASS_NOCOLORARRAY;
|
||||||
|
pass->blendsrc = GL_ONE;
|
||||||
|
pass->blenddst = GL_ONE;
|
||||||
|
pass->blendmode = GL_MODULATE;
|
||||||
|
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, true, true, true);//GL_FindImage (shortname, 0);
|
||||||
|
pass->depthfunc = GL_LEQUAL;
|
||||||
|
pass->rgbgen = RGB_GEN_VERTEX;
|
||||||
|
pass->alphagen = ALPHA_GEN_IDENTITY;
|
||||||
|
pass->numtcmods = 0;
|
||||||
|
pass->tcgen = TC_GEN_BASE;
|
||||||
|
pass->numMergedPasses = 1;
|
||||||
|
pass->flush = R_RenderMeshGeneric;
|
||||||
|
|
||||||
|
if ( !pass->anim_frames[0] ) {
|
||||||
|
Con_DPrintf ( S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname );
|
||||||
|
pass->anim_frames[0] = 0;//fizme:r_notexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
s->numpasses = 1;
|
||||||
|
s->numdeforms = 0;
|
||||||
|
s->flags = SHADER_FLARE;
|
||||||
|
s->features = MF_STCOORDS|MF_COLORS;
|
||||||
|
s->sort = SHADER_SORT_ADDITIVE;
|
||||||
|
s->registration_sequence = 1;//fizme: registration_sequence;
|
||||||
|
}
|
||||||
|
void Shader_DefaultSkin(char *shortname, shader_t *s)
|
||||||
|
{
|
||||||
|
shaderpass_t *pass;
|
||||||
|
pass = &s->passes[0];
|
||||||
|
pass->flags = SHADER_PASS_DEPTHWRITE;
|
||||||
|
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, true, true, true);//GL_FindImage (shortname, 0);
|
||||||
|
pass->depthfunc = GL_LEQUAL;
|
||||||
|
pass->rgbgen = RGB_GEN_LIGHTING_DIFFUSE;
|
||||||
|
pass->numtcmods = 0;
|
||||||
|
pass->tcgen = TC_GEN_BASE;
|
||||||
|
pass->blendmode = GL_MODULATE;
|
||||||
|
pass->numMergedPasses = 1;
|
||||||
|
pass->flush = R_RenderMeshGeneric;
|
||||||
|
|
||||||
|
if ( !pass->anim_frames[0] ) {
|
||||||
|
Con_DPrintf ( S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname );
|
||||||
|
pass->anim_frames[0] = 0;//fizme:r_notexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
s->numpasses = 1;
|
||||||
|
s->numdeforms = 0;
|
||||||
|
s->flags = SHADER_DEPTHWRITE|SHADER_CULL_FRONT;
|
||||||
|
s->features = MF_STCOORDS|MF_NORMALS;
|
||||||
|
s->sort = SHADER_SORT_OPAQUE;
|
||||||
|
s->registration_sequence = 1;//fizme: registration_sequence;
|
||||||
|
}
|
||||||
|
void Shader_DefaultSkinShell(char *shortname, shader_t *s)
|
||||||
|
{
|
||||||
|
shaderpass_t *pass;
|
||||||
|
pass = &s->passes[0];
|
||||||
|
pass->flags = SHADER_PASS_DEPTHWRITE | SHADER_PASS_BLEND;
|
||||||
|
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, true, true, true);//GL_FindImage (shortname, 0);
|
||||||
|
pass->depthfunc = GL_LEQUAL;
|
||||||
|
pass->rgbgen = RGB_GEN_ENTITY;
|
||||||
|
pass->alphagen = ALPHA_GEN_ENTITY;
|
||||||
|
pass->numtcmods = 0;
|
||||||
|
pass->tcgen = TC_GEN_BASE;
|
||||||
|
pass->blendsrc = GL_SRC_ALPHA;
|
||||||
|
pass->blenddst = GL_ONE_MINUS_SRC_ALPHA;
|
||||||
|
pass->blendmode = GL_MODULATE;
|
||||||
|
pass->numMergedPasses = 1;
|
||||||
|
pass->flush = R_RenderMeshGeneric;
|
||||||
|
|
||||||
|
if ( !pass->anim_frames[0] ) {
|
||||||
|
Con_DPrintf ( S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname );
|
||||||
|
pass->anim_frames[0] = 0;//fizme:r_notexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
s->numpasses = 1;
|
||||||
|
s->numdeforms = 0;
|
||||||
|
s->flags = SHADER_DEPTHWRITE|SHADER_CULL_FRONT;
|
||||||
|
s->features = MF_STCOORDS|MF_NORMALS;
|
||||||
|
s->sort = SHADER_SORT_OPAQUE;
|
||||||
|
s->registration_sequence = 1;//fizme: registration_sequence;
|
||||||
|
}
|
||||||
|
void Shader_Default2D(char *shortname, shader_t *s)
|
||||||
|
{
|
||||||
|
shaderpass_t *pass;
|
||||||
|
pass = &s->passes[0];
|
||||||
|
pass->flags = SHADER_PASS_BLEND | SHADER_PASS_NOCOLORARRAY;
|
||||||
|
pass->blendsrc = GL_SRC_ALPHA;
|
||||||
|
pass->blenddst = GL_ONE_MINUS_SRC_ALPHA;
|
||||||
|
pass->blendmode = GL_MODULATE;
|
||||||
|
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, false, true, true);//GL_FindImage (shortname, IT_NOPICMIP|IT_NOMIPMAP);
|
||||||
|
pass->depthfunc = GL_LEQUAL;
|
||||||
|
pass->rgbgen = RGB_GEN_VERTEX;
|
||||||
|
pass->alphagen = ALPHA_GEN_VERTEX;
|
||||||
|
pass->numtcmods = 0;
|
||||||
|
pass->tcgen = TC_GEN_BASE;
|
||||||
|
pass->numMergedPasses = 1;
|
||||||
|
pass->flush = R_RenderMeshGeneric;
|
||||||
|
|
||||||
|
if ( !pass->anim_frames[0] ) {
|
||||||
|
Con_DPrintf ( S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname );
|
||||||
|
pass->anim_frames[0] = 0;//fizme:r_notexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
s->numpasses = 1;
|
||||||
|
s->numdeforms = 0;
|
||||||
|
s->flags = SHADER_NOPICMIP|SHADER_NOMIPMAPS|SHADER_BLEND;
|
||||||
|
s->features = MF_STCOORDS|MF_COLORS;
|
||||||
|
s->sort = SHADER_SORT_ADDITIVE;
|
||||||
|
s->registration_sequence = 1;//fizme: registration_sequence;
|
||||||
|
}
|
||||||
|
|
||||||
|
int R_LoadShader ( char *name, void(*defaultgen)(char *name, shader_t*))
|
||||||
{
|
{
|
||||||
int i, f = -1;
|
int i, f = -1;
|
||||||
unsigned int offset, length = 0;
|
unsigned int offset, length = 0;
|
||||||
char shortname[MAX_QPATH], path[MAX_QPATH];
|
char shortname[MAX_QPATH], path[MAX_QPATH];
|
||||||
char *buf = NULL, *ts = NULL;
|
char *buf = NULL, *ts = NULL;
|
||||||
shader_t *s;
|
shader_t *s;
|
||||||
shaderpass_t *pass;
|
|
||||||
|
|
||||||
COM_StripExtension ( name, shortname );
|
COM_StripExtension ( name, shortname );
|
||||||
|
|
||||||
|
@ -1768,194 +1958,42 @@ int R_LoadShader ( char *name, int type )
|
||||||
}
|
}
|
||||||
else // make a default shader
|
else // make a default shader
|
||||||
{
|
{
|
||||||
switch (type)
|
if (defaultgen)
|
||||||
{
|
defaultgen(shortname, s);
|
||||||
case SHADER_BSP:
|
|
||||||
pass = &s->passes[0];
|
|
||||||
pass->flags = SHADER_PASS_LIGHTMAP | SHADER_PASS_DEPTHWRITE | SHADER_PASS_NOCOLORARRAY;
|
|
||||||
pass->tcgen = TC_GEN_LIGHTMAP;
|
|
||||||
pass->anim_frames[0] = 0;
|
|
||||||
pass->depthfunc = GL_LEQUAL;
|
|
||||||
pass->blendmode = GL_REPLACE;
|
|
||||||
pass->alphagen = ALPHA_GEN_IDENTITY;
|
|
||||||
pass->rgbgen = RGB_GEN_IDENTITY;
|
|
||||||
pass->numMergedPasses = 2;
|
|
||||||
|
|
||||||
if ( qglMTexCoord2fSGIS )
|
|
||||||
{
|
|
||||||
pass->numMergedPasses = 2;
|
|
||||||
pass->flush = R_RenderMeshMultitextured;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
pass->numMergedPasses = 1;
|
|
||||||
pass->flush = R_RenderMeshGeneric;
|
|
||||||
}
|
|
||||||
|
|
||||||
pass = &s->passes[1];
|
|
||||||
pass->flags = SHADER_PASS_BLEND | SHADER_PASS_NOCOLORARRAY;
|
|
||||||
pass->tcgen = TC_GEN_BASE;
|
|
||||||
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, true, false, true);//GL_FindImage (shortname, 0);
|
|
||||||
pass->blendsrc = GL_ZERO;
|
|
||||||
pass->blenddst = GL_SRC_COLOR;
|
|
||||||
pass->blendmode = GL_MODULATE;
|
|
||||||
pass->depthfunc = GL_LEQUAL;
|
|
||||||
pass->rgbgen = RGB_GEN_IDENTITY;
|
|
||||||
pass->alphagen = ALPHA_GEN_IDENTITY;
|
|
||||||
|
|
||||||
pass->numMergedPasses = 1;
|
|
||||||
pass->flush = R_RenderMeshGeneric;
|
|
||||||
|
|
||||||
if ( !pass->anim_frames[0] ) {
|
|
||||||
Con_DPrintf ( S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname );
|
|
||||||
pass->anim_frames[0] = 0;//fizme:r_notexture;
|
|
||||||
}
|
|
||||||
|
|
||||||
s->numpasses = 2;
|
|
||||||
s->numdeforms = 0;
|
|
||||||
s->flags = SHADER_DEPTHWRITE|SHADER_CULL_FRONT;
|
|
||||||
s->features = MF_STCOORDS|MF_LMCOORDS|MF_TRNORMALS;
|
|
||||||
s->sort = SHADER_SORT_OPAQUE;
|
|
||||||
s->registration_sequence = 1;//fizme: registration_sequence;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SHADER_BSP_VERTEX:
|
|
||||||
pass = &s->passes[0];
|
|
||||||
pass->tcgen = TC_GEN_BASE;
|
|
||||||
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, true, false, true);//GL_FindImage (shortname, 0);
|
|
||||||
pass->depthfunc = GL_LEQUAL;
|
|
||||||
pass->flags = SHADER_PASS_DEPTHWRITE;
|
|
||||||
pass->rgbgen = RGB_GEN_VERTEX;
|
|
||||||
pass->alphagen = ALPHA_GEN_IDENTITY;
|
|
||||||
pass->blendmode = GL_MODULATE;
|
|
||||||
pass->numMergedPasses = 1;
|
|
||||||
pass->flush = R_RenderMeshGeneric;
|
|
||||||
|
|
||||||
if ( !pass->anim_frames[0] ) {
|
|
||||||
Con_DPrintf ( S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname );
|
|
||||||
pass->anim_frames[0] = 0;//fizme:r_notexture;
|
|
||||||
}
|
|
||||||
|
|
||||||
s->numpasses = 1;
|
|
||||||
s->numdeforms = 0;
|
|
||||||
s->flags = SHADER_DEPTHWRITE|SHADER_CULL_FRONT;
|
|
||||||
s->features = MF_STCOORDS|MF_COLORS|MF_TRNORMALS;
|
|
||||||
s->sort = SHADER_SORT_OPAQUE;
|
|
||||||
s->registration_sequence = 1;//fizme: registration_sequence;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SHADER_BSP_FLARE:
|
|
||||||
pass = &s->passes[0];
|
|
||||||
pass->flags = SHADER_PASS_BLEND | SHADER_PASS_NOCOLORARRAY;
|
|
||||||
pass->blendsrc = GL_ONE;
|
|
||||||
pass->blenddst = GL_ONE;
|
|
||||||
pass->blendmode = GL_MODULATE;
|
|
||||||
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, true, true, true);//GL_FindImage (shortname, 0);
|
|
||||||
pass->depthfunc = GL_LEQUAL;
|
|
||||||
pass->rgbgen = RGB_GEN_VERTEX;
|
|
||||||
pass->alphagen = ALPHA_GEN_IDENTITY;
|
|
||||||
pass->numtcmods = 0;
|
|
||||||
pass->tcgen = TC_GEN_BASE;
|
|
||||||
pass->numMergedPasses = 1;
|
|
||||||
pass->flush = R_RenderMeshGeneric;
|
|
||||||
|
|
||||||
if ( !pass->anim_frames[0] ) {
|
|
||||||
Con_DPrintf ( S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname );
|
|
||||||
pass->anim_frames[0] = 0;//fizme:r_notexture;
|
|
||||||
}
|
|
||||||
|
|
||||||
s->numpasses = 1;
|
|
||||||
s->numdeforms = 0;
|
|
||||||
s->flags = SHADER_FLARE;
|
|
||||||
s->features = MF_STCOORDS|MF_COLORS;
|
|
||||||
s->sort = SHADER_SORT_ADDITIVE;
|
|
||||||
s->registration_sequence = 1;//fizme: registration_sequence;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SHADER_MD3:
|
|
||||||
pass = &s->passes[0];
|
|
||||||
pass->flags = SHADER_PASS_DEPTHWRITE;
|
|
||||||
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, true, true, true);//GL_FindImage (shortname, 0);
|
|
||||||
pass->depthfunc = GL_LEQUAL;
|
|
||||||
pass->rgbgen = RGB_GEN_LIGHTING_DIFFUSE;
|
|
||||||
pass->numtcmods = 0;
|
|
||||||
pass->tcgen = TC_GEN_BASE;
|
|
||||||
pass->blendmode = GL_MODULATE;
|
|
||||||
pass->numMergedPasses = 1;
|
|
||||||
pass->flush = R_RenderMeshGeneric;
|
|
||||||
|
|
||||||
if ( !pass->anim_frames[0] ) {
|
|
||||||
Con_DPrintf ( S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname );
|
|
||||||
pass->anim_frames[0] = 0;//fizme:r_notexture;
|
|
||||||
}
|
|
||||||
|
|
||||||
s->numpasses = 1;
|
|
||||||
s->numdeforms = 0;
|
|
||||||
s->flags = SHADER_DEPTHWRITE|SHADER_CULL_FRONT;
|
|
||||||
s->features = MF_STCOORDS|MF_NORMALS;
|
|
||||||
s->sort = SHADER_SORT_OPAQUE;
|
|
||||||
s->registration_sequence = 1;//fizme: registration_sequence;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SHADER_2D:
|
|
||||||
pass = &s->passes[0];
|
|
||||||
pass->flags = SHADER_PASS_BLEND | SHADER_PASS_NOCOLORARRAY;
|
|
||||||
pass->blendsrc = GL_SRC_ALPHA;
|
|
||||||
pass->blenddst = GL_ONE_MINUS_SRC_ALPHA;
|
|
||||||
pass->blendmode = GL_MODULATE;
|
|
||||||
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, false, true, true);//GL_FindImage (shortname, IT_NOPICMIP|IT_NOMIPMAP);
|
|
||||||
pass->depthfunc = GL_LEQUAL;
|
|
||||||
pass->rgbgen = RGB_GEN_VERTEX;
|
|
||||||
pass->alphagen = ALPHA_GEN_VERTEX;
|
|
||||||
pass->numtcmods = 0;
|
|
||||||
pass->tcgen = TC_GEN_BASE;
|
|
||||||
pass->numMergedPasses = 1;
|
|
||||||
pass->flush = R_RenderMeshGeneric;
|
|
||||||
|
|
||||||
if ( !pass->anim_frames[0] ) {
|
|
||||||
Con_DPrintf ( S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname );
|
|
||||||
pass->anim_frames[0] = 0;//fizme:r_notexture;
|
|
||||||
}
|
|
||||||
|
|
||||||
s->numpasses = 1;
|
|
||||||
s->numdeforms = 0;
|
|
||||||
s->flags = SHADER_NOPICMIP|SHADER_NOMIPMAPS|SHADER_BLEND;
|
|
||||||
s->features = MF_STCOORDS|MF_COLORS;
|
|
||||||
s->sort = SHADER_SORT_ADDITIVE;
|
|
||||||
s->registration_sequence = 1;//fizme: registration_sequence;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
shader_t *R_RegisterPic (char *name)
|
shader_t *R_RegisterPic (char *name)
|
||||||
{
|
{
|
||||||
return &r_shaders[R_LoadShader (name, SHADER_2D)];
|
return &r_shaders[R_LoadShader (name, Shader_Default2D)];
|
||||||
}
|
}
|
||||||
|
|
||||||
shader_t *R_RegisterShader (char *name)
|
shader_t *R_RegisterShader (char *name)
|
||||||
{
|
{
|
||||||
return &r_shaders[R_LoadShader (name, SHADER_BSP)];
|
return &r_shaders[R_LoadShader (name, Shader_DefaultBSP)];
|
||||||
}
|
}
|
||||||
|
|
||||||
shader_t *R_RegisterShader_Vertex (char *name)
|
shader_t *R_RegisterShader_Vertex (char *name)
|
||||||
{
|
{
|
||||||
return &r_shaders[R_LoadShader (name, SHADER_BSP_VERTEX)];
|
return &r_shaders[R_LoadShader (name, Shader_DefaultBSPVertex)];
|
||||||
}
|
}
|
||||||
|
|
||||||
shader_t *R_RegisterShader_Flare (char *name)
|
shader_t *R_RegisterShader_Flare (char *name)
|
||||||
{
|
{
|
||||||
return &r_shaders[R_LoadShader (name, SHADER_BSP_FLARE)];
|
return &r_shaders[R_LoadShader (name, Shader_DefaultBSPFlare)];
|
||||||
}
|
}
|
||||||
|
|
||||||
shader_t *R_RegisterSkin (char *name)
|
shader_t *R_RegisterSkin (char *name)
|
||||||
{
|
{
|
||||||
return &r_shaders[R_LoadShader (name, SHADER_MD3)];
|
return &r_shaders[R_LoadShader (name, Shader_DefaultSkin)];
|
||||||
|
}
|
||||||
|
shader_t *R_RegisterCustom (char *name, void(*defaultgen)(char *name, shader_t*))
|
||||||
|
{
|
||||||
|
return &r_shaders[R_LoadShader (name, defaultgen)];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,9 @@ shader_t *R_RegisterShader (char *name);
|
||||||
shader_t *R_RegisterShader_Vertex (char *name);
|
shader_t *R_RegisterShader_Vertex (char *name);
|
||||||
shader_t *R_RegisterShader_Flare (char *name);
|
shader_t *R_RegisterShader_Flare (char *name);
|
||||||
shader_t *R_RegisterSkin (char *name);
|
shader_t *R_RegisterSkin (char *name);
|
||||||
|
shader_t *R_RegisterCustom (char *name, void(*defaultgen)(char *name, shader_t*));
|
||||||
|
|
||||||
|
void Shader_DefaultSkinShell(char *shortname, shader_t *s);
|
||||||
|
|
||||||
|
|
||||||
void R_BackendInit (void);
|
void R_BackendInit (void);
|
||||||
|
|
|
@ -437,26 +437,37 @@ extern token_type_t pr_token_type;
|
||||||
extern QCC_type_t *pr_immediate_type;
|
extern QCC_type_t *pr_immediate_type;
|
||||||
extern QCC_eval_t pr_immediate;
|
extern QCC_eval_t pr_immediate;
|
||||||
|
|
||||||
extern pbool keyword_var;
|
extern pbool keyword_asm;
|
||||||
extern pbool keyword_thinktime;
|
extern pbool keyword_break;
|
||||||
extern pbool keyword_switch;
|
|
||||||
extern pbool keyword_for;
|
|
||||||
extern pbool keyword_case;
|
extern pbool keyword_case;
|
||||||
|
extern pbool keyword_class;
|
||||||
|
extern pbool keyword_const;
|
||||||
|
extern pbool keyword_continue;
|
||||||
extern pbool keyword_default;
|
extern pbool keyword_default;
|
||||||
extern pbool keyword_do;
|
extern pbool keyword_do;
|
||||||
extern pbool keyword_asm;
|
extern pbool keyword_entity;
|
||||||
|
extern pbool keyword_float;
|
||||||
|
extern pbool keyword_for;
|
||||||
extern pbool keyword_goto;
|
extern pbool keyword_goto;
|
||||||
extern pbool keyword_break;
|
extern pbool keyword_int;
|
||||||
extern pbool keyword_continue;
|
extern pbool keyword_integer;
|
||||||
extern pbool keyword_state;
|
extern pbool keyword_state;
|
||||||
extern pbool keyword_string;
|
extern pbool keyword_string;
|
||||||
extern pbool keyword_float;
|
extern pbool keyword_struct;
|
||||||
extern pbool keyword_entity;
|
extern pbool keyword_switch;
|
||||||
|
extern pbool keyword_thinktime;
|
||||||
|
extern pbool keyword_var;
|
||||||
extern pbool keyword_vector;
|
extern pbool keyword_vector;
|
||||||
extern pbool keyword_integer;
|
extern pbool keyword_union;
|
||||||
extern pbool keyword_int;
|
extern pbool keyword_enum; //kinda like in c, but typedef not supported.
|
||||||
extern pbool keyword_const;
|
extern pbool keyword_enumflags; //like enum, but doubles instead of adds 1.
|
||||||
extern pbool keyword_class;
|
extern pbool keyword_typedef; //fixme
|
||||||
|
extern pbool keyword_extern; //function is external, don't error or warn if the body was not found
|
||||||
|
extern pbool keyword_shared; //mark global to be copied over when progs changes (part of FTE_MULTIPROGS)
|
||||||
|
extern pbool keyword_noref; //nowhere else references this, don't strip it.
|
||||||
|
extern pbool keyword_nosave; //don't write the def to the output.
|
||||||
|
extern pbool keyword_union; //you surly know what a union is!
|
||||||
|
|
||||||
|
|
||||||
extern pbool keywords_coexist;
|
extern pbool keywords_coexist;
|
||||||
extern pbool output_parms;
|
extern pbool output_parms;
|
||||||
|
@ -527,9 +538,10 @@ CompilerConstant_t *QCC_PR_DefineName(char *name);
|
||||||
void QCC_RemapOffsets(unsigned int firststatement, unsigned int laststatement, unsigned int min, unsigned int max, unsigned int newmin);
|
void QCC_RemapOffsets(unsigned int firststatement, unsigned int laststatement, unsigned int min, unsigned int max, unsigned int newmin);
|
||||||
|
|
||||||
#ifndef COMMONINLINES
|
#ifndef COMMONINLINES
|
||||||
pbool QCC_PR_Check (char *string);
|
pbool QCC_PR_CheckToken (char *string);
|
||||||
pbool QCC_PR_CheckInsens (char *string);
|
pbool QCC_PR_CheckName (char *string);
|
||||||
void QCC_PR_Expect (char *string);
|
void QCC_PR_Expect (char *string);
|
||||||
|
pbool QCC_PR_CheckKeyword(int keywordenabled, char *string);
|
||||||
#endif
|
#endif
|
||||||
void VARGS QCC_PR_ParseError (int errortype, char *error, ...);
|
void VARGS QCC_PR_ParseError (int errortype, char *error, ...);
|
||||||
void VARGS QCC_PR_ParseWarning (int warningtype, char *error, ...);
|
void VARGS QCC_PR_ParseWarning (int warningtype, char *error, ...);
|
||||||
|
@ -587,6 +599,7 @@ enum {
|
||||||
WARN_EXTENSION_USED, //extension that frikqcc also understands
|
WARN_EXTENSION_USED, //extension that frikqcc also understands
|
||||||
WARN_IFSTRING_USED,
|
WARN_IFSTRING_USED,
|
||||||
WARN_LAXCAST, //some errors become this with a compiler flag
|
WARN_LAXCAST, //some errors become this with a compiler flag
|
||||||
|
WARN_UNDESIRABLECONVENTION,
|
||||||
|
|
||||||
ERR_PARSEERRORS, //caused by qcc_pr_parseerror being called.
|
ERR_PARSEERRORS, //caused by qcc_pr_parseerror being called.
|
||||||
|
|
||||||
|
@ -847,9 +860,9 @@ extern qcc_cachedsourcefile_t *qcc_sourcefile;
|
||||||
|
|
||||||
|
|
||||||
#ifdef COMMONINLINES
|
#ifdef COMMONINLINES
|
||||||
bool inline QCC_PR_Check (char *string)
|
bool inline QCC_PR_CheckToken (char *string)
|
||||||
{
|
{
|
||||||
if (strcmp (string, pr_token))
|
if (STRCMP (string, pr_token))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QCC_PR_Lex ();
|
QCC_PR_Lex ();
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -935,8 +935,13 @@ void QCC_PR_LexString (void)
|
||||||
else if (c == '\'')
|
else if (c == '\'')
|
||||||
c = '\'';
|
c = '\'';
|
||||||
else if (c >= '0' && c <= '9')
|
else if (c >= '0' && c <= '9')
|
||||||
c = (int)QCC_PR_LexOctal();
|
c = 18 + c - '0';
|
||||||
|
else if (c >= '0' && c <= '8')
|
||||||
|
{ //octal
|
||||||
|
c = c - '0';
|
||||||
|
while(*pr_file_p >= '0' && *pr_file_p <= '8')
|
||||||
|
c = (c<<3) | (*pr_file_p++ - '0');
|
||||||
|
}
|
||||||
else if (c == '\r')
|
else if (c == '\r')
|
||||||
{ //sigh
|
{ //sigh
|
||||||
c = *pr_file_p++;
|
c = *pr_file_p++;
|
||||||
|
@ -2367,7 +2372,7 @@ Returns false and does nothing otherwise
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
#ifndef COMMONINLINES
|
#ifndef COMMONINLINES
|
||||||
pbool QCC_PR_Check (char *string)
|
pbool QCC_PR_CheckToken (char *string)
|
||||||
{
|
{
|
||||||
if (STRCMP (string, pr_token))
|
if (STRCMP (string, pr_token))
|
||||||
return false;
|
return false;
|
||||||
|
@ -2375,17 +2380,43 @@ pbool QCC_PR_Check (char *string)
|
||||||
QCC_PR_Lex ();
|
QCC_PR_Lex ();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
pbool QCC_PR_CheckInsens (char *string)
|
pbool QCC_PR_CheckName(char *string)
|
||||||
{
|
{
|
||||||
|
if (flag_caseinsensative)
|
||||||
|
{
|
||||||
if (stricmp (string, pr_token))
|
if (stricmp (string, pr_token))
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (STRCMP(string, pr_token))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
QCC_PR_Lex ();
|
QCC_PR_Lex ();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pbool QCC_PR_CheckKeyword(int keywordenabled, char *string)
|
||||||
|
{
|
||||||
|
if (!keywordenabled)
|
||||||
|
return false;
|
||||||
|
if (flag_caseinsensative)
|
||||||
|
{
|
||||||
|
if (stricmp (string, pr_token))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (STRCMP(string, pr_token))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
QCC_PR_Lex ();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
PR_ParseName
|
PR_ParseName
|
||||||
|
@ -2622,7 +2653,7 @@ void QCC_PR_SkipToSemicolon (void)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (!pr_bracelevel && QCC_PR_Check (";"))
|
if (!pr_bracelevel && QCC_PR_CheckToken (";"))
|
||||||
return;
|
return;
|
||||||
QCC_PR_Lex ();
|
QCC_PR_Lex ();
|
||||||
} while (pr_token_type != tt_eof);
|
} while (pr_token_type != tt_eof);
|
||||||
|
@ -2661,9 +2692,9 @@ QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype)
|
||||||
ptype = NULL;
|
ptype = NULL;
|
||||||
|
|
||||||
|
|
||||||
if (!QCC_PR_Check (")"))
|
if (!QCC_PR_CheckToken (")"))
|
||||||
{
|
{
|
||||||
if (QCC_PR_Check ("..."))
|
if (QCC_PR_CheckToken ("..."))
|
||||||
ftype->num_parms = -1; // variable args
|
ftype->num_parms = -1; // variable args
|
||||||
else
|
else
|
||||||
do
|
do
|
||||||
|
@ -2671,7 +2702,7 @@ QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype)
|
||||||
if (ftype->num_parms>=MAX_PARMS+MAX_EXTRA_PARMS)
|
if (ftype->num_parms>=MAX_PARMS+MAX_EXTRA_PARMS)
|
||||||
QCC_PR_ParseError(ERR_TOOMANYTOTALPARAMETERS, "Too many parameters. Sorry. (limit is %i)\n", MAX_PARMS+MAX_EXTRA_PARMS);
|
QCC_PR_ParseError(ERR_TOOMANYTOTALPARAMETERS, "Too many parameters. Sorry. (limit is %i)\n", MAX_PARMS+MAX_EXTRA_PARMS);
|
||||||
|
|
||||||
if (QCC_PR_Check ("..."))
|
if (QCC_PR_CheckToken ("..."))
|
||||||
{
|
{
|
||||||
ftype->num_parms = (ftype->num_parms * -1) - 1;
|
ftype->num_parms = (ftype->num_parms * -1) - 1;
|
||||||
break;
|
break;
|
||||||
|
@ -2703,7 +2734,7 @@ QCC_type_t *QCC_PR_ParseFunctionType (int newtype, QCC_type_t *returntype)
|
||||||
else if (definenames)
|
else if (definenames)
|
||||||
strcpy (pr_parm_names[ftype->num_parms], "");
|
strcpy (pr_parm_names[ftype->num_parms], "");
|
||||||
ftype->num_parms++;
|
ftype->num_parms++;
|
||||||
} while (QCC_PR_Check (","));
|
} while (QCC_PR_CheckToken (","));
|
||||||
|
|
||||||
QCC_PR_Expect (")");
|
QCC_PR_Expect (")");
|
||||||
}
|
}
|
||||||
|
@ -2730,9 +2761,9 @@ QCC_type_t *QCC_PR_ParseFunctionTypeReacc (int newtype, QCC_type_t *returntype)
|
||||||
ptype = NULL;
|
ptype = NULL;
|
||||||
|
|
||||||
|
|
||||||
if (!QCC_PR_Check (")"))
|
if (!QCC_PR_CheckToken (")"))
|
||||||
{
|
{
|
||||||
if (QCC_PR_Check ("..."))
|
if (QCC_PR_CheckToken ("..."))
|
||||||
ftype->num_parms = -1; // variable args
|
ftype->num_parms = -1; // variable args
|
||||||
else
|
else
|
||||||
do
|
do
|
||||||
|
@ -2740,19 +2771,19 @@ QCC_type_t *QCC_PR_ParseFunctionTypeReacc (int newtype, QCC_type_t *returntype)
|
||||||
if (ftype->num_parms>=MAX_PARMS+MAX_EXTRA_PARMS)
|
if (ftype->num_parms>=MAX_PARMS+MAX_EXTRA_PARMS)
|
||||||
QCC_PR_ParseError(ERR_TOOMANYTOTALPARAMETERS, "Too many parameters. Sorry. (limit is %i)\n", MAX_PARMS+MAX_EXTRA_PARMS);
|
QCC_PR_ParseError(ERR_TOOMANYTOTALPARAMETERS, "Too many parameters. Sorry. (limit is %i)\n", MAX_PARMS+MAX_EXTRA_PARMS);
|
||||||
|
|
||||||
if (QCC_PR_Check ("..."))
|
if (QCC_PR_CheckToken ("..."))
|
||||||
{
|
{
|
||||||
ftype->num_parms = (ftype->num_parms * -1) - 1;
|
ftype->num_parms = (ftype->num_parms * -1) - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QCC_PR_Check("arg"))
|
if (QCC_PR_CheckToken("arg"))
|
||||||
{
|
{
|
||||||
sprintf(argname, "arg%i", ftype->num_parms);
|
sprintf(argname, "arg%i", ftype->num_parms);
|
||||||
name = argname;
|
name = argname;
|
||||||
nptype = QCC_PR_NewType("Variant", ev_variant);
|
nptype = QCC_PR_NewType("Variant", ev_variant);
|
||||||
}
|
}
|
||||||
else if (QCC_PR_Check("vect")) //this can only be of vector sizes, so...
|
else if (QCC_PR_CheckToken("vect")) //this can only be of vector sizes, so...
|
||||||
{
|
{
|
||||||
sprintf(argname, "arg%i", ftype->num_parms);
|
sprintf(argname, "arg%i", ftype->num_parms);
|
||||||
name = argname;
|
name = argname;
|
||||||
|
@ -2782,7 +2813,7 @@ QCC_type_t *QCC_PR_ParseFunctionTypeReacc (int newtype, QCC_type_t *returntype)
|
||||||
if (definenames)
|
if (definenames)
|
||||||
strcpy (pr_parm_names[ftype->num_parms], name);
|
strcpy (pr_parm_names[ftype->num_parms], name);
|
||||||
ftype->num_parms++;
|
ftype->num_parms++;
|
||||||
} while (QCC_PR_Check (";"));
|
} while (QCC_PR_CheckToken (";"));
|
||||||
|
|
||||||
QCC_PR_Expect (")");
|
QCC_PR_Expect (")");
|
||||||
}
|
}
|
||||||
|
@ -2821,7 +2852,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype)
|
||||||
|
|
||||||
// int ofs;
|
// int ofs;
|
||||||
|
|
||||||
if (QCC_PR_Check ("..")) //so we don't end up with the user specifying '. .vector blah' (hexen2 added the .. token for array ranges)
|
if (QCC_PR_CheckToken ("..")) //so we don't end up with the user specifying '. .vector blah' (hexen2 added the .. token for array ranges)
|
||||||
{
|
{
|
||||||
newt = QCC_PR_NewType("FIELD TYPE", ev_field);
|
newt = QCC_PR_NewType("FIELD TYPE", ev_field);
|
||||||
newt->aux_type = QCC_PR_ParseType (false);
|
newt->aux_type = QCC_PR_ParseType (false);
|
||||||
|
@ -2839,7 +2870,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype)
|
||||||
return type;
|
return type;
|
||||||
return QCC_PR_FindType (type);
|
return QCC_PR_FindType (type);
|
||||||
}
|
}
|
||||||
if (QCC_PR_Check ("."))
|
if (QCC_PR_CheckToken ("."))
|
||||||
{
|
{
|
||||||
newt = QCC_PR_NewType("FIELD TYPE", ev_field);
|
newt = QCC_PR_NewType("FIELD TYPE", ev_field);
|
||||||
newt->aux_type = QCC_PR_ParseType (false);
|
newt->aux_type = QCC_PR_ParseType (false);
|
||||||
|
@ -2853,7 +2884,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype)
|
||||||
|
|
||||||
name = QCC_PR_CheakCompConstString(pr_token);
|
name = QCC_PR_CheakCompConstString(pr_token);
|
||||||
|
|
||||||
if (QCC_PR_Check ("class"))
|
if (QCC_PR_CheckKeyword (keyword_class, "class"))
|
||||||
{
|
{
|
||||||
// int parms;
|
// int parms;
|
||||||
QCC_type_t *fieldtype;
|
QCC_type_t *fieldtype;
|
||||||
|
@ -2864,7 +2895,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype)
|
||||||
|
|
||||||
type = NULL;
|
type = NULL;
|
||||||
|
|
||||||
if (QCC_PR_Check(":"))
|
if (QCC_PR_CheckToken(":"))
|
||||||
{
|
{
|
||||||
char *parentname = QCC_PR_ParseName();
|
char *parentname = QCC_PR_ParseName();
|
||||||
newt->parentclass = QCC_TypeForName(parentname);
|
newt->parentclass = QCC_TypeForName(parentname);
|
||||||
|
@ -2876,11 +2907,11 @@ QCC_type_t *QCC_PR_ParseType (int newtype)
|
||||||
|
|
||||||
|
|
||||||
QCC_PR_Expect("{");
|
QCC_PR_Expect("{");
|
||||||
if (QCC_PR_Check(","))
|
if (QCC_PR_CheckToken(","))
|
||||||
QCC_PR_ParseError(ERR_NOTANAME, "member missing name");
|
QCC_PR_ParseError(ERR_NOTANAME, "member missing name");
|
||||||
while (!QCC_PR_Check("}"))
|
while (!QCC_PR_CheckToken("}"))
|
||||||
{
|
{
|
||||||
// if (QCC_PR_Check(","))
|
// if (QCC_PR_CheckToken(","))
|
||||||
// type->next = QCC_PR_NewType(type->name, type->type);
|
// type->next = QCC_PR_NewType(type->name, type->type);
|
||||||
// else
|
// else
|
||||||
newparm = QCC_PR_ParseType(true);
|
newparm = QCC_PR_ParseType(true);
|
||||||
|
@ -2888,17 +2919,17 @@ QCC_type_t *QCC_PR_ParseType (int newtype)
|
||||||
if (newparm->type == ev_struct || newparm->type == ev_union) //we wouldn't be able to handle it.
|
if (newparm->type == ev_struct || newparm->type == ev_union) //we wouldn't be able to handle it.
|
||||||
QCC_PR_ParseError(ERR_INTERNAL, "Struct or union in class %s", classname);
|
QCC_PR_ParseError(ERR_INTERNAL, "Struct or union in class %s", classname);
|
||||||
|
|
||||||
if (!QCC_PR_Check(";"))
|
if (!QCC_PR_CheckToken(";"))
|
||||||
{
|
{
|
||||||
newparm->name = QCC_CopyString(pr_token)+strings;
|
newparm->name = QCC_CopyString(pr_token)+strings;
|
||||||
QCC_PR_Lex();
|
QCC_PR_Lex();
|
||||||
if (QCC_PR_Check("["))
|
if (QCC_PR_CheckToken("["))
|
||||||
{
|
{
|
||||||
type->next->size*=atoi(pr_token);
|
type->next->size*=atoi(pr_token);
|
||||||
QCC_PR_Lex();
|
QCC_PR_Lex();
|
||||||
QCC_PR_Expect("]");
|
QCC_PR_Expect("]");
|
||||||
}
|
}
|
||||||
QCC_PR_Check(";");
|
QCC_PR_CheckToken(";");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
newparm->name = QCC_CopyString("")+strings;
|
newparm->name = QCC_CopyString("")+strings;
|
||||||
|
@ -2924,20 +2955,20 @@ QCC_type_t *QCC_PR_ParseType (int newtype)
|
||||||
QCC_PR_Expect(";");
|
QCC_PR_Expect(";");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (QCC_PR_Check ("struct"))
|
if (QCC_PR_CheckKeyword (keyword_struct, "struct"))
|
||||||
{
|
{
|
||||||
newt = QCC_PR_NewType("struct", ev_struct);
|
newt = QCC_PR_NewType("struct", ev_struct);
|
||||||
newt->size=0;
|
newt->size=0;
|
||||||
QCC_PR_Expect("{");
|
QCC_PR_Expect("{");
|
||||||
|
|
||||||
type = NULL;
|
type = NULL;
|
||||||
if (QCC_PR_Check(","))
|
if (QCC_PR_CheckToken(","))
|
||||||
QCC_PR_ParseError(ERR_NOTANAME, "element missing name");
|
QCC_PR_ParseError(ERR_NOTANAME, "element missing name");
|
||||||
|
|
||||||
newparm = NULL;
|
newparm = NULL;
|
||||||
while (!QCC_PR_Check("}"))
|
while (!QCC_PR_CheckToken("}"))
|
||||||
{
|
{
|
||||||
if (QCC_PR_Check(","))
|
if (QCC_PR_CheckToken(","))
|
||||||
{
|
{
|
||||||
if (!newparm)
|
if (!newparm)
|
||||||
QCC_PR_ParseError(ERR_NOTANAME, "element missing type");
|
QCC_PR_ParseError(ERR_NOTANAME, "element missing type");
|
||||||
|
@ -2946,17 +2977,17 @@ QCC_type_t *QCC_PR_ParseType (int newtype)
|
||||||
else
|
else
|
||||||
newparm = QCC_PR_ParseType(true);
|
newparm = QCC_PR_ParseType(true);
|
||||||
|
|
||||||
if (!QCC_PR_Check(";"))
|
if (!QCC_PR_CheckToken(";"))
|
||||||
{
|
{
|
||||||
newparm->name = QCC_CopyString(pr_token)+strings;
|
newparm->name = QCC_CopyString(pr_token)+strings;
|
||||||
QCC_PR_Lex();
|
QCC_PR_Lex();
|
||||||
if (QCC_PR_Check("["))
|
if (QCC_PR_CheckToken("["))
|
||||||
{
|
{
|
||||||
newparm->size*=atoi(pr_token);
|
newparm->size*=atoi(pr_token);
|
||||||
QCC_PR_Lex();
|
QCC_PR_Lex();
|
||||||
QCC_PR_Expect("]");
|
QCC_PR_Expect("]");
|
||||||
}
|
}
|
||||||
QCC_PR_Check(";");
|
QCC_PR_CheckToken(";");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
newparm->name = QCC_CopyString("")+strings;
|
newparm->name = QCC_CopyString("")+strings;
|
||||||
|
@ -2972,19 +3003,19 @@ QCC_type_t *QCC_PR_ParseType (int newtype)
|
||||||
}
|
}
|
||||||
return newt;
|
return newt;
|
||||||
}
|
}
|
||||||
if (QCC_PR_Check ("union"))
|
if (QCC_PR_CheckKeyword (keyword_union, "union"))
|
||||||
{
|
{
|
||||||
newt = QCC_PR_NewType("union", ev_union);
|
newt = QCC_PR_NewType("union", ev_union);
|
||||||
newt->size=0;
|
newt->size=0;
|
||||||
QCC_PR_Expect("{");
|
QCC_PR_Expect("{");
|
||||||
|
|
||||||
type = NULL;
|
type = NULL;
|
||||||
if (QCC_PR_Check(","))
|
if (QCC_PR_CheckToken(","))
|
||||||
QCC_PR_ParseError(ERR_NOTANAME, "element missing name");
|
QCC_PR_ParseError(ERR_NOTANAME, "element missing name");
|
||||||
newparm = NULL;
|
newparm = NULL;
|
||||||
while (!QCC_PR_Check("}"))
|
while (!QCC_PR_CheckToken("}"))
|
||||||
{
|
{
|
||||||
if (QCC_PR_Check(","))
|
if (QCC_PR_CheckToken(","))
|
||||||
{
|
{
|
||||||
if (!newparm)
|
if (!newparm)
|
||||||
QCC_PR_ParseError(ERR_NOTANAME, "element missing type");
|
QCC_PR_ParseError(ERR_NOTANAME, "element missing type");
|
||||||
|
@ -2992,7 +3023,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
newparm = QCC_PR_ParseType(true);
|
newparm = QCC_PR_ParseType(true);
|
||||||
if (QCC_PR_Check(";"))
|
if (QCC_PR_CheckToken(";"))
|
||||||
newparm->name = QCC_CopyString("")+strings;
|
newparm->name = QCC_CopyString("")+strings;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3047,7 +3078,7 @@ QCC_type_t *QCC_PR_ParseType (int newtype)
|
||||||
}
|
}
|
||||||
QCC_PR_Lex ();
|
QCC_PR_Lex ();
|
||||||
|
|
||||||
if (QCC_PR_Check ("(")) //this is followed by parameters. Must be a function.
|
if (QCC_PR_CheckToken ("(")) //this is followed by parameters. Must be a function.
|
||||||
return QCC_PR_ParseFunctionType(newtype, type);
|
return QCC_PR_ParseFunctionType(newtype, type);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,11 +32,14 @@ void RunCompiler(char *args);
|
||||||
HINSTANCE ghInstance;
|
HINSTANCE ghInstance;
|
||||||
HMODULE richedit;
|
HMODULE richedit;
|
||||||
|
|
||||||
|
pbool resetprogssrc; //progs.src was changed, reload project info.
|
||||||
|
|
||||||
|
|
||||||
HWND mainwindow;
|
HWND mainwindow;
|
||||||
HWND mdibox;
|
HWND mdibox;
|
||||||
HWND outputwindow;
|
HWND outputwindow;
|
||||||
HWND outputbox;
|
HWND outputbox;
|
||||||
|
HWND projecttree;
|
||||||
|
|
||||||
FILE *logfile;
|
FILE *logfile;
|
||||||
|
|
||||||
|
@ -67,10 +70,12 @@ void GUI_DialogPrint(char *title, char *text)
|
||||||
|
|
||||||
HWND CreateAnEditControl(HWND parent)
|
HWND CreateAnEditControl(HWND parent)
|
||||||
{
|
{
|
||||||
|
HWND newc;
|
||||||
|
|
||||||
if (!richedit)
|
if (!richedit)
|
||||||
richedit = LoadLibrary("RICHED32.DLL");
|
richedit = LoadLibrary("RICHED32.DLL");
|
||||||
|
|
||||||
outputbox=CreateWindowEx(WS_EX_CLIENTEDGE,
|
newc=CreateWindowEx(WS_EX_CLIENTEDGE,
|
||||||
richedit?RICHEDIT_CLASS:"EDIT",
|
richedit?RICHEDIT_CLASS:"EDIT",
|
||||||
"",
|
"",
|
||||||
WS_CHILD /*| ES_READONLY*/ | WS_VISIBLE |
|
WS_CHILD /*| ES_READONLY*/ | WS_VISIBLE |
|
||||||
|
@ -82,8 +87,8 @@ HWND CreateAnEditControl(HWND parent)
|
||||||
ghInstance,
|
ghInstance,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!outputbox)
|
if (!newc)
|
||||||
outputbox=CreateWindowEx(WS_EX_CLIENTEDGE,
|
newc=CreateWindowEx(WS_EX_CLIENTEDGE,
|
||||||
richedit?RICHEDIT_CLASS10A:"EDIT", //fall back to the earlier version
|
richedit?RICHEDIT_CLASS10A:"EDIT", //fall back to the earlier version
|
||||||
"",
|
"",
|
||||||
WS_CHILD /*| ES_READONLY*/ | WS_VISIBLE |
|
WS_CHILD /*| ES_READONLY*/ | WS_VISIBLE |
|
||||||
|
@ -95,11 +100,11 @@ HWND CreateAnEditControl(HWND parent)
|
||||||
ghInstance,
|
ghInstance,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!outputbox)
|
if (!newc)
|
||||||
{ //you've not got RICHEDIT installed properly, I guess
|
{ //you've not got RICHEDIT installed properly, I guess
|
||||||
FreeLibrary(richedit);
|
FreeLibrary(richedit);
|
||||||
richedit = NULL;
|
richedit = NULL;
|
||||||
outputbox=CreateWindowEx(WS_EX_CLIENTEDGE,
|
newc=CreateWindowEx(WS_EX_CLIENTEDGE,
|
||||||
"EDIT",
|
"EDIT",
|
||||||
"",
|
"",
|
||||||
WS_CHILD /*| ES_READONLY*/ | WS_VISIBLE |
|
WS_CHILD /*| ES_READONLY*/ | WS_VISIBLE |
|
||||||
|
@ -112,14 +117,26 @@ HWND CreateAnEditControl(HWND parent)
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (richedit)
|
//go to lucidia console, 10pt
|
||||||
{
|
{
|
||||||
SendMessage(outputbox, EM_EXLIMITTEXT, 0, 1<<20);
|
CHARFORMAT cf;
|
||||||
|
memset(&cf, 0, sizeof(cf));
|
||||||
|
cf.cbSize = sizeof(cf);
|
||||||
|
cf.dwMask = CFM_BOLD | CFM_FACE;// | CFM_SIZE;
|
||||||
|
strcpy(cf.szFaceName, "Lucida Console");
|
||||||
|
cf.yHeight = 5;
|
||||||
|
|
||||||
|
SendMessage(newc, EM_SETCHARFORMAT, SCF_ALL, (WPARAM)&cf);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowWindow(outputbox, SW_SHOW);
|
if (richedit)
|
||||||
|
{
|
||||||
|
SendMessage(newc, EM_EXLIMITTEXT, 0, 1<<20);
|
||||||
|
}
|
||||||
|
|
||||||
return outputbox;
|
ShowWindow(newc, SW_SHOW);
|
||||||
|
|
||||||
|
return newc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -328,6 +345,8 @@ static LONG CALLBACK EditorWndProc(HWND hWnd,UINT message,
|
||||||
}
|
}
|
||||||
goto gdefault;
|
goto gdefault;
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
|
editor->editpane = CreateAnEditControl(hWnd);
|
||||||
|
/*
|
||||||
editor->editpane=CreateWindowEx(WS_EX_CLIENTEDGE,
|
editor->editpane=CreateWindowEx(WS_EX_CLIENTEDGE,
|
||||||
richedit?RICHEDIT_CLASS:"EDIT",
|
richedit?RICHEDIT_CLASS:"EDIT",
|
||||||
"",
|
"",
|
||||||
|
@ -339,7 +358,7 @@ static LONG CALLBACK EditorWndProc(HWND hWnd,UINT message,
|
||||||
NULL,
|
NULL,
|
||||||
ghInstance,
|
ghInstance,
|
||||||
NULL);
|
NULL);
|
||||||
|
*/
|
||||||
if (richedit)
|
if (richedit)
|
||||||
{
|
{
|
||||||
SendMessage(editor->editpane, EM_EXLIMITTEXT, 0, 1<<31);
|
SendMessage(editor->editpane, EM_EXLIMITTEXT, 0, 1<<31);
|
||||||
|
@ -1045,6 +1064,7 @@ static LONG CALLBACK OptionsWndProc(HWND hWnd,UINT message,
|
||||||
SetCurrentDirectory(progssrcdir);
|
SetCurrentDirectory(progssrcdir);
|
||||||
*progssrcdir = '\0';
|
*progssrcdir = '\0';
|
||||||
}
|
}
|
||||||
|
resetprogssrc = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IDI_O_LEVEL0:
|
case IDI_O_LEVEL0:
|
||||||
|
@ -1371,7 +1391,7 @@ void OptionsDialog(void)
|
||||||
|
|
||||||
compiler_flag[i].guiinfo = wnd = CreateWindow("BUTTON",compiler_flag[i].fullname,
|
compiler_flag[i].guiinfo = wnd = CreateWindow("BUTTON",compiler_flag[i].fullname,
|
||||||
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
|
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
|
||||||
x,y,200-16,16,
|
x,y,168,16,
|
||||||
optionsmenu,
|
optionsmenu,
|
||||||
(HMENU)IDI_O_COMPILER_FLAG,
|
(HMENU)IDI_O_COMPILER_FLAG,
|
||||||
ghInstance,
|
ghInstance,
|
||||||
|
@ -1471,8 +1491,13 @@ static LONG CALLBACK MainWndProc(HWND hWnd,UINT message,
|
||||||
mdibox = CreateWindow( "MDICLIENT", (LPCTSTR) NULL,
|
mdibox = CreateWindow( "MDICLIENT", (LPCTSTR) NULL,
|
||||||
WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL,
|
WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL,
|
||||||
0, 0, 320, 200, hWnd, (HMENU) 0xCAC, ghInstance, (LPSTR) &ccs);
|
0, 0, 320, 200, hWnd, (HMENU) 0xCAC, ghInstance, (LPSTR) &ccs);
|
||||||
|
|
||||||
ShowWindow(mdibox, SW_SHOW);
|
ShowWindow(mdibox, SW_SHOW);
|
||||||
|
|
||||||
|
projecttree = CreateWindow(WC_TREEVIEW, (LPCTSTR) NULL,
|
||||||
|
WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL
|
||||||
|
| TVS_HASBUTTONS |TVS_LINESATROOT|TVS_HASLINES,
|
||||||
|
0, 0, 320, 200, hWnd, (HMENU) 0xCAC, ghInstance, (LPSTR) &ccs);
|
||||||
|
ShowWindow(projecttree, SW_SHOW);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1482,6 +1507,12 @@ static LONG CALLBACK MainWndProc(HWND hWnd,UINT message,
|
||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
GetClientRect(mainwindow, &rect);
|
GetClientRect(mainwindow, &rect);
|
||||||
|
if (projecttree)
|
||||||
|
{
|
||||||
|
SetWindowPos(projecttree, NULL, 0, 0, 192, rect.bottom-rect.top - 32, 0);
|
||||||
|
SetWindowPos(mdibox?mdibox:outputbox, NULL, 192, 0, rect.right-rect.left-192, rect.bottom-rect.top - 32, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
SetWindowPos(mdibox?mdibox:outputbox, NULL, 0, 0, rect.right-rect.left, rect.bottom-rect.top - 32, 0);
|
SetWindowPos(mdibox?mdibox:outputbox, NULL, 0, 0, rect.right-rect.left, rect.bottom-rect.top - 32, 0);
|
||||||
width = (rect.right-rect.left);
|
width = (rect.right-rect.left);
|
||||||
width/=NUMBUTTONS;
|
width/=NUMBUTTONS;
|
||||||
|
@ -1521,6 +1552,34 @@ static LONG CALLBACK MainWndProc(HWND hWnd,UINT message,
|
||||||
GenericMenu(wParam);
|
GenericMenu(wParam);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case WM_NOTIFY:
|
||||||
|
{
|
||||||
|
NMHDR *nm;
|
||||||
|
HANDLE item;
|
||||||
|
TVITEM i;
|
||||||
|
char filename[256];
|
||||||
|
char itemtext[256];
|
||||||
|
nm = lParam;
|
||||||
|
if (nm->hwndFrom == projecttree)
|
||||||
|
{
|
||||||
|
switch(nm->code)
|
||||||
|
{
|
||||||
|
case NM_CLICK:
|
||||||
|
item = TreeView_GetSelection(projecttree);
|
||||||
|
i.hItem = item;
|
||||||
|
i.mask = TVIF_TEXT;
|
||||||
|
i.pszText = itemtext;
|
||||||
|
i.cchTextMax = sizeof(itemtext)-1;
|
||||||
|
TreeView_GetItem(projecttree, &i);
|
||||||
|
while(i.hItem)
|
||||||
|
{
|
||||||
|
item = TreeView_GetParent(projecttree, item);
|
||||||
|
}
|
||||||
|
EditFile(filename, -1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
if (mdibox)
|
if (mdibox)
|
||||||
return DefFrameProc(hWnd,mdibox,message,wParam,lParam);
|
return DefFrameProc(hWnd,mdibox,message,wParam,lParam);
|
||||||
|
@ -1771,6 +1830,92 @@ void CreateOutputWindow(void)
|
||||||
SendMessage(mdibox, WM_MDIACTIVATE, (WPARAM)outputwindow, 0);
|
SendMessage(mdibox, WM_MDIACTIVATE, (WPARAM)outputwindow, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//progssrcname should already have been set.
|
||||||
|
void SetProgsSrc(void)
|
||||||
|
{
|
||||||
|
FILE *f;
|
||||||
|
|
||||||
|
HANDLE rootitem, pi;
|
||||||
|
TVINSERTSTRUCT item;
|
||||||
|
TV_ITEM parent;
|
||||||
|
char parentstring[256];
|
||||||
|
memset(&item, 0, sizeof(item));
|
||||||
|
memset(&parent, 0, sizeof(parent));
|
||||||
|
|
||||||
|
if (projecttree)
|
||||||
|
{
|
||||||
|
int size;
|
||||||
|
char *buffer;
|
||||||
|
char *slash;
|
||||||
|
|
||||||
|
f = fopen (progssrcname, "rb");
|
||||||
|
if (!f)
|
||||||
|
return;
|
||||||
|
fseek(f, 0, SEEK_END);
|
||||||
|
size = ftell(f);
|
||||||
|
fseek(f, 0, SEEK_SET);
|
||||||
|
buffer = malloc(size+1);
|
||||||
|
if (!buffer)
|
||||||
|
{
|
||||||
|
fclose(f);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
buffer[size] = '\0';
|
||||||
|
fread(buffer, 1, size, f);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
pr_file_p = QCC_COM_Parse(buffer);
|
||||||
|
if (*qcc_token == '#')
|
||||||
|
{
|
||||||
|
free(buffer); //aaaahhh! newstyle!
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pr_file_p = QCC_COM_Parse(pr_file_p); //we dont care about the produced progs.dat
|
||||||
|
|
||||||
|
|
||||||
|
item.hParent = TVI_ROOT;
|
||||||
|
item.hInsertAfter = TVI_SORT;
|
||||||
|
item.item.pszText = progssrcname;
|
||||||
|
item.item.mask = TVIF_TEXT;
|
||||||
|
rootitem = (HANDLE)SendMessage(projecttree,TVM_INSERTITEM,0,(LPARAM)&item);
|
||||||
|
while(pr_file_p)
|
||||||
|
{
|
||||||
|
pi = item.hParent = rootitem;
|
||||||
|
item.item.pszText = qcc_token;
|
||||||
|
while(slash = strchr(item.item.pszText, '/'))
|
||||||
|
{
|
||||||
|
*slash = '\0';
|
||||||
|
item.hParent = TreeView_GetChild(projecttree, item.hParent);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
parent.hItem = item.hParent;
|
||||||
|
parent.mask = TVIF_TEXT;
|
||||||
|
parent.pszText = parentstring;
|
||||||
|
parent.cchTextMax = sizeof(parentstring)-1;
|
||||||
|
if (TreeView_GetItem(projecttree, &parent))
|
||||||
|
{
|
||||||
|
if (!stricmp(parent.pszText, item.item.pszText))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while(item.hParent=TreeView_GetNextSibling(projecttree, item.hParent));
|
||||||
|
if (!item.hParent)
|
||||||
|
{ //add a directory.
|
||||||
|
item.hParent = pi;
|
||||||
|
pi = (HANDLE)SendMessage(projecttree,TVM_INSERTITEM,0,(LPARAM)&item);
|
||||||
|
}
|
||||||
|
else pi = item.hParent;
|
||||||
|
|
||||||
|
item.item.pszText = slash+1;
|
||||||
|
}
|
||||||
|
SendMessage(projecttree,TVM_INSERTITEM,0,(LPARAM)&item);
|
||||||
|
pr_file_p = QCC_COM_Parse(pr_file_p);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -1863,6 +2008,8 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetprogssrc = true;
|
||||||
|
|
||||||
wndclass.style = 0;
|
wndclass.style = 0;
|
||||||
wndclass.lpfnWndProc = (WNDPROC)MainWndProc;
|
wndclass.lpfnWndProc = (WNDPROC)MainWndProc;
|
||||||
wndclass.cbClsExtra = 0;
|
wndclass.cbClsExtra = 0;
|
||||||
|
@ -1948,6 +2095,12 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
||||||
{
|
{
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
|
||||||
|
if (resetprogssrc)
|
||||||
|
{ //this here, with the compiler below, means that we don't run recursivly.
|
||||||
|
resetprogssrc = false;
|
||||||
|
SetProgsSrc();
|
||||||
|
}
|
||||||
|
|
||||||
EditorsRun();
|
EditorsRun();
|
||||||
|
|
||||||
while (PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE))
|
while (PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE))
|
||||||
|
|
|
@ -178,26 +178,35 @@ optimisations_t optimisations[] =
|
||||||
|
|
||||||
compiler_flag_t compiler_flag[] = {
|
compiler_flag_t compiler_flag[] = {
|
||||||
//keywords
|
//keywords
|
||||||
{&keyword_var, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "var", "Keyword: var", "Disables the 'var' keyword."},
|
|
||||||
{&keyword_thinktime, FLAG_HIDDENINGUI|0, "thinktime", "Keyword: thinktime", "Disables the 'thinktime' keyword."},
|
|
||||||
{&keyword_switch, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "switch", "Keyword: switch", "Disables the 'switch' keyword."},
|
|
||||||
{&keyword_for, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "for", "Keyword: for", "Disables the 'for' keyword."},
|
|
||||||
{&keyword_case, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "case", "Keyword: case", "Disables the 'case' keyword."},
|
|
||||||
{&keyword_default, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "default", "Keyword: default", "Disables the 'default' keyword."},
|
|
||||||
{&keyword_do, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "do", "Keyword: do", "Disables the 'do' keyword."},
|
|
||||||
{&keyword_asm, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "asm", "Keyword: asm", "Disables the 'asm' keyword."},
|
{&keyword_asm, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "asm", "Keyword: asm", "Disables the 'asm' keyword."},
|
||||||
{&keyword_goto, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "goto", "Keyword: goto", "Disables the 'goto' keyword."},
|
|
||||||
{&keyword_break, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "break", "Keyword: break", "Disables the 'break' keyword."},
|
{&keyword_break, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "break", "Keyword: break", "Disables the 'break' keyword."},
|
||||||
|
{&keyword_case, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "case", "Keyword: case", "Disables the 'case' keyword."},
|
||||||
|
{&keyword_class, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "class", "Keyword: class", "Disables the 'class' keyword."},
|
||||||
|
{&keyword_const, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "const", "Keyword: const", "Disables the 'const' keyword."},
|
||||||
{&keyword_continue, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "continue", "Keyword: continue", "Disables the 'continue' keyword."},
|
{&keyword_continue, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "continue", "Keyword: continue", "Disables the 'continue' keyword."},
|
||||||
|
{&keyword_default, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "default", "Keyword: default", "Disables the 'default' keyword."},
|
||||||
|
{&keyword_entity, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "entity", "Keyword: entity", "Disables the 'entity' keyword."},
|
||||||
|
{&keyword_enum, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "enum", "Keyword: enum", "Disables the 'enum' keyword."}, //kinda like in c, but typedef not supported.
|
||||||
|
{&keyword_enumflags, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "enumflags", "Keyword: enumflags", "Disables the 'enumflags' keyword."}, //like enum, but doubles instead of adds 1.
|
||||||
|
{&keyword_extern, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "extern", "Keyword: extern", "Disables the 'extern' keyword."}, //function is external, don't error or warn if the body was not found
|
||||||
|
{&keyword_float, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "float", "Keyword: float", "Disables the 'float' keyword."},
|
||||||
|
{&keyword_for, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "for", "Keyword: for", "Disables the 'for' keyword."},
|
||||||
|
{&keyword_goto, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "goto", "Keyword: goto", "Disables the 'goto' keyword."},
|
||||||
|
{&keyword_int, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "int", "Keyword: int", "Disables the 'int' keyword."},
|
||||||
|
{&keyword_integer, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "integer", "Keyword: integer", "Disables the 'integer' keyword."},
|
||||||
|
{&keyword_noref, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "noref", "Keyword: noref", "Disables the 'noref' keyword."}, //nowhere else references this, don't strip it.
|
||||||
|
{&keyword_nosave, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "nosave", "Keyword: nosave", "Disables the 'nosave' keyword."}, //don't write the def to the output.
|
||||||
|
{&keyword_shared, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "shared", "Keyword: shared", "Disables the 'shared' keyword."}, //mark global to be copied over when progs changes (part of FTE_MULTIPROGS)
|
||||||
{&keyword_state, FLAG_HIDDENINGUI|0, "state", "Keyword: state", "Disables the 'state' keyword."},
|
{&keyword_state, FLAG_HIDDENINGUI|0, "state", "Keyword: state", "Disables the 'state' keyword."},
|
||||||
{&keyword_string, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "string", "Keyword: string", "Disables the 'string' keyword."},
|
{&keyword_string, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "string", "Keyword: string", "Disables the 'string' keyword."},
|
||||||
{&keyword_float, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "float", "Keyword: float", "Disables the 'float' keyword."},
|
{&keyword_struct, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "struct", "Keyword: struct", "Disables the 'struct' keyword."},
|
||||||
{&keyword_entity, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "entity", "Keyword: entity", "Disables the 'entity' keyword."},
|
{&keyword_switch, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "switch", "Keyword: switch", "Disables the 'switch' keyword."},
|
||||||
|
{&keyword_thinktime, FLAG_HIDDENINGUI|0, "thinktime", "Keyword: thinktime", "Disables the 'thinktime' keyword."},
|
||||||
|
{&keyword_typedef, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "typedef", "Keyword: typedef", "Disables the 'typedef' keyword."}, //fixme
|
||||||
|
{&keyword_union, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "union", "Keyword: union", "Disables the 'union' keyword."}, //you surly know what a union is!
|
||||||
|
{&keyword_var, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "var", "Keyword: var", "Disables the 'var' keyword."},
|
||||||
{&keyword_vector, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "vector", "Keyword: vector", "Disables the 'vector' keyword."},
|
{&keyword_vector, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "vector", "Keyword: vector", "Disables the 'vector' keyword."},
|
||||||
{&keyword_const, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "const", "Keyword: const", "Disables the 'const' keyword."},
|
|
||||||
{&keyword_integer, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "integer", "Keyword: integer", "Disables the 'integer' keyword."},
|
|
||||||
{&keyword_int, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "int", "Keyword: int", "Disables the 'int' keyword."},
|
|
||||||
{&keyword_class, FLAG_HIDDENINGUI|FLAG_ASDEFAULT, "class", "Keyword: class", "Disables the 'class' keyword."},
|
|
||||||
|
|
||||||
//options
|
//options
|
||||||
{&keywords_coexist, FLAG_ASDEFAULT, "kce", "Keywords Coexist", "If you want keywords to NOT be disabled when they a variable by the same name is defined, check here."},
|
{&keywords_coexist, FLAG_ASDEFAULT, "kce", "Keywords Coexist", "If you want keywords to NOT be disabled when they a variable by the same name is defined, check here."},
|
||||||
|
@ -2479,7 +2488,7 @@ void QCC_SetDefaultProperties (void)
|
||||||
QCC_PR_CommandLinePrecompilerOptions();
|
QCC_PR_CommandLinePrecompilerOptions();
|
||||||
|
|
||||||
|
|
||||||
if (qcc_targetformat == QCF_HEXEN2)
|
if (qcc_targetformat == QCF_HEXEN2) //force on the thinktime keyword if hexen2 progs.
|
||||||
keyword_thinktime = true;
|
keyword_thinktime = true;
|
||||||
|
|
||||||
if (QCC_CheckParm("/Debug")) //disable any debug optimisations
|
if (QCC_CheckParm("/Debug")) //disable any debug optimisations
|
||||||
|
@ -2830,13 +2839,6 @@ memset(pr_immediate_string, 0, sizeof(pr_immediate_string));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newstylesource = false;
|
|
||||||
|
|
||||||
while(*qccmsrc && *qccmsrc < ' ')
|
|
||||||
qccmsrc++;
|
|
||||||
|
|
||||||
pr_file_p = QCC_COM_Parse(qccmsrc);
|
|
||||||
|
|
||||||
#ifdef WRITEASM
|
#ifdef WRITEASM
|
||||||
if (writeasm)
|
if (writeasm)
|
||||||
{
|
{
|
||||||
|
@ -2846,6 +2848,11 @@ memset(pr_immediate_string, 0, sizeof(pr_immediate_string));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
newstylesource = false;
|
||||||
|
while(*qccmsrc && *qccmsrc < ' ')
|
||||||
|
qccmsrc++;
|
||||||
|
pr_file_p = QCC_COM_Parse(qccmsrc);
|
||||||
|
|
||||||
if (QCC_CheckParm ("-qc"))
|
if (QCC_CheckParm ("-qc"))
|
||||||
{
|
{
|
||||||
strcpy(destfile, qccmprogsdat);
|
strcpy(destfile, qccmprogsdat);
|
||||||
|
|
|
@ -7857,7 +7857,7 @@ void PF_runclientphys(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||||
// AddLinksToPmove ( sv_areanodes );
|
// AddLinksToPmove ( sv_areanodes );
|
||||||
|
|
||||||
|
|
||||||
PM_PlayerMove();
|
PM_PlayerMove(sv.gamespeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
|
BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
|
||||||
|
|
|
@ -102,6 +102,9 @@ typedef struct
|
||||||
qboolean active; // false when server is going down
|
qboolean active; // false when server is going down
|
||||||
server_state_t state; // precache commands are only valid during load
|
server_state_t state; // precache commands are only valid during load
|
||||||
|
|
||||||
|
float gamespeed; //time progression multiplier, fixed per-level.
|
||||||
|
qboolean csqcdebug;
|
||||||
|
|
||||||
double time;
|
double time;
|
||||||
int framenum;
|
int framenum;
|
||||||
|
|
||||||
|
@ -118,15 +121,23 @@ typedef struct
|
||||||
char mapname[256];
|
char mapname[256];
|
||||||
char modelname[MAX_QPATH]; // maps/<name>.bsp, for model_precache[0]
|
char modelname[MAX_QPATH]; // maps/<name>.bsp, for model_precache[0]
|
||||||
struct model_s *worldmodel;
|
struct model_s *worldmodel;
|
||||||
|
|
||||||
|
union {
|
||||||
|
#ifdef Q2SERVER
|
||||||
|
struct {
|
||||||
|
char configstring[Q2MAX_CONFIGSTRINGS][MAX_QPATH];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
struct {
|
||||||
char model_precache[MAX_MODELS][MAX_QPATH]; // NULL terminated
|
char model_precache[MAX_MODELS][MAX_QPATH]; // NULL terminated
|
||||||
char sound_precache[MAX_SOUNDS][MAX_QPATH]; // NULL terminated
|
char sound_precache[MAX_SOUNDS][MAX_QPATH]; // NULL terminated
|
||||||
char image_precache[Q2MAX_IMAGES][MAX_QPATH];
|
char image_precache[Q2MAX_IMAGES][MAX_QPATH];
|
||||||
char *lightstyles[MAX_LIGHTSTYLES];
|
char *lightstyles[MAX_LIGHTSTYLES];
|
||||||
char lightstylecolours[MAX_LIGHTSTYLES];
|
char lightstylecolours[MAX_LIGHTSTYLES];
|
||||||
|
};
|
||||||
|
};
|
||||||
struct model_s *models[MAX_MODELS];
|
struct model_s *models[MAX_MODELS];
|
||||||
|
|
||||||
char *statusbar; //part of the config strings - q2 has a progs specified sbar.
|
|
||||||
|
|
||||||
int allocated_client_slots; //number of slots available. (used mostly to stop single player saved games cacking up)
|
int allocated_client_slots; //number of slots available. (used mostly to stop single player saved games cacking up)
|
||||||
int max_edicts; //limiting factor... 1024 fields*4*MAX_EDICTS == a heck of a lot.
|
int max_edicts; //limiting factor... 1024 fields*4*MAX_EDICTS == a heck of a lot.
|
||||||
int num_edicts; // increases towards MAX_EDICTS
|
int num_edicts; // increases towards MAX_EDICTS
|
||||||
|
|
|
@ -347,6 +347,12 @@ void SV_EmitCSQCUpdate(client_t *client, sizebuf_t *msg)
|
||||||
MSG_WriteByte(msg, svc_csqcentities);
|
MSG_WriteByte(msg, svc_csqcentities);
|
||||||
}
|
}
|
||||||
MSG_WriteShort(msg, ent->entnum);
|
MSG_WriteShort(msg, ent->entnum);
|
||||||
|
if (sv.csqcdebug) //optional extra.
|
||||||
|
{
|
||||||
|
if (!csqcmsgbuffer.cursize)
|
||||||
|
Con_Printf("Warning: empty csqc packet on %s\n", svprogfuncs->stringtable+ent->v.classname);
|
||||||
|
MSG_WriteShort(msg, csqcmsgbuffer.cursize);
|
||||||
|
}
|
||||||
//FIXME: Add a developer mode to write the length of each entity.
|
//FIXME: Add a developer mode to write the length of each entity.
|
||||||
SZ_Write(msg, csqcmsgbuffer.data, csqcmsgbuffer.cursize);
|
SZ_Write(msg, csqcmsgbuffer.data, csqcmsgbuffer.cursize);
|
||||||
|
|
||||||
|
@ -2141,6 +2147,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
|
||||||
|
|
||||||
if (!ignorepvs)
|
if (!ignorepvs)
|
||||||
{
|
{
|
||||||
|
//branch out to the pvs testing.
|
||||||
if (ent->tagent)
|
if (ent->tagent)
|
||||||
{
|
{
|
||||||
edict_t *p = ent;
|
edict_t *p = ent;
|
||||||
|
@ -2157,54 +2164,6 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
|
||||||
if (!sv.worldmodel->funcs.EdictInFatPVS(ent))
|
if (!sv.worldmodel->funcs.EdictInFatPVS(ent))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
#ifdef Q2BSPS
|
|
||||||
if (sv.worldmodel->fromgame == fg_quake2 || sv.worldmodel->fromgame == fg_quake3)
|
|
||||||
{//quake2 vising logic
|
|
||||||
// check area
|
|
||||||
if (!CM_AreasConnected (clientarea, ent->areanum))
|
|
||||||
{ // doors can legally straddle two areas, so
|
|
||||||
// we may need to check another one
|
|
||||||
if (!ent->areanum2
|
|
||||||
|| !CM_AreasConnected (clientarea, ent->areanum2))
|
|
||||||
continue; // blocked by a door
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ent->num_leafs == -1)
|
|
||||||
{ // too many leafs for individual check, go by headnode
|
|
||||||
if (!CM_HeadnodeVisible (ent->headnode, fatpvs))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // check individual leafs
|
|
||||||
for (i=0 ; i < ent->num_leafs ; i++)
|
|
||||||
{
|
|
||||||
l = ent->leafnums[i];
|
|
||||||
if (fatpvs[l >> 3] & (1 << (l&7) ))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i == ent->num_leafs)
|
|
||||||
continue; // not visible
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if (sv.worldmodel->fromgame == fg_doom)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{//quake1 vising logic
|
|
||||||
// ignore if not touching a PV leaf
|
|
||||||
for (i=0 ; i < ent->num_leafs ; i++)
|
|
||||||
if (pvs[ent->leafnums[i] >> 3] & (1 << (ent->leafnums[i]&7) ))
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (i == ent->num_leafs) // not visible
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
extern int total_loading_size, current_loading_size, loading_stage;
|
extern int total_loading_size, current_loading_size, loading_stage;
|
||||||
char *T_GetString(int num);
|
char *T_GetString(int num);
|
||||||
|
|
||||||
#define Q2EDICT_NUM(i) (q2edict_t*)((char *)ge->edicts+i*ge->edict_size)
|
#define Q2EDICT_NUM(i) (q2edict_t*)((char *)ge->edicts+(i)*ge->edict_size)
|
||||||
|
|
||||||
server_static_t svs; // persistant server info
|
server_static_t svs; // persistant server info
|
||||||
server_t sv; // local server
|
server_t sv; // local server
|
||||||
|
@ -35,6 +35,8 @@ char localinfo[MAX_LOCALINFO_STRING+1]; // local game info
|
||||||
extern cvar_t skill, sv_loadentfiles;
|
extern cvar_t skill, sv_loadentfiles;
|
||||||
extern cvar_t sv_cheats;
|
extern cvar_t sv_cheats;
|
||||||
extern cvar_t sv_bigcoords;
|
extern cvar_t sv_bigcoords;
|
||||||
|
extern cvar_t sv_gamespeed;
|
||||||
|
extern cvar_t sv_csqcdebug;
|
||||||
extern qboolean sv_allow_cheats;
|
extern qboolean sv_allow_cheats;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -671,21 +673,6 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
||||||
//
|
//
|
||||||
SV_ClearWorld ();
|
SV_ClearWorld ();
|
||||||
|
|
||||||
strcpy(sv.sound_precache[0], "");
|
|
||||||
strcpy(sv.model_precache[0], "");
|
|
||||||
|
|
||||||
strcpy(sv.model_precache[1], sv.modelname);
|
|
||||||
sv.models[1] = sv.worldmodel;
|
|
||||||
for (i=1 ; i<sv.worldmodel->numsubmodels ; i++)
|
|
||||||
{
|
|
||||||
strcpy(sv.model_precache[1+i], localmodels[i]);
|
|
||||||
sv.models[i+1] = Mod_ForName (localmodels[i], false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//check player/eyes models for hacks
|
|
||||||
sv.model_player_checksum = SV_CheckModel("progs/player.mdl");
|
|
||||||
sv.eyes_player_checksum = SV_CheckModel("progs/eyes.mdl");
|
|
||||||
|
|
||||||
if (sv_cheats.value)
|
if (sv_cheats.value)
|
||||||
{
|
{
|
||||||
sv_allow_cheats = true;
|
sv_allow_cheats = true;
|
||||||
|
@ -697,6 +684,15 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
||||||
Info_SetValueForStarKey(svs.info, "*cheats", "", MAX_SERVERINFO_STRING);
|
Info_SetValueForStarKey(svs.info, "*cheats", "", MAX_SERVERINFO_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sv.gamespeed = sv_gamespeed.value;
|
||||||
|
Info_SetValueForStarKey(svs.info, "*gamespeed", va("%i", (int)(sv.gamespeed*100)), MAX_SERVERINFO_STRING);
|
||||||
|
sv.gamespeed = atof(Info_ValueForKey(svs.info, "*gamespeed"))/100;
|
||||||
|
if (sv.gamespeed < 0.1 || sv.gamespeed == 1)
|
||||||
|
{
|
||||||
|
sv.gamespeed = 1;
|
||||||
|
Info_SetValueForStarKey(svs.info, "*gamespeed", "", MAX_SERVERINFO_STRING);
|
||||||
|
}
|
||||||
|
|
||||||
//do we allow csprogs?
|
//do we allow csprogs?
|
||||||
#ifdef PEXT_CSQC
|
#ifdef PEXT_CSQC
|
||||||
file = COM_LoadTempFile("csprogs.dat");
|
file = COM_LoadTempFile("csprogs.dat");
|
||||||
|
@ -708,7 +704,18 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Info_SetValueForStarKey(svs.info, "*csprogs", "", MAX_SERVERINFO_STRING);
|
Info_SetValueForStarKey(svs.info, "*csprogs", "", MAX_SERVERINFO_STRING);
|
||||||
|
|
||||||
|
sv.csqcdebug = sv_csqcdebug.value;
|
||||||
|
if (sv.csqcdebug)
|
||||||
|
Info_SetValueForStarKey(svs.info, "*csqcdebug", "1", MAX_SERVERINFO_STRING);
|
||||||
|
else
|
||||||
|
Info_RemoveKey(svs.info, "*csqcdebug");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (svprogfuncs) //we don't want the q1 stuff anymore.
|
if (svprogfuncs) //we don't want the q1 stuff anymore.
|
||||||
{
|
{
|
||||||
CloseProgs(svprogfuncs);
|
CloseProgs(svprogfuncs);
|
||||||
|
@ -755,6 +762,36 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sv.models[1] = sv.worldmodel;
|
||||||
|
if (svs.gametype == GT_PROGS)
|
||||||
|
{
|
||||||
|
strcpy(sv.sound_precache[0], "");
|
||||||
|
strcpy(sv.model_precache[0], "");
|
||||||
|
|
||||||
|
strcpy(sv.model_precache[1], sv.modelname);
|
||||||
|
for (i=1 ; i<sv.worldmodel->numsubmodels ; i++)
|
||||||
|
{
|
||||||
|
strcpy(sv.model_precache[1+i], localmodels[i]);
|
||||||
|
sv.models[i+1] = Mod_ForName (localmodels[i], false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//check player/eyes models for hacks
|
||||||
|
sv.model_player_checksum = SV_CheckModel("progs/player.mdl");
|
||||||
|
sv.eyes_player_checksum = SV_CheckModel("progs/eyes.mdl");
|
||||||
|
}
|
||||||
|
else if (svs.gametype == GT_QUAKE2)
|
||||||
|
{
|
||||||
|
memset(sv.configstring, 0, sizeof(sv.configstring));
|
||||||
|
strcpy(sv.configstring[Q2CS_MODELS+1], sv.modelname);
|
||||||
|
for (i=1; i<sv.worldmodel->numsubmodels; i++)
|
||||||
|
{
|
||||||
|
strcpy(sv.configstring[Q2CS_MODELS+1+i], localmodels[i]);
|
||||||
|
sv.models[i+1] = Mod_ForName (localmodels[i], false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef SERVERONLY
|
#ifndef SERVERONLY
|
||||||
current_loading_size+=10;
|
current_loading_size+=10;
|
||||||
SCR_BeginLoadingPlaque();
|
SCR_BeginLoadingPlaque();
|
||||||
|
|
|
@ -93,6 +93,8 @@ cvar_t sv_master = {"sv_master", "0"};
|
||||||
cvar_t sv_masterport = {"sv_masterport", "0"};
|
cvar_t sv_masterport = {"sv_masterport", "0"};
|
||||||
|
|
||||||
cvar_t sv_voicechat = {"sv_voicechat", "0"}; //still development.
|
cvar_t sv_voicechat = {"sv_voicechat", "0"}; //still development.
|
||||||
|
cvar_t sv_gamespeed = {"sv_gamespeed", "1"};
|
||||||
|
cvar_t sv_csqcdebug = {"sv_csqcdebug", "0"};
|
||||||
|
|
||||||
cvar_t pausable = {"pausable", "1"};
|
cvar_t pausable = {"pausable", "1"};
|
||||||
|
|
||||||
|
@ -331,7 +333,10 @@ void SV_DropClient (client_t *drop)
|
||||||
#ifdef SVCHAT
|
#ifdef SVCHAT
|
||||||
SV_WipeChat(drop);
|
SV_WipeChat(drop);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef Q2SERVER
|
||||||
|
if (ge)
|
||||||
|
ge->ClientDisconnect(drop->q2edict);
|
||||||
|
#endif
|
||||||
if (svprogfuncs)
|
if (svprogfuncs)
|
||||||
{
|
{
|
||||||
if (drop->state == cs_spawned)
|
if (drop->state == cs_spawned)
|
||||||
|
@ -356,10 +361,6 @@ void SV_DropClient (client_t *drop)
|
||||||
Z_Free(drop->spawninfo);
|
Z_Free(drop->spawninfo);
|
||||||
drop->spawninfo = NULL;
|
drop->spawninfo = NULL;
|
||||||
}
|
}
|
||||||
#ifdef Q2SERVER
|
|
||||||
else if (ge && drop->q2edict) //could be in sv_spawnserver.
|
|
||||||
ge->ClientDisconnect(drop->q2edict);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (drop->spectator)
|
if (drop->spectator)
|
||||||
Con_Printf ("Spectator %s removed\n",drop->name);
|
Con_Printf ("Spectator %s removed\n",drop->name);
|
||||||
|
@ -1472,7 +1473,7 @@ void SVC_DirectConnect
|
||||||
if (!ge->ClientConnect(q2ent, temp.userinfo))
|
if (!ge->ClientConnect(q2ent, temp.userinfo))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ge->ClientUserinfoChanged(q2ent, temp.userinfo);
|
||||||
|
|
||||||
// build a new connection
|
// build a new connection
|
||||||
// accept the new client
|
// accept the new client
|
||||||
|
@ -2615,7 +2616,7 @@ void SV_GetConsoleCommands (void)
|
||||||
int SV_RateForClient(client_t *cl)
|
int SV_RateForClient(client_t *cl)
|
||||||
{
|
{
|
||||||
int rate;
|
int rate;
|
||||||
if (cl->download)
|
if (cl->download && cl->drate)
|
||||||
{
|
{
|
||||||
rate = cl->drate;
|
rate = cl->drate;
|
||||||
if (rate > sv_maxdrate.value)
|
if (rate > sv_maxdrate.value)
|
||||||
|
@ -2755,12 +2756,17 @@ void SV_Frame (float time)
|
||||||
// keep the random time dependent
|
// keep the random time dependent
|
||||||
rand ();
|
rand ();
|
||||||
|
|
||||||
|
if (!sv.gamespeed)
|
||||||
|
sv.gamespeed = 1;
|
||||||
|
|
||||||
// decide the simulation time
|
// decide the simulation time
|
||||||
if (!sv.paused) {
|
if (!sv.paused) {
|
||||||
#ifndef SERVERONLY
|
#ifndef SERVERONLY
|
||||||
if (isDedicated)
|
if (isDedicated)
|
||||||
#endif
|
#endif
|
||||||
realtime += time;
|
realtime += time;
|
||||||
|
|
||||||
|
time *= sv.gamespeed;
|
||||||
sv.time += time;
|
sv.time += time;
|
||||||
}
|
}
|
||||||
#ifdef IWEB_H__
|
#ifdef IWEB_H__
|
||||||
|
@ -3006,6 +3012,9 @@ void SV_InitLocal (void)
|
||||||
|
|
||||||
Cvar_Register (&sv_phs, cvargroup_servercontrol);
|
Cvar_Register (&sv_phs, cvargroup_servercontrol);
|
||||||
|
|
||||||
|
Cvar_Register (&sv_csqcdebug, cvargroup_servercontrol);
|
||||||
|
|
||||||
|
Cvar_Register (&sv_gamespeed, cvargroup_serverphysics);
|
||||||
Cvar_Register (&sv_nomsec, cvargroup_serverphysics);
|
Cvar_Register (&sv_nomsec, cvargroup_serverphysics);
|
||||||
Cvar_Register (&pr_allowbutton1, cvargroup_servercontrol);
|
Cvar_Register (&pr_allowbutton1, cvargroup_servercontrol);
|
||||||
|
|
||||||
|
@ -3414,7 +3423,7 @@ void SV_ExtractFromUserinfo (client_t *cl)
|
||||||
if (strlen(val))
|
if (strlen(val))
|
||||||
cl->drate = atoi(val);
|
cl->drate = atoi(val);
|
||||||
else
|
else
|
||||||
cl->drate = cl->rate;
|
cl->drate = 0; //0 disables the downloading check
|
||||||
|
|
||||||
// msg command
|
// msg command
|
||||||
val = Info_ValueForKey (cl->userinfo, "msg");
|
val = Info_ValueForKey (cl->userinfo, "msg");
|
||||||
|
|
|
@ -325,6 +325,7 @@ void SVQ2_ConfigStrings_f (void)
|
||||||
{
|
{
|
||||||
extern int map_checksum;
|
extern int map_checksum;
|
||||||
int start;
|
int start;
|
||||||
|
char *str;
|
||||||
|
|
||||||
Con_DPrintf ("Configstrings() from %s\n", host_client->name);
|
Con_DPrintf ("Configstrings() from %s\n", host_client->name);
|
||||||
|
|
||||||
|
@ -356,18 +357,21 @@ void SVQ2_ConfigStrings_f (void)
|
||||||
while ( host_client->netchan.message.cursize < MAX_QWMSGLEN/2
|
while ( host_client->netchan.message.cursize < MAX_QWMSGLEN/2
|
||||||
&& start < Q2MAX_CONFIGSTRINGS)
|
&& start < Q2MAX_CONFIGSTRINGS)
|
||||||
{
|
{
|
||||||
|
str = sv.configstring[start];
|
||||||
|
if (*str)
|
||||||
|
{
|
||||||
|
MSG_WriteByte (&host_client->netchan.message, svcq2_configstring);
|
||||||
|
MSG_WriteShort (&host_client->netchan.message, start);
|
||||||
|
MSG_WriteString (&host_client->netchan.message, str);
|
||||||
|
}
|
||||||
|
/*
|
||||||
//choose range to grab from.
|
//choose range to grab from.
|
||||||
if (start < Q2CS_CDTRACK)
|
if (start < Q2CS_CDTRACK)
|
||||||
{
|
{
|
||||||
MSG_WriteByte (&host_client->netchan.message, svcq2_configstring);
|
MSG_WriteByte (&host_client->netchan.message, svcq2_configstring);
|
||||||
MSG_WriteShort (&host_client->netchan.message, start);
|
MSG_WriteShort (&host_client->netchan.message, start);
|
||||||
MSG_WriteString (&host_client->netchan.message, sv.name);
|
MSG_WriteString (&host_client->netchan.message, sv.name);
|
||||||
/* if (svprogfuncs)
|
}
|
||||||
MSG_WriteString (&host_client->netchan.message, va("%s", PR_GetString(svprogfuncs, sv.edicts->v.message)));
|
|
||||||
else
|
|
||||||
MSG_WriteString (&host_client->netchan.message, "LEVEL NAME");
|
|
||||||
*/ }
|
|
||||||
else if (start < Q2CS_SKY)
|
else if (start < Q2CS_SKY)
|
||||||
{
|
{
|
||||||
MSG_WriteByte (&host_client->netchan.message, svcq2_configstring);
|
MSG_WriteByte (&host_client->netchan.message, svcq2_configstring);
|
||||||
|
@ -476,6 +480,7 @@ void SVQ2_ConfigStrings_f (void)
|
||||||
// MSG_WriteShort (&host_client->netchan.message, start);
|
// MSG_WriteShort (&host_client->netchan.message, start);
|
||||||
// MSG_WriteString (&host_client->netchan.message, sv.configstrings[start]);
|
// MSG_WriteString (&host_client->netchan.message, sv.configstrings[start]);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
start++;
|
start++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2138,24 +2143,15 @@ Change the bandwidth estimate for a client
|
||||||
*/
|
*/
|
||||||
void SV_Rate_f (void)
|
void SV_Rate_f (void)
|
||||||
{
|
{
|
||||||
extern cvar_t sv_maxrate;
|
|
||||||
int rate;
|
|
||||||
|
|
||||||
if (Cmd_Argc() != 2)
|
if (Cmd_Argc() != 2)
|
||||||
{
|
{
|
||||||
SV_ClientTPrintf (host_client, PRINT_HIGH, STL_CURRENTRATE,
|
SV_ClientPrintf (host_client, PRINT_HIGH, "Effective rate %i\n", SV_RateForClient(host_client));
|
||||||
host_client->rate);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rate = atoi(Cmd_Argv(1));
|
host_client->rate = atoi(Cmd_Argv(1));
|
||||||
if (rate < 500)
|
|
||||||
rate = 500;
|
|
||||||
if (rate > sv_maxrate.value)
|
|
||||||
rate = sv_maxrate.value;
|
|
||||||
|
|
||||||
SV_ClientTPrintf (host_client, PRINT_HIGH, STL_RATESETTO, rate);
|
SV_ClientTPrintf (host_client, PRINT_HIGH, STL_RATESETTO, SV_RateForClient(host_client));
|
||||||
host_client->rate = rate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2854,9 +2850,10 @@ ucmd_t ucmdsq2[] = {
|
||||||
{"baselines", SVQ2_BaseLines_f, true},
|
{"baselines", SVQ2_BaseLines_f, true},
|
||||||
{"begin", SV_Begin_f, true},
|
{"begin", SV_Begin_f, true},
|
||||||
|
|
||||||
{"setinfo", SV_SetInfo_f, true},
|
// {"setinfo", SV_SetInfo_f, true},
|
||||||
|
|
||||||
{"serverinfo", SV_ShowServerinfo_f, true},
|
{"serverinfo", SV_ShowServerinfo_f, true},
|
||||||
|
{"info", SV_ShowServerinfo_f, true},
|
||||||
|
|
||||||
{"download", SV_BeginDownload_f, true},
|
{"download", SV_BeginDownload_f, true},
|
||||||
{"nextdl", SV_NextDownload_f, true},
|
{"nextdl", SV_NextDownload_f, true},
|
||||||
|
@ -2865,9 +2862,9 @@ ucmd_t ucmdsq2[] = {
|
||||||
|
|
||||||
{"vote", SV_Vote_f, true},
|
{"vote", SV_Vote_f, true},
|
||||||
|
|
||||||
#ifdef SVRANKING
|
//#ifdef SVRANKING
|
||||||
{"topten", Rank_ListTop10_f, true},
|
// {"topten", Rank_ListTop10_f, true},
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
{"drop", SV_Drop_f, true},
|
{"drop", SV_Drop_f, true},
|
||||||
{"disconnect", SV_Drop_f, true},
|
{"disconnect", SV_Drop_f, true},
|
||||||
|
@ -3754,6 +3751,7 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse)
|
||||||
}
|
}
|
||||||
|
|
||||||
host_frametime = ucmd->msec * 0.001;
|
host_frametime = ucmd->msec * 0.001;
|
||||||
|
host_frametime *= sv.gamespeed;
|
||||||
if (host_frametime > 0.1)
|
if (host_frametime > 0.1)
|
||||||
host_frametime = 0.1;
|
host_frametime = 0.1;
|
||||||
|
|
||||||
|
@ -3800,7 +3798,7 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse)
|
||||||
pmove_maxs[i] = pmove.origin[i] + 256;
|
pmove_maxs[i] = pmove.origin[i] + 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
PM_PlayerMove ();
|
PM_PlayerMove (cl.gamespeed);
|
||||||
|
|
||||||
VectorCopy (pmove.origin, host_client->specorigin);
|
VectorCopy (pmove.origin, host_client->specorigin);
|
||||||
VectorCopy (pmove.velocity, host_client->specvelocity);
|
VectorCopy (pmove.velocity, host_client->specvelocity);
|
||||||
|
@ -3978,7 +3976,7 @@ if (sv_player->v.health > 0 && before && !after )
|
||||||
Con_Printf ("player %s got stuck in playermove!!!!\n", host_client->name);
|
Con_Printf ("player %s got stuck in playermove!!!!\n", host_client->name);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PM_PlayerMove ();
|
PM_PlayerMove (sv.gamespeed);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
host_client->jump_held = pmove.jump_held;
|
host_client->jump_held = pmove.jump_held;
|
||||||
|
@ -4496,7 +4494,9 @@ void SVQ2_ExecuteClientMessage (client_t *cl)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case clcq2_userinfo:
|
case clcq2_userinfo:
|
||||||
s = MSG_ReadString ();
|
strncpy (cl->userinfo, MSG_ReadString (), sizeof(cl->userinfo)-1);
|
||||||
|
ge->ClientUserinfoChanged (cl->q2edict, cl->userinfo); //tell the gamecode
|
||||||
|
SV_ExtractFromUserinfo(cl); //let the server routines know
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case clcq2_stringcmd:
|
case clcq2_stringcmd:
|
||||||
|
|
|
@ -176,6 +176,12 @@ static void VARGS PFQ2_Configstring (int i, char *val)
|
||||||
if (!val)
|
if (!val)
|
||||||
val = "";
|
val = "";
|
||||||
|
|
||||||
|
strcpy(sv.configstring[i], val);
|
||||||
|
|
||||||
|
if (i == Q2CS_NAME)
|
||||||
|
Q_strncpyz(sv.mapname, val, sizeof(sv.name));
|
||||||
|
|
||||||
|
/*
|
||||||
//work out range
|
//work out range
|
||||||
if (i >= Q2CS_LIGHTS && i < Q2CS_LIGHTS+Q2MAX_LIGHTSTYLES)
|
if (i >= Q2CS_LIGHTS && i < Q2CS_LIGHTS+Q2MAX_LIGHTSTYLES)
|
||||||
{
|
{
|
||||||
|
@ -213,31 +219,9 @@ static void VARGS PFQ2_Configstring (int i, char *val)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
#define Q2CS_NAME 0
|
|
||||||
#define Q2CS_CDTRACK 1
|
|
||||||
#define Q2CS_SKY 2
|
|
||||||
#define Q2CS_SKYAXIS 3 // %f %f %f format
|
|
||||||
#define Q2CS_SKYROTATE 4
|
|
||||||
#define Q2CS_STATUSBAR 5 // display program string
|
|
||||||
|
|
||||||
#define Q2CS_AIRACCEL 29 // air acceleration control
|
|
||||||
#define Q2CS_MAXCLIENTS 30
|
|
||||||
#define Q2CS_MAPCHECKSUM 31 // for catching cheater maps
|
|
||||||
|
|
||||||
#define Q2CS_MODELS 32
|
|
||||||
#define Q2CS_SOUNDS (Q2CS_MODELS +Q2MAX_MODELS)
|
|
||||||
#define Q2CS_IMAGES (Q2CS_SOUNDS +Q2MAX_SOUNDS)
|
|
||||||
#define Q2CS_LIGHTS (Q2CS_IMAGES +Q2MAX_IMAGES)
|
|
||||||
#define Q2CS_ITEMS (Q2CS_LIGHTS +Q2MAX_LIGHTSTYLES)
|
|
||||||
#define Q2CS_PLAYERSKINS (Q2CS_ITEMS +Q2MAX_ITEMS)
|
|
||||||
#define Q2CS_GENERAL (Q2CS_PLAYERSKINS +Q2MAX_CLIENTS)
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
Con_Printf("Ignoring configstring %i\n", i);
|
Con_Printf("Ignoring configstring %i\n", i);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (sv.state != ss_loading)
|
if (sv.state != ss_loading)
|
||||||
{ // send the update to everyone
|
{ // send the update to everyone
|
||||||
|
@ -250,9 +234,12 @@ static void VARGS PFQ2_Configstring (int i, char *val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SVQ2_FindIndex (char *name, int start, int max, char *strings, int stringlength, qboolean create)
|
static int SVQ2_FindIndex (char *name, int start, int max, qboolean create)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int stringlength = MAX_QPATH;
|
||||||
|
char *strings = sv.configstring[start];
|
||||||
|
strings += stringlength;
|
||||||
|
|
||||||
if (!name || !name[0])
|
if (!name || !name[0])
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -275,17 +262,17 @@ static int SVQ2_FindIndex (char *name, int start, int max, char *strings, int st
|
||||||
|
|
||||||
static int VARGS SVQ2_ModelIndex (char *name)
|
static int VARGS SVQ2_ModelIndex (char *name)
|
||||||
{
|
{
|
||||||
return SVQ2_FindIndex (name, Q2CS_MODELS, Q2MAX_MODELS, sv.model_precache[1], sizeof(sv.model_precache[0]), true);
|
return SVQ2_FindIndex (name, Q2CS_MODELS, Q2MAX_MODELS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int VARGS SVQ2_SoundIndex (char *name)
|
static int VARGS SVQ2_SoundIndex (char *name)
|
||||||
{
|
{
|
||||||
return SVQ2_FindIndex (name, Q2CS_SOUNDS, Q2MAX_SOUNDS, sv.sound_precache[1], sizeof(sv.sound_precache[0]), true);
|
return SVQ2_FindIndex (name, Q2CS_SOUNDS, Q2MAX_SOUNDS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int VARGS SVQ2_ImageIndex (char *name)
|
static int VARGS SVQ2_ImageIndex (char *name)
|
||||||
{
|
{
|
||||||
return SVQ2_FindIndex (name, Q2CS_IMAGES, Q2MAX_IMAGES, sv.image_precache[1], sizeof(sv.image_precache[0]), true);
|
return SVQ2_FindIndex (name, Q2CS_IMAGES, Q2MAX_IMAGES, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue