Bug 5094 - Code cleanup, patch by Zack Middleton and DevHC. Fixes unused-but-set gcc warnings

This commit is contained in:
Thilo Schulz 2011-07-29 12:27:00 +00:00
parent 1ea7ab1f42
commit 23f6fd1633
85 changed files with 246 additions and 496 deletions

View file

@ -811,7 +811,7 @@ int AAS_CheckAreaForPossiblePortals(int areanum)
//
Com_Memset(numareafrontfaces, 0, sizeof(numareafrontfaces));
Com_Memset(numareabackfaces, 0, sizeof(numareabackfaces));
numareas = numfrontfaces = numbackfaces = 0;
numfrontfaces = numbackfaces = 0;
numfrontareas = numbackareas = 0;
frontplanenum = backplanenum = -1;
//add any adjacent areas with less presence types

View file

@ -382,18 +382,6 @@ void AAS_Accelerate(vec3_t velocity, float frametime, vec3_t wishdir, float wish
}
} //end of the function AAS_Accelerate
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_AirControl(vec3_t start, vec3_t end, vec3_t velocity, vec3_t cmdmove)
{
vec3_t dir;
VectorSubtract(end, start, dir);
} //end of the function AAS_AirControl
//===========================================================================
// applies ground friction to the given velocity
//
// Parameter: -
@ -518,7 +506,8 @@ int AAS_ClientMovementPrediction(struct aas_clientmove_s *move,
float phys_maxstep, phys_maxsteepness, phys_jumpvel, friction;
float gravity, delta, maxvel, wishspeed, accelerate;
//float velchange, newvel;
int n, i, j, pc, step, swimming, ax, crouch, event, jump_frame, areanum;
//int ax;
int n, i, j, pc, step, swimming, crouch, event, jump_frame, areanum;
int areas[20], numareas;
vec3_t points[20];
vec3_t org, end, feet, start, stepend, lastorg, wishdir;
@ -574,7 +563,7 @@ int AAS_ClientMovementPrediction(struct aas_clientmove_s *move,
//apply command movement
if (n < cmdframes)
{
ax = 0;
//ax = 0;
maxvel = phys_maxwalkvelocity;
accelerate = phys_airaccelerate;
VectorCopy(cmdmove, wishdir);
@ -598,13 +587,13 @@ int AAS_ClientMovementPrediction(struct aas_clientmove_s *move,
{
accelerate = phys_walkaccelerate;
} //end else
ax = 2;
//ax = 2;
} //end if
if (swimming)
{
maxvel = phys_maxswimvelocity;
accelerate = phys_swimaccelerate;
ax = 3;
//ax = 3;
} //end if
else
{

View file

@ -289,7 +289,7 @@ int AAS_GetJumpPadInfo(int ent, vec3_t areastart, vec3_t absmins, vec3_t absmaxs
//===========================================================================
int AAS_BestReachableFromJumpPadArea(vec3_t origin, vec3_t mins, vec3_t maxs)
{
int area2num, ent, bot_visualizejumppads, bestareanum;
int ent, bot_visualizejumppads, bestareanum;
float volume, bestareavolume;
vec3_t areastart, cmdmove, bboxmins, bboxmaxs;
vec3_t absmins, absmaxs, velocity;
@ -327,7 +327,6 @@ int AAS_BestReachableFromJumpPadArea(vec3_t origin, vec3_t mins, vec3_t maxs)
//
VectorSet(cmdmove, 0, 0, 0);
Com_Memset(&move, 0, sizeof(aas_clientmove_t));
area2num = 0;
AAS_ClientMovementHitBBox(&move, -1, areastart, PRESENCE_NORMAL, qfalse,
velocity, cmdmove, 0, 30, 0.1f, bboxmins, bboxmaxs, bot_visualizejumppads);
if (move.frames < 30)
@ -837,7 +836,6 @@ int AAS_Reachability_Swim(int area1num, int area2num)
{
int i, j, face1num, face2num, side1;
aas_area_t *area1, *area2;
aas_areasettings_t *areasettings;
aas_lreachability_t *lreach;
aas_face_t *face1;
aas_plane_t *plane;
@ -875,7 +873,6 @@ int AAS_Reachability_Swim(int area1num, int area2num)
{
//
face1 = &aasworld.faces[face1num];
areasettings = &aasworld.areasettings[area1num];
//create a new reachability link
lreach = AAS_AllocReachability();
if (!lreach) return qfalse;
@ -1062,7 +1059,8 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(int area1num, int area2
int ground_bestarea2groundedgenum, ground_foundreach;
int water_bestarea2groundedgenum, water_foundreach;
int side1, area1swim, faceside1, groundface1num;
float dist, dist1, dist2, diff, invgravitydot, ortdot;
float dist, dist1, dist2, diff, ortdot;
//float invgravitydot;
float x1, x2, x3, x4, y1, y2, y3, y4, tmp, y;
float length, ground_bestlength, water_bestlength, ground_bestdist, water_bestdist;
vec3_t v1, v2, v3, v4, tmpv, p1area1, p1area2, p2area1, p2area2;
@ -1073,7 +1071,7 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(int area1num, int area2
vec3_t testpoint;
aas_plane_t *plane;
aas_area_t *area1, *area2;
aas_face_t *groundface1, *groundface2, *ground_bestface1, *water_bestface1;
aas_face_t *groundface1, *groundface2;
aas_edge_t *edge1, *edge2;
aas_lreachability_t *lreach;
aas_trace_t trace;
@ -1172,7 +1170,7 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(int area1num, int area2
//edges if they overlap in the direction orthogonal to
//the gravity direction
CrossProduct(invgravity, normal, ort);
invgravitydot = DotProduct(invgravity, invgravity);
//invgravitydot = DotProduct(invgravity, invgravity);
ortdot = DotProduct(ort, ort);
//projection into the step plane
//NOTE: since gravity is vertical this is just the z coordinate
@ -1302,7 +1300,6 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(int area1num, int area2
ground_bestlength = length;
ground_foundreach = qtrue;
ground_bestarea2groundedgenum = edge1num;
ground_bestface1 = groundface1;
//best point towards area1
VectorCopy(start, ground_beststart);
//normal is pointing into area2
@ -1323,7 +1320,6 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(int area1num, int area2
water_bestlength = length;
water_foundreach = qtrue;
water_bestarea2groundedgenum = edge1num;
water_bestface1 = groundface1;
//best point towards area1
VectorCopy(start, water_beststart);
//normal is pointing into area2
@ -2852,9 +2848,9 @@ void AAS_Reachability_Teleport(void)
botimport.Print(PRT_ERROR, "teleporter destination (%s) in solid\n", target);
continue;
} //end if
/*
area2num = AAS_PointAreaNum(trace.endpos);
//
/*
if (!AAS_AreaTeleporter(area2num) &&
!AAS_AreaJumpPad(area2num) &&
!AAS_AreaGrounded(area2num))
@ -3396,7 +3392,6 @@ void AAS_Reachability_FuncBobbing(void)
//
for (i = 0; i < 2; i++)
{
firststartreach = firstendreach = NULL;
//
if (i == 0)
{
@ -3492,7 +3487,8 @@ void AAS_Reachability_JumpPad(void)
int face2num, i, ret, area2num, visualize, ent, bot_visualizejumppads;
//int modelnum, ent2;
//float dist, time, height, gravity, forward;
float speed, zvel, hordist;
float speed, zvel;
//float hordist;
aas_face_t *face2;
aas_area_t *area2;
aas_lreachability_t *lreach;
@ -3714,7 +3710,7 @@ void AAS_Reachability_JumpPad(void)
//direction towards the face center
VectorSubtract(facecenter, areastart, dir);
dir[2] = 0;
hordist = VectorNormalize(dir);
//hordist = VectorNormalize(dir);
//if (hordist < 1.6 * facecenter[2] - areastart[2])
{
//get command movement
@ -3997,7 +3993,8 @@ void AAS_SetWeaponJumpAreaFlags(void)
int AAS_Reachability_WeaponJump(int area1num, int area2num)
{
int face2num, i, n, ret, visualize;
float speed, zvel, hordist;
float speed, zvel;
//float hordist;
aas_face_t *face2;
aas_area_t *area1, *area2;
aas_lreachability_t *lreach;
@ -4057,7 +4054,7 @@ int AAS_Reachability_WeaponJump(int area1num, int area2num)
//direction towards the face center
VectorSubtract(facecenter, areastart, dir);
dir[2] = 0;
hordist = VectorNormalize(dir);
//hordist = VectorNormalize(dir);
//if (hordist < 1.6 * (facecenter[2] - areastart[2]))
{
//get command movement

View file

@ -506,9 +506,11 @@ void AAS_CalculateAreaTravelTimes(void)
aas_reversedlink_t *revlink;
aas_reachability_t *reach;
aas_areasettings_t *settings;
#ifdef DEBUG
int starttime;
starttime = Sys_MilliSeconds();
#endif
//if there are still area travel times, free the memory
if (aasworld.areatraveltimes) FreeMemory(aasworld.areatraveltimes);
//get the total size of all the area travel times
@ -887,7 +889,8 @@ void AAS_InitRoutingUpdate(void)
//===========================================================================
void AAS_CreateAllRoutingCache(void)
{
int i, j, t;
int i, j;
//int t;
aasworld.initialized = qtrue;
botimport.Print(PRT_MESSAGE, "AAS_CreateAllRoutingCache\n");
@ -898,7 +901,8 @@ void AAS_CreateAllRoutingCache(void)
{
if (i == j) continue;
if (!AAS_AreaReachability(j)) continue;
t = AAS_AreaTravelTimeToGoalArea(i, aasworld.areas[i].center, j, TFL_DEFAULT);
AAS_AreaTravelTimeToGoalArea(i, aasworld.areas[i].center, j, TFL_DEFAULT);
//t = AAS_AreaTravelTimeToGoalArea(i, aasworld.areas[i].center, j, TFL_DEFAULT);
//Log_Write("traveltime from %d to %d is %d", i, j, t);
} //end for
} //end for

View file

@ -844,7 +844,6 @@ void BotReplaceReplySynonyms(char *string, unsigned long int context)
if (!(syn->context & context)) continue;
for (synonym = syn->firstsynonym->next; synonym; synonym = synonym->next)
{
str2 = synonym->string;
//if the synonym is not at the front of the string continue
str2 = StringContainsWord(str1, synonym->string, qfalse);
if (!str2 || str2 != str1) continue;
@ -2939,7 +2938,6 @@ int BotAllocChatState(void)
//========================================================================
void BotFreeChatState(int handle)
{
bot_chatstate_t *cs;
bot_consolemessage_t m;
int h;
@ -2953,7 +2951,6 @@ void BotFreeChatState(int handle)
botimport.Print(PRT_FATAL, "invalid chat state %d\n", handle);
return;
} //end if
cs = botchatstates[handle];
if (LibVarGetValue("bot_reloadcharacters"))
{
BotFreeChatFile(handle);

View file

@ -51,7 +51,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//===========================================================================
int GeneticSelection(int numranks, float *rankings)
{
float sum, select;
float sum;
int i, index;
sum = 0;
@ -64,7 +64,7 @@ int GeneticSelection(int numranks, float *rankings)
{
//select a bot where the ones with the higest rankings have
//the highest chance of being selected
select = random() * sum;
//sum *= random();
for (i = 0; i < numranks; i++)
{
if (rankings[i] < 0) continue;

View file

@ -238,9 +238,9 @@ void BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child)
//===========================================================================
void BotSaveGoalFuzzyLogic(int goalstate, char *filename)
{
bot_goalstate_t *gs;
//bot_goalstate_t *gs;
gs = BotGoalStateFromHandle(goalstate);
//gs = BotGoalStateFromHandle(goalstate);
//WriteWeightConfig(filename, gs->itemweightconfig);
} //end of the function BotSaveGoalFuzzyLogic

View file

@ -848,7 +848,6 @@ int BotMovementViewTarget(int movestate, bot_goal_t *goal, int travelflags, floa
ms = BotMoveStateFromHandle(movestate);
if (!ms) return qfalse;
reachnum = 0;
//if the bot has no goal or no last reachability
if (!ms->lastreachnum || !goal) return qfalse;
@ -997,12 +996,13 @@ void MoverBottomCenter(aas_reachability_t *reach, vec3_t bottomcenter)
//===========================================================================
float BotGapDistance(vec3_t origin, vec3_t hordir, int entnum)
{
float dist, startz;
int dist;
float startz;
vec3_t start, end;
aas_trace_t trace;
//do gap checking
startz = origin[2];
//startz = origin[2];
//this enables walking down stairs more fluidly
{
VectorCopy(origin, start);
@ -1030,7 +1030,7 @@ float BotGapDistance(vec3_t origin, vec3_t hordir, int entnum)
end[2] -= 20;
if (AAS_PointContents(end) & CONTENTS_WATER) break;
//if a gap is found slow down
//botimport.Print(PRT_MESSAGE, "gap at %f\n", dist);
//botimport.Print(PRT_MESSAGE, "gap at %i\n", dist);
return dist;
} //end if
startz = trace.endpos[2];
@ -1480,7 +1480,6 @@ bot_moveresult_t BotTravel_BarrierJump(bot_movestate_t *ms, aas_reachability_t *
//===========================================================================
bot_moveresult_t BotFinishTravel_BarrierJump(bot_movestate_t *ms, aas_reachability_t *reach)
{
float dist;
vec3_t hordir;
bot_moveresult_t_cleared( result );
@ -1490,7 +1489,6 @@ bot_moveresult_t BotFinishTravel_BarrierJump(bot_movestate_t *ms, aas_reachabili
hordir[0] = reach->end[0] - ms->origin[0];
hordir[1] = reach->end[1] - ms->origin[1];
hordir[2] = 0;
dist = VectorNormalize(hordir);
//
BotCheckBlocked(ms, hordir, qtrue, &result);
//
@ -1567,7 +1565,6 @@ bot_moveresult_t BotTravel_WaterJump(bot_movestate_t *ms, aas_reachability_t *re
bot_moveresult_t BotFinishTravel_WaterJump(bot_movestate_t *ms, aas_reachability_t *reach)
{
vec3_t dir, pnt;
float dist;
bot_moveresult_t_cleared( result );
//botimport.Print(PRT_MESSAGE, "BotFinishTravel_WaterJump\n");
@ -1583,7 +1580,6 @@ bot_moveresult_t BotFinishTravel_WaterJump(bot_movestate_t *ms, aas_reachability
dir[0] += crandom() * 10;
dir[1] += crandom() * 10;
dir[2] += 70 + crandom() * 10;
dist = VectorNormalize(dir);
//elemantary actions
EA_Move(ms->client, dir, 400);
//set the ideal view angles
@ -1721,7 +1717,6 @@ bot_moveresult_t BotFinishTravel_WalkOffLedge(bot_movestate_t *ms, aas_reachabil
VectorCopy(dir, hordir);
hordir[2] = 0;
//
dist = VectorNormalize(hordir);
speed = 400;
} //end if
//
@ -1788,6 +1783,7 @@ bot_moveresult_t BotTravel_Jump(bot_movestate_t *ms, aas_reachability_t *reach)
bot_moveresult_t BotTravel_Jump(bot_movestate_t *ms, aas_reachability_t *reach)
{
vec3_t hordir, dir1, dir2, mins, maxs, start, end;
int gapdist;
float dist1, dist2, speed;
bot_moveresult_t_cleared( result );
bsp_trace_t trace;
@ -1808,13 +1804,13 @@ bot_moveresult_t BotTravel_Jump(bot_movestate_t *ms, aas_reachability_t *reach)
trace = AAS_Trace(start, mins, maxs, end, ms->entitynum, MASK_PLAYERSOLID);
if (trace.startsolid) VectorCopy(start, trace.endpos);
//check for a gap
for (dist1 = 0; dist1 < 80; dist1 += 10)
for (gapdist = 0; gapdist < 80; gapdist += 10)
{
VectorMA(start, dist1+10, hordir, end);
VectorMA(start, gapdist+10, hordir, end);
end[2] += 1;
if (AAS_PointAreaNum(end) != ms->reachareanum) break;
} //end for
if (dist1 < 80) VectorMA(reach->start, dist1, hordir, trace.endpos);
if (gapdist < 80) VectorMA(reach->start, gapdist, hordir, trace.endpos);
// dist1 = BotGapDistance(start, hordir, ms->entitynum);
// if (dist1 && dist1 <= trace.fraction * 80) VectorMA(reach->start, dist1-20, hordir, trace.endpos);
//
@ -1860,6 +1856,7 @@ bot_moveresult_t BotTravel_Jump(bot_movestate_t *ms, aas_reachability_t *reach)
{
vec3_t hordir, dir1, dir2, start, end, runstart;
// vec3_t runstart, dir1, dir2, hordir;
int gapdist;
float dist1, dist2, speed;
bot_moveresult_t_cleared( result );
@ -1875,13 +1872,13 @@ bot_moveresult_t BotTravel_Jump(bot_movestate_t *ms, aas_reachability_t *reach)
start[2] += 1;
VectorMA(reach->start, 80, hordir, runstart);
//check for a gap
for (dist1 = 0; dist1 < 80; dist1 += 10)
for (gapdist = 0; gapdist < 80; gapdist += 10)
{
VectorMA(start, dist1+10, hordir, end);
VectorMA(start, gapdist+10, hordir, end);
end[2] += 1;
if (AAS_PointAreaNum(end) != ms->reachareanum) break;
} //end for
if (dist1 < 80) VectorMA(reach->start, dist1, hordir, runstart);
if (gapdist < 80) VectorMA(reach->start, gapdist, hordir, runstart);
//
VectorSubtract(ms->origin, reach->start, dir1);
dir1[2] = 0;
@ -2867,7 +2864,6 @@ bot_moveresult_t BotFinishTravel_WeaponJump(bot_movestate_t *ms, aas_reachabilit
//===========================================================================
bot_moveresult_t BotTravel_JumpPad(bot_movestate_t *ms, aas_reachability_t *reach)
{
float dist, speed;
vec3_t hordir;
bot_moveresult_t_cleared( result );
@ -2875,12 +2871,10 @@ bot_moveresult_t BotTravel_JumpPad(bot_movestate_t *ms, aas_reachability_t *reac
hordir[0] = reach->start[0] - ms->origin[0];
hordir[1] = reach->start[1] - ms->origin[1];
hordir[2] = 0;
dist = VectorNormalize(hordir);
//
BotCheckBlocked(ms, hordir, qtrue, &result);
speed = 400;
//elemantary action move in direction
EA_Move(ms->client, hordir, speed);
EA_Move(ms->client, hordir, 400);
VectorCopy(hordir, result.movedir);
//
return result;

View file

@ -1698,7 +1698,6 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval
int questmarkintvalue = 0;
float questmarkfloatvalue = 0;
int gotquestmarkvalue = qfalse;
int lastoperatortype = 0;
//
operator_t operator_heap[MAX_OPERATORS];
int numoperators = 0;
@ -2087,7 +2086,6 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval
else Log_Write("result value = %f", v1->floatvalue);
#endif //DEBUG_EVAL
if (error) break;
lastoperatortype = o->operator;
//if not an operator with arity 1
if (o->operator != P_LOGIC_NOT
&& o->operator != P_BIN_NOT)