1
0
Fork 0
forked from fte/fteqw

change out build number/version number logic, remove some unused variables

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3757 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2011-03-30 15:17:55 +00:00
parent cdb6dccb97
commit e4e2399c69
19 changed files with 67 additions and 99 deletions

View file

@ -2901,12 +2901,10 @@ void CL_Init (void)
extern void CL_SayTeam_f (void);
extern cvar_t baseskin;
extern cvar_t noskins;
char st[80];
cls.state = ca_disconnected;
sprintf (st, "%s %i", DISTRIBUTION, build_number());
Info_SetValueForStarKey (cls.userinfo[0], "*ver", st, sizeof(cls.userinfo[0]));
Info_SetValueForStarKey (cls.userinfo[0], "*ver", version_string(), sizeof(cls.userinfo[0]));
Info_SetValueForStarKey (cls.userinfo[1], "*ss", "1", sizeof(cls.userinfo[1]));
Info_SetValueForStarKey (cls.userinfo[2], "*ss", "1", sizeof(cls.userinfo[2]));
Info_SetValueForStarKey (cls.userinfo[3], "*ss", "1", sizeof(cls.userinfo[3]));
@ -3769,7 +3767,7 @@ void Host_FinishInit(void)
#endif
Con_TPrintf (TL_NL);
Con_TPrintf (TL_VERSION, DISTRIBUTION, build_number());
Con_Printf ("%s", version_string());
Con_TPrintf (TL_NL);
Con_TPrintf (TLC_QUAKEWORLD_INITED);

View file

@ -1396,13 +1396,7 @@ void Con_DrawConsole (int lines, qboolean noback)
if (!haveprogress && lines == vid.height)
{
#ifdef SVNREVISION
#define STRINGIFY2(arg) #arg
#define STRINGIFY(arg) STRINGIFY2(arg)
char *version = va(DISTRIBUTION " Quake B%i" IFMINIMAL("m","") " (R%s)\n", build_number(), STRINGIFY(SVNREVISION));
#else
char *version = va(DISTRIBUTION " Quake %i" IFMINIMAL("m",""), build_number());
#endif
char *version = version_string();
int i;
Font_BeginString(font_conchar, vid.width, lines, &x, &y);
y -= Font_CharHeight();

View file

@ -5313,7 +5313,7 @@ qboolean CSQC_Init (unsigned int checksum)
void *pr_globals = PR_globals(csqcprogs, PR_CURRENT);
G_FLOAT(OFS_PARM0) = 1.0; //api version
(((string_t *)pr_globals)[OFS_PARM1] = PR_TempString(csqcprogs, FULLENGINENAME));
G_FLOAT(OFS_PARM2) = build_number();
G_FLOAT(OFS_PARM2) = version_number();
PR_ExecuteProgram(csqcprogs, csqcg.init_function);
}

View file

@ -168,7 +168,7 @@ LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
{
s = va("Your plugin may be incompatible");
TextOutA(hdc, 0, 32, s, strlen(s));
s = va("Version %3.2f was requested, you are using version %3.2f", pub->availver, (float)build_number());
s = va("Version %3.2f was requested, you are using version %3.2f", pub->availver, (float)version_number());
TextOutA(hdc, 0, 48, s, strlen(s));
}
}

View file

@ -158,7 +158,7 @@ LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
{
s = va("Your plugin may be incompatible");
TextOutA(hdc, 0, 32, s, strlen(s));
s = va("Version %3.2f was requested, you are using version %3.2f", pub->availver, (float)build_number());
s = va("Version %3.2f was requested, you are using version %3.2f", pub->availver, (float)version_number());
TextOutA(hdc, 0, 48, s, strlen(s));
}
}

View file

@ -829,13 +829,13 @@ void pscript_property_map_sets(struct context *ctx, const char *val)
float pscript_property_curver_getf(struct context *ctx)
{
return build_number();
return version_number();
}
void pscript_property_availver_setf(struct context *ctx, float val)
{
ctx->pub.availver = val;
if (ctx->pub.availver <= build_number())
if (ctx->pub.availver <= version_number())
ctx->pub.availver = 0;
}

View file

@ -117,9 +117,9 @@ static void Validation_Version(void)
auth = "";
if (*sr)
Cbuf_AddText (va("say "DISTRIBUTION"Quake v%i "PLATFORM"/%s/%s%s\n", build_number(), q_renderername, sr, auth), RESTRICT_RCON);
Cbuf_AddText (va("say %s "PLATFORM"/%s/%s%s\n", version_string(), q_renderername, sr, auth), RESTRICT_RCON);
else
Cbuf_AddText (va("say "DISTRIBUTION"Quake v%i "PLATFORM"/%s%s\n", build_number(), q_renderername, auth), RESTRICT_RCON);
Cbuf_AddText (va("say %s "PLATFORM"/%s%s\n", version_string(), q_renderername, auth), RESTRICT_RCON);
}
void Validation_CheckIfResponse(char *text)
{
@ -234,7 +234,7 @@ void InitValidation(void)
if (Security_Init)
{
switch(Security_Init(va("%s %.2f %i", DISTRIBUTION, 2.57, build_number())))
switch(Security_Init(va("%s %.2f %i", DISTRIBUTION, 2.57, version_number())))
{
case SECURITY_INIT_BAD_CHECKSUM:
Con_Printf("Checksum failed. Security module does not support this build. Go upgrade it.\n");
@ -505,7 +505,7 @@ void Validation_AllChecks(void)
{
char servername[22];
char playername[16];
char *enginebuild = va(DISTRIBUTION "%i", build_number());
char *enginebuild = version_string();
char localpnamelen = strlen(cl.players[cl.playernum[0]].name);
char ruleset[1024];

View file

@ -845,7 +845,7 @@ static char *Macro_Version (void)
{
/* you probably don't need date, but it's included as this is likly to be used by
q2 servers checking for cheats. */
return va("%.2f "DISTRIBUTION" ["__DATE__"] (%i)", 2.57, build_number());
return va("%.2f %s", 2.57, version_string());
}

View file

@ -3101,7 +3101,7 @@ COM_Version_f
*/
void COM_Version_f (void)
{
Con_TPrintf (TLC_VERSIONST, DISTRIBUTION, build_number());
Con_Printf("%s", version_string());
Con_TPrintf (TL_EXEDATETIME, __DATE__, __TIME__);
@ -4251,48 +4251,6 @@ qbyte Q2COM_BlockSequenceCRCByte (qbyte *base, int length, int sequence)
#endif
// char *date = "Oct 24 1996";
static char *date = __DATE__ ;
static char *mon[12] =
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
static char mond[12] =
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
// returns days since Oct 24 1996
int build_number( void )
{
int m = 0;
int d = 0;
int y = 0;
static int b = 0;
if (b != 0)
return b;
for (m = 0; m < 11; m++)
{
if (Q_strncasecmp( &date[0], mon[m], 3 ) == 0)
break;
d += mond[m];
}
d += atoi( &date[4] ) - 1;
y = atoi( &date[7] ) - 1900;
b = d + (int)((y - 1) * 365.25);
if (((y % 4) == 0) && m > 1)
{
b += 1;
}
b -= 35778; // Dec 16 1998
return b;
}
#ifdef _WIN32
// don't use these functions in MSVC8
#if (_MSC_VER < 1400)
@ -4353,3 +4311,38 @@ int __mingw_vfprintf (FILE *__stream, const char *__format, __VALIST __local_arg
return vfprintf( __stream, __format, __local_argv );
}
#endif
int version_number(void)
{
int base = FTE_VER_MAJOR * 10000 + FTE_VER_MINOR * 100;
#ifdef OFFICIAL_RELEASE
base -= 1;
#endif
return base;
}
char *version_string(void)
{
static char s[128];
static qboolean done;
if (!done)
{
#ifdef OFFICIAL_RELEASE
Q_snprintfz(s, sizeof(s), "%s v%i.%02i", DISTRIBUTION, FTE_VER_MAJOR, FTE_VER_MINOR);
#elif SVNREVISION
#define STRINGIFY2(arg) #arg
#define STRINGIFY(arg) STRINGIFY2(arg)
Q_snprintfz(s, sizeof(s), "%s SVN %s", DISTRIBUTION, STRINGIFY(SVNREVISION));
#undef STRINGIFY2
#undef STRINGIFY
#else
Q_snprintfz(s, sizeof(s), "%s build %s", DISTRIBUTION, __DATE__);
#endif
done = true;
}
return s;
}

View file

@ -17,6 +17,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// release version
#define FTE_VER_MAJOR 1
#define FTE_VER_MINOR 0
// comndef.h -- general definitions
typedef unsigned char qbyte;
@ -429,8 +433,8 @@ qbyte COM_BlockSequenceCheckByte (qbyte *base, int length, int sequence, unsigne
qbyte COM_BlockSequenceCRCByte (qbyte *base, int length, int sequence);
qbyte Q2COM_BlockSequenceCRCByte (qbyte *base, int length, int sequence);
int build_number( void );
int version_number(void);
char *version_string(void);
void TL_InitLanguages(void);

View file

@ -144,7 +144,6 @@
"TL_EXEDATETIME \"Exe: %s %s\\n\"\n"
"TL_HEAPSIZE \"%4.1f megabyte heap\\n\"\n"
"TL_VERSION \"\\nBuild %i\\n\\n\"\n"
"TL_SERVERVERSION \"\\n%s Build %i\\n\\n\"\n"
"STL_SAVESYNTAX \"save <savename> : save a game\\n\"\n"
"STL_NORELATIVEPATHS \"Relative pathnames are not allowed.\\n\"\n"
"STL_SAVEGAMETO \"Saving game to %s...\\n\"\n"

View file

@ -1044,9 +1044,7 @@ static void tcgen_environment(float *st, unsigned int numverts, float *xyz, floa
static void tcgen_fog(float *st, unsigned int numverts, float *xyz)
{
int i;
vec3_t viewer;
vec3_t rorg;
float z;
vec4_t zmat;
@ -2449,7 +2447,6 @@ static unsigned int BE_Program_Set_Attribute(const shaderprogparm_t *p, unsigned
static void BE_RenderMeshProgram(const shader_t *shader, const shaderpass_t *pass)
{
const shader_t *s = shader;
program_t *p = shader->prog;
int i;
unsigned int attr = 0;

View file

@ -1504,7 +1504,6 @@ qboolean R_RenderScene_Fish(void)
int order[6] = {4, 0, 1, 5, 3, 2};
int numsides = 4;
vec3_t saveang;
int rot45 = 0;
vrect_t vrect;
vrect_t prect;

View file

@ -2297,8 +2297,6 @@ static void Shaderpass_TexGen(shader_t *shader, shaderpass_t *pass, char **ptr)
}
static void Shaderpass_CubeMap(shader_t *shader, shaderpass_t *pass, char **ptr)
{
char *token = Shader_ParseString(ptr);
int flags = Shader_SetImageFlags(shader);
if (pass->tcgen == TC_GEN_BASE)
pass->tcgen = TC_GEN_SKYBOX;
pass->texgen = T_GEN_SKYBOX;
@ -2772,7 +2770,6 @@ void Shader_SetPassFlush (shaderpass_t *pass, shaderpass_t *pass2)
{
qboolean config_tex_env_combine = 1;//0;
qboolean config_nv_tex_env_combine4 = 1;//0;
qboolean config_multitexure = be_maxpasses > 1;//0;
qboolean config_env_add = 1;//0;
if (((pass->flags & SHADER_PASS_DETAIL) && !r_detailtextures.value) ||

View file

@ -835,20 +835,20 @@ progsnum_t AddProgs(char *name)
if ((f = PR_FindFunction (svprogfuncs, "VersionChat", num )))
{
pr_globals = PR_globals(svprogfuncs, num);
G_FLOAT(OFS_PARM0) = build_number();
G_FLOAT(OFS_PARM0) = version_number();
PR_ExecuteProgram (svprogfuncs, f);
fl = G_FLOAT(OFS_RETURN);
if (fl < 0)
SV_Error ("PR_LoadProgs: progs.dat is not compatible with EXE version");
else if ((int) (fl) != (int) (build_number()))
Con_DPrintf("Warning: Progs may not be fully compatible\n (%4.2f != %i)\n", fl, build_number());
else if ((int) (fl) != (int) (version_number()))
Con_DPrintf("Warning: Progs may not be fully compatible\n (%4.2f != %i)\n", fl, version_number());
}
if ((f = PR_FindFunction (svprogfuncs, "FTE_init", num )))
{
pr_globals = PR_globals(svprogfuncs, num);
G_FLOAT(OFS_PARM0) = build_number();
G_FLOAT(OFS_PARM0) = version_number();
PR_ExecuteProgram (svprogfuncs, f);
}

View file

@ -991,13 +991,7 @@ static qintptr_t syscallhandle (void *offset, quintptr_t mask, qintptr_t fn, con
return -1;
if (!strcmp(n, "version"))
{
#define STRINGIFY2(arg) #arg
#define STRINGIFY(arg) STRINGIFY2(arg)
n = va(FULLENGINENAME
#ifdef SVNREVISION
" SVN build " STRINGIFY(SVNREVISION)
#endif
" Build Number %i\n" "Build Date: " __DATE__ ", " __TIME__, build_number());
n = version_string();
Q_strncpyz(VM_POINTER(arg[1]), n, VM_LONG(arg[2]));
}
else

View file

@ -1204,7 +1204,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
#endif
{
ent->v->targetname = PR_NewString(svprogfuncs, "mvdsv", 0);
ent->v->netname = PR_NewString(svprogfuncs, va("%s %f %s, build %d\nBuild date: " __DATE__ ", " __TIME__ "", DISTRIBUTIONLONG, 2.4, PLATFORM, build_number()), 0);
ent->v->netname = PR_NewString(svprogfuncs, version_string(), 0);
}
ent->v->impulse = 0;//QWE_VERNUM;
ent->v->items = 103;

View file

@ -1684,7 +1684,7 @@ client_t *SVC_DirectConnect(void)
// case 43: //q3 1.11 (most 'recent' demo)
// break;
default:
SV_RejectMessage (SCP_BAD, "Server is "DISTRIBUTION" build %i.\n", build_number());
SV_RejectMessage (SCP_BAD, "Server is %s.\n", version_string());
Con_Printf ("* rejected connect from incompatable client\n");
return NULL;
}
@ -1707,7 +1707,7 @@ client_t *SVC_DirectConnect(void)
if (strcmp(Info_ValueForKey(userinfo[0], "protocol"), "darkplaces 3"))
{
SV_RejectMessage (SCP_BAD, "Server is "DISTRIBUTION" build %i.\n", build_number());
SV_RejectMessage (SCP_BAD, "Server is %s.\n", version_string());
Con_Printf ("* rejected connect from incompatible client\n");
return NULL;
}
@ -1749,7 +1749,7 @@ client_t *SVC_DirectConnect(void)
numssclients = atoi(Cmd_Argv(0)+7);
if (numssclients<1 || numssclients > 4)
{
SV_RejectMessage (SCP_BAD, "Server is "DISTRIBUTION" build %i.\n", build_number());
SV_RejectMessage (SCP_BAD, "Server is %s.\n", version_string());
Con_Printf ("* rejected connect from broken client\n");
return NULL;
}
@ -3961,7 +3961,7 @@ void SV_InitLocal (void)
// if (svs.protocolextensions)
// Info_SetValueForStarKey (svs.info, "*"DISTRIBUTION"_ext", va("%x", svs.protocolextensions), MAX_SERVERINFO_STRING);
Info_SetValueForStarKey (svs.info, "*version", va("%s %i", DISTRIBUTION, build_number()), MAX_SERVERINFO_STRING);
Info_SetValueForStarKey (svs.info, "*version", version_string(), MAX_SERVERINFO_STRING);
Info_SetValueForStarKey (svs.info, "*z_ext", va("%i", SUPPORTED_Z_EXTENSIONS), MAX_SERVERINFO_STRING);
@ -4616,10 +4616,7 @@ void SV_Init (quakeparms_t *parms)
Con_TPrintf (TL_EXEDATETIME, __DATE__, __TIME__);
Con_TPrintf (TL_HEAPSIZE,parms->memsize/ (1024*1024.0));
if (sizeof(void*) == 8)
Con_TPrintf (TL_VERSION, DISTRIBUTION"-64", build_number());
else
Con_TPrintf (TL_VERSION, DISTRIBUTION"-32", build_number());
Con_Printf ("%s\n", version_string());
Con_TPrintf (STL_INITED);

View file

@ -402,11 +402,7 @@ void SVNQ_New_f (void)
int i;
MSG_WriteByte (&host_client->netchan.message, svc_print);
#ifdef DISTRIBUTION
sprintf (message, "%c\n" DISTRIBUTION " QuakeWorld build %i server\n", 2, build_number());
#else
sprintf (message, "%c\nQUAKEWORLD BUILD %i SERVER\n", 2, build_number());
#endif
sprintf (message, "%c\n%s server\n", 2, version_string());
MSG_WriteString (&host_client->netchan.message,message);
if (host_client->protocol == SCP_DARKPLACES6 || host_client->protocol == SCP_DARKPLACES7)