Change Hunk_* and zone alloc functions to use size_t instead of int.

Replace READ_COMPRESSED_SAVEGAMES and WRITE_COMPRESSED_SAVEGAMES macros with COMPRESSED_SAVEGAMES.
Misc changes and some cleanup to game code.
This commit is contained in:
Knightmare66 2020-04-20 03:17:27 -04:00
parent ce580d2c10
commit 9272d5ea85
43 changed files with 1501 additions and 1222 deletions

View file

@ -80,32 +80,32 @@ qboolean debug_mode=false;
///////////////////////////////////////////////////////////////////////
// Special command processor
///////////////////////////////////////////////////////////////////////
qboolean ACECM_Commands(edict_t *ent)
qboolean ACECM_Commands (edict_t *ent)
{
char *cmd;
int node;
cmd = gi.argv(0);
if(Q_stricmp (cmd, "addnode") == 0 && debug_mode)
if (Q_stricmp (cmd, "addnode") == 0 && debug_mode)
ent->last_node = ACEND_AddNode(ent,atoi(gi.argv(1)));
else if(Q_stricmp (cmd, "removelink") == 0 && debug_mode)
else if (Q_stricmp (cmd, "removelink") == 0 && debug_mode)
ACEND_RemoveNodeEdge(ent,atoi(gi.argv(1)), atoi(gi.argv(2)));
else if(Q_stricmp (cmd, "addlink") == 0 && debug_mode)
else if (Q_stricmp (cmd, "addlink") == 0 && debug_mode)
ACEND_UpdateNodeEdge(atoi(gi.argv(1)), atoi(gi.argv(2)));
else if(Q_stricmp (cmd, "showpath") == 0 && debug_mode)
else if (Q_stricmp (cmd, "showpath") == 0 && debug_mode)
ACEND_ShowPath(ent,atoi(gi.argv(1)));
else if(Q_stricmp (cmd, "findnode") == 0 && debug_mode)
else if (Q_stricmp (cmd, "findnode") == 0 && debug_mode)
{
node = ACEND_FindClosestReachableNode(ent,NODE_DENSITY, NODE_ALL);
safe_bprintf(PRINT_MEDIUM,"node: %d type: %d x: %f y: %f z %f\n",node,nodes[node].type,nodes[node].origin[0],nodes[node].origin[1],nodes[node].origin[2]);
}
else if(Q_stricmp (cmd, "movenode") == 0 && debug_mode)
else if (Q_stricmp (cmd, "movenode") == 0 && debug_mode)
{
node = atoi(gi.argv(1));
nodes[node].origin[0] = atof(gi.argv(2));
@ -124,7 +124,7 @@ qboolean ACECM_Commands(edict_t *ent)
///////////////////////////////////////////////////////////////////////
// Called when the level changes, store maps and bots (disconnected)
///////////////////////////////////////////////////////////////////////
void ACECM_Store()
void ACECM_Store (void)
{
ACEND_SaveNodes();
}
@ -145,7 +145,7 @@ void ACECM_Store()
///////////////////////////////////////////////////////////////////////
// Debug print, could add a "logging" feature to print to a file
///////////////////////////////////////////////////////////////////////
void debug_printf(char *fmt, ...)
void debug_printf (char *fmt, ...)
{
int i;
char bigbuffer[0x10000];
@ -158,7 +158,8 @@ void debug_printf(char *fmt, ...)
va_end (argptr);
if (dedicated->value)
gi.cprintf(NULL, PRINT_MEDIUM, bigbuffer);
// gi.cprintf(NULL, PRINT_MEDIUM, bigbuffer);
gi.cprintf(NULL, PRINT_MEDIUM, "%s", bigbuffer);
for (i=0 ; i<maxclients->value ; i++)
{
@ -166,8 +167,8 @@ void debug_printf(char *fmt, ...)
if (!cl_ent->inuse || cl_ent->is_bot)
continue;
// gi.cprintf(cl_ent, PRINT_MEDIUM, bigbuffer);
gi.cprintf(cl_ent, PRINT_MEDIUM, "%s", bigbuffer);
//gi.cprintf(cl_ent, PRINT_MEDIUM, bigbuffer);
}
}
@ -188,8 +189,8 @@ void safe_cprintf (edict_t *ent, int printlevel, char *fmt, ...)
len = Q_vsnprintf (bigbuffer, sizeof(bigbuffer), fmt, argptr);
va_end (argptr);
// gi.cprintf(ent, printlevel, bigbuffer);
gi.cprintf(ent, printlevel, "%s", bigbuffer);
//gi.cprintf(ent, printlevel, bigbuffer);
}
///////////////////////////////////////////////////////////////////////
@ -208,8 +209,8 @@ void safe_centerprintf (edict_t *ent, char *fmt, ...)
len = Q_vsnprintf (bigbuffer, sizeof(bigbuffer), fmt, argptr);
va_end (argptr);
// gi.centerprintf(ent, bigbuffer);
gi.centerprintf(ent, "%s", bigbuffer);
//gi.centerprintf(ent, bigbuffer);
}
///////////////////////////////////////////////////////////////////////
@ -228,7 +229,8 @@ void safe_bprintf (int printlevel, char *fmt, ...)
va_end (argptr);
if (dedicated->value)
gi.cprintf(NULL, printlevel, bigbuffer);
// gi.cprintf(NULL, printlevel, bigbuffer);
gi.cprintf(NULL, printlevel, "%s", bigbuffer);
for (i=0 ; i<maxclients->value ; i++)
{
@ -236,8 +238,7 @@ void safe_bprintf (int printlevel, char *fmt, ...)
if (!cl_ent->inuse || cl_ent->is_bot)
continue;
// gi.cprintf(cl_ent, printlevel, bigbuffer);
gi.cprintf(cl_ent, printlevel, "%s", bigbuffer);
//gi.cprintf(cl_ent, printlevel, bigbuffer);
}
}

View file

@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
if match_length is greater than this */
#define NIL N /* index for root of binary search trees */
unsigned long int
unsigned /*long*/ int
textsize = 0, /* text size counter */
codesize = 0, /* code size counter */
printcount = 0; /* counter for reporting progress every 1K bytes */

View file

@ -100,7 +100,7 @@ short int path_table[MAX_NODES][MAX_NODES];
///////////////////////////////////////////////////////////////////////
// Determin cost of moving from one node to another
///////////////////////////////////////////////////////////////////////
int ACEND_FindCost(int from, int to)
int ACEND_FindCost (int from, int to)
{
int curnode;
int cost=1; // Shortest possible is 1
@ -113,10 +113,10 @@ int ACEND_FindCost(int from, int to)
curnode = path_table[from][to];
// Find a path (linear time, very fast)
while(curnode != to)
while (curnode != to)
{
curnode = path_table[curnode][to];
if(curnode == INVALID) // something has corrupted the path abort
if (curnode == INVALID) // something has corrupted the path abort
return INVALID;
cost++;
}
@ -130,7 +130,7 @@ int ACEND_FindCost(int from, int to)
// Faster than looking for the closest node, but not very
// accurate.
///////////////////////////////////////////////////////////////////////
int ACEND_FindCloseReachableNode(edict_t *self, int range, int type)
int ACEND_FindCloseReachableNode (edict_t *self, int range, int type)
{
vec3_t v;
int i;
@ -139,22 +139,22 @@ int ACEND_FindCloseReachableNode(edict_t *self, int range, int type)
range *= range;
for(i=0;i<numnodes;i++)
for (i=0;i<numnodes;i++)
{
if(type == NODE_ALL || type == nodes[i].type) // check node type
if (type == NODE_ALL || type == nodes[i].type) // check node type
{
VectorSubtract(nodes[i].origin,self->s.origin,v); // subtract first
dist = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
if(dist < range) // square range instead of sqrt
if (dist < range) // square range instead of sqrt
{
// make sure it is visible
//trace = gi.trace (self->s.origin, vec3_origin, vec3_origin, nodes[i].origin, self, MASK_OPAQUE);
tr = gi.trace (self->s.origin, self->mins, self->maxs, nodes[i].origin, self, MASK_OPAQUE);
if(tr.fraction == 1.0)
if (tr.fraction == 1.0)
return i;
}
}
@ -166,7 +166,7 @@ int ACEND_FindCloseReachableNode(edict_t *self, int range, int type)
///////////////////////////////////////////////////////////////////////
// Find the closest node to the player within a certain range
///////////////////////////////////////////////////////////////////////
int ACEND_FindClosestReachableNode(edict_t *self, int range, int type)
int ACEND_FindClosestReachableNode (edict_t *self, int range, int type)
{
int i;
float closest = 99999;
@ -181,7 +181,7 @@ int ACEND_FindClosestReachableNode(edict_t *self, int range, int type)
VectorCopy(self->maxs,maxs);
// For Ladders, do not worry so much about reachability
if(type == NODE_LADDER)
if (type == NODE_LADDER)
{
VectorCopy(vec3_origin,maxs);
VectorCopy(vec3_origin,mins);
@ -191,19 +191,19 @@ int ACEND_FindClosestReachableNode(edict_t *self, int range, int type)
rng = (float)(range * range); // square range for distance comparison (eliminate sqrt)
for(i=0;i<numnodes;i++)
for (i=0;i<numnodes;i++)
{
if(type == NODE_ALL || type == nodes[i].type) // check node type
if (type == NODE_ALL || type == nodes[i].type) // check node type
{
VectorSubtract(nodes[i].origin, self->s.origin,v); // subtract first
dist = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
if(dist < closest && dist < rng)
if (dist < closest && dist < rng)
{
// make sure it is visible
tr = gi.trace (self->s.origin, mins, maxs, nodes[i].origin, self, MASK_OPAQUE);
if(tr.fraction == 1.0)
if (tr.fraction == 1.0)
{
node = i;
closest = dist;
@ -222,17 +222,17 @@ int ACEND_FindClosestReachableNode(edict_t *self, int range, int type)
///////////////////////////////////////////////////////////////////////
// Set up the goal
///////////////////////////////////////////////////////////////////////
void ACEND_SetGoal(edict_t *self, int goal_node)
void ACEND_SetGoal (edict_t *self, int goal_node)
{
int node;
self->goal_node = goal_node;
node = ACEND_FindClosestReachableNode(self, NODE_DENSITY*3, NODE_ALL);
if(node == -1)
if (node == -1)
return;
if(debug_mode)
if (debug_mode)
debug_printf("%s new start node selected %d\n",self->client->pers.netname,node);
@ -246,7 +246,7 @@ void ACEND_SetGoal(edict_t *self, int goal_node)
// Move closer to goal by pointing the bot to the next node
// that is closer to the goal
///////////////////////////////////////////////////////////////////////
qboolean ACEND_FollowPath(edict_t *self)
qboolean ACEND_FollowPath (edict_t *self)
{
vec3_t v;
@ -258,9 +258,9 @@ qboolean ACEND_FollowPath(edict_t *self)
//////////////////////////////////////////
// Try again?
if(self->node_timeout ++ > 30)
if (self->node_timeout ++ > 30)
{
if(self->tries++ > 3)
if (self->tries++ > 3)
return false;
else
ACEND_SetGoal(self,self->goal_node);
@ -269,14 +269,14 @@ qboolean ACEND_FollowPath(edict_t *self)
// Are we there yet?
VectorSubtract(self->s.origin,nodes[self->next_node].origin,v);
if(VectorLength(v) < 32)
if (VectorLength(v) < 32)
{
// reset timeout
self->node_timeout = 0;
if(self->next_node == self->goal_node)
if (self->next_node == self->goal_node)
{
if(debug_mode)
if (debug_mode)
debug_printf("%s reached goal!\n",self->client->pers.netname);
ACEAI_PickLongRangeGoal(self); // Pick a new goal
@ -288,7 +288,7 @@ qboolean ACEND_FollowPath(edict_t *self)
}
}
if(self->current_node == -1 || self->next_node ==-1)
if (self->current_node == -1 || self->next_node ==-1)
return false;
// Set bot's movement vector
@ -305,19 +305,19 @@ qboolean ACEND_FollowPath(edict_t *self)
///////////////////////////////////////////////////////////////////////
// Capture when the grappling hook has been fired for mapping purposes.
///////////////////////////////////////////////////////////////////////
void ACEND_GrapFired(edict_t *self)
void ACEND_GrapFired (edict_t *self)
{
int closest_node;
if(!self->owner)
if (!self->owner)
return; // should not be here
// Check to see if the grapple is in pull mode
if(self->owner->client->ctf_grapplestate == CTF_GRAPPLE_STATE_PULL)
if (self->owner->client->ctf_grapplestate == CTF_GRAPPLE_STATE_PULL)
{
// Look for the closest node of type grapple
closest_node = ACEND_FindClosestReachableNode(self,NODE_DENSITY,NODE_GRAPPLE);
if(closest_node == -1 ) // we need to drop a node
if (closest_node == -1 ) // we need to drop a node
{
closest_node = ACEND_AddNode(self,NODE_GRAPPLE);
@ -335,7 +335,7 @@ void ACEND_GrapFired(edict_t *self)
///////////////////////////////////////////////////////////////////////
// Check for adding ladder nodes
///////////////////////////////////////////////////////////////////////
qboolean ACEND_CheckForLadder(edict_t *self)
qboolean ACEND_CheckForLadder (edict_t *self)
{
int closest_node;
@ -345,7 +345,7 @@ qboolean ACEND_CheckForLadder(edict_t *self)
//debug_printf("contents: %x\n",tr.contents);
closest_node = ACEND_FindClosestReachableNode(self,NODE_DENSITY,NODE_LADDER);
if(closest_node == -1)
if (closest_node == -1)
{
closest_node = ACEND_AddNode(self,NODE_LADDER);
@ -369,29 +369,29 @@ qboolean ACEND_CheckForLadder(edict_t *self)
// This routine is called to hook in the pathing code and sets
// the current node if valid.
///////////////////////////////////////////////////////////////////////
void ACEND_PathMap(edict_t *self)
void ACEND_PathMap (edict_t *self)
{
int closest_node;
static float last_update=0; // start off low
vec3_t v;
if(level.time < last_update)
if (level.time < last_update)
return;
last_update = level.time + 0.15; // slow down updates a bit
// Special node drawing code for debugging
if(show_path_to != -1)
if (show_path_to != -1)
ACEND_DrawPath();
////////////////////////////////////////////////////////
// Special check for ladder nodes
///////////////////////////////////////////////////////
if(ACEND_CheckForLadder(self)) // check for ladder nodes
if (ACEND_CheckForLadder(self)) // check for ladder nodes
return;
// Not on ground, and not in the water, so bail
if(!self->groundentity && !self->waterlevel)
if (!self->groundentity && !self->waterlevel)
return;
////////////////////////////////////////////////////////
@ -399,22 +399,22 @@ void ACEND_PathMap(edict_t *self)
////////////////////////////////////////////////////////
VectorCopy(self->s.origin,v);
v[2] -= 18;
if(gi.pointcontents(v) & (CONTENTS_LAVA|CONTENTS_SLIME))
if (gi.pointcontents(v) & (CONTENTS_LAVA|CONTENTS_SLIME))
return; // no nodes in slime
////////////////////////////////////////////////////////
// Jumping
///////////////////////////////////////////////////////
if(self->is_jumping)
if (self->is_jumping)
{
// See if there is a closeby jump landing node (prevent adding too many)
closest_node = ACEND_FindClosestReachableNode(self, 64, NODE_JUMP);
if(closest_node == INVALID)
if (closest_node == INVALID)
closest_node = ACEND_AddNode(self,NODE_JUMP);
// Now add link
if(self->last_node != -1)
if (self->last_node != -1)
ACEND_UpdateNodeEdge(self->last_node, closest_node);
self->is_jumping = false;
@ -425,7 +425,7 @@ void ACEND_PathMap(edict_t *self)
// Grapple
// Do not add nodes during grapple, added elsewhere manually
////////////////////////////////////////////////////////////
if(ctf->value && self->client->ctf_grapplestate == CTF_GRAPPLE_STATE_PULL)
if (ctf->value && self->client->ctf_grapplestate == CTF_GRAPPLE_STATE_PULL)
return;
// Iterate through all nodes to make sure far enough apart
@ -434,13 +434,13 @@ void ACEND_PathMap(edict_t *self)
////////////////////////////////////////////////////////
// Special Check for Platforms
////////////////////////////////////////////////////////
if(self->groundentity && self->groundentity->use == Use_Plat)
if (self->groundentity && self->groundentity->use == Use_Plat)
{
if(closest_node == INVALID)
if (closest_node == INVALID)
return; // Do not want to do anything here.
// Here we want to add links
if(closest_node != self->last_node && self->last_node != INVALID)
if (closest_node != self->last_node && self->last_node != INVALID)
ACEND_UpdateNodeEdge(self->last_node,closest_node);
self->last_node = closest_node; // set visited to last
@ -450,20 +450,20 @@ void ACEND_PathMap(edict_t *self)
////////////////////////////////////////////////////////
// Add Nodes as needed
////////////////////////////////////////////////////////
if(closest_node == INVALID)
if (closest_node == INVALID)
{
// Add nodes in the water as needed
if(self->waterlevel)
if (self->waterlevel)
closest_node = ACEND_AddNode(self,NODE_WATER);
else
closest_node = ACEND_AddNode(self,NODE_MOVE);
// Now add link
if(self->last_node != -1)
if (self->last_node != -1)
ACEND_UpdateNodeEdge(self->last_node, closest_node);
}
else if(closest_node != self->last_node && self->last_node != INVALID)
else if (closest_node != self->last_node && self->last_node != INVALID)
ACEND_UpdateNodeEdge(self->last_node,closest_node);
self->last_node = closest_node; // set visited to last
@ -473,7 +473,7 @@ void ACEND_PathMap(edict_t *self)
///////////////////////////////////////////////////////////////////////
// Init node array (set all to INVALID)
///////////////////////////////////////////////////////////////////////
void ACEND_InitNodes(void)
void ACEND_InitNodes (void)
{
numnodes = 1;
numitemnodes = 1;
@ -485,7 +485,7 @@ void ACEND_InitNodes(void)
///////////////////////////////////////////////////////////////////////
// Show the node for debugging (utility function)
///////////////////////////////////////////////////////////////////////
void ACEND_ShowNode(int node)
void ACEND_ShowNode (int node)
{
edict_t *ent;
@ -497,7 +497,7 @@ void ACEND_ShowNode(int node)
ent->movetype = MOVETYPE_NONE;
ent->solid = SOLID_NOT;
if(nodes[node].type == NODE_MOVE)
if (nodes[node].type == NODE_MOVE)
ent->s.renderfx = RF_SHELL_BLUE;
else if (nodes[node].type == NODE_WATER)
ent->s.renderfx = RF_SHELL_RED;
@ -518,7 +518,7 @@ void ACEND_ShowNode(int node)
///////////////////////////////////////////////////////////////////////
// Draws the current path (utility function)
///////////////////////////////////////////////////////////////////////
void ACEND_DrawPath()
void ACEND_DrawPath (void)
{
int current_node, goal_node, next_node;
@ -528,7 +528,7 @@ void ACEND_DrawPath()
next_node = path_table[current_node][goal_node];
// Now set up and display the path
while(current_node != goal_node && current_node != -1)
while (current_node != goal_node && current_node != -1)
{
gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_BFG_LASER);
@ -544,7 +544,7 @@ void ACEND_DrawPath()
// Turns on showing of the path, set goal to -1 to
// shut off. (utility function)
///////////////////////////////////////////////////////////////////////
void ACEND_ShowPath(edict_t *self, int goal_node)
void ACEND_ShowPath (edict_t *self, int goal_node)
{
show_path_from = ACEND_FindClosestReachableNode(self, NODE_DENSITY, NODE_ALL);
show_path_to = goal_node;
@ -553,7 +553,7 @@ void ACEND_ShowPath(edict_t *self, int goal_node)
///////////////////////////////////////////////////////////////////////
// Add a node of type ?
///////////////////////////////////////////////////////////////////////
int ACEND_AddNode(edict_t *self, int type)
int ACEND_AddNode (edict_t *self, int type)
{
vec3_t v1,v2;
@ -570,24 +570,24 @@ int ACEND_AddNode(edict_t *self, int type)
/////////////////////////////////////////////////////
// ITEMS
// Move the z location up just a bit.
if(type == NODE_ITEM)
if (type == NODE_ITEM)
{
nodes[numnodes].origin[2] += 16;
numitemnodes++;
}
// Teleporters
if(type == NODE_TELEPORTER)
if (type == NODE_TELEPORTER)
{
// Up 32
nodes[numnodes].origin[2] += 32;
}
if(type == NODE_LADDER)
if (type == NODE_LADDER)
{
nodes[numnodes].type = NODE_LADDER;
if(debug_mode)
if (debug_mode)
{
debug_printf("Node added %d type: Ladder\n",numnodes);
ACEND_ShowNode(numnodes);
@ -599,7 +599,7 @@ int ACEND_AddNode(edict_t *self, int type)
}
// For platforms drop two nodes one at top, one at bottom
if(type == NODE_PLATFORM)
if (type == NODE_PLATFORM)
{
VectorCopy(self->maxs,v1);
VectorCopy(self->mins,v2);
@ -609,7 +609,7 @@ int ACEND_AddNode(edict_t *self, int type)
nodes[numnodes].origin[1] = (v1[1] - v2[1]) / 2 + v2[1];
nodes[numnodes].origin[2] = self->maxs[2];
if(debug_mode)
if (debug_mode)
ACEND_ShowNode(numnodes);
numnodes++;
@ -623,7 +623,7 @@ int ACEND_AddNode(edict_t *self, int type)
// Add a link
ACEND_UpdateNodeEdge(numnodes,numnodes-1);
if(debug_mode)
if (debug_mode)
{
debug_printf("Node added %d type: Platform\n",numnodes);
ACEND_ShowNode(numnodes);
@ -634,17 +634,17 @@ int ACEND_AddNode(edict_t *self, int type)
return numnodes -1;
}
if(debug_mode)
if (debug_mode)
{
if(nodes[numnodes].type == NODE_MOVE)
if (nodes[numnodes].type == NODE_MOVE)
debug_printf("Node added %d type: Move\n",numnodes);
else if(nodes[numnodes].type == NODE_TELEPORTER)
else if (nodes[numnodes].type == NODE_TELEPORTER)
debug_printf("Node added %d type: Teleporter\n",numnodes);
else if(nodes[numnodes].type == NODE_ITEM)
else if (nodes[numnodes].type == NODE_ITEM)
debug_printf("Node added %d type: Item\n",numnodes);
else if(nodes[numnodes].type == NODE_WATER)
else if (nodes[numnodes].type == NODE_WATER)
debug_printf("Node added %d type: Water\n",numnodes);
else if(nodes[numnodes].type == NODE_GRAPPLE)
else if (nodes[numnodes].type == NODE_GRAPPLE)
debug_printf("Node added %d type: Grapple\n",numnodes);
ACEND_ShowNode(numnodes);
@ -658,43 +658,43 @@ int ACEND_AddNode(edict_t *self, int type)
///////////////////////////////////////////////////////////////////////
// Add/Update node connections (paths)
///////////////////////////////////////////////////////////////////////
void ACEND_UpdateNodeEdge(int from, int to)
void ACEND_UpdateNodeEdge (int from, int to)
{
int i;
if(from == -1 || to == -1 || from == to)
if (from == -1 || to == -1 || from == to)
return; // safety
// Add the link
path_table[from][to] = to;
// Now for the self-referencing part, linear time for each link added
for(i=0;i<numnodes;i++)
if(path_table[i][from] != INVALID)
if(i == to)
for (i=0;i<numnodes;i++)
if (path_table[i][from] != INVALID)
if (i == to)
path_table[i][to] = INVALID; // make sure we terminate
else
path_table[i][to] = path_table[i][from];
if(debug_mode)
if (debug_mode)
debug_printf("Link %d -> %d\n", from, to);
}
///////////////////////////////////////////////////////////////////////
// Remove a node edge
///////////////////////////////////////////////////////////////////////
void ACEND_RemoveNodeEdge(edict_t *self, int from, int to)
void ACEND_RemoveNodeEdge (edict_t *self, int from, int to)
{
int i;
if(debug_mode)
if (debug_mode)
debug_printf("%s: Removing Edge %d -> %d\n", self->client->pers.netname, from, to);
path_table[from][to] = INVALID; // set to invalid
// Make sure this gets updated in our path array
for(i=0;i<numnodes;i++)
if(path_table[from][i] == to)
for (i=0;i<numnodes;i++)
if (path_table[from][i] == to)
path_table[from][i] = INVALID;
}
@ -702,7 +702,7 @@ void ACEND_RemoveNodeEdge(edict_t *self, int from, int to)
// This function will resolve all paths that are incomplete
// usually called before saving to disk
///////////////////////////////////////////////////////////////////////
void ACEND_ResolveAllPaths()
void ACEND_ResolveAllPaths (void)
{
int i, from, to;
int num=0;
@ -739,12 +739,12 @@ void ACEND_ResolveAllPaths()
// save out to a node file around 50-200k, so compression is not really
// a big deal.
///////////////////////////////////////////////////////////////////////
void ACEND_SaveNodes()
void ACEND_SaveNodes (void)
{
FILE *pOut;
char tempname[MAX_QPATH] = "";
char tempname[MAX_OSPATH] = "";
char dirname[MAX_OSPATH] = "";
char filename[MAX_QPATH] = "";
char filename[MAX_OSPATH] = "";
// char filename[60];
int i, j;
int version = 1;
@ -754,11 +754,10 @@ void ACEND_SaveNodes()
safe_bprintf(PRINT_MEDIUM,"Saving node table...");
// Knightmare- rewote this
// Knightmare- rewrote this to use fs_savegamedir
// create nav dir if needed
SavegameDirRelativePath ("nav", dirname, sizeof(dirname));
// _mkdir (filename);
// _mkdir (dirname);
CreatePath (dirname);
Com_sprintf (tempname, sizeof(tempname), "nav/%s.nod", level.mapname);
SavegameDirRelativePath (tempname, filename, sizeof(filename));
@ -789,12 +788,12 @@ void ACEND_SaveNodes()
///////////////////////////////////////////////////////////////////////
// Read from disk file
///////////////////////////////////////////////////////////////////////
void ACEND_LoadNodes(void)
void ACEND_LoadNodes (void)
{
FILE *pIn;
int i,j;
char tempname[MAX_QPATH] = "";
char filename[MAX_QPATH] = "";
char filename[MAX_OSPATH] = "";
// char filename[60];
int version;

View file

@ -276,7 +276,7 @@ void ACESP_PutClientInServer (edict_t *bot, qboolean respawn, int team)
client->ps.fov = 160;
}
// Knightmare- fix for null model?
// Knightmare- fix for null model
if (client->pers.weapon && client->pers.weapon->view_model)
client->ps.gunindex = gi.modelindex(client->pers.weapon->view_model);
@ -291,8 +291,9 @@ void ACESP_PutClientInServer (edict_t *bot, qboolean respawn, int team)
VectorCopy (bot->s.origin, bot->s.old_origin); // Knightmare- was missing oldorigin!
// set the delta angle
for (i=0 ; i<3 ; i++)
for (i=0 ; i<3 ; i++) {
client->ps.pmove.delta_angles[i] = ANGLE2SHORT(spawn_angles[i] - client->resp.cmd_angles[i]);
}
bot->s.angles[PITCH] = 0;
bot->s.angles[YAW] = spawn_angles[YAW];

View file

@ -934,7 +934,8 @@ qboolean FindTarget (edict_t *self)
}
else if(!(client->flags & FL_REFLECT))
{
if (!gi.inPHS(self->s.origin, client->s.origin))
// Knightmare- exclude turret drivers from this check
if ( !gi.inPHS(self->s.origin, client->s.origin) && strcmp(self->classname, "turret_driver") )
return false;
}
@ -1035,7 +1036,7 @@ qboolean M_CheckAttack (edict_t *self)
if (enemy_range == RANGE_MELEE)
{
// don't always melee in easy mode
if (skill->value == 0 && (rand()&3) )
if ( (skill->value == 0) && (rand()&3) )
return false;
if (self->monsterinfo.melee)
self->monsterinfo.attack_state = AS_MELEE;
@ -1078,7 +1079,9 @@ qboolean M_CheckAttack (edict_t *self)
chance = 0.02;
}
else
{
return false;
}
if (skill->value == 0)
chance *= 0.5;
@ -1186,12 +1189,18 @@ qboolean ai_checkattack (edict_t *self, float dist)
vec3_t temp;
qboolean hesDeadJim;
// if (!self || !self-enemy) // Knightmare- check those pointers!
if (!self) // Knightmare- check those pointers!
return false;
// this causes monsters to run blindly to the combat point w/o firing
if (self->goalentity)
{
if (self->monsterinfo.aiflags & AI_COMBAT_POINT)
return false;
// Caedes fix for monsters ignoring player
// if (self->monsterinfo.aiflags & AI_SOUND_TARGET)
if ( !visible(self, self->goalentity) && (self->monsterinfo.aiflags & AI_SOUND_TARGET) )
{
if (self->enemy && (level.time - self->enemy->teleport_time) > 5.0) //mxd. Added self->enemy check
@ -1311,7 +1320,7 @@ qboolean ai_checkattack (edict_t *self, float dist)
}
// look for other coop players here
// if (coop && self->monsterinfo.search_time < level.time)
// if (coop->value && self->monsterinfo.search_time < level.time)
// {
// if (FindTarget (self))
// return true;

View file

@ -173,10 +173,11 @@ void camera_on (edict_t *ent)
// check to see if we're the enemy of any monster. If so, make the
// faker the enemy
for(i=maxclients->value+1, monster=g_edicts+i; i<globals.num_edicts; i++, monster++) {
if(!monster->inuse) continue;
if(!(monster->svflags & SVF_MONSTER)) continue;
if(monster->enemy == ent) {
for (i=maxclients->value+1, monster=g_edicts+i; i<globals.num_edicts; i++, monster++)
{
if (!monster->inuse) continue;
if (!(monster->svflags & SVF_MONSTER)) continue;
if (monster->enemy == ent) {
monster->enemy = faker;
FoundTarget(monster);
}

View file

@ -1397,7 +1397,8 @@ qboolean CheckFlood(edict_t *ent)
int i;
gclient_t *cl;
if (flood_msgs->value) {
if (flood_msgs->value)
{
cl = ent->client;
if (level.time < cl->flood_locktill) {
@ -1475,7 +1476,8 @@ void Cmd_Say_f (edict_t *ent, qboolean team, qboolean arg0)
// strncat(text, "\n");
Q_strncatz(text, "\n", sizeof(text));
if (flood_msgs->value) {
if (flood_msgs->value)
{
cl = ent->client;
if (level.time < cl->flood_locktill) {
@ -1517,6 +1519,21 @@ void Cmd_Say_f (edict_t *ent, qboolean team, qboolean arg0)
}
}
// Knightmare added
void Cmd_EntCount_f (edict_t *ent)
{
int cnt = 0;
edict_t *e;
for (e = g_edicts; e < &g_edicts[globals.num_edicts]; e++)
{
if (e->inuse)
cnt++;
}
gi.dprintf ("%d entities active\n", cnt);
}
// end Knightmare
void Cmd_PlayerList_f(edict_t *ent)
{
int i;
@ -2079,6 +2096,10 @@ void ClientCommand (edict_t *ent)
// tpp->value = ent->client->chasetoggle;
}
// Knightmare- added entcount cmd
else if (Q_stricmp (cmd, "entcount") == 0)
Cmd_EntCount_f(ent);
// alternate attack mode
/*else if (!Q_stricmp(cmd,"attack2_off"))
Cmd_attack2_f(ent,false);
@ -2101,7 +2122,8 @@ void ClientCommand (edict_t *ent)
}
else if (!Q_stricmp(cmd, "zoomout"))
{
if (!deathmatch->value && !coop->value && !ent->client->chasetoggle) {
if (!deathmatch->value && !coop->value && !ent->client->chasetoggle)
{
if (ent->client->ps.fov < ent->client->original_fov) {
if (cl_gun->value)
stuffcmd(ent,"cl_gun 0\n");
@ -2137,7 +2159,8 @@ void ClientCommand (edict_t *ent)
}
else if (!Q_stricmp(cmd, "zoomoff"))
{
if (!deathmatch->value && !coop->value && !ent->client->chasetoggle) {
if (!deathmatch->value && !coop->value && !ent->client->chasetoggle)
{
if (ent->client->zoomed && !ent->client->zooming) {
ent->client->ps.fov = ent->client->original_fov;
ent->client->zooming = 0;
@ -2164,8 +2187,10 @@ void ClientCommand (edict_t *ent)
}
else if (!Q_stricmp(cmd, "zoominstop"))
{
if (!deathmatch->value && !coop->value && !ent->client->chasetoggle) {
if (ent->client->zooming > 0) {
if (!deathmatch->value && !coop->value && !ent->client->chasetoggle)
{
if (ent->client->zooming > 0)
{
ent->client->zooming = 0;
if (ent->client->ps.fov == ent->client->original_fov) {
ent->client->zoomed = false;
@ -2267,7 +2292,7 @@ void ClientCommand (edict_t *ent)
if (e->classname)
{
// class-specific output
if(!Q_stricmp(e->classname,"target_changelevel"))
if (!Q_stricmp(e->classname,"target_changelevel"))
fprintf(f,"map=%s\n",e->map);
}
fprintf(f,"movetype=%d, solid=%d, clipmask=0x%08x\n",e->movetype,e->solid,e->clipmask);
@ -2298,7 +2323,6 @@ void ClientCommand (edict_t *ent)
e = LookingAt(ent,0,NULL,NULL);
if(!e) return;
// GameDirRelativePath(parm, filename, sizeof(filename));
SavegameDirRelativePath(parm, filename, sizeof(filename));
// strncat(filename, ".txt");
Q_strncatz(filename, ".txt", sizeof(filename));

View file

@ -3925,6 +3925,7 @@ void CTFSay_Team (edict_t *who, char *msg)
int i;
char *p;
edict_t *cl_ent;
// size_t outmsgSize = sizeof(outmsg);
if (CheckFlood(who))
return;
@ -3936,15 +3937,20 @@ void CTFSay_Team (edict_t *who, char *msg)
msg++;
}
for (p = outmsg; *msg && (p - outmsg) < sizeof(outmsg) - 2; msg++) {
if (*msg == '%') {
switch (*++msg) {
for (p = outmsg; *msg && (p - outmsg) < sizeof(outmsg) - 2; msg++)
{
if (*msg == '%')
{
switch (*++msg)
{
case 'l' :
case 'L' :
CTFSay_Team_Location(who, buf, sizeof(buf));
if (strlen(buf) + (p - outmsg) < sizeof(outmsg) - 2) {
strcpy(p, buf);
// Q_strncpyz(p, buf, outmsgSize);
p += strlen(buf);
// outmsgSize -= strlen(buf);
}
break;
case 'a' :
@ -3952,7 +3958,9 @@ void CTFSay_Team (edict_t *who, char *msg)
CTFSay_Team_Armor(who, buf, sizeof(buf));
if (strlen(buf) + (p - outmsg) < sizeof(outmsg) - 2) {
strcpy(p, buf);
// Q_strncpyz(p, buf, outmsgSize);
p += strlen(buf);
// outmsgSize -= strlen(buf);
}
break;
case 'h' :
@ -3960,7 +3968,9 @@ void CTFSay_Team (edict_t *who, char *msg)
CTFSay_Team_Health(who, buf, sizeof(buf));
if (strlen(buf) + (p - outmsg) < sizeof(outmsg) - 2) {
strcpy(p, buf);
// Q_strncpyz(p, buf, outmsgSize);
p += strlen(buf);
// outmsgSize -= strlen(buf);
}
break;
case 't' :
@ -3968,7 +3978,9 @@ void CTFSay_Team (edict_t *who, char *msg)
CTFSay_Team_Tech(who, buf, sizeof(buf));
if (strlen(buf) + (p - outmsg) < sizeof(outmsg) - 2) {
strcpy(p, buf);
// Q_strncpyz(p, buf, outmsgSize);
p += strlen(buf);
// outmsgSize -= strlen(buf);
}
break;
case 'w' :
@ -3976,7 +3988,9 @@ void CTFSay_Team (edict_t *who, char *msg)
CTFSay_Team_Weapon(who, buf, sizeof(buf));
if (strlen(buf) + (p - outmsg) < sizeof(outmsg) - 2) {
strcpy(p, buf);
// Q_strncpyz(p, buf, outmsgSize);
p += strlen(buf);
// outmsgSize -= strlen(buf);
}
break;
@ -3985,19 +3999,23 @@ void CTFSay_Team (edict_t *who, char *msg)
CTFSay_Team_Sight(who, buf, sizeof(buf));
if (strlen(buf) + (p - outmsg) < sizeof(outmsg) - 2) {
strcpy(p, buf);
// Q_strncpyz(p, buf, outmsgSize);
p += strlen(buf);
// outmsgSize -= strlen(buf);
}
break;
default :
*p++ = *msg;
}
} else
}
else
*p++ = *msg;
}
*p = 0;
for (i = 0; i < maxclients->value; i++) {
for (i = 0; i < maxclients->value; i++)
{
cl_ent = g_edicts + 1 + i;
if (!cl_ent->inuse)
continue;

View file

@ -975,15 +975,14 @@ void plat_spawn_inside_trigger (edict_t *ent)
/*QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER
speed default 150
Plats are always drawn in the extended position, so they will light correctly.
If the plat is the target of another trigger or button, it will start out disabled in the extended position until it is trigger, when it will lower and become a normal plat.
"speed" overrides default 200.
"accel" overrides default 500
"lip" overrides default 8 pixel lip
"speed" overrides default 200
"accel" overrides default 50
"decel" overrides default 50
"lip" overrides default 8 unit lip
If the "height" key is set, that will determine the amount the plat moves, instead of being implicitly determoveinfoned by the model's height.
@ -2540,7 +2539,7 @@ void train_wait (edict_t *self)
self->spawnflags &= ~TRAIN_START_ON;
VectorClear (self->velocity);
if ( !(self->spawnflags & TRAIN_ROTATE_CONSTANT) )
VectorClear (self->avelocity); //Knightmare added
VectorClear (self->avelocity); // Knightmare added
// Lazarus: turn off animation for stationary trains
if (!strcmp(self->classname, "func_train"))
self->s.effects &= ~(EF_ANIM_ALL | EF_ANIM_ALLFAST);

View file

@ -2,7 +2,7 @@ extern void Info_SetValueForKey ( char * s , char * key , char * value ) ;
extern qboolean Info_Validate ( char * s ) ;
extern void Info_RemoveKey ( char * s , char * key ) ;
extern char * Info_ValueForKey ( char * s , char * key ) ;
extern long Com_HashFileName ( const char * fname , int hashSize , qboolean sized ) ;
extern unsigned int Com_HashFileName ( const char * fname , int hashSize , qboolean sized ) ;
extern void Com_sprintf ( char * dest , size_t size , char * fmt , ... ) ;
extern char * Q_strupr ( char * string ) ;
extern char * Q_strlwr ( char * string ) ;
@ -10,7 +10,7 @@ extern void Q_snprintfz ( char * dst , size_t dstSize , const char * fmt , ... )
extern void Q_strncatz ( char * dst , const char * src , size_t dstSize ) ;
extern void Q_strncpyz ( char * dst , const char * src , size_t dstSize ) ;
extern int Q_strcasecmp ( char * s1 , char * s2 ) ;
extern int Q_strncasecmp ( char * s1 , char * s2 , int n ) ;
extern int Q_strncasecmp ( char * s1 , char * s2 , size_t n ) ;
extern int Q_SortStrcmp ( const char * * arg1 , const char * * arg2 ) ;
extern int Q_strcmp ( const char * string1 , const char * string2 ) ;
extern int Q_strncmp ( const char * string1 , const char * string2 , int n ) ;
@ -46,6 +46,7 @@ extern void COM_FileBase ( char * in , char * out , size_t outSize ) ;
extern char * COM_FileExtension ( char * in ) ;
extern void COM_StripExtension ( char * in , char * out , size_t outSize ) ;
extern char * COM_SkipPath ( char * pathname ) ;
extern void MatrixMultiply ( float in1 [ 3 ] [ 3 ] , float in2 [ 3 ] [ 3 ] , float out [ 3 ] [ 3 ] ) ;
extern qboolean AxisCompare ( const vec3_t axis1 [ 3 ] , const vec3_t axis2 [ 3 ] ) ;
extern void AxisCopy ( const vec3_t in [ 3 ] , vec3_t out [ 3 ] ) ;
extern void AxisClear ( vec3_t axis [ 3 ] ) ;
@ -72,6 +73,7 @@ extern int BoxOnPlaneSide ( vec3_t emins , vec3_t emaxs , struct cplane_s * p )
extern int BoxOnPlaneSide2 ( vec3_t emins , vec3_t emaxs , struct cplane_s * p ) ;
extern float anglemod ( float a ) ;
extern float LerpAngle ( float a2 , float a1 , float frac ) ;
extern int Q_ftol ( float f ) ;
extern float Q_fabs ( float f ) ;
extern void R_ConcatTransforms ( float in1 [ 3 ] [ 4 ] , float in2 [ 3 ] [ 4 ] , float out [ 3 ] [ 4 ] ) ;
extern void R_ConcatRotations ( float in1 [ 3 ] [ 3 ] , float in2 [ 3 ] [ 3 ] , float out [ 3 ] [ 3 ] ) ;
@ -1260,7 +1262,7 @@ extern void EndDMLevel ( void ) ;
extern edict_t * CreateTargetChangeLevel ( char * map ) ;
extern void ClientEndServerFrames ( void ) ;
extern void Com_Printf ( char * msg , ... ) ;
extern void Sys_Error ( char * error , ... ) ;
extern void Sys_Error ( const char * error , ... ) ;
extern game_export_t * GetGameAPI ( game_import_t * import ) ;
extern int Debug_Soundindex ( char * name ) ;
extern int Debug_Modelindex ( char * name ) ;
@ -1668,6 +1670,7 @@ extern void SetLazarusCrosshair ( edict_t * ent ) ;
extern void Cmd_Bbox_f ( edict_t * ent ) ;
extern void DrawBBox ( edict_t * ent ) ;
extern void Cmd_PlayerList_f ( edict_t * ent ) ;
extern void Cmd_EntCount_f ( edict_t * ent ) ;
extern void Cmd_Say_f ( edict_t * ent , qboolean team , qboolean arg0 ) ;
extern qboolean CheckFlood ( edict_t * ent ) ;
extern void Cmd_Wave_f ( edict_t * ent ) ;
@ -1739,13 +1742,13 @@ extern void ACESP_Respawn ( edict_t * self ) ;
extern void ACESP_PutClientInServer ( edict_t * bot , qboolean respawn , int team ) ;
extern void ACESP_HoldSpawn ( edict_t * self ) ;
extern void ACEND_LoadNodes ( void ) ;
extern void ACEND_SaveNodes ( ) ;
extern void ACEND_ResolveAllPaths ( ) ;
extern void ACEND_SaveNodes ( void ) ;
extern void ACEND_ResolveAllPaths ( void ) ;
extern void ACEND_RemoveNodeEdge ( edict_t * self , int from , int to ) ;
extern void ACEND_UpdateNodeEdge ( int from , int to ) ;
extern int ACEND_AddNode ( edict_t * self , int type ) ;
extern void ACEND_ShowPath ( edict_t * self , int goal_node ) ;
extern void ACEND_DrawPath ( ) ;
extern void ACEND_DrawPath ( void ) ;
extern void ACEND_ShowNode ( int node ) ;
extern void ACEND_InitNodes ( void ) ;
extern void ACEND_PathMap ( edict_t * self ) ;
@ -1782,7 +1785,7 @@ extern void safe_bprintf ( int printlevel , char * fmt , ... ) ;
extern void safe_centerprintf ( edict_t * ent , char * fmt , ... ) ;
extern void safe_cprintf ( edict_t * ent , int printlevel , char * fmt , ... ) ;
extern void debug_printf ( char * fmt , ... ) ;
extern void ACECM_Store ( ) ;
extern void ACECM_Store ( void ) ;
extern qboolean ACECM_Commands ( edict_t * ent ) ;
extern void ACEAI_ChooseWeapon ( edict_t * self ) ;
extern qboolean ACEAI_CheckShot ( edict_t * self ) ;

View file

@ -46,6 +46,7 @@
{"COM_FileExtension", (byte *)COM_FileExtension},
{"COM_StripExtension", (byte *)COM_StripExtension},
{"COM_SkipPath", (byte *)COM_SkipPath},
{"MatrixMultiply", (byte *)MatrixMultiply},
{"AxisCompare", (byte *)AxisCompare},
{"AxisCopy", (byte *)AxisCopy},
{"AxisClear", (byte *)AxisClear},
@ -72,6 +73,7 @@
{"BoxOnPlaneSide2", (byte *)BoxOnPlaneSide2},
{"anglemod", (byte *)anglemod},
{"LerpAngle", (byte *)LerpAngle},
{"Q_ftol", (byte *)Q_ftol},
{"Q_fabs", (byte *)Q_fabs},
{"R_ConcatTransforms", (byte *)R_ConcatTransforms},
{"R_ConcatRotations", (byte *)R_ConcatRotations},
@ -1668,6 +1670,7 @@
{"Cmd_Bbox_f", (byte *)Cmd_Bbox_f},
{"DrawBBox", (byte *)DrawBBox},
{"Cmd_PlayerList_f", (byte *)Cmd_PlayerList_f},
{"Cmd_EntCount_f", (byte *)Cmd_EntCount_f},
{"Cmd_Say_f", (byte *)Cmd_Say_f},
{"CheckFlood", (byte *)CheckFlood},
{"Cmd_Wave_f", (byte *)Cmd_Wave_f},

View file

@ -49,7 +49,7 @@ void target_lock_use (edict_t *self, edict_t *other, edict_t *activator)
n = e->count - 1;
current[n] = '0' + e->s.frame;
}
if(strcmp(current,self->key_message)==0)
if (strcmp(current,self->key_message)==0)
{
copy_message = self->message;
self->message = NULL;
@ -58,10 +58,10 @@ void target_lock_use (edict_t *self, edict_t *other, edict_t *activator)
}
else
{
if(self->message) safe_centerprintf(activator,self->message);
if(self->pathtarget) {
if (self->message) safe_centerprintf(activator,self->message);
if (self->pathtarget) {
e = G_Find(NULL,FOFS(targetname),self->pathtarget);
if(e) e->use(e,other,activator);
if (e) e->use(e,other,activator);
}
else {
BeepBeep(activator);
@ -71,7 +71,7 @@ void target_lock_use (edict_t *self, edict_t *other, edict_t *activator)
void lock_digit_increment (edict_t *digit, edict_t *activator)
{
if(digit->s.frame == 9)
if (digit->s.frame == 9)
digit->s.frame = 0;
else
digit->s.frame++;
@ -84,13 +84,13 @@ void lock_initialize (edict_t *lock)
int numdigits;
char c;
if(lock->spawnflags & 1 && strlen(game.lock_code) != 0)
if (lock->spawnflags & 1 && strlen(game.lock_code) != 0)
{
strcpy(lock->key_message, game.lock_code);
return;
}
// Maximum of 8 digits in combination
l = min(strlen(lock->key_message),8);
l = min((int)strlen(lock->key_message),8);
numdigits = 0;
for (e = lock->teammaster; e; e = e->teamchain)
{
@ -115,7 +115,7 @@ void lock_initialize (edict_t *lock)
n = random();
n = random();
n = random();
for(n=0; n<numdigits; n++)
for (n=0; n<numdigits; n++)
lock->key_message[n] = '0' + (int)(random() * 9.99);
lock->key_message[numdigits] = '\0';
@ -134,7 +134,7 @@ void SP_target_lock (edict_t *self)
}
if (self->spawnflags & 2) game.lock_hud = true;
if (!self->key_message)
self->key_message = "00000000";
self->key_message = "000000000";
self->use = target_lock_use;
self->think = lock_initialize;
self->nextthink = level.time + 1.0;
@ -150,31 +150,31 @@ void lock_code_use (edict_t *self, edict_t *other, edict_t *activator)
{
int i, L;
char message[64];
if(self->spawnflags & 1)
if (self->spawnflags & 1)
{
if(!strlen(game.lock_code))
if (!strlen(game.lock_code))
{
gi.dprintf("Lock has not been properly initialized.\n");
return;
}
Com_sprintf(message, sizeof(message), "Lock combination is %s",game.lock_code);
Do_Text_Display(activator, 0, message);
L = strlen(game.lock_code);
for(i=0; i<L; i++)
L = (int)strlen(game.lock_code);
for (i=0; i<L; i++)
game.lock_revealed |= 1<<i;
}
else
{
edict_t *lock;
lock = G_Find(NULL,FOFS(targetname),self->target);
if(!lock)
if (!lock)
gi.dprintf("Target of target_lock_code does not exist\n");
else
{
Com_sprintf(message, sizeof(message), "Lock combination is %s",game.lock_code);
Do_Text_Display(activator, 0, message);
L = min(8,strlen(lock->key_message));
for(i=0; i<L; i++)
L = min(8,(int)strlen(lock->key_message));
for (i=0; i<L; i++)
game.lock_revealed |= 1<<i;
}
}
@ -182,7 +182,7 @@ void lock_code_use (edict_t *self, edict_t *other, edict_t *activator)
void SP_target_lock_code (edict_t *self)
{
if(!self->target && !(self->spawnflags & 1))
if (!self->target && !(self->spawnflags & 1))
{
gi.dprintf("non-crosslevel target_lock_code w/o target\n");
G_FreeEdict(self);
@ -193,28 +193,28 @@ void SP_target_lock_code (edict_t *self)
void lock_clue_use (edict_t *self, edict_t *other, edict_t *activator)
{
int i, L;
if(self->spawnflags & 1)
if (self->spawnflags & 1)
{
if(!strlen(game.lock_code))
if (!strlen(game.lock_code))
{
gi.dprintf("Lock has not been properly initialized.\n");
return;
}
L = strlen(game.lock_code);
for(i=0; i<L; i++)
if(self->message[i] != '?') game.lock_revealed |= 1<<i;
L = (int)strlen(game.lock_code);
for (i=0; i<L; i++)
if (self->message[i] != '?') game.lock_revealed |= 1<<i;
}
else
{
edict_t *lock;
lock = G_Find(NULL,FOFS(targetname),self->target);
if(!lock)
if (!lock)
gi.dprintf("Target of target_lock_clue does not exist\n");
else
{
L = min(8,strlen(lock->key_message));
for(i=0; i<L; i++)
if(self->message[i] != '?') game.lock_revealed |= 1<<i;
L = min(8,(int)strlen(lock->key_message));
for (i=0; i<L; i++)
if (self->message[i] != '?') game.lock_revealed |= 1<<i;
}
}
}
@ -225,7 +225,7 @@ void lock_clue_think(edict_t *self)
int unrevealed_count;
edict_t *e;
if(!self->team)
if (!self->team)
return;
unrevealed_count = 0;
@ -234,16 +234,16 @@ void lock_clue_think(edict_t *self)
if (!e->count)
continue;
n = e->count - 1;
if(game.lock_revealed & 1<<n)
if (game.lock_revealed & 1<<n)
e->s.frame = game.lock_code[n] - '0';
else
{
e->s.frame++; // spin unknown digits
if(e->s.frame > 9) e->s.frame = 0;
if (e->s.frame > 9) e->s.frame = 0;
unrevealed_count++;
}
}
if(unrevealed_count)
if (unrevealed_count)
{
self->nextthink = level.time + FRAMETIME;
gi.linkentity(self);
@ -255,7 +255,7 @@ void lock_clue_initialize(edict_t *self)
// show the same numbers across the board.
edict_t *e;
if(self->team)
if (self->team)
{
for (e = self->teammaster; e; e = e->teamchain)
{
@ -270,7 +270,7 @@ void lock_clue_initialize(edict_t *self)
}
void SP_target_lock_clue (edict_t *self)
{
if(!self->target && !(self->spawnflags & 1))
if (!self->target && !(self->spawnflags & 1))
{
gi.dprintf("non-crosslevel target_lock_clue w/o target\n");
G_FreeEdict(self);

View file

@ -261,7 +261,7 @@ game_export_t *GetGameAPI (game_import_t *import)
#ifndef GAME_HARD_LINKED
// this is only here so the functions in q_shared.c and q_shwin.c can link
void Sys_Error (char *error, ...)
void Sys_Error (const char *error, ...)
{
va_list argptr;
char text[1024];

View file

@ -2914,7 +2914,7 @@ void target_string_use (edict_t *self, edict_t *other, edict_t *activator)
int n, l;
char c;
l = strlen(self->message);
l = (int)strlen(self->message);
for (e = self->teammaster; e; e = e->teamchain)
{
if (!e->count)
@ -3436,16 +3436,20 @@ void teleporter_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_
gi.linkentity (other);
}
void use_teleporter (edict_t *self, edict_t *other, edict_t *activator) {
void use_teleporter (edict_t *self, edict_t *other, edict_t *activator)
{
if(!(self->spawnflags & 1)) {
if (!(self->spawnflags & 1))
{
if(!(self->spawnflags & 2))
return;
self->spawnflags |= 1;
self->s.effects &= ~EF_TELEPORTER;
self->target_ent->solid = SOLID_NOT;
self->s.sound = 0;
} else {
}
else
{
self->spawnflags &= ~1;
if(!(self->spawnflags & 4))
self->s.effects |= EF_TELEPORTER;
@ -3470,7 +3474,8 @@ void SP_misc_teleporter (edict_t *ent)
return;
}
if(!(ent->spawnflags & 4)) {
if (!(ent->spawnflags & 4))
{
gi.setmodel (ent, "models/objects/dmspot/tris.md2");
ent->s.skinnum = 1;
if(!(ent->spawnflags & 1)) {
@ -3479,12 +3484,13 @@ void SP_misc_teleporter (edict_t *ent)
}
}
if(ent->spawnflags & 3)
if (ent->spawnflags & 3)
ent->use = use_teleporter;
if (ent->spawnflags & 4) {
ent->solid = SOLID_NOT;
} else {
}
else {
ent->solid = SOLID_BBOX;
VectorSet (ent->mins, -32, -32, -24);
VectorSet (ent->maxs, 32, 32, -16);
@ -4208,7 +4214,7 @@ int PatchDeadSoldier (void)
char outfilename[MAX_OSPATH];
char tempname[MAX_OSPATH];
int j;
char *p;
// char *p;
FILE *infile;
FILE *outfile;
dmdl_t model; // model header
@ -4228,6 +4234,7 @@ int PatchDeadSoldier (void)
{
// output file already exists, move along
fclose (outfile);
// gi.dprintf ("PatchDeadSoldier: Could not save %s, file already exists\n", outfilename);
return 0;
}

View file

@ -1035,6 +1035,8 @@ int PatchMonsterModel (char *modelname)
qboolean is_tank=false;
qboolean is_soldier=false;
qboolean gamedirpakfile=false;
// get game (moddir) name
gamedir = gi.cvar("game", "", 0);
if (!*gamedir->string)
@ -1193,53 +1195,103 @@ int PatchMonsterModel (char *modelname)
// load original model
Com_sprintf (infilename, sizeof(infilename), "baseq2/%s", modelname);
// If file doesn't exist on user's hard disk, it must be in
// a pak file
if ( !(infile = fopen (infilename, "rb")) )
{
// If file doesn't exist on user's hard disk, it must be in
// pak0.pak
pak_header_t pakheader;
pak_item_t pakitem;
FILE *fpak;
int k, numitems;
int i, k, numitems;
char pakfile[MAX_OSPATH];
fpak = fopen("baseq2/pak0.pak","rb");
if (!fpak)
// Knightmare- look in all pak files in baseq2
for (i=0; i<10; i++)
{
cvar_t *cddir;
char pakfile[MAX_OSPATH];
cddir = gi.cvar("cddir", "", 0);
Com_sprintf(pakfile, sizeof(pakfile), "%s/baseq2/pak0.pak",cddir->string);
fpak = fopen(pakfile,"rb");
Com_sprintf (pakfile, sizeof(pakfile), "baseq2/pak%i.pak", i);
// fpak = fopen("baseq2/pak0.pak","rb");
fpak = fopen(pakfile, "rb");
if (!fpak)
{
gi.dprintf("PatchMonsterModel: Cannot find pak0.pak\n");
return 0;
}
}
fread(&pakheader,1,sizeof(pak_header_t),fpak);
numitems = pakheader.dsize/sizeof(pak_item_t);
fseek(fpak,pakheader.dstart,SEEK_SET);
data = NULL;
for (k=0; k<numitems && !data; k++)
{
fread(&pakitem,1,sizeof(pak_item_t),fpak);
if (!Q_stricmp(pakitem.name,modelname))
{
fseek(fpak,pakitem.start,SEEK_SET);
fread(&model, sizeof(dmdl_t), 1, fpak);
datasize = model.ofs_end - model.ofs_skins;
if ( !(data = malloc (datasize)) ) // make sure freed locally
cvar_t *cddir;
char pakfile[MAX_OSPATH];
cddir = gi.cvar("cddir", "", 0);
Com_sprintf(pakfile, sizeof(pakfile), "%s/baseq2/pak0.pak",cddir->string);
fpak = fopen(pakfile,"rb");
if (!fpak)
{
fclose(fpak);
gi.dprintf ("PatchMonsterModel: Could not allocate memory for model\n");
gi.dprintf("PatchMonsterModel: Cannot find pak0.pak\n");
return 0;
}
fread (data, sizeof (byte), datasize, fpak);
}
fread(&pakheader,1,sizeof(pak_header_t),fpak);
numitems = pakheader.dsize/sizeof(pak_item_t);
fseek(fpak,pakheader.dstart,SEEK_SET);
data = NULL;
for (k=0; k<numitems && !data; k++)
{
fread(&pakitem,1,sizeof(pak_item_t),fpak);
if (!Q_stricmp(pakitem.name,modelname))
{
fseek(fpak,pakitem.start,SEEK_SET);
fread(&model, sizeof(dmdl_t), 1, fpak);
datasize = model.ofs_end - model.ofs_skins;
if ( !(data = malloc (datasize)) ) // make sure freed locally
{
fclose(fpak);
gi.dprintf ("PatchMonsterModel: Could not allocate memory for model\n");
return 0;
}
fread (data, sizeof (byte), datasize, fpak);
}
}
fclose(fpak);
if (data) // we found it, so stop searching
break;
}
if (!data) // if not in baseq2 pak file, check pakfiles in current gamedir
{
char pakname[MAX_OSPATH];
// check all pakfiles in current gamedir
for (i=0; i<10; i++)
{
Com_sprintf (pakname, sizeof(pakname), "pak%i.pak", i);
GameDirRelativePath (pakname, pakfile, sizeof(pakfile));
fpak = fopen(pakfile,"rb");
if (!fpak) // this pak not found, go on to next
continue;
fread(&pakheader,1,sizeof(pak_header_t),fpak);
numitems = pakheader.dsize/sizeof(pak_item_t);
fseek(fpak,pakheader.dstart,SEEK_SET);
data = NULL;
for (k=0; k<numitems && !data; k++)
{
fread(&pakitem,1,sizeof(pak_item_t),fpak);
if (!Q_stricmp(pakitem.name,modelname))
{
fseek(fpak,pakitem.start,SEEK_SET);
fread(&model, sizeof(dmdl_t), 1, fpak);
datasize = model.ofs_end - model.ofs_skins;
if ( !(data = malloc (datasize)) ) // make sure freed locally
{
fclose(fpak);
gi.dprintf ("PatchMonsterModel: Could not allocate memory for model\n");
return 0;
}
fread (data, sizeof (byte), datasize, fpak);
}
}
fclose(fpak);
if (data) // we found it, so stop searching
{
gamedirpakfile = true;
break;
}
}
}
fclose(fpak);
if (!data)
{
gi.dprintf("PatchMonsterModel: Could not find %s in baseq2/pak0.pak\n",modelname);

View file

@ -126,7 +126,7 @@ edict_t *SV_TestEntityPosition (edict_t *ent)
mask = ent->clipmask;
else
mask = MASK_SOLID;
if(ent->solid == SOLID_BSP)
if (ent->solid == SOLID_BSP)
{
vec3_t org, mins, maxs;
VectorAdd(ent->s.origin,ent->origin_offset,org);
@ -145,7 +145,7 @@ edict_t *SV_TestEntityPosition (edict_t *ent)
return NULL;
// Lazarus - return a bit more useful info than simply "g_edicts"
if(trace.ent)
if (trace.ent)
return trace.ent;
else
return world;
@ -357,11 +357,11 @@ retry:
vec3_t player_dest;
trace_t ptrace;
if(ent->mass > hit->mass)
if (ent->mass > hit->mass)
{
VectorMA (hit->s.origin,time_left,ent->velocity,player_dest);
ptrace = gi.trace(hit->s.origin,hit->mins,hit->maxs,player_dest,hit,hit->clipmask);
if(ptrace.fraction == 1.0)
if (ptrace.fraction == 1.0)
{
VectorCopy(player_dest,hit->s.origin);
gi.linkentity(hit);
@ -557,11 +557,11 @@ retry:
vec3_t player_dest;
trace_t ptrace;
if(ent->mass > hit->mass)
if (ent->mass > hit->mass)
{
VectorMA (hit->s.origin,time_left,ent->velocity,player_dest);
ptrace = gi.trace(hit->s.origin,hit->mins,hit->maxs,player_dest,hit,hit->clipmask);
if(ptrace.fraction == 1.0)
if (ptrace.fraction == 1.0)
{
VectorCopy(player_dest,hit->s.origin);
gi.linkentity(hit);
@ -575,7 +575,7 @@ retry:
{
// Lazarus: special case - if this ent or the impact ent is
// in water, motion is NOT blocked.
if((hit->movetype != MOVETYPE_PUSHABLE) || ((ent->waterlevel==0) && (hit->waterlevel==0)))
if ((hit->movetype != MOVETYPE_PUSHABLE) || ((ent->waterlevel==0) && (hit->waterlevel==0)))
{
blocked |= 1; // floor
if ( hit->solid == SOLID_BSP)
@ -616,7 +616,7 @@ retry:
{
// DH: experimenting here. 1 is no bounce,
// 1.5 bounces like a grenade, 2 is a superball
if(ent->bounce_me == 1) {
if (ent->bounce_me == 1) {
ClipVelocity (original_velocity, planes[i], new_velocity, 1.4);
// stop small oscillations
if (new_velocity[2] < 60)
@ -626,10 +626,10 @@ retry:
VectorCopy (vec3_origin, new_velocity);
} else {
// add a bit of random horizontal motion
if(!new_velocity[0]) new_velocity[0] = crandom() * new_velocity[2]/4;
if(!new_velocity[1]) new_velocity[1] = crandom() * new_velocity[2]/4;
if (!new_velocity[0]) new_velocity[0] = crandom() * new_velocity[2]/4;
if (!new_velocity[1]) new_velocity[1] = crandom() * new_velocity[2]/4;
}
} else if(ent->bounce_me == 2)
} else if (ent->bounce_me == 2)
VectorCopy(ent->velocity,new_velocity);
else
ClipVelocity (original_velocity, planes[i], new_velocity, 1);
@ -665,7 +665,7 @@ retry:
// if velocity is against the original velocity, stop dead
// to avoid tiny occilations in sloping corners
//
if( !ent->bounce_me ) {
if ( !ent->bounce_me ) {
if (DotProduct (ent->velocity, primal_velocity) <= 0)
{
VectorCopy (vec3_origin, ent->velocity);
@ -684,7 +684,7 @@ SV_AddGravity
*/
void SV_AddGravity (edict_t *ent)
{
if(level.time > ent->gravity_debounce_time)
if (level.time > ent->gravity_debounce_time)
ent->velocity[2] -= ent->gravity * sv_gravity->value * FRAMETIME;
}
@ -737,6 +737,12 @@ retry:
// Harven fix end
VectorCopy (trace.endpos, ent->s.origin);
// mxd fix for dark gibs/debris on sloped surfaces- push slightly away from surface
// if (trace.plane.type != 2) { // 2 = PLANE_Z, horizonal plane
// VectorAdd (ent->s.origin, trace.plane.normal, ent->s.origin);
// }
gi.linkentity (ent);
if (trace.fraction != 1.0)
@ -769,10 +775,10 @@ retry:
goto retry;
}
}
if(onconveyor && !trace.ent->client)
if (onconveyor && !trace.ent->client)
{
// If blocker can be damaged, destroy it. Otherwise destroy blockee.
if(trace.ent->takedamage == DAMAGE_YES)
if (trace.ent->takedamage == DAMAGE_YES)
T_Damage(trace.ent, ent, ent, vec3_origin, trace.ent->s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH);
else
T_Damage(ent, trace.ent, trace.ent, vec3_origin, ent->s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH);
@ -802,11 +808,11 @@ void MoveRiders(edict_t *platform, edict_t *ignore, vec3_t move, vec3_t amove, q
int i;
edict_t *rider;
for(i=1, rider=g_edicts+i; i<=globals.num_edicts; i++, rider++) {
if((rider->groundentity == platform) && (rider != ignore)) {
for (i=1, rider=g_edicts+i; i<=globals.num_edicts; i++, rider++) {
if ((rider->groundentity == platform) && (rider != ignore)) {
VectorAdd(rider->s.origin,move,rider->s.origin);
if (turn && (amove[YAW] != 0.)) {
if(!rider->client)
if (!rider->client)
rider->s.angles[YAW] += amove[YAW];
else
{
@ -817,13 +823,13 @@ void MoveRiders(edict_t *platform, edict_t *ignore, vec3_t move, vec3_t amove, q
}
}
gi.linkentity(rider);
if(SV_TestEntityPosition(rider)) {
if (SV_TestEntityPosition(rider)) {
// Move is blocked. Since this is for riders, not pushees,
// it should be ok to just back the move for this rider off
VectorSubtract(rider->s.origin,move,rider->s.origin);
if(turn && (amove[YAW] != 0.)) {
if (turn && (amove[YAW] != 0.)) {
rider->s.angles[YAW] -= amove[YAW];
if(rider->client)
if (rider->client)
{
rider->client->ps.pmove.delta_angles[YAW] -= ANGLE2SHORT(amove[YAW]);
rider->client->ps.viewangles[YAW] -= amove[YAW];
@ -855,27 +861,27 @@ void RealBoundingBox(edict_t *ent, vec3_t mins, vec3_t maxs)
vec3_t p[8];
int i, j, k, j2, k4;
for(k=0; k<2; k++)
for (k=0; k<2; k++)
{
k4 = k*4;
if(k)
if (k)
p[k4][2] = ent->maxs[2];
else
p[k4][2] = ent->mins[2];
p[k4+1][2] = p[k4][2];
p[k4+2][2] = p[k4][2];
p[k4+3][2] = p[k4][2];
for(j=0; j<2; j++)
for (j=0; j<2; j++)
{
j2 = j*2;
if(j)
if (j)
p[j2+k4][1] = ent->maxs[1];
else
p[j2+k4][1] = ent->mins[1];
p[j2+k4+1][1] = p[j2+k4][1];
for(i=0; i<2; i++)
for (i=0; i<2; i++)
{
if(i)
if (i)
p[i+j2+k4][0] = ent->maxs[0];
else
p[i+j2+k4][0] = ent->mins[0];
@ -883,7 +889,7 @@ void RealBoundingBox(edict_t *ent, vec3_t mins, vec3_t maxs)
}
}
AngleVectors(ent->s.angles,forward,left,up);
for(i=0; i<8; i++)
for (i=0; i<8; i++)
{
VectorScale(forward,p[i][0],f1);
VectorScale(left,-p[i][1],l1);
@ -894,7 +900,7 @@ void RealBoundingBox(edict_t *ent, vec3_t mins, vec3_t maxs)
}
VectorCopy(p[0],mins);
VectorCopy(p[0],maxs);
for(i=1; i<8; i++)
for (i=1; i<8; i++)
{
mins[0] = min(mins[0],p[i][0]);
mins[1] = min(mins[1],p[i][1]);
@ -1053,7 +1059,7 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
// 'cause it can be a fairly drastic change in gameplay
if (turn && (check->groundentity == pusher))
{
if(!check->client)
if (!check->client)
{
check->s.angles[YAW] += amove[YAW];
}
@ -1074,7 +1080,7 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
// player is riding a MOVETYPE_PUSH
check->client->ps.pmove.pm_flags |= PMF_NO_PREDICTION;
}
if(amove[PITCH] != 0.0f)
if (amove[PITCH] != 0.0f)
{
float delta_yaw;
float pitch = amove[PITCH];
@ -1092,7 +1098,7 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
// Lazarus: This is where we attempt to move check due to a rotation, WITHOUT embedding
// check in pusher (or anything else)
if((amove[PITCH] != 0) || (amove[YAW] != 0) || (amove[ROLL] != 0))
if ((amove[PITCH] != 0) || (amove[YAW] != 0) || (amove[ROLL] != 0))
{
// Argh! - always need to do this, except for pendulums
if (pusher->movetype != MOVETYPE_PENDULUM)
@ -1115,7 +1121,7 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
VectorCopy(check->s.origin,org);
org[2] += 2*check->mins[2];
//tr = gi.trace(check->s.origin,vec3_origin,vec3_origin,org,check,MASK_SOLID);
//if(!tr.startsolid && tr.fraction < 1)
//if (!tr.startsolid && tr.fraction < 1)
// check->s.origin[2] = tr.endpos[2] - check->mins[2]
// + fabs(tr.plane.normal[0])*check->size[0]/2
// + fabs(tr.plane.normal[1])*check->size[1]/2;
@ -1124,14 +1130,14 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
// rotating pushers, trains still seem okay too but
// I haven't tested them thoroughly
tr = gi.trace(check->s.origin, check->mins, check->maxs, org, check, MASK_SOLID);
if(!tr.startsolid && tr.fraction < 1)
if (!tr.startsolid && tr.fraction < 1)
check->s.origin[2] = tr.endpos[2];
// Lazarus: func_tracktrain is a special case. Since we KNOW (if the map was
// constructed properly) that "move_origin" is a safe position, we
// can infer that there should be a safe (not embedded) position
// somewhere between move_origin and the proposed new location.
if((pusher->flags & FL_TRACKTRAIN) && (check->client || (check->svflags & SVF_MONSTER)))
if ((pusher->flags & FL_TRACKTRAIN) && (check->client || (check->svflags & SVF_MONSTER)))
{
vec3_t f,l,u;
@ -1143,13 +1149,13 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
org[2] += pusher->move_origin[2] + 1;
org[2] += 16 * ( fabs(u[0]) + fabs(u[1]) );
tr = gi.trace(org,check->mins,check->maxs,check->s.origin,check,MASK_SOLID);
if(!tr.startsolid)
if (!tr.startsolid)
{
VectorCopy(tr.endpos,check->s.origin);
VectorCopy(check->s.origin,org);
org[2] -= 128;
tr = gi.trace(check->s.origin,check->mins,check->maxs,org,check,MASK_SOLID);
if(tr.fraction > 0)
if (tr.fraction > 0)
VectorCopy(tr.endpos,check->s.origin);
}
}
@ -1186,13 +1192,13 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
org[2] += pusher->move_origin[2] + 1;
org[2] += 16 * ( fabs(u[0]) + fabs(u[1]) );
tr = gi.trace(org,check->mins,check->maxs,check->s.origin,check,MASK_SOLID);
if(!tr.startsolid)
if (!tr.startsolid)
{
VectorCopy(tr.endpos,check->s.origin);
VectorCopy(check->s.origin,org);
org[2] -= 128;
tr = gi.trace(check->s.origin,check->mins,check->maxs,org,check,MASK_SOLID);
if(tr.fraction > 0)
if (tr.fraction > 0)
VectorCopy(tr.endpos,check->s.origin);
block = SV_TestEntityPosition (check);
}
@ -1212,11 +1218,11 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
// this is only relevent for riding entities, not pushed
VectorSubtract (check->s.origin, move, check->s.origin);
VectorSubtract (check->s.origin, move2, check->s.origin);
if(turn)
if (turn)
{
// Argh! - angle
check->s.angles[YAW] -= amove[YAW];
if(check->client)
if (check->client)
{
check->client->ps.pmove.delta_angles[YAW] -= ANGLE2SHORT(amove[YAW]);
check->client->ps.viewangles[YAW] -= amove[YAW];
@ -1288,7 +1294,7 @@ void SV_Physics_Pusher (edict_t *ent)
pushed_p = pushed;
for (part = ent ; part ; part=part->teamchain)
{
if(part->attracted)
if (part->attracted)
part->velocity[0] = part->velocity[1] = 0;
if (part->velocity[0] || part->velocity[1] || part->velocity[2] ||
part->avelocity[0] || part->avelocity[1] || part->avelocity[2]
@ -1300,10 +1306,10 @@ void SV_Physics_Pusher (edict_t *ent)
if (!SV_Push (part, move, amove))
break; // move was blocked
if(part->moveinfo.is_blocked)
if (part->moveinfo.is_blocked)
{
part->moveinfo.is_blocked = false;
if(part->moveinfo.sound_middle)
if (part->moveinfo.sound_middle)
part->s.sound = part->moveinfo.sound_middle;
}
}
@ -1325,20 +1331,20 @@ void SV_Physics_Pusher (edict_t *ent)
if (part->blocked)
{
// Lazarus: Func_pushables with health < 0 & vehicles ALWAYS block pushers
if( ( (obstacle->movetype == MOVETYPE_PUSHABLE) && (obstacle->health < 0)) ||
if ( ( (obstacle->movetype == MOVETYPE_PUSHABLE) && (obstacle->health < 0)) ||
(obstacle->movetype == MOVETYPE_VEHICLE) )
{
part->moveinfo.is_blocked = true;
if(part->s.sound)
if (part->s.sound)
{
if (part->moveinfo.sound_end)
gi.sound (part, CHAN_NO_PHS_ADD+CHAN_VOICE, part->moveinfo.sound_end, 1, ATTN_STATIC, 0);
part->s.sound = 0;
}
// Lazarus: More special-case stuff. Man I hate doing this
if(part->movetype == MOVETYPE_PENDULUM)
if (part->movetype == MOVETYPE_PENDULUM)
{
if(fabs(part->s.angles[ROLL]) > 2)
if (fabs(part->s.angles[ROLL]) > 2)
{
// gi.dprintf("pendulum continue in g_phys, avelocity=%g\n",part->avelocity[ROLL]);
part->moveinfo.start_angles[ROLL] = part->s.angles[ROLL];
@ -1467,16 +1473,16 @@ void SV_Physics_Toss (edict_t *ent)
end[2] -= 256;
tr = gi.trace (point, ent->mins, ent->maxs, end, ent, MASK_SOLID);
// tr.ent HAS to be ground, but just in case we screwed something up:
if(tr.ent == ground)
if (tr.ent == ground)
{
onconveyor = true;
ent->velocity[0] = ground->movedir[0] * ground->speed;
ent->velocity[1] = ground->movedir[1] * ground->speed;
if(tr.plane.normal[2] > 0) {
if (tr.plane.normal[2] > 0) {
ent->velocity[2] = ground->speed *
sqrt(1.0 - tr.plane.normal[2]*tr.plane.normal[2]) /
tr.plane.normal[2];
if(DotProduct(ground->movedir,tr.plane.normal) > 0) {
if (DotProduct(ground->movedir,tr.plane.normal) > 0) {
// then we're moving down
ent->velocity[2] = -ent->velocity[2];
}
@ -1522,9 +1528,9 @@ void SV_Physics_Toss (edict_t *ent)
//if (mega_gibs->value && !strcmp(ent->classname, "gib") && !isinwater)
// gi.sound (ent, CHAN_VOICE, gi.soundindex ("misc/fhit3.wav"), 1, ATTN_NORM, 0);
}
else if((ent->movetype == MOVETYPE_RAIN) && (trace.plane.normal[2] <= 0.7))
else if ((ent->movetype == MOVETYPE_RAIN) && (trace.plane.normal[2] <= 0.7))
backoff = 2;
else if(trace.plane.normal[2] <= 0.7) // Lazarus - don't stop on steep incline
else if (trace.plane.normal[2] <= 0.7) // Lazarus - don't stop on steep incline
backoff = 1.5;
else
backoff = 1;
@ -1549,7 +1555,7 @@ void SV_Physics_Toss (edict_t *ent)
}
// Lazarus: MOVETYPE_RAIN doesn't cause splash noises when touching water
if(ent->movetype != MOVETYPE_RAIN)
if (ent->movetype != MOVETYPE_RAIN)
{
// check for water transition
wasinwater = (ent->watertype & MASK_WATER);
@ -1562,7 +1568,7 @@ void SV_Physics_Toss (edict_t *ent)
ent->waterlevel = 0;
// tpp... don't do sounds for the camera
if(Q_stricmp(ent->classname,"chasecam"))
if (Q_stricmp(ent->classname,"chasecam"))
{
if (!wasinwater && isinwater)
gi.positioned_sound (old_origin, g_edicts, CHAN_AUTO, gi.soundindex("misc/h2ohit1.wav"), 1, 1, 0);
@ -1640,10 +1646,10 @@ float RiderMass(edict_t *platform)
trace_t trace;
vec3_t point;
for(i=1, rider=g_edicts+i; i<=globals.num_edicts; i++, rider++) {
if(rider == platform) continue;
if(!rider->inuse) continue;
if(rider->groundentity == platform) {
for (i=1, rider=g_edicts+i; i<=globals.num_edicts; i++, rider++) {
if (rider == platform) continue;
if (!rider->inuse) continue;
if (rider->groundentity == platform) {
mass += rider->mass;
mass += RiderMass(rider);
} else if (rider->movetype == MOVETYPE_PUSHABLE ) {
@ -1657,7 +1663,7 @@ float RiderMass(edict_t *platform)
if ( trace.plane.normal[2] < 0.7 && !trace.startsolid)
continue;
if (!trace.startsolid && !trace.allsolid) {
if(trace.ent == platform) {
if (trace.ent == platform) {
mass += rider->mass;
mass += RiderMass(rider);
}
@ -1691,11 +1697,13 @@ void SV_Physics_Step (edict_t *ent)
VectorCopy(ent->s.origin,old_origin);
// Lazarus: If density hasn't been calculated yet, do so now
if (ent->mass > 0 && ent->density == 0.) {
if (ent->mass > 0 && ent->density == 0.)
{
ent->volume = ent->size[0] * ent->size[1] * ent->size[2];
ent->density = ent->mass/ent->volume;
if(ent->movetype == MOVETYPE_PUSHABLE) {
if (ent->movetype == MOVETYPE_PUSHABLE)
{
// This stuff doesn't apply to anything else, and... heh...
// caused monster_flipper to sink
@ -1709,13 +1717,14 @@ void SV_Physics_Step (edict_t *ent)
// (Otherwise, player might cause a 501 crate to leave
// water and expect to be able to push it.)
// Max floating density is then 0.0019073486328125
if(ent->density > WATER_DENSITY)
if (ent->density > WATER_DENSITY)
ent->flags &= ~FL_SWIM; // sinks like a rock
}
}
// If not a monster, then determine whether we're in water.
// (monsters take care of this in g_monster.c)
if (!(ent->svflags & SVF_MONSTER) && (ent->flags & FL_SWIM) ) {
if (!(ent->svflags & SVF_MONSTER) && (ent->flags & FL_SWIM) )
{
point[0] = (ent->absmax[0] + ent->absmin[0])/2;
point[1] = (ent->absmax[1] + ent->absmin[1])/2;
point[2] = ent->absmin[2] + 1;
@ -1724,7 +1733,8 @@ void SV_Physics_Step (edict_t *ent)
ent->waterlevel = 0;
ent->watertype = 0;
}
else {
else
{
ent->watertype = cont;
ent->waterlevel = 1;
point[2] = ent->absmin[2] + ent->size[2]/2;
@ -1755,7 +1765,8 @@ void SV_Physics_Step (edict_t *ent)
// swimming monsters who are in the water
if (! wasonground)
if (!(ent->flags & FL_FLY))
if (!((ent->flags & FL_SWIM) && (ent->waterlevel > 2))) {
if (!((ent->flags & FL_SWIM) && (ent->waterlevel > 2)))
{
if (ent->velocity[2] < sv_gravity->value*-0.1)
hitsound = true;
if (ent->waterlevel == 0)
@ -1763,7 +1774,8 @@ void SV_Physics_Step (edict_t *ent)
}
// friction for flying monsters that have been given vertical velocity
if ((ent->flags & FL_FLY) && (ent->velocity[2] != 0)) {
if ((ent->flags & FL_FLY) && (ent->velocity[2] != 0))
{
speed = fabs(ent->velocity[2]);
control = speed < sv_stopspeed->value ? sv_stopspeed->value : speed;
friction = sv_friction/3;
@ -1775,10 +1787,12 @@ void SV_Physics_Step (edict_t *ent)
}
// friction for swimming monsters that have been given vertical velocity
if (ent->movetype != MOVETYPE_PUSHABLE) {
if (ent->movetype != MOVETYPE_PUSHABLE)
{
// Lazarus: This is id's swag at drag. It works mostly, but for submerged
// crates we can do better.
if ((ent->flags & FL_SWIM) && (ent->velocity[2] != 0)) {
if ((ent->flags & FL_SWIM) && (ent->velocity[2] != 0))
{
speed = fabs(ent->velocity[2]);
control = speed < sv_stopspeed->value ? sv_stopspeed->value : speed;
newspeed = speed - (FRAMETIME * control * sv_waterfriction * ent->waterlevel);
@ -1799,7 +1813,7 @@ void SV_Physics_Step (edict_t *ent)
float Accel, Area, Drag, Force;
VectorCopy(point,end);
if(ent->waterlevel < 3) {
if (ent->waterlevel < 3) {
point[2] = ent->absmax[2];
end[2] = ent->absmin[2];
tr = gi.trace(point,NULL,NULL,end,ent,MASK_WATER);
@ -1852,7 +1866,7 @@ void SV_Physics_Step (edict_t *ent)
if (sv_gravity->value)
{
Drag = 0.00190735 * 1.05 * Area * (ent->velocity[2]*ent->velocity[2])/sv_gravity->value;
if(Drag > fabs(Force)) {
if (Drag > fabs(Force)) {
// Drag actually CAN be > total weight, but if we do this we tend to
// get crates flying back out of the water after being dropped from some
// height
@ -1906,7 +1920,8 @@ void SV_Physics_Step (edict_t *ent)
onconveyor = true;
ent->velocity[0] = ground->movedir[0] * ground->speed;
ent->velocity[1] = ground->movedir[1] * ground->speed;
if (tr.plane.normal[2] > 0) {
if (tr.plane.normal[2] > 0)
{
ent->velocity[2] = ground->speed *
sqrt(1.0 - tr.plane.normal[2]*tr.plane.normal[2]) /
tr.plane.normal[2];
@ -1931,7 +1946,8 @@ void SV_Physics_Step (edict_t *ent)
{
vel = ent->velocity;
speed = sqrt(vel[0]*vel[0] +vel[1]*vel[1]);
if (speed) {
if (speed)
{
friction = sv_friction;
control = speed < sv_stopspeed->value ? sv_stopspeed->value : speed;
@ -1959,26 +1975,26 @@ void SV_Physics_Step (edict_t *ent)
if (ent->movetype == MOVETYPE_PUSHABLE)
{
block = SV_PushableMove (ent, FRAMETIME, mask);
if(block && !(block & 8) && onconveyor)
if (block && !(block & 8) && onconveyor)
{
if(blocker && (blocker->takedamage == DAMAGE_YES))
if (blocker && (blocker->takedamage == DAMAGE_YES))
T_Damage(blocker,world,world,vec3_origin,ent->s.origin,vec3_origin,100000,1,0,MOD_CRUSH);
else
T_Damage(ent,world,world,vec3_origin,ent->s.origin,vec3_origin,100000,1,0,MOD_CRUSH);
if(!ent->inuse)
if (!ent->inuse)
return;
}
}
else
{
block = SV_FlyMove (ent, FRAMETIME, mask);
if(block && !(block & 8) && onconveyor)
if (block && !(block & 8) && onconveyor)
{
if(blocker && (blocker->takedamage == DAMAGE_YES))
if (blocker && (blocker->takedamage == DAMAGE_YES))
T_Damage(blocker,world,world,vec3_origin,ent->s.origin,vec3_origin,100000,1,0,MOD_CRUSH);
else
T_Damage (ent,world,world,vec3_origin,ent->s.origin,vec3_origin,100000,1,0,MOD_CRUSH);
if(!ent->inuse)
if (!ent->inuse)
return;
}
}
@ -1993,9 +2009,10 @@ void SV_Physics_Step (edict_t *ent)
gi.sound (ent, 0, gi.soundindex("world/land.wav"), 1, 1, 0);
// Move func_pushable riders
if(ent->movetype == MOVETYPE_PUSHABLE) {
if (ent->movetype == MOVETYPE_PUSHABLE)
{
trace_t tr;
if(ent->bounce_me == 2)
if (ent->bounce_me == 2)
VectorMA(old_origin,FRAMETIME,ent->velocity,ent->s.origin);
VectorSubtract(ent->s.origin,old_origin,move);
for (i=1, e=g_edicts+i; i<globals.num_edicts; i++, e++)
@ -2031,7 +2048,7 @@ void SV_Physics_Step (edict_t *ent)
{
if (ent->watertype & CONTENTS_MUD)
gi.sound (ent, CHAN_BODY, gi.soundindex("mud/mud_in2.wav"), 1, ATTN_NORM, 0);
else if( (ent->watertype & CONTENTS_SLIME) || (ent->watertype & CONTENTS_WATER) )
else if ( (ent->watertype & CONTENTS_SLIME) || (ent->watertype & CONTENTS_WATER) )
gi.sound (ent, CHAN_BODY, gi.soundindex("player/watr_in.wav"), 1, ATTN_NORM, 0);
}
@ -2103,7 +2120,7 @@ int SV_VehicleMove (edict_t *ent, float time, int mask)
retry:
trace = gi.trace (start, mins, maxs, end, ignore, mask);
if(trace.ent && (trace.ent->movewith_ent == ent) )
if (trace.ent && (trace.ent->movewith_ent == ent) )
{
ignore = trace.ent;
VectorCopy(trace.endpos,start);
@ -2113,7 +2130,7 @@ retry:
if (trace.allsolid)
{
// entity is trapped in another solid
if(trace.ent && (trace.ent->svflags & SVF_MONSTER)) {
if (trace.ent && (trace.ent->svflags & SVF_MONSTER)) {
// Monster stuck in vehicle. No matter how screwed up this is,
// we've gotta get him out of there.
// Give him a light-speed nudge and a velocity
@ -2127,13 +2144,13 @@ retry:
VectorMA(trace.ent->velocity,32,dir,new_velocity);
VectorMA(trace.ent->s.origin,FRAMETIME,new_velocity,new_origin);
tr = gi.trace(trace.ent->s.origin,trace.ent->mins,trace.ent->maxs,new_origin,trace.ent,MASK_MONSTERSOLID);
if(tr.fraction == 1) {
if (tr.fraction == 1) {
VectorCopy(new_origin,trace.ent->s.origin);
VectorCopy(new_velocity,trace.ent->velocity);
gi.linkentity(trace.ent);
}
}
else if(trace.ent->client && xy_speed > 0 )
else if (trace.ent->client && xy_speed > 0 )
{
// If player is relatively close to the vehicle move_origin, AND the
// vehicle is still moving, then most likely the player just disengaged
@ -2203,23 +2220,23 @@ not_allsolid:
break;
}
if(trace.ent->classname)
if (trace.ent->classname)
{
if(ent->owner && (trace.ent->svflags & (SVF_MONSTER | SVF_DEADMONSTER)))
if (ent->owner && (trace.ent->svflags & (SVF_MONSTER | SVF_DEADMONSTER)))
{
continue; // handled in vehicle_touch
}
else if(trace.ent->movetype != MOVETYPE_PUSHABLE)
else if (trace.ent->movetype != MOVETYPE_PUSHABLE)
{
// if not a func_pushable, match speeds...
VectorCopy(trace.ent->velocity,ent->velocity);
}
else if(ent->mass && VectorLength(ent->velocity))
else if (ent->mass && VectorLength(ent->velocity))
{
// otherwise push func_pushable (if vehicle has mass & is moving)
e = 0.0; // coefficient of restitution
m = (float)(ent->mass)/(float)(trace.ent->mass);
for(i=0; i<2; i++) {
for (i=0; i<2; i++) {
v11 = ent->velocity[i];
v21 = trace.ent->velocity[i];
v22 = ( e*m*(v11-v21) + m*v11 + v21 ) / (1.0 + m);
@ -2243,15 +2260,15 @@ not_allsolid:
}
// players, monsters and func_pushables don't block us
if(trace.ent->client) {
if (trace.ent->client) {
blocked = 0;
continue;
}
if(trace.ent->svflags & SVF_MONSTER) {
if (trace.ent->svflags & SVF_MONSTER) {
blocked = 0;
continue;
}
if(trace.ent->movetype == MOVETYPE_PUSHABLE)
if (trace.ent->movetype == MOVETYPE_PUSHABLE)
{
blocked = 0;
continue;
@ -2338,7 +2355,7 @@ void SV_Physics_Vehicle (edict_t *ent)
if (ent->velocity[2] || ent->velocity[1] || ent->velocity[0])
{
if(ent->org_size[0])
if (ent->org_size[0])
{
float ca, sa, yaw;
vec3_t p[2][2];
@ -2428,7 +2445,7 @@ trace_t SV_DebrisEntity (edict_t *ent, vec3_t push)
{
// touching a player or monster
// if rock has no mass we really don't care who it hits
if(!ent->mass) return trace;
if (!ent->mass) return trace;
speed1 = VectorLength(ent->velocity);
if (!speed1) return trace;
speed2 = VectorLength(trace.ent->velocity);
@ -2438,7 +2455,7 @@ trace_t SV_DebrisEntity (edict_t *ent, vec3_t push)
VectorNormalize(v2);
dot = -DotProduct(v1,v2);
speed1 += speed2 * dot;
if(speed1 <= 0) return trace;
if (speed1 <= 0) return trace;
scale = (float)ent->mass/200.*speed1;
VectorMA(trace.ent->velocity,scale,v1,trace.ent->velocity);
// Take a swag at it...
@ -2593,14 +2610,14 @@ void SV_Physics_Conveyor(edict_t *ent)
VectorScale(ent->movedir,ent->speed,v);
VectorScale(v,FRAMETIME,move);
for(i=0; i<game.maxclients; i++)
for (i=0; i<game.maxclients; i++)
{
player = g_edicts + 1 + i;
if(!player->inuse)
if (!player->inuse)
continue;
if(!player->groundentity)
if (!player->groundentity)
continue;
if(player->groundentity != ent)
if (player->groundentity != ent)
continue;
// Look below player; make sure he's on a conveyor
VectorCopy(player->s.origin,point);
@ -2609,12 +2626,12 @@ void SV_Physics_Conveyor(edict_t *ent)
end[2] -= 256;
tr = gi.trace (point, player->mins, player->maxs, end, player, MASK_SOLID);
// tr.ent HAS to be conveyor, but just in case we screwed something up:
if(tr.ent == ent)
if (tr.ent == ent)
{
if(tr.plane.normal[2] > 0) {
if (tr.plane.normal[2] > 0) {
v[2] = ent->speed * sqrt(1.0 - tr.plane.normal[2]*tr.plane.normal[2]) /
tr.plane.normal[2];
if(DotProduct(ent->movedir,tr.plane.normal) > 0) {
if (DotProduct(ent->movedir,tr.plane.normal) > 0) {
// then we're moving down
v[2] = -v[2];
}
@ -2636,7 +2653,7 @@ G_RunEntity
*/
void G_RunEntity (edict_t *ent)
{
if(level.freeze && Q_stricmp(ent->classname,"chasecam"))
if (level.freeze && Q_stricmp(ent->classname,"chasecam"))
return;
if (ent->prethink)

View file

@ -23,6 +23,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "g_local.h"
/* Func_reflect is adopted from psychospaz' original floor reflection code. See
psychospaz' stuff at http://modscape.telefragged.com
Chief differences:
1) The obvious - reflections work in 6 directions, not just the floor.
2) Uses a new entity rather than automatically doing reflections based on surface
or content properties of the floor.
3) Most TE_ effects are reflected, in addition to entities. This requires calls to
the appropriate ReflectXXXXX routine in several places scattered around the code.
4) Roll angle is correct.
You can have up to 16 func_reflects in one map. To increase that number change
MAX_MIRRORS below. The only reason to use a static limit is that the func_reflect
entity addresses get copied to g_mirror, which makes searching for func_reflects
much easier.
*/
#define MAX_MIRRORS 16
edict_t *g_mirror[MAX_MIRRORS];

View file

@ -604,7 +604,7 @@ void WriteField1 (FILE *f, field_t *field, byte *base)
case F_LSTRING:
case F_GSTRING:
if ( *(char **)p )
len = strlen(*(char **)p) + 1;
len = (int)strlen(*(char **)p) + 1;
else
len = 0;
*(int *)p = len;
@ -641,7 +641,7 @@ void WriteField1 (FILE *f, field_t *field, byte *base)
func = GetFunctionByAddress (*(byte **)p);
if (!func)
gi.error ("WriteField1: function not in list, can't save game");
len = strlen(func->funcStr)+1;
len = (int)strlen(func->funcStr)+1;
}
*(int *)p = len;
break;
@ -655,7 +655,7 @@ void WriteField1 (FILE *f, field_t *field, byte *base)
mmove = GetMmoveByAddress (*(mmove_t **)p);
if (!mmove)
gi.error ("WriteField1: mmove not in list, can't save game");
len = strlen(mmove->mmoveStr)+1;
len = (int)strlen(mmove->mmoveStr)+1;
}
*(int *)p = len;
break;
@ -701,7 +701,7 @@ void WriteField2 (FILE *f, field_t *field, byte *base)
case F_LSTRING:
if ( *(char **)p )
{
len = strlen(*(char **)p) + 1;
len = (int)strlen(*(char **)p) + 1;
fwrite (*(char **)p, len, 1, f);
}
break;
@ -712,7 +712,7 @@ void WriteField2 (FILE *f, field_t *field, byte *base)
func = GetFunctionByAddress (*(byte **)p);
if (!func)
gi.error ("WriteField2: function not in list, can't save game");
len = strlen(func->funcStr)+1;
len = (int)strlen(func->funcStr)+1;
fwrite (func->funcStr, len, 1, f);
}
break;
@ -722,7 +722,7 @@ void WriteField2 (FILE *f, field_t *field, byte *base)
mmove = GetMmoveByAddress (*(mmove_t **)p);
if (!mmove)
gi.error ("WriteField2: mmove not in list, can't save game");
len = strlen(mmove->mmoveStr)+1;
len = (int)strlen(mmove->mmoveStr)+1;
fwrite (mmove->mmoveStr, len, 1, f);
}
break;

View file

@ -524,7 +524,7 @@ char *ED_NewString (char *string)
char *newb, *new_p;
int i,l;
l = strlen(string) + 1;
l = (int)strlen(string) + 1;
newb = gi.TagMalloc (l, TAG_LEVEL);
@ -685,7 +685,7 @@ qboolean LoadAliasFile (char *name)
basedir = gi.cvar("basedir", "", 0);
gamedir = gi.cvar("gamedir", "", 0);
strncpy(filename, basedir->string, sizeof(filename));
Q_strncpyz(filename, basedir->string, sizeof(filename));
Com_sprintf(textname, sizeof(textname), name);
if (strlen(gamedir->string))
@ -809,7 +809,7 @@ qboolean ED_ParseEntityAlias (char *data, edict_t *ent)
gi.error ("ED_ParseEntityAlias: closing brace without entity data");
// if we've found the classname, exit loop
if (classname_found) {
strncpy (entclassname, search_token, sizeof(entclassname)-1);
Q_strncpyz (entclassname, search_token, sizeof(entclassname));
break;
}
}
@ -861,7 +861,7 @@ qboolean ED_ParseEntityAlias (char *data, edict_t *ent)
}
if (search_token[0] == '}')
break;
strncpy (keyname, search_token, sizeof(keyname)-1);
Q_strncpyz (keyname, search_token, sizeof(keyname));
// parse value
search_token = COM_Parse (&search_data);
@ -918,7 +918,7 @@ char *ED_ParseEdict (char *data, edict_t *ent)
if (!data)
gi.error ("ED_ParseEntity: EOF without closing brace");
strncpy (keyname, com_token, sizeof(keyname)-1);
Q_strncpyz (keyname, com_token, sizeof(keyname));
// parse value
com_token = COM_Parse (&data);
@ -1150,8 +1150,8 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
// Lazarus: last frame a gib was spawned in
lastgibframe = 0;
strncpy (level.mapname, mapname, sizeof(level.mapname)-1);
strncpy (game.spawnpoint, spawnpoint, sizeof(game.spawnpoint)-1);
Q_strncpyz (level.mapname, mapname, sizeof(level.mapname));
Q_strncpyz (game.spawnpoint, spawnpoint, sizeof(game.spawnpoint));
// set client fields on player ents
for (i=0 ; i<game.maxclients ; i++)
@ -1573,10 +1573,10 @@ void SP_worldspawn (edict_t *ent)
if (ent->message && ent->message[0])
{
gi.configstring (CS_NAME, ent->message);
strncpy (level.level_name, ent->message, sizeof(level.level_name));
Q_strncpyz (level.level_name, ent->message, sizeof(level.level_name));
}
else
strncpy (level.level_name, level.mapname, sizeof(level.level_name));
Q_strncpyz (level.level_name, level.mapname, sizeof(level.level_name));
if (st.sky && st.sky[0])
gi.configstring (CS_SKY, st.sky);
@ -1727,6 +1727,7 @@ void SP_worldspawn (edict_t *ent)
sm_meat_index = gi.modelindex ("models/objects/gibs/sm_meat/tris.md2");
gi.modelindex ("models/objects/gibs/arm/tris.md2");
gi.modelindex ("models/objects/gibs/leg/tris.md2");
gi.modelindex ("models/objects/gibs/bone/tris.md2");
gi.modelindex ("models/objects/gibs/bone2/tris.md2");
gi.modelindex ("models/objects/gibs/chest/tris.md2");

File diff suppressed because it is too large Load diff

View file

@ -1341,13 +1341,13 @@ void trigger_speaker_think (edict_t *self)
touching = NULL;
for (i = 1; i <= maxclients->value && !touching; i++) {
player = &g_edicts[i];
if(!player->inuse) continue;
if(player->s.origin[0] < self->s.origin[0] + self->bleft[0]) continue;
if(player->s.origin[1] < self->s.origin[1] + self->bleft[1]) continue;
if(player->s.origin[2] < self->s.origin[2] + self->bleft[2]) continue;
if(player->s.origin[0] > self->s.origin[0] + self->tright[0]) continue;
if(player->s.origin[1] > self->s.origin[1] + self->tright[1]) continue;
if(player->s.origin[2] > self->s.origin[2] + self->tright[2]) continue;
if (!player->inuse) continue;
if (player->s.origin[0] < self->s.origin[0] + self->bleft[0]) continue;
if (player->s.origin[1] < self->s.origin[1] + self->bleft[1]) continue;
if (player->s.origin[2] < self->s.origin[2] + self->bleft[2]) continue;
if (player->s.origin[0] > self->s.origin[0] + self->tright[0]) continue;
if (player->s.origin[1] > self->s.origin[1] + self->tright[1]) continue;
if (player->s.origin[2] > self->s.origin[2] + self->tright[2]) continue;
touching = player;
}
if(touching)
@ -1448,7 +1448,7 @@ void WriteTransitionEdict (FILE *f, edict_t *changelevel, edict_t *ent)
if (!Q_stricmp(e.classname,"target_speaker"))
e.spawnflags |= 8; // indicates that "message" contains noise
if(changelevel->s.angles[YAW])
if (changelevel->s.angles[YAW])
{
vec3_t angles;
vec3_t forward, right, v;
@ -1568,7 +1568,11 @@ entlist_t DoNotMove[] = {
void trans_ent_filename (char *filename, size_t filenameSize)
{
#if defined (_M_X64) || defined (_M_AMD64) || defined (__x86_64__)
SavegameDirRelativePath("save_x64/trans.ent", filename, filenameSize);
#else
SavegameDirRelativePath("save/trans.ent", filename, filenameSize);
#endif
}
int trigger_transition_ents (edict_t *changelevel, edict_t *self)
@ -1583,25 +1587,25 @@ int trigger_transition_ents (edict_t *changelevel, edict_t *self)
trans_ent_filename(t_file, sizeof(t_file));
f = fopen(t_file,"wb");
if(!f)
if (!f)
{
gi.dprintf("Error opening %s for writing\n",t_file);
return 0;
}
// First scan entities for brush models that SHOULD change levels, e.g. func_tracktrain,
// which had better have a partner train in the next map... or we'll bitch loudly
for(i=game.maxclients+1; i<globals.num_edicts; i++)
for (i=game.maxclients+1; i<globals.num_edicts; i++)
{
ent = &g_edicts[i];
if(!ent->inuse) continue;
if(ent->solid != SOLID_BSP) continue;
if(ent->s.origin[0] > self->maxs[0]) continue;
if(ent->s.origin[1] > self->maxs[1]) continue;
if(ent->s.origin[2] > self->maxs[2]) continue;
if(ent->s.origin[0] < self->mins[0]) continue;
if(ent->s.origin[1] < self->mins[1]) continue;
if(ent->s.origin[2] < self->mins[2]) continue;
if(!Q_stricmp(ent->classname,"func_tracktrain") && !(ent->spawnflags & 8) && ent->targetname)
if (!ent->inuse) continue;
if (ent->solid != SOLID_BSP) continue;
if (ent->s.origin[0] > self->maxs[0]) continue;
if (ent->s.origin[1] > self->maxs[1]) continue;
if (ent->s.origin[2] > self->maxs[2]) continue;
if (ent->s.origin[0] < self->mins[0]) continue;
if (ent->s.origin[1] < self->mins[1]) continue;
if (ent->s.origin[2] < self->mins[2]) continue;
if (!Q_stricmp(ent->classname,"func_tracktrain") && !(ent->spawnflags & 8) && ent->targetname)
{
edict_t *e;
@ -1626,7 +1630,7 @@ int trigger_transition_ents (edict_t *changelevel, edict_t *self)
e->radius = ent->moveinfo.distance;
e->solid = SOLID_NOT;
e->svflags |= SVF_NOCLIENT;
if(ent->owner)
if (ent->owner)
e->style = ent->owner - g_edicts;
else
e->style = 0;
@ -1641,32 +1645,32 @@ int trigger_transition_ents (edict_t *changelevel, edict_t *self)
}
}
for(i=game.maxclients+1; i<globals.num_edicts; i++)
for (i=game.maxclients+1; i<globals.num_edicts; i++)
{
ent = &g_edicts[i];
ent->id = 0;
if(!ent->inuse) continue;
if (!ent->inuse) continue;
// Pass up owned entities not owned by the player on this pass...
// get 'em next pass so we'll know whether owner is in our list
if(ent->owner && !ent->owner->client) continue;
if(ent->movewith) continue;
if(ent->s.origin[0] > self->maxs[0]) continue;
if(ent->s.origin[1] > self->maxs[1]) continue;
if(ent->s.origin[2] > self->maxs[2]) continue;
if(ent->s.origin[0] < self->mins[0]) continue;
if(ent->s.origin[1] < self->mins[1]) continue;
if(ent->s.origin[2] < self->mins[2]) continue;
if(ent->solid == SOLID_BSP) continue;
if((ent->solid == SOLID_TRIGGER) && !FindItemByClassname(ent->classname)) continue;
if (ent->owner && !ent->owner->client) continue;
if (ent->movewith) continue;
if (ent->s.origin[0] > self->maxs[0]) continue;
if (ent->s.origin[1] > self->maxs[1]) continue;
if (ent->s.origin[2] > self->maxs[2]) continue;
if (ent->s.origin[0] < self->mins[0]) continue;
if (ent->s.origin[1] < self->mins[1]) continue;
if (ent->s.origin[2] < self->mins[2]) continue;
if (ent->solid == SOLID_BSP) continue;
if ((ent->solid == SOLID_TRIGGER) && !FindItemByClassname(ent->classname)) continue;
// Do not under any circumstances move these entities:
for(p=DoNotMove, nogo=false; p->name && !nogo; p++)
if(!Q_stricmp(ent->classname,p->name))
for (p=DoNotMove, nogo=false; p->name && !nogo; p++)
if (!Q_stricmp(ent->classname,p->name))
nogo = true;
if(nogo) continue;
if(!HasSpawnFunction(ent)) continue;
if (nogo) continue;
if (!HasSpawnFunction(ent)) continue;
total++;
ent->id = total;
if(ent->owner)
if (ent->owner)
ent->owner_id = -(ent->owner - g_edicts);
else
ent->owner_id = 0;
@ -1675,34 +1679,34 @@ int trigger_transition_ents (edict_t *changelevel, edict_t *self)
ent->inuse = false;
}
// Repeat, ONLY for ents owned by non-players
for(i=game.maxclients+1; i<globals.num_edicts; i++)
for (i=game.maxclients+1; i<globals.num_edicts; i++)
{
ent = &g_edicts[i];
if(!ent->inuse) continue;
if(!ent->owner) continue;
if(ent->owner->client) continue;
if(ent->movewith) continue;
if(ent->solid == SOLID_BSP) continue;
if((ent->solid == SOLID_TRIGGER) && !FindItemByClassname(ent->classname)) continue;
if (!ent->inuse) continue;
if (!ent->owner) continue;
if (ent->owner->client) continue;
if (ent->movewith) continue;
if (ent->solid == SOLID_BSP) continue;
if ((ent->solid == SOLID_TRIGGER) && !FindItemByClassname(ent->classname)) continue;
// Do not under any circumstances move these entities:
for(p=DoNotMove, nogo=false; p->name && !nogo; p++)
if(!Q_stricmp(ent->classname,p->name))
for (p=DoNotMove, nogo=false; p->name && !nogo; p++)
if (!Q_stricmp(ent->classname,p->name))
nogo = true;
if(nogo) continue;
if(!HasSpawnFunction(ent)) continue;
if(ent->s.origin[0] > self->maxs[0]) continue;
if(ent->s.origin[1] > self->maxs[1]) continue;
if(ent->s.origin[2] > self->maxs[2]) continue;
if(ent->s.origin[0] < self->mins[0]) continue;
if(ent->s.origin[1] < self->mins[1]) continue;
if(ent->s.origin[2] < self->mins[2]) continue;
if (nogo) continue;
if (!HasSpawnFunction(ent)) continue;
if (ent->s.origin[0] > self->maxs[0]) continue;
if (ent->s.origin[1] > self->maxs[1]) continue;
if (ent->s.origin[2] > self->maxs[2]) continue;
if (ent->s.origin[0] < self->mins[0]) continue;
if (ent->s.origin[1] < self->mins[1]) continue;
if (ent->s.origin[2] < self->mins[2]) continue;
ent->owner_id = 0;
for(j=game.maxclients+1; j<globals.num_edicts && !ent->owner_id; j++)
for (j=game.maxclients+1; j<globals.num_edicts && !ent->owner_id; j++)
{
if(ent->owner == &g_edicts[j])
if (ent->owner == &g_edicts[j])
ent->owner_id = g_edicts[j].id;
}
if(!ent->owner_id) continue;
if (!ent->owner_id) continue;
total++;
ent->id = total;
WriteTransitionEdict(f,changelevel,ent);
@ -1717,7 +1721,7 @@ int trigger_transition_ents (edict_t *changelevel, edict_t *self)
void SP_trigger_transition (edict_t *self)
{
if(!self->targetname)
if (!self->targetname)
{
gi.dprintf("trigger_transition w/o a targetname\n");
G_FreeEdict(self);

View file

@ -173,7 +173,7 @@ void hrocket_turret_fire (edict_t *self, edict_t *owner, vec3_t start, vec3_t di
}
//CW--
static unsigned long HB_Shots;
static unsigned int /*long*/ HB_Shots;
void turret_breach_fire (edict_t *self)
{

View file

@ -39,7 +39,7 @@ void func_vehicle_explode (edict_t *self, edict_t *inflictor, edict_t *attacker,
int count;
int mass;
if(self->deathtarget)
if (self->deathtarget)
{
self->target = self->deathtarget;
G_UseTargets (self, attacker);
@ -70,7 +70,7 @@ void func_vehicle_explode (edict_t *self, edict_t *inflictor, edict_t *attacker,
count = mass / 100;
if (count > 8)
count = 8;
while(count--)
while (count--)
{
chunkorigin[0] = origin[0] + crandom() * size[0];
chunkorigin[1] = origin[1] + crandom() * size[1];
@ -83,7 +83,7 @@ void func_vehicle_explode (edict_t *self, edict_t *inflictor, edict_t *attacker,
count = mass / 25;
if (count > 16)
count = 16;
while(count--)
while (count--)
{
chunkorigin[0] = origin[0] + crandom() * size[0];
chunkorigin[1] = origin[1] + crandom() * size[1];
@ -101,7 +101,7 @@ void vehicle_blocked (edict_t *self, edict_t *other)
{
edict_t *attacker;
if((self->spawnflags & VEHICLE_BLOCK_STOPS) || (other == world))
if ((self->spawnflags & VEHICLE_BLOCK_STOPS) || (other == world))
{
VectorClear(self->velocity);
VectorClear(self->avelocity);
@ -162,7 +162,7 @@ void vehicle_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *
// players and monsters
if (!other->client && !(other->svflags & SVF_MONSTER)) return;
vspeed = VectorLength(self->velocity);
if(!vspeed) return;
if (!vspeed) return;
VectorSubtract(other->s.origin,self->s.origin,dir);
dir[2] = 0;
VectorNormalize(dir);
@ -174,10 +174,10 @@ void vehicle_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *
vspeed *= DotProduct(dir,v);
mspeed = VectorLength(other->velocity) * DotProduct(dir,v);
vspeed -= mspeed;
if(vspeed <= 0.) return;
if (vspeed <= 0.0) return;
// for speed < 200, don't do damage but move monster
if(vspeed < 200) {
if(other->mass > self->mass) vspeed *= (float)self->mass/other->mass;
if (vspeed < 200) {
if (other->mass > self->mass) vspeed *= (float)self->mass/other->mass;
VectorMA(other->velocity,vspeed,dir,new_velocity);
VectorMA(other->s.origin,FRAMETIME,new_velocity,new_origin);
new_origin[2] += 2;
@ -185,7 +185,7 @@ void vehicle_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *
VectorCopy(new_origin,end);
end[2] -= 1;
tr = gi.trace(new_origin,other->mins,other->maxs,end,self,CONTENTS_SOLID);
if(tr.startsolid)
if (tr.startsolid)
// splat
T_Damage (other, self, self->owner, dir, self->s.origin, vec3_origin,
other->health - other->gib_health + 1, 0, 0, MOD_VEHICLE);
@ -207,7 +207,7 @@ void vehicle_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *
dir[2] = 0.2; // make knockback slightly upward
VectorMA(other->velocity,vspeed,dir,new_velocity);
VectorMA(other->s.origin,FRAMETIME,new_velocity,new_origin);
if(gi.pointcontents(new_origin) & CONTENTS_SOLID)
if (gi.pointcontents(new_origin) & CONTENTS_SOLID)
knockback = (160.0f/500.0f) * 200.0f * (self->mass/2000.0f * vspeed*vspeed/160000);
else {
knockback = 0;
@ -226,7 +226,7 @@ void vehicle_disengage (edict_t *vehicle)
vec3_t forward, left, f1, l1;
driver = vehicle->owner;
if(!driver) return;
if (!driver) return;
AngleVectors(vehicle->s.angles, forward, left, NULL);
VectorCopy(vehicle->velocity,driver->velocity);
@ -257,12 +257,12 @@ void vehicle_think (edict_t *self)
VectorCopy(self->oldvelocity,v);
v[2] = 0;
speed = VectorLength(v);
if(speed > 0)
if (speed > 0)
self->s.effects |= EF_ANIM_ALL;
else
self->s.effects &= ~EF_ANIM_ALL;
AngleVectors(self->s.angles, forward, left, NULL);
if(DotProduct(forward,self->oldvelocity) < 0) speed = -speed;
if (DotProduct(forward,self->oldvelocity) < 0) speed = -speed;
self->moveinfo.current_speed = speed;
if (self->owner)
@ -277,7 +277,7 @@ void vehicle_think (edict_t *self)
{
// if he's pressing the use key, and he didn't just
// get on or off, disengage
if(level.framenum - self->owner->client->vehicle_framenum > 2)
if (level.framenum - self->owner->client->vehicle_framenum > 2)
{
VectorCopy(self->velocity,self->oldvelocity);
vehicle_disengage(self);
@ -286,9 +286,9 @@ void vehicle_think (edict_t *self)
}
if (self->owner->client->ucmd.forwardmove != 0 && level.time > self->moveinfo.wait)
{
if(self->owner->client->ucmd.forwardmove > 0)
if (self->owner->client->ucmd.forwardmove > 0)
{
if(self->moveinfo.state < FAST)
if (self->moveinfo.state < FAST)
{
self->moveinfo.state++;
self->moveinfo.next_speed = self->moveinfo.state * self->speed/3;
@ -297,7 +297,7 @@ void vehicle_think (edict_t *self)
}
else
{
if(self->moveinfo.state > RFAST)
if (self->moveinfo.state > RFAST)
{
self->moveinfo.state--;
self->moveinfo.next_speed = self->moveinfo.state * self->speed/3;
@ -305,27 +305,27 @@ void vehicle_think (edict_t *self)
}
}
}
if(self->moveinfo.current_speed < self->moveinfo.next_speed)
if (self->moveinfo.current_speed < self->moveinfo.next_speed)
{
speed = self->moveinfo.current_speed + self->accel/10;
if(speed > self->moveinfo.next_speed) speed = self->moveinfo.next_speed;
if (speed > self->moveinfo.next_speed) speed = self->moveinfo.next_speed;
}
else if(self->moveinfo.current_speed > self->moveinfo.next_speed)
else if (self->moveinfo.current_speed > self->moveinfo.next_speed)
{
speed = self->moveinfo.current_speed - self->decel/10;
if(speed < self->moveinfo.next_speed) speed = self->moveinfo.next_speed;
if (speed < self->moveinfo.next_speed) speed = self->moveinfo.next_speed;
}
VectorScale(forward,speed,self->velocity);
if (self->owner->client->ucmd.sidemove != 0 && speed != 0 )
{
aspeed = 180.*speed/(M_PI*self->radius);
if(self->owner->client->ucmd.sidemove > 0) aspeed = -aspeed;
if (self->owner->client->ucmd.sidemove > 0) aspeed = -aspeed;
self->avelocity[1] = aspeed;
}
else
self->avelocity[1] = 0;
if(speed != 0)
if (speed != 0)
self->s.sound = self->noise_index;
else
self->s.sound = self->noise_index2;
@ -343,7 +343,7 @@ void vehicle_think (edict_t *self)
VectorAdd(self->owner->s.origin,l1,self->owner->s.origin);
self->owner->s.origin[2] += self->move_origin[2];
// If moving, turn driver
if(speed != 0)
if (speed != 0)
{
float yaw;
yaw = self->avelocity[1]*FRAMETIME;
@ -364,9 +364,9 @@ void vehicle_think (edict_t *self)
//
// if vehicle has stopped, drop it to ground.
// otherwise slow it down
if(speed==0)
if (speed==0)
{
if(!self->groundentity)
if (!self->groundentity)
SV_AddGravity (self);
}
else
@ -374,7 +374,7 @@ void vehicle_think (edict_t *self)
// no driver... slow to an eventual stop in no more than 5 sec.
self->moveinfo.next_speed = 0;
self->moveinfo.state = STOP;
if(speed > 0)
if (speed > 0)
newspeed = max(0.,speed - self->speed/50);
else
newspeed = min(0.,speed + self->speed/50);
@ -410,7 +410,7 @@ void vehicle_think (edict_t *self)
self->s.origin[2] += 1;
gi.linkentity(self);
if(self->message)
if (self->message)
safe_centerprintf(ent,self->message);
self->owner = ent;
ent->movetype = MOVETYPE_PUSH;
@ -431,7 +431,7 @@ void vehicle_think (edict_t *self)
}
}
}
if(self->movewith_next && (self->movewith_next->movewith_ent == self))
if (self->movewith_next && (self->movewith_next->movewith_ent == self))
set_child_movement(self);
}

View file

@ -170,7 +170,7 @@ typedef struct
void (*WriteAngle) (float f);
// managed memory allocation
void *(*TagMalloc) (int size, int tag);
void *(*TagMalloc) (size_t size, int tag); // Knightmare- was int size
void (*TagFree) (void *block);
void (*FreeTags) (int tag);
@ -207,6 +207,7 @@ typedef struct
char *(*SaveGameDir) (void);
void (*CreatePath) (char *path);
char **(*GetFileList) (const char *path, const char *extension, int *num);
// void (*cvar_setdescription) (char *var_name, char *description);
#endif
} game_import_t;

View file

@ -107,7 +107,7 @@ mmove_t actor_move_stand = {FRAME_stand01, FRAME_stand40, actor_frames_stand, NU
void actor_stand (edict_t *self)
{
self->s.sound = 0;
if(self->monsterinfo.aiflags & AI_CROUCH)
if (self->monsterinfo.aiflags & AI_CROUCH)
self->monsterinfo.currentmove = &actor_move_crouch;
else
self->monsterinfo.currentmove = &actor_move_stand;
@ -152,11 +152,11 @@ void actor_walk (edict_t *self)
// prevent foolishness:
if (self->monsterinfo.aiflags & AI_FOLLOW_LEADER)
{
if(!self->movetarget || !self->movetarget->inuse || (self->movetarget == world))
if (!self->movetarget || !self->movetarget->inuse || (self->movetarget == world))
self->movetarget = self->monsterinfo.leader;
}
if( (self->monsterinfo.aiflags & AI_FOLLOW_LEADER) &&
if ( (self->monsterinfo.aiflags & AI_FOLLOW_LEADER) &&
(self->movetarget) &&
(self->movetarget->inuse) &&
(self->movetarget->health > 0) )
@ -164,10 +164,10 @@ void actor_walk (edict_t *self)
float R;
R = realrange(self,self->movetarget);
if(R > ACTOR_FOLLOW_RUN_RANGE || self->enemy)
if (R > ACTOR_FOLLOW_RUN_RANGE || self->enemy)
{
self->monsterinfo.currentmove = &actor_move_run;
if(self->monsterinfo.aiflags & AI_CROUCH)
if (self->monsterinfo.aiflags & AI_CROUCH)
{
self->monsterinfo.aiflags &= ~AI_CROUCH;
self->maxs[2] += 28;
@ -175,17 +175,17 @@ void actor_walk (edict_t *self)
self->move_origin[2] += 28;
}
}
else if(R <= ACTOR_FOLLOW_STAND_RANGE && self->movetarget->client)
else if (R <= ACTOR_FOLLOW_STAND_RANGE && self->movetarget->client)
{
self->monsterinfo.pausetime = level.time + 0.5;
if(self->monsterinfo.aiflags & AI_CROUCH)
if (self->monsterinfo.aiflags & AI_CROUCH)
self->monsterinfo.currentmove = &actor_move_crouch;
else
self->monsterinfo.currentmove = &actor_move_stand;
}
else
{
if(self->monsterinfo.aiflags & AI_CROUCH)
if (self->monsterinfo.aiflags & AI_CROUCH)
self->monsterinfo.currentmove = &actor_move_crouchwalk;
else
self->monsterinfo.currentmove = &actor_move_walk;
@ -193,7 +193,7 @@ void actor_walk (edict_t *self)
}
else
{
if(self->monsterinfo.aiflags & AI_CROUCH)
if (self->monsterinfo.aiflags & AI_CROUCH)
self->monsterinfo.currentmove = &actor_move_crouchwalk;
else
self->monsterinfo.currentmove = &actor_move_walk;
@ -233,11 +233,11 @@ void actor_walk_back (edict_t *self)
// prevent foolishness:
if (self->monsterinfo.aiflags & AI_FOLLOW_LEADER)
{
if(!self->movetarget || !self->movetarget->inuse || (self->movetarget == world))
if (!self->movetarget || !self->movetarget->inuse || (self->movetarget == world))
self->movetarget = self->monsterinfo.leader;
}
if( (self->monsterinfo.aiflags & AI_FOLLOW_LEADER) &&
if ( (self->monsterinfo.aiflags & AI_FOLLOW_LEADER) &&
(self->movetarget) &&
(self->movetarget->inuse) &&
(self->movetarget->health > 0) )
@ -245,17 +245,17 @@ void actor_walk_back (edict_t *self)
float R;
R = realrange(self,self->movetarget);
if(R <= ACTOR_FOLLOW_STAND_RANGE && self->movetarget->client)
if (R <= ACTOR_FOLLOW_STAND_RANGE && self->movetarget->client)
{
self->monsterinfo.pausetime = level.time + 0.5;
if(self->monsterinfo.aiflags & AI_CROUCH)
if (self->monsterinfo.aiflags & AI_CROUCH)
self->monsterinfo.currentmove = &actor_move_crouch;
else
self->monsterinfo.currentmove = &actor_move_stand;
}
else
{
if(self->monsterinfo.aiflags & AI_CROUCH)
if (self->monsterinfo.aiflags & AI_CROUCH)
self->monsterinfo.currentmove = &actor_move_crouchwalk_back;
else
self->monsterinfo.currentmove = &actor_move_walk_back;
@ -263,7 +263,7 @@ void actor_walk_back (edict_t *self)
}
else
{
if(self->monsterinfo.aiflags & AI_CROUCH)
if (self->monsterinfo.aiflags & AI_CROUCH)
self->monsterinfo.currentmove = &actor_move_crouchwalk_back;
else
self->monsterinfo.currentmove = &actor_move_walk_back;
@ -334,7 +334,7 @@ void actor_run (edict_t *self)
// prevent foolishness:
if (self->monsterinfo.aiflags & AI_FOLLOW_LEADER)
{
if(!self->movetarget || !self->movetarget->inuse || (self->movetarget == world))
if (!self->movetarget || !self->movetarget->inuse || (self->movetarget == world))
self->movetarget = self->monsterinfo.leader;
}
if ((level.time < self->pain_debounce_time) && (!self->enemy))
@ -352,7 +352,7 @@ void actor_run (edict_t *self)
return;
}
if( self->monsterinfo.aiflags & AI_CROUCH)
if ( self->monsterinfo.aiflags & AI_CROUCH)
{
self->monsterinfo.aiflags &= ~AI_CROUCH;
self->maxs[2] += 28;
@ -360,7 +360,7 @@ void actor_run (edict_t *self)
self->move_origin[2] += 28;
}
if( self->monsterinfo.aiflags & AI_GOOD_GUY ) {
if ( self->monsterinfo.aiflags & AI_GOOD_GUY ) {
self->monsterinfo.currentmove = &actor_move_run;
}
else
@ -385,7 +385,7 @@ void actor_run_back (edict_t *self)
// prevent foolishness:
if (self->monsterinfo.aiflags & AI_FOLLOW_LEADER)
{
if(!self->movetarget || !self->movetarget->inuse || (self->movetarget == world))
if (!self->movetarget || !self->movetarget->inuse || (self->movetarget == world))
self->movetarget = self->monsterinfo.leader;
}
if ((level.time < self->pain_debounce_time) && (!self->enemy))
@ -403,7 +403,7 @@ void actor_run_back (edict_t *self)
return;
}
if( self->monsterinfo.aiflags & AI_CROUCH)
if ( self->monsterinfo.aiflags & AI_CROUCH)
{
self->monsterinfo.aiflags &= ~AI_CROUCH;
self->maxs[2] += 28;
@ -485,7 +485,7 @@ void actor_ideal_range(edict_t *self)
weapon = self->actor_weapon[self->actor_current_weapon];
switch(weapon)
switch (weapon)
{
case 2:
self->monsterinfo.ideal_range[0] = 0;
@ -614,7 +614,7 @@ void actor_dead (edict_t *self)
M_FlyCheck (self);
// Lazarus monster fade
if(world->effects & FX_WORLDSPAWN_CORPSEFADE)
if (world->effects & FX_WORLDSPAWN_CORPSEFADE)
{
self->think=FadeDieSink;
self->nextthink=level.time+corpse_fadetime->value;
@ -673,9 +673,9 @@ void actor_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage
self->deadflag = DEAD_DEAD;
self->takedamage = DAMAGE_YES;
if(self->monsterinfo.aiflags & AI_CHASE_THING)
if (self->monsterinfo.aiflags & AI_CHASE_THING)
{
if(self->movetarget && !Q_stricmp(self->movetarget->classname,"thing"))
if (self->movetarget && !Q_stricmp(self->movetarget->classname,"thing"))
{
G_FreeEdict(self->movetarget);
self->movetarget = NULL;
@ -694,7 +694,8 @@ void actor_fire (edict_t *self)
weapon = self->actor_weapon[self->actor_current_weapon];
switch(weapon) {
switch (weapon)
{
case 1:
actorBlaster (self);
break;
@ -765,39 +766,39 @@ void actor_seekcover (edict_t *self)
trace_t trace1, trace2;
// No point in hiding from enemy if.. we don't have an enemy
if(!self->enemy || !self->enemy->inuse)
if (!self->enemy || !self->enemy->inuse)
{
actor_run(self);
return;
}
if(!actorscram->value)
if (!actorscram->value)
{
actor_run(self);
return;
}
// Don't hide from non-humanoid stuff
if(!self->enemy->client && !(self->enemy->svflags & SVF_MONSTER))
if (!self->enemy->client && !(self->enemy->svflags & SVF_MONSTER))
{
actor_run(self);
return;
}
// This shouldn't happen, we're just being cautious. Quit now if
// already chasing a "thing"
if(self->movetarget && !Q_stricmp(self->movetarget->classname,"thing"))
if (self->movetarget && !Q_stricmp(self->movetarget->classname,"thing"))
{
actor_run(self);
return;
}
// Don't bother finding cover if we're within melee range of enemy
VectorSubtract(self->enemy->s.origin,self->s.origin,atk);
if(VectorLength(atk) < 80)
if (VectorLength(atk) < 80)
{
actor_run(self);
return;
}
VectorCopy(self->mins,mins);
mins[2] += 18;
if(mins[2] > 0) mins[2] = 0;
if (mins[2] > 0) mins[2] = 0;
VectorCopy(self->maxs,maxs);
// Find a vector that will hide the actor from his enemy
@ -806,9 +807,9 @@ void actor_seekcover (edict_t *self)
VectorClear(best_dir);
AngleVectors(self->s.angles,forward,NULL,NULL);
dir[2] = 0;
for(travel=64; travel<257 && best_dist == 0; travel *= 2)
for (travel=64; travel<257 && best_dist == 0; travel *= 2)
{
for(i=0; i<8 && best_dist == 0; i++)
for (i=0; i<8 && best_dist == 0; i++)
{
yaw = self->s.angles[YAW] + chase_angle[i];
yaw = (int)(yaw/45)*45;
@ -822,31 +823,31 @@ void actor_seekcover (edict_t *self)
// isn't foolproof - tests against 1) new origin, 2-5) each corner of top
// of bounding box.
trace2 = gi.trace(trace1.endpos,NULL,NULL,atk,self,MASK_SOLID);
if(trace2.fraction == 1.0) continue;
if (trace2.fraction == 1.0) continue;
VectorAdd(trace1.endpos,self->maxs,testpos);
trace2 = gi.trace(testpos,NULL,NULL,atk,self,MASK_SOLID);
if(trace2.fraction == 1.0) continue;
if (trace2.fraction == 1.0) continue;
testpos[0] = trace1.endpos[0] + self->mins[0];
trace2 = gi.trace(testpos,NULL,NULL,atk,self,MASK_SOLID);
if(trace2.fraction == 1.0) continue;
if (trace2.fraction == 1.0) continue;
testpos[1] = trace1.endpos[1] + self->mins[1];
trace2 = gi.trace(testpos,NULL,NULL,atk,self,MASK_SOLID);
if(trace2.fraction == 1.0) continue;
if (trace2.fraction == 1.0) continue;
testpos[0] = trace1.endpos[0] + self->maxs[0];
trace2 = gi.trace(testpos,NULL,NULL,atk,self,MASK_SOLID);
if(trace2.fraction == 1.0) continue;
if (trace2.fraction == 1.0) continue;
best_dist = trace1.fraction * travel;
if(best_dist < 32) // not much point to this move
if (best_dist < 32) // not much point to this move
continue;
VectorCopy(dir,best_dir);
}
}
if(best_dist < 32)
if (best_dist < 32)
{
actor_run(self);
return;
@ -908,7 +909,7 @@ void actor_attack (edict_t *self)
if ( w_select == 0 && self->actor_weapon[1] > 0 )
{
VectorSubtract(self->s.origin,self->enemy->s.origin,v);
if(VectorLength(v) < 200)
if (VectorLength(v) < 200)
{
self->monsterinfo.currentmove = &actor_move_switch;
return;
@ -917,7 +918,7 @@ void actor_attack (edict_t *self)
else if ( w_select == 1 && self->actor_weapon[0] > 0 )
{
VectorSubtract(self->s.origin,self->enemy->s.origin,v);
if(VectorLength(v) > 300)
if (VectorLength(v) > 300)
{
self->monsterinfo.currentmove = &actor_move_switch;
return;
@ -928,13 +929,13 @@ void actor_attack (edict_t *self)
self->actor_gunframe = 0;
// temporary deal to toggle crouch
/* if(self->actor_crouch_time < level.time)
/* if (self->actor_crouch_time < level.time)
self->actor_crouch_time = level.time + 5;
else
self->actor_crouch_time = 0; */
// end temp
if(self->actor_crouch_time < level.time)
if (self->actor_crouch_time < level.time)
attackmove = &actor_move_attack;
else
attackmove = &actor_move_crattack;
@ -985,7 +986,7 @@ void actor_attack (edict_t *self)
self->monsterinfo.pausetime = level.time + 3;
break;
case 10:
if(level.time > self->endtime)
if (level.time > self->endtime)
{
self->monsterinfo.currentmove = attackmove;
self->monsterinfo.pausetime = level.time + 1.5;
@ -1044,12 +1045,12 @@ qboolean actor_checkattack (edict_t *self)
return false;
// If running to "thing", never attack
if(self->monsterinfo.aiflags & AI_CHASE_THING)
if (self->monsterinfo.aiflags & AI_CHASE_THING)
return false;
weapon = self->actor_weapon[self->actor_current_weapon];
// If actor has no weapon, well then of course he should not attack
if(weapon < 1 || weapon > 10)
if (weapon < 1 || weapon > 10)
return false;
if (self->enemy->health > 0)
@ -1096,27 +1097,27 @@ qboolean actor_checkattack (edict_t *self)
}
else
{
if(weapon >= 2 && weapon <= 5)
if (weapon >= 2 && weapon <= 5)
{
// Scatter guns - probability of firing based on percentage of rounds
// that will hit target at a given range.
if(skill->value == 1)
if (skill->value == 1)
goodchance = 0.6;
else if(skill->value > 1)
else if (skill->value > 1)
goodchance = 0.9;
else
goodchance = 0.3;
poorchance = 0.01;
switch(weapon)
switch (weapon)
{
case 2: lorange=270; hirange=500; break;
case 3: lorange= 90; hirange=200; break;
case 4: lorange=450; hirange=628; break;
case 5: lorange=450; hirange=628; break;
}
if(range <= lorange)
if (range <= lorange)
chance = goodchance;
else if(range > hirange)
else if (range > hirange)
chance = poorchance;
else
chance = goodchance + (range-lorange)/(hirange-lorange)*(poorchance-goodchance);
@ -1127,22 +1128,22 @@ qboolean actor_checkattack (edict_t *self)
chance = chancenear[weapon];
else
chance = chancefar[weapon];
if(self->monsterinfo.aiflags & AI_GOOD_GUY)
if (self->monsterinfo.aiflags & AI_GOOD_GUY)
{
if(skill->value == 0)
if (skill->value == 0)
chance *= 2;
else if(skill->value == 2)
else if (skill->value == 2)
chance *= 0.5;
else if(skill->value == 3)
else if (skill->value == 3)
chance *= 0.25;
}
else
{
if(skill->value == 0)
if (skill->value == 0)
chance *= 0.5;
else if(skill->value == 2)
else if (skill->value == 2)
chance *= 2;
else if(skill->value == 3)
else if (skill->value == 3)
chance *= 4;
}
}
@ -1161,9 +1162,9 @@ qboolean actor_checkattack (edict_t *self)
mmove_t actor_move_jump;
void actor_end_jump (edict_t *self)
{
if(self->flags & FL_ROBOT)
if (self->flags & FL_ROBOT)
{
if(self->monsterinfo.savemove)
if (self->monsterinfo.savemove)
{
actor_run(self);
// self->monsterinfo.currentmove = self->monsterinfo.savemove;
@ -1173,9 +1174,9 @@ void actor_end_jump (edict_t *self)
gi.dprintf("actor_move_walk=%d\n",&actor_move_walk);
gi.dprintf("actor_move_stand=%d\n",&actor_move_stand); */
}
else if(self->enemy)
else if (self->enemy)
actor_run(self);
else if(self->movetarget)
else if (self->movetarget)
actor_walk(self);
else
actor_stand(self);
@ -1203,13 +1204,13 @@ void actor_jump (edict_t *self)
}
qboolean actor_blocked (edict_t *self, float dist)
{
if(check_shot_blocked (self, 0.25 + (0.05 * skill->value) ))
if (check_shot_blocked (self, 0.25 + (0.05 * skill->value) ))
return true;
if(check_jump_blocked (self, dist, self->monsterinfo.jumpdn, self->monsterinfo.jumpup))
if (check_jump_blocked (self, dist, self->monsterinfo.jumpdn, self->monsterinfo.jumpup))
return true;
if(check_plat_blocked (self, dist))
if (check_plat_blocked (self, dist))
return true;
return false;
@ -1273,21 +1274,21 @@ void SP_misc_actor (edict_t *self)
self->movetype = MOVETYPE_STEP;
self->solid = SOLID_BBOX;
if(self->usermodel) {
if (self->usermodel) {
p = strstr(self->usermodel,"/tris.md2");
if(p) *p = 0;
if (p) *p = 0;
}
else {
self->usermodel = gi.TagMalloc(5, TAG_LEVEL);
// strncpy(self->usermodel,"male");
Q_strncpyz(self->usermodel,"male", 5);
}
if( (!Q_stricmp(self->usermodel,"male")) ||
if ( (!Q_stricmp(self->usermodel,"male")) ||
(!Q_stricmp(self->usermodel,"female")) ||
(!Q_stricmp(self->usermodel,"cyborg")) )
{
self->actor_id_model = true;
if(PatchPlayerModels(self->usermodel))
if (PatchPlayerModels(self->usermodel))
level.restart_for_actor_models = true;
}
else
@ -1296,15 +1297,15 @@ void SP_misc_actor (edict_t *self)
Com_sprintf(modelpath, sizeof(modelpath), "players/%s/tris.md2",self->usermodel);
self->s.modelindex = gi.modelindex(modelpath);
for(i=0; i<NUM_ACTORPAK_ACTORS && !ActorID; i++)
for (i=0; i<NUM_ACTORPAK_ACTORS && !ActorID; i++)
{
if(!Q_stricmp(self->usermodel,ActorNames[i]))
if (!Q_stricmp(self->usermodel,ActorNames[i]))
ActorID = i+1;
}
if(!VectorLength(self->bleft) && !VectorLength(self->tright))
if (!VectorLength(self->bleft) && !VectorLength(self->tright))
{
switch(ActorID)
switch (ActorID)
{
case ACTOR_ALIEN:
VectorSet (self->mins, -28, -28, -24);
@ -1351,12 +1352,12 @@ void SP_misc_actor (edict_t *self)
if (!self->mass)
self->mass = 200;
if(self->sounds < 0)
if (self->sounds < 0)
{
self->actor_weapon[0] = 0;
self->actor_weapon[1] = -self->sounds;
}
else if(self->sounds < 10)
else if (self->sounds < 10)
{
self->actor_weapon[0] = self->sounds;
self->actor_weapon[1] = 0;
@ -1367,15 +1368,15 @@ void SP_misc_actor (edict_t *self)
self->actor_weapon[1] = self->sounds % 100;
}
if(!VectorLength(self->muzzle))
if (!VectorLength(self->muzzle))
{
switch(ActorID)
switch (ActorID)
{
case ACTOR_ALIEN:
VectorSet(self->muzzle,42,5,15);
break;
case ACTOR_HUNTER:
switch(self->actor_weapon[0])
switch (self->actor_weapon[0])
{
case 1: VectorSet(self->muzzle,32,5,15);break;
case 2: VectorSet(self->muzzle,36,5,15);break;
@ -1390,7 +1391,7 @@ void SP_misc_actor (edict_t *self)
}
break;
case ACTOR_PARANOID:
switch(self->actor_weapon[0])
switch (self->actor_weapon[0])
{
case 1: VectorSet(self->muzzle,18,7,10);break;
case 2: VectorSet(self->muzzle,22,7,10);break;
@ -1414,7 +1415,7 @@ void SP_misc_actor (edict_t *self)
VectorSet(self->muzzle,17,6.5,17);
break;
case ACTOR_SLITH:
switch(self->actor_weapon[0])
switch (self->actor_weapon[0])
{
case 1: VectorSet(self->muzzle,32,7,10);break;
case 2: VectorSet(self->muzzle,32,7,10);break;
@ -1435,7 +1436,7 @@ void SP_misc_actor (edict_t *self)
VectorSet(self->muzzle,9,16,7);
break;
case ACTOR_WASTE:
switch(self->actor_weapon[0])
switch (self->actor_weapon[0])
{
case 1: VectorSet(self->muzzle,12, 9,9);break;
case 2: VectorSet(self->muzzle,22, 9,9);break;
@ -1453,7 +1454,7 @@ void SP_misc_actor (edict_t *self)
VectorSet(self->muzzle,20,12,7);
break;
case ACTOR_ZUMLIN:
switch(self->actor_weapon[0])
switch (self->actor_weapon[0])
{
case 1: VectorSet(self->muzzle,22, 3,8);break;
case 2: VectorSet(self->muzzle,20, 2,9);break;
@ -1468,7 +1469,7 @@ void SP_misc_actor (edict_t *self)
}
break;
default:
switch(self->actor_weapon[0])
switch (self->actor_weapon[0])
{
case 4: VectorSet(self->muzzle, 6 ,9 ,6 );break;
case 5: VectorSet(self->muzzle,20 ,9 ,8 );break;
@ -1478,9 +1479,9 @@ void SP_misc_actor (edict_t *self)
}
}
if(!VectorLength(self->muzzle2))
if (!VectorLength(self->muzzle2))
{
switch(ActorID)
switch (ActorID)
{
case ACTOR_RHINO:
VectorSet(self->muzzle2,27,-15,13);
@ -1490,7 +1491,7 @@ void SP_misc_actor (edict_t *self)
break;
}
}
if(VectorLength(self->muzzle2))
if (VectorLength(self->muzzle2))
self->monsterinfo.aiflags |= AI_TWO_GUNS;
self->pain = actor_pain;
@ -1505,7 +1506,7 @@ void SP_misc_actor (edict_t *self)
self->monsterinfo.sight = NULL;
self->monsterinfo.idle = NULL;
self->monsterinfo.checkattack = actor_checkattack;
if(actorjump->value)
if (actorjump->value)
{
self->monsterinfo.jump = actor_jump;
self->monsterinfo.jumpup = 48;
@ -1516,22 +1517,22 @@ void SP_misc_actor (edict_t *self)
// There are several actions (mainly following a player leader) that
// are only applicable to misc_actor (not other monsters)
self->monsterinfo.aiflags |= AI_ACTOR;
if(!(self->spawnflags & SF_ACTOR_BAD_GUY) || (self->spawnflags & SF_MONSTER_GOODGUY))
if (!(self->spawnflags & SF_ACTOR_BAD_GUY) || (self->spawnflags & SF_MONSTER_GOODGUY))
self->monsterinfo.aiflags |= AI_GOOD_GUY;
if(self->powerarmor) {
if (self->powerarmor) {
self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD;
self->monsterinfo.power_armor_power = self->powerarmor;
}
// Minimum distance
if(self->actor_weapon[1])
if (self->actor_weapon[1])
self->monsterinfo.min_range = 0;
else
{
int weapon;
weapon = self->actor_weapon[0];
if(weapon == 6 || weapon == 7 || weapon == 10)
if (weapon == 6 || weapon == 7 || weapon == 10)
self->monsterinfo.min_range = 200;
else
self->monsterinfo.min_range = 0;
@ -1542,7 +1543,7 @@ void SP_misc_actor (edict_t *self)
gi.linkentity (self);
self->monsterinfo.currentmove = &actor_move_stand;
if(self->health < 0)
if (self->health < 0)
{
mmove_t *deathmoves[] = {&actor_move_death1,
&actor_move_death2,
@ -1560,7 +1561,7 @@ void SP_misc_actor (edict_t *self)
self->use = actor_use;
// If health > 100000, actor is invulnerable
if(self->health >= 100000)
if (self->health >= 100000)
self->takedamage = DAMAGE_NO;
self->common_name = "Actor";
@ -1615,7 +1616,7 @@ void target_actor_touch (edict_t *self, edict_t *other, cplane_t *plane, csurfac
{
other->groundentity = NULL;
other->velocity[2] = self->movedir[2];
if(other->monsterinfo.aiflags & AI_ACTOR)
if (other->monsterinfo.aiflags & AI_ACTOR)
gi.sound (self, CHAN_VOICE, other->actor_sound_index[ACTOR_SOUND_JUMP], 1, ATTN_NORM, 0);
}
// NOTE: The jump animation won't work UNLESS this target_actor has a target. If this
@ -1627,8 +1628,8 @@ void target_actor_touch (edict_t *self, edict_t *other, cplane_t *plane, csurfac
if (self->spawnflags & 2) //shoot
{
if(self->pathtarget) {
if( G_Find(NULL,FOFS(targetname),self->pathtarget) != NULL ) {
if (self->pathtarget) {
if ( G_Find(NULL,FOFS(targetname),self->pathtarget) != NULL ) {
other->enemy = G_PickTarget(self->pathtarget);
if (self->spawnflags & 8)
{
@ -1645,8 +1646,8 @@ void target_actor_touch (edict_t *self, edict_t *other, cplane_t *plane, csurfac
}
else if (self->spawnflags & 4) //attack
{
if(self->pathtarget) {
if( G_Find(NULL,FOFS(targetname),self->pathtarget) != NULL )
if (self->pathtarget) {
if ( G_Find(NULL,FOFS(targetname),self->pathtarget) != NULL )
other->enemy = G_PickTarget(self->pathtarget);
else
other->enemy = NULL;
@ -1681,12 +1682,12 @@ void target_actor_touch (edict_t *self, edict_t *other, cplane_t *plane, csurfac
}
// DWH: Allow blank target field
if(self->target)
if (self->target)
other->movetarget = G_PickTarget(self->target);
else
other->movetarget = NULL;
if(!other->goalentity)
if (!other->goalentity)
other->goalentity = other->movetarget;
if (self->wait)
@ -1713,7 +1714,7 @@ void target_actor_touch (edict_t *self, edict_t *other, cplane_t *plane, csurfac
}
self->count--;
if(!self->count) {
if (!self->count) {
self->think = G_FreeEdict;
self->nextthink = level.time + 1;
}
@ -1774,10 +1775,10 @@ qboolean InPak(char *basedir, char *gamedir, char *filename)
#endif
// Search paks in game folder
for(k=9; k>=0 && !found; k--)
for (k=9; k>=0 && !found; k--)
{
strncpy(pakfile, basedir, sizeof(pakfile));
if(strlen(gamedir))
if (strlen(gamedir))
{
Q_strncatz (pakfile, "/", sizeof(pakfile));
Q_strncatz (pakfile, gamedir, sizeof(pakfile));
@ -1785,20 +1786,20 @@ qboolean InPak(char *basedir, char *gamedir, char *filename)
Q_strncatz (pakfile, va("/pak%d.pak",k), sizeof(pakfile));
if (NULL != (f = fopen(pakfile, "rb")))
{
num=fread(&pakheader,1,sizeof(pak_header_t),f);
if(num >= sizeof(pak_header_t))
num = (int)fread(&pakheader,1,sizeof(pak_header_t),f);
if (num >= sizeof(pak_header_t))
{
if( pakheader.id[0] == 'P' &&
if ( pakheader.id[0] == 'P' &&
pakheader.id[1] == 'A' &&
pakheader.id[2] == 'C' &&
pakheader.id[3] == 'K' )
{
numitems = pakheader.dsize/sizeof(pak_item_t);
fseek(f,pakheader.dstart,SEEK_SET);
for(kk=0; kk<numitems && !found; kk++)
for (kk=0; kk<numitems && !found; kk++)
{
fread(&pakitem,1,sizeof(pak_item_t),f);
if(!Q_stricmp(pakitem.name,filename))
if (!Q_stricmp(pakitem.name,filename))
found = true;
}
}
@ -1826,7 +1827,7 @@ void actor_files ()
edict_t *e, *e0;
FILE *f;
if(deathmatch->value)
if (deathmatch->value)
return;
basedir = gi.cvar("basedir", "", 0);
@ -1835,72 +1836,72 @@ void actor_files ()
memset(&actors,0,MAX_EDICTS*sizeof(actorlist));
for(i=game.maxclients+1; i<globals.num_edicts; i++) {
for (i=game.maxclients+1; i<globals.num_edicts; i++) {
e = &g_edicts[i];
if(!e->inuse) continue;
if(!e->classname) continue;
if(!(e->monsterinfo.aiflags & AI_ACTOR)) continue;
if (!e->inuse) continue;
if (!e->classname) continue;
if (!(e->monsterinfo.aiflags & AI_ACTOR)) continue;
for(j=0; j<NUM_ACTOR_SOUNDS; j++)
for (j=0; j<NUM_ACTOR_SOUNDS; j++)
e->actor_sound_index[j] = 0;
s_match = 0;
w_match[0] = 0;
w_match[1] = 0;
if(num_actors > 0) {
for(j=0; j<num_actors && (s_match == 0 || w_match[0] == 0 || w_match[1] == 0); j++) {
if (num_actors > 0) {
for (j=0; j<num_actors && (s_match == 0 || w_match[0] == 0 || w_match[1] == 0); j++) {
e0 = &g_edicts[actors[j].index];
if(!Q_stricmp(e->usermodel,e0->usermodel)) {
if (!Q_stricmp(e->usermodel,e0->usermodel)) {
s_match = j+1;
if(e->actor_weapon[0] == e0->actor_weapon[0])
if (e->actor_weapon[0] == e0->actor_weapon[0])
w_match[0] = j*2+1;
else if(e->actor_weapon[0] == e0->actor_weapon[1])
else if (e->actor_weapon[0] == e0->actor_weapon[1])
w_match[0] = j*2+2;
if(e->actor_weapon[1] == e0->actor_weapon[0])
if (e->actor_weapon[1] == e0->actor_weapon[0])
w_match[1] = j*2+1;
else if(e->actor_weapon[1] == e0->actor_weapon[1])
else if (e->actor_weapon[1] == e0->actor_weapon[1])
w_match[1] = j*2+2;
}
}
if(s_match) {
if (s_match) {
// copy sound indices from previous actor
e0 = &g_edicts[actors[s_match-1].index];
for(j=0; j<NUM_ACTOR_SOUNDS; j++)
for (j=0; j<NUM_ACTOR_SOUNDS; j++)
e->actor_sound_index[j] = e0->actor_sound_index[j];
}
if(w_match[0]) {
if (w_match[0]) {
k = (w_match[0]-1) % 2;
e0 = &g_edicts[actors[ (w_match[0]-k-1)/2 ].index];
e->s.modelindex2 = e->actor_model_index[0] = e0->actor_model_index[k];
}
if(w_match[1]) {
if (w_match[1]) {
k = (w_match[1]-1) % 2;
e0 = &g_edicts[actors[ (w_match[1]-k-1)/2 ].index];
e->actor_model_index[1] = e0->actor_model_index[k];
}
}
if(!s_match) {
if (!s_match) {
// search for sounds on hard disk and in paks
actors[num_actors].index = i;
num_actors++;
if(!Q_stricmp(e->usermodel,"male") || !Q_stricmp(e->usermodel,"female")) {
if (!Q_stricmp(e->usermodel,"male") || !Q_stricmp(e->usermodel,"female")) {
Com_sprintf(path, sizeof(path), "player/%s/",e->usermodel);
} else {
Com_sprintf(path, sizeof(path), "../players/%s/",e->usermodel);
}
for(j=0; j<NUM_ACTOR_SOUNDS; j++) {
for (j=0; j<NUM_ACTOR_SOUNDS; j++) {
if(e->actor_sound_index[j])
if (e->actor_sound_index[j])
continue;
// If it's NOT a custom model, start by looking in game folder
if(strlen(gamedir->string))
if (strlen(gamedir->string))
{
Com_sprintf(filename, sizeof(filename), "%s/%s/sound/%s%s",basedir->string,gamedir->string,path,wavname[j]);
f = fopen(filename,"r");
if(f) {
if (f) {
fclose(f);
Q_strncpyz(filename, path, sizeof(filename));
Q_strncatz(filename, wavname[j], sizeof(filename));
@ -1921,7 +1922,7 @@ void actor_files ()
// Search in baseq2 for external file
Com_sprintf(filename, sizeof(filename), "%s/baseq2/sound/%s%s",basedir->string,path,wavname[j]);
f = fopen(filename,"r");
if(f) {
if (f) {
fclose(f);
Q_strncpyz(filename, path, sizeof(filename));
Q_strncatz(filename, wavname[j], sizeof(filename));
@ -1938,11 +1939,12 @@ void actor_files ()
continue;
}
if (strlen(cddir->string)) {
if (strlen(cddir->string))
{
// Search in cddir (minimal installation)
Com_sprintf(filename, sizeof(filename), "%s/baseq2/sound/%s%s",cddir->string,path,wavname[j]);
f = fopen(filename,"r");
if(f) {
if (f) {
fclose(f);
Q_strncpyz(filename, path, sizeof(filename));
Q_strncatz(filename, wavname[j], sizeof(filename));
@ -1968,17 +1970,17 @@ void actor_files ()
// repeat this WHOLE DAMN THING for weapons
for(k=0; k<2; k++) {
if(w_match[k]) continue;
if(!e->actor_weapon[k]) continue;
if((k==1) && (e->actor_weapon[0] == e->actor_weapon[1])) {
for (k=0; k<2; k++) {
if (w_match[k]) continue;
if (!e->actor_weapon[k]) continue;
if ((k==1) && (e->actor_weapon[0] == e->actor_weapon[1])) {
e->actor_model_index[1] = e->actor_model_index[0];
continue;
}
if(s_match)
if (s_match)
{
// Wasn't added to table on account of sounds
if(k==0 || w_match[0] > 0) {
if (k==0 || w_match[0] > 0) {
// Either this is weapon 0, or weapon 0 was a match. Either
// way, this guy has something unique and hasn't been added
// to the table
@ -2006,7 +2008,7 @@ void actor_files ()
// Start in game folder
Com_sprintf(path, sizeof(path), "%s/%s/%s",basedir->string,gamedir->string,filename);
f = fopen(path,"r");
if(f) {
if (f) {
fclose(f);
e->actor_model_index[k] = gi.modelindex(filename);
continue;
@ -2034,7 +2036,8 @@ void actor_files ()
continue;
}
if (strlen(cddir->string)) {
if (strlen(cddir->string))
{
// Search CD for minimal installations
Com_sprintf(path, sizeof(path), "%s/baseq2/%s",cddir->string,filename);
f = fopen(path,"r");
@ -2087,7 +2090,8 @@ void actor_files ()
continue;
}
if (strlen(cddir->string)) {
if (strlen(cddir->string))
{
// Search CD for minimal installations
Com_sprintf(path, sizeof(path), "%s/baseq2/%s",cddir->string,filename);
f = fopen(path,"r");
@ -2126,25 +2130,25 @@ void actor_moveit (edict_t *player, edict_t *actor)
vec_t travel;
int best=0;
if(!(actor->monsterinfo.aiflags & AI_FOLLOW_LEADER))
if (!(actor->monsterinfo.aiflags & AI_FOLLOW_LEADER))
return;
if(actor->enemy)
if (actor->enemy)
return;
if(actor->health <= 0)
if (actor->health <= 0)
return;
travel = 256 + 128*crandom();
thing = actor->vehicle;
if(!thing || !thing->inuse || Q_stricmp(thing->classname,"thing"))
if (!thing || !thing->inuse || Q_stricmp(thing->classname,"thing"))
thing = actor->vehicle = SpawnThing();
VectorSubtract(actor->s.origin,player->s.origin,dir);
dir[2] = 0;
VectorNormalize(dir);
if(!VectorLength(dir))
if (!VectorLength(dir))
VectorSet(dir,1.0,0.,0.);
VectorMA(actor->s.origin,travel,dir,end);
tr = gi.trace(actor->s.origin,NULL,NULL,end,actor,MASK_MONSTERSOLID);
d[best] = tr.fraction * travel;
if(d[best] < 64)
if (d[best] < 64)
{
temp = dir[0];
dir[0] = -dir[1];
@ -2153,7 +2157,7 @@ void actor_moveit (edict_t *player, edict_t *actor)
tr = gi.trace(actor->s.origin,NULL,NULL,end,actor,MASK_MONSTERSOLID);
best = 1;
d[best] = tr.fraction * travel;
if(d[best] < 64)
if (d[best] < 64)
{
dir[0] = -dir[0];
dir[1] = -dir[1];
@ -2161,18 +2165,18 @@ void actor_moveit (edict_t *player, edict_t *actor)
tr = gi.trace(actor->s.origin,NULL,NULL,end,actor,MASK_MONSTERSOLID);
best = 2;
d[best] = tr.fraction * travel;
if(d[best] < 64)
if (d[best] < 64)
{
if(d[0] > d[1] && d[0] > d[2])
if (d[0] > d[1] && d[0] > d[2])
best = 0;
else if(d[1] > d[0] && d[1] > d[2])
else if (d[1] > d[0] && d[1] > d[2])
best = 1;
if(best==1)
if (best==1)
{
dir[0] = -dir[0];
dir[1] = -dir[1];
}
else if(best==0)
else if (best==0)
{
temp = -dir[1];
dir[1] = dir[0];

View file

@ -58,7 +58,7 @@ void flyer_sight (edict_t *self, edict_t *other)
void flyer_idle (edict_t *self)
{
if(!(self->spawnflags & SF_MONSTER_AMBUSH))
// if (!(self->spawnflags & SF_MONSTER_AMBUSH))
gi.sound (self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0);
}

View file

@ -1633,7 +1633,8 @@ void spectator_respawn (edict_t *ent)
// if the user wants to become a spectator, make sure he doesn't
// exceed max_spectators
if (ent->client->pers.spectator) {
if (ent->client->pers.spectator)
{
char *value = Info_ValueForKey (ent->client->pers.userinfo, "spectator");
if (*spectator_password->string &&
strcmp(spectator_password->string, "none") &&
@ -1651,7 +1652,8 @@ void spectator_respawn (edict_t *ent)
if (g_edicts[i].inuse && g_edicts[i].client->pers.spectator)
numspec++;
if (numspec >= maxspectators->value) {
if (numspec >= maxspectators->value)
{
safe_cprintf(ent, PRINT_HIGH, "Server spectator limit is full.");
ent->client->pers.spectator = false;
// reset his spectator var
@ -1660,12 +1662,15 @@ void spectator_respawn (edict_t *ent)
gi.unicast(ent, true);
return;
}
} else {
}
else
{
// he was a spectator and wants to join the game
// he must have the right password
char *value = Info_ValueForKey (ent->client->pers.userinfo, "password");
if (*password->string && strcmp(password->string, "none") &&
strcmp(password->string, value)) {
strcmp(password->string, value))
{
safe_cprintf(ent, PRINT_HIGH, "Password incorrect.\n");
ent->client->pers.spectator = true;
gi.WriteByte (svc_stufftext);
@ -1682,7 +1687,8 @@ void spectator_respawn (edict_t *ent)
PutClientInServer (ent);
// add a teleportation effect
if (!ent->client->pers.spectator) {
if (!ent->client->pers.spectator)
{
// send effect
gi.WriteByte (svc_muzzleflash);
gi.WriteShort (ent-g_edicts);
@ -1935,7 +1941,8 @@ void PutClientInServer (edict_t *ent)
VectorCopy (client->ps.viewangles, client->v_angle);
// spawn a spectator
if (client->pers.spectator) {
if (client->pers.spectator)
{
client->chase_target = NULL;
client->resp.spectator = true;
@ -1946,7 +1953,8 @@ void PutClientInServer (edict_t *ent)
ent->client->ps.gunindex = 0;
gi.linkentity (ent);
return;
} else
}
else
client->resp.spectator = false;
// DWH:
@ -2091,6 +2099,7 @@ void ClientBegin (edict_t *ent)
}
Fog_Off (ent);
// Fog (ent);
stuffcmd(ent,"alias +zoomin zoomin;alias -zoomin zoominstop\n");
stuffcmd(ent,"alias +zoomout zoomout;alias -zoomout zoomoutstop\n");
@ -2188,7 +2197,7 @@ void ClientUserinfoChanged (edict_t *ent, char *userinfo)
// check for malformed or illegal info strings
if (!Info_Validate(userinfo))
{
// strcpy (userinfo, "\\name\\badinfo\\skin\\male/grunt");
// strncpy (userinfo, "\\name\\badinfo\\skin\\male/grunt");
Q_strncpyz (userinfo, "\\name\\badinfo\\skin\\male/grunt", MAX_INFO_STRING); // userinfo is always length of MAX_INFO_STRING
}
@ -3257,6 +3266,7 @@ void ClientThink (edict_t *ent, usercmd_t *ucmd)
for (i=0 ; i<3 ; i++)
{
pm.s.origin[i] = ent->s.origin[i]*8;
// FIXME: make sure this short doesn't overflow
pm.s.velocity[i] = ent->velocity[i]*8;
}

View file

@ -239,7 +239,7 @@ void DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer)
// print level name and exit rules
string[0] = 0;
stringlength = strlen(string);
stringlength = (int)strlen(string);
// add the clients in sorted order
if (total > 12)
@ -265,7 +265,7 @@ void DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer)
{
Com_sprintf (entry, sizeof(entry),
"xv %i yv %i picn %s ",x+32, y, tag);
j = strlen(entry);
j = (int)strlen(entry);
if (stringlength + j > 1024)
break;
// strncpy (string + stringlength, entry);
@ -277,7 +277,7 @@ void DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer)
Com_sprintf (entry, sizeof(entry),
"client %i %i %i %i %i %i ",
x, y, sorted[i], cl->resp.score, cl->ping, (level.framenum - cl->resp.enterframe)/600);
j = strlen(entry);
j = (int)strlen(entry);
if (stringlength + j > 1024)
break;
// strncpy (string + stringlength, entry);

View file

@ -122,23 +122,27 @@ void PMenu_Do_Update(edict_t *ent)
alt = true;
t++;
}
sprintf(string + strlen(string), "yv %d ", 32 + i * 8);
// sprintf(string + strlen(string), "yv %d ", 32 + i * 8);
Com_sprintf (string + strlen(string), sizeof(string)-strlen(string), "yv %d ", 32 + i * 8);
if (p->align == PMENU_ALIGN_CENTER)
x = 196/2 - strlen(t)*4 + 64;
x = 196/2 - (int)strlen(t)*4 + 64;
else if (p->align == PMENU_ALIGN_RIGHT)
x = 64 + (196 - strlen(t)*8);
x = 64 + (196 - (int)strlen(t)*8);
else
x = 64;
sprintf(string + strlen(string), "xv %d ",
x - ((hnd->cur == i) ? 8 : 0));
// sprintf(string + strlen(string), "xv %d ", x - ((hnd->cur == i) ? 8 : 0));
Com_sprintf (string + strlen(string), sizeof(string)-strlen(string), "xv %d ", x - ((hnd->cur == i) ? 8 : 0));
if (hnd->cur == i)
sprintf(string + strlen(string), "string2 \"\x0d%s\" ", t);
// sprintf(string + strlen(string), "string2 \"\x0d%s\" ", t);
Com_sprintf (string + strlen(string), sizeof(string)-strlen(string), "string2 \"\x0d%s\" ", t);
else if (alt)
sprintf(string + strlen(string), "string2 \"%s\" ", t);
// sprintf(string + strlen(string), "string2 \"%s\" ", t);
Com_sprintf (string + strlen(string), sizeof(string)-strlen(string), "string2 \"%s\" ", t);
else
sprintf(string + strlen(string), "string \"%s\" ", t);
// sprintf(string + strlen(string), "string \"%s\" ", t);
Com_sprintf (string + strlen(string), sizeof(string)-strlen(string), "string \"%s\" ", t);
alt = false;
}
@ -192,23 +196,27 @@ void PMenu_Update(edict_t *ent)
alt = true;
t++;
}
sprintf(string + strlen(string), "yv %d ", 32 + i * 8);
// sprintf(string + strlen(string), "yv %d ", 32 + i * 8);
Com_sprintf (string + strlen(string), sizeof(string)-strlen(string), "yv %d ", 32 + i * 8);
if (p->align == PMENU_ALIGN_CENTER)
x = 196/2 - strlen(t)*4 + 64;
x = 196/2 - (int)strlen(t)*4 + 64;
else if (p->align == PMENU_ALIGN_RIGHT)
x = 64 + (196 - strlen(t)*8);
x = 64 + (196 - (int)strlen(t)*8);
else
x = 64;
sprintf(string + strlen(string), "xv %d ",
x - ((hnd->cur == i) ? 8 : 0));
// sprintf(string + strlen(string), "xv %d ", x - ((hnd->cur == i) ? 8 : 0));
Com_sprintf (string + strlen(string), sizeof(string)-strlen(string), "xv %d ", x - ((hnd->cur == i) ? 8 : 0));
if (hnd->cur == i)
sprintf(string + strlen(string), "string2 \"\x0d%s\" ", t);
// sprintf(string + strlen(string), "string2 \"\x0d%s\" ", t);
Com_sprintf (string + strlen(string), sizeof(string)-strlen(string), "string2 \"\x0d%s\" ", t);
else if (alt)
sprintf(string + strlen(string), "string2 \"%s\" ", t);
// sprintf(string + strlen(string), "string2 \"%s\" ", t);
Com_sprintf (string + strlen(string), sizeof(string)-strlen(string), "string2 \"%s\" ", t);
else
sprintf(string + strlen(string), "string \"%s\" ", t);
// sprintf(string + strlen(string), "string \"%s\" ", t);
Com_sprintf (string + strlen(string), sizeof(string)-strlen(string), "string \"%s\" ", t);
alt = false;
}

View file

@ -39,9 +39,9 @@ void Text_Open(edict_t *ent)
void Text_Close(edict_t *ent)
{
if(!ent->client) return;
if(!ent->client->textdisplay) return;
if(ent->client->textdisplay->buffer)
if (!ent->client) return;
if (!ent->client->textdisplay) return;
if (ent->client->textdisplay->buffer)
{
gi.TagFree(ent->client->textdisplay->buffer);
ent->client->textdisplay->buffer = NULL;
@ -56,25 +56,25 @@ void Text_BuildDisplay(texthnd_t *hnd)
int i, imax, n;
char *p1, *p2, *p3;
for(i=0; i<hnd->page_length+2; i++)
for (i=0; i<hnd->page_length+2; i++)
text[i].text = NULL;
if(!(hnd->flags & 2))
if (!(hnd->flags & 2))
{
text[hnd->page_length+1].text = "Esc to quit";
if(hnd->nlines > hnd->page_length)
if (hnd->nlines > hnd->page_length)
text[hnd->page_length].text = "Use [ and ] to scroll";
}
p1 = hnd->buffer+hnd->start_char;
p3 = hnd->buffer+hnd->size-1;
if(hnd->curline > 0)
if (hnd->curline > 0)
{
// Scan for hnd->curline'th 0 byte, point to following character
n = hnd->curline;
while(p1 < p3 && n)
while (p1 < p3 && n)
{
if(*p1==0) n--;
if (*p1==0) n--;
p1++;
}
}
@ -82,13 +82,13 @@ void Text_BuildDisplay(texthnd_t *hnd)
i = 0;
p2 = p1;
text[i].text = p2;
if(hnd->nlines > hnd->page_length)
if (hnd->nlines > hnd->page_length)
imax = hnd->page_length-2;
else
imax = hnd->page_length-1;
while(p2 <= p3 && i < imax)
while (p2 <= p3 && i < imax)
{
if(*p2 == 0 && p2 < p3)
if (*p2 == 0 && p2 < p3)
{
i++;
p2++;
@ -118,7 +118,7 @@ void Text_Update(edict_t *ent)
}
hnd = ent->client->textdisplay;
if(hnd->last_update + 2*FRAMETIME > level.time) return;
if (hnd->last_update + 2*FRAMETIME > level.time) return;
hnd->last_update = level.time;
@ -127,11 +127,11 @@ void Text_Update(edict_t *ent)
if (!(hnd->flags & 2))
{
sprintf(string,"xv %d yv %d picn %s ",
Com_sprintf (string, sizeof(string), "xv %d yv %d picn %s ",
x0, y0, hnd->background_image);
}
else // Knightmare- we NEED to have a placeholder image here
sprintf(string,"xv %d yv %d picn blank ", x0, y0);
Com_sprintf (string, sizeof(string), "xv %d yv %d picn blank ", x0, y0);
xlast = 9999;
for (i = 0, p = hnd->lines; i < hnd->page_length+2; i++, p++)
@ -148,7 +148,7 @@ void Text_Update(edict_t *ent)
{
tnext = t;
tnext++;
if(*tnext == 'c')
if (*tnext == 'c')
{
align = TEXT_CENTER;
t++;
@ -163,27 +163,32 @@ void Text_Update(edict_t *ent)
}
if (strlen(t))
{
sprintf(string + strlen(string), "yv %d ", y0 + 24 + i * 8);
// sprintf (string + strlen(string), "yv %d ", y0 + 24 + i * 8);
Com_sprintf (string + strlen(string), sizeof(string)-strlen(string), "yv %d ", y0 + 24 + i * 8);
if (align == TEXT_CENTER)
x = x0 + 20 + (hnd->page_width-1-strlen(t))*4;
x = x0 + 20 + (hnd->page_width-1-(int)strlen(t))*4;
else if (align == TEXT_RIGHT)
x = x0 + 20 + (hnd->page_width-1-strlen(t))*8;
x = x0 + 20 + (hnd->page_width-1-(int)strlen(t))*8;
else
x = x0 + 20;
if (x != xlast)
{
sprintf(string + strlen(string), "xv %d ",x);
// sprintf (string + strlen(string), "xv %d ",x);
Com_sprintf (string + strlen(string), sizeof(string)-strlen(string), "xv %d ",x);
xlast = x;
}
if (alt) {
sprintf(string + strlen(string), "string2 \"%s\" ", t);
} else {
sprintf(string + strlen(string), "string \"%s\" ", t);
// sprintf (string + strlen(string), "string2 \"%s\" ", t);
Com_sprintf (string + strlen(string), sizeof(string)-strlen(string), "string2 \"%s\" ", t);
}
else {
// sprintf (string + strlen(string), "string \"%s\" ", t);
Com_sprintf (string + strlen(string), sizeof(string)-strlen(string), "string \"%s\" ", t);
}
}
alt = false;
}
// if(strlen(string) > 1000)
// if (strlen(string) > 1000)
// gi.dprintf("WARNING: formatted string length (%d) > 1000\n",strlen(string));
gi.WriteByte (svc_layout);
@ -205,13 +210,13 @@ void Text_Next(edict_t *ent)
hnd = ent->client->textdisplay;
displayed_lines = hnd->page_length;
if(hnd->nlines > hnd->page_length) displayed_lines--;
if(hnd->curline+displayed_lines+1 < hnd->nlines)
if (hnd->nlines > hnd->page_length) displayed_lines--;
if (hnd->curline+displayed_lines+1 < hnd->nlines)
{
current = hnd->curline;
// hnd->curline = min(hnd->curline+MAX_LINES/2,hnd->nlines-displayed_lines-1);
hnd->curline = hnd->curline+hnd->page_length-1;
if(hnd->curline > current)
if (hnd->curline > current)
{
Text_BuildDisplay(hnd);
Text_Update(ent);
@ -230,7 +235,7 @@ void Text_Prev(edict_t *ent)
hnd = ent->client->textdisplay;
if(hnd->curline > 0)
if (hnd->curline > 0)
{
// hnd->curline = max(0, hnd->curline-MAX_LINES/2);
hnd->curline = max(0, hnd->curline-hnd->page_length+1);
@ -255,7 +260,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
hnd = gi.TagMalloc(sizeof(*hnd), TAG_LEVEL);
// If a file, open and read it
if(flags & 1)
if (flags & 1)
{
#ifdef KMQUAKE2_ENGINE_MOD // use new engine file loading function instead
char textname[128];
@ -273,7 +278,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
}
hnd->allocated = textsize + 128; // add some slop for additional control characters
hnd->buffer = gi.TagMalloc(hnd->allocated, TAG_LEVEL);
if(!hnd->buffer)
if (!hnd->buffer)
{
gi.dprintf("Memory allocation failure on target_text\n");
Text_Close(activator);
@ -298,7 +303,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
gamedir = gi.cvar("gamedir", "", 0);
// strncpy(filename, basedir->string);
Q_strncpyz(filename, basedir->string, sizeof(filename));
if(strlen(gamedir->string))
if (strlen(gamedir->string))
{
// strncat(filename, "\\");
// strncat(filename, gamedir->string);
@ -307,16 +312,16 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
}
// First check for existence of text file in pak0.pak -> pak9.pak
in_pak = false;
for(i=0; i<=9 && !in_pak; i++)
for (i=0; i<=9 && !in_pak; i++)
{
// sprintf(pakfile,"%s\\pak%d.pak",filename,i);
Com_sprintf(pakfile, sizeof(pakfile), "%s\\pak%d.pak",filename,i);
if (NULL != (f = fopen(pakfile, "rb")))
{
num=fread(&pakheader,1,sizeof(pak_header_t),f);
if(num >= sizeof(pak_header_t))
if (num >= sizeof(pak_header_t))
{
if( pakheader.id[0] == 'P' &&
if ( pakheader.id[0] == 'P' &&
pakheader.id[1] == 'A' &&
pakheader.id[2] == 'C' &&
pakheader.id[3] == 'K' )
@ -325,16 +330,16 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
// sprintf(textname,"maps/%s",message);
Com_sprintf(textname, sizeof(textname), "maps/%s",message);
fseek(f,pakheader.dstart,SEEK_SET);
for(k=0; k<numitems && !in_pak; k++)
for (k=0; k<numitems && !in_pak; k++)
{
fread(&pakitem,1,sizeof(pak_item_t),f);
if(!Q_stricmp(pakitem.name,textname))
if (!Q_stricmp(pakitem.name,textname))
{
in_pak = true;
fseek(f,pakitem.start,SEEK_SET);
hnd->allocated = pakitem.size + 128; // add some slop for additional control characters
hnd->buffer = gi.TagMalloc(hnd->allocated, TAG_LEVEL);
if(!hnd->buffer)
if (!hnd->buffer)
{
fclose(f);
gi.dprintf("Memory allocation failure on target_text\n");
@ -351,14 +356,14 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
fclose(f);
}
}
if(!in_pak)
if (!in_pak)
{
// strncat(filename, "\\maps\\");
// strncat(filename, message);
Q_strncatz(filename, "\\maps\\", sizeof(filename));
Q_strncatz(filename, message, sizeof(filename));
f = fopen(filename,"rb");
if(!f)
if (!f)
{
gi.dprintf("File not found:%s\n",filename);
return;
@ -368,7 +373,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
fseek(f,0,SEEK_SET);
hnd->allocated = L+128;
hnd->buffer = gi.TagMalloc(hnd->allocated, TAG_LEVEL);
if(!hnd->buffer)
if (!hnd->buffer)
{
gi.dprintf("Memory allocation failure on target_text\n");
Text_Close(activator);
@ -380,7 +385,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
}
#endif // KMQUAKE2_ENGINE_MOD
if(!hnd->buffer)
if (!hnd->buffer)
{
gi.dprintf("Umm... how'd you get here?\n");
Text_Close(activator);
@ -389,10 +394,10 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
}
else
{
L = strlen(message);
L = (int)strlen(message);
hnd->allocated = L+128;
hnd->buffer = gi.TagMalloc(hnd->allocated, TAG_LEVEL);
if(!hnd->buffer)
if (!hnd->buffer)
{
gi.dprintf("Memory allocation failure\n");
Text_Close(activator);
@ -402,7 +407,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
memcpy(hnd->buffer,message,L);
}
hnd->size = strlen(hnd->buffer) + 1;
hnd->size = (int)strlen(hnd->buffer) + 1;
// Default page length:
hnd->page_length = MAX_LINES-2;
@ -414,44 +419,44 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
// If 1st line starts with $, read page length, width, and image name
p1 = hnd->buffer;
if(*p1 == '$')
if (*p1 == '$')
{
p3 = p1;
while((p3 < hnd->buffer+hnd->size) && (*p3 != 13))
while ((p3 < hnd->buffer+hnd->size) && (*p3 != 13))
p3++;
p2 = strstr(p1,"L=");
if(p2 && (p2 < p3))
if (p2 && (p2 < p3))
{
p2 += 2;
sscanf(p2,"%d",&hnd->page_length);
hnd->page_length += 1;
}
p2 = strstr(p1,"W=");
if(p2 && (p2 < p3))
if (p2 && (p2 < p3))
{
p2 += 2;
sscanf(p2,"%d",&hnd->page_width);
}
p2 = strstr(p1,"I=");
if(p2 && (p2 < p3))
if (p2 && (p2 < p3))
{
p2 += 2;
sscanf(p2,"%s",hnd->background_image);
}
p3++;
if(*p3 == 10) p3++;
if (*p3 == 10) p3++;
hnd->start_char = p3-p1;
do_linebreaks = false;
}
// Eliminate all <CR>'s so lines are delineated with <LF>'s only
p1 = hnd->buffer+hnd->start_char;
while(p1 < hnd->buffer+hnd->size)
while (p1 < hnd->buffer+hnd->size)
{
if(*p1 == 13)
if (*p1 == 13)
{
for(p2=p1, p3=p1+1; p2<hnd->buffer+hnd->size; p2++, p3++)
for (p2=p1, p3=p1+1; p2<hnd->buffer+hnd->size; p2++, p3++)
*p2 = *p3;
hnd->size--;
}
@ -460,16 +465,16 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
}
// Count number of lines and replace all line feeds with 0's
hnd->nlines = 1;
for(p1 = hnd->buffer+hnd->start_char; p1 < hnd->buffer+hnd->size; p1++)
for (p1 = hnd->buffer+hnd->start_char; p1 < hnd->buffer+hnd->size; p1++)
{
if(*p1 == 10)
if (*p1 == 10)
{
hnd->nlines++;
*p1 = 0;
}
}
// Line break stuff
if(!do_linebreaks)
if (!do_linebreaks)
goto done_linebreaks;
line_length = 0;
@ -477,23 +482,23 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
alt = false;
centered = false;
right_justified = false;
while(p1 < hnd->buffer+hnd->size)
while (p1 < hnd->buffer+hnd->size)
{
// Don't count control characters
if(line_length == 0) {
if(*p1 == '*') {
if (line_length == 0) {
if (*p1 == '*') {
p1++;
alt = true;
} else {
alt = false;
}
if(*p1 == '\\') {
if (*p1 == '\\') {
p1++;
if(*p1 == 'c') {
if (*p1 == 'c') {
p1++;
centered = true;
right_justified = false;
} else if(*p1 == 'r') {
} else if (*p1 == 'r') {
p1++;
centered = false;
right_justified = true;
@ -506,12 +511,12 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
right_justified = false;
}
}
if((line_length == 0) && (*p1 == '\\')) p1 += 2;
if(*p1 != 0) line_length++;
if ((line_length == 0) && (*p1 == '\\')) p1 += 2;
if (*p1 != 0) line_length++;
linebreak = false;
if(line_length > hnd->page_width)
if (line_length > hnd->page_width)
{
if(*p1 == 32)
if (*p1 == 32)
{
// We're at a space... good deal, just replace space with
// a line-break 0 and move on
@ -524,9 +529,9 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
// back up from current position to last space character and
// replace with a 0 (but don't go past previous 0)
p2 = p1;
while(p1 > hnd->buffer+hnd->start_char && *p1 != 0)
while (p1 > hnd->buffer+hnd->start_char && *p1 != 0)
{
if(*p1 == 32)
if (*p1 == 32)
{
*p1 = 0;
hnd->nlines++;
@ -535,16 +540,16 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
else
p1--;
}
if(!linebreak) {
if (!linebreak) {
// Must be an ugly Mad Dog test trying my patience - say
// a 40-character line with no spaces. Back up one space,
// add a hyphen then a 0.
hnd->size += 2;
if(hnd->size >= hnd->allocated) {
if (hnd->size >= hnd->allocated) {
hnd->allocated += 128;
temp_buffer = hnd->buffer;
hnd->buffer = gi.TagMalloc(hnd->allocated, TAG_LEVEL);
if(!hnd->buffer)
if (!hnd->buffer)
{
gi.dprintf("Memory allocation failure\n");
Text_Close(activator);
@ -559,7 +564,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
p1 = p2-1;
p2 = hnd->buffer + hnd->size;
p3 = p2 - 2;
while(p3 >= p1) {
while (p3 >= p1) {
*p2 = *p3;
p2--;
p3--;
@ -572,15 +577,15 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
}
}
}
if(linebreak && alt) {
if (linebreak && alt) {
// We broke a line and the line was green text. Insert another
// '*' at beginning of next line
hnd->size += 1;
if(hnd->size > hnd->allocated) {
if (hnd->size > hnd->allocated) {
hnd->allocated += 128;
temp_buffer = hnd->buffer;
hnd->buffer = gi.TagMalloc(hnd->allocated, TAG_LEVEL);
if(!hnd->buffer)
if (!hnd->buffer)
{
gi.dprintf("Memory allocation failure\n");
Text_Close(activator);
@ -594,7 +599,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
}
p2 = hnd->buffer + hnd->size;
p3 = p2 - 1;
while(p3 >= p1) {
while (p3 >= p1) {
*p2 = *p3;
p2--;
p3--;
@ -602,15 +607,15 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
p2 = p1+1;
*p2 = '*';
}
if(linebreak && (centered || right_justified)) {
if (linebreak && (centered || right_justified)) {
// We broke a line and the line had other than left justification. Insert another
// '\c' or '\r' at beginning of next line
hnd->size += 2;
if(hnd->size > hnd->allocated) {
if (hnd->size > hnd->allocated) {
hnd->allocated += 128;
temp_buffer = hnd->buffer;
hnd->buffer = gi.TagMalloc(hnd->allocated, TAG_LEVEL);
if(!hnd->buffer)
if (!hnd->buffer)
{
gi.dprintf("Memory allocation failure\n");
Text_Close(activator);
@ -624,26 +629,26 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
}
p2 = hnd->buffer + hnd->size;
p3 = p2 - 2;
while(p3 >= p1) {
while (p3 >= p1) {
*p2 = *p3;
p2--;
p3--;
}
p2 = p1+1;
if(alt) p2++;
if (alt) p2++;
*p2 = '\\';
p2++;
if(centered)
if (centered)
*p2 = 'c';
else
*p2 = 'r';
}
if(*p1=='\\') {
if (*p1=='\\') {
p2 = p1+1;
if(*p2=='n') {
if (*p2=='n') {
*p1 = 0;
p3 = p2 + 1;
while(p3 < hnd->buffer + hnd->size) {
while (p3 < hnd->buffer + hnd->size) {
*p2 = *p3;
p2++;
p3++;
@ -656,26 +661,26 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
}
}
// If we're at a 0, check to see if subsequent words will fit on this line
if((!linebreak) && (*p1 == 0) && (p1 < hnd->buffer+hnd->size-1) &&
if ((!linebreak) && (*p1 == 0) && (p1 < hnd->buffer+hnd->size-1) &&
(line_length < hnd->page_width) )
{
// Don't do this if 2 consecutive 0's are found (end of paragraph)
// or if 1st character in next line is '*' or '\'
p2 = p1;
p2--;
if(*p2 != 0)
if (*p2 != 0)
{
p2++;
p2++;
if(*p2 != 0 && *p2 != '*' && *p2 != '\\' && p2 < hnd->buffer+hnd->size)
if (*p2 != 0 && *p2 != '*' && *p2 != '\\' && p2 < hnd->buffer+hnd->size)
{
new_line_length = line_length+2;
while(p2 < hnd->buffer+hnd->size && *p2 != 32 && *p2 != 0)
while (p2 < hnd->buffer+hnd->size && *p2 != 32 && *p2 != 0)
{
new_line_length++;
p2++;
}
if(new_line_length <= hnd->page_width)
if (new_line_length <= hnd->page_width)
{
*p1 = 32;
line_length++; // include the space that was a 0
@ -684,7 +689,7 @@ void Do_Text_Display(edict_t *activator, int flags, char *message)
}
}
}
if(*p1 == 0) line_length = 0;
if (*p1 == 0) line_length = 0;
p1++;
}
@ -693,22 +698,22 @@ done_linebreaks:
// Finally, scan for a \a code (embedded audio). If present remove that line
// and play the sound
p1 = hnd->buffer+hnd->start_char;
while(p1 < hnd->buffer+hnd->size)
while (p1 < hnd->buffer+hnd->size)
{
if((*p1 == 0) || (p1 == hnd->buffer+hnd->start_char))
if ((*p1 == 0) || (p1 == hnd->buffer+hnd->start_char))
{
if(*p1 == 0)
if (*p1 == 0)
p1++;
if(*p1 == '\\')
if (*p1 == '\\')
{
p1++;
if(*p1 == 'a')
if (*p1 == 'a')
{
// strncpy(sound, p1+1);
Q_strncpyz(sound, p1+1, sizeof(sound));
p1--;
p2=p1;
while(*p2 != 0)
while (*p2 != 0)
p2++;
p2++;
memcpy(p1,p2,hnd->buffer+hnd->size-p2+1);
@ -733,7 +738,7 @@ done_linebreaks:
void Use_Target_Text(edict_t *self, edict_t *other, edict_t *activator)
{
if(!activator || !activator->client) return;
if (!activator || !activator->client) return;
activator->client->showinventory = false;
activator->client->showscores = false;
activator->client->showhelp = false;
@ -746,7 +751,7 @@ void Use_Target_Text(edict_t *self, edict_t *other, edict_t *activator)
void SP_target_text(edict_t *self)
{
if(!self->message)
if (!self->message)
{
gi.dprintf("target_text with no message at %s\n",
vtos(self->s.origin));

View file

@ -1234,7 +1234,7 @@ void Weapon_HyperBlaster_Fire (edict_t *ent, qboolean altfire)
// Knightmare- select color
color = sk_hyperblaster_color->value;
// hyperblaster_color could be any other value, so clamp this
// hyperblaster_color could be any other value, so clamp it
if (sk_hyperblaster_color->value < 2 || sk_hyperblaster_color->value > 4)
color = BLASTER_ORANGE;
// CTF color override

View file

@ -304,7 +304,7 @@ float Q_fabs (float f)
#if defined _M_IX86 && !defined C_ONLY
#pragma warning (disable:4035)
__declspec( naked ) long Q_ftol( float f )
__declspec( naked ) int Q_ftol( float f )
{
static int tmp;
__asm fld dword ptr [esp+4]
@ -313,6 +313,11 @@ __declspec( naked ) long Q_ftol( float f )
__asm ret
}
#pragma warning (default:4035)
#else
int Q_ftol( float f )
{
return (int)f;
}
#endif
/*
@ -384,11 +389,17 @@ int BoxOnPlaneSide2 (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
BoxOnPlaneSide
Returns 1, 2, or 1 + 2
Which means (THANKS FOR THE FUCKING COMMENTS CARMACK!):
1 = PSIDE_FRONT (front of plane)
2 = PSIDE_BACK (back of plane)
3 = PSIDE_BOTH (both sides of plane)
==================
*/
//#if !id386 || defined __linux__
//#ifndef id386
#ifndef _WIN32
//#ifndef _WIN32
#if !defined (_WIN32) || !defined (_M_IX86)
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
{
float dist1, dist2;
@ -971,12 +982,43 @@ qboolean AxisCompare (const vec3_t axis1[3], const vec3_t axis2[3])
return true;
}
/*
================
MatrixMultiply
From Q3A
================
*/
void MatrixMultiply (float in1[3][3], float in2[3][3], float out[3][3])
{
out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] +
in1[0][2] * in2[2][0];
out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] +
in1[0][2] * in2[2][1];
out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] +
in1[0][2] * in2[2][2];
out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] +
in1[1][2] * in2[2][0];
out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] +
in1[1][2] * in2[2][1];
out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] +
in1[1][2] * in2[2][2];
out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] +
in1[2][2] * in2[2][0];
out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] +
in1[2][2] * in2[2][1];
out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] +
in1[2][2] * in2[2][2];
}
//====================================================================================
/*
============
COM_SkipPath
Skips the file path
============
*/
char *COM_SkipPath (char *pathname)
@ -996,6 +1038,8 @@ char *COM_SkipPath (char *pathname)
/*
============
COM_StripExtension
Removes the file extension, if any
============
*/
void COM_StripExtension (char *in, char *out, size_t outSize)
@ -1419,6 +1463,9 @@ skipwhite:
c = *data++;
if (c=='\"' || !c)
{
if (len == MAX_TOKEN_CHARS) // Knightmare- discard if > MAX_TOKEN_CHARS-1
len = 0;
com_token[len] = 0;
*data_p = data;
return com_token;
@ -1855,7 +1902,7 @@ int Q_SortStrcmp (const char **arg1, const char **arg2)
Q_strncasecmp
=================
*/
int Q_strncasecmp (char *s1, char *s2, int n)
int Q_strncasecmp (char *s1, char *s2, size_t n)
{
int c1, c2;
@ -2037,11 +2084,11 @@ void Com_sprintf (char *dest, size_t size, char *fmt, ...)
Com_HashFileName
=============
*/
long Com_HashFileName (const char *fname, int hashSize, qboolean sized)
unsigned int Com_HashFileName (const char *fname, int hashSize, qboolean sized)
{
int i = 0;
long hash = 0;
char letter;
int i = 0;
unsigned int hash = 0;
char letter;
if (fname[0] == '/' || fname[0] == '\\') i++; // skip leading slash
while (fname[i] != '\0')

View file

@ -134,10 +134,6 @@ __inline int Q_vsnprintf (char *Dest, size_t Count, const char *Format, va_list
// Eraser Bot's precompiled p_trail.c not compatible with modified entity state structure
//#define ERASER_COMPAT_BUILD
// enable to build exe to host net games
// (to bring MAX_MSG_LENGTH in line with UDP packet size)
//#define NET_SERVER_BUILD
#ifdef KMQUAKE2_ENGINE_MOD
#ifndef ERASER_COMPAT_BUILD
#define NEW_ENTITY_STATE_MEMBERS
@ -149,22 +145,17 @@ __inline int Q_vsnprintf (char *Dest, size_t Count, const char *Format, va_list
// enable to include looping of attenuated sounds
// changes entity_state_t struct
#define LOOP_SOUND_ATTENUATION
// enable to read compressed savegame files
#define READ_COMPRESSED_SAVEGAMES
// enable to save compressed savegame files
#define WRITE_COMPRESSED_SAVEGAMES
#define COMPRESSED_SAVEGAMES
#endif
#define ROQ_SUPPORT // whether to use new cinematic system
#define OGG_SUPPORT // whether to use Ogg Vorbis soundtrack
#define PNG_SUPPORT // whether to include PNG image support
#define LOC_SUPPORT // whether to include loc file support
#define USE_CURL // whether to include HTTP downloading
#define LOC_SUPPORT // whether to include loc file support
#define MD2_AS_MD3 // whether to load md2s into md3 memory representation
#ifndef MD2_AS_MD3
@ -218,6 +209,7 @@ __inline int Q_vsnprintf (char *Dest, size_t Count, const char *Format, va_list
#define OLD_MAX_SOUNDS 256
#define OLD_MAX_IMAGES 256
#define OLD_MAX_ITEMS 256
#define OLD_MAX_LIGHTSTYLES 256
//end Knightmare
#define MAX_ITEMS 256
@ -316,7 +308,7 @@ extern vec4_t vec4_origin;
//float Q_fabs (float f);
//#define fabs(f) Q_fabs(f)
#if !defined C_ONLY && !defined __linux__ && !defined __sgi
extern long Q_ftol( float f );
extern int Q_ftol( float f );
#else
#define Q_ftol( f ) ( long ) (f)
#endif
@ -370,6 +362,7 @@ void AnglesToAxis (const vec3_t angles, vec3_t axis[3]);
void AxisClear (vec3_t axis[3]);
void AxisCopy (const vec3_t in[3], vec3_t out[3]);
qboolean AxisCompare (const vec3_t axis1[3], const vec3_t axis2[3]);
void MatrixMultiply (float in1[3][3], float in2[3][3], float out[3][3]);
void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]);
@ -417,7 +410,7 @@ char *COM_Parse (char **data_p);
char *COM_ParseExt (char **data_p, qboolean allowNewLines);
void Com_sprintf (char *dest, size_t size, char *fmt, ...);
long Com_HashFileName (const char *fname, int hashSize, qboolean sized);
unsigned int Com_HashFileName (const char *fname, int hashSize, qboolean sized);
void Com_PageInMemory (byte *buffer, int size);
@ -468,7 +461,7 @@ int Q_SortStrcmp (const char **arg1, const char **arg2);
// portable case insensitive string compare
int Q_stricmp (char *s1, char *s2);
int Q_strcasecmp (char *s1, char *s2);
int Q_strncasecmp (char *s1, char *s2, int n);
int Q_strncasecmp (char *s1, char *s2, size_t n);
void Q_strncpyz (char *dst, const char *src, size_t dstSize);
void Q_strncatz (char *dst, const char *src, size_t dstSize);
@ -519,10 +512,10 @@ void Sys_Mkdir (char *path);
void Sys_Rmdir (char *path);
// large block stack allocation routines
void *Hunk_Begin (int maxsize);
void *Hunk_Alloc (int size);
void *Hunk_Begin (size_t maxsize);
void *Hunk_Alloc (size_t size);
void Hunk_Free (void *buf);
int Hunk_End (void);
size_t Hunk_End (void);
// directory searching
#define SFF_ARCH 0x01
@ -542,7 +535,7 @@ void Sys_Sleep (int msec);
unsigned Sys_TickCount (void);
// this is only here so the functions in q_shared.c and q_shwin.c can link
void Sys_Error (char *error, ...);
void Sys_Error (const char *error, ...);
void Com_Printf (char *msg, ...);
@ -603,8 +596,9 @@ COLLISION DETECTION
#define CONTENTS_SLIME 16
#define CONTENTS_WATER 32
#define CONTENTS_MIST 64
#define LAST_VISIBLE_CONTENTS 64
#define CONTENTS_MUD 128 // not a "real" content property - used only for watertype
#define CONTENTS_FOG 1024 // fog
#define LAST_VISIBLE_CONTENTS 1024 // was 64
// remaining contents are non-visible, and don't eat brushes
@ -667,6 +661,7 @@ COLLISION DETECTION
#define SURF_NOLIGHTENV 0x01000000 // no lightmap or envmap trans/warp surface
#define SURF_ALPHATEST 0x02000000 // alpha test flag
#define SURF_FOGPLANE 0x04000000 // fog surface
#define SURF_MIRROR 0x10000000
#define SURF_CHOPPY 0x20000000
@ -876,16 +871,16 @@ typedef struct
#define EF_PLASMA 0x01000000
#define EF_TRAP 0x02000000
//ROGUE
// ROGUE
#define EF_TRACKER 0x04000000
#define EF_DOUBLE 0x08000000
#define EF_SPHERETRANS 0x10000000
#define EF_TAGTRAIL 0x20000000
#define EF_HALF_DAMAGE 0x40000000
#define EF_TRACKERTRAIL 0x80000000
//ROGUE
// ROGUE
//mappack.h
// mappack.h
#define EF_EDARK 0x84000000 // pulsing dynamic black light
#define EF_BLUEC 0x08208000 // violet or pale blue shell
#define EF_REDC 0x30050001 // ef_rotate, red shell, transparent and a redlight
@ -909,12 +904,12 @@ typedef struct
#define RF_TRANS_ADDITIVE 8192
#define RF_MIRRORMODEL 16384
//ROGUE
// ROGUE
#define RF_IR_VISIBLE 0x00008000 // 32768
#define RF_SHELL_DOUBLE 0x00010000 // 65536
#define RF_SHELL_HALF_DAM 0x00020000
#define RF_USE_DISGUISE 0x00040000
//ROGUE
// ROGUE
#define RF_NOSHADOW 0x00080000 // Knightmare- no shadow flag
@ -932,7 +927,7 @@ typedef struct
#define RDF_CAMERAEFFECT 16 // Camera effect
#define RDF_LETTERBOX 32 // Letterboxed view
//Mappack - laser colors
// Mappack - laser colors
#define LASER_RED 0xf2f2f0f0
#define LASER_GREEN 0xd0d1d2d3
@ -966,7 +961,7 @@ typedef struct
#define MZ_PHALANX 18
#define MZ_SILENCED 128 // bit flag ORed with one of the above numbers
//ROGUE
// ROGUE
#define MZ_ETF_RIFLE 30
#define MZ_UNUSED 31
#define MZ_SHOTGUN2 32
@ -977,14 +972,14 @@ typedef struct
#define MZ_NUKE2 37
#define MZ_NUKE4 38
#define MZ_NUKE8 39
//Knightmare 1/3/2002- blue blaster and green hyperblaster
// ROGUE
// Knightmare 1/3/2002- blue blaster and green hyperblaster
#define MZ_BLUEBLASTER 40
#define MZ_GREENHYPERBLASTER 41
#define MZ_REDBLASTER 42
#define MZ_REDHYPERBLASTER 43
//end Knightmare
// end Knightmare
//ROGUE
//
// monster muzzle flashes
@ -1476,7 +1471,7 @@ ROGUE - VERSIONS
#define OLD_CS_SOUNDS (CS_MODELS+OLD_MAX_MODELS)
#define OLD_CS_IMAGES (OLD_CS_SOUNDS+OLD_MAX_SOUNDS)
#define OLD_CS_LIGHTS (OLD_CS_IMAGES+OLD_MAX_IMAGES)
#define OLD_CS_ITEMS (OLD_CS_LIGHTS+MAX_LIGHTSTYLES)
#define OLD_CS_ITEMS (OLD_CS_LIGHTS+OLD_MAX_LIGHTSTYLES)
#define OLD_CS_PLAYERSKINS (OLD_CS_ITEMS+OLD_MAX_ITEMS)
#define OLD_CS_GENERAL (OLD_CS_PLAYERSKINS+MAX_CLIENTS)
#define OLD_MAX_CONFIGSTRINGS (OLD_CS_GENERAL+MAX_GENERAL)

View file

@ -1790,16 +1790,17 @@ CM_WritePortalState
Writes the portal state to a savegame file
===================
*/
#ifdef WRITE_COMPRESSED_SAVEGAMES
#ifdef COMPRESSED_SAVEGAMES
void CM_WritePortalState (fileHandle_t f)
{
FS_Write (portalopen, sizeof(portalopen), f);
}
#else // WRITE_COMPRESSED_SAVEGAMESvoid CM_WritePortalState (FILE *f)
#else // COMPRESSED_SAVEGAMES
void CM_WritePortalState (FILE *f)
{
fwrite (portalopen, sizeof(portalopen), 1, f);
}
#endif // WRITE_COMPRESSED_SAVEGAMES
#endif // COMPRESSED_SAVEGAMES
/*
===================

View file

@ -1320,11 +1320,12 @@ typedef struct zhead_s
struct zhead_s *prev, *next;
short magic;
short tag; // for group free
int size;
size_t size;
} zhead_t;
zhead_t z_chain;
int z_count, z_bytes;
int z_count;
size_t z_bytes;
/*
========================
@ -1381,7 +1382,7 @@ void Z_FreeTags (int tag)
Z_TagMalloc
========================
*/
void *Z_TagMalloc (int size, int tag)
void *Z_TagMalloc (size_t size, int tag)
{
zhead_t *z;
@ -1409,7 +1410,7 @@ void *Z_TagMalloc (int size, int tag)
Z_Malloc
========================
*/
void *Z_Malloc (int size)
void *Z_Malloc (size_t size)
{
return Z_TagMalloc (size, 0);
}

View file

@ -924,8 +924,8 @@ extern int time_before_ref;
extern int time_after_ref;
void Z_Free (void *ptr);
void *Z_Malloc (int size); // returns 0 filled memory
void *Z_TagMalloc (int size, int tag);
void *Z_Malloc (size_t size); // returns 0 filled memory
void *Z_TagMalloc (size_t size, int tag);
void Z_FreeTags (int tag);
void Qcommon_Init (int argc, char **argv);
@ -958,7 +958,7 @@ void *Sys_GetGameAPI (void *parms);
char *Sys_ConsoleInput (void);
void Sys_ConsoleOutput (char *string);
void Sys_SendKeyEvents (void);
void Sys_Error (char *error, ...);
void Sys_Error (const char *error, ...);
void Sys_Quit (void);
char *Sys_GetClipboardData( void );
void Sys_CopyProtect (void);

View file

@ -459,7 +459,8 @@ typedef struct
#define CONTENTS_SLIME 16
#define CONTENTS_WATER 32
#define CONTENTS_MIST 64
#define LAST_VISIBLE_CONTENTS 64
#define CONTENTS_FOG 1024 // fog
#define LAST_VISIBLE_CONTENTS 1024 // was 64
// remaining contents are non-visible, and don't eat brushes

View file

@ -308,9 +308,9 @@ byte *Mod_ClusterPVS (int cluster, model_t *model);
void Mod_Modellist_f (void);
void *Hunk_Begin (int maxsize);
void *Hunk_Alloc (int size);
int Hunk_End (void);
void *Hunk_Begin (size_t maxsize);
void *Hunk_Alloc (size_t size);
size_t Hunk_End (void);
void Hunk_Free (void *base);
void Mod_FreeAll (void);

View file

@ -271,11 +271,11 @@ void SV_CopySaveGame (char *src, char *dst)
}
}
#ifdef WRITE_COMPRESSED_SAVEGAMES
#ifdef COMPRESSED_SAVEGAMES
void CM_WritePortalState (fileHandle_t f);
#else // WRITE_COMPRESSED_SAVEGAMES
#else // COMPRESSED_SAVEGAMES
void CM_WritePortalState (FILE *f);
#endif // WRITE_COMPRESSED_SAVEGAMES
#endif // COMPRESSED_SAVEGAMES
/*
==============
SV_WriteLevelFile
@ -284,7 +284,7 @@ SV_WriteLevelFile
*/
void SV_WriteLevelFile (void)
{
#ifdef WRITE_COMPRESSED_SAVEGAMES
#ifdef COMPRESSED_SAVEGAMES
char name[MAX_OSPATH], zipName[MAX_QPATH], intName[MAX_QPATH];
fileHandle_t f;
@ -301,7 +301,7 @@ void SV_WriteLevelFile (void)
FS_Write (sv.configstrings, sizeof(sv.configstrings), f);
CM_WritePortalState (f);
FS_FCloseFile (f);
#else // WRITE_COMPRESSED_SAVEGAMES char name[MAX_OSPATH];
#else // COMPRESSED_SAVEGAMES
char name[MAX_OSPATH];
FILE *f;
@ -317,11 +317,11 @@ void SV_WriteLevelFile (void)
fwrite (sv.configstrings, sizeof(sv.configstrings), 1, f);
CM_WritePortalState (f);
fclose (f);
#endif // WRITE_COMPRESSED_SAVEGAMES
#endif // COMPRESSED_SAVEGAMES
Com_sprintf (name, sizeof(name), "%s/save/current/%s.sav", FS_Gamedir(), sv.name);
ge->WriteLevel (name);
#ifdef WRITE_COMPRESSED_SAVEGAMES
#ifdef COMPRESSED_SAVEGAMES
// compress .sav into .savz
Com_sprintf (zipName, sizeof(zipName), "/save/current/%s.savz", sv.name);
Com_sprintf (intName, sizeof(intName), "%s.sav", sv.name);
@ -329,7 +329,7 @@ void SV_WriteLevelFile (void)
// delete .sav
remove (name);
#endif // WRITE_COMPRESSED_SAVEGAMES}
#endif // COMPRESSED_SAVEGAMES
}
void CM_ReadPortalState (fileHandle_t f);
@ -343,14 +343,14 @@ void SV_ReadLevelFile (void)
{
char name[MAX_OSPATH];
fileHandle_t f;
#ifdef READ_COMPRESSED_SAVEGAMES // check for compressed .savz file here
#ifdef COMPRESSED_SAVEGAMES // check for compressed .savz file here
char zipName[MAX_QPATH], intName[MAX_QPATH];
FILE *fp;
#endif // READ_COMPRESSED_SAVEGAMES
#endif // COMPRESSED_SAVEGAMES
Com_DPrintf("SV_ReadLevelFile()\n");
#ifdef READ_COMPRESSED_SAVEGAMES // check for compressed .savz file here
#ifdef COMPRESSED_SAVEGAMES // check for compressed .savz file here
Com_sprintf (zipName, sizeof(zipName), "save/current/%s.savz", sv.name);
Com_sprintf (intName, sizeof(intName), "%s.sv2", sv.name);
@ -362,7 +362,7 @@ void SV_ReadLevelFile (void)
FS_FCloseFile(f);
}
else
#endif // READ_COMPRESSED_SAVEGAMES
#endif // COMPRESSED_SAVEGAMES
{
Com_sprintf (name, sizeof(name), "save/current/%s.sv2", sv.name);
FS_FOpenFile (name, &f, FS_READ);
@ -377,7 +377,7 @@ void SV_ReadLevelFile (void)
}
Com_sprintf (name, sizeof(name), "%s/save/current/%s.sav", FS_Gamedir(), sv.name);
#ifdef READ_COMPRESSED_SAVEGAMES
#ifdef COMPRESSED_SAVEGAMES
// check for .sav; if not present, decompress from .savz
fp = fopen (name, "rb");
if (!fp) {
@ -388,7 +388,7 @@ void SV_ReadLevelFile (void)
else {
fclose (fp);
}
#endif // READ_COMPRESSED_SAVEGAMES
#endif // COMPRESSED_SAVEGAMES
ge->ReadLevel (name);
}

View file

@ -411,7 +411,7 @@ void SV_InitGameProgs (void)
import.FRead = FS_Read;
import.FWrite = FS_Write;
import.GameDir = FS_GameDir;
import.SaveGameDir = FS_GameDir;
import.SaveGameDir = FS_GameDir; // change to FS_SaveGameDir when ready
import.CreatePath = FS_CreatePath;
import.GetFileList = FS_GetFileList;

View file

@ -142,16 +142,16 @@ void SV_CheckForSavegame (void)
Com_sprintf (name, sizeof(name), "%s/save/current/%s.sav", FS_Gamedir(), sv.name);
f = fopen (name, "rb");
if (!f)
#ifdef READ_COMPRESSED_SAVEGAMES
#ifdef COMPRESSED_SAVEGAMES
{
Com_sprintf (name, sizeof(name), "%s/save/current/%s.savz", FS_Gamedir(), sv.name);
f = fopen (name, "rb");
if (!f)
return; // no savegame
}
#else // READ_COMPRESSED_SAVEGAMES
#else // COMPRESSED_SAVEGAMES
return; // no savegame
#endif // READ_COMPRESSED_SAVEGAMES
#endif // COMPRESSED_SAVEGAMES
fclose (f);

View file

@ -33,12 +33,12 @@ int hunkcount;
byte *membase;
int hunkmaxsize;
int cursize;
size_t hunkmaxsize;
size_t cursize;
#define VIRTUAL_ALLOC
void *Hunk_Begin (int maxsize)
void *Hunk_Begin (size_t maxsize)
{
// reserve a huge chunk of memory, but don't commit any yet
cursize = 0;
@ -54,7 +54,7 @@ void *Hunk_Begin (int maxsize)
return (void *)membase;
}
void *Hunk_Alloc (int size)
void *Hunk_Alloc (size_t size)
{
void *buf;
@ -78,7 +78,7 @@ void *Hunk_Alloc (int size)
return (void *)(membase+cursize-size);
}
int Hunk_End (void)
size_t Hunk_End (void)
{
// free the remaining unused virtual memory

View file

@ -153,7 +153,7 @@ void Sys_ConsoleOutput (char *text)
Sys_Error
=================
*/
void Sys_Error (char *error, ...)
void Sys_Error (const char *error, ...)
{
char string[1024];
va_list argPtr;