diff --git a/common/cmd.c b/common/cmd.c index 2762c1e..bf1b9ad 100644 --- a/common/cmd.c +++ b/common/cmd.c @@ -21,13 +21,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // cmd.c -- Quake script command processing module -#include "quakedef.h" #include "common.h" #include "cmd.h" #include "console.h" #include "cvar.h" #include "sys.h" #include "client.h" +#include +#include +#include +#include void Cmd_ForwardToServer (void); diff --git a/common/crc.c b/common/crc.c index 268f8b1..eea4ff4 100644 --- a/common/crc.c +++ b/common/crc.c @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* crc.c */ -#include "quakedef.h" +#include #include "crc.h" // this is a 16 bit, non-reflected CRC using the polynomial 0x1021 diff --git a/common/cvar.c b/common/cvar.c index 9462c68..170134f 100644 --- a/common/cvar.c +++ b/common/cvar.c @@ -22,18 +22,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // cvar.c -- dynamic variable tracking +#include #include "qtypes.h" +#include "qstructs.h" #include "lib_replace.h" #include "console.h" -#include "common.h" #include "cmd.h" #include "client.h" - -#ifdef SERVERONLY -#include "qwsvdef.h" -#else -#include "quakedef.h" +#ifdef UQUAKE +#include "server.h" #endif +#include cvar_t *cvar_vars; char *cvar_null_string = ""; @@ -124,6 +123,7 @@ void SV_SendServerInfoChange(char *key, char *value); Cvar_Set ============ */ +#if defined(QUAKEWORLD) void Cvar_Set (char *var_name, char *value) { cvar_t *var; @@ -160,6 +160,33 @@ void Cvar_Set (char *var_name, char *value) Q_strcpy (var->string, value); var->value = Q_atof (var->string); } +#elif defined(UQUAKE) +void Cvar_Set (char *var_name, char *value) +{ + cvar_t *var; + qboolean changed; + + var = Cvar_FindVar (var_name); + if (!var) + { // there is an error in C code if this happens + Con_Printf ("Cvar_Set: variable %s not found\n", var_name); + return; + } + + changed = Q_strcmp(var->string, value); + + Z_Free (var->string); // free the old value string + + var->string = Z_Malloc (Q_strlen(value)+1); + Q_strcpy (var->string, value); + var->value = Q_atof (var->string); + if (var->server && changed) + { + if (sv.active) + SV_BroadcastPrintf ("\"%s\" changed to \"%s\"\n", var->name, var->string); + } +} +#endif /* ============ diff --git a/common/pr_comp.h b/common/pr_comp.h index 478d469..210c068 100644 --- a/common/pr_comp.h +++ b/common/pr_comp.h @@ -22,6 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // this file is shared by quake and qcc +#ifndef _PR_COMP_H +#define _PR_COMP_H + typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t; @@ -177,3 +180,4 @@ typedef struct int entityfields; } dprograms_t; +#endif // _PR_COMP_H diff --git a/common/progs.h b/common/progs.h index 6269d12..97bae8f 100644 --- a/common/progs.h +++ b/common/progs.h @@ -20,6 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _PROGS_H +#define _PROGS_H + #include "pr_comp.h" // defs shared with qcc #include "progdefs.h" // generated by program cdefs @@ -148,3 +151,4 @@ extern int num_prstr; char *PR_GetString(int num); int PR_SetString(char *s); +#endif // _PROGS_H diff --git a/common/qdefs.h b/common/qdefs.h index b9aa922..246faa1 100644 --- a/common/qdefs.h +++ b/common/qdefs.h @@ -25,13 +25,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -#define MAX_QPATH 64 +#define MAX_QPATH 64 #define MAX_CL_STATS 32 -#define NUM_CSHIFTS 4 -#define MAX_MODELS 256 -#define MAX_SOUNDS 256 +#define NUM_CSHIFTS 4 +#define MAX_MODELS 256 +#define MAX_SOUNDS 256 #define MAX_SCOREBOARDNAME 32 -#define MAX_NUM_ARGVS 50 -#define NUM_SAFE_ARGVS 7 +#define MAX_NUM_ARGVS 50 +#define NUM_SAFE_ARGVS 7 +#define MAX_STYLESTRING 64 +#define MAX_EDICTS 768 +#define MAX_LIGHTSTYLES 64 +#define MAX_DATAGRAM 1450 +#define MAX_MSGLEN 1450 + +#define clc_stringcmd 4 #endif // _QDEFS_H diff --git a/common/qstructs.h b/common/qstructs.h index caefe6f..a2eee29 100644 --- a/common/qstructs.h +++ b/common/qstructs.h @@ -51,6 +51,7 @@ typedef struct cvar_s char *string; qboolean archive; // set to true to cause it to be saved to vars.rc qboolean info; // added to serverinfo or userinfo when changed + qboolean server; // notifies players when changed (UQUAKE) float value; struct cvar_s *next; } cvar_t; diff --git a/uquake/Makefile.in b/uquake/Makefile.in index 1473146..de9189f 100644 --- a/uquake/Makefile.in +++ b/uquake/Makefile.in @@ -214,7 +214,7 @@ CL_COMMON_SRC = $(MISC_SRC) $(CL_GUI_SRC) $(CL_SRC) \ # DEFS = @DEFS@ CFLAGS = @CFLAGS@ $(OPTFLAGS) $(DEFS) -I. $(SRC_DIR_INC) \ --I$(COMMON_ODIR) -I$(COMMON_DIR) +-I$(COMMON_ODIR) -I$(COMMON_DIR) -DUQUAKE GENERAL_SRC = $(CL_COMMON_SRC) \ $(SYS_SRC) chasecam.c world.c $(SRV_PR_SRC) \ diff --git a/uquake/client.h b/uquake/client.h index 988d797..36f2359 100644 --- a/uquake/client.h +++ b/uquake/client.h @@ -21,6 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _CLIENT_H #define _CLIENT_H + +#include +#include +#include + typedef struct { vec3_t viewangles; @@ -49,12 +54,6 @@ typedef struct byte translations[VID_GRADES*256]; } scoreboard_t; -typedef struct -{ - int destcolor[3]; - int percent; // 0-256 -} cshift_t; - #define CSHIFT_CONTENTS 0 #define CSHIFT_DAMAGE 1 #define CSHIFT_BONUS 2 @@ -143,99 +142,6 @@ typedef struct extern client_static_t cls; -// -// the client_state_t structure is wiped completely at every -// server signon -// -typedef struct -{ - int movemessages; // since connecting to this server - // throw out the first couple, so the player - // doesn't accidentally do something the - // first frame - usercmd_t cmd; // last command sent to the server - -// information for local display - int stats[MAX_CL_STATS]; // health, etc - int items; // inventory bit flags - float item_gettime[32];// cl.time of aquiring item, for blinking - float faceanimtime; // use anim frame if cl.time < this - - cshift_t cshifts[NUM_CSHIFTS]; // color shifts for damage, powerups - cshift_t prev_cshifts[NUM_CSHIFTS]; // and content types - -// the client maintains its own idea of view angles, which are -// sent to the server each frame. The server sets punchangle when -// the view is temporarliy offset, and an angle reset commands at the start -// of each level and after teleporting. - vec3_t mviewangles[2]; // during demo playback viewangles is lerped - // between these - vec3_t viewangles; - - vec3_t mvelocity[2]; // update by server, used for lean+bob - // (0 is newest) - vec3_t velocity; // lerped between mvelocity[0] and [1] - - vec3_t punchangle; // temporary offset - -// pitch drifting vars - float idealpitch; - float pitchvel; - qboolean nodrift; - float driftmove; - double laststop; - - float viewheight; - float crouch; // local amount for smoothing stepups - - qboolean paused; // send over by server - qboolean onground; - qboolean inwater; - - int intermission; // don't change view angle, full screen, etc - int completed_time; // latched at intermission start - - double mtime[2]; // the timestamp of last two messages - double time; // clients view of time, should be between - // servertime and oldservertime to generate - // a lerp point for other data - double oldtime; // previous cl.time, time-oldtime is used - // to decay light values and smooth step ups - - - float last_received_message; // (realtime) for net trouble icon - -// -// information that is static for the entire time connected to a server -// - struct model_s *model_precache[MAX_MODELS]; - struct sfx_s *sound_precache[MAX_SOUNDS]; - - char levelname[40]; // for display on solo scoreboard - int viewentity; // cl_entitites[cl.viewentity] = player - int maxclients; - int gametype; - -// refresh related state - struct model_s *worldmodel; // cl_entitites[0].model - struct efrag_s *free_efrags; - int num_entities; // held in cl_entities array - int num_statics; // held in cl_staticentities array - entity_t viewent; // the gun model - - int cdtrack, looptrack; // cd audio - -// frag scoreboard - scoreboard_t *scores; // [cl.maxclients] - -#ifdef QUAKE2 -// light level at player's position including dlights -// this is sent back to the server each frame -// architectually ugly but it works - int light_level; -#endif -} client_state_t; - // // cvars @@ -278,8 +184,6 @@ extern cvar_t _windowed_mouse; #define MAX_TEMP_ENTITIES 64 // lightning bolts, etc #define MAX_STATIC_ENTITIES 128 // torches, etc -extern client_state_t cl; - // FIXME, allocate dynamically extern efrag_t cl_efrags[MAX_EFRAGS]; extern entity_t cl_entities[MAX_EDICTS]; diff --git a/uquake/common.c b/uquake/common.c index f9984f0..f1e50df 100644 --- a/uquake/common.c +++ b/uquake/common.c @@ -22,8 +22,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // common.c -- misc functions used in client and server -#include "quakedef.h" #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #define NUM_SAFE_ARGVS 7 diff --git a/uquake/common.h b/uquake/common.h index 94af75f..bc6b198 100644 --- a/uquake/common.h +++ b/uquake/common.h @@ -19,17 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // comndef.h -- general definitions +#ifndef _COMMON_H +#define _COMMON_H + #include - -#if !defined BYTE_DEFINED -typedef unsigned char byte; -#define BYTE_DEFINED 1 -#endif - -#undef true -#undef false - -typedef enum {false, true} qboolean; +#include //============================================================================ @@ -134,23 +128,6 @@ float MSG_ReadAngle (void); //============================================================================ -void Q_memset (void *dest, int fill, int count); -void Q_memcpy (void *dest, void *src, int count); -int Q_memcmp (void *m1, void *m2, int count); -void Q_strcpy (char *dest, char *src); -void Q_strncpy (char *dest, char *src, int count); -int Q_strlen (char *str); -char *Q_strrchr (char *s, char c); -void Q_strcat (char *dest, char *src); -int Q_strcmp (char *s1, char *s2); -int Q_strncmp (char *s1, char *s2, int count); -int Q_strcasecmp (char *s1, char *s2); -int Q_strncasecmp (char *s1, char *s2, int n); -int Q_atoi (char *str); -float Q_atof (char *str); - -//============================================================================ - extern char com_token[1024]; extern qboolean com_eof; @@ -178,16 +155,11 @@ char *va(char *format, ...); extern int com_filesize; struct cache_user_s; -extern char com_gamedir[MAX_OSPATH]; - -void COM_WriteFile (char *filename, void *data, int len); -int COM_OpenFile (char *filename, int *hndl); -int COM_FOpenFile (char *filename, FILE **file); -void COM_CloseFile (int h); - byte *COM_LoadStackFile (char *path, void *buffer, int bufsize); byte *COM_LoadTempFile (char *path); byte *COM_LoadHunkFile (char *path); void COM_LoadCacheFile (char *path, struct cache_user_s *cu); extern qboolean standard_quake, rogue, hipnotic; + +#endif // _COMMON_H diff --git a/uquake/progdefs.h b/uquake/progdefs.h index eb15c45..72113f9 100644 --- a/uquake/progdefs.h +++ b/uquake/progdefs.h @@ -1,4 +1,7 @@ +#ifndef _PROGDEFS_H +#define _PROGDEFS_H + /* file generated by qcc, do not modify */ typedef struct @@ -141,3 +144,5 @@ typedef struct } entvars_t; #define PROGHEADER_CRC 5927 + +#endif // _PROGDEFS_H diff --git a/uquake/quakedef.h b/uquake/quakedef.h index 37d1185..a475110 100644 --- a/uquake/quakedef.h +++ b/uquake/quakedef.h @@ -65,13 +65,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define ON_EPSILON 0.1 // point on plane side epsilon -#define MAX_MSGLEN 8000 // max length of a reliable message -#define MAX_DATAGRAM 1024 // max length of unreliable message - // // per-level limits // -#define MAX_EDICTS 600 // FIXME: ouch! ouch! ouch! #define MAX_LIGHTSTYLES 64 #define MAX_MODELS 256 // these are sent over the net as bytes #define MAX_SOUNDS 256 // so they cannot be blindly increased diff --git a/uquake/server.h b/uquake/server.h index 2d4dfeb..4797997 100644 --- a/uquake/server.h +++ b/uquake/server.h @@ -19,6 +19,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // server.h +#include +#include +#include + typedef struct { int maxclients; diff --git a/uquake/world.h b/uquake/world.h index f504d7d..e501c83 100644 --- a/uquake/world.h +++ b/uquake/world.h @@ -19,6 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // world.h +#ifndef _WORLD_H +#define _WORLD_H + +#include + typedef struct { vec3_t normal; @@ -78,3 +83,5 @@ trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, e // passedict is explicitly excluded from clipping checks (normally NULL) qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, trace_t *trace); + +#endif // _WORLD_H