Fix all whitespace errors

Excluding 3rd party files.
This commit is contained in:
dhewg 2011-12-06 19:20:15 +01:00
parent ff493f6847
commit 79ad905e05
1086 changed files with 21052 additions and 21253 deletions

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -72,7 +72,7 @@ public:
const char *NextToken( const char *errorstring = NULL ); const char *NextToken( const char *errorstring = NULL );
bool TokenAvailable( void ) { return currentToken < tokens.Num(); }; bool TokenAvailable( void ) { return currentToken < tokens.Num(); };
int Num( void ) { return tokens.Num(); }; int Num( void ) { return tokens.Num(); };
void UnGetToken( void ) { if ( currentToken > 0 ) { currentToken--; } }; void UnGetToken( void ) { if ( currentToken > 0 ) { currentToken--; } };
const char *GetToken( int index ) { if ( ( index >= 0 ) && ( index < tokens.Num() ) ) { return tokens[ index ]; } else { return NULL; } }; const char *GetToken( int index ) { if ( ( index >= 0 ) && ( index < tokens.Num() ) ) { return tokens[ index ]; } else { return NULL; } };
const char *CurrentToken( void ) { return GetToken( currentToken ); }; const char *CurrentToken( void ) { return GetToken( currentToken ); };
@ -101,10 +101,10 @@ public:
class idExportOptions { class idExportOptions {
private: private:
idTokenizer tokens; idTokenizer tokens;
void Reset( const char *commandline ); void Reset( const char *commandline );
public: public:
idStr commandLine; idStr commandLine;
idStr src; idStr src;
idStr dest; idStr dest;
@ -132,9 +132,9 @@ public:
float rotate; float rotate;
float jointThreshold; float jointThreshold;
int cycleStart; int cycleStart;
idExportOptions( const char *commandline, const char *ospath ); idExportOptions( const char *commandline, const char *ospath );
bool jointInExportGroup( const char *jointname ); bool jointInExportGroup( const char *jointname );
}; };
@ -154,15 +154,15 @@ public:
int index; int index;
int exportNum; int exportNum;
bool keep; bool keep;
float scale; float scale;
float invscale; float invscale;
MFnDagNode *dagnode; MFnDagNode *dagnode;
idHierarchy<idExportJoint> mayaNode; idHierarchy<idExportJoint> mayaNode;
idHierarchy<idExportJoint> exportNode; idHierarchy<idExportJoint> exportNode;
idVec3 t; idVec3 t;
idMat3 wm; idMat3 wm;
@ -176,7 +176,7 @@ public:
int firstComponent; int firstComponent;
jointFrame_t baseFrame; jointFrame_t baseFrame;
int depth; int depth;
idExportJoint(); idExportJoint();
idExportJoint &operator=( const idExportJoint &other ); idExportJoint &operator=( const idExportJoint &other );
}; };
@ -281,23 +281,23 @@ typedef struct md3Tag_s {
** XyzNormals sizeof( md3XyzNormal_t ) * numVerts * numFrames ** XyzNormals sizeof( md3XyzNormal_t ) * numVerts * numFrames
*/ */
typedef struct { typedef struct {
int ident; // int ident; //
char name[MAX_Q3PATH]; // polyset name char name[MAX_Q3PATH]; // polyset name
int flags; int flags;
int numFrames; // all surfaces in a model should have the same int numFrames; // all surfaces in a model should have the same
int numShaders; // all surfaces in a model should have the same int numShaders; // all surfaces in a model should have the same
int numVerts; int numVerts;
int numTriangles; int numTriangles;
int ofsTriangles; int ofsTriangles;
int ofsShaders; // offset from start of md3Surface_t int ofsShaders; // offset from start of md3Surface_t
int ofsSt; // texture coords are common for all frames int ofsSt; // texture coords are common for all frames
int ofsXyzNormals; // numVerts * numFrames int ofsXyzNormals; // numVerts * numFrames
int ofsEnd; // next surface follows int ofsEnd; // next surface follows
} md3Surface_t; } md3Surface_t;
@ -328,7 +328,7 @@ typedef struct {
int flags; int flags;
int numFrames; int numFrames;
int numTags; int numTags;
int numSurfaces; int numSurfaces;
int numSkins; int numSkins;
@ -389,7 +389,7 @@ public:
int frameRate; int frameRate;
int numFrames; int numFrames;
int skipjoints; int skipjoints;
int export_joints; int export_joints;
idList<idExportMesh *> meshes; idList<idExportMesh *> meshes;
idExportModel(); idExportModel();
@ -424,7 +424,7 @@ private:
void GetBindPose( MObject &jointNode, idExportJoint *joint, float scale ); void GetBindPose( MObject &jointNode, idExportJoint *joint, float scale );
void GetLocalTransform( idExportJoint *joint, idVec3 &pos, idMat3 &mat ); void GetLocalTransform( idExportJoint *joint, idVec3 &pos, idMat3 &mat );
void GetWorldTransform( idExportJoint *joint, idVec3 &pos, idMat3 &mat, float scale ); void GetWorldTransform( idExportJoint *joint, idVec3 &pos, idMat3 &mat, float scale );
void CreateJoints( float scale ); void CreateJoints( float scale );
void PruneJoints( idStrList &keepjoints, idStr &prefix ); void PruneJoints( idStrList &keepjoints, idStr &prefix );
void RenameJoints( idList<idNamePair> &renamejoints, idStr &prefix ); void RenameJoints( idList<idNamePair> &renamejoints, idStr &prefix );

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -211,7 +211,7 @@ bool OSPathToRelativePath( const char *osPath, idStr &qpath, const char *game )
base = s; base = s;
} }
} }
} }
if ( base ) { if ( base ) {
s = strstr( base, "/" ); s = strstr( base, "/" );
@ -241,11 +241,11 @@ idMat3 ConvertFromIdSpace( const idMat3 &idmat ) {
mat[ 0 ][ 0 ] = idmat[ 0 ][ 0 ]; mat[ 0 ][ 0 ] = idmat[ 0 ][ 0 ];
mat[ 0 ][ 2 ] = -idmat[ 0 ][ 1 ]; mat[ 0 ][ 2 ] = -idmat[ 0 ][ 1 ];
mat[ 0 ][ 1 ] = idmat[ 0 ][ 2 ]; mat[ 0 ][ 1 ] = idmat[ 0 ][ 2 ];
mat[ 1 ][ 0 ] = idmat[ 1 ][ 0 ]; mat[ 1 ][ 0 ] = idmat[ 1 ][ 0 ];
mat[ 1 ][ 2 ] = -idmat[ 1 ][ 1 ]; mat[ 1 ][ 2 ] = -idmat[ 1 ][ 1 ];
mat[ 1 ][ 1 ] = idmat[ 1 ][ 2 ]; mat[ 1 ][ 1 ] = idmat[ 1 ][ 2 ];
mat[ 2 ][ 0 ] = idmat[ 2 ][ 0 ]; mat[ 2 ][ 0 ] = idmat[ 2 ][ 0 ];
mat[ 2 ][ 2 ] = -idmat[ 2 ][ 1 ]; mat[ 2 ][ 2 ] = -idmat[ 2 ][ 1 ];
mat[ 2 ][ 1 ] = idmat[ 2 ][ 2 ]; mat[ 2 ][ 1 ] = idmat[ 2 ][ 2 ];
@ -408,7 +408,7 @@ int idTokenizer::SetTokens( const char *buffer ) {
if ( !*cmd ) { if ( !*cmd ) {
break; break;
} }
idStr &current = tokens.Alloc(); idStr &current = tokens.Alloc();
while( *cmd && !isspace( *cmd ) ) { while( *cmd && !isspace( *cmd ) ) {
current += *cmd; current += *cmd;
@ -603,7 +603,7 @@ idExportOptions::idExportOptions( const char *commandline, const char *ospath )
if ( quatPrecision < 0.0f ) { if ( quatPrecision < 0.0f ) {
MayaError( "Invalid value for -quatprecision. Must be >= 0" ); MayaError( "Invalid value for -quatprecision. Must be >= 0" );
} }
} else if ( token == "-jointthreshold" ) { } else if ( token == "-jointthreshold" ) {
// parse joint threshold // parse joint threshold
token = tokens.NextToken( "Missing weight for -jointthreshold. Usage: -jointthreshold [minimum joint weight]" ); token = tokens.NextToken( "Missing weight for -jointthreshold. Usage: -jointthreshold [minimum joint weight]" );
@ -743,7 +743,7 @@ idExportJoint::idExportJoint() {
exportNode.SetOwner( this ); exportNode.SetOwner( this );
dagnode = NULL; dagnode = NULL;
t = vec3_zero; t = vec3_zero;
wm = mat3_default; wm = mat3_default;
bindpos = vec3_zero; bindpos = vec3_zero;
@ -764,15 +764,15 @@ idExportJoint &idExportJoint::operator=( const idExportJoint &other ) {
index = other.index; index = other.index;
exportNum = other.exportNum; exportNum = other.exportNum;
keep = other.keep; keep = other.keep;
scale = other.scale; scale = other.scale;
invscale = other.invscale; invscale = other.invscale;
dagnode = other.dagnode; dagnode = other.dagnode;
mayaNode = other.mayaNode; mayaNode = other.mayaNode;
exportNode = other.exportNode; exportNode = other.exportNode;
t = other.t; t = other.t;
idt = other.idt; idt = other.idt;
wm = other.wm; wm = other.wm;
@ -1027,7 +1027,7 @@ bool idExportModel::WriteMesh( const char *filename, idExportOptions &options )
} }
idCQuat bindQuat = joint->bindmat.ToQuat().ToCQuat(); idCQuat bindQuat = joint->bindmat.ToQuat().ToCQuat();
WriteFloatString( file, "\t\"%s\"\t%d ( %f %f %f ) ( %f %f %f )\t\t// %s\n", joint->name.c_str(), parentNum, WriteFloatString( file, "\t\"%s\"\t%d ( %f %f %f ) ( %f %f %f )\t\t// %s\n", joint->name.c_str(), parentNum,
joint->bindpos.x, joint->bindpos.y, joint->bindpos.z, bindQuat[ 0 ], bindQuat[ 1 ], bindQuat[ 2 ], parentName ); joint->bindpos.x, joint->bindpos.y, joint->bindpos.z, bindQuat[ 0 ], bindQuat[ 1 ], bindQuat[ 2 ], parentName );
} }
WriteFloatString( file, "}\n" ); WriteFloatString( file, "}\n" );
@ -1042,11 +1042,11 @@ bool idExportModel::WriteMesh( const char *filename, idExportOptions &options )
WriteFloatString( file, "\nmesh {\n" ); WriteFloatString( file, "\nmesh {\n" );
WriteFloatString( file, "\t// meshes: %s\n", mesh->name.c_str() ); WriteFloatString( file, "\t// meshes: %s\n", mesh->name.c_str() );
WriteFloatString( file, "\tshader \"%s\"\n", mesh->shader.c_str() ); WriteFloatString( file, "\tshader \"%s\"\n", mesh->shader.c_str() );
WriteFloatString( file, "\n\tnumverts %d\n", mesh->verts.Num() ); WriteFloatString( file, "\n\tnumverts %d\n", mesh->verts.Num() );
for( j = 0; j < mesh->verts.Num(); j++ ) { for( j = 0; j < mesh->verts.Num(); j++ ) {
WriteFloatString( file, "\tvert %d ( %f %f ) %d %d\n", j, mesh->verts[ j ].texCoords[ 0 ], mesh->verts[ j ].texCoords[ 1 ], WriteFloatString( file, "\tvert %d ( %f %f ) %d %d\n", j, mesh->verts[ j ].texCoords[ 0 ], mesh->verts[ j ].texCoords[ 1 ],
mesh->verts[ j ].startweight, mesh->verts[ j ].numWeights ); mesh->verts[ j ].startweight, mesh->verts[ j ].numWeights );
} }
WriteFloatString( file, "\n\tnumtris %d\n", mesh->tris.Num() ); WriteFloatString( file, "\n\tnumtris %d\n", mesh->tris.Num() );
@ -1059,7 +1059,7 @@ bool idExportModel::WriteMesh( const char *filename, idExportOptions &options )
exportWeight_t *weight; exportWeight_t *weight;
weight = &mesh->weights[ j ]; weight = &mesh->weights[ j ];
WriteFloatString( file, "\tweight %d %d %f ( %f %f %f )\n", j, WriteFloatString( file, "\tweight %d %d %f ( %f %f %f )\n", j,
weight->joint->exportNum, weight->jointWeight, weight->offset.x, weight->offset.y, weight->offset.z ); weight->joint->exportNum, weight->jointWeight, weight->offset.x, weight->offset.y, weight->offset.z );
} }
@ -1156,7 +1156,7 @@ bool idExportModel::WriteAnim( const char *filename, idExportOptions &options )
WriteFloatString( file, "numJoints %d\n", jointList.Num() ); WriteFloatString( file, "numJoints %d\n", jointList.Num() );
WriteFloatString( file, "frameRate %d\n", frameRate ); WriteFloatString( file, "frameRate %d\n", frameRate );
WriteFloatString( file, "numAnimatedComponents %d\n", numAnimatedComponents ); WriteFloatString( file, "numAnimatedComponents %d\n", numAnimatedComponents );
// write out the hierarchy // write out the hierarchy
WriteFloatString( file, "\nhierarchy {\n" ); WriteFloatString( file, "\nhierarchy {\n" );
for( i = 0; i < jointList.Num(); i++ ) { for( i = 0; i < jointList.Num(); i++ ) {
@ -1251,7 +1251,7 @@ bool idExportModel::WriteCamera( const char *filename, idExportOptions &options
WriteFloatString( file, "numFrames %d\n", camera.Num() ); WriteFloatString( file, "numFrames %d\n", camera.Num() );
WriteFloatString( file, "frameRate %d\n", frameRate ); WriteFloatString( file, "frameRate %d\n", frameRate );
WriteFloatString( file, "numCuts %d\n", cameraCuts.Num() ); WriteFloatString( file, "numCuts %d\n", cameraCuts.Num() );
// write out the cuts // write out the cuts
WriteFloatString( file, "\ncuts {\n" ); WriteFloatString( file, "\ncuts {\n" );
for( i = 0; i < cameraCuts.Num(); i++ ) { for( i = 0; i < cameraCuts.Num(); i++ ) {
@ -1511,7 +1511,7 @@ void idMayaExport::GetBindPose( MObject &jointNode, idExportJoint *joint, float
if ( MS::kSuccess != status ) { if ( MS::kSuccess != status ) {
// Problem retrieving world matrix // Problem retrieving world matrix
return; return;
} }
MFnMatrixData dMatrix( worldMatrix ); MFnMatrixData dMatrix( worldMatrix );
MMatrix wMatrix = dMatrix.matrix( &status ); MMatrix wMatrix = dMatrix.matrix( &status );
@ -1658,7 +1658,7 @@ void idMayaExport::CreateJoints( float scale ) {
delete parentNode; delete parentNode;
} }
// create long name // create long name
parent = joint->mayaNode.GetParent(); parent = joint->mayaNode.GetParent();
if ( parent ) { if ( parent ) {
@ -1681,7 +1681,7 @@ void idMayaExport::CreateJoints( float scale ) {
} }
joint->dagnode->getPath( dagPath ); joint->dagnode->getPath( dagPath );
GetBindPose( dagPath.node( &status ), joint, scale ); GetBindPose( dagPath.node( &status ), joint, scale );
} }
} }
@ -1762,7 +1762,7 @@ bool idMayaExport::RemapParents( idList<idNamePair> &remapjoints ) {
// force the joint to be kept // force the joint to be kept
origin->keep = true; origin->keep = true;
// make all root joints children of the origin joint // make all root joints children of the origin joint
joint = model.exportHead.GetChild(); joint = model.exportHead.GetChild();
while( joint ) { while( joint ) {
@ -1787,8 +1787,8 @@ MObject idMayaExport::FindShader( MObject& setNode ) {
MStatus status; MStatus status;
MFnDependencyNode fnNode( setNode ); MFnDependencyNode fnNode( setNode );
MPlug shaderPlug; MPlug shaderPlug;
shaderPlug = fnNode.findPlug( "surfaceShader" ); shaderPlug = fnNode.findPlug( "surfaceShader" );
if ( !shaderPlug.isNull() ) { if ( !shaderPlug.isNull() ) {
MPlugArray connectedPlugs; MPlugArray connectedPlugs;
bool asSrc = false; bool asSrc = false;
@ -1800,8 +1800,8 @@ MObject idMayaExport::FindShader( MObject& setNode ) {
} else { } else {
return connectedPlugs[ 0 ].node(); return connectedPlugs[ 0 ].node();
} }
} }
return MObject::kNullObj; return MObject::kNullObj;
} }
@ -1818,7 +1818,7 @@ void idMayaExport::GetTextureForMesh( idExportMesh *mesh, MFnDagNode &dagNode )
MDagPath path; MDagPath path;
int i; int i;
int instanceNum; int instanceNum;
status = dagNode.getPath( path ); status = dagNode.getPath( path );
if ( !status ) { if ( !status ) {
return; return;
@ -1834,9 +1834,9 @@ void idMayaExport::GetTextureForMesh( idExportMesh *mesh, MFnDagNode &dagNode )
instanceNum = path.instanceNumber(); instanceNum = path.instanceNumber();
} }
// Get a list of all sets pertaining to the selected shape and the // Get a list of all sets pertaining to the selected shape and the
// members of those sets. // members of those sets.
// //
MFnMesh fnMesh( path ); MFnMesh fnMesh( path );
MObjectArray sets; MObjectArray sets;
MObjectArray comps; MObjectArray comps;
@ -1846,8 +1846,8 @@ void idMayaExport::GetTextureForMesh( idExportMesh *mesh, MFnDagNode &dagNode )
} }
// Loop through all the sets. If the set is a polygonal set, find the // Loop through all the sets. If the set is a polygonal set, find the
// shader attached to the and print out the texture file name for the // shader attached to the and print out the texture file name for the
// set along with the polygons in the set. // set along with the polygons in the set.
// //
for ( i = 0; i < ( int )sets.length(); i++ ) { for ( i = 0; i < ( int )sets.length(); i++ ) {
MObject set = sets[i]; MObject set = sets[i];
@ -1856,20 +1856,20 @@ void idMayaExport::GetTextureForMesh( idExportMesh *mesh, MFnDagNode &dagNode )
MFnSet fnSet( set, &status ); MFnSet fnSet( set, &status );
if ( status == MS::kFailure ) { if ( status == MS::kFailure ) {
MayaError( "GetTextureForMesh: MFnSet constructor failed (%s)", status.errorString().asChar() ); MayaError( "GetTextureForMesh: MFnSet constructor failed (%s)", status.errorString().asChar() );
continue; continue;
} }
// Make sure the set is a polygonal set. If not, continue. // Make sure the set is a polygonal set. If not, continue.
MItMeshPolygon piter(path, comp, &status); MItMeshPolygon piter(path, comp, &status);
if (status == MS::kFailure) { if (status == MS::kFailure) {
continue; continue;
} }
// Find the texture that is applied to this set. First, get the // Find the texture that is applied to this set. First, get the
// shading node connected to the set. Then, if there is an input // shading node connected to the set. Then, if there is an input
// attribute called "color", search upstream from it for a texture // attribute called "color", search upstream from it for a texture
// file node. // file node.
// //
MObject shaderNode = FindShader( set ); MObject shaderNode = FindShader( set );
if ( shaderNode == MObject::kNullObj ) { if ( shaderNode == MObject::kNullObj ) {
continue; continue;
@ -1881,29 +1881,29 @@ void idMayaExport::GetTextureForMesh( idExportMesh *mesh, MFnDagNode &dagNode )
} }
MItDependencyGraph dgIt(colorPlug, MFn::kFileTexture, MItDependencyGraph dgIt(colorPlug, MFn::kFileTexture,
MItDependencyGraph::kUpstream, MItDependencyGraph::kUpstream,
MItDependencyGraph::kBreadthFirst, MItDependencyGraph::kBreadthFirst,
MItDependencyGraph::kNodeLevel, MItDependencyGraph::kNodeLevel,
&status); &status);
if ( status == MS::kFailure ) { if ( status == MS::kFailure ) {
continue; continue;
} }
dgIt.disablePruningOnFilter(); dgIt.disablePruningOnFilter();
// If no texture file node was found, just continue. // If no texture file node was found, just continue.
// //
if ( dgIt.isDone() ) { if ( dgIt.isDone() ) {
continue; continue;
} }
// Print out the texture node name and texture file that it references. // Print out the texture node name and texture file that it references.
// //
MObject textureNode = dgIt.thisNode(); MObject textureNode = dgIt.thisNode();
MPlug filenamePlug = MFnDependencyNode( textureNode ).findPlug( "fileTextureName" ); MPlug filenamePlug = MFnDependencyNode( textureNode ).findPlug( "fileTextureName" );
MString textureName; MString textureName;
filenamePlug.getValue( textureName ); filenamePlug.getValue( textureName );
// remove the OS path and save it in the mesh // remove the OS path and save it in the mesh
OSPathToRelativePath( textureName.asChar(), mesh->shader, options.game ); OSPathToRelativePath( textureName.asChar(), mesh->shader, options.game );
@ -2002,7 +2002,7 @@ idExportMesh *idMayaExport::CopyMesh( MFnSkinCluster &skinCluster, float scale )
return NULL; return NULL;
} }
} }
if ( options.skipmeshes.Find( name ) || options.skipmeshes.Find( altname ) ) { if ( options.skipmeshes.Find( name ) || options.skipmeshes.Find( altname ) ) {
common->Printf( "Skipping mesh '%s' ('%s')\n", name.c_str(), altname.c_str() ); common->Printf( "Skipping mesh '%s' ('%s')\n", name.c_str(), altname.c_str() );
return NULL; return NULL;
@ -2032,13 +2032,13 @@ idExportMesh *idMayaExport::CopyMesh( MFnSkinCluster &skinCluster, float scale )
MIntArray vertexList; MIntArray vertexList;
int p; int p;
p = fnmesh.numPolygons( &status ); p = fnmesh.numPolygons( &status );
mesh->tris.SetNum( p ); mesh->tris.SetNum( p );
mesh->uv.SetNum( p ); mesh->uv.SetNum( p );
MString setName; MString setName;
status = fnmesh.getCurrentUVSetName( setName ); status = fnmesh.getCurrentUVSetName( setName );
if ( !status ) { if ( !status ) {
MayaError( "CopyMesh: MFnMesh::getCurrentUVSetName failed (%s)", status.errorString().asChar() ); MayaError( "CopyMesh: MFnMesh::getCurrentUVSetName failed (%s)", status.errorString().asChar() );
@ -2052,12 +2052,12 @@ idExportMesh *idMayaExport::CopyMesh( MFnSkinCluster &skinCluster, float scale )
for( k = 0; k < 3; k++ ) { for( k = 0; k < 3; k++ ) {
mesh->tris[ j ].indexes[ k ] = vertexList[ k ]; mesh->tris[ j ].indexes[ k ] = vertexList[ k ];
status = fnmesh.getPolygonUV( j, k, uv_u, uv_v, &setName ); status = fnmesh.getPolygonUV( j, k, uv_u, uv_v, &setName );
if ( !status ) { if ( !status ) {
MayaError( "CopyMesh: MFnMesh::getPolygonUV failed (%s)", status.errorString().asChar() ); MayaError( "CopyMesh: MFnMesh::getPolygonUV failed (%s)", status.errorString().asChar() );
} }
mesh->uv[ j ].uv[ k ][ 0 ] = uv_u; mesh->uv[ j ].uv[ k ][ 0 ] = uv_u;
mesh->uv[ j ].uv[ k ][ 1 ] = uv_v; mesh->uv[ j ].uv[ k ][ 1 ] = uv_v;
} }
@ -2086,14 +2086,14 @@ void idMayaExport::CreateMesh( float scale ) {
count = 0; count = 0;
for ( ; !iter.isDone(); iter.next() ) { for ( ; !iter.isDone(); iter.next() ) {
MObject object = iter.item(); MObject object = iter.item();
count++; count++;
// For each skinCluster node, get the list of influence objects // For each skinCluster node, get the list of influence objects
MFnSkinCluster skinCluster( object, &status ); MFnSkinCluster skinCluster( object, &status );
if ( !status ) { if ( !status ) {
MayaError( "%s: Error getting skin cluster (%s)", object.apiTypeStr(), status.errorString().asChar() ); MayaError( "%s: Error getting skin cluster (%s)", object.apiTypeStr(), status.errorString().asChar() );
} }
mesh = CopyMesh( skinCluster, scale ); mesh = CopyMesh( skinCluster, scale );
if ( !mesh ) { if ( !mesh ) {
@ -2109,7 +2109,7 @@ void idMayaExport::CreateMesh( float scale ) {
if ( 0 == nInfs ) { if ( 0 == nInfs ) {
MayaError( "Mesh '%s': No influence objects found", mesh->name.c_str() ); MayaError( "Mesh '%s': No influence objects found", mesh->name.c_str() );
} }
// loop through the geometries affected by this cluster // loop through the geometries affected by this cluster
nGeoms = skinCluster.numOutputConnections(); nGeoms = skinCluster.numOutputConnections();
for (size_t ii = 0; ii < nGeoms; ++ii) { for (size_t ii = 0; ii < nGeoms; ++ii) {
@ -2183,7 +2183,7 @@ void idMayaExport::CreateMesh( float scale ) {
if ( w > options.jointThreshold ) { if ( w > options.jointThreshold ) {
weight.joint = joints[ jj ]; weight.joint = joints[ jj ];
weight.jointWeight = wts[ jj ]; weight.jointWeight = wts[ jj ];
if ( !options.ignoreScale ) { if ( !options.ignoreScale ) {
weight.joint->bindmat.ProjectVector( vert->pos - ( weight.joint->bindpos * weight.joint->invscale ), weight.offset ); weight.joint->bindmat.ProjectVector( vert->pos - ( weight.joint->bindpos * weight.joint->invscale ), weight.offset );
weight.offset *= weight.joint->scale; weight.offset *= weight.joint->scale;
@ -2367,7 +2367,7 @@ float idMayaExport::GetCameraFov( idExportJoint *joint ) {
fov = 90.0f; fov = 90.0f;
for( j = 0; j < childCount; j++ ) { for( j = 0; j < childCount; j++ ) {
MObject childNode = dagnode->child( j ); MObject childNode = dagnode->child( j );
n1 = GetObjectType( cameraNode ); n1 = GetObjectType( cameraNode );
n2 = GetObjectType( childNode ); n2 = GetObjectType( childNode );
if ( ( !strcmp( "transform", n1 ) ) && ( !strcmp( "camera", n2 ) ) ) { if ( ( !strcmp( "transform", n1 ) ) && ( !strcmp( "camera", n2 ) ) ) {
@ -2394,7 +2394,7 @@ void idMayaExport::GetCameraFrame( idExportJoint *camera, idMat3 &align, cameraF
// get the worldspace positions of the joint // get the worldspace positions of the joint
GetWorldTransform( camera, pos, axis, 1.0f ); GetWorldTransform( camera, pos, axis, 1.0f );
// convert to id coordinates // convert to id coordinates
cam->t = ConvertToIdSpace( pos ) * align; cam->t = ConvertToIdSpace( pos ) * align;
@ -2482,7 +2482,7 @@ void idMayaExport::CreateCameraAnim( idMat3 &align ) {
} }
} }
camJoint = model.FindJoint( currentCam ); camJoint = model.FindJoint( currentCam );
if ( !camJoint ) { if ( !camJoint ) {
MayaError( "Couldn't find camera '%s'", currentCam.c_str() ); MayaError( "Couldn't find camera '%s'", currentCam.c_str() );
} }
@ -2564,7 +2564,7 @@ void idMayaExport::GetDefaultPose( idMat3 &align ) {
// get the worldspace positions of the joint // get the worldspace positions of the joint
GetWorldTransform( joint, jointpos, jointaxis, options.scale ); GetWorldTransform( joint, jointpos, jointaxis, options.scale );
// convert to id coordinates // convert to id coordinates
jointaxis = ConvertToIdSpace( jointaxis ) * align; jointaxis = ConvertToIdSpace( jointaxis ) * align;
jointpos = ConvertToIdSpace( jointpos ) * align; jointpos = ConvertToIdSpace( jointpos ) * align;
@ -2682,7 +2682,7 @@ void idMayaExport::CreateAnimation( idMat3 &align ) {
// get the worldspace positions of the joint // get the worldspace positions of the joint
GetWorldTransform( joint, jointpos, jointaxis, options.scale ); GetWorldTransform( joint, jointpos, jointaxis, options.scale );
// convert to id coordinates // convert to id coordinates
jointaxis = ConvertToIdSpace( jointaxis ) * align; jointaxis = ConvertToIdSpace( jointaxis ) * align;
jointpos = ConvertToIdSpace( jointpos ) * align; jointpos = ConvertToIdSpace( jointpos ) * align;
@ -2865,7 +2865,7 @@ void idMayaExport::ConvertModel( void ) {
switch( options.type ) { switch( options.type ) {
case WRITE_MESH : case WRITE_MESH :
common->Printf( "Grabbing default pose:\n" ); common->Printf( "Grabbing default pose:\n" );
GetDefaultPose( align ); GetDefaultPose( align );
common->Printf( "Writing file...\n" ); common->Printf( "Writing file...\n" );
if ( !model.WriteMesh( options.dest, options ) ) { if ( !model.WriteMesh( options.dest, options ) ) {
@ -2874,7 +2874,7 @@ void idMayaExport::ConvertModel( void ) {
break; break;
case WRITE_ANIM : case WRITE_ANIM :
common->Printf( "Creating animation frames:\n" ); common->Printf( "Creating animation frames:\n" );
CreateAnimation( align ); CreateAnimation( align );
common->Printf( "Writing file...\n" ); common->Printf( "Writing file...\n" );
if ( !model.WriteAnim( options.dest, options ) ) { if ( !model.WriteAnim( options.dest, options ) ) {
@ -2905,7 +2905,7 @@ void idMayaExport::ConvertToMD3( void ) {
#if 0 #if 0
int i, j; int i, j;
md3Header_t *pinmodel; md3Header_t *pinmodel;
md3Frame_t *frame; md3Frame_t *frame;
md3Surface_t *surf; md3Surface_t *surf;
md3Shader_t *shader; md3Shader_t *shader;
md3Triangle_t *tri; md3Triangle_t *tri;
@ -2933,59 +2933,59 @@ void idMayaExport::ConvertToMD3( void ) {
memcpy (mod->md3[lod], buffer, LittleLong(pinmodel->ofsEnd) ); memcpy (mod->md3[lod], buffer, LittleLong(pinmodel->ofsEnd) );
LL(mod->md3[lod]->ident); LL(mod->md3[lod]->ident);
LL(mod->md3[lod]->version); LL(mod->md3[lod]->version);
LL(mod->md3[lod]->numFrames); LL(mod->md3[lod]->numFrames);
LL(mod->md3[lod]->numTags); LL(mod->md3[lod]->numTags);
LL(mod->md3[lod]->numSurfaces); LL(mod->md3[lod]->numSurfaces);
LL(mod->md3[lod]->ofsFrames); LL(mod->md3[lod]->ofsFrames);
LL(mod->md3[lod]->ofsTags); LL(mod->md3[lod]->ofsTags);
LL(mod->md3[lod]->ofsSurfaces); LL(mod->md3[lod]->ofsSurfaces);
LL(mod->md3[lod]->ofsEnd); LL(mod->md3[lod]->ofsEnd);
if ( mod->md3[lod]->numFrames < 1 ) { if ( mod->md3[lod]->numFrames < 1 ) {
common->Printf( "R_LoadMD3: %s has no frames\n", mod_name ); common->Printf( "R_LoadMD3: %s has no frames\n", mod_name );
return qfalse; return qfalse;
} }
// swap all the frames // swap all the frames
frame = (md3Frame_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsFrames ); frame = (md3Frame_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsFrames );
for ( i = 0 ; i < mod->md3[lod]->numFrames ; i++, frame++) { for ( i = 0 ; i < mod->md3[lod]->numFrames ; i++, frame++) {
frame->radius = LittleFloat( frame->radius ); frame->radius = LittleFloat( frame->radius );
for ( j = 0 ; j < 3 ; j++ ) { for ( j = 0 ; j < 3 ; j++ ) {
frame->bounds[0][j] = LittleFloat( frame->bounds[0][j] ); frame->bounds[0][j] = LittleFloat( frame->bounds[0][j] );
frame->bounds[1][j] = LittleFloat( frame->bounds[1][j] ); frame->bounds[1][j] = LittleFloat( frame->bounds[1][j] );
frame->localOrigin[j] = LittleFloat( frame->localOrigin[j] ); frame->localOrigin[j] = LittleFloat( frame->localOrigin[j] );
} }
} }
// swap all the tags // swap all the tags
tag = (md3Tag_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsTags ); tag = (md3Tag_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsTags );
for ( i = 0 ; i < mod->md3[lod]->numTags * mod->md3[lod]->numFrames ; i++, tag++) { for ( i = 0 ; i < mod->md3[lod]->numTags * mod->md3[lod]->numFrames ; i++, tag++) {
for ( j = 0 ; j < 3 ; j++ ) { for ( j = 0 ; j < 3 ; j++ ) {
tag->origin[j] = LittleFloat( tag->origin[j] ); tag->origin[j] = LittleFloat( tag->origin[j] );
tag->axis[0][j] = LittleFloat( tag->axis[0][j] ); tag->axis[0][j] = LittleFloat( tag->axis[0][j] );
tag->axis[1][j] = LittleFloat( tag->axis[1][j] ); tag->axis[1][j] = LittleFloat( tag->axis[1][j] );
tag->axis[2][j] = LittleFloat( tag->axis[2][j] ); tag->axis[2][j] = LittleFloat( tag->axis[2][j] );
} }
} }
// swap all the surfaces // swap all the surfaces
surf = (md3Surface_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsSurfaces ); surf = (md3Surface_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsSurfaces );
for ( i = 0 ; i < mod->md3[lod]->numSurfaces ; i++) { for ( i = 0 ; i < mod->md3[lod]->numSurfaces ; i++) {
LL(surf->ident); LL(surf->ident);
LL(surf->flags); LL(surf->flags);
LL(surf->numFrames); LL(surf->numFrames);
LL(surf->numShaders); LL(surf->numShaders);
LL(surf->numTriangles); LL(surf->numTriangles);
LL(surf->ofsTriangles); LL(surf->ofsTriangles);
LL(surf->numVerts); LL(surf->numVerts);
LL(surf->ofsShaders); LL(surf->ofsShaders);
LL(surf->ofsSt); LL(surf->ofsSt);
LL(surf->ofsXyzNormals); LL(surf->ofsXyzNormals);
LL(surf->ofsEnd); LL(surf->ofsEnd);
if ( surf->numVerts > SHADER_MAX_VERTEXES ) { if ( surf->numVerts > SHADER_MAX_VERTEXES ) {
ri.Error (ERR_DROP, "R_LoadMD3: %s has more than %i verts on a surface (%i)", ri.Error (ERR_DROP, "R_LoadMD3: %s has more than %i verts on a surface (%i)",
mod_name, SHADER_MAX_VERTEXES, surf->numVerts ); mod_name, SHADER_MAX_VERTEXES, surf->numVerts );
@ -2994,7 +2994,7 @@ void idMayaExport::ConvertToMD3( void ) {
ri.Error (ERR_DROP, "R_LoadMD3: %s has more than %i triangles on a surface (%i)", ri.Error (ERR_DROP, "R_LoadMD3: %s has more than %i triangles on a surface (%i)",
mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles ); mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles );
} }
// change to surface identifier // change to surface identifier
surf->ident = SF_MD3; surf->ident = SF_MD3;
@ -3008,18 +3008,18 @@ void idMayaExport::ConvertToMD3( void ) {
surf->name[j-2] = 0; surf->name[j-2] = 0;
} }
// register the shaders // register the shaders
shader = (md3Shader_t *) ( (byte *)surf + surf->ofsShaders ); shader = (md3Shader_t *) ( (byte *)surf + surf->ofsShaders );
for ( j = 0 ; j < surf->numShaders ; j++, shader++ ) { for ( j = 0 ; j < surf->numShaders ; j++, shader++ ) {
shader_t *sh; shader_t *sh;
sh = R_FindShader( shader->name, LIGHTMAP_NONE, qtrue ); sh = R_FindShader( shader->name, LIGHTMAP_NONE, qtrue );
if ( sh->defaultShader ) { if ( sh->defaultShader ) {
shader->shaderIndex = 0; shader->shaderIndex = 0;
} else { } else {
shader->shaderIndex = sh->index; shader->shaderIndex = sh->index;
} }
} }
// swap all the triangles // swap all the triangles
tri = (md3Triangle_t *) ( (byte *)surf + surf->ofsTriangles ); tri = (md3Triangle_t *) ( (byte *)surf + surf->ofsTriangles );
@ -3030,22 +3030,22 @@ void idMayaExport::ConvertToMD3( void ) {
} }
// swap all the ST // swap all the ST
st = (md3St_t *) ( (byte *)surf + surf->ofsSt ); st = (md3St_t *) ( (byte *)surf + surf->ofsSt );
for ( j = 0 ; j < surf->numVerts ; j++, st++ ) { for ( j = 0 ; j < surf->numVerts ; j++, st++ ) {
st->st[0] = LittleFloat( st->st[0] ); st->st[0] = LittleFloat( st->st[0] );
st->st[1] = LittleFloat( st->st[1] ); st->st[1] = LittleFloat( st->st[1] );
} }
// swap all the XyzNormals // swap all the XyzNormals
xyz = (md3XyzNormal_t *) ( (byte *)surf + surf->ofsXyzNormals ); xyz = (md3XyzNormal_t *) ( (byte *)surf + surf->ofsXyzNormals );
for ( j = 0 ; j < surf->numVerts * surf->numFrames ; j++, xyz++ ) for ( j = 0 ; j < surf->numVerts * surf->numFrames ; j++, xyz++ )
{ {
xyz->xyz[0] = LittleShort( xyz->xyz[0] ); xyz->xyz[0] = LittleShort( xyz->xyz[0] );
xyz->xyz[1] = LittleShort( xyz->xyz[1] ); xyz->xyz[1] = LittleShort( xyz->xyz[1] );
xyz->xyz[2] = LittleShort( xyz->xyz[2] ); xyz->xyz[2] = LittleShort( xyz->xyz[2] );
xyz->normal = LittleShort( xyz->normal ); xyz->normal = LittleShort( xyz->normal );
} }
// find the next surface // find the next surface
@ -3084,16 +3084,16 @@ Maya_ConvertModel
=============== ===============
*/ */
const char *Maya_ConvertModel( const char *ospath, const char *commandline ) { const char *Maya_ConvertModel( const char *ospath, const char *commandline ) {
errorMessage = "Ok"; errorMessage = "Ok";
try { try {
idExportOptions options( commandline, ospath ); idExportOptions options( commandline, ospath );
idMayaExport exportM( options ); idMayaExport exportM( options );
exportM.ConvertModel(); exportM.ConvertModel();
} }
catch( idException &exception ) { catch( idException &exception ) {
errorMessage = exception.error; errorMessage = exception.error;
} }

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -87,14 +87,14 @@ TARGET_DEMO (default 0)
IDNET_HOST (default to source hardcoded) IDNET_HOST (default to source hardcoded)
Override builtin IDNET_HOST with your own settings Override builtin IDNET_HOST with your own settings
GL_HARDLINK (default 0) GL_HARDLINK (default 0)
Instead of dynamically loading the OpenGL libraries, use implicit dependencies Instead of dynamically loading the OpenGL libraries, use implicit dependencies
NOTE: no GL logging capability and no r_glDriver with GL_HARDLINK 1 NOTE: no GL logging capability and no r_glDriver with GL_HARDLINK 1
DEBUG_MEMORY (default 0) DEBUG_MEMORY (default 0)
Enables memory logging to file Enables memory logging to file
LIBC_MALLOC (default 1) LIBC_MALLOC (default 1)
Toggle idHeap memory / libc malloc usage Toggle idHeap memory / libc malloc usage
When libc malloc is on, memory size statistics are wrong ( no _msize ) When libc malloc is on, memory size statistics are wrong ( no _msize )
@ -102,7 +102,7 @@ LIBC_MALLOC (default 1)
ID_NOLANADDRESS (default 0) ID_NOLANADDRESS (default 0)
Don't recognize any IP as LAN address. This is useful when debugging network Don't recognize any IP as LAN address. This is useful when debugging network
code where LAN / not LAN influences application behaviour code where LAN / not LAN influences application behaviour
ID_MCHECK (default 2) ID_MCHECK (default 2)
Perform heap consistency checking Perform heap consistency checking
0: on in Debug / off in Release 0: on in Debug / off in Release
@ -112,9 +112,9 @@ ID_MCHECK (default 2)
ALSA (default 1) ALSA (default 1)
enable ALSA sound backend support enable ALSA sound backend support
SETUP (default 0, not saved) SETUP (default 0, not saved)
build a setup. implies release build build a setup. implies release build
SDK (default 0, not saved) SDK (default 0, not saved)
build an SDK release build an SDK release
@ -245,7 +245,7 @@ if ( GL_HARDLINK != '0' ):
if ( DEBUG_MEMORY != '0' ): if ( DEBUG_MEMORY != '0' ):
g_build += '-debugmem' g_build += '-debugmem'
if ( LIBC_MALLOC != '1' ): if ( LIBC_MALLOC != '1' ):
g_build += '-nolibcmalloc' g_build += '-nolibcmalloc'
@ -313,7 +313,7 @@ if ( GL_HARDLINK != '0' ):
if ( DEBUG_MEMORY != '0' ): if ( DEBUG_MEMORY != '0' ):
BASECPPFLAGS += [ '-DID_DEBUG_MEMORY', '-DID_REDIRECT_NEWDELETE' ] BASECPPFLAGS += [ '-DID_DEBUG_MEMORY', '-DID_REDIRECT_NEWDELETE' ]
if ( LIBC_MALLOC != '1' ): if ( LIBC_MALLOC != '1' ):
BASECPPFLAGS.append( '-DUSE_LIBC_MALLOC=0' ) BASECPPFLAGS.append( '-DUSE_LIBC_MALLOC=0' )
@ -322,10 +322,10 @@ if ( len( IDNET_HOST ) ):
if ( ID_NOLANADDRESS != '0' ): if ( ID_NOLANADDRESS != '0' ):
CORECPPFLAGS.append( '-DID_NOLANADDRESS' ) CORECPPFLAGS.append( '-DID_NOLANADDRESS' )
if ( ID_MCHECK == '1' ): if ( ID_MCHECK == '1' ):
BASECPPFLAGS.append( '-DID_MCHECK' ) BASECPPFLAGS.append( '-DID_MCHECK' )
# create the build environements # create the build environements
g_base_env = Environment( ENV = os.environ, CC = CC, CXX = CXX, LINK = LINK, CPPFLAGS = BASECPPFLAGS, LINKFLAGS = BASELINKFLAGS, CPPPATH = CORECPPPATH, LIBPATH = CORELIBPATH ) g_base_env = Environment( ENV = os.environ, CC = CC, CXX = CXX, LINK = LINK, CPPFLAGS = BASECPPFLAGS, LINKFLAGS = BASELINKFLAGS, CPPPATH = CORECPPPATH, LIBPATH = CORELIBPATH )
scons_utils.SetupUtils( g_base_env ) scons_utils.SetupUtils( g_base_env )
@ -391,7 +391,7 @@ if ( TARGET_CORE == '1' ):
if ( DEDICATED == '0' or DEDICATED == '2' ): if ( DEDICATED == '0' or DEDICATED == '2' ):
local_dedicated = 0 local_dedicated = 0
Export( 'GLOBALS ' + GLOBALS ) Export( 'GLOBALS ' + GLOBALS )
VariantDir( g_build + '/core/glimp', '.', duplicate = 1 ) VariantDir( g_build + '/core/glimp', '.', duplicate = 1 )
SConscript( g_build + '/core/glimp/sys/scons/SConscript.gl' ) SConscript( g_build + '/core/glimp/sys/scons/SConscript.gl' )
VariantDir( g_build + '/core', '.', duplicate = 0 ) VariantDir( g_build + '/core', '.', duplicate = 0 )
@ -400,11 +400,11 @@ if ( TARGET_CORE == '1' ):
doom = SConscript( g_build + '/core/sys/scons/SConscript.core' ) doom = SConscript( g_build + '/core/sys/scons/SConscript.core' )
InstallAs( '#doom.' + cpu, doom ) InstallAs( '#doom.' + cpu, doom )
if ( DEDICATED == '1' or DEDICATED == '2' ): if ( DEDICATED == '1' or DEDICATED == '2' ):
local_dedicated = 1 local_dedicated = 1
Export( 'GLOBALS ' + GLOBALS ) Export( 'GLOBALS ' + GLOBALS )
VariantDir( g_build + '/dedicated/glimp', '.', duplicate = 1 ) VariantDir( g_build + '/dedicated/glimp', '.', duplicate = 1 )
SConscript( g_build + '/dedicated/glimp/sys/scons/SConscript.gl' ) SConscript( g_build + '/dedicated/glimp/sys/scons/SConscript.gl' )
VariantDir( g_build + '/dedicated', '.', duplicate = 0 ) VariantDir( g_build + '/dedicated', '.', duplicate = 0 )
@ -444,7 +444,7 @@ if ( TARGET_GAME == '1' or TARGET_D3XP == '1' ):
game_d3xp = InstallAs( '#game%s-d3xp.so' % cpu, d3xp ) game_d3xp = InstallAs( '#game%s-d3xp.so' % cpu, d3xp )
if ( BUILD_GAMEPAK == '1' ): if ( BUILD_GAMEPAK == '1' ):
Command( '#game01-d3xp.pk4', [ game_d3xp, d3xp ], Action( g_env.BuildGamePak ) ) Command( '#game01-d3xp.pk4', [ game_d3xp, d3xp ], Action( g_env.BuildGamePak ) )
if ( TARGET_MONO == '1' ): if ( TARGET_MONO == '1' ):
# NOTE: no D3XP atm. add a TARGET_MONO_D3XP # NOTE: no D3XP atm. add a TARGET_MONO_D3XP
local_gamedll = 0 local_gamedll = 0
@ -479,7 +479,7 @@ if ( TARGET_DEMO == '1' ):
doom_demo = SConscript( g_build + '/demo/sys/scons/SConscript.core' ) doom_demo = SConscript( g_build + '/demo/sys/scons/SConscript.core' )
InstallAs( '#doom-demo.' + cpu, doom_demo ) InstallAs( '#doom-demo.' + cpu, doom_demo )
local_idlibpic = 1 local_idlibpic = 1
Export( 'GLOBALS ' + GLOBALS ) Export( 'GLOBALS ' + GLOBALS )
VariantDir( g_build + '/demo/game', '.', duplicate = 0 ) VariantDir( g_build + '/demo/game', '.', duplicate = 0 )

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -630,7 +630,7 @@ void idTypeInfoGen::ParseScope( const char *scope, bool isTemplate, idParser &sr
isStatic = true; isStatic = true;
} else if ( token.type == TT_NAME ) { } else if ( token.type == TT_NAME ) {
assert( indent == 1 ); assert( indent == 1 );
// if this is a class operator // if this is a class operator
@ -720,7 +720,7 @@ void idTypeInfoGen::ParseScope( const char *scope, bool isTemplate, idParser &sr
var.bits = 0; var.bits = 0;
typeInfo->variables.Append( var ); typeInfo->variables.Append( var );
if ( !src.CheckTokenString( "," ) ) { if ( !src.CheckTokenString( "," ) ) {
varType = ""; varType = "";
isConst = false; isConst = false;
isStatic = false; isStatic = false;
break; break;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -1360,7 +1360,7 @@ cm_polygon_t *idCollisionModelManagerLocal::TryMergePolygons( cm_model_t *model,
// check if the new polygon would still be convex // check if the new polygon would still be convex
edgeNum = p1->edges[p1BeforeShare]; edgeNum = p1->edges[p1BeforeShare];
edge = model->edges + abs(edgeNum); edge = model->edges + abs(edgeNum);
delta = model->vertices[edge->vertexNum[INTSIGNBITNOTSET(edgeNum)]].p - delta = model->vertices[edge->vertexNum[INTSIGNBITNOTSET(edgeNum)]].p -
model->vertices[edge->vertexNum[INTSIGNBITSET(edgeNum)]].p; model->vertices[edge->vertexNum[INTSIGNBITSET(edgeNum)]].p;
normal = p1->plane.Normal().Cross( delta ); normal = p1->plane.Normal().Cross( delta );
normal.Normalize(); normal.Normalize();
@ -2276,7 +2276,7 @@ idCollisionModelManagerLocal::GetVertex
int idCollisionModelManagerLocal::GetVertex( cm_model_t *model, const idVec3 &v, int *vertexNum ) { int idCollisionModelManagerLocal::GetVertex( cm_model_t *model, const idVec3 &v, int *vertexNum ) {
int i, hashKey, vn; int i, hashKey, vn;
idVec3 vert, *p; idVec3 vert, *p;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
if ( idMath::Fabs(v[i] - idMath::Rint(v[i])) < INTEGRAL_EPSILON ) if ( idMath::Fabs(v[i] - idMath::Rint(v[i])) < INTEGRAL_EPSILON )
vert[i] = idMath::Rint(v[i]); vert[i] = idMath::Rint(v[i]);

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -198,7 +198,7 @@ void idCollisionModelManagerLocal::TraceThroughAxialBSPTree_r( cm_traceWork_t *t
else if ( frac2 > 1.0f ) { else if ( frac2 > 1.0f ) {
frac2 = 1.0f; frac2 = 1.0f;
} }
midf = p1f + (p2f - p1f)*frac2; midf = p1f + (p2f - p1f)*frac2;
mid[0] = p1[0] + frac2*(p2[0] - p1[0]); mid[0] = p1[0] + frac2*(p2[0] - p1[0]);

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -621,7 +621,7 @@ idAF::LoadConstraint
bool idAF::LoadConstraint( const idDeclAF_Constraint *fc ) { bool idAF::LoadConstraint( const idDeclAF_Constraint *fc ) {
idAFBody *body1, *body2; idAFBody *body1, *body2;
idAngles angles; idAngles angles;
idMat3 axis; idMat3 axis;
body1 = physicsObj.GetBody( fc->body1 ); body1 = physicsObj.GetBody( fc->body1 );
body2 = physicsObj.GetBody( fc->body2 ); body2 = physicsObj.GetBody( fc->body2 );
@ -1143,7 +1143,7 @@ void idAF::LoadState( const idDict &args ) {
body->SetWorldOrigin( origin ); body->SetWorldOrigin( origin );
body->SetWorldAxis( angles.ToMat3() ); body->SetWorldAxis( angles.ToMat3() );
} else { } else {
gameLocal.Warning("Unknown body part %s in articulated figure %s", name.c_str(), this->name.c_str()); gameLocal.Warning("Unknown body part %s in articulated figure %s", name.c_str(), this->name.c_str());
} }
kv = args.MatchPrefix( "body ", kv ); kv = args.MatchPrefix( "body ", kv );
@ -1261,7 +1261,7 @@ void idAF::RemoveBindConstraints( void ) {
name.Strip( "bindConstraint " ); name.Strip( "bindConstraint " );
if ( physicsObj.GetConstraint( name ) ) { if ( physicsObj.GetConstraint( name ) ) {
physicsObj.DeleteConstraint( name ); physicsObj.DeleteConstraint( name );
} }
kv = args.MatchPrefix( "bindConstraint ", kv ); kv = args.MatchPrefix( "bindConstraint ", kv );

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -371,9 +371,9 @@ idAFAttachment::Damage
Pass damage to body at the bindjoint Pass damage to body at the bindjoint
============ ============
*/ */
void idAFAttachment::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, void idAFAttachment::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir,
const char *damageDefName, const float damageScale, const int location ) { const char *damageDefName, const float damageScale, const int location ) {
if ( body ) { if ( body ) {
body->Damage( inflictor, attacker, dir, damageDefName, damageScale, attachJoint ); body->Damage( inflictor, attacker, dir, damageDefName, damageScale, attachJoint );
} }
@ -1705,7 +1705,7 @@ void idAFEntity_Vehicle::Spawn( void ) {
steeringWheelJoint = animator.GetJointHandle( steeringWheelJointName ); steeringWheelJoint = animator.GetJointHandle( steeringWheelJointName );
spawnArgs.GetFloat( "wheelRadius", "20", wheelRadius ); spawnArgs.GetFloat( "wheelRadius", "20", wheelRadius );
spawnArgs.GetFloat( "steerSpeed", "5", steerSpeed ); spawnArgs.GetFloat( "steerSpeed", "5", steerSpeed );
player = NULL; player = NULL;
steerAngle = 0.0f; steerAngle = 0.0f;
@ -3116,7 +3116,7 @@ idRenderModel *idGameEdit::AF_CreateMesh( const idDict &args, idVec3 &meshOrigin
modifiedAxis[ jointNum ] = ( bodyAxis[i] * originalJoints[jointNum].ToMat3().Transpose() ).Transpose() * ( newBodyAxis[i] * meshAxis.Transpose() ); modifiedAxis[ jointNum ] = ( bodyAxis[i] * originalJoints[jointNum].ToMat3().Transpose() ).Transpose() * ( newBodyAxis[i] * meshAxis.Transpose() );
// FIXME: calculate correct modifiedOrigin // FIXME: calculate correct modifiedOrigin
modifiedOrigin[ jointNum ] = originalJoints[ jointNum ].ToVec3(); modifiedOrigin[ jointNum ] = originalJoints[ jointNum ].ToVec3();
} }
} }
// apply joint modifications to the skeleton // apply joint modifications to the skeleton
@ -3184,7 +3184,7 @@ idHarvestable::~idHarvestable() {
} }
void idHarvestable::Spawn() { void idHarvestable::Spawn() {
startTime = 0; startTime = 0;
spawnArgs.GetFloat( "triggersize", "120", triggersize ); spawnArgs.GetFloat( "triggersize", "120", triggersize );
@ -3197,13 +3197,13 @@ void idHarvestable::Spawn() {
fxFollowPlayer = spawnArgs.GetBool("fx_follow_player", "1"); fxFollowPlayer = spawnArgs.GetBool("fx_follow_player", "1");
fxOrient = spawnArgs.GetString("fx_orient"); fxOrient = spawnArgs.GetString("fx_orient");
} }
void idHarvestable::Init(idEntity* parent) { void idHarvestable::Init(idEntity* parent) {
assert(parent); assert(parent);
parentEnt = parent; parentEnt = parent;
GetPhysics()->SetOrigin( parent->GetPhysics()->GetOrigin() ); GetPhysics()->SetOrigin( parent->GetPhysics()->GetOrigin() );
@ -3214,7 +3214,7 @@ void idHarvestable::Init(idEntity* parent) {
if(skin.Length()) { if(skin.Length()) {
parent->SetSkin(declManager->FindSkin(skin.c_str())); parent->SetSkin(declManager->FindSkin(skin.c_str()));
} }
idEntity* head; idEntity* head;
if(parent->IsType(idActor::Type)) { if(parent->IsType(idActor::Type)) {
idActor* withHead = (idActor*)parent; idActor* withHead = (idActor*)parent;
@ -3270,7 +3270,7 @@ void idHarvestable::Restore( idRestoreGame *savefile ) {
savefile->ReadBool( fxFollowPlayer ); savefile->ReadBool( fxFollowPlayer );
fx.Restore( savefile ); fx.Restore( savefile );
savefile->ReadString( fxOrient ); savefile->ReadString( fxOrient );
parentEnt.Restore(savefile); parentEnt.Restore(savefile);
} }
@ -3302,7 +3302,7 @@ void idHarvestable::Think() {
parent->PostEventMS( &EV_Remove, 0 ); parent->PostEventMS( &EV_Remove, 0 );
PostEventMS( &EV_Remove, 0 ); PostEventMS( &EV_Remove, 0 );
} }
if(fxFollowPlayer) { if(fxFollowPlayer) {
idEntityFx* fxEnt = fx.GetEntity(); idEntityFx* fxEnt = fx.GetEntity();
@ -3339,12 +3339,12 @@ idAFEntity_Harvest::BeginBurn
================ ================
*/ */
void idHarvestable::BeginBurn() { void idHarvestable::BeginBurn() {
idEntity* parent = parentEnt.GetEntity(); idEntity* parent = parentEnt.GetEntity();
if(!parent) { if(!parent) {
return; return;
} }
if(!spawnArgs.GetBool("burn")) { if(!spawnArgs.GetBool("burn")) {
return; return;
} }
@ -3377,8 +3377,8 @@ void idHarvestable::BeginBurn() {
head->SetShaderParm( SHADERPARM_TIME_OF_DEATH, gameLocal.slow.time * 0.001f ); head->SetShaderParm( SHADERPARM_TIME_OF_DEATH, gameLocal.slow.time * 0.001f );
} }
} }
/* /*
@ -3406,7 +3406,7 @@ idAFEntity_Harvest::CalcTriggerBounds
================ ================
*/ */
void idHarvestable::CalcTriggerBounds( float size, idBounds &bounds ) { void idHarvestable::CalcTriggerBounds( float size, idBounds &bounds ) {
idEntity* parent = parentEnt.GetEntity(); idEntity* parent = parentEnt.GetEntity();
if(!parent) { if(!parent) {
return; return;
@ -3420,12 +3420,12 @@ void idHarvestable::CalcTriggerBounds( float size, idBounds &bounds ) {
} }
bool idHarvestable::GetFxOrientationAxis(idMat3& mat) { bool idHarvestable::GetFxOrientationAxis(idMat3& mat) {
idEntity* parent = parentEnt.GetEntity(); idEntity* parent = parentEnt.GetEntity();
if(!parent) { if(!parent) {
return false; return false;
} }
idPlayer *thePlayer = player.GetEntity(); idPlayer *thePlayer = player.GetEntity();
if(!fxOrient.Icmp("up")) { if(!fxOrient.Icmp("up")) {
@ -3466,7 +3466,7 @@ bool idHarvestable::GetFxOrientationAxis(idMat3& mat) {
//Orient the fx towards the eye of the player //Orient the fx towards the eye of the player
idVec3 eye = thePlayer->GetEyePosition(); idVec3 eye = thePlayer->GetEyePosition();
idVec3 toPlayer = eye-parent->GetPhysics()->GetOrigin(); idVec3 toPlayer = eye-parent->GetPhysics()->GetOrigin();
toPlayer.Normalize(); toPlayer.Normalize();
idVec3 left, up; idVec3 left, up;
@ -3613,11 +3613,11 @@ idAFEntity_Harvest::~idAFEntity_Harvest
================ ================
*/ */
idAFEntity_Harvest::~idAFEntity_Harvest() { idAFEntity_Harvest::~idAFEntity_Harvest() {
if ( harvestEnt.GetEntity() ) { if ( harvestEnt.GetEntity() ) {
harvestEnt.GetEntity()->PostEventMS( &EV_Remove, 0 ); harvestEnt.GetEntity()->PostEventMS( &EV_Remove, 0 );
} }
} }
/* /*

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -526,7 +526,7 @@ private:
#ifdef _D3XP #ifdef _D3XP
/** /**
* idHarvestable contains all of the code required to turn an entity into a harvestable * idHarvestable contains all of the code required to turn an entity into a harvestable
* entity. The entity must create an instance of this class and call the appropriate * entity. The entity must create an instance of this class and call the appropriate
* interface methods at the correct time. * interface methods at the correct time.

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -230,7 +230,7 @@ idAnimState::AnimDone
*/ */
bool idAnimState::AnimDone( int blendFrames ) const { bool idAnimState::AnimDone( int blendFrames ) const {
int animDoneTime; int animDoneTime;
animDoneTime = animator->CurrentAnim( channel )->GetEndTime(); animDoneTime = animator->CurrentAnim( channel )->GetEndTime();
if ( animDoneTime < 0 ) { if ( animDoneTime < 0 ) {
// playing a cycle // playing a cycle
@ -457,7 +457,7 @@ idActor::idActor( void ) {
allowEyeFocus = false; allowEyeFocus = false;
waitState = ""; waitState = "";
blink_anim = NULL; blink_anim = NULL;
blink_time = 0; blink_time = 0;
blink_min = 0; blink_min = 0;
@ -527,7 +527,7 @@ void idActor::Spawn( void ) {
spawnArgs.GetInt( "team", "0", team ); spawnArgs.GetInt( "team", "0", team );
spawnArgs.GetVector( "offsetModel", "0 0 0", modelOffset ); spawnArgs.GetVector( "offsetModel", "0 0 0", modelOffset );
spawnArgs.GetBool( "use_combat_bbox", "0", use_combat_bbox ); spawnArgs.GetBool( "use_combat_bbox", "0", use_combat_bbox );
viewAxis = GetPhysics()->GetAxis(); viewAxis = GetPhysics()->GetAxis();
@ -560,7 +560,7 @@ void idActor::Spawn( void ) {
// don't let them drop to the floor // don't let them drop to the floor
args.Set( "dropToFloor", "0" ); args.Set( "dropToFloor", "0" );
gameLocal.SpawnEntityDef( args, &ent ); gameLocal.SpawnEntityDef( args, &ent );
if ( !ent ) { if ( !ent ) {
gameLocal.Error( "Couldn't spawn '%s' to attach to entity '%s'", kv->GetValue().c_str(), name.c_str() ); gameLocal.Error( "Couldn't spawn '%s' to attach to entity '%s'", kv->GetValue().c_str(), name.c_str() );
@ -627,7 +627,7 @@ void idActor::Spawn( void ) {
int headAnim = headAnimator->GetAnim( "def_head" ); int headAnim = headAnimator->GetAnim( "def_head" );
if ( headAnim ) { if ( headAnim ) {
if ( headEnt ) { if ( headEnt ) {
headAnimator->CycleAnim( ANIMCHANNEL_ALL, headAnim, gameLocal.time, 0 ); headAnimator->CycleAnim( ANIMCHANNEL_ALL, headAnim, gameLocal.time, 0 );
} else { } else {
headAnimator->CycleAnim( ANIMCHANNEL_HEAD, headAnim, gameLocal.time, 0 ); headAnimator->CycleAnim( ANIMCHANNEL_HEAD, headAnim, gameLocal.time, 0 );
} }
@ -1065,7 +1065,7 @@ void idActor::Show( void ) {
static_cast<idLight *>( ent )->On(); static_cast<idLight *>( ent )->On();
} }
#endif #endif
} }
} }
@ -1304,7 +1304,7 @@ idThread *idActor::ConstructScriptObject( void ) {
} else { } else {
scriptThread->EndThread(); scriptThread->EndThread();
} }
// call script object's constructor // call script object's constructor
constructor = scriptObject.GetConstructor(); constructor = scriptObject.GetConstructor();
if ( !constructor ) { if ( !constructor ) {
@ -1392,7 +1392,7 @@ void idActor::UpdateScript( void ) {
if ( scriptThread->IsWaiting() ) { if ( scriptThread->IsWaiting() ) {
break; break;
} }
scriptThread->Execute(); scriptThread->Execute();
if ( idealState == state ) { if ( idealState == state ) {
break; break;
@ -1477,7 +1477,7 @@ bool idActor::CheckFOV( const idVec3 &pos ) const {
float dot; float dot;
idVec3 delta; idVec3 delta;
delta = pos - GetEyePosition(); delta = pos - GetEyePosition();
// get our gravity normal // get our gravity normal
@ -1911,7 +1911,7 @@ void idActor::GetAASLocation( idAAS *aas, idVec3 &pos, int &areaNum ) const {
areaNum = 0; areaNum = 0;
return; return;
} }
size = aas->GetSettings()->boundingBoxes[0][1]; size = aas->GetSettings()->boundingBoxes[0][1];
bounds[0] = -size; bounds[0] = -size;
size.z = 32.0f; size.z = 32.0f;
@ -1948,7 +1948,7 @@ void idActor::SetAnimState( int channel, const char *statename, int blendFrames
headAnim.SetState( statename, blendFrames ); headAnim.SetState( statename, blendFrames );
allowEyeFocus = true; allowEyeFocus = true;
break; break;
case ANIMCHANNEL_TORSO : case ANIMCHANNEL_TORSO :
torsoAnim.SetState( statename, blendFrames ); torsoAnim.SetState( statename, blendFrames );
legsAnim.Enable( blendFrames ); legsAnim.Enable( blendFrames );
@ -2200,7 +2200,7 @@ Bleeding wounds and surface overlays are applied in the collision code that
calls Damage() calls Damage()
============ ============
*/ */
void idActor::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, void idActor::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir,
const char *damageDefName, const float damageScale, const int location ) { const char *damageDefName, const float damageScale, const int location ) {
if ( !fl.takedamage ) { if ( !fl.takedamage ) {
return; return;
@ -2222,7 +2222,7 @@ void idActor::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir
} }
// Maledict is immume to the falling asteroids // Maledict is immume to the falling asteroids
if ( !idStr::Icmp( GetEntityDefName(), "monster_boss_d3xp_maledict" ) && if ( !idStr::Icmp( GetEntityDefName(), "monster_boss_d3xp_maledict" ) &&
(!idStr::Icmp( damageDefName, "damage_maledict_asteroid" ) || !idStr::Icmp( damageDefName, "damage_maledict_asteroid_splash" ) ) ) { (!idStr::Icmp( damageDefName, "damage_maledict_asteroid" ) || !idStr::Icmp( damageDefName, "damage_maledict_asteroid_splash" ) ) ) {
return; return;
} }
@ -2360,7 +2360,7 @@ bool idActor::Pain( idEntity *inflictor, idEntity *attacker, int damage, const i
} }
if ( g_debugDamage.GetBool() ) { if ( g_debugDamage.GetBool() ) {
gameLocal.Printf( "Damage: joint: '%s', zone '%s', anim '%s'\n", animator.GetJointName( ( jointHandle_t )location ), gameLocal.Printf( "Damage: joint: '%s', zone '%s', anim '%s'\n", animator.GetJointName( ( jointHandle_t )location ),
damageGroup.c_str(), painAnim.c_str() ); damageGroup.c_str(), painAnim.c_str() );
} }
@ -2504,7 +2504,7 @@ idActor::Event_DisableEyeFocus
*/ */
void idActor::Event_DisableEyeFocus( void ) { void idActor::Event_DisableEyeFocus( void ) {
allowEyeFocus = false; allowEyeFocus = false;
idEntity *headEnt = head.GetEntity(); idEntity *headEnt = head.GetEntity();
if ( headEnt ) { if ( headEnt ) {
headEnt->GetAnimator()->Clear( ANIMCHANNEL_EYELIDS, gameLocal.time, FRAME2MS( 2 ) ); headEnt->GetAnimator()->Clear( ANIMCHANNEL_EYELIDS, gameLocal.time, FRAME2MS( 2 ) );
@ -2641,7 +2641,7 @@ void idActor::Event_PlayAnim( int channel, const char *animname ) {
animFlags_t flags; animFlags_t flags;
idEntity *headEnt; idEntity *headEnt;
int anim; int anim;
anim = GetAnim( channel, animname ); anim = GetAnim( channel, animname );
if ( !anim ) { if ( !anim ) {
if ( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() ) { if ( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() ) {
@ -2720,7 +2720,7 @@ idActor::Event_PlayCycle
void idActor::Event_PlayCycle( int channel, const char *animname ) { void idActor::Event_PlayCycle( int channel, const char *animname ) {
animFlags_t flags; animFlags_t flags;
int anim; int anim;
anim = GetAnim( channel, animname ); anim = GetAnim( channel, animname );
if ( !anim ) { if ( !anim ) {
if ( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() ) { if ( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() ) {
@ -2793,8 +2793,8 @@ idActor::Event_IdleAnim
*/ */
void idActor::Event_IdleAnim( int channel, const char *animname ) { void idActor::Event_IdleAnim( int channel, const char *animname ) {
int anim; int anim;
anim = GetAnim( channel, animname ); anim = GetAnim( channel, animname );
if ( !anim ) { if ( !anim ) {
if ( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() ) { if ( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() ) {
gameLocal.DPrintf( "missing '%s' animation on '%s' (%s)\n", animname, name.c_str(), spawnArgs.GetString( "def_head", "" ) ); gameLocal.DPrintf( "missing '%s' animation on '%s' (%s)\n", animname, name.c_str(), spawnArgs.GetString( "def_head", "" ) );
@ -3198,9 +3198,9 @@ void idActor::Event_AnimLength( int channel, const char *animname ) {
} else { } else {
idThread::ReturnFloat( MS2SEC( animator.AnimLength( anim ) ) ); idThread::ReturnFloat( MS2SEC( animator.AnimLength( anim ) ) );
return; return;
} }
} }
idThread::ReturnFloat( 0.0f ); idThread::ReturnFloat( 0.0f );
} }
@ -3224,7 +3224,7 @@ void idActor::Event_AnimDistance( int channel, const char *animname ) {
return; return;
} }
} }
idThread::ReturnFloat( 0.0f ); idThread::ReturnFloat( 0.0f );
} }
@ -3268,7 +3268,7 @@ void idActor::Event_NextEnemy( idEntity *ent ) {
} }
} }
idThread::ReturnEntity( NULL ); idThread::ReturnEntity( NULL );
} }
/* /*

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -196,8 +196,8 @@ public:
virtual void Teleport( const idVec3 &origin, const idAngles &angles, idEntity *destination ); virtual void Teleport( const idVec3 &origin, const idAngles &angles, idEntity *destination );
virtual renderView_t * GetRenderView(); virtual renderView_t * GetRenderView();
// animation state control // animation state control
int GetAnim( int channel, const char *name ); int GetAnim( int channel, const char *name );
void UpdateAnimState( void ); void UpdateAnimState( void );
@ -333,7 +333,7 @@ private:
void Event_SetDamageCap( float _damageCap ); void Event_SetDamageCap( float _damageCap );
void Event_SetWaitState( const char* waitState); void Event_SetWaitState( const char* waitState);
void Event_GetWaitState(); void Event_GetWaitState();
#endif #endif
}; };

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -105,7 +105,7 @@ void idBrittleFracture::Save( idSaveGame *savefile ) const {
entityFlags_s flags = fl; entityFlags_s flags = fl;
LittleBitField( &flags, sizeof( flags ) ); LittleBitField( &flags, sizeof( flags ) );
savefile->Write( &flags, sizeof( flags ) ); savefile->Write( &flags, sizeof( flags ) );
// setttings // setttings
savefile->WriteMaterial( material ); savefile->WriteMaterial( material );
savefile->WriteMaterial( decalMaterial ); savefile->WriteMaterial( decalMaterial );
@ -416,7 +416,7 @@ bool idBrittleFracture::UpdateRenderEntity( renderEntity_s *renderEntity, const
} }
packedColor = PackColor( idVec4( renderEntity->shaderParms[ SHADERPARM_RED ] * fade, packedColor = PackColor( idVec4( renderEntity->shaderParms[ SHADERPARM_RED ] * fade,
renderEntity->shaderParms[ SHADERPARM_GREEN ] * fade, renderEntity->shaderParms[ SHADERPARM_GREEN ] * fade,
renderEntity->shaderParms[ SHADERPARM_BLUE ] * fade, renderEntity->shaderParms[ SHADERPARM_BLUE ] * fade,
fade ) ); fade ) );
const idWinding &winding = shards[i]->winding; const idWinding &winding = shards[i]->winding;
@ -946,7 +946,7 @@ void idBrittleFracture::DropFloatingIslands( const idVec3 &point, const idVec3 &
continue; continue;
} }
queueStart = 0; queueStart = 0;
queueEnd = 1; queueEnd = 1;
queue[0] = shards[i]; queue[0] = shards[i];
shards[i]->islandNum = numIslands+1; shards[i]->islandNum = numIslands+1;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -193,7 +193,7 @@ idCameraView::GetViewParms
*/ */
void idCameraView::GetViewParms( renderView_t *view ) { void idCameraView::GetViewParms( renderView_t *view ) {
assert( view ); assert( view );
if (view == NULL) { if (view == NULL) {
return; return;
} }
@ -215,7 +215,7 @@ void idCameraView::GetViewParms( renderView_t *view ) {
} else { } else {
view->viewaxis = ent->GetPhysics()->GetAxis(); view->viewaxis = ent->GetPhysics()->GetAxis();
} }
gameLocal.CalcFov( fov, view->fov_x, view->fov_y ); gameLocal.CalcFov( fov, view->fov_x, view->fov_y );
} }
@ -519,7 +519,7 @@ void idCameraAnim::Think( void ) {
frameTime = ( gameLocal.time - starttime ) * frameRate; frameTime = ( gameLocal.time - starttime ) * frameRate;
frame = frameTime / 1000; frame = frameTime / 1000;
} }
if ( frame > camera.Num() + cameraCuts.Num() - 2 ) { if ( frame > camera.Num() + cameraCuts.Num() - 2 ) {
if ( cycle > 0 ) { if ( cycle > 0 ) {
cycle--; cycle--;
@ -656,7 +656,7 @@ void idCameraAnim::GetViewParms( renderView_t *view ) {
// setup the pvs for this frame // setup the pvs for this frame
UpdatePVSAreas( view->vieworg ); UpdatePVSAreas( view->vieworg );
#if 0 #if 0
static int lastFrame = 0; static int lastFrame = 0;
static idVec3 lastFrameVec( 0.0f, 0.0f, 0.0f ); static idVec3 lastFrameVec( 0.0f, 0.0f, 0.0f );

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -75,7 +75,7 @@ idTarget_EndLevel::~idTarget_EndLevel()
================ ================
*/ */
idTarget_EndLevel::~idTarget_EndLevel() { idTarget_EndLevel::~idTarget_EndLevel() {
//FIXME: need to go to smart ptrs for gui allocs or the unique method //FIXME: need to go to smart ptrs for gui allocs or the unique method
//delete gui; //delete gui;
} }
@ -88,7 +88,7 @@ void idTarget_EndLevel::Event_Trigger( idEntity *activator ) {
if ( gameLocal.endLevel ) { if ( gameLocal.endLevel ) {
return; return;
} }
// mark the endLevel, which will modify some game actions // mark the endLevel, which will modify some game actions
// and pass control to us for drawing the stats and camera position // and pass control to us for drawing the stats and camera position
gameLocal.endLevel = this; gameLocal.endLevel = this;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -63,4 +63,3 @@ private:
void Event_Trigger( idEntity *activator ); void Event_Trigger( idEntity *activator );
}; };

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -160,8 +160,8 @@ ABSTRACT_DECLARATION( idClass, idEntity )
EVENT( EV_GetMins, idEntity::Event_GetMins) EVENT( EV_GetMins, idEntity::Event_GetMins)
EVENT( EV_GetMaxs, idEntity::Event_GetMaxs ) EVENT( EV_GetMaxs, idEntity::Event_GetMaxs )
EVENT( EV_Touches, idEntity::Event_Touches ) EVENT( EV_Touches, idEntity::Event_Touches )
EVENT( EV_SetGuiParm, idEntity::Event_SetGuiParm ) EVENT( EV_SetGuiParm, idEntity::Event_SetGuiParm )
EVENT( EV_SetGuiFloat, idEntity::Event_SetGuiFloat ) EVENT( EV_SetGuiFloat, idEntity::Event_SetGuiFloat )
EVENT( EV_GetNextKey, idEntity::Event_GetNextKey ) EVENT( EV_GetNextKey, idEntity::Event_GetNextKey )
EVENT( EV_SetKey, idEntity::Event_SetKey ) EVENT( EV_SetKey, idEntity::Event_SetKey )
EVENT( EV_GetKey, idEntity::Event_GetKey ) EVENT( EV_GetKey, idEntity::Event_GetKey )
@ -490,7 +490,7 @@ void idEntity::Spawn( void ) {
gameEdit->ParseSpawnArgsToRenderEntity( &spawnArgs, &renderEntity ); gameEdit->ParseSpawnArgsToRenderEntity( &spawnArgs, &renderEntity );
renderEntity.entityNum = entityNumber; renderEntity.entityNum = entityNumber;
#ifdef _D3XP #ifdef _D3XP
noGrab = spawnArgs.GetBool( "noGrab", "0" ); noGrab = spawnArgs.GetBool( "noGrab", "0" );
@ -778,7 +778,7 @@ void idEntity::Restore( idRestoreGame *savefile ) {
savefile->Read( &fl, sizeof( fl ) ); savefile->Read( &fl, sizeof( fl ) );
LittleBitField( &fl, sizeof( fl ) ); LittleBitField( &fl, sizeof( fl ) );
#ifdef _D3XP #ifdef _D3XP
savefile->ReadInt( timeGroup ); savefile->ReadInt( timeGroup );
savefile->ReadBool( noGrab ); savefile->ReadBool( noGrab );
@ -880,7 +880,7 @@ const char * idEntity::GetName( void ) const {
/*********************************************************************** /***********************************************************************
Thinking Thinking
***********************************************************************/ ***********************************************************************/
/* /*
@ -945,7 +945,7 @@ off from the player can skip all of their work
*/ */
bool idEntity::CheckDormant( void ) { bool idEntity::CheckDormant( void ) {
bool dormant; bool dormant;
dormant = DoDormantTests(); dormant = DoDormantTests();
if ( dormant && !fl.isDormant ) { if ( dormant && !fl.isDormant ) {
fl.isDormant = true; fl.isDormant = true;
@ -1056,7 +1056,7 @@ void idEntity::BecomeInactive( int flags ) {
/*********************************************************************** /***********************************************************************
Visuals Visuals
***********************************************************************/ ***********************************************************************/
/* /*
@ -1600,7 +1600,7 @@ renderView_t *idEntity::GetRenderView( void ) {
/*********************************************************************** /***********************************************************************
Sound Sound
***********************************************************************/ ***********************************************************************/
/* /*
@ -1794,7 +1794,7 @@ void idEntity::FreeSoundEmitter( bool immediate ) {
/*********************************************************************** /***********************************************************************
entity binding entity binding
***********************************************************************/ ***********************************************************************/
/* /*
@ -2429,13 +2429,13 @@ void idEntity::JoinTeam( idEntity *teammember ) {
ent->teamChain->teamMaster = master; ent->teamChain->teamMaster = master;
} }
prev->teamChain = this; prev->teamChain = this;
ent->teamChain = next; ent->teamChain = next;
} }
teamMaster = master; teamMaster = master;
// reorder the active entity list // reorder the active entity list
gameLocal.sortTeamMasters = true; gameLocal.sortTeamMasters = true;
} }
@ -2490,7 +2490,7 @@ void idEntity::QuitTeam( void ) {
/*********************************************************************** /***********************************************************************
Physics. Physics.
***********************************************************************/ ***********************************************************************/
/* /*
@ -2947,7 +2947,7 @@ void idEntity::RemoveContactEntity( idEntity *ent ) {
/*********************************************************************** /***********************************************************************
Damage Damage
***********************************************************************/ ***********************************************************************/
/* /*
@ -2959,9 +2959,9 @@ explosions and melee attacks.
============ ============
*/ */
bool idEntity::CanDamage( const idVec3 &origin, idVec3 &damagePoint ) const { bool idEntity::CanDamage( const idVec3 &origin, idVec3 &damagePoint ) const {
idVec3 dest; idVec3 dest;
trace_t tr; trace_t tr;
idVec3 midpoint; idVec3 midpoint;
// use the midpoint of the bounds instead of the origin, because // use the midpoint of the bounds instead of the origin, because
// bmodels may have their origin at 0,0,0 // bmodels may have their origin at 0,0,0
@ -3058,7 +3058,7 @@ inflictor, attacker, dir, and point can be NULL for environmental effects
============ ============
*/ */
void idEntity::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, void idEntity::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir,
const char *damageDefName, const float damageScale, const int location ) { const char *damageDefName, const float damageScale, const int location ) {
if ( !fl.takedamage ) { if ( !fl.takedamage ) {
return; return;
@ -3167,7 +3167,7 @@ void idEntity::Killed( idEntity *inflictor, idEntity *attacker, int damage, cons
/*********************************************************************** /***********************************************************************
Script functions Script functions
***********************************************************************/ ***********************************************************************/
/* /*
@ -3402,7 +3402,7 @@ void idEntity::SignalEvent( idThread *thread, signalNum_t signalnum ) {
/*********************************************************************** /***********************************************************************
Guis. Guis.
***********************************************************************/ ***********************************************************************/
@ -3599,7 +3599,7 @@ bool idEntity::HandleSingleGuiCommand( idEntity *entityGui, idLexer *src ) {
/*********************************************************************** /***********************************************************************
Targets Targets
***********************************************************************/ ***********************************************************************/
/* /*
@ -3650,7 +3650,7 @@ idEntity::ActivateTargets
void idEntity::ActivateTargets( idEntity *activator ) const { void idEntity::ActivateTargets( idEntity *activator ) const {
idEntity *ent; idEntity *ent;
int i, j; int i, j;
for( i = 0; i < targets.Num(); i++ ) { for( i = 0; i < targets.Num(); i++ ) {
ent = targets[ i ].GetEntity(); ent = targets[ i ].GetEntity();
if ( !ent ) { if ( !ent ) {
@ -3659,7 +3659,7 @@ void idEntity::ActivateTargets( idEntity *activator ) const {
if ( ent->RespondsTo( EV_Activate ) || ent->HasSignal( SIG_TRIGGER ) ) { if ( ent->RespondsTo( EV_Activate ) || ent->HasSignal( SIG_TRIGGER ) ) {
ent->Signal( SIG_TRIGGER ); ent->Signal( SIG_TRIGGER );
ent->ProcessEvent( &EV_Activate, activator ); ent->ProcessEvent( &EV_Activate, activator );
} }
for ( j = 0; j < MAX_RENDERENTITY_GUI; j++ ) { for ( j = 0; j < MAX_RENDERENTITY_GUI; j++ ) {
if ( ent->renderEntity.gui[ j ] ) { if ( ent->renderEntity.gui[ j ] ) {
ent->renderEntity.gui[ j ]->Trigger( gameLocal.time ); ent->renderEntity.gui[ j ]->Trigger( gameLocal.time );
@ -3671,7 +3671,7 @@ void idEntity::ActivateTargets( idEntity *activator ) const {
/*********************************************************************** /***********************************************************************
Misc. Misc.
***********************************************************************/ ***********************************************************************/
/* /*
@ -3803,7 +3803,7 @@ void idEntity::ShowEditingDialog( void ) {
/*********************************************************************** /***********************************************************************
Events Events
***********************************************************************/ ***********************************************************************/
/* /*
@ -3970,7 +3970,7 @@ void idEntity::Event_SpawnBind( void ) {
const idAnim *anim; const idAnim *anim;
int animNum; int animNum;
idAnimator *parentAnimator; idAnimator *parentAnimator;
if ( spawnArgs.GetString( "bind", "", &bind ) ) { if ( spawnArgs.GetString( "bind", "", &bind ) ) {
if ( idStr::Icmp( bind, "worldspawn" ) == 0 ) { if ( idStr::Icmp( bind, "worldspawn" ) == 0 ) {
//FIXME: Completely unneccessary since the worldspawn is called "world" //FIXME: Completely unneccessary since the worldspawn is called "world"
@ -4175,12 +4175,12 @@ void idEntity::Event_StopSound( int channel, int netSync ) {
/* /*
================ ================
idEntity::Event_StartSound idEntity::Event_StartSound
================ ================
*/ */
void idEntity::Event_StartSound( const char *soundName, int channel, int netSync ) { void idEntity::Event_StartSound( const char *soundName, int channel, int netSync ) {
int time; int time;
StartSound( soundName, ( s_channelType )channel, 0, ( netSync != 0 ), &time ); StartSound( soundName, ( s_channelType )channel, 0, ( netSync != 0 ), &time );
idThread::ReturnFloat( MS2SEC( time ) ); idThread::ReturnFloat( MS2SEC( time ) );
} }
@ -4499,9 +4499,9 @@ void idEntity::Event_RestorePosition( void ) {
if ( spawnArgs.GetMatrix( "rotation", "1 0 0 0 1 0 0 0 1", axis ) ) { if ( spawnArgs.GetMatrix( "rotation", "1 0 0 0 1 0 0 0 1", axis ) ) {
angles = axis.ToAngles(); angles = axis.ToAngles();
} else { } else {
angles[ 0 ] = 0; angles[ 0 ] = 0;
angles[ 1 ] = spawnArgs.GetFloat( "angle" ); angles[ 1 ] = spawnArgs.GetFloat( "angle" );
angles[ 2 ] = 0; angles[ 2 ] = 0;
} }
Teleport( org, angles, NULL ); Teleport( org, angles, NULL );
@ -4543,7 +4543,7 @@ void idEntity::Event_UpdateCameraTarget( void ) {
dir.Normalize(); dir.Normalize();
cameraTarget->SetAxis( dir.ToMat3() ); cameraTarget->SetAxis( dir.ToMat3() );
SetAxis(dir.ToMat3()); SetAxis(dir.ToMat3());
break; break;
} }
kv = cameraTarget->spawnArgs.MatchPrefix( "target", kv ); kv = cameraTarget->spawnArgs.MatchPrefix( "target", kv );
} }
@ -4592,7 +4592,7 @@ idEntity::Event_WaitFrame
*/ */
void idEntity::Event_WaitFrame( void ) { void idEntity::Event_WaitFrame( void ) {
idThread *thread; idThread *thread;
thread = idThread::CurrentThread(); thread = idThread::CurrentThread();
if ( thread ) { if ( thread ) {
thread->WaitFrame(); thread->WaitFrame();
@ -4735,7 +4735,7 @@ void idEntity::Event_GuiNamedEvent(int guiNum, const char *event) {
/*********************************************************************** /***********************************************************************
Network Network
***********************************************************************/ ***********************************************************************/
/* /*
@ -4909,7 +4909,7 @@ void idEntity::ServerSendEvent( int eventId, const idBitMsg *msg, bool saveEvent
outMsg.Init( msgBuf, sizeof( msgBuf ) ); outMsg.Init( msgBuf, sizeof( msgBuf ) );
outMsg.BeginWriting(); outMsg.BeginWriting();
outMsg.WriteByte( GAME_RELIABLE_MESSAGE_EVENT ); outMsg.WriteByte( GAME_RELIABLE_MESSAGE_EVENT );
outMsg.WriteBits( gameLocal.GetSpawnId( this ), 32 ); outMsg.WriteBits( gameLocal.GetSpawnId( this ), 32 );
outMsg.WriteByte( eventId ); outMsg.WriteByte( eventId );
outMsg.WriteLong( gameLocal.time ); outMsg.WriteLong( gameLocal.time );
@ -5281,7 +5281,7 @@ bool idAnimatedEntity::GetJointTransformForAnim( jointHandle_t jointHandle, int
offset = frame[ jointHandle ].ToVec3(); offset = frame[ jointHandle ].ToVec3();
axis = frame[ jointHandle ].ToMat3(); axis = frame[ jointHandle ].ToMat3();
return true; return true;
} }

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -484,7 +484,7 @@ private:
=============================================================================== ===============================================================================
Animated entity base class. Animated entity base class.
=============================================================================== ===============================================================================
*/ */
@ -536,12 +536,12 @@ protected:
private: private:
void Event_GetJointHandle( const char *jointname ); void Event_GetJointHandle( const char *jointname );
void Event_ClearAllJoints( void ); void Event_ClearAllJoints( void );
void Event_ClearJoint( jointHandle_t jointnum ); void Event_ClearJoint( jointHandle_t jointnum );
void Event_SetJointPos( jointHandle_t jointnum, jointModTransform_t transform_type, const idVec3 &pos ); void Event_SetJointPos( jointHandle_t jointnum, jointModTransform_t transform_type, const idVec3 &pos );
void Event_SetJointAngle( jointHandle_t jointnum, jointModTransform_t transform_type, const idAngles &angles ); void Event_SetJointAngle( jointHandle_t jointnum, jointModTransform_t transform_type, const idAngles &angles );
void Event_GetJointPos( jointHandle_t jointnum ); void Event_GetJointPos( jointHandle_t jointnum );
void Event_GetJointAngle( jointHandle_t jointnum ); void Event_GetJointAngle( jointHandle_t jointnum );
}; };

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -43,7 +43,7 @@ const idEventDef EV_Fx_KillFx( "_killfx" );
const idEventDef EV_Fx_Action( "_fxAction", "e" ); // implemented by subclasses const idEventDef EV_Fx_Action( "_fxAction", "e" ); // implemented by subclasses
CLASS_DECLARATION( idEntity, idEntityFx ) CLASS_DECLARATION( idEntity, idEntityFx )
EVENT( EV_Activate, idEntityFx::Event_Trigger ) EVENT( EV_Activate, idEntityFx::Event_Trigger )
EVENT( EV_Fx_KillFx, idEntityFx::Event_ClearFx ) EVENT( EV_Fx_KillFx, idEntityFx::Event_ClearFx )
END_CLASS END_CLASS
@ -217,7 +217,7 @@ void idEntityFx::CleanUp( void ) {
for( int i = 0; i < fxEffect->events.Num(); i++ ) { for( int i = 0; i < fxEffect->events.Num(); i++ ) {
const idFXSingleAction& fxaction = fxEffect->events[i]; const idFXSingleAction& fxaction = fxEffect->events[i];
idFXLocalAction& laction = actions[i]; idFXLocalAction& laction = actions[i];
CleanUpSingleAction( fxaction, laction ); CleanUpSingleAction( fxaction, laction );
} }
} }
@ -319,7 +319,7 @@ void idEntityFx::ApplyFade( const idFXSingleAction& fxaction, idFXLocalAction& l
laction.renderEntity.shaderParms[SHADERPARM_RED] = (fxaction.fadeInTime) ? fadePct : 1.0f - fadePct; laction.renderEntity.shaderParms[SHADERPARM_RED] = (fxaction.fadeInTime) ? fadePct : 1.0f - fadePct;
laction.renderEntity.shaderParms[SHADERPARM_GREEN] = (fxaction.fadeInTime) ? fadePct : 1.0f - fadePct; laction.renderEntity.shaderParms[SHADERPARM_GREEN] = (fxaction.fadeInTime) ? fadePct : 1.0f - fadePct;
laction.renderEntity.shaderParms[SHADERPARM_BLUE] = (fxaction.fadeInTime) ? fadePct : 1.0f - fadePct; laction.renderEntity.shaderParms[SHADERPARM_BLUE] = (fxaction.fadeInTime) ? fadePct : 1.0f - fadePct;
gameRenderWorld->UpdateEntityDef( laction.modelDefHandle, &laction.renderEntity ); gameRenderWorld->UpdateEntityDef( laction.modelDefHandle, &laction.renderEntity );
} }
if ( laction.lightDefHandle != -1 ) { if ( laction.lightDefHandle != -1 ) {
@ -383,7 +383,7 @@ void idEntityFx::Run( int time ) {
} }
laction.delay = totalDelay; laction.delay = totalDelay;
laction.start = time; laction.start = time;
} }
continue; continue;
} }
@ -457,7 +457,7 @@ void idEntityFx::Run( int time ) {
case FX_DECAL: { case FX_DECAL: {
if ( !useAction->decalDropped ) { if ( !useAction->decalDropped ) {
useAction->decalDropped = true; useAction->decalDropped = true;
gameLocal.ProjectDecal( GetPhysics()->GetOrigin(), GetPhysics()->GetGravity(), 8.0f, true, fxaction.size, fxaction.data ); gameLocal.ProjectDecal( GetPhysics()->GetOrigin(), GetPhysics()->GetGravity(), 8.0f, true, fxaction.size, fxaction.data );
} }
break; break;
} }
@ -789,8 +789,8 @@ idEntityFx::ClientPredictionThink
================= =================
*/ */
void idEntityFx::ClientPredictionThink( void ) { void idEntityFx::ClientPredictionThink( void ) {
if ( gameLocal.isNewFrame ) { if ( gameLocal.isNewFrame ) {
Run( gameLocal.time ); Run( gameLocal.time );
} }
RunPhysics(); RunPhysics();
Present(); Present();
@ -800,7 +800,7 @@ void idEntityFx::ClientPredictionThink( void ) {
=============================================================================== ===============================================================================
idTeleporter idTeleporter
=============================================================================== ===============================================================================
*/ */

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -241,7 +241,7 @@ public:
// Animation system calls for non-game based skeletal rendering. // Animation system calls for non-game based skeletal rendering.
virtual idRenderModel * ANIM_GetModelFromEntityDef( const char *classname ); virtual idRenderModel * ANIM_GetModelFromEntityDef( const char *classname );
virtual const idVec3 &ANIM_GetModelOffsetFromEntityDef( const char *classname ); virtual const idVec3 &ANIM_GetModelOffsetFromEntityDef( const char *classname );
virtual idRenderModel * ANIM_GetModelFromEntityDef( const idDict *args ); virtual idRenderModel * ANIM_GetModelFromEntityDef( const idDict *args );
virtual idRenderModel * ANIM_GetModelFromName( const char *modelName ); virtual idRenderModel * ANIM_GetModelFromName( const char *modelName );
virtual const idMD5Anim * ANIM_GetAnimFromEntityDef( const char *classname, const char *animname ); virtual const idMD5Anim * ANIM_GetAnimFromEntityDef( const char *classname, const char *animname );

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -176,7 +176,7 @@ void idDragEntity::Update( idPlayer *player ) {
player->GetViewPos( viewPoint, viewAxis ); player->GetViewPos( viewPoint, viewAxis );
// if no entity selected for dragging // if no entity selected for dragging
if ( !dragEnt.GetEntity() ) { if ( !dragEnt.GetEntity() ) {
if ( player->usercmd.buttons & BUTTON_ATTACK ) { if ( player->usercmd.buttons & BUTTON_ATTACK ) {
@ -470,7 +470,7 @@ idEditEntities::RemoveSelectedEntity
============== ==============
*/ */
void idEditEntities::RemoveSelectedEntity( idEntity *ent ) { void idEditEntities::RemoveSelectedEntity( idEntity *ent ) {
if ( selectedEntities.Find( ent ) ) { if ( selectedEntities.Find( ent ) ) {
selectedEntities.Remove( ent ); selectedEntities.Remove( ent );
} }
} }
@ -751,7 +751,7 @@ idGameEdit::FindEntity
================ ================
*/ */
idEntity *idGameEdit::FindEntity( const char *name ) const { idEntity *idGameEdit::FindEntity( const char *name ) const {
return gameLocal.FindEntity( name ); return gameLocal.FindEntity( name );
} }
/* /*
@ -876,7 +876,7 @@ void idGameEdit::EntityChangeSpawnArgs( idEntity *ent, const idDict *newArgs ) {
if ( ent ) { if ( ent ) {
for ( int i = 0 ; i < newArgs->GetNumKeyVals () ; i ++ ) { for ( int i = 0 ; i < newArgs->GetNumKeyVals () ; i ++ ) {
const idKeyValue *kv = newArgs->GetKeyVal( i ); const idKeyValue *kv = newArgs->GetKeyVal( i );
if ( kv->GetValue().Length() > 0 ) { if ( kv->GetValue().Length() > 0 ) {
ent->spawnArgs.Set ( kv->GetKey() ,kv->GetValue() ); ent->spawnArgs.Set ( kv->GetKey() ,kv->GetValue() );
} else { } else {
@ -1107,7 +1107,7 @@ int idGameEdit::MapGetEntitiesMatchingClassWithString( const char *classname, co
if (ent) { if (ent) {
idStr work = ent->epairs.GetString("classname"); idStr work = ent->epairs.GetString("classname");
if ( work.Icmp( classname ) == 0 ) { if ( work.Icmp( classname ) == 0 ) {
if ( match && *match ) { if ( match && *match ) {
work = ent->epairs.GetString( "soundgroup" ); work = ent->epairs.GetString( "soundgroup" );
if ( count < max && work.Icmp( match ) == 0 ) { if ( count < max && work.Icmp( match ) == 0 ) {
list[count++] = ent->epairs.GetString( "name" ); list[count++] = ent->epairs.GetString( "name" );

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -352,7 +352,7 @@ void idGameLocal::Init( void ) {
// load default scripts // load default scripts
program.Startup( SCRIPT_DEFAULT ); program.Startup( SCRIPT_DEFAULT );
#ifdef _D3XP #ifdef _D3XP
//BSM Nerve: Loads a game specific main script file //BSM Nerve: Loads a game specific main script file
idStr gamedir; idStr gamedir;
@ -363,7 +363,7 @@ void idGameLocal::Init( void ) {
} else if ( i == 1 ) { } else if ( i == 1 ) {
gamedir = cvarSystem->GetCVarString( "fs_game" ); gamedir = cvarSystem->GetCVarString( "fs_game" );
} }
if( gamedir.Length() > 0 ) { if( gamedir.Length() > 0 ) {
idStr scriptFile = va( "script/%s_main.script", gamedir.c_str() ); idStr scriptFile = va( "script/%s_main.script", gamedir.c_str() );
if ( fileSystem->ReadFile( scriptFile.c_str(), NULL ) > 0 ) { if ( fileSystem->ReadFile( scriptFile.c_str(), NULL ) > 0 ) {
program.CompileFile( scriptFile.c_str() ); program.CompileFile( scriptFile.c_str() );
@ -486,7 +486,7 @@ void idGameLocal::SaveGame( idFile *f ) {
idSaveGame savegame( f ); idSaveGame savegame( f );
if (g_flushSave.GetBool( ) == true ) { if (g_flushSave.GetBool( ) == true ) {
// force flushing with each write... for tracking down // force flushing with each write... for tracking down
// save game bugs. // save game bugs.
f->ForceFlush(); f->ForceFlush();
@ -844,7 +844,7 @@ const idDict* idGameLocal::SetUserInfo( int clientNum, const idDict &userInfo, b
idGameLocal::userInfo[ clientNum ].Set( "ui_name", va( "%s_", idGameLocal::userInfo[ clientNum ].GetString( "ui_name" ) ) ); idGameLocal::userInfo[ clientNum ].Set( "ui_name", va( "%s_", idGameLocal::userInfo[ clientNum ].GetString( "ui_name" ) ) );
modifiedInfo = true; modifiedInfo = true;
} }
// don't allow dupe nicknames // don't allow dupe nicknames
for ( i = 0; i < numClients; i++ ) { for ( i = 0; i < numClients; i++ ) {
if ( i == clientNum ) { if ( i == clientNum ) {
@ -959,7 +959,7 @@ void idGameLocal::LoadMap( const char *mapName, int randseed ) {
memset( usercmds, 0, sizeof( usercmds ) ); memset( usercmds, 0, sizeof( usercmds ) );
memset( spawnIds, -1, sizeof( spawnIds ) ); memset( spawnIds, -1, sizeof( spawnIds ) );
spawnCount = INITIAL_SPAWN_COUNT; spawnCount = INITIAL_SPAWN_COUNT;
spawnedEntities.Clear(); spawnedEntities.Clear();
activeEntities.Clear(); activeEntities.Clear();
numEntitiesToDeactivate = 0; numEntitiesToDeactivate = 0;
@ -988,7 +988,7 @@ void idGameLocal::LoadMap( const char *mapName, int randseed ) {
lastAIAlertEntity = NULL; lastAIAlertEntity = NULL;
lastAIAlertTime = 0; lastAIAlertTime = 0;
previousTime = 0; previousTime = 0;
time = 0; time = 0;
framenum = 0; framenum = 0;
@ -1131,7 +1131,7 @@ void idGameLocal::MapRestart( ) {
#endif #endif
if ( isClient ) { if ( isClient ) {
LocalMapRestart(); LocalMapRestart();
} else { } else {
@ -1628,7 +1628,7 @@ idGameLocal::MapShutdown
*/ */
void idGameLocal::MapShutdown( void ) { void idGameLocal::MapShutdown( void ) {
Printf( "--------- Game Map Shutdown ----------\n" ); Printf( "--------- Game Map Shutdown ----------\n" );
gamestate = GAMESTATE_SHUTDOWN; gamestate = GAMESTATE_SHUTDOWN;
if ( gameRenderWorld ) { if ( gameRenderWorld ) {
@ -1867,7 +1867,7 @@ void idGameLocal::CacheDictionaryMedia( const idDict *dict ) {
while( kv ) { while( kv ) {
if ( kv->GetValue().Length() ) { if ( kv->GetValue().Length() ) {
if ( !idStr::Icmp( kv->GetKey(), "gui_noninteractive" ) if ( !idStr::Icmp( kv->GetKey(), "gui_noninteractive" )
|| !idStr::Icmpn( kv->GetKey(), "gui_parm", 8 ) || !idStr::Icmpn( kv->GetKey(), "gui_parm", 8 )
|| !idStr::Icmp( kv->GetKey(), "gui_inventory" ) ) { || !idStr::Icmp( kv->GetKey(), "gui_inventory" ) ) {
// unfortunate flag names, they aren't actually a gui // unfortunate flag names, they aren't actually a gui
} else { } else {
@ -2240,7 +2240,7 @@ bool idGameLocal::InPlayerPVS( idEntity *ent ) const {
if ( playerPVS.i == -1 ) { if ( playerPVS.i == -1 ) {
return false; return false;
} }
return pvs.InCurrentPVS( playerPVS, ent->GetPVSAreas(), ent->GetNumPVSAreas() ); return pvs.InCurrentPVS( playerPVS, ent->GetPVSAreas(), ent->GetNumPVSAreas() );
} }
/* /*
@ -2254,7 +2254,7 @@ bool idGameLocal::InPlayerConnectedArea( idEntity *ent ) const {
if ( playerConnectedAreas.i == -1 ) { if ( playerConnectedAreas.i == -1 ) {
return false; return false;
} }
return pvs.InCurrentPVS( playerConnectedAreas, ent->GetPVSAreas(), ent->GetNumPVSAreas() ); return pvs.InCurrentPVS( playerConnectedAreas, ent->GetPVSAreas(), ent->GetNumPVSAreas() );
} }
/* /*
@ -2269,7 +2269,7 @@ void idGameLocal::UpdateGravity( void ) {
if ( g_gravity.GetFloat() == 0.0f ) { if ( g_gravity.GetFloat() == 0.0f ) {
g_gravity.SetFloat( 1.0f ); g_gravity.SetFloat( 1.0f );
} }
gravity.Set( 0, 0, -g_gravity.GetFloat() ); gravity.Set( 0, 0, -g_gravity.GetFloat() );
// update all physics objects // update all physics objects
for( ent = spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() ) { for( ent = spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() ) {
@ -2385,7 +2385,7 @@ void idGameLocal::RunTimeGroup2() {
slow.Get( time, previousTime, msec, framenum, realClientTime ); slow.Get( time, previousTime, msec, framenum, realClientTime );
} }
#endif #endif
/* /*
================ ================
idGameLocal::RunFrame idGameLocal::RunFrame
@ -2611,7 +2611,7 @@ gameReturn_t idGameLocal::RunFrame( const usercmd_t *clientCmds ) {
ret.syncNextGameFrame = skipCinematic; ret.syncNextGameFrame = skipCinematic;
if ( skipCinematic ) { if ( skipCinematic ) {
soundSystem->SetMute( false ); soundSystem->SetMute( false );
skipCinematic = false; skipCinematic = false;
} }
// show any debug info for this frame // show any debug info for this frame
@ -2642,7 +2642,7 @@ void idGameLocal::CalcFov( float base_fov, float &fov_x, float &fov_y ) const {
float y; float y;
float ratio_x; float ratio_x;
float ratio_y; float ratio_y;
if ( !sys->FPU_StackIsEmpty() ) { if ( !sys->FPU_StackIsEmpty() ) {
Printf( sys->FPU_GetState() ); Printf( sys->FPU_GetState() );
Error( "idGameLocal::CalcFov: FPU stack not empty" ); Error( "idGameLocal::CalcFov: FPU stack not empty" );
@ -3255,7 +3255,7 @@ idEntity *idGameLocal::SpawnEntityType( const idTypeInfo &classdef, const idDict
obj = classdef.CreateInstance(); obj = classdef.CreateInstance();
obj->CallSpawn(); obj->CallSpawn();
} }
catch( idAllocError & ) { catch( idAllocError & ) {
obj = NULL; obj = NULL;
} }
@ -3392,7 +3392,7 @@ idGameLocal::InhibitEntitySpawn
================ ================
*/ */
bool idGameLocal::InhibitEntitySpawn( idDict &spawnArgs ) { bool idGameLocal::InhibitEntitySpawn( idDict &spawnArgs ) {
bool result = false; bool result = false;
if ( isMultiplayer ) { if ( isMultiplayer ) {
@ -3413,7 +3413,7 @@ bool idGameLocal::InhibitEntitySpawn( idDict &spawnArgs ) {
const char *name; const char *name;
#ifndef ID_DEMO_BUILD #ifndef ID_DEMO_BUILD
if ( g_skill.GetInteger() == 3 ) { if ( g_skill.GetInteger() == 3 ) {
name = spawnArgs.GetString( "classname" ); name = spawnArgs.GetString( "classname" );
// _D3XP :: remove moveable medkit packs also // _D3XP :: remove moveable medkit packs also
if ( idStr::Icmp( name, "item_medkit" ) == 0 || idStr::Icmp( name, "item_medkit_small" ) == 0 || if ( idStr::Icmp( name, "item_medkit" ) == 0 || idStr::Icmp( name, "item_medkit_small" ) == 0 ||
@ -3575,7 +3575,7 @@ int idGameLocal::GetTargets( const idDict &args, idList< idEntityPtr<idEntity> >
ent = FindEntity( arg->GetValue() ); ent = FindEntity( arg->GetValue() );
if ( ent ) { if ( ent ) {
idEntityPtr<idEntity> &entityPtr = list.Alloc(); idEntityPtr<idEntity> &entityPtr = list.Alloc();
entityPtr = ent; entityPtr = ent;
} }
} }
} }
@ -3844,7 +3844,7 @@ void idGameLocal::RadiusDamage( const idVec3 &origin, idEntity *inflictor, idEnt
idEntity * entityList[ MAX_GENTITIES ]; idEntity * entityList[ MAX_GENTITIES ];
int numListedEntities; int numListedEntities;
idBounds bounds; idBounds bounds;
idVec3 v, damagePoint, dir; idVec3 v, damagePoint, dir;
int i, e, damage, radius, push; int i, e, damage, radius, push;
const idDict *damageDef = FindEntityDefDict( damageDefName, false ); const idDict *damageDef = FindEntityDefDict( damageDefName, false );
@ -3929,7 +3929,7 @@ void idGameLocal::RadiusDamage( const idVec3 &origin, idEntity *inflictor, idEnt
} }
ent->Damage( inflictor, attacker, dir, damageDefName, damageScale, INVALID_JOINT ); ent->Damage( inflictor, attacker, dir, damageDefName, damageScale, INVALID_JOINT );
} }
} }
// push physics objects // push physics objects
@ -4180,7 +4180,7 @@ void idGameLocal::SetCamera( idCamera *cam ) {
// set r_znear so that transitioning into/out of the player's head doesn't clip through the view // set r_znear so that transitioning into/out of the player's head doesn't clip through the view
cvarSystem->SetCVarFloat( "r_znear", 1.0f ); cvarSystem->SetCVarFloat( "r_znear", 1.0f );
// hide all the player models // hide all the player models
for( i = 0; i < numClients; i++ ) { for( i = 0; i < numClients; i++ ) {
if ( entities[ i ] ) { if ( entities[ i ] ) {
@ -4196,7 +4196,7 @@ void idGameLocal::SetCamera( idCamera *cam ) {
// only kill entities that aren't needed for cinematics and aren't dormant // only kill entities that aren't needed for cinematics and aren't dormant
continue; continue;
} }
if ( ent->IsType( idAI::Type ) ) { if ( ent->IsType( idAI::Type ) ) {
ai = static_cast<idAI *>( ent ); ai = static_cast<idAI *>( ent );
if ( !ai->GetEnemy() || !ai->IsActive() ) { if ( !ai->GetEnemy() || !ai->IsActive() ) {
@ -4400,7 +4400,7 @@ void idGameLocal::RandomizeInitialSpawns( void ) {
#ifdef CTF #ifdef CTF
int k; int k;
#endif #endif
idEntity *ent; idEntity *ent;
if ( !isMultiplayer || isClient ) { if ( !isMultiplayer || isClient ) {
@ -4414,7 +4414,7 @@ void idGameLocal::RandomizeInitialSpawns( void ) {
teamInitialSpots[0].Clear(); teamInitialSpots[0].Clear();
teamInitialSpots[1].Clear(); teamInitialSpots[1].Clear();
#endif #endif
spot.dist = 0; spot.dist = 0;
spot.ent = FindEntityUsingDef( NULL, "info_player_deathmatch" ); spot.ent = FindEntityUsingDef( NULL, "info_player_deathmatch" );
while( spot.ent ) { while( spot.ent ) {
@ -4428,7 +4428,7 @@ void idGameLocal::RandomizeInitialSpawns( void ) {
else else
common->Warning( "info_player_deathmatch : invalid or no team attached to spawn point\n"); common->Warning( "info_player_deathmatch : invalid or no team attached to spawn point\n");
} }
#endif #endif
spawnSpots.Append( spot ); spawnSpots.Append( spot );
if ( spot.ent->spawnArgs.GetBool( "initial" ) ) { if ( spot.ent->spawnArgs.GetBool( "initial" ) ) {
#ifdef CTF #ifdef CTF
@ -4438,7 +4438,7 @@ void idGameLocal::RandomizeInitialSpawns( void ) {
teamInitialSpots[ spot.team ].Append( spot.ent ); teamInitialSpots[ spot.team ].Append( spot.ent );
} }
#endif #endif
initialSpots.Append( spot.ent ); initialSpots.Append( spot.ent );
} }
spot.ent = FindEntityUsingDef( spot.ent, "info_player_deathmatch" ); spot.ent = FindEntityUsingDef( spot.ent, "info_player_deathmatch" );
@ -4456,7 +4456,7 @@ void idGameLocal::RandomizeInitialSpawns( void ) {
return; return;
} }
#endif #endif
if ( !spawnSpots.Num() ) { if ( !spawnSpots.Num() ) {
common->Warning( "no info_player_deathmatch in map" ); common->Warning( "no info_player_deathmatch in map" );
return; return;
@ -4485,7 +4485,7 @@ void idGameLocal::RandomizeInitialSpawns( void ) {
} }
#endif #endif
common->Printf( "%d spawns (%d initials)\n", spawnSpots.Num(), initialSpots.Num() ); common->Printf( "%d spawns (%d initials)\n", spawnSpots.Num(), initialSpots.Num() );
// if there are no initial spots in the map, consider they can all be used as initial // if there are no initial spots in the map, consider they can all be used as initial
if ( !initialSpots.Num() ) { if ( !initialSpots.Num() ) {
@ -4504,7 +4504,7 @@ void idGameLocal::RandomizeInitialSpawns( void ) {
teamInitialSpots[ k ][ j ] = ent; teamInitialSpots[ k ][ j ] = ent;
} }
#endif #endif
for ( i = 0; i < initialSpots.Num(); i++ ) { for ( i = 0; i < initialSpots.Num(); i++ ) {
j = random.RandomInt( initialSpots.Num() ); j = random.RandomInt( initialSpots.Num() );
ent = initialSpots[ i ]; ent = initialSpots[ i ];
@ -4557,7 +4557,7 @@ idEntity *idGameLocal::SelectInitialSpawnPoint( idPlayer *player ) {
useInitialSpots = player->useInitialSpawns && currentInitialSpot < initialSpots.Num(); useInitialSpots = player->useInitialSpawns && currentInitialSpot < initialSpots.Num();
} }
#endif #endif
if ( player->spectating ) { if ( player->spectating ) {
// plain random spot, don't bother // plain random spot, don't bother
return spawnSpots[ random.RandomInt( spawnSpots.Num() ) ].ent; return spawnSpots[ random.RandomInt( spawnSpots.Num() ) ].ent;
@ -4619,7 +4619,7 @@ idEntity *idGameLocal::SelectInitialSpawnPoint( idPlayer *player ) {
|| static_cast< idPlayer * >( entities[ j ] )->spectating ) { || static_cast< idPlayer * >( entities[ j ] )->spectating ) {
continue; continue;
} }
dist = ( pos - entities[ j ]->GetPhysics()->GetOrigin() ).LengthSqr(); dist = ( pos - entities[ j ]->GetPhysics()->GetOrigin() ).LengthSqr();
if ( dist < teamSpawnSpots[ team ][ i ].dist ) { if ( dist < teamSpawnSpots[ team ][ i ].dist ) {
teamSpawnSpots[ team ][ i ].dist = dist; teamSpawnSpots[ team ][ i ].dist = dist;
@ -4638,7 +4638,7 @@ idEntity *idGameLocal::SelectInitialSpawnPoint( idPlayer *player ) {
return spot.ent; return spot.ent;
} }
#endif #endif
// find the distance to the closest active player for each spawn spot // find the distance to the closest active player for each spawn spot
for( i = 0; i < spawnSpots.Num(); i++ ) { for( i = 0; i < spawnSpots.Num(); i++ ) {
pos = spawnSpots[ i ].ent->GetPhysics()->GetOrigin(); pos = spawnSpots[ i ].ent->GetPhysics()->GetOrigin();
@ -4649,7 +4649,7 @@ idEntity *idGameLocal::SelectInitialSpawnPoint( idPlayer *player ) {
|| static_cast< idPlayer * >( entities[ j ] )->spectating ) { || static_cast< idPlayer * >( entities[ j ] )->spectating ) {
continue; continue;
} }
dist = ( pos - entities[ j ]->GetPhysics()->GetOrigin() ).LengthSqr(); dist = ( pos - entities[ j ]->GetPhysics()->GetOrigin() ).LengthSqr();
if ( dist < spawnSpots[ i ].dist ) { if ( dist < spawnSpots[ i ].dist ) {
spawnSpots[ i ].dist = dist; spawnSpots[ i ].dist = dist;
@ -4688,7 +4688,7 @@ void idGameLocal::UpdateServerInfoFlags() {
gameType = GAME_CTF; gameType = GAME_CTF;
} }
#endif #endif
if ( gameType == GAME_LASTMAN ) { if ( gameType == GAME_LASTMAN ) {
if ( !serverInfo.GetInt( "si_warmup" ) ) { if ( !serverInfo.GetInt( "si_warmup" ) ) {
common->Warning( "Last Man Standing - forcing warmup on" ); common->Warning( "Last Man Standing - forcing warmup on" );
@ -4923,12 +4923,12 @@ idGameLocal::NeedRestart
=============== ===============
*/ */
bool idGameLocal::NeedRestart() { bool idGameLocal::NeedRestart() {
idDict newInfo; idDict newInfo;
const idKeyValue *keyval, *keyval2; const idKeyValue *keyval, *keyval2;
newInfo = *cvarSystem->MoveCVarsToDict( CVAR_SERVERINFO ); newInfo = *cvarSystem->MoveCVarsToDict( CVAR_SERVERINFO );
for ( int i = 0; i < newInfo.GetNumKeyVals(); i++ ) { for ( int i = 0; i < newInfo.GetNumKeyVals(); i++ ) {
keyval = newInfo.GetKeyVal( i ); keyval = newInfo.GetKeyVal( i );
keyval2 = serverInfo.FindKey( keyval->GetKey() ); keyval2 = serverInfo.FindKey( keyval->GetKey() );
@ -4983,4 +4983,3 @@ idGameLocal::GetMapLoadingGUI
=============== ===============
*/ */
void idGameLocal::GetMapLoadingGUI( char gui[ MAX_STRING_CHARS ] ) { } void idGameLocal::GetMapLoadingGUI( char gui[ MAX_STRING_CHARS ] ) { }

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -181,8 +181,8 @@ typedef struct {
idEntity *ent; idEntity *ent;
int dist; int dist;
#ifdef CTF #ifdef CTF
int team; int team;
#endif #endif
} spawnSpot_t; } spawnSpot_t;
//============================================================================ //============================================================================
@ -286,7 +286,7 @@ public:
idDict persistentLevelInfo; // contains args that are kept around between levels idDict persistentLevelInfo; // contains args that are kept around between levels
// can be used to automatically effect every material in the world that references globalParms // can be used to automatically effect every material in the world that references globalParms
float globalShaderParms[ MAX_GLOBAL_SHADER_PARMS ]; float globalShaderParms[ MAX_GLOBAL_SHADER_PARMS ];
idRandom random; // random number generator used throughout the game idRandom random; // random number generator used throughout the game
@ -300,7 +300,7 @@ public:
idTestModel * testmodel; // for development testing of models idTestModel * testmodel; // for development testing of models
idEntityFx * testFx; // for development testing of fx idEntityFx * testFx; // for development testing of fx
idStr sessionCommand; // a target_sessionCommand can set this to return something to the session idStr sessionCommand; // a target_sessionCommand can set this to return something to the session
idMultiplayerGame mpGame; // handles rules for standard dm idMultiplayerGame mpGame; // handles rules for standard dm

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -566,7 +566,7 @@ void idGameLocal::ServerWriteSnapshot( int clientNum, int sequence, idBitMsg &ms
} else { } else {
spectated = player; spectated = player;
} }
// free too old snapshots // free too old snapshots
FreeSnapshotsOlderThanSequence( clientNum, sequence - 64 ); FreeSnapshotsOlderThanSequence( clientNum, sequence - 64 );
@ -749,7 +749,7 @@ void idGameLocal::ServerProcessEntityNetworkEventQueue( void ) {
} }
idEntityPtr< idEntity > entPtr; idEntityPtr< idEntity > entPtr;
if( !entPtr.SetSpawnId( event->spawnId ) ) { if( !entPtr.SetSpawnId( event->spawnId ) ) {
NetworkEventWarning( event, "Entity does not exist any longer, or has not been spawned yet." ); NetworkEventWarning( event, "Entity does not exist any longer, or has not been spawned yet." );
} else { } else {
@ -1294,7 +1294,7 @@ void idGameLocal::ClientProcessEntityNetworkEventQueue( void ) {
} }
idEntityPtr< idEntity > entPtr; idEntityPtr< idEntity > entPtr;
if( !entPtr.SetSpawnId( event->spawnId ) ) { if( !entPtr.SetSpawnId( event->spawnId ) ) {
if( !gameLocal.entities[ event->spawnId & ( ( 1 << GENTITYNUM_BITS ) - 1 ) ] ) { if( !gameLocal.entities[ event->spawnId & ( ( 1 << GENTITYNUM_BITS ) - 1 ) ] ) {
// if new entity exists in this position, silently ignore // if new entity exists in this position, silently ignore
@ -1573,7 +1573,7 @@ idGameLocal::Tokenize
void idGameLocal::Tokenize( idStrList &out, const char *in ) { void idGameLocal::Tokenize( idStrList &out, const char *in ) {
char buf[ MAX_STRING_CHARS ]; char buf[ MAX_STRING_CHARS ];
char *token, *next; char *token, *next;
idStr::Copynz( buf, in, MAX_STRING_CHARS ); idStr::Copynz( buf, in, MAX_STRING_CHARS );
token = buf; token = buf;
next = strchr( token, ';' ); next = strchr( token, ';' );
@ -1588,7 +1588,7 @@ void idGameLocal::Tokenize( idStrList &out, const char *in ) {
next = strchr( token, ';' ); next = strchr( token, ';' );
} else { } else {
token = NULL; token = NULL;
} }
} }
} }
@ -1647,7 +1647,7 @@ bool idGameLocal::DownloadRequest( const char *IP, const char *guid, const char
common->DPrintf( "download for %s: %s\n", IP, url.c_str() ); common->DPrintf( "download for %s: %s\n", IP, url.c_str() );
} }
} }
idStr::Copynz( urls, reply, MAX_STRING_CHARS ); idStr::Copynz( urls, reply, MAX_STRING_CHARS );
return true; return true;
} }
@ -1738,7 +1738,7 @@ entityNetEvent_t* idEventQueue::RemoveLast( void ) {
if ( !end ) { if ( !end ) {
start = NULL; start = NULL;
} else { } else {
end->next = NULL; end->next = NULL;
} }
event->next = NULL; event->next = NULL;
@ -1782,7 +1782,7 @@ void idEventQueue::Enqueue( entityNetEvent_t *event, outOfOrderBehaviour_t behav
cur->next = event; cur->next = event;
} }
return; return;
} }
// add the new event // add the new event
event->next = NULL; event->next = NULL;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -341,7 +341,7 @@ void idGrabber::StopDrag( bool dropOnly ) {
aiEnt->Damage( thePlayer, thePlayer, vec3_origin, "damage_suicide", 1.0f, INVALID_JOINT ); aiEnt->Damage( thePlayer, thePlayer, vec3_origin, "damage_suicide", 1.0f, INVALID_JOINT );
} }
af->SetThrown( !dropOnly ); af->SetThrown( !dropOnly );
// Reset timers so that it isn't forcibly put to rest in mid-air // Reset timers so that it isn't forcibly put to rest in mid-air
@ -451,7 +451,7 @@ int idGrabber::Update( idPlayer *player, bool hide ) {
if ( !gameLocal.isMultiplayer && !abort && (( player->usercmd.flags & UCF_IMPULSE_SEQUENCE ) != ( oldUcmdFlags & UCF_IMPULSE_SEQUENCE )) && (player->usercmd.impulse == IMPULSE_13) ) { if ( !gameLocal.isMultiplayer && !abort && (( player->usercmd.flags & UCF_IMPULSE_SEQUENCE ) != ( oldUcmdFlags & UCF_IMPULSE_SEQUENCE )) && (player->usercmd.impulse == IMPULSE_13) ) {
abort = true; abort = true;
} }
if ( abort ) { if ( abort ) {
StopDrag( true ); StopDrag( true );
return 3; return 3;
@ -461,7 +461,7 @@ int idGrabber::Update( idPlayer *player, bool hide ) {
owner = player; owner = player;
// if no entity selected for dragging // if no entity selected for dragging
if ( !dragEnt.GetEntity() ) { if ( !dragEnt.GetEntity() ) {
idBounds bounds; idBounds bounds;
idVec3 end = player->firstPersonViewOrigin + player->firstPersonViewAxis[0] * dragTraceDist; idVec3 end = player->firstPersonViewOrigin + player->firstPersonViewAxis[0] * dragTraceDist;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -30,7 +30,7 @@ If you have questions concerning this license or the applicable additional terms
/* /*
=============================================================================== ===============================================================================
Grabber Object - Class to extend idWeapon to include functionality for Grabber Object - Class to extend idWeapon to include functionality for
manipulating physics objects. manipulating physics objects.
=============================================================================== ===============================================================================

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -151,7 +151,7 @@ bool idIK::Init( idEntity *self, const char *anim, const idVec3 &modelOffset ) {
self->name.c_str(), self->GetPhysics()->GetOrigin().ToString(0) ); self->name.c_str(), self->GetPhysics()->GetOrigin().ToString(0) );
return false; return false;
} }
this->modelOffset = modelOffset; this->modelOffset = modelOffset;
return true; return true;
@ -296,40 +296,40 @@ idIK_Walk::Save
*/ */
void idIK_Walk::Save( idSaveGame *savefile ) const { void idIK_Walk::Save( idSaveGame *savefile ) const {
int i; int i;
idIK::Save( savefile ); idIK::Save( savefile );
savefile->WriteClipModel( footModel ); savefile->WriteClipModel( footModel );
savefile->WriteInt( numLegs ); savefile->WriteInt( numLegs );
savefile->WriteInt( enabledLegs ); savefile->WriteInt( enabledLegs );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->WriteInt( footJoints[i] ); savefile->WriteInt( footJoints[i] );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->WriteInt( ankleJoints[i] ); savefile->WriteInt( ankleJoints[i] );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->WriteInt( kneeJoints[i] ); savefile->WriteInt( kneeJoints[i] );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->WriteInt( hipJoints[i] ); savefile->WriteInt( hipJoints[i] );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->WriteInt( dirJoints[i] ); savefile->WriteInt( dirJoints[i] );
savefile->WriteInt( waistJoint ); savefile->WriteInt( waistJoint );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->WriteVec3( hipForward[i] ); savefile->WriteVec3( hipForward[i] );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->WriteVec3( kneeForward[i] ); savefile->WriteVec3( kneeForward[i] );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->WriteFloat( upperLegLength[i] ); savefile->WriteFloat( upperLegLength[i] );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->WriteFloat( lowerLegLength[i] ); savefile->WriteFloat( lowerLegLength[i] );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->WriteMat3( upperLegToHipJoint[i] ); savefile->WriteMat3( upperLegToHipJoint[i] );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->WriteMat3( lowerLegToKneeJoint[i] ); savefile->WriteMat3( lowerLegToKneeJoint[i] );
savefile->WriteFloat( smoothing ); savefile->WriteFloat( smoothing );
savefile->WriteFloat( waistSmoothing ); savefile->WriteFloat( waistSmoothing );
savefile->WriteFloat( footShift ); savefile->WriteFloat( footShift );
@ -359,7 +359,7 @@ idIK_Walk::Restore
*/ */
void idIK_Walk::Restore( idRestoreGame *savefile ) { void idIK_Walk::Restore( idRestoreGame *savefile ) {
int i; int i;
idIK::Restore( savefile ); idIK::Restore( savefile );
savefile->ReadClipModel( footModel ); savefile->ReadClipModel( footModel );
@ -377,22 +377,22 @@ void idIK_Walk::Restore( idRestoreGame *savefile ) {
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->ReadInt( (int&)dirJoints[i] ); savefile->ReadInt( (int&)dirJoints[i] );
savefile->ReadInt( (int&)waistJoint ); savefile->ReadInt( (int&)waistJoint );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->ReadVec3( hipForward[i] ); savefile->ReadVec3( hipForward[i] );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->ReadVec3( kneeForward[i] ); savefile->ReadVec3( kneeForward[i] );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->ReadFloat( upperLegLength[i] ); savefile->ReadFloat( upperLegLength[i] );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->ReadFloat( lowerLegLength[i] ); savefile->ReadFloat( lowerLegLength[i] );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->ReadMat3( upperLegToHipJoint[i] ); savefile->ReadMat3( upperLegToHipJoint[i] );
for ( i = 0; i < MAX_LEGS; i++ ) for ( i = 0; i < MAX_LEGS; i++ )
savefile->ReadMat3( lowerLegToKneeJoint[i] ); savefile->ReadMat3( lowerLegToKneeJoint[i] );
savefile->ReadFloat( smoothing ); savefile->ReadFloat( smoothing );
savefile->ReadFloat( waistSmoothing ); savefile->ReadFloat( waistSmoothing );
savefile->ReadFloat( footShift ); savefile->ReadFloat( footShift );
@ -893,17 +893,17 @@ void idIK_Reach::Save( idSaveGame *savefile ) const {
savefile->WriteInt( shoulderJoints[i] ); savefile->WriteInt( shoulderJoints[i] );
for ( i = 0; i < MAX_ARMS; i++ ) for ( i = 0; i < MAX_ARMS; i++ )
savefile->WriteInt( dirJoints[i] ); savefile->WriteInt( dirJoints[i] );
for ( i = 0; i < MAX_ARMS; i++ ) for ( i = 0; i < MAX_ARMS; i++ )
savefile->WriteVec3( shoulderForward[i] ); savefile->WriteVec3( shoulderForward[i] );
for ( i = 0; i < MAX_ARMS; i++ ) for ( i = 0; i < MAX_ARMS; i++ )
savefile->WriteVec3( elbowForward[i] ); savefile->WriteVec3( elbowForward[i] );
for ( i = 0; i < MAX_ARMS; i++ ) for ( i = 0; i < MAX_ARMS; i++ )
savefile->WriteFloat( upperArmLength[i] ); savefile->WriteFloat( upperArmLength[i] );
for ( i = 0; i < MAX_ARMS; i++ ) for ( i = 0; i < MAX_ARMS; i++ )
savefile->WriteFloat( lowerArmLength[i] ); savefile->WriteFloat( lowerArmLength[i] );
for ( i = 0; i < MAX_ARMS; i++ ) for ( i = 0; i < MAX_ARMS; i++ )
savefile->WriteMat3( upperArmToShoulderJoint[i] ); savefile->WriteMat3( upperArmToShoulderJoint[i] );
for ( i = 0; i < MAX_ARMS; i++ ) for ( i = 0; i < MAX_ARMS; i++ )
@ -929,17 +929,17 @@ void idIK_Reach::Restore( idRestoreGame *savefile ) {
savefile->ReadInt( (int&)shoulderJoints[i] ); savefile->ReadInt( (int&)shoulderJoints[i] );
for ( i = 0; i < MAX_ARMS; i++ ) for ( i = 0; i < MAX_ARMS; i++ )
savefile->ReadInt( (int&)dirJoints[i] ); savefile->ReadInt( (int&)dirJoints[i] );
for ( i = 0; i < MAX_ARMS; i++ ) for ( i = 0; i < MAX_ARMS; i++ )
savefile->ReadVec3( shoulderForward[i] ); savefile->ReadVec3( shoulderForward[i] );
for ( i = 0; i < MAX_ARMS; i++ ) for ( i = 0; i < MAX_ARMS; i++ )
savefile->ReadVec3( elbowForward[i] ); savefile->ReadVec3( elbowForward[i] );
for ( i = 0; i < MAX_ARMS; i++ ) for ( i = 0; i < MAX_ARMS; i++ )
savefile->ReadFloat( upperArmLength[i] ); savefile->ReadFloat( upperArmLength[i] );
for ( i = 0; i < MAX_ARMS; i++ ) for ( i = 0; i < MAX_ARMS; i++ )
savefile->ReadFloat( lowerArmLength[i] ); savefile->ReadFloat( lowerArmLength[i] );
for ( i = 0; i < MAX_ARMS; i++ ) for ( i = 0; i < MAX_ARMS; i++ )
savefile->ReadMat3( upperArmToShoulderJoint[i] ); savefile->ReadMat3( upperArmToShoulderJoint[i] );
for ( i = 0; i < MAX_ARMS; i++ ) for ( i = 0; i < MAX_ARMS; i++ )

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -69,7 +69,7 @@ protected:
/* /*
=============================================================================== ===============================================================================
IK controller for a walking character with an arbitrary number of legs. IK controller for a walking character with an arbitrary number of legs.
=============================================================================== ===============================================================================
*/ */

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -165,7 +165,7 @@ bool idItem::UpdateRenderEntity( renderEntity_s *renderEntity, const renderView_
} }
} }
// fade down after the last pulse finishes // fade down after the last pulse finishes
if ( !inView && cycle > lastCycle ) { if ( !inView && cycle > lastCycle ) {
renderEntity->shaderParms[4] = 0.0f; renderEntity->shaderParms[4] = 0.0f;
} else { } else {
@ -224,7 +224,7 @@ void idItem::Think( void ) {
SetAngles( ang ); SetAngles( ang );
float scale = 0.005f + entityNumber * 0.00001f; float scale = 0.005f + entityNumber * 0.00001f;
org = orgOrigin; org = orgOrigin;
org.z += 4.0f + cos( ( gameLocal.time + 2000 ) * scale ) * 4.0f; org.z += 4.0f + cos( ( gameLocal.time + 2000 ) * scale ) * 4.0f;
SetOrigin( org ); SetOrigin( org );
@ -302,7 +302,7 @@ void idItem::Spawn( void ) {
if ( spawnArgs.GetBool( "spin" ) || (gameLocal.isMultiplayer && !this->IsType( idItemTeam::Type ) ) ) { if ( spawnArgs.GetBool( "spin" ) || (gameLocal.isMultiplayer && !this->IsType( idItemTeam::Type ) ) ) {
spin = true; spin = true;
BecomeActive( TH_THINK ); BecomeActive( TH_THINK );
} }
#else #else
if ( spawnArgs.GetBool( "spin" ) || gameLocal.isMultiplayer ) { if ( spawnArgs.GetBool( "spin" ) || gameLocal.isMultiplayer ) {
spin = true; spin = true;
@ -352,8 +352,8 @@ bool idItem::GiveToPlayer( idPlayer *player ) {
if ( spawnArgs.GetBool( "inv_carry" ) ) { if ( spawnArgs.GetBool( "inv_carry" ) ) {
return player->GiveInventoryItem( &spawnArgs ); return player->GiveInventoryItem( &spawnArgs );
} }
return player->GiveItem( this ); return player->GiveItem( this );
} }
@ -363,7 +363,7 @@ idItem::Pickup
================ ================
*/ */
bool idItem::Pickup( idPlayer *player ) { bool idItem::Pickup( idPlayer *player ) {
if ( !GiveToPlayer( player ) ) { if ( !GiveToPlayer( player ) ) {
return false; return false;
} }
@ -402,7 +402,7 @@ bool idItem::Pickup( idPlayer *player ) {
const char *sfx = spawnArgs.GetString( "fxRespawn" ); const char *sfx = spawnArgs.GetString( "fxRespawn" );
if ( sfx && *sfx ) { if ( sfx && *sfx ) {
PostEventSec( &EV_RespawnFx, respawn - 0.5f ); PostEventSec( &EV_RespawnFx, respawn - 0.5f );
} }
PostEventSec( &EV_RespawnItem, respawn ); PostEventSec( &EV_RespawnItem, respawn );
} else if ( !spawnArgs.GetBool( "inv_objective" ) && !no_respawn ) { } else if ( !spawnArgs.GetBool( "inv_objective" ) && !no_respawn ) {
// give some time for the pickup sound to play // give some time for the pickup sound to play
@ -677,12 +677,12 @@ idItemTeam::idItemTeam
=============== ===============
*/ */
idItemTeam::idItemTeam() { idItemTeam::idItemTeam() {
team = -1; team = -1;
carried = false; carried = false;
dropped = false; dropped = false;
lastDrop = 0; lastDrop = 0;
itemGlowHandle = -1; itemGlowHandle = -1;
skinDefault = NULL; skinDefault = NULL;
skinCarried = NULL; skinCarried = NULL;
@ -710,7 +710,7 @@ idItemTeam::Spawn
=============== ===============
*/ */
void idItemTeam::Spawn( void ) { void idItemTeam::Spawn( void ) {
team = spawnArgs.GetInt( "team" ); team = spawnArgs.GetInt( "team" );
returnOrigin = GetPhysics()->GetOrigin() + idVec3( 0, 0, 20 ); returnOrigin = GetPhysics()->GetOrigin() + idVec3( 0, 0, 20 );
returnAxis = GetPhysics()->GetAxis(); returnAxis = GetPhysics()->GetAxis();
@ -829,18 +829,18 @@ idItemTeam::Pickup
=============== ===============
*/ */
bool idItemTeam::Pickup( idPlayer *player ) { bool idItemTeam::Pickup( idPlayer *player ) {
if ( !gameLocal.mpGame.IsGametypeFlagBased() ) /* CTF */ if ( !gameLocal.mpGame.IsGametypeFlagBased() ) /* CTF */
return false; return false;
if ( gameLocal.mpGame.GetGameState() == idMultiplayerGame::WARMUP || if ( gameLocal.mpGame.GetGameState() == idMultiplayerGame::WARMUP ||
gameLocal.mpGame.GetGameState() == idMultiplayerGame::COUNTDOWN ) gameLocal.mpGame.GetGameState() == idMultiplayerGame::COUNTDOWN )
return false; return false;
// wait 2 seconds after drop before beeing picked up again // wait 2 seconds after drop before beeing picked up again
if ( lastDrop != 0 && (gameLocal.time - lastDrop) < spawnArgs.GetInt("pickupDelay", "500") ) if ( lastDrop != 0 && (gameLocal.time - lastDrop) < spawnArgs.GetInt("pickupDelay", "500") )
return false; return false;
if ( carried == false && player->team != this->team ) { if ( carried == false && player->team != this->team ) {
PostEventMS( &EV_TakeFlag, 0, player ); PostEventMS( &EV_TakeFlag, 0, player );
@ -864,10 +864,10 @@ idItemTeam::ClientReceiveEvent
=============== ===============
*/ */
bool idItemTeam::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { bool idItemTeam::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) {
gameLocal.DPrintf("ClientRecieveEvent: %i\n", event ); gameLocal.DPrintf("ClientRecieveEvent: %i\n", event );
switch ( event ) { switch ( event ) {
case EVENT_TAKEFLAG: { case EVENT_TAKEFLAG: {
idPlayer * player = static_cast<idPlayer *>(gameLocal.entities[ msg.ReadBits( GENTITYNUM_BITS ) ]); idPlayer * player = static_cast<idPlayer *>(gameLocal.entities[ msg.ReadBits( GENTITYNUM_BITS ) ]);
if ( player == NULL ) { if ( player == NULL ) {
gameLocal.Warning( "NULL player takes flag?\n" ); gameLocal.Warning( "NULL player takes flag?\n" );
@ -905,7 +905,7 @@ bool idItemTeam::ClientReceiveEvent( int event, int time, const idBitMsg &msg )
return true; return true;
}; };
return false; return false;
} }
/* /*
@ -982,7 +982,7 @@ void idItemTeam::PrivateReturn( void )
itemGlow.shaderParms[ SHADERPARM_BLUE ] = 0.0f; itemGlow.shaderParms[ SHADERPARM_BLUE ] = 0.0f;
itemGlow.shaderParms[ SHADERPARM_ALPHA ] = 0.0f; itemGlow.shaderParms[ SHADERPARM_ALPHA ] = 0.0f;
if ( itemGlowHandle != -1 ) if ( itemGlowHandle != -1 )
gameRenderWorld->UpdateLightDef( itemGlowHandle, &itemGlow );*/ gameRenderWorld->UpdateLightDef( itemGlowHandle, &itemGlow );*/
GetPhysics()->SetLinearVelocity( idVec3(0, 0, 0) ); GetPhysics()->SetLinearVelocity( idVec3(0, 0, 0) );
@ -995,7 +995,7 @@ idItemTeam::Event_TakeFlag
================ ================
*/ */
void idItemTeam::Event_TakeFlag( idPlayer * player ) { void idItemTeam::Event_TakeFlag( idPlayer * player ) {
gameLocal.DPrintf("Event_TakeFlag()!\n"); gameLocal.DPrintf("Event_TakeFlag()!\n");
if ( gameLocal.isServer ) { if ( gameLocal.isServer ) {
idBitMsg msg; idBitMsg msg;
@ -1044,14 +1044,14 @@ void idItemTeam::Event_TakeFlag( idPlayer * player ) {
SetSkin( skinCarried ); SetSkin( skinCarried );
UpdateVisuals(); UpdateVisuals();
UpdateGuis(); UpdateGuis();
if ( gameLocal.isServer ) { if ( gameLocal.isServer ) {
if ( team == 0 ) if ( team == 0 )
gameLocal.mpGame.player_red_flag = player->entityNumber; gameLocal.mpGame.player_red_flag = player->entityNumber;
else else
gameLocal.mpGame.player_blue_flag = player->entityNumber; gameLocal.mpGame.player_blue_flag = player->entityNumber;
} }
} }
/* /*
@ -1060,7 +1060,7 @@ idItemTeam::Event_DropFlag
================ ================
*/ */
void idItemTeam::Event_DropFlag( bool death ) { void idItemTeam::Event_DropFlag( bool death ) {
gameLocal.DPrintf("Event_DropFlag()!\n"); gameLocal.DPrintf("Event_DropFlag()!\n");
if ( gameLocal.isServer ) { if ( gameLocal.isServer ) {
idBitMsg msg; idBitMsg msg;
@ -1094,7 +1094,7 @@ void idItemTeam::Event_DropFlag( bool death ) {
// GetPhysics()->SetLinearVelocity( ( GetPhysics()->GetLinearVelocity() * GetBindMaster()->GetPhysics()->GetAxis() ) + GetBindMaster()->GetPhysics()->GetLinearVelocity() ); // GetPhysics()->SetLinearVelocity( ( GetPhysics()->GetLinearVelocity() * GetBindMaster()->GetPhysics()->GetAxis() ) + GetBindMaster()->GetPhysics()->GetLinearVelocity() );
if ( GetBindMaster() ) { if ( GetBindMaster() ) {
const idBounds bounds = GetPhysics()->GetBounds(); const idBounds bounds = GetPhysics()->GetBounds();
idVec3 origin = GetBindMaster()->GetPhysics()->GetOrigin() + idVec3(0, 0, ( bounds[1].z-bounds[0].z )*0.6f ); idVec3 origin = GetBindMaster()->GetPhysics()->GetOrigin() + idVec3(0, 0, ( bounds[1].z-bounds[0].z )*0.6f );
Unbind(); Unbind();
@ -1116,18 +1116,18 @@ void idItemTeam::Event_DropFlag( bool death ) {
thread->DelayedStart( 0 ); thread->DelayedStart( 0 );
} }
SetSkin( skinDefault ); SetSkin( skinDefault );
UpdateVisuals(); UpdateVisuals();
UpdateGuis(); UpdateGuis();
if ( gameLocal.isServer ) { if ( gameLocal.isServer ) {
if ( team == 0 ) if ( team == 0 )
gameLocal.mpGame.player_red_flag = -1; gameLocal.mpGame.player_red_flag = -1;
else else
gameLocal.mpGame.player_blue_flag = -1; gameLocal.mpGame.player_blue_flag = -1;
} }
} }
/* /*
@ -1136,7 +1136,7 @@ idItemTeam::Event_FlagReturn
================ ================
*/ */
void idItemTeam::Event_FlagReturn( idPlayer * player ) { void idItemTeam::Event_FlagReturn( idPlayer * player ) {
gameLocal.DPrintf("Event_FlagReturn()!\n"); gameLocal.DPrintf("Event_FlagReturn()!\n");
if ( gameLocal.isServer ) { if ( gameLocal.isServer ) {
ServerSendEvent( EVENT_FLAGRETURN, NULL, false, -1 ); ServerSendEvent( EVENT_FLAGRETURN, NULL, false, -1 );
@ -1166,15 +1166,15 @@ void idItemTeam::Event_FlagReturn( idPlayer * player ) {
} }
UpdateVisuals(); UpdateVisuals();
UpdateGuis(); UpdateGuis();
// Present(); // Present();
if ( gameLocal.isServer ) { if ( gameLocal.isServer ) {
if ( team == 0 ) if ( team == 0 )
gameLocal.mpGame.player_red_flag = -1; gameLocal.mpGame.player_red_flag = -1;
else else
gameLocal.mpGame.player_blue_flag = -1; gameLocal.mpGame.player_blue_flag = -1;
} }
} }
/* /*
@ -1215,16 +1215,16 @@ void idItemTeam::Event_FlagCapture( void ) {
} }
UpdateVisuals(); UpdateVisuals();
UpdateGuis(); UpdateGuis();
if ( gameLocal.isServer ) {
if ( team == 0 )
gameLocal.mpGame.player_red_flag = -1;
else
gameLocal.mpGame.player_blue_flag = -1;
}
if ( gameLocal.isServer ) {
if ( team == 0 )
gameLocal.mpGame.player_red_flag = -1;
else
gameLocal.mpGame.player_blue_flag = -1;
}
} }
/* /*
@ -1287,15 +1287,15 @@ void idItemTeam::ReadFromSnapshot( const idBitMsgDelta &msg ) {
ReadBindFromSnapshot( msg ); ReadBindFromSnapshot( msg );
if ( msg.HasChanged() ) if ( msg.HasChanged() )
{ {
UpdateGuis(); UpdateGuis();
if ( carried == true ) if ( carried == true )
SetSkin( skinCarried ); SetSkin( skinCarried );
else else
SetSkin( skinDefault ); SetSkin( skinDefault );
} }
idMoveableItem::ReadFromSnapshot( msg ); idMoveableItem::ReadFromSnapshot( msg );
} }
@ -1308,21 +1308,21 @@ Update all client's huds wrt the flag status.
================ ================
*/ */
void idItemTeam::UpdateGuis( void ) { void idItemTeam::UpdateGuis( void ) {
idPlayer *player; idPlayer *player;
for ( int i = 0; i < gameLocal.numClients; i++ ) { for ( int i = 0; i < gameLocal.numClients; i++ ) {
player = static_cast<idPlayer *>( gameLocal.entities[ i ] ); player = static_cast<idPlayer *>( gameLocal.entities[ i ] );
if ( player == NULL || player->hud == NULL ) if ( player == NULL || player->hud == NULL )
continue; continue;
player->hud->SetStateInt( "red_flagstatus", gameLocal.mpGame.GetFlagStatus( 0 ) ); player->hud->SetStateInt( "red_flagstatus", gameLocal.mpGame.GetFlagStatus( 0 ) );
player->hud->SetStateInt( "blue_flagstatus", gameLocal.mpGame.GetFlagStatus( 1 ) ); player->hud->SetStateInt( "blue_flagstatus", gameLocal.mpGame.GetFlagStatus( 1 ) );
player->hud->SetStateInt( "red_team_score", gameLocal.mpGame.GetFlagPoints( 0 ) ); player->hud->SetStateInt( "red_team_score", gameLocal.mpGame.GetFlagPoints( 0 ) );
player->hud->SetStateInt( "blue_team_score", gameLocal.mpGame.GetFlagPoints( 1 ) ); player->hud->SetStateInt( "blue_team_score", gameLocal.mpGame.GetFlagPoints( 1 ) );
} }
} }
@ -1479,7 +1479,7 @@ void idObjective::Event_Trigger( idEntity *activator ) {
//Pickup( player ); //Pickup( player );
if ( spawnArgs.GetString( "inv_objective", NULL ) ) { if ( spawnArgs.GetString( "inv_objective", NULL ) ) {
if ( player && player->hud ) { if ( player && player->hud ) {
idStr shotName = gameLocal.GetMapName(); idStr shotName = gameLocal.GetMapName();
shotName.StripFileExtension(); shotName.StripFileExtension();
shotName += "/"; shotName += "/";
@ -1598,7 +1598,7 @@ bool idPDAItem::GiveToPlayer(idPlayer *player) {
=============================================================================== ===============================================================================
idMoveableItem idMoveableItem
=============================================================================== ===============================================================================
*/ */
@ -1641,7 +1641,7 @@ idMoveableItem::Save
================ ================
*/ */
void idMoveableItem::Save( idSaveGame *savefile ) const { void idMoveableItem::Save( idSaveGame *savefile ) const {
savefile->WriteStaticObject( physicsObj ); savefile->WriteStaticObject( physicsObj );
savefile->WriteClipModel( trigger ); savefile->WriteClipModel( trigger );
@ -1757,7 +1757,7 @@ void idMoveableItem::Think( void ) {
// update trigger position // update trigger position
trigger->Link( gameLocal.clip, this, 0, GetPhysics()->GetOrigin(), mat3_identity ); trigger->Link( gameLocal.clip, this, 0, GetPhysics()->GetOrigin(), mat3_identity );
} }
if ( thinkFlags & TH_UPDATEPARTICLES ) { if ( thinkFlags & TH_UPDATEPARTICLES ) {
if ( !gameLocal.smokeParticles->EmitSmoke( smoke, smokeTime, gameLocal.random.CRandomFloat(), GetPhysics()->GetOrigin(), GetPhysics()->GetAxis(), timeGroup /*_D3XP*/ ) ) { if ( !gameLocal.smokeParticles->EmitSmoke( smoke, smokeTime, gameLocal.random.CRandomFloat(), GetPhysics()->GetOrigin(), GetPhysics()->GetAxis(), timeGroup /*_D3XP*/ ) ) {
#ifdef CTF #ifdef CTF
@ -1810,7 +1810,7 @@ bool idMoveableItem::Pickup( idPlayer *player ) {
bool ret = idItem::Pickup( player ); bool ret = idItem::Pickup( player );
if ( ret ) { if ( ret ) {
trigger->SetContents( 0 ); trigger->SetContents( 0 );
} }
return ret; return ret;
} }
@ -2034,7 +2034,7 @@ idItemRemover::RemoveItem
*/ */
void idItemRemover::RemoveItem( idPlayer *player ) { void idItemRemover::RemoveItem( idPlayer *player ) {
const char *remove; const char *remove;
remove = spawnArgs.GetString( "remove" ); remove = spawnArgs.GetString( "remove" );
player->RemoveInventoryItem( remove ); player->RemoveInventoryItem( remove );
} }
@ -2115,7 +2115,7 @@ void idObjectiveComplete::Event_Trigger( idEntity *activator ) {
RemoveItem( player ); RemoveItem( player );
if ( spawnArgs.GetString( "inv_objective", NULL ) ) { if ( spawnArgs.GetString( "inv_objective", NULL ) ) {
if ( player->hud ) { if ( player->hud ) {
player->hud->SetStateString( "objective", "2"); player->hud->SetStateString( "objective", "2");
player->hud->SetStateString( "objectivetext", spawnArgs.GetString( "objectivetext" ) ); player->hud->SetStateString( "objectivetext", spawnArgs.GetString( "objectivetext" ) );

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -60,9 +60,9 @@ public:
EVENT_RESPAWN, EVENT_RESPAWN,
EVENT_RESPAWNFX, EVENT_RESPAWNFX,
#ifdef CTF #ifdef CTF
EVENT_TAKEFLAG, EVENT_TAKEFLAG,
EVENT_DROPFLAG, EVENT_DROPFLAG,
EVENT_FLAGRETURN, EVENT_FLAGRETURN,
EVENT_FLAGCAPTURE, EVENT_FLAGCAPTURE,
#endif #endif
EVENT_MAXEVENTS EVENT_MAXEVENTS
@ -176,7 +176,7 @@ public:
virtual void WriteToSnapshot( idBitMsgDelta &msg ) const; virtual void WriteToSnapshot( idBitMsgDelta &msg ) const;
virtual void ReadFromSnapshot( const idBitMsgDelta &msg ); virtual void ReadFromSnapshot( const idBitMsgDelta &msg );
#ifdef CTF #ifdef CTF
protected: protected:
#else #else
private: private:
@ -203,14 +203,14 @@ private:
class idItemTeam : public idMoveableItem { class idItemTeam : public idMoveableItem {
public: public:
CLASS_PROTOTYPE( idItemTeam ); CLASS_PROTOTYPE( idItemTeam );
idItemTeam(); idItemTeam();
virtual ~idItemTeam(); virtual ~idItemTeam();
void Spawn(); void Spawn();
virtual bool Pickup( idPlayer *player ); virtual bool Pickup( idPlayer *player );
virtual bool ClientReceiveEvent( int event, int time, const idBitMsg &msg ); virtual bool ClientReceiveEvent( int event, int time, const idBitMsg &msg );
virtual void Think(void ); virtual void Think(void );
void Drop( bool death = false ); // was the drop caused by death of carrier? void Drop( bool death = false ); // was the drop caused by death of carrier?
@ -225,8 +225,8 @@ public:
virtual void ReadFromSnapshot( const idBitMsgDelta &msg ); virtual void ReadFromSnapshot( const idBitMsgDelta &msg );
public: public:
int team; int team;
// TODO : turn this into a state : // TODO : turn this into a state :
bool carried; // is it beeing carried by a player? bool carried; // is it beeing carried by a player?
bool dropped; // was it dropped? bool dropped; // was it dropped?
@ -243,8 +243,8 @@ private:
const function_t * scriptReturned; const function_t * scriptReturned;
const function_t * scriptCaptured; const function_t * scriptCaptured;
renderLight_t itemGlow; // Used by flags when they are picked up renderLight_t itemGlow; // Used by flags when they are picked up
int itemGlowHandle; int itemGlowHandle;
int lastNuggetDrop; int lastNuggetDrop;
const char * nuggetName; const char * nuggetName;
@ -252,7 +252,7 @@ private:
private: private:
void Event_TakeFlag( idPlayer * player ); void Event_TakeFlag( idPlayer * player );
void Event_DropFlag( bool death ); void Event_DropFlag( bool death );
void Event_FlagReturn( idPlayer * player = NULL ); void Event_FlagReturn( idPlayer * player = NULL );
void Event_FlagCapture( void ); void Event_FlagCapture( void );
@ -260,7 +260,7 @@ private:
function_t * LoadScript( char * script ); function_t * LoadScript( char * script );
void SpawnNugget( idVec3 pos ); void SpawnNugget( idVec3 pos );
void UpdateGuis( void ); void UpdateGuis( void );
}; };
#endif #endif

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -123,10 +123,10 @@ void idGameEdit::ParseSpawnArgsToRenderLight( const idDict *args, renderLight_t
idMat3 mat; idMat3 mat;
if ( !args->GetMatrix( "light_rotation", "1 0 0 0 1 0 0 0 1", mat ) ) { if ( !args->GetMatrix( "light_rotation", "1 0 0 0 1 0 0 0 1", mat ) ) {
if ( !args->GetMatrix( "rotation", "1 0 0 0 1 0 0 0 1", mat ) ) { if ( !args->GetMatrix( "rotation", "1 0 0 0 1 0 0 0 1", mat ) ) {
args->GetFloat( "angle", "0", angles[ 1 ] ); args->GetFloat( "angle", "0", angles[ 1 ] );
angles[ 0 ] = 0; angles[ 0 ] = 0;
angles[ 1 ] = idMath::AngleNormalize360( angles[ 1 ] ); angles[ 1 ] = idMath::AngleNormalize360( angles[ 1 ] );
angles[ 2 ] = 0; angles[ 2 ] = 0;
mat = angles.ToMat3(); mat = angles.ToMat3();
} }
} }
@ -228,7 +228,7 @@ archives object for save game file
*/ */
void idLight::Save( idSaveGame *savefile ) const { void idLight::Save( idSaveGame *savefile ) const {
savefile->WriteRenderLight( renderLight ); savefile->WriteRenderLight( renderLight );
savefile->WriteBool( renderLight.prelightModel != NULL ); savefile->WriteBool( renderLight.prelightModel != NULL );
savefile->WriteVec3( localLightOrigin ); savefile->WriteVec3( localLightOrigin );
@ -357,12 +357,12 @@ void idLight::Spawn( void ) {
} }
#ifdef CTF #ifdef CTF
// Midnight CTF // Midnight CTF
if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") && !spawnArgs.GetBool("midnight_override") ) { if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") && !spawnArgs.GetBool("midnight_override") ) {
Off(); Off();
} }
#endif #endif
health = spawnArgs.GetInt( "health", "0" ); health = spawnArgs.GetInt( "health", "0" );
spawnArgs.GetString( "broken", "", brokenModel ); spawnArgs.GetString( "broken", "", brokenModel );
spawnArgs.GetBool( "break", "0", breakOnTrigger ); spawnArgs.GetBool( "break", "0", breakOnTrigger );
@ -390,7 +390,7 @@ void idLight::Spawn( void ) {
int pos; int pos;
needBroken = false; needBroken = false;
pos = model.Find( "." ); pos = model.Find( "." );
if ( pos < 0 ) { if ( pos < 0 ) {
pos = model.Length(); pos = model.Length();
@ -403,7 +403,7 @@ void idLight::Spawn( void ) {
brokenModel += &model[ pos ]; brokenModel += &model[ pos ];
} }
} }
// make sure the model gets cached // make sure the model gets cached
if ( !renderModelManager->CheckModel( brokenModel ) ) { if ( !renderModelManager->CheckModel( brokenModel ) ) {
if ( needBroken ) { if ( needBroken ) {
@ -414,7 +414,7 @@ void idLight::Spawn( void ) {
} }
GetPhysics()->SetContents( spawnArgs.GetBool( "nonsolid" ) ? 0 : CONTENTS_SOLID ); GetPhysics()->SetContents( spawnArgs.GetBool( "nonsolid" ) ? 0 : CONTENTS_SOLID );
// make sure the collision model gets cached // make sure the collision model gets cached
idClipModel::CheckModel( brokenModel ); idClipModel::CheckModel( brokenModel );
} }
@ -1095,7 +1095,7 @@ void idLight::ReadFromSnapshot( const idBitMsgDelta &msg ) {
} }
} }
UnpackColor( msg.ReadLong(), baseColor ); UnpackColor( msg.ReadLong(), baseColor );
// lightParentEntityNum = msg.ReadBits( GENTITYNUM_BITS ); // lightParentEntityNum = msg.ReadBits( GENTITYNUM_BITS );
/* // only helps prediction /* // only helps prediction
UnpackColor( msg.ReadLong(), fadeFrom ); UnpackColor( msg.ReadLong(), fadeFrom );

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -419,7 +419,7 @@ void idPathCorner::Event_RandomPath( void ) {
=============================================================================== ===============================================================================
idDamagable idDamagable
=============================================================================== ===============================================================================
*/ */
@ -469,9 +469,9 @@ void idDamagable::Spawn( void ) {
idStr broken; idStr broken;
health = spawnArgs.GetInt( "health", "5" ); health = spawnArgs.GetInt( "health", "5" );
spawnArgs.GetInt( "count", "1", count ); spawnArgs.GetInt( "count", "1", count );
nextTriggerTime = 0; nextTriggerTime = 0;
// make sure the model gets cached // make sure the model gets cached
spawnArgs.GetString( "broken", "", broken ); spawnArgs.GetString( "broken", "", broken );
if ( broken.Length() && !renderModelManager->CheckModel( broken ) ) { if ( broken.Length() && !renderModelManager->CheckModel( broken ) ) {
@ -492,7 +492,7 @@ void idDamagable::BecomeBroken( idEntity *activator ) {
int numStates; int numStates;
int cycle; int cycle;
float wait; float wait;
if ( gameLocal.time < nextTriggerTime ) { if ( gameLocal.time < nextTriggerTime ) {
return; return;
} }
@ -605,7 +605,7 @@ void idDamagable::Event_RestoreDamagable( void ) {
=============================================================================== ===============================================================================
idExplodable idExplodable
=============================================================================== ===============================================================================
*/ */
@ -655,7 +655,7 @@ void idExplodable::Event_Explode( idEntity *activator ) {
=============================================================================== ===============================================================================
idSpring idSpring
=============================================================================== ===============================================================================
*/ */
@ -692,7 +692,7 @@ void idSpring::Think( void ) {
origin = ent2->GetPhysics()->GetOrigin(); origin = ent2->GetPhysics()->GetOrigin();
end = origin + p2 * axis; end = origin + p2 * axis;
} }
gameRenderWorld->DebugLine( idVec4(1, 1, 0, 1), start, end, 0, true ); gameRenderWorld->DebugLine( idVec4(1, 1, 0, 1), start, end, 0, true );
} }
@ -760,7 +760,7 @@ void idSpring::Spawn( void ) {
=============================================================================== ===============================================================================
idForceField idForceField
=============================================================================== ===============================================================================
*/ */
@ -998,7 +998,7 @@ void idAnimated::Spawn( void ) {
float wait; float wait;
const char *joint; const char *joint;
joint = spawnArgs.GetString( "sound_bone", "origin" ); joint = spawnArgs.GetString( "sound_bone", "origin" );
soundJoint = animator.GetJointHandle( joint ); soundJoint = animator.GetJointHandle( joint );
if ( soundJoint == INVALID_JOINT ) { if ( soundJoint == INVALID_JOINT ) {
gameLocal.Warning( "idAnimated '%s' at (%s): cannot find joint '%s' for sound playback", name.c_str(), GetPhysics()->GetOrigin().ToString(0), joint ); gameLocal.Warning( "idAnimated '%s' at (%s): cannot find joint '%s' for sound playback", name.c_str(), GetPhysics()->GetOrigin().ToString(0), joint );
@ -1047,7 +1047,7 @@ void idAnimated::Spawn( void ) {
animator.CycleAnim( ANIMCHANNEL_ALL, anim2, gameLocal.time, 0 ); animator.CycleAnim( ANIMCHANNEL_ALL, anim2, gameLocal.time, 0 );
} else if ( anim ) { } else if ( anim ) {
// init joints to the first frame of the animation // init joints to the first frame of the animation
animator.SetFrame( ANIMCHANNEL_ALL, anim, 1, gameLocal.time, 0 ); animator.SetFrame( ANIMCHANNEL_ALL, anim, 1, gameLocal.time, 0 );
if ( !num_anims ) { if ( !num_anims ) {
blendFrames = 0; blendFrames = 0;
@ -1108,7 +1108,7 @@ bool idAnimated::StartRagdoll( void ) {
// start using the AF // start using the AF
af.StartFromCurrentPose( spawnArgs.GetInt( "velocityTime", "0" ) ); af.StartFromCurrentPose( spawnArgs.GetInt( "velocityTime", "0" ) );
return true; return true;
} }
@ -1151,7 +1151,7 @@ void idAnimated::PlayNextAnim( void ) {
if ( g_debugCinematic.GetBool() ) { if ( g_debugCinematic.GetBool() ) {
gameLocal.Printf( "%d: '%s' start anim '%s'\n", gameLocal.framenum, GetName(), animname ); gameLocal.Printf( "%d: '%s' start anim '%s'\n", gameLocal.framenum, GetName(), animname );
} }
spawnArgs.GetInt( "cycle", "1", cycle ); spawnArgs.GetInt( "cycle", "1", cycle );
if ( ( current_anim_index == num_anims ) && spawnArgs.GetBool( "loop_last_anim" ) ) { if ( ( current_anim_index == num_anims ) && spawnArgs.GetBool( "loop_last_anim" ) ) {
cycle = -1; cycle = -1;
@ -1303,7 +1303,7 @@ void idAnimated::Event_LaunchMissilesUpdate( int launchjoint, int targetjoint, i
animator.GetJointTransform( ( jointHandle_t )launchjoint, gameLocal.time, launchPos, axis ); animator.GetJointTransform( ( jointHandle_t )launchjoint, gameLocal.time, launchPos, axis );
launchPos = renderEntity.origin + launchPos * renderEntity.axis; launchPos = renderEntity.origin + launchPos * renderEntity.axis;
animator.GetJointTransform( ( jointHandle_t )targetjoint, gameLocal.time, targetPos, axis ); animator.GetJointTransform( ( jointHandle_t )targetjoint, gameLocal.time, targetPos, axis );
targetPos = renderEntity.origin + targetPos * renderEntity.axis; targetPos = renderEntity.origin + targetPos * renderEntity.axis;
@ -1595,7 +1595,7 @@ void idStaticEntity::Event_Activate( idEntity *activator ) {
renderEntity.shaderParms[ SHADERPARM_TIMEOFFSET ] = -MS2SEC( spawnTime ); renderEntity.shaderParms[ SHADERPARM_TIMEOFFSET ] = -MS2SEC( spawnTime );
renderEntity.shaderParms[5] = active; renderEntity.shaderParms[5] = active;
// this change should be a good thing, it will automatically turn on // this change should be a good thing, it will automatically turn on
// lights etc.. when triggered so that does not have to be specifically done // lights etc.. when triggered so that does not have to be specifically done
// with trigger parms.. it MIGHT break things so need to keep an eye on it // with trigger parms.. it MIGHT break things so need to keep an eye on it
renderEntity.shaderParms[ SHADERPARM_MODE ] = ( renderEntity.shaderParms[ SHADERPARM_MODE ] ) ? 0.0f : 1.0f; renderEntity.shaderParms[ SHADERPARM_MODE ] = ( renderEntity.shaderParms[ SHADERPARM_MODE ] ) ? 0.0f : 1.0f;
@ -2314,7 +2314,7 @@ void idBeam::Event_Activate( idEntity *activator ) {
if ( IsHidden() ) { if ( IsHidden() ) {
Show(); Show();
} else { } else {
Hide(); Hide();
} }
} }
@ -2467,7 +2467,7 @@ void idShaking::Spawn( void ) {
physicsObj.SetAxis( GetPhysics()->GetAxis() ); physicsObj.SetAxis( GetPhysics()->GetAxis() );
physicsObj.SetClipMask( MASK_SOLID ); physicsObj.SetClipMask( MASK_SOLID );
SetPhysics( &physicsObj ); SetPhysics( &physicsObj );
active = false; active = false;
if ( !spawnArgs.GetBool( "start_off" ) ) { if ( !spawnArgs.GetBool( "start_off" ) ) {
BeginShaking(); BeginShaking();
@ -2596,7 +2596,7 @@ idEarthQuake::Event_Activate
================ ================
*/ */
void idEarthQuake::Event_Activate( idEntity *activator ) { void idEarthQuake::Event_Activate( idEntity *activator ) {
if ( nextTriggerTime > gameLocal.time ) { if ( nextTriggerTime > gameLocal.time ) {
return; return;
} }
@ -2920,7 +2920,7 @@ void idFuncRadioChatter::Event_Activate( idEntity *activator ) {
const char *sound; const char *sound;
const idSoundShader *shader; const idSoundShader *shader;
int length; int length;
if ( activator->IsType( idPlayer::Type ) ) { if ( activator->IsType( idPlayer::Type ) ) {
player = static_cast<idPlayer *>( activator ); player = static_cast<idPlayer *>( activator );
} else { } else {
@ -2935,7 +2935,7 @@ void idFuncRadioChatter::Event_Activate( idEntity *activator ) {
player->StartSoundShader( shader, SND_CHANNEL_RADIO, SSF_GLOBAL, false, &length ); player->StartSoundShader( shader, SND_CHANNEL_RADIO, SSF_GLOBAL, false, &length );
time = MS2SEC( length + 150 ); time = MS2SEC( length + 150 );
} }
// we still put the hud up because this is used with no sound on // we still put the hud up because this is used with no sound on
// certain frame commands when the chatter is triggered // certain frame commands when the chatter is triggered
PostEventSec( &EV_ResetRadioHud, time, player ); PostEventSec( &EV_ResetRadioHud, time, player );
@ -2973,8 +2973,8 @@ idPhantomObjects::idPhantomObjects
idPhantomObjects::idPhantomObjects() { idPhantomObjects::idPhantomObjects() {
target = NULL; target = NULL;
end_time = 0; end_time = 0;
throw_time = 0.0f; throw_time = 0.0f;
shake_time = 0.0f; shake_time = 0.0f;
shake_ang.Zero(); shake_ang.Zero();
speed = 0.0f; speed = 0.0f;
min_wait = 0; min_wait = 0;
@ -3025,8 +3025,8 @@ void idPhantomObjects::Restore( idRestoreGame *savefile ) {
savefile->ReadInt( min_wait ); savefile->ReadInt( min_wait );
savefile->ReadInt( max_wait ); savefile->ReadInt( max_wait );
target.Restore( savefile ); target.Restore( savefile );
savefile->ReadInt( num ); savefile->ReadInt( num );
targetTime.SetGranularity( 1 ); targetTime.SetGranularity( 1 );
targetTime.SetNum( num ); targetTime.SetNum( num );
lastTargetPos.SetGranularity( 1 ); lastTargetPos.SetGranularity( 1 );
@ -3087,7 +3087,7 @@ void idPhantomObjects::Event_Activate( idEntity *activator ) {
} else { } else {
target = static_cast<idActor *>( activator ); target = static_cast<idActor *>( activator );
} }
end_time = gameLocal.time + SEC2MS( spawnArgs.GetFloat( "end_time", "0" ) ); end_time = gameLocal.time + SEC2MS( spawnArgs.GetFloat( "end_time", "0" ) );
targetTime.SetNum( targets.Num() ); targetTime.SetNum( targets.Num() );
@ -3095,7 +3095,7 @@ void idPhantomObjects::Event_Activate( idEntity *activator ) {
const idVec3 &toPos = target.GetEntity()->GetEyePosition(); const idVec3 &toPos = target.GetEntity()->GetEyePosition();
// calculate the relative times of all the objects // calculate the relative times of all the objects
time = 0.0f; time = 0.0f;
for( i = 0; i < targetTime.Num(); i++ ) { for( i = 0; i < targetTime.Num(); i++ ) {
targetTime[ i ] = SEC2MS( time ); targetTime[ i ] = SEC2MS( time );
@ -3153,7 +3153,7 @@ void idPhantomObjects::Think( void ) {
if ( !ent ) { if ( !ent ) {
continue; continue;
} }
if ( ent->fl.hidden ) { if ( ent->fl.hidden ) {
// don't throw hidden objects // don't throw hidden objects
continue; continue;
@ -3180,7 +3180,7 @@ void idPhantomObjects::Think( void ) {
} }
if ( time < 0.0f ) { if ( time < 0.0f ) {
idAI::PredictTrajectory( entPhys->GetOrigin(), lastTargetPos[ i ], speed, entPhys->GetGravity(), idAI::PredictTrajectory( entPhys->GetOrigin(), lastTargetPos[ i ], speed, entPhys->GetGravity(),
entPhys->GetClipModel(), entPhys->GetClipMask(), 256.0f, ent, targetEnt, ai_debugTrajectory.GetBool() ? 1 : 0, vel ); entPhys->GetClipModel(), entPhys->GetClipMask(), 256.0f, ent, targetEnt, ai_debugTrajectory.GetBool() ? 1 : 0, vel );
vel *= speed; vel *= speed;
entPhys->SetLinearVelocity( vel ); entPhys->SetLinearVelocity( vel );
@ -3285,7 +3285,7 @@ void idShockwave::Restore( idRestoreGame *savefile ) {
savefile->ReadFloat( height ); savefile->ReadFloat( height );
savefile->ReadBool( playerDamaged ); savefile->ReadBool( playerDamaged );
savefile->ReadFloat( playerDamageSize ); savefile->ReadFloat( playerDamageSize );
} }
/* /*
@ -3347,13 +3347,13 @@ void idShockwave::Think() {
} else { } else {
zVal = height/2.0f; zVal = height/2.0f;
} }
//Expand in a sphere //Expand in a sphere
end = pos + idVec3( newSize, newSize, zVal ); end = pos + idVec3( newSize, newSize, zVal );
idBounds bounds( end ); idBounds bounds( end );
end = pos + idVec3( -newSize, -newSize, -zVal ); end = pos + idVec3( -newSize, -newSize, -zVal );
bounds.AddPoint( end ); bounds.AddPoint( end );
if(g_debugShockwave.GetBool()) { if(g_debugShockwave.GetBool()) {
gameRenderWorld->DebugBounds(colorRed, bounds, vec3_origin); gameRenderWorld->DebugBounds(colorRed, bounds, vec3_origin);
} }
@ -3380,7 +3380,7 @@ void idShockwave::Think() {
if(ent->IsType( idPlayer::Type )) { if(ent->IsType( idPlayer::Type )) {
if(ent->GetPhysics()->GetAbsBounds().IntersectsBounds(bounds)) { if(ent->GetPhysics()->GetAbsBounds().IntersectsBounds(bounds)) {
//For player damage we check the current radius and a specified player damage ring size //For player damage we check the current radius and a specified player damage ring size
if ( dist <= newSize && dist > newSize-playerDamageSize ) { if ( dist <= newSize && dist > newSize-playerDamageSize ) {
@ -3624,7 +3624,7 @@ void idFuncMountedWeapon::Spawn( void ) {
spawnArgs.GetString( "snd_fire", "", fireSound ); spawnArgs.GetString( "snd_fire", "", fireSound );
soundFireWeapon = declManager->FindSound( fireSound ); soundFireWeapon = declManager->FindSound( fireSound );
PostEventMS( &EV_PostSpawn, 0 ); PostEventMS( &EV_PostSpawn, 0 );
} }
void idFuncMountedWeapon::Think( void ) { void idFuncMountedWeapon::Think( void ) {

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -97,7 +97,7 @@ private:
Bind to a mover to have the mover activate a trigger as it moves. Bind to a mover to have the mover activate a trigger as it moves.
When target by triggers, activating the trigger will toggle the When target by triggers, activating the trigger will toggle the
activator on and off. Check "start_off" to have it spawn disabled. activator on and off. Check "start_off" to have it spawn disabled.
=============================================================================== ===============================================================================
*/ */
@ -288,7 +288,7 @@ private:
void PlayNextAnim( void ); void PlayNextAnim( void );
void Event_Activate( idEntity *activator ); void Event_Activate( idEntity *activator );
void Event_Start( void ); void Event_Start( void );
void Event_StartRagdoll( void ); void Event_StartRagdoll( void );
void Event_AnimDone( int animIndex ); void Event_AnimDone( int animIndex );
@ -486,7 +486,7 @@ public:
void Save( idSaveGame *savefile ) const; void Save( idSaveGame *savefile ) const;
void Restore( idRestoreGame *savefile ); void Restore( idRestoreGame *savefile );
void Event_Activate( idEntity *activator ); void Event_Activate( idEntity *activator );
private: private:
qhandle_t portal; qhandle_t portal;
@ -606,7 +606,7 @@ private:
class idEarthQuake : public idEntity { class idEarthQuake : public idEntity {
public: public:
CLASS_PROTOTYPE( idEarthQuake ); CLASS_PROTOTYPE( idEarthQuake );
idEarthQuake(); idEarthQuake();
void Spawn( void ); void Spawn( void );
@ -641,7 +641,7 @@ private:
class idFuncPortal : public idEntity { class idFuncPortal : public idEntity {
public: public:
CLASS_PROTOTYPE( idFuncPortal ); CLASS_PROTOTYPE( idFuncPortal );
idFuncPortal(); idFuncPortal();
void Spawn( void ); void Spawn( void );
@ -667,7 +667,7 @@ private:
class idFuncAASPortal : public idEntity { class idFuncAASPortal : public idEntity {
public: public:
CLASS_PROTOTYPE( idFuncAASPortal ); CLASS_PROTOTYPE( idFuncAASPortal );
idFuncAASPortal(); idFuncAASPortal();
void Spawn( void ); void Spawn( void );
@ -692,7 +692,7 @@ private:
class idFuncAASObstacle : public idEntity { class idFuncAASObstacle : public idEntity {
public: public:
CLASS_PROTOTYPE( idFuncAASObstacle ); CLASS_PROTOTYPE( idFuncAASObstacle );
idFuncAASObstacle(); idFuncAASObstacle();
void Spawn( void ); void Spawn( void );
@ -744,7 +744,7 @@ private:
class idPhantomObjects : public idEntity { class idPhantomObjects : public idEntity {
public: public:
CLASS_PROTOTYPE( idPhantomObjects ); CLASS_PROTOTYPE( idPhantomObjects );
idPhantomObjects(); idPhantomObjects();
void Spawn( void ); void Spawn( void );
@ -834,7 +834,7 @@ private:
int harc; int harc;
int varc; int varc;
void Event_Touch( idEntity *other, trace_t *trace ); void Event_Touch( idEntity *other, trace_t *trace );
void Event_Activate( idEntity *activator ); void Event_Activate( idEntity *activator );
public: public:

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -35,7 +35,7 @@ If you have questions concerning this license or the applicable additional terms
=============================================================================== ===============================================================================
idMoveable idMoveable
=============================================================================== ===============================================================================
*/ */
@ -556,7 +556,7 @@ void idMoveable::Event_Activate( idEntity *activator ) {
Show(); Show();
if ( !spawnArgs.GetInt( "notPushable" ) ) { if ( !spawnArgs.GetInt( "notPushable" ) ) {
physicsObj.EnableImpact(); physicsObj.EnableImpact();
} }
physicsObj.Activate(); physicsObj.Activate();
@ -622,7 +622,7 @@ void idMoveable::Event_EnableDamage( float enable ) {
=============================================================================== ===============================================================================
idBarrel idBarrel
=============================================================================== ===============================================================================
*/ */
@ -1155,7 +1155,7 @@ void idExplodingBarrel::Killed( idEntity *inflictor, idEntity *attacker, int dam
msg.Init( msgBuf, sizeof( msgBuf ) ); msg.Init( msgBuf, sizeof( msgBuf ) );
msg.WriteLong( gameLocal.time ); msg.WriteLong( gameLocal.time );
ServerSendEvent( EVENT_EXPLODE, &msg, false, -1 ); ServerSendEvent( EVENT_EXPLODE, &msg, false, -1 );
} }
} }
// do this before applying radius damage so the ent can trace to any damagable ents nearby // do this before applying radius damage so the ent can trace to any damagable ents nearby
@ -1168,7 +1168,7 @@ void idExplodingBarrel::Killed( idEntity *inflictor, idEntity *attacker, int dam
} }
ExplodingEffects( ); ExplodingEffects( );
//FIXME: need to precache all the debris stuff here and in the projectiles //FIXME: need to precache all the debris stuff here and in the projectiles
const idKeyValue *kv = spawnArgs.MatchPrefix( "def_debris" ); const idKeyValue *kv = spawnArgs.MatchPrefix( "def_debris" );
// bool first = true; // bool first = true;
@ -1198,7 +1198,7 @@ void idExplodingBarrel::Killed( idEntity *inflictor, idEntity *attacker, int dam
debris->Launch(); debris->Launch();
debris->GetRenderEntity()->shaderParms[ SHADERPARM_TIME_OF_DEATH ] = ( gameLocal.time + 1500 ) * 0.001f; debris->GetRenderEntity()->shaderParms[ SHADERPARM_TIME_OF_DEATH ] = ( gameLocal.time + 1500 ) * 0.001f;
debris->UpdateVisuals(); debris->UpdateVisuals();
} }
kv = spawnArgs.MatchPrefix( "def_debris", kv ); kv = spawnArgs.MatchPrefix( "def_debris", kv );
} }
@ -1224,7 +1224,7 @@ void idExplodingBarrel::Killed( idEntity *inflictor, idEntity *attacker, int dam
idExplodingBarrel::Damage idExplodingBarrel::Damage
================ ================
*/ */
void idExplodingBarrel::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, void idExplodingBarrel::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir,
const char *damageDefName, const float damageScale, const int location ) { const char *damageDefName, const float damageScale, const int location ) {
const idDict *damageDef = gameLocal.FindEntityDefDict( damageDefName ); const idDict *damageDef = gameLocal.FindEntityDefDict( damageDefName );

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -167,7 +167,7 @@ public:
#endif #endif
virtual void Think( void ); virtual void Think( void );
virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir,
const char *damageDefName, const float damageScale, const int location ); const char *damageDefName, const float damageScale, const int location );
virtual void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ); virtual void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location );

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms
// _D3XP : rename all gameLocal.time to gameLocal.slow.time for merge! // _D3XP : rename all gameLocal.time to gameLocal.slow.time for merge!
// a mover will update any gui entities in it's target list with // a mover will update any gui entities in it's target list with
// a key/val pair of "mover" "state" from below.. guis can represent // a key/val pair of "mover" "state" from below.. guis can represent
// realtime info like this // realtime info like this
// binary only // binary only
@ -174,7 +174,7 @@ void idMover::Save( idSaveGame *savefile ) const {
savefile->WriteInt( move.movetime ); savefile->WriteInt( move.movetime );
savefile->WriteInt( move.deceleration ); savefile->WriteInt( move.deceleration );
savefile->WriteVec3( move.dir ); savefile->WriteVec3( move.dir );
savefile->WriteInt( rot.stage ); savefile->WriteInt( rot.stage );
savefile->WriteInt( rot.acceleration ); savefile->WriteInt( rot.acceleration );
savefile->WriteInt( rot.movetime ); savefile->WriteInt( rot.movetime );
@ -182,7 +182,7 @@ void idMover::Save( idSaveGame *savefile ) const {
savefile->WriteFloat( rot.rot.pitch ); savefile->WriteFloat( rot.rot.pitch );
savefile->WriteFloat( rot.rot.yaw ); savefile->WriteFloat( rot.rot.yaw );
savefile->WriteFloat( rot.rot.roll ); savefile->WriteFloat( rot.rot.roll );
savefile->WriteInt( move_thread ); savefile->WriteInt( move_thread );
savefile->WriteInt( rotate_thread ); savefile->WriteInt( rotate_thread );
@ -243,7 +243,7 @@ void idMover::Restore( idRestoreGame *savefile ) {
savefile->ReadInt( move.movetime ); savefile->ReadInt( move.movetime );
savefile->ReadInt( move.deceleration ); savefile->ReadInt( move.deceleration );
savefile->ReadVec3( move.dir ); savefile->ReadVec3( move.dir );
savefile->ReadInt( (int&)rot.stage ); savefile->ReadInt( (int&)rot.stage );
savefile->ReadInt( rot.acceleration ); savefile->ReadInt( rot.acceleration );
savefile->ReadInt( rot.movetime ); savefile->ReadInt( rot.movetime );
@ -251,7 +251,7 @@ void idMover::Restore( idRestoreGame *savefile ) {
savefile->ReadFloat( rot.rot.pitch ); savefile->ReadFloat( rot.rot.pitch );
savefile->ReadFloat( rot.rot.yaw ); savefile->ReadFloat( rot.rot.yaw );
savefile->ReadFloat( rot.rot.roll ); savefile->ReadFloat( rot.rot.roll );
savefile->ReadInt( move_thread ); savefile->ReadInt( move_thread );
savefile->ReadInt( rotate_thread ); savefile->ReadInt( rotate_thread );
@ -299,7 +299,7 @@ void idMover::Restore( idRestoreGame *savefile ) {
savefile->ReadInt( useAngles ); savefile->ReadInt( useAngles );
PostEventMS( &EV_PostRestore, 0, starttime, totaltime, accel, decel, useAngles ); PostEventMS( &EV_PostRestore, 0, starttime, totaltime, accel, decel, useAngles );
} }
} }
/* /*
@ -524,7 +524,7 @@ idMover::FindGuiTargets
================ ================
*/ */
void idMover::FindGuiTargets( void ) { void idMover::FindGuiTargets( void ) {
gameLocal.GetTargets( spawnArgs, guiTargets, "guiTarget" ); gameLocal.GetTargets( spawnArgs, guiTargets, "guiTarget" );
} }
/* /*
@ -589,7 +589,7 @@ void idMover::Event_InitGuiTargets( void ) {
/*********************************************************************** /***********************************************************************
Translation control functions Translation control functions
***********************************************************************/ ***********************************************************************/
/* /*
@ -782,7 +782,7 @@ void idMover::BeginMove( idThread *thread ) {
/*********************************************************************** /***********************************************************************
Rotation control functions Rotation control functions
***********************************************************************/ ***********************************************************************/
/* /*
@ -977,8 +977,8 @@ void idMover::BeginRotation( idThread *thread, bool stopwhendone ) {
/*********************************************************************** /***********************************************************************
Script callable routines Script callable routines
***********************************************************************/ ***********************************************************************/
/* /*
@ -1702,7 +1702,7 @@ idElevator::Event_Touch
=============== ===============
*/ */
void idElevator::Event_Touch( idEntity *other, trace_t *trace ) { void idElevator::Event_Touch( idEntity *other, trace_t *trace ) {
if ( gameLocal.slow.time < lastTouchTime + 2000 ) { if ( gameLocal.slow.time < lastTouchTime + 2000 ) {
return; return;
} }
@ -1764,7 +1764,7 @@ void idElevator::Think( void ) {
MoveToPos( fi->pos ); MoveToPos( fi->pos );
} }
} }
} }
RunPhysics(); RunPhysics();
Present(); Present();
} }
@ -2440,7 +2440,7 @@ idMover_Binary::SetMoverState
=============== ===============
*/ */
void idMover_Binary::SetMoverState( moverState_t newstate, int time ) { void idMover_Binary::SetMoverState( moverState_t newstate, int time ) {
idVec3 delta; idVec3 delta;
moverState = newstate; moverState = newstate;
move_thread = 0; move_thread = 0;
@ -2520,7 +2520,7 @@ void idMover_Binary::Event_MatchActivateTeam( moverState_t newstate, int time )
================ ================
idMover_Binary::BindTeam idMover_Binary::BindTeam
All entities in a mover team will be bound All entities in a mover team will be bound
================ ================
*/ */
void idMover_Binary::BindTeam( idEntity *bindTo ) { void idMover_Binary::BindTeam( idEntity *bindTo ) {
@ -2654,10 +2654,10 @@ void idMover_Binary::Event_Reached_BinaryMover( void ) {
// return to pos1 after a delay // return to pos1 after a delay
PostEventSec( &EV_Mover_ReturnToPos1, wait ); PostEventSec( &EV_Mover_ReturnToPos1, wait );
} }
// fire targets // fire targets
ActivateTargets( moveMaster->GetActivator() ); ActivateTargets( moveMaster->GetActivator() );
SetBlocked(false); SetBlocked(false);
} else if ( moverState == MOVER_2TO1 ) { } else if ( moverState == MOVER_2TO1 ) {
// reached pos1 // reached pos1
@ -2911,7 +2911,7 @@ idMover_Binary::FindGuiTargets
================ ================
*/ */
void idMover_Binary::FindGuiTargets( void ) { void idMover_Binary::FindGuiTargets( void ) {
gameLocal.GetTargets( spawnArgs, guiTargets, "guiTarget" ); gameLocal.GetTargets( spawnArgs, guiTargets, "guiTarget" );
} }
/* /*
@ -3309,7 +3309,7 @@ void idDoor::Spawn( void ) {
// if "start_open", reverse position 1 and 2 // if "start_open", reverse position 1 and 2
if ( start_open ) { if ( start_open ) {
// post it after EV_SpawnBind // post it after EV_SpawnBind
PostEventMS( &EV_Door_StartOpen, 1 ); PostEventMS( &EV_Door_StartOpen, 1 );
} }
if ( spawnArgs.GetFloat( "time", "1", time ) ) { if ( spawnArgs.GetFloat( "time", "1", time ) ) {
@ -3534,7 +3534,7 @@ void idDoor::Use( idEntity *other, idEntity *activator ) {
} }
ActivateTargets( activator ); ActivateTargets( activator );
Use_BinaryMover( activator ); Use_BinaryMover( activator );
} }
} }
/* /*
@ -3647,7 +3647,7 @@ void idDoor::CalcTriggerBounds( float size, idBounds &bounds ) {
// find the bounds of everything on the team // find the bounds of everything on the team
bounds = GetPhysics()->GetAbsBounds(); bounds = GetPhysics()->GetAbsBounds();
fl.takedamage = true; fl.takedamage = true;
for( other = activateChain; other != NULL; other = other->GetActivateChain() ) { for( other = activateChain; other != NULL; other = other->GetActivateChain() ) {
if ( other->IsType( idDoor::Type ) ) { if ( other->IsType( idDoor::Type ) ) {
@ -3938,13 +3938,13 @@ void idDoor::Event_Activate( idEntity *activator ) {
} }
} }
if ( syncLock.Length() ) { if ( syncLock.Length() ) {
idEntity *sync = gameLocal.FindEntity( syncLock ); idEntity *sync = gameLocal.FindEntity( syncLock );
if ( sync && sync->IsType( idDoor::Type ) ) { if ( sync && sync->IsType( idDoor::Type ) ) {
if ( static_cast<idDoor *>( sync )->IsOpen() ) { if ( static_cast<idDoor *>( sync )->IsOpen() ) {
return; return;
} }
} }
} }
ActivateTargets( activator ); ActivateTargets( activator );
@ -4246,7 +4246,7 @@ void idPlat::SpawnPlatTrigger( idVec3 &pos ) {
tmin[1] = ( bounds[0][1] + bounds[1][1] ) * 0.5f; tmin[1] = ( bounds[0][1] + bounds[1][1] ) * 0.5f;
tmax[1] = tmin[1] + 1; tmax[1] = tmin[1] + 1;
} }
trigger = new idClipModel( idTraceModel( idBounds( tmin, tmax ) ) ); trigger = new idClipModel( idTraceModel( idBounds( tmin, tmax ) ) );
trigger->Link( gameLocal.clip, this, 255, GetPhysics()->GetOrigin(), mat3_identity ); trigger->Link( gameLocal.clip, this, 255, GetPhysics()->GetOrigin(), mat3_identity );
trigger->SetContents( CONTENTS_TRIGGER ); trigger->SetContents( CONTENTS_TRIGGER );
@ -4486,7 +4486,7 @@ void idRotater::Event_Activate( idEntity *activator ) {
spawnArgs.GetFloat( "speed", "100", speed ); spawnArgs.GetFloat( "speed", "100", speed );
spawnArgs.GetBool( "x_axis", "0", x_axis ); spawnArgs.GetBool( "x_axis", "0", x_axis );
spawnArgs.GetBool( "y_axis", "0", y_axis ); spawnArgs.GetBool( "y_axis", "0", y_axis );
// set the axis of rotation // set the axis of rotation
if ( x_axis ) { if ( x_axis ) {
delta[2] = speed; delta[2] = speed;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -157,7 +157,7 @@ private:
void VectorForDir( float dir, idVec3 &vec ); void VectorForDir( float dir, idVec3 &vec );
idCurve_Spline<idVec3> *GetSpline( idEntity *splineEntity ) const; idCurve_Spline<idVec3> *GetSpline( idEntity *splineEntity ) const;
void Event_SetCallback( void ); void Event_SetCallback( void );
void Event_TeamBlocked( idEntity *blockedPart, idEntity *blockingEntity ); void Event_TeamBlocked( idEntity *blockedPart, idEntity *blockingEntity );
void Event_StopMoving( void ); void Event_StopMoving( void );
void Event_StopRotating( void ); void Event_StopRotating( void );
@ -489,7 +489,7 @@ public:
idMover_Periodic( void ); idMover_Periodic( void );
void Spawn( void ); void Spawn( void );
void Save( idSaveGame *savefile ) const; void Save( idSaveGame *savefile ) const;
void Restore( idRestoreGame *savefile ); void Restore( idRestoreGame *savefile );

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -122,10 +122,10 @@ idMultiplayerGame::idMultiplayerGame() {
flagMsgOn = true; flagMsgOn = true;
player_blue_flag = -1; player_blue_flag = -1;
player_red_flag = -1; player_red_flag = -1;
#endif #endif
Clear(); Clear();
} }
@ -181,13 +181,13 @@ void idMultiplayerGame::Reset() {
assert( !scoreBoard && !spectateGui && !guiChat && !mainGui && !mapList ); assert( !scoreBoard && !spectateGui && !guiChat && !mainGui && !mapList );
#ifdef CTF #ifdef CTF
// CTF uses its own scoreboard // CTF uses its own scoreboard
if ( IsGametypeFlagBased() ) if ( IsGametypeFlagBased() )
scoreBoard = uiManager->FindGui( "guis/ctfscoreboard.gui", true, false, true ); scoreBoard = uiManager->FindGui( "guis/ctfscoreboard.gui", true, false, true );
else else
#endif #endif
scoreBoard = uiManager->FindGui( "guis/scoreboard.gui", true, false, true ); scoreBoard = uiManager->FindGui( "guis/scoreboard.gui", true, false, true );
spectateGui = uiManager->FindGui( "guis/spectate.gui", true, false, true ); spectateGui = uiManager->FindGui( "guis/spectate.gui", true, false, true );
guiChat = uiManager->FindGui( "guis/chat.gui", true, false, true ); guiChat = uiManager->FindGui( "guis/chat.gui", true, false, true );
mainGui = uiManager->FindGui( "guis/mpmain.gui", true, false, true ); mainGui = uiManager->FindGui( "guis/mpmain.gui", true, false, true );
@ -228,7 +228,7 @@ void idMultiplayerGame::SpawnPlayer( int clientNum ) {
idPlayer *p = static_cast< idPlayer * >( gameLocal.entities[ clientNum ] ); idPlayer *p = static_cast< idPlayer * >( gameLocal.entities[ clientNum ] );
p->spawnedTime = gameLocal.time; p->spawnedTime = gameLocal.time;
if ( IsGametypeTeamBased() ) { /* CTF */ if ( IsGametypeTeamBased() ) { /* CTF */
SwitchToTeam( clientNum, -1, p->team ); SwitchToTeam( clientNum, -1, p->team );
} }
p->tourneyRank = 0; p->tourneyRank = 0;
@ -292,7 +292,7 @@ idMultiplayerGame::ClearGuis
*/ */
void idMultiplayerGame::ClearGuis() { void idMultiplayerGame::ClearGuis() {
int i; int i;
for ( i = 0; i < MAX_CLIENTS; i++ ) { for ( i = 0; i < MAX_CLIENTS; i++ ) {
scoreBoard->SetStateString( va( "player%i",i+1 ), "" ); scoreBoard->SetStateString( va( "player%i",i+1 ), "" );
scoreBoard->SetStateString( va( "player%i_score", i+1 ), "" ); scoreBoard->SetStateString( va( "player%i_score", i+1 ), "" );
@ -313,11 +313,11 @@ void idMultiplayerGame::ClearGuis() {
scoreBoard->SetStateInt( va( "rank%i", i+1 ), 0 ); scoreBoard->SetStateInt( va( "rank%i", i+1 ), 0 );
player->hud->SetStateInt( "rank_self", 0 ); player->hud->SetStateInt( "rank_self", 0 );
} }
#ifdef CTF #ifdef CTF
ClearHUDStatus(); ClearHUDStatus();
#endif #endif
} }
#ifdef CTF #ifdef CTF
@ -327,23 +327,23 @@ idMultiplayerGame::ClearHUDStatus
================ ================
*/ */
void idMultiplayerGame::ClearHUDStatus( void ) { void idMultiplayerGame::ClearHUDStatus( void ) {
int i; int i;
for ( i = 0; i < MAX_CLIENTS; i++ ) {
for ( i = 0; i < MAX_CLIENTS; i++ ) {
idPlayer *player = static_cast<idPlayer *>( gameLocal.entities[ i ] ); idPlayer *player = static_cast<idPlayer *>( gameLocal.entities[ i ] );
if ( !player || !player->hud ) { if ( !player || !player->hud ) {
continue; continue;
} }
player->hud->SetStateInt( "red_flagstatus", 0 ); player->hud->SetStateInt( "red_flagstatus", 0 );
player->hud->SetStateInt( "blue_flagstatus", 0 ); player->hud->SetStateInt( "blue_flagstatus", 0 );
if ( IsGametypeFlagBased()) if ( IsGametypeFlagBased())
player->hud->SetStateInt( "self_team", player->team ); player->hud->SetStateInt( "self_team", player->team );
else else
player->hud->SetStateInt( "self_team", -1 ); // Invisible. player->hud->SetStateInt( "self_team", -1 ); // Invisible.
} }
} }
/* /*
@ -358,9 +358,9 @@ Gets number of captures in CTF game.
*/ */
int idMultiplayerGame::GetFlagPoints( int team ) int idMultiplayerGame::GetFlagPoints( int team )
{ {
assert( team <= 1 ); assert( team <= 1 );
return teamPoints[ team ]; return teamPoints[ team ];
} }
#endif #endif
@ -523,7 +523,7 @@ void idMultiplayerGame::UpdateScoreboard( idUserInterface *scoreBoard, idPlayer
continue; continue;
} }
} }
iline++; iline++;
if ( !playerState[ i ].ingame ) { if ( !playerState[ i ].ingame ) {
scoreBoard->SetStateString( va( "player%i", iline ), common->GetLanguageDict()->GetString( "#str_04244" ) ); scoreBoard->SetStateString( va( "player%i", iline ), common->GetLanguageDict()->GetString( "#str_04244" ) );
@ -595,9 +595,9 @@ void idMultiplayerGame::UpdateScoreboard( idUserInterface *scoreBoard, idPlayer
} else if ( gameLocal.gameType != GAME_CTF ) { } else if ( gameLocal.gameType != GAME_CTF ) {
#else #else
} else { } else {
#endif #endif
livesinfo = va( "%s: %i", common->GetLanguageDict()->GetString( "#str_01982" ), gameLocal.serverInfo.GetInt( "si_fragLimit" ) ); livesinfo = va( "%s: %i", common->GetLanguageDict()->GetString( "#str_01982" ), gameLocal.serverInfo.GetInt( "si_fragLimit" ) );
} }
if ( gameLocal.serverInfo.GetInt( "si_timeLimit" ) > 0 ) { if ( gameLocal.serverInfo.GetInt( "si_timeLimit" ) > 0 ) {
timeinfo = va( "%s: %i", common->GetLanguageDict()->GetString( "#str_01983" ), gameLocal.serverInfo.GetInt( "si_timeLimit" ) ); timeinfo = va( "%s: %i", common->GetLanguageDict()->GetString( "#str_01983" ), gameLocal.serverInfo.GetInt( "si_timeLimit" ) );
} else { } else {
@ -610,7 +610,7 @@ void idMultiplayerGame::UpdateScoreboard( idUserInterface *scoreBoard, idPlayer
scoreBoard->Redraw( gameLocal.time ); scoreBoard->Redraw( gameLocal.time );
} }
#ifdef CTF #ifdef CTF
/* /*
================ ================
idMultiplayerGame::UpdateCTFScoreboard idMultiplayerGame::UpdateCTFScoreboard
@ -622,197 +622,197 @@ void idMultiplayerGame::UpdateCTFScoreboard( idUserInterface *scoreBoard, idPlay
idEntity *ent; idEntity *ent;
int value; int value;
// The display lines // The display lines
int ilines[2] = {0,0}; int ilines[2] = {0,0};
// The team strings // The team strings
char redTeam[] = "red"; char redTeam[] = "red";
char blueTeam[] = "blue"; char blueTeam[] = "blue";
char *curTeam = NULL; char *curTeam = NULL;
/* Word "frags" */ /* Word "frags" */
scoreBoard->SetStateString( "scoretext", gameLocal.gameType == GAME_LASTMAN ? common->GetLanguageDict()->GetString( "#str_04242" ) : common->GetLanguageDict()->GetString( "#str_04243" ) ); scoreBoard->SetStateString( "scoretext", gameLocal.gameType == GAME_LASTMAN ? common->GetLanguageDict()->GetString( "#str_04242" ) : common->GetLanguageDict()->GetString( "#str_04243" ) );
// Blank the flag carrier on the scoreboard. We update these in the loop below if necessary. // Blank the flag carrier on the scoreboard. We update these in the loop below if necessary.
if ( this->player_blue_flag == -1 ) if ( this->player_blue_flag == -1 )
scoreBoard->SetStateInt( "player_blue_flag", 0 ); scoreBoard->SetStateInt( "player_blue_flag", 0 );
if ( this->player_red_flag == -1 ) if ( this->player_red_flag == -1 )
scoreBoard->SetStateInt( "player_red_flag", 0 ); scoreBoard->SetStateInt( "player_red_flag", 0 );
if ( gameState != WARMUP ) { if ( gameState != WARMUP ) {
for ( i = 0; i < numRankedPlayers; i++ ) { for ( i = 0; i < numRankedPlayers; i++ ) {
idPlayer *player = rankedPlayers[ i ]; idPlayer *player = rankedPlayers[ i ];
assert( player ); assert( player );
if ( player->team == 0 ) if ( player->team == 0 )
curTeam = redTeam; curTeam = redTeam;
else else
curTeam = blueTeam; curTeam = blueTeam;
// Increase the appropriate iline // Increase the appropriate iline
assert( player->team <= 1 ); assert( player->team <= 1 );
ilines[ player->team ]++; ilines[ player->team ]++;
// Update the flag status // Update the flag status
if ( this->player_blue_flag == player->entityNumber ) if ( this->player_blue_flag == player->entityNumber )
scoreBoard->SetStateInt( "player_blue_flag", ilines[ player->team ] ); scoreBoard->SetStateInt( "player_blue_flag", ilines[ player->team ] );
if ( player->team == 1 && this->player_red_flag == player->entityNumber ) if ( player->team == 1 && this->player_red_flag == player->entityNumber )
scoreBoard->SetStateInt( "player_red_flag", ilines[ player->team ] ); scoreBoard->SetStateInt( "player_red_flag", ilines[ player->team ] );
/* Player Name */
scoreBoard->SetStateString( va( "player%i_%s", ilines[ player->team ], curTeam ), player->GetUserInfo()->GetString( "ui_name" ) ); /* Player Name */
scoreBoard->SetStateString( va( "player%i_%s", ilines[ player->team ], curTeam ), player->GetUserInfo()->GetString( "ui_name" ) );
if ( IsGametypeTeamBased() ) {
if ( IsGametypeTeamBased() ) {
value = idMath::ClampInt( MP_PLAYER_MINFRAGS, MP_PLAYER_MAXFRAGS, playerState[ rankedPlayers[ i ]->entityNumber ].fragCount ); value = idMath::ClampInt( MP_PLAYER_MINFRAGS, MP_PLAYER_MAXFRAGS, playerState[ rankedPlayers[ i ]->entityNumber ].fragCount );
scoreBoard->SetStateInt( va( "player%i_%s_score", ilines[ player->team ], curTeam ), value ); scoreBoard->SetStateInt( va( "player%i_%s_score", ilines[ player->team ], curTeam ), value );
/* Team score and score, blanked */ /* Team score and score, blanked */
scoreBoard->SetStateString( va( "player%i_%s_tscore", ilines[ player->team ], curTeam ), "" ); scoreBoard->SetStateString( va( "player%i_%s_tscore", ilines[ player->team ], curTeam ), "" );
//scoreBoard->SetStateString( va( "player%i_%s_score", ilines[ player->team ], curTeam ), "" ); //scoreBoard->SetStateString( va( "player%i_%s_score", ilines[ player->team ], curTeam ), "" );
} }
/* Wins */ /* Wins */
value = idMath::ClampInt( 0, MP_PLAYER_MAXWINS, playerState[ rankedPlayers[ i ]->entityNumber ].wins ); value = idMath::ClampInt( 0, MP_PLAYER_MAXWINS, playerState[ rankedPlayers[ i ]->entityNumber ].wins );
scoreBoard->SetStateInt( va( "player%i_%s_wins", ilines[ player->team ], curTeam ), value ); scoreBoard->SetStateInt( va( "player%i_%s_wins", ilines[ player->team ], curTeam ), value );
/* Ping */ /* Ping */
scoreBoard->SetStateInt( va( "player%i_%s_ping", ilines[ player->team ], curTeam ), playerState[ rankedPlayers[ i ]->entityNumber ].ping ); scoreBoard->SetStateInt( va( "player%i_%s_ping", ilines[ player->team ], curTeam ), playerState[ rankedPlayers[ i ]->entityNumber ].ping );
} }
} }
for ( i = 0; i < MAX_CLIENTS; i++ ) {
ent = gameLocal.entities[ i ];
if ( !ent || !ent->IsType( idPlayer::Type ) ) {
continue;
}
if ( gameState != WARMUP ) {
// check he's not covered by ranks already
for ( j = 0; j < numRankedPlayers; j++ ) {
if ( ent == rankedPlayers[ j ] ) {
break;
}
}
if ( j != numRankedPlayers ) {
continue;
}
}
player = static_cast< idPlayer * >( ent );
if ( player->spectating )
continue;
if ( player->team == 0 ) for ( i = 0; i < MAX_CLIENTS; i++ ) {
curTeam = redTeam;
else ent = gameLocal.entities[ i ];
curTeam = blueTeam; if ( !ent || !ent->IsType( idPlayer::Type ) ) {
continue;
ilines[ player->team ]++; }
if ( gameState != WARMUP ) {
// check he's not covered by ranks already
for ( j = 0; j < numRankedPlayers; j++ ) {
if ( ent == rankedPlayers[ j ] ) {
break;
}
}
if ( j != numRankedPlayers ) {
continue;
}
}
player = static_cast< idPlayer * >( ent );
if ( player->spectating )
continue;
if ( player->team == 0 )
curTeam = redTeam;
else
curTeam = blueTeam;
ilines[ player->team ]++;
if ( !playerState[ i ].ingame ) {
/* "New Player" on player's name location */
scoreBoard->SetStateString( va( "player%i_%s", ilines[ player->team ], curTeam ), common->GetLanguageDict()->GetString( "#str_04244" ) );
/* "Connecting" on player's score location */
scoreBoard->SetStateString( va( "player%i_%s_score", ilines[ player->team ], curTeam ), common->GetLanguageDict()->GetString( "#str_04245" ) );
} else {
/* Player's name in player's name location */
if ( !player->spectating )
scoreBoard->SetStateString( va( "player%i_%s", ilines[ player->team ], curTeam ), gameLocal.userInfo[ i ].GetString( "ui_name" ) );
if ( gameState == WARMUP ) {
if ( player->spectating ) {
/* "Spectating" on player's score location */
scoreBoard->SetStateString( va( "player%i_%s_score", ilines[ player->team ], curTeam ), common->GetLanguageDict()->GetString( "#str_04246" ) );
} else {
/* Display "ready" in player's score location if they're ready. Display nothing if not. No room for 'not ready'. */
scoreBoard->SetStateString( va( "player%i_%s_score", ilines[ player->team ], curTeam ), player->IsReady() ? common->GetLanguageDict()->GetString( "#str_04247" ) : "" );
}
}
}
}
// Clear remaining slots
for ( i = 0; i < 2; i++ )
{
if ( i )
curTeam = blueTeam;
else
curTeam = redTeam;
for ( j = ilines[ i ]+1; j <= 8; j++ )
{
scoreBoard->SetStateString( va( "player%i_%s", j, curTeam ), "" );
scoreBoard->SetStateString( va( "player%i_%s_score", j, curTeam ), "" );
scoreBoard->SetStateString( va( "player%i_%s_wins", j, curTeam ), "" );
scoreBoard->SetStateString( va( "player%i_%s_ping", j, curTeam ), "" );
scoreBoard->SetStateInt( "rank_self", 0 );
}
}
// Don't display "CTF" -- if this scoreboard comes up, it should be apparent.
if ( !playerState[ i ].ingame ) {
/* "New Player" on player's name location */
scoreBoard->SetStateString( va( "player%i_%s", ilines[ player->team ], curTeam ), common->GetLanguageDict()->GetString( "#str_04244" ) );
/* "Connecting" on player's score location */
scoreBoard->SetStateString( va( "player%i_%s_score", ilines[ player->team ], curTeam ), common->GetLanguageDict()->GetString( "#str_04245" ) );
} else {
/* Player's name in player's name location */
if ( !player->spectating )
scoreBoard->SetStateString( va( "player%i_%s", ilines[ player->team ], curTeam ), gameLocal.userInfo[ i ].GetString( "ui_name" ) );
if ( gameState == WARMUP ) {
if ( player->spectating ) {
/* "Spectating" on player's score location */
scoreBoard->SetStateString( va( "player%i_%s_score", ilines[ player->team ], curTeam ), common->GetLanguageDict()->GetString( "#str_04246" ) );
} else {
/* Display "ready" in player's score location if they're ready. Display nothing if not. No room for 'not ready'. */
scoreBoard->SetStateString( va( "player%i_%s_score", ilines[ player->team ], curTeam ), player->IsReady() ? common->GetLanguageDict()->GetString( "#str_04247" ) : "" );
}
}
}
}
// Clear remaining slots
for ( i = 0; i < 2; i++ )
{
if ( i )
curTeam = blueTeam;
else
curTeam = redTeam;
for ( j = ilines[ i ]+1; j <= 8; j++ )
{
scoreBoard->SetStateString( va( "player%i_%s", j, curTeam ), "" );
scoreBoard->SetStateString( va( "player%i_%s_score", j, curTeam ), "" );
scoreBoard->SetStateString( va( "player%i_%s_wins", j, curTeam ), "" );
scoreBoard->SetStateString( va( "player%i_%s_ping", j, curTeam ), "" );
scoreBoard->SetStateInt( "rank_self", 0 );
}
}
// Don't display "CTF" -- if this scoreboard comes up, it should be apparent.
if ( gameLocal.gameType == GAME_CTF ) { if ( gameLocal.gameType == GAME_CTF ) {
int captureLimit = gameLocal.serverInfo.GetInt( "si_fragLimit" ); int captureLimit = gameLocal.serverInfo.GetInt( "si_fragLimit" );
if ( captureLimit > MP_CTF_MAXPOINTS ) if ( captureLimit > MP_CTF_MAXPOINTS )
captureLimit = MP_CTF_MAXPOINTS; captureLimit = MP_CTF_MAXPOINTS;
int timeLimit = gameLocal.serverInfo.GetInt( "si_timeLimit" ); int timeLimit = gameLocal.serverInfo.GetInt( "si_timeLimit" );
/* Prints "Capture Limit: %i" at the bottom of the scoreboard, left */ /* Prints "Capture Limit: %i" at the bottom of the scoreboard, left */
if ( captureLimit ) if ( captureLimit )
scoreBoard->SetStateString( "gameinfo_red", va( common->GetLanguageDict()->GetString( "#str_11108" ), captureLimit) ); scoreBoard->SetStateString( "gameinfo_red", va( common->GetLanguageDict()->GetString( "#str_11108" ), captureLimit) );
else else
scoreBoard->SetStateString( "gameinfo_red", "" ); scoreBoard->SetStateString( "gameinfo_red", "" );
/* Prints "Time Limit: %i" at the bottom of the scoreboard, right */ /* Prints "Time Limit: %i" at the bottom of the scoreboard, right */
if ( timeLimit ) if ( timeLimit )
scoreBoard->SetStateString( "gameinfo_blue", va( common->GetLanguageDict()->GetString( "#str_11109" ), timeLimit) ); scoreBoard->SetStateString( "gameinfo_blue", va( common->GetLanguageDict()->GetString( "#str_11109" ), timeLimit) );
else else
scoreBoard->SetStateString( "gameinfo_blue", "" ); scoreBoard->SetStateString( "gameinfo_blue", "" );
} }
// Set team scores
scoreBoard->SetStateInt( "red_team_score", GetFlagPoints( 0 ) ); // Set team scores
scoreBoard->SetStateInt( "blue_team_score", GetFlagPoints( 1 ) ); scoreBoard->SetStateInt( "red_team_score", GetFlagPoints( 0 ) );
scoreBoard->SetStateInt( "blue_team_score", GetFlagPoints( 1 ) );
// Handle flag status changed event // Handle flag status changed event
scoreBoard->HandleNamedEvent( "BlueFlagStatusChange" ); scoreBoard->HandleNamedEvent( "BlueFlagStatusChange" );
scoreBoard->HandleNamedEvent( "RedFlagStatusChange" ); scoreBoard->HandleNamedEvent( "RedFlagStatusChange" );
scoreBoard->Redraw( gameLocal.time ); scoreBoard->Redraw( gameLocal.time );
} }
#endif #endif
@ -844,7 +844,7 @@ const char *idMultiplayerGame::GameTime() {
if ( ms < 0 ) { if ( ms < 0 ) {
ms = 0; ms = 0;
} }
s = ms / 1000; s = ms / 1000;
m = s / 60; m = s / 60;
s -= m * 60; s -= m * 60;
@ -1006,7 +1006,7 @@ idPlayer *idMultiplayerGame::FragLimitHit() {
idMultiplayerGame::TimeLimitHit idMultiplayerGame::TimeLimitHit
================ ================
*/ */
bool idMultiplayerGame::TimeLimitHit() { bool idMultiplayerGame::TimeLimitHit() {
int timeLimit = gameLocal.serverInfo.GetInt( "si_timeLimit" ); int timeLimit = gameLocal.serverInfo.GetInt( "si_timeLimit" );
if ( timeLimit ) { if ( timeLimit ) {
if ( gameLocal.time >= matchStartedTime + timeLimit * 60000 ) { if ( gameLocal.time >= matchStartedTime + timeLimit * 60000 ) {
@ -1174,7 +1174,7 @@ void idMultiplayerGame::UpdateWinsLosses( idPlayer *winner ) {
PlayGlobalSound( player->entityNumber, SND_YOULOSE ); PlayGlobalSound( player->entityNumber, SND_YOULOSE );
} }
} else if ( gameLocal.gameType == GAME_TOURNEY ) { } else if ( gameLocal.gameType == GAME_TOURNEY ) {
if ( player == winner ) { if ( player == winner ) {
playerState[ i ].wins++; playerState[ i ].wins++;
PlayGlobalSound( player->entityNumber, SND_YOUWIN ); PlayGlobalSound( player->entityNumber, SND_YOUWIN );
} else if ( i == currentTourneyPlayer[ 0 ] || i == currentTourneyPlayer[ 1 ] ) { } else if ( i == currentTourneyPlayer[ 0 ] || i == currentTourneyPlayer[ 1 ] ) {
@ -1210,7 +1210,7 @@ void idMultiplayerGame::UpdateWinsLosses( idPlayer *winner ) {
} }
} }
#endif #endif
if ( winner ) { if ( winner ) {
lastWinner = winner->entityNumber; lastWinner = winner->entityNumber;
} else { } else {
@ -1310,7 +1310,7 @@ void idMultiplayerGame::PlayerDeath( idPlayer *dead, idPlayer *killer, bool tele
if ( killer ) { if ( killer ) {
if ( gameLocal.gameType == GAME_LASTMAN ) { if ( gameLocal.gameType == GAME_LASTMAN ) {
playerState[ dead->entityNumber ].fragCount--; playerState[ dead->entityNumber ].fragCount--;
} else if ( IsGametypeTeamBased() ) { /* CTF */ } else if ( IsGametypeTeamBased() ) { /* CTF */
if ( killer == dead || killer->team == dead->team ) { if ( killer == dead || killer->team == dead->team ) {
// suicide or teamkill // suicide or teamkill
@ -1357,7 +1357,7 @@ void idMultiplayerGame::PlayerStats( int clientNum, char *data, const int len )
} }
// find which team this player is on // find which team this player is on
ent = gameLocal.entities[ clientNum ]; ent = gameLocal.entities[ clientNum ];
if ( ent && ent->IsType( idPlayer::Type ) ) { if ( ent && ent->IsType( idPlayer::Type ) ) {
team = static_cast< idPlayer * >(ent)->team; team = static_cast< idPlayer * >(ent)->team;
} else { } else {
@ -1418,7 +1418,7 @@ void idMultiplayerGame::NewState( gameState_t news, idPlayer *player ) {
teamPoints[0] = 0; teamPoints[0] = 0;
teamPoints[1] = 0; teamPoints[1] = 0;
ClearHUDStatus(); ClearHUDStatus();
#endif #endif
PlayGlobalSound( -1, SND_FIGHT ); PlayGlobalSound( -1, SND_FIGHT );
@ -1628,7 +1628,7 @@ void idMultiplayerGame::CycleTourneyPlayers( ) {
if ( lastWinner != -1 ) { if ( lastWinner != -1 ) {
idEntity *ent = gameLocal.entities[ lastWinner ]; idEntity *ent = gameLocal.entities[ lastWinner ];
if ( ent && ent->IsType( idPlayer::Type ) ) { if ( ent && ent->IsType( idPlayer::Type ) ) {
currentTourneyPlayer[ 0 ] = lastWinner; currentTourneyPlayer[ 0 ] = lastWinner;
} }
} }
FillTourneySlots( ); FillTourneySlots( );
@ -1669,7 +1669,7 @@ void idMultiplayerGame::ExecuteVote( void ) {
if ( needRestart ) { if ( needRestart ) {
cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "nextMap" ); cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "nextMap" );
} }
#endif #endif
break; break;
case VOTE_FRAGLIMIT: case VOTE_FRAGLIMIT:
si_fragLimit.SetInteger( atoi( voteValue ) ); si_fragLimit.SetInteger( atoi( voteValue ) );
@ -1900,7 +1900,7 @@ void idMultiplayerGame::Run() {
break; break;
} }
#endif #endif
player = FragLimitHit(); player = FragLimitHit();
if ( player ) { if ( player ) {
// delay between detecting frag limit and ending game. let the death anims play // delay between detecting frag limit and ending game. let the death anims play
@ -1944,7 +1944,7 @@ void idMultiplayerGame::Run() {
break; break;
} }
#endif #endif
player = FragLeader(); player = FragLeader();
if ( player ) { if ( player ) {
if ( !fragLimitTimeout ) { if ( !fragLimitTimeout ) {
@ -2557,10 +2557,10 @@ void idMultiplayerGame::UpdateHud( idPlayer *player, idUserInterface *hud ) {
} }
#ifdef CTF #ifdef CTF
if ( IsGametypeFlagBased() ) if ( IsGametypeFlagBased() )
hud->SetStateInt( "self_team", player->team ); hud->SetStateInt( "self_team", player->team );
else else
hud->SetStateInt( "self_team", -1 ); /* Disable */ hud->SetStateInt( "self_team", -1 ); /* Disable */
#endif #endif
} }
@ -2576,14 +2576,14 @@ void idMultiplayerGame::DrawScoreBoard( idPlayer *player ) {
scoreBoard->Activate( true, gameLocal.time ); scoreBoard->Activate( true, gameLocal.time );
playerState[ player->entityNumber ].scoreBoardUp = true; playerState[ player->entityNumber ].scoreBoardUp = true;
} }
#ifdef CTF #ifdef CTF
if ( IsGametypeFlagBased() ) if ( IsGametypeFlagBased() )
UpdateCTFScoreboard( scoreBoard, player ); UpdateCTFScoreboard( scoreBoard, player );
else else
#endif #endif
UpdateScoreboard( scoreBoard, player ); UpdateScoreboard( scoreBoard, player );
} else { } else {
if ( playerState[ player->entityNumber ].scoreBoardUp ) { if ( playerState[ player->entityNumber ].scoreBoardUp ) {
scoreBoard->Activate( false, gameLocal.time ); scoreBoard->Activate( false, gameLocal.time );
@ -2611,11 +2611,11 @@ idMultiplayerGame::AddChatLine
void idMultiplayerGame::AddChatLine( const char *fmt, ... ) { void idMultiplayerGame::AddChatLine( const char *fmt, ... ) {
idStr temp; idStr temp;
va_list argptr; va_list argptr;
va_start( argptr, fmt ); va_start( argptr, fmt );
vsprintf( temp, fmt, argptr ); vsprintf( temp, fmt, argptr );
va_end( argptr ); va_end( argptr );
gameLocal.Printf( "%s\n", temp.c_str() ); gameLocal.Printf( "%s\n", temp.c_str() );
chatHistory[ chatHistoryIndex % NUM_CHAT_NOTIFY ].line = temp; chatHistory[ chatHistoryIndex % NUM_CHAT_NOTIFY ].line = temp;
@ -2704,10 +2704,10 @@ void idMultiplayerGame::WriteToSnapshot( idBitMsgDelta &msg ) const {
} }
#ifdef CTF #ifdef CTF
msg.WriteShort( teamPoints[0] ); msg.WriteShort( teamPoints[0] );
msg.WriteShort( teamPoints[1] ); msg.WriteShort( teamPoints[1] );
msg.WriteShort( player_red_flag ); msg.WriteShort( player_red_flag );
msg.WriteShort( player_blue_flag ); msg.WriteShort( player_blue_flag );
#endif #endif
} }
@ -2742,14 +2742,14 @@ void idMultiplayerGame::ReadFromSnapshot( const idBitMsgDelta &msg ) {
playerState[i].ingame = msg.ReadBits( 1 ) != 0; playerState[i].ingame = msg.ReadBits( 1 ) != 0;
} }
#ifdef CTF #ifdef CTF
teamPoints[0] = msg.ReadShort(); teamPoints[0] = msg.ReadShort();
teamPoints[1] = msg.ReadShort(); teamPoints[1] = msg.ReadShort();
player_red_flag = msg.ReadShort(); player_red_flag = msg.ReadShort();
player_blue_flag = msg.ReadShort(); player_blue_flag = msg.ReadShort();
#endif #endif
} }
@ -2880,8 +2880,8 @@ void idMultiplayerGame::PrintMessageEvent( int to, msg_evt_t evt, int parm1, int
break; break;
case MSG_FLAGTAKEN : case MSG_FLAGTAKEN :
if ( gameLocal.GetLocalPlayer() == NULL ) if ( gameLocal.GetLocalPlayer() == NULL )
break; break;
if ( parm2 < 0 || parm2 >= MAX_CLIENTS ) if ( parm2 < 0 || parm2 >= MAX_CLIENTS )
break; break;
@ -2894,8 +2894,8 @@ void idMultiplayerGame::PrintMessageEvent( int to, msg_evt_t evt, int parm1, int
break; break;
case MSG_FLAGDROP : case MSG_FLAGDROP :
if ( gameLocal.GetLocalPlayer() == NULL ) if ( gameLocal.GetLocalPlayer() == NULL )
break; break;
if ( gameLocal.GetLocalPlayer()->team != parm1 ) { if ( gameLocal.GetLocalPlayer()->team != parm1 ) {
AddChatLine( common->GetLanguageDict()->GetString( "#str_11103" ) ); // your team AddChatLine( common->GetLanguageDict()->GetString( "#str_11103" ) ); // your team
@ -2905,8 +2905,8 @@ void idMultiplayerGame::PrintMessageEvent( int to, msg_evt_t evt, int parm1, int
break; break;
case MSG_FLAGRETURN : case MSG_FLAGRETURN :
if ( gameLocal.GetLocalPlayer() == NULL ) if ( gameLocal.GetLocalPlayer() == NULL )
break; break;
if ( parm2 >= 0 && parm2 < MAX_CLIENTS ) { if ( parm2 >= 0 && parm2 < MAX_CLIENTS ) {
if ( gameLocal.GetLocalPlayer()->team != parm1 ) { if ( gameLocal.GetLocalPlayer()->team != parm1 ) {
@ -2915,13 +2915,13 @@ void idMultiplayerGame::PrintMessageEvent( int to, msg_evt_t evt, int parm1, int
AddChatLine( common->GetLanguageDict()->GetString( "#str_11121" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // enemy AddChatLine( common->GetLanguageDict()->GetString( "#str_11121" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // enemy
} }
} else { } else {
AddChatLine( common->GetLanguageDict()->GetString( "#str_11105" ), parm1 ? common->GetLanguageDict()->GetString( "#str_11110" ) : common->GetLanguageDict()->GetString( "#str_11111" ) ); AddChatLine( common->GetLanguageDict()->GetString( "#str_11105" ), parm1 ? common->GetLanguageDict()->GetString( "#str_11110" ) : common->GetLanguageDict()->GetString( "#str_11111" ) );
} }
break; break;
case MSG_FLAGCAPTURE : case MSG_FLAGCAPTURE :
if ( gameLocal.GetLocalPlayer() == NULL ) if ( gameLocal.GetLocalPlayer() == NULL )
break; break;
if ( parm2 < 0 || parm2 >= MAX_CLIENTS ) if ( parm2 < 0 || parm2 >= MAX_CLIENTS )
break; break;
@ -2930,8 +2930,8 @@ void idMultiplayerGame::PrintMessageEvent( int to, msg_evt_t evt, int parm1, int
AddChatLine( common->GetLanguageDict()->GetString( "#str_11122" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // your team AddChatLine( common->GetLanguageDict()->GetString( "#str_11122" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // your team
} else { } else {
AddChatLine( common->GetLanguageDict()->GetString( "#str_11123" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // enemy AddChatLine( common->GetLanguageDict()->GetString( "#str_11123" ), gameLocal.userInfo[ parm2 ].GetString( "ui_name" ) ); // enemy
} }
// AddChatLine( common->GetLanguageDict()->GetString( "#str_11106" ), parm1 ? common->GetLanguageDict()->GetString( "#str_11110" ) : common->GetLanguageDict()->GetString( "#str_11111" ) ); // AddChatLine( common->GetLanguageDict()->GetString( "#str_11106" ), parm1 ? common->GetLanguageDict()->GetString( "#str_11110" ) : common->GetLanguageDict()->GetString( "#str_11111" ) );
break; break;
@ -3017,11 +3017,11 @@ void idMultiplayerGame::CheckRespawns( idPlayer *spectator ) {
} }
} else { } else {
if ( gameLocal.gameType == GAME_DM || // CTF : 3wave sboily, was DM really included before? if ( gameLocal.gameType == GAME_DM || // CTF : 3wave sboily, was DM really included before?
IsGametypeTeamBased() ) IsGametypeTeamBased() )
{ {
if ( gameState == WARMUP || gameState == COUNTDOWN || gameState == GAMEON ) { if ( gameState == WARMUP || gameState == COUNTDOWN || gameState == GAMEON ) {
p->ServerSpectate( false ); p->ServerSpectate( false );
} }
} else if ( gameLocal.gameType == GAME_TOURNEY ) { } else if ( gameLocal.gameType == GAME_TOURNEY ) {
if ( i == currentTourneyPlayer[ 0 ] || i == currentTourneyPlayer[ 1 ] ) { if ( i == currentTourneyPlayer[ 0 ] || i == currentTourneyPlayer[ 1 ] ) {
if ( gameState == WARMUP || gameState == COUNTDOWN || gameState == GAMEON ) { if ( gameState == WARMUP || gameState == COUNTDOWN || gameState == GAMEON ) {
@ -3336,7 +3336,7 @@ void idMultiplayerGame::ClientCallVote( vote_flags_t voteIndex, const char *vote
idBitMsg outMsg; idBitMsg outMsg;
byte msgBuf[ MAX_GAME_MESSAGE_SIZE ]; byte msgBuf[ MAX_GAME_MESSAGE_SIZE ];
// send // send
outMsg.Init( msgBuf, sizeof( msgBuf ) ); outMsg.Init( msgBuf, sizeof( msgBuf ) );
outMsg.WriteByte( GAME_RELIABLE_MESSAGE_CALLVOTE ); outMsg.WriteByte( GAME_RELIABLE_MESSAGE_CALLVOTE );
outMsg.WriteByte( voteIndex ); outMsg.WriteByte( voteIndex );
@ -3424,7 +3424,7 @@ void idMultiplayerGame::ServerCallVote( int clientNum, const idBitMsg &msg ) {
if ( vote_timeLimit == gameLocal.serverInfo.GetInt( "si_timeLimit" ) ) { if ( vote_timeLimit == gameLocal.serverInfo.GetInt( "si_timeLimit" ) ) {
gameLocal.ServerSendChatMessage( clientNum, "server", common->GetLanguageDict()->GetString( "#str_04270" ) ); gameLocal.ServerSendChatMessage( clientNum, "server", common->GetLanguageDict()->GetString( "#str_04270" ) );
common->DPrintf( "client %d: already at the voted Time Limit\n", clientNum ); common->DPrintf( "client %d: already at the voted Time Limit\n", clientNum );
return; return;
} }
if ( vote_timeLimit < si_timeLimit.GetMinValue() || vote_timeLimit > si_timeLimit.GetMaxValue() ) { if ( vote_timeLimit < si_timeLimit.GetMinValue() || vote_timeLimit > si_timeLimit.GetMaxValue() ) {
gameLocal.ServerSendChatMessage( clientNum, "server", common->GetLanguageDict()->GetString( "#str_04269" ) ); gameLocal.ServerSendChatMessage( clientNum, "server", common->GetLanguageDict()->GetString( "#str_04269" ) );
@ -3439,7 +3439,7 @@ void idMultiplayerGame::ServerCallVote( int clientNum, const idBitMsg &msg ) {
if ( vote_fragLimit == gameLocal.serverInfo.GetInt( "si_fragLimit" ) ) { if ( vote_fragLimit == gameLocal.serverInfo.GetInt( "si_fragLimit" ) ) {
gameLocal.ServerSendChatMessage( clientNum, "server", common->GetLanguageDict()->GetString( "#str_04267" ) ); gameLocal.ServerSendChatMessage( clientNum, "server", common->GetLanguageDict()->GetString( "#str_04267" ) );
common->DPrintf( "client %d: already at the voted Frag Limit\n", clientNum ); common->DPrintf( "client %d: already at the voted Frag Limit\n", clientNum );
return; return;
} }
if ( vote_fragLimit < si_fragLimit.GetMinValue() || vote_fragLimit > si_fragLimit.GetMaxValue() ) { if ( vote_fragLimit < si_fragLimit.GetMinValue() || vote_fragLimit > si_fragLimit.GetMaxValue() ) {
gameLocal.ServerSendChatMessage( clientNum, "server", common->GetLanguageDict()->GetString( "#str_04266" ) ); gameLocal.ServerSendChatMessage( clientNum, "server", common->GetLanguageDict()->GetString( "#str_04266" ) );
@ -3619,7 +3619,7 @@ void idMultiplayerGame::MapRestart( void ) {
teamPoints[0] = 0; teamPoints[0] = 0;
teamPoints[1] = 0; teamPoints[1] = 0;
ClearHUDStatus(); ClearHUDStatus();
#endif #endif
#ifdef CTF #ifdef CTF
@ -3627,7 +3627,7 @@ void idMultiplayerGame::MapRestart( void ) {
if ( g_balanceTDM.GetBool() && lastGameType != GAME_TDM && lastGameType != GAME_CTF && gameLocal.mpGame.IsGametypeTeamBased() ) { if ( g_balanceTDM.GetBool() && lastGameType != GAME_TDM && lastGameType != GAME_CTF && gameLocal.mpGame.IsGametypeTeamBased() ) {
#else #else
if ( g_balanceTDM.GetBool() && lastGameType != GAME_TDM && gameLocal.gameType == GAME_TDM ) { if ( g_balanceTDM.GetBool() && lastGameType != GAME_TDM && gameLocal.gameType == GAME_TDM ) {
#endif #endif
for ( clientNum = 0; clientNum < gameLocal.numClients; clientNum++ ) { for ( clientNum = 0; clientNum < gameLocal.numClients; clientNum++ ) {
if ( gameLocal.entities[ clientNum ] && gameLocal.entities[ clientNum ]->IsType( idPlayer::Type ) ) { if ( gameLocal.entities[ clientNum ] && gameLocal.entities[ clientNum ]->IsType( idPlayer::Type ) ) {
if ( static_cast< idPlayer* >( gameLocal.entities[ clientNum ] )->BalanceTDM() ) { if ( static_cast< idPlayer* >( gameLocal.entities[ clientNum ] )->BalanceTDM() ) {
@ -3650,7 +3650,7 @@ void idMultiplayerGame::SwitchToTeam( int clientNum, int oldteam, int newteam )
idEntity *ent; idEntity *ent;
int i; int i;
assert( IsGametypeTeamBased() ); /* CTF */ assert( IsGametypeTeamBased() ); /* CTF */
assert( oldteam != newteam ); assert( oldteam != newteam );
assert( !gameLocal.isClient ); assert( !gameLocal.isClient );
@ -3662,16 +3662,16 @@ void idMultiplayerGame::SwitchToTeam( int clientNum, int oldteam, int newteam )
if ( i == clientNum ) { if ( i == clientNum ) {
continue; continue;
} }
ent = gameLocal.entities[ i ]; ent = gameLocal.entities[ i ];
if ( ent && ent->IsType( idPlayer::Type ) && static_cast< idPlayer * >(ent)->team == newteam ) { if ( ent && ent->IsType( idPlayer::Type ) && static_cast< idPlayer * >(ent)->team == newteam ) {
playerState[ clientNum ].teamFragCount = playerState[ i ].teamFragCount; playerState[ clientNum ].teamFragCount = playerState[ i ].teamFragCount;
break; break;
} }
} }
if ( i == gameLocal.numClients ) { if ( i == gameLocal.numClients ) {
// alone on this team // alone on this team
playerState[ clientNum ].teamFragCount = 0; playerState[ clientNum ].teamFragCount = 0;
} }
#ifdef CTF #ifdef CTF
if ( ( gameState == GAMEON || ( IsGametypeFlagBased() && gameState == SUDDENDEATH ) ) && oldteam != -1 ) { if ( ( gameState == GAMEON || ( IsGametypeFlagBased() && gameState == SUDDENDEATH ) ) && oldteam != -1 ) {
@ -3686,9 +3686,9 @@ void idMultiplayerGame::SwitchToTeam( int clientNum, int oldteam, int newteam )
} }
p->Kill( true, true ); p->Kill( true, true );
#ifdef CTF #ifdef CTF
if ( IsGametypeFlagBased() ) if ( IsGametypeFlagBased() )
p->DropFlag(); p->DropFlag();
#endif #endif
CheckAbortGame(); CheckAbortGame();
} }
#ifdef CTF #ifdef CTF
@ -3710,7 +3710,7 @@ void idMultiplayerGame::ProcessChatMessage( int clientNum, bool team, const char
const char *prefix = NULL; const char *prefix = NULL;
int send_to; // 0 - all, 1 - specs, 2 - team int send_to; // 0 - all, 1 - specs, 2 - team
int i; int i;
idEntity *ent; idEntity *ent;
idPlayer *p; idPlayer *p;
idStr prefixed_name; idStr prefixed_name;
@ -3761,7 +3761,7 @@ void idMultiplayerGame::ProcessChatMessage( int clientNum, bool team, const char
} }
} else { } else {
for ( i = 0; i < gameLocal.numClients; i++ ) { for ( i = 0; i < gameLocal.numClients; i++ ) {
ent = gameLocal.entities[ i ]; ent = gameLocal.entities[ i ];
if ( !ent || !ent->IsType( idPlayer::Type ) ) { if ( !ent || !ent->IsType( idPlayer::Type ) ) {
continue; continue;
} }
@ -3801,7 +3801,7 @@ void idMultiplayerGame::Precache( void ) {
return; return;
} }
gameLocal.FindEntityDefDict( "player_doommarine", false );; gameLocal.FindEntityDefDict( "player_doommarine", false );;
// skins // skins
idStr str = cvarSystem->GetCVarString( "mod_validSkins" ); idStr str = cvarSystem->GetCVarString( "mod_validSkins" );
idStr skin; idStr skin;
@ -3881,7 +3881,7 @@ idMultiplayerGame::ToggleTeam
void idMultiplayerGame::ToggleTeam( void ) { void idMultiplayerGame::ToggleTeam( void ) {
bool team; bool team;
assert( gameLocal.isClient || gameLocal.localClientNum == 0 ); assert( gameLocal.isClient || gameLocal.localClientNum == 0 );
team = ( idStr::Icmp( cvarSystem->GetCVarString( "ui_team" ), "Red" ) == 0 ); team = ( idStr::Icmp( cvarSystem->GetCVarString( "ui_team" ), "Red" ) == 0 );
if ( team ) { if ( team ) {
cvarSystem->SetCVarString( "ui_team", "Blue" ); cvarSystem->SetCVarString( "ui_team", "Blue" );
@ -4082,7 +4082,7 @@ void idMultiplayerGame::ServerWriteInitialReliableMessages( int clientNum ) {
outMsg.WriteShort( startFragLimit ); outMsg.WriteShort( startFragLimit );
// send the powerup states and the spectate states // send the powerup states and the spectate states
for( i = 0; i < gameLocal.numClients; i++ ) { for( i = 0; i < gameLocal.numClients; i++ ) {
ent = gameLocal.entities[ i ]; ent = gameLocal.entities[ i ];
if ( i != clientNum && ent && ent->IsType( idPlayer::Type ) ) { if ( i != clientNum && ent && ent->IsType( idPlayer::Type ) ) {
outMsg.WriteShort( i ); outMsg.WriteShort( i );
outMsg.WriteShort( static_cast< idPlayer * >( ent )->inventory.powerups ); outMsg.WriteShort( static_cast< idPlayer * >( ent )->inventory.powerups );
@ -4144,7 +4144,7 @@ void idMultiplayerGame::ClientReadWarmupTime( const idBitMsg &msg ) {
/* /*
#ifdef CTF #ifdef CTF
Threewave note: Threewave note:
The below IsGametype...() functions were implemented for CTF, The below IsGametype...() functions were implemented for CTF,
but we did not #ifdef CTF them, because doing so would clutter but we did not #ifdef CTF them, because doing so would clutter
the codebase substantially. Please consider them part of the merged the codebase substantially. Please consider them part of the merged
@ -4158,52 +4158,52 @@ idMultiplayerGame::IsGametypeTeamBased
*/ */
bool idMultiplayerGame::IsGametypeTeamBased( void ) /* CTF */ bool idMultiplayerGame::IsGametypeTeamBased( void ) /* CTF */
{ {
switch ( gameLocal.gameType ) switch ( gameLocal.gameType )
{ {
case GAME_SP: case GAME_SP:
case GAME_DM: case GAME_DM:
case GAME_TOURNEY: case GAME_TOURNEY:
case GAME_LASTMAN: case GAME_LASTMAN:
return false; return false;
#ifdef CTF #ifdef CTF
case GAME_CTF: case GAME_CTF:
#endif #endif
case GAME_TDM: case GAME_TDM:
return true; return true;
default: default:
assert( !"Add support for your new gametype here." ); assert( !"Add support for your new gametype here." );
} }
return false; return false;
} }
/* /*
================ ================
idMultiplayerGame::IsGametypeFlagBased idMultiplayerGame::IsGametypeFlagBased
================ ================
*/ */
bool idMultiplayerGame::IsGametypeFlagBased( void ) { bool idMultiplayerGame::IsGametypeFlagBased( void ) {
switch ( gameLocal.gameType ) switch ( gameLocal.gameType )
{ {
case GAME_SP: case GAME_SP:
case GAME_DM: case GAME_DM:
case GAME_TOURNEY: case GAME_TOURNEY:
case GAME_LASTMAN: case GAME_LASTMAN:
case GAME_TDM: case GAME_TDM:
return false; return false;
#ifdef CTF #ifdef CTF
case GAME_CTF: case GAME_CTF:
return true; return true;
#endif #endif
default: default:
assert( !"Add support for your new gametype here." ); assert( !"Add support for your new gametype here." );
} }
return false;
return false;
} }
#ifdef CTF #ifdef CTF
@ -4213,8 +4213,8 @@ idMultiplayerGame::GetTeamFlag
================ ================
*/ */
idItemTeam * idMultiplayerGame::GetTeamFlag( int team ) { idItemTeam * idMultiplayerGame::GetTeamFlag( int team ) {
assert( team == 0 || team == 1 ); assert( team == 0 || team == 1 );
if ( !IsGametypeFlagBased() || ( team != 0 && team != 1 ) ) /* CTF */ if ( !IsGametypeFlagBased() || ( team != 0 && team != 1 ) ) /* CTF */
return NULL; return NULL;
@ -4263,24 +4263,24 @@ idMultiplayerGame::GetFlagStatus
================ ================
*/ */
flagStatus_t idMultiplayerGame::GetFlagStatus( int team ) { flagStatus_t idMultiplayerGame::GetFlagStatus( int team ) {
//assert( IsGametypeFlagBased() ); //assert( IsGametypeFlagBased() );
idItemTeam *teamFlag = GetTeamFlag( team ); idItemTeam *teamFlag = GetTeamFlag( team );
//assert( teamFlag != NULL ); //assert( teamFlag != NULL );
if ( teamFlag != NULL ) { if ( teamFlag != NULL ) {
if ( teamFlag->carried == false && teamFlag->dropped == false ) if ( teamFlag->carried == false && teamFlag->dropped == false )
return FLAGSTATUS_INBASE; return FLAGSTATUS_INBASE;
if ( teamFlag->carried == true ) if ( teamFlag->carried == true )
return FLAGSTATUS_TAKEN; return FLAGSTATUS_TAKEN;
if ( teamFlag->carried == false && teamFlag->dropped == true ) if ( teamFlag->carried == false && teamFlag->dropped == true )
return FLAGSTATUS_STRAY; return FLAGSTATUS_STRAY;
} }
//assert( !"Invalid flag state." ); //assert( !"Invalid flag state." );
return FLAGSTATUS_NONE; return FLAGSTATUS_NONE;
} }
/* /*
@ -4355,7 +4355,7 @@ void idMultiplayerGame::ReloadScoreboard() {
#ifdef _D3XP #ifdef _D3XP
idStr idMultiplayerGame::GetBestGametype( const char* map, const char* gametype ) { idStr idMultiplayerGame::GetBestGametype( const char* map, const char* gametype ) {
int num = declManager->GetNumDecls( DECL_MAPDEF ); int num = declManager->GetNumDecls( DECL_MAPDEF );
int i, j; int i, j;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -51,7 +51,7 @@ typedef enum {
GAME_TDM, GAME_TDM,
GAME_LASTMAN, GAME_LASTMAN,
#ifdef CTF #ifdef CTF
GAME_CTF, GAME_CTF,
GAME_COUNT, GAME_COUNT,
#endif #endif
} gameType_t; } gameType_t;
@ -60,10 +60,10 @@ typedef enum {
// Used by the UI // Used by the UI
typedef enum { typedef enum {
FLAGSTATUS_INBASE = 0, FLAGSTATUS_INBASE = 0,
FLAGSTATUS_TAKEN = 1, FLAGSTATUS_TAKEN = 1,
FLAGSTATUS_STRAY = 2, FLAGSTATUS_STRAY = 2,
FLAGSTATUS_NONE = 3 FLAGSTATUS_NONE = 3
} flagStatus_t; } flagStatus_t;
#endif #endif
@ -119,7 +119,7 @@ typedef enum {
SND_TWO, SND_TWO,
SND_ONE, SND_ONE,
SND_SUDDENDEATH, SND_SUDDENDEATH,
#ifdef CTF #ifdef CTF
SND_FLAG_CAPTURED_YOURS, SND_FLAG_CAPTURED_YOURS,
SND_FLAG_CAPTURED_THEIRS, SND_FLAG_CAPTURED_THEIRS,
SND_FLAG_RETURN, SND_FLAG_RETURN,
@ -147,7 +147,7 @@ public:
// checks rules and updates state of the mp game // checks rules and updates state of the mp game
void Run( void ); void Run( void );
// draws mp hud, scoredboard, etc.. // draws mp hud, scoredboard, etc..
bool Draw( int clientNum ); bool Draw( int clientNum );
// updates a player vote // updates a player vote
@ -266,7 +266,7 @@ public:
void ProcessVoiceChat( int clientNum, bool team, int index ); void ProcessVoiceChat( int clientNum, bool team, int index );
void Precache( void ); void Precache( void );
// throttle UI switch rates // throttle UI switch rates
void ThrottleUserInfo( void ); void ThrottleUserInfo( void );
void ToggleSpectate( void ); void ToggleSpectate( void );
@ -285,17 +285,17 @@ public:
void ClientReadWarmupTime( const idBitMsg &msg ); void ClientReadWarmupTime( const idBitMsg &msg );
void ServerClientConnect( int clientNum ); void ServerClientConnect( int clientNum );
#ifdef CTF #ifdef CTF
void ClearHUDStatus( void ); void ClearHUDStatus( void );
int GetFlagPoints( int team ); // Team points in CTF int GetFlagPoints( int team ); // Team points in CTF
void SetFlagMsg( bool b ); // allow flag event messages to be sent void SetFlagMsg( bool b ); // allow flag event messages to be sent
bool IsFlagMsgOn( void ); // should flag event messages go through? bool IsFlagMsgOn( void ); // should flag event messages go through?
void ClearGuis( void ); void ClearGuis( void );
int player_red_flag; // Ent num of red flag carrier for HUD int player_red_flag; // Ent num of red flag carrier for HUD
int player_blue_flag; // Ent num of blue flag carrier for HUD int player_blue_flag; // Ent num of blue flag carrier for HUD
#endif #endif
void PlayerStats( int clientNum, char *data, const int len ); void PlayerStats( int clientNum, char *data, const int len );
private: private:
@ -383,15 +383,15 @@ private:
// updates the passed gui with current score information // updates the passed gui with current score information
void UpdateRankColor( idUserInterface *gui, const char *mask, int i, const idVec3 &vec ); void UpdateRankColor( idUserInterface *gui, const char *mask, int i, const idVec3 &vec );
void UpdateScoreboard( idUserInterface *scoreBoard, idPlayer *player ); void UpdateScoreboard( idUserInterface *scoreBoard, idPlayer *player );
#ifdef CTF #ifdef CTF
void UpdateCTFScoreboard( idUserInterface *scoreBoard, idPlayer *player ); void UpdateCTFScoreboard( idUserInterface *scoreBoard, idPlayer *player );
#endif #endif
#ifndef CTF #ifndef CTF
// We declare this publically above so we can call it during a map restart. // We declare this publically above so we can call it during a map restart.
void ClearGuis( void ); void ClearGuis( void );
#endif #endif
void DrawScoreBoard( idPlayer *player ); void DrawScoreBoard( idPlayer *player );
void UpdateHud( idPlayer *player, idUserInterface *hud ); void UpdateHud( idPlayer *player, idUserInterface *hud );
bool Warmup( void ); bool Warmup( void );
@ -436,18 +436,18 @@ private:
#ifdef CTF #ifdef CTF
void FindTeamFlags( void ); void FindTeamFlags( void );
#endif #endif
public: public:
#ifdef CTF #ifdef CTF
idItemTeam * GetTeamFlag( int team ); idItemTeam * GetTeamFlag( int team );
flagStatus_t GetFlagStatus( int team ); flagStatus_t GetFlagStatus( int team );
void TeamScoreCTF( int team, int delta ); void TeamScoreCTF( int team, int delta );
void PlayerScoreCTF( int playerIdx, int delta ); void PlayerScoreCTF( int playerIdx, int delta );
// returns entityNum to team flag carrier, -1 if no flag carrier // returns entityNum to team flag carrier, -1 if no flag carrier
int GetFlagCarrier( int team ); int GetFlagCarrier( int team );
void UpdateScoreboardFlagStatus( void ); void UpdateScoreboardFlagStatus( void );
void SetBestGametype( const char * map ); void SetBestGametype( const char * map );
void ReloadScoreboard(); void ReloadScoreboard();
#endif #endif
@ -460,7 +460,7 @@ public:
bool IsGametypeFlagBased( void ); bool IsGametypeFlagBased( void );
bool IsGametypeTeamBased( void ); bool IsGametypeTeamBased( void );
/* #endif CTF */ /* #endif CTF */
}; };
ID_INLINE idMultiplayerGame::gameState_t idMultiplayerGame::GetGameState( void ) const { ID_INLINE idMultiplayerGame::gameState_t idMultiplayerGame::GetGameState( void ) const {
@ -480,4 +480,3 @@ ID_INLINE bool idMultiplayerGame::IsInGame( int clientNum ) {
} }
#endif /* !__MULTIPLAYERGAME_H__ */ #endif /* !__MULTIPLAYERGAME_H__ */

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -131,9 +131,9 @@ const int MAX_INVENTORY_ITEMS = 20;
#ifdef _D3XP #ifdef _D3XP
idVec3 idPlayer::colorBarTable[ 8 ] = { idVec3 idPlayer::colorBarTable[ 8 ] = {
#else #else
idVec3 idPlayer::colorBarTable[ 5 ] = { idVec3 idPlayer::colorBarTable[ 5 ] = {
#endif #endif
idVec3( 0.25f, 0.25f, 0.25f ), idVec3( 0.25f, 0.25f, 0.25f ),
idVec3( 1.00f, 0.00f, 0.00f ), idVec3( 1.00f, 0.00f, 0.00f ),
@ -169,7 +169,7 @@ void idInventory::Clear( void ) {
// set to -1 so that the gun knows to have a full clip the first time we get it and at the start of the level // set to -1 so that the gun knows to have a full clip the first time we get it and at the start of the level
memset( clip, -1, sizeof( clip ) ); memset( clip, -1, sizeof( clip ) );
items.DeleteContents( true ); items.DeleteContents( true );
memset(pdasViewed, 0, 4 * sizeof( pdasViewed[0] ) ); memset(pdasViewed, 0, 4 * sizeof( pdasViewed[0] ) );
pdas.Clear(); pdas.Clear();
@ -218,7 +218,7 @@ void idInventory::GivePowerUp( idPlayer *player, int powerup, int msec ) {
case MEGAHEALTH: case MEGAHEALTH:
def = gameLocal.FindEntityDef( "powerup_megahealth", false ); def = gameLocal.FindEntityDef( "powerup_megahealth", false );
break; break;
case ADRENALINE: case ADRENALINE:
def = gameLocal.FindEntityDef( "powerup_adrenaline", false ); def = gameLocal.FindEntityDef( "powerup_adrenaline", false );
break; break;
#ifdef _D3XP #ifdef _D3XP
@ -266,7 +266,7 @@ void idInventory::GetPersistantData( idDict &dict ) {
// armor // armor
dict.SetInt( "armor", armor ); dict.SetInt( "armor", armor );
// don't bother with powerups, maxhealth, maxarmor, or the clip // don't bother with powerups, maxhealth, maxarmor, or the clip
// ammo // ammo
for( i = 0; i < AMMO_NUMTYPES; i++ ) { for( i = 0; i < AMMO_NUMTYPES; i++ ) {
@ -502,7 +502,7 @@ void idInventory::Save( idSaveGame *savefile ) const {
savefile->WriteInt( pdasViewed[1] ); savefile->WriteInt( pdasViewed[1] );
savefile->WriteInt( pdasViewed[2] ); savefile->WriteInt( pdasViewed[2] );
savefile->WriteInt( pdasViewed[3] ); savefile->WriteInt( pdasViewed[3] );
savefile->WriteInt( selPDA ); savefile->WriteInt( selPDA );
savefile->WriteInt( selVideo ); savefile->WriteInt( selVideo );
savefile->WriteInt( selEMail ); savefile->WriteInt( selEMail );
@ -610,7 +610,7 @@ void idInventory::Restore( idRestoreGame *savefile ) {
savefile->ReadInt( pdasViewed[1] ); savefile->ReadInt( pdasViewed[1] );
savefile->ReadInt( pdasViewed[2] ); savefile->ReadInt( pdasViewed[2] );
savefile->ReadInt( pdasViewed[3] ); savefile->ReadInt( pdasViewed[3] );
savefile->ReadInt( selPDA ); savefile->ReadInt( selPDA );
savefile->ReadInt( selVideo ); savefile->ReadInt( selVideo );
savefile->ReadInt( selEMail ); savefile->ReadInt( selEMail );
@ -691,7 +691,7 @@ void idInventory::Restore( idRestoreGame *savefile ) {
for(i = 0; i < AMMO_NUMTYPES; i++) { for(i = 0; i < AMMO_NUMTYPES; i++) {
savefile->ReadInt(rechargeAmmo[i].ammo); savefile->ReadInt(rechargeAmmo[i].ammo);
savefile->ReadInt(rechargeAmmo[i].rechargeTime); savefile->ReadInt(rechargeAmmo[i].rechargeTime);
idStr name; idStr name;
savefile->ReadString(name); savefile->ReadString(name);
strcpy(rechargeAmmo[i].ammoName, name); strcpy(rechargeAmmo[i].ammoName, name);
@ -796,7 +796,7 @@ void idInventory::AddPickupName( const char *name, const char *icon, idPlayer* o
msg.WriteString( name, MAX_EVENT_PARAM_SIZE ); msg.WriteString( name, MAX_EVENT_PARAM_SIZE );
owner->ServerSendEvent( idPlayer::EVENT_PICKUPNAME, &msg, false, -1 ); owner->ServerSendEvent( idPlayer::EVENT_PICKUPNAME, &msg, false, -1 );
} }
} }
#endif #endif
} }
@ -820,7 +820,7 @@ bool idInventory::Give( idPlayer *owner, const idDict &spawnArgs, const char *st
#ifdef _D3XP #ifdef _D3XP
if ( !idStr::Icmp( statname, "ammo_bloodstone" ) ) { if ( !idStr::Icmp( statname, "ammo_bloodstone" ) ) {
i = AmmoIndexForAmmoClass( statname ); i = AmmoIndexForAmmoClass( statname );
max = MaxAmmoForAmmoClass( owner, statname ); max = MaxAmmoForAmmoClass( owner, statname );
if(max <= 0) { if(max <= 0) {
@ -848,7 +848,7 @@ bool idInventory::Give( idPlayer *owner, const idDict &spawnArgs, const char *st
return false; return false;
} }
amount = atoi( value ); amount = atoi( value );
if ( amount ) { if ( amount ) {
ammo[ i ] += amount; ammo[ i ] += amount;
if ( ( max > 0 ) && ( ammo[ i ] > max ) ) { if ( ( max > 0 ) && ( ammo[ i ] > max ) ) {
ammo[ i ] = max; ammo[ i ] = max;
@ -948,7 +948,7 @@ bool idInventory::Give( idPlayer *owner, const idDict &spawnArgs, const char *st
if ( owner->GetUserInfo()->GetBool( "ui_autoSwitch" ) && idealWeapon && i != owner->weapon_bloodstone_active1 && i != owner->weapon_bloodstone_active2 && i != owner->weapon_bloodstone_active3) { if ( owner->GetUserInfo()->GetBool( "ui_autoSwitch" ) && idealWeapon && i != owner->weapon_bloodstone_active1 && i != owner->weapon_bloodstone_active2 && i != owner->weapon_bloodstone_active3) {
assert( !gameLocal.isClient ); assert( !gameLocal.isClient );
*idealWeapon = i; *idealWeapon = i;
} }
if ( owner->hud && updateHud && lastGiveTime + 1000 < gameLocal.time ) { if ( owner->hud && updateHud && lastGiveTime + 1000 < gameLocal.time ) {
owner->hud->SetStateInt( "newWeapon", i ); owner->hud->SetStateInt( "newWeapon", i );
owner->hud->HandleNamedEvent( "newWeapon" ); owner->hud->HandleNamedEvent( "newWeapon" );
@ -1043,7 +1043,7 @@ int idInventory::HasAmmo( const char *weapon_classname, bool includeClip, idPlay
#endif #endif
} }
#ifdef _D3XP #ifdef _D3XP
/* /*
=============== ===============
@ -1051,7 +1051,7 @@ idInventory::HasEmptyClipCannotRefill
=============== ===============
*/ */
bool idInventory::HasEmptyClipCannotRefill(const char *weapon_classname, idPlayer* owner) { bool idInventory::HasEmptyClipCannotRefill(const char *weapon_classname, idPlayer* owner) {
int clipSize = clip[owner->SlotForWeapon(weapon_classname)]; int clipSize = clip[owner->SlotForWeapon(weapon_classname)];
if(clipSize) { if(clipSize) {
return false; return false;
@ -1257,9 +1257,9 @@ idPlayer::idPlayer() {
forcedReady = false; forcedReady = false;
wantSpectate = false; wantSpectate = false;
#ifdef CTF #ifdef CTF
carryingFlag = false; carryingFlag = false;
#endif #endif
lastHitToggle = false; lastHitToggle = false;
@ -1349,7 +1349,7 @@ idPlayer::idPlayer() {
talkCursor = 0; talkCursor = 0;
focusVehicle = NULL; focusVehicle = NULL;
cursor = NULL; cursor = NULL;
oldMouseX = 0; oldMouseX = 0;
oldMouseY = 0; oldMouseY = 0;
@ -1678,7 +1678,7 @@ void idPlayer::Init( void ) {
// execute the script so the script object's constructor takes effect immediately // execute the script so the script object's constructor takes effect immediately
scriptThread->Execute(); scriptThread->Execute();
forceScoreBoard = false; forceScoreBoard = false;
forcedReady = false; forcedReady = false;
@ -1759,11 +1759,11 @@ void idPlayer::Spawn( void ) {
if ( hud ) { if ( hud ) {
hud->Activate( true, gameLocal.time ); hud->Activate( true, gameLocal.time );
#ifdef CTF #ifdef CTF
if ( gameLocal.mpGame.IsGametypeFlagBased() ) { if ( gameLocal.mpGame.IsGametypeFlagBased() ) {
hud->SetStateInt( "red_team_score", gameLocal.mpGame.GetFlagPoints(0) ); hud->SetStateInt( "red_team_score", gameLocal.mpGame.GetFlagPoints(0) );
hud->SetStateInt( "blue_team_score", gameLocal.mpGame.GetFlagPoints(1) ); hud->SetStateInt( "blue_team_score", gameLocal.mpGame.GetFlagPoints(1) );
} }
#endif #endif
} }
// load cursor // load cursor
@ -1876,7 +1876,7 @@ void idPlayer::Spawn( void ) {
} else { } else {
hiddenWeapon = false; hiddenWeapon = false;
} }
if ( hud ) { if ( hud ) {
UpdateHudWeapon(); UpdateHudWeapon();
hud->StateChanged( gameLocal.time ); hud->StateChanged( gameLocal.time );
@ -1986,7 +1986,7 @@ idPlayer::~idPlayer() {
enviroSuitLight.GetEntity()->ProcessEvent( &EV_Remove ); enviroSuitLight.GetEntity()->ProcessEvent( &EV_Remove );
} }
// have to do this here, idMultiplayerGame::DisconnectClient() is too late // have to do this here, idMultiplayerGame::DisconnectClient() is too late
if ( gameLocal.isMultiplayer && gameLocal.mpGame.IsGametypeFlagBased() ) { if ( gameLocal.isMultiplayer && gameLocal.mpGame.IsGametypeFlagBased() ) {
ReturnFlag(); ReturnFlag();
} }
#endif #endif
@ -2040,8 +2040,8 @@ void idPlayer::Save( idSaveGame *savefile ) const {
savefile->WriteInt( hudPowerup ); savefile->WriteInt( hudPowerup );
savefile->WriteInt( lastHudPowerup ); savefile->WriteInt( lastHudPowerup );
savefile->WriteInt( hudPowerupDuration ); savefile->WriteInt( hudPowerupDuration );
#endif #endif
savefile->WriteInt( heartRate ); savefile->WriteInt( heartRate );
@ -2300,8 +2300,8 @@ void idPlayer::Restore( idRestoreGame *savefile ) {
savefile->ReadInt( hudPowerup ); savefile->ReadInt( hudPowerup );
savefile->ReadInt( lastHudPowerup ); savefile->ReadInt( lastHudPowerup );
savefile->ReadInt( hudPowerupDuration ); savefile->ReadInt( hudPowerupDuration );
#endif #endif
savefile->ReadInt( heartRate ); savefile->ReadInt( heartRate );
@ -2540,17 +2540,17 @@ void idPlayer::PrepareForRestart( void ) {
ClearPowerUps(); ClearPowerUps();
Spectate( true ); Spectate( true );
forceRespawn = true; forceRespawn = true;
#ifdef CTF #ifdef CTF
// Confirm reset hud states // Confirm reset hud states
DropFlag(); DropFlag();
if ( hud ) { if ( hud ) {
hud->SetStateInt( "red_flagstatus", 0 ); hud->SetStateInt( "red_flagstatus", 0 );
hud->SetStateInt( "blue_flagstatus", 0 ); hud->SetStateInt( "blue_flagstatus", 0 );
} }
#endif #endif
// we will be restarting program, clear the client entities from program-related things first // we will be restarting program, clear the client entities from program-related things first
ShutdownThreads(); ShutdownThreads();
@ -2565,7 +2565,7 @@ idPlayer::Restart
*/ */
void idPlayer::Restart( void ) { void idPlayer::Restart( void ) {
idActor::Restart(); idActor::Restart();
// client needs to setup the animation script object again // client needs to setup the animation script object again
if ( gameLocal.isClient ) { if ( gameLocal.isClient ) {
Init(); Init();
@ -2604,7 +2604,7 @@ void idPlayer::ServerSpectate( bool spectate ) {
} }
#ifdef CTF #ifdef CTF
// drop the flag if player was carrying it // drop the flag if player was carrying it
if ( spectate && gameLocal.isMultiplayer && gameLocal.mpGame.IsGametypeFlagBased() && if ( spectate && gameLocal.isMultiplayer && gameLocal.mpGame.IsGametypeFlagBased() &&
carryingFlag ) carryingFlag )
{ {
DropFlag(); DropFlag();
@ -2649,7 +2649,7 @@ Chooses a spawn location and spawns the player
void idPlayer::SpawnFromSpawnSpot( void ) { void idPlayer::SpawnFromSpawnSpot( void ) {
idVec3 spawn_origin; idVec3 spawn_origin;
idAngles spawn_angles; idAngles spawn_angles;
SelectInitialSpawnPoint( spawn_origin, spawn_angles ); SelectInitialSpawnPoint( spawn_origin, spawn_angles );
SpawnToPoint( spawn_origin, spawn_angles ); SpawnToPoint( spawn_origin, spawn_angles );
} }
@ -2935,7 +2935,7 @@ bool idPlayer::UserInfoChanged( bool canModify ) {
if ( canModify && spec ) { if ( canModify && spec ) {
userInfo->Set( "ui_spectate", "Play" ); userInfo->Set( "ui_spectate", "Play" );
modifiedInfo |= true; modifiedInfo |= true;
} else if ( spectating ) { } else if ( spectating ) {
// allow player to leaving spectator mode if they were in it when si_spectators got turned off // allow player to leaving spectator mode if they were in it when si_spectators got turned off
forceRespawn = true; forceRespawn = true;
} }
@ -2989,7 +2989,7 @@ void idPlayer::UpdateHudAmmo( idUserInterface *_hud ) {
// show infinite ammo // show infinite ammo
_hud->SetStateString( "player_ammo", "" ); _hud->SetStateString( "player_ammo", "" );
_hud->SetStateString( "player_totalammo", "" ); _hud->SetStateString( "player_totalammo", "" );
} else { } else {
// show remaining ammo // show remaining ammo
#ifdef _D3XP #ifdef _D3XP
_hud->SetStateString( "player_totalammo", va( "%i", ammoamount ) ); _hud->SetStateString( "player_totalammo", va( "%i", ammoamount ) );
@ -3004,7 +3004,7 @@ void idPlayer::UpdateHudAmmo( idUserInterface *_hud ) {
#else #else
_hud->SetStateString( "player_allammo", va( "%i/%i", inclip, ammoamount - inclip ) ); _hud->SetStateString( "player_allammo", va( "%i/%i", inclip, ammoamount - inclip ) );
#endif #endif
} }
_hud->SetStateBool( "player_ammo_empty", ( ammoamount == 0 ) ); _hud->SetStateBool( "player_ammo_empty", ( ammoamount == 0 ) );
_hud->SetStateBool( "player_clip_empty", ( weapon.GetEntity()->ClipSize() ? inclip == 0 : false ) ); _hud->SetStateBool( "player_clip_empty", ( weapon.GetEntity()->ClipSize() ? inclip == 0 : false ) );
@ -3059,7 +3059,7 @@ void idPlayer::UpdateHudStats( idUserInterface *_hud ) {
_hud->SetStateInt( "player_stamina", staminapercentage ); _hud->SetStateInt( "player_stamina", staminapercentage );
_hud->SetStateInt( "player_armor", inventory.armor ); _hud->SetStateInt( "player_armor", inventory.armor );
_hud->SetStateInt( "player_hr", heartRate ); _hud->SetStateInt( "player_hr", heartRate );
_hud->SetStateInt( "player_nostamina", ( max_stamina == 0 ) ? 1 : 0 ); _hud->SetStateInt( "player_nostamina", ( max_stamina == 0 ) ? 1 : 0 );
_hud->HandleNamedEvent( "updateArmorHealthAir" ); _hud->HandleNamedEvent( "updateArmorHealthAir" );
@ -3080,7 +3080,7 @@ void idPlayer::UpdateHudStats( idUserInterface *_hud ) {
healthTake = false; healthTake = false;
} }
if ( inventory.ammoPulse ) { if ( inventory.ammoPulse ) {
_hud->HandleNamedEvent( "ammoPulse" ); _hud->HandleNamedEvent( "ammoPulse" );
inventory.ammoPulse = false; inventory.ammoPulse = false;
} }
@ -3092,28 +3092,28 @@ void idPlayer::UpdateHudStats( idUserInterface *_hud ) {
_hud->HandleNamedEvent( "weaponPulse" ); _hud->HandleNamedEvent( "weaponPulse" );
inventory.weaponPulse = false; inventory.weaponPulse = false;
} }
if ( inventory.armorPulse ) { if ( inventory.armorPulse ) {
_hud->HandleNamedEvent( "armorPulse" ); _hud->HandleNamedEvent( "armorPulse" );
inventory.armorPulse = false; inventory.armorPulse = false;
} }
#ifdef CTF #ifdef CTF
if ( gameLocal.mpGame.IsGametypeFlagBased() && _hud ) if ( gameLocal.mpGame.IsGametypeFlagBased() && _hud )
{ {
_hud->SetStateInt( "red_flagstatus", gameLocal.mpGame.GetFlagStatus( 0 ) ); _hud->SetStateInt( "red_flagstatus", gameLocal.mpGame.GetFlagStatus( 0 ) );
_hud->SetStateInt( "blue_flagstatus", gameLocal.mpGame.GetFlagStatus( 1 ) ); _hud->SetStateInt( "blue_flagstatus", gameLocal.mpGame.GetFlagStatus( 1 ) );
_hud->SetStateInt( "red_team_score", gameLocal.mpGame.GetFlagPoints( 0 ) ); _hud->SetStateInt( "red_team_score", gameLocal.mpGame.GetFlagPoints( 0 ) );
_hud->SetStateInt( "blue_team_score", gameLocal.mpGame.GetFlagPoints( 1 ) ); _hud->SetStateInt( "blue_team_score", gameLocal.mpGame.GetFlagPoints( 1 ) );
_hud->HandleNamedEvent( "RedFlagStatusChange" ); _hud->HandleNamedEvent( "RedFlagStatusChange" );
_hud->HandleNamedEvent( "BlueFlagStatusChange" ); _hud->HandleNamedEvent( "BlueFlagStatusChange" );
} }
_hud->HandleNamedEvent( "selfTeam" ); _hud->HandleNamedEvent( "selfTeam" );
#endif #endif
UpdateHudAmmo( _hud ); UpdateHudAmmo( _hud );
} }
@ -3233,9 +3233,9 @@ void idPlayer::EnterCinematic( void ) {
if ( hud ) { if ( hud ) {
hud->HandleNamedEvent( "radioChatterDown" ); hud->HandleNamedEvent( "radioChatterDown" );
} }
physicsObj.SetLinearVelocity( vec3_origin ); physicsObj.SetLinearVelocity( vec3_origin );
SetState( "EnterCinematic" ); SetState( "EnterCinematic" );
UpdateScript(); UpdateScript();
@ -3430,7 +3430,7 @@ void idPlayer::CacheWeapons( void ) {
if ( !inventory.weapons ) { if ( !inventory.weapons ) {
return; return;
} }
for( w = 0; w < MAX_WEAPONS; w++ ) { for( w = 0; w < MAX_WEAPONS; w++ ) {
if ( inventory.weapons & ( 1 << w ) ) { if ( inventory.weapons & ( 1 << w ) ) {
weap = spawnArgs.GetString( va( "def_weapon%d", w ) ); weap = spawnArgs.GetString( va( "def_weapon%d", w ) );
@ -3503,11 +3503,11 @@ bool idPlayer::Give( const char *statname, const char *value ) {
} else { } else {
bool ret = inventory.Give( this, spawnArgs, statname, value, &idealWeapon, true ); bool ret = inventory.Give( this, spawnArgs, statname, value, &idealWeapon, true );
if(!idStr::Icmp( statname, "ammo_bloodstone" ) ) { if(!idStr::Icmp( statname, "ammo_bloodstone" ) ) {
//int i = inventory.AmmoIndexForAmmoClass( statname ); //int i = inventory.AmmoIndexForAmmoClass( statname );
//int max = inventory.MaxAmmoForAmmoClass( this, statname ); //int max = inventory.MaxAmmoForAmmoClass( this, statname );
//if(hud && inventory.ammo[ i ] >= max) { //if(hud && inventory.ammo[ i ] >= max) {
if(hud) { if(hud) {
//Force an update of the bloodstone ammount //Force an update of the bloodstone ammount
int ammoRequired; int ammoRequired;
ammo_t ammo_i = inventory.AmmoIndexForWeaponClass( "weapon_bloodstone_passive", &ammoRequired ); ammo_t ammo_i = inventory.AmmoIndexForWeaponClass( "weapon_bloodstone_passive", &ammoRequired );
@ -3536,7 +3536,7 @@ adds health to the player health pool
=============== ===============
*/ */
void idPlayer::GiveHealthPool( float amt ) { void idPlayer::GiveHealthPool( float amt ) {
if ( AI_DEAD ) { if ( AI_DEAD ) {
return; return;
} }
@ -3569,7 +3569,7 @@ bool idPlayer::GiveItem( idItem *item ) {
} }
item->GetAttributes( attr ); item->GetAttributes( attr );
gave = false; gave = false;
numPickup = inventory.pickupItemNames.Num(); numPickup = inventory.pickupItemNames.Num();
for( i = 0; i < attr.GetNumKeyVals(); i++ ) { for( i = 0; i < attr.GetNumKeyVals(); i++ ) {
@ -3643,7 +3643,7 @@ float idPlayer::PowerUpModifier( int type ) {
} }
} }
}*/ }*/
#endif #endif
} }
return mod; return mod;
@ -3696,7 +3696,7 @@ bool idPlayer::GivePowerUp( int powerup, int time ) {
StartSoundShader( declManager->FindSound( sound ), SND_CHANNEL_DEMONIC, 0, false, NULL ); StartSoundShader( declManager->FindSound( sound ), SND_CHANNEL_DEMONIC, 0, false, NULL );
} }
} }
if ( baseSkinName.Length() ) { if ( baseSkinName.Length() ) {
powerUpSkin = declManager->FindSkin( baseSkinName + "_berserk" ); powerUpSkin = declManager->FindSkin( baseSkinName + "_berserk" );
@ -3813,7 +3813,7 @@ bool idPlayer::GivePowerUp( int powerup, int time ) {
if(gameLocal.isMultiplayer && !gameLocal.isClient) { if(gameLocal.isMultiplayer && !gameLocal.isClient) {
inventory.AddPickupName("#str_00100631", "", this); inventory.AddPickupName("#str_00100631", "", this);
} }
if ( baseSkinName.Length() ) { if ( baseSkinName.Length() ) {
powerUpSkin = declManager->FindSkin( baseSkinName + "_haste" ); powerUpSkin = declManager->FindSkin( baseSkinName + "_haste" );
} }
@ -3877,7 +3877,7 @@ void idPlayer::ClearPowerup( int i ) {
break; break;
} }
case ENVIROSUIT: { case ENVIROSUIT: {
hudPowerup = -1; hudPowerup = -1;
// Turn off the envirosuit sound // Turn off the envirosuit sound
@ -3978,7 +3978,7 @@ void idPlayer::UpdatePowerUps( void ) {
#ifndef ID_DEMO_BUILD #ifndef ID_DEMO_BUILD
if ( !gameLocal.inCinematic && influenceActive == 0 && g_skill.GetInteger() == 3 && gameLocal.time > nextHealthTake && !AI_DEAD && health > g_healthTakeLimit.GetInteger() ) { if ( !gameLocal.inCinematic && influenceActive == 0 && g_skill.GetInteger() == 3 && gameLocal.time > nextHealthTake && !AI_DEAD && health > g_healthTakeLimit.GetInteger() ) {
assert( !gameLocal.isClient ); // healthPool never be set on client assert( !gameLocal.isClient ); // healthPool never be set on client
#ifdef _D3XP #ifdef _D3XP
if(!PowerUpActive(INVULNERABILITY)) { if(!PowerUpActive(INVULNERABILITY)) {
#endif #endif
@ -4388,13 +4388,13 @@ void idPlayer::NextBestWeapon( void ) {
} }
#ifdef _D3XP #ifdef _D3XP
//Some weapons will report having ammo but the clip is empty and //Some weapons will report having ammo but the clip is empty and
//will not have enough to fill the clip (i.e. Double Barrel Shotgun with 1 round left) //will not have enough to fill the clip (i.e. Double Barrel Shotgun with 1 round left)
//We need to skip these weapons because they cannot be used //We need to skip these weapons because they cannot be used
if(inventory.HasEmptyClipCannotRefill(weap, this)) { if(inventory.HasEmptyClipCannotRefill(weap, this)) {
continue; continue;
} }
#endif #endif
break; break;
} }
@ -4425,13 +4425,13 @@ void idPlayer::NextWeapon( void ) {
if ( !inventory.weapons ) { if ( !inventory.weapons ) {
return; return;
} }
w = idealWeapon; w = idealWeapon;
while( 1 ) { while( 1 ) {
w++; w++;
if ( w >= MAX_WEAPONS ) { if ( w >= MAX_WEAPONS ) {
w = 0; w = 0;
} }
weap = spawnArgs.GetString( va( "def_weapon%d", w ) ); weap = spawnArgs.GetString( va( "def_weapon%d", w ) );
if ( !spawnArgs.GetBool( va( "weapon%d_cycle", w ) ) ) { if ( !spawnArgs.GetBool( va( "weapon%d_cycle", w ) ) ) {
continue; continue;
@ -4542,7 +4542,7 @@ void idPlayer::SelectWeapon( int num, bool force ) {
} else { } else {
weapon.GetEntity()->RaiseWeapon(); weapon.GetEntity()->RaiseWeapon();
} }
} }
weap = spawnArgs.GetString( va( "def_weapon%d", num ) ); weap = spawnArgs.GetString( va( "def_weapon%d", num ) );
if ( !weap[ 0 ] ) { if ( !weap[ 0 ] ) {
@ -4578,7 +4578,7 @@ void idPlayer::SelectWeapon( int num, bool force ) {
} }
for(int i = 0; i < weaponToggle->toggleList.Num(); i++) { for(int i = 0; i < weaponToggle->toggleList.Num(); i++) {
//Is it available //Is it available
if(inventory.weapons & ( 1 << weaponToggle->toggleList[weaponToggleIndex])) { if(inventory.weapons & ( 1 << weaponToggle->toggleList[weaponToggleIndex])) {
break; break;
@ -4632,11 +4632,11 @@ void idPlayer::DropWeapon( bool died ) {
int inclip, ammoavailable; int inclip, ammoavailable;
assert( !gameLocal.isClient ); assert( !gameLocal.isClient );
if ( spectating || weaponGone || weapon.GetEntity() == NULL ) { if ( spectating || weaponGone || weapon.GetEntity() == NULL ) {
return; return;
} }
if ( ( !died && !weapon.GetEntity()->IsReady() ) || weapon.GetEntity()->IsReloading() ) { if ( ( !died && !weapon.GetEntity()->IsReady() ) || weapon.GetEntity()->IsReloading() ) {
return; return;
} }
@ -4644,7 +4644,7 @@ void idPlayer::DropWeapon( bool died ) {
// inclip is which amount is in clip right now // inclip is which amount is in clip right now
ammoavailable = weapon.GetEntity()->AmmoAvailable(); ammoavailable = weapon.GetEntity()->AmmoAvailable();
inclip = weapon.GetEntity()->AmmoInClip(); inclip = weapon.GetEntity()->AmmoInClip();
// don't drop a grenade if we have none left // don't drop a grenade if we have none left
if ( !idStr::Icmp( idWeapon::GetAmmoNameForNum( weapon.GetEntity()->GetAmmoType() ), "ammo_grenades" ) && ( ammoavailable - inclip <= 0 ) ) { if ( !idStr::Icmp( idWeapon::GetAmmoNameForNum( weapon.GetEntity()->GetAmmoType() ), "ammo_grenades" ) && ( ammoavailable - inclip <= 0 ) ) {
return; return;
@ -4811,7 +4811,7 @@ void idPlayer::Weapon_Combat( void ) {
SetState( newstate ); SetState( newstate );
UpdateScript(); UpdateScript();
} }
weaponCatchup = false; weaponCatchup = false;
} else { } else {
if ( weapon.GetEntity()->IsReady() ) { if ( weapon.GetEntity()->IsReady() ) {
weapon.GetEntity()->PutAway(); weapon.GetEntity()->PutAway();
@ -4834,7 +4834,7 @@ void idPlayer::Weapon_Combat( void ) {
} }
} }
} else { } else {
weaponGone = false; // if you drop and re-get weap, you may miss the = false above weaponGone = false; // if you drop and re-get weap, you may miss the = false above
if ( weapon.GetEntity()->IsHolstered() ) { if ( weapon.GetEntity()->IsHolstered() ) {
if ( !weapon.GetEntity()->AmmoAvailable() ) { if ( !weapon.GetEntity()->AmmoAvailable() ) {
// weapons can switch automatically if they have no more ammo // weapons can switch automatically if they have no more ammo
@ -5008,7 +5008,7 @@ void idPlayer::UpdateWeapon( void ) {
if ( hiddenWeapon && tipUp && usercmd.buttons & BUTTON_ATTACK ) { if ( hiddenWeapon && tipUp && usercmd.buttons & BUTTON_ATTACK ) {
HideTip(); HideTip();
} }
if ( g_dragEntity.GetBool() ) { if ( g_dragEntity.GetBool() ) {
StopFiring(); StopFiring();
weapon.GetEntity()->LowerWeapon(); weapon.GetEntity()->LowerWeapon();
@ -5016,12 +5016,12 @@ void idPlayer::UpdateWeapon( void ) {
} else if ( ActiveGui() ) { } else if ( ActiveGui() ) {
// gui handling overrides weapon use // gui handling overrides weapon use
Weapon_GUI(); Weapon_GUI();
} else if ( focusCharacter && ( focusCharacter->health > 0 ) ) { } else if ( focusCharacter && ( focusCharacter->health > 0 ) ) {
Weapon_NPC(); Weapon_NPC();
} else { } else {
Weapon_Combat(); Weapon_Combat();
} }
if ( hiddenWeapon ) { if ( hiddenWeapon ) {
weapon.GetEntity()->LowerWeapon(); weapon.GetEntity()->LowerWeapon();
} }
@ -5063,7 +5063,7 @@ void idPlayer::SpectateFreeFly( bool force ) {
idAngles angle = player->viewAngles; idAngles angle = player->viewAngles;
angle[ 2 ] = 0; angle[ 2 ] = 0;
SetViewAngles( angle ); SetViewAngles( angle );
} else { } else {
SelectInitialSpawnPoint( spawn_origin, spawn_angles ); SelectInitialSpawnPoint( spawn_origin, spawn_angles );
spawn_origin[ 2 ] += pm_normalviewheight.GetFloat(); spawn_origin[ 2 ] += pm_normalviewheight.GetFloat();
spawn_origin[ 2 ] += SPECTATE_RAISE; spawn_origin[ 2 ] += SPECTATE_RAISE;
@ -5257,7 +5257,7 @@ bool idPlayer::Collide( const trace_t &collision, const idVec3 &velocity ) {
================ ================
idPlayer::UpdateLocation idPlayer::UpdateLocation
Searches nearby locations Searches nearby locations
================ ================
*/ */
void idPlayer::UpdateLocation( void ) { void idPlayer::UpdateLocation( void ) {
@ -5440,7 +5440,7 @@ void idPlayer::UpdateFocus( void ) {
} else { } else {
ui = focusGUIrenderEntity->gui[ 2 ]; ui = focusGUIrenderEntity->gui[ 2 ];
} }
if ( ui == NULL ) { if ( ui == NULL ) {
continue; continue;
} }
@ -5504,7 +5504,7 @@ void idPlayer::UpdateFocus( void ) {
// clamp the mouse to the corner // clamp the mouse to the corner
ev = sys->GenerateMouseMoveEvent( -2000, -2000 ); ev = sys->GenerateMouseMoveEvent( -2000, -2000 );
command = focusUI->HandleEvent( &ev, gameLocal.time ); command = focusUI->HandleEvent( &ev, gameLocal.time );
HandleGuiCommands( focusGUIent, command ); HandleGuiCommands( focusGUIent, command );
// move to an absolute position // move to an absolute position
ev = sys->GenerateMouseMoveEvent( pt.x * SCREEN_WIDTH, pt.y * SCREEN_HEIGHT ); ev = sys->GenerateMouseMoveEvent( pt.x * SCREEN_WIDTH, pt.y * SCREEN_HEIGHT );
@ -5747,7 +5747,7 @@ void idPlayer::BobCycle( const idVec3 &pushVelocity ) {
// add angles based on velocity // add angles based on velocity
delta = velocity * viewaxis[0]; delta = velocity * viewaxis[0];
viewBobAngles.pitch += delta * pm_runpitch.GetFloat(); viewBobAngles.pitch += delta * pm_runpitch.GetFloat();
delta = velocity * viewaxis[1]; delta = velocity * viewaxis[1];
viewBobAngles.roll -= delta * pm_runroll.GetFloat(); viewBobAngles.roll -= delta * pm_runroll.GetFloat();
@ -5943,10 +5943,10 @@ Being at less than 25% stamina adds 5 beats per second up to ZEROSTAMINA_HEARTRA
All heartrates are target rates.. the heart rate will start falling as soon as there have been no adjustments for 5 seconds All heartrates are target rates.. the heart rate will start falling as soon as there have been no adjustments for 5 seconds
Once it starts falling it always tries to get to DEF_HEARTRATE Once it starts falling it always tries to get to DEF_HEARTRATE
The exception to the above rule is upon death at which point the rate is set to DYING_HEARTRATE and starts falling The exception to the above rule is upon death at which point the rate is set to DYING_HEARTRATE and starts falling
immediately to zero immediately to zero
Heart rate volumes go from zero ( -40 db for DEF_HEARTRATE to 5 db for MAX_HEARTRATE ) the volume is Heart rate volumes go from zero ( -40 db for DEF_HEARTRATE to 5 db for MAX_HEARTRATE ) the volume is
scaled linearly based on the actual rate scaled linearly based on the actual rate
Exception to the above rule is once the player is dead, the dying heart rate starts at either the current volume if Exception to the above rule is once the player is dead, the dying heart rate starts at either the current volume if
@ -5963,7 +5963,7 @@ void idPlayer::AdjustHeartRate( int target, float timeInSecs, float delay, bool
return; return;
} }
lastHeartAdjust = gameLocal.time; lastHeartAdjust = gameLocal.time;
heartInfo.Init( gameLocal.time + delay * 1000, timeInSecs * 1000, heartRate, target ); heartInfo.Init( gameLocal.time + delay * 1000, timeInSecs * 1000, heartRate, target );
} }
@ -6017,7 +6017,7 @@ void idPlayer::SetCurrentHeartRate( void ) {
pct = 0.0f; pct = 0.0f;
} }
pct *= ((float)deathVol - (float)zeroVol); pct *= ((float)deathVol - (float)zeroVol);
} }
pct += (float)zeroVol; pct += (float)zeroVol;
@ -6039,7 +6039,7 @@ void idPlayer::SetCurrentHeartRate( void ) {
idPlayer::UpdateAir idPlayer::UpdateAir
============== ==============
*/ */
void idPlayer::UpdateAir( void ) { void idPlayer::UpdateAir( void ) {
if ( health <= 0 ) { if ( health <= 0 ) {
return; return;
} }
@ -6089,7 +6089,7 @@ void idPlayer::UpdateAir( void ) {
lastAirDamage = gameLocal.time; lastAirDamage = gameLocal.time;
} }
} }
} else { } else {
if ( airless ) { if ( airless ) {
StartSound( "snd_recompress", SND_CHANNEL_ANY, SSF_GLOBAL, false, NULL ); StartSound( "snd_recompress", SND_CHANNEL_ANY, SSF_GLOBAL, false, NULL );
@ -6112,13 +6112,13 @@ void idPlayer::UpdateAir( void ) {
} }
void idPlayer::UpdatePowerupHud() { void idPlayer::UpdatePowerupHud() {
if ( health <= 0 ) { if ( health <= 0 ) {
return; return;
} }
if(lastHudPowerup != hudPowerup) { if(lastHudPowerup != hudPowerup) {
if(hudPowerup == -1) { if(hudPowerup == -1) {
//The powerup hud should be turned off //The powerup hud should be turned off
if ( hud ) { if ( hud ) {
@ -6138,7 +6138,7 @@ void idPlayer::UpdatePowerupHud() {
if(PowerUpActive(hudPowerup)) { if(PowerUpActive(hudPowerup)) {
int remaining = inventory.powerupEndTime[ hudPowerup ] - gameLocal.time; int remaining = inventory.powerupEndTime[ hudPowerup ] - gameLocal.time;
int filledbar = idMath::ClampInt( 0, hudPowerupDuration, remaining ); int filledbar = idMath::ClampInt( 0, hudPowerupDuration, remaining );
if ( hud ) { if ( hud ) {
hud->SetStateInt( "player_powerup", 100 * filledbar / hudPowerupDuration ); hud->SetStateInt( "player_powerup", 100 * filledbar / hudPowerupDuration );
hud->SetStateInt( "player_poweruptime", remaining / 1000 ); hud->SetStateInt( "player_poweruptime", remaining / 1000 );
@ -6708,7 +6708,7 @@ void idPlayer::PerformImpulse( int impulse ) {
break; break;
} }
#endif #endif
} }
} }
bool idPlayer::HandleESC( void ) { bool idPlayer::HandleESC( void ) {
@ -6796,7 +6796,7 @@ void idPlayer::AdjustSpeed( void ) {
speed = pm_walkspeed.GetFloat() * ( 1.0f - bobFrac ) + pm_runspeed.GetFloat() * bobFrac; speed = pm_walkspeed.GetFloat() * ( 1.0f - bobFrac ) + pm_runspeed.GetFloat() * bobFrac;
} else { } else {
rate = pm_staminarate.GetFloat(); rate = pm_staminarate.GetFloat();
// increase 25% faster when not moving // increase 25% faster when not moving
if ( ( usercmd.forwardmove == 0 ) && ( usercmd.rightmove == 0 ) && ( !physicsObj.OnLadder() || ( usercmd.upmove == 0 ) ) ) { if ( ( usercmd.forwardmove == 0 ) && ( usercmd.rightmove == 0 ) && ( !physicsObj.OnLadder() || ( usercmd.upmove == 0 ) ) ) {
rate *= 1.25f; rate *= 1.25f;
@ -6904,7 +6904,7 @@ void idPlayer::AdjustBodyAngles( void ) {
upBlend = -frac; upBlend = -frac;
} }
animator.CurrentAnim( ANIMCHANNEL_TORSO )->SetSyncedAnimWeight( 0, downBlend ); animator.CurrentAnim( ANIMCHANNEL_TORSO )->SetSyncedAnimWeight( 0, downBlend );
animator.CurrentAnim( ANIMCHANNEL_TORSO )->SetSyncedAnimWeight( 1, forwardBlend ); animator.CurrentAnim( ANIMCHANNEL_TORSO )->SetSyncedAnimWeight( 1, forwardBlend );
animator.CurrentAnim( ANIMCHANNEL_TORSO )->SetSyncedAnimWeight( 2, upBlend ); animator.CurrentAnim( ANIMCHANNEL_TORSO )->SetSyncedAnimWeight( 2, upBlend );
@ -6930,7 +6930,7 @@ void idPlayer::InitAASLocation( void ) {
num = gameLocal.NumAAS(); num = gameLocal.NumAAS();
aasLocation.SetGranularity( 1 ); aasLocation.SetGranularity( 1 );
aasLocation.SetNum( num ); aasLocation.SetNum( num );
for( i = 0; i < aasLocation.Num(); i++ ) { for( i = 0; i < aasLocation.Num(); i++ ) {
aasLocation[ i ].areaNum = 0; aasLocation[ i ].areaNum = 0;
aasLocation[ i ].pos = origin; aasLocation[ i ].pos = origin;
@ -6962,7 +6962,7 @@ void idPlayer::SetAASLocation( void ) {
if ( !GetFloorPos( 64.0f, origin ) ) { if ( !GetFloorPos( 64.0f, origin ) ) {
return; return;
} }
for( i = 0; i < aasLocation.Num(); i++ ) { for( i = 0; i < aasLocation.Num(); i++ ) {
aas = gameLocal.GetAAS( i ); aas = gameLocal.GetAAS( i );
if ( !aas ) { if ( !aas ) {
@ -7114,7 +7114,7 @@ void idPlayer::Move( void ) {
if ( AI_JUMP ) { if ( AI_JUMP ) {
// bounce the view weapon // bounce the view weapon
loggedAccel_t *acc = &loggedAccel[currentLoggedAccel&(NUM_LOGGED_ACCELS-1)]; loggedAccel_t *acc = &loggedAccel[currentLoggedAccel&(NUM_LOGGED_ACCELS-1)];
currentLoggedAccel++; currentLoggedAccel++;
acc->time = gameLocal.time; acc->time = gameLocal.time;
acc->dir[2] = 200; acc->dir[2] = 200;
@ -7171,7 +7171,7 @@ void idPlayer::UpdateHud( void ) {
inventory.pickupItemNames.RemoveIndex( 0 ); inventory.pickupItemNames.RemoveIndex( 0 );
if (inventory.nextItemNum == 1 ) { if (inventory.nextItemNum == 1 ) {
inventory.onePickupTime = gameLocal.time; inventory.onePickupTime = gameLocal.time;
} else if ( inventory.nextItemNum > count ) { //_D3XP } else if ( inventory.nextItemNum > count ) { //_D3XP
inventory.nextItemNum = 1; inventory.nextItemNum = 1;
inventory.nextItemPickup = inventory.onePickupTime + 2000; inventory.nextItemPickup = inventory.onePickupTime + 2000;
} else { } else {
@ -7412,7 +7412,7 @@ void idPlayer::Think( void ) {
// update GUIs, Items, and character interactions // update GUIs, Items, and character interactions
UpdateFocus(); UpdateFocus();
UpdateLocation(); UpdateLocation();
// update player script // update player script
@ -7420,7 +7420,7 @@ void idPlayer::Think( void ) {
// service animations // service animations
if ( !spectating && !af.IsActive() && !gameLocal.inCinematic ) { if ( !spectating && !af.IsActive() && !gameLocal.inCinematic ) {
UpdateConditions(); UpdateConditions();
UpdateAnimState(); UpdateAnimState();
CheckBlink(); CheckBlink();
} }
@ -7449,7 +7449,7 @@ void idPlayer::Think( void ) {
#ifdef _D3XP #ifdef _D3XP
UpdatePowerupHud(); UpdatePowerupHud();
#endif #endif
UpdateHud(); UpdateHud();
UpdatePowerUps(); UpdatePowerUps();
@ -7517,7 +7517,7 @@ void idPlayer::Think( void ) {
if ( !g_stopTime.GetBool() ) { if ( !g_stopTime.GetBool() ) {
UpdateAnimation(); UpdateAnimation();
Present(); Present();
UpdateDamageEffects(); UpdateDamageEffects();
@ -7727,7 +7727,7 @@ idPlayer::LookAtKiller
*/ */
void idPlayer::LookAtKiller( idEntity *inflictor, idEntity *attacker ) { void idPlayer::LookAtKiller( idEntity *inflictor, idEntity *attacker ) {
idVec3 dir; idVec3 dir;
if ( attacker && attacker != this ) { if ( attacker && attacker != this ) {
dir = attacker->GetPhysics()->GetOrigin() - GetPhysics()->GetOrigin(); dir = attacker->GetPhysics()->GetOrigin() - GetPhysics()->GetOrigin();
} else if ( inflictor && inflictor != this ) { } else if ( inflictor && inflictor != this ) {
@ -7826,7 +7826,7 @@ void idPlayer::Killed( idEntity *inflictor, idEntity *attacker, int damage, cons
#ifdef CTF #ifdef CTF
// drop the flag if player was carrying it // drop the flag if player was carrying it
if ( gameLocal.isMultiplayer && gameLocal.mpGame.IsGametypeFlagBased() && if ( gameLocal.isMultiplayer && gameLocal.mpGame.IsGametypeFlagBased() &&
carryingFlag ) carryingFlag )
{ {
DropFlag(); DropFlag();
@ -7871,7 +7871,7 @@ void idPlayer::GetAIAimTargets( const idVec3 &lastSightPos, idVec3 &headPos, idV
idVec3 offset; idVec3 offset;
idMat3 axis; idMat3 axis;
idVec3 origin; idVec3 origin;
origin = lastSightPos - physicsObj.GetOrigin(); origin = lastSightPos - physicsObj.GetOrigin();
GetJointWorldTransform( chestJoint, gameLocal.time, offset, axis ); GetJointWorldTransform( chestJoint, gameLocal.time, offset, axis );
@ -7893,18 +7893,18 @@ void idPlayer::DamageFeedback( idEntity *victim, idEntity *inflictor, int &damag
damage *= PowerUpModifier( BERSERK ); damage *= PowerUpModifier( BERSERK );
if ( damage && ( victim != this ) && ( victim->IsType( idActor::Type ) || victim->IsType( idDamagable::Type ) ) ) { if ( damage && ( victim != this ) && ( victim->IsType( idActor::Type ) || victim->IsType( idDamagable::Type ) ) ) {
idPlayer *victimPlayer = NULL; idPlayer *victimPlayer = NULL;
/* No damage feedback sound for hitting friendlies in CTF */ /* No damage feedback sound for hitting friendlies in CTF */
if ( victim->IsType( idPlayer::Type ) ) { if ( victim->IsType( idPlayer::Type ) ) {
victimPlayer = static_cast<idPlayer*>(victim); victimPlayer = static_cast<idPlayer*>(victim);
} }
if ( gameLocal.mpGame.IsGametypeFlagBased() && victimPlayer && this->team == victimPlayer->team ) { if ( gameLocal.mpGame.IsGametypeFlagBased() && victimPlayer && this->team == victimPlayer->team ) {
/* Do nothing ... */ /* Do nothing ... */
} }
else { else {
SetLastHitTime( gameLocal.time ); SetLastHitTime( gameLocal.time );
} }
} }
} }
@ -7930,7 +7930,7 @@ void idPlayer::CalcDamagePoints( idEntity *inflictor, idEntity *attacker, const
if ( !gameLocal.isMultiplayer ) { if ( !gameLocal.isMultiplayer ) {
if ( inflictor != gameLocal.world ) { if ( inflictor != gameLocal.world ) {
switch ( g_skill.GetInteger() ) { switch ( g_skill.GetInteger() ) {
case 0: case 0:
damage *= 0.80f; damage *= 0.80f;
if ( damage < 1 ) { if ( damage < 1 ) {
damage = 1; damage = 1;
@ -8037,7 +8037,7 @@ void idPlayer::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &di
int armorSave; int armorSave;
int knockback; int knockback;
idVec3 damage_from; idVec3 damage_from;
idVec3 localDamageVector; idVec3 localDamageVector;
float attackerPushScale; float attackerPushScale;
#ifdef _D3XP #ifdef _D3XP
SetTimeState ts( timeGroup ); SetTimeState ts( timeGroup );
@ -8047,7 +8047,7 @@ void idPlayer::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &di
if ( gameLocal.isClient ) { if ( gameLocal.isClient ) {
return; return;
} }
if ( !fl.takedamage || noclip || spectating || gameLocal.inCinematic ) { if ( !fl.takedamage || noclip || spectating || gameLocal.inCinematic ) {
return; return;
} }
@ -8082,7 +8082,7 @@ void idPlayer::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &di
} }
CalcDamagePoints( inflictor, attacker, &damageDef->dict, damageScale, location, &damage, &armorSave ); CalcDamagePoints( inflictor, attacker, &damageDef->dict, damageScale, location, &damage, &armorSave );
// determine knockback // determine knockback
damageDef->dict.GetInt( "knockback", "20", knockback ); damageDef->dict.GetInt( "knockback", "20", knockback );
@ -8125,7 +8125,7 @@ void idPlayer::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &di
} }
lastArmorPulse = gameLocal.time; lastArmorPulse = gameLocal.time;
} }
if ( damageDef->dict.GetBool( "burn" ) ) { if ( damageDef->dict.GetBool( "burn" ) ) {
StartSound( "snd_burn", SND_CHANNEL_BODY3, 0, false, NULL ); StartSound( "snd_burn", SND_CHANNEL_BODY3, 0, false, NULL );
} else if ( damageDef->dict.GetBool( "no_air" ) ) { } else if ( damageDef->dict.GetBool( "no_air" ) ) {
@ -8135,14 +8135,14 @@ void idPlayer::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &di
} }
if ( g_debugDamage.GetInteger() ) { if ( g_debugDamage.GetInteger() ) {
gameLocal.Printf( "client:%i health:%i damage:%i armor:%i\n", gameLocal.Printf( "client:%i health:%i damage:%i armor:%i\n",
entityNumber, health, damage, armorSave ); entityNumber, health, damage, armorSave );
} }
// move the world direction vector to local coordinates // move the world direction vector to local coordinates
damage_from = dir; damage_from = dir;
damage_from.Normalize(); damage_from.Normalize();
viewAxis.ProjectVector( damage_from, localDamageVector ); viewAxis.ProjectVector( damage_from, localDamageVector );
// add to the damage inflicted on a player this frame // add to the damage inflicted on a player this frame
@ -8583,7 +8583,7 @@ idPlayer::GetEyePosition
*/ */
idVec3 idPlayer::GetEyePosition( void ) const { idVec3 idPlayer::GetEyePosition( void ) const {
idVec3 org; idVec3 org;
// use the smoothed origin if spectating another player in multiplayer // use the smoothed origin if spectating another player in multiplayer
if ( gameLocal.isClient && entityNumber != gameLocal.localClientNum ) { if ( gameLocal.isClient && entityNumber != gameLocal.localClientNum ) {
org = smoothedOrigin; org = smoothedOrigin;
@ -8635,7 +8635,7 @@ void idPlayer::CalculateFirstPersonView( void ) {
ang = viewBobAngles + playerView.AngleOffset(); ang = viewBobAngles + playerView.AngleOffset();
ang.yaw += viewAxis[ 0 ].ToYaw(); ang.yaw += viewAxis[ 0 ].ToYaw();
jointHandle_t joint = animator.GetJointHandle( "camera" ); jointHandle_t joint = animator.GetJointHandle( "camera" );
animator.GetJointTransform( joint, gameLocal.time, origin, axis ); animator.GetJointTransform( joint, gameLocal.time, origin, axis );
firstPersonViewOrigin = ( origin + modelOffset ) * ( viewAxis * physicsObj.GetGravityAxis() ) + physicsObj.GetOrigin() + viewBob; firstPersonViewOrigin = ( origin + modelOffset ) * ( viewAxis * physicsObj.GetGravityAxis() ) + physicsObj.GetOrigin() + viewBob;
@ -8725,7 +8725,7 @@ void idPlayer::CalculateRenderView( void ) {
// allow the right player view weapons // allow the right player view weapons
renderView->viewID = entityNumber + 1; renderView->viewID = entityNumber + 1;
} }
// field of view // field of view
gameLocal.CalcFov( CalcFov( true ), renderView->fov_x, renderView->fov_y ); gameLocal.CalcFov( CalcFov( true ), renderView->fov_x, renderView->fov_y );
} }
@ -8961,17 +8961,17 @@ void idPlayer::Event_StopFxFov( void ) {
/* /*
================== ==================
idPlayer::StartFxFov idPlayer::StartFxFov
================== ==================
*/ */
void idPlayer::StartFxFov( float duration ) { void idPlayer::StartFxFov( float duration ) {
fxFov = true; fxFov = true;
PostEventSec( &EV_Player_StopFxFov, duration ); PostEventSec( &EV_Player_StopFxFov, duration );
} }
/* /*
================== ==================
idPlayer::Event_EnableWeapon idPlayer::Event_EnableWeapon
================== ==================
*/ */
void idPlayer::Event_EnableWeapon( void ) { void idPlayer::Event_EnableWeapon( void ) {
@ -8998,7 +8998,7 @@ void idPlayer::Event_DisableWeapon( void ) {
#ifdef _D3XP #ifdef _D3XP
/* /*
================== ==================
idPlayer::Event_GiveInventoryItem idPlayer::Event_GiveInventoryItem
================== ==================
*/ */
void idPlayer::Event_GiveInventoryItem( const char* name ) { void idPlayer::Event_GiveInventoryItem( const char* name ) {
@ -9007,7 +9007,7 @@ void idPlayer::Event_GiveInventoryItem( const char* name ) {
/* /*
================== ==================
idPlayer::Event_RemoveInventoryItem idPlayer::Event_RemoveInventoryItem
================== ==================
*/ */
void idPlayer::Event_RemoveInventoryItem( const char* name ) { void idPlayer::Event_RemoveInventoryItem( const char* name ) {
@ -9016,7 +9016,7 @@ void idPlayer::Event_RemoveInventoryItem( const char* name ) {
/* /*
================== ==================
idPlayer::Event_GetIdealWeapon idPlayer::Event_GetIdealWeapon
================== ==================
*/ */
void idPlayer::Event_GetIdealWeapon( void ) { void idPlayer::Event_GetIdealWeapon( void ) {
@ -9032,7 +9032,7 @@ void idPlayer::Event_GetIdealWeapon( void ) {
/* /*
================== ==================
idPlayer::Event_SetPowerupTime idPlayer::Event_SetPowerupTime
================== ==================
*/ */
void idPlayer::Event_SetPowerupTime( int powerup, int time ) { void idPlayer::Event_SetPowerupTime( int powerup, int time ) {
@ -9045,7 +9045,7 @@ void idPlayer::Event_SetPowerupTime( int powerup, int time ) {
/* /*
================== ==================
idPlayer::Event_IsPowerupActive idPlayer::Event_IsPowerupActive
================== ==================
*/ */
void idPlayer::Event_IsPowerupActive( int powerup ) { void idPlayer::Event_IsPowerupActive( int powerup ) {
@ -9331,14 +9331,14 @@ void idPlayer::ClientPredictionThink( void ) {
if ( !isLagged ) { if ( !isLagged ) {
// don't allow client to move when lagged // don't allow client to move when lagged
Move(); Move();
} }
// update GUIs, Items, and character interactions // update GUIs, Items, and character interactions
UpdateFocus(); UpdateFocus();
// service animations // service animations
if ( !spectating && !af.IsActive() ) { if ( !spectating && !af.IsActive() ) {
UpdateConditions(); UpdateConditions();
UpdateAnimState(); UpdateAnimState();
CheckBlink(); CheckBlink();
} }
@ -9543,8 +9543,8 @@ void idPlayer::WriteToSnapshot( idBitMsgDelta &msg ) const {
msg.WriteBits( isLagged, 1 ); msg.WriteBits( isLagged, 1 );
msg.WriteBits( isChatting, 1 ); msg.WriteBits( isChatting, 1 );
#ifdef CTF #ifdef CTF
/* Needed for the scoreboard */ /* Needed for the scoreboard */
msg.WriteBits( carryingFlag, 1 ); msg.WriteBits( carryingFlag, 1 );
#endif #endif
#ifdef _D3XP #ifdef _D3XP
msg.WriteBits( enviroSuitLight.GetSpawnId(), 32 ); msg.WriteBits( enviroSuitLight.GetSpawnId(), 32 );
@ -9788,7 +9788,7 @@ bool idPlayer::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) {
GivePowerUp( powerup, 0 ); GivePowerUp( powerup, 0 );
} else { } else {
ClearPowerup( powerup ); ClearPowerup( powerup );
} }
return true; return true;
} }
#ifdef _D3XP #ifdef _D3XP
@ -9841,7 +9841,7 @@ idPlayer::Show
*/ */
void idPlayer::Show( void ) { void idPlayer::Show( void ) {
idWeapon *weap; idWeapon *weap;
idActor::Show(); idActor::Show();
weap = weapon.GetEntity(); weap = weapon.GetEntity();
if ( weap ) { if ( weap ) {
@ -9882,7 +9882,7 @@ void idPlayer::ShowTip( const char *title, const char *tip, bool autoHide ) {
} }
hud->SetStateString( "tip", tip ); hud->SetStateString( "tip", tip );
hud->SetStateString( "tiptitle", title ); hud->SetStateString( "tiptitle", title );
hud->HandleNamedEvent( "tipWindowUp" ); hud->HandleNamedEvent( "tipWindowUp" );
if ( autoHide ) { if ( autoHide ) {
PostEventSec( &EV_Player_HideTip, 5.0f ); PostEventSec( &EV_Player_HideTip, 5.0f );
} }
@ -9895,7 +9895,7 @@ idPlayer::HideTip
=============== ===============
*/ */
void idPlayer::HideTip( void ) { void idPlayer::HideTip( void ) {
hud->HandleNamedEvent( "tipWindowDown" ); hud->HandleNamedEvent( "tipWindowDown" );
tipUp = false; tipUp = false;
} }
@ -10040,11 +10040,11 @@ void idPlayer::DrawPlayerIcons( void ) {
} }
#ifdef CTF #ifdef CTF
// Never draw icons for hidden players. // Never draw icons for hidden players.
if ( this->IsHidden() ) if ( this->IsHidden() )
return; return;
#endif #endif
playerIcon.Draw( this, headJoint ); playerIcon.Draw( this, headJoint );
} }
@ -10085,7 +10085,7 @@ void idPlayer::DropFlag( void ) {
idEntity * entity = gameLocal.mpGame.GetTeamFlag( 1 - this->latchedTeam ); idEntity * entity = gameLocal.mpGame.GetTeamFlag( 1 - this->latchedTeam );
if ( entity ) { if ( entity ) {
idItemTeam * item = static_cast<idItemTeam*>(entity); idItemTeam * item = static_cast<idItemTeam*>(entity);
if ( item->carried && !item->dropped ) { if ( item->carried && !item->dropped ) {
item->Drop( health <= 0 ); item->Drop( health <= 0 );
carryingFlag = false; carryingFlag = false;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms
=============================================================================== ===============================================================================
Player entity. Player entity.
=============================================================================== ===============================================================================
*/ */
@ -59,7 +59,7 @@ const int MAX_WEAPONS = 16;
#endif #endif
const int DEAD_HEARTRATE = 0; // fall to as you die const int DEAD_HEARTRATE = 0; // fall to as you die
const int LOWHEALTH_HEARTRATE_ADJ = 20; // const int LOWHEALTH_HEARTRATE_ADJ = 20; //
const int DYING_HEARTRATE = 30; // used for volumen calc when dying/dead const int DYING_HEARTRATE = 30; // used for volumen calc when dying/dead
const int BASE_HEARTRATE = 70; // default const int BASE_HEARTRATE = 70; // default
const int ZEROSTAMINA_HEARTRATE = 115; // no stamina const int ZEROSTAMINA_HEARTRATE = 115; // no stamina
@ -91,7 +91,7 @@ struct idLevelTriggerInfo {
// powerups - the "type" in item .def must match // powerups - the "type" in item .def must match
enum { enum {
BERSERK = 0, BERSERK = 0,
INVISIBILITY, INVISIBILITY,
MEGAHEALTH, MEGAHEALTH,
ADRENALINE, ADRENALINE,
@ -349,10 +349,10 @@ public:
int tourneyLine; // client side - our spot in the wait line. 0 means no info. int tourneyLine; // client side - our spot in the wait line. 0 means no info.
int spawnedTime; // when client first enters the game int spawnedTime; // when client first enters the game
#ifdef CTF #ifdef CTF
bool carryingFlag; // is the player carrying the flag? bool carryingFlag; // is the player carrying the flag?
#endif #endif
idEntityPtr<idEntity> teleportEntity; // while being teleported, this is set to the entity we'll use for exit idEntityPtr<idEntity> teleportEntity; // while being teleported, this is set to the entity we'll use for exit
int teleportKiller; // entity number of an entity killing us at teleporter exit int teleportKiller; // entity number of an entity killing us at teleporter exit
bool lastManOver; // can't respawn in last man anymore (srv only) bool lastManOver; // can't respawn in last man anymore (srv only)
@ -469,7 +469,7 @@ public:
bool GiveItem( idItem *item ); bool GiveItem( idItem *item );
void GiveItem( const char *name ); void GiveItem( const char *name );
void GiveHealthPool( float amt ); void GiveHealthPool( float amt );
bool GiveInventoryItem( idDict *item ); bool GiveInventoryItem( idDict *item );
void RemoveInventoryItem( idDict *item ); void RemoveInventoryItem( idDict *item );
bool GiveInventoryItem( const char *name ); bool GiveInventoryItem( const char *name );
@ -680,7 +680,7 @@ private:
int focusTime; int focusTime;
idAFEntity_Vehicle * focusVehicle; idAFEntity_Vehicle * focusVehicle;
idUserInterface * cursor; idUserInterface * cursor;
// full screen guis track mouse movements directly // full screen guis track mouse movements directly
int oldMouseX; int oldMouseX;
int oldMouseY; int oldMouseY;
@ -837,4 +837,3 @@ ID_INLINE void idPlayer::SetSelfSmooth( bool b ) {
} }
#endif /* !__GAME_PLAYER_H__ */ #endif /* !__GAME_PLAYER_H__ */

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -195,4 +195,3 @@ void idPlayerIcon::UpdateIcon( idPlayer *player, const idVec3 &origin, const idM
renderEnt.axis = axis; renderEnt.axis = axis;
gameRenderWorld->UpdateEntityDef( iconHandle, &renderEnt ); gameRenderWorld->UpdateEntityDef( iconHandle, &renderEnt );
} }

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -41,7 +41,7 @@ typedef enum {
class idPlayerIcon { class idPlayerIcon {
public: public:
public: public:
idPlayerIcon(); idPlayerIcon();
~idPlayerIcon(); ~idPlayerIcon();
@ -64,4 +64,3 @@ public:
#endif /* !_PLAYERICON_H_ */ #endif /* !_PLAYERICON_H_ */

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -168,7 +168,7 @@ void idPlayerView::Restore( idRestoreGame *savefile ) {
savefile->ReadInt( dvFinishTime ); savefile->ReadInt( dvFinishTime );
savefile->ReadMaterial( dvMaterial ); savefile->ReadMaterial( dvMaterial );
savefile->ReadInt( kickFinishTime ); savefile->ReadInt( kickFinishTime );
savefile->ReadAngles( kickAngles ); savefile->ReadAngles( kickAngles );
savefile->ReadBool( bfgVision ); savefile->ReadBool( bfgVision );
savefile->ReadMaterial( tunnelMaterial ); savefile->ReadMaterial( tunnelMaterial );
@ -310,7 +310,7 @@ void idPlayerView::DamageImpulse( idVec3 localKickDir, const idDict *damageDef )
blob->x += ( gameLocal.random.RandomInt()&63 ) - 32; blob->x += ( gameLocal.random.RandomInt()&63 ) - 32;
blob->y = damageDef->GetFloat( "blob_y" ); blob->y = damageDef->GetFloat( "blob_y" );
blob->y += ( gameLocal.random.RandomInt()&63 ) - 32; blob->y += ( gameLocal.random.RandomInt()&63 ) - 32;
float scale = ( 256 + ( ( gameLocal.random.RandomInt()&63 ) - 32 ) ) / 256.0f; float scale = ( 256 + ( ( gameLocal.random.RandomInt()&63 ) - 32 ) ) / 256.0f;
blob->w = damageDef->GetFloat( "blob_width" ) * g_blobSize.GetFloat() * scale; blob->w = damageDef->GetFloat( "blob_width" ) * g_blobSize.GetFloat() * scale;
blob->h = damageDef->GetFloat( "blob_height" ) * g_blobSize.GetFloat() * scale; blob->h = damageDef->GetFloat( "blob_height" ) * g_blobSize.GetFloat() * scale;
@ -392,7 +392,7 @@ void idPlayerView::WeaponFireFeedback( const idDict *weaponDef ) {
kickAngles = angles; kickAngles = angles;
int finish = gameLocal.slow.time + g_kickTime.GetFloat() * recoilTime; int finish = gameLocal.slow.time + g_kickTime.GetFloat() * recoilTime;
kickFinishTime = finish; kickFinishTime = finish;
} }
} }
@ -429,7 +429,7 @@ idMat3 idPlayerView::ShakeAxis() const {
=================== ===================
idPlayerView::AngleOffset idPlayerView::AngleOffset
kickVector, a world space direction that the attack should kickVector, a world space direction that the attack should
=================== ===================
*/ */
idAngles idPlayerView::AngleOffset() const { idAngles idPlayerView::AngleOffset() const {
@ -530,7 +530,7 @@ void idPlayerView::SingleView( idUserInterface *hud, const renderView_t *view )
if ( blob->finishTime <= gameLocal.slow.time ) { if ( blob->finishTime <= gameLocal.slow.time ) {
continue; continue;
} }
blob->y += blob->driftAmount; blob->y += blob->driftAmount;
float fade = (float)( blob->finishTime - gameLocal.slow.time ) / ( blob->finishTime - blob->startFadeTime ); float fade = (float)( blob->finishTime - gameLocal.slow.time ) / ( blob->finishTime - blob->startFadeTime );
@ -577,7 +577,7 @@ void idPlayerView::SingleView( idUserInterface *hud, const renderView_t *view )
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f ); renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
renderSystem->DrawStretchPic( 0.0f, 0.0f, 640.0f, 480.0f, 0.0f, 0.0f, 1.0f, 1.0f, bfgMaterial ); renderSystem->DrawStretchPic( 0.0f, 0.0f, 640.0f, 480.0f, 0.0f, 0.0f, 1.0f, 1.0f, bfgMaterial );
} }
} }
// test a single material drawn over everything // test a single material drawn over everything
@ -690,7 +690,7 @@ void idPlayerView::RenderPlayerView( idUserInterface *hud ) {
if ( net_clientLagOMeter.GetBool() && lagoMaterial && gameLocal.isClient ) { if ( net_clientLagOMeter.GetBool() && lagoMaterial && gameLocal.isClient ) {
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f ); renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
renderSystem->DrawStretchPic( 10.0f, 380.0f, 64.0f, 64.0f, 0.0f, 0.0f, 1.0f, 1.0f, lagoMaterial ); renderSystem->DrawStretchPic( 10.0f, 380.0f, 64.0f, 64.0f, 0.0f, 0.0f, 1.0f, 1.0f, lagoMaterial );
} }
} }
#ifdef _D3XP #ifdef _D3XP
@ -1263,7 +1263,7 @@ void FullscreenFX_Warp::HighQuality() {
p.center.y = center.y; p.center.y = center.y;
p.center.z = p.center.x / 640.f; p.center.z = p.center.x / 640.f;
p.center.w = 1 - ( p.center.y / 480.f ); p.center.w = 1 - ( p.center.y / 480.f );
// draw it // draw it
DrawWarp( p, interp ); DrawWarp( p, interp );
} }
@ -1690,7 +1690,7 @@ void FullscreenFXManager::Initialize( idPlayerView *pv ) {
renderSystem->CaptureRenderToImage( "_accum" ); renderSystem->CaptureRenderToImage( "_accum" );
renderSystem->UnCrop(); renderSystem->UnCrop();
renderSystem->CropRenderSize( 512, 256, true ); renderSystem->CropRenderSize( 512, 256, true );
renderSystem->CaptureRenderToImage( "_scratch" ); renderSystem->CaptureRenderToImage( "_scratch" );
renderSystem->UnCrop(); renderSystem->UnCrop();

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -393,9 +393,9 @@ public:
const idMaterial * dvMaterial; // material to take the double vision screen shot const idMaterial * dvMaterial; // material to take the double vision screen shot
int kickFinishTime; // view kick will be stopped at this time int kickFinishTime; // view kick will be stopped at this time
idAngles kickAngles; idAngles kickAngles;
bool bfgVision; // bool bfgVision; //
const idMaterial * tunnelMaterial; // health tunnel vision const idMaterial * tunnelMaterial; // health tunnel vision
const idMaterial * armorMaterial; // armor damage view effect const idMaterial * armorMaterial; // armor damage view effect

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -25,7 +25,7 @@ If you have questions concerning this license or the applicable additional terms
=========================================================================== ===========================================================================
*/ */
#include "../idlib/precompiled.h" #include "../idlib/precompiled.h"
#pragma hdrstop #pragma hdrstop
@ -335,7 +335,7 @@ void idProjectile::Launch( const idVec3 &start, const idVec3 &dir, const idVec3
endthrust = spawnArgs.GetFloat( "thrust_end" ); endthrust = spawnArgs.GetFloat( "thrust_end" );
spawnArgs.GetVector( "velocity", "0 0 0", velocity ); spawnArgs.GetVector( "velocity", "0 0 0", velocity );
speed = velocity.Length() * launchPower; speed = velocity.Length() * launchPower;
damagePower = dmgPower; damagePower = dmgPower;
@ -510,11 +510,11 @@ void idProjectile::Think( void ) {
if ( gameLocal.time < lightEndTime ) { if ( gameLocal.time < lightEndTime ) {
float frac = ( float )( gameLocal.time - lightStartTime ) / ( float )( lightEndTime - lightStartTime ); float frac = ( float )( gameLocal.time - lightStartTime ) / ( float )( lightEndTime - lightStartTime );
color.Lerp( lightColor, color, frac ); color.Lerp( lightColor, color, frac );
} }
renderLight.shaderParms[SHADERPARM_RED] = color.x; renderLight.shaderParms[SHADERPARM_RED] = color.x;
renderLight.shaderParms[SHADERPARM_GREEN] = color.y; renderLight.shaderParms[SHADERPARM_GREEN] = color.y;
renderLight.shaderParms[SHADERPARM_BLUE] = color.z; renderLight.shaderParms[SHADERPARM_BLUE] = color.z;
} }
gameRenderWorld->UpdateLightDef( lightDefHandle, &renderLight ); gameRenderWorld->UpdateLightDef( lightDefHandle, &renderLight );
} else { } else {
lightDefHandle = gameRenderWorld->AddLightDef( &renderLight ); lightDefHandle = gameRenderWorld->AddLightDef( &renderLight );
@ -897,9 +897,9 @@ void idProjectile::Explode( const trace_t &collision, idEntity *ignore ) {
if ( fxname && *fxname ) { if ( fxname && *fxname ) {
SetModel( fxname ); SetModel( fxname );
renderEntity.shaderParms[SHADERPARM_RED] = renderEntity.shaderParms[SHADERPARM_RED] =
renderEntity.shaderParms[SHADERPARM_GREEN] = renderEntity.shaderParms[SHADERPARM_GREEN] =
renderEntity.shaderParms[SHADERPARM_BLUE] = renderEntity.shaderParms[SHADERPARM_BLUE] =
renderEntity.shaderParms[SHADERPARM_ALPHA] = 1.0f; renderEntity.shaderParms[SHADERPARM_ALPHA] = 1.0f;
renderEntity.shaderParms[SHADERPARM_TIMEOFFSET] = -MS2SEC( gameLocal.time ); renderEntity.shaderParms[SHADERPARM_TIMEOFFSET] = -MS2SEC( gameLocal.time );
renderEntity.shaderParms[SHADERPARM_DIVERSITY] = gameLocal.random.CRandomFloat(); renderEntity.shaderParms[SHADERPARM_DIVERSITY] = gameLocal.random.CRandomFloat();
@ -910,13 +910,13 @@ void idProjectile::Explode( const trace_t &collision, idEntity *ignore ) {
// explosion light // explosion light
light_shader = spawnArgs.GetString( "mtr_explode_light_shader" ); light_shader = spawnArgs.GetString( "mtr_explode_light_shader" );
#ifdef CTF #ifdef CTF
if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") ) if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") )
{ {
light_shader = "lights/midnight_grenade"; light_shader = "lights/midnight_grenade";
} }
#endif #endif
if ( *light_shader ) { if ( *light_shader ) {
renderLight.shader = declManager->FindMaterial( light_shader, false ); renderLight.shader = declManager->FindMaterial( light_shader, false );
renderLight.pointLight = true; renderLight.pointLight = true;
@ -925,16 +925,16 @@ void idProjectile::Explode( const trace_t &collision, idEntity *ignore ) {
renderLight.lightRadius[2] = spawnArgs.GetFloat( "explode_light_radius" ); renderLight.lightRadius[2] = spawnArgs.GetFloat( "explode_light_radius" );
#ifdef CTF #ifdef CTF
// Midnight ctf // Midnight ctf
if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") ) if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") )
{ {
renderLight.lightRadius[0] = renderLight.lightRadius[0] =
renderLight.lightRadius[1] = renderLight.lightRadius[1] =
renderLight.lightRadius[2] = spawnArgs.GetFloat( "explode_light_radius" ) * 2; renderLight.lightRadius[2] = spawnArgs.GetFloat( "explode_light_radius" ) * 2;
} }
#endif #endif
spawnArgs.GetVector( "explode_light_color", "1 1 1", lightColor ); spawnArgs.GetVector( "explode_light_color", "1 1 1", lightColor );
renderLight.shaderParms[SHADERPARM_RED] = lightColor.x; renderLight.shaderParms[SHADERPARM_RED] = lightColor.x;
renderLight.shaderParms[SHADERPARM_GREEN] = lightColor.y; renderLight.shaderParms[SHADERPARM_GREEN] = lightColor.y;
@ -943,13 +943,13 @@ void idProjectile::Explode( const trace_t &collision, idEntity *ignore ) {
renderLight.shaderParms[SHADERPARM_TIMEOFFSET] = -MS2SEC( gameLocal.time ); renderLight.shaderParms[SHADERPARM_TIMEOFFSET] = -MS2SEC( gameLocal.time );
#ifdef CTF #ifdef CTF
// Midnight ctf // Midnight ctf
if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") ) if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") )
{ {
light_fadetime = 3.0f; light_fadetime = 3.0f;
} }
else else
#endif #endif
light_fadetime = spawnArgs.GetFloat( "explode_light_fadetime", "0.5" ); light_fadetime = spawnArgs.GetFloat( "explode_light_fadetime", "0.5" );
lightStartTime = gameLocal.time; lightStartTime = gameLocal.time;
lightEndTime = gameLocal.time + SEC2MS( light_fadetime ); lightEndTime = gameLocal.time + SEC2MS( light_fadetime );
@ -1099,7 +1099,7 @@ void idProjectile::Event_Touch( idEntity *other, trace_t *trace ) {
return; return;
} }
#ifdef CTF #ifdef CTF
// Projectiles do not collide with flags // Projectiles do not collide with flags
if ( other->IsType( idItemTeam::Type ) ) if ( other->IsType( idItemTeam::Type ) )
return; return;
@ -1141,7 +1141,7 @@ void idProjectile::CatchProjectile( idEntity* o, const char* reflectName ) {
const idDict *damageDef = gameLocal.FindEntityDefDict( s, false ); const idDict *damageDef = gameLocal.FindEntityDefDict( s, false );
if ( damageDef ) { if ( damageDef ) {
spawnArgs.Set( "def_damage", s ); spawnArgs.Set( "def_damage", s );
} }
} }
@ -1267,7 +1267,7 @@ void idProjectile::WriteToSnapshot( idBitMsgDelta &msg ) const {
msg.WriteDeltaFloat( 0.0f, velocity[0], RB_VELOCITY_EXPONENT_BITS, RB_VELOCITY_MANTISSA_BITS ); msg.WriteDeltaFloat( 0.0f, velocity[0], RB_VELOCITY_EXPONENT_BITS, RB_VELOCITY_MANTISSA_BITS );
msg.WriteDeltaFloat( 0.0f, velocity[1], RB_VELOCITY_EXPONENT_BITS, RB_VELOCITY_MANTISSA_BITS ); msg.WriteDeltaFloat( 0.0f, velocity[1], RB_VELOCITY_EXPONENT_BITS, RB_VELOCITY_MANTISSA_BITS );
msg.WriteDeltaFloat( 0.0f, velocity[2], RB_VELOCITY_EXPONENT_BITS, RB_VELOCITY_MANTISSA_BITS ); msg.WriteDeltaFloat( 0.0f, velocity[2], RB_VELOCITY_EXPONENT_BITS, RB_VELOCITY_MANTISSA_BITS );
} }
} }
@ -1519,7 +1519,7 @@ void idGuidedProjectile::Think( void ) {
int i; int i;
if ( state == LAUNCHED && !unGuided ) { if ( state == LAUNCHED && !unGuided ) {
GetSeekPos( seekPos ); GetSeekPos( seekPos );
if ( rndUpdateTime < gameLocal.time ) { if ( rndUpdateTime < gameLocal.time ) {
@ -1595,7 +1595,7 @@ void idGuidedProjectile::Launch( const idVec3 &start, const idVec3 &dir, const i
gameLocal.clip.TracePoint( tr, start, end, MASK_SHOT_RENDERMODEL | CONTENTS_BODY, owner.GetEntity() ); gameLocal.clip.TracePoint( tr, start, end, MASK_SHOT_RENDERMODEL | CONTENTS_BODY, owner.GetEntity() );
if ( tr.fraction < 1.0f ) { if ( tr.fraction < 1.0f ) {
enemy = gameLocal.GetTraceEntity( tr ); enemy = gameLocal.GetTraceEntity( tr );
} }
// ignore actors on the player's team // ignore actors on the player's team
if ( enemy.GetEntity() == NULL || !enemy.GetEntity()->IsType( idActor::Type ) || ( static_cast<idActor *>( enemy.GetEntity() )->team == player->team ) ) { if ( enemy.GetEntity() == NULL || !enemy.GetEntity()->IsType( idActor::Type ) || ( static_cast<idActor *>( enemy.GetEntity() )->team == player->team ) ) {
enemy = player->EnemyWithMostHealth(); enemy = player->EnemyWithMostHealth();
@ -1746,13 +1746,13 @@ void idSoulCubeMissile::Think( void ) {
if ( !gameLocal.smokeParticles->EmitSmoke( smokeKill, smokeKillTime, gameLocal.random.CRandomFloat(), orbitOrg, mat3_identity, timeGroup /*_D3XP*/ ) ) { if ( !gameLocal.smokeParticles->EmitSmoke( smokeKill, smokeKillTime, gameLocal.random.CRandomFloat(), orbitOrg, mat3_identity, timeGroup /*_D3XP*/ ) ) {
smokeKillTime = gameLocal.time; smokeKillTime = gameLocal.time;
} }
} }
} else { } else {
if ( accelTime && gameLocal.time < launchTime + accelTime * 1000 ) { if ( accelTime && gameLocal.time < launchTime + accelTime * 1000 ) {
pct = ( gameLocal.time - launchTime ) / ( accelTime * 1000 ); pct = ( gameLocal.time - launchTime ) / ( accelTime * 1000 );
speed = ( startingVelocity + ( startingVelocity + endingVelocity ) * pct ).Length(); speed = ( startingVelocity + ( startingVelocity + endingVelocity ) * pct ).Length();
} }
} }
idGuidedProjectile::Think(); idGuidedProjectile::Think();
GetSeekPos( seekPos ); GetSeekPos( seekPos );
if ( ( seekPos - physicsObj.GetOrigin() ).Length() < 32.0f ) { if ( ( seekPos - physicsObj.GetOrigin() ).Length() < 32.0f ) {
@ -1789,7 +1789,7 @@ void idSoulCubeMissile::GetSeekPos( idVec3 &out ) {
if ( destOrg != vec3_zero ) { if ( destOrg != vec3_zero ) {
out = destOrg; out = destOrg;
return; return;
} }
idGuidedProjectile::GetSeekPos( out ); idGuidedProjectile::GetSeekPos( out );
} }
@ -1835,7 +1835,7 @@ void idSoulCubeMissile::Launch( const idVec3 &start, const idVec3 &dir, const id
launchTime = gameLocal.time; launchTime = gameLocal.time;
killPhase = false; killPhase = false;
UpdateVisuals(); UpdateVisuals();
ownerEnt = owner.GetEntity(); ownerEnt = owner.GetEntity();
if ( ownerEnt && ownerEnt->IsType( idPlayer::Type ) ) { if ( ownerEnt && ownerEnt->IsType( idPlayer::Type ) ) {
static_cast<idPlayer *>( ownerEnt )->SetSoulCubeProjectile( this ); static_cast<idPlayer *>( ownerEnt )->SetSoulCubeProjectile( this );
@ -2017,9 +2017,9 @@ void idBFGProjectile::Think( void ) {
beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BEAM_END_X ] = org.x; beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BEAM_END_X ] = org.x;
beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BEAM_END_Y ] = org.y; beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BEAM_END_Y ] = org.y;
beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BEAM_END_Z ] = org.z; beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BEAM_END_Z ] = org.z;
beamTargets[i].renderEntity.shaderParms[ SHADERPARM_RED ] = beamTargets[i].renderEntity.shaderParms[ SHADERPARM_RED ] =
beamTargets[i].renderEntity.shaderParms[ SHADERPARM_GREEN ] = beamTargets[i].renderEntity.shaderParms[ SHADERPARM_GREEN ] =
beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BLUE ] = beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BLUE ] =
beamTargets[i].renderEntity.shaderParms[ SHADERPARM_ALPHA ] = 1.0f; beamTargets[i].renderEntity.shaderParms[ SHADERPARM_ALPHA ] = 1.0f;
if ( gameLocal.time > nextDamageTime ) { if ( gameLocal.time > nextDamageTime ) {
bool bfgVision = true; bool bfgVision = true;
@ -2032,9 +2032,9 @@ void idBFGProjectile::Think( void ) {
org.Normalize(); org.Normalize();
beamTargets[i].target.GetEntity()->Damage( this, owner.GetEntity(), org, damageFreq, ( damagePower ) ? damagePower : 1.0f, INVALID_JOINT ); beamTargets[i].target.GetEntity()->Damage( this, owner.GetEntity(), org, damageFreq, ( damagePower ) ? damagePower : 1.0f, INVALID_JOINT );
} else { } else {
beamTargets[i].renderEntity.shaderParms[ SHADERPARM_RED ] = beamTargets[i].renderEntity.shaderParms[ SHADERPARM_RED ] =
beamTargets[i].renderEntity.shaderParms[ SHADERPARM_GREEN ] = beamTargets[i].renderEntity.shaderParms[ SHADERPARM_GREEN ] =
beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BLUE ] = beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BLUE ] =
beamTargets[i].renderEntity.shaderParms[ SHADERPARM_ALPHA ] = 0.0f; beamTargets[i].renderEntity.shaderParms[ SHADERPARM_ALPHA ] = 0.0f;
bfgVision = false; bfgVision = false;
} }
@ -2078,7 +2078,7 @@ void idBFGProjectile::Launch( const idVec3 &start, const idVec3 &dir, const idVe
idProjectile::Launch( start, dir, pushVelocity, 0.0f, power, dmgPower ); idProjectile::Launch( start, dir, pushVelocity, 0.0f, power, dmgPower );
// dmgPower * radius is the target acquisition area // dmgPower * radius is the target acquisition area
// acquisition should make sure that monsters are not dormant // acquisition should make sure that monsters are not dormant
// which will cut down on hitting monsters not actively fighting // which will cut down on hitting monsters not actively fighting
// but saves on the traces making sure they are visible // but saves on the traces making sure they are visible
// damage is not applied until the projectile explodes // damage is not applied until the projectile explodes
@ -2416,7 +2416,7 @@ void idDebris::Launch( void ) {
spawnArgs.GetVector( "velocity", "0 0 0", velocity ); spawnArgs.GetVector( "velocity", "0 0 0", velocity );
spawnArgs.GetAngles( "angular_velocity", "0 0 0", angular_velocity ); spawnArgs.GetAngles( "angular_velocity", "0 0 0", angular_velocity );
linear_friction = spawnArgs.GetFloat( "linear_friction" ); linear_friction = spawnArgs.GetFloat( "linear_friction" );
angular_friction = spawnArgs.GetFloat( "angular_friction" ); angular_friction = spawnArgs.GetFloat( "angular_friction" );
contact_friction = spawnArgs.GetFloat( "contact_friction" ); contact_friction = spawnArgs.GetFloat( "contact_friction" );

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms
=============================================================================== ===============================================================================
idProjectile idProjectile
=============================================================================== ===============================================================================
*/ */
@ -125,7 +125,7 @@ protected:
FIZZLED = 3, FIZZLED = 3,
EXPLODED = 4 EXPLODED = 4
} projectileState_t; } projectileState_t;
projectileState_t state; projectileState_t state;
private: private:
@ -243,7 +243,7 @@ private:
=============================================================================== ===============================================================================
idDebris idDebris
=============================================================================== ===============================================================================
*/ */

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -258,7 +258,7 @@ void idPVS::FrontPortalPVS( void ) const {
} }
for ( p = 0; p < area->numPortals; p++ ) { for ( p = 0; p < area->numPortals; p++ ) {
p2 = area->portals[p]; p2 = area->portals[p];
// if we the whole area is not at the front we need to check // if we the whole area is not at the front we need to check
@ -456,7 +456,7 @@ void idPVS::AddPassageBoundaries( const idWinding &source, const idWinding &pass
idPlane plane; idPlane plane;
// check all combinations // check all combinations
for ( i = 0; i < source.GetNumPoints(); i++ ) { for ( i = 0; i < source.GetNumPoints(); i++ ) {
l = (i + 1) % source.GetNumPoints(); l = (i + 1) % source.GetNumPoints();
@ -623,7 +623,7 @@ void idPVS::CreatePassages( void ) const {
} }
p = &pvsPortals[(byteNum << 3) + bitNum]; p = &pvsPortals[(byteNum << 3) + bitNum];
if ( p->areaNum == source->areaNum ) { if ( p->areaNum == source->areaNum ) {
continue; continue;
} }

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -42,7 +42,7 @@ If you have questions concerning this license or the applicable additional terms
/*********************************************************************** /***********************************************************************
idSecurityCamera idSecurityCamera
***********************************************************************/ ***********************************************************************/
const idEventDef EV_SecurityCam_ReverseSweep( "<reverseSweep>" ); const idEventDef EV_SecurityCam_ReverseSweep( "<reverseSweep>" );
@ -71,7 +71,7 @@ void idSecurityCamera::Save( idSaveGame *savefile ) const {
savefile->WriteBool( flipAxis ); savefile->WriteBool( flipAxis );
savefile->WriteFloat( scanDist ); savefile->WriteFloat( scanDist );
savefile->WriteFloat( scanFov ); savefile->WriteFloat( scanFov );
savefile->WriteFloat( sweepStart ); savefile->WriteFloat( sweepStart );
savefile->WriteFloat( sweepEnd ); savefile->WriteFloat( sweepEnd );
savefile->WriteBool( negativeSweep ); savefile->WriteBool( negativeSweep );
@ -81,7 +81,7 @@ void idSecurityCamera::Save( idSaveGame *savefile ) const {
savefile->WriteFloat( scanFovCos ); savefile->WriteFloat( scanFovCos );
savefile->WriteVec3( viewOffset ); savefile->WriteVec3( viewOffset );
savefile->WriteInt( pvsArea ); savefile->WriteInt( pvsArea );
savefile->WriteStaticObject( physicsObj ); savefile->WriteStaticObject( physicsObj );
savefile->WriteTraceModel( trm ); savefile->WriteTraceModel( trm );
@ -99,7 +99,7 @@ void idSecurityCamera::Restore( idRestoreGame *savefile ) {
savefile->ReadBool( flipAxis ); savefile->ReadBool( flipAxis );
savefile->ReadFloat( scanDist ); savefile->ReadFloat( scanDist );
savefile->ReadFloat( scanFov ); savefile->ReadFloat( scanFov );
savefile->ReadFloat( sweepStart ); savefile->ReadFloat( sweepStart );
savefile->ReadFloat( sweepEnd ); savefile->ReadFloat( sweepEnd );
savefile->ReadBool( negativeSweep ); savefile->ReadBool( negativeSweep );
@ -109,7 +109,7 @@ void idSecurityCamera::Restore( idRestoreGame *savefile ) {
savefile->ReadFloat( scanFovCos ); savefile->ReadFloat( scanFovCos );
savefile->ReadVec3( viewOffset ); savefile->ReadVec3( viewOffset );
savefile->ReadInt( pvsArea ); savefile->ReadInt( pvsArea );
savefile->ReadStaticObject( physicsObj ); savefile->ReadStaticObject( physicsObj );
savefile->ReadTraceModel( trm ); savefile->ReadTraceModel( trm );
@ -190,24 +190,24 @@ void idSecurityCamera::Event_AddLight( void ) {
float radius; float radius;
idVec3 lightOffset; idVec3 lightOffset;
idLight *spotLight; idLight *spotLight;
dir = GetAxis(); dir = GetAxis();
dir.NormalVectors( right, up ); dir.NormalVectors( right, up );
target = GetPhysics()->GetOrigin() + dir * scanDist; target = GetPhysics()->GetOrigin() + dir * scanDist;
radius = tan( scanFov * idMath::PI / 360.0f ); radius = tan( scanFov * idMath::PI / 360.0f );
up = dir + up * radius; up = dir + up * radius;
up.Normalize(); up.Normalize();
up = GetPhysics()->GetOrigin() + up * scanDist; up = GetPhysics()->GetOrigin() + up * scanDist;
up -= target; up -= target;
right = dir + right * radius; right = dir + right * radius;
right.Normalize(); right.Normalize();
right = GetPhysics()->GetOrigin() + right * scanDist; right = GetPhysics()->GetOrigin() + right * scanDist;
right -= target; right -= target;
spawnArgs.GetVector( "lightOffset", "0 0 0", lightOffset ); spawnArgs.GetVector( "lightOffset", "0 0 0", lightOffset );
args.Set( "origin", ( GetPhysics()->GetOrigin() + lightOffset ).ToString() ); args.Set( "origin", ( GetPhysics()->GetOrigin() + lightOffset ).ToString() );
args.Set( "light_target", target.ToString() ); args.Set( "light_target", target.ToString() );
args.Set( "light_right", right.ToString() ); args.Set( "light_right", right.ToString() );
@ -393,7 +393,7 @@ void idSecurityCamera::Think( void ) {
SetAlertMode(LOSINGINTEREST); SetAlertMode(LOSINGINTEREST);
CancelEvents( &EV_SecurityCam_Alert ); CancelEvents( &EV_SecurityCam_Alert );
sightResume = spawnArgs.GetFloat( "sightResume", "1.5" ); sightResume = spawnArgs.GetFloat( "sightResume", "1.5" );
PostEventSec( &EV_SecurityCam_ContinueSweep, sightResume ); PostEventSec( &EV_SecurityCam_ContinueSweep, sightResume );
} }
@ -446,7 +446,7 @@ void idSecurityCamera::StartSweep( void ) {
sweepStart = gameLocal.time; sweepStart = gameLocal.time;
speed = SEC2MS( SweepSpeed() ); speed = SEC2MS( SweepSpeed() );
sweepEnd = sweepStart + speed; sweepEnd = sweepStart + speed;
PostEventMS( &EV_SecurityCam_Pause, speed ); PostEventMS( &EV_SecurityCam_Pause, speed );
StartSound( "snd_moving", SND_CHANNEL_BODY, 0, false, NULL ); StartSound( "snd_moving", SND_CHANNEL_BODY, 0, false, NULL );
} }
@ -463,7 +463,7 @@ void idSecurityCamera::Event_ContinueSweep( void ) {
sweepStart = f; sweepStart = f;
speed = MS2SEC( SweepSpeed() ); speed = MS2SEC( SweepSpeed() );
sweepEnd = sweepStart + speed; sweepEnd = sweepStart + speed;
PostEventMS( &EV_SecurityCam_Pause, speed * (1.0 - pct)); PostEventMS( &EV_SecurityCam_Pause, speed * (1.0 - pct));
StartSound( "snd_moving", SND_CHANNEL_BODY, 0, false, NULL ); StartSound( "snd_moving", SND_CHANNEL_BODY, 0, false, NULL );
SetAlertMode(SCANNING); SetAlertMode(SCANNING);
sweeping = true; sweeping = true;
@ -510,7 +510,7 @@ void idSecurityCamera::Event_Pause( void ) {
sweeping = false; sweeping = false;
StopSound( SND_CHANNEL_ANY, false ); StopSound( SND_CHANNEL_ANY, false );
StartSound( "snd_stop", SND_CHANNEL_BODY, 0, false, NULL ); StartSound( "snd_stop", SND_CHANNEL_BODY, 0, false, NULL );
PostEventSec( &EV_SecurityCam_ReverseSweep, sweepWait ); PostEventSec( &EV_SecurityCam_ReverseSweep, sweepWait );
} }
/* /*

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -65,7 +65,7 @@ private:
bool flipAxis; bool flipAxis;
float scanDist; float scanDist;
float scanFov; float scanFov;
float sweepStart; float sweepStart;
float sweepEnd; float sweepEnd;
bool negativeSweep; bool negativeSweep;
@ -75,7 +75,7 @@ private:
float scanFovCos; float scanFovCos;
idVec3 viewOffset; idVec3 viewOffset;
int pvsArea; int pvsArea;
idPhysics_RigidBody physicsObj; idPhysics_RigidBody physicsObj;
idTraceModel trm; idTraceModel trm;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -216,7 +216,7 @@ bool idSmokeParticles::EmitSmoke( const idDeclParticle *smoke, const int systemS
} }
// see how many particles we should emit this tic // see how many particles we should emit this tic
// FIXME: smoke.privateStartTime += stage->timeOffset; // FIXME: smoke.privateStartTime += stage->timeOffset;
int finalParticleTime = stage->cycleMsec * stage->spawnBunching; int finalParticleTime = stage->cycleMsec * stage->spawnBunching;
int deltaMsec = gameLocal.time - systemStartTime; int deltaMsec = gameLocal.time - systemStartTime;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -302,4 +302,3 @@ idSound::ShowEditingDialog
void idSound::ShowEditingDialog( void ) { void idSound::ShowEditingDialog( void ) {
common->InitTool( EDITOR_SOUND, &spawnArgs ); common->InitTool( EDITOR_SOUND, &spawnArgs );
} }

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -602,7 +602,7 @@ idTarget_Give::Event_Activate
================ ================
*/ */
void idTarget_Give::Event_Activate( idEntity *activator ) { void idTarget_Give::Event_Activate( idEntity *activator ) {
if ( spawnArgs.GetBool( "development" ) && developer.GetInteger() == 0 ) { if ( spawnArgs.GetBool( "development" ) && developer.GetInteger() == 0 ) {
return; return;
} }
@ -913,7 +913,7 @@ idTarget_SetInfluence::Event_ClearFlash
*/ */
void idTarget_SetInfluence::Event_ClearFlash( float flash ) { void idTarget_SetInfluence::Event_ClearFlash( float flash ) {
idPlayer *player = gameLocal.GetLocalPlayer(); idPlayer *player = gameLocal.GetLocalPlayer();
player->playerView.Fade( vec4_zero , flash ); player->playerView.Fade( vec4_zero , flash );
} }
/* /*
================ ================
@ -1073,7 +1073,7 @@ void idTarget_SetInfluence::Event_Activate( idEntity *activator ) {
if ( parm && *parm ) { if ( parm && *parm ) {
light->SetShader( parm ); light->SetShader( parm );
} }
color = light->spawnArgs.GetVector( "_color" ); color = light->spawnArgs.GetVector( "_color" );
color = light->spawnArgs.GetVector( "color_demonic", color.ToString() ); color = light->spawnArgs.GetVector( "color_demonic", color.ToString() );
colorTo.Set( color.x, color.y, color.z, 1.0f ); colorTo.Set( color.x, color.y, color.z, 1.0f );
@ -1133,7 +1133,7 @@ void idTarget_SetInfluence::Event_Activate( idEntity *activator ) {
if ( spawnArgs.GetBool( "effect_vision" ) ) { if ( spawnArgs.GetBool( "effect_vision" ) ) {
parm = spawnArgs.GetString( "mtrVision" ); parm = spawnArgs.GetString( "mtrVision" );
skin = spawnArgs.GetString( "skinVision" ); skin = spawnArgs.GetString( "skinVision" );
player->SetInfluenceView( parm, skin, spawnArgs.GetInt( "visionRadius" ), this ); player->SetInfluenceView( parm, skin, spawnArgs.GetInt( "visionRadius" ), this );
} }
parm = spawnArgs.GetString( "mtrWorld" ); parm = spawnArgs.GetString( "mtrWorld" );
@ -1798,4 +1798,3 @@ void idTarget_FadeSoundClass::Event_RestoreVolume() {
// restore volume // restore volume
gameSoundWorld->FadeSoundClasses( 0, fadeDB, fadeTime ); gameSoundWorld->FadeSoundClasses( 0, fadeDB, fadeTime );
} }

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -36,7 +36,7 @@ If you have questions concerning this license or the applicable additional terms
=============================================================================== ===============================================================================
idTrigger idTrigger
=============================================================================== ===============================================================================
*/ */
@ -239,7 +239,7 @@ void idTrigger::Spawn( void ) {
=============================================================================== ===============================================================================
idTrigger_Multi idTrigger_Multi
=============================================================================== ===============================================================================
*/ */
@ -325,7 +325,7 @@ void idTrigger_Multi::Spawn( void ) {
spawnArgs.GetFloat( "random", "0", random ); spawnArgs.GetFloat( "random", "0", random );
spawnArgs.GetFloat( "delay", "0", delay ); spawnArgs.GetFloat( "delay", "0", delay );
spawnArgs.GetFloat( "random_delay", "0", random_delay ); spawnArgs.GetFloat( "random_delay", "0", random_delay );
if ( random && ( random >= wait ) && ( wait >= 0 ) ) { if ( random && ( random >= wait ) && ( wait >= 0 ) ) {
random = wait - 1; random = wait - 1;
gameLocal.Warning( "idTrigger_Multi '%s' at (%s) has random >= wait", name.c_str(), GetPhysics()->GetOrigin().ToString(0) ); gameLocal.Warning( "idTrigger_Multi '%s' at (%s) has random >= wait", name.c_str(), GetPhysics()->GetOrigin().ToString(0) );
@ -515,7 +515,7 @@ void idTrigger_Multi::Event_Touch( idEntity *other, trace_t *trace ) {
=============================================================================== ===============================================================================
idTrigger_EntityName idTrigger_EntityName
=============================================================================== ===============================================================================
*/ */
@ -579,7 +579,7 @@ void idTrigger_EntityName::Spawn( void ) {
spawnArgs.GetFloat( "random", "0", random ); spawnArgs.GetFloat( "random", "0", random );
spawnArgs.GetFloat( "delay", "0", delay ); spawnArgs.GetFloat( "delay", "0", delay );
spawnArgs.GetFloat( "random_delay", "0", random_delay ); spawnArgs.GetFloat( "random_delay", "0", random_delay );
if ( random && ( random >= wait ) && ( wait >= 0 ) ) { if ( random && ( random >= wait ) && ( wait >= 0 ) ) {
random = wait - 1; random = wait - 1;
gameLocal.Warning( "idTrigger_EntityName '%s' at (%s) has random >= wait", name.c_str(), GetPhysics()->GetOrigin().ToString(0) ); gameLocal.Warning( "idTrigger_EntityName '%s' at (%s) has random >= wait", name.c_str(), GetPhysics()->GetOrigin().ToString(0) );
@ -702,7 +702,7 @@ void idTrigger_EntityName::Event_Touch( idEntity *other, trace_t *trace ) {
=============================================================================== ===============================================================================
idTrigger_Timer idTrigger_Timer
=============================================================================== ===============================================================================
*/ */
@ -846,7 +846,7 @@ void idTrigger_Timer::Event_Use( idEntity *activator ) {
=============================================================================== ===============================================================================
idTrigger_Count idTrigger_Count
=============================================================================== ===============================================================================
*/ */
@ -936,7 +936,7 @@ void idTrigger_Count::Event_TriggerAction( idEntity *activator ) {
=============================================================================== ===============================================================================
idTrigger_Hurt idTrigger_Hurt
=============================================================================== ===============================================================================
*/ */
@ -1076,7 +1076,7 @@ void idTrigger_Fade::Event_Trigger( idEntity *activator ) {
=============================================================================== ===============================================================================
idTrigger_Touch idTrigger_Touch
=============================================================================== ===============================================================================
*/ */
@ -1158,7 +1158,7 @@ void idTrigger_Touch::TouchEntities( void ) {
if ( !entity ) { if ( !entity ) {
continue; continue;
} }
if ( !gameLocal.clip.ContentsModel( cm->GetOrigin(), cm, cm->GetAxis(), -1, if ( !gameLocal.clip.ContentsModel( cm->GetOrigin(), cm, cm->GetAxis(), -1,
clipModel->Handle(), clipModel->GetOrigin(), clipModel->GetAxis() ) ) { clipModel->Handle(), clipModel->GetOrigin(), clipModel->GetAxis() ) ) {
continue; continue;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -86,11 +86,11 @@ public:
void Save( idSaveGame *savefile ) const; void Save( idSaveGame *savefile ) const;
void Restore( idRestoreGame *savefile ); void Restore( idRestoreGame *savefile );
#ifdef CTF #ifdef CTF
protected: protected:
#else #else
private: private:
#endif #endif
float wait; float wait;
float random; float random;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -33,8 +33,8 @@ If you have questions concerning this license or the applicable additional terms
/*********************************************************************** /***********************************************************************
idWeapon idWeapon
***********************************************************************/ ***********************************************************************/
// //
@ -645,7 +645,7 @@ void idWeapon::Restore( idRestoreGame *savefile ) {
for(int i = 0; i < lightCount; i++) { for(int i = 0; i < lightCount; i++) {
WeaponLight_t newLight; WeaponLight_t newLight;
memset(&newLight, 0, sizeof(newLight)); memset(&newLight, 0, sizeof(newLight));
idStr name; idStr name;
savefile->ReadString( name ); savefile->ReadString( name );
strcpy( newLight.name, name.c_str() ); strcpy( newLight.name, name.c_str() );
@ -730,7 +730,7 @@ void idWeapon::Clear( void ) {
refSound.referenceSound->Free( true ); refSound.referenceSound->Free( true );
} }
memset( &refSound, 0, sizeof( refSound_t ) ); memset( &refSound, 0, sizeof( refSound_t ) );
// setting diversity to 0 results in no random sound. -1 indicates random. // setting diversity to 0 results in no random sound. -1 indicates random.
refSound.diversity = -1.0f; refSound.diversity = -1.0f;
@ -1158,7 +1158,7 @@ void idWeapon::GetWeaponDef( const char *objectname, int ammoinclip ) {
if ( !weaponDef->dict.GetString( "weapon_scriptobject", NULL, &objectType ) ) { if ( !weaponDef->dict.GetString( "weapon_scriptobject", NULL, &objectType ) ) {
gameLocal.Error( "No 'weapon_scriptobject' set on '%s'.", objectname ); gameLocal.Error( "No 'weapon_scriptobject' set on '%s'.", objectname );
} }
// setup script object // setup script object
if ( !scriptObject.SetType( objectType ) ) { if ( !scriptObject.SetType( objectType ) ) {
gameLocal.Error( "Script object '%s' not found on weapon '%s'.", objectType, objectname ); gameLocal.Error( "Script object '%s' not found on weapon '%s'.", objectType, objectname );
@ -1295,7 +1295,7 @@ void idWeapon::UpdateGUI( void ) {
if ( !renderEntity.gui[ 0 ] ) { if ( !renderEntity.gui[ 0 ] ) {
return; return;
} }
if ( status == WP_HOLSTERED ) { if ( status == WP_HOLSTERED ) {
return; return;
} }
@ -1385,7 +1385,7 @@ idWeapon::MuzzleFlashLight
================ ================
*/ */
void idWeapon::MuzzleFlashLight( void ) { void idWeapon::MuzzleFlashLight( void ) {
if ( !lightOn && ( !g_muzzleFlash.GetBool() || !muzzleFlash.lightRadius[0] ) ) { if ( !lightOn && ( !g_muzzleFlash.GetBool() || !muzzleFlash.lightRadius[0] ) ) {
return; return;
} }
@ -1432,7 +1432,7 @@ bool idWeapon::UpdateSkin( void ) {
common->Warning( "Can't find function 'UpdateSkin' in object '%s'", scriptObject.GetTypeName() ); common->Warning( "Can't find function 'UpdateSkin' in object '%s'", scriptObject.GetTypeName() );
return false; return false;
} }
// use the frameCommandThread since it's safe to use outside of framecommands // use the frameCommandThread since it's safe to use outside of framecommands
gameLocal.frameCommandThread->CallFunction( this, func, true ); gameLocal.frameCommandThread->CallFunction( this, func, true );
gameLocal.frameCommandThread->Execute(); gameLocal.frameCommandThread->Execute();
@ -1676,7 +1676,7 @@ void idWeapon::OwnerDied( void ) {
idWeapon::BeginAttack idWeapon::BeginAttack
================ ================
*/ */
void idWeapon::BeginAttack( void ) { void idWeapon::BeginAttack( void ) {
if ( status != WP_OUTOFAMMO ) { if ( status != WP_OUTOFAMMO ) {
lastAttack = gameLocal.time; lastAttack = gameLocal.time;
} }
@ -1991,7 +1991,7 @@ void idWeapon::MuzzleRise( idVec3 &origin, idMat3 &axis ) {
if ( time > muzzle_kick_maxtime ) { if ( time > muzzle_kick_maxtime ) {
time = muzzle_kick_maxtime; time = muzzle_kick_maxtime;
} }
amount = ( float )time / ( float )muzzle_kick_maxtime; amount = ( float )time / ( float )muzzle_kick_maxtime;
ang = muzzle_kick_angles * amount; ang = muzzle_kick_angles * amount;
offset = muzzle_kick_offset * amount; offset = muzzle_kick_offset * amount;
@ -2042,7 +2042,7 @@ void idWeapon::DeconstructScriptObject( void ) {
if ( !thread ) { if ( !thread ) {
return; return;
} }
// don't bother calling the script object's destructor on map shutdown // don't bother calling the script object's destructor on map shutdown
if ( gameLocal.GameState() == GAMESTATE_SHUTDOWN ) { if ( gameLocal.GameState() == GAMESTATE_SHUTDOWN ) {
return; return;
@ -2156,7 +2156,7 @@ void idWeapon::PresentWeapon( bool showViewModel ) {
// hide offset is for dropping the gun when approaching a GUI or NPC // hide offset is for dropping the gun when approaching a GUI or NPC
// This is simpler to manage than doing the weapon put-away animation // This is simpler to manage than doing the weapon put-away animation
if ( gameLocal.time - hideStartTime < hideTime ) { if ( gameLocal.time - hideStartTime < hideTime ) {
float frac = ( float )( gameLocal.time - hideStartTime ) / ( float )hideTime; float frac = ( float )( gameLocal.time - hideStartTime ) / ( float )hideTime;
if ( hideStart < hideEnd ) { if ( hideStart < hideEnd ) {
frac = 1.0f - frac; frac = 1.0f - frac;
@ -2689,7 +2689,7 @@ void idWeapon::WriteToSnapshot( idBitMsgDelta &msg ) const {
idWeapon::ReadFromSnapshot idWeapon::ReadFromSnapshot
================ ================
*/ */
void idWeapon::ReadFromSnapshot( const idBitMsgDelta &msg ) { void idWeapon::ReadFromSnapshot( const idBitMsgDelta &msg ) {
ammoClip = msg.ReadBits( ASYNC_PLAYER_INV_CLIP_BITS ); ammoClip = msg.ReadBits( ASYNC_PLAYER_INV_CLIP_BITS );
worldModel.SetSpawnId( msg.ReadBits( 32 ) ); worldModel.SetSpawnId( msg.ReadBits( 32 ) );
bool snapLight = msg.ReadBits( 1 ) != 0; bool snapLight = msg.ReadBits( 1 ) != 0;
@ -2703,10 +2703,10 @@ void idWeapon::ReadFromSnapshot( const idBitMsgDelta &msg ) {
idealState = "Fire"; idealState = "Fire";
} }
// immediately switch back to idle // immediately switch back to idle
if ( WEAPON_NETFIRING && !isFiring ) { if ( WEAPON_NETFIRING && !isFiring ) {
idealState = "Idle"; idealState = "Idle";
} }
WEAPON_NETFIRING = isFiring; WEAPON_NETFIRING = isFiring;
} }
@ -2944,7 +2944,7 @@ idWeapon::Event_AmmoInClip
*/ */
void idWeapon::Event_AmmoInClip( void ) { void idWeapon::Event_AmmoInClip( void ) {
int ammo = AmmoInClip(); int ammo = AmmoInClip();
idThread::ReturnFloat( ammo ); idThread::ReturnFloat( ammo );
} }
/* /*
@ -2979,7 +2979,7 @@ idWeapon::Event_ClipSize
=============== ===============
*/ */
void idWeapon::Event_ClipSize( void ) { void idWeapon::Event_ClipSize( void ) {
idThread::ReturnFloat( clipSize ); idThread::ReturnFloat( clipSize );
} }
/* /*
@ -3027,7 +3027,7 @@ idWeapon::Event_PlayAnim
*/ */
void idWeapon::Event_PlayAnim( int channel, const char *animname ) { void idWeapon::Event_PlayAnim( int channel, const char *animname ) {
int anim; int anim;
anim = animator.GetAnim( animname ); anim = animator.GetAnim( animname );
if ( !anim ) { if ( !anim ) {
gameLocal.Warning( "missing '%s' animation on '%s' (%s)", animname, name.c_str(), GetEntityDefName() ); gameLocal.Warning( "missing '%s' animation on '%s' (%s)", animname, name.c_str(), GetEntityDefName() );
@ -3311,13 +3311,13 @@ void idWeapon::Event_LaunchProjectiles( int num_projectiles, float spread, float
return; return;
} }
#endif #endif
// if this is a power ammo weapon ( currently only the bfg ) then make sure // if this is a power ammo weapon ( currently only the bfg ) then make sure
// we only fire as much power as available in each clip // we only fire as much power as available in each clip
if ( powerAmmo ) { if ( powerAmmo ) {
// power comes in as a float from zero to max // power comes in as a float from zero to max
// if we use this on more than the bfg will need to define the max // if we use this on more than the bfg will need to define the max
// in the .def as opposed to just in the script so proper calcs // in the .def as opposed to just in the script so proper calcs
// can be done here. // can be done here.
dmgPower = ( int )dmgPower + 1; dmgPower = ( int )dmgPower + 1;
if ( dmgPower > ammoClip ) { if ( dmgPower > ammoClip ) {
dmgPower = ammoClip; dmgPower = ammoClip;
@ -3611,14 +3611,14 @@ void idWeapon::Event_LaunchProjectilesEllipse( int num_projectiles, float spread
} }
/** /**
* Gives the player a powerup as if it were a weapon shot. It will use the ammo amount specified * Gives the player a powerup as if it were a weapon shot. It will use the ammo amount specified
* as ammoRequired. * as ammoRequired.
*/ */
void idWeapon::Event_LaunchPowerup( const char* powerup, float duration, int useAmmo ) { void idWeapon::Event_LaunchPowerup( const char* powerup, float duration, int useAmmo ) {
if ( IsHidden() ) { if ( IsHidden() ) {
return; return;
} }
// check if we're out of ammo // check if we're out of ammo
@ -3766,12 +3766,12 @@ void idWeapon::Event_Melee( void ) {
&& !owner->PowerUpActive( BERSERK ) && !owner->PowerUpActive( BERSERK )
&& ( (gameLocal.gameType != GAME_TDM ) || gameLocal.serverInfo.GetBool( "si_teamDamage" ) || ( owner->team != static_cast< idPlayer * >( ent )->team ) ) && ( (gameLocal.gameType != GAME_TDM ) || gameLocal.serverInfo.GetBool( "si_teamDamage" ) || ( owner->team != static_cast< idPlayer * >( ent )->team ) )
) { ) {
#ifdef CTF /* Code is formed oddly for easy merge */ #ifdef CTF /* Code is formed oddly for easy merge */
if ( gameLocal.mpGame.IsGametypeFlagBased() ) if ( gameLocal.mpGame.IsGametypeFlagBased() )
{ /* Do nothing ... */ } { /* Do nothing ... */ }
else else
#endif #endif
owner->StealWeapon( static_cast< idPlayer * >( ent ) ); owner->StealWeapon( static_cast< idPlayer * >( ent ) );
} }
@ -3934,5 +3934,5 @@ idWeapon::ClientPredictionThink
=============== ===============
*/ */
void idWeapon::ClientPredictionThink( void ) { void idWeapon::ClientPredictionThink( void ) {
UpdateAnimation(); UpdateAnimation();
} }

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms
=============================================================================== ===============================================================================
Player Weapon Player Weapon
=============================================================================== ===============================================================================
*/ */
@ -231,7 +231,7 @@ private:
// the view weapon render entity parms // the view weapon render entity parms
idVec3 viewWeaponOrigin; idVec3 viewWeaponOrigin;
idMat3 viewWeaponAxis; idMat3 viewWeaponAxis;
// the muzzle bone's position, used for launching projectiles and trailing smoke // the muzzle bone's position, used for launching projectiles and trailing smoke
idVec3 muzzleOrigin; idVec3 muzzleOrigin;
idMat3 muzzleAxis; idMat3 muzzleAxis;
@ -290,7 +290,7 @@ private:
bool isFiring; bool isFiring;
// zoom // zoom
int zoomFov; // variable zoom fov per weapon int zoomFov; // variable zoom fov per weapon
// joints from models // joints from models
jointHandle_t barrelJointView; jointHandle_t barrelJointView;
@ -318,8 +318,8 @@ private:
int weaponSmokeStartTime; // set to gameLocal.time every weapon fire int weaponSmokeStartTime; // set to gameLocal.time every weapon fire
bool continuousSmoke; // if smoke is continuous ( chainsaw ) bool continuousSmoke; // if smoke is continuous ( chainsaw )
const idDeclParticle * strikeSmoke; // striking something in melee const idDeclParticle * strikeSmoke; // striking something in melee
int strikeSmokeStartTime; // timing int strikeSmokeStartTime; // timing
idVec3 strikePos; // position of last melee strike idVec3 strikePos; // position of last melee strike
idMat3 strikeAxis; // axis of last melee strike idMat3 strikeAxis; // axis of last melee strike
int nextStrikeFx; // used for sound and decal ( may use for strike smoke too ) int nextStrikeFx; // used for sound and decal ( may use for strike smoke too )

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -163,7 +163,7 @@ int idAASLocal::BoundsReachableAreaNum( const idBounds &bounds, const int areaFl
if ( !file ) { if ( !file ) {
return 0; return 0;
} }
return file->BoundsReachableAreaNum( bounds, areaFlags, TFL_INVALID ); return file->BoundsReachableAreaNum( bounds, areaFlags, TFL_INVALID );
} }

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -196,7 +196,7 @@ void idAASLocal::ShowArea( const idVec3 &origin ) const {
if ( aas_goalArea.GetInteger() ) { if ( aas_goalArea.GetInteger() ) {
int travelTime; int travelTime;
idReachability *reach; idReachability *reach;
RouteToGoalArea( areaNum, org, aas_goalArea.GetInteger(), TFL_WALK|TFL_AIR, travelTime, &reach ); RouteToGoalArea( areaNum, org, aas_goalArea.GetInteger(), TFL_WALK|TFL_AIR, travelTime, &reach );
gameLocal.Printf( "\rtt = %4d", travelTime ); gameLocal.Printf( "\rtt = %4d", travelTime );
if ( reach ) { if ( reach ) {

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -1193,7 +1193,7 @@ bool idAASLocal::FindNearestGoal( aasGoal_t &goal, int areaNum, const idVec3 ori
obstacles[k].expAbsBounds[0] = obstacles[k].absBounds[0] - file->GetSettings().boundingBoxes[0][1]; obstacles[k].expAbsBounds[0] = obstacles[k].absBounds[0] - file->GetSettings().boundingBoxes[0][1];
obstacles[k].expAbsBounds[1] = obstacles[k].absBounds[1] - file->GetSettings().boundingBoxes[0][0]; obstacles[k].expAbsBounds[1] = obstacles[k].absBounds[1] - file->GetSettings().boundingBoxes[0][0];
} }
badTravelFlags = ~travelFlags; badTravelFlags = ~travelFlags;
SIMDProcessor->Memset( goalAreaTravelTimes, 0, file->GetNumAreas() * sizeof( unsigned short ) ); SIMDProcessor->Memset( goalAreaTravelTimes, 0, file->GetNumAreas() * sizeof( unsigned short ) );
@ -1327,7 +1327,7 @@ bool idAASLocal::FindNearestGoal( aasGoal_t &goal, int areaNum, const idVec3 ori
// add travel time through the area // add travel time through the area
t += AreaTravelTime( reach->toAreaNum, reach->end, nextArea->center ); t += AreaTravelTime( reach->toAreaNum, reach->end, nextArea->center );
if ( !bestTravelTime || t < bestTravelTime ) { if ( !bestTravelTime || t < bestTravelTime ) {
// if the area is not visible to the target // if the area is not visible to the target
if ( callback.TestArea( this, reach->toAreaNum ) ) { if ( callback.TestArea( this, reach->toAreaNum ) ) {

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -221,7 +221,7 @@ idAASFindAttackPosition::idAASFindAttackPosition( const idAI *self, const idMat3
this->gravityAxis = gravityAxis; this->gravityAxis = gravityAxis;
excludeBounds = idBounds( idVec3( -64.0, -64.0f, -8.0f ), idVec3( 64.0, 64.0f, 64.0f ) ); excludeBounds = idBounds( idVec3( -64.0, -64.0f, -8.0f ), idVec3( 64.0, 64.0f, 64.0f ) );
excludeBounds.TranslateSelf( self->GetPhysics()->GetOrigin() ); excludeBounds.TranslateSelf( self->GetPhysics()->GetOrigin() );
// setup PVS // setup PVS
idBounds bounds( targetPos - idVec3( 16, 16, 0 ), targetPos + idVec3( 16, 16, 64 ) ); idBounds bounds( targetPos - idVec3( 16, 16, 0 ), targetPos + idVec3( 16, 16, 64 ) );
@ -737,13 +737,13 @@ void idAI::Restore( idRestoreGame *savefile ) {
memset(&newEmitter, 0, sizeof(newEmitter)); memset(&newEmitter, 0, sizeof(newEmitter));
idStr name; idStr name;
savefile->ReadString( name ); savefile->ReadString( name );
strcpy( newEmitter.name, name.c_str() ); strcpy( newEmitter.name, name.c_str() );
savefile->ReadJoint( newEmitter.joint ); savefile->ReadJoint( newEmitter.joint );
savefile->ReadObject(reinterpret_cast<idClass *&>(newEmitter.particle)); savefile->ReadObject(reinterpret_cast<idClass *&>(newEmitter.particle));
funcEmitters.Set(newEmitter.name, newEmitter); funcEmitters.Set(newEmitter.name, newEmitter);
} }
@ -751,7 +751,7 @@ void idAI::Restore( idRestoreGame *savefile ) {
//if(harvestEnt.GetEntity()) { //if(harvestEnt.GetEntity()) {
// harvestEnt.GetEntity()->SetParent(this); // harvestEnt.GetEntity()->SetParent(this);
//} //}
#endif #endif
} }
@ -789,7 +789,7 @@ void idAI::Spawn( void ) {
spawnArgs.GetFloat( "melee_range", "64", melee_range ); spawnArgs.GetFloat( "melee_range", "64", melee_range );
spawnArgs.GetFloat( "projectile_height_to_distance_ratio", "1", projectile_height_to_distance_ratio ); spawnArgs.GetFloat( "projectile_height_to_distance_ratio", "1", projectile_height_to_distance_ratio );
spawnArgs.GetFloat( "turn_rate", "360", turnRate ); spawnArgs.GetFloat( "turn_rate", "360", turnRate );
spawnArgs.GetBool( "talks", "0", talks ); spawnArgs.GetBool( "talks", "0", talks );
@ -921,7 +921,7 @@ void idAI::Spawn( void ) {
// move up to make sure the monster is at least an epsilon above the floor // move up to make sure the monster is at least an epsilon above the floor
physicsObj.SetOrigin( GetPhysics()->GetOrigin() + idVec3( 0, 0, CM_CLIP_EPSILON ) ); physicsObj.SetOrigin( GetPhysics()->GetOrigin() + idVec3( 0, 0, CM_CLIP_EPSILON ) );
if ( num_cinematics ) { if ( num_cinematics ) {
physicsObj.SetGravity( vec3_origin ); physicsObj.SetGravity( vec3_origin );
} else { } else {
@ -1016,7 +1016,7 @@ void idAI::InitMuzzleFlash( void ) {
spawnArgs.GetString( "mtr_flashShader", "muzzleflash", &shader ); spawnArgs.GetString( "mtr_flashShader", "muzzleflash", &shader );
spawnArgs.GetVector( "flashColor", "0 0 0", flashColor ); spawnArgs.GetVector( "flashColor", "0 0 0", flashColor );
float flashRadius = spawnArgs.GetFloat( "flashRadius" ); float flashRadius = spawnArgs.GetFloat( "flashRadius" );
flashTime = SEC2MS( spawnArgs.GetFloat( "flashTime", "0.25" ) ); flashTime = SEC2MS( spawnArgs.GetFloat( "flashTime", "0.25" ) );
memset( &worldMuzzleFlash, 0, sizeof ( worldMuzzleFlash ) ); memset( &worldMuzzleFlash, 0, sizeof ( worldMuzzleFlash ) );
@ -1104,7 +1104,7 @@ void idAI::DormantEnd( void ) {
// let our enemy know we're back on the trail // let our enemy know we're back on the trail
enemyNode.AddToEnd( enemy.GetEntity()->enemyList ); enemyNode.AddToEnd( enemy.GetEntity()->enemyList );
} }
if ( particles.Num() ) { if ( particles.Num() ) {
for ( int i = 0; i < particles.Num(); i++ ) { for ( int i = 0; i < particles.Num(); i++ ) {
particles[i].time = gameLocal.time; particles[i].time = gameLocal.time;
@ -1418,7 +1418,7 @@ idAI::ReachedPos
bool idAI::ReachedPos( const idVec3 &pos, const moveCommand_t moveCommand ) const { bool idAI::ReachedPos( const idVec3 &pos, const moveCommand_t moveCommand ) const {
if ( move.moveType == MOVETYPE_SLIDE ) { if ( move.moveType == MOVETYPE_SLIDE ) {
idBounds bnds( idVec3( -4, -4.0f, -8.0f ), idVec3( 4.0f, 4.0f, 64.0f ) ); idBounds bnds( idVec3( -4, -4.0f, -8.0f ), idVec3( 4.0f, 4.0f, 64.0f ) );
bnds.TranslateSelf( physicsObj.GetOrigin() ); bnds.TranslateSelf( physicsObj.GetOrigin() );
if ( bnds.ContainsPoint( pos ) ) { if ( bnds.ContainsPoint( pos ) ) {
return true; return true;
} }
@ -1429,7 +1429,7 @@ bool idAI::ReachedPos( const idVec3 &pos, const moveCommand_t moveCommand ) cons
} }
} else { } else {
idBounds bnds( idVec3( -16.0, -16.0f, -8.0f ), idVec3( 16.0, 16.0f, 64.0f ) ); idBounds bnds( idVec3( -16.0, -16.0f, -8.0f ), idVec3( 16.0, 16.0f, 64.0f ) );
bnds.TranslateSelf( physicsObj.GetOrigin() ); bnds.TranslateSelf( physicsObj.GetOrigin() );
if ( bnds.ContainsPoint( pos ) ) { if ( bnds.ContainsPoint( pos ) ) {
return true; return true;
} }
@ -2090,7 +2090,7 @@ idAI::WanderAround
*/ */
bool idAI::WanderAround( void ) { bool idAI::WanderAround( void ) {
StopMove( MOVE_STATUS_DONE ); StopMove( MOVE_STATUS_DONE );
move.moveDest = physicsObj.GetOrigin() + viewAxis[ 0 ] * physicsObj.GetGravityAxis() * 256.0f; move.moveDest = physicsObj.GetOrigin() + viewAxis[ 0 ] * physicsObj.GetGravityAxis() * 256.0f;
if ( !NewWanderDir( move.moveDest ) ) { if ( !NewWanderDir( move.moveDest ) ) {
StopMove( MOVE_STATUS_DEST_UNREACHABLE ); StopMove( MOVE_STATUS_DEST_UNREACHABLE );
@ -2163,7 +2163,7 @@ bool idAI::StepDirection( float dir ) {
if ( z <= ceilingPos.z ) { if ( z <= ceilingPos.z ) {
start.x = org.x; start.x = org.x;
start.y = org.y; start.y = org.y;
start.z = z; start.z = z;
} else { } else {
start = ceilingPos; start = ceilingPos;
} }
@ -2250,7 +2250,7 @@ bool idAI::NewWanderDir( const idVec3 &dest ) {
if ( gameLocal.random.RandomInt() & 1 ) { if ( gameLocal.random.RandomInt() & 1 ) {
for( tdir = 0; tdir <= 315; tdir += 45 ) { for( tdir = 0; tdir <= 315; tdir += 45 ) {
if ( tdir != turnaround && StepDirection( tdir ) ) { if ( tdir != turnaround && StepDirection( tdir ) ) {
return true; return true;
} }
} }
} else { } else {
@ -2303,7 +2303,7 @@ bool idAI::GetMovePos( idVec3 &seekPos ) {
} }
return false; return false;
break; break;
case MOVE_SLIDE_TO_POSITION : case MOVE_SLIDE_TO_POSITION :
seekPos = org; seekPos = org;
return false; return false;
@ -2739,7 +2739,7 @@ void idAI::AnimMove( void ) {
AI_BLOCKED = false; AI_BLOCKED = false;
if ( move.moveCommand < NUM_NONMOVING_COMMANDS ){ if ( move.moveCommand < NUM_NONMOVING_COMMANDS ){
move.lastMoveOrigin.Zero(); move.lastMoveOrigin.Zero();
move.lastMoveTime = gameLocal.time; move.lastMoveTime = gameLocal.time;
} }
@ -2861,7 +2861,7 @@ void idAI::SlideMove( void ) {
AI_BLOCKED = false; AI_BLOCKED = false;
if ( move.moveCommand < NUM_NONMOVING_COMMANDS ){ if ( move.moveCommand < NUM_NONMOVING_COMMANDS ){
move.lastMoveOrigin.Zero(); move.lastMoveOrigin.Zero();
move.lastMoveTime = gameLocal.time; move.lastMoveTime = gameLocal.time;
} }
@ -2961,9 +2961,9 @@ idAI::AdjustFlyingAngles
*/ */
void idAI::AdjustFlyingAngles( void ) { void idAI::AdjustFlyingAngles( void ) {
idVec3 vel; idVec3 vel;
float speed; float speed;
float roll; float roll;
float pitch; float pitch;
vel = physicsObj.GetLinearVelocity(); vel = physicsObj.GetLinearVelocity();
@ -3042,7 +3042,7 @@ void idAI::AdjustFlyHeight( idVec3 &vel, const idVec3 &goalPos ) {
vel.z += addVel.z; vel.z += addVel.z;
goLower = true; goLower = true;
} }
if ( ai_debugMove.GetBool() ) { if ( ai_debugMove.GetBool() ) {
gameRenderWorld->DebugBounds( goLower ? colorRed : colorGreen, physicsObj.GetBounds(), path.endPos, gameLocal.msec ); gameRenderWorld->DebugBounds( goLower ? colorRed : colorGreen, physicsObj.GetBounds(), path.endPos, gameLocal.msec );
} }
@ -3072,7 +3072,7 @@ idAI::FlySeekGoal
*/ */
void idAI::FlySeekGoal( idVec3 &vel, idVec3 &goalPos ) { void idAI::FlySeekGoal( idVec3 &vel, idVec3 &goalPos ) {
idVec3 seekVel; idVec3 seekVel;
// seek the goal position // seek the goal position
seekVel = Seek( vel, physicsObj.GetOrigin(), goalPos, AI_SEEK_PREDICTION ); seekVel = Seek( vel, physicsObj.GetOrigin(), goalPos, AI_SEEK_PREDICTION );
seekVel *= fly_seek_scale; seekVel *= fly_seek_scale;
@ -3403,7 +3403,7 @@ void idAI::Killed( idEntity *inflictor, idEntity *attacker, int damage, const id
EndAttack(); EndAttack();
if ( g_debugDamage.GetBool() ) { if ( g_debugDamage.GetBool() ) {
gameLocal.Printf( "Damage: joint: '%s', zone '%s'\n", animator.GetJointName( ( jointHandle_t )location ), gameLocal.Printf( "Damage: joint: '%s', zone '%s'\n", animator.GetJointName( ( jointHandle_t )location ),
GetDamageGroup( location ) ); GetDamageGroup( location ) );
} }
@ -3503,7 +3503,7 @@ void idAI::Killed( idEntity *inflictor, idEntity *attacker, int damage, const id
idEntity *temp; idEntity *temp;
gameLocal.SpawnEntityDef( *harvestDef, &temp, false ); gameLocal.SpawnEntityDef( *harvestDef, &temp, false );
harvestEnt = static_cast<idHarvestable *>(temp); harvestEnt = static_cast<idHarvestable *>(temp);
} }
if(harvestEnt.GetEntity()) { if(harvestEnt.GetEntity()) {
@ -3628,7 +3628,7 @@ void idAI::Activate( idEntity *activator ) {
// update the script in cinematics so that entities don't start anims or show themselves a frame late. // update the script in cinematics so that entities don't start anims or show themselves a frame late.
if ( cinematic ) { if ( cinematic ) {
UpdateAIScript(); UpdateAIScript();
// make sure our model gets updated // make sure our model gets updated
animator.ForceUpdate(); animator.ForceUpdate();
@ -4046,7 +4046,7 @@ void idAI::CalculateAttackOffsets( void ) {
return; return;
} }
num = modelDef->NumAnims(); num = modelDef->NumAnims();
// needs to be off while getting the offsets so that we account for the distance the monster moves in the attack anim // needs to be off while getting the offsets so that we account for the distance the monster moves in the attack anim
animator.RemoveOriginOffset( false ); animator.RemoveOriginOffset( false );
@ -4175,7 +4175,7 @@ idProjectile *idAI::CreateProjectile( const idVec3 &pos, const idVec3 &dir ) {
clsname = projectileDef->GetString( "classname" ); clsname = projectileDef->GetString( "classname" );
gameLocal.Error( "Could not spawn entityDef '%s'", clsname ); gameLocal.Error( "Could not spawn entityDef '%s'", clsname );
} }
if ( !ent->IsType( idProjectile::Type ) ) { if ( !ent->IsType( idProjectile::Type ) ) {
clsname = ent->GetClassname(); clsname = ent->GetClassname();
gameLocal.Error( "'%s' is not an idProjectile", clsname ); gameLocal.Error( "'%s' is not an idProjectile", clsname );
@ -4650,7 +4650,7 @@ idAI::UpdateMuzzleFlash
================ ================
*/ */
void idAI::UpdateMuzzleFlash( void ) { void idAI::UpdateMuzzleFlash( void ) {
if ( worldMuzzleFlashHandle != -1 ) { if ( worldMuzzleFlashHandle != -1 ) {
if ( gameLocal.time >= muzzleFlashEnd ) { if ( gameLocal.time >= muzzleFlashEnd ) {
gameRenderWorld->FreeLightDef( worldMuzzleFlashHandle ); gameRenderWorld->FreeLightDef( worldMuzzleFlashHandle );
worldMuzzleFlashHandle = -1; worldMuzzleFlashHandle = -1;
@ -4841,7 +4841,7 @@ void idAI::TriggerParticles( const char *jointName ) {
#ifdef _D3XP #ifdef _D3XP
void idAI::TriggerFX( const char* joint, const char* fx ) { void idAI::TriggerFX( const char* joint, const char* fx ) {
if( !strcmp(joint, "origin") ) { if( !strcmp(joint, "origin") ) {
idEntityFx::StartFx( fx, NULL, NULL, this, true ); idEntityFx::StartFx( fx, NULL, NULL, this, true );
} else { } else {
@ -4903,14 +4903,14 @@ idEntity* idAI::StartEmitter( const char* name, const char* joint, const char* p
axis[0] = -tmp; axis[0] = -tmp;
ent->GetPhysics()->SetAxis(axis);*/ ent->GetPhysics()->SetAxis(axis);*/
axis = physicsObj.GetGravityAxis(); axis = physicsObj.GetGravityAxis();
ent->GetPhysics()->SetAxis(axis); ent->GetPhysics()->SetAxis(axis);
ent->GetPhysics()->GetClipModel()->SetOwner( this ); ent->GetPhysics()->GetClipModel()->SetOwner( this );
//Keep a reference to the emitter so we can track it //Keep a reference to the emitter so we can track it
funcEmitter_t newEmitter; funcEmitter_t newEmitter;
strcpy(newEmitter.name, name); strcpy(newEmitter.name, name);
@ -4964,10 +4964,10 @@ bool idAI::UpdateAnimationControllers( void ) {
idVec3 focusPos; idVec3 focusPos;
idQuat jawQuat; idQuat jawQuat;
idVec3 left; idVec3 left;
idVec3 dir; idVec3 dir;
idVec3 orientationJointPos; idVec3 orientationJointPos;
idVec3 localDir; idVec3 localDir;
idAngles newLookAng; idAngles newLookAng;
idAngles diff; idAngles diff;
idMat3 mat; idMat3 mat;
idMat3 axis; idMat3 axis;
@ -5022,7 +5022,7 @@ bool idAI::UpdateAnimationControllers( void ) {
idEntity *focusEnt = focusEntity.GetEntity(); idEntity *focusEnt = focusEntity.GetEntity();
if ( !allowJointMod || !allowEyeFocus || ( gameLocal.time >= focusTime ) ) { if ( !allowJointMod || !allowEyeFocus || ( gameLocal.time >= focusTime ) ) {
focusPos = GetEyePosition() + orientationJointAxis[ 0 ] * 512.0f; focusPos = GetEyePosition() + orientationJointAxis[ 0 ] * 512.0f;
} else if ( focusEnt == NULL ) { } else if ( focusEnt == NULL ) {
// keep looking at last position until focusTime is up // keep looking at last position until focusTime is up
focusPos = currentFocusPos; focusPos = currentFocusPos;
@ -5056,7 +5056,7 @@ bool idAI::UpdateAnimationControllers( void ) {
newLookAng.roll = 0.0f; newLookAng.roll = 0.0f;
diff = newLookAng - lookAng; diff = newLookAng - lookAng;
if ( eyeAng != diff ) { if ( eyeAng != diff ) {
eyeAng = diff; eyeAng = diff;
eyeAng.Clamp( eyeMin, eyeMax ); eyeAng.Clamp( eyeMin, eyeMax );
@ -5105,7 +5105,7 @@ bool idAI::UpdateAnimationControllers( void ) {
// lean into turns // lean into turns
AdjustFlyingAngles(); AdjustFlyingAngles();
} }
if ( headEnt ) { if ( headEnt ) {
idAnimator *headAnimator = headEnt->GetAnimator(); idAnimator *headAnimator = headEnt->GetAnimator();
@ -5253,7 +5253,7 @@ void idCombatNode::DrawDebugInfo( void ) {
idPlayer *player = gameLocal.GetLocalPlayer(); idPlayer *player = gameLocal.GetLocalPlayer();
idVec4 color; idVec4 color;
idBounds bounds( idVec3( -16, -16, 0 ), idVec3( 16, 16, 0 ) ); idBounds bounds( idVec3( -16, -16, 0 ), idVec3( 16, 16, 0 ) );
for( ent = gameLocal.spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() ) { for( ent = gameLocal.spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() ) {
if ( !ent->IsType( idCombatNode::Type ) ) { if ( !ent->IsType( idCombatNode::Type ) ) {
continue; continue;
@ -5315,7 +5315,7 @@ bool idCombatNode::EntityInView( idActor *actor, const idVec3 &pos ) {
const idMat3 &axis = GetPhysics()->GetAxis(); const idMat3 &axis = GetPhysics()->GetAxis();
idVec3 dir = pos - org; idVec3 dir = pos - org;
float dist = dir * axis[ 0 ]; float dist = dir * axis[ 0 ];
if ( ( dist < min_dist ) || ( dist > max_dist ) ) { if ( ( dist < min_dist ) || ( dist > max_dist ) ) {
return false; return false;
} }

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -70,7 +70,7 @@ typedef enum {
MOVE_TO_ENEMY = NUM_NONMOVING_COMMANDS, MOVE_TO_ENEMY = NUM_NONMOVING_COMMANDS,
MOVE_TO_ENEMYHEIGHT, MOVE_TO_ENEMYHEIGHT,
MOVE_TO_ENTITY, MOVE_TO_ENTITY,
MOVE_OUT_OF_RANGE, MOVE_OUT_OF_RANGE,
MOVE_TO_ATTACK_POSITION, MOVE_TO_ATTACK_POSITION,
MOVE_TO_COVER, MOVE_TO_COVER,
@ -112,9 +112,9 @@ typedef struct obstaclePath_s {
idVec3 seekPos; // seek position avoiding obstacles idVec3 seekPos; // seek position avoiding obstacles
idEntity * firstObstacle; // if != NULL the first obstacle along the path idEntity * firstObstacle; // if != NULL the first obstacle along the path
idVec3 startPosOutsideObstacles; // start position outside obstacles idVec3 startPosOutsideObstacles; // start position outside obstacles
idEntity * startPosObstacle; // if != NULL the obstacle containing the start position idEntity * startPosObstacle; // if != NULL the obstacle containing the start position
idVec3 seekPosOutsideObstacles; // seek position outside obstacles idVec3 seekPosOutsideObstacles; // seek position outside obstacles
idEntity * seekPosObstacle; // if != NULL the obstacle containing the seek position idEntity * seekPosObstacle; // if != NULL the obstacle containing the seek position
} obstaclePath_t; } obstaclePath_t;
// path prediction // path prediction
@ -333,7 +333,7 @@ protected:
bool allowHiddenMovement; // allows character to still move around while hidden bool allowHiddenMovement; // allows character to still move around while hidden
bool disableGravity; // disables gravity and allows vertical movement by the animation bool disableGravity; // disables gravity and allows vertical movement by the animation
bool af_push_moveables; // allow the articulated figure to push moveable objects bool af_push_moveables; // allow the articulated figure to push moveable objects
// weapon/attack vars // weapon/attack vars
bool lastHitCheckResult; bool lastHitCheckResult;
int lastHitCheckTime; int lastHitCheckTime;
@ -385,7 +385,7 @@ protected:
// special fx // special fx
float shrivel_rate; float shrivel_rate;
int shrivel_start; int shrivel_start;
bool restartParticles; // should smoke emissions restart bool restartParticles; // should smoke emissions restart
bool useBoneAxis; // use the bone vs the model axis bool useBoneAxis; // use the bone vs the model axis
idList<particleEmitter_t> particles; // particle data idList<particleEmitter_t> particles; // particle data
@ -689,8 +689,8 @@ protected:
void Event_AllowHiddenMovement( int enable ); void Event_AllowHiddenMovement( int enable );
void Event_TriggerParticles( const char *jointName ); void Event_TriggerParticles( const char *jointName );
void Event_FindActorsInBounds( const idVec3 &mins, const idVec3 &maxs ); void Event_FindActorsInBounds( const idVec3 &mins, const idVec3 &maxs );
void Event_CanReachPosition( const idVec3 &pos ); void Event_CanReachPosition( const idVec3 &pos );
void Event_CanReachEntity( idEntity *ent ); void Event_CanReachEntity( idEntity *ent );
void Event_CanReachEnemy( void ); void Event_CanReachEnemy( void );
void Event_GetReachableEntityPosition( idEntity *ent ); void Event_GetReachableEntityPosition( idEntity *ent );
#ifdef _D3XP #ifdef _D3XP

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -108,10 +108,10 @@ void idAI_Vagary::Event_ChooseObjectToThrow( const idVec3 &mins, const idVec3 &m
continue; continue;
} }
if ( PredictTrajectory( entPhys->GetOrigin() + offsetVec, enemyEyePos, speed, entPhys->GetGravity(), if ( PredictTrajectory( entPhys->GetOrigin() + offsetVec, enemyEyePos, speed, entPhys->GetGravity(),
entPhys->GetClipModel(), entPhys->GetClipMask(), MAX_WORLD_SIZE, NULL, enemyEnt, ai_debugTrajectory.GetBool() ? 4000 : 0, vel ) ) { entPhys->GetClipModel(), entPhys->GetClipMask(), MAX_WORLD_SIZE, NULL, enemyEnt, ai_debugTrajectory.GetBool() ? 4000 : 0, vel ) ) {
idThread::ReturnEntity( ent ); idThread::ReturnEntity( ent );
return; return;
} }
} }
@ -133,7 +133,7 @@ void idAI_Vagary::Event_ThrowObjectAtEnemy( idEntity *ent, float speed ) {
if ( !enemyEnt ) { if ( !enemyEnt ) {
vel = ( viewAxis[ 0 ] * physicsObj.GetGravityAxis() ) * speed; vel = ( viewAxis[ 0 ] * physicsObj.GetGravityAxis() ) * speed;
} else { } else {
PredictTrajectory( entPhys->GetOrigin(), lastVisibleEnemyPos + lastVisibleEnemyEyeOffset, speed, entPhys->GetGravity(), PredictTrajectory( entPhys->GetOrigin(), lastVisibleEnemyPos + lastVisibleEnemyEyeOffset, speed, entPhys->GetGravity(),
entPhys->GetClipModel(), entPhys->GetClipMask(), MAX_WORLD_SIZE, NULL, enemyEnt, ai_debugTrajectory.GetBool() ? 4000 : 0, vel ); entPhys->GetClipModel(), entPhys->GetClipMask(), MAX_WORLD_SIZE, NULL, enemyEnt, ai_debugTrajectory.GetBool() ? 4000 : 0, vel );
vel *= speed; vel *= speed;
} }

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -166,10 +166,10 @@ const idEventDef AI_GetReachableEntityPosition( "getReachableEntityPosition", "e
#ifdef _D3XP #ifdef _D3XP
const idEventDef AI_MoveToPositionDirect( "moveToPositionDirect", "v" ); const idEventDef AI_MoveToPositionDirect( "moveToPositionDirect", "v" );
const idEventDef AI_AvoidObstacles( "avoidObstacles", "d" ); const idEventDef AI_AvoidObstacles( "avoidObstacles", "d" );
const idEventDef AI_TriggerFX( "triggerFX", "ss" ); const idEventDef AI_TriggerFX( "triggerFX", "ss" );
const idEventDef AI_StartEmitter( "startEmitter", "sss", 'e' ); const idEventDef AI_StartEmitter( "startEmitter", "sss", 'e' );
const idEventDef AI_GetEmitter( "getEmitter", "s", 'e' ); const idEventDef AI_GetEmitter( "getEmitter", "s", 'e' );
const idEventDef AI_StopEmitter( "stopEmitter", "s" ); const idEventDef AI_StopEmitter( "stopEmitter", "s" );
#endif #endif
@ -265,7 +265,7 @@ CLASS_DECLARATION( idActor, idAI )
EVENT( AI_SetMoveType, idAI::Event_SetMoveType ) EVENT( AI_SetMoveType, idAI::Event_SetMoveType )
EVENT( AI_SaveMove, idAI::Event_SaveMove ) EVENT( AI_SaveMove, idAI::Event_SaveMove )
EVENT( AI_RestoreMove, idAI::Event_RestoreMove ) EVENT( AI_RestoreMove, idAI::Event_RestoreMove )
EVENT( AI_AllowMovement, idAI::Event_AllowMovement ) EVENT( AI_AllowMovement, idAI::Event_AllowMovement )
EVENT( AI_JumpFrame, idAI::Event_JumpFrame ) EVENT( AI_JumpFrame, idAI::Event_JumpFrame )
EVENT( AI_EnableClip, idAI::Event_EnableClip ) EVENT( AI_EnableClip, idAI::Event_EnableClip )
EVENT( AI_DisableClip, idAI::Event_DisableClip ) EVENT( AI_DisableClip, idAI::Event_DisableClip )
@ -308,7 +308,7 @@ CLASS_DECLARATION( idActor, idAI )
EVENT( AI_GetReachableEntityPosition, idAI::Event_GetReachableEntityPosition ) EVENT( AI_GetReachableEntityPosition, idAI::Event_GetReachableEntityPosition )
#ifdef _D3XP #ifdef _D3XP
EVENT( AI_MoveToPositionDirect, idAI::Event_MoveToPositionDirect ) EVENT( AI_MoveToPositionDirect, idAI::Event_MoveToPositionDirect )
EVENT( AI_AvoidObstacles, idAI::Event_AvoidObstacles ) EVENT( AI_AvoidObstacles, idAI::Event_AvoidObstacles )
EVENT( AI_TriggerFX, idAI::Event_TriggerFX ) EVENT( AI_TriggerFX, idAI::Event_TriggerFX )
EVENT( AI_StartEmitter, idAI::Event_StartEmitter ) EVENT( AI_StartEmitter, idAI::Event_StartEmitter )
EVENT( AI_GetEmitter, idAI::Event_GetEmitter ) EVENT( AI_GetEmitter, idAI::Event_GetEmitter )
@ -476,7 +476,7 @@ void idAI::Event_ClosestReachableEnemyOfEntity( idEntity *team_mate ) {
int areaNum; int areaNum;
int enemyAreaNum; int enemyAreaNum;
aasPath_t path; aasPath_t path;
if ( !team_mate->IsType( idActor::Type ) ) { if ( !team_mate->IsType( idActor::Type ) ) {
gameLocal.Error( "Entity '%s' is not an AI character or player", team_mate->GetName() ); gameLocal.Error( "Entity '%s' is not an AI character or player", team_mate->GetName() );
} }
@ -741,7 +741,7 @@ idAI::Event_AttackMelee
*/ */
void idAI::Event_AttackMelee( const char *meleeDefName ) { void idAI::Event_AttackMelee( const char *meleeDefName ) {
bool hit; bool hit;
hit = AttackMelee( meleeDefName ); hit = AttackMelee( meleeDefName );
idThread::ReturnInt( hit ); idThread::ReturnInt( hit );
} }
@ -828,7 +828,7 @@ void idAI::Event_MeleeAttackToJoint( const char *jointname, const char *meleeDef
animator.GetJointTransform( joint, gameLocal.time, end, axis ); animator.GetJointTransform( joint, gameLocal.time, end, axis );
end = physicsObj.GetOrigin() + ( end + modelOffset ) * viewAxis * physicsObj.GetGravityAxis(); end = physicsObj.GetOrigin() + ( end + modelOffset ) * viewAxis * physicsObj.GetGravityAxis();
start = GetEyePosition(); start = GetEyePosition();
if ( ai_debugMove.GetBool() ) { if ( ai_debugMove.GetBool() ) {
gameRenderWorld->DebugLine( colorYellow, start, end, gameLocal.msec ); gameRenderWorld->DebugLine( colorYellow, start, end, gameLocal.msec );
} }
@ -1316,7 +1316,7 @@ void idAI::Event_EnemyInCombatCone( idEntity *ent, int use_current_enemy_locatio
} }
#ifdef _D3XP #ifdef _D3XP
//Allow the level designers define attack nodes that the enemy should never leave. //Allow the level designers define attack nodes that the enemy should never leave.
//This is different that the turrent type combat nodes because they can play an animation //This is different that the turrent type combat nodes because they can play an animation
if(ent->spawnArgs.GetBool("neverLeave", "0")) { if(ent->spawnArgs.GetBool("neverLeave", "0")) {
idThread::ReturnInt( true ); idThread::ReturnInt( true );
@ -1397,7 +1397,7 @@ void idAI::Event_EntityInAttackCone( idEntity *ent ) {
idVec3 delta; idVec3 delta;
float yaw; float yaw;
float relYaw; float relYaw;
if ( !ent ) { if ( !ent ) {
idThread::ReturnInt( false ); idThread::ReturnInt( false );
return; return;
@ -1598,7 +1598,7 @@ void idAI::Event_CanHitEnemy( void ) {
hit = gameLocal.GetTraceEntity( tr ); hit = gameLocal.GetTraceEntity( tr );
if ( tr.fraction >= 1.0f || ( hit == enemyEnt ) ) { if ( tr.fraction >= 1.0f || ( hit == enemyEnt ) ) {
lastHitCheckResult = true; lastHitCheckResult = true;
} else if ( ( tr.fraction < 1.0f ) && ( hit->IsType( idAI::Type ) ) && } else if ( ( tr.fraction < 1.0f ) && ( hit->IsType( idAI::Type ) ) &&
( static_cast<idAI *>( hit )->team != team ) ) { ( static_cast<idAI *>( hit )->team != team ) ) {
lastHitCheckResult = true; lastHitCheckResult = true;
} else { } else {
@ -1838,7 +1838,7 @@ void idAI::Event_TestAnimMoveTowardEnemy( const char *animname ) {
float yaw; float yaw;
idVec3 delta; idVec3 delta;
idActor *enemyEnt; idActor *enemyEnt;
enemyEnt = enemy.GetEntity(); enemyEnt = enemy.GetEntity();
if ( !enemyEnt ) { if ( !enemyEnt ) {
idThread::ReturnInt( false ); idThread::ReturnInt( false );
@ -1853,7 +1853,7 @@ void idAI::Event_TestAnimMoveTowardEnemy( const char *animname ) {
} }
delta = enemyEnt->GetPhysics()->GetOrigin() - physicsObj.GetOrigin(); delta = enemyEnt->GetPhysics()->GetOrigin() - physicsObj.GetOrigin();
yaw = delta.ToYaw(); yaw = delta.ToYaw();
moveVec = animator.TotalMovementDelta( anim ) * idAngles( 0.0f, yaw, 0.0f ).ToMat3() * physicsObj.GetGravityAxis(); moveVec = animator.TotalMovementDelta( anim ) * idAngles( 0.0f, yaw, 0.0f ).ToMat3() * physicsObj.GetGravityAxis();
idAI::PredictPath( this, aas, physicsObj.GetOrigin(), moveVec, 1000, 1000, ( move.moveType == MOVETYPE_FLY ) ? SE_BLOCKED : ( SE_ENTER_OBSTACLE | SE_BLOCKED | SE_ENTER_LEDGE_AREA ), path ); idAI::PredictPath( this, aas, physicsObj.GetOrigin(), moveVec, 1000, 1000, ( move.moveType == MOVETYPE_FLY ) ? SE_BLOCKED : ( SE_ENTER_OBSTACLE | SE_BLOCKED | SE_ENTER_LEDGE_AREA ), path );
@ -2578,7 +2578,7 @@ idAI::Event_LocateEnemy
void idAI::Event_LocateEnemy( void ) { void idAI::Event_LocateEnemy( void ) {
idActor *enemyEnt; idActor *enemyEnt;
int areaNum; int areaNum;
enemyEnt = enemy.GetEntity(); enemyEnt = enemy.GetEntity();
if ( !enemyEnt ) { if ( !enemyEnt ) {
return; return;
@ -2597,7 +2597,7 @@ idAI::Event_KickObstacles
void idAI::Event_KickObstacles( idEntity *kickEnt, float force ) { void idAI::Event_KickObstacles( idEntity *kickEnt, float force ) {
idVec3 dir; idVec3 dir;
idEntity *obEnt; idEntity *obEnt;
if ( kickEnt ) { if ( kickEnt ) {
obEnt = kickEnt; obEnt = kickEnt;
} else { } else {
@ -2903,4 +2903,3 @@ void idAI::Event_StopEmitter( const char* name ) {
} }
#endif #endif

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -52,10 +52,10 @@ If you have questions concerning this license or the applicable additional terms
const float MAX_OBSTACLE_RADIUS = 256.0f; const float MAX_OBSTACLE_RADIUS = 256.0f;
const float PUSH_OUTSIDE_OBSTACLES = 0.5f; const float PUSH_OUTSIDE_OBSTACLES = 0.5f;
const float CLIP_BOUNDS_EPSILON = 10.0f; const float CLIP_BOUNDS_EPSILON = 10.0f;
const int MAX_AAS_WALL_EDGES = 256; const int MAX_AAS_WALL_EDGES = 256;
const int MAX_OBSTACLES = 256; const int MAX_OBSTACLES = 256;
const int MAX_PATH_NODES = 256; const int MAX_PATH_NODES = 256;
const int MAX_OBSTACLE_PATH = 64; const int MAX_OBSTACLE_PATH = 64;
typedef struct obstacle_s { typedef struct obstacle_s {
idVec2 bounds[2]; idVec2 bounds[2];
@ -260,7 +260,7 @@ void GetPointOutsideObstacles( const obstacle_t *obstacles, const int numObstacl
return; return;
} }
} }
gameLocal.Warning( "GetPointOutsideObstacles: no valid point found" ); gameLocal.Warning( "GetPointOutsideObstacles: no valid point found" );
} }
/* /*
@ -425,7 +425,7 @@ int GetObstacles( const idPhysics *physics, const idAAS *aas, const idEntity *ig
lastEdgeNormal.Zero(); lastEdgeNormal.Zero();
nextVerts[0] = nextVerts[1] = 0; nextVerts[0] = nextVerts[1] = 0;
for ( i = 0; i < numWallEdges && numObstacles < MAX_OBSTACLES; i++ ) { for ( i = 0; i < numWallEdges && numObstacles < MAX_OBSTACLES; i++ ) {
aas->GetEdge( wallEdges[i], start, end ); aas->GetEdge( wallEdges[i], start, end );
aas->GetEdgeVertexNumbers( wallEdges[i], verts ); aas->GetEdgeVertexNumbers( wallEdges[i], verts );
edgeDir = end.ToVec2() - start.ToVec2(); edgeDir = end.ToVec2() - start.ToVec2();
edgeDir.Normalize(); edgeDir.Normalize();
@ -1338,7 +1338,7 @@ static float HeightForTrajectory( const idVec3 &start, float zVel, float gravity
t = zVel / gravity; t = zVel / gravity;
// maximum height of projectile // maximum height of projectile
maxHeight = start.z - 0.5f * gravity * ( t * t ); maxHeight = start.z - 0.5f * gravity * ( t * t );
return maxHeight; return maxHeight;
} }

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -216,7 +216,7 @@ bool idMD5Anim::LoadAnim( const char *filename ) {
for( i = 0; i < numJoints; i++ ) { for( i = 0; i < numJoints; i++ ) {
parser.ReadToken( &token ); parser.ReadToken( &token );
jointInfo[ i ].nameIndex = animationLib.JointIndex( token ); jointInfo[ i ].nameIndex = animationLib.JointIndex( token );
// parse parent num // parse parent num
jointInfo[ i ].parentNum = parser.ParseInt(); jointInfo[ i ].parentNum = parser.ParseInt();
if ( jointInfo[ i ].parentNum >= i ) { if ( jointInfo[ i ].parentNum >= i ) {
@ -278,7 +278,7 @@ bool idMD5Anim::LoadAnim( const char *filename ) {
parser.Error( "Expected frame number %d", i ); parser.Error( "Expected frame number %d", i );
} }
parser.ExpectTokenString( "{" ); parser.ExpectTokenString( "{" );
for( j = 0; j < numAnimatedComponents; j++, componentPtr++ ) { for( j = 0; j < numAnimatedComponents; j++, componentPtr++ ) {
*componentPtr = parser.ParseFloat(); *componentPtr = parser.ParseFloat();
} }
@ -402,7 +402,7 @@ void idMD5Anim::ConvertTimeToFrame( int time, int cyclecount, frameBlend_t &fram
frame.cycleCount = 0; frame.cycleCount = 0;
return; return;
} }
frameTime = time * frameRate; frameTime = time * frameRate;
frameNum = frameTime / 1000; frameNum = frameTime / 1000;
frame.cycleCount = frameNum / ( numFrames - 1 ); frame.cycleCount = frameNum / ( numFrames - 1 );
@ -415,7 +415,7 @@ void idMD5Anim::ConvertTimeToFrame( int time, int cyclecount, frameBlend_t &fram
frame.frontlerp = 1.0f; frame.frontlerp = 1.0f;
return; return;
} }
frame.frame1 = frameNum % ( numFrames - 1 ); frame.frame1 = frameNum % ( numFrames - 1 );
frame.frame2 = frame.frame1 + 1; frame.frame2 = frame.frame1 + 1;
if ( frame.frame2 >= numFrames ) { if ( frame.frame2 >= numFrames ) {
@ -436,7 +436,7 @@ void idMD5Anim::GetOrigin( idVec3 &offset, int time, int cyclecount ) const {
offset = baseFrame[ 0 ].t; offset = baseFrame[ 0 ].t;
if ( !( jointInfo[ 0 ].animBits & ( ANIM_TX | ANIM_TY | ANIM_TZ ) ) ) { if ( !( jointInfo[ 0 ].animBits & ( ANIM_TX | ANIM_TY | ANIM_TZ ) ) ) {
// just use the baseframe // just use the baseframe
return; return;
} }
@ -474,10 +474,10 @@ idMD5Anim::GetOriginRotation
void idMD5Anim::GetOriginRotation( idQuat &rotation, int time, int cyclecount ) const { void idMD5Anim::GetOriginRotation( idQuat &rotation, int time, int cyclecount ) const {
frameBlend_t frame; frameBlend_t frame;
int animBits; int animBits;
animBits = jointInfo[ 0 ].animBits; animBits = jointInfo[ 0 ].animBits;
if ( !( animBits & ( ANIM_QX | ANIM_QY | ANIM_QZ ) ) ) { if ( !( animBits & ( ANIM_QX | ANIM_QY | ANIM_QZ ) ) ) {
// just use the baseframe // just use the baseframe
rotation = baseFrame[ 0 ].q; rotation = baseFrame[ 0 ].q;
return; return;
} }
@ -1070,7 +1070,7 @@ void idAnimManager::FlushUnusedAnims( void ) {
int i; int i;
idMD5Anim **animptr; idMD5Anim **animptr;
idList<idMD5Anim *> removeAnims; idList<idMD5Anim *> removeAnims;
for( i = 0; i < animations.Num(); i++ ) { for( i = 0; i < animations.Num(); i++ ) {
animptr = animations.GetIndex( i ); animptr = animations.GetIndex( i );
if ( animptr && *animptr ) { if ( animptr && *animptr ) {

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -147,7 +147,7 @@ typedef enum {
FC_RECORDDEMO, FC_RECORDDEMO,
FC_AVIGAME FC_AVIGAME
#ifdef _D3XP #ifdef _D3XP
, FC_LAUNCH_PROJECTILE, , FC_LAUNCH_PROJECTILE,
FC_TRIGGER_FX, FC_TRIGGER_FX,
FC_START_EMITTER, FC_START_EMITTER,
FC_STOP_EMITTER, FC_STOP_EMITTER,
@ -251,7 +251,7 @@ public:
void IncreaseRefs( void ) const; void IncreaseRefs( void ) const;
void DecreaseRefs( void ) const; void DecreaseRefs( void ) const;
int NumRefs( void ) const; int NumRefs( void ) const;
void CheckModelHierarchy( const idRenderModel *model ) const; void CheckModelHierarchy( const idRenderModel *model ) const;
void GetInterpolatedFrame( frameBlend_t &frame, idJointQuat *joints, const int *index, int numIndexes ) const; void GetInterpolatedFrame( frameBlend_t &frame, idJointQuat *joints, const int *index, int numIndexes ) const;
void GetSingleFrame( int framenum, idJointQuat *joints, const int *index, int numIndexes ) const; void GetSingleFrame( int framenum, idJointQuat *joints, const int *index, int numIndexes ) const;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -163,7 +163,7 @@ index 0 will never be NULL. Any anim >= NumAnims will return NULL.
===================== =====================
*/ */
const idMD5Anim *idAnim::MD5Anim( int num ) const { const idMD5Anim *idAnim::MD5Anim( int num ) const {
if ( anims == NULL || anims[0] == NULL ) { if ( anims == NULL || anims[0] == NULL ) {
return NULL; return NULL;
} }
return anims[ num ]; return anims[ num ];
@ -196,11 +196,11 @@ int idAnim::Length( void ) const {
idAnim::NumFrames idAnim::NumFrames
===================== =====================
*/ */
int idAnim::NumFrames( void ) const { int idAnim::NumFrames( void ) const {
if ( !anims[ 0 ] ) { if ( !anims[ 0 ] ) {
return 0; return 0;
} }
return anims[ 0 ]->NumFrames(); return anims[ 0 ]->NumFrames();
} }
@ -209,7 +209,7 @@ int idAnim::NumFrames( void ) const {
idAnim::NumAnims idAnim::NumAnims
===================== =====================
*/ */
int idAnim::NumAnims( void ) const { int idAnim::NumAnims( void ) const {
return numAnims; return numAnims;
} }
@ -222,7 +222,7 @@ const idVec3 &idAnim::TotalMovementDelta( void ) const {
if ( !anims[ 0 ] ) { if ( !anims[ 0 ] ) {
return vec3_zero; return vec3_zero;
} }
return anims[ 0 ]->TotalMovementDelta(); return anims[ 0 ]->TotalMovementDelta();
} }
@ -576,7 +576,7 @@ const char *idAnim::AddFrameCommand( const idDeclModelDef *modelDef, int framenu
fc.type = FC_LAUNCH_PROJECTILE; fc.type = FC_LAUNCH_PROJECTILE;
fc.string = new idStr( token ); fc.string = new idStr( token );
} else if ( token == "trigger_fx" ) { } else if ( token == "trigger_fx" ) {
if( !src.ReadTokenOnLine( &token ) ) { if( !src.ReadTokenOnLine( &token ) ) {
return "Unexpected end of line"; return "Unexpected end of line";
} }
@ -703,7 +703,7 @@ const char *idAnim::AddFrameCommand( const idDeclModelDef *modelDef, int framenu
frameLookup[ i ].firstCommand++; frameLookup[ i ].firstCommand++;
} }
// store the new command // store the new command
frameCommands[ index ] = fc; frameCommands[ index ] = fc;
// increase the number of commands on this frame // increase the number of commands on this frame
@ -1192,7 +1192,7 @@ void idAnimBlend::Reset( const idDeclModelDef *_modelDef ) {
blendStartValue = 0.0f; blendStartValue = 0.0f;
blendEndValue = 0.0f; blendEndValue = 0.0f;
blendStartTime = 0; blendStartTime = 0;
blendDuration = 0; blendDuration = 0;
} }
@ -1292,7 +1292,7 @@ idAnimBlend::SetWeight
void idAnimBlend::SetWeight( float newweight, int currentTime, int blendTime ) { void idAnimBlend::SetWeight( float newweight, int currentTime, int blendTime ) {
blendStartValue = GetWeight( currentTime ); blendStartValue = GetWeight( currentTime );
blendEndValue = newweight; blendEndValue = newweight;
blendStartTime = currentTime - 1; blendStartTime = currentTime - 1;
blendDuration = blendTime; blendDuration = blendTime;
if ( !newweight ) { if ( !newweight ) {
@ -1343,7 +1343,7 @@ void idAnimBlend::SetFrame( const idDeclModelDef *modelDef, int _animNum, int _f
if ( !modelDef ) { if ( !modelDef ) {
return; return;
} }
const idAnim *_anim = modelDef->GetAnim( _animNum ); const idAnim *_anim = modelDef->GetAnim( _animNum );
if ( !_anim ) { if ( !_anim ) {
return; return;
@ -1354,7 +1354,7 @@ void idAnimBlend::SetFrame( const idDeclModelDef *modelDef, int _animNum, int _f
gameLocal.Warning( "Model '%s' has different # of joints than anim '%s'", modelDef->GetModelName(), md5anim->Name() ); gameLocal.Warning( "Model '%s' has different # of joints than anim '%s'", modelDef->GetModelName(), md5anim->Name() );
return; return;
} }
animNum = _animNum; animNum = _animNum;
starttime = currentTime; starttime = currentTime;
endtime = -1; endtime = -1;
@ -1386,7 +1386,7 @@ void idAnimBlend::CycleAnim( const idDeclModelDef *modelDef, int _animNum, int c
if ( !modelDef ) { if ( !modelDef ) {
return; return;
} }
const idAnim *_anim = modelDef->GetAnim( _animNum ); const idAnim *_anim = modelDef->GetAnim( _animNum );
if ( !_anim ) { if ( !_anim ) {
return; return;
@ -1426,7 +1426,7 @@ void idAnimBlend::PlayAnim( const idDeclModelDef *modelDef, int _animNum, int cu
if ( !modelDef ) { if ( !modelDef ) {
return; return;
} }
const idAnim *_anim = modelDef->GetAnim( _animNum ); const idAnim *_anim = modelDef->GetAnim( _animNum );
if ( !_anim ) { if ( !_anim ) {
return; return;
@ -1918,7 +1918,7 @@ bool idAnimBlend::BlendAnim( int currentTime, int channel, int numJoints, idJoin
blendFrame[j].q = jointFrame[j].q; blendFrame[j].q = jointFrame[j].q;
} }
} }
} else { } else {
blendWeight += weight; blendWeight += weight;
lerp = weight / blendWeight; lerp = weight / blendWeight;
SIMDProcessor->BlendJoints( blendFrame, jointFrame, lerp, modelDef->GetChannelJoints( channel ), modelDef->NumJointsOnChannel( channel ) ); SIMDProcessor->BlendJoints( blendFrame, jointFrame, lerp, modelDef->GetChannelJoints( channel ), modelDef->NumJointsOnChannel( channel ) );
@ -2000,7 +2000,7 @@ void idAnimBlend::BlendDelta( int fromtime, int totime, idVec3 &blendDelta, floa
float lerp; float lerp;
int num; int num;
int i; int i;
if ( frame || !allowMove || ( ( endtime > 0 ) && ( fromtime > endtime ) ) ) { if ( frame || !allowMove || ( ( endtime > 0 ) && ( fromtime > endtime ) ) ) {
return; return;
} }
@ -2059,7 +2059,7 @@ void idAnimBlend::BlendDeltaRotation( int fromtime, int totime, idQuat &blendDel
float mixWeight; float mixWeight;
int num; int num;
int i; int i;
if ( frame || !allowMove || ( ( endtime > 0 ) && ( fromtime > endtime ) ) ) { if ( frame || !allowMove || ( ( endtime > 0 ) && ( fromtime > endtime ) ) ) {
return; return;
} }
@ -2142,7 +2142,7 @@ bool idAnimBlend::AddBounds( int currentTime, idBounds &bounds, bool removeOrigi
time = AnimTime( currentTime ); time = AnimTime( currentTime );
num = anim->NumAnims(); num = anim->NumAnims();
addorigin = !allowMove || !removeOriginOffset; addorigin = !allowMove || !removeOriginOffset;
for( i = 0; i < num; i++ ) { for( i = 0; i < num; i++ ) {
if ( anim->GetBounds( b, i, time, cycle ) ) { if ( anim->GetBounds( b, i, time, cycle ) ) {
@ -2261,7 +2261,7 @@ const jointInfo_t *idDeclModelDef::FindJoint( const char *name ) const {
if ( !modelHandle ) { if ( !modelHandle ) {
return NULL; return NULL;
} }
joint = modelHandle->GetJoints(); joint = modelHandle->GetJoints();
for( i = 0; i < joints.Num(); i++, joint++ ) { for( i = 0; i < joints.Num(); i++, joint++ ) {
if ( !joint->name.Icmp( name ) ) { if ( !joint->name.Icmp( name ) ) {
@ -2667,7 +2667,7 @@ bool idDeclModelDef::Parse( const char *text, const int textLength ) {
MakeDefault(); MakeDefault();
return false; return false;
} }
const idDeclModelDef *copy = static_cast<const idDeclModelDef *>( declManager->FindType( DECL_MODELDEF, token2, false ) ); const idDeclModelDef *copy = static_cast<const idDeclModelDef *>( declManager->FindType( DECL_MODELDEF, token2, false ) );
if ( !copy ) { if ( !copy ) {
common->Warning( "Unknown model definition '%s'", token2.c_str() ); common->Warning( "Unknown model definition '%s'", token2.c_str() );
@ -2872,7 +2872,7 @@ bool idDeclModelDef::HasAnim( const char *name ) const {
return true; return true;
} }
} }
return false; return false;
} }
@ -2915,7 +2915,7 @@ const idAnim *idDeclModelDef::GetAnim( int index ) const {
if ( ( index < 1 ) || ( index > anims.Num() ) ) { if ( ( index < 1 ) || ( index > anims.Num() ) ) {
return NULL; return NULL;
} }
return anims[ index - 1 ]; return anims[ index - 1 ];
} }
@ -3031,7 +3031,7 @@ const char *idDeclModelDef::GetJointName( int jointHandle ) const {
if ( !modelHandle ) { if ( !modelHandle ) {
return NULL; return NULL;
} }
if ( ( jointHandle < 0 ) || ( jointHandle > joints.Num() ) ) { if ( ( jointHandle < 0 ) || ( jointHandle > joints.Num() ) ) {
gameLocal.Error( "idDeclModelDef::GetJointName : joint handle out of range" ); gameLocal.Error( "idDeclModelDef::GetJointName : joint handle out of range" );
} }
@ -3155,7 +3155,7 @@ void idAnimator::Save( idSaveGame *savefile ) const {
savefile->WriteInt( (int&)jointMods[ i ]->transform_pos ); savefile->WriteInt( (int&)jointMods[ i ]->transform_pos );
savefile->WriteInt( (int&)jointMods[ i ]->transform_axis ); savefile->WriteInt( (int&)jointMods[ i ]->transform_axis );
} }
savefile->WriteInt( numJoints ); savefile->WriteInt( numJoints );
for ( i = 0; i < numJoints; i++ ) { for ( i = 0; i < numJoints; i++ ) {
float *data = joints[i].ToFloatPtr(); float *data = joints[i].ToFloatPtr();
@ -3175,14 +3175,14 @@ void idAnimator::Save( idSaveGame *savefile ) const {
for ( i = 0; i < AFPoseJoints.Num(); i++ ) { for ( i = 0; i < AFPoseJoints.Num(); i++ ) {
savefile->WriteInt( AFPoseJoints[i] ); savefile->WriteInt( AFPoseJoints[i] );
} }
savefile->WriteInt( AFPoseJointMods.Num() ); savefile->WriteInt( AFPoseJointMods.Num() );
for ( i = 0; i < AFPoseJointMods.Num(); i++ ) { for ( i = 0; i < AFPoseJointMods.Num(); i++ ) {
savefile->WriteInt( (int&)AFPoseJointMods[i].mod ); savefile->WriteInt( (int&)AFPoseJointMods[i].mod );
savefile->WriteMat3( AFPoseJointMods[i].axis ); savefile->WriteMat3( AFPoseJointMods[i].axis );
savefile->WriteVec3( AFPoseJointMods[i].origin ); savefile->WriteVec3( AFPoseJointMods[i].origin );
} }
savefile->WriteInt( AFPoseJointFrame.Num() ); savefile->WriteInt( AFPoseJointFrame.Num() );
for ( i = 0; i < AFPoseJointFrame.Num(); i++ ) { for ( i = 0; i < AFPoseJointFrame.Num(); i++ ) {
savefile->WriteFloat( AFPoseJointFrame[i].q.x ); savefile->WriteFloat( AFPoseJointFrame[i].q.x );
@ -3191,7 +3191,7 @@ void idAnimator::Save( idSaveGame *savefile ) const {
savefile->WriteFloat( AFPoseJointFrame[i].q.w ); savefile->WriteFloat( AFPoseJointFrame[i].q.w );
savefile->WriteVec3( AFPoseJointFrame[i].t ); savefile->WriteVec3( AFPoseJointFrame[i].t );
} }
savefile->WriteBounds( AFPoseBounds ); savefile->WriteBounds( AFPoseBounds );
savefile->WriteInt( AFPoseTime ); savefile->WriteInt( AFPoseTime );
@ -3229,7 +3229,7 @@ void idAnimator::Restore( idRestoreGame *savefile ) {
savefile->ReadInt( (int&)jointMods[ i ]->transform_pos ); savefile->ReadInt( (int&)jointMods[ i ]->transform_pos );
savefile->ReadInt( (int&)jointMods[ i ]->transform_axis ); savefile->ReadInt( (int&)jointMods[ i ]->transform_axis );
} }
savefile->ReadInt( numJoints ); savefile->ReadInt( numJoints );
joints = (idJointMat *) Mem_Alloc16( numJoints * sizeof( joints[0] ) ); joints = (idJointMat *) Mem_Alloc16( numJoints * sizeof( joints[0] ) );
for ( i = 0; i < numJoints; i++ ) { for ( i = 0; i < numJoints; i++ ) {
@ -3238,7 +3238,7 @@ void idAnimator::Restore( idRestoreGame *savefile ) {
savefile->ReadFloat( data[j] ); savefile->ReadFloat( data[j] );
} }
} }
savefile->ReadInt( lastTransformTime ); savefile->ReadInt( lastTransformTime );
savefile->ReadBool( stoppedAnimatingUpdate ); savefile->ReadBool( stoppedAnimatingUpdate );
savefile->ReadBool( forceUpdate ); savefile->ReadBool( forceUpdate );
@ -3252,7 +3252,7 @@ void idAnimator::Restore( idRestoreGame *savefile ) {
for ( i = 0; i < AFPoseJoints.Num(); i++ ) { for ( i = 0; i < AFPoseJoints.Num(); i++ ) {
savefile->ReadInt( AFPoseJoints[i] ); savefile->ReadInt( AFPoseJoints[i] );
} }
savefile->ReadInt( num ); savefile->ReadInt( num );
AFPoseJointMods.SetGranularity( 1 ); AFPoseJointMods.SetGranularity( 1 );
AFPoseJointMods.SetNum( num ); AFPoseJointMods.SetNum( num );
@ -3261,7 +3261,7 @@ void idAnimator::Restore( idRestoreGame *savefile ) {
savefile->ReadMat3( AFPoseJointMods[i].axis ); savefile->ReadMat3( AFPoseJointMods[i].axis );
savefile->ReadVec3( AFPoseJointMods[i].origin ); savefile->ReadVec3( AFPoseJointMods[i].origin );
} }
savefile->ReadInt( num ); savefile->ReadInt( num );
AFPoseJointFrame.SetGranularity( 1 ); AFPoseJointFrame.SetGranularity( 1 );
AFPoseJointFrame.SetNum( num ); AFPoseJointFrame.SetNum( num );
@ -3272,7 +3272,7 @@ void idAnimator::Restore( idRestoreGame *savefile ) {
savefile->ReadFloat( AFPoseJointFrame[i].q.w ); savefile->ReadFloat( AFPoseJointFrame[i].q.w );
savefile->ReadVec3( AFPoseJointFrame[i].t ); savefile->ReadVec3( AFPoseJointFrame[i].t );
} }
savefile->ReadBounds( AFPoseBounds ); savefile->ReadBounds( AFPoseBounds );
savefile->ReadInt( AFPoseTime ); savefile->ReadInt( AFPoseTime );
@ -3356,7 +3356,7 @@ idRenderModel *idAnimator::SetModel( const char *modelname ) {
if ( !modelDef ) { if ( !modelDef ) {
return NULL; return NULL;
} }
idRenderModel *renderModel = modelDef->ModelHandle(); idRenderModel *renderModel = modelDef->ModelHandle();
if ( !renderModel ) { if ( !renderModel ) {
modelDef = NULL; modelDef = NULL;
@ -3444,7 +3444,7 @@ int idAnimator::NumAnims( void ) const {
if ( !modelDef ) { if ( !modelDef ) {
return 0; return 0;
} }
return modelDef->NumAnims(); return modelDef->NumAnims();
} }
@ -3457,7 +3457,7 @@ const idAnim *idAnimator::GetAnim( int index ) const {
if ( !modelDef ) { if ( !modelDef ) {
return NULL; return NULL;
} }
return modelDef->GetAnim( index ); return modelDef->GetAnim( index );
} }
@ -3470,7 +3470,7 @@ int idAnimator::GetAnim( const char *name ) const {
if ( !modelDef ) { if ( !modelDef ) {
return 0; return 0;
} }
return modelDef->GetAnim( name ); return modelDef->GetAnim( name );
} }
@ -3483,7 +3483,7 @@ bool idAnimator::HasAnim( const char *name ) const {
if ( !modelDef ) { if ( !modelDef ) {
return false; return false;
} }
return modelDef->HasAnim( name ); return modelDef->HasAnim( name );
} }
@ -3505,7 +3505,7 @@ idRenderModel *idAnimator::ModelHandle( void ) const {
if ( !modelDef ) { if ( !modelDef ) {
return NULL; return NULL;
} }
return modelDef->ModelHandle(); return modelDef->ModelHandle();
} }
@ -3585,7 +3585,7 @@ void idAnimator::CycleAnim( int channelNum, int animNum, int currentTime, int bl
if ( !modelDef || !modelDef->GetAnim( animNum ) ) { if ( !modelDef || !modelDef->GetAnim( animNum ) ) {
return; return;
} }
PushAnims( channelNum, currentTime, blendTime ); PushAnims( channelNum, currentTime, blendTime );
channels[ channelNum ][ 0 ].CycleAnim( modelDef, animNum, currentTime, blendTime ); channels[ channelNum ][ 0 ].CycleAnim( modelDef, animNum, currentTime, blendTime );
if ( entity ) { if ( entity ) {
@ -3606,7 +3606,7 @@ void idAnimator::PlayAnim( int channelNum, int animNum, int currentTime, int ble
if ( !modelDef || !modelDef->GetAnim( animNum ) ) { if ( !modelDef || !modelDef->GetAnim( animNum ) ) {
return; return;
} }
PushAnims( channelNum, currentTime, blendTime ); PushAnims( channelNum, currentTime, blendTime );
channels[ channelNum ][ 0 ].PlayAnim( modelDef, animNum, currentTime, blendTime ); channels[ channelNum ][ 0 ].PlayAnim( modelDef, animNum, currentTime, blendTime );
if ( entity ) { if ( entity ) {
@ -3634,7 +3634,7 @@ void idAnimator::SyncAnimChannels( int channelNum, int fromChannelNum, int curre
toBlend.blendStartValue = 0.0f; toBlend.blendStartValue = 0.0f;
toBlend.blendEndValue = 0.0f; toBlend.blendEndValue = 0.0f;
} }
toBlend.SetWeight( weight, currentTime - 1, blendTime ); toBlend.SetWeight( weight, currentTime - 1, blendTime );
// disable framecommands on the current channel so that commands aren't called twice // disable framecommands on the current channel so that commands aren't called twice
toBlend.AllowFrameCommands( false ); toBlend.AllowFrameCommands( false );
@ -3987,7 +3987,7 @@ void idAnimator::FinishAFPose( int animNum, const idBounds &bounds, const int ti
if ( !modelDef ) { if ( !modelDef ) {
return; return;
} }
const idAnim *anim = modelDef->GetAnim( animNum ); const idAnim *anim = modelDef->GetAnim( animNum );
if ( !anim ) { if ( !anim ) {
return; return;
@ -4290,7 +4290,7 @@ bool idAnimator::CreateFrame( int currentTime, bool force ) {
if ( entity && ( ( g_debugAnim.GetInteger() == entity->entityNumber ) || ( g_debugAnim.GetInteger() == -2 ) ) ) { if ( entity && ( ( g_debugAnim.GetInteger() == entity->entityNumber ) || ( g_debugAnim.GetInteger() == -2 ) ) ) {
debugInfo = true; debugInfo = true;
gameLocal.Printf( "---------------\n%d: entity '%s':\n", gameLocal.time, entity->GetName() ); gameLocal.Printf( "---------------\n%d: entity '%s':\n", gameLocal.time, entity->GetName() );
gameLocal.Printf( "model '%s':\n", modelDef->GetModelName() ); gameLocal.Printf( "model '%s':\n", modelDef->GetModelName() );
} else { } else {
debugInfo = false; debugInfo = false;
} }
@ -4393,7 +4393,7 @@ bool idAnimator::CreateFrame( int currentTime, bool force ) {
case JOINTMOD_LOCAL: case JOINTMOD_LOCAL:
joints[0].SetRotation( jointMod->mat * joints[0].ToMat3() ); joints[0].SetRotation( jointMod->mat * joints[0].ToMat3() );
break; break;
case JOINTMOD_WORLD: case JOINTMOD_WORLD:
joints[0].SetRotation( joints[0].ToMat3() * jointMod->mat ); joints[0].SetRotation( joints[0].ToMat3() * jointMod->mat );
break; break;
@ -4411,7 +4411,7 @@ bool idAnimator::CreateFrame( int currentTime, bool force ) {
case JOINTMOD_LOCAL: case JOINTMOD_LOCAL:
joints[0].SetTranslation( joints[0].ToVec3() + jointMod->pos ); joints[0].SetTranslation( joints[0].ToVec3() + jointMod->pos );
break; break;
case JOINTMOD_LOCAL_OVERRIDE: case JOINTMOD_LOCAL_OVERRIDE:
case JOINTMOD_WORLD: case JOINTMOD_WORLD:
case JOINTMOD_WORLD_OVERRIDE: case JOINTMOD_WORLD_OVERRIDE:
@ -4448,7 +4448,7 @@ bool idAnimator::CreateFrame( int currentTime, bool force ) {
case JOINTMOD_LOCAL: case JOINTMOD_LOCAL:
joints[i].SetRotation( jointMod->mat * ( joints[i].ToMat3() * joints[parentNum].ToMat3() ) ); joints[i].SetRotation( jointMod->mat * ( joints[i].ToMat3() * joints[parentNum].ToMat3() ) );
break; break;
case JOINTMOD_LOCAL_OVERRIDE: case JOINTMOD_LOCAL_OVERRIDE:
joints[i].SetRotation( jointMod->mat * joints[parentNum].ToMat3() ); joints[i].SetRotation( jointMod->mat * joints[parentNum].ToMat3() );
break; break;
@ -4471,7 +4471,7 @@ bool idAnimator::CreateFrame( int currentTime, bool force ) {
case JOINTMOD_LOCAL: case JOINTMOD_LOCAL:
joints[i].SetTranslation( joints[parentNum].ToVec3() + ( joints[i].ToVec3() + jointMod->pos ) * joints[parentNum].ToMat3() ); joints[i].SetTranslation( joints[parentNum].ToVec3() + ( joints[i].ToVec3() + jointMod->pos ) * joints[parentNum].ToMat3() );
break; break;
case JOINTMOD_LOCAL_OVERRIDE: case JOINTMOD_LOCAL_OVERRIDE:
joints[i].SetTranslation( joints[parentNum].ToVec3() + jointMod->pos * joints[parentNum].ToMat3() ); joints[i].SetTranslation( joints[parentNum].ToVec3() + jointMod->pos * joints[parentNum].ToMat3() );
break; break;
@ -5039,7 +5039,7 @@ idRenderModel *idGameEdit::ANIM_CreateMeshForAnim( idRenderModel *model, const c
const idDict *args; const idDict *args;
const char *temp; const char *temp;
idRenderModel *newmodel; idRenderModel *newmodel;
const idMD5Anim *md5anim; const idMD5Anim *md5anim;
idStr filename; idStr filename;
idStr extension; idStr extension;
const idAnim *anim; const idAnim *anim;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -140,7 +140,7 @@ void idModelExport::LoadMayaDll( void ) {
} }
// look up the dll interface functions // look up the dll interface functions
dllEntry = ( exporterDLLEntry_t )sys->DLL_GetProcAddress( importDLL, "dllEntry" ); dllEntry = ( exporterDLLEntry_t )sys->DLL_GetProcAddress( importDLL, "dllEntry" );
Maya_ConvertModel = ( exporterInterface_t )sys->DLL_GetProcAddress( importDLL, "Maya_ConvertModel" ); Maya_ConvertModel = ( exporterInterface_t )sys->DLL_GetProcAddress( importDLL, "Maya_ConvertModel" );
Maya_Shutdown = ( exporterShutdown_t )sys->DLL_GetProcAddress( importDLL, "Maya_Shutdown" ); Maya_Shutdown = ( exporterShutdown_t )sys->DLL_GetProcAddress( importDLL, "Maya_Shutdown" );
if ( !Maya_ConvertModel || !dllEntry || !Maya_Shutdown ) { if ( !Maya_ConvertModel || !dllEntry || !Maya_Shutdown ) {
@ -168,7 +168,7 @@ void idModelExport::LoadMayaDll( void ) {
===================== =====================
idModelExport::ConvertMayaToMD5 idModelExport::ConvertMayaToMD5
Checks if a Maya model should be converted to an MD5, and converts if if the time/date or Checks if a Maya model should be converted to an MD5, and converts if if the time/date or
version number has changed. version number has changed.
===================== =====================
*/ */
@ -256,7 +256,7 @@ bool idModelExport::ConvertMayaToMD5( void ) {
if ( Maya_Error != "Ok" ) { if ( Maya_Error != "Ok" ) {
return false; return false;
} }
// conversion succeded // conversion succeded
return true; return true;
} }
@ -415,7 +415,7 @@ int idModelExport::ParseExportSection( idParser &parser ) {
return 0; return 0;
} }
parser.ReadToken( &token ); parser.ReadToken( &token );
if ( token.Icmp( g_exportMask.GetString() ) ) { if ( token.Icmp( g_exportMask.GetString() ) ) {
parser.SkipBracedSection(); parser.SkipBracedSection();
return 0; return 0;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms
Model viewing can begin with either "testmodel <modelname>" Model viewing can begin with either "testmodel <modelname>"
The names must be the full pathname after the basedir, like The names must be the full pathname after the basedir, like
"models/weapons/v_launch/tris.md3" or "players/male/tris.md3" "models/weapons/v_launch/tris.md3" or "players/male/tris.md3"
Extension will default to ".ase" if not specified. Extension will default to ".ase" if not specified.
@ -55,7 +55,7 @@ move around it to view it from different angles.
CLASS_DECLARATION( idAnimatedEntity, idTestModel ) CLASS_DECLARATION( idAnimatedEntity, idTestModel )
EVENT( EV_FootstepLeft, idTestModel::Event_Footstep ) EVENT( EV_FootstepLeft, idTestModel::Event_Footstep )
EVENT( EV_FootstepRight, idTestModel::Event_Footstep ) EVENT( EV_FootstepRight, idTestModel::Event_Footstep )
END_CLASS END_CLASS
/* /*
@ -120,7 +120,7 @@ void idTestModel::Spawn( void ) {
physicsObj.SetSelf( this ); physicsObj.SetSelf( this );
physicsObj.SetOrigin( GetPhysics()->GetOrigin() ); physicsObj.SetOrigin( GetPhysics()->GetOrigin() );
physicsObj.SetAxis( GetPhysics()->GetAxis() ); physicsObj.SetAxis( GetPhysics()->GetAxis() );
if ( spawnArgs.GetVector( "mins", NULL, bounds[0] ) ) { if ( spawnArgs.GetVector( "mins", NULL, bounds[0] ) ) {
spawnArgs.GetVector( "maxs", NULL, bounds[1] ); spawnArgs.GetVector( "maxs", NULL, bounds[1] );
physicsObj.SetClipBox( bounds, 1.0f ); physicsObj.SetClipBox( bounds, 1.0f );
@ -157,7 +157,7 @@ void idTestModel::Spawn( void ) {
head.GetEntity()->SetOrigin( origin ); head.GetEntity()->SetOrigin( origin );
head.GetEntity()->SetAxis( GetPhysics()->GetAxis() ); head.GetEntity()->SetAxis( GetPhysics()->GetAxis() );
head.GetEntity()->BindToJoint( this, animator.GetJointName( joint ), true ); head.GetEntity()->BindToJoint( this, animator.GetJointName( joint ), true );
headAnimator = head.GetEntity()->GetAnimator(); headAnimator = head.GetEntity()->GetAnimator();
// set up the list of joints to copy to the head // set up the list of joints to copy to the head
@ -324,7 +324,7 @@ void idTestModel::Think( void ) {
} }
break; break;
} }
mode = g_testModelAnimate.GetInteger(); mode = g_testModelAnimate.GetInteger();
} }
@ -414,7 +414,7 @@ void idTestModel::NextAnim( const idCmdArgs &args ) {
headAnim = 0; headAnim = 0;
if ( headAnimator ) { if ( headAnimator ) {
headAnimator->ClearAllAnims( gameLocal.time, 0 ); headAnimator->ClearAllAnims( gameLocal.time, 0 );
headAnim = headAnimator->GetAnim( animname ); headAnim = headAnimator->GetAnim( animname );
if ( !headAnim ) { if ( !headAnim ) {
headAnim = headAnimator->GetAnim( "idle" ); headAnim = headAnimator->GetAnim( "idle" );
} }
@ -456,7 +456,7 @@ void idTestModel::PrevAnim( const idCmdArgs &args ) {
headAnim = 0; headAnim = 0;
if ( headAnimator ) { if ( headAnimator ) {
headAnimator->ClearAllAnims( gameLocal.time, 0 ); headAnimator->ClearAllAnims( gameLocal.time, 0 );
headAnim = headAnimator->GetAnim( animname ); headAnim = headAnimator->GetAnim( animname );
if ( !headAnim ) { if ( !headAnim ) {
headAnim = headAnimator->GetAnim( "idle" ); headAnim = headAnimator->GetAnim( "idle" );
} }
@ -565,7 +565,7 @@ void idTestModel::TestAnim( const idCmdArgs &args ) {
headAnim = 0; headAnim = 0;
if ( headAnimator ) { if ( headAnimator ) {
headAnimator->ClearAllAnims( gameLocal.time, 0 ); headAnimator->ClearAllAnims( gameLocal.time, 0 );
headAnim = headAnimator->GetAnim( animname ); headAnim = headAnimator->GetAnim( animname );
if ( !headAnim ) { if ( !headAnim ) {
headAnim = headAnimator->GetAnim( "idle" ); headAnim = headAnimator->GetAnim( "idle" );
if ( !headAnim ) { if ( !headAnim ) {
@ -766,8 +766,8 @@ void idTestModel::TestModel_f( const idCmdArgs &args ) {
// without appending an ase // without appending an ase
if ( name[ 0 ] != '_' ) { if ( name[ 0 ] != '_' ) {
name.DefaultFileExtension( ".ase" ); name.DefaultFileExtension( ".ase" );
} }
#ifndef _D3XP #ifndef _D3XP
// Maya ascii format is supported natively now // Maya ascii format is supported natively now
if ( strstr( name, ".ma" ) || strstr( name, ".mb" ) ) { if ( strstr( name, ".ma" ) || strstr( name, ".mb" ) ) {

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -58,19 +58,19 @@ public:
void TestAnim( const idCmdArgs &args ); void TestAnim( const idCmdArgs &args );
void BlendAnim( const idCmdArgs &args ); void BlendAnim( const idCmdArgs &args );
static void KeepTestModel_f( const idCmdArgs &args ); static void KeepTestModel_f( const idCmdArgs &args );
static void TestModel_f( const idCmdArgs &args ); static void TestModel_f( const idCmdArgs &args );
static void ArgCompletion_TestModel( const idCmdArgs &args, void(*callback)( const char *s ) ); static void ArgCompletion_TestModel( const idCmdArgs &args, void(*callback)( const char *s ) );
static void TestSkin_f( const idCmdArgs &args ); static void TestSkin_f( const idCmdArgs &args );
static void TestShaderParm_f( const idCmdArgs &args ); static void TestShaderParm_f( const idCmdArgs &args );
static void TestParticleStopTime_f( const idCmdArgs &args ); static void TestParticleStopTime_f( const idCmdArgs &args );
static void TestAnim_f( const idCmdArgs &args ); static void TestAnim_f( const idCmdArgs &args );
static void ArgCompletion_TestAnim( const idCmdArgs &args, void(*callback)( const char *s ) ); static void ArgCompletion_TestAnim( const idCmdArgs &args, void(*callback)( const char *s ) );
static void TestBlend_f( const idCmdArgs &args ); static void TestBlend_f( const idCmdArgs &args );
static void TestModelNextAnim_f( const idCmdArgs &args ); static void TestModelNextAnim_f( const idCmdArgs &args );
static void TestModelPrevAnim_f( const idCmdArgs &args ); static void TestModelPrevAnim_f( const idCmdArgs &args );
static void TestModelNextFrame_f( const idCmdArgs &args ); static void TestModelNextFrame_f( const idCmdArgs &args );
static void TestModelPrevFrame_f( const idCmdArgs &args ); static void TestModelPrevFrame_f( const idCmdArgs &args );
private: private:
idEntityPtr<idEntity> head; idEntityPtr<idEntity> head;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -2623,4 +2623,3 @@ If you have questions concerning this license or the applicable additional terms
typedef void ( idClass::*eventCallback_ffffffff_t )( const float, const float, const float, const float, const float, const float, const float, const float ); typedef void ( idClass::*eventCallback_ffffffff_t )( const float, const float, const float, const float, const float, const float, const float, const float );
( this->*( eventCallback_ffffffff_t )callback )( *( float * )&data[ 0 ], *( float * )&data[ 1 ], *( float * )&data[ 2 ], *( float * )&data[ 3 ], *( float * )&data[ 4 ], *( float * )&data[ 5 ], *( float * )&data[ 6 ], *( float * )&data[ 7 ] ); ( this->*( eventCallback_ffffffff_t )callback )( *( float * )&data[ 0 ], *( float * )&data[ 1 ], *( float * )&data[ 2 ], *( float * )&data[ 3 ], *( float * )&data[ 4 ], *( float * )&data[ 5 ], *( float * )&data[ 6 ], *( float * )&data[ 7 ] );
break; break;

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -62,7 +62,7 @@ initialized in any order, the constructor must handle the case that subclasses
are initialized before superclasses. are initialized before superclasses.
================ ================
*/ */
idTypeInfo::idTypeInfo( const char *classname, const char *superclass, idEventFunc<idClass> *eventCallbacks, idClass *( *CreateInstance )( void ), idTypeInfo::idTypeInfo( const char *classname, const char *superclass, idEventFunc<idClass> *eventCallbacks, idClass *( *CreateInstance )( void ),
void ( idClass::*Spawn )( void ), void ( idClass::*Save )( idSaveGame *savefile ) const, void ( idClass::*Restore )( idRestoreGame *savefile ) ) { void ( idClass::*Spawn )( void ), void ( idClass::*Save )( idSaveGame *savefile ) const, void ( idClass::*Restore )( idRestoreGame *savefile ) ) {
idTypeInfo *type; idTypeInfo *type;
@ -83,7 +83,7 @@ idTypeInfo::idTypeInfo( const char *classname, const char *superclass, idEventFu
// Check if any subclasses were initialized before their superclass // Check if any subclasses were initialized before their superclass
for( type = typelist; type != NULL; type = type->next ) { for( type = typelist; type != NULL; type = type->next ) {
if ( ( type->super == NULL ) && !idStr::Cmp( type->superclass, this->classname ) && if ( ( type->super == NULL ) && !idStr::Cmp( type->superclass, this->classname ) &&
idStr::Cmp( type->classname, "idClass" ) ) { idStr::Cmp( type->classname, "idClass" ) ) {
type->super = this; type->super = this;
} }
@ -117,7 +117,7 @@ idTypeInfo::~idTypeInfo() {
================ ================
idTypeInfo::Init idTypeInfo::Init
Initializes the event callback table for the class. Creates a Initializes the event callback table for the class. Creates a
table for fast lookups of event functions. Should only be called once. table for fast lookups of event functions. Should only be called once.
================ ================
*/ */
@ -203,7 +203,7 @@ void idTypeInfo::Init( void ) {
idTypeInfo::Shutdown idTypeInfo::Shutdown
Should only be called when DLL or EXE is being shutdown. Should only be called when DLL or EXE is being shutdown.
Although it cleans up any allocated memory, it doesn't bother to remove itself Although it cleans up any allocated memory, it doesn't bother to remove itself
from the class list since the program is shutting down. from the class list since the program is shutting down.
================ ================
*/ */
@ -394,7 +394,7 @@ void idClass::Init( void ) {
// is a subclass of another // is a subclass of another
num = 0; num = 0;
for( c = classHierarchy.GetNext(); c != NULL; c = c->node.GetNext(), num++ ) { for( c = classHierarchy.GetNext(); c != NULL; c = c->node.GetNext(), num++ ) {
c->typeNum = num; c->typeNum = num;
c->lastChild += num; c->lastChild += num;
} }
@ -504,7 +504,7 @@ void idClass::operator delete( void *ptr ) {
p = ( ( int * )ptr ) - 1; p = ( ( int * )ptr ) - 1;
memused -= *p; memused -= *p;
numobjects--; numobjects--;
Mem_Free( p ); Mem_Free( p );
} }
} }
@ -515,7 +515,7 @@ void idClass::operator delete( void *ptr, int, int, char *, int ) {
p = ( ( int * )ptr ) - 1; p = ( ( int * )ptr ) - 1;
memused -= *p; memused -= *p;
numobjects--; numobjects--;
Mem_Free( p ); Mem_Free( p );
} }
} }
@ -629,9 +629,9 @@ bool idClass::PostEventArgs( const idEventDef *ev, int time, int numargs, ... )
idTypeInfo *c; idTypeInfo *c;
idEvent *event; idEvent *event;
va_list args; va_list args;
assert( ev ); assert( ev );
if ( !idEvent::initialized ) { if ( !idEvent::initialized ) {
return false; return false;
} }
@ -830,7 +830,7 @@ bool idClass::ProcessEventArgs( const idEventDef *ev, int numargs, ... ) {
int num; int num;
int data[ D_EVENT_MAXARGS ]; int data[ D_EVENT_MAXARGS ];
va_list args; va_list args;
assert( ev ); assert( ev );
assert( idEvent::initialized ); assert( idEvent::initialized );

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
@ -102,7 +102,7 @@ CLASS_DECLARATION
This macro must be included in the code to properly initialize variables This macro must be included in the code to properly initialize variables
used in type checking and run-time instanciation. It also defines the list used in type checking and run-time instanciation. It also defines the list
of events that the class responds to. Take special care to ensure that the of events that the class responds to. Take special care to ensure that the
proper superclass is indicated or the run-time type information will be proper superclass is indicated or the run-time type information will be
incorrect. Use this on concrete classes only. incorrect. Use this on concrete classes only.
================ ================
@ -287,7 +287,7 @@ public:
idHierarchy<idTypeInfo> node; idHierarchy<idTypeInfo> node;
idTypeInfo( const char *classname, const char *superclass, idTypeInfo( const char *classname, const char *superclass,
idEventFunc<idClass> *eventCallbacks, idClass *( *CreateInstance )( void ), void ( idClass::*Spawn )( void ), idEventFunc<idClass> *eventCallbacks, idClass *( *CreateInstance )( void ), void ( idClass::*Spawn )( void ),
void ( idClass::*Save )( idSaveGame *savefile ) const, void ( idClass::*Restore )( idRestoreGame *savefile ) ); void ( idClass::*Save )( idSaveGame *savefile ) const, void ( idClass::*Restore )( idRestoreGame *savefile ) );
~idTypeInfo(); ~idTypeInfo();
@ -303,7 +303,7 @@ public:
================ ================
idTypeInfo::IsType idTypeInfo::IsType
Checks if the object's class is a subclass of the class defined by the Checks if the object's class is a subclass of the class defined by the
passed in idTypeInfo. passed in idTypeInfo.
================ ================
*/ */
@ -330,7 +330,7 @@ ID_INLINE bool idTypeInfo::RespondsTo( const idEventDef &ev ) const {
================ ================
idClass::IsType idClass::IsType
Checks if the object's class is a subclass of the class defined by the Checks if the object's class is a subclass of the class defined by the
passed in idTypeInfo. passed in idTypeInfo.
================ ================
*/ */

View file

@ -2,7 +2,7 @@
=========================================================================== ===========================================================================
Doom 3 GPL Source Code Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

Some files were not shown because too many files have changed in this diff Show more