From c7c187e4dca3ba4606a06258e62bcd2f33f6f833 Mon Sep 17 00:00:00 2001 From: dhewg Date: Tue, 6 Dec 2011 19:20:15 +0100 Subject: [PATCH] Fix all whitespace errors Excluding 3rd party files. --- cm/CollisionModel.h | 2 +- d3xp/AF.cpp | 8 +- d3xp/AF.h | 2 +- d3xp/AFEntity.cpp | 42 +- d3xp/AFEntity.h | 4 +- d3xp/Actor.cpp | 48 +- d3xp/Actor.h | 8 +- d3xp/BrittleFracture.cpp | 8 +- d3xp/BrittleFracture.h | 2 +- d3xp/Camera.cpp | 10 +- d3xp/Camera.h | 2 +- d3xp/EndLevel.cpp | 6 +- d3xp/EndLevel.h | 3 +- d3xp/Entity.cpp | 70 +- d3xp/Entity.h | 16 +- d3xp/Fx.cpp | 18 +- d3xp/Fx.h | 2 +- d3xp/Game.h | 4 +- d3xp/GameEdit.cpp | 12 +- d3xp/GameEdit.h | 2 +- d3xp/Game_local.cpp | 77 +- d3xp/Game_local.h | 10 +- d3xp/Game_network.cpp | 18 +- d3xp/Grabber.cpp | 8 +- d3xp/Grabber.h | 4 +- d3xp/IK.cpp | 46 +- d3xp/IK.h | 4 +- d3xp/Item.cpp | 162 +- d3xp/Item.h | 30 +- d3xp/Light.cpp | 28 +- d3xp/Light.h | 2 +- d3xp/Misc.cpp | 66 +- d3xp/Misc.h | 20 +- d3xp/Moveable.cpp | 16 +- d3xp/Moveable.h | 4 +- d3xp/Mover.cpp | 56 +- d3xp/Mover.h | 6 +- d3xp/MultiplayerGame.cpp | 566 ++-- d3xp/MultiplayerGame.h | 55 +- d3xp/Player.cpp | 288 +- d3xp/Player.h | 19 +- d3xp/PlayerIcon.cpp | 3 +- d3xp/PlayerIcon.h | 5 +- d3xp/PlayerView.cpp | 20 +- d3xp/PlayerView.h | 6 +- d3xp/Projectile.cpp | 100 +- d3xp/Projectile.h | 8 +- d3xp/Pvs.cpp | 8 +- d3xp/Pvs.h | 2 +- d3xp/SecurityCamera.cpp | 28 +- d3xp/SecurityCamera.h | 6 +- d3xp/SmokeParticles.cpp | 4 +- d3xp/SmokeParticles.h | 2 +- d3xp/Sound.cpp | 3 +- d3xp/Sound.h | 2 +- d3xp/Target.cpp | 11 +- d3xp/Target.h | 2 +- d3xp/Trigger.cpp | 22 +- d3xp/Trigger.h | 6 +- d3xp/Weapon.cpp | 62 +- d3xp/Weapon.h | 12 +- d3xp/WorldSpawn.cpp | 2 +- d3xp/WorldSpawn.h | 2 +- d3xp/ai/AAS.cpp | 4 +- d3xp/ai/AAS.h | 2 +- d3xp/ai/AAS_debug.cpp | 4 +- d3xp/ai/AAS_local.h | 2 +- d3xp/ai/AAS_pathing.cpp | 2 +- d3xp/ai/AAS_routing.cpp | 6 +- d3xp/ai/AI.cpp | 82 +- d3xp/ai/AI.h | 16 +- d3xp/ai/AI_Vagary.cpp | 8 +- d3xp/ai/AI_events.cpp | 35 +- d3xp/ai/AI_pathing.cpp | 14 +- d3xp/anim/Anim.cpp | 18 +- d3xp/anim/Anim.h | 6 +- d3xp/anim/Anim_Blend.cpp | 96 +- d3xp/anim/Anim_Import.cpp | 10 +- d3xp/anim/Anim_Testmodel.cpp | 22 +- d3xp/anim/Anim_Testmodel.h | 24 +- d3xp/gamesys/Callbacks.cpp | 3 +- d3xp/gamesys/Class.cpp | 22 +- d3xp/gamesys/Class.h | 10 +- d3xp/gamesys/DebugGraph.cpp | 2 +- d3xp/gamesys/DebugGraph.h | 2 +- d3xp/gamesys/Event.cpp | 10 +- d3xp/gamesys/Event.h | 8 +- d3xp/gamesys/NoGameTypeInfo.h | 2 +- d3xp/gamesys/SaveGame.cpp | 18 +- d3xp/gamesys/SaveGame.h | 2 +- d3xp/gamesys/SysCmds.cpp | 44 +- d3xp/gamesys/SysCmds.h | 2 +- d3xp/gamesys/SysCvar.cpp | 12 +- d3xp/gamesys/SysCvar.h | 2 +- d3xp/gamesys/TypeInfo.cpp | 2 +- d3xp/gamesys/TypeInfo.h | 2 +- d3xp/physics/Clip.cpp | 14 +- d3xp/physics/Clip.h | 2 +- d3xp/physics/Force.cpp | 2 +- d3xp/physics/Force.h | 2 +- d3xp/physics/Force_Constant.cpp | 2 +- d3xp/physics/Force_Constant.h | 2 +- d3xp/physics/Force_Drag.cpp | 2 +- d3xp/physics/Force_Drag.h | 2 +- d3xp/physics/Force_Field.cpp | 4 +- d3xp/physics/Force_Field.h | 2 +- d3xp/physics/Force_Grab.cpp | 4 +- d3xp/physics/Force_Grab.h | 2 +- d3xp/physics/Force_Spring.cpp | 2 +- d3xp/physics/Force_Spring.h | 2 +- d3xp/physics/Physics.cpp | 2 +- d3xp/physics/Physics.h | 4 +- d3xp/physics/Physics_AF.cpp | 8 +- d3xp/physics/Physics_AF.h | 2 +- d3xp/physics/Physics_Actor.cpp | 2 +- d3xp/physics/Physics_Actor.h | 2 +- d3xp/physics/Physics_Base.cpp | 2 +- d3xp/physics/Physics_Base.h | 2 +- d3xp/physics/Physics_Monster.cpp | 12 +- d3xp/physics/Physics_Monster.h | 2 +- d3xp/physics/Physics_Parametric.cpp | 2 +- d3xp/physics/Physics_Parametric.h | 2 +- d3xp/physics/Physics_Player.cpp | 13 +- d3xp/physics/Physics_Player.h | 2 +- d3xp/physics/Physics_RigidBody.cpp | 2 +- d3xp/physics/Physics_RigidBody.h | 2 +- d3xp/physics/Physics_Static.cpp | 4 +- d3xp/physics/Physics_Static.h | 2 +- d3xp/physics/Physics_StaticMulti.cpp | 8 +- d3xp/physics/Physics_StaticMulti.h | 2 +- d3xp/physics/Push.cpp | 4 +- d3xp/physics/Push.h | 2 +- d3xp/script/Script_Compiler.cpp | 158 +- d3xp/script/Script_Compiler.h | 18 +- d3xp/script/Script_Interpreter.cpp | 64 +- d3xp/script/Script_Interpreter.h | 22 +- d3xp/script/Script_Program.cpp | 22 +- d3xp/script/Script_Program.h | 36 +- d3xp/script/Script_Thread.cpp | 36 +- d3xp/script/Script_Thread.h | 54 +- framework/BuildDefines.h | 3 +- framework/BuildVersion.h | 2 +- framework/CVarSystem.h | 2 +- framework/CmdSystem.h | 2 +- framework/Common.h | 4 +- framework/DeclAF.h | 2 +- framework/DeclEntityDef.h | 2 +- framework/DeclFX.h | 4 +- framework/DeclManager.h | 6 +- framework/DeclPDA.h | 2 +- framework/DeclParticle.h | 30 +- framework/DeclSkin.h | 2 +- framework/DeclTable.h | 2 +- framework/File.h | 6 +- framework/FileSystem.h | 2 +- framework/Licensee.h | 2 +- framework/UsercmdGen.h | 2 +- framework/async/NetworkSystem.h | 2 +- game/AF.cpp | 8 +- game/AF.h | 2 +- game/AFEntity.cpp | 10 +- game/AFEntity.h | 2 +- game/Actor.cpp | 44 +- game/Actor.h | 6 +- game/BrittleFracture.cpp | 8 +- game/BrittleFracture.h | 2 +- game/Camera.cpp | 10 +- game/Camera.h | 2 +- game/EndLevel.cpp | 6 +- game/EndLevel.h | 3 +- game/Entity.cpp | 70 +- game/Entity.h | 14 +- game/Fx.cpp | 18 +- game/Fx.h | 2 +- game/Game.h | 4 +- game/GameEdit.cpp | 12 +- game/GameEdit.h | 2 +- game/Game_local.cpp | 45 +- game/Game_local.h | 6 +- game/Game_network.cpp | 20 +- game/IK.cpp | 46 +- game/IK.h | 4 +- game/Item.cpp | 28 +- game/Item.h | 2 +- game/Light.cpp | 18 +- game/Light.h | 2 +- game/Misc.cpp | 56 +- game/Misc.h | 18 +- game/Moveable.cpp | 16 +- game/Moveable.h | 4 +- game/Mover.cpp | 54 +- game/Mover.h | 6 +- game/MultiplayerGame.cpp | 51 +- game/MultiplayerGame.h | 9 +- game/Player.cpp | 162 +- game/Player.h | 13 +- game/PlayerIcon.cpp | 3 +- game/PlayerIcon.h | 5 +- game/PlayerView.cpp | 19 +- game/PlayerView.h | 6 +- game/Projectile.cpp | 48 +- game/Projectile.h | 8 +- game/Pvs.cpp | 9 +- game/Pvs.h | 2 +- game/SecurityCamera.cpp | 28 +- game/SecurityCamera.h | 6 +- game/SmokeParticles.cpp | 4 +- game/SmokeParticles.h | 2 +- game/Sound.cpp | 3 +- game/Sound.h | 2 +- game/Target.cpp | 11 +- game/Target.h | 2 +- game/Trigger.cpp | 22 +- game/Trigger.h | 2 +- game/Weapon.cpp | 46 +- game/Weapon.h | 12 +- game/WorldSpawn.cpp | 2 +- game/WorldSpawn.h | 2 +- game/ai/AAS.cpp | 4 +- game/ai/AAS.h | 2 +- game/ai/AAS_debug.cpp | 4 +- game/ai/AAS_local.h | 2 +- game/ai/AAS_pathing.cpp | 2 +- game/ai/AAS_routing.cpp | 6 +- game/ai/AI.cpp | 66 +- game/ai/AI.h | 16 +- game/ai/AI_Vagary.cpp | 8 +- game/ai/AI_events.cpp | 22 +- game/ai/AI_pathing.cpp | 14 +- game/anim/Anim.cpp | 18 +- game/anim/Anim.h | 4 +- game/anim/Anim_Blend.cpp | 94 +- game/anim/Anim_Import.cpp | 12 +- game/anim/Anim_Testmodel.cpp | 22 +- game/anim/Anim_Testmodel.h | 24 +- game/gamesys/Callbacks.cpp | 3 +- game/gamesys/Class.cpp | 22 +- game/gamesys/Class.h | 10 +- game/gamesys/DebugGraph.cpp | 2 +- game/gamesys/DebugGraph.h | 2 +- game/gamesys/Event.cpp | 14 +- game/gamesys/Event.h | 8 +- game/gamesys/NoGameTypeInfo.h | 2 +- game/gamesys/SaveGame.cpp | 18 +- game/gamesys/SaveGame.h | 2 +- game/gamesys/SysCmds.cpp | 14 +- game/gamesys/SysCmds.h | 2 +- game/gamesys/SysCvar.cpp | 14 +- game/gamesys/SysCvar.h | 2 +- game/gamesys/TypeInfo.cpp | 2 +- game/gamesys/TypeInfo.h | 2 +- game/physics/Clip.cpp | 12 +- game/physics/Clip.h | 2 +- game/physics/Force.cpp | 2 +- game/physics/Force.h | 2 +- game/physics/Force_Constant.cpp | 2 +- game/physics/Force_Constant.h | 2 +- game/physics/Force_Drag.cpp | 2 +- game/physics/Force_Drag.h | 2 +- game/physics/Force_Field.cpp | 4 +- game/physics/Force_Field.h | 2 +- game/physics/Force_Spring.cpp | 2 +- game/physics/Force_Spring.h | 2 +- game/physics/Physics.cpp | 2 +- game/physics/Physics.h | 4 +- game/physics/Physics_AF.cpp | 8 +- game/physics/Physics_AF.h | 2 +- game/physics/Physics_Actor.cpp | 2 +- game/physics/Physics_Actor.h | 2 +- game/physics/Physics_Base.cpp | 2 +- game/physics/Physics_Base.h | 2 +- game/physics/Physics_Monster.cpp | 12 +- game/physics/Physics_Monster.h | 2 +- game/physics/Physics_Parametric.cpp | 2 +- game/physics/Physics_Parametric.h | 2 +- game/physics/Physics_Player.cpp | 13 +- game/physics/Physics_Player.h | 2 +- game/physics/Physics_RigidBody.cpp | 2 +- game/physics/Physics_RigidBody.h | 2 +- game/physics/Physics_Static.cpp | 4 +- game/physics/Physics_Static.h | 2 +- game/physics/Physics_StaticMulti.cpp | 8 +- game/physics/Physics_StaticMulti.h | 2 +- game/physics/Push.cpp | 4 +- game/physics/Push.h | 2 +- game/script/Script_Compiler.cpp | 158 +- game/script/Script_Compiler.h | 18 +- game/script/Script_Interpreter.cpp | 64 +- game/script/Script_Interpreter.h | 22 +- game/script/Script_Program.cpp | 22 +- game/script/Script_Program.h | 36 +- game/script/Script_Thread.cpp | 36 +- game/script/Script_Thread.h | 52 +- idlib/Base64.cpp | 20 +- idlib/Base64.h | 4 +- idlib/BitMsg.cpp | 8 +- idlib/BitMsg.h | 2 +- idlib/CmdArgs.cpp | 3 +- idlib/CmdArgs.h | 2 +- idlib/Dict.cpp | 16 +- idlib/Dict.h | 2 +- idlib/Heap.cpp | 46 +- idlib/Heap.h | 4 +- idlib/LangDict.cpp | 12 +- idlib/LangDict.h | 2 +- idlib/Lexer.cpp | 9 +- idlib/Lexer.h | 7 +- idlib/Lib.cpp | 24 +- idlib/Lib.h | 4 +- idlib/MapFile.cpp | 6 +- idlib/MapFile.h | 2 +- idlib/Parser.cpp | 23 +- idlib/Parser.h | 2 +- idlib/Str.cpp | 45 +- idlib/Str.h | 2 +- idlib/Timer.cpp | 2 +- idlib/Timer.h | 2 +- idlib/Token.cpp | 2 +- idlib/Token.h | 2 +- idlib/bv/Bounds.cpp | 32 +- idlib/bv/Bounds.h | 2 +- idlib/bv/Box.cpp | 256 +- idlib/bv/Box.h | 2 +- idlib/bv/Frustum.cpp | 2 +- idlib/bv/Frustum.h | 2 +- idlib/bv/Frustum_gcc.cpp | 2 +- idlib/bv/Sphere.cpp | 2 +- idlib/bv/Sphere.h | 2 +- idlib/containers/BTree.h | 2 +- idlib/containers/BinSearch.h | 2 +- idlib/containers/HashIndex.cpp | 2 +- idlib/containers/HashIndex.h | 2 +- idlib/containers/HashTable.h | 2 +- idlib/containers/Hierarchy.h | 6 +- idlib/containers/LinkList.h | 4 +- idlib/containers/List.h | 8 +- idlib/containers/PlaneSet.h | 2 +- idlib/containers/Queue.h | 2 +- idlib/containers/Stack.h | 2 +- idlib/containers/StaticList.h | 10 +- idlib/containers/StrList.h | 2 +- idlib/containers/StrPool.h | 4 +- idlib/containers/VectorSet.h | 2 +- idlib/geometry/DrawVert.cpp | 2 +- idlib/geometry/DrawVert.h | 4 +- idlib/geometry/JointTransform.cpp | 6 +- idlib/geometry/JointTransform.h | 2 +- idlib/geometry/Surface.cpp | 8 +- idlib/geometry/Surface.h | 2 +- idlib/geometry/Surface_Patch.cpp | 4 +- idlib/geometry/Surface_Patch.h | 2 +- idlib/geometry/Surface_Polytope.cpp | 2 +- idlib/geometry/Surface_Polytope.h | 2 +- idlib/geometry/Surface_SweptSpline.cpp | 2 +- idlib/geometry/Surface_SweptSpline.h | 2 +- idlib/geometry/TraceModel.cpp | 8 +- idlib/geometry/TraceModel.h | 3 +- idlib/geometry/Winding.cpp | 74 +- idlib/geometry/Winding.h | 2 +- idlib/geometry/Winding2D.cpp | 24 +- idlib/geometry/Winding2D.h | 2 +- idlib/hashing/MD4.cpp | 116 +- idlib/hashing/MD5.cpp | 274 +- idlib/math/Angles.cpp | 8 +- idlib/math/Angles.h | 6 +- idlib/math/Complex.cpp | 2 +- idlib/math/Complex.h | 4 +- idlib/math/Curve.h | 22 +- idlib/math/Extrapolate.h | 2 +- idlib/math/Interpolate.h | 2 +- idlib/math/Lcp.cpp | 6 +- idlib/math/Lcp.h | 14 +- idlib/math/Math.cpp | 18 +- idlib/math/Math.h | 8 +- idlib/math/Matrix.cpp | 126 +- idlib/math/Matrix.h | 36 +- idlib/math/Ode.cpp | 15 +- idlib/math/Ode.h | 2 +- idlib/math/Plane.cpp | 2 +- idlib/math/Plane.h | 6 +- idlib/math/Pluecker.cpp | 2 +- idlib/math/Pluecker.h | 8 +- idlib/math/Polynomial.cpp | 2 +- idlib/math/Polynomial.h | 4 +- idlib/math/Quat.cpp | 2 +- idlib/math/Quat.h | 6 +- idlib/math/Random.h | 2 +- idlib/math/Rotation.cpp | 2 +- idlib/math/Rotation.h | 2 +- idlib/math/Simd.cpp | 54 +- idlib/math/Simd.h | 2 +- idlib/math/Simd_3DNow.cpp | 10 +- idlib/math/Simd_3DNow.h | 2 +- idlib/math/Simd_AltiVec.cpp | 4010 ++++++++++++------------ idlib/math/Simd_AltiVec.h | 22 +- idlib/math/Simd_Generic.cpp | 6 +- idlib/math/Simd_Generic.h | 2 +- idlib/math/Simd_MMX.cpp | 250 +- idlib/math/Simd_MMX.h | 2 +- idlib/math/Simd_SSE.cpp | 102 +- idlib/math/Simd_SSE.h | 8 +- idlib/math/Simd_SSE2.cpp | 164 +- idlib/math/Simd_SSE2.h | 4 +- idlib/math/Simd_SSE3.cpp | 2 +- idlib/math/Simd_SSE3.h | 2 +- idlib/math/Vector.cpp | 10 +- idlib/math/Vector.h | 46 +- idlib/precompiled.h | 2 +- renderer/Cinematic.h | 4 +- renderer/Material.h | 22 +- renderer/Model.h | 4 +- renderer/ModelManager.h | 2 +- renderer/RenderSystem.h | 4 +- renderer/RenderWorld.h | 6 +- renderer/glext.h | 8 +- renderer/qgl.h | 12 +- renderer/qgl_linked.h | 2 +- sound/sound.h | 6 +- sys/linux/qgl_enforce.h | 6 +- sys/sys_public.h | 8 +- tools/compilers/aas/AASFile.h | 4 +- tools/compilers/aas/AASFileManager.h | 2 +- ui/ListGUI.h | 2 +- ui/UserInterface.h | 2 +- 424 files changed, 5695 insertions(+), 5729 deletions(-) diff --git a/cm/CollisionModel.h b/cm/CollisionModel.h index 332427a..57561f1 100644 --- a/cm/CollisionModel.h +++ b/cm/CollisionModel.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/AF.cpp b/d3xp/AF.cpp index ff37d06..526c8cf 100644 --- a/d3xp/AF.cpp +++ b/d3xp/AF.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -621,7 +621,7 @@ idAF::LoadConstraint bool idAF::LoadConstraint( const idDeclAF_Constraint *fc ) { idAFBody *body1, *body2; idAngles angles; - idMat3 axis; + idMat3 axis; body1 = physicsObj.GetBody( fc->body1 ); body2 = physicsObj.GetBody( fc->body2 ); @@ -1143,7 +1143,7 @@ void idAF::LoadState( const idDict &args ) { body->SetWorldOrigin( origin ); body->SetWorldAxis( angles.ToMat3() ); } 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 ); @@ -1261,7 +1261,7 @@ void idAF::RemoveBindConstraints( void ) { name.Strip( "bindConstraint " ); if ( physicsObj.GetConstraint( name ) ) { - physicsObj.DeleteConstraint( name ); + physicsObj.DeleteConstraint( name ); } kv = args.MatchPrefix( "bindConstraint ", kv ); diff --git a/d3xp/AF.h b/d3xp/AF.h index 754925d..6380707 100644 --- a/d3xp/AF.h +++ b/d3xp/AF.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/AFEntity.cpp b/d3xp/AFEntity.cpp index 56cfae0..9a3c1d8 100644 --- a/d3xp/AFEntity.cpp +++ b/d3xp/AFEntity.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -371,9 +371,9 @@ idAFAttachment::Damage 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 ) { - + if ( body ) { body->Damage( inflictor, attacker, dir, damageDefName, damageScale, attachJoint ); } @@ -1705,7 +1705,7 @@ void idAFEntity_Vehicle::Spawn( void ) { steeringWheelJoint = animator.GetJointHandle( steeringWheelJointName ); spawnArgs.GetFloat( "wheelRadius", "20", wheelRadius ); - spawnArgs.GetFloat( "steerSpeed", "5", steerSpeed ); + spawnArgs.GetFloat( "steerSpeed", "5", steerSpeed ); player = NULL; 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() ); // FIXME: calculate correct modifiedOrigin modifiedOrigin[ jointNum ] = originalJoints[ jointNum ].ToVec3(); - } + } } // apply joint modifications to the skeleton @@ -3184,7 +3184,7 @@ idHarvestable::~idHarvestable() { } void idHarvestable::Spawn() { - + startTime = 0; spawnArgs.GetFloat( "triggersize", "120", triggersize ); @@ -3197,13 +3197,13 @@ void idHarvestable::Spawn() { fxFollowPlayer = spawnArgs.GetBool("fx_follow_player", "1"); fxOrient = spawnArgs.GetString("fx_orient"); - + } void idHarvestable::Init(idEntity* parent) { assert(parent); - + parentEnt = parent; GetPhysics()->SetOrigin( parent->GetPhysics()->GetOrigin() ); @@ -3214,7 +3214,7 @@ void idHarvestable::Init(idEntity* parent) { if(skin.Length()) { parent->SetSkin(declManager->FindSkin(skin.c_str())); } - + idEntity* head; if(parent->IsType(idActor::Type)) { idActor* withHead = (idActor*)parent; @@ -3270,7 +3270,7 @@ void idHarvestable::Restore( idRestoreGame *savefile ) { savefile->ReadBool( fxFollowPlayer ); fx.Restore( savefile ); savefile->ReadString( fxOrient ); - + parentEnt.Restore(savefile); } @@ -3302,7 +3302,7 @@ void idHarvestable::Think() { parent->PostEventMS( &EV_Remove, 0 ); PostEventMS( &EV_Remove, 0 ); } - + if(fxFollowPlayer) { idEntityFx* fxEnt = fx.GetEntity(); @@ -3339,12 +3339,12 @@ idAFEntity_Harvest::BeginBurn ================ */ void idHarvestable::BeginBurn() { - + idEntity* parent = parentEnt.GetEntity(); if(!parent) { return; } - + if(!spawnArgs.GetBool("burn")) { return; } @@ -3377,8 +3377,8 @@ void idHarvestable::BeginBurn() { 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 ) { - + idEntity* parent = parentEnt.GetEntity(); if(!parent) { return; @@ -3420,12 +3420,12 @@ void idHarvestable::CalcTriggerBounds( float size, idBounds &bounds ) { } bool idHarvestable::GetFxOrientationAxis(idMat3& mat) { - + idEntity* parent = parentEnt.GetEntity(); if(!parent) { return false; } - + idPlayer *thePlayer = player.GetEntity(); if(!fxOrient.Icmp("up")) { @@ -3466,7 +3466,7 @@ bool idHarvestable::GetFxOrientationAxis(idMat3& mat) { //Orient the fx towards the eye of the player idVec3 eye = thePlayer->GetEyePosition(); idVec3 toPlayer = eye-parent->GetPhysics()->GetOrigin(); - + toPlayer.Normalize(); idVec3 left, up; @@ -3613,11 +3613,11 @@ idAFEntity_Harvest::~idAFEntity_Harvest ================ */ idAFEntity_Harvest::~idAFEntity_Harvest() { - + if ( harvestEnt.GetEntity() ) { harvestEnt.GetEntity()->PostEventMS( &EV_Remove, 0 ); } - + } /* diff --git a/d3xp/AFEntity.h b/d3xp/AFEntity.h index 48165db..3739189 100644 --- a/d3xp/AFEntity.h +++ b/d3xp/AFEntity.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -526,7 +526,7 @@ private: #ifdef _D3XP -/** +/** * 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 * interface methods at the correct time. diff --git a/d3xp/Actor.cpp b/d3xp/Actor.cpp index 3a81919..135bae3 100644 --- a/d3xp/Actor.cpp +++ b/d3xp/Actor.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -230,7 +230,7 @@ idAnimState::AnimDone */ bool idAnimState::AnimDone( int blendFrames ) const { int animDoneTime; - + animDoneTime = animator->CurrentAnim( channel )->GetEndTime(); if ( animDoneTime < 0 ) { // playing a cycle @@ -457,7 +457,7 @@ idActor::idActor( void ) { allowEyeFocus = false; waitState = ""; - + blink_anim = NULL; blink_time = 0; blink_min = 0; @@ -527,7 +527,7 @@ void idActor::Spawn( void ) { spawnArgs.GetInt( "team", "0", team ); 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(); @@ -560,7 +560,7 @@ void idActor::Spawn( void ) { // don't let them drop to the floor args.Set( "dropToFloor", "0" ); - + gameLocal.SpawnEntityDef( args, &ent ); if ( !ent ) { 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" ); if ( headAnim ) { if ( headEnt ) { - headAnimator->CycleAnim( ANIMCHANNEL_ALL, headAnim, gameLocal.time, 0 ); + headAnimator->CycleAnim( ANIMCHANNEL_ALL, headAnim, gameLocal.time, 0 ); } else { headAnimator->CycleAnim( ANIMCHANNEL_HEAD, headAnim, gameLocal.time, 0 ); } @@ -1065,7 +1065,7 @@ void idActor::Show( void ) { static_cast( ent )->On(); } #endif - + } } @@ -1304,7 +1304,7 @@ idThread *idActor::ConstructScriptObject( void ) { } else { scriptThread->EndThread(); } - + // call script object's constructor constructor = scriptObject.GetConstructor(); if ( !constructor ) { @@ -1392,7 +1392,7 @@ void idActor::UpdateScript( void ) { if ( scriptThread->IsWaiting() ) { break; } - + scriptThread->Execute(); if ( idealState == state ) { break; @@ -1477,7 +1477,7 @@ bool idActor::CheckFOV( const idVec3 &pos ) const { float dot; idVec3 delta; - + delta = pos - GetEyePosition(); // get our gravity normal @@ -1911,7 +1911,7 @@ void idActor::GetAASLocation( idAAS *aas, idVec3 &pos, int &areaNum ) const { areaNum = 0; return; } - + size = aas->GetSettings()->boundingBoxes[0][1]; bounds[0] = -size; size.z = 32.0f; @@ -1948,7 +1948,7 @@ void idActor::SetAnimState( int channel, const char *statename, int blendFrames headAnim.SetState( statename, blendFrames ); allowEyeFocus = true; break; - + case ANIMCHANNEL_TORSO : torsoAnim.SetState( statename, blendFrames ); legsAnim.Enable( blendFrames ); @@ -2200,7 +2200,7 @@ Bleeding wounds and surface overlays are applied in the collision code that 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 ) { if ( !fl.takedamage ) { return; @@ -2222,7 +2222,7 @@ void idActor::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir } // 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" ) ) ) { return; } @@ -2360,7 +2360,7 @@ bool idActor::Pain( idEntity *inflictor, idEntity *attacker, int damage, const i } 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() ); } @@ -2504,7 +2504,7 @@ idActor::Event_DisableEyeFocus */ void idActor::Event_DisableEyeFocus( void ) { allowEyeFocus = false; - + idEntity *headEnt = head.GetEntity(); if ( headEnt ) { 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; idEntity *headEnt; int anim; - + anim = GetAnim( channel, animname ); if ( !anim ) { if ( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() ) { @@ -2720,7 +2720,7 @@ idActor::Event_PlayCycle void idActor::Event_PlayCycle( int channel, const char *animname ) { animFlags_t flags; int anim; - + anim = GetAnim( channel, animname ); if ( !anim ) { if ( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() ) { @@ -2793,8 +2793,8 @@ idActor::Event_IdleAnim */ void idActor::Event_IdleAnim( int channel, const char *animname ) { int anim; - - anim = GetAnim( channel, animname ); + + anim = GetAnim( channel, animname ); if ( !anim ) { if ( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() ) { 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 { idThread::ReturnFloat( MS2SEC( animator.AnimLength( anim ) ) ); return; - } + } } - + idThread::ReturnFloat( 0.0f ); } @@ -3224,7 +3224,7 @@ void idActor::Event_AnimDistance( int channel, const char *animname ) { return; } } - + idThread::ReturnFloat( 0.0f ); } @@ -3268,7 +3268,7 @@ void idActor::Event_NextEnemy( idEntity *ent ) { } } - idThread::ReturnEntity( NULL ); + idThread::ReturnEntity( NULL ); } /* diff --git a/d3xp/Actor.h b/d3xp/Actor.h index 09217e7..4af6006 100644 --- a/d3xp/Actor.h +++ b/d3xp/Actor.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -196,8 +196,8 @@ public: virtual void Teleport( const idVec3 &origin, const idAngles &angles, idEntity *destination ); - virtual renderView_t * GetRenderView(); - + virtual renderView_t * GetRenderView(); + // animation state control int GetAnim( int channel, const char *name ); void UpdateAnimState( void ); @@ -333,7 +333,7 @@ private: void Event_SetDamageCap( float _damageCap ); void Event_SetWaitState( const char* waitState); void Event_GetWaitState(); - + #endif }; diff --git a/d3xp/BrittleFracture.cpp b/d3xp/BrittleFracture.cpp index 5e68e21..665a623 100644 --- a/d3xp/BrittleFracture.cpp +++ b/d3xp/BrittleFracture.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -105,7 +105,7 @@ void idBrittleFracture::Save( idSaveGame *savefile ) const { entityFlags_s flags = fl; LittleBitField( &flags, sizeof( flags ) ); savefile->Write( &flags, sizeof( flags ) ); - + // setttings savefile->WriteMaterial( material ); savefile->WriteMaterial( decalMaterial ); @@ -416,7 +416,7 @@ bool idBrittleFracture::UpdateRenderEntity( renderEntity_s *renderEntity, const } packedColor = PackColor( idVec4( renderEntity->shaderParms[ SHADERPARM_RED ] * fade, renderEntity->shaderParms[ SHADERPARM_GREEN ] * fade, - renderEntity->shaderParms[ SHADERPARM_BLUE ] * fade, + renderEntity->shaderParms[ SHADERPARM_BLUE ] * fade, fade ) ); const idWinding &winding = shards[i]->winding; @@ -946,7 +946,7 @@ void idBrittleFracture::DropFloatingIslands( const idVec3 &point, const idVec3 & continue; } - queueStart = 0; + queueStart = 0; queueEnd = 1; queue[0] = shards[i]; shards[i]->islandNum = numIslands+1; diff --git a/d3xp/BrittleFracture.h b/d3xp/BrittleFracture.h index 9746bb4..18d704b 100644 --- a/d3xp/BrittleFracture.h +++ b/d3xp/BrittleFracture.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/Camera.cpp b/d3xp/Camera.cpp index 214c8ea..55eaafd 100644 --- a/d3xp/Camera.cpp +++ b/d3xp/Camera.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -193,7 +193,7 @@ idCameraView::GetViewParms */ void idCameraView::GetViewParms( renderView_t *view ) { assert( view ); - + if (view == NULL) { return; } @@ -215,7 +215,7 @@ void idCameraView::GetViewParms( renderView_t *view ) { } else { view->viewaxis = ent->GetPhysics()->GetAxis(); } - + gameLocal.CalcFov( fov, view->fov_x, view->fov_y ); } @@ -519,7 +519,7 @@ void idCameraAnim::Think( void ) { frameTime = ( gameLocal.time - starttime ) * frameRate; frame = frameTime / 1000; } - + if ( frame > camera.Num() + cameraCuts.Num() - 2 ) { if ( cycle > 0 ) { cycle--; @@ -656,7 +656,7 @@ void idCameraAnim::GetViewParms( renderView_t *view ) { // setup the pvs for this frame UpdatePVSAreas( view->vieworg ); - + #if 0 static int lastFrame = 0; static idVec3 lastFrameVec( 0.0f, 0.0f, 0.0f ); diff --git a/d3xp/Camera.h b/d3xp/Camera.h index 1146c88..3d6016e 100644 --- a/d3xp/Camera.h +++ b/d3xp/Camera.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/EndLevel.cpp b/d3xp/EndLevel.cpp index 3794995..21f1ec9 100644 --- a/d3xp/EndLevel.cpp +++ b/d3xp/EndLevel.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -75,7 +75,7 @@ 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; } @@ -88,7 +88,7 @@ void idTarget_EndLevel::Event_Trigger( idEntity *activator ) { if ( gameLocal.endLevel ) { return; } - + // mark the endLevel, which will modify some game actions // and pass control to us for drawing the stats and camera position gameLocal.endLevel = this; diff --git a/d3xp/EndLevel.h b/d3xp/EndLevel.h index 0157502..b2d6b04 100644 --- a/d3xp/EndLevel.h +++ b/d3xp/EndLevel.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -63,4 +63,3 @@ private: void Event_Trigger( idEntity *activator ); }; - diff --git a/d3xp/Entity.cpp b/d3xp/Entity.cpp index fc00c6d..64d9bd8 100644 --- a/d3xp/Entity.cpp +++ b/d3xp/Entity.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -160,8 +160,8 @@ ABSTRACT_DECLARATION( idClass, idEntity ) EVENT( EV_GetMins, idEntity::Event_GetMins) EVENT( EV_GetMaxs, idEntity::Event_GetMaxs ) EVENT( EV_Touches, idEntity::Event_Touches ) - EVENT( EV_SetGuiParm, idEntity::Event_SetGuiParm ) - EVENT( EV_SetGuiFloat, idEntity::Event_SetGuiFloat ) + EVENT( EV_SetGuiParm, idEntity::Event_SetGuiParm ) + EVENT( EV_SetGuiFloat, idEntity::Event_SetGuiFloat ) EVENT( EV_GetNextKey, idEntity::Event_GetNextKey ) EVENT( EV_SetKey, idEntity::Event_SetKey ) EVENT( EV_GetKey, idEntity::Event_GetKey ) @@ -490,7 +490,7 @@ void idEntity::Spawn( void ) { gameEdit->ParseSpawnArgsToRenderEntity( &spawnArgs, &renderEntity ); renderEntity.entityNum = entityNumber; - + #ifdef _D3XP noGrab = spawnArgs.GetBool( "noGrab", "0" ); @@ -778,7 +778,7 @@ void idEntity::Restore( idRestoreGame *savefile ) { savefile->Read( &fl, sizeof( fl ) ); LittleBitField( &fl, sizeof( fl ) ); - + #ifdef _D3XP savefile->ReadInt( timeGroup ); savefile->ReadBool( noGrab ); @@ -880,7 +880,7 @@ const char * idEntity::GetName( void ) const { /*********************************************************************** Thinking - + ***********************************************************************/ /* @@ -945,7 +945,7 @@ off from the player can skip all of their work */ bool idEntity::CheckDormant( void ) { bool dormant; - + dormant = DoDormantTests(); if ( dormant && !fl.isDormant ) { fl.isDormant = true; @@ -1056,7 +1056,7 @@ void idEntity::BecomeInactive( int flags ) { /*********************************************************************** Visuals - + ***********************************************************************/ /* @@ -1600,7 +1600,7 @@ renderView_t *idEntity::GetRenderView( void ) { /*********************************************************************** Sound - + ***********************************************************************/ /* @@ -1794,7 +1794,7 @@ void idEntity::FreeSoundEmitter( bool immediate ) { /*********************************************************************** entity binding - + ***********************************************************************/ /* @@ -2429,13 +2429,13 @@ void idEntity::JoinTeam( idEntity *teammember ) { ent->teamChain->teamMaster = master; } - prev->teamChain = this; + prev->teamChain = this; ent->teamChain = next; } teamMaster = master; - // reorder the active entity list + // reorder the active entity list gameLocal.sortTeamMasters = true; } @@ -2490,7 +2490,7 @@ void idEntity::QuitTeam( void ) { /*********************************************************************** Physics. - + ***********************************************************************/ /* @@ -2947,7 +2947,7 @@ void idEntity::RemoveContactEntity( idEntity *ent ) { /*********************************************************************** Damage - + ***********************************************************************/ /* @@ -2959,9 +2959,9 @@ explosions and melee attacks. ============ */ bool idEntity::CanDamage( const idVec3 &origin, idVec3 &damagePoint ) const { - idVec3 dest; + idVec3 dest; trace_t tr; - idVec3 midpoint; + idVec3 midpoint; // use the midpoint of the bounds instead of the origin, because // 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 ) { if ( !fl.takedamage ) { return; @@ -3167,7 +3167,7 @@ void idEntity::Killed( idEntity *inflictor, idEntity *attacker, int damage, cons /*********************************************************************** Script functions - + ***********************************************************************/ /* @@ -3402,7 +3402,7 @@ void idEntity::SignalEvent( idThread *thread, signalNum_t signalnum ) { /*********************************************************************** Guis. - + ***********************************************************************/ @@ -3599,7 +3599,7 @@ bool idEntity::HandleSingleGuiCommand( idEntity *entityGui, idLexer *src ) { /*********************************************************************** Targets - + ***********************************************************************/ /* @@ -3650,7 +3650,7 @@ idEntity::ActivateTargets void idEntity::ActivateTargets( idEntity *activator ) const { idEntity *ent; int i, j; - + for( i = 0; i < targets.Num(); i++ ) { ent = targets[ i ].GetEntity(); if ( !ent ) { @@ -3659,7 +3659,7 @@ void idEntity::ActivateTargets( idEntity *activator ) const { if ( ent->RespondsTo( EV_Activate ) || ent->HasSignal( SIG_TRIGGER ) ) { ent->Signal( SIG_TRIGGER ); ent->ProcessEvent( &EV_Activate, activator ); - } + } for ( j = 0; j < MAX_RENDERENTITY_GUI; j++ ) { if ( ent->renderEntity.gui[ j ] ) { ent->renderEntity.gui[ j ]->Trigger( gameLocal.time ); @@ -3671,7 +3671,7 @@ void idEntity::ActivateTargets( idEntity *activator ) const { /*********************************************************************** Misc. - + ***********************************************************************/ /* @@ -3803,7 +3803,7 @@ void idEntity::ShowEditingDialog( void ) { /*********************************************************************** Events - + ***********************************************************************/ /* @@ -3970,7 +3970,7 @@ void idEntity::Event_SpawnBind( void ) { const idAnim *anim; int animNum; idAnimator *parentAnimator; - + if ( spawnArgs.GetString( "bind", "", &bind ) ) { if ( idStr::Icmp( bind, "worldspawn" ) == 0 ) { //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 ) { int time; - + StartSound( soundName, ( s_channelType )channel, 0, ( netSync != 0 ), &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 ) ) { angles = axis.ToAngles(); } else { - angles[ 0 ] = 0; - angles[ 1 ] = spawnArgs.GetFloat( "angle" ); - angles[ 2 ] = 0; + angles[ 0 ] = 0; + angles[ 1 ] = spawnArgs.GetFloat( "angle" ); + angles[ 2 ] = 0; } Teleport( org, angles, NULL ); @@ -4543,7 +4543,7 @@ void idEntity::Event_UpdateCameraTarget( void ) { dir.Normalize(); cameraTarget->SetAxis( dir.ToMat3() ); SetAxis(dir.ToMat3()); - break; + break; } kv = cameraTarget->spawnArgs.MatchPrefix( "target", kv ); } @@ -4592,7 +4592,7 @@ idEntity::Event_WaitFrame */ void idEntity::Event_WaitFrame( void ) { idThread *thread; - + thread = idThread::CurrentThread(); if ( thread ) { thread->WaitFrame(); @@ -4735,7 +4735,7 @@ void idEntity::Event_GuiNamedEvent(int guiNum, const char *event) { /*********************************************************************** Network - + ***********************************************************************/ /* @@ -4909,7 +4909,7 @@ void idEntity::ServerSendEvent( int eventId, const idBitMsg *msg, bool saveEvent outMsg.Init( msgBuf, sizeof( msgBuf ) ); outMsg.BeginWriting(); - outMsg.WriteByte( GAME_RELIABLE_MESSAGE_EVENT ); + outMsg.WriteByte( GAME_RELIABLE_MESSAGE_EVENT ); outMsg.WriteBits( gameLocal.GetSpawnId( this ), 32 ); outMsg.WriteByte( eventId ); outMsg.WriteLong( gameLocal.time ); @@ -5281,7 +5281,7 @@ bool idAnimatedEntity::GetJointTransformForAnim( jointHandle_t jointHandle, int offset = frame[ jointHandle ].ToVec3(); axis = frame[ jointHandle ].ToMat3(); - + return true; } diff --git a/d3xp/Entity.h b/d3xp/Entity.h index f023de9..7d91008 100644 --- a/d3xp/Entity.h +++ b/d3xp/Entity.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -484,7 +484,7 @@ private: =============================================================================== Animated entity base class. - + =============================================================================== */ @@ -536,12 +536,12 @@ protected: private: void Event_GetJointHandle( const char *jointname ); - void Event_ClearAllJoints( void ); - void Event_ClearJoint( jointHandle_t jointnum ); - 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_GetJointPos( jointHandle_t jointnum ); - void Event_GetJointAngle( jointHandle_t jointnum ); + void Event_ClearAllJoints( void ); + void Event_ClearJoint( jointHandle_t jointnum ); + 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_GetJointPos( jointHandle_t jointnum ); + void Event_GetJointAngle( jointHandle_t jointnum ); }; diff --git a/d3xp/Fx.cpp b/d3xp/Fx.cpp index e7e3440..3be5597 100644 --- a/d3xp/Fx.cpp +++ b/d3xp/Fx.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -43,7 +43,7 @@ const idEventDef EV_Fx_KillFx( "_killfx" ); const idEventDef EV_Fx_Action( "_fxAction", "e" ); // implemented by subclasses CLASS_DECLARATION( idEntity, idEntityFx ) -EVENT( EV_Activate, idEntityFx::Event_Trigger ) +EVENT( EV_Activate, idEntityFx::Event_Trigger ) EVENT( EV_Fx_KillFx, idEntityFx::Event_ClearFx ) END_CLASS @@ -217,7 +217,7 @@ void idEntityFx::CleanUp( void ) { for( int i = 0; i < fxEffect->events.Num(); i++ ) { const idFXSingleAction& fxaction = fxEffect->events[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_GREEN] = (fxaction.fadeInTime) ? fadePct : 1.0f - fadePct; laction.renderEntity.shaderParms[SHADERPARM_BLUE] = (fxaction.fadeInTime) ? fadePct : 1.0f - fadePct; - + gameRenderWorld->UpdateEntityDef( laction.modelDefHandle, &laction.renderEntity ); } if ( laction.lightDefHandle != -1 ) { @@ -383,7 +383,7 @@ void idEntityFx::Run( int time ) { } laction.delay = totalDelay; laction.start = time; - } + } continue; } @@ -457,7 +457,7 @@ void idEntityFx::Run( int time ) { case FX_DECAL: { if ( !useAction->decalDropped ) { 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; } @@ -789,8 +789,8 @@ idEntityFx::ClientPredictionThink ================= */ void idEntityFx::ClientPredictionThink( void ) { - if ( gameLocal.isNewFrame ) { - Run( gameLocal.time ); + if ( gameLocal.isNewFrame ) { + Run( gameLocal.time ); } RunPhysics(); Present(); @@ -800,7 +800,7 @@ void idEntityFx::ClientPredictionThink( void ) { =============================================================================== idTeleporter - + =============================================================================== */ diff --git a/d3xp/Fx.h b/d3xp/Fx.h index ca75c55..f546d41 100644 --- a/d3xp/Fx.h +++ b/d3xp/Fx.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/Game.h b/d3xp/Game.h index 0fb3497..fee57b2 100644 --- a/d3xp/Game.h +++ b/d3xp/Game.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -241,7 +241,7 @@ public: // Animation system calls for non-game based skeletal rendering. 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_GetModelFromName( const char *modelName ); virtual const idMD5Anim * ANIM_GetAnimFromEntityDef( const char *classname, const char *animname ); diff --git a/d3xp/GameEdit.cpp b/d3xp/GameEdit.cpp index f8f19c7..a5be11e 100644 --- a/d3xp/GameEdit.cpp +++ b/d3xp/GameEdit.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -176,7 +176,7 @@ void idDragEntity::Update( idPlayer *player ) { player->GetViewPos( viewPoint, viewAxis ); // if no entity selected for dragging - if ( !dragEnt.GetEntity() ) { + if ( !dragEnt.GetEntity() ) { if ( player->usercmd.buttons & BUTTON_ATTACK ) { @@ -470,7 +470,7 @@ idEditEntities::RemoveSelectedEntity ============== */ void idEditEntities::RemoveSelectedEntity( idEntity *ent ) { - if ( selectedEntities.Find( ent ) ) { + if ( selectedEntities.Find( ent ) ) { selectedEntities.Remove( ent ); } } @@ -751,7 +751,7 @@ idGameEdit::FindEntity ================ */ 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 ) { for ( int i = 0 ; i < newArgs->GetNumKeyVals () ; i ++ ) { const idKeyValue *kv = newArgs->GetKeyVal( i ); - + if ( kv->GetValue().Length() > 0 ) { ent->spawnArgs.Set ( kv->GetKey() ,kv->GetValue() ); } else { @@ -1107,7 +1107,7 @@ int idGameEdit::MapGetEntitiesMatchingClassWithString( const char *classname, co if (ent) { idStr work = ent->epairs.GetString("classname"); if ( work.Icmp( classname ) == 0 ) { - if ( match && *match ) { + if ( match && *match ) { work = ent->epairs.GetString( "soundgroup" ); if ( count < max && work.Icmp( match ) == 0 ) { list[count++] = ent->epairs.GetString( "name" ); diff --git a/d3xp/GameEdit.h b/d3xp/GameEdit.h index 5fc74e5..4e63f67 100644 --- a/d3xp/GameEdit.h +++ b/d3xp/GameEdit.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/Game_local.cpp b/d3xp/Game_local.cpp index 00bf367..d16954d 100644 --- a/d3xp/Game_local.cpp +++ b/d3xp/Game_local.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -352,7 +352,7 @@ void idGameLocal::Init( void ) { // load default scripts program.Startup( SCRIPT_DEFAULT ); - + #ifdef _D3XP //BSM Nerve: Loads a game specific main script file idStr gamedir; @@ -363,7 +363,7 @@ void idGameLocal::Init( void ) { } else if ( i == 1 ) { gamedir = cvarSystem->GetCVarString( "fs_game" ); } - if( gamedir.Length() > 0 ) { + if( gamedir.Length() > 0 ) { idStr scriptFile = va( "script/%s_main.script", gamedir.c_str() ); if ( fileSystem->ReadFile( scriptFile.c_str(), NULL ) > 0 ) { program.CompileFile( scriptFile.c_str() ); @@ -486,7 +486,7 @@ void idGameLocal::SaveGame( idFile *f ) { idSaveGame savegame( f ); - if (g_flushSave.GetBool( ) == true ) { + if (g_flushSave.GetBool( ) == true ) { // force flushing with each write... for tracking down // save game bugs. 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" ) ) ); modifiedInfo = true; } - + // don't allow dupe nicknames for ( i = 0; i < numClients; i++ ) { if ( i == clientNum ) { @@ -959,7 +959,7 @@ void idGameLocal::LoadMap( const char *mapName, int randseed ) { memset( usercmds, 0, sizeof( usercmds ) ); memset( spawnIds, -1, sizeof( spawnIds ) ); spawnCount = INITIAL_SPAWN_COUNT; - + spawnedEntities.Clear(); activeEntities.Clear(); numEntitiesToDeactivate = 0; @@ -988,7 +988,7 @@ void idGameLocal::LoadMap( const char *mapName, int randseed ) { lastAIAlertEntity = NULL; lastAIAlertTime = 0; - + previousTime = 0; time = 0; framenum = 0; @@ -1131,7 +1131,7 @@ void idGameLocal::MapRestart( ) { #endif - + if ( isClient ) { LocalMapRestart(); } else { @@ -1628,7 +1628,7 @@ idGameLocal::MapShutdown */ void idGameLocal::MapShutdown( void ) { Printf( "--------- Game Map Shutdown ----------\n" ); - + gamestate = GAMESTATE_SHUTDOWN; if ( gameRenderWorld ) { @@ -1867,7 +1867,7 @@ void idGameLocal::CacheDictionaryMedia( const idDict *dict ) { while( kv ) { if ( kv->GetValue().Length() ) { 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" ) ) { // unfortunate flag names, they aren't actually a gui } else { @@ -2240,7 +2240,7 @@ bool idGameLocal::InPlayerPVS( idEntity *ent ) const { if ( playerPVS.i == -1 ) { 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 ) { 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 ) { g_gravity.SetFloat( 1.0f ); } - gravity.Set( 0, 0, -g_gravity.GetFloat() ); + gravity.Set( 0, 0, -g_gravity.GetFloat() ); // update all physics objects for( ent = spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() ) { @@ -2385,7 +2385,7 @@ void idGameLocal::RunTimeGroup2() { slow.Get( time, previousTime, msec, framenum, realClientTime ); } #endif - + /* ================ idGameLocal::RunFrame @@ -2611,7 +2611,7 @@ gameReturn_t idGameLocal::RunFrame( const usercmd_t *clientCmds ) { ret.syncNextGameFrame = skipCinematic; if ( skipCinematic ) { soundSystem->SetMute( false ); - skipCinematic = false; + skipCinematic = false; } // 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 ratio_x; float ratio_y; - + if ( !sys->FPU_StackIsEmpty() ) { Printf( sys->FPU_GetState() ); Error( "idGameLocal::CalcFov: FPU stack not empty" ); @@ -3255,7 +3255,7 @@ idEntity *idGameLocal::SpawnEntityType( const idTypeInfo &classdef, const idDict obj = classdef.CreateInstance(); obj->CallSpawn(); } - + catch( idAllocError & ) { obj = NULL; } @@ -3392,7 +3392,7 @@ idGameLocal::InhibitEntitySpawn ================ */ bool idGameLocal::InhibitEntitySpawn( idDict &spawnArgs ) { - + bool result = false; if ( isMultiplayer ) { @@ -3413,7 +3413,7 @@ bool idGameLocal::InhibitEntitySpawn( idDict &spawnArgs ) { const char *name; #ifndef ID_DEMO_BUILD - if ( g_skill.GetInteger() == 3 ) { + if ( g_skill.GetInteger() == 3 ) { name = spawnArgs.GetString( "classname" ); // _D3XP :: remove moveable medkit packs also 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 > ent = FindEntity( arg->GetValue() ); if ( ent ) { idEntityPtr &entityPtr = list.Alloc(); - entityPtr = ent; + entityPtr = ent; } } } @@ -3844,7 +3844,7 @@ void idGameLocal::RadiusDamage( const idVec3 &origin, idEntity *inflictor, idEnt idEntity * entityList[ MAX_GENTITIES ]; int numListedEntities; idBounds bounds; - idVec3 v, damagePoint, dir; + idVec3 v, damagePoint, dir; int i, e, damage, radius, push; 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 ); - } + } } // 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 cvarSystem->SetCVarFloat( "r_znear", 1.0f ); - + // hide all the player models for( i = 0; i < numClients; 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 continue; } - + if ( ent->IsType( idAI::Type ) ) { ai = static_cast( ent ); if ( !ai->GetEnemy() || !ai->IsActive() ) { @@ -4400,7 +4400,7 @@ void idGameLocal::RandomizeInitialSpawns( void ) { #ifdef CTF int k; #endif - + idEntity *ent; if ( !isMultiplayer || isClient ) { @@ -4414,7 +4414,7 @@ void idGameLocal::RandomizeInitialSpawns( void ) { teamInitialSpots[0].Clear(); teamInitialSpots[1].Clear(); #endif - + spot.dist = 0; spot.ent = FindEntityUsingDef( NULL, "info_player_deathmatch" ); while( spot.ent ) { @@ -4428,7 +4428,7 @@ void idGameLocal::RandomizeInitialSpawns( void ) { else common->Warning( "info_player_deathmatch : invalid or no team attached to spawn point\n"); } -#endif +#endif spawnSpots.Append( spot ); if ( spot.ent->spawnArgs.GetBool( "initial" ) ) { #ifdef CTF @@ -4438,7 +4438,7 @@ void idGameLocal::RandomizeInitialSpawns( void ) { teamInitialSpots[ spot.team ].Append( spot.ent ); } #endif - + initialSpots.Append( spot.ent ); } spot.ent = FindEntityUsingDef( spot.ent, "info_player_deathmatch" ); @@ -4456,7 +4456,7 @@ void idGameLocal::RandomizeInitialSpawns( void ) { return; } #endif - + if ( !spawnSpots.Num() ) { common->Warning( "no info_player_deathmatch in map" ); return; @@ -4485,7 +4485,7 @@ void idGameLocal::RandomizeInitialSpawns( void ) { } #endif - + 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 ( !initialSpots.Num() ) { @@ -4504,7 +4504,7 @@ void idGameLocal::RandomizeInitialSpawns( void ) { teamInitialSpots[ k ][ j ] = ent; } #endif - + for ( i = 0; i < initialSpots.Num(); i++ ) { j = random.RandomInt( initialSpots.Num() ); ent = initialSpots[ i ]; @@ -4557,7 +4557,7 @@ idEntity *idGameLocal::SelectInitialSpawnPoint( idPlayer *player ) { useInitialSpots = player->useInitialSpawns && currentInitialSpot < initialSpots.Num(); } #endif - + if ( player->spectating ) { // plain random spot, don't bother return spawnSpots[ random.RandomInt( spawnSpots.Num() ) ].ent; @@ -4619,7 +4619,7 @@ idEntity *idGameLocal::SelectInitialSpawnPoint( idPlayer *player ) { || static_cast< idPlayer * >( entities[ j ] )->spectating ) { continue; } - + dist = ( pos - entities[ j ]->GetPhysics()->GetOrigin() ).LengthSqr(); if ( dist < teamSpawnSpots[ team ][ i ].dist ) { teamSpawnSpots[ team ][ i ].dist = dist; @@ -4638,7 +4638,7 @@ idEntity *idGameLocal::SelectInitialSpawnPoint( idPlayer *player ) { return spot.ent; } #endif - + // find the distance to the closest active player for each spawn spot for( i = 0; i < spawnSpots.Num(); i++ ) { pos = spawnSpots[ i ].ent->GetPhysics()->GetOrigin(); @@ -4649,7 +4649,7 @@ idEntity *idGameLocal::SelectInitialSpawnPoint( idPlayer *player ) { || static_cast< idPlayer * >( entities[ j ] )->spectating ) { continue; } - + dist = ( pos - entities[ j ]->GetPhysics()->GetOrigin() ).LengthSqr(); if ( dist < spawnSpots[ i ].dist ) { spawnSpots[ i ].dist = dist; @@ -4688,7 +4688,7 @@ void idGameLocal::UpdateServerInfoFlags() { gameType = GAME_CTF; } #endif - + if ( gameType == GAME_LASTMAN ) { if ( !serverInfo.GetInt( "si_warmup" ) ) { common->Warning( "Last Man Standing - forcing warmup on" ); @@ -4923,12 +4923,12 @@ idGameLocal::NeedRestart =============== */ bool idGameLocal::NeedRestart() { - + idDict newInfo; const idKeyValue *keyval, *keyval2; newInfo = *cvarSystem->MoveCVarsToDict( CVAR_SERVERINFO ); - + for ( int i = 0; i < newInfo.GetNumKeyVals(); i++ ) { keyval = newInfo.GetKeyVal( i ); keyval2 = serverInfo.FindKey( keyval->GetKey() ); @@ -4983,4 +4983,3 @@ idGameLocal::GetMapLoadingGUI =============== */ void idGameLocal::GetMapLoadingGUI( char gui[ MAX_STRING_CHARS ] ) { } - diff --git a/d3xp/Game_local.h b/d3xp/Game_local.h index 3c229bf..4af1493 100644 --- a/d3xp/Game_local.h +++ b/d3xp/Game_local.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -181,8 +181,8 @@ typedef struct { idEntity *ent; int dist; #ifdef CTF - int team; -#endif + int team; +#endif } spawnSpot_t; //============================================================================ @@ -286,7 +286,7 @@ public: idDict persistentLevelInfo; // contains args that are kept around between levels // 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 @@ -300,7 +300,7 @@ public: idTestModel * testmodel; // for development testing of models 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 diff --git a/d3xp/Game_network.cpp b/d3xp/Game_network.cpp index 465241b..732329a 100644 --- a/d3xp/Game_network.cpp +++ b/d3xp/Game_network.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -566,7 +566,7 @@ void idGameLocal::ServerWriteSnapshot( int clientNum, int sequence, idBitMsg &ms } else { spectated = player; } - + // free too old snapshots FreeSnapshotsOlderThanSequence( clientNum, sequence - 64 ); @@ -749,7 +749,7 @@ void idGameLocal::ServerProcessEntityNetworkEventQueue( void ) { } idEntityPtr< idEntity > entPtr; - + if( !entPtr.SetSpawnId( event->spawnId ) ) { NetworkEventWarning( event, "Entity does not exist any longer, or has not been spawned yet." ); } else { @@ -1294,7 +1294,7 @@ void idGameLocal::ClientProcessEntityNetworkEventQueue( void ) { } idEntityPtr< idEntity > entPtr; - + if( !entPtr.SetSpawnId( event->spawnId ) ) { if( !gameLocal.entities[ event->spawnId & ( ( 1 << GENTITYNUM_BITS ) - 1 ) ] ) { // if new entity exists in this position, silently ignore @@ -1573,7 +1573,7 @@ idGameLocal::Tokenize void idGameLocal::Tokenize( idStrList &out, const char *in ) { char buf[ MAX_STRING_CHARS ]; char *token, *next; - + idStr::Copynz( buf, in, MAX_STRING_CHARS ); token = buf; next = strchr( token, ';' ); @@ -1588,7 +1588,7 @@ void idGameLocal::Tokenize( idStrList &out, const char *in ) { next = strchr( token, ';' ); } else { 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() ); } } - + idStr::Copynz( urls, reply, MAX_STRING_CHARS ); return true; } @@ -1738,7 +1738,7 @@ entityNetEvent_t* idEventQueue::RemoveLast( void ) { if ( !end ) { start = NULL; } else { - end->next = NULL; + end->next = NULL; } event->next = NULL; @@ -1782,7 +1782,7 @@ void idEventQueue::Enqueue( entityNetEvent_t *event, outOfOrderBehaviour_t behav cur->next = event; } return; - } + } // add the new event event->next = NULL; diff --git a/d3xp/Grabber.cpp b/d3xp/Grabber.cpp index ab62c2b..7c9dbe9 100644 --- a/d3xp/Grabber.cpp +++ b/d3xp/Grabber.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -341,7 +341,7 @@ void idGrabber::StopDrag( bool dropOnly ) { aiEnt->Damage( thePlayer, thePlayer, vec3_origin, "damage_suicide", 1.0f, INVALID_JOINT ); } - + af->SetThrown( !dropOnly ); // 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) ) { abort = true; } - + if ( abort ) { StopDrag( true ); return 3; @@ -461,7 +461,7 @@ int idGrabber::Update( idPlayer *player, bool hide ) { owner = player; // if no entity selected for dragging - if ( !dragEnt.GetEntity() ) { + if ( !dragEnt.GetEntity() ) { idBounds bounds; idVec3 end = player->firstPersonViewOrigin + player->firstPersonViewAxis[0] * dragTraceDist; diff --git a/d3xp/Grabber.h b/d3xp/Grabber.h index e4c75c0..1b14fae 100644 --- a/d3xp/Grabber.h +++ b/d3xp/Grabber.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -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. =============================================================================== diff --git a/d3xp/IK.cpp b/d3xp/IK.cpp index 3076dc3..1844ba2 100644 --- a/d3xp/IK.cpp +++ b/d3xp/IK.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -151,7 +151,7 @@ bool idIK::Init( idEntity *self, const char *anim, const idVec3 &modelOffset ) { self->name.c_str(), self->GetPhysics()->GetOrigin().ToString(0) ); return false; } - + this->modelOffset = modelOffset; return true; @@ -296,40 +296,40 @@ idIK_Walk::Save */ void idIK_Walk::Save( idSaveGame *savefile ) const { int i; - + idIK::Save( savefile ); savefile->WriteClipModel( footModel ); savefile->WriteInt( numLegs ); savefile->WriteInt( enabledLegs ); - for ( i = 0; i < MAX_LEGS; i++ ) + for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteInt( footJoints[i] ); - for ( i = 0; i < MAX_LEGS; i++ ) + for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteInt( ankleJoints[i] ); - for ( i = 0; i < MAX_LEGS; i++ ) + for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteInt( kneeJoints[i] ); - for ( i = 0; i < MAX_LEGS; i++ ) + for ( i = 0; i < MAX_LEGS; 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( waistJoint ); - + for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteVec3( hipForward[i] ); for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteVec3( kneeForward[i] ); - + for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteFloat( upperLegLength[i] ); for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteFloat( lowerLegLength[i] ); - + for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteMat3( upperLegToHipJoint[i] ); for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteMat3( lowerLegToKneeJoint[i] ); - + savefile->WriteFloat( smoothing ); savefile->WriteFloat( waistSmoothing ); savefile->WriteFloat( footShift ); @@ -359,7 +359,7 @@ idIK_Walk::Restore */ void idIK_Walk::Restore( idRestoreGame *savefile ) { int i; - + idIK::Restore( savefile ); savefile->ReadClipModel( footModel ); @@ -377,22 +377,22 @@ void idIK_Walk::Restore( idRestoreGame *savefile ) { for ( i = 0; i < MAX_LEGS; i++ ) savefile->ReadInt( (int&)dirJoints[i] ); savefile->ReadInt( (int&)waistJoint ); - + for ( i = 0; i < MAX_LEGS; i++ ) savefile->ReadVec3( hipForward[i] ); for ( i = 0; i < MAX_LEGS; i++ ) savefile->ReadVec3( kneeForward[i] ); - + for ( i = 0; i < MAX_LEGS; i++ ) savefile->ReadFloat( upperLegLength[i] ); for ( i = 0; i < MAX_LEGS; i++ ) savefile->ReadFloat( lowerLegLength[i] ); - + for ( i = 0; i < MAX_LEGS; i++ ) savefile->ReadMat3( upperLegToHipJoint[i] ); for ( i = 0; i < MAX_LEGS; i++ ) savefile->ReadMat3( lowerLegToKneeJoint[i] ); - + savefile->ReadFloat( smoothing ); savefile->ReadFloat( waistSmoothing ); savefile->ReadFloat( footShift ); @@ -893,17 +893,17 @@ void idIK_Reach::Save( idSaveGame *savefile ) const { savefile->WriteInt( shoulderJoints[i] ); for ( i = 0; i < MAX_ARMS; i++ ) savefile->WriteInt( dirJoints[i] ); - + for ( i = 0; i < MAX_ARMS; i++ ) savefile->WriteVec3( shoulderForward[i] ); for ( i = 0; i < MAX_ARMS; i++ ) savefile->WriteVec3( elbowForward[i] ); - + for ( i = 0; i < MAX_ARMS; i++ ) savefile->WriteFloat( upperArmLength[i] ); for ( i = 0; i < MAX_ARMS; i++ ) savefile->WriteFloat( lowerArmLength[i] ); - + for ( i = 0; i < MAX_ARMS; i++ ) savefile->WriteMat3( upperArmToShoulderJoint[i] ); for ( i = 0; i < MAX_ARMS; i++ ) @@ -929,17 +929,17 @@ void idIK_Reach::Restore( idRestoreGame *savefile ) { savefile->ReadInt( (int&)shoulderJoints[i] ); for ( i = 0; i < MAX_ARMS; i++ ) savefile->ReadInt( (int&)dirJoints[i] ); - + for ( i = 0; i < MAX_ARMS; i++ ) savefile->ReadVec3( shoulderForward[i] ); for ( i = 0; i < MAX_ARMS; i++ ) savefile->ReadVec3( elbowForward[i] ); - + for ( i = 0; i < MAX_ARMS; i++ ) savefile->ReadFloat( upperArmLength[i] ); for ( i = 0; i < MAX_ARMS; i++ ) savefile->ReadFloat( lowerArmLength[i] ); - + for ( i = 0; i < MAX_ARMS; i++ ) savefile->ReadMat3( upperArmToShoulderJoint[i] ); for ( i = 0; i < MAX_ARMS; i++ ) diff --git a/d3xp/IK.h b/d3xp/IK.h index dbc4e37..2e71b81 100644 --- a/d3xp/IK.h +++ b/d3xp/IK.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -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. =============================================================================== */ diff --git a/d3xp/Item.cpp b/d3xp/Item.cpp index 8279e01..c1f2d97 100644 --- a/d3xp/Item.cpp +++ b/d3xp/Item.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -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 ) { renderEntity->shaderParms[4] = 0.0f; } else { @@ -224,7 +224,7 @@ void idItem::Think( void ) { SetAngles( ang ); float scale = 0.005f + entityNumber * 0.00001f; - + org = orgOrigin; org.z += 4.0f + cos( ( gameLocal.time + 2000 ) * scale ) * 4.0f; SetOrigin( org ); @@ -302,7 +302,7 @@ void idItem::Spawn( void ) { if ( spawnArgs.GetBool( "spin" ) || (gameLocal.isMultiplayer && !this->IsType( idItemTeam::Type ) ) ) { spin = true; BecomeActive( TH_THINK ); - } + } #else if ( spawnArgs.GetBool( "spin" ) || gameLocal.isMultiplayer ) { spin = true; @@ -352,8 +352,8 @@ bool idItem::GiveToPlayer( idPlayer *player ) { if ( spawnArgs.GetBool( "inv_carry" ) ) { return player->GiveInventoryItem( &spawnArgs ); - } - + } + return player->GiveItem( this ); } @@ -363,7 +363,7 @@ idItem::Pickup ================ */ bool idItem::Pickup( idPlayer *player ) { - + if ( !GiveToPlayer( player ) ) { return false; } @@ -402,7 +402,7 @@ bool idItem::Pickup( idPlayer *player ) { const char *sfx = spawnArgs.GetString( "fxRespawn" ); if ( sfx && *sfx ) { PostEventSec( &EV_RespawnFx, respawn - 0.5f ); - } + } PostEventSec( &EV_RespawnItem, respawn ); } else if ( !spawnArgs.GetBool( "inv_objective" ) && !no_respawn ) { // give some time for the pickup sound to play @@ -677,12 +677,12 @@ idItemTeam::idItemTeam =============== */ idItemTeam::idItemTeam() { - team = -1; + team = -1; carried = false; dropped = false; lastDrop = 0; - itemGlowHandle = -1; + itemGlowHandle = -1; skinDefault = NULL; skinCarried = NULL; @@ -710,7 +710,7 @@ idItemTeam::Spawn =============== */ void idItemTeam::Spawn( void ) { - team = spawnArgs.GetInt( "team" ); + team = spawnArgs.GetInt( "team" ); returnOrigin = GetPhysics()->GetOrigin() + idVec3( 0, 0, 20 ); returnAxis = GetPhysics()->GetAxis(); @@ -829,18 +829,18 @@ idItemTeam::Pickup =============== */ bool idItemTeam::Pickup( idPlayer *player ) { - if ( !gameLocal.mpGame.IsGametypeFlagBased() ) /* CTF */ - return false; + if ( !gameLocal.mpGame.IsGametypeFlagBased() ) /* CTF */ + return false; - if ( gameLocal.mpGame.GetGameState() == idMultiplayerGame::WARMUP || - gameLocal.mpGame.GetGameState() == idMultiplayerGame::COUNTDOWN ) - return false; + if ( gameLocal.mpGame.GetGameState() == idMultiplayerGame::WARMUP || + gameLocal.mpGame.GetGameState() == idMultiplayerGame::COUNTDOWN ) + return false; // wait 2 seconds after drop before beeing picked up again if ( lastDrop != 0 && (gameLocal.time - lastDrop) < spawnArgs.GetInt("pickupDelay", "500") ) return false; - - if ( carried == false && player->team != this->team ) { + + if ( carried == false && player->team != this->team ) { PostEventMS( &EV_TakeFlag, 0, player ); @@ -864,10 +864,10 @@ idItemTeam::ClientReceiveEvent =============== */ bool idItemTeam::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { - gameLocal.DPrintf("ClientRecieveEvent: %i\n", event ); + gameLocal.DPrintf("ClientRecieveEvent: %i\n", event ); switch ( event ) { - case EVENT_TAKEFLAG: { + case EVENT_TAKEFLAG: { idPlayer * player = static_cast(gameLocal.entities[ msg.ReadBits( GENTITYNUM_BITS ) ]); if ( player == NULL ) { gameLocal.Warning( "NULL player takes flag?\n" ); @@ -905,7 +905,7 @@ bool idItemTeam::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) return true; }; - return false; + return false; } /* @@ -982,7 +982,7 @@ void idItemTeam::PrivateReturn( void ) itemGlow.shaderParms[ SHADERPARM_BLUE ] = 0.0f; itemGlow.shaderParms[ SHADERPARM_ALPHA ] = 0.0f; - if ( itemGlowHandle != -1 ) + if ( itemGlowHandle != -1 ) gameRenderWorld->UpdateLightDef( itemGlowHandle, &itemGlow );*/ GetPhysics()->SetLinearVelocity( idVec3(0, 0, 0) ); @@ -995,7 +995,7 @@ idItemTeam::Event_TakeFlag ================ */ void idItemTeam::Event_TakeFlag( idPlayer * player ) { - gameLocal.DPrintf("Event_TakeFlag()!\n"); + gameLocal.DPrintf("Event_TakeFlag()!\n"); if ( gameLocal.isServer ) { idBitMsg msg; @@ -1044,14 +1044,14 @@ void idItemTeam::Event_TakeFlag( idPlayer * player ) { SetSkin( skinCarried ); UpdateVisuals(); - UpdateGuis(); + UpdateGuis(); - if ( gameLocal.isServer ) { - if ( team == 0 ) - gameLocal.mpGame.player_red_flag = player->entityNumber; - else - gameLocal.mpGame.player_blue_flag = player->entityNumber; - } + if ( gameLocal.isServer ) { + if ( team == 0 ) + gameLocal.mpGame.player_red_flag = player->entityNumber; + else + gameLocal.mpGame.player_blue_flag = player->entityNumber; + } } /* @@ -1060,7 +1060,7 @@ idItemTeam::Event_DropFlag ================ */ void idItemTeam::Event_DropFlag( bool death ) { - gameLocal.DPrintf("Event_DropFlag()!\n"); + gameLocal.DPrintf("Event_DropFlag()!\n"); if ( gameLocal.isServer ) { idBitMsg msg; @@ -1094,7 +1094,7 @@ void idItemTeam::Event_DropFlag( bool death ) { // GetPhysics()->SetLinearVelocity( ( GetPhysics()->GetLinearVelocity() * GetBindMaster()->GetPhysics()->GetAxis() ) + GetBindMaster()->GetPhysics()->GetLinearVelocity() ); 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 ); Unbind(); @@ -1116,18 +1116,18 @@ void idItemTeam::Event_DropFlag( bool death ) { thread->DelayedStart( 0 ); } - SetSkin( skinDefault ); + SetSkin( skinDefault ); 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; + + } } /* @@ -1136,7 +1136,7 @@ idItemTeam::Event_FlagReturn ================ */ void idItemTeam::Event_FlagReturn( idPlayer * player ) { - gameLocal.DPrintf("Event_FlagReturn()!\n"); + gameLocal.DPrintf("Event_FlagReturn()!\n"); if ( gameLocal.isServer ) { ServerSendEvent( EVENT_FLAGRETURN, NULL, false, -1 ); @@ -1166,15 +1166,15 @@ void idItemTeam::Event_FlagReturn( idPlayer * player ) { } UpdateVisuals(); - UpdateGuis(); + UpdateGuis(); // Present(); - 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; + } } /* @@ -1215,16 +1215,16 @@ void idItemTeam::Event_FlagCapture( void ) { } 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 ); - if ( msg.HasChanged() ) - { - UpdateGuis(); + if ( msg.HasChanged() ) + { + UpdateGuis(); - if ( carried == true ) - SetSkin( skinCarried ); - else - SetSkin( skinDefault ); - } + if ( carried == true ) + SetSkin( skinCarried ); + else + SetSkin( skinDefault ); + } idMoveableItem::ReadFromSnapshot( msg ); } @@ -1308,21 +1308,21 @@ Update all client's huds wrt the flag status. ================ */ void idItemTeam::UpdateGuis( void ) { - idPlayer *player; - + idPlayer *player; + for ( int i = 0; i < gameLocal.numClients; i++ ) { player = static_cast( gameLocal.entities[ i ] ); - if ( player == NULL || player->hud == NULL ) + if ( player == NULL || player->hud == NULL ) continue; - player->hud->SetStateInt( "red_flagstatus", gameLocal.mpGame.GetFlagStatus( 0 ) ); - player->hud->SetStateInt( "blue_flagstatus", gameLocal.mpGame.GetFlagStatus( 1 ) ); + player->hud->SetStateInt( "red_flagstatus", gameLocal.mpGame.GetFlagStatus( 0 ) ); + player->hud->SetStateInt( "blue_flagstatus", gameLocal.mpGame.GetFlagStatus( 1 ) ); - player->hud->SetStateInt( "red_team_score", gameLocal.mpGame.GetFlagPoints( 0 ) ); - player->hud->SetStateInt( "blue_team_score", gameLocal.mpGame.GetFlagPoints( 1 ) ); + player->hud->SetStateInt( "red_team_score", gameLocal.mpGame.GetFlagPoints( 0 ) ); + player->hud->SetStateInt( "blue_team_score", gameLocal.mpGame.GetFlagPoints( 1 ) ); - } + } } @@ -1479,7 +1479,7 @@ void idObjective::Event_Trigger( idEntity *activator ) { //Pickup( player ); if ( spawnArgs.GetString( "inv_objective", NULL ) ) { - if ( player && player->hud ) { + if ( player && player->hud ) { idStr shotName = gameLocal.GetMapName(); shotName.StripFileExtension(); shotName += "/"; @@ -1598,7 +1598,7 @@ bool idPDAItem::GiveToPlayer(idPlayer *player) { =============================================================================== idMoveableItem - + =============================================================================== */ @@ -1641,7 +1641,7 @@ idMoveableItem::Save ================ */ void idMoveableItem::Save( idSaveGame *savefile ) const { - savefile->WriteStaticObject( physicsObj ); + savefile->WriteStaticObject( physicsObj ); savefile->WriteClipModel( trigger ); @@ -1757,7 +1757,7 @@ void idMoveableItem::Think( void ) { // update trigger position trigger->Link( gameLocal.clip, this, 0, GetPhysics()->GetOrigin(), mat3_identity ); } - + if ( thinkFlags & TH_UPDATEPARTICLES ) { if ( !gameLocal.smokeParticles->EmitSmoke( smoke, smokeTime, gameLocal.random.CRandomFloat(), GetPhysics()->GetOrigin(), GetPhysics()->GetAxis(), timeGroup /*_D3XP*/ ) ) { #ifdef CTF @@ -1810,7 +1810,7 @@ bool idMoveableItem::Pickup( idPlayer *player ) { bool ret = idItem::Pickup( player ); if ( ret ) { trigger->SetContents( 0 ); - } + } return ret; } @@ -2034,7 +2034,7 @@ idItemRemover::RemoveItem */ void idItemRemover::RemoveItem( idPlayer *player ) { const char *remove; - + remove = spawnArgs.GetString( "remove" ); player->RemoveInventoryItem( remove ); } @@ -2115,7 +2115,7 @@ void idObjectiveComplete::Event_Trigger( idEntity *activator ) { RemoveItem( player ); if ( spawnArgs.GetString( "inv_objective", NULL ) ) { - if ( player->hud ) { + if ( player->hud ) { player->hud->SetStateString( "objective", "2"); player->hud->SetStateString( "objectivetext", spawnArgs.GetString( "objectivetext" ) ); diff --git a/d3xp/Item.h b/d3xp/Item.h index e997a18..851ebb4 100644 --- a/d3xp/Item.h +++ b/d3xp/Item.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -60,9 +60,9 @@ public: EVENT_RESPAWN, EVENT_RESPAWNFX, #ifdef CTF - EVENT_TAKEFLAG, - EVENT_DROPFLAG, - EVENT_FLAGRETURN, + EVENT_TAKEFLAG, + EVENT_DROPFLAG, + EVENT_FLAGRETURN, EVENT_FLAGCAPTURE, #endif EVENT_MAXEVENTS @@ -176,7 +176,7 @@ public: virtual void WriteToSnapshot( idBitMsgDelta &msg ) const; virtual void ReadFromSnapshot( const idBitMsgDelta &msg ); -#ifdef CTF +#ifdef CTF protected: #else private: @@ -203,14 +203,14 @@ private: class idItemTeam : public idMoveableItem { public: - CLASS_PROTOTYPE( idItemTeam ); + CLASS_PROTOTYPE( idItemTeam ); - idItemTeam(); + idItemTeam(); virtual ~idItemTeam(); - void Spawn(); + void Spawn(); 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 ); void Drop( bool death = false ); // was the drop caused by death of carrier? @@ -225,8 +225,8 @@ public: virtual void ReadFromSnapshot( const idBitMsgDelta &msg ); public: - int team; - // TODO : turn this into a state : + int team; + // TODO : turn this into a state : bool carried; // is it beeing carried by a player? bool dropped; // was it dropped? @@ -243,8 +243,8 @@ private: const function_t * scriptReturned; const function_t * scriptCaptured; - renderLight_t itemGlow; // Used by flags when they are picked up - int itemGlowHandle; + renderLight_t itemGlow; // Used by flags when they are picked up + int itemGlowHandle; int lastNuggetDrop; const char * nuggetName; @@ -252,7 +252,7 @@ private: private: void Event_TakeFlag( idPlayer * player ); - void Event_DropFlag( bool death ); + void Event_DropFlag( bool death ); void Event_FlagReturn( idPlayer * player = NULL ); void Event_FlagCapture( void ); @@ -260,7 +260,7 @@ private: function_t * LoadScript( char * script ); void SpawnNugget( idVec3 pos ); - void UpdateGuis( void ); + void UpdateGuis( void ); }; #endif diff --git a/d3xp/Light.cpp b/d3xp/Light.cpp index d084c67..05cfb24 100644 --- a/d3xp/Light.cpp +++ b/d3xp/Light.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -123,10 +123,10 @@ void idGameEdit::ParseSpawnArgsToRenderLight( const idDict *args, renderLight_t idMat3 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 ) ) { - args->GetFloat( "angle", "0", angles[ 1 ] ); - angles[ 0 ] = 0; + args->GetFloat( "angle", "0", angles[ 1 ] ); + angles[ 0 ] = 0; angles[ 1 ] = idMath::AngleNormalize360( angles[ 1 ] ); - angles[ 2 ] = 0; + angles[ 2 ] = 0; mat = angles.ToMat3(); } } @@ -228,7 +228,7 @@ archives object for save game file */ void idLight::Save( idSaveGame *savefile ) const { savefile->WriteRenderLight( renderLight ); - + savefile->WriteBool( renderLight.prelightModel != NULL ); savefile->WriteVec3( localLightOrigin ); @@ -357,12 +357,12 @@ void idLight::Spawn( void ) { } #ifdef CTF - // Midnight CTF - if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") && !spawnArgs.GetBool("midnight_override") ) { - Off(); - } + // Midnight CTF + if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") && !spawnArgs.GetBool("midnight_override") ) { + Off(); + } #endif - + health = spawnArgs.GetInt( "health", "0" ); spawnArgs.GetString( "broken", "", brokenModel ); spawnArgs.GetBool( "break", "0", breakOnTrigger ); @@ -390,7 +390,7 @@ void idLight::Spawn( void ) { int pos; needBroken = false; - + pos = model.Find( "." ); if ( pos < 0 ) { pos = model.Length(); @@ -403,7 +403,7 @@ void idLight::Spawn( void ) { brokenModel += &model[ pos ]; } } - + // make sure the model gets cached if ( !renderModelManager->CheckModel( brokenModel ) ) { if ( needBroken ) { @@ -414,7 +414,7 @@ void idLight::Spawn( void ) { } GetPhysics()->SetContents( spawnArgs.GetBool( "nonsolid" ) ? 0 : CONTENTS_SOLID ); - + // make sure the collision model gets cached idClipModel::CheckModel( brokenModel ); } @@ -1095,7 +1095,7 @@ void idLight::ReadFromSnapshot( const idBitMsgDelta &msg ) { } } UnpackColor( msg.ReadLong(), baseColor ); - // lightParentEntityNum = msg.ReadBits( GENTITYNUM_BITS ); + // lightParentEntityNum = msg.ReadBits( GENTITYNUM_BITS ); /* // only helps prediction UnpackColor( msg.ReadLong(), fadeFrom ); diff --git a/d3xp/Light.h b/d3xp/Light.h index 20d31e6..123c8f2 100644 --- a/d3xp/Light.h +++ b/d3xp/Light.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/Misc.cpp b/d3xp/Misc.cpp index 78292a7..cce92cd 100644 --- a/d3xp/Misc.cpp +++ b/d3xp/Misc.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -419,7 +419,7 @@ void idPathCorner::Event_RandomPath( void ) { =============================================================================== idDamagable - + =============================================================================== */ @@ -469,9 +469,9 @@ void idDamagable::Spawn( void ) { idStr broken; health = spawnArgs.GetInt( "health", "5" ); - spawnArgs.GetInt( "count", "1", count ); + spawnArgs.GetInt( "count", "1", count ); nextTriggerTime = 0; - + // make sure the model gets cached spawnArgs.GetString( "broken", "", broken ); if ( broken.Length() && !renderModelManager->CheckModel( broken ) ) { @@ -492,7 +492,7 @@ void idDamagable::BecomeBroken( idEntity *activator ) { int numStates; int cycle; float wait; - + if ( gameLocal.time < nextTriggerTime ) { return; } @@ -605,7 +605,7 @@ void idDamagable::Event_RestoreDamagable( void ) { =============================================================================== idExplodable - + =============================================================================== */ @@ -655,7 +655,7 @@ void idExplodable::Event_Explode( idEntity *activator ) { =============================================================================== idSpring - + =============================================================================== */ @@ -692,7 +692,7 @@ void idSpring::Think( void ) { origin = ent2->GetPhysics()->GetOrigin(); end = origin + p2 * axis; } - + gameRenderWorld->DebugLine( idVec4(1, 1, 0, 1), start, end, 0, true ); } @@ -760,7 +760,7 @@ void idSpring::Spawn( void ) { =============================================================================== idForceField - + =============================================================================== */ @@ -998,7 +998,7 @@ void idAnimated::Spawn( void ) { float wait; const char *joint; - joint = spawnArgs.GetString( "sound_bone", "origin" ); + joint = spawnArgs.GetString( "sound_bone", "origin" ); soundJoint = animator.GetJointHandle( 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 ); @@ -1047,7 +1047,7 @@ void idAnimated::Spawn( void ) { animator.CycleAnim( ANIMCHANNEL_ALL, anim2, gameLocal.time, 0 ); } else if ( anim ) { // 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 ) { blendFrames = 0; @@ -1108,7 +1108,7 @@ bool idAnimated::StartRagdoll( void ) { // start using the AF af.StartFromCurrentPose( spawnArgs.GetInt( "velocityTime", "0" ) ); - + return true; } @@ -1151,7 +1151,7 @@ void idAnimated::PlayNextAnim( void ) { if ( g_debugCinematic.GetBool() ) { gameLocal.Printf( "%d: '%s' start anim '%s'\n", gameLocal.framenum, GetName(), animname ); } - + spawnArgs.GetInt( "cycle", "1", cycle ); if ( ( current_anim_index == num_anims ) && spawnArgs.GetBool( "loop_last_anim" ) ) { cycle = -1; @@ -1303,7 +1303,7 @@ void idAnimated::Event_LaunchMissilesUpdate( int launchjoint, int targetjoint, i animator.GetJointTransform( ( jointHandle_t )launchjoint, gameLocal.time, launchPos, axis ); launchPos = renderEntity.origin + launchPos * renderEntity.axis; - + animator.GetJointTransform( ( jointHandle_t )targetjoint, gameLocal.time, targetPos, 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[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 // 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; @@ -2314,7 +2314,7 @@ void idBeam::Event_Activate( idEntity *activator ) { if ( IsHidden() ) { Show(); } else { - Hide(); + Hide(); } } @@ -2467,7 +2467,7 @@ void idShaking::Spawn( void ) { physicsObj.SetAxis( GetPhysics()->GetAxis() ); physicsObj.SetClipMask( MASK_SOLID ); SetPhysics( &physicsObj ); - + active = false; if ( !spawnArgs.GetBool( "start_off" ) ) { BeginShaking(); @@ -2596,7 +2596,7 @@ idEarthQuake::Event_Activate ================ */ void idEarthQuake::Event_Activate( idEntity *activator ) { - + if ( nextTriggerTime > gameLocal.time ) { return; } @@ -2920,7 +2920,7 @@ void idFuncRadioChatter::Event_Activate( idEntity *activator ) { const char *sound; const idSoundShader *shader; int length; - + if ( activator->IsType( idPlayer::Type ) ) { player = static_cast( activator ); } else { @@ -2935,7 +2935,7 @@ void idFuncRadioChatter::Event_Activate( idEntity *activator ) { player->StartSoundShader( shader, SND_CHANNEL_RADIO, SSF_GLOBAL, false, &length ); 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 PostEventSec( &EV_ResetRadioHud, time, player ); @@ -2973,8 +2973,8 @@ idPhantomObjects::idPhantomObjects idPhantomObjects::idPhantomObjects() { target = NULL; end_time = 0; - throw_time = 0.0f; - shake_time = 0.0f; + throw_time = 0.0f; + shake_time = 0.0f; shake_ang.Zero(); speed = 0.0f; min_wait = 0; @@ -3025,8 +3025,8 @@ void idPhantomObjects::Restore( idRestoreGame *savefile ) { savefile->ReadInt( min_wait ); savefile->ReadInt( max_wait ); target.Restore( savefile ); - - savefile->ReadInt( num ); + + savefile->ReadInt( num ); targetTime.SetGranularity( 1 ); targetTime.SetNum( num ); lastTargetPos.SetGranularity( 1 ); @@ -3087,7 +3087,7 @@ void idPhantomObjects::Event_Activate( idEntity *activator ) { } else { target = static_cast( activator ); } - + end_time = gameLocal.time + SEC2MS( spawnArgs.GetFloat( "end_time", "0" ) ); targetTime.SetNum( targets.Num() ); @@ -3095,7 +3095,7 @@ void idPhantomObjects::Event_Activate( idEntity *activator ) { 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; for( i = 0; i < targetTime.Num(); i++ ) { targetTime[ i ] = SEC2MS( time ); @@ -3153,7 +3153,7 @@ void idPhantomObjects::Think( void ) { if ( !ent ) { continue; } - + if ( ent->fl.hidden ) { // don't throw hidden objects continue; @@ -3180,7 +3180,7 @@ void idPhantomObjects::Think( void ) { } 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 ); vel *= speed; entPhys->SetLinearVelocity( vel ); @@ -3285,7 +3285,7 @@ void idShockwave::Restore( idRestoreGame *savefile ) { savefile->ReadFloat( height ); savefile->ReadBool( playerDamaged ); savefile->ReadFloat( playerDamageSize ); - + } /* @@ -3347,13 +3347,13 @@ void idShockwave::Think() { } else { zVal = height/2.0f; } - + //Expand in a sphere end = pos + idVec3( newSize, newSize, zVal ); idBounds bounds( end ); end = pos + idVec3( -newSize, -newSize, -zVal ); bounds.AddPoint( end ); - + if(g_debugShockwave.GetBool()) { gameRenderWorld->DebugBounds(colorRed, bounds, vec3_origin); } @@ -3380,7 +3380,7 @@ void idShockwave::Think() { if(ent->IsType( idPlayer::Type )) { if(ent->GetPhysics()->GetAbsBounds().IntersectsBounds(bounds)) { - + //For player damage we check the current radius and a specified player damage ring size if ( dist <= newSize && dist > newSize-playerDamageSize ) { @@ -3624,7 +3624,7 @@ void idFuncMountedWeapon::Spawn( void ) { spawnArgs.GetString( "snd_fire", "", fireSound ); soundFireWeapon = declManager->FindSound( fireSound ); - PostEventMS( &EV_PostSpawn, 0 ); + PostEventMS( &EV_PostSpawn, 0 ); } void idFuncMountedWeapon::Think( void ) { diff --git a/d3xp/Misc.h b/d3xp/Misc.h index 43ece0e..4b51aa8 100644 --- a/d3xp/Misc.h +++ b/d3xp/Misc.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -97,7 +97,7 @@ private: Bind to a mover to have the mover activate a trigger as it moves. When target by triggers, activating the trigger will toggle the activator on and off. Check "start_off" to have it spawn disabled. - + =============================================================================== */ @@ -288,7 +288,7 @@ private: void PlayNextAnim( void ); - void Event_Activate( idEntity *activator ); + void Event_Activate( idEntity *activator ); void Event_Start( void ); void Event_StartRagdoll( void ); void Event_AnimDone( int animIndex ); @@ -486,7 +486,7 @@ public: void Save( idSaveGame *savefile ) const; void Restore( idRestoreGame *savefile ); - void Event_Activate( idEntity *activator ); + void Event_Activate( idEntity *activator ); private: qhandle_t portal; @@ -606,7 +606,7 @@ private: class idEarthQuake : public idEntity { public: CLASS_PROTOTYPE( idEarthQuake ); - + idEarthQuake(); void Spawn( void ); @@ -641,7 +641,7 @@ private: class idFuncPortal : public idEntity { public: CLASS_PROTOTYPE( idFuncPortal ); - + idFuncPortal(); void Spawn( void ); @@ -667,7 +667,7 @@ private: class idFuncAASPortal : public idEntity { public: CLASS_PROTOTYPE( idFuncAASPortal ); - + idFuncAASPortal(); void Spawn( void ); @@ -692,7 +692,7 @@ private: class idFuncAASObstacle : public idEntity { public: CLASS_PROTOTYPE( idFuncAASObstacle ); - + idFuncAASObstacle(); void Spawn( void ); @@ -744,7 +744,7 @@ private: class idPhantomObjects : public idEntity { public: CLASS_PROTOTYPE( idPhantomObjects ); - + idPhantomObjects(); void Spawn( void ); @@ -834,7 +834,7 @@ private: int harc; int varc; - void Event_Touch( idEntity *other, trace_t *trace ); + void Event_Touch( idEntity *other, trace_t *trace ); void Event_Activate( idEntity *activator ); public: diff --git a/d3xp/Moveable.cpp b/d3xp/Moveable.cpp index 943f736..e2bdd1f 100644 --- a/d3xp/Moveable.cpp +++ b/d3xp/Moveable.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -35,7 +35,7 @@ If you have questions concerning this license or the applicable additional terms =============================================================================== idMoveable - + =============================================================================== */ @@ -556,7 +556,7 @@ void idMoveable::Event_Activate( idEntity *activator ) { Show(); if ( !spawnArgs.GetInt( "notPushable" ) ) { - physicsObj.EnableImpact(); + physicsObj.EnableImpact(); } physicsObj.Activate(); @@ -622,7 +622,7 @@ void idMoveable::Event_EnableDamage( float enable ) { =============================================================================== idBarrel - + =============================================================================== */ @@ -1155,7 +1155,7 @@ void idExplodingBarrel::Killed( idEntity *inflictor, idEntity *attacker, int dam msg.Init( msgBuf, sizeof( msgBuf ) ); msg.WriteLong( gameLocal.time ); ServerSendEvent( EVENT_EXPLODE, &msg, false, -1 ); - } + } } // 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( ); - + //FIXME: need to precache all the debris stuff here and in the projectiles const idKeyValue *kv = spawnArgs.MatchPrefix( "def_debris" ); // bool first = true; @@ -1198,7 +1198,7 @@ void idExplodingBarrel::Killed( idEntity *inflictor, idEntity *attacker, int dam debris->Launch(); debris->GetRenderEntity()->shaderParms[ SHADERPARM_TIME_OF_DEATH ] = ( gameLocal.time + 1500 ) * 0.001f; debris->UpdateVisuals(); - + } kv = spawnArgs.MatchPrefix( "def_debris", kv ); } @@ -1224,7 +1224,7 @@ void idExplodingBarrel::Killed( idEntity *inflictor, idEntity *attacker, int dam 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 idDict *damageDef = gameLocal.FindEntityDefDict( damageDefName ); diff --git a/d3xp/Moveable.h b/d3xp/Moveable.h index 6611e78..b8e0ba2 100644 --- a/d3xp/Moveable.h +++ b/d3xp/Moveable.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -167,7 +167,7 @@ public: #endif 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 ); virtual void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ); diff --git a/d3xp/Mover.cpp b/d3xp/Mover.cpp index b04b2f7..a2414bb 100644 --- a/d3xp/Mover.cpp +++ b/d3xp/Mover.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -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! -// 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 // realtime info like this // binary only @@ -174,7 +174,7 @@ void idMover::Save( idSaveGame *savefile ) const { savefile->WriteInt( move.movetime ); savefile->WriteInt( move.deceleration ); savefile->WriteVec3( move.dir ); - + savefile->WriteInt( rot.stage ); savefile->WriteInt( rot.acceleration ); savefile->WriteInt( rot.movetime ); @@ -182,7 +182,7 @@ void idMover::Save( idSaveGame *savefile ) const { savefile->WriteFloat( rot.rot.pitch ); savefile->WriteFloat( rot.rot.yaw ); savefile->WriteFloat( rot.rot.roll ); - + savefile->WriteInt( move_thread ); savefile->WriteInt( rotate_thread ); @@ -243,7 +243,7 @@ void idMover::Restore( idRestoreGame *savefile ) { savefile->ReadInt( move.movetime ); savefile->ReadInt( move.deceleration ); savefile->ReadVec3( move.dir ); - + savefile->ReadInt( (int&)rot.stage ); savefile->ReadInt( rot.acceleration ); savefile->ReadInt( rot.movetime ); @@ -251,7 +251,7 @@ void idMover::Restore( idRestoreGame *savefile ) { savefile->ReadFloat( rot.rot.pitch ); savefile->ReadFloat( rot.rot.yaw ); savefile->ReadFloat( rot.rot.roll ); - + savefile->ReadInt( move_thread ); savefile->ReadInt( rotate_thread ); @@ -299,7 +299,7 @@ void idMover::Restore( idRestoreGame *savefile ) { savefile->ReadInt( useAngles ); PostEventMS( &EV_PostRestore, 0, starttime, totaltime, accel, decel, useAngles ); - } + } } /* @@ -524,7 +524,7 @@ idMover::FindGuiTargets ================ */ 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 - + ***********************************************************************/ /* @@ -782,7 +782,7 @@ void idMover::BeginMove( idThread *thread ) { /*********************************************************************** 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 ) { - + if ( gameLocal.slow.time < lastTouchTime + 2000 ) { return; } @@ -1764,7 +1764,7 @@ void idElevator::Think( void ) { MoveToPos( fi->pos ); } } - } + } RunPhysics(); Present(); } @@ -2440,7 +2440,7 @@ idMover_Binary::SetMoverState =============== */ void idMover_Binary::SetMoverState( moverState_t newstate, int time ) { - idVec3 delta; + idVec3 delta; moverState = newstate; move_thread = 0; @@ -2520,7 +2520,7 @@ void idMover_Binary::Event_MatchActivateTeam( moverState_t newstate, int time ) ================ 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 ) { @@ -2654,10 +2654,10 @@ void idMover_Binary::Event_Reached_BinaryMover( void ) { // return to pos1 after a delay PostEventSec( &EV_Mover_ReturnToPos1, wait ); } - + // fire targets ActivateTargets( moveMaster->GetActivator() ); - + SetBlocked(false); } else if ( moverState == MOVER_2TO1 ) { // reached pos1 @@ -2911,7 +2911,7 @@ idMover_Binary::FindGuiTargets ================ */ 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 ) { // post it after EV_SpawnBind - PostEventMS( &EV_Door_StartOpen, 1 ); + PostEventMS( &EV_Door_StartOpen, 1 ); } if ( spawnArgs.GetFloat( "time", "1", time ) ) { @@ -3534,7 +3534,7 @@ void idDoor::Use( idEntity *other, idEntity *activator ) { } ActivateTargets( activator ); Use_BinaryMover( activator ); - } + } } /* @@ -3647,7 +3647,7 @@ void idDoor::CalcTriggerBounds( float size, idBounds &bounds ) { // find the bounds of everything on the team bounds = GetPhysics()->GetAbsBounds(); - + fl.takedamage = true; for( other = activateChain; other != NULL; other = other->GetActivateChain() ) { 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 ); if ( sync && sync->IsType( idDoor::Type ) ) { if ( static_cast( sync )->IsOpen() ) { - return; - } - } + return; + } + } } ActivateTargets( activator ); @@ -4246,7 +4246,7 @@ void idPlat::SpawnPlatTrigger( idVec3 &pos ) { tmin[1] = ( bounds[0][1] + bounds[1][1] ) * 0.5f; tmax[1] = tmin[1] + 1; } - + trigger = new idClipModel( idTraceModel( idBounds( tmin, tmax ) ) ); trigger->Link( gameLocal.clip, this, 255, GetPhysics()->GetOrigin(), mat3_identity ); trigger->SetContents( CONTENTS_TRIGGER ); @@ -4486,7 +4486,7 @@ void idRotater::Event_Activate( idEntity *activator ) { spawnArgs.GetFloat( "speed", "100", speed ); spawnArgs.GetBool( "x_axis", "0", x_axis ); spawnArgs.GetBool( "y_axis", "0", y_axis ); - + // set the axis of rotation if ( x_axis ) { delta[2] = speed; diff --git a/d3xp/Mover.h b/d3xp/Mover.h index e480500..784c9eb 100644 --- a/d3xp/Mover.h +++ b/d3xp/Mover.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -157,7 +157,7 @@ private: void VectorForDir( float dir, idVec3 &vec ); idCurve_Spline *GetSpline( idEntity *splineEntity ) const; - void Event_SetCallback( void ); + void Event_SetCallback( void ); void Event_TeamBlocked( idEntity *blockedPart, idEntity *blockingEntity ); void Event_StopMoving( void ); void Event_StopRotating( void ); @@ -489,7 +489,7 @@ public: idMover_Periodic( void ); void Spawn( void ); - + void Save( idSaveGame *savefile ) const; void Restore( idRestoreGame *savefile ); diff --git a/d3xp/MultiplayerGame.cpp b/d3xp/MultiplayerGame.cpp index 2682102..e315a1e 100644 --- a/d3xp/MultiplayerGame.cpp +++ b/d3xp/MultiplayerGame.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -122,10 +122,10 @@ idMultiplayerGame::idMultiplayerGame() { flagMsgOn = true; - player_blue_flag = -1; - player_red_flag = -1; + player_blue_flag = -1; + player_red_flag = -1; #endif - + Clear(); } @@ -181,13 +181,13 @@ void idMultiplayerGame::Reset() { assert( !scoreBoard && !spectateGui && !guiChat && !mainGui && !mapList ); #ifdef CTF - // CTF uses its own scoreboard - if ( IsGametypeFlagBased() ) - scoreBoard = uiManager->FindGui( "guis/ctfscoreboard.gui", true, false, true ); - else + // CTF uses its own scoreboard + if ( IsGametypeFlagBased() ) + scoreBoard = uiManager->FindGui( "guis/ctfscoreboard.gui", true, false, true ); + else #endif scoreBoard = uiManager->FindGui( "guis/scoreboard.gui", true, false, true ); - + spectateGui = uiManager->FindGui( "guis/spectate.gui", true, false, true ); guiChat = uiManager->FindGui( "guis/chat.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 ] ); p->spawnedTime = gameLocal.time; - if ( IsGametypeTeamBased() ) { /* CTF */ + if ( IsGametypeTeamBased() ) { /* CTF */ SwitchToTeam( clientNum, -1, p->team ); } p->tourneyRank = 0; @@ -292,7 +292,7 @@ idMultiplayerGame::ClearGuis */ void idMultiplayerGame::ClearGuis() { int i; - + for ( i = 0; i < MAX_CLIENTS; i++ ) { scoreBoard->SetStateString( va( "player%i",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 ); player->hud->SetStateInt( "rank_self", 0 ); - } - + } + #ifdef CTF - ClearHUDStatus(); -#endif + ClearHUDStatus(); +#endif } #ifdef CTF @@ -327,23 +327,23 @@ idMultiplayerGame::ClearHUDStatus ================ */ 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( gameLocal.entities[ i ] ); if ( !player || !player->hud ) { continue; } - - player->hud->SetStateInt( "red_flagstatus", 0 ); - player->hud->SetStateInt( "blue_flagstatus", 0 ); - if ( IsGametypeFlagBased()) - player->hud->SetStateInt( "self_team", player->team ); - else - player->hud->SetStateInt( "self_team", -1 ); // Invisible. - } - + + player->hud->SetStateInt( "red_flagstatus", 0 ); + player->hud->SetStateInt( "blue_flagstatus", 0 ); + if ( IsGametypeFlagBased()) + player->hud->SetStateInt( "self_team", player->team ); + else + player->hud->SetStateInt( "self_team", -1 ); // Invisible. + } + } /* @@ -358,9 +358,9 @@ Gets number of captures in CTF game. */ int idMultiplayerGame::GetFlagPoints( int team ) { - assert( team <= 1 ); - - return teamPoints[ team ]; + assert( team <= 1 ); + + return teamPoints[ team ]; } #endif @@ -523,7 +523,7 @@ void idMultiplayerGame::UpdateScoreboard( idUserInterface *scoreBoard, idPlayer continue; } } - + iline++; if ( !playerState[ i ].ingame ) { 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 } else { -#endif +#endif livesinfo = va( "%s: %i", common->GetLanguageDict()->GetString( "#str_01982" ), gameLocal.serverInfo.GetInt( "si_fragLimit" ) ); - } + } if ( gameLocal.serverInfo.GetInt( "si_timeLimit" ) > 0 ) { timeinfo = va( "%s: %i", common->GetLanguageDict()->GetString( "#str_01983" ), gameLocal.serverInfo.GetInt( "si_timeLimit" ) ); } else { @@ -610,7 +610,7 @@ void idMultiplayerGame::UpdateScoreboard( idUserInterface *scoreBoard, idPlayer scoreBoard->Redraw( gameLocal.time ); } -#ifdef CTF +#ifdef CTF /* ================ idMultiplayerGame::UpdateCTFScoreboard @@ -622,197 +622,197 @@ void idMultiplayerGame::UpdateCTFScoreboard( idUserInterface *scoreBoard, idPlay idEntity *ent; int value; - // The display lines - int ilines[2] = {0,0}; + // The display lines + int ilines[2] = {0,0}; - // The team strings - char redTeam[] = "red"; - char blueTeam[] = "blue"; - char *curTeam = NULL; + // The team strings + char redTeam[] = "red"; + char blueTeam[] = "blue"; + char *curTeam = NULL; /* Word "frags" */ 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. - if ( this->player_blue_flag == -1 ) + // Blank the flag carrier on the scoreboard. We update these in the loop below if necessary. + if ( this->player_blue_flag == -1 ) scoreBoard->SetStateInt( "player_blue_flag", 0 ); - if ( this->player_red_flag == -1 ) - scoreBoard->SetStateInt( "player_red_flag", 0 ); - + if ( this->player_red_flag == -1 ) + scoreBoard->SetStateInt( "player_red_flag", 0 ); + if ( gameState != WARMUP ) { for ( i = 0; i < numRankedPlayers; i++ ) { - idPlayer *player = rankedPlayers[ i ]; - assert( player ); + idPlayer *player = rankedPlayers[ i ]; + assert( player ); - if ( player->team == 0 ) - curTeam = redTeam; - else - curTeam = blueTeam; - - // Increase the appropriate iline - assert( player->team <= 1 ); - ilines[ player->team ]++; + if ( player->team == 0 ) + curTeam = redTeam; + else + curTeam = blueTeam; + + // Increase the appropriate iline + assert( player->team <= 1 ); + ilines[ player->team ]++; // Update the flag status if ( this->player_blue_flag == player->entityNumber ) 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 ] ); - - /* Player Name */ - scoreBoard->SetStateString( va( "player%i_%s", ilines[ player->team ], curTeam ), player->GetUserInfo()->GetString( "ui_name" ) ); - - if ( IsGametypeTeamBased() ) { - + + /* Player Name */ + scoreBoard->SetStateString( va( "player%i_%s", ilines[ player->team ], curTeam ), player->GetUserInfo()->GetString( "ui_name" ) ); + + if ( IsGametypeTeamBased() ) { + 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 ); - /* Team score and score, blanked */ - scoreBoard->SetStateString( va( "player%i_%s_tscore", ilines[ player->team ], curTeam ), "" ); - //scoreBoard->SetStateString( va( "player%i_%s_score", ilines[ player->team ], curTeam ), "" ); - } + /* Team score and score, blanked */ + scoreBoard->SetStateString( va( "player%i_%s_tscore", 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 ); - 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 */ - scoreBoard->SetStateInt( va( "player%i_%s_ping", ilines[ player->team ], curTeam ), playerState[ rankedPlayers[ i ]->entityNumber ].ping ); + /* 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 ) - curTeam = redTeam; - else - curTeam = blueTeam; - - ilines[ player->team ]++; + 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 ) + 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 ) { - int captureLimit = gameLocal.serverInfo.GetInt( "si_fragLimit" ); - + int captureLimit = gameLocal.serverInfo.GetInt( "si_fragLimit" ); + if ( 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 */ - if ( captureLimit ) - scoreBoard->SetStateString( "gameinfo_red", va( common->GetLanguageDict()->GetString( "#str_11108" ), captureLimit) ); - else - scoreBoard->SetStateString( "gameinfo_red", "" ); + /* Prints "Capture Limit: %i" at the bottom of the scoreboard, left */ + if ( captureLimit ) + scoreBoard->SetStateString( "gameinfo_red", va( common->GetLanguageDict()->GetString( "#str_11108" ), captureLimit) ); + else + scoreBoard->SetStateString( "gameinfo_red", "" ); - /* Prints "Time Limit: %i" at the bottom of the scoreboard, right */ - if ( timeLimit ) - scoreBoard->SetStateString( "gameinfo_blue", va( common->GetLanguageDict()->GetString( "#str_11109" ), timeLimit) ); - else - scoreBoard->SetStateString( "gameinfo_blue", "" ); + /* Prints "Time Limit: %i" at the bottom of the scoreboard, right */ + if ( timeLimit ) + scoreBoard->SetStateString( "gameinfo_blue", va( common->GetLanguageDict()->GetString( "#str_11109" ), timeLimit) ); + else + scoreBoard->SetStateString( "gameinfo_blue", "" ); } - - // Set team scores - scoreBoard->SetStateInt( "red_team_score", GetFlagPoints( 0 ) ); - scoreBoard->SetStateInt( "blue_team_score", GetFlagPoints( 1 ) ); + + // Set team scores + scoreBoard->SetStateInt( "red_team_score", GetFlagPoints( 0 ) ); + scoreBoard->SetStateInt( "blue_team_score", GetFlagPoints( 1 ) ); // Handle flag status changed event scoreBoard->HandleNamedEvent( "BlueFlagStatusChange" ); - scoreBoard->HandleNamedEvent( "RedFlagStatusChange" ); - + scoreBoard->HandleNamedEvent( "RedFlagStatusChange" ); + scoreBoard->Redraw( gameLocal.time ); - - + + } #endif @@ -844,7 +844,7 @@ const char *idMultiplayerGame::GameTime() { if ( ms < 0 ) { ms = 0; } - + s = ms / 1000; m = s / 60; s -= m * 60; @@ -1006,7 +1006,7 @@ idPlayer *idMultiplayerGame::FragLimitHit() { idMultiplayerGame::TimeLimitHit ================ */ -bool idMultiplayerGame::TimeLimitHit() { +bool idMultiplayerGame::TimeLimitHit() { int timeLimit = gameLocal.serverInfo.GetInt( "si_timeLimit" ); if ( timeLimit ) { if ( gameLocal.time >= matchStartedTime + timeLimit * 60000 ) { @@ -1174,7 +1174,7 @@ void idMultiplayerGame::UpdateWinsLosses( idPlayer *winner ) { PlayGlobalSound( player->entityNumber, SND_YOULOSE ); } } else if ( gameLocal.gameType == GAME_TOURNEY ) { - if ( player == winner ) { + if ( player == winner ) { playerState[ i ].wins++; PlayGlobalSound( player->entityNumber, SND_YOUWIN ); } else if ( i == currentTourneyPlayer[ 0 ] || i == currentTourneyPlayer[ 1 ] ) { @@ -1210,7 +1210,7 @@ void idMultiplayerGame::UpdateWinsLosses( idPlayer *winner ) { } } #endif - + if ( winner ) { lastWinner = winner->entityNumber; } else { @@ -1310,7 +1310,7 @@ void idMultiplayerGame::PlayerDeath( idPlayer *dead, idPlayer *killer, bool tele if ( killer ) { if ( gameLocal.gameType == GAME_LASTMAN ) { playerState[ dead->entityNumber ].fragCount--; - + } else if ( IsGametypeTeamBased() ) { /* CTF */ if ( killer == dead || killer->team == dead->team ) { // suicide or teamkill @@ -1357,7 +1357,7 @@ void idMultiplayerGame::PlayerStats( int clientNum, char *data, const int len ) } // find which team this player is on - ent = gameLocal.entities[ clientNum ]; + ent = gameLocal.entities[ clientNum ]; if ( ent && ent->IsType( idPlayer::Type ) ) { team = static_cast< idPlayer * >(ent)->team; } else { @@ -1418,7 +1418,7 @@ void idMultiplayerGame::NewState( gameState_t news, idPlayer *player ) { teamPoints[0] = 0; teamPoints[1] = 0; - ClearHUDStatus(); + ClearHUDStatus(); #endif PlayGlobalSound( -1, SND_FIGHT ); @@ -1628,7 +1628,7 @@ void idMultiplayerGame::CycleTourneyPlayers( ) { if ( lastWinner != -1 ) { idEntity *ent = gameLocal.entities[ lastWinner ]; if ( ent && ent->IsType( idPlayer::Type ) ) { - currentTourneyPlayer[ 0 ] = lastWinner; + currentTourneyPlayer[ 0 ] = lastWinner; } } FillTourneySlots( ); @@ -1669,7 +1669,7 @@ void idMultiplayerGame::ExecuteVote( void ) { if ( needRestart ) { cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "nextMap" ); } -#endif +#endif break; case VOTE_FRAGLIMIT: si_fragLimit.SetInteger( atoi( voteValue ) ); @@ -1900,7 +1900,7 @@ void idMultiplayerGame::Run() { break; } #endif - + player = FragLimitHit(); if ( player ) { // delay between detecting frag limit and ending game. let the death anims play @@ -1944,7 +1944,7 @@ void idMultiplayerGame::Run() { break; } #endif - + player = FragLeader(); if ( player ) { if ( !fragLimitTimeout ) { @@ -2557,10 +2557,10 @@ void idMultiplayerGame::UpdateHud( idPlayer *player, idUserInterface *hud ) { } #ifdef CTF - if ( IsGametypeFlagBased() ) - hud->SetStateInt( "self_team", player->team ); - else - hud->SetStateInt( "self_team", -1 ); /* Disable */ + if ( IsGametypeFlagBased() ) + hud->SetStateInt( "self_team", player->team ); + else + hud->SetStateInt( "self_team", -1 ); /* Disable */ #endif } @@ -2576,14 +2576,14 @@ void idMultiplayerGame::DrawScoreBoard( idPlayer *player ) { scoreBoard->Activate( true, gameLocal.time ); playerState[ player->entityNumber ].scoreBoardUp = true; } - + #ifdef CTF - if ( IsGametypeFlagBased() ) - UpdateCTFScoreboard( scoreBoard, player ); - else + if ( IsGametypeFlagBased() ) + UpdateCTFScoreboard( scoreBoard, player ); + else #endif UpdateScoreboard( scoreBoard, player ); - + } else { if ( playerState[ player->entityNumber ].scoreBoardUp ) { scoreBoard->Activate( false, gameLocal.time ); @@ -2611,11 +2611,11 @@ idMultiplayerGame::AddChatLine void idMultiplayerGame::AddChatLine( const char *fmt, ... ) { idStr temp; va_list argptr; - + va_start( argptr, fmt ); vsprintf( temp, fmt, argptr ); va_end( argptr ); - + gameLocal.Printf( "%s\n", temp.c_str() ); chatHistory[ chatHistoryIndex % NUM_CHAT_NOTIFY ].line = temp; @@ -2704,10 +2704,10 @@ void idMultiplayerGame::WriteToSnapshot( idBitMsgDelta &msg ) const { } #ifdef CTF - msg.WriteShort( teamPoints[0] ); - msg.WriteShort( teamPoints[1] ); - msg.WriteShort( player_red_flag ); - msg.WriteShort( player_blue_flag ); + msg.WriteShort( teamPoints[0] ); + msg.WriteShort( teamPoints[1] ); + msg.WriteShort( player_red_flag ); + msg.WriteShort( player_blue_flag ); #endif } @@ -2742,14 +2742,14 @@ void idMultiplayerGame::ReadFromSnapshot( const idBitMsgDelta &msg ) { playerState[i].ingame = msg.ReadBits( 1 ) != 0; } -#ifdef CTF - teamPoints[0] = msg.ReadShort(); - teamPoints[1] = msg.ReadShort(); +#ifdef CTF + teamPoints[0] = msg.ReadShort(); + teamPoints[1] = msg.ReadShort(); - player_red_flag = msg.ReadShort(); - player_blue_flag = msg.ReadShort(); + player_red_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; case MSG_FLAGTAKEN : - if ( gameLocal.GetLocalPlayer() == NULL ) - break; + if ( gameLocal.GetLocalPlayer() == NULL ) + break; if ( parm2 < 0 || parm2 >= MAX_CLIENTS ) break; @@ -2894,8 +2894,8 @@ void idMultiplayerGame::PrintMessageEvent( int to, msg_evt_t evt, int parm1, int break; case MSG_FLAGDROP : - if ( gameLocal.GetLocalPlayer() == NULL ) - break; + if ( gameLocal.GetLocalPlayer() == NULL ) + break; if ( gameLocal.GetLocalPlayer()->team != parm1 ) { 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; case MSG_FLAGRETURN : - if ( gameLocal.GetLocalPlayer() == NULL ) - break; + if ( gameLocal.GetLocalPlayer() == NULL ) + break; if ( parm2 >= 0 && parm2 < MAX_CLIENTS ) { 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 } } 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; case MSG_FLAGCAPTURE : - if ( gameLocal.GetLocalPlayer() == NULL ) - break; + if ( gameLocal.GetLocalPlayer() == NULL ) + break; if ( parm2 < 0 || parm2 >= MAX_CLIENTS ) 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 } else { 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" ) ); break; @@ -3017,11 +3017,11 @@ void idMultiplayerGame::CheckRespawns( idPlayer *spectator ) { } } else { if ( gameLocal.gameType == GAME_DM || // CTF : 3wave sboily, was DM really included before? - IsGametypeTeamBased() ) - { + IsGametypeTeamBased() ) + { if ( gameState == WARMUP || gameState == COUNTDOWN || gameState == GAMEON ) { p->ServerSpectate( false ); - } + } } else if ( gameLocal.gameType == GAME_TOURNEY ) { if ( i == currentTourneyPlayer[ 0 ] || i == currentTourneyPlayer[ 1 ] ) { if ( gameState == WARMUP || gameState == COUNTDOWN || gameState == GAMEON ) { @@ -3336,7 +3336,7 @@ void idMultiplayerGame::ClientCallVote( vote_flags_t voteIndex, const char *vote idBitMsg outMsg; byte msgBuf[ MAX_GAME_MESSAGE_SIZE ]; - // send + // send outMsg.Init( msgBuf, sizeof( msgBuf ) ); outMsg.WriteByte( GAME_RELIABLE_MESSAGE_CALLVOTE ); outMsg.WriteByte( voteIndex ); @@ -3424,7 +3424,7 @@ void idMultiplayerGame::ServerCallVote( int clientNum, const idBitMsg &msg ) { if ( vote_timeLimit == gameLocal.serverInfo.GetInt( "si_timeLimit" ) ) { gameLocal.ServerSendChatMessage( clientNum, "server", common->GetLanguageDict()->GetString( "#str_04270" ) ); 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() ) { 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" ) ) { gameLocal.ServerSendChatMessage( clientNum, "server", common->GetLanguageDict()->GetString( "#str_04267" ) ); 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() ) { gameLocal.ServerSendChatMessage( clientNum, "server", common->GetLanguageDict()->GetString( "#str_04266" ) ); @@ -3619,7 +3619,7 @@ void idMultiplayerGame::MapRestart( void ) { teamPoints[0] = 0; teamPoints[1] = 0; - ClearHUDStatus(); + ClearHUDStatus(); #endif #ifdef CTF @@ -3627,7 +3627,7 @@ void idMultiplayerGame::MapRestart( void ) { if ( g_balanceTDM.GetBool() && lastGameType != GAME_TDM && lastGameType != GAME_CTF && gameLocal.mpGame.IsGametypeTeamBased() ) { #else if ( g_balanceTDM.GetBool() && lastGameType != GAME_TDM && gameLocal.gameType == GAME_TDM ) { -#endif +#endif for ( clientNum = 0; clientNum < gameLocal.numClients; clientNum++ ) { if ( gameLocal.entities[ clientNum ] && gameLocal.entities[ clientNum ]->IsType( idPlayer::Type ) ) { if ( static_cast< idPlayer* >( gameLocal.entities[ clientNum ] )->BalanceTDM() ) { @@ -3650,7 +3650,7 @@ void idMultiplayerGame::SwitchToTeam( int clientNum, int oldteam, int newteam ) idEntity *ent; int i; - assert( IsGametypeTeamBased() ); /* CTF */ + assert( IsGametypeTeamBased() ); /* CTF */ assert( oldteam != newteam ); assert( !gameLocal.isClient ); @@ -3662,16 +3662,16 @@ void idMultiplayerGame::SwitchToTeam( int clientNum, int oldteam, int newteam ) if ( i == clientNum ) { continue; } - ent = gameLocal.entities[ i ]; + ent = gameLocal.entities[ i ]; if ( ent && ent->IsType( idPlayer::Type ) && static_cast< idPlayer * >(ent)->team == newteam ) { playerState[ clientNum ].teamFragCount = playerState[ i ].teamFragCount; break; - } + } } if ( i == gameLocal.numClients ) { // alone on this team playerState[ clientNum ].teamFragCount = 0; - + } #ifdef CTF 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 ); #ifdef CTF - if ( IsGametypeFlagBased() ) - p->DropFlag(); -#endif + if ( IsGametypeFlagBased() ) + p->DropFlag(); +#endif CheckAbortGame(); } #ifdef CTF @@ -3710,7 +3710,7 @@ void idMultiplayerGame::ProcessChatMessage( int clientNum, bool team, const char const char *prefix = NULL; int send_to; // 0 - all, 1 - specs, 2 - team int i; - idEntity *ent; + idEntity *ent; idPlayer *p; idStr prefixed_name; @@ -3761,7 +3761,7 @@ void idMultiplayerGame::ProcessChatMessage( int clientNum, bool team, const char } } else { for ( i = 0; i < gameLocal.numClients; i++ ) { - ent = gameLocal.entities[ i ]; + ent = gameLocal.entities[ i ]; if ( !ent || !ent->IsType( idPlayer::Type ) ) { continue; } @@ -3801,7 +3801,7 @@ void idMultiplayerGame::Precache( void ) { return; } gameLocal.FindEntityDefDict( "player_doommarine", false );; - + // skins idStr str = cvarSystem->GetCVarString( "mod_validSkins" ); idStr skin; @@ -3881,7 +3881,7 @@ idMultiplayerGame::ToggleTeam void idMultiplayerGame::ToggleTeam( void ) { bool team; assert( gameLocal.isClient || gameLocal.localClientNum == 0 ); - + team = ( idStr::Icmp( cvarSystem->GetCVarString( "ui_team" ), "Red" ) == 0 ); if ( team ) { cvarSystem->SetCVarString( "ui_team", "Blue" ); @@ -4082,7 +4082,7 @@ void idMultiplayerGame::ServerWriteInitialReliableMessages( int clientNum ) { outMsg.WriteShort( startFragLimit ); // send the powerup states and the spectate states for( i = 0; i < gameLocal.numClients; i++ ) { - ent = gameLocal.entities[ i ]; + ent = gameLocal.entities[ i ]; if ( i != clientNum && ent && ent->IsType( idPlayer::Type ) ) { outMsg.WriteShort( i ); outMsg.WriteShort( static_cast< idPlayer * >( ent )->inventory.powerups ); @@ -4144,7 +4144,7 @@ void idMultiplayerGame::ClientReadWarmupTime( const idBitMsg &msg ) { /* #ifdef CTF - Threewave note: + Threewave note: The below IsGametype...() functions were implemented for CTF, but we did not #ifdef CTF them, because doing so would clutter the codebase substantially. Please consider them part of the merged @@ -4158,52 +4158,52 @@ idMultiplayerGame::IsGametypeTeamBased */ bool idMultiplayerGame::IsGametypeTeamBased( void ) /* CTF */ { - switch ( gameLocal.gameType ) - { - case GAME_SP: - case GAME_DM: - case GAME_TOURNEY: - case GAME_LASTMAN: - return false; + switch ( gameLocal.gameType ) + { + case GAME_SP: + case GAME_DM: + case GAME_TOURNEY: + case GAME_LASTMAN: + return false; #ifdef CTF - case GAME_CTF: + case GAME_CTF: #endif - case GAME_TDM: - return true; + case GAME_TDM: + return true; - default: - assert( !"Add support for your new gametype here." ); - } + default: + assert( !"Add support for your new gametype here." ); + } - return false; + return false; } /* ================ -idMultiplayerGame::IsGametypeFlagBased +idMultiplayerGame::IsGametypeFlagBased ================ */ bool idMultiplayerGame::IsGametypeFlagBased( void ) { - switch ( gameLocal.gameType ) - { - case GAME_SP: - case GAME_DM: - case GAME_TOURNEY: - case GAME_LASTMAN: - case GAME_TDM: - return false; + switch ( gameLocal.gameType ) + { + case GAME_SP: + case GAME_DM: + case GAME_TOURNEY: + case GAME_LASTMAN: + case GAME_TDM: + return false; #ifdef CTF - case GAME_CTF: - return true; + case GAME_CTF: + return true; #endif - default: - assert( !"Add support for your new gametype here." ); - } + default: + assert( !"Add support for your new gametype here." ); + } + + return false; - return false; - } #ifdef CTF @@ -4213,8 +4213,8 @@ idMultiplayerGame::GetTeamFlag ================ */ idItemTeam * idMultiplayerGame::GetTeamFlag( int team ) { - assert( team == 0 || team == 1 ); - + assert( team == 0 || team == 1 ); + if ( !IsGametypeFlagBased() || ( team != 0 && team != 1 ) ) /* CTF */ return NULL; @@ -4263,24 +4263,24 @@ idMultiplayerGame::GetFlagStatus ================ */ flagStatus_t idMultiplayerGame::GetFlagStatus( int team ) { - //assert( IsGametypeFlagBased() ); + //assert( IsGametypeFlagBased() ); - idItemTeam *teamFlag = GetTeamFlag( team ); - //assert( teamFlag != NULL ); + idItemTeam *teamFlag = GetTeamFlag( team ); + //assert( teamFlag != NULL ); if ( teamFlag != NULL ) { if ( teamFlag->carried == false && teamFlag->dropped == false ) - return FLAGSTATUS_INBASE; + return FLAGSTATUS_INBASE; - if ( teamFlag->carried == true ) + if ( teamFlag->carried == true ) return FLAGSTATUS_TAKEN; if ( teamFlag->carried == false && teamFlag->dropped == true ) - return FLAGSTATUS_STRAY; + return FLAGSTATUS_STRAY; } - //assert( !"Invalid flag state." ); - return FLAGSTATUS_NONE; + //assert( !"Invalid flag state." ); + return FLAGSTATUS_NONE; } /* @@ -4355,7 +4355,7 @@ void idMultiplayerGame::ReloadScoreboard() { #ifdef _D3XP idStr idMultiplayerGame::GetBestGametype( const char* map, const char* gametype ) { - + int num = declManager->GetNumDecls( DECL_MAPDEF ); int i, j; diff --git a/d3xp/MultiplayerGame.h b/d3xp/MultiplayerGame.h index 33353ee..718b1dd 100644 --- a/d3xp/MultiplayerGame.h +++ b/d3xp/MultiplayerGame.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -51,7 +51,7 @@ typedef enum { GAME_TDM, GAME_LASTMAN, #ifdef CTF - GAME_CTF, + GAME_CTF, GAME_COUNT, #endif } gameType_t; @@ -60,10 +60,10 @@ typedef enum { // Used by the UI typedef enum { - FLAGSTATUS_INBASE = 0, - FLAGSTATUS_TAKEN = 1, - FLAGSTATUS_STRAY = 2, - FLAGSTATUS_NONE = 3 + FLAGSTATUS_INBASE = 0, + FLAGSTATUS_TAKEN = 1, + FLAGSTATUS_STRAY = 2, + FLAGSTATUS_NONE = 3 } flagStatus_t; #endif @@ -119,7 +119,7 @@ typedef enum { SND_TWO, SND_ONE, SND_SUDDENDEATH, -#ifdef CTF +#ifdef CTF SND_FLAG_CAPTURED_YOURS, SND_FLAG_CAPTURED_THEIRS, SND_FLAG_RETURN, @@ -147,7 +147,7 @@ public: // checks rules and updates state of the mp game void Run( void ); - // draws mp hud, scoredboard, etc.. + // draws mp hud, scoredboard, etc.. bool Draw( int clientNum ); // updates a player vote @@ -266,7 +266,7 @@ public: void ProcessVoiceChat( int clientNum, bool team, int index ); void Precache( void ); - + // throttle UI switch rates void ThrottleUserInfo( void ); void ToggleSpectate( void ); @@ -285,17 +285,17 @@ public: void ClientReadWarmupTime( const idBitMsg &msg ); void ServerClientConnect( int clientNum ); -#ifdef CTF - void ClearHUDStatus( void ); - int GetFlagPoints( int team ); // Team points in CTF +#ifdef CTF + void ClearHUDStatus( void ); + int GetFlagPoints( int team ); // Team points in CTF void SetFlagMsg( bool b ); // allow flag event messages to be sent 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_blue_flag; // Ent num of blue 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 -#endif +#endif void PlayerStats( int clientNum, char *data, const int len ); private: @@ -383,15 +383,15 @@ private: // updates the passed gui with current score information void UpdateRankColor( idUserInterface *gui, const char *mask, int i, const idVec3 &vec ); void UpdateScoreboard( idUserInterface *scoreBoard, idPlayer *player ); -#ifdef CTF - void UpdateCTFScoreboard( idUserInterface *scoreBoard, idPlayer *player ); +#ifdef CTF + void UpdateCTFScoreboard( idUserInterface *scoreBoard, idPlayer *player ); #endif #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 ); -#endif - +#endif + void DrawScoreBoard( idPlayer *player ); void UpdateHud( idPlayer *player, idUserInterface *hud ); bool Warmup( void ); @@ -436,18 +436,18 @@ private: #ifdef CTF void FindTeamFlags( void ); #endif - + public: -#ifdef CTF +#ifdef CTF idItemTeam * GetTeamFlag( int team ); - flagStatus_t GetFlagStatus( int team ); + flagStatus_t GetFlagStatus( int team ); void TeamScoreCTF( int team, int delta ); void PlayerScoreCTF( int playerIdx, int delta ); // returns entityNum to team flag carrier, -1 if no flag carrier int GetFlagCarrier( int team ); - void UpdateScoreboardFlagStatus( void ); - + void UpdateScoreboardFlagStatus( void ); + void SetBestGametype( const char * map ); void ReloadScoreboard(); #endif @@ -460,7 +460,7 @@ public: bool IsGametypeFlagBased( void ); bool IsGametypeTeamBased( void ); /* #endif CTF */ - + }; ID_INLINE idMultiplayerGame::gameState_t idMultiplayerGame::GetGameState( void ) const { @@ -480,4 +480,3 @@ ID_INLINE bool idMultiplayerGame::IsInGame( int clientNum ) { } #endif /* !__MULTIPLAYERGAME_H__ */ - diff --git a/d3xp/Player.cpp b/d3xp/Player.cpp index 8d112b6..dd179a7 100644 --- a/d3xp/Player.cpp +++ b/d3xp/Player.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -131,9 +131,9 @@ const int MAX_INVENTORY_ITEMS = 20; #ifdef _D3XP -idVec3 idPlayer::colorBarTable[ 8 ] = { +idVec3 idPlayer::colorBarTable[ 8 ] = { #else -idVec3 idPlayer::colorBarTable[ 5 ] = { +idVec3 idPlayer::colorBarTable[ 5 ] = { #endif idVec3( 0.25f, 0.25f, 0.25f ), 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 memset( clip, -1, sizeof( clip ) ); - + items.DeleteContents( true ); memset(pdasViewed, 0, 4 * sizeof( pdasViewed[0] ) ); pdas.Clear(); @@ -218,7 +218,7 @@ void idInventory::GivePowerUp( idPlayer *player, int powerup, int msec ) { case MEGAHEALTH: def = gameLocal.FindEntityDef( "powerup_megahealth", false ); break; - case ADRENALINE: + case ADRENALINE: def = gameLocal.FindEntityDef( "powerup_adrenaline", false ); break; #ifdef _D3XP @@ -266,7 +266,7 @@ void idInventory::GetPersistantData( idDict &dict ) { // 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 for( i = 0; i < AMMO_NUMTYPES; i++ ) { @@ -502,7 +502,7 @@ void idInventory::Save( idSaveGame *savefile ) const { savefile->WriteInt( pdasViewed[1] ); savefile->WriteInt( pdasViewed[2] ); savefile->WriteInt( pdasViewed[3] ); - + savefile->WriteInt( selPDA ); savefile->WriteInt( selVideo ); savefile->WriteInt( selEMail ); @@ -610,7 +610,7 @@ void idInventory::Restore( idRestoreGame *savefile ) { savefile->ReadInt( pdasViewed[1] ); savefile->ReadInt( pdasViewed[2] ); savefile->ReadInt( pdasViewed[3] ); - + savefile->ReadInt( selPDA ); savefile->ReadInt( selVideo ); savefile->ReadInt( selEMail ); @@ -691,7 +691,7 @@ void idInventory::Restore( idRestoreGame *savefile ) { for(i = 0; i < AMMO_NUMTYPES; i++) { savefile->ReadInt(rechargeAmmo[i].ammo); savefile->ReadInt(rechargeAmmo[i].rechargeTime); - + idStr name; savefile->ReadString(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 ); owner->ServerSendEvent( idPlayer::EVENT_PICKUPNAME, &msg, false, -1 ); } - } + } #endif } @@ -820,7 +820,7 @@ bool idInventory::Give( idPlayer *owner, const idDict &spawnArgs, const char *st #ifdef _D3XP if ( !idStr::Icmp( statname, "ammo_bloodstone" ) ) { - i = AmmoIndexForAmmoClass( statname ); + i = AmmoIndexForAmmoClass( statname ); max = MaxAmmoForAmmoClass( owner, statname ); if(max <= 0) { @@ -848,7 +848,7 @@ bool idInventory::Give( idPlayer *owner, const idDict &spawnArgs, const char *st return false; } amount = atoi( value ); - if ( amount ) { + if ( amount ) { ammo[ i ] += amount; if ( ( max > 0 ) && ( 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) { assert( !gameLocal.isClient ); *idealWeapon = i; - } + } if ( owner->hud && updateHud && lastGiveTime + 1000 < gameLocal.time ) { owner->hud->SetStateInt( "newWeapon", i ); owner->hud->HandleNamedEvent( "newWeapon" ); @@ -1043,7 +1043,7 @@ int idInventory::HasAmmo( const char *weapon_classname, bool includeClip, idPlay #endif } - + #ifdef _D3XP /* =============== @@ -1051,7 +1051,7 @@ idInventory::HasEmptyClipCannotRefill =============== */ bool idInventory::HasEmptyClipCannotRefill(const char *weapon_classname, idPlayer* owner) { - + int clipSize = clip[owner->SlotForWeapon(weapon_classname)]; if(clipSize) { return false; @@ -1257,9 +1257,9 @@ idPlayer::idPlayer() { forcedReady = false; wantSpectate = false; -#ifdef CTF +#ifdef CTF carryingFlag = false; -#endif +#endif lastHitToggle = false; @@ -1349,7 +1349,7 @@ idPlayer::idPlayer() { talkCursor = 0; focusVehicle = NULL; cursor = NULL; - + oldMouseX = 0; oldMouseY = 0; @@ -1678,7 +1678,7 @@ void idPlayer::Init( void ) { // execute the script so the script object's constructor takes effect immediately scriptThread->Execute(); - + forceScoreBoard = false; forcedReady = false; @@ -1759,11 +1759,11 @@ void idPlayer::Spawn( void ) { if ( hud ) { hud->Activate( true, gameLocal.time ); #ifdef CTF - if ( gameLocal.mpGame.IsGametypeFlagBased() ) { - hud->SetStateInt( "red_team_score", gameLocal.mpGame.GetFlagPoints(0) ); - hud->SetStateInt( "blue_team_score", gameLocal.mpGame.GetFlagPoints(1) ); - } -#endif + if ( gameLocal.mpGame.IsGametypeFlagBased() ) { + hud->SetStateInt( "red_team_score", gameLocal.mpGame.GetFlagPoints(0) ); + hud->SetStateInt( "blue_team_score", gameLocal.mpGame.GetFlagPoints(1) ); + } +#endif } // load cursor @@ -1876,7 +1876,7 @@ void idPlayer::Spawn( void ) { } else { hiddenWeapon = false; } - + if ( hud ) { UpdateHudWeapon(); hud->StateChanged( gameLocal.time ); @@ -1986,7 +1986,7 @@ idPlayer::~idPlayer() { enviroSuitLight.GetEntity()->ProcessEvent( &EV_Remove ); } // have to do this here, idMultiplayerGame::DisconnectClient() is too late - if ( gameLocal.isMultiplayer && gameLocal.mpGame.IsGametypeFlagBased() ) { + if ( gameLocal.isMultiplayer && gameLocal.mpGame.IsGametypeFlagBased() ) { ReturnFlag(); } #endif @@ -2040,8 +2040,8 @@ void idPlayer::Save( idSaveGame *savefile ) const { savefile->WriteInt( hudPowerup ); savefile->WriteInt( lastHudPowerup ); savefile->WriteInt( hudPowerupDuration ); - - + + #endif savefile->WriteInt( heartRate ); @@ -2300,8 +2300,8 @@ void idPlayer::Restore( idRestoreGame *savefile ) { savefile->ReadInt( hudPowerup ); savefile->ReadInt( lastHudPowerup ); savefile->ReadInt( hudPowerupDuration ); - - + + #endif savefile->ReadInt( heartRate ); @@ -2540,17 +2540,17 @@ void idPlayer::PrepareForRestart( void ) { ClearPowerUps(); Spectate( true ); forceRespawn = true; - + #ifdef CTF // Confirm reset hud states - DropFlag(); + DropFlag(); if ( hud ) { hud->SetStateInt( "red_flagstatus", 0 ); hud->SetStateInt( "blue_flagstatus", 0 ); } #endif - + // we will be restarting program, clear the client entities from program-related things first ShutdownThreads(); @@ -2565,7 +2565,7 @@ idPlayer::Restart */ void idPlayer::Restart( void ) { idActor::Restart(); - + // client needs to setup the animation script object again if ( gameLocal.isClient ) { Init(); @@ -2604,7 +2604,7 @@ void idPlayer::ServerSpectate( bool spectate ) { } #ifdef CTF // drop the flag if player was carrying it - if ( spectate && gameLocal.isMultiplayer && gameLocal.mpGame.IsGametypeFlagBased() && + if ( spectate && gameLocal.isMultiplayer && gameLocal.mpGame.IsGametypeFlagBased() && carryingFlag ) { DropFlag(); @@ -2649,7 +2649,7 @@ Chooses a spawn location and spawns the player void idPlayer::SpawnFromSpawnSpot( void ) { idVec3 spawn_origin; idAngles spawn_angles; - + SelectInitialSpawnPoint( spawn_origin, spawn_angles ); SpawnToPoint( spawn_origin, spawn_angles ); } @@ -2935,7 +2935,7 @@ bool idPlayer::UserInfoChanged( bool canModify ) { if ( canModify && spec ) { userInfo->Set( "ui_spectate", "Play" ); 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 forceRespawn = true; } @@ -2989,7 +2989,7 @@ void idPlayer::UpdateHudAmmo( idUserInterface *_hud ) { // show infinite ammo _hud->SetStateString( "player_ammo", "" ); _hud->SetStateString( "player_totalammo", "" ); - } else { + } else { // show remaining ammo #ifdef _D3XP _hud->SetStateString( "player_totalammo", va( "%i", ammoamount ) ); @@ -3004,7 +3004,7 @@ void idPlayer::UpdateHudAmmo( idUserInterface *_hud ) { #else _hud->SetStateString( "player_allammo", va( "%i/%i", inclip, ammoamount - inclip ) ); #endif - } + } _hud->SetStateBool( "player_ammo_empty", ( ammoamount == 0 ) ); _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_armor", inventory.armor ); _hud->SetStateInt( "player_hr", heartRate ); - + _hud->SetStateInt( "player_nostamina", ( max_stamina == 0 ) ? 1 : 0 ); _hud->HandleNamedEvent( "updateArmorHealthAir" ); @@ -3080,7 +3080,7 @@ void idPlayer::UpdateHudStats( idUserInterface *_hud ) { healthTake = false; } - if ( inventory.ammoPulse ) { + if ( inventory.ammoPulse ) { _hud->HandleNamedEvent( "ammoPulse" ); inventory.ammoPulse = false; } @@ -3092,28 +3092,28 @@ void idPlayer::UpdateHudStats( idUserInterface *_hud ) { _hud->HandleNamedEvent( "weaponPulse" ); inventory.weaponPulse = false; } - if ( inventory.armorPulse ) { + if ( inventory.armorPulse ) { _hud->HandleNamedEvent( "armorPulse" ); inventory.armorPulse = false; } #ifdef CTF - if ( gameLocal.mpGame.IsGametypeFlagBased() && _hud ) - { + if ( gameLocal.mpGame.IsGametypeFlagBased() && _hud ) + { _hud->SetStateInt( "red_flagstatus", gameLocal.mpGame.GetFlagStatus( 0 ) ); _hud->SetStateInt( "blue_flagstatus", gameLocal.mpGame.GetFlagStatus( 1 ) ); _hud->SetStateInt( "red_team_score", gameLocal.mpGame.GetFlagPoints( 0 ) ); _hud->SetStateInt( "blue_team_score", gameLocal.mpGame.GetFlagPoints( 1 ) ); - _hud->HandleNamedEvent( "RedFlagStatusChange" ); - _hud->HandleNamedEvent( "BlueFlagStatusChange" ); - } - - _hud->HandleNamedEvent( "selfTeam" ); - + _hud->HandleNamedEvent( "RedFlagStatusChange" ); + _hud->HandleNamedEvent( "BlueFlagStatusChange" ); + } + + _hud->HandleNamedEvent( "selfTeam" ); + #endif - + UpdateHudAmmo( _hud ); } @@ -3233,9 +3233,9 @@ void idPlayer::EnterCinematic( void ) { if ( hud ) { hud->HandleNamedEvent( "radioChatterDown" ); } - + physicsObj.SetLinearVelocity( vec3_origin ); - + SetState( "EnterCinematic" ); UpdateScript(); @@ -3430,7 +3430,7 @@ void idPlayer::CacheWeapons( void ) { if ( !inventory.weapons ) { return; } - + for( w = 0; w < MAX_WEAPONS; w++ ) { if ( inventory.weapons & ( 1 << w ) ) { weap = spawnArgs.GetString( va( "def_weapon%d", w ) ); @@ -3503,11 +3503,11 @@ bool idPlayer::Give( const char *statname, const char *value ) { } else { bool ret = inventory.Give( this, spawnArgs, statname, value, &idealWeapon, true ); if(!idStr::Icmp( statname, "ammo_bloodstone" ) ) { - //int i = inventory.AmmoIndexForAmmoClass( statname ); + //int i = inventory.AmmoIndexForAmmoClass( statname ); //int max = inventory.MaxAmmoForAmmoClass( this, statname ); //if(hud && inventory.ammo[ i ] >= max) { if(hud) { - + //Force an update of the bloodstone ammount int 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 ) { - + if ( AI_DEAD ) { return; } @@ -3569,7 +3569,7 @@ bool idPlayer::GiveItem( idItem *item ) { } item->GetAttributes( attr ); - + gave = false; numPickup = inventory.pickupItemNames.Num(); for( i = 0; i < attr.GetNumKeyVals(); i++ ) { @@ -3643,7 +3643,7 @@ float idPlayer::PowerUpModifier( int type ) { } } }*/ -#endif +#endif } return mod; @@ -3696,7 +3696,7 @@ bool idPlayer::GivePowerUp( int powerup, int time ) { StartSoundShader( declManager->FindSound( sound ), SND_CHANNEL_DEMONIC, 0, false, NULL ); } } - + if ( baseSkinName.Length() ) { powerUpSkin = declManager->FindSkin( baseSkinName + "_berserk" ); @@ -3813,7 +3813,7 @@ bool idPlayer::GivePowerUp( int powerup, int time ) { if(gameLocal.isMultiplayer && !gameLocal.isClient) { inventory.AddPickupName("#str_00100631", "", this); } - + if ( baseSkinName.Length() ) { powerUpSkin = declManager->FindSkin( baseSkinName + "_haste" ); } @@ -3877,7 +3877,7 @@ void idPlayer::ClearPowerup( int i ) { break; } case ENVIROSUIT: { - + hudPowerup = -1; // Turn off the envirosuit sound @@ -3978,7 +3978,7 @@ void idPlayer::UpdatePowerUps( void ) { #ifndef ID_DEMO_BUILD 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 - + #ifdef _D3XP if(!PowerUpActive(INVULNERABILITY)) { #endif @@ -4388,13 +4388,13 @@ void idPlayer::NextBestWeapon( void ) { } #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) //We need to skip these weapons because they cannot be used if(inventory.HasEmptyClipCannotRefill(weap, this)) { continue; } -#endif +#endif break; } @@ -4425,13 +4425,13 @@ void idPlayer::NextWeapon( void ) { if ( !inventory.weapons ) { return; } - + w = idealWeapon; while( 1 ) { w++; if ( w >= MAX_WEAPONS ) { w = 0; - } + } weap = spawnArgs.GetString( va( "def_weapon%d", w ) ); if ( !spawnArgs.GetBool( va( "weapon%d_cycle", w ) ) ) { continue; @@ -4542,7 +4542,7 @@ void idPlayer::SelectWeapon( int num, bool force ) { } else { weapon.GetEntity()->RaiseWeapon(); } - } + } weap = spawnArgs.GetString( va( "def_weapon%d", num ) ); if ( !weap[ 0 ] ) { @@ -4578,7 +4578,7 @@ void idPlayer::SelectWeapon( int num, bool force ) { } for(int i = 0; i < weaponToggle->toggleList.Num(); i++) { - + //Is it available if(inventory.weapons & ( 1 << weaponToggle->toggleList[weaponToggleIndex])) { break; @@ -4632,11 +4632,11 @@ void idPlayer::DropWeapon( bool died ) { int inclip, ammoavailable; assert( !gameLocal.isClient ); - + if ( spectating || weaponGone || weapon.GetEntity() == NULL ) { return; } - + if ( ( !died && !weapon.GetEntity()->IsReady() ) || weapon.GetEntity()->IsReloading() ) { return; } @@ -4644,7 +4644,7 @@ void idPlayer::DropWeapon( bool died ) { // inclip is which amount is in clip right now ammoavailable = weapon.GetEntity()->AmmoAvailable(); inclip = weapon.GetEntity()->AmmoInClip(); - + // don't drop a grenade if we have none left if ( !idStr::Icmp( idWeapon::GetAmmoNameForNum( weapon.GetEntity()->GetAmmoType() ), "ammo_grenades" ) && ( ammoavailable - inclip <= 0 ) ) { return; @@ -4811,7 +4811,7 @@ void idPlayer::Weapon_Combat( void ) { SetState( newstate ); UpdateScript(); } - weaponCatchup = false; + weaponCatchup = false; } else { if ( weapon.GetEntity()->IsReady() ) { weapon.GetEntity()->PutAway(); @@ -4834,7 +4834,7 @@ void idPlayer::Weapon_Combat( void ) { } } } 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()->AmmoAvailable() ) { // 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 ) { HideTip(); } - + if ( g_dragEntity.GetBool() ) { StopFiring(); weapon.GetEntity()->LowerWeapon(); @@ -5016,12 +5016,12 @@ void idPlayer::UpdateWeapon( void ) { } else if ( ActiveGui() ) { // gui handling overrides weapon use Weapon_GUI(); - } else if ( focusCharacter && ( focusCharacter->health > 0 ) ) { + } else if ( focusCharacter && ( focusCharacter->health > 0 ) ) { Weapon_NPC(); } else { Weapon_Combat(); } - + if ( hiddenWeapon ) { weapon.GetEntity()->LowerWeapon(); } @@ -5063,7 +5063,7 @@ void idPlayer::SpectateFreeFly( bool force ) { idAngles angle = player->viewAngles; angle[ 2 ] = 0; SetViewAngles( angle ); - } else { + } else { SelectInitialSpawnPoint( spawn_origin, spawn_angles ); spawn_origin[ 2 ] += pm_normalviewheight.GetFloat(); spawn_origin[ 2 ] += SPECTATE_RAISE; @@ -5257,7 +5257,7 @@ bool idPlayer::Collide( const trace_t &collision, const idVec3 &velocity ) { ================ idPlayer::UpdateLocation -Searches nearby locations +Searches nearby locations ================ */ void idPlayer::UpdateLocation( void ) { @@ -5440,7 +5440,7 @@ void idPlayer::UpdateFocus( void ) { } else { ui = focusGUIrenderEntity->gui[ 2 ]; } - + if ( ui == NULL ) { continue; } @@ -5504,7 +5504,7 @@ void idPlayer::UpdateFocus( void ) { // clamp the mouse to the corner ev = sys->GenerateMouseMoveEvent( -2000, -2000 ); command = focusUI->HandleEvent( &ev, gameLocal.time ); - HandleGuiCommands( focusGUIent, command ); + HandleGuiCommands( focusGUIent, command ); // move to an absolute position 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 delta = velocity * viewaxis[0]; viewBobAngles.pitch += delta * pm_runpitch.GetFloat(); - + delta = velocity * viewaxis[1]; 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 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 -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 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; } - lastHeartAdjust = gameLocal.time; + lastHeartAdjust = gameLocal.time; heartInfo.Init( gameLocal.time + delay * 1000, timeInSecs * 1000, heartRate, target ); } @@ -6017,7 +6017,7 @@ void idPlayer::SetCurrentHeartRate( void ) { pct = 0.0f; } pct *= ((float)deathVol - (float)zeroVol); - } + } pct += (float)zeroVol; @@ -6039,7 +6039,7 @@ void idPlayer::SetCurrentHeartRate( void ) { idPlayer::UpdateAir ============== */ -void idPlayer::UpdateAir( void ) { +void idPlayer::UpdateAir( void ) { if ( health <= 0 ) { return; } @@ -6089,7 +6089,7 @@ void idPlayer::UpdateAir( void ) { lastAirDamage = gameLocal.time; } } - + } else { if ( airless ) { StartSound( "snd_recompress", SND_CHANNEL_ANY, SSF_GLOBAL, false, NULL ); @@ -6112,13 +6112,13 @@ void idPlayer::UpdateAir( void ) { } void idPlayer::UpdatePowerupHud() { - + if ( health <= 0 ) { return; } if(lastHudPowerup != hudPowerup) { - + if(hudPowerup == -1) { //The powerup hud should be turned off if ( hud ) { @@ -6138,7 +6138,7 @@ void idPlayer::UpdatePowerupHud() { if(PowerUpActive(hudPowerup)) { int remaining = inventory.powerupEndTime[ hudPowerup ] - gameLocal.time; int filledbar = idMath::ClampInt( 0, hudPowerupDuration, remaining ); - + if ( hud ) { hud->SetStateInt( "player_powerup", 100 * filledbar / hudPowerupDuration ); hud->SetStateInt( "player_poweruptime", remaining / 1000 ); @@ -6708,7 +6708,7 @@ void idPlayer::PerformImpulse( int impulse ) { break; } #endif - } + } } bool idPlayer::HandleESC( void ) { @@ -6796,7 +6796,7 @@ void idPlayer::AdjustSpeed( void ) { speed = pm_walkspeed.GetFloat() * ( 1.0f - bobFrac ) + pm_runspeed.GetFloat() * bobFrac; } else { rate = pm_staminarate.GetFloat(); - + // increase 25% faster when not moving if ( ( usercmd.forwardmove == 0 ) && ( usercmd.rightmove == 0 ) && ( !physicsObj.OnLadder() || ( usercmd.upmove == 0 ) ) ) { rate *= 1.25f; @@ -6904,7 +6904,7 @@ void idPlayer::AdjustBodyAngles( void ) { 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( 2, upBlend ); @@ -6930,7 +6930,7 @@ void idPlayer::InitAASLocation( void ) { num = gameLocal.NumAAS(); aasLocation.SetGranularity( 1 ); - aasLocation.SetNum( num ); + aasLocation.SetNum( num ); for( i = 0; i < aasLocation.Num(); i++ ) { aasLocation[ i ].areaNum = 0; aasLocation[ i ].pos = origin; @@ -6962,7 +6962,7 @@ void idPlayer::SetAASLocation( void ) { if ( !GetFloorPos( 64.0f, origin ) ) { return; } - + for( i = 0; i < aasLocation.Num(); i++ ) { aas = gameLocal.GetAAS( i ); if ( !aas ) { @@ -7114,7 +7114,7 @@ void idPlayer::Move( void ) { if ( AI_JUMP ) { // bounce the view weapon - loggedAccel_t *acc = &loggedAccel[currentLoggedAccel&(NUM_LOGGED_ACCELS-1)]; + loggedAccel_t *acc = &loggedAccel[currentLoggedAccel&(NUM_LOGGED_ACCELS-1)]; currentLoggedAccel++; acc->time = gameLocal.time; acc->dir[2] = 200; @@ -7171,7 +7171,7 @@ void idPlayer::UpdateHud( void ) { inventory.pickupItemNames.RemoveIndex( 0 ); if (inventory.nextItemNum == 1 ) { inventory.onePickupTime = gameLocal.time; - } else if ( inventory.nextItemNum > count ) { //_D3XP + } else if ( inventory.nextItemNum > count ) { //_D3XP inventory.nextItemNum = 1; inventory.nextItemPickup = inventory.onePickupTime + 2000; } else { @@ -7412,7 +7412,7 @@ void idPlayer::Think( void ) { // update GUIs, Items, and character interactions UpdateFocus(); - + UpdateLocation(); // update player script @@ -7420,7 +7420,7 @@ void idPlayer::Think( void ) { // service animations if ( !spectating && !af.IsActive() && !gameLocal.inCinematic ) { - UpdateConditions(); + UpdateConditions(); UpdateAnimState(); CheckBlink(); } @@ -7449,7 +7449,7 @@ void idPlayer::Think( void ) { #ifdef _D3XP UpdatePowerupHud(); #endif - + UpdateHud(); UpdatePowerUps(); @@ -7517,7 +7517,7 @@ void idPlayer::Think( void ) { if ( !g_stopTime.GetBool() ) { UpdateAnimation(); - Present(); + Present(); UpdateDamageEffects(); @@ -7727,7 +7727,7 @@ idPlayer::LookAtKiller */ void idPlayer::LookAtKiller( idEntity *inflictor, idEntity *attacker ) { idVec3 dir; - + if ( attacker && attacker != this ) { dir = attacker->GetPhysics()->GetOrigin() - GetPhysics()->GetOrigin(); } else if ( inflictor && inflictor != this ) { @@ -7826,7 +7826,7 @@ void idPlayer::Killed( idEntity *inflictor, idEntity *attacker, int damage, cons #ifdef CTF // drop the flag if player was carrying it - if ( gameLocal.isMultiplayer && gameLocal.mpGame.IsGametypeFlagBased() && + if ( gameLocal.isMultiplayer && gameLocal.mpGame.IsGametypeFlagBased() && carryingFlag ) { DropFlag(); @@ -7871,7 +7871,7 @@ void idPlayer::GetAIAimTargets( const idVec3 &lastSightPos, idVec3 &headPos, idV idVec3 offset; idMat3 axis; idVec3 origin; - + origin = lastSightPos - physicsObj.GetOrigin(); GetJointWorldTransform( chestJoint, gameLocal.time, offset, axis ); @@ -7893,18 +7893,18 @@ void idPlayer::DamageFeedback( idEntity *victim, idEntity *inflictor, int &damag damage *= PowerUpModifier( BERSERK ); if ( damage && ( victim != this ) && ( victim->IsType( idActor::Type ) || victim->IsType( idDamagable::Type ) ) ) { - idPlayer *victimPlayer = NULL; - - /* No damage feedback sound for hitting friendlies in CTF */ + idPlayer *victimPlayer = NULL; + + /* No damage feedback sound for hitting friendlies in CTF */ if ( victim->IsType( idPlayer::Type ) ) { - victimPlayer = static_cast(victim); + victimPlayer = static_cast(victim); } - if ( gameLocal.mpGame.IsGametypeFlagBased() && victimPlayer && this->team == victimPlayer->team ) { - /* Do nothing ... */ + if ( gameLocal.mpGame.IsGametypeFlagBased() && victimPlayer && this->team == victimPlayer->team ) { + /* Do nothing ... */ } else { - SetLastHitTime( gameLocal.time ); + SetLastHitTime( gameLocal.time ); } } } @@ -7930,7 +7930,7 @@ void idPlayer::CalcDamagePoints( idEntity *inflictor, idEntity *attacker, const if ( !gameLocal.isMultiplayer ) { if ( inflictor != gameLocal.world ) { switch ( g_skill.GetInteger() ) { - case 0: + case 0: damage *= 0.80f; if ( damage < 1 ) { damage = 1; @@ -8037,7 +8037,7 @@ void idPlayer::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &di int armorSave; int knockback; idVec3 damage_from; - idVec3 localDamageVector; + idVec3 localDamageVector; float attackerPushScale; #ifdef _D3XP SetTimeState ts( timeGroup ); @@ -8047,7 +8047,7 @@ void idPlayer::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &di if ( gameLocal.isClient ) { return; } - + if ( !fl.takedamage || noclip || spectating || gameLocal.inCinematic ) { return; } @@ -8082,7 +8082,7 @@ void idPlayer::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &di } CalcDamagePoints( inflictor, attacker, &damageDef->dict, damageScale, location, &damage, &armorSave ); - + // determine knockback damageDef->dict.GetInt( "knockback", "20", knockback ); @@ -8125,7 +8125,7 @@ void idPlayer::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &di } lastArmorPulse = gameLocal.time; } - + if ( damageDef->dict.GetBool( "burn" ) ) { StartSound( "snd_burn", SND_CHANNEL_BODY3, 0, false, NULL ); } 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() ) { - 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 ); } // move the world direction vector to local coordinates damage_from = dir; damage_from.Normalize(); - + viewAxis.ProjectVector( damage_from, localDamageVector ); // add to the damage inflicted on a player this frame @@ -8583,7 +8583,7 @@ idPlayer::GetEyePosition */ idVec3 idPlayer::GetEyePosition( void ) const { idVec3 org; - + // use the smoothed origin if spectating another player in multiplayer if ( gameLocal.isClient && entityNumber != gameLocal.localClientNum ) { org = smoothedOrigin; @@ -8635,7 +8635,7 @@ void idPlayer::CalculateFirstPersonView( void ) { ang = viewBobAngles + playerView.AngleOffset(); ang.yaw += viewAxis[ 0 ].ToYaw(); - + jointHandle_t joint = animator.GetJointHandle( "camera" ); animator.GetJointTransform( joint, gameLocal.time, origin, axis ); firstPersonViewOrigin = ( origin + modelOffset ) * ( viewAxis * physicsObj.GetGravityAxis() ) + physicsObj.GetOrigin() + viewBob; @@ -8725,7 +8725,7 @@ void idPlayer::CalculateRenderView( void ) { // allow the right player view weapons renderView->viewID = entityNumber + 1; } - + // field of view 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; PostEventSec( &EV_Player_StopFxFov, duration ); } /* ================== -idPlayer::Event_EnableWeapon +idPlayer::Event_EnableWeapon ================== */ void idPlayer::Event_EnableWeapon( void ) { @@ -8998,7 +8998,7 @@ void idPlayer::Event_DisableWeapon( void ) { #ifdef _D3XP /* ================== -idPlayer::Event_GiveInventoryItem +idPlayer::Event_GiveInventoryItem ================== */ 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 ) { @@ -9016,7 +9016,7 @@ void idPlayer::Event_RemoveInventoryItem( const char* name ) { /* ================== -idPlayer::Event_GetIdealWeapon +idPlayer::Event_GetIdealWeapon ================== */ 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 ) { @@ -9045,7 +9045,7 @@ void idPlayer::Event_SetPowerupTime( int powerup, int time ) { /* ================== -idPlayer::Event_IsPowerupActive +idPlayer::Event_IsPowerupActive ================== */ void idPlayer::Event_IsPowerupActive( int powerup ) { @@ -9331,14 +9331,14 @@ void idPlayer::ClientPredictionThink( void ) { if ( !isLagged ) { // don't allow client to move when lagged Move(); - } + } // update GUIs, Items, and character interactions UpdateFocus(); // service animations if ( !spectating && !af.IsActive() ) { - UpdateConditions(); + UpdateConditions(); UpdateAnimState(); CheckBlink(); } @@ -9543,8 +9543,8 @@ void idPlayer::WriteToSnapshot( idBitMsgDelta &msg ) const { msg.WriteBits( isLagged, 1 ); msg.WriteBits( isChatting, 1 ); #ifdef CTF - /* Needed for the scoreboard */ - msg.WriteBits( carryingFlag, 1 ); + /* Needed for the scoreboard */ + msg.WriteBits( carryingFlag, 1 ); #endif #ifdef _D3XP msg.WriteBits( enviroSuitLight.GetSpawnId(), 32 ); @@ -9788,7 +9788,7 @@ bool idPlayer::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { GivePowerUp( powerup, 0 ); } else { ClearPowerup( powerup ); - } + } return true; } #ifdef _D3XP @@ -9841,7 +9841,7 @@ idPlayer::Show */ void idPlayer::Show( void ) { idWeapon *weap; - + idActor::Show(); weap = weapon.GetEntity(); if ( weap ) { @@ -9882,7 +9882,7 @@ void idPlayer::ShowTip( const char *title, const char *tip, bool autoHide ) { } hud->SetStateString( "tip", tip ); hud->SetStateString( "tiptitle", title ); - hud->HandleNamedEvent( "tipWindowUp" ); + hud->HandleNamedEvent( "tipWindowUp" ); if ( autoHide ) { PostEventSec( &EV_Player_HideTip, 5.0f ); } @@ -9895,7 +9895,7 @@ idPlayer::HideTip =============== */ void idPlayer::HideTip( void ) { - hud->HandleNamedEvent( "tipWindowDown" ); + hud->HandleNamedEvent( "tipWindowDown" ); tipUp = false; } @@ -10040,11 +10040,11 @@ void idPlayer::DrawPlayerIcons( void ) { } #ifdef CTF - // Never draw icons for hidden players. - if ( this->IsHidden() ) - return; -#endif - + // Never draw icons for hidden players. + if ( this->IsHidden() ) + return; +#endif + playerIcon.Draw( this, headJoint ); } @@ -10085,7 +10085,7 @@ void idPlayer::DropFlag( void ) { idEntity * entity = gameLocal.mpGame.GetTeamFlag( 1 - this->latchedTeam ); if ( entity ) { idItemTeam * item = static_cast(entity); - + if ( item->carried && !item->dropped ) { item->Drop( health <= 0 ); carryingFlag = false; diff --git a/d3xp/Player.h b/d3xp/Player.h index c192876..ec589ad 100644 --- a/d3xp/Player.h +++ b/d3xp/Player.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms =============================================================================== Player entity. - + =============================================================================== */ @@ -59,7 +59,7 @@ const int MAX_WEAPONS = 16; #endif 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 BASE_HEARTRATE = 70; // default const int ZEROSTAMINA_HEARTRATE = 115; // no stamina @@ -91,7 +91,7 @@ struct idLevelTriggerInfo { // powerups - the "type" in item .def must match enum { - BERSERK = 0, + BERSERK = 0, INVISIBILITY, MEGAHEALTH, ADRENALINE, @@ -349,10 +349,10 @@ public: int tourneyLine; // client side - our spot in the wait line. 0 means no info. int spawnedTime; // when client first enters the game -#ifdef CTF +#ifdef CTF bool carryingFlag; // is the player carrying the flag? -#endif - +#endif + idEntityPtr 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 bool lastManOver; // can't respawn in last man anymore (srv only) @@ -469,7 +469,7 @@ public: bool GiveItem( idItem *item ); void GiveItem( const char *name ); void GiveHealthPool( float amt ); - + bool GiveInventoryItem( idDict *item ); void RemoveInventoryItem( idDict *item ); bool GiveInventoryItem( const char *name ); @@ -680,7 +680,7 @@ private: int focusTime; idAFEntity_Vehicle * focusVehicle; idUserInterface * cursor; - + // full screen guis track mouse movements directly int oldMouseX; int oldMouseY; @@ -837,4 +837,3 @@ ID_INLINE void idPlayer::SetSelfSmooth( bool b ) { } #endif /* !__GAME_PLAYER_H__ */ - diff --git a/d3xp/PlayerIcon.cpp b/d3xp/PlayerIcon.cpp index 28ef770..cb9828d 100644 --- a/d3xp/PlayerIcon.cpp +++ b/d3xp/PlayerIcon.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -195,4 +195,3 @@ void idPlayerIcon::UpdateIcon( idPlayer *player, const idVec3 &origin, const idM renderEnt.axis = axis; gameRenderWorld->UpdateEntityDef( iconHandle, &renderEnt ); } - diff --git a/d3xp/PlayerIcon.h b/d3xp/PlayerIcon.h index a602630..cbf582d 100644 --- a/d3xp/PlayerIcon.h +++ b/d3xp/PlayerIcon.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -41,7 +41,7 @@ typedef enum { class idPlayerIcon { public: - + public: idPlayerIcon(); ~idPlayerIcon(); @@ -64,4 +64,3 @@ public: #endif /* !_PLAYERICON_H_ */ - diff --git a/d3xp/PlayerView.cpp b/d3xp/PlayerView.cpp index 922ff0b..5cb0514 100644 --- a/d3xp/PlayerView.cpp +++ b/d3xp/PlayerView.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -168,7 +168,7 @@ void idPlayerView::Restore( idRestoreGame *savefile ) { savefile->ReadInt( dvFinishTime ); savefile->ReadMaterial( dvMaterial ); savefile->ReadInt( kickFinishTime ); - savefile->ReadAngles( kickAngles ); + savefile->ReadAngles( kickAngles ); savefile->ReadBool( bfgVision ); savefile->ReadMaterial( tunnelMaterial ); @@ -310,7 +310,7 @@ void idPlayerView::DamageImpulse( idVec3 localKickDir, const idDict *damageDef ) blob->x += ( gameLocal.random.RandomInt()&63 ) - 32; blob->y = damageDef->GetFloat( "blob_y" ); blob->y += ( gameLocal.random.RandomInt()&63 ) - 32; - + float scale = ( 256 + ( ( gameLocal.random.RandomInt()&63 ) - 32 ) ) / 256.0f; blob->w = damageDef->GetFloat( "blob_width" ) * 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; int finish = gameLocal.slow.time + g_kickTime.GetFloat() * recoilTime; kickFinishTime = finish; - } + } } @@ -429,7 +429,7 @@ idMat3 idPlayerView::ShakeAxis() const { =================== idPlayerView::AngleOffset - kickVector, a world space direction that the attack should + kickVector, a world space direction that the attack should =================== */ idAngles idPlayerView::AngleOffset() const { @@ -530,7 +530,7 @@ void idPlayerView::SingleView( idUserInterface *hud, const renderView_t *view ) if ( blob->finishTime <= gameLocal.slow.time ) { continue; } - + blob->y += blob->driftAmount; 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->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 @@ -690,7 +690,7 @@ void idPlayerView::RenderPlayerView( idUserInterface *hud ) { if ( net_clientLagOMeter.GetBool() && lagoMaterial && gameLocal.isClient ) { 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 ); - } + } } #ifdef _D3XP @@ -1263,7 +1263,7 @@ void FullscreenFX_Warp::HighQuality() { p.center.y = center.y; p.center.z = p.center.x / 640.f; p.center.w = 1 - ( p.center.y / 480.f ); - + // draw it DrawWarp( p, interp ); } @@ -1690,7 +1690,7 @@ void FullscreenFXManager::Initialize( idPlayerView *pv ) { renderSystem->CaptureRenderToImage( "_accum" ); renderSystem->UnCrop(); - renderSystem->CropRenderSize( 512, 256, true ); + renderSystem->CropRenderSize( 512, 256, true ); renderSystem->CaptureRenderToImage( "_scratch" ); renderSystem->UnCrop(); diff --git a/d3xp/PlayerView.h b/d3xp/PlayerView.h index 89df101..4971d79 100644 --- a/d3xp/PlayerView.h +++ b/d3xp/PlayerView.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -393,9 +393,9 @@ public: const idMaterial * dvMaterial; // material to take the double vision screen shot 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 * armorMaterial; // armor damage view effect diff --git a/d3xp/Projectile.cpp b/d3xp/Projectile.cpp index e4bc3ea..5659a17 100644 --- a/d3xp/Projectile.cpp +++ b/d3xp/Projectile.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -25,7 +25,7 @@ If you have questions concerning this license or the applicable additional terms =========================================================================== */ - + #include "../idlib/precompiled.h" #pragma hdrstop @@ -335,7 +335,7 @@ void idProjectile::Launch( const idVec3 &start, const idVec3 &dir, const idVec3 endthrust = spawnArgs.GetFloat( "thrust_end" ); spawnArgs.GetVector( "velocity", "0 0 0", velocity ); - + speed = velocity.Length() * launchPower; damagePower = dmgPower; @@ -510,11 +510,11 @@ void idProjectile::Think( void ) { if ( gameLocal.time < lightEndTime ) { float frac = ( float )( gameLocal.time - lightStartTime ) / ( float )( lightEndTime - lightStartTime ); color.Lerp( lightColor, color, frac ); - } + } renderLight.shaderParms[SHADERPARM_RED] = color.x; renderLight.shaderParms[SHADERPARM_GREEN] = color.y; renderLight.shaderParms[SHADERPARM_BLUE] = color.z; - } + } gameRenderWorld->UpdateLightDef( lightDefHandle, &renderLight ); } else { lightDefHandle = gameRenderWorld->AddLightDef( &renderLight ); @@ -897,9 +897,9 @@ void idProjectile::Explode( const trace_t &collision, idEntity *ignore ) { if ( fxname && *fxname ) { SetModel( fxname ); - renderEntity.shaderParms[SHADERPARM_RED] = - renderEntity.shaderParms[SHADERPARM_GREEN] = - renderEntity.shaderParms[SHADERPARM_BLUE] = + renderEntity.shaderParms[SHADERPARM_RED] = + renderEntity.shaderParms[SHADERPARM_GREEN] = + renderEntity.shaderParms[SHADERPARM_BLUE] = renderEntity.shaderParms[SHADERPARM_ALPHA] = 1.0f; renderEntity.shaderParms[SHADERPARM_TIMEOFFSET] = -MS2SEC( gameLocal.time ); renderEntity.shaderParms[SHADERPARM_DIVERSITY] = gameLocal.random.CRandomFloat(); @@ -910,13 +910,13 @@ void idProjectile::Explode( const trace_t &collision, idEntity *ignore ) { // explosion light light_shader = spawnArgs.GetString( "mtr_explode_light_shader" ); -#ifdef CTF - if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") ) - { - light_shader = "lights/midnight_grenade"; - } -#endif - +#ifdef CTF + if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") ) + { + light_shader = "lights/midnight_grenade"; + } +#endif + if ( *light_shader ) { renderLight.shader = declManager->FindMaterial( light_shader, false ); renderLight.pointLight = true; @@ -925,16 +925,16 @@ void idProjectile::Explode( const trace_t &collision, idEntity *ignore ) { renderLight.lightRadius[2] = spawnArgs.GetFloat( "explode_light_radius" ); #ifdef CTF - // Midnight ctf - if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") ) - { - renderLight.lightRadius[0] = - renderLight.lightRadius[1] = - renderLight.lightRadius[2] = spawnArgs.GetFloat( "explode_light_radius" ) * 2; - } - -#endif - + // Midnight ctf + if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") ) + { + renderLight.lightRadius[0] = + renderLight.lightRadius[1] = + renderLight.lightRadius[2] = spawnArgs.GetFloat( "explode_light_radius" ) * 2; + } + +#endif + spawnArgs.GetVector( "explode_light_color", "1 1 1", lightColor ); renderLight.shaderParms[SHADERPARM_RED] = lightColor.x; 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 ); #ifdef CTF - // Midnight ctf - if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") ) - { - light_fadetime = 3.0f; - } - else -#endif + // Midnight ctf + if ( gameLocal.mpGame.IsGametypeFlagBased() && gameLocal.serverInfo.GetBool("si_midnight") ) + { + light_fadetime = 3.0f; + } + else +#endif light_fadetime = spawnArgs.GetFloat( "explode_light_fadetime", "0.5" ); lightStartTime = gameLocal.time; lightEndTime = gameLocal.time + SEC2MS( light_fadetime ); @@ -1099,7 +1099,7 @@ void idProjectile::Event_Touch( idEntity *other, trace_t *trace ) { return; } -#ifdef CTF +#ifdef CTF // Projectiles do not collide with flags if ( other->IsType( idItemTeam::Type ) ) return; @@ -1141,7 +1141,7 @@ void idProjectile::CatchProjectile( idEntity* o, const char* reflectName ) { const idDict *damageDef = gameLocal.FindEntityDefDict( s, false ); 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[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; if ( state == LAUNCHED && !unGuided ) { - + GetSeekPos( seekPos ); 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() ); if ( tr.fraction < 1.0f ) { enemy = gameLocal.GetTraceEntity( tr ); - } + } // ignore actors on the player's team if ( enemy.GetEntity() == NULL || !enemy.GetEntity()->IsType( idActor::Type ) || ( static_cast( enemy.GetEntity() )->team == player->team ) ) { 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*/ ) ) { smokeKillTime = gameLocal.time; } - } + } } else { if ( accelTime && gameLocal.time < launchTime + accelTime * 1000 ) { pct = ( gameLocal.time - launchTime ) / ( accelTime * 1000 ); speed = ( startingVelocity + ( startingVelocity + endingVelocity ) * pct ).Length(); - } - } + } + } idGuidedProjectile::Think(); GetSeekPos( seekPos ); if ( ( seekPos - physicsObj.GetOrigin() ).Length() < 32.0f ) { @@ -1789,7 +1789,7 @@ void idSoulCubeMissile::GetSeekPos( idVec3 &out ) { if ( destOrg != vec3_zero ) { out = destOrg; return; - } + } idGuidedProjectile::GetSeekPos( out ); } @@ -1835,7 +1835,7 @@ void idSoulCubeMissile::Launch( const idVec3 &start, const idVec3 &dir, const id launchTime = gameLocal.time; killPhase = false; UpdateVisuals(); - + ownerEnt = owner.GetEntity(); if ( ownerEnt && ownerEnt->IsType( idPlayer::Type ) ) { static_cast( 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_Y ] = org.y; beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BEAM_END_Z ] = org.z; - beamTargets[i].renderEntity.shaderParms[ SHADERPARM_RED ] = - beamTargets[i].renderEntity.shaderParms[ SHADERPARM_GREEN ] = - beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BLUE ] = + beamTargets[i].renderEntity.shaderParms[ SHADERPARM_RED ] = + beamTargets[i].renderEntity.shaderParms[ SHADERPARM_GREEN ] = + beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BLUE ] = beamTargets[i].renderEntity.shaderParms[ SHADERPARM_ALPHA ] = 1.0f; if ( gameLocal.time > nextDamageTime ) { bool bfgVision = true; @@ -2032,9 +2032,9 @@ void idBFGProjectile::Think( void ) { org.Normalize(); beamTargets[i].target.GetEntity()->Damage( this, owner.GetEntity(), org, damageFreq, ( damagePower ) ? damagePower : 1.0f, INVALID_JOINT ); } else { - beamTargets[i].renderEntity.shaderParms[ SHADERPARM_RED ] = - beamTargets[i].renderEntity.shaderParms[ SHADERPARM_GREEN ] = - beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BLUE ] = + beamTargets[i].renderEntity.shaderParms[ SHADERPARM_RED ] = + beamTargets[i].renderEntity.shaderParms[ SHADERPARM_GREEN ] = + beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BLUE ] = beamTargets[i].renderEntity.shaderParms[ SHADERPARM_ALPHA ] = 0.0f; 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 ); // 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 // but saves on the traces making sure they are visible // damage is not applied until the projectile explodes @@ -2416,7 +2416,7 @@ void idDebris::Launch( void ) { spawnArgs.GetVector( "velocity", "0 0 0", velocity ); spawnArgs.GetAngles( "angular_velocity", "0 0 0", angular_velocity ); - + linear_friction = spawnArgs.GetFloat( "linear_friction" ); angular_friction = spawnArgs.GetFloat( "angular_friction" ); contact_friction = spawnArgs.GetFloat( "contact_friction" ); diff --git a/d3xp/Projectile.h b/d3xp/Projectile.h index 2db3f0c..1b0784f 100644 --- a/d3xp/Projectile.h +++ b/d3xp/Projectile.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms =============================================================================== idProjectile - + =============================================================================== */ @@ -125,7 +125,7 @@ protected: FIZZLED = 3, EXPLODED = 4 } projectileState_t; - + projectileState_t state; private: @@ -243,7 +243,7 @@ private: =============================================================================== idDebris - + =============================================================================== */ diff --git a/d3xp/Pvs.cpp b/d3xp/Pvs.cpp index 12b0e5f..9564982 100644 --- a/d3xp/Pvs.cpp +++ b/d3xp/Pvs.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -258,7 +258,7 @@ void idPVS::FrontPortalPVS( void ) const { } for ( p = 0; p < area->numPortals; p++ ) { - + p2 = area->portals[p]; // 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; - // check all combinations + // check all combinations for ( i = 0; i < source.GetNumPoints(); i++ ) { l = (i + 1) % source.GetNumPoints(); @@ -623,7 +623,7 @@ void idPVS::CreatePassages( void ) const { } p = &pvsPortals[(byteNum << 3) + bitNum]; - + if ( p->areaNum == source->areaNum ) { continue; } diff --git a/d3xp/Pvs.h b/d3xp/Pvs.h index 37ea23c..17a5f4a 100644 --- a/d3xp/Pvs.h +++ b/d3xp/Pvs.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/SecurityCamera.cpp b/d3xp/SecurityCamera.cpp index dfd8bd0..44df1aa 100644 --- a/d3xp/SecurityCamera.cpp +++ b/d3xp/SecurityCamera.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -42,7 +42,7 @@ If you have questions concerning this license or the applicable additional terms /*********************************************************************** idSecurityCamera - + ***********************************************************************/ const idEventDef EV_SecurityCam_ReverseSweep( "" ); @@ -71,7 +71,7 @@ void idSecurityCamera::Save( idSaveGame *savefile ) const { savefile->WriteBool( flipAxis ); savefile->WriteFloat( scanDist ); savefile->WriteFloat( scanFov ); - + savefile->WriteFloat( sweepStart ); savefile->WriteFloat( sweepEnd ); savefile->WriteBool( negativeSweep ); @@ -81,7 +81,7 @@ void idSecurityCamera::Save( idSaveGame *savefile ) const { savefile->WriteFloat( scanFovCos ); savefile->WriteVec3( viewOffset ); - + savefile->WriteInt( pvsArea ); savefile->WriteStaticObject( physicsObj ); savefile->WriteTraceModel( trm ); @@ -99,7 +99,7 @@ void idSecurityCamera::Restore( idRestoreGame *savefile ) { savefile->ReadBool( flipAxis ); savefile->ReadFloat( scanDist ); savefile->ReadFloat( scanFov ); - + savefile->ReadFloat( sweepStart ); savefile->ReadFloat( sweepEnd ); savefile->ReadBool( negativeSweep ); @@ -109,7 +109,7 @@ void idSecurityCamera::Restore( idRestoreGame *savefile ) { savefile->ReadFloat( scanFovCos ); savefile->ReadVec3( viewOffset ); - + savefile->ReadInt( pvsArea ); savefile->ReadStaticObject( physicsObj ); savefile->ReadTraceModel( trm ); @@ -190,24 +190,24 @@ void idSecurityCamera::Event_AddLight( void ) { float radius; idVec3 lightOffset; idLight *spotLight; - + dir = GetAxis(); dir.NormalVectors( right, up ); target = GetPhysics()->GetOrigin() + dir * scanDist; - + radius = tan( scanFov * idMath::PI / 360.0f ); up = dir + up * radius; up.Normalize(); up = GetPhysics()->GetOrigin() + up * scanDist; up -= target; - + right = dir + right * radius; right.Normalize(); right = GetPhysics()->GetOrigin() + right * scanDist; right -= target; spawnArgs.GetVector( "lightOffset", "0 0 0", lightOffset ); - + args.Set( "origin", ( GetPhysics()->GetOrigin() + lightOffset ).ToString() ); args.Set( "light_target", target.ToString() ); args.Set( "light_right", right.ToString() ); @@ -393,7 +393,7 @@ void idSecurityCamera::Think( void ) { SetAlertMode(LOSINGINTEREST); CancelEvents( &EV_SecurityCam_Alert ); - + sightResume = spawnArgs.GetFloat( "sightResume", "1.5" ); PostEventSec( &EV_SecurityCam_ContinueSweep, sightResume ); } @@ -446,7 +446,7 @@ void idSecurityCamera::StartSweep( void ) { sweepStart = gameLocal.time; speed = SEC2MS( SweepSpeed() ); sweepEnd = sweepStart + speed; - PostEventMS( &EV_SecurityCam_Pause, speed ); + PostEventMS( &EV_SecurityCam_Pause, speed ); StartSound( "snd_moving", SND_CHANNEL_BODY, 0, false, NULL ); } @@ -463,7 +463,7 @@ void idSecurityCamera::Event_ContinueSweep( void ) { sweepStart = f; speed = MS2SEC( SweepSpeed() ); 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 ); SetAlertMode(SCANNING); sweeping = true; @@ -510,7 +510,7 @@ void idSecurityCamera::Event_Pause( void ) { sweeping = false; StopSound( SND_CHANNEL_ANY, false ); StartSound( "snd_stop", SND_CHANNEL_BODY, 0, false, NULL ); - PostEventSec( &EV_SecurityCam_ReverseSweep, sweepWait ); + PostEventSec( &EV_SecurityCam_ReverseSweep, sweepWait ); } /* diff --git a/d3xp/SecurityCamera.h b/d3xp/SecurityCamera.h index cf9ab3e..02600df 100644 --- a/d3xp/SecurityCamera.h +++ b/d3xp/SecurityCamera.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -65,7 +65,7 @@ private: bool flipAxis; float scanDist; float scanFov; - + float sweepStart; float sweepEnd; bool negativeSweep; @@ -75,7 +75,7 @@ private: float scanFovCos; idVec3 viewOffset; - + int pvsArea; idPhysics_RigidBody physicsObj; idTraceModel trm; diff --git a/d3xp/SmokeParticles.cpp b/d3xp/SmokeParticles.cpp index 86d2d41..66ee854 100644 --- a/d3xp/SmokeParticles.cpp +++ b/d3xp/SmokeParticles.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -216,7 +216,7 @@ bool idSmokeParticles::EmitSmoke( const idDeclParticle *smoke, const int systemS } // 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 deltaMsec = gameLocal.time - systemStartTime; diff --git a/d3xp/SmokeParticles.h b/d3xp/SmokeParticles.h index ec585c0..f0b4b45 100644 --- a/d3xp/SmokeParticles.h +++ b/d3xp/SmokeParticles.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/Sound.cpp b/d3xp/Sound.cpp index c1d8044..949324d 100644 --- a/d3xp/Sound.cpp +++ b/d3xp/Sound.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -302,4 +302,3 @@ idSound::ShowEditingDialog void idSound::ShowEditingDialog( void ) { common->InitTool( EDITOR_SOUND, &spawnArgs ); } - diff --git a/d3xp/Sound.h b/d3xp/Sound.h index 1bc291b..55d8497 100644 --- a/d3xp/Sound.h +++ b/d3xp/Sound.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/Target.cpp b/d3xp/Target.cpp index 8210201..1ba4461 100644 --- a/d3xp/Target.cpp +++ b/d3xp/Target.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -602,7 +602,7 @@ idTarget_Give::Event_Activate ================ */ void idTarget_Give::Event_Activate( idEntity *activator ) { - + if ( spawnArgs.GetBool( "development" ) && developer.GetInteger() == 0 ) { return; } @@ -913,7 +913,7 @@ idTarget_SetInfluence::Event_ClearFlash */ void idTarget_SetInfluence::Event_ClearFlash( float flash ) { 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 ) { light->SetShader( parm ); } - + color = light->spawnArgs.GetVector( "_color" ); color = light->spawnArgs.GetVector( "color_demonic", color.ToString() ); 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" ) ) { parm = spawnArgs.GetString( "mtrVision" ); skin = spawnArgs.GetString( "skinVision" ); - player->SetInfluenceView( parm, skin, spawnArgs.GetInt( "visionRadius" ), this ); + player->SetInfluenceView( parm, skin, spawnArgs.GetInt( "visionRadius" ), this ); } parm = spawnArgs.GetString( "mtrWorld" ); @@ -1798,4 +1798,3 @@ void idTarget_FadeSoundClass::Event_RestoreVolume() { // restore volume gameSoundWorld->FadeSoundClasses( 0, fadeDB, fadeTime ); } - diff --git a/d3xp/Target.h b/d3xp/Target.h index 88adc65..96ef1c8 100644 --- a/d3xp/Target.h +++ b/d3xp/Target.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/Trigger.cpp b/d3xp/Trigger.cpp index a954b14..e15c021 100644 --- a/d3xp/Trigger.cpp +++ b/d3xp/Trigger.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -36,7 +36,7 @@ If you have questions concerning this license or the applicable additional terms =============================================================================== idTrigger - + =============================================================================== */ @@ -239,7 +239,7 @@ void idTrigger::Spawn( void ) { =============================================================================== idTrigger_Multi - + =============================================================================== */ @@ -325,7 +325,7 @@ void idTrigger_Multi::Spawn( void ) { spawnArgs.GetFloat( "random", "0", random ); spawnArgs.GetFloat( "delay", "0", delay ); spawnArgs.GetFloat( "random_delay", "0", random_delay ); - + if ( random && ( random >= wait ) && ( wait >= 0 ) ) { random = wait - 1; 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 - + =============================================================================== */ @@ -579,7 +579,7 @@ void idTrigger_EntityName::Spawn( void ) { spawnArgs.GetFloat( "random", "0", random ); spawnArgs.GetFloat( "delay", "0", delay ); spawnArgs.GetFloat( "random_delay", "0", random_delay ); - + if ( random && ( random >= wait ) && ( wait >= 0 ) ) { random = wait - 1; 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 - + =============================================================================== */ @@ -846,7 +846,7 @@ void idTrigger_Timer::Event_Use( idEntity *activator ) { =============================================================================== idTrigger_Count - + =============================================================================== */ @@ -936,7 +936,7 @@ void idTrigger_Count::Event_TriggerAction( idEntity *activator ) { =============================================================================== idTrigger_Hurt - + =============================================================================== */ @@ -1076,7 +1076,7 @@ void idTrigger_Fade::Event_Trigger( idEntity *activator ) { =============================================================================== idTrigger_Touch - + =============================================================================== */ @@ -1158,7 +1158,7 @@ void idTrigger_Touch::TouchEntities( void ) { if ( !entity ) { continue; } - + if ( !gameLocal.clip.ContentsModel( cm->GetOrigin(), cm, cm->GetAxis(), -1, clipModel->Handle(), clipModel->GetOrigin(), clipModel->GetAxis() ) ) { continue; diff --git a/d3xp/Trigger.h b/d3xp/Trigger.h index bff0144..fe6d742 100644 --- a/d3xp/Trigger.h +++ b/d3xp/Trigger.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -86,11 +86,11 @@ public: void Save( idSaveGame *savefile ) const; void Restore( idRestoreGame *savefile ); -#ifdef CTF +#ifdef CTF protected: #else private: -#endif +#endif float wait; float random; diff --git a/d3xp/Weapon.cpp b/d3xp/Weapon.cpp index 597c50c..1db5dc0 100644 --- a/d3xp/Weapon.cpp +++ b/d3xp/Weapon.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -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++) { WeaponLight_t newLight; memset(&newLight, 0, sizeof(newLight)); - + idStr name; savefile->ReadString( name ); strcpy( newLight.name, name.c_str() ); @@ -730,7 +730,7 @@ void idWeapon::Clear( void ) { refSound.referenceSound->Free( true ); } memset( &refSound, 0, sizeof( refSound_t ) ); - + // setting diversity to 0 results in no random sound. -1 indicates random. refSound.diversity = -1.0f; @@ -1158,7 +1158,7 @@ void idWeapon::GetWeaponDef( const char *objectname, int ammoinclip ) { if ( !weaponDef->dict.GetString( "weapon_scriptobject", NULL, &objectType ) ) { gameLocal.Error( "No 'weapon_scriptobject' set on '%s'.", objectname ); } - + // setup script object if ( !scriptObject.SetType( objectType ) ) { gameLocal.Error( "Script object '%s' not found on weapon '%s'.", objectType, objectname ); @@ -1295,7 +1295,7 @@ void idWeapon::UpdateGUI( void ) { if ( !renderEntity.gui[ 0 ] ) { return; } - + if ( status == WP_HOLSTERED ) { return; } @@ -1385,7 +1385,7 @@ idWeapon::MuzzleFlashLight ================ */ void idWeapon::MuzzleFlashLight( void ) { - + if ( !lightOn && ( !g_muzzleFlash.GetBool() || !muzzleFlash.lightRadius[0] ) ) { return; } @@ -1432,7 +1432,7 @@ bool idWeapon::UpdateSkin( void ) { common->Warning( "Can't find function 'UpdateSkin' in object '%s'", scriptObject.GetTypeName() ); return false; } - + // use the frameCommandThread since it's safe to use outside of framecommands gameLocal.frameCommandThread->CallFunction( this, func, true ); gameLocal.frameCommandThread->Execute(); @@ -1676,7 +1676,7 @@ void idWeapon::OwnerDied( void ) { idWeapon::BeginAttack ================ */ -void idWeapon::BeginAttack( void ) { +void idWeapon::BeginAttack( void ) { if ( status != WP_OUTOFAMMO ) { lastAttack = gameLocal.time; } @@ -1991,7 +1991,7 @@ void idWeapon::MuzzleRise( idVec3 &origin, idMat3 &axis ) { if ( time > muzzle_kick_maxtime ) { time = muzzle_kick_maxtime; } - + amount = ( float )time / ( float )muzzle_kick_maxtime; ang = muzzle_kick_angles * amount; offset = muzzle_kick_offset * amount; @@ -2042,7 +2042,7 @@ void idWeapon::DeconstructScriptObject( void ) { if ( !thread ) { return; } - + // don't bother calling the script object's destructor on map shutdown if ( gameLocal.GameState() == GAMESTATE_SHUTDOWN ) { return; @@ -2156,7 +2156,7 @@ void idWeapon::PresentWeapon( bool showViewModel ) { // 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 - if ( gameLocal.time - hideStartTime < hideTime ) { + if ( gameLocal.time - hideStartTime < hideTime ) { float frac = ( float )( gameLocal.time - hideStartTime ) / ( float )hideTime; if ( hideStart < hideEnd ) { frac = 1.0f - frac; @@ -2689,7 +2689,7 @@ void idWeapon::WriteToSnapshot( idBitMsgDelta &msg ) const { idWeapon::ReadFromSnapshot ================ */ -void idWeapon::ReadFromSnapshot( const idBitMsgDelta &msg ) { +void idWeapon::ReadFromSnapshot( const idBitMsgDelta &msg ) { ammoClip = msg.ReadBits( ASYNC_PLAYER_INV_CLIP_BITS ); worldModel.SetSpawnId( msg.ReadBits( 32 ) ); bool snapLight = msg.ReadBits( 1 ) != 0; @@ -2703,10 +2703,10 @@ void idWeapon::ReadFromSnapshot( const idBitMsgDelta &msg ) { idealState = "Fire"; } - // immediately switch back to idle - if ( WEAPON_NETFIRING && !isFiring ) { - idealState = "Idle"; - } + // immediately switch back to idle + if ( WEAPON_NETFIRING && !isFiring ) { + idealState = "Idle"; + } WEAPON_NETFIRING = isFiring; } @@ -2944,7 +2944,7 @@ idWeapon::Event_AmmoInClip */ void idWeapon::Event_AmmoInClip( void ) { int ammo = AmmoInClip(); - idThread::ReturnFloat( ammo ); + idThread::ReturnFloat( ammo ); } /* @@ -2979,7 +2979,7 @@ idWeapon::Event_ClipSize =============== */ 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 ) { int anim; - + anim = animator.GetAnim( animname ); if ( !anim ) { 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; } #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 if ( powerAmmo ) { // 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 // 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; if ( 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 * as ammoRequired. */ void idWeapon::Event_LaunchPowerup( const char* powerup, float duration, int useAmmo ) { if ( IsHidden() ) { - return; + return; } // check if we're out of ammo @@ -3766,12 +3766,12 @@ void idWeapon::Event_Melee( void ) { && !owner->PowerUpActive( BERSERK ) && ( (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 */ - - if ( gameLocal.mpGame.IsGametypeFlagBased() ) - { /* Do nothing ... */ } - else + + if ( gameLocal.mpGame.IsGametypeFlagBased() ) + { /* Do nothing ... */ } + else #endif owner->StealWeapon( static_cast< idPlayer * >( ent ) ); } @@ -3934,5 +3934,5 @@ idWeapon::ClientPredictionThink =============== */ void idWeapon::ClientPredictionThink( void ) { - UpdateAnimation(); + UpdateAnimation(); } diff --git a/d3xp/Weapon.h b/d3xp/Weapon.h index 97ede12..f3ff821 100644 --- a/d3xp/Weapon.h +++ b/d3xp/Weapon.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms =============================================================================== Player Weapon - + =============================================================================== */ @@ -231,7 +231,7 @@ private: // the view weapon render entity parms idVec3 viewWeaponOrigin; idMat3 viewWeaponAxis; - + // the muzzle bone's position, used for launching projectiles and trailing smoke idVec3 muzzleOrigin; idMat3 muzzleAxis; @@ -290,7 +290,7 @@ private: bool isFiring; // zoom - int zoomFov; // variable zoom fov per weapon + int zoomFov; // variable zoom fov per weapon // joints from models jointHandle_t barrelJointView; @@ -318,8 +318,8 @@ private: int weaponSmokeStartTime; // set to gameLocal.time every weapon fire bool continuousSmoke; // if smoke is continuous ( chainsaw ) const idDeclParticle * strikeSmoke; // striking something in melee - int strikeSmokeStartTime; // timing - idVec3 strikePos; // position of last melee strike + int strikeSmokeStartTime; // timing + idVec3 strikePos; // position of last melee strike idMat3 strikeAxis; // axis of last melee strike int nextStrikeFx; // used for sound and decal ( may use for strike smoke too ) diff --git a/d3xp/WorldSpawn.cpp b/d3xp/WorldSpawn.cpp index 0c368c4..9e2ce5d 100644 --- a/d3xp/WorldSpawn.cpp +++ b/d3xp/WorldSpawn.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/WorldSpawn.h b/d3xp/WorldSpawn.h index 7b65ddd..bf88243 100644 --- a/d3xp/WorldSpawn.h +++ b/d3xp/WorldSpawn.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/ai/AAS.cpp b/d3xp/ai/AAS.cpp index 1abb78d..9fd1ac8 100644 --- a/d3xp/ai/AAS.cpp +++ b/d3xp/ai/AAS.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -163,7 +163,7 @@ int idAASLocal::BoundsReachableAreaNum( const idBounds &bounds, const int areaFl if ( !file ) { return 0; } - + return file->BoundsReachableAreaNum( bounds, areaFlags, TFL_INVALID ); } diff --git a/d3xp/ai/AAS.h b/d3xp/ai/AAS.h index a1e22dd..8f272b4 100644 --- a/d3xp/ai/AAS.h +++ b/d3xp/ai/AAS.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/ai/AAS_debug.cpp b/d3xp/ai/AAS_debug.cpp index 5605712..0c4ba48 100644 --- a/d3xp/ai/AAS_debug.cpp +++ b/d3xp/ai/AAS_debug.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -196,7 +196,7 @@ void idAASLocal::ShowArea( const idVec3 &origin ) const { if ( aas_goalArea.GetInteger() ) { int travelTime; idReachability *reach; - + RouteToGoalArea( areaNum, org, aas_goalArea.GetInteger(), TFL_WALK|TFL_AIR, travelTime, &reach ); gameLocal.Printf( "\rtt = %4d", travelTime ); if ( reach ) { diff --git a/d3xp/ai/AAS_local.h b/d3xp/ai/AAS_local.h index afab2de..5b9af24 100644 --- a/d3xp/ai/AAS_local.h +++ b/d3xp/ai/AAS_local.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/ai/AAS_pathing.cpp b/d3xp/ai/AAS_pathing.cpp index 07a57ef..7805c0a 100644 --- a/d3xp/ai/AAS_pathing.cpp +++ b/d3xp/ai/AAS_pathing.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/ai/AAS_routing.cpp b/d3xp/ai/AAS_routing.cpp index f44631a..acb59ac 100644 --- a/d3xp/ai/AAS_routing.cpp +++ b/d3xp/ai/AAS_routing.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -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[1] = obstacles[k].absBounds[1] - file->GetSettings().boundingBoxes[0][0]; } - + badTravelFlags = ~travelFlags; 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 t += AreaTravelTime( reach->toAreaNum, reach->end, nextArea->center ); - + if ( !bestTravelTime || t < bestTravelTime ) { // if the area is not visible to the target if ( callback.TestArea( this, reach->toAreaNum ) ) { diff --git a/d3xp/ai/AI.cpp b/d3xp/ai/AI.cpp index 36cce7b..2ccb337 100644 --- a/d3xp/ai/AI.cpp +++ b/d3xp/ai/AI.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -221,7 +221,7 @@ idAASFindAttackPosition::idAASFindAttackPosition( const idAI *self, const idMat3 this->gravityAxis = gravityAxis; 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 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)); idStr name; - savefile->ReadString( name ); + savefile->ReadString( name ); strcpy( newEmitter.name, name.c_str() ); savefile->ReadJoint( newEmitter.joint ); savefile->ReadObject(reinterpret_cast(newEmitter.particle)); - + funcEmitters.Set(newEmitter.name, newEmitter); } @@ -751,7 +751,7 @@ void idAI::Restore( idRestoreGame *savefile ) { //if(harvestEnt.GetEntity()) { // harvestEnt.GetEntity()->SetParent(this); //} - + #endif } @@ -789,7 +789,7 @@ void idAI::Spawn( void ) { spawnArgs.GetFloat( "melee_range", "64", melee_range ); spawnArgs.GetFloat( "projectile_height_to_distance_ratio", "1", projectile_height_to_distance_ratio ); - + spawnArgs.GetFloat( "turn_rate", "360", turnRate ); 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 physicsObj.SetOrigin( GetPhysics()->GetOrigin() + idVec3( 0, 0, CM_CLIP_EPSILON ) ); - + if ( num_cinematics ) { physicsObj.SetGravity( vec3_origin ); } else { @@ -1016,7 +1016,7 @@ void idAI::InitMuzzleFlash( void ) { spawnArgs.GetString( "mtr_flashShader", "muzzleflash", &shader ); spawnArgs.GetVector( "flashColor", "0 0 0", flashColor ); - float flashRadius = spawnArgs.GetFloat( "flashRadius" ); + float flashRadius = spawnArgs.GetFloat( "flashRadius" ); flashTime = SEC2MS( spawnArgs.GetFloat( "flashTime", "0.25" ) ); memset( &worldMuzzleFlash, 0, sizeof ( worldMuzzleFlash ) ); @@ -1104,7 +1104,7 @@ void idAI::DormantEnd( void ) { // let our enemy know we're back on the trail enemyNode.AddToEnd( enemy.GetEntity()->enemyList ); } - + if ( particles.Num() ) { for ( int i = 0; i < particles.Num(); i++ ) { particles[i].time = gameLocal.time; @@ -1418,7 +1418,7 @@ idAI::ReachedPos bool idAI::ReachedPos( const idVec3 &pos, const moveCommand_t moveCommand ) const { if ( move.moveType == MOVETYPE_SLIDE ) { 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 ) ) { return true; } @@ -1429,7 +1429,7 @@ bool idAI::ReachedPos( const idVec3 &pos, const moveCommand_t moveCommand ) cons } } else { 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 ) ) { return true; } @@ -2090,7 +2090,7 @@ idAI::WanderAround */ bool idAI::WanderAround( void ) { StopMove( MOVE_STATUS_DONE ); - + move.moveDest = physicsObj.GetOrigin() + viewAxis[ 0 ] * physicsObj.GetGravityAxis() * 256.0f; if ( !NewWanderDir( move.moveDest ) ) { StopMove( MOVE_STATUS_DEST_UNREACHABLE ); @@ -2163,7 +2163,7 @@ bool idAI::StepDirection( float dir ) { if ( z <= ceilingPos.z ) { start.x = org.x; start.y = org.y; - start.z = z; + start.z = z; } else { start = ceilingPos; } @@ -2250,7 +2250,7 @@ bool idAI::NewWanderDir( const idVec3 &dest ) { if ( gameLocal.random.RandomInt() & 1 ) { for( tdir = 0; tdir <= 315; tdir += 45 ) { if ( tdir != turnaround && StepDirection( tdir ) ) { - return true; + return true; } } } else { @@ -2303,7 +2303,7 @@ bool idAI::GetMovePos( idVec3 &seekPos ) { } return false; break; - + case MOVE_SLIDE_TO_POSITION : seekPos = org; return false; @@ -2739,7 +2739,7 @@ void idAI::AnimMove( void ) { AI_BLOCKED = false; - if ( move.moveCommand < NUM_NONMOVING_COMMANDS ){ + if ( move.moveCommand < NUM_NONMOVING_COMMANDS ){ move.lastMoveOrigin.Zero(); move.lastMoveTime = gameLocal.time; } @@ -2861,7 +2861,7 @@ void idAI::SlideMove( void ) { AI_BLOCKED = false; - if ( move.moveCommand < NUM_NONMOVING_COMMANDS ){ + if ( move.moveCommand < NUM_NONMOVING_COMMANDS ){ move.lastMoveOrigin.Zero(); move.lastMoveTime = gameLocal.time; } @@ -2961,9 +2961,9 @@ idAI::AdjustFlyingAngles */ void idAI::AdjustFlyingAngles( void ) { idVec3 vel; - float speed; - float roll; - float pitch; + float speed; + float roll; + float pitch; vel = physicsObj.GetLinearVelocity(); @@ -3042,7 +3042,7 @@ void idAI::AdjustFlyHeight( idVec3 &vel, const idVec3 &goalPos ) { vel.z += addVel.z; goLower = true; } - + if ( ai_debugMove.GetBool() ) { gameRenderWorld->DebugBounds( goLower ? colorRed : colorGreen, physicsObj.GetBounds(), path.endPos, gameLocal.msec ); } @@ -3072,7 +3072,7 @@ idAI::FlySeekGoal */ void idAI::FlySeekGoal( idVec3 &vel, idVec3 &goalPos ) { idVec3 seekVel; - + // seek the goal position seekVel = Seek( vel, physicsObj.GetOrigin(), goalPos, AI_SEEK_PREDICTION ); seekVel *= fly_seek_scale; @@ -3403,7 +3403,7 @@ void idAI::Killed( idEntity *inflictor, idEntity *attacker, int damage, const id EndAttack(); 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 ) ); } @@ -3503,7 +3503,7 @@ void idAI::Killed( idEntity *inflictor, idEntity *attacker, int damage, const id idEntity *temp; gameLocal.SpawnEntityDef( *harvestDef, &temp, false ); harvestEnt = static_cast(temp); - + } 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. if ( cinematic ) { - UpdateAIScript(); + UpdateAIScript(); // make sure our model gets updated animator.ForceUpdate(); @@ -4046,7 +4046,7 @@ void idAI::CalculateAttackOffsets( void ) { return; } 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 animator.RemoveOriginOffset( false ); @@ -4175,7 +4175,7 @@ idProjectile *idAI::CreateProjectile( const idVec3 &pos, const idVec3 &dir ) { clsname = projectileDef->GetString( "classname" ); gameLocal.Error( "Could not spawn entityDef '%s'", clsname ); } - + if ( !ent->IsType( idProjectile::Type ) ) { clsname = ent->GetClassname(); gameLocal.Error( "'%s' is not an idProjectile", clsname ); @@ -4650,7 +4650,7 @@ idAI::UpdateMuzzleFlash ================ */ void idAI::UpdateMuzzleFlash( void ) { - if ( worldMuzzleFlashHandle != -1 ) { + if ( worldMuzzleFlashHandle != -1 ) { if ( gameLocal.time >= muzzleFlashEnd ) { gameRenderWorld->FreeLightDef( worldMuzzleFlashHandle ); worldMuzzleFlashHandle = -1; @@ -4841,7 +4841,7 @@ void idAI::TriggerParticles( const char *jointName ) { #ifdef _D3XP void idAI::TriggerFX( const char* joint, const char* fx ) { - + if( !strcmp(joint, "origin") ) { idEntityFx::StartFx( fx, NULL, NULL, this, true ); } else { @@ -4903,14 +4903,14 @@ idEntity* idAI::StartEmitter( const char* name, const char* joint, const char* p axis[0] = -tmp; ent->GetPhysics()->SetAxis(axis);*/ - + axis = physicsObj.GetGravityAxis(); ent->GetPhysics()->SetAxis(axis); - + ent->GetPhysics()->GetClipModel()->SetOwner( this ); - + //Keep a reference to the emitter so we can track it funcEmitter_t newEmitter; strcpy(newEmitter.name, name); @@ -4964,10 +4964,10 @@ bool idAI::UpdateAnimationControllers( void ) { idVec3 focusPos; idQuat jawQuat; idVec3 left; - idVec3 dir; - idVec3 orientationJointPos; - idVec3 localDir; - idAngles newLookAng; + idVec3 dir; + idVec3 orientationJointPos; + idVec3 localDir; + idAngles newLookAng; idAngles diff; idMat3 mat; idMat3 axis; @@ -5022,7 +5022,7 @@ bool idAI::UpdateAnimationControllers( void ) { idEntity *focusEnt = focusEntity.GetEntity(); if ( !allowJointMod || !allowEyeFocus || ( gameLocal.time >= focusTime ) ) { - focusPos = GetEyePosition() + orientationJointAxis[ 0 ] * 512.0f; + focusPos = GetEyePosition() + orientationJointAxis[ 0 ] * 512.0f; } else if ( focusEnt == NULL ) { // keep looking at last position until focusTime is up focusPos = currentFocusPos; @@ -5056,7 +5056,7 @@ bool idAI::UpdateAnimationControllers( void ) { newLookAng.roll = 0.0f; diff = newLookAng - lookAng; - + if ( eyeAng != diff ) { eyeAng = diff; eyeAng.Clamp( eyeMin, eyeMax ); @@ -5105,7 +5105,7 @@ bool idAI::UpdateAnimationControllers( void ) { // lean into turns AdjustFlyingAngles(); } - + if ( headEnt ) { idAnimator *headAnimator = headEnt->GetAnimator(); @@ -5253,7 +5253,7 @@ void idCombatNode::DrawDebugInfo( void ) { idPlayer *player = gameLocal.GetLocalPlayer(); idVec4 color; idBounds bounds( idVec3( -16, -16, 0 ), idVec3( 16, 16, 0 ) ); - + for( ent = gameLocal.spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() ) { if ( !ent->IsType( idCombatNode::Type ) ) { continue; @@ -5315,7 +5315,7 @@ bool idCombatNode::EntityInView( idActor *actor, const idVec3 &pos ) { const idMat3 &axis = GetPhysics()->GetAxis(); idVec3 dir = pos - org; float dist = dir * axis[ 0 ]; - + if ( ( dist < min_dist ) || ( dist > max_dist ) ) { return false; } diff --git a/d3xp/ai/AI.h b/d3xp/ai/AI.h index 0e4b204..8b337ad 100644 --- a/d3xp/ai/AI.h +++ b/d3xp/ai/AI.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -70,7 +70,7 @@ typedef enum { MOVE_TO_ENEMY = NUM_NONMOVING_COMMANDS, MOVE_TO_ENEMYHEIGHT, - MOVE_TO_ENTITY, + MOVE_TO_ENTITY, MOVE_OUT_OF_RANGE, MOVE_TO_ATTACK_POSITION, MOVE_TO_COVER, @@ -112,9 +112,9 @@ typedef struct obstaclePath_s { idVec3 seekPos; // seek position avoiding obstacles idEntity * firstObstacle; // if != NULL the first obstacle along the path 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 - idEntity * seekPosObstacle; // if != NULL the obstacle containing the seek position + idEntity * seekPosObstacle; // if != NULL the obstacle containing the seek position } obstaclePath_t; // path prediction @@ -333,7 +333,7 @@ protected: bool allowHiddenMovement; // allows character to still move around while hidden bool disableGravity; // disables gravity and allows vertical movement by the animation bool af_push_moveables; // allow the articulated figure to push moveable objects - + // weapon/attack vars bool lastHitCheckResult; int lastHitCheckTime; @@ -385,7 +385,7 @@ protected: // special fx float shrivel_rate; int shrivel_start; - + bool restartParticles; // should smoke emissions restart bool useBoneAxis; // use the bone vs the model axis idList particles; // particle data @@ -689,8 +689,8 @@ protected: void Event_AllowHiddenMovement( int enable ); void Event_TriggerParticles( const char *jointName ); void Event_FindActorsInBounds( const idVec3 &mins, const idVec3 &maxs ); - void Event_CanReachPosition( const idVec3 &pos ); - void Event_CanReachEntity( idEntity *ent ); + void Event_CanReachPosition( const idVec3 &pos ); + void Event_CanReachEntity( idEntity *ent ); void Event_CanReachEnemy( void ); void Event_GetReachableEntityPosition( idEntity *ent ); #ifdef _D3XP diff --git a/d3xp/ai/AI_Vagary.cpp b/d3xp/ai/AI_Vagary.cpp index 6bcb4f0..24c7a86 100644 --- a/d3xp/ai/AI_Vagary.cpp +++ b/d3xp/ai/AI_Vagary.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -108,10 +108,10 @@ void idAI_Vagary::Event_ChooseObjectToThrow( const idVec3 &mins, const idVec3 &m 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 ) ) { idThread::ReturnEntity( ent ); - return; + return; } } @@ -133,7 +133,7 @@ void idAI_Vagary::Event_ThrowObjectAtEnemy( idEntity *ent, float speed ) { if ( !enemyEnt ) { vel = ( viewAxis[ 0 ] * physicsObj.GetGravityAxis() ) * speed; } 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 ); vel *= speed; } diff --git a/d3xp/ai/AI_events.cpp b/d3xp/ai/AI_events.cpp index fdedfc3..6d11607 100644 --- a/d3xp/ai/AI_events.cpp +++ b/d3xp/ai/AI_events.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -166,10 +166,10 @@ const idEventDef AI_GetReachableEntityPosition( "getReachableEntityPosition", "e #ifdef _D3XP const idEventDef AI_MoveToPositionDirect( "moveToPositionDirect", "v" ); const idEventDef AI_AvoidObstacles( "avoidObstacles", "d" ); -const idEventDef AI_TriggerFX( "triggerFX", "ss" ); -const idEventDef AI_StartEmitter( "startEmitter", "sss", 'e' ); -const idEventDef AI_GetEmitter( "getEmitter", "s", 'e' ); -const idEventDef AI_StopEmitter( "stopEmitter", "s" ); +const idEventDef AI_TriggerFX( "triggerFX", "ss" ); +const idEventDef AI_StartEmitter( "startEmitter", "sss", 'e' ); +const idEventDef AI_GetEmitter( "getEmitter", "s", 'e' ); +const idEventDef AI_StopEmitter( "stopEmitter", "s" ); #endif @@ -265,7 +265,7 @@ CLASS_DECLARATION( idActor, idAI ) EVENT( AI_SetMoveType, idAI::Event_SetMoveType ) EVENT( AI_SaveMove, idAI::Event_SaveMove ) 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_EnableClip, idAI::Event_EnableClip ) EVENT( AI_DisableClip, idAI::Event_DisableClip ) @@ -308,7 +308,7 @@ CLASS_DECLARATION( idActor, idAI ) EVENT( AI_GetReachableEntityPosition, idAI::Event_GetReachableEntityPosition ) #ifdef _D3XP 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_StartEmitter, idAI::Event_StartEmitter ) EVENT( AI_GetEmitter, idAI::Event_GetEmitter ) @@ -476,7 +476,7 @@ void idAI::Event_ClosestReachableEnemyOfEntity( idEntity *team_mate ) { int areaNum; int enemyAreaNum; aasPath_t path; - + if ( !team_mate->IsType( idActor::Type ) ) { 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 ) { bool hit; - + hit = AttackMelee( meleeDefName ); idThread::ReturnInt( hit ); } @@ -828,7 +828,7 @@ void idAI::Event_MeleeAttackToJoint( const char *jointname, const char *meleeDef animator.GetJointTransform( joint, gameLocal.time, end, axis ); end = physicsObj.GetOrigin() + ( end + modelOffset ) * viewAxis * physicsObj.GetGravityAxis(); start = GetEyePosition(); - + if ( ai_debugMove.GetBool() ) { gameRenderWorld->DebugLine( colorYellow, start, end, gameLocal.msec ); } @@ -1316,7 +1316,7 @@ void idAI::Event_EnemyInCombatCone( idEntity *ent, int use_current_enemy_locatio } #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 if(ent->spawnArgs.GetBool("neverLeave", "0")) { idThread::ReturnInt( true ); @@ -1397,7 +1397,7 @@ void idAI::Event_EntityInAttackCone( idEntity *ent ) { idVec3 delta; float yaw; float relYaw; - + if ( !ent ) { idThread::ReturnInt( false ); return; @@ -1598,7 +1598,7 @@ void idAI::Event_CanHitEnemy( void ) { hit = gameLocal.GetTraceEntity( tr ); if ( tr.fraction >= 1.0f || ( hit == enemyEnt ) ) { lastHitCheckResult = true; - } else if ( ( tr.fraction < 1.0f ) && ( hit->IsType( idAI::Type ) ) && + } else if ( ( tr.fraction < 1.0f ) && ( hit->IsType( idAI::Type ) ) && ( static_cast( hit )->team != team ) ) { lastHitCheckResult = true; } else { @@ -1838,7 +1838,7 @@ void idAI::Event_TestAnimMoveTowardEnemy( const char *animname ) { float yaw; idVec3 delta; idActor *enemyEnt; - + enemyEnt = enemy.GetEntity(); if ( !enemyEnt ) { idThread::ReturnInt( false ); @@ -1853,7 +1853,7 @@ void idAI::Event_TestAnimMoveTowardEnemy( const char *animname ) { } 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(); 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 ) { idActor *enemyEnt; int areaNum; - + enemyEnt = enemy.GetEntity(); if ( !enemyEnt ) { return; @@ -2597,7 +2597,7 @@ idAI::Event_KickObstacles void idAI::Event_KickObstacles( idEntity *kickEnt, float force ) { idVec3 dir; idEntity *obEnt; - + if ( kickEnt ) { obEnt = kickEnt; } else { @@ -2903,4 +2903,3 @@ void idAI::Event_StopEmitter( const char* name ) { } #endif - diff --git a/d3xp/ai/AI_pathing.cpp b/d3xp/ai/AI_pathing.cpp index 939390d..886d594 100644 --- a/d3xp/ai/AI_pathing.cpp +++ b/d3xp/ai/AI_pathing.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -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 PUSH_OUTSIDE_OBSTACLES = 0.5f; const float CLIP_BOUNDS_EPSILON = 10.0f; -const int MAX_AAS_WALL_EDGES = 256; -const int MAX_OBSTACLES = 256; +const int MAX_AAS_WALL_EDGES = 256; +const int MAX_OBSTACLES = 256; const int MAX_PATH_NODES = 256; -const int MAX_OBSTACLE_PATH = 64; +const int MAX_OBSTACLE_PATH = 64; typedef struct obstacle_s { idVec2 bounds[2]; @@ -260,7 +260,7 @@ void GetPointOutsideObstacles( const obstacle_t *obstacles, const int numObstacl 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(); nextVerts[0] = nextVerts[1] = 0; 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 ); edgeDir = end.ToVec2() - start.ToVec2(); edgeDir.Normalize(); @@ -1338,7 +1338,7 @@ static float HeightForTrajectory( const idVec3 &start, float zVel, float gravity t = zVel / gravity; // maximum height of projectile maxHeight = start.z - 0.5f * gravity * ( t * t ); - + return maxHeight; } diff --git a/d3xp/anim/Anim.cpp b/d3xp/anim/Anim.cpp index 44de237..3904342 100644 --- a/d3xp/anim/Anim.cpp +++ b/d3xp/anim/Anim.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -216,7 +216,7 @@ bool idMD5Anim::LoadAnim( const char *filename ) { for( i = 0; i < numJoints; i++ ) { parser.ReadToken( &token ); jointInfo[ i ].nameIndex = animationLib.JointIndex( token ); - + // parse parent num jointInfo[ i ].parentNum = parser.ParseInt(); if ( jointInfo[ i ].parentNum >= i ) { @@ -278,7 +278,7 @@ bool idMD5Anim::LoadAnim( const char *filename ) { parser.Error( "Expected frame number %d", i ); } parser.ExpectTokenString( "{" ); - + for( j = 0; j < numAnimatedComponents; j++, componentPtr++ ) { *componentPtr = parser.ParseFloat(); } @@ -402,7 +402,7 @@ void idMD5Anim::ConvertTimeToFrame( int time, int cyclecount, frameBlend_t &fram frame.cycleCount = 0; return; } - + frameTime = time * frameRate; frameNum = frameTime / 1000; frame.cycleCount = frameNum / ( numFrames - 1 ); @@ -415,7 +415,7 @@ void idMD5Anim::ConvertTimeToFrame( int time, int cyclecount, frameBlend_t &fram frame.frontlerp = 1.0f; return; } - + frame.frame1 = frameNum % ( numFrames - 1 ); frame.frame2 = frame.frame1 + 1; if ( frame.frame2 >= numFrames ) { @@ -436,7 +436,7 @@ void idMD5Anim::GetOrigin( idVec3 &offset, int time, int cyclecount ) const { offset = baseFrame[ 0 ].t; if ( !( jointInfo[ 0 ].animBits & ( ANIM_TX | ANIM_TY | ANIM_TZ ) ) ) { - // just use the baseframe + // just use the baseframe return; } @@ -474,10 +474,10 @@ idMD5Anim::GetOriginRotation void idMD5Anim::GetOriginRotation( idQuat &rotation, int time, int cyclecount ) const { frameBlend_t frame; int animBits; - + animBits = jointInfo[ 0 ].animBits; if ( !( animBits & ( ANIM_QX | ANIM_QY | ANIM_QZ ) ) ) { - // just use the baseframe + // just use the baseframe rotation = baseFrame[ 0 ].q; return; } @@ -1070,7 +1070,7 @@ void idAnimManager::FlushUnusedAnims( void ) { int i; idMD5Anim **animptr; idList removeAnims; - + for( i = 0; i < animations.Num(); i++ ) { animptr = animations.GetIndex( i ); if ( animptr && *animptr ) { diff --git a/d3xp/anim/Anim.h b/d3xp/anim/Anim.h index a1f60f9..e3ae912 100644 --- a/d3xp/anim/Anim.h +++ b/d3xp/anim/Anim.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -147,7 +147,7 @@ typedef enum { FC_RECORDDEMO, FC_AVIGAME #ifdef _D3XP - , FC_LAUNCH_PROJECTILE, + , FC_LAUNCH_PROJECTILE, FC_TRIGGER_FX, FC_START_EMITTER, FC_STOP_EMITTER, @@ -251,7 +251,7 @@ public: void IncreaseRefs( void ) const; void DecreaseRefs( void ) const; int NumRefs( void ) const; - + void CheckModelHierarchy( const idRenderModel *model ) 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; diff --git a/d3xp/anim/Anim_Blend.cpp b/d3xp/anim/Anim_Blend.cpp index 625d2a0..781fe70 100644 --- a/d3xp/anim/Anim_Blend.cpp +++ b/d3xp/anim/Anim_Blend.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -163,7 +163,7 @@ index 0 will never be NULL. Any anim >= NumAnims will return NULL. ===================== */ const idMD5Anim *idAnim::MD5Anim( int num ) const { - if ( anims == NULL || anims[0] == NULL ) { + if ( anims == NULL || anims[0] == NULL ) { return NULL; } return anims[ num ]; @@ -196,11 +196,11 @@ int idAnim::Length( void ) const { idAnim::NumFrames ===================== */ -int idAnim::NumFrames( void ) const { +int idAnim::NumFrames( void ) const { if ( !anims[ 0 ] ) { return 0; } - + return anims[ 0 ]->NumFrames(); } @@ -209,7 +209,7 @@ int idAnim::NumFrames( void ) const { idAnim::NumAnims ===================== */ -int idAnim::NumAnims( void ) const { +int idAnim::NumAnims( void ) const { return numAnims; } @@ -222,7 +222,7 @@ const idVec3 &idAnim::TotalMovementDelta( void ) const { if ( !anims[ 0 ] ) { return vec3_zero; } - + return anims[ 0 ]->TotalMovementDelta(); } @@ -576,7 +576,7 @@ const char *idAnim::AddFrameCommand( const idDeclModelDef *modelDef, int framenu fc.type = FC_LAUNCH_PROJECTILE; fc.string = new idStr( token ); } else if ( token == "trigger_fx" ) { - + if( !src.ReadTokenOnLine( &token ) ) { return "Unexpected end of line"; } @@ -703,7 +703,7 @@ const char *idAnim::AddFrameCommand( const idDeclModelDef *modelDef, int framenu frameLookup[ i ].firstCommand++; } - // store the new command + // store the new command frameCommands[ index ] = fc; // increase the number of commands on this frame @@ -1192,7 +1192,7 @@ void idAnimBlend::Reset( const idDeclModelDef *_modelDef ) { blendStartValue = 0.0f; blendEndValue = 0.0f; - blendStartTime = 0; + blendStartTime = 0; blendDuration = 0; } @@ -1292,7 +1292,7 @@ idAnimBlend::SetWeight void idAnimBlend::SetWeight( float newweight, int currentTime, int blendTime ) { blendStartValue = GetWeight( currentTime ); blendEndValue = newweight; - blendStartTime = currentTime - 1; + blendStartTime = currentTime - 1; blendDuration = blendTime; if ( !newweight ) { @@ -1343,7 +1343,7 @@ void idAnimBlend::SetFrame( const idDeclModelDef *modelDef, int _animNum, int _f if ( !modelDef ) { return; } - + const idAnim *_anim = modelDef->GetAnim( _animNum ); if ( !_anim ) { 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() ); return; } - + animNum = _animNum; starttime = currentTime; endtime = -1; @@ -1386,7 +1386,7 @@ void idAnimBlend::CycleAnim( const idDeclModelDef *modelDef, int _animNum, int c if ( !modelDef ) { return; } - + const idAnim *_anim = modelDef->GetAnim( _animNum ); if ( !_anim ) { return; @@ -1426,7 +1426,7 @@ void idAnimBlend::PlayAnim( const idDeclModelDef *modelDef, int _animNum, int cu if ( !modelDef ) { return; } - + const idAnim *_anim = modelDef->GetAnim( _animNum ); if ( !_anim ) { return; @@ -1918,7 +1918,7 @@ bool idAnimBlend::BlendAnim( int currentTime, int channel, int numJoints, idJoin blendFrame[j].q = jointFrame[j].q; } } - } else { + } else { blendWeight += weight; lerp = weight / blendWeight; 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; int num; int i; - + if ( frame || !allowMove || ( ( endtime > 0 ) && ( fromtime > endtime ) ) ) { return; } @@ -2059,7 +2059,7 @@ void idAnimBlend::BlendDeltaRotation( int fromtime, int totime, idQuat &blendDel float mixWeight; int num; int i; - + if ( frame || !allowMove || ( ( endtime > 0 ) && ( fromtime > endtime ) ) ) { return; } @@ -2142,7 +2142,7 @@ bool idAnimBlend::AddBounds( int currentTime, idBounds &bounds, bool removeOrigi time = AnimTime( currentTime ); num = anim->NumAnims(); - + addorigin = !allowMove || !removeOriginOffset; for( i = 0; i < num; i++ ) { if ( anim->GetBounds( b, i, time, cycle ) ) { @@ -2261,7 +2261,7 @@ const jointInfo_t *idDeclModelDef::FindJoint( const char *name ) const { if ( !modelHandle ) { return NULL; } - + joint = modelHandle->GetJoints(); for( i = 0; i < joints.Num(); i++, joint++ ) { if ( !joint->name.Icmp( name ) ) { @@ -2667,7 +2667,7 @@ bool idDeclModelDef::Parse( const char *text, const int textLength ) { MakeDefault(); return false; } - + const idDeclModelDef *copy = static_cast( declManager->FindType( DECL_MODELDEF, token2, false ) ); if ( !copy ) { common->Warning( "Unknown model definition '%s'", token2.c_str() ); @@ -2872,7 +2872,7 @@ bool idDeclModelDef::HasAnim( const char *name ) const { return true; } } - + return false; } @@ -2915,7 +2915,7 @@ const idAnim *idDeclModelDef::GetAnim( int index ) const { if ( ( index < 1 ) || ( index > anims.Num() ) ) { return NULL; } - + return anims[ index - 1 ]; } @@ -3031,7 +3031,7 @@ const char *idDeclModelDef::GetJointName( int jointHandle ) const { if ( !modelHandle ) { return NULL; } - + if ( ( jointHandle < 0 ) || ( jointHandle > joints.Num() ) ) { 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_axis ); } - + savefile->WriteInt( numJoints ); for ( i = 0; i < numJoints; i++ ) { float *data = joints[i].ToFloatPtr(); @@ -3175,14 +3175,14 @@ void idAnimator::Save( idSaveGame *savefile ) const { for ( i = 0; i < AFPoseJoints.Num(); i++ ) { savefile->WriteInt( AFPoseJoints[i] ); } - + savefile->WriteInt( AFPoseJointMods.Num() ); for ( i = 0; i < AFPoseJointMods.Num(); i++ ) { savefile->WriteInt( (int&)AFPoseJointMods[i].mod ); savefile->WriteMat3( AFPoseJointMods[i].axis ); savefile->WriteVec3( AFPoseJointMods[i].origin ); } - + savefile->WriteInt( AFPoseJointFrame.Num() ); for ( i = 0; i < AFPoseJointFrame.Num(); i++ ) { savefile->WriteFloat( AFPoseJointFrame[i].q.x ); @@ -3191,7 +3191,7 @@ void idAnimator::Save( idSaveGame *savefile ) const { savefile->WriteFloat( AFPoseJointFrame[i].q.w ); savefile->WriteVec3( AFPoseJointFrame[i].t ); } - + savefile->WriteBounds( AFPoseBounds ); 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_axis ); } - + savefile->ReadInt( numJoints ); joints = (idJointMat *) Mem_Alloc16( numJoints * sizeof( joints[0] ) ); for ( i = 0; i < numJoints; i++ ) { @@ -3238,7 +3238,7 @@ void idAnimator::Restore( idRestoreGame *savefile ) { savefile->ReadFloat( data[j] ); } } - + savefile->ReadInt( lastTransformTime ); savefile->ReadBool( stoppedAnimatingUpdate ); savefile->ReadBool( forceUpdate ); @@ -3252,7 +3252,7 @@ void idAnimator::Restore( idRestoreGame *savefile ) { for ( i = 0; i < AFPoseJoints.Num(); i++ ) { savefile->ReadInt( AFPoseJoints[i] ); } - + savefile->ReadInt( num ); AFPoseJointMods.SetGranularity( 1 ); AFPoseJointMods.SetNum( num ); @@ -3261,7 +3261,7 @@ void idAnimator::Restore( idRestoreGame *savefile ) { savefile->ReadMat3( AFPoseJointMods[i].axis ); savefile->ReadVec3( AFPoseJointMods[i].origin ); } - + savefile->ReadInt( num ); AFPoseJointFrame.SetGranularity( 1 ); AFPoseJointFrame.SetNum( num ); @@ -3272,7 +3272,7 @@ void idAnimator::Restore( idRestoreGame *savefile ) { savefile->ReadFloat( AFPoseJointFrame[i].q.w ); savefile->ReadVec3( AFPoseJointFrame[i].t ); } - + savefile->ReadBounds( AFPoseBounds ); savefile->ReadInt( AFPoseTime ); @@ -3356,7 +3356,7 @@ idRenderModel *idAnimator::SetModel( const char *modelname ) { if ( !modelDef ) { return NULL; } - + idRenderModel *renderModel = modelDef->ModelHandle(); if ( !renderModel ) { modelDef = NULL; @@ -3444,7 +3444,7 @@ int idAnimator::NumAnims( void ) const { if ( !modelDef ) { return 0; } - + return modelDef->NumAnims(); } @@ -3457,7 +3457,7 @@ const idAnim *idAnimator::GetAnim( int index ) const { if ( !modelDef ) { return NULL; } - + return modelDef->GetAnim( index ); } @@ -3470,7 +3470,7 @@ int idAnimator::GetAnim( const char *name ) const { if ( !modelDef ) { return 0; } - + return modelDef->GetAnim( name ); } @@ -3483,7 +3483,7 @@ bool idAnimator::HasAnim( const char *name ) const { if ( !modelDef ) { return false; } - + return modelDef->HasAnim( name ); } @@ -3505,7 +3505,7 @@ idRenderModel *idAnimator::ModelHandle( void ) const { if ( !modelDef ) { return NULL; } - + return modelDef->ModelHandle(); } @@ -3585,7 +3585,7 @@ void idAnimator::CycleAnim( int channelNum, int animNum, int currentTime, int bl if ( !modelDef || !modelDef->GetAnim( animNum ) ) { return; } - + PushAnims( channelNum, currentTime, blendTime ); channels[ channelNum ][ 0 ].CycleAnim( modelDef, animNum, currentTime, blendTime ); if ( entity ) { @@ -3606,7 +3606,7 @@ void idAnimator::PlayAnim( int channelNum, int animNum, int currentTime, int ble if ( !modelDef || !modelDef->GetAnim( animNum ) ) { return; } - + PushAnims( channelNum, currentTime, blendTime ); channels[ channelNum ][ 0 ].PlayAnim( modelDef, animNum, currentTime, blendTime ); if ( entity ) { @@ -3634,7 +3634,7 @@ void idAnimator::SyncAnimChannels( int channelNum, int fromChannelNum, int curre toBlend.blendStartValue = 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 toBlend.AllowFrameCommands( false ); @@ -3987,7 +3987,7 @@ void idAnimator::FinishAFPose( int animNum, const idBounds &bounds, const int ti if ( !modelDef ) { return; } - + const idAnim *anim = modelDef->GetAnim( animNum ); if ( !anim ) { return; @@ -4290,7 +4290,7 @@ bool idAnimator::CreateFrame( int currentTime, bool force ) { if ( entity && ( ( g_debugAnim.GetInteger() == entity->entityNumber ) || ( g_debugAnim.GetInteger() == -2 ) ) ) { debugInfo = true; 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 { debugInfo = false; } @@ -4393,7 +4393,7 @@ bool idAnimator::CreateFrame( int currentTime, bool force ) { case JOINTMOD_LOCAL: joints[0].SetRotation( jointMod->mat * joints[0].ToMat3() ); break; - + case JOINTMOD_WORLD: joints[0].SetRotation( joints[0].ToMat3() * jointMod->mat ); break; @@ -4411,7 +4411,7 @@ bool idAnimator::CreateFrame( int currentTime, bool force ) { case JOINTMOD_LOCAL: joints[0].SetTranslation( joints[0].ToVec3() + jointMod->pos ); break; - + case JOINTMOD_LOCAL_OVERRIDE: case JOINTMOD_WORLD: case JOINTMOD_WORLD_OVERRIDE: @@ -4448,7 +4448,7 @@ bool idAnimator::CreateFrame( int currentTime, bool force ) { case JOINTMOD_LOCAL: joints[i].SetRotation( jointMod->mat * ( joints[i].ToMat3() * joints[parentNum].ToMat3() ) ); break; - + case JOINTMOD_LOCAL_OVERRIDE: joints[i].SetRotation( jointMod->mat * joints[parentNum].ToMat3() ); break; @@ -4471,7 +4471,7 @@ bool idAnimator::CreateFrame( int currentTime, bool force ) { case JOINTMOD_LOCAL: joints[i].SetTranslation( joints[parentNum].ToVec3() + ( joints[i].ToVec3() + jointMod->pos ) * joints[parentNum].ToMat3() ); break; - + case JOINTMOD_LOCAL_OVERRIDE: joints[i].SetTranslation( joints[parentNum].ToVec3() + jointMod->pos * joints[parentNum].ToMat3() ); break; @@ -5039,7 +5039,7 @@ idRenderModel *idGameEdit::ANIM_CreateMeshForAnim( idRenderModel *model, const c const idDict *args; const char *temp; idRenderModel *newmodel; - const idMD5Anim *md5anim; + const idMD5Anim *md5anim; idStr filename; idStr extension; const idAnim *anim; diff --git a/d3xp/anim/Anim_Import.cpp b/d3xp/anim/Anim_Import.cpp index ff77606..80d0571 100644 --- a/d3xp/anim/Anim_Import.cpp +++ b/d3xp/anim/Anim_Import.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -140,7 +140,7 @@ void idModelExport::LoadMayaDll( void ) { } // 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_Shutdown = ( exporterShutdown_t )sys->DLL_GetProcAddress( importDLL, "Maya_Shutdown" ); if ( !Maya_ConvertModel || !dllEntry || !Maya_Shutdown ) { @@ -168,7 +168,7 @@ void idModelExport::LoadMayaDll( void ) { ===================== 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. ===================== */ @@ -256,7 +256,7 @@ bool idModelExport::ConvertMayaToMD5( void ) { if ( Maya_Error != "Ok" ) { return false; } - + // conversion succeded return true; } @@ -415,7 +415,7 @@ int idModelExport::ParseExportSection( idParser &parser ) { return 0; } - parser.ReadToken( &token ); + parser.ReadToken( &token ); if ( token.Icmp( g_exportMask.GetString() ) ) { parser.SkipBracedSection(); return 0; diff --git a/d3xp/anim/Anim_Testmodel.cpp b/d3xp/anim/Anim_Testmodel.cpp index 769850b..99c0ac3 100644 --- a/d3xp/anim/Anim_Testmodel.cpp +++ b/d3xp/anim/Anim_Testmodel.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms Model viewing can begin with either "testmodel " -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" 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 ) EVENT( EV_FootstepLeft, idTestModel::Event_Footstep ) - EVENT( EV_FootstepRight, idTestModel::Event_Footstep ) + EVENT( EV_FootstepRight, idTestModel::Event_Footstep ) END_CLASS /* @@ -120,7 +120,7 @@ void idTestModel::Spawn( void ) { physicsObj.SetSelf( this ); physicsObj.SetOrigin( GetPhysics()->GetOrigin() ); physicsObj.SetAxis( GetPhysics()->GetAxis() ); - + if ( spawnArgs.GetVector( "mins", NULL, bounds[0] ) ) { spawnArgs.GetVector( "maxs", NULL, bounds[1] ); physicsObj.SetClipBox( bounds, 1.0f ); @@ -157,7 +157,7 @@ void idTestModel::Spawn( void ) { head.GetEntity()->SetOrigin( origin ); head.GetEntity()->SetAxis( GetPhysics()->GetAxis() ); head.GetEntity()->BindToJoint( this, animator.GetJointName( joint ), true ); - + headAnimator = head.GetEntity()->GetAnimator(); // set up the list of joints to copy to the head @@ -324,7 +324,7 @@ void idTestModel::Think( void ) { } break; } - + mode = g_testModelAnimate.GetInteger(); } @@ -414,7 +414,7 @@ void idTestModel::NextAnim( const idCmdArgs &args ) { headAnim = 0; if ( headAnimator ) { headAnimator->ClearAllAnims( gameLocal.time, 0 ); - headAnim = headAnimator->GetAnim( animname ); + headAnim = headAnimator->GetAnim( animname ); if ( !headAnim ) { headAnim = headAnimator->GetAnim( "idle" ); } @@ -456,7 +456,7 @@ void idTestModel::PrevAnim( const idCmdArgs &args ) { headAnim = 0; if ( headAnimator ) { headAnimator->ClearAllAnims( gameLocal.time, 0 ); - headAnim = headAnimator->GetAnim( animname ); + headAnim = headAnimator->GetAnim( animname ); if ( !headAnim ) { headAnim = headAnimator->GetAnim( "idle" ); } @@ -565,7 +565,7 @@ void idTestModel::TestAnim( const idCmdArgs &args ) { headAnim = 0; if ( headAnimator ) { headAnimator->ClearAllAnims( gameLocal.time, 0 ); - headAnim = headAnimator->GetAnim( animname ); + headAnim = headAnimator->GetAnim( animname ); if ( !headAnim ) { headAnim = headAnimator->GetAnim( "idle" ); if ( !headAnim ) { @@ -766,8 +766,8 @@ void idTestModel::TestModel_f( const idCmdArgs &args ) { // without appending an ase if ( name[ 0 ] != '_' ) { name.DefaultFileExtension( ".ase" ); - } - + } + #ifndef _D3XP // Maya ascii format is supported natively now if ( strstr( name, ".ma" ) || strstr( name, ".mb" ) ) { diff --git a/d3xp/anim/Anim_Testmodel.h b/d3xp/anim/Anim_Testmodel.h index a752577..e63a7c4 100644 --- a/d3xp/anim/Anim_Testmodel.h +++ b/d3xp/anim/Anim_Testmodel.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -58,19 +58,19 @@ public: void TestAnim( const idCmdArgs &args ); void BlendAnim( const idCmdArgs &args ); - static void KeepTestModel_f( const idCmdArgs &args ); - static void TestModel_f( const idCmdArgs &args ); + static void KeepTestModel_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 TestSkin_f( const idCmdArgs &args ); - static void TestShaderParm_f( const idCmdArgs &args ); - static void TestParticleStopTime_f( const idCmdArgs &args ); - static void TestAnim_f( const idCmdArgs &args ); + static void TestSkin_f( const idCmdArgs &args ); + static void TestShaderParm_f( const idCmdArgs &args ); + static void TestParticleStopTime_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 TestBlend_f( const idCmdArgs &args ); - static void TestModelNextAnim_f( const idCmdArgs &args ); - static void TestModelPrevAnim_f( const idCmdArgs &args ); - static void TestModelNextFrame_f( const idCmdArgs &args ); - static void TestModelPrevFrame_f( const idCmdArgs &args ); + static void TestBlend_f( const idCmdArgs &args ); + static void TestModelNextAnim_f( const idCmdArgs &args ); + static void TestModelPrevAnim_f( const idCmdArgs &args ); + static void TestModelNextFrame_f( const idCmdArgs &args ); + static void TestModelPrevFrame_f( const idCmdArgs &args ); private: idEntityPtr head; diff --git a/d3xp/gamesys/Callbacks.cpp b/d3xp/gamesys/Callbacks.cpp index 0f7f7f6..caacc10 100644 --- a/d3xp/gamesys/Callbacks.cpp +++ b/d3xp/gamesys/Callbacks.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -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 ); ( 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; - diff --git a/d3xp/gamesys/Class.cpp b/d3xp/gamesys/Class.cpp index e97fe88..78e4c1b 100644 --- a/d3xp/gamesys/Class.cpp +++ b/d3xp/gamesys/Class.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -62,7 +62,7 @@ initialized in any order, the constructor must handle the case that subclasses are initialized before superclasses. ================ */ -idTypeInfo::idTypeInfo( const char *classname, const char *superclass, idEventFunc *eventCallbacks, idClass *( *CreateInstance )( void ), +idTypeInfo::idTypeInfo( const char *classname, const char *superclass, idEventFunc *eventCallbacks, idClass *( *CreateInstance )( void ), void ( idClass::*Spawn )( void ), void ( idClass::*Save )( idSaveGame *savefile ) const, void ( idClass::*Restore )( idRestoreGame *savefile ) ) { idTypeInfo *type; @@ -83,7 +83,7 @@ idTypeInfo::idTypeInfo( const char *classname, const char *superclass, idEventFu // Check if any subclasses were initialized before their superclass 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" ) ) { type->super = this; } @@ -117,7 +117,7 @@ idTypeInfo::~idTypeInfo() { ================ 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. ================ */ @@ -203,7 +203,7 @@ void idTypeInfo::Init( void ) { idTypeInfo::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. ================ */ @@ -394,7 +394,7 @@ void idClass::Init( void ) { // is a subclass of another num = 0; for( c = classHierarchy.GetNext(); c != NULL; c = c->node.GetNext(), num++ ) { - c->typeNum = num; + c->typeNum = num; c->lastChild += num; } @@ -504,7 +504,7 @@ void idClass::operator delete( void *ptr ) { p = ( ( int * )ptr ) - 1; memused -= *p; 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; memused -= *p; numobjects--; - Mem_Free( p ); + Mem_Free( p ); } } @@ -629,9 +629,9 @@ bool idClass::PostEventArgs( const idEventDef *ev, int time, int numargs, ... ) idTypeInfo *c; idEvent *event; va_list args; - + assert( ev ); - + if ( !idEvent::initialized ) { return false; } @@ -830,7 +830,7 @@ bool idClass::ProcessEventArgs( const idEventDef *ev, int numargs, ... ) { int num; int data[ D_EVENT_MAXARGS ]; va_list args; - + assert( ev ); assert( idEvent::initialized ); diff --git a/d3xp/gamesys/Class.h b/d3xp/gamesys/Class.h index 7557a90..21e6873 100644 --- a/d3xp/gamesys/Class.h +++ b/d3xp/gamesys/Class.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -102,7 +102,7 @@ CLASS_DECLARATION 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 -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 incorrect. Use this on concrete classes only. ================ @@ -287,7 +287,7 @@ public: idHierarchy node; - idTypeInfo( const char *classname, const char *superclass, + idTypeInfo( const char *classname, const char *superclass, idEventFunc *eventCallbacks, idClass *( *CreateInstance )( void ), void ( idClass::*Spawn )( void ), void ( idClass::*Save )( idSaveGame *savefile ) const, void ( idClass::*Restore )( idRestoreGame *savefile ) ); ~idTypeInfo(); @@ -303,7 +303,7 @@ public: ================ 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. ================ */ @@ -330,7 +330,7 @@ ID_INLINE bool idTypeInfo::RespondsTo( const idEventDef &ev ) const { ================ 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. ================ */ diff --git a/d3xp/gamesys/DebugGraph.cpp b/d3xp/gamesys/DebugGraph.cpp index 9c28470..f79c627 100644 --- a/d3xp/gamesys/DebugGraph.cpp +++ b/d3xp/gamesys/DebugGraph.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/gamesys/DebugGraph.h b/d3xp/gamesys/DebugGraph.h index 00b357b..0729d49 100644 --- a/d3xp/gamesys/DebugGraph.h +++ b/d3xp/gamesys/DebugGraph.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/gamesys/Event.cpp b/d3xp/gamesys/Event.cpp index 3c5abed..85c16c7 100644 --- a/d3xp/gamesys/Event.cpp +++ b/d3xp/gamesys/Event.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -476,8 +476,8 @@ void idEvent::ClearEventList( void ) { // FreeEvents.Clear(); EventQueue.Clear(); - - // + + // // add the events to the free list // for( i = 0; i < MAX_EVENTS; i++ ) { @@ -733,7 +733,7 @@ void idEvent::Shutdown( void ) { } ClearEventList(); - + eventDataAllocator.Shutdown(); // say it is now shutdown @@ -962,7 +962,7 @@ void idEvent::Restore( idRestoreGame *savefile ) { /* ================ idEvent::ReadTrace - + idRestoreGame has a ReadTrace procedure, but unfortunately idEvent wants the material string name at the of the data structure rather than in the middle ================ diff --git a/d3xp/gamesys/Event.h b/d3xp/gamesys/Event.h index 1d3ef03..8af13b7 100644 --- a/d3xp/gamesys/Event.h +++ b/d3xp/gamesys/Event.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -67,7 +67,7 @@ private: public: idEventDef( const char *command, const char *formatspec = NULL, char returnType = 0 ); - + const char *GetName( void ) const; const char *GetArgFormat( void ) const; unsigned int GetFormatspecIndex( void ) const; @@ -105,7 +105,7 @@ public: static idEvent *Alloc( const idEventDef *evdef, int numargs, va_list args ); static void CopyArgs( const idEventDef *evdef, int numargs, va_list args, int data[ D_EVENT_MAXARGS ] ); - + void Free( void ); void Schedule( idClass *object, const idTypeInfo *cls, int time ); byte *GetData( void ); @@ -124,7 +124,7 @@ public: static void Restore( idRestoreGame *savefile ); // unarchives object from save game file static void SaveTrace( idSaveGame *savefile, const trace_t &trace ); static void RestoreTrace( idRestoreGame *savefile, trace_t &trace ); - + }; /* diff --git a/d3xp/gamesys/NoGameTypeInfo.h b/d3xp/gamesys/NoGameTypeInfo.h index 23d4652..5b5618e 100644 --- a/d3xp/gamesys/NoGameTypeInfo.h +++ b/d3xp/gamesys/NoGameTypeInfo.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/gamesys/SaveGame.cpp b/d3xp/gamesys/SaveGame.cpp index 3c4f80f..2f6a3c3 100644 --- a/d3xp/gamesys/SaveGame.cpp +++ b/d3xp/gamesys/SaveGame.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -36,7 +36,7 @@ If you have questions concerning this license or the applicable additional terms /* Save game related helper classes. -Save games are implemented in two classes, idSaveGame and idRestoreGame, that implement write/read functions for +Save games are implemented in two classes, idSaveGame and idRestoreGame, that implement write/read functions for common types. They're passed in to each entity and object for them to archive themselves. Each class implements save/restore functions for it's own data. When restoring, all the objects are instantiated, then the restore function is called on each, superclass first, then subclasses. @@ -138,7 +138,7 @@ void idSaveGame::CallSave_r( const idTypeInfo *cls, const idClass *obj ) { return; } } - + ( obj->*cls->Save )( this ); } @@ -227,13 +227,13 @@ void idSaveGame::WriteBool( const bool value ) { ================ idSaveGame::WriteString ================ -*/ +*/ void idSaveGame::WriteString( const char *string ) { int len; len = strlen( string ); WriteInt( len ); - file->Write( string, len ); + file->Write( string, len ); } /* @@ -705,7 +705,7 @@ void idSaveGame::WriteTrace( const trace_t &trace ) { */ void idSaveGame::WriteTraceModel( const idTraceModel &trace ) { int j, k; - + WriteInt( (int&)trace.type ); WriteInt( trace.numVerts ); for ( j = 0; j < MAX_TRACEMODEL_VERTS; j++ ) { @@ -771,7 +771,7 @@ void idSaveGame::WriteBuildNumber( const int value ) { /*********************************************************************** idRestoreGame - + ***********************************************************************/ /* @@ -901,7 +901,7 @@ void idRestoreGame::CallRestore_r( const idTypeInfo *cls, idClass *obj ) { return; } } - + ( obj->*cls->Restore )( this ); } @@ -1481,7 +1481,7 @@ void idRestoreGame::ReadTrace( trace_t &trace ) { */ void idRestoreGame::ReadTraceModel( idTraceModel &trace ) { int j, k; - + ReadInt( (int&)trace.type ); ReadInt( trace.numVerts ); for ( j = 0; j < MAX_TRACEMODEL_VERTS; j++ ) { diff --git a/d3xp/gamesys/SaveGame.h b/d3xp/gamesys/SaveGame.h index fc6f2e4..7b3be8e 100644 --- a/d3xp/gamesys/SaveGame.h +++ b/d3xp/gamesys/SaveGame.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/gamesys/SysCmds.cpp b/d3xp/gamesys/SysCmds.cpp index fc67fdb..f856962 100644 --- a/d3xp/gamesys/SysCmds.cpp +++ b/d3xp/gamesys/SysCmds.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -623,22 +623,22 @@ static void Cmd_Say( bool team, const idCmdArgs &args ) { } #ifdef CTF - // Append the player's location to team chat messages in CTF - if ( gameLocal.mpGame.IsGametypeFlagBased() && team && player ) { - idLocationEntity *locationEntity = gameLocal.LocationForPoint( player->GetEyePosition() ); - - if ( locationEntity ) { - idStr temp = "["; - temp += locationEntity->GetLocation(); - temp += "] "; - temp += text; - text = temp; - } - - } + // Append the player's location to team chat messages in CTF + if ( gameLocal.mpGame.IsGametypeFlagBased() && team && player ) { + idLocationEntity *locationEntity = gameLocal.LocationForPoint( player->GetEyePosition() ); + + if ( locationEntity ) { + idStr temp = "["; + temp += locationEntity->GetLocation(); + temp += "] "; + temp += text; + text = temp; + } + + } #endif - + } else { name = "server"; } @@ -2119,7 +2119,7 @@ static void Cmd_CloseViewNotes_f( const idCmdArgs &args ) { if ( !player ) { return; } - + player->hud->SetStateString( "viewcomments", "" ); player->hud->HandleNamedEvent( "hideViewComments" ); } @@ -2159,7 +2159,7 @@ static void Cmd_ShowViewNotes_f( const idCmdArgs &args ) { } } - if ( parser.ExpectTokenString( "view" ) && parser.Parse1DMatrix( 3, origin.ToFloatPtr() ) && + if ( parser.ExpectTokenString( "view" ) && parser.Parse1DMatrix( 3, origin.ToFloatPtr() ) && parser.Parse1DMatrix( 9, axis.ToFloatPtr() ) && parser.ExpectTokenString( "comments" ) && parser.ReadToken( &token ) ) { player->hud->SetStateString( "viewcomments", token ); player->hud->HandleNamedEvent( "showViewComments" ); @@ -2274,7 +2274,7 @@ void Cmd_NextGUI_f( const idCmdArgs &args ) { if ( ent->spawnArgs.GetString( "gui", NULL ) != NULL ) { break; } - + if ( ent->spawnArgs.GetString( "gui2", NULL ) != NULL ) { break; } @@ -2282,7 +2282,7 @@ void Cmd_NextGUI_f( const idCmdArgs &args ) { if ( ent->spawnArgs.GetString( "gui3", NULL ) != NULL ) { break; } - + // try the next entity gameLocal.lastGUIEnt = ent; } @@ -2317,7 +2317,7 @@ void Cmd_NextGUI_f( const idCmdArgs &args ) { assert( geom->facePlanes != NULL ); - modelMatrix = idMat4( renderEnt->axis, renderEnt->origin ); + modelMatrix = idMat4( renderEnt->axis, renderEnt->origin ); normal = geom->facePlanes[ 0 ].Normal() * renderEnt->axis; center = geom->bounds.GetCenter() * modelMatrix; @@ -2346,7 +2346,7 @@ void Cmd_SetActorState_f( const idCmdArgs &args ) { return; } - + if(!ent->IsType(idActor::Type)) { gameLocal.Printf( "entity not an actor\n" ); return; @@ -2381,7 +2381,7 @@ void Cmd_TestId_f( const idCmdArgs &args ) { if ( idStr::Cmpn( id, STRTABLE_ID, STRTABLE_ID_LENGTH ) != 0 ) { id = STRTABLE_ID + id; } - gameLocal.mpGame.AddChatLine( common->GetLanguageDict()->GetString( id ), "", "", "" ); + gameLocal.mpGame.AddChatLine( common->GetLanguageDict()->GetString( id ), "", "", "" ); } /* diff --git a/d3xp/gamesys/SysCmds.h b/d3xp/gamesys/SysCmds.h index dbba941..2b1abcd 100644 --- a/d3xp/gamesys/SysCmds.h +++ b/d3xp/gamesys/SysCmds.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/gamesys/SysCvar.cpp b/d3xp/gamesys/SysCvar.cpp index dd23ec7..828015e 100644 --- a/d3xp/gamesys/SysCvar.cpp +++ b/d3xp/gamesys/SysCvar.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -49,7 +49,7 @@ const char *si_gameTypeArgs[] = { "singleplayer", "deathmatch", "Tourney", "Tea const char *si_gameTypeArgs[] = { "singleplayer", "deathmatch", "Tourney", "Team DM", "Last Man", NULL }; #endif -const char *si_readyArgs[] = { "Not Ready", "Ready", NULL }; +const char *si_readyArgs[] = { "Not Ready", "Ready", NULL }; const char *si_spectateArgs[] = { "Play", "Spectate", NULL }; #ifdef _D3XP @@ -58,7 +58,7 @@ const char *ui_skinArgs[] = { "skins/characters/player/marine_mp", "skins/char const char *ui_skinArgs[] = { "skins/characters/player/marine_mp", "skins/characters/player/marine_mp_red", "skins/characters/player/marine_mp_blue", "skins/characters/player/marine_mp_green", "skins/characters/player/marine_mp_yellow", NULL }; #endif -const char *ui_teamArgs[] = { "Red", "Blue", NULL }; +const char *ui_teamArgs[] = { "Red", "Blue", NULL }; struct gameVersion_s { gameVersion_s( void ) { sprintf( string, "%s.%d%s %s %s", ENGINE_VERSION, BUILD_NUMBER, BUILD_DEBUG, BUILD_STRING, __DATE__, __TIME__ ); } @@ -101,7 +101,7 @@ idCVar si_midnight( "si_midnight", "0", // user info idCVar ui_name( "ui_name", "Player", CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE, "player name" ); idCVar ui_skin( "ui_skin", ui_skinArgs[ 0 ], CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE, "player skin", ui_skinArgs, idCmdSystem::ArgCompletion_String ); -idCVar ui_team( "ui_team", ui_teamArgs[ 0 ], CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE, "player team", ui_teamArgs, idCmdSystem::ArgCompletion_String ); +idCVar ui_team( "ui_team", ui_teamArgs[ 0 ], CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE, "player team", ui_teamArgs, idCmdSystem::ArgCompletion_String ); idCVar ui_autoSwitch( "ui_autoSwitch", "1", CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE | CVAR_BOOL, "auto switch weapon" ); idCVar ui_autoReload( "ui_autoReload", "1", CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE | CVAR_BOOL, "auto reload weapon" ); idCVar ui_showGun( "ui_showGun", "1", CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE | CVAR_BOOL, "show gun" ); @@ -112,7 +112,7 @@ idCVar ui_chat( "ui_chat", "0", CVAR_GAME | CVAR_USERINFO | CVAR_BOOL // change anytime vars idCVar developer( "developer", "0", CVAR_GAME | CVAR_BOOL, "" ); -idCVar r_aspectRatio( "r_aspectRatio", "0", CVAR_RENDERER | CVAR_INTEGER | CVAR_ARCHIVE, "aspect ratio of view:\n0 = 4:3\n1 = 16:9\n2 = 16:10", 0, 2 ); +idCVar r_aspectRatio( "r_aspectRatio", "0", CVAR_RENDERER | CVAR_INTEGER | CVAR_ARCHIVE, "aspect ratio of view:\n0 = 4:3\n1 = 16:9\n2 = 16:10", 0, 2 ); idCVar g_cinematic( "g_cinematic", "1", CVAR_GAME | CVAR_BOOL, "skips updating entities that aren't marked 'cinematic' '1' during cinematics" ); idCVar g_cinematicMaxSkipTime( "g_cinematicMaxSkipTime", "600", CVAR_GAME | CVAR_FLOAT, "# of seconds to allow game to run when skipping cinematic. prevents lock-up when cinematic doesn't end.", 0, 3600 ); @@ -225,7 +225,7 @@ idCVar g_dragShowSelection( "g_dragShowSelection", "0", CVAR_GAME | CVAR_BO idCVar g_dropItemRotation( "g_dropItemRotation", "", CVAR_GAME, "" ); #ifdef CTF -// Note: These cvars do not necessarily need to be in the shipping game. +// Note: These cvars do not necessarily need to be in the shipping game. idCVar g_flagAttachJoint( "g_flagAttachJoint", "Chest", CVAR_GAME | CVAR_CHEAT, "player joint to attach CTF flag to" ); idCVar g_flagAttachOffsetX( "g_flagAttachOffsetX", "8", CVAR_GAME | CVAR_CHEAT, "X offset of CTF flag when carried" ); idCVar g_flagAttachOffsetY( "g_flagAttachOffsetY", "4", CVAR_GAME | CVAR_CHEAT, "Y offset of CTF flag when carried" ); diff --git a/d3xp/gamesys/SysCvar.h b/d3xp/gamesys/SysCvar.h index b219348..b4c0716 100644 --- a/d3xp/gamesys/SysCvar.h +++ b/d3xp/gamesys/SysCvar.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/gamesys/TypeInfo.cpp b/d3xp/gamesys/TypeInfo.cpp index 94b6743..9e71192 100644 --- a/d3xp/gamesys/TypeInfo.cpp +++ b/d3xp/gamesys/TypeInfo.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/gamesys/TypeInfo.h b/d3xp/gamesys/TypeInfo.h index 36717d0..cd47bfd 100644 --- a/d3xp/gamesys/TypeInfo.h +++ b/d3xp/gamesys/TypeInfo.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Clip.cpp b/d3xp/physics/Clip.cpp index 06079a2..07d47e0 100644 --- a/d3xp/physics/Clip.cpp +++ b/d3xp/physics/Clip.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -72,7 +72,7 @@ idBlockAlloc clipLinkAllocator; static idList traceModelCache; static idHashIndex traceModelHash; - + /* =============== idClipModel::ClearTraceModelCache @@ -162,7 +162,7 @@ void idClipModel::SaveTraceModels( idSaveGame *savefile ) { savefile->WriteInt( traceModelCache.Num() ); for ( i = 0; i < traceModelCache.Num(); i++ ) { trmCache_t *entry = traceModelCache[i]; - + savefile->WriteTraceModel( entry->trm ); savefile->WriteFloat( entry->volume ); savefile->WriteVec3( entry->centerOfMass ); @@ -185,7 +185,7 @@ void idClipModel::RestoreTraceModels( idRestoreGame *savefile ) { for ( i = 0; i < num; i++ ) { trmCache_t *entry = new trmCache_t; - + savefile->ReadTraceModel( entry->trm ); savefile->ReadFloat( entry->volume ); @@ -667,9 +667,9 @@ clipSector_t *idClip::CreateClipSectors_r( const int depth, const idBounds &boun front = bounds; back = bounds; - + front[0][anode->axis] = back[1][anode->axis] = anode->dist; - + anode->children[0] = CreateClipSectors_r( depth+1, front, maxSector ); anode->children[1] = CreateClipSectors_r( depth+1, back, maxSector ); @@ -967,7 +967,7 @@ ID_INLINE bool TestHugeTranslation( trace_t &results, const idClipModel *mdl, co // May be important: This occurs in CTF when a player connects and spawns // in the PVS of a player that has a flag that is spawning the idMoveableItem // "nuggets". The error seems benign and the assert was getting in the way - // of testing. + // of testing. assert( 0 ); #endif diff --git a/d3xp/physics/Clip.h b/d3xp/physics/Clip.h index 7d5d857..1d79c84 100644 --- a/d3xp/physics/Clip.h +++ b/d3xp/physics/Clip.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Force.cpp b/d3xp/physics/Force.cpp index e06d97f..a835a55 100644 --- a/d3xp/physics/Force.cpp +++ b/d3xp/physics/Force.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Force.h b/d3xp/physics/Force.h index bf17875..ff6f448 100644 --- a/d3xp/physics/Force.h +++ b/d3xp/physics/Force.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Force_Constant.cpp b/d3xp/physics/Force_Constant.cpp index 8ef517d..2b15096 100644 --- a/d3xp/physics/Force_Constant.cpp +++ b/d3xp/physics/Force_Constant.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Force_Constant.h b/d3xp/physics/Force_Constant.h index 875bc3f..0466b3a 100644 --- a/d3xp/physics/Force_Constant.h +++ b/d3xp/physics/Force_Constant.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Force_Drag.cpp b/d3xp/physics/Force_Drag.cpp index a21ed77..ee41c7f 100644 --- a/d3xp/physics/Force_Drag.cpp +++ b/d3xp/physics/Force_Drag.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Force_Drag.h b/d3xp/physics/Force_Drag.h index 3979716..97465ae 100644 --- a/d3xp/physics/Force_Drag.h +++ b/d3xp/physics/Force_Drag.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Force_Field.cpp b/d3xp/physics/Force_Field.cpp index 44248d7..23f50af 100644 --- a/d3xp/physics/Force_Field.cpp +++ b/d3xp/physics/Force_Field.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -173,7 +173,7 @@ void idForce_Field::Evaluate( int time ) { if ( !entity ) { continue; } - + idPhysics *physics = entity->GetPhysics(); if ( playerOnly ) { diff --git a/d3xp/physics/Force_Field.h b/d3xp/physics/Force_Field.h index 4b47cad..e3bfc83 100644 --- a/d3xp/physics/Force_Field.h +++ b/d3xp/physics/Force_Field.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Force_Grab.cpp b/d3xp/physics/Force_Grab.cpp index 420eb1c..d538f1a 100644 --- a/d3xp/physics/Force_Grab.cpp +++ b/d3xp/physics/Force_Grab.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -43,7 +43,7 @@ idForce_Grab::Save ================ */ void idForce_Grab::Save( idSaveGame *savefile ) const { - + savefile->WriteFloat( damping ); savefile->WriteVec3( goalPosition ); savefile->WriteFloat( distanceToGoal ); diff --git a/d3xp/physics/Force_Grab.h b/d3xp/physics/Force_Grab.h index 6abad2f..b06ab4d 100644 --- a/d3xp/physics/Force_Grab.h +++ b/d3xp/physics/Force_Grab.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Force_Spring.cpp b/d3xp/physics/Force_Spring.cpp index 1df7d11..93a6d19 100644 --- a/d3xp/physics/Force_Spring.cpp +++ b/d3xp/physics/Force_Spring.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Force_Spring.h b/d3xp/physics/Force_Spring.h index e87a863..06db706 100644 --- a/d3xp/physics/Force_Spring.h +++ b/d3xp/physics/Force_Spring.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Physics.cpp b/d3xp/physics/Physics.cpp index 3d2e8f4..bb48704 100644 --- a/d3xp/physics/Physics.cpp +++ b/d3xp/physics/Physics.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Physics.h b/d3xp/physics/Physics.h index 92d3c97..3d70adb 100644 --- a/d3xp/physics/Physics.h +++ b/d3xp/physics/Physics.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -158,7 +158,7 @@ public: // common physics interface virtual const contactInfo_t &GetContact( int num ) const = 0; virtual void ClearContacts( void ) = 0; virtual void AddContactEntity( idEntity *e ) = 0; - virtual void RemoveContactEntity( idEntity *e ) = 0; + virtual void RemoveContactEntity( idEntity *e ) = 0; // ground contacts virtual bool HasGroundContacts( void ) const = 0; virtual bool IsGroundEntity( int entityNum ) const = 0; diff --git a/d3xp/physics/Physics_AF.cpp b/d3xp/physics/Physics_AF.cpp index 9dc60b0..79528d6 100644 --- a/d3xp/physics/Physics_AF.cpp +++ b/d3xp/physics/Physics_AF.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -1301,12 +1301,12 @@ void idAFConstraint_UniversalJoint::DebugDraw( void ) { d1 = axis1 * body1->GetWorldAxis(); if ( master ) { - a2 = master->GetWorldOrigin() + anchor2 * master->GetWorldAxis(); + a2 = master->GetWorldOrigin() + anchor2 * master->GetWorldAxis(); s2 = shaft2 * master->GetWorldAxis(); d2 = axis2 * master->GetWorldAxis(); } else { - a2 = anchor2; + a2 = anchor2; s2 = shaft2; d2 = axis2; } @@ -5337,7 +5337,7 @@ void idPhysics_AF::Evolve( float timeStep ) { idVec6 force; idRotation rotation; float vSqr, maxLinearVelocity, maxAngularVelocity; - + maxLinearVelocity = af_maxLinearVelocity.GetFloat() / timeStep; maxAngularVelocity = af_maxAngularVelocity.GetFloat() / timeStep; diff --git a/d3xp/physics/Physics_AF.h b/d3xp/physics/Physics_AF.h index 2dc5179..4d712b1 100644 --- a/d3xp/physics/Physics_AF.h +++ b/d3xp/physics/Physics_AF.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Physics_Actor.cpp b/d3xp/physics/Physics_Actor.cpp index 6bdb726..5237272 100644 --- a/d3xp/physics/Physics_Actor.cpp +++ b/d3xp/physics/Physics_Actor.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Physics_Actor.h b/d3xp/physics/Physics_Actor.h index 3c0b0f4..0e4fec1 100644 --- a/d3xp/physics/Physics_Actor.h +++ b/d3xp/physics/Physics_Actor.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Physics_Base.cpp b/d3xp/physics/Physics_Base.cpp index 57a8518..ee421c7 100644 --- a/d3xp/physics/Physics_Base.cpp +++ b/d3xp/physics/Physics_Base.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Physics_Base.h b/d3xp/physics/Physics_Base.h index 6ff655c..a0ac05b 100644 --- a/d3xp/physics/Physics_Base.h +++ b/d3xp/physics/Physics_Base.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Physics_Monster.cpp b/d3xp/physics/Physics_Monster.cpp index f985912..c5b919c 100644 --- a/d3xp/physics/Physics_Monster.cpp +++ b/d3xp/physics/Physics_Monster.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -108,8 +108,8 @@ monsterMoveResult_t idPhysics_Monster::SlideMove( idVec3 &start, idVec3 &velocit if ( tr.c.entityNum != ENTITYNUM_NONE ) { blockingEntity = gameLocal.entities[ tr.c.entityNum ]; - } - + } + // clip the movement delta and velocity move.ProjectOntoPlane( tr.c.normal, OVERCLIP ); velocity.ProjectOntoPlane( tr.c.normal, OVERCLIP ); @@ -252,7 +252,7 @@ idPhysics_Monster::idPhysics_Monster( void ) { memset( ¤t, 0, sizeof( current ) ); current.atRest = -1; saved = current; - + delta.Zero(); maxStepHeight = 18.0f; minFloorCosine = 0.7f; @@ -310,7 +310,7 @@ void idPhysics_Monster::Save( idSaveGame *savefile ) const { savefile->WriteBool( fly ); savefile->WriteBool( useVelocityMove ); savefile->WriteBool( noImpact ); - + savefile->WriteInt( (int)moveResult ); savefile->WriteObject( blockingEntity ); } @@ -501,7 +501,7 @@ bool idPhysics_Monster::Evaluate( int timeStepMSec, int endTimeMSec ) { delta = current.velocity * timeStep; if ( delta != vec3_origin ) { moveResult = idPhysics_Monster::SlideMove( current.origin, current.velocity, delta ); - delta.Zero(); + delta.Zero(); } if ( !fly ) { diff --git a/d3xp/physics/Physics_Monster.h b/d3xp/physics/Physics_Monster.h index 9ae7303..5492324 100644 --- a/d3xp/physics/Physics_Monster.h +++ b/d3xp/physics/Physics_Monster.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Physics_Parametric.cpp b/d3xp/physics/Physics_Parametric.cpp index 3628d73..2208b94 100644 --- a/d3xp/physics/Physics_Parametric.cpp +++ b/d3xp/physics/Physics_Parametric.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Physics_Parametric.h b/d3xp/physics/Physics_Parametric.h index b13f48b..3cbd6a5 100644 --- a/d3xp/physics/Physics_Parametric.h +++ b/d3xp/physics/Physics_Parametric.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Physics_Player.cpp b/d3xp/physics/Physics_Player.cpp index b32e6d5..bc042d3 100644 --- a/d3xp/physics/Physics_Player.cpp +++ b/d3xp/physics/Physics_Player.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -134,7 +134,7 @@ void idPhysics_Player::Accelerate( const idVec3 &wishdir, const float wishspeed, if (accelspeed > addspeed) { accelspeed = addspeed; } - + current.velocity += accelspeed * wishdir; #else // proper way (avoids strafe jump maxspeed bug), but feels bad @@ -295,7 +295,7 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool current.velocity *= 1.0f - idMath::ClampFloat( 0.0f, 1000.0f, totalMass - 20.0f ) * ( 1.0f / 950.0f ); pushed = true; } - + current.origin = trace.endpos; time_left -= time_left * trace.fraction; @@ -441,7 +441,7 @@ void idPhysics_Player::Friction( void ) { idVec3 vel; float speed, newspeed, control; float drop; - + vel = current.velocity; if ( walking ) { // ignore slope movement, remove all velocity in gravity direction @@ -1011,7 +1011,7 @@ void idPhysics_Player::CheckGround( void ) { walking = false; return; } - + // slopes that are too steep will not be considered onground if ( ( groundTrace.c.normal * -gravityNormal ) < MIN_WALK_NORMAL ) { if ( debugLevel ) { @@ -1123,7 +1123,7 @@ void idPhysics_Player::CheckLadder( void ) { idVec3 forward, start, end; trace_t trace; float tracedist; - + if ( current.movementTime ) { return; } @@ -2042,4 +2042,3 @@ void idPhysics_Player::ReadFromSnapshot( const idBitMsgDelta &msg ) { clipModel->Link( gameLocal.clip, self, 0, current.origin, clipModel->GetAxis() ); } } - diff --git a/d3xp/physics/Physics_Player.h b/d3xp/physics/Physics_Player.h index 494fdb2..f3aa852 100644 --- a/d3xp/physics/Physics_Player.h +++ b/d3xp/physics/Physics_Player.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Physics_RigidBody.cpp b/d3xp/physics/Physics_RigidBody.cpp index 850c8fc..aaefd04 100644 --- a/d3xp/physics/Physics_RigidBody.cpp +++ b/d3xp/physics/Physics_RigidBody.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Physics_RigidBody.h b/d3xp/physics/Physics_RigidBody.h index bce2009..1e9874d 100644 --- a/d3xp/physics/Physics_RigidBody.h +++ b/d3xp/physics/Physics_RigidBody.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Physics_Static.cpp b/d3xp/physics/Physics_Static.cpp index 0c65ec7..4ff07e2 100644 --- a/d3xp/physics/Physics_Static.cpp +++ b/d3xp/physics/Physics_Static.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -542,7 +542,7 @@ void idPhysics_Static::ClipTranslation( trace_t &results, const idVec3 &translat } else { gameLocal.clip.Translation( results, current.origin, current.origin + translation, clipModel, current.axis, MASK_SOLID, self ); - } + } } /* diff --git a/d3xp/physics/Physics_Static.h b/d3xp/physics/Physics_Static.h index 650d236..e8002e1 100644 --- a/d3xp/physics/Physics_Static.h +++ b/d3xp/physics/Physics_Static.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Physics_StaticMulti.cpp b/d3xp/physics/Physics_StaticMulti.cpp index 57f840e..7b87b5b 100644 --- a/d3xp/physics/Physics_StaticMulti.cpp +++ b/d3xp/physics/Physics_StaticMulti.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -762,7 +762,7 @@ void idPhysics_StaticMulti::DisableClip( void ) { int i; for ( i = 0; i < clipModels.Num(); i++ ) { - if ( clipModels[i] ) { + if ( clipModels[i] ) { clipModels[i]->Disable(); } } @@ -792,7 +792,7 @@ void idPhysics_StaticMulti::UnlinkClip( void ) { int i; for ( i = 0; i < clipModels.Num(); i++ ) { - if ( clipModels[i] ) { + if ( clipModels[i] ) { clipModels[i]->Unlink(); } } @@ -934,7 +934,7 @@ void idPhysics_StaticMulti::SetMaster( idEntity *master, const bool orientated ) // transform from world space to master space self->GetMasterPosition( masterOrigin, masterAxis ); for ( i = 0; i < clipModels.Num(); i++ ) { - current[i].localOrigin = ( current[i].origin - masterOrigin ) * masterAxis.Transpose(); + current[i].localOrigin = ( current[i].origin - masterOrigin ) * masterAxis.Transpose(); if ( orientated ) { current[i].localAxis = current[i].axis * masterAxis.Transpose(); } else { diff --git a/d3xp/physics/Physics_StaticMulti.h b/d3xp/physics/Physics_StaticMulti.h index 65d7dd3..a6055f9 100644 --- a/d3xp/physics/Physics_StaticMulti.h +++ b/d3xp/physics/Physics_StaticMulti.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/physics/Push.cpp b/d3xp/physics/Push.cpp index 1b90833..3cb5c34 100644 --- a/d3xp/physics/Push.cpp +++ b/d3xp/physics/Push.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -1394,7 +1394,7 @@ float idPush::ClipPush( trace_t &results, idEntity *pusher, const int flags, idRotation rotation; float mass; - mass = 0.0f; + mass = 0.0f; results.fraction = 1.0f; results.endpos = newOrigin; diff --git a/d3xp/physics/Push.h b/d3xp/physics/Push.h index 9a38dce..b122d01 100644 --- a/d3xp/physics/Push.h +++ b/d3xp/physics/Push.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/d3xp/script/Script_Compiler.cpp b/d3xp/script/Script_Compiler.cpp index 2f94bad..f427bcf 100644 --- a/d3xp/script/Script_Compiler.cpp +++ b/d3xp/script/Script_Compiler.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -47,22 +47,22 @@ char *idCompiler::punctuation[] = { opcode_t idCompiler::opcodes[] = { { "", "RETURN", -1, false, &def_void, &def_void, &def_void }, - + { "++", "UINC_F", 1, true, &def_float, &def_void, &def_void }, { "++", "UINCP_F", 1, true, &def_object, &def_field, &def_float }, { "--", "UDEC_F", 1, true, &def_float, &def_void, &def_void }, { "--", "UDECP_F", 1, true, &def_object, &def_field, &def_float }, { "~", "COMP_F", -1, false, &def_float, &def_void, &def_float }, - + { "*", "MUL_F", 3, false, &def_float, &def_float, &def_float }, { "*", "MUL_V", 3, false, &def_vector, &def_vector, &def_float }, { "*", "MUL_FV", 3, false, &def_float, &def_vector, &def_vector }, { "*", "MUL_VF", 3, false, &def_vector, &def_float, &def_vector }, - + { "/", "DIV", 3, false, &def_float, &def_float, &def_float }, { "%", "MOD_F", 3, false, &def_float, &def_float, &def_float }, - + { "+", "ADD_F", 4, false, &def_float, &def_float, &def_float }, { "+", "ADD_V", 4, false, &def_vector, &def_vector, &def_vector }, { "+", "ADD_S", 4, false, &def_string, &def_string, &def_string }, @@ -70,10 +70,10 @@ opcode_t idCompiler::opcodes[] = { { "+", "ADD_SF", 4, false, &def_string, &def_float, &def_string }, { "+", "ADD_VS", 4, false, &def_vector, &def_string, &def_string }, { "+", "ADD_SV", 4, false, &def_string, &def_vector, &def_string }, - + { "-", "SUB_F", 4, false, &def_float, &def_float, &def_float }, { "-", "SUB_V", 4, false, &def_vector, &def_vector, &def_vector }, - + { "==", "EQ_F", 5, false, &def_float, &def_float, &def_float }, { "==", "EQ_V", 5, false, &def_vector, &def_vector, &def_float }, { "==", "EQ_S", 5, false, &def_string, &def_string, &def_float }, @@ -81,20 +81,20 @@ opcode_t idCompiler::opcodes[] = { { "==", "EQ_EO", 5, false, &def_entity, &def_object, &def_float }, { "==", "EQ_OE", 5, false, &def_object, &def_entity, &def_float }, { "==", "EQ_OO", 5, false, &def_object, &def_object, &def_float }, - + { "!=", "NE_F", 5, false, &def_float, &def_float, &def_float }, { "!=", "NE_V", 5, false, &def_vector, &def_vector, &def_float }, { "!=", "NE_S", 5, false, &def_string, &def_string, &def_float }, - { "!=", "NE_E", 5, false, &def_entity, &def_entity, &def_float }, + { "!=", "NE_E", 5, false, &def_entity, &def_entity, &def_float }, { "!=", "NE_EO", 5, false, &def_entity, &def_object, &def_float }, { "!=", "NE_OE", 5, false, &def_object, &def_entity, &def_float }, { "!=", "NE_OO", 5, false, &def_object, &def_object, &def_float }, - + { "<=", "LE", 5, false, &def_float, &def_float, &def_float }, { ">=", "GE", 5, false, &def_float, &def_float, &def_float }, { "<", "LT", 5, false, &def_float, &def_float, &def_float }, { ">", "GT", 5, false, &def_float, &def_float, &def_float }, - + { ".", "INDIRECT_F", 1, false, &def_object, &def_field, &def_float }, { ".", "INDIRECT_V", 1, false, &def_object, &def_field, &def_vector }, { ".", "INDIRECT_S", 1, false, &def_object, &def_field, &def_string }, @@ -116,7 +116,7 @@ opcode_t idCompiler::opcodes[] = { { "=", "STORE_OBJENT", 6, true, &def_object, &def_entity, &def_object }, { "=", "STORE_OBJ", 6, true, &def_object, &def_object, &def_object }, { "=", "STORE_OBJENT", 6, true, &def_entity, &def_object, &def_object }, - + { "=", "STORE_FTOS", 6, true, &def_string, &def_float, &def_string }, { "=", "STORE_BTOS", 6, true, &def_string, &def_boolean, &def_string }, { "=", "STORE_VTOS", 6, true, &def_string, &def_vector, &def_string }, @@ -137,7 +137,7 @@ opcode_t idCompiler::opcodes[] = { { "<=>", "STOREP_VTOS", 6, true, &def_pointer, &def_vector, &def_string }, { "<=>", "STOREP_FTOBOOL", 6, true, &def_pointer, &def_float, &def_boolean }, { "<=>", "STOREP_BOOLTOF", 6, true, &def_pointer, &def_boolean, &def_float }, - + { "*=", "UMUL_F", 6, true, &def_float, &def_float, &def_void }, { "*=", "UMUL_V", 6, true, &def_vector, &def_float, &def_void }, { "/=", "UDIV_F", 6, true, &def_float, &def_float, &def_void }, @@ -149,7 +149,7 @@ opcode_t idCompiler::opcodes[] = { { "-=", "USUB_V", 6, true, &def_vector, &def_vector, &def_void }, { "&=", "UAND_F", 6, true, &def_float, &def_float, &def_void }, { "|=", "UOR_F", 6, true, &def_float, &def_float, &def_void }, - + { "!", "NOT_BOOL", -1, false, &def_boolean, &def_void, &def_float }, { "!", "NOT_F", -1, false, &def_float, &def_void, &def_float }, { "!", "NOT_V", -1, false, &def_vector, &def_void, &def_float }, @@ -160,15 +160,15 @@ opcode_t idCompiler::opcodes[] = { { "", "NEG_V", -1, false, &def_vector, &def_void, &def_vector }, { "int", "INT_F", -1, false, &def_float, &def_void, &def_float }, - + { "", "IF", -1, false, &def_float, &def_jumpoffset, &def_void }, { "", "IFNOT", -1, false, &def_float, &def_jumpoffset, &def_void }, - + // calls returns REG_RETURN { "", "CALL", -1, false, &def_function, &def_argsize, &def_void }, { "", "THREAD", -1, false, &def_function, &def_argsize, &def_void }, { "", "OBJTHREAD", -1, false, &def_function, &def_argsize, &def_void }, - + { "", "PUSH_F", -1, false, &def_float, &def_float, &def_void }, { "", "PUSH_V", -1, false, &def_vector, &def_vector, &def_void }, { "", "PUSH_S", -1, false, &def_string, &def_string, &def_void }, @@ -180,9 +180,9 @@ opcode_t idCompiler::opcodes[] = { { "", "PUSH_FTOB", -1, false, &def_boolean, &def_float, &def_void }, { "", "PUSH_VTOS", -1, false, &def_string, &def_vector, &def_void }, { "", "PUSH_BTOS", -1, false, &def_string, &def_boolean, &def_void }, - + { "", "GOTO", -1, false, &def_jumpoffset, &def_void, &def_void }, - + { "&&", "AND", 7, false, &def_float, &def_float, &def_float }, { "&&", "AND_BOOLF", 7, false, &def_boolean, &def_float, &def_float }, { "&&", "AND_FBOOL", 7, false, &def_float, &def_boolean, &def_float }, @@ -191,7 +191,7 @@ opcode_t idCompiler::opcodes[] = { { "||", "OR_BOOLF", 7, false, &def_boolean, &def_float, &def_float }, { "||", "OR_FBOOL", 7, false, &def_float, &def_boolean, &def_float }, { "||", "OR_BOOLBOOL", 7, false, &def_boolean, &def_boolean, &def_float }, - + { "&", "BITAND", 3, false, &def_float, &def_float, &def_float }, { "|", "BITOR", 3, false, &def_float, &def_float, &def_float }, @@ -289,7 +289,7 @@ ID_INLINE idVarDef *idCompiler::VirtualFunctionConstant( idVarDef *func ) { if ( eval._int < 0 ) { Error( "Function '%s' not found in scope '%s'", func->Name(), func->scope->Name() ); } - + return GetImmediate( &type_virtualfunction, &eval, "" ); } @@ -434,8 +434,8 @@ idVarDef *idCompiler::FindImmediate( const idTypeDef *type, const eval_t *eval, case ev_vector : - if ( ( def->value.vectorPtr->x == eval->vector[ 0 ] ) && - ( def->value.vectorPtr->y == eval->vector[ 1 ] ) && + if ( ( def->value.vectorPtr->x == eval->vector[ 0 ] ) && + ( def->value.vectorPtr->y == eval->vector[ 1 ] ) && ( def->value.vectorPtr->z == eval->vector[ 2 ] ) ) { return def; } @@ -534,7 +534,7 @@ idVarDef *idCompiler::OptimizeOpcode( const opcode_t *op, idVarDef *var_a, idVar case OP_UDIV_F: c._float = Divide( *var_b->value.floatPtr, *var_a->value.floatPtr ); type = &type_float; break; case OP_UMOD_F: c._float = ( int ) *var_b->value.floatPtr % ( int )*var_a->value.floatPtr; type = &type_float; break; case OP_UOR_F: c._float = ( int )*var_b->value.floatPtr | ( int )*var_a->value.floatPtr; type = &type_float; break; - case OP_UAND_F: c._float = ( int )*var_b->value.floatPtr & ( int )*var_a->value.floatPtr; type = &type_float; break; + case OP_UAND_F: c._float = ( int )*var_b->value.floatPtr & ( int )*var_a->value.floatPtr; type = &type_float; break; case OP_UINC_F: c._float = *var_a->value.floatPtr + 1; type = &type_float; break; case OP_UDEC_F: c._float = *var_a->value.floatPtr - 1; type = &type_float; break; case OP_COMP_F: c._float = ( float )~( int )*var_a->value.floatPtr; type = &type_float; break; @@ -583,11 +583,11 @@ idVarDef *idCompiler::EmitOpcode( const opcode_t *op, idVarDef *var_a, idVarDef if ( var_b && !strcmp( var_b->Name(), RESULT_STRING ) ) { var_b->numUsers++; } - + statement = gameLocal.program.AllocStatement(); statement->linenumber = currentLineNumber; - statement->file = currentFileNumber; - + statement->file = currentFileNumber; + if ( ( op->type_c == &def_void ) || op->rightAssociative ) { // ifs, gotos, and assignments don't need vars allocated var_c = NULL; @@ -668,8 +668,8 @@ void idCompiler::NextToken( void ) { immediateType = NULL; memset( &immediate, 0, sizeof( immediate ) ); - // Save the token's line number and filename since when we emit opcodes the current - // token is always the next one to be read + // Save the token's line number and filename since when we emit opcodes the current + // token is always the next one to be read currentLineNumber = token.line; currentFileNumber = gameLocal.program.GetFilenum( parserPtr->GetFileName() ); @@ -788,9 +788,9 @@ bool idCompiler::CheckToken( const char *string ) { if ( token != string ) { return false; } - + NextToken(); - + return true; } @@ -851,7 +851,7 @@ Parses a variable type, including functions types */ idTypeDef *idCompiler::CheckType( void ) { idTypeDef *type; - + if ( token == "float" ) { type = &type_float; } else if ( token == "vector" ) { @@ -876,7 +876,7 @@ idTypeDef *idCompiler::CheckType( void ) { type = NULL; } } - + return type; } @@ -889,7 +889,7 @@ Parses a variable type, including functions types */ idTypeDef *idCompiler::ParseType( void ) { idTypeDef *type; - + type = CheckType(); if ( !type ) { Error( "\"%s\" is not a type", token.c_str() ); @@ -904,7 +904,7 @@ idTypeDef *idCompiler::ParseType( void ) { } NextToken(); - + return type; } @@ -935,8 +935,8 @@ idVarDef *idCompiler::EmitFunctionParms( int op, idVarDef *func, int startarg, i const idTypeDef *funcArg; idVarDef *returnDef; idTypeDef *returnType; - int arg; - int size; + int arg; + int size; int resultOp; type = func->TypeDef(); @@ -968,7 +968,7 @@ idVarDef *idCompiler::EmitFunctionParms( int op, idVarDef *func, int startarg, i arg++; } while( CheckToken( "," ) ); - + ExpectToken( ")" ); } @@ -1199,7 +1199,7 @@ idVarDef *idCompiler::LookupDef( const char *name, const idVarDef *baseobj ) { type_c = field->TypeDef()->ReturnType()->Type(); } else { type_c = field->TypeDef()->FieldType()->Type(); // field access gets type from field - if ( CheckToken( "++" ) ) { + if ( CheckToken( "++" ) ) { if ( type_c != ev_float ) { Error( "Invalid type for ++" ); } @@ -1215,9 +1215,9 @@ idVarDef *idCompiler::LookupDef( const char *name, const idVarDef *baseobj ) { } op = &opcodes[ OP_INDIRECT_F ]; - while( ( op->type_a->Type() != ev_object ) + while( ( op->type_a->Type() != ev_object ) || ( type_b != op->type_b->Type() ) || ( type_c != op->type_c->Type() ) ) { - if ( ( op->priority == FUNCTION_PRIORITY ) && ( op->type_a->Type() == ev_object ) && ( op->type_c->Type() == ev_void ) && + if ( ( op->priority == FUNCTION_PRIORITY ) && ( op->type_a->Type() == ev_object ) && ( op->type_c->Type() == ev_void ) && ( type_c != op->type_c->Type() ) ) { // catches object calls that return a value break; @@ -1256,7 +1256,7 @@ idVarDef *idCompiler::ParseValue( void ) { idVarDef *def; idVarDef *namespaceDef; idStr name; - + if ( immediateType == &type_entity ) { // if an immediate entity ($-prefaced name) then create or lookup a def for it. // when entities are spawned, they'll lookup the def and point it to them. @@ -1303,8 +1303,8 @@ idCompiler::GetTerm */ idVarDef *idCompiler::GetTerm( void ) { idVarDef *e; - int op; - + int op; + if ( !immediateType && CheckToken( "~" ) ) { e = GetExpression( TILDE_PRIORITY ); switch( e->Type() ) { @@ -1399,7 +1399,7 @@ idVarDef *idCompiler::GetTerm( void ) { return EmitOpcode( &opcodes[ op ], e, 0 ); } } - + if ( CheckToken( "int" ) ) { ExpectToken( "(" ); @@ -1412,7 +1412,7 @@ idVarDef *idCompiler::GetTerm( void ) { return EmitOpcode( OP_INT_F, e, 0 ); } - + if ( CheckToken( "thread" ) ) { callthread = true; e = GetExpression( FUNCTION_PRIORITY ); @@ -1425,14 +1425,14 @@ idVarDef *idCompiler::GetTerm( void ) { gameLocal.program.returnDef->SetTypeDef( &type_float ); return gameLocal.program.returnDef; } - + if ( !immediateType && CheckToken( "(" ) ) { e = GetExpression( TOP_PRIORITY ); ExpectToken( ")" ); return e; } - + return ParseValue(); } @@ -1449,7 +1449,7 @@ bool idCompiler::TypeMatches( etype_t type1, etype_t type2 ) const { //if ( ( type1 == ev_entity ) && ( type2 == ev_object ) ) { // return true; //} - + //if ( ( type2 == ev_entity ) && ( type1 == ev_object ) ) { // return true; //} @@ -1468,14 +1468,14 @@ idVarDef *idCompiler::GetExpression( int priority ) { idVarDef *e; idVarDef *e2; const idVarDef *oldtype; - etype_t type_a; - etype_t type_b; - etype_t type_c; - + etype_t type_a; + etype_t type_b; + etype_t type_c; + if ( priority == 0 ) { return GetTerm(); } - + e = GetExpression( priority - 1 ); if ( token == ";" ) { // save us from searching through the opcodes unneccesarily @@ -1536,7 +1536,7 @@ idVarDef *idCompiler::GetExpression( int priority ) { // restore type basetype = oldtype; - + // type check type_a = e->Type(); type_b = e2->Type(); @@ -1582,7 +1582,7 @@ idVarDef *idCompiler::GetExpression( int priority ) { e = ParseObjectCall( e, e2 ); } break; - + case OP_EVENTCALL : ExpectToken( "(" ); if ( ( e2->initialized != idVarDef::uninitialized ) && e2->value.functionPtr->eventdef ) { @@ -1621,7 +1621,7 @@ idVarDef *idCompiler::GetExpression( int priority ) { Error( "type mismatch for '%s'", op->name ); } } - + if ( op->rightAssociative ) { e = EmitOpcode( op, e2, e ); } else { @@ -1675,8 +1675,8 @@ idCompiler::ParseReturnStatement */ void idCompiler::ParseReturnStatement( void ) { idVarDef *e; - etype_t type_a; - etype_t type_b; + etype_t type_a; + etype_t type_b; opcode_t *op; if ( CheckToken( ";" ) ) { @@ -1723,7 +1723,7 @@ void idCompiler::ParseReturnStatement( void ) { } EmitOpcode( OP_RETURN, 0, 0 ); } - + /* ================ idCompiler::ParseWhileStatement @@ -1737,7 +1737,7 @@ void idCompiler::ParseWhileStatement( void ) { loopDepth++; ExpectToken( "(" ); - + patch2 = gameLocal.program.NumStatements(); e = GetExpression( TOP_PRIORITY ); ExpectToken( ")" ); @@ -1748,7 +1748,7 @@ void idCompiler::ParseWhileStatement( void ) { EmitOpcode( OP_GOTO, JumpTo( patch2 ), 0 ); } else { patch1 = gameLocal.program.NumStatements(); - EmitOpcode( OP_IFNOT, e, 0 ); + EmitOpcode( OP_IFNOT, e, 0 ); ParseStatement(); EmitOpcode( OP_GOTO, JumpTo( patch2 ), 0 ); gameLocal.program.GetStatement( patch1 ).b = JumpFrom( patch1 ); @@ -1812,7 +1812,7 @@ void idCompiler::ParseForStatement( void ) { start = gameLocal.program.NumStatements(); ExpectToken( "(" ); - + // init if ( !CheckToken( ";" ) ) { do { @@ -1842,7 +1842,7 @@ void idCompiler::ParseForStatement( void ) { do { GetExpression( TOP_PRIORITY ); } while( CheckToken( "," ) ); - + ExpectToken( ")" ); // goto patch4 @@ -1912,7 +1912,7 @@ void idCompiler::ParseIfStatement( void ) { EmitOpcode( OP_IFNOT, e, 0 ); ParseStatement(); - + if ( CheckToken( "else" ) ) { patch2 = gameLocal.program.NumStatements(); EmitOpcode( OP_GOTO, 0, 0 ); @@ -1941,13 +1941,13 @@ void idCompiler::ParseStatement( void ) { } while( !CheckToken( "}" ) ); return; - } + } if ( CheckToken( "return" ) ) { ParseReturnStatement(); return; } - + if ( CheckToken( "while" ) ) { ParseWhileStatement(); return; @@ -2031,7 +2031,7 @@ void idCompiler::ParseObjectDef( const char *objname ) { Error( "Objects may only inherit from objects." ); } } - + objtype = gameLocal.program.AllocType( ev_object, NULL, objname, parentType == &type_object ? 0 : parentType->Size(), parentType ); objtype->def = gameLocal.program.AllocDef( objtype, objname, scope, true ); scope = objtype->def; @@ -2086,7 +2086,7 @@ parse a function type idTypeDef *idCompiler::ParseFunction( idTypeDef *returnType, const char *name ) { idTypeDef newtype( ev_function, NULL, name, type_function.Size(), returnType ); idTypeDef *type; - + if ( scope->Type() != ev_namespace ) { // create self pointer newtype.AddFunctionParm( scope->TypeDef(), "self" ); @@ -2116,8 +2116,8 @@ void idCompiler::ParseFunctionDef( idTypeDef *returnType, const char *name ) { idVarDef *def; const idVarDef *parm; idVarDef *oldscope; - int i; - int numParms; + int i; + int numParms; const idTypeDef *parmType; function_t *func; statement_t *pos; @@ -2268,7 +2268,7 @@ void idCompiler::ParseVariableDef( idTypeDef *type, const char *name ) { if ( def ) { Error( "%s redeclared", name ); } - + def = gameLocal.program.AllocDef( type, name, scope, false ); // check for an initialization @@ -2386,7 +2386,7 @@ idTypeDef *idCompiler::GetTypeForEventArg( char argType ) { type = NULL; break; } - + return type; } @@ -2399,7 +2399,7 @@ void idCompiler::ParseEventDef( idTypeDef *returnType, const char *name ) { const idTypeDef *expectedType; idTypeDef *argType; idTypeDef *type; - int i; + int i; int num; const char *format; const idEventDef *ev; @@ -2434,7 +2434,7 @@ void idCompiler::ParseEventDef( idTypeDef *returnType, const char *name ) { argType = ParseType(); ParseName( parmName ); if ( argType != expectedType ) { - Error( "The type of parm %d ('%s') does not match the internal type '%s' in definition of '%s' event.", + Error( "The type of parm %d ('%s') does not match the internal type '%s' in definition of '%s' event.", i + 1, parmName.c_str(), expectedType->Name(), name ); } @@ -2483,7 +2483,7 @@ Called at the outer layer and when a local statement is hit ================ */ void idCompiler::ParseDefs( void ) { - idStr name; + idStr name; idTypeDef *type; idVarDef *def; idVarDef *oldscope; @@ -2500,7 +2500,7 @@ void idCompiler::ParseDefs( void ) { ParseEventDef( type, name ); return; } - + ParseName( name ); if ( type == &type_namespace ) { @@ -2586,7 +2586,7 @@ void idCompiler::CompileFile( const char *text, const char *filename, bool toCon immediateType = NULL; currentLineNumber = 0; console = toConsole; - + memset( &immediate, 0, sizeof( immediate ) ); parser.SetFlags( LEXFL_ALLOWMULTICHARLITERALS ); @@ -2624,7 +2624,7 @@ void idCompiler::CompileFile( const char *text, const char *filename, bool toCon ParseNamespace( &def_namespace ); } } - + catch( idCompileError &err ) { idStr error; diff --git a/d3xp/script/Script_Compiler.h b/d3xp/script/Script_Compiler.h index 3e26d8e..f943379 100644 --- a/d3xp/script/Script_Compiler.h +++ b/d3xp/script/Script_Compiler.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -68,7 +68,7 @@ enum { OP_ADD_SV, OP_SUB_F, OP_SUB_V, - + OP_EQ_F, OP_EQ_V, OP_EQ_S, @@ -76,7 +76,7 @@ enum { OP_EQ_EO, OP_EQ_OE, OP_EQ_OO, - + OP_NE_F, OP_NE_V, OP_NE_S, @@ -84,7 +84,7 @@ enum { OP_NE_EO, OP_NE_OE, OP_NE_OO, - + OP_LE, OP_GE, OP_LT, @@ -96,7 +96,7 @@ enum { OP_INDIRECT_ENT, OP_INDIRECT_BOOL, OP_INDIRECT_OBJ, - + OP_ADDRESS, OP_EVENTCALL, @@ -184,7 +184,7 @@ enum { OP_OR_BOOLF, OP_OR_FBOOL, OP_OR_BOOLBOOL, - + OP_BITAND, OP_BITOR, @@ -202,10 +202,10 @@ private: idParser parser; idParser *parserPtr; idToken token; - + idTypeDef *immediateType; eval_t immediate; - + bool eof; bool console; bool callthread; @@ -214,7 +214,7 @@ private: int currentLineNumber; int currentFileNumber; int errorCount; - + idVarDef *scope; // the function being parsed, or NULL const idVarDef *basetype; // for accessing fields diff --git a/d3xp/script/Script_Interpreter.cpp b/d3xp/script/Script_Interpreter.cpp index 04484b3..2779aae 100644 --- a/d3xp/script/Script_Interpreter.cpp +++ b/d3xp/script/Script_Interpreter.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -170,7 +170,7 @@ void idInterpreter::Reset( void ) { currentFunction = 0; NextInstruction( 0 ); - threadDying = false; + threadDying = false; doneProcessing = true; } @@ -178,7 +178,7 @@ void idInterpreter::Reset( void ) { ================ idInterpreter::GetRegisterValue -Returns a string representation of the value of the register. This is +Returns a string representation of the value of the register. This is used primarily for the debugger and debugging //FIXME: This is pretty much wrong. won't access data in most situations. @@ -195,11 +195,11 @@ bool idInterpreter::GetRegisterValue( const char *name, idStr &out, int scopeDep const function_t *func; out.Empty(); - + if ( scopeDepth == -1 ) { scopeDepth = callStackDepth; - } - + } + if ( scopeDepth == callStackDepth ) { func = currentFunction; } else { @@ -225,14 +225,14 @@ bool idInterpreter::GetRegisterValue( const char *name, idStr &out, int scopeDep if ( !d ) { return false; } - + // Get the variable itself and check various namespaces d = gameLocal.program.GetDef( NULL, name, d ); if ( !d ) { if ( scope == &def_namespace ) { return false; } - + d = gameLocal.program.GetDef( NULL, name, scope ); if ( !d ) { d = gameLocal.program.GetDef( NULL, name, &def_namespace ); @@ -241,7 +241,7 @@ bool idInterpreter::GetRegisterValue( const char *name, idStr &out, int scopeDep } } } - + reg = GetVariable( d ); switch( d->Type() ) { case ev_float: @@ -254,7 +254,7 @@ bool idInterpreter::GetRegisterValue( const char *name, idStr &out, int scopeDep break; case ev_vector: - if ( reg.vectorPtr ) { + if ( reg.vectorPtr ) { out = va( "%g,%g,%g", reg.vectorPtr->x, reg.vectorPtr->y, reg.vectorPtr->z ); } else { out = "0,0,0"; @@ -282,7 +282,7 @@ bool idInterpreter::GetRegisterValue( const char *name, idStr &out, int scopeDep if ( !field || !obj ) { return false; } - + switch ( field->Type() ) { case ev_boolean: out = va( "%d", *( reinterpret_cast( &obj->data[ reg.ptrOffset ] ) ) ); @@ -389,7 +389,7 @@ idInterpreter::StackTrace */ void idInterpreter::StackTrace( void ) const { const function_t *f; - int i; + int i; int top; if ( callStackDepth == 0 ) { @@ -401,7 +401,7 @@ void idInterpreter::StackTrace( void ) const { if ( top >= MAX_STACK_DEPTH ) { top = MAX_STACK_DEPTH - 1; } - + if ( !currentFunction ) { gameLocal.Printf( "\n" ); } else { @@ -552,7 +552,7 @@ NOTE: If this is called from within a event called by this interpreter, the func ==================== */ void idInterpreter::EnterFunction( const function_t *func, bool clearStack ) { - int c; + int c; prstack_t *stack; if ( clearStack ) { @@ -584,10 +584,10 @@ void idInterpreter::EnterFunction( const function_t *func, bool clearStack ) { if ( debug ) { if ( currentFunction ) { - gameLocal.Printf( "%d: call '%s' from '%s'(line %d)%s\n", gameLocal.time, func->Name(), currentFunction->Name(), + gameLocal.Printf( "%d: call '%s' from '%s'(line %d)%s\n", gameLocal.time, func->Name(), currentFunction->Name(), gameLocal.program.GetStatement( instructionPointer ).linenumber, clearStack ? " clear stack" : "" ); } else { - gameLocal.Printf( "%d: call '%s'%s\n", gameLocal.time, func->Name(), clearStack ? " clear stack" : "" ); + gameLocal.Printf( "%d: call '%s'%s\n", gameLocal.time, func->Name(), clearStack ? " clear stack" : "" ); } } @@ -623,7 +623,7 @@ idInterpreter::LeaveFunction void idInterpreter::LeaveFunction( idVarDef *returnDef ) { prstack_t *stack; varEval_t ret; - + if ( callStackDepth <= 0 ) { Error( "prog stack underflow" ); } @@ -662,7 +662,7 @@ void idInterpreter::LeaveFunction( idVarDef *returnDef ) { // up stack callStackDepth--; - stack = &callStack[ callStackDepth ]; + stack = &callStack[ callStackDepth ]; currentFunction = stack->f; localstackBase = stack->stackbase; NextInstruction( stack->s ); @@ -681,11 +681,11 @@ idInterpreter::CallEvent ================ */ void idInterpreter::CallEvent( const function_t *func, int argsize ) { - int i; + int i; int j; varEval_t var; - int pos; - int start; + int pos; + int start; int data[ D_EVENT_MAXARGS ]; const idEventDef *evdef; const char *format; @@ -809,7 +809,7 @@ void idInterpreter::CallEvent( const function_t *func, int argsize ) { idInterpreter::BeginMultiFrameEvent ================ */ -bool idInterpreter::BeginMultiFrameEvent( idEntity *ent, const idEventDef *event ) { +bool idInterpreter::BeginMultiFrameEvent( idEntity *ent, const idEventDef *event ) { if ( eventEntity != ent ) { Error( "idInterpreter::BeginMultiFrameEvent called with wrong entity" ); } @@ -852,11 +852,11 @@ idInterpreter::CallSysEvent ================ */ void idInterpreter::CallSysEvent( const function_t *func, int argsize ) { - int i; + int i; int j; varEval_t source; - int pos; - int start; + int pos; + int start; int data[ D_EVENT_MAXARGS ]; const idEventDef *evdef; const char *format; @@ -939,7 +939,7 @@ bool idInterpreter::Execute( void ) { varEval_t var_c; varEval_t var; statement_t *st; - int runaway; + int runaway; idThread *newThread; float floatVal; idScriptObject *obj; @@ -1007,7 +1007,7 @@ bool idInterpreter::Execute( void ) { CallEvent( st->a->value.functionPtr, st->b->value.argSize ); break; - case OP_OBJECTCALL: + case OP_OBJECTCALL: var_a = GetVariable( st->a ); obj = GetScriptObject( *var_a.entityNumberPtr ); if ( obj ) { @@ -1224,7 +1224,7 @@ bool idInterpreter::Execute( void ) { *var_c.floatPtr = ( *var_a.intPtr != 0 ) && ( *var_b.intPtr != 0 ); break; - case OP_OR: + case OP_OR: var_a = GetVariable( st->a ); var_b = GetVariable( st->b ); var_c = GetVariable( st->c ); @@ -1244,14 +1244,14 @@ bool idInterpreter::Execute( void ) { var_c = GetVariable( st->c ); *var_c.floatPtr = ( *var_a.floatPtr != 0.0f ) || ( *var_b.intPtr != 0 ); break; - + case OP_OR_BOOLBOOL: var_a = GetVariable( st->a ); var_b = GetVariable( st->b ); var_c = GetVariable( st->c ); *var_c.floatPtr = ( *var_a.intPtr != 0 ) || ( *var_b.intPtr != 0 ); break; - + case OP_NOT_BOOL: var_a = GetVariable( st->a ); var_c = GetVariable( st->c ); @@ -1489,7 +1489,7 @@ bool idInterpreter::Execute( void ) { *var_b.entityNumberPtr = *var_a.entityNumberPtr; break; - case OP_STORE_BOOL: + case OP_STORE_BOOL: var_a = GetVariable( st->a ); var_b = GetVariable( st->b ); *var_b.intPtr = *var_a.intPtr; @@ -1603,7 +1603,7 @@ bool idInterpreter::Execute( void ) { *var_b.evalPtr->vectorPtr = *var_a.vectorPtr; } break; - + case OP_STOREP_FTOS: var_b = GetVariable( st->b ); if ( var_b.evalPtr && var_b.evalPtr->stringPtr ) { diff --git a/d3xp/script/Script_Interpreter.h b/d3xp/script/Script_Interpreter.h index 4c30579..add78af 100644 --- a/d3xp/script/Script_Interpreter.h +++ b/d3xp/script/Script_Interpreter.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -29,28 +29,28 @@ If you have questions concerning this license or the applicable additional terms #ifndef __SCRIPT_INTERPRETER_H__ #define __SCRIPT_INTERPRETER_H__ -#define MAX_STACK_DEPTH 64 -#define LOCALSTACK_SIZE 6144 +#define MAX_STACK_DEPTH 64 +#define LOCALSTACK_SIZE 6144 typedef struct prstack_s { - int s; + int s; const function_t *f; - int stackbase; + int stackbase; } prstack_t; class idInterpreter { private: prstack_t callStack[ MAX_STACK_DEPTH ]; - int callStackDepth; - int maxStackDepth; + int callStackDepth; + int maxStackDepth; byte localstack[ LOCALSTACK_SIZE ]; - int localstackUsed; - int localstackBase; - int maxLocalstackUsed; + int localstackUsed; + int localstackBase; + int maxLocalstackUsed; const function_t *currentFunction; - int instructionPointer; + int instructionPointer; int popParms; const idEventDef *multiFrameEvent; diff --git a/d3xp/script/Script_Program.cpp b/d3xp/script/Script_Program.cpp index 2d8a8b9..a2fdefa 100644 --- a/d3xp/script/Script_Program.cpp +++ b/d3xp/script/Script_Program.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -141,7 +141,7 @@ idTypeDef::idTypeDef( etype_t etype, idVarDef *edef, const char *ename, int esiz def = edef; size = esize; auxType = aux; - + parmTypes.SetGranularity( 1 ); parmNames.SetGranularity( 1 ); functions.SetGranularity( 1 ); @@ -724,7 +724,7 @@ void idVarDef::SetString( const char *string, bool constant ) { } else { initialized = initializedVariable; } - + assert( typeDef && ( typeDef->Type() == ev_string ) ); idStr::Copynz( value.stringPtr, string, MAX_STRING_LEN ); } @@ -795,7 +795,7 @@ void idVarDef::PrintInfo( idFile *file, int instructionPointer ) const { break; case ev_float : - file->Printf( "%f", *value.floatPtr ); + file->Printf( "%f", *value.floatPtr ); break; case ev_virtualfunction : @@ -954,7 +954,7 @@ bool idScriptObject::SetType( const char *typeName ) { newtype = gameLocal.program.FindType( typeName ); // only allocate memory if the object type changes - if ( newtype != type ) { + if ( newtype != type ) { Free(); if ( !newtype ) { gameLocal.Warning( "idScriptObject::SetType: Unknown type '%s'", typeName ); @@ -1121,7 +1121,7 @@ idProgram::AllocType idTypeDef *idProgram::AllocType( idTypeDef &type ) { idTypeDef *newtype; - newtype = new idTypeDef( type ); + newtype = new idTypeDef( type ); types.Append( newtype ); return newtype; @@ -1418,7 +1418,7 @@ idProgram::FindFreeResultDef */ idVarDef *idProgram::FindFreeResultDef( idTypeDef *type, const char *name, idVarDef *scope, const idVarDef *a, const idVarDef *b ) { idVarDef *def; - + for( def = GetDefList( name ); def != NULL; def = def->Next() ) { if ( def == a || def == b ) { continue; @@ -1597,7 +1597,7 @@ void idProgram::BeginCompilation( void ) { // make the first statement a return for a "NULL" function statement = AllocStatement(); statement->linenumber = 0; - statement->file = 0; + statement->file = 0; statement->op = OP_RETURN; statement->a = NULL; statement->b = NULL; @@ -1677,7 +1677,7 @@ void idProgram::Disassemble( void ) const { for( instructionPointer = 0; instructionPointer < func->numStatements; instructionPointer++ ) { DisassembleStatement( file, func->firstStatement + instructionPointer ); } - + file->Printf( "}\n" ); } @@ -1792,7 +1792,7 @@ bool idProgram::CompileText( const char *source, const char *text, bool console } } } - + catch( idCompileError &err ) { if ( console ) { gameLocal.Printf( "%s\n", err.error ); @@ -2081,7 +2081,7 @@ void idProgram::Restart( void ) { statements.SetNum( top_statements ); fileList.SetNum( top_files, false ); filename.Clear(); - + // reset the variables to their default values numVariables = variableDefaults.Num(); for( i = 0; i < numVariables; i++ ) { diff --git a/d3xp/script/Script_Program.h b/d3xp/script/Script_Program.h index 4690019..2d53f68 100644 --- a/d3xp/script/Script_Program.h +++ b/d3xp/script/Script_Program.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -72,16 +72,16 @@ public: void Clear( void ); private: - idStr name; + idStr name; public: const idEventDef *eventdef; idVarDef *def; const idTypeDef *type; - int firstStatement; - int numStatements; - int parmTotal; - int locals; // total ints of parms + locals - int filenum; // source file defined in + int firstStatement; + int numStatements; + int parmTotal; + int locals; // total ints of parms + locals + int filenum; // source file defined in idList parmSize; }; @@ -90,8 +90,8 @@ typedef union eval_s { float _float; float vector[ 3 ]; function_t *function; - int _int; - int entity; + int _int; + int entity; } eval_t; /*********************************************************************** @@ -105,7 +105,7 @@ Contains type information for variables and functions. class idTypeDef { private: etype_t type; - idStr name; + idStr name; int size; // function types are more complex @@ -135,7 +135,7 @@ public: int Size( void ) const; idTypeDef *SuperClass( void ) const; - + idTypeDef *ReturnType( void ) const; void SetReturnType( idTypeDef *type ); @@ -167,7 +167,7 @@ In-game representation of objects in scripts. Use the idScriptVariable template class idScriptObject { private: idTypeDef *type; - + public: byte *data; @@ -309,9 +309,9 @@ typedef union varEval_s { float *floatPtr; idVec3 *vectorPtr; function_t *functionPtr; - int *intPtr; + int *intPtr; byte *bytePtr; - int *entityNumberPtr; + int *entityNumberPtr; int virtualFunction; int jumpOffset; int stackOffset; // offset in stack for local variables @@ -328,7 +328,7 @@ class idVarDef { public: int num; varEval_t value; - idVarDef * scope; // function, namespace, or object the var was defined in + idVarDef * scope; // function, namespace, or object the var was defined in int numUsers; // number of users if this is a constant typedef enum { @@ -448,7 +448,7 @@ single idProgram. class idProgram { private: idStrList fileList; - idStr filename; + idStr filename; int filenum; int numVariables; @@ -524,14 +524,14 @@ public: statement_t &GetStatement( int index ); int NumStatements( void ) { return statements.Num(); } - int GetReturnedInteger( void ); + int GetReturnedInteger( void ); void ReturnFloat( float value ); void ReturnInteger( int value ); void ReturnVector( idVec3 const &vec ); void ReturnString( const char *string ); void ReturnEntity( idEntity *ent ); - + int NumFilenames( void ) { return fileList.Num( ); } }; diff --git a/d3xp/script/Script_Thread.cpp b/d3xp/script/Script_Thread.cpp index 53a376d..920d5ce 100644 --- a/d3xp/script/Script_Thread.cpp +++ b/d3xp/script/Script_Thread.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms const idEventDef EV_Thread_Execute( "", NULL ); const idEventDef EV_Thread_SetCallback( "", NULL ); - + // script callable events const idEventDef EV_Thread_TerminateThread( "terminate", "d" ); const idEventDef EV_Thread_Pause( "pause", NULL ); @@ -285,7 +285,7 @@ idThread::idThread */ idThread::idThread( idEntity *self, const function_t *func ) { assert( self ); - + Init(); SetThreadName( self->name ); interpreter.EnterObjectFunction( self, func, false ); @@ -440,7 +440,7 @@ void idThread::Init( void ) { threadNum = threadIndex; threadList.Append( this ); - + creationTime = gameLocal.time; lastExecuteTime = 0; manualControl = false; @@ -477,19 +477,19 @@ idThread::DisplayInfo ================ */ void idThread::DisplayInfo( void ) { - gameLocal.Printf( + gameLocal.Printf( "%12i: '%s'\n" " File: %s(%d)\n" " Created: %d (%d ms ago)\n" - " Status: ", - threadNum, threadName.c_str(), - interpreter.CurrentFile(), interpreter.CurrentLine(), + " Status: ", + threadNum, threadName.c_str(), + interpreter.CurrentFile(), interpreter.CurrentLine(), creationTime, gameLocal.time - creationTime ); if ( interpreter.threadDying ) { gameLocal.Printf( "Dying\n" ); } else if ( interpreter.doneProcessing ) { - gameLocal.Printf( + gameLocal.Printf( "Paused since %d (%d ms)\n" " Reason: ", lastExecuteTime, gameLocal.time - lastExecuteTime ); if ( waitingForThread ) { @@ -935,8 +935,8 @@ void idThread::WaitFrame( void ) { /*********************************************************************** - Script callable events - + Script callable events + ***********************************************************************/ /* @@ -1437,7 +1437,7 @@ void idThread::Event_OnSignal( int signal, idEntity *ent, const char *func ) { if ( !ent ) { Error( "Entity not found" ); } - + if ( ( signal < 0 ) || ( signal >= NUM_SIGNALS ) ) { Error( "Signal out of range" ); } @@ -1459,7 +1459,7 @@ void idThread::Event_ClearSignalThread( int signal, idEntity *ent ) { if ( !ent ) { Error( "Entity not found" ); } - + if ( ( signal < 0 ) || ( signal >= NUM_SIGNALS ) ) { Error( "Signal out of range" ); } @@ -1724,7 +1724,7 @@ void idThread::Event_StrLeft( const char *string, int num ) { /* ================ -idThread::Event_StrRight +idThread::Event_StrRight ================ */ void idThread::Event_StrRight( const char *string, int num ) { @@ -1821,7 +1821,7 @@ void idThread::Event_RadiusDamage( const idVec3 &origin, idEntity *inflictor, id idThread::Event_IsClient ================ */ -void idThread::Event_IsClient( void ) { +void idThread::Event_IsClient( void ) { idThread::ReturnFloat( gameLocal.isClient ); } @@ -1830,7 +1830,7 @@ void idThread::Event_IsClient( void ) { idThread::Event_IsMultiplayer ================ */ -void idThread::Event_IsMultiplayer( void ) { +void idThread::Event_IsMultiplayer( void ) { idThread::ReturnFloat( gameLocal.isMultiplayer ); } @@ -1839,7 +1839,7 @@ void idThread::Event_IsMultiplayer( void ) { idThread::Event_GetFrameTime ================ */ -void idThread::Event_GetFrameTime( void ) { +void idThread::Event_GetFrameTime( void ) { idThread::ReturnFloat( MS2SEC( gameLocal.msec ) ); } @@ -1848,7 +1848,7 @@ void idThread::Event_GetFrameTime( void ) { idThread::Event_GetTicsPerSecond ================ */ -void idThread::Event_GetTicsPerSecond( void ) { +void idThread::Event_GetTicsPerSecond( void ) { idThread::ReturnFloat( USERCMD_HZ ); } diff --git a/d3xp/script/Script_Thread.h b/d3xp/script/Script_Thread.h index 6a5efad..7f1a743 100644 --- a/d3xp/script/Script_Thread.h +++ b/d3xp/script/Script_Thread.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -84,9 +84,9 @@ private: idInterpreter interpreter; idDict spawnArgs; - - int threadNum; - idStr threadName; + + int threadNum; + idStr threadName; int lastExecuteTime; int creationTime; @@ -121,7 +121,7 @@ private: void Event_SetCvar( const char *name, const char *value ) const; void Event_GetCvar( const char *name ) const; void Event_Random( float range ) const; -#ifdef _D3XP +#ifdef _D3XP void Event_RandomInt( int range ) const; #endif void Event_GetTime( void ); @@ -134,10 +134,10 @@ private: void Event_SpawnFloat( const char *key, float defaultvalue ); void Event_SpawnVector( const char *key, idVec3 &defaultvalue ); void Event_ClearPersistantArgs( void ); - void Event_SetPersistantArg( const char *key, const char *value ); - void Event_GetPersistantString( const char *key ); - void Event_GetPersistantFloat( const char *key ); - void Event_GetPersistantVector( const char *key ); + void Event_SetPersistantArg( const char *key, const char *value ); + void Event_GetPersistantString( const char *key ); + void Event_GetPersistantFloat( const char *key ); + void Event_GetPersistantVector( const char *key ); void Event_AngToForward( idAngles &ang ); void Event_AngToRight( idAngles &ang ); void Event_AngToUp( idAngles &ang ); @@ -176,17 +176,17 @@ private: void Event_StartMusic( const char *name ); void Event_Warning( const char *text ); void Event_Error( const char *text ); - void Event_StrLen( const char *string ); - void Event_StrLeft( const char *string, int num ); - void Event_StrRight( const char *string, int num ); - void Event_StrSkip( const char *string, int num ); - void Event_StrMid( const char *string, int start, int num ); + void Event_StrLen( const char *string ); + void Event_StrLeft( const char *string, int num ); + void Event_StrRight( const char *string, int num ); + void Event_StrSkip( const char *string, int num ); + void Event_StrMid( const char *string, int start, int num ); void Event_StrToFloat( const char *string ); void Event_RadiusDamage( const idVec3 &origin, idEntity *inflictor, idEntity *attacker, idEntity *ignore, const char *damageDefName, float dmgPower ); void Event_IsClient( void ); - void Event_IsMultiplayer( void ); - void Event_GetFrameTime( void ); - void Event_GetTicsPerSecond( void ); + void Event_IsMultiplayer( void ); + void Event_GetFrameTime( void ); + void Event_GetTicsPerSecond( void ); void Event_CacheSoundShader( const char *soundName ); void Event_DebugLine( const idVec3 &color, const idVec3 &start, const idVec3 &end, const float lifetime ); void Event_DebugArrow( const idVec3 &color, const idVec3 &start, const idVec3 &end, const int size, const float lifetime ); @@ -195,9 +195,9 @@ private: void Event_DrawText( const char *text, const idVec3 &origin, float scale, const idVec3 &color, const int align, const float lifetime ); void Event_InfluenceActive( void ); -public: +public: CLASS_PROTOTYPE( idThread ); - + idThread(); idThread( idEntity *self, const function_t *func ); idThread( const function_t *func ); @@ -219,7 +219,7 @@ public: void WaitMS( int time ); void WaitSec( float time ); void WaitFrame( void ); - + // NOTE: If this is called from within a event called by this thread, the function arguments will be invalid after calling this function. void CallFunction( const function_t *func, bool clearStack ); @@ -231,12 +231,12 @@ public: static void ListThreads_f( const idCmdArgs &args ); static void Restart( void ); static void ObjectMoveDone( int threadnum, idEntity *obj ); - + static idList& GetThreads ( void ); - + bool IsDoneProcessing ( void ); - bool IsDying ( void ); - + bool IsDying ( void ); + void End( void ); static void KillThread( const char *name ); static void KillThread( int num ); @@ -255,13 +255,13 @@ public: bool Start( void ); idThread *WaitingOnThread( void ); void SetThreadNum( int num ); - int GetThreadNum( void ); + int GetThreadNum( void ); void SetThreadName( const char *name ); const char *GetThreadName( void ); void Error( const char *fmt, ... ) const id_attribute((format(printf,2,3))); void Warning( const char *fmt, ... ) const id_attribute((format(printf,2,3))); - + static idThread *CurrentThread( void ); static int CurrentThreadNum( void ); static bool BeginMultiFrameEvent( idEntity *ent, const idEventDef *event ); @@ -317,7 +317,7 @@ idThread::GetThreads */ ID_INLINE idList& idThread::GetThreads ( void ) { return threadList; -} +} /* ================ diff --git a/framework/BuildDefines.h b/framework/BuildDefines.h index 0ff78be..34e2f6e 100644 --- a/framework/BuildDefines.h +++ b/framework/BuildDefines.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -132,4 +132,3 @@ If you have questions concerning this license or the applicable additional terms # define ID_ALLOW_D3XP 1 # endif #endif - diff --git a/framework/BuildVersion.h b/framework/BuildVersion.h index ec73649..8065815 100644 --- a/framework/BuildVersion.h +++ b/framework/BuildVersion.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/framework/CVarSystem.h b/framework/CVarSystem.h index dd2a480..baa5fd3 100644 --- a/framework/CVarSystem.h +++ b/framework/CVarSystem.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/framework/CmdSystem.h b/framework/CmdSystem.h index 067c2b6..ffbc4f0 100644 --- a/framework/CmdSystem.h +++ b/framework/CmdSystem.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/framework/Common.h b/framework/Common.h index 1fbdb8d..ac0e4c3 100644 --- a/framework/Common.h +++ b/framework/Common.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -201,7 +201,7 @@ public: virtual const char * KeysFromBinding( const char *bind ) = 0; // Returns the binding bound to the key - virtual const char * BindingFromKey( const char *key ) = 0; + virtual const char * BindingFromKey( const char *key ) = 0; // Directly sample a button. virtual int ButtonState( int key ) = 0; diff --git a/framework/DeclAF.h b/framework/DeclAF.h index d53de01..105c05b 100644 --- a/framework/DeclAF.h +++ b/framework/DeclAF.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/framework/DeclEntityDef.h b/framework/DeclEntityDef.h index d6868b3..2630f9a 100644 --- a/framework/DeclEntityDef.h +++ b/framework/DeclEntityDef.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/framework/DeclFX.h b/framework/DeclFX.h index 858ddd0..0abfd3c 100644 --- a/framework/DeclFX.h +++ b/framework/DeclFX.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -37,7 +37,7 @@ If you have questions concerning this license or the applicable additional terms =============================================================================== */ -enum { +enum { FX_LIGHT, FX_PARTICLE, FX_DECAL, diff --git a/framework/DeclManager.h b/framework/DeclManager.h index e6a030d..e4fa8b5 100644 --- a/framework/DeclManager.h +++ b/framework/DeclManager.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -100,7 +100,7 @@ const int DECL_LEXER_FLAGS = LEXFL_NOSTRINGCONCAT | // multiple strings seper class idDeclBase { public: - virtual ~idDeclBase() {}; + virtual ~idDeclBase() {}; virtual const char * GetName( void ) const = 0; virtual declType_t GetType( void ) const = 0; virtual declState_t GetState( void ) const = 0; @@ -134,7 +134,7 @@ public: // The constructor should initialize variables such that // an immediate call to FreeData() does no harm. idDecl( void ) { base = NULL; } - virtual ~idDecl( void ) {}; + virtual ~idDecl( void ) {}; // Returns the name of the decl. const char * GetName( void ) const { return base->GetName(); } diff --git a/framework/DeclPDA.h b/framework/DeclPDA.h index 05b2692..7721274 100644 --- a/framework/DeclPDA.h +++ b/framework/DeclPDA.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/framework/DeclParticle.h b/framework/DeclParticle.h index 2c883b3..a32ae34 100644 --- a/framework/DeclParticle.h +++ b/framework/DeclParticle.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -44,7 +44,7 @@ public: const idDeclTable * table; float from; float to; - + float Eval( float frac, idRandom &rand ) const; float Integrate( float frac, idRandom &rand ) const; }; @@ -137,36 +137,36 @@ public: float particleLife; // total seconds of life for each particle float timeOffset; // time offset from system start for the first particle to spawn float deadTime; // time after particleLife before respawning - + //------------------------------- // standard path parms - + prtDistribution_t distributionType; float distributionParms[4]; - + prtDirection_t directionType; float directionParms[4]; - + idParticleParm speed; float gravity; // can be negative to float up bool worldGravity; // apply gravity in world space - bool randomDistribution; // randomly orient the quad on emission ( defaults to true ) + bool randomDistribution; // randomly orient the quad on emission ( defaults to true ) bool entityColor; // force color from render entity ( fadeColor is still valid ) - + //------------------------------ // custom path will completely replace the standard path calculations - + prtCustomPth_t customPathType; // use custom C code routines for determining the origin float customPathParms[8]; - + //-------------------------------- - + idVec3 offset; // offset from origin to spawn all particles, also applies to customPath - + int animationFrames; // if > 1, subdivide the texture S axis into frames and crossfade float animationRate; // frames per second - float initialAngle; // in degrees, random angle is used if zero ( default ) + float initialAngle; // in degrees, random angle is used if zero ( default ) idParticleParm rotationSpeed; // half the particles will have negative rotation speeds - + prtOrientation_t orientation; // view, aimed, or axis fixed float orientationParms[4]; @@ -177,7 +177,7 @@ public: idVec4 fadeColor; // either 0 0 0 0 for additive, or 1 1 1 0 for blended materials float fadeInFraction; // in 0.0 to 1.0 range float fadeOutFraction; // in 0.0 to 1.0 range - float fadeIndexFraction; // in 0.0 to 1.0 range, causes later index smokes to be more faded + float fadeIndexFraction; // in 0.0 to 1.0 range, causes later index smokes to be more faded bool hidden; // for editor use //----------------------------------- diff --git a/framework/DeclSkin.h b/framework/DeclSkin.h index 2f02987..04ab4e0 100644 --- a/framework/DeclSkin.h +++ b/framework/DeclSkin.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/framework/DeclTable.h b/framework/DeclTable.h index f6386e0..01bd48e 100644 --- a/framework/DeclTable.h +++ b/framework/DeclTable.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/framework/File.h b/framework/File.h index 378197d..cf08a0e 100644 --- a/framework/File.h +++ b/framework/File.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -78,7 +78,7 @@ public: virtual int VPrintf( const char *fmt, va_list arg ); // Write a string with high precision floating point numbers to the file. virtual int WriteFloatString( const char *fmt, ... ) id_attribute((format(printf,2,3))); - + // Endian portable alternatives to Read(...) virtual int ReadInt( int &value ); virtual int ReadUnsignedInt( unsigned int &value ); @@ -94,7 +94,7 @@ public: virtual int ReadVec4( idVec4 &vec ); virtual int ReadVec6( idVec6 &vec ); virtual int ReadMat3( idMat3 &mat ); - + // Endian portable alternatives to Write(...) virtual int WriteInt( const int value ); virtual int WriteUnsignedInt( const unsigned int value ); diff --git a/framework/FileSystem.h b/framework/FileSystem.h index e1b618c..48466a5 100644 --- a/framework/FileSystem.h +++ b/framework/FileSystem.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/framework/Licensee.h b/framework/Licensee.h index d751201..957b4b4 100644 --- a/framework/Licensee.h +++ b/framework/Licensee.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/framework/UsercmdGen.h b/framework/UsercmdGen.h index 91d059f..17e88fe 100644 --- a/framework/UsercmdGen.h +++ b/framework/UsercmdGen.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/framework/async/NetworkSystem.h b/framework/async/NetworkSystem.h index c0cceed..4d5dc26 100644 --- a/framework/async/NetworkSystem.h +++ b/framework/async/NetworkSystem.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/AF.cpp b/game/AF.cpp index ff37d06..526c8cf 100644 --- a/game/AF.cpp +++ b/game/AF.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -621,7 +621,7 @@ idAF::LoadConstraint bool idAF::LoadConstraint( const idDeclAF_Constraint *fc ) { idAFBody *body1, *body2; idAngles angles; - idMat3 axis; + idMat3 axis; body1 = physicsObj.GetBody( fc->body1 ); body2 = physicsObj.GetBody( fc->body2 ); @@ -1143,7 +1143,7 @@ void idAF::LoadState( const idDict &args ) { body->SetWorldOrigin( origin ); body->SetWorldAxis( angles.ToMat3() ); } 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 ); @@ -1261,7 +1261,7 @@ void idAF::RemoveBindConstraints( void ) { name.Strip( "bindConstraint " ); if ( physicsObj.GetConstraint( name ) ) { - physicsObj.DeleteConstraint( name ); + physicsObj.DeleteConstraint( name ); } kv = args.MatchPrefix( "bindConstraint ", kv ); diff --git a/game/AF.h b/game/AF.h index 754925d..6380707 100644 --- a/game/AF.h +++ b/game/AF.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/AFEntity.cpp b/game/AFEntity.cpp index 86695ba..3115130 100644 --- a/game/AFEntity.cpp +++ b/game/AFEntity.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -371,9 +371,9 @@ idAFAttachment::Damage 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 ) { - + if ( body ) { body->Damage( inflictor, attacker, dir, damageDefName, damageScale, attachJoint ); } @@ -1623,7 +1623,7 @@ void idAFEntity_Vehicle::Spawn( void ) { steeringWheelJoint = animator.GetJointHandle( steeringWheelJointName ); spawnArgs.GetFloat( "wheelRadius", "20", wheelRadius ); - spawnArgs.GetFloat( "steerSpeed", "5", steerSpeed ); + spawnArgs.GetFloat( "steerSpeed", "5", steerSpeed ); player = NULL; steerAngle = 0.0f; @@ -2838,7 +2838,7 @@ idRenderModel *idGameEdit::AF_CreateMesh( const idDict &args, idVec3 &meshOrigin modifiedAxis[ jointNum ] = ( bodyAxis[i] * originalJoints[jointNum].ToMat3().Transpose() ).Transpose() * ( newBodyAxis[i] * meshAxis.Transpose() ); // FIXME: calculate correct modifiedOrigin modifiedOrigin[ jointNum ] = originalJoints[ jointNum ].ToVec3(); - } + } } // apply joint modifications to the skeleton diff --git a/game/AFEntity.h b/game/AFEntity.h index d14400e..f89a305 100644 --- a/game/AFEntity.h +++ b/game/AFEntity.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/Actor.cpp b/game/Actor.cpp index 78f7b34..ec20ab7 100644 --- a/game/Actor.cpp +++ b/game/Actor.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -230,7 +230,7 @@ idAnimState::AnimDone */ bool idAnimState::AnimDone( int blendFrames ) const { int animDoneTime; - + animDoneTime = animator->CurrentAnim( channel )->GetEndTime(); if ( animDoneTime < 0 ) { // playing a cycle @@ -441,7 +441,7 @@ idActor::idActor( void ) { allowEyeFocus = false; waitState = ""; - + blink_anim = NULL; blink_time = 0; blink_min = 0; @@ -507,7 +507,7 @@ void idActor::Spawn( void ) { spawnArgs.GetInt( "team", "0", team ); 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(); @@ -540,7 +540,7 @@ void idActor::Spawn( void ) { // don't let them drop to the floor args.Set( "dropToFloor", "0" ); - + gameLocal.SpawnEntityDef( args, &ent ); if ( !ent ) { gameLocal.Error( "Couldn't spawn '%s' to attach to entity '%s'", kv->GetValue().c_str(), name.c_str() ); @@ -607,7 +607,7 @@ void idActor::Spawn( void ) { int headAnim = headAnimator->GetAnim( "def_head" ); if ( headAnim ) { if ( headEnt ) { - headAnimator->CycleAnim( ANIMCHANNEL_ALL, headAnim, gameLocal.time, 0 ); + headAnimator->CycleAnim( ANIMCHANNEL_ALL, headAnim, gameLocal.time, 0 ); } else { headAnimator->CycleAnim( ANIMCHANNEL_HEAD, headAnim, gameLocal.time, 0 ); } @@ -1256,7 +1256,7 @@ idThread *idActor::ConstructScriptObject( void ) { } else { scriptThread->EndThread(); } - + // call script object's constructor constructor = scriptObject.GetConstructor(); if ( !constructor ) { @@ -1344,7 +1344,7 @@ void idActor::UpdateScript( void ) { if ( scriptThread->IsWaiting() ) { break; } - + scriptThread->Execute(); if ( idealState == state ) { break; @@ -1429,7 +1429,7 @@ bool idActor::CheckFOV( const idVec3 &pos ) const { float dot; idVec3 delta; - + delta = pos - GetEyePosition(); // get our gravity normal @@ -1863,7 +1863,7 @@ void idActor::GetAASLocation( idAAS *aas, idVec3 &pos, int &areaNum ) const { areaNum = 0; return; } - + size = aas->GetSettings()->boundingBoxes[0][1]; bounds[0] = -size; size.z = 32.0f; @@ -1900,7 +1900,7 @@ void idActor::SetAnimState( int channel, const char *statename, int blendFrames headAnim.SetState( statename, blendFrames ); allowEyeFocus = true; break; - + case ANIMCHANNEL_TORSO : torsoAnim.SetState( statename, blendFrames ); legsAnim.Enable( blendFrames ); @@ -2152,7 +2152,7 @@ Bleeding wounds and surface overlays are applied in the collision code that 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 ) { if ( !fl.takedamage ) { return; @@ -2289,7 +2289,7 @@ bool idActor::Pain( idEntity *inflictor, idEntity *attacker, int damage, const i } 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() ); } @@ -2433,7 +2433,7 @@ idActor::Event_DisableEyeFocus */ void idActor::Event_DisableEyeFocus( void ) { allowEyeFocus = false; - + idEntity *headEnt = head.GetEntity(); if ( headEnt ) { headEnt->GetAnimator()->Clear( ANIMCHANNEL_EYELIDS, gameLocal.time, FRAME2MS( 2 ) ); @@ -2570,7 +2570,7 @@ void idActor::Event_PlayAnim( int channel, const char *animname ) { animFlags_t flags; idEntity *headEnt; int anim; - + anim = GetAnim( channel, animname ); if ( !anim ) { if ( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() ) { @@ -2649,7 +2649,7 @@ idActor::Event_PlayCycle void idActor::Event_PlayCycle( int channel, const char *animname ) { animFlags_t flags; int anim; - + anim = GetAnim( channel, animname ); if ( !anim ) { if ( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() ) { @@ -2722,8 +2722,8 @@ idActor::Event_IdleAnim */ void idActor::Event_IdleAnim( int channel, const char *animname ) { int anim; - - anim = GetAnim( channel, animname ); + + anim = GetAnim( channel, animname ); if ( !anim ) { if ( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() ) { gameLocal.DPrintf( "missing '%s' animation on '%s' (%s)\n", animname, name.c_str(), spawnArgs.GetString( "def_head", "" ) ); @@ -3127,9 +3127,9 @@ void idActor::Event_AnimLength( int channel, const char *animname ) { } else { idThread::ReturnFloat( MS2SEC( animator.AnimLength( anim ) ) ); return; - } + } } - + idThread::ReturnFloat( 0.0f ); } @@ -3153,7 +3153,7 @@ void idActor::Event_AnimDistance( int channel, const char *animname ) { return; } } - + idThread::ReturnFloat( 0.0f ); } @@ -3197,7 +3197,7 @@ void idActor::Event_NextEnemy( idEntity *ent ) { } } - idThread::ReturnEntity( NULL ); + idThread::ReturnEntity( NULL ); } /* diff --git a/game/Actor.h b/game/Actor.h index c981167..0c25702 100644 --- a/game/Actor.h +++ b/game/Actor.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -192,8 +192,8 @@ public: virtual void Teleport( const idVec3 &origin, const idAngles &angles, idEntity *destination ); - virtual renderView_t * GetRenderView(); - + virtual renderView_t * GetRenderView(); + // animation state control int GetAnim( int channel, const char *name ); void UpdateAnimState( void ); diff --git a/game/BrittleFracture.cpp b/game/BrittleFracture.cpp index 401b25b..5a24871 100644 --- a/game/BrittleFracture.cpp +++ b/game/BrittleFracture.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -101,7 +101,7 @@ void idBrittleFracture::Save( idSaveGame *savefile ) const { entityFlags_s flags = fl; LittleBitField( &flags, sizeof( flags ) ); savefile->Write( &flags, sizeof( flags ) ); - + // setttings savefile->WriteMaterial( material ); savefile->WriteMaterial( decalMaterial ); @@ -386,7 +386,7 @@ bool idBrittleFracture::UpdateRenderEntity( renderEntity_s *renderEntity, const } packedColor = PackColor( idVec4( renderEntity->shaderParms[ SHADERPARM_RED ] * fade, renderEntity->shaderParms[ SHADERPARM_GREEN ] * fade, - renderEntity->shaderParms[ SHADERPARM_BLUE ] * fade, + renderEntity->shaderParms[ SHADERPARM_BLUE ] * fade, fade ) ); const idWinding &winding = shards[i]->winding; @@ -916,7 +916,7 @@ void idBrittleFracture::DropFloatingIslands( const idVec3 &point, const idVec3 & continue; } - queueStart = 0; + queueStart = 0; queueEnd = 1; queue[0] = shards[i]; shards[i]->islandNum = numIslands+1; diff --git a/game/BrittleFracture.h b/game/BrittleFracture.h index a90bfbd..03622ef 100644 --- a/game/BrittleFracture.h +++ b/game/BrittleFracture.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/Camera.cpp b/game/Camera.cpp index 965063e..7d3665a 100644 --- a/game/Camera.cpp +++ b/game/Camera.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -193,7 +193,7 @@ idCameraView::GetViewParms */ void idCameraView::GetViewParms( renderView_t *view ) { assert( view ); - + if (view == NULL) { return; } @@ -215,7 +215,7 @@ void idCameraView::GetViewParms( renderView_t *view ) { } else { view->viewaxis = ent->GetPhysics()->GetAxis(); } - + gameLocal.CalcFov( fov, view->fov_x, view->fov_y ); } @@ -519,7 +519,7 @@ void idCameraAnim::Think( void ) { frameTime = ( gameLocal.time - starttime ) * frameRate; frame = frameTime / 1000; } - + if ( frame > camera.Num() + cameraCuts.Num() - 2 ) { if ( cycle > 0 ) { cycle--; @@ -652,7 +652,7 @@ void idCameraAnim::GetViewParms( renderView_t *view ) { // setup the pvs for this frame UpdatePVSAreas( view->vieworg ); - + #if 0 static int lastFrame = 0; static idVec3 lastFrameVec( 0.0f, 0.0f, 0.0f ); diff --git a/game/Camera.h b/game/Camera.h index 1146c88..3d6016e 100644 --- a/game/Camera.h +++ b/game/Camera.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/EndLevel.cpp b/game/EndLevel.cpp index 3794995..21f1ec9 100644 --- a/game/EndLevel.cpp +++ b/game/EndLevel.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -75,7 +75,7 @@ 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; } @@ -88,7 +88,7 @@ void idTarget_EndLevel::Event_Trigger( idEntity *activator ) { if ( gameLocal.endLevel ) { return; } - + // mark the endLevel, which will modify some game actions // and pass control to us for drawing the stats and camera position gameLocal.endLevel = this; diff --git a/game/EndLevel.h b/game/EndLevel.h index 0157502..b2d6b04 100644 --- a/game/EndLevel.h +++ b/game/EndLevel.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -63,4 +63,3 @@ private: void Event_Trigger( idEntity *activator ); }; - diff --git a/game/Entity.cpp b/game/Entity.cpp index 0369093..b7d6896 100644 --- a/game/Entity.cpp +++ b/game/Entity.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -151,8 +151,8 @@ ABSTRACT_DECLARATION( idClass, idEntity ) EVENT( EV_GetMins, idEntity::Event_GetMins) EVENT( EV_GetMaxs, idEntity::Event_GetMaxs ) EVENT( EV_Touches, idEntity::Event_Touches ) - EVENT( EV_SetGuiParm, idEntity::Event_SetGuiParm ) - EVENT( EV_SetGuiFloat, idEntity::Event_SetGuiFloat ) + EVENT( EV_SetGuiParm, idEntity::Event_SetGuiParm ) + EVENT( EV_SetGuiFloat, idEntity::Event_SetGuiFloat ) EVENT( EV_GetNextKey, idEntity::Event_GetNextKey ) EVENT( EV_SetKey, idEntity::Event_SetKey ) EVENT( EV_GetKey, idEntity::Event_GetKey ) @@ -464,7 +464,7 @@ void idEntity::Spawn( void ) { gameEdit->ParseSpawnArgsToRenderEntity( &spawnArgs, &renderEntity ); renderEntity.entityNum = entityNumber; - + // go dormant within 5 frames so that when the map starts most monsters are dormant dormantStart = gameLocal.time - DELAY_DORMANT_TIME + gameLocal.msec * 5; @@ -720,7 +720,7 @@ void idEntity::Restore( idRestoreGame *savefile ) { savefile->Read( &fl, sizeof( fl ) ); LittleBitField( &fl, sizeof( fl ) ); - + savefile->ReadRenderEntity( renderEntity ); savefile->ReadInt( modelDefHandle ); savefile->ReadRefSound( refSound ); @@ -811,7 +811,7 @@ const char * idEntity::GetName( void ) const { /*********************************************************************** Thinking - + ***********************************************************************/ /* @@ -876,7 +876,7 @@ off from the player can skip all of their work */ bool idEntity::CheckDormant( void ) { bool dormant; - + dormant = DoDormantTests(); if ( dormant && !fl.isDormant ) { fl.isDormant = true; @@ -987,7 +987,7 @@ void idEntity::BecomeInactive( int flags ) { /*********************************************************************** Visuals - + ***********************************************************************/ /* @@ -1508,7 +1508,7 @@ renderView_t *idEntity::GetRenderView( void ) { /*********************************************************************** Sound - + ***********************************************************************/ /* @@ -1702,7 +1702,7 @@ void idEntity::FreeSoundEmitter( bool immediate ) { /*********************************************************************** entity binding - + ***********************************************************************/ /* @@ -2337,13 +2337,13 @@ void idEntity::JoinTeam( idEntity *teammember ) { ent->teamChain->teamMaster = master; } - prev->teamChain = this; + prev->teamChain = this; ent->teamChain = next; } teamMaster = master; - // reorder the active entity list + // reorder the active entity list gameLocal.sortTeamMasters = true; } @@ -2398,7 +2398,7 @@ void idEntity::QuitTeam( void ) { /*********************************************************************** Physics. - + ***********************************************************************/ /* @@ -2855,7 +2855,7 @@ void idEntity::RemoveContactEntity( idEntity *ent ) { /*********************************************************************** Damage - + ***********************************************************************/ /* @@ -2867,9 +2867,9 @@ explosions and melee attacks. ============ */ bool idEntity::CanDamage( const idVec3 &origin, idVec3 &damagePoint ) const { - idVec3 dest; + idVec3 dest; trace_t tr; - idVec3 midpoint; + idVec3 midpoint; // use the midpoint of the bounds instead of the origin, because // bmodels may have their origin at 0,0,0 @@ -2966,7 +2966,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 ) { if ( !fl.takedamage ) { return; @@ -3071,7 +3071,7 @@ void idEntity::Killed( idEntity *inflictor, idEntity *attacker, int damage, cons /*********************************************************************** Script functions - + ***********************************************************************/ /* @@ -3306,7 +3306,7 @@ void idEntity::SignalEvent( idThread *thread, signalNum_t signalnum ) { /*********************************************************************** Guis. - + ***********************************************************************/ @@ -3494,7 +3494,7 @@ bool idEntity::HandleSingleGuiCommand( idEntity *entityGui, idLexer *src ) { /*********************************************************************** Targets - + ***********************************************************************/ /* @@ -3545,7 +3545,7 @@ idEntity::ActivateTargets void idEntity::ActivateTargets( idEntity *activator ) const { idEntity *ent; int i, j; - + for( i = 0; i < targets.Num(); i++ ) { ent = targets[ i ].GetEntity(); if ( !ent ) { @@ -3554,7 +3554,7 @@ void idEntity::ActivateTargets( idEntity *activator ) const { if ( ent->RespondsTo( EV_Activate ) || ent->HasSignal( SIG_TRIGGER ) ) { ent->Signal( SIG_TRIGGER ); ent->ProcessEvent( &EV_Activate, activator ); - } + } for ( j = 0; j < MAX_RENDERENTITY_GUI; j++ ) { if ( ent->renderEntity.gui[ j ] ) { ent->renderEntity.gui[ j ]->Trigger( gameLocal.time ); @@ -3566,7 +3566,7 @@ void idEntity::ActivateTargets( idEntity *activator ) const { /*********************************************************************** Misc. - + ***********************************************************************/ /* @@ -3694,7 +3694,7 @@ void idEntity::ShowEditingDialog( void ) { /*********************************************************************** Events - + ***********************************************************************/ /* @@ -3861,7 +3861,7 @@ void idEntity::Event_SpawnBind( void ) { const idAnim *anim; int animNum; idAnimator *parentAnimator; - + if ( spawnArgs.GetString( "bind", "", &bind ) ) { if ( idStr::Icmp( bind, "worldspawn" ) == 0 ) { //FIXME: Completely unneccessary since the worldspawn is called "world" @@ -4066,12 +4066,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 ) { int time; - + StartSound( soundName, ( s_channelType )channel, 0, ( netSync != 0 ), &time ); idThread::ReturnFloat( MS2SEC( time ) ); } @@ -4387,9 +4387,9 @@ void idEntity::Event_RestorePosition( void ) { if ( spawnArgs.GetMatrix( "rotation", "1 0 0 0 1 0 0 0 1", axis ) ) { angles = axis.ToAngles(); } else { - angles[ 0 ] = 0; - angles[ 1 ] = spawnArgs.GetFloat( "angle" ); - angles[ 2 ] = 0; + angles[ 0 ] = 0; + angles[ 1 ] = spawnArgs.GetFloat( "angle" ); + angles[ 2 ] = 0; } Teleport( org, angles, NULL ); @@ -4431,7 +4431,7 @@ void idEntity::Event_UpdateCameraTarget( void ) { dir.Normalize(); cameraTarget->SetAxis( dir.ToMat3() ); SetAxis(dir.ToMat3()); - break; + break; } kv = cameraTarget->spawnArgs.MatchPrefix( "target", kv ); } @@ -4480,7 +4480,7 @@ idEntity::Event_WaitFrame */ void idEntity::Event_WaitFrame( void ) { idThread *thread; - + thread = idThread::CurrentThread(); if ( thread ) { thread->WaitFrame(); @@ -4561,7 +4561,7 @@ void idEntity::Event_SetNeverDormant( int enable ) { /*********************************************************************** Network - + ***********************************************************************/ /* @@ -4735,7 +4735,7 @@ void idEntity::ServerSendEvent( int eventId, const idBitMsg *msg, bool saveEvent outMsg.Init( msgBuf, sizeof( msgBuf ) ); outMsg.BeginWriting(); - outMsg.WriteByte( GAME_RELIABLE_MESSAGE_EVENT ); + outMsg.WriteByte( GAME_RELIABLE_MESSAGE_EVENT ); outMsg.WriteBits( gameLocal.GetSpawnId( this ), 32 ); outMsg.WriteByte( eventId ); outMsg.WriteLong( gameLocal.time ); @@ -5073,7 +5073,7 @@ bool idAnimatedEntity::GetJointTransformForAnim( jointHandle_t jointHandle, int offset = frame[ jointHandle ].ToVec3(); axis = frame[ jointHandle ].ToMat3(); - + return true; } diff --git a/game/Entity.h b/game/Entity.h index 379f380..57e437f 100644 --- a/game/Entity.h +++ b/game/Entity.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -513,12 +513,12 @@ protected: private: void Event_GetJointHandle( const char *jointname ); - void Event_ClearAllJoints( void ); - void Event_ClearJoint( jointHandle_t jointnum ); - 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_GetJointPos( jointHandle_t jointnum ); - void Event_GetJointAngle( jointHandle_t jointnum ); + void Event_ClearAllJoints( void ); + void Event_ClearJoint( jointHandle_t jointnum ); + 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_GetJointPos( jointHandle_t jointnum ); + void Event_GetJointAngle( jointHandle_t jointnum ); }; #endif /* !__GAME_ENTITY_H__ */ diff --git a/game/Fx.cpp b/game/Fx.cpp index 8b93c6b..6fc7e54 100644 --- a/game/Fx.cpp +++ b/game/Fx.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -43,7 +43,7 @@ const idEventDef EV_Fx_KillFx( "_killfx" ); const idEventDef EV_Fx_Action( "_fxAction", "e" ); // implemented by subclasses CLASS_DECLARATION( idEntity, idEntityFx ) -EVENT( EV_Activate, idEntityFx::Event_Trigger ) +EVENT( EV_Activate, idEntityFx::Event_Trigger ) EVENT( EV_Fx_KillFx, idEntityFx::Event_ClearFx ) END_CLASS @@ -217,7 +217,7 @@ void idEntityFx::CleanUp( void ) { for( int i = 0; i < fxEffect->events.Num(); i++ ) { const idFXSingleAction& fxaction = fxEffect->events[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_GREEN] = (fxaction.fadeInTime) ? fadePct : 1.0f - fadePct; laction.renderEntity.shaderParms[SHADERPARM_BLUE] = (fxaction.fadeInTime) ? fadePct : 1.0f - fadePct; - + gameRenderWorld->UpdateEntityDef( laction.modelDefHandle, &laction.renderEntity ); } if ( laction.lightDefHandle != -1 ) { @@ -383,7 +383,7 @@ void idEntityFx::Run( int time ) { } laction.delay = totalDelay; laction.start = time; - } + } continue; } @@ -457,7 +457,7 @@ void idEntityFx::Run( int time ) { case FX_DECAL: { if ( !useAction->decalDropped ) { 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; } @@ -759,8 +759,8 @@ idEntityFx::ClientPredictionThink ================= */ void idEntityFx::ClientPredictionThink( void ) { - if ( gameLocal.isNewFrame ) { - Run( gameLocal.time ); + if ( gameLocal.isNewFrame ) { + Run( gameLocal.time ); } RunPhysics(); Present(); @@ -770,7 +770,7 @@ void idEntityFx::ClientPredictionThink( void ) { =============================================================================== idTeleporter - + =============================================================================== */ diff --git a/game/Fx.h b/game/Fx.h index ca75c55..f546d41 100644 --- a/game/Fx.h +++ b/game/Fx.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/Game.h b/game/Game.h index 15038c0..a14c2c6 100644 --- a/game/Game.h +++ b/game/Game.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -239,7 +239,7 @@ public: // Animation system calls for non-game based skeletal rendering. 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_GetModelFromName( const char *modelName ); virtual const idMD5Anim * ANIM_GetAnimFromEntityDef( const char *classname, const char *animname ); diff --git a/game/GameEdit.cpp b/game/GameEdit.cpp index f8f19c7..a5be11e 100644 --- a/game/GameEdit.cpp +++ b/game/GameEdit.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -176,7 +176,7 @@ void idDragEntity::Update( idPlayer *player ) { player->GetViewPos( viewPoint, viewAxis ); // if no entity selected for dragging - if ( !dragEnt.GetEntity() ) { + if ( !dragEnt.GetEntity() ) { if ( player->usercmd.buttons & BUTTON_ATTACK ) { @@ -470,7 +470,7 @@ idEditEntities::RemoveSelectedEntity ============== */ void idEditEntities::RemoveSelectedEntity( idEntity *ent ) { - if ( selectedEntities.Find( ent ) ) { + if ( selectedEntities.Find( ent ) ) { selectedEntities.Remove( ent ); } } @@ -751,7 +751,7 @@ idGameEdit::FindEntity ================ */ 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 ) { for ( int i = 0 ; i < newArgs->GetNumKeyVals () ; i ++ ) { const idKeyValue *kv = newArgs->GetKeyVal( i ); - + if ( kv->GetValue().Length() > 0 ) { ent->spawnArgs.Set ( kv->GetKey() ,kv->GetValue() ); } else { @@ -1107,7 +1107,7 @@ int idGameEdit::MapGetEntitiesMatchingClassWithString( const char *classname, co if (ent) { idStr work = ent->epairs.GetString("classname"); if ( work.Icmp( classname ) == 0 ) { - if ( match && *match ) { + if ( match && *match ) { work = ent->epairs.GetString( "soundgroup" ); if ( count < max && work.Icmp( match ) == 0 ) { list[count++] = ent->epairs.GetString( "name" ); diff --git a/game/GameEdit.h b/game/GameEdit.h index 5fc74e5..4e63f67 100644 --- a/game/GameEdit.h +++ b/game/GameEdit.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/Game_local.cpp b/game/Game_local.cpp index 02d6e22..a06d6e4 100644 --- a/game/Game_local.cpp +++ b/game/Game_local.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -298,7 +298,7 @@ void idGameLocal::Init( void ) { // load default scripts program.Startup( SCRIPT_DEFAULT ); - + smokeParticles = new idSmokeParticles; // set up the aas @@ -412,7 +412,7 @@ void idGameLocal::SaveGame( idFile *f ) { idSaveGame savegame( f ); - if (g_flushSave.GetBool( ) == true ) { + if (g_flushSave.GetBool( ) == true ) { // force flushing with each write... for tracking down // save game bugs. f->ForceFlush(); @@ -754,7 +754,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" ) ) ); modifiedInfo = true; } - + // don't allow dupe nicknames for ( i = 0; i < numClients; i++ ) { if ( i == clientNum ) { @@ -863,7 +863,7 @@ void idGameLocal::LoadMap( const char *mapName, int randseed ) { memset( usercmds, 0, sizeof( usercmds ) ); memset( spawnIds, -1, sizeof( spawnIds ) ); spawnCount = INITIAL_SPAWN_COUNT; - + spawnedEntities.Clear(); activeEntities.Clear(); numEntitiesToDeactivate = 0; @@ -892,7 +892,7 @@ void idGameLocal::LoadMap( const char *mapName, int randseed ) { lastAIAlertEntity = NULL; lastAIAlertTime = 0; - + previousTime = 0; time = 0; framenum = 0; @@ -1459,7 +1459,7 @@ idGameLocal::MapShutdown */ void idGameLocal::MapShutdown( void ) { Printf( "--------- Game Map Shutdown ----------\n" ); - + gamestate = GAMESTATE_SHUTDOWN; if ( gameRenderWorld ) { @@ -1684,7 +1684,7 @@ void idGameLocal::CacheDictionaryMedia( const idDict *dict ) { while( kv ) { if ( kv->GetValue().Length() ) { 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" ) ) { // unfortunate flag names, they aren't actually a gui } else { @@ -2029,7 +2029,7 @@ bool idGameLocal::InPlayerPVS( idEntity *ent ) const { if ( playerPVS.i == -1 ) { return false; } - return pvs.InCurrentPVS( playerPVS, ent->GetPVSAreas(), ent->GetNumPVSAreas() ); + return pvs.InCurrentPVS( playerPVS, ent->GetPVSAreas(), ent->GetNumPVSAreas() ); } /* @@ -2043,7 +2043,7 @@ bool idGameLocal::InPlayerConnectedArea( idEntity *ent ) const { if ( playerConnectedAreas.i == -1 ) { return false; } - return pvs.InCurrentPVS( playerConnectedAreas, ent->GetPVSAreas(), ent->GetNumPVSAreas() ); + return pvs.InCurrentPVS( playerConnectedAreas, ent->GetPVSAreas(), ent->GetNumPVSAreas() ); } /* @@ -2058,7 +2058,7 @@ void idGameLocal::UpdateGravity( void ) { if ( g_gravity.GetFloat() == 0.0f ) { g_gravity.SetFloat( 1.0f ); } - gravity.Set( 0, 0, -g_gravity.GetFloat() ); + gravity.Set( 0, 0, -g_gravity.GetFloat() ); // update all physics objects for( ent = spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() ) { @@ -2347,7 +2347,7 @@ gameReturn_t idGameLocal::RunFrame( const usercmd_t *clientCmds ) { ret.syncNextGameFrame = skipCinematic; if ( skipCinematic ) { soundSystem->SetMute( false ); - skipCinematic = false; + skipCinematic = false; } // show any debug info for this frame @@ -2378,7 +2378,7 @@ void idGameLocal::CalcFov( float base_fov, float &fov_x, float &fov_y ) const { float y; float ratio_x; float ratio_y; - + if ( !sys->FPU_StackIsEmpty() ) { Printf( sys->FPU_GetState() ); Error( "idGameLocal::CalcFov: FPU stack not empty" ); @@ -2991,7 +2991,7 @@ idEntity *idGameLocal::SpawnEntityType( const idTypeInfo &classdef, const idDict obj = classdef.CreateInstance(); obj->CallSpawn(); } - + catch( idAllocError & ) { obj = NULL; } @@ -3111,7 +3111,7 @@ idGameLocal::InhibitEntitySpawn ================ */ bool idGameLocal::InhibitEntitySpawn( idDict &spawnArgs ) { - + bool result = false; if ( isMultiplayer ) { @@ -3126,7 +3126,7 @@ bool idGameLocal::InhibitEntitySpawn( idDict &spawnArgs ) { const char *name; #ifndef ID_DEMO_BUILD - if ( g_skill.GetInteger() == 3 ) { + if ( g_skill.GetInteger() == 3 ) { name = spawnArgs.GetString( "classname" ); if ( idStr::Icmp( name, "item_medkit" ) == 0 || idStr::Icmp( name, "item_medkit_small" ) == 0 ) { result = true; @@ -3285,7 +3285,7 @@ int idGameLocal::GetTargets( const idDict &args, idList< idEntityPtr > ent = FindEntity( arg->GetValue() ); if ( ent ) { idEntityPtr &entityPtr = list.Alloc(); - entityPtr = ent; + entityPtr = ent; } } } @@ -3546,7 +3546,7 @@ void idGameLocal::RadiusDamage( const idVec3 &origin, idEntity *inflictor, idEnt idEntity * entityList[ MAX_GENTITIES ]; int numListedEntities; idBounds bounds; - idVec3 v, damagePoint, dir; + idVec3 v, damagePoint, dir; int i, e, damage, radius, push; const idDict *damageDef = FindEntityDefDict( damageDefName, false ); @@ -3631,7 +3631,7 @@ void idGameLocal::RadiusDamage( const idVec3 &origin, idEntity *inflictor, idEnt } ent->Damage( inflictor, attacker, dir, damageDefName, damageScale, INVALID_JOINT ); - } + } } // push physics objects @@ -3882,7 +3882,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 cvarSystem->SetCVarFloat( "r_znear", 1.0f ); - + // hide all the player models for( i = 0; i < numClients; i++ ) { if ( entities[ i ] ) { @@ -3898,7 +3898,7 @@ void idGameLocal::SetCamera( idCamera *cam ) { // only kill entities that aren't needed for cinematics and aren't dormant continue; } - + if ( ent->IsType( idAI::Type ) ) { ai = static_cast( ent ); if ( !ai->GetEnemy() || !ai->IsActive() ) { @@ -4189,7 +4189,7 @@ idEntity *idGameLocal::SelectInitialSpawnPoint( idPlayer *player ) { || static_cast< idPlayer * >( entities[ j ] )->spectating ) { continue; } - + dist = ( pos - entities[ j ]->GetPhysics()->GetOrigin() ).LengthSqr(); if ( dist < spawnSpots[ i ].dist ) { spawnSpots[ i ].dist = dist; @@ -4365,4 +4365,3 @@ idGameLocal::GetMapLoadingGUI =============== */ void idGameLocal::GetMapLoadingGUI( char gui[ MAX_STRING_CHARS ] ) { } - diff --git a/game/Game_local.h b/game/Game_local.h index fe84bbc..bb0e4aa 100644 --- a/game/Game_local.h +++ b/game/Game_local.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -260,7 +260,7 @@ public: idDict persistentLevelInfo; // contains args that are kept around between levels // 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 @@ -274,7 +274,7 @@ public: idTestModel * testmodel; // for development testing of models 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 diff --git a/game/Game_network.cpp b/game/Game_network.cpp index 5746dcc..e2be04d 100644 --- a/game/Game_network.cpp +++ b/game/Game_network.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -566,7 +566,7 @@ void idGameLocal::ServerWriteSnapshot( int clientNum, int sequence, idBitMsg &ms } else { spectated = player; } - + // free too old snapshots FreeSnapshotsOlderThanSequence( clientNum, sequence - 64 ); @@ -735,7 +735,7 @@ void idGameLocal::ServerProcessEntityNetworkEventQueue( void ) { } idEntityPtr< idEntity > entPtr; - + if( !entPtr.SetSpawnId( event->spawnId ) ) { NetworkEventWarning( event, "Entity does not exist any longer, or has not been spawned yet." ); } else { @@ -1262,7 +1262,7 @@ void idGameLocal::ClientProcessEntityNetworkEventQueue( void ) { } idEntityPtr< idEntity > entPtr; - + if( !entPtr.SetSpawnId( event->spawnId ) ) { if( !gameLocal.entities[ event->spawnId & ( ( 1 << GENTITYNUM_BITS ) - 1 ) ] ) { // if new entity exists in this position, silently ignore @@ -1528,7 +1528,7 @@ idGameLocal::Tokenize void idGameLocal::Tokenize( idStrList &out, const char *in ) { char buf[ MAX_STRING_CHARS ]; char *token, *next; - + idStr::Copynz( buf, in, MAX_STRING_CHARS ); token = buf; next = strchr( token, ';' ); @@ -1543,7 +1543,7 @@ void idGameLocal::Tokenize( idStrList &out, const char *in ) { next = strchr( token, ';' ); } else { token = NULL; - } + } } } @@ -1580,7 +1580,7 @@ bool idGameLocal::DownloadRequest( const char *IP, const char *guid, const char reply += ";"; } if ( pakList[ i ][ 0 ] == '\0' ) { - if ( i == 0 ) { + if ( i == 0 ) { // pak 0 will always miss when client doesn't ask for game bin common->DPrintf( "no game pak request\n" ); } else { @@ -1602,7 +1602,7 @@ bool idGameLocal::DownloadRequest( const char *IP, const char *guid, const char common->DPrintf( "download for %s: %s\n", IP, url.c_str() ); } } - + idStr::Copynz( urls, reply, MAX_STRING_CHARS ); return true; } @@ -1693,7 +1693,7 @@ entityNetEvent_t* idEventQueue::RemoveLast( void ) { if ( !end ) { start = NULL; } else { - end->next = NULL; + end->next = NULL; } event->next = NULL; @@ -1737,7 +1737,7 @@ void idEventQueue::Enqueue( entityNetEvent_t *event, outOfOrderBehaviour_t behav cur->next = event; } return; - } + } // add the new event event->next = NULL; diff --git a/game/IK.cpp b/game/IK.cpp index 3076dc3..1844ba2 100644 --- a/game/IK.cpp +++ b/game/IK.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -151,7 +151,7 @@ bool idIK::Init( idEntity *self, const char *anim, const idVec3 &modelOffset ) { self->name.c_str(), self->GetPhysics()->GetOrigin().ToString(0) ); return false; } - + this->modelOffset = modelOffset; return true; @@ -296,40 +296,40 @@ idIK_Walk::Save */ void idIK_Walk::Save( idSaveGame *savefile ) const { int i; - + idIK::Save( savefile ); savefile->WriteClipModel( footModel ); savefile->WriteInt( numLegs ); savefile->WriteInt( enabledLegs ); - for ( i = 0; i < MAX_LEGS; i++ ) + for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteInt( footJoints[i] ); - for ( i = 0; i < MAX_LEGS; i++ ) + for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteInt( ankleJoints[i] ); - for ( i = 0; i < MAX_LEGS; i++ ) + for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteInt( kneeJoints[i] ); - for ( i = 0; i < MAX_LEGS; i++ ) + for ( i = 0; i < MAX_LEGS; 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( waistJoint ); - + for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteVec3( hipForward[i] ); for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteVec3( kneeForward[i] ); - + for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteFloat( upperLegLength[i] ); for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteFloat( lowerLegLength[i] ); - + for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteMat3( upperLegToHipJoint[i] ); for ( i = 0; i < MAX_LEGS; i++ ) savefile->WriteMat3( lowerLegToKneeJoint[i] ); - + savefile->WriteFloat( smoothing ); savefile->WriteFloat( waistSmoothing ); savefile->WriteFloat( footShift ); @@ -359,7 +359,7 @@ idIK_Walk::Restore */ void idIK_Walk::Restore( idRestoreGame *savefile ) { int i; - + idIK::Restore( savefile ); savefile->ReadClipModel( footModel ); @@ -377,22 +377,22 @@ void idIK_Walk::Restore( idRestoreGame *savefile ) { for ( i = 0; i < MAX_LEGS; i++ ) savefile->ReadInt( (int&)dirJoints[i] ); savefile->ReadInt( (int&)waistJoint ); - + for ( i = 0; i < MAX_LEGS; i++ ) savefile->ReadVec3( hipForward[i] ); for ( i = 0; i < MAX_LEGS; i++ ) savefile->ReadVec3( kneeForward[i] ); - + for ( i = 0; i < MAX_LEGS; i++ ) savefile->ReadFloat( upperLegLength[i] ); for ( i = 0; i < MAX_LEGS; i++ ) savefile->ReadFloat( lowerLegLength[i] ); - + for ( i = 0; i < MAX_LEGS; i++ ) savefile->ReadMat3( upperLegToHipJoint[i] ); for ( i = 0; i < MAX_LEGS; i++ ) savefile->ReadMat3( lowerLegToKneeJoint[i] ); - + savefile->ReadFloat( smoothing ); savefile->ReadFloat( waistSmoothing ); savefile->ReadFloat( footShift ); @@ -893,17 +893,17 @@ void idIK_Reach::Save( idSaveGame *savefile ) const { savefile->WriteInt( shoulderJoints[i] ); for ( i = 0; i < MAX_ARMS; i++ ) savefile->WriteInt( dirJoints[i] ); - + for ( i = 0; i < MAX_ARMS; i++ ) savefile->WriteVec3( shoulderForward[i] ); for ( i = 0; i < MAX_ARMS; i++ ) savefile->WriteVec3( elbowForward[i] ); - + for ( i = 0; i < MAX_ARMS; i++ ) savefile->WriteFloat( upperArmLength[i] ); for ( i = 0; i < MAX_ARMS; i++ ) savefile->WriteFloat( lowerArmLength[i] ); - + for ( i = 0; i < MAX_ARMS; i++ ) savefile->WriteMat3( upperArmToShoulderJoint[i] ); for ( i = 0; i < MAX_ARMS; i++ ) @@ -929,17 +929,17 @@ void idIK_Reach::Restore( idRestoreGame *savefile ) { savefile->ReadInt( (int&)shoulderJoints[i] ); for ( i = 0; i < MAX_ARMS; i++ ) savefile->ReadInt( (int&)dirJoints[i] ); - + for ( i = 0; i < MAX_ARMS; i++ ) savefile->ReadVec3( shoulderForward[i] ); for ( i = 0; i < MAX_ARMS; i++ ) savefile->ReadVec3( elbowForward[i] ); - + for ( i = 0; i < MAX_ARMS; i++ ) savefile->ReadFloat( upperArmLength[i] ); for ( i = 0; i < MAX_ARMS; i++ ) savefile->ReadFloat( lowerArmLength[i] ); - + for ( i = 0; i < MAX_ARMS; i++ ) savefile->ReadMat3( upperArmToShoulderJoint[i] ); for ( i = 0; i < MAX_ARMS; i++ ) diff --git a/game/IK.h b/game/IK.h index dbc4e37..2e71b81 100644 --- a/game/IK.h +++ b/game/IK.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -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. =============================================================================== */ diff --git a/game/Item.cpp b/game/Item.cpp index bccee6e..fa0f28d 100644 --- a/game/Item.cpp +++ b/game/Item.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -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 ) { renderEntity->shaderParms[4] = 0.0f; } else { @@ -224,7 +224,7 @@ void idItem::Think( void ) { SetAngles( ang ); float scale = 0.005f + entityNumber * 0.00001f; - + org = orgOrigin; org.z += 4.0f + cos( ( gameLocal.time + 2000 ) * scale ) * 4.0f; SetOrigin( org ); @@ -344,8 +344,8 @@ bool idItem::GiveToPlayer( idPlayer *player ) { if ( spawnArgs.GetBool( "inv_carry" ) ) { return player->GiveInventoryItem( &spawnArgs ); - } - + } + return player->GiveItem( this ); } @@ -355,7 +355,7 @@ idItem::Pickup ================ */ bool idItem::Pickup( idPlayer *player ) { - + if ( !GiveToPlayer( player ) ) { return false; } @@ -394,7 +394,7 @@ bool idItem::Pickup( idPlayer *player ) { const char *sfx = spawnArgs.GetString( "fxRespawn" ); if ( sfx && *sfx ) { PostEventSec( &EV_RespawnFx, respawn - 0.5f ); - } + } PostEventSec( &EV_RespawnItem, respawn ); } else if ( !spawnArgs.GetBool( "inv_objective" ) && !no_respawn ) { // give some time for the pickup sound to play @@ -729,7 +729,7 @@ void idObjective::Event_Trigger( idEntity *activator ) { //Pickup( player ); if ( spawnArgs.GetString( "inv_objective", NULL ) ) { - if ( player && player->hud ) { + if ( player && player->hud ) { idStr shotName = gameLocal.GetMapName(); shotName.StripFileExtension(); shotName += "/"; @@ -848,7 +848,7 @@ bool idPDAItem::GiveToPlayer(idPlayer *player) { =============================================================================== idMoveableItem - + =============================================================================== */ @@ -885,7 +885,7 @@ idMoveableItem::Save ================ */ void idMoveableItem::Save( idSaveGame *savefile ) const { - savefile->WriteStaticObject( physicsObj ); + savefile->WriteStaticObject( physicsObj ); savefile->WriteClipModel( trigger ); @@ -985,7 +985,7 @@ void idMoveableItem::Think( void ) { // update trigger position trigger->Link( gameLocal.clip, this, 0, GetPhysics()->GetOrigin(), mat3_identity ); } - + if ( thinkFlags & TH_UPDATEPARTICLES ) { if ( !gameLocal.smokeParticles->EmitSmoke( smoke, smokeTime, gameLocal.random.CRandomFloat(), GetPhysics()->GetOrigin(), GetPhysics()->GetAxis() ) ) { smokeTime = 0; @@ -1005,7 +1005,7 @@ bool idMoveableItem::Pickup( idPlayer *player ) { bool ret = idItem::Pickup( player ); if ( ret ) { trigger->SetContents( 0 ); - } + } return ret; } @@ -1229,7 +1229,7 @@ idItemRemover::RemoveItem */ void idItemRemover::RemoveItem( idPlayer *player ) { const char *remove; - + remove = spawnArgs.GetString( "remove" ); player->RemoveInventoryItem( remove ); } @@ -1310,7 +1310,7 @@ void idObjectiveComplete::Event_Trigger( idEntity *activator ) { RemoveItem( player ); if ( spawnArgs.GetString( "inv_objective", NULL ) ) { - if ( player->hud ) { + if ( player->hud ) { player->hud->SetStateString( "objective", "2" ); player->hud->SetStateString( "objectivetext", spawnArgs.GetString( "objectivetext" ) ); player->hud->SetStateString( "objectivetitle", spawnArgs.GetString( "objectivetitle" ) ); diff --git a/game/Item.h b/game/Item.h index 28c6c48..ac9e209 100644 --- a/game/Item.h +++ b/game/Item.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/Light.cpp b/game/Light.cpp index 98967e9..c5a4cdf 100644 --- a/game/Light.cpp +++ b/game/Light.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -123,10 +123,10 @@ void idGameEdit::ParseSpawnArgsToRenderLight( const idDict *args, renderLight_t idMat3 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 ) ) { - args->GetFloat( "angle", "0", angles[ 1 ] ); - angles[ 0 ] = 0; + args->GetFloat( "angle", "0", angles[ 1 ] ); + angles[ 0 ] = 0; angles[ 1 ] = idMath::AngleNormalize360( angles[ 1 ] ); - angles[ 2 ] = 0; + angles[ 2 ] = 0; mat = angles.ToMat3(); } } @@ -228,7 +228,7 @@ archives object for save game file */ void idLight::Save( idSaveGame *savefile ) const { savefile->WriteRenderLight( renderLight ); - + savefile->WriteBool( renderLight.prelightModel != NULL ); savefile->WriteVec3( localLightOrigin ); @@ -383,7 +383,7 @@ void idLight::Spawn( void ) { int pos; needBroken = false; - + pos = model.Find( "." ); if ( pos < 0 ) { pos = model.Length(); @@ -396,7 +396,7 @@ void idLight::Spawn( void ) { brokenModel += &model[ pos ]; } } - + // make sure the model gets cached if ( !renderModelManager->CheckModel( brokenModel ) ) { if ( needBroken ) { @@ -407,7 +407,7 @@ void idLight::Spawn( void ) { } GetPhysics()->SetContents( spawnArgs.GetBool( "nonsolid" ) ? 0 : CONTENTS_SOLID ); - + // make sure the collision model gets cached idClipModel::CheckModel( brokenModel ); } @@ -1088,7 +1088,7 @@ void idLight::ReadFromSnapshot( const idBitMsgDelta &msg ) { } } UnpackColor( msg.ReadLong(), baseColor ); - // lightParentEntityNum = msg.ReadBits( GENTITYNUM_BITS ); + // lightParentEntityNum = msg.ReadBits( GENTITYNUM_BITS ); /* // only helps prediction UnpackColor( msg.ReadLong(), fadeFrom ); diff --git a/game/Light.h b/game/Light.h index 20d31e6..123c8f2 100644 --- a/game/Light.h +++ b/game/Light.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/Misc.cpp b/game/Misc.cpp index c0f110e..0736877 100644 --- a/game/Misc.cpp +++ b/game/Misc.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -415,7 +415,7 @@ void idPathCorner::Event_RandomPath( void ) { =============================================================================== idDamagable - + =============================================================================== */ @@ -465,9 +465,9 @@ void idDamagable::Spawn( void ) { idStr broken; health = spawnArgs.GetInt( "health", "5" ); - spawnArgs.GetInt( "count", "1", count ); + spawnArgs.GetInt( "count", "1", count ); nextTriggerTime = 0; - + // make sure the model gets cached spawnArgs.GetString( "broken", "", broken ); if ( broken.Length() && !renderModelManager->CheckModel( broken ) ) { @@ -488,7 +488,7 @@ void idDamagable::BecomeBroken( idEntity *activator ) { int numStates; int cycle; float wait; - + if ( gameLocal.time < nextTriggerTime ) { return; } @@ -579,7 +579,7 @@ void idDamagable::Event_RestoreDamagable( void ) { =============================================================================== idExplodable - + =============================================================================== */ @@ -629,7 +629,7 @@ void idExplodable::Event_Explode( idEntity *activator ) { =============================================================================== idSpring - + =============================================================================== */ @@ -666,7 +666,7 @@ void idSpring::Think( void ) { origin = ent2->GetPhysics()->GetOrigin(); end = origin + p2 * axis; } - + gameRenderWorld->DebugLine( idVec4(1, 1, 0, 1), start, end, 0, true ); } @@ -734,7 +734,7 @@ void idSpring::Spawn( void ) { =============================================================================== idForceField - + =============================================================================== */ @@ -964,7 +964,7 @@ void idAnimated::Spawn( void ) { float wait; const char *joint; - joint = spawnArgs.GetString( "sound_bone", "origin" ); + joint = spawnArgs.GetString( "sound_bone", "origin" ); soundJoint = animator.GetJointHandle( 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 ); @@ -1013,7 +1013,7 @@ void idAnimated::Spawn( void ) { animator.CycleAnim( ANIMCHANNEL_ALL, anim2, gameLocal.time, 0 ); } else if ( anim ) { // 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 ) { blendFrames = 0; @@ -1074,7 +1074,7 @@ bool idAnimated::StartRagdoll( void ) { // start using the AF af.StartFromCurrentPose( spawnArgs.GetInt( "velocityTime", "0" ) ); - + return true; } @@ -1117,7 +1117,7 @@ void idAnimated::PlayNextAnim( void ) { if ( g_debugCinematic.GetBool() ) { gameLocal.Printf( "%d: '%s' start anim '%s'\n", gameLocal.framenum, GetName(), animname ); } - + spawnArgs.GetInt( "cycle", "1", cycle ); if ( ( current_anim_index == num_anims ) && spawnArgs.GetBool( "loop_last_anim" ) ) { cycle = -1; @@ -1269,7 +1269,7 @@ void idAnimated::Event_LaunchMissilesUpdate( int launchjoint, int targetjoint, i animator.GetJointTransform( ( jointHandle_t )launchjoint, gameLocal.time, launchPos, axis ); launchPos = renderEntity.origin + launchPos * renderEntity.axis; - + animator.GetJointTransform( ( jointHandle_t )targetjoint, gameLocal.time, targetPos, axis ); targetPos = renderEntity.origin + targetPos * renderEntity.axis; @@ -1529,7 +1529,7 @@ void idStaticEntity::Event_Activate( idEntity *activator ) { renderEntity.shaderParms[ SHADERPARM_TIMEOFFSET ] = -MS2SEC( spawnTime ); 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 // 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; @@ -2248,7 +2248,7 @@ void idBeam::Event_Activate( idEntity *activator ) { if ( IsHidden() ) { Show(); } else { - Hide(); + Hide(); } } @@ -2401,7 +2401,7 @@ void idShaking::Spawn( void ) { physicsObj.SetAxis( GetPhysics()->GetAxis() ); physicsObj.SetClipMask( MASK_SOLID ); SetPhysics( &physicsObj ); - + active = false; if ( !spawnArgs.GetBool( "start_off" ) ) { BeginShaking(); @@ -2530,7 +2530,7 @@ idEarthQuake::Event_Activate ================ */ void idEarthQuake::Event_Activate( idEntity *activator ) { - + if ( nextTriggerTime > gameLocal.time ) { return; } @@ -2854,7 +2854,7 @@ void idFuncRadioChatter::Event_Activate( idEntity *activator ) { const char *sound; const idSoundShader *shader; int length; - + if ( activator->IsType( idPlayer::Type ) ) { player = static_cast( activator ); } else { @@ -2869,7 +2869,7 @@ void idFuncRadioChatter::Event_Activate( idEntity *activator ) { player->StartSoundShader( shader, SND_CHANNEL_RADIO, SSF_GLOBAL, false, &length ); 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 PostEventSec( &EV_ResetRadioHud, time, player ); @@ -2907,8 +2907,8 @@ idPhantomObjects::idPhantomObjects idPhantomObjects::idPhantomObjects() { target = NULL; end_time = 0; - throw_time = 0.0f; - shake_time = 0.0f; + throw_time = 0.0f; + shake_time = 0.0f; shake_ang.Zero(); speed = 0.0f; min_wait = 0; @@ -2959,8 +2959,8 @@ void idPhantomObjects::Restore( idRestoreGame *savefile ) { savefile->ReadInt( min_wait ); savefile->ReadInt( max_wait ); target.Restore( savefile ); - - savefile->ReadInt( num ); + + savefile->ReadInt( num ); targetTime.SetGranularity( 1 ); targetTime.SetNum( num ); lastTargetPos.SetGranularity( 1 ); @@ -3029,7 +3029,7 @@ void idPhantomObjects::Event_Activate( idEntity *activator ) { } else { target = static_cast( activator ); } - + end_time = gameLocal.time + SEC2MS( spawnArgs.GetFloat( "end_time", "0" ) ); targetTime.SetNum( targets.Num() ); @@ -3037,7 +3037,7 @@ void idPhantomObjects::Event_Activate( idEntity *activator ) { 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; for( i = 0; i < targetTime.Num(); i++ ) { targetTime[ i ] = SEC2MS( time ); @@ -3095,7 +3095,7 @@ void idPhantomObjects::Think( void ) { if ( !ent ) { continue; } - + if ( ent->fl.hidden ) { // don't throw hidden objects continue; @@ -3122,7 +3122,7 @@ void idPhantomObjects::Think( void ) { } 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 ); vel *= speed; entPhys->SetLinearVelocity( vel ); diff --git a/game/Misc.h b/game/Misc.h index 619d66d..1fda06f 100644 --- a/game/Misc.h +++ b/game/Misc.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -97,7 +97,7 @@ private: Bind to a mover to have the mover activate a trigger as it moves. When target by triggers, activating the trigger will toggle the activator on and off. Check "start_off" to have it spawn disabled. - + =============================================================================== */ @@ -283,7 +283,7 @@ private: void PlayNextAnim( void ); - void Event_Activate( idEntity *activator ); + void Event_Activate( idEntity *activator ); void Event_Start( void ); void Event_StartRagdoll( void ); void Event_AnimDone( int animIndex ); @@ -477,7 +477,7 @@ public: void Save( idSaveGame *savefile ) const; void Restore( idRestoreGame *savefile ); - void Event_Activate( idEntity *activator ); + void Event_Activate( idEntity *activator ); private: qhandle_t portal; @@ -597,7 +597,7 @@ private: class idEarthQuake : public idEntity { public: CLASS_PROTOTYPE( idEarthQuake ); - + idEarthQuake(); void Spawn( void ); @@ -632,7 +632,7 @@ private: class idFuncPortal : public idEntity { public: CLASS_PROTOTYPE( idFuncPortal ); - + idFuncPortal(); void Spawn( void ); @@ -658,7 +658,7 @@ private: class idFuncAASPortal : public idEntity { public: CLASS_PROTOTYPE( idFuncAASPortal ); - + idFuncAASPortal(); void Spawn( void ); @@ -683,7 +683,7 @@ private: class idFuncAASObstacle : public idEntity { public: CLASS_PROTOTYPE( idFuncAASObstacle ); - + idFuncAASObstacle(); void Spawn( void ); @@ -735,7 +735,7 @@ private: class idPhantomObjects : public idEntity { public: CLASS_PROTOTYPE( idPhantomObjects ); - + idPhantomObjects(); void Spawn( void ); diff --git a/game/Moveable.cpp b/game/Moveable.cpp index 0cf8b34..a49468e 100644 --- a/game/Moveable.cpp +++ b/game/Moveable.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -35,7 +35,7 @@ If you have questions concerning this license or the applicable additional terms =============================================================================== idMoveable - + =============================================================================== */ @@ -479,7 +479,7 @@ void idMoveable::Event_Activate( idEntity *activator ) { Show(); if ( !spawnArgs.GetInt( "notPushable" ) ) { - physicsObj.EnableImpact(); + physicsObj.EnableImpact(); } physicsObj.Activate(); @@ -540,7 +540,7 @@ void idMoveable::Event_EnableDamage( float enable ) { =============================================================================== idBarrel - + =============================================================================== */ @@ -993,7 +993,7 @@ void idExplodingBarrel::Killed( idEntity *inflictor, idEntity *attacker, int dam msg.Init( msgBuf, sizeof( msgBuf ) ); msg.WriteLong( gameLocal.time ); ServerSendEvent( EVENT_EXPLODE, &msg, false, -1 ); - } + } } // do this before applying radius damage so the ent can trace to any damagable ents nearby @@ -1006,7 +1006,7 @@ void idExplodingBarrel::Killed( idEntity *inflictor, idEntity *attacker, int dam } ExplodingEffects( ); - + //FIXME: need to precache all the debris stuff here and in the projectiles const idKeyValue *kv = spawnArgs.MatchPrefix( "def_debris" ); // bool first = true; @@ -1036,7 +1036,7 @@ void idExplodingBarrel::Killed( idEntity *inflictor, idEntity *attacker, int dam debris->Launch(); debris->GetRenderEntity()->shaderParms[ SHADERPARM_TIME_OF_DEATH ] = ( gameLocal.time + 1500 ) * 0.001f; debris->UpdateVisuals(); - + } kv = spawnArgs.MatchPrefix( "def_debris", kv ); } @@ -1062,7 +1062,7 @@ void idExplodingBarrel::Killed( idEntity *inflictor, idEntity *attacker, int dam 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 idDict *damageDef = gameLocal.FindEntityDefDict( damageDefName ); diff --git a/game/Moveable.h b/game/Moveable.h index 4ec5dd0..71b9678 100644 --- a/game/Moveable.h +++ b/game/Moveable.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -152,7 +152,7 @@ public: void Restore( idRestoreGame *savefile ); 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 ); virtual void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ); diff --git a/game/Mover.cpp b/game/Mover.cpp index 9d5f51c..739b86f 100644 --- a/game/Mover.cpp +++ b/game/Mover.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms #include "Game_local.h" -// 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 // realtime info like this // binary only @@ -172,7 +172,7 @@ void idMover::Save( idSaveGame *savefile ) const { savefile->WriteInt( move.movetime ); savefile->WriteInt( move.deceleration ); savefile->WriteVec3( move.dir ); - + savefile->WriteInt( rot.stage ); savefile->WriteInt( rot.acceleration ); savefile->WriteInt( rot.movetime ); @@ -180,7 +180,7 @@ void idMover::Save( idSaveGame *savefile ) const { savefile->WriteFloat( rot.rot.pitch ); savefile->WriteFloat( rot.rot.yaw ); savefile->WriteFloat( rot.rot.roll ); - + savefile->WriteInt( move_thread ); savefile->WriteInt( rotate_thread ); @@ -241,7 +241,7 @@ void idMover::Restore( idRestoreGame *savefile ) { savefile->ReadInt( move.movetime ); savefile->ReadInt( move.deceleration ); savefile->ReadVec3( move.dir ); - + savefile->ReadInt( (int&)rot.stage ); savefile->ReadInt( rot.acceleration ); savefile->ReadInt( rot.movetime ); @@ -249,7 +249,7 @@ void idMover::Restore( idRestoreGame *savefile ) { savefile->ReadFloat( rot.rot.pitch ); savefile->ReadFloat( rot.rot.yaw ); savefile->ReadFloat( rot.rot.roll ); - + savefile->ReadInt( move_thread ); savefile->ReadInt( rotate_thread ); @@ -297,7 +297,7 @@ void idMover::Restore( idRestoreGame *savefile ) { savefile->ReadInt( useAngles ); PostEventMS( &EV_PostRestore, 0, starttime, totaltime, accel, decel, useAngles ); - } + } } /* @@ -522,7 +522,7 @@ idMover::FindGuiTargets ================ */ void idMover::FindGuiTargets( void ) { - gameLocal.GetTargets( spawnArgs, guiTargets, "guiTarget" ); + gameLocal.GetTargets( spawnArgs, guiTargets, "guiTarget" ); } /* @@ -587,7 +587,7 @@ void idMover::Event_InitGuiTargets( void ) { /*********************************************************************** Translation control functions - + ***********************************************************************/ /* @@ -780,7 +780,7 @@ void idMover::BeginMove( idThread *thread ) { /*********************************************************************** Rotation control functions - + ***********************************************************************/ /* @@ -975,8 +975,8 @@ void idMover::BeginRotation( idThread *thread, bool stopwhendone ) { /*********************************************************************** - Script callable routines - + Script callable routines + ***********************************************************************/ /* @@ -1694,7 +1694,7 @@ idElevator::Event_Touch =============== */ void idElevator::Event_Touch( idEntity *other, trace_t *trace ) { - + if ( gameLocal.time < lastTouchTime + 2000 ) { return; } @@ -1756,7 +1756,7 @@ void idElevator::Think( void ) { MoveToPos( fi->pos ); } } - } + } RunPhysics(); Present(); } @@ -2418,7 +2418,7 @@ idMover_Binary::SetMoverState =============== */ void idMover_Binary::SetMoverState( moverState_t newstate, int time ) { - idVec3 delta; + idVec3 delta; moverState = newstate; move_thread = 0; @@ -2498,7 +2498,7 @@ void idMover_Binary::Event_MatchActivateTeam( moverState_t newstate, int time ) ================ 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 ) { @@ -2622,7 +2622,7 @@ void idMover_Binary::Event_Reached_BinaryMover( void ) { // return to pos1 after a delay PostEventSec( &EV_Mover_ReturnToPos1, wait ); } - + // fire targets ActivateTargets( moveMaster->GetActivator() ); @@ -2880,7 +2880,7 @@ idMover_Binary::FindGuiTargets ================ */ void idMover_Binary::FindGuiTargets( void ) { - gameLocal.GetTargets( spawnArgs, guiTargets, "guiTarget" ); + gameLocal.GetTargets( spawnArgs, guiTargets, "guiTarget" ); } /* @@ -3275,7 +3275,7 @@ void idDoor::Spawn( void ) { // if "start_open", reverse position 1 and 2 if ( start_open ) { // post it after EV_SpawnBind - PostEventMS( &EV_Door_StartOpen, 1 ); + PostEventMS( &EV_Door_StartOpen, 1 ); } if ( spawnArgs.GetFloat( "time", "1", time ) ) { @@ -3494,7 +3494,7 @@ void idDoor::Use( idEntity *other, idEntity *activator ) { } ActivateTargets( activator ); Use_BinaryMover( activator ); - } + } } /* @@ -3592,7 +3592,7 @@ void idDoor::CalcTriggerBounds( float size, idBounds &bounds ) { // find the bounds of everything on the team bounds = GetPhysics()->GetAbsBounds(); - + fl.takedamage = true; for( other = activateChain; other != NULL; other = other->GetActivateChain() ) { if ( other->IsType( idDoor::Type ) ) { @@ -3877,13 +3877,13 @@ void idDoor::Event_Activate( idEntity *activator ) { } } - if ( syncLock.Length() ) { + if ( syncLock.Length() ) { idEntity *sync = gameLocal.FindEntity( syncLock ); if ( sync && sync->IsType( idDoor::Type ) ) { if ( static_cast( sync )->IsOpen() ) { - return; - } - } + return; + } + } } ActivateTargets( activator ); @@ -4185,7 +4185,7 @@ void idPlat::SpawnPlatTrigger( idVec3 &pos ) { tmin[1] = ( bounds[0][1] + bounds[1][1] ) * 0.5f; tmax[1] = tmin[1] + 1; } - + trigger = new idClipModel( idTraceModel( idBounds( tmin, tmax ) ) ); trigger->Link( gameLocal.clip, this, 255, GetPhysics()->GetOrigin(), mat3_identity ); trigger->SetContents( CONTENTS_TRIGGER ); @@ -4425,7 +4425,7 @@ void idRotater::Event_Activate( idEntity *activator ) { spawnArgs.GetFloat( "speed", "100", speed ); spawnArgs.GetBool( "x_axis", "0", x_axis ); spawnArgs.GetBool( "y_axis", "0", y_axis ); - + // set the axis of rotation if ( x_axis ) { delta[2] = speed; diff --git a/game/Mover.h b/game/Mover.h index 650c632..f72af1c 100644 --- a/game/Mover.h +++ b/game/Mover.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -157,7 +157,7 @@ private: void VectorForDir( float dir, idVec3 &vec ); idCurve_Spline *GetSpline( idEntity *splineEntity ) const; - void Event_SetCallback( void ); + void Event_SetCallback( void ); void Event_TeamBlocked( idEntity *blockedPart, idEntity *blockingEntity ); void Event_StopMoving( void ); void Event_StopRotating( void ); @@ -479,7 +479,7 @@ public: idMover_Periodic( void ); void Spawn( void ); - + void Save( idSaveGame *savefile ) const; void Restore( idRestoreGame *savefile ); diff --git a/game/MultiplayerGame.cpp b/game/MultiplayerGame.cpp index 70bbfc1..8d740af 100644 --- a/game/MultiplayerGame.cpp +++ b/game/MultiplayerGame.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -193,7 +193,7 @@ void idMultiplayerGame::SpawnPlayer( int clientNum ) { bool ingame = playerState[ clientNum ].ingame; memset( &playerState[ clientNum ], 0, sizeof( playerState[ clientNum ] ) ); - if ( !gameLocal.isClient ) { + if ( !gameLocal.isClient ) { idPlayer *p = static_cast< idPlayer * >( gameLocal.entities[ clientNum ] ); p->spawnedTime = gameLocal.time; if ( gameLocal.gameType == GAME_TDM ) { @@ -260,7 +260,7 @@ idMultiplayerGame::ClearGuis */ void idMultiplayerGame::ClearGuis() { int i; - + for ( i = 0; i < MAX_CLIENTS; i++ ) { scoreBoard->SetStateString( va( "player%i",i+1 ), "" ); scoreBoard->SetStateString( va( "player%i_score", i+1 ), "" ); @@ -280,7 +280,7 @@ void idMultiplayerGame::ClearGuis() { player->hud->SetStateString( va( "player%i_ready", i+1 ), "" ); scoreBoard->SetStateInt( va( "rank%i", i+1 ), 0 ); player->hud->SetStateInt( "rank_self", 0 ); - } + } } /* @@ -437,7 +437,7 @@ void idMultiplayerGame::UpdateScoreboard( idUserInterface *scoreBoard, idPlayer continue; } } - + iline++; if ( !playerState[ i ].ingame ) { scoreBoard->SetStateString( va( "player%i", iline ), common->GetLanguageDict()->GetString( "#str_04244" ) ); @@ -504,7 +504,7 @@ void idMultiplayerGame::UpdateScoreboard( idUserInterface *scoreBoard, idPlayer } else { livesinfo = va( "%s: %i", common->GetLanguageDict()->GetString( "#str_01982" ), gameLocal.serverInfo.GetInt( "si_fragLimit" ) ); - } + } if ( gameLocal.serverInfo.GetInt( "si_timeLimit" ) > 0 ) { timeinfo = va( "%s: %i", common->GetLanguageDict()->GetString( "#str_01983" ), gameLocal.serverInfo.GetInt( "si_timeLimit" ) ); } else { @@ -544,7 +544,7 @@ const char *idMultiplayerGame::GameTime() { if ( ms < 0 ) { ms = 0; } - + s = ms / 1000; m = s / 60; s -= m * 60; @@ -701,7 +701,7 @@ idPlayer *idMultiplayerGame::FragLimitHit() { idMultiplayerGame::TimeLimitHit ================ */ -bool idMultiplayerGame::TimeLimitHit() { +bool idMultiplayerGame::TimeLimitHit() { int timeLimit = gameLocal.serverInfo.GetInt( "si_timeLimit" ); if ( timeLimit ) { if ( gameLocal.time >= matchStartedTime + timeLimit * 60000 ) { @@ -827,7 +827,7 @@ void idMultiplayerGame::UpdateWinsLosses( idPlayer *winner ) { PlayGlobalSound( player->entityNumber, SND_YOULOSE ); } } else if ( gameLocal.gameType == GAME_TOURNEY ) { - if ( player == winner ) { + if ( player == winner ) { playerState[ i ].wins++; PlayGlobalSound( player->entityNumber, SND_YOUWIN ); } else if ( i == currentTourneyPlayer[ 0 ] || i == currentTourneyPlayer[ 1 ] ) { @@ -928,7 +928,7 @@ void idMultiplayerGame::PlayerStats( int clientNum, char *data, const int len ) } // find which team this player is on - ent = gameLocal.entities[ clientNum ]; + ent = gameLocal.entities[ clientNum ]; if ( ent && ent->IsType( idPlayer::Type ) ) { team = static_cast< idPlayer * >(ent)->team; } else { @@ -1169,7 +1169,7 @@ void idMultiplayerGame::CycleTourneyPlayers( ) { if ( lastWinner != -1 ) { idEntity *ent = gameLocal.entities[ lastWinner ]; if ( ent && ent->IsType( idPlayer::Type ) ) { - currentTourneyPlayer[ 0 ] = lastWinner; + currentTourneyPlayer[ 0 ] = lastWinner; } } FillTourneySlots( ); @@ -2032,11 +2032,11 @@ idMultiplayerGame::AddChatLine void idMultiplayerGame::AddChatLine( const char *fmt, ... ) { idStr temp; va_list argptr; - + va_start( argptr, fmt ); vsprintf( temp, fmt, argptr ); va_end( argptr ); - + gameLocal.Printf( "%s\n", temp.c_str() ); chatHistory[ chatHistoryIndex % NUM_CHAT_NOTIFY ].line = temp; @@ -2330,7 +2330,7 @@ void idMultiplayerGame::CheckRespawns( idPlayer *spectator ) { gameLocal.gameType == GAME_TDM ) { if ( gameState == WARMUP || gameState == COUNTDOWN || gameState == GAMEON ) { p->ServerSpectate( false ); - } + } } else if ( gameLocal.gameType == GAME_TOURNEY ) { if ( i == currentTourneyPlayer[ 0 ] || i == currentTourneyPlayer[ 1 ] ) { if ( gameState == WARMUP || gameState == COUNTDOWN || gameState == GAMEON ) { @@ -2366,7 +2366,7 @@ void idMultiplayerGame::CheckRespawns( idPlayer *spectator ) { // so set the fragCount to something silly ( used in scoreboard and player ranking ) playerState[ i ].fragCount = LASTMAN_NOLIVES; p->ServerSpectate( true ); - + //Check for a situation where the last two player dies at the same time and don't //try to respawn manually...This was causing all players to go into spectate mode //and the server got stuck @@ -2645,7 +2645,7 @@ void idMultiplayerGame::ClientCallVote( vote_flags_t voteIndex, const char *vote idBitMsg outMsg; byte msgBuf[ MAX_GAME_MESSAGE_SIZE ]; - // send + // send outMsg.Init( msgBuf, sizeof( msgBuf ) ); outMsg.WriteByte( GAME_RELIABLE_MESSAGE_CALLVOTE ); outMsg.WriteByte( voteIndex ); @@ -2733,7 +2733,7 @@ void idMultiplayerGame::ServerCallVote( int clientNum, const idBitMsg &msg ) { if ( vote_timeLimit == gameLocal.serverInfo.GetInt( "si_timeLimit" ) ) { gameLocal.ServerSendChatMessage( clientNum, "server", common->GetLanguageDict()->GetString( "#str_04270" ) ); 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() ) { gameLocal.ServerSendChatMessage( clientNum, "server", common->GetLanguageDict()->GetString( "#str_04269" ) ); @@ -2748,7 +2748,7 @@ void idMultiplayerGame::ServerCallVote( int clientNum, const idBitMsg &msg ) { if ( vote_fragLimit == gameLocal.serverInfo.GetInt( "si_fragLimit" ) ) { gameLocal.ServerSendChatMessage( clientNum, "server", common->GetLanguageDict()->GetString( "#str_04267" ) ); 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() ) { gameLocal.ServerSendChatMessage( clientNum, "server", common->GetLanguageDict()->GetString( "#str_04266" ) ); @@ -2944,11 +2944,11 @@ void idMultiplayerGame::SwitchToTeam( int clientNum, int oldteam, int newteam ) if ( i == clientNum ) { continue; } - ent = gameLocal.entities[ i ]; + ent = gameLocal.entities[ i ]; if ( ent && ent->IsType( idPlayer::Type ) && static_cast< idPlayer * >(ent)->team == newteam ) { playerState[ clientNum ].teamFragCount = playerState[ i ].teamFragCount; break; - } + } } if ( i == gameLocal.numClients ) { // alone on this team @@ -2977,7 +2977,7 @@ void idMultiplayerGame::ProcessChatMessage( int clientNum, bool team, const char const char *prefix = NULL; int send_to; // 0 - all, 1 - specs, 2 - team int i; - idEntity *ent; + idEntity *ent; idPlayer *p; idStr prefixed_name; @@ -3028,7 +3028,7 @@ void idMultiplayerGame::ProcessChatMessage( int clientNum, bool team, const char } } else { for ( i = 0; i < gameLocal.numClients; i++ ) { - ent = gameLocal.entities[ i ]; + ent = gameLocal.entities[ i ]; if ( !ent || !ent->IsType( idPlayer::Type ) ) { continue; } @@ -3068,7 +3068,7 @@ void idMultiplayerGame::Precache( void ) { return; } gameLocal.FindEntityDefDict( "player_doommarine", false );; - + // skins idStr str = cvarSystem->GetCVarString( "mod_validSkins" ); idStr skin; @@ -3148,7 +3148,7 @@ idMultiplayerGame::ToggleTeam void idMultiplayerGame::ToggleTeam( void ) { bool team; assert( gameLocal.isClient || gameLocal.localClientNum == 0 ); - + team = ( idStr::Icmp( cvarSystem->GetCVarString( "ui_team" ), "Red" ) == 0 ); if ( team ) { cvarSystem->SetCVarString( "ui_team", "Blue" ); @@ -3349,7 +3349,7 @@ void idMultiplayerGame::ServerWriteInitialReliableMessages( int clientNum ) { outMsg.WriteShort( startFragLimit ); // send the powerup states and the spectate states for( i = 0; i < gameLocal.numClients; i++ ) { - ent = gameLocal.entities[ i ]; + ent = gameLocal.entities[ i ]; if ( i != clientNum && ent && ent->IsType( idPlayer::Type ) ) { outMsg.WriteShort( i ); outMsg.WriteShort( static_cast< idPlayer * >( ent )->inventory.powerups ); @@ -3407,4 +3407,3 @@ idMultiplayerGame::ClientReadWarmupTime void idMultiplayerGame::ClientReadWarmupTime( const idBitMsg &msg ) { warmupEndTime = msg.ReadLong(); } - diff --git a/game/MultiplayerGame.h b/game/MultiplayerGame.h index a27de12..5275ab3 100644 --- a/game/MultiplayerGame.h +++ b/game/MultiplayerGame.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -108,7 +108,7 @@ public: // checks rules and updates state of the mp game void Run( void ); - // draws mp hud, scoredboard, etc.. + // draws mp hud, scoredboard, etc.. bool Draw( int clientNum ); // updates a player vote @@ -214,7 +214,7 @@ public: void ProcessVoiceChat( int clientNum, bool team, int index ); void Precache( void ); - + // throttle UI switch rates void ThrottleUserInfo( void ); void ToggleSpectate( void ); @@ -312,7 +312,7 @@ private: // updates the passed gui with current score information void UpdateRankColor( idUserInterface *gui, const char *mask, int i, const idVec3 &vec ); void UpdateScoreboard( idUserInterface *scoreBoard, idPlayer *player ); - + void ClearGuis( void ); void DrawScoreBoard( idPlayer *player ); void UpdateHud( idPlayer *player, idUserInterface *hud ); @@ -368,4 +368,3 @@ ID_INLINE bool idMultiplayerGame::IsInGame( int clientNum ) { } #endif /* !__MULTIPLAYERGAME_H__ */ - diff --git a/game/Player.cpp b/game/Player.cpp index e58bef2..f33d10f 100644 --- a/game/Player.cpp +++ b/game/Player.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -137,7 +137,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 memset( clip, -1, sizeof( clip ) ); - + items.DeleteContents( true ); memset(pdasViewed, 0, 4 * sizeof( pdasViewed[0] ) ); pdas.Clear(); @@ -186,7 +186,7 @@ void idInventory::GivePowerUp( idPlayer *player, int powerup, int msec ) { case MEGAHEALTH: def = gameLocal.FindEntityDef( "powerup_megahealth", false ); break; - case ADRENALINE: + case ADRENALINE: def = gameLocal.FindEntityDef( "powerup_adrenaline", false ); break; } @@ -226,7 +226,7 @@ void idInventory::GetPersistantData( idDict &dict ) { // 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 for( i = 0; i < AMMO_NUMTYPES; i++ ) { @@ -448,7 +448,7 @@ void idInventory::Save( idSaveGame *savefile ) const { savefile->WriteInt( pdasViewed[1] ); savefile->WriteInt( pdasViewed[2] ); savefile->WriteInt( pdasViewed[3] ); - + savefile->WriteInt( selPDA ); savefile->WriteInt( selVideo ); savefile->WriteInt( selEMail ); @@ -548,7 +548,7 @@ void idInventory::Restore( idRestoreGame *savefile ) { savefile->ReadInt( pdasViewed[1] ); savefile->ReadInt( pdasViewed[2] ); savefile->ReadInt( pdasViewed[3] ); - + savefile->ReadInt( selPDA ); savefile->ReadInt( selVideo ); savefile->ReadInt( selEMail ); @@ -713,7 +713,7 @@ void idInventory::AddPickupName( const char *name, const char *icon ) { info.name = name; } info.icon = icon; - } + } } /* @@ -741,7 +741,7 @@ bool idInventory::Give( idPlayer *owner, const idDict &spawnArgs, const char *st return false; } amount = atoi( value ); - if ( amount ) { + if ( amount ) { ammo[ i ] += amount; if ( ( max > 0 ) && ( ammo[ i ] > max ) ) { ammo[ i ] = max; @@ -815,7 +815,7 @@ bool idInventory::Give( idPlayer *owner, const idDict &spawnArgs, const char *st if ( owner->GetUserInfo()->GetBool( "ui_autoSwitch" ) && idealWeapon ) { assert( !gameLocal.isClient ); *idealWeapon = i; - } + } if ( owner->hud && updateHud && lastGiveTime + 1000 < gameLocal.time ) { owner->hud->SetStateInt( "newWeapon", i ); owner->hud->HandleNamedEvent( "newWeapon" ); @@ -1069,7 +1069,7 @@ idPlayer::idPlayer() { talkCursor = 0; focusVehicle = NULL; cursor = NULL; - + oldMouseX = 0; oldMouseY = 0; @@ -1369,7 +1369,7 @@ void idPlayer::Init( void ) { // execute the script so the script object's constructor takes effect immediately scriptThread->Execute(); - + forceScoreBoard = false; forcedReady = false; @@ -1549,7 +1549,7 @@ void idPlayer::Spawn( void ) { } else { hiddenWeapon = false; } - + if ( hud ) { UpdateHudWeapon(); hud->StateChanged( gameLocal.time ); @@ -2066,7 +2066,7 @@ void idPlayer::PrepareForRestart( void ) { ClearPowerUps(); Spectate( true ); forceRespawn = true; - + // we will be restarting program, clear the client entities from program-related things first ShutdownThreads(); @@ -2081,7 +2081,7 @@ idPlayer::Restart */ void idPlayer::Restart( void ) { idActor::Restart(); - + // client needs to setup the animation script object again if ( gameLocal.isClient ) { Init(); @@ -2157,7 +2157,7 @@ Chooses a spawn location and spawns the player void idPlayer::SpawnFromSpawnSpot( void ) { idVec3 spawn_origin; idAngles spawn_angles; - + SelectInitialSpawnPoint( spawn_origin, spawn_angles ); SpawnToPoint( spawn_origin, spawn_angles ); } @@ -2430,7 +2430,7 @@ bool idPlayer::UserInfoChanged( bool canModify ) { if ( canModify && spec ) { userInfo->Set( "ui_spectate", "Play" ); 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 forceRespawn = true; } @@ -2448,7 +2448,7 @@ bool idPlayer::UserInfoChanged( bool canModify ) { modifiedInfo |= BalanceTDM( ); } UpdateSkinSetup( false ); - + isChatting = userInfo->GetBool( "ui_chat", "0" ); if ( canModify && isChatting && AI_DEAD ) { // if dead, always force chat icon off. @@ -2478,13 +2478,13 @@ void idPlayer::UpdateHudAmmo( idUserInterface *_hud ) { // show infinite ammo _hud->SetStateString( "player_ammo", "" ); _hud->SetStateString( "player_totalammo", "" ); - } else { + } else { // show remaining ammo _hud->SetStateString( "player_totalammo", va( "%i", ammoamount - inclip ) ); _hud->SetStateString( "player_ammo", weapon.GetEntity()->ClipSize() ? va( "%i", inclip ) : "--" ); // how much in the current clip _hud->SetStateString( "player_clips", weapon.GetEntity()->ClipSize() ? va( "%i", ammoamount / weapon.GetEntity()->ClipSize() ) : "--" ); _hud->SetStateString( "player_allammo", va( "%i/%i", inclip, ammoamount - inclip ) ); - } + } _hud->SetStateBool( "player_ammo_empty", ( ammoamount == 0 ) ); _hud->SetStateBool( "player_clip_empty", ( weapon.GetEntity()->ClipSize() ? inclip == 0 : false ) ); @@ -2532,7 +2532,7 @@ void idPlayer::UpdateHudStats( idUserInterface *_hud ) { healthTake = false; } - if ( inventory.ammoPulse ) { + if ( inventory.ammoPulse ) { _hud->HandleNamedEvent( "ammoPulse" ); inventory.ammoPulse = false; } @@ -2544,7 +2544,7 @@ void idPlayer::UpdateHudStats( idUserInterface *_hud ) { _hud->HandleNamedEvent( "weaponPulse" ); inventory.weaponPulse = false; } - if ( inventory.armorPulse ) { + if ( inventory.armorPulse ) { _hud->HandleNamedEvent( "armorPulse" ); inventory.armorPulse = false; } @@ -2637,9 +2637,9 @@ void idPlayer::EnterCinematic( void ) { if ( hud ) { hud->HandleNamedEvent( "radioChatterDown" ); } - + physicsObj.SetLinearVelocity( vec3_origin ); - + SetState( "EnterCinematic" ); UpdateScript(); @@ -2820,7 +2820,7 @@ void idPlayer::CacheWeapons( void ) { if ( !inventory.weapons ) { return; } - + for( w = 0; w < MAX_WEAPONS; w++ ) { if ( inventory.weapons & ( 1 << w ) ) { weap = spawnArgs.GetString( va( "def_weapon%d", w ) ); @@ -2898,7 +2898,7 @@ adds health to the player health pool =============== */ void idPlayer::GiveHealthPool( float amt ) { - + if ( AI_DEAD ) { return; } @@ -2931,7 +2931,7 @@ bool idPlayer::GiveItem( idItem *item ) { } item->GetAttributes( attr ); - + gave = false; numPickup = inventory.pickupItemNames.Num(); for( i = 0; i < attr.GetNumKeyVals(); i++ ) { @@ -3532,13 +3532,13 @@ void idPlayer::NextWeapon( void ) { if ( !inventory.weapons ) { return; } - + w = idealWeapon; while( 1 ) { w++; if ( w >= MAX_WEAPONS ) { w = 0; - } + } weap = spawnArgs.GetString( va( "def_weapon%d", w ) ); if ( !spawnArgs.GetBool( va( "weapon%d_cycle", w ) ) ) { continue; @@ -3639,7 +3639,7 @@ void idPlayer::SelectWeapon( int num, bool force ) { } else { weapon.GetEntity()->RaiseWeapon(); } - } + } weap = spawnArgs.GetString( va( "def_weapon%d", num ) ); if ( !weap[ 0 ] ) { @@ -3677,11 +3677,11 @@ void idPlayer::DropWeapon( bool died ) { int inclip, ammoavailable; assert( !gameLocal.isClient ); - + if ( spectating || weaponGone || weapon.GetEntity() == NULL ) { return; } - + if ( ( !died && !weapon.GetEntity()->IsReady() ) || weapon.GetEntity()->IsReloading() ) { return; } @@ -3689,7 +3689,7 @@ void idPlayer::DropWeapon( bool died ) { // inclip is which amount is in clip right now ammoavailable = weapon.GetEntity()->AmmoAvailable(); inclip = weapon.GetEntity()->AmmoInClip(); - + // don't drop a grenade if we have none left if ( !idStr::Icmp( idWeapon::GetAmmoNameForNum( weapon.GetEntity()->GetAmmoType() ), "ammo_grenades" ) && ( ammoavailable - inclip <= 0 ) ) { return; @@ -3840,7 +3840,7 @@ void idPlayer::Weapon_Combat( void ) { SetState( newstate ); UpdateScript(); } - weaponCatchup = false; + weaponCatchup = false; } else { if ( weapon.GetEntity()->IsReady() ) { weapon.GetEntity()->PutAway(); @@ -3863,7 +3863,7 @@ void idPlayer::Weapon_Combat( void ) { } } } 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()->AmmoAvailable() ) { // weapons can switch automatically if they have no more ammo @@ -4037,7 +4037,7 @@ void idPlayer::UpdateWeapon( void ) { if ( hiddenWeapon && tipUp && usercmd.buttons & BUTTON_ATTACK ) { HideTip(); } - + if ( g_dragEntity.GetBool() ) { StopFiring(); weapon.GetEntity()->LowerWeapon(); @@ -4045,12 +4045,12 @@ void idPlayer::UpdateWeapon( void ) { } else if ( ActiveGui() ) { // gui handling overrides weapon use Weapon_GUI(); - } else if ( focusCharacter && ( focusCharacter->health > 0 ) ) { + } else if ( focusCharacter && ( focusCharacter->health > 0 ) ) { Weapon_NPC(); } else { Weapon_Combat(); } - + if ( hiddenWeapon ) { weapon.GetEntity()->LowerWeapon(); } @@ -4092,7 +4092,7 @@ void idPlayer::SpectateFreeFly( bool force ) { idAngles angle = player->viewAngles; angle[ 2 ] = 0; SetViewAngles( angle ); - } else { + } else { SelectInitialSpawnPoint( spawn_origin, spawn_angles ); spawn_origin[ 2 ] += pm_normalviewheight.GetFloat(); spawn_origin[ 2 ] += SPECTATE_RAISE; @@ -4286,7 +4286,7 @@ bool idPlayer::Collide( const trace_t &collision, const idVec3 &velocity ) { ================ idPlayer::UpdateLocation -Searches nearby locations +Searches nearby locations ================ */ void idPlayer::UpdateLocation( void ) { @@ -4469,7 +4469,7 @@ void idPlayer::UpdateFocus( void ) { } else { ui = focusGUIrenderEntity->gui[ 2 ]; } - + if ( ui == NULL ) { continue; } @@ -4522,7 +4522,7 @@ void idPlayer::UpdateFocus( void ) { // clamp the mouse to the corner ev = sys->GenerateMouseMoveEvent( -2000, -2000 ); command = focusUI->HandleEvent( &ev, gameLocal.time ); - HandleGuiCommands( focusGUIent, command ); + HandleGuiCommands( focusGUIent, command ); // move to an absolute position ev = sys->GenerateMouseMoveEvent( pt.x * SCREEN_WIDTH, pt.y * SCREEN_HEIGHT ); @@ -4758,7 +4758,7 @@ void idPlayer::BobCycle( const idVec3 &pushVelocity ) { // add angles based on velocity delta = velocity * viewaxis[0]; viewBobAngles.pitch += delta * pm_runpitch.GetFloat(); - + delta = velocity * viewaxis[1]; viewBobAngles.roll -= delta * pm_runroll.GetFloat(); @@ -4937,10 +4937,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 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 -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 Exception to the above rule is once the player is dead, the dying heart rate starts at either the current volume if @@ -4957,7 +4957,7 @@ void idPlayer::AdjustHeartRate( int target, float timeInSecs, float delay, bool return; } - lastHeartAdjust = gameLocal.time; + lastHeartAdjust = gameLocal.time; heartInfo.Init( gameLocal.time + delay * 1000, timeInSecs * 1000, heartRate, target ); } @@ -5011,7 +5011,7 @@ void idPlayer::SetCurrentHeartRate( void ) { pct = 0.0f; } pct *= ((float)deathVol - (float)zeroVol); - } + } pct += (float)zeroVol; @@ -5033,7 +5033,7 @@ void idPlayer::SetCurrentHeartRate( void ) { idPlayer::UpdateAir ============== */ -void idPlayer::UpdateAir( void ) { +void idPlayer::UpdateAir( void ) { if ( health <= 0 ) { return; } @@ -5077,7 +5077,7 @@ void idPlayer::UpdateAir( void ) { lastAirDamage = gameLocal.time; } } - + } else { if ( airless ) { StartSound( "snd_recompress", SND_CHANNEL_ANY, SSF_GLOBAL, false, NULL ); @@ -5614,7 +5614,7 @@ void idPlayer::PerformImpulse( int impulse ) { UseVehicle(); break; } - } + } } bool idPlayer::HandleESC( void ) { @@ -5702,7 +5702,7 @@ void idPlayer::AdjustSpeed( void ) { speed = pm_walkspeed.GetFloat() * ( 1.0f - bobFrac ) + pm_runspeed.GetFloat() * bobFrac; } else { rate = pm_staminarate.GetFloat(); - + // increase 25% faster when not moving if ( ( usercmd.forwardmove == 0 ) && ( usercmd.rightmove == 0 ) && ( !physicsObj.OnLadder() || ( usercmd.upmove == 0 ) ) ) { rate *= 1.25f; @@ -5810,7 +5810,7 @@ void idPlayer::AdjustBodyAngles( void ) { 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( 2, upBlend ); @@ -5836,7 +5836,7 @@ void idPlayer::InitAASLocation( void ) { num = gameLocal.NumAAS(); aasLocation.SetGranularity( 1 ); - aasLocation.SetNum( num ); + aasLocation.SetNum( num ); for( i = 0; i < aasLocation.Num(); i++ ) { aasLocation[ i ].areaNum = 0; aasLocation[ i ].pos = origin; @@ -5868,7 +5868,7 @@ void idPlayer::SetAASLocation( void ) { if ( !GetFloorPos( 64.0f, origin ) ) { return; } - + for( i = 0; i < aasLocation.Num(); i++ ) { aas = gameLocal.GetAAS( i ); if ( !aas ) { @@ -6015,7 +6015,7 @@ void idPlayer::Move( void ) { if ( AI_JUMP ) { // bounce the view weapon - loggedAccel_t *acc = &loggedAccel[currentLoggedAccel&(NUM_LOGGED_ACCELS-1)]; + loggedAccel_t *acc = &loggedAccel[currentLoggedAccel&(NUM_LOGGED_ACCELS-1)]; currentLoggedAccel++; acc->time = gameLocal.time; acc->dir[2] = 200; @@ -6065,7 +6065,7 @@ void idPlayer::UpdateHud( void ) { inventory.pickupItemNames.RemoveIndex( 0 ); if (inventory.nextItemNum == 1 ) { inventory.onePickupTime = gameLocal.time; - } else if ( inventory.nextItemNum > 5 ) { + } else if ( inventory.nextItemNum > 5 ) { inventory.nextItemNum = 1; inventory.nextItemPickup = inventory.onePickupTime + 2000; } else { @@ -6197,7 +6197,7 @@ void idPlayer::Think( void ) { // clear the ik before we do anything else so the skeleton doesn't get updated twice walkIK.ClearJointMods(); - + // if this is the very first frame of the map, set the delta view angles // based on the usercmd angles if ( !spawnAnglesSet && ( gameLocal.GameState() != GAMESTATE_STARTUP ) ) { @@ -6290,7 +6290,7 @@ void idPlayer::Think( void ) { // update GUIs, Items, and character interactions UpdateFocus(); - + UpdateLocation(); // update player script @@ -6298,7 +6298,7 @@ void idPlayer::Think( void ) { // service animations if ( !spectating && !af.IsActive() && !gameLocal.inCinematic ) { - UpdateConditions(); + UpdateConditions(); UpdateAnimState(); CheckBlink(); } @@ -6323,7 +6323,7 @@ void idPlayer::Think( void ) { } UpdateAir(); - + UpdateHud(); UpdatePowerUps(); @@ -6368,7 +6368,7 @@ void idPlayer::Think( void ) { if ( !g_stopTime.GetBool() ) { UpdateAnimation(); - Present(); + Present(); UpdateDamageEffects(); @@ -6417,7 +6417,7 @@ idPlayer::LookAtKiller */ void idPlayer::LookAtKiller( idEntity *inflictor, idEntity *attacker ) { idVec3 dir; - + if ( attacker && attacker != this ) { dir = attacker->GetPhysics()->GetOrigin() - GetPhysics()->GetOrigin(); } else if ( inflictor && inflictor != this ) { @@ -6552,7 +6552,7 @@ void idPlayer::GetAIAimTargets( const idVec3 &lastSightPos, idVec3 &headPos, idV idVec3 offset; idMat3 axis; idVec3 origin; - + origin = lastSightPos - physicsObj.GetOrigin(); GetJointWorldTransform( chestJoint, gameLocal.time, offset, axis ); @@ -6598,7 +6598,7 @@ void idPlayer::CalcDamagePoints( idEntity *inflictor, idEntity *attacker, const if ( !gameLocal.isMultiplayer ) { if ( inflictor != gameLocal.world ) { switch ( g_skill.GetInteger() ) { - case 0: + case 0: damage *= 0.80f; if ( damage < 1 ) { damage = 1; @@ -6699,14 +6699,14 @@ void idPlayer::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &di int armorSave; int knockback; idVec3 damage_from; - idVec3 localDamageVector; + idVec3 localDamageVector; float attackerPushScale; // damage is only processed on server if ( gameLocal.isClient ) { return; } - + if ( !fl.takedamage || noclip || spectating || gameLocal.inCinematic ) { return; } @@ -6768,7 +6768,7 @@ void idPlayer::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &di } lastArmorPulse = gameLocal.time; } - + if ( damageDef->dict.GetBool( "burn" ) ) { StartSound( "snd_burn", SND_CHANNEL_BODY3, 0, false, NULL ); } else if ( damageDef->dict.GetBool( "no_air" ) ) { @@ -6778,14 +6778,14 @@ void idPlayer::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &di } 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 ); } // move the world direction vector to local coordinates damage_from = dir; damage_from.Normalize(); - + viewAxis.ProjectVector( damage_from, localDamageVector ); // add to the damage inflicted on a player this frame @@ -7212,7 +7212,7 @@ idPlayer::GetEyePosition */ idVec3 idPlayer::GetEyePosition( void ) const { idVec3 org; - + // use the smoothed origin if spectating another player in multiplayer if ( gameLocal.isClient && entityNumber != gameLocal.localClientNum ) { org = smoothedOrigin; @@ -7264,7 +7264,7 @@ void idPlayer::CalculateFirstPersonView( void ) { ang = viewBobAngles + playerView.AngleOffset(); ang.yaw += viewAxis[ 0 ].ToYaw(); - + jointHandle_t joint = animator.GetJointHandle( "camera" ); animator.GetJointTransform( joint, gameLocal.time, origin, axis ); firstPersonViewOrigin = ( origin + modelOffset ) * ( viewAxis * physicsObj.GetGravityAxis() ) + physicsObj.GetOrigin() + viewBob; @@ -7351,7 +7351,7 @@ void idPlayer::CalculateRenderView( void ) { // allow the right player view weapons renderView->viewID = entityNumber + 1; } - + // field of view gameLocal.CalcFov( CalcFov( true ), renderView->fov_x, renderView->fov_y ); } @@ -7582,17 +7582,17 @@ void idPlayer::Event_StopFxFov( void ) { /* ================== -idPlayer::StartFxFov +idPlayer::StartFxFov ================== */ -void idPlayer::StartFxFov( float duration ) { +void idPlayer::StartFxFov( float duration ) { fxFov = true; PostEventSec( &EV_Player_StopFxFov, duration ); } /* ================== -idPlayer::Event_EnableWeapon +idPlayer::Event_EnableWeapon ================== */ void idPlayer::Event_EnableWeapon( void ) { @@ -7840,14 +7840,14 @@ void idPlayer::ClientPredictionThink( void ) { if ( !isLagged ) { // don't allow client to move when lagged Move(); - } + } // update GUIs, Items, and character interactions UpdateFocus(); // service animations if ( !spectating && !af.IsActive() ) { - UpdateConditions(); + UpdateConditions(); UpdateAnimState(); CheckBlink(); } @@ -8242,7 +8242,7 @@ bool idPlayer::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) { GivePowerUp( powerup, 0 ); } else { ClearPowerup( powerup ); - } + } return true; } case EVENT_SPECTATE: { @@ -8287,7 +8287,7 @@ idPlayer::Show */ void idPlayer::Show( void ) { idWeapon *weap; - + idActor::Show(); weap = weapon.GetEntity(); if ( weap ) { @@ -8328,7 +8328,7 @@ void idPlayer::ShowTip( const char *title, const char *tip, bool autoHide ) { } hud->SetStateString( "tip", tip ); hud->SetStateString( "tiptitle", title ); - hud->HandleNamedEvent( "tipWindowUp" ); + hud->HandleNamedEvent( "tipWindowUp" ); if ( autoHide ) { PostEventSec( &EV_Player_HideTip, 5.0f ); } @@ -8341,7 +8341,7 @@ idPlayer::HideTip =============== */ void idPlayer::HideTip( void ) { - hud->HandleNamedEvent( "tipWindowDown" ); + hud->HandleNamedEvent( "tipWindowDown" ); tipUp = false; } @@ -8460,7 +8460,7 @@ void idPlayer::Event_Gibbed( void ) { /* ================== -idPlayer::Event_GetIdealWeapon +idPlayer::Event_GetIdealWeapon ================== */ void idPlayer::Event_GetIdealWeapon( void ) { diff --git a/game/Player.h b/game/Player.h index d50b410..23377d0 100644 --- a/game/Player.h +++ b/game/Player.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms =============================================================================== Player entity. - + =============================================================================== */ @@ -55,7 +55,7 @@ const int FOCUS_GUI_TIME = 500; const int MAX_WEAPONS = 16; 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 BASE_HEARTRATE = 70; // default const int ZEROSTAMINA_HEARTRATE = 115; // no stamina @@ -87,7 +87,7 @@ struct idLevelTriggerInfo { // powerups - the "type" in item .def must match enum { - BERSERK = 0, + BERSERK = 0, INVISIBILITY, MEGAHEALTH, ADRENALINE, @@ -397,7 +397,7 @@ public: bool GiveItem( idItem *item ); void GiveItem( const char *name ); void GiveHealthPool( float amt ); - + bool GiveInventoryItem( idDict *item ); void RemoveInventoryItem( idDict *item ); bool GiveInventoryItem( const char *name ); @@ -586,7 +586,7 @@ private: int focusTime; idAFEntity_Vehicle * focusVehicle; idUserInterface * cursor; - + // full screen guis track mouse movements directly int oldMouseX; int oldMouseY; @@ -718,4 +718,3 @@ ID_INLINE void idPlayer::SetSelfSmooth( bool b ) { } #endif /* !__GAME_PLAYER_H__ */ - diff --git a/game/PlayerIcon.cpp b/game/PlayerIcon.cpp index 1e64fa1..33bfa45 100644 --- a/game/PlayerIcon.cpp +++ b/game/PlayerIcon.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -180,4 +180,3 @@ void idPlayerIcon::UpdateIcon( idPlayer *player, const idVec3 &origin, const idM renderEnt.axis = axis; gameRenderWorld->UpdateEntityDef( iconHandle, &renderEnt ); } - diff --git a/game/PlayerIcon.h b/game/PlayerIcon.h index bee9416..9890d00 100644 --- a/game/PlayerIcon.h +++ b/game/PlayerIcon.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -37,7 +37,7 @@ typedef enum { class idPlayerIcon { public: - + public: idPlayerIcon(); ~idPlayerIcon(); @@ -60,4 +60,3 @@ public: #endif /* !_PLAYERICON_H_ */ - diff --git a/game/PlayerView.cpp b/game/PlayerView.cpp index ce6548f..9364339 100644 --- a/game/PlayerView.cpp +++ b/game/PlayerView.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -143,7 +143,7 @@ void idPlayerView::Restore( idRestoreGame *savefile ) { savefile->ReadInt( dvFinishTime ); savefile->ReadMaterial( dvMaterial ); savefile->ReadInt( kickFinishTime ); - savefile->ReadAngles( kickAngles ); + savefile->ReadAngles( kickAngles ); savefile->ReadBool( bfgVision ); savefile->ReadMaterial( tunnelMaterial ); @@ -279,7 +279,7 @@ void idPlayerView::DamageImpulse( idVec3 localKickDir, const idDict *damageDef ) blob->x += ( gameLocal.random.RandomInt()&63 ) - 32; blob->y = damageDef->GetFloat( "blob_y" ); blob->y += ( gameLocal.random.RandomInt()&63 ) - 32; - + float scale = ( 256 + ( ( gameLocal.random.RandomInt()&63 ) - 32 ) ) / 256.0f; blob->w = damageDef->GetFloat( "blob_width" ) * g_blobSize.GetFloat() * scale; blob->h = damageDef->GetFloat( "blob_height" ) * g_blobSize.GetFloat() * scale; @@ -361,7 +361,7 @@ void idPlayerView::WeaponFireFeedback( const idDict *weaponDef ) { kickAngles = angles; int finish = gameLocal.time + g_kickTime.GetFloat() * recoilTime; kickFinishTime = finish; - } + } } @@ -398,7 +398,7 @@ idMat3 idPlayerView::ShakeAxis() const { =================== idPlayerView::AngleOffset - kickVector, a world space direction that the attack should + kickVector, a world space direction that the attack should =================== */ idAngles idPlayerView::AngleOffset() const { @@ -460,7 +460,7 @@ void idPlayerView::SingleView( idUserInterface *hud, const renderView_t *view ) if ( blob->finishTime <= gameLocal.time ) { continue; } - + blob->y += blob->driftAmount; float fade = (float)( blob->finishTime - gameLocal.time ) / ( blob->finishTime - blob->startFadeTime ); @@ -517,7 +517,7 @@ void idPlayerView::SingleView( idUserInterface *hud, const renderView_t *view ) 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 ); } - + } // test a single material drawn over everything @@ -549,7 +549,7 @@ void idPlayerView::DoubleVision( idUserInterface *hud, const renderView_t *view, if ( scale > 0.5f ) { scale = 0.5f; } - float shift = scale * sin( sqrtf( offset ) * g_dvFrequency.GetFloat() ); + float shift = scale * sin( sqrtf( offset ) * g_dvFrequency.GetFloat() ); shift = fabs( shift ); // if double vision, render to a texture @@ -717,6 +717,5 @@ void idPlayerView::RenderPlayerView( idUserInterface *hud ) { if ( net_clientLagOMeter.GetBool() && lagoMaterial && gameLocal.isClient ) { 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 ); - } + } } - diff --git a/game/PlayerView.h b/game/PlayerView.h index 04a4085..bb7c9b0 100644 --- a/game/PlayerView.h +++ b/game/PlayerView.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -98,9 +98,9 @@ private: const idMaterial * dvMaterial; // material to take the double vision screen shot 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 * armorMaterial; // armor damage view effect diff --git a/game/Projectile.cpp b/game/Projectile.cpp index 50fdbda..d7cfac2 100644 --- a/game/Projectile.cpp +++ b/game/Projectile.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -25,7 +25,7 @@ If you have questions concerning this license or the applicable additional terms =========================================================================== */ - + #include "../idlib/precompiled.h" #pragma hdrstop @@ -304,7 +304,7 @@ void idProjectile::Launch( const idVec3 &start, const idVec3 &dir, const idVec3 endthrust = spawnArgs.GetFloat( "thrust_end" ); spawnArgs.GetVector( "velocity", "0 0 0", velocity ); - + speed = velocity.Length() * launchPower; damagePower = dmgPower; @@ -465,11 +465,11 @@ void idProjectile::Think( void ) { if ( gameLocal.time < lightEndTime ) { float frac = ( float )( gameLocal.time - lightStartTime ) / ( float )( lightEndTime - lightStartTime ); color.Lerp( lightColor, color, frac ); - } + } renderLight.shaderParms[SHADERPARM_RED] = color.x; renderLight.shaderParms[SHADERPARM_GREEN] = color.y; renderLight.shaderParms[SHADERPARM_BLUE] = color.z; - } + } gameRenderWorld->UpdateLightDef( lightDefHandle, &renderLight ); } else { lightDefHandle = gameRenderWorld->AddLightDef( &renderLight ); @@ -829,9 +829,9 @@ void idProjectile::Explode( const trace_t &collision, idEntity *ignore ) { if ( fxname && *fxname ) { SetModel( fxname ); - renderEntity.shaderParms[SHADERPARM_RED] = - renderEntity.shaderParms[SHADERPARM_GREEN] = - renderEntity.shaderParms[SHADERPARM_BLUE] = + renderEntity.shaderParms[SHADERPARM_RED] = + renderEntity.shaderParms[SHADERPARM_GREEN] = + renderEntity.shaderParms[SHADERPARM_BLUE] = renderEntity.shaderParms[SHADERPARM_ALPHA] = 1.0f; renderEntity.shaderParms[SHADERPARM_TIMEOFFSET] = -MS2SEC( gameLocal.time ); renderEntity.shaderParms[SHADERPARM_DIVERSITY] = gameLocal.random.CRandomFloat(); @@ -1095,7 +1095,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[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 ); } } @@ -1340,7 +1340,7 @@ void idGuidedProjectile::Think( void ) { int i; if ( state == LAUNCHED && !unGuided ) { - + GetSeekPos( seekPos ); if ( rndUpdateTime < gameLocal.time ) { @@ -1416,7 +1416,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() ); if ( tr.fraction < 1.0f ) { enemy = gameLocal.GetTraceEntity( tr ); - } + } // ignore actors on the player's team if ( enemy.GetEntity() == NULL || !enemy.GetEntity()->IsType( idActor::Type ) || ( static_cast( enemy.GetEntity() )->team == player->team ) ) { enemy = player->EnemyWithMostHealth(); @@ -1559,13 +1559,13 @@ void idSoulCubeMissile::Think( void ) { if ( !gameLocal.smokeParticles->EmitSmoke( smokeKill, smokeKillTime, gameLocal.random.CRandomFloat(), orbitOrg, mat3_identity ) ) { smokeKillTime = gameLocal.time; } - } + } } else { if ( accelTime && gameLocal.time < launchTime + accelTime * 1000 ) { pct = ( gameLocal.time - launchTime ) / ( accelTime * 1000 ); speed = ( startingVelocity + ( startingVelocity + endingVelocity ) * pct ).Length(); - } - } + } + } idGuidedProjectile::Think(); GetSeekPos( seekPos ); if ( ( seekPos - physicsObj.GetOrigin() ).Length() < 32.0f ) { @@ -1602,7 +1602,7 @@ void idSoulCubeMissile::GetSeekPos( idVec3 &out ) { if ( destOrg != vec3_zero ) { out = destOrg; return; - } + } idGuidedProjectile::GetSeekPos( out ); } @@ -1648,7 +1648,7 @@ void idSoulCubeMissile::Launch( const idVec3 &start, const idVec3 &dir, const id launchTime = gameLocal.time; killPhase = false; UpdateVisuals(); - + ownerEnt = owner.GetEntity(); if ( ownerEnt && ownerEnt->IsType( idPlayer::Type ) ) { static_cast( ownerEnt )->SetSoulCubeProjectile( this ); @@ -1809,9 +1809,9 @@ void idBFGProjectile::Think( void ) { 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_Z ] = org.z; - beamTargets[i].renderEntity.shaderParms[ SHADERPARM_RED ] = - beamTargets[i].renderEntity.shaderParms[ SHADERPARM_GREEN ] = - beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BLUE ] = + beamTargets[i].renderEntity.shaderParms[ SHADERPARM_RED ] = + beamTargets[i].renderEntity.shaderParms[ SHADERPARM_GREEN ] = + beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BLUE ] = beamTargets[i].renderEntity.shaderParms[ SHADERPARM_ALPHA ] = 1.0f; if ( gameLocal.time > nextDamageTime ) { bool bfgVision = true; @@ -1820,9 +1820,9 @@ void idBFGProjectile::Think( void ) { org.Normalize(); beamTargets[i].target.GetEntity()->Damage( this, owner.GetEntity(), org, damageFreq, ( damagePower ) ? damagePower : 1.0f, INVALID_JOINT ); } else { - beamTargets[i].renderEntity.shaderParms[ SHADERPARM_RED ] = - beamTargets[i].renderEntity.shaderParms[ SHADERPARM_GREEN ] = - beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BLUE ] = + beamTargets[i].renderEntity.shaderParms[ SHADERPARM_RED ] = + beamTargets[i].renderEntity.shaderParms[ SHADERPARM_GREEN ] = + beamTargets[i].renderEntity.shaderParms[ SHADERPARM_BLUE ] = beamTargets[i].renderEntity.shaderParms[ SHADERPARM_ALPHA ] = 0.0f; bfgVision = false; } @@ -1866,7 +1866,7 @@ void idBFGProjectile::Launch( const idVec3 &start, const idVec3 &dir, const idVe idProjectile::Launch( start, dir, pushVelocity, 0.0f, power, dmgPower ); // 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 // but saves on the traces making sure they are visible // damage is not applied until the projectile explodes @@ -2157,7 +2157,7 @@ void idDebris::Launch( void ) { spawnArgs.GetVector( "velocity", "0 0 0", velocity ); spawnArgs.GetAngles( "angular_velocity", "0 0 0", angular_velocity ); - + linear_friction = spawnArgs.GetFloat( "linear_friction" ); angular_friction = spawnArgs.GetFloat( "angular_friction" ); contact_friction = spawnArgs.GetFloat( "contact_friction" ); diff --git a/game/Projectile.h b/game/Projectile.h index c43e6fd..ed68c43 100644 --- a/game/Projectile.h +++ b/game/Projectile.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms =============================================================================== idProjectile - + =============================================================================== */ @@ -114,7 +114,7 @@ protected: FIZZLED = 3, EXPLODED = 4 } projectileState_t; - + projectileState_t state; private: @@ -228,7 +228,7 @@ private: =============================================================================== idDebris - + =============================================================================== */ diff --git a/game/Pvs.cpp b/game/Pvs.cpp index 3caa182..f8bd5d0 100644 --- a/game/Pvs.cpp +++ b/game/Pvs.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -258,7 +258,7 @@ void idPVS::FrontPortalPVS( void ) const { } for ( p = 0; p < area->numPortals; p++ ) { - + p2 = area->portals[p]; // 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; - // check all combinations + // check all combinations for ( i = 0; i < source.GetNumPoints(); i++ ) { l = (i + 1) % source.GetNumPoints(); @@ -623,7 +623,7 @@ void idPVS::CreatePassages( void ) const { } p = &pvsPortals[(byteNum << 3) + bitNum]; - + if ( p->areaNum == source->areaNum ) { continue; } @@ -1419,4 +1419,3 @@ void idPVS::ReadPVS( const pvsHandle_t handle, const idBitMsg &msg ) { } #endif - diff --git a/game/Pvs.h b/game/Pvs.h index 1d24c2f..46f004d 100644 --- a/game/Pvs.h +++ b/game/Pvs.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/SecurityCamera.cpp b/game/SecurityCamera.cpp index dfd8bd0..44df1aa 100644 --- a/game/SecurityCamera.cpp +++ b/game/SecurityCamera.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -42,7 +42,7 @@ If you have questions concerning this license or the applicable additional terms /*********************************************************************** idSecurityCamera - + ***********************************************************************/ const idEventDef EV_SecurityCam_ReverseSweep( "" ); @@ -71,7 +71,7 @@ void idSecurityCamera::Save( idSaveGame *savefile ) const { savefile->WriteBool( flipAxis ); savefile->WriteFloat( scanDist ); savefile->WriteFloat( scanFov ); - + savefile->WriteFloat( sweepStart ); savefile->WriteFloat( sweepEnd ); savefile->WriteBool( negativeSweep ); @@ -81,7 +81,7 @@ void idSecurityCamera::Save( idSaveGame *savefile ) const { savefile->WriteFloat( scanFovCos ); savefile->WriteVec3( viewOffset ); - + savefile->WriteInt( pvsArea ); savefile->WriteStaticObject( physicsObj ); savefile->WriteTraceModel( trm ); @@ -99,7 +99,7 @@ void idSecurityCamera::Restore( idRestoreGame *savefile ) { savefile->ReadBool( flipAxis ); savefile->ReadFloat( scanDist ); savefile->ReadFloat( scanFov ); - + savefile->ReadFloat( sweepStart ); savefile->ReadFloat( sweepEnd ); savefile->ReadBool( negativeSweep ); @@ -109,7 +109,7 @@ void idSecurityCamera::Restore( idRestoreGame *savefile ) { savefile->ReadFloat( scanFovCos ); savefile->ReadVec3( viewOffset ); - + savefile->ReadInt( pvsArea ); savefile->ReadStaticObject( physicsObj ); savefile->ReadTraceModel( trm ); @@ -190,24 +190,24 @@ void idSecurityCamera::Event_AddLight( void ) { float radius; idVec3 lightOffset; idLight *spotLight; - + dir = GetAxis(); dir.NormalVectors( right, up ); target = GetPhysics()->GetOrigin() + dir * scanDist; - + radius = tan( scanFov * idMath::PI / 360.0f ); up = dir + up * radius; up.Normalize(); up = GetPhysics()->GetOrigin() + up * scanDist; up -= target; - + right = dir + right * radius; right.Normalize(); right = GetPhysics()->GetOrigin() + right * scanDist; right -= target; spawnArgs.GetVector( "lightOffset", "0 0 0", lightOffset ); - + args.Set( "origin", ( GetPhysics()->GetOrigin() + lightOffset ).ToString() ); args.Set( "light_target", target.ToString() ); args.Set( "light_right", right.ToString() ); @@ -393,7 +393,7 @@ void idSecurityCamera::Think( void ) { SetAlertMode(LOSINGINTEREST); CancelEvents( &EV_SecurityCam_Alert ); - + sightResume = spawnArgs.GetFloat( "sightResume", "1.5" ); PostEventSec( &EV_SecurityCam_ContinueSweep, sightResume ); } @@ -446,7 +446,7 @@ void idSecurityCamera::StartSweep( void ) { sweepStart = gameLocal.time; speed = SEC2MS( SweepSpeed() ); sweepEnd = sweepStart + speed; - PostEventMS( &EV_SecurityCam_Pause, speed ); + PostEventMS( &EV_SecurityCam_Pause, speed ); StartSound( "snd_moving", SND_CHANNEL_BODY, 0, false, NULL ); } @@ -463,7 +463,7 @@ void idSecurityCamera::Event_ContinueSweep( void ) { sweepStart = f; speed = MS2SEC( SweepSpeed() ); 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 ); SetAlertMode(SCANNING); sweeping = true; @@ -510,7 +510,7 @@ void idSecurityCamera::Event_Pause( void ) { sweeping = false; StopSound( SND_CHANNEL_ANY, false ); StartSound( "snd_stop", SND_CHANNEL_BODY, 0, false, NULL ); - PostEventSec( &EV_SecurityCam_ReverseSweep, sweepWait ); + PostEventSec( &EV_SecurityCam_ReverseSweep, sweepWait ); } /* diff --git a/game/SecurityCamera.h b/game/SecurityCamera.h index cf9ab3e..02600df 100644 --- a/game/SecurityCamera.h +++ b/game/SecurityCamera.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -65,7 +65,7 @@ private: bool flipAxis; float scanDist; float scanFov; - + float sweepStart; float sweepEnd; bool negativeSweep; @@ -75,7 +75,7 @@ private: float scanFovCos; idVec3 viewOffset; - + int pvsArea; idPhysics_RigidBody physicsObj; idTraceModel trm; diff --git a/game/SmokeParticles.cpp b/game/SmokeParticles.cpp index d4b1784..6a64d0f 100644 --- a/game/SmokeParticles.cpp +++ b/game/SmokeParticles.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -202,7 +202,7 @@ bool idSmokeParticles::EmitSmoke( const idDeclParticle *smoke, const int systemS } // 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 deltaMsec = gameLocal.time - systemStartTime; diff --git a/game/SmokeParticles.h b/game/SmokeParticles.h index bee7e2d..4fcda97 100644 --- a/game/SmokeParticles.h +++ b/game/SmokeParticles.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/Sound.cpp b/game/Sound.cpp index c1d8044..949324d 100644 --- a/game/Sound.cpp +++ b/game/Sound.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -302,4 +302,3 @@ idSound::ShowEditingDialog void idSound::ShowEditingDialog( void ) { common->InitTool( EDITOR_SOUND, &spawnArgs ); } - diff --git a/game/Sound.h b/game/Sound.h index 1bc291b..55d8497 100644 --- a/game/Sound.h +++ b/game/Sound.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/Target.cpp b/game/Target.cpp index 3ed5945..018ed16 100644 --- a/game/Target.cpp +++ b/game/Target.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -602,7 +602,7 @@ idTarget_Give::Event_Activate ================ */ void idTarget_Give::Event_Activate( idEntity *activator ) { - + if ( spawnArgs.GetBool( "development" ) && developer.GetInteger() == 0 ) { return; } @@ -893,7 +893,7 @@ idTarget_SetInfluence::Event_ClearFlash */ void idTarget_SetInfluence::Event_ClearFlash( float flash ) { idPlayer *player = gameLocal.GetLocalPlayer(); - player->playerView.Fade( vec4_zero , flash ); + player->playerView.Fade( vec4_zero , flash ); } /* ================ @@ -1046,7 +1046,7 @@ void idTarget_SetInfluence::Event_Activate( idEntity *activator ) { if ( parm && *parm ) { light->SetShader( parm ); } - + color = light->spawnArgs.GetVector( "_color" ); color = light->spawnArgs.GetVector( "color_demonic", color.ToString() ); colorTo.Set( color.x, color.y, color.z, 1.0f ); @@ -1101,7 +1101,7 @@ void idTarget_SetInfluence::Event_Activate( idEntity *activator ) { if ( spawnArgs.GetBool( "effect_vision" ) ) { parm = spawnArgs.GetString( "mtrVision" ); skin = spawnArgs.GetString( "skinVision" ); - player->SetInfluenceView( parm, skin, spawnArgs.GetInt( "visionRadius" ), this ); + player->SetInfluenceView( parm, skin, spawnArgs.GetInt( "visionRadius" ), this ); } parm = spawnArgs.GetString( "mtrWorld" ); @@ -1762,4 +1762,3 @@ void idTarget_FadeSoundClass::Event_RestoreVolume() { // restore volume gameSoundWorld->FadeSoundClasses( 0, fadeDB, fadeTime ); } - diff --git a/game/Target.h b/game/Target.h index fbfb0d1..9131c2f 100644 --- a/game/Target.h +++ b/game/Target.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/Trigger.cpp b/game/Trigger.cpp index 29bfa4a..df7cacc 100644 --- a/game/Trigger.cpp +++ b/game/Trigger.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -36,7 +36,7 @@ If you have questions concerning this license or the applicable additional terms =============================================================================== idTrigger - + =============================================================================== */ @@ -239,7 +239,7 @@ void idTrigger::Spawn( void ) { =============================================================================== idTrigger_Multi - + =============================================================================== */ @@ -325,7 +325,7 @@ void idTrigger_Multi::Spawn( void ) { spawnArgs.GetFloat( "random", "0", random ); spawnArgs.GetFloat( "delay", "0", delay ); spawnArgs.GetFloat( "random_delay", "0", random_delay ); - + if ( random && ( random >= wait ) && ( wait >= 0 ) ) { random = wait - 1; gameLocal.Warning( "idTrigger_Multi '%s' at (%s) has random >= wait", name.c_str(), GetPhysics()->GetOrigin().ToString(0) ); @@ -509,7 +509,7 @@ void idTrigger_Multi::Event_Touch( idEntity *other, trace_t *trace ) { =============================================================================== idTrigger_EntityName - + =============================================================================== */ @@ -573,7 +573,7 @@ void idTrigger_EntityName::Spawn( void ) { spawnArgs.GetFloat( "random", "0", random ); spawnArgs.GetFloat( "delay", "0", delay ); spawnArgs.GetFloat( "random_delay", "0", random_delay ); - + if ( random && ( random >= wait ) && ( wait >= 0 ) ) { random = wait - 1; gameLocal.Warning( "idTrigger_EntityName '%s' at (%s) has random >= wait", name.c_str(), GetPhysics()->GetOrigin().ToString(0) ); @@ -696,7 +696,7 @@ void idTrigger_EntityName::Event_Touch( idEntity *other, trace_t *trace ) { =============================================================================== idTrigger_Timer - + =============================================================================== */ @@ -840,7 +840,7 @@ void idTrigger_Timer::Event_Use( idEntity *activator ) { =============================================================================== idTrigger_Count - + =============================================================================== */ @@ -930,7 +930,7 @@ void idTrigger_Count::Event_TriggerAction( idEntity *activator ) { =============================================================================== idTrigger_Hurt - + =============================================================================== */ @@ -1052,7 +1052,7 @@ void idTrigger_Fade::Event_Trigger( idEntity *activator ) { =============================================================================== idTrigger_Touch - + =============================================================================== */ @@ -1134,7 +1134,7 @@ void idTrigger_Touch::TouchEntities( void ) { if ( !entity ) { continue; } - + if ( !gameLocal.clip.ContentsModel( cm->GetOrigin(), cm, cm->GetAxis(), -1, clipModel->Handle(), clipModel->GetOrigin(), clipModel->GetAxis() ) ) { continue; diff --git a/game/Trigger.h b/game/Trigger.h index f75be16..9f20952 100644 --- a/game/Trigger.h +++ b/game/Trigger.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/Weapon.cpp b/game/Weapon.cpp index e559571..40f6daa 100644 --- a/game/Weapon.cpp +++ b/game/Weapon.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -33,8 +33,8 @@ If you have questions concerning this license or the applicable additional terms /*********************************************************************** - idWeapon - + idWeapon + ***********************************************************************/ // @@ -590,7 +590,7 @@ void idWeapon::Clear( void ) { refSound.referenceSound->Free( true ); } memset( &refSound, 0, sizeof( refSound_t ) ); - + // setting diversity to 0 results in no random sound. -1 indicates random. refSound.diversity = -1.0f; @@ -977,7 +977,7 @@ void idWeapon::GetWeaponDef( const char *objectname, int ammoinclip ) { if ( !weaponDef->dict.GetString( "weapon_scriptobject", NULL, &objectType ) ) { gameLocal.Error( "No 'weapon_scriptobject' set on '%s'.", objectname ); } - + // setup script object if ( !scriptObject.SetType( objectType ) ) { gameLocal.Error( "Script object '%s' not found on weapon '%s'.", objectType, objectname ); @@ -1032,7 +1032,7 @@ void idWeapon::UpdateGUI( void ) { if ( !renderEntity.gui[ 0 ] ) { return; } - + if ( status == WP_HOLSTERED ) { return; } @@ -1105,7 +1105,7 @@ idWeapon::MuzzleFlashLight ================ */ void idWeapon::MuzzleFlashLight( void ) { - + if ( !lightOn && ( !g_muzzleFlash.GetBool() || !muzzleFlash.lightRadius[0] ) ) { return; } @@ -1152,7 +1152,7 @@ bool idWeapon::UpdateSkin( void ) { common->Warning( "Can't find function 'UpdateSkin' in object '%s'", scriptObject.GetTypeName() ); return false; } - + // use the frameCommandThread since it's safe to use outside of framecommands gameLocal.frameCommandThread->CallFunction( this, func, true ); gameLocal.frameCommandThread->Execute(); @@ -1389,7 +1389,7 @@ void idWeapon::OwnerDied( void ) { idWeapon::BeginAttack ================ */ -void idWeapon::BeginAttack( void ) { +void idWeapon::BeginAttack( void ) { if ( status != WP_OUTOFAMMO ) { lastAttack = gameLocal.time; } @@ -1704,7 +1704,7 @@ void idWeapon::MuzzleRise( idVec3 &origin, idMat3 &axis ) { if ( time > muzzle_kick_maxtime ) { time = muzzle_kick_maxtime; } - + amount = ( float )time / ( float )muzzle_kick_maxtime; ang = muzzle_kick_angles * amount; offset = muzzle_kick_offset * amount; @@ -1755,7 +1755,7 @@ void idWeapon::DeconstructScriptObject( void ) { if ( !thread ) { return; } - + // don't bother calling the script object's destructor on map shutdown if ( gameLocal.GameState() == GAMESTATE_SHUTDOWN ) { return; @@ -1869,7 +1869,7 @@ void idWeapon::PresentWeapon( bool showViewModel ) { // 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 - if ( gameLocal.time - hideStartTime < hideTime ) { + if ( gameLocal.time - hideStartTime < hideTime ) { float frac = ( float )( gameLocal.time - hideStartTime ) / ( float )hideTime; if ( hideStart < hideEnd ) { frac = 1.0f - frac; @@ -2262,7 +2262,7 @@ void idWeapon::WriteToSnapshot( idBitMsgDelta &msg ) const { idWeapon::ReadFromSnapshot ================ */ -void idWeapon::ReadFromSnapshot( const idBitMsgDelta &msg ) { +void idWeapon::ReadFromSnapshot( const idBitMsgDelta &msg ) { ammoClip = msg.ReadBits( ASYNC_PLAYER_INV_CLIP_BITS ); worldModel.SetSpawnId( msg.ReadBits( 32 ) ); bool snapLight = msg.ReadBits( 1 ) != 0; @@ -2276,10 +2276,10 @@ void idWeapon::ReadFromSnapshot( const idBitMsgDelta &msg ) { idealState = "Fire"; } - // immediately switch back to idle - if ( WEAPON_NETFIRING && !isFiring ) { - idealState = "Idle"; - } + // immediately switch back to idle + if ( WEAPON_NETFIRING && !isFiring ) { + idealState = "Idle"; + } WEAPON_NETFIRING = isFiring; } @@ -2502,7 +2502,7 @@ idWeapon::Event_AmmoInClip */ void idWeapon::Event_AmmoInClip( void ) { int ammo = AmmoInClip(); - idThread::ReturnFloat( ammo ); + idThread::ReturnFloat( ammo ); } /* @@ -2531,7 +2531,7 @@ idWeapon::Event_ClipSize =============== */ void idWeapon::Event_ClipSize( void ) { - idThread::ReturnFloat( clipSize ); + idThread::ReturnFloat( clipSize ); } /* @@ -2579,7 +2579,7 @@ idWeapon::Event_PlayAnim */ void idWeapon::Event_PlayAnim( int channel, const char *animname ) { int anim; - + anim = animator.GetAnim( animname ); if ( !anim ) { gameLocal.Warning( "missing '%s' animation on '%s' (%s)", animname, name.c_str(), GetEntityDefName() ); @@ -2821,13 +2821,13 @@ void idWeapon::Event_LaunchProjectiles( int num_projectiles, float spread, float return; } - // 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 if ( powerAmmo ) { // 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 // 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; if ( dmgPower > ammoClip ) { dmgPower = ammoClip; @@ -3163,5 +3163,5 @@ idWeapon::ClientPredictionThink =============== */ void idWeapon::ClientPredictionThink( void ) { - UpdateAnimation(); + UpdateAnimation(); } diff --git a/game/Weapon.h b/game/Weapon.h index 2ee67c0..c214f14 100644 --- a/game/Weapon.h +++ b/game/Weapon.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms =============================================================================== Player Weapon - + =============================================================================== */ @@ -196,7 +196,7 @@ private: // the view weapon render entity parms idVec3 viewWeaponOrigin; idMat3 viewWeaponAxis; - + // the muzzle bone's position, used for launching projectiles and trailing smoke idVec3 muzzleOrigin; idMat3 muzzleAxis; @@ -255,7 +255,7 @@ private: bool isFiring; // zoom - int zoomFov; // variable zoom fov per weapon + int zoomFov; // variable zoom fov per weapon // joints from models jointHandle_t barrelJointView; @@ -276,8 +276,8 @@ private: int weaponSmokeStartTime; // set to gameLocal.time every weapon fire bool continuousSmoke; // if smoke is continuous ( chainsaw ) const idDeclParticle * strikeSmoke; // striking something in melee - int strikeSmokeStartTime; // timing - idVec3 strikePos; // position of last melee strike + int strikeSmokeStartTime; // timing + idVec3 strikePos; // position of last melee strike idMat3 strikeAxis; // axis of last melee strike int nextStrikeFx; // used for sound and decal ( may use for strike smoke too ) diff --git a/game/WorldSpawn.cpp b/game/WorldSpawn.cpp index 0c368c4..9e2ce5d 100644 --- a/game/WorldSpawn.cpp +++ b/game/WorldSpawn.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/WorldSpawn.h b/game/WorldSpawn.h index 7b65ddd..bf88243 100644 --- a/game/WorldSpawn.h +++ b/game/WorldSpawn.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/ai/AAS.cpp b/game/ai/AAS.cpp index 1abb78d..9fd1ac8 100644 --- a/game/ai/AAS.cpp +++ b/game/ai/AAS.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -163,7 +163,7 @@ int idAASLocal::BoundsReachableAreaNum( const idBounds &bounds, const int areaFl if ( !file ) { return 0; } - + return file->BoundsReachableAreaNum( bounds, areaFlags, TFL_INVALID ); } diff --git a/game/ai/AAS.h b/game/ai/AAS.h index a1e22dd..8f272b4 100644 --- a/game/ai/AAS.h +++ b/game/ai/AAS.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/ai/AAS_debug.cpp b/game/ai/AAS_debug.cpp index 5605712..0c4ba48 100644 --- a/game/ai/AAS_debug.cpp +++ b/game/ai/AAS_debug.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -196,7 +196,7 @@ void idAASLocal::ShowArea( const idVec3 &origin ) const { if ( aas_goalArea.GetInteger() ) { int travelTime; idReachability *reach; - + RouteToGoalArea( areaNum, org, aas_goalArea.GetInteger(), TFL_WALK|TFL_AIR, travelTime, &reach ); gameLocal.Printf( "\rtt = %4d", travelTime ); if ( reach ) { diff --git a/game/ai/AAS_local.h b/game/ai/AAS_local.h index afab2de..5b9af24 100644 --- a/game/ai/AAS_local.h +++ b/game/ai/AAS_local.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/ai/AAS_pathing.cpp b/game/ai/AAS_pathing.cpp index 07a57ef..7805c0a 100644 --- a/game/ai/AAS_pathing.cpp +++ b/game/ai/AAS_pathing.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/ai/AAS_routing.cpp b/game/ai/AAS_routing.cpp index f44631a..acb59ac 100644 --- a/game/ai/AAS_routing.cpp +++ b/game/ai/AAS_routing.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -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[1] = obstacles[k].absBounds[1] - file->GetSettings().boundingBoxes[0][0]; } - + badTravelFlags = ~travelFlags; 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 t += AreaTravelTime( reach->toAreaNum, reach->end, nextArea->center ); - + if ( !bestTravelTime || t < bestTravelTime ) { // if the area is not visible to the target if ( callback.TestArea( this, reach->toAreaNum ) ) { diff --git a/game/ai/AI.cpp b/game/ai/AI.cpp index 2fa6f42..a097c82 100644 --- a/game/ai/AI.cpp +++ b/game/ai/AI.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -221,7 +221,7 @@ idAASFindAttackPosition::idAASFindAttackPosition( const idAI *self, const idMat3 this->gravityAxis = gravityAxis; 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 idBounds bounds( targetPos - idVec3( 16, 16, 0 ), targetPos + idVec3( 16, 16, 64 ) ); @@ -730,7 +730,7 @@ void idAI::Spawn( void ) { spawnArgs.GetFloat( "melee_range", "64", melee_range ); spawnArgs.GetFloat( "projectile_height_to_distance_ratio", "1", projectile_height_to_distance_ratio ); - + spawnArgs.GetFloat( "turn_rate", "360", turnRate ); spawnArgs.GetBool( "talks", "0", talks ); @@ -862,7 +862,7 @@ void idAI::Spawn( void ) { // 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 ) ); - + if ( num_cinematics ) { physicsObj.SetGravity( vec3_origin ); } else { @@ -941,7 +941,7 @@ void idAI::InitMuzzleFlash( void ) { spawnArgs.GetString( "mtr_flashShader", "muzzleflash", &shader ); spawnArgs.GetVector( "flashColor", "0 0 0", flashColor ); - float flashRadius = spawnArgs.GetFloat( "flashRadius" ); + float flashRadius = spawnArgs.GetFloat( "flashRadius" ); flashTime = SEC2MS( spawnArgs.GetFloat( "flashTime", "0.25" ) ); memset( &worldMuzzleFlash, 0, sizeof ( worldMuzzleFlash ) ); @@ -1029,7 +1029,7 @@ void idAI::DormantEnd( void ) { // let our enemy know we're back on the trail enemyNode.AddToEnd( enemy.GetEntity()->enemyList ); } - + if ( particles.Num() ) { for ( int i = 0; i < particles.Num(); i++ ) { particles[i].time = gameLocal.time; @@ -1336,7 +1336,7 @@ idAI::ReachedPos bool idAI::ReachedPos( const idVec3 &pos, const moveCommand_t moveCommand ) const { if ( move.moveType == MOVETYPE_SLIDE ) { 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 ) ) { return true; } @@ -1347,7 +1347,7 @@ bool idAI::ReachedPos( const idVec3 &pos, const moveCommand_t moveCommand ) cons } } else { 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 ) ) { return true; } @@ -2008,7 +2008,7 @@ idAI::WanderAround */ bool idAI::WanderAround( void ) { StopMove( MOVE_STATUS_DONE ); - + move.moveDest = physicsObj.GetOrigin() + viewAxis[ 0 ] * physicsObj.GetGravityAxis() * 256.0f; if ( !NewWanderDir( move.moveDest ) ) { StopMove( MOVE_STATUS_DEST_UNREACHABLE ); @@ -2081,7 +2081,7 @@ bool idAI::StepDirection( float dir ) { if ( z <= ceilingPos.z ) { start.x = org.x; start.y = org.y; - start.z = z; + start.z = z; } else { start = ceilingPos; } @@ -2168,7 +2168,7 @@ bool idAI::NewWanderDir( const idVec3 &dest ) { if ( gameLocal.random.RandomInt() & 1 ) { for( tdir = 0; tdir <= 315; tdir += 45 ) { if ( tdir != turnaround && StepDirection( tdir ) ) { - return true; + return true; } } } else { @@ -2221,7 +2221,7 @@ bool idAI::GetMovePos( idVec3 &seekPos ) { } return false; break; - + case MOVE_SLIDE_TO_POSITION : seekPos = org; return false; @@ -2657,7 +2657,7 @@ void idAI::AnimMove( void ) { AI_BLOCKED = false; - if ( move.moveCommand < NUM_NONMOVING_COMMANDS ){ + if ( move.moveCommand < NUM_NONMOVING_COMMANDS ){ move.lastMoveOrigin.Zero(); move.lastMoveTime = gameLocal.time; } @@ -2776,7 +2776,7 @@ void idAI::SlideMove( void ) { AI_BLOCKED = false; - if ( move.moveCommand < NUM_NONMOVING_COMMANDS ){ + if ( move.moveCommand < NUM_NONMOVING_COMMANDS ){ move.lastMoveOrigin.Zero(); move.lastMoveTime = gameLocal.time; } @@ -2876,9 +2876,9 @@ idAI::AdjustFlyingAngles */ void idAI::AdjustFlyingAngles( void ) { idVec3 vel; - float speed; - float roll; - float pitch; + float speed; + float roll; + float pitch; vel = physicsObj.GetLinearVelocity(); @@ -2957,7 +2957,7 @@ void idAI::AdjustFlyHeight( idVec3 &vel, const idVec3 &goalPos ) { vel.z += addVel.z; goLower = true; } - + if ( ai_debugMove.GetBool() ) { gameRenderWorld->DebugBounds( goLower ? colorRed : colorGreen, physicsObj.GetBounds(), path.endPos, gameLocal.msec ); } @@ -2987,7 +2987,7 @@ idAI::FlySeekGoal */ void idAI::FlySeekGoal( idVec3 &vel, idVec3 &goalPos ) { idVec3 seekVel; - + // seek the goal position seekVel = Seek( vel, physicsObj.GetOrigin(), goalPos, AI_SEEK_PREDICTION ); seekVel *= fly_seek_scale; @@ -3318,7 +3318,7 @@ void idAI::Killed( idEntity *inflictor, idEntity *attacker, int damage, const id EndAttack(); 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 ) ); } @@ -3519,7 +3519,7 @@ void idAI::Activate( idEntity *activator ) { // update the script in cinematics so that entities don't start anims or show themselves a frame late. if ( cinematic ) { - UpdateAIScript(); + UpdateAIScript(); // make sure our model gets updated animator.ForceUpdate(); @@ -3930,7 +3930,7 @@ void idAI::CalculateAttackOffsets( void ) { return; } 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 animator.RemoveOriginOffset( false ); @@ -4052,7 +4052,7 @@ idProjectile *idAI::CreateProjectile( const idVec3 &pos, const idVec3 &dir ) { clsname = projectileDef->GetString( "classname" ); gameLocal.Error( "Could not spawn entityDef '%s'", clsname ); } - + if ( !ent->IsType( idProjectile::Type ) ) { clsname = ent->GetClassname(); gameLocal.Error( "'%s' is not an idProjectile", clsname ); @@ -4514,7 +4514,7 @@ idAI::UpdateMuzzleFlash ================ */ void idAI::UpdateMuzzleFlash( void ) { - if ( worldMuzzleFlashHandle != -1 ) { + if ( worldMuzzleFlashHandle != -1 ) { if ( gameLocal.time >= muzzleFlashEnd ) { gameRenderWorld->FreeLightDef( worldMuzzleFlashHandle ); worldMuzzleFlashHandle = -1; @@ -4716,10 +4716,10 @@ bool idAI::UpdateAnimationControllers( void ) { idVec3 focusPos; idQuat jawQuat; idVec3 left; - idVec3 dir; - idVec3 orientationJointPos; - idVec3 localDir; - idAngles newLookAng; + idVec3 dir; + idVec3 orientationJointPos; + idVec3 localDir; + idAngles newLookAng; idAngles diff; idMat3 mat; idMat3 axis; @@ -4774,7 +4774,7 @@ bool idAI::UpdateAnimationControllers( void ) { idEntity *focusEnt = focusEntity.GetEntity(); if ( !allowJointMod || !allowEyeFocus || ( gameLocal.time >= focusTime ) ) { - focusPos = GetEyePosition() + orientationJointAxis[ 0 ] * 512.0f; + focusPos = GetEyePosition() + orientationJointAxis[ 0 ] * 512.0f; } else if ( focusEnt == NULL ) { // keep looking at last position until focusTime is up focusPos = currentFocusPos; @@ -4808,7 +4808,7 @@ bool idAI::UpdateAnimationControllers( void ) { newLookAng.roll = 0.0f; diff = newLookAng - lookAng; - + if ( eyeAng != diff ) { eyeAng = diff; eyeAng.Clamp( eyeMin, eyeMax ); @@ -4857,7 +4857,7 @@ bool idAI::UpdateAnimationControllers( void ) { // lean into turns AdjustFlyingAngles(); } - + if ( headEnt ) { idAnimator *headAnimator = headEnt->GetAnimator(); @@ -5005,7 +5005,7 @@ void idCombatNode::DrawDebugInfo( void ) { idPlayer *player = gameLocal.GetLocalPlayer(); idVec4 color; idBounds bounds( idVec3( -16, -16, 0 ), idVec3( 16, 16, 0 ) ); - + for( ent = gameLocal.spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() ) { if ( !ent->IsType( idCombatNode::Type ) ) { continue; @@ -5067,7 +5067,7 @@ bool idCombatNode::EntityInView( idActor *actor, const idVec3 &pos ) { const idMat3 &axis = GetPhysics()->GetAxis(); idVec3 dir = pos - org; float dist = dir * axis[ 0 ]; - + if ( ( dist < min_dist ) || ( dist > max_dist ) ) { return false; } diff --git a/game/ai/AI.h b/game/ai/AI.h index 882f185..aeb4f37 100644 --- a/game/ai/AI.h +++ b/game/ai/AI.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -70,7 +70,7 @@ typedef enum { MOVE_TO_ENEMY = NUM_NONMOVING_COMMANDS, MOVE_TO_ENEMYHEIGHT, - MOVE_TO_ENTITY, + MOVE_TO_ENTITY, MOVE_OUT_OF_RANGE, MOVE_TO_ATTACK_POSITION, MOVE_TO_COVER, @@ -112,9 +112,9 @@ typedef struct obstaclePath_s { idVec3 seekPos; // seek position avoiding obstacles idEntity * firstObstacle; // if != NULL the first obstacle along the path 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 - idEntity * seekPosObstacle; // if != NULL the obstacle containing the seek position + idEntity * seekPosObstacle; // if != NULL the obstacle containing the seek position } obstaclePath_t; // path prediction @@ -315,7 +315,7 @@ protected: bool allowHiddenMovement; // allows character to still move around while hidden bool disableGravity; // disables gravity and allows vertical movement by the animation bool af_push_moveables; // allow the articulated figure to push moveable objects - + // weapon/attack vars bool lastHitCheckResult; int lastHitCheckTime; @@ -367,7 +367,7 @@ protected: // special fx float shrivel_rate; int shrivel_start; - + bool restartParticles; // should smoke emissions restart bool useBoneAxis; // use the bone vs the model axis idList particles; // particle data @@ -653,8 +653,8 @@ protected: void Event_AllowHiddenMovement( int enable ); void Event_TriggerParticles( const char *jointName ); void Event_FindActorsInBounds( const idVec3 &mins, const idVec3 &maxs ); - void Event_CanReachPosition( const idVec3 &pos ); - void Event_CanReachEntity( idEntity *ent ); + void Event_CanReachPosition( const idVec3 &pos ); + void Event_CanReachEntity( idEntity *ent ); void Event_CanReachEnemy( void ); void Event_GetReachableEntityPosition( idEntity *ent ); }; diff --git a/game/ai/AI_Vagary.cpp b/game/ai/AI_Vagary.cpp index 6bcb4f0..24c7a86 100644 --- a/game/ai/AI_Vagary.cpp +++ b/game/ai/AI_Vagary.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -108,10 +108,10 @@ void idAI_Vagary::Event_ChooseObjectToThrow( const idVec3 &mins, const idVec3 &m 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 ) ) { idThread::ReturnEntity( ent ); - return; + return; } } @@ -133,7 +133,7 @@ void idAI_Vagary::Event_ThrowObjectAtEnemy( idEntity *ent, float speed ) { if ( !enemyEnt ) { vel = ( viewAxis[ 0 ] * physicsObj.GetGravityAxis() ) * speed; } 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 ); vel *= speed; } diff --git a/game/ai/AI_events.cpp b/game/ai/AI_events.cpp index 87cb7de..fc96076 100644 --- a/game/ai/AI_events.cpp +++ b/game/ai/AI_events.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -249,7 +249,7 @@ CLASS_DECLARATION( idActor, idAI ) EVENT( AI_SetMoveType, idAI::Event_SetMoveType ) EVENT( AI_SaveMove, idAI::Event_SaveMove ) 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_EnableClip, idAI::Event_EnableClip ) EVENT( AI_DisableClip, idAI::Event_DisableClip ) @@ -452,7 +452,7 @@ void idAI::Event_ClosestReachableEnemyOfEntity( idEntity *team_mate ) { int areaNum; int enemyAreaNum; aasPath_t path; - + if ( !team_mate->IsType( idActor::Type ) ) { gameLocal.Error( "Entity '%s' is not an AI character or player", team_mate->GetName() ); } @@ -659,7 +659,7 @@ idAI::Event_AttackMelee */ void idAI::Event_AttackMelee( const char *meleeDefName ) { bool hit; - + hit = AttackMelee( meleeDefName ); idThread::ReturnInt( hit ); } @@ -746,7 +746,7 @@ void idAI::Event_MeleeAttackToJoint( const char *jointname, const char *meleeDef animator.GetJointTransform( joint, gameLocal.time, end, axis ); end = physicsObj.GetOrigin() + ( end + modelOffset ) * viewAxis * physicsObj.GetGravityAxis(); start = GetEyePosition(); - + if ( ai_debugMove.GetBool() ) { gameRenderWorld->DebugLine( colorYellow, start, end, gameLocal.msec ); } @@ -1248,7 +1248,7 @@ void idAI::Event_EntityInAttackCone( idEntity *ent ) { idVec3 delta; float yaw; float relYaw; - + if ( !ent ) { idThread::ReturnInt( false ); return; @@ -1449,7 +1449,7 @@ void idAI::Event_CanHitEnemy( void ) { hit = gameLocal.GetTraceEntity( tr ); if ( tr.fraction >= 1.0f || ( hit == enemyEnt ) ) { lastHitCheckResult = true; - } else if ( ( tr.fraction < 1.0f ) && ( hit->IsType( idAI::Type ) ) && + } else if ( ( tr.fraction < 1.0f ) && ( hit->IsType( idAI::Type ) ) && ( static_cast( hit )->team != team ) ) { lastHitCheckResult = true; } else { @@ -1689,7 +1689,7 @@ void idAI::Event_TestAnimMoveTowardEnemy( const char *animname ) { float yaw; idVec3 delta; idActor *enemyEnt; - + enemyEnt = enemy.GetEntity(); if ( !enemyEnt ) { idThread::ReturnInt( false ); @@ -1704,7 +1704,7 @@ void idAI::Event_TestAnimMoveTowardEnemy( const char *animname ) { } 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(); 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 ); @@ -2424,7 +2424,7 @@ idAI::Event_LocateEnemy void idAI::Event_LocateEnemy( void ) { idActor *enemyEnt; int areaNum; - + enemyEnt = enemy.GetEntity(); if ( !enemyEnt ) { return; @@ -2443,7 +2443,7 @@ idAI::Event_KickObstacles void idAI::Event_KickObstacles( idEntity *kickEnt, float force ) { idVec3 dir; idEntity *obEnt; - + if ( kickEnt ) { obEnt = kickEnt; } else { diff --git a/game/ai/AI_pathing.cpp b/game/ai/AI_pathing.cpp index 1af3890..c67135a 100644 --- a/game/ai/AI_pathing.cpp +++ b/game/ai/AI_pathing.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -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 PUSH_OUTSIDE_OBSTACLES = 0.5f; const float CLIP_BOUNDS_EPSILON = 10.0f; -const int MAX_AAS_WALL_EDGES = 256; -const int MAX_OBSTACLES = 256; +const int MAX_AAS_WALL_EDGES = 256; +const int MAX_OBSTACLES = 256; const int MAX_PATH_NODES = 256; -const int MAX_OBSTACLE_PATH = 64; +const int MAX_OBSTACLE_PATH = 64; typedef struct obstacle_s { idVec2 bounds[2]; @@ -260,7 +260,7 @@ void GetPointOutsideObstacles( const obstacle_t *obstacles, const int numObstacl 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(); nextVerts[0] = nextVerts[1] = 0; 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 ); edgeDir = end.ToVec2() - start.ToVec2(); edgeDir.Normalize(); @@ -1337,7 +1337,7 @@ static float HeightForTrajectory( const idVec3 &start, float zVel, float gravity t = zVel / gravity; // maximum height of projectile maxHeight = start.z - 0.5f * gravity * ( t * t ); - + return maxHeight; } diff --git a/game/anim/Anim.cpp b/game/anim/Anim.cpp index 44de237..3904342 100644 --- a/game/anim/Anim.cpp +++ b/game/anim/Anim.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -216,7 +216,7 @@ bool idMD5Anim::LoadAnim( const char *filename ) { for( i = 0; i < numJoints; i++ ) { parser.ReadToken( &token ); jointInfo[ i ].nameIndex = animationLib.JointIndex( token ); - + // parse parent num jointInfo[ i ].parentNum = parser.ParseInt(); if ( jointInfo[ i ].parentNum >= i ) { @@ -278,7 +278,7 @@ bool idMD5Anim::LoadAnim( const char *filename ) { parser.Error( "Expected frame number %d", i ); } parser.ExpectTokenString( "{" ); - + for( j = 0; j < numAnimatedComponents; j++, componentPtr++ ) { *componentPtr = parser.ParseFloat(); } @@ -402,7 +402,7 @@ void idMD5Anim::ConvertTimeToFrame( int time, int cyclecount, frameBlend_t &fram frame.cycleCount = 0; return; } - + frameTime = time * frameRate; frameNum = frameTime / 1000; frame.cycleCount = frameNum / ( numFrames - 1 ); @@ -415,7 +415,7 @@ void idMD5Anim::ConvertTimeToFrame( int time, int cyclecount, frameBlend_t &fram frame.frontlerp = 1.0f; return; } - + frame.frame1 = frameNum % ( numFrames - 1 ); frame.frame2 = frame.frame1 + 1; if ( frame.frame2 >= numFrames ) { @@ -436,7 +436,7 @@ void idMD5Anim::GetOrigin( idVec3 &offset, int time, int cyclecount ) const { offset = baseFrame[ 0 ].t; if ( !( jointInfo[ 0 ].animBits & ( ANIM_TX | ANIM_TY | ANIM_TZ ) ) ) { - // just use the baseframe + // just use the baseframe return; } @@ -474,10 +474,10 @@ idMD5Anim::GetOriginRotation void idMD5Anim::GetOriginRotation( idQuat &rotation, int time, int cyclecount ) const { frameBlend_t frame; int animBits; - + animBits = jointInfo[ 0 ].animBits; if ( !( animBits & ( ANIM_QX | ANIM_QY | ANIM_QZ ) ) ) { - // just use the baseframe + // just use the baseframe rotation = baseFrame[ 0 ].q; return; } @@ -1070,7 +1070,7 @@ void idAnimManager::FlushUnusedAnims( void ) { int i; idMD5Anim **animptr; idList removeAnims; - + for( i = 0; i < animations.Num(); i++ ) { animptr = animations.GetIndex( i ); if ( animptr && *animptr ) { diff --git a/game/anim/Anim.h b/game/anim/Anim.h index b3ccdfc..b58d44f 100644 --- a/game/anim/Anim.h +++ b/game/anim/Anim.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -245,7 +245,7 @@ public: void IncreaseRefs( void ) const; void DecreaseRefs( void ) const; int NumRefs( void ) const; - + void CheckModelHierarchy( const idRenderModel *model ) 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; diff --git a/game/anim/Anim_Blend.cpp b/game/anim/Anim_Blend.cpp index 93e9dd0..db33658 100644 --- a/game/anim/Anim_Blend.cpp +++ b/game/anim/Anim_Blend.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -163,7 +163,7 @@ index 0 will never be NULL. Any anim >= NumAnims will return NULL. ===================== */ const idMD5Anim *idAnim::MD5Anim( int num ) const { - if ( anims == NULL || anims[0] == NULL ) { + if ( anims == NULL || anims[0] == NULL ) { return NULL; } return anims[ num ]; @@ -196,11 +196,11 @@ int idAnim::Length( void ) const { idAnim::NumFrames ===================== */ -int idAnim::NumFrames( void ) const { +int idAnim::NumFrames( void ) const { if ( !anims[ 0 ] ) { return 0; } - + return anims[ 0 ]->NumFrames(); } @@ -209,7 +209,7 @@ int idAnim::NumFrames( void ) const { idAnim::NumAnims ===================== */ -int idAnim::NumAnims( void ) const { +int idAnim::NumAnims( void ) const { return numAnims; } @@ -222,7 +222,7 @@ const idVec3 &idAnim::TotalMovementDelta( void ) const { if ( !anims[ 0 ] ) { return vec3_zero; } - + return anims[ 0 ]->TotalMovementDelta(); } @@ -642,7 +642,7 @@ const char *idAnim::AddFrameCommand( const idDeclModelDef *modelDef, int framenu frameLookup[ i ].firstCommand++; } - // store the new command + // store the new command frameCommands[ index ] = fc; // increase the number of commands on this frame @@ -1106,7 +1106,7 @@ void idAnimBlend::Reset( const idDeclModelDef *_modelDef ) { blendStartValue = 0.0f; blendEndValue = 0.0f; - blendStartTime = 0; + blendStartTime = 0; blendDuration = 0; } @@ -1206,7 +1206,7 @@ idAnimBlend::SetWeight void idAnimBlend::SetWeight( float newweight, int currentTime, int blendTime ) { blendStartValue = GetWeight( currentTime ); blendEndValue = newweight; - blendStartTime = currentTime - 1; + blendStartTime = currentTime - 1; blendDuration = blendTime; if ( !newweight ) { @@ -1257,7 +1257,7 @@ void idAnimBlend::SetFrame( const idDeclModelDef *modelDef, int _animNum, int _f if ( !modelDef ) { return; } - + const idAnim *_anim = modelDef->GetAnim( _animNum ); if ( !_anim ) { return; @@ -1268,7 +1268,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() ); return; } - + animNum = _animNum; starttime = currentTime; endtime = -1; @@ -1300,7 +1300,7 @@ void idAnimBlend::CycleAnim( const idDeclModelDef *modelDef, int _animNum, int c if ( !modelDef ) { return; } - + const idAnim *_anim = modelDef->GetAnim( _animNum ); if ( !_anim ) { return; @@ -1340,7 +1340,7 @@ void idAnimBlend::PlayAnim( const idDeclModelDef *modelDef, int _animNum, int cu if ( !modelDef ) { return; } - + const idAnim *_anim = modelDef->GetAnim( _animNum ); if ( !_anim ) { return; @@ -1832,7 +1832,7 @@ bool idAnimBlend::BlendAnim( int currentTime, int channel, int numJoints, idJoin blendFrame[j].q = jointFrame[j].q; } } - } else { + } else { blendWeight += weight; lerp = weight / blendWeight; SIMDProcessor->BlendJoints( blendFrame, jointFrame, lerp, modelDef->GetChannelJoints( channel ), modelDef->NumJointsOnChannel( channel ) ); @@ -1914,7 +1914,7 @@ void idAnimBlend::BlendDelta( int fromtime, int totime, idVec3 &blendDelta, floa float lerp; int num; int i; - + if ( frame || !allowMove || ( ( endtime > 0 ) && ( fromtime > endtime ) ) ) { return; } @@ -1973,7 +1973,7 @@ void idAnimBlend::BlendDeltaRotation( int fromtime, int totime, idQuat &blendDel float mixWeight; int num; int i; - + if ( frame || !allowMove || ( ( endtime > 0 ) && ( fromtime > endtime ) ) ) { return; } @@ -2056,7 +2056,7 @@ bool idAnimBlend::AddBounds( int currentTime, idBounds &bounds, bool removeOrigi time = AnimTime( currentTime ); num = anim->NumAnims(); - + addorigin = !allowMove || !removeOriginOffset; for( i = 0; i < num; i++ ) { if ( anim->GetBounds( b, i, time, cycle ) ) { @@ -2175,7 +2175,7 @@ const jointInfo_t *idDeclModelDef::FindJoint( const char *name ) const { if ( !modelHandle ) { return NULL; } - + joint = modelHandle->GetJoints(); for( i = 0; i < joints.Num(); i++, joint++ ) { if ( !joint->name.Icmp( name ) ) { @@ -2581,7 +2581,7 @@ bool idDeclModelDef::Parse( const char *text, const int textLength ) { MakeDefault(); return false; } - + const idDeclModelDef *copy = static_cast( declManager->FindType( DECL_MODELDEF, token2, false ) ); if ( !copy ) { common->Warning( "Unknown model definition '%s'", token2.c_str() ); @@ -2786,7 +2786,7 @@ bool idDeclModelDef::HasAnim( const char *name ) const { return true; } } - + return false; } @@ -2829,7 +2829,7 @@ const idAnim *idDeclModelDef::GetAnim( int index ) const { if ( ( index < 1 ) || ( index > anims.Num() ) ) { return NULL; } - + return anims[ index - 1 ]; } @@ -2945,7 +2945,7 @@ const char *idDeclModelDef::GetJointName( int jointHandle ) const { if ( !modelHandle ) { return NULL; } - + if ( ( jointHandle < 0 ) || ( jointHandle > joints.Num() ) ) { gameLocal.Error( "idDeclModelDef::GetJointName : joint handle out of range" ); } @@ -3069,7 +3069,7 @@ void idAnimator::Save( idSaveGame *savefile ) const { savefile->WriteInt( (int&)jointMods[ i ]->transform_pos ); savefile->WriteInt( (int&)jointMods[ i ]->transform_axis ); } - + savefile->WriteInt( numJoints ); for ( i = 0; i < numJoints; i++ ) { float *data = joints[i].ToFloatPtr(); @@ -3089,14 +3089,14 @@ void idAnimator::Save( idSaveGame *savefile ) const { for ( i = 0; i < AFPoseJoints.Num(); i++ ) { savefile->WriteInt( AFPoseJoints[i] ); } - + savefile->WriteInt( AFPoseJointMods.Num() ); for ( i = 0; i < AFPoseJointMods.Num(); i++ ) { savefile->WriteInt( (int&)AFPoseJointMods[i].mod ); savefile->WriteMat3( AFPoseJointMods[i].axis ); savefile->WriteVec3( AFPoseJointMods[i].origin ); } - + savefile->WriteInt( AFPoseJointFrame.Num() ); for ( i = 0; i < AFPoseJointFrame.Num(); i++ ) { savefile->WriteFloat( AFPoseJointFrame[i].q.x ); @@ -3105,7 +3105,7 @@ void idAnimator::Save( idSaveGame *savefile ) const { savefile->WriteFloat( AFPoseJointFrame[i].q.w ); savefile->WriteVec3( AFPoseJointFrame[i].t ); } - + savefile->WriteBounds( AFPoseBounds ); savefile->WriteInt( AFPoseTime ); @@ -3143,7 +3143,7 @@ void idAnimator::Restore( idRestoreGame *savefile ) { savefile->ReadInt( (int&)jointMods[ i ]->transform_pos ); savefile->ReadInt( (int&)jointMods[ i ]->transform_axis ); } - + savefile->ReadInt( numJoints ); joints = (idJointMat *) Mem_Alloc16( numJoints * sizeof( joints[0] ) ); for ( i = 0; i < numJoints; i++ ) { @@ -3152,7 +3152,7 @@ void idAnimator::Restore( idRestoreGame *savefile ) { savefile->ReadFloat( data[j] ); } } - + savefile->ReadInt( lastTransformTime ); savefile->ReadBool( stoppedAnimatingUpdate ); savefile->ReadBool( forceUpdate ); @@ -3166,7 +3166,7 @@ void idAnimator::Restore( idRestoreGame *savefile ) { for ( i = 0; i < AFPoseJoints.Num(); i++ ) { savefile->ReadInt( AFPoseJoints[i] ); } - + savefile->ReadInt( num ); AFPoseJointMods.SetGranularity( 1 ); AFPoseJointMods.SetNum( num ); @@ -3175,7 +3175,7 @@ void idAnimator::Restore( idRestoreGame *savefile ) { savefile->ReadMat3( AFPoseJointMods[i].axis ); savefile->ReadVec3( AFPoseJointMods[i].origin ); } - + savefile->ReadInt( num ); AFPoseJointFrame.SetGranularity( 1 ); AFPoseJointFrame.SetNum( num ); @@ -3186,7 +3186,7 @@ void idAnimator::Restore( idRestoreGame *savefile ) { savefile->ReadFloat( AFPoseJointFrame[i].q.w ); savefile->ReadVec3( AFPoseJointFrame[i].t ); } - + savefile->ReadBounds( AFPoseBounds ); savefile->ReadInt( AFPoseTime ); @@ -3270,7 +3270,7 @@ idRenderModel *idAnimator::SetModel( const char *modelname ) { if ( !modelDef ) { return NULL; } - + idRenderModel *renderModel = modelDef->ModelHandle(); if ( !renderModel ) { modelDef = NULL; @@ -3358,7 +3358,7 @@ int idAnimator::NumAnims( void ) const { if ( !modelDef ) { return 0; } - + return modelDef->NumAnims(); } @@ -3371,7 +3371,7 @@ const idAnim *idAnimator::GetAnim( int index ) const { if ( !modelDef ) { return NULL; } - + return modelDef->GetAnim( index ); } @@ -3384,7 +3384,7 @@ int idAnimator::GetAnim( const char *name ) const { if ( !modelDef ) { return 0; } - + return modelDef->GetAnim( name ); } @@ -3397,7 +3397,7 @@ bool idAnimator::HasAnim( const char *name ) const { if ( !modelDef ) { return false; } - + return modelDef->HasAnim( name ); } @@ -3419,7 +3419,7 @@ idRenderModel *idAnimator::ModelHandle( void ) const { if ( !modelDef ) { return NULL; } - + return modelDef->ModelHandle(); } @@ -3499,7 +3499,7 @@ void idAnimator::CycleAnim( int channelNum, int animNum, int currentTime, int bl if ( !modelDef || !modelDef->GetAnim( animNum ) ) { return; } - + PushAnims( channelNum, currentTime, blendTime ); channels[ channelNum ][ 0 ].CycleAnim( modelDef, animNum, currentTime, blendTime ); if ( entity ) { @@ -3520,7 +3520,7 @@ void idAnimator::PlayAnim( int channelNum, int animNum, int currentTime, int ble if ( !modelDef || !modelDef->GetAnim( animNum ) ) { return; } - + PushAnims( channelNum, currentTime, blendTime ); channels[ channelNum ][ 0 ].PlayAnim( modelDef, animNum, currentTime, blendTime ); if ( entity ) { @@ -3548,7 +3548,7 @@ void idAnimator::SyncAnimChannels( int channelNum, int fromChannelNum, int curre toBlend.blendStartValue = 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 toBlend.AllowFrameCommands( false ); @@ -3901,7 +3901,7 @@ void idAnimator::FinishAFPose( int animNum, const idBounds &bounds, const int ti if ( !modelDef ) { return; } - + const idAnim *anim = modelDef->GetAnim( animNum ); if ( !anim ) { return; @@ -4204,7 +4204,7 @@ bool idAnimator::CreateFrame( int currentTime, bool force ) { if ( entity && ( ( g_debugAnim.GetInteger() == entity->entityNumber ) || ( g_debugAnim.GetInteger() == -2 ) ) ) { debugInfo = true; 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 { debugInfo = false; } @@ -4307,7 +4307,7 @@ bool idAnimator::CreateFrame( int currentTime, bool force ) { case JOINTMOD_LOCAL: joints[0].SetRotation( jointMod->mat * joints[0].ToMat3() ); break; - + case JOINTMOD_WORLD: joints[0].SetRotation( joints[0].ToMat3() * jointMod->mat ); break; @@ -4325,7 +4325,7 @@ bool idAnimator::CreateFrame( int currentTime, bool force ) { case JOINTMOD_LOCAL: joints[0].SetTranslation( joints[0].ToVec3() + jointMod->pos ); break; - + case JOINTMOD_LOCAL_OVERRIDE: case JOINTMOD_WORLD: case JOINTMOD_WORLD_OVERRIDE: @@ -4362,7 +4362,7 @@ bool idAnimator::CreateFrame( int currentTime, bool force ) { case JOINTMOD_LOCAL: joints[i].SetRotation( jointMod->mat * ( joints[i].ToMat3() * joints[parentNum].ToMat3() ) ); break; - + case JOINTMOD_LOCAL_OVERRIDE: joints[i].SetRotation( jointMod->mat * joints[parentNum].ToMat3() ); break; @@ -4385,7 +4385,7 @@ bool idAnimator::CreateFrame( int currentTime, bool force ) { case JOINTMOD_LOCAL: joints[i].SetTranslation( joints[parentNum].ToVec3() + ( joints[i].ToVec3() + jointMod->pos ) * joints[parentNum].ToMat3() ); break; - + case JOINTMOD_LOCAL_OVERRIDE: joints[i].SetTranslation( joints[parentNum].ToVec3() + jointMod->pos * joints[parentNum].ToMat3() ); break; @@ -4953,7 +4953,7 @@ idRenderModel *idGameEdit::ANIM_CreateMeshForAnim( idRenderModel *model, const c const idDict *args; const char *temp; idRenderModel *newmodel; - const idMD5Anim *md5anim; + const idMD5Anim *md5anim; idStr filename; idStr extension; const idAnim *anim; diff --git a/game/anim/Anim_Import.cpp b/game/anim/Anim_Import.cpp index ef3b76c..cf97f92 100644 --- a/game/anim/Anim_Import.cpp +++ b/game/anim/Anim_Import.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -140,7 +140,7 @@ void idModelExport::LoadMayaDll( void ) { } // 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_Shutdown = ( exporterShutdown_t )sys->DLL_GetProcAddress( importDLL, "Maya_Shutdown" ); if ( !Maya_ConvertModel || !dllEntry || !Maya_Shutdown ) { @@ -168,12 +168,12 @@ void idModelExport::LoadMayaDll( void ) { ===================== 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. ===================== */ bool idModelExport::ConvertMayaToMD5( void ) { - ID_TIME_T + ID_TIME_T sourceTime; ID_TIME_T destTime; int version; @@ -256,7 +256,7 @@ bool idModelExport::ConvertMayaToMD5( void ) { if ( Maya_Error != "Ok" ) { return false; } - + // conversion succeded return true; } @@ -409,7 +409,7 @@ int idModelExport::ParseExportSection( idParser &parser ) { return 0; } - parser.ReadToken( &token ); + parser.ReadToken( &token ); if ( token.Icmp( g_exportMask.GetString() ) ) { parser.SkipBracedSection(); return 0; diff --git a/game/anim/Anim_Testmodel.cpp b/game/anim/Anim_Testmodel.cpp index b23964d..e64251d 100644 --- a/game/anim/Anim_Testmodel.cpp +++ b/game/anim/Anim_Testmodel.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms Model viewing can begin with either "testmodel " -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" 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 ) EVENT( EV_FootstepLeft, idTestModel::Event_Footstep ) - EVENT( EV_FootstepRight, idTestModel::Event_Footstep ) + EVENT( EV_FootstepRight, idTestModel::Event_Footstep ) END_CLASS /* @@ -120,7 +120,7 @@ void idTestModel::Spawn( void ) { physicsObj.SetSelf( this ); physicsObj.SetOrigin( GetPhysics()->GetOrigin() ); physicsObj.SetAxis( GetPhysics()->GetAxis() ); - + if ( spawnArgs.GetVector( "mins", NULL, bounds[0] ) ) { spawnArgs.GetVector( "maxs", NULL, bounds[1] ); physicsObj.SetClipBox( bounds, 1.0f ); @@ -157,7 +157,7 @@ void idTestModel::Spawn( void ) { head.GetEntity()->SetOrigin( origin ); head.GetEntity()->SetAxis( GetPhysics()->GetAxis() ); head.GetEntity()->BindToJoint( this, animator.GetJointName( joint ), true ); - + headAnimator = head.GetEntity()->GetAnimator(); // set up the list of joints to copy to the head @@ -324,7 +324,7 @@ void idTestModel::Think( void ) { } break; } - + mode = g_testModelAnimate.GetInteger(); } @@ -414,7 +414,7 @@ void idTestModel::NextAnim( const idCmdArgs &args ) { headAnim = 0; if ( headAnimator ) { headAnimator->ClearAllAnims( gameLocal.time, 0 ); - headAnim = headAnimator->GetAnim( animname ); + headAnim = headAnimator->GetAnim( animname ); if ( !headAnim ) { headAnim = headAnimator->GetAnim( "idle" ); } @@ -456,7 +456,7 @@ void idTestModel::PrevAnim( const idCmdArgs &args ) { headAnim = 0; if ( headAnimator ) { headAnimator->ClearAllAnims( gameLocal.time, 0 ); - headAnim = headAnimator->GetAnim( animname ); + headAnim = headAnimator->GetAnim( animname ); if ( !headAnim ) { headAnim = headAnimator->GetAnim( "idle" ); } @@ -565,7 +565,7 @@ void idTestModel::TestAnim( const idCmdArgs &args ) { headAnim = 0; if ( headAnimator ) { headAnimator->ClearAllAnims( gameLocal.time, 0 ); - headAnim = headAnimator->GetAnim( animname ); + headAnim = headAnimator->GetAnim( animname ); if ( !headAnim ) { headAnim = headAnimator->GetAnim( "idle" ); if ( !headAnim ) { @@ -766,8 +766,8 @@ void idTestModel::TestModel_f( const idCmdArgs &args ) { // without appending an ase if ( name[ 0 ] != '_' ) { name.DefaultFileExtension( ".ase" ); - } - + } + if ( strstr( name, ".ma" ) || strstr( name, ".mb" ) ) { idModelExport exporter; exporter.ExportModel( name ); diff --git a/game/anim/Anim_Testmodel.h b/game/anim/Anim_Testmodel.h index a752577..e63a7c4 100644 --- a/game/anim/Anim_Testmodel.h +++ b/game/anim/Anim_Testmodel.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -58,19 +58,19 @@ public: void TestAnim( const idCmdArgs &args ); void BlendAnim( const idCmdArgs &args ); - static void KeepTestModel_f( const idCmdArgs &args ); - static void TestModel_f( const idCmdArgs &args ); + static void KeepTestModel_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 TestSkin_f( const idCmdArgs &args ); - static void TestShaderParm_f( const idCmdArgs &args ); - static void TestParticleStopTime_f( const idCmdArgs &args ); - static void TestAnim_f( const idCmdArgs &args ); + static void TestSkin_f( const idCmdArgs &args ); + static void TestShaderParm_f( const idCmdArgs &args ); + static void TestParticleStopTime_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 TestBlend_f( const idCmdArgs &args ); - static void TestModelNextAnim_f( const idCmdArgs &args ); - static void TestModelPrevAnim_f( const idCmdArgs &args ); - static void TestModelNextFrame_f( const idCmdArgs &args ); - static void TestModelPrevFrame_f( const idCmdArgs &args ); + static void TestBlend_f( const idCmdArgs &args ); + static void TestModelNextAnim_f( const idCmdArgs &args ); + static void TestModelPrevAnim_f( const idCmdArgs &args ); + static void TestModelNextFrame_f( const idCmdArgs &args ); + static void TestModelPrevFrame_f( const idCmdArgs &args ); private: idEntityPtr head; diff --git a/game/gamesys/Callbacks.cpp b/game/gamesys/Callbacks.cpp index 0f7f7f6..caacc10 100644 --- a/game/gamesys/Callbacks.cpp +++ b/game/gamesys/Callbacks.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -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 ); ( 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; - diff --git a/game/gamesys/Class.cpp b/game/gamesys/Class.cpp index 617a50b..7c39cb0 100644 --- a/game/gamesys/Class.cpp +++ b/game/gamesys/Class.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -62,7 +62,7 @@ initialized in any order, the constructor must handle the case that subclasses are initialized before superclasses. ================ */ -idTypeInfo::idTypeInfo( const char *classname, const char *superclass, idEventFunc *eventCallbacks, idClass *( *CreateInstance )( void ), +idTypeInfo::idTypeInfo( const char *classname, const char *superclass, idEventFunc *eventCallbacks, idClass *( *CreateInstance )( void ), void ( idClass::*Spawn )( void ), void ( idClass::*Save )( idSaveGame *savefile ) const, void ( idClass::*Restore )( idRestoreGame *savefile ) ) { idTypeInfo *type; @@ -83,7 +83,7 @@ idTypeInfo::idTypeInfo( const char *classname, const char *superclass, idEventFu // Check if any subclasses were initialized before their superclass 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" ) ) { type->super = this; } @@ -117,7 +117,7 @@ idTypeInfo::~idTypeInfo() { ================ 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. ================ */ @@ -203,7 +203,7 @@ void idTypeInfo::Init( void ) { idTypeInfo::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. ================ */ @@ -394,7 +394,7 @@ void idClass::Init( void ) { // is a subclass of another num = 0; for( c = classHierarchy.GetNext(); c != NULL; c = c->node.GetNext(), num++ ) { - c->typeNum = num; + c->typeNum = num; c->lastChild += num; } @@ -504,7 +504,7 @@ void idClass::operator delete( void *ptr ) { p = ( ( int * )ptr ) - 1; memused -= *p; 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; memused -= *p; numobjects--; - Mem_Free( p ); + Mem_Free( p ); } } @@ -629,9 +629,9 @@ bool idClass::PostEventArgs( const idEventDef *ev, int time, int numargs, ... ) idTypeInfo *c; idEvent *event; va_list args; - + assert( ev ); - + if ( !idEvent::initialized ) { return false; } @@ -830,7 +830,7 @@ bool idClass::ProcessEventArgs( const idEventDef *ev, int numargs, ... ) { int num; int data[ D_EVENT_MAXARGS ]; va_list args; - + assert( ev ); assert( idEvent::initialized ); diff --git a/game/gamesys/Class.h b/game/gamesys/Class.h index 7557a90..21e6873 100644 --- a/game/gamesys/Class.h +++ b/game/gamesys/Class.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -102,7 +102,7 @@ CLASS_DECLARATION 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 -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 incorrect. Use this on concrete classes only. ================ @@ -287,7 +287,7 @@ public: idHierarchy node; - idTypeInfo( const char *classname, const char *superclass, + idTypeInfo( const char *classname, const char *superclass, idEventFunc *eventCallbacks, idClass *( *CreateInstance )( void ), void ( idClass::*Spawn )( void ), void ( idClass::*Save )( idSaveGame *savefile ) const, void ( idClass::*Restore )( idRestoreGame *savefile ) ); ~idTypeInfo(); @@ -303,7 +303,7 @@ public: ================ 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. ================ */ @@ -330,7 +330,7 @@ ID_INLINE bool idTypeInfo::RespondsTo( const idEventDef &ev ) const { ================ 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. ================ */ diff --git a/game/gamesys/DebugGraph.cpp b/game/gamesys/DebugGraph.cpp index 9c28470..f79c627 100644 --- a/game/gamesys/DebugGraph.cpp +++ b/game/gamesys/DebugGraph.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/gamesys/DebugGraph.h b/game/gamesys/DebugGraph.h index 00b357b..0729d49 100644 --- a/game/gamesys/DebugGraph.h +++ b/game/gamesys/DebugGraph.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/gamesys/Event.cpp b/game/gamesys/Event.cpp index 6753e8e..49dc250 100644 --- a/game/gamesys/Event.cpp +++ b/game/gamesys/Event.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -70,7 +70,7 @@ idEventDef::idEventDef( const char *command, const char *formatspec, char return if ( !formatspec ) { formatspec = ""; } - + this->name = command; this->formatspec = formatspec; this->returnType = returnType; @@ -443,8 +443,8 @@ void idEvent::ClearEventList( void ) { // FreeEvents.Clear(); EventQueue.Clear(); - - // + + // // add the events to the free list // for( i = 0; i < MAX_EVENTS; i++ ) { @@ -599,7 +599,7 @@ void idEvent::Shutdown( void ) { } ClearEventList(); - + eventDataAllocator.Shutdown(); // say it is now shutdown @@ -766,7 +766,7 @@ void idEvent::Restore( idRestoreGame *savefile ) { /* ================ idEvent::ReadTrace - + idRestoreGame has a ReadTrace procedure, but unfortunately idEvent wants the material string name at the of the data structure rather than in the middle ================ @@ -841,7 +841,7 @@ void CreateEventCallbackHandler( void ) { argString[ k ] = j & ( 1 << k ) ? 'f' : 'i'; } argString[ i ] = '\0'; - + string1.Empty(); string2.Empty(); diff --git a/game/gamesys/Event.h b/game/gamesys/Event.h index 4150202..a265a6f 100644 --- a/game/gamesys/Event.h +++ b/game/gamesys/Event.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -67,7 +67,7 @@ private: public: idEventDef( const char *command, const char *formatspec = NULL, char returnType = 0 ); - + const char *GetName( void ) const; const char *GetArgFormat( void ) const; unsigned int GetFormatspecIndex( void ) const; @@ -105,7 +105,7 @@ public: static idEvent *Alloc( const idEventDef *evdef, int numargs, va_list args ); static void CopyArgs( const idEventDef *evdef, int numargs, va_list args, int data[ D_EVENT_MAXARGS ] ); - + void Free( void ); void Schedule( idClass *object, const idTypeInfo *cls, int time ); byte *GetData( void ); @@ -121,7 +121,7 @@ public: static void Restore( idRestoreGame *savefile ); // unarchives object from save game file static void SaveTrace( idSaveGame *savefile, const trace_t &trace ); static void RestoreTrace( idRestoreGame *savefile, trace_t &trace ); - + }; /* diff --git a/game/gamesys/NoGameTypeInfo.h b/game/gamesys/NoGameTypeInfo.h index 23d4652..5b5618e 100644 --- a/game/gamesys/NoGameTypeInfo.h +++ b/game/gamesys/NoGameTypeInfo.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/gamesys/SaveGame.cpp b/game/gamesys/SaveGame.cpp index ea8a559..432f19f 100644 --- a/game/gamesys/SaveGame.cpp +++ b/game/gamesys/SaveGame.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -36,7 +36,7 @@ If you have questions concerning this license or the applicable additional terms /* Save game related helper classes. -Save games are implemented in two classes, idSaveGame and idRestoreGame, that implement write/read functions for +Save games are implemented in two classes, idSaveGame and idRestoreGame, that implement write/read functions for common types. They're passed in to each entity and object for them to archive themselves. Each class implements save/restore functions for it's own data. When restoring, all the objects are instantiated, then the restore function is called on each, superclass first, then subclasses. @@ -138,7 +138,7 @@ void idSaveGame::CallSave_r( const idTypeInfo *cls, const idClass *obj ) { return; } } - + ( obj->*cls->Save )( this ); } @@ -227,13 +227,13 @@ void idSaveGame::WriteBool( const bool value ) { ================ idSaveGame::WriteString ================ -*/ +*/ void idSaveGame::WriteString( const char *string ) { int len; len = strlen( string ); WriteInt( len ); - file->Write( string, len ); + file->Write( string, len ); } /* @@ -700,7 +700,7 @@ void idSaveGame::WriteTrace( const trace_t &trace ) { */ void idSaveGame::WriteTraceModel( const idTraceModel &trace ) { int j, k; - + WriteInt( (int&)trace.type ); WriteInt( trace.numVerts ); for ( j = 0; j < MAX_TRACEMODEL_VERTS; j++ ) { @@ -766,7 +766,7 @@ void idSaveGame::WriteBuildNumber( const int value ) { /*********************************************************************** idRestoreGame - + ***********************************************************************/ /* @@ -896,7 +896,7 @@ void idRestoreGame::CallRestore_r( const idTypeInfo *cls, idClass *obj ) { return; } } - + ( obj->*cls->Restore )( this ); } @@ -1471,7 +1471,7 @@ void idRestoreGame::ReadTrace( trace_t &trace ) { */ void idRestoreGame::ReadTraceModel( idTraceModel &trace ) { int j, k; - + ReadInt( (int&)trace.type ); ReadInt( trace.numVerts ); for ( j = 0; j < MAX_TRACEMODEL_VERTS; j++ ) { diff --git a/game/gamesys/SaveGame.h b/game/gamesys/SaveGame.h index fc6f2e4..7b3be8e 100644 --- a/game/gamesys/SaveGame.h +++ b/game/gamesys/SaveGame.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/gamesys/SysCmds.cpp b/game/gamesys/SysCmds.cpp index 32a79e0..1e4dc88 100644 --- a/game/gamesys/SysCmds.cpp +++ b/game/gamesys/SysCmds.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -2044,7 +2044,7 @@ static void Cmd_CloseViewNotes_f( const idCmdArgs &args ) { if ( !player ) { return; } - + player->hud->SetStateString( "viewcomments", "" ); player->hud->HandleNamedEvent( "hideViewComments" ); } @@ -2084,7 +2084,7 @@ static void Cmd_ShowViewNotes_f( const idCmdArgs &args ) { } } - if ( parser.ExpectTokenString( "view" ) && parser.Parse1DMatrix( 3, origin.ToFloatPtr() ) && + if ( parser.ExpectTokenString( "view" ) && parser.Parse1DMatrix( 3, origin.ToFloatPtr() ) && parser.Parse1DMatrix( 9, axis.ToFloatPtr() ) && parser.ExpectTokenString( "comments" ) && parser.ReadToken( &token ) ) { player->hud->SetStateString( "viewcomments", token ); player->hud->HandleNamedEvent( "showViewComments" ); @@ -2199,7 +2199,7 @@ void Cmd_NextGUI_f( const idCmdArgs &args ) { if ( ent->spawnArgs.GetString( "gui", NULL ) != NULL ) { break; } - + if ( ent->spawnArgs.GetString( "gui2", NULL ) != NULL ) { break; } @@ -2207,7 +2207,7 @@ void Cmd_NextGUI_f( const idCmdArgs &args ) { if ( ent->spawnArgs.GetString( "gui3", NULL ) != NULL ) { break; } - + // try the next entity gameLocal.lastGUIEnt = ent; } @@ -2242,7 +2242,7 @@ void Cmd_NextGUI_f( const idCmdArgs &args ) { assert( geom->facePlanes != NULL ); - modelMatrix = idMat4( renderEnt->axis, renderEnt->origin ); + modelMatrix = idMat4( renderEnt->axis, renderEnt->origin ); normal = geom->facePlanes[ 0 ].Normal() * renderEnt->axis; center = geom->bounds.GetCenter() * modelMatrix; @@ -2280,7 +2280,7 @@ void Cmd_TestId_f( const idCmdArgs &args ) { if ( idStr::Cmpn( id, STRTABLE_ID, STRTABLE_ID_LENGTH ) != 0 ) { id = STRTABLE_ID + id; } - gameLocal.mpGame.AddChatLine( common->GetLanguageDict()->GetString( id ), "", "", "" ); + gameLocal.mpGame.AddChatLine( common->GetLanguageDict()->GetString( id ), "", "", "" ); } /* diff --git a/game/gamesys/SysCmds.h b/game/gamesys/SysCmds.h index dbba941..2b1abcd 100644 --- a/game/gamesys/SysCmds.h +++ b/game/gamesys/SysCmds.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/gamesys/SysCvar.cpp b/game/gamesys/SysCvar.cpp index a2727dd..93e7b49 100644 --- a/game/gamesys/SysCvar.cpp +++ b/game/gamesys/SysCvar.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -44,11 +44,11 @@ All game cvars should be defined here. */ const char *si_gameTypeArgs[] = { "singleplayer", "deathmatch", "Tourney", "Team DM", "Last Man", NULL }; -const char *si_readyArgs[] = { "Not Ready", "Ready", NULL }; +const char *si_readyArgs[] = { "Not Ready", "Ready", NULL }; const char *si_spectateArgs[] = { "Play", "Spectate", NULL }; const char *ui_skinArgs[] = { "skins/characters/player/marine_mp", "skins/characters/player/marine_mp_red", "skins/characters/player/marine_mp_blue", "skins/characters/player/marine_mp_green", "skins/characters/player/marine_mp_yellow", NULL }; -const char *ui_teamArgs[] = { "Red", "Blue", NULL }; +const char *ui_teamArgs[] = { "Red", "Blue", NULL }; struct gameVersion_s { gameVersion_s( void ) { sprintf( string, "%s.%d%s %s %s", ENGINE_VERSION, BUILD_NUMBER, BUILD_DEBUG, BUILD_STRING, __DATE__, __TIME__ ); } @@ -78,7 +78,7 @@ idCVar si_serverURL( "si_serverURL", "", CVAR_GAME | CVAR_SERVERINFO | // user info idCVar ui_name( "ui_name", "Player", CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE, "player name" ); idCVar ui_skin( "ui_skin", ui_skinArgs[ 0 ], CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE, "player skin", ui_skinArgs, idCmdSystem::ArgCompletion_String ); -idCVar ui_team( "ui_team", ui_teamArgs[ 0 ], CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE, "player team", ui_teamArgs, idCmdSystem::ArgCompletion_String ); +idCVar ui_team( "ui_team", ui_teamArgs[ 0 ], CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE, "player team", ui_teamArgs, idCmdSystem::ArgCompletion_String ); idCVar ui_autoSwitch( "ui_autoSwitch", "1", CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE | CVAR_BOOL, "auto switch weapon" ); idCVar ui_autoReload( "ui_autoReload", "1", CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE | CVAR_BOOL, "auto reload weapon" ); idCVar ui_showGun( "ui_showGun", "1", CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE | CVAR_BOOL, "show gun" ); @@ -89,7 +89,7 @@ idCVar ui_chat( "ui_chat", "0", CVAR_GAME | CVAR_USERINFO | CVAR_BOOL // change anytime vars idCVar developer( "developer", "0", CVAR_GAME | CVAR_BOOL, "" ); -idCVar r_aspectRatio( "r_aspectRatio", "0", CVAR_RENDERER | CVAR_INTEGER | CVAR_ARCHIVE, "aspect ratio of view:\n0 = 4:3\n1 = 16:9\n2 = 16:10", 0, 2 ); +idCVar r_aspectRatio( "r_aspectRatio", "0", CVAR_RENDERER | CVAR_INTEGER | CVAR_ARCHIVE, "aspect ratio of view:\n0 = 4:3\n1 = 16:9\n2 = 16:10", 0, 2 ); idCVar g_cinematic( "g_cinematic", "1", CVAR_GAME | CVAR_BOOL, "skips updating entities that aren't marked 'cinematic' '1' during cinematics" ); idCVar g_cinematicMaxSkipTime( "g_cinematicMaxSkipTime", "600", CVAR_GAME | CVAR_FLOAT, "# of seconds to allow game to run when skipping cinematic. prevents lock-up when cinematic doesn't end.", 0, 3600 ); @@ -144,7 +144,7 @@ idCVar g_showEnemies( "g_showEnemies", "0", CVAR_GAME | CVAR_BOOL, "draws idCVar g_frametime( "g_frametime", "0", CVAR_GAME | CVAR_BOOL, "displays timing information for each game frame" ); idCVar g_timeentities( "g_timeEntities", "0", CVAR_GAME | CVAR_FLOAT, "when non-zero, shows entities whose think functions exceeded the # of milliseconds specified" ); - + idCVar ai_debugScript( "ai_debugScript", "-1", CVAR_GAME | CVAR_INTEGER, "displays script calls for the specified monster entity number" ); idCVar ai_debugMove( "ai_debugMove", "0", CVAR_GAME | CVAR_BOOL, "draws movement information for monsters" ); idCVar ai_debugTrajectory( "ai_debugTrajectory", "0", CVAR_GAME | CVAR_BOOL, "draws trajectory tests for monsters" ); @@ -153,7 +153,7 @@ idCVar ai_showCombatNodes( "ai_showCombatNodes", "0", CVAR_GAME | CVAR_BOOL idCVar ai_showPaths( "ai_showPaths", "0", CVAR_GAME | CVAR_BOOL, "draws path_* entities" ); idCVar ai_showObstacleAvoidance( "ai_showObstacleAvoidance", "0", CVAR_GAME | CVAR_INTEGER, "draws obstacle avoidance information for monsters. if 2, draws obstacles for player, as well", 0, 2, idCmdSystem::ArgCompletion_Integer<0,2> ); idCVar ai_blockedFailSafe( "ai_blockedFailSafe", "1", CVAR_GAME | CVAR_BOOL, "enable blocked fail safe handling" ); - + idCVar g_dvTime( "g_dvTime", "1", CVAR_GAME | CVAR_FLOAT, "" ); idCVar g_dvAmplitude( "g_dvAmplitude", "0.001", CVAR_GAME | CVAR_FLOAT, "" ); idCVar g_dvFrequency( "g_dvFrequency", "0.5", CVAR_GAME | CVAR_FLOAT, "" ); diff --git a/game/gamesys/SysCvar.h b/game/gamesys/SysCvar.h index 9fd12ad..bcecd1d 100644 --- a/game/gamesys/SysCvar.h +++ b/game/gamesys/SysCvar.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/gamesys/TypeInfo.cpp b/game/gamesys/TypeInfo.cpp index 94b6743..9e71192 100644 --- a/game/gamesys/TypeInfo.cpp +++ b/game/gamesys/TypeInfo.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/gamesys/TypeInfo.h b/game/gamesys/TypeInfo.h index 36717d0..cd47bfd 100644 --- a/game/gamesys/TypeInfo.h +++ b/game/gamesys/TypeInfo.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Clip.cpp b/game/physics/Clip.cpp index 9ee7518..e6a30fe 100644 --- a/game/physics/Clip.cpp +++ b/game/physics/Clip.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -72,7 +72,7 @@ idBlockAlloc clipLinkAllocator; static idList traceModelCache; static idHashIndex traceModelHash; - + /* =============== idClipModel::ClearTraceModelCache @@ -162,7 +162,7 @@ void idClipModel::SaveTraceModels( idSaveGame *savefile ) { savefile->WriteInt( traceModelCache.Num() ); for ( i = 0; i < traceModelCache.Num(); i++ ) { trmCache_t *entry = traceModelCache[i]; - + savefile->WriteTraceModel( entry->trm ); savefile->WriteFloat( entry->volume ); savefile->WriteVec3( entry->centerOfMass ); @@ -185,7 +185,7 @@ void idClipModel::RestoreTraceModels( idRestoreGame *savefile ) { for ( i = 0; i < num; i++ ) { trmCache_t *entry = new trmCache_t; - + savefile->ReadTraceModel( entry->trm ); savefile->ReadFloat( entry->volume ); @@ -667,9 +667,9 @@ clipSector_t *idClip::CreateClipSectors_r( const int depth, const idBounds &boun front = bounds; back = bounds; - + front[0][anode->axis] = back[1][anode->axis] = anode->dist; - + anode->children[0] = CreateClipSectors_r( depth+1, front, maxSector ); anode->children[1] = CreateClipSectors_r( depth+1, back, maxSector ); diff --git a/game/physics/Clip.h b/game/physics/Clip.h index 7d5d857..1d79c84 100644 --- a/game/physics/Clip.h +++ b/game/physics/Clip.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Force.cpp b/game/physics/Force.cpp index e06d97f..a835a55 100644 --- a/game/physics/Force.cpp +++ b/game/physics/Force.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Force.h b/game/physics/Force.h index bf17875..ff6f448 100644 --- a/game/physics/Force.h +++ b/game/physics/Force.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Force_Constant.cpp b/game/physics/Force_Constant.cpp index 8ef517d..2b15096 100644 --- a/game/physics/Force_Constant.cpp +++ b/game/physics/Force_Constant.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Force_Constant.h b/game/physics/Force_Constant.h index 875bc3f..0466b3a 100644 --- a/game/physics/Force_Constant.h +++ b/game/physics/Force_Constant.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Force_Drag.cpp b/game/physics/Force_Drag.cpp index a21ed77..ee41c7f 100644 --- a/game/physics/Force_Drag.cpp +++ b/game/physics/Force_Drag.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Force_Drag.h b/game/physics/Force_Drag.h index 3979716..97465ae 100644 --- a/game/physics/Force_Drag.h +++ b/game/physics/Force_Drag.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Force_Field.cpp b/game/physics/Force_Field.cpp index 44248d7..23f50af 100644 --- a/game/physics/Force_Field.cpp +++ b/game/physics/Force_Field.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -173,7 +173,7 @@ void idForce_Field::Evaluate( int time ) { if ( !entity ) { continue; } - + idPhysics *physics = entity->GetPhysics(); if ( playerOnly ) { diff --git a/game/physics/Force_Field.h b/game/physics/Force_Field.h index 4b47cad..e3bfc83 100644 --- a/game/physics/Force_Field.h +++ b/game/physics/Force_Field.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Force_Spring.cpp b/game/physics/Force_Spring.cpp index 1df7d11..93a6d19 100644 --- a/game/physics/Force_Spring.cpp +++ b/game/physics/Force_Spring.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Force_Spring.h b/game/physics/Force_Spring.h index e87a863..06db706 100644 --- a/game/physics/Force_Spring.h +++ b/game/physics/Force_Spring.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Physics.cpp b/game/physics/Physics.cpp index 3d2e8f4..bb48704 100644 --- a/game/physics/Physics.cpp +++ b/game/physics/Physics.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Physics.h b/game/physics/Physics.h index 92d3c97..3d70adb 100644 --- a/game/physics/Physics.h +++ b/game/physics/Physics.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -158,7 +158,7 @@ public: // common physics interface virtual const contactInfo_t &GetContact( int num ) const = 0; virtual void ClearContacts( void ) = 0; virtual void AddContactEntity( idEntity *e ) = 0; - virtual void RemoveContactEntity( idEntity *e ) = 0; + virtual void RemoveContactEntity( idEntity *e ) = 0; // ground contacts virtual bool HasGroundContacts( void ) const = 0; virtual bool IsGroundEntity( int entityNum ) const = 0; diff --git a/game/physics/Physics_AF.cpp b/game/physics/Physics_AF.cpp index 924e2c5..13f3e59 100644 --- a/game/physics/Physics_AF.cpp +++ b/game/physics/Physics_AF.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -1301,12 +1301,12 @@ void idAFConstraint_UniversalJoint::DebugDraw( void ) { d1 = axis1 * body1->GetWorldAxis(); if ( master ) { - a2 = master->GetWorldOrigin() + anchor2 * master->GetWorldAxis(); + a2 = master->GetWorldOrigin() + anchor2 * master->GetWorldAxis(); s2 = shaft2 * master->GetWorldAxis(); d2 = axis2 * master->GetWorldAxis(); } else { - a2 = anchor2; + a2 = anchor2; s2 = shaft2; d2 = axis2; } @@ -5336,7 +5336,7 @@ void idPhysics_AF::Evolve( float timeStep ) { idVec6 force; idRotation rotation; float vSqr, maxLinearVelocity, maxAngularVelocity; - + maxLinearVelocity = af_maxLinearVelocity.GetFloat() / timeStep; maxAngularVelocity = af_maxAngularVelocity.GetFloat() / timeStep; diff --git a/game/physics/Physics_AF.h b/game/physics/Physics_AF.h index 2dc5179..4d712b1 100644 --- a/game/physics/Physics_AF.h +++ b/game/physics/Physics_AF.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Physics_Actor.cpp b/game/physics/Physics_Actor.cpp index 6bdb726..5237272 100644 --- a/game/physics/Physics_Actor.cpp +++ b/game/physics/Physics_Actor.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Physics_Actor.h b/game/physics/Physics_Actor.h index 3c0b0f4..0e4fec1 100644 --- a/game/physics/Physics_Actor.h +++ b/game/physics/Physics_Actor.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Physics_Base.cpp b/game/physics/Physics_Base.cpp index 57a8518..ee421c7 100644 --- a/game/physics/Physics_Base.cpp +++ b/game/physics/Physics_Base.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Physics_Base.h b/game/physics/Physics_Base.h index 6ff655c..a0ac05b 100644 --- a/game/physics/Physics_Base.h +++ b/game/physics/Physics_Base.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Physics_Monster.cpp b/game/physics/Physics_Monster.cpp index f985912..c5b919c 100644 --- a/game/physics/Physics_Monster.cpp +++ b/game/physics/Physics_Monster.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -108,8 +108,8 @@ monsterMoveResult_t idPhysics_Monster::SlideMove( idVec3 &start, idVec3 &velocit if ( tr.c.entityNum != ENTITYNUM_NONE ) { blockingEntity = gameLocal.entities[ tr.c.entityNum ]; - } - + } + // clip the movement delta and velocity move.ProjectOntoPlane( tr.c.normal, OVERCLIP ); velocity.ProjectOntoPlane( tr.c.normal, OVERCLIP ); @@ -252,7 +252,7 @@ idPhysics_Monster::idPhysics_Monster( void ) { memset( ¤t, 0, sizeof( current ) ); current.atRest = -1; saved = current; - + delta.Zero(); maxStepHeight = 18.0f; minFloorCosine = 0.7f; @@ -310,7 +310,7 @@ void idPhysics_Monster::Save( idSaveGame *savefile ) const { savefile->WriteBool( fly ); savefile->WriteBool( useVelocityMove ); savefile->WriteBool( noImpact ); - + savefile->WriteInt( (int)moveResult ); savefile->WriteObject( blockingEntity ); } @@ -501,7 +501,7 @@ bool idPhysics_Monster::Evaluate( int timeStepMSec, int endTimeMSec ) { delta = current.velocity * timeStep; if ( delta != vec3_origin ) { moveResult = idPhysics_Monster::SlideMove( current.origin, current.velocity, delta ); - delta.Zero(); + delta.Zero(); } if ( !fly ) { diff --git a/game/physics/Physics_Monster.h b/game/physics/Physics_Monster.h index 9ae7303..5492324 100644 --- a/game/physics/Physics_Monster.h +++ b/game/physics/Physics_Monster.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Physics_Parametric.cpp b/game/physics/Physics_Parametric.cpp index 3628d73..2208b94 100644 --- a/game/physics/Physics_Parametric.cpp +++ b/game/physics/Physics_Parametric.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Physics_Parametric.h b/game/physics/Physics_Parametric.h index b13f48b..3cbd6a5 100644 --- a/game/physics/Physics_Parametric.h +++ b/game/physics/Physics_Parametric.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Physics_Player.cpp b/game/physics/Physics_Player.cpp index b32e6d5..bc042d3 100644 --- a/game/physics/Physics_Player.cpp +++ b/game/physics/Physics_Player.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -134,7 +134,7 @@ void idPhysics_Player::Accelerate( const idVec3 &wishdir, const float wishspeed, if (accelspeed > addspeed) { accelspeed = addspeed; } - + current.velocity += accelspeed * wishdir; #else // proper way (avoids strafe jump maxspeed bug), but feels bad @@ -295,7 +295,7 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool current.velocity *= 1.0f - idMath::ClampFloat( 0.0f, 1000.0f, totalMass - 20.0f ) * ( 1.0f / 950.0f ); pushed = true; } - + current.origin = trace.endpos; time_left -= time_left * trace.fraction; @@ -441,7 +441,7 @@ void idPhysics_Player::Friction( void ) { idVec3 vel; float speed, newspeed, control; float drop; - + vel = current.velocity; if ( walking ) { // ignore slope movement, remove all velocity in gravity direction @@ -1011,7 +1011,7 @@ void idPhysics_Player::CheckGround( void ) { walking = false; return; } - + // slopes that are too steep will not be considered onground if ( ( groundTrace.c.normal * -gravityNormal ) < MIN_WALK_NORMAL ) { if ( debugLevel ) { @@ -1123,7 +1123,7 @@ void idPhysics_Player::CheckLadder( void ) { idVec3 forward, start, end; trace_t trace; float tracedist; - + if ( current.movementTime ) { return; } @@ -2042,4 +2042,3 @@ void idPhysics_Player::ReadFromSnapshot( const idBitMsgDelta &msg ) { clipModel->Link( gameLocal.clip, self, 0, current.origin, clipModel->GetAxis() ); } } - diff --git a/game/physics/Physics_Player.h b/game/physics/Physics_Player.h index 494fdb2..f3aa852 100644 --- a/game/physics/Physics_Player.h +++ b/game/physics/Physics_Player.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Physics_RigidBody.cpp b/game/physics/Physics_RigidBody.cpp index 850c8fc..aaefd04 100644 --- a/game/physics/Physics_RigidBody.cpp +++ b/game/physics/Physics_RigidBody.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Physics_RigidBody.h b/game/physics/Physics_RigidBody.h index bce2009..1e9874d 100644 --- a/game/physics/Physics_RigidBody.h +++ b/game/physics/Physics_RigidBody.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Physics_Static.cpp b/game/physics/Physics_Static.cpp index 0c65ec7..4ff07e2 100644 --- a/game/physics/Physics_Static.cpp +++ b/game/physics/Physics_Static.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -542,7 +542,7 @@ void idPhysics_Static::ClipTranslation( trace_t &results, const idVec3 &translat } else { gameLocal.clip.Translation( results, current.origin, current.origin + translation, clipModel, current.axis, MASK_SOLID, self ); - } + } } /* diff --git a/game/physics/Physics_Static.h b/game/physics/Physics_Static.h index 650d236..e8002e1 100644 --- a/game/physics/Physics_Static.h +++ b/game/physics/Physics_Static.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Physics_StaticMulti.cpp b/game/physics/Physics_StaticMulti.cpp index 57f840e..7b87b5b 100644 --- a/game/physics/Physics_StaticMulti.cpp +++ b/game/physics/Physics_StaticMulti.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -762,7 +762,7 @@ void idPhysics_StaticMulti::DisableClip( void ) { int i; for ( i = 0; i < clipModels.Num(); i++ ) { - if ( clipModels[i] ) { + if ( clipModels[i] ) { clipModels[i]->Disable(); } } @@ -792,7 +792,7 @@ void idPhysics_StaticMulti::UnlinkClip( void ) { int i; for ( i = 0; i < clipModels.Num(); i++ ) { - if ( clipModels[i] ) { + if ( clipModels[i] ) { clipModels[i]->Unlink(); } } @@ -934,7 +934,7 @@ void idPhysics_StaticMulti::SetMaster( idEntity *master, const bool orientated ) // transform from world space to master space self->GetMasterPosition( masterOrigin, masterAxis ); for ( i = 0; i < clipModels.Num(); i++ ) { - current[i].localOrigin = ( current[i].origin - masterOrigin ) * masterAxis.Transpose(); + current[i].localOrigin = ( current[i].origin - masterOrigin ) * masterAxis.Transpose(); if ( orientated ) { current[i].localAxis = current[i].axis * masterAxis.Transpose(); } else { diff --git a/game/physics/Physics_StaticMulti.h b/game/physics/Physics_StaticMulti.h index 65d7dd3..a6055f9 100644 --- a/game/physics/Physics_StaticMulti.h +++ b/game/physics/Physics_StaticMulti.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/physics/Push.cpp b/game/physics/Push.cpp index 1b90833..3cb5c34 100644 --- a/game/physics/Push.cpp +++ b/game/physics/Push.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -1394,7 +1394,7 @@ float idPush::ClipPush( trace_t &results, idEntity *pusher, const int flags, idRotation rotation; float mass; - mass = 0.0f; + mass = 0.0f; results.fraction = 1.0f; results.endpos = newOrigin; diff --git a/game/physics/Push.h b/game/physics/Push.h index 9a38dce..b122d01 100644 --- a/game/physics/Push.h +++ b/game/physics/Push.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/game/script/Script_Compiler.cpp b/game/script/Script_Compiler.cpp index 2f94bad..f427bcf 100644 --- a/game/script/Script_Compiler.cpp +++ b/game/script/Script_Compiler.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -47,22 +47,22 @@ char *idCompiler::punctuation[] = { opcode_t idCompiler::opcodes[] = { { "", "RETURN", -1, false, &def_void, &def_void, &def_void }, - + { "++", "UINC_F", 1, true, &def_float, &def_void, &def_void }, { "++", "UINCP_F", 1, true, &def_object, &def_field, &def_float }, { "--", "UDEC_F", 1, true, &def_float, &def_void, &def_void }, { "--", "UDECP_F", 1, true, &def_object, &def_field, &def_float }, { "~", "COMP_F", -1, false, &def_float, &def_void, &def_float }, - + { "*", "MUL_F", 3, false, &def_float, &def_float, &def_float }, { "*", "MUL_V", 3, false, &def_vector, &def_vector, &def_float }, { "*", "MUL_FV", 3, false, &def_float, &def_vector, &def_vector }, { "*", "MUL_VF", 3, false, &def_vector, &def_float, &def_vector }, - + { "/", "DIV", 3, false, &def_float, &def_float, &def_float }, { "%", "MOD_F", 3, false, &def_float, &def_float, &def_float }, - + { "+", "ADD_F", 4, false, &def_float, &def_float, &def_float }, { "+", "ADD_V", 4, false, &def_vector, &def_vector, &def_vector }, { "+", "ADD_S", 4, false, &def_string, &def_string, &def_string }, @@ -70,10 +70,10 @@ opcode_t idCompiler::opcodes[] = { { "+", "ADD_SF", 4, false, &def_string, &def_float, &def_string }, { "+", "ADD_VS", 4, false, &def_vector, &def_string, &def_string }, { "+", "ADD_SV", 4, false, &def_string, &def_vector, &def_string }, - + { "-", "SUB_F", 4, false, &def_float, &def_float, &def_float }, { "-", "SUB_V", 4, false, &def_vector, &def_vector, &def_vector }, - + { "==", "EQ_F", 5, false, &def_float, &def_float, &def_float }, { "==", "EQ_V", 5, false, &def_vector, &def_vector, &def_float }, { "==", "EQ_S", 5, false, &def_string, &def_string, &def_float }, @@ -81,20 +81,20 @@ opcode_t idCompiler::opcodes[] = { { "==", "EQ_EO", 5, false, &def_entity, &def_object, &def_float }, { "==", "EQ_OE", 5, false, &def_object, &def_entity, &def_float }, { "==", "EQ_OO", 5, false, &def_object, &def_object, &def_float }, - + { "!=", "NE_F", 5, false, &def_float, &def_float, &def_float }, { "!=", "NE_V", 5, false, &def_vector, &def_vector, &def_float }, { "!=", "NE_S", 5, false, &def_string, &def_string, &def_float }, - { "!=", "NE_E", 5, false, &def_entity, &def_entity, &def_float }, + { "!=", "NE_E", 5, false, &def_entity, &def_entity, &def_float }, { "!=", "NE_EO", 5, false, &def_entity, &def_object, &def_float }, { "!=", "NE_OE", 5, false, &def_object, &def_entity, &def_float }, { "!=", "NE_OO", 5, false, &def_object, &def_object, &def_float }, - + { "<=", "LE", 5, false, &def_float, &def_float, &def_float }, { ">=", "GE", 5, false, &def_float, &def_float, &def_float }, { "<", "LT", 5, false, &def_float, &def_float, &def_float }, { ">", "GT", 5, false, &def_float, &def_float, &def_float }, - + { ".", "INDIRECT_F", 1, false, &def_object, &def_field, &def_float }, { ".", "INDIRECT_V", 1, false, &def_object, &def_field, &def_vector }, { ".", "INDIRECT_S", 1, false, &def_object, &def_field, &def_string }, @@ -116,7 +116,7 @@ opcode_t idCompiler::opcodes[] = { { "=", "STORE_OBJENT", 6, true, &def_object, &def_entity, &def_object }, { "=", "STORE_OBJ", 6, true, &def_object, &def_object, &def_object }, { "=", "STORE_OBJENT", 6, true, &def_entity, &def_object, &def_object }, - + { "=", "STORE_FTOS", 6, true, &def_string, &def_float, &def_string }, { "=", "STORE_BTOS", 6, true, &def_string, &def_boolean, &def_string }, { "=", "STORE_VTOS", 6, true, &def_string, &def_vector, &def_string }, @@ -137,7 +137,7 @@ opcode_t idCompiler::opcodes[] = { { "<=>", "STOREP_VTOS", 6, true, &def_pointer, &def_vector, &def_string }, { "<=>", "STOREP_FTOBOOL", 6, true, &def_pointer, &def_float, &def_boolean }, { "<=>", "STOREP_BOOLTOF", 6, true, &def_pointer, &def_boolean, &def_float }, - + { "*=", "UMUL_F", 6, true, &def_float, &def_float, &def_void }, { "*=", "UMUL_V", 6, true, &def_vector, &def_float, &def_void }, { "/=", "UDIV_F", 6, true, &def_float, &def_float, &def_void }, @@ -149,7 +149,7 @@ opcode_t idCompiler::opcodes[] = { { "-=", "USUB_V", 6, true, &def_vector, &def_vector, &def_void }, { "&=", "UAND_F", 6, true, &def_float, &def_float, &def_void }, { "|=", "UOR_F", 6, true, &def_float, &def_float, &def_void }, - + { "!", "NOT_BOOL", -1, false, &def_boolean, &def_void, &def_float }, { "!", "NOT_F", -1, false, &def_float, &def_void, &def_float }, { "!", "NOT_V", -1, false, &def_vector, &def_void, &def_float }, @@ -160,15 +160,15 @@ opcode_t idCompiler::opcodes[] = { { "", "NEG_V", -1, false, &def_vector, &def_void, &def_vector }, { "int", "INT_F", -1, false, &def_float, &def_void, &def_float }, - + { "", "IF", -1, false, &def_float, &def_jumpoffset, &def_void }, { "", "IFNOT", -1, false, &def_float, &def_jumpoffset, &def_void }, - + // calls returns REG_RETURN { "", "CALL", -1, false, &def_function, &def_argsize, &def_void }, { "", "THREAD", -1, false, &def_function, &def_argsize, &def_void }, { "", "OBJTHREAD", -1, false, &def_function, &def_argsize, &def_void }, - + { "", "PUSH_F", -1, false, &def_float, &def_float, &def_void }, { "", "PUSH_V", -1, false, &def_vector, &def_vector, &def_void }, { "", "PUSH_S", -1, false, &def_string, &def_string, &def_void }, @@ -180,9 +180,9 @@ opcode_t idCompiler::opcodes[] = { { "", "PUSH_FTOB", -1, false, &def_boolean, &def_float, &def_void }, { "", "PUSH_VTOS", -1, false, &def_string, &def_vector, &def_void }, { "", "PUSH_BTOS", -1, false, &def_string, &def_boolean, &def_void }, - + { "", "GOTO", -1, false, &def_jumpoffset, &def_void, &def_void }, - + { "&&", "AND", 7, false, &def_float, &def_float, &def_float }, { "&&", "AND_BOOLF", 7, false, &def_boolean, &def_float, &def_float }, { "&&", "AND_FBOOL", 7, false, &def_float, &def_boolean, &def_float }, @@ -191,7 +191,7 @@ opcode_t idCompiler::opcodes[] = { { "||", "OR_BOOLF", 7, false, &def_boolean, &def_float, &def_float }, { "||", "OR_FBOOL", 7, false, &def_float, &def_boolean, &def_float }, { "||", "OR_BOOLBOOL", 7, false, &def_boolean, &def_boolean, &def_float }, - + { "&", "BITAND", 3, false, &def_float, &def_float, &def_float }, { "|", "BITOR", 3, false, &def_float, &def_float, &def_float }, @@ -289,7 +289,7 @@ ID_INLINE idVarDef *idCompiler::VirtualFunctionConstant( idVarDef *func ) { if ( eval._int < 0 ) { Error( "Function '%s' not found in scope '%s'", func->Name(), func->scope->Name() ); } - + return GetImmediate( &type_virtualfunction, &eval, "" ); } @@ -434,8 +434,8 @@ idVarDef *idCompiler::FindImmediate( const idTypeDef *type, const eval_t *eval, case ev_vector : - if ( ( def->value.vectorPtr->x == eval->vector[ 0 ] ) && - ( def->value.vectorPtr->y == eval->vector[ 1 ] ) && + if ( ( def->value.vectorPtr->x == eval->vector[ 0 ] ) && + ( def->value.vectorPtr->y == eval->vector[ 1 ] ) && ( def->value.vectorPtr->z == eval->vector[ 2 ] ) ) { return def; } @@ -534,7 +534,7 @@ idVarDef *idCompiler::OptimizeOpcode( const opcode_t *op, idVarDef *var_a, idVar case OP_UDIV_F: c._float = Divide( *var_b->value.floatPtr, *var_a->value.floatPtr ); type = &type_float; break; case OP_UMOD_F: c._float = ( int ) *var_b->value.floatPtr % ( int )*var_a->value.floatPtr; type = &type_float; break; case OP_UOR_F: c._float = ( int )*var_b->value.floatPtr | ( int )*var_a->value.floatPtr; type = &type_float; break; - case OP_UAND_F: c._float = ( int )*var_b->value.floatPtr & ( int )*var_a->value.floatPtr; type = &type_float; break; + case OP_UAND_F: c._float = ( int )*var_b->value.floatPtr & ( int )*var_a->value.floatPtr; type = &type_float; break; case OP_UINC_F: c._float = *var_a->value.floatPtr + 1; type = &type_float; break; case OP_UDEC_F: c._float = *var_a->value.floatPtr - 1; type = &type_float; break; case OP_COMP_F: c._float = ( float )~( int )*var_a->value.floatPtr; type = &type_float; break; @@ -583,11 +583,11 @@ idVarDef *idCompiler::EmitOpcode( const opcode_t *op, idVarDef *var_a, idVarDef if ( var_b && !strcmp( var_b->Name(), RESULT_STRING ) ) { var_b->numUsers++; } - + statement = gameLocal.program.AllocStatement(); statement->linenumber = currentLineNumber; - statement->file = currentFileNumber; - + statement->file = currentFileNumber; + if ( ( op->type_c == &def_void ) || op->rightAssociative ) { // ifs, gotos, and assignments don't need vars allocated var_c = NULL; @@ -668,8 +668,8 @@ void idCompiler::NextToken( void ) { immediateType = NULL; memset( &immediate, 0, sizeof( immediate ) ); - // Save the token's line number and filename since when we emit opcodes the current - // token is always the next one to be read + // Save the token's line number and filename since when we emit opcodes the current + // token is always the next one to be read currentLineNumber = token.line; currentFileNumber = gameLocal.program.GetFilenum( parserPtr->GetFileName() ); @@ -788,9 +788,9 @@ bool idCompiler::CheckToken( const char *string ) { if ( token != string ) { return false; } - + NextToken(); - + return true; } @@ -851,7 +851,7 @@ Parses a variable type, including functions types */ idTypeDef *idCompiler::CheckType( void ) { idTypeDef *type; - + if ( token == "float" ) { type = &type_float; } else if ( token == "vector" ) { @@ -876,7 +876,7 @@ idTypeDef *idCompiler::CheckType( void ) { type = NULL; } } - + return type; } @@ -889,7 +889,7 @@ Parses a variable type, including functions types */ idTypeDef *idCompiler::ParseType( void ) { idTypeDef *type; - + type = CheckType(); if ( !type ) { Error( "\"%s\" is not a type", token.c_str() ); @@ -904,7 +904,7 @@ idTypeDef *idCompiler::ParseType( void ) { } NextToken(); - + return type; } @@ -935,8 +935,8 @@ idVarDef *idCompiler::EmitFunctionParms( int op, idVarDef *func, int startarg, i const idTypeDef *funcArg; idVarDef *returnDef; idTypeDef *returnType; - int arg; - int size; + int arg; + int size; int resultOp; type = func->TypeDef(); @@ -968,7 +968,7 @@ idVarDef *idCompiler::EmitFunctionParms( int op, idVarDef *func, int startarg, i arg++; } while( CheckToken( "," ) ); - + ExpectToken( ")" ); } @@ -1199,7 +1199,7 @@ idVarDef *idCompiler::LookupDef( const char *name, const idVarDef *baseobj ) { type_c = field->TypeDef()->ReturnType()->Type(); } else { type_c = field->TypeDef()->FieldType()->Type(); // field access gets type from field - if ( CheckToken( "++" ) ) { + if ( CheckToken( "++" ) ) { if ( type_c != ev_float ) { Error( "Invalid type for ++" ); } @@ -1215,9 +1215,9 @@ idVarDef *idCompiler::LookupDef( const char *name, const idVarDef *baseobj ) { } op = &opcodes[ OP_INDIRECT_F ]; - while( ( op->type_a->Type() != ev_object ) + while( ( op->type_a->Type() != ev_object ) || ( type_b != op->type_b->Type() ) || ( type_c != op->type_c->Type() ) ) { - if ( ( op->priority == FUNCTION_PRIORITY ) && ( op->type_a->Type() == ev_object ) && ( op->type_c->Type() == ev_void ) && + if ( ( op->priority == FUNCTION_PRIORITY ) && ( op->type_a->Type() == ev_object ) && ( op->type_c->Type() == ev_void ) && ( type_c != op->type_c->Type() ) ) { // catches object calls that return a value break; @@ -1256,7 +1256,7 @@ idVarDef *idCompiler::ParseValue( void ) { idVarDef *def; idVarDef *namespaceDef; idStr name; - + if ( immediateType == &type_entity ) { // if an immediate entity ($-prefaced name) then create or lookup a def for it. // when entities are spawned, they'll lookup the def and point it to them. @@ -1303,8 +1303,8 @@ idCompiler::GetTerm */ idVarDef *idCompiler::GetTerm( void ) { idVarDef *e; - int op; - + int op; + if ( !immediateType && CheckToken( "~" ) ) { e = GetExpression( TILDE_PRIORITY ); switch( e->Type() ) { @@ -1399,7 +1399,7 @@ idVarDef *idCompiler::GetTerm( void ) { return EmitOpcode( &opcodes[ op ], e, 0 ); } } - + if ( CheckToken( "int" ) ) { ExpectToken( "(" ); @@ -1412,7 +1412,7 @@ idVarDef *idCompiler::GetTerm( void ) { return EmitOpcode( OP_INT_F, e, 0 ); } - + if ( CheckToken( "thread" ) ) { callthread = true; e = GetExpression( FUNCTION_PRIORITY ); @@ -1425,14 +1425,14 @@ idVarDef *idCompiler::GetTerm( void ) { gameLocal.program.returnDef->SetTypeDef( &type_float ); return gameLocal.program.returnDef; } - + if ( !immediateType && CheckToken( "(" ) ) { e = GetExpression( TOP_PRIORITY ); ExpectToken( ")" ); return e; } - + return ParseValue(); } @@ -1449,7 +1449,7 @@ bool idCompiler::TypeMatches( etype_t type1, etype_t type2 ) const { //if ( ( type1 == ev_entity ) && ( type2 == ev_object ) ) { // return true; //} - + //if ( ( type2 == ev_entity ) && ( type1 == ev_object ) ) { // return true; //} @@ -1468,14 +1468,14 @@ idVarDef *idCompiler::GetExpression( int priority ) { idVarDef *e; idVarDef *e2; const idVarDef *oldtype; - etype_t type_a; - etype_t type_b; - etype_t type_c; - + etype_t type_a; + etype_t type_b; + etype_t type_c; + if ( priority == 0 ) { return GetTerm(); } - + e = GetExpression( priority - 1 ); if ( token == ";" ) { // save us from searching through the opcodes unneccesarily @@ -1536,7 +1536,7 @@ idVarDef *idCompiler::GetExpression( int priority ) { // restore type basetype = oldtype; - + // type check type_a = e->Type(); type_b = e2->Type(); @@ -1582,7 +1582,7 @@ idVarDef *idCompiler::GetExpression( int priority ) { e = ParseObjectCall( e, e2 ); } break; - + case OP_EVENTCALL : ExpectToken( "(" ); if ( ( e2->initialized != idVarDef::uninitialized ) && e2->value.functionPtr->eventdef ) { @@ -1621,7 +1621,7 @@ idVarDef *idCompiler::GetExpression( int priority ) { Error( "type mismatch for '%s'", op->name ); } } - + if ( op->rightAssociative ) { e = EmitOpcode( op, e2, e ); } else { @@ -1675,8 +1675,8 @@ idCompiler::ParseReturnStatement */ void idCompiler::ParseReturnStatement( void ) { idVarDef *e; - etype_t type_a; - etype_t type_b; + etype_t type_a; + etype_t type_b; opcode_t *op; if ( CheckToken( ";" ) ) { @@ -1723,7 +1723,7 @@ void idCompiler::ParseReturnStatement( void ) { } EmitOpcode( OP_RETURN, 0, 0 ); } - + /* ================ idCompiler::ParseWhileStatement @@ -1737,7 +1737,7 @@ void idCompiler::ParseWhileStatement( void ) { loopDepth++; ExpectToken( "(" ); - + patch2 = gameLocal.program.NumStatements(); e = GetExpression( TOP_PRIORITY ); ExpectToken( ")" ); @@ -1748,7 +1748,7 @@ void idCompiler::ParseWhileStatement( void ) { EmitOpcode( OP_GOTO, JumpTo( patch2 ), 0 ); } else { patch1 = gameLocal.program.NumStatements(); - EmitOpcode( OP_IFNOT, e, 0 ); + EmitOpcode( OP_IFNOT, e, 0 ); ParseStatement(); EmitOpcode( OP_GOTO, JumpTo( patch2 ), 0 ); gameLocal.program.GetStatement( patch1 ).b = JumpFrom( patch1 ); @@ -1812,7 +1812,7 @@ void idCompiler::ParseForStatement( void ) { start = gameLocal.program.NumStatements(); ExpectToken( "(" ); - + // init if ( !CheckToken( ";" ) ) { do { @@ -1842,7 +1842,7 @@ void idCompiler::ParseForStatement( void ) { do { GetExpression( TOP_PRIORITY ); } while( CheckToken( "," ) ); - + ExpectToken( ")" ); // goto patch4 @@ -1912,7 +1912,7 @@ void idCompiler::ParseIfStatement( void ) { EmitOpcode( OP_IFNOT, e, 0 ); ParseStatement(); - + if ( CheckToken( "else" ) ) { patch2 = gameLocal.program.NumStatements(); EmitOpcode( OP_GOTO, 0, 0 ); @@ -1941,13 +1941,13 @@ void idCompiler::ParseStatement( void ) { } while( !CheckToken( "}" ) ); return; - } + } if ( CheckToken( "return" ) ) { ParseReturnStatement(); return; } - + if ( CheckToken( "while" ) ) { ParseWhileStatement(); return; @@ -2031,7 +2031,7 @@ void idCompiler::ParseObjectDef( const char *objname ) { Error( "Objects may only inherit from objects." ); } } - + objtype = gameLocal.program.AllocType( ev_object, NULL, objname, parentType == &type_object ? 0 : parentType->Size(), parentType ); objtype->def = gameLocal.program.AllocDef( objtype, objname, scope, true ); scope = objtype->def; @@ -2086,7 +2086,7 @@ parse a function type idTypeDef *idCompiler::ParseFunction( idTypeDef *returnType, const char *name ) { idTypeDef newtype( ev_function, NULL, name, type_function.Size(), returnType ); idTypeDef *type; - + if ( scope->Type() != ev_namespace ) { // create self pointer newtype.AddFunctionParm( scope->TypeDef(), "self" ); @@ -2116,8 +2116,8 @@ void idCompiler::ParseFunctionDef( idTypeDef *returnType, const char *name ) { idVarDef *def; const idVarDef *parm; idVarDef *oldscope; - int i; - int numParms; + int i; + int numParms; const idTypeDef *parmType; function_t *func; statement_t *pos; @@ -2268,7 +2268,7 @@ void idCompiler::ParseVariableDef( idTypeDef *type, const char *name ) { if ( def ) { Error( "%s redeclared", name ); } - + def = gameLocal.program.AllocDef( type, name, scope, false ); // check for an initialization @@ -2386,7 +2386,7 @@ idTypeDef *idCompiler::GetTypeForEventArg( char argType ) { type = NULL; break; } - + return type; } @@ -2399,7 +2399,7 @@ void idCompiler::ParseEventDef( idTypeDef *returnType, const char *name ) { const idTypeDef *expectedType; idTypeDef *argType; idTypeDef *type; - int i; + int i; int num; const char *format; const idEventDef *ev; @@ -2434,7 +2434,7 @@ void idCompiler::ParseEventDef( idTypeDef *returnType, const char *name ) { argType = ParseType(); ParseName( parmName ); if ( argType != expectedType ) { - Error( "The type of parm %d ('%s') does not match the internal type '%s' in definition of '%s' event.", + Error( "The type of parm %d ('%s') does not match the internal type '%s' in definition of '%s' event.", i + 1, parmName.c_str(), expectedType->Name(), name ); } @@ -2483,7 +2483,7 @@ Called at the outer layer and when a local statement is hit ================ */ void idCompiler::ParseDefs( void ) { - idStr name; + idStr name; idTypeDef *type; idVarDef *def; idVarDef *oldscope; @@ -2500,7 +2500,7 @@ void idCompiler::ParseDefs( void ) { ParseEventDef( type, name ); return; } - + ParseName( name ); if ( type == &type_namespace ) { @@ -2586,7 +2586,7 @@ void idCompiler::CompileFile( const char *text, const char *filename, bool toCon immediateType = NULL; currentLineNumber = 0; console = toConsole; - + memset( &immediate, 0, sizeof( immediate ) ); parser.SetFlags( LEXFL_ALLOWMULTICHARLITERALS ); @@ -2624,7 +2624,7 @@ void idCompiler::CompileFile( const char *text, const char *filename, bool toCon ParseNamespace( &def_namespace ); } } - + catch( idCompileError &err ) { idStr error; diff --git a/game/script/Script_Compiler.h b/game/script/Script_Compiler.h index 3e26d8e..f943379 100644 --- a/game/script/Script_Compiler.h +++ b/game/script/Script_Compiler.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -68,7 +68,7 @@ enum { OP_ADD_SV, OP_SUB_F, OP_SUB_V, - + OP_EQ_F, OP_EQ_V, OP_EQ_S, @@ -76,7 +76,7 @@ enum { OP_EQ_EO, OP_EQ_OE, OP_EQ_OO, - + OP_NE_F, OP_NE_V, OP_NE_S, @@ -84,7 +84,7 @@ enum { OP_NE_EO, OP_NE_OE, OP_NE_OO, - + OP_LE, OP_GE, OP_LT, @@ -96,7 +96,7 @@ enum { OP_INDIRECT_ENT, OP_INDIRECT_BOOL, OP_INDIRECT_OBJ, - + OP_ADDRESS, OP_EVENTCALL, @@ -184,7 +184,7 @@ enum { OP_OR_BOOLF, OP_OR_FBOOL, OP_OR_BOOLBOOL, - + OP_BITAND, OP_BITOR, @@ -202,10 +202,10 @@ private: idParser parser; idParser *parserPtr; idToken token; - + idTypeDef *immediateType; eval_t immediate; - + bool eof; bool console; bool callthread; @@ -214,7 +214,7 @@ private: int currentLineNumber; int currentFileNumber; int errorCount; - + idVarDef *scope; // the function being parsed, or NULL const idVarDef *basetype; // for accessing fields diff --git a/game/script/Script_Interpreter.cpp b/game/script/Script_Interpreter.cpp index 04484b3..921ee1c 100644 --- a/game/script/Script_Interpreter.cpp +++ b/game/script/Script_Interpreter.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -170,7 +170,7 @@ void idInterpreter::Reset( void ) { currentFunction = 0; NextInstruction( 0 ); - threadDying = false; + threadDying = false; doneProcessing = true; } @@ -178,7 +178,7 @@ void idInterpreter::Reset( void ) { ================ idInterpreter::GetRegisterValue -Returns a string representation of the value of the register. This is +Returns a string representation of the value of the register. This is used primarily for the debugger and debugging //FIXME: This is pretty much wrong. won't access data in most situations. @@ -195,11 +195,11 @@ bool idInterpreter::GetRegisterValue( const char *name, idStr &out, int scopeDep const function_t *func; out.Empty(); - + if ( scopeDepth == -1 ) { scopeDepth = callStackDepth; - } - + } + if ( scopeDepth == callStackDepth ) { func = currentFunction; } else { @@ -225,14 +225,14 @@ bool idInterpreter::GetRegisterValue( const char *name, idStr &out, int scopeDep if ( !d ) { return false; } - + // Get the variable itself and check various namespaces d = gameLocal.program.GetDef( NULL, name, d ); if ( !d ) { if ( scope == &def_namespace ) { return false; } - + d = gameLocal.program.GetDef( NULL, name, scope ); if ( !d ) { d = gameLocal.program.GetDef( NULL, name, &def_namespace ); @@ -241,7 +241,7 @@ bool idInterpreter::GetRegisterValue( const char *name, idStr &out, int scopeDep } } } - + reg = GetVariable( d ); switch( d->Type() ) { case ev_float: @@ -254,7 +254,7 @@ bool idInterpreter::GetRegisterValue( const char *name, idStr &out, int scopeDep break; case ev_vector: - if ( reg.vectorPtr ) { + if ( reg.vectorPtr ) { out = va( "%g,%g,%g", reg.vectorPtr->x, reg.vectorPtr->y, reg.vectorPtr->z ); } else { out = "0,0,0"; @@ -282,7 +282,7 @@ bool idInterpreter::GetRegisterValue( const char *name, idStr &out, int scopeDep if ( !field || !obj ) { return false; } - + switch ( field->Type() ) { case ev_boolean: out = va( "%d", *( reinterpret_cast( &obj->data[ reg.ptrOffset ] ) ) ); @@ -389,7 +389,7 @@ idInterpreter::StackTrace */ void idInterpreter::StackTrace( void ) const { const function_t *f; - int i; + int i; int top; if ( callStackDepth == 0 ) { @@ -401,7 +401,7 @@ void idInterpreter::StackTrace( void ) const { if ( top >= MAX_STACK_DEPTH ) { top = MAX_STACK_DEPTH - 1; } - + if ( !currentFunction ) { gameLocal.Printf( "\n" ); } else { @@ -552,7 +552,7 @@ NOTE: If this is called from within a event called by this interpreter, the func ==================== */ void idInterpreter::EnterFunction( const function_t *func, bool clearStack ) { - int c; + int c; prstack_t *stack; if ( clearStack ) { @@ -584,10 +584,10 @@ void idInterpreter::EnterFunction( const function_t *func, bool clearStack ) { if ( debug ) { if ( currentFunction ) { - gameLocal.Printf( "%d: call '%s' from '%s'(line %d)%s\n", gameLocal.time, func->Name(), currentFunction->Name(), + gameLocal.Printf( "%d: call '%s' from '%s'(line %d)%s\n", gameLocal.time, func->Name(), currentFunction->Name(), gameLocal.program.GetStatement( instructionPointer ).linenumber, clearStack ? " clear stack" : "" ); } else { - gameLocal.Printf( "%d: call '%s'%s\n", gameLocal.time, func->Name(), clearStack ? " clear stack" : "" ); + gameLocal.Printf( "%d: call '%s'%s\n", gameLocal.time, func->Name(), clearStack ? " clear stack" : "" ); } } @@ -623,7 +623,7 @@ idInterpreter::LeaveFunction void idInterpreter::LeaveFunction( idVarDef *returnDef ) { prstack_t *stack; varEval_t ret; - + if ( callStackDepth <= 0 ) { Error( "prog stack underflow" ); } @@ -662,7 +662,7 @@ void idInterpreter::LeaveFunction( idVarDef *returnDef ) { // up stack callStackDepth--; - stack = &callStack[ callStackDepth ]; + stack = &callStack[ callStackDepth ]; currentFunction = stack->f; localstackBase = stack->stackbase; NextInstruction( stack->s ); @@ -681,11 +681,11 @@ idInterpreter::CallEvent ================ */ void idInterpreter::CallEvent( const function_t *func, int argsize ) { - int i; + int i; int j; varEval_t var; - int pos; - int start; + int pos; + int start; int data[ D_EVENT_MAXARGS ]; const idEventDef *evdef; const char *format; @@ -809,7 +809,7 @@ void idInterpreter::CallEvent( const function_t *func, int argsize ) { idInterpreter::BeginMultiFrameEvent ================ */ -bool idInterpreter::BeginMultiFrameEvent( idEntity *ent, const idEventDef *event ) { +bool idInterpreter::BeginMultiFrameEvent( idEntity *ent, const idEventDef *event ) { if ( eventEntity != ent ) { Error( "idInterpreter::BeginMultiFrameEvent called with wrong entity" ); } @@ -852,11 +852,11 @@ idInterpreter::CallSysEvent ================ */ void idInterpreter::CallSysEvent( const function_t *func, int argsize ) { - int i; + int i; int j; varEval_t source; - int pos; - int start; + int pos; + int start; int data[ D_EVENT_MAXARGS ]; const idEventDef *evdef; const char *format; @@ -939,7 +939,7 @@ bool idInterpreter::Execute( void ) { varEval_t var_c; varEval_t var; statement_t *st; - int runaway; + int runaway; idThread *newThread; float floatVal; idScriptObject *obj; @@ -1007,7 +1007,7 @@ bool idInterpreter::Execute( void ) { CallEvent( st->a->value.functionPtr, st->b->value.argSize ); break; - case OP_OBJECTCALL: + case OP_OBJECTCALL: var_a = GetVariable( st->a ); obj = GetScriptObject( *var_a.entityNumberPtr ); if ( obj ) { @@ -1224,7 +1224,7 @@ bool idInterpreter::Execute( void ) { *var_c.floatPtr = ( *var_a.intPtr != 0 ) && ( *var_b.intPtr != 0 ); break; - case OP_OR: + case OP_OR: var_a = GetVariable( st->a ); var_b = GetVariable( st->b ); var_c = GetVariable( st->c ); @@ -1244,14 +1244,14 @@ bool idInterpreter::Execute( void ) { var_c = GetVariable( st->c ); *var_c.floatPtr = ( *var_a.floatPtr != 0.0f ) || ( *var_b.intPtr != 0 ); break; - + case OP_OR_BOOLBOOL: var_a = GetVariable( st->a ); var_b = GetVariable( st->b ); var_c = GetVariable( st->c ); *var_c.floatPtr = ( *var_a.intPtr != 0 ) || ( *var_b.intPtr != 0 ); break; - + case OP_NOT_BOOL: var_a = GetVariable( st->a ); var_c = GetVariable( st->c ); @@ -1489,7 +1489,7 @@ bool idInterpreter::Execute( void ) { *var_b.entityNumberPtr = *var_a.entityNumberPtr; break; - case OP_STORE_BOOL: + case OP_STORE_BOOL: var_a = GetVariable( st->a ); var_b = GetVariable( st->b ); *var_b.intPtr = *var_a.intPtr; @@ -1603,7 +1603,7 @@ bool idInterpreter::Execute( void ) { *var_b.evalPtr->vectorPtr = *var_a.vectorPtr; } break; - + case OP_STOREP_FTOS: var_b = GetVariable( st->b ); if ( var_b.evalPtr && var_b.evalPtr->stringPtr ) { diff --git a/game/script/Script_Interpreter.h b/game/script/Script_Interpreter.h index 4c30579..add78af 100644 --- a/game/script/Script_Interpreter.h +++ b/game/script/Script_Interpreter.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -29,28 +29,28 @@ If you have questions concerning this license or the applicable additional terms #ifndef __SCRIPT_INTERPRETER_H__ #define __SCRIPT_INTERPRETER_H__ -#define MAX_STACK_DEPTH 64 -#define LOCALSTACK_SIZE 6144 +#define MAX_STACK_DEPTH 64 +#define LOCALSTACK_SIZE 6144 typedef struct prstack_s { - int s; + int s; const function_t *f; - int stackbase; + int stackbase; } prstack_t; class idInterpreter { private: prstack_t callStack[ MAX_STACK_DEPTH ]; - int callStackDepth; - int maxStackDepth; + int callStackDepth; + int maxStackDepth; byte localstack[ LOCALSTACK_SIZE ]; - int localstackUsed; - int localstackBase; - int maxLocalstackUsed; + int localstackUsed; + int localstackBase; + int maxLocalstackUsed; const function_t *currentFunction; - int instructionPointer; + int instructionPointer; int popParms; const idEventDef *multiFrameEvent; diff --git a/game/script/Script_Program.cpp b/game/script/Script_Program.cpp index 2d8a8b9..a2fdefa 100644 --- a/game/script/Script_Program.cpp +++ b/game/script/Script_Program.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -141,7 +141,7 @@ idTypeDef::idTypeDef( etype_t etype, idVarDef *edef, const char *ename, int esiz def = edef; size = esize; auxType = aux; - + parmTypes.SetGranularity( 1 ); parmNames.SetGranularity( 1 ); functions.SetGranularity( 1 ); @@ -724,7 +724,7 @@ void idVarDef::SetString( const char *string, bool constant ) { } else { initialized = initializedVariable; } - + assert( typeDef && ( typeDef->Type() == ev_string ) ); idStr::Copynz( value.stringPtr, string, MAX_STRING_LEN ); } @@ -795,7 +795,7 @@ void idVarDef::PrintInfo( idFile *file, int instructionPointer ) const { break; case ev_float : - file->Printf( "%f", *value.floatPtr ); + file->Printf( "%f", *value.floatPtr ); break; case ev_virtualfunction : @@ -954,7 +954,7 @@ bool idScriptObject::SetType( const char *typeName ) { newtype = gameLocal.program.FindType( typeName ); // only allocate memory if the object type changes - if ( newtype != type ) { + if ( newtype != type ) { Free(); if ( !newtype ) { gameLocal.Warning( "idScriptObject::SetType: Unknown type '%s'", typeName ); @@ -1121,7 +1121,7 @@ idProgram::AllocType idTypeDef *idProgram::AllocType( idTypeDef &type ) { idTypeDef *newtype; - newtype = new idTypeDef( type ); + newtype = new idTypeDef( type ); types.Append( newtype ); return newtype; @@ -1418,7 +1418,7 @@ idProgram::FindFreeResultDef */ idVarDef *idProgram::FindFreeResultDef( idTypeDef *type, const char *name, idVarDef *scope, const idVarDef *a, const idVarDef *b ) { idVarDef *def; - + for( def = GetDefList( name ); def != NULL; def = def->Next() ) { if ( def == a || def == b ) { continue; @@ -1597,7 +1597,7 @@ void idProgram::BeginCompilation( void ) { // make the first statement a return for a "NULL" function statement = AllocStatement(); statement->linenumber = 0; - statement->file = 0; + statement->file = 0; statement->op = OP_RETURN; statement->a = NULL; statement->b = NULL; @@ -1677,7 +1677,7 @@ void idProgram::Disassemble( void ) const { for( instructionPointer = 0; instructionPointer < func->numStatements; instructionPointer++ ) { DisassembleStatement( file, func->firstStatement + instructionPointer ); } - + file->Printf( "}\n" ); } @@ -1792,7 +1792,7 @@ bool idProgram::CompileText( const char *source, const char *text, bool console } } } - + catch( idCompileError &err ) { if ( console ) { gameLocal.Printf( "%s\n", err.error ); @@ -2081,7 +2081,7 @@ void idProgram::Restart( void ) { statements.SetNum( top_statements ); fileList.SetNum( top_files, false ); filename.Clear(); - + // reset the variables to their default values numVariables = variableDefaults.Num(); for( i = 0; i < numVariables; i++ ) { diff --git a/game/script/Script_Program.h b/game/script/Script_Program.h index a82f4f2..e9a04f9 100644 --- a/game/script/Script_Program.h +++ b/game/script/Script_Program.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -58,16 +58,16 @@ public: void Clear( void ); private: - idStr name; + idStr name; public: const idEventDef *eventdef; idVarDef *def; const idTypeDef *type; - int firstStatement; - int numStatements; - int parmTotal; - int locals; // total ints of parms + locals - int filenum; // source file defined in + int firstStatement; + int numStatements; + int parmTotal; + int locals; // total ints of parms + locals + int filenum; // source file defined in idList parmSize; }; @@ -76,8 +76,8 @@ typedef union eval_s { float _float; float vector[ 3 ]; function_t *function; - int _int; - int entity; + int _int; + int entity; } eval_t; /*********************************************************************** @@ -91,7 +91,7 @@ Contains type information for variables and functions. class idTypeDef { private: etype_t type; - idStr name; + idStr name; int size; // function types are more complex @@ -121,7 +121,7 @@ public: int Size( void ) const; idTypeDef *SuperClass( void ) const; - + idTypeDef *ReturnType( void ) const; void SetReturnType( idTypeDef *type ); @@ -153,7 +153,7 @@ In-game representation of objects in scripts. Use the idScriptVariable template class idScriptObject { private: idTypeDef *type; - + public: byte *data; @@ -295,9 +295,9 @@ typedef union varEval_s { float *floatPtr; idVec3 *vectorPtr; function_t *functionPtr; - int *intPtr; + int *intPtr; byte *bytePtr; - int *entityNumberPtr; + int *entityNumberPtr; int virtualFunction; int jumpOffset; int stackOffset; // offset in stack for local variables @@ -314,7 +314,7 @@ class idVarDef { public: int num; varEval_t value; - idVarDef * scope; // function, namespace, or object the var was defined in + idVarDef * scope; // function, namespace, or object the var was defined in int numUsers; // number of users if this is a constant typedef enum { @@ -434,7 +434,7 @@ single idProgram. class idProgram { private: idStrList fileList; - idStr filename; + idStr filename; int filenum; int numVariables; @@ -510,14 +510,14 @@ public: statement_t &GetStatement( int index ); int NumStatements( void ) { return statements.Num(); } - int GetReturnedInteger( void ); + int GetReturnedInteger( void ); void ReturnFloat( float value ); void ReturnInteger( int value ); void ReturnVector( idVec3 const &vec ); void ReturnString( const char *string ); void ReturnEntity( idEntity *ent ); - + int NumFilenames( void ) { return fileList.Num( ); } }; diff --git a/game/script/Script_Thread.cpp b/game/script/Script_Thread.cpp index 62bb45a..e05d181 100644 --- a/game/script/Script_Thread.cpp +++ b/game/script/Script_Thread.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms const idEventDef EV_Thread_Execute( "", NULL ); const idEventDef EV_Thread_SetCallback( "", NULL ); - + // script callable events const idEventDef EV_Thread_TerminateThread( "terminate", "d" ); const idEventDef EV_Thread_Pause( "pause", NULL ); @@ -263,7 +263,7 @@ idThread::idThread */ idThread::idThread( idEntity *self, const function_t *func ) { assert( self ); - + Init(); SetThreadName( self->name ); interpreter.EnterObjectFunction( self, func, false ); @@ -418,7 +418,7 @@ void idThread::Init( void ) { threadNum = threadIndex; threadList.Append( this ); - + creationTime = gameLocal.time; lastExecuteTime = 0; manualControl = false; @@ -455,19 +455,19 @@ idThread::DisplayInfo ================ */ void idThread::DisplayInfo( void ) { - gameLocal.Printf( + gameLocal.Printf( "%12i: '%s'\n" " File: %s(%d)\n" " Created: %d (%d ms ago)\n" - " Status: ", - threadNum, threadName.c_str(), - interpreter.CurrentFile(), interpreter.CurrentLine(), + " Status: ", + threadNum, threadName.c_str(), + interpreter.CurrentFile(), interpreter.CurrentLine(), creationTime, gameLocal.time - creationTime ); if ( interpreter.threadDying ) { gameLocal.Printf( "Dying\n" ); } else if ( interpreter.doneProcessing ) { - gameLocal.Printf( + gameLocal.Printf( "Paused since %d (%d ms)\n" " Reason: ", lastExecuteTime, gameLocal.time - lastExecuteTime ); if ( waitingForThread ) { @@ -913,8 +913,8 @@ void idThread::WaitFrame( void ) { /*********************************************************************** - Script callable events - + Script callable events + ***********************************************************************/ /* @@ -1357,7 +1357,7 @@ void idThread::Event_OnSignal( int signal, idEntity *ent, const char *func ) { if ( !ent ) { Error( "Entity not found" ); } - + if ( ( signal < 0 ) || ( signal >= NUM_SIGNALS ) ) { Error( "Signal out of range" ); } @@ -1379,7 +1379,7 @@ void idThread::Event_ClearSignalThread( int signal, idEntity *ent ) { if ( !ent ) { Error( "Entity not found" ); } - + if ( ( signal < 0 ) || ( signal >= NUM_SIGNALS ) ) { Error( "Signal out of range" ); } @@ -1644,7 +1644,7 @@ void idThread::Event_StrLeft( const char *string, int num ) { /* ================ -idThread::Event_StrRight +idThread::Event_StrRight ================ */ void idThread::Event_StrRight( const char *string, int num ) { @@ -1741,7 +1741,7 @@ void idThread::Event_RadiusDamage( const idVec3 &origin, idEntity *inflictor, id idThread::Event_IsClient ================ */ -void idThread::Event_IsClient( void ) { +void idThread::Event_IsClient( void ) { idThread::ReturnFloat( gameLocal.isClient ); } @@ -1750,7 +1750,7 @@ void idThread::Event_IsClient( void ) { idThread::Event_IsMultiplayer ================ */ -void idThread::Event_IsMultiplayer( void ) { +void idThread::Event_IsMultiplayer( void ) { idThread::ReturnFloat( gameLocal.isMultiplayer ); } @@ -1759,7 +1759,7 @@ void idThread::Event_IsMultiplayer( void ) { idThread::Event_GetFrameTime ================ */ -void idThread::Event_GetFrameTime( void ) { +void idThread::Event_GetFrameTime( void ) { idThread::ReturnFloat( MS2SEC( gameLocal.msec ) ); } @@ -1768,7 +1768,7 @@ void idThread::Event_GetFrameTime( void ) { idThread::Event_GetTicsPerSecond ================ */ -void idThread::Event_GetTicsPerSecond( void ) { +void idThread::Event_GetTicsPerSecond( void ) { idThread::ReturnFloat( USERCMD_HZ ); } diff --git a/game/script/Script_Thread.h b/game/script/Script_Thread.h index d5b2b20..232f6cc 100644 --- a/game/script/Script_Thread.h +++ b/game/script/Script_Thread.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -84,9 +84,9 @@ private: idInterpreter interpreter; idDict spawnArgs; - - int threadNum; - idStr threadName; + + int threadNum; + idStr threadName; int lastExecuteTime; int creationTime; @@ -131,10 +131,10 @@ private: void Event_SpawnFloat( const char *key, float defaultvalue ); void Event_SpawnVector( const char *key, idVec3 &defaultvalue ); void Event_ClearPersistantArgs( void ); - void Event_SetPersistantArg( const char *key, const char *value ); - void Event_GetPersistantString( const char *key ); - void Event_GetPersistantFloat( const char *key ); - void Event_GetPersistantVector( const char *key ); + void Event_SetPersistantArg( const char *key, const char *value ); + void Event_GetPersistantString( const char *key ); + void Event_GetPersistantFloat( const char *key ); + void Event_GetPersistantVector( const char *key ); void Event_AngToForward( idAngles &ang ); void Event_AngToRight( idAngles &ang ); void Event_AngToUp( idAngles &ang ); @@ -165,17 +165,17 @@ private: void Event_StartMusic( const char *name ); void Event_Warning( const char *text ); void Event_Error( const char *text ); - void Event_StrLen( const char *string ); - void Event_StrLeft( const char *string, int num ); - void Event_StrRight( const char *string, int num ); - void Event_StrSkip( const char *string, int num ); - void Event_StrMid( const char *string, int start, int num ); + void Event_StrLen( const char *string ); + void Event_StrLeft( const char *string, int num ); + void Event_StrRight( const char *string, int num ); + void Event_StrSkip( const char *string, int num ); + void Event_StrMid( const char *string, int start, int num ); void Event_StrToFloat( const char *string ); void Event_RadiusDamage( const idVec3 &origin, idEntity *inflictor, idEntity *attacker, idEntity *ignore, const char *damageDefName, float dmgPower ); void Event_IsClient( void ); - void Event_IsMultiplayer( void ); - void Event_GetFrameTime( void ); - void Event_GetTicsPerSecond( void ); + void Event_IsMultiplayer( void ); + void Event_GetFrameTime( void ); + void Event_GetTicsPerSecond( void ); void Event_CacheSoundShader( const char *soundName ); void Event_DebugLine( const idVec3 &color, const idVec3 &start, const idVec3 &end, const float lifetime ); void Event_DebugArrow( const idVec3 &color, const idVec3 &start, const idVec3 &end, const int size, const float lifetime ); @@ -184,9 +184,9 @@ private: void Event_DrawText( const char *text, const idVec3 &origin, float scale, const idVec3 &color, const int align, const float lifetime ); void Event_InfluenceActive( void ); -public: +public: CLASS_PROTOTYPE( idThread ); - + idThread(); idThread( idEntity *self, const function_t *func ); idThread( const function_t *func ); @@ -208,7 +208,7 @@ public: void WaitMS( int time ); void WaitSec( float time ); void WaitFrame( void ); - + // NOTE: If this is called from within a event called by this thread, the function arguments will be invalid after calling this function. void CallFunction( const function_t *func, bool clearStack ); @@ -220,12 +220,12 @@ public: static void ListThreads_f( const idCmdArgs &args ); static void Restart( void ); static void ObjectMoveDone( int threadnum, idEntity *obj ); - + static idList& GetThreads ( void ); - + bool IsDoneProcessing ( void ); - bool IsDying ( void ); - + bool IsDying ( void ); + void End( void ); static void KillThread( const char *name ); static void KillThread( int num ); @@ -244,13 +244,13 @@ public: bool Start( void ); idThread *WaitingOnThread( void ); void SetThreadNum( int num ); - int GetThreadNum( void ); + int GetThreadNum( void ); void SetThreadName( const char *name ); const char *GetThreadName( void ); void Error( const char *fmt, ... ) const id_attribute((format(printf,2,3))); void Warning( const char *fmt, ... ) const id_attribute((format(printf,2,3))); - + static idThread *CurrentThread( void ); static int CurrentThreadNum( void ); static bool BeginMultiFrameEvent( idEntity *ent, const idEventDef *event ); @@ -306,7 +306,7 @@ idThread::GetThreads */ ID_INLINE idList& idThread::GetThreads ( void ) { return threadList; -} +} /* ================ diff --git a/idlib/Base64.cpp b/idlib/Base64.cpp index 1274e3d..ce024b8 100644 --- a/idlib/Base64.cpp +++ b/idlib/Base64.cpp @@ -38,17 +38,17 @@ POSSIBILITY OF SUCH DAMAGE. idBase64::Encode ============ */ -static const char sixtet_to_base64[] = +static const char sixtet_to_base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; void idBase64::Encode( const byte *from, int size ) { int i, j; unsigned long w; byte *to; - + EnsureAlloced( 4*(size+3)/3 + 2 ); // ratio and padding + trailing \0 to = data; - + w = 0; i = 0; while (size > 0) { @@ -71,7 +71,7 @@ void idBase64::Encode( const byte *from, int size ) { i = 0; } } - + *to++ = '\0'; len = to - data; } @@ -99,7 +99,7 @@ int idBase64::Decode( byte *to ) const { static char base64_to_sixtet[256]; static int tab_init = 0; byte *from = data; - + if (!tab_init) { memset( base64_to_sixtet, 0, 256 ); for (i = 0; (j = sixtet_to_base64[i]) != '\0'; ++i) { @@ -161,7 +161,7 @@ void idBase64::Decode( idStr &dest ) const { idBase64::Decode ============ */ -void idBase64::Decode( idFile *dest ) const { +void idBase64::Decode( idFile *dest ) const { byte *buf = new byte[ DecodeLength()+1 ]; // +1 for trailing \0 int out = Decode( buf ); dest->Write( buf, out ); @@ -171,7 +171,7 @@ void idBase64::Decode( idFile *dest ) const { #if 0 void idBase64_TestBase64() { - + idStr src; idBase64 dest; src = "Encode me in base64"; @@ -184,11 +184,11 @@ void idBase64_TestBase64() { src_dict.SetFloat("float", 0.5f); src_dict.SetBool("bool", true); src_dict.Set("value", "foo"); - idFile_Memory src_fmem("serialize_dict"); + idFile_Memory src_fmem("serialize_dict"); src_dict.WriteToFileHandle( &src_fmem ); dest.Encode( (const byte *)src_fmem.GetDataPtr(), src_fmem.Length() ); idLib::common->Printf( "idDict encoded to %s\n", dest.c_str()); - + // now decode to another stream and build back idFile_Memory dest_fmem( "build_back" ); dest.Decode( &dest_fmem ); @@ -197,7 +197,7 @@ void idBase64_TestBase64() { dest_dict.ReadFromFileHandle( &dest_fmem ); idLib::common->Printf( "idDict reconstructed after base64 decode\n"); dest_dict.Print(); - + // test idDict read from file - from python generated files, see idDict.py idFile *file = idLib::fileSystem->OpenFileRead("idDict.test"); if (file) { diff --git a/idlib/Base64.h b/idlib/Base64.h index 9cd6142..632d011 100644 --- a/idlib/Base64.h +++ b/idlib/Base64.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -52,7 +52,7 @@ public: const char *c_str() const; - void operator=( const idStr &s ); + void operator=( const idStr &s ); private: byte * data; diff --git a/idlib/BitMsg.cpp b/idlib/BitMsg.cpp index af28bf2..f6f3b7f 100644 --- a/idlib/BitMsg.cpp +++ b/idlib/BitMsg.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -423,7 +423,7 @@ idBitMsg::ReadString */ int idBitMsg::ReadString( char *buffer, int bufferSize ) const { int l, c; - + ReadByteAlign(); l = 0; while( 1 ) { @@ -444,7 +444,7 @@ int idBitMsg::ReadString( char *buffer, int bufferSize ) const { l++; } } - + buffer[l] = 0; return l; } @@ -482,7 +482,7 @@ idBitMsg::ReadNetadr */ void idBitMsg::ReadNetadr( netadr_t *adr ) const { int i; - + adr->type = NA_IP; for ( i = 0; i < 4; i++ ) { adr->ip[ i ] = ReadByte(); diff --git a/idlib/BitMsg.h b/idlib/BitMsg.h index e162fac..ad727fe 100644 --- a/idlib/BitMsg.h +++ b/idlib/BitMsg.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/CmdArgs.cpp b/idlib/CmdArgs.cpp index 68c55d4..34d2889 100644 --- a/idlib/CmdArgs.cpp +++ b/idlib/CmdArgs.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -195,4 +195,3 @@ const char **idCmdArgs::GetArgs( int *_argc ) { *_argc = argc; return (const char **)&argv[0]; } - diff --git a/idlib/CmdArgs.h b/idlib/CmdArgs.h index df2b8d8..61a32db 100644 --- a/idlib/CmdArgs.h +++ b/idlib/CmdArgs.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/Dict.cpp b/idlib/Dict.cpp index 68f436a..c49a5ca 100644 --- a/idlib/Dict.cpp +++ b/idlib/Dict.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -80,7 +80,7 @@ void idDict::Copy( const idDict &other ) { if ( args.Num() ) { found = (int *) _alloca16( other.args.Num() * sizeof( int ) ); - for ( i = 0; i < n; i++ ) { + for ( i = 0; i < n; i++ ) { found[i] = FindKeyIndex( other.args[i].GetKey() ); } } else { @@ -343,13 +343,13 @@ idDict::GetAngles bool idDict::GetAngles( const char *key, const char *defaultString, idAngles &out ) const { bool found; const char *s; - + if ( !defaultString ) { defaultString = "0 0 0"; } found = GetString( key, defaultString, &s ); - out.Zero(); + out.Zero(); sscanf( s, "%f %f %f", &out.pitch, &out.yaw, &out.roll ); return found; } @@ -362,7 +362,7 @@ idDict::GetVector bool idDict::GetVector( const char *key, const char *defaultString, idVec3 &out ) const { bool found; const char *s; - + if ( !defaultString ) { defaultString = "0 0 0"; } @@ -381,7 +381,7 @@ idDict::GetVec2 bool idDict::GetVec2( const char *key, const char *defaultString, idVec2 &out ) const { bool found; const char *s; - + if ( !defaultString ) { defaultString = "0 0"; } @@ -400,7 +400,7 @@ idDict::GetVec4 bool idDict::GetVec4( const char *key, const char *defaultString, idVec4 &out ) const { bool found; const char *s; - + if ( !defaultString ) { defaultString = "0 0 0 0"; } @@ -419,7 +419,7 @@ idDict::GetMatrix bool idDict::GetMatrix( const char *key, const char *defaultString, idMat3 &out ) const { const char *s; bool found; - + if ( !defaultString ) { defaultString = "1 0 0 0 1 0 0 0 1"; } diff --git a/idlib/Dict.h b/idlib/Dict.h index e751e87..29b9dd3 100644 --- a/idlib/Dict.h +++ b/idlib/Dict.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/Heap.cpp b/idlib/Heap.cpp index a3a8bb0..0aca5c2 100644 --- a/idlib/Heap.cpp +++ b/idlib/Heap.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -65,7 +65,7 @@ public: dword Msize( void *p ); // return size of data block void Dump( void ); - void AllocDefragBlock( void ); // hack for huge renderbumps + void AllocDefragBlock( void ); // hack for huge renderbumps private: @@ -195,7 +195,7 @@ idHeap::~idHeap( void ) { if ( smallCurPage ) { FreePage( smallCurPage ); // free small-heap current allocation page } - p = smallFirstUsedPage; // free small-heap allocated pages + p = smallFirstUsedPage; // free small-heap allocated pages while( p ) { idHeap::page_s *next = p->next; FreePage( p ); @@ -223,7 +223,7 @@ idHeap::~idHeap( void ) { p = next; } - ReleaseSwappedPages(); + ReleaseSwappedPages(); if ( defragBlock ) { free( defragBlock ); @@ -326,7 +326,7 @@ void *idHeap::Allocate16( const dword bytes ) { idLib::common->Printf( "Freeing defragBlock on alloc of %i.\n", bytes ); free( defragBlock ); defragBlock = NULL; - ptr = (byte *) malloc( bytes + 16 + 4 ); + ptr = (byte *) malloc( bytes + 16 + 4 ); AllocDefragBlock(); } if ( !ptr ) { @@ -417,7 +417,7 @@ void idHeap::Dump( void ) { for ( pg = mediumFirstFreePage; pg; pg = pg->next ) { idLib::common->Printf( "%p bytes %-8d (partially used by medium heap)\n", pg->data, pg->dataSize ); } - + for ( pg = largeFirstUsedPage; pg; pg = pg->next ) { idLib::common->Printf( "%p bytes %-8d (fully used by large heap)\n", pg->data, pg->dataSize ); } @@ -481,7 +481,7 @@ idHeap::page_s* idHeap::AllocatePage( dword bytes ) { idLib::common->Printf( "Freeing defragBlock on alloc of %i.\n", size + ALIGN - 1 ); free( defragBlock ); defragBlock = NULL; - p = (idHeap::page_s *) ::malloc( size + ALIGN - 1 ); + p = (idHeap::page_s *) ::malloc( size + ALIGN - 1 ); AllocDefragBlock(); } if ( !p ) { @@ -500,7 +500,7 @@ idHeap::page_s* idHeap::AllocatePage( dword bytes ) { p->next = NULL; pagesAllocated++; - + return p; } @@ -648,7 +648,7 @@ void *idHeap::MediumAllocateFromPage( idHeap::page_s *p, dword sizeNeeded ) { } best->next = nw; best->size -= sizeNeeded; - + p->largestFree = best->size; } else { @@ -713,7 +713,7 @@ void *idHeap::MediumAllocate( dword bytes ) { } mediumFirstFreePage = p; - + p->largestFree = pageSize; p->firstFree = (void *)p->data; @@ -731,7 +731,7 @@ void *idHeap::MediumAllocate( dword bytes ) { data = MediumAllocateFromPage( p, sizeNeeded ); // allocate data from page - // if the page can no longer serve memory, move it away from free list + // if the page can no longer serve memory, move it away from free list // (so that it won't slow down the later alloc queries) // this modification speeds up the pageWalk from O(N) to O(sqrt(N)) // a call to free may swap this page back to the free list @@ -760,7 +760,7 @@ void *idHeap::MediumAllocate( dword bytes ) { } mediumFirstUsedPage = p; return data; - } + } // re-order linked list (so that next malloc query starts from current // matching block) -- this speeds up both the page walks and block walks @@ -824,18 +824,18 @@ void idHeap::MediumFree( void *ptr ) { p->largestFree = e->size; e->freeBlock = 1; // mark block as free } - + mediumHeapEntry_s *next = e->next; // if the next block is free we can merge if ( next && next->freeBlock ) { e->size += next->size; e->next = next->next; - + if ( next->next ) { next->next->prev = e; } - + if ( next->prevFree ) { next->prevFree->nextFree = next->nextFree; } @@ -868,7 +868,7 @@ void idHeap::MediumFree( void *ptr ) { if ( e->nextFree ) { e->nextFree->prevFree = e->prevFree; } - + e->nextFree = (mediumHeapEntry_s *)p->firstFree; e->prevFree = NULL; if ( e->nextFree ) { @@ -901,7 +901,7 @@ void idHeap::MediumFree( void *ptr ) { if ( !mediumFirstFreePage ) { mediumFirstFreePage = p; } - } + } } //=============================================================== @@ -1096,7 +1096,7 @@ void Mem_Free( void *ptr ) { return; } Mem_UpdateFreeStats( mem_heap->Msize( ptr ) ); - mem_heap->Free( ptr ); + mem_heap->Free( ptr ); } /* @@ -1138,7 +1138,7 @@ void Mem_Free16( void *ptr ) { } // make sure the memory is 16 byte aligned assert( ( ((int)ptr) & 15) == 0 ); - mem_heap->Free16( ptr ); + mem_heap->Free16( ptr ); } /* @@ -1168,7 +1168,7 @@ Mem_CopyString */ char *Mem_CopyString( const char *in ) { char *out; - + out = (char *)Mem_Alloc( strlen(in) + 1 ); strcpy( out, in ); return out; @@ -1647,10 +1647,10 @@ void Mem_FreeDebugMemory( void *p, const char *fileName, const int lineNumber, c idLib::sys->GetCallStack( m->callStack, MAX_CALLSTACK_DEPTH ); if ( align16 ) { - mem_heap->Free16( m ); + mem_heap->Free16( m ); } else { - mem_heap->Free( m ); + mem_heap->Free( m ); } } @@ -1725,7 +1725,7 @@ Mem_CopyString */ char *Mem_CopyString( const char *in, const char *fileName, const int lineNumber ) { char *out; - + out = (char *)Mem_Alloc( strlen(in) + 1, fileName, lineNumber ); strcpy( out, in ); return out; diff --git a/idlib/Heap.h b/idlib/Heap.h index 11ea4d5..f02d3b5 100644 --- a/idlib/Heap.h +++ b/idlib/Heap.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -37,7 +37,7 @@ If you have questions concerning this license or the applicable additional terms This is a replacement for the compiler heap code (i.e. "C" malloc() and free() calls). On average 2.5-3.0 times faster than MSVC malloc()/free(). Worst case performance is 1.65 times faster and best case > 70 times. - + =============================================================================== */ diff --git a/idlib/LangDict.cpp b/idlib/LangDict.cpp index 9c06d91..426d909 100644 --- a/idlib/LangDict.cpp +++ b/idlib/LangDict.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -67,11 +67,11 @@ idLangDict::Load ============ */ bool idLangDict::Load( const char *fileName, bool clear /* _D3XP */ ) { - + if ( clear ) { Clear(); } - + const char *buffer = NULL; idLexer src( LEXFL_NOFATALERRORS | LEXFL_NOSTRINGCONCAT | LEXFL_ALLOWMULTICHARLITERALS | LEXFL_ALLOWBACKSLASHSTRINGCONCAT ); @@ -104,7 +104,7 @@ bool idLangDict::Load( const char *fileName, bool clear /* _D3XP */ ) { } idLib::common->Printf( "%i strings read from %s\n", args.Num(), fileName ); idLib::fileSystem->FreeFile( (void*)buffer ); - + return true; } @@ -172,7 +172,7 @@ idLangDict::AddString ============ */ const char *idLangDict::AddString( const char *str ) { - + if ( ExcludeString( str ) ) { return str; } @@ -263,7 +263,7 @@ bool idLangDict::ExcludeString( const char *str ) const { if ( i == c ) { return true; } - + return false; } diff --git a/idlib/LangDict.h b/idlib/LangDict.h index eccb181..a1cd1f5 100644 --- a/idlib/LangDict.h +++ b/idlib/LangDict.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/Lexer.cpp b/idlib/Lexer.cpp index c34676c..9916522 100644 --- a/idlib/Lexer.cpp +++ b/idlib/Lexer.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -1385,7 +1385,7 @@ const char *idLexer::ParseBracedSectionExact( idStr &out, int tabs ) { } out = "{"; - depth = 1; + depth = 1; skipWhite = false; doTabs = tabs >= 0; @@ -1416,7 +1416,7 @@ const char *idLexer::ParseBracedSectionExact( idStr &out, int tabs ) { case '}': { depth--; tabs--; - break; + break; } } @@ -1598,7 +1598,7 @@ int idLexer::LoadFile( const char *filename, bool OSPath ) { idLib::common->Error("idLexer::LoadFile: another script already loaded"); return false; } - + if ( !OSPath && ( baseFolder[0] != '\0' ) ) { pathname = va( "%s/%s", baseFolder, filename ); } else { @@ -1794,4 +1794,3 @@ idLexer::HadError bool idLexer::HadError( void ) const { return hadError; } - diff --git a/idlib/Lexer.h b/idlib/Lexer.h index c0e4d16..ba56b15 100644 --- a/idlib/Lexer.h +++ b/idlib/Lexer.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -37,7 +37,7 @@ If you have questions concerning this license or the applicable additional terms Does not use memory allocation during parsing. The lexer uses no memory allocation if a source is loaded with LoadMemory(). However, idToken may still allocate memory for large strings. - + A number directly following the escape character '\' in a string is assumed to be in decimal format instead of octal. Binary numbers of the form 0b.. or 0B.. can also be used. @@ -182,7 +182,7 @@ public: void UnreadToken( const idToken *token ); // read a token only if on the same line int ReadTokenOnLine( idToken *token ); - + //Returns the rest of the current line const char* ReadRestOfLine(idStr& out); @@ -304,4 +304,3 @@ ID_INLINE int idLexer::GetFlags( void ) { } #endif /* !__LEXER_H__ */ - diff --git a/idlib/Lib.cpp b/idlib/Lib.cpp index 4bfe202..08b7e43 100644 --- a/idlib/Lib.cpp +++ b/idlib/Lib.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -169,12 +169,12 @@ UnpackColor void UnpackColor( const dword color, idVec4 &unpackedColor ) { #if defined(_WIN32) || defined(__linux__) || (defined(MACOS_X) && defined(__i386__)) unpackedColor.Set( ( ( color >> 0 ) & 255 ) * ( 1.0f / 255.0f ), - ( ( color >> 8 ) & 255 ) * ( 1.0f / 255.0f ), + ( ( color >> 8 ) & 255 ) * ( 1.0f / 255.0f ), ( ( color >> 16 ) & 255 ) * ( 1.0f / 255.0f ), ( ( color >> 24 ) & 255 ) * ( 1.0f / 255.0f ) ); #elif (defined(MACOS_X) && defined(__ppc__)) unpackedColor.Set( ( ( color >> 24 ) & 255 ) * ( 1.0f / 255.0f ), - ( ( color >> 16 ) & 255 ) * ( 1.0f / 255.0f ), + ( ( color >> 16 ) & 255 ) * ( 1.0f / 255.0f ), ( ( color >> 8 ) & 255 ) * ( 1.0f / 255.0f ), ( ( color >> 0 ) & 255 ) * ( 1.0f / 255.0f ) ); #else @@ -211,7 +211,7 @@ UnpackColor void UnpackColor( const dword color, idVec3 &unpackedColor ) { #if defined(_WIN32) || defined(__linux__) || (defined(MACOS_X) && defined(__i386__)) unpackedColor.Set( ( ( color >> 0 ) & 255 ) * ( 1.0f / 255.0f ), - ( ( color >> 8 ) & 255 ) * ( 1.0f / 255.0f ), + ( ( color >> 8 ) & 255 ) * ( 1.0f / 255.0f ), ( ( color >> 16 ) & 255 ) * ( 1.0f / 255.0f ) ); #elif (defined(MACOS_X) && defined(__ppc__)) unpackedColor.Set( ( ( color >> 16 ) & 255 ) * ( 1.0f / 255.0f ), @@ -346,8 +346,8 @@ float FloatSwap( float f ) { float f; byte b[4]; } dat1, dat2; - - + + dat1.f = f; dat2.b[0] = dat1.b[3]; dat2.b[1] = dat1.b[2]; @@ -412,22 +412,22 @@ void RevBytesSwap( void *bp, int elsize, int elcount ) { /* ===================================================================== RevBytesSwap - + Reverses byte order in place, then reverses bits in those bytes - + INPUTS bp bitfield structure to reverse elsize size of the underlying data type - + RESULTS Reverses the bitfield of size elsize. ===================================================================== */ void RevBitFieldSwap( void *bp, int elsize) { int i; unsigned char *p, t, v; - + LittleRevBytes( bp, elsize, 1 ); - + p = (unsigned char *) bp; while ( elsize-- ) { v = *p; @@ -525,7 +525,7 @@ Swap_Init void Swap_Init( void ) { byte swaptest[2] = {1,0}; - // set the byte swapping variables in a portable manner + // set the byte swapping variables in a portable manner if ( *(short *)swaptest == 1) { // little endian ex: x86 _BigShort = ShortSwap; diff --git a/idlib/Lib.h b/idlib/Lib.h index 9261ad9..0a013c7 100644 --- a/idlib/Lib.h +++ b/idlib/Lib.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -58,7 +58,7 @@ public: static void Init( void ); static void ShutDown( void ); - // wrapper to idCommon functions + // wrapper to idCommon functions static void Error( const char *fmt, ... ); static void Warning( const char *fmt, ... ); }; diff --git a/idlib/MapFile.cpp b/idlib/MapFile.cpp index 646ce0b..fe896f0 100644 --- a/idlib/MapFile.cpp +++ b/idlib/MapFile.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -362,7 +362,7 @@ idMapBrush *idMapBrush::Parse( idLexer &src, const idVec3 &origin, bool newForma return NULL; } side->origin = origin; - + // read the material if ( !src.ReadTokenOnLine( &token ) ) { src.Error( "idMapBrush::Parse: unable to read brush side material" ); @@ -457,7 +457,7 @@ idMapBrush *idMapBrush::ParseQ3( idLexer &src, const idVec3 &origin ) { side->texMat[0] = idVec3( 0.03125f, 0.0f, 0.0f ); side->texMat[1] = idVec3( 0.0f, 0.03125f, 0.0f ); side->origin = origin; - + // Q2 allowed override of default flags and values, but we don't any more if ( src.ReadTokenOnLine( &token ) ) { if ( src.ReadTokenOnLine( &token ) ) { diff --git a/idlib/MapFile.h b/idlib/MapFile.h index 4f6b62e..ba5d357 100644 --- a/idlib/MapFile.h +++ b/idlib/MapFile.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/Parser.cpp b/idlib/Parser.cpp index 9a52cee..927e3d3 100644 --- a/idlib/Parser.cpp +++ b/idlib/Parser.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -628,7 +628,7 @@ void idParser::AddBuiltinDefines( void ) { char *string; int id; } builtin[] = { - { "__LINE__", BUILTIN_LINE }, + { "__LINE__", BUILTIN_LINE }, { "__FILE__", BUILTIN_FILE }, { "__DATE__", BUILTIN_DATE }, { "__TIME__", BUILTIN_TIME }, @@ -838,7 +838,7 @@ int idParser::ExpandDefine( idToken *deftoken, define_t *define, idToken **first // add the token to the list t->next = NULL; // the token being read from the define list should use the line number of -// the original file, not the header file +// the original file, not the header file t->line = deftoken->line; if ( last ) last->next = t; @@ -918,7 +918,7 @@ int idParser::ReadLine( idToken *token ) { if (!idParser::ReadSourceToken( token )) { return false; } - + if (token->linesCrossed > crossline) { idParser::UnreadSourceToken( token ); return false; @@ -1524,7 +1524,7 @@ int idParser::EvaluateTokens( idToken *tokens, signed long int *intvalue, double break; } } - + case P_MUL: case P_DIV: case P_MOD: @@ -2933,19 +2933,19 @@ void idParser::GetStringFromMarker( idStr& out, bool clean ) { if ( marker_p == NULL ) { marker_p = scriptstack->buffer; } - + if ( tokens ) { p = (char*)tokens->whiteSpaceStart_p; } else { p = (char*)scriptstack->script_p; } - + // Set the end character to NULL to give us a complete string save = *p; *p = 0; - + // If cleaning then reparse - if ( clean ) { + if ( clean ) { idParser temp( marker_p, strlen( marker_p ), "temp", flags ); idToken token; while ( temp.ReadToken ( &token ) ) { @@ -2954,9 +2954,9 @@ void idParser::GetStringFromMarker( idStr& out, bool clean ) { } else { out = marker_p; } - + // restore the character we set to NULL - *p = save; + *p = save; } /* @@ -3249,4 +3249,3 @@ idParser::~idParser idParser::~idParser( void ) { idParser::FreeSource( false ); } - diff --git a/idlib/Parser.h b/idlib/Parser.h index 8d69c2f..6843b05 100644 --- a/idlib/Parser.h +++ b/idlib/Parser.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/Str.cpp b/idlib/Str.cpp index 896604b..bc54504 100644 --- a/idlib/Str.cpp +++ b/idlib/Str.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -242,7 +242,7 @@ Several metacharacter may be used in the filter. * match any string of zero or more characters ? match any single character [abc...] match any of the enclosed characters; a hyphen can - be used to specify a range (e.g. a-z, A-Z, 0-9) + be used to specify a range (e.g. a-z, A-Z, 0-9) ============ */ @@ -451,7 +451,7 @@ returns -1 if not found otherwise the index of the char */ int idStr::Last( const char c ) const { int i; - + for( i = Length(); i > 0; i-- ) { if ( data[ i - 1 ] == c ) { return i - 1; @@ -514,7 +514,7 @@ idStr::StripTrailing */ void idStr::StripTrailing( const char c ) { int i; - + for( i = Length(); i > 0 && data[ i - 1 ] == c; i-- ) { data[ i - 1 ] = '\0'; len--; @@ -647,7 +647,7 @@ idStr::StripTrailingWhitespace */ void idStr::StripTrailingWhitespace( void ) { int i; - + // cast to unsigned char to prevent stripping off high-ASCII characters for( i = Length(); i > 0 && (unsigned char)(data[ i - 1 ]) <= ' '; i-- ) { data[ i - 1 ] = '\0'; @@ -668,7 +668,7 @@ idStr& idStr::StripQuotes ( void ) { return *this; } - + // Remove the trailing quote first if ( data[len-1] == '\"' ) { @@ -677,10 +677,10 @@ idStr& idStr::StripQuotes ( void ) } // Strip the leading quote now - len--; + len--; memmove( &data[ 0 ], &data[ 1 ], len ); data[len] = '\0'; - + return *this; } @@ -1030,21 +1030,21 @@ bool idStr::HasLower( const char *s ) { if ( !s ) { return false; } - + while ( *s ) { if ( CharIsLower( *s ) ) { return true; } s++; } - + return false; } /* ============ idStr::HasUpper - + Checks if a string has any uppercase chars ============ */ @@ -1052,14 +1052,14 @@ bool idStr::HasUpper( const char *s ) { if ( !s ) { return false; } - + while ( *s ) { if ( CharIsUpper( *s ) ) { return true; } s++; } - + return false; } @@ -1369,7 +1369,7 @@ int idStr::IcmpnPath( const char *s1, const char *s2, int n ) { /* ============= idStr::Copynz - + Safe strncpy that ensures a trailing zero ============= */ @@ -1379,12 +1379,12 @@ void idStr::Copynz( char *dest, const char *src, int destsize ) { return; } if ( destsize < 1 ) { - idLib::common->Warning( "idStr::Copynz: destsize < 1" ); + idLib::common->Warning( "idStr::Copynz: destsize < 1" ); return; } strncpy( dest, src, destsize-1 ); - dest[destsize-1] = 0; + dest[destsize-1] = 0; } /* @@ -1446,7 +1446,7 @@ char *idStr::RemoveColors( char *string ) { while( (c = *s) != 0 ) { if ( idStr::IsColor( s ) ) { s++; - } + } else { *d++ = c; } @@ -1492,7 +1492,7 @@ C99 standard: vsnprintf returns the number of characters (excluding the trailing snprintf and vsnprintf do not write more than size bytes (including the trailing '\0') win32: _vsnprintf returns the number of characters written, not including the terminating null character, -or a negative value if an output error occurs. If the number of characters to write exceeds count, then count +or a negative value if an output error occurs. If the number of characters to write exceeds count, then count characters are written and -1 is returned and no trailing '\0' is added. idStr::vsnPrintf: always appends a trailing '\0', returns number of characters written (not including terminal \0) @@ -1529,7 +1529,7 @@ int sprintf( idStr &string, const char *fmt, ... ) { int l; va_list argptr; char buffer[32000]; - + va_start( argptr, fmt ); l = idStr::vsnPrintf( buffer, sizeof(buffer)-1, fmt, argptr ); va_end( argptr ); @@ -1549,10 +1549,10 @@ Sets the value of the string using a vprintf interface. int vsprintf( idStr &string, const char *fmt, va_list argptr ) { int l; char buffer[32000]; - + l = idStr::vsnPrintf( buffer, sizeof(buffer)-1, fmt, argptr ); buffer[sizeof(buffer)-1] = '\0'; - + string = buffer; return l; } @@ -1610,7 +1610,7 @@ void idStr::SetUnit( const char *format, float value, int unit, Measure_t measur value /= 1 << ( unit * 10 ); sprintf( *this, format, value ); *this += " "; - *this += units[ measure ][ unit ]; + *this += units[ measure ][ unit ]; } /* @@ -1740,4 +1740,3 @@ idStr idStr::FormatNumber( int number ) { return string; } - diff --git a/idlib/Str.h b/idlib/Str.h index cc8f258..ec87944 100644 --- a/idlib/Str.h +++ b/idlib/Str.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/Timer.cpp b/idlib/Timer.cpp index 57733ec..51a3fe0 100644 --- a/idlib/Timer.cpp +++ b/idlib/Timer.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/Timer.h b/idlib/Timer.h index 3d69295..39110c6 100644 --- a/idlib/Timer.h +++ b/idlib/Timer.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/Token.cpp b/idlib/Token.cpp index f156013..73fd163 100644 --- a/idlib/Token.cpp +++ b/idlib/Token.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/Token.h b/idlib/Token.h index c369a5e..af6df0c 100644 --- a/idlib/Token.h +++ b/idlib/Token.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/bv/Bounds.cpp b/idlib/bv/Bounds.cpp index 160fda5..10207ce 100644 --- a/idlib/bv/Bounds.cpp +++ b/idlib/bv/Bounds.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -133,43 +133,43 @@ idBounds::LineIntersection ============ */ bool idBounds::LineIntersection( const idVec3 &start, const idVec3 &end ) const { - float ld[3]; + float ld[3]; idVec3 center = ( b[0] + b[1] ) * 0.5f; idVec3 extents = b[1] - center; - idVec3 lineDir = 0.5f * ( end - start ); - idVec3 lineCenter = start + lineDir; - idVec3 dir = lineCenter - center; + idVec3 lineDir = 0.5f * ( end - start ); + idVec3 lineCenter = start + lineDir; + idVec3 dir = lineCenter - center; - ld[0] = idMath::Fabs( lineDir[0] ); + ld[0] = idMath::Fabs( lineDir[0] ); if ( idMath::Fabs( dir[0] ) > extents[0] + ld[0] ) { - return false; + return false; } - ld[1] = idMath::Fabs( lineDir[1] ); + ld[1] = idMath::Fabs( lineDir[1] ); if ( idMath::Fabs( dir[1] ) > extents[1] + ld[1] ) { - return false; + return false; } - ld[2] = idMath::Fabs( lineDir[2] ); + ld[2] = idMath::Fabs( lineDir[2] ); if ( idMath::Fabs( dir[2] ) > extents[2] + ld[2] ) { - return false; + return false; } - idVec3 cross = lineDir.Cross( dir ); + idVec3 cross = lineDir.Cross( dir ); if ( idMath::Fabs( cross[0] ) > extents[1] * ld[2] + extents[2] * ld[1] ) { - return false; + return false; } if ( idMath::Fabs( cross[1] ) > extents[0] * ld[2] + extents[2] * ld[0] ) { - return false; + return false; } if ( idMath::Fabs( cross[2] ) > extents[0] * ld[1] + extents[1] * ld[0] ) { - return false; + return false; } - return true; + return true; } /* diff --git a/idlib/bv/Bounds.h b/idlib/bv/Bounds.h index 96e93a4..5fb97cc 100644 --- a/idlib/bv/Bounds.h +++ b/idlib/bv/Bounds.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/bv/Box.cpp b/idlib/bv/Box.cpp index f616c94..28acecf 100644 --- a/idlib/bv/Box.cpp +++ b/idlib/bv/Box.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -32,19 +32,19 @@ If you have questions concerning this license or the applicable additional terms idBox box_zero( vec3_zero, vec3_zero, mat3_identity ); /* - 4---{4}---5 + 4---{4}---5 + /| /| Z {7} {8} {5} | - / | / {9} - 7--{6}----6 | - | | | | - {11} 0---|-{0}-1 - | / | / - - | {3} {10} {1} Y - |/ |/ + - 3---{2}---2 + 7--{6}----6 | + | | | | + {11} 0---|-{0}-1 + | / | / - + | {3} {10} {1} Y + |/ |/ + + 3---{2}---2 - - X + + - X + plane bits: 0 = min x @@ -374,158 +374,158 @@ idBox::IntersectsBox ============ */ bool idBox::IntersectsBox( const idBox &a ) const { - idVec3 dir; // vector between centers - float c[3][3]; // matrix c = axis.Transpose() * a.axis - float ac[3][3]; // absolute values of c - float axisdir[3]; // axis[i] * dir - float d, e0, e1; // distance between centers and projected extents + idVec3 dir; // vector between centers + float c[3][3]; // matrix c = axis.Transpose() * a.axis + float ac[3][3]; // absolute values of c + float axisdir[3]; // axis[i] * dir + float d, e0, e1; // distance between centers and projected extents dir = a.center - center; - - // axis C0 + t * A0 - c[0][0] = axis[0] * a.axis[0]; - c[0][1] = axis[0] * a.axis[1]; - c[0][2] = axis[0] * a.axis[2]; - axisdir[0] = axis[0] * dir; - ac[0][0] = idMath::Fabs( c[0][0] ); - ac[0][1] = idMath::Fabs( c[0][1] ); - ac[0][2] = idMath::Fabs( c[0][2] ); - d = idMath::Fabs( axisdir[0] ); + // axis C0 + t * A0 + c[0][0] = axis[0] * a.axis[0]; + c[0][1] = axis[0] * a.axis[1]; + c[0][2] = axis[0] * a.axis[2]; + axisdir[0] = axis[0] * dir; + ac[0][0] = idMath::Fabs( c[0][0] ); + ac[0][1] = idMath::Fabs( c[0][1] ); + ac[0][2] = idMath::Fabs( c[0][2] ); + + d = idMath::Fabs( axisdir[0] ); e0 = extents[0]; - e1 = a.extents[0] * ac[0][0] + a.extents[1] * ac[0][1] + a.extents[2] * ac[0][2]; + e1 = a.extents[0] * ac[0][0] + a.extents[1] * ac[0][1] + a.extents[2] * ac[0][2]; if ( d > e0 + e1 ) { - return false; + return false; } - // axis C0 + t * A1 - c[1][0] = axis[1] * a.axis[0]; - c[1][1] = axis[1] * a.axis[1]; - c[1][2] = axis[1] * a.axis[2]; - axisdir[1] = axis[1] * dir; - ac[1][0] = idMath::Fabs( c[1][0] ); - ac[1][1] = idMath::Fabs( c[1][1] ); - ac[1][2] = idMath::Fabs( c[1][2] ); + // axis C0 + t * A1 + c[1][0] = axis[1] * a.axis[0]; + c[1][1] = axis[1] * a.axis[1]; + c[1][2] = axis[1] * a.axis[2]; + axisdir[1] = axis[1] * dir; + ac[1][0] = idMath::Fabs( c[1][0] ); + ac[1][1] = idMath::Fabs( c[1][1] ); + ac[1][2] = idMath::Fabs( c[1][2] ); - d = idMath::Fabs( axisdir[1] ); + d = idMath::Fabs( axisdir[1] ); e0 = extents[1]; - e1 = a.extents[0] * ac[1][0] + a.extents[1] * ac[1][1] + a.extents[2] * ac[1][2]; + e1 = a.extents[0] * ac[1][0] + a.extents[1] * ac[1][1] + a.extents[2] * ac[1][2]; if ( d > e0 + e1 ) { - return false; + return false; } - // axis C0 + t * A2 - c[2][0] = axis[2] * a.axis[0]; - c[2][1] = axis[2] * a.axis[1]; - c[2][2] = axis[2] * a.axis[2]; - axisdir[2] = axis[2] * dir; - ac[2][0] = idMath::Fabs( c[2][0] ); - ac[2][1] = idMath::Fabs( c[2][1] ); - ac[2][2] = idMath::Fabs( c[2][2] ); + // axis C0 + t * A2 + c[2][0] = axis[2] * a.axis[0]; + c[2][1] = axis[2] * a.axis[1]; + c[2][2] = axis[2] * a.axis[2]; + axisdir[2] = axis[2] * dir; + ac[2][0] = idMath::Fabs( c[2][0] ); + ac[2][1] = idMath::Fabs( c[2][1] ); + ac[2][2] = idMath::Fabs( c[2][2] ); - d = idMath::Fabs( axisdir[2] ); + d = idMath::Fabs( axisdir[2] ); e0 = extents[2]; - e1 = a.extents[0] * ac[2][0] + a.extents[1] * ac[2][1] + a.extents[2] * ac[2][2]; + e1 = a.extents[0] * ac[2][0] + a.extents[1] * ac[2][1] + a.extents[2] * ac[2][2]; if ( d > e0 + e1 ) { - return false; + return false; } - // axis C0 + t * B0 - d = idMath::Fabs( a.axis[0] * dir ); - e0 = extents[0] * ac[0][0] + extents[1] * ac[1][0] + extents[2] * ac[2][0]; + // axis C0 + t * B0 + d = idMath::Fabs( a.axis[0] * dir ); + e0 = extents[0] * ac[0][0] + extents[1] * ac[1][0] + extents[2] * ac[2][0]; e1 = a.extents[0]; if ( d > e0 + e1 ) { - return false; + return false; } - // axis C0 + t * B1 - d = idMath::Fabs( a.axis[1] * dir ); - e0 = extents[0] * ac[0][1] + extents[1] * ac[1][1] + extents[2] * ac[2][1]; + // axis C0 + t * B1 + d = idMath::Fabs( a.axis[1] * dir ); + e0 = extents[0] * ac[0][1] + extents[1] * ac[1][1] + extents[2] * ac[2][1]; e1 = a.extents[1]; if ( d > e0 + e1 ) { - return false; + return false; } - // axis C0 + t * B2 - d = idMath::Fabs( a.axis[2] * dir ); - e0 = extents[0] * ac[0][2] + extents[1] * ac[1][2] + extents[2] * ac[2][2]; + // axis C0 + t * B2 + d = idMath::Fabs( a.axis[2] * dir ); + e0 = extents[0] * ac[0][2] + extents[1] * ac[1][2] + extents[2] * ac[2][2]; e1 = a.extents[2]; if ( d > e0 + e1 ) { - return false; + return false; } - // axis C0 + t * A0xB0 - d = idMath::Fabs( axisdir[2] * c[1][0] - axisdir[1] * c[2][0] ); - e0 = extents[1] * ac[2][0] + extents[2] * ac[1][0]; - e1 = a.extents[1] * ac[0][2] + a.extents[2] * ac[0][1]; + // axis C0 + t * A0xB0 + d = idMath::Fabs( axisdir[2] * c[1][0] - axisdir[1] * c[2][0] ); + e0 = extents[1] * ac[2][0] + extents[2] * ac[1][0]; + e1 = a.extents[1] * ac[0][2] + a.extents[2] * ac[0][1]; if ( d > e0 + e1 ) { - return false; + return false; } - // axis C0 + t * A0xB1 - d = idMath::Fabs( axisdir[2] * c[1][1] - axisdir[1] * c[2][1] ); - e0 = extents[1] * ac[2][1] + extents[2] * ac[1][1]; - e1 = a.extents[0] * ac[0][2] + a.extents[2] * ac[0][0]; + // axis C0 + t * A0xB1 + d = idMath::Fabs( axisdir[2] * c[1][1] - axisdir[1] * c[2][1] ); + e0 = extents[1] * ac[2][1] + extents[2] * ac[1][1]; + e1 = a.extents[0] * ac[0][2] + a.extents[2] * ac[0][0]; if ( d > e0 + e1 ) { - return false; + return false; } - // axis C0 + t * A0xB2 - d = idMath::Fabs( axisdir[2] * c[1][2] - axisdir[1] * c[2][2] ); - e0 = extents[1] * ac[2][2] + extents[2] * ac[1][2]; - e1 = a.extents[0] * ac[0][1] + a.extents[1] * ac[0][0]; - if ( d > e0 + e1 ) { - return false; - } - - // axis C0 + t * A1xB0 - d = idMath::Fabs( axisdir[0] * c[2][0] - axisdir[2] * c[0][0] ); - e0 = extents[0] * ac[2][0] + extents[2] * ac[0][0]; - e1 = a.extents[1] * ac[1][2] + a.extents[2] * ac[1][1]; + // axis C0 + t * A0xB2 + d = idMath::Fabs( axisdir[2] * c[1][2] - axisdir[1] * c[2][2] ); + e0 = extents[1] * ac[2][2] + extents[2] * ac[1][2]; + e1 = a.extents[0] * ac[0][1] + a.extents[1] * ac[0][0]; if ( d > e0 + e1 ) { - return false; + return false; } - // axis C0 + t * A1xB1 - d = idMath::Fabs( axisdir[0] * c[2][1] - axisdir[2] * c[0][1] ); - e0 = extents[0] * ac[2][1] + extents[2] * ac[0][1]; - e1 = a.extents[0] * ac[1][2] + a.extents[2] * ac[1][0]; + // axis C0 + t * A1xB0 + d = idMath::Fabs( axisdir[0] * c[2][0] - axisdir[2] * c[0][0] ); + e0 = extents[0] * ac[2][0] + extents[2] * ac[0][0]; + e1 = a.extents[1] * ac[1][2] + a.extents[2] * ac[1][1]; if ( d > e0 + e1 ) { - return false; + return false; } - // axis C0 + t * A1xB2 - d = idMath::Fabs( axisdir[0] * c[2][2] - axisdir[2] * c[0][2] ); - e0 = extents[0] * ac[2][2] + extents[2] * ac[0][2]; - e1 = a.extents[0] * ac[1][1] + a.extents[1] * ac[1][0]; + // axis C0 + t * A1xB1 + d = idMath::Fabs( axisdir[0] * c[2][1] - axisdir[2] * c[0][1] ); + e0 = extents[0] * ac[2][1] + extents[2] * ac[0][1]; + e1 = a.extents[0] * ac[1][2] + a.extents[2] * ac[1][0]; if ( d > e0 + e1 ) { - return false; + return false; } - // axis C0 + t * A2xB0 - d = idMath::Fabs( axisdir[1] * c[0][0] - axisdir[0] * c[1][0] ); - e0 = extents[0] * ac[1][0] + extents[1] * ac[0][0]; - e1 = a.extents[1] * ac[2][2] + a.extents[2] * ac[2][1]; + // axis C0 + t * A1xB2 + d = idMath::Fabs( axisdir[0] * c[2][2] - axisdir[2] * c[0][2] ); + e0 = extents[0] * ac[2][2] + extents[2] * ac[0][2]; + e1 = a.extents[0] * ac[1][1] + a.extents[1] * ac[1][0]; if ( d > e0 + e1 ) { - return false; + return false; } - // axis C0 + t * A2xB1 - d = idMath::Fabs( axisdir[1] * c[0][1] - axisdir[0] * c[1][1] ); - e0 = extents[0] * ac[1][1] + extents[1] * ac[0][1]; - e1 = a.extents[0] * ac[2][2] + a.extents[2] * ac[2][0]; + // axis C0 + t * A2xB0 + d = idMath::Fabs( axisdir[1] * c[0][0] - axisdir[0] * c[1][0] ); + e0 = extents[0] * ac[1][0] + extents[1] * ac[0][0]; + e1 = a.extents[1] * ac[2][2] + a.extents[2] * ac[2][1]; if ( d > e0 + e1 ) { - return false; + return false; } - // axis C0 + t * A2xB2 - d = idMath::Fabs( axisdir[1] * c[0][2] - axisdir[0] * c[1][2] ); - e0 = extents[0] * ac[1][2] + extents[1] * ac[0][2]; - e1 = a.extents[0] * ac[2][1] + a.extents[1] * ac[2][0]; + // axis C0 + t * A2xB1 + d = idMath::Fabs( axisdir[1] * c[0][1] - axisdir[0] * c[1][1] ); + e0 = extents[0] * ac[1][1] + extents[1] * ac[0][1]; + e1 = a.extents[0] * ac[2][2] + a.extents[2] * ac[2][0]; if ( d > e0 + e1 ) { - return false; + return false; } - return true; + + // axis C0 + t * A2xB2 + d = idMath::Fabs( axisdir[1] * c[0][2] - axisdir[0] * c[1][2] ); + e0 = extents[0] * ac[1][2] + extents[1] * ac[0][2]; + e1 = a.extents[0] * ac[2][1] + a.extents[1] * ac[2][0]; + if ( d > e0 + e1 ) { + return false; + } + return true; } /* @@ -536,41 +536,41 @@ idBox::LineIntersection ============ */ bool idBox::LineIntersection( const idVec3 &start, const idVec3 &end ) const { - float ld[3]; - idVec3 lineDir = 0.5f * ( end - start ); - idVec3 lineCenter = start + lineDir; - idVec3 dir = lineCenter - center; + float ld[3]; + idVec3 lineDir = 0.5f * ( end - start ); + idVec3 lineCenter = start + lineDir; + idVec3 dir = lineCenter - center; - ld[0] = idMath::Fabs( lineDir * axis[0] ); + ld[0] = idMath::Fabs( lineDir * axis[0] ); if ( idMath::Fabs( dir * axis[0] ) > extents[0] + ld[0] ) { - return false; + return false; } - ld[1] = idMath::Fabs( lineDir * axis[1] ); + ld[1] = idMath::Fabs( lineDir * axis[1] ); if ( idMath::Fabs( dir * axis[1] ) > extents[1] + ld[1] ) { - return false; + return false; } - ld[2] = idMath::Fabs( lineDir * axis[2] ); + ld[2] = idMath::Fabs( lineDir * axis[2] ); if ( idMath::Fabs( dir * axis[2] ) > extents[2] + ld[2] ) { - return false; + return false; } - idVec3 cross = lineDir.Cross( dir ); + idVec3 cross = lineDir.Cross( dir ); if ( idMath::Fabs( cross * axis[0] ) > extents[1] * ld[2] + extents[2] * ld[1] ) { - return false; + return false; } if ( idMath::Fabs( cross * axis[1] ) > extents[0] * ld[2] + extents[2] * ld[0] ) { - return false; + return false; } if ( idMath::Fabs( cross * axis[2] ) > extents[0] * ld[1] + extents[1] * ld[0] ) { - return false; + return false; } - return true; + return true; } /* @@ -619,7 +619,7 @@ bool idBox::RayIntersection( const idVec3 &start, const idVec3 &dir, float &scal scale1 = -idMath::INFINITY; scale2 = idMath::INFINITY; - return BoxPlaneClip( localDir.x, -localStart.x - extents[0], scale1, scale2 ) && + return BoxPlaneClip( localDir.x, -localStart.x - extents[0], scale1, scale2 ) && BoxPlaneClip( -localDir.x, localStart.x - extents[0], scale1, scale2 ) && BoxPlaneClip( localDir.y, -localStart.y - extents[1], scale1, scale2 ) && BoxPlaneClip( -localDir.y, localStart.y - extents[1], scale1, scale2 ) && @@ -701,9 +701,9 @@ void idBox::FromPoints( const idVec3 *points, const int numPoints ) { // refine by calculating the bounds of the points projected onto the axis and adjusting the center and extents bounds.Clear(); - for ( i = 0; i < numPoints; i++ ) { + for ( i = 0; i < numPoints; i++ ) { bounds.AddPoint( idVec3( points[i] * axis[0], points[i] * axis[1], points[i] * axis[2] ) ); - } + } center = ( bounds[0] + bounds[1] ) * 0.5f; extents = bounds[1] - center; center *= axis; diff --git a/idlib/bv/Box.h b/idlib/bv/Box.h index 83e91ac..2d8e3cb 100644 --- a/idlib/bv/Box.h +++ b/idlib/bv/Box.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/bv/Frustum.cpp b/idlib/bv/Frustum.cpp index 1010255..37213f1 100644 --- a/idlib/bv/Frustum.cpp +++ b/idlib/bv/Frustum.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/bv/Frustum.h b/idlib/bv/Frustum.h index 1052a03..7340368 100644 --- a/idlib/bv/Frustum.h +++ b/idlib/bv/Frustum.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/bv/Frustum_gcc.cpp b/idlib/bv/Frustum_gcc.cpp index 991f5ef..be4ec32 100644 --- a/idlib/bv/Frustum_gcc.cpp +++ b/idlib/bv/Frustum_gcc.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/bv/Sphere.cpp b/idlib/bv/Sphere.cpp index f05db48..f06d813 100644 --- a/idlib/bv/Sphere.cpp +++ b/idlib/bv/Sphere.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/bv/Sphere.h b/idlib/bv/Sphere.h index dff0971..a5e2e5f 100644 --- a/idlib/bv/Sphere.h +++ b/idlib/bv/Sphere.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/containers/BTree.h b/idlib/containers/BTree.h index 29ea10d..c04bedd 100644 --- a/idlib/containers/BTree.h +++ b/idlib/containers/BTree.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/containers/BinSearch.h b/idlib/containers/BinSearch.h index b94b9cc..724aee7 100644 --- a/idlib/containers/BinSearch.h +++ b/idlib/containers/BinSearch.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/containers/HashIndex.cpp b/idlib/containers/HashIndex.cpp index f879cc9..1bfb38b 100644 --- a/idlib/containers/HashIndex.cpp +++ b/idlib/containers/HashIndex.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/containers/HashIndex.h b/idlib/containers/HashIndex.h index ed5555b..6385074 100644 --- a/idlib/containers/HashIndex.h +++ b/idlib/containers/HashIndex.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/containers/HashTable.h b/idlib/containers/HashTable.h index 73ed3ac..aab3d1a 100644 --- a/idlib/containers/HashTable.h +++ b/idlib/containers/HashTable.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/containers/Hierarchy.h b/idlib/containers/Hierarchy.h index 620b752..79143aa 100644 --- a/idlib/containers/Hierarchy.h +++ b/idlib/containers/Hierarchy.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -43,7 +43,7 @@ public: idHierarchy(); ~idHierarchy(); - + void SetOwner( type *object ); type * Owner( void ) const; void ParentTo( idHierarchy &node ); @@ -76,7 +76,7 @@ idHierarchy::idHierarchy template< class type > idHierarchy::idHierarchy() { owner = NULL; - parent = NULL; + parent = NULL; sibling = NULL; child = NULL; } diff --git a/idlib/containers/LinkList.h b/idlib/containers/LinkList.h index 3d2a041..06247a2 100644 --- a/idlib/containers/LinkList.h +++ b/idlib/containers/LinkList.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -84,7 +84,7 @@ Node is initialized to be the head of an empty list template< class type > idLinkList::idLinkList() { owner = NULL; - head = this; + head = this; next = this; prev = this; } diff --git a/idlib/containers/List.h b/idlib/containers/List.h index 5b3d722..7389267 100644 --- a/idlib/containers/List.h +++ b/idlib/containers/List.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -669,7 +669,7 @@ ID_INLINE int idList::Append( type const & obj ) { ================ idList::Insert -Increases the size of the list by at leat one element if necessary +Increases the size of the list by at leat one element if necessary and inserts the supplied data into it. Returns the index of the new element. @@ -819,7 +819,7 @@ ID_INLINE int idList::FindNull( void ) const { idList::IndexOf Takes a pointer to an element in the list and returns the index of the element. -This is NOT a guarantee that the object is really in the list. +This is NOT a guarantee that the object is really in the list. Function will assert in debug builds if pointer is outside the bounds of the list, but remains silent in release builds. ================ @@ -882,7 +882,7 @@ ID_INLINE bool idList::Remove( type const & obj ) { if ( index >= 0 ) { return RemoveIndex( index ); } - + return false; } diff --git a/idlib/containers/PlaneSet.h b/idlib/containers/PlaneSet.h index 51b9477..bd5912f 100644 --- a/idlib/containers/PlaneSet.h +++ b/idlib/containers/PlaneSet.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/containers/Queue.h b/idlib/containers/Queue.h index 2409aa0..cc93e69 100644 --- a/idlib/containers/Queue.h +++ b/idlib/containers/Queue.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/containers/Stack.h b/idlib/containers/Stack.h index 904ddcb..c43fdeb 100644 --- a/idlib/containers/Stack.h +++ b/idlib/containers/Stack.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/containers/StaticList.h b/idlib/containers/StaticList.h index 639eb12..4ae72f7 100644 --- a/idlib/containers/StaticList.h +++ b/idlib/containers/StaticList.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -76,7 +76,7 @@ public: private: int num; - type list[ size ]; + type list[ size ]; }; /* @@ -322,7 +322,7 @@ ID_INLINE int idStaticList::Append( type const & obj ) { ================ idStaticList::Insert -Increases the size of the list by at leat one element if necessary +Increases the size of the list by at leat one element if necessary and inserts the supplied data into it. Returns the index of the new element, or -1 when list is full. @@ -465,7 +465,7 @@ ID_INLINE int idStaticList::FindNull( void ) const { idStaticList::IndexOf Takes a pointer to an element in the list and returns the index of the element. -This is NOT a guarantee that the object is really in the list. +This is NOT a guarantee that the object is really in the list. Function will assert in debug builds if pointer is outside the bounds of the list, but remains silent in release builds. ================ @@ -527,7 +527,7 @@ ID_INLINE bool idStaticList::Remove( type const & obj ) { if ( index >= 0 ) { return RemoveIndex( index ); } - + return false; } diff --git a/idlib/containers/StrList.h b/idlib/containers/StrList.h index bf466e4..1a2916d 100644 --- a/idlib/containers/StrList.h +++ b/idlib/containers/StrList.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/containers/StrPool.h b/idlib/containers/StrPool.h index 0318df2..104bf8c 100644 --- a/idlib/containers/StrPool.h +++ b/idlib/containers/StrPool.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -138,7 +138,7 @@ ID_INLINE void idStrPool::FreeString( const idPoolStr *poolStr ) { poolStr->numUsers--; if ( poolStr->numUsers <= 0 ) { hash = poolHash.GenerateKey( poolStr->c_str(), caseSensitive ); - if ( caseSensitive ) { + if ( caseSensitive ) { for ( i = poolHash.First( hash ); i != -1; i = poolHash.Next( i ) ) { if ( pool[i]->Cmp( poolStr->c_str() ) == 0 ) { break; diff --git a/idlib/containers/VectorSet.h b/idlib/containers/VectorSet.h index fc4bea3..4e18daa 100644 --- a/idlib/containers/VectorSet.h +++ b/idlib/containers/VectorSet.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/geometry/DrawVert.cpp b/idlib/geometry/DrawVert.cpp index ecffd16..cd14b22 100644 --- a/idlib/geometry/DrawVert.cpp +++ b/idlib/geometry/DrawVert.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/geometry/DrawVert.h b/idlib/geometry/DrawVert.h index d8f1bbd..b33c660 100644 --- a/idlib/geometry/DrawVert.h +++ b/idlib/geometry/DrawVert.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -44,7 +44,7 @@ public: idVec3 normal; idVec3 tangents[2]; byte color[4]; -#if 0 // was MACOS_X see comments concerning DRAWVERT_PADDED in Simd_Altivec.h +#if 0 // was MACOS_X see comments concerning DRAWVERT_PADDED in Simd_Altivec.h float padding; #endif float operator[]( const int index ) const; diff --git a/idlib/geometry/JointTransform.cpp b/idlib/geometry/JointTransform.cpp index 28d5510..fe8badd 100644 --- a/idlib/geometry/JointTransform.cpp +++ b/idlib/geometry/JointTransform.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -40,11 +40,11 @@ idJointQuat idJointMat::ToJointQuat( void ) const { float trace; float s; float t; - int i; + int i; int j; int k; - static int next[3] = { 1, 2, 0 }; + static int next[3] = { 1, 2, 0 }; trace = mat[0 * 4 + 0] + mat[1 * 4 + 1] + mat[2 * 4 + 2]; diff --git a/idlib/geometry/JointTransform.h b/idlib/geometry/JointTransform.h index cf405c6..ceaa1c8 100644 --- a/idlib/geometry/JointTransform.h +++ b/idlib/geometry/JointTransform.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/geometry/Surface.cpp b/idlib/geometry/Surface.cpp index 04ebfa1..eb45485 100644 --- a/idlib/geometry/Surface.cpp +++ b/idlib/geometry/Surface.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -86,7 +86,7 @@ int idSurface::Split( const idPlane &plane, const float epsilon, idSurface **fro } counts[sides[i]]++; } - + *front = *back = NULL; // if coplanar, put on the front side if the normals match @@ -401,7 +401,7 @@ bool idSurface::ClipInPlace( const idPlane &plane, const float epsilon, const bo } counts[sides[i]]++; } - + // if coplanar, put on the front side if the normals match if ( !counts[SIDE_FRONT] && !counts[SIDE_BACK] ) { @@ -618,7 +618,7 @@ bool idSurface::IsConnected( void ) const { continue; } - queueStart = 0; + queueStart = 0; queueEnd = 1; queue[0] = i; islandNum[i] = numIslands; diff --git a/idlib/geometry/Surface.h b/idlib/geometry/Surface.h index 738b32d..847c67e 100644 --- a/idlib/geometry/Surface.h +++ b/idlib/geometry/Surface.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/geometry/Surface_Patch.cpp b/idlib/geometry/Surface_Patch.cpp index 43b12a4..06413d1 100644 --- a/idlib/geometry/Surface_Patch.cpp +++ b/idlib/geometry/Surface_Patch.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -266,7 +266,7 @@ void idSurface_Patch::GenerateNormals( void ) { // idVec3 extent[3]; float offset; - + extent[0] = verts[width - 1].xyz - verts[0].xyz; extent[1] = verts[(height-1) * width + width - 1].xyz - verts[0].xyz; extent[2] = verts[(height-1) * width].xyz - verts[0].xyz; diff --git a/idlib/geometry/Surface_Patch.h b/idlib/geometry/Surface_Patch.h index 2b57c1d..dae0e5b 100644 --- a/idlib/geometry/Surface_Patch.h +++ b/idlib/geometry/Surface_Patch.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/geometry/Surface_Polytope.cpp b/idlib/geometry/Surface_Polytope.cpp index a027a53..87a344c 100644 --- a/idlib/geometry/Surface_Polytope.cpp +++ b/idlib/geometry/Surface_Polytope.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/geometry/Surface_Polytope.h b/idlib/geometry/Surface_Polytope.h index df72d2c..be1336a 100644 --- a/idlib/geometry/Surface_Polytope.h +++ b/idlib/geometry/Surface_Polytope.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/geometry/Surface_SweptSpline.cpp b/idlib/geometry/Surface_SweptSpline.cpp index 38f6f50..c004ad1 100644 --- a/idlib/geometry/Surface_SweptSpline.cpp +++ b/idlib/geometry/Surface_SweptSpline.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/geometry/Surface_SweptSpline.h b/idlib/geometry/Surface_SweptSpline.h index 0849397..3ccb131 100644 --- a/idlib/geometry/Surface_SweptSpline.h +++ b/idlib/geometry/Surface_SweptSpline.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/geometry/TraceModel.cpp b/idlib/geometry/TraceModel.cpp index 0409868..2bd7d6b 100644 --- a/idlib/geometry/TraceModel.cpp +++ b/idlib/geometry/TraceModel.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -1100,7 +1100,7 @@ idTraceModel::Compare bool idTraceModel::Compare( const idTraceModel &trm ) const { int i; - if ( type != trm.type || numVerts != trm.numVerts || + if ( type != trm.type || numVerts != trm.numVerts || numEdges != trm.numEdges || numPolys != trm.numPolys ) { return false; } @@ -1301,7 +1301,7 @@ void idTraceModel::ProjectionIntegrals( int polyNum, int a, int b, struct projec b0_3 = b0_2 * b0; b0_4 = b0_3 * b0; a1_2 = a1 * a1; - a1_3 = a1_2 * a1; + a1_3 = a1_2 * a1; b1_2 = b1 * b1; b1_3 = b1_2 * b1; @@ -1381,7 +1381,7 @@ void idTraceModel::PolygonIntegrals( int polyNum, int a, int b, int c, struct po integrals.Faaa = k1 * pi.Paaa; integrals.Fbbb = k1 * pi.Pbbb; - integrals.Fccc = -k4 * (Cube(n[a]) * pi.Paaa + 3 * Square(n[a]) * n[b] * pi.Paab + integrals.Fccc = -k4 * (Cube(n[a]) * pi.Paaa + 3 * Square(n[a]) * n[b] * pi.Paab + 3 * n[a] * Square(n[b]) * pi.Pabb + Cube(n[b]) * pi.Pbbb + 3 * w * (Square(n[a]) * pi.Paa + 2 * n[a] * n[b] * pi.Pab + Square(n[b]) * pi.Pbb) + w * w * (3 * (n[a] * pi.Pa + n[b] * pi.Pb) + w * pi.P1)); diff --git a/idlib/geometry/TraceModel.h b/idlib/geometry/TraceModel.h index 72865c0..bd7ada3 100644 --- a/idlib/geometry/TraceModel.h +++ b/idlib/geometry/TraceModel.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -186,4 +186,3 @@ ID_INLINE bool idTraceModel::operator!=( const idTraceModel &trm ) const { } #endif /* !__TRACEMODEL_H__ */ - diff --git a/idlib/geometry/Winding.cpp b/idlib/geometry/Winding.cpp index 83aa976..09f3454 100644 --- a/idlib/geometry/Winding.cpp +++ b/idlib/geometry/Winding.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -121,7 +121,7 @@ int idWinding::Split( const idPlane &plane, const float epsilon, idWinding **fro } sides[i] = sides[0]; dists[i] = dists[0]; - + *front = *back = NULL; // if coplanar, put on the front side if the normals match @@ -152,10 +152,10 @@ int idWinding::Split( const idPlane &plane, const float epsilon, idWinding **fro *front = f = new idWinding(maxpts); *back = b = new idWinding(maxpts); - + for (i = 0; i < numPoints; i++) { p1 = &p[i]; - + if ( sides[i] == SIDE_ON ) { f->p[f->numPoints] = *p1; f->numPoints++; @@ -163,7 +163,7 @@ int idWinding::Split( const idPlane &plane, const float epsilon, idWinding **fro b->numPoints++; continue; } - + if ( sides[i] == SIDE_FRONT ) { f->p[f->numPoints] = *p1; f->numPoints++; @@ -177,10 +177,10 @@ int idWinding::Split( const idPlane &plane, const float epsilon, idWinding **fro if ( sides[i+1] == SIDE_ON || sides[i+1] == sides[i] ) { continue; } - + // generate a split point p2 = &p[(i+1)%numPoints]; - + // always calculate the split going from the same side // or minor epsilon issues can happen if ( sides[i] == SIDE_FRONT ) { @@ -199,7 +199,7 @@ int idWinding::Split( const idPlane &plane, const float epsilon, idWinding **fro mid.t = p1->t + dot * ( p2->t - p1->t ); } else { dot = dists[i+1] / ( dists[i+1] - dists[i] ); - for ( j = 0; j < 3; j++ ) { + for ( j = 0; j < 3; j++ ) { // avoid round off error when possible if ( plane.Normal()[j] == 1.0f ) { mid[j] = plane.Dist(); @@ -218,7 +218,7 @@ int idWinding::Split( const idPlane &plane, const float epsilon, idWinding **fro b->p[b->numPoints] = mid; b->numPoints++; } - + if ( f->numPoints > maxpts || b->numPoints > maxpts ) { idLib::common->FatalError( "idWinding::Split: points exceeded estimate." ); } @@ -283,7 +283,7 @@ idWinding *idWinding::Clip( const idPlane &plane, const float epsilon, const boo newPoints = (idVec5 *) _alloca16( maxpts * sizeof( idVec5 ) ); newNumPoints = 0; - + for ( i = 0; i < numPoints; i++ ) { p1 = &p[i]; @@ -330,7 +330,7 @@ idWinding *idWinding::Clip( const idPlane &plane, const float epsilon, const boo newPoints[newNumPoints] = mid; newNumPoints++; } - + if ( !EnsureAlloced( newNumPoints, false ) ) { return this; } @@ -379,7 +379,7 @@ bool idWinding::ClipInPlace( const idPlane &plane, const float epsilon, const bo } sides[i] = sides[0]; dists[i] = dists[0]; - + // if the winding is on the plane and we should keep it if ( keepOn && !counts[SIDE_FRONT] && !counts[SIDE_BACK] ) { return true; @@ -405,13 +405,13 @@ bool idWinding::ClipInPlace( const idPlane &plane, const float epsilon, const bo if ( newNumPoints+1 > maxpts ) { return true; // can't split -- fall back to original } - + if ( sides[i] == SIDE_ON ) { newPoints[newNumPoints] = *p1; newNumPoints++; continue; } - + if ( sides[i] == SIDE_FRONT ) { newPoints[newNumPoints] = *p1; newNumPoints++; @@ -420,14 +420,14 @@ bool idWinding::ClipInPlace( const idPlane &plane, const float epsilon, const bo if ( sides[i+1] == SIDE_ON || sides[i+1] == sides[i] ) { continue; } - + if ( newNumPoints+1 > maxpts ) { return true; // can't split -- fall back to original } // generate a split point p2 = &p[(i+1)%numPoints]; - + dot = dists[i] / (dists[i] - dists[i+1]); for ( j = 0; j < 3; j++ ) { // avoid round off error when possible @@ -441,7 +441,7 @@ bool idWinding::ClipInPlace( const idPlane &plane, const float epsilon, const bo } mid.s = p1->s + dot * ( p2->s - p1->s ); mid.t = p1->t + dot * ( p2->t - p1->t ); - + newPoints[newNumPoints] = mid; newNumPoints++; } @@ -521,7 +521,7 @@ bool idWinding::Check( bool print ) const { } return false; } - + area = GetArea(); if ( area < 1.0f ) { if ( print ) { @@ -531,7 +531,7 @@ bool idWinding::Check( bool print ) const { } GetPlane( plane ); - + for ( i = 0; i < numPoints; i++ ) { const idVec3 &p1 = p[i].ToVec3(); @@ -546,7 +546,7 @@ bool idWinding::Check( bool print ) const { } j = i + 1 == numPoints ? 0 : i + 1; - + // check if the point is on the face plane d = p1 * plane.Normal() + plane[3]; if ( d < -ON_EPSILON || d > ON_EPSILON ) { @@ -555,11 +555,11 @@ bool idWinding::Check( bool print ) const { } return false; } - + // check if the edge isn't degenerate const idVec3 &p2 = p[j].ToVec3(); dir = p2 - p1; - + if ( dir.Length() < ON_EPSILON) { if ( print ) { idLib::common->Printf( "idWinding::Check: edge %d is degenerate.", i ); @@ -572,7 +572,7 @@ bool idWinding::Check( bool print ) const { edgenormal.Normalize(); edgedist = p1 * edgenormal; edgedist += ON_EPSILON; - + // all other points must be on front side for ( j = 0; j < numPoints; j++ ) { if ( j == i ) { @@ -1008,10 +1008,10 @@ idWinding *idWinding::TryMerge( const idWinding &w, const idVec3 &planenormal, i f2 = &w; // // find a idLib::common edge - // + // p1 = p2 = NULL; // stop compiler warning j = 0; - + for ( i = 0; i < f1->numPoints; i++ ) { p1 = &f1->p[i].ToVec3(); p2 = &f1->p[(i+1) % f1->numPoints].ToVec3(); @@ -1034,7 +1034,7 @@ idWinding *idWinding::TryMerge( const idWinding &w, const idVec3 &planenormal, i break; } } - + if ( i == f1->numPoints ) { return NULL; // no matching edges } @@ -1047,7 +1047,7 @@ idWinding *idWinding::TryMerge( const idWinding &w, const idVec3 &planenormal, i delta = (*p1) - (*back); normal = planenormal.Cross(delta); normal.Normalize(); - + back = &f2->p[(j+2)%f2->numPoints].ToVec3(); delta = (*back) - (*p1); dot = delta * normal; @@ -1056,7 +1056,7 @@ idWinding *idWinding::TryMerge( const idWinding &w, const idVec3 &planenormal, i } keep1 = (bool)(dot < -CONTINUOUS_EPSILON); - + back = &f1->p[(i+2)%f1->numPoints].ToVec3(); delta = (*back) - (*p2); normal = planenormal.Cross( delta ); @@ -1075,17 +1075,17 @@ idWinding *idWinding::TryMerge( const idWinding &w, const idVec3 &planenormal, i // build the new polygon // newf = new idWinding( f1->numPoints + f2->numPoints ); - + // copy first polygon for ( k = (i+1) % f1->numPoints; k != i; k = (k+1) % f1->numPoints ) { if ( !keep && k == (i+1) % f1->numPoints && !keep2 ) { continue; } - + newf->p[newf->numPoints] = f1->p[k]; newf->numPoints++; } - + // copy second polygon for ( l = (j+1) % f2->numPoints; l != j; l = (l+1) % f2->numPoints ) { if ( !keep && l == (j+1) % f2->numPoints && !keep1 ) { @@ -1514,14 +1514,14 @@ int idFixedWinding::Split( idFixedWinding *back, const idPlane &plane, const flo return SIDE_FRONT; } } - + if ( !counts[SIDE_FRONT] ) { return SIDE_BACK; } sides[i] = sides[0]; dists[i] = dists[0]; - + out.numPoints = 0; back->numPoints = 0; @@ -1542,7 +1542,7 @@ int idFixedWinding::Split( idFixedWinding *back, const idPlane &plane, const flo back->numPoints++; continue; } - + if ( sides[i] == SIDE_FRONT ) { out.p[out.numPoints] = *p1; out.numPoints++; @@ -1551,11 +1551,11 @@ int idFixedWinding::Split( idFixedWinding *back, const idPlane &plane, const flo back->p[back->numPoints] = *p1; back->numPoints++; } - + if ( sides[i+1] == SIDE_ON || sides[i+1] == sides[i] ) { continue; } - + if ( !out.EnsureAlloced( out.numPoints+1, true ) ) { return SIDE_FRONT; // can't split -- fall back to original } @@ -1586,7 +1586,7 @@ int idFixedWinding::Split( idFixedWinding *back, const idPlane &plane, const flo } mid.s = p1->s + dot * ( p2->s - p1->s ); mid.t = p1->t + dot * ( p2->t - p1->t ); - + out.p[out.numPoints] = mid; out.numPoints++; back->p[back->numPoints] = mid; diff --git a/idlib/geometry/Winding.h b/idlib/geometry/Winding.h index 444870d..7636e35 100644 --- a/idlib/geometry/Winding.h +++ b/idlib/geometry/Winding.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/geometry/Winding2D.cpp b/idlib/geometry/Winding2D.cpp index 60847f4..c88edbe 100644 --- a/idlib/geometry/Winding2D.cpp +++ b/idlib/geometry/Winding2D.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -167,7 +167,7 @@ int idWinding2D::Split( const idVec3 &plane, const float epsilon, idWinding2D ** } sides[i] = sides[0]; dists[i] = dists[0]; - + *front = *back = NULL; // if nothing at the front of the clipping plane @@ -185,10 +185,10 @@ int idWinding2D::Split( const idVec3 &plane, const float epsilon, idWinding2D ** *front = f = new idWinding2D; *back = b = new idWinding2D; - + for ( i = 0; i < numPoints; i++ ) { p1 = &p[i]; - + if ( sides[i] == SIDE_ON ) { f->p[f->numPoints] = *p1; f->numPoints++; @@ -196,7 +196,7 @@ int idWinding2D::Split( const idVec3 &plane, const float epsilon, idWinding2D ** b->numPoints++; continue; } - + if ( sides[i] == SIDE_FRONT ) { f->p[f->numPoints] = *p1; f->numPoints++; @@ -210,10 +210,10 @@ int idWinding2D::Split( const idVec3 &plane, const float epsilon, idWinding2D ** if ( sides[i+1] == SIDE_ON || sides[i+1] == sides[i] ) { continue; } - + // generate a split point p2 = &p[(i+1)%numPoints]; - + // always calculate the split going from the same side // or minor epsilon issues can happen if ( sides[i] == SIDE_FRONT ) { @@ -277,7 +277,7 @@ bool idWinding2D::ClipInPlace( const idVec3 &plane, const float epsilon, const b } sides[i] = sides[0]; dists[i] = dists[0]; - + // if the winding is on the plane and we should keep it if ( keepOn && !counts[SIDE_FRONT] && !counts[SIDE_BACK] ) { return true; @@ -299,13 +299,13 @@ bool idWinding2D::ClipInPlace( const idVec3 &plane, const float epsilon, const b if ( newNumPoints+1 > maxpts ) { return true; // can't split -- fall back to original } - + if ( sides[i] == SIDE_ON ) { newPoints[newNumPoints] = *p1; newNumPoints++; continue; } - + if ( sides[i] == SIDE_FRONT ) { newPoints[newNumPoints] = *p1; newNumPoints++; @@ -314,14 +314,14 @@ bool idWinding2D::ClipInPlace( const idVec3 &plane, const float epsilon, const b if ( sides[i+1] == SIDE_ON || sides[i+1] == sides[i] ) { continue; } - + if ( newNumPoints+1 > maxpts ) { return true; // can't split -- fall back to original } // generate a split point p2 = &p[(i+1)%numPoints]; - + dot = dists[i] / (dists[i] - dists[i+1]); for ( j = 0; j < 2; j++ ) { // avoid round off error when possible diff --git a/idlib/geometry/Winding2D.h b/idlib/geometry/Winding2D.h index 83d828f..6a27e19 100644 --- a/idlib/geometry/Winding2D.h +++ b/idlib/geometry/Winding2D.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/hashing/MD4.cpp b/idlib/hashing/MD4.cpp index f2139e6..ab91595 100644 --- a/idlib/hashing/MD4.cpp +++ b/idlib/hashing/MD4.cpp @@ -44,7 +44,7 @@ typedef unsigned long int UINT4; typedef struct { UINT4 state[4]; /* state (ABCD) */ UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ - unsigned char buffer[64]; /* input buffer */ + unsigned char buffer[64]; /* input buffer */ } MD4_CTX; /* Constants for MD4Transform routine. */ @@ -86,10 +86,10 @@ static void Encode( unsigned char *output, UINT4 *input, unsigned int len ) { unsigned int i, j; for ( i = 0, j = 0; j < len; i++, j += 4 ) { - output[j] = (unsigned char)(input[i] & 0xff); - output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); - output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); - output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); + output[j] = (unsigned char)(input[i] & 0xff); + output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); + output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); + output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); } } @@ -98,7 +98,7 @@ static void Decode( UINT4 *output, const unsigned char *input, unsigned int len unsigned int i, j; for ( i = 0, j = 0; j < len; i++, j += 4 ) { - output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); + output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); } } @@ -109,57 +109,57 @@ static void MD4_Transform( UINT4 state[4], const unsigned char block[64] ) { Decode (x, block, 64); /* Round 1 */ - FF (a, b, c, d, x[ 0], S11); /* 1 */ - FF (d, a, b, c, x[ 1], S12); /* 2 */ - FF (c, d, a, b, x[ 2], S13); /* 3 */ - FF (b, c, d, a, x[ 3], S14); /* 4 */ - FF (a, b, c, d, x[ 4], S11); /* 5 */ - FF (d, a, b, c, x[ 5], S12); /* 6 */ - FF (c, d, a, b, x[ 6], S13); /* 7 */ - FF (b, c, d, a, x[ 7], S14); /* 8 */ - FF (a, b, c, d, x[ 8], S11); /* 9 */ - FF (d, a, b, c, x[ 9], S12); /* 10 */ - FF (c, d, a, b, x[10], S13); /* 11 */ - FF (b, c, d, a, x[11], S14); /* 12 */ - FF (a, b, c, d, x[12], S11); /* 13 */ - FF (d, a, b, c, x[13], S12); /* 14 */ - FF (c, d, a, b, x[14], S13); /* 15 */ - FF (b, c, d, a, x[15], S14); /* 16 */ + FF (a, b, c, d, x[ 0], S11); /* 1 */ + FF (d, a, b, c, x[ 1], S12); /* 2 */ + FF (c, d, a, b, x[ 2], S13); /* 3 */ + FF (b, c, d, a, x[ 3], S14); /* 4 */ + FF (a, b, c, d, x[ 4], S11); /* 5 */ + FF (d, a, b, c, x[ 5], S12); /* 6 */ + FF (c, d, a, b, x[ 6], S13); /* 7 */ + FF (b, c, d, a, x[ 7], S14); /* 8 */ + FF (a, b, c, d, x[ 8], S11); /* 9 */ + FF (d, a, b, c, x[ 9], S12); /* 10 */ + FF (c, d, a, b, x[10], S13); /* 11 */ + FF (b, c, d, a, x[11], S14); /* 12 */ + FF (a, b, c, d, x[12], S11); /* 13 */ + FF (d, a, b, c, x[13], S12); /* 14 */ + FF (c, d, a, b, x[14], S13); /* 15 */ + FF (b, c, d, a, x[15], S14); /* 16 */ /* Round 2 */ - GG (a, b, c, d, x[ 0], S21); /* 17 */ - GG (d, a, b, c, x[ 4], S22); /* 18 */ - GG (c, d, a, b, x[ 8], S23); /* 19 */ - GG (b, c, d, a, x[12], S24); /* 20 */ - GG (a, b, c, d, x[ 1], S21); /* 21 */ - GG (d, a, b, c, x[ 5], S22); /* 22 */ - GG (c, d, a, b, x[ 9], S23); /* 23 */ - GG (b, c, d, a, x[13], S24); /* 24 */ - GG (a, b, c, d, x[ 2], S21); /* 25 */ - GG (d, a, b, c, x[ 6], S22); /* 26 */ - GG (c, d, a, b, x[10], S23); /* 27 */ - GG (b, c, d, a, x[14], S24); /* 28 */ - GG (a, b, c, d, x[ 3], S21); /* 29 */ - GG (d, a, b, c, x[ 7], S22); /* 30 */ - GG (c, d, a, b, x[11], S23); /* 31 */ - GG (b, c, d, a, x[15], S24); /* 32 */ + GG (a, b, c, d, x[ 0], S21); /* 17 */ + GG (d, a, b, c, x[ 4], S22); /* 18 */ + GG (c, d, a, b, x[ 8], S23); /* 19 */ + GG (b, c, d, a, x[12], S24); /* 20 */ + GG (a, b, c, d, x[ 1], S21); /* 21 */ + GG (d, a, b, c, x[ 5], S22); /* 22 */ + GG (c, d, a, b, x[ 9], S23); /* 23 */ + GG (b, c, d, a, x[13], S24); /* 24 */ + GG (a, b, c, d, x[ 2], S21); /* 25 */ + GG (d, a, b, c, x[ 6], S22); /* 26 */ + GG (c, d, a, b, x[10], S23); /* 27 */ + GG (b, c, d, a, x[14], S24); /* 28 */ + GG (a, b, c, d, x[ 3], S21); /* 29 */ + GG (d, a, b, c, x[ 7], S22); /* 30 */ + GG (c, d, a, b, x[11], S23); /* 31 */ + GG (b, c, d, a, x[15], S24); /* 32 */ /* Round 3 */ HH (a, b, c, d, x[ 0], S31); /* 33 */ - HH (d, a, b, c, x[ 8], S32); /* 34 */ - HH (c, d, a, b, x[ 4], S33); /* 35 */ - HH (b, c, d, a, x[12], S34); /* 36 */ - HH (a, b, c, d, x[ 2], S31); /* 37 */ - HH (d, a, b, c, x[10], S32); /* 38 */ - HH (c, d, a, b, x[ 6], S33); /* 39 */ - HH (b, c, d, a, x[14], S34); /* 40 */ - HH (a, b, c, d, x[ 1], S31); /* 41 */ - HH (d, a, b, c, x[ 9], S32); /* 42 */ - HH (c, d, a, b, x[ 5], S33); /* 43 */ - HH (b, c, d, a, x[13], S34); /* 44 */ - HH (a, b, c, d, x[ 3], S31); /* 45 */ - HH (d, a, b, c, x[11], S32); /* 46 */ - HH (c, d, a, b, x[ 7], S33); /* 47 */ + HH (d, a, b, c, x[ 8], S32); /* 34 */ + HH (c, d, a, b, x[ 4], S33); /* 35 */ + HH (b, c, d, a, x[12], S34); /* 36 */ + HH (a, b, c, d, x[ 2], S31); /* 37 */ + HH (d, a, b, c, x[10], S32); /* 38 */ + HH (c, d, a, b, x[ 6], S33); /* 39 */ + HH (b, c, d, a, x[14], S34); /* 40 */ + HH (a, b, c, d, x[ 1], S31); /* 41 */ + HH (d, a, b, c, x[ 9], S32); /* 42 */ + HH (c, d, a, b, x[ 5], S33); /* 43 */ + HH (b, c, d, a, x[13], S34); /* 44 */ + HH (a, b, c, d, x[ 3], S31); /* 45 */ + HH (d, a, b, c, x[11], S32); /* 46 */ + HH (c, d, a, b, x[ 7], S33); /* 47 */ HH (b, c, d, a, x[15], S34); /* 48 */ state[0] += a; @@ -200,16 +200,16 @@ void MD4_Update( MD4_CTX *context, const unsigned char *input, unsigned int inpu /* Transform as many times as possible.*/ if ( inputLen >= partLen ) { - memcpy((POINTER)&context->buffer[index], (POINTER)input, partLen); - MD4_Transform (context->state, context->buffer); + memcpy((POINTER)&context->buffer[index], (POINTER)input, partLen); + MD4_Transform (context->state, context->buffer); for ( i = partLen; i + 63 < inputLen; i += 64 ) { - MD4_Transform (context->state, &input[i]); + MD4_Transform (context->state, &input[i]); } - index = 0; + index = 0; } else { - i = 0; + i = 0; } /* Buffer remaining input */ @@ -231,7 +231,7 @@ void MD4_Final( MD4_CTX *context, unsigned char digest[16] ) { /* Append length (before padding) */ MD4_Update( context, bits, 8 ); - + /* Store state in digest */ Encode( digest, context->state, 16 ); diff --git a/idlib/hashing/MD5.cpp b/idlib/hashing/MD5.cpp index 8900089..03fe414 100644 --- a/idlib/hashing/MD5.cpp +++ b/idlib/hashing/MD5.cpp @@ -29,8 +29,8 @@ will fill a supplied 16-byte array with the digest. typedef struct { unsigned int state[4]; - unsigned int bits[2]; - unsigned char in[64]; + unsigned int bits[2]; + unsigned char in[64]; } MD5_CTX; /* The four core functions - F1 is optimized somewhat */ @@ -53,89 +53,89 @@ the data and converts bytes into longwords for this routine. ================= */ void MD5_Transform( unsigned int state[4], unsigned int in[16] ) { - register unsigned int a, b, c, d; + register unsigned int a, b, c, d; - a = state[0]; - b = state[1]; - c = state[2]; - d = state[3]; + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; LittleRevBytes( in, sizeof(unsigned int), 16 ); - MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); - MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); - MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); - MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); - MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); - MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); - MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); - MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); - MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); - MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); - MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); - MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); - MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); - MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); - MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); - MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); - MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); - MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); - MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); - MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); - MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); - MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); - MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); - MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); - MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); - MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); - MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); - MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); - MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); - MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); - MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); - MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); - MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); - MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); - MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); - MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); - MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); - MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); - MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); - MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); - MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); - MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); - MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); - MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); - MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); - MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); - MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); - MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); + MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); - MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); - MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); - MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); - MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); - MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); - MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); - MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); - MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); - MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); - MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); - MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); - MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); - MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); - MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); - MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); - MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); LittleRevBytes( in, sizeof(unsigned int), 16 ); - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; } /* @@ -146,13 +146,13 @@ MD5 initialization. Begins an MD5 operation, writing a new context. ================== */ void MD5_Init( MD5_CTX *ctx ) { - ctx->state[0] = 0x67452301; - ctx->state[1] = 0xefcdab89; - ctx->state[2] = 0x98badcfe; - ctx->state[3] = 0x10325476; + ctx->state[0] = 0x67452301; + ctx->state[1] = 0xefcdab89; + ctx->state[2] = 0x98badcfe; + ctx->state[3] = 0x10325476; - ctx->bits[0] = 0; - ctx->bits[1] = 0; + ctx->bits[0] = 0; + ctx->bits[1] = 0; } /* @@ -164,44 +164,44 @@ processing another message block, and updating the context. =================== */ void MD5_Update( MD5_CTX *ctx, unsigned char const *buf, unsigned int len ) { - unsigned int t; + unsigned int t; - /* Update bitcount */ + /* Update bitcount */ - t = ctx->bits[0]; + t = ctx->bits[0]; if ( ( ctx->bits[0] = t + ( (unsigned int) len << 3 ) ) < t ) { - ctx->bits[1]++; /* Carry from low to high */ + ctx->bits[1]++; /* Carry from low to high */ } - ctx->bits[1] += len >> 29; + ctx->bits[1] += len >> 29; - t = ( t >> 3 ) & 0x3f; /* Bytes already in shsInfo->data */ + t = ( t >> 3 ) & 0x3f; /* Bytes already in shsInfo->data */ - /* Handle any leading odd-sized chunks */ + /* Handle any leading odd-sized chunks */ - if ( t ) { - unsigned char *p = (unsigned char *) ctx->in + t; + if ( t ) { + unsigned char *p = (unsigned char *) ctx->in + t; - t = 64 - t; - if ( len < t ) { - memcpy( p, buf, len ); - return; - } - memcpy( p, buf, t ); - MD5_Transform( ctx->state, (unsigned int *) ctx->in ); - buf += t; - len -= t; - } - /* Process data in 64-byte chunks */ + t = 64 - t; + if ( len < t ) { + memcpy( p, buf, len ); + return; + } + memcpy( p, buf, t ); + MD5_Transform( ctx->state, (unsigned int *) ctx->in ); + buf += t; + len -= t; + } + /* Process data in 64-byte chunks */ - while( len >= 64 ) { - memcpy( ctx->in, buf, 64 ); - MD5_Transform( ctx->state, (unsigned int *) ctx->in ); - buf += 64; - len -= 64; - } + while( len >= 64 ) { + memcpy( ctx->in, buf, 64 ); + MD5_Transform( ctx->state, (unsigned int *) ctx->in ); + buf += 64; + len -= 64; + } - /* Handle any remaining bytes of data. */ - memcpy( ctx->in, buf, len ); + /* Handle any remaining bytes of data. */ + memcpy( ctx->in, buf, len ); } /* @@ -213,43 +213,43 @@ writing the message digest and zeroizing the context. =============== */ void MD5_Final( MD5_CTX *ctx, unsigned char digest[16] ) { - unsigned count; - unsigned char *p; + unsigned count; + unsigned char *p; - /* Compute number of bytes mod 64 */ - count = ( ctx->bits[0] >> 3 ) & 0x3F; + /* Compute number of bytes mod 64 */ + count = ( ctx->bits[0] >> 3 ) & 0x3F; - /* Set the first char of padding to 0x80. This is safe since there is - always at least one byte free */ - p = ctx->in + count; - *p++ = 0x80; + /* Set the first char of padding to 0x80. This is safe since there is + always at least one byte free */ + p = ctx->in + count; + *p++ = 0x80; - /* Bytes of padding needed to make 64 bytes */ - count = 64 - 1 - count; + /* Bytes of padding needed to make 64 bytes */ + count = 64 - 1 - count; - /* Pad out to 56 mod 64 */ - if ( count < 8 ) { - /* Two lots of padding: Pad the first block to 64 bytes */ - memset( p, 0, count ); - MD5_Transform( ctx->state, (unsigned int *) ctx->in ); + /* Pad out to 56 mod 64 */ + if ( count < 8 ) { + /* Two lots of padding: Pad the first block to 64 bytes */ + memset( p, 0, count ); + MD5_Transform( ctx->state, (unsigned int *) ctx->in ); - /* Now fill the next block with 56 bytes */ - memset( ctx->in, 0, 56 ); - } else { - /* Pad block to 56 bytes */ - memset( p, 0, count - 8 ); - } + /* Now fill the next block with 56 bytes */ + memset( ctx->in, 0, 56 ); + } else { + /* Pad block to 56 bytes */ + memset( p, 0, count - 8 ); + } - /* Append length in bits and transform */ + /* Append length in bits and transform */ unsigned int val0 = ctx->bits[0]; unsigned int val1 = ctx->bits[1]; - - ((unsigned int *) ctx->in)[14] = LittleLong( val0 ); - ((unsigned int *) ctx->in)[15] = LittleLong( val1 ); - MD5_Transform( ctx->state, (unsigned int *) ctx->in ); - memcpy( digest, ctx->state, 16 ); - memset( ctx, 0, sizeof( ctx ) ); /* In case it's sensitive */ + ((unsigned int *) ctx->in)[14] = LittleLong( val0 ); + ((unsigned int *) ctx->in)[15] = LittleLong( val1 ); + + MD5_Transform( ctx->state, (unsigned int *) ctx->in ); + memcpy( digest, ctx->state, 16 ); + memset( ctx, 0, sizeof( ctx ) ); /* In case it's sensitive */ } /* diff --git a/idlib/math/Angles.cpp b/idlib/math/Angles.cpp index 7e3da8a..f7ee446 100644 --- a/idlib/math/Angles.cpp +++ b/idlib/math/Angles.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -73,7 +73,7 @@ idAngles& idAngles::Normalize180( void ) { if ( pitch > 180.0f ) { pitch -= 360.0f; } - + if ( yaw > 180.0f ) { yaw -= 360.0f; } @@ -91,7 +91,7 @@ idAngles::ToVectors */ void idAngles::ToVectors( idVec3 *forward, idVec3 *right, idVec3 *up ) const { float sr, sp, sy, cr, cp, cy; - + idMath::SinCos( DEG2RAD( yaw ), sy, cy ); idMath::SinCos( DEG2RAD( pitch ), sp, cp ); idMath::SinCos( DEG2RAD( roll ), sr, cr ); @@ -116,7 +116,7 @@ idAngles::ToForward */ idVec3 idAngles::ToForward( void ) const { float sp, sy, cp, cy; - + idMath::SinCos( DEG2RAD( yaw ), sy, cy ); idMath::SinCos( DEG2RAD( pitch ), sp, cp ); diff --git a/idlib/math/Angles.h b/idlib/math/Angles.h index 927f939..51c9312 100644 --- a/idlib/math/Angles.h +++ b/idlib/math/Angles.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -58,7 +58,7 @@ public: idAngles( float pitch, float yaw, float roll ); explicit idAngles( const idVec3 &v ); - void Set( float pitch, float yaw, float roll ); + void Set( float pitch, float yaw, float roll ); idAngles & Zero( void ); float operator[]( int index ) const; @@ -209,7 +209,7 @@ ID_INLINE bool idAngles::Compare( const idAngles &a, const float epsilon ) const if ( idMath::Fabs( pitch - a.pitch ) > epsilon ) { return false; } - + if ( idMath::Fabs( yaw - a.yaw ) > epsilon ) { return false; } diff --git a/idlib/math/Complex.cpp b/idlib/math/Complex.cpp index e9035bd..dfb74c4 100644 --- a/idlib/math/Complex.cpp +++ b/idlib/math/Complex.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Complex.h b/idlib/math/Complex.h index 082ecf3..d4ef2ee 100644 --- a/idlib/math/Complex.h +++ b/idlib/math/Complex.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -45,7 +45,7 @@ public: idComplex( void ); idComplex( const float r, const float i ); - void Set( const float r, const float i ); + void Set( const float r, const float i ); void Zero( void ); float operator[]( int index ) const; diff --git a/idlib/math/Curve.h b/idlib/math/Curve.h index c9c6e2b..37f9730 100644 --- a/idlib/math/Curve.h +++ b/idlib/math/Curve.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -72,7 +72,7 @@ protected: idList times; // knots idList values; // knot values - + mutable int currentIndex; // cached index for fast lookup mutable bool changed; // set whenever the curve changes @@ -592,7 +592,7 @@ ID_INLINE void idCurve_Bezier::Basis( const int order, const float t, floa c = (float *) _alloca16( (d+1) * sizeof( float ) ); s = (float) ( t - this->times[0] ) / ( this->times[this->times.Num()-1] - this->times[0] ); - o = 1.0f - s; + o = 1.0f - s; ps = s; po = o; @@ -1973,7 +1973,7 @@ ID_INLINE float idCurve_BSpline::BasisSecondDerivative( const int index, c template< class type > class idCurve_UniformCubicBSpline : public idCurve_BSpline { - + public: idCurve_UniformCubicBSpline( void ); @@ -2142,7 +2142,7 @@ ID_INLINE void idCurve_UniformCubicBSpline::BasisSecondDerivative( const i template< class type > class idCurve_NonUniformBSpline : public idCurve_BSpline { - + public: idCurve_NonUniformBSpline( void ); @@ -2261,11 +2261,11 @@ idCurve_NonUniformBSpline::Basis */ template< class type > ID_INLINE void idCurve_NonUniformBSpline::Basis( const int index, const int order, const float t, float *bvals ) const { - int r, s, i; - float omega; + int r, s, i; + float omega; - bvals[order-1] = 1.0f; - for ( r = 2; r <= order; r++ ) { + bvals[order-1] = 1.0f; + for ( r = 2; r <= order; r++ ) { i = index - r + 1; bvals[order - r] = 0.0f; for ( s = order - r + 1; s < order; s++ ) { @@ -2274,7 +2274,7 @@ ID_INLINE void idCurve_NonUniformBSpline::Basis( const int index, const in bvals[s - 1] += ( 1.0f - omega ) * bvals[s]; bvals[s] *= omega; } - } + } } /* @@ -2328,7 +2328,7 @@ ID_INLINE void idCurve_NonUniformBSpline::BasisSecondDerivative( const int template< class type > class idCurve_NURBS : public idCurve_NonUniformBSpline { - + public: idCurve_NURBS( void ); diff --git a/idlib/math/Extrapolate.h b/idlib/math/Extrapolate.h index 970d472..1c8ec1a 100644 --- a/idlib/math/Extrapolate.h +++ b/idlib/math/Extrapolate.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Interpolate.h b/idlib/math/Interpolate.h index 03ddbc6..2659dd8 100644 --- a/idlib/math/Interpolate.h +++ b/idlib/math/Interpolate.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Lcp.cpp b/idlib/math/Lcp.cpp index 7f1da8e..f41dbbc 100644 --- a/idlib/math/Lcp.cpp +++ b/idlib/math/Lcp.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -578,7 +578,7 @@ bool idLCP_Square::Solve( const idMatX &o_m, idVecX &o_x, const idVecX &o_b, con } } - // sub matrix for factorization + // sub matrix for factorization clamped.SetData( m.GetNumRows(), m.GetNumColumns(), MATX_ALLOCA( m.GetNumRows() * m.GetNumColumns() ) ); diagonal.SetData( m.GetNumRows(), VECX_ALLOCA( m.GetNumRows() ) ); @@ -1368,7 +1368,7 @@ bool idLCP_Symmetric::Solve( const idMatX &o_m, idVecX &o_x, const idVecX &o_b, } } - // sub matrix for factorization + // sub matrix for factorization clamped.SetData( m.GetNumRows(), m.GetNumColumns(), MATX_ALLOCA( m.GetNumRows() * m.GetNumColumns() ) ); diagonal.SetData( m.GetNumRows(), VECX_ALLOCA( m.GetNumRows() ) ); solveCache1.SetData( m.GetNumRows(), VECX_ALLOCA( m.GetNumRows() ) ); diff --git a/idlib/math/Lcp.h b/idlib/math/Lcp.h index 83496ff..e800fae 100644 --- a/idlib/math/Lcp.h +++ b/idlib/math/Lcp.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -40,19 +40,19 @@ If you have questions concerning this license or the applicable additional terms complementarity condition: (x[i] - lo[i]) * (x[i] - hi[i]) * t[i] = 0 such that for each 0 <= i < n one of the following holds: - 1. lo[i] < x[i] < hi[i], t[i] == 0 - 2. x[i] == lo[i], t[i] >= 0 - 3. x[i] == hi[i], t[i] <= 0 + 1. lo[i] < x[i] < hi[i], t[i] == 0 + 2. x[i] == lo[i], t[i] >= 0 + 3. x[i] == hi[i], t[i] <= 0 Partly bounded or unbounded variables can have lo[i] and/or hi[i] set to negative/positive idMath::INFITITY respectively. If boxIndex != NULL and boxIndex[i] != -1 then - lo[i] = - fabs( lo[i] * x[boxIndex[i]] ) - hi[i] = fabs( hi[i] * x[boxIndex[i]] ) + lo[i] = - fabs( lo[i] * x[boxIndex[i]] ) + hi[i] = fabs( hi[i] * x[boxIndex[i]] ) boxIndex[boxIndex[i]] must be -1 - + Before calculating any of the bounded x[i] with boxIndex[i] != -1 the solver calculates all unbounded x[i] and all x[i] with boxIndex[i] == -1. diff --git a/idlib/math/Math.cpp b/idlib/math/Math.cpp index 08d93d9..3745259 100644 --- a/idlib/math/Math.cpp +++ b/idlib/math/Math.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -55,15 +55,15 @@ idMath::Init =============== */ void idMath::Init( void ) { - union _flint fi, fo; + union _flint fi, fo; - for ( int i = 0; i < SQRT_TABLE_SIZE; i++ ) { - fi.i = ((EXP_BIAS-1) << EXP_POS) | (i << LOOKUP_POS); - fo.f = (float)( 1.0 / sqrt( fi.f ) ); - iSqrt[i] = ((dword)(((fo.i + (1<<(SEED_POS-2))) >> SEED_POS) & 0xFF))<> SEED_POS) & 0xFF))< 0.0f ) { t = trace + 1.0f; s = idMath::InvSqrt( t ) * 0.5f; - + r.angle = s * t; r.vec[0] = ( mat[ 2 ][ 1 ] - mat[ 1 ][ 2 ] ) * s; r.vec[1] = ( mat[ 0 ][ 2 ] - mat[ 2 ][ 0 ] ) * s; @@ -273,12 +273,12 @@ idRotation idMat3::ToRotation( void ) const { if ( mat[ 2 ][ 2 ] > mat[ i ][ i ] ) { i = 2; } - j = next[ i ]; + j = next[ i ]; k = next[ j ]; - + t = ( mat[ i ][ i ] - ( mat[ j ][ j ] + mat[ k ][ k ] ) ) + 1.0f; s = idMath::InvSqrt( t ) * 0.5f; - + r.vec[i] = s * t; r.angle = ( mat[ k ][ j ] - mat[ j ][ k ] ) * s; r.vec[j] = ( mat[ j ][ i ] + mat[ i ][ j ] ) * s; @@ -629,11 +629,11 @@ idMat4::Transpose idMat4 idMat4::Transpose( void ) const { idMat4 transpose; int i, j; - + for( i = 0; i < 4; i++ ) { for( j = 0; j < 4; j++ ) { transpose[ i ][ j ] = mat[ j ][ i ]; - } + } } return transpose; } @@ -646,13 +646,13 @@ idMat4::TransposeSelf idMat4 &idMat4::TransposeSelf( void ) { float temp; int i, j; - + for( i = 0; i < 4; i++ ) { for( j = i + 1; j < 4; j++ ) { temp = mat[ i ][ j ]; mat[ i ][ j ] = mat[ j ][ i ]; mat[ j ][ i ] = temp; - } + } } return *this; } @@ -1064,11 +1064,11 @@ idMat5::Transpose idMat5 idMat5::Transpose( void ) const { idMat5 transpose; int i, j; - + for( i = 0; i < 5; i++ ) { for( j = 0; j < 5; j++ ) { transpose[ i ][ j ] = mat[ j ][ i ]; - } + } } return transpose; } @@ -1081,13 +1081,13 @@ idMat5::TransposeSelf idMat5 &idMat5::TransposeSelf( void ) { float temp; int i, j; - + for( i = 0; i < 5; i++ ) { for( j = i + 1; j < 5; j++ ) { temp = mat[ i ][ j ]; mat[ i ][ j ] = mat[ j ][ i ]; mat[ j ][ i ] = temp; - } + } } return *this; } @@ -1178,7 +1178,7 @@ bool idMat5::InverseSelf( void ) { // determinant of 5x5 matrix det = mat[0][0] * det4_1234_1234 - mat[0][1] * det4_1234_0234 + mat[0][2] * det4_1234_0134 - mat[0][3] * det4_1234_0124 + mat[0][4] * det4_1234_0123; - if( idMath::Fabs( det ) < MATRIX_INVERSE_EPSILON ) { + if( idMath::Fabs( det ) < MATRIX_INVERSE_EPSILON ) { return false; } @@ -1338,7 +1338,7 @@ bool idMat5::InverseFastSelf( void ) { // determinant of 5x5 matrix det = mat[0][0] * det4_1234_1234 - mat[0][1] * det4_1234_0234 + mat[0][2] * det4_1234_0134 - mat[0][3] * det4_1234_0124 + mat[0][4] * det4_1234_0123; - if( idMath::Fabs( det ) < MATRIX_INVERSE_EPSILON ) { + if( idMath::Fabs( det ) < MATRIX_INVERSE_EPSILON ) { return false; } @@ -1757,11 +1757,11 @@ idMat6::Transpose idMat6 idMat6::Transpose( void ) const { idMat6 transpose; int i, j; - + for( i = 0; i < 6; i++ ) { for( j = 0; j < 6; j++ ) { transpose[ i ][ j ] = mat[ j ][ i ]; - } + } } return transpose; } @@ -1774,13 +1774,13 @@ idMat6::TransposeSelf idMat6 &idMat6::TransposeSelf( void ) { float temp; int i, j; - + for( i = 0; i < 6; i++ ) { for( j = i + 1; j < 6; j++ ) { temp = mat[ i ][ j ]; mat[ i ][ j ] = mat[ j ][ i ]; mat[ j ][ i ] = temp; - } + } } return *this; } @@ -3490,9 +3490,9 @@ idMatX::Update_RowColumn Updates the matrix to obtain the matrix: - [ 0 a 0 ] + [ 0 a 0 ] A + [ d b e ] - [ 0 c 0 ] + [ 0 c 0 ] where: a = v[0,r-1], b = v[r], c = v[r+1,numRows-1], d = w[0,r-1], w[r] = 0.0f, e = w[r+1,numColumns-1] ============ @@ -3518,9 +3518,9 @@ idMatX::Update_RowColumnSymmetric Updates the matrix to obtain the matrix: - [ 0 a 0 ] + [ 0 a 0 ] A + [ a b c ] - [ 0 c 0 ] + [ 0 c 0 ] where: a = v[0,r-1], b = v[r], c = v[r+1,numRows-1] ============ @@ -3743,9 +3743,9 @@ idMatX::Inverse_UpdateRowColumn Updates the in-place inverse to obtain the inverse for the matrix: - [ 0 a 0 ] + [ 0 a 0 ] A + [ d b e ] - [ 0 c 0 ] + [ 0 c 0 ] where: a = v[0,r-1], b = v[r], c = v[r+1,numRows-1], d = w[0,r-1], w[r] = 0.0f, e = w[r+1,numColumns-1] ============ @@ -3935,7 +3935,7 @@ bool idMatX::LU_Factor( int *index, float *det ) { } return true; -} +} /* ============ @@ -4012,9 +4012,9 @@ idMatX::LU_UpdateRowColumn Updates the in-place LU factorization to obtain the factors for the matrix: - [ 0 a 0 ] + [ 0 a 0 ] LU + [ d b e ] - [ 0 c 0 ] + [ 0 c 0 ] where: a = v[0,r-1], b = v[r], c = v[r+1,numRows-1], d = w[0,r-1], w[r] = 0.0f, e = w[r+1,numColumns-1] ============ @@ -4588,9 +4588,9 @@ idMatX::QR_UpdateRowColumn Updates the unpacked QR factorization to obtain the factors for the matrix: - [ 0 a 0 ] + [ 0 a 0 ] QR + [ d b e ] - [ 0 c 0 ] + [ 0 c 0 ] where: a = v[0,r-1], b = v[r], c = v[r+1,numRows-1], d = w[0,r-1], w[r] = 0.0f, e = w[r+1,numColumns-1] ============ @@ -5382,9 +5382,9 @@ idMatX::Cholesky_UpdateRowColumn Updates the in-place Cholesky factorization to obtain the factors for the matrix: - [ 0 a 0 ] + [ 0 a 0 ] LL' + [ a b c ] - [ 0 c 0 ] + [ 0 c 0 ] where: a = v[0,r-1], b = v[r], c = v[r+1,numRows-1] ============ @@ -5406,8 +5406,8 @@ bool idMatX::Cholesky_UpdateRowColumn( const idVecX &v, int r ) { if ( numColumns == 1 ) { double v0 = v[0]; sum = (*this)[0][0]; - sum = sum * sum; - sum = sum + v0; + sum = sum * sum; + sum = sum + v0; if ( sum <= 0.0f ) { return false; } @@ -5761,8 +5761,8 @@ bool idMatX::LDLT_Factor( void ) { sum = (*this)[i][i]; for ( j = 0; j < i; j++ ) { d = (*this)[i][j]; - v[j] = (*this)[j][j] * d; - sum -= v[j] * d; + v[j] = (*this)[j][j] * d; + sum -= v[j] * d; } if ( sum == 0.0f ) { @@ -5773,11 +5773,11 @@ bool idMatX::LDLT_Factor( void ) { d = 1.0f / sum; for ( j = i + 1; j < numRows; j++ ) { - sum = (*this)[j][i]; + sum = (*this)[j][i]; for ( k = 0; k < i; k++ ) { sum -= (*this)[j][k] * v[k]; } - (*this)[j][i] = sum * d; + (*this)[j][i] = sum * d; } } @@ -5837,9 +5837,9 @@ idMatX::LDLT_UpdateRowColumn Updates the in-place LDL' factorization to obtain the factors for the matrix: - [ 0 a 0 ] + [ 0 a 0 ] LDL' + [ a b c ] - [ 0 c 0 ] + [ 0 c 0 ] where: a = v[0,r-1], b = v[r], c = v[r+1,numRows-1] ============ @@ -6391,7 +6391,7 @@ void idMatX::HouseholderReduction( idVecX &diag, idVecX &subd ) { (*this)[i1][i2] -= f * subd[i2] + g * (*this)[i0][i2]; } } - } + } } else { subd[i0] = (*this)[i0][i3]; } @@ -6440,7 +6440,7 @@ idMatX::QL ============ */ bool idMatX::QL( idVecX &diag, idVecX &subd ) { - const int maxIter = 32; + const int maxIter = 32; int i0, i1, i2, i3; float a, b, f, g, r, p, s, c; @@ -6710,7 +6710,7 @@ bool idMatX::HessenbergToRealSchur( idMatX &H, idVecX &realEigenValues, idVecX & } l--; } - + // check for convergence if ( l == n ) { // one root found H[n][n] = H[n][n] + exshift; @@ -6918,7 +6918,7 @@ bool idMatX::HessenbergToRealSchur( idMatX &H, idVecX &realEigenValues, idVecX & } } } - + // backsubstitute to find vectors of upper triangular form if ( norm == 0.0f ) { return false; @@ -7064,7 +7064,7 @@ idMatX::Eigen_Solve ============ */ bool idMatX::Eigen_Solve( idVecX &realEigenValues, idVecX &imaginaryEigenValues ) { - idMatX H; + idMatX H; assert( numRows == numColumns ); @@ -7073,11 +7073,11 @@ bool idMatX::Eigen_Solve( idVecX &realEigenValues, idVecX &imaginaryEigenValues H = *this; - // reduce to Hessenberg form - HessenbergReduction( H ); + // reduce to Hessenberg form + HessenbergReduction( H ); - // reduce Hessenberg to real Schur form - return HessenbergToRealSchur( H, realEigenValues, imaginaryEigenValues ); + // reduce Hessenberg to real Schur form + return HessenbergToRealSchur( H, realEigenValues, imaginaryEigenValues ); } /* @@ -7258,7 +7258,7 @@ void idMatX::Test( void ) { // invert m1 m1.Inverse_GaussJordan(); - // modify and invert m2 + // modify and invert m2 m2.Update_RankOne( v, w, 1.0f ); if ( !m2.Inverse_GaussJordan() ) { assert( 0 ); @@ -7314,7 +7314,7 @@ void idMatX::Test( void ) { // invert m1 m1.Inverse_GaussJordan(); - // modify and invert m2 + // modify and invert m2 m2.Update_Increment( v, w ); if ( !m2.Inverse_GaussJordan() ) { assert( 0 ); @@ -7386,7 +7386,7 @@ void idMatX::Test( void ) { // factor m1 m1.LU_Factor( index1 ); - // modify and factor m2 + // modify and factor m2 m2.Update_RankOne( v, w, 1.0f ); if ( !m2.LU_Factor( index2 ) ) { assert( 0 ); @@ -7450,7 +7450,7 @@ void idMatX::Test( void ) { // factor m1 m1.LU_Factor( index1 ); - // modify and factor m2 + // modify and factor m2 m2.Update_Increment( v, w ); if ( !m2.LU_Factor( index2 ) ) { assert( 0 ); @@ -7556,7 +7556,7 @@ void idMatX::Test( void ) { m1.QR_Factor( c, d ); m1.QR_UnpackFactors( q1, r1, c, d ); - // modify and factor m2 + // modify and factor m2 m2.Update_RankOne( v, w, 1.0f ); if ( !m2.QR_Factor( c, d ) ) { assert( 0 ); @@ -7626,7 +7626,7 @@ void idMatX::Test( void ) { m1.QR_Factor( c, d ); m1.QR_UnpackFactors( q1, r1, c, d ); - // modify and factor m2 + // modify and factor m2 m2.Update_Increment( v, w ); if ( !m2.QR_Factor( c, d ) ) { assert( 0 ); @@ -7752,7 +7752,7 @@ void idMatX::Test( void ) { m1.Cholesky_Factor(); m1.ClearUpperTriangle(); - // modify and factor m2 + // modify and factor m2 m2.Update_RankOneSymmetric( w, 1.0f ); if ( !m2.Cholesky_Factor() ) { assert( 0 ); @@ -7815,7 +7815,7 @@ void idMatX::Test( void ) { // factor m1 m1.Cholesky_Factor(); - // modify and factor m2 + // modify and factor m2 m2.Update_IncrementSymmetric( w ); if ( !m2.Cholesky_Factor() ) { assert( 0 ); @@ -7908,7 +7908,7 @@ void idMatX::Test( void ) { m1.LDLT_Factor(); m1.ClearUpperTriangle(); - // modify and factor m2 + // modify and factor m2 m2.Update_RankOneSymmetric( w, 1.0f ); if ( !m2.LDLT_Factor() ) { assert( 0 ); @@ -7969,7 +7969,7 @@ void idMatX::Test( void ) { // factor m1 m1.LDLT_Factor(); - // modify and factor m2 + // modify and factor m2 m2.Update_IncrementSymmetric( w ); if ( !m2.LDLT_Factor() ) { assert( 0 ); diff --git a/idlib/math/Matrix.h b/idlib/math/Matrix.h index 03867d0..40f444c 100644 --- a/idlib/math/Matrix.h +++ b/idlib/math/Matrix.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -158,16 +158,16 @@ ID_INLINE idMat2 idMat2::operator*( const idMat2 &a ) const { ID_INLINE idMat2 idMat2::operator*( const float a ) const { return idMat2( - mat[0].x * a, mat[0].y * a, + mat[0].x * a, mat[0].y * a, mat[1].x * a, mat[1].y * a ); } ID_INLINE idMat2 idMat2::operator+( const idMat2 &a ) const { return idMat2( - mat[0].x + a[0].x, mat[0].y + a[0].y, + mat[0].x + a[0].x, mat[0].y + a[0].y, mat[1].x + a[1].x, mat[1].y + a[1].y ); } - + ID_INLINE idMat2 idMat2::operator-( const idMat2 &a ) const { return idMat2( mat[0].x - a[0].x, mat[0].y - a[0].y, @@ -178,7 +178,7 @@ ID_INLINE idMat2 &idMat2::operator*=( const float a ) { mat[0].x *= a; mat[0].y *= a; mat[1].x *= a; mat[1].y *= a; - return *this; + return *this; } ID_INLINE idMat2 &idMat2::operator*=( const idMat2 &a ) { @@ -196,14 +196,14 @@ ID_INLINE idMat2 &idMat2::operator+=( const idMat2 &a ) { mat[0].x += a[0].x; mat[0].y += a[0].y; mat[1].x += a[1].x; mat[1].y += a[1].y; - return *this; + return *this; } ID_INLINE idMat2 &idMat2::operator-=( const idMat2 &a ) { mat[0].x -= a[0].x; mat[0].y -= a[0].y; mat[1].x -= a[1].x; mat[1].y -= a[1].y; - return *this; + return *this; } ID_INLINE idVec2 operator*( const idVec2 &vec, const idMat2 &mat ) { @@ -489,7 +489,7 @@ ID_INLINE idMat3 idMat3::operator+( const idMat3 &a ) const { mat[1].x + a[1].x, mat[1].y + a[1].y, mat[1].z + a[1].z, mat[2].x + a[2].x, mat[2].y + a[2].y, mat[2].z + a[2].z ); } - + ID_INLINE idMat3 idMat3::operator-( const idMat3 &a ) const { return idMat3( mat[0].x - a[0].x, mat[0].y - a[0].y, mat[0].z - a[0].z, @@ -499,10 +499,10 @@ ID_INLINE idMat3 idMat3::operator-( const idMat3 &a ) const { ID_INLINE idMat3 &idMat3::operator*=( const float a ) { mat[0].x *= a; mat[0].y *= a; mat[0].z *= a; - mat[1].x *= a; mat[1].y *= a; mat[1].z *= a; + mat[1].x *= a; mat[1].y *= a; mat[1].z *= a; mat[2].x *= a; mat[2].y *= a; mat[2].z *= a; - return *this; + return *this; } ID_INLINE idMat3 &idMat3::operator*=( const idMat3 &a ) { @@ -530,7 +530,7 @@ ID_INLINE idMat3 &idMat3::operator+=( const idMat3 &a ) { mat[1].x += a[1].x; mat[1].y += a[1].y; mat[1].z += a[1].z; mat[2].x += a[2].x; mat[2].y += a[2].y; mat[2].z += a[2].z; - return *this; + return *this; } ID_INLINE idMat3 &idMat3::operator-=( const idMat3 &a ) { @@ -538,7 +538,7 @@ ID_INLINE idMat3 &idMat3::operator-=( const idMat3 &a ) { mat[1].x -= a[1].x; mat[1].y -= a[1].y; mat[1].z -= a[1].z; mat[2].x -= a[2].x; mat[2].y -= a[2].y; mat[2].z -= a[2].z; - return *this; + return *this; } ID_INLINE idVec3 operator*( const idVec3 &vec, const idMat3 &mat ) { @@ -944,15 +944,15 @@ ID_INLINE idMat4 idMat4::operator*( const idMat4 &a ) const { } ID_INLINE idMat4 idMat4::operator+( const idMat4 &a ) const { - return idMat4( + return idMat4( mat[0].x + a[0].x, mat[0].y + a[0].y, mat[0].z + a[0].z, mat[0].w + a[0].w, mat[1].x + a[1].x, mat[1].y + a[1].y, mat[1].z + a[1].z, mat[1].w + a[1].w, mat[2].x + a[2].x, mat[2].y + a[2].y, mat[2].z + a[2].z, mat[2].w + a[2].w, mat[3].x + a[3].x, mat[3].y + a[3].y, mat[3].z + a[3].z, mat[3].w + a[3].w ); } - + ID_INLINE idMat4 idMat4::operator-( const idMat4 &a ) const { - return idMat4( + return idMat4( mat[0].x - a[0].x, mat[0].y - a[0].y, mat[0].z - a[0].z, mat[0].w - a[0].w, mat[1].x - a[1].x, mat[1].y - a[1].y, mat[1].z - a[1].z, mat[1].w - a[1].w, mat[2].x - a[2].x, mat[2].y - a[2].y, mat[2].z - a[2].z, mat[2].w - a[2].w, @@ -964,7 +964,7 @@ ID_INLINE idMat4 &idMat4::operator*=( const float a ) { mat[1].x *= a; mat[1].y *= a; mat[1].z *= a; mat[1].w *= a; mat[2].x *= a; mat[2].y *= a; mat[2].z *= a; mat[2].w *= a; mat[3].x *= a; mat[3].y *= a; mat[3].z *= a; mat[3].w *= a; - return *this; + return *this; } ID_INLINE idMat4 &idMat4::operator*=( const idMat4 &a ) { @@ -977,7 +977,7 @@ ID_INLINE idMat4 &idMat4::operator+=( const idMat4 &a ) { mat[1].x += a[1].x; mat[1].y += a[1].y; mat[1].z += a[1].z; mat[1].w += a[1].w; mat[2].x += a[2].x; mat[2].y += a[2].y; mat[2].z += a[2].z; mat[2].w += a[2].w; mat[3].x += a[3].x; mat[3].y += a[3].y; mat[3].z += a[3].z; mat[3].w += a[3].w; - return *this; + return *this; } ID_INLINE idMat4 &idMat4::operator-=( const idMat4 &a ) { @@ -985,7 +985,7 @@ ID_INLINE idMat4 &idMat4::operator-=( const idMat4 &a ) { mat[1].x -= a[1].x; mat[1].y -= a[1].y; mat[1].z -= a[1].z; mat[1].w -= a[1].w; mat[2].x -= a[2].x; mat[2].y -= a[2].y; mat[2].z -= a[2].z; mat[2].w -= a[2].w; mat[3].x -= a[3].x; mat[3].y -= a[3].y; mat[3].z -= a[3].z; mat[3].w -= a[3].w; - return *this; + return *this; } ID_INLINE idMat4 operator*( const float a, const idMat4 &mat ) { diff --git a/idlib/math/Ode.cpp b/idlib/math/Ode.cpp index 1f9d41e..1ce6db3 100644 --- a/idlib/math/Ode.cpp +++ b/idlib/math/Ode.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -109,16 +109,16 @@ idODE_Midpoint::~Evaluate */ float idODE_Midpoint::Evaluate( const float *state, float *newState, float t0, float t1 ) { double delta, halfDelta; - int i; + int i; delta = t1 - t0; halfDelta = delta * 0.5; - // first step + // first step derive( t0, userData, state, derivatives ); for ( i = 0; i < dimension; i++ ) { tmpState[i] = state[i] + halfDelta * derivatives[i]; } - // second step + // second step derive( t0 + halfDelta, userData, tmpState, derivatives ); for ( i = 0; i < dimension; i++ ) { @@ -333,16 +333,16 @@ float idODE_RK4Adaptive::Evaluate( const float *state, float *newState, float t0 } // get max estimated error - max = 0.0; + max = 0.0; for ( i = 0; i < dimension; i++ ) { error = idMath::Fabs( (newState[i] - tmpState[i]) / (delta * d1[i] + 1e-10) ); if ( error > max ) { max = error; } - } + } error = max / maxError; - if ( error <= 1.0f ) { + if ( error <= 1.0f ) { return delta * 4.0; } if ( delta <= 1e-7 ) { @@ -352,4 +352,3 @@ float idODE_RK4Adaptive::Evaluate( const float *state, float *newState, float t0 } return delta; } - diff --git a/idlib/math/Ode.h b/idlib/math/Ode.h index 11b7aaf..ae3ea22 100644 --- a/idlib/math/Ode.h +++ b/idlib/math/Ode.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Plane.cpp b/idlib/math/Plane.cpp index f77a6b5..7336053 100644 --- a/idlib/math/Plane.cpp +++ b/idlib/math/Plane.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Plane.h b/idlib/math/Plane.h index c0188bb..075687c 100644 --- a/idlib/math/Plane.h +++ b/idlib/math/Plane.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -163,7 +163,7 @@ ID_INLINE idPlane idPlane::operator-() const { return idPlane( -a, -b, -c, -d ); } -ID_INLINE idPlane &idPlane::operator=( const idVec3 &v ) { +ID_INLINE idPlane &idPlane::operator=( const idVec3 &v ) { a = v.x; b = v.y; c = v.z; @@ -192,7 +192,7 @@ ID_INLINE bool idPlane::Compare( const idPlane &p, const float epsilon ) const { if ( idMath::Fabs( a - p.a ) > epsilon ) { return false; } - + if ( idMath::Fabs( b - p.b ) > epsilon ) { return false; } diff --git a/idlib/math/Pluecker.cpp b/idlib/math/Pluecker.cpp index b35604c..de91698 100644 --- a/idlib/math/Pluecker.cpp +++ b/idlib/math/Pluecker.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Pluecker.h b/idlib/math/Pluecker.h index 22e1f10..bc8b66b 100644 --- a/idlib/math/Pluecker.h +++ b/idlib/math/Pluecker.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -38,7 +38,7 @@ If you have questions concerning this license or the applicable additional terms */ class idPluecker { -public: +public: idPluecker( void ); explicit idPluecker( const float *a ); explicit idPluecker( const idVec3 &start, const idVec3 &end ); @@ -62,7 +62,7 @@ public: bool operator==( const idPluecker &a ) const; // exact compare, no epsilon bool operator!=( const idPluecker &a ) const; // exact compare, no epsilon - void Set( const float a1, const float a2, const float a3, const float a4, const float a5, const float a6 ); + void Set( const float a1, const float a2, const float a3, const float a4, const float a5, const float a6 ); void Zero( void ); void FromLine( const idVec3 &start, const idVec3 &end ); // pluecker from line @@ -201,7 +201,7 @@ ID_INLINE bool idPluecker::Compare( const idPluecker &a, const float epsilon ) c if ( idMath::Fabs( p[0] - a[0] ) > epsilon ) { return false; } - + if ( idMath::Fabs( p[1] - a[1] ) > epsilon ) { return false; } diff --git a/idlib/math/Polynomial.cpp b/idlib/math/Polynomial.cpp index 5bd2925..4ee475f 100644 --- a/idlib/math/Polynomial.cpp +++ b/idlib/math/Polynomial.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Polynomial.h b/idlib/math/Polynomial.h index f019519..2ceac0c 100644 --- a/idlib/math/Polynomial.h +++ b/idlib/math/Polynomial.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -177,7 +177,7 @@ ID_INLINE idPolynomial idPolynomial::operator-() const { return n; } -ID_INLINE idPolynomial &idPolynomial::operator=( const idPolynomial &p ) { +ID_INLINE idPolynomial &idPolynomial::operator=( const idPolynomial &p ) { Resize( p.degree, false ); for ( int i = 0; i <= degree; i++ ) { coefficient[i] = p.coefficient[i]; diff --git a/idlib/math/Quat.cpp b/idlib/math/Quat.cpp index d039214..af2885e 100644 --- a/idlib/math/Quat.cpp +++ b/idlib/math/Quat.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Quat.h b/idlib/math/Quat.h index 0d57e4d..1bc0360 100644 --- a/idlib/math/Quat.h +++ b/idlib/math/Quat.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -55,7 +55,7 @@ public: idQuat( void ); idQuat( float x, float y, float z, float w ); - void Set( float x, float y, float z, float w ); + void Set( float x, float y, float z, float w ); float operator[]( int index ) const; float & operator[]( int index ); @@ -312,7 +312,7 @@ public: idCQuat( void ); idCQuat( float x, float y, float z ); - void Set( float x, float y, float z ); + void Set( float x, float y, float z ); float operator[]( int index ) const; float & operator[]( int index ); diff --git a/idlib/math/Random.h b/idlib/math/Random.h index 1de2070..a908cf0 100644 --- a/idlib/math/Random.h +++ b/idlib/math/Random.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Rotation.cpp b/idlib/math/Rotation.cpp index 11adb21..606b8cd 100644 --- a/idlib/math/Rotation.cpp +++ b/idlib/math/Rotation.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Rotation.h b/idlib/math/Rotation.h index 02bdf78..6250643 100644 --- a/idlib/math/Rotation.h +++ b/idlib/math/Rotation.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Simd.cpp b/idlib/math/Simd.cpp index 986cc0b..ff3b0db 100644 --- a/idlib/math/Simd.cpp +++ b/idlib/math/Simd.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -182,23 +182,23 @@ double ticksPerNanosecond; #ifdef __MWERKS__ //time_in_millisec is missing /* - .text + .text .align 2 .globl _GetTB _GetTB: loop: - mftbu r4 ; load from TBU - mftb r5 ; load from TBL - mftbu r6 ; load from TBU - cmpw r6, r4 ; see if old == new - bne loop ; if not, carry occured, therefore loop + mftbu r4 ; load from TBU + mftb r5 ; load from TBL + mftbu r6 ; load from TBU + cmpw r6, r4 ; see if old == new + bne loop ; if not, carry occured, therefore loop - stw r4, 0(r3) - stw r5, 4(r3) + stw r4, 0(r3) + stw r5, 4(r3) done: - blr ; return + blr ; return */ typedef struct { @@ -211,17 +211,17 @@ asm void GetTB(U64 *in) { nofralloc // suppress prolog machine 603 // allows the use of mftb & mftbu functions - -loop: + +loop: mftbu r5 // grab the upper time base register (TBU) mftb r4 // grab the lower time base register (TBL) - mftbu r6 // grab the upper time base register (TBU) again - + mftbu r6 // grab the upper time base register (TBU) again + cmpw r6,r5 // see if old TBU == new TBU bne- loop // loop if carry occurred (predict branch not taken) - - stw r4,4(r3) // store TBL in the low 32 bits of the return value - stw r5,0(r3) // store TBU in the high 32 bits of the return value + + stw r4,4(r3) // store TBL in the low 32 bits of the return value + stw r5,0(r3) // store TBU in the high 32 bits of the return value blr } @@ -251,7 +251,7 @@ double TBToDoubleNano( U64 startTime, U64 stopTime, double ticksPerNanosecond ) nanoTime = (double)(diffTime.hi)*((double)K_2POWER32) + (double)(diffTime.lo); nanoTime = nanoTime/ticksPerNanosecond; return (nanoTime); -} +} TIME_TYPE time_in_millisec( void ) { #define K_2POWER32 4294967296.0 @@ -276,7 +276,7 @@ TIME_TYPE time_in_millisec( void ) { } #define StartRecordTime( start ) \ - start = time_in_millisec(); + start = time_in_millisec(); #define StopRecordTime( end ) \ end = time_in_millisec(); @@ -284,7 +284,7 @@ TIME_TYPE time_in_millisec( void ) { #else #define StartRecordTime( start ) \ - start = mach_absolute_time(); + start = mach_absolute_time(); #define StopRecordTime( end ) \ end = mach_absolute_time(); @@ -3104,8 +3104,8 @@ void TestNormalizeTangents( void ) { if ( !drawVerts1[i].tangents[1].Compare( drawVerts2[i].tangents[1], 1e-2f ) ) { break; } - - // since we're doing a lot of unaligned work, added this check to + + // since we're doing a lot of unaligned work, added this check to // make sure xyz wasn't getting overwritten if ( !drawVerts1[i].xyz.Compare( drawVerts2[i].xyz, 1e-2f ) ) { break; @@ -4049,7 +4049,7 @@ void TestNegate( void ) { ALIGN16( float fsrc0[COUNT] ); ALIGN16( float fsrc1[COUNT] ); ALIGN16( float fsrc2[COUNT] ); - + const char *result; idRandom srnd( RANDOM_SEED ); @@ -4063,9 +4063,9 @@ void TestNegate( void ) { bestClocksGeneric = 0; for ( i = 0; i < NUMTESTS; i++ ) { - + memcpy( &fsrc1[0], &fsrc0[0], COUNT * sizeof(float) ); - + StartRecordTime( start ); p_generic->Negate16( fsrc1, COUNT ); StopRecordTime( end ); @@ -4075,9 +4075,9 @@ void TestNegate( void ) { bestClocksSIMD = 0; for ( i = 0; i < NUMTESTS; i++ ) { - + memcpy( &fsrc2[0], &fsrc0[0], COUNT * sizeof(float) ); - + StartRecordTime( start ); p_simd->Negate16( fsrc2, COUNT ); StopRecordTime( end ); diff --git a/idlib/math/Simd.h b/idlib/math/Simd.h index 84e19bc..309c364 100644 --- a/idlib/math/Simd.h +++ b/idlib/math/Simd.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Simd_3DNow.cpp b/idlib/math/Simd_3DNow.cpp index 1565eaa..798ef86 100644 --- a/idlib/math/Simd_3DNow.cpp +++ b/idlib/math/Simd_3DNow.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -74,7 +74,7 @@ const char * idSIMD_3DNow::GetName( void ) const { // uses the software prefetch instruction to pre-read the data. // USE 64 * 1024 FOR THIS VALUE IF YOU'RE ALWAYS FILLING A "CLEAN CACHE" -#define BLOCK_PREFETCH_COPY infinity // no limit for movq/movntq w/block prefetch +#define BLOCK_PREFETCH_COPY infinity // no limit for movq/movntq w/block prefetch #define CACHEBLOCK 80h // number of 64-byte blocks (cache lines) for block prefetch // For the largest size blocks, a special technique called Block Prefetch // can be used to accelerate the read operations. Block Prefetch reads @@ -246,7 +246,7 @@ $memcpy_bp_3: add esi, 64 // update source pointer movntq [edi ], mm0 // write 64 bits, bypassing cache movntq [edi+ 8], mm1 // note: movntq also prevents the CPU - movntq [edi+16], mm2 // from READING the destination address + movntq [edi+16], mm2 // from READING the destination address movntq [edi+24], mm3 // into the cache, only to be over-written, movntq [edi+32], mm4 // so that also helps performance movntq [edi+40], mm5 @@ -286,12 +286,12 @@ $memcpy_last_few: // dword aligned from before movsd's jz $memcpy_final // no more, let's leave rep movsb // the last 1, 2, or 3 bytes -$memcpy_final: +$memcpy_final: emms // clean up the MMX state sfence // flush the write buffer mov eax, [dest] // ret value = destination pointer - } + } } #endif /* _WIN32 */ diff --git a/idlib/math/Simd_3DNow.h b/idlib/math/Simd_3DNow.h index 91108f5..9f3d0b1 100644 --- a/idlib/math/Simd_3DNow.h +++ b/idlib/math/Simd_3DNow.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Simd_AltiVec.cpp b/idlib/math/Simd_AltiVec.cpp index 17bc327..e5a2d8f 100644 --- a/idlib/math/Simd_AltiVec.cpp +++ b/idlib/math/Simd_AltiVec.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -68,19 +68,19 @@ If you have questions concerning this license or the applicable additional terms #define IDVEC4_OFFSET 4 // Alignment tests -#define IS_16BYTE_ALIGNED( x ) ( ( (unsigned long)&x & 0x0F ) == 0 ) +#define IS_16BYTE_ALIGNED( x ) ( ( (unsigned long)&x & 0x0F ) == 0 ) #define NOT_16BYTE_ALIGNED( x ) ( ( (unsigned long)&x & 0x0F) != 0 ) // Aligned storing floats #define ALIGNED_STORE2( ADDR, V0, V1 ) \ vec_st( V0, 0, ADDR ); \ - vec_st( V1, 16, ADDR ) - + vec_st( V1, 16, ADDR ) + #define ALIGNED_STORE3( ADDR, V0, V1, V2 ) \ vec_st( V0, 0, ADDR ); \ vec_st( V1, 16, ADDR ); \ vec_st( V2, 32, ADDR ) - + #define ALIGNED_STORE4( ADDR, V0, V1, V2, V3 ) \ vec_st( V0, 0, ADDR ); \ vec_st( V1, 16, ADDR ); \ @@ -94,7 +94,7 @@ If you have questions concerning this license or the applicable additional terms vec_st( V3, 48, ADDR ); \ vec_st( V4, 64, ADDR ); \ vec_st( V5, 80, ADDR ) - + #define ALIGNED_STORE8( ADDR, V0, V1, V2, V3, V4, V5, V6, V7 ) \ vec_st( V0, 0, ADDR ); \ vec_st( V1, 16, ADDR ); \ @@ -103,8 +103,8 @@ If you have questions concerning this license or the applicable additional terms vec_st( V4, 64, ADDR ); \ vec_st( V5, 80, ADDR ); \ vec_st( V6, 96, ADDR ); \ - vec_st( V7, 112, ADDR ) - + vec_st( V7, 112, ADDR ) + // Unaligned storing floats. These assume that we can trash the input #define UNALIGNED_STORE1( ADDR, V0 ) { \ /* use store element */ \ @@ -114,7 +114,7 @@ If you have questions concerning this license or the applicable additional terms vec_ste( V0, 4, ADDR ); \ vec_ste( V0, 8, ADDR ); \ vec_ste( V0, 12, ADDR ); \ - } + } #define UNALIGNED_STORE2( ADDR, V0, V1 ) { \ /* load up the values that are there now */ \ @@ -301,8 +301,8 @@ inline void debugPrintVector( vector unsigned short v, char *msg ) { For each element in vector: n = 1 / n =============== -*/ - +*/ + // Use Newton-Raphson to calculate reciprocal of a vector inline vector float Reciprocal( vector float v ) { //Get the reciprocal estimate @@ -319,14 +319,14 @@ inline vector float Reciprocal( vector float v ) { n = 1 / sqrt(n) =============== */ -// Reciprocal square root estimate of a vector +// Reciprocal square root estimate of a vector inline vector float ReciprocalSquareRoot( vector float v ) { //Get the square root reciprocal estimate vector float zero = (vector float)(0); vector float oneHalf = (vector float)(0.5); vector float one = (vector float)(1.0); vector float estimate = vec_rsqrte( vec_max( v, (vector float)(FLT_MIN) ) ); - + //One round of Newton-Raphson refinement vector float estimateSquared = vec_madd( estimate, estimate, zero ); vector float halfEstimate = vec_madd( estimate, oneHalf, zero ); @@ -372,16 +372,16 @@ inline vector float loadSplatUnalignedScalar( const float *s ) { */ // calculates arc tangent of a vector with 16 bits of precision, based on atan16 in idMath inline vector float VectorATan16( vector float x, vector float y ) { - + vector float xDivY = Divide( x, y ); vector float yDivX = Divide( y, x ); vector float zeroVector = (vector float)(0); - + vector bool int vecCmp = vec_cmpgt( vec_abs( y ), vec_abs( x ) ); vector float vecA = vec_sel( yDivX, xDivY, vecCmp ); vector bool int vecCmp2 = vec_cmplt( vecA, zeroVector ); vector float vecS = vec_madd( vecA, vecA, (vector float)(0) ); - + // do calculation for S vector float vecWork1 = vec_madd( (vector float)(0.0028662257f), vecS, (vector float)(-0.0161657367f) ); vecWork1 = vec_madd( vecWork1, vecS, (vector float)(0.0429096138f) ); @@ -391,15 +391,15 @@ inline vector float VectorATan16( vector float x, vector float y ) { vecWork1 = vec_madd( vecWork1, vecS, (vector float)(0.1999355085f) ); vecWork1 = vec_madd( vecWork1, vecS, (vector float)(-0.3333314528f) ); vecWork1 = vec_madd( vecWork1, vecS, (vector float)(1) ); - + // get the regular S value vecS = vec_madd( vecWork1, vecA, (vector float)(0) ); - + // calculate what to return if y > x vector float negSPlusHalfPI = vec_madd( vecS, (vector float)(-1), (vector float)(0.5f * 3.14159265358979323846f) ); vector float negSMinusHalfPI = vec_madd( vecS, (vector float)(-1), (vector float)(-0.5f * 3.14159265358979323846f) ); vector float modRet = vec_sel( negSPlusHalfPI, negSMinusHalfPI, vecCmp2 ); - + return vec_sel( modRet, vecS, vecCmp ); } @@ -414,26 +414,26 @@ inline vector float VectorATan16( vector float x, vector float y ) { inline vector float VectorSin16( vector float v ) { vector float zero = (vector float)(0); -#if 0 +#if 0 // load up half PI and use it to calculate the rest of the values. This is // sometimes cheaper than loading them from memory - + vector float halfPI = (vector float) ( 0.5f * 3.14159265358979323846f ); - vector float PI = vec_add( halfPI, halfPI ); - vector float oneandhalfPI = vec_add( PI, halfPI ); + vector float PI = vec_add( halfPI, halfPI ); + vector float oneandhalfPI = vec_add( PI, halfPI ); vector float twoPI = vec_add( oneandhalfPI, halfPI ); #else vector float halfPI = (vector float) ( 0.5f * 3.14159265358979323846f ); vector float PI = (vector float)(3.14159265358979323846f); vector float oneandhalfPI = (vector float)(3.14159265358979323846f + ( 0.5f * 3.14159265358979323846f ) ); vector float twoPI = (vector float)( 2.0f * 3.14159265358979323846f); -#endif - +#endif + vector bool int vecCmp1, vecCmp2, vecCmp3, vecCmp4; - + vector float vecMod; vector float vecResult; - + // fix the range if needbe vecMod = vec_floor( Divide( v, twoPI ) ); vecResult = vec_nmsub( vecMod, twoPI, v ); @@ -446,14 +446,14 @@ inline vector float VectorSin16( vector float v ) { // these are the ones where a > PI + HALF_PI so set a = a - TWO_PI vecCmp3 = vec_cmpgt( vecResult, oneandhalfPI ); - + // we also want to set a = PI - a everywhere that !(a < PI) and !(a > PI + HALF_PI) vecCmp4 = vec_and( vec_xor( vecCmp3, (vector bool int)(1) ), vec_xor( vecCmp1, (vector bool int)(1) ) ); // everywhere that both of those are false - + // these are ones where a < PI and a > HALF_PI so we set a = PI - a vecCmp1 = vec_and( vecCmp1, vecCmp2 ); vecCmp1 = vec_or( vecCmp1, vecCmp4 ); - + // put the correct values into place vecResult = vec_sel( vecResult, vecPIminusA, vecCmp1 ); vecResult = vec_sel( vecResult, vecAminus2PI, vecCmp3 ); @@ -487,7 +487,7 @@ inline vector float vecSplatWithRunTime( vector float v, int i ) { /* =============== FastScalarInvSqrt - + n = 1 / sqrt( f ) =============== */ @@ -497,9 +497,9 @@ inline float FastScalarInvSqrt( float f ) { const float kSmallestFloat = FLT_MIN; //Calculate a 5 bit starting estimate for the reciprocal sqrt - estimate = __frsqrte ( f + kSmallestFloat ); + estimate = __frsqrte ( f + kSmallestFloat ); - //if you require less precision, you may reduce the number of loop iterations. + //if you require less precision, you may reduce the number of loop iterations. // This will do 2 rounds of NR estimate = estimate + 0.5f * estimate * ( 1.0f - f * estimate * estimate ); estimate = estimate + 0.5f * estimate * ( 1.0f - f * estimate * estimate ); @@ -512,10 +512,10 @@ inline float FastScalarInvSqrt( float f ) { /* =============== FastScalarInvSqrt_x3 - + arg1 = 1 / sqrt( arg1 ) arg2 = 1 / sqrt( arg2 ) - arg3 = 1 / sqrt( arg3 ) + arg3 = 1 / sqrt( arg3 ) =============== */ inline void FastScalarInvSqrt_x3( float *arg1, float *arg2, float *arg3 ) { @@ -524,7 +524,7 @@ inline void FastScalarInvSqrt_x3( float *arg1, float *arg2, float *arg3 ) { const float kSmallestFloat = FLT_MIN; //Calculate a 5 bit starting estimate for the reciprocal sqrt of each - estimate1 = __frsqrte ( *arg1 + kSmallestFloat ); + estimate1 = __frsqrte ( *arg1 + kSmallestFloat ); estimate2 = __frsqrte ( *arg2 + kSmallestFloat ); estimate3 = __frsqrte ( *arg3 + kSmallestFloat ); @@ -549,13 +549,13 @@ inline void FastScalarInvSqrt_x3( float *arg1, float *arg2, float *arg3 ) { /* =============== FastScalarInvSqrt_x6 - + arg1 = 1 / sqrt( arg1 ) arg2 = 1 / sqrt( arg2 ) - arg3 = 1 / sqrt( arg3 ) - arg4 = 1 / sqrt( arg4 ) - arg5 = 1 / sqrt( arg5 ) - arg6 = 1 / sqrt( arg6 ) + arg3 = 1 / sqrt( arg3 ) + arg4 = 1 / sqrt( arg4 ) + arg5 = 1 / sqrt( arg5 ) + arg6 = 1 / sqrt( arg6 ) On a G5, you've got 2 pipeline stages to fill. (2 FPU's with 6 stages each) =============== @@ -566,7 +566,7 @@ inline void FastScalarInvSqrt_x6( float *arg1, float *arg2, float *arg3, float * const float kSmallestFloat = FLT_MIN; //Calculate a 5 bit starting estimate for the reciprocal sqrt of each - estimate1 = __frsqrte ( *arg1 + kSmallestFloat ); + estimate1 = __frsqrte ( *arg1 + kSmallestFloat ); estimate2 = __frsqrte ( *arg2 + kSmallestFloat ); estimate3 = __frsqrte ( *arg3 + kSmallestFloat ); estimate4 = __frsqrte ( *arg4 + kSmallestFloat ); @@ -600,7 +600,7 @@ inline void FastScalarInvSqrt_x6( float *arg1, float *arg2, float *arg3, float * *arg3 = idMath::InvSqrt( *arg3 ); *arg4 = idMath::InvSqrt( *arg4 ); *arg5 = idMath::InvSqrt( *arg5 ); - *arg6 = idMath::InvSqrt( *arg6 ); + *arg6 = idMath::InvSqrt( *arg6 ); #endif } @@ -617,45 +617,45 @@ idSIMD_AltiVec::Add ============ */ void VPCALL idSIMD_AltiVec::Add( float *dst, const float constant, const float *src, const int count ) { - vector float v0, v1, v2, v3; + vector float v0, v1, v2, v3; vector float v0_low, v0_hi, v1_hi; - vector unsigned char permVec; - vector float constVec; - int i; - - // handle unaligned cases at beginning - for ( i = 0; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { - dst[i] = constant + src[i]; - } - - //splat constant into a vector - constVec = loadSplatUnalignedScalar( &constant ); - - //calculate permute and do first load - permVec = vec_add( vec_lvsl( -1, (int*) &src[i] ), (vector unsigned char)(1) ); - v1_hi = vec_ld( 0, &src[i] ); + vector unsigned char permVec; + vector float constVec; + int i; - //vectorize! - for ( ; i+7 < count; i += 8 ) { + // handle unaligned cases at beginning + for ( i = 0; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { + dst[i] = constant + src[i]; + } + + //splat constant into a vector + constVec = loadSplatUnalignedScalar( &constant ); + + //calculate permute and do first load + permVec = vec_add( vec_lvsl( -1, (int*) &src[i] ), (vector unsigned char)(1) ); + v1_hi = vec_ld( 0, &src[i] ); + + //vectorize! + for ( ; i+7 < count; i += 8 ) { //load source - v0_low = v1_hi; + v0_low = v1_hi; v0_hi = vec_ld( 15, &src[i] ); v1_hi = vec_ld( 31, &src[i] ); - + v0 = vec_perm( v0_low, v0_hi, permVec ); v1 = vec_perm( v0_hi, v1_hi, permVec ); - + v2 = vec_add( v0, constVec ); v3 = vec_add( v1, constVec ); - + // store results ALIGNED_STORE2( &dst[i], v2, v3 ); } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] = constant + src[i]; - } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] = constant + src[i]; + } } /* @@ -666,58 +666,58 @@ idSIMD_AltiVec::Add ============ */ void VPCALL idSIMD_AltiVec::Add( float *dst, const float *src0, const float *src1, const int count ) { - - register vector float v0, v1, v2, v3, v4, v5; - //src0 + + register vector float v0, v1, v2, v3, v4, v5; + //src0 register vector float v0_low, v0_hi, v2_low, v2_hi; //src1 register vector float v1_low, v1_hi, v3_low, v3_hi; //permute vectors register vector unsigned char permVec1, permVec2; vector unsigned char oneCharVector = (vector unsigned char)(1); - + int i; - - //unaligned at start - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { - dst[i] = src0[i] + src1[i]; - } - + + //unaligned at start + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { + dst[i] = src0[i] + src1[i]; + } + //calculate permute and do loads permVec1 = vec_add( vec_lvsl( -1, (int*) &src0[i] ), oneCharVector ); permVec2 = vec_add( vec_lvsl( -1, (int*) &src1[i] ), oneCharVector ); v2_hi = vec_ld( 0, &src0[i] ); v3_hi = vec_ld( 0, &src1[i] ); - - //vectorize! - for ( ; i+7 < count; i += 8 ) { + + //vectorize! + for ( ; i+7 < count; i += 8 ) { //load source v0_low = v2_hi; v0_hi = vec_ld( 15, &src0[i] ); v2_low = v0_hi; v2_hi = vec_ld( 31, &src0[i] ); - + v1_low = v3_hi; v1_hi = vec_ld( 15, &src1[i] ); v3_low = v1_hi; v3_hi = vec_ld( 31, &src1[i] ); - + v0 = vec_perm( v0_low, v0_hi, permVec1 ); v1 = vec_perm( v1_low, v1_hi, permVec2 ); v2 = vec_perm( v2_low, v2_hi, permVec1 ); v3 = vec_perm( v3_low, v3_hi, permVec2 ); - + v4 = vec_add( v0, v1 ); v5 = vec_add( v2, v3 ); - + ALIGNED_STORE2( &dst[i], v4, v5 ); - + + } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] = src0[i] + src1[i]; } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] = src0[i] + src1[i]; - } } /* @@ -729,46 +729,46 @@ idSIMD_AltiVec::Sub */ void VPCALL idSIMD_AltiVec::Sub( float *dst, const float constant, const float *src, const int count ) { - register vector float v0, v1, v2, v3; + register vector float v0, v1, v2, v3; register vector float v0_low, v0_hi, v1_low, v1_hi; - register vector unsigned char permVec; - register vector float constVec; + register vector unsigned char permVec; + register vector float constVec; vector unsigned char oneCharVector = (vector unsigned char)(1); - int i; - - //handle unaligned at start - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { + int i; + + //handle unaligned at start + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { dst[i] = constant - src[i]; - } - - //splat constant into a vector - constVec = loadSplatUnalignedScalar( &constant ); - + } + + //splat constant into a vector + constVec = loadSplatUnalignedScalar( &constant ); + //calculate permute vector and do first load permVec = vec_add( vec_lvsl( -1, (int*) &src[i] ), oneCharVector ); v1_hi = vec_ld( 0, &src[i] ); - - //vectorize! - for ( ; i+7 < count; i += 8 ) { + + //vectorize! + for ( ; i+7 < count; i += 8 ) { //load source v0_low = v1_hi; v0_hi = vec_ld( 15, &src[i] ); v1_low = v0_hi; v1_hi = vec_ld( 31, &src[i] ); - + v0 = vec_perm( v0_low, v0_hi, permVec ); v1 = vec_perm( v1_low, v1_hi, permVec ); - + v2 = vec_sub( constVec, v0 ); v3 = vec_sub( constVec, v1 ); - + ALIGNED_STORE2( &dst[i], v2, v3 ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] = constant - src[i]; - } + } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] = constant - src[i]; + } } /* @@ -779,54 +779,54 @@ idSIMD_AltiVec::Sub ============ */ void VPCALL idSIMD_AltiVec::Sub( float *dst, const float *src0, const float *src1, const int count ) { - register vector float v0, v1, v2, v3, v4, v5; + register vector float v0, v1, v2, v3, v4, v5; //src0 register vector float v0_low, v0_hi, v2_low, v2_hi; //src1 register vector float v1_low, v1_hi, v3_low, v3_hi; - register vector unsigned char permVec1, permVec2; + register vector unsigned char permVec1, permVec2; vector unsigned char oneCharVector = (vector unsigned char)(1); int i; - //handle unaligned at start - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { + //handle unaligned at start + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { dst[i] = src0[i] - src1[i]; - } - + } + //calculate permute and do first loads permVec1 = vec_add( vec_lvsl( -1, (int*) &src0[i] ), oneCharVector ); permVec2 = vec_add( vec_lvsl( -1, (int*) &src1[i] ), oneCharVector ); v2_hi = vec_ld( 0, &src0[i] ); v3_hi = vec_ld( 0, &src1[i] ); - - //vectorize! - for ( ; i+7 < count; i += 8 ) { + + //vectorize! + for ( ; i+7 < count; i += 8 ) { //load source v0_low = v2_hi; v0_hi = vec_ld( 15, &src0[i] ); v2_low = v0_hi; v2_hi = vec_ld( 31, &src0[i] ); - + v1_low = v3_hi; v1_hi = vec_ld( 15, &src1[i] ); v3_low = v1_hi; v3_hi = vec_ld( 31, &src1[i] ); - + v0 = vec_perm( v0_low, v0_hi, permVec1 ); v1 = vec_perm( v1_low, v1_hi, permVec2 ); v2 = vec_perm( v2_low, v2_hi, permVec1 ); v3 = vec_perm( v3_low, v3_hi, permVec2 ); - + v4 = vec_sub( v0, v1 ); v5 = vec_sub( v2, v3 ); ALIGNED_STORE2( &dst[i], v4, v5 ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] = src0[i] - src1[i]; - } + } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] = src0[i] - src1[i]; + } } /* @@ -837,26 +837,26 @@ idSIMD_AltiVec::Mul ============ */ void VPCALL idSIMD_AltiVec::Mul( float *dst, const float constant, const float *src, const int count) { - register vector float v0, v0_low, v0_hi, v1_low, v1_hi, v1, v2, v3; - register vector float constVec; - register vector unsigned char permVec; + register vector float v0, v0_low, v0_hi, v1_low, v1_hi, v1, v2, v3; + register vector float constVec; + register vector unsigned char permVec; vector unsigned char oneCharVector = (vector unsigned char)(1); - register vector float zeroVector = (vector float)(0.0); - int i; - - // handle unaligned data at start - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { - dst[i] = constant * src[i]; - } - - //splat constant into a vector - constVec = loadSplatUnalignedScalar( &constant ); - + register vector float zeroVector = (vector float)(0.0); + int i; + + // handle unaligned data at start + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + dst[i] = constant * src[i]; + } + + //splat constant into a vector + constVec = loadSplatUnalignedScalar( &constant ); + permVec = vec_add( vec_lvsl( -1, (int*) &src[i] ), oneCharVector ); - v1_hi = vec_ld( 0, &src[i] ); - - //vectorize! - for ( ; i+7 < count; i += 8 ) { + v1_hi = vec_ld( 0, &src[i] ); + + //vectorize! + for ( ; i+7 < count; i += 8 ) { //load source v0_low = v1_hi; v0_hi = vec_ld( 15, &src[i] ); @@ -865,17 +865,17 @@ void VPCALL idSIMD_AltiVec::Mul( float *dst, const float constant, const float * v0 = vec_perm( v0_low, v0_hi, permVec ); v1 = vec_perm( v1_low, v1_hi, permVec ); - + v2 = vec_madd( constVec, v0, zeroVector ); v3 = vec_madd( constVec, v1, zeroVector ); ALIGNED_STORE2( &dst[i], v2, v3 ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] = constant * src[i]; - } + } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] = constant * src[i]; + } } /* @@ -886,58 +886,58 @@ idSIMD_AltiVec::Mul ============ */ void VPCALL idSIMD_AltiVec::Mul( float *dst, const float *src0, const float *src1, const int count ) { - register vector float v0, v1, v2, v3, v4, v5; + register vector float v0, v1, v2, v3, v4, v5; //src0 register vector float v0_low, v0_hi, v2_low, v2_hi; //src1 register vector float v1_low, v1_hi, v3_low, v3_hi; //permute vectors register vector unsigned char permVec1, permVec2; - register vector float constVec = (vector float)(0.0); + register vector float constVec = (vector float)(0.0); vector unsigned char oneCharVector = (vector unsigned char)(1); - int i; - - //handle unaligned at start - for ( i = 0; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + int i; + + //handle unaligned at start + for ( i = 0; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { dst[i] = src0[i] * src1[i]; - } - + } + //calculate permute and do loads permVec1 = vec_add( vec_lvsl( -1, (int*) &src0[i] ), oneCharVector ); permVec2 = vec_add( vec_lvsl( -1, (int*) &src1[i] ), oneCharVector ); v2_hi = vec_ld( 0, &src0[i] ); v3_hi = vec_ld( 0, &src1[i] ); - - //vectorize! - for ( ; i+7 < count; i += 8 ) { + + //vectorize! + for ( ; i+7 < count; i += 8 ) { //load source v0_low = v2_hi; v0_hi = vec_ld( 15, &src0[i] ); v2_low = v0_hi; v2_hi = vec_ld( 31, &src0[i] ); - + v1_low = v3_hi; v1_hi = vec_ld( 15, &src1[i] ); v3_low = v1_hi; v3_hi = vec_ld( 31, &src1[i] ); - + v0 = vec_perm( v0_low, v0_hi, permVec1 ); v1 = vec_perm( v1_low, v1_hi, permVec2 ); v2 = vec_perm( v2_low, v2_hi, permVec1 ); v3 = vec_perm( v3_low, v3_hi, permVec2 ); - + //no such thing as regular multiply so we do //multiply then add zero v4 = vec_madd( v0, v1, constVec ); v5 = vec_madd( v2, v3, constVec ); ALIGNED_STORE2( &dst[i], v4, v5 ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] = src0[i] * src1[i]; - } + } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] = src0[i] * src1[i]; + } } /* @@ -948,46 +948,46 @@ idSIMD_AltiVec::Div ============ */ void VPCALL idSIMD_AltiVec::Div( float *dst, const float constant, const float *divisor, const int count ) { - register vector float v0, v1, v2, v3; - register vector float v0_low, v0_hi, v1_low, v1_hi; + register vector float v0, v1, v2, v3; + register vector float v0_low, v0_hi, v1_low, v1_hi; register vector unsigned char permVec; - register vector float constVec; - vector unsigned char oneCharVector = (vector unsigned char)(1); + register vector float constVec; + vector unsigned char oneCharVector = (vector unsigned char)(1); int i; - - //handle unaligned at start - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + + //handle unaligned at start + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { dst[i] = constant / divisor[i]; - } - - //splat constant into a vector - constVec = loadSplatUnalignedScalar( &constant ); - + } + + //splat constant into a vector + constVec = loadSplatUnalignedScalar( &constant ); + //calculate permute and do first loads permVec = vec_add( vec_lvsl( -1, (int*) &divisor[i] ), oneCharVector ); - v1_hi = vec_ld( 0, &divisor[i] ); + v1_hi = vec_ld( 0, &divisor[i] ); - //vectorize! - for ( ; i+7 < count; i += 8 ) { + //vectorize! + for ( ; i+7 < count; i += 8 ) { //load source v0_low = v1_hi; v0_hi = vec_ld( 15, &divisor[i] ); v1_low = v0_hi; v1_hi = vec_ld( 31, &divisor[i] ); - + v0 = vec_perm( v0_low, v0_hi, permVec ); v1 = vec_perm( v1_low, v1_hi, permVec ); - + v2 = Divide( constVec, v0 ); v3 = Divide( constVec, v1 ); - + ALIGNED_STORE2( &dst[i], v2, v3 ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] = constant / divisor[i]; - } + } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] = constant / divisor[i]; + } } /* @@ -998,55 +998,55 @@ idSIMD_AltiVec::Div ============ */ void VPCALL idSIMD_AltiVec::Div( float *dst, const float *src0, const float *src1, const int count ) { - register vector float v0, v1, v2, v3, v4, v5; + register vector float v0, v1, v2, v3, v4, v5; //src0 register vector float v0_low, v0_hi, v2_low, v2_hi; //src1 register vector float v1_low, v1_hi, v3_low, v3_hi; //permute vectors register vector unsigned char permVec1, permVec2; - vector unsigned char oneCharVector = (vector unsigned char)(1); + vector unsigned char oneCharVector = (vector unsigned char)(1); int i; - //handle unaligned at start - for ( i = 0; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + //handle unaligned at start + for ( i = 0; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { dst[i] = src0[i] / src1[i]; - } - + } + //calculate permute and do loads permVec1 = vec_add( vec_lvsl( -1, (int*) &src0[i] ), oneCharVector ); permVec2 = vec_add( vec_lvsl( -1, (int*) &src1[i] ), oneCharVector ); v2_hi = vec_ld( 0, &src0[i] ); v3_hi = vec_ld( 0, &src1[i] ); - - //vectorize! - for ( ; i+7 < count; i += 8 ) { - //load source + + //vectorize! + for ( ; i+7 < count; i += 8 ) { + //load source v0_low = v2_hi; v0_hi = vec_ld( 15, &src0[i] ); v2_low = v0_hi; v2_hi = vec_ld( 31, &src0[i] ); - + v1_low = v3_hi; v1_hi = vec_ld( 15, &src1[i] ); v3_low = v1_hi; v3_hi = vec_ld( 31, &src1[i] ); - + v0 = vec_perm( v0_low, v0_hi, permVec1 ); v1 = vec_perm( v1_low, v1_hi, permVec2 ); v2 = vec_perm( v2_low, v2_hi, permVec1 ); v3 = vec_perm( v3_low, v3_hi, permVec2 ); - + v4 = Divide( v0, v1 ); v5 = Divide( v2, v3 ); - + ALIGNED_STORE2( &dst[i], v4, v5 ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] = src0[i] / src1[i]; - } + } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] = src0[i] / src1[i]; + } } /* @@ -1057,64 +1057,64 @@ idSIMD_AltiVec::MulAdd ============ */ void VPCALL idSIMD_AltiVec::MulAdd( float *dst, const float constant, const float *src, const int count ) { - - register vector float v0, v1, v2, v3, v4, v5; - register vector float constVec; + + register vector float v0, v1, v2, v3, v4, v5; + register vector float constVec; //src register vector float v0_low, v0_hi, v2_low, v2_hi; //permute vectors register vector unsigned char permVec1; vector unsigned char oneCharVector = (vector unsigned char)(1); - int i; + int i; - //handle unaligned at start - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + //handle unaligned at start + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { dst[i] += constant * src[i]; - } - - //splat constant into a vector + } + + //splat constant into a vector constVec = loadSplatUnalignedScalar( &constant ); - + //calculate permute and do loads permVec1 = vec_add( vec_lvsl( -1, (int*) &src[i] ), oneCharVector ); v2_hi = vec_ld( 0, &src[i] ); - - //vectorize! - for ( ; i+7 < count; i += 8 ) { + + //vectorize! + for ( ; i+7 < count; i += 8 ) { v0_low = v2_hi; v0_hi = vec_ld( 15, &src[i] ); v2_low = v0_hi; v2_hi = vec_ld( 31, &src[i] ); - + v0 = vec_perm( v0_low, v0_hi, permVec1 ); v2 = vec_perm( v2_low, v2_hi, permVec1 ); // at this point, dst is known to be aligned v1 = vec_ld( 0, &dst[i] ); v3 = vec_ld( 16, &dst[i] ); - + v4 = vec_madd( constVec, v0, v1 ); v5 = vec_madd( constVec, v2, v3 ); - + ALIGNED_STORE2( &dst[i], v4, v5 ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] += constant * src[i]; - } + } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] += constant * src[i]; + } } /* ============ idSIMD_AltiVec::MulAdd - dst[i] += src0[i] * src1[i]; + dst[i] += src0[i] * src1[i]; ============ */ void VPCALL idSIMD_AltiVec::MulAdd( float *dst, const float *src0, const float *src1, const int count ) { - register vector float v0, v1, v2, v3, v4, v5, v6, v7; - //src0 + register vector float v0, v1, v2, v3, v4, v5, v6, v7; + //src0 register vector float v0_low, v0_hi, v2_low, v2_hi; //src1 register vector float v1_low, v1_hi, v3_low, v3_hi; @@ -1122,52 +1122,52 @@ void VPCALL idSIMD_AltiVec::MulAdd( float *dst, const float *src0, const float * register vector unsigned char permVec1, permVec2; vector unsigned char oneCharVector = (vector unsigned char)(1); - int i; - - //unaligned at start - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + int i; + + //unaligned at start + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { dst[i] += src0[i] * src1[i]; - } - + } + //calculate permute and do loads permVec1 = vec_add( vec_lvsl( -1, (int*) &src0[i] ), oneCharVector ); permVec2 = vec_add( vec_lvsl( -1, (int*) &src1[i] ), oneCharVector ); v2_hi = vec_ld( 0, &src0[i] ); v3_hi = vec_ld( 0, &src1[i] ); - - //vectorize! - for ( ; i+7 < count; i += 8 ) { + + //vectorize! + for ( ; i+7 < count; i += 8 ) { // load sources v0_low = v2_hi; v0_hi = vec_ld( 15, &src0[i] ); v2_low = v0_hi; v2_hi = vec_ld( 31, &src0[i] ); - + v1_low = v3_hi; v1_hi = vec_ld( 15, &src1[i] ); v3_low = v1_hi; v3_hi = vec_ld( 31, &src1[i] ); - + v0 = vec_perm( v0_low, v0_hi, permVec1 ); v1 = vec_perm( v1_low, v1_hi, permVec2 ); v2 = vec_perm( v2_low, v2_hi, permVec1 ); v3 = vec_perm( v3_low, v3_hi, permVec2 ); - + //we know dst is aligned because we handled unaligned cases //up front v4 = vec_ld( 0, &dst[i] ); v5 = vec_ld( 16, &dst[i] ); - + v6 = vec_madd( v0, v1, v4 ); v7 = vec_madd( v2, v3, v5 ); - + ALIGNED_STORE2( &dst[i], v6, v7 ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] += src0[i] * src1[i]; - } + } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] += src0[i] * src1[i]; + } } /* @@ -1178,52 +1178,52 @@ idSIMD_AltiVec::MulSub ============ */ void VPCALL idSIMD_AltiVec::MulSub( float *dst, const float constant, const float *src, const int count ) { - register vector float v0, v1, v2, v3, v4, v5; - register vector float constVec; + register vector float v0, v1, v2, v3, v4, v5; + register vector float constVec; //src register vector float v0_low, v0_hi, v2_low, v2_hi; //permute vectors register vector unsigned char permVec1; vector unsigned char oneCharVector = (vector unsigned char)(1); - int i; + int i; - //handle unaligned at start - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + //handle unaligned at start + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { dst[i] -= constant * src[i]; - } - - //splat constant into a vector + } + + //splat constant into a vector constVec = loadSplatUnalignedScalar( &constant ); - + //calculate permute and do loads permVec1 = vec_add( vec_lvsl( -1, (int*) &src[i] ), oneCharVector ); v2_hi = vec_ld( 0, &src[i] ); - - //vectorize! - for ( ; i+7 < count; i += 8 ) { + + //vectorize! + for ( ; i+7 < count; i += 8 ) { v0_low = v2_hi; v0_hi = vec_ld( 15, &src[i] ); v2_low = v0_hi; v2_hi = vec_ld( 31, &src[i] ); - + v0 = vec_perm( v0_low, v0_hi, permVec1 ); v2 = vec_perm( v2_low, v2_hi, permVec1 ); - + //we know dst will be aligned here because we already handled the preceeding //unaligned cases v1 = vec_ld( 0, &dst[i] ); v3 = vec_ld( 16, &dst[i] ); - + v4 = vec_nmsub( v0, constVec, v1 ); v5 = vec_nmsub( v2, constVec, v3 ); ALIGNED_STORE2( &dst[i], v4, v5 ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] -= constant * src[i]; - } + } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] -= constant * src[i]; + } } /* @@ -1234,61 +1234,61 @@ idSIMD_AltiVec::MulSub ============ */ void VPCALL idSIMD_AltiVec::MulSub( float *dst, const float *src0, const float *src1, const int count ) { - register vector float v0, v1, v2, v3, v4, v5, v6, v7; - //src0 + register vector float v0, v1, v2, v3, v4, v5, v6, v7; + //src0 register vector float v0_low, v0_hi, v2_low, v2_hi; //src1 register vector float v1_low, v1_hi, v3_low, v3_hi; //permute vectors register vector unsigned char permVec1, permVec2; vector unsigned char oneCharVector = (vector unsigned char)(1); - int i; - - //unaligned at start - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + int i; + + //unaligned at start + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { dst[i] -= src0[i] * src1[i]; - } - + } + //calculate permute and do loads permVec1 = vec_add( vec_lvsl( -1, (int*) &src0[i] ), oneCharVector ); permVec2 = vec_add( vec_lvsl( -1, (int*) &src1[i] ), oneCharVector ); v2_hi = vec_ld( 0, &src0[i] ); v3_hi = vec_ld( 0, &src1[i] ); - - //vectorize! - for ( ; i+7 < count; i += 8 ) { + + //vectorize! + for ( ; i+7 < count; i += 8 ) { // load sources v0_low = v2_hi; v0_hi = vec_ld( 15, &src0[i] ); v2_low = v0_hi; v2_hi = vec_ld( 31, &src0[i] ); - + v1_low = v3_hi; v1_hi = vec_ld( 15, &src1[i] ); v3_low = v1_hi; v3_hi = vec_ld( 31, &src1[i] ); - + v0 = vec_perm( v0_low, v0_hi, permVec1 ); v1 = vec_perm( v1_low, v1_hi, permVec2 ); v2 = vec_perm( v2_low, v2_hi, permVec1 ); v3 = vec_perm( v3_low, v3_hi, permVec2 ); - + //we know dst is aligned because we handled unaligned cases //up front v4 = vec_ld( 0, &dst[i] ); v5 = vec_ld( 16, &dst[i] ); - + v6 = vec_nmsub( v0, v1, v4 ); v7 = vec_nmsub( v2, v3, v5 ); ALIGNED_STORE2( &dst[i], v6, v7 ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] -= src0[i] * src1[i]; - } + } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] -= src0[i] * src1[i]; + } } #endif /* ENABLE_SIMPLE_MATH */ @@ -1302,7 +1302,7 @@ idSIMD_AltiVec::Dot ============ */ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 &constant, const idVec3 *src, const int count ) { - + register vector float vecLd1, vecLd2, vecLd3, vecLd4, vecLd5, vecLd6; register vector float vecX, vecY, vecZ; vector float vecX2, vecY2, vecZ2; @@ -1311,48 +1311,48 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 &constant, const idVec float constVal[4]; register vector float zeroVector = (vector float)(0.0); register vector float vecConstX, vecConstY, vecConstZ; - + // permute vectors register vector unsigned char permX1 = (vector unsigned char)(0,1,2,3,12,13,14,15,24,25,26,27,28,29,30,31); //last 4 bytes are junk register vector unsigned char permX2 = (vector unsigned char)(0,1,2,3,4,5,6,7,8,9,10,11,20,21,22,23); - + register vector unsigned char permY1 = (vector unsigned char)(4,5,6,7,16,17,18,19,28,29,30,31,0,1,2,3); //last 4 bytes are junk register vector unsigned char permY2 = (vector unsigned char)(0,1,2,3,4,5,6,7,8,9,10,11,24,25,26,27); - + register vector unsigned char permZ1 = (vector unsigned char)(8,9,10,11,20,21,22,23,0,1,2,3,4,5,6,7); //last 8 bytes are junk register vector unsigned char permZ2 = (vector unsigned char)(0,1,2,3,4,5,6,7,16,17,18,19,28,29,30,31); - + int i; - + // for scalar cleanup, if necessary constVal[0] = constant[0]; constVal[1] = constant[1]; constVal[2] = constant[2]; constVal[3] = 0; - + vector unsigned char constPerm = vec_lvsl( 0, constant.ToFloatPtr() ); vecLd1 = vec_ld( 0, constant.ToFloatPtr() ); vecLd2 = vec_ld( 11, constant.ToFloatPtr() ); vecLd1 = vec_perm( vecLd1, vecLd2, constPerm ); - - + + // populate const vectors - vecConstX = vec_splat( vecLd1, 0 ); - vecConstY = vec_splat( vecLd1, 1 ); - vecConstZ = vec_splat( vecLd1, 2 ); + vecConstX = vec_splat( vecLd1, 0 ); + vecConstY = vec_splat( vecLd1, 1 ); + vecConstZ = vec_splat( vecLd1, 2 ); vector unsigned char permVec = vec_add( vec_lvsl( -1, addr ), (vector unsigned char)(1) ); vector float vecOld = vec_ld( 0, addr ); // handle unaligned case at beginning - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { dst[i] = constant * src[i]; } for ( ; i + 7 < count; i += 8 ) { float *vecPtr = (float*)( addr + (i*3) ); vector float v0, v1, v2, v3, v4, v5; - + v0 = vecOld; //vec_ld( 0, vecPtr ); v1 = vec_ld( 15, vecPtr ); v2 = vec_ld( 31, vecPtr ); @@ -1364,11 +1364,11 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 &constant, const idVec vecLd1 = vec_perm( v0, v1, permVec ); vecLd2 = vec_perm( v1, v2, permVec ); vecLd3 = vec_perm( v2, v3, permVec ); - + vecLd4 = vec_perm( v3, v4, permVec ); vecLd5 = vec_perm( v4, v5, permVec ); vecLd6 = vec_perm( v5, vecOld, permVec ); - + // permute into X Y Z vectors vecX = vec_perm( vecLd1, vecLd2, permX1 ); vecY = vec_perm( vecLd1, vecLd2, permY1 ); @@ -1376,34 +1376,34 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 &constant, const idVec vecX = vec_perm( vecX, vecLd3, permX2 ); vecY = vec_perm( vecY, vecLd3, permY2 ); vecZ = vec_perm( vecZ, vecLd3, permZ2 ); - + vecX2 = vec_perm( vecLd4, vecLd5, permX1 ); vecY2 = vec_perm( vecLd4, vecLd5, permY1 ); vecZ2 = vec_perm( vecLd4, vecLd5, permZ1 ); vecX2 = vec_perm( vecX2, vecLd6, permX2 ); vecY2 = vec_perm( vecY2, vecLd6, permY2 ); vecZ2 = vec_perm( vecZ2, vecLd6, permZ2 ); - + // do multiply vecX = vec_madd( vecX, vecConstX, zeroVector ); vecY = vec_madd( vecY, vecConstY, vecX ); vecZ = vec_madd( vecZ, vecConstZ, vecY ); - + vecX2 = vec_madd( vecX2, vecConstX, zeroVector ); vecY2 = vec_madd( vecY2, vecConstY, vecX2 ); vecZ2 = vec_madd( vecZ2, vecConstZ, vecY2 ); - + // store out results ALIGNED_STORE2( &dst[i], vecZ, vecZ2 ); } - + //cleanup for ( ; i < count; i++ ) { // look up whats at the address we want, cast it as float pointer, then // dereference that pointer - tempVal[0] = *( addr + (i*3) + 0 ); - tempVal[1] = *( addr + (i*3) + 1 ); - tempVal[2] = *( addr + (i*3) + 2 ); + tempVal[0] = *( addr + (i*3) + 0 ); + tempVal[1] = *( addr + (i*3) + 1 ); + tempVal[2] = *( addr + (i*3) + 2 ); dst[i] = constVal[0] * tempVal[0] + constVal[1] * tempVal[1] + constVal[2] * tempVal[2]; } } @@ -1420,33 +1420,33 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 &constant, const idPla //#define OPER(X) dst[(X)] = constant * src[(X)].Normal() + src[(X)][3]; assert( sizeof(idPlane) == PLANE_OFFSET * sizeof(float) ); - + int i; float constVal[4]; float srcVal[3]; float srcI3; float tempVal; - + vector float vecPlaneLd1, vecPlaneLd2, vecPlaneLd3, vecPlaneLd4; vector float vecPlaneLd5, vecPlaneLd6, vecPlaneLd7, vecPlaneLd8; vector float vecX, vecY, vecZ, vecI3; vector float vecX2, vecY2, vecZ2, vecI32; vector float vecConstX, vecConstY, vecConstZ; - + constVal[0] = constant[0]; constVal[1] = constant[1]; constVal[2] = constant[2]; constVal[3] = 1; - + vector unsigned char constPerm = vec_lvsl( 0, constant.ToFloatPtr() ); vector float v0 = vec_ld( 0, constant.ToFloatPtr() ); vector float v1 = vec_ld( 11, constant.ToFloatPtr() ); vector float vecConst = vec_perm( v0, v1, constPerm ); - + vecConstX = vec_splat( vecConst, 0 ); vecConstY = vec_splat( vecConst, 1 ); vecConstZ = vec_splat( vecConst, 2 ); - + // handle unaligned case at beginning for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { dst[i] = constant * src[i].Normal() + src[i][3]; @@ -1455,11 +1455,11 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 &constant, const idPla const float *addr = src[i].ToFloatPtr(); vector unsigned char permVec = vec_add( vec_lvsl( -1, addr ), (vector unsigned char)(1) ); vector float vecOld = vec_ld( 0, addr ); - + for ( ; i + 7 < count; i += 8 ) { float *planePtr = (float*)( addr + (i*PLANE_OFFSET) ); vector float v0, v1, v2, v3, v4, v5, v6, v7; - + v0 = vecOld; //vec_ld( 0, planePtr ); v1 = vec_ld( 15, planePtr ); v2 = vec_ld( 31, planePtr ); @@ -1469,34 +1469,34 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 &constant, const idPla v6 = vec_ld( 95, planePtr ); v7 = vec_ld( 111, planePtr ); vecOld = vec_ld( 127, planePtr ); - + vecPlaneLd1 = vec_perm( v0, v1, permVec ); vecPlaneLd2 = vec_perm( v1, v2, permVec ); vecPlaneLd3 = vec_perm( v2, v3, permVec ); vecPlaneLd4 = vec_perm( v3, v4, permVec ); - + vecPlaneLd5 = vec_perm( v4, v5, permVec ); vecPlaneLd6 = vec_perm( v5, v6, permVec ); vecPlaneLd7 = vec_perm( v6, v7, permVec ); vecPlaneLd8 = vec_perm( v7, vecOld, permVec ); - + // permute into X Y Z vectors, since this is square its basically // a matrix transpose v0 = vec_mergeh( vecPlaneLd1, vecPlaneLd3 ); v1 = vec_mergeh( vecPlaneLd2, vecPlaneLd4 ); v2 = vec_mergel( vecPlaneLd1, vecPlaneLd3 ); v3 = vec_mergel( vecPlaneLd2, vecPlaneLd4 ); - + vecX = vec_mergeh( v0, v1 ); vecY = vec_mergel( v0, v1 ); vecZ = vec_mergeh( v2, v3 ); vecI3 = vec_mergel( v2, v3 ); - + v4 = vec_mergeh( vecPlaneLd5, vecPlaneLd7 ); v5 = vec_mergeh( vecPlaneLd6, vecPlaneLd8 ); v6 = vec_mergel( vecPlaneLd5, vecPlaneLd7 ); v7 = vec_mergel( vecPlaneLd6, vecPlaneLd8 ); - + vecX2 = vec_mergeh( v4, v5 ); vecY2 = vec_mergel( v4, v5 ); vecZ2 = vec_mergeh( v6, v7 ); @@ -1506,11 +1506,11 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 &constant, const idPla v6 = vec_madd( vecZ, vecConstZ, vecI3 ); v5 = vec_madd( vecY, vecConstY, v6 ); v4 = vec_madd( vecX, vecConstX, v5 ); - + v0 = vec_madd( vecZ2, vecConstZ, vecI32 ); v1 = vec_madd( vecY2, vecConstY, v0 ); v2 = vec_madd( vecX2, vecConstX, v1 ); - + // store results ALIGNED_STORE2( &dst[i], v4, v2 ); } @@ -1521,7 +1521,7 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 &constant, const idPla srcVal[0] = *(addr + (i*PLANE_OFFSET) + 0 ); srcVal[1] = *(addr + (i*PLANE_OFFSET) + 1 ); srcVal[2] = *(addr + (i*PLANE_OFFSET) + 2 ); - + // put src[i][3] into srcI3 srcI3 = *(addr + (i*PLANE_OFFSET) + 3 ); @@ -1540,32 +1540,32 @@ idSIMD_AltiVec::Dot */ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 &constant, const idDrawVert *src, const int count ) { //#define OPER(X) dst[(X)] = constant * src[(X)].xyz; - + // idDrawVert size is 60 bytes assert( sizeof(idDrawVert) == DRAWVERT_OFFSET * sizeof( float ) ); - + register vector float v0, v1, v2, v3, v4, v5, v6, v7; int i; register vector float vecConstX, vecConstY, vecConstZ; register vector float vecSrcX1, vecSrcY1, vecSrcZ1; register vector float zeroVector = (vector float)(0.0); vector unsigned char vertPerm1, vertPerm2, vertPerm3, vertPerm4; - + vector unsigned char constPerm = vec_lvsl( 0, constant.ToFloatPtr() ); v0 = vec_ld( 0, constant.ToFloatPtr() ); v1 = vec_ld( 11, constant.ToFloatPtr() ); v0 = vec_perm( v0, v1, constPerm ); - + // permute into constant vectors vecConstX = vec_splat( v0, 0 ); vecConstY = vec_splat( v0, 1 ); vecConstZ = vec_splat( v0, 2 ); - + // handle unaligned case at beginning - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { dst[i] = constant * src[i].xyz; - } - + } + // every fourth one will have the same alignment. Make sure we've got enough here if ( i+3 < count ) { vertPerm1 = vec_add( vec_lvsl( -1, (float*) src[i].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); @@ -1573,13 +1573,13 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 &constant, const idDra vertPerm3 = vec_add( vec_lvsl( -1, (float*) src[i+2].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); vertPerm4 = vec_add( vec_lvsl( -1, (float*) src[i+3].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); } - + for ( ; i+3 < count; i += 4 ) { const float *vertPtr = src[i].xyz.ToFloatPtr(); const float *vertPtr2 = src[i+1].xyz.ToFloatPtr(); const float *vertPtr3 = src[i+2].xyz.ToFloatPtr(); const float *vertPtr4 = src[i+3].xyz.ToFloatPtr(); - + v0 = vec_ld( 0, vertPtr ); v1 = vec_ld( 11, vertPtr ); v2 = vec_ld( 0, vertPtr2 ); @@ -1588,31 +1588,31 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 &constant, const idDra v5 = vec_ld( 11, vertPtr3 ); v6 = vec_ld( 0, vertPtr4 ); v7 = vec_ld( 11, vertPtr4 ); - + v0 = vec_perm( v0, v1, vertPerm1 ); v2 = vec_perm( v2, v3, vertPerm2 ); v4 = vec_perm( v4, v5, vertPerm3 ); v6 = vec_perm( v6, v7, vertPerm4 ); - // transpose into X Y Z vectors + // transpose into X Y Z vectors v1 = vec_mergeh( v0, v4 ); v3 = vec_mergeh( v2, v6 ); v5 = vec_mergel( v0, v4 ); v7 = vec_mergel( v2, v6 ); - + vecSrcX1 = vec_mergeh( v1, v3 ); vecSrcY1 = vec_mergel( v1, v3 ); vecSrcZ1 = vec_mergeh( v5, v7 ); - + // now calculate dot product vecSrcX1 = vec_madd( vecSrcX1, vecConstX, zeroVector ); vecSrcY1 = vec_madd( vecSrcY1, vecConstY, vecSrcX1 ); vecSrcZ1 = vec_madd( vecSrcZ1, vecConstZ, vecSrcY1 ); - + // store results vec_st( vecSrcZ1, 0, &dst[i] ); } - + for ( ; i < count; i++ ) { dst[i] = constant * src[i].xyz; } @@ -1627,62 +1627,62 @@ idSIMD_AltiVec::Dot */ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 &constant, const idDrawVert *src, const int count ) { //#define OPER(X) dst[(X)] = constant * src[(X)].xyz; - + // idDrawVert size is 64 bytes assert( sizeof(idDrawVert) == DRAWVERT_OFFSET * sizeof( float ) ); - + register vector float v0, v1, v2, v3, v4, v5, v6, v7; int i; register vector float vecConstX, vecConstY, vecConstZ; register vector float vecSrcX1, vecSrcY1, vecSrcZ1; register vector float zeroVector = (vector float)(0.0); vector unsigned char vertPerm1, vertPerm2, vertPerm3, vertPerm4; - + vector unsigned char constPerm = vec_lvsl( 0, constant.ToFloatPtr() ); v0 = vec_ld( 0, constant.ToFloatPtr() ); v1 = vec_ld( 11, constant.ToFloatPtr() ); v0 = vec_perm( v0, v1, constPerm ); - + // permute into constant vectors vecConstX = vec_splat( v0, 0 ); vecConstY = vec_splat( v0, 1 ); vecConstZ = vec_splat( v0, 2 ); - + // handle unaligned case at beginning - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { dst[i] = constant * src[i].xyz; - } - + } + for ( ; i+3 < count; i += 4 ) { const float *vertPtr = src[i].xyz.ToFloatPtr(); const float *vertPtr2 = src[i+1].xyz.ToFloatPtr(); const float *vertPtr3 = src[i+2].xyz.ToFloatPtr(); const float *vertPtr4 = src[i+3].xyz.ToFloatPtr(); - + v0 = vec_ld( 0, vertPtr ); v2 = vec_ld( 0, vertPtr2 ); v4 = vec_ld( 0, vertPtr3 ); v6 = vec_ld( 0, vertPtr4 ); - - // transpose into X Y Z vectors + + // transpose into X Y Z vectors v1 = vec_mergeh( v0, v4 ); v3 = vec_mergeh( v2, v6 ); v5 = vec_mergel( v0, v4 ); v7 = vec_mergel( v2, v6 ); - + vecSrcX1 = vec_mergeh( v1, v3 ); vecSrcY1 = vec_mergel( v1, v3 ); vecSrcZ1 = vec_mergeh( v5, v7 ); - + // now calculate dot product vecSrcX1 = vec_madd( vecSrcX1, vecConstX, zeroVector ); vecSrcY1 = vec_madd( vecSrcY1, vecConstY, vecSrcX1 ); vecSrcZ1 = vec_madd( vecSrcZ1, vecConstZ, vecSrcY1 ); - + // store results vec_st( vecSrcZ1, 0, &dst[i] ); } - + for ( ; i < count; i++ ) { dst[i] = constant * src[i].xyz; } @@ -1694,38 +1694,38 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 &constant, const idDra ============ idSIMD_AltiVec::Dot - dst[i] = constant.Normal() * src[i] + constant[3]; + dst[i] = constant.Normal() * src[i] + constant[3]; ============ */ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idVec3 *src, const int count ) { //#define OPER(X) dst[(X)] = constant.Normal() * src[(X)] + constant[3]; - + register vector float vecLd1, vecLd2, vecLd3, vecLd4, vecLd5, vecLd6; register vector float vecX, vecY, vecZ, vecX2, vecY2, vecZ2; register vector float zeroVector = (vector float)(0.0); register vector float vecConstX, vecConstY, vecConstZ; register vector float vecConst3; - + idVec3 constNormal = constant.Normal(); float const3 = constant[3]; - + // permute vectors register vector unsigned char permX1 = (vector unsigned char)(0,1,2,3,12,13,14,15,24,25,26,27,28,29,30,31); //last 4 bytes are junk register vector unsigned char permX2 = (vector unsigned char)(0,1,2,3,4,5,6,7,8,9,10,11,20,21,22,23); - + register vector unsigned char permY1 = (vector unsigned char)(4,5,6,7,16,17,18,19,28,29,30,31,0,1,2,3); //last 4 bytes are junk register vector unsigned char permY2 = (vector unsigned char)(0,1,2,3,4,5,6,7,8,9,10,11,24,25,26,27); - + register vector unsigned char permZ1 = (vector unsigned char)(8,9,10,11,20,21,22,23,0,1,2,3,4,5,6,7); //last 8 bytes are junk register vector unsigned char permZ2 = (vector unsigned char)(0,1,2,3,4,5,6,7,16,17,18,19,28,29,30,31); - + int i; - - vector unsigned char constPerm = vec_lvsl( 0, constant.ToFloatPtr() ); + + vector unsigned char constPerm = vec_lvsl( 0, constant.ToFloatPtr() ); vecLd1 = vec_ld( 0, constant.ToFloatPtr() ); vecLd2 = vec_ld( 15, constant.ToFloatPtr() ); vecLd1 = vec_perm( vecLd1, vecLd2, constPerm ); - + // populate const vec vecConstX = vec_splat( vecLd1, 0 ); vecConstY = vec_splat( vecLd1, 1 ); @@ -1735,34 +1735,34 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idVe vecConst3 = loadSplatUnalignedScalar( &const3 ); // handle unaligned case at beginning - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { dst[i] = constant.Normal() * src[i] + constant[3]; } const float *addr = src[i].ToFloatPtr(); vector unsigned char permVec = vec_add( vec_lvsl( -1, addr ), (vector unsigned char)(1) ); vector float vecOld = vec_ld( 0, addr ); - + for ( ; i+7 < count; i += 8 ) { float *vecPtr = (float*)( addr + (i*3) ); vector float v0, v1, v2, v3, v4, v5; - + v0 = vecOld; //vec_ld( 0, vecPtr ); v1 = vec_ld( 15, vecPtr ); v2 = vec_ld( 31, vecPtr ); - v3 = vec_ld( 47, vecPtr ); + v3 = vec_ld( 47, vecPtr ); v4 = vec_ld( 63, vecPtr ); v5 = vec_ld( 79, vecPtr ); vecOld = vec_ld( 95, vecPtr ); - + vecLd1 = vec_perm( v0, v1, permVec ); vecLd2 = vec_perm( v1, v2, permVec ); vecLd3 = vec_perm( v2, v3, permVec ); - + vecLd4 = vec_perm( v3, v4, permVec ); vecLd5 = vec_perm( v4, v5, permVec ); vecLd6 = vec_perm( v5, vecOld, permVec ); - + // permute into X Y Z vectors vecX = vec_perm( vecLd1, vecLd2, permX1 ); vecY = vec_perm( vecLd1, vecLd2, permY1 ); @@ -1777,27 +1777,27 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idVe vecX2 = vec_perm( vecX2, vecLd6, permX2 ); vecY2 = vec_perm( vecY2, vecLd6, permY2 ); vecZ2 = vec_perm( vecZ2, vecLd6, permZ2 ); - + // calculate dot product vecX = vec_madd( vecX, vecConstX, zeroVector ); vecY = vec_madd( vecY, vecConstY, vecX ); vecZ = vec_madd( vecZ, vecConstZ, vecY ); - + vecX2 = vec_madd( vecX2, vecConstX, zeroVector ); vecY2 = vec_madd( vecY2, vecConstY, vecX2 ); vecZ2 = vec_madd( vecZ2, vecConstZ, vecY2 ); - + // add in constant[3] vecZ = vec_add( vecZ, vecConst3 ); vecZ2 = vec_add( vecZ2, vecConst3 ); - + // store out results ALIGNED_STORE2( &dst[i], vecZ, vecZ2 ); } - + //cleanup - for ( ; i < count; i++ ) { - dst[i] = constNormal * src[i] + const3; + for ( ; i < count; i++ ) { + dst[i] = constNormal * src[i] + const3; } } @@ -1813,13 +1813,13 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idPl // check plane size assert( sizeof(idPlane) == PLANE_OFFSET * sizeof(float) ); - + float constVal[4]; float srcVal[4]; - + int i; const float *constPtr = constant.ToFloatPtr(); - + register vector float vecX, vecY, vecZ, vecI3; register vector float vecX2, vecY2, vecZ2, vecI32; @@ -1827,36 +1827,36 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idPl vector float vecPlaneLd5, vecPlaneLd6, vecPlaneLd7, vecPlaneLd8; register vector float zeroVector = (vector float)(0.0); register vector float vecConstX, vecConstY, vecConstZ, vecConstI3; - + constVal[0] = *(constPtr); constVal[1] = *(constPtr+1); constVal[2] = *(constPtr+2); constVal[3] = *(constPtr+3); - + // populate const vector vector unsigned char constPerm = vec_lvsl( 0, constant.ToFloatPtr() ); vector float v0 = vec_ld( 0, constant.ToFloatPtr() ); vector float v1 = vec_ld( 15, constant.ToFloatPtr() ); vector float vecConst = vec_perm( v0, v1, constPerm ); - + vecConstX = vec_splat( vecConst, 0 ); vecConstY = vec_splat( vecConst, 1 ); vecConstZ = vec_splat( vecConst, 2 ); vecConstI3 = vec_splat( vecConst, 3 ); - + // handle unaligned case at beginning for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { dst[i] = constant.Normal() * src[i].Normal() + constant[3] * src[i][3]; } - + const float *srcPtr = src[i].ToFloatPtr(); vector unsigned char permVec = vec_add( vec_lvsl( -1, srcPtr ), (vector unsigned char)(1) ); vector float vecOld = vec_ld( 0, srcPtr ); - + for ( ; i+7 < count; i += 8 ) { float *planePtr = (float*)( srcPtr + (i*PLANE_OFFSET) ); vector float v0, v1, v2, v3, v4, v5, v6, v7; - + v0 = vecOld; // vec_ld( 0, planePtr ); v1 = vec_ld( 15, planePtr ); v2 = vec_ld( 31, planePtr ); @@ -1866,39 +1866,39 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idPl v6 = vec_ld( 95, planePtr ); v7 = vec_ld( 111, planePtr ); vecOld = vec_ld( 127, planePtr ); - + vecPlaneLd1 = vec_perm( v0, v1, permVec ); vecPlaneLd2 = vec_perm( v1, v2, permVec ); vecPlaneLd3 = vec_perm( v2, v3, permVec ); vecPlaneLd4 = vec_perm( v3, v4, permVec ); - + vecPlaneLd5 = vec_perm( v4, v5, permVec ); vecPlaneLd6 = vec_perm( v5, v6, permVec ); vecPlaneLd7 = vec_perm( v6, v7, permVec ); vecPlaneLd8 = vec_perm( v7, vecOld, permVec ); - + // permute into X Y Z vectors, since this is square its basically // a matrix transpose v0 = vec_mergeh( vecPlaneLd1, vecPlaneLd3 ); v1 = vec_mergeh( vecPlaneLd2, vecPlaneLd4 ); v2 = vec_mergel( vecPlaneLd1, vecPlaneLd3 ); v3 = vec_mergel( vecPlaneLd2, vecPlaneLd4 ); - + vecX = vec_mergeh( v0, v1 ); vecY = vec_mergel( v0, v1 ); vecZ = vec_mergeh( v2, v3 ); vecI3 = vec_mergel( v2, v3 ); - + v4 = vec_mergeh( vecPlaneLd5, vecPlaneLd7 ); v5 = vec_mergeh( vecPlaneLd6, vecPlaneLd8 ); v6 = vec_mergel( vecPlaneLd5, vecPlaneLd7 ); v7 = vec_mergel( vecPlaneLd6, vecPlaneLd8 ); - + vecX2 = vec_mergeh( v4, v5 ); vecY2 = vec_mergel( v4, v5 ); vecZ2 = vec_mergeh( v6, v7 ); - vecI32 = vec_mergel( v6, v7 ); - + vecI32 = vec_mergel( v6, v7 ); + // do calculation v4 = vec_madd( vecConstX, vecX, zeroVector ); v5 = vec_madd( vecConstY, vecY, v4 ); @@ -1909,7 +1909,7 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idPl v1 = vec_madd( vecConstY, vecY2, v0 ); v2 = vec_madd( vecConstZ, vecZ2, v1 ); v3 = vec_madd( vecConstI3, vecI32, v2 ); - + //store result ALIGNED_STORE2( &dst[i], v7, v3 ); } @@ -1936,24 +1936,24 @@ idSIMD_AltiVec::Dot */ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idDrawVert *src, const int count ) { //#define OPER(X) dst[(X)] = constant.Normal() * src[(X)].xyz + constant[3]; - + // idDrawVert size is 60 bytes assert( sizeof(idDrawVert) == DRAWVERT_OFFSET * sizeof( float ) ); - + int i; const float *constPtr = constant.ToFloatPtr(); const float *srcPtr = src[0].xyz.ToFloatPtr(); - + register vector float v0, v1, v2, v3, v4, v5, v6, v7; register vector float vecConstX, vecConstY, vecConstZ, vecConstI3; register vector float vecSrcX1, vecSrcY1, vecSrcZ1; register vector float vecDest1; register vector float zeroVector = (vector float)(0.0); vector unsigned char vertPerm1, vertPerm2, vertPerm3, vertPerm4; - + float constVal[4]; float srcVal[3]; - + constVal[0] = *(constPtr+0); constVal[1] = *(constPtr+1); constVal[2] = *(constPtr+2); @@ -1964,32 +1964,32 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idDr v0 = vec_ld( 0, constant.ToFloatPtr() ); v1 = vec_ld( 15, constant.ToFloatPtr() ); v0 = vec_perm( v0, v1, constPerm ); - + vecConstX = vec_splat( v0, 0 ); vecConstY = vec_splat( v0, 1 ); vecConstZ = vec_splat( v0, 2 ); vecConstI3 = vec_splat( v0, 3 ); - + // handle unaligned case at beginning for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { dst[i] = constant.Normal() * src[i].xyz + constant[3]; } - + // every fourth one will have the same alignment, so can store these. Make sure we // have enough so we don't run off the end of the array if ( i+3 < count ) { vertPerm1 = vec_add( vec_lvsl( -1, (float*) src[i].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); vertPerm2 = vec_add( vec_lvsl( -1, (float*) src[i+1].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); vertPerm3 = vec_add( vec_lvsl( -1, (float*) src[i+2].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); - vertPerm4 = vec_add( vec_lvsl( -1, (float*) src[i+3].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); + vertPerm4 = vec_add( vec_lvsl( -1, (float*) src[i+3].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); } - + for ( ; i+3 < count; i+=4 ) { const float *vertPtr = src[i].xyz.ToFloatPtr(); const float *vertPtr2 = src[i+1].xyz.ToFloatPtr(); const float *vertPtr3 = src[i+2].xyz.ToFloatPtr(); const float *vertPtr4 = src[i+3].xyz.ToFloatPtr(); - + v0 = vec_ld( 0, vertPtr ); v1 = vec_ld( 11, vertPtr ); v2 = vec_ld( 0, vertPtr2 ); @@ -1998,18 +1998,18 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idDr v5 = vec_ld( 11, vertPtr3 ); v6 = vec_ld( 0, vertPtr4 ); v7 = vec_ld( 11, vertPtr4 ); - + v0 = vec_perm( v0, v1, vertPerm1 ); v2 = vec_perm( v2, v3, vertPerm2 ); v4 = vec_perm( v4, v5, vertPerm3 ); v6 = vec_perm( v6, v7, vertPerm4 ); - // transpose into X Y Z vectors + // transpose into X Y Z vectors v1 = vec_mergeh( v0, v4 ); v3 = vec_mergeh( v2, v6 ); v5 = vec_mergel( v0, v4 ); v7 = vec_mergel( v2, v6 ); - + vecSrcX1 = vec_mergeh( v1, v3 ); vecSrcY1 = vec_mergel( v1, v3 ); vecSrcZ1 = vec_mergeh( v5, v7 ); @@ -2019,7 +2019,7 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idDr vecSrcY1 = vec_madd( vecSrcY1, vecConstY, vecSrcX1 ); vecSrcZ1 = vec_madd( vecSrcZ1, vecConstZ, vecSrcY1 ); vecDest1 = vec_add( vecSrcZ1, vecConstI3 ); - + // store results vec_st( vecDest1, 0, &dst[i] ); } @@ -2030,7 +2030,7 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idDr srcVal[1] = *(srcPtr + (i*DRAWVERT_OFFSET) + 1 ); srcVal[2] = *(srcPtr + (i*DRAWVERT_OFFSET) + 2 ); // dst[i] = constant.Normal() * src[i].xyz + constant[3]; - + dst[i] = constVal[0] * srcVal[0] + constVal[1] * srcVal[1] + constVal[2] * srcVal[2]; dst[i] += constVal[3]; } @@ -2045,24 +2045,24 @@ idSIMD_AltiVec::Dot */ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idDrawVert *src, const int count ) { //#define OPER(X) dst[(X)] = constant.Normal() * src[(X)].xyz + constant[3]; - + // idDrawVert size is 60 bytes assert( sizeof(idDrawVert) == DRAWVERT_OFFSET * sizeof( float ) ); - + int i; const float *constPtr = constant.ToFloatPtr(); const float *srcPtr = src[0].xyz.ToFloatPtr(); - + register vector float v0, v1, v2, v3, v4, v5, v6, v7; register vector float vecConstX, vecConstY, vecConstZ, vecConstI3; register vector float vecSrcX1, vecSrcY1, vecSrcZ1; register vector float vecDest1; register vector float zeroVector = (vector float)(0.0); vector unsigned char vertPerm1, vertPerm2, vertPerm3, vertPerm4; - + float constVal[4]; float srcVal[3]; - + constVal[0] = *(constPtr+0); constVal[1] = *(constPtr+1); constVal[2] = *(constPtr+2); @@ -2073,34 +2073,34 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idDr v0 = vec_ld( 0, constant.ToFloatPtr() ); v1 = vec_ld( 15, constant.ToFloatPtr() ); v0 = vec_perm( v0, v1, constPerm ); - + vecConstX = vec_splat( v0, 0 ); vecConstY = vec_splat( v0, 1 ); vecConstZ = vec_splat( v0, 2 ); vecConstI3 = vec_splat( v0, 3 ); - + // handle unaligned case at beginning for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { dst[i] = constant.Normal() * src[i].xyz + constant[3]; } - + for ( ; i+3 < count; i+=4 ) { const float *vertPtr = src[i].xyz.ToFloatPtr(); const float *vertPtr2 = src[i+1].xyz.ToFloatPtr(); const float *vertPtr3 = src[i+2].xyz.ToFloatPtr(); const float *vertPtr4 = src[i+3].xyz.ToFloatPtr(); - + v0 = vec_ld( 0, vertPtr ); v2 = vec_ld( 0, vertPtr2 ); v4 = vec_ld( 0, vertPtr3 ); v6 = vec_ld( 0, vertPtr4 ); - // transpose into X Y Z vectors + // transpose into X Y Z vectors v1 = vec_mergeh( v0, v4 ); v3 = vec_mergeh( v2, v6 ); v5 = vec_mergel( v0, v4 ); v7 = vec_mergel( v2, v6 ); - + vecSrcX1 = vec_mergeh( v1, v3 ); vecSrcY1 = vec_mergel( v1, v3 ); vecSrcZ1 = vec_mergeh( v5, v7 ); @@ -2110,7 +2110,7 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idDr vecSrcY1 = vec_madd( vecSrcY1, vecConstY, vecSrcX1 ); vecSrcZ1 = vec_madd( vecSrcZ1, vecConstZ, vecSrcY1 ); vecDest1 = vec_add( vecSrcZ1, vecConstI3 ); - + // store results vec_st( vecDest1, 0, &dst[i] ); } @@ -2121,7 +2121,7 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idPlane &constant, const idDr srcVal[1] = *(srcPtr + (i*DRAWVERT_OFFSET) + 1 ); srcVal[2] = *(srcPtr + (i*DRAWVERT_OFFSET) + 2 ); // dst[i] = constant.Normal() * src[i].xyz + constant[3]; - + dst[i] = constVal[0] * srcVal[0] + constVal[1] * srcVal[1] + constVal[2] * srcVal[2]; dst[i] += constVal[3]; } @@ -2138,11 +2138,11 @@ idSIMD_AltiVec::Dot */ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 *src0, const idVec3 *src1, const int count ) { //#define OPER(X) dst[(X)] = src0[(X)] * src1[(X)]; - + int i; float src0Val[3]; float src1Val[3]; - + register vector float vecLd1, vecLd2, vecLd3, vecLd4, vecLd5, vecLd6; vector float vecLd7, vecLd8, vecLd9, vecLd10, vecLd11, vecLd12; register vector float vecX0, vecY0, vecZ0, vecX1, vecY1, vecZ1; @@ -2155,54 +2155,54 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 *src0, const idVec3 *s register vector unsigned char permY2 = (vector unsigned char)(0,1,2,3,4,5,6,7,8,9,10,11,24,25,26,27); register vector unsigned char permZ1 = (vector unsigned char)(8,9,10,11,20,21,22,23,0,1,2,3,4,5,6,7); //last 8 bytes are junk register vector unsigned char permZ2 = (vector unsigned char)(0,1,2,3,4,5,6,7,16,17,18,19,28,29,30,31); - + // handle unaligned case at beginning for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { dst[i] = src0[i] * src1[i]; } - + const float *src0Ptr = src0[i].ToFloatPtr(); const float *src1Ptr = src1[i].ToFloatPtr(); vector unsigned char permVec1 = vec_add( vec_lvsl( -1, src0Ptr ), (vector unsigned char)(1) ); vector unsigned char permVec2 = vec_add( vec_lvsl( -1, src1Ptr ), (vector unsigned char)(1) ); vector float vecOld0 = vec_ld( 0, src0Ptr ); vector float vecOld1 = vec_ld( 0, src1Ptr ); - + for ( i = 0; i+7 < count; i += 8 ) { float *s0Ptr = (float*)( src0Ptr + (i*3) ); float *s1Ptr = (float*)( src1Ptr + (i*3) ); - + vector float v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11; - v0 = vecOld0; + v0 = vecOld0; v1 = vec_ld( 15, s0Ptr ); v2 = vec_ld( 31, s0Ptr ); v3 = vec_ld( 47, s0Ptr ); v4 = vec_ld( 63, s0Ptr ); v5 = vec_ld( 79, s0Ptr ); vecOld0 = vec_ld( 95, s0Ptr ); - - v6 = vecOld1; + + v6 = vecOld1; v7 = vec_ld( 15, s1Ptr ); v8 = vec_ld( 31, s1Ptr ); v9 = vec_ld( 47, s1Ptr ); v10 = vec_ld( 63, s1Ptr ); v11 = vec_ld( 79, s1Ptr ); vecOld1 = vec_ld( 95, s1Ptr ); - + vecLd1 = vec_perm( v0, v1, permVec1 ); vecLd2 = vec_perm( v1, v2, permVec1 ); vecLd3 = vec_perm( v2, v3, permVec1 ); vecLd4 = vec_perm( v3, v4, permVec1 ); vecLd5 = vec_perm( v4, v5, permVec1 ); vecLd6 = vec_perm( v5, vecOld0, permVec1 ); - + vecLd7 = vec_perm( v6, v7, permVec2 ); vecLd8 = vec_perm( v7, v8, permVec2 ); vecLd9 = vec_perm( v8, v9, permVec2 ); vecLd10 = vec_perm( v9, v10, permVec2 ); vecLd11 = vec_perm( v10, v11, permVec2 ); vecLd12 = vec_perm( v11, vecOld1, permVec2 ); - + // permute into X Y Z vectors vecX0 = vec_perm( vecLd1, vecLd2, permX1 ); vecY0 = vec_perm( vecLd1, vecLd2, permY1 ); @@ -2210,51 +2210,51 @@ void VPCALL idSIMD_AltiVec::Dot( float *dst, const idVec3 *src0, const idVec3 *s vecX0 = vec_perm( vecX0, vecLd3, permX2 ); vecY0 = vec_perm( vecY0, vecLd3, permY2 ); vecZ0 = vec_perm( vecZ0, vecLd3, permZ2 ); - + vecX02 = vec_perm( vecLd4, vecLd5, permX1 ); vecY02 = vec_perm( vecLd4, vecLd5, permY1 ); vecZ02 = vec_perm( vecLd4, vecLd5, permZ1 ); vecX02 = vec_perm( vecX02, vecLd6, permX2 ); vecY02 = vec_perm( vecY02, vecLd6, permY2 ); vecZ02 = vec_perm( vecZ02, vecLd6, permZ2 ); - + vecX1 = vec_perm( vecLd7, vecLd8, permX1 ); vecY1 = vec_perm( vecLd7, vecLd8, permY1 ); vecZ1 = vec_perm( vecLd7, vecLd8, permZ1 ); vecX1 = vec_perm( vecX1, vecLd9, permX2 ); vecY1 = vec_perm( vecY1, vecLd9, permY2 ); vecZ1 = vec_perm( vecZ1, vecLd9, permZ2 ); - + vecX12 = vec_perm( vecLd10, vecLd11, permX1 ); vecY12 = vec_perm( vecLd10, vecLd11, permY1 ); vecZ12 = vec_perm( vecLd10, vecLd11, permZ1 ); vecX12 = vec_perm( vecX12, vecLd12, permX2 ); vecY12 = vec_perm( vecY12, vecLd12, permY2 ); - vecZ12 = vec_perm( vecZ12, vecLd12, permZ2 ); - + vecZ12 = vec_perm( vecZ12, vecLd12, permZ2 ); + // do multiply vecX0 = vec_madd( vecX0, vecX1, zeroVector ); vecY0 = vec_madd( vecY0, vecY1, vecX0 ); vecZ0 = vec_madd( vecZ0, vecZ1, vecY0 ); vecX02 = vec_madd( vecX02, vecX12, zeroVector ); vecY02 = vec_madd( vecY02, vecY12, vecX02 ); - vecZ02 = vec_madd( vecZ02, vecZ12, vecY02 ); - + vecZ02 = vec_madd( vecZ02, vecZ12, vecY02 ); + // store out results ALIGNED_STORE2( &dst[i], vecZ0, vecZ02 ); } - + // cleanup for ( ; i < count; i++ ) { // dst[i] = src0[i] * src1[i]; src0Val[0] = *( src0Ptr + (i*3) + 0 ); src0Val[1] = *( src0Ptr + (i*3) + 1 ); src0Val[2] = *( src0Ptr + (i*3) + 2 ); - + src1Val[0] = *( src1Ptr + (i*3) + 0 ); src1Val[1] = *( src1Ptr + (i*3) + 1 ); - src1Val[2] = *( src1Ptr + (i*3) + 2 ); - + src1Val[2] = *( src1Ptr + (i*3) + 2 ); + dst[i] = src0Val[0] * src1Val[0] + src0Val[1] * src1Val[1] + src0Val[2] * src1Val[2]; } } @@ -2269,10 +2269,10 @@ idSIMD_AltiVec::Dot void VPCALL idSIMD_AltiVec::Dot( float &dot, const float *src1, const float *src2, const int count ) { dot = 0.0f; - register vector float v0, v1, v2, v3; - register vector float zeroVector; - register vector float runningTotal1, runningTotal2; - //src0 + register vector float v0, v1, v2, v3; + register vector float zeroVector; + register vector float runningTotal1, runningTotal2; + //src0 register vector float v0_low, v0_hi, v2_low, v2_hi; //src1 register vector float v1_low, v1_hi, v3_low, v3_hi; @@ -2280,13 +2280,13 @@ void VPCALL idSIMD_AltiVec::Dot( float &dot, const float *src1, const float *src register vector unsigned char permVec1, permVec2; vector unsigned char oneCharVector = (vector unsigned char)(1); - int i = 0; - - runningTotal1 = (vector float)(0.0); + int i = 0; + + runningTotal1 = (vector float)(0.0); runningTotal2 = (vector float)(0.0); - zeroVector = (vector float)(0.0); - - if ( count >= 8 ) { + zeroVector = (vector float)(0.0); + + if ( count >= 8 ) { //calculate permute and do loads permVec1 = vec_add( vec_lvsl( -1, (int*) &src1[i] ), oneCharVector ); permVec2 = vec_add( vec_lvsl( -1, (int*) &src2[i] ), oneCharVector ); @@ -2300,12 +2300,12 @@ void VPCALL idSIMD_AltiVec::Dot( float &dot, const float *src1, const float *src v0_hi = vec_ld( 15, &src1[i] ); v2_low = v0_hi; v2_hi = vec_ld( 31, &src1[i] ); - + v1_low = v3_hi; v1_hi = vec_ld( 15, &src2[i] ); v3_low = v1_hi; v3_hi = vec_ld( 31, &src2[i] ); - + v0 = vec_perm( v0_low, v0_hi, permVec1 ); v1 = vec_perm( v1_low, v1_hi, permVec2 ); v2 = vec_perm( v2_low, v2_hi, permVec1 ); @@ -2315,23 +2315,23 @@ void VPCALL idSIMD_AltiVec::Dot( float &dot, const float *src1, const float *src runningTotal1 = vec_madd( v0, v1, runningTotal1 ); runningTotal2 = vec_madd( v2, v3, runningTotal2 ); } - + runningTotal1 = vec_add( runningTotal1, runningTotal2 ); - + // sum accross vector v0 = vec_add( runningTotal1, vec_sld( runningTotal1, runningTotal1, 8 ) ); v1 = vec_add( v0, vec_sld( v0, v0, 4 ) ); runningTotal1 = vec_splat( v1, 0 ); vec_ste( runningTotal1, 0, &dot ); - } - - //handle cleanup. when profiling the game, we found that most of the counts to this function were small, so it - // spends a lot of time in this scalar code. It's already really really fast (eg 1 TB tick) for scalar code for - // counts less than 50, so not much point in trying to get vector code in on the action + } + + //handle cleanup. when profiling the game, we found that most of the counts to this function were small, so it + // spends a lot of time in this scalar code. It's already really really fast (eg 1 TB tick) for scalar code for + // counts less than 50, so not much point in trying to get vector code in on the action for ( ; i < count ; i++ ) { dot += src1[i] * src2[i]; } - + } #endif /* ENABLE_DOT */ @@ -2348,31 +2348,31 @@ idSIMD_AltiVec::CmpGT void VPCALL idSIMD_AltiVec::CmpGT( byte *dst, const float *src0, const float constant, const int count ) { //#define OPER(X) dst[(X)] = src0[(X)] > constant; - register vector float v0, v1, v2, v3; - register vector bool int vr1, vr2, vr3, vr4; + register vector float v0, v1, v2, v3; + register vector bool int vr1, vr2, vr3, vr4; register vector bool short vs1, vs2; register vector float v0_low, v0_hi, v1_low, v1_hi, v2_low, v2_hi, v3_low, v3_hi; register vector unsigned char vc1; register vector bool char vbc1; - register vector float constVec; - register vector unsigned char oneVector = (vector unsigned char)(1); + register vector float constVec; + register vector unsigned char oneVector = (vector unsigned char)(1); register vector unsigned char permVec; - int i; + int i; - //handle unaligned at start - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + //handle unaligned at start + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { dst[i] = src0[i] > constant; - } - + } + //splat constant into a vector - constVec = loadSplatUnalignedScalar( &constant ); - + constVec = loadSplatUnalignedScalar( &constant ); + //calculate permute and do loads permVec = vec_add( vec_lvsl( -1, (int*) &src0[i] ), oneVector ); v3_hi = vec_ld( 0, &src0[i] ); - - //vectorize! - for ( ; i+15 < count; i += 16 ) { + + //vectorize! + for ( ; i+15 < count; i += 16 ) { // load values v0_low = v3_hi; v0_hi = vec_ld( 15, &src0[i] ); @@ -2382,37 +2382,37 @@ void VPCALL idSIMD_AltiVec::CmpGT( byte *dst, const float *src0, const float con v2_hi = vec_ld( 47, &src0[i] ); v3_low = v2_hi; v3_hi = vec_ld( 63, &src0[i] ); - + //permute into the vectors we want v0 = vec_perm( v0_low, v0_hi, permVec ); v1 = vec_perm( v1_low, v1_hi, permVec ); v2 = vec_perm( v2_low, v2_hi, permVec ); v3 = vec_perm( v3_low, v3_hi, permVec ); - + //do comparison vr1 = vec_cmpgt( v0, constVec ); vr2 = vec_cmpgt( v1, constVec ); vr3 = vec_cmpgt( v2, constVec ); vr4 = vec_cmpgt( v3, constVec ); - + // pack results into shorts vs1 = vec_pack(vr1, vr2); vs2 = vec_pack(vr3, vr4); - + // pack results into byte vbc1 = vec_pack(vs1, vs2); - + //AND with 1 to get true=1 not true=255 vc1 = vec_and( vbc1, oneVector ); - + //store results vec_st( vc1, 0, &dst[i] ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] = src0[i] > constant; - } + } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] = src0[i] > constant; + } } @@ -2427,46 +2427,46 @@ void VPCALL idSIMD_AltiVec::CmpGT( byte *dst, const byte bitNum, const float *sr //#define OPER(X) dst[(X)] |= ( src0[(X)] > constant ) << bitNum; // Temp vector registers - register vector bool int vtbi0, vtbi1, vtbi2, vtbi3; + register vector bool int vtbi0, vtbi1, vtbi2, vtbi3; register vector bool short vtbs0, vtbs1; register vector bool char vtbc0; - register vector unsigned char vtuc0; - register vector unsigned char permVec, permVec2; - + register vector unsigned char vtuc0; + register vector unsigned char permVec, permVec2; + // dest vectors - register vector unsigned char vd; + register vector unsigned char vd; // bitNum vectors - register vector unsigned char bitNumVec; + register vector unsigned char bitNumVec; // src0 vectors - register vector float vs0, vs1, vs2, vs3; + register vector float vs0, vs1, vs2, vs3; register vector float vs0_low, vs0_hi, vs1_low, vs1_hi, vs2_low, vs2_hi, vs3_low, vs3_hi; // constant vector - register vector float constVec; - // all one's + register vector float constVec; + // all one's register vector unsigned char oneVector = (vector unsigned char)(1); int i = 0; - + //handle unaligned at start - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { dst[i] |= ( src0[i] > constant ) << bitNum; - } - + } + //splat constant into a vector constVec = loadSplatUnalignedScalar( &constant ); - - //bitNum is unaligned. - permVec2 = vec_lvsl( 0, &bitNum ); - vtuc0 = vec_ld( 0, &bitNum ); - bitNumVec = vec_perm( vtuc0, vtuc0, permVec2 ); - bitNumVec = vec_splat( bitNumVec, 0 ); + + //bitNum is unaligned. + permVec2 = vec_lvsl( 0, &bitNum ); + vtuc0 = vec_ld( 0, &bitNum ); + bitNumVec = vec_perm( vtuc0, vtuc0, permVec2 ); + bitNumVec = vec_splat( bitNumVec, 0 ); //calculate permute and do loads permVec = vec_add( vec_lvsl( -1, (int*) &src0[i] ), oneVector ); - vs3_hi = vec_ld( 0, &src0[i] ); + vs3_hi = vec_ld( 0, &src0[i] ); - //vectorize! - for ( ; i+15 < count; i += 16 ) { - //load sources (floats) + //vectorize! + for ( ; i+15 < count; i += 16 ) { + //load sources (floats) vs0_low = vs3_hi; vs0_hi = vec_ld( 15, &src0[i] ); vs1_low = vs0_hi; @@ -2475,43 +2475,43 @@ void VPCALL idSIMD_AltiVec::CmpGT( byte *dst, const byte bitNum, const float *sr vs2_hi = vec_ld( 47, &src0[i] ); vs3_low = vs2_hi; vs3_hi = vec_ld( 63, &src0[i] ); - + //permute into the vectors we want vs0 = vec_perm( vs0_low, vs0_hi, permVec ); vs1 = vec_perm( vs1_low, vs1_hi, permVec ); vs2 = vec_perm( vs2_low, vs2_hi, permVec ); vs3 = vec_perm( vs3_low, vs3_hi, permVec ); - + //load dest (bytes) as unsigned char vd = vec_ld( 0, &dst[i] ); - + // do comparison and get bool int result vtbi0 = vec_cmpgt( vs0, constVec ); vtbi1 = vec_cmpgt( vs1, constVec ); vtbi2 = vec_cmpgt( vs2, constVec ); - vtbi3 = vec_cmpgt( vs3, constVec ); - + vtbi3 = vec_cmpgt( vs3, constVec ); + // pack results into shorts vtbs0 = vec_pack(vtbi0, vtbi1); vtbs1 = vec_pack(vtbi2, vtbi3); - + // pack results into byte vtbc0 = vec_pack(vtbs0, vtbs1); - + //and with 1 to get true=1 instead of true=255 vtuc0 = vec_and(vtbc0, oneVector); vtuc0 = vec_sl(vtuc0, bitNumVec ); - + //or with original vd = vec_or( vd, vtuc0 ); - + vec_st( vd, 0, &dst[i] ); - } - - //handle cleanup + } + + //handle cleanup for ( ; i < count ; i++ ) { dst[i] |= ( src0[i] > constant ) << bitNum; - } + } } /* @@ -2523,31 +2523,31 @@ idSIMD_AltiVec::CmpGE */ void VPCALL idSIMD_AltiVec::CmpGE( byte *dst, const float *src0, const float constant, const int count ) { - register vector float v0, v1, v2, v3; - register vector bool int vr1, vr2, vr3, vr4; + register vector float v0, v1, v2, v3; + register vector bool int vr1, vr2, vr3, vr4; register vector bool short vs1, vs2; register vector float v0_low, v0_hi, v1_low, v1_hi, v2_low, v2_hi, v3_low, v3_hi; register vector unsigned char vc1; register vector bool char vbc1; - register vector float constVec; - register vector unsigned char oneVector = (vector unsigned char)(1); + register vector float constVec; + register vector unsigned char oneVector = (vector unsigned char)(1); register vector unsigned char permVec; - int i = 0; + int i = 0; - //handle unaligned at start - for ( ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + //handle unaligned at start + for ( ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { dst[i] = src0[i] >= constant; - } - + } + //splat constant into a vector - constVec = loadSplatUnalignedScalar( &constant ); - + constVec = loadSplatUnalignedScalar( &constant ); + //calculate permute and do loads permVec = vec_add( vec_lvsl( -1, (int*) &src0[i] ), oneVector ); v3_hi = vec_ld( 0, &src0[i] ); - - //vectorize! - for ( ; i+15 < count; i += 16 ) { + + //vectorize! + for ( ; i+15 < count; i += 16 ) { // load values v0_low = v3_hi; v0_hi = vec_ld( 15, &src0[i] ); @@ -2582,12 +2582,12 @@ void VPCALL idSIMD_AltiVec::CmpGE( byte *dst, const float *src0, const float con //store results vec_st( vc1, 0, &dst[i] ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] = src0[i] >= constant; - } + } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] = src0[i] >= constant; + } } /* @@ -2598,46 +2598,46 @@ idSIMD_AltiVec::CmpGE ============ */ void VPCALL idSIMD_AltiVec::CmpGE( byte *dst, const byte bitNum, const float *src0, const float constant, const int count ) { - register vector bool int vtbi0, vtbi1, vtbi2, vtbi3; + register vector bool int vtbi0, vtbi1, vtbi2, vtbi3; register vector bool short vtbs0, vtbs1; register vector bool char vtbc0; - register vector unsigned char vtuc0; - register vector unsigned char permVec, permVec2; - + register vector unsigned char vtuc0; + register vector unsigned char permVec, permVec2; + // dest vectors - register vector unsigned char vd; + register vector unsigned char vd; // bitNum vectors - register vector unsigned char bitNumVec; + register vector unsigned char bitNumVec; // src0 vectors - register vector float vs0, vs1, vs2, vs3; + register vector float vs0, vs1, vs2, vs3; register vector float vs0_low, vs0_hi, vs1_low, vs1_hi, vs2_low, vs2_hi, vs3_low, vs3_hi; // constant vector - register vector float constVec; - // all one's + register vector float constVec; + // all one's register vector unsigned char oneVector = (vector unsigned char)(1); int i = 0; - + //handle unaligned at start - for ( ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + for ( ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { dst[i] |= ( src0[i] >= constant ) << bitNum; - } - + } + //splat constant into a vector constVec = loadSplatUnalignedScalar( &constant ); - - //bitNum is unaligned. - permVec2 = vec_lvsl( 0, &bitNum ); - vtuc0 = vec_ld( 0, &bitNum ); - bitNumVec = vec_perm( vtuc0, vtuc0, permVec2 ); - bitNumVec = vec_splat( bitNumVec, 0 ); + + //bitNum is unaligned. + permVec2 = vec_lvsl( 0, &bitNum ); + vtuc0 = vec_ld( 0, &bitNum ); + bitNumVec = vec_perm( vtuc0, vtuc0, permVec2 ); + bitNumVec = vec_splat( bitNumVec, 0 ); //calculate permute and do loads permVec = vec_add( vec_lvsl( -1, (int*) &src0[i] ), oneVector ); - vs3_hi = vec_ld( 0, &src0[i] ); + vs3_hi = vec_ld( 0, &src0[i] ); - //vectorize! - for ( ; i+15 < count; i += 16 ) { - //load sources (floats) + //vectorize! + for ( ; i+15 < count; i += 16 ) { + //load sources (floats) vs0_low = vs3_hi; vs0_hi = vec_ld( 15, &src0[i] ); vs1_low = vs0_hi; @@ -2646,43 +2646,43 @@ void VPCALL idSIMD_AltiVec::CmpGE( byte *dst, const byte bitNum, const float *sr vs2_hi = vec_ld( 47, &src0[i] ); vs3_low = vs2_hi; vs3_hi = vec_ld( 63, &src0[i] ); - + //permute into the vectors we want vs0 = vec_perm( vs0_low, vs0_hi, permVec ); vs1 = vec_perm( vs1_low, vs1_hi, permVec ); vs2 = vec_perm( vs2_low, vs2_hi, permVec ); vs3 = vec_perm( vs3_low, vs3_hi, permVec ); - + //load dest (bytes) as unsigned char vd = vec_ld( 0, &dst[i] ); - + // do comparison and get bool int result vtbi0 = vec_cmpge( vs0, constVec ); vtbi1 = vec_cmpge( vs1, constVec ); vtbi2 = vec_cmpge( vs2, constVec ); - vtbi3 = vec_cmpge( vs3, constVec ); - + vtbi3 = vec_cmpge( vs3, constVec ); + // pack results into shorts vtbs0 = vec_pack(vtbi0, vtbi1); vtbs1 = vec_pack(vtbi2, vtbi3); - + // pack results into byte vtbc0 = vec_pack(vtbs0, vtbs1); - + //and with 1L to get true=1 instead of true=255 vtuc0 = vec_and(vtbc0, oneVector); vtuc0 = vec_sl(vtuc0, bitNumVec ); - + //or with original vd = vec_or( vd, vtuc0 ); - + vec_st( vd, 0, &dst[i] ); - } - - //handle cleanup + } + + //handle cleanup for ( ; i < count ; i++ ) { dst[i] |= ( src0[i] >= constant ) << bitNum; - } + } } @@ -2695,31 +2695,31 @@ idSIMD_AltiVec::CmpLT */ void VPCALL idSIMD_AltiVec::CmpLT( byte *dst, const float *src0, const float constant, const int count ) { //#define OPER(X) dst[(X)] = src0[(X)] < constant; - register vector float v0, v1, v2, v3; - register vector bool int vr1, vr2, vr3, vr4; + register vector float v0, v1, v2, v3; + register vector bool int vr1, vr2, vr3, vr4; register vector bool short vs1, vs2; register vector float v0_low, v0_hi, v1_low, v1_hi, v2_low, v2_hi, v3_low, v3_hi; register vector unsigned char vc1; register vector bool char vbc1; - register vector float constVec; - register vector unsigned char oneVector = (vector unsigned char)(1); + register vector float constVec; + register vector unsigned char oneVector = (vector unsigned char)(1); register vector unsigned char permVec; - int i = 0; + int i = 0; - //handle unaligned at start - for ( ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + //handle unaligned at start + for ( ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { dst[i] = src0[i] < constant; - } - + } + //splat constant into a vector - constVec = loadSplatUnalignedScalar( &constant ); - + constVec = loadSplatUnalignedScalar( &constant ); + //calculate permute and do loads permVec = vec_add( vec_lvsl( -1, (int*) &src0[i] ), oneVector ); v3_hi = vec_ld( 0, &src0[i] ); - - //vectorize! - for ( ; i+15 < count; i += 16 ) { + + //vectorize! + for ( ; i+15 < count; i += 16 ) { // load values v0_low = v3_hi; v0_hi = vec_ld( 15, &src0[i] ); @@ -2729,37 +2729,37 @@ void VPCALL idSIMD_AltiVec::CmpLT( byte *dst, const float *src0, const float con v2_hi = vec_ld( 47, &src0[i] ); v3_low = v2_hi; v3_hi = vec_ld( 63, &src0[i] ); - + //permute into the vectors we want v0 = vec_perm( v0_low, v0_hi, permVec ); v1 = vec_perm( v1_low, v1_hi, permVec ); v2 = vec_perm( v2_low, v2_hi, permVec ); v3 = vec_perm( v3_low, v3_hi, permVec ); - + //do comparison vr1 = vec_cmplt( v0, constVec ); vr2 = vec_cmplt( v1, constVec ); vr3 = vec_cmplt( v2, constVec ); vr4 = vec_cmplt( v3, constVec ); - + // pack results into shorts vs1 = vec_pack(vr1, vr2); vs2 = vec_pack(vr3, vr4); - + // pack results into byte vbc1 = vec_pack(vs1, vs2); - + //AND with 1 to get true=1 not true=255 vc1 = vec_and( vbc1, oneVector ); - + //store results vec_st( vc1, 0, &dst[i] ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] = src0[i] < constant; - } + } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] = src0[i] < constant; + } } /* @@ -2771,46 +2771,46 @@ idSIMD_AltiVec::CmpLT */ void VPCALL idSIMD_AltiVec::CmpLT( byte *dst, const byte bitNum, const float *src0, const float constant, const int count ) { //#define OPER(X) dst[(X)] |= ( src0[(X)] < constant ) << bitNum; - register vector bool int vtbi0, vtbi1, vtbi2, vtbi3; + register vector bool int vtbi0, vtbi1, vtbi2, vtbi3; register vector bool short vtbs0, vtbs1; register vector bool char vtbc0; - register vector unsigned char vtuc0; - register vector unsigned char permVec, permVec2; - + register vector unsigned char vtuc0; + register vector unsigned char permVec, permVec2; + // dest vectors - register vector unsigned char vd; + register vector unsigned char vd; // bitNum vectors - register vector unsigned char bitNumVec; + register vector unsigned char bitNumVec; // src0 vectors - register vector float vs0, vs1, vs2, vs3; + register vector float vs0, vs1, vs2, vs3; register vector float vs0_low, vs0_hi, vs1_low, vs1_hi, vs2_low, vs2_hi, vs3_low, vs3_hi; // constant vector - register vector float constVec; - // all one's + register vector float constVec; + // all one's register vector unsigned char oneVector = (vector unsigned char)(1); int i = 0; - + //handle unaligned at start - for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + for ( i = 0 ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { dst[i] |= ( src0[i] < constant ) << bitNum; - } - + } + //splat constant into a vector constVec = loadSplatUnalignedScalar( &constant ); - - //bitNum is unaligned. - permVec2 = vec_lvsl( 0, &bitNum ); - vtuc0 = vec_ld( 0, &bitNum ); - bitNumVec = vec_perm( vtuc0, vtuc0, permVec2 ); - bitNumVec = vec_splat( bitNumVec, 0 ); + + //bitNum is unaligned. + permVec2 = vec_lvsl( 0, &bitNum ); + vtuc0 = vec_ld( 0, &bitNum ); + bitNumVec = vec_perm( vtuc0, vtuc0, permVec2 ); + bitNumVec = vec_splat( bitNumVec, 0 ); //calculate permute and do loads permVec = vec_add( vec_lvsl( -1, (int*) &src0[i] ), oneVector ); - vs3_hi = vec_ld( 0, &src0[i] ); + vs3_hi = vec_ld( 0, &src0[i] ); - //vectorize! - for ( ; i+15 < count; i += 16 ) { - //load sources (floats) + //vectorize! + for ( ; i+15 < count; i += 16 ) { + //load sources (floats) vs0_low = vs3_hi; vs0_hi = vec_ld( 15, &src0[i] ); vs1_low = vs0_hi; @@ -2819,43 +2819,43 @@ void VPCALL idSIMD_AltiVec::CmpLT( byte *dst, const byte bitNum, const float *sr vs2_hi = vec_ld( 47, &src0[i] ); vs3_low = vs2_hi; vs3_hi = vec_ld( 63, &src0[i] ); - + //permute into the vectors we want vs0 = vec_perm( vs0_low, vs0_hi, permVec ); vs1 = vec_perm( vs1_low, vs1_hi, permVec ); vs2 = vec_perm( vs2_low, vs2_hi, permVec ); vs3 = vec_perm( vs3_low, vs3_hi, permVec ); - + //load dest (bytes) as unsigned char vd = vec_ld( 0, &dst[i] ); - + // do comparison and get bool int result vtbi0 = vec_cmplt( vs0, constVec ); vtbi1 = vec_cmplt( vs1, constVec ); vtbi2 = vec_cmplt( vs2, constVec ); - vtbi3 = vec_cmplt( vs3, constVec ); - + vtbi3 = vec_cmplt( vs3, constVec ); + // pack results into shorts vtbs0 = vec_pack(vtbi0, vtbi1); vtbs1 = vec_pack(vtbi2, vtbi3); - + // pack results into byte vtbc0 = vec_pack(vtbs0, vtbs1); - + //and with 1L to get true=1 instead of true=255 vtuc0 = vec_and(vtbc0, oneVector); vtuc0 = vec_sl(vtuc0, bitNumVec ); - + //or with original vd = vec_or( vd, vtuc0 ); - + vec_st( vd, 0, &dst[i] ); - } - - //handle cleanup + } + + //handle cleanup for ( ; i < count ; i++ ) { dst[i] |= ( src0[i] < constant ) << bitNum; - } + } } //#endif @@ -2869,31 +2869,31 @@ idSIMD_AltiVec::CmpLE */ void VPCALL idSIMD_AltiVec::CmpLE( byte *dst, const float *src0, const float constant, const int count ) { //#define OPER(X) dst[(X)] = src0[(X)] <= constant; - register vector float v0, v1, v2, v3; - register vector bool int vr1, vr2, vr3, vr4; + register vector float v0, v1, v2, v3; + register vector bool int vr1, vr2, vr3, vr4; register vector bool short vs1, vs2; register vector float v0_low, v0_hi, v1_low, v1_hi, v2_low, v2_hi, v3_low, v3_hi; register vector unsigned char vc1; register vector bool char vbc1; - register vector float constVec; - register vector unsigned char oneVector = (vector unsigned char)(1); + register vector float constVec; + register vector unsigned char oneVector = (vector unsigned char)(1); register vector unsigned char permVec; - int i = 0; + int i = 0; - //handle unaligned at start - for ( ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + //handle unaligned at start + for ( ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { dst[i] = src0[i] <= constant; - } - + } + //splat constant into a vector - constVec = loadSplatUnalignedScalar( &constant ); - + constVec = loadSplatUnalignedScalar( &constant ); + //calculate permute and do loads permVec = vec_add( vec_lvsl( -1, (int*) &src0[i] ), oneVector ); v3_hi = vec_ld( 0, &src0[i] ); - - //vectorize! - for ( ; i+15 < count; i += 16 ) { + + //vectorize! + for ( ; i+15 < count; i += 16 ) { // load values v0_low = v3_hi; v0_hi = vec_ld( 15, &src0[i] ); @@ -2903,37 +2903,37 @@ void VPCALL idSIMD_AltiVec::CmpLE( byte *dst, const float *src0, const float con v2_hi = vec_ld( 47, &src0[i] ); v3_low = v2_hi; v3_hi = vec_ld( 63, &src0[i] ); - + //permute into the vectors we want v0 = vec_perm( v0_low, v0_hi, permVec ); v1 = vec_perm( v1_low, v1_hi, permVec ); v2 = vec_perm( v2_low, v2_hi, permVec ); v3 = vec_perm( v3_low, v3_hi, permVec ); - + //do comparison vr1 = vec_cmple( v0, constVec ); vr2 = vec_cmple( v1, constVec ); vr3 = vec_cmple( v2, constVec ); vr4 = vec_cmple( v3, constVec ); - + // pack results into shorts vs1 = vec_pack(vr1, vr2); vs2 = vec_pack(vr3, vr4); - + // pack results into byte vbc1 = vec_pack(vs1, vs2); - + //AND with 1 to get true=1 not true=255 vc1 = vec_and( vbc1, oneVector ); - + //store results vec_st( vc1, 0, &dst[i] ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { - dst[i] = src0[i] <= constant; - } + } + + //handle cleanup + for ( ; i < count ; i++ ) { + dst[i] = src0[i] <= constant; + } } /* @@ -2945,46 +2945,46 @@ idSIMD_AltiVec::CmpLE */ void VPCALL idSIMD_AltiVec::CmpLE( byte *dst, const byte bitNum, const float *src0, const float constant, const int count ) { //#define OPER(X) dst[(X)] |= ( src0[(X)] <= constant ) << bitNum; - register vector bool int vtbi0, vtbi1, vtbi2, vtbi3; + register vector bool int vtbi0, vtbi1, vtbi2, vtbi3; register vector bool short vtbs0, vtbs1; register vector bool char vtbc0; - register vector unsigned char vtuc0; - register vector unsigned char permVec, permVec2; - + register vector unsigned char vtuc0; + register vector unsigned char permVec, permVec2; + // dest vectors - register vector unsigned char vd; + register vector unsigned char vd; // bitNum vectors - register vector unsigned char bitNumVec; + register vector unsigned char bitNumVec; // src0 vectors - register vector float vs0, vs1, vs2, vs3; + register vector float vs0, vs1, vs2, vs3; register vector float vs0_low, vs0_hi, vs1_low, vs1_hi, vs2_low, vs2_hi, vs3_low, vs3_hi; // constant vector - register vector float constVec; - // all one's + register vector float constVec; + // all one's register vector unsigned char oneVector = (vector unsigned char)(1); int i = 0; - + //handle unaligned at start - for ( ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { + for ( ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count );i++ ) { dst[i] |= ( src0[i] <= constant ) << bitNum; - } - + } + //splat constant into a vector constVec = loadSplatUnalignedScalar( &constant ); - - //bitNum is unaligned. - permVec2 = vec_lvsl( 0, &bitNum ); - vtuc0 = vec_ld( 0, &bitNum ); - bitNumVec = vec_perm( vtuc0, vtuc0, permVec2 ); - bitNumVec = vec_splat( bitNumVec, 0 ); + + //bitNum is unaligned. + permVec2 = vec_lvsl( 0, &bitNum ); + vtuc0 = vec_ld( 0, &bitNum ); + bitNumVec = vec_perm( vtuc0, vtuc0, permVec2 ); + bitNumVec = vec_splat( bitNumVec, 0 ); //calculate permute and do loads permVec = vec_add( vec_lvsl( -1, (int*) &src0[i] ), oneVector ); - vs3_hi = vec_ld( 0, &src0[i] ); + vs3_hi = vec_ld( 0, &src0[i] ); - //vectorize! - for ( ; i+15 < count; i += 16 ) { - //load sources (floats) + //vectorize! + for ( ; i+15 < count; i += 16 ) { + //load sources (floats) vs0_low = vs3_hi; vs0_hi = vec_ld( 15, &src0[i] ); vs1_low = vs0_hi; @@ -2993,43 +2993,43 @@ void VPCALL idSIMD_AltiVec::CmpLE( byte *dst, const byte bitNum, const float *sr vs2_hi = vec_ld( 47, &src0[i] ); vs3_low = vs2_hi; vs3_hi = vec_ld( 63, &src0[i] ); - + //permute into the vectors we want vs0 = vec_perm( vs0_low, vs0_hi, permVec ); vs1 = vec_perm( vs1_low, vs1_hi, permVec ); vs2 = vec_perm( vs2_low, vs2_hi, permVec ); vs3 = vec_perm( vs3_low, vs3_hi, permVec ); - + //load dest (bytes) as unsigned char vd = vec_ld( 0, &dst[i] ); - + // do comparison and get bool int result vtbi0 = vec_cmple( vs0, constVec ); vtbi1 = vec_cmple( vs1, constVec ); vtbi2 = vec_cmple( vs2, constVec ); - vtbi3 = vec_cmple( vs3, constVec ); - + vtbi3 = vec_cmple( vs3, constVec ); + // pack results into shorts vtbs0 = vec_pack(vtbi0, vtbi1); vtbs1 = vec_pack(vtbi2, vtbi3); - + // pack results into byte vtbc0 = vec_pack(vtbs0, vtbs1); - + //and with 1L to get true=1 instead of true=255 vtuc0 = vec_and(vtbc0, oneVector); vtuc0 = vec_sl(vtuc0, bitNumVec ); - + //or with original vd = vec_or( vd, vtuc0 ); - + vec_st( vd, 0, &dst[i] ); - } - - //handle cleanup + } + + //handle cleanup for ( ; i < count ; i++ ) { dst[i] |= ( src0[i] <= constant ) << bitNum; - } + } } #endif /* ENABLE_COMPARES */ @@ -3044,23 +3044,23 @@ void VPCALL idSIMD_AltiVec::MinMax( float &min, float &max, const float *src, co min = idMath::INFINITY; max = -idMath::INFINITY; //#define OPER(X) if ( src[(X)] < min ) {min = src[(X)];} if ( src[(X)] > max ) {max = src[(X)];} - register vector float v0, v1, v2, v3; - register vector float maxVec, minVec, tempMin, tempMax; - register vector unsigned char permVec; - register vector float v0_low, v0_hi, v1_low, v1_hi; + register vector float v0, v1, v2, v3; + register vector float maxVec, minVec, tempMin, tempMax; + register vector unsigned char permVec; + register vector float v0_low, v0_hi, v1_low, v1_hi; vector unsigned char oneCharVector = (vector unsigned char)(1); int i = 0; - - if ( count >= 4 ) { - + + if ( count >= 4 ) { + //calculate permute and do first load to //get a starting point for min and max permVec = vec_add( vec_lvsl( -1, (int*) &src[0] ), oneCharVector ); v1_hi = vec_ld( 0, &src[0] ); - + maxVec = loadSplatUnalignedScalar( &max ); minVec = loadSplatUnalignedScalar( &min ); - + //vectorize! for ( ; i+7 < count; i += 8 ) { //load sources @@ -3070,7 +3070,7 @@ void VPCALL idSIMD_AltiVec::MinMax( float &min, float &max, const float *src, co v1_hi = vec_ld( 31, &src[i] ); v0 = vec_perm( v0_low, v0_hi, permVec ); v1 = vec_perm( v1_low, v1_hi, permVec ); - + // minimum v2 = vec_min( v0, v1 ); minVec = vec_min( minVec, v2 ); @@ -3078,10 +3078,10 @@ void VPCALL idSIMD_AltiVec::MinMax( float &min, float &max, const float *src, co v3 = vec_max( v0, v1 ); maxVec = vec_max( maxVec, v3 ); } - + //minVec and maxVec hold the min/max elements from the array, but now //we need to figure out which particular element it is - + tempMin = minVec; tempMax = maxVec; @@ -3094,13 +3094,13 @@ void VPCALL idSIMD_AltiVec::MinMax( float &min, float &max, const float *src, co maxVec = vec_splat( tempMax, 0 ); vec_ste( minVec, 0, &min ); vec_ste( maxVec, 0, &max ); - } - + } + //cleanup - for ( ; i < count; i++ ) { + for ( ; i < count; i++ ) { if ( src[i] < min ) { min = src[i]; - } + } if ( src[i] > max ) { max = src[i]; } @@ -3119,18 +3119,18 @@ void VPCALL idSIMD_AltiVec::MinMax( idVec2 &min, idVec2 &max, const idVec2 *src, idVec2 v; int i = 0; int j; - + const float *srcPtr = src[0].ToFloatPtr(); register vector float vecLd1, vecLd2, vecLd3, vecLd4; register vector float vecMin, vecMax; - + register vector float v0, v1, v2, v3; - + if ( count > 4 ) { - + vecMin = (vector float)(FLT_MAX); vecMax = (vector float)(FLT_MIN); - + vector unsigned char permVec = vec_add( vec_lvsl( -1, srcPtr ), (vector unsigned char)(1) ); vector float vecOld = vec_ld( 0, srcPtr ); @@ -3138,13 +3138,13 @@ void VPCALL idSIMD_AltiVec::MinMax( idVec2 &min, idVec2 &max, const idVec2 *src, // load data float *vecPtr = (float*)( srcPtr + (j*4) ); vector float v0, v1, v2, v3; - - v0 = vecOld; + + v0 = vecOld; v1 = vec_ld( 15, vecPtr ); v2 = vec_ld( 31, vecPtr ); v3 = vec_ld( 47, vecPtr ); vecOld = vec_ld( 63, vecPtr ); - + vecLd1 = vec_perm( v0, v1, permVec ); vecLd2 = vec_perm( v1, v2, permVec ); vecLd3 = vec_perm( v2, v3, permVec ); @@ -3155,11 +3155,11 @@ void VPCALL idSIMD_AltiVec::MinMax( idVec2 &min, idVec2 &max, const idVec2 *src, v0 = vec_min( vecLd1, vecLd2 ); v1 = vec_min( vecLd3, vecLd4 ); v0 = vec_min( v0, v1 ); - + v2 = vec_max( vecLd1, vecLd2 ); v3 = vec_max( vecLd3, vecLd4 ); v2 = vec_max( v2, v3 ); - + // since its always X Y X Y we don't have to re-merge each time. we can wait // until the end vecMin = vec_min( v0, vecMin ); @@ -3172,24 +3172,24 @@ void VPCALL idSIMD_AltiVec::MinMax( idVec2 &min, idVec2 &max, const idVec2 *src, v1 = vec_splat( vecMin, 1 ); v2 = vec_splat( vecMax, 0 ); v3 = vec_splat( vecMax, 1 ); - + vec_ste( v0, 0, &min[0] ); vec_ste( v1, 0, &min[1] ); vec_ste( v2, 0, &max[0] ); vec_ste( v3, 0, &max[1] ); - } - + } + // cleanup for ( ; i < count; i++ ) { v = src[i]; - + if ( v[0] < min[0] ) { min[0] = v[0]; } if ( v[0] > max[0] ) { max[0] = v[0]; } - + if ( v[1] < min[1] ) { min[1] = v[1]; } @@ -3216,12 +3216,12 @@ void VPCALL idSIMD_AltiVec::MinMax( idVec3 &min, idVec3 &max, const idVec3 *src, register vector float vecMin, vecMax; register vector float vecSrc1, vecSrc2, vecSrc3, vecSrc4; register vector float vecMin1, vecMin2, vecMax1, vecMax2; - + if ( count >= 4 ) { - + vecMin = (vector float)(FLT_MAX); vecMax = (vector float)(FLT_MIN); - + vector unsigned char permVec = vec_add( vec_lvsl( -1, srcPtr), (vector unsigned char)(1) ); vector float vecOld = vec_ld( 0, srcPtr ); @@ -3229,34 +3229,34 @@ void VPCALL idSIMD_AltiVec::MinMax( idVec3 &min, idVec3 &max, const idVec3 *src, for ( ; i+3 < count; i += 4 ) { float *vecPtr = (float*)( srcPtr + (i*3) ); vector float v0, v1, v2; - - v0 = vecOld; + + v0 = vecOld; v1 = vec_ld( 15, vecPtr ); v2 = vec_ld( 31, vecPtr ); vecOld = vec_ld( 47, vecPtr ); - + vecLd1 = vec_perm( v0, v1, permVec ); vecLd2 = vec_perm( v1, v2, permVec ); vecLd3 = vec_perm( v2, vecOld, permVec ); - + // put each idVec3 into its own vector as X Y Z (crap) vecSrc1 = vecLd1; - vecSrc2 = vec_sld( vecLd1, vecLd2, 12 ); - vecSrc3 = vec_sld( vecLd2, vecLd3, 8 ); + vecSrc2 = vec_sld( vecLd1, vecLd2, 12 ); + vecSrc3 = vec_sld( vecLd2, vecLd3, 8 ); vecSrc4 = vec_sld( vecLd3, vecLd3, 4 ); - + // do min and max vecMin1 = vec_min( vecSrc1, vecSrc2 ); vecMin2 = vec_min( vecSrc3, vecSrc4 ); vecMin1 = vec_min( vecMin1, vecMin2 ); vecMin = vec_min( vecMin, vecMin1 ); - + vecMax1 = vec_max( vecSrc1, vecSrc2 ); vecMax2 = vec_max( vecSrc3, vecSrc4 ); vecMax1 = vec_max( vecMax1, vecMax2 ); vecMax = vec_max( vecMax1, vecMax ); } - + // store results vector float v0, v1, v2, v3, v4, v5; v0 = vec_splat( vecMin, 0 ); @@ -3264,7 +3264,7 @@ void VPCALL idSIMD_AltiVec::MinMax( idVec3 &min, idVec3 &max, const idVec3 *src, v2 = vec_splat( vecMin, 2 ); v3 = vec_splat( vecMax, 0 ); v4 = vec_splat( vecMax, 1 ); - v5 = vec_splat( vecMax, 2 ); + v5 = vec_splat( vecMax, 2 ); vec_ste( v0, 0, &min[0] ); vec_ste( v1, 0, &min[1] ); @@ -3272,30 +3272,30 @@ void VPCALL idSIMD_AltiVec::MinMax( idVec3 &min, idVec3 &max, const idVec3 *src, vec_ste( v3, 0, &max[0] ); vec_ste( v4, 0, &max[1] ); vec_ste( v5, 0, &max[2] ); - } - + } + // cleanup for ( ; i < count; i ++ ) { v = src[i]; - - if ( v[0] < min[0] ) { - min[0] = v[0]; - } - if ( v[0] > max[0] ) { - max[0] = v[0]; - } - if ( v[1] < min[1] ) { - min[1] = v[1]; - } - if ( v[1] > max[1] ) { - max[1] = v[1]; - } - if ( v[2] < min[2] ) { - min[2] = v[2]; - } - if ( v[2] > max[2] ) { - max[2] = v[2]; - } + + if ( v[0] < min[0] ) { + min[0] = v[0]; + } + if ( v[0] > max[0] ) { + max[0] = v[0]; + } + if ( v[1] < min[1] ) { + min[1] = v[1]; + } + if ( v[1] > max[1] ) { + max[1] = v[1]; + } + if ( v[2] < min[2] ) { + min[2] = v[2]; + } + if ( v[2] > max[2] ) { + max[2] = v[2]; + } } } @@ -3306,23 +3306,23 @@ idSIMD_AltiVec::MinMax ============ */ void VPCALL idSIMD_AltiVec::MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, const int count ) { - - min[0] = min[1] = min[2] = idMath::INFINITY; max[0] = max[1] = max[2] = -idMath::INFINITY; + + min[0] = min[1] = min[2] = idMath::INFINITY; max[0] = max[1] = max[2] = -idMath::INFINITY; idVec3 v; - int i = 0; + int i = 0; register vector float vecMin, vecMax; - + register vector float v0, v1, v2, v3, v4, v5, v6, v7; register vector float vecMin1, vecMin2, vecMax1, vecMax2; - + if ( count >= 4 ) { vecMin = (vector float)(FLT_MAX); vecMax = (vector float)(FLT_MIN); - + vector unsigned char vertPerm1 = vec_add( vec_lvsl( -1, (float*) src[i].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); vector unsigned char vertPerm2 = vec_add( vec_lvsl( -1, (float*) src[i+1].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); vector unsigned char vertPerm3 = vec_add( vec_lvsl( -1, (float*) src[i+2].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); - vector unsigned char vertPerm4 = vec_add( vec_lvsl( -1, (float*) src[i+3].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); + vector unsigned char vertPerm4 = vec_add( vec_lvsl( -1, (float*) src[i+3].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); for ( ; i+3 < count; i += 4) { const float *vertPtr = src[i].xyz.ToFloatPtr(); @@ -3338,61 +3338,61 @@ void VPCALL idSIMD_AltiVec::MinMax( idVec3 &min, idVec3 &max, const idDrawVert * v5 = vec_ld( 11, vertPtr3 ); v6 = vec_ld( 0, vertPtr4 ); v7 = vec_ld( 11, vertPtr4 ); - + v0 = vec_perm( v0, v1, vertPerm1 ); v2 = vec_perm( v2, v3, vertPerm2 ); v4 = vec_perm( v4, v5, vertPerm3 ); v6 = vec_perm( v6, v7, vertPerm4 ); - + vecMin1 = vec_min( v0, v2 ); vecMin2 = vec_min( v4, v6 ); vecMin1 = vec_min( vecMin1, vecMin2 ); vecMin = vec_min( vecMin, vecMin1 ); - + vecMax1 = vec_max( v0, v2 ); vecMax2 = vec_max( v4, v6 ); vecMax1 = vec_max( vecMax1, vecMax2 ); - vecMax = vec_max( vecMax, vecMax1 ); + vecMax = vec_max( vecMax, vecMax1 ); } - + // now we have min/max vectors in X Y Z form, store out v0 = vec_splat( vecMin, 0 ); v1 = vec_splat( vecMin, 1 ); v2 = vec_splat( vecMin, 2 ); v3 = vec_splat( vecMax, 0 ); v4 = vec_splat( vecMax, 1 ); - v5 = vec_splat( vecMax, 2 ); + v5 = vec_splat( vecMax, 2 ); vec_ste( v0, 0, &min[0] ); vec_ste( v1, 0, &min[1] ); vec_ste( v2, 0, &min[2] ); vec_ste( v3, 0, &max[0] ); vec_ste( v4, 0, &max[1] ); - vec_ste( v5, 0, &max[2] ); - } - + vec_ste( v5, 0, &max[2] ); + } + // cleanup for ( ; i < count; i++ ) { v = src[i].xyz; - + if ( v[0] < min[0] ) { min[0] = v[0]; } if ( v[0] > max[0] ) { max[0] = v[0]; } - + if ( v[1] < min[1] ) { min[1] = v[1]; } if ( v[1] > max[1] ) { max[1] = v[1]; } - + if ( v[2] > max[2] ) { max[2] = v[2]; } - + if ( v[2] < min[2] ) { min[2] = v[2]; } @@ -3405,15 +3405,15 @@ idSIMD_AltiVec::MinMax ============ */ void VPCALL idSIMD_AltiVec::MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, const int count ) { - - min[0] = min[1] = min[2] = idMath::INFINITY; max[0] = max[1] = max[2] = -idMath::INFINITY; + + min[0] = min[1] = min[2] = idMath::INFINITY; max[0] = max[1] = max[2] = -idMath::INFINITY; idVec3 v; - int i = 0; + int i = 0; register vector float vecMin, vecMax; - + register vector float v0, v1, v2, v3, v4, v5, v6, v7; register vector float vecMin1, vecMin2, vecMax1, vecMax2; - + if ( count >= 4 ) { vecMin = (vector float)(FLT_MAX); vecMax = (vector float)(FLT_MIN); @@ -3428,56 +3428,56 @@ void VPCALL idSIMD_AltiVec::MinMax( idVec3 &min, idVec3 &max, const idDrawVert * v2 = vec_ld( 0, vertPtr2 ); v4 = vec_ld( 0, vertPtr3 ); v6 = vec_ld( 0, vertPtr4 ); - + vecMin1 = vec_min( v0, v2 ); vecMin2 = vec_min( v4, v6 ); vecMin1 = vec_min( vecMin1, vecMin2 ); vecMin = vec_min( vecMin, vecMin1 ); - + vecMax1 = vec_max( v0, v2 ); vecMax2 = vec_max( v4, v6 ); vecMax1 = vec_max( vecMax1, vecMax2 ); - vecMax = vec_max( vecMax, vecMax1 ); + vecMax = vec_max( vecMax, vecMax1 ); } - + // now we have min/max vectors in X Y Z form, store out v0 = vec_splat( vecMin, 0 ); v1 = vec_splat( vecMin, 1 ); v2 = vec_splat( vecMin, 2 ); v3 = vec_splat( vecMax, 0 ); v4 = vec_splat( vecMax, 1 ); - v5 = vec_splat( vecMax, 2 ); + v5 = vec_splat( vecMax, 2 ); vec_ste( v0, 0, &min[0] ); vec_ste( v1, 0, &min[1] ); vec_ste( v2, 0, &min[2] ); vec_ste( v3, 0, &max[0] ); vec_ste( v4, 0, &max[1] ); - vec_ste( v5, 0, &max[2] ); - } - + vec_ste( v5, 0, &max[2] ); + } + // cleanup for ( ; i < count; i++ ) { v = src[i].xyz; - + if ( v[0] < min[0] ) { min[0] = v[0]; } if ( v[0] > max[0] ) { max[0] = v[0]; } - + if ( v[1] < min[1] ) { min[1] = v[1]; } if ( v[1] > max[1] ) { max[1] = v[1]; } - + if ( v[2] > max[2] ) { max[2] = v[2]; } - + if ( v[2] < min[2] ) { min[2] = v[2]; } @@ -3494,24 +3494,24 @@ idSIMD_AltiVec::MinMax */ void VPCALL idSIMD_AltiVec::MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, const int *indexes, const int count ) { min[0] = min[1] = min[2] = idMath::INFINITY; max[0] = max[1] = max[2] = -idMath::INFINITY; - + idVec3 v; int i = 0; - + register vector float vecMin, vecMax; - + register vector float v0, v1, v2, v3, v4, v5, v6, v7; register vector float vecMin1, vecMin2, vecMax1, vecMax2; - + if ( count >= 4 ) { - + vecMin = (vector float)(FLT_MAX); vecMax = (vector float)(FLT_MIN); - + vector unsigned char vertPerm1; vector unsigned char vertPerm2; vector unsigned char vertPerm3; - vector unsigned char vertPerm4; + vector unsigned char vertPerm4; for ( ; i+3 < count; i += 4) { const float *vertPtr = src[indexes[i]].xyz.ToFloatPtr(); @@ -3523,7 +3523,7 @@ void VPCALL idSIMD_AltiVec::MinMax( idVec3 &min, idVec3 &max, const idDrawVert * vertPerm2 = vec_add( vec_lvsl( -1, vertPtr2 ), (vector unsigned char)(1) ); vertPerm3 = vec_add( vec_lvsl( -1, vertPtr3 ), (vector unsigned char)(1) ); vertPerm4 = vec_add( vec_lvsl( -1, vertPtr4 ), (vector unsigned char)(1) ); - + v0 = vec_ld( 0, vertPtr ); v1 = vec_ld( 15, vertPtr ); v2 = vec_ld( 0, vertPtr2 ); @@ -3532,30 +3532,30 @@ void VPCALL idSIMD_AltiVec::MinMax( idVec3 &min, idVec3 &max, const idDrawVert * v5 = vec_ld( 15, vertPtr3 ); v6 = vec_ld( 0, vertPtr4 ); v7 = vec_ld( 15, vertPtr4 ); - + v0 = vec_perm( v0, v1, vertPerm1 ); v2 = vec_perm( v2, v3, vertPerm2 ); v4 = vec_perm( v4, v5, vertPerm3 ); v6 = vec_perm( v6, v7, vertPerm4 ); - + vecMin1 = vec_min( v0, v2 ); vecMin2 = vec_min( v4, v6 ); vecMin1 = vec_min( vecMin1, vecMin2 ); vecMin = vec_min( vecMin, vecMin1 ); - + vecMax1 = vec_max( v0, v2 ); vecMax2 = vec_max( v4, v6 ); vecMax1 = vec_max( vecMax1, vecMax2 ); - vecMax = vec_max( vecMax, vecMax1 ); + vecMax = vec_max( vecMax, vecMax1 ); } - + // now we have min/max vectors in X Y Z form, store out v0 = vec_splat( vecMin, 0 ); v1 = vec_splat( vecMin, 1 ); v2 = vec_splat( vecMin, 2 ); v3 = vec_splat( vecMax, 0 ); v4 = vec_splat( vecMax, 1 ); - v5 = vec_splat( vecMax, 2 ); + v5 = vec_splat( vecMax, 2 ); vec_ste( v0, 0, &min[0] ); vec_ste( v1, 0, &min[1] ); @@ -3563,30 +3563,30 @@ void VPCALL idSIMD_AltiVec::MinMax( idVec3 &min, idVec3 &max, const idDrawVert * vec_ste( v3, 0, &max[0] ); vec_ste( v4, 0, &max[1] ); vec_ste( v5, 0, &max[2] ); - } - + } + // cleanup for ( ; i < count; i++ ) { v = src[indexes[i]].xyz; - + if ( v[0] < min[0] ) { min[0] = v[0]; } if ( v[0] > max[0] ) { max[0] = v[0]; } - + if ( v[1] < min[1] ) { min[1] = v[1]; } if ( v[1] > max[1] ) { max[1] = v[1]; } - + if ( v[2] > max[2] ) { max[2] = v[2]; } - + if ( v[2] < min[2] ) { min[2] = v[2]; } @@ -3600,54 +3600,54 @@ idSIMD_AltiVec::MinMax */ void VPCALL idSIMD_AltiVec::MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, const int *indexes, const int count ) { min[0] = min[1] = min[2] = idMath::INFINITY; max[0] = max[1] = max[2] = -idMath::INFINITY; - + idVec3 v; int i = 0; - + register vector float vecMin, vecMax; - + register vector float v0, v1, v2, v3, v4, v5, v6, v7; register vector float vecMin1, vecMin2, vecMax1, vecMax2; - + if ( count >= 4 ) { - + vecMin = (vector float)(FLT_MAX); vecMax = (vector float)(FLT_MIN); - + vector unsigned char vertPerm1; vector unsigned char vertPerm2; vector unsigned char vertPerm3; - vector unsigned char vertPerm4; + vector unsigned char vertPerm4; for ( ; i+3 < count; i += 4) { const float *vertPtr = src[indexes[i]].xyz.ToFloatPtr(); const float *vertPtr2 = src[indexes[i+1]].xyz.ToFloatPtr(); const float *vertPtr3 = src[indexes[i+2]].xyz.ToFloatPtr(); const float *vertPtr4 = src[indexes[i+3]].xyz.ToFloatPtr(); - + v0 = vec_ld( 0, vertPtr ); v2 = vec_ld( 0, vertPtr2 ); v4 = vec_ld( 0, vertPtr3 ); v6 = vec_ld( 0, vertPtr4 ); - + vecMin1 = vec_min( v0, v2 ); vecMin2 = vec_min( v4, v6 ); vecMin1 = vec_min( vecMin1, vecMin2 ); vecMin = vec_min( vecMin, vecMin1 ); - + vecMax1 = vec_max( v0, v2 ); vecMax2 = vec_max( v4, v6 ); vecMax1 = vec_max( vecMax1, vecMax2 ); - vecMax = vec_max( vecMax, vecMax1 ); + vecMax = vec_max( vecMax, vecMax1 ); } - + // now we have min/max vectors in X Y Z form, store out v0 = vec_splat( vecMin, 0 ); v1 = vec_splat( vecMin, 1 ); v2 = vec_splat( vecMin, 2 ); v3 = vec_splat( vecMax, 0 ); v4 = vec_splat( vecMax, 1 ); - v5 = vec_splat( vecMax, 2 ); + v5 = vec_splat( vecMax, 2 ); vec_ste( v0, 0, &min[0] ); vec_ste( v1, 0, &min[1] ); @@ -3655,30 +3655,30 @@ void VPCALL idSIMD_AltiVec::MinMax( idVec3 &min, idVec3 &max, const idDrawVert * vec_ste( v3, 0, &max[0] ); vec_ste( v4, 0, &max[1] ); vec_ste( v5, 0, &max[2] ); - } - + } + // cleanup for ( ; i < count; i++ ) { v = src[indexes[i]].xyz; - + if ( v[0] < min[0] ) { min[0] = v[0]; } if ( v[0] > max[0] ) { max[0] = v[0]; } - + if ( v[1] < min[1] ) { min[1] = v[1]; } if ( v[1] > max[1] ) { max[1] = v[1]; } - + if ( v[2] > max[2] ) { max[2] = v[2]; } - + if ( v[2] < min[2] ) { min[2] = v[2]; } @@ -3699,29 +3699,29 @@ idSIMD_AltiVec::Clamp */ void VPCALL idSIMD_AltiVec::Clamp( float *dst, const float *src, const float min, const float max, const int count ) { //#define OPER(X) dst[(X)] = src[(X)] < min ? min : src[(X)] > max ? max : src[(X)]; - register vector float v0, v1, v2, v3, v4, v5; - register vector unsigned char permVec; + register vector float v0, v1, v2, v3, v4, v5; + register vector unsigned char permVec; register vector float v0_low, v0_hi, v1_low, v1_hi; vector unsigned char oneVector = (vector unsigned char)(1); - register vector float minVec, maxVec; - int i = 0; - - //handle unaligned at start - for ( ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { + register vector float minVec, maxVec; + int i = 0; + + //handle unaligned at start + for ( ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { dst[i] = src[i] < min ? min : src[i] > max ? max : src[i]; - } - - //splat min/max into a vector - minVec = loadSplatUnalignedScalar( &min ); + } + + //splat min/max into a vector + minVec = loadSplatUnalignedScalar( &min ); maxVec = loadSplatUnalignedScalar( &max ); - + //calculate permute and do first load permVec = vec_add( vec_lvsl( -1, (int*) &src[i] ), oneVector ); - v1_hi = vec_ld( 0, &src[i] ); + v1_hi = vec_ld( 0, &src[i] ); - - //vectorize! - for ( ; i+7 < count; i += 8 ) { + + //vectorize! + for ( ; i+7 < count; i += 8 ) { //load source v0_low = v1_hi; v0_hi = vec_ld( 15, &src[i] ); @@ -3730,22 +3730,22 @@ void VPCALL idSIMD_AltiVec::Clamp( float *dst, const float *src, const float min v0 = vec_perm( v0_low, v0_hi, permVec ); v1 = vec_perm( v1_low, v1_hi, permVec ); - + //apply minimum v2 = vec_max( v0, minVec ); v3 = vec_max( v1, minVec ); - + //apply maximum v4 = vec_min( v2, maxVec ); v5 = vec_min( v3, maxVec ); - + ALIGNED_STORE2( &dst[i], v4, v5 ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { + } + + //handle cleanup + for ( ; i < count ; i++ ) { dst[i] = src[i] < min ? min : src[i] > max ? max : src[i]; - } + } } /* @@ -3755,46 +3755,46 @@ idSIMD_AltiVec::ClampMin */ void VPCALL idSIMD_AltiVec::ClampMin( float *dst, const float *src, const float min, const int count ) { //#define OPER(X) dst[(X)] = src[(X)] < min ? min : src[(X)]; - register vector float v0, v1, v2, v3; - register vector unsigned char permVec; + register vector float v0, v1, v2, v3; + register vector unsigned char permVec; register vector float v0_low, v0_hi, v1_low, v1_hi; - register vector float constVec; + register vector float constVec; vector unsigned char oneVector = (vector unsigned char)(1); - int i = 0; + int i = 0; - //handle unaligned at start + //handle unaligned at start for ( ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { dst[i] = src[i] < min ? min : src[i]; - } - - //splat constant into a vector - constVec = loadSplatUnalignedScalar( &min ); - + } + + //splat constant into a vector + constVec = loadSplatUnalignedScalar( &min ); + //calculate permute and do first load permVec = vec_add( vec_lvsl( -1, (int*) &src[i] ), oneVector ); - v1_hi = vec_ld( 0, &src[i] ); - - //vectorize! - for ( ; i+7 < count; i += 8 ) { + v1_hi = vec_ld( 0, &src[i] ); + + //vectorize! + for ( ; i+7 < count; i += 8 ) { //load source v0_low = v1_hi; v0_hi = vec_ld( 15, &src[i] ); v1_low = v0_hi; v1_hi = vec_ld( 31, &src[i] ); - + v0 = vec_perm( v0_low, v0_hi, permVec ); v1 = vec_perm( v1_low, v1_hi, permVec ); v2 = vec_max( v0, constVec ); v3 = vec_max( v1, constVec ); - + ALIGNED_STORE2( &dst[i], v2, v3 ); - } - - //handle cleanup - for ( ; i < count ; i++ ) { + } + + //handle cleanup + for ( ; i < count ; i++ ) { dst[i] = src[i] < min ? min : src[i]; - } + } } /* @@ -3804,50 +3804,50 @@ idSIMD_AltiVec::ClampMax */ void VPCALL idSIMD_AltiVec::ClampMax( float *dst, const float *src, const float max, const int count ) { //#define OPER(X) dst[(X)] = src[(X)] > max ? max : src[(X)]; - register vector float v0, v1, v2, v3; - register vector unsigned char permVec; - register vector float constVec; + register vector float v0, v1, v2, v3; + register vector unsigned char permVec; + register vector float constVec; register vector float v0_low, v0_hi, v1_low, v1_hi; vector unsigned char oneVector = (vector unsigned char)(1); - int i = 0; - + int i = 0; + //handle unaligned at start - for ( ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { + for ( ; NOT_16BYTE_ALIGNED( dst[i] ) && ( i < count ); i++ ) { dst[i] = src[i] < max ? max : src[i]; - } - - //splat constant into a vector - constVec = loadSplatUnalignedScalar( &max ); - + } + + //splat constant into a vector + constVec = loadSplatUnalignedScalar( &max ); + //calculate permute and do first load permVec = vec_add( vec_lvsl( -1, (int*) &src[i] ), oneVector ); - v1_hi = vec_ld( 0, &src[i] ); - - //vectorize! - for ( ; i+7 < count; i += 8 ) { + v1_hi = vec_ld( 0, &src[i] ); + + //vectorize! + for ( ; i+7 < count; i += 8 ) { //load source v0_low = v1_hi; v0_hi = vec_ld( 15, &src[i] ); v1_low = v0_hi; v1_hi = vec_ld( 31, &src[i] ); - + v0 = vec_perm( v0_low, v0_hi, permVec ); - v1 = vec_perm( v1_low, v1_hi, permVec ); + v1 = vec_perm( v1_low, v1_hi, permVec ); v2 = vec_min( v0, constVec ); v3 = vec_min( v1, constVec ); - + ALIGNED_STORE2( &dst[i], v2, v3 ); } - - //handle cleanup - for ( ; i < count ; i++ ) { + + //handle cleanup + for ( ; i < count ; i++ ) { dst[i] = src[i] < max ? max : src[i]; - } + } } #endif /* ENABLE_CLAMP */ -#ifdef ENABLE_16ROUTINES +#ifdef ENABLE_16ROUTINES /* ============ @@ -3867,28 +3867,28 @@ idSIMD_AltiVec::Negate16 ============ */ void VPCALL idSIMD_AltiVec::Negate16( float *dst, const int count ) { -//#define OPER(X) ptr[(X)] ^= ( 1 << 31 ) // IEEE 32 bits float sign bit - +//#define OPER(X) ptr[(X)] ^= ( 1 << 31 ) // IEEE 32 bits float sign bit + // dst is aligned assert( IS_16BYTE_ALIGNED( dst[0] ) ); // round count up to next 4 if needbe int count2 = ( count + 3 ) & ~3; - - int i = 0; + + int i = 0; vector float v0, v1, v2, v3; - - //know its 16-byte aligned + + //know its 16-byte aligned for ( ; i + 7 < count2; i += 8 ) { v0 = vec_ld( 0, &dst[i] ); v1 = vec_ld( 16, &dst[i] ); - + v2 = vec_sub( (vector float)(0), v0 ); v3 = vec_sub( (vector float)(0), v1 ); - + ALIGNED_STORE2( &dst[i], v2, v3 ); } - + for ( ; i < count2; i += 4 ) { v0 = vec_ld( 0, &dst[i] ); v1 = vec_sub( (vector float)(0), v0 ); @@ -3909,7 +3909,7 @@ void VPCALL idSIMD_AltiVec::Copy16( float *dst, const float *src, const int coun /* ============ idSIMD_AltiVec::Add16 - + Assumptions: Assumes dst, src1, src2 all start at aligned address ============ @@ -3922,16 +3922,16 @@ void VPCALL idSIMD_AltiVec::Add16( float *dst, const float *src1, const float *s // src1 is aligned assert( IS_16BYTE_ALIGNED( src1[0] ) ); // src2 is aligned - assert( IS_16BYTE_ALIGNED( src2[0] ) ); - + assert( IS_16BYTE_ALIGNED( src2[0] ) ); + // round count up to next 4 if needbe int count2 = ( count + 3 ) & ~3; - - register vector float v0, v1, v2, v3, v4, v5; - int i = 0; - - //know all data is 16-byte aligned, so vectorize! - for ( ; i+7 < count2; i += 8 ) { + + register vector float v0, v1, v2, v3, v4, v5; + int i = 0; + + //know all data is 16-byte aligned, so vectorize! + for ( ; i+7 < count2; i += 8 ) { //load sources v0 = vec_ld( 0, &src1[i] ); v1 = vec_ld( 16, &src1[i] ); @@ -3939,10 +3939,10 @@ void VPCALL idSIMD_AltiVec::Add16( float *dst, const float *src1, const float *s v3 = vec_ld( 16, &src2[i] ); v4 = vec_add( v0, v2 ); v5 = vec_add( v1, v3 ); - + ALIGNED_STORE2( &dst[i], v4, v5 ); - } - + } + for ( ; i < count2; i += 4 ) { v0 = vec_ld( 0, &src1[i] ); v1 = vec_ld( 0, &src2[i] ); @@ -3956,7 +3956,7 @@ void VPCALL idSIMD_AltiVec::Add16( float *dst, const float *src1, const float *s idSIMD_AltiVec::Sub16 Assumptions: - Assumes that dst, src1, and src2 all start at aligned address + Assumes that dst, src1, and src2 all start at aligned address ============ */ void VPCALL idSIMD_AltiVec::Sub16( float *dst, const float *src1, const float *src2, const int count ) { @@ -3966,16 +3966,16 @@ void VPCALL idSIMD_AltiVec::Sub16( float *dst, const float *src1, const float *s // src1 is aligned assert( IS_16BYTE_ALIGNED( src1[0] ) ); // src2 is aligned - assert( IS_16BYTE_ALIGNED( src2[0] ) ); - + assert( IS_16BYTE_ALIGNED( src2[0] ) ); + // round count up to next 4 if needbe int count2 = ( count + 3 ) & ~3; - register vector float v0, v1, v2, v3, v4, v5; - int i = 0; - - //know data is aligned, so vectorize! - for ( ; i+7 < count2; i += 8 ) { + register vector float v0, v1, v2, v3, v4, v5; + int i = 0; + + //know data is aligned, so vectorize! + for ( ; i+7 < count2; i += 8 ) { //load sources v0 = vec_ld( 0, &src1[i] ); v1 = vec_ld( 16, &src1[i] ); @@ -3983,10 +3983,10 @@ void VPCALL idSIMD_AltiVec::Sub16( float *dst, const float *src1, const float *s v3 = vec_ld( 16, &src2[i] ); v4 = vec_sub( v0, v2 ); v5 = vec_sub( v1, v3 ); - + ALIGNED_STORE2( &dst[i], v4, v5 ); - } - + } + for ( ; i < count2; i += 4 ) { v0 = vec_ld( 0, &src1[i] ); v1 = vec_ld( 0, &src2[i] ); @@ -4005,33 +4005,33 @@ idSIMD_AltiVec::Mul16 */ void VPCALL idSIMD_AltiVec::Mul16( float *dst, const float *src1, const float constant, const int count ) { //#define OPER(X) dst[(X)] = src1[(X)] * constant - - // dst is aligned + + // dst is aligned assert( IS_16BYTE_ALIGNED( dst[0] ) ); // src1 is aligned assert( IS_16BYTE_ALIGNED( src1[0] ) ); - + // round count up to next 4 if needbe int count2 = ( count + 3 ) & ~3; - - register vector float v0, v1, v2, v3; - register vector float constVec; - register vector float zeroVector = (vector float)(0.0); - int i = 0; - - //splat constant into a vector + + register vector float v0, v1, v2, v3; + register vector float constVec; + register vector float zeroVector = (vector float)(0.0); + int i = 0; + + //splat constant into a vector constVec = loadSplatUnalignedScalar( &constant ); - - //know data is aligned, so vectorize! - for ( ; i+7 < count2; i += 8 ) { + + //know data is aligned, so vectorize! + for ( ; i+7 < count2; i += 8 ) { //load source v0 = vec_ld( 0, &src1[i] ); v1 = vec_ld( 16, &src1[i] ); v2 = vec_madd( constVec, v0, zeroVector ); v3 = vec_madd( constVec, v1, zeroVector ); ALIGNED_STORE2( &dst[i], v2, v3 ); - } - + } + for ( ; i < count2; i += 4 ) { v0 = vec_ld( 0, &src1[i] ); v1 = vec_madd( constVec, v0, zeroVector ); @@ -4049,20 +4049,20 @@ idSIMD_AltiVec::AddAssign16 */ void VPCALL idSIMD_AltiVec::AddAssign16( float *dst, const float *src, const int count ) { //#define OPER(X) dst[(X)] += src[(X)] - + // dst is aligned assert( IS_16BYTE_ALIGNED( dst[0] ) ); // src is aligned - assert( IS_16BYTE_ALIGNED( src[0] ) ); - + assert( IS_16BYTE_ALIGNED( src[0] ) ); + // round count up to next 4 if needbe int count2 = ( count + 3 ) & ~3; - + register vector float v0, v1, v2, v3, v4, v5; - int i = 0; - - //vectorize! - for ( ; i+7 < count2; i += 8 ) { + int i = 0; + + //vectorize! + for ( ; i+7 < count2; i += 8 ) { v0 = vec_ld( 0, &src[i] ); v1 = vec_ld( 16, &src[i] ); v2 = vec_ld( 0, &dst[i] ); @@ -4070,8 +4070,8 @@ void VPCALL idSIMD_AltiVec::AddAssign16( float *dst, const float *src, const int v4 = vec_add( v0, v2 ); v5 = vec_add( v1, v3 ); ALIGNED_STORE2( &dst[i], v4, v5 ); - } - + } + for ( ; i < count2; i += 4 ) { v0 = vec_ld( 0, &src[i] ); v1 = vec_ld( 0, &dst[i] ); @@ -4090,18 +4090,18 @@ idSIMD_AltiVec::SubAssign16 */ void VPCALL idSIMD_AltiVec::SubAssign16( float *dst, const float *src, const int count ) { //#define OPER(X) dst[(X)] -= src[(X)] - register vector float v0, v1, v2, v3, v4, v5; - int i=0; - + register vector float v0, v1, v2, v3, v4, v5; + int i=0; + // dst is aligned assert( IS_16BYTE_ALIGNED( dst[0] ) ); // src is aligned - assert( IS_16BYTE_ALIGNED( src[0] ) ); + assert( IS_16BYTE_ALIGNED( src[0] ) ); // round count up to next 4 if needbe int count2 = ( count + 3 ) & ~3; - - //vectorize! - for ( ; i+7 < count2; i += 8 ) { + + //vectorize! + for ( ; i+7 < count2; i += 8 ) { v0 = vec_ld( 0, &src[i] ); v1 = vec_ld( 16, &src[i] ); v2 = vec_ld( 0, &dst[i] ); @@ -4109,8 +4109,8 @@ void VPCALL idSIMD_AltiVec::SubAssign16( float *dst, const float *src, const int v4 = vec_sub( v2, v0 ); v5 = vec_sub( v3, v1 ); ALIGNED_STORE2( &dst[i], v4, v5 ); - } - + } + for ( ; i < count2; i += 4 ) { v0 = vec_ld( 0, &src[i] ); v1 = vec_ld( 0, &dst[i] ); @@ -4134,24 +4134,24 @@ void VPCALL idSIMD_AltiVec::MulAssign16( float *dst, const float constant, const assert( IS_16BYTE_ALIGNED( dst[0] ) ); // round count up to next 4 if needbe int count2 = ( count + 3 ) & ~3; - - register vector float v0, v1, v2, v3; - register vector float constVec; - int i = 0; - register vector float zeroVector = (vector float)(0.0); - - //splat constant into a vector + + register vector float v0, v1, v2, v3; + register vector float constVec; + int i = 0; + register vector float zeroVector = (vector float)(0.0); + + //splat constant into a vector constVec = loadSplatUnalignedScalar( &constant ); - - //vectorize! - for ( ; i+7 < count2; i += 8 ) { + + //vectorize! + for ( ; i+7 < count2; i += 8 ) { v0 = vec_ld( 0, &dst[i] ); v1 = vec_ld( 16, &dst[i] ); v2 = vec_madd( v0, constVec, zeroVector ); v3 = vec_madd( v1, constVec, zeroVector ); ALIGNED_STORE2( &dst[i], v2, v3 ); - } - + } + for ( ; i < count2; i += 4 ) { v0 = vec_ld( 0, &dst[i] ); v1 = vec_madd( v0, constVec, zeroVector ); @@ -4175,7 +4175,7 @@ idSIMD_AltiVec::MatX_LowerTriangularSolve */ void VPCALL idSIMD_AltiVec::MatX_LowerTriangularSolve( const idMatX &L, float *x, const float *b, const int n, int skip ) { - + int i, j; const float *lptr; const float *lptr2; @@ -4194,16 +4194,16 @@ void VPCALL idSIMD_AltiVec::MatX_LowerTriangularSolve( const idMatX &L, float *x vector float v0, v1, v2, v3, v4, v5, v6, v7, v8, v9; vector float zeroVector = (vector float)(0.0); vector float vecSum3, vecSum4, vecSum5, vecSum6, vecSum7, vecSum8; - + vector unsigned char vecPermX = vec_add( vec_lvsl( -1, &x[0] ), (vector unsigned char)(1) ); - + // unrolled this loop a bit - for ( i = skip; i+3 < n; i+=4 ) { + for ( i = skip; i+3 < n; i+=4 ) { sum = b[i]; sum2 = b[i+1]; sum3 = b[i+2]; sum4 = b[i+3]; - + vecSum1 = zeroVector; vecSum2 = zeroVector; vecSum3 = vecSum4 = vecSum5 = vecSum6 = vecSum7 = vecSum8 = zeroVector; @@ -4211,74 +4211,74 @@ void VPCALL idSIMD_AltiVec::MatX_LowerTriangularSolve( const idMatX &L, float *x lptr2 = L[i+1]; lptr3 = L[i+2]; lptr4 = L[i+3]; - + vector unsigned char vecPermLptr1 = vec_add( vec_lvsl( -1, lptr ), (vector unsigned char)(1) ); vector unsigned char vecPermLptr2 = vec_add( vec_lvsl( -1, lptr2 ), (vector unsigned char)(1) ); vector unsigned char vecPermLptr3 = vec_add( vec_lvsl( -1, lptr3 ), (vector unsigned char)(1) ); vector unsigned char vecPermLptr4 = vec_add( vec_lvsl( -1, lptr4 ), (vector unsigned char)(1) ); - + for ( j = 0 ; j+7 < i; j+=8 ) { - + v0 = vec_ld( 0, &x[j] ); v1 = vec_ld( 15, &x[j] ); vector float vecExtraX = vec_ld( 31, &x[j] ); v0 = vec_perm( v0, v1, vecPermX ); v1 = vec_perm( v1, vecExtraX, vecPermX ); - + v2 = vec_ld( 0, lptr + j ); v3 = vec_ld( 15, lptr + j ); vector float vecExtra1 = vec_ld( 31, lptr + j ); v2 = vec_perm( v2, v3, vecPermLptr1 ); v3 = vec_perm( v3, vecExtra1, vecPermLptr1 ); - + v4 = vec_ld( 0, lptr2 + j ); v5 = vec_ld( 15, lptr2 + j ); vector float vecExtra2 = vec_ld( 31, lptr2 + j ); v4 = vec_perm( v4, v5, vecPermLptr2 ); v5 = vec_perm( v5, vecExtra2, vecPermLptr2 ); - + v6 = vec_ld( 0, lptr3 + j ); v7 = vec_ld( 15, lptr3 + j ); vector float vecExtra3 = vec_ld( 31, lptr3 + j ); v6 = vec_perm( v6, v7, vecPermLptr3 ); v7 = vec_perm( v7, vecExtra3, vecPermLptr3 ); - + v8 = vec_ld( 0, lptr4 + j ); v9 = vec_ld( 15, lptr4 + j ); vector float vecExtra4 = vec_ld( 31, lptr4 + j ); v8 = vec_perm( v8, v9, vecPermLptr4 ); v9 = vec_perm( v9, vecExtra4, vecPermLptr4 ); - + vecSum1 = vec_madd( v2, v0, vecSum1 ); vecSum2 = vec_madd( v3, v1, vecSum2 ); - + vecSum3 = vec_madd( v4, v0, vecSum3 ); vecSum4 = vec_madd( v5, v1, vecSum4 ); - + vecSum5 = vec_madd( v6, v0, vecSum5 ); vecSum6 = vec_madd( v7, v1, vecSum6 ); - + vecSum7 = vec_madd( v8, v0, vecSum7 ); vecSum8 = vec_madd( v9, v1, vecSum8 ); } - + // if we ran the unrolled code, we need to sum accross the vectors // to find out how much to subtract from sum if ( j > 0 ) { - vecSum1 = vec_add( vecSum1, vecSum2 ); + vecSum1 = vec_add( vecSum1, vecSum2 ); vecSum3 = vec_add( vecSum3, vecSum4 ); vecSum5 = vec_add( vecSum5, vecSum6 ); vecSum7 = vec_add( vecSum7, vecSum8 ); - //sum accross the vectors + //sum accross the vectors vecSum1 = vec_add( vecSum1, vec_sld( vecSum1, vecSum1, 8 ) ); vecSum1 = vec_add( vecSum1, vec_sld( vecSum1, vecSum1, 4 ) ); - + vecSum3 = vec_add( vecSum3, vec_sld( vecSum3, vecSum3, 8 ) ); vecSum3 = vec_add( vecSum3, vec_sld( vecSum3, vecSum3, 4 ) ); - + vecSum5 = vec_add( vecSum5, vec_sld( vecSum5, vecSum5, 8 ) ); vecSum5 = vec_add( vecSum5, vec_sld( vecSum5, vecSum5, 4 ) ); - + vecSum7 = vec_add( vecSum7, vec_sld( vecSum7, vecSum7, 8 ) ); vecSum7 = vec_add( vecSum7, vec_sld( vecSum7, vecSum7, 4 ) ); @@ -4287,13 +4287,13 @@ void VPCALL idSIMD_AltiVec::MatX_LowerTriangularSolve( const idMatX &L, float *x vec_ste( vec_splat( vecSum3, 0 ), 0, &tempSum2 ); vec_ste( vec_splat( vecSum5, 0 ), 0, &tempSum3 ); vec_ste( vec_splat( vecSum7, 0 ), 0, &tempSum4 ); - + sum -= tempSum; sum2 -= tempSum2; sum3 -= tempSum3; - sum4 -= tempSum4; + sum4 -= tempSum4; } - + //cleanup for ( ; j < i; j++ ) { sum -= lptr[j] * x[j]; @@ -4303,47 +4303,47 @@ void VPCALL idSIMD_AltiVec::MatX_LowerTriangularSolve( const idMatX &L, float *x } // store the 4 results at a time - sum2 -= ( lptr2[i] * sum ); + sum2 -= ( lptr2[i] * sum ); sum3 = sum3 - ( lptr3[i+1] * sum2 ) - ( lptr3[i] * sum ); sum4 = sum4 - ( lptr4[i+2] * sum3 ) - ( lptr4[i+1] * sum2 ) - ( lptr4[i] * sum ); - + x[i] = sum; x[i+1] = sum2; - x[i+2] = sum3; + x[i+2] = sum3; x[i+3] = sum4; } - + // cleanup - for ( ; i < n; i++ ) { + for ( ; i < n; i++ ) { sum = b[i]; vecSum1 = zeroVector; vecSum2 = zeroVector; lptr = L[i]; vector unsigned char vecPermLptr = vec_add( vec_lvsl( -1, lptr ), (vector unsigned char)(1) ); - + for ( j = 0 ; j+7 < i; j+=8 ) { - + v0 = vec_ld( 0, &x[j] ); v2 = vec_ld( 15, &x[j] ); vector float vecExtraX = vec_ld( 31, &x[j] ); v0 = vec_perm( v0, v2, vecPermX ); v2 = vec_perm( v2, vecExtraX, vecPermX ); - + v1 = vec_ld( 0, lptr + j ); v3 = vec_ld( 15, lptr + j ); vector float vecExtra = vec_ld( 31, lptr + j ); v1 = vec_perm( v1, v3, vecPermLptr ); v3 = vec_perm( v3, vecExtra, vecPermLptr ); - + vecSum1 = vec_madd( v1, v0, vecSum1 ); vecSum2 = vec_madd( v3, v2, vecSum2 ); } - + // if we ran the unrolled code, we need to sum accross the vectors // to find out how much to subtract from sum if ( j > 0 ) { //sum accross the vectors - vecSum1 = vec_add( vecSum1, vecSum2 ); + vecSum1 = vec_add( vecSum1, vecSum2 ); vecSum1 = vec_add( vecSum1, vec_sld( vecSum1, vecSum1, 8 ) ); vecSum1 = vec_add( vecSum1, vec_sld( vecSum1, vecSum1, 4 ) ); @@ -4351,7 +4351,7 @@ void VPCALL idSIMD_AltiVec::MatX_LowerTriangularSolve( const idMatX &L, float *x vec_ste( vec_splat( vecSum1, 0 ), 0, &tempSum ); sum -= tempSum; } - + //cleanup for ( ; j < i; j++ ) { sum -= lptr[j] * x[j]; @@ -4390,7 +4390,7 @@ void VPCALL idSIMD_AltiVec::MatX_LowerTriangularSolveTranspose( const idMatX &L, case 2: x1 = b[1]; x0 = b[0] - lptr[1*nc+0] * x1; - + x[1] = x1; x[0] = x0; return; @@ -4398,7 +4398,7 @@ void VPCALL idSIMD_AltiVec::MatX_LowerTriangularSolveTranspose( const idMatX &L, x2 = b[2]; x1 = b[1] - lptr[2*nc+1] * x2; x0 = b[0] - lptr[2*nc+0] * x2 - lptr[1*nc+0] * x1; - + x[2] = x2; x[1] = x1; x[0] = x0; @@ -4408,20 +4408,20 @@ void VPCALL idSIMD_AltiVec::MatX_LowerTriangularSolveTranspose( const idMatX &L, x2 = b[2] - lptr[3*nc+2] * x3; x1 = b[1] - lptr[3*nc+1] * x3 - lptr[2*nc+1] * x2; x0 = b[0] - lptr[3*nc+0] * x3 - lptr[2*nc+0] * x2 - lptr[1*nc+0] * x1; - + x[3] = x3; x[2] = x2; x[1] = x1; x[0] = x0; - + return; case 5: x4 = b[4]; x3 = b[3] - lptr[4*nc+3] * x4; x2 = b[2] - lptr[4*nc+2] * x4 - lptr[3*nc+2] * x3; x1 = b[1] - lptr[4*nc+1] * x4 - lptr[3*nc+1] * x3 - lptr[2*nc+1] * x2; - x0 = b[0] - lptr[4*nc+0] * x4 - lptr[3*nc+0] * x3 - lptr[2*nc+0] * x2 - lptr[1*nc+0] * x1; - + x0 = b[0] - lptr[4*nc+0] * x4 - lptr[3*nc+0] * x3 - lptr[2*nc+0] * x2 - lptr[1*nc+0] * x1; + x[4] = x4; x[3] = x3; x[2] = x2; @@ -4435,14 +4435,14 @@ void VPCALL idSIMD_AltiVec::MatX_LowerTriangularSolveTranspose( const idMatX &L, x2 = b[2] - lptr[5*nc+2] * x5 - lptr[4*nc+2] * x4 - lptr[3*nc+2] * x3; x1 = b[1] - lptr[5*nc+1] * x5 - lptr[4*nc+1] * x4 - lptr[3*nc+1] * x3 - lptr[2*nc+1] * x2; x0 = b[0] - lptr[5*nc+0] * x5 - lptr[4*nc+0] * x4 - lptr[3*nc+0] * x3 - lptr[2*nc+0] * x2 - lptr[1*nc+0] * x1; - + x[5] = x5; x[4] = x4; x[3] = x3; x[2] = x2; x[1] = x1; x[0] = x0; - + return; case 7: x6 = b[6]; @@ -4452,7 +4452,7 @@ void VPCALL idSIMD_AltiVec::MatX_LowerTriangularSolveTranspose( const idMatX &L, x2 = b[2] - lptr[6*nc+2] * x6 - lptr[5*nc+2] * x5 - lptr[4*nc+2] * x4 - lptr[3*nc+2] * x3; x1 = b[1] - lptr[6*nc+1] * x6 - lptr[5*nc+1] * x5 - lptr[4*nc+1] * x4 - lptr[3*nc+1] * x3 - lptr[2*nc+1] * x2; x0 = b[0] - lptr[6*nc+0] * x6 - lptr[5*nc+0] * x5 - lptr[4*nc+0] * x4 - lptr[3*nc+0] * x3 - lptr[2*nc+0] * x2 - lptr[1*nc+0] * x1; - + x[6] = x6; x[5] = x5; x[4] = x4; @@ -4521,7 +4521,7 @@ void VPCALL idSIMD_AltiVec::MatX_LowerTriangularSolveTranspose( const idMatX &L, s0 -= lptr[j*nc] * x[j]; } x[i] = s0; - } + } } /* @@ -4674,18 +4674,18 @@ bool VPCALL idSIMD_AltiVec::MatX_LDLTFactor( idMatX &mat, idVecX &invDiag, const // unrolling madness! mptr = mat[i+1]; mptr2 = mat[i+1] + nc; - + for ( j = i+1; j+1 < n; j+=2 ) { s0 = mptr[0] * v[0]; s1 = mptr[1] * v[1]; s2 = mptr[2] * v[2]; s3 = mptr[3] * v[3]; - + s0_2 = mptr2[0] * v[0]; s1_2 = mptr2[1] * v[1]; s2_2 = mptr2[2] * v[2]; - s3_2 = mptr2[3] * v[3]; - + s3_2 = mptr2[3] * v[3]; + for ( k = 4; k < i-7; k += 8 ) { s0 += mptr[k+0] * v[k+0]; s1 += mptr[k+1] * v[k+1]; @@ -4695,7 +4695,7 @@ bool VPCALL idSIMD_AltiVec::MatX_LDLTFactor( idMatX &mat, idVecX &invDiag, const s1 += mptr[k+5] * v[k+5]; s2 += mptr[k+6] * v[k+6]; s3 += mptr[k+7] * v[k+7]; - + s0_2 += mptr2[k+0] * v[k+0]; s1_2 += mptr2[k+1] * v[k+1]; s2_2 += mptr2[k+2] * v[k+2]; @@ -4703,9 +4703,9 @@ bool VPCALL idSIMD_AltiVec::MatX_LDLTFactor( idMatX &mat, idVecX &invDiag, const s0_2 += mptr2[k+4] * v[k+4]; s1_2 += mptr2[k+5] * v[k+5]; s2_2 += mptr2[k+6] * v[k+6]; - s3_2 += mptr2[k+7] * v[k+7]; + s3_2 += mptr2[k+7] * v[k+7]; } - + switch( i - k ) { case 7: s0 += mptr[k+6] * v[k+6]; s0_2 += mptr2[k+6] * v[k+6]; case 6: s1 += mptr[k+5] * v[k+5]; s1_2 += mptr2[k+5] * v[k+5]; @@ -4719,14 +4719,14 @@ bool VPCALL idSIMD_AltiVec::MatX_LDLTFactor( idMatX &mat, idVecX &invDiag, const s3 += s2; s1 += s0; sum = s1 + s3; - + s3_2 += s2_2; s1_2 += s0_2; sum_2 = s1_2 + s3_2; - + mptr[i] = ( mptr[i] - sum ) * d; mptr2[i] = ( mptr2[i] - sum_2 ) * d; - + mptr += nc*2; mptr2 += nc*2; } @@ -4777,13 +4777,13 @@ idSIMD_AltiVec::BlendJoints */ void VPCALL idSIMD_AltiVec::BlendJoints( idJointQuat *joints, const idJointQuat *blendJoints, const float lerp, const int *index, const int numJoints ) { int i; - + // since lerp is a constant, we can special case the two cases if they're true if ( lerp <= 0.0f ) { // this sets joints back to joints. No sense in doing no work, so just return return; } - + if ( lerp >= 1.0f ) { // this copies each q from blendJoints to joints and copies each t from blendJoints to joints memcpy( joints[0].q.ToFloatPtr(), blendJoints[0].q.ToFloatPtr(), sizeof(idJointQuat) * numJoints ); @@ -4792,23 +4792,23 @@ void VPCALL idSIMD_AltiVec::BlendJoints( idJointQuat *joints, const idJointQuat vector float vecLerp = loadSplatUnalignedScalar( &lerp ); vector float zeroVector = (vector float)(0); - + for ( i = 0; i+3 < numJoints; i+=4 ) { int j = index[i]; int j2 = index[i+1]; int j3 = index[i+2]; int j4 = index[i+3]; - + // slerp const float *jointPtr = joints[j].q.ToFloatPtr(); const float *blendPtr = blendJoints[j].q.ToFloatPtr(); const float *jointPtr2 = joints[j2].q.ToFloatPtr(); const float *blendPtr2 = blendJoints[j2].q.ToFloatPtr(); const float *jointPtr3 = joints[j3].q.ToFloatPtr(); - const float *blendPtr3 = blendJoints[j3].q.ToFloatPtr(); + const float *blendPtr3 = blendJoints[j3].q.ToFloatPtr(); const float *jointPtr4 = joints[j4].q.ToFloatPtr(); - const float *blendPtr4 = blendJoints[j4].q.ToFloatPtr(); - + const float *blendPtr4 = blendJoints[j4].q.ToFloatPtr(); + vector unsigned char permVec = vec_add( vec_lvsl( -1, jointPtr ), (vector unsigned char)(1) ); vector unsigned char permVec2 = vec_add( vec_lvsl( -1, jointPtr2 ), (vector unsigned char)(1) ); vector unsigned char permVec3 = vec_add( vec_lvsl( -1, jointPtr3 ), (vector unsigned char)(1) ); @@ -4823,24 +4823,24 @@ void VPCALL idSIMD_AltiVec::BlendJoints( idJointQuat *joints, const idJointQuat vector float v12, v13, v14, v15, v16; vector float vecFromX, vecFromY, vecFromZ, vecFromW; vector float vecToX, vecToY, vecToZ, vecToW; - + // load up the the idJointQuats from joints v0 = vec_ld( 0, jointPtr ); v1 = vec_ld( 15, jointPtr ); v2 = vec_perm( v0, v1, permVec ); - + v3 = vec_ld( 0, jointPtr2 ); v4 = vec_ld( 15, jointPtr2 ); v5 = vec_perm( v3, v4, permVec2 ); - + v6 = vec_ld( 0, jointPtr3 ); v7 = vec_ld( 15, jointPtr3 ); v8 = vec_perm( v6, v7, permVec3 ); v9 = vec_ld( 0, jointPtr4 ); v10 = vec_ld( 15, jointPtr4 ); - v11 = vec_perm( v9, v10, permVec4 ); - + v11 = vec_perm( v9, v10, permVec4 ); + // planarizing, so put each x y z w into its own vector v0 = vec_mergeh( v2, v8 ); v1 = vec_mergeh( v5, v11 ); @@ -4856,11 +4856,11 @@ void VPCALL idSIMD_AltiVec::BlendJoints( idJointQuat *joints, const idJointQuat v5 = vec_ld( 0, blendPtr ); v6 = vec_ld( 15, blendPtr ); v7 = vec_perm( v5, v6, permVec5 ); - + v8 = vec_ld( 0, blendPtr2 ); v9 = vec_ld( 15, blendPtr2 ); v10 = vec_perm( v8, v9, permVec6 ); - + v11 = vec_ld( 0, blendPtr3 ); v12 = vec_ld( 15, blendPtr3 ); v13 = vec_perm( v11, v12, permVec7 ); @@ -4868,7 +4868,7 @@ void VPCALL idSIMD_AltiVec::BlendJoints( idJointQuat *joints, const idJointQuat v14 = vec_ld( 0, blendPtr4 ); v15 = vec_ld( 15, blendPtr4 ); v16 = vec_perm( v14, v15, permVec8 ); - + // put these into their own vectors too v5 = vec_mergeh( v7, v13 ); v6 = vec_mergeh( v10, v16 ); @@ -4886,35 +4886,35 @@ void VPCALL idSIMD_AltiVec::BlendJoints( idJointQuat *joints, const idJointQuat vecCosom = vec_madd( vecFromZ, vecToZ, vecCosom ); vecCosom = vec_madd( vecFromW, vecToW, vecCosom ); - // if cosom is < 0, negate it and set temp to negated elements in to. otherwise, set temp to + // if cosom is < 0, negate it and set temp to negated elements in to. otherwise, set temp to // to vector bool int vecCmp, vecCmp2; vecCmp = vec_cmplt( vecCosom, zeroVector ); - + // negate if needed vecToX = vec_sel( vecToX, vec_madd( vecToX, (vector float)(-1), zeroVector ), vecCmp ); vecToY = vec_sel( vecToY, vec_madd( vecToY, (vector float)(-1), zeroVector ), vecCmp ); vecToZ = vec_sel( vecToZ, vec_madd( vecToZ, (vector float)(-1), zeroVector ), vecCmp ); vecToW = vec_sel( vecToW, vec_madd( vecToW, (vector float)(-1), zeroVector ), vecCmp ); vecCosom = vec_sel( vecCosom, vec_madd( vecCosom, (vector float)(-1), zeroVector ), vecCmp ); - + // check if we need to calculate scale vecCmp2 = vec_cmpgt( vec_sub( (vector float)(1), vecCosom ), (vector float)(1e-6f) ); vector float vecScale0 = vec_sub( (vector float)(1), vecLerp ); vector float vecScale1 = vec_splat( vecLerp, 0 ); - + vector float vecWork1 = vec_sub( (vector float)(1), vec_madd( vecCosom, vecCosom, zeroVector ) ); vector float vecWork2 = ReciprocalSquareRoot( vecWork1 ); vector float vecWork3 = VectorATan16( vec_madd( vecWork1, vecWork2, zeroVector ), vecCosom ); - + vecWork1 = vec_madd( VectorSin16( vec_madd( vecScale0, vecWork3, zeroVector ) ), vecWork2, zeroVector ); vecWork2 = vec_madd( VectorSin16( vec_madd( vecLerp, vecWork3, zeroVector ) ), vecWork2, zeroVector ); - + // see which ones we have to insert into our scale0 and scale1 vectors vecScale0 = vec_sel( vecScale0, vecWork1, vecCmp2 ); vecScale1 = vec_sel( vecScale1, vecWork2, vecCmp2 ); - - // multiply each element by the scale + + // multiply each element by the scale vecFromX = vec_madd( vecFromX, vecScale0, zeroVector ); vecFromY = vec_madd( vecFromY, vecScale0, zeroVector ); vecFromZ = vec_madd( vecFromZ, vecScale0, zeroVector ); @@ -4946,18 +4946,18 @@ void VPCALL idSIMD_AltiVec::BlendJoints( idJointQuat *joints, const idJointQuat vecToX = vec_perm( vecToX, vecToX, storePerm1 ); vecToY = vec_perm( vecToY, vecToY, storePerm2 ); vecToZ = vec_perm( vecToZ, vecToZ, storePerm3 ); - vecToW = vec_perm( vecToW, vecToW, storePerm4 ); + vecToW = vec_perm( vecToW, vecToW, storePerm4 ); vec_ste( vecToX, 0, (float*) jointPtr ); vec_ste( vecToX, 4, (float*) jointPtr ); vec_ste( vecToX, 8, (float*) jointPtr ); vec_ste( vecToX, 12, (float*) jointPtr ); - + vec_ste( vecToY, 0, (float*) jointPtr2 ); vec_ste( vecToY, 4, (float*) jointPtr2 ); vec_ste( vecToY, 8, (float*) jointPtr2 ); vec_ste( vecToY, 12, (float*) jointPtr2 ); - + vec_ste( vecToZ, 0, (float*) jointPtr3 ); vec_ste( vecToZ, 4, (float*) jointPtr3 ); vec_ste( vecToZ, 8, (float*) jointPtr3 ); @@ -4966,9 +4966,9 @@ void VPCALL idSIMD_AltiVec::BlendJoints( idJointQuat *joints, const idJointQuat vec_ste( vecToW, 0, (float*) jointPtr4 ); vec_ste( vecToW, 4, (float*) jointPtr4 ); vec_ste( vecToW, 8, (float*) jointPtr4 ); - vec_ste( vecToW, 12, (float*) jointPtr4 ); + vec_ste( vecToW, 12, (float*) jointPtr4 ); - // lerp is v1 + l * ( v2 - v1 ); + // lerp is v1 + l * ( v2 - v1 ); // the idVec3 T is going to be 12 bytes after the Q, so we can do this without calling ToFloatPtr() again. since its float *jointVecPtr = (float*)( jointPtr + 4 ); float *jointVecPtr2 = (float*)( jointPtr2 + 4 ); @@ -4978,11 +4978,11 @@ void VPCALL idSIMD_AltiVec::BlendJoints( idJointQuat *joints, const idJointQuat v0 = vec_ld( 0, jointVecPtr ); v1 = vec_ld( 11, jointVecPtr ); vector float vecLd1 = vec_perm( v0, v1, vec_add( vec_lvsl( -1, jointVecPtr ), (vector unsigned char)(1) ) ); - + v2 = vec_ld( 0, jointVecPtr2 ); v3 = vec_ld( 11, jointVecPtr2 ); vector float vecLd2 = vec_perm( v2, v3, vec_add( vec_lvsl( -1, jointVecPtr2 ), (vector unsigned char)(1) ) ); - + v4 = vec_ld( 0, jointVecPtr3 ); v5 = vec_ld( 11, jointVecPtr3 ); vector float vecLd3 = vec_perm( v4, v5, vec_add( vec_lvsl( -1, jointVecPtr3 ), (vector unsigned char)(1) ) ); @@ -4990,7 +4990,7 @@ void VPCALL idSIMD_AltiVec::BlendJoints( idJointQuat *joints, const idJointQuat v6 = vec_ld( 0, jointVecPtr4 ); v7 = vec_ld( 11, jointVecPtr4 ); vector float vecLd4 = vec_perm( v6, v7, vec_add( vec_lvsl( -1, jointVecPtr4 ), (vector unsigned char)(1) ) ); - + vector float vecVecX, vecVecY, vecVecZ; vecVecX = vecVecY = vecVecZ = zeroVector; @@ -5013,11 +5013,11 @@ void VPCALL idSIMD_AltiVec::BlendJoints( idJointQuat *joints, const idJointQuat v0 = vec_ld( 0, blendVecPtr ); v1 = vec_ld( 11, blendVecPtr ); vector float vecLd5 = vec_perm( v0, v1, vec_add( vec_lvsl( -1, blendVecPtr ), (vector unsigned char)(1) ) ); - + v2 = vec_ld( 0, blendVecPtr2 ); v3 = vec_ld( 11, blendVecPtr2 ); vector float vecLd6 = vec_perm( v2, v3, vec_add( vec_lvsl( -1, blendVecPtr2 ), (vector unsigned char)(1) ) ); - + v4 = vec_ld( 0, blendVecPtr3 ); v5 = vec_ld( 11, blendVecPtr3 ); vector float vecLd7 = vec_perm( v4, v5, vec_add( vec_lvsl( -1, blendVecPtr3 ), (vector unsigned char)(1) ) ); @@ -5043,22 +5043,22 @@ void VPCALL idSIMD_AltiVec::BlendJoints( idJointQuat *joints, const idJointQuat vecWork1 = vec_sub( vecBlendX, vecVecX ); vecWork2 = vec_sub( vecBlendY, vecVecY ); vecWork3 = vec_sub( vecBlendZ, vecVecZ ); - + // multiply by lerp and add to v1 vecVecX = vec_madd( vecWork1, vecLerp, vecVecX ); vecVecY = vec_madd( vecWork2, vecLerp, vecVecY ); vecVecZ = vec_madd( vecWork3, vecLerp, vecVecZ ); - + // put it back in original form v0 = vec_mergeh( vecVecX, vecVecZ ); v1 = vec_mergeh( vecVecY, zeroVector ); v3 = vec_mergel( vecVecX, vecVecZ ); v4 = vec_mergel( vecVecY, zeroVector ); - + // generate vectors to store vecWork1 = vec_mergeh( v0, v1 ); vecWork2 = vec_mergel( v0, v1 ); - vecWork3 = vec_mergeh( v3, v4 ); + vecWork3 = vec_mergeh( v3, v4 ); vector float vecWork4 = vec_mergel( v3, v4 ); // store the T values @@ -5066,12 +5066,12 @@ void VPCALL idSIMD_AltiVec::BlendJoints( idJointQuat *joints, const idJointQuat storePerm2 = vec_lvsr( 0, jointVecPtr2 ); storePerm3 = vec_lvsr( 0, jointVecPtr3 ); storePerm4 = vec_lvsr( 0, jointVecPtr4 ); - + // right rotate the input data vecWork1 = vec_perm( vecWork1, vecWork1, storePerm1 ); vecWork2 = vec_perm( vecWork2, vecWork2, storePerm2 ); vecWork3 = vec_perm( vecWork3, vecWork3, storePerm3 ); - vecWork4 = vec_perm( vecWork4, vecWork4, storePerm4 ); + vecWork4 = vec_perm( vecWork4, vecWork4, storePerm4 ); vec_ste( vecWork1, 0, (float*) jointVecPtr ); vec_ste( vecWork1, 4, (float*) jointVecPtr ); @@ -5080,16 +5080,16 @@ void VPCALL idSIMD_AltiVec::BlendJoints( idJointQuat *joints, const idJointQuat vec_ste( vecWork2, 0, (float*) jointVecPtr2 ); vec_ste( vecWork2, 4, (float*) jointVecPtr2 ); vec_ste( vecWork2, 8, (float*) jointVecPtr2 ); - + vec_ste( vecWork3, 0, (float*) jointVecPtr3 ); vec_ste( vecWork3, 4, (float*) jointVecPtr3 ); vec_ste( vecWork3, 8, (float*) jointVecPtr3 ); - + vec_ste( vecWork4, 0, (float*) jointVecPtr4 ); vec_ste( vecWork4, 4, (float*) jointVecPtr4 ); vec_ste( vecWork4, 8, (float*) jointVecPtr4 ); } - + // cleanup for ( ; i < numJoints; i++ ) { int j = index[i]; @@ -5107,7 +5107,7 @@ idSIMD_AltiVec::ConvertJointQuatsToJointMats // SSE doesn't vectorize this, and I don't think we should either. Its mainly just copying data, there's very little math involved and // it's not easily parallelizable void VPCALL idSIMD_AltiVec::ConvertJointQuatsToJointMats( idJointMat *jointMats, const idJointQuat *jointQuats, const int numJoints ) { - + for ( int i = 0; i < numJoints; i++ ) { const float *q = jointQuats[i].q.ToFloatPtr(); @@ -5168,21 +5168,21 @@ void VPCALL idSIMD_AltiVec::ConvertJointMatsToJointQuats( idJointQuat *jointQuat // Since we use very little of the data we have to pull in for the altivec version, we end up with // a lot of wasted math. Rather than try to force it to use altivec, I wrote an optimized version - // of InvSqrt for the G5, and made it use that instead. With only this change, we get a little + // of InvSqrt for the G5, and made it use that instead. With only this change, we get a little // bigger than 50% speedup, which is not too shabby. Should really replace idMath::InvSqrt with // my function so everyone can benefit on G5. - + for ( index = 0; index < numJoints; index++ ) { idJointQuat jq; float trace; float s; float t; - int i; + int i; int j; int k; - - static int next[3] = { 1, 2, 0 }; + + static int next[3] = { 1, 2, 0 }; float *mat = (float*)( jointMats[index].ToFloatPtr() ); trace = mat[0 * 4 + 0] + mat[1 * 4 + 1] + mat[2 * 4 + 2]; @@ -5251,24 +5251,24 @@ void VPCALL idSIMD_AltiVec::TransformJoints( idJointMat *jointMats, const int *p vector unsigned char permVec = vec_add( vec_lvsl( -1, jointPtr ), (vector unsigned char)(1) ); vector unsigned char permVec2 = vec_add( vec_lvsl( -1, parentPtr ), (vector unsigned char)(1) ); vector float v0, v1, v2, v3, v4, v5, v6, v7; - + // we need to load up 12 float elements that make up the Mat v0 = vec_ld( 0, jointPtr ); v1 = vec_ld( 15, jointPtr ); v2 = vec_ld( 31, jointPtr ); v3 = vec_ld( 47, jointPtr ); - + // load parents v4 = vec_ld( 0, parentPtr ); v5 = vec_ld( 15, parentPtr ); v6 = vec_ld( 31, parentPtr ); v7 = vec_ld( 47, parentPtr ); - + // permute into vectors vector float vecJointMat1 = vec_perm( v0, v1, permVec ); vector float vecJointMat2 = vec_perm( v1, v2, permVec ); vector float vecJointMat3 = vec_perm( v2, v3, permVec ); - + vector float vecParentMat1 = vec_perm( v4, v5, permVec2 ); vector float vecParentMat2 = vec_perm( v5, v6, permVec2 ); vector float vecParentMat3 = vec_perm( v6, v7, permVec2 ); @@ -5280,12 +5280,12 @@ void VPCALL idSIMD_AltiVec::TransformJoints( idJointMat *jointMats, const int *p C1 = vec_madd( vecJointMat1, vec_splat( vecParentMat1, 0 ), zero ); // m(0 to 3) * a(0) C2 = vec_madd( vecJointMat1, vec_splat( vecParentMat2, 0 ), zero ); // m(4 to 7) * a(4) C3 = vec_madd( vecJointMat1, vec_splat( vecParentMat3, 0 ), zero ); // m(8 to 11) * a(8) - + C1 = vec_madd( vecJointMat2, vec_splat( vecParentMat1, 1 ), C1 ); // add in m(4 to 7) * a(1) C2 = vec_madd( vecJointMat2, vec_splat( vecParentMat2, 1 ), C2 ); // add in m(4 to 7) * a(5) C3 = vec_madd( vecJointMat2, vec_splat( vecParentMat3, 1 ), C3 ); // add in m(4 to 7) * a(9) - - C1 = vec_madd( vecJointMat3, vec_splat( vecParentMat1, 2 ), C1 ); + + C1 = vec_madd( vecJointMat3, vec_splat( vecParentMat1, 2 ), C1 ); C2 = vec_madd( vecJointMat3, vec_splat( vecParentMat2, 2 ), C2 ); C3 = vec_madd( vecJointMat3, vec_splat( vecParentMat3, 2 ), C3 ); @@ -5324,53 +5324,53 @@ void VPCALL idSIMD_AltiVec::UntransformJoints( idJointMat *jointMats, const int vector unsigned char permVec = vec_add( vec_lvsl( -1, jointPtr ), (vector unsigned char)(1) ); vector unsigned char permVec2 = vec_add( vec_lvsl( -1, parentPtr ), (vector unsigned char)(1) ); vector float v0, v1, v2, v3, v4, v5, v6, v7; - + // we need to load up 12 float elements that make up the Mat v0 = vec_ld( 0, jointPtr ); v1 = vec_ld( 15, jointPtr ); v2 = vec_ld( 31, jointPtr ); v3 = vec_ld( 47, jointPtr ); - + // load parents v4 = vec_ld( 0, parentPtr ); v5 = vec_ld( 15, parentPtr ); v6 = vec_ld( 31, parentPtr ); v7 = vec_ld( 47, parentPtr ); - + // permute into vectors vector float vecJointMat1 = vec_perm( v0, v1, permVec ); vector float vecJointMat2 = vec_perm( v1, v2, permVec ); vector float vecJointMat3 = vec_perm( v2, v3, permVec ); - + vector float vecParentMat1 = vec_perm( v4, v5, permVec2 ); vector float vecParentMat2 = vec_perm( v5, v6, permVec2 ); vector float vecParentMat3 = vec_perm( v6, v7, permVec2 ); vector float zero = (vector float)(0); vector float C1, C2, C3; - + // do subtraction at the beginning vector unsigned char permZeroAndLast = (vector unsigned char)(0,1,2,3,4,5,6,7,8,9,10,11,28,29,30,31); vecJointMat1 = vec_sub( vecJointMat1, vec_perm( zero, vecParentMat1, permZeroAndLast ) ); vecJointMat2 = vec_sub( vecJointMat2, vec_perm( zero, vecParentMat2, permZeroAndLast ) ); vecJointMat3 = vec_sub( vecJointMat3, vec_perm( zero, vecParentMat3, permZeroAndLast ) ); - + // matrix multiply C1 = vec_madd( vecJointMat1, vec_splat( vecParentMat1, 0 ), zero ); - C2 = vec_madd( vecJointMat1, vec_splat( vecParentMat1, 1 ), zero ); - C3 = vec_madd( vecJointMat1, vec_splat( vecParentMat1, 2 ), zero ); - - C1 = vec_madd( vecJointMat2, vec_splat( vecParentMat2, 0 ), C1 ); - C2 = vec_madd( vecJointMat2, vec_splat( vecParentMat2, 1 ), C2 ); - C3 = vec_madd( vecJointMat2, vec_splat( vecParentMat2, 2 ), C3 ); - - C1 = vec_madd( vecJointMat3, vec_splat( vecParentMat3, 0 ), C1 ); + C2 = vec_madd( vecJointMat1, vec_splat( vecParentMat1, 1 ), zero ); + C3 = vec_madd( vecJointMat1, vec_splat( vecParentMat1, 2 ), zero ); + + C1 = vec_madd( vecJointMat2, vec_splat( vecParentMat2, 0 ), C1 ); + C2 = vec_madd( vecJointMat2, vec_splat( vecParentMat2, 1 ), C2 ); + C3 = vec_madd( vecJointMat2, vec_splat( vecParentMat2, 2 ), C3 ); + + C1 = vec_madd( vecJointMat3, vec_splat( vecParentMat3, 0 ), C1 ); C2 = vec_madd( vecJointMat3, vec_splat( vecParentMat3, 1 ), C2 ); C3 = vec_madd( vecJointMat3, vec_splat( vecParentMat3, 2 ), C3 ); // store results back vector unsigned char storePerm = vec_lvsr( 0, jointPtr ); - + // right rotate the input data C1 = vec_perm( C1, C1, storePerm ); C2 = vec_perm( C2, C2, storePerm ); @@ -5402,7 +5402,7 @@ idSIMD_AltiVec::TransformVerts */ // Here we don't have much for the vector unit to do, and the gain we get from doing the math -// in parallel is eaten by doing unaligned stores. +// in parallel is eaten by doing unaligned stores. void VPCALL idSIMD_AltiVec::TransformVerts( idDrawVert *verts, const int numVerts, const idJointMat *joints, const idVec4 *weights, const int *index, int numWeights ) { int i, j; const byte *jointsPtr = (byte *)joints; @@ -5412,7 +5412,7 @@ void VPCALL idSIMD_AltiVec::TransformVerts( idDrawVert *verts, const int numVert float *matPtrOrig = ( *(idJointMat *)( jointsPtr + index[j*2] ) ).ToFloatPtr(); float *weightPtr = (float*) weights[j].ToFloatPtr(); - + v[0] = matPtrOrig[0] * weightPtr[0]; v[0] += matPtrOrig[1] * weightPtr[1]; v[0] += matPtrOrig[2] * weightPtr[2]; @@ -5422,7 +5422,7 @@ void VPCALL idSIMD_AltiVec::TransformVerts( idDrawVert *verts, const int numVert v[1] += matPtrOrig[5] * weightPtr[1]; v[1] += matPtrOrig[6] * weightPtr[2]; v[1] += matPtrOrig[7] * weightPtr[3]; - + v[2] = matPtrOrig[8] * weightPtr[0]; v[2] += matPtrOrig[9] * weightPtr[1]; v[2] += matPtrOrig[10] * weightPtr[2]; @@ -5432,17 +5432,17 @@ void VPCALL idSIMD_AltiVec::TransformVerts( idDrawVert *verts, const int numVert j++; float *matPtr = ( *(idJointMat *)( jointsPtr + index[j*2] ) ).ToFloatPtr(); weightPtr = (float*) weights[j].ToFloatPtr(); - + v[0] += matPtr[0] * weightPtr[0]; v[0] += matPtr[1] * weightPtr[1]; v[0] += matPtr[2] * weightPtr[2]; v[0] += matPtr[3] * weightPtr[3]; - + v[1] += matPtr[4] * weightPtr[0]; v[1] += matPtr[5] * weightPtr[1]; v[1] += matPtr[6] * weightPtr[2]; v[1] += matPtr[7] * weightPtr[3]; - + v[2] += matPtr[8] * weightPtr[0]; v[2] += matPtr[9] * weightPtr[1]; v[2] += matPtr[10] * weightPtr[2]; @@ -5464,16 +5464,16 @@ idSIMD_AltiVec::TracePointCull ============ */ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const float radius, const idPlane *planes, const idDrawVert *verts, const int numVerts ) { - + // idDrawVert size assert( sizeof(idDrawVert) == DRAWVERT_OFFSET * sizeof(float) ); - + byte tOr; tOr = 0; // pointers const float *planePtr = planes[0].ToFloatPtr(); - + vector unsigned int vecShift1 = (vector unsigned int)(0,1,2,3); vector unsigned int vecShift2 = (vector unsigned int)(4,5,6,7); vector unsigned int vecFlipBits = (vector unsigned int)(0x0F); @@ -5488,16 +5488,16 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vector unsigned char vecPermLast = (vector unsigned char)(0,1,2,3,4,5,6,7,8,9,10,11,16,17,18,19); vector unsigned char vecPermHalves = (vector unsigned char)(0,1,2,3,4,5,6,7,16,17,18,19,20,21,22,23); vector float vecDPlusRadius1, vecDPlusRadius2, vecDPlusRadius3, vecDPlusRadius4; - vector float vecDMinusRadius1, vecDMinusRadius2, vecDMinusRadius3, vecDMinusRadius4; + vector float vecDMinusRadius1, vecDMinusRadius2, vecDMinusRadius3, vecDMinusRadius4; vector bool int oneIntVector = (vector bool int)(1); vector unsigned int vecBitShifted1, vecBitShifted2, vecBitShifted3, vecBitShifted4, vecBitShifted5, vecBitShifted6, vecBitShifted7, vecBitShifted8; vector unsigned int vecTotals; vector unsigned int tempIntSum; vector unsigned char vertPerm1, vertPerm2, vertPerm3, vertPerm4; - + vecPerm = vec_add( vec_lvsl( -1, planePtr ), (vector unsigned char)(1) ); - - // populate planes + + // populate planes v0 = vec_ld( 0, planePtr ); v1 = vec_ld( 15, planePtr ); vecPlane0 = vec_perm( v0, v1, vecPerm ); @@ -5513,7 +5513,7 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const v2 = vec_ld( 0, planePtr + 12 ); v3 = vec_ld( 15, planePtr + 12 ); vecPlane3 = vec_perm( v2, v3, vecPerm ); - + // transpose v0 = vec_mergeh( vecPlane0, vecPlane2 ); v1 = vec_mergeh( vecPlane1, vecPlane3 ); @@ -5524,14 +5524,14 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vecPlane1 = vec_mergel( v0, v1 ); vecPlane2 = vec_mergeh( v2, v3 ); vecPlane3 = vec_mergel( v2, v3 ); - + // load constants vecRadius = loadSplatUnalignedScalar( &radius ); - + unsigned int cullBitVal[4]; vector unsigned char cullBitPerm = vec_lvsr( 0, &cullBitVal[0] ); int i = 0; - + // every fourth one will have the same alignment. Make sure we've got enough here if ( i+3 < numVerts ) { vertPerm1 = vec_add( vec_lvsl( -1, (float*) verts[0].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); @@ -5539,14 +5539,14 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vertPerm3 = vec_add( vec_lvsl( -1, (float*) verts[2].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); vertPerm4 = vec_add( vec_lvsl( -1, (float*) verts[3].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); } - + for ( ; i+3 < numVerts; i+=4 ) { const float *vertPtr = verts[i].xyz.ToFloatPtr(); const float *vertPtr2 = verts[i+1].xyz.ToFloatPtr(); const float *vertPtr3 = verts[i+2].xyz.ToFloatPtr(); const float *vertPtr4 = verts[i+3].xyz.ToFloatPtr(); - + v0 = vec_ld( 0, vertPtr ); v1 = vec_ld( 15, vertPtr ); v2 = vec_ld( 0, vertPtr2 ); @@ -5555,7 +5555,7 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const v5 = vec_ld( 15, vertPtr3 ); v6 = vec_ld( 0, vertPtr4 ); v7 = vec_ld( 15, vertPtr4 ); - + vecXYZ1 = vec_perm( v0, v1, vertPerm1 ); vecXYZ2 = vec_perm( v2, v3, vertPerm2 ); vecXYZ3 = vec_perm( v4, v5, vertPerm3 ); @@ -5565,21 +5565,21 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vec1Sum1 = vec_madd( vec_splat( vecXYZ1, 1 ), vecPlane1, vec1Sum1 ); vec1Sum1 = vec_madd( vec_splat( vecXYZ1, 2 ), vecPlane2, vec1Sum1 ); vec1Sum1 = vec_add( vec1Sum1, vecPlane3 ); - + vec1Sum2 = vec_madd( vec_splat( vecXYZ2, 0 ), vecPlane0, zeroVector ); vec1Sum2 = vec_madd( vec_splat( vecXYZ2, 1 ), vecPlane1, vec1Sum2 ); vec1Sum2 = vec_madd( vec_splat( vecXYZ2, 2 ), vecPlane2, vec1Sum2 ); - vec1Sum2 = vec_add( vec1Sum2, vecPlane3 ); - + vec1Sum2 = vec_add( vec1Sum2, vecPlane3 ); + vec1Sum3 = vec_madd( vec_splat( vecXYZ3, 0 ), vecPlane0, zeroVector ); vec1Sum3 = vec_madd( vec_splat( vecXYZ3, 1 ), vecPlane1, vec1Sum3 ); vec1Sum3 = vec_madd( vec_splat( vecXYZ3, 2 ), vecPlane2, vec1Sum3 ); vec1Sum3 = vec_add( vec1Sum3, vecPlane3 ); - + vec1Sum4 = vec_madd( vec_splat( vecXYZ4, 0 ), vecPlane0, zeroVector ); vec1Sum4 = vec_madd( vec_splat( vecXYZ4, 1 ), vecPlane1, vec1Sum4 ); vec1Sum4 = vec_madd( vec_splat( vecXYZ4, 2 ), vecPlane2, vec1Sum4 ); - vec1Sum4 = vec_add( vec1Sum4, vecPlane3 ); + vec1Sum4 = vec_add( vec1Sum4, vecPlane3 ); // vec1Sum1 now holds d0, d1, d2, d3. calculate the // difference with +radius and -radius @@ -5591,7 +5591,7 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vecDMinusRadius3 = vec_sub( vec1Sum3, vecRadius ); vecDPlusRadius4 = vec_add( vec1Sum4, vecRadius ); vecDMinusRadius4 = vec_sub( vec1Sum4, vecRadius ); - + // do compare vecCmp1 = vec_cmplt( vecDPlusRadius1, zeroVector ); vecCmp2 = vec_cmplt( vecDMinusRadius1, zeroVector ); @@ -5601,7 +5601,7 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vecCmp6 = vec_cmplt( vecDMinusRadius3, zeroVector ); vecCmp7 = vec_cmplt( vecDPlusRadius4, zeroVector ); vecCmp8 = vec_cmplt( vecDMinusRadius4, zeroVector ); - + //and it with 1 so we multiply by 1 not 1111's vecCmp1 = vec_and( vecCmp1, oneIntVector ); vecCmp2 = vec_and( vecCmp2, oneIntVector ); @@ -5611,7 +5611,7 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vecCmp6 = vec_and( vecCmp6, oneIntVector ); vecCmp7 = vec_and( vecCmp7, oneIntVector ); vecCmp8 = vec_and( vecCmp8, oneIntVector ); - + vecBitShifted1 = vec_sl( (vector unsigned int)vecCmp1, vecShift1 ); vecBitShifted2 = vec_sl( (vector unsigned int)vecCmp2, vecShift2 ); vecBitShifted3 = vec_sl( (vector unsigned int)vecCmp3, vecShift1 ); @@ -5620,25 +5620,25 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vecBitShifted6 = vec_sl( (vector unsigned int)vecCmp6, vecShift2 ); vecBitShifted7 = vec_sl( (vector unsigned int)vecCmp7, vecShift1 ); vecBitShifted8 = vec_sl( (vector unsigned int)vecCmp8, vecShift2 ); - + // OR (add) them all together vecBitShifted1 = vec_add( vecBitShifted1, vecBitShifted2 ); vecBitShifted3 = vec_add( vecBitShifted3, vecBitShifted4 ); vecBitShifted5 = vec_add( vecBitShifted5, vecBitShifted6 ); vecBitShifted7 = vec_add( vecBitShifted7, vecBitShifted8 ); - + vecTotals = vec_add( vecBitShifted1, vec_sld( vecBitShifted1, vecBitShifted1, 8 ) ); vecTotals = vec_add( vecTotals, vec_sld( vecTotals, vecTotals, 4 ) ); tempIntSum = vec_add( vecBitShifted3, vec_sld( vecBitShifted3, vecBitShifted3, 8 ) ); tempIntSum = vec_add( tempIntSum, vec_sld( tempIntSum, tempIntSum, 4 ) ); vecTotals = vec_mergeh( vecTotals, tempIntSum ); tempIntSum = vec_add( vecBitShifted5, vec_sld( vecBitShifted5, vecBitShifted5, 8 ) ); - tempIntSum = vec_add( tempIntSum, vec_sld( tempIntSum, tempIntSum, 4 ) ); + tempIntSum = vec_add( tempIntSum, vec_sld( tempIntSum, tempIntSum, 4 ) ); vecTotals = vec_perm( vecTotals, tempIntSum, vecPermHalves ); tempIntSum = vec_add( vecBitShifted7, vec_sld( vecBitShifted7, vecBitShifted7, 8 ) ); tempIntSum = vec_add( tempIntSum, vec_sld( tempIntSum, tempIntSum, 4 ) ); vecTotals = vec_perm( vecTotals, tempIntSum, vecPermLast ); - + // store out results vector unsigned int tempSt = vec_xor( vecTotals, vecFlipBits ); tempSt = vec_perm( tempSt, tempSt, cullBitPerm ); @@ -5646,16 +5646,16 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vec_ste( tempSt, 4, &cullBitVal[0] ); vec_ste( tempSt, 8, &cullBitVal[0] ); vec_ste( tempSt, 12, &cullBitVal[0] ); - + tOr |= cullBitVal[0]; tOr |= cullBitVal[1]; tOr |= cullBitVal[2]; tOr |= cullBitVal[3]; - + cullBits[i] = cullBitVal[0]; cullBits[i+1] = cullBitVal[1]; cullBits[i+2] = cullBitVal[2]; - cullBits[i+3] = cullBitVal[3]; + cullBits[i+3] = cullBitVal[3]; } // cleanup @@ -5703,16 +5703,16 @@ idSIMD_AltiVec::TracePointCull ============ */ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const float radius, const idPlane *planes, const idDrawVert *verts, const int numVerts ) { - + // idDrawVert size assert( sizeof(idDrawVert) == DRAWVERT_OFFSET * sizeof(float) ); - + byte tOr; tOr = 0; // pointers const float *planePtr = planes[0].ToFloatPtr(); - + vector unsigned int vecShift1 = (vector unsigned int)(0,1,2,3); vector unsigned int vecShift2 = (vector unsigned int)(4,5,6,7); vector unsigned int vecFlipBits = (vector unsigned int)(0x0F); @@ -5727,16 +5727,16 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vector unsigned char vecPermLast = (vector unsigned char)(0,1,2,3,4,5,6,7,8,9,10,11,16,17,18,19); vector unsigned char vecPermHalves = (vector unsigned char)(0,1,2,3,4,5,6,7,16,17,18,19,20,21,22,23); vector float vecDPlusRadius1, vecDPlusRadius2, vecDPlusRadius3, vecDPlusRadius4; - vector float vecDMinusRadius1, vecDMinusRadius2, vecDMinusRadius3, vecDMinusRadius4; + vector float vecDMinusRadius1, vecDMinusRadius2, vecDMinusRadius3, vecDMinusRadius4; vector bool int oneIntVector = (vector bool int)(1); vector unsigned int vecBitShifted1, vecBitShifted2, vecBitShifted3, vecBitShifted4, vecBitShifted5, vecBitShifted6, vecBitShifted7, vecBitShifted8; vector unsigned int vecTotals; vector unsigned int tempIntSum; vector unsigned char vertPerm1, vertPerm2, vertPerm3, vertPerm4; - + vecPerm = vec_add( vec_lvsl( -1, planePtr ), (vector unsigned char)(1) ); - - // populate planes + + // populate planes v0 = vec_ld( 0, planePtr ); v1 = vec_ld( 15, planePtr ); vecPlane0 = vec_perm( v0, v1, vecPerm ); @@ -5752,7 +5752,7 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const v2 = vec_ld( 0, planePtr + 12 ); v3 = vec_ld( 15, planePtr + 12 ); vecPlane3 = vec_perm( v2, v3, vecPerm ); - + // transpose v0 = vec_mergeh( vecPlane0, vecPlane2 ); v1 = vec_mergeh( vecPlane1, vecPlane3 ); @@ -5763,45 +5763,45 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vecPlane1 = vec_mergel( v0, v1 ); vecPlane2 = vec_mergeh( v2, v3 ); vecPlane3 = vec_mergel( v2, v3 ); - + // load constants vecRadius = loadSplatUnalignedScalar( &radius ); - + unsigned int cullBitVal[4]; vector unsigned char cullBitPerm = vec_lvsr( 0, &cullBitVal[0] ); int i = 0; - + for ( ; i+3 < numVerts; i+=4 ) { const float *vertPtr = verts[i].xyz.ToFloatPtr(); const float *vertPtr2 = verts[i+1].xyz.ToFloatPtr(); const float *vertPtr3 = verts[i+2].xyz.ToFloatPtr(); const float *vertPtr4 = verts[i+3].xyz.ToFloatPtr(); - + vecXYZ1 = vec_ld( 0, vertPtr ); vecXYZ2 = vec_ld( 0, vertPtr2 ); vecXYZ3 = vec_ld( 0, vertPtr3 ); vecXYZ4 = vec_ld( 0, vertPtr4 ); - + vec1Sum1 = vec_madd( vec_splat( vecXYZ1, 0 ), vecPlane0, zeroVector ); vec1Sum1 = vec_madd( vec_splat( vecXYZ1, 1 ), vecPlane1, vec1Sum1 ); vec1Sum1 = vec_madd( vec_splat( vecXYZ1, 2 ), vecPlane2, vec1Sum1 ); vec1Sum1 = vec_add( vec1Sum1, vecPlane3 ); - + vec1Sum2 = vec_madd( vec_splat( vecXYZ2, 0 ), vecPlane0, zeroVector ); vec1Sum2 = vec_madd( vec_splat( vecXYZ2, 1 ), vecPlane1, vec1Sum2 ); vec1Sum2 = vec_madd( vec_splat( vecXYZ2, 2 ), vecPlane2, vec1Sum2 ); - vec1Sum2 = vec_add( vec1Sum2, vecPlane3 ); - + vec1Sum2 = vec_add( vec1Sum2, vecPlane3 ); + vec1Sum3 = vec_madd( vec_splat( vecXYZ3, 0 ), vecPlane0, zeroVector ); vec1Sum3 = vec_madd( vec_splat( vecXYZ3, 1 ), vecPlane1, vec1Sum3 ); vec1Sum3 = vec_madd( vec_splat( vecXYZ3, 2 ), vecPlane2, vec1Sum3 ); vec1Sum3 = vec_add( vec1Sum3, vecPlane3 ); - + vec1Sum4 = vec_madd( vec_splat( vecXYZ4, 0 ), vecPlane0, zeroVector ); vec1Sum4 = vec_madd( vec_splat( vecXYZ4, 1 ), vecPlane1, vec1Sum4 ); vec1Sum4 = vec_madd( vec_splat( vecXYZ4, 2 ), vecPlane2, vec1Sum4 ); - vec1Sum4 = vec_add( vec1Sum4, vecPlane3 ); + vec1Sum4 = vec_add( vec1Sum4, vecPlane3 ); // vec1Sum1 now holds d0, d1, d2, d3. calculate the // difference with +radius and -radius @@ -5813,7 +5813,7 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vecDMinusRadius3 = vec_sub( vec1Sum3, vecRadius ); vecDPlusRadius4 = vec_add( vec1Sum4, vecRadius ); vecDMinusRadius4 = vec_sub( vec1Sum4, vecRadius ); - + // do compare vecCmp1 = vec_cmplt( vecDPlusRadius1, zeroVector ); vecCmp2 = vec_cmplt( vecDMinusRadius1, zeroVector ); @@ -5823,7 +5823,7 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vecCmp6 = vec_cmplt( vecDMinusRadius3, zeroVector ); vecCmp7 = vec_cmplt( vecDPlusRadius4, zeroVector ); vecCmp8 = vec_cmplt( vecDMinusRadius4, zeroVector ); - + //and it with 1 so we multiply by 1 not 1111's vecCmp1 = vec_and( vecCmp1, oneIntVector ); vecCmp2 = vec_and( vecCmp2, oneIntVector ); @@ -5833,7 +5833,7 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vecCmp6 = vec_and( vecCmp6, oneIntVector ); vecCmp7 = vec_and( vecCmp7, oneIntVector ); vecCmp8 = vec_and( vecCmp8, oneIntVector ); - + vecBitShifted1 = vec_sl( (vector unsigned int)vecCmp1, vecShift1 ); vecBitShifted2 = vec_sl( (vector unsigned int)vecCmp2, vecShift2 ); vecBitShifted3 = vec_sl( (vector unsigned int)vecCmp3, vecShift1 ); @@ -5842,25 +5842,25 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vecBitShifted6 = vec_sl( (vector unsigned int)vecCmp6, vecShift2 ); vecBitShifted7 = vec_sl( (vector unsigned int)vecCmp7, vecShift1 ); vecBitShifted8 = vec_sl( (vector unsigned int)vecCmp8, vecShift2 ); - + // OR (add) them all together vecBitShifted1 = vec_add( vecBitShifted1, vecBitShifted2 ); vecBitShifted3 = vec_add( vecBitShifted3, vecBitShifted4 ); vecBitShifted5 = vec_add( vecBitShifted5, vecBitShifted6 ); vecBitShifted7 = vec_add( vecBitShifted7, vecBitShifted8 ); - + vecTotals = vec_add( vecBitShifted1, vec_sld( vecBitShifted1, vecBitShifted1, 8 ) ); vecTotals = vec_add( vecTotals, vec_sld( vecTotals, vecTotals, 4 ) ); tempIntSum = vec_add( vecBitShifted3, vec_sld( vecBitShifted3, vecBitShifted3, 8 ) ); tempIntSum = vec_add( tempIntSum, vec_sld( tempIntSum, tempIntSum, 4 ) ); vecTotals = vec_mergeh( vecTotals, tempIntSum ); tempIntSum = vec_add( vecBitShifted5, vec_sld( vecBitShifted5, vecBitShifted5, 8 ) ); - tempIntSum = vec_add( tempIntSum, vec_sld( tempIntSum, tempIntSum, 4 ) ); + tempIntSum = vec_add( tempIntSum, vec_sld( tempIntSum, tempIntSum, 4 ) ); vecTotals = vec_perm( vecTotals, tempIntSum, vecPermHalves ); tempIntSum = vec_add( vecBitShifted7, vec_sld( vecBitShifted7, vecBitShifted7, 8 ) ); tempIntSum = vec_add( tempIntSum, vec_sld( tempIntSum, tempIntSum, 4 ) ); vecTotals = vec_perm( vecTotals, tempIntSum, vecPermLast ); - + // store out results vector unsigned int tempSt = vec_xor( vecTotals, vecFlipBits ); tempSt = vec_perm( tempSt, tempSt, cullBitPerm ); @@ -5868,16 +5868,16 @@ void VPCALL idSIMD_AltiVec::TracePointCull( byte *cullBits, byte &totalOr, const vec_ste( tempSt, 4, &cullBitVal[0] ); vec_ste( tempSt, 8, &cullBitVal[0] ); vec_ste( tempSt, 12, &cullBitVal[0] ); - + tOr |= cullBitVal[0]; tOr |= cullBitVal[1]; tOr |= cullBitVal[2]; tOr |= cullBitVal[3]; - + cullBits[i] = cullBitVal[0]; cullBits[i+1] = cullBitVal[1]; cullBits[i+2] = cullBitVal[2]; - cullBits[i+3] = cullBitVal[3]; + cullBits[i+3] = cullBitVal[3]; } // cleanup @@ -5930,18 +5930,18 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane // idDrawVert size assert( sizeof(idDrawVert) == DRAWVERT_OFFSET * sizeof(float) ); - + int i; const float *planePtr = planes[0].ToFloatPtr(); - + vector float vecPlane0, vecPlane1, vecPlane2, vecPlane3, vecPlane4, vecPlane5, vecPlane6, vecPlane7; vector float zeroVector = (vector float)(0.0); vector unsigned char vecPerm; vector float v0, v1, v2, v3, v4, v5, v6, v7; - + vecPerm = vec_add( vec_lvsl( -1, planePtr ), (vector unsigned char)(1) ); - - // populate planes + + // populate planes v0 = vec_ld( 0, planePtr ); v1 = vec_ld( 15, planePtr ); vecPlane0 = vec_perm( v0, v1, vecPerm ); @@ -5957,15 +5957,15 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane v2 = vec_ld( 0, planePtr + 12 ); v3 = vec_ld( 15, planePtr + 12 ); vecPlane3 = vec_perm( v2, v3, vecPerm ); - + v0 = vec_ld( 0, planePtr + 16 ); v1 = vec_ld( 15, planePtr + 16 ); vecPlane4 = vec_perm( v0, v1, vecPerm ); - + v2 = vec_ld( 0, planePtr + 20 ); v3 = vec_ld( 15, planePtr + 20 ); vecPlane5 = vec_perm( v2, v3, vecPerm ); - + // transpose v0 = vec_mergeh( vecPlane0, vecPlane2 ); v1 = vec_mergeh( vecPlane1, vecPlane3 ); @@ -5976,7 +5976,7 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane vecPlane1 = vec_mergel( v0, v1 ); vecPlane2 = vec_mergeh( v2, v3 ); vecPlane3 = vec_mergel( v2, v3 ); - + v0 = vec_mergeh( vecPlane4, zeroVector ); v1 = vec_mergeh( vecPlane5, zeroVector ); v2 = vec_mergel( vecPlane4, zeroVector ); @@ -5986,14 +5986,14 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane vecPlane5 = vec_mergel( v0, v1 ); vecPlane6 = vec_mergeh( v2, v3 ); vecPlane7 = vec_mergel( v2, v3 ); - - + + vector float vecXYZ1, vecXYZ2, vecXYZ3, vecXYZ4; vector bool int oneIntVector = (vector bool int)(1); vector float vec1Sum1, vec1Sum2, vec2Sum1, vec2Sum2, vec3Sum1, vec3Sum2, vec4Sum1, vec4Sum2; vector unsigned int vecShift1 = (vector unsigned int)(0, 1, 2, 3 ); vector unsigned int vecShift2 = (vector unsigned int)(4, 5, 0, 0 ); - + vector bool int vecCmp1, vecCmp2, vecCmp3, vecCmp4, vecCmp5, vecCmp6, vecCmp7, vecCmp8; vector unsigned int vecBitShifted1, vecBitShifted2, vecBitShifted3, vecBitShifted4; vector unsigned int vecBitShifted5, vecBitShifted6, vecBitShifted7, vecBitShifted8; @@ -6003,7 +6003,7 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane vector unsigned char vertPerm1, vertPerm2, vertPerm3, vertPerm4; unsigned int vBits[4]; vector unsigned char vBitPerm = vec_lvsr( 0, &vBits[4] ); - + i = 0; // every fourth one will have the same alignment. Make sure we've got enough here if ( i+3 < numVerts ) { @@ -6012,14 +6012,14 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane vertPerm3 = vec_add( vec_lvsl( -1, (float*) verts[2].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); vertPerm4 = vec_add( vec_lvsl( -1, (float*) verts[3].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); } - + for ( ; i+3 < numVerts; i+=4 ) { const float *vertPtr = verts[i].xyz.ToFloatPtr(); const float *vertPtr2 = verts[i+1].xyz.ToFloatPtr(); const float *vertPtr3 = verts[i+2].xyz.ToFloatPtr(); const float *vertPtr4 = verts[i+3].xyz.ToFloatPtr(); - + v0 = vec_ld( 0, vertPtr ); v1 = vec_ld( 15, vertPtr ); v2 = vec_ld( 0, vertPtr2 ); @@ -6028,50 +6028,50 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane v5 = vec_ld( 15, vertPtr3 ); v6 = vec_ld( 0, vertPtr4 ); v7 = vec_ld( 15, vertPtr4 ); - + vecXYZ1 = vec_perm( v0, v1, vertPerm1 ); vecXYZ2 = vec_perm( v2, v3, vertPerm2 ); vecXYZ3 = vec_perm( v4, v5, vertPerm3 ); vecXYZ4 = vec_perm( v6, v7, vertPerm4 ); - + vec1Sum1 = vec_madd( vec_splat( vecXYZ1, 0 ), vecPlane0, zeroVector ); vec1Sum1 = vec_madd( vec_splat( vecXYZ1, 1 ), vecPlane1, vec1Sum1 ); vec1Sum1 = vec_madd( vec_splat( vecXYZ1, 2 ), vecPlane2, vec1Sum1 ); vec1Sum1 = vec_add( vec1Sum1, vecPlane3 ); - + vec1Sum2 = vec_madd( vec_splat( vecXYZ1, 0 ), vecPlane4, zeroVector ); vec1Sum2 = vec_madd( vec_splat( vecXYZ1, 1 ), vecPlane5, vec1Sum2 ); - vec1Sum2 = vec_madd( vec_splat( vecXYZ1, 2 ), vecPlane6, vec1Sum2 ); + vec1Sum2 = vec_madd( vec_splat( vecXYZ1, 2 ), vecPlane6, vec1Sum2 ); vec1Sum2 = vec_add( vec1Sum2, vecPlane7 ); - + vec2Sum1 = vec_madd( vec_splat( vecXYZ2, 0 ), vecPlane0, zeroVector ); vec2Sum1 = vec_madd( vec_splat( vecXYZ2, 1 ), vecPlane1, vec2Sum1 ); vec2Sum1 = vec_madd( vec_splat( vecXYZ2, 2 ), vecPlane2, vec2Sum1 ); - vec2Sum1 = vec_add( vec2Sum1, vecPlane3 ); - + vec2Sum1 = vec_add( vec2Sum1, vecPlane3 ); + vec2Sum2 = vec_madd( vec_splat( vecXYZ2, 0 ), vecPlane4, zeroVector ); vec2Sum2 = vec_madd( vec_splat( vecXYZ2, 1 ), vecPlane5, vec2Sum2 ); - vec2Sum2 = vec_madd( vec_splat( vecXYZ2, 2 ), vecPlane6, vec2Sum2 ); + vec2Sum2 = vec_madd( vec_splat( vecXYZ2, 2 ), vecPlane6, vec2Sum2 ); vec2Sum2 = vec_add( vec2Sum2, vecPlane7 ); - + vec3Sum1 = vec_madd( vec_splat( vecXYZ3, 0 ), vecPlane0, zeroVector ); vec3Sum1 = vec_madd( vec_splat( vecXYZ3, 1 ), vecPlane1, vec3Sum1 ); vec3Sum1 = vec_madd( vec_splat( vecXYZ3, 2 ), vecPlane2, vec3Sum1 ); vec3Sum1 = vec_add( vec3Sum1, vecPlane3 ); - + vec3Sum2 = vec_madd( vec_splat( vecXYZ3, 0 ), vecPlane4, zeroVector ); - vec3Sum2 = vec_madd( vec_splat( vecXYZ3, 1 ), vecPlane5, vec3Sum2 ); - vec3Sum2 = vec_madd( vec_splat( vecXYZ3, 2 ), vecPlane6, vec3Sum2 ); - vec3Sum2 = vec_add( vec3Sum2, vecPlane7 ); - + vec3Sum2 = vec_madd( vec_splat( vecXYZ3, 1 ), vecPlane5, vec3Sum2 ); + vec3Sum2 = vec_madd( vec_splat( vecXYZ3, 2 ), vecPlane6, vec3Sum2 ); + vec3Sum2 = vec_add( vec3Sum2, vecPlane7 ); + vec4Sum1 = vec_madd( vec_splat( vecXYZ4, 0 ), vecPlane0, zeroVector ); vec4Sum1 = vec_madd( vec_splat( vecXYZ4, 1 ), vecPlane1, vec4Sum1 ); vec4Sum1 = vec_madd( vec_splat( vecXYZ4, 2 ), vecPlane2, vec4Sum1 ); - vec4Sum1 = vec_add( vec4Sum1, vecPlane3 ); - + vec4Sum1 = vec_add( vec4Sum1, vecPlane3 ); + vec4Sum2 = vec_madd( vec_splat( vecXYZ4, 0 ), vecPlane4, zeroVector ); - vec4Sum2 = vec_madd( vec_splat( vecXYZ4, 1 ), vecPlane5, vec4Sum2 ); - vec4Sum2 = vec_madd( vec_splat( vecXYZ4, 2 ), vecPlane6, vec4Sum2 ); + vec4Sum2 = vec_madd( vec_splat( vecXYZ4, 1 ), vecPlane5, vec4Sum2 ); + vec4Sum2 = vec_madd( vec_splat( vecXYZ4, 2 ), vecPlane6, vec4Sum2 ); vec4Sum2 = vec_add( vec4Sum2, vecPlane7 ); vecCmp1 = vec_cmplt( vec1Sum1, zeroVector ); @@ -6082,7 +6082,7 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane vecCmp6 = vec_cmplt( vec3Sum2, zeroVector ); vecCmp7 = vec_cmplt( vec4Sum1, zeroVector ); vecCmp8 = vec_cmplt( vec4Sum2, zeroVector ); - + //and it with 1 so we multiply by 1 not 1111's vecCmp1 = vec_and( vecCmp1, oneIntVector ); vecCmp2 = vec_and( vecCmp2, oneIntVector ); @@ -6101,32 +6101,32 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane vecBitShifted6 = vec_sl( (vector unsigned int)vecCmp6, vecShift2 ); vecBitShifted7 = vec_sl( (vector unsigned int)vecCmp7, vecShift1 ); vecBitShifted8 = vec_sl( (vector unsigned int)vecCmp8, vecShift2 ); - - //OR them all together (this is the same as adding them, since they're all only 1 bit set) + + //OR them all together (this is the same as adding them, since they're all only 1 bit set) vecR1 = (vector unsigned int)(0); //zeroIntVector; vecR1 = vec_add( vecBitShifted1, vec_sld( vecBitShifted1, vecBitShifted1, 8 ) ); - vecR1 = vec_add( vecR1, vec_sld( vecR1, vecR1, 4 ) ); + vecR1 = vec_add( vecR1, vec_sld( vecR1, vecR1, 4 ) ); vecR1 = vec_add(vecR1, vecBitShifted2 ); vecR1 = vec_or( vecR1, vec_sld( vecBitShifted2, vecBitShifted2, 4 ) ); - + vecR2 = (vector unsigned int)(0); //zeroIntVector; vecR2 = vec_add( vecBitShifted3, vec_sld( vecBitShifted3, vecBitShifted3, 8 ) ); - vecR2 = vec_add( vecR2, vec_sld( vecR2, vecR2, 4 ) ); + vecR2 = vec_add( vecR2, vec_sld( vecR2, vecR2, 4 ) ); vecR2 = vec_add(vecR2, vecBitShifted4 ); vecR2 = vec_or( vecR2, vec_sld( vecBitShifted4, vecBitShifted4, 4 ) ); - + vecR3 = (vector unsigned int)(0); //zeroIntVector; vecR3 = vec_add( vecBitShifted5, vec_sld( vecBitShifted5, vecBitShifted5, 8 ) ); - vecR3 = vec_add( vecR3, vec_sld( vecR3, vecR3, 4 ) ); + vecR3 = vec_add( vecR3, vec_sld( vecR3, vecR3, 4 ) ); vecR3 = vec_add(vecR3, vecBitShifted6 ); vecR3 = vec_or( vecR3, vec_sld( vecBitShifted6, vecBitShifted6, 4 ) ); - + vecR4 = (vector unsigned int)(0); //zeroIntVector; vecR4 = vec_add( vecBitShifted7, vec_sld( vecBitShifted7, vecBitShifted7, 8 ) ); - vecR4 = vec_add( vecR4, vec_sld( vecR4, vecR4, 4 ) ); + vecR4 = vec_add( vecR4, vec_sld( vecR4, vecR4, 4 ) ); vecR4 = vec_add(vecR4, vecBitShifted8 ); vecR4 = vec_or( vecR4, vec_sld( vecBitShifted8, vecBitShifted8, 4 ) ); - + // take the first element from each vector and put them into vecR1 vecR1 = vec_mergeh( vecR1, vecR2 ); vecR3 = vec_mergeh( vecR3, vecR4 ); @@ -6134,7 +6134,7 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane // XOR with 0x3F to flip lower 6 bits vecR1 = vec_xor( vecR1, vecFlipBits ); - + // store out results. don't have 16 at a time so let's just // do this and avoid alignment concerns vecR1 = vec_perm( vecR1, vecR1, vBitPerm ); @@ -6142,13 +6142,13 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane vec_ste( vecR1, 4, &vBits[0] ); vec_ste( vecR1, 8, &vBits[0] ); vec_ste( vecR1, 12, &vBits[0] ); - + cullBits[i] = vBits[0]; cullBits[i+1] = vBits[1]; cullBits[i+2] = vBits[2]; cullBits[i+3] = vBits[3]; } - + for ( ; i < numVerts; i++ ) { byte bits; float d0, d1, d2, d3, d4, d5; @@ -6161,7 +6161,7 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane d4 = planes[4].Distance( v ); d5 = planes[5].Distance( v ); - // they check if the sign bit is set by casting as long and shifting right 31 places. + // they check if the sign bit is set by casting as long and shifting right 31 places. bits = FLOATSIGNBITSET( d0 ) << 0; bits |= FLOATSIGNBITSET( d1 ) << 1; bits |= FLOATSIGNBITSET( d2 ) << 2; @@ -6184,18 +6184,18 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane // idDrawVert size assert( sizeof(idDrawVert) == DRAWVERT_OFFSET * sizeof(float) ); - + int i; const float *planePtr = planes[0].ToFloatPtr(); - + vector float vecPlane0, vecPlane1, vecPlane2, vecPlane3, vecPlane4, vecPlane5, vecPlane6, vecPlane7; vector float zeroVector = (vector float)(0.0); vector unsigned char vecPerm; vector float v0, v1, v2, v3, v4, v5, v6, v7; - + vecPerm = vec_add( vec_lvsl( -1, planePtr ), (vector unsigned char)(1) ); - - // populate planes + + // populate planes v0 = vec_ld( 0, planePtr ); v1 = vec_ld( 15, planePtr ); vecPlane0 = vec_perm( v0, v1, vecPerm ); @@ -6211,15 +6211,15 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane v2 = vec_ld( 0, planePtr + 12 ); v3 = vec_ld( 15, planePtr + 12 ); vecPlane3 = vec_perm( v2, v3, vecPerm ); - + v0 = vec_ld( 0, planePtr + 16 ); v1 = vec_ld( 15, planePtr + 16 ); vecPlane4 = vec_perm( v0, v1, vecPerm ); - + v2 = vec_ld( 0, planePtr + 20 ); v3 = vec_ld( 15, planePtr + 20 ); vecPlane5 = vec_perm( v2, v3, vecPerm ); - + // transpose v0 = vec_mergeh( vecPlane0, vecPlane2 ); v1 = vec_mergeh( vecPlane1, vecPlane3 ); @@ -6230,7 +6230,7 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane vecPlane1 = vec_mergel( v0, v1 ); vecPlane2 = vec_mergeh( v2, v3 ); vecPlane3 = vec_mergel( v2, v3 ); - + v0 = vec_mergeh( vecPlane4, zeroVector ); v1 = vec_mergeh( vecPlane5, zeroVector ); v2 = vec_mergel( vecPlane4, zeroVector ); @@ -6240,14 +6240,14 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane vecPlane5 = vec_mergel( v0, v1 ); vecPlane6 = vec_mergeh( v2, v3 ); vecPlane7 = vec_mergel( v2, v3 ); - - + + vector float vecXYZ1, vecXYZ2, vecXYZ3, vecXYZ4; vector bool int oneIntVector = (vector bool int)(1); vector float vec1Sum1, vec1Sum2, vec2Sum1, vec2Sum2, vec3Sum1, vec3Sum2, vec4Sum1, vec4Sum2; vector unsigned int vecShift1 = (vector unsigned int)(0, 1, 2, 3 ); vector unsigned int vecShift2 = (vector unsigned int)(4, 5, 0, 0 ); - + vector bool int vecCmp1, vecCmp2, vecCmp3, vecCmp4, vecCmp5, vecCmp6, vecCmp7, vecCmp8; vector unsigned int vecBitShifted1, vecBitShifted2, vecBitShifted3, vecBitShifted4; vector unsigned int vecBitShifted5, vecBitShifted6, vecBitShifted7, vecBitShifted8; @@ -6257,58 +6257,58 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane vector unsigned char vertPerm1, vertPerm2, vertPerm3, vertPerm4; unsigned int vBits[4]; vector unsigned char vBitPerm = vec_lvsr( 0, &vBits[4] ); - + i = 0; - + for ( ; i+3 < numVerts; i+=4 ) { const float *vertPtr = verts[i].xyz.ToFloatPtr(); const float *vertPtr2 = verts[i+1].xyz.ToFloatPtr(); const float *vertPtr3 = verts[i+2].xyz.ToFloatPtr(); const float *vertPtr4 = verts[i+3].xyz.ToFloatPtr(); - + v0 = vec_ld( 0, vertPtr ); v2 = vec_ld( 0, vertPtr2 ); v4 = vec_ld( 0, vertPtr3 ); v6 = vec_ld( 0, vertPtr4 ); - + vec1Sum1 = vec_madd( vec_splat( vecXYZ1, 0 ), vecPlane0, zeroVector ); vec1Sum1 = vec_madd( vec_splat( vecXYZ1, 1 ), vecPlane1, vec1Sum1 ); vec1Sum1 = vec_madd( vec_splat( vecXYZ1, 2 ), vecPlane2, vec1Sum1 ); vec1Sum1 = vec_add( vec1Sum1, vecPlane3 ); - + vec1Sum2 = vec_madd( vec_splat( vecXYZ1, 0 ), vecPlane4, zeroVector ); vec1Sum2 = vec_madd( vec_splat( vecXYZ1, 1 ), vecPlane5, vec1Sum2 ); - vec1Sum2 = vec_madd( vec_splat( vecXYZ1, 2 ), vecPlane6, vec1Sum2 ); + vec1Sum2 = vec_madd( vec_splat( vecXYZ1, 2 ), vecPlane6, vec1Sum2 ); vec1Sum2 = vec_add( vec1Sum2, vecPlane7 ); - + vec2Sum1 = vec_madd( vec_splat( vecXYZ2, 0 ), vecPlane0, zeroVector ); vec2Sum1 = vec_madd( vec_splat( vecXYZ2, 1 ), vecPlane1, vec2Sum1 ); vec2Sum1 = vec_madd( vec_splat( vecXYZ2, 2 ), vecPlane2, vec2Sum1 ); - vec2Sum1 = vec_add( vec2Sum1, vecPlane3 ); - + vec2Sum1 = vec_add( vec2Sum1, vecPlane3 ); + vec2Sum2 = vec_madd( vec_splat( vecXYZ2, 0 ), vecPlane4, zeroVector ); vec2Sum2 = vec_madd( vec_splat( vecXYZ2, 1 ), vecPlane5, vec2Sum2 ); - vec2Sum2 = vec_madd( vec_splat( vecXYZ2, 2 ), vecPlane6, vec2Sum2 ); + vec2Sum2 = vec_madd( vec_splat( vecXYZ2, 2 ), vecPlane6, vec2Sum2 ); vec2Sum2 = vec_add( vec2Sum2, vecPlane7 ); - + vec3Sum1 = vec_madd( vec_splat( vecXYZ3, 0 ), vecPlane0, zeroVector ); vec3Sum1 = vec_madd( vec_splat( vecXYZ3, 1 ), vecPlane1, vec3Sum1 ); vec3Sum1 = vec_madd( vec_splat( vecXYZ3, 2 ), vecPlane2, vec3Sum1 ); vec3Sum1 = vec_add( vec3Sum1, vecPlane3 ); - + vec3Sum2 = vec_madd( vec_splat( vecXYZ3, 0 ), vecPlane4, zeroVector ); - vec3Sum2 = vec_madd( vec_splat( vecXYZ3, 1 ), vecPlane5, vec3Sum2 ); - vec3Sum2 = vec_madd( vec_splat( vecXYZ3, 2 ), vecPlane6, vec3Sum2 ); - vec3Sum2 = vec_add( vec3Sum2, vecPlane7 ); - + vec3Sum2 = vec_madd( vec_splat( vecXYZ3, 1 ), vecPlane5, vec3Sum2 ); + vec3Sum2 = vec_madd( vec_splat( vecXYZ3, 2 ), vecPlane6, vec3Sum2 ); + vec3Sum2 = vec_add( vec3Sum2, vecPlane7 ); + vec4Sum1 = vec_madd( vec_splat( vecXYZ4, 0 ), vecPlane0, zeroVector ); vec4Sum1 = vec_madd( vec_splat( vecXYZ4, 1 ), vecPlane1, vec4Sum1 ); vec4Sum1 = vec_madd( vec_splat( vecXYZ4, 2 ), vecPlane2, vec4Sum1 ); - vec4Sum1 = vec_add( vec4Sum1, vecPlane3 ); - + vec4Sum1 = vec_add( vec4Sum1, vecPlane3 ); + vec4Sum2 = vec_madd( vec_splat( vecXYZ4, 0 ), vecPlane4, zeroVector ); - vec4Sum2 = vec_madd( vec_splat( vecXYZ4, 1 ), vecPlane5, vec4Sum2 ); - vec4Sum2 = vec_madd( vec_splat( vecXYZ4, 2 ), vecPlane6, vec4Sum2 ); + vec4Sum2 = vec_madd( vec_splat( vecXYZ4, 1 ), vecPlane5, vec4Sum2 ); + vec4Sum2 = vec_madd( vec_splat( vecXYZ4, 2 ), vecPlane6, vec4Sum2 ); vec4Sum2 = vec_add( vec4Sum2, vecPlane7 ); vecCmp1 = vec_cmplt( vec1Sum1, zeroVector ); @@ -6319,7 +6319,7 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane vecCmp6 = vec_cmplt( vec3Sum2, zeroVector ); vecCmp7 = vec_cmplt( vec4Sum1, zeroVector ); vecCmp8 = vec_cmplt( vec4Sum2, zeroVector ); - + //and it with 1 so we multiply by 1 not 1111's vecCmp1 = vec_and( vecCmp1, oneIntVector ); vecCmp2 = vec_and( vecCmp2, oneIntVector ); @@ -6338,32 +6338,32 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane vecBitShifted6 = vec_sl( (vector unsigned int)vecCmp6, vecShift2 ); vecBitShifted7 = vec_sl( (vector unsigned int)vecCmp7, vecShift1 ); vecBitShifted8 = vec_sl( (vector unsigned int)vecCmp8, vecShift2 ); - - //OR them all together (this is the same as adding them, since they're all only 1 bit set) + + //OR them all together (this is the same as adding them, since they're all only 1 bit set) vecR1 = (vector unsigned int)(0); //zeroIntVector; vecR1 = vec_add( vecBitShifted1, vec_sld( vecBitShifted1, vecBitShifted1, 8 ) ); - vecR1 = vec_add( vecR1, vec_sld( vecR1, vecR1, 4 ) ); + vecR1 = vec_add( vecR1, vec_sld( vecR1, vecR1, 4 ) ); vecR1 = vec_add(vecR1, vecBitShifted2 ); vecR1 = vec_or( vecR1, vec_sld( vecBitShifted2, vecBitShifted2, 4 ) ); - + vecR2 = (vector unsigned int)(0); //zeroIntVector; vecR2 = vec_add( vecBitShifted3, vec_sld( vecBitShifted3, vecBitShifted3, 8 ) ); - vecR2 = vec_add( vecR2, vec_sld( vecR2, vecR2, 4 ) ); + vecR2 = vec_add( vecR2, vec_sld( vecR2, vecR2, 4 ) ); vecR2 = vec_add(vecR2, vecBitShifted4 ); vecR2 = vec_or( vecR2, vec_sld( vecBitShifted4, vecBitShifted4, 4 ) ); - + vecR3 = (vector unsigned int)(0); //zeroIntVector; vecR3 = vec_add( vecBitShifted5, vec_sld( vecBitShifted5, vecBitShifted5, 8 ) ); - vecR3 = vec_add( vecR3, vec_sld( vecR3, vecR3, 4 ) ); + vecR3 = vec_add( vecR3, vec_sld( vecR3, vecR3, 4 ) ); vecR3 = vec_add(vecR3, vecBitShifted6 ); vecR3 = vec_or( vecR3, vec_sld( vecBitShifted6, vecBitShifted6, 4 ) ); - + vecR4 = (vector unsigned int)(0); //zeroIntVector; vecR4 = vec_add( vecBitShifted7, vec_sld( vecBitShifted7, vecBitShifted7, 8 ) ); - vecR4 = vec_add( vecR4, vec_sld( vecR4, vecR4, 4 ) ); + vecR4 = vec_add( vecR4, vec_sld( vecR4, vecR4, 4 ) ); vecR4 = vec_add(vecR4, vecBitShifted8 ); vecR4 = vec_or( vecR4, vec_sld( vecBitShifted8, vecBitShifted8, 4 ) ); - + // take the first element from each vector and put them into vecR1 vecR1 = vec_mergeh( vecR1, vecR2 ); vecR3 = vec_mergeh( vecR3, vecR4 ); @@ -6371,7 +6371,7 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane // XOR with 0x3F to flip lower 6 bits vecR1 = vec_xor( vecR1, vecFlipBits ); - + // store out results. don't have 16 at a time so let's just // do this and avoid alignment concerns vecR1 = vec_perm( vecR1, vecR1, vBitPerm ); @@ -6379,13 +6379,13 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane vec_ste( vecR1, 4, &vBits[0] ); vec_ste( vecR1, 8, &vBits[0] ); vec_ste( vecR1, 12, &vBits[0] ); - + cullBits[i] = vBits[0]; cullBits[i+1] = vBits[1]; cullBits[i+2] = vBits[2]; cullBits[i+3] = vBits[3]; } - + for ( ; i < numVerts; i++ ) { byte bits; float d0, d1, d2, d3, d4, d5; @@ -6398,7 +6398,7 @@ void VPCALL idSIMD_AltiVec::DecalPointCull( byte *cullBits, const idPlane *plane d4 = planes[4].Distance( v ); d5 = planes[5].Distance( v ); - // they check if the sign bit is set by casting as long and shifting right 31 places. + // they check if the sign bit is set by casting as long and shifting right 31 places. bits = FLOATSIGNBITSET( d0 ) << 0; bits |= FLOATSIGNBITSET( d1 ) << 1; bits |= FLOATSIGNBITSET( d2 ) << 2; @@ -6420,23 +6420,23 @@ idSIMD_AltiVec::OverlayPointCull ============ */ void VPCALL idSIMD_AltiVec::OverlayPointCull( byte *cullBits, idVec2 *texCoords, const idPlane *planes, const idDrawVert *verts, const int numVerts ) { - + // idDrawVert size assert( sizeof(idDrawVert) == DRAWVERT_OFFSET * sizeof(float) ); - + int i; float p0x, p0y, p0z, p0d; float p1x, p1y, p1z, p1d; - + const float *planePtr = planes[0].ToFloatPtr(); const float *vertPtr = verts[0].xyz.ToFloatPtr(); - + vector float vecPlane0, vecPlane1, vecPlane2, vecPlane3; vector float v0, v1, v2, v3, v4, v5, v6, v7; vector unsigned char vecPerm; vector float zeroVector = (vector float)(0); - + p0x = *(planePtr + 0); p0y = *(planePtr + 1); p0z = *(planePtr + 2); @@ -6445,16 +6445,16 @@ void VPCALL idSIMD_AltiVec::OverlayPointCull( byte *cullBits, idVec2 *texCoords, p1y = *(planePtr + 5); p1z = *(planePtr + 6); p1d = *(planePtr + 7); - + // populate the planes vecPerm = vec_add( vec_lvsl( -1, planePtr ), (vector unsigned char)(1) ); v0 = vec_ld( 0, planePtr ); v1 = vec_ld( 15, planePtr ); vecPlane0 = vec_perm( v0, v1, vecPerm ); - + v2 = vec_ld( 31, planePtr ); vecPlane1 = vec_perm( v1, v2, vecPerm ); - + // transpose v0 = vec_mergeh( vecPlane0, vecPlane0 ); v1 = vec_mergeh( vecPlane1, vecPlane1 ); @@ -6490,14 +6490,14 @@ void VPCALL idSIMD_AltiVec::OverlayPointCull( byte *cullBits, idVec2 *texCoords, vertPerm3 = vec_add( vec_lvsl( -1, (float*) verts[2].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); vertPerm4 = vec_add( vec_lvsl( -1, (float*) verts[3].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); } - + for ( ; i+3 < numVerts; i+=4 ) { const float *vertPtr = verts[i].xyz.ToFloatPtr(); const float *vertPtr2 = verts[i+1].xyz.ToFloatPtr(); const float *vertPtr3 = verts[i+2].xyz.ToFloatPtr(); const float *vertPtr4 = verts[i+3].xyz.ToFloatPtr(); - + v0 = vec_ld( 0, vertPtr ); v1 = vec_ld( 15, vertPtr ); v2 = vec_ld( 0, vertPtr2 ); @@ -6506,7 +6506,7 @@ void VPCALL idSIMD_AltiVec::OverlayPointCull( byte *cullBits, idVec2 *texCoords, v5 = vec_ld( 15, vertPtr3 ); v6 = vec_ld( 0, vertPtr4 ); v7 = vec_ld( 15, vertPtr4 ); - + vecXYZ1 = vec_perm( v0, v1, vertPerm1 ); vecXYZ2 = vec_perm( v2, v3, vertPerm2 ); vecXYZ3 = vec_perm( v4, v5, vertPerm3 ); @@ -6529,22 +6529,22 @@ void VPCALL idSIMD_AltiVec::OverlayPointCull( byte *cullBits, idVec2 *texCoords, // bit manipulation vecCmp1 = vec_cmplt( vecSum1, zeroVector ); vecCmp2 = vec_cmplt( vecSum2, zeroVector ); - + //and it with 1 so we multiply by 1 not 1111's vecCmp1 = vec_and( vecCmp1, oneIntVector ); - vecCmp2 = vec_and( vecCmp2, oneIntVector ); - - // store out and write to cullBits + vecCmp2 = vec_and( vecCmp2, oneIntVector ); + + // store out and write to cullBits // finally, a use for algebra! 1-x = x + 1 - 2x vecSum1Inv = vec_madd( vecSum1, negTwoVector, vecSum1 ); vecSum2Inv = vec_madd( vecSum2, negTwoVector, vecSum2 ); vecSum1Inv = vec_add( vecSum1Inv, oneVector ); vecSum2Inv = vec_add( vecSum2Inv, oneVector ); - + // do the same comparisons for the inverted d0/d1 vecCmp1Inv = vec_cmplt( vecSum1Inv, zeroVector ); vecCmp2Inv = vec_cmplt( vecSum2Inv, zeroVector ); - + //and it with 1 so we multiply by 1 not 1111's vecCmp1Inv = vec_and( vecCmp1Inv, oneIntVector ); vecCmp2Inv = vec_and( vecCmp2Inv, oneIntVector ); @@ -6561,24 +6561,24 @@ void VPCALL idSIMD_AltiVec::OverlayPointCull( byte *cullBits, idVec2 *texCoords, vector unsigned int vecResult2; vector unsigned int vecResult3; vecResult = vec_add( vecBitShifted1, vec_sld( vecBitShifted1, vecBitShifted1, 4 ) ); - + vecResult2 = vec_add( vecBitShifted2, vec_sld( vecBitShifted2, vecBitShifted2, 4 ) ); - + // vecResult now holds the values without the inverses yet, so add those - vecResult = vec_perm( vecResult, vecResult2, vecPermFirstThird ); + vecResult = vec_perm( vecResult, vecResult2, vecPermFirstThird ); vecResult2 = vec_add( vecBitShifted1Inv, vec_sld( vecBitShifted1Inv, vecBitShifted1Inv, 4 ) ); vecResult3 = vec_add( vecBitShifted2Inv, vec_sld( vecBitShifted2Inv, vecBitShifted2Inv, 4 ) ); vecResult2 = vec_perm( vecResult2, vecResult3, vecPermFirstThird ); - + vecResult = vec_add( vecResult, vecResult2 ); - + //store out results vecResult = vec_perm( vecResult, vecResult, cullBitPerm ); vec_ste( vecResult, 0, &cullBitVal[0] ); vec_ste( vecResult, 4, &cullBitVal[0] ); vec_ste( vecResult, 8, &cullBitVal[0] ); vec_ste( vecResult, 12, &cullBitVal[0] ); - + cullBits[i] = cullBitVal[0]; cullBits[i+1] = cullBitVal[1]; cullBits[i+2] = cullBitVal[2]; @@ -6590,21 +6590,21 @@ void VPCALL idSIMD_AltiVec::OverlayPointCull( byte *cullBits, idVec2 *texCoords, byte bits; float d0, d1; float vx, vy, vz; - + vx = *( vertPtr + (i*DRAWVERT_OFFSET) + 0 ); vy = *( vertPtr + (i*DRAWVERT_OFFSET) + 1 ); vz = *( vertPtr + (i*DRAWVERT_OFFSET) + 2 ); - + d0 = p0x * vx + p0y * vy + p0z * vz + p0d; d1 = p1x * vx + p1y * vy + p1z * vz + p1d; texCoords[i][0] = d0; texCoords[i][1] = d1; - + bits = ( d0 >= 0 ) ? 0 : 1; d0 = 1.0f - d0; - bits |= ( d1 >= 0 ) ? 0 : 1*2; + bits |= ( d1 >= 0 ) ? 0 : 1*2; d1 = 1.0f - d1; - + bits |= ( d0 >= 0 ) ? 0: 1*4; bits |= ( d1 >= 0 ) ? 0: 1*8; @@ -6619,23 +6619,23 @@ idSIMD_AltiVec::OverlayPointCull ============ */ void VPCALL idSIMD_AltiVec::OverlayPointCull( byte *cullBits, idVec2 *texCoords, const idPlane *planes, const idDrawVert *verts, const int numVerts ) { - + // idDrawVert size assert( sizeof(idDrawVert) == DRAWVERT_OFFSET * sizeof(float) ); - + int i; float p0x, p0y, p0z, p0d; float p1x, p1y, p1z, p1d; - + const float *planePtr = planes[0].ToFloatPtr(); const float *vertPtr = verts[0].xyz.ToFloatPtr(); - + vector float vecPlane0, vecPlane1, vecPlane2, vecPlane3; vector float v0, v1, v2, v3, v4, v5, v6, v7; vector unsigned char vecPerm; vector float zeroVector = (vector float)(0); - + p0x = *(planePtr + 0); p0y = *(planePtr + 1); p0z = *(planePtr + 2); @@ -6644,16 +6644,16 @@ void VPCALL idSIMD_AltiVec::OverlayPointCull( byte *cullBits, idVec2 *texCoords, p1y = *(planePtr + 5); p1z = *(planePtr + 6); p1d = *(planePtr + 7); - + // populate the planes vecPerm = vec_add( vec_lvsl( -1, planePtr ), (vector unsigned char)(1) ); v0 = vec_ld( 0, planePtr ); v1 = vec_ld( 15, planePtr ); vecPlane0 = vec_perm( v0, v1, vecPerm ); - + v2 = vec_ld( 31, planePtr ); vecPlane1 = vec_perm( v1, v2, vecPerm ); - + // transpose v0 = vec_mergeh( vecPlane0, vecPlane0 ); v1 = vec_mergeh( vecPlane1, vecPlane1 ); @@ -6688,12 +6688,12 @@ void VPCALL idSIMD_AltiVec::OverlayPointCull( byte *cullBits, idVec2 *texCoords, const float *vertPtr2 = verts[i+1].xyz.ToFloatPtr(); const float *vertPtr3 = verts[i+2].xyz.ToFloatPtr(); const float *vertPtr4 = verts[i+3].xyz.ToFloatPtr(); - + vecXYZ1 = vec_ld( 0, vertPtr ); vecXYZ2 = vec_ld( 0, vertPtr2 ); vecXYZ3 = vec_ld( 0, vertPtr3 ); vecXYZ4 = vec_ld( 0, vertPtr4 ); - + // like a splat, but only doing halves vecSum1 = vec_madd( vec_perm( vecXYZ1, vecXYZ2, (vector unsigned char)(0,1,2,3,0,1,2,3,16,17,18,19,16,17,18,19) ), vecPlane0, zeroVector ); vecSum1 = vec_madd( vec_perm( vecXYZ1, vecXYZ2, (vector unsigned char)(4,5,6,7,4,5,6,7,20,21,22,23,20,21,22,23) ) , vecPlane1, vecSum1 ); @@ -6711,22 +6711,22 @@ void VPCALL idSIMD_AltiVec::OverlayPointCull( byte *cullBits, idVec2 *texCoords, // bit manipulation vecCmp1 = vec_cmplt( vecSum1, zeroVector ); vecCmp2 = vec_cmplt( vecSum2, zeroVector ); - + //and it with 1 so we multiply by 1 not 1111's vecCmp1 = vec_and( vecCmp1, oneIntVector ); - vecCmp2 = vec_and( vecCmp2, oneIntVector ); - - // store out and write to cullBits + vecCmp2 = vec_and( vecCmp2, oneIntVector ); + + // store out and write to cullBits // finally, a use for algebra! 1-x = x + 1 - 2x vecSum1Inv = vec_madd( vecSum1, negTwoVector, vecSum1 ); vecSum2Inv = vec_madd( vecSum2, negTwoVector, vecSum2 ); vecSum1Inv = vec_add( vecSum1Inv, oneVector ); vecSum2Inv = vec_add( vecSum2Inv, oneVector ); - + // do the same comparisons for the inverted d0/d1 vecCmp1Inv = vec_cmplt( vecSum1Inv, zeroVector ); vecCmp2Inv = vec_cmplt( vecSum2Inv, zeroVector ); - + //and it with 1 so we multiply by 1 not 1111's vecCmp1Inv = vec_and( vecCmp1Inv, oneIntVector ); vecCmp2Inv = vec_and( vecCmp2Inv, oneIntVector ); @@ -6743,24 +6743,24 @@ void VPCALL idSIMD_AltiVec::OverlayPointCull( byte *cullBits, idVec2 *texCoords, vector unsigned int vecResult2; vector unsigned int vecResult3; vecResult = vec_add( vecBitShifted1, vec_sld( vecBitShifted1, vecBitShifted1, 4 ) ); - + vecResult2 = vec_add( vecBitShifted2, vec_sld( vecBitShifted2, vecBitShifted2, 4 ) ); - + // vecResult now holds the values without the inverses yet, so add those - vecResult = vec_perm( vecResult, vecResult2, vecPermFirstThird ); + vecResult = vec_perm( vecResult, vecResult2, vecPermFirstThird ); vecResult2 = vec_add( vecBitShifted1Inv, vec_sld( vecBitShifted1Inv, vecBitShifted1Inv, 4 ) ); vecResult3 = vec_add( vecBitShifted2Inv, vec_sld( vecBitShifted2Inv, vecBitShifted2Inv, 4 ) ); vecResult2 = vec_perm( vecResult2, vecResult3, vecPermFirstThird ); - + vecResult = vec_add( vecResult, vecResult2 ); - + //store out results vecResult = vec_perm( vecResult, vecResult, cullBitPerm ); vec_ste( vecResult, 0, &cullBitVal[0] ); vec_ste( vecResult, 4, &cullBitVal[0] ); vec_ste( vecResult, 8, &cullBitVal[0] ); vec_ste( vecResult, 12, &cullBitVal[0] ); - + cullBits[i] = cullBitVal[0]; cullBits[i+1] = cullBitVal[1]; cullBits[i+2] = cullBitVal[2]; @@ -6772,21 +6772,21 @@ void VPCALL idSIMD_AltiVec::OverlayPointCull( byte *cullBits, idVec2 *texCoords, byte bits; float d0, d1; float vx, vy, vz; - + vx = *( vertPtr + (i*DRAWVERT_OFFSET) + 0 ); vy = *( vertPtr + (i*DRAWVERT_OFFSET) + 1 ); vz = *( vertPtr + (i*DRAWVERT_OFFSET) + 2 ); - + d0 = p0x * vx + p0y * vy + p0z * vz + p0d; d1 = p1x * vx + p1y * vy + p1z * vz + p1d; texCoords[i][0] = d0; texCoords[i][1] = d1; - + bits = ( d0 >= 0 ) ? 0 : 1; d0 = 1.0f - d0; - bits |= ( d1 >= 0 ) ? 0 : 1*2; + bits |= ( d1 >= 0 ) ? 0 : 1*2; d1 = 1.0f - d1; - + bits |= ( d0 >= 0 ) ? 0: 1*4; bits |= ( d1 >= 0 ) ? 0: 1*8; @@ -6830,11 +6830,11 @@ void VPCALL idSIMD_AltiVec::DeriveTriPlanes( idPlane *planes, const idDrawVert * vector float zeroVector = (vector float)(0); vector float vecNegOne = (vector float)(-1); vector float vecSecondHalf, vecFirstHalf, vecSecondHalf2, vecFirstHalf2, vecSecondHalf3, vecFirstHalf3, vecFirstHalf4, vecSecondHalf4; - + vector unsigned char vecPermA, vecPermA2, vecPermA3, vecPermA4; vector unsigned char vecPermB, vecPermB2, vecPermB3, vecPermB4; vector unsigned char vecPermC, vecPermC2, vecPermC3, vecPermC4; - + vector unsigned char oneVector = (vector unsigned char)(1); vector float vecLd1, vecLd2, vecLd3, vecLd4, vecLd5, vecLd6; vector unsigned char vecPermZeroLast = (vector unsigned char)(0,1,2,3,4,5,6,7,8,9,10,11,16,17,18,19); @@ -6842,36 +6842,36 @@ void VPCALL idSIMD_AltiVec::DeriveTriPlanes( idPlane *planes, const idDrawVert * const float *xyzPtr = verts[0].xyz.ToFloatPtr(); float *planePtr = planes[0].ToFloatPtr(); - int j; + int j; for ( j = 0, i = 0; i+11 < numIndexes; i += 12, j += 4 ) { -#ifndef DRAWVERT_PADDED +#ifndef DRAWVERT_PADDED // calculate permute vectors to load as needed. these are all // triangle indexes and are usaully pretty close together but // not guaranteed to be in any particular order vecPermA = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+0] * DRAWVERT_OFFSET ) ), oneVector ); vecPermB = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+1] * DRAWVERT_OFFSET ) ), oneVector ); - vecPermC = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+2] * DRAWVERT_OFFSET ) ), oneVector ); + vecPermC = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+2] * DRAWVERT_OFFSET ) ), oneVector ); vecPermA2 = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+3] * DRAWVERT_OFFSET ) ), oneVector ); vecPermB2 = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+4] * DRAWVERT_OFFSET ) ), oneVector ); - vecPermC2 = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+5] * DRAWVERT_OFFSET ) ), oneVector ); + vecPermC2 = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+5] * DRAWVERT_OFFSET ) ), oneVector ); vecPermA3 = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+6] * DRAWVERT_OFFSET ) ), oneVector ); vecPermB3 = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+7] * DRAWVERT_OFFSET ) ), oneVector ); - vecPermC3 = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+8] * DRAWVERT_OFFSET ) ), oneVector ); + vecPermC3 = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+8] * DRAWVERT_OFFSET ) ), oneVector ); vecPermA4 = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+9] * DRAWVERT_OFFSET ) ), oneVector ); vecPermB4 = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+10] * DRAWVERT_OFFSET ) ), oneVector ); - vecPermC4 = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+11] * DRAWVERT_OFFSET ) ), oneVector ); + vecPermC4 = vec_add( vec_lvsl( -1, xyzPtr + ( indexes[i+11] * DRAWVERT_OFFSET ) ), oneVector ); #endif -#ifndef DRAWVERT_PADDED - // load first A B C +#ifndef DRAWVERT_PADDED + // load first A B C vecLd1 = vec_ld( 0, xyzPtr + ( indexes[i+0] * DRAWVERT_OFFSET ) ); vecLd2 = vec_ld( 15, xyzPtr + ( indexes[i+0] * DRAWVERT_OFFSET ) ); vecLd3 = vec_ld( 0, xyzPtr + ( indexes[i+1] * DRAWVERT_OFFSET ) ); vecLd4 = vec_ld( 15, xyzPtr + ( indexes[i+1] * DRAWVERT_OFFSET ) ); vecLd5 = vec_ld( 0, xyzPtr + ( indexes[i+2] * DRAWVERT_OFFSET ) ); vecLd6 = vec_ld( 15, xyzPtr + ( indexes[i+2] * DRAWVERT_OFFSET ) ); - + vecVertA = vec_perm( vecLd1, vecLd2, vecPermA ); vecVertB = vec_perm( vecLd3, vecLd4, vecPermB ); vecVertC = vec_perm( vecLd5, vecLd6, vecPermC ); @@ -6880,7 +6880,7 @@ void VPCALL idSIMD_AltiVec::DeriveTriPlanes( idPlane *planes, const idDrawVert * vecVertA = vec_perm( vecVertA, zeroVector, vecPermZeroLast ); vecVertB = vec_perm( vecVertB, zeroVector, vecPermZeroLast ); vecVertC = vec_perm( vecVertC, zeroVector, vecPermZeroLast ); - + // load second A B C vecLd1 = vec_ld( 0, xyzPtr + ( indexes[i+3] * DRAWVERT_OFFSET ) ); vecLd2 = vec_ld( 15, xyzPtr + ( indexes[i+3] * DRAWVERT_OFFSET ) ); @@ -6888,7 +6888,7 @@ void VPCALL idSIMD_AltiVec::DeriveTriPlanes( idPlane *planes, const idDrawVert * vecLd4 = vec_ld( 15, xyzPtr + ( indexes[i+4] * DRAWVERT_OFFSET ) ); vecLd5 = vec_ld( 0, xyzPtr + ( indexes[i+5] * DRAWVERT_OFFSET ) ); vecLd6 = vec_ld( 15, xyzPtr + ( indexes[i+5] * DRAWVERT_OFFSET ) ); - + vecVertA2 = vec_perm( vecLd1, vecLd2, vecPermA2 ); vecVertB2 = vec_perm( vecLd3, vecLd4, vecPermB2 ); vecVertC2 = vec_perm( vecLd5, vecLd6, vecPermC2 ); @@ -6905,7 +6905,7 @@ void VPCALL idSIMD_AltiVec::DeriveTriPlanes( idPlane *planes, const idDrawVert * vecLd4 = vec_ld( 15, xyzPtr + ( indexes[i+7] * DRAWVERT_OFFSET ) ); vecLd5 = vec_ld( 0, xyzPtr + ( indexes[i+8] * DRAWVERT_OFFSET ) ); vecLd6 = vec_ld( 15, xyzPtr + ( indexes[i+8] * DRAWVERT_OFFSET ) ); - + vecVertA3 = vec_perm( vecLd1, vecLd2, vecPermA3 ); vecVertB3 = vec_perm( vecLd3, vecLd4, vecPermB3 ); vecVertC3 = vec_perm( vecLd5, vecLd6, vecPermC3 ); @@ -6922,7 +6922,7 @@ void VPCALL idSIMD_AltiVec::DeriveTriPlanes( idPlane *planes, const idDrawVert * vecLd4 = vec_ld( 15, xyzPtr + ( indexes[i+10] * DRAWVERT_OFFSET ) ); vecLd5 = vec_ld( 0, xyzPtr + ( indexes[i+11] * DRAWVERT_OFFSET ) ); vecLd6 = vec_ld( 15, xyzPtr + ( indexes[i+11] * DRAWVERT_OFFSET ) ); - + vecVertA4 = vec_perm( vecLd1, vecLd2, vecPermA4 ); vecVertB4 = vec_perm( vecLd3, vecLd4, vecPermB4 ); vecVertC4 = vec_perm( vecLd5, vecLd6, vecPermC4 ); @@ -6932,7 +6932,7 @@ void VPCALL idSIMD_AltiVec::DeriveTriPlanes( idPlane *planes, const idDrawVert * vecVertB4 = vec_perm( vecVertB4, zeroVector, vecPermZeroLast ); vecVertC4 = vec_perm( vecVertC4, zeroVector, vecPermZeroLast ); #else - // load first A B C + // load first A B C vecVertA = vec_ld( 0, xyzPtr + ( indexes[i+0] * DRAWVERT_OFFSET ) ); vecVertB = vec_ld( 0, xyzPtr + ( indexes[i+1] * DRAWVERT_OFFSET ) ); vecVertC = vec_ld( 0, xyzPtr + ( indexes[i+2] * DRAWVERT_OFFSET ) ); @@ -6941,12 +6941,12 @@ void VPCALL idSIMD_AltiVec::DeriveTriPlanes( idPlane *planes, const idDrawVert * vecVertA = vec_perm( vecVertA, zeroVector, vecPermZeroLast ); vecVertB = vec_perm( vecVertB, zeroVector, vecPermZeroLast ); vecVertC = vec_perm( vecVertC, zeroVector, vecPermZeroLast ); - + // load second A B C vecVertA2 = vec_ld( 0, xyzPtr + ( indexes[i+3] * DRAWVERT_OFFSET ) ); vecVertB2 = vec_ld( 0, xyzPtr + ( indexes[i+4] * DRAWVERT_OFFSET ) ); vecVertC2 = vec_ld( 0, xyzPtr + ( indexes[i+5] * DRAWVERT_OFFSET ) ); - + // set the last element to 0 vecVertA2 = vec_perm( vecVertA2, zeroVector, vecPermZeroLast ); vecVertB2 = vec_perm( vecVertB2, zeroVector, vecPermZeroLast ); @@ -6966,7 +6966,7 @@ void VPCALL idSIMD_AltiVec::DeriveTriPlanes( idPlane *planes, const idDrawVert * vecVertA4 = vec_ld( 0, xyzPtr + ( indexes[i+9] * DRAWVERT_OFFSET ) ); vecVertB4 = vec_ld( 0, xyzPtr + ( indexes[i+10] * DRAWVERT_OFFSET ) ); vecVertC4 = vec_ld( 0, xyzPtr + ( indexes[i+11] * DRAWVERT_OFFSET ) ); - + // set the last element to 0 vecVertA4 = vec_perm( vecVertA4, zeroVector, vecPermZeroLast ); vecVertB4 = vec_perm( vecVertB4, zeroVector, vecPermZeroLast ); @@ -6975,13 +6975,13 @@ void VPCALL idSIMD_AltiVec::DeriveTriPlanes( idPlane *planes, const idDrawVert * // calculate d0 and d1 for each vecD0 = vec_sub( vecVertB, vecVertA ); vecD1 = vec_sub( vecVertC, vecVertA ); - + vecD2 = vec_sub( vecVertB2, vecVertA2 ); vecD3 = vec_sub( vecVertC2, vecVertA2 ); - + vecD4 = vec_sub( vecVertB3, vecVertA3 ); vecD5 = vec_sub( vecVertC3, vecVertA3 ); - + vecD6 = vec_sub( vecVertB4, vecVertA4 ); vecD7 = vec_sub( vecVertC4, vecVertA4 ); @@ -6993,12 +6993,12 @@ void VPCALL idSIMD_AltiVec::DeriveTriPlanes( idPlane *planes, const idDrawVert * vecWork6 = vec_perm( vecD5, vecD5, vecPerm2 ); vecWork7 = vec_perm( vecD6, vecD6, vecPerm1 ); vecWork8 = vec_perm( vecD7, vecD7, vecPerm2 ); - + vecSecondHalf = vec_madd( vecWork1, vecWork2, zeroVector ); vecSecondHalf2 = vec_madd( vecWork3, vecWork4, zeroVector ); vecSecondHalf3 = vec_madd( vecWork5, vecWork6, zeroVector ); vecSecondHalf4 = vec_madd( vecWork7, vecWork8, zeroVector ); - + vecWork1 = vec_perm( vecD1, vecD1, vecPerm1 ); vecWork2 = vec_perm( vecD0, vecD0, vecPerm2 ); vecWork3 = vec_perm( vecD3, vecD3, vecPerm1 ); @@ -7007,24 +7007,24 @@ void VPCALL idSIMD_AltiVec::DeriveTriPlanes( idPlane *planes, const idDrawVert * vecWork6 = vec_perm( vecD4, vecD4, vecPerm2 ); vecWork7 = vec_perm( vecD7, vecD7, vecPerm1 ); vecWork8 = vec_perm( vecD6, vecD6, vecPerm2 ); - + vecFirstHalf = vec_madd( vecWork1, vecWork2, zeroVector ); vecFirstHalf2 = vec_madd( vecWork3, vecWork4, zeroVector ); vecFirstHalf3 = vec_madd( vecWork5, vecWork6, zeroVector ); vecFirstHalf4 = vec_madd( vecWork7, vecWork8, zeroVector ); - + vecN = vec_madd( vecSecondHalf, vecNegOne, vecFirstHalf ); vecN2 = vec_madd( vecSecondHalf2, vecNegOne, vecFirstHalf2 ); vecN3 = vec_madd( vecSecondHalf3, vecNegOne, vecFirstHalf3 ); vecN4 = vec_madd( vecSecondHalf4, vecNegOne, vecFirstHalf4 ); - + // transpose vecNs vector float v0, v1, v2, v3; v0 = vec_mergeh( vecN, vecN3 ); v1 = vec_mergeh( vecN2, vecN4 ); v2 = vec_mergel( vecN, vecN3 ); v3 = vec_mergel( vecN2, vecN4 ); - + vecN = vec_mergeh( v0, v1 ); vecN2 = vec_mergel( v0, v1 ); vecN3 = vec_mergeh( v2, v3 ); @@ -7033,9 +7033,9 @@ void VPCALL idSIMD_AltiVec::DeriveTriPlanes( idPlane *planes, const idDrawVert * vecF = vec_madd( vecN, vecN, zeroVector ); vecF = vec_madd( vecN2, vecN2, vecF ); vecF = vec_madd( vecN3, vecN3, vecF ); - + vecF = ReciprocalSquareRoot( vecF ); - + vecF1 = vec_madd( vecF, vecN, zeroVector ); vecF2 = vec_madd( vecF, vecN2, zeroVector ); vecF3 = vec_madd( vecF, vecN3, zeroVector ); @@ -7052,25 +7052,25 @@ void VPCALL idSIMD_AltiVec::DeriveTriPlanes( idPlane *planes, const idDrawVert * v1 = vec_mergeh( vecVertA2, vecVertA4 ); v2 = vec_mergel( vecVertA, vecVertA3 ); v3 = vec_mergel( vecVertA2, vecVertA4 ); - + vecVertA = vec_mergeh( v0, v1 ); vecVertA2 = vec_mergel( v0, v1 ); vecVertA3 = vec_mergeh( v2, v3 ); vecVertA4 = vec_mergel( v2, v3 ); - + vector float vecTotals; vecTotals = vec_madd( vecVertA, v8, zeroVector ); vecTotals = vec_madd( vecVertA2, v9, vecTotals ); vecTotals = vec_madd( vecVertA3, v10, vecTotals ); vecTotals = vec_madd( vecVertA4, v11, vecTotals ); vecF = vec_madd( vecTotals, vecNegOne, zeroVector ); - + // transpose vecFs v0 = vec_mergeh( vecF1, vecF3 ); v1 = vec_mergeh( vecF2, vecF ); v2 = vec_mergel( vecF1, vecF3 ); v3 = vec_mergel( vecF2, vecF ); - + vecF1 = vec_mergeh( v0, v1 ); vecF2 = vec_mergel( v0, v1 ); vecF3 = vec_mergeh( v2, v3 ); @@ -7111,7 +7111,7 @@ void VPCALL idSIMD_AltiVec::DeriveTriPlanes( idPlane *planes, const idDrawVert * planes[j].SetNormal( n ); planes[j].FitThroughPoint( a->xyz ); - } + } } /* @@ -7130,7 +7130,7 @@ void VPCALL idSIMD_AltiVec::DeriveTangents( idPlane *planes, idDrawVert *verts, bool *used = (bool *)_alloca16( numVerts * sizeof( used[0] ) ); memset( used, 0, numVerts * sizeof( used[0] ) ); - + idPlane *planesPtr = planes; for ( i = 0; i < numIndexes; i += 3 ) { idDrawVert *a, *b, *c; @@ -7165,7 +7165,7 @@ void VPCALL idSIMD_AltiVec::DeriveTangents( idPlane *planes, idDrawVert *verts, n[2] = d1[0] * d0[1] - d1[1] * d0[0]; f1 = n.x * n.x + n.y * n.y + n.z * n.z; - + // area sign bit area = d0[3] * d1[4] - d0[4] * d1[3]; @@ -7173,7 +7173,7 @@ void VPCALL idSIMD_AltiVec::DeriveTangents( idPlane *planes, idDrawVert *verts, t0[0] = d0[0] * d1[4] - d0[4] * d1[0]; t0[1] = d0[1] * d1[4] - d0[4] * d1[1]; t0[2] = d0[2] * d1[4] - d0[4] * d1[2]; - + f2 = t0.x * t0.x + t0.y * t0.y + t0.z * t0.z; // second tangent @@ -7185,7 +7185,7 @@ void VPCALL idSIMD_AltiVec::DeriveTangents( idPlane *planes, idDrawVert *verts, // Behold! The power of the pipeline FastScalarInvSqrt_x3( &f1, &f2, &f3 ); -#ifdef PPC_INTRINSICS +#ifdef PPC_INTRINSICS f2 = __fsel( area, f2, -f2 ); f3 = __fsel( area, f3, -f3 ); #else @@ -7195,7 +7195,7 @@ void VPCALL idSIMD_AltiVec::DeriveTangents( idPlane *planes, idDrawVert *verts, t0.x *= f2; t0.y *= f2; t0.z *= f2; - + n.x *= f1; n.y *= f1; n.z *= f1; @@ -7262,7 +7262,7 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d assert( sizeof(idDrawVert) == DRAWVERT_OFFSET * sizeof(float) ); // drawverts aligned assert( IS_16BYTE_ALIGNED( verts[0] ) ); - + vector float vecVertA, vecVertB, vecVertC; vector float vecVertA2, vecVertB2, vecVertC2; vector float vecVertA3, vecVertB3, vecVertC3; @@ -7273,21 +7273,21 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d vector float vecS0_2, vecS1_2, vecS2_2; vector float vecS0_3, vecS1_3, vecS2_3; vector float vecS0_4, vecS1_4, vecS2_4; - + vector float vecD1, vecD2, vecD3, vecD4, vecD5, vecD6; vector float vecD7, vecD8, vecD9, vecD10, vecD11, vecD12; vector float vecT1, vecT1_2, vecT1_3, vecT1_4, vecT2, vecT2_2, vecT2_3, vecT2_4; vector float vecWork1, vecWork2, vecWork3, vecWork4, vecWork5, vecWork6, vecWork7, vecWork8; vector float vecN, vecN2, vecN3, vecN4; - + vector unsigned char vecPermN0 = (vector unsigned char)(8,9,10,11,0,1,2,3,4,5,6,7,12,13,14,15); vector unsigned char vecPermN1 = (vector unsigned char)(4,5,6,7,8,9,10,11,0,1,2,3,12,13,14,15); vector unsigned char vecPermT0 = (vector unsigned char)(0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3); vector unsigned char vecPermT1 = (vector unsigned char)(8,9,10,11,8,9,10,11,8,9,10,11,8,9,10,11); vector float zeroVector = (vector float)(0); - + vector float vecNegOne = (vector float)(-1.0); - + vector float vecStore1, vecStore2, vecStore3; vector unsigned char vecPermFirstThreeLast = (vector unsigned char)(0,1,2,3,4,5,6,7,8,9,10,11,16,17,18,19); vector unsigned char vecPermStoreSecond = (vector unsigned char)(4,5,6,7,8,9,10,11,16,17,18,19,20,21,22,23); @@ -7296,22 +7296,22 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d vector unsigned char vecPermStore3 = (vector unsigned char)(4,5,6,7,8,9,10,11,16,17,18,19,20,21,22,23); vector unsigned char vecPermStore4 = (vector unsigned char)(8,9,10,11,16,17,18,19,20,21,22,23,24,25,26,27); vector unsigned char vecPermHalves = (vector unsigned char)(0,1,2,3,4,5,6,7,16,17,18,19,20,21,22,23); - + vector float vecLd1, vecLd2, vecLd3; vector unsigned char vecPerm0, vecPerm1, vecPerm2, vecPerm3, vecPerm4; - + float *normalPtr = verts[0].normal.ToFloatPtr(); - float *xyzPtr = verts[0].xyz.ToFloatPtr(); + float *xyzPtr = verts[0].xyz.ToFloatPtr(); vector float vecFirstHalf, vecSecondHalf; vector float vecFirstHalf2, vecSecondHalf2; vector float vecFirstHalf3, vecSecondHalf3; vector float vecFirstHalf4, vecSecondHalf4; - + for ( i = 0; i+3 < numVerts; i+=4 ) { int bOffset1, bOffset2, bOffset3, bOffset4; int cOffset1, cOffset2, cOffset3, cOffset4; - + bOffset1 = dominantTris[i].v2; cOffset1 = dominantTris[i].v3; bOffset2 = dominantTris[i+1].v2; @@ -7320,7 +7320,7 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d cOffset3 = dominantTris[i+2].v3; bOffset4 = dominantTris[i+3].v2; cOffset4 = dominantTris[i+3].v3; - + vecPerm0 = vec_lvsl( 0, xyzPtr + ( i * DRAWVERT_OFFSET ) ); v0 = vec_ld( 0, xyzPtr + (i * DRAWVERT_OFFSET ) ); v1 = vec_ld( 16, xyzPtr + (i * DRAWVERT_OFFSET ) ); @@ -7330,7 +7330,7 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d v2 = vec_ld( 0, xyzPtr + ( bOffset1 * DRAWVERT_OFFSET ) ); v3 = vec_ld( 16, xyzPtr + ( bOffset1 * DRAWVERT_OFFSET ) ); vecVertB = vec_perm( v2, v3, vecPerm1 ); - + vecPerm2 = vec_lvsl( 0, xyzPtr + ( cOffset1 * DRAWVERT_OFFSET ) ); v4 = vec_ld( 0, xyzPtr + ( cOffset1 * DRAWVERT_OFFSET ) ); v5 = vec_ld( 16, xyzPtr + ( cOffset1 * DRAWVERT_OFFSET ) ); @@ -7340,23 +7340,23 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d v1 = vec_perm( v1, v1, vecPerm0 ); v3 = vec_perm( v3, v3, vecPerm1 ); v5 = vec_perm( v5, v5, vecPerm2 ); - + v1 = vec_mergeh( v1, v5 ); v2 = vec_mergeh( v3, zeroVector ); v2 = vec_mergeh( v1, v2 ); v2 = vec_perm( v2, v2, (vector unsigned char)(4,5,6,7,0,1,2,3,8,9,10,11,0,1,2,3) ); - + // load second one vecPerm0 = vec_lvsl( 0, xyzPtr + ((i+1) * DRAWVERT_OFFSET ) ); v0 = vec_ld( 0, xyzPtr + ((i+1) * DRAWVERT_OFFSET ) ); v1 = vec_ld( 16, xyzPtr + ((i+1) * DRAWVERT_OFFSET ) ); - vecVertA2 = vec_perm( v0, v1, vecPerm0 ); - + vecVertA2 = vec_perm( v0, v1, vecPerm0 ); + vecPerm3 = vec_lvsl( 0, xyzPtr + (bOffset2 * DRAWVERT_OFFSET ) ); v3 = vec_ld( 0, xyzPtr + ( bOffset2 * DRAWVERT_OFFSET ) ); v4 = vec_ld( 16, xyzPtr + ( bOffset2 * DRAWVERT_OFFSET ) ); vecVertB2 = vec_perm( v3, v4, vecPerm3 ); - + vecPerm4 = vec_lvsl( 0, xyzPtr + ( cOffset2 * DRAWVERT_OFFSET ) ); v5 = vec_ld( 0, xyzPtr + ( cOffset2 * DRAWVERT_OFFSET ) ); v6 = vec_ld( 16, xyzPtr + ( cOffset2 * DRAWVERT_OFFSET ) ); @@ -7366,7 +7366,7 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d v1 = vec_perm( v1, v1, vecPerm0 ); v4 = vec_perm( v4, v4, vecPerm3 ); v5 = vec_perm( v6, v6, vecPerm4 ); - + v1 = vec_mergeh( v1, v5 ); v3 = vec_mergeh( v4, zeroVector ); v3 = vec_mergeh( v1, v3 ); @@ -7377,38 +7377,38 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d v0 = vec_ld( 0, xyzPtr + ((i+2) * DRAWVERT_OFFSET ) ); v1 = vec_ld( 16, xyzPtr + ((i+2) * DRAWVERT_OFFSET ) ); vecVertA3 = vec_perm( v0, v1, vecPerm0 ); - + vecPerm1 = vec_lvsl( 0, xyzPtr + (bOffset3 * DRAWVERT_OFFSET ) ); v4 = vec_ld( 0, xyzPtr + ( bOffset3 * DRAWVERT_OFFSET ) ); v5 = vec_ld( 16, xyzPtr + ( bOffset3 * DRAWVERT_OFFSET ) ); vecVertB3 = vec_perm( v4, v5, vecPerm1 ); - + vecPerm2 = vec_lvsl( 0, xyzPtr + ( cOffset3 * DRAWVERT_OFFSET ) ); v6 = vec_ld( 0, xyzPtr + ( cOffset3 * DRAWVERT_OFFSET ) ); v7 = vec_ld( 16, xyzPtr + ( cOffset3 * DRAWVERT_OFFSET ) ); vecVertC3 = vec_perm( v6, v7, vecPerm2 ); - // put remainder into v4 + // put remainder into v4 v1 = vec_perm( v1, v1, vecPerm0 ); v5 = vec_perm( v5, v5, vecPerm1 ); v7 = vec_perm( v7, v7, vecPerm2 ); - + v1 = vec_mergeh( v1, v7 ); v4 = vec_mergeh( v5, zeroVector ); v4 = vec_mergeh( v1, v4 ); - v4 = vec_perm( v4, v4, (vector unsigned char)(4,5,6,7,0,1,2,3,8,9,10,11,0,1,2,3) ); - + v4 = vec_perm( v4, v4, (vector unsigned char)(4,5,6,7,0,1,2,3,8,9,10,11,0,1,2,3) ); + // load fourth one vecPerm0 = vec_lvsl( 0, xyzPtr + ((i+3) * DRAWVERT_OFFSET ) ); v0 = vec_ld( 0, xyzPtr + ((i+3) * DRAWVERT_OFFSET ) ); v1 = vec_ld( 16, xyzPtr + ((i+3) * DRAWVERT_OFFSET ) ); vecVertA4 = vec_perm( v0, v1, vecPerm0 ); - + vecPerm3 = vec_lvsl( 0, xyzPtr + (bOffset4 * DRAWVERT_OFFSET ) ); v5 = vec_ld( 0, xyzPtr + ( bOffset4 * DRAWVERT_OFFSET ) ); v6 = vec_ld( 16, xyzPtr + ( bOffset4 * DRAWVERT_OFFSET ) ); vecVertB4 = vec_perm( v5, v6, vecPerm3 ); - + vecPerm4 = vec_lvsl( 0, xyzPtr + ( cOffset4 * DRAWVERT_OFFSET ) ); v7 = vec_ld( 0, xyzPtr + ( cOffset4 * DRAWVERT_OFFSET ) ); v8 = vec_ld( 16, xyzPtr + ( cOffset4 * DRAWVERT_OFFSET ) ); @@ -7418,7 +7418,7 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d v1 = vec_perm( v1, v1, vecPerm0 ); v6 = vec_perm( v6, v6, vecPerm3 ); v8 = vec_perm( v8, v8, vecPerm4 ); - + v1 = vec_mergeh( v1, v8 ); v5 = vec_mergeh( v6, zeroVector ); v5 = vec_mergeh( v1, v5 ); @@ -7437,7 +7437,7 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d vecD5 = vec_sub( vecVertC2, vecVertA2 ); vecD8 = vec_sub( vecVertC3, vecVertA3 ); vecD11 = vec_sub( vecVertC4, vecVertA4 ); - + // vecD3 now holds d4, crap, d9, crap vecD3 = vec_sub( v2, vec_sld( v2, v2, 4 ) ); vecD6 = vec_sub( v3, vec_sld( v3, v3, 4 ) ); @@ -7464,11 +7464,11 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d v2 = vec_perm( v2, v3, vecPerm2 ); v4 = vec_perm( v4, v5, vecPerm3 ); v6 = vec_perm( v6, v7, vecPerm4 ); - + vecS0 = vec_splat( v0, 0 ); vecS1 = vec_splat( v0, 1 ); vecS2 = vec_splat( v0, 2 ); - + vecS0_2 = vec_splat( v2, 0); vecS1_2 = vec_splat( v2, 1 ); vecS2_2 = vec_splat( v2, 2 ); @@ -7476,12 +7476,12 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d vecS0_3 = vec_splat( v4, 0 ); vecS1_3 = vec_splat( v4, 1 ); vecS2_3 = vec_splat( v4, 2 ); - + vecS0_4 = vec_splat( v6, 0 ); vecS1_4 = vec_splat( v6, 1 ); vecS2_4 = vec_splat( v6, 2 ); - // do calculation + // do calculation vecWork1 = vec_perm( vecD2, vecD2, vecPermN1 ); vecWork2 = vec_perm( vecD1, vecD1, vecPermN0 ); vecWork3 = vec_perm( vecD5, vecD5, vecPermN1 ); @@ -7489,13 +7489,13 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d vecWork5 = vec_perm( vecD8, vecD8, vecPermN1 ); vecWork6 = vec_perm( vecD7, vecD7, vecPermN0 ); vecWork7 = vec_perm( vecD11, vecD11, vecPermN1 ); - vecWork8 = vec_perm( vecD10, vecD10, vecPermN0 ); - + vecWork8 = vec_perm( vecD10, vecD10, vecPermN0 ); + vecFirstHalf = vec_madd( vecWork1, vecWork2, zeroVector ); vecFirstHalf2 = vec_madd( vecWork3, vecWork4, zeroVector ); vecFirstHalf3 = vec_madd( vecWork5, vecWork6, zeroVector ); vecFirstHalf4 = vec_madd( vecWork7, vecWork8, zeroVector ); - + vecWork1 = vec_perm( vecD2, vecD2, vecPermN0 ); vecWork2 = vec_perm( vecD1, vecD1, vecPermN1 ); vecWork3 = vec_perm( vecD5, vecD5, vecPermN0 ); @@ -7504,19 +7504,19 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d vecWork6 = vec_perm( vecD7, vecD7, vecPermN1 ); vecWork7 = vec_perm( vecD11, vecD11, vecPermN0 ); vecWork8 = vec_perm( vecD10, vecD10, vecPermN1 ); - + vecSecondHalf = vec_nmsub( vecWork1, vecWork2, vecFirstHalf ); vecSecondHalf2 = vec_nmsub( vecWork3, vecWork4, vecFirstHalf2 ); vecSecondHalf3 = vec_nmsub( vecWork5, vecWork6, vecFirstHalf3 ); vecSecondHalf4 = vec_nmsub( vecWork7, vecWork8, vecFirstHalf4 ); - - + + // calculate N values vecN = vec_madd( vecS2, vecSecondHalf, zeroVector ); vecN2 = vec_madd( vecS2_2, vecSecondHalf2, zeroVector ); vecN3 = vec_madd( vecS2_3, vecSecondHalf3, zeroVector ); vecN4 = vec_madd( vecS2_4, vecSecondHalf4, zeroVector ); - + // calculate both halves of the calculation for t vecWork1 = vecD1; vecWork2 = vec_perm( vecD3, vecD3, vecPermT1 ); @@ -7526,12 +7526,12 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d vecWork6 = vec_perm( vecD9, vecD9, vecPermT1 ); vecWork7 = vecD10; vecWork8 = vec_perm( vecD12, vecD12, vecPermT1 ); - + vecFirstHalf = vec_madd( vecWork1, vecWork2, zeroVector ); vecFirstHalf2 = vec_madd( vecWork3, vecWork4, zeroVector ); vecFirstHalf3 = vec_madd( vecWork5, vecWork6, zeroVector ); vecFirstHalf4 = vec_madd( vecWork7, vecWork8, zeroVector ); - + vecWork1 = vecD2; vecWork2 = vec_perm( vecD3, vecD3, vecPermT0 ); vecWork3 = vecD5; @@ -7539,7 +7539,7 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d vecWork5 = vecD8; vecWork6 = vec_perm( vecD9, vecD9, vecPermT0 ); vecWork7 = vecD11; - vecWork8 = vec_perm( vecD12, vecD12, vecPermT0 ); + vecWork8 = vec_perm( vecD12, vecD12, vecPermT0 ); vecSecondHalf = vec_nmsub( vecWork1, vecWork2, vecFirstHalf ); vecSecondHalf2 = vec_nmsub( vecWork3, vecWork4, vecFirstHalf2 ); @@ -7566,7 +7566,7 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d vecSecondHalf2 = vec_madd( vecWork3, vecWork4, zeroVector ); vecSecondHalf3 = vec_madd( vecWork5, vecWork6, zeroVector ); vecSecondHalf4 = vec_madd( vecWork7, vecWork8, zeroVector ); - + vecWork1 = vec_perm( vecD1, vecD1, vecPermT2 ); vecWork2 = vecD2; vecWork3 = vec_perm( vecD4, vecD4, vecPermT2 ); @@ -7576,10 +7576,10 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d vecWork7 = vec_perm( vecD10, vecD10, vecPermT2 ); vecWork8 = vecD11; - vecFirstHalf = vec_madd( vecWork1, vecWork2, zeroVector ); - vecFirstHalf2 = vec_madd( vecWork3, vecWork4, zeroVector ); - vecFirstHalf3 = vec_madd( vecWork5, vecWork6, zeroVector ); - vecFirstHalf4 = vec_madd( vecWork7, vecWork8, zeroVector ); + vecFirstHalf = vec_madd( vecWork1, vecWork2, zeroVector ); + vecFirstHalf2 = vec_madd( vecWork3, vecWork4, zeroVector ); + vecFirstHalf3 = vec_madd( vecWork5, vecWork6, zeroVector ); + vecFirstHalf4 = vec_madd( vecWork7, vecWork8, zeroVector ); #else vecWork1 = vec_perm( vecN, vecN, vecPermN1 ); @@ -7595,7 +7595,7 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d vecSecondHalf2 = vec_madd( vecWork3, vecWork4, zeroVector ); vecSecondHalf3 = vec_madd( vecWork5, vecWork6, zeroVector ); vecSecondHalf4 = vec_madd( vecWork7, vecWork8, zeroVector ); - + vecWork1 = vec_perm( vecN, vecN, vecPermN0 ); vecWork2 = vec_perm( vecT1, vecT1, vecPermN1 ); vecWork3 = vec_perm( vecN2, vecN2, vecPermN0 ); @@ -7626,24 +7626,24 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d // read values that we need to preserve vecLd1 = vec_ld( 0, normalPtr + ( i * DRAWVERT_OFFSET ) ); vecLd2 = vec_ld( 32, normalPtr + ( i * DRAWVERT_OFFSET ) ); - + //generate vectors to store vecStore1 = vec_perm( vecLd1, vecN, vecPermLeadAndThree ); vecStore2 = vec_perm( vecT1, vecT2, vecPermFirstThreeLast ); vecStore3 = vec_perm( vecT2, vecLd2, vecPermStore2 ); - + // store out results ALIGNED_STORE3( normalPtr + ( i * DRAWVERT_OFFSET ), vecStore1, vecStore2, vecStore3 ); // read values that we need to preserve vecLd3 = vec_ld( 32, normalPtr + ( (i+1) * DRAWVERT_OFFSET )); - + // generate vectors to store vecStore1 = vec_perm( vecN2, vecT1_2, vecPermFirstThreeLast ); vecStore2 = vec_perm( vecT1_2, vecT2_2, vecPermStoreSecond ); vecStore3 = vec_perm( vecT2_2, vecLd3, (vector unsigned char)(8,9,10,11,20,21,22,23,24,25,26,27,28,29,30,31) ); - - // instead of doing permute, shift it where it needs to be and use vec_ste + + // instead of doing permute, shift it where it needs to be and use vec_ste // store out vectors ALIGNED_STORE3( normalPtr + ((i+1) * DRAWVERT_OFFSET), vecStore1, vecStore2, vecStore3 ); @@ -7654,21 +7654,21 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d vecStore1 = vec_perm( vecLd1, vecN3, vecPermFirstThreeLast ); vecStore2 = vec_perm( vecN3, vecT1_3, vecPermStore3 ); vecStore3 = vec_perm( vecT1_3, vecT2_3, vecPermStore4 ); - + // store out vectors ALIGNED_STORE3( normalPtr + ((i+2) * DRAWVERT_OFFSET), vecStore1, vecStore2, vecStore3 ); // read values that we need to preserve vecLd2 = vec_ld( 0, normalPtr + ((i+3) * DRAWVERT_OFFSET ) ); vecLd3 = vec_ld( 32, normalPtr + ((i+3) * DRAWVERT_OFFSET ) ); - + // generate vectors to store vecStore1 = vec_perm( vecLd2, vecN4, vecPermHalves ); vecStore2 = vec_perm( vecN4, vecT1_4, vecPermStore4 ); vecStore3 = vec_perm( vecT2_4, vecLd3, vecPermFirstThreeLast ); - + // store out vectors - ALIGNED_STORE3( normalPtr + ((i+3) * DRAWVERT_OFFSET ), vecStore1, vecStore2, vecStore3 ); + ALIGNED_STORE3( normalPtr + ((i+3) * DRAWVERT_OFFSET ), vecStore1, vecStore2, vecStore3 ); } // cleanup @@ -7686,19 +7686,19 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d a = verts + i; b = verts + dt.v2; c = verts + dt.v3; - + d0 = b->xyz[0] - a->xyz[0]; d1 = b->xyz[1] - a->xyz[1]; d2 = b->xyz[2] - a->xyz[2]; d3 = b->st[0] - a->st[0]; - + d4 = b->st[1] - a->st[1]; d5 = c->xyz[0] - a->xyz[0]; d6 = c->xyz[1] - a->xyz[1]; d7 = c->xyz[2] - a->xyz[2]; d8 = c->st[0] - a->st[0]; - + d9 = c->st[1] - a->st[1]; s0 = dt.normalizationScale[0]; @@ -7750,7 +7750,7 @@ idSIMD_AltiVec::DeriveUnsmoothedTangents void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const dominantTri_s *dominantTris, const int numVerts ) { int i; - + for ( i = 0; i < numVerts; i++ ) { idDrawVert *a, *b, *c; float d0, d1, d2, d3, d4; @@ -7765,19 +7765,19 @@ void VPCALL idSIMD_AltiVec::DeriveUnsmoothedTangents( idDrawVert *verts, const d a = verts + i; b = verts + dt.v2; c = verts + dt.v3; - + d0 = b->xyz[0] - a->xyz[0]; d1 = b->xyz[1] - a->xyz[1]; d2 = b->xyz[2] - a->xyz[2]; d3 = b->st[0] - a->st[0]; - + d4 = b->st[1] - a->st[1]; d5 = c->xyz[0] - a->xyz[0]; d6 = c->xyz[1] - a->xyz[1]; d7 = c->xyz[2] - a->xyz[2]; d8 = c->st[0] - a->st[0]; - + d9 = c->st[1] - a->st[1]; s0 = dt.normalizationScale[0]; @@ -7838,15 +7838,15 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV // as much hit for unaligned stores vector float v0, v1, v2, v3; // v5 through v8 are the "working" values of the vectors - vector float v5, v6, v7, v8; + vector float v5, v6, v7, v8; // working values vector float vec1T0, vec1T1, vec2T0, vec2T1, vec3T0, vec3T1, vec4T0, vec4T1; vector float vecSum, vecTSum1, vecTSum2, tempSum, tempSum2, tempSum3; vector float vecF, vecF2; vector float vecTemp, vecTemp2, vecTemp3, vecTemp4; - + register vector float zeroVector = (vector float)(0.0); - + vector unsigned char vecPermHalves = (vector unsigned char)(0,1,2,3,4,5,6,7,16,17,18,19,20,21,22,23); vector unsigned char vecPermLast = (vector unsigned char)(0,1,2,3,4,5,6,7,8,9,10,11,16,17,18,19); vector unsigned char vecPermSplatFirstWithZero = (vector unsigned char)(0,1,2,3,0,1,2,3,0,1,2,3,16,17,18,19); @@ -7855,20 +7855,20 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV vector float vecTan11, vecTan12, vecTan13, vecTan21, vecTan22, vecTan23; vector float vecTan31, vecTan32, vecTan33, vecTan41, vecTan42, vecTan43; - + vector unsigned char vec1T0Perm, vec1T1Perm, vec2T0Perm, vec2T1Perm, vec3T0Perm, vec3T1Perm, vec4T0Perm, vec4T1Perm; vector unsigned char storeT11, storeT12, storeT21, storeT22, storeT31, storeT32; vector unsigned char storeT41, storeT42; - - int i = 0; - + + int i = 0; + if ( i+3 < numVerts ) { // for loading normal from idDrawVert vecPerm0 = vec_add( vec_lvsl( -1, addr ), (vector unsigned char)(1) ); vecPerm1 = vec_add( vec_lvsl( -1, addr + ( 1 * DRAWVERT_OFFSET ) ), (vector unsigned char)(1) ); vecPerm2 = vec_add( vec_lvsl( -1, addr + ( 2 * DRAWVERT_OFFSET ) ), (vector unsigned char)(1) ); vecPerm3 = vec_add( vec_lvsl( -1, addr + ( 3 * DRAWVERT_OFFSET ) ), (vector unsigned char)(1) ); - + // for loading tangents from idDrawVert vec1T0Perm = vec_add( vec_lvsl( -1, tAddr + ( 0 * DRAWVERT_OFFSET ) ), (vector unsigned char)(1) ); vec1T1Perm = vec_add( vec_lvsl( -1, tAddr + ( 0 * DRAWVERT_OFFSET ) + 3 ), (vector unsigned char)(1) ); @@ -7877,8 +7877,8 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV vec3T0Perm = vec_add( vec_lvsl( -1, tAddr + ( 2 * DRAWVERT_OFFSET ) ), (vector unsigned char)(1) ); vec3T1Perm = vec_add( vec_lvsl( -1, tAddr + ( 2 * DRAWVERT_OFFSET ) + 3 ), (vector unsigned char)(1) ); vec4T0Perm = vec_add( vec_lvsl( -1, tAddr + ( 3 * DRAWVERT_OFFSET ) ), (vector unsigned char)(1) ); - vec4T1Perm = vec_add( vec_lvsl( -1, tAddr + ( 3 * DRAWVERT_OFFSET ) + 3 ), (vector unsigned char)(1) ); - + vec4T1Perm = vec_add( vec_lvsl( -1, tAddr + ( 3 * DRAWVERT_OFFSET ) + 3 ), (vector unsigned char)(1) ); + // generate permute vectors to store normals storePerm0 = vec_lvsr( 0, addr ); storePerm1 = vec_lvsr( 0, addr + ( 1 * DRAWVERT_OFFSET ) ); @@ -7891,33 +7891,33 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV storeT21 = vec_lvsr( 0, tAddr + ( 1 * DRAWVERT_OFFSET ) ); storeT22 = vec_lvsr( 12, tAddr + ( 1 * DRAWVERT_OFFSET ) ); - + storeT31 = vec_lvsr( 0, tAddr + ( 2 * DRAWVERT_OFFSET ) ); storeT32 = vec_lvsr( 12, tAddr + ( 2 * DRAWVERT_OFFSET ) ); - + storeT41 = vec_lvsr( 0, tAddr + ( 3 * DRAWVERT_OFFSET ) ); storeT42 = vec_lvsr( 12, tAddr + ( 3 * DRAWVERT_OFFSET ) ); } - + for ( ; i+3 < numVerts; i+=4 ) { - + // load normals vector float vecNormal11 = vec_ld( 0, addr + ( i * DRAWVERT_OFFSET ) ); - vector float vecNormal12 = vec_ld( 15, addr + ( i * DRAWVERT_OFFSET ) ); + vector float vecNormal12 = vec_ld( 15, addr + ( i * DRAWVERT_OFFSET ) ); v0 = vec_perm( vecNormal11, vecNormal12, vecPerm0 ); - + vector float vecNormal21 = vec_ld( 0, addr + ((i+1) * DRAWVERT_OFFSET ) ); vector float vecNormal22 = vec_ld( 15, addr + ((i+1) * DRAWVERT_OFFSET ) ); v1 = vec_perm( vecNormal21, vecNormal22, vecPerm1 ); - + vector float vecNormal31 = vec_ld( 0, addr + ( (i+2) * DRAWVERT_OFFSET ) ); - vector float vecNormal32 = vec_ld( 15, addr + ( (i+2) * DRAWVERT_OFFSET ) ); + vector float vecNormal32 = vec_ld( 15, addr + ( (i+2) * DRAWVERT_OFFSET ) ); v2 = vec_perm( vecNormal31, vecNormal32, vecPerm2 ); - + vector float vecNormal41 = vec_ld( 0, addr + ((i+3) * DRAWVERT_OFFSET ) ); vector float vecNormal42 = vec_ld( 15, addr + ((i+3) * DRAWVERT_OFFSET ) ); v3 = vec_perm( vecNormal41, vecNormal42, vecPerm3 ); - + // zero out the last element of each useless vector v0 = vec_perm( v0, zeroVector, vecPermLast ); v1 = vec_perm( v1, zeroVector, vecPermLast ); @@ -7927,23 +7927,23 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV // got 4 vectors in v0 through v3, sum them each accross // and put into one vector vecTemp = vec_madd( v0, v0, zeroVector ); - + vecSum = vec_add( vecTemp, vec_sld( vecTemp, vecTemp, 8 ) ); vecSum = vec_add( vecSum, vec_sld( vecSum, vecSum, 4 ) ); // element 0 of vecSum now has sum of v0 - + vecTemp2 = vec_madd( v1, v1, zeroVector ); tempSum = vec_add( vecTemp2, vec_sld( vecTemp2, vecTemp2, 8 ) ); tempSum = vec_add( tempSum, vec_sld( tempSum, tempSum, 4 ) ); // put this into vecSum vecSum = vec_mergeh( vecSum, tempSum ); - + vecTemp3 = vec_madd( v2, v2, zeroVector ); tempSum = vec_add( vecTemp3, vec_sld( vecTemp3, vecTemp3, 8 ) ); - tempSum = vec_add( tempSum, vec_sld( tempSum, tempSum, 4 ) ); + tempSum = vec_add( tempSum, vec_sld( tempSum, tempSum, 4 ) ); // put this into vecSum vecSum = vec_perm( vecSum, tempSum, vecPermHalves ); - + vecTemp4 = vec_madd( v3, v3, zeroVector ); tempSum = vec_add( vecTemp4, vec_sld( vecTemp4, vecTemp4, 8 ) ); tempSum = vec_add( tempSum, vec_sld( tempSum, tempSum, 4 ) ); @@ -7952,7 +7952,7 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV // take reciprocal square roots of these vecF = ReciprocalSquareRoot( vecSum ); - + // multiply each vector by f v5 = vec_madd( v0, vec_splat( vecF, 0 ), zeroVector ); v6 = vec_madd( v1, vec_splat( vecF, 1 ), zeroVector ); @@ -7967,11 +7967,11 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV vecTan21 = vec_ld( 0, tAddr + ( (i+1) * DRAWVERT_OFFSET ) ); vecTan22 = vec_ld( 11, tAddr + ( (i+1) * DRAWVERT_OFFSET ) ); vecTan23 = vec_ld( 23, tAddr + ( (i+1) * DRAWVERT_OFFSET ) ); - + vecTan31 = vec_ld( 0, tAddr + ( (i+2) * DRAWVERT_OFFSET ) ); vecTan32 = vec_ld( 11, tAddr + ( (i+2) * DRAWVERT_OFFSET ) ); vecTan33 = vec_ld( 23, tAddr + ( (i+2) * DRAWVERT_OFFSET ) ); - + vecTan41 = vec_ld( 0, tAddr + ( (i+3) * DRAWVERT_OFFSET ) ); vecTan42 = vec_ld( 11, tAddr + ( (i+3) * DRAWVERT_OFFSET ) ); vecTan43 = vec_ld( 23, tAddr + ( (i+3) * DRAWVERT_OFFSET ) ); @@ -8002,81 +8002,81 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV vecTSum1 = vec_add( tempSum, vec_sld( tempSum, tempSum, 8 ) ); vecTSum1 = vec_add( vecTSum1, vec_sld( vecTSum1, vecTSum1, 4 ) ); // put tempSum splatted accross vecTSum1 - vecTSum1 = vec_perm( vecTSum1, zeroVector, vecPermSplatFirstWithZero ); + vecTSum1 = vec_perm( vecTSum1, zeroVector, vecPermSplatFirstWithZero ); vecTSum1 = vec_madd( vecTSum1, v5, zeroVector ); - + //vec1T0 now contains what needs to be rsqrt'd and multiplied by f vec1T0 = vec_sub( vec1T0, vecTSum1 ); - + tempSum = zeroVector; tempSum = vec_madd( vec2T0, v6, tempSum ); - + //sum accross tempSum vecTSum1 = vec_add( tempSum, vec_sld( tempSum, tempSum, 8 ) ); - vecTSum1 = vec_add( vecTSum1, vec_sld( vecTSum1, vecTSum1, 4 ) ); + vecTSum1 = vec_add( vecTSum1, vec_sld( vecTSum1, vecTSum1, 4 ) ); vecTSum1 = vec_perm( vecTSum1, zeroVector, vecPermSplatFirstWithZero ); vecTSum1 = vec_madd( vecTSum1, v6, zeroVector ); vec2T0 = vec_sub( vec2T0, vecTSum1 ); - + tempSum = zeroVector; tempSum = vec_madd( vec3T0, v7, tempSum ); - + //sum accross tempSum vecTSum1 = vec_add( tempSum, vec_sld( tempSum, tempSum, 8 ) ); - vecTSum1 = vec_add( vecTSum1, vec_sld( vecTSum1, vecTSum1, 4 ) ); + vecTSum1 = vec_add( vecTSum1, vec_sld( vecTSum1, vecTSum1, 4 ) ); vecTSum1 = vec_perm( vecTSum1, zeroVector, vecPermSplatFirstWithZero ); vecTSum1 = vec_madd( vecTSum1, v7, zeroVector ); vec3T0 = vec_sub( vec3T0, vecTSum1 ); - + tempSum = zeroVector; tempSum = vec_madd( vec4T0, v8, tempSum ); - + //sum accross tempSum vecTSum1 = vec_add( tempSum, vec_sld( tempSum, tempSum, 8 ) ); - vecTSum1 = vec_add( vecTSum1, vec_sld( vecTSum1, vecTSum1, 4 ) ); + vecTSum1 = vec_add( vecTSum1, vec_sld( vecTSum1, vecTSum1, 4 ) ); vecTSum1 = vec_perm( vecTSum1, zeroVector, vecPermSplatFirstWithZero ); vecTSum1 = vec_madd( vecTSum1, v8, zeroVector ); vec4T0 = vec_sub( vec4T0, vecTSum1 ); - + // all tangents[1] tempSum = zeroVector; tempSum = vec_madd( vec1T1, v5, tempSum ); - + //sum accross tempSum vecTSum1 = vec_add( tempSum, vec_sld( tempSum, tempSum, 8 ) ); - vecTSum1 = vec_add( vecTSum1, vec_sld( vecTSum1, vecTSum1, 4 ) ); - vecTSum1 = vec_perm( vecTSum1, zeroVector, vecPermSplatFirstWithZero ); + vecTSum1 = vec_add( vecTSum1, vec_sld( vecTSum1, vecTSum1, 4 ) ); + vecTSum1 = vec_perm( vecTSum1, zeroVector, vecPermSplatFirstWithZero ); vecTSum1 = vec_madd( vecTSum1, v5, zeroVector ); - + //vec1T0 now contains what needs to be rsqrt'd and multiplied by f - vec1T1 = vec_sub( vec1T1, vecTSum1 ); - + vec1T1 = vec_sub( vec1T1, vecTSum1 ); + tempSum = zeroVector; tempSum = vec_madd( vec2T1, v6, tempSum ); - + //sum accross tempSum vecTSum1 = vec_add( tempSum, vec_sld( tempSum, tempSum, 8 ) ); - vecTSum1 = vec_add( vecTSum1, vec_sld( vecTSum1, vecTSum1, 4 ) ); + vecTSum1 = vec_add( vecTSum1, vec_sld( vecTSum1, vecTSum1, 4 ) ); vecTSum1 = vec_perm( vecTSum1, zeroVector, vecPermSplatFirstWithZero ); vecTSum1 = vec_madd( vecTSum1, v6, zeroVector ); vec2T1 = vec_sub( vec2T1, vecTSum1 ); - + tempSum = zeroVector; tempSum = vec_madd( vec3T1, v7, tempSum ); - + //sum accross tempSum vecTSum1 = vec_add( tempSum, vec_sld( tempSum, tempSum, 8 ) ); - vecTSum1 = vec_add( vecTSum1, vec_sld( vecTSum1, vecTSum1, 4 ) ); + vecTSum1 = vec_add( vecTSum1, vec_sld( vecTSum1, vecTSum1, 4 ) ); vecTSum1 = vec_perm( vecTSum1, zeroVector, vecPermSplatFirstWithZero ); vecTSum1 = vec_madd( vecTSum1, v7, zeroVector ); vec3T1 = vec_sub( vec3T1, vecTSum1 ); - + tempSum = zeroVector; tempSum = vec_madd( vec4T1, v8, tempSum ); - + //sum accross tempSum vecTSum1 = vec_add( tempSum, vec_sld( tempSum, tempSum, 8 ) ); - vecTSum1 = vec_add( vecTSum1, vec_sld( vecTSum1, vecTSum1, 4 ) ); + vecTSum1 = vec_add( vecTSum1, vec_sld( vecTSum1, vecTSum1, 4 ) ); vecTSum1 = vec_perm( vecTSum1, zeroVector, vecPermSplatFirstWithZero ); vecTSum1 = vec_madd( vecTSum1, v8, zeroVector ); vec4T1 = vec_sub( vec4T1, vecTSum1 ); @@ -8095,7 +8095,7 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV vecTemp = vec_madd( vec3T0, vec3T0, zeroVector ); vecTSum1 = vec_mergeh( vecTSum1, tempSum2 ); tempSum2 = vec_add( vecTemp, vec_sld( vecTemp, vecTemp, 8 ) ); - tempSum2 = vec_add( tempSum2, vec_sld( tempSum2, tempSum2, 4 ) ); + tempSum2 = vec_add( tempSum2, vec_sld( tempSum2, tempSum2, 4 ) ); // put this into vecSum vecTSum1 = vec_perm( vecTSum1, tempSum2, vecPermHalves ); vecTemp = vec_madd( vec4T0, vec4T0, zeroVector ); @@ -8103,7 +8103,7 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV tempSum2 = vec_add( tempSum2, vec_sld( tempSum2, tempSum2, 4 ) ); // put this into vecSum vecTSum1 = vec_perm( vecTSum1, tempSum2, vecPermLast ); - + vecTemp = vec_madd( vec1T1, vec1T1, zeroVector ); vecTSum2 = vec_add( vecTemp, vec_sld( vecTemp, vecTemp, 8 ) ); vecTSum2 = vec_add( vecTSum2, vec_sld( vecTSum2, vecTSum2, 4 ) ); @@ -8115,7 +8115,7 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV vecTSum2 = vec_mergeh( vecTSum2, tempSum3 ); vecTemp = vec_madd( vec3T1, vec3T1, zeroVector ); tempSum3 = vec_add( vecTemp, vec_sld( vecTemp, vecTemp, 8 ) ); - tempSum3 = vec_add( tempSum3, vec_sld( tempSum3, tempSum3, 4 ) ); + tempSum3 = vec_add( tempSum3, vec_sld( tempSum3, tempSum3, 4 ) ); // put this into vecSum vecTSum2 = vec_perm( vecTSum2, tempSum3, vecPermHalves ); vecTemp = vec_madd( vec4T1, vec4T1, zeroVector ); @@ -8123,12 +8123,12 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV tempSum3 = vec_add( tempSum3, vec_sld( tempSum3, tempSum3, 4 ) ); // put this into vecSum vecTSum2 = vec_perm( vecTSum2, tempSum3, vecPermLast ); - + // tangents[0] vecF = ReciprocalSquareRoot( vecTSum1 ); // tangents[1] vecF2 = ReciprocalSquareRoot( vecTSum2 ); - + // multiply each tangent vector by f vec1T0 = vec_madd( vec1T0, vec_splat( vecF, 0 ), zeroVector ); @@ -8154,7 +8154,7 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV vec_ste( v6, 0, addr + ( (i+1) * DRAWVERT_OFFSET ) ); vec_ste( v6, 4, addr + ( (i+1) * DRAWVERT_OFFSET ) ); vec_ste( v6, 8, addr + ( (i+1) * DRAWVERT_OFFSET ) ); - + vec_ste( v7, 0, addr + ( (i+2) * DRAWVERT_OFFSET ) ); vec_ste( v7, 4, addr + ( (i+2) * DRAWVERT_OFFSET ) ); vec_ste( v7, 8, addr + ( (i+2) * DRAWVERT_OFFSET ) ); @@ -8166,7 +8166,7 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV // store tangents[0] and tangents[1] vec1T0 = vec_perm( vec1T0, vec1T0, storeT11 ); vec1T1 = vec_perm( vec1T1, vec1T1, storeT12 ); - + vec_ste( vec1T0, 0, tAddr + ((i+0) * DRAWVERT_OFFSET ) ); vec_ste( vec1T0, 4, tAddr + ((i+0) * DRAWVERT_OFFSET ) ); vec_ste( vec1T0, 8, tAddr + ((i+0) * DRAWVERT_OFFSET ) ); @@ -8177,7 +8177,7 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV // store second tangents[0] and tangents[1] vec2T0 = vec_perm( vec2T0, vec2T0, storeT21 ); vec2T1 = vec_perm( vec2T1, vec2T1, storeT22 ); - + vec_ste( vec2T0, 0, tAddr + ((i+1) * DRAWVERT_OFFSET ) ); vec_ste( vec2T0, 4, tAddr + ((i+1) * DRAWVERT_OFFSET ) ); vec_ste( vec2T0, 8, tAddr + ((i+1) * DRAWVERT_OFFSET ) ); @@ -8185,10 +8185,10 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV vec_ste( vec2T1, 16, tAddr + ((i+1) * DRAWVERT_OFFSET ) ); vec_ste( vec2T1, 20, tAddr + ((i+1) * DRAWVERT_OFFSET ) ); - // store third tangents[0] and tangents[1] + // store third tangents[0] and tangents[1] vec3T0 = vec_perm( vec3T0, vec3T0, storeT31 ); vec3T1 = vec_perm( vec3T1, vec3T1, storeT32 ); - + vec_ste( vec3T0, 0, tAddr + ((i+2) * DRAWVERT_OFFSET ) ); vec_ste( vec3T0, 4, tAddr + ((i+2) * DRAWVERT_OFFSET ) ); vec_ste( vec3T0, 8, tAddr + ((i+2) * DRAWVERT_OFFSET ) ); @@ -8199,7 +8199,7 @@ void VPCALL idSIMD_AltiVec::NormalizeTangents( idDrawVert *verts, const int numV // store fourth tangents[0] and tangents[1] vec4T0 = vec_perm( vec4T0, vec4T0, storeT41 ); vec4T1 = vec_perm( vec4T1, vec4T1, storeT42 ); - + vec_ste( vec4T0, 0, tAddr + ((i+3) * DRAWVERT_OFFSET ) ); vec_ste( vec4T0, 4, tAddr + ((i+3) * DRAWVERT_OFFSET ) ); vec_ste( vec4T0, 8, tAddr + ((i+3) * DRAWVERT_OFFSET ) ); @@ -8242,7 +8242,7 @@ idSIMD_AltiVec::CreateTextureSpaceLightVectors */ void VPCALL idSIMD_AltiVec::CreateTextureSpaceLightVectors( idVec3 *lightVectors, const idVec3 &lightOrigin, const idDrawVert *verts, const int numVerts, const int *indexes, const int numIndexes ) { - + bool *used = (bool *)_alloca16( numVerts * sizeof( used[0] ) ); memset( used, 0, numVerts * sizeof( used[0] ) ); @@ -8255,9 +8255,9 @@ void VPCALL idSIMD_AltiVec::CreateTextureSpaceLightVectors( idVec3 *lightVectors used[indexes[i+4]] = true; used[indexes[i+5]] = true; used[indexes[i+6]] = true; - used[indexes[i+7]] = true; + used[indexes[i+7]] = true; } - + for ( ; i < numIndexes; i++ ) { used[indexes[i]] = true; } @@ -8266,7 +8266,7 @@ void VPCALL idSIMD_AltiVec::CreateTextureSpaceLightVectors( idVec3 *lightVectors const idDrawVert *v = &verts[i]; const idDrawVert *v2 = &verts[i+1]; - + float x, y, z; float x2, y2, z2; idVec3 lightDir, lightDir2; @@ -8274,25 +8274,25 @@ void VPCALL idSIMD_AltiVec::CreateTextureSpaceLightVectors( idVec3 *lightVectors lightDir[0] = lightOrigin[0] - v->xyz[0]; lightDir[1] = lightOrigin[1] - v->xyz[1]; lightDir[2] = lightOrigin[2] - v->xyz[2]; - + lightDir2[0] = lightOrigin[0] - v2->xyz[0]; lightDir2[1] = lightOrigin[1] - v2->xyz[1]; lightDir2[2] = lightOrigin[2] - v2->xyz[2]; - + x = lightDir[0] * v->tangents[0][0] + lightDir[1] * v->tangents[0][1] + lightDir[2] * v->tangents[0][2]; y = lightDir[0] * v->tangents[1][0] + lightDir[1] * v->tangents[1][1] + lightDir[2] * v->tangents[1][2]; z = lightDir[0] * v->normal[0] + lightDir[1] * v->normal[1] + lightDir[2] * v->normal[2]; - + x2 = lightDir2[0] * v2->tangents[0][0] + lightDir2[1] * v2->tangents[0][1] + lightDir2[2] * v2->tangents[0][2]; y2 = lightDir2[0] * v2->tangents[1][0] + lightDir2[1] * v2->tangents[1][1] + lightDir2[2] * v2->tangents[1][2]; z2 = lightDir2[0] * v2->normal[0] + lightDir2[1] * v2->normal[1] + lightDir2[2] * v2->normal[2]; - + if ( used[i] ) { lightVectors[i][0] = x; lightVectors[i][1] = y; lightVectors[i][2] = z; } - + if ( used[i+1] ) { lightVectors[i+1][0] = x2; lightVectors[i+1][1] = y2; @@ -8331,7 +8331,7 @@ idSIMD_AltiVec::CreateSpecularTextureCoords ============ */ void VPCALL idSIMD_AltiVec::CreateSpecularTextureCoords( idVec4 *texCoords, const idVec3 &lightOrigin, const idVec3 &viewOrigin, const idDrawVert *verts, const int numVerts, const int *indexes, const int numIndexes ) { - + bool *used = (bool *)_alloca16( numVerts * sizeof( used[0] ) ); memset( used, 0, numVerts * sizeof( used[0] ) ); @@ -8344,9 +8344,9 @@ void VPCALL idSIMD_AltiVec::CreateSpecularTextureCoords( idVec4 *texCoords, cons used[indexes[i+4]] = true; used[indexes[i+5]] = true; used[indexes[i+6]] = true; - used[indexes[i+7]] = true; + used[indexes[i+7]] = true; } - + for ( ; i < numIndexes; i++ ) { used[indexes[i]] = true; } @@ -8371,19 +8371,19 @@ void VPCALL idSIMD_AltiVec::CreateSpecularTextureCoords( idVec4 *texCoords, cons permVec = vec_add( vec_lvsl( -1, vertPtr ), (vector unsigned char)(1) ); permVec2 = vec_add( vec_lvsl( -1, vertPtr2 ), (vector unsigned char)(1) ); - + v0 = vec_ld( 0, vertPtr ); v1 = vec_ld( 15, vertPtr ); vector float v2 = vec_ld( 31, vertPtr ); - vector float v3 = vec_ld( 47, vertPtr ); - vector float v4 = vec_ld( 63, vertPtr ); - + vector float v3 = vec_ld( 47, vertPtr ); + vector float v4 = vec_ld( 63, vertPtr ); + vector float v5 = vec_ld( 0, vertPtr2 ); vector float v6 = vec_ld( 15, vertPtr2 ); vector float v7 = vec_ld( 31, vertPtr2 ); vector float v8 = vec_ld( 47, vertPtr2 ); vector float v9 = vec_ld( 63, vertPtr2 ); - + // figure out what values go where vector float vecXYZ = vec_perm( v0, v1, permVec ); vector float vecNormal = vec_perm( v1, v2, permVec ); @@ -8391,64 +8391,64 @@ void VPCALL idSIMD_AltiVec::CreateSpecularTextureCoords( idVec4 *texCoords, cons const vector float vecTangent0 = vec_perm( v2, v3, permVec ); permVec = vec_add( permVec, (vector unsigned char)(-4) ); //shift permute right 3 elements const vector float vecTangent1 = vec_perm( v3, v4, permVec ); - + vector float vecXYZ2 = vec_perm( v5, v6, permVec2 ); vector float vecNormal2 = vec_perm( v6, v7, permVec2 ); vecNormal2 = vec_sld( vecNormal2, vecNormal2, 4 ); const vector float vecTangent02 = vec_perm( v7, v8, permVec2 ); permVec2 = vec_add( permVec2, (vector unsigned char)(-4) ); const vector float vecTangent12 = vec_perm( v8, v9, permVec2 ); - + // calculate lightDir vector float vecLightDir = vec_sub( vecLightOrigin, vecXYZ ); vector float vecViewDir = vec_sub( vecViewOrigin, vecXYZ ); - + vector float vecLightDir2 = vec_sub( vecLightOrigin, vecXYZ2 ); vector float vecViewDir2 = vec_sub( vecViewOrigin, vecXYZ2 ); // calculate distance vector float vecTempLight = vec_madd( vecLightDir, vecLightDir, zeroVector ); vector float vecTempView = vec_madd( vecViewDir, vecViewDir, zeroVector ); - + vector float vecTempLight2 = vec_madd( vecLightDir2, vecLightDir2, zeroVector ); vector float vecTempView2 = vec_madd( vecViewDir2, vecViewDir2, zeroVector ); - + // sum accross first 3 elements of vector vector float tempSum = vec_add( vecTempLight, vec_sld( vecTempLight, vecTempLight, 4 ) ); vecTempLight = vec_add( tempSum, vec_sld( tempSum, tempSum, 8 ) ); vector float tempSum2 = vec_add( vecTempView, vec_sld( vecTempView, vecTempView, 4 ) ); vecTempView = vec_add( tempSum2, vec_sld( tempSum2, tempSum2, 8 ) ); - + vector float tempSum4 = vec_add( vecTempLight2, vec_sld( vecTempLight2, vecTempLight2, 4 ) ); vecTempLight2 = vec_add( tempSum4, vec_sld( tempSum4, tempSum4, 8 ) ); vector float tempSum5 = vec_add( vecTempView2, vec_sld( vecTempView2, vecTempView2, 4 ) ); vecTempView2 = vec_add( tempSum5, vec_sld( tempSum5, tempSum5, 8 ) ); - + // splat sum accross the whole vector vecTempLight = vec_splat( vecTempLight, 0 ); vecTempView = vec_splat( vecTempView, 0 ); - + vecTempLight2 = vec_splat( vecTempLight2, 0 ); vecTempView2 = vec_splat( vecTempView2, 0 ); - + vecTempLight = ReciprocalSquareRoot( vecTempLight ); vecTempView = ReciprocalSquareRoot( vecTempView ); - + vecTempLight2 = ReciprocalSquareRoot( vecTempLight2 ); vecTempView2 = ReciprocalSquareRoot( vecTempView2 ); // modify light and view vectors based on ilength vecViewDir = vec_madd( vecViewDir, vecTempView, zeroVector ); vecLightDir = vec_madd( vecLightDir, vecTempLight, vecViewDir ); - + vecViewDir2 = vec_madd( vecViewDir2, vecTempView2, zeroVector ); vecLightDir2 = vec_madd( vecLightDir2, vecTempLight2, vecViewDir2 ); - + // calculate what to store in each texture coord vector float vecTC0 = vec_madd( vecLightDir, vecTangent0, zeroVector ); vector float vecTC1 = vec_madd( vecLightDir, vecTangent1, zeroVector ); - vector float vecTC2 = vec_madd( vecLightDir, vecNormal, zeroVector ); - + vector float vecTC2 = vec_madd( vecLightDir, vecNormal, zeroVector ); + vector float vecTC3 = vec_madd( vecLightDir2, vecTangent02, zeroVector ); vector float vecTC4 = vec_madd( vecLightDir2, vecTangent12, zeroVector ); vector float vecTC5 = vec_madd( vecLightDir2, vecNormal2, zeroVector ); @@ -8458,17 +8458,17 @@ void VPCALL idSIMD_AltiVec::CreateSpecularTextureCoords( idVec4 *texCoords, cons tempSum = vec_add( vecTC0, vec_sld( vecTC0, vecTC0, 4 ) ); vecTC0 = vec_add( tempSum, vec_sld( vecTC0, vecTC0, 8 ) ); tempSum2 = vec_add( vecTC1, vec_sld( vecTC1, vecTC1, 4 ) ); - vecTC1 = vec_add( tempSum2, vec_sld( vecTC1, vecTC1, 8 ) ); + vecTC1 = vec_add( tempSum2, vec_sld( vecTC1, vecTC1, 8 ) ); tempSum3 = vec_add( vecTC2, vec_sld( vecTC2, vecTC2, 4 ) ); - vecTC2 = vec_add( tempSum3, vec_sld( vecTC2, vecTC2, 8 ) ); - + vecTC2 = vec_add( tempSum3, vec_sld( vecTC2, vecTC2, 8 ) ); + tempSum4 = vec_add( vecTC3, vec_sld( vecTC3, vecTC3, 4 ) ); vecTC3 = vec_add( tempSum4, vec_sld( vecTC3, vecTC3, 8 ) ); tempSum5 = vec_add( vecTC4, vec_sld( vecTC4, vecTC4, 4 ) ); vecTC4 = vec_add( tempSum5, vec_sld( vecTC4, vecTC4, 8 ) ); vector float tempSum6 = vec_add( vecTC5, vec_sld( vecTC5, vecTC5, 4 ) ); vecTC5 = vec_add( tempSum6, vec_sld( vecTC5, vecTC5, 8 ) ); - + vecTC0 = vec_splat( vecTC0, 0 ); vecTC1 = vec_splat( vecTC1, 0 ); vecTC2 = vec_splat( vecTC2, 0 ); @@ -8476,7 +8476,7 @@ void VPCALL idSIMD_AltiVec::CreateSpecularTextureCoords( idVec4 *texCoords, cons vecTC3 = vec_splat( vecTC3, 0 ); vecTC4 = vec_splat( vecTC4, 0 ); vecTC5 = vec_splat( vecTC5, 0 ); - + if ( used[index] ) { // store out results vec_ste( vecTC0, 0, &texCoords[index][0] ); @@ -8484,12 +8484,12 @@ void VPCALL idSIMD_AltiVec::CreateSpecularTextureCoords( idVec4 *texCoords, cons vec_ste( vecTC2, 0, &texCoords[index][2] ); vec_ste( (vector float)(1.0), 0, &texCoords[index][3] ); } - + if ( used[index+1] ) { vec_ste( vecTC3, 0, &texCoords[index+1][0] ); vec_ste( vecTC4, 0, &texCoords[index+1][1] ); vec_ste( vecTC5, 0, &texCoords[index+1][2] ); - vec_ste( (vector float)(1.0), 0, &texCoords[index+1][3] ); + vec_ste( (vector float)(1.0), 0, &texCoords[index+1][3] ); } } @@ -8502,13 +8502,13 @@ void VPCALL idSIMD_AltiVec::CreateSpecularTextureCoords( idVec4 *texCoords, cons const float *vertPtr = verts[index].xyz.ToFloatPtr(); permVec = vec_add( vec_lvsl( -1, vertPtr ), (vector unsigned char)(1) ); - + v0 = vec_ld( 0, vertPtr ); v1 = vec_ld( 15, vertPtr ); vector float v2 = vec_ld( 31, vertPtr ); - vector float v3 = vec_ld( 47, vertPtr ); - vector float v4 = vec_ld( 63, vertPtr ); - + vector float v3 = vec_ld( 47, vertPtr ); + vector float v4 = vec_ld( 63, vertPtr ); + // figure out what values go where vector float vecXYZ = vec_perm( v0, v1, permVec ); vector float vecNormal = vec_perm( v1, v2, permVec ); @@ -8516,7 +8516,7 @@ void VPCALL idSIMD_AltiVec::CreateSpecularTextureCoords( idVec4 *texCoords, cons const vector float vecTangent0 = vec_perm( v2, v3, permVec ); permVec = vec_add( permVec, (vector unsigned char)(-4) ); //shift permute right 3 elements const vector float vecTangent1 = vec_perm( v3, v4, permVec ); - + // calculate lightDir vector float vecLightDir = vec_sub( vecLightOrigin, vecXYZ ); vector float vecViewDir = vec_sub( vecViewOrigin, vecXYZ ); @@ -8524,48 +8524,48 @@ void VPCALL idSIMD_AltiVec::CreateSpecularTextureCoords( idVec4 *texCoords, cons // calculate distance vector float vecTempLight = vec_madd( vecLightDir, vecLightDir, zeroVector ); vector float vecTempView = vec_madd( vecViewDir, vecViewDir, zeroVector ); - + // sum accross first 3 elements of vector vector float tempSum = vec_add( vecTempLight, vec_sld( vecTempLight, vecTempLight, 4 ) ); vecTempLight = vec_add( tempSum, vec_sld( tempSum, tempSum, 8 ) ); vector float tempSum2 = vec_add( vecTempView, vec_sld( vecTempView, vecTempView, 4 ) ); vecTempView = vec_add( tempSum2, vec_sld( tempSum2, tempSum2, 8 ) ); - + // splat sum accross the whole vector vecTempLight = vec_splat( vecTempLight, 0 ); vecTempView = vec_splat( vecTempView, 0 ); - + vecTempLight = ReciprocalSquareRoot( vecTempLight ); vecTempView = ReciprocalSquareRoot( vecTempView ); - + // modify light and view vectors based on ilength vecViewDir = vec_madd( vecViewDir, vecTempView, zeroVector ); vecLightDir = vec_madd( vecLightDir, vecTempLight, vecViewDir ); - + // calculate what to store in each texture coord vector float vecTC0 = vec_madd( vecLightDir, vecTangent0, zeroVector ); vector float vecTC1 = vec_madd( vecLightDir, vecTangent1, zeroVector ); - vector float vecTC2 = vec_madd( vecLightDir, vecNormal, zeroVector ); - + vector float vecTC2 = vec_madd( vecLightDir, vecNormal, zeroVector ); + // sum accross first 3 elements of vector vector float tempSum3; tempSum = vec_add( vecTC0, vec_sld( vecTC0, vecTC0, 4 ) ); vecTC0 = vec_add( tempSum, vec_sld( vecTC0, vecTC0, 8 ) ); tempSum2 = vec_add( vecTC1, vec_sld( vecTC1, vecTC1, 4 ) ); - vecTC1 = vec_add( tempSum2, vec_sld( vecTC1, vecTC1, 8 ) ); + vecTC1 = vec_add( tempSum2, vec_sld( vecTC1, vecTC1, 8 ) ); tempSum3 = vec_add( vecTC2, vec_sld( vecTC2, vecTC2, 4 ) ); - vecTC2 = vec_add( tempSum3, vec_sld( vecTC2, vecTC2, 8 ) ); - + vecTC2 = vec_add( tempSum3, vec_sld( vecTC2, vecTC2, 8 ) ); + vecTC0 = vec_splat( vecTC0, 0 ); vecTC1 = vec_splat( vecTC1, 0 ); vecTC2 = vec_splat( vecTC2, 0 ); - + // store out results vec_ste( vecTC0, 0, &texCoords[index][0] ); vec_ste( vecTC1, 0, &texCoords[index][1] ); vec_ste( vecTC2, 0, &texCoords[index][2] ); vec_ste( (vector float)(1.0), 0, &texCoords[index][3] ); - + } } #endif /* 0 for disable spec coord */ @@ -8581,30 +8581,30 @@ idSIMD_AltiVec::CreateShadowCache int VPCALL idSIMD_AltiVec::CreateShadowCache( idVec4 *vertexCache, int *vertRemap, const idVec3 &lightOrigin, const idDrawVert *verts, const int numVerts ) { int outVerts = 0; int i = 0; - + assert( IS_16BYTE_ALIGNED( vertexCache[0] ) ); - + register vector float v0, v1, v2, v3, v4, v5, v6, v7; register vector unsigned char vecPerm, vecPerm2, vecPerm3, vecPerm4, vecPerm5; register vector float zeroVector = (vector float)(0.0); register vector float oneVector = (vector float)(1); register vector unsigned char vecPermZeroLast = (vector unsigned char)(0,1,2,3,4,5,6,7,8,9,10,11,16,17,18,19); - + const float *lPtr = lightOrigin.ToFloatPtr(); const float *vPtr; const float *vPtr2; const float *vPtr3; const float *vPtr4; - + // put values into a vector vecPerm = vec_add( vec_lvsl( -1, lPtr ), (vector unsigned char)(1) ); v0 = vec_ld( 0, lPtr ); v1 = vec_ld( 15, lPtr ); v0 = vec_perm( v0, v1, vecPerm ); v0 = vec_perm( v0, zeroVector, vecPermZeroLast ); - + //v0 now contains lightOrigin[0], lightOrigin[1], lightOrigin[2], 0 - for ( ; i+3 < numVerts; i+= 4 ) { + for ( ; i+3 < numVerts; i+= 4 ) { if ( ! vertRemap[i] ) { vPtr = verts[i].xyz.ToFloatPtr(); @@ -8612,25 +8612,25 @@ int VPCALL idSIMD_AltiVec::CreateShadowCache( idVec4 *vertexCache, int *vertRema vecPerm2 = vec_add( vec_lvsl( -1, vPtr ), (vector unsigned char)(1) ); v2 = vec_ld( 0, vPtr ); v3 = vec_ld( 15, vPtr ); - v7 = vec_perm( v2, v3, vecPerm2 ); + v7 = vec_perm( v2, v3, vecPerm2 ); #else v7 = vec_ld( 0, vPtr ); #endif v2 = vec_perm( v7, zeroVector, vecPermZeroLast ); v3 = vec_perm( v7, oneVector, vecPermZeroLast ); v1 = vec_sub( v2, v0 ); - + vec_st( v3, 0, &vertexCache[outVerts][0] ); vec_st( v1, 0, &vertexCache[outVerts+1][0] ); vertRemap[i] = outVerts; outVerts += 2; } - + if ( ! vertRemap[i+1] ) { vPtr2 = verts[i+1].xyz.ToFloatPtr(); -#ifndef DRAWVERT_PADDED +#ifndef DRAWVERT_PADDED vecPerm3 = vec_add( vec_lvsl( -1, vPtr2 ), (vector unsigned char)(1) ); v4 = vec_ld( 0, vPtr2 ); v5 = vec_ld( 15, vPtr2 ); @@ -8641,19 +8641,19 @@ int VPCALL idSIMD_AltiVec::CreateShadowCache( idVec4 *vertexCache, int *vertRema v4 = vec_perm( v6, zeroVector, vecPermZeroLast ); v5 = vec_perm( v6, oneVector, vecPermZeroLast ); v6 = vec_sub( v4, v0 ); - + vec_st( v5, 0, &vertexCache[outVerts][0] ); - vec_st( v6, 0, &vertexCache[outVerts+1][0] ); - + vec_st( v6, 0, &vertexCache[outVerts+1][0] ); + vertRemap[i+1] = outVerts; outVerts += 2; } - + if ( ! vertRemap[i+2] ) { vPtr3 = verts[i+2].xyz.ToFloatPtr(); -#ifndef DRAWVERT_PADDED - vecPerm4 = vec_add( vec_lvsl( -1, vPtr3 ), (vector unsigned char)(1) ); +#ifndef DRAWVERT_PADDED + vecPerm4 = vec_add( vec_lvsl( -1, vPtr3 ), (vector unsigned char)(1) ); v1 = vec_ld( 0, vPtr3 ); v2 = vec_ld( 15, vPtr3 ); v3 = vec_perm( v1, v2, vecPerm4 ); @@ -8665,16 +8665,16 @@ int VPCALL idSIMD_AltiVec::CreateShadowCache( idVec4 *vertexCache, int *vertRema v3 = vec_sub( v1, v0 ); vec_st( v2, 0, &vertexCache[outVerts][0] ); - vec_st( v3, 0, &vertexCache[outVerts+1][0] ); - + vec_st( v3, 0, &vertexCache[outVerts+1][0] ); + vertRemap[i+2] = outVerts; outVerts += 2; } - + if ( ! vertRemap[i+3] ) { vPtr4 = verts[i+3].xyz.ToFloatPtr(); -#ifndef DRAWVERT_PADDED - vecPerm5 = vec_add( vec_lvsl( -1, vPtr4 ), (vector unsigned char)(1) ); +#ifndef DRAWVERT_PADDED + vecPerm5 = vec_add( vec_lvsl( -1, vPtr4 ), (vector unsigned char)(1) ); v4 = vec_ld( 0, vPtr4 ); v5 = vec_ld( 16, vPtr4 ); v6 = vec_perm( v4, v5, vecPerm5 ); @@ -8684,13 +8684,13 @@ int VPCALL idSIMD_AltiVec::CreateShadowCache( idVec4 *vertexCache, int *vertRema v4 = vec_perm( v6, zeroVector, vecPermZeroLast ); v5 = vec_perm( v6, oneVector, vecPermZeroLast ); v6 = vec_sub( v4, v0 ); - + vec_st( v5, 0, &vertexCache[outVerts][0] ); vec_st( v6, 0, &vertexCache[outVerts+1][0] ); - + vertRemap[i+3] = outVerts; outVerts += 2; - } + } } // cleanup @@ -8727,52 +8727,52 @@ idSIMD_AltiVec::CreateShadowCache int VPCALL idSIMD_AltiVec::CreateShadowCache( idVec4 *vertexCache, int *vertRemap, const idVec3 &lightOrigin, const idDrawVert *verts, const int numVerts ) { int outVerts = 0; int i = 0; - + register vector float v0, v1, v2, v3, v4, v5, v6, v7; register vector unsigned char vecPerm, vecPerm2, vecPerm3, vecPerm4, vecPerm5; register vector float zeroVector = (vector float)(0.0); register vector float oneVector = (vector float)(1); register vector unsigned char vecPermZeroLast = (vector unsigned char)(0,1,2,3,4,5,6,7,8,9,10,11,16,17,18,19); - + const float *lPtr = lightOrigin.ToFloatPtr(); const float *vPtr; const float *vPtr2; const float *vPtr3; const float *vPtr4; - + // put values into a vector vecPerm = vec_add( vec_lvsl( -1, lPtr ), (vector unsigned char)(1) ); v0 = vec_ld( 0, lPtr ); v1 = vec_ld( 15, lPtr ); v0 = vec_perm( v0, v1, vecPerm ); v0 = vec_perm( v0, zeroVector, vecPermZeroLast ); - + //v0 now contains lightOrigin[0], lightOrigin[1], lightOrigin[2], 0 - for ( ; i+3 < numVerts; i+= 4 ) { + for ( ; i+3 < numVerts; i+= 4 ) { if ( ! vertRemap[i] ) { vPtr = verts[i].xyz.ToFloatPtr(); #ifndef DRAWVERT_PADDED vecPerm2 = vec_add( vec_lvsl( -1, vPtr ), (vector unsigned char)(1) ); v2 = vec_ld( 0, vPtr ); v3 = vec_ld( 15, vPtr ); - v7 = vec_perm( v2, v3, vecPerm2 ); + v7 = vec_perm( v2, v3, vecPerm2 ); #else v7 = vec_ld( 0, vPtr ); #endif v2 = vec_perm( v7, zeroVector, vecPermZeroLast ); v3 = vec_perm( v7, oneVector, vecPermZeroLast ); v1 = vec_sub( v2, v0 ); - + // store results UNALIGNED_STORE2( &vertexCache[outVerts][0], v3, v1 ); - + vertRemap[i] = outVerts; outVerts += 2; } - + if ( ! vertRemap[i+1] ) { vPtr2 = verts[i+1].xyz.ToFloatPtr(); -#ifndef DRAWVERT_PADDED +#ifndef DRAWVERT_PADDED vecPerm3 = vec_add( vec_lvsl( -1, vPtr2 ), (vector unsigned char)(1) ); v4 = vec_ld( 0, vPtr2 ); v5 = vec_ld( 15, vPtr2 ); @@ -8786,15 +8786,15 @@ int VPCALL idSIMD_AltiVec::CreateShadowCache( idVec4 *vertexCache, int *vertRema // store results UNALIGNED_STORE2( &vertexCache[outVerts][0], v5, v6 ); - + vertRemap[i+1] = outVerts; outVerts += 2; } - + if ( ! vertRemap[i+2] ) { vPtr3 = verts[i+2].xyz.ToFloatPtr(); -#ifndef DRAWVERT_PADDED - vecPerm4 = vec_add( vec_lvsl( -1, vPtr3 ), (vector unsigned char)(1) ); +#ifndef DRAWVERT_PADDED + vecPerm4 = vec_add( vec_lvsl( -1, vPtr3 ), (vector unsigned char)(1) ); v1 = vec_ld( 0, vPtr3 ); v2 = vec_ld( 15, vPtr3 ); v3 = vec_perm( v1, v2, vecPerm4 ); @@ -8804,17 +8804,17 @@ int VPCALL idSIMD_AltiVec::CreateShadowCache( idVec4 *vertexCache, int *vertRema v1 = vec_perm( v3, zeroVector, vecPermZeroLast ); v2 = vec_perm( v3, oneVector, vecPermZeroLast ); v3 = vec_sub( v1, v0 ); - + // store results UNALIGNED_STORE2( &vertexCache[outVerts][0], v2, v3 ); - + vertRemap[i+2] = outVerts; outVerts += 2; } if ( ! vertRemap[i+3] ) { vPtr4 = verts[i+3].xyz.ToFloatPtr(); -#ifndef DRAWVERT_PADDED - vecPerm5 = vec_add( vec_lvsl( -1, vPtr4 ), (vector unsigned char)(1) ); +#ifndef DRAWVERT_PADDED + vecPerm5 = vec_add( vec_lvsl( -1, vPtr4 ), (vector unsigned char)(1) ); v4 = vec_ld( 0, vPtr4 ); v5 = vec_ld( 16, vPtr4 ); v6 = vec_perm( v4, v5, vecPerm5 ); @@ -8825,14 +8825,14 @@ int VPCALL idSIMD_AltiVec::CreateShadowCache( idVec4 *vertexCache, int *vertRema v4 = vec_perm( v6, zeroVector, vecPermZeroLast ); v5 = vec_perm( v6, oneVector, vecPermZeroLast ); v6 = vec_sub( v4, v0 ); - + // store results UNALIGNED_STORE2( &vertexCache[outVerts][0], v5, v6 ); - - + + vertRemap[i+3] = outVerts; outVerts += 2; - } + } } // cleanup @@ -8878,7 +8878,7 @@ int VPCALL idSIMD_AltiVec::CreateVertexProgramShadowCache( idVec4 *vertexCache, assert( sizeof(idDrawVert) == DRAWVERT_OFFSET * sizeof(float) ); // idVec4 size assert( sizeof(idVec4) == IDVEC4_OFFSET * sizeof(float) ); - + register vector float v0, v1, v2, v3, v4, v5, v6, v7; register vector float zeroVector = (vector float)(0.0); register vector float oneVector = (vector float)(1); @@ -8895,13 +8895,13 @@ int VPCALL idSIMD_AltiVec::CreateVertexProgramShadowCache( idVec4 *vertexCache, vertPerm4 = vec_add( vec_lvsl( -1, (float*) verts[3].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); } #endif - + for ( ; i+3 < numVerts; i+=4 ) { const float *vertPtr = verts[i].xyz.ToFloatPtr(); const float *vertPtr2 = verts[i+1].xyz.ToFloatPtr(); const float *vertPtr3 = verts[i+2].xyz.ToFloatPtr(); const float *vertPtr4 = verts[i+3].xyz.ToFloatPtr(); - + #ifndef DRAWVERT_PADDED v0 = vec_ld( 0, vertPtr ); v1 = vec_ld( 15, vertPtr ); @@ -8925,17 +8925,17 @@ int VPCALL idSIMD_AltiVec::CreateVertexProgramShadowCache( idVec4 *vertexCache, v0 = vec_perm( v0, oneVector, vecPermThreeOne ); v4 = vec_perm( v0, zeroVector, vecPermThreeOne ); - + v1 = vec_perm( v1, oneVector, vecPermThreeOne ); v5 = vec_perm( v1, zeroVector, vecPermThreeOne ); - + v2 = vec_perm( v2, oneVector, vecPermThreeOne ); v6 = vec_perm( v2, zeroVector, vecPermThreeOne ); - + v3 = vec_perm( v3, oneVector, vecPermThreeOne ); v7 = vec_perm( v3, zeroVector, vecPermThreeOne ); - // store results + // store results ALIGNED_STORE4( &vertexCache[i*2][0], v0, v4, v1, v5 ); ALIGNED_STORE4( &vertexCache[(i+2)*2][0], v2, v6, v3, v7 ); @@ -8968,7 +8968,7 @@ int VPCALL idSIMD_AltiVec::CreateVertexProgramShadowCache( idVec4 *vertexCache, assert( sizeof(idDrawVert) == DRAWVERT_OFFSET * sizeof(float) ); // idVec4 size assert( sizeof(idVec4) == IDVEC4_OFFSET * sizeof(float) ); - + register vector float v0, v1, v2, v3, v4, v5, v6, v7; register vector float zeroVector = (vector float)(0.0); register vector float oneVector = (vector float)(1); @@ -8985,14 +8985,14 @@ int VPCALL idSIMD_AltiVec::CreateVertexProgramShadowCache( idVec4 *vertexCache, vertPerm4 = vec_add( vec_lvsl( -1, (float*) verts[3].xyz.ToFloatPtr() ), (vector unsigned char)(1) ); } #endif - + for ( ; i+3 < numVerts; i+=4 ) { const float *vertPtr = verts[i].xyz.ToFloatPtr(); const float *vertPtr2 = verts[i+1].xyz.ToFloatPtr(); const float *vertPtr3 = verts[i+2].xyz.ToFloatPtr(); const float *vertPtr4 = verts[i+3].xyz.ToFloatPtr(); -#ifndef DRAWVERT_PADDED +#ifndef DRAWVERT_PADDED v0 = vec_ld( 0, vertPtr ); v1 = vec_ld( 15, vertPtr ); v2 = vec_ld( 0, vertPtr2 ); @@ -9001,7 +9001,7 @@ int VPCALL idSIMD_AltiVec::CreateVertexProgramShadowCache( idVec4 *vertexCache, v5 = vec_ld( 15, vertPtr3 ); v6 = vec_ld( 0, vertPtr4 ); v7 = vec_ld( 15, vertPtr4 ); - + v0 = vec_perm( v0, v1, vertPerm1 ); v1 = vec_perm( v2, v3, vertPerm2 ); v2 = vec_perm( v4, v5, vertPerm3 ); @@ -9010,27 +9010,27 @@ int VPCALL idSIMD_AltiVec::CreateVertexProgramShadowCache( idVec4 *vertexCache, v0 = vec_ld( 0, vertPtr ); v1 = vec_ld( 0, vertPtr2 ); v2 = vec_ld( 0, vertPtr3 ); - v3 = vec_ld( 0, vertPtr4 ); -#endif + v3 = vec_ld( 0, vertPtr4 ); +#endif v0 = vec_perm( v0, oneVector, vecPermThreeOne ); v4 = vec_perm( v0, zeroVector, vecPermThreeOne ); - + v1 = vec_perm( v1, oneVector, vecPermThreeOne ); v5 = vec_perm( v1, zeroVector, vecPermThreeOne ); - + v2 = vec_perm( v2, oneVector, vecPermThreeOne ); v6 = vec_perm( v2, zeroVector, vecPermThreeOne ); - + v3 = vec_perm( v3, oneVector, vecPermThreeOne ); v7 = vec_perm( v3, zeroVector, vecPermThreeOne ); - + // store results as unaligned vector unsigned char storePerm = vec_sub( vec_lvsr( 15, &vertexCache[i*2][0] ), (vector unsigned char)(1) ); vector unsigned int mask = vec_perm( (vector unsigned int)(0), (vector unsigned int)(-1), storePerm ); vector float vc1 = vec_ld( 0, &vertexCache[i*2][0] ); vector float vc2 = vec_ld( 127, &vertexCache[i*2][0] ); - + // right rotate input data v0 = vec_perm( v0, v0, storePerm ); v4 = vec_perm( v4, v4, storePerm ); @@ -9040,7 +9040,7 @@ int VPCALL idSIMD_AltiVec::CreateVertexProgramShadowCache( idVec4 *vertexCache, v6 = vec_perm( v6, v6, storePerm ); v3 = vec_perm( v3, v3, storePerm ); v7 = vec_perm( v7, v7, storePerm ); - + vec_st( vec_sel( vc1, v0, mask ), 0 , &vertexCache[i*2][0] ); vec_st( vec_sel( v0, v4, mask ), 15 , &vertexCache[i*2][0] ); vec_st( vec_sel( v4, v1, mask ), 31 , &vertexCache[i*2][0] ); @@ -9081,44 +9081,44 @@ int VPCALL idSIMD_AltiVec::CreateVertexProgramShadowCache( idVec4 *vertexCache, idSIMD_AltiVec::UpSamplePCMTo44kHz Duplicate samples for 44kHz output. - + Assumptions: Assumes that dest starts at aligned address ============ */ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const int numSamples, const int kHz, const int numChannels ) { - + // dest is aligned assert( IS_16BYTE_ALIGNED( dest[0] ) ); vector signed short vs0, vs1; register vector signed int vi0, vi1; register vector float v0, v1, v2, v3, v4, v5, v6, v7, v8, v9; - // permute vectors + // permute vectors register vector unsigned char vecFirstHalf = (vector unsigned char)(0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7); register vector unsigned char vecSecondHalf = (vector unsigned char)(8,9,10,11,12,13,14,15,8,9,10,11,12,13,14,15); - + register vector unsigned char vecBottom = (vector unsigned char)(0,1,2,3,0,1,2,3,4,5,6,7,4,5,6,7); register vector unsigned char vecTop = (vector unsigned char)(8,9,10,11,8,9,10,11,12,13,14,15,12,13,14,15); - + // If this can be assumed true, we can eliminate another conditional that checks to see if we can // load up a vector before the loop assert( numSamples >= 12 ); - + if ( kHz == 11025 ) { if ( numChannels == 1 ) { // 8 at a time int i = 0; - + vector signed short vsOld = vec_ld( 0, &src[i] ); vector unsigned char permVec = vec_add( vec_lvsl( -1, &src[i] ), (vector unsigned char)(1) ); - + for ( ; i+7 < numSamples; i+= 8 ) { // load src vs1 = vec_ld( 15, &src[i] ); vs0 = vec_perm( vsOld, vs1, permVec ); vsOld = vs1; - + // unpack shorts to ints vi0 = vec_unpackh( vs0 ); vi1 = vec_unpackl( vs0 ); @@ -9145,16 +9145,16 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in } } else { int i = 0; - + vector unsigned char permVec = vec_add( vec_lvsl( -1, &src[0] ), (vector unsigned char)(1) ); vector signed short vsOld = vec_ld( 0, &src[0] ); - + for ( ; i+7 < numSamples; i += 8 ) { // load src vs1 = vec_ld( 15, &src[i] ); vs0 = vec_perm( vsOld, vs1, permVec ); vsOld = vs1; - + // unpack shorts to ints vi0 = vec_unpackh( vs0 ); vi1 = vec_unpackl( vs0 ); @@ -9170,11 +9170,11 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in v7 = v6; v8 = vec_perm (v1, v1, vecSecondHalf ); v9 = v8; - + // store results ALIGNED_STORE8( &dest[i*4], v2, v3, v4, v5, v6, v7, v8, v9 ); } - + for ( ; i < numSamples; i += 2 ) { dest[i*4+0] = dest[i*4+2] = dest[i*4+4] = dest[i*4+6] = (float) src[i+0]; dest[i*4+1] = dest[i*4+3] = dest[i*4+5] = dest[i*4+7] = (float) src[i+1]; @@ -9185,13 +9185,13 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in int i; vector unsigned char permVec = vec_add( vec_lvsl( -1, &src[0] ), (vector unsigned char)(1) ); vector signed short vsOld = vec_ld( 0, &src[0] ); - + for ( i = 0; i+7 < numSamples; i += 8 ) { // load src vs1 = vec_ld( 0, &src[i] ); vs0 = vec_perm( vsOld, vs1, permVec ); vsOld = vs1; - + // unpack shorts to ints vi0 = vec_unpackh( vs0 ); vi1 = vec_unpackl( vs0 ); @@ -9203,7 +9203,7 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in v3 = vec_perm( v0, v0, vecTop ); v4 = vec_perm( v1, v1, vecBottom ); v5 = vec_perm (v1, v1, vecTop ); - + // store results ALIGNED_STORE4( &dest[i*2], v2, v3, v4, v5 ); } @@ -9215,13 +9215,13 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in int i; vector unsigned char permVec = vec_add( vec_lvsl( -1, &src[0] ), (vector unsigned char)(1) ); vector signed short vsOld = vec_ld( 0, &src[0] ); - + for ( i = 0; i+7 < numSamples; i += 8 ) { // load src vs1 = vec_ld( 15, &src[i] ); vs0 = vec_perm( vsOld, vs1, permVec ); vsOld = vs1; - + // unpack shorts to ints vi0 = vec_unpackh( vs0 ); vi1 = vec_unpackl( vs0 ); @@ -9230,10 +9230,10 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in v1 = vec_ctf( vi1, 0 ); // put into vectors in order to store v2 = vec_perm( v0, v0, vecFirstHalf ); - v3 = vec_perm( v0, v0, vecSecondHalf ); + v3 = vec_perm( v0, v0, vecSecondHalf ); v4 = vec_perm( v1, v1, vecFirstHalf ); v5 = vec_perm (v1, v1, vecSecondHalf ); - + // store results ALIGNED_STORE4( &dest[i*2], v2, v3, v4, v5 ); } @@ -9247,20 +9247,20 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in int i; vector unsigned char permVec = vec_add( vec_lvsl( -1, &src[0] ), (vector unsigned char)(1) ); vector signed short vsOld = vec_ld( 0, &src[0] ); - + for ( i = 0; i+7 < numSamples; i += 8 ) { vs1 = vec_ld( 15, &src[i] ); vs0 = vec_perm( vsOld, vs1, permVec ); vsOld = vs1; - + //unpack shorts to ints vi0 = vec_unpackh( vs0 ); vi1 = vec_unpackl( vs0 ); - + //convert ints to floats v0 = vec_ctf( vi0, 0 ); v1 = vec_ctf( vi1, 0 ); - + //store results ALIGNED_STORE2( &dest[i], v0, v1 ); } @@ -9280,44 +9280,44 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in idSIMD_AltiVec::UpSamplePCMTo44kHz Duplicate samples for 44kHz output. - + Assumptions: No assumptions ============ */ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const int numSamples, const int kHz, const int numChannels ) { - + vector signed short vs0, vs1; register vector signed int vi0, vi1; register vector float v0, v1, v2, v3, v4, v5, v6, v7, v8, v9; - // permute vectors + // permute vectors register vector unsigned char vecFirstHalf = (vector unsigned char)(0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7); register vector unsigned char vecSecondHalf = (vector unsigned char)(8,9,10,11,12,13,14,15,8,9,10,11,12,13,14,15); - + register vector unsigned char vecBottom = (vector unsigned char)(0,1,2,3,0,1,2,3,4,5,6,7,4,5,6,7); register vector unsigned char vecTop = (vector unsigned char)(8,9,10,11,8,9,10,11,12,13,14,15,12,13,14,15); - + // calculate perm vector and masks for stores vector unsigned char storePerm = vec_sub( vec_lvsr( 15, &dest[0] ), (vector unsigned char)(1) ); // original values of dest - vector float vecDest = vec_ld( 0, &dest[0] ); + vector float vecDest = vec_ld( 0, &dest[0] ); vector unsigned int mask = vec_perm( (vector unsigned int)(0), (vector unsigned int)(-1), storePerm ); - + if ( kHz == 11025 ) { if ( numChannels == 1 ) { // 8 at a time int i = 0; - + vector signed short vsOld = vec_ld( 0, &src[i] ); vector unsigned char permVec = vec_add( vec_lvsl( -1, &src[i] ), (vector unsigned char)(1) ); - + for ( ; i+7 < numSamples; i+= 8 ) { // load src vs1 = vec_ld( 15, &src[i] ); vs0 = vec_perm( vsOld, vs1, permVec ); vsOld = vs1; vector float vecDestEnd = vec_ld( 127, &dest[i*4] ); - + // unpack shorts to ints vi0 = vec_unpackh( vs0 ); vi1 = vec_unpackl( vs0 ); @@ -9343,7 +9343,7 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in v7 = vec_perm( v7, v7, storePerm ); v8 = vec_perm( v8, v8, storePerm ); v9 = vec_perm( v9, v9, storePerm ); - + // store results vec_st( vec_sel( vecDest, v2, mask ), 0, &dest[i*4] ); vec_st( vec_sel( v2, v3, mask ), 15, &dest[i*4] ); @@ -9362,10 +9362,10 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in } } else { int i = 0; - + vector unsigned char permVec = vec_add( vec_lvsl( -1, &src[0] ), (vector unsigned char)(1) ); vector signed short vsOld = vec_ld( 0, &src[0] ); - + for ( ; i+7 < numSamples; i += 8 ) { // load src vs1 = vec_ld( 15, &src[i] ); @@ -9397,7 +9397,7 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in v7 = vec_perm( v7, v7, storePerm ); v8 = vec_perm( v8, v8, storePerm ); v9 = vec_perm( v9, v9, storePerm ); - + // store results vec_st( vec_sel( vecDest, v2, mask ), 0, &dest[i*4] ); vec_st( vec_sel( v2, v3, mask ), 15, &dest[i*4] ); @@ -9410,7 +9410,7 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in vecDest = vec_sel( v9, vecDestEnd, mask ); vec_st( vecDest, 127, &dest[i*4] ); } - + for ( ; i < numSamples; i += 2 ) { dest[i*4+0] = dest[i*4+2] = dest[i*4+4] = dest[i*4+6] = (float) src[i+0]; dest[i*4+1] = dest[i*4+3] = dest[i*4+5] = dest[i*4+7] = (float) src[i+1]; @@ -9421,14 +9421,14 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in int i; vector unsigned char permVec = vec_add( vec_lvsl( -1, &src[0] ), (vector unsigned char)(1) ); vector signed short vsOld = vec_ld( 0, &src[0] ); - + for ( i = 0; i+7 < numSamples; i += 8 ) { // load src vs1 = vec_ld( 0, &src[i] ); vs0 = vec_perm( vsOld, vs1, permVec ); vsOld = vs1; vector float vecDestEnd = vec_ld( 63, &dest[i*2] ); - + // unpack shorts to ints vi0 = vec_unpackh( vs0 ); vi1 = vec_unpackl( vs0 ); @@ -9440,12 +9440,12 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in v3 = vec_perm( v0, v0, vecTop ); v4 = vec_perm( v1, v1, vecBottom ); v5 = vec_perm (v1, v1, vecTop ); - + v2 = vec_perm( v2, v2, storePerm ); v3 = vec_perm( v3, v3, storePerm ); v4 = vec_perm( v4, v4, storePerm ); v5 = vec_perm( v5, v5, storePerm ); - + // store results vec_st( vec_sel( vecDest, v2, mask ), 0, &dest[i*2] ); vec_st( vec_sel( v2, v3, mask ), 15, &dest[i*2] ); @@ -9453,7 +9453,7 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in vec_st( vec_sel( v4, v5, mask ), 47, &dest[i*2] ); vecDest = vec_sel( v5, vecDestEnd, mask ); vec_st( vecDest, 63, &dest[i*2] ); - + } // cleanup for ( ; i < numSamples; i++ ) { @@ -9463,7 +9463,7 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in int i; vector unsigned char permVec = vec_add( vec_lvsl( -1, &src[0] ), (vector unsigned char)(1) ); vector signed short vsOld = vec_ld( 0, &src[0] ); - + for ( i = 0; i+7 < numSamples; i += 8 ) { // load src vs1 = vec_ld( 15, &src[i] ); @@ -9479,15 +9479,15 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in v1 = vec_ctf( vi1, 0 ); // put into vectors in order to store v2 = vec_perm( v0, v0, vecFirstHalf ); - v3 = vec_perm( v0, v0, vecSecondHalf ); + v3 = vec_perm( v0, v0, vecSecondHalf ); v4 = vec_perm( v1, v1, vecFirstHalf ); v5 = vec_perm (v1, v1, vecSecondHalf ); - + v2 = vec_perm( v2, v2, storePerm ); v3 = vec_perm( v3, v3, storePerm ); v4 = vec_perm( v4, v4, storePerm ); v5 = vec_perm( v5, v5, storePerm ); - + // store results vec_st( vec_sel( vecDest, v2, mask ), 0, &dest[i*2] ); vec_st( vec_sel( v2, v3, mask ), 15, &dest[i*2] ); @@ -9506,25 +9506,25 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in int i; vector unsigned char permVec = vec_add( vec_lvsl( -1, &src[0] ), (vector unsigned char)(1) ); vector signed short vsOld = vec_ld( 0, &src[0] ); - + for ( i = 0; i+7 < numSamples; i += 8 ) { //vs0 = vec_ld( 0, &src[i] ); vs1 = vec_ld( 15, &src[i] ); vs0 = vec_perm( vsOld, vs1, permVec ); vsOld = vs1; vector float vecDestEnd = vec_ld( 31, &dest[i] ); - + //unpack shorts to ints vi0 = vec_unpackh( vs0 ); vi1 = vec_unpackl( vs0 ); - + //convert ints to floats v0 = vec_ctf( vi0, 0 ); v1 = vec_ctf( vi1, 0 ); - + v0 = vec_perm( v0, v0, storePerm ); v1 = vec_perm( v1, v1, storePerm ); - + // store results vec_st( vec_sel( vecDest, v0, mask ), 0, &dest[i] ); vec_st( vec_sel( v0, v1, mask ), 15, &dest[i] ); @@ -9548,20 +9548,20 @@ void idSIMD_AltiVec::UpSamplePCMTo44kHz( float *dest, const short *src, const in idSIMD_AltiVec::UpSampleOGGTo44kHz Duplicate samples for 44kHz output. - - Assumptions: + + Assumptions: Assumes that dest starts at aligned address ============ */ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, const int numSamples, const int kHz, const int numChannels ) { // dest is aligned assert( IS_16BYTE_ALIGNED( dest[0] ) ); - + register vector float oggVec1, oggVec2, oggVec3, oggVec4, oggVec5, oggVec6, oggVec7, oggVec8; register vector float constVec, zeroVector; register vector float v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10; vector unsigned char vecPerm1; - vector unsigned char vecPerm2; + vector unsigned char vecPerm2; vector unsigned char vecOneTwo = (vector unsigned char)(0,1,2,3,0,1,2,3,4,5,6,7,4,5,6,7); vector unsigned char vecThreeFour = (vector unsigned char)(8,9,10,11,8,9,10,11,12,13,14,15,12,13,14,15); @@ -9569,16 +9569,16 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, vector unsigned char vecSecond = (vector unsigned char)(4,5,6,7,20,21,22,23,4,5,6,7,20,21,22,23); vector unsigned char vecThird = (vector unsigned char)(8,9,10,11,24,25,26,27,8,9,10,11,24,25,26,27); vector unsigned char vecFourth = (vector unsigned char)(12,13,14,15,28,29,30,31,12,13,14,15,28,29,30,31); - + constVec = (vector float)(32768.0f); zeroVector = (vector float)(0.0); - + if ( kHz == 11025 ) { if ( numChannels == 1 ) { // calculate perm vector and do first load - vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); + vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); v10 = vec_ld( 0, &ogg[0][0] ); - + int i; for ( i = 0; i+7 < numSamples; i += 8 ) { // as it happens, ogg[0][i] through ogg[0][i+3] are contiguous in memory @@ -9587,18 +9587,18 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, v10 = vec_ld( 31, &ogg[0][i] ); v0 = vec_perm( v8, v9, vecPerm1 ); v1 = vec_perm( v9, v10, vecPerm1 ); - + // now we have the elements in a vector, we want // to splat them each accross their own vector oggVec1 = vec_splat( v0, 0 ); oggVec2 = vec_splat( v0, 1 ); oggVec3 = vec_splat( v0, 2 ); - oggVec4 = vec_splat( v0, 3 ); + oggVec4 = vec_splat( v0, 3 ); oggVec5 = vec_splat( v1, 0 ); oggVec6 = vec_splat( v1, 1 ); oggVec7 = vec_splat( v1, 2 ); oggVec8 = vec_splat( v1, 3 ); - + v0 = vec_madd( oggVec1, constVec, zeroVector ); v1 = vec_madd( oggVec2, constVec, zeroVector ); v2 = vec_madd( oggVec3, constVec, zeroVector ); @@ -9607,52 +9607,52 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, v5 = vec_madd( oggVec6, constVec, zeroVector ); v6 = vec_madd( oggVec7, constVec, zeroVector ); v7 = vec_madd( oggVec8, constVec, zeroVector ); - + //store results ALIGNED_STORE8( &dest[i*4], v0, v1, v2, v3, v4, v5, v6, v7 ); } - + //cleanup for ( ; i < numSamples; i++ ) { dest[i*4+0] = dest[i*4+1] = dest[i*4+2] = dest[i*4+3] = ogg[0][i] * 32768.0f; } - + } else { - - // calculate perm vec for ogg - vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); + + // calculate perm vec for ogg + vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); vecPerm2 = vec_add( vec_lvsl( -1, (int*) &ogg[1][0] ), (vector unsigned char)(1) ); v7 = vec_ld( 0, &ogg[1][0] ); v9 = vec_ld( 0, &ogg[0][0] ); int i; - + for ( i = 0; i+3 < numSamples >> 1; i+=4 ) { // +1 += 2 // load and splat from the array ( ogg[0][i] to ogg[0][i+3] ) v8 = v9; v9 = vec_ld( 15, &ogg[0][i] ); v0 = vec_perm( v8, v9, vecPerm1 ); - + // now we have the elements in a vector, we want // to splat them each accross their own vector oggVec1 = vec_splat( v0, 0 ); oggVec2 = vec_splat( v0, 1 ); oggVec3 = vec_splat( v0, 2 ); - oggVec4 = vec_splat( v0, 3 ); - + oggVec4 = vec_splat( v0, 3 ); + // load and splat from the array ( ogg[1][i] to ogg[1][i+3] ) v6 = v7; v7 = vec_ld( 15, &ogg[1][i] ); v1 = vec_perm( v6, v7, vecPerm2 ); - + // now we have the elements in a vector, we want // to splat them each accross their own vector oggVec5 = vec_splat( v1, 0 ); oggVec6 = vec_splat( v1, 1 ); oggVec7 = vec_splat( v1, 2 ); - oggVec8 = vec_splat( v1, 3 ); - - oggVec1 = vec_madd( oggVec1, constVec, zeroVector ); // ogg[0][i] * 32768 + oggVec8 = vec_splat( v1, 3 ); + + oggVec1 = vec_madd( oggVec1, constVec, zeroVector ); // ogg[0][i] * 32768 oggVec2 = vec_madd( oggVec2, constVec, zeroVector ); // ogg[0][i+1] * 32768 oggVec3 = vec_madd( oggVec3, constVec, zeroVector ); // ogg[0][i+2] * 32768 oggVec4 = vec_madd( oggVec4, constVec, zeroVector ); // ogg[0][i+3] * 32768 @@ -9660,23 +9660,23 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, oggVec6 = vec_madd( oggVec6, constVec, zeroVector ); // ogg[1][i+1] * 32768 oggVec7 = vec_madd( oggVec7, constVec, zeroVector ); // ogg[1][i+2] * 32768 oggVec8 = vec_madd( oggVec8, constVec, zeroVector ); // ogg[1][i+3] * 32768 - + //merge generates the interleaved pattern that we want and it //doesn't require a permute vector, so use that instead v0 = vec_mergeh( oggVec1, oggVec5 ); v1 = vec_mergel( oggVec1, oggVec5 ); v2 = vec_mergeh( oggVec2, oggVec6 ); v3 = vec_mergel( oggVec2, oggVec6 ); - + v4 = vec_mergeh( oggVec3, oggVec7 ); v5 = vec_mergel( oggVec3, oggVec7 ); v6 = vec_mergeh( oggVec4, oggVec8 ); v10 = vec_mergel( oggVec4, oggVec8 ); - + //store results ALIGNED_STORE8( &dest[i*8], v0, v1, v2, v3, v4, v5, v6, v10 ); } - + //cleanup for ( ; i < numSamples >> 1; i++ ) { dest[i*8+0] = dest[i*8+2] = dest[i*8+4] = dest[i*8+6] = ogg[0][i] * 32768.0f; @@ -9685,31 +9685,31 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, } } else if ( kHz == 22050 ) { if ( numChannels == 1 ) { - + // calculate perm vector and do first load - vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); + vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); v10 = vec_ld( 0, &ogg[0][0] ); - + int i; - - for ( i = 0; i+7 < numSamples; i += 8 ) { + + for ( i = 0; i+7 < numSamples; i += 8 ) { // load values from ogg v8 = v10; v9 = vec_ld( 15, &ogg[0][i] ); v10 = vec_ld( 31, &ogg[0][i] ); v0 = vec_perm( v8, v9, vecPerm1 ); v1 = vec_perm( v9, v10, vecPerm1 ); - - // multiply + + // multiply v0 = vec_madd( v0, constVec, zeroVector ); v1 = vec_madd( v1, constVec, zeroVector ); - + // permute into results vectors to store v5 = vec_perm( v0, v0, vecOneTwo ); - v6 = vec_perm( v0, v0, vecThreeFour); + v6 = vec_perm( v0, v0, vecThreeFour); v7 = vec_perm( v1, v1, vecOneTwo ); v8 = vec_perm( v1, v1, vecThreeFour ); - + //store results ALIGNED_STORE4( &dest[i*2], v5, v6, v7, v8 ); } @@ -9720,27 +9720,27 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, } else { // calculate perm vector and do first load - vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); - vecPerm2 = vec_add( vec_lvsl( -1, (int*) &ogg[1][0] ), (vector unsigned char)(1) ); + vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); + vecPerm2 = vec_add( vec_lvsl( -1, (int*) &ogg[1][0] ), (vector unsigned char)(1) ); v7 = vec_ld( 0, &ogg[1][0] ); - v9 = vec_ld( 0, &ogg[0][0] ); - + v9 = vec_ld( 0, &ogg[0][0] ); + int i; for ( i = 0; i+3 < numSamples >> 1; i += 4 ) { // load ogg[0][i] to ogg[0][i+4] v8 = v9; v9 = vec_ld( 15, &ogg[0][i] ); v0 = vec_perm( v8, v9, vecPerm1 ); - - // load ogg[1][i] to ogg[1][i+3] + + // load ogg[1][i] to ogg[1][i+3] v6 = v7; v7 = vec_ld( 15, &ogg[1][i] ); v1 = vec_perm( v6, v7, vecPerm2 ); - + // multiply v0 = vec_madd( v0, constVec, zeroVector ); v1 = vec_madd( v1, constVec, zeroVector ); - + // generate result vectors to store v2 = vec_perm( v0, v1, vecFirst ); v3 = vec_perm( v0, v1, vecSecond ); @@ -9760,58 +9760,58 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, if ( numChannels == 1 ) { // calculate perm vector and do first load vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); - + v9 = vec_ld( 0, &ogg[0][0] ); int i; - for ( i = 0; i+7 < numSamples; i += 8 ) { + for ( i = 0; i+7 < numSamples; i += 8 ) { // load values from ogg v8 = v9; v7 = vec_ld( 15, &ogg[0][i] ); v6 = v7; v9 = vec_ld( 31, &ogg[0][i] ); - + v0 = vec_perm( v8, v7, vecPerm1 ); v1 = vec_perm( v6, v9, vecPerm1 ); - + // multiply v0 = vec_madd( v0, constVec, zeroVector ); v1 = vec_madd( v1, constVec, zeroVector ); ALIGNED_STORE2( &dest[i], v0, v1 ); } - + // cleanup for ( ; i < numSamples; i++ ) { dest[i*1+0] = ogg[0][i] * 32768.0f; } } else { - + // calculate perm vector and do first load - vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); - vecPerm2 = vec_add( vec_lvsl( -1, (int*) &ogg[1][0] ), (vector unsigned char)(1) ); + vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); + vecPerm2 = vec_add( vec_lvsl( -1, (int*) &ogg[1][0] ), (vector unsigned char)(1) ); v7 = vec_ld( 0, &ogg[1][0] ); - v9 = vec_ld( 0, &ogg[0][0] ); + v9 = vec_ld( 0, &ogg[0][0] ); int i; - + for ( i = 0; i+3 < numSamples >> 1; i += 4 ) { v8 = v9; v9 = vec_ld( 15, &ogg[0][i] ); v0 = vec_perm( v8, v9, vecPerm1 ); - - // load ogg[1][i] to ogg[1][i+3] + + // load ogg[1][i] to ogg[1][i+3] v6 = v7; v7 = vec_ld( 15, &ogg[1][i] ); v1 = vec_perm( v6, v7, vecPerm2 ); - + // multiply v0 = vec_madd( v0, constVec, zeroVector ); v1 = vec_madd( v1, constVec, zeroVector ); - + // generate result vectors v2 = vec_mergeh( v0, v1 ); v3 = vec_mergel( v0, v1 ); - + // store results ALIGNED_STORE2( &dest[i*2], v2, v3 ); } @@ -9833,18 +9833,18 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, idSIMD_AltiVec::UpSampleOGGTo44kHz Duplicate samples for 44kHz output. - - Assumptions: + + Assumptions: No assumptions ============ */ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, const int numSamples, const int kHz, const int numChannels ) { - + register vector float oggVec1, oggVec2, oggVec3, oggVec4, oggVec5, oggVec6, oggVec7, oggVec8; register vector float constVec, zeroVector; register vector float v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10; vector unsigned char vecPerm1; - vector unsigned char vecPerm2; + vector unsigned char vecPerm2; vector unsigned char vecOneTwo = (vector unsigned char)(0,1,2,3,0,1,2,3,4,5,6,7,4,5,6,7); vector unsigned char vecThreeFour = (vector unsigned char)(8,9,10,11,8,9,10,11,12,13,14,15,12,13,14,15); @@ -9852,24 +9852,24 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, vector unsigned char vecSecond = (vector unsigned char)(4,5,6,7,20,21,22,23,4,5,6,7,20,21,22,23); vector unsigned char vecThird = (vector unsigned char)(8,9,10,11,24,25,26,27,8,9,10,11,24,25,26,27); vector unsigned char vecFourth = (vector unsigned char)(12,13,14,15,28,29,30,31,12,13,14,15,28,29,30,31); - + vector unsigned char storePerm; - + constVec = (vector float)(32768.0f); zeroVector = (vector float)(0.0); - + // calculate perm vector and masks for stores storePerm = vec_sub( vec_lvsr( 15, &dest[0] ), (vector unsigned char)(1) ); // original values of dest - vector float vecDest = vec_ld( 0, &dest[0] ); + vector float vecDest = vec_ld( 0, &dest[0] ); vector unsigned int mask = vec_perm( (vector unsigned int)(0), (vector unsigned int)(-1), storePerm ); - + if ( kHz == 11025 ) { if ( numChannels == 1 ) { // calculate perm vector and do first load - vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); + vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); v10 = vec_ld( 0, &ogg[0][0] ); - + int i; for ( i = 0; i+7 < numSamples; i += 8 ) { // as it happens, ogg[0][i] through ogg[0][i+3] are contiguous in memory @@ -9879,18 +9879,18 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, vector float vecDestEnd = vec_ld( 127, &dest[i*4] ); v0 = vec_perm( v8, v9, vecPerm1 ); v1 = vec_perm( v9, v10, vecPerm1 ); - + // now we have the elements in a vector, we want // to splat them each accross their own vector oggVec1 = vec_splat( v0, 0 ); oggVec2 = vec_splat( v0, 1 ); oggVec3 = vec_splat( v0, 2 ); - oggVec4 = vec_splat( v0, 3 ); + oggVec4 = vec_splat( v0, 3 ); oggVec5 = vec_splat( v1, 0 ); oggVec6 = vec_splat( v1, 1 ); oggVec7 = vec_splat( v1, 2 ); oggVec8 = vec_splat( v1, 3 ); - + v0 = vec_madd( oggVec1, constVec, zeroVector ); v1 = vec_madd( oggVec2, constVec, zeroVector ); v2 = vec_madd( oggVec3, constVec, zeroVector ); @@ -9899,7 +9899,7 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, v5 = vec_madd( oggVec6, constVec, zeroVector ); v6 = vec_madd( oggVec7, constVec, zeroVector ); v7 = vec_madd( oggVec8, constVec, zeroVector ); - + // rotate input data v0 = vec_perm( v0, v0, storePerm ); v1 = vec_perm( v1, v1, storePerm ); @@ -9909,7 +9909,7 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, v5 = vec_perm( v5, v5, storePerm ); v6 = vec_perm( v6, v6, storePerm ); v7 = vec_perm( v7, v7, storePerm ); - + // store results vec_st( vec_sel( vecDest, v0, mask ), 0, &dest[i*4] ); vec_st( vec_sel( v0, v1, mask ), 15, &dest[i*4] ); @@ -9922,48 +9922,48 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, vecDest = vec_sel( v7, vecDestEnd, mask ); vec_st( vecDest, 127, &dest[i*4] ); } - + //cleanup for ( ; i < numSamples; i++ ) { dest[i*4+0] = dest[i*4+1] = dest[i*4+2] = dest[i*4+3] = ogg[0][i] * 32768.0f; } - + } else { - - // calculate perm vec for ogg - vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); + + // calculate perm vec for ogg + vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); vecPerm2 = vec_add( vec_lvsl( -1, (int*) &ogg[1][0] ), (vector unsigned char)(1) ); v7 = vec_ld( 0, &ogg[1][0] ); v9 = vec_ld( 0, &ogg[0][0] ); int i; - - for ( i = 0; i+3 < numSamples >> 1; i+=4 ) { // +1 += 2 + + for ( i = 0; i+3 < numSamples >> 1; i+=4 ) { // +1 += 2 // load and splat from the array ( ogg[0][i] to ogg[0][i+3] ) v8 = v9; v9 = vec_ld( 15, &ogg[0][i] ); vector float vecDestEnd = vec_ld( 127, &dest[i*8] ); v0 = vec_perm( v8, v9, vecPerm1 ); - + // now we have the elements in a vector, we want // to splat them each accross their own vector oggVec1 = vec_splat( v0, 0 ); oggVec2 = vec_splat( v0, 1 ); oggVec3 = vec_splat( v0, 2 ); - oggVec4 = vec_splat( v0, 3 ); - + oggVec4 = vec_splat( v0, 3 ); + // load and splat from the array ( ogg[1][i] to ogg[1][i+3] ) v6 = v7; v7 = vec_ld( 15, &ogg[1][i] ); v1 = vec_perm( v6, v7, vecPerm2 ); - + // now we have the elements in a vector, we want // to splat them each accross their own vector oggVec5 = vec_splat( v1, 0 ); oggVec6 = vec_splat( v1, 1 ); oggVec7 = vec_splat( v1, 2 ); - oggVec8 = vec_splat( v1, 3 ); - - oggVec1 = vec_madd( oggVec1, constVec, zeroVector ); // ogg[0][i] * 32768 + oggVec8 = vec_splat( v1, 3 ); + + oggVec1 = vec_madd( oggVec1, constVec, zeroVector ); // ogg[0][i] * 32768 oggVec2 = vec_madd( oggVec2, constVec, zeroVector ); // ogg[0][i+1] * 32768 oggVec3 = vec_madd( oggVec3, constVec, zeroVector ); // ogg[0][i+2] * 32768 oggVec4 = vec_madd( oggVec4, constVec, zeroVector ); // ogg[0][i+3] * 32768 @@ -9971,19 +9971,19 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, oggVec6 = vec_madd( oggVec6, constVec, zeroVector ); // ogg[1][i+1] * 32768 oggVec7 = vec_madd( oggVec7, constVec, zeroVector ); // ogg[1][i+2] * 32768 oggVec8 = vec_madd( oggVec8, constVec, zeroVector ); // ogg[1][i+3] * 32768 - + //merge generates the interleaved pattern that we want and it //doesn't require a permute vector, so use that instead v0 = vec_mergeh( oggVec1, oggVec5 ); v1 = vec_mergel( oggVec1, oggVec5 ); v2 = vec_mergeh( oggVec2, oggVec6 ); v3 = vec_mergel( oggVec2, oggVec6 ); - + v4 = vec_mergeh( oggVec3, oggVec7 ); v5 = vec_mergel( oggVec3, oggVec7 ); v6 = vec_mergeh( oggVec4, oggVec8 ); v10 = vec_mergel( oggVec4, oggVec8 ); - + // rotate input data v0 = vec_perm( v0, v0, storePerm ); v1 = vec_perm( v1, v1, storePerm ); @@ -9993,7 +9993,7 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, v5 = vec_perm( v5, v5, storePerm ); v6 = vec_perm( v6, v6, storePerm ); v10 = vec_perm( v10, v10, storePerm ); - + // store results vec_st( vec_sel( vecDest, v0, mask ), 0, &dest[i*8] ); vec_st( vec_sel( v0, v1, mask ), 15, &dest[i*8] ); @@ -10004,9 +10004,9 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, vec_st( vec_sel( v5, v6, mask ), 95, &dest[i*8] ); vec_st( vec_sel( v6, v10, mask ), 111, &dest[i*8] ); vecDest = vec_sel( v10, vecDestEnd, mask ); - vec_st( vecDest, 127, &dest[i*8] ); + vec_st( vecDest, 127, &dest[i*8] ); } - + //cleanup for ( ; i < numSamples >> 1; i++ ) { dest[i*8+0] = dest[i*8+2] = dest[i*8+4] = dest[i*8+6] = ogg[0][i] * 32768.0f; @@ -10015,15 +10015,15 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, } } else if ( kHz == 22050 ) { if ( numChannels == 1 ) { - + // calculate perm vector and do first load - vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); + vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); v10 = vec_ld( 0, &ogg[0][0] ); - + int i; - + for ( i = 0; i+7 < numSamples; i += 8 ) { - + // load values from ogg v8 = v10; v9 = vec_ld( 15, &ogg[0][i] ); @@ -10031,23 +10031,23 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, vector float vecDestEnd = vec_ld( 63, &dest[i*2] ); v0 = vec_perm( v8, v9, vecPerm1 ); v1 = vec_perm( v9, v10, vecPerm1 ); - - // multiply + + // multiply v0 = vec_madd( v0, constVec, zeroVector ); v1 = vec_madd( v1, constVec, zeroVector ); - + // permute into results vectors to store v5 = vec_perm( v0, v0, vecOneTwo ); - v6 = vec_perm( v0, v0, vecThreeFour); + v6 = vec_perm( v0, v0, vecThreeFour); v7 = vec_perm( v1, v1, vecOneTwo ); v8 = vec_perm( v1, v1, vecThreeFour ); - + // rotate input data v5 = vec_perm( v5, v5, storePerm ); v6 = vec_perm( v6, v6, storePerm ); v7 = vec_perm( v7, v7, storePerm ); v8 = vec_perm( v8, v8, storePerm ); - + // store results vec_st( vec_sel( vecDest, v5, mask ), 0, &dest[i*2] ); vec_st( vec_sel( v5, v6, mask ), 15, &dest[i*2] ); @@ -10064,11 +10064,11 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, } else { // calculate perm vector and do first load - vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); - vecPerm2 = vec_add( vec_lvsl( -1, (int*) &ogg[1][0] ), (vector unsigned char)(1) ); + vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); + vecPerm2 = vec_add( vec_lvsl( -1, (int*) &ogg[1][0] ), (vector unsigned char)(1) ); v7 = vec_ld( 0, &ogg[1][0] ); - v9 = vec_ld( 0, &ogg[0][0] ); - + v9 = vec_ld( 0, &ogg[0][0] ); + int i; for ( i = 0; i+3 < numSamples >> 1; i += 4 ) { // load ogg[0][i] to ogg[0][i+4] @@ -10076,28 +10076,28 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, v9 = vec_ld( 15, &ogg[0][i] ); vector float vecDestEnd = vec_ld( 63, &dest[i*4] ); v0 = vec_perm( v8, v9, vecPerm1 ); - - // load ogg[1][i] to ogg[1][i+3] + + // load ogg[1][i] to ogg[1][i+3] v6 = v7; v7 = vec_ld( 15, &ogg[1][i] ); v1 = vec_perm( v6, v7, vecPerm2 ); - + // multiply v0 = vec_madd( v0, constVec, zeroVector ); v1 = vec_madd( v1, constVec, zeroVector ); - + // generate result vectors to store v2 = vec_perm( v0, v1, vecFirst ); v3 = vec_perm( v0, v1, vecSecond ); v4 = vec_perm( v0, v1, vecThird ); v5 = vec_perm( v0, v1, vecFourth ); - + // rotate input data v2 = vec_perm( v2, v2, storePerm ); v3 = vec_perm( v3, v3, storePerm ); v4 = vec_perm( v4, v4, storePerm ); v5 = vec_perm( v5, v5, storePerm ); - + // store results vec_st( vec_sel( vecDest, v2, mask ), 0, &dest[i*4] ); vec_st( vec_sel( v2, v3, mask ), 15, &dest[i*4] ); @@ -10106,7 +10106,7 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, vecDest = vec_sel( v5, vecDestEnd, mask ); vec_st( vecDest, 63, &dest[i*4] ); } - + // cleanup for ( ; i < numSamples >> 1; i++ ) { dest[i*4+0] = dest[i*4+2] = ogg[0][i] * 32768.0f; @@ -10117,67 +10117,67 @@ void idSIMD_AltiVec::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, if ( numChannels == 1 ) { // calculate perm vector and do first load vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); - + v9 = vec_ld( 0, &ogg[0][0] ); int i; - for ( i = 0; i+7 < numSamples; i += 8 ) { + for ( i = 0; i+7 < numSamples; i += 8 ) { // load values from ogg v8 = v9; v7 = vec_ld( 15, &ogg[0][i] ); v6 = v7; v9 = vec_ld( 31, &ogg[0][i] ); vector float vecDestEnd = vec_ld( 31, &dest[i] ); - + v0 = vec_perm( v8, v7, vecPerm1 ); v1 = vec_perm( v6, v9, vecPerm1 ); - + // multiply v0 = vec_madd( v0, constVec, zeroVector ); v1 = vec_madd( v1, constVec, zeroVector ); - + // rotate data v0 = vec_perm( v0, v0, storePerm ); v1 = vec_perm( v1, v1, storePerm ); - + // store results vec_st( vec_sel( vecDest, v0, mask ), 0, &dest[i] ); vec_st( vec_sel( v0, v1, mask ), 15, &dest[i] ); vecDest = vec_sel( v1, vecDestEnd, mask ); vec_st( vecDest, 31, &dest[i] ); } - + // cleanup for ( ; i < numSamples; i++ ) { dest[i*1+0] = ogg[0][i] * 32768.0f; } } else { - + // calculate perm vector and do first load - vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); - vecPerm2 = vec_add( vec_lvsl( -1, (int*) &ogg[1][0] ), (vector unsigned char)(1) ); + vecPerm1 = vec_add( vec_lvsl( -1, (int*) &ogg[0][0] ), (vector unsigned char)(1) ); + vecPerm2 = vec_add( vec_lvsl( -1, (int*) &ogg[1][0] ), (vector unsigned char)(1) ); v7 = vec_ld( 0, &ogg[1][0] ); - v9 = vec_ld( 0, &ogg[0][0] ); + v9 = vec_ld( 0, &ogg[0][0] ); int i; - + for ( i = 0; i+3 < numSamples >> 1; i += 4 ) { v8 = v9; v9 = vec_ld( 15, &ogg[0][i] ); v0 = vec_perm( v8, v9, vecPerm1 ); - - // load ogg[1][i] to ogg[1][i+3] + + // load ogg[1][i] to ogg[1][i+3] v6 = v7; v7 = vec_ld( 15, &ogg[1][i] ); v1 = vec_perm( v6, v7, vecPerm2 ); - + // multiply v0 = vec_madd( v0, constVec, zeroVector ); v1 = vec_madd( v1, constVec, zeroVector ); - + // generate result vectors v2 = vec_mergeh( v0, v1 ); v3 = vec_mergel( v0, v1 ); - + // store results UNALIGNED_STORE2( &dest[i*2], v2, v3 ); } @@ -10206,7 +10206,7 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerMono( float *mixBuffer, const floa // mixBuffer is aligned assert( IS_16BYTE_ALIGNED( mixBuffer[0] ) ); - + int i; float inc[2]; float spkr[4]; @@ -10216,16 +10216,16 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerMono( float *mixBuffer, const floa register vector float vecMixBuffer1, vecMixBuffer2, vecMixBuffer3, vecMixBuffer4; register vector float vecSamplesLd1, vecSamplesLd2; register vector float vecSamples1, vecSamples2, vecSamples3, vecSamples4; - + register vector unsigned char permVec1 = (vector unsigned char)(0,1,2,3,0,1,2,3,4,5,6,7,4,5,6,7); //0,0,1,1 register vector unsigned char permVec2 = (vector unsigned char)(8,9,10,11,8,9,10,11,12,13,14,15,12,13,14,15); //2,2,3,3 register vector unsigned char permVec3 = (vector unsigned char)(16,17,18,19,16,17,18,19,20,21,22,23,20,21,22,23); //4,4,5,5 register vector unsigned char permVec4 = (vector unsigned char)(24,25,26,27,24,25,26,27,28,29,30,31,28,29,30,31); //6,6,7,7 - + //constants vector float fourVec = (vector float)(4.0); vector float zeroVec = (vector float)(0.0); - + inc[0] = ( currentV[0] - lastV[0] ) / MIXBUFFER_SAMPLES; inc[1] = ( currentV[1] - lastV[1] ) / MIXBUFFER_SAMPLES; @@ -10235,7 +10235,7 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerMono( float *mixBuffer, const floa spkr[3] = lastV[1] + inc[1]; assert( numSamples == MIXBUFFER_SAMPLES ); - + inc[0] *= 2; inc[1] *= 2; @@ -10243,25 +10243,25 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerMono( float *mixBuffer, const floa vector float v0 = loadSplatUnalignedScalar( &inc[0] ); vector float v1 = loadSplatUnalignedScalar( &inc[1] ); vecInc = vec_mergeh( v0, v1 ); - + vector float v2 = loadSplatUnalignedScalar( &spkr[0] ); vector float v3 = loadSplatUnalignedScalar( &spkr[1] ); vector float v4 = loadSplatUnalignedScalar( &spkr[2] ); vector float v5 = loadSplatUnalignedScalar( &spkr[3] ); - + // load spkr array v0 = vec_mergeh( v2, v4 ); v1 = vec_mergeh( v3, v5 ); vecSpeaker1 = vec_mergeh( v0, v1 ); - + vecSpeaker2 = vec_add( vecSpeaker1, vecInc ); vecSpeaker3 = vec_add( vecSpeaker2, vecInc ); vecSpeaker4 = vec_add( vecSpeaker3, vecInc ); vecInc = vec_madd( vecInc, fourVec, zeroVec ); - + vector unsigned char samplesPerm = vec_add( vec_lvsl( -1, &samples[0] ), (vector unsigned char)(1) ); vector float vecSamplesLast = vec_ld( 0, &samples[0] ); - + //since MIXBUFFER_SAMPLES is a multiple of 8, we don't //need a cleanup loop for( i=0 ; i+7 < MIXBUFFER_SAMPLES; i += 8 ) { @@ -10270,10 +10270,10 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerMono( float *mixBuffer, const floa vecSamplesLd1 = vecSamplesLast; //vec_ld( 0, &samples[i] ); vecSamplesLd2 = vec_ld( 15, &samples[i] ); vecSamplesLast = vec_ld( 31, &samples[i] ); - + vecSamplesLd1 = vec_perm( vecSamplesLd1, vecSamplesLd2, samplesPerm ); vecSamplesLd2 = vec_perm( vecSamplesLd2, vecSamplesLast, samplesPerm ); - + vecMixBuffer1 = vec_ld( 0, &mixBuffer[i*2] ); vecMixBuffer2 = vec_ld( 0, &mixBuffer[i*2+4] ); vecMixBuffer3 = vec_ld( 0, &mixBuffer[i*2+8] ); @@ -10288,10 +10288,10 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerMono( float *mixBuffer, const floa vecMixBuffer2 = vec_madd( vecSamples2, vecSpeaker2, vecMixBuffer2 ); vecMixBuffer3 = vec_madd( vecSamples3, vecSpeaker3, vecMixBuffer3 ); vecMixBuffer4 = vec_madd( vecSamples4, vecSpeaker4, vecMixBuffer4 ); - + // store results ALIGNED_STORE4( &mixBuffer[i*2], vecMixBuffer1, vecMixBuffer2, vecMixBuffer3, vecMixBuffer4 ); - + //add for next iteration vecSpeaker1 = vec_add( vecSpeaker1, vecInc ); vecSpeaker2 = vec_add( vecSpeaker2, vecInc ); @@ -10311,7 +10311,7 @@ idSIMD_AltiVec::MixSoundTwoSpeakerMono ============ */ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerMono( float *mixBuffer, const float *samples, const int numSamples, const float lastV[2], const float currentV[2] ) { - + int i; float inc[2]; float spkr[4]; @@ -10321,16 +10321,16 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerMono( float *mixBuffer, const floa register vector float vecMixBuffer1, vecMixBuffer2, vecMixBuffer3, vecMixBuffer4; register vector float vecSamplesLd1, vecSamplesLd2; register vector float vecSamples1, vecSamples2, vecSamples3, vecSamples4; - + register vector unsigned char permVec1 = (vector unsigned char)(0,1,2,3,0,1,2,3,4,5,6,7,4,5,6,7); //0,0,1,1 register vector unsigned char permVec2 = (vector unsigned char)(8,9,10,11,8,9,10,11,12,13,14,15,12,13,14,15); //2,2,3,3 register vector unsigned char permVec3 = (vector unsigned char)(16,17,18,19,16,17,18,19,20,21,22,23,20,21,22,23); //4,4,5,5 register vector unsigned char permVec4 = (vector unsigned char)(24,25,26,27,24,25,26,27,28,29,30,31,28,29,30,31); //6,6,7,7 - + //constants vector float fourVec = (vector float)(4.0); vector float zeroVec = (vector float)(0.0); - + inc[0] = ( currentV[0] - lastV[0] ) / MIXBUFFER_SAMPLES; inc[1] = ( currentV[1] - lastV[1] ) / MIXBUFFER_SAMPLES; @@ -10340,7 +10340,7 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerMono( float *mixBuffer, const floa spkr[3] = lastV[1] + inc[1]; assert( numSamples == MIXBUFFER_SAMPLES ); - + inc[0] *= 2; inc[1] *= 2; @@ -10348,12 +10348,12 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerMono( float *mixBuffer, const floa vector float v0 = loadSplatUnalignedScalar( &inc[0] ); vector float v1 = loadSplatUnalignedScalar( &inc[1] ); vecInc = vec_mergeh( v0, v1 ); - + vector float v2 = loadSplatUnalignedScalar( &spkr[0] ); vector float v3 = loadSplatUnalignedScalar( &spkr[1] ); vector float v4 = loadSplatUnalignedScalar( &spkr[2] ); vector float v5 = loadSplatUnalignedScalar( &spkr[3] ); - + // load spkr array v0 = vec_mergeh( v2, v4 ); v1 = vec_mergeh( v3, v5 ); @@ -10363,24 +10363,24 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerMono( float *mixBuffer, const floa vecSpeaker3 = vec_add( vecSpeaker2, vecInc ); vecSpeaker4 = vec_add( vecSpeaker3, vecInc ); vecInc = vec_madd( vecInc, fourVec, zeroVec ); - + vector unsigned char samplesPerm = vec_add( vec_lvsl( -1, &samples[0] ), (vector unsigned char)(1) ); vector unsigned char mixBufferPerm = vec_add( vec_lvsl( -1, &mixBuffer[0]), (vector unsigned char)(1) ); - vector float vecSamplesLast = vec_ld( 0, &samples[0] ); + vector float vecSamplesLast = vec_ld( 0, &samples[0] ); vector float vecDest = vec_ld( 0, &mixBuffer[0] ); - + //since MIXBUFFER_SAMPLES is a multiple of 8, we don't //need a cleanup loop for( i=0 ; i+7 < MIXBUFFER_SAMPLES; i += 8 ) { //load samples and mix buffers - vecSamplesLd1 = vecSamplesLast; + vecSamplesLd1 = vecSamplesLast; vecSamplesLd2 = vec_ld( 15, &samples[i] ); vecSamplesLast = vec_ld( 31, &samples[i] ); - + vecSamplesLd1 = vec_perm( vecSamplesLd1, vecSamplesLd2, samplesPerm ); vecSamplesLd2 = vec_perm( vecSamplesLd2, vecSamplesLast, samplesPerm ); - + vecMixBuffer1 = vecDest; vecMixBuffer2 = vec_ld( 15, &mixBuffer[i*2] ); vecMixBuffer3 = vec_ld( 31, &mixBuffer[i*2] ); @@ -10401,10 +10401,10 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerMono( float *mixBuffer, const floa vecMixBuffer2 = vec_madd( vecSamples2, vecSpeaker2, vecMixBuffer2 ); vecMixBuffer3 = vec_madd( vecSamples3, vecSpeaker3, vecMixBuffer3 ); vecMixBuffer4 = vec_madd( vecSamples4, vecSpeaker4, vecMixBuffer4 ); - + // store results - UNALIGNED_STORE4( &mixBuffer[i*2], vecMixBuffer1, vecMixBuffer2, vecMixBuffer3, vecMixBuffer4 ); - + UNALIGNED_STORE4( &mixBuffer[i*2], vecMixBuffer1, vecMixBuffer2, vecMixBuffer3, vecMixBuffer4 ); + //add for next iteration vecSpeaker1 = vec_add( vecSpeaker1, vecInc ); vecSpeaker2 = vec_add( vecSpeaker2, vecInc ); @@ -10427,11 +10427,11 @@ idSIMD_AltiVec::MixSoundTwoSpeakerStereo void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerStereo( float *mixBuffer, const float *samples, const int numSamples, const float lastV[2], const float currentV[2] ) { // mixBuffer is aligned assert( IS_16BYTE_ALIGNED( mixBuffer[0] ) ); - + int i, k; float inc[2]; float spkr[4]; - + // loading buffers register vector float vecMixBuffer1, vecMixBuffer2, vecMixBuffer3, vecMixBuffer4; // loading buffers @@ -10440,7 +10440,7 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerStereo( float *mixBuffer, const fl register vector float vecInc; vector float fourVec = (vector float)(4.0); vector float zeroVec = (vector float)(0.0); - + assert( numSamples == MIXBUFFER_SAMPLES ); inc[0] = ( currentV[0] - lastV[0] ) / MIXBUFFER_SAMPLES; @@ -10459,12 +10459,12 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerStereo( float *mixBuffer, const fl vector float v0 = loadSplatUnalignedScalar( &inc[0] ); vector float v1 = loadSplatUnalignedScalar( &inc[1] ); vecInc = vec_mergeh( v0, v1 ); - + vector float v2 = loadSplatUnalignedScalar( &spkr[0] ); vector float v3 = loadSplatUnalignedScalar( &spkr[1] ); vector float v4 = loadSplatUnalignedScalar( &spkr[2] ); vector float v5 = loadSplatUnalignedScalar( &spkr[3] ); - + // load spkr array v0 = vec_mergeh( v2, v4 ); v1 = vec_mergeh( v3, v5 ); @@ -10474,35 +10474,35 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerStereo( float *mixBuffer, const fl vecSpeaker3 = vec_add( vecSpeaker2, vecInc ); vecSpeaker4 = vec_add( vecSpeaker3, vecInc ); vecInc = vec_madd( vecInc, fourVec, zeroVec ); - + vector unsigned char samplesPerm = vec_add( vec_lvsl( -1, &samples[0] ), (vector unsigned char)(1) ); vector float vecSamplesLast = vec_ld( 0, &samples[0] ); - + //since MIXBUFFER_SAMPLES is a multiple of 8, we don't //need a cleanup loop - for( i = 0 ; i+7 < MIXBUFFER_SAMPLES; i += 8 ) { + for( i = 0 ; i+7 < MIXBUFFER_SAMPLES; i += 8 ) { // load mix buffers and samples vecMixBuffer1 = vec_ld( 0, &mixBuffer[i*2] ); vecMixBuffer2 = vec_ld( 0, &mixBuffer[i*2+4] ); vecMixBuffer3 = vec_ld( 0, &mixBuffer[i*2+8] ); vecMixBuffer4 = vec_ld( 0, &mixBuffer[i*2+12] ); - - vecSamples1 = vecSamplesLast; + + vecSamples1 = vecSamplesLast; vecSamples2 = vec_ld( 15, &samples[i*2] ); vecSamples3 = vec_ld( 31, &samples[i*2] ); vecSamples4 = vec_ld( 47, &samples[i*2] ); vecSamplesLast = vec_ld( 63, &samples[i*2] ); - + vecSamples1 = vec_perm( vecSamples1, vecSamples2, samplesPerm ); vecSamples2 = vec_perm( vecSamples2, vecSamples3, samplesPerm ); vecSamples3 = vec_perm( vecSamples3, vecSamples4, samplesPerm ); vecSamples4 = vec_perm( vecSamples4, vecSamplesLast, samplesPerm ); - + vecMixBuffer1 = vec_madd( vecSamples1, vecSpeaker1, vecMixBuffer1 ); vecMixBuffer2 = vec_madd( vecSamples2, vecSpeaker2, vecMixBuffer2 ); vecMixBuffer3 = vec_madd( vecSamples3, vecSpeaker3, vecMixBuffer3 ); vecMixBuffer4 = vec_madd( vecSamples4, vecSpeaker4, vecMixBuffer4 ); - + vecSpeaker1 = vec_add( vecSpeaker1, vecInc ); vecSpeaker2 = vec_add( vecSpeaker2, vecInc ); vecSpeaker3 = vec_add( vecSpeaker3, vecInc ); @@ -10523,7 +10523,7 @@ idSIMD_AltiVec::MixSoundTwoSpeakerStereo ============ */ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerStereo( float *mixBuffer, const float *samples, const int numSamples, const float lastV[2], const float currentV[2] ) { - + int i, k; float inc[2]; float spkr[4]; @@ -10535,7 +10535,7 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerStereo( float *mixBuffer, const fl register vector float vecInc; vector float fourVec = (vector float)(4.0); vector float zeroVec = (vector float)(0.0); - + assert( numSamples == MIXBUFFER_SAMPLES ); inc[0] = ( currentV[0] - lastV[0] ) / MIXBUFFER_SAMPLES; @@ -10554,12 +10554,12 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerStereo( float *mixBuffer, const fl vector float v0 = loadSplatUnalignedScalar( &inc[0] ); vector float v1 = loadSplatUnalignedScalar( &inc[1] ); vecInc = vec_mergeh( v0, v1 ); - + vector float v2 = loadSplatUnalignedScalar( &spkr[0] ); vector float v3 = loadSplatUnalignedScalar( &spkr[1] ); vector float v4 = loadSplatUnalignedScalar( &spkr[2] ); vector float v5 = loadSplatUnalignedScalar( &spkr[3] ); - + // load spkr array v0 = vec_mergeh( v2, v4 ); v1 = vec_mergeh( v3, v5 ); @@ -10569,17 +10569,17 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerStereo( float *mixBuffer, const fl vecSpeaker3 = vec_add( vecSpeaker2, vecInc ); vecSpeaker4 = vec_add( vecSpeaker3, vecInc ); vecInc = vec_madd( vecInc, fourVec, zeroVec ); - + vector unsigned char samplesPerm = vec_add( vec_lvsl( -1, &samples[0] ), (vector unsigned char)(1) ); vector unsigned char mixBufferPerm = vec_add( vec_lvsl( -1, &mixBuffer[0] ), (vector unsigned char)(1) ); vector float vecSamplesLast = vec_ld( 0, &samples[0] ); vector float vecDest = vec_ld( 0, &mixBuffer[0] ); - + //since MIXBUFFER_SAMPLES is a multiple of 8, we don't //need a cleanup loop - for( i = 0 ; i+7 < MIXBUFFER_SAMPLES; i += 8 ) { + for( i = 0 ; i+7 < MIXBUFFER_SAMPLES; i += 8 ) { // load mix buffers and samples - vecMixBuffer1 = vecDest; + vecMixBuffer1 = vecDest; vecMixBuffer2 = vec_ld( 15, &mixBuffer[i*2] ); vecMixBuffer3 = vec_ld( 31, &mixBuffer[i*2] ); vecMixBuffer4 = vec_ld( 47, &mixBuffer[i*2] ); @@ -10589,23 +10589,23 @@ void VPCALL idSIMD_AltiVec::MixSoundTwoSpeakerStereo( float *mixBuffer, const fl vecMixBuffer2 = vec_perm( vecMixBuffer2, vecMixBuffer3, mixBufferPerm ); vecMixBuffer3 = vec_perm( vecMixBuffer3, vecMixBuffer4, mixBufferPerm ); vecMixBuffer4 = vec_perm( vecMixBuffer4, vecDestEnd, mixBufferPerm ); - - vecSamples1 = vecSamplesLast; + + vecSamples1 = vecSamplesLast; vecSamples2 = vec_ld( 15, &samples[i*2] ); vecSamples3 = vec_ld( 31, &samples[i*2] ); vecSamples4 = vec_ld( 47, &samples[i*2] ); vecSamplesLast = vec_ld( 63, &samples[i*2] ); - + vecSamples1 = vec_perm( vecSamples1, vecSamples2, samplesPerm ); vecSamples2 = vec_perm( vecSamples2, vecSamples3, samplesPerm ); vecSamples3 = vec_perm( vecSamples3, vecSamples4, samplesPerm ); vecSamples4 = vec_perm( vecSamples4, vecSamplesLast, samplesPerm ); - + vecMixBuffer1 = vec_madd( vecSamples1, vecSpeaker1, vecMixBuffer1 ); vecMixBuffer2 = vec_madd( vecSamples2, vecSpeaker2, vecMixBuffer2 ); vecMixBuffer3 = vec_madd( vecSamples3, vecSpeaker3, vecMixBuffer3 ); vecMixBuffer4 = vec_madd( vecSamples4, vecSpeaker4, vecMixBuffer4 ); - + vecSpeaker1 = vec_add( vecSpeaker1, vecInc ); vecSpeaker2 = vec_add( vecSpeaker2, vecInc ); vecSpeaker3 = vec_add( vecSpeaker3, vecInc ); @@ -10628,14 +10628,14 @@ idSIMD_AltiVec::MixSoundSixSpeakerMono ============ */ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const float *samples, const int numSamples, const float lastV[6], const float currentV[6] ) { - + // mixBuffer is aligned assert( IS_16BYTE_ALIGNED( mixBuffer[0] ) ); - + float incL[24]; float sL[24]; int i, k; - + vector float vecIncl1, vecIncl2, vecIncl3, vecIncl4, vecIncl5, vecIncl6, vecIncl7; vector float vecSL1, vecSL2, vecSL3, vecSL4, vecSL5, vecSL6, vecSL7; vector float vecSamplesLd; @@ -10648,15 +10648,15 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const floa assert( numSamples == MIXBUFFER_SAMPLES ); assert( SPEAKER_RIGHT == 1 ); assert( SPEAKER_BACKRIGHT == 5 ); - - // incL array, 6 elements repeated + + // incL array, 6 elements repeated incL[0] = incL[6] = incL[12] = incL[18] = ( currentV[0] - lastV[0] ) / MIXBUFFER_SAMPLES; incL[1] = incL[7] = incL[13] = incL[19] = ( currentV[1] - lastV[1] ) / MIXBUFFER_SAMPLES; incL[2] = incL[8] = incL[14] = incL[20] = ( currentV[2] - lastV[2] ) / MIXBUFFER_SAMPLES; incL[3] = incL[9] = incL[15] = incL[21] = ( currentV[3] - lastV[3] ) / MIXBUFFER_SAMPLES; incL[4] = incL[10] = incL[16] = incL[22] = ( currentV[4] - lastV[4] ) / MIXBUFFER_SAMPLES; incL[5] = incL[11] = incL[17] = incL[23] = ( currentV[5] - lastV[5] ) / MIXBUFFER_SAMPLES; - + // sL array repeated for ( k = 0; k < 6; k++ ) { sL[k] = lastV[k]; @@ -10670,16 +10670,16 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const floa for ( k = 18; k < 24; k++ ) { sL[k] = lastV[k-18] + incL[k] + incL[k] + incL[k]; } - + // multiply by 2 since doing 12 at a time for ( k = 0; k < 24; k++ ) { incL[k] *= 4; } //load the data - vector unsigned char incPerm = vec_add( vec_lvsl( -1, &incL[0] ), (vector unsigned char)(1) ); - vector unsigned char slPerm = vec_add( vec_lvsl( -1, &sL[0] ), (vector unsigned char)(1) ); - + vector unsigned char incPerm = vec_add( vec_lvsl( -1, &incL[0] ), (vector unsigned char)(1) ); + vector unsigned char slPerm = vec_add( vec_lvsl( -1, &sL[0] ), (vector unsigned char)(1) ); + vecIncl1 = vec_ld( 0, &incL[0] ); vecIncl2 = vec_ld( 15, &incL[0] ); vecIncl3 = vec_ld( 31, &incL[0] ); @@ -10687,14 +10687,14 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const floa vecIncl5 = vec_ld( 63, &incL[0] ); vecIncl6 = vec_ld( 79, &incL[0] ); vecIncl7 = vec_ld( 95, &incL[0] ); - + vecIncl1 = vec_perm( vecIncl1, vecIncl2, incPerm ); vecIncl2 = vec_perm( vecIncl2, vecIncl3, incPerm ); vecIncl3 = vec_perm( vecIncl3, vecIncl4, incPerm ); vecIncl4 = vec_perm( vecIncl4, vecIncl5, incPerm ); vecIncl5 = vec_perm( vecIncl5, vecIncl6, incPerm ); vecIncl6 = vec_perm( vecIncl6, vecIncl7, incPerm ); - + vecSL1 = vec_ld( 0, &sL[0] ); vecSL2 = vec_ld( 15, &sL[0] ); vecSL3 = vec_ld( 31, &sL[0] ); @@ -10702,14 +10702,14 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const floa vecSL5 = vec_ld( 63, &sL[0] ); vecSL6 = vec_ld( 79, &sL[0] ); vecSL7 = vec_ld( 95, &sL[0] ); - + vecSL1 = vec_perm( vecSL1, vecSL2, slPerm ); vecSL2 = vec_perm( vecSL2, vecSL3, slPerm ); vecSL3 = vec_perm( vecSL3, vecSL4, slPerm ); vecSL4 = vec_perm( vecSL4, vecSL5, slPerm ); vecSL5 = vec_perm( vecSL5, vecSL6, slPerm ); vecSL6 = vec_perm( vecSL6, vecSL7, slPerm ); - + vector unsigned char samplesPerm = vec_add( vec_lvsl( -1, &samples[0] ), (vector unsigned char)(1) ); vector float vecSamplesLast = vec_ld( 0, &samples[0] ); @@ -10724,12 +10724,12 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const floa vecMixBuffer4 = vec_ld( 0, &mixBuffer[(i*6)+12] ); vecMixBuffer5 = vec_ld( 0, &mixBuffer[(i*6)+16] ); vecMixBuffer6 = vec_ld( 0, &mixBuffer[(i*6)+20] ); - + //load samples into vector vector float vecSamplesLd2 = vec_ld( 15, &samples[i] ); vecSamplesLd = vec_perm( vecSamplesLast, vecSamplesLd2, samplesPerm ); - vecSamplesLast = vecSamplesLd2; - + vecSamplesLast = vecSamplesLd2; + //permute to get them ordered how we want vecSamples1 = vec_splat( vecSamplesLd, 0 ); vecSamples2 = vec_perm( vecSamplesLd, vecSamplesLd, samplePerm2 ); @@ -10745,7 +10745,7 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const floa vecMixBuffer4 = vec_madd( vecSamples4, vecSL4, vecMixBuffer4 ); vecMixBuffer5 = vec_madd( vecSamples5, vecSL5, vecMixBuffer5 ); vecMixBuffer6 = vec_madd( vecSamples6, vecSL6, vecMixBuffer6 ); - + //store out results ALIGNED_STORE6( &mixBuffer[i*6], vecMixBuffer1, vecMixBuffer2, vecMixBuffer3, vecMixBuffer4, vecMixBuffer5, vecMixBuffer6 ); @@ -10756,7 +10756,7 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const floa vecSL4 = vec_add( vecSL4, vecIncl4 ); vecSL5 = vec_add( vecSL5, vecIncl5 ); vecSL6 = vec_add( vecSL6, vecIncl6 ); - } + } } #else @@ -10769,7 +10769,7 @@ idSIMD_AltiVec::MixSoundSixSpeakerMono ============ */ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const float *samples, const int numSamples, const float lastV[6], const float currentV[6] ) { - + float incL[24]; float sL[24]; int i, k; @@ -10786,15 +10786,15 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const floa assert( numSamples == MIXBUFFER_SAMPLES ); assert( SPEAKER_RIGHT == 1 ); assert( SPEAKER_BACKRIGHT == 5 ); - - // incL array, 6 elements repeated + + // incL array, 6 elements repeated incL[0] = incL[6] = incL[12] = incL[18] = ( currentV[0] - lastV[0] ) / MIXBUFFER_SAMPLES; incL[1] = incL[7] = incL[13] = incL[19] = ( currentV[1] - lastV[1] ) / MIXBUFFER_SAMPLES; incL[2] = incL[8] = incL[14] = incL[20] = ( currentV[2] - lastV[2] ) / MIXBUFFER_SAMPLES; incL[3] = incL[9] = incL[15] = incL[21] = ( currentV[3] - lastV[3] ) / MIXBUFFER_SAMPLES; incL[4] = incL[10] = incL[16] = incL[22] = ( currentV[4] - lastV[4] ) / MIXBUFFER_SAMPLES; incL[5] = incL[11] = incL[17] = incL[23] = ( currentV[5] - lastV[5] ) / MIXBUFFER_SAMPLES; - + // sL array repeated for ( k = 0; k < 6; k++ ) { sL[k] = lastV[k]; @@ -10808,16 +10808,16 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const floa for ( k = 18; k < 24; k++ ) { sL[k] = lastV[k-18] + incL[k] + incL[k] + incL[k]; } - + // multiply by 2 since doing 12 at a time for ( k = 0; k < 24; k++ ) { incL[k] *= 4; } // load the data - vector unsigned char incPerm = vec_add( vec_lvsl( -1, &incL[0] ), (vector unsigned char)(1) ); - vector unsigned char slPerm = vec_add( vec_lvsl( -1, &sL[0] ), (vector unsigned char)(1) ); - + vector unsigned char incPerm = vec_add( vec_lvsl( -1, &incL[0] ), (vector unsigned char)(1) ); + vector unsigned char slPerm = vec_add( vec_lvsl( -1, &sL[0] ), (vector unsigned char)(1) ); + vecIncl1 = vec_ld( 0, &incL[0] ); vecIncl2 = vec_ld( 15, &incL[0] ); vecIncl3 = vec_ld( 31, &incL[0] ); @@ -10825,14 +10825,14 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const floa vecIncl5 = vec_ld( 63, &incL[0] ); vecIncl6 = vec_ld( 79, &incL[0] ); vecIncl7 = vec_ld( 95, &incL[0] ); - + vecIncl1 = vec_perm( vecIncl1, vecIncl2, incPerm ); vecIncl2 = vec_perm( vecIncl2, vecIncl3, incPerm ); vecIncl3 = vec_perm( vecIncl3, vecIncl4, incPerm ); vecIncl4 = vec_perm( vecIncl4, vecIncl5, incPerm ); vecIncl5 = vec_perm( vecIncl5, vecIncl6, incPerm ); vecIncl6 = vec_perm( vecIncl6, vecIncl7, incPerm ); - + vecSL1 = vec_ld( 0, &sL[0] ); vecSL2 = vec_ld( 15, &sL[0] ); vecSL3 = vec_ld( 31, &sL[0] ); @@ -10840,7 +10840,7 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const floa vecSL5 = vec_ld( 63, &sL[0] ); vecSL6 = vec_ld( 79, &sL[0] ); vecSL7 = vec_ld( 95, &sL[0] ); - + vecSL1 = vec_perm( vecSL1, vecSL2, slPerm ); vecSL2 = vec_perm( vecSL2, vecSL3, slPerm ); vecSL3 = vec_perm( vecSL3, vecSL4, slPerm ); @@ -10856,27 +10856,27 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const floa //since MIXBUFFER_SAMPLES is a multiple of 4, we don't //need a cleanup loop for( i = 0; i <= MIXBUFFER_SAMPLES - 4; i += 4 ) { - //load mix buffer into vectors - vecMixBuffer1 = vecDest; + //load mix buffer into vectors + vecMixBuffer1 = vecDest; vecMixBuffer2 = vec_ld( 15, &mixBuffer[i*6] ); vecMixBuffer3 = vec_ld( 31, &mixBuffer[i*6] ); vecMixBuffer4 = vec_ld( 47, &mixBuffer[i*6] ); vecMixBuffer5 = vec_ld( 63, &mixBuffer[i*6] ); vecMixBuffer6 = vec_ld( 79, &mixBuffer[i*6] ); vector float vecDestEnd = vec_ld( 95, &mixBuffer[i*6] ); - + vecMixBuffer1 = vec_perm( vecMixBuffer1, vecMixBuffer2, mixBufferPerm ); vecMixBuffer2 = vec_perm( vecMixBuffer2, vecMixBuffer3, mixBufferPerm ); vecMixBuffer3 = vec_perm( vecMixBuffer3, vecMixBuffer4, mixBufferPerm ); vecMixBuffer4 = vec_perm( vecMixBuffer4, vecMixBuffer5, mixBufferPerm ); vecMixBuffer5 = vec_perm( vecMixBuffer5, vecMixBuffer6, mixBufferPerm ); vecMixBuffer6 = vec_perm( vecMixBuffer6, vecDestEnd, mixBufferPerm ); - + //load samples into vector vector float vecSamplesLd2 = vec_ld( 15, &samples[i] ); vecSamplesLd = vec_perm( vecSamplesLast, vecSamplesLd2, samplesPerm ); - vecSamplesLast = vecSamplesLd2; - + vecSamplesLast = vecSamplesLd2; + //permute to get them ordered how we want vecSamples1 = vec_splat( vecSamplesLd, 0 ); vecSamples2 = vec_perm( vecSamplesLd, vecSamplesLd, samplePerm2 ); @@ -10892,7 +10892,7 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const floa vecMixBuffer4 = vec_madd( vecSamples4, vecSL4, vecMixBuffer4 ); vecMixBuffer5 = vec_madd( vecSamples5, vecSL5, vecMixBuffer5 ); vecMixBuffer6 = vec_madd( vecSamples6, vecSL6, vecMixBuffer6 ); - + // store results UNALIGNED_STORE6( &mixBuffer[i*6], vecMixBuffer1, vecMixBuffer2, vecMixBuffer3, vecMixBuffer4, vecMixBuffer5, vecMixBuffer6 ); @@ -10903,7 +10903,7 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerMono( float *mixBuffer, const floa vecSL4 = vec_add( vecSL4, vecIncl4 ); vecSL5 = vec_add( vecSL5, vecIncl5 ); vecSL6 = vec_add( vecSL6, vecIncl6 ); - } + } } #endif /* SOUND_DEST_ALIGNED */ @@ -10917,12 +10917,12 @@ idSIMD_AltiVec::MixSoundSixSpeakerStereo Assumes that mixBuffer starts at aligned address ============ */ - + void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerStereo( float *mixBuffer, const float *samples, const int numSamples, const float lastV[6], const float currentV[6] ) { // mixBuffer is aligned assert( IS_16BYTE_ALIGNED( mixBuffer[0] ) ); - + float incL[12]; float sL[12]; int i; @@ -10938,15 +10938,15 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerStereo( float *mixBuffer, const fl assert( numSamples == MIXBUFFER_SAMPLES ); assert( SPEAKER_RIGHT == 1 ); assert( SPEAKER_BACKRIGHT == 5 ); - - // incL array, 6 elements repeated + + // incL array, 6 elements repeated incL[0] = incL[6] = ( currentV[0] - lastV[0] ) / MIXBUFFER_SAMPLES; incL[1] = incL[7] = ( currentV[1] - lastV[1] ) / MIXBUFFER_SAMPLES; incL[2] = incL[8] = ( currentV[2] - lastV[2] ) / MIXBUFFER_SAMPLES; incL[3] = incL[9] = ( currentV[3] - lastV[3] ) / MIXBUFFER_SAMPLES; incL[4] = incL[10] = ( currentV[4] - lastV[4] ) / MIXBUFFER_SAMPLES; incL[5] = incL[11] = ( currentV[5] - lastV[5] ) / MIXBUFFER_SAMPLES; - + // sL array repeated sL[0] = lastV[0]; sL[1] = lastV[1]; @@ -10960,7 +10960,7 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerStereo( float *mixBuffer, const fl sL[9] = lastV[3] + incL[3]; sL[10] = lastV[4] + incL[4]; sL[11] = lastV[5] + incL[5]; - + // multiply by 2 since doing 12 at a time incL[0] *= 2; incL[1] *= 2; @@ -10974,43 +10974,43 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerStereo( float *mixBuffer, const fl incL[9] *= 2; incL[10] *= 2; incL[11] *= 2; - + //we aligned this data, so load it up - vector unsigned char incPerm = vec_add( vec_lvsl( -1, &incL[0] ), (vector unsigned char)(1) ); + vector unsigned char incPerm = vec_add( vec_lvsl( -1, &incL[0] ), (vector unsigned char)(1) ); vector unsigned char slPerm = vec_add( vec_lvsl( -1, &sL[0] ), (vector unsigned char)(1) ); vecIncl1 = vec_ld( 0, &incL[0] ); vecIncl2 = vec_ld( 15, &incL[0] ); vecIncl3 = vec_ld( 31, &incL[0] ); vecIncl4 = vec_ld( 47, &incL[0] ); - + vecIncl1 = vec_perm( vecIncl1, vecIncl2, incPerm ); vecIncl2 = vec_perm( vecIncl2, vecIncl3, incPerm ); vecIncl3 = vec_perm( vecIncl3, vecIncl4, incPerm ); - + vecSL1 = vec_ld( 0, &sL[0] ); vecSL2 = vec_ld( 15, &sL[0] ); vecSL3 = vec_ld( 31, &sL[0] ); vecSL4 = vec_ld( 47, &sL[0] ); - + vecSL1 = vec_perm( vecSL1, vecSL2, slPerm ); vecSL2 = vec_perm( vecSL2, vecSL3, slPerm ); vecSL3 = vec_perm( vecSL3, vecSL4, slPerm ); - + vector unsigned char samplesPerm = vec_add( vec_lvsl( -1, &samples[0] ), (vector unsigned char)(1) ); - vector float vecSamplesLast = vec_ld( 0, &samples[0] ); + vector float vecSamplesLast = vec_ld( 0, &samples[0] ); for( i = 0; i <= MIXBUFFER_SAMPLES - 2; i += 2 ) { - + //load mix buffer into vectors, assume aligned vecMixBuffer1 = vec_ld( 0, &mixBuffer[i*6] ); vecMixBuffer2 = vec_ld( 0, &mixBuffer[(i*6)+4] ); vecMixBuffer3 = vec_ld( 0, &mixBuffer[(i*6)+8] ); - + //load samples into vector vector float vecSamplesLd2 = vec_ld( 15, &samples[i*2] ); vecSamplesLd = vec_perm( vecSamplesLast, vecSamplesLd2, samplesPerm ); vecSamplesLast = vecSamplesLd2; - + //permute to get them ordered how we want. For the 2nd vector, //the order happens to be the same as the order we loaded them //in, so there's no need to permute that one @@ -11022,14 +11022,14 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerStereo( float *mixBuffer, const fl vecMixBuffer1 = vec_madd( vecSamples1, vecSL1, vecMixBuffer1 ); vecMixBuffer2 = vec_madd( vecSamples2, vecSL2, vecMixBuffer2 ); vecMixBuffer3 = vec_madd( vecSamples3, vecSL3, vecMixBuffer3 ); - + //store out results ALIGNED_STORE3( &mixBuffer[i*6], vecMixBuffer1, vecMixBuffer2, vecMixBuffer3 ); // add for next iteration vecSL1 = vec_add( vecSL1, vecIncl1 ); vecSL2 = vec_add( vecSL2, vecIncl2 ); - vecSL3 = vec_add( vecSL3, vecIncl3 ); + vecSL3 = vec_add( vecSL3, vecIncl3 ); } } #else @@ -11041,12 +11041,12 @@ idSIMD_AltiVec::MixSoundSixSpeakerStereo Assumptions: No assumptions ============ -*/ +*/ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerStereo( float *mixBuffer, const float *samples, const int numSamples, const float lastV[6], const float currentV[6] ) { - + float incL[12]; float sL[12]; - + int i; vector float vecIncl1, vecIncl2, vecIncl3, vecIncl4; vector float vecSL1, vecSL2, vecSL3, vecSL4; @@ -11060,15 +11060,15 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerStereo( float *mixBuffer, const fl assert( numSamples == MIXBUFFER_SAMPLES ); assert( SPEAKER_RIGHT == 1 ); assert( SPEAKER_BACKRIGHT == 5 ); - - // incL array, 6 elements repeated + + // incL array, 6 elements repeated incL[0] = incL[6] = ( currentV[0] - lastV[0] ) / MIXBUFFER_SAMPLES; incL[1] = incL[7] = ( currentV[1] - lastV[1] ) / MIXBUFFER_SAMPLES; incL[2] = incL[8] = ( currentV[2] - lastV[2] ) / MIXBUFFER_SAMPLES; incL[3] = incL[9] = ( currentV[3] - lastV[3] ) / MIXBUFFER_SAMPLES; incL[4] = incL[10] = ( currentV[4] - lastV[4] ) / MIXBUFFER_SAMPLES; incL[5] = incL[11] = ( currentV[5] - lastV[5] ) / MIXBUFFER_SAMPLES; - + // sL array repeated sL[0] = lastV[0]; sL[1] = lastV[1]; @@ -11082,7 +11082,7 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerStereo( float *mixBuffer, const fl sL[9] = lastV[3] + incL[3]; sL[10] = lastV[4] + incL[4]; sL[11] = lastV[5] + incL[5]; - + // multiply by 2 since doing 12 at a time incL[0] *= 2; incL[1] *= 2; @@ -11096,50 +11096,50 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerStereo( float *mixBuffer, const fl incL[9] *= 2; incL[10] *= 2; incL[11] *= 2; - + // load the data - vector unsigned char incPerm = vec_add( vec_lvsl( -1, &incL[0] ), (vector unsigned char)(1) ); + vector unsigned char incPerm = vec_add( vec_lvsl( -1, &incL[0] ), (vector unsigned char)(1) ); vector unsigned char slPerm = vec_add( vec_lvsl( -1, &sL[0] ), (vector unsigned char)(1) ); vecIncl1 = vec_ld( 0, &incL[0] ); vecIncl2 = vec_ld( 15, &incL[0] ); vecIncl3 = vec_ld( 31, &incL[0] ); vecIncl4 = vec_ld( 47, &incL[0] ); - + vecIncl1 = vec_perm( vecIncl1, vecIncl2, incPerm ); vecIncl2 = vec_perm( vecIncl2, vecIncl3, incPerm ); vecIncl3 = vec_perm( vecIncl3, vecIncl4, incPerm ); - + vecSL1 = vec_ld( 0, &sL[0] ); vecSL2 = vec_ld( 15, &sL[0] ); vecSL3 = vec_ld( 31, &sL[0] ); vecSL4 = vec_ld( 47, &sL[0] ); - + vecSL1 = vec_perm( vecSL1, vecSL2, slPerm ); vecSL2 = vec_perm( vecSL2, vecSL3, slPerm ); vecSL3 = vec_perm( vecSL3, vecSL4, slPerm ); vector unsigned char samplesPerm = vec_add( vec_lvsl( -1, &samples[0] ), (vector unsigned char)(1) ); vector unsigned char mixBufferPerm = vec_add( vec_lvsl( -1, &mixBuffer[0] ), (vector unsigned char)(1) ); - vector float vecSamplesLast = vec_ld( 0, &samples[0] ); + vector float vecSamplesLast = vec_ld( 0, &samples[0] ); vector float vecDest = vec_ld( 0, &mixBuffer[0] ); for( i = 0; i <= MIXBUFFER_SAMPLES - 2; i += 2 ) { - + //load mix buffer into vectors - vecMixBuffer1 = vecDest; + vecMixBuffer1 = vecDest; vecMixBuffer2 = vec_ld( 15, &mixBuffer[i*6] ); vecMixBuffer3 = vec_ld( 31, &mixBuffer[i*6] ); vector float vecDestEnd = vec_ld( 47, &mixBuffer[i*6] ); - + vecMixBuffer1 = vec_perm( vecMixBuffer1, vecMixBuffer2, mixBufferPerm ); vecMixBuffer2 = vec_perm( vecMixBuffer2, vecMixBuffer3, mixBufferPerm ); vecMixBuffer3 = vec_perm( vecMixBuffer3, vecDestEnd, mixBufferPerm ); - + //load samples into vector vector float vecSamplesLd2 = vec_ld( 15, &samples[i*2] ); vecSamplesLd = vec_perm( vecSamplesLast, vecSamplesLd2, samplesPerm ); vecSamplesLast = vecSamplesLd2; - + //permute to get them ordered how we want. For the 2nd vector, //the order happens to be the same as the order we loaded them //in, so there's no need to permute that one @@ -11151,14 +11151,14 @@ void VPCALL idSIMD_AltiVec::MixSoundSixSpeakerStereo( float *mixBuffer, const fl vecMixBuffer1 = vec_madd( vecSamples1, vecSL1, vecMixBuffer1 ); vecMixBuffer2 = vec_madd( vecSamples2, vecSL2, vecMixBuffer2 ); vecMixBuffer3 = vec_madd( vecSamples3, vecSL3, vecMixBuffer3 ); - + // store results UNALIGNED_STORE3( &mixBuffer[i*6], vecMixBuffer1, vecMixBuffer2, vecMixBuffer3 ); // add for next iteration vecSL1 = vec_add( vecSL1, vecIncl1 ); vecSL2 = vec_add( vecSL2, vecIncl2 ); - vecSL3 = vec_add( vecSL3, vecIncl3 ); + vecSL3 = vec_add( vecSL3, vecIncl3 ); } } @@ -11170,31 +11170,31 @@ idSIMD_AltiVec::MixedSoundToSamples ============ */ void VPCALL idSIMD_AltiVec::MixedSoundToSamples( short *samples, const float *mixBuffer, const int numSamples ) { - //this is basically a clamp for sound mixing - register vector float v0, v1, v2, v3, v4, v5, v6, v7; + //this is basically a clamp for sound mixing + register vector float v0, v1, v2, v3, v4, v5, v6, v7; register vector signed int vi0, vi1, vi2, vi3; register vector signed short vs0, vs1; - register vector float minVec, maxVec, constVec; - int i = 0; + register vector float minVec, maxVec, constVec; + int i = 0; - //unaligned at start, since samples is not 16-byte aligned - for ( ; NOT_16BYTE_ALIGNED( samples[i] ) && ( i < numSamples ); i++ ) { + //unaligned at start, since samples is not 16-byte aligned + for ( ; NOT_16BYTE_ALIGNED( samples[i] ) && ( i < numSamples ); i++ ) { samples[i] = mixBuffer[i] <= -32768.0f ? -32768 : mixBuffer[i] >= 32767.0f ? 32767 : (short) mixBuffer[i]; - } - - constVec = (vector float)(65536.0f); + } + + constVec = (vector float)(65536.0f); + + //splat min/max into a vector + minVec = (vector float)(-32768.0f); + maxVec = (vector float)(32767.0f); - //splat min/max into a vector - minVec = (vector float)(-32768.0f); - maxVec = (vector float)(32767.0f); - vector float vecOld = vec_ld( 0, &mixBuffer[i] ); vector unsigned char permVec = vec_add( vec_lvsl( -1, &mixBuffer[i] ), (vector unsigned char)(1) ); - - //vectorize! - for ( ; i+15 < numSamples; i += 16 ) { + + //vectorize! + for ( ; i+15 < numSamples; i += 16 ) { //load source - v0 = vecOld; + v0 = vecOld; v1 = vec_ld( 15, &mixBuffer[i] ); v2 = vec_ld( 31, &mixBuffer[i] ); v3 = vec_ld( 31, &mixBuffer[i] ); @@ -11204,35 +11204,35 @@ void VPCALL idSIMD_AltiVec::MixedSoundToSamples( short *samples, const float *mi v1 = vec_perm( v1, v2, permVec ); v2 = vec_perm( v2, v3, permVec ); v3 = vec_perm( v3, vecOld, permVec ); - + //apply minimum v4 = vec_max( v0, minVec ); v5 = vec_max( v1, minVec ); v6 = vec_max( v2, minVec ); v7 = vec_max( v3, minVec ); - + //apply maximum v4 = vec_min( v4, maxVec ); v5 = vec_min( v5, maxVec ); v6 = vec_min( v6, maxVec ); v7 = vec_min( v7, maxVec ); - + // convert floats to ints vi0 = vec_cts( v4, 0 ); vi1 = vec_cts( v5, 0 ); vi2 = vec_cts( v6, 0 ); vi3 = vec_cts( v7, 0 ); - + // pack ints into shorts vs0 = vec_pack( vi0, vi1 ); vs1 = vec_pack( vi2, vi3 ); ALIGNED_STORE2( &samples[i], vs0, vs1 ); - } - - //handle cleanup - for ( ; i < numSamples ; i++ ) { + } + + //handle cleanup + for ( ; i < numSamples ; i++ ) { samples[i] = mixBuffer[i] <= -32768.0f ? -32768 : mixBuffer[i] >= 32767.0f ? 32767 : (short) mixBuffer[i]; - } + } } #endif /* ENABLE_SOUND_ROUTINES */ diff --git a/idlib/math/Simd_AltiVec.h b/idlib/math/Simd_AltiVec.h index fcf04e9..e7bdac3 100644 --- a/idlib/math/Simd_AltiVec.h +++ b/idlib/math/Simd_AltiVec.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -40,7 +40,7 @@ If you have questions concerning this license or the applicable additional terms // Defines for enabling parts of the library // Turns on/off the simple math routines (add, sub, div, etc) -#define ENABLE_SIMPLE_MATH +#define ENABLE_SIMPLE_MATH // Turns on/off the dot routines #define ENABLE_DOT @@ -66,7 +66,7 @@ If you have questions concerning this license or the applicable additional terms // Turns on/off TracePointCull, DecalPointCull, and OverlayPoint // The Enable_Cull routines breaks the g_decals functionality, DecalPointCull is // the likely suspect. Bullet holes do not appear on the walls when this optimization -// is enabled. +// is enabled. //#define ENABLE_CULL // Turns on/off DeriveTriPlanes, DeriveTangents, DeriveUnsmoothedTangents, NormalizeTangents @@ -91,7 +91,7 @@ If you have questions concerning this license or the applicable additional terms // then we take a big performance hit from unaligned stores. //#define VERTEXCACHE_ALIGNED -// This turns on support for PPC intrinsics in the SIMD_AltiVec.cpp file. Right now it's only used for frsqrte. GCC +// This turns on support for PPC intrinsics in the SIMD_AltiVec.cpp file. Right now it's only used for frsqrte. GCC // supports these intrinsics but XLC does not. #define PPC_INTRINSICS @@ -114,17 +114,17 @@ public: #ifdef ENABLE_SIMPLE_MATH // Basic math, works for both aligned and unaligned data virtual void VPCALL Add( float *dst, const float constant, const float *src, const int count ); - virtual void VPCALL Add( float *dst, const float *src0, const float *src1, const int count ); + virtual void VPCALL Add( float *dst, const float *src0, const float *src1, const int count ); virtual void VPCALL Sub( float *dst, const float constant, const float *src, const int count ); virtual void VPCALL Sub( float *dst, const float *src0, const float *src1, const int count ); - virtual void VPCALL Mul( float *dst, const float constant, const float *src, const int count); + virtual void VPCALL Mul( float *dst, const float constant, const float *src, const int count); virtual void VPCALL Mul( float *dst, const float *src0, const float *src1, const int count ); virtual void VPCALL Div( float *dst, const float constant, const float *divisor, const int count ); - virtual void VPCALL Div( float *dst, const float *src0, const float *src1, const int count ); + virtual void VPCALL Div( float *dst, const float *src0, const float *src1, const int count ); virtual void VPCALL MulAdd( float *dst, const float constant, const float *src, const int count ); virtual void VPCALL MulAdd( float *dst, const float *src0, const float *src1, const int count ); virtual void VPCALL MulSub( float *dst, const float constant, const float *src, const int count ); - virtual void VPCALL MulSub( float *dst, const float *src0, const float *src1, const int count ); + virtual void VPCALL MulSub( float *dst, const float *src0, const float *src1, const int count ); #endif #ifdef ENABLE_DOT @@ -151,7 +151,7 @@ public: virtual void VPCALL CmpLE( byte *dst, const byte bitNum, const float *src0, const float constant, const int count ); #endif -#ifdef ENABLE_MINMAX +#ifdef ENABLE_MINMAX // Min/Max. Expects data structures in contiguous memory virtual void VPCALL MinMax( float &min, float &max, const float *src, const int count ); virtual void VPCALL MinMax( idVec2 &min, idVec2 &max, const idVec2 *src, const int count ); @@ -167,7 +167,7 @@ public: virtual void VPCALL ClampMax( float *dst, const float *src, const float max, const int count ); #endif - // These are already using memcpy and memset functions. Leaving default implementation + // These are already using memcpy and memset functions. Leaving default implementation // virtual void VPCALL Memcpy( void *dst, const void *src, const int count ); // virtual void VPCALL Memset( void *dst, const int val, const int count ); @@ -224,7 +224,7 @@ public: virtual void VPCALL DeriveTangents( idPlane *planes, idDrawVert *verts, const int numVerts, const int *indexes, const int numIndexes ); virtual void VPCALL DeriveUnsmoothedTangents( idDrawVert *verts, const dominantTri_s *dominantTris, const int numVerts ); virtual void VPCALL NormalizeTangents( idDrawVert *verts, const int numVerts ); -#endif +#endif #ifdef ENABLE_CREATE virtual void VPCALL CreateTextureSpaceLightVectors( idVec3 *lightVectors, const idVec3 &lightOrigin, const idDrawVert *verts, const int numVerts, const int *indexes, const int numIndexes ); diff --git a/idlib/math/Simd_Generic.cpp b/idlib/math/Simd_Generic.cpp index 9b8e60d..e5ad662 100644 --- a/idlib/math/Simd_Generic.cpp +++ b/idlib/math/Simd_Generic.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -2206,8 +2206,8 @@ bool VPCALL idSIMD_Generic::MatX_LDLTFactor( idMatX &mat, idVecX &invDiag, const sum = ptr[i]; for ( j = 0; j < i; j++ ) { d = ptr[j]; - v[j] = diagPtr[0] * d; - sum -= v[j] * d; + v[j] = diagPtr[0] * d; + sum -= v[j] * d; diagPtr += nc + 1; } diff --git a/idlib/math/Simd_Generic.h b/idlib/math/Simd_Generic.h index 31e0d9d..6af6b26 100644 --- a/idlib/math/Simd_Generic.h +++ b/idlib/math/Simd_Generic.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Simd_MMX.cpp b/idlib/math/Simd_MMX.cpp index 05482eb..ea02ae8 100644 --- a/idlib/math/Simd_MMX.cpp +++ b/idlib/math/Simd_MMX.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -68,22 +68,22 @@ MMX_Memcpy8B ================ */ void MMX_Memcpy8B( void *dest, const void *src, const int count ) { - _asm { - mov esi, src - mov edi, dest - mov ecx, count - shr ecx, 3 // 8 bytes per iteration + _asm { + mov esi, src + mov edi, dest + mov ecx, count + shr ecx, 3 // 8 bytes per iteration -loop1: - movq mm1, 0[ESI] // Read in source data - movntq 0[EDI], mm1 // Non-temporal stores +loop1: + movq mm1, 0[ESI] // Read in source data + movntq 0[EDI], mm1 // Non-temporal stores - add esi, 8 - add edi, 8 - dec ecx - jnz loop1 + add esi, 8 + add edi, 8 + dec ecx + jnz loop1 - } + } EMMS_INSTRUCTION } @@ -95,39 +95,39 @@ MMX_Memcpy64B ================ */ void MMX_Memcpy64B( void *dest, const void *src, const int count ) { - _asm { - mov esi, src - mov edi, dest - mov ecx, count - shr ecx, 6 // 64 bytes per iteration + _asm { + mov esi, src + mov edi, dest + mov ecx, count + shr ecx, 6 // 64 bytes per iteration -loop1: - prefetchnta 64[ESI] // Prefetch next loop, non-temporal - prefetchnta 96[ESI] +loop1: + prefetchnta 64[ESI] // Prefetch next loop, non-temporal + prefetchnta 96[ESI] - movq mm1, 0[ESI] // Read in source data - movq mm2, 8[ESI] - movq mm3, 16[ESI] - movq mm4, 24[ESI] - movq mm5, 32[ESI] - movq mm6, 40[ESI] - movq mm7, 48[ESI] - movq mm0, 56[ESI] + movq mm1, 0[ESI] // Read in source data + movq mm2, 8[ESI] + movq mm3, 16[ESI] + movq mm4, 24[ESI] + movq mm5, 32[ESI] + movq mm6, 40[ESI] + movq mm7, 48[ESI] + movq mm0, 56[ESI] - movntq 0[EDI], mm1 // Non-temporal stores - movntq 8[EDI], mm2 - movntq 16[EDI], mm3 - movntq 24[EDI], mm4 - movntq 32[EDI], mm5 - movntq 40[EDI], mm6 - movntq 48[EDI], mm7 - movntq 56[EDI], mm0 + movntq 0[EDI], mm1 // Non-temporal stores + movntq 8[EDI], mm2 + movntq 16[EDI], mm3 + movntq 24[EDI], mm4 + movntq 32[EDI], mm5 + movntq 40[EDI], mm6 + movntq 48[EDI], mm7 + movntq 56[EDI], mm0 - add esi, 64 - add edi, 64 - dec ecx - jnz loop1 - } + add esi, 64 + add edi, 64 + dec ecx + jnz loop1 + } EMMS_INSTRUCTION } @@ -140,76 +140,76 @@ MMX_Memcpy2kB */ void MMX_Memcpy2kB( void *dest, const void *src, const int count ) { byte *tbuf = (byte *)_alloca16(2048); - __asm { + __asm { push ebx - mov esi, src - mov ebx, count - shr ebx, 11 // 2048 bytes at a time - mov edi, dest + mov esi, src + mov ebx, count + shr ebx, 11 // 2048 bytes at a time + mov edi, dest loop2k: - push edi // copy 2k into temporary buffer - mov edi, tbuf - mov ecx, 32 + push edi // copy 2k into temporary buffer + mov edi, tbuf + mov ecx, 32 -loopMemToL1: - prefetchnta 64[ESI] // Prefetch next loop, non-temporal - prefetchnta 96[ESI] +loopMemToL1: + prefetchnta 64[ESI] // Prefetch next loop, non-temporal + prefetchnta 96[ESI] - movq mm1, 0[ESI] // Read in source data - movq mm2, 8[ESI] - movq mm3, 16[ESI] - movq mm4, 24[ESI] - movq mm5, 32[ESI] - movq mm6, 40[ESI] - movq mm7, 48[ESI] - movq mm0, 56[ESI] + movq mm1, 0[ESI] // Read in source data + movq mm2, 8[ESI] + movq mm3, 16[ESI] + movq mm4, 24[ESI] + movq mm5, 32[ESI] + movq mm6, 40[ESI] + movq mm7, 48[ESI] + movq mm0, 56[ESI] - movq 0[EDI], mm1 // Store into L1 - movq 8[EDI], mm2 - movq 16[EDI], mm3 - movq 24[EDI], mm4 - movq 32[EDI], mm5 - movq 40[EDI], mm6 - movq 48[EDI], mm7 - movq 56[EDI], mm0 - add esi, 64 - add edi, 64 - dec ecx - jnz loopMemToL1 + movq 0[EDI], mm1 // Store into L1 + movq 8[EDI], mm2 + movq 16[EDI], mm3 + movq 24[EDI], mm4 + movq 32[EDI], mm5 + movq 40[EDI], mm6 + movq 48[EDI], mm7 + movq 56[EDI], mm0 + add esi, 64 + add edi, 64 + dec ecx + jnz loopMemToL1 - pop edi // Now copy from L1 to system memory - push esi - mov esi, tbuf - mov ecx, 32 + pop edi // Now copy from L1 to system memory + push esi + mov esi, tbuf + mov ecx, 32 loopL1ToMem: - movq mm1, 0[ESI] // Read in source data from L1 - movq mm2, 8[ESI] - movq mm3, 16[ESI] - movq mm4, 24[ESI] - movq mm5, 32[ESI] - movq mm6, 40[ESI] - movq mm7, 48[ESI] - movq mm0, 56[ESI] + movq mm1, 0[ESI] // Read in source data from L1 + movq mm2, 8[ESI] + movq mm3, 16[ESI] + movq mm4, 24[ESI] + movq mm5, 32[ESI] + movq mm6, 40[ESI] + movq mm7, 48[ESI] + movq mm0, 56[ESI] - movntq 0[EDI], mm1 // Non-temporal stores - movntq 8[EDI], mm2 - movntq 16[EDI], mm3 - movntq 24[EDI], mm4 - movntq 32[EDI], mm5 - movntq 40[EDI], mm6 - movntq 48[EDI], mm7 - movntq 56[EDI], mm0 + movntq 0[EDI], mm1 // Non-temporal stores + movntq 8[EDI], mm2 + movntq 16[EDI], mm3 + movntq 24[EDI], mm4 + movntq 32[EDI], mm5 + movntq 40[EDI], mm6 + movntq 48[EDI], mm7 + movntq 56[EDI], mm0 - add esi, 64 - add edi, 64 - dec ecx - jnz loopL1ToMem + add esi, 64 + add edi, 64 + dec ecx + jnz loopL1ToMem - pop esi // Do next 2k block - dec ebx - jnz loop2k + pop esi // Do next 2k block + dec ebx + jnz loop2k pop ebx } EMMS_INSTRUCTION @@ -304,10 +304,10 @@ void VPCALL idSIMD_MMX::Memset( void* dest0, const int val, const int count0 ) { if ( count >= 64 ) { __asm { - mov edi, dest - mov ecx, count - shr ecx, 6 // 64 bytes per iteration - movq mm1, dat // Read in source data + mov edi, dest + mov ecx, count + shr ecx, 6 // 64 bytes per iteration + movq mm1, dat // Read in source data movq mm2, mm1 movq mm3, mm1 movq mm4, mm1 @@ -315,19 +315,19 @@ void VPCALL idSIMD_MMX::Memset( void* dest0, const int val, const int count0 ) { movq mm6, mm1 movq mm7, mm1 movq mm0, mm1 -loop1: - movntq 0[EDI], mm1 // Non-temporal stores - movntq 8[EDI], mm2 - movntq 16[EDI], mm3 - movntq 24[EDI], mm4 - movntq 32[EDI], mm5 - movntq 40[EDI], mm6 - movntq 48[EDI], mm7 - movntq 56[EDI], mm0 +loop1: + movntq 0[EDI], mm1 // Non-temporal stores + movntq 8[EDI], mm2 + movntq 16[EDI], mm3 + movntq 24[EDI], mm4 + movntq 32[EDI], mm5 + movntq 40[EDI], mm6 + movntq 48[EDI], mm7 + movntq 56[EDI], mm0 - add edi, 64 - dec ecx - jnz loop1 + add edi, 64 + dec ecx + jnz loop1 } dest += ( count & ~63 ); count &= 63; @@ -335,15 +335,15 @@ loop1: if ( count >= 8 ) { __asm { - mov edi, dest - mov ecx, count - shr ecx, 3 // 8 bytes per iteration - movq mm1, dat // Read in source data -loop2: - movntq 0[EDI], mm1 // Non-temporal stores + mov edi, dest + mov ecx, count + shr ecx, 3 // 8 bytes per iteration + movq mm1, dat // Read in source data +loop2: + movntq 0[EDI], mm1 // Non-temporal stores add edi, 8 - dec ecx + dec ecx jnz loop2 } dest += (count & ~7); @@ -356,7 +356,7 @@ loop2: count--; } - EMMS_INSTRUCTION + EMMS_INSTRUCTION // the MMX_Memcpy* functions use MOVNTQ, issue a fence operation __asm { diff --git a/idlib/math/Simd_MMX.h b/idlib/math/Simd_MMX.h index d0c1a8a..a9c23f5 100644 --- a/idlib/math/Simd_MMX.h +++ b/idlib/math/Simd_MMX.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Simd_SSE.cpp b/idlib/math/Simd_SSE.cpp index 43f2a59..f4b6365 100644 --- a/idlib/math/Simd_SSE.cpp +++ b/idlib/math/Simd_SSE.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -78,14 +78,14 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idPlane &constant, const idDrawVe // 6, 7, 8 // 9, 10, 11 - /* + /* mov eax, count mov edi, constant mov edx, eax mov esi, src mov ecx, dst - */ - __m128 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7; // Declare 8 xmm registers. + */ + __m128 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7; // Declare 8 xmm registers. int count_l4 = count; // count_l4 = eax int count_l1 = count; // count_l1 = edx char *constant_p = (char *)&constant; // constant_p = edi @@ -94,7 +94,7 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idPlane &constant, const idDrawVe assert( sizeof( idDrawVert ) == DRAWVERT_SIZE ); assert( (int)&((idDrawVert *)0)->xyz == DRAWVERT_XYZ_OFFSET ); - + /* and eax, ~3 movss xmm4, [edi+0] @@ -112,10 +112,10 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idPlane &constant, const idDrawVe xmm5 = _mm_load_ss((float *) (constant_p + 4)); xmm5 = _mm_shuffle_ps(xmm5, xmm5, R_SHUFFLEPS( 0, 0, 0, 0 )); xmm6 = _mm_load_ss((float *) (constant_p + 8)); - xmm6 = _mm_shuffle_ps(xmm6, xmm6, R_SHUFFLEPS( 0, 0, 0, 0 )); - xmm7 = _mm_load_ss((float *) (constant_p + 12)); - xmm7 = _mm_shuffle_ps(xmm7, xmm7, R_SHUFFLEPS( 0, 0, 0, 0 )); - + xmm6 = _mm_shuffle_ps(xmm6, xmm6, R_SHUFFLEPS( 0, 0, 0, 0 )); + xmm7 = _mm_load_ss((float *) (constant_p + 12)); + xmm7 = _mm_shuffle_ps(xmm7, xmm7, R_SHUFFLEPS( 0, 0, 0, 0 )); + /* jz startVert1 */ @@ -142,14 +142,14 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idPlane &constant, const idDrawVe xmm2 = _mm_load_ss((float *) (src_p+count_l4+0*DRAWVERT_SIZE+DRAWVERT_XYZ_OFFSET+8)); // 2, X, X, X xmm0 = _mm_loadh_pi(xmm0, (__m64 *) (src_p+count_l4+0*DRAWVERT_SIZE+DRAWVERT_XYZ_OFFSET+0)); // 3, X, 0, 1 xmm1 = xmm0; // 3, X, 0, 1 - - /* + + /* movlps xmm1, [esi+eax+1*DRAWVERT_SIZE+DRAWVERT_XYZ_OFFSET+4] // 4, 5, 0, 1 shufps xmm2, xmm1, R_SHUFFLEPS( 0, 1, 0, 1 ) // 2, X, 4, 5 */ xmm1 = _mm_loadl_pi(xmm1, (__m64 *) (src_p+count_l4+1*DRAWVERT_SIZE+DRAWVERT_XYZ_OFFSET+4)); // 4, 5, 0, 1 xmm2 = _mm_shuffle_ps(xmm2, xmm1, R_SHUFFLEPS( 0, 1, 0, 1 )); // 2, X, 4, 5 - + /* movss xmm3, [esi+eax+3*DRAWVERT_SIZE+DRAWVERT_XYZ_OFFSET+0] // 9, X, X, X movhps xmm3, [esi+eax+2*DRAWVERT_SIZE+DRAWVERT_XYZ_OFFSET+0] // 9, X, 6, 7 @@ -167,17 +167,17 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idPlane &constant, const idDrawVe /* movhps xmm3, [esi+eax+2*DRAWVERT_SIZE+DRAWVERT_XYZ_OFFSET+8] // 10, 11, 8, X shufps xmm2, xmm3, R_SHUFFLEPS( 0, 3, 2, 1 ) // 2, 5, 8, 11 - */ + */ xmm3 = _mm_loadh_pi(xmm3, (__m64 *)(src_p+count_l4+2*DRAWVERT_SIZE+DRAWVERT_XYZ_OFFSET+8)); // 10, 11, 8, X xmm2 = _mm_shuffle_ps(xmm2, xmm3, R_SHUFFLEPS( 0, 3, 2, 1 )); // 2, 5, 8, 11 - + /* add ecx, 16 add eax, 4*DRAWVERT_SIZE */ dst_p = dst_p + 16; count_l4 = count_l4 + 4*DRAWVERT_SIZE; - + /* mulps xmm0, xmm4 mulps xmm1, xmm5 @@ -192,7 +192,7 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idPlane &constant, const idDrawVe xmm0 = _mm_add_ps(xmm0, xmm7); xmm0 = _mm_add_ps(xmm0, xmm1); xmm0 = _mm_add_ps(xmm0, xmm2); - + /* movlps [ecx-16+0], xmm0 movhps [ecx-16+8], xmm0 @@ -202,7 +202,7 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idPlane &constant, const idDrawVe _mm_storeh_pi((__m64 *) (dst_p-16+8), xmm0); } while(count_l4 < 0); } - + /* startVert1: and edx, 3 @@ -239,7 +239,7 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idPlane &constant, const idDrawVe xmm0 = _mm_add_ss(xmm0, xmm1); count_l4 = count_l4 + DRAWVERT_SIZE; xmm0 = _mm_add_ss(xmm0, xmm2); - count_l1 = count_l1 - 1; + count_l1 = count_l1 - 1; _mm_store_ss((float *) (dst_p-4), xmm0); } while( count_l1 != 0); } @@ -265,7 +265,7 @@ void VPCALL idSIMD_SSE::MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, int edx; char *min_p; char *max_p; - + /* movss xmm0, idMath::INFINITY xorps xmm1, xmm1 @@ -275,7 +275,7 @@ void VPCALL idSIMD_SSE::MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, movaps xmm3, xmm1 */ xmm0 = _mm_load_ss(&idMath::INFINITY); - // To satisfy the compiler use xmm0 instead. + // To satisfy the compiler use xmm0 instead. xmm1 = _mm_xor_ps(xmm0, xmm0); xmm0 = _mm_shuffle_ps(xmm0, xmm0, R_SHUFFLEPS( 0, 0, 0, 0 )); xmm1 = _mm_sub_ps(xmm1, xmm0); @@ -322,7 +322,7 @@ void VPCALL idSIMD_SSE::MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, xmm4 = _mm_loadh_pi(xmm4, (__m64 *) (src_p+edx+DRAWVERT_XYZ_OFFSET+0) ); xmm0 = _mm_min_ps(xmm0, xmm4); xmm1 = _mm_max_ps(xmm1, xmm4); - + /* mov edx, [edi+eax+4] imul edx, DRAWVERT_SIZE @@ -336,8 +336,8 @@ void VPCALL idSIMD_SSE::MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, xmm5 = _mm_load_ss((float *) (src_p+edx+DRAWVERT_XYZ_OFFSET+0)); xmm5 = _mm_loadh_pi(xmm5, (__m64 *) (src_p+edx+DRAWVERT_XYZ_OFFSET+4) ); xmm2 = _mm_min_ps(xmm2, xmm5); - xmm3 = _mm_max_ps(xmm3, xmm5); - + xmm3 = _mm_max_ps(xmm3, xmm5); + /* mov edx, [edi+eax+8] imul edx, DRAWVERT_SIZE @@ -352,7 +352,7 @@ void VPCALL idSIMD_SSE::MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, xmm6 = _mm_loadh_pi(xmm6, (__m64 *) (src_p+edx+DRAWVERT_XYZ_OFFSET+0) ); xmm0 = _mm_min_ps(xmm0, xmm6); xmm1 = _mm_max_ps(xmm1, xmm6); - + /* mov edx, [edi+eax+12] imul edx, DRAWVERT_SIZE @@ -366,7 +366,7 @@ void VPCALL idSIMD_SSE::MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, xmm7 = _mm_load_ss((float *) (src_p+edx+DRAWVERT_XYZ_OFFSET+0)); xmm7 = _mm_loadh_pi(xmm7, (__m64 *) (src_p+edx+DRAWVERT_XYZ_OFFSET+4) ); xmm2 = _mm_min_ps(xmm2, xmm7); - xmm3 = _mm_max_ps(xmm3, xmm7); + xmm3 = _mm_max_ps(xmm3, xmm7); /* add eax, 4*4 @@ -393,7 +393,7 @@ void VPCALL idSIMD_SSE::MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, indexes_p = indexes_p + count_l; count_l = -count_l; /* - loop1: + loop1: */ do{ /* @@ -410,17 +410,17 @@ void VPCALL idSIMD_SSE::MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, xmm4 = _mm_loadh_pi(xmm4, (__m64 *) (src_p+edx+DRAWVERT_XYZ_OFFSET+0) ); xmm0 = _mm_min_ps(xmm0, xmm4); xmm1 = _mm_max_ps(xmm1, xmm4); - + /* add eax, 4 jl loop1 */ count_l = count_l + 4; } while (count_l < 0); - + } - /* + /* done1: shufps xmm2, xmm2, R_SHUFFLEPS( 3, 1, 0, 2 ) shufps xmm3, xmm3, R_SHUFFLEPS( 3, 1, 0, 2 ) @@ -489,7 +489,7 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idVec3 &constant, const idPlane * xmm6 = _mm_shuffle_ps(xmm6, xmm6, R_SHUFFLEPS( 0, 0, 0, 0 )); xmm7 = _mm_load_ss((float *) (constant_p+8)); xmm7 = _mm_shuffle_ps(xmm7, xmm7, R_SHUFFLEPS( 0, 0, 0, 0 )); - + /* jz startVert1 */ @@ -503,7 +503,7 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idVec3 &constant, const idPlane * src_p = src_p + count_l4; count_l4 = -count_l4; /* - loopVert4: + loopVert4: */ do { /* @@ -537,14 +537,14 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idVec3 &constant, const idPlane * xmm2 = xmm3; xmm2 = _mm_shuffle_ps(xmm2, xmm4, R_SHUFFLEPS( 0, 2, 0, 2 )); xmm3 = _mm_shuffle_ps(xmm3, xmm4, R_SHUFFLEPS( 1, 3, 1, 3 )); - + /* add ecx, 16 add eax, 4*16 */ dst_p = dst_p + 16; count_l4 = count_l4 + 4*16; - + /* mulps xmm0, xmm5 mulps xmm1, xmm6 @@ -555,11 +555,11 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idVec3 &constant, const idPlane * */ xmm0 = _mm_mul_ps(xmm0, xmm5); xmm1 = _mm_mul_ps(xmm1, xmm6); - xmm2 = _mm_mul_ps(xmm2, xmm7); + xmm2 = _mm_mul_ps(xmm2, xmm7); xmm0 = _mm_add_ps(xmm0, xmm3); xmm0 = _mm_add_ps(xmm0, xmm1); - xmm0 = _mm_add_ps(xmm0, xmm2); - + xmm0 = _mm_add_ps(xmm0, xmm2); + /* movlps [ecx-16+0], xmm0 movhps [ecx-16+8], xmm0 @@ -567,7 +567,7 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idVec3 &constant, const idPlane * */ _mm_storel_pi((__m64 *) (dst_p-16+0), xmm0); _mm_storeh_pi((__m64 *) (dst_p-16+8), xmm0); - } while (count_l4 < 0); + } while (count_l4 < 0); } /* @@ -579,7 +579,7 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idVec3 &constant, const idPlane * if(count_l1 != 0) { /* - loopVert1: + loopVert1: */ do { /* @@ -602,11 +602,11 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idVec3 &constant, const idPlane * xmm1 = _mm_load_ss((float *) (src_p+count_l4+ 4)); xmm2 = _mm_load_ss((float *) (src_p+count_l4+ 8)); xmm3 = _mm_load_ss((float *) (src_p+count_l4+12)); - + xmm0 = _mm_mul_ss(xmm0, xmm5); xmm1 = _mm_mul_ss(xmm1, xmm6); xmm2 = _mm_mul_ss(xmm2, xmm7); - + xmm0 = _mm_add_ss(xmm0, xmm3); dst_p = dst_p + 4; xmm0 = _mm_add_ss(xmm0, xmm1); @@ -703,7 +703,7 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idVec3 &constant, const idPlane * // transpose a 4x3 matrix to memory from 3 xmm registers (reg3 is temporary) #define TRANSPOSE_4x3_TO_MEMORY( address, reg0, reg1, reg2, reg3 ) \ - __asm movhlps reg3, reg0 /* reg3 = 3, 9, X, X */ \ + __asm movhlps reg3, reg0 /* reg3 = 3, 9, X, X */ \ __asm unpcklps reg0, reg1 /* reg0 = 0, 1, 6, 7 */ \ __asm unpckhps reg1, reg2 /* reg1 = 4, 5, 10, 11 */ \ __asm unpcklps reg2, reg3 /* reg2 = 2, 3, 8, 9 */ \ @@ -2918,7 +2918,7 @@ void VPCALL idSIMD_SSE::Dot( float *dst, const idPlane &constant, const idPlane shl ecx, 2 lea eax, [eax+ecx*4] add edx, ecx - neg ecx + neg ecx movlps xmm0, [eax+ecx*4] movhps xmm0, [eax+ecx*4+16] @@ -3360,7 +3360,7 @@ void VPCALL idSIMD_SSE::Dot( float &dot, const float *src1, const float *src2, c for ( i = 0; i < pre; i++ ) { \ dst[i] = src0[i] CMP c; \ } \ - for ( i = count - post; i < count; i++ ) { \ + for ( i = count - post; i < count; i++ ) { \ dst[i] = src0[i] CMP c; \ } @@ -3456,7 +3456,7 @@ void VPCALL idSIMD_SSE::Dot( float &dot, const float *src1, const float *src2, c for ( i = 0; i < pre; i++ ) { \ dst[i] |= ( src0[i] CMP c ) << BITNUM; \ } \ - for ( i = count - post; i < count; i++ ) { \ + for ( i = count - post; i < count; i++ ) { \ dst[i] |= ( src0[i] CMP c ) << BITNUM; \ } @@ -3628,7 +3628,7 @@ done: min = tmp; } } - for ( i = count - post; i < count; i++ ) { + for ( i = count - post; i < count; i++ ) { float tmp = src[i]; if ( tmp > max ) { max = tmp; @@ -4826,7 +4826,7 @@ void VPCALL idSIMD_SSE::MatX_MultiplyVecX( idVecX &dst, const idMatX &mat, const __asm { mov esi, vPtr mov edi, mPtr - mov eax, dstPtr + mov eax, dstPtr movss xmm0, [esi] mulss xmm0, [edi] movss xmm1, [esi+4] @@ -5572,7 +5572,7 @@ void VPCALL idSIMD_SSE::MatX_MultiplyAddVecX( idVecX &dst, const idMatX &mat, co __asm { mov esi, vPtr mov edi, mPtr - mov eax, dstPtr + mov eax, dstPtr movss xmm0, [esi] mulss xmm0, [edi] movss xmm1, [esi+4] @@ -6318,7 +6318,7 @@ void VPCALL idSIMD_SSE::MatX_MultiplySubVecX( idVecX &dst, const idMatX &mat, co __asm { mov esi, vPtr mov edi, mPtr - mov eax, dstPtr + mov eax, dstPtr movss xmm0, [esi] mulss xmm0, [edi] movss xmm1, [esi+4] @@ -9080,7 +9080,7 @@ void VPCALL idSIMD_SSE::MatX_MultiplyMatX( idMatX &dst, const idMatX &m1, const MUL_Nx6_6x4_ROW( 1 ) MUL_Nx6_6x4_ROW( 2 ) MUL_Nx6_6x4_ROW( 3 ) - + return; } break; @@ -12655,7 +12655,7 @@ void VPCALL idSIMD_SSE::TracePointCull( byte *cullBits, byte &totalOr, const flo done: mov esi, totalOr - mov byte ptr [esi], dl + mov byte ptr [esi], dl pop ebx } @@ -12791,7 +12791,7 @@ void VPCALL idSIMD_SSE::DecalPointCull( byte *cullBits, const idPlane *planes, c cmpnltps xmm6, SIMD_SP_zero movmskps ecx, xmm6 - + movaps xmm6, p0 movss xmm3, [esi+eax+1*DRAWVERT_SIZE+DRAWVERT_XYZ_OFFSET+0] shufps xmm3, xmm3, R_SHUFFLEPS( 0, 0, 0, 0 ) diff --git a/idlib/math/Simd_SSE.h b/idlib/math/Simd_SSE.h index 13404c2..f505444 100644 --- a/idlib/math/Simd_SSE.h +++ b/idlib/math/Simd_SSE.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -41,9 +41,9 @@ class idSIMD_SSE : public idSIMD_MMX { public: #if defined(MACOS_X) && defined(__i386__) virtual const char * VPCALL GetName( void ) const; - virtual void VPCALL Dot( float *dst, const idPlane &constant,const idDrawVert *src, const int count ); - virtual void VPCALL MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, const int *indexes, const int count ); - virtual void VPCALL Dot( float *dst, const idVec3 &constant, const idPlane *src, const int count ); + virtual void VPCALL Dot( float *dst, const idPlane &constant,const idDrawVert *src, const int count ); + virtual void VPCALL MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, const int *indexes, const int count ); + virtual void VPCALL Dot( float *dst, const idVec3 &constant, const idPlane *src, const int count ); #elif defined(_WIN32) virtual const char * VPCALL GetName( void ) const; diff --git a/idlib/math/Simd_SSE2.cpp b/idlib/math/Simd_SSE2.cpp index 15ef637..72a6bad 100644 --- a/idlib/math/Simd_SSE2.cpp +++ b/idlib/math/Simd_SSE2.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -74,7 +74,7 @@ void VPCALL idSIMD_SSE2::CmpLT( byte *dst, const byte bitNum, const float *src0, char *dst_p; int mask_l; int dst_l; - + /* if the float array is not aligned on a 4 byte boundary */ if ( ((int) src0) & 3 ) { /* unaligned memory access */ @@ -83,21 +83,21 @@ void VPCALL idSIMD_SSE2::CmpLT( byte *dst, const byte bitNum, const float *src0, post = count - (cnt<<2); /* - __asm mov edx, cnt - __asm test edx, edx - __asm je doneCmp + __asm mov edx, cnt + __asm test edx, edx + __asm je doneCmp */ cnt_l = cnt; if(cnt_l != 0) { /* - __asm push ebx - __asm neg edx - __asm mov esi, src0 - __asm prefetchnta [esi+64] - __asm movss xmm1, constant - __asm shufps xmm1, xmm1, R_SHUFFLEPS( 0, 0, 0, 0 ) - __asm mov edi, dst - __asm mov cl, bitNum + __asm push ebx + __asm neg edx + __asm mov esi, src0 + __asm prefetchnta [esi+64] + __asm movss xmm1, constant + __asm shufps xmm1, xmm1, R_SHUFFLEPS( 0, 0, 0, 0 ) + __asm mov edi, dst + __asm mov cl, bitNum */ cnt_l = -cnt_l; src0_p = (char *) src0; @@ -107,28 +107,28 @@ void VPCALL idSIMD_SSE2::CmpLT( byte *dst, const byte bitNum, const float *src0, xmm1 = _mm_shuffle_ps(xmm1, xmm1, R_SHUFFLEPS( 0, 0, 0, 0 )); dst_p = (char *)dst; /* - __asm loopNA: + __asm loopNA: */ do { /* - __asm movups xmm0, [esi] - __asm prefetchnta [esi+128] - __asm cmpltps xmm0, xmm1 + __asm movups xmm0, [esi] + __asm prefetchnta [esi+128] + __asm cmpltps xmm0, xmm1 __asm movmskps eax, xmm0 \ - __asm mov ah, al - __asm shr ah, 1 - __asm mov bx, ax - __asm shl ebx, 14 - __asm mov bx, ax - __asm and ebx, 0x01010101 - __asm shl ebx, cl - __asm or ebx, dword ptr [edi] - __asm mov dword ptr [edi], ebx - __asm add esi, 16 - __asm add edi, 4 - __asm inc edx - __asm jl loopNA - __asm pop ebx + __asm mov ah, al + __asm shr ah, 1 + __asm mov bx, ax + __asm shl ebx, 14 + __asm mov bx, ax + __asm and ebx, 0x01010101 + __asm shl ebx, cl + __asm or ebx, dword ptr [edi] + __asm mov dword ptr [edi], ebx + __asm add esi, 16 + __asm add edi, 4 + __asm inc edx + __asm jl loopNA + __asm pop ebx */ xmm0 = _mm_loadu_ps((float *) src0_p); _mm_prefetch(src0_p+128, _MM_HINT_NTA); @@ -138,7 +138,7 @@ void VPCALL idSIMD_SSE2::CmpLT( byte *dst, const byte bitNum, const float *src0, xmm0i = _mm_packs_epi32(xmm0i, xmm0i); xmm0i = _mm_packs_epi16(xmm0i, xmm0i); mask_l = _mm_cvtsi128_si32(xmm0i); - // End + // End mask_l = mask_l & 0x01010101; mask_l = mask_l << bitNum; dst_l = *((int *) dst_p); @@ -148,35 +148,35 @@ void VPCALL idSIMD_SSE2::CmpLT( byte *dst, const byte bitNum, const float *src0, dst_p = dst_p + 4; cnt_l = cnt_l + 1; } while (cnt_l < 0); - } - } - else { - /* aligned memory access */ - aligned = (float *) ((((int) src0) + 15) & ~15); - if ( (int)aligned > ((int)src0) + count ) { - pre = count; - post = 0; - } - else { - pre = aligned - src0; - cnt = (count - pre) >> 2; + } + } + else { + /* aligned memory access */ + aligned = (float *) ((((int) src0) + 15) & ~15); + if ( (int)aligned > ((int)src0) + count ) { + pre = count; + post = 0; + } + else { + pre = aligned - src0; + cnt = (count - pre) >> 2; post = count - pre - (cnt<<2); /* - __asm mov edx, cnt - __asm test edx, edx - __asm je doneCmp + __asm mov edx, cnt + __asm test edx, edx + __asm je doneCmp */ cnt_l = cnt; if(cnt_l != 0) { /* - __asm push ebx - __asm neg edx - __asm mov esi, aligned - __asm prefetchnta [esi+64] - __asm movss xmm1, constant - __asm shufps xmm1, xmm1, R_SHUFFLEPS( 0, 0, 0, 0 ) - __asm mov edi, dst - __asm add edi, pre + __asm push ebx + __asm neg edx + __asm mov esi, aligned + __asm prefetchnta [esi+64] + __asm movss xmm1, constant + __asm shufps xmm1, xmm1, R_SHUFFLEPS( 0, 0, 0, 0 ) + __asm mov edi, dst + __asm add edi, pre __asm mov cl, bitNum */ cnt_l = -cnt_l; @@ -188,27 +188,27 @@ void VPCALL idSIMD_SSE2::CmpLT( byte *dst, const byte bitNum, const float *src0, dst_p = (char *)dst; dst_p = dst_p + pre; /* - __asm loopA: + __asm loopA: */ do { /* - __asm movaps xmm0, [esi] - __asm prefetchnta [esi+128] - __asm cmpltps xmm0, xmm1 + __asm movaps xmm0, [esi] + __asm prefetchnta [esi+128] + __asm cmpltps xmm0, xmm1 __asm movmskps eax, xmm0 \ - __asm mov ah, al - __asm shr ah, 1 - __asm mov bx, ax - __asm shl ebx, 14 - __asm mov bx, ax - __asm and ebx, 0x01010101 - __asm shl ebx, cl - __asm or ebx, dword ptr [edi] - __asm mov dword ptr [edi], ebx - __asm add esi, 16 - __asm add edi, 4 - __asm inc edx - __asm jl loopA + __asm mov ah, al + __asm shr ah, 1 + __asm mov bx, ax + __asm shl ebx, 14 + __asm mov bx, ax + __asm and ebx, 0x01010101 + __asm shl ebx, cl + __asm or ebx, dword ptr [edi] + __asm mov dword ptr [edi], ebx + __asm add esi, 16 + __asm add edi, 4 + __asm inc edx + __asm jl loopA __asm pop ebx */ xmm0 = _mm_load_ps((float *) src0_p); @@ -219,7 +219,7 @@ void VPCALL idSIMD_SSE2::CmpLT( byte *dst, const byte bitNum, const float *src0, xmm0i = _mm_packs_epi32(xmm0i, xmm0i); xmm0i = _mm_packs_epi16(xmm0i, xmm0i); mask_l = _mm_cvtsi128_si32(xmm0i); - // End + // End mask_l = mask_l & 0x01010101; mask_l = mask_l << bitNum; dst_l = *((int *) dst_p); @@ -229,18 +229,18 @@ void VPCALL idSIMD_SSE2::CmpLT( byte *dst, const byte bitNum, const float *src0, dst_p = dst_p + 4; cnt_l = cnt_l + 1; } while (cnt_l < 0); - } + } } - } + } /* - doneCmp: + doneCmp: */ - float c = constant; - for ( i = 0; i < pre; i++ ) { - dst[i] |= ( src0[i] < c ) << bitNum; - } - for ( i = count - post; i < count; i++ ) { - dst[i] |= ( src0[i] < c ) << bitNum; + float c = constant; + for ( i = 0; i < pre; i++ ) { + dst[i] |= ( src0[i] < c ) << bitNum; + } + for ( i = count - post; i < count; i++ ) { + dst[i] |= ( src0[i] < c ) << bitNum; } } diff --git a/idlib/math/Simd_SSE2.h b/idlib/math/Simd_SSE2.h index db1d341..81863b8 100644 --- a/idlib/math/Simd_SSE2.h +++ b/idlib/math/Simd_SSE2.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -41,7 +41,7 @@ class idSIMD_SSE2 : public idSIMD_SSE { public: #if defined(MACOS_X) && defined(__i386__) virtual const char * VPCALL GetName( void ) const; - virtual void VPCALL CmpLT( byte *dst, const byte bitNum, const float *src0, const float constant, const int count ); + virtual void VPCALL CmpLT( byte *dst, const byte bitNum, const float *src0, const float constant, const int count ); #elif defined(_WIN32) virtual const char * VPCALL GetName( void ) const; diff --git a/idlib/math/Simd_SSE3.cpp b/idlib/math/Simd_SSE3.cpp index 67901bd..72bc062 100644 --- a/idlib/math/Simd_SSE3.cpp +++ b/idlib/math/Simd_SSE3.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Simd_SSE3.h b/idlib/math/Simd_SSE3.h index b5644dd..83715f3 100644 --- a/idlib/math/Simd_SSE3.h +++ b/idlib/math/Simd_SSE3.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/idlib/math/Vector.cpp b/idlib/math/Vector.cpp index e53e814..c29f4b1 100644 --- a/idlib/math/Vector.cpp +++ b/idlib/math/Vector.cpp @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -83,7 +83,7 @@ idVec3::ToYaw */ float idVec3::ToYaw( void ) const { float yaw; - + if ( ( y == 0.0f ) && ( x == 0.0f ) ) { yaw = 0.0f; } else { @@ -104,7 +104,7 @@ idVec3::ToPitch float idVec3::ToPitch( void ) const { float forward; float pitch; - + if ( ( x == 0.0f ) && ( y == 0.0f ) ) { if ( z > 0.0f ) { pitch = 90.0f; @@ -131,7 +131,7 @@ idAngles idVec3::ToAngles( void ) const { float forward; float yaw; float pitch; - + if ( ( x == 0.0f ) && ( y == 0.0f ) ) { yaw = 0.0f; if ( z > 0.0f ) { @@ -164,7 +164,7 @@ idPolar3 idVec3::ToPolar( void ) const { float forward; float yaw; float pitch; - + if ( ( x == 0.0f ) && ( y == 0.0f ) ) { yaw = 0.0f; if ( z > 0.0f ) { diff --git a/idlib/math/Vector.h b/idlib/math/Vector.h index ecc001d..773bf43 100644 --- a/idlib/math/Vector.h +++ b/idlib/math/Vector.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -57,7 +57,7 @@ public: idVec2( void ); explicit idVec2( const float x, const float y ); - void Set( const float x, const float y ); + void Set( const float x, const float y ); void Zero( void ); float operator[]( int index ) const; @@ -128,7 +128,7 @@ ID_INLINE bool idVec2::Compare( const idVec2 &a, const float epsilon ) const { if ( idMath::Fabs( x - a.x ) > epsilon ) { return false; } - + if ( idMath::Fabs( y - a.y ) > epsilon ) { return false; } @@ -232,7 +232,7 @@ ID_INLINE void idVec2::SnapInt( void ) { ID_INLINE idVec2 idVec2::operator-() const { return idVec2( -x, -y ); } - + ID_INLINE idVec2 idVec2::operator-( const idVec2 &a ) const { return idVec2( x - a.x, y - a.y ); } @@ -314,7 +314,7 @@ ID_INLINE float *idVec2::ToFloatPtr( void ) { //=============================================================== class idVec3 { -public: +public: float x; float y; float z; @@ -322,7 +322,7 @@ public: idVec3( void ); explicit idVec3( const float x, const float y, const float z ); - void Set( const float x, const float y, const float z ); + void Set( const float x, const float y, const float z ); void Zero( void ); float operator[]( const int index ) const; @@ -501,7 +501,7 @@ ID_INLINE bool idVec3::Compare( const idVec3 &a, const float epsilon ) const { if ( idMath::Fabs( x - a.x ) > epsilon ) { return false; } - + if ( idMath::Fabs( y - a.y ) > epsilon ) { return false; } @@ -768,9 +768,9 @@ ID_INLINE void idVec3::OrthogonalBasis( idVec3 &left, idVec3 &up ) const { ID_INLINE void idVec3::ProjectOntoPlane( const idVec3 &normal, const float overBounce ) { float backoff; - + backoff = *this * normal; - + if ( overBounce != 1.0 ) { if ( backoff < 0 ) { backoff *= overBounce; @@ -806,7 +806,7 @@ ID_INLINE bool idVec3::ProjectAlongPlane( const idVec3 &normal, const float epsi //=============================================================== class idVec4 { -public: +public: float x; float y; float z; @@ -815,7 +815,7 @@ public: idVec4( void ); explicit idVec4( const float x, const float y, const float z, const float w ); - void Set( const float x, const float y, const float z, const float w ); + void Set( const float x, const float y, const float z, const float w ); void Zero( void ); float operator[]( const int index ) const; @@ -972,7 +972,7 @@ ID_INLINE bool idVec4::Compare( const idVec4 &a, const float epsilon ) const { if ( idMath::Fabs( x - a.x ) > epsilon ) { return false; } - + if ( idMath::Fabs( y - a.y ) > epsilon ) { return false; } @@ -1120,7 +1120,7 @@ ID_INLINE float& idVec5::operator[]( int index ) { return ( &x )[ index ]; } -ID_INLINE idVec5 &idVec5::operator=( const idVec3 &a ) { +ID_INLINE idVec5 &idVec5::operator=( const idVec3 &a ) { x = a.x; y = a.y; z = a.z; @@ -1156,12 +1156,12 @@ ID_INLINE float *idVec5::ToFloatPtr( void ) { //=============================================================== class idVec6 { -public: +public: idVec6( void ); explicit idVec6( const float *a ); explicit idVec6( const float a1, const float a2, const float a3, const float a4, const float a5, const float a6 ); - void Set( const float a1, const float a2, const float a3, const float a4, const float a5, const float a6 ); + void Set( const float a1, const float a2, const float a3, const float a4, const float a5, const float a6 ); void Zero( void ); float operator[]( const int index ) const; @@ -1314,7 +1314,7 @@ ID_INLINE bool idVec6::Compare( const idVec6 &a, const float epsilon ) const { if ( idMath::Fabs( p[0] - a[0] ) > epsilon ) { return false; } - + if ( idMath::Fabs( p[1] - a[1] ) > epsilon ) { return false; } @@ -1435,7 +1435,7 @@ ID_INLINE float *idVec6::ToFloatPtr( void ) { class idVecX { friend class idMatX; -public: +public: idVecX( void ); explicit idVecX( int length ); explicit idVecX( int length, float *data ); @@ -1548,7 +1548,7 @@ ID_INLINE idVecX idVecX::operator-() const { return m; } -ID_INLINE idVecX &idVecX::operator=( const idVecX &a ) { +ID_INLINE idVecX &idVecX::operator=( const idVecX &a ) { SetSize( a.size ); #ifdef VECX_SIMD SIMDProcessor->Copy16( p, a.p, a.size ); @@ -1923,13 +1923,13 @@ ID_INLINE float *idVecX::ToFloatPtr( void ) { //=============================================================== class idPolar3 { -public: +public: float radius, theta, phi; idPolar3( void ); explicit idPolar3( const float radius, const float theta, const float phi ); - void Set( const float radius, const float theta, const float phi ); + void Set( const float radius, const float theta, const float phi ); float operator[]( const int index ) const; float & operator[]( const int index ); @@ -1948,7 +1948,7 @@ ID_INLINE idPolar3::idPolar3( const float radius, const float theta, const float this->theta = theta; this->phi = phi; } - + ID_INLINE void idPolar3::Set( const float radius, const float theta, const float phi ) { assert( radius > 0 ); this->radius = radius; @@ -1968,7 +1968,7 @@ ID_INLINE idPolar3 idPolar3::operator-() const { return idPolar3( radius, -theta, -phi ); } -ID_INLINE idPolar3 &idPolar3::operator=( const idPolar3 &a ) { +ID_INLINE idPolar3 &idPolar3::operator=( const idPolar3 &a ) { radius = a.radius; theta = a.theta; phi = a.phi; @@ -1979,7 +1979,7 @@ ID_INLINE idVec3 idPolar3::ToVec3( void ) const { float sp, cp, st, ct; idMath::SinCos( phi, sp, cp ); idMath::SinCos( theta, st, ct ); - return idVec3( cp * radius * ct, cp * radius * st, radius * sp ); + return idVec3( cp * radius * ct, cp * radius * st, radius * sp ); } diff --git a/idlib/precompiled.h b/idlib/precompiled.h index 2654d7a..dca42d7 100644 --- a/idlib/precompiled.h +++ b/idlib/precompiled.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/renderer/Cinematic.h b/renderer/Cinematic.h index 26dbd4e..93bc2b0 100644 --- a/renderer/Cinematic.h +++ b/renderer/Cinematic.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -99,7 +99,7 @@ public: class idSndWindow : public idCinematic { public: - + idSndWindow() { showWaveform = false; } ~idSndWindow() {} diff --git a/renderer/Material.h b/renderer/Material.h index ad64027..71ee936 100644 --- a/renderer/Material.h +++ b/renderer/Material.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -137,7 +137,7 @@ typedef enum { } expRegister_t; typedef struct { - expOpType_t opType; + expOpType_t opType; int a, b, c; } expOp_t; @@ -197,7 +197,7 @@ typedef struct { int numFragmentProgramImages; idImage * fragmentProgramImages[MAX_FRAGMENT_IMAGES]; - idMegaTexture *megaTexture; // handles all the binding and parameter setting + idMegaTexture *megaTexture; // handles all the binding and parameter setting } newShaderStage_t; typedef struct { @@ -300,7 +300,7 @@ const int MAX_SURFACE_TYPES = 1 << NUM_SURFACE_BITS; typedef enum { SURFTYPE_NONE, // default type - SURFTYPE_METAL, + SURFTYPE_METAL, SURFTYPE_STONE, SURFTYPE_FLESH, SURFTYPE_WOOD, @@ -508,7 +508,7 @@ public: // get sort order const float GetSort( void ) const { return sort; } // this is only used by the gui system to force sorting order - // on images referenced from tga's instead of materials. + // on images referenced from tga's instead of materials. // this is done this way as there are 2000 tgas the guis use void SetSort( float s ) const { sort = s; }; @@ -575,7 +575,7 @@ public: const int GetNumRegisters() const { return numRegisters; } // regs should point to a float array large enough to hold GetNumRegisters() floats - void EvaluateRegisters( float *regs, const float entityParms[MAX_ENTITY_SHADER_PARMS], + void EvaluateRegisters( float *regs, const float entityParms[MAX_ENTITY_SHADER_PARMS], const struct viewDef_s *view, idSoundEmitter *soundEmitter = NULL ) const; // if a material only uses constants (no entityParm or globalparm references), this @@ -633,9 +633,9 @@ private: float polygonOffset; int contentFlags; // content flags - int surfaceFlags; // surface flags + int surfaceFlags; // surface flags mutable int materialFlags; // material flags - + decalInfo_t decalInfo; @@ -649,7 +649,7 @@ private: materialCoverage_t coverage; cullType_t cullType; // CT_FRONT_SIDED, CT_BACK_SIDED, or CT_TWO_SIDED bool shouldCreateBackSides; - + bool fogLight; bool blendLight; bool ambientLight; @@ -659,7 +659,7 @@ private: int numOps; expOp_t * ops; // evaluate to make expressionRegisters - + int numRegisters; // float * expressionRegisters; @@ -667,7 +667,7 @@ private: int numStages; int numAmbientStages; - + shaderStage_t * stages; struct mtrParsingData_s *pd; // only used during parsing diff --git a/renderer/Model.h b/renderer/Model.h index 6bf1b9d..419a64e 100644 --- a/renderer/Model.h +++ b/renderer/Model.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -199,7 +199,7 @@ public: // which can regenerate the data with LoadModel() virtual void PurgeModel() = 0; - // resets any model information that needs to be reset on a same level load etc.. + // resets any model information that needs to be reset on a same level load etc.. // currently only implemented for liquids virtual void Reset() = 0; diff --git a/renderer/ModelManager.h b/renderer/ModelManager.h index 62144ca..2b61f43 100644 --- a/renderer/ModelManager.h +++ b/renderer/ModelManager.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/renderer/RenderSystem.h b/renderer/RenderSystem.h index 51524ff..806734c 100644 --- a/renderer/RenderSystem.h +++ b/renderer/RenderSystem.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -99,7 +99,7 @@ typedef struct glconfig_s { } glconfig_t; -// font support +// font support const int GLYPH_START = 0; const int GLYPH_END = 255; const int GLYPH_CHARSTART = 32; diff --git a/renderer/RenderWorld.h b/renderer/RenderWorld.h index ad590a1..8507d29 100644 --- a/renderer/RenderWorld.h +++ b/renderer/RenderWorld.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -216,7 +216,7 @@ typedef struct renderView_s { idMat3 viewaxis; // transformation matrix, view looks down the positive X axis bool cramZNear; // for cinematics, we want to set ZNear much lower - bool forceUpdate; // for an update + bool forceUpdate; // for an update // time in milliseconds for shader effects and other time dependent rendering issues int time; @@ -394,7 +394,7 @@ public: // the next renderScene virtual bool ProcessDemoCommand( idDemoFile *readDemo, renderView_t *demoRenderView, int *demoTimeOffset ) = 0; - // this is used to regenerate all interactions ( which is currently only done during influences ), there may be a less + // this is used to regenerate all interactions ( which is currently only done during influences ), there may be a less // expensive way to do it virtual void RegenerateWorld() = 0; diff --git a/renderer/glext.h b/renderer/glext.h index 7f15730..38262d9 100644 --- a/renderer/glext.h +++ b/renderer/glext.h @@ -13,21 +13,21 @@ extern "C" { ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2002 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: This software was created using the ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** not been independently verified as being compliant with the OpenGL(R) diff --git a/renderer/qgl.h b/renderer/qgl.h index b315444..855d0e6 100644 --- a/renderer/qgl.h +++ b/renderer/qgl.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -111,7 +111,7 @@ extern void ( APIENTRY *qglCombinerParameterfNV )( GLenum pname, const GLfloat p extern void ( APIENTRY *qglCombinerParameteriNV )( GLenum pname, const GLint param ); extern void ( APIENTRY *qglCombinerInputNV )( GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage ); -extern void ( APIENTRY *qglCombinerOutputNV )( GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, +extern void ( APIENTRY *qglCombinerOutputNV )( GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum ); extern void ( APIENTRY *qglFinalCombinerInputNV )( GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage ); @@ -531,14 +531,14 @@ extern BOOL ( WINAPI * qwglShareLists)(HGLRC, HGLRC); extern BOOL ( WINAPI * qwglUseFontBitmaps)(HDC, DWORD, DWORD, DWORD); extern BOOL ( WINAPI * qwglUseFontOutlines)(HDC, DWORD, DWORD, DWORD, FLOAT, - FLOAT, int, LPGLYPHMETRICSFLOAT); + FLOAT, int, LPGLYPHMETRICSFLOAT); extern BOOL ( WINAPI * qwglDescribeLayerPlane)(HDC, int, int, UINT, - LPLAYERPLANEDESCRIPTOR); + LPLAYERPLANEDESCRIPTOR); extern int ( WINAPI * qwglSetLayerPaletteEntries)(HDC, int, int, int, - CONST COLORREF *); + CONST COLORREF *); extern int ( WINAPI * qwglGetLayerPaletteEntries)(HDC, int, int, int, - COLORREF *); + COLORREF *); extern BOOL ( WINAPI * qwglRealizeLayerPalette)(HDC, int, BOOL); extern BOOL ( WINAPI * qwglSwapLayerBuffers)(HDC, UINT); diff --git a/renderer/qgl_linked.h b/renderer/qgl_linked.h index 832c6ef..f5bfc7a 100644 --- a/renderer/qgl_linked.h +++ b/renderer/qgl_linked.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/sound/sound.h b/sound/sound.h index 8475eca..226d455 100644 --- a/sound/sound.h +++ b/sound/sound.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -241,8 +241,8 @@ public: // under the assumption that we are rendering out screenshots and the gameTime is going // much slower than real time. // path should not include an extension, and the generated filenames will be: - // _left.raw, _right.raw, or _51left.raw, _51right.raw, - // _51center.raw, _51lfe.raw, _51backleft.raw, _51backright.raw, + // _left.raw, _right.raw, or _51left.raw, _51right.raw, + // _51center.raw, _51lfe.raw, _51backleft.raw, _51backright.raw, // If only two channel mixing is enabled, the left and right .raw files will also be // combined into a stereo .wav file. virtual void AVIOpen( const char *path, const char *name ) = 0; diff --git a/sys/linux/qgl_enforce.h b/sys/linux/qgl_enforce.h index d8de306..3a201ea 100644 --- a/sys/linux/qgl_enforce.h +++ b/sys/linux/qgl_enforce.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms - + @@ -1474,5 +1474,3 @@ If you have questions concerning this license or the applicable additional terms #define glMakeCurrent use_qglMakeCurrent #define glSwapBuffers use_qglSwapBuffers #define glGetProcAddressARB use_qglGetProcAddressARB - - diff --git a/sys/sys_public.h b/sys/sys_public.h index 8fa7850..c76bc38 100644 --- a/sys/sys_public.h +++ b/sys/sys_public.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -136,7 +136,7 @@ If you have questions concerning this license or the applicable additional terms #ifdef __GNUC__ #define id_attribute(x) __attribute__(x) #else -#define id_attribute(x) +#define id_attribute(x) #endif typedef enum { @@ -335,7 +335,7 @@ void Sys_GenerateEvents( void ); sysEvent_t Sys_GetEvent( void ); void Sys_ClearEvents( void ); -// input is tied to windows, so it needs to be started up and shut down whenever +// input is tied to windows, so it needs to be started up and shut down whenever // the main window is recreated void Sys_InitInput( void ); void Sys_ShutdownInput( void ); @@ -501,7 +501,7 @@ void Sys_DestroyThread( xthreadInfo& info ); // sets threadHandle back to 0 // find the name of the calling thread // if index != NULL, set the index in g_threads array (use -1 for "main" thread) const char * Sys_GetThreadName( int *index = 0 ); - + const int MAX_CRITICAL_SECTIONS = 4; enum { diff --git a/tools/compilers/aas/AASFile.h b/tools/compilers/aas/AASFile.h index 76d1dc2..d066f6e 100644 --- a/tools/compilers/aas/AASFile.h +++ b/tools/compilers/aas/AASFile.h @@ -2,7 +2,7 @@ =========================================================================== 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"). @@ -281,7 +281,7 @@ private: class idAASFile { public: - virtual ~idAASFile( void ) {} + virtual ~idAASFile( void ) {} const char * GetName( void ) const { return name.c_str(); } unsigned int GetCRC( void ) const { return crc; } diff --git a/tools/compilers/aas/AASFileManager.h b/tools/compilers/aas/AASFileManager.h index 8ca1d37..a3abaf8 100644 --- a/tools/compilers/aas/AASFileManager.h +++ b/tools/compilers/aas/AASFileManager.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/ui/ListGUI.h b/ui/ListGUI.h index 16dd7cf..044dfe9 100644 --- a/ui/ListGUI.h +++ b/ui/ListGUI.h @@ -2,7 +2,7 @@ =========================================================================== 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"). diff --git a/ui/UserInterface.h b/ui/UserInterface.h index dae7d9c..82aac37 100644 --- a/ui/UserInterface.h +++ b/ui/UserInterface.h @@ -2,7 +2,7 @@ =========================================================================== 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").