*** empty log message ***

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@894 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-03-07 08:58:26 +00:00
parent 061024cf36
commit 2621cc6aad
19 changed files with 263 additions and 102 deletions

View file

@ -2777,7 +2777,7 @@ void CL_SetInfo (void)
Con_DPrintf("SETINFO %s: %s=%s\n", player->name, key, value); Con_DPrintf("SETINFO %s: %s=%s\n", player->name, key, value);
Info_SetValueForStarKey (player->userinfo, key, value, MAX_INFO_STRING); Info_SetValueForStarKey (player->userinfo, key, value, sizeof(player->userinfo));
CL_ProcessUserInfo (slot, player); CL_ProcessUserInfo (slot, player);
} }

View file

@ -439,7 +439,6 @@ int VM_LerpTag(void *out, model_t *model, int f1, int f2, float l2, char *tagnam
#define MAX_RENDER_STRINGS 8 #define MAX_RENDER_STRINGS 8
#define MAX_RENDER_STRING_LENGTH 32 #define MAX_RENDER_STRING_LENGTH 32
#define MAX_MAP_AREA_BYTES 16
typedef struct q3refdef_s { typedef struct q3refdef_s {
int x, y, width, height; int x, y, width, height;
@ -508,7 +507,7 @@ void VQ3_RenderView(const q3refdef_t *ref)
#ifndef Q3CLIENT
typedef struct { typedef struct {
int handle; int handle;
int modificationCount; int modificationCount;
@ -516,6 +515,7 @@ typedef struct {
int integer; int integer;
char string[256]; char string[256];
} vmcvar_t; } vmcvar_t;
#endif
#ifndef _DEBUG #ifndef _DEBUG
static static

View file

@ -26,6 +26,7 @@ int menuentsize;
void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...); void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...);
void PF_cvar_string (progfuncs_t *prinst, struct globalvars_s *pr_globals); void PF_cvar_string (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals); void PF_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_print (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_dprint (progfuncs_t *prinst, struct globalvars_s *pr_globals); void PF_dprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_error (progfuncs_t *prinst, struct globalvars_s *pr_globals); void PF_error (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_rint (progfuncs_t *prinst, struct globalvars_s *pr_globals); void PF_rint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
@ -362,24 +363,6 @@ void PF_search_getfilename (progfuncs_t *prinst, struct globalvars_s *pr_globals
void PF_developerprint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *s;
if (!developer.value)
return;
s = PF_VarString(prinst, 0, pr_globals);
Con_Printf("%s", s);
}
void PF_print (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *s;
s = PF_VarString(prinst, 0, pr_globals);
Con_Printf("%s", s);
}
static void PF_cvar (progfuncs_t *prinst, struct globalvars_s *pr_globals) static void PF_cvar (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {
cvar_t *var; cvar_t *var;
@ -1123,7 +1106,7 @@ builtin_t menu_builtins[] = {
PF_localcmd,//13 PF_localcmd,//13
PF_cvar,//14 PF_cvar,//14
PF_cvar_set,//15 PF_cvar_set,//15
PF_developerprint,//16 PF_dprint,//16
PF_ftos,//17 PF_ftos,//17
PF_fabs,//18 PF_fabs,//18
PF_vtos,//19 PF_vtos,//19

View file

@ -4750,7 +4750,7 @@ void Info_SetValueForStarKey (char *s, char *key, char *value, int maxsize)
if (!value || !strlen(value)) if (!value || !strlen(value))
return; return;
sprintf (new, "\\%s\\%s", key, value); _snprintf (new, sizeof(new), "\\%s\\%s", key, value);
if ((int)(strlen(new) + strlen(s) + 1) > maxsize) if ((int)(strlen(new) + strlen(s) + 1) > maxsize)
{ {

View file

@ -32,8 +32,9 @@ typedef enum qboolean;//false and true are forcivly defined.
typedef enum {false, true} qboolean; typedef enum {false, true} qboolean;
#endif #endif
#define MAX_INFO_STRING 196 #define MAX_INFO_STRING 196 //regular quakeworld. Sickening isn't it.
#define MAX_SERVERINFO_STRING 512 #define EXTENDED_INFO_STRING 1024
#define MAX_SERVERINFO_STRING 1024 //standard quake has 512 here.
#define MAX_LOCALINFO_STRING 32768 #define MAX_LOCALINFO_STRING 32768
//============================================================================ //============================================================================

View file

@ -863,7 +863,7 @@ typedef struct q1usercmd_s
//ROGUE //ROGUE
#define MAX_MAP_AREA_BYTES 32
// edict->drawflags (hexen2 stuff) // edict->drawflags (hexen2 stuff)
#define MLS_MASKIN 7 // Model Light Style #define MLS_MASKIN 7 // Model Light Style

View file

@ -1039,6 +1039,17 @@ qboolean VM_Restart(vm_t *vm)
return VM_Create(vm, name, syscall, syscallex)!=NULL; return VM_Create(vm, name, syscall, syscallex)!=NULL;
} }
void *VM_MemoryBase(vm_t *vm)
{
switch(vm->type)
{
case VM_NATIVE:
return NULL;
case VM_BYTECODE:
return ((qvm_t*)vm->hInst)->ds;
}
}
/* /*
** VM_Call ** VM_Call
*/ */

View file

@ -1,13 +1,7 @@
//these structures are shared with the exe. //these structures are shared with the exe.
#define UIMAX_SCOREBOARDNAME 16 #define UIMAX_SCOREBOARDNAME 16
#define UIMAX_INFO_STRING 196 #define UIMAX_INFO_STRING EXTENDED_INFO_STRING
#ifdef UIMAX_INFO_STRING
#if MAX_INFO_STRING != UIMAX_INFO_STRING
#pragma message("MAX_INFO_STRING doesn't match UIMAX_INFO_STRING")
#endif
#endif
typedef struct { typedef struct {
int userid; int userid;

View file

@ -356,7 +356,7 @@ LINK32=link.exe
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE 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" /D "Q3CLIENT" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c # ADD BASE 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" /D "Q3CLIENT" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c
# SUBTRACT BASE CPP /X # SUBTRACT BASE CPP /X
# ADD CPP /nologo /G5 /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" /D "Q3CLIENT" /Fp".\GLDebugQ3/qwcl.pch" /Yu"quakedef.h" /Fo".\GLDebugQ3/" /Fd".\GLDebugQ3/" /FD /c # ADD CPP /nologo /G5 /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" /D "Q3CLIENT" /D "Q3SERVER" /FR /Fp".\GLDebugQ3/qwcl.pch" /Yu"quakedef.h" /Fo".\GLDebugQ3/" /Fd".\GLDebugQ3/" /FD /c
# 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
# ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD BASE RSC /l 0x809 /d "_DEBUG"
@ -367,7 +367,8 @@ BSC32=bscmake.exe
LINK32=link.exe LINK32=link.exe
# ADD BASE 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:".\GLDebug/dglqwcl.pdb" /debug /machine:I386 /out:"../../fteglqw_dbg.exe" # ADD BASE 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:".\GLDebug/dglqwcl.pdb" /debug /machine:I386 /out:"../../fteglqw_dbg.exe"
# SUBTRACT BASE LINK32 /pdb:none # SUBTRACT BASE LINK32 /pdb:none
# 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:"../../fteglqw_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:"../../fteglqw_dbg.exe"
# SUBTRACT LINK32 /pdb:none
!ENDIF !ENDIF
@ -488,6 +489,59 @@ SOURCE=..\server\svq2_game.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\server\svq3_game.c
!IF "$(CFG)" == "ftequake - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\server\world.c SOURCE=..\server\world.c
# ADD CPP /Yu"qwsvdef.h" # ADD CPP /Yu"qwsvdef.h"
# End Source File # End Source File
@ -581,6 +635,8 @@ SOURCE=..\client\cl_cg.c
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug" !ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease" !ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease"
# PROP Exclude_From_Build 1 # PROP Exclude_From_Build 1
@ -1033,6 +1089,8 @@ SOURCE=..\client\clq3_parse.c
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug" !ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease" !ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease"
# PROP Exclude_From_Build 1 # PROP Exclude_From_Build 1

View file

@ -1056,6 +1056,7 @@ void R_SetFrustum (void)
if ((int)r_novis.value & 4) if ((int)r_novis.value & 4)
return; return;
/* removed - assumes fov_x == fov_y
if (r_refdef.fov_x == 90) if (r_refdef.fov_x == 90)
{ {
// front side is visible // front side is visible
@ -1067,6 +1068,7 @@ void R_SetFrustum (void)
VectorSubtract (vpn, vup, frustum[3].normal); VectorSubtract (vpn, vup, frustum[3].normal);
} }
else else
*/
{ {
// rotate VPN right by FOV_X/2 degrees // rotate VPN right by FOV_X/2 degrees

View file

@ -573,14 +573,14 @@ void R_Set2DFrustum (void)
viewang[2] = 0; viewang[2] = 0;
AngleVectors (viewang, vpn, vright, vup); AngleVectors (viewang, vpn, vright, vup);
if (r_refdef.fov_x == 90) /* if (r_refdef.fov_x == 90)
{ {
// front side is visible // front side is visible
VectorAdd (vpn, vright, frustum2d[0].normal); VectorAdd (vpn, vright, frustum2d[0].normal);
VectorSubtract (vpn, vright, frustum2d[1].normal); VectorSubtract (vpn, vright, frustum2d[1].normal);
} }
else else*/
{ {
// rotate VPN right by FOV_X/2 degrees // rotate VPN right by FOV_X/2 degrees

View file

@ -41,7 +41,7 @@ sizebuf_t *NQWriteDest (int dest);
void NPP_SetInfo(client_t *cl, char *key, char *value) void NPP_SetInfo(client_t *cl, char *key, char *value)
{ {
int i; int i;
Info_SetValueForKey (cl->userinfo, key, value, MAX_INFO_STRING); Info_SetValueForKey (cl->userinfo, key, value, sizeof(cl->userinfo));
if (!*Info_ValueForKey (cl->userinfo, "name")) if (!*Info_ValueForKey (cl->userinfo, "name"))
cl->name[0] = '\0'; cl->name[0] = '\0';
else // process any changed values else // process any changed values

View file

@ -42,7 +42,7 @@ typedef struct pmove_s pmove_t;
#define GAME_API_VERSION 3 #define Q2GAME_API_VERSION 3
// edict->svflags // edict->svflags

View file

@ -292,6 +292,19 @@ typedef struct //merge?
int senttime; // for ping calculations int senttime; // for ping calculations
} q2client_frame_t; } q2client_frame_t;
#endif #endif
#ifdef Q3SERVER
#include "clq3defs.h"
typedef struct //merge?
{
int flags;
int areabytes;
qbyte areabits[MAX_Q2MAP_AREAS/8]; // portalarea visibility bits
q3playerState_t ps;
int num_entities;
int first_entity; // into the circular sv_packet_entities[]
int senttime; // for ping calculations
} q3client_frame_t;
#endif
#define MAXCACHEDSOUNDBUFFERS 8 #define MAXCACHEDSOUNDBUFFERS 8
typedef struct { typedef struct {
@ -336,8 +349,9 @@ typedef struct client_s
qboolean drop; // lose this guy next opportunity qboolean drop; // lose this guy next opportunity
int lossage; // loss percentage int lossage; // loss percentage
int challenge;
int userid; // identifying number int userid; // identifying number
char userinfo[MAX_INFO_STRING]; // infostring char userinfo[EXTENDED_INFO_STRING]; // infostring
usercmd_t lastcmd; // for filling in big drops and partial predictions usercmd_t lastcmd; // for filling in big drops and partial predictions
double localtime; // of last message double localtime; // of last message
@ -392,6 +406,9 @@ typedef struct client_s
client_frame_t *frames; // updates can be deltad from here client_frame_t *frames; // updates can be deltad from here
#ifdef Q2SERVER #ifdef Q2SERVER
q2client_frame_t *q2frames; q2client_frame_t *q2frames;
#endif
#ifdef Q3SERVER
q3client_frame_t *q3frames;
#endif #endif
}; };
FILE *download; // file being downloaded FILE *download; // file being downloaded
@ -400,6 +417,15 @@ typedef struct client_s
int spec_track; // entnum of player tracking int spec_track; // entnum of player tracking
#ifdef Q3SERVER
int gamestatesequence; //the sequence number the initial gamestate was sent in.
int last_server_command_num;
int last_client_command_num;
int num_server_commands;
int num_client_commands;
char server_commands[1024][64];
char last_client_command[1024];
#endif
#ifdef PEXT_CSQC #ifdef PEXT_CSQC
int csqclastsentsequence; int csqclastsentsequence;
int csqcentsequence[MAX_EDICTS];//the sequence number a csqc entity was sent in int csqcentsequence[MAX_EDICTS];//the sequence number a csqc entity was sent in
@ -427,6 +453,7 @@ typedef struct client_s
//===== NETWORK ============ //===== NETWORK ============
int chokecount; int chokecount;
int delta_sequence; // -1 = no compression int delta_sequence; // -1 = no compression
int last_sequence;
netchan_t netchan; netchan_t netchan;
int lastsequence_acknoledged; int lastsequence_acknoledged;
@ -618,8 +645,15 @@ typedef struct levelcache_s {
char *mapname; char *mapname;
} levelcache_t; } levelcache_t;
typedef enum {
GT_PROGS, //q1, qw, h2 are similar enough that we consider it only one game mode. (We don't support the h2 protocol)
GT_QUAKE2, //q2 servers run from a q2 game dll
GT_QUAKE3 //q3 servers run off the q3 qvm api
} gametype_e;
typedef struct typedef struct
{ {
gametype_e gametype;
int spawncount; // number of servers spawned since start, int spawncount; // number of servers spawned since start,
// used to check late spawns // used to check late spawns

View file

@ -474,6 +474,8 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
func_t f; func_t f;
char *file; char *file;
gametype_e oldgametype;
edict_t *ent; edict_t *ent;
#ifdef Q2SERVER #ifdef Q2SERVER
q2edict_t *q2ent; q2edict_t *q2ent;
@ -699,35 +701,44 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
svprogfuncs = NULL; svprogfuncs = NULL;
} }
sv.state = ss_loading;
oldgametype = svs.gametype;
#ifdef Q3SERVER
if (SVQ3_InitGame())
svs.gametype = GT_QUAKE3;
else
#endif
#ifdef Q2SERVER #ifdef Q2SERVER
if ((sv.worldmodel->fromgame == fg_quake2 || sv.worldmodel->fromgame == fg_quake3) && !*progs.string && SVQ2_InitGameProgs()) //full q2 dll decision in one if statement if ((sv.worldmodel->fromgame == fg_quake2 || sv.worldmodel->fromgame == fg_quake3) && !*progs.string && SVQ2_InitGameProgs()) //these are the rules for running a q2 server
{ //quake2 game support depends upon q2 style bsp clipping (fixable if we tried) also, don't use q2 dlls if a progs.dat was specified. svs.gametype = GT_QUAKE2; //we loaded the dll
for (i=0 ; i<MAX_CLIENTS ; i++) //we need to drop all non-q2 clients. We don't mix q1w with q2.
{
if (!svs.clients[i].isq2client && svs.clients[i].state)
SV_DropClient(&svs.clients[i]);
}
}
else else
#endif #endif
{ {
for (i=0 ; i<MAX_CLIENTS ; i++) //we need to drop all q2 clients. We don't mix q1w with q2. svs.gametype = GT_PROGS; //let's just hope this loads.
{ Q_InitProgs();
if (svs.clients[i].isq2client && svs.clients[i].state)
SV_DropClient(&svs.clients[i]);
} }
#ifdef Q3SERVER
if (svs.gametype != GT_QUAKE3)
SVQ3_ShutdownGame();
#endif
#ifdef Q2SERVER #ifdef Q2SERVER
if (ge) //we don't want the q2 stuff anymore. if (svs.gametype != GT_QUAKE2) //we don't want the q2 stuff anymore.
{
SVQ2_ShutdownGameProgs (); SVQ2_ShutdownGameProgs ();
ge = NULL;
}
#endif #endif
//load the progs. // if ((sv.worldmodel->fromgame == fg_quake2 || sv.worldmodel->fromgame == fg_quake3) && !*progs.string && SVQ2_InitGameProgs()) //full q2 dll decision in one if statement
sv.state = ss_loading;
Q_InitProgs(); if (oldgametype != svs.gametype)
{
for (i=0 ; i<MAX_CLIENTS ; i++) //server type changed, so we need to drop all clients. :(
{
if (svs.clients[i].state)
SV_DropClient(&svs.clients[i]);
svs.clients[i].name[0] = '\0'; //kill all bots
}
} }
#ifndef SERVERONLY #ifndef SERVERONLY
@ -735,8 +746,9 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
SCR_BeginLoadingPlaque(); SCR_BeginLoadingPlaque();
#endif #endif
if (svprogfuncs) switch (svs.gametype)
{ {
case GT_PROGS:
ent = EDICT_NUM(svprogfuncs, 0); ent = EDICT_NUM(svprogfuncs, 0);
ent->isfree = false; ent->isfree = false;
@ -767,10 +779,9 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
sv.csqcentversion[i] = 1; //force all csqc edicts to start off as version 1 sv.csqcentversion[i] = 1; //force all csqc edicts to start off as version 1
#endif #endif
} break;
#ifdef Q2SERVER #ifdef Q2SERVER
else case GT_QUAKE2:
{
for (i=0 ; i<MAX_CLIENTS ; i++) for (i=0 ; i<MAX_CLIENTS ; i++)
{ {
q2ent = Q2EDICT_NUM(i+1); q2ent = Q2EDICT_NUM(i+1);
@ -778,8 +789,9 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
svs.clients[i].q2edict = q2ent; svs.clients[i].q2edict = q2ent;
} }
sv.allocated_client_slots = i; sv.allocated_client_slots = i;
} break;
#endif #endif
}
#ifndef SERVERONLY #ifndef SERVERONLY
current_loading_size+=10; current_loading_size+=10;
@ -834,7 +846,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
if (eval) eval->_float = deathmatch.value; if (eval) eval->_float = deathmatch.value;
} }
eval = PR_FindGlobal(svprogfuncs, "randomclass", 0); eval = PR_FindGlobal(svprogfuncs, "randomclass", 0);
if (eval) eval->_float = 1; if (eval) eval->_float = Cvar_Get("randomclass", "1", CVAR_LATCH, "Hexen2 rules")->value;
eval = PR_FindGlobal(svprogfuncs, "cl_playerclass", 0); eval = PR_FindGlobal(svprogfuncs, "cl_playerclass", 0);
if (eval) eval->_float = 1; if (eval) eval->_float = 1;
@ -902,24 +914,34 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
char crc[12]; char crc[12];
sprintf(crc, "%i", CRC_Block(file, com_filesize)); sprintf(crc, "%i", CRC_Block(file, com_filesize));
Info_SetValueForStarKey(svs.info, "*entfile", crc, MAX_SERVERINFO_STRING); Info_SetValueForStarKey(svs.info, "*entfile", crc, MAX_SERVERINFO_STRING);
if (svprogfuncs) switch(svs.gametype)
{
case GT_PROGS:
pr_edict_size = PR_LoadEnts(svprogfuncs, file, spawnflagmask); pr_edict_size = PR_LoadEnts(svprogfuncs, file, spawnflagmask);
break;
#ifdef Q2SERVER #ifdef Q2SERVER
else case GT_QUAKE2:
ge->SpawnEntities(sv.name, file, startspot?startspot:""); ge->SpawnEntities(sv.name, file, startspot?startspot:"");
break;
#endif #endif
}
BZ_Free(file); BZ_Free(file);
} }
else else
{ {
Info_SetValueForStarKey(svs.info, "*entfile", "", MAX_SERVERINFO_STRING); Info_SetValueForStarKey(svs.info, "*entfile", "", MAX_SERVERINFO_STRING);
if (svprogfuncs) switch(svs.gametype)
{
case GT_PROGS:
pr_edict_size = PR_LoadEnts(svprogfuncs, sv.worldmodel->entities, spawnflagmask); pr_edict_size = PR_LoadEnts(svprogfuncs, sv.worldmodel->entities, spawnflagmask);
break;
#ifdef Q2SERVER #ifdef Q2SERVER
else case GT_QUAKE2:
ge->SpawnEntities(sv.name, sv.worldmodel->entities, startspot?startspot:""); ge->SpawnEntities(sv.name, sv.worldmodel->entities, startspot?startspot:"");
break;
#endif #endif
} }
}
#ifndef SERVERONLY #ifndef SERVERONLY
current_loading_size+=10; current_loading_size+=10;

View file

@ -845,14 +845,22 @@ void SVC_GetChallenge (void)
char *buf; char *buf;
int lng; int lng;
char *over; char *over;
if (!svprogfuncs)//htons(net_from.port) == PORT_CLIENT) //quake 2 client port - this is a hack based on an evil assumtion.
#ifdef Q3SERVER
if (svs.gametype == GT_QUAKE3) //q3 servers
buf = va("challengeResponse %i", svs.challenges[i].challenge);
else
#endif
#ifdef Q2SERVER
if (svs.gametype == GT_QUAKE2) //quake 2 servers give a different challenge responce
buf = va("challenge %i", svs.challenges[i].challenge); buf = va("challenge %i", svs.challenges[i].challenge);
else else
#endif
buf = va("%c%i", S2C_CHALLENGE, svs.challenges[i].challenge); buf = va("%c%i", S2C_CHALLENGE, svs.challenges[i].challenge);
over = buf + strlen(buf) + 1; over = buf + strlen(buf) + 1;
if (svprogfuncs) if (svs.gametype == GT_PROGS)
{ {
#ifdef PROTOCOL_VERSION_FTE #ifdef PROTOCOL_VERSION_FTE
//tell the client what fte extensions we support //tell the client what fte extensions we support
@ -1048,6 +1056,21 @@ void VARGS SV_OutOfBandTPrintf (int q2, netadr_t adr, int language, translation_
Netchan_OutOfBand (NS_SERVER, adr, strlen(string), (qbyte *)string); Netchan_OutOfBand (NS_SERVER, adr, strlen(string), (qbyte *)string);
} }
qboolean SV_ChallengePasses(int challenge)
{
int i;
for (i=0 ; i<MAX_CHALLENGES ; i++)
{ //one per ip.
if (NET_CompareBaseAdr (net_from, svs.challenges[i].adr))
{
if (challenge == svs.challenges[i].challenge)
return true;
return false;
}
}
return false;
}
/* /*
================== ==================
SVC_DirectConnect SVC_DirectConnect
@ -1164,13 +1187,10 @@ void SVC_DirectConnect
if (sv.msgfromdemo || net_from.type == NA_LOOPBACK) //normal rules don't apply if (sv.msgfromdemo || net_from.type == NA_LOOPBACK) //normal rules don't apply
i=0; i=0;
else else
{
// see if the challenge is valid // see if the challenge is valid
for (i=0 ; i<MAX_CHALLENGES ; i++) if (!SV_ChallengePasses(challenge))
{ {
if (NET_CompareBaseAdr (net_from, svs.challenges[i].adr))
{
if (challenge == svs.challenges[i].challenge)
break; // good
SV_OutOfBandPrintf (isquake2client, net_from, "\nBad challenge.\n"); SV_OutOfBandPrintf (isquake2client, net_from, "\nBad challenge.\n");
return; return;
} }
@ -1196,7 +1216,7 @@ void SVC_DirectConnect
return; return;
} }
Info_RemoveKey (userinfo[0], "spectator"); // remove key Info_RemoveKey (userinfo[0], "spectator"); // remove key
Info_SetValueForStarKey (userinfo[0], "*spectator", "1", MAX_INFO_STRING); Info_SetValueForStarKey (userinfo[0], "*spectator", "1", sizeof(userinfo[0]));
spectator = true; spectator = true;
} }
else else
@ -1685,7 +1705,7 @@ void SVC_DirectConnect
if (spectator) if (spectator)
{ {
Info_RemoveKey (cl->userinfo, "spectator"); Info_RemoveKey (cl->userinfo, "spectator");
Info_SetValueForStarKey (cl->userinfo, "*spectator", "1", MAX_INFO_STRING); Info_SetValueForStarKey (cl->userinfo, "*spectator", "1", sizeof(cl->userinfo));
} }
else else
Info_RemoveKey (cl->userinfo, "*spectator"); Info_RemoveKey (cl->userinfo, "*spectator");
@ -1803,7 +1823,7 @@ void SVNQ_CheckForNewClients(void)
{ {
cl->state = cs_connected; //this is a real player cl->state = cs_connected; //this is a real player
*cl->userinfo = '\0'; *cl->userinfo = '\0';
Info_SetValueForKey(cl->userinfo, "name", "unnamed", MAX_INFO_STRING); Info_SetValueForKey(cl->userinfo, "name", "unnamed", sizeof(cl->userinfo));
SV_ExtractFromUserinfo(cl); SV_ExtractFromUserinfo(cl);
if (pr_global_struct->SetNewParms) if (pr_global_struct->SetNewParms)
@ -1998,6 +2018,14 @@ qboolean SV_ConnectionlessPacket (void)
SVC_InfoQ2 (); SVC_InfoQ2 ();
else if (!strncmp(c,"connect", 7)) else if (!strncmp(c,"connect", 7))
{ {
#ifdef Q3SERVER
if (svs.gametype == GT_QUAKE3)
{
SVQ3_DirectConnect();
return true;
}
else
#endif
if (secure.value) //FIXME: possible problem for nq clients when enabled if (secure.value) //FIXME: possible problem for nq clients when enabled
Netchan_OutOfBandPrint (NS_SERVER, net_from, "%c\nThis server requires client validation.\nPlease use the "DISTRIBUTION" validation program\n", A2C_PRINT); Netchan_OutOfBandPrint (NS_SERVER, net_from, "%c\nThis server requires client validation.\nPlease use the "DISTRIBUTION" validation program\n", A2C_PRINT);
else else
@ -2433,6 +2461,14 @@ void SV_ReadPackets (void)
continue; continue;
} }
#ifdef Q3SERVER
if (svs.gametype == GT_QUAKE3)
{
SVQ3_HandleClient();
continue;
}
#endif
// read the qport out of the message so we can fix up // read the qport out of the message so we can fix up
// stupid address translating routers // stupid address translating routers
MSG_BeginReading (); MSG_BeginReading ();
@ -3310,7 +3346,7 @@ void SV_ExtractFromUserinfo (client_t *cl)
else else
{ {
Info_SetValueForKey (cl->userinfo, "name", newname, MAX_INFO_STRING); Info_SetValueForKey (cl->userinfo, "name", newname, sizeof(cl->userinfo));
if (!sv.paused) { if (!sv.paused) {
if (!cl->lastnametime || realtime - cl->lastnametime > 5) { if (!cl->lastnametime || realtime - cl->lastnametime > 5) {
cl->lastnamecount = 0; cl->lastnamecount = 0;
@ -3342,7 +3378,7 @@ void SV_ExtractFromUserinfo (client_t *cl)
} }
} }
Info_SetValueForKey(cl->userinfo, "name", newname, MAX_INFO_STRING); Info_SetValueForKey(cl->userinfo, "name", newname, sizeof(cl->userinfo));
val = Info_ValueForKey (cl->userinfo, "lang"); val = Info_ValueForKey (cl->userinfo, "lang");
cl->language = atoi(val); cl->language = atoi(val);
@ -3494,6 +3530,8 @@ void SV_Init (quakeparms_t *parms)
Cmd_StuffCmds(); Cmd_StuffCmds();
Cbuf_Execute ();
// if a map wasn't specified on the command line, spawn start.map // if a map wasn't specified on the command line, spawn start.map
if (sv.state == ss_dead) if (sv.state == ss_dead)
Cmd_ExecuteString ("map start", RESTRICT_LOCAL); Cmd_ExecuteString ("map start", RESTRICT_LOCAL);

View file

@ -1940,8 +1940,8 @@ qboolean SV_Physics (void)
edict_t *ent; edict_t *ent;
static double old_time; static double old_time;
#ifdef Q2SERVER
if (!svprogfuncs) //make tics multiples of sv_maxtic (defaults to 0.1) if (svs.gametype != GT_PROGS) //make tics multiples of sv_maxtic (defaults to 0.1)
{ {
host_frametime = realtime - old_time; host_frametime = realtime - old_time;
if (host_frametime < sv_maxtic.value && realtime) if (host_frametime < sv_maxtic.value && realtime)
@ -1956,10 +1956,24 @@ qboolean SV_Physics (void)
sv.framenum++; sv.framenum++;
sv.time = sv.framenum*100; sv.time = sv.framenum*100;
switch(svs.gametype)
{
#ifdef Q2SERVER
case GT_QUAKE2:
ge->RunFrame(); ge->RunFrame();
break;
#endif
#ifdef Q3SERVER
case GT_QUAKE3:
SVQ3_RunFrame();
break;
#endif
default:
break;
}
return false; return false;
} }
#endif
// don't bother running a frame if sys_ticrate seconds haven't passed // don't bother running a frame if sys_ticrate seconds haven't passed
host_frametime = realtime - old_time; host_frametime = realtime - old_time;

View file

@ -1583,6 +1583,10 @@ void SV_BeginDownload_f(void)
name = Cmd_Argv(1); name = Cmd_Argv(1);
if (!strncmp(name, "demonum/", 8))
name = SV_MVDNum(atoi(name+8));
// hacked by zoid to allow more conrol over download // hacked by zoid to allow more conrol over download
if (!SV_AllowDownload(name)) if (!SV_AllowDownload(name))
{ // don't allow anything with .. path { // don't allow anything with .. path
@ -2202,7 +2206,7 @@ void SV_SetInfo_f (void)
strcpy(oldval, Info_ValueForKey(host_client->userinfo, Cmd_Argv(1))); strcpy(oldval, Info_ValueForKey(host_client->userinfo, Cmd_Argv(1)));
Info_SetValueForKey (host_client->userinfo, Cmd_Argv(1), Cmd_Argv(2), MAX_INFO_STRING); Info_SetValueForKey (host_client->userinfo, Cmd_Argv(1), Cmd_Argv(2), sizeof(host_client->userinfo));
// name is extracted below in ExtractFromUserInfo // name is extracted below in ExtractFromUserInfo
// strncpy (host_client->name, Info_ValueForKey (host_client->userinfo, "name") // strncpy (host_client->name, Info_ValueForKey (host_client->userinfo, "name")
// , sizeof(host_client->name)-1); // , sizeof(host_client->name)-1);
@ -2743,7 +2747,7 @@ void Cmd_Observe_f (void)
// turn the player into a spectator // turn the player into a spectator
host_client->spectator = true; host_client->spectator = true;
Info_SetValueForStarKey (host_client->userinfo, "*spectator", "1", MAX_INFO_STRING); Info_SetValueForStarKey (host_client->userinfo, "*spectator", "1", sizeof(host_client->userinfo));
// FIXME, bump the client's userid? // FIXME, bump the client's userid?
@ -3261,18 +3265,18 @@ void SVNQ_NQColour_f (void)
if (progstype != PROG_QW) if (progstype != PROG_QW)
host_client->edict->v.team = bottom + 1; host_client->edict->v.team = bottom + 1;
Info_SetValueForKey(host_client->userinfo, "topcolor", va("%i", top), MAX_INFO_STRING); Info_SetValueForKey(host_client->userinfo, "topcolor", va("%i", top), sizeof(host_client->userinfo));
Info_SetValueForKey(host_client->userinfo, "bottomcolor", va("%i", bottom), MAX_INFO_STRING); Info_SetValueForKey(host_client->userinfo, "bottomcolor", va("%i", bottom), sizeof(host_client->userinfo));
switch(bottom) switch(bottom)
{ {
case 4: case 4:
Info_SetValueForKey(host_client->userinfo, "team", "red", MAX_INFO_STRING); Info_SetValueForKey(host_client->userinfo, "team", "red", sizeof(host_client->userinfo));
break; break;
case 14: case 14:
Info_SetValueForKey(host_client->userinfo, "team", "blue", MAX_INFO_STRING); Info_SetValueForKey(host_client->userinfo, "team", "blue", sizeof(host_client->userinfo));
break; break;
default: default:
Info_SetValueForKey(host_client->userinfo, "team", va("t%i", bottom+1), MAX_INFO_STRING); Info_SetValueForKey(host_client->userinfo, "team", va("t%i", bottom+1), sizeof(host_client->userinfo));
break; break;
} }

View file

@ -729,9 +729,9 @@ qboolean SVQ2_InitGameProgs(void)
if (!ge) if (!ge)
return false; return false;
if (ge->apiversion != GAME_API_VERSION) if (ge->apiversion != Q2GAME_API_VERSION)
{ {
Con_Printf("game is version %i, not %i", ge->apiversion, GAME_API_VERSION); Con_Printf("game is version %i, not %i", ge->apiversion, Q2GAME_API_VERSION);
SVQ2_ShutdownGameProgs(); SVQ2_ShutdownGameProgs();
return false; return false;
} }