mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-02-17 01:22:32 +00:00
updating to ioq3 svn version 1910 and fixing some bugs in game and cgame
This commit is contained in:
parent
7d4f5d8dcf
commit
bf4e0f3a7a
114 changed files with 2053 additions and 1296 deletions
|
@ -216,7 +216,7 @@ void AAS_ContinueInit(float time)
|
|||
//save the AAS file
|
||||
if (AAS_WriteAASFile(aasworld.filename))
|
||||
{
|
||||
botimport.Print(PRT_MESSAGE, "%s written succesfully\n", aasworld.filename);
|
||||
botimport.Print(PRT_MESSAGE, "%s written successfully\n", aasworld.filename);
|
||||
} //end if
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1556,7 +1556,7 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(int area1num, int area2
|
|||
if (AAS_PointAreaNum(trace.endpos) == area2num)
|
||||
{
|
||||
//if not going through a cluster portal
|
||||
numareas = AAS_TraceAreas(start, end, areas, NULL, sizeof(areas) / sizeof(int));
|
||||
numareas = AAS_TraceAreas(start, end, areas, NULL, ARRAY_LEN(areas));
|
||||
for (i = 0; i < numareas; i++)
|
||||
if (AAS_AreaClusterPortal(areas[i]))
|
||||
break;
|
||||
|
@ -2311,7 +2311,7 @@ int AAS_Reachability_Jump(int area1num, int area2num)
|
|||
//because the predicted jump could have rushed through the area
|
||||
VectorMA(move.endpos, -64, dir, teststart);
|
||||
teststart[2] += 1;
|
||||
numareas = AAS_TraceAreas(move.endpos, teststart, areas, NULL, sizeof(areas) / sizeof(int));
|
||||
numareas = AAS_TraceAreas(move.endpos, teststart, areas, NULL, ARRAY_LEN(areas));
|
||||
for (j = 0; j < numareas; j++)
|
||||
{
|
||||
if (areas[j] == area2num)
|
||||
|
@ -4254,7 +4254,7 @@ void AAS_Reachability_WalkOffLedge(int areanum)
|
|||
break;
|
||||
} //end if
|
||||
//if not going through a cluster portal
|
||||
numareas = AAS_TraceAreas(mid, testend, areas, NULL, sizeof(areas) / sizeof(int));
|
||||
numareas = AAS_TraceAreas(mid, testend, areas, NULL, ARRAY_LEN(areas));
|
||||
for (p = 0; p < numareas; p++)
|
||||
if (AAS_AreaClusterPortal(areas[p]))
|
||||
break;
|
||||
|
|
|
@ -106,8 +106,8 @@ void BotDumpCharacter(bot_character_t *ch)
|
|||
{
|
||||
int i;
|
||||
|
||||
Log_Write("%s", ch->filename);
|
||||
Log_Write("skill %d\n", ch->skill);
|
||||
Log_Write("%s\n", ch->filename);
|
||||
Log_Write("skill %.1f\n", ch->skill);
|
||||
Log_Write("{\n");
|
||||
for (i = 0; i < MAX_CHARACTERISTICS; i++)
|
||||
{
|
||||
|
|
|
@ -2198,7 +2198,7 @@ bot_chat_t *BotLoadInitialChat(char *chatfile, char *chatname)
|
|||
#ifdef DEBUG
|
||||
botimport.Print(PRT_MESSAGE, "initial chats loaded in %d msec\n", Sys_MilliSeconds() - starttime);
|
||||
#endif //DEBUG
|
||||
//character was read succesfully
|
||||
//character was read successfully
|
||||
return chat;
|
||||
} //end of the function BotLoadInitialChat
|
||||
//===========================================================================
|
||||
|
|
|
@ -2366,7 +2366,7 @@ bot_moveresult_t BotTravel_FuncBobbing(bot_movestate_t *ms, aas_reachability_t *
|
|||
VectorSubtract(reach->start, ms->origin, dir1);
|
||||
if (!(ms->moveflags & MFL_SWIMMING)) dir1[2] = 0;
|
||||
dist1 = VectorNormalize(dir1);
|
||||
//if func_bobbing is Not it's start position
|
||||
//if func_bobbing is Not its start position
|
||||
VectorSubtract(bob_origin, bob_start, dir);
|
||||
if (VectorLength(dir) > 16)
|
||||
{
|
||||
|
@ -3027,7 +3027,7 @@ void BotMoveToGoal(bot_moveresult_t *result, int movestate, bot_goal_t *goal, in
|
|||
ms = BotMoveStateFromHandle(movestate);
|
||||
if (!ms) return;
|
||||
//reset the grapple before testing if the bot has a valid goal
|
||||
//because the bot could loose all it's goals when stuck to a wall
|
||||
//because the bot could lose all its goals when stuck to a wall
|
||||
BotResetGrapple(ms);
|
||||
//
|
||||
if (!goal)
|
||||
|
|
|
@ -83,7 +83,7 @@ static fielddef_t weaponinfo_fields[] =
|
|||
static fielddef_t projectileinfo_fields[] =
|
||||
{
|
||||
{"name", PROJECTILE_OFS(name), FT_STRING}, //name of the projectile
|
||||
{"model", WEAPON_OFS(model), FT_STRING}, //model of the projectile
|
||||
{"model", PROJECTILE_OFS(model), FT_STRING}, //model of the projectile
|
||||
{"flags", PROJECTILE_OFS(flags), FT_INT}, //special flags
|
||||
{"gravity", PROJECTILE_OFS(gravity), FT_FLOAT}, //amount of gravity applied to the projectile [0,1]
|
||||
{"damage", PROJECTILE_OFS(damage), FT_INT}, //damage of the projectile
|
||||
|
|
|
@ -40,7 +40,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
#define MAX_USERMOVE 400
|
||||
#define MAX_COMMANDARGUMENTS 10
|
||||
#define ACTION_JUMPEDLASTFRAME 128
|
||||
|
||||
bot_input_t *botinputs;
|
||||
|
||||
|
@ -416,24 +415,6 @@ void EA_View(int client, vec3_t viewangles)
|
|||
//===========================================================================
|
||||
void EA_EndRegular(int client, float thinktime)
|
||||
{
|
||||
/*
|
||||
bot_input_t *bi;
|
||||
int jumped = qfalse;
|
||||
|
||||
bi = &botinputs[client];
|
||||
|
||||
bi->actionflags &= ~ACTION_JUMPEDLASTFRAME;
|
||||
|
||||
bi->thinktime = thinktime;
|
||||
botimport.BotInput(client, bi);
|
||||
|
||||
bi->thinktime = 0;
|
||||
VectorClear(bi->dir);
|
||||
bi->speed = 0;
|
||||
jumped = bi->actionflags & ACTION_JUMP;
|
||||
bi->actionflags = 0;
|
||||
if (jumped) bi->actionflags |= ACTION_JUMPEDLASTFRAME;
|
||||
*/
|
||||
} //end of the function EA_EndRegular
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -444,23 +425,10 @@ void EA_EndRegular(int client, float thinktime)
|
|||
void EA_GetInput(int client, float thinktime, bot_input_t *input)
|
||||
{
|
||||
bot_input_t *bi;
|
||||
// int jumped = qfalse;
|
||||
|
||||
bi = &botinputs[client];
|
||||
|
||||
// bi->actionflags &= ~ACTION_JUMPEDLASTFRAME;
|
||||
|
||||
bi->thinktime = thinktime;
|
||||
Com_Memcpy(input, bi, sizeof(bot_input_t));
|
||||
|
||||
/*
|
||||
bi->thinktime = 0;
|
||||
VectorClear(bi->dir);
|
||||
bi->speed = 0;
|
||||
jumped = bi->actionflags & ACTION_JUMP;
|
||||
bi->actionflags = 0;
|
||||
if (jumped) bi->actionflags |= ACTION_JUMPEDLASTFRAME;
|
||||
*/
|
||||
} //end of the function EA_GetInput
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -474,7 +442,6 @@ void EA_ResetInput(int client)
|
|||
int jumped = qfalse;
|
||||
|
||||
bi = &botinputs[client];
|
||||
bi->actionflags &= ~ACTION_JUMPEDLASTFRAME;
|
||||
|
||||
bi->thinktime = 0;
|
||||
VectorClear(bi->dir);
|
||||
|
|
|
@ -144,16 +144,19 @@ int Export_BotLibSetup(void)
|
|||
|
||||
if(botDeveloper)
|
||||
{
|
||||
char *homedir, *gamedir;
|
||||
char *homedir, *gamedir, *basedir;
|
||||
char logfilename[MAX_OSPATH];
|
||||
|
||||
homedir = LibVarGetString("homedir");
|
||||
gamedir = LibVarGetString("gamedir");
|
||||
basedir = LibVarGetString("com_basegame");
|
||||
|
||||
if (*homedir)
|
||||
{
|
||||
if(*gamedir)
|
||||
Com_sprintf(logfilename, sizeof(logfilename), "%s%c%s%cbotlib.log", homedir, PATH_SEP, gamedir, PATH_SEP);
|
||||
else if(*basedir)
|
||||
Com_sprintf(logfilename, sizeof(logfilename), "%s%c%s%cbotlib.log", homedir, PATH_SEP, basedir, PATH_SEP);
|
||||
else
|
||||
Com_sprintf(logfilename, sizeof(logfilename), "%s%c" BASEGAME "%cbotlib.log", homedir, PATH_SEP, PATH_SEP);
|
||||
}
|
||||
|
|
|
@ -79,27 +79,28 @@ struct weaponinfo_s;
|
|||
#define BLERR_CANNOTLOADWEAPONCONFIG 12 //cannot load weapon config
|
||||
|
||||
//action flags
|
||||
#define ACTION_ATTACK 0x0000001
|
||||
#define ACTION_USE 0x0000002
|
||||
#define ACTION_RESPAWN 0x0000008
|
||||
#define ACTION_JUMP 0x0000010
|
||||
#define ACTION_MOVEUP 0x0000020
|
||||
#define ACTION_CROUCH 0x0000080
|
||||
#define ACTION_MOVEDOWN 0x0000100
|
||||
#define ACTION_MOVEFORWARD 0x0000200
|
||||
#define ACTION_MOVEBACK 0x0000800
|
||||
#define ACTION_MOVELEFT 0x0001000
|
||||
#define ACTION_MOVERIGHT 0x0002000
|
||||
#define ACTION_DELAYEDJUMP 0x0008000
|
||||
#define ACTION_TALK 0x0010000
|
||||
#define ACTION_GESTURE 0x0020000
|
||||
#define ACTION_WALK 0x0080000
|
||||
#define ACTION_AFFIRMATIVE 0x0100000
|
||||
#define ACTION_NEGATIVE 0x0200000
|
||||
#define ACTION_GETFLAG 0x0800000
|
||||
#define ACTION_GUARDBASE 0x1000000
|
||||
#define ACTION_PATROL 0x2000000
|
||||
#define ACTION_FOLLOWME 0x8000000
|
||||
#define ACTION_ATTACK 0x00000001
|
||||
#define ACTION_USE 0x00000002
|
||||
#define ACTION_RESPAWN 0x00000008
|
||||
#define ACTION_JUMP 0x00000010
|
||||
#define ACTION_MOVEUP 0x00000020
|
||||
#define ACTION_CROUCH 0x00000080
|
||||
#define ACTION_MOVEDOWN 0x00000100
|
||||
#define ACTION_MOVEFORWARD 0x00000200
|
||||
#define ACTION_MOVEBACK 0x00000800
|
||||
#define ACTION_MOVELEFT 0x00001000
|
||||
#define ACTION_MOVERIGHT 0x00002000
|
||||
#define ACTION_DELAYEDJUMP 0x00008000
|
||||
#define ACTION_TALK 0x00010000
|
||||
#define ACTION_GESTURE 0x00020000
|
||||
#define ACTION_WALK 0x00080000
|
||||
#define ACTION_AFFIRMATIVE 0x00100000
|
||||
#define ACTION_NEGATIVE 0x00200000
|
||||
#define ACTION_GETFLAG 0x00800000
|
||||
#define ACTION_GUARDBASE 0x01000000
|
||||
#define ACTION_PATROL 0x02000000
|
||||
#define ACTION_FOLLOWME 0x08000000
|
||||
#define ACTION_JUMPEDLASTFRAME 0x10000000
|
||||
|
||||
//the bot input, will be converted to an usercmd_t
|
||||
typedef struct bot_input_s
|
||||
|
|
|
@ -1362,7 +1362,7 @@ define_t *PC_DefineFromString(char *string)
|
|||
#endif //DEFINEHASHING
|
||||
//
|
||||
FreeScript(script);
|
||||
//if the define was created succesfully
|
||||
//if the define was created successfully
|
||||
if (res > 0) return def;
|
||||
//free the define is created
|
||||
if (src.defines) PC_FreeDefine(def);
|
||||
|
|
|
@ -421,7 +421,7 @@ int PS_ReadEscapeCharacter(script_t *script, char *ch)
|
|||
script->script_p++;
|
||||
//store the escape character
|
||||
*ch = c;
|
||||
//succesfully read escape character
|
||||
//successfully read escape character
|
||||
return 1;
|
||||
} //end of the function PS_ReadEscapeCharacter
|
||||
//============================================================================
|
||||
|
@ -431,7 +431,7 @@ int PS_ReadEscapeCharacter(script_t *script, char *ch)
|
|||
//
|
||||
// Parameter: script : script to read from
|
||||
// token : buffer to store the string
|
||||
// Returns: qtrue when a string was read succesfully
|
||||
// Returns: qtrue when a string was read successfully
|
||||
// Changes Globals: -
|
||||
//============================================================================
|
||||
int PS_ReadString(script_t *script, token_t *token, int quote)
|
||||
|
@ -912,7 +912,7 @@ int PS_ReadToken(script_t *script, token_t *token)
|
|||
} //end if
|
||||
//copy the token into the script structure
|
||||
Com_Memcpy(&script->token, token, sizeof(token_t));
|
||||
//succesfully read a token
|
||||
//successfully read a token
|
||||
return 1;
|
||||
} //end of the function PS_ReadToken
|
||||
//============================================================================
|
||||
|
|
|
@ -689,7 +689,7 @@ qboolean CG_ConsoleCommand(void)
|
|||
|
||||
cmd = CG_Argv(0);
|
||||
|
||||
for (i = 0; i < sizeof(commands) / sizeof(commands[0]); i++) {
|
||||
for ( i = 0 ; i < ARRAY_LEN( commands ) ; i++ ) {
|
||||
if (!Q_stricmp(cmd, commands[i].cmd)) {
|
||||
commands[i].function();
|
||||
return qtrue;
|
||||
|
@ -711,7 +711,7 @@ void CG_InitConsoleCommands(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(commands) / sizeof(commands[0]); i++) {
|
||||
for ( i = 0 ; i < ARRAY_LEN( commands ) ; i++ ) {
|
||||
trap_AddCommand(commands[i].cmd);
|
||||
}
|
||||
|
||||
|
|
|
@ -2812,35 +2812,18 @@ Perform all drawing needed to completely fill the screen
|
|||
*/
|
||||
void CG_DrawActive(stereoFrame_t stereoView)
|
||||
{
|
||||
float separation;
|
||||
vec3_t baseOrg;
|
||||
|
||||
// optionally draw the info screen instead
|
||||
if (!cg.snap) {
|
||||
CG_DrawInformation();
|
||||
return;
|
||||
}
|
||||
|
||||
// optionally draw the tournement scoreboard instead
|
||||
if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR && (cg.snap->ps.pm_flags & PMF_SCOREBOARD)) {
|
||||
CG_DrawTourneyScoreboard();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (stereoView) {
|
||||
case STEREO_CENTER:
|
||||
separation = 0;
|
||||
break;
|
||||
case STEREO_LEFT:
|
||||
separation = -cg_stereoSeparation.value / 2;
|
||||
break;
|
||||
case STEREO_RIGHT:
|
||||
separation = cg_stereoSeparation.value / 2;
|
||||
break;
|
||||
default:
|
||||
separation = 0;
|
||||
CG_Error("CG_DrawActive: Undefined stereoView");
|
||||
}
|
||||
|
||||
// clear around the rendered view if sized down
|
||||
CG_TileClear();
|
||||
|
||||
|
@ -2848,12 +2831,6 @@ void CG_DrawActive(stereoFrame_t stereoView)
|
|||
//if (cg.snap->ps.pm_type == PM_NORMAL)
|
||||
// CG_DrawBigPolygon();
|
||||
|
||||
// offset vieworg appropriately if we're doing stereo separation
|
||||
VectorCopy(cg.refdef.vieworg, baseOrg);
|
||||
if (separation != 0) {
|
||||
VectorMA(cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1], cg.refdef.vieworg);
|
||||
}
|
||||
|
||||
//Makro - sun flare
|
||||
CG_AddLensFlare(qtrue);
|
||||
|
||||
|
@ -2861,9 +2838,9 @@ void CG_DrawActive(stereoFrame_t stereoView)
|
|||
trap_R_RenderScene(&cg.refdef);
|
||||
|
||||
// restore original viewpoint if running stereo
|
||||
if (separation != 0) {
|
||||
VectorCopy(baseOrg, cg.refdef.vieworg);
|
||||
}
|
||||
// if (separation != 0) {
|
||||
// VectorCopy(baseOrg, cg.refdef.vieworg);
|
||||
// }
|
||||
// Elder: draw damage blend
|
||||
CG_DrawDamageBlend();
|
||||
//CG_DrawIRBlend();
|
||||
|
|
|
@ -124,11 +124,48 @@ static void CG_LaserSight(centity_t * cent);
|
|||
static void CG_Dlight(centity_t * cent);
|
||||
static void CG_FakeShadow(centity_t * cent);
|
||||
static void CG_Corona(centity_t * cent);
|
||||
|
||||
extern char rq3_breakables[RQ3_MAX_BREAKABLES][80];
|
||||
|
||||
extern void trap_R_AddAdditiveLightToScene(const vec3_t org, float intensity, float r, float g, float b);
|
||||
|
||||
|
||||
/*
|
||||
* ================
|
||||
* RotatePoint
|
||||
* ================
|
||||
* */
|
||||
void RotatePoint(vec3_t point, /*const*/ vec3_t matrix[3]) { // FIXME
|
||||
vec3_t tvec;
|
||||
|
||||
VectorCopy(point, tvec);
|
||||
point[0] = DotProduct(matrix[0], tvec);
|
||||
point[1] = DotProduct(matrix[1], tvec);
|
||||
point[2] = DotProduct(matrix[2], tvec);
|
||||
}
|
||||
|
||||
/*
|
||||
* ================
|
||||
* TransposeMatrix
|
||||
* ================
|
||||
* */
|
||||
void TransposeMatrix(/*const*/ vec3_t matrix[3], vec3_t transpose[3]) { // FIXME
|
||||
int i, j;
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
transpose[i][j] = matrix[j][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ================
|
||||
* CreateRotationMatrix
|
||||
* ================
|
||||
* */
|
||||
void CreateRotationMatrix(const vec3_t angles, vec3_t matrix[3]) {
|
||||
AngleVectors(angles, matrix[0], matrix[1], matrix[2]);
|
||||
VectorInverse(matrix[1]);
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
CG_PositionEntityOnTag
|
||||
|
|
|
@ -1039,8 +1039,10 @@ typedef struct {
|
|||
int spectatorOffset; // current offset from start
|
||||
int spectatorPaintLen; // current offset from start
|
||||
|
||||
#ifdef MISSIONPACK
|
||||
// skull trails
|
||||
skulltrail_t skulltrails[MAX_CLIENTS];
|
||||
#endif
|
||||
|
||||
// centerprinting
|
||||
int centerPrintTime;
|
||||
|
@ -1216,10 +1218,12 @@ typedef struct {
|
|||
|
||||
qhandle_t blackHackShader;
|
||||
|
||||
#ifdef MISSIONPACK
|
||||
qhandle_t redCubeModel;
|
||||
qhandle_t blueCubeModel;
|
||||
qhandle_t redCubeIcon;
|
||||
qhandle_t blueCubeIcon;
|
||||
#endif
|
||||
qhandle_t redFlagModel;
|
||||
qhandle_t blueFlagModel;
|
||||
qhandle_t neutralFlagModel;
|
||||
|
@ -1839,7 +1843,6 @@ extern vmCvar_t cg_fov;
|
|||
extern vmCvar_t cg_thirdPersonRange;
|
||||
extern vmCvar_t cg_thirdPersonAngle;
|
||||
extern vmCvar_t cg_thirdPerson;
|
||||
extern vmCvar_t cg_stereoSeparation;
|
||||
extern vmCvar_t cg_lagometer;
|
||||
extern vmCvar_t cg_drawAttacker;
|
||||
extern vmCvar_t cg_synchronousClients;
|
||||
|
|
|
@ -410,7 +410,7 @@ This is the only way control passes into the module.
|
|||
This must be the very first function compiled into the .q3vm file
|
||||
================
|
||||
*/
|
||||
int vmMain(int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8,
|
||||
Q_EXPORT intptr_t vmMain(int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8,
|
||||
int arg9, int arg10, int arg11)
|
||||
{
|
||||
|
||||
|
@ -509,7 +509,6 @@ vmCvar_t cg_fov;
|
|||
vmCvar_t cg_thirdPerson;
|
||||
vmCvar_t cg_thirdPersonRange;
|
||||
vmCvar_t cg_thirdPersonAngle;
|
||||
vmCvar_t cg_stereoSeparation;
|
||||
vmCvar_t cg_lagometer;
|
||||
vmCvar_t cg_drawAttacker;
|
||||
vmCvar_t cg_synchronousClients;
|
||||
|
@ -747,7 +746,6 @@ static cvarTable_t cvarTable[] = { // bk001129
|
|||
{&cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE},
|
||||
{&cg_fov, "cg_fov", "90", CVAR_ARCHIVE | CVAR_CHEAT },
|
||||
{&cg_viewsize, "cg_viewsize", "100", CVAR_ARCHIVE},
|
||||
{&cg_stereoSeparation, "cg_stereoSeparation", "0.4", CVAR_ARCHIVE},
|
||||
{&cg_shadows, "cg_shadows", "1", CVAR_ARCHIVE},
|
||||
{&cg_gibs, "cg_gibs", "1", CVAR_ARCHIVE},
|
||||
{&cg_draw2D, "cg_draw2D", "1", CVAR_ARCHIVE},
|
||||
|
@ -983,7 +981,7 @@ static cvarTable_t cvarTable[] = { // bk001129
|
|||
//{ &cg_pmove_fixed, "cg_pmove_fixed", "0", CVAR_USERINFO | CVAR_ARCHIVE }
|
||||
};
|
||||
|
||||
static int cvarTableSize = sizeof(cvarTable) / sizeof(cvarTable[0]);
|
||||
static int cvarTableSize = ARRAY_LEN( cvarTable );
|
||||
|
||||
/*
|
||||
=================
|
||||
|
@ -1164,7 +1162,7 @@ void CG_UpdateCvars(void)
|
|||
trap_Cvar_Set("teamoverlay", "0");
|
||||
}
|
||||
// FIXME E3 HACK
|
||||
trap_Cvar_Set("teamoverlay", "1");
|
||||
//trap_Cvar_Set("teamoverlay", "1");
|
||||
}
|
||||
// if force model changed
|
||||
if (forceModelModificationCount != cg_forceModel.modificationCount && cgs.gametype < GT_TEAM) {
|
||||
|
@ -1847,7 +1845,7 @@ static void CG_RegisterSounds(void)
|
|||
}
|
||||
|
||||
// only register the items that the server says we need
|
||||
strcpy(items, CG_ConfigString(CS_ITEMS));
|
||||
Q_strncpyz(items, CG_ConfigString(CS_ITEMS), sizeof(items));
|
||||
|
||||
for (i = 1; i < bg_numItems; i++) {
|
||||
// if ( items[ i ] == '1' || cg_buildScript.integer ) {
|
||||
|
@ -2112,12 +2110,12 @@ static void CG_RegisterGraphics(void)
|
|||
cgs.media.irPlayerShaderFriendly = trap_R_RegisterShader("powerups/irdetailfriendly");
|
||||
cgs.media.itemStrobeShader = trap_R_RegisterShader("rq3-itemstrobe");
|
||||
|
||||
if (cgs.gametype == GT_CTF || cg_buildScript.integer) {
|
||||
cgs.media.redCubeModel = trap_R_RegisterModel("models/powerups/orb/r_orb.md3");
|
||||
cgs.media.blueCubeModel = trap_R_RegisterModel("models/powerups/orb/b_orb.md3");
|
||||
cgs.media.redCubeIcon = trap_R_RegisterShader("icons/skull_red");
|
||||
cgs.media.blueCubeIcon = trap_R_RegisterShader("icons/skull_blue");
|
||||
}
|
||||
// if (cgs.gametype == GT_CTF || cg_buildScript.integer) {
|
||||
// cgs.media.redCubeModel = trap_R_RegisterModel("models/powerups/orb/r_orb.md3");
|
||||
// cgs.media.blueCubeModel = trap_R_RegisterModel("models/powerups/orb/b_orb.md3");
|
||||
// cgs.media.redCubeIcon = trap_R_RegisterShader("icons/skull_red");
|
||||
// cgs.media.blueCubeIcon = trap_R_RegisterShader("icons/skull_blue");
|
||||
// }
|
||||
|
||||
if (cgs.gametype == GT_CTF || cg_buildScript.integer) {
|
||||
// cgs.media.redFlagModel = trap_R_RegisterModel("models/flags/r_flag.md3");
|
||||
|
@ -2271,7 +2269,7 @@ static void CG_RegisterGraphics(void)
|
|||
memset(cg_weapons, 0, sizeof(cg_weapons));
|
||||
|
||||
// only register the items that the server says we need
|
||||
strcpy(items, CG_ConfigString(CS_ITEMS));
|
||||
Q_strncpyz(items, CG_ConfigString(CS_ITEMS), sizeof(items));
|
||||
CG_Printf("Items: (%s)\n",items);
|
||||
for (i = 1; i < bg_numItems; i++)
|
||||
if (items[i] == '1' || cg_buildScript.integer)
|
||||
|
|
|
@ -1212,7 +1212,7 @@ void CG_NewClientInfo(int clientNum)
|
|||
char *skin;
|
||||
|
||||
if (cgs.gametype >= GT_TEAM) {
|
||||
Q_strncpyz(newInfo.headModelName, DEFAULT_TEAM_MODEL, sizeof(newInfo.headModelName));
|
||||
Q_strncpyz(newInfo.headModelName, DEFAULT_TEAM_HEAD, sizeof(newInfo.headModelName));
|
||||
Q_strncpyz(newInfo.headSkinName, "default", sizeof(newInfo.headSkinName));
|
||||
} else {
|
||||
trap_Cvar_VariableStringBuffer("headmodel", modelStr, sizeof(modelStr));
|
||||
|
|
|
@ -248,7 +248,7 @@ static const orderTask_t validOrders[] = {
|
|||
{VOICECHAT_FOLLOWFLAGCARRIER, TEAMTASK_ESCORT}
|
||||
};
|
||||
|
||||
static const int numValidOrders = sizeof(validOrders) / sizeof(orderTask_t);
|
||||
static const int numValidOrders = ARRAY_LEN(validOrders);
|
||||
|
||||
/*
|
||||
=================
|
||||
|
@ -835,6 +835,7 @@ static void CG_MapRestart(void)
|
|||
cg.timelimitWarnings = 0;
|
||||
|
||||
cg.intermissionStarted = qfalse;
|
||||
cg.levelShot = qfalse;
|
||||
|
||||
cgs.voteTime = 0;
|
||||
|
||||
|
@ -1651,11 +1652,26 @@ static void CG_ServerCommand(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (Q_stricmp(cmd, "remapShader") == 0) {
|
||||
if ( Q_stricmp (cmd, "remapShader") == 0 ) {
|
||||
if (trap_Argc() == 4) {
|
||||
char shader1[MAX_QPATH];
|
||||
char shader2[MAX_QPATH];
|
||||
char shader3[MAX_QPATH];
|
||||
|
||||
Q_strncpyz(shader1, CG_Argv(1), sizeof(shader1));
|
||||
Q_strncpyz(shader2, CG_Argv(2), sizeof(shader2));
|
||||
Q_strncpyz(shader3, CG_Argv(3), sizeof(shader3));
|
||||
|
||||
trap_R_RemapShader(shader1, shader2, shader3);
|
||||
}
|
||||
return;
|
||||
}
|
||||
/* if (Q_stricmp(cmd, "remapShader") == 0) {
|
||||
if (trap_Argc() == 4) {
|
||||
trap_R_RemapShader(CG_Argv(1), CG_Argv(2), CG_Argv(3));
|
||||
}
|
||||
}
|
||||
*/
|
||||
// loaddeferred can be both a servercmd and a consolecmd
|
||||
//Makro - fixed spelling
|
||||
//if ( !strcmp( cmd, "loaddefered" ) ) { // FIXME: spelled wrong, but not changing for demo
|
||||
|
|
|
@ -301,7 +301,7 @@ static snapshot_t *CG_ReadNextSnapshot(void)
|
|||
snapshot_t *dest;
|
||||
|
||||
if (cg.latestSnapshotNum > cgs.processedSnapshotNum + 1000) {
|
||||
CG_Printf("WARNING: CG_ReadNextSnapshot: way out of range, %i > %i",
|
||||
CG_Printf("WARNING: CG_ReadNextSnapshot: way out of range, %i > %i\n",
|
||||
cg.latestSnapshotNum, cgs.processedSnapshotNum);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,8 +34,7 @@
|
|||
|
||||
static int (QDECL * syscall) (int arg, ...) = (int (QDECL *) (int, ...)) -1;
|
||||
|
||||
void dllEntry(int (QDECL * syscallptr) (int arg, ...))
|
||||
{
|
||||
Q_EXPORT void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) {
|
||||
syscall = syscallptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -244,6 +244,18 @@
|
|||
// cg_weapons.c -- events and effects dealing with weapons
|
||||
#include "cg_local.h"
|
||||
|
||||
/*
|
||||
* ============
|
||||
* COM_StripExtensionInPlace
|
||||
* ============
|
||||
* */
|
||||
void COM_StripExtensionInPlace(char *name)
|
||||
{
|
||||
char* ext = Q_strrchr(name, '.');
|
||||
if (ext)
|
||||
*ext = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==========================
|
||||
CG_ParseWeaponSoundFile
|
||||
|
|
|
@ -1508,6 +1508,66 @@ void CIN_SetLooping(int handle, qboolean loop) {
|
|||
cinTable[handle].looping = loop;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CIN_ResampleCinematic
|
||||
|
||||
Resample cinematic to 256x256 and store in buf2
|
||||
==================
|
||||
*/
|
||||
void CIN_ResampleCinematic(int handle, int *buf2) {
|
||||
int ix, iy, *buf3, xm, ym, ll;
|
||||
byte *buf;
|
||||
|
||||
buf = cinTable[handle].buf;
|
||||
|
||||
xm = cinTable[handle].CIN_WIDTH/256;
|
||||
ym = cinTable[handle].CIN_HEIGHT/256;
|
||||
ll = 8;
|
||||
if (cinTable[handle].CIN_WIDTH==512) {
|
||||
ll = 9;
|
||||
}
|
||||
|
||||
buf3 = (int*)buf;
|
||||
if (xm==2 && ym==2) {
|
||||
byte *bc2, *bc3;
|
||||
int ic, iiy;
|
||||
|
||||
bc2 = (byte *)buf2;
|
||||
bc3 = (byte *)buf3;
|
||||
for (iy = 0; iy<256; iy++) {
|
||||
iiy = iy<<12;
|
||||
for (ix = 0; ix<2048; ix+=8) {
|
||||
for(ic = ix;ic<(ix+4);ic++) {
|
||||
*bc2=(bc3[iiy+ic]+bc3[iiy+4+ic]+bc3[iiy+2048+ic]+bc3[iiy+2048+4+ic])>>2;
|
||||
bc2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (xm==2 && ym==1) {
|
||||
byte *bc2, *bc3;
|
||||
int ic, iiy;
|
||||
|
||||
bc2 = (byte *)buf2;
|
||||
bc3 = (byte *)buf3;
|
||||
for (iy = 0; iy<256; iy++) {
|
||||
iiy = iy<<11;
|
||||
for (ix = 0; ix<2048; ix+=8) {
|
||||
for(ic = ix;ic<(ix+4);ic++) {
|
||||
*bc2=(bc3[iiy+ic]+bc3[iiy+4+ic])>>1;
|
||||
bc2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (iy = 0; iy<256; iy++) {
|
||||
for (ix = 0; ix<256; ix++) {
|
||||
buf2[(iy<<8)+ix] = buf3[((iy*ym)<<ll) + (ix*xm)];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SCR_DrawCinematic
|
||||
|
@ -1532,54 +1592,12 @@ void CIN_DrawCinematic (int handle) {
|
|||
SCR_AdjustFrom640( &x, &y, &w, &h );
|
||||
|
||||
if (cinTable[handle].dirty && (cinTable[handle].CIN_WIDTH != cinTable[handle].drawX || cinTable[handle].CIN_HEIGHT != cinTable[handle].drawY)) {
|
||||
int ix, iy, *buf2, *buf3, xm, ym, ll;
|
||||
|
||||
xm = cinTable[handle].CIN_WIDTH/256;
|
||||
ym = cinTable[handle].CIN_HEIGHT/256;
|
||||
ll = 8;
|
||||
if (cinTable[handle].CIN_WIDTH==512) {
|
||||
ll = 9;
|
||||
}
|
||||
|
||||
buf3 = (int*)buf;
|
||||
int *buf2;
|
||||
|
||||
buf2 = Hunk_AllocateTempMemory( 256*256*4 );
|
||||
if (xm==2 && ym==2) {
|
||||
byte *bc2, *bc3;
|
||||
int ic, iiy;
|
||||
|
||||
bc2 = (byte *)buf2;
|
||||
bc3 = (byte *)buf3;
|
||||
for (iy = 0; iy<256; iy++) {
|
||||
iiy = iy<<12;
|
||||
for (ix = 0; ix<2048; ix+=8) {
|
||||
for(ic = ix;ic<(ix+4);ic++) {
|
||||
*bc2=(bc3[iiy+ic]+bc3[iiy+4+ic]+bc3[iiy+2048+ic]+bc3[iiy+2048+4+ic])>>2;
|
||||
bc2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (xm==2 && ym==1) {
|
||||
byte *bc2, *bc3;
|
||||
int ic, iiy;
|
||||
|
||||
bc2 = (byte *)buf2;
|
||||
bc3 = (byte *)buf3;
|
||||
for (iy = 0; iy<256; iy++) {
|
||||
iiy = iy<<11;
|
||||
for (ix = 0; ix<2048; ix+=8) {
|
||||
for(ic = ix;ic<(ix+4);ic++) {
|
||||
*bc2=(bc3[iiy+ic]+bc3[iiy+4+ic])>>1;
|
||||
bc2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (iy = 0; iy<256; iy++) {
|
||||
for (ix = 0; ix<256; ix++) {
|
||||
buf2[(iy<<8)+ix] = buf3[((iy*ym)<<ll) + (ix*xm)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CIN_ResampleCinematic(handle, buf2);
|
||||
|
||||
re.DrawStretchRaw( x, y, w, h, 256, 256, (byte *)buf2, handle, qtrue);
|
||||
cinTable[handle].dirty = qfalse;
|
||||
Hunk_FreeTempMemory(buf2);
|
||||
|
@ -1659,10 +1677,31 @@ void CIN_UploadCinematic(int handle) {
|
|||
}
|
||||
}
|
||||
}
|
||||
re.UploadCinematic( 256, 256, 256, 256, cinTable[handle].buf, handle, cinTable[handle].dirty);
|
||||
|
||||
// Resample the video if needed
|
||||
if (cinTable[handle].dirty && (cinTable[handle].CIN_WIDTH != cinTable[handle].drawX || cinTable[handle].CIN_HEIGHT != cinTable[handle].drawY)) {
|
||||
int *buf2;
|
||||
|
||||
buf2 = Hunk_AllocateTempMemory( 256*256*4 );
|
||||
|
||||
CIN_ResampleCinematic(handle, buf2);
|
||||
|
||||
re.UploadCinematic( cinTable[handle].CIN_WIDTH, cinTable[handle].CIN_HEIGHT, 256, 256, (byte *)buf2, handle, qtrue);
|
||||
cinTable[handle].dirty = qfalse;
|
||||
Hunk_FreeTempMemory(buf2);
|
||||
} else {
|
||||
// Upload video at normal resolution
|
||||
re.UploadCinematic( cinTable[handle].CIN_WIDTH, cinTable[handle].CIN_HEIGHT, cinTable[handle].drawX, cinTable[handle].drawY,
|
||||
cinTable[handle].buf, handle, cinTable[handle].dirty);
|
||||
cinTable[handle].dirty = qfalse;
|
||||
}
|
||||
|
||||
if (cl_inGameVideo->integer == 0 && cinTable[handle].playonwalls == 1) {
|
||||
cinTable[handle].playonwalls--;
|
||||
}
|
||||
else if (cl_inGameVideo->integer != 0 && cinTable[handle].playonwalls != 1) {
|
||||
cinTable[handle].playonwalls = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -309,7 +309,7 @@ Cmd_CompleteTxtName
|
|||
*/
|
||||
void Cmd_CompleteTxtName( char *args, int argNum ) {
|
||||
if( argNum == 2 ) {
|
||||
Field_CompleteFilename( "", "txt", qfalse );
|
||||
Field_CompleteFilename( "", "txt", qfalse, qtrue );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -445,10 +445,8 @@ void CL_ConsolePrint( char *txt ) {
|
|||
y = con.current % con.totallines;
|
||||
con.text[y*con.linewidth+con.x] = (color << 8) | c;
|
||||
con.x++;
|
||||
if (con.x >= con.linewidth) {
|
||||
if(con.x >= con.linewidth)
|
||||
Con_Linefeed(skipnotify);
|
||||
con.x = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -535,12 +535,14 @@ void Field_CharEvent( field_t *edit, int ch ) {
|
|||
}
|
||||
|
||||
if ( key_overstrikeMode ) {
|
||||
if ( edit->cursor == MAX_EDIT_LINE - 1 )
|
||||
// - 2 to leave room for the leading slash and trailing \0
|
||||
if ( edit->cursor == MAX_EDIT_LINE - 2 )
|
||||
return;
|
||||
edit->buffer[edit->cursor] = ch;
|
||||
edit->cursor++;
|
||||
} else { // insert mode
|
||||
if ( len == MAX_EDIT_LINE - 1 ) {
|
||||
// - 2 to leave room for the leading slash and trailing \0
|
||||
if ( len == MAX_EDIT_LINE - 2 ) {
|
||||
return; // all full
|
||||
}
|
||||
memmove( edit->buffer + edit->cursor + 1,
|
||||
|
@ -584,8 +586,10 @@ void Console_Key (int key) {
|
|||
// enter finishes the line
|
||||
if ( key == K_ENTER || key == K_KP_ENTER ) {
|
||||
// if not in the game explicitly prepend a slash if needed
|
||||
if ( cls.state != CA_ACTIVE && g_consoleField.buffer[0] != '\\'
|
||||
&& g_consoleField.buffer[0] != '/' ) {
|
||||
if ( cls.state != CA_ACTIVE &&
|
||||
g_consoleField.buffer[0] &&
|
||||
g_consoleField.buffer[0] != '\\' &&
|
||||
g_consoleField.buffer[0] != '/' ) {
|
||||
char temp[MAX_EDIT_LINE-1];
|
||||
|
||||
Q_strncpyz( temp, g_consoleField.buffer, sizeof( temp ) );
|
||||
|
|
|
@ -100,6 +100,8 @@ cvar_t *cl_guidServerUniq;
|
|||
|
||||
cvar_t *cl_consoleKeys;
|
||||
|
||||
cvar_t *cl_gamename;
|
||||
|
||||
clientActive_t cl;
|
||||
clientConnection_t clc;
|
||||
clientStatic_t cls;
|
||||
|
@ -127,6 +129,7 @@ int serverStatusCount;
|
|||
void hA3Dg_ExportRenderGeom (refexport_t *incoming_re);
|
||||
#endif
|
||||
|
||||
extern void GLimp_Minimize(void);
|
||||
extern void SV_BotFrame( int time );
|
||||
void CL_CheckForResend( void );
|
||||
void CL_ShowIP_f(void);
|
||||
|
@ -908,7 +911,7 @@ static void CL_CompleteDemoName( char *args, int argNum )
|
|||
char demoExt[ 16 ];
|
||||
|
||||
Com_sprintf( demoExt, sizeof( demoExt ), ".dm_%d", PROTOCOL_VERSION );
|
||||
Field_CompleteFilename( "demos", demoExt, qtrue );
|
||||
Field_CompleteFilename( "demos", demoExt, qtrue, qtrue );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2106,7 +2109,7 @@ void CL_CheckForResend( void ) {
|
|||
case CA_CONNECTING:
|
||||
// requesting a challenge .. IPv6 users always get in as authorize server supports no ipv6.
|
||||
#ifndef STANDALONE
|
||||
if (!Cvar_VariableIntegerValue("com_standalone") && clc.serverAddress.type == NA_IP && !Sys_IsLANAddress( clc.serverAddress ) )
|
||||
if (!com_standalone->integer && clc.serverAddress.type == NA_IP && !Sys_IsLANAddress( clc.serverAddress ) )
|
||||
CL_RequestAuthorization();
|
||||
#endif
|
||||
|
||||
|
@ -2121,7 +2124,7 @@ void CL_CheckForResend( void ) {
|
|||
port = Cvar_VariableValue ("net_qport");
|
||||
|
||||
Q_strncpyz( info, Cvar_InfoString( CVAR_USERINFO ), sizeof( info ) );
|
||||
Info_SetValueForKey( info, "protocol", va("%i", PROTOCOL_VERSION ) );
|
||||
Info_SetValueForKey( info, "protocol", va("%i", com_protocol->integer ) );
|
||||
Info_SetValueForKey( info, "qport", va("%i", port ) );
|
||||
Info_SetValueForKey( info, "challenge", va("%i", clc.challenge ) );
|
||||
|
||||
|
@ -2237,7 +2240,7 @@ CL_ServersResponsePacket
|
|||
===================
|
||||
*/
|
||||
void CL_ServersResponsePacket( const netadr_t* from, msg_t *msg, qboolean extended ) {
|
||||
int i, count, total;
|
||||
int i, j, count, total;
|
||||
netadr_t addresses[MAX_SERVERSPERPACKET];
|
||||
int numservers;
|
||||
byte* buffptr;
|
||||
|
@ -2318,6 +2321,18 @@ void CL_ServersResponsePacket( const netadr_t* from, msg_t *msg, qboolean extend
|
|||
// build net address
|
||||
serverInfo_t *server = &cls.globalServers[count];
|
||||
|
||||
// Tequila: It's possible to have sent many master server requests. Then
|
||||
// we may receive many times the same addresses from the master server.
|
||||
// We just avoid to add a server if it is still in the global servers list.
|
||||
for (j = 0; j < count; j++)
|
||||
{
|
||||
if (NET_CompareAdr(cls.globalServers[j].adr, addresses[i]))
|
||||
break;
|
||||
}
|
||||
|
||||
if (j < count)
|
||||
continue;
|
||||
|
||||
CL_InitServerInfo( server, &addresses[i] );
|
||||
// advance to next slot
|
||||
count++;
|
||||
|
@ -3125,6 +3140,7 @@ void CL_Init( void ) {
|
|||
// offset for the power function (for style 1, ignored otherwise)
|
||||
// this should be set to the max rate value
|
||||
cl_mouseAccelOffset = Cvar_Get( "cl_mouseAccelOffset", "5", CVAR_ARCHIVE );
|
||||
Cvar_CheckRange(cl_mouseAccelOffset, 0.001f, 50000.0f, qfalse);
|
||||
|
||||
cl_showMouseRate = Cvar_Get ("cl_showmouserate", "0", 0);
|
||||
|
||||
|
@ -3169,6 +3185,8 @@ void CL_Init( void ) {
|
|||
// ~ and `, as keys and characters
|
||||
cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60", CVAR_ARCHIVE);
|
||||
|
||||
cl_gamename = Cvar_Get("cl_gamename", GAMENAME_FOR_MASTER, CVAR_TEMP);
|
||||
|
||||
// userinfo
|
||||
Cvar_Get ("name", "Suislide", CVAR_USERINFO | CVAR_ARCHIVE );
|
||||
Cvar_Get ("rate", "25000", CVAR_USERINFO | CVAR_ARCHIVE );
|
||||
|
@ -3254,6 +3272,7 @@ void CL_Init( void ) {
|
|||
Cmd_AddCommand ("model", CL_SetModel_f );
|
||||
Cmd_AddCommand ("video", CL_Video_f );
|
||||
Cmd_AddCommand ("stopvideo", CL_StopVideo_f );
|
||||
Cmd_AddCommand("minimize", GLimp_Minimize);
|
||||
CL_InitRef();
|
||||
|
||||
SCR_Init ();
|
||||
|
@ -3386,7 +3405,7 @@ void CL_ServerInfoPacket( netadr_t from, msg_t *msg ) {
|
|||
|
||||
// if this isn't the correct protocol version, ignore it
|
||||
prot = atoi( Info_ValueForKey( infoString, "protocol" ) );
|
||||
if ( prot != PROTOCOL_VERSION ) {
|
||||
if ( prot != com_protocol->integer ) {
|
||||
Com_DPrintf( "Different protocol info packet: %s\n", infoString );
|
||||
return;
|
||||
}
|
||||
|
@ -3715,11 +3734,10 @@ void CL_GlobalServers_f( void ) {
|
|||
netadr_t to;
|
||||
int count, i, masterNum;
|
||||
char command[1024], *masteraddress;
|
||||
char *cmdname;
|
||||
|
||||
if ((count = Cmd_Argc()) < 3 || (masterNum = atoi(Cmd_Argv(1))) < 0 || masterNum > 4)
|
||||
if ((count = Cmd_Argc()) < 3 || (masterNum = atoi(Cmd_Argv(1))) < 0 || masterNum > MAX_MASTER_SERVERS - 1)
|
||||
{
|
||||
Com_Printf( "usage: globalservers <master# 0-4> <protocol> [keywords]\n");
|
||||
Com_Printf("usage: globalservers <master# 0-%d> <protocol> [keywords]\n", MAX_MASTER_SERVERS - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3753,14 +3771,24 @@ void CL_GlobalServers_f( void ) {
|
|||
// Use the extended query for IPv6 masters
|
||||
if (to.type == NA_IP6 || to.type == NA_MULTICAST6)
|
||||
{
|
||||
cmdname = "getserversExt " GAMENAME_FOR_MASTER;
|
||||
int v4enabled = Cvar_VariableIntegerValue("net_enabled") & NET_ENABLEV4;
|
||||
|
||||
if(v4enabled)
|
||||
{
|
||||
Com_sprintf(command, sizeof(command), "getserversExt %s %s ipv6",
|
||||
cl_gamename->string, Cmd_Argv(2));
|
||||
}
|
||||
else
|
||||
{
|
||||
Com_sprintf(command, sizeof(command), "getserversExt %s %s",
|
||||
cl_gamename->string, Cmd_Argv(2));
|
||||
}
|
||||
|
||||
// TODO: test if we only have an IPv6 connection. If it's the case,
|
||||
// request IPv6 servers only by appending " ipv6" to the command
|
||||
}
|
||||
else
|
||||
cmdname = "getservers";
|
||||
Com_sprintf( command, sizeof(command), "%s %s", cmdname, Cmd_Argv(2) );
|
||||
Com_sprintf(command, sizeof(command), "getservers %s", Cmd_Argv(2));
|
||||
|
||||
for (i=3; i < count; i++)
|
||||
{
|
||||
|
@ -3783,9 +3811,9 @@ void CL_GetPing( int n, char *buf, int buflen, int *pingtime )
|
|||
int time;
|
||||
int maxPing;
|
||||
|
||||
if (!cl_pinglist[n].adr.port)
|
||||
if (n < 0 || n >= MAX_PINGREQUESTS || !cl_pinglist[n].adr.port)
|
||||
{
|
||||
// empty slot
|
||||
// empty or invalid slot
|
||||
buf[0] = '\0';
|
||||
*pingtime = 0;
|
||||
return;
|
||||
|
@ -3815,21 +3843,6 @@ void CL_GetPing( int n, char *buf, int buflen, int *pingtime )
|
|||
*pingtime = time;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_UpdateServerInfo
|
||||
==================
|
||||
*/
|
||||
void CL_UpdateServerInfo( int n )
|
||||
{
|
||||
if (!cl_pinglist[n].adr.port)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CL_SetServerInfoByAddress(cl_pinglist[n].adr, cl_pinglist[n].info, cl_pinglist[n].time );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_GetPingInfo
|
||||
|
@ -3837,9 +3850,9 @@ CL_GetPingInfo
|
|||
*/
|
||||
void CL_GetPingInfo( int n, char *buf, int buflen )
|
||||
{
|
||||
if (!cl_pinglist[n].adr.port)
|
||||
if (n < 0 || n >= MAX_PINGREQUESTS || !cl_pinglist[n].adr.port)
|
||||
{
|
||||
// empty slot
|
||||
// empty or invalid slot
|
||||
if (buflen)
|
||||
buf[0] = '\0';
|
||||
return;
|
||||
|
|
|
@ -456,9 +456,7 @@ int CL_GetPingQueueCount( void );
|
|||
|
||||
void CL_ShutdownRef( void );
|
||||
void CL_InitRef( void );
|
||||
#ifndef STANDALONE
|
||||
qboolean CL_CDKeyValidate( const char *key, const char *checksum );
|
||||
#endif
|
||||
int CL_ServerStatus( char *serverAddress, char *serverStatusString, int maxLen );
|
||||
|
||||
qboolean CL_CheckPaused(void);
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
#define uint32_t UINT32
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#ifdef __sun
|
||||
#define _POSIX_C_SOURCE 199309L
|
||||
#endif
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
|
@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
// includes for the OGG codec
|
||||
#include <errno.h>
|
||||
#define OV_EXCLUDE_STATIC_CALLBACKS
|
||||
#include <vorbis/vorbisfile.h>
|
||||
|
||||
// The OGG codec can return the samples in a number of different formats,
|
||||
|
|
|
@ -127,6 +127,7 @@ typedef struct alSfx_s
|
|||
snd_info_t info; // information for this sound like rate, sample count..
|
||||
|
||||
qboolean isDefault; // Couldn't be loaded - use default FX
|
||||
qboolean isDefaultChecked; // Sound has been check if it isDefault
|
||||
qboolean inMemory; // Sound is stored in memory
|
||||
qboolean isLocked; // Sound is locked (can not be unloaded)
|
||||
int lastUsedTime; // Time last used
|
||||
|
@ -291,7 +292,7 @@ static qboolean S_AL_BufferEvict( void )
|
|||
S_AL_BufferLoad
|
||||
=================
|
||||
*/
|
||||
static void S_AL_BufferLoad(sfxHandle_t sfx)
|
||||
static void S_AL_BufferLoad(sfxHandle_t sfx, qboolean cache)
|
||||
{
|
||||
ALenum error;
|
||||
ALuint format;
|
||||
|
@ -309,7 +310,7 @@ static void S_AL_BufferLoad(sfxHandle_t sfx)
|
|||
return;
|
||||
|
||||
// Already done?
|
||||
if((curSfx->inMemory) || (curSfx->isDefault))
|
||||
if((curSfx->inMemory) || (curSfx->isDefault) || (!cache && curSfx->isDefaultChecked))
|
||||
return;
|
||||
|
||||
// Try to load
|
||||
|
@ -320,6 +321,15 @@ static void S_AL_BufferLoad(sfxHandle_t sfx)
|
|||
return;
|
||||
}
|
||||
|
||||
curSfx->isDefaultChecked = qtrue;
|
||||
|
||||
if (!cache)
|
||||
{
|
||||
// Don't create AL cache
|
||||
Z_Free(data);
|
||||
return;
|
||||
}
|
||||
|
||||
format = S_AL_Format(info.width, info.channels);
|
||||
|
||||
// Create a buffer
|
||||
|
@ -394,7 +404,7 @@ void S_AL_BufferUse(sfxHandle_t sfx)
|
|||
return;
|
||||
|
||||
if((!knownSfx[sfx].inMemory) && (!knownSfx[sfx].isDefault))
|
||||
S_AL_BufferLoad(sfx);
|
||||
S_AL_BufferLoad(sfx, qtrue);
|
||||
knownSfx[sfx].lastUsedTime = Sys_Milliseconds();
|
||||
}
|
||||
|
||||
|
@ -460,10 +470,14 @@ sfxHandle_t S_AL_RegisterSound( const char *sample, qboolean compressed )
|
|||
{
|
||||
sfxHandle_t sfx = S_AL_BufferFind(sample);
|
||||
|
||||
if( s_alPrecache->integer && (!knownSfx[sfx].inMemory) && (!knownSfx[sfx].isDefault))
|
||||
S_AL_BufferLoad(sfx);
|
||||
if((!knownSfx[sfx].inMemory) && (!knownSfx[sfx].isDefault))
|
||||
S_AL_BufferLoad(sfx, s_alPrecache->integer);
|
||||
knownSfx[sfx].lastUsedTime = Com_Milliseconds();
|
||||
|
||||
if (knownSfx[sfx].isDefault) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return sfx;
|
||||
}
|
||||
|
||||
|
@ -597,7 +611,7 @@ static void S_AL_ScaleGain(src_t *chksrc, vec3_t origin)
|
|||
|
||||
scaleFactor *= chksrc->curGain;
|
||||
|
||||
if(chksrc->scaleGain != scaleFactor);
|
||||
if(chksrc->scaleGain != scaleFactor)
|
||||
{
|
||||
chksrc->scaleGain = scaleFactor;
|
||||
S_AL_Gain(chksrc->alSource, chksrc->scaleGain);
|
||||
|
|
|
@ -45,15 +45,24 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "g_local.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_ea.h"
|
||||
#include "be_ai_char.h"
|
||||
#include "be_ai_chat.h"
|
||||
#include "be_ai_gen.h"
|
||||
#include "be_ai_goal.h"
|
||||
#include "be_ai_move.h"
|
||||
#include "be_ai_weap.h"
|
||||
//#include "botlib.h"
|
||||
//#include "be_aas.h"
|
||||
//#include "be_ea.h"
|
||||
//#include "be_ai_char.h"
|
||||
//#include "be_ai_chat.h"
|
||||
//#include "be_ai_gen.h"
|
||||
//#include "be_ai_goal.h"
|
||||
//#include "be_ai_move.h"
|
||||
//#include "be_ai_weap.h"
|
||||
#include "../botlib/botlib.h"
|
||||
#include "../botlib/be_aas.h"
|
||||
#include "../botlib/be_ea.h"
|
||||
#include "../botlib/be_ai_char.h"
|
||||
#include "../botlib/be_ai_chat.h"
|
||||
#include "../botlib/be_ai_gen.h"
|
||||
#include "../botlib/be_ai_goal.h"
|
||||
#include "../botlib/be_ai_move.h"
|
||||
#include "../botlib/be_ai_weap.h"
|
||||
//
|
||||
#include "ai_main.h"
|
||||
#include "ai_dmq3.h"
|
||||
|
@ -876,7 +885,7 @@ int BotChat_EnemySuicide(bot_state_t * bs)
|
|||
if (BotNumActivePlayers() <= 1)
|
||||
return qfalse;
|
||||
//
|
||||
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_KILL, 0, 1);
|
||||
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENEMYSUICIDE, 0, 1);
|
||||
//don't chat in teamplay
|
||||
if (TeamPlayIsOn())
|
||||
return qfalse;
|
||||
|
@ -946,7 +955,7 @@ int BotChat_HitTalking(bot_state_t * bs)
|
|||
return qfalse;
|
||||
//
|
||||
ClientName(g_entities[bs->client].client->lasthurt_client, name, sizeof(name));
|
||||
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_client);
|
||||
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_mod);
|
||||
//
|
||||
BotAI_BotInitialChat(bs, "hit_talking", name, weap, NULL);
|
||||
bs->lastchat_time = FloatTime();
|
||||
|
|
|
@ -107,15 +107,15 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "g_local.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_ea.h"
|
||||
#include "be_ai_char.h"
|
||||
#include "be_ai_chat.h"
|
||||
#include "be_ai_gen.h"
|
||||
#include "be_ai_goal.h"
|
||||
#include "be_ai_move.h"
|
||||
#include "be_ai_weap.h"
|
||||
#include "../botlib/botlib.h"
|
||||
#include "../botlib/be_aas.h"
|
||||
#include "../botlib/be_ea.h"
|
||||
#include "../botlib/be_ai_char.h"
|
||||
#include "../botlib/be_ai_chat.h"
|
||||
#include "../botlib/be_ai_gen.h"
|
||||
#include "../botlib/be_ai_goal.h"
|
||||
#include "../botlib/be_ai_move.h"
|
||||
#include "../botlib/be_ai_weap.h"
|
||||
//
|
||||
#include "ai_main.h"
|
||||
#include "ai_dmq3.h"
|
||||
|
@ -139,7 +139,7 @@ void Cmd_Bandage(gentity_t * ent);
|
|||
void Cmd_DropItem_f(gentity_t * ent);
|
||||
void Cmd_DropWeapon_f(gentity_t * ent);
|
||||
|
||||
//goal flag, see be_ai_goal.h for the other GFL_*
|
||||
//goal flag, see ../botlib/be_ai_goal.h for the other GFL_*
|
||||
#define GFL_AIR 128
|
||||
|
||||
int numnodeswitches;
|
||||
|
@ -171,7 +171,7 @@ void BotDumpNodeSwitches(bot_state_t * bs)
|
|||
BotAI_Print(PRT_MESSAGE, "%s at %1.1f switched more than %d AI nodes\n", netname, FloatTime(),
|
||||
MAX_NODESWITCHES);
|
||||
for (i = 0; i < numnodeswitches; i++) {
|
||||
BotAI_Print(PRT_MESSAGE, nodeswitch[i]);
|
||||
BotAI_Print(PRT_MESSAGE, "%s", nodeswitch[i]);
|
||||
}
|
||||
BotAI_Print(PRT_FATAL, "");
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ void BotRecordNodeSwitch(bot_state_t * bs, char *node, char *str, char *s)
|
|||
node, str, s);
|
||||
#ifdef DEBUG
|
||||
if (0) {
|
||||
BotAI_Print(PRT_MESSAGE, nodeswitch[numnodeswitches]);
|
||||
BotAI_Print(PRT_MESSAGE, "%s", nodeswitch[numnodeswitches]);
|
||||
}
|
||||
#endif //DEBUG
|
||||
numnodeswitches++;
|
||||
|
|
|
@ -187,15 +187,15 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "g_local.h"
|
||||
#include "botlib.h"
|
||||
#include "be_aas.h"
|
||||
#include "be_ea.h"
|
||||
#include "be_ai_char.h"
|
||||
#include "be_ai_chat.h"
|
||||
#include "be_ai_gen.h"
|
||||
#include "be_ai_goal.h"
|
||||
#include "be_ai_move.h"
|
||||
#include "be_ai_weap.h"
|
||||
#include "../botlib/botlib.h"
|
||||
#include "../botlib/be_aas.h"
|
||||
#include "../botlib/be_ea.h"
|
||||
#include "../botlib/be_ai_char.h"
|
||||
#include "../botlib/be_ai_chat.h"
|
||||
#include "../botlib/be_ai_gen.h"
|
||||
#include "../botlib/be_ai_goal.h"
|
||||
#include "../botlib/be_ai_move.h"
|
||||
#include "../botlib/be_ai_weap.h"
|
||||
//
|
||||
#include "ai_main.h"
|
||||
#include "ai_dmq3.h"
|
||||
|
@ -1463,7 +1463,7 @@ char *EasyClientName(int client, char *buf, int size)
|
|||
char *str1, *str2, *ptr, c;
|
||||
char name[128];
|
||||
|
||||
strcpy(name, ClientName(client, name, sizeof(name)));
|
||||
ClientName(client, name, sizeof(name));
|
||||
for (i = 0; name[i]; i++)
|
||||
name[i] &= 127;
|
||||
//remove all spaces
|
||||
|
|
|
@ -1668,7 +1668,7 @@ int BotInitLibrary(void)
|
|||
//no chatting
|
||||
trap_Cvar_VariableStringBuffer("bot_nochat", buf, sizeof(buf));
|
||||
if (strlen(buf))
|
||||
trap_BotLibVarSet("nochat", "0");
|
||||
trap_BotLibVarSet("nochat", buf);
|
||||
//visualize jump pads
|
||||
trap_Cvar_VariableStringBuffer("bot_visualizejumppads", buf, sizeof(buf));
|
||||
if (strlen(buf))
|
||||
|
@ -1707,9 +1707,13 @@ int BotInitLibrary(void)
|
|||
if (strlen(buf))
|
||||
trap_BotLibVarSet("gamedir", buf);
|
||||
//cd directory
|
||||
trap_Cvar_VariableStringBuffer("fs_cdpath", buf, sizeof(buf));
|
||||
// trap_Cvar_VariableStringBuffer("fs_cdpath", buf, sizeof(buf));
|
||||
// if (strlen(buf))
|
||||
// trap_BotLibVarSet("cddir", buf);
|
||||
//home directory
|
||||
trap_Cvar_VariableStringBuffer("fs_homepath", buf, sizeof(buf));
|
||||
if (strlen(buf))
|
||||
trap_BotLibVarSet("cddir", buf);
|
||||
trap_BotLibVarSet("homedir", buf);
|
||||
//setup the bot library
|
||||
return trap_BotLibSetup();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ static char* med3(char *, char *, char *, cmp_t *);
|
|||
static void swapfunc(char *, char *, int, int);
|
||||
|
||||
#ifndef min
|
||||
#define min(a, b) (a) < (b) ? a : b
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -317,19 +317,30 @@ int toupper( int c ) {
|
|||
return c;
|
||||
}
|
||||
|
||||
void *memmove( void *dest, const void *src, size_t count ) {
|
||||
int i;
|
||||
void *memmove(void *dest, const void *src, size_t count)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if ( dest > src ) {
|
||||
for ( i = count-1 ; i >= 0 ; i-- ) {
|
||||
((char *)dest)[i] = ((char *)src)[i];
|
||||
}
|
||||
} else {
|
||||
for ( i = 0 ; i < count ; i++ ) {
|
||||
((char *)dest)[i] = ((char *)src)[i];
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
if(count)
|
||||
{
|
||||
if(dest > src)
|
||||
{
|
||||
i = count;
|
||||
|
||||
do
|
||||
{
|
||||
i--;
|
||||
((char *) dest)[i] = ((char *) src)[i];
|
||||
} while(i > 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i = 0; i < count; i++)
|
||||
((char *) dest)[i] = ((char *) src)[i];
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
|
@ -935,6 +946,234 @@ double _atof( const char **stringPtr ) {
|
|||
return value * sign;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
strtod
|
||||
|
||||
Without an errno variable, this is a fair bit less useful than it is in libc
|
||||
but it's still a fair bit more capable than atof or _atof
|
||||
Handles inf[inity], nan (ignoring case), hexadecimals, and decimals
|
||||
Handles decimal exponents like 10e10 and hex exponents like 0x7f8p20
|
||||
10e10 == 10000000000 (power of ten)
|
||||
0x7f8p20 == 0x7f800000 (decimal power of two)
|
||||
The variable pointed to by endptr will hold the location of the first character
|
||||
in the nptr string that was not used in the conversion
|
||||
==============
|
||||
*/
|
||||
double strtod( const char *nptr, char **endptr )
|
||||
{
|
||||
double res;
|
||||
qboolean neg = qfalse;
|
||||
|
||||
// skip whitespace
|
||||
while( isspace( *nptr ) )
|
||||
nptr++;
|
||||
|
||||
// special string parsing
|
||||
if( Q_stricmpn( nptr, "nan", 3 ) == 0 )
|
||||
{
|
||||
floatint_t nan;
|
||||
|
||||
if( endptr )
|
||||
*endptr = (char *)&nptr[3];
|
||||
|
||||
// nan can be followed by a bracketed number (in hex, octal,
|
||||
// or decimal) which is then put in the mantissa
|
||||
// this can be used to generate signalling or quiet NaNs, for
|
||||
// example (though I doubt it'll ever be used)
|
||||
// note that nan(0) is infinity!
|
||||
if( nptr[3] == '(' )
|
||||
{
|
||||
char *end;
|
||||
int mantissa = strtol( &nptr[4], &end, 0 );
|
||||
if( *end == ')' )
|
||||
{
|
||||
nan.ui = 0x7f800000 | ( mantissa & 0x7fffff );
|
||||
if( endptr )
|
||||
*endptr = &end[1];
|
||||
return nan.f;
|
||||
}
|
||||
}
|
||||
nan.ui = 0x7fffffff;
|
||||
return nan.f;
|
||||
}
|
||||
if( Q_stricmpn( nptr, "inf", 3 ) == 0 )
|
||||
{
|
||||
floatint_t inf;
|
||||
inf.ui = 0x7f800000;
|
||||
if( endptr == NULL )
|
||||
return inf.f;
|
||||
if( Q_stricmpn( &nptr[3], "inity", 5 ) == 0 )
|
||||
*endptr = (char *)&nptr[8];
|
||||
else
|
||||
*endptr = (char *)&nptr[3];
|
||||
return inf.f;
|
||||
}
|
||||
|
||||
// normal numeric parsing
|
||||
// sign
|
||||
if( *nptr == '-' )
|
||||
{
|
||||
nptr++;
|
||||
neg = qtrue;
|
||||
}
|
||||
else if( *nptr == '+' )
|
||||
nptr++;
|
||||
// hex
|
||||
if( Q_stricmpn( nptr, "0x", 2 ) == 0 )
|
||||
{
|
||||
// track if we use any digits
|
||||
const char *s = &nptr[1], *end = s;
|
||||
nptr += 2;
|
||||
res = 0;
|
||||
while( qtrue )
|
||||
{
|
||||
if( isdigit( *nptr ) )
|
||||
res = 16 * res + ( *nptr++ - '0' );
|
||||
else if( *nptr >= 'A' && *nptr <= 'F' )
|
||||
res = 16 * res + 10 + *nptr++ - 'A';
|
||||
else if( *nptr >= 'a' && *nptr <= 'f' )
|
||||
res = 16 * res + 10 + *nptr++ - 'a';
|
||||
else
|
||||
break;
|
||||
}
|
||||
// if nptr moved, save it
|
||||
if( end + 1 < nptr )
|
||||
end = nptr;
|
||||
if( *nptr == '.' )
|
||||
{
|
||||
float place;
|
||||
nptr++;
|
||||
// 1.0 / 16.0 == 0.0625
|
||||
// I don't expect the float accuracy to hold out for
|
||||
// very long but since we need to know the length of
|
||||
// the string anyway we keep on going regardless
|
||||
for( place = 0.0625;; place /= 16.0 )
|
||||
{
|
||||
if( isdigit( *nptr ) )
|
||||
res += place * ( *nptr++ - '0' );
|
||||
else if( *nptr >= 'A' && *nptr <= 'F' )
|
||||
res += place * ( 10 + *nptr++ - 'A' );
|
||||
else if( *nptr >= 'a' && *nptr <= 'f' )
|
||||
res += place * ( 10 + *nptr++ - 'a' );
|
||||
else
|
||||
break;
|
||||
}
|
||||
if( end < nptr )
|
||||
end = nptr;
|
||||
}
|
||||
// parse an optional exponent, representing multiplication
|
||||
// by a power of two
|
||||
// exponents are only valid if we encountered at least one
|
||||
// digit already (and have therefore set end to something)
|
||||
if( end != s && tolower( *nptr ) == 'p' )
|
||||
{
|
||||
int exp;
|
||||
float res2;
|
||||
// apparently (confusingly) the exponent should be
|
||||
// decimal
|
||||
exp = strtol( &nptr[1], (char **)&end, 10 );
|
||||
if( &nptr[1] == end )
|
||||
{
|
||||
// no exponent
|
||||
if( endptr )
|
||||
*endptr = (char *)nptr;
|
||||
return res;
|
||||
}
|
||||
if( exp > 0 )
|
||||
{
|
||||
while( exp-- > 0 )
|
||||
{
|
||||
res2 = res * 2;
|
||||
// check for infinity
|
||||
if( res2 <= res )
|
||||
break;
|
||||
res = res2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while( exp++ < 0 )
|
||||
{
|
||||
res2 = res / 2;
|
||||
// check for underflow
|
||||
if( res2 >= res )
|
||||
break;
|
||||
res = res2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( endptr )
|
||||
*endptr = (char *)end;
|
||||
return res;
|
||||
}
|
||||
// decimal
|
||||
else
|
||||
{
|
||||
// track if we find any digits
|
||||
const char *end = nptr, *p = nptr;
|
||||
// this is most of the work
|
||||
for( res = 0; isdigit( *nptr );
|
||||
res = 10 * res + *nptr++ - '0' );
|
||||
// if nptr moved, we read something
|
||||
if( end < nptr )
|
||||
end = nptr;
|
||||
if( *nptr == '.' )
|
||||
{
|
||||
// fractional part
|
||||
float place;
|
||||
nptr++;
|
||||
for( place = 0.1; isdigit( *nptr ); place /= 10.0 )
|
||||
res += ( *nptr++ - '0' ) * place;
|
||||
// if nptr moved, we read something
|
||||
if( end + 1 < nptr )
|
||||
end = nptr;
|
||||
}
|
||||
// exponent
|
||||
// meaningless without having already read digits, so check
|
||||
// we've set end to something
|
||||
if( p != end && tolower( *nptr ) == 'e' )
|
||||
{
|
||||
int exp;
|
||||
float res10;
|
||||
exp = strtol( &nptr[1], (char **)&end, 10 );
|
||||
if( &nptr[1] == end )
|
||||
{
|
||||
// no exponent
|
||||
if( endptr )
|
||||
*endptr = (char *)nptr;
|
||||
return res;
|
||||
}
|
||||
if( exp > 0 )
|
||||
{
|
||||
while( exp-- > 0 )
|
||||
{
|
||||
res10 = res * 10;
|
||||
// check for infinity to save us time
|
||||
if( res10 <= res )
|
||||
break;
|
||||
res = res10;
|
||||
}
|
||||
}
|
||||
else if( exp < 0 )
|
||||
{
|
||||
while( exp++ < 0 )
|
||||
{
|
||||
res10 = res / 10;
|
||||
// check for underflow
|
||||
// (test for 0 would probably be just
|
||||
// as good)
|
||||
if( res10 >= res )
|
||||
break;
|
||||
res = res10;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( endptr )
|
||||
*endptr = (char *)end;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
int atoi( const char *string ) {
|
||||
int sign;
|
||||
|
@ -1031,6 +1270,98 @@ int _atoi( const char **stringPtr ) {
|
|||
return value * sign;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
strtol
|
||||
|
||||
Handles any base from 2 to 36. If base is 0 then it guesses
|
||||
decimal, hex, or octal based on the format of the number (leading 0 or 0x)
|
||||
Will not overflow - returns LONG_MIN or LONG_MAX as appropriate
|
||||
*endptr is set to the location of the first character not used
|
||||
==============
|
||||
*/
|
||||
long strtol( const char *nptr, char **endptr, int base )
|
||||
{
|
||||
long res;
|
||||
qboolean pos = qtrue;
|
||||
|
||||
if( endptr )
|
||||
*endptr = (char *)nptr;
|
||||
// bases other than 0, 2, 8, 16 are very rarely used, but they're
|
||||
// not much extra effort to support
|
||||
if( base < 0 || base == 1 || base > 36 )
|
||||
return 0;
|
||||
// skip leading whitespace
|
||||
while( isspace( *nptr ) )
|
||||
nptr++;
|
||||
// sign
|
||||
if( *nptr == '-' )
|
||||
{
|
||||
nptr++;
|
||||
pos = qfalse;
|
||||
}
|
||||
else if( *nptr == '+' )
|
||||
nptr++;
|
||||
// look for base-identifying sequences e.g. 0x for hex, 0 for octal
|
||||
if( nptr[0] == '0' )
|
||||
{
|
||||
nptr++;
|
||||
// 0 is always a valid digit
|
||||
if( endptr )
|
||||
*endptr = (char *)nptr;
|
||||
if( *nptr == 'x' || *nptr == 'X' )
|
||||
{
|
||||
if( base != 0 && base != 16 )
|
||||
{
|
||||
// can't be hex, reject x (accept 0)
|
||||
if( endptr )
|
||||
*endptr = (char *)nptr;
|
||||
return 0;
|
||||
}
|
||||
nptr++;
|
||||
base = 16;
|
||||
}
|
||||
else if( base == 0 )
|
||||
base = 8;
|
||||
}
|
||||
else if( base == 0 )
|
||||
base = 10;
|
||||
res = 0;
|
||||
while( qtrue )
|
||||
{
|
||||
int val;
|
||||
if( isdigit( *nptr ) )
|
||||
val = *nptr - '0';
|
||||
else if( islower( *nptr ) )
|
||||
val = 10 + *nptr - 'a';
|
||||
else if( isupper( *nptr ) )
|
||||
val = 10 + *nptr - 'A';
|
||||
else
|
||||
break;
|
||||
if( val >= base )
|
||||
break;
|
||||
// we go negative because LONG_MIN is further from 0 than
|
||||
// LONG_MAX
|
||||
if( res < ( LONG_MIN + val ) / base )
|
||||
res = LONG_MIN; // overflow
|
||||
else
|
||||
res = res * base - val;
|
||||
nptr++;
|
||||
if( endptr )
|
||||
*endptr = (char *)nptr;
|
||||
}
|
||||
if( pos )
|
||||
{
|
||||
// can't represent LONG_MIN positive
|
||||
if( res == LONG_MIN )
|
||||
res = LONG_MAX;
|
||||
else
|
||||
res = -res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
int abs( int n ) {
|
||||
return n < 0 ? -n : n;
|
||||
}
|
||||
|
@ -1804,10 +2135,11 @@ int Q_snprintf(char *str, size_t length, const char *fmt, ...)
|
|||
/* this is really crappy */
|
||||
int sscanf( const char *buffer, const char *fmt, ... ) {
|
||||
int cmd;
|
||||
int **arg;
|
||||
va_list ap;
|
||||
int count;
|
||||
size_t len;
|
||||
|
||||
arg = (int **)&fmt + 1;
|
||||
va_start (ap, fmt);
|
||||
count = 0;
|
||||
|
||||
while ( *fmt ) {
|
||||
|
@ -1816,22 +2148,40 @@ int sscanf( const char *buffer, const char *fmt, ... ) {
|
|||
continue;
|
||||
}
|
||||
|
||||
cmd = fmt[1];
|
||||
fmt += 2;
|
||||
fmt++;
|
||||
cmd = *fmt;
|
||||
|
||||
if (isdigit (cmd)) {
|
||||
len = (size_t)_atoi (&fmt);
|
||||
cmd = *(fmt - 1);
|
||||
} else {
|
||||
len = MAX_STRING_CHARS - 1;
|
||||
fmt++;
|
||||
}
|
||||
|
||||
switch ( cmd ) {
|
||||
case 'i':
|
||||
case 'd':
|
||||
case 'u':
|
||||
**arg = _atoi( &buffer );
|
||||
*(va_arg (ap, int *)) = _atoi( &buffer );
|
||||
break;
|
||||
case 'f':
|
||||
*(float *)*arg = _atof( &buffer );
|
||||
*(va_arg (ap, float *)) = _atof( &buffer );
|
||||
break;
|
||||
case 's':
|
||||
{
|
||||
char *s = va_arg (ap, char *);
|
||||
while (isspace (*buffer))
|
||||
buffer++;
|
||||
while (*buffer && !isspace (*buffer) && len-- > 0 )
|
||||
*s++ = *buffer++;
|
||||
*s++ = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
arg++;
|
||||
}
|
||||
|
||||
va_end (ap);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
typedef int size_t;
|
||||
typedef unsigned int size_t;
|
||||
|
||||
typedef char * va_list;
|
||||
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
|
||||
|
@ -46,18 +46,18 @@ typedef char * va_list;
|
|||
#define va_end(ap) ( ap = (va_list)0 )
|
||||
|
||||
#define CHAR_BIT 8 /* number of bits in a char */
|
||||
#define SCHAR_MIN (-128) /* minimum signed char value */
|
||||
#define SCHAR_MAX 127 /* maximum signed char value */
|
||||
#define SCHAR_MAX 0x7f /* maximum signed char value */
|
||||
#define SCHAR_MIN (-SCHAR_MAX - 1) /* minimum signed char value */
|
||||
#define UCHAR_MAX 0xff /* maximum unsigned char value */
|
||||
|
||||
#define SHRT_MIN (-32768) /* minimum (signed) short value */
|
||||
#define SHRT_MAX 32767 /* maximum (signed) short value */
|
||||
#define SHRT_MAX 0x7fff /* maximum (signed) short value */
|
||||
#define SHRT_MIN (-SHRT_MAX - 1) /* minimum (signed) short value */
|
||||
#define USHRT_MAX 0xffff /* maximum unsigned short value */
|
||||
#define INT_MIN (-2147483647 - 1) /* minimum (signed) int value */
|
||||
#define INT_MAX 2147483647 /* maximum (signed) int value */
|
||||
#define INT_MAX 0x7fffffff /* maximum (signed) int value */
|
||||
#define INT_MIN (-INT_MAX - 1) /* minimum (signed) int value */
|
||||
#define UINT_MAX 0xffffffff /* maximum unsigned int value */
|
||||
#define LONG_MIN (-2147483647L - 1) /* minimum (signed) long value */
|
||||
#define LONG_MAX 2147483647L /* maximum (signed) long value */
|
||||
#define LONG_MAX 0x7fffffffL /* maximum (signed) long value */
|
||||
#define LONG_MIN (-LONG_MAX - 1) /* minimum (signed) long value */
|
||||
#define ULONG_MAX 0xffffffffUL /* maximum unsigned long value */
|
||||
|
||||
#define isalnum(c) (isalpha(c) || isdigit(c))
|
||||
|
@ -96,8 +96,10 @@ int toupper( int c );
|
|||
|
||||
double atof( const char *string );
|
||||
double _atof( const char **stringPtr );
|
||||
double strtod( const char *nptr, char **endptr );
|
||||
int atoi( const char *string );
|
||||
int _atoi( const char **stringPtr );
|
||||
long strtol( const char *nptr, char **endptr, int base );
|
||||
|
||||
int Q_vsnprintf( char *buffer, size_t length, const char *fmt, va_list argptr );
|
||||
int Q_snprintf( char *buffer, size_t length, const char *fmt, ... ) __attribute__ ((format (printf, 3, 4)));
|
||||
|
|
|
@ -73,7 +73,6 @@ extern pml_t pml;
|
|||
extern float pm_stopspeed;
|
||||
extern float pm_duckScale;
|
||||
extern float pm_swimScale;
|
||||
extern float pm_wadeScale;
|
||||
|
||||
extern float pm_accelerate;
|
||||
extern float pm_airaccelerate;
|
||||
|
|
|
@ -141,7 +141,7 @@ gitem_t bg_itemlist[] = {
|
|||
NULL,
|
||||
{NULL,
|
||||
NULL,
|
||||
0, 0}
|
||||
NULL, NULL}
|
||||
,
|
||||
/* icon */ NULL,
|
||||
/* pickup */ NULL,
|
||||
|
@ -711,7 +711,7 @@ Only in CTF games
|
|||
{NULL}
|
||||
};
|
||||
|
||||
int bg_numItems = sizeof(bg_itemlist) / sizeof(bg_itemlist[0]) - 1;
|
||||
int bg_numItems = ARRAY_LEN( bg_itemlist ) - 1;
|
||||
|
||||
/*
|
||||
==============
|
||||
|
@ -1233,12 +1233,19 @@ char *eventnames[] = {
|
|||
"EV_PROXIMITY_MINE_TRIGGER",
|
||||
"EV_KAMIKAZE", // kamikaze explodes
|
||||
"EV_OBELISKEXPLODE", // obelisk explodes
|
||||
"EV_OBELISKPAIN", // obelisk pain
|
||||
"EV_INVUL_IMPACT", // invulnerability sphere impact
|
||||
"EV_JUICED", // invulnerability juiced effect
|
||||
"EV_LIGHTNINGBOLT", // lightning bolt bounced of invulnerability sphere
|
||||
"EV_DEBUG_LINE",
|
||||
"EV_STOPLOOPINGSOUND",
|
||||
"EV_TAUNT"
|
||||
"EV_TAUNT",
|
||||
"EV_TAUNT_YES",
|
||||
"EV_TAUNT_NO",
|
||||
"EV_TAUNT_FOLLOWME",
|
||||
"EV_TAUNT_GETFLAG",
|
||||
"EV_TAUNT_GUARDBASE",
|
||||
"EV_TAUNT_PATROL"
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -166,7 +166,6 @@ pml_t pml;
|
|||
float pm_stopspeed = 100.0f;
|
||||
float pm_duckScale = 0.25f;
|
||||
float pm_swimScale = 0.50f;
|
||||
float pm_wadeScale = 0.70f;
|
||||
float pm_ladderScale = 0.75f; // more c3a ladders
|
||||
float pm_maxspeed = 300;
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@
|
|||
// because games can change separately from the main system version, we need a
|
||||
// second version that must match between game and cgame
|
||||
|
||||
#define GAME_VERSION "baseq3-1"
|
||||
#define GAME_VERSION BASEGAME "-1"
|
||||
|
||||
#define DEFAULT_GRAVITY 800
|
||||
//Elder: lowered from -40 so falling deaths don't gib so easily
|
||||
|
|
|
@ -48,7 +48,6 @@ void UpdateTournamentInfo(void)
|
|||
gentity_t *player;
|
||||
int playerClientNum;
|
||||
int n, accuracy, perfect, msglen;
|
||||
int buflen;
|
||||
char buf[32];
|
||||
char msg[MAX_STRING_CHARS];
|
||||
|
||||
|
@ -97,8 +96,8 @@ void UpdateTournamentInfo(void)
|
|||
n = level.sortedClients[i];
|
||||
Com_sprintf(buf, sizeof(buf), " %i %i %i", n, level.clients[n].ps.persistant[PERS_RANK],
|
||||
level.clients[n].ps.persistant[PERS_SCORE]);
|
||||
buflen = strlen(buf);
|
||||
if (msglen + buflen + 1 >= sizeof(msg)) {
|
||||
msglen += strlen(buf);
|
||||
if (msglen >= sizeof(msg)) {
|
||||
break;
|
||||
}
|
||||
strcat(msg, buf);
|
||||
|
|
|
@ -333,7 +333,6 @@ G_RemoveRandomBot
|
|||
int G_RemoveRandomBot(int team)
|
||||
{
|
||||
int i;
|
||||
char netname[36];
|
||||
gclient_t *cl;
|
||||
|
||||
for (i = 0; i < g_maxclients.integer; i++) {
|
||||
|
@ -347,9 +346,7 @@ int G_RemoveRandomBot(int team)
|
|||
if (team >= 0 && cl->sess.sessionTeam != team) {
|
||||
continue;
|
||||
}
|
||||
strcpy(netname, cl->pers.netname);
|
||||
Q_CleanStr(netname);
|
||||
trap_SendConsoleCommand(EXEC_INSERT, va("kick %s\n", netname));
|
||||
trap_SendConsoleCommand( EXEC_INSERT, va("clientkick %d\n", cl->ps.clientNum) );
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
|
|
|
@ -940,75 +940,43 @@ ClientCheckName
|
|||
*/
|
||||
static void ClientCleanName(const char *in, char *out, int outSize)
|
||||
{
|
||||
int len, colorlessLen;
|
||||
char ch;
|
||||
char *p;
|
||||
int spaces;
|
||||
int outpos = 0, colorlessLen = 0, spaces = 0;
|
||||
|
||||
//save room for trailing null byte
|
||||
outSize--;
|
||||
// discard leading spaces
|
||||
for (; *in == ' '; in++);
|
||||
for (; *in && outpos < outSize - 1; in++) {
|
||||
out[outpos] = *in;
|
||||
|
||||
len = 0;
|
||||
colorlessLen = 0;
|
||||
p = out;
|
||||
*p = 0;
|
||||
spaces = 0;
|
||||
|
||||
while (1) {
|
||||
ch = *in++;
|
||||
if (!ch) {
|
||||
break;
|
||||
}
|
||||
// don't allow leading spaces
|
||||
if (!*p && ch == ' ') {
|
||||
continue;
|
||||
}
|
||||
// check colors
|
||||
if (ch == Q_COLOR_ESCAPE) {
|
||||
// solo trailing carat is not a color prefix
|
||||
if (!*in) {
|
||||
break;
|
||||
}
|
||||
// don't allow black in a name, period
|
||||
if (ColorIndex(*in) == 0) {
|
||||
in++;
|
||||
if (*in == ' ') {
|
||||
// don't allow too many consecutive spaces
|
||||
if (spaces > 2)
|
||||
continue;
|
||||
}
|
||||
// make sure room in dest for both chars
|
||||
if (len > outSize - 2) {
|
||||
break;
|
||||
}
|
||||
|
||||
*out++ = ch;
|
||||
*out++ = *in++;
|
||||
len += 2;
|
||||
continue;
|
||||
}
|
||||
// don't allow too many consecutive spaces
|
||||
if (ch == ' ') {
|
||||
spaces++;
|
||||
if (spaces > 3) {
|
||||
continue;
|
||||
} else if (outpos > 0 && out[outpos - 1] == Q_COLOR_ESCAPE) {
|
||||
if (Q_IsColorString(&out[outpos - 1])) {
|
||||
colorlessLen--;
|
||||
if (ColorIndex(*in) == 0) {
|
||||
// Disallow color black in names to prevent players
|
||||
// from getting advantage playing in front of black backgrounds
|
||||
outpos--;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
spaces = 0;
|
||||
colorlessLen++;
|
||||
}
|
||||
} else {
|
||||
spaces = 0;
|
||||
colorlessLen++;
|
||||
}
|
||||
|
||||
if (len > outSize - 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
*out++ = ch;
|
||||
colorlessLen++;
|
||||
len++;
|
||||
outpos++;
|
||||
}
|
||||
*out = 0;
|
||||
|
||||
out[outpos] = '\0';
|
||||
|
||||
// don't allow empty names
|
||||
if (*p == 0 || colorlessLen == 0) {
|
||||
//Elder: change to what we want
|
||||
Q_strncpyz(p, RQ3_NONAMEPLAYER, outSize);
|
||||
}
|
||||
if( *out == '\0' || colorlessLen == 0)
|
||||
Q_strncpyz(out, RQ3_NONAMEPLAYER, outSize);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1326,13 +1294,11 @@ restarts.
|
|||
*/
|
||||
char *ClientConnect(int clientNum, qboolean firstTime, qboolean isBot)
|
||||
{
|
||||
char *value, *ip;
|
||||
char *value;
|
||||
gclient_t *client;
|
||||
char userinfo[MAX_INFO_STRING], ipaddr[64];
|
||||
gentity_t *ent;
|
||||
|
||||
//Blaze: Prit out some Debug info
|
||||
if (&g_entities[clientNum] == NULL) G_Printf("Ln 1399\n");
|
||||
ent = &g_entities[clientNum];
|
||||
trap_GetUserinfo(clientNum, userinfo, sizeof(userinfo));
|
||||
|
||||
|
@ -1340,16 +1306,15 @@ char *ClientConnect(int clientNum, qboolean firstTime, qboolean isBot)
|
|||
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=500
|
||||
// recommanding PB based IP / GUID banning, the builtin system is pretty limited
|
||||
// check to see if they are on the banned IP list
|
||||
ip = Info_ValueForKey(userinfo, "ip");
|
||||
strcpy(ipaddr, ip);
|
||||
if (G_FilterPacket(ip)) {
|
||||
value = Info_ValueForKey(userinfo, "ip");
|
||||
strncpy(ipaddr, value, sizeof(ipaddr));
|
||||
if (G_FilterPacket(value)) {
|
||||
return "You are banned from this server..";
|
||||
}
|
||||
// we don't check password for bots and local client
|
||||
// NOTE: local client <-> "ip" "localhost"
|
||||
// this means this client is not running in our current process
|
||||
//Slicer: Crash FIX - during the 1.32 merging the strcmp was using "value" without being assigned.. replaced it with "ip"
|
||||
if (!(ent->r.svFlags & SVF_BOT) && (strcmp(ip, "localhost") != 0)) {
|
||||
if ( !isBot && (strcmp(value, "localhost") != 0)) {
|
||||
// check for a password
|
||||
value = Info_ValueForKey(userinfo, "password");
|
||||
if (g_password.string[0] && Q_stricmp(g_password.string, "none") &&
|
||||
|
@ -1738,7 +1703,7 @@ void ClientSpawn(gentity_t * ent)
|
|||
savedFemaleSet = client->radioSetFemale;
|
||||
memcpy(&savedCamera, &client->camera, sizeof(camera_t));
|
||||
|
||||
memset(client, 0, sizeof(*client)); // bk FIXME: Com_Memset?
|
||||
Com_Memset (client, 0, sizeof(*client));
|
||||
|
||||
// JBravo: restore weapon/item info
|
||||
client->teamplayWeapon = savedWeapon;
|
||||
|
|
|
@ -955,6 +955,11 @@ void Cmd_LevelShot_f(gentity_t * ent)
|
|||
return;
|
||||
}
|
||||
|
||||
if(!ent->client->pers.localClient) {
|
||||
trap_SendServerCommand(ent-g_entities, "print \"The levelshot command must be executed by a local client\n\"");
|
||||
return;
|
||||
}
|
||||
|
||||
BeginIntermission();
|
||||
trap_SendServerCommand(ent - g_entities, "clientLevelShot");
|
||||
}
|
||||
|
@ -1129,17 +1134,17 @@ void SetTeam(gentity_t * ent, char *s)
|
|||
if (g_teamForceBalance.integer) {
|
||||
int counts[TEAM_NUM_TEAMS];
|
||||
|
||||
counts[TEAM_BLUE] = TeamCount(ent->client->ps.clientNum, TEAM_BLUE);
|
||||
counts[TEAM_RED] = TeamCount(ent->client->ps.clientNum, TEAM_RED);
|
||||
counts[TEAM_BLUE] = TeamCount( clientNum, TEAM_BLUE );
|
||||
counts[TEAM_RED] = TeamCount( clientNum, TEAM_RED );
|
||||
|
||||
// We allow a spread of two
|
||||
if (team == TEAM_RED && counts[TEAM_RED] - counts[TEAM_BLUE] > 1) {
|
||||
trap_SendServerCommand(ent->client->ps.clientNum,
|
||||
trap_SendServerCommand(clientNum,
|
||||
"cp \"Red team has too many players.\n\"");
|
||||
return; // ignore the request
|
||||
}
|
||||
if (team == TEAM_BLUE && counts[TEAM_BLUE] - counts[TEAM_RED] > 1) {
|
||||
trap_SendServerCommand(ent->client->ps.clientNum,
|
||||
trap_SendServerCommand(clientNum,
|
||||
"cp \"Blue team has too many players.\n\"");
|
||||
return; // ignore the request
|
||||
}
|
||||
|
@ -1995,7 +2000,7 @@ void Cmd_GameCommand_f(gentity_t * ent)
|
|||
if (player < 0 || player >= MAX_CLIENTS) {
|
||||
return;
|
||||
}
|
||||
if (order < 0 || order > sizeof(gc_orders) / sizeof(char *)) {
|
||||
if (order < 0 || order > ARRAY_LEN(gc_orders)) {
|
||||
return;
|
||||
}
|
||||
//Blaze: Prit out some Debug info
|
||||
|
|
|
@ -1255,7 +1255,7 @@ void player_die(gentity_t * self, gentity_t * inflictor, gentity_t * attacker, i
|
|||
self->client->pers.records[REC_WORLDDEATHS]++;
|
||||
}
|
||||
|
||||
if (meansOfDeath < 0 || meansOfDeath >= sizeof(modNames) / sizeof(modNames[0])) {
|
||||
if ( meansOfDeath < 0 || meansOfDeath >= ARRAY_LEN( modNames ) ) {
|
||||
obit = "<bad obituary>";
|
||||
} else {
|
||||
obit = modNames[meansOfDeath];
|
||||
|
|
|
@ -386,7 +386,7 @@
|
|||
//==================================================================
|
||||
|
||||
// the "gameversion" client command will print this plus compile date
|
||||
#define GAMEVERSION "rq3"
|
||||
#define GAMEVERSION BASEGAME
|
||||
#define BODY_QUEUE_SIZE 8
|
||||
|
||||
// JBravo: Max number of killed enemys to track
|
||||
|
@ -1125,8 +1125,8 @@ qboolean G_EntitiesFree(void);
|
|||
void G_TouchTriggers(gentity_t * ent);
|
||||
void G_TouchSolids(gentity_t * ent);
|
||||
|
||||
/*float *tv(float x, float y, float z);
|
||||
char *vtos(const vec3_t v);*/
|
||||
//float *tv(float x, float y, float z);
|
||||
char *vtos(const vec3_t v);
|
||||
|
||||
float vectoyaw(const vec3_t vec);
|
||||
|
||||
|
@ -1204,7 +1204,7 @@ qboolean G_FileExists(char *filename);
|
|||
//
|
||||
qboolean LogAccuracyHit(gentity_t * target, gentity_t * attacker);
|
||||
void CalcMuzzlePoint(gentity_t * ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint);
|
||||
//void SnapVectorTowards(vec3_t v, vec3_t to);
|
||||
void SnapVectorTowards(vec3_t v, vec3_t to);
|
||||
qboolean CheckGauntletAttack(gentity_t * ent);
|
||||
|
||||
// JBravo: unlagged - g_unlagged.c
|
||||
|
@ -1413,7 +1413,7 @@ extern gentity_t g_entities[MAX_GENTITIES];
|
|||
//Makro - moveparent tree
|
||||
extern gentity_t *g_parentOrder[MAX_GENTITIES];
|
||||
|
||||
#define FOFS(x) ((int)&(((gentity_t *)0)->x))
|
||||
#define FOFS(x) ((size_t)&(((gentity_t *)0)->x))
|
||||
|
||||
extern vmCvar_t g_gametype;
|
||||
extern vmCvar_t g_dedicated;
|
||||
|
|
|
@ -452,6 +452,8 @@ gentity_t *getEntByName(char *name);
|
|||
void AddIP(char *str);
|
||||
void G_RunAttachedEnt(gentity_t *ent);
|
||||
void G_SetGlobalRefSystem(int newRefSys);
|
||||
void G_TransposeMatrix(vec3_t matrix[3], vec3_t transpose[3]);
|
||||
void G_RotatePoint(vec3_t point, vec3_t matrix[3]);
|
||||
level_locals_t level;
|
||||
|
||||
typedef struct {
|
||||
|
@ -749,7 +751,7 @@ static cvarTable_t gameCvarTable[] = {
|
|||
};
|
||||
|
||||
// bk001129 - made static to avoid aliasing
|
||||
static int gameCvarTableSize = sizeof(gameCvarTable) / sizeof(gameCvarTable[0]);
|
||||
static int gameCvarTableSize = ARRAY_LEN( gameCvarTable );
|
||||
|
||||
void G_InitGame(int levelTime, int randomSeed, int restart);
|
||||
void G_RunFrame(int levelTime);
|
||||
|
@ -764,9 +766,7 @@ This is the only way control passes into the module.
|
|||
This must be the very first function compiled into the .q3vm file
|
||||
================
|
||||
*/
|
||||
int vmMain(int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8,
|
||||
int arg9, int arg10, int arg11)
|
||||
{
|
||||
Q_EXPORT intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
|
||||
switch (command) {
|
||||
case GAME_INIT:
|
||||
G_InitGame(arg0, arg1, arg2);
|
||||
|
@ -775,7 +775,7 @@ int vmMain(int command, int arg0, int arg1, int arg2, int arg3, int arg4, int ar
|
|||
G_ShutdownGame(arg0);
|
||||
return 0;
|
||||
case GAME_CLIENT_CONNECT:
|
||||
return (int) ClientConnect(arg0, arg1, arg2);
|
||||
return (intptr_t)ClientConnect( arg0, arg1, arg2 );
|
||||
case GAME_CLIENT_THINK:
|
||||
//G_SetGlobalRefSystem(REFSYSTEM_WORLD);
|
||||
ClientThink(arg0);
|
||||
|
@ -1201,8 +1201,8 @@ void G_InitMoveParents( void )
|
|||
VectorNegate(ent->moveParent_ent->s.origin, ent->s.angles2);
|
||||
VectorNegate(ent->moveParent_ent->s.angles, v);
|
||||
AnglesToAxis(v, axis);
|
||||
TransposeMatrix(axis, matrix);
|
||||
RotatePoint(ent->s.angles2, matrix);
|
||||
G_TransposeMatrix(axis, matrix);
|
||||
G_RotatePoint(ent->s.angles2, matrix);
|
||||
|
||||
/*
|
||||
//adjust origin, angles etc.
|
||||
|
@ -1215,13 +1215,13 @@ void G_InitMoveParents( void )
|
|||
VectorSubtract(ent->pos2, ent->moveParent_ent->s.origin, ent->pos2);
|
||||
//
|
||||
|
||||
RotatePoint(ent->s.origin, matrix);
|
||||
RotatePoint(ent->r.currentOrigin, matrix);
|
||||
RotatePoint(ent->s.pos.trBase, matrix);
|
||||
G_RotatePoint(ent->s.origin, matrix);
|
||||
G_RotatePoint(ent->r.currentOrigin, matrix);
|
||||
G_RotatePoint(ent->s.pos.trBase, matrix);
|
||||
|
||||
//temp
|
||||
RotatePoint(ent->pos1, matrix);
|
||||
RotatePoint(ent->pos2, matrix);
|
||||
G_RotatePoint(ent->pos1, matrix);
|
||||
G_RotatePoint(ent->pos2, matrix);
|
||||
//
|
||||
*/
|
||||
|
||||
|
@ -1531,7 +1531,6 @@ void G_ShutdownGame(int restart)
|
|||
|
||||
//===================================================================
|
||||
|
||||
#ifndef GAME_HARD_LINKED
|
||||
// this is only here so the functions in q_shared.c and bg_*.c can link
|
||||
|
||||
void QDECL Com_Error(int level, const char *error, ...)
|
||||
|
@ -1558,8 +1557,6 @@ void QDECL Com_Printf(const char *msg, ...)
|
|||
G_Printf("%s", text);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
|
@ -1778,7 +1775,7 @@ void CalculateRanks(void)
|
|||
level.numNonSpectatorClients = 0;
|
||||
level.numPlayingClients = 0;
|
||||
level.numVotingClients = 0; // don't count bots
|
||||
for (i = 0; i < TEAM_NUM_TEAMS; i++) {
|
||||
for (i = 0; i < ARRAY_LEN(level.numteamVotingClients); i++) {
|
||||
level.numteamVotingClients[i] = 0;
|
||||
}
|
||||
for (i = 0; i < level.maxclients; i++) {
|
||||
|
|
|
@ -203,7 +203,6 @@
|
|||
|
||||
#include "g_local.h"
|
||||
void InitRotator(gentity_t * ent);
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
|
@ -256,6 +255,44 @@ gentity_t *G_TestEntityPosition(gentity_t * ent)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* ================
|
||||
* G_CreateRotationMatrix
|
||||
* ================
|
||||
* */
|
||||
void G_CreateRotationMatrix(vec3_t angles, vec3_t matrix[3]) {
|
||||
AngleVectors(angles, matrix[0], matrix[1], matrix[2]);
|
||||
VectorInverse(matrix[1]);
|
||||
}
|
||||
|
||||
/*
|
||||
* ================
|
||||
* G_TransposeMatrix
|
||||
* ================
|
||||
* */
|
||||
void G_TransposeMatrix(vec3_t matrix[3], vec3_t transpose[3]) {
|
||||
int i, j;
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
transpose[i][j] = matrix[j][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ================
|
||||
* G_RotatePoint
|
||||
* ================
|
||||
* */
|
||||
void G_RotatePoint(vec3_t point, vec3_t matrix[3]) {
|
||||
vec3_t tvec;
|
||||
|
||||
VectorCopy(point, tvec);
|
||||
point[0] = DotProduct(matrix[0], tvec);
|
||||
point[1] = DotProduct(matrix[1], tvec);
|
||||
point[2] = DotProduct(matrix[2], tvec);
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
G_TryPushingEntity
|
||||
|
@ -289,8 +326,8 @@ qboolean G_TryPushingEntity(gentity_t * check, gentity_t * pusher, vec3_t move,
|
|||
|
||||
// try moving the contacted entity
|
||||
// figure movement due to the pusher's amove
|
||||
CreateRotationMatrix(amove, transpose);
|
||||
TransposeMatrix(transpose, matrix);
|
||||
G_CreateRotationMatrix(amove, transpose);
|
||||
G_TransposeMatrix(transpose, matrix);
|
||||
if (check->client) {
|
||||
VectorSubtract(check->client->ps.origin, pusher->r.currentOrigin, org);
|
||||
} else {
|
||||
|
@ -302,7 +339,7 @@ qboolean G_TryPushingEntity(gentity_t * check, gentity_t * pusher, vec3_t move,
|
|||
VectorAdd(org, move, org);
|
||||
|
||||
VectorCopy(org, org2);
|
||||
RotatePoint(org2, matrix);
|
||||
G_RotatePoint(org2, matrix);
|
||||
VectorSubtract(org2, org, move2);
|
||||
// add movement
|
||||
VectorAdd(check->s.pos.trBase, move, check->s.pos.trBase);
|
||||
|
@ -2446,6 +2483,25 @@ void Use_Func_Train(gentity_t * ent, gentity_t * other, gentity_t * activator)
|
|||
|
||||
ent->s.pos.trDuration = length * 1000 / speed;
|
||||
|
||||
// Tequila comment: Be sure to send to clients after any fast move case
|
||||
ent->r.svFlags &= ~SVF_NOCLIENT;
|
||||
|
||||
// Tequila comment: Fast move case
|
||||
if(ent->s.pos.trDuration<1) {
|
||||
// Tequila comment: As trDuration is used later in a division, we need to avoid that case now
|
||||
// With null trDuration,
|
||||
// the calculated rocks bounding box becomes infinite and the engine think for a short time
|
||||
// any entity is riding that mover but not the world entity... In rare case, I found it
|
||||
// can also stuck every map entities after func_door are used.
|
||||
// The desired effect with very very big speed is to have instant move, so any not null duration
|
||||
// lower than a frame duration should be sufficient.
|
||||
// Afaik, the negative case don't have to be supported.
|
||||
ent->s.pos.trDuration=1;
|
||||
|
||||
// Tequila comment: Don't send entity to clients so it becomes really invisible
|
||||
ent->r.svFlags |= SVF_NOCLIENT;
|
||||
}
|
||||
|
||||
// looping sound
|
||||
ent->s.loopSound = next->soundLoop;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
//===============================================================
|
||||
|
||||
typedef struct {
|
||||
entityState_t s; // communicated by server to clients
|
||||
entityState_t unused; // apparently this field was put here accidentally (and is kept only for compatibility, as a struct pad)
|
||||
|
||||
qboolean linked; // qfalse if not in any good cluster
|
||||
int linkcount;
|
||||
|
@ -85,8 +85,8 @@ typedef struct {
|
|||
// when a trace call is made and passEntityNum != ENTITYNUM_NONE,
|
||||
// an ent will be excluded from testing if:
|
||||
// ent->s.number == passEntityNum (don't interact with self)
|
||||
// ent->s.ownerNum = passEntityNum (don't interact with your own missiles)
|
||||
// entity[ent->s.ownerNum].ownerNum = passEntityNum (don't interact with other missiles from owner)
|
||||
// ent->r.ownerNum = passEntityNum (don't interact with your own missiles)
|
||||
// entity[ent->r.ownerNum].r.ownerNum == passEntityNum (don't interact with other missiles from owner)
|
||||
int ownerNum;
|
||||
} entityShared_t;
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ void G_WriteClientSessionData(gclient_t * client)
|
|||
//Captain and sub
|
||||
);
|
||||
|
||||
var = va("session%i", client - level.clients);
|
||||
var = va( "session%i", (int)(client - level.clients) );
|
||||
|
||||
trap_Cvar_Set(var, s);
|
||||
|
||||
|
@ -141,7 +141,7 @@ void G_ReadSessionData(gclient_t * client)
|
|||
int sub;
|
||||
int ref;
|
||||
|
||||
var = va("session%i", client - level.clients);
|
||||
var = va("session%i", (int)(client - level.clients));
|
||||
trap_Cvar_VariableStringBuffer(var, s, sizeof(s));
|
||||
//Slicer: Reading savedTeam also.
|
||||
sscanf(s, "%i %i %i %i %i %i %i %i %i %i %i", &sessionTeam, // bk010221 - format
|
||||
|
|
|
@ -230,7 +230,7 @@ typedef struct {
|
|||
char *name;
|
||||
int ofs;
|
||||
fieldtype_t type;
|
||||
int flags;
|
||||
// int flags;
|
||||
} field_t;
|
||||
|
||||
field_t fields[] = {
|
||||
|
@ -438,7 +438,7 @@ spawn_t spawns[] = {
|
|||
// {"func_explosive", SP_func_explosive}, // JBravo: for explosive.
|
||||
{"item_botroam", SP_item_botroam},
|
||||
|
||||
{0, 0}
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
// JBravo: Compiler warning shutup
|
||||
|
|
|
@ -29,19 +29,17 @@
|
|||
#error "Do not use in VM build"
|
||||
#endif
|
||||
|
||||
static int (QDECL * syscall) (int arg, ...) = (int (QDECL *) (int, ...)) -1;
|
||||
static intptr_t (QDECL *syscall)( intptr_t arg, ... ) = (intptr_t (QDECL *)( intptr_t, ...))-1;
|
||||
|
||||
void dllEntry(int (QDECL * syscallptr) (int arg, ...))
|
||||
{
|
||||
Q_EXPORT void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) {
|
||||
syscall = syscallptr;
|
||||
}
|
||||
|
||||
int PASSFLOAT(float x)
|
||||
{
|
||||
float floatTemp;
|
||||
|
||||
floatTemp = x;
|
||||
return *(int *) &floatTemp;
|
||||
floatint_t fi;
|
||||
fi.f = x;
|
||||
return fi.i;
|
||||
}
|
||||
|
||||
void trap_Printf(const char *fmt)
|
||||
|
@ -355,10 +353,9 @@ void trap_AAS_PresenceTypeBoundingBox(int presencetype, vec3_t mins, vec3_t maxs
|
|||
|
||||
float trap_AAS_Time(void)
|
||||
{
|
||||
int temp;
|
||||
|
||||
temp = syscall(BOTLIB_AAS_TIME);
|
||||
return (*(float *) &temp);
|
||||
floatint_t fi;
|
||||
fi.i = syscall( BOTLIB_AAS_TIME );
|
||||
return fi.f;
|
||||
}
|
||||
|
||||
int trap_AAS_PointAreaNum(vec3_t point)
|
||||
|
@ -592,18 +589,18 @@ void trap_BotFreeCharacter(int character)
|
|||
|
||||
float trap_Characteristic_Float(int character, int index)
|
||||
{
|
||||
int temp;
|
||||
floatint_t fi;
|
||||
|
||||
temp = syscall(BOTLIB_AI_CHARACTERISTIC_FLOAT, character, index);
|
||||
return (*(float *) &temp);
|
||||
fi.i = syscall( BOTLIB_AI_CHARACTERISTIC_FLOAT, character, index );
|
||||
return fi.f;
|
||||
}
|
||||
|
||||
float trap_Characteristic_BFloat(int character, int index, float min, float max)
|
||||
{
|
||||
int temp;
|
||||
floatint_t fi;
|
||||
|
||||
temp = syscall(BOTLIB_AI_CHARACTERISTIC_BFLOAT, character, index, PASSFLOAT(min), PASSFLOAT(max));
|
||||
return (*(float *) &temp);
|
||||
fi.i = syscall( BOTLIB_AI_CHARACTERISTIC_BFLOAT, character, index, PASSFLOAT(min), PASSFLOAT(max) );
|
||||
return fi.f;
|
||||
}
|
||||
|
||||
int trap_Characteristic_Integer(int character, int index)
|
||||
|
@ -817,10 +814,10 @@ int trap_BotGetMapLocationGoal(char *name, void /* struct bot_goal_s */ *goal)
|
|||
|
||||
float trap_BotAvoidGoalTime(int goalstate, int number)
|
||||
{
|
||||
int temp;
|
||||
floatint_t fi;
|
||||
|
||||
temp = syscall(BOTLIB_AI_AVOID_GOAL_TIME, goalstate, number);
|
||||
return (*(float *) &temp);
|
||||
fi.i = syscall( BOTLIB_AI_AVOID_GOAL_TIME, goalstate, number );
|
||||
return fi.f;
|
||||
}
|
||||
|
||||
void trap_BotSetAvoidGoalTime(int goalstate, int number, float avoidtime)
|
||||
|
|
|
@ -81,8 +81,9 @@ void Team_InitGame(void)
|
|||
|
||||
switch (g_gametype.integer) {
|
||||
case GT_CTF:
|
||||
teamgame.redStatus = teamgame.blueStatus = -1; // Invalid to force update
|
||||
teamgame.redStatus = -1; // Invalid to force update
|
||||
Team_SetFlagStatus(TEAM_RED, FLAG_ATBASE);
|
||||
teamgame.blueStatus = -1; // Invalid to force update
|
||||
Team_SetFlagStatus(TEAM_BLUE, FLAG_ATBASE);
|
||||
break;
|
||||
default:
|
||||
|
@ -758,7 +759,7 @@ int Team_TouchOurFlag(gentity_t * ent, gentity_t * other, int team)
|
|||
// Ok, let's do the player loop, hand out the bonuses
|
||||
for (i = 0; i < g_maxclients.integer; i++) {
|
||||
player = &g_entities[i];
|
||||
if (!player->inuse)
|
||||
if (!player->inuse || player == other)
|
||||
continue;
|
||||
|
||||
if (player->client->sess.sessionTeam != cl->sess.sessionTeam) {
|
||||
|
@ -1079,7 +1080,7 @@ void TeamplayInfoMessage(gentity_t * ent)
|
|||
i, player->client->pers.teamState.location, h, a,
|
||||
player->client->ps.weapon, player->s.powerups);
|
||||
j = strlen(entry);
|
||||
if (stringlength + j > sizeof(string))
|
||||
if (stringlength + j >= sizeof(string))
|
||||
break;
|
||||
strcpy(string + stringlength, entry);
|
||||
stringlength += j;
|
||||
|
|
|
@ -415,6 +415,28 @@ void G_UseTargets(gentity_t * ent, gentity_t * activator)
|
|||
G_UseEntities(ent, ent->target, activator);
|
||||
}
|
||||
|
||||
/*
|
||||
* =============
|
||||
* VectorToString
|
||||
*
|
||||
* This is just a convenience function
|
||||
* for printing vectors
|
||||
* =============
|
||||
* */
|
||||
char *vtos( const vec3_t v ) {
|
||||
static int index;
|
||||
static char str[8][32];
|
||||
char *s;
|
||||
|
||||
// use an array so that multiple vtos won't collide
|
||||
s = str[index];
|
||||
index = (index + 1)&7;
|
||||
|
||||
Com_sprintf (s, 32, "(%i %i %i)", (int)v[0], (int)v[1], (int)v[2]);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
|
|
|
@ -480,7 +480,7 @@ into a wall.
|
|||
======================
|
||||
*/
|
||||
// JBravo: unlagged. moved to q_shared.c
|
||||
/*
|
||||
|
||||
void SnapVectorTowards(vec3_t v, vec3_t to)
|
||||
{
|
||||
int i;
|
||||
|
@ -492,7 +492,7 @@ void SnapVectorTowards(vec3_t v, vec3_t to)
|
|||
v[i] = (int) v[i] + 1;
|
||||
}
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
#define MACHINEGUN_SPREAD 200
|
||||
#define MACHINEGUN_DAMAGE 7
|
||||
|
|
|
@ -1773,49 +1773,6 @@ int ReflectVectorByte(vec3_t dir, vec3_t plane)
|
|||
return DirToByte(final);
|
||||
}
|
||||
|
||||
//Makro - moved from g_mover.c
|
||||
/*
|
||||
================
|
||||
CreateRotationMatrix
|
||||
================
|
||||
*/
|
||||
void CreateRotationMatrix(const vec3_t angles, vec3_t matrix[3])
|
||||
{
|
||||
AngleVectors(angles, matrix[0], matrix[1], matrix[2]);
|
||||
VectorInverse(matrix[1]);
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
TransposeMatrix
|
||||
================
|
||||
*/
|
||||
void TransposeMatrix(vec3_t matrix[3], vec3_t transpose[3])
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
transpose[i][j] = matrix[j][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
RotatePoint
|
||||
================
|
||||
*/
|
||||
void RotatePoint(vec3_t point, vec3_t matrix[3])
|
||||
{
|
||||
vec3_t tvec;
|
||||
|
||||
VectorCopy(point, tvec);
|
||||
point[0] = DotProduct(matrix[0], tvec);
|
||||
point[1] = DotProduct(matrix[1], tvec);
|
||||
point[2] = DotProduct(matrix[2], tvec);
|
||||
}
|
||||
|
||||
//Makro - added
|
||||
void ChangeRefSystem(vec3_t in, vec3_t neworg, vec3_t newaxis[], vec3_t out)
|
||||
{
|
||||
|
|
|
@ -223,6 +223,32 @@ static float asinf(float x)
|
|||
/* local data */
|
||||
static camera_t cameras[MAX_CLIENTS];
|
||||
|
||||
/*
|
||||
* =============
|
||||
* TempVector
|
||||
*
|
||||
* This is just a convenience function
|
||||
* for making temporary vectors for function calls
|
||||
* =============
|
||||
* */
|
||||
float *tv(float x, float y, float z)
|
||||
{
|
||||
static int index;
|
||||
static vec3_t vecs[8];
|
||||
float *v;
|
||||
|
||||
// use an array so that multiple tempvectors won't collide
|
||||
// for a while
|
||||
v = vecs[index];
|
||||
index = (index + 1) & 7;
|
||||
|
||||
v[0] = x;
|
||||
v[1] = y;
|
||||
v[2] = z;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
/* local functions */
|
||||
|
||||
static gentity_t *ClosestVisible(gentity_t * ent, float maxrange, qboolean pvs)
|
||||
|
|
|
@ -52,14 +52,3 @@ Sys_SendPacket
|
|||
*/
|
||||
void Sys_SendPacket( int length, void *data, netadr_t to ) {
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Sys_GetPacket
|
||||
|
||||
Never called by the game logic, just the system event queing
|
||||
==================
|
||||
*/
|
||||
qboolean Sys_GetPacket ( netadr_t *net_from, msg_t *net_message ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -51,14 +51,3 @@ Sys_SendPacket
|
|||
*/
|
||||
void Sys_SendPacket( int length, void *data, netadr_t to ) {
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Sys_GetPacket
|
||||
|
||||
Never called by the game logic, just the system event queing
|
||||
==================
|
||||
*/
|
||||
qboolean Sys_GetPacket ( netadr_t *net_from, msg_t *net_message ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ static cvarTable_t cvarTable[] = {
|
|||
{ &ui_ioq3, "ui_ioq3", "1", CVAR_ROM }
|
||||
};
|
||||
|
||||
static int cvarTableSize = sizeof(cvarTable) / sizeof(cvarTable[0]);
|
||||
static int cvarTableSize = ARRAY_LEN( cvarTable );
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -121,7 +121,7 @@ void Main_MenuEvent (void* ptr, int event) {
|
|||
break;
|
||||
|
||||
case ID_TEAMARENA:
|
||||
trap_Cvar_Set( "fs_game", "missionpack");
|
||||
trap_Cvar_Set( "fs_game", BASETA);
|
||||
trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart;" );
|
||||
break;
|
||||
|
||||
|
@ -248,7 +248,7 @@ static qboolean UI_TeamArenaExists( void ) {
|
|||
for( i = 0; i < numdirs; i++ ) {
|
||||
dirlen = strlen( dirptr ) + 1;
|
||||
descptr = dirptr + dirlen;
|
||||
if (Q_stricmp(dirptr, "missionpack") == 0) {
|
||||
if (Q_stricmp(dirptr, BASETA) == 0) {
|
||||
return qtrue;
|
||||
}
|
||||
dirptr += dirlen + strlen(descptr) + 1;
|
||||
|
|
|
@ -147,8 +147,8 @@ static char* gamenames[] = {
|
|||
};
|
||||
|
||||
static char* netnames[] = {
|
||||
"???",
|
||||
"UDP",
|
||||
"??? ",
|
||||
"UDP ",
|
||||
"UDP6",
|
||||
NULL
|
||||
};
|
||||
|
@ -534,7 +534,7 @@ static void ArenaServers_UpdateMenu( void ) {
|
|||
pingColor = S_COLOR_RED;
|
||||
}
|
||||
|
||||
Com_sprintf( buff, MAX_LISTBOXWIDTH, "%-20.20s %-12.12s %2d/%2d %-8.8s %3s %s%3d " S_COLOR_YELLOW "%s",
|
||||
Com_sprintf( buff, MAX_LISTBOXWIDTH, "%-20.20s %-12.12s %2d/%2d %-8.8s %4s%s%3d " S_COLOR_YELLOW "%s",
|
||||
servernodeptr->hostname, servernodeptr->mapname, servernodeptr->numclients,
|
||||
servernodeptr->maxclients, servernodeptr->gamename,
|
||||
netnames[servernodeptr->nettype], pingColor, servernodeptr->pingtime, servernodeptr->bPB ? "Yes" : "No" );
|
||||
|
@ -672,6 +672,9 @@ static void ArenaServers_Insert( char* adrstr, char* info, int pingtime )
|
|||
}
|
||||
*/
|
||||
servernodeptr->nettype = atoi(Info_ValueForKey(info, "nettype"));
|
||||
if (servernodeptr->nettype < 0 || servernodeptr->nettype >= ARRAY_LEN(netnames) - 1) {
|
||||
servernodeptr->nettype = 0;
|
||||
}
|
||||
|
||||
s = Info_ValueForKey( info, "game");
|
||||
i = atoi( Info_ValueForKey( info, "gametype") );
|
||||
|
|
|
@ -766,13 +766,13 @@ static void ServerOptions_Start( void ) {
|
|||
case GT_TEAM:
|
||||
trap_Cvar_SetValue( "ui_team_fraglimit", fraglimit );
|
||||
trap_Cvar_SetValue( "ui_team_timelimit", timelimit );
|
||||
trap_Cvar_SetValue( "ui_team_friendlt", friendlyfire );
|
||||
trap_Cvar_SetValue( "ui_team_friendly", friendlyfire );
|
||||
break;
|
||||
|
||||
case GT_CTF:
|
||||
trap_Cvar_SetValue( "ui_ctf_fraglimit", fraglimit );
|
||||
trap_Cvar_SetValue( "ui_ctf_capturelimit", flaglimit );
|
||||
trap_Cvar_SetValue( "ui_ctf_timelimit", timelimit );
|
||||
trap_Cvar_SetValue( "ui_ctf_friendlt", friendlyfire );
|
||||
trap_Cvar_SetValue( "ui_ctf_friendly", friendlyfire );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1239,7 +1239,8 @@ static void ServerOptions_MenuInit( qboolean multiplayer ) {
|
|||
|
||||
memset( &s_serveroptions, 0 ,sizeof(serveroptions_t) );
|
||||
s_serveroptions.multiplayer = multiplayer;
|
||||
s_serveroptions.gametype = (int)Com_Clamp( 0, 5, trap_Cvar_VariableValue( "g_gameType" ) );
|
||||
s_serveroptions.gametype = (int) Com_Clamp(0, ARRAY_LEN(gametype_remap2) - 1,
|
||||
trap_Cvar_VariableValue("g_gametype"));
|
||||
s_serveroptions.punkbuster.curvalue = Com_Clamp( 0, 1, trap_Cvar_VariableValue( "sv_punkbuster" ) );
|
||||
|
||||
ServerOptions_Cache();
|
||||
|
|
|
@ -318,7 +318,7 @@ static InitialVideoOptions_s s_ivo_templates[] =
|
|||
}
|
||||
};
|
||||
|
||||
#define NUM_IVO_TEMPLATES ( sizeof( s_ivo_templates ) / sizeof( s_ivo_templates[0] ) )
|
||||
#define NUM_IVO_TEMPLATES ( ARRAY_LEN( s_ivo_templates ) )
|
||||
|
||||
static const char *builtinResolutions[ ] =
|
||||
{
|
||||
|
@ -496,7 +496,7 @@ static void GraphicsOptions_GetResolutions( void )
|
|||
{
|
||||
char* s = resbuf;
|
||||
unsigned int i = 0;
|
||||
while( s && i < sizeof(detectedResolutions)/sizeof(detectedResolutions[0])-1)
|
||||
while( s && i < ARRAY_LEN(detectedResolutions)-1 )
|
||||
{
|
||||
detectedResolutions[i++] = s;
|
||||
s = strchr(s, ' ');
|
||||
|
@ -662,7 +662,7 @@ static void GraphicsOptions_ApplyChanges( void *unused, int notification )
|
|||
// search for builtin mode that matches the detected mode
|
||||
int mode;
|
||||
if ( s_graphicsoptions.mode.curvalue == -1
|
||||
|| s_graphicsoptions.mode.curvalue >= sizeof(detectedResolutions)/sizeof(detectedResolutions[0]) )
|
||||
|| s_graphicsoptions.mode.curvalue >= ARRAY_LEN( detectedResolutions ) )
|
||||
s_graphicsoptions.mode.curvalue = 0;
|
||||
|
||||
mode = GraphicsOptions_FindBuiltinResolution( s_graphicsoptions.mode.curvalue );
|
||||
|
|
|
@ -36,6 +36,44 @@ BASIC MATH
|
|||
===============================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
================
|
||||
RotatePoint
|
||||
================
|
||||
*/
|
||||
void RotatePoint(vec3_t point, /*const*/ vec3_t matrix[3]) { // FIXME
|
||||
vec3_t tvec;
|
||||
|
||||
VectorCopy(point, tvec);
|
||||
point[0] = DotProduct(matrix[0], tvec);
|
||||
point[1] = DotProduct(matrix[1], tvec);
|
||||
point[2] = DotProduct(matrix[2], tvec);
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
TransposeMatrix
|
||||
================
|
||||
*/
|
||||
void TransposeMatrix(/*const*/ vec3_t matrix[3], vec3_t transpose[3]) { // FIXME
|
||||
int i, j;
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
transpose[i][j] = matrix[j][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CreateRotationMatrix
|
||||
================
|
||||
*/
|
||||
void CreateRotationMatrix(const vec3_t angles, vec3_t matrix[3]) {
|
||||
AngleVectors(angles, matrix[0], matrix[1], matrix[2]);
|
||||
VectorInverse(matrix[1]);
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CM_ProjectPointOntoVector
|
||||
|
|
|
@ -435,11 +435,20 @@ char *Cmd_Cmd(void)
|
|||
Replace command separators with space to prevent interpretation
|
||||
This is a hack to protect buggy qvms
|
||||
https://bugzilla.icculus.org/show_bug.cgi?id=3593
|
||||
https://bugzilla.icculus.org/show_bug.cgi?id=4769
|
||||
*/
|
||||
void Cmd_Args_Sanitize( void ) {
|
||||
|
||||
void Cmd_Args_Sanitize(void)
|
||||
{
|
||||
int i;
|
||||
for ( i = 1 ; i < cmd_argc ; i++ ) {
|
||||
char* c = cmd_argv[i];
|
||||
|
||||
for(i = 1; i < cmd_argc; i++)
|
||||
{
|
||||
char *c = cmd_argv[i];
|
||||
|
||||
if(strlen(c) > MAX_CVAR_VALUE_STRING - 1)
|
||||
c[MAX_CVAR_VALUE_STRING - 1] = '\0';
|
||||
|
||||
while ((c = strpbrk(c, "\n\r;"))) {
|
||||
*c = ' ';
|
||||
++c;
|
||||
|
@ -775,7 +784,7 @@ Cmd_CompleteCfgName
|
|||
*/
|
||||
void Cmd_CompleteCfgName( char *args, int argNum ) {
|
||||
if( argNum == 2 ) {
|
||||
Field_CompleteFilename( "", "cfg", qfalse );
|
||||
Field_CompleteFilename( "", "cfg", qfalse, qtrue );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ cvar_t *com_developer;
|
|||
cvar_t *com_dedicated;
|
||||
cvar_t *com_timescale;
|
||||
cvar_t *com_fixedtime;
|
||||
cvar_t *com_dropsim; // 0.0 to 1.0, simulated packet drops
|
||||
cvar_t *com_journal;
|
||||
cvar_t *com_maxfps;
|
||||
cvar_t *com_altivec;
|
||||
|
@ -84,6 +83,10 @@ cvar_t *com_minimized;
|
|||
cvar_t *com_maxfpsMinimized;
|
||||
cvar_t *com_abnormalExit;
|
||||
cvar_t *com_standalone;
|
||||
cvar_t *com_protocol;
|
||||
cvar_t *com_basegame;
|
||||
cvar_t *com_homepath;
|
||||
cvar_t *com_busyWait;
|
||||
|
||||
// com_speeds times
|
||||
int time_game;
|
||||
|
@ -91,7 +94,6 @@ int time_frontend; // renderer frontend time
|
|||
int time_backend; // renderer backend time
|
||||
|
||||
int com_frameTime;
|
||||
int com_frameMsec;
|
||||
int com_frameNumber;
|
||||
|
||||
qboolean com_errorEntered = qfalse;
|
||||
|
@ -288,9 +290,9 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
|
|||
Cvar_Set("com_errorMessage", com_errorMessage);
|
||||
|
||||
if (code == ERR_DISCONNECT || code == ERR_SERVERDISCONNECT) {
|
||||
VM_Forced_Unload_Start();
|
||||
SV_Shutdown( "Server disconnected" );
|
||||
CL_Disconnect( qtrue );
|
||||
VM_Forced_Unload_Start();
|
||||
CL_FlushMemory( );
|
||||
VM_Forced_Unload_Done();
|
||||
// make sure we can get at our local stuff
|
||||
|
@ -299,32 +301,36 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
|
|||
longjmp (abortframe, -1);
|
||||
} else if (code == ERR_DROP) {
|
||||
Com_Printf ("********************\nERROR: %s\n********************\n", com_errorMessage);
|
||||
VM_Forced_Unload_Start();
|
||||
SV_Shutdown (va("Server crashed: %s", com_errorMessage));
|
||||
CL_Disconnect( qtrue );
|
||||
VM_Forced_Unload_Start();
|
||||
CL_FlushMemory( );
|
||||
VM_Forced_Unload_Done();
|
||||
FS_PureServerSetLoadedPaks("", "");
|
||||
com_errorEntered = qfalse;
|
||||
longjmp (abortframe, -1);
|
||||
} else if ( code == ERR_NEED_CD ) {
|
||||
VM_Forced_Unload_Start();
|
||||
SV_Shutdown( "Server didn't have CD" );
|
||||
if ( com_cl_running && com_cl_running->integer ) {
|
||||
CL_Disconnect( qtrue );
|
||||
VM_Forced_Unload_Start();
|
||||
CL_FlushMemory( );
|
||||
VM_Forced_Unload_Done();
|
||||
CL_CDDialog();
|
||||
} else {
|
||||
Com_Printf("Server didn't have CD\n" );
|
||||
VM_Forced_Unload_Done();
|
||||
}
|
||||
|
||||
FS_PureServerSetLoadedPaks("", "");
|
||||
|
||||
com_errorEntered = qfalse;
|
||||
longjmp (abortframe, -1);
|
||||
} else {
|
||||
VM_Forced_Unload_Start();
|
||||
CL_Shutdown (va("Client fatal crashed: %s", com_errorMessage));
|
||||
SV_Shutdown (va("Server fatal crashed: %s", com_errorMessage));
|
||||
VM_Forced_Unload_Done();
|
||||
}
|
||||
|
||||
Com_Shutdown ();
|
||||
|
@ -503,8 +509,8 @@ qboolean Com_AddStartupCommands( void ) {
|
|||
//============================================================================
|
||||
|
||||
void Info_Print( const char *s ) {
|
||||
char key[512];
|
||||
char value[512];
|
||||
char key[BIG_INFO_KEY];
|
||||
char value[BIG_INFO_VALUE];
|
||||
char *o;
|
||||
int l;
|
||||
|
||||
|
@ -524,7 +530,7 @@ void Info_Print( const char *s ) {
|
|||
}
|
||||
else
|
||||
*o = 0;
|
||||
Com_Printf ("%s", key);
|
||||
Com_Printf ("%s ", key);
|
||||
|
||||
if (!*s)
|
||||
{
|
||||
|
@ -1945,7 +1951,6 @@ EVENT LOOP
|
|||
static sysEvent_t eventQueue[ MAX_QUEUED_EVENTS ];
|
||||
static int eventHead = 0;
|
||||
static int eventTail = 0;
|
||||
static byte sys_packetReceived[ MAX_MSGLEN ];
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -1998,8 +2003,6 @@ sysEvent_t Com_GetSystemEvent( void )
|
|||
{
|
||||
sysEvent_t ev;
|
||||
char *s;
|
||||
msg_t netmsg;
|
||||
netadr_t adr;
|
||||
|
||||
// return if we have data
|
||||
if ( eventHead > eventTail )
|
||||
|
@ -2021,21 +2024,6 @@ sysEvent_t Com_GetSystemEvent( void )
|
|||
Com_QueueEvent( 0, SE_CONSOLE, 0, 0, len, b );
|
||||
}
|
||||
|
||||
// check for network packets
|
||||
MSG_Init( &netmsg, sys_packetReceived, sizeof( sys_packetReceived ) );
|
||||
if ( Sys_GetPacket ( &adr, &netmsg ) )
|
||||
{
|
||||
netadr_t *buf;
|
||||
int len;
|
||||
|
||||
// copy out to a seperate buffer for qeueing
|
||||
len = sizeof( netadr_t ) + netmsg.cursize;
|
||||
buf = Z_Malloc( len );
|
||||
*buf = adr;
|
||||
memcpy( buf+1, netmsg.data, netmsg.cursize );
|
||||
Com_QueueEvent( 0, SE_PACKET, 0, 0, len, buf );
|
||||
}
|
||||
|
||||
// return if we have data
|
||||
if ( eventHead > eventTail )
|
||||
{
|
||||
|
@ -2195,7 +2183,6 @@ int Com_EventLoop( void ) {
|
|||
MSG_Init( &buf, bufData, sizeof( bufData ) );
|
||||
|
||||
while ( 1 ) {
|
||||
NET_FlushPacketQueue();
|
||||
ev = Com_GetEvent();
|
||||
|
||||
// if no more events are available
|
||||
|
@ -2216,57 +2203,26 @@ int Com_EventLoop( void ) {
|
|||
}
|
||||
|
||||
|
||||
switch ( ev.evType ) {
|
||||
default:
|
||||
Com_Error( ERR_FATAL, "Com_EventLoop: bad event type %i", ev.evType );
|
||||
switch(ev.evType)
|
||||
{
|
||||
case SE_KEY:
|
||||
CL_KeyEvent( ev.evValue, ev.evValue2, ev.evTime );
|
||||
break;
|
||||
case SE_NONE:
|
||||
break;
|
||||
case SE_KEY:
|
||||
CL_KeyEvent( ev.evValue, ev.evValue2, ev.evTime );
|
||||
case SE_CHAR:
|
||||
CL_CharEvent( ev.evValue );
|
||||
break;
|
||||
case SE_CHAR:
|
||||
CL_CharEvent( ev.evValue );
|
||||
case SE_MOUSE:
|
||||
CL_MouseEvent( ev.evValue, ev.evValue2, ev.evTime );
|
||||
break;
|
||||
case SE_MOUSE:
|
||||
CL_MouseEvent( ev.evValue, ev.evValue2, ev.evTime );
|
||||
case SE_JOYSTICK_AXIS:
|
||||
CL_JoystickEvent( ev.evValue, ev.evValue2, ev.evTime );
|
||||
break;
|
||||
case SE_JOYSTICK_AXIS:
|
||||
CL_JoystickEvent( ev.evValue, ev.evValue2, ev.evTime );
|
||||
case SE_CONSOLE:
|
||||
Cbuf_AddText( (char *)ev.evPtr );
|
||||
Cbuf_AddText( "\n" );
|
||||
break;
|
||||
case SE_CONSOLE:
|
||||
Cbuf_AddText( (char *)ev.evPtr );
|
||||
Cbuf_AddText( "\n" );
|
||||
break;
|
||||
case SE_PACKET:
|
||||
// this cvar allows simulation of connections that
|
||||
// drop a lot of packets. Note that loopback connections
|
||||
// don't go through here at all.
|
||||
if ( com_dropsim->value > 0 ) {
|
||||
static int seed;
|
||||
|
||||
if ( Q_random( &seed ) < com_dropsim->value ) {
|
||||
break; // drop this packet
|
||||
}
|
||||
}
|
||||
|
||||
evFrom = *(netadr_t *)ev.evPtr;
|
||||
buf.cursize = ev.evPtrLength - sizeof( evFrom );
|
||||
|
||||
// we must copy the contents of the message out, because
|
||||
// the event buffers are only large enough to hold the
|
||||
// exact payload, but channel messages need to be large
|
||||
// enough to hold fragment reassembly
|
||||
if ( (unsigned)buf.cursize > buf.maxsize ) {
|
||||
Com_Printf("Com_EventLoop: oversize packet\n");
|
||||
continue;
|
||||
}
|
||||
Com_Memcpy( buf.data, (byte *)((netadr_t *)ev.evPtr + 1), buf.cursize );
|
||||
if ( com_sv_running->integer ) {
|
||||
Com_RunAndTimeServerPacket( &evFrom, &buf );
|
||||
} else {
|
||||
CL_PacketEvent( evFrom, &buf );
|
||||
}
|
||||
default:
|
||||
Com_Error( ERR_FATAL, "Com_EventLoop: bad event type %i", ev.evType );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2639,7 +2595,6 @@ void Com_Init( char *commandLine ) {
|
|||
|
||||
// Clear queues
|
||||
Com_Memset( &eventQueue[ 0 ], 0, MAX_QUEUED_EVENTS * sizeof( sysEvent_t ) );
|
||||
Com_Memset( &sys_packetReceived[ 0 ], 0, MAX_MSGLEN * sizeof( byte ) );
|
||||
|
||||
// initialize the weak pseudo-random number generator for use later.
|
||||
Com_InitRand();
|
||||
|
@ -2664,11 +2619,19 @@ void Com_Init( char *commandLine ) {
|
|||
Cmd_Init ();
|
||||
|
||||
// get the developer cvar set as early as possible
|
||||
Com_StartupVariable( "developer" );
|
||||
com_developer = Cvar_Get("developer", "0", CVAR_TEMP);
|
||||
|
||||
// done early so bind command exists
|
||||
CL_InitKeyCommands();
|
||||
|
||||
com_standalone = Cvar_Get("com_standalone", "0", CVAR_ROM);
|
||||
com_basegame = Cvar_Get("com_basegame", BASEGAME, CVAR_INIT);
|
||||
com_homepath = Cvar_Get("com_homepath", "", CVAR_INIT);
|
||||
|
||||
if(!com_basegame->string[0])
|
||||
Cvar_ForceReset("com_basegame");
|
||||
|
||||
// Com_StartupVariable(
|
||||
FS_InitFilesystem ();
|
||||
|
||||
Com_InitJournaling();
|
||||
|
@ -2714,13 +2677,11 @@ void Com_Init( char *commandLine ) {
|
|||
com_maxfps = Cvar_Get ("com_maxfps", "85", CVAR_ARCHIVE);
|
||||
com_blood = Cvar_Get ("com_blood", "1", CVAR_ARCHIVE);
|
||||
|
||||
com_developer = Cvar_Get ("developer", "0", CVAR_TEMP );
|
||||
com_logfile = Cvar_Get ("logfile", "0", CVAR_TEMP );
|
||||
|
||||
com_timescale = Cvar_Get ("timescale", "1", CVAR_CHEAT | CVAR_SYSTEMINFO );
|
||||
com_fixedtime = Cvar_Get ("fixedtime", "0", CVAR_CHEAT);
|
||||
com_showtrace = Cvar_Get ("com_showtrace", "0", CVAR_CHEAT);
|
||||
com_dropsim = Cvar_Get ("com_dropsim", "0", CVAR_CHEAT);
|
||||
com_speeds = Cvar_Get ("com_speeds", "0", 0);
|
||||
com_timedemo = Cvar_Get ("timedemo", "0", CVAR_CHEAT);
|
||||
com_cameraMode = Cvar_Get ("com_cameraMode", "0", CVAR_CHEAT);
|
||||
|
@ -2739,12 +2700,13 @@ void Com_Init( char *commandLine ) {
|
|||
com_minimized = Cvar_Get( "com_minimized", "0", CVAR_ROM );
|
||||
com_maxfpsMinimized = Cvar_Get( "com_maxfpsMinimized", "0", CVAR_ARCHIVE );
|
||||
com_abnormalExit = Cvar_Get( "com_abnormalExit", "0", CVAR_ROM );
|
||||
com_standalone = Cvar_Get( "com_standalone", "0", CVAR_INIT );
|
||||
com_busyWait = Cvar_Get("com_busyWait", "0", CVAR_ARCHIVE);
|
||||
|
||||
com_introPlayed = Cvar_Get( "com_introplayed", "0", CVAR_ARCHIVE);
|
||||
|
||||
s = va("%s %s %s", Q3_VERSION, PLATFORM_STRING, __DATE__ );
|
||||
com_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO );
|
||||
com_protocol = Cvar_Get ("protocol", va("%i", PROTOCOL_VERSION), CVAR_SERVERINFO | CVAR_INIT);
|
||||
|
||||
Sys_Init();
|
||||
|
||||
|
@ -2834,7 +2796,7 @@ Writes key bindings and archived cvars to config file if modified
|
|||
===============
|
||||
*/
|
||||
void Com_WriteConfiguration( void ) {
|
||||
#ifndef DEDICATED
|
||||
#if !defined(DEDICATED) && !defined(STANDALONE)
|
||||
cvar_t *fs;
|
||||
#endif
|
||||
// if we are quiting without fully initializing, make sure
|
||||
|
@ -2850,11 +2812,11 @@ void Com_WriteConfiguration( void ) {
|
|||
|
||||
Com_WriteConfigToFile( Q3CONFIG_CFG );
|
||||
|
||||
// not needed for dedicated
|
||||
#ifndef DEDICATED
|
||||
// not needed for dedicated or standalone
|
||||
#if !defined(DEDICATED) && !defined(STANDALONE)
|
||||
fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
|
||||
#ifndef STANDALONE
|
||||
if(!Cvar_VariableIntegerValue("com_standalone"))
|
||||
|
||||
if(!com_standalone->integer)
|
||||
{
|
||||
if (UI_usesUniqueCDKey() && fs && fs->string[0] != 0) {
|
||||
Com_WriteCDKey( fs->string, &cl_cdkey[16] );
|
||||
|
@ -2863,7 +2825,6 @@ void Com_WriteConfiguration( void ) {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -2947,19 +2908,16 @@ Com_Frame
|
|||
void Com_Frame( void ) {
|
||||
|
||||
int msec, minMsec;
|
||||
static int lastTime;
|
||||
int key;
|
||||
int timeVal;
|
||||
static int lastTime = 0, bias = 0;
|
||||
|
||||
int timeBeforeFirstEvents;
|
||||
int timeBeforeServer;
|
||||
int timeBeforeEvents;
|
||||
int timeBeforeClient;
|
||||
int timeAfter;
|
||||
int timeBeforeServer;
|
||||
int timeBeforeEvents;
|
||||
int timeBeforeClient;
|
||||
int timeAfter;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ( setjmp (abortframe) ) {
|
||||
return; // an ERR_DROP was thrown
|
||||
}
|
||||
|
@ -2970,10 +2928,6 @@ void Com_Frame( void ) {
|
|||
timeBeforeClient = 0;
|
||||
timeAfter = 0;
|
||||
|
||||
|
||||
// old net chan encryption key
|
||||
key = 0x87243987;
|
||||
|
||||
// write config file if anything changed
|
||||
Com_WriteConfiguration();
|
||||
|
||||
|
@ -2984,37 +2938,59 @@ void Com_Frame( void ) {
|
|||
timeBeforeFirstEvents = Sys_Milliseconds ();
|
||||
}
|
||||
|
||||
// we may want to spin here if things are going too fast
|
||||
if ( !com_dedicated->integer && !com_timedemo->integer ) {
|
||||
if( com_minimized->integer && com_maxfpsMinimized->integer > 0 ) {
|
||||
minMsec = 1000 / com_maxfpsMinimized->integer;
|
||||
} else if( com_unfocused->integer && com_maxfpsUnfocused->integer > 0 ) {
|
||||
minMsec = 1000 / com_maxfpsUnfocused->integer;
|
||||
} else if( com_maxfps->integer > 0 ) {
|
||||
minMsec = 1000 / com_maxfps->integer;
|
||||
} else {
|
||||
minMsec = 1;
|
||||
// Figure out how much time we have
|
||||
if(!com_timedemo->integer)
|
||||
{
|
||||
if(com_dedicated->integer)
|
||||
minMsec = SV_FrameMsec();
|
||||
else
|
||||
{
|
||||
if(com_minimized->integer && com_maxfpsMinimized->integer > 0)
|
||||
minMsec = 1000 / com_maxfpsMinimized->integer;
|
||||
else if(com_unfocused->integer && com_maxfpsUnfocused->integer > 0)
|
||||
minMsec = 1000 / com_maxfpsUnfocused->integer;
|
||||
else if(com_maxfps->integer > 0)
|
||||
minMsec = 1000 / com_maxfps->integer;
|
||||
else
|
||||
minMsec = 1;
|
||||
|
||||
timeVal = com_frameTime - lastTime;
|
||||
bias += timeVal - minMsec;
|
||||
|
||||
if(bias > minMsec)
|
||||
bias = minMsec;
|
||||
|
||||
// Adjust minMsec if previous frame took too long to render so
|
||||
// that framerate is stable at the requested value.
|
||||
minMsec -= bias;
|
||||
}
|
||||
} else {
|
||||
minMsec = 1;
|
||||
}
|
||||
else
|
||||
minMsec = 1;
|
||||
|
||||
msec = minMsec;
|
||||
do {
|
||||
int timeRemaining = minMsec - msec;
|
||||
timeVal = 0;
|
||||
do
|
||||
{
|
||||
// Busy sleep the last millisecond for better timeout precision
|
||||
if(com_busyWait->integer || timeVal < 2)
|
||||
NET_Sleep(0);
|
||||
else
|
||||
NET_Sleep(timeVal - 1);
|
||||
|
||||
// The existing Sys_Sleep implementations aren't really
|
||||
// precise enough to be of use beyond 100fps
|
||||
// FIXME: implement a more precise sleep (RDTSC or something)
|
||||
if( timeRemaining >= 10 )
|
||||
Sys_Sleep( timeRemaining );
|
||||
msec = Sys_Milliseconds() - com_frameTime;
|
||||
|
||||
if(msec >= minMsec)
|
||||
timeVal = 0;
|
||||
else
|
||||
timeVal = minMsec - msec;
|
||||
|
||||
} while(timeVal > 0);
|
||||
|
||||
lastTime = com_frameTime;
|
||||
com_frameTime = Com_EventLoop();
|
||||
|
||||
msec = com_frameTime - lastTime;
|
||||
|
||||
com_frameTime = Com_EventLoop();
|
||||
if ( lastTime > com_frameTime ) {
|
||||
lastTime = com_frameTime; // possible on first frame
|
||||
}
|
||||
msec = com_frameTime - lastTime;
|
||||
} while ( msec < minMsec );
|
||||
Cbuf_Execute ();
|
||||
|
||||
if (com_altivec->modified)
|
||||
|
@ -3023,11 +2999,8 @@ void Com_Frame( void ) {
|
|||
com_altivec->modified = qfalse;
|
||||
}
|
||||
|
||||
lastTime = com_frameTime;
|
||||
|
||||
// mess with msec if needed
|
||||
com_frameMsec = msec;
|
||||
msec = Com_ModifyMsec( msec );
|
||||
msec = Com_ModifyMsec(msec);
|
||||
|
||||
//
|
||||
// server side
|
||||
|
@ -3087,6 +3060,9 @@ void Com_Frame( void ) {
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
NET_FlushPacketQueue();
|
||||
|
||||
//
|
||||
// report timing information
|
||||
//
|
||||
|
@ -3120,9 +3096,6 @@ void Com_Frame( void ) {
|
|||
c_pointcontents = 0;
|
||||
}
|
||||
|
||||
// old net chan encryption key
|
||||
key = lastTime * 0x87243987;
|
||||
|
||||
com_frameNumber++;
|
||||
}
|
||||
|
||||
|
@ -3329,15 +3302,15 @@ Field_CompleteFilename
|
|||
===============
|
||||
*/
|
||||
void Field_CompleteFilename( const char *dir,
|
||||
const char *ext, qboolean stripExt )
|
||||
const char *ext, qboolean stripExt, qboolean allowNonPureFilesOnDisk )
|
||||
{
|
||||
matchCount = 0;
|
||||
shortestMatch[ 0 ] = 0;
|
||||
|
||||
FS_FilenameCompletion( dir, ext, stripExt, FindMatches );
|
||||
FS_FilenameCompletion( dir, ext, stripExt, FindMatches, allowNonPureFilesOnDisk );
|
||||
|
||||
if( !Field_Complete( ) )
|
||||
FS_FilenameCompletion( dir, ext, stripExt, PrintMatches );
|
||||
FS_FilenameCompletion( dir, ext, stripExt, PrintMatches, allowNonPureFilesOnDisk );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1210,9 +1210,9 @@ void Cvar_Update( vmCvar_t *vmCvar ) {
|
|||
}
|
||||
vmCvar->modificationCount = cv->modificationCount;
|
||||
if ( strlen(cv->string)+1 > MAX_CVAR_VALUE_STRING )
|
||||
Com_Error( ERR_DROP, "Cvar_Update: src %s length %zd exceeds MAX_CVAR_VALUE_STRING",
|
||||
Com_Error( ERR_DROP, "Cvar_Update: src %s length %u exceeds MAX_CVAR_VALUE_STRING",
|
||||
cv->string,
|
||||
strlen(cv->string));
|
||||
(unsigned int) strlen(cv->string));
|
||||
Q_strncpyz( vmCvar->string, cv->string, MAX_CVAR_VALUE_STRING );
|
||||
|
||||
vmCvar->value = cv->value;
|
||||
|
|
|
@ -175,7 +175,7 @@ or configs will never get loaded from disk!
|
|||
// every time a new demo pk3 file is built, this checksum must be updated.
|
||||
// the easiest way to get it is to just run the game and see what it spits out
|
||||
#define DEMO_PAK0_CHECKSUM 2985612116u
|
||||
static const unsigned pak_checksums[] = {
|
||||
static const unsigned int pak_checksums[] = {
|
||||
1566731103u,
|
||||
298122907u,
|
||||
412165236u,
|
||||
|
@ -187,6 +187,14 @@ static const unsigned pak_checksums[] = {
|
|||
977125798u
|
||||
};
|
||||
|
||||
static const unsigned int missionpak_checksums[] =
|
||||
{
|
||||
2430342401u,
|
||||
511014160u,
|
||||
2662638993u,
|
||||
1438664554u
|
||||
};
|
||||
|
||||
// if this is defined, the executable positively won't work with any paks other
|
||||
// than the demo pak, even if productid is present. This is only used for our
|
||||
// last demo release to prevent the mac and linux users from using the demo
|
||||
|
@ -325,7 +333,7 @@ qboolean FS_PakIsPure( pack_t *pack ) {
|
|||
for ( i = 0 ; i < fs_numServerPaks ; i++ ) {
|
||||
// FIXME: also use hashed file names
|
||||
// NOTE TTimo: a pk3 with same checksum but different name would be validated too
|
||||
// I don't see this as allowing for any exploit, it would only happen if the client does manips of it's file names 'not a bug'
|
||||
// I don't see this as allowing for any exploit, it would only happen if the client does manips of its file names 'not a bug'
|
||||
if ( pack->checksum == fs_serverPaks[i] ) {
|
||||
return qtrue; // on the aproved list
|
||||
}
|
||||
|
@ -537,57 +545,6 @@ static void FS_CheckFilenameIsNotExecutable( const char *filename,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
FS_CopyFile
|
||||
|
||||
Copy a fully specified file from one place to another
|
||||
=================
|
||||
*/
|
||||
static void FS_CopyFile( char *fromOSPath, char *toOSPath ) {
|
||||
FILE *f;
|
||||
int len;
|
||||
byte *buf;
|
||||
|
||||
Com_Printf( "copy %s to %s\n", fromOSPath, toOSPath );
|
||||
|
||||
FS_CheckFilenameIsNotExecutable( toOSPath, __func__ );
|
||||
|
||||
if (strstr(fromOSPath, "journal.dat") || strstr(fromOSPath, "journaldata.dat")) {
|
||||
Com_Printf( "Ignoring journal files\n");
|
||||
return;
|
||||
}
|
||||
|
||||
f = fopen( fromOSPath, "rb" );
|
||||
if ( !f ) {
|
||||
return;
|
||||
}
|
||||
fseek (f, 0, SEEK_END);
|
||||
len = ftell (f);
|
||||
fseek (f, 0, SEEK_SET);
|
||||
|
||||
// we are using direct malloc instead of Z_Malloc here, so it
|
||||
// probably won't work on a mac... Its only for developers anyway...
|
||||
buf = malloc( len );
|
||||
if (fread( buf, 1, len, f ) != len)
|
||||
Com_Error( ERR_FATAL, "Short read in FS_Copyfiles()\n" );
|
||||
fclose( f );
|
||||
|
||||
if( FS_CreatePath( toOSPath ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
f = fopen( toOSPath, "wb" );
|
||||
if ( !f ) {
|
||||
return;
|
||||
}
|
||||
if (fwrite( buf, 1, len, f ) != len)
|
||||
Com_Error( ERR_FATAL, "Short write in FS_Copyfiles()\n" );
|
||||
fclose( f );
|
||||
free( buf );
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
FS_Remove
|
||||
|
@ -799,11 +756,7 @@ void FS_SV_Rename( const char *from, const char *to ) {
|
|||
|
||||
FS_CheckFilenameIsNotExecutable( to_ospath, __func__ );
|
||||
|
||||
if (rename( from_ospath, to_ospath )) {
|
||||
// Failed, try copying it and deleting the original
|
||||
FS_CopyFile ( from_ospath, to_ospath );
|
||||
FS_Remove ( from_ospath );
|
||||
}
|
||||
rename(from_ospath, to_ospath);
|
||||
}
|
||||
|
||||
|
||||
|
@ -833,11 +786,7 @@ void FS_Rename( const char *from, const char *to ) {
|
|||
|
||||
FS_CheckFilenameIsNotExecutable( to_ospath, __func__ );
|
||||
|
||||
if (rename( from_ospath, to_ospath )) {
|
||||
// Failed, try copying it and deleting the original
|
||||
FS_CopyFile ( from_ospath, to_ospath );
|
||||
FS_Remove ( from_ospath );
|
||||
}
|
||||
rename(from_ospath, to_ospath);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1212,6 +1161,32 @@ int FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean uniqueF
|
|||
}
|
||||
|
||||
|
||||
char *FS_FindDll( const char *filename ) {
|
||||
searchpath_t *search;
|
||||
directory_t *dir;
|
||||
|
||||
if ( !fs_searchpaths ) {
|
||||
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
|
||||
}
|
||||
|
||||
for ( search = fs_searchpaths ; search ; search = search->next ) {
|
||||
if ( search->dir ) {
|
||||
FILE *f;
|
||||
char *netpath;
|
||||
|
||||
dir = search->dir;
|
||||
netpath = FS_BuildOSPath( dir->path, dir->gamedir, filename );
|
||||
f = fopen( netpath, "rb" );
|
||||
if (f) {
|
||||
fclose( f );
|
||||
return netpath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
FS_Read
|
||||
|
@ -1887,7 +1862,7 @@ Returns a uniqued list of files that match the given criteria
|
|||
from all search paths
|
||||
===============
|
||||
*/
|
||||
char **FS_ListFilteredFiles( const char *path, const char *extension, char *filter, int *numfiles ) {
|
||||
char **FS_ListFilteredFiles( const char *path, const char *extension, char *filter, int *numfiles, qboolean allowNonPureFilesOnDisk ) {
|
||||
int nfiles;
|
||||
char **listCopy;
|
||||
char *list[MAX_FOUND_FILES];
|
||||
|
@ -1983,7 +1958,7 @@ char **FS_ListFilteredFiles( const char *path, const char *extension, char *filt
|
|||
char *name;
|
||||
|
||||
// don't scan directories for files if we are pure or restricted
|
||||
if ( fs_numServerPaks ) {
|
||||
if ( fs_numServerPaks && !allowNonPureFilesOnDisk ) {
|
||||
continue;
|
||||
} else {
|
||||
netpath = FS_BuildOSPath( search->dir->path, search->dir->gamedir, path );
|
||||
|
@ -2020,7 +1995,7 @@ FS_ListFiles
|
|||
=================
|
||||
*/
|
||||
char **FS_ListFiles( const char *path, const char *extension, int *numfiles ) {
|
||||
return FS_ListFilteredFiles( path, extension, NULL, numfiles );
|
||||
return FS_ListFilteredFiles( path, extension, NULL, numfiles, qfalse );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2195,7 +2170,7 @@ int FS_GetModList( char *listbuf, int bufsize ) {
|
|||
continue;
|
||||
}
|
||||
// we drop "baseq3" "." and ".."
|
||||
if (Q_stricmp(name, BASEGAME) && Q_stricmpn(name, ".", 1)) {
|
||||
if (Q_stricmp(name, com_basegame->string) && Q_stricmpn(name, ".", 1)) {
|
||||
// now we need to find some .pk3 files to validate the mod
|
||||
// NOTE TTimo: (actually I'm not sure why .. what if it's a mod under developement with no .pk3?)
|
||||
// we didn't keep the information when we merged the directory names, as to what OS Path it was found under
|
||||
|
@ -2399,7 +2374,7 @@ void FS_NewDir_f( void ) {
|
|||
|
||||
Com_Printf( "---------------\n" );
|
||||
|
||||
dirnames = FS_ListFilteredFiles( "", "", filter, &ndirs );
|
||||
dirnames = FS_ListFilteredFiles( "", "", filter, &ndirs, qfalse );
|
||||
|
||||
FS_SortFileList(dirnames, ndirs);
|
||||
|
||||
|
@ -2465,6 +2440,74 @@ void FS_TouchFile_f( void ) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
FS_Which_f
|
||||
============
|
||||
*/
|
||||
void FS_Which_f( void ) {
|
||||
searchpath_t *search;
|
||||
char *netpath;
|
||||
pack_t *pak;
|
||||
fileInPack_t *pakFile;
|
||||
directory_t *dir;
|
||||
long hash;
|
||||
FILE *temp;
|
||||
char *filename;
|
||||
char buf[ MAX_OSPATH ];
|
||||
|
||||
hash = 0;
|
||||
filename = Cmd_Argv(1);
|
||||
|
||||
if ( !filename[0] ) {
|
||||
Com_Printf( "Usage: which <file>\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
// qpaths are not supposed to have a leading slash
|
||||
if ( filename[0] == '/' || filename[0] == '\\' ) {
|
||||
filename++;
|
||||
}
|
||||
|
||||
// just wants to see if file is there
|
||||
for ( search = fs_searchpaths ; search ; search = search->next ) {
|
||||
if ( search->pack ) {
|
||||
hash = FS_HashFileName(filename, search->pack->hashSize);
|
||||
}
|
||||
// is the element a pak file?
|
||||
if ( search->pack && search->pack->hashTable[hash] ) {
|
||||
// look through all the pak file elements
|
||||
pak = search->pack;
|
||||
pakFile = pak->hashTable[hash];
|
||||
do {
|
||||
// case and separator insensitive comparisons
|
||||
if ( !FS_FilenameCompare( pakFile->name, filename ) ) {
|
||||
// found it!
|
||||
Com_Printf( "File \"%s\" found in \"%s\"\n", filename, pak->pakFilename );
|
||||
return;
|
||||
}
|
||||
pakFile = pakFile->next;
|
||||
} while(pakFile != NULL);
|
||||
} else if ( search->dir ) {
|
||||
dir = search->dir;
|
||||
|
||||
netpath = FS_BuildOSPath( dir->path, dir->gamedir, filename );
|
||||
temp = fopen (netpath, "rb");
|
||||
if ( !temp ) {
|
||||
continue;
|
||||
}
|
||||
fclose(temp);
|
||||
Com_sprintf( buf, sizeof( buf ), "%s/%s", dir->path, dir->gamedir );
|
||||
FS_ReplaceSeparators( buf );
|
||||
Com_Printf( "File \"%s\" found at \"%s\"\n", filename, buf );
|
||||
return;
|
||||
}
|
||||
}
|
||||
Com_Printf( "File not found: \"%s\"\n", filename );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
|
||||
|
||||
|
@ -2546,7 +2589,8 @@ void FS_AddGameDirectory( const char *path, const char *dir ) {
|
|||
FS_idPak
|
||||
================
|
||||
*/
|
||||
qboolean FS_idPak( char *pak, char *base ) {
|
||||
qboolean FS_idPak(char *pak, char *base, int numPaks)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_ID_PAKS; i++) {
|
||||
|
@ -2554,7 +2598,7 @@ qboolean FS_idPak( char *pak, char *base ) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (i < NUM_ID_PAKS) {
|
||||
if (i < numPaks) {
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
|
@ -2621,8 +2665,12 @@ qboolean FS_ComparePaks( char *neededpaks, int len, qboolean dlstring ) {
|
|||
havepak = qfalse;
|
||||
|
||||
// never autodownload any of the id paks
|
||||
if ( FS_idPak(fs_serverReferencedPakNames[i], "baseq3")
|
||||
|| FS_idPak(fs_serverReferencedPakNames[i], "missionpack") ) {
|
||||
if(FS_idPak(fs_serverReferencedPakNames[i], BASEGAME, NUM_ID_PAKS)
|
||||
#ifndef STANDALONE
|
||||
|| FS_idPak(fs_serverReferencedPakNames[i], BASETA, NUM_TA_PAKS)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2739,6 +2787,7 @@ void FS_Shutdown( qboolean closemfp ) {
|
|||
Cmd_RemoveCommand( "dir" );
|
||||
Cmd_RemoveCommand( "fdir" );
|
||||
Cmd_RemoveCommand( "touchFile" );
|
||||
Cmd_RemoveCommand( "which" );
|
||||
|
||||
#ifdef FS_MISSING
|
||||
if (closemfp) {
|
||||
|
@ -2855,7 +2904,7 @@ static void FS_Startup( const char *gameName )
|
|||
}
|
||||
|
||||
#ifndef STANDALONE
|
||||
if(!Cvar_VariableIntegerValue("com_standalone"))
|
||||
if(!com_standalone->integer)
|
||||
{
|
||||
cvar_t *fs;
|
||||
|
||||
|
@ -2872,6 +2921,7 @@ static void FS_Startup( const char *gameName )
|
|||
Cmd_AddCommand ("dir", FS_Dir_f );
|
||||
Cmd_AddCommand ("fdir", FS_NewDir_f );
|
||||
Cmd_AddCommand ("touchFile", FS_TouchFile_f );
|
||||
Cmd_AddCommand ("which", FS_Which_f );
|
||||
|
||||
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=506
|
||||
// reorder the pure pk3 files according to server order
|
||||
|
@ -2897,17 +2947,21 @@ static void FS_Startup( const char *gameName )
|
|||
===================
|
||||
FS_CheckPak0
|
||||
|
||||
Checks that pak0.pk3 is present and its checksum is correct
|
||||
Check whether any of the original id pak files is present,
|
||||
and start up in standalone mode, if there are none and a
|
||||
different com_basegame was set.
|
||||
Note: If you're building a game that doesn't depend on the
|
||||
Q3 media pak0.pk3, you'll want to remove this function
|
||||
Q3 media pak0.pk3, you'll want to remove this by defining
|
||||
STANDALONE in q_shared.h
|
||||
===================
|
||||
*/
|
||||
/* JBravo - Not
|
||||
static void FS_CheckPak0( void )
|
||||
{
|
||||
searchpath_t *path;
|
||||
pack_t *curpack;
|
||||
qboolean founddemo = qfalse;
|
||||
unsigned foundPak = 0;
|
||||
unsigned int foundPak = 0, foundTA = 0;
|
||||
|
||||
for( path = fs_searchpaths; path; path = path->next )
|
||||
{
|
||||
|
@ -2915,13 +2969,116 @@ static void FS_CheckPak0( void )
|
|||
|
||||
if(!path->pack)
|
||||
continue;
|
||||
|
||||
curpack = path->pack;
|
||||
|
||||
if(!Q_stricmpn( path->pack->pakGamename, "demoq3", MAX_OSPATH )
|
||||
if(!Q_stricmpn( curpack->pakGamename, "demoq3", MAX_OSPATH )
|
||||
&& !Q_stricmpn( pakBasename, "pak0", MAX_OSPATH ))
|
||||
{
|
||||
founddemo = qtrue;
|
||||
if(curpack->checksum == DEMO_PAK0_CHECKSUM)
|
||||
founddemo = qtrue;
|
||||
}
|
||||
|
||||
if( path->pack->checksum == DEMO_PAK0_CHECKSUM )
|
||||
else if(!Q_stricmpn( curpack->pakGamename, BASEGAME, MAX_OSPATH )
|
||||
&& strlen(pakBasename) == 4 && !Q_stricmpn( pakBasename, "pak", 3 )
|
||||
&& pakBasename[3] >= '0' && pakBasename[3] <= '0' + NUM_ID_PAKS - 1)
|
||||
{
|
||||
if( curpack->checksum != pak_checksums[pakBasename[3]-'0'] )
|
||||
{
|
||||
if(pakBasename[3] == '0')
|
||||
{
|
||||
Com_Printf("\n\n"
|
||||
"**************************************************\n"
|
||||
"WARNING: " BASEGAME "/pak0.pk3 is present but its checksum (%u)\n"
|
||||
"is not correct. Please re-copy pak0.pk3 from your\n"
|
||||
"legitimate Q3 CDROM.\n"
|
||||
"**************************************************\n\n\n",
|
||||
curpack->checksum );
|
||||
}
|
||||
else
|
||||
{
|
||||
Com_Printf("\n\n"
|
||||
"**************************************************\n"
|
||||
"WARNING: " BASEGAME "/pak%d.pk3 is present but its checksum (%u)\n"
|
||||
"is not correct. Please re-install the point release\n"
|
||||
"**************************************************\n\n\n",
|
||||
pakBasename[3]-'0', curpack->checksum );
|
||||
}
|
||||
}
|
||||
|
||||
foundPak |= 1<<(pakBasename[3]-'0');
|
||||
}
|
||||
else if(!Q_stricmpn(curpack->pakGamename, BASETA, MAX_OSPATH)
|
||||
&& strlen(pakBasename) == 4 && !Q_stricmpn(pakBasename, "pak", 3)
|
||||
&& pakBasename[3] >= '0' && pakBasename[3] <= '0' + NUM_TA_PAKS - 1)
|
||||
|
||||
{
|
||||
if(curpack->checksum != missionpak_checksums[pakBasename[3]-'0'])
|
||||
{
|
||||
Com_Printf("\n\n"
|
||||
"**************************************************\n"
|
||||
"WARNING: " BASETA "/pak%d.pk3 is present but its checksum (%u)\n"
|
||||
"is not correct. Please re-install Team Arena\n"
|
||||
"**************************************************\n\n\n",
|
||||
pakBasename[3]-'0', curpack->checksum );
|
||||
}
|
||||
|
||||
foundTA |= 1 << (pakBasename[3]-'0');
|
||||
}
|
||||
else
|
||||
{
|
||||
int index;
|
||||
|
||||
// Finally check whether this pak's checksum is listed because the user tried
|
||||
// to trick us by renaming the file, and set foundPak's highest bit to indicate this case.
|
||||
|
||||
for(index = 0; index < ARRAY_LEN(pak_checksums); index++)
|
||||
{
|
||||
if(curpack->checksum == pak_checksums[index])
|
||||
{
|
||||
Com_Printf("\n\n"
|
||||
"**************************************************\n"
|
||||
"WARNING: %s is renamed pak file %s%cpak%d.pk3\n"
|
||||
"Running in standalone mode won't work\n"
|
||||
"Please rename, or remove this file\n"
|
||||
"**************************************************\n\n\n",
|
||||
curpack->pakFilename, BASEGAME, PATH_SEP, index);
|
||||
|
||||
|
||||
foundPak |= 0x80000000;
|
||||
}
|
||||
}
|
||||
|
||||
for(index = 0; index < ARRAY_LEN(missionpak_checksums); index++)
|
||||
{
|
||||
if(curpack->checksum == missionpak_checksums[index])
|
||||
{
|
||||
Com_Printf("\n\n"
|
||||
"**************************************************\n"
|
||||
"WARNING: %s is renamed pak file %s%cpak%d.pk3\n"
|
||||
"Running in standalone mode won't work\n"
|
||||
"Please rename, or remove this file\n"
|
||||
"**************************************************\n\n\n",
|
||||
curpack->pakFilename, BASETA, PATH_SEP, index);
|
||||
|
||||
foundTA |= 0x80000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!foundPak && !foundTA && Q_stricmp(com_basegame->string, BASEGAME))
|
||||
{
|
||||
Cvar_Set("com_standalone", "1");
|
||||
}
|
||||
else
|
||||
Cvar_Set("com_standalone", "0");
|
||||
|
||||
if(!com_standalone->integer)
|
||||
{
|
||||
if(!(foundPak & 0x01))
|
||||
{
|
||||
if(founddemo)
|
||||
{
|
||||
Com_Printf( "\n\n"
|
||||
"**************************************************\n"
|
||||
|
@ -2929,57 +3086,25 @@ static void FS_CheckPak0( void )
|
|||
"from the demo. This may work fine, but it is not\n"
|
||||
"guaranteed or supported.\n"
|
||||
"**************************************************\n\n\n" );
|
||||
|
||||
foundPak |= 0x01;
|
||||
}
|
||||
}
|
||||
|
||||
else if(!Q_stricmpn( path->pack->pakGamename, BASEGAME, MAX_OSPATH )
|
||||
&& strlen(pakBasename) == 4 && !Q_stricmpn( pakBasename, "pak", 3 )
|
||||
&& pakBasename[3] >= '0' && pakBasename[3] <= '8')
|
||||
{
|
||||
if( path->pack->checksum != pak_checksums[pakBasename[3]-'0'] )
|
||||
{
|
||||
if(pakBasename[0] == '0')
|
||||
{
|
||||
Com_Printf("\n\n"
|
||||
"**************************************************\n"
|
||||
"WARNING: pak0.pk3 is present but its checksum (%u)\n"
|
||||
"is not correct. Please re-copy pak0.pk3 from your\n"
|
||||
"legitimate Q3 CDROM.\n"
|
||||
"**************************************************\n\n\n",
|
||||
path->pack->checksum );
|
||||
}
|
||||
else
|
||||
{
|
||||
Com_Printf("\n\n"
|
||||
"**************************************************\n"
|
||||
"WARNING: pak%d.pk3 is present but its checksum (%u)\n"
|
||||
"is not correct. Please re-install the point release\n"
|
||||
"**************************************************\n\n\n",
|
||||
pakBasename[3]-'0', path->pack->checksum );
|
||||
}
|
||||
}
|
||||
|
||||
foundPak |= 1<<(pakBasename[3]-'0');
|
||||
}
|
||||
}
|
||||
|
||||
if( (!Cvar_VariableIntegerValue("com_standalone") ||
|
||||
!fs_gamedirvar->string[0] ||
|
||||
!Q_stricmp(fs_gamedirvar->string, BASEGAME) ||
|
||||
!Q_stricmp(fs_gamedirvar->string, "missionpack") )
|
||||
&&
|
||||
(!founddemo && (foundPak & 0x1ff) != 0x1ff) )
|
||||
|
||||
if(!com_standalone->integer && (foundPak & 0x1ff) != 0x1ff)
|
||||
{
|
||||
char errorText[MAX_STRING_CHARS] = "";
|
||||
|
||||
if((foundPak&1) != 1 )
|
||||
if((foundPak & 0x01) != 0x01)
|
||||
{
|
||||
Q_strcat(errorText, sizeof(errorText),
|
||||
"\"pak0.pk3\" is missing. Please copy it "
|
||||
"from your legitimate Q3 CDROM. ");
|
||||
}
|
||||
|
||||
if((foundPak&0x1fe) != 0x1fe )
|
||||
if((foundPak & 0x1fe) != 0x1fe)
|
||||
{
|
||||
Q_strcat(errorText, sizeof(errorText),
|
||||
"Point Release files are missing. Please "
|
||||
|
@ -2994,8 +3119,26 @@ static void FS_CheckPak0( void )
|
|||
Com_Error(ERR_FATAL, "%s", errorText);
|
||||
}
|
||||
|
||||
if(foundPak & 1)
|
||||
Cvar_Set("com_standalone", "0");
|
||||
if(!com_standalone->integer && foundTA && (foundTA & 0x0f) != 0x0f)
|
||||
{
|
||||
char errorText[MAX_STRING_CHARS] = "";
|
||||
|
||||
if((foundTA & 0x01) != 0x01)
|
||||
{
|
||||
Com_sprintf(errorText, sizeof(errorText),
|
||||
"\"" BASETA "%cpak0.pk3\" is missing. Please copy it "
|
||||
"from your legitimate Quake 3 Team Arena CDROM. ", PATH_SEP);
|
||||
}
|
||||
|
||||
if((foundTA & 0x0e) != 0x0e)
|
||||
{
|
||||
Q_strcat(errorText, sizeof(errorText),
|
||||
"Team Arena Point Release files are missing. Please "
|
||||
"re-install the latest Team Arena point release.");
|
||||
}
|
||||
|
||||
Com_Error(ERR_FATAL, "%s", errorText);
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
@ -3125,7 +3268,7 @@ const char *FS_ReferencedPakChecksums( void ) {
|
|||
for ( search = fs_searchpaths ; search ; search = search->next ) {
|
||||
// is the element a pak file?
|
||||
if ( search->pack ) {
|
||||
if (search->pack->referenced || Q_stricmpn(search->pack->pakGamename, BASEGAME, strlen(BASEGAME))) {
|
||||
if (search->pack->referenced || Q_stricmpn(search->pack->pakGamename, com_basegame->string, strlen(com_basegame->string))) {
|
||||
Q_strcat( info, sizeof( info ), va("%i ", search->pack->checksum ) );
|
||||
}
|
||||
}
|
||||
|
@ -3200,7 +3343,7 @@ const char *FS_ReferencedPakNames( void ) {
|
|||
for ( search = fs_searchpaths ; search ; search = search->next ) {
|
||||
// is the element a pak file?
|
||||
if ( search->pack ) {
|
||||
if (search->pack->referenced || Q_stricmpn(search->pack->pakGamename, BASEGAME, strlen(BASEGAME))) {
|
||||
if (search->pack->referenced || Q_stricmpn(search->pack->pakGamename, com_basegame->string, strlen(com_basegame->string))) {
|
||||
if (*info) {
|
||||
Q_strcat(info, sizeof( info ), " " );
|
||||
}
|
||||
|
@ -3318,7 +3461,7 @@ void FS_PureServerSetReferencedPaks( const char *pakSums, const char *pakNames )
|
|||
fs_serverReferencedPaks[i] = atoi( Cmd_Argv( i ) );
|
||||
}
|
||||
|
||||
for (i = 0 ; i < sizeof(fs_serverReferencedPakNames) / sizeof(*fs_serverReferencedPakNames); i++)
|
||||
for (i = 0 ; i < ARRAY_LEN(fs_serverReferencedPakNames); i++)
|
||||
{
|
||||
if(fs_serverReferencedPakNames[i])
|
||||
Z_Free(fs_serverReferencedPakNames[i]);
|
||||
|
@ -3364,10 +3507,10 @@ void FS_InitFilesystem( void ) {
|
|||
Com_StartupVariable( "fs_game" );
|
||||
|
||||
// try to start up normally
|
||||
FS_Startup( BASEGAME );
|
||||
FS_Startup(com_basegame->string);
|
||||
|
||||
#ifndef STANDALONE
|
||||
// FS_CheckPak0( );
|
||||
// FS_CheckPak0( );
|
||||
#endif
|
||||
|
||||
// if we can't find default.cfg, assume that the paths are
|
||||
|
@ -3399,10 +3542,10 @@ void FS_Restart( int checksumFeed ) {
|
|||
FS_ClearPakReferences(0);
|
||||
|
||||
// try to start up normally
|
||||
FS_Startup( BASEGAME );
|
||||
FS_Startup(com_basegame->string);
|
||||
|
||||
#ifndef STANDALONE
|
||||
// FS_CheckPak0( );
|
||||
// FS_CheckPak0( );
|
||||
#endif
|
||||
|
||||
// if we can't find default.cfg, assume that the paths are
|
||||
|
@ -3425,7 +3568,7 @@ void FS_Restart( int checksumFeed ) {
|
|||
}
|
||||
|
||||
if ( Q_stricmp(fs_gamedirvar->string, lastValidGame) ) {
|
||||
// skip the Reaction.cfg if "safe" is on the command line
|
||||
// skip the q3config.cfg if "safe" is on the command line
|
||||
if ( !Com_SafeMode() ) {
|
||||
Cbuf_AddText ("exec " Q3CONFIG_CFG "\n");
|
||||
}
|
||||
|
@ -3535,13 +3678,13 @@ void FS_Flush( fileHandle_t f ) {
|
|||
}
|
||||
|
||||
void FS_FilenameCompletion( const char *dir, const char *ext,
|
||||
qboolean stripExt, void(*callback)(const char *s) ) {
|
||||
qboolean stripExt, void(*callback)(const char *s), qboolean allowNonPureFilesOnDisk ) {
|
||||
char **filenames;
|
||||
int nfiles;
|
||||
int i;
|
||||
char filename[ MAX_STRING_CHARS ];
|
||||
|
||||
filenames = FS_ListFilteredFiles( dir, ext, NULL, &nfiles );
|
||||
filenames = FS_ListFilteredFiles( dir, ext, NULL, &nfiles, allowNonPureFilesOnDisk );
|
||||
|
||||
FS_SortFileList( filenames, nfiles );
|
||||
|
||||
|
@ -3557,3 +3700,11 @@ void FS_FilenameCompletion( const char *dir, const char *ext,
|
|||
}
|
||||
FS_FreeFileList( filenames );
|
||||
}
|
||||
|
||||
const char *FS_GetCurrentGameDir(void)
|
||||
{
|
||||
if(fs_gamedirvar->string[0])
|
||||
return fs_gamedirvar->string;
|
||||
|
||||
return com_basegame->string;
|
||||
}
|
||||
|
|
|
@ -895,7 +895,7 @@ void MSG_WriteDeltaEntity( msg_t *msg, struct entityState_s *from, struct entity
|
|||
float fullFloat;
|
||||
int *fromF, *toF;
|
||||
|
||||
numFields = sizeof(entityStateFields)/sizeof(entityStateFields[0]);
|
||||
numFields = ARRAY_LEN( entityStateFields );
|
||||
|
||||
// all fields should be 32 bits to avoid any compiler packing issues
|
||||
// the "number" field is not part of the field list
|
||||
|
@ -1040,7 +1040,7 @@ void MSG_ReadDeltaEntity( msg_t *msg, entityState_t *from, entityState_t *to,
|
|||
return;
|
||||
}
|
||||
|
||||
numFields = sizeof(entityStateFields)/sizeof(entityStateFields[0]);
|
||||
numFields = ARRAY_LEN( entityStateFields );
|
||||
lc = MSG_ReadByte(msg);
|
||||
|
||||
if ( lc > numFields || lc < 0 ) {
|
||||
|
@ -1210,7 +1210,7 @@ void MSG_WriteDeltaPlayerstate( msg_t *msg, struct playerState_s *from, struct p
|
|||
|
||||
c = msg->cursize;
|
||||
|
||||
numFields = sizeof( playerStateFields ) / sizeof( playerStateFields[0] );
|
||||
numFields = ARRAY_LEN( playerStateFields );
|
||||
|
||||
lc = 0;
|
||||
for ( i = 0, field = playerStateFields ; i < numFields ; i++, field++ ) {
|
||||
|
@ -1377,7 +1377,7 @@ void MSG_ReadDeltaPlayerstate (msg_t *msg, playerState_t *from, playerState_t *t
|
|||
print = 0;
|
||||
}
|
||||
|
||||
numFields = sizeof( playerStateFields ) / sizeof( playerStateFields[0] );
|
||||
numFields = ARRAY_LEN( playerStateFields );
|
||||
lc = MSG_ReadByte(msg);
|
||||
|
||||
if ( lc > numFields || lc < 0 ) {
|
||||
|
|
|
@ -50,6 +50,7 @@ typedef unsigned short sa_family_t;
|
|||
# define EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
||||
# define EAFNOSUPPORT WSAEAFNOSUPPORT
|
||||
# define ECONNRESET WSAECONNRESET
|
||||
typedef u_long ioctlarg_t;
|
||||
# define socketError WSAGetLastError( )
|
||||
|
||||
static WSADATA winsockdata;
|
||||
|
@ -85,6 +86,7 @@ typedef int SOCKET;
|
|||
# define SOCKET_ERROR -1
|
||||
# define closesocket close
|
||||
# define ioctlsocket ioctl
|
||||
typedef int ioctlarg_t;
|
||||
# define socketError errno
|
||||
|
||||
#endif
|
||||
|
@ -107,6 +109,8 @@ static cvar_t *net_port6;
|
|||
static cvar_t *net_mcast6addr;
|
||||
static cvar_t *net_mcast6iface;
|
||||
|
||||
static cvar_t *net_dropsim;
|
||||
|
||||
static struct sockaddr socksRelayAddr;
|
||||
|
||||
static SOCKET ip_socket = INVALID_SOCKET;
|
||||
|
@ -201,7 +205,7 @@ char *NET_ErrorString( void ) {
|
|||
default: return "NO ERROR";
|
||||
}
|
||||
#else
|
||||
return strerror (errno);
|
||||
return strerror(socketError);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -309,11 +313,11 @@ static qboolean Sys_StringToSockaddr(const char *s, struct sockaddr *sadr, int s
|
|||
|
||||
if(search)
|
||||
{
|
||||
if(res->ai_addrlen > sadr_len)
|
||||
res->ai_addrlen = sadr_len;
|
||||
if(search->ai_addrlen > sadr_len)
|
||||
search->ai_addrlen = sadr_len;
|
||||
|
||||
memcpy(sadr, res->ai_addr, res->ai_addrlen);
|
||||
freeaddrinfo(res);
|
||||
memcpy(sadr, search->ai_addr, search->ai_addrlen);
|
||||
freeaddrinfo(search);
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
|
@ -524,16 +528,17 @@ qboolean NET_IsLocalAddress( netadr_t adr ) {
|
|||
|
||||
/*
|
||||
==================
|
||||
Sys_GetPacket
|
||||
NET_GetPacket
|
||||
|
||||
Never called by the game logic, just the system event queing
|
||||
Receive one packet
|
||||
==================
|
||||
*/
|
||||
#ifdef _DEBUG
|
||||
int recvfromCount;
|
||||
#endif
|
||||
|
||||
qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) {
|
||||
qboolean NET_GetPacket(netadr_t *net_from, msg_t *net_message, fd_set *fdr)
|
||||
{
|
||||
int ret;
|
||||
struct sockaddr_storage from;
|
||||
socklen_t fromlen;
|
||||
|
@ -543,7 +548,7 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) {
|
|||
recvfromCount++; // performance check
|
||||
#endif
|
||||
|
||||
if(ip_socket != INVALID_SOCKET)
|
||||
if(ip_socket != INVALID_SOCKET && FD_ISSET(ip_socket, fdr))
|
||||
{
|
||||
fromlen = sizeof(from);
|
||||
ret = recvfrom( ip_socket, (void *)net_message->data, net_message->maxsize, 0, (struct sockaddr *) &from, &fromlen );
|
||||
|
@ -577,7 +582,7 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) {
|
|||
net_message->readcount = 0;
|
||||
}
|
||||
|
||||
if( ret == net_message->maxsize ) {
|
||||
if( ret >= net_message->maxsize ) {
|
||||
Com_Printf( "Oversize packet from %s\n", NET_AdrToString (*net_from) );
|
||||
return qfalse;
|
||||
}
|
||||
|
@ -587,7 +592,7 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) {
|
|||
}
|
||||
}
|
||||
|
||||
if(ip6_socket != INVALID_SOCKET)
|
||||
if(ip6_socket != INVALID_SOCKET && FD_ISSET(ip6_socket, fdr))
|
||||
{
|
||||
fromlen = sizeof(from);
|
||||
ret = recvfrom(ip6_socket, (void *)net_message->data, net_message->maxsize, 0, (struct sockaddr *) &from, &fromlen);
|
||||
|
@ -604,7 +609,7 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) {
|
|||
SockadrToNetadr((struct sockaddr *) &from, net_from);
|
||||
net_message->readcount = 0;
|
||||
|
||||
if(ret == net_message->maxsize)
|
||||
if(ret >= net_message->maxsize)
|
||||
{
|
||||
Com_Printf( "Oversize packet from %s\n", NET_AdrToString (*net_from) );
|
||||
return qfalse;
|
||||
|
@ -615,7 +620,7 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) {
|
|||
}
|
||||
}
|
||||
|
||||
if(multicast6_socket != INVALID_SOCKET && multicast6_socket != ip6_socket)
|
||||
if(multicast6_socket != INVALID_SOCKET && multicast6_socket != ip6_socket && FD_ISSET(multicast6_socket, fdr))
|
||||
{
|
||||
fromlen = sizeof(from);
|
||||
ret = recvfrom(multicast6_socket, (void *)net_message->data, net_message->maxsize, 0, (struct sockaddr *) &from, &fromlen);
|
||||
|
@ -632,7 +637,7 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) {
|
|||
SockadrToNetadr((struct sockaddr *) &from, net_from);
|
||||
net_message->readcount = 0;
|
||||
|
||||
if(ret == net_message->maxsize)
|
||||
if(ret >= net_message->maxsize)
|
||||
{
|
||||
Com_Printf( "Oversize packet from %s\n", NET_AdrToString (*net_from) );
|
||||
return qfalse;
|
||||
|
@ -828,7 +833,7 @@ NET_IPSocket
|
|||
int NET_IPSocket( char *net_interface, int port, int *err ) {
|
||||
SOCKET newsocket;
|
||||
struct sockaddr_in address;
|
||||
u_long _true = 1;
|
||||
ioctlarg_t _true = 1;
|
||||
int i = 1;
|
||||
|
||||
*err = 0;
|
||||
|
@ -896,7 +901,7 @@ NET_IP6Socket
|
|||
int NET_IP6Socket( char *net_interface, int port, struct sockaddr_in6 *bindto, int *err ) {
|
||||
SOCKET newsocket;
|
||||
struct sockaddr_in6 address;
|
||||
u_long _true = 1;
|
||||
ioctlarg_t _true = 1;
|
||||
|
||||
*err = 0;
|
||||
|
||||
|
@ -1499,6 +1504,8 @@ static qboolean NET_GetCvars( void ) {
|
|||
modified += net_socksPassword->modified;
|
||||
net_socksPassword->modified = qfalse;
|
||||
|
||||
net_dropsim = Cvar_Get("net_dropsim", "", CVAR_TEMP);
|
||||
|
||||
return modified ? qtrue : qfalse;
|
||||
}
|
||||
|
||||
|
@ -1627,6 +1634,42 @@ void NET_Shutdown( void ) {
|
|||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
NET_Event
|
||||
|
||||
Called from NET_Sleep which uses select() to determine which sockets have seen action.
|
||||
====================
|
||||
*/
|
||||
|
||||
void NET_Event(fd_set *fdr)
|
||||
{
|
||||
byte bufData[MAX_MSGLEN + 1];
|
||||
netadr_t from;
|
||||
msg_t netmsg;
|
||||
|
||||
while(1)
|
||||
{
|
||||
MSG_Init(&netmsg, bufData, sizeof(bufData));
|
||||
|
||||
if(NET_GetPacket(&from, &netmsg, fdr))
|
||||
{
|
||||
if(net_dropsim->value > 0.0f && net_dropsim->value <= 100.0f)
|
||||
{
|
||||
// com_dropsim->value percent of incoming packets get dropped.
|
||||
if(rand() < (int) (((double) RAND_MAX) / 100.0 * (double) net_dropsim->value))
|
||||
continue; // drop this packet
|
||||
}
|
||||
|
||||
if(com_sv_running->integer)
|
||||
Com_RunAndTimeServerPacket(&from, &netmsg);
|
||||
else
|
||||
CL_PacketEvent(from, &netmsg);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
|
@ -1635,31 +1678,23 @@ NET_Sleep
|
|||
Sleeps msec or until something happens on the network
|
||||
====================
|
||||
*/
|
||||
void NET_Sleep( int msec ) {
|
||||
void NET_Sleep(int msec)
|
||||
{
|
||||
struct timeval timeout;
|
||||
fd_set fdset;
|
||||
int highestfd = -1;
|
||||
fd_set fdr;
|
||||
int highestfd = -1, retval;
|
||||
|
||||
if (!com_dedicated->integer)
|
||||
return; // we're not a server, just run full speed
|
||||
|
||||
if (ip_socket == INVALID_SOCKET && ip6_socket == INVALID_SOCKET)
|
||||
return;
|
||||
|
||||
if (msec < 0 )
|
||||
return;
|
||||
|
||||
FD_ZERO(&fdset);
|
||||
FD_ZERO(&fdr);
|
||||
|
||||
if(ip_socket != INVALID_SOCKET)
|
||||
{
|
||||
FD_SET(ip_socket, &fdset);
|
||||
FD_SET(ip_socket, &fdr);
|
||||
|
||||
highestfd = ip_socket;
|
||||
}
|
||||
if(ip6_socket != INVALID_SOCKET)
|
||||
{
|
||||
FD_SET(ip6_socket, &fdset);
|
||||
FD_SET(ip6_socket, &fdr);
|
||||
|
||||
if(ip6_socket > highestfd)
|
||||
highestfd = ip6_socket;
|
||||
|
@ -1667,9 +1702,23 @@ void NET_Sleep( int msec ) {
|
|||
|
||||
timeout.tv_sec = msec/1000;
|
||||
timeout.tv_usec = (msec%1000)*1000;
|
||||
select(highestfd + 1, &fdset, NULL, NULL, &timeout);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if(highestfd < 0)
|
||||
{
|
||||
// windows ain't happy when select is called without valid FDs
|
||||
SleepEx(msec, 0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
retval = select(highestfd + 1, &fdr, NULL, NULL, &timeout);
|
||||
|
||||
if(retval < 0)
|
||||
Com_Printf("Warning: select() syscall failed: %s\n", NET_ErrorString());
|
||||
else if(retval > 0)
|
||||
NET_Event(&fdr);
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
|
|
|
@ -1020,48 +1020,6 @@ int ReflectVectorByte(vec3_t dir, vec3_t plane)
|
|||
return DirToByte(final);
|
||||
}
|
||||
|
||||
/*
|
||||
* ================
|
||||
* CreateRotationMatrix
|
||||
* ================
|
||||
* */
|
||||
void CreateRotationMatrix(const vec3_t angles, vec3_t matrix[3])
|
||||
{
|
||||
AngleVectors(angles, matrix[0], matrix[1], matrix[2]);
|
||||
VectorInverse(matrix[1]);
|
||||
}
|
||||
|
||||
/*
|
||||
* ================
|
||||
* TransposeMatrix
|
||||
* ================
|
||||
* */
|
||||
void TransposeMatrix(vec3_t matrix[3], vec3_t transpose[3])
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
transpose[i][j] = matrix[j][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ================
|
||||
* RotatePoint
|
||||
* ================
|
||||
* */
|
||||
void RotatePoint(vec3_t point, vec3_t matrix[3])
|
||||
{
|
||||
vec3_t tvec;
|
||||
|
||||
VectorCopy(point, tvec);
|
||||
point[0] = DotProduct(matrix[0], tvec);
|
||||
point[1] = DotProduct(matrix[1], tvec);
|
||||
point[2] = DotProduct(matrix[2], tvec);
|
||||
}
|
||||
|
||||
//Makro - added
|
||||
void ChangeRefSystem(vec3_t in, vec3_t neworg, vec3_t newaxis[], vec3_t out)
|
||||
{
|
||||
|
|
|
@ -74,7 +74,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
//================================================================= WIN64/32 ===
|
||||
|
||||
#ifdef __WIN64__
|
||||
#if defined(_WIN64) || defined(__WIN64__)
|
||||
|
||||
#undef QDECL
|
||||
#define QDECL __cdecl
|
||||
|
@ -98,7 +98,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
#define DLL_EXT ".dll"
|
||||
|
||||
#elif defined(__WIN32__) || defined (_WIN32)
|
||||
#elif defined(_WIN32) || defined(__WIN32__)
|
||||
|
||||
#undef QDECL
|
||||
#define QDECL __cdecl
|
||||
|
@ -154,11 +154,16 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
//================================================================= LINUX ===
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__FreeBSD_kernel__)
|
||||
|
||||
#include <endian.h>
|
||||
|
||||
#if defined(__linux__)
|
||||
#define OS_STRING "linux"
|
||||
#else
|
||||
#define OS_STRING "kFreeBSD"
|
||||
#endif
|
||||
|
||||
#define ID_INLINE inline
|
||||
#define PATH_SEP '/'
|
||||
|
||||
|
|
|
@ -96,13 +96,6 @@ void COM_StripExtension( const char *in, char *out, int destsize ) {
|
|||
out[length] = 0;
|
||||
}
|
||||
|
||||
void COM_StripExtensionInPlace(char *name)
|
||||
{
|
||||
char* ext = Q_strrchr(name, '.');
|
||||
if (ext)
|
||||
*ext = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
|
@ -733,6 +726,39 @@ qboolean Q_isintegral( float f )
|
|||
return (int)f == f;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/*
|
||||
=============
|
||||
Q_vsnprintf
|
||||
|
||||
Special wrapper function for Microsoft's broken _vsnprintf() function.
|
||||
MinGW comes with its own snprintf() which is not broken.
|
||||
=============
|
||||
*/
|
||||
|
||||
int Q_vsnprintf(char *str, size_t size, const char *format, va_list ap);
|
||||
{
|
||||
int retval;
|
||||
|
||||
retval = _vsnprintf(str, size, format, ap);
|
||||
|
||||
if(retval < 0 || retval == size)
|
||||
{
|
||||
// Microsoft doesn't adhere to the C99 standard of vsnprintf,
|
||||
// which states that the return value must be the number of
|
||||
// bytes written if the output string had sufficient length.
|
||||
//
|
||||
// Obviously we cannot determine that value from Microsoft's
|
||||
// implementation, so we have no choice but to return size.
|
||||
|
||||
str[size - 1] = '\0';
|
||||
return size;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
=============
|
||||
Q_strncpyz
|
||||
|
@ -941,28 +967,18 @@ int Q_CountChar(const char *string, char tocount)
|
|||
return count;
|
||||
}
|
||||
|
||||
void QDECL Com_sprintf( char *dest, int size, const char *fmt, ...) {
|
||||
void QDECL Com_sprintf(char *dest, int size, const char *fmt, ...)
|
||||
{
|
||||
int len;
|
||||
va_list argptr;
|
||||
char bigbuffer[32000]; // big, but small enough to fit in PPC stack
|
||||
|
||||
va_start (argptr,fmt);
|
||||
len = Q_vsnprintf (bigbuffer, sizeof(bigbuffer), fmt,argptr);
|
||||
len = Q_vsnprintf(dest, size, fmt, argptr);
|
||||
va_end (argptr);
|
||||
if ( len >= sizeof( bigbuffer ) ) {
|
||||
Com_Error( ERR_FATAL, "Com_sprintf: overflowed bigbuffer" );
|
||||
}
|
||||
if (len >= size) {
|
||||
Com_Printf ("Com_sprintf: overflow of %i in %i\n", len, size);
|
||||
#ifdef _DEBUG
|
||||
__asm {
|
||||
int 3;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Q_strncpyz (dest, bigbuffer, size );
|
||||
}
|
||||
|
||||
if(len >= size)
|
||||
Com_Printf("Com_sprintf: Output length %d too short, require %d bytes.\n", size, len);
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
|
@ -1009,70 +1025,6 @@ void Com_TruncateLongString( char *buffer, const char *s )
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* =============
|
||||
* TempVector
|
||||
*
|
||||
* This is just a convenience function
|
||||
* for making temporary vectors for function calls
|
||||
* =============
|
||||
* */
|
||||
float *tv(float x, float y, float z)
|
||||
{
|
||||
static int index;
|
||||
static vec3_t vecs[8];
|
||||
float *v;
|
||||
|
||||
// use an array so that multiple tempvectors won't collide
|
||||
// for a while
|
||||
v = vecs[index];
|
||||
index = (index + 1) & 7;
|
||||
|
||||
v[0] = x;
|
||||
v[1] = y;
|
||||
v[2] = z;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
/*
|
||||
* =============
|
||||
* VectorToString
|
||||
*
|
||||
* This is just a convenience function
|
||||
* for printing vectors
|
||||
* =============
|
||||
* */
|
||||
char *vtos(const vec3_t v)
|
||||
{
|
||||
static int index;
|
||||
static char str[8][32];
|
||||
char *s;
|
||||
|
||||
// use an array so that multiple vtos won't collide
|
||||
s = str[index];
|
||||
index = (index + 1) & 7;
|
||||
|
||||
Com_sprintf(s, 32, "(%.3f %.3f %.3f)", v[0], v[1], v[2]);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
//====================================================================
|
||||
// JBravo: moved from g_weapon.c
|
||||
void SnapVectorTowards( vec3_t v, vec3_t to )
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < 3 ; i++) {
|
||||
if ( to[i] <= v[i] ) {
|
||||
v[i] = (int)v[i];
|
||||
} else {
|
||||
v[i] = (int)v[i] + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=====================================================================
|
||||
|
||||
|
@ -1358,6 +1310,7 @@ void Info_SetValueForKey( char *s, const char *key, const char *value ) {
|
|||
Info_SetValueForKey_Big
|
||||
|
||||
Changes or adds a key/value pair
|
||||
Includes and retains zero-length values
|
||||
==================
|
||||
*/
|
||||
void Info_SetValueForKey_Big( char *s, const char *key, const char *value ) {
|
||||
|
@ -1378,7 +1331,7 @@ void Info_SetValueForKey_Big( char *s, const char *key, const char *value ) {
|
|||
}
|
||||
|
||||
Info_RemoveKey_Big (s, key);
|
||||
if (!value || !strlen(value))
|
||||
if (!value)
|
||||
return;
|
||||
|
||||
Com_sprintf (newi, sizeof(newi), "\\%s\\%s", key, value);
|
||||
|
|
|
@ -31,22 +31,29 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define BASEGAME "Boomstick"
|
||||
#define CLIENT_WINDOW_TITLE "Reaction"
|
||||
#define CLIENT_WINDOW_MIN_TITLE "Reaction"
|
||||
#define GAMENAME_FOR_MASTER "Reaction" // must NOT contain whitespaces
|
||||
#define GAMENAME_FOR_MASTER "Reaction" // must NOT contain whitespaces
|
||||
#define HEARTBEAT_FOR_MASTER GAMENAME_FOR_MASTER
|
||||
#define FLATLINE_FOR_MASTER GAMENAME_FOR_MASTER "dead"
|
||||
#else
|
||||
#define PRODUCT_NAME "Reaction"
|
||||
#define BASEGAME "Boomstick"
|
||||
#define BASEGAME "baseq3"
|
||||
#define CLIENT_WINDOW_TITLE "Reaction"
|
||||
#define CLIENT_WINDOW_MIN_TITLE "Reaction"
|
||||
#define GAMENAME_FOR_MASTER "Reaction"
|
||||
#define HEARTBEAT_FOR_MASTER "Reaction-1"
|
||||
#define FLATLINE_FOR_MASTER HEARTBEAT_FOR_MASTER
|
||||
#endif
|
||||
|
||||
#define BASETA "missionpack"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define PRODUCT_VERSION "1.35"
|
||||
#endif
|
||||
|
||||
#define Q3_VERSION PRODUCT_NAME " " PRODUCT_VERSION
|
||||
|
||||
#define MAX_TEAMNAME 32
|
||||
#define MAX_TEAMNAME 32
|
||||
#define MAX_MASTER_SERVERS 5 // number of supported master servers
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
|
@ -125,16 +132,6 @@ typedef int intptr_t;
|
|||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
// vsnprintf is ISO/IEC 9899:1999
|
||||
// abstracting this to make it portable
|
||||
#ifdef _WIN32
|
||||
#define Q_vsnprintf _vsnprintf
|
||||
#define Q_snprintf _snprintf
|
||||
#else
|
||||
#define Q_vsnprintf vsnprintf
|
||||
#define Q_snprintf snprintf
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <io.h>
|
||||
|
||||
|
@ -146,8 +143,14 @@ typedef int intptr_t;
|
|||
typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
|
||||
// vsnprintf is ISO/IEC 9899:1999
|
||||
// abstracting this to make it portable
|
||||
int Q_vsnprintf(char *str, size_t size, const char *format, va_list ap);
|
||||
#else
|
||||
#include <stdint.h>
|
||||
|
||||
#define Q_vsnprintf vsnprintf
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -175,9 +178,9 @@ typedef int clipHandle_t;
|
|||
#define PAD(x,y) (((x)+(y)-1) & ~((y)-1))
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define ALIGN(x) __attribute__((aligned(x)))
|
||||
#define QALIGN(x) __attribute__((aligned(x)))
|
||||
#else
|
||||
#define ALIGN(x)
|
||||
#define QALIGN(x)
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
|
@ -191,16 +194,17 @@ typedef int clipHandle_t;
|
|||
#define MAX_QINT 0x7fffffff
|
||||
#define MIN_QINT (-MAX_QINT-1)
|
||||
|
||||
#define ARRAY_LEN(x) (sizeof(x) / sizeof(*(x)))
|
||||
|
||||
|
||||
// angle indexes
|
||||
#define PITCH 0 // up / down
|
||||
#define YAW 1 // left / right
|
||||
#define ROLL 2 // fall over
|
||||
|
||||
//Makro - angle axis
|
||||
#define PITCH_AXIS 1
|
||||
#define YAW_AXIS 2
|
||||
#define ROLL_AXIS 0
|
||||
#define PITCH_AXIS 1
|
||||
#define YAW_AXIS 2
|
||||
#define ROLL_AXIS 0
|
||||
|
||||
|
||||
// the game guarantees that no string from the network will ever
|
||||
|
@ -338,11 +342,9 @@ typedef int fixed16_t;
|
|||
#define M_PI 3.14159265358979323846f // matches value in gcc v2 math.h
|
||||
#endif
|
||||
|
||||
//#define NUMVERTEXNORMALS 162
|
||||
//extern vec3_t bytedirs[NUMVERTEXNORMALS];
|
||||
//Makro - changed from 162 to 256 in order to use the new bytedirs table
|
||||
#define NUMVERTEXNORMALS 256
|
||||
extern vec3_t bytedirs[NUMVERTEXNORMALS];
|
||||
extern vec3_t bytedirs[NUMVERTEXNORMALS];
|
||||
|
||||
// all drawing is done to a 640*480 virtual screen size
|
||||
// and will be automatically scaled to the real resolution
|
||||
|
@ -388,6 +390,9 @@ extern vec4_t colorDkGrey;
|
|||
//#define ColorIndex(c) (((c) - '0') & 0x07)
|
||||
#define ColorIndex(c) ( ( (c) - '0' ) & 7 )
|
||||
|
||||
//Makro - reset color
|
||||
#define S_COLOR_RESET "^*"
|
||||
|
||||
#define S_COLOR_BLACK "^0"
|
||||
#define S_COLOR_RED "^1"
|
||||
#define S_COLOR_GREEN "^2"
|
||||
|
@ -397,24 +402,11 @@ extern vec4_t colorDkGrey;
|
|||
#define S_COLOR_MAGENTA "^6"
|
||||
#define S_COLOR_WHITE "^7"
|
||||
|
||||
//Makro - reset color
|
||||
#define S_COLOR_RESET "^*"
|
||||
|
||||
extern vec4_t g_color_table[8];
|
||||
|
||||
#define MAKERGB( v, r, g, b ) v[0]=r;v[1]=g;v[2]=b
|
||||
#define MAKERGBA( v, r, g, b, a ) v[0]=r;v[1]=g;v[2]=b;v[3]=a
|
||||
|
||||
//Makro - for the UI
|
||||
#define Vector2Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1])
|
||||
#define Vector2MA(v,s,b,o) ((o)[0]=(v)[0]+(b)[0]*(s),(o)[1]=(v)[1]+(b)[1]*(s))
|
||||
#define Vector2Add(a,b,o) ((o)[0]=(a)[0]+(b)[0],(o)[1]=(a)[1]+(b)[1])
|
||||
#define Vector2Subtract(a,b,o) ((o)[0]=(a)[0]-(b)[0],(o)[1]=(a)[1]-(b)[1])
|
||||
#define Vector2Scale(a,s,o) ((o)[0]=(a)[0]*(s),(o)[1]=(a)[1]*(s))
|
||||
#define Vector2Negate(a,o) ((o)[0]=-(a)[0],(o)[1]=-(a)[1])
|
||||
#define Vector2Set(v,x,y) ((v)[0]=(x),(v)[1]=(y))
|
||||
#define Vector2Norm2(v) ((v)[0]*(v)[0]+(v)[1]*(v)[1])
|
||||
|
||||
#define DEG2RAD( a ) ( ( (a) * M_PI ) / 180.0F )
|
||||
#define RAD2DEG( a ) ( ( (a) * 180.0f ) / M_PI )
|
||||
|
||||
|
@ -501,6 +493,16 @@ typedef struct {
|
|||
#define VectorSet(v, x, y, z) ((v)[0]=(x), (v)[1]=(y), (v)[2]=(z))
|
||||
#define Vector4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
|
||||
|
||||
//Makro - for the UI
|
||||
#define Vector2Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1])
|
||||
#define Vector2MA(v,s,b,o) ((o)[0]=(v)[0]+(b)[0]*(s),(o)[1]=(v)[1]+(b)[1]*(s))
|
||||
#define Vector2Add(a,b,o) ((o)[0]=(a)[0]+(b)[0],(o)[1]=(a)[1]+(b)[1])
|
||||
#define Vector2Subtract(a,b,o) ((o)[0]=(a)[0]-(b)[0],(o)[1]=(a)[1]-(b)[1])
|
||||
#define Vector2Scale(a,s,o) ((o)[0]=(a)[0]*(s),(o)[1]=(a)[1]*(s))
|
||||
#define Vector2Negate(a,o) ((o)[0]=-(a)[0],(o)[1]=-(a)[1])
|
||||
#define Vector2Set(v,x,y) ((v)[0]=(x),(v)[1]=(y))
|
||||
#define Vector2Norm2(v) ((v)[0]*(v)[0]+(v)[1]*(v)[1])
|
||||
|
||||
#define SnapVector(v) {v[0]=((int)(v[0]));v[1]=((int)(v[1]));v[2]=((int)(v[2]));}
|
||||
void SnapVectorTowards(vec3_t v, vec3_t to);
|
||||
// just in case you do't want to use the macros
|
||||
|
@ -650,14 +652,13 @@ int ReflectVectorByte( vec3_t dir, vec3_t plane );
|
|||
int Q_isnan( float x );
|
||||
|
||||
// Makro - added
|
||||
void RotatePoint(vec3_t point, /*const*/ vec3_t matrix[3]);
|
||||
void TransposeMatrix(/*const*/ vec3_t matrix[3], vec3_t transpose[3]);
|
||||
void CreateRotationMatrix(const vec3_t angles, vec3_t matrix[3]);
|
||||
void ChangeRefSystem(vec3_t in, vec3_t neworg, vec3_t newaxis[], vec3_t out);
|
||||
void ChangeBackRefSystem(vec3_t in, vec3_t neworg, vec3_t newaxis[], vec3_t out);
|
||||
void ChangeAngleRefSystem(vec3_t in, vec3_t newaxis[], vec3_t out);
|
||||
|
||||
|
||||
// Makro - moved from bg_lic.c so all can use :P
|
||||
#define is_digit(c) ((unsigned)to_digit(c) <= 9)
|
||||
#define to_digit(c) ((c) - '0')
|
||||
|
||||
//=============================================
|
||||
|
||||
|
@ -666,7 +667,6 @@ float Com_Clamp( float min, float max, float value );
|
|||
char *COM_SkipPath( char *pathname );
|
||||
const char *COM_GetExtension( const char *name );
|
||||
void COM_StripExtension(const char *in, char *out, int destsize);
|
||||
void COM_StripExtensionInPlace(char* name);
|
||||
void COM_DefaultExtension( char *path, int maxSize, const char *extension );
|
||||
|
||||
void COM_BeginParseSession( const char *name );
|
||||
|
@ -790,9 +790,6 @@ float LittleFloat (const float *l);
|
|||
void Swap_Init (void);
|
||||
*/
|
||||
char * QDECL va(char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
float *tv(float x, float y, float z);
|
||||
char *vtos( const vec3_t v );
|
||||
|
||||
|
||||
#define TRUNCATE_LENGTH 64
|
||||
void Com_TruncateLongString( char *buffer, const char *s );
|
||||
|
@ -1279,10 +1276,6 @@ typedef struct {
|
|||
|
||||
#define Square(x) ((x)*(x))
|
||||
|
||||
// Makro - moved from bg_lic.c so all can use :P
|
||||
#define is_digit(c) ((unsigned)to_digit(c) <= 9)
|
||||
#define to_digit(c) ((c) - '0')
|
||||
|
||||
// real time
|
||||
//=============================================
|
||||
|
||||
|
@ -1343,4 +1336,7 @@ typedef enum _flag_status {
|
|||
#define CDCHKSUM_LEN 2
|
||||
|
||||
|
||||
#define LERP( a, b, w ) ( ( a ) * ( 1.0f - ( w ) ) + ( b ) * ( w ) )
|
||||
#define LUMA( red, green, blue ) ( 0.2126f * ( red ) + 0.7152f * ( green ) + 0.0722f * ( blue ) )
|
||||
|
||||
#endif // __Q_SHARED_H
|
||||
|
|
|
@ -573,15 +573,16 @@ issues.
|
|||
#define FS_UI_REF 0x02
|
||||
#define FS_CGAME_REF 0x04
|
||||
#define FS_QAGAME_REF 0x08
|
||||
// number of id paks that will never be autodownloaded from baseq3
|
||||
// number of id paks that will never be autodownloaded from baseq3/missionpack
|
||||
#define NUM_ID_PAKS 9
|
||||
#define NUM_TA_PAKS 4
|
||||
|
||||
#define MAX_FILE_HANDLES 64
|
||||
|
||||
#ifdef DEDICATED
|
||||
# define Q3CONFIG_CFG "Reaction_server.cfg"
|
||||
# define Q3CONFIG_CFG "q3config_server.cfg"
|
||||
#else
|
||||
# define Q3CONFIG_CFG "Reaction.cfg"
|
||||
# define Q3CONFIG_CFG "q3config.cfg"
|
||||
#endif
|
||||
|
||||
qboolean FS_Initialized( void );
|
||||
|
@ -605,6 +606,9 @@ void FS_FreeFileList( char **list );
|
|||
qboolean FS_FileExists( const char *file );
|
||||
|
||||
qboolean FS_CreatePath (char *OSPath);
|
||||
|
||||
char *FS_FindDll( const char *filename );
|
||||
|
||||
char *FS_BuildOSPath( const char *base, const char *game, const char *qpath );
|
||||
qboolean FS_CompareZipChecksum(const char *zipfile);
|
||||
|
||||
|
@ -702,7 +706,7 @@ void FS_PureServerSetLoadedPaks( const char *pakSums, const char *pakNames );
|
|||
// sole exception of .cfg files.
|
||||
|
||||
qboolean FS_CheckDirTraversal(const char *checkdir);
|
||||
qboolean FS_idPak( char *pak, char *base );
|
||||
qboolean FS_idPak(char *pak, char *base, int numPaks);
|
||||
qboolean FS_ComparePaks( char *neededpaks, int len, qboolean dlstring );
|
||||
|
||||
void FS_Rename( const char *from, const char *to );
|
||||
|
@ -711,7 +715,9 @@ void FS_Remove( const char *osPath );
|
|||
void FS_HomeRemove( const char *homePath );
|
||||
|
||||
void FS_FilenameCompletion( const char *dir, const char *ext,
|
||||
qboolean stripExt, void(*callback)(const char *s) );
|
||||
qboolean stripExt, void(*callback)(const char *s), qboolean allowNonPureFilesOnDisk );
|
||||
|
||||
const char *FS_GetCurrentGameDir(void);
|
||||
|
||||
/*
|
||||
==============================================================
|
||||
|
@ -733,7 +739,7 @@ void Field_Clear( field_t *edit );
|
|||
void Field_AutoComplete( field_t *edit );
|
||||
void Field_CompleteKeyname( void );
|
||||
void Field_CompleteFilename( const char *dir,
|
||||
const char *ext, qboolean stripExt );
|
||||
const char *ext, qboolean stripExt, qboolean allowNonPureFilesOnDisk );
|
||||
void Field_CompleteCommand( char *cmd,
|
||||
qboolean doCommands, qboolean doCvars );
|
||||
|
||||
|
@ -768,13 +774,12 @@ typedef enum
|
|||
|
||||
typedef enum {
|
||||
// SE_NONE must be zero
|
||||
SE_NONE = 0, // evTime is still valid
|
||||
SE_KEY, // evValue is a key code, evValue2 is the down flag
|
||||
SE_CHAR, // evValue is an ascii char
|
||||
SE_MOUSE, // evValue and evValue2 are reletive signed x / y moves
|
||||
SE_NONE = 0, // evTime is still valid
|
||||
SE_KEY, // evValue is a key code, evValue2 is the down flag
|
||||
SE_CHAR, // evValue is an ascii char
|
||||
SE_MOUSE, // evValue and evValue2 are reletive signed x / y moves
|
||||
SE_JOYSTICK_AXIS, // evValue is an axis number and evValue2 is the current state (-127 to 127)
|
||||
SE_CONSOLE, // evPtr is a char*
|
||||
SE_PACKET // evPtr is a netadr_t followed by data bytes to evPtrLength
|
||||
SE_CONSOLE // evPtr is a char*
|
||||
} sysEventType_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -807,6 +812,7 @@ int Com_Filter(char *filter, char *name, int casesensitive);
|
|||
int Com_FilterPath(char *filter, char *name, int casesensitive);
|
||||
int Com_RealTime(qtime_t *qtime);
|
||||
qboolean Com_SafeMode( void );
|
||||
void Com_RunAndTimeServerPacket(netadr_t *evFrom, msg_t *buf);
|
||||
|
||||
void Com_StartupVariable( const char *match );
|
||||
// checks for and removes command line "+set var arg" constructs
|
||||
|
@ -831,6 +837,9 @@ extern cvar_t *com_maxfpsUnfocused;
|
|||
extern cvar_t *com_minimized;
|
||||
extern cvar_t *com_maxfpsMinimized;
|
||||
extern cvar_t *com_altivec;
|
||||
extern cvar_t *com_standalone;
|
||||
extern cvar_t *com_basegame;
|
||||
extern cvar_t *com_homepath;
|
||||
|
||||
// both client and server must agree to pause
|
||||
extern cvar_t *cl_paused;
|
||||
|
@ -839,13 +848,14 @@ extern cvar_t *sv_paused;
|
|||
extern cvar_t *cl_packetdelay;
|
||||
extern cvar_t *sv_packetdelay;
|
||||
|
||||
extern cvar_t *com_protocol;
|
||||
|
||||
// com_speeds times
|
||||
extern int time_game;
|
||||
extern int time_frontend;
|
||||
extern int time_backend; // renderer backend time
|
||||
|
||||
extern int com_frameTime;
|
||||
extern int com_frameMsec;
|
||||
|
||||
extern qboolean com_errorEntered;
|
||||
|
||||
|
@ -997,6 +1007,7 @@ void SV_Init( void );
|
|||
void SV_Shutdown( char *finalmsg );
|
||||
void SV_Frame( int msec );
|
||||
void SV_PacketEvent( netadr_t from, msg_t *msg );
|
||||
int SV_FrameMsec(void);
|
||||
qboolean SV_GameCommand( void );
|
||||
|
||||
|
||||
|
@ -1027,7 +1038,7 @@ typedef enum {
|
|||
void Sys_Init (void);
|
||||
|
||||
// general development dll loading for virtual machine testing
|
||||
void * QDECL Sys_LoadDll( const char *name, char *fqpath , intptr_t (QDECL **entryPoint)(int, ...),
|
||||
void * QDECL Sys_LoadDll( const char *name, intptr_t (QDECL **entryPoint)(int, ...),
|
||||
intptr_t (QDECL *systemcalls)(intptr_t, ...) );
|
||||
void Sys_UnloadDll( void *dllHandle );
|
||||
|
||||
|
@ -1068,7 +1079,6 @@ cpuFeatures_t Sys_GetProcessorFeatures( void );
|
|||
void Sys_SetErrorText( const char *text );
|
||||
|
||||
void Sys_SendPacket( int length, const void *data, netadr_t to );
|
||||
qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message );
|
||||
|
||||
qboolean Sys_StringToAdr( const char *s, netadr_t *a, netadrtype_t family );
|
||||
//Does NOT parse port numbers, only base addresses.
|
||||
|
|
|
@ -80,15 +80,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define SURF_DUST 0x40000 // leave a dust trail when walking on this surface
|
||||
|
||||
//Elder: new surfaces
|
||||
#define SURF_GRAVEL 0x80000
|
||||
#define SURF_WOOD 0x100000
|
||||
#define SURF_CARPET 0x200000
|
||||
#define SURF_METAL2 0x400000
|
||||
#define SURF_GLASS 0x800000
|
||||
#define SURF_GRASS 0x1000000
|
||||
#define SURF_GRAVEL 0x80000
|
||||
#define SURF_WOOD 0x100000
|
||||
#define SURF_CARPET 0x200000
|
||||
#define SURF_METAL2 0x400000
|
||||
#define SURF_GLASS 0x800000
|
||||
#define SURF_GRASS 0x1000000
|
||||
// JBravo: new sounds
|
||||
#define SURF_SNOW 0x2000000
|
||||
#define SURF_MUD 0x4000000
|
||||
#define SURF_WOOD2 0x8000000
|
||||
#define SURF_HARDMETAL 0x10000000
|
||||
#define SURF_SNOW 0x2000000
|
||||
#define SURF_MUD 0x4000000
|
||||
#define SURF_WOOD2 0x8000000
|
||||
#define SURF_HARDMETAL 0x10000000
|
||||
|
||||
|
|
|
@ -35,23 +35,10 @@ woven in by Terry Thorsen 1/2003.
|
|||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "../qcommon/q_shared.h"
|
||||
#include "../qcommon/qcommon.h"
|
||||
#include "unzip.h"
|
||||
|
||||
#ifdef STDC
|
||||
# include <stddef.h>
|
||||
# include <string.h>
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#ifdef NO_ERRNO_H
|
||||
extern int errno;
|
||||
#else
|
||||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef local
|
||||
# define local static
|
||||
#endif
|
||||
|
@ -74,10 +61,10 @@ woven in by Terry Thorsen 1/2003.
|
|||
#endif
|
||||
|
||||
#ifndef ALLOC
|
||||
# define ALLOC(size) (malloc(size))
|
||||
# define ALLOC(size) (Z_Malloc(size))
|
||||
#endif
|
||||
#ifndef TRYFREE
|
||||
# define TRYFREE(p) {if (p) free(p);}
|
||||
# define TRYFREE(p) {if (p) Z_Free(p);}
|
||||
#endif
|
||||
|
||||
#define SIZECENTRALDIRITEM (0x2e)
|
||||
|
|
|
@ -306,7 +306,7 @@ Dlls will call this directly
|
|||
|
||||
rcg010206 The horror; the horror.
|
||||
|
||||
The syscall mechanism relies on stack manipulation to get it's args.
|
||||
The syscall mechanism relies on stack manipulation to get its args.
|
||||
This is likely due to C's inability to pass "..." parameters to
|
||||
a function in one clean chunk. On PowerPC Linux, these parameters
|
||||
are not necessarily passed on the stack, so while (&arg[0] == arg)
|
||||
|
@ -346,7 +346,7 @@ intptr_t QDECL VM_DllSyscall( intptr_t arg, ... ) {
|
|||
args[0] = arg;
|
||||
|
||||
va_start(ap, arg);
|
||||
for (i = 1; i < sizeof (args) / sizeof (args[i]); i++)
|
||||
for (i = 1; i < ARRAY_LEN (args); i++)
|
||||
args[i] = va_arg(ap, intptr_t);
|
||||
va_end(ap);
|
||||
|
||||
|
@ -384,6 +384,9 @@ vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc ) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// show where the qvm was loaded from
|
||||
Cmd_ExecuteString( va( "which %s\n", filename ) );
|
||||
|
||||
if( LittleLong( header.h->vmMagic ) == VM_MAGIC_VER2 ) {
|
||||
Com_Printf( "...which has vmMagic VM_MAGIC_VER2\n" );
|
||||
|
||||
|
@ -556,7 +559,7 @@ vm_t *VM_Create( const char *module, intptr_t (*systemCalls)(intptr_t *),
|
|||
if ( interpret == VMI_NATIVE ) {
|
||||
// try to load as a system dll
|
||||
Com_Printf( "Loading dll file %s.\n", vm->name );
|
||||
vm->dllHandle = Sys_LoadDll( module, vm->fqpath , &vm->entryPoint, VM_DllSyscall );
|
||||
vm->dllHandle = Sys_LoadDll( module, &vm->entryPoint, VM_DllSyscall );
|
||||
if ( vm->dllHandle ) {
|
||||
return vm;
|
||||
}
|
||||
|
@ -753,7 +756,7 @@ intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... ) {
|
|||
int args[10];
|
||||
va_list ap;
|
||||
va_start(ap, callnum);
|
||||
for (i = 0; i < sizeof (args) / sizeof (args[i]); i++) {
|
||||
for (i = 0; i < ARRAY_LEN(args); i++) {
|
||||
args[i] = va_arg(ap, int);
|
||||
}
|
||||
va_end(ap);
|
||||
|
@ -778,7 +781,7 @@ intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... ) {
|
|||
|
||||
a.callnum = callnum;
|
||||
va_start(ap, callnum);
|
||||
for (i = 0; i < sizeof (a.args) / sizeof (a.args[0]); i++) {
|
||||
for (i = 0; i < ARRAY_LEN(a.args); i++) {
|
||||
a.args[i] = va_arg(ap, int);
|
||||
}
|
||||
va_end(ap);
|
||||
|
|
|
@ -168,8 +168,6 @@ struct vm_s {
|
|||
int breakFunction; // increment breakCount on function entry to this
|
||||
int breakCount;
|
||||
|
||||
char fqpath[MAX_QPATH+1] ;
|
||||
|
||||
byte *jumpTableTargets;
|
||||
int numJumpTableTargets;
|
||||
};
|
||||
|
|
|
@ -690,7 +690,7 @@ static const long int gpr_list[] = {
|
|||
r7, r8, r9, r10,
|
||||
};
|
||||
static const long int gpr_vstart = 8; /* position of first volatile register */
|
||||
static const long int gpr_total = sizeof( gpr_list ) / sizeof( gpr_list[0] );
|
||||
static const long int gpr_total = ARRAY_LEN( gpr_list );
|
||||
|
||||
static const long int fpr_list[] = {
|
||||
/* static registers, normally none is used */
|
||||
|
@ -704,7 +704,7 @@ static const long int fpr_list[] = {
|
|||
f12, f13,
|
||||
};
|
||||
static const long int fpr_vstart = 8;
|
||||
static const long int fpr_total = sizeof( fpr_list ) / sizeof( fpr_list[0] );
|
||||
static const long int fpr_total = ARRAY_LEN( fpr_list );
|
||||
|
||||
/*
|
||||
* prepare some dummy structures and emit init code
|
||||
|
@ -1837,7 +1837,7 @@ PPC_ComputeCode( vm_t *vm )
|
|||
unsigned char *dataAndCode = mmap( NULL, codeLength,
|
||||
PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0 );
|
||||
|
||||
if ( ! dataAndCode )
|
||||
if (dataAndCode == MAP_FAILED)
|
||||
DIE( "Not enough memory" );
|
||||
|
||||
ppc_instruction_t *codeNow, *codeBegin;
|
||||
|
|
|
@ -389,8 +389,7 @@ static const struct powerpc_operand powerpc_operands[] =
|
|||
|
||||
};
|
||||
|
||||
static const unsigned int num_powerpc_operands =
|
||||
(sizeof (powerpc_operands) / sizeof (powerpc_operands[0]));
|
||||
static const unsigned int num_powerpc_operands = ARRAY_LEN (powerpc_operands);
|
||||
|
||||
/* The functions used to insert and extract complicated operands. */
|
||||
|
||||
|
@ -1004,6 +1003,3 @@ static const struct powerpc_opcode powerpc_opcodes[] = {
|
|||
{ "fsub", A(63,20,0), AFRC_MASK, PPCCOM, { FRT, FRA, FRB } },
|
||||
{ "fneg", XRC(63,40,0), XRA_MASK, COM, { FRT, FRB } },
|
||||
};
|
||||
|
||||
static const int powerpc_num_opcodes =
|
||||
sizeof (powerpc_opcodes) / sizeof (powerpc_opcodes[0]);
|
||||
|
|
|
@ -259,7 +259,7 @@ static const struct sparc_opcode sparc_opcodes[] = {
|
|||
{ "fbg", BFCC(0,6), { ARG_DISP22 }, },
|
||||
{ "fble", BFCC(0,13), { ARG_DISP22 }, },
|
||||
};
|
||||
#define SPARC_NUM_OPCODES (sizeof(sparc_opcodes) / sizeof(sparc_opcodes[0]))
|
||||
#define SPARC_NUM_OPCODES (ARRAY_LEN(sparc_opcodes))
|
||||
|
||||
#define RS1(X) (((X) & 0x1f) << 14)
|
||||
#define RS2(X) (((X) & 0x1f) << 0)
|
||||
|
@ -320,7 +320,7 @@ static unsigned int sparc_assemble(enum sparc_iname iname, const int argc, const
|
|||
|
||||
#define IN(inst, args...) \
|
||||
({ const int argv[] = { args }; \
|
||||
const int argc = sizeof(argv) / sizeof(argv[0]); \
|
||||
const int argc = ARRAY_LEN(argv); \
|
||||
sparc_assemble(inst, argc, argv); \
|
||||
})
|
||||
|
||||
|
@ -1427,7 +1427,7 @@ static void sparc_compute_code(vm_t *vm, struct func_info * const fp)
|
|||
|
||||
data_and_code = mmap(NULL, code_length, PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
|
||||
if (!data_and_code)
|
||||
if (data_and_code == MAP_FAILED)
|
||||
DIE("Not enough memory");
|
||||
|
||||
code_now = code_begin = (unsigned int *)
|
||||
|
|
|
@ -36,7 +36,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
/* need this on NX enabled systems (i386 with PAE kernel or
|
||||
* noexec32=on x86_64) */
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
#define VM_X86_MMAP
|
||||
#endif
|
||||
|
||||
|
@ -53,6 +53,7 @@ static void VM_Destroy_Compiled(vm_t* self);
|
|||
|
||||
*/
|
||||
|
||||
#define VMFREE_BUFFERS() do {Z_Free(buf); Z_Free(jused);} while(0)
|
||||
static byte *buf = NULL;
|
||||
static byte *jused = NULL;
|
||||
static int compiledOfs = 0;
|
||||
|
@ -289,6 +290,7 @@ static int Hex( int c ) {
|
|||
return c - '0';
|
||||
}
|
||||
|
||||
VMFREE_BUFFERS();
|
||||
Com_Error( ERR_DROP, "Hex: bad char '%c'", c );
|
||||
|
||||
return 0;
|
||||
|
@ -408,6 +410,7 @@ qboolean EmitMovEBXEDI(vm_t *vm, int andit) {
|
|||
#define JUSED(x) \
|
||||
do { \
|
||||
if (x < 0 || x >= jusedSize) { \
|
||||
VMFREE_BUFFERS(); \
|
||||
Com_Error( ERR_DROP, \
|
||||
"VM_CompileX86: jump target out of range at offset %d", pc ); \
|
||||
} \
|
||||
|
@ -429,7 +432,7 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
|
|||
|
||||
// allocate a very large temp buffer, we will shrink it later
|
||||
maxLength = header->codeLength * 8;
|
||||
buf = Z_Malloc( maxLength );
|
||||
buf = Z_Malloc(maxLength);
|
||||
jused = Z_Malloc(jusedSize);
|
||||
|
||||
Com_Memset(jused, 0, jusedSize);
|
||||
|
@ -454,16 +457,21 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
|
|||
|
||||
LastCommand = LAST_COMMAND_NONE;
|
||||
|
||||
while ( instruction < header->instructionCount ) {
|
||||
if ( compiledOfs > maxLength - 16 ) {
|
||||
Com_Error( ERR_FATAL, "VM_CompileX86: maxLength exceeded" );
|
||||
while(instruction < header->instructionCount)
|
||||
{
|
||||
if(compiledOfs > maxLength - 16)
|
||||
{
|
||||
VMFREE_BUFFERS();
|
||||
Com_Error(ERR_DROP, "VM_CompileX86: maxLength exceeded");
|
||||
}
|
||||
|
||||
vm->instructionPointers[ instruction ] = compiledOfs;
|
||||
instruction++;
|
||||
|
||||
if ( pc > header->codeLength ) {
|
||||
Com_Error( ERR_FATAL, "VM_CompileX86: pc > header->codeLength" );
|
||||
if(pc > header->codeLength)
|
||||
{
|
||||
VMFREE_BUFFERS();
|
||||
Com_Error(ERR_DROP, "VM_CompileX86: pc > header->codeLength");
|
||||
}
|
||||
|
||||
op = code[ pc ];
|
||||
|
@ -1075,7 +1083,8 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
|
|||
Emit4( (int)vm->instructionPointers );
|
||||
break;
|
||||
default:
|
||||
Com_Error( ERR_DROP, "VM_CompileX86: bad opcode %i at offset %i", op, pc );
|
||||
VMFREE_BUFFERS();
|
||||
Com_Error(ERR_DROP, "VM_CompileX86: bad opcode %i at offset %i", op, pc);
|
||||
}
|
||||
pop0 = pop1;
|
||||
pop1 = op;
|
||||
|
@ -1086,13 +1095,13 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
|
|||
vm->codeLength = compiledOfs;
|
||||
#ifdef VM_X86_MMAP
|
||||
vm->codeBase = mmap(NULL, compiledOfs, PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
|
||||
if(vm->codeBase == (void*)-1)
|
||||
Com_Error(ERR_DROP, "VM_CompileX86: can't mmap memory");
|
||||
if(vm->codeBase == MAP_FAILED)
|
||||
Com_Error(ERR_FATAL, "VM_CompileX86: can't mmap memory");
|
||||
#elif _WIN32
|
||||
// allocate memory with EXECUTE permissions under windows.
|
||||
vm->codeBase = VirtualAlloc(NULL, compiledOfs, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
if(!vm->codeBase)
|
||||
Com_Error(ERR_DROP, "VM_CompileX86: VirtualAlloc failed");
|
||||
Com_Error(ERR_FATAL, "VM_CompileX86: VirtualAlloc failed");
|
||||
#else
|
||||
vm->codeBase = malloc(compiledOfs);
|
||||
#endif
|
||||
|
@ -1101,14 +1110,14 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
|
|||
|
||||
#ifdef VM_X86_MMAP
|
||||
if(mprotect(vm->codeBase, compiledOfs, PROT_READ|PROT_EXEC))
|
||||
Com_Error(ERR_DROP, "VM_CompileX86: mprotect failed");
|
||||
Com_Error(ERR_FATAL, "VM_CompileX86: mprotect failed");
|
||||
#elif _WIN32
|
||||
{
|
||||
DWORD oldProtect = 0;
|
||||
|
||||
// remove write permissions.
|
||||
if(!VirtualProtect(vm->codeBase, compiledOfs, PAGE_EXECUTE_READ, &oldProtect))
|
||||
Com_Error(ERR_DROP, "VM_CompileX86: VirtualProtect failed");
|
||||
Com_Error(ERR_FATAL, "VM_CompileX86: VirtualProtect failed");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ static FILE* qdasmout;
|
|||
#define Dfprintf(args...)
|
||||
#endif
|
||||
|
||||
#define VM_FREEBUFFERS(vm) do {assembler_init(0); VM_Destroy_Compiled(vm);} while(0)
|
||||
|
||||
void assembler_set_output(char* buf);
|
||||
size_t assembler_get_code_size(void);
|
||||
void assembler_init(int pass);
|
||||
|
@ -251,6 +253,7 @@ void emit(const char* fmt, ...)
|
|||
|
||||
#define CHECK_INSTR(nr) \
|
||||
do { if(nr < 0 || nr >= header->instructionCount) { \
|
||||
VM_FREEBUFFERS(vm); \
|
||||
Com_Error( ERR_DROP, \
|
||||
"%s: jump target 0x%x out of range at offset %d", __func__, nr, pc ); \
|
||||
} } while(0)
|
||||
|
@ -429,6 +432,8 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
|
|||
|
||||
// const optimization
|
||||
unsigned got_const = 0, const_value = 0;
|
||||
|
||||
vm->codeBase = NULL;
|
||||
|
||||
gettimeofday(&tvstart, NULL);
|
||||
|
||||
|
@ -441,15 +446,17 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
|
|||
|
||||
#ifdef VM_X86_64_MMAP
|
||||
vm->codeBase = mmap(NULL, compiledOfs, PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
|
||||
if(vm->codeBase == (void*)-1)
|
||||
Com_Error(ERR_DROP, "VM_CompileX86: can't mmap memory");
|
||||
if(vm->codeBase == MAP_FAILED)
|
||||
Com_Error(ERR_FATAL, "VM_CompileX86_64: can't mmap memory");
|
||||
#elif __WIN64__
|
||||
// allocate memory with write permissions under windows.
|
||||
vm->codeBase = VirtualAlloc(NULL, compiledOfs, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);
|
||||
if(!vm->codeBase)
|
||||
Com_Error(ERR_DROP, "VM_CompileX86: VirtualAlloc failed");
|
||||
Com_Error(ERR_FATAL, "VM_CompileX86_64: VirtualAlloc failed");
|
||||
#else
|
||||
vm->codeBase = malloc(compiledOfs);
|
||||
if(!vm_codeBase)
|
||||
Com_Error(ERR_FATAL, "VM_CompileX86_64: Failed to allocate memory");
|
||||
#endif
|
||||
|
||||
assembler_set_output((char*)vm->codeBase);
|
||||
|
@ -930,7 +937,9 @@ emit_do_syscall:
|
|||
|
||||
}
|
||||
|
||||
if(got_const) {
|
||||
if(got_const)
|
||||
{
|
||||
VM_FREEBUFFERS(vm);
|
||||
Com_Error(ERR_DROP, "leftover const\n");
|
||||
}
|
||||
|
||||
|
@ -943,14 +952,14 @@ emit_do_syscall:
|
|||
|
||||
#ifdef VM_X86_64_MMAP
|
||||
if(mprotect(vm->codeBase, compiledOfs, PROT_READ|PROT_EXEC))
|
||||
Com_Error(ERR_DROP, "VM_CompileX86: mprotect failed");
|
||||
Com_Error(ERR_FATAL, "VM_CompileX86_64: mprotect failed");
|
||||
#elif __WIN64__
|
||||
{
|
||||
DWORD oldProtect = 0;
|
||||
|
||||
// remove write permissions; give exec permision
|
||||
if(!VirtualProtect(vm->codeBase, compiledOfs, PAGE_EXECUTE_READ, &oldProtect))
|
||||
Com_Error(ERR_DROP, "VM_CompileX86: VirtualProtect failed");
|
||||
Com_Error(ERR_FATAL, "VM_CompileX86_64: VirtualProtect failed");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -987,11 +996,16 @@ emit_do_syscall:
|
|||
|
||||
void VM_Destroy_Compiled(vm_t* self)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
VirtualFree(self->codeBase, 0, MEM_RELEASE);
|
||||
if(self && self->codeBase)
|
||||
{
|
||||
#ifdef VM_X86_64_MMAP
|
||||
munmap(self->codeBase, self->codeLength);
|
||||
#elif __WIN64__
|
||||
VirtualFree(self->codeBase, 0, MEM_RELEASE);
|
||||
#else
|
||||
munmap(self->codeBase, self->codeLength);
|
||||
free(self->codeBase);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -20,6 +20,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
#define _ISOC99_SOURCE
|
||||
|
||||
#include "vm_local.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -238,9 +241,15 @@ static void hash_add_label(const char* label, unsigned address)
|
|||
{
|
||||
struct hashentry* h;
|
||||
unsigned i = hashkey(label, -1U);
|
||||
i %= sizeof(labelhash)/sizeof(labelhash[0]);
|
||||
h = malloc(sizeof(struct hashentry));
|
||||
h->label = strdup(label);
|
||||
int labellen;
|
||||
|
||||
i %= ARRAY_LEN(labelhash);
|
||||
h = Z_Malloc(sizeof(struct hashentry));
|
||||
|
||||
labellen = strlen(label) + 1;
|
||||
h->label = Z_Malloc(labellen);
|
||||
memcpy(h->label, label, labellen);
|
||||
|
||||
h->address = address;
|
||||
h->next = labelhash[i];
|
||||
labelhash[i] = h;
|
||||
|
@ -250,7 +259,7 @@ static unsigned lookup_label(const char* label)
|
|||
{
|
||||
struct hashentry* h;
|
||||
unsigned i = hashkey(label, -1U);
|
||||
i %= sizeof(labelhash)/sizeof(labelhash[0]);
|
||||
i %= ARRAY_LEN(labelhash);
|
||||
for(h = labelhash[i]; h; h = h->next )
|
||||
{
|
||||
if(!strcmp(h->label, label))
|
||||
|
@ -266,15 +275,15 @@ static void labelhash_free(void)
|
|||
struct hashentry* h;
|
||||
unsigned i;
|
||||
unsigned z = 0, min = -1U, max = 0, t = 0;
|
||||
for ( i = 0; i < sizeof(labelhash)/sizeof(labelhash[0]); ++i)
|
||||
for ( i = 0; i < ARRAY_LEN(labelhash); ++i)
|
||||
{
|
||||
unsigned n = 0;
|
||||
h = labelhash[i];
|
||||
while(h)
|
||||
{
|
||||
struct hashentry* next = h->next;
|
||||
free(h->label);
|
||||
free(h);
|
||||
Z_Free(h->label);
|
||||
Z_Free(h);
|
||||
h = next;
|
||||
++n;
|
||||
}
|
||||
|
@ -284,7 +293,7 @@ static void labelhash_free(void)
|
|||
min = MIN(min, n);
|
||||
max = MAX(max, n);
|
||||
}
|
||||
printf("total %u, hsize %"PRIu64", zero %u, min %u, max %u\n", t, sizeof(labelhash)/sizeof(labelhash[0]), z, min, max);
|
||||
printf("total %u, hsize %"PRIu64", zero %u, min %u, max %u\n", t, ARRAY_LEN(labelhash), z, min, max);
|
||||
memset(labelhash, 0, sizeof(labelhash));
|
||||
}
|
||||
|
||||
|
@ -1006,7 +1015,7 @@ static op_t* getop(const char* n)
|
|||
#else
|
||||
unsigned m, t, b;
|
||||
int r;
|
||||
t = sizeof(ops)/sizeof(ops[0])-1;
|
||||
t = ARRAY_LEN(ops)-1;
|
||||
b = 0;
|
||||
|
||||
while(b <= t)
|
||||
|
@ -1297,7 +1306,7 @@ void assembler_init(int pass)
|
|||
if(!ops_sorted)
|
||||
{
|
||||
ops_sorted = 1;
|
||||
qsort(ops, sizeof(ops)/sizeof(ops[0])-1, sizeof(ops[0]), opsort);
|
||||
qsort(ops, ARRAY_LEN(ops)-1, sizeof(ops[0]), opsort);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -155,9 +155,6 @@ static void R_LoadLightmaps( lump_t *l ) {
|
|||
//FIXME: HACK: maps with only one lightmap turn up fullbright for some reason.
|
||||
//this avoids this, but isn't the correct solution.
|
||||
tr.numLightmaps++;
|
||||
} else if ( tr.numLightmaps >= MAX_LIGHTMAPS ) { // 20051020 misantropia
|
||||
ri.Printf( PRINT_WARNING, "WARNING: number of lightmaps > MAX_LIGHTMAPS\n" );
|
||||
tr.numLightmaps = MAX_LIGHTMAPS;
|
||||
}
|
||||
|
||||
// if we are in r_vertexLight mode, we don't need the lightmaps at all
|
||||
|
@ -165,6 +162,7 @@ static void R_LoadLightmaps( lump_t *l ) {
|
|||
return;
|
||||
}
|
||||
|
||||
tr.lightmaps = ri.Hunk_Alloc( tr.numLightmaps * sizeof(image_t *), h_low );
|
||||
for ( i = 0 ; i < tr.numLightmaps ; i++ ) {
|
||||
// expand the 24 bit on-disk to 32 bit
|
||||
buf_p = buf + i * LIGHTMAP_SIZE*LIGHTMAP_SIZE * 3;
|
||||
|
|
|
@ -144,7 +144,7 @@ void R_IssueRenderCommands( qboolean runPerformanceCounters ) {
|
|||
}
|
||||
|
||||
// at this point, the back end thread is idle, so it is ok
|
||||
// to look at it's performance counters
|
||||
// to look at its performance counters
|
||||
if ( runPerformanceCounters ) {
|
||||
R_PerformanceCounters();
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ constant, irrespective of distance, but the intensity should be proportional to
|
|||
projected area of the light source.
|
||||
|
||||
A surface that has been flagged as having a light flare will calculate the depth
|
||||
buffer value that it's midpoint should have when the surface is added.
|
||||
buffer value that its midpoint should have when the surface is added.
|
||||
|
||||
After all opaque surfaces have been rendered, the depth buffer is read back for
|
||||
each flare in view. If the point has not been obscured by a closer surface, the
|
||||
|
|
|
@ -560,6 +560,27 @@ static void Upload32( unsigned *data,
|
|||
scan = ((byte *)data);
|
||||
samples = 3;
|
||||
|
||||
if( r_greyscale->integer )
|
||||
{
|
||||
for ( i = 0; i < c; i++ )
|
||||
{
|
||||
byte luma = LUMA(scan[i*4], scan[i*4 + 1], scan[i*4 + 2]);
|
||||
scan[i*4] = luma;
|
||||
scan[i*4 + 1] = luma;
|
||||
scan[i*4 + 2] = luma;
|
||||
}
|
||||
}
|
||||
else if( r_greyscale->value )
|
||||
{
|
||||
for ( i = 0; i < c; i++ )
|
||||
{
|
||||
float luma = LUMA(scan[i*4], scan[i*4 + 1], scan[i*4 + 2]);
|
||||
scan[i*4] = LERP(scan[i*4], luma, r_greyscale->value);
|
||||
scan[i*4 + 1] = LERP(scan[i*4 + 1], luma, r_greyscale->value);
|
||||
scan[i*4 + 2] = LERP(scan[i*4 + 2], luma, r_greyscale->value);
|
||||
}
|
||||
}
|
||||
|
||||
if(lightMap)
|
||||
{
|
||||
if(r_greyscale->integer)
|
||||
|
|
|
@ -156,6 +156,9 @@ cvar_t *r_saveFontData;
|
|||
|
||||
cvar_t *r_marksOnTriangleMeshes;
|
||||
|
||||
cvar_t *r_aviMotionJpegQuality;
|
||||
cvar_t *r_screenshotJpegQuality;
|
||||
|
||||
cvar_t *r_maxpolys;
|
||||
int max_polys;
|
||||
cvar_t *r_maxpolyverts;
|
||||
|
@ -283,7 +286,7 @@ vidmode_t r_vidModes[] =
|
|||
{ "Mode 10: 2048x1536", 2048, 1536, 1 },
|
||||
{ "Mode 11: 856x480 (wide)",856, 480, 1 }
|
||||
};
|
||||
static int s_numVidModes = ( sizeof( r_vidModes ) / sizeof( r_vidModes[0] ) );
|
||||
static int s_numVidModes = ARRAY_LEN( r_vidModes );
|
||||
|
||||
qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode ) {
|
||||
vidmode_t *vm;
|
||||
|
@ -405,7 +408,7 @@ void RB_TakeScreenshotJPEG( int x, int y, int width, int height, char *fileName
|
|||
}
|
||||
|
||||
ri.FS_WriteFile( fileName, buffer, 1 ); // create path
|
||||
SaveJPG( fileName, 90, glConfig.vidWidth, glConfig.vidHeight, buffer);
|
||||
SaveJPG( fileName, r_screenshotJpegQuality->integer, glConfig.vidWidth, glConfig.vidHeight, buffer);
|
||||
|
||||
ri.Hunk_FreeTempMemory( buffer );
|
||||
}
|
||||
|
@ -709,7 +712,7 @@ const void *RB_TakeVideoFrameCmd( const void *data )
|
|||
|
||||
if( cmd->motionJpeg )
|
||||
{
|
||||
frameSize = SaveJPGToBuffer( cmd->encodeBuffer, 90,
|
||||
frameSize = SaveJPGToBuffer( cmd->encodeBuffer, r_aviMotionJpegQuality->integer,
|
||||
cmd->width, cmd->height, cmd->captureBuffer );
|
||||
ri.CL_WriteAVIVideoFrame( cmd->encodeBuffer, frameSize );
|
||||
}
|
||||
|
@ -906,7 +909,7 @@ void R_Register( void )
|
|||
ri.Cvar_CheckRange( r_ext_multisample, 0, 4, qtrue );
|
||||
r_overBrightBits = ri.Cvar_Get ("r_overBrightBits", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_ignorehwgamma = ri.Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_mode = ri.Cvar_Get( "r_mode", "6", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_mode = ri.Cvar_Get( "r_mode", "3", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_fullscreen = ri.Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE );
|
||||
r_noborder = Cvar_Get("r_noborder", "0", CVAR_ARCHIVE);
|
||||
r_customwidth = ri.Cvar_Get( "r_customwidth", "1600", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
|
@ -920,6 +923,7 @@ void R_Register( void )
|
|||
r_stereoEnabled = ri.Cvar_Get( "r_stereoEnabled", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_ignoreFastPath = ri.Cvar_Get( "r_ignoreFastPath", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_greyscale = ri.Cvar_Get("r_greyscale", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
ri.Cvar_CheckRange(r_greyscale, 0, 1, qfalse);
|
||||
|
||||
//
|
||||
// temporary latched variables that can only change over a restart
|
||||
|
@ -1011,6 +1015,9 @@ void R_Register( void )
|
|||
|
||||
r_marksOnTriangleMeshes = ri.Cvar_Get("r_marksOnTriangleMeshes", "0", CVAR_ARCHIVE);
|
||||
|
||||
r_aviMotionJpegQuality = ri.Cvar_Get("r_aviMotionJpegQuality", "90", CVAR_ARCHIVE);
|
||||
r_screenshotJpegQuality = ri.Cvar_Get("r_screenshotJpegQuality", "90", CVAR_ARCHIVE);
|
||||
|
||||
r_maxpolys = ri.Cvar_Get( "r_maxpolys", va("%d", MAX_POLYS), 0);
|
||||
r_maxpolyverts = ri.Cvar_Get( "r_maxpolyverts", va("%d", MAX_POLYVERTS), 0);
|
||||
|
||||
|
|
|
@ -76,7 +76,6 @@ typedef struct {
|
|||
|
||||
qboolean needDlights; // true for bmodels that touch a dlight
|
||||
qboolean lightingCalculated;
|
||||
qboolean mirrored; // mirrored matrix, needs reversed culling
|
||||
vec3_t lightDir; // normalized direction towards light
|
||||
vec3_t ambientLight; // color normalized to 0-255
|
||||
int ambientLightInt; // 32 bit rgba packed
|
||||
|
@ -780,7 +779,6 @@ void R_Modellist_f (void);
|
|||
extern refimport_t ri;
|
||||
|
||||
#define MAX_DRAWIMAGES 2048
|
||||
#define MAX_LIGHTMAPS 256
|
||||
#define MAX_SKINS 1024
|
||||
|
||||
|
||||
|
@ -917,7 +915,7 @@ typedef struct {
|
|||
shader_t *sunShader;
|
||||
|
||||
int numLightmaps;
|
||||
image_t *lightmaps[MAX_LIGHTMAPS];
|
||||
image_t **lightmaps;
|
||||
|
||||
trRefEntity_t *currentEntity;
|
||||
trRefEntity_t worldEntity; // point currentEntity at this when rendering world
|
||||
|
@ -1064,7 +1062,6 @@ extern cvar_t *r_colorMipLevels; // development aid to see texture mip usage
|
|||
extern cvar_t *r_picmip; // controls picmip values
|
||||
extern cvar_t *r_finish;
|
||||
extern cvar_t *r_drawBuffer;
|
||||
extern cvar_t *r_glDriver;
|
||||
extern cvar_t *r_swapInterval;
|
||||
extern cvar_t *r_textureMode;
|
||||
extern cvar_t *r_offsetFactor;
|
||||
|
@ -1117,8 +1114,6 @@ extern cvar_t *r_saveFontData;
|
|||
|
||||
extern cvar_t *r_marksOnTriangleMeshes;
|
||||
|
||||
extern cvar_t *r_GLlibCoolDownMsec;
|
||||
|
||||
//====================================================================
|
||||
|
||||
float R_NoiseGet4f( float x, float y, float z, float t );
|
||||
|
@ -1304,19 +1299,19 @@ typedef struct stageVars
|
|||
|
||||
typedef struct shaderCommands_s
|
||||
{
|
||||
glIndex_t indexes[SHADER_MAX_INDEXES] ALIGN(16);
|
||||
vec4_t xyz[SHADER_MAX_VERTEXES] ALIGN(16);
|
||||
vec4_t normal[SHADER_MAX_VERTEXES] ALIGN(16);
|
||||
vec2_t texCoords[SHADER_MAX_VERTEXES][2] ALIGN(16);
|
||||
color4ub_t vertexColors[SHADER_MAX_VERTEXES] ALIGN(16);
|
||||
int vertexDlightBits[SHADER_MAX_VERTEXES] ALIGN(16);
|
||||
glIndex_t indexes[SHADER_MAX_INDEXES] QALIGN(16);
|
||||
vec4_t xyz[SHADER_MAX_VERTEXES] QALIGN(16);
|
||||
vec4_t normal[SHADER_MAX_VERTEXES] QALIGN(16);
|
||||
vec2_t texCoords[SHADER_MAX_VERTEXES][2] QALIGN(16);
|
||||
color4ub_t vertexColors[SHADER_MAX_VERTEXES] QALIGN(16);
|
||||
int vertexDlightBits[SHADER_MAX_VERTEXES] QALIGN(16);
|
||||
|
||||
stageVars_t svars ALIGN(16);
|
||||
stageVars_t svars QALIGN(16);
|
||||
|
||||
color4ub_t constantColor255[SHADER_MAX_VERTEXES] ALIGN(16);
|
||||
color4ub_t constantColor255[SHADER_MAX_VERTEXES] QALIGN(16);
|
||||
|
||||
shader_t *shader;
|
||||
float shaderTime;
|
||||
float shaderTime;
|
||||
int fogNum;
|
||||
|
||||
int dlightBits; // or together of all vertexDlightBits
|
||||
|
|
|
@ -562,8 +562,8 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char
|
|||
((float *)frame->bones)[j] = LittleFloat( ((float *)curframe->bones)[j] );
|
||||
}
|
||||
|
||||
curframe++;
|
||||
frame++;
|
||||
curframe = (mdrFrame_t *) &curframe->bones[mdr->numBones];
|
||||
frame = (mdrFrame_t *) &frame->bones[mdr->numBones];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
static float s_noise_table[NOISE_SIZE];
|
||||
static int s_noise_perm[NOISE_SIZE];
|
||||
|
||||
#define LERP( a, b, w ) ( a * ( 1.0f - w ) + b * w )
|
||||
|
||||
static float GetNoiseValue( int x, int y, int z, int t )
|
||||
{
|
||||
int index = INDEX( ( int ) x, ( int ) y, ( int ) z, ( int ) t );
|
||||
|
|
|
@ -99,15 +99,13 @@ void R_AddPolygonSurfaces( void ) {
|
|||
int i;
|
||||
shader_t *sh;
|
||||
srfPoly_t *poly;
|
||||
int fogMask;
|
||||
|
||||
tr.currentEntityNum = ENTITYNUM_WORLD;
|
||||
tr.shiftedEntityNum = tr.currentEntityNum << QSORT_ENTITYNUM_SHIFT;
|
||||
fogMask = -((tr.refdef.rdflags & RDF_NOFOG) == 0);
|
||||
|
||||
for ( i = 0, poly = tr.refdef.polys; i < tr.refdef.numPolys ; i++, poly++ ) {
|
||||
sh = R_GetShaderByHandle( poly->hShader );
|
||||
R_AddDrawSurf( ( void * )poly, sh, poly->fogIndex & fogMask, qfalse );
|
||||
R_AddDrawSurf( ( void * )poly, sh, poly->fogIndex, qfalse );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -459,9 +459,18 @@ static void ProjectDlightTexture_altivec( void ) {
|
|||
{
|
||||
float luminance;
|
||||
|
||||
luminance = (dl->color[0] * 255.0f + dl->color[1] * 255.0f + dl->color[2] * 255.0f) / 3;
|
||||
luminance = LUMA(dl->color[0], dl->color[1], dl->color[2]) * 255.0f;
|
||||
floatColor[0] = floatColor[1] = floatColor[2] = luminance;
|
||||
}
|
||||
else if(r_greyscale->value)
|
||||
{
|
||||
float luminance;
|
||||
|
||||
luminance = LUMA(dl->color[0], dl->color[1], dl->color[2]) * 255.0f;
|
||||
floatColor[0] = LERP(dl->color[0] * 255.0f, luminance, r_greyscale->value);
|
||||
floatColor[1] = LERP(dl->color[1] * 255.0f, luminance, r_greyscale->value);
|
||||
floatColor[2] = LERP(dl->color[2] * 255.0f, luminance, r_greyscale->value);
|
||||
}
|
||||
else
|
||||
{
|
||||
floatColor[0] = dl->color[0] * 255.0f;
|
||||
|
@ -612,10 +621,19 @@ static void ProjectDlightTexture_scalar( void ) {
|
|||
if(r_greyscale->integer)
|
||||
{
|
||||
float luminance;
|
||||
|
||||
luminance = (dl->color[0] * 255.0f + dl->color[1] * 255.0f + dl->color[2] * 255.0f) / 3;
|
||||
|
||||
luminance = LUMA(dl->color[0], dl->color[1], dl->color[2]) * 255.0f;
|
||||
floatColor[0] = floatColor[1] = floatColor[2] = luminance;
|
||||
}
|
||||
else if(r_greyscale->value)
|
||||
{
|
||||
float luminance;
|
||||
|
||||
luminance = LUMA(dl->color[0], dl->color[1], dl->color[2]) * 255.0f;
|
||||
floatColor[0] = LERP(dl->color[0] * 255.0f, luminance, r_greyscale->value);
|
||||
floatColor[1] = LERP(dl->color[1] * 255.0f, luminance, r_greyscale->value);
|
||||
floatColor[2] = LERP(dl->color[2] * 255.0f, luminance, r_greyscale->value);
|
||||
}
|
||||
else
|
||||
{
|
||||
floatColor[0] = dl->color[0] * 255.0f;
|
||||
|
@ -964,11 +982,22 @@ static void ComputeColors( shaderStage_t *pStage )
|
|||
if(r_greyscale->integer)
|
||||
{
|
||||
int scale;
|
||||
for(i = 0; i < tess.numVertexes; i++)
|
||||
{
|
||||
scale = LUMA(tess.svars.colors[i][0], tess.svars.colors[i][1], tess.svars.colors[i][2]);
|
||||
tess.svars.colors[i][0] = tess.svars.colors[i][1] = tess.svars.colors[i][2] = scale;
|
||||
}
|
||||
}
|
||||
else if(r_greyscale->value)
|
||||
{
|
||||
float scale;
|
||||
|
||||
for(i = 0; i < tess.numVertexes; i++)
|
||||
{
|
||||
scale = (tess.svars.colors[i][0] + tess.svars.colors[i][1] + tess.svars.colors[i][2]) / 3;
|
||||
tess.svars.colors[i][0] = tess.svars.colors[i][1] = tess.svars.colors[i][2] = scale;
|
||||
scale = LUMA(tess.svars.colors[i][0], tess.svars.colors[i][1], tess.svars.colors[i][2]);
|
||||
tess.svars.colors[i][0] = LERP(tess.svars.colors[i][0], scale, r_greyscale->value);
|
||||
tess.svars.colors[i][1] = LERP(tess.svars.colors[i][1], scale, r_greyscale->value);
|
||||
tess.svars.colors[i][2] = LERP(tess.svars.colors[i][2], scale, r_greyscale->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -359,10 +359,10 @@ static void AutospriteDeform( void ) {
|
|||
vec3_t leftDir, upDir;
|
||||
|
||||
if ( tess.numVertexes & 3 ) {
|
||||
ri.Printf( PRINT_WARNING, "Autosprite shader %s had odd vertex count", tess.shader->name );
|
||||
ri.Printf( PRINT_WARNING, "Autosprite shader %s had odd vertex count\n", tess.shader->name );
|
||||
}
|
||||
if ( tess.numIndexes != ( tess.numVertexes >> 2 ) * 6 ) {
|
||||
ri.Printf( PRINT_WARNING, "Autosprite shader %s had odd index count", tess.shader->name );
|
||||
ri.Printf( PRINT_WARNING, "Autosprite shader %s had odd index count\n", tess.shader->name );
|
||||
}
|
||||
|
||||
oldVerts = tess.numVertexes;
|
||||
|
|
|
@ -30,7 +30,6 @@ static char *s_shaderText;
|
|||
static shaderStage_t stages[MAX_SHADER_STAGES];
|
||||
static shader_t shader;
|
||||
static texModInfo_t texMods[MAX_SHADER_STAGES][TR_MAX_TEXMODS];
|
||||
static qboolean deferLoad;
|
||||
|
||||
#define FILE_HASH_SIZE 1024
|
||||
static shader_t* hashTable[FILE_HASH_SIZE];
|
||||
|
@ -1034,7 +1033,7 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
|
|||
}
|
||||
|
||||
// decide which agens we can skip
|
||||
if ( stage->alphaGen == CGEN_IDENTITY ) {
|
||||
if ( stage->alphaGen == AGEN_IDENTITY ) {
|
||||
if ( stage->rgbGen == CGEN_IDENTITY
|
||||
|| stage->rgbGen == CGEN_LIGHTING_DIFFUSE ) {
|
||||
stage->alphaGen = AGEN_SKIP;
|
||||
|
@ -1371,7 +1370,7 @@ surfaceparm <name>
|
|||
*/
|
||||
static void ParseSurfaceParm( char **text ) {
|
||||
char *token;
|
||||
int numInfoParms = sizeof(infoParms) / sizeof(infoParms[0]);
|
||||
int numInfoParms = ARRAY_LEN( infoParms );
|
||||
int i;
|
||||
|
||||
token = COM_ParseExt( text, qfalse );
|
||||
|
@ -1824,7 +1823,7 @@ static qboolean CollapseMultitexture( void ) {
|
|||
return qfalse;
|
||||
}
|
||||
}
|
||||
if ( stages[0].alphaGen == CGEN_WAVEFORM )
|
||||
if ( stages[0].alphaGen == AGEN_WAVEFORM )
|
||||
{
|
||||
if ( memcmp( &stages[0].alphaWave,
|
||||
&stages[1].alphaWave,
|
||||
|
@ -2327,11 +2326,15 @@ static char *FindShaderInShaderText( const char *shadername ) {
|
|||
|
||||
hash = generateHashValue(shadername, MAX_SHADERTEXT_HASH);
|
||||
|
||||
for (i = 0; shaderTextHashTable[hash][i]; i++) {
|
||||
p = shaderTextHashTable[hash][i];
|
||||
token = COM_ParseExt(&p, qtrue);
|
||||
if ( !Q_stricmp( token, shadername ) ) {
|
||||
return p;
|
||||
if(shaderTextHashTable[hash])
|
||||
{
|
||||
for (i = 0; shaderTextHashTable[hash][i]; i++)
|
||||
{
|
||||
p = shaderTextHashTable[hash][i];
|
||||
token = COM_ParseExt(&p, qtrue);
|
||||
|
||||
if(!Q_stricmp(token, shadername))
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2866,7 +2869,6 @@ void R_ShaderList_f (void) {
|
|||
ri.Printf (PRINT_ALL, "------------------\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
ScanAndLoadShaderFiles
|
||||
|
@ -2883,7 +2885,7 @@ static void ScanAndLoadShaderFiles( void )
|
|||
char *p;
|
||||
int numShaderFiles;
|
||||
int i;
|
||||
char *oldp, *token, *hashMem;
|
||||
char *oldp, *token, *hashMem, *textEnd;
|
||||
int shaderTextHashTableSizes[MAX_SHADERTEXT_HASH], hash, size;
|
||||
|
||||
long sum = 0, summand;
|
||||
|
@ -2944,20 +2946,22 @@ static void ScanAndLoadShaderFiles( void )
|
|||
// build single large buffer
|
||||
s_shaderText = ri.Hunk_Alloc( sum + numShaderFiles*2, h_low );
|
||||
s_shaderText[ 0 ] = '\0';
|
||||
|
||||
textEnd = s_shaderText;
|
||||
|
||||
// free in reverse order, so the temp files are all dumped
|
||||
for ( i = numShaderFiles - 1; i >= 0 ; i-- )
|
||||
{
|
||||
if(buffers[i])
|
||||
{
|
||||
p = &s_shaderText[strlen(s_shaderText)];
|
||||
strcat( s_shaderText, buffers[i] );
|
||||
ri.FS_FreeFile( buffers[i] );
|
||||
COM_Compress(p);
|
||||
strcat( s_shaderText, "\n" );
|
||||
}
|
||||
if ( !buffers[i] )
|
||||
continue;
|
||||
|
||||
strcat( textEnd, buffers[i] );
|
||||
strcat( textEnd, "\n" );
|
||||
textEnd += strlen( textEnd );
|
||||
ri.FS_FreeFile( buffers[i] );
|
||||
}
|
||||
|
||||
COM_Compress( s_shaderText );
|
||||
|
||||
// free up memory
|
||||
ri.FS_FreeFileList( shaderFiles );
|
||||
|
||||
|
@ -3065,8 +3069,6 @@ void R_InitShaders( void ) {
|
|||
|
||||
Com_Memset(hashTable, 0, sizeof(hashTable));
|
||||
|
||||
deferLoad = qfalse;
|
||||
|
||||
CreateInternalShaders();
|
||||
|
||||
ScanAndLoadShaderFiles();
|
||||
|
|
|
@ -615,10 +615,10 @@ static void LerpMeshVertexes_altivec(md3Surface_t *surf, float backlerp)
|
|||
{
|
||||
short *oldXyz, *newXyz, *oldNormals, *newNormals;
|
||||
float *outXyz, *outNormal;
|
||||
float oldXyzScale ALIGN(16);
|
||||
float newXyzScale ALIGN(16);
|
||||
float oldNormalScale ALIGN(16);
|
||||
float newNormalScale ALIGN(16);
|
||||
float oldXyzScale QALIGN(16);
|
||||
float newXyzScale QALIGN(16);
|
||||
float oldNormalScale QALIGN(16);
|
||||
float newNormalScale QALIGN(16);
|
||||
int vertNum;
|
||||
unsigned lat, lng;
|
||||
int numVerts;
|
||||
|
@ -879,21 +879,8 @@ static void RB_SurfaceMesh(md3Surface_t *surface) {
|
|||
indexes = surface->numTriangles * 3;
|
||||
Bob = tess.numIndexes;
|
||||
Doug = tess.numVertexes;
|
||||
|
||||
if (backEnd.currentEntity->mirrored) {
|
||||
// Makro - this should be done differently, but since we're copying
|
||||
// indices in a loop anyway (see below), reversing them in the same loop
|
||||
// is practically free...
|
||||
|
||||
for (j = 0 ; j < indexes ; j += 3) {
|
||||
tess.indexes[Bob + j + 0] = Doug + triangles[j + 0];
|
||||
tess.indexes[Bob + j + 1] = Doug + triangles[j + 2];
|
||||
tess.indexes[Bob + j + 2] = Doug + triangles[j + 1];
|
||||
}
|
||||
} else {
|
||||
for (j = 0 ; j < indexes ; j++) {
|
||||
tess.indexes[Bob + j] = Doug + triangles[j];
|
||||
}
|
||||
for (j = 0 ; j < indexes ; j++) {
|
||||
tess.indexes[Bob + j] = Doug + triangles[j];
|
||||
}
|
||||
tess.numIndexes += indexes;
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
// refdef flags
|
||||
#define RDF_NOWORLDMODEL 0x0001 // used for player configuration screen
|
||||
#define RDF_HYPERSPACE 0x0004 // teleportation effect
|
||||
#define RDF_NOFOG 0x0008 // don't apply fog
|
||||
|
||||
typedef struct {
|
||||
vec3_t xyz;
|
||||
|
|
|
@ -99,6 +99,19 @@ void GLimp_Shutdown( void )
|
|||
Com_Memset( &glState, 0, sizeof( glState ) );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
GLimp_Minimize
|
||||
|
||||
Minimize the game so that user is back at the desktop
|
||||
===============
|
||||
*/
|
||||
void GLimp_Minimize(void)
|
||||
{
|
||||
SDL_WM_IconifyWindow();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
GLimp_LogComment
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue