*** empty log message ***
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@896 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
ce3c561cfe
commit
d4e494488b
26 changed files with 459 additions and 242 deletions
|
@ -43,7 +43,7 @@ ifeq ($(USEASM),true)
|
|||
DO_AS=$(CC) $(BASE_CFLAGS) $(WCFLAGS) -x assembler-with-cpp -DELF -o $@ -c $< $(CFLAGS)
|
||||
endif
|
||||
endif
|
||||
BASELDFLAGS=-lm
|
||||
BASELDFLAGS=-lm -lz
|
||||
GLXLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lpng -ljpeg -lXxf86vm
|
||||
GLSLDFLAGS=-L/usr/X11R6/lib -lMesaGL -lglide -lvga
|
||||
XLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lpng -ljpeg
|
||||
|
|
|
@ -913,23 +913,28 @@ void CL_AllowIndependantSendCmd(qboolean allow)
|
|||
LeaveCriticalSection(&indepcriticialsection);
|
||||
else
|
||||
EnterCriticalSection(&indepcriticialsection);
|
||||
allowindepphys = allow;
|
||||
}
|
||||
allowindepphys = allow;
|
||||
}
|
||||
|
||||
unsigned long _stdcall CL_IndepPhysicsThread(void *param)
|
||||
{
|
||||
int sleeptime;
|
||||
float fps;
|
||||
float time, lasttime;
|
||||
lasttime = Sys_DoubleTime();
|
||||
while(1)
|
||||
{
|
||||
EnterCriticalSection(&indepcriticialsection);
|
||||
time = Sys_DoubleTime();
|
||||
host_frametime = time - lasttime;
|
||||
lasttime = time;
|
||||
CL_SendCmd();
|
||||
LeaveCriticalSection(&indepcriticialsection);
|
||||
|
||||
fps = cl_netfps.value*10; //try and be generous. (This isn't the framerate capping function).
|
||||
if (fps < 10)
|
||||
fps = 10;
|
||||
fps = cl_netfps.value;
|
||||
if (fps < 0)
|
||||
fps = 0;
|
||||
|
||||
sleeptime = 1000/fps;
|
||||
|
||||
|
@ -949,6 +954,7 @@ void CL_UseIndepPhysics(qboolean allow)
|
|||
runningindepphys = true;
|
||||
|
||||
indepphysicsthread = CreateThread(NULL, 8192, CL_IndepPhysicsThread, NULL, 0, &tid);
|
||||
allowindepphys = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -958,6 +964,7 @@ void CL_UseIndepPhysics(qboolean allow)
|
|||
TerminateThread(indepphysicsthread, 0);
|
||||
CloseHandle(indepphysicsthread);
|
||||
LeaveCriticalSection(&indepcriticialsection);
|
||||
DeleteCriticalSection(&indepcriticialsection);
|
||||
|
||||
runningindepphys = false;
|
||||
}
|
||||
|
|
|
@ -85,6 +85,9 @@ cvar_t cl_solid_players = {"cl_solid_players", "1"};
|
|||
|
||||
cvar_t cl_demospeed = {"cl_demospeed", "0"};
|
||||
|
||||
|
||||
cvar_t cl_indepphysics = {"cl_indepphysics", "0"};
|
||||
|
||||
cvar_t localid = {"localid", ""};
|
||||
|
||||
static qboolean allowremotecmd = true;
|
||||
|
@ -504,12 +507,22 @@ void CL_CheckForResend (void)
|
|||
{
|
||||
Q_strncpyz (cls.servername, "internalserver", sizeof(cls.servername));
|
||||
cls.state = ca_disconnected;
|
||||
#ifdef Q2CLIENT
|
||||
if (!svprogfuncs)
|
||||
cls.q2server = true;
|
||||
else
|
||||
cls.q2server = false;
|
||||
switch (svs.gametype)
|
||||
{
|
||||
#ifdef Q3CLIENT
|
||||
case GT_QUAKE3:
|
||||
cls.q2server = 2;
|
||||
break;
|
||||
#endif
|
||||
#ifdef Q2CLIENT
|
||||
case GT_QUAKE2:
|
||||
cls.q2server = true;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
cls.q2server = false;
|
||||
break;
|
||||
}
|
||||
|
||||
CL_SendConnectPacket (svs.fteprotocolextensions, false);
|
||||
return;
|
||||
|
@ -1817,7 +1830,8 @@ client_connect: //fixme: make function
|
|||
#ifdef NQPROT
|
||||
cls.netchan.qsocket = cls.netcon;
|
||||
#endif
|
||||
CL_SendClientCommand("new");
|
||||
if (cls.q2server < 2)
|
||||
CL_SendClientCommand("new");
|
||||
cls.state = ca_connected;
|
||||
Con_TPrintf (TLC_CONNECTED);
|
||||
allowremotecmd = false; // localid required now for remote cmds
|
||||
|
@ -2682,6 +2696,8 @@ void Host_Frame (float time)
|
|||
|
||||
RSpeedRemark();
|
||||
|
||||
CL_UseIndepPhysics(!!cl_indepphysics.value);
|
||||
|
||||
CL_AllowIndependantSendCmd(false);
|
||||
|
||||
if (cls.downloadtype == dl_none && !*cls.downloadname && cl.downloadlist)
|
||||
|
@ -2701,7 +2717,9 @@ void Host_Frame (float time)
|
|||
}
|
||||
else
|
||||
{
|
||||
CL_SendCmd ();
|
||||
extern qboolean runningindepphys;
|
||||
if (!runningindepphys)
|
||||
CL_SendCmd ();
|
||||
|
||||
if (cls.state == ca_onserver && cl.validsequence && cl.worldmodel)
|
||||
{ // first update is the final signon stage
|
||||
|
|
|
@ -3421,7 +3421,9 @@ void CL_ParseServerMessage (void)
|
|||
|
||||
//
|
||||
// if recording demos, copy the message out
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
if (cl_shownet.value == 1)
|
||||
Con_TPrintf (TL_INT_SPACE,net_message.cursize);
|
||||
else if (cl_shownet.value == 2)
|
||||
|
|
|
@ -1880,8 +1880,10 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
|
|||
else
|
||||
SCR_DrawFPS ();
|
||||
SCR_CheckDrawCenterString ();
|
||||
#ifdef RGLQUAKE
|
||||
if (qrenderer == QR_OPENGL)
|
||||
qglTexEnvi ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
#endif
|
||||
#ifdef TEXTEDITOR
|
||||
if (editoractive)
|
||||
Editor_Draw();
|
||||
|
|
|
@ -842,8 +842,6 @@ void Con_DrawInput (void)
|
|||
int maskstack[4];
|
||||
int maskstackdepth = 0;
|
||||
|
||||
int oc;
|
||||
|
||||
int si, x;
|
||||
|
||||
if (key_dest != key_console && cls.state == ca_active)
|
||||
|
@ -900,7 +898,7 @@ void Con_DrawInput (void)
|
|||
|
||||
if (con_current->commandcompletion)
|
||||
{
|
||||
if (text[1] == '/' || IsCommand(text+1))
|
||||
if (text[1] == '/' || Cmd_IsCommand(text+1))
|
||||
{ //color the first token yellow, it's a valid command
|
||||
for (p = 1; (maskedtext[p]&255)>' '; p++)
|
||||
maskedtext[p] = (maskedtext[p]&255) | (COLOR_YELLOW<<8);
|
||||
|
@ -941,94 +939,6 @@ void Con_DrawInput (void)
|
|||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
x = 1;
|
||||
if (text[1] == '/')
|
||||
x = 2;
|
||||
if (con_current->commandcompletion)
|
||||
{
|
||||
fname = Cmd_CompleteCommand(text+x, true, con_commandmatch);
|
||||
}
|
||||
else
|
||||
fname = NULL;
|
||||
oc = text[key_linepos];
|
||||
if (!oc)
|
||||
text[key_linepos+1] = 0;
|
||||
if (fname)
|
||||
{
|
||||
si = strlen(text)-x;
|
||||
|
||||
if ((int)(realtime*con_cursorspeed)&1)
|
||||
{
|
||||
text[key_linepos] = 11;
|
||||
mask = COLOR_GREEN<<8;
|
||||
if (*(fname+si)) //make sure we arn't skipping a null char
|
||||
strcat(text, fname+si+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mask = COLOR_GREEN<<8;
|
||||
strcat(text, fname+si);
|
||||
}
|
||||
}
|
||||
else if (((int)(realtime*con_cursorspeed)&1))
|
||||
text[key_linepos] = 11;
|
||||
else if (!text[key_linepos])
|
||||
text[key_linepos] = 10;
|
||||
|
||||
i = strlen(text);
|
||||
|
||||
if (i >= con_current->linewidth) //work out the start point
|
||||
si = i - con_current->linewidth;
|
||||
else
|
||||
si = 0;
|
||||
|
||||
y = con_current->vislines-22;
|
||||
|
||||
for (i=0,p=0,x=8; x<=con_current->linewidth*8 ; p++) //draw it
|
||||
{
|
||||
if (text[p] == '^')
|
||||
{
|
||||
if (text[p+1]>='0' && text[p+1]<'8')
|
||||
mask = (text[p+1]-'0')*256 + (mask&~CON_COLOURMASK); //change colour only.
|
||||
else if (text[p+1] == 'b')
|
||||
mask = (mask & ~CON_BLINKTEXT) + (CON_BLINKTEXT - (mask & CON_BLINKTEXT));
|
||||
else if (text[p+1] == 'a') //alternate
|
||||
mask = (mask & ~CON_2NDCHARSETTEXT) + (CON_2NDCHARSETTEXT - (mask & CON_2NDCHARSETTEXT));
|
||||
else if (text[p+1] == 's') //store on stack (it's great for names)
|
||||
{
|
||||
if (maskstackdepth < sizeof(maskstack)/sizeof(maskstack[0]))
|
||||
{
|
||||
maskstack[maskstackdepth] = mask;
|
||||
maskstackdepth++;
|
||||
}
|
||||
}
|
||||
else if (text[p+1] == 'r') //restore from stack (it's great for names)
|
||||
{
|
||||
if (maskstackdepth)
|
||||
{
|
||||
maskstackdepth--;
|
||||
mask = maskstack[maskstackdepth];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!text[p])
|
||||
break;
|
||||
if (si <= i)
|
||||
{
|
||||
Draw_ColouredCharacter ( x, con_current->vislines - 22, text[p]|mask);
|
||||
x+=8;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
text[key_linepos] = oc;
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -212,7 +212,7 @@ keyname_t keynames[] =
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
qboolean IsCommand (char *line)
|
||||
qboolean Cmd_IsCommand (char *line)
|
||||
{
|
||||
char command[128];
|
||||
char *cmd, *s;
|
||||
|
@ -354,7 +354,7 @@ void Con_ExecuteLine(console_t *con, char *line)
|
|||
con_commandmatch=1;
|
||||
if (line[0] == '\\' || line[0] == '/')
|
||||
Cbuf_AddText (line+1, RESTRICT_LOCAL); // skip the >
|
||||
else if (IsCommand(line))
|
||||
else if (Cmd_IsCommand(line))
|
||||
Cbuf_AddText (line, RESTRICT_LOCAL); // valid command
|
||||
#ifdef Q2CLIENT
|
||||
else if (cls.q2server)
|
||||
|
|
|
@ -810,7 +810,7 @@ void SWV_UpdatePalette (void)
|
|||
|
||||
if (r_pixbytes == 4) //doesn't support palette cycling. It messes up caches.
|
||||
{
|
||||
if (!force)
|
||||
if (!new && !force)
|
||||
return;
|
||||
basepal = host_basepal;
|
||||
newpal = pal;
|
||||
|
@ -829,6 +829,7 @@ void SWV_UpdatePalette (void)
|
|||
}
|
||||
|
||||
VID_ShiftPalette (pal);
|
||||
D_FlushCaches();
|
||||
return;
|
||||
}
|
||||
if (!new && !force)
|
||||
|
@ -1298,6 +1299,7 @@ void V_RenderPlayerViews(int plnum)
|
|||
}
|
||||
|
||||
#ifdef SWQUAKE
|
||||
if (cl.splitclients>1)
|
||||
r_viewchanged = true;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#endif
|
||||
|
||||
#define SVRANKING
|
||||
#define SWSTAINS
|
||||
|
||||
#ifdef MINIMAL
|
||||
#define CL_MASTER //this is useful
|
||||
|
|
|
@ -1296,7 +1296,7 @@ void Cmd_RestrictCommand_f (void)
|
|||
cvar_t *v;
|
||||
cmd_function_t *cmd;
|
||||
char *cmd_name = Cmd_Argv(1);
|
||||
int level = atoi(Cmd_Argv(2));
|
||||
int level;
|
||||
|
||||
if (Cmd_Argc() != 3 && Cmd_Argc() != 2)
|
||||
{
|
||||
|
@ -1304,8 +1304,9 @@ void Cmd_RestrictCommand_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (Cmd_Argc() == 2)
|
||||
if (Cmd_Argc() > 2)
|
||||
{
|
||||
level = atoi(Cmd_Argv(2));
|
||||
if (level > RESTRICT_MAX)
|
||||
{
|
||||
level = RESTRICT_MAX;
|
||||
|
@ -1318,6 +1319,7 @@ void Cmd_RestrictCommand_f (void)
|
|||
else if (level < RESTRICT_MIN)
|
||||
level = RESTRICT_MIN;
|
||||
}
|
||||
else level = 0;
|
||||
//commands
|
||||
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
|
||||
{
|
||||
|
@ -2645,10 +2647,10 @@ void Cmd_Init (void)
|
|||
Cmd_AddCommand ("wait", Cmd_Wait_f);
|
||||
#ifndef SERVERONLY
|
||||
Cmd_AddCommand ("cmd", Cmd_ForwardToServer_f);
|
||||
#else
|
||||
#endif
|
||||
Cmd_AddCommand ("restrict", Cmd_RestrictCommand_f);
|
||||
Cmd_AddCommand ("aliaslevel", Cmd_AliasLevel_f);
|
||||
#endif
|
||||
|
||||
Cmd_AddCommand ("showalias", Cmd_ShowAlias_f);
|
||||
|
||||
// Cmd_AddCommand ("msg_trigger", Cmd_Msg_Trigger_f);
|
||||
|
|
|
@ -84,6 +84,7 @@ qboolean Cmd_Exists (char *cmd_name);
|
|||
// used by the cvar code to check for cvar / command name overlap
|
||||
|
||||
char *Cmd_CompleteCommand (char *partial, qboolean fullonly, int matchnum);
|
||||
qboolean Cmd_IsCommand (char *line);
|
||||
// attempts to match a partial command for automatic command line completion
|
||||
// returns NULL if nothing fits
|
||||
|
||||
|
@ -91,6 +92,8 @@ int Cmd_Argc (void);
|
|||
char *Cmd_Argv (int arg);
|
||||
char *Cmd_Args (void);
|
||||
extern int Cmd_ExecLevel;
|
||||
|
||||
extern cvar_t cmd_gamecodelevel, cmd_allowaccess;
|
||||
// The functions that execute commands get their parameters with these
|
||||
// functions. Cmd_Argv () will return an empty string, not a NULL
|
||||
// if arg > argc, so string operations are allways safe.
|
||||
|
|
|
@ -439,7 +439,7 @@ printf("%s\n", cl->outmessagebuffer);
|
|||
extern cvar_t rank_filename;
|
||||
|
||||
token = COM_ParseToken(token);
|
||||
id = Rank_GetPlayerID(cl->username, atoi(com_token), false);
|
||||
id = Rank_GetPlayerID(cl->username, atoi(com_token), false, true);
|
||||
if (!id && *rank_filename.string)
|
||||
{
|
||||
SV_POP3_QueueMessage(cl, "-ERR User or Password not valid\r\n");
|
||||
|
@ -471,7 +471,7 @@ printf("%s\n", cl->outmessagebuffer);
|
|||
#ifndef CLIENTONLY
|
||||
token = COM_ParseToken(token);
|
||||
pass = Rank_GetPass(cl->username);
|
||||
id = Rank_GetPlayerID(cl->username, pass, false);
|
||||
id = Rank_GetPlayerID(cl->username, pass, false, true);
|
||||
if ((!id && *rank_filename.string) || strcmp(MD5_GetPop3APOPString(cl->greeting, va("%i", pass)), com_token))
|
||||
{
|
||||
SV_POP3_QueueMessage(cl, "-ERR User or Password not valid\r\n");
|
||||
|
|
|
@ -89,7 +89,8 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
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 LINK32 comctl32.lib wsock32.lib winmm.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 /nologo /subsystem:windows /pdb:none /debug /machine:I386 /out:"../../fteswqw_dbg.exe"
|
||||
# ADD LINK32 comctl32.lib wsock32.lib winmm.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 /nologo /subsystem:windows /debug /machine:I386 /out:"../../fteswqw_dbg.exe"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug"
|
||||
|
||||
|
@ -7990,6 +7991,8 @@ SOURCE=..\server\sv_sys_win.c
|
|||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server"
|
||||
|
||||
# ADD CPP /Yu"qwsvdef.h"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW"
|
||||
|
@ -8043,6 +8046,8 @@ SOURCE=..\server\svmodel.c
|
|||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server"
|
||||
|
||||
# ADD CPP /Yu"qwsvdef.h"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW"
|
||||
|
|
|
@ -1116,9 +1116,9 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
VectorAdd (e->origin, clmodel->mins, mins);
|
||||
VectorAdd (e->origin, clmodel->maxs, maxs);
|
||||
|
||||
// if (!(e->flags & Q2RF_WEAPONMODEL))
|
||||
// if (R_CullBox (mins, maxs))
|
||||
// return;
|
||||
if (!(e->flags & Q2RF_WEAPONMODEL))
|
||||
if (R_CullBox (mins, maxs))
|
||||
return;
|
||||
|
||||
if (!(r_refdef.flags & 1)) //RDF_NOWORLDMODEL
|
||||
{
|
||||
|
|
|
@ -219,6 +219,14 @@ typedef struct mfog_s
|
|||
} mfog_t;
|
||||
#endif
|
||||
|
||||
typedef struct decal_s {
|
||||
int xpos, ypos;
|
||||
struct msurface_s *owner;
|
||||
struct decal_s *next;
|
||||
struct decal_s *prev;
|
||||
} decal_t;
|
||||
|
||||
|
||||
typedef struct msurface_s
|
||||
{
|
||||
int visframe; // should be drawn when node is crossed
|
||||
|
@ -269,6 +277,8 @@ typedef struct msurface_s
|
|||
qboolean stained;
|
||||
#endif
|
||||
qbyte *samples; // [numstyles*surfsize]
|
||||
|
||||
decal_t *decal;
|
||||
} msurface_t;
|
||||
|
||||
typedef struct mnode_s
|
||||
|
|
|
@ -572,7 +572,7 @@ int IWebAuthorize(char *name, char *password)
|
|||
return IWEBACC_READ;
|
||||
#else
|
||||
#ifndef CLIENTONLY
|
||||
int id = Rank_GetPlayerID(name, atoi(password), false);
|
||||
int id = Rank_GetPlayerID(name, atoi(password), false, true);
|
||||
rankinfo_t info;
|
||||
if (!id)
|
||||
{
|
||||
|
|
|
@ -1268,6 +1268,10 @@ qboolean PR_ConsoleCmd(void)
|
|||
{
|
||||
globalvars_t *pr_globals;
|
||||
extern redirect_t sv_redirected;
|
||||
|
||||
if (Cmd_ExecLevel < cmd_gamecodelevel.value)
|
||||
return false;
|
||||
|
||||
#ifdef Q2SERVER
|
||||
if (ge)
|
||||
{ //server command
|
||||
|
@ -1280,17 +1284,20 @@ qboolean PR_ConsoleCmd(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
pr_globals = PR_globals(svprogfuncs, PR_CURRENT);
|
||||
if (mod_ConsoleCmd && pr_imitatemvdsv.value >= 0)
|
||||
if (svprogfuncs)
|
||||
{
|
||||
if (sv_redirected != RD_OBLIVION)
|
||||
pr_globals = PR_globals(svprogfuncs, PR_CURRENT);
|
||||
if (mod_ConsoleCmd && pr_imitatemvdsv.value >= 0)
|
||||
{
|
||||
pr_global_struct->time = sv.time;
|
||||
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, sv_player);
|
||||
if (sv_redirected != RD_OBLIVION)
|
||||
{
|
||||
pr_global_struct->time = sv.time;
|
||||
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, sv_player);
|
||||
}
|
||||
|
||||
PR_ExecuteProgram (svprogfuncs, mod_ConsoleCmd);
|
||||
return (int) G_FLOAT(OFS_RETURN);
|
||||
}
|
||||
|
||||
PR_ExecuteProgram (svprogfuncs, mod_ConsoleCmd);
|
||||
return (int) G_FLOAT(OFS_RETURN);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -1027,7 +1027,7 @@ typedef struct {
|
|||
rankstats_t s;
|
||||
} rankinfo_t;
|
||||
|
||||
int Rank_GetPlayerID(char *name, int pwd, qboolean allowcreate);
|
||||
int Rank_GetPlayerID(char *name, int pwd, qboolean allowcreate, qboolean requirepasswordtobeset);
|
||||
void Rank_SetPlayerStats(int id, rankstats_t *stats);
|
||||
rankstats_t *Rank_GetPlayerStats(int id, rankstats_t *buffer);
|
||||
rankinfo_t *Rank_GetPlayerInfo(int id, rankinfo_t *buffer);
|
||||
|
|
|
@ -424,6 +424,9 @@ void SV_DropClient (client_t *drop)
|
|||
drop->frames = NULL;
|
||||
}
|
||||
|
||||
if (svs.gametype != GT_PROGS) //gamecode should do it all for us.
|
||||
return;
|
||||
|
||||
// send notification to all remaining clients
|
||||
SV_FullClientUpdate (drop, &sv.reliable_datagram);
|
||||
#ifdef NQPROT
|
||||
|
@ -1542,6 +1545,9 @@ void SVC_DirectConnect
|
|||
if (!Rank_GetPlayerStats(newcl->rankid, &rs))
|
||||
{
|
||||
SV_OutOfBandPrintf (isquake2client, adr, "\nRankings/Account system failed\n");
|
||||
Con_Printf("banned player %s is trying to connect\n", newcl->name);
|
||||
newcl->name[0] = 0;
|
||||
memset (newcl->userinfo, 0, sizeof(newcl->userinfo));
|
||||
newcl->state = cs_free;
|
||||
return;
|
||||
}
|
||||
|
@ -1878,55 +1884,58 @@ void SVC_RemoteCommand (void)
|
|||
|
||||
if (!Rcon_Validate ())
|
||||
{
|
||||
int rid;
|
||||
char *s = Cmd_Argv(1);
|
||||
char *colon=NULL, *c2;
|
||||
rankstats_t stats;
|
||||
c2=s;
|
||||
for(;;)
|
||||
if (cmd_allowaccess.value) //try and find a username, match the numeric password
|
||||
{
|
||||
c2 = strchr(c2, ':');
|
||||
if (!c2)
|
||||
break;
|
||||
colon = c2;
|
||||
c2++;
|
||||
}
|
||||
if (colon) //oh, could this be a specific username?
|
||||
{
|
||||
*colon = '\0';
|
||||
colon++;
|
||||
rid = Rank_GetPlayerID(s, atoi(colon), false);
|
||||
if (rid)
|
||||
int rid;
|
||||
char *s = Cmd_Argv(1);
|
||||
char *colon=NULL, *c2;
|
||||
rankstats_t stats;
|
||||
c2=s;
|
||||
for(;;)
|
||||
{
|
||||
if (!Rank_GetPlayerStats(rid, &stats))
|
||||
return;
|
||||
|
||||
|
||||
Con_Printf ("Rcon from %s:\n%s\n"
|
||||
, NET_AdrToString (net_from), net_message.data+4);
|
||||
|
||||
SV_BeginRedirect (RD_PACKET, LANGDEFAULT);
|
||||
|
||||
remaining[0] = 0;
|
||||
|
||||
for (i=2 ; i<Cmd_Argc() ; i++)
|
||||
c2 = strchr(c2, ':');
|
||||
if (!c2)
|
||||
break;
|
||||
colon = c2;
|
||||
c2++;
|
||||
}
|
||||
if (colon) //oh, could this be a specific username?
|
||||
{
|
||||
*colon = '\0';
|
||||
colon++;
|
||||
rid = Rank_GetPlayerID(s, atoi(colon), false, true);
|
||||
if (rid)
|
||||
{
|
||||
if (strlen(remaining)+strlen(Cmd_Argv(i))>=sizeof(remaining)-2)
|
||||
{
|
||||
Con_Printf("Rcon was too long\n");
|
||||
SV_EndRedirect ();
|
||||
Con_Printf ("Rcon from %s:\n%s\n"
|
||||
, NET_AdrToString (net_from), "Was too long - possible buffer overflow attempt");
|
||||
if (!Rank_GetPlayerStats(rid, &stats))
|
||||
return;
|
||||
|
||||
|
||||
Con_Printf ("Rcon from %s:\n%s\n"
|
||||
, NET_AdrToString (net_from), net_message.data+4);
|
||||
|
||||
SV_BeginRedirect (RD_PACKET, LANGDEFAULT);
|
||||
|
||||
remaining[0] = 0;
|
||||
|
||||
for (i=2 ; i<Cmd_Argc() ; i++)
|
||||
{
|
||||
if (strlen(remaining)+strlen(Cmd_Argv(i))>=sizeof(remaining)-2)
|
||||
{
|
||||
Con_Printf("Rcon was too long\n");
|
||||
SV_EndRedirect ();
|
||||
Con_Printf ("Rcon from %s:\n%s\n"
|
||||
, NET_AdrToString (net_from), "Was too long - possible buffer overflow attempt");
|
||||
return;
|
||||
}
|
||||
strcat (remaining, Cmd_Argv(i) );
|
||||
strcat (remaining, " ");
|
||||
}
|
||||
strcat (remaining, Cmd_Argv(i) );
|
||||
strcat (remaining, " ");
|
||||
|
||||
Cmd_ExecuteString (remaining, stats.trustlevel);
|
||||
|
||||
SV_EndRedirect ();
|
||||
return;
|
||||
}
|
||||
|
||||
Cmd_ExecuteString (remaining, stats.trustlevel);
|
||||
|
||||
SV_EndRedirect ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3227,9 +3236,9 @@ qboolean ReloadRanking(client_t *cl, char *newname)
|
|||
int newid;
|
||||
int j;
|
||||
rankstats_t rs;
|
||||
newid = Rank_GetPlayerID(newname, atoi(Info_ValueForKey (cl->userinfo, "_pwd")), true); //'_' keys are always stripped. On any server. So try and use that so persistant data won't give out the password when connecting to a different server
|
||||
newid = Rank_GetPlayerID(newname, atoi(Info_ValueForKey (cl->userinfo, "_pwd")), true, false); //'_' keys are always stripped. On any server. So try and use that so persistant data won't give out the password when connecting to a different server
|
||||
if (!newid)
|
||||
newid = Rank_GetPlayerID(newname, atoi(Info_ValueForKey (cl->userinfo, "password")), true);
|
||||
newid = Rank_GetPlayerID(newname, atoi(Info_ValueForKey (cl->userinfo, "password")), true, false);
|
||||
if (newid)
|
||||
{
|
||||
if (cl->rankid && cl->state >= cs_spawned)//apply current stats
|
||||
|
|
|
@ -348,12 +348,16 @@ void Rank_SetPlayerStats(int id, rankstats_t *stats)
|
|||
}
|
||||
}
|
||||
|
||||
int Rank_GetPlayerID(char *name, int pwd, qboolean allowadd)
|
||||
int Rank_GetPlayerID(char *name, int pwd, qboolean allowadd, qboolean requirepasswordtobeset)
|
||||
{
|
||||
rankstats_t rs;
|
||||
rankheader_t rh;
|
||||
int id;
|
||||
|
||||
if (requirepasswordtobeset)
|
||||
if (!pwd)
|
||||
return 0;
|
||||
|
||||
if (!Rank_OpenRankings())
|
||||
return 0;
|
||||
|
||||
|
@ -364,7 +368,11 @@ int Rank_GetPlayerID(char *name, int pwd, qboolean allowadd)
|
|||
if (!NAMECMP(rh.name, name))
|
||||
{
|
||||
if (rh.pwd == pwd || !rh.pwd)
|
||||
{
|
||||
if (!rh.pwd && requirepasswordtobeset)
|
||||
return 0;
|
||||
return id;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
id = rh.next;
|
||||
|
|
|
@ -47,7 +47,9 @@ cvar_t sv_cheatpc = {"sv_cheatpc", "125"};
|
|||
cvar_t sv_cheatspeedchecktime = {"sv_cheatspeedchecktime", "30"};
|
||||
cvar_t sv_playermodelchecks = {"sv_playermodelchecks", "1"};
|
||||
|
||||
cvar_t sv_cmdlikercon = {"sv_cmdlikercon", "0"};
|
||||
cvar_t sv_cmdlikercon = {"sv_cmdlikercon", "0"}; //set to 1 to allow a password of username:password instead of the correct rcon password.
|
||||
cvar_t cmd_allowaccess = {"cmd_allowaccess", "0"}; //set to 1 to allow cmd to execute console commands on the server.
|
||||
cvar_t cmd_gamecodelevel = {"cmd_gamecodelevel", "50"}; //execution level which gamecode is told about (for unrecognised commands)
|
||||
|
||||
cvar_t sv_nomsec = {"sv_nomsec", "0"};
|
||||
cvar_t sv_edgefriction = {"sv_edgefriction", "2"};
|
||||
|
@ -4673,6 +4675,8 @@ void SV_UserInit (void)
|
|||
Cvar_Register (&sv_playermodelchecks, cvargroup_servercontrol);
|
||||
|
||||
Cvar_Register (&sv_cmdlikercon, cvargroup_serverpermissions);
|
||||
Cvar_Register(&cmd_gamecodelevel, "Access controls");
|
||||
Cvar_Register(&cmd_allowaccess, "Access controls");
|
||||
|
||||
Cvar_Register (&votelevel, sv_votinggroup);
|
||||
Cvar_Register (&voteminimum, sv_votinggroup);
|
||||
|
|
|
@ -105,6 +105,6 @@ d_pix_max*=2;
|
|||
|
||||
D_Patch ();
|
||||
|
||||
D_FlushCaches();
|
||||
// D_FlushCaches();
|
||||
}
|
||||
|
||||
|
|
|
@ -1183,14 +1183,13 @@ void D_PolysetDraw16 (void)
|
|||
|
||||
a_spans = (spanpackage_t *)
|
||||
(((long)&spans[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
|
||||
|
||||
#if !id386
|
||||
/*
|
||||
if (r_affinetridesc.drawtype)
|
||||
{
|
||||
D_DrawSubdiv ();
|
||||
D_DrawNonSubdiv (); //hrm.
|
||||
}
|
||||
else
|
||||
#endif
|
||||
*/
|
||||
{
|
||||
D_DrawNonSubdiv ();
|
||||
}
|
||||
|
|
|
@ -395,40 +395,18 @@ void R_AliasSetUpTransform (int trivial_accept)
|
|||
float rotationmatrix[3][4], t2matrix[3][4];
|
||||
static float tmatrix[3][4];
|
||||
static float viewmatrix[3][4];
|
||||
vec3_t angles;
|
||||
|
||||
// TODO: should really be stored with the entity instead of being reconstructed
|
||||
// TODO: should use a look-up table
|
||||
// TODO: could cache lazily, stored in the entity
|
||||
|
||||
angles[ROLL] = currententity->angles[ROLL];
|
||||
angles[PITCH] = -currententity->angles[PITCH];
|
||||
angles[YAW] = currententity->angles[YAW];
|
||||
AngleVectors (angles, alias_forward, alias_right, alias_up);
|
||||
|
||||
tmatrix[0][0] = currententity->scale;
|
||||
tmatrix[1][1] = currententity->scale;
|
||||
tmatrix[2][2] = currententity->scale;
|
||||
|
||||
tmatrix[0][3] = 0;
|
||||
tmatrix[1][3] = 0;
|
||||
tmatrix[2][3] = 0;
|
||||
|
||||
// TODO: can do this with simple matrix rearrangement
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
t2matrix[i][0] = alias_forward[i];
|
||||
t2matrix[i][1] = -alias_right[i];
|
||||
t2matrix[i][2] = alias_up[i];
|
||||
rotationmatrix[i][0] = currententity->axis[0][i]*currententity->scale;
|
||||
rotationmatrix[i][1] = currententity->axis[1][i]*currententity->scale;
|
||||
rotationmatrix[i][2] = currententity->axis[2][i]*currententity->scale;
|
||||
}
|
||||
|
||||
t2matrix[0][3] = -modelorg[0];
|
||||
t2matrix[1][3] = -modelorg[1];
|
||||
t2matrix[2][3] = -modelorg[2];
|
||||
rotationmatrix[0][3] = -modelorg[0];
|
||||
rotationmatrix[1][3] = -modelorg[1];
|
||||
rotationmatrix[2][3] = -modelorg[2];
|
||||
|
||||
// FIXME: can do more efficiently than full concatenation
|
||||
R_ConcatTransforms (t2matrix, tmatrix, rotationmatrix);
|
||||
|
||||
// TODO: should be global, set when vright, etc., set
|
||||
VectorCopy (vright, viewmatrix[0]);
|
||||
|
@ -440,7 +418,26 @@ void R_AliasSetUpTransform (int trivial_accept)
|
|||
// viewmatrix[1][3] = 0;
|
||||
// viewmatrix[2][3] = 0;
|
||||
|
||||
R_ConcatTransforms (viewmatrix, rotationmatrix, aliastransform);
|
||||
if (currententity->flags & Q2RF_WEAPONMODEL)
|
||||
{ //rotate viewmodel to view first
|
||||
float vmmatrix[3][4];
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
t2matrix[i][0] = cl.viewent[r_refdef.currentplayernum].axis[0][i];
|
||||
t2matrix[i][1] = cl.viewent[r_refdef.currentplayernum].axis[1][i];
|
||||
t2matrix[i][2] = cl.viewent[r_refdef.currentplayernum].axis[2][i];
|
||||
}
|
||||
|
||||
t2matrix[0][3] = cl.viewent[r_refdef.currentplayernum].origin[0];
|
||||
t2matrix[1][3] = cl.viewent[r_refdef.currentplayernum].origin[1];
|
||||
t2matrix[2][3] = cl.viewent[r_refdef.currentplayernum].origin[2];
|
||||
|
||||
R_ConcatTransforms (rotationmatrix, t2matrix, vmmatrix);
|
||||
R_ConcatTransforms (viewmatrix, vmmatrix, aliastransform);
|
||||
}
|
||||
else
|
||||
R_ConcatTransforms (viewmatrix, rotationmatrix, aliastransform);
|
||||
|
||||
|
||||
// do the scaling up of x and y to screen coordinates as part of the transform
|
||||
// for the unclipped case (it would mess up clipping in the clipped case).
|
||||
|
@ -749,9 +746,9 @@ void R_AliasSetupLighting (alight_t *plighting)
|
|||
r_shadelight *= VID_GRADES;
|
||||
|
||||
// rotate the lighting vector into the model's frame of reference
|
||||
r_plightvec[0] = DotProduct (plighting->plightvec, alias_forward);
|
||||
r_plightvec[1] = -DotProduct (plighting->plightvec, alias_right);
|
||||
r_plightvec[2] = DotProduct (plighting->plightvec, alias_up);
|
||||
r_plightvec[0] = DotProduct (plighting->plightvec, currententity->axis[0]);
|
||||
r_plightvec[1] = DotProduct (plighting->plightvec, currententity->axis[1]);
|
||||
r_plightvec[2] = DotProduct (plighting->plightvec, currententity->axis[2]);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -19,8 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
// r_main.c
|
||||
|
||||
#define SWSTAINS
|
||||
|
||||
#include "quakedef.h"
|
||||
#include "r_local.h"
|
||||
#include "sw_draw.h"
|
||||
|
@ -229,8 +227,10 @@ void SWR_Init (void)
|
|||
|
||||
Cmd_AddRemCommand ("timerefresh", SWR_TimeRefresh_f);
|
||||
|
||||
Cvar_SetValue (&r_maxedges, (float)NUMSTACKEDGES);
|
||||
Cvar_SetValue (&r_maxsurfs, (float)NUMSTACKSURFACES);
|
||||
if (!r_maxedges.value)
|
||||
Cvar_SetValue (&r_maxedges, (float)NUMSTACKEDGES);
|
||||
if (!r_maxsurfs.value)
|
||||
Cvar_SetValue (&r_maxsurfs, (float)NUMSTACKSURFACES);
|
||||
|
||||
view_clipplanes[0].leftedge = true;
|
||||
view_clipplanes[1].rightedge = true;
|
||||
|
@ -319,6 +319,8 @@ void SWR_NewMap (void)
|
|||
SWR_BuildLightmaps();
|
||||
#endif
|
||||
|
||||
R_WipeDecals();
|
||||
|
||||
R_InitSkyBox();
|
||||
|
||||
UI_Reset();
|
||||
|
@ -707,6 +709,7 @@ void SWR_DrawEntitiesOnList (void)
|
|||
// trivial accept status
|
||||
if (R_AliasCheckBBox ())
|
||||
{
|
||||
float *org;
|
||||
extern cvar_t r_fullbrightSkins;
|
||||
float fb = r_fullbrightSkins.value;
|
||||
if (fb > cls.allow_fbskins)
|
||||
|
@ -714,7 +717,12 @@ void SWR_DrawEntitiesOnList (void)
|
|||
if (fb < 0)
|
||||
fb = 0;
|
||||
|
||||
j = SWR_LightPoint (currententity->origin);
|
||||
if (currententity->flags & Q2RF_WEAPONMODEL)
|
||||
org = cl.viewent[r_refdef.currentplayernum].origin;
|
||||
else
|
||||
org = currententity->origin;
|
||||
|
||||
j = SWR_LightPoint (org);
|
||||
|
||||
lighting.ambientlight = j+fb * 120;
|
||||
lighting.shadelight = j+fb * 120;
|
||||
|
@ -725,7 +733,7 @@ void SWR_DrawEntitiesOnList (void)
|
|||
{
|
||||
if (cl_dlights[lnum].radius)
|
||||
{
|
||||
VectorSubtract (currententity->origin,
|
||||
VectorSubtract (org,
|
||||
cl_dlights[lnum].origin,
|
||||
dist);
|
||||
add = cl_dlights[lnum].radius - Length(dist);
|
||||
|
@ -759,6 +767,7 @@ R_DrawViewModel
|
|||
*/
|
||||
void SWR_DrawViewModel (void)
|
||||
{
|
||||
/*
|
||||
// FIXME: remove and do real lighting
|
||||
float lightvec[3] = {-1, 0, 0};
|
||||
int j;
|
||||
|
@ -865,6 +874,7 @@ void SWR_DrawViewModel (void)
|
|||
case mod_dummy:
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,13 +20,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
// r_surf.c: surface-related refresh code
|
||||
|
||||
#include "quakedef.h"
|
||||
#define SWSTAINS
|
||||
|
||||
#include "r_local.h"
|
||||
#ifdef SWSTAINS
|
||||
#include "d_local.h"
|
||||
#endif
|
||||
|
||||
#define MAX_DECALS (1<<8)
|
||||
decal_t decals[MAX_DECALS];
|
||||
int nextdecal;
|
||||
|
||||
void SWR_AddDecal(vec3_t org);
|
||||
|
||||
drawsurf_t r_drawsurf;
|
||||
|
||||
int lightleft, sourcesstep, blocksize, sourcetstep;
|
||||
|
@ -74,13 +79,12 @@ extern cvar_t r_stains;
|
|||
extern cvar_t r_stainfadetime;
|
||||
extern cvar_t r_stainfadeammount;
|
||||
|
||||
#define BLOCK_WIDTH 128
|
||||
#define BLOCK_HEIGHT 128
|
||||
|
||||
#define LMBLOCK_WIDTH 128
|
||||
#define LMBLOCK_HEIGHT 128
|
||||
#define MAX_LIGHTMAPS 64
|
||||
|
||||
int stainmaps[MAX_LIGHTMAPS*BLOCK_WIDTH*BLOCK_HEIGHT]; //added to lightmap for added (hopefully) speed.
|
||||
int allocated[MAX_LIGHTMAPS][BLOCK_WIDTH];
|
||||
int stainmaps[MAX_LIGHTMAPS*LMBLOCK_WIDTH*LMBLOCK_HEIGHT]; //added to lightmap for added (hopefully) speed.
|
||||
int allocated[MAX_LIGHTMAPS][LMBLOCK_WIDTH];
|
||||
|
||||
//radius, x y z, a
|
||||
void SWR_StainSurf (msurface_t *surf, float *parms)
|
||||
|
@ -100,8 +104,8 @@ void SWR_StainSurf (msurface_t *surf, float *parms)
|
|||
tmax = (surf->extents[1]>>4)+1;
|
||||
tex = surf->texinfo;
|
||||
|
||||
stainbase = stainmaps + surf->lightmaptexturenum*BLOCK_WIDTH*BLOCK_HEIGHT;
|
||||
stainbase += (surf->light_t * BLOCK_WIDTH + surf->light_s);
|
||||
stainbase = stainmaps + surf->lightmaptexturenum*LMBLOCK_WIDTH*LMBLOCK_HEIGHT;
|
||||
stainbase += (surf->light_t * LMBLOCK_WIDTH + surf->light_s);
|
||||
|
||||
|
||||
|
||||
|
@ -150,7 +154,7 @@ void SWR_StainSurf (msurface_t *surf, float *parms)
|
|||
surf->stained = true;
|
||||
}
|
||||
}
|
||||
stainbase += BLOCK_WIDTH;
|
||||
stainbase += LMBLOCK_WIDTH;
|
||||
}
|
||||
|
||||
if (surf->stained)
|
||||
|
@ -204,6 +208,9 @@ void SWR_AddStain(vec3_t org, float red, float green, float blue, float radius)
|
|||
physent_t *pe;
|
||||
int i;
|
||||
float parms[5];
|
||||
|
||||
SWR_AddDecal(org);
|
||||
|
||||
if (red != green && red != blue) //sw only does luminance of stain maps
|
||||
return; //a mix would look wrong.
|
||||
if (!r_stains.value || !cl.worldmodel)
|
||||
|
@ -274,10 +281,10 @@ void SWR_LessenStains(void)
|
|||
smax = (surf->extents[0]>>4)+1;
|
||||
tmax = (surf->extents[1]>>4)+1;
|
||||
|
||||
stain = stainmaps + surf->lightmaptexturenum*BLOCK_WIDTH*BLOCK_HEIGHT;
|
||||
stain += (surf->light_t * BLOCK_WIDTH + surf->light_s);
|
||||
stain = stainmaps + surf->lightmaptexturenum*LMBLOCK_WIDTH*LMBLOCK_HEIGHT;
|
||||
stain += (surf->light_t * LMBLOCK_WIDTH + surf->light_s);
|
||||
|
||||
stride = (BLOCK_WIDTH-smax);
|
||||
stride = (LMBLOCK_WIDTH-smax);
|
||||
|
||||
surf->stained = false;
|
||||
|
||||
|
@ -334,9 +341,9 @@ int SWAllocBlock (int w, int h, int *x, int *y)
|
|||
|
||||
for (texnum=0 ; texnum<MAX_LIGHTMAPS ; texnum++)
|
||||
{
|
||||
best = BLOCK_HEIGHT;
|
||||
best = LMBLOCK_HEIGHT;
|
||||
|
||||
for (i=0 ; i<BLOCK_WIDTH-w ; i++)
|
||||
for (i=0 ; i<LMBLOCK_WIDTH-w ; i++)
|
||||
{
|
||||
best2 = 0;
|
||||
|
||||
|
@ -354,7 +361,7 @@ int SWAllocBlock (int w, int h, int *x, int *y)
|
|||
}
|
||||
}
|
||||
|
||||
if (best + h > BLOCK_HEIGHT)
|
||||
if (best + h > LMBLOCK_HEIGHT)
|
||||
continue;
|
||||
|
||||
for (i=0 ; i<w ; i++)
|
||||
|
@ -401,6 +408,203 @@ void SWR_BuildLightmaps(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
//retrieves the next decal to be used, unlinking if needed.
|
||||
decal_t *R_GetFreeDecal(void)
|
||||
{
|
||||
decal_t *dec = &decals[nextdecal];
|
||||
if (dec->owner)
|
||||
{ //already in use.
|
||||
if (dec->prev)
|
||||
dec->prev->next = dec->next;
|
||||
else
|
||||
dec->owner->decal = dec->next;
|
||||
if (dec->next)
|
||||
dec->next->prev = dec->prev;
|
||||
|
||||
dec->owner->cached_dlight = -1; //get the surface to redraw.
|
||||
}
|
||||
nextdecal = (nextdecal+1)&(MAX_DECALS-1);
|
||||
|
||||
memset(dec, 0, sizeof(decal_t));
|
||||
|
||||
return dec;
|
||||
}
|
||||
|
||||
void R_WipeDecals(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
memset(decals, 0, sizeof(decals));
|
||||
for (i=0 ; i<cl.worldmodel->numsurfaces ; i++)
|
||||
cl.worldmodel->surfaces[i].decal = NULL;
|
||||
}
|
||||
|
||||
static vec3_t decalorg;
|
||||
static float decalradius;
|
||||
void SWR_AddSurfDecal (msurface_t *surf)
|
||||
{
|
||||
int sd, td;
|
||||
float dist, rad, minlight;
|
||||
vec3_t impact, local;
|
||||
int s, t;
|
||||
int i;
|
||||
int smax, tmax;
|
||||
float amm;
|
||||
mtexinfo_t *tex;
|
||||
decal_t *dec;
|
||||
decal_t *prev;
|
||||
|
||||
smax = (surf->extents[0]>>4)+1;
|
||||
tmax = (surf->extents[1]>>4)+1;
|
||||
tex = surf->texinfo;
|
||||
|
||||
rad = decalradius;
|
||||
dist = DotProduct (decalorg, surf->plane->normal) - surf->plane->dist;
|
||||
rad -= fabs(dist);
|
||||
minlight = 0;
|
||||
if (rad < minlight) //not hit
|
||||
return;
|
||||
minlight = rad - minlight;
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
impact[i] = decalorg[i] - surf->plane->normal[i]*dist;
|
||||
}
|
||||
|
||||
local[0] = DotProduct (impact, tex->vecs[0]) + tex->vecs[0][3];
|
||||
local[1] = DotProduct (impact, tex->vecs[1]) + tex->vecs[1][3];
|
||||
|
||||
local[0] -= surf->texturemins[0];
|
||||
local[1] -= surf->texturemins[1];
|
||||
|
||||
dec = R_GetFreeDecal();
|
||||
if (surf->decal) //add to the end of the linked list.
|
||||
{
|
||||
prev = surf->decal;
|
||||
while(prev->next)
|
||||
prev = prev->next;
|
||||
|
||||
prev->next = dec;
|
||||
dec->prev = prev;
|
||||
}
|
||||
else
|
||||
surf->decal = dec; //no list yet
|
||||
dec->owner = surf;
|
||||
surf->cached_dlight = -1;
|
||||
|
||||
dec->xpos = local[0];
|
||||
dec->ypos = local[1];
|
||||
}
|
||||
|
||||
void SWR_Q1BSP_AddNodeDecal (mnode_t *node)
|
||||
{
|
||||
mplane_t *splitplane;
|
||||
float dist;
|
||||
msurface_t *surf;
|
||||
int i;
|
||||
|
||||
if (node->contents < 0)
|
||||
return;
|
||||
|
||||
splitplane = node->plane;
|
||||
dist = DotProduct (decalorg, splitplane->normal) - splitplane->dist;
|
||||
|
||||
if (dist > (decalradius))
|
||||
{
|
||||
SWR_Q1BSP_AddNodeDecal (node->children[0]);
|
||||
return;
|
||||
}
|
||||
if (dist < (-decalradius))
|
||||
{
|
||||
SWR_Q1BSP_AddNodeDecal (node->children[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
// mark the polygons
|
||||
surf = cl.worldmodel->surfaces + node->firstsurface;
|
||||
for (i=0 ; i<node->numsurfaces ; i++, surf++)
|
||||
{
|
||||
if (surf->flags&~(SURF_DRAWTURB|SURF_PLANEBACK))
|
||||
continue;
|
||||
SWR_AddSurfDecal(surf);
|
||||
}
|
||||
|
||||
SWR_Q1BSP_AddNodeDecal (node->children[0]);
|
||||
SWR_Q1BSP_AddNodeDecal (node->children[1]);
|
||||
}
|
||||
|
||||
void SWR_AddDecal(vec3_t org)
|
||||
{
|
||||
VectorCopy(org, decalorg);
|
||||
decalradius = 320;
|
||||
SWR_Q1BSP_AddNodeDecal(cl.worldmodel->nodes+cl.worldmodel->hulls[0].firstclipnode);
|
||||
}
|
||||
|
||||
|
||||
void SWR_DrawDecal8(decal_t *dec)
|
||||
{
|
||||
mpic_t *srcpic = (mpic_t *)Draw_SafeCachePic ("gfx/conback.lmp");
|
||||
qbyte *srcimg = srcpic->data;
|
||||
int srcw=16, srch=16;
|
||||
int s, t;
|
||||
int stride; //horizontal pixels to copy
|
||||
int lines; //vertical pixels to copy
|
||||
|
||||
qbyte *dest = r_drawsurf.surfdat;
|
||||
int dw = r_drawsurf.surfwidth, dh = r_drawsurf.surfheight;
|
||||
|
||||
stride = dw;
|
||||
lines = dh;
|
||||
|
||||
s=0;t=0;
|
||||
/*
|
||||
s = dec->xpos - srcw/2;
|
||||
t = dec->ypos - srch/2;
|
||||
if (s < 0)
|
||||
{
|
||||
stride-=s;
|
||||
s = 0;
|
||||
}
|
||||
if (t < 0)
|
||||
{
|
||||
stride-=t;
|
||||
t = 0;
|
||||
}
|
||||
*/
|
||||
|
||||
//s and t are at the top left of the image.
|
||||
dest += s; //align to the left
|
||||
srcimg += s;
|
||||
for (t = 0; t < lines; t++)
|
||||
{
|
||||
for (s = 0; s < stride; s++)
|
||||
{
|
||||
dest[s] = srcimg[s];
|
||||
}
|
||||
dest += dw;
|
||||
srcimg += srcw;
|
||||
}
|
||||
|
||||
/*
|
||||
pixel_t *surfdat; // destination for generated surface
|
||||
int rowbytes; // destination logical width in bytes
|
||||
msurface_t *surf; // description for surface to generate
|
||||
fixed8_t lightadj[MAXLIGHTMAPS];
|
||||
// adjust for lightmap levels for dynamic lighting
|
||||
texture_t *texture; // corrected for animating textures
|
||||
int surfmip; // mipmapped ratio of surface texels / world pixels
|
||||
int surfwidth; // in mipmapped texels
|
||||
int surfheight; // in mipmapped texels
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_AddDynamicLights
|
||||
|
@ -603,10 +807,10 @@ void SWR_BuildLightMap (void)
|
|||
int x, y;
|
||||
int quant;
|
||||
|
||||
stain = stainmaps + surf->lightmaptexturenum*BLOCK_WIDTH*BLOCK_HEIGHT;
|
||||
stain += (surf->light_t * BLOCK_WIDTH + surf->light_s);
|
||||
stain = stainmaps + surf->lightmaptexturenum*LMBLOCK_WIDTH*LMBLOCK_HEIGHT;
|
||||
stain += (surf->light_t * LMBLOCK_WIDTH + surf->light_s);
|
||||
|
||||
sstride = BLOCK_WIDTH - smax;
|
||||
sstride = LMBLOCK_WIDTH - smax;
|
||||
|
||||
i=0;
|
||||
|
||||
|
@ -694,10 +898,10 @@ void SWR_BuildLightMapRGB (void)
|
|||
int sstride;
|
||||
int x, y;
|
||||
|
||||
stain = stainmaps + surf->lightmaptexturenum*BLOCK_WIDTH*BLOCK_HEIGHT;
|
||||
stain += (surf->light_t * BLOCK_WIDTH + surf->light_s);
|
||||
stain = stainmaps + surf->lightmaptexturenum*LMBLOCK_WIDTH*LMBLOCK_HEIGHT;
|
||||
stain += (surf->light_t * LMBLOCK_WIDTH + surf->light_s);
|
||||
|
||||
sstride = BLOCK_WIDTH - smax;
|
||||
sstride = LMBLOCK_WIDTH - smax;
|
||||
|
||||
i=0;
|
||||
|
||||
|
@ -863,16 +1067,17 @@ void R_DrawSurface (void)
|
|||
unsigned char *pcolumndest;
|
||||
void (*pblockdrawer)(void);
|
||||
texture_t *mt;
|
||||
decal_t *dec;
|
||||
|
||||
// calculate the lightings
|
||||
SWR_BuildLightMap ();
|
||||
|
||||
|
||||
surfrowbytes = r_drawsurf.rowbytes;
|
||||
|
||||
mt = r_drawsurf.texture;
|
||||
|
||||
|
||||
r_source = (qbyte *)mt + mt->offsets[r_drawsurf.surfmip];
|
||||
|
||||
|
||||
// the fractional light values should range from 0 to (VID_GRADES - 1) << 16
|
||||
// from a source range of 0 - 255
|
||||
|
||||
|
@ -897,7 +1102,7 @@ void R_DrawSurface (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
pblockdrawer = R_DrawSurfaceBlock16From8;
|
||||
pblockdrawer = R_DrawSurfaceBlock16From8;//16bit rendering uses 16bit caches.
|
||||
// TODO: only needs to be set when there is a display settings change
|
||||
horzblockstep = blocksize << 1;
|
||||
}
|
||||
|
@ -936,6 +1141,22 @@ void R_DrawSurface (void)
|
|||
|
||||
pcolumndest += horzblockstep;
|
||||
}
|
||||
|
||||
if (r_drawsurf.surf->decal && !r_drawsurf.surfmip)
|
||||
{
|
||||
if (r_pixbytes == 1 || r_pixbytes == 4)
|
||||
{
|
||||
for (dec = r_drawsurf.surf->decal; dec; dec = dec->next)
|
||||
{
|
||||
int x, y;
|
||||
x = rand()%smax;
|
||||
y = rand()%tmax;
|
||||
pcolumndest = r_drawsurf.surfdat;
|
||||
pcolumndest[y*smax+x] = 15;
|
||||
SWR_DrawDecal8(dec);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void R_DrawSurface32 (void)
|
||||
|
|
Loading…
Reference in a new issue