From 79ad905e05a1221e57032f8a946860153da1dc53 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. --- neo/MayaImport/exporter.h | 42 +- neo/MayaImport/maya_main.cpp | 240 +- neo/MayaImport/maya_main.h | 2 +- neo/SConstruct | 28 +- neo/TypeInfo/TypeInfoGen.cpp | 6 +- neo/TypeInfo/TypeInfoGen.h | 2 +- neo/TypeInfo/main.cpp | 2 +- neo/cm/CollisionModel.h | 2 +- neo/cm/CollisionModel_contacts.cpp | 2 +- neo/cm/CollisionModel_contents.cpp | 2 +- neo/cm/CollisionModel_debug.cpp | 2 +- neo/cm/CollisionModel_files.cpp | 2 +- neo/cm/CollisionModel_load.cpp | 6 +- neo/cm/CollisionModel_local.h | 2 +- neo/cm/CollisionModel_rotate.cpp | 2 +- neo/cm/CollisionModel_trace.cpp | 4 +- neo/cm/CollisionModel_translate.cpp | 2 +- neo/d3xp/AF.cpp | 8 +- neo/d3xp/AF.h | 2 +- neo/d3xp/AFEntity.cpp | 42 +- neo/d3xp/AFEntity.h | 4 +- neo/d3xp/Actor.cpp | 48 +- neo/d3xp/Actor.h | 8 +- neo/d3xp/BrittleFracture.cpp | 8 +- neo/d3xp/BrittleFracture.h | 2 +- neo/d3xp/Camera.cpp | 10 +- neo/d3xp/Camera.h | 2 +- neo/d3xp/EndLevel.cpp | 6 +- neo/d3xp/EndLevel.h | 3 +- neo/d3xp/Entity.cpp | 70 +- neo/d3xp/Entity.h | 16 +- neo/d3xp/Fx.cpp | 18 +- neo/d3xp/Fx.h | 2 +- neo/d3xp/Game.h | 4 +- neo/d3xp/GameEdit.cpp | 12 +- neo/d3xp/GameEdit.h | 2 +- neo/d3xp/Game_local.cpp | 77 +- neo/d3xp/Game_local.h | 10 +- neo/d3xp/Game_network.cpp | 18 +- neo/d3xp/Grabber.cpp | 8 +- neo/d3xp/Grabber.h | 4 +- neo/d3xp/IK.cpp | 46 +- neo/d3xp/IK.h | 4 +- neo/d3xp/Item.cpp | 162 +- neo/d3xp/Item.h | 30 +- neo/d3xp/Light.cpp | 28 +- neo/d3xp/Light.h | 2 +- neo/d3xp/Misc.cpp | 66 +- neo/d3xp/Misc.h | 20 +- neo/d3xp/Moveable.cpp | 16 +- neo/d3xp/Moveable.h | 4 +- neo/d3xp/Mover.cpp | 56 +- neo/d3xp/Mover.h | 6 +- neo/d3xp/MultiplayerGame.cpp | 566 +-- neo/d3xp/MultiplayerGame.h | 55 +- neo/d3xp/Player.cpp | 288 +- neo/d3xp/Player.h | 19 +- neo/d3xp/PlayerIcon.cpp | 3 +- neo/d3xp/PlayerIcon.h | 5 +- neo/d3xp/PlayerView.cpp | 20 +- neo/d3xp/PlayerView.h | 6 +- neo/d3xp/Projectile.cpp | 100 +- neo/d3xp/Projectile.h | 8 +- neo/d3xp/Pvs.cpp | 8 +- neo/d3xp/Pvs.h | 2 +- neo/d3xp/SecurityCamera.cpp | 28 +- neo/d3xp/SecurityCamera.h | 6 +- neo/d3xp/SmokeParticles.cpp | 4 +- neo/d3xp/SmokeParticles.h | 2 +- neo/d3xp/Sound.cpp | 3 +- neo/d3xp/Sound.h | 2 +- neo/d3xp/Target.cpp | 11 +- neo/d3xp/Target.h | 2 +- neo/d3xp/Trigger.cpp | 22 +- neo/d3xp/Trigger.h | 6 +- neo/d3xp/Weapon.cpp | 62 +- neo/d3xp/Weapon.h | 12 +- neo/d3xp/WorldSpawn.cpp | 2 +- neo/d3xp/WorldSpawn.h | 2 +- neo/d3xp/ai/AAS.cpp | 4 +- neo/d3xp/ai/AAS.h | 2 +- neo/d3xp/ai/AAS_debug.cpp | 4 +- neo/d3xp/ai/AAS_local.h | 2 +- neo/d3xp/ai/AAS_pathing.cpp | 2 +- neo/d3xp/ai/AAS_routing.cpp | 6 +- neo/d3xp/ai/AI.cpp | 82 +- neo/d3xp/ai/AI.h | 16 +- neo/d3xp/ai/AI_Vagary.cpp | 8 +- neo/d3xp/ai/AI_events.cpp | 35 +- neo/d3xp/ai/AI_pathing.cpp | 14 +- neo/d3xp/anim/Anim.cpp | 18 +- neo/d3xp/anim/Anim.h | 6 +- neo/d3xp/anim/Anim_Blend.cpp | 96 +- neo/d3xp/anim/Anim_Import.cpp | 10 +- neo/d3xp/anim/Anim_Testmodel.cpp | 22 +- neo/d3xp/anim/Anim_Testmodel.h | 24 +- neo/d3xp/gamesys/Callbacks.cpp | 3 +- neo/d3xp/gamesys/Class.cpp | 22 +- neo/d3xp/gamesys/Class.h | 10 +- neo/d3xp/gamesys/DebugGraph.cpp | 2 +- neo/d3xp/gamesys/DebugGraph.h | 2 +- neo/d3xp/gamesys/Event.cpp | 10 +- neo/d3xp/gamesys/Event.h | 8 +- neo/d3xp/gamesys/NoGameTypeInfo.h | 2 +- neo/d3xp/gamesys/SaveGame.cpp | 18 +- neo/d3xp/gamesys/SaveGame.h | 2 +- neo/d3xp/gamesys/SysCmds.cpp | 44 +- neo/d3xp/gamesys/SysCmds.h | 2 +- neo/d3xp/gamesys/SysCvar.cpp | 12 +- neo/d3xp/gamesys/SysCvar.h | 2 +- neo/d3xp/gamesys/TypeInfo.cpp | 2 +- neo/d3xp/gamesys/TypeInfo.h | 2 +- neo/d3xp/physics/Clip.cpp | 14 +- neo/d3xp/physics/Clip.h | 2 +- neo/d3xp/physics/Force.cpp | 2 +- neo/d3xp/physics/Force.h | 2 +- neo/d3xp/physics/Force_Constant.cpp | 2 +- neo/d3xp/physics/Force_Constant.h | 2 +- neo/d3xp/physics/Force_Drag.cpp | 2 +- neo/d3xp/physics/Force_Drag.h | 2 +- neo/d3xp/physics/Force_Field.cpp | 4 +- neo/d3xp/physics/Force_Field.h | 2 +- neo/d3xp/physics/Force_Grab.cpp | 4 +- neo/d3xp/physics/Force_Grab.h | 2 +- neo/d3xp/physics/Force_Spring.cpp | 2 +- neo/d3xp/physics/Force_Spring.h | 2 +- neo/d3xp/physics/Physics.cpp | 2 +- neo/d3xp/physics/Physics.h | 4 +- neo/d3xp/physics/Physics_AF.cpp | 8 +- neo/d3xp/physics/Physics_AF.h | 2 +- neo/d3xp/physics/Physics_Actor.cpp | 2 +- neo/d3xp/physics/Physics_Actor.h | 2 +- neo/d3xp/physics/Physics_Base.cpp | 2 +- neo/d3xp/physics/Physics_Base.h | 2 +- neo/d3xp/physics/Physics_Monster.cpp | 12 +- neo/d3xp/physics/Physics_Monster.h | 2 +- neo/d3xp/physics/Physics_Parametric.cpp | 2 +- neo/d3xp/physics/Physics_Parametric.h | 2 +- neo/d3xp/physics/Physics_Player.cpp | 13 +- neo/d3xp/physics/Physics_Player.h | 2 +- neo/d3xp/physics/Physics_RigidBody.cpp | 2 +- neo/d3xp/physics/Physics_RigidBody.h | 2 +- neo/d3xp/physics/Physics_Static.cpp | 4 +- neo/d3xp/physics/Physics_Static.h | 2 +- neo/d3xp/physics/Physics_StaticMulti.cpp | 8 +- neo/d3xp/physics/Physics_StaticMulti.h | 2 +- neo/d3xp/physics/Push.cpp | 4 +- neo/d3xp/physics/Push.h | 2 +- neo/d3xp/script/Script_Compiler.cpp | 158 +- neo/d3xp/script/Script_Compiler.h | 18 +- neo/d3xp/script/Script_Interpreter.cpp | 64 +- neo/d3xp/script/Script_Interpreter.h | 22 +- neo/d3xp/script/Script_Program.cpp | 22 +- neo/d3xp/script/Script_Program.h | 36 +- neo/d3xp/script/Script_Thread.cpp | 36 +- neo/d3xp/script/Script_Thread.h | 54 +- neo/framework/BuildDefines.h | 3 +- neo/framework/BuildVersion.h | 2 +- neo/framework/CVarSystem.cpp | 8 +- neo/framework/CVarSystem.h | 2 +- neo/framework/CmdSystem.cpp | 26 +- neo/framework/CmdSystem.h | 2 +- neo/framework/Common.cpp | 74 +- neo/framework/Common.h | 4 +- neo/framework/Compressor.cpp | 106 +- neo/framework/Compressor.h | 2 +- neo/framework/Console.cpp | 16 +- neo/framework/Console.h | 2 +- neo/framework/DeclAF.cpp | 16 +- neo/framework/DeclAF.h | 2 +- neo/framework/DeclEntityDef.cpp | 2 +- neo/framework/DeclEntityDef.h | 2 +- neo/framework/DeclFX.cpp | 8 +- neo/framework/DeclFX.h | 4 +- neo/framework/DeclManager.cpp | 70 +- neo/framework/DeclManager.h | 6 +- neo/framework/DeclPDA.cpp | 14 +- neo/framework/DeclPDA.h | 2 +- neo/framework/DeclParticle.cpp | 26 +- neo/framework/DeclParticle.h | 30 +- neo/framework/DeclSkin.cpp | 4 +- neo/framework/DeclSkin.h | 2 +- neo/framework/DeclTable.cpp | 6 +- neo/framework/DeclTable.h | 2 +- neo/framework/DemoChecksum.h | 2 +- neo/framework/DemoFile.cpp | 14 +- neo/framework/DemoFile.h | 2 +- neo/framework/EditField.cpp | 6 +- neo/framework/EditField.h | 2 +- neo/framework/EventLoop.cpp | 4 +- neo/framework/EventLoop.h | 2 +- neo/framework/File.cpp | 18 +- neo/framework/File.h | 6 +- neo/framework/FileSystem.cpp | 102 +- neo/framework/FileSystem.h | 2 +- neo/framework/KeyInput.cpp | 192 +- neo/framework/KeyInput.h | 4 +- neo/framework/Licensee.h | 2 +- neo/framework/Session.cpp | 72 +- neo/framework/Session.h | 4 +- neo/framework/Session_local.h | 18 +- neo/framework/Session_menu.cpp | 32 +- neo/framework/Unzip.cpp | 3006 ++++++------ neo/framework/Unzip.h | 92 +- neo/framework/UsercmdGen.cpp | 20 +- neo/framework/UsercmdGen.h | 2 +- neo/framework/async/AsyncClient.cpp | 46 +- neo/framework/async/AsyncClient.h | 4 +- neo/framework/async/AsyncNetwork.cpp | 17 +- neo/framework/async/AsyncNetwork.h | 8 +- neo/framework/async/AsyncServer.cpp | 54 +- neo/framework/async/AsyncServer.h | 4 +- neo/framework/async/MsgChannel.cpp | 2 +- neo/framework/async/MsgChannel.h | 2 +- neo/framework/async/NetworkSystem.cpp | 2 +- neo/framework/async/NetworkSystem.h | 2 +- neo/framework/async/ServerScan.cpp | 37 +- neo/framework/async/ServerScan.h | 26 +- neo/game/AF.cpp | 8 +- neo/game/AF.h | 2 +- neo/game/AFEntity.cpp | 10 +- neo/game/AFEntity.h | 2 +- neo/game/Actor.cpp | 44 +- neo/game/Actor.h | 6 +- neo/game/BrittleFracture.cpp | 8 +- neo/game/BrittleFracture.h | 2 +- neo/game/Camera.cpp | 10 +- neo/game/Camera.h | 2 +- neo/game/EndLevel.cpp | 6 +- neo/game/EndLevel.h | 3 +- neo/game/Entity.cpp | 70 +- neo/game/Entity.h | 14 +- neo/game/Fx.cpp | 18 +- neo/game/Fx.h | 2 +- neo/game/Game.h | 4 +- neo/game/GameEdit.cpp | 12 +- neo/game/GameEdit.h | 2 +- neo/game/Game_local.cpp | 45 +- neo/game/Game_local.h | 6 +- neo/game/Game_network.cpp | 20 +- neo/game/IK.cpp | 46 +- neo/game/IK.h | 4 +- neo/game/Item.cpp | 28 +- neo/game/Item.h | 2 +- neo/game/Light.cpp | 18 +- neo/game/Light.h | 2 +- neo/game/Misc.cpp | 56 +- neo/game/Misc.h | 18 +- neo/game/Moveable.cpp | 16 +- neo/game/Moveable.h | 4 +- neo/game/Mover.cpp | 54 +- neo/game/Mover.h | 6 +- neo/game/MultiplayerGame.cpp | 51 +- neo/game/MultiplayerGame.h | 9 +- neo/game/Player.cpp | 162 +- neo/game/Player.h | 13 +- neo/game/PlayerIcon.cpp | 3 +- neo/game/PlayerIcon.h | 5 +- neo/game/PlayerView.cpp | 19 +- neo/game/PlayerView.h | 6 +- neo/game/Projectile.cpp | 48 +- neo/game/Projectile.h | 8 +- neo/game/Pvs.cpp | 9 +- neo/game/Pvs.h | 2 +- neo/game/SecurityCamera.cpp | 28 +- neo/game/SecurityCamera.h | 6 +- neo/game/SmokeParticles.cpp | 4 +- neo/game/SmokeParticles.h | 2 +- neo/game/Sound.cpp | 3 +- neo/game/Sound.h | 2 +- neo/game/Target.cpp | 11 +- neo/game/Target.h | 2 +- neo/game/Trigger.cpp | 22 +- neo/game/Trigger.h | 2 +- neo/game/Weapon.cpp | 46 +- neo/game/Weapon.h | 12 +- neo/game/WorldSpawn.cpp | 2 +- neo/game/WorldSpawn.h | 2 +- neo/game/ai/AAS.cpp | 4 +- neo/game/ai/AAS.h | 2 +- neo/game/ai/AAS_debug.cpp | 4 +- neo/game/ai/AAS_local.h | 2 +- neo/game/ai/AAS_pathing.cpp | 2 +- neo/game/ai/AAS_routing.cpp | 6 +- neo/game/ai/AI.cpp | 66 +- neo/game/ai/AI.h | 16 +- neo/game/ai/AI_Vagary.cpp | 8 +- neo/game/ai/AI_events.cpp | 22 +- neo/game/ai/AI_pathing.cpp | 14 +- neo/game/anim/Anim.cpp | 18 +- neo/game/anim/Anim.h | 4 +- neo/game/anim/Anim_Blend.cpp | 94 +- neo/game/anim/Anim_Import.cpp | 12 +- neo/game/anim/Anim_Testmodel.cpp | 22 +- neo/game/anim/Anim_Testmodel.h | 24 +- neo/game/gamesys/Callbacks.cpp | 3 +- neo/game/gamesys/Class.cpp | 22 +- neo/game/gamesys/Class.h | 10 +- neo/game/gamesys/DebugGraph.cpp | 2 +- neo/game/gamesys/DebugGraph.h | 2 +- neo/game/gamesys/Event.cpp | 14 +- neo/game/gamesys/Event.h | 8 +- neo/game/gamesys/NoGameTypeInfo.h | 2 +- neo/game/gamesys/SaveGame.cpp | 18 +- neo/game/gamesys/SaveGame.h | 2 +- neo/game/gamesys/SysCmds.cpp | 14 +- neo/game/gamesys/SysCmds.h | 2 +- neo/game/gamesys/SysCvar.cpp | 14 +- neo/game/gamesys/SysCvar.h | 2 +- neo/game/gamesys/TypeInfo.cpp | 2 +- neo/game/gamesys/TypeInfo.h | 2 +- neo/game/physics/Clip.cpp | 12 +- neo/game/physics/Clip.h | 2 +- neo/game/physics/Force.cpp | 2 +- neo/game/physics/Force.h | 2 +- neo/game/physics/Force_Constant.cpp | 2 +- neo/game/physics/Force_Constant.h | 2 +- neo/game/physics/Force_Drag.cpp | 2 +- neo/game/physics/Force_Drag.h | 2 +- neo/game/physics/Force_Field.cpp | 4 +- neo/game/physics/Force_Field.h | 2 +- neo/game/physics/Force_Spring.cpp | 2 +- neo/game/physics/Force_Spring.h | 2 +- neo/game/physics/Physics.cpp | 2 +- neo/game/physics/Physics.h | 4 +- neo/game/physics/Physics_AF.cpp | 8 +- neo/game/physics/Physics_AF.h | 2 +- neo/game/physics/Physics_Actor.cpp | 2 +- neo/game/physics/Physics_Actor.h | 2 +- neo/game/physics/Physics_Base.cpp | 2 +- neo/game/physics/Physics_Base.h | 2 +- neo/game/physics/Physics_Monster.cpp | 12 +- neo/game/physics/Physics_Monster.h | 2 +- neo/game/physics/Physics_Parametric.cpp | 2 +- neo/game/physics/Physics_Parametric.h | 2 +- neo/game/physics/Physics_Player.cpp | 13 +- neo/game/physics/Physics_Player.h | 2 +- neo/game/physics/Physics_RigidBody.cpp | 2 +- neo/game/physics/Physics_RigidBody.h | 2 +- neo/game/physics/Physics_Static.cpp | 4 +- neo/game/physics/Physics_Static.h | 2 +- neo/game/physics/Physics_StaticMulti.cpp | 8 +- neo/game/physics/Physics_StaticMulti.h | 2 +- neo/game/physics/Push.cpp | 4 +- neo/game/physics/Push.h | 2 +- neo/game/script/Script_Compiler.cpp | 158 +- neo/game/script/Script_Compiler.h | 18 +- neo/game/script/Script_Interpreter.cpp | 64 +- neo/game/script/Script_Interpreter.h | 22 +- neo/game/script/Script_Program.cpp | 22 +- neo/game/script/Script_Program.h | 36 +- neo/game/script/Script_Thread.cpp | 36 +- neo/game/script/Script_Thread.h | 52 +- neo/idlib/Base64.cpp | 20 +- neo/idlib/Base64.h | 4 +- neo/idlib/BitMsg.cpp | 8 +- neo/idlib/BitMsg.h | 2 +- neo/idlib/CmdArgs.cpp | 3 +- neo/idlib/CmdArgs.h | 2 +- neo/idlib/Dict.cpp | 16 +- neo/idlib/Dict.h | 2 +- neo/idlib/Heap.cpp | 46 +- neo/idlib/Heap.h | 4 +- neo/idlib/LangDict.cpp | 12 +- neo/idlib/LangDict.h | 2 +- neo/idlib/Lexer.cpp | 9 +- neo/idlib/Lexer.h | 7 +- neo/idlib/Lib.cpp | 24 +- neo/idlib/Lib.h | 4 +- neo/idlib/MapFile.cpp | 6 +- neo/idlib/MapFile.h | 2 +- neo/idlib/Parser.cpp | 23 +- neo/idlib/Parser.h | 2 +- neo/idlib/Str.cpp | 45 +- neo/idlib/Str.h | 2 +- neo/idlib/Timer.cpp | 2 +- neo/idlib/Timer.h | 2 +- neo/idlib/Token.cpp | 2 +- neo/idlib/Token.h | 2 +- neo/idlib/bv/Bounds.cpp | 32 +- neo/idlib/bv/Bounds.h | 2 +- neo/idlib/bv/Box.cpp | 256 +- neo/idlib/bv/Box.h | 2 +- neo/idlib/bv/Frustum.cpp | 2 +- neo/idlib/bv/Frustum.h | 2 +- neo/idlib/bv/Frustum_gcc.cpp | 2 +- neo/idlib/bv/Sphere.cpp | 2 +- neo/idlib/bv/Sphere.h | 2 +- neo/idlib/containers/BTree.h | 2 +- neo/idlib/containers/BinSearch.h | 2 +- neo/idlib/containers/HashIndex.cpp | 2 +- neo/idlib/containers/HashIndex.h | 2 +- neo/idlib/containers/HashTable.h | 2 +- neo/idlib/containers/Hierarchy.h | 6 +- neo/idlib/containers/LinkList.h | 4 +- neo/idlib/containers/List.h | 8 +- neo/idlib/containers/PlaneSet.h | 2 +- neo/idlib/containers/Queue.h | 2 +- neo/idlib/containers/Stack.h | 2 +- neo/idlib/containers/StaticList.h | 10 +- neo/idlib/containers/StrList.h | 2 +- neo/idlib/containers/StrPool.h | 4 +- neo/idlib/containers/VectorSet.h | 2 +- neo/idlib/geometry/DrawVert.cpp | 2 +- neo/idlib/geometry/DrawVert.h | 4 +- neo/idlib/geometry/JointTransform.cpp | 6 +- neo/idlib/geometry/JointTransform.h | 2 +- neo/idlib/geometry/Surface.cpp | 8 +- neo/idlib/geometry/Surface.h | 2 +- neo/idlib/geometry/Surface_Patch.cpp | 4 +- neo/idlib/geometry/Surface_Patch.h | 2 +- neo/idlib/geometry/Surface_Polytope.cpp | 2 +- neo/idlib/geometry/Surface_Polytope.h | 2 +- neo/idlib/geometry/Surface_SweptSpline.cpp | 2 +- neo/idlib/geometry/Surface_SweptSpline.h | 2 +- neo/idlib/geometry/TraceModel.cpp | 8 +- neo/idlib/geometry/TraceModel.h | 3 +- neo/idlib/geometry/Winding.cpp | 74 +- neo/idlib/geometry/Winding.h | 2 +- neo/idlib/geometry/Winding2D.cpp | 24 +- neo/idlib/geometry/Winding2D.h | 2 +- neo/idlib/hashing/MD4.cpp | 116 +- neo/idlib/hashing/MD5.cpp | 274 +- neo/idlib/math/Angles.cpp | 8 +- neo/idlib/math/Angles.h | 6 +- neo/idlib/math/Complex.cpp | 2 +- neo/idlib/math/Complex.h | 4 +- neo/idlib/math/Curve.h | 22 +- neo/idlib/math/Extrapolate.h | 2 +- neo/idlib/math/Interpolate.h | 2 +- neo/idlib/math/Lcp.cpp | 6 +- neo/idlib/math/Lcp.h | 14 +- neo/idlib/math/Math.cpp | 18 +- neo/idlib/math/Math.h | 8 +- neo/idlib/math/Matrix.cpp | 126 +- neo/idlib/math/Matrix.h | 36 +- neo/idlib/math/Ode.cpp | 15 +- neo/idlib/math/Ode.h | 2 +- neo/idlib/math/Plane.cpp | 2 +- neo/idlib/math/Plane.h | 6 +- neo/idlib/math/Pluecker.cpp | 2 +- neo/idlib/math/Pluecker.h | 8 +- neo/idlib/math/Polynomial.cpp | 2 +- neo/idlib/math/Polynomial.h | 4 +- neo/idlib/math/Quat.cpp | 2 +- neo/idlib/math/Quat.h | 6 +- neo/idlib/math/Random.h | 2 +- neo/idlib/math/Rotation.cpp | 2 +- neo/idlib/math/Rotation.h | 2 +- neo/idlib/math/Simd.cpp | 54 +- neo/idlib/math/Simd.h | 2 +- neo/idlib/math/Simd_3DNow.cpp | 10 +- neo/idlib/math/Simd_3DNow.h | 2 +- neo/idlib/math/Simd_AltiVec.cpp | 4010 ++++++++--------- neo/idlib/math/Simd_AltiVec.h | 22 +- neo/idlib/math/Simd_Generic.cpp | 6 +- neo/idlib/math/Simd_Generic.h | 2 +- neo/idlib/math/Simd_MMX.cpp | 250 +- neo/idlib/math/Simd_MMX.h | 2 +- neo/idlib/math/Simd_SSE.cpp | 102 +- neo/idlib/math/Simd_SSE.h | 8 +- neo/idlib/math/Simd_SSE2.cpp | 164 +- neo/idlib/math/Simd_SSE2.h | 4 +- neo/idlib/math/Simd_SSE3.cpp | 2 +- neo/idlib/math/Simd_SSE3.h | 2 +- neo/idlib/math/Vector.cpp | 10 +- neo/idlib/math/Vector.h | 46 +- neo/idlib/precompiled.cpp | 2 +- neo/idlib/precompiled.h | 2 +- neo/openal/idal.py | 162 +- neo/openal/stubs.cpp | 6 +- neo/renderer/Cinematic.cpp | 142 +- neo/renderer/Cinematic.h | 4 +- neo/renderer/GuiModel.cpp | 23 +- neo/renderer/GuiModel.h | 7 +- neo/renderer/Image.h | 61 +- neo/renderer/Image_files.cpp | 70 +- neo/renderer/Image_init.cpp | 154 +- neo/renderer/Image_load.cpp | 76 +- neo/renderer/Image_process.cpp | 9 +- neo/renderer/Image_program.cpp | 19 +- neo/renderer/Interaction.cpp | 22 +- neo/renderer/Interaction.h | 6 +- neo/renderer/Material.cpp | 42 +- neo/renderer/Material.h | 22 +- neo/renderer/MegaTexture.cpp | 26 +- neo/renderer/MegaTexture.h | 3 +- neo/renderer/Model.cpp | 98 +- neo/renderer/Model.h | 4 +- neo/renderer/ModelDecal.cpp | 18 +- neo/renderer/ModelDecal.h | 2 +- neo/renderer/ModelManager.cpp | 4 +- neo/renderer/ModelManager.h | 2 +- neo/renderer/ModelOverlay.cpp | 4 +- neo/renderer/ModelOverlay.h | 2 +- neo/renderer/Model_ase.cpp | 12 +- neo/renderer/Model_ase.h | 2 +- neo/renderer/Model_beam.cpp | 8 +- neo/renderer/Model_liquid.cpp | 8 +- neo/renderer/Model_local.h | 14 +- neo/renderer/Model_lwo.cpp | 2638 +++++------ neo/renderer/Model_lwo.h | 18 +- neo/renderer/Model_ma.cpp | 72 +- neo/renderer/Model_ma.h | 8 +- neo/renderer/Model_md3.cpp | 115 +- neo/renderer/Model_md3.h | 6 +- neo/renderer/Model_md5.cpp | 16 +- neo/renderer/Model_prt.cpp | 6 +- neo/renderer/Model_sprite.cpp | 2 +- neo/renderer/RenderEntity.cpp | 2 +- neo/renderer/RenderSystem.cpp | 36 +- neo/renderer/RenderSystem.h | 4 +- neo/renderer/RenderSystem_init.cpp | 141 +- neo/renderer/RenderWorld.cpp | 46 +- neo/renderer/RenderWorld.h | 6 +- neo/renderer/RenderWorld_demo.cpp | 18 +- neo/renderer/RenderWorld_load.cpp | 6 +- neo/renderer/RenderWorld_local.h | 4 +- neo/renderer/RenderWorld_portals.cpp | 14 +- neo/renderer/VertexCache.cpp | 6 +- neo/renderer/VertexCache.h | 4 +- neo/renderer/cg_explicit.cpp | 512 +-- neo/renderer/cg_explicit.h | 1607 ++++--- neo/renderer/draw_arb.cpp | 15 +- neo/renderer/draw_arb2.cpp | 5 +- neo/renderer/draw_common.cpp | 44 +- neo/renderer/draw_exp.cpp | 104 +- neo/renderer/draw_exp_stub.cpp | 2 +- neo/renderer/draw_nv10.cpp | 64 +- neo/renderer/draw_nv20.cpp | 101 +- neo/renderer/draw_r200.cpp | 6 +- neo/renderer/glext.h | 8 +- neo/renderer/qgl.h | 12 +- neo/renderer/qgl_linked.h | 2 +- neo/renderer/simplex.h | 190 +- neo/renderer/tr_backend.cpp | 16 +- neo/renderer/tr_deform.cpp | 40 +- neo/renderer/tr_font.cpp | 26 +- neo/renderer/tr_guisurf.cpp | 20 +- neo/renderer/tr_light.cpp | 10 +- neo/renderer/tr_lightrun.cpp | 16 +- neo/renderer/tr_local.h | 30 +- neo/renderer/tr_main.cpp | 30 +- neo/renderer/tr_orderIndexes.cpp | 3 +- neo/renderer/tr_polytope.cpp | 2 +- neo/renderer/tr_render.cpp | 44 +- neo/renderer/tr_rendertools.cpp | 74 +- neo/renderer/tr_shadowbounds.cpp | 374 +- neo/renderer/tr_stencilshadow.cpp | 38 +- neo/renderer/tr_subview.cpp | 6 +- neo/renderer/tr_trace.cpp | 6 +- neo/renderer/tr_trisurf.cpp | 69 +- neo/renderer/tr_turboshadow.cpp | 4 +- neo/renderer/wglext.h | 9 +- neo/sound/snd_cache.cpp | 24 +- neo/sound/snd_decoder.cpp | 2 +- neo/sound/snd_efxfile.cpp | 12 +- neo/sound/snd_emitter.cpp | 22 +- neo/sound/snd_local.h | 112 +- neo/sound/snd_shader.cpp | 8 +- neo/sound/snd_system.cpp | 32 +- neo/sound/snd_wavefile.cpp | 32 +- neo/sound/snd_world.cpp | 56 +- neo/sound/sound.h | 6 +- neo/sys/gllog/gl_def.m4 | 1 - neo/sys/gllog/gl_extensions.cpp.m4 | 8 +- neo/sys/gllog/logfunc.py | 4 +- neo/sys/gllog/read.py | 2 +- neo/sys/gllog/wgl.api | 2 +- neo/sys/linux/dedicated.cpp | 7 +- neo/sys/linux/glimp.cpp | 40 +- neo/sys/linux/glimp_dlopen.cpp.m4 | 12 +- neo/sys/linux/glimp_glenum.h | 2 +- neo/sys/linux/glimp_local.h.m4 | 4 +- neo/sys/linux/glimp_logging.cpp.m4 | 6 +- neo/sys/linux/glimp_stub.cpp.m4 | 4 +- neo/sys/linux/input.cpp | 72 +- neo/sys/linux/local.h | 2 +- neo/sys/linux/main.cpp | 26 +- neo/sys/linux/pk4/id_utils.py | 83 +- neo/sys/linux/pk4/packup-nocase.sh | 1 - neo/sys/linux/pk4/packup.sh | 1 - neo/sys/linux/pk4/updatepaks.sh | 1 - neo/sys/linux/process_undef.pl | 1 - neo/sys/linux/qgl_enforce.h | 6 +- neo/sys/linux/qgl_enforce.h.m4 | 5 +- neo/sys/linux/runner/runner_lib.py | 20 +- neo/sys/linux/setup/brandelf.c | 2 +- neo/sys/linux/setup/image-base/setup.sh | 218 +- .../image-demo/setup.data/postinstall.sh | 16 +- .../setup/image/setup.data/postinstall.sh | 16 +- .../linux/setup/makeself/makeself-header.sh | 192 +- neo/sys/linux/setup/makeself/makeself.sh | 242 +- neo/sys/linux/sound.cpp | 49 +- neo/sys/linux/sound.h | 20 +- neo/sys/linux/sound_alsa.cpp | 18 +- neo/sys/linux/stack.cpp | 10 +- neo/sys/linux/test_scheduler.c | 14 +- neo/sys/osx/DOOMController.mm | 476 +- neo/sys/osx/PickMonitor.cpp | 84 +- neo/sys/osx/PickMonitor.h | 2 +- neo/sys/osx/PreferencesDialog.cpp | 218 +- neo/sys/osx/PreferencesDialog.h | 6 +- neo/sys/osx/macosx_event.mm | 314 +- neo/sys/osx/macosx_glimp.mm | 296 +- neo/sys/osx/macosx_local.h | 4 +- neo/sys/osx/macosx_misc.mm | 6 +- neo/sys/osx/macosx_sound.cpp | 26 +- neo/sys/osx/macosx_sys.h | 50 +- neo/sys/osx/macosx_sys.mm | 92 +- neo/sys/osx/macosx_utils.mm | 140 +- neo/sys/osx/showcursor.c | 46 +- neo/sys/posix/posix_input.cpp | 6 +- neo/sys/posix/posix_main.cpp | 36 +- neo/sys/posix/posix_net.cpp | 64 +- neo/sys/posix/posix_public.h | 3 +- neo/sys/posix/posix_signal.cpp | 24 +- neo/sys/posix/posix_threads.cpp | 15 +- neo/sys/scons/SConscript.core | 4 +- neo/sys/scons/SConscript.game | 2 - neo/sys/scons/SConscript.gl | 8 +- neo/sys/scons/SDK.py | 2 +- neo/sys/scons/Setup.py | 5 +- neo/sys/scons/scons_utils.py | 12 +- neo/sys/stub/stub_gl.cpp | 2 +- neo/sys/stub/sys_stub.cpp | 12 +- neo/sys/stub/util_stub.cpp | 2 +- neo/sys/sys_local.cpp | 7 +- neo/sys/sys_local.h | 2 +- neo/sys/sys_public.h | 8 +- neo/sys/win32/eax.h | 318 +- neo/sys/win32/gl_logfuncs.cpp | 2 +- neo/sys/win32/rc/AFEditor_resource.h | 4 +- neo/sys/win32/rc/Common_resource.h | 4 +- neo/sys/win32/rc/CreateResourceIDs.cpp | 2 +- neo/sys/win32/rc/CreateResourceIDs.h | 2 +- neo/sys/win32/rc/Debugger_resource.h | 4 +- neo/sys/win32/rc/DeclEditor_resource.h | 4 +- neo/sys/win32/rc/GuiEd_resource.h | 4 +- neo/sys/win32/rc/MaterialEditor_Resource.h | 4 +- neo/sys/win32/rc/PDAEditor_resource.h | 4 +- neo/sys/win32/rc/ParticleEditor_resource.h | 4 +- neo/sys/win32/rc/PropTree_resource.h | 4 +- neo/sys/win32/rc/Radiant_resource.h | 4 +- neo/sys/win32/rc/ScriptEditor_resource.h | 4 +- neo/sys/win32/rc/SoundEditor_resource.h | 4 +- neo/sys/win32/rc/doom_resource.h | 4 +- neo/sys/win32/sdk/prepare.py | 62 +- neo/sys/win32/win_cpu.cpp | 28 +- neo/sys/win32/win_gamma.cpp | 2 +- neo/sys/win32/win_glimp.cpp | 98 +- neo/sys/win32/win_input.cpp | 524 +-- neo/sys/win32/win_local.h | 6 +- neo/sys/win32/win_main.cpp | 110 +- neo/sys/win32/win_net.cpp | 42 +- neo/sys/win32/win_qgl.cpp | 1600 +++---- neo/sys/win32/win_shared.cpp | 12 +- neo/sys/win32/win_snd.cpp | 582 +-- neo/sys/win32/win_syscon.cpp | 34 +- neo/sys/win32/win_taskkeyhook.cpp | 4 +- neo/sys/win32/win_wndproc.cpp | 58 +- neo/tools/af/DialogAF.cpp | 6 +- neo/tools/af/DialogAF.h | 2 +- neo/tools/af/DialogAFBody.cpp | 4 +- neo/tools/af/DialogAFBody.h | 2 +- neo/tools/af/DialogAFConstraint.cpp | 4 +- neo/tools/af/DialogAFConstraint.h | 2 +- .../af/DialogAFConstraintBallAndSocket.cpp | 2 +- .../af/DialogAFConstraintBallAndSocket.h | 2 +- neo/tools/af/DialogAFConstraintFixed.cpp | 2 +- neo/tools/af/DialogAFConstraintFixed.h | 2 +- neo/tools/af/DialogAFConstraintHinge.cpp | 2 +- neo/tools/af/DialogAFConstraintHinge.h | 2 +- neo/tools/af/DialogAFConstraintSlider.cpp | 2 +- neo/tools/af/DialogAFConstraintSlider.h | 2 +- neo/tools/af/DialogAFConstraintSpring.cpp | 2 +- neo/tools/af/DialogAFConstraintSpring.h | 2 +- neo/tools/af/DialogAFConstraintUniversal.cpp | 2 +- neo/tools/af/DialogAFConstraintUniversal.h | 2 +- neo/tools/af/DialogAFName.cpp | 2 +- neo/tools/af/DialogAFName.h | 2 +- neo/tools/af/DialogAFProperties.cpp | 2 +- neo/tools/af/DialogAFProperties.h | 2 +- neo/tools/af/DialogAFView.cpp | 2 +- neo/tools/af/DialogAFView.h | 2 +- neo/tools/comafx/CDIB.cpp | 50 +- neo/tools/comafx/CDIB.h | 6 +- neo/tools/comafx/CPathTreeCtrl.cpp | 4 +- neo/tools/comafx/CPathTreeCtrl.h | 2 +- neo/tools/comafx/CSyntaxRichEditCtrl.cpp | 14 +- neo/tools/comafx/CSyntaxRichEditCtrl.h | 8 +- neo/tools/comafx/DialogColorPicker.cpp | 152 +- neo/tools/comafx/DialogColorPicker.h | 6 +- neo/tools/comafx/DialogGoToLine.cpp | 6 +- neo/tools/comafx/DialogGoToLine.h | 2 +- neo/tools/comafx/DialogName.cpp | 10 +- neo/tools/comafx/DialogName.h | 2 +- neo/tools/comafx/StdAfx.cpp | 2 +- neo/tools/comafx/StdAfx.h | 2 +- neo/tools/comafx/VectorCtl.cpp | 438 +- neo/tools/comafx/VectorCtl.h | 214 +- neo/tools/common/AlphaPopup.cpp | 106 +- neo/tools/common/ColorButton.cpp | 36 +- neo/tools/common/ColorButton.h | 2 +- neo/tools/common/DialogHelpers.h | 30 +- neo/tools/common/MaskEdit.cpp | 6 +- neo/tools/common/MaskEdit.h | 2 +- neo/tools/common/OpenFileDialog.cpp | 94 +- neo/tools/common/OpenFileDialog.h | 12 +- neo/tools/common/PropTree/PropTree.cpp | 28 +- neo/tools/common/PropTree/PropTree.h | 10 +- neo/tools/common/PropTree/PropTreeInfo.cpp | 8 +- neo/tools/common/PropTree/PropTreeInfo.h | 6 +- neo/tools/common/PropTree/PropTreeItem.cpp | 14 +- neo/tools/common/PropTree/PropTreeItem.h | 6 +- .../common/PropTree/PropTreeItemButton.cpp | 6 +- .../common/PropTree/PropTreeItemButton.h | 6 +- .../common/PropTree/PropTreeItemCheck.cpp | 12 +- neo/tools/common/PropTree/PropTreeItemCheck.h | 12 +- .../common/PropTree/PropTreeItemColor.cpp | 108 +- neo/tools/common/PropTree/PropTreeItemColor.h | 6 +- .../common/PropTree/PropTreeItemCombo.cpp | 14 +- neo/tools/common/PropTree/PropTreeItemCombo.h | 6 +- .../common/PropTree/PropTreeItemEdit.cpp | 20 +- neo/tools/common/PropTree/PropTreeItemEdit.h | 10 +- .../PropTree/PropTreeItemEditButton.cpp | 14 +- .../common/PropTree/PropTreeItemEditButton.h | 6 +- .../common/PropTree/PropTreeItemFileEdit.cpp | 12 +- .../common/PropTree/PropTreeItemFileEdit.h | 16 +- .../common/PropTree/PropTreeItemStatic.cpp | 6 +- .../common/PropTree/PropTreeItemStatic.h | 6 +- neo/tools/common/PropTree/PropTreeList.cpp | 26 +- neo/tools/common/PropTree/PropTreeList.h | 6 +- neo/tools/common/PropTree/PropTreeView.cpp | 2 +- neo/tools/common/PropTree/PropTreeView.h | 4 +- neo/tools/common/PropertyGrid.cpp | 142 +- neo/tools/common/PropertyGrid.h | 12 +- neo/tools/common/RegistryOptions.cpp | 64 +- neo/tools/common/RegistryOptions.h | 6 +- neo/tools/common/RenderBumpFlatDialog.cpp | 46 +- neo/tools/common/RenderBumpFlatDialog.h | 3 +- neo/tools/common/RollupPanel.cpp | 271 +- neo/tools/common/RollupPanel.h | 18 +- neo/tools/common/SpinButton.cpp | 28 +- neo/tools/common/SpinButton.h | 2 +- neo/tools/compilers/aas/AASBuild.cpp | 2 +- neo/tools/compilers/aas/AASBuild_file.cpp | 4 +- neo/tools/compilers/aas/AASBuild_gravity.cpp | 2 +- neo/tools/compilers/aas/AASBuild_ledge.cpp | 2 +- neo/tools/compilers/aas/AASBuild_local.h | 2 +- neo/tools/compilers/aas/AASBuild_merge.cpp | 2 +- neo/tools/compilers/aas/AASCluster.cpp | 2 +- neo/tools/compilers/aas/AASCluster.h | 4 +- neo/tools/compilers/aas/AASFile.cpp | 2 +- neo/tools/compilers/aas/AASFile.h | 4 +- neo/tools/compilers/aas/AASFileManager.cpp | 2 +- neo/tools/compilers/aas/AASFileManager.h | 2 +- neo/tools/compilers/aas/AASFile_local.h | 4 +- neo/tools/compilers/aas/AASFile_optimize.cpp | 2 +- neo/tools/compilers/aas/AASFile_sample.cpp | 4 +- neo/tools/compilers/aas/AASReach.cpp | 2 +- neo/tools/compilers/aas/AASReach.h | 2 +- neo/tools/compilers/aas/Brush.cpp | 2 +- neo/tools/compilers/aas/Brush.h | 2 +- neo/tools/compilers/aas/BrushBSP.cpp | 18 +- neo/tools/compilers/aas/BrushBSP.h | 2 +- neo/tools/compilers/compiler_public.h | 2 +- neo/tools/compilers/dmap/dmap.cpp | 6 +- neo/tools/compilers/dmap/dmap.h | 4 +- neo/tools/compilers/dmap/facebsp.cpp | 3 +- neo/tools/compilers/dmap/gldraw.cpp | 12 +- neo/tools/compilers/dmap/glfile.cpp | 3 +- neo/tools/compilers/dmap/leakfile.cpp | 3 +- neo/tools/compilers/dmap/map.cpp | 16 +- neo/tools/compilers/dmap/optimize.cpp | 18 +- neo/tools/compilers/dmap/optimize_gcc.cpp | 4 +- neo/tools/compilers/dmap/output.cpp | 16 +- neo/tools/compilers/dmap/portals.cpp | 32 +- neo/tools/compilers/dmap/shadowopt3.cpp | 28 +- neo/tools/compilers/dmap/tritjunction.cpp | 12 +- neo/tools/compilers/dmap/tritools.cpp | 12 +- neo/tools/compilers/dmap/ubrush.cpp | 8 +- neo/tools/compilers/dmap/usurface.cpp | 35 +- neo/tools/compilers/renderbump/renderbump.cpp | 34 +- .../compilers/roqvq/NSBitmapImageRep.cpp | 3 +- neo/tools/compilers/roqvq/codec.cpp | 219 +- neo/tools/compilers/roqvq/codec.h | 12 +- neo/tools/compilers/roqvq/gdefs.h | 10 +- neo/tools/compilers/roqvq/quaddefs.h | 10 +- neo/tools/compilers/roqvq/roq.cpp | 56 +- neo/tools/compilers/roqvq/roq.h | 20 +- neo/tools/compilers/roqvq/roqParam.cpp | 52 +- neo/tools/compilers/roqvq/roqParam.h | 4 +- neo/tools/debugger/DebuggerApp.cpp | 23 +- neo/tools/debugger/DebuggerApp.h | 10 +- neo/tools/debugger/DebuggerBreakpoint.cpp | 10 +- neo/tools/debugger/DebuggerBreakpoint.h | 6 +- neo/tools/debugger/DebuggerClient.cpp | 125 +- neo/tools/debugger/DebuggerClient.h | 24 +- neo/tools/debugger/DebuggerFindDlg.cpp | 18 +- neo/tools/debugger/DebuggerFindDlg.h | 2 +- neo/tools/debugger/DebuggerMessages.h | 2 +- neo/tools/debugger/DebuggerQuickWatchDlg.cpp | 64 +- neo/tools/debugger/DebuggerQuickWatchDlg.h | 2 +- neo/tools/debugger/DebuggerScript.cpp | 50 +- neo/tools/debugger/DebuggerScript.h | 8 +- neo/tools/debugger/DebuggerServer.cpp | 186 +- neo/tools/debugger/DebuggerServer.h | 24 +- neo/tools/debugger/DebuggerWindow.cpp | 630 +-- neo/tools/debugger/DebuggerWindow.h | 41 +- neo/tools/debugger/debugger.cpp | 27 +- neo/tools/decl/DialogDeclBrowser.cpp | 6 +- neo/tools/decl/DialogDeclBrowser.h | 2 +- neo/tools/decl/DialogDeclEditor.cpp | 12 +- neo/tools/decl/DialogDeclEditor.h | 4 +- neo/tools/decl/DialogDeclNew.cpp | 4 +- neo/tools/decl/DialogDeclNew.h | 2 +- neo/tools/decl/DialogEntityDefEditor.cpp | 4 +- neo/tools/decl/DialogEntityDefEditor.h | 4 +- neo/tools/edit_public.h | 2 +- neo/tools/edit_stub.cpp | 2 +- neo/tools/guied/GEApp.cpp | 377 +- neo/tools/guied/GEApp.h | 20 +- neo/tools/guied/GECheckInDlg.cpp | 31 +- neo/tools/guied/GEDeleteModifier.cpp | 7 +- neo/tools/guied/GEDeleteModifier.h | 4 +- neo/tools/guied/GEHideModifier.cpp | 7 +- neo/tools/guied/GEHideModifier.h | 4 +- neo/tools/guied/GEInsertModifier.cpp | 27 +- neo/tools/guied/GEInsertModifier.h | 6 +- neo/tools/guied/GEItemPropsDlg.cpp | 261 +- neo/tools/guied/GEItemPropsDlg.h | 2 +- neo/tools/guied/GEItemScriptsDlg.cpp | 109 +- neo/tools/guied/GEItemScriptsDlg.h | 2 +- neo/tools/guied/GEKeyValueModifier.cpp | 10 +- neo/tools/guied/GEKeyValueModifier.h | 10 +- neo/tools/guied/GEModifier.cpp | 5 +- neo/tools/guied/GEModifier.h | 16 +- neo/tools/guied/GEModifierGroup.cpp | 30 +- neo/tools/guied/GEModifierGroup.h | 14 +- neo/tools/guied/GEModifierStack.cpp | 27 +- neo/tools/guied/GEModifierStack.h | 10 +- neo/tools/guied/GEMoveModifier.cpp | 14 +- neo/tools/guied/GEMoveModifier.h | 10 +- neo/tools/guied/GENavigator.cpp | 189 +- neo/tools/guied/GENavigator.h | 10 +- neo/tools/guied/GEOptions.cpp | 26 +- neo/tools/guied/GEOptions.h | 25 +- neo/tools/guied/GEOptionsDlg.cpp | 38 +- neo/tools/guied/GEOptionsDlg.h | 2 +- neo/tools/guied/GEProperties.cpp | 82 +- neo/tools/guied/GEProperties.h | 10 +- neo/tools/guied/GEPropertyPage.cpp | 31 +- neo/tools/guied/GEPropertyPage.h | 8 +- neo/tools/guied/GESelectionMgr.cpp | 94 +- neo/tools/guied/GESelectionMgr.h | 14 +- neo/tools/guied/GESizeModifier.cpp | 12 +- neo/tools/guied/GESizeModifier.h | 12 +- neo/tools/guied/GEStateModifier.cpp | 11 +- neo/tools/guied/GEStateModifier.h | 8 +- neo/tools/guied/GEStatusBar.cpp | 16 +- neo/tools/guied/GEStatusBar.h | 10 +- neo/tools/guied/GETransformer.cpp | 108 +- neo/tools/guied/GETransformer.h | 14 +- neo/tools/guied/GEViewer.cpp | 160 +- neo/tools/guied/GEViewer.h | 12 +- neo/tools/guied/GEWindowWrapper.cpp | 21 +- neo/tools/guied/GEWindowWrapper.h | 26 +- neo/tools/guied/GEWindowWrapper_stub.cpp | 2 +- neo/tools/guied/GEWorkspace.cpp | 462 +- neo/tools/guied/GEWorkspace.h | 56 +- neo/tools/guied/GEWorkspaceFile.cpp | 99 +- neo/tools/guied/GEZOrderModifier.cpp | 36 +- neo/tools/guied/GEZOrderModifier.h | 10 +- neo/tools/guied/guied.cpp | 42 +- neo/tools/materialeditor/ConsoleView.cpp | 38 +- neo/tools/materialeditor/ConsoleView.h | 12 +- neo/tools/materialeditor/FindDialog.cpp | 10 +- neo/tools/materialeditor/FindDialog.h | 4 +- neo/tools/materialeditor/MEMainFrame.cpp | 52 +- neo/tools/materialeditor/MEMainFrame.h | 94 +- neo/tools/materialeditor/MEOptions.cpp | 10 +- neo/tools/materialeditor/MEOptions.h | 4 +- neo/tools/materialeditor/MaterialDef.cpp | 6 +- neo/tools/materialeditor/MaterialDef.h | 14 +- neo/tools/materialeditor/MaterialDoc.cpp | 53 +- neo/tools/materialeditor/MaterialDoc.h | 11 +- .../materialeditor/MaterialDocManager.cpp | 56 +- neo/tools/materialeditor/MaterialDocManager.h | 14 +- neo/tools/materialeditor/MaterialEditView.cpp | 19 +- neo/tools/materialeditor/MaterialEditView.h | 14 +- neo/tools/materialeditor/MaterialEditor.cpp | 13 +- neo/tools/materialeditor/MaterialEditor.h | 2 +- neo/tools/materialeditor/MaterialModifier.cpp | 27 +- neo/tools/materialeditor/MaterialModifier.h | 27 +- .../MaterialPreviewPropView.cpp | 6 +- .../materialeditor/MaterialPreviewPropView.h | 4 +- .../materialeditor/MaterialPreviewView.cpp | 7 +- .../materialeditor/MaterialPreviewView.h | 3 +- .../materialeditor/MaterialPropTreeView.cpp | 17 +- .../materialeditor/MaterialPropTreeView.h | 16 +- neo/tools/materialeditor/MaterialTreeView.cpp | 83 +- neo/tools/materialeditor/MaterialTreeView.h | 58 +- neo/tools/materialeditor/MaterialView.cpp | 3 +- neo/tools/materialeditor/MaterialView.h | 16 +- neo/tools/materialeditor/StageView.cpp | 66 +- neo/tools/materialeditor/StageView.h | 48 +- neo/tools/materialeditor/ToggleListView.cpp | 52 +- neo/tools/materialeditor/ToggleListView.h | 18 +- neo/tools/particle/DialogParticleEditor.cpp | 48 +- neo/tools/particle/DialogParticleEditor.h | 6 +- neo/tools/pda/DialogPDAEditor.cpp | 15 +- neo/tools/pda/DialogPDAEditor.h | 4 +- neo/tools/radiant/CSG.CPP | 8 +- neo/tools/radiant/CamWnd.cpp | 75 +- neo/tools/radiant/CamWnd.h | 4 +- neo/tools/radiant/CameraTargetDlg.cpp | 6 +- neo/tools/radiant/CameraTargetDlg.h | 2 +- neo/tools/radiant/CapDialog.cpp | 2 +- neo/tools/radiant/CapDialog.h | 2 +- neo/tools/radiant/CommandsDlg.cpp | 5 +- neo/tools/radiant/CommandsDlg.h | 2 +- neo/tools/radiant/CommentsDlg.cpp | 4 +- neo/tools/radiant/CommentsDlg.h | 2 +- neo/tools/radiant/ConsoleDlg.cpp | 76 +- neo/tools/radiant/ConsoleDlg.h | 10 +- neo/tools/radiant/CurveDlg.cpp | 2 +- neo/tools/radiant/CurveDlg.h | 2 +- neo/tools/radiant/DRAG.CPP | 10 +- neo/tools/radiant/DialogInfo.cpp | 20 +- neo/tools/radiant/DialogInfo.h | 2 +- neo/tools/radiant/DialogTextures.cpp | 48 +- neo/tools/radiant/DialogTextures.h | 2 +- neo/tools/radiant/DialogThick.cpp | 2 +- neo/tools/radiant/DialogThick.h | 2 +- neo/tools/radiant/DlgCamera.cpp | 62 +- neo/tools/radiant/DlgCamera.h | 2 +- neo/tools/radiant/DlgEvent.cpp | 2 +- neo/tools/radiant/DlgEvent.h | 2 +- neo/tools/radiant/ECLASS.CPP | 30 +- neo/tools/radiant/EditViewDlg.cpp | 20 +- neo/tools/radiant/EditViewDlg.h | 4 +- neo/tools/radiant/EditorBrush.cpp | 106 +- neo/tools/radiant/EditorBrush.h | 2 +- neo/tools/radiant/EditorBrushPrimit.cpp | 11 +- neo/tools/radiant/EditorEntity.cpp | 57 +- neo/tools/radiant/EditorEntity.h | 6 +- neo/tools/radiant/EditorMap.cpp | 40 +- neo/tools/radiant/EditorMap.h | 6 +- neo/tools/radiant/EntKeyFindReplace.cpp | 27 +- neo/tools/radiant/EntKeyFindReplace.h | 10 +- neo/tools/radiant/EntityDlg.cpp | 39 +- neo/tools/radiant/EntityDlg.h | 4 +- neo/tools/radiant/EntityListDlg.cpp | 16 +- neo/tools/radiant/EntityListDlg.h | 2 +- neo/tools/radiant/FindTextureDlg.cpp | 48 +- neo/tools/radiant/FindTextureDlg.h | 2 +- neo/tools/radiant/GLWidget.cpp | 50 +- neo/tools/radiant/GLWidget.h | 6 +- neo/tools/radiant/GetString.cpp | 15 +- neo/tools/radiant/GetString.h | 4 +- neo/tools/radiant/InspectorDialog.cpp | 8 +- neo/tools/radiant/InspectorDialog.h | 4 +- neo/tools/radiant/LightDlg.cpp | 94 +- neo/tools/radiant/LightDlg.h | 14 +- neo/tools/radiant/MRU.CPP | 238 +- neo/tools/radiant/MRU.H | 22 +- neo/tools/radiant/MainFrm.cpp | 148 +- neo/tools/radiant/MainFrm.h | 6 +- neo/tools/radiant/MapInfo.cpp | 32 +- neo/tools/radiant/MapInfo.h | 2 +- neo/tools/radiant/MediaPreviewDlg.cpp | 4 +- neo/tools/radiant/MediaPreviewDlg.h | 2 +- neo/tools/radiant/NewProjDlg.cpp | 2 +- neo/tools/radiant/NewProjDlg.h | 2 +- neo/tools/radiant/NewTexWnd.cpp | 28 +- neo/tools/radiant/NewTexWnd.h | 2 +- neo/tools/radiant/PARSE.CPP | 13 +- neo/tools/radiant/PARSE.H | 3 +- neo/tools/radiant/PMESH.CPP | 63 +- neo/tools/radiant/PMESH.H | 4 +- neo/tools/radiant/PatchDensityDlg.cpp | 10 +- neo/tools/radiant/PatchDensityDlg.h | 2 +- neo/tools/radiant/PatchDialog.cpp | 140 +- neo/tools/radiant/PatchDialog.h | 2 +- neo/tools/radiant/PointFile.cpp | 3 +- neo/tools/radiant/PrefsDlg.cpp | 6 +- neo/tools/radiant/PrefsDlg.h | 2 +- neo/tools/radiant/PreviewDlg.cpp | 22 +- neo/tools/radiant/PreviewDlg.h | 6 +- neo/tools/radiant/PropertyList.cpp | 55 +- neo/tools/radiant/PropertyList.h | 4 +- neo/tools/radiant/QE3.CPP | 11 +- neo/tools/radiant/QE3.H | 54 +- neo/tools/radiant/QEDEFS.H | 6 +- neo/tools/radiant/QERTYPES.H | 22 +- neo/tools/radiant/Radiant.cpp | 16 +- neo/tools/radiant/Radiant.h | 2 +- neo/tools/radiant/RotateDlg.cpp | 22 +- neo/tools/radiant/RotateDlg.h | 2 +- neo/tools/radiant/SELECT.CPP | 64 +- neo/tools/radiant/SELECT.H | 2 +- neo/tools/radiant/ScaleDialog.cpp | 2 +- neo/tools/radiant/ScaleDialog.h | 2 +- neo/tools/radiant/SurfaceDlg.cpp | 60 +- neo/tools/radiant/SurfaceDlg.h | 2 +- neo/tools/radiant/TabsDlg.cpp | 52 +- neo/tools/radiant/TabsDlg.h | 12 +- neo/tools/radiant/TearoffContainerWindow.cpp | 22 +- neo/tools/radiant/TearoffContainerWindow.h | 6 +- neo/tools/radiant/TextureBar.cpp | 70 +- neo/tools/radiant/TextureBar.h | 2 +- neo/tools/radiant/Textures.h | 2 +- neo/tools/radiant/Undo.cpp | 20 +- neo/tools/radiant/Undo.h | 3 +- neo/tools/radiant/VERTSEL.CPP | 6 +- neo/tools/radiant/WIN_DLG.CPP | 178 +- neo/tools/radiant/WIN_QE3.CPP | 6 +- neo/tools/radiant/WaitDlg.cpp | 10 +- neo/tools/radiant/WaitDlg.h | 2 +- neo/tools/radiant/WaveOpen.cpp | 22 +- neo/tools/radiant/WaveOpen.h | 2 +- neo/tools/radiant/XYWnd.cpp | 84 +- neo/tools/radiant/XYWnd.h | 8 +- neo/tools/radiant/Z.CPP | 36 +- neo/tools/radiant/Z.H | 3 +- neo/tools/radiant/ZClip.cpp | 18 +- neo/tools/radiant/ZClip.h | 4 +- neo/tools/radiant/ZWnd.cpp | 78 +- neo/tools/radiant/ZWnd.h | 2 +- neo/tools/radiant/autocaulk.cpp | 56 +- neo/tools/radiant/autocaulk.h | 3 +- neo/tools/radiant/cmdlib.cpp | 2 +- neo/tools/radiant/cmdlib.h | 10 +- neo/tools/radiant/splines.cpp | 60 +- neo/tools/radiant/splines.h | 10 +- neo/tools/script/DialogScriptEditor.cpp | 14 +- neo/tools/script/DialogScriptEditor.h | 4 +- neo/tools/sound/DialogSound.cpp | 84 +- neo/tools/sound/DialogSound.h | 2 +- neo/tools/sound/DialogSoundGroup.cpp | 14 +- neo/tools/sound/DialogSoundGroup.h | 2 +- neo/ui/BindWindow.cpp | 4 +- neo/ui/BindWindow.h | 10 +- neo/ui/ChoiceWindow.cpp | 14 +- neo/ui/ChoiceWindow.h | 16 +- neo/ui/DeviceContext.cpp | 42 +- neo/ui/DeviceContext.h | 6 +- neo/ui/EditWindow.cpp | 30 +- neo/ui/EditWindow.h | 20 +- neo/ui/FieldWindow.cpp | 3 +- neo/ui/FieldWindow.h | 4 +- neo/ui/GameBearShootWindow.cpp | 16 +- neo/ui/GameBearShootWindow.h | 4 +- neo/ui/GameBustOutWindow.cpp | 16 +- neo/ui/GameBustOutWindow.h | 4 +- neo/ui/GameSSDWindow.cpp | 198 +- neo/ui/GameSSDWindow.h | 54 +- neo/ui/GameWindow.cpp | 3 +- neo/ui/GameWindow.h | 2 +- neo/ui/GuiScript.cpp | 72 +- neo/ui/GuiScript.h | 2 +- neo/ui/ListGUI.cpp | 8 +- neo/ui/ListGUI.h | 2 +- neo/ui/ListGUILocal.h | 2 +- neo/ui/ListWindow.cpp | 9 +- neo/ui/ListWindow.h | 6 +- neo/ui/MarkerWindow.cpp | 4 +- neo/ui/MarkerWindow.h | 4 +- neo/ui/Rectangle.h | 4 +- neo/ui/RegExp.cpp | 6 +- neo/ui/RegExp.h | 2 +- neo/ui/RegExp_old.h | 8 +- neo/ui/RenderWindow.cpp | 18 +- neo/ui/RenderWindow.h | 10 +- neo/ui/SimpleWindow.cpp | 14 +- neo/ui/SimpleWindow.h | 34 +- neo/ui/SliderWindow.cpp | 11 +- neo/ui/SliderWindow.h | 11 +- neo/ui/UserInterface.cpp | 19 +- neo/ui/UserInterface.h | 2 +- neo/ui/UserInterfaceLocal.h | 2 +- neo/ui/Window.cpp | 256 +- neo/ui/Window.h | 28 +- neo/ui/Winvar.cpp | 17 +- neo/ui/Winvar.h | 43 +- 1086 files changed, 21052 insertions(+), 21253 deletions(-) diff --git a/neo/MayaImport/exporter.h b/neo/MayaImport/exporter.h index b9378fcf..94e138ba 100644 --- a/neo/MayaImport/exporter.h +++ b/neo/MayaImport/exporter.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 @@ public: const char *NextToken( const char *errorstring = NULL ); bool TokenAvailable( void ) { return currentToken < tokens.Num(); }; - int Num( void ) { return tokens.Num(); }; + int Num( void ) { return tokens.Num(); }; void UnGetToken( void ) { if ( currentToken > 0 ) { currentToken--; } }; const char *GetToken( int index ) { if ( ( index >= 0 ) && ( index < tokens.Num() ) ) { return tokens[ index ]; } else { return NULL; } }; const char *CurrentToken( void ) { return GetToken( currentToken ); }; @@ -101,10 +101,10 @@ public: class idExportOptions { private: idTokenizer tokens; - + void Reset( const char *commandline ); - -public: + +public: idStr commandLine; idStr src; idStr dest; @@ -132,9 +132,9 @@ public: float rotate; float jointThreshold; int cycleStart; - + idExportOptions( const char *commandline, const char *ospath ); - + bool jointInExportGroup( const char *jointname ); }; @@ -154,15 +154,15 @@ public: int index; int exportNum; bool keep; - + float scale; float invscale; - + MFnDagNode *dagnode; idHierarchy mayaNode; idHierarchy exportNode; - + idVec3 t; idMat3 wm; @@ -176,7 +176,7 @@ public: int firstComponent; jointFrame_t baseFrame; int depth; - + idExportJoint(); idExportJoint &operator=( const idExportJoint &other ); }; @@ -281,23 +281,23 @@ typedef struct md3Tag_s { ** XyzNormals sizeof( md3XyzNormal_t ) * numVerts * numFrames */ typedef struct { - int ident; // - + int ident; // + char name[MAX_Q3PATH]; // polyset name - + int flags; int numFrames; // all surfaces in a model should have the same - + int numShaders; // all surfaces in a model should have the same int numVerts; - + int numTriangles; int ofsTriangles; - + int ofsShaders; // offset from start of md3Surface_t int ofsSt; // texture coords are common for all frames int ofsXyzNormals; // numVerts * numFrames - + int ofsEnd; // next surface follows } md3Surface_t; @@ -328,7 +328,7 @@ typedef struct { int flags; int numFrames; - int numTags; + int numTags; int numSurfaces; int numSkins; @@ -389,7 +389,7 @@ public: int frameRate; int numFrames; int skipjoints; - int export_joints; + int export_joints; idList meshes; idExportModel(); @@ -424,7 +424,7 @@ private: void GetBindPose( MObject &jointNode, idExportJoint *joint, float scale ); void GetLocalTransform( idExportJoint *joint, idVec3 &pos, idMat3 &mat ); void GetWorldTransform( idExportJoint *joint, idVec3 &pos, idMat3 &mat, float scale ); - + void CreateJoints( float scale ); void PruneJoints( idStrList &keepjoints, idStr &prefix ); void RenameJoints( idList &renamejoints, idStr &prefix ); diff --git a/neo/MayaImport/maya_main.cpp b/neo/MayaImport/maya_main.cpp index 688f40b9..3a089c14 100644 --- a/neo/MayaImport/maya_main.cpp +++ b/neo/MayaImport/maya_main.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"). @@ -211,7 +211,7 @@ bool OSPathToRelativePath( const char *osPath, idStr &qpath, const char *game ) base = s; } } - } + } if ( base ) { s = strstr( base, "/" ); @@ -241,11 +241,11 @@ idMat3 ConvertFromIdSpace( const idMat3 &idmat ) { mat[ 0 ][ 0 ] = idmat[ 0 ][ 0 ]; mat[ 0 ][ 2 ] = -idmat[ 0 ][ 1 ]; mat[ 0 ][ 1 ] = idmat[ 0 ][ 2 ]; - + mat[ 1 ][ 0 ] = idmat[ 1 ][ 0 ]; mat[ 1 ][ 2 ] = -idmat[ 1 ][ 1 ]; mat[ 1 ][ 1 ] = idmat[ 1 ][ 2 ]; - + mat[ 2 ][ 0 ] = idmat[ 2 ][ 0 ]; mat[ 2 ][ 2 ] = -idmat[ 2 ][ 1 ]; mat[ 2 ][ 1 ] = idmat[ 2 ][ 2 ]; @@ -408,7 +408,7 @@ int idTokenizer::SetTokens( const char *buffer ) { if ( !*cmd ) { break; } - + idStr ¤t = tokens.Alloc(); while( *cmd && !isspace( *cmd ) ) { current += *cmd; @@ -603,7 +603,7 @@ idExportOptions::idExportOptions( const char *commandline, const char *ospath ) if ( quatPrecision < 0.0f ) { MayaError( "Invalid value for -quatprecision. Must be >= 0" ); } - + } else if ( token == "-jointthreshold" ) { // parse joint threshold token = tokens.NextToken( "Missing weight for -jointthreshold. Usage: -jointthreshold [minimum joint weight]" ); @@ -743,7 +743,7 @@ idExportJoint::idExportJoint() { exportNode.SetOwner( this ); dagnode = NULL; - + t = vec3_zero; wm = mat3_default; bindpos = vec3_zero; @@ -764,15 +764,15 @@ idExportJoint &idExportJoint::operator=( const idExportJoint &other ) { index = other.index; exportNum = other.exportNum; keep = other.keep; - + scale = other.scale; invscale = other.invscale; - + dagnode = other.dagnode; mayaNode = other.mayaNode; exportNode = other.exportNode; - + t = other.t; idt = other.idt; wm = other.wm; @@ -1027,7 +1027,7 @@ bool idExportModel::WriteMesh( const char *filename, idExportOptions &options ) } idCQuat bindQuat = joint->bindmat.ToQuat().ToCQuat(); - WriteFloatString( file, "\t\"%s\"\t%d ( %f %f %f ) ( %f %f %f )\t\t// %s\n", joint->name.c_str(), parentNum, + WriteFloatString( file, "\t\"%s\"\t%d ( %f %f %f ) ( %f %f %f )\t\t// %s\n", joint->name.c_str(), parentNum, joint->bindpos.x, joint->bindpos.y, joint->bindpos.z, bindQuat[ 0 ], bindQuat[ 1 ], bindQuat[ 2 ], parentName ); } WriteFloatString( file, "}\n" ); @@ -1042,11 +1042,11 @@ bool idExportModel::WriteMesh( const char *filename, idExportOptions &options ) WriteFloatString( file, "\nmesh {\n" ); WriteFloatString( file, "\t// meshes: %s\n", mesh->name.c_str() ); WriteFloatString( file, "\tshader \"%s\"\n", mesh->shader.c_str() ); - + WriteFloatString( file, "\n\tnumverts %d\n", mesh->verts.Num() ); for( j = 0; j < mesh->verts.Num(); j++ ) { WriteFloatString( file, "\tvert %d ( %f %f ) %d %d\n", j, mesh->verts[ j ].texCoords[ 0 ], mesh->verts[ j ].texCoords[ 1 ], - mesh->verts[ j ].startweight, mesh->verts[ j ].numWeights ); + mesh->verts[ j ].startweight, mesh->verts[ j ].numWeights ); } WriteFloatString( file, "\n\tnumtris %d\n", mesh->tris.Num() ); @@ -1059,7 +1059,7 @@ bool idExportModel::WriteMesh( const char *filename, idExportOptions &options ) exportWeight_t *weight; weight = &mesh->weights[ j ]; - WriteFloatString( file, "\tweight %d %d %f ( %f %f %f )\n", j, + WriteFloatString( file, "\tweight %d %d %f ( %f %f %f )\n", j, weight->joint->exportNum, weight->jointWeight, weight->offset.x, weight->offset.y, weight->offset.z ); } @@ -1156,7 +1156,7 @@ bool idExportModel::WriteAnim( const char *filename, idExportOptions &options ) WriteFloatString( file, "numJoints %d\n", jointList.Num() ); WriteFloatString( file, "frameRate %d\n", frameRate ); WriteFloatString( file, "numAnimatedComponents %d\n", numAnimatedComponents ); - + // write out the hierarchy WriteFloatString( file, "\nhierarchy {\n" ); for( i = 0; i < jointList.Num(); i++ ) { @@ -1251,7 +1251,7 @@ bool idExportModel::WriteCamera( const char *filename, idExportOptions &options WriteFloatString( file, "numFrames %d\n", camera.Num() ); WriteFloatString( file, "frameRate %d\n", frameRate ); WriteFloatString( file, "numCuts %d\n", cameraCuts.Num() ); - + // write out the cuts WriteFloatString( file, "\ncuts {\n" ); for( i = 0; i < cameraCuts.Num(); i++ ) { @@ -1511,7 +1511,7 @@ void idMayaExport::GetBindPose( MObject &jointNode, idExportJoint *joint, float if ( MS::kSuccess != status ) { // Problem retrieving world matrix return; - } + } MFnMatrixData dMatrix( worldMatrix ); MMatrix wMatrix = dMatrix.matrix( &status ); @@ -1658,7 +1658,7 @@ void idMayaExport::CreateJoints( float scale ) { delete parentNode; } - + // create long name parent = joint->mayaNode.GetParent(); if ( parent ) { @@ -1681,7 +1681,7 @@ void idMayaExport::CreateJoints( float scale ) { } joint->dagnode->getPath( dagPath ); - GetBindPose( dagPath.node( &status ), joint, scale ); + GetBindPose( dagPath.node( &status ), joint, scale ); } } @@ -1762,7 +1762,7 @@ bool idMayaExport::RemapParents( idList &remapjoints ) { // force the joint to be kept origin->keep = true; - + // make all root joints children of the origin joint joint = model.exportHead.GetChild(); while( joint ) { @@ -1787,8 +1787,8 @@ MObject idMayaExport::FindShader( MObject& setNode ) { MStatus status; MFnDependencyNode fnNode( setNode ); MPlug shaderPlug; - - shaderPlug = fnNode.findPlug( "surfaceShader" ); + + shaderPlug = fnNode.findPlug( "surfaceShader" ); if ( !shaderPlug.isNull() ) { MPlugArray connectedPlugs; bool asSrc = false; @@ -1800,8 +1800,8 @@ MObject idMayaExport::FindShader( MObject& setNode ) { } else { return connectedPlugs[ 0 ].node(); } - } - + } + return MObject::kNullObj; } @@ -1818,7 +1818,7 @@ void idMayaExport::GetTextureForMesh( idExportMesh *mesh, MFnDagNode &dagNode ) MDagPath path; int i; int instanceNum; - + status = dagNode.getPath( path ); if ( !status ) { return; @@ -1834,9 +1834,9 @@ void idMayaExport::GetTextureForMesh( idExportMesh *mesh, MFnDagNode &dagNode ) instanceNum = path.instanceNumber(); } - // Get a list of all sets pertaining to the selected shape and the - // members of those sets. - // + // Get a list of all sets pertaining to the selected shape and the + // members of those sets. + // MFnMesh fnMesh( path ); MObjectArray sets; MObjectArray comps; @@ -1846,8 +1846,8 @@ void idMayaExport::GetTextureForMesh( idExportMesh *mesh, MFnDagNode &dagNode ) } // Loop through all the sets. If the set is a polygonal set, find the - // shader attached to the and print out the texture file name for the - // set along with the polygons in the set. + // shader attached to the and print out the texture file name for the + // set along with the polygons in the set. // for ( i = 0; i < ( int )sets.length(); i++ ) { MObject set = sets[i]; @@ -1856,20 +1856,20 @@ void idMayaExport::GetTextureForMesh( idExportMesh *mesh, MFnDagNode &dagNode ) MFnSet fnSet( set, &status ); if ( status == MS::kFailure ) { MayaError( "GetTextureForMesh: MFnSet constructor failed (%s)", status.errorString().asChar() ); - continue; - } + continue; + } - // Make sure the set is a polygonal set. If not, continue. + // Make sure the set is a polygonal set. If not, continue. MItMeshPolygon piter(path, comp, &status); if (status == MS::kFailure) { - continue; + continue; } // Find the texture that is applied to this set. First, get the // shading node connected to the set. Then, if there is an input // attribute called "color", search upstream from it for a texture // file node. - // + // MObject shaderNode = FindShader( set ); if ( shaderNode == MObject::kNullObj ) { continue; @@ -1881,29 +1881,29 @@ void idMayaExport::GetTextureForMesh( idExportMesh *mesh, MFnDagNode &dagNode ) } MItDependencyGraph dgIt(colorPlug, MFn::kFileTexture, - MItDependencyGraph::kUpstream, + MItDependencyGraph::kUpstream, MItDependencyGraph::kBreadthFirst, - MItDependencyGraph::kNodeLevel, + MItDependencyGraph::kNodeLevel, &status); if ( status == MS::kFailure ) { continue; } - + dgIt.disablePruningOnFilter(); - // If no texture file node was found, just continue. - // + // If no texture file node was found, just continue. + // if ( dgIt.isDone() ) { continue; } - - // Print out the texture node name and texture file that it references. - // + + // Print out the texture node name and texture file that it references. + // MObject textureNode = dgIt.thisNode(); - MPlug filenamePlug = MFnDependencyNode( textureNode ).findPlug( "fileTextureName" ); - MString textureName; - filenamePlug.getValue( textureName ); + MPlug filenamePlug = MFnDependencyNode( textureNode ).findPlug( "fileTextureName" ); + MString textureName; + filenamePlug.getValue( textureName ); // remove the OS path and save it in the mesh OSPathToRelativePath( textureName.asChar(), mesh->shader, options.game ); @@ -2002,7 +2002,7 @@ idExportMesh *idMayaExport::CopyMesh( MFnSkinCluster &skinCluster, float scale ) return NULL; } } - + if ( options.skipmeshes.Find( name ) || options.skipmeshes.Find( altname ) ) { common->Printf( "Skipping mesh '%s' ('%s')\n", name.c_str(), altname.c_str() ); return NULL; @@ -2032,13 +2032,13 @@ idExportMesh *idMayaExport::CopyMesh( MFnSkinCluster &skinCluster, float scale ) MIntArray vertexList; int p; - + p = fnmesh.numPolygons( &status ); mesh->tris.SetNum( p ); mesh->uv.SetNum( p ); MString setName; - + status = fnmesh.getCurrentUVSetName( setName ); if ( !status ) { MayaError( "CopyMesh: MFnMesh::getCurrentUVSetName failed (%s)", status.errorString().asChar() ); @@ -2052,12 +2052,12 @@ idExportMesh *idMayaExport::CopyMesh( MFnSkinCluster &skinCluster, float scale ) for( k = 0; k < 3; k++ ) { mesh->tris[ j ].indexes[ k ] = vertexList[ k ]; - + status = fnmesh.getPolygonUV( j, k, uv_u, uv_v, &setName ); if ( !status ) { MayaError( "CopyMesh: MFnMesh::getPolygonUV failed (%s)", status.errorString().asChar() ); } - + mesh->uv[ j ].uv[ k ][ 0 ] = uv_u; mesh->uv[ j ].uv[ k ][ 1 ] = uv_v; } @@ -2086,14 +2086,14 @@ void idMayaExport::CreateMesh( float scale ) { count = 0; for ( ; !iter.isDone(); iter.next() ) { MObject object = iter.item(); - + count++; - + // For each skinCluster node, get the list of influence objects MFnSkinCluster skinCluster( object, &status ); if ( !status ) { MayaError( "%s: Error getting skin cluster (%s)", object.apiTypeStr(), status.errorString().asChar() ); - } + } mesh = CopyMesh( skinCluster, scale ); if ( !mesh ) { @@ -2109,7 +2109,7 @@ void idMayaExport::CreateMesh( float scale ) { if ( 0 == nInfs ) { MayaError( "Mesh '%s': No influence objects found", mesh->name.c_str() ); } - + // loop through the geometries affected by this cluster nGeoms = skinCluster.numOutputConnections(); for (size_t ii = 0; ii < nGeoms; ++ii) { @@ -2183,7 +2183,7 @@ void idMayaExport::CreateMesh( float scale ) { if ( w > options.jointThreshold ) { weight.joint = joints[ jj ]; weight.jointWeight = wts[ jj ]; - + if ( !options.ignoreScale ) { weight.joint->bindmat.ProjectVector( vert->pos - ( weight.joint->bindpos * weight.joint->invscale ), weight.offset ); weight.offset *= weight.joint->scale; @@ -2367,7 +2367,7 @@ float idMayaExport::GetCameraFov( idExportJoint *joint ) { fov = 90.0f; for( j = 0; j < childCount; j++ ) { MObject childNode = dagnode->child( j ); - + n1 = GetObjectType( cameraNode ); n2 = GetObjectType( childNode ); if ( ( !strcmp( "transform", n1 ) ) && ( !strcmp( "camera", n2 ) ) ) { @@ -2394,7 +2394,7 @@ void idMayaExport::GetCameraFrame( idExportJoint *camera, idMat3 &align, cameraF // get the worldspace positions of the joint GetWorldTransform( camera, pos, axis, 1.0f ); - + // convert to id coordinates cam->t = ConvertToIdSpace( pos ) * align; @@ -2482,7 +2482,7 @@ void idMayaExport::CreateCameraAnim( idMat3 &align ) { } } - camJoint = model.FindJoint( currentCam ); + camJoint = model.FindJoint( currentCam ); if ( !camJoint ) { MayaError( "Couldn't find camera '%s'", currentCam.c_str() ); } @@ -2564,7 +2564,7 @@ void idMayaExport::GetDefaultPose( idMat3 &align ) { // get the worldspace positions of the joint GetWorldTransform( joint, jointpos, jointaxis, options.scale ); - + // convert to id coordinates jointaxis = ConvertToIdSpace( jointaxis ) * align; jointpos = ConvertToIdSpace( jointpos ) * align; @@ -2682,7 +2682,7 @@ void idMayaExport::CreateAnimation( idMat3 &align ) { // get the worldspace positions of the joint GetWorldTransform( joint, jointpos, jointaxis, options.scale ); - + // convert to id coordinates jointaxis = ConvertToIdSpace( jointaxis ) * align; jointpos = ConvertToIdSpace( jointpos ) * align; @@ -2865,7 +2865,7 @@ void idMayaExport::ConvertModel( void ) { switch( options.type ) { case WRITE_MESH : - common->Printf( "Grabbing default pose:\n" ); + common->Printf( "Grabbing default pose:\n" ); GetDefaultPose( align ); common->Printf( "Writing file...\n" ); if ( !model.WriteMesh( options.dest, options ) ) { @@ -2874,7 +2874,7 @@ void idMayaExport::ConvertModel( void ) { break; case WRITE_ANIM : - common->Printf( "Creating animation frames:\n" ); + common->Printf( "Creating animation frames:\n" ); CreateAnimation( align ); common->Printf( "Writing file...\n" ); if ( !model.WriteAnim( options.dest, options ) ) { @@ -2905,7 +2905,7 @@ void idMayaExport::ConvertToMD3( void ) { #if 0 int i, j; md3Header_t *pinmodel; - md3Frame_t *frame; + md3Frame_t *frame; md3Surface_t *surf; md3Shader_t *shader; md3Triangle_t *tri; @@ -2933,59 +2933,59 @@ void idMayaExport::ConvertToMD3( void ) { memcpy (mod->md3[lod], buffer, LittleLong(pinmodel->ofsEnd) ); - LL(mod->md3[lod]->ident); - LL(mod->md3[lod]->version); - LL(mod->md3[lod]->numFrames); - LL(mod->md3[lod]->numTags); - LL(mod->md3[lod]->numSurfaces); - LL(mod->md3[lod]->ofsFrames); - LL(mod->md3[lod]->ofsTags); - LL(mod->md3[lod]->ofsSurfaces); - LL(mod->md3[lod]->ofsEnd); + LL(mod->md3[lod]->ident); + LL(mod->md3[lod]->version); + LL(mod->md3[lod]->numFrames); + LL(mod->md3[lod]->numTags); + LL(mod->md3[lod]->numSurfaces); + LL(mod->md3[lod]->ofsFrames); + LL(mod->md3[lod]->ofsTags); + LL(mod->md3[lod]->ofsSurfaces); + LL(mod->md3[lod]->ofsEnd); if ( mod->md3[lod]->numFrames < 1 ) { common->Printf( "R_LoadMD3: %s has no frames\n", mod_name ); return qfalse; } - + // swap all the frames - frame = (md3Frame_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsFrames ); - for ( i = 0 ; i < mod->md3[lod]->numFrames ; i++, frame++) { - frame->radius = LittleFloat( frame->radius ); - for ( j = 0 ; j < 3 ; j++ ) { - frame->bounds[0][j] = LittleFloat( frame->bounds[0][j] ); - frame->bounds[1][j] = LittleFloat( frame->bounds[1][j] ); - frame->localOrigin[j] = LittleFloat( frame->localOrigin[j] ); - } + frame = (md3Frame_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsFrames ); + for ( i = 0 ; i < mod->md3[lod]->numFrames ; i++, frame++) { + frame->radius = LittleFloat( frame->radius ); + for ( j = 0 ; j < 3 ; j++ ) { + frame->bounds[0][j] = LittleFloat( frame->bounds[0][j] ); + frame->bounds[1][j] = LittleFloat( frame->bounds[1][j] ); + frame->localOrigin[j] = LittleFloat( frame->localOrigin[j] ); + } } // swap all the tags - tag = (md3Tag_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsTags ); - for ( i = 0 ; i < mod->md3[lod]->numTags * mod->md3[lod]->numFrames ; i++, tag++) { - for ( j = 0 ; j < 3 ; j++ ) { + tag = (md3Tag_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsTags ); + for ( i = 0 ; i < mod->md3[lod]->numTags * mod->md3[lod]->numFrames ; i++, tag++) { + for ( j = 0 ; j < 3 ; j++ ) { tag->origin[j] = LittleFloat( tag->origin[j] ); tag->axis[0][j] = LittleFloat( tag->axis[0][j] ); tag->axis[1][j] = LittleFloat( tag->axis[1][j] ); tag->axis[2][j] = LittleFloat( tag->axis[2][j] ); - } + } } // swap all the surfaces surf = (md3Surface_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsSurfaces ); for ( i = 0 ; i < mod->md3[lod]->numSurfaces ; i++) { - LL(surf->ident); - LL(surf->flags); - LL(surf->numFrames); - LL(surf->numShaders); - LL(surf->numTriangles); - LL(surf->ofsTriangles); - LL(surf->numVerts); - LL(surf->ofsShaders); - LL(surf->ofsSt); - LL(surf->ofsXyzNormals); - LL(surf->ofsEnd); - + LL(surf->ident); + LL(surf->flags); + LL(surf->numFrames); + LL(surf->numShaders); + LL(surf->numTriangles); + LL(surf->ofsTriangles); + LL(surf->numVerts); + LL(surf->ofsShaders); + LL(surf->ofsSt); + LL(surf->ofsXyzNormals); + LL(surf->ofsEnd); + if ( surf->numVerts > SHADER_MAX_VERTEXES ) { ri.Error (ERR_DROP, "R_LoadMD3: %s has more than %i verts on a surface (%i)", mod_name, SHADER_MAX_VERTEXES, surf->numVerts ); @@ -2994,7 +2994,7 @@ void idMayaExport::ConvertToMD3( void ) { ri.Error (ERR_DROP, "R_LoadMD3: %s has more than %i triangles on a surface (%i)", mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles ); } - + // change to surface identifier surf->ident = SF_MD3; @@ -3008,18 +3008,18 @@ void idMayaExport::ConvertToMD3( void ) { surf->name[j-2] = 0; } - // register the shaders - shader = (md3Shader_t *) ( (byte *)surf + surf->ofsShaders ); - for ( j = 0 ; j < surf->numShaders ; j++, shader++ ) { - shader_t *sh; + // register the shaders + shader = (md3Shader_t *) ( (byte *)surf + surf->ofsShaders ); + for ( j = 0 ; j < surf->numShaders ; j++, shader++ ) { + shader_t *sh; - sh = R_FindShader( shader->name, LIGHTMAP_NONE, qtrue ); + sh = R_FindShader( shader->name, LIGHTMAP_NONE, qtrue ); if ( sh->defaultShader ) { shader->shaderIndex = 0; } else { shader->shaderIndex = sh->index; } - } + } // swap all the triangles tri = (md3Triangle_t *) ( (byte *)surf + surf->ofsTriangles ); @@ -3030,22 +3030,22 @@ void idMayaExport::ConvertToMD3( void ) { } // swap all the ST - st = (md3St_t *) ( (byte *)surf + surf->ofsSt ); - for ( j = 0 ; j < surf->numVerts ; j++, st++ ) { - st->st[0] = LittleFloat( st->st[0] ); - st->st[1] = LittleFloat( st->st[1] ); - } + st = (md3St_t *) ( (byte *)surf + surf->ofsSt ); + for ( j = 0 ; j < surf->numVerts ; j++, st++ ) { + st->st[0] = LittleFloat( st->st[0] ); + st->st[1] = LittleFloat( st->st[1] ); + } // swap all the XyzNormals - xyz = (md3XyzNormal_t *) ( (byte *)surf + surf->ofsXyzNormals ); - for ( j = 0 ; j < surf->numVerts * surf->numFrames ; j++, xyz++ ) + xyz = (md3XyzNormal_t *) ( (byte *)surf + surf->ofsXyzNormals ); + for ( j = 0 ; j < surf->numVerts * surf->numFrames ; j++, xyz++ ) { - xyz->xyz[0] = LittleShort( xyz->xyz[0] ); - xyz->xyz[1] = LittleShort( xyz->xyz[1] ); - xyz->xyz[2] = LittleShort( xyz->xyz[2] ); + xyz->xyz[0] = LittleShort( xyz->xyz[0] ); + xyz->xyz[1] = LittleShort( xyz->xyz[1] ); + xyz->xyz[2] = LittleShort( xyz->xyz[2] ); - xyz->normal = LittleShort( xyz->normal ); - } + xyz->normal = LittleShort( xyz->normal ); + } // find the next surface @@ -3084,16 +3084,16 @@ Maya_ConvertModel =============== */ const char *Maya_ConvertModel( const char *ospath, const char *commandline ) { - + errorMessage = "Ok"; - + try { idExportOptions options( commandline, ospath ); idMayaExport exportM( options ); exportM.ConvertModel(); } - + catch( idException &exception ) { errorMessage = exception.error; } diff --git a/neo/MayaImport/maya_main.h b/neo/MayaImport/maya_main.h index 726a1592..9f641709 100644 --- a/neo/MayaImport/maya_main.h +++ b/neo/MayaImport/maya_main.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/neo/SConstruct b/neo/SConstruct index d8cc9b17..4c0edc27 100644 --- a/neo/SConstruct +++ b/neo/SConstruct @@ -87,14 +87,14 @@ TARGET_DEMO (default 0) IDNET_HOST (default to source hardcoded) Override builtin IDNET_HOST with your own settings - + GL_HARDLINK (default 0) Instead of dynamically loading the OpenGL libraries, use implicit dependencies NOTE: no GL logging capability and no r_glDriver with GL_HARDLINK 1 DEBUG_MEMORY (default 0) Enables memory logging to file - + LIBC_MALLOC (default 1) Toggle idHeap memory / libc malloc usage When libc malloc is on, memory size statistics are wrong ( no _msize ) @@ -102,7 +102,7 @@ LIBC_MALLOC (default 1) ID_NOLANADDRESS (default 0) Don't recognize any IP as LAN address. This is useful when debugging network code where LAN / not LAN influences application behaviour - + ID_MCHECK (default 2) Perform heap consistency checking 0: on in Debug / off in Release @@ -112,9 +112,9 @@ ID_MCHECK (default 2) ALSA (default 1) enable ALSA sound backend support - + SETUP (default 0, not saved) - build a setup. implies release build + build a setup. implies release build SDK (default 0, not saved) build an SDK release @@ -245,7 +245,7 @@ if ( GL_HARDLINK != '0' ): if ( DEBUG_MEMORY != '0' ): g_build += '-debugmem' - + if ( LIBC_MALLOC != '1' ): g_build += '-nolibcmalloc' @@ -313,7 +313,7 @@ if ( GL_HARDLINK != '0' ): if ( DEBUG_MEMORY != '0' ): BASECPPFLAGS += [ '-DID_DEBUG_MEMORY', '-DID_REDIRECT_NEWDELETE' ] - + if ( LIBC_MALLOC != '1' ): BASECPPFLAGS.append( '-DUSE_LIBC_MALLOC=0' ) @@ -322,10 +322,10 @@ if ( len( IDNET_HOST ) ): if ( ID_NOLANADDRESS != '0' ): CORECPPFLAGS.append( '-DID_NOLANADDRESS' ) - + if ( ID_MCHECK == '1' ): BASECPPFLAGS.append( '-DID_MCHECK' ) - + # create the build environements g_base_env = Environment( ENV = os.environ, CC = CC, CXX = CXX, LINK = LINK, CPPFLAGS = BASECPPFLAGS, LINKFLAGS = BASELINKFLAGS, CPPPATH = CORECPPPATH, LIBPATH = CORELIBPATH ) scons_utils.SetupUtils( g_base_env ) @@ -391,7 +391,7 @@ if ( TARGET_CORE == '1' ): if ( DEDICATED == '0' or DEDICATED == '2' ): local_dedicated = 0 Export( 'GLOBALS ' + GLOBALS ) - + VariantDir( g_build + '/core/glimp', '.', duplicate = 1 ) SConscript( g_build + '/core/glimp/sys/scons/SConscript.gl' ) VariantDir( g_build + '/core', '.', duplicate = 0 ) @@ -400,11 +400,11 @@ if ( TARGET_CORE == '1' ): doom = SConscript( g_build + '/core/sys/scons/SConscript.core' ) InstallAs( '#doom.' + cpu, doom ) - + if ( DEDICATED == '1' or DEDICATED == '2' ): local_dedicated = 1 Export( 'GLOBALS ' + GLOBALS ) - + VariantDir( g_build + '/dedicated/glimp', '.', duplicate = 1 ) SConscript( g_build + '/dedicated/glimp/sys/scons/SConscript.gl' ) VariantDir( g_build + '/dedicated', '.', duplicate = 0 ) @@ -444,7 +444,7 @@ if ( TARGET_GAME == '1' or TARGET_D3XP == '1' ): game_d3xp = InstallAs( '#game%s-d3xp.so' % cpu, d3xp ) if ( BUILD_GAMEPAK == '1' ): Command( '#game01-d3xp.pk4', [ game_d3xp, d3xp ], Action( g_env.BuildGamePak ) ) - + if ( TARGET_MONO == '1' ): # NOTE: no D3XP atm. add a TARGET_MONO_D3XP local_gamedll = 0 @@ -479,7 +479,7 @@ if ( TARGET_DEMO == '1' ): doom_demo = SConscript( g_build + '/demo/sys/scons/SConscript.core' ) InstallAs( '#doom-demo.' + cpu, doom_demo ) - + local_idlibpic = 1 Export( 'GLOBALS ' + GLOBALS ) VariantDir( g_build + '/demo/game', '.', duplicate = 0 ) diff --git a/neo/TypeInfo/TypeInfoGen.cpp b/neo/TypeInfo/TypeInfoGen.cpp index ec70bfad..cacf2610 100644 --- a/neo/TypeInfo/TypeInfoGen.cpp +++ b/neo/TypeInfo/TypeInfoGen.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"). @@ -630,7 +630,7 @@ void idTypeInfoGen::ParseScope( const char *scope, bool isTemplate, idParser &sr isStatic = true; } else if ( token.type == TT_NAME ) { - + assert( indent == 1 ); // if this is a class operator @@ -720,7 +720,7 @@ void idTypeInfoGen::ParseScope( const char *scope, bool isTemplate, idParser &sr var.bits = 0; typeInfo->variables.Append( var ); if ( !src.CheckTokenString( "," ) ) { - varType = ""; + varType = ""; isConst = false; isStatic = false; break; diff --git a/neo/TypeInfo/TypeInfoGen.h b/neo/TypeInfo/TypeInfoGen.h index be1e6a44..576181cc 100644 --- a/neo/TypeInfo/TypeInfoGen.h +++ b/neo/TypeInfo/TypeInfoGen.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/neo/TypeInfo/main.cpp b/neo/TypeInfo/main.cpp index 592c235f..e4a3ccf9 100644 --- a/neo/TypeInfo/main.cpp +++ b/neo/TypeInfo/main.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/neo/cm/CollisionModel.h b/neo/cm/CollisionModel.h index 332427a5..57561f15 100644 --- a/neo/cm/CollisionModel.h +++ b/neo/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/neo/cm/CollisionModel_contacts.cpp b/neo/cm/CollisionModel_contacts.cpp index 5c0946a7..761d0331 100644 --- a/neo/cm/CollisionModel_contacts.cpp +++ b/neo/cm/CollisionModel_contacts.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/neo/cm/CollisionModel_contents.cpp b/neo/cm/CollisionModel_contents.cpp index e12b8b13..b61afbf6 100644 --- a/neo/cm/CollisionModel_contents.cpp +++ b/neo/cm/CollisionModel_contents.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/neo/cm/CollisionModel_debug.cpp b/neo/cm/CollisionModel_debug.cpp index 88b24e0c..754ecc31 100644 --- a/neo/cm/CollisionModel_debug.cpp +++ b/neo/cm/CollisionModel_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"). diff --git a/neo/cm/CollisionModel_files.cpp b/neo/cm/CollisionModel_files.cpp index 0d02552d..e8de061c 100644 --- a/neo/cm/CollisionModel_files.cpp +++ b/neo/cm/CollisionModel_files.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/neo/cm/CollisionModel_load.cpp b/neo/cm/CollisionModel_load.cpp index 896424b7..234d7a36 100644 --- a/neo/cm/CollisionModel_load.cpp +++ b/neo/cm/CollisionModel_load.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"). @@ -1360,7 +1360,7 @@ cm_polygon_t *idCollisionModelManagerLocal::TryMergePolygons( cm_model_t *model, // check if the new polygon would still be convex edgeNum = p1->edges[p1BeforeShare]; edge = model->edges + abs(edgeNum); - delta = model->vertices[edge->vertexNum[INTSIGNBITNOTSET(edgeNum)]].p - + delta = model->vertices[edge->vertexNum[INTSIGNBITNOTSET(edgeNum)]].p - model->vertices[edge->vertexNum[INTSIGNBITSET(edgeNum)]].p; normal = p1->plane.Normal().Cross( delta ); normal.Normalize(); @@ -2276,7 +2276,7 @@ idCollisionModelManagerLocal::GetVertex int idCollisionModelManagerLocal::GetVertex( cm_model_t *model, const idVec3 &v, int *vertexNum ) { int i, hashKey, vn; idVec3 vert, *p; - + for (i = 0; i < 3; i++) { if ( idMath::Fabs(v[i] - idMath::Rint(v[i])) < INTEGRAL_EPSILON ) vert[i] = idMath::Rint(v[i]); diff --git a/neo/cm/CollisionModel_local.h b/neo/cm/CollisionModel_local.h index 64ddebcd..83609745 100644 --- a/neo/cm/CollisionModel_local.h +++ b/neo/cm/CollisionModel_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/neo/cm/CollisionModel_rotate.cpp b/neo/cm/CollisionModel_rotate.cpp index 415a488c..58bb0b65 100644 --- a/neo/cm/CollisionModel_rotate.cpp +++ b/neo/cm/CollisionModel_rotate.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/neo/cm/CollisionModel_trace.cpp b/neo/cm/CollisionModel_trace.cpp index bf4d1a89..60c52883 100644 --- a/neo/cm/CollisionModel_trace.cpp +++ b/neo/cm/CollisionModel_trace.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"). @@ -198,7 +198,7 @@ void idCollisionModelManagerLocal::TraceThroughAxialBSPTree_r( cm_traceWork_t *t else if ( frac2 > 1.0f ) { frac2 = 1.0f; } - + midf = p1f + (p2f - p1f)*frac2; mid[0] = p1[0] + frac2*(p2[0] - p1[0]); diff --git a/neo/cm/CollisionModel_translate.cpp b/neo/cm/CollisionModel_translate.cpp index 695b3430..d4dd1b26 100644 --- a/neo/cm/CollisionModel_translate.cpp +++ b/neo/cm/CollisionModel_translate.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/neo/d3xp/AF.cpp b/neo/d3xp/AF.cpp index ff37d060..526c8cfd 100644 --- a/neo/d3xp/AF.cpp +++ b/neo/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/neo/d3xp/AF.h b/neo/d3xp/AF.h index 754925df..63807073 100644 --- a/neo/d3xp/AF.h +++ b/neo/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/neo/d3xp/AFEntity.cpp b/neo/d3xp/AFEntity.cpp index 56cfae08..9a3c1d81 100644 --- a/neo/d3xp/AFEntity.cpp +++ b/neo/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/neo/d3xp/AFEntity.h b/neo/d3xp/AFEntity.h index 48165db0..37391898 100644 --- a/neo/d3xp/AFEntity.h +++ b/neo/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/neo/d3xp/Actor.cpp b/neo/d3xp/Actor.cpp index 3a819193..135bae32 100644 --- a/neo/d3xp/Actor.cpp +++ b/neo/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/neo/d3xp/Actor.h b/neo/d3xp/Actor.h index 09217e73..4af60068 100644 --- a/neo/d3xp/Actor.h +++ b/neo/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/neo/d3xp/BrittleFracture.cpp b/neo/d3xp/BrittleFracture.cpp index 5e68e213..665a623b 100644 --- a/neo/d3xp/BrittleFracture.cpp +++ b/neo/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/neo/d3xp/BrittleFracture.h b/neo/d3xp/BrittleFracture.h index 9746bb48..18d704b7 100644 --- a/neo/d3xp/BrittleFracture.h +++ b/neo/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/neo/d3xp/Camera.cpp b/neo/d3xp/Camera.cpp index 214c8ea5..55eaafd6 100644 --- a/neo/d3xp/Camera.cpp +++ b/neo/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/neo/d3xp/Camera.h b/neo/d3xp/Camera.h index 1146c88e..3d6016e8 100644 --- a/neo/d3xp/Camera.h +++ b/neo/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/neo/d3xp/EndLevel.cpp b/neo/d3xp/EndLevel.cpp index 3794995c..21f1ec9f 100644 --- a/neo/d3xp/EndLevel.cpp +++ b/neo/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/neo/d3xp/EndLevel.h b/neo/d3xp/EndLevel.h index 0157502d..b2d6b046 100644 --- a/neo/d3xp/EndLevel.h +++ b/neo/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/neo/d3xp/Entity.cpp b/neo/d3xp/Entity.cpp index fc00c6d2..64d9bd88 100644 --- a/neo/d3xp/Entity.cpp +++ b/neo/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/neo/d3xp/Entity.h b/neo/d3xp/Entity.h index f023de90..7d910081 100644 --- a/neo/d3xp/Entity.h +++ b/neo/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/neo/d3xp/Fx.cpp b/neo/d3xp/Fx.cpp index e7e3440a..3be55973 100644 --- a/neo/d3xp/Fx.cpp +++ b/neo/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/neo/d3xp/Fx.h b/neo/d3xp/Fx.h index ca75c55d..f546d418 100644 --- a/neo/d3xp/Fx.h +++ b/neo/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/neo/d3xp/Game.h b/neo/d3xp/Game.h index 0fb34977..fee57b21 100644 --- a/neo/d3xp/Game.h +++ b/neo/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/neo/d3xp/GameEdit.cpp b/neo/d3xp/GameEdit.cpp index f8f19c73..a5be11e2 100644 --- a/neo/d3xp/GameEdit.cpp +++ b/neo/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/neo/d3xp/GameEdit.h b/neo/d3xp/GameEdit.h index 5fc74e58..4e63f67e 100644 --- a/neo/d3xp/GameEdit.h +++ b/neo/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/neo/d3xp/Game_local.cpp b/neo/d3xp/Game_local.cpp index 00bf3673..d16954da 100644 --- a/neo/d3xp/Game_local.cpp +++ b/neo/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/neo/d3xp/Game_local.h b/neo/d3xp/Game_local.h index 3c229bf8..4af1493e 100644 --- a/neo/d3xp/Game_local.h +++ b/neo/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/neo/d3xp/Game_network.cpp b/neo/d3xp/Game_network.cpp index 465241bd..732329a6 100644 --- a/neo/d3xp/Game_network.cpp +++ b/neo/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/neo/d3xp/Grabber.cpp b/neo/d3xp/Grabber.cpp index ab62c2b5..7c9dbe98 100644 --- a/neo/d3xp/Grabber.cpp +++ b/neo/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/neo/d3xp/Grabber.h b/neo/d3xp/Grabber.h index e4c75c0a..1b14fae8 100644 --- a/neo/d3xp/Grabber.h +++ b/neo/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/neo/d3xp/IK.cpp b/neo/d3xp/IK.cpp index 3076dc3d..1844ba2e 100644 --- a/neo/d3xp/IK.cpp +++ b/neo/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/neo/d3xp/IK.h b/neo/d3xp/IK.h index dbc4e373..2e71b813 100644 --- a/neo/d3xp/IK.h +++ b/neo/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/neo/d3xp/Item.cpp b/neo/d3xp/Item.cpp index 8279e01d..c1f2d97e 100644 --- a/neo/d3xp/Item.cpp +++ b/neo/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/neo/d3xp/Item.h b/neo/d3xp/Item.h index e997a18b..851ebb43 100644 --- a/neo/d3xp/Item.h +++ b/neo/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/neo/d3xp/Light.cpp b/neo/d3xp/Light.cpp index d084c677..05cfb24e 100644 --- a/neo/d3xp/Light.cpp +++ b/neo/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/neo/d3xp/Light.h b/neo/d3xp/Light.h index 20d31e61..123c8f2f 100644 --- a/neo/d3xp/Light.h +++ b/neo/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/neo/d3xp/Misc.cpp b/neo/d3xp/Misc.cpp index 78292a70..cce92cd8 100644 --- a/neo/d3xp/Misc.cpp +++ b/neo/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/neo/d3xp/Misc.h b/neo/d3xp/Misc.h index 43ece0e1..4b51aa89 100644 --- a/neo/d3xp/Misc.h +++ b/neo/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/neo/d3xp/Moveable.cpp b/neo/d3xp/Moveable.cpp index 943f7369..e2bdd1fb 100644 --- a/neo/d3xp/Moveable.cpp +++ b/neo/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/neo/d3xp/Moveable.h b/neo/d3xp/Moveable.h index 6611e785..b8e0ba2c 100644 --- a/neo/d3xp/Moveable.h +++ b/neo/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/neo/d3xp/Mover.cpp b/neo/d3xp/Mover.cpp index b04b2f79..a2414bb9 100644 --- a/neo/d3xp/Mover.cpp +++ b/neo/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/neo/d3xp/Mover.h b/neo/d3xp/Mover.h index e4805004..784c9eba 100644 --- a/neo/d3xp/Mover.h +++ b/neo/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/neo/d3xp/MultiplayerGame.cpp b/neo/d3xp/MultiplayerGame.cpp index 2682102f..e315a1e2 100644 --- a/neo/d3xp/MultiplayerGame.cpp +++ b/neo/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/neo/d3xp/MultiplayerGame.h b/neo/d3xp/MultiplayerGame.h index 33353eec..718b1ddd 100644 --- a/neo/d3xp/MultiplayerGame.h +++ b/neo/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/neo/d3xp/Player.cpp b/neo/d3xp/Player.cpp index 8d112b66..dd179a7a 100644 --- a/neo/d3xp/Player.cpp +++ b/neo/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/neo/d3xp/Player.h b/neo/d3xp/Player.h index c1928766..ec589add 100644 --- a/neo/d3xp/Player.h +++ b/neo/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/neo/d3xp/PlayerIcon.cpp b/neo/d3xp/PlayerIcon.cpp index 28ef7704..cb9828d9 100644 --- a/neo/d3xp/PlayerIcon.cpp +++ b/neo/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/neo/d3xp/PlayerIcon.h b/neo/d3xp/PlayerIcon.h index a6026307..cbf582d4 100644 --- a/neo/d3xp/PlayerIcon.h +++ b/neo/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/neo/d3xp/PlayerView.cpp b/neo/d3xp/PlayerView.cpp index 922ff0b1..5cb0514a 100644 --- a/neo/d3xp/PlayerView.cpp +++ b/neo/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/neo/d3xp/PlayerView.h b/neo/d3xp/PlayerView.h index 89df101f..4971d794 100644 --- a/neo/d3xp/PlayerView.h +++ b/neo/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/neo/d3xp/Projectile.cpp b/neo/d3xp/Projectile.cpp index e4bc3ea7..5659a17e 100644 --- a/neo/d3xp/Projectile.cpp +++ b/neo/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/neo/d3xp/Projectile.h b/neo/d3xp/Projectile.h index 2db3f0c5..1b0784f5 100644 --- a/neo/d3xp/Projectile.h +++ b/neo/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/neo/d3xp/Pvs.cpp b/neo/d3xp/Pvs.cpp index 12b0e5fb..95649822 100644 --- a/neo/d3xp/Pvs.cpp +++ b/neo/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/neo/d3xp/Pvs.h b/neo/d3xp/Pvs.h index 37ea23c2..17a5f4af 100644 --- a/neo/d3xp/Pvs.h +++ b/neo/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/neo/d3xp/SecurityCamera.cpp b/neo/d3xp/SecurityCamera.cpp index dfd8bd00..44df1aab 100644 --- a/neo/d3xp/SecurityCamera.cpp +++ b/neo/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/neo/d3xp/SecurityCamera.h b/neo/d3xp/SecurityCamera.h index cf9ab3ec..02600df6 100644 --- a/neo/d3xp/SecurityCamera.h +++ b/neo/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/neo/d3xp/SmokeParticles.cpp b/neo/d3xp/SmokeParticles.cpp index 86d2d41f..66ee8547 100644 --- a/neo/d3xp/SmokeParticles.cpp +++ b/neo/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/neo/d3xp/SmokeParticles.h b/neo/d3xp/SmokeParticles.h index ec585c09..f0b4b458 100644 --- a/neo/d3xp/SmokeParticles.h +++ b/neo/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/neo/d3xp/Sound.cpp b/neo/d3xp/Sound.cpp index c1d80442..949324dc 100644 --- a/neo/d3xp/Sound.cpp +++ b/neo/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/neo/d3xp/Sound.h b/neo/d3xp/Sound.h index 1bc291b1..55d84973 100644 --- a/neo/d3xp/Sound.h +++ b/neo/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/neo/d3xp/Target.cpp b/neo/d3xp/Target.cpp index 82102014..1ba44619 100644 --- a/neo/d3xp/Target.cpp +++ b/neo/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/neo/d3xp/Target.h b/neo/d3xp/Target.h index 88adc655..96ef1c89 100644 --- a/neo/d3xp/Target.h +++ b/neo/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/neo/d3xp/Trigger.cpp b/neo/d3xp/Trigger.cpp index a954b141..e15c0210 100644 --- a/neo/d3xp/Trigger.cpp +++ b/neo/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/neo/d3xp/Trigger.h b/neo/d3xp/Trigger.h index bff01444..fe6d7421 100644 --- a/neo/d3xp/Trigger.h +++ b/neo/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/neo/d3xp/Weapon.cpp b/neo/d3xp/Weapon.cpp index 597c50c4..1db5dc0d 100644 --- a/neo/d3xp/Weapon.cpp +++ b/neo/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/neo/d3xp/Weapon.h b/neo/d3xp/Weapon.h index 97ede12d..f3ff8217 100644 --- a/neo/d3xp/Weapon.h +++ b/neo/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/neo/d3xp/WorldSpawn.cpp b/neo/d3xp/WorldSpawn.cpp index 0c368c44..9e2ce5d3 100644 --- a/neo/d3xp/WorldSpawn.cpp +++ b/neo/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/neo/d3xp/WorldSpawn.h b/neo/d3xp/WorldSpawn.h index 7b65dddc..bf882439 100644 --- a/neo/d3xp/WorldSpawn.h +++ b/neo/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/neo/d3xp/ai/AAS.cpp b/neo/d3xp/ai/AAS.cpp index 1abb78d5..9fd1ac88 100644 --- a/neo/d3xp/ai/AAS.cpp +++ b/neo/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/neo/d3xp/ai/AAS.h b/neo/d3xp/ai/AAS.h index a1e22ddc..8f272b46 100644 --- a/neo/d3xp/ai/AAS.h +++ b/neo/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/neo/d3xp/ai/AAS_debug.cpp b/neo/d3xp/ai/AAS_debug.cpp index 56057121..0c4ba482 100644 --- a/neo/d3xp/ai/AAS_debug.cpp +++ b/neo/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/neo/d3xp/ai/AAS_local.h b/neo/d3xp/ai/AAS_local.h index afab2ded..5b9af242 100644 --- a/neo/d3xp/ai/AAS_local.h +++ b/neo/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/neo/d3xp/ai/AAS_pathing.cpp b/neo/d3xp/ai/AAS_pathing.cpp index 07a57ef5..7805c0a7 100644 --- a/neo/d3xp/ai/AAS_pathing.cpp +++ b/neo/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/neo/d3xp/ai/AAS_routing.cpp b/neo/d3xp/ai/AAS_routing.cpp index f44631aa..acb59ac9 100644 --- a/neo/d3xp/ai/AAS_routing.cpp +++ b/neo/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/neo/d3xp/ai/AI.cpp b/neo/d3xp/ai/AI.cpp index 36cce7be..2ccb337f 100644 --- a/neo/d3xp/ai/AI.cpp +++ b/neo/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/neo/d3xp/ai/AI.h b/neo/d3xp/ai/AI.h index 0e4b204d..8b337ad8 100644 --- a/neo/d3xp/ai/AI.h +++ b/neo/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/neo/d3xp/ai/AI_Vagary.cpp b/neo/d3xp/ai/AI_Vagary.cpp index 6bcb4f02..24c7a861 100644 --- a/neo/d3xp/ai/AI_Vagary.cpp +++ b/neo/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/neo/d3xp/ai/AI_events.cpp b/neo/d3xp/ai/AI_events.cpp index fdedfc3d..6d11607f 100644 --- a/neo/d3xp/ai/AI_events.cpp +++ b/neo/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/neo/d3xp/ai/AI_pathing.cpp b/neo/d3xp/ai/AI_pathing.cpp index 939390dd..886d5942 100644 --- a/neo/d3xp/ai/AI_pathing.cpp +++ b/neo/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/neo/d3xp/anim/Anim.cpp b/neo/d3xp/anim/Anim.cpp index 44de2372..39043428 100644 --- a/neo/d3xp/anim/Anim.cpp +++ b/neo/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/neo/d3xp/anim/Anim.h b/neo/d3xp/anim/Anim.h index a1f60f90..e3ae912f 100644 --- a/neo/d3xp/anim/Anim.h +++ b/neo/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/neo/d3xp/anim/Anim_Blend.cpp b/neo/d3xp/anim/Anim_Blend.cpp index 625d2a0c..781fe707 100644 --- a/neo/d3xp/anim/Anim_Blend.cpp +++ b/neo/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/neo/d3xp/anim/Anim_Import.cpp b/neo/d3xp/anim/Anim_Import.cpp index ff776067..80d05714 100644 --- a/neo/d3xp/anim/Anim_Import.cpp +++ b/neo/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/neo/d3xp/anim/Anim_Testmodel.cpp b/neo/d3xp/anim/Anim_Testmodel.cpp index 769850ba..99c0ac3f 100644 --- a/neo/d3xp/anim/Anim_Testmodel.cpp +++ b/neo/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/neo/d3xp/anim/Anim_Testmodel.h b/neo/d3xp/anim/Anim_Testmodel.h index a752577d..e63a7c49 100644 --- a/neo/d3xp/anim/Anim_Testmodel.h +++ b/neo/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/neo/d3xp/gamesys/Callbacks.cpp b/neo/d3xp/gamesys/Callbacks.cpp index 0f7f7f60..caacc102 100644 --- a/neo/d3xp/gamesys/Callbacks.cpp +++ b/neo/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/neo/d3xp/gamesys/Class.cpp b/neo/d3xp/gamesys/Class.cpp index e97fe88b..78e4c1b5 100644 --- a/neo/d3xp/gamesys/Class.cpp +++ b/neo/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/neo/d3xp/gamesys/Class.h b/neo/d3xp/gamesys/Class.h index 7557a90a..21e6873b 100644 --- a/neo/d3xp/gamesys/Class.h +++ b/neo/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/neo/d3xp/gamesys/DebugGraph.cpp b/neo/d3xp/gamesys/DebugGraph.cpp index 9c28470c..f79c6274 100644 --- a/neo/d3xp/gamesys/DebugGraph.cpp +++ b/neo/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/neo/d3xp/gamesys/DebugGraph.h b/neo/d3xp/gamesys/DebugGraph.h index 00b357ba..0729d498 100644 --- a/neo/d3xp/gamesys/DebugGraph.h +++ b/neo/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/neo/d3xp/gamesys/Event.cpp b/neo/d3xp/gamesys/Event.cpp index 3c5abedb..85c16c7e 100644 --- a/neo/d3xp/gamesys/Event.cpp +++ b/neo/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/neo/d3xp/gamesys/Event.h b/neo/d3xp/gamesys/Event.h index 1d3ef032..8af13b76 100644 --- a/neo/d3xp/gamesys/Event.h +++ b/neo/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/neo/d3xp/gamesys/NoGameTypeInfo.h b/neo/d3xp/gamesys/NoGameTypeInfo.h index 23d46523..5b5618e5 100644 --- a/neo/d3xp/gamesys/NoGameTypeInfo.h +++ b/neo/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/neo/d3xp/gamesys/SaveGame.cpp b/neo/d3xp/gamesys/SaveGame.cpp index 3c4f80fc..2f6a3c33 100644 --- a/neo/d3xp/gamesys/SaveGame.cpp +++ b/neo/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/neo/d3xp/gamesys/SaveGame.h b/neo/d3xp/gamesys/SaveGame.h index fc6f2e4a..7b3be8e6 100644 --- a/neo/d3xp/gamesys/SaveGame.h +++ b/neo/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/neo/d3xp/gamesys/SysCmds.cpp b/neo/d3xp/gamesys/SysCmds.cpp index fc67fdb0..f8569621 100644 --- a/neo/d3xp/gamesys/SysCmds.cpp +++ b/neo/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/neo/d3xp/gamesys/SysCmds.h b/neo/d3xp/gamesys/SysCmds.h index dbba941e..2b1abcd8 100644 --- a/neo/d3xp/gamesys/SysCmds.h +++ b/neo/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/neo/d3xp/gamesys/SysCvar.cpp b/neo/d3xp/gamesys/SysCvar.cpp index dd23ec76..828015e8 100644 --- a/neo/d3xp/gamesys/SysCvar.cpp +++ b/neo/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/neo/d3xp/gamesys/SysCvar.h b/neo/d3xp/gamesys/SysCvar.h index b2193480..b4c07160 100644 --- a/neo/d3xp/gamesys/SysCvar.h +++ b/neo/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/neo/d3xp/gamesys/TypeInfo.cpp b/neo/d3xp/gamesys/TypeInfo.cpp index 94b67431..9e711923 100644 --- a/neo/d3xp/gamesys/TypeInfo.cpp +++ b/neo/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/neo/d3xp/gamesys/TypeInfo.h b/neo/d3xp/gamesys/TypeInfo.h index 36717d04..cd47bfda 100644 --- a/neo/d3xp/gamesys/TypeInfo.h +++ b/neo/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/neo/d3xp/physics/Clip.cpp b/neo/d3xp/physics/Clip.cpp index 06079a2e..07d47e07 100644 --- a/neo/d3xp/physics/Clip.cpp +++ b/neo/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/neo/d3xp/physics/Clip.h b/neo/d3xp/physics/Clip.h index 7d5d857a..1d79c84a 100644 --- a/neo/d3xp/physics/Clip.h +++ b/neo/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/neo/d3xp/physics/Force.cpp b/neo/d3xp/physics/Force.cpp index e06d97f4..a835a555 100644 --- a/neo/d3xp/physics/Force.cpp +++ b/neo/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/neo/d3xp/physics/Force.h b/neo/d3xp/physics/Force.h index bf178751..ff6f4481 100644 --- a/neo/d3xp/physics/Force.h +++ b/neo/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/neo/d3xp/physics/Force_Constant.cpp b/neo/d3xp/physics/Force_Constant.cpp index 8ef517d7..2b15096c 100644 --- a/neo/d3xp/physics/Force_Constant.cpp +++ b/neo/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/neo/d3xp/physics/Force_Constant.h b/neo/d3xp/physics/Force_Constant.h index 875bc3f8..0466b3a0 100644 --- a/neo/d3xp/physics/Force_Constant.h +++ b/neo/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/neo/d3xp/physics/Force_Drag.cpp b/neo/d3xp/physics/Force_Drag.cpp index a21ed778..ee41c7f7 100644 --- a/neo/d3xp/physics/Force_Drag.cpp +++ b/neo/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/neo/d3xp/physics/Force_Drag.h b/neo/d3xp/physics/Force_Drag.h index 3979716d..97465ae3 100644 --- a/neo/d3xp/physics/Force_Drag.h +++ b/neo/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/neo/d3xp/physics/Force_Field.cpp b/neo/d3xp/physics/Force_Field.cpp index 44248d72..23f50af9 100644 --- a/neo/d3xp/physics/Force_Field.cpp +++ b/neo/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/neo/d3xp/physics/Force_Field.h b/neo/d3xp/physics/Force_Field.h index 4b47cadb..e3bfc837 100644 --- a/neo/d3xp/physics/Force_Field.h +++ b/neo/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/neo/d3xp/physics/Force_Grab.cpp b/neo/d3xp/physics/Force_Grab.cpp index 420eb1c0..d538f1ae 100644 --- a/neo/d3xp/physics/Force_Grab.cpp +++ b/neo/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/neo/d3xp/physics/Force_Grab.h b/neo/d3xp/physics/Force_Grab.h index 6abad2f7..b06ab4df 100644 --- a/neo/d3xp/physics/Force_Grab.h +++ b/neo/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/neo/d3xp/physics/Force_Spring.cpp b/neo/d3xp/physics/Force_Spring.cpp index 1df7d11a..93a6d19b 100644 --- a/neo/d3xp/physics/Force_Spring.cpp +++ b/neo/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/neo/d3xp/physics/Force_Spring.h b/neo/d3xp/physics/Force_Spring.h index e87a8638..06db7063 100644 --- a/neo/d3xp/physics/Force_Spring.h +++ b/neo/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/neo/d3xp/physics/Physics.cpp b/neo/d3xp/physics/Physics.cpp index 3d2e8f4d..bb487047 100644 --- a/neo/d3xp/physics/Physics.cpp +++ b/neo/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/neo/d3xp/physics/Physics.h b/neo/d3xp/physics/Physics.h index 92d3c97f..3d70adb9 100644 --- a/neo/d3xp/physics/Physics.h +++ b/neo/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/neo/d3xp/physics/Physics_AF.cpp b/neo/d3xp/physics/Physics_AF.cpp index 9dc60b00..79528d6c 100644 --- a/neo/d3xp/physics/Physics_AF.cpp +++ b/neo/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/neo/d3xp/physics/Physics_AF.h b/neo/d3xp/physics/Physics_AF.h index 2dc51794..4d712b1f 100644 --- a/neo/d3xp/physics/Physics_AF.h +++ b/neo/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/neo/d3xp/physics/Physics_Actor.cpp b/neo/d3xp/physics/Physics_Actor.cpp index 6bdb726e..52372725 100644 --- a/neo/d3xp/physics/Physics_Actor.cpp +++ b/neo/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/neo/d3xp/physics/Physics_Actor.h b/neo/d3xp/physics/Physics_Actor.h index 3c0b0f4e..0e4fec1a 100644 --- a/neo/d3xp/physics/Physics_Actor.h +++ b/neo/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/neo/d3xp/physics/Physics_Base.cpp b/neo/d3xp/physics/Physics_Base.cpp index 57a85188..ee421c77 100644 --- a/neo/d3xp/physics/Physics_Base.cpp +++ b/neo/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/neo/d3xp/physics/Physics_Base.h b/neo/d3xp/physics/Physics_Base.h index 6ff655c4..a0ac05b1 100644 --- a/neo/d3xp/physics/Physics_Base.h +++ b/neo/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/neo/d3xp/physics/Physics_Monster.cpp b/neo/d3xp/physics/Physics_Monster.cpp index f9859125..c5b919c2 100644 --- a/neo/d3xp/physics/Physics_Monster.cpp +++ b/neo/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/neo/d3xp/physics/Physics_Monster.h b/neo/d3xp/physics/Physics_Monster.h index 9ae7303f..54923242 100644 --- a/neo/d3xp/physics/Physics_Monster.h +++ b/neo/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/neo/d3xp/physics/Physics_Parametric.cpp b/neo/d3xp/physics/Physics_Parametric.cpp index 3628d73d..2208b94d 100644 --- a/neo/d3xp/physics/Physics_Parametric.cpp +++ b/neo/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/neo/d3xp/physics/Physics_Parametric.h b/neo/d3xp/physics/Physics_Parametric.h index b13f48bb..3cbd6a5c 100644 --- a/neo/d3xp/physics/Physics_Parametric.h +++ b/neo/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/neo/d3xp/physics/Physics_Player.cpp b/neo/d3xp/physics/Physics_Player.cpp index b32e6d5c..bc042d31 100644 --- a/neo/d3xp/physics/Physics_Player.cpp +++ b/neo/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/neo/d3xp/physics/Physics_Player.h b/neo/d3xp/physics/Physics_Player.h index 494fdb20..f3aa8521 100644 --- a/neo/d3xp/physics/Physics_Player.h +++ b/neo/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/neo/d3xp/physics/Physics_RigidBody.cpp b/neo/d3xp/physics/Physics_RigidBody.cpp index 850c8fcb..aaefd041 100644 --- a/neo/d3xp/physics/Physics_RigidBody.cpp +++ b/neo/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/neo/d3xp/physics/Physics_RigidBody.h b/neo/d3xp/physics/Physics_RigidBody.h index bce2009e..1e9874d1 100644 --- a/neo/d3xp/physics/Physics_RigidBody.h +++ b/neo/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/neo/d3xp/physics/Physics_Static.cpp b/neo/d3xp/physics/Physics_Static.cpp index 0c65ec76..4ff07e2c 100644 --- a/neo/d3xp/physics/Physics_Static.cpp +++ b/neo/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/neo/d3xp/physics/Physics_Static.h b/neo/d3xp/physics/Physics_Static.h index 650d2367..e8002e15 100644 --- a/neo/d3xp/physics/Physics_Static.h +++ b/neo/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/neo/d3xp/physics/Physics_StaticMulti.cpp b/neo/d3xp/physics/Physics_StaticMulti.cpp index 57f840ec..7b87b5b0 100644 --- a/neo/d3xp/physics/Physics_StaticMulti.cpp +++ b/neo/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/neo/d3xp/physics/Physics_StaticMulti.h b/neo/d3xp/physics/Physics_StaticMulti.h index 65d7dd39..a6055f92 100644 --- a/neo/d3xp/physics/Physics_StaticMulti.h +++ b/neo/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/neo/d3xp/physics/Push.cpp b/neo/d3xp/physics/Push.cpp index 1b908330..3cb5c34c 100644 --- a/neo/d3xp/physics/Push.cpp +++ b/neo/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/neo/d3xp/physics/Push.h b/neo/d3xp/physics/Push.h index 9a38dce9..b122d016 100644 --- a/neo/d3xp/physics/Push.h +++ b/neo/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/neo/d3xp/script/Script_Compiler.cpp b/neo/d3xp/script/Script_Compiler.cpp index 2f94bad8..f427bcf1 100644 --- a/neo/d3xp/script/Script_Compiler.cpp +++ b/neo/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/neo/d3xp/script/Script_Compiler.h b/neo/d3xp/script/Script_Compiler.h index 3e26d8ec..f943379f 100644 --- a/neo/d3xp/script/Script_Compiler.h +++ b/neo/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/neo/d3xp/script/Script_Interpreter.cpp b/neo/d3xp/script/Script_Interpreter.cpp index 04484b3b..2779aae9 100644 --- a/neo/d3xp/script/Script_Interpreter.cpp +++ b/neo/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/neo/d3xp/script/Script_Interpreter.h b/neo/d3xp/script/Script_Interpreter.h index 4c305796..add78af8 100644 --- a/neo/d3xp/script/Script_Interpreter.h +++ b/neo/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/neo/d3xp/script/Script_Program.cpp b/neo/d3xp/script/Script_Program.cpp index 2d8a8b97..a2fdefae 100644 --- a/neo/d3xp/script/Script_Program.cpp +++ b/neo/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/neo/d3xp/script/Script_Program.h b/neo/d3xp/script/Script_Program.h index 46900194..2d53f689 100644 --- a/neo/d3xp/script/Script_Program.h +++ b/neo/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/neo/d3xp/script/Script_Thread.cpp b/neo/d3xp/script/Script_Thread.cpp index 53a376d5..920d5ce1 100644 --- a/neo/d3xp/script/Script_Thread.cpp +++ b/neo/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/neo/d3xp/script/Script_Thread.h b/neo/d3xp/script/Script_Thread.h index 6a5efad7..7f1a743f 100644 --- a/neo/d3xp/script/Script_Thread.h +++ b/neo/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/neo/framework/BuildDefines.h b/neo/framework/BuildDefines.h index 0ff78be4..34e2f6e0 100644 --- a/neo/framework/BuildDefines.h +++ b/neo/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/neo/framework/BuildVersion.h b/neo/framework/BuildVersion.h index ec73649c..80658150 100644 --- a/neo/framework/BuildVersion.h +++ b/neo/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/neo/framework/CVarSystem.cpp b/neo/framework/CVarSystem.cpp index f50046ad..686ec69e 100644 --- a/neo/framework/CVarSystem.cpp +++ b/neo/framework/CVarSystem.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"). @@ -309,7 +309,7 @@ void idInternalCVar::Set( const char *newValue, bool force, bool fromServer ) { common->Printf( "%s is a synced over the network and cannot be changed on a multiplayer client.\n", nameString.c_str() ); #if ID_ALLOW_CHEATS common->Printf( "ID_ALLOW_CHEATS override!\n" ); -#else +#else return; #endif } @@ -318,10 +318,10 @@ void idInternalCVar::Set( const char *newValue, bool force, bool fromServer ) { common->Printf( "%s cannot be changed in multiplayer.\n", nameString.c_str() ); #if ID_ALLOW_CHEATS common->Printf( "ID_ALLOW_CHEATS override!\n" ); -#else +#else return; #endif - } + } } if ( !newValue ) { diff --git a/neo/framework/CVarSystem.h b/neo/framework/CVarSystem.h index dd2a4801..baa5fd38 100644 --- a/neo/framework/CVarSystem.h +++ b/neo/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/neo/framework/CmdSystem.cpp b/neo/framework/CmdSystem.cpp index fea45f58..813f5f61 100644 --- a/neo/framework/CmdSystem.cpp +++ b/neo/framework/CmdSystem.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"). @@ -91,7 +91,7 @@ private: // a command stored to be executed after a reloadEngine and all associated commands have been processed idCmdArgs postReload; -private: +private: void ExecuteTokenizedString( const idCmdArgs &args ); void ExecuteCommandText( const char *text ); void InsertCommandText( const char *text ); @@ -239,7 +239,7 @@ void idCmdSystemLocal::Exec_f( const idCmdArgs &args ) { return; } common->Printf( "execing %s\n", args.Argv(1) ); - + cmdSystemLocal.BufferCommandText( CMD_EXEC_INSERT, f ); fileSystem->FreeFile( f ); @@ -274,7 +274,7 @@ Just prints the rest of the line to the console */ void idCmdSystemLocal::Echo_f( const idCmdArgs &args ) { int i; - + for ( i = 1; i < args.Argc(); i++ ) { common->Printf( "%s ", args.Argv( i ) ); } @@ -363,7 +363,7 @@ idCmdSystemLocal::AddCommand */ void idCmdSystemLocal::AddCommand( const char *cmdName, cmdFunction_t function, int flags, const char *description, argCompletion_t argCompletion ) { commandDef_t *cmd; - + // fail if the command already exists for ( cmd = commands; cmd; cmd = cmd->next ) { if ( idStr::Cmp( cmdName, cmd->name ) == 0 ) { @@ -431,7 +431,7 @@ idCmdSystemLocal::CommandCompletion */ void idCmdSystemLocal::CommandCompletion( void(*callback)( const char *s ) ) { commandDef_t *cmd; - + for ( cmd = commands; cmd; cmd = cmd->next ) { callback( cmd->name ); } @@ -464,15 +464,15 @@ void idCmdSystemLocal::ArgCompletion( const char *cmdString, void(*callback)( co idCmdSystemLocal::ExecuteTokenizedString ============ */ -void idCmdSystemLocal::ExecuteTokenizedString( const idCmdArgs &args ) { +void idCmdSystemLocal::ExecuteTokenizedString( const idCmdArgs &args ) { commandDef_t *cmd, **prev; - + // execute the command line if ( !args.Argc() ) { return; // no tokens } - // check registered command functions + // check registered command functions for ( prev = &commands; *prev; prev = &cmd->next ) { cmd = *prev; if ( idStr::Icmp( args.Argv( 0 ), cmd->name ) == 0 ) { @@ -495,7 +495,7 @@ void idCmdSystemLocal::ExecuteTokenizedString( const idCmdArgs &args ) { return; } } - + // check cvars if ( cvarSystem->Command( args ) ) { return; @@ -511,7 +511,7 @@ idCmdSystemLocal::ExecuteCommandText Tokenizes, then executes. ============ */ -void idCmdSystemLocal::ExecuteCommandText( const char *text ) { +void idCmdSystemLocal::ExecuteCommandText( const char *text ) { ExecuteTokenizedString( idCmdArgs( text, false ) ); } @@ -556,7 +556,7 @@ Adds command text at the end of the buffer, does NOT add a final \n */ void idCmdSystemLocal::AppendCommandText( const char *text ) { int l; - + l = strlen( text ); if ( textLength + l >= (int)sizeof( textBuf ) ) { @@ -648,7 +648,7 @@ void idCmdSystemLocal::ExecuteCommandBuffer( void ) { break; } } - + text[i] = 0; if ( !idStr::Cmp( text, "_execTokenized" ) ) { diff --git a/neo/framework/CmdSystem.h b/neo/framework/CmdSystem.h index 067c2b6b..ffbc4f03 100644 --- a/neo/framework/CmdSystem.h +++ b/neo/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/neo/framework/Common.cpp b/neo/framework/Common.cpp index 2ea38efc..b1b4577d 100644 --- a/neo/framework/Common.cpp +++ b/neo/framework/Common.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"). @@ -474,7 +474,7 @@ prints message that only shows up if the "developer" cvar is set void idCommonLocal::DPrintf( const char *fmt, ... ) { va_list argptr; char msg[MAX_PRINT_MSG_SIZE]; - + if ( !cvarSystem->IsInitialized() || !com_developer.GetBool() ) { return; // don't confuse non-developers with techie stuff... } @@ -483,7 +483,7 @@ void idCommonLocal::DPrintf( const char *fmt, ... ) { idStr::vsnPrintf( msg, sizeof(msg), fmt, argptr ); va_end( argptr ); msg[sizeof(msg)-1] = '\0'; - + // never refresh the screen, which could cause reentrency problems bool temp = com_refreshOnPrint; com_refreshOnPrint = false; @@ -503,7 +503,7 @@ prints warning message in yellow that only shows up if the "developer" cvar is s void idCommonLocal::DWarning( const char *fmt, ... ) { va_list argptr; char msg[MAX_PRINT_MSG_SIZE]; - + if ( !com_developer.GetBool() ) { return; // don't confuse non-developers with techie stuff... } @@ -526,7 +526,7 @@ prints WARNING %s and adds the warning message to a queue to be printed later on void idCommonLocal::Warning( const char *fmt, ... ) { va_list argptr; char msg[MAX_PRINT_MSG_SIZE]; - + va_start( argptr, fmt ); idStr::vsnPrintf( msg, sizeof(msg), fmt, argptr ); va_end( argptr ); @@ -890,7 +890,7 @@ void idCommonLocal::CheckToolMode( void ) { else if ( !idStr::Icmp( com_consoleLines[ i ].Argv(0), "materialEditor" ) ) { com_editors |= EDITOR_MATERIAL; } - + if ( !idStr::Icmp( com_consoleLines[ i ].Argv(0), "renderbump" ) || !idStr::Icmp( com_consoleLines[ i ].Argv(0), "editor" ) || !idStr::Icmp( com_consoleLines[ i ].Argv(0), "guieditor" ) @@ -1217,7 +1217,7 @@ static void PrintMemInfo_f( const idCmdArgs &args ) { return; } - f->Printf( "total(%s ) image(%s ) model(%s ) sound(%s ): %s\n", idStr::FormatNumber( mi.assetTotals ).c_str(), idStr::FormatNumber( mi.imageAssetsTotal ).c_str(), + f->Printf( "total(%s ) image(%s ) model(%s ) sound(%s ): %s\n", idStr::FormatNumber( mi.assetTotals ).c_str(), idStr::FormatNumber( mi.imageAssetsTotal ).c_str(), idStr::FormatNumber( mi.modelAssetsTotal ).c_str(), idStr::FormatNumber( mi.soundAssetsTotal ).c_str(), mi.filebase.c_str() ); fileSystem->CloseFile( f ); @@ -1596,7 +1596,7 @@ idCommonLocal::FilterLangList =============== */ void idCommonLocal::FilterLangList( idStrList* list, idStr lang ) { - + idStr temp; for( int i = 0; i < list->Num(); i++ ) { temp = (*list)[i]; @@ -1624,7 +1624,7 @@ void idCommonLocal::InitLanguageDict( void ) { //to add new strings to the english language dictionary idFileList* langFiles; langFiles = fileSystem->ListFilesTree( "strings", ".lang", true ); - + idStrList langList = langFiles->GetList(); StartupVariable( "sys_lang", false ); // let it be set on the command line - this is needed because this init happens very early @@ -1633,7 +1633,7 @@ void idCommonLocal::InitLanguageDict( void ) { //Loop through the list and filter idStrList currentLangList = langList; FilterLangList(¤tLangList, langName); - + if ( currentLangList.Num() == 0 ) { // reset cvar to default and try to load again cmdSystem->BufferCommandText( CMD_EXEC_NOW, "reset sys_lang" ); @@ -1743,7 +1743,7 @@ void idCommonLocal::LocalizeGui( const char *fileName, idLangDict &langDict ) { if ( fileSystem->ReadFile( fileName, (void**)&buffer ) > 0 ) { src.LoadMemory( buffer, strlen(buffer), fileName ); if ( src.IsLoaded() ) { - idFile *outFile = fileSystem->OpenFileWrite( fileName ); + idFile *outFile = fileSystem->OpenFileWrite( fileName ); common->Printf( "Processing %s\n", fileName ); session->UpdateScreen(); idToken token; @@ -1945,7 +1945,7 @@ int LocalizeMap(const char* mapName, idLangDict &langDict, ListHash& listHash, i common->Printf("Localizing Map '%s'\n", mapName); int strCount = 0; - + idMapFile map; if ( map.Parse(mapName, false, false ) ) { int count = map.GetNumEntities(); @@ -1965,13 +1965,13 @@ int LocalizeMap(const char* mapName, idLangDict &langDict, ListHash& listHash, i for(int k = 0; k < list->Num(); k++) { idStr val = ent->epairs.GetString((*list)[k], ""); - + if(val.Length() && classname == "info_location" && (*list)[k] == "location") { hasLocation = true; } if(val.Length() && TestMapVal(val)) { - + if(!hasLocation || (*list)[k] == "location") { //Localize it!!! strCount++; @@ -2011,7 +2011,7 @@ int LocalizeMap(const char* mapName, idLangDict &langDict, ListHash& listHash, i idStr bak = file.Left(file.Length() - 4); bak.Append(".bak_loc"); fileSystem->CopyFile( file, bak ); - + map.Write( mapName, ".map" ); } } @@ -2032,7 +2032,7 @@ void Com_LocalizeMaps_f( const idCmdArgs &args ) { } int strCount = 0; - + bool count = false; bool dictUpdate = false; bool write = false; @@ -2061,7 +2061,7 @@ void Com_LocalizeMaps_f( const idCmdArgs &args ) { } common->SetRefreshOnPrint( true ); - + ListHash listHash; LoadMapLocalizeData(listHash); @@ -2075,7 +2075,7 @@ void Com_LocalizeMaps_f( const idCmdArgs &args ) { GetFileList("z:/d3xp/d3xp/maps/game", "*.map", files); for ( int i = 0; i < files.Num(); i++ ) { idStr file = fileSystem->OSPathToRelativePath(files[i]); - strCount += LocalizeMap(file, strTable, listHash, excludeList, write); + strCount += LocalizeMap(file, strTable, listHash, excludeList, write); } } @@ -2128,7 +2128,7 @@ void Com_LocalizeGuis_f( const idCmdArgs &args ) { } else { files = fileSystem->ListFilesTree( "guis", "*.pd", true, "d3xp" ); } - + for ( int i = 0; i < files->GetNumFiles(); i++ ) { commonLocal.LocalizeGui( files->GetFile( i ), strTable ); } @@ -2144,8 +2144,8 @@ void Com_LocalizeGuiParmsTest_f( const idCmdArgs &args ) { common->SetRefreshOnPrint( true ); - idFile *localizeFile = fileSystem->OpenFileWrite( "gui_parm_localize.csv" ); - idFile *noLocalizeFile = fileSystem->OpenFileWrite( "gui_parm_nolocalize.csv" ); + idFile *localizeFile = fileSystem->OpenFileWrite( "gui_parm_localize.csv" ); + idFile *noLocalizeFile = fileSystem->OpenFileWrite( "gui_parm_nolocalize.csv" ); idStrList excludeList; LoadGuiParmExcludeList(excludeList); @@ -2154,7 +2154,7 @@ void Com_LocalizeGuiParmsTest_f( const idCmdArgs &args ) { GetFileList("z:/d3xp/d3xp/maps/game", "*.map", files); for ( int i = 0; i < files.Num(); i++ ) { - + common->Printf("Testing Map '%s'\n", files[i].c_str()); idMapFile map; @@ -2179,7 +2179,7 @@ void Com_LocalizeGuiParmsTest_f( const idCmdArgs &args ) { } } } - + fileSystem->CloseFile( localizeFile ); fileSystem->CloseFile( noLocalizeFile ); @@ -2195,8 +2195,8 @@ void Com_LocalizeMapsTest_f( const idCmdArgs &args ) { common->SetRefreshOnPrint( true ); - idFile *localizeFile = fileSystem->OpenFileWrite( "map_localize.csv" ); - + idFile *localizeFile = fileSystem->OpenFileWrite( "map_localize.csv" ); + idStrList files; GetFileList("z:/d3xp/d3xp/maps/game", "*.map", files); @@ -2211,7 +2211,7 @@ void Com_LocalizeMapsTest_f( const idCmdArgs &args ) { for ( int j = 0; j < count; j++ ) { idMapEntity *ent = map.GetEntity( j ); if ( ent ) { - + //Temp code to get a list of all entity key value pairs /*idStr classname = ent->epairs.GetString("classname"); if(classname == "worldspawn" || classname == "func_static" || classname == "light" || classname == "speaker" || classname.Left(8) == "trigger_") { @@ -2224,7 +2224,7 @@ void Com_LocalizeMapsTest_f( const idCmdArgs &args ) { }*/ idStr classname = ent->epairs.GetString("classname"); - + //Hack: for info_location bool hasLocation = false; @@ -2235,13 +2235,13 @@ void Com_LocalizeMapsTest_f( const idCmdArgs &args ) { for(int k = 0; k < list->Num(); k++) { idStr val = ent->epairs.GetString((*list)[k], ""); - + if(classname == "info_location" && (*list)[k] == "location") { hasLocation = true; } if(val.Length() && TestMapVal(val)) { - + if(!hasLocation || (*list)[k] == "location") { idStr out = va("%s,%s,%s\r\n", val.c_str(), (*list)[k].c_str(), file.c_str()); localizeFile->Write( out.c_str(), out.Length() ); @@ -2443,7 +2443,7 @@ void idCommonLocal::Frame( void ) { Sys_GenerateEvents(); // write config file if anything changed - WriteConfiguration(); + WriteConfiguration(); // change SIMD implementation if required if ( com_forceGenericSIMD.IsModified() ) { @@ -2477,7 +2477,7 @@ void idCommonLocal::Frame( void ) { Printf( "frame:%i all:%3i gfr:%3i rf:%3i bk:%3i\n", com_frameNumber, com_frameMsec, time_gameFrame, time_frontend, time_backend ); time_gameFrame = 0; time_gameDraw = 0; - } + } com_frameNumber++; @@ -2509,7 +2509,7 @@ void idCommonLocal::GUIFrame( bool execCmd, bool network ) { idAsyncNetwork::RunFrame(); } session->Frame(); - session->UpdateScreen( false ); + session->UpdateScreen( false ); } /* @@ -2775,7 +2775,7 @@ void idCommonLocal::Init( int argc, const char **argv, const char *cmdline ) { // clear warning buffer ClearWarnings( GAME_NAME " initialization" ); - + // parse command line options idCmdArgs args; if ( cmdline ) { @@ -2853,7 +2853,7 @@ void idCommonLocal::Init( int argc, const char **argv, const char *cmdline ) { // remove any prints from the notify lines console->ClearNotifyLines(); - + ClearCommandLine(); com_fullyInitialized = true; @@ -2938,7 +2938,7 @@ void idCommonLocal::InitGame( void ) { file = fileSystem->OpenFileWrite( CONFIG_SPEC ); fileSystem->CloseFile( file ); } - + idCmdArgs args; if ( sysDetect ) { SetMachineSpec(); @@ -3025,7 +3025,7 @@ void idCommonLocal::InitGame( void ) { // load the game dll LoadGameDLL(); - + PrintLoadingMessage( common->GetLanguageDict()->GetString( "#str_04351" ) ); // init the session @@ -3033,7 +3033,7 @@ void idCommonLocal::InitGame( void ) { // have to do this twice.. first one sets the correct r_mode for the renderer init // this time around the backend is all setup correct.. a bit fugly but do not want - // to mess with all the gl init at this point.. an old vid card will never qualify for + // to mess with all the gl init at this point.. an old vid card will never qualify for if ( sysDetect ) { SetMachineSpec(); Com_ExecMachineSpec_f( args ); diff --git a/neo/framework/Common.h b/neo/framework/Common.h index 1fbdb8d6..ac0e4c39 100644 --- a/neo/framework/Common.h +++ b/neo/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/neo/framework/Compressor.cpp b/neo/framework/Compressor.cpp index 73f87963..682f84a5 100644 --- a/neo/framework/Compressor.cpp +++ b/neo/framework/Compressor.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"). @@ -813,7 +813,7 @@ typedef struct nodetype { struct nodetype *next, *prev; // doubly-linked list struct nodetype **head; // highest ranked node in block int weight; - int symbol; + int symbol; } huffmanNode_t; class idCompressor_Huffman : public idCompressor_None { @@ -904,7 +904,7 @@ void idCompressor_Huffman::Init( idFile *f, bool compress, int wordLength ) { tree->parent = tree->left = tree->right = NULL; loc[NYT] = tree; } else { - // Initialize the tree & list with the NYT node + // Initialize the tree & list with the NYT node tree = lhead = ltail = loc[NYT] = &nodeList[blocNode++]; tree->symbol = NYT; tree->weight = 0; @@ -1011,7 +1011,7 @@ idCompressor_Huffman::Swap Swap the location of the given two nodes in the tree. ================ */ -void idCompressor_Huffman::Swap( huffmanNode_t *node1, huffmanNode_t *node2 ) { +void idCompressor_Huffman::Swap( huffmanNode_t *node1, huffmanNode_t *node2 ) { huffmanNode_t *par1, *par2; par1 = node1->parent; @@ -1021,7 +1021,7 @@ void idCompressor_Huffman::Swap( huffmanNode_t *node1, huffmanNode_t *node2 ) { if ( par1->left == node1 ) { par1->left = node2; } else { - par1->right = node2; + par1->right = node2; } } else { tree = node2; @@ -1036,7 +1036,7 @@ void idCompressor_Huffman::Swap( huffmanNode_t *node1, huffmanNode_t *node2 ) { } else { tree = node1; } - + node1->parent = par2; node2->parent = par1; } @@ -1092,7 +1092,7 @@ void idCompressor_Huffman::Increment( huffmanNode_t *node ) { } if ( node->next != NULL && node->next->weight == node->weight ) { - lnode = *node->head; + lnode = *node->head; if ( lnode != node->parent ) { Swap( lnode, node ); } @@ -1101,13 +1101,13 @@ void idCompressor_Huffman::Increment( huffmanNode_t *node ) { if ( node->prev && node->prev->weight == node->weight ) { *node->head = node->prev; } else { - *node->head = NULL; + *node->head = NULL; Free_ppnode( node->head ); } node->weight++; if ( node->next && node->next->weight == node->weight ) { node->head = node->next->head; - } else { + } else { node->head = Get_ppnode(); *node->head = node; } @@ -1150,7 +1150,7 @@ void idCompressor_Huffman::AddRef( byte ch ) { } lhead->next = tnode2; tnode2->prev = lhead; - + tnode->symbol = ch; tnode->weight = 1; tnode->next = lhead->next; @@ -1162,7 +1162,7 @@ void idCompressor_Huffman::AddRef( byte ch ) { /* this should never happen */ tnode->head = Get_ppnode(); *tnode->head = tnode2; - } + } } else { /* this should never happen */ tnode->head = Get_ppnode(); @@ -1171,7 +1171,7 @@ void idCompressor_Huffman::AddRef( byte ch ) { lhead->next = tnode; tnode->prev = lhead; tnode->left = tnode->right = NULL; - + if ( lhead->parent ) { if ( lhead->parent->left == lhead ) { /* lhead is guaranteed to by the NYT */ lhead->parent->left = tnode2; @@ -1179,17 +1179,17 @@ void idCompressor_Huffman::AddRef( byte ch ) { lhead->parent->right = tnode2; } } else { - tree = tnode2; + tree = tnode2; } - + tnode2->right = tnode; tnode2->left = lhead; - + tnode2->parent = lhead->parent; lhead->parent = tnode->parent = tnode2; - + loc[ch] = tnode; - + Increment( tnode2->parent ); } else { Increment( loc[ch] ); @@ -1246,7 +1246,7 @@ idCompressor_Huffman::Transmit */ void idCompressor_Huffman::Transmit( int ch, byte *fout ) { int i; - if ( loc[ch] == NULL ) { + if ( loc[ch] == NULL ) { /* huffmanNode_t hasn't been transmitted, send a NYT, then the symbol */ Transmit( NYT, fout ); for ( i = 7; i >= 0; i-- ) { @@ -1296,7 +1296,7 @@ void idCompressor_Huffman::FinishCompress( void ) { if ( compress == false ) { return; } - + bloc += 7; int str = (bloc>>3); if ( str ) { @@ -1335,7 +1335,7 @@ int idCompressor_Huffman::Read( void *outData, int outLength ) { ch = ( ch << 1 ) + Get_bit(); } } - + ((byte *)outData)[i] = ch; /* Write symbol */ AddRef( (byte) ch ); /* Increment node */ } @@ -1384,13 +1384,13 @@ public: int Write( const void *inData, int inLength ); int Read( void *outData, int outLength ); - + private: typedef struct acProbs_s { unsigned int low; unsigned int high; } acProbs_t; - + typedef struct acSymbol_s { unsigned int low; unsigned int high; @@ -1466,7 +1466,7 @@ void idCompressor_Arithmetic::UpdateProbabilities( acSymbol_t* symbol ) { int i, x; x = symbol->position; - + probabilities[ x ].high++; for( i = x + 1; i < (1<= probabilities[ j ].low && count < probabilities[ j ].high ) { + if ( count >= probabilities[ j ].low && count < probabilities[ j ].high ) { return j; - } - } + } + } assert( false ); @@ -1540,10 +1540,10 @@ idCompressor_Arithmetic::SymbolFromCount */ int idCompressor_Arithmetic::SymbolFromCount( unsigned int count, acSymbol_t* symbol ) { int p = ProbabilityForCount( count ); - symbol->low = probabilities[ p ].low; - symbol->high = probabilities[ p ].high; + symbol->low = probabilities[ p ].low; + symbol->high = probabilities[ p ].high; symbol->position = p; - return p; + return p; } /* @@ -1552,31 +1552,31 @@ idCompressor_Arithmetic::RemoveSymbolFromStream ================ */ void idCompressor_Arithmetic::RemoveSymbolFromStream( acSymbol_t* symbol ) { - long range; + long range; range = ( long )( high - low ) + 1; high = low + ( unsigned short )( ( range * symbol->high ) / scale - 1 ); low = low + ( unsigned short )( ( range * symbol->low ) / scale ); - while( true ) { + while( true ) { - if ( ( high & AC_MSB_MASK ) == ( low & AC_MSB_MASK ) ) { + if ( ( high & AC_MSB_MASK ) == ( low & AC_MSB_MASK ) ) { } else if( ( low & AC_MSB2_MASK ) == AC_MSB2_MASK && ( high & AC_MSB2_MASK ) == 0 ) { - code ^= AC_MSB2_MASK; - low &= AC_MSB2_MASK - 1; - high |= AC_MSB2_MASK; + code ^= AC_MSB2_MASK; + low &= AC_MSB2_MASK - 1; + high |= AC_MSB2_MASK; } else { UpdateProbabilities( symbol ); - return; + return; } - low <<= 1; - high <<= 1; - high |= 1; - code <<= 1; - code |= ReadBits( 1 ); - } + low <<= 1; + high <<= 1; + high |= 1; + code <<= 1; + code |= ReadBits( 1 ); + } } /* @@ -1608,7 +1608,7 @@ idCompressor_Arithmetic::EncodeSymbol */ void idCompressor_Arithmetic::EncodeSymbol( acSymbol_t* symbol ) { unsigned int range; - + // rescale high and low for the new symbol. range = ( high - low ) + 1; high = low + ( unsigned short )(( range * symbol->high ) / scale - 1 ); @@ -1619,26 +1619,26 @@ void idCompressor_Arithmetic::EncodeSymbol( acSymbol_t* symbol ) { // the high digits of low and high have converged, and can be written to the stream WriteBits( high >> AC_MSB_SHIFT, 1 ); - while( underflowBits > 0 ) { + while( underflowBits > 0 ) { WriteBits( ~high >> AC_MSB_SHIFT, 1 ); underflowBits--; - } - } else if ( ( low & AC_MSB2_MASK ) && !( high & AC_MSB2_MASK ) ) { + } + } else if ( ( low & AC_MSB2_MASK ) && !( high & AC_MSB2_MASK ) ) { // underflow is in danger of happening, 2nd digits are converging but 1st digits don't match underflowBits += 1; low &= AC_MSB2_MASK - 1; high |= AC_MSB2_MASK; } else { UpdateProbabilities( symbol ); - return; + return; } - low <<= 1; - high <<= 1; - high |= 1; - } + low <<= 1; + high <<= 1; + high |= 1; + } } /* @@ -2339,7 +2339,7 @@ int idCompressor_LZW::Lookup( int w, int k ) { return k; } else { for ( j = index.First( w ^ k ); j >= 0 ; j = index.Next( j ) ) { - if ( dictionary[ j ].k == k && dictionary[ j ].w == w ) { + if ( dictionary[ j ].k == k && dictionary[ j ].w == w ) { return j; } } diff --git a/neo/framework/Compressor.h b/neo/framework/Compressor.h index caede6a4..7efe8e42 100644 --- a/neo/framework/Compressor.h +++ b/neo/framework/Compressor.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/neo/framework/Console.cpp b/neo/framework/Console.cpp index 392aa943..dcc1cd69 100644 --- a/neo/framework/Console.cpp +++ b/neo/framework/Console.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"). @@ -224,7 +224,7 @@ SCR_DrawMemoryUsage */ float SCR_DrawMemoryUsage( float y ) { memoryStats_t allocs, frees; - + Mem_GetStats( allocs ); SCR_DrawTextRightAlign( y, "total allocated memory: %4d, %4dkB", allocs.num, allocs.totalSize>>10 ); @@ -564,7 +564,7 @@ Handles history and console scrollback ==================== */ void idConsoleLocal::KeyDownEvent( int key ) { - + // Execute F key bindings if ( key >= K_F1 && key <= K_F12 ) { idKeyInput::ExecKeyBinding( key ); @@ -1004,7 +1004,7 @@ void idConsoleLocal::DrawNotify() { continue; } text_p = text + (i % TOTAL_LINES)*LINE_WIDTH; - + for ( x = 0; x < LINE_WIDTH; x++ ) { if ( ( text_p[x] & 0xff ) == ' ' ) { continue; @@ -1067,7 +1067,7 @@ void idConsoleLocal::DrawSolidConsole( float frac ) { i = version.Length(); for ( x = 0; x < i; x++ ) { - renderSystem->DrawSmallChar( SCREEN_WIDTH - ( i - x ) * SMALLCHAR_WIDTH, + renderSystem->DrawSmallChar( SCREEN_WIDTH - ( i - x ) * SMALLCHAR_WIDTH, (lines-(SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), version[x], localConsole.charSetShader ); } @@ -1089,7 +1089,7 @@ void idConsoleLocal::DrawSolidConsole( float frac ) { y -= SMALLCHAR_HEIGHT; rows--; } - + row = display; if ( x == 0 ) { @@ -1105,7 +1105,7 @@ void idConsoleLocal::DrawSolidConsole( float frac ) { } if ( current - row >= TOTAL_LINES ) { // past scrollback wrap point - continue; + continue; } text_p = text + (row % TOTAL_LINES)*LINE_WIDTH; @@ -1145,7 +1145,7 @@ void idConsoleLocal::Draw( bool forceFullScreen ) { } if ( forceFullScreen ) { - // if we are forced full screen because of a disconnect, + // if we are forced full screen because of a disconnect, // we want the console closed when we go back to a session state Close(); // we are however catching keyboard input diff --git a/neo/framework/Console.h b/neo/framework/Console.h index 4f02dcbf..81aee957 100644 --- a/neo/framework/Console.h +++ b/neo/framework/Console.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/neo/framework/DeclAF.cpp b/neo/framework/DeclAF.cpp index 7579ef30..51abd5fb 100644 --- a/neo/framework/DeclAF.cpp +++ b/neo/framework/DeclAF.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"). @@ -312,7 +312,7 @@ bool idDeclAF::WriteBody( idFile *f, const idDeclAF_Body &body ) const { f->WriteFloatString( "\tmod %s\n", JointModToString( body.jointMod ) ); switch( body.modelType ) { case TRM_BOX: { - f->WriteFloatString( "\tmodel box( " ); + f->WriteFloatString( "\tmodel box( " ); body.v1.Write( f ); f->WriteFloatString( ", " ); body.v2.Write( f ); @@ -320,7 +320,7 @@ bool idDeclAF::WriteBody( idFile *f, const idDeclAF_Body &body ) const { break; } case TRM_OCTAHEDRON: { - f->WriteFloatString( "\tmodel octahedron( " ); + f->WriteFloatString( "\tmodel octahedron( " ); body.v1.Write( f ); f->WriteFloatString( ", " ); body.v2.Write( f ); @@ -328,7 +328,7 @@ bool idDeclAF::WriteBody( idFile *f, const idDeclAF_Body &body ) const { break; } case TRM_DODECAHEDRON: { - f->WriteFloatString( "\tmodel dodecahedron( " ); + f->WriteFloatString( "\tmodel dodecahedron( " ); body.v1.Write( f ); f->WriteFloatString( ", " ); body.v2.Write( f ); @@ -336,15 +336,15 @@ bool idDeclAF::WriteBody( idFile *f, const idDeclAF_Body &body ) const { break; } case TRM_CYLINDER: { - f->WriteFloatString( "\tmodel cylinder( " ); + f->WriteFloatString( "\tmodel cylinder( " ); body.v1.Write( f ); f->WriteFloatString( ", " ); body.v2.Write( f ); f->WriteFloatString( ", %d )\n", body.numSides ); break; - } + } case TRM_CONE: { - f->WriteFloatString( "\tmodel cone( " ); + f->WriteFloatString( "\tmodel cone( " ); body.v1.Write( f ); f->WriteFloatString( ", " ); body.v2.Write( f ); @@ -352,7 +352,7 @@ bool idDeclAF::WriteBody( idFile *f, const idDeclAF_Body &body ) const { break; } case TRM_BONE: { - f->WriteFloatString( "\tmodel bone( " ); + f->WriteFloatString( "\tmodel bone( " ); body.v1.Write( f ); f->WriteFloatString( ", " ); body.v2.Write( f ); diff --git a/neo/framework/DeclAF.h b/neo/framework/DeclAF.h index d53de016..105c05bb 100644 --- a/neo/framework/DeclAF.h +++ b/neo/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/neo/framework/DeclEntityDef.cpp b/neo/framework/DeclEntityDef.cpp index 631eaead..15725642 100644 --- a/neo/framework/DeclEntityDef.cpp +++ b/neo/framework/DeclEntityDef.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/neo/framework/DeclEntityDef.h b/neo/framework/DeclEntityDef.h index d6868b3b..2630f9ae 100644 --- a/neo/framework/DeclEntityDef.h +++ b/neo/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/neo/framework/DeclFX.cpp b/neo/framework/DeclFX.cpp index a318cf7f..f141b24f 100644 --- a/neo/framework/DeclFX.cpp +++ b/neo/framework/DeclFX.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"). @@ -337,7 +337,7 @@ void idDeclFX::ParseSingleFXAction( idLexer &src, idFXSingleAction& FXAction ) { declManager->FindMaterial( FXAction.data ); continue; } - + if ( !token.Icmp( "model" ) ) { src.ReadToken( &token ); FXAction.data = token; @@ -418,7 +418,7 @@ bool idDeclFX::Parse( const char *text, const int textLength ) { // scan through, identifying each individual parameter while( 1 ) { - + if ( !src.ReadToken( &token ) ) { break; } @@ -460,7 +460,7 @@ const char *idDeclFX::DefaultDefinition( void ) const { "\t\t" "duration\t5\n" "\t\t" "model\t\t_default\n" "\t" "}\n" - "}"; + "}"; } /* diff --git a/neo/framework/DeclFX.h b/neo/framework/DeclFX.h index 858ddd02..0abfd3ce 100644 --- a/neo/framework/DeclFX.h +++ b/neo/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/neo/framework/DeclManager.cpp b/neo/framework/DeclManager.cpp index f28bd608..b67e2493 100644 --- a/neo/framework/DeclManager.cpp +++ b/neo/framework/DeclManager.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 @@ class idDeclLocal : public idDeclBase { public: idDeclLocal(); - virtual ~idDeclLocal() {}; + virtual ~idDeclLocal() {}; virtual const char * GetName( void ) const; virtual declType_t GetType( void ) const; virtual declState_t GetState( void ) const; @@ -272,39 +272,39 @@ typedef struct huffmanCode_s { // compression ratio = 64% static int huffmanFrequencies[] = { - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00078fb6, 0x000352a7, 0x00000002, 0x00000001, 0x0002795e, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00049600, 0x000000dd, 0x00018732, 0x0000005a, 0x00000007, 0x00000092, 0x0000000a, 0x00000919, - 0x00002dcf, 0x00002dda, 0x00004dfc, 0x0000039a, 0x000058be, 0x00002d13, 0x00014d8c, 0x00023c60, - 0x0002ddb0, 0x0000d1fc, 0x000078c4, 0x00003ec7, 0x00003113, 0x00006b59, 0x00002499, 0x0000184a, - 0x0000250b, 0x00004e38, 0x000001ca, 0x00000011, 0x00000020, 0x000023da, 0x00000012, 0x00000091, - 0x0000000b, 0x00000b14, 0x0000035d, 0x0000137e, 0x000020c9, 0x00000e11, 0x000004b4, 0x00000737, - 0x000006b8, 0x00001110, 0x000006b3, 0x000000fe, 0x00000f02, 0x00000d73, 0x000005f6, 0x00000be4, - 0x00000d86, 0x0000014d, 0x00000d89, 0x0000129b, 0x00000db3, 0x0000015a, 0x00000167, 0x00000375, - 0x00000028, 0x00000112, 0x00000018, 0x00000678, 0x0000081a, 0x00000677, 0x00000003, 0x00018112, - 0x00000001, 0x000441ee, 0x000124b0, 0x0001fa3f, 0x00026125, 0x0005a411, 0x0000e50f, 0x00011820, - 0x00010f13, 0x0002e723, 0x00003518, 0x00005738, 0x0002cc26, 0x0002a9b7, 0x0002db81, 0x0003b5fa, - 0x000185d2, 0x00001299, 0x00030773, 0x0003920d, 0x000411cd, 0x00018751, 0x00005fbd, 0x000099b0, - 0x00009242, 0x00007cf2, 0x00002809, 0x00005a1d, 0x00000001, 0x00005a1d, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00078fb6, 0x000352a7, 0x00000002, 0x00000001, 0x0002795e, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00049600, 0x000000dd, 0x00018732, 0x0000005a, 0x00000007, 0x00000092, 0x0000000a, 0x00000919, + 0x00002dcf, 0x00002dda, 0x00004dfc, 0x0000039a, 0x000058be, 0x00002d13, 0x00014d8c, 0x00023c60, + 0x0002ddb0, 0x0000d1fc, 0x000078c4, 0x00003ec7, 0x00003113, 0x00006b59, 0x00002499, 0x0000184a, + 0x0000250b, 0x00004e38, 0x000001ca, 0x00000011, 0x00000020, 0x000023da, 0x00000012, 0x00000091, + 0x0000000b, 0x00000b14, 0x0000035d, 0x0000137e, 0x000020c9, 0x00000e11, 0x000004b4, 0x00000737, + 0x000006b8, 0x00001110, 0x000006b3, 0x000000fe, 0x00000f02, 0x00000d73, 0x000005f6, 0x00000be4, + 0x00000d86, 0x0000014d, 0x00000d89, 0x0000129b, 0x00000db3, 0x0000015a, 0x00000167, 0x00000375, + 0x00000028, 0x00000112, 0x00000018, 0x00000678, 0x0000081a, 0x00000677, 0x00000003, 0x00018112, + 0x00000001, 0x000441ee, 0x000124b0, 0x0001fa3f, 0x00026125, 0x0005a411, 0x0000e50f, 0x00011820, + 0x00010f13, 0x0002e723, 0x00003518, 0x00005738, 0x0002cc26, 0x0002a9b7, 0x0002db81, 0x0003b5fa, + 0x000185d2, 0x00001299, 0x00030773, 0x0003920d, 0x000411cd, 0x00018751, 0x00005fbd, 0x000099b0, + 0x00009242, 0x00007cf2, 0x00002809, 0x00005a1d, 0x00000001, 0x00005a1d, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, - 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, + 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, }; static huffmanCode_t huffmanCodes[MAX_HUFFMAN_SYMBOLS]; @@ -1046,7 +1046,7 @@ int idDeclManagerLocal::GetChecksum( void ) const { if ( type == DECL_PDA || type == DECL_VIDEO || type == DECL_AUDIO || type == DECL_EMAIL ) { continue; } - + num = linearLists[i].Num(); for ( j = 0; j < num; j++ ) { idDeclLocal *decl = linearLists[i][j]; diff --git a/neo/framework/DeclManager.h b/neo/framework/DeclManager.h index e6a030db..e4fa8b52 100644 --- a/neo/framework/DeclManager.h +++ b/neo/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/neo/framework/DeclPDA.cpp b/neo/framework/DeclPDA.cpp index 588b4dc1..d255c0c9 100644 --- a/neo/framework/DeclPDA.cpp +++ b/neo/framework/DeclPDA.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"). @@ -71,7 +71,7 @@ bool idDeclPDA::Parse( const char *text, const int textLength ) { // scan through, identifying each individual parameter while( 1 ) { - + if ( !src.ReadToken( &token ) ) { break; } @@ -164,7 +164,7 @@ const char *idDeclPDA::DefaultDefinition( void ) const { return "{\n" "\t" "name \"default pda\"\n" - "}"; + "}"; } /* @@ -435,7 +435,7 @@ const char *idDeclEmail::DefaultDefinition( void ) const { "\t\t" "subject\t5Nothing\n" "\t\t" "from\t5No one\n" "\t" "}\n" - "}"; + "}"; } /* @@ -512,7 +512,7 @@ bool idDeclVideo::Parse( const char *text, const int textLength ) { if ( !token.Icmp( "video") ) { src.ReadToken( &token ); video = token; - declManager->FindMaterial( video ); + declManager->FindMaterial( video ); continue; } @@ -549,7 +549,7 @@ const char *idDeclVideo::DefaultDefinition( void ) const { "\t" "{\n" "\t\t" "name\t5Default Video\n" "\t" "}\n" - "}"; + "}"; } /* @@ -656,7 +656,7 @@ const char *idDeclAudio::DefaultDefinition( void ) const { "\t" "{\n" "\t\t" "name\t5Default Audio\n" "\t" "}\n" - "}"; + "}"; } /* diff --git a/neo/framework/DeclPDA.h b/neo/framework/DeclPDA.h index 05b26928..77212743 100644 --- a/neo/framework/DeclPDA.h +++ b/neo/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/neo/framework/DeclParticle.cpp b/neo/framework/DeclParticle.cpp index 0d2c5ccc..6d29e088 100644 --- a/neo/framework/DeclParticle.cpp +++ b/neo/framework/DeclParticle.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"). @@ -51,7 +51,7 @@ const ParticleParmDesc ParticleOrientationDesc[] = { { "aimed", 2, "" }, { "x", 0, "" }, { "y", 0, "" }, - { "z", 0, "" } + { "z", 0, "" } }; const ParticleParmDesc ParticleCustomDesc[] = { @@ -121,7 +121,7 @@ void idDeclParticle::GetStageBounds( idParticleStage *stage ) { // don't increment the verts idVec3 origin; - stage->ParticleOrigin( &g, origin ); + stage->ParticleOrigin( &g, origin ); stage->bounds.AddPoint( origin ); } } @@ -339,7 +339,7 @@ idParticleStage *idDeclParticle::ParseParticleStage( idLexer &src ) { stage->initialAngle = src.ParseFloat(); continue; } - if ( !token.Icmp( "entityColor" ) ) { + if ( !token.Icmp( "entityColor" ) ) { stage->entityColor = src.ParseBool(); continue; } @@ -527,7 +527,7 @@ idDeclParticle::WriteStage ================ */ void idDeclParticle::WriteStage( idFile *f, idParticleStage *stage ) { - + int i; f->WriteFloatString( "\t{\n" ); @@ -548,7 +548,7 @@ void idDeclParticle::WriteStage( idFile *f, idParticleStage *stage ) { f->WriteFloatString( "\t\tdeadTime\t\t\t%.3f\n", stage->deadTime ); } f->WriteFloatString( "\t\tbunching\t\t\t%.3f\n", stage->spawnBunching ); - + f->WriteFloatString( "\t\tdistribution\t\t%s ", ParticleDistributionDesc[stage->distributionType].name ); for ( i = 0; i < ParticleDistributionDesc[stage->distributionType].count; i++ ) { f->WriteFloatString( "%.3f ", stage->distributionParms[i] ); @@ -922,7 +922,7 @@ void idParticleStage::ParticleOrigin( particleGen_t *g, idVec3 &origin ) const { // angle is the full angle, so 360 degrees is any spherical direction angle1 = g->random.CRandomFloat() * directionParms[0] * idMath::M_DEG2RAD; angle2 = g->random.CRandomFloat() * idMath::PI; - + float s1, c1, s2, c2; idMath::SinCos16( angle1, s1, c1 ); idMath::SinCos16( angle2, s2, c2 ); @@ -942,7 +942,7 @@ void idParticleStage::ParticleOrigin( particleGen_t *g, idVec3 &origin ) const { // add speed float iSpeed = speed.Integrate( g->frac, g->random ); - origin += dir * iSpeed * particleLife; + origin += dir * iSpeed * particleLife; } else { // @@ -1116,7 +1116,7 @@ int idParticleStage::ParticleVerts( particleGen_t *g, idVec3 origin, idDrawVert } // - // constant rotation + // constant rotation // float angle; @@ -1234,7 +1234,7 @@ void idParticleStage::ParticleColors( particleGen_t *g, idDrawVert *verts ) cons // most particles fade in at the beginning and fade out at the end if ( g->frac < fadeInFraction ) { fadeFraction *= ( g->frac / fadeInFraction ); - } + } if ( 1.0f - g->frac < fadeOutFraction ) { fadeFraction *= ( ( 1.0f - g->frac ) / fadeOutFraction ); } @@ -1256,9 +1256,9 @@ void idParticleStage::ParticleColors( particleGen_t *g, idDrawVert *verts ) cons } else if ( icolor > 255 ) { icolor = 255; } - verts[0].color[i] = - verts[1].color[i] = - verts[2].color[i] = + verts[0].color[i] = + verts[1].color[i] = + verts[2].color[i] = verts[3].color[i] = icolor; } } diff --git a/neo/framework/DeclParticle.h b/neo/framework/DeclParticle.h index 2c883b34..a32ae348 100644 --- a/neo/framework/DeclParticle.h +++ b/neo/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/neo/framework/DeclSkin.cpp b/neo/framework/DeclSkin.cpp index da69fc4e..fe09777b 100644 --- a/neo/framework/DeclSkin.cpp +++ b/neo/framework/DeclSkin.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"). @@ -139,7 +139,7 @@ idDeclSkin::GetNumModelAssociations ================ */ const int idDeclSkin::GetNumModelAssociations(void ) const { - return associatedModels.Num(); + return associatedModels.Num(); } /* diff --git a/neo/framework/DeclSkin.h b/neo/framework/DeclSkin.h index 2f029871..04ab4e04 100644 --- a/neo/framework/DeclSkin.h +++ b/neo/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/neo/framework/DeclTable.cpp b/neo/framework/DeclTable.cpp index 39916f62..a17bc9d7 100644 --- a/neo/framework/DeclTable.cpp +++ b/neo/framework/DeclTable.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"). @@ -38,7 +38,7 @@ idDeclTable::TableLookup float idDeclTable::TableLookup( float index ) const { int iIndex; float iFrac; - + int domain = values.Num() - 1; if ( domain <= 1 ) { @@ -71,7 +71,7 @@ float idDeclTable::TableLookup( float index ) const { // don't need to worry about wrapping the filter return values[iIndex] * ( 1.0f - iFrac ) + values[iIndex + 1] * iFrac; } - + return values[iIndex]; } diff --git a/neo/framework/DeclTable.h b/neo/framework/DeclTable.h index f6386e05..01bd48e9 100644 --- a/neo/framework/DeclTable.h +++ b/neo/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/neo/framework/DemoChecksum.h b/neo/framework/DemoChecksum.h index 586b154b..a0abfae6 100644 --- a/neo/framework/DemoChecksum.h +++ b/neo/framework/DemoChecksum.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/neo/framework/DemoFile.cpp b/neo/framework/DemoFile.cpp index 796b5c23..bbc0b7ce 100644 --- a/neo/framework/DemoFile.cpp +++ b/neo/framework/DemoFile.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"). @@ -215,18 +215,18 @@ const char *idDemoFile::ReadHashString() { if ( log && fLog ) { const char *text = va( "%s > Reading hash string\n", logStr.c_str() ); fLog->Write( text, strlen( text ) ); - } + } ReadInt( index ); if ( index == -1 ) { // read a new string for the table idStr *str = new idStr; - + idStr data; ReadString( data ); *str = data; - + demoStrings.Append( str ); return *str; @@ -262,7 +262,7 @@ void idDemoFile::WriteHashString( const char *str ) { idStr *copy = new idStr( str ); //common->Printf( "hash:%i = %s\n", demoStrings.Num(), str ); demoStrings.Append( copy ); - int cmd = -1; + int cmd = -1; WriteInt( cmd ); WriteString( str ); } @@ -322,7 +322,3 @@ int idDemoFile::Read( void *buffer, int len ) { int idDemoFile::Write( const void *buffer, int len ) { return compressor->Write( buffer, len ); } - - - - diff --git a/neo/framework/DemoFile.h b/neo/framework/DemoFile.h index 6ca216b3..f9f32f00 100644 --- a/neo/framework/DemoFile.h +++ b/neo/framework/DemoFile.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/neo/framework/EditField.cpp b/neo/framework/EditField.cpp index a5bad1ae..2b09e3c6 100644 --- a/neo/framework/EditField.cpp +++ b/neo/framework/EditField.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"). @@ -340,7 +340,7 @@ void idEditField::CharEvent( int ch ) { return; } - if ( idKeyInput::GetOverstrikeMode() ) { + if ( idKeyInput::GetOverstrikeMode() ) { if ( cursor == MAX_EDIT_LINE - 1 ) { return; } @@ -554,7 +554,7 @@ void idEditField::Draw( int x, int y, int width, bool showCursor, const idMateri prestep = scroll; // Skip color code - if ( idStr::IsColor( buffer + prestep ) ) { + if ( idStr::IsColor( buffer + prestep ) ) { prestep += 2; } if ( prestep > 0 && idStr::IsColor( buffer + prestep - 1 ) ) { diff --git a/neo/framework/EditField.h b/neo/framework/EditField.h index fba725f2..709a3e25 100644 --- a/neo/framework/EditField.h +++ b/neo/framework/EditField.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/neo/framework/EventLoop.cpp b/neo/framework/EventLoop.cpp index c260af27..02aa3d68 100644 --- a/neo/framework/EventLoop.cpp +++ b/neo/framework/EventLoop.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"). @@ -259,7 +259,7 @@ int idEventLoop::Milliseconds( void ) { Com_PushEvent( &ev ); } } while ( ev.evType != SE_NONE ); - + return ev.evTime; #endif } diff --git a/neo/framework/EventLoop.h b/neo/framework/EventLoop.h index 6277107c..06819704 100644 --- a/neo/framework/EventLoop.h +++ b/neo/framework/EventLoop.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/neo/framework/File.cpp b/neo/framework/File.cpp index 68a0b10b..7aed3b50 100644 --- a/neo/framework/File.cpp +++ b/neo/framework/File.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"). @@ -267,10 +267,10 @@ int idFile::Printf( const char *fmt, ... ) { va_end( argptr ); // so notepad formats the lines correctly - idStr work( buf ); - work.Replace( "\n", "\r\n" ); - - return Write( work.c_str(), work.Length() ); + idStr work( buf ); + work.Replace( "\n", "\r\n" ); + + return Write( work.c_str(), work.Length() ); } /* @@ -396,7 +396,7 @@ int idFile::ReadBool( bool &value ) { int idFile::ReadString( idStr &string ) { int len; int result = 0; - + ReadInt( len ); if ( len >= 0 ) { string.Fill( ' ', len ); @@ -545,10 +545,10 @@ int idFile::WriteBool( const bool value ) { */ int idFile::WriteString( const char *value ) { int len; - + len = strlen( value ); WriteInt( len ); - return Write( value, len ); + return Write( value, len ); } /* @@ -738,7 +738,7 @@ int idFile_Memory::Write( const void *buffer, int len ) { memcpy( newPtr, filePtr, allocated ); } allocated += extra; - curPtr = newPtr + ( curPtr - filePtr ); + curPtr = newPtr + ( curPtr - filePtr ); if ( filePtr ) { Mem_Free( filePtr ); } diff --git a/neo/framework/File.h b/neo/framework/File.h index 378197d1..cf08a0e4 100644 --- a/neo/framework/File.h +++ b/neo/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/neo/framework/FileSystem.cpp b/neo/framework/FileSystem.cpp index 745d0e2c..f25cb813 100644 --- a/neo/framework/FileSystem.cpp +++ b/neo/framework/FileSystem.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"). @@ -53,7 +53,7 @@ If you have questions concerning this license or the applicable additional terms DOOM FILESYSTEM -All of Doom's data access is through a hierarchical file system, but the contents of +All of Doom's data access is through a hierarchical file system, but the contents of the file system can be transparently merged from several sources. A "relativePath" is a reference to game file data, which must include a terminating zero. @@ -148,7 +148,7 @@ basedir / cddir / game combinations, but all other subsystems that rely on it "fs_caseSensitiveOS": This cvar is set on operating systems that use case sensitive filesystems (Linux and OSX) -It is a common situation to have the media reference filenames, whereas the file on disc +It is a common situation to have the media reference filenames, whereas the file on disc only matches in a case-insensitive way. When "fs_caseSensitiveOS" is set, the filesystem will always do a case insensitive search. IMPORTANT: This only applies to files, and not to directories. There is no case-insensitive @@ -169,9 +169,9 @@ for instance to base a mod of D3 + D3XP assets, fs_game mymod, fs_game_base d3xp -// define to fix special-cases for GetPackStatus so that files that shipped in +// define to fix special-cases for GetPackStatus so that files that shipped in // the wrong place for Doom 3 don't break pure servers. -#define DOOM3_PURE_SPECIAL_CASES +#define DOOM3_PURE_SPECIAL_CASES typedef bool (*pureExclusionFunc_t)( const struct pureExclusion_s &excl, int l, const idStr &name ); @@ -213,7 +213,7 @@ static pureExclusion_t pureExclusions[] = { { 0, 0, NULL, ".lang", excludeExtension }, { 0, 0, "sound/VO", ".ogg", excludePathPrefixAndExtension }, { 0, 0, "sound/VO", ".wav", excludePathPrefixAndExtension }, -#if defined DOOM3_PURE_SPECIAL_CASES +#if defined DOOM3_PURE_SPECIAL_CASES // add any special-case files or paths for pure servers here { 0, 0, "sound/ed/marscity/vo_intro_cutscene.ogg", NULL, excludeFullName }, { 0, 0, "sound/weapons/soulcube/energize_01.ogg", NULL, excludeFullName }, @@ -367,7 +367,7 @@ public: virtual int ReadFile( const char *relativePath, void **buffer, ID_TIME_T *timestamp ); virtual void FreeFile( void *buffer ); virtual int WriteFile( const char *relativePath, const void *buffer, int size, const char *basePath = "fs_savepath" ); - virtual void RemoveFile( const char *relativePath ); + virtual void RemoveFile( const char *relativePath ); virtual idFile * OpenFileReadFlags( const char *relativePath, int searchFlags, pack_t **foundInPak = NULL, bool allowCopyFiles = true, const char* gamedir = NULL ); virtual idFile * OpenFileRead( const char *relativePath, bool allowCopyFiles = true, const char* gamedir = NULL ); virtual idFile * OpenFileWrite( const char *relativePath, const char *basePath = "fs_savepath" ); @@ -401,7 +401,7 @@ public: static void TouchFileList_f( const idCmdArgs &args ); private: - friend dword BackgroundDownloadThread( void *parms ); + friend dword BackgroundDownloadThread( void *parms ); searchpath_t * searchPaths; int readCount; // total bytes read @@ -556,7 +556,7 @@ Ignore case and separator char distinctions */ bool idFileSystemLocal::FilenameCompare( const char *s1, const char *s2 ) const { int c1, c2; - + do { c1 = *s1++; c2 = *s2++; @@ -574,12 +574,12 @@ bool idFileSystemLocal::FilenameCompare( const char *s1, const char *s2 ) const if ( c2 == '\\' || c2 == ':' ) { c2 = '/'; } - + if ( c1 != c2 ) { return true; // strings not equal } } while( c1 ); - + return false; // strings are equal } @@ -596,7 +596,7 @@ FILE *idFileSystemLocal::OpenOSFile( const char *fileName, const char *mode, idS idStrList list; #ifndef __MWERKS__ -#ifndef WIN32 +#ifndef WIN32 // some systems will let you fopen a directory struct stat buf; if ( stat( fileName, &buf ) != -1 && !S_ISREG(buf.st_mode) ) { @@ -612,7 +612,7 @@ FILE *idFileSystemLocal::OpenOSFile( const char *fileName, const char *mode, idS if ( ListOSFiles( fpath, NULL, list ) == -1 ) { return NULL; } - + for ( i = 0; i < list.Num(); i++ ) { entry = fpath + PATHSEPERATOR_CHAR + list[i]; if ( !entry.Icmp( fileName ) ) { @@ -680,11 +680,11 @@ Creates any directories needed to store the given filename */ void idFileSystemLocal::CreateOSPath( const char *OSPath ) { char *ofs; - + // make absolutely sure that it can't back up the path // FIXME: what about c: ? if ( strstr( OSPath, ".." ) || strstr( OSPath, "::" ) ) { -#ifdef _DEBUG +#ifdef _DEBUG common->DPrintf( "refusing to create relative path \"%s\"\n", OSPath ); #endif return; @@ -692,7 +692,7 @@ void idFileSystemLocal::CreateOSPath( const char *OSPath ) { idStr path( OSPath ); for( ofs = &path[ 1 ]; *ofs ; ofs++ ) { - if ( *ofs == PATHSEPERATOR_CHAR ) { + if ( *ofs == PATHSEPERATOR_CHAR ) { // create the directory *ofs = 0; Sys_Mkdir( path ); @@ -860,7 +860,7 @@ const char *idFileSystemLocal::OSPathToRelativePath( const char *OSPath ) { // which won't match any of our drive letter based search paths bool ignoreWarning = false; #ifdef ID_DEMO_BUILD - base = strstr( OSPath, BASE_GAMEDIR ); + base = strstr( OSPath, BASE_GAMEDIR ); idStr tempStr = OSPath; tempStr.ToLower(); if ( ( strstr( tempStr, "//" ) || strstr( tempStr, "w:" ) ) && strstr( tempStr, "/doom/base/") ) { @@ -991,7 +991,7 @@ bool idFileSystemLocal::FileIsInPAK( const char *relativePath ) { // make absolutely sure that it can't back up the path. // The searchpaths do guarantee that something will always - // be prepended, so we don't need to worry about "c:" or "//limbo" + // be prepended, so we don't need to worry about "c:" or "//limbo" if ( strstr( relativePath, ".." ) || strstr( relativePath, "::" ) ) { return false; } @@ -1108,7 +1108,7 @@ int idFileSystemLocal::ReadFile( const char *relativePath, void **buffer, ID_TIM if ( timestamp ) { *timestamp = f->Timestamp(); } - + if ( !buffer ) { CloseFile( f ); return len; @@ -1368,8 +1368,8 @@ pack_t *idFileSystemLocal::LoadZipFile( const char *zipfile ) { pack->addon = false; confHash = HashFileName( ADDON_CONFIG ); for ( pakFile = pack->hashTable[confHash]; pakFile; pakFile = pakFile->next ) { - if ( !FilenameCompare( pakFile->name, ADDON_CONFIG ) ) { - pack->addon = true; + if ( !FilenameCompare( pakFile->name, ADDON_CONFIG ) ) { + pack->addon = true; idFile_InZip *file = ReadFileFromZip( pack, pakFile, ADDON_CONFIG ); // may be just an empty file if you don't bother about the mapDef if ( file && file->Length() ) { @@ -1570,12 +1570,12 @@ int idFileSystemLocal::GetFileList( const char *relativePath, const idStrList &e if ( pathLength && idStr::Icmpn( name, relativePath, pathLength - 1 ) != 0 ) { continue; } - + // ensure we have a path, and not just a filename containing the path if ( name[ pathLength ] == '\0' || name[pathLength - 1] != '/' ) { continue; } - + // make sure the file is not in a subdirectory for ( j = pathLength; name[j+1] != '\0'; j++ ) { if ( name[j] == '/' ) { @@ -1706,9 +1706,9 @@ idFileSystemLocal::ListMods =============== */ idModList *idFileSystemLocal::ListMods( void ) { - int i; - const int MAX_DESCRIPTION = 256; - char desc[ MAX_DESCRIPTION ]; + int i; + const int MAX_DESCRIPTION = 256; + char desc[ MAX_DESCRIPTION ]; idStrList dirs; idStrList pk4s; @@ -1750,7 +1750,7 @@ idModList *idFileSystemLocal::ListMods( void ) { } } } - + list->mods.Sort(); // read the descriptions for each mod - search all paths @@ -1864,7 +1864,7 @@ int idFileSystemLocal::ListOSFiles( const char *directory, const char *extension if ( fs_debug.GetInteger() ) { //common->Printf( "idFileSystemLocal::ListOSFiles: cache miss: %s\n", directory ); - } + } ret = Sys_ListFiles( directory, extension, list ); @@ -2019,7 +2019,7 @@ void idFileSystemLocal::Path_f( const idCmdArgs &args ) { common->Printf( "%s (%i files - 0x%x)\n", sp->pack->pakFilename.c_str(), sp->pack->numfiles, sp->pack->checksum ); } else { common->Printf( "%s (%i files)\n", sp->pack->pakFilename.c_str(), sp->pack->numfiles ); - } + } } } @@ -2071,7 +2071,7 @@ Takes a text file and touches every file in it, use one file per line. ============ */ void idFileSystemLocal::TouchFileList_f( const idCmdArgs &args ) { - + if ( args.Argc() != 2 ) { common->Printf( "Usage: touchFileList \n" ); return; @@ -2306,7 +2306,7 @@ void idFileSystemLocal::Startup( void ) { paksearch->next = addonPaks; addonPaks = paksearch; common->Printf( "Addon pk4 %s with checksum 0x%x is on addon list\n", - pak->pakFilename.c_str(), pak->checksum ); + pak->pakFilename.c_str(), pak->checksum ); } } @@ -2504,7 +2504,7 @@ bool idFileSystemLocal::UpdateGamePakChecksums( void ) { if ( fs_debug.GetBool() ) { common->Printf( "Adding game pak checksum for OS %d: %s 0x%x\n", id, confFile->GetFullPath(), search->pack->checksum ); } - gamePakForOS[ id ] = search->pack->checksum; + gamePakForOS[ id ] = search->pack->checksum; } } } @@ -2858,8 +2858,8 @@ void idFileSystemLocal::Init( void ) { if ( fs_game_base.GetString()[0] && !idStr::Icmp( fs_game_base.GetString(), "d3xp" ) ) { fs_game_base.SetString( NULL ); } -#endif - +#endif + if ( fs_basepath.GetString()[0] == '\0' ) { fs_basepath.SetString( Sys_DefaultBasePath() ); } @@ -3025,7 +3025,7 @@ bool idFileSystemLocal::FileAllowedFromDir( const char *path ) { return true; } // objective tgas - if ( strstr( path, "maps/game" ) == path && + if ( strstr( path, "maps/game" ) == path && !strcmp( path + l - 4, ".tga" ) ) { return true; } @@ -3146,7 +3146,7 @@ idFile *idFileSystemLocal::OpenFileReadFlags( const char *relativePath, int sear directory_t * dir; long hash; FILE * fp; - + if ( !searchPaths ) { common->FatalError( "Filesystem call made without initialization\n" ); } @@ -3166,11 +3166,11 @@ idFile *idFileSystemLocal::OpenFileReadFlags( const char *relativePath, int sear // make absolutely sure that it can't back up the path. // The searchpaths do guarantee that something will always - // be prepended, so we don't need to worry about "c:" or "//limbo" + // be prepended, so we don't need to worry about "c:" or "//limbo" if ( strstr( relativePath, ".." ) || strstr( relativePath, "::" ) ) { return NULL; } - + // edge case if ( relativePath[0] == '\0' ) { return NULL; @@ -3207,7 +3207,7 @@ idFile *idFileSystemLocal::OpenFileReadFlags( const char *relativePath, int sear continue; } } - + netpath = BuildOSPath( dir->path, dir->gamedir, relativePath ); fp = OpenOSFileCorrectName( netpath, "rb" ); if ( !fp ) { @@ -3372,11 +3372,11 @@ idFile *idFileSystemLocal::OpenFileReadFlags( const char *relativePath, int sear } } } - + if ( fs_debug.GetInteger( ) ) { common->Printf( "Can't find %s\n", relativePath ); } - + return NULL; } @@ -3868,7 +3868,7 @@ void idFileSystemLocal::FindDLL( const char *name, char _dllPath[ MAX_OSPATH ], int dllHash; pack_t *inPak; pack_t *pak; - fileInPack_t *pakFile; + fileInPack_t *pakFile; sys->DLL_GetFileName( name, dllName, MAX_OSPATH ); dllHash = HashFileName( dllName ); @@ -3938,7 +3938,7 @@ void idFileSystemLocal::FindDLL( const char *name, char _dllPath[ MAX_OSPATH ], } else { gameDLLChecksum = GetFileChecksum( dllFile ); updateChecksum = false; // don't try again below - } + } } } } @@ -3992,7 +3992,7 @@ bool idFileSystemLocal::HasD3XP( void ) { } else if ( d3xp == 1 ) { return true; } - + #if 0 // check for a d3xp directory with a pk4 file // copied over from ListMods - only looks in basepath @@ -4012,7 +4012,7 @@ bool idFileSystemLocal::HasD3XP( void ) { // checking wether the pak is loaded by checksum wouldn't be enough: // we may have a different fs_game right now but still need to reply that it's installed const char *search[4]; - idFile *pakfile; + idFile *pakfile; search[0] = fs_savepath.GetString(); search[1] = fs_devpath.GetString(); search[2] = fs_basepath.GetString(); @@ -4033,7 +4033,7 @@ bool idFileSystemLocal::HasD3XP( void ) { ListOSFiles( fs_basepath.GetString(), "/", dirs ); for ( i = 0; i < dirs.Num(); i++ ) { if ( dirs[i].Icmp( "d3xp" ) == 0 ) { - + gamepath = BuildOSPath( fs_savepath.GetString(), dirs[ i ], "default.cfg" ); idFile* cfg = OpenExplicitFileRead(gamepath); if(cfg) { @@ -4100,7 +4100,7 @@ idFileSystemLocal::FindFile } // marking addons for inclusion on reload - may need to do that even when already in the search path if ( scheduleAddons && pak->addon && addonChecksums.FindIndex( pak->checksum ) < 0 ) { - addonChecksums.Append( pak->checksum ); + addonChecksums.Append( pak->checksum ); } // an addon that's not on search list yet? that will require a restart if ( pak->addon && !pak->addon_search ) { @@ -4121,7 +4121,7 @@ int idFileSystemLocal::GetNumMaps() { int i; searchpath_t *search = NULL; int ret = declManager->GetNumDecls( DECL_MAPDEF ); - + // add to this all addon decls - coming from all addon packs ( searched or not ) for ( i = 0; i < 2; i++ ) { if ( i == 0 ) { @@ -4146,12 +4146,12 @@ retrieve the decl dictionary, add a 'path' value =============== */ const idDict * idFileSystemLocal::GetMapDecl( int idecl ) { - int i; + int i; const idDecl *mapDecl; const idDeclEntityDef *mapDef; int numdecls = declManager->GetNumDecls( DECL_MAPDEF ); searchpath_t *search = NULL; - + if ( idecl < numdecls ) { mapDecl = declManager->DeclByIndex( DECL_MAPDEF, idecl ); mapDef = static_cast( mapDecl ); @@ -4196,7 +4196,7 @@ void idFileSystemLocal::FindMapScreenshot( const char *path, char *buf, int len mapname.StripPath(); mapname.StripFileExtension(); - + idStr::snPrintf( buf, len, "guis/assets/splash/%s.tga", mapname.c_str() ); if ( ReadFile( buf, NULL, NULL ) == -1 ) { // try to extract from an addon diff --git a/neo/framework/FileSystem.h b/neo/framework/FileSystem.h index e1b618c6..48466a5d 100644 --- a/neo/framework/FileSystem.h +++ b/neo/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/neo/framework/KeyInput.cpp b/neo/framework/KeyInput.cpp index 62db430f..de17f2b6 100644 --- a/neo/framework/KeyInput.cpp +++ b/neo/framework/KeyInput.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"). @@ -60,119 +60,119 @@ keyname_t keynames[] = {"CTRL", K_CTRL, "#str_07028"}, {"SHIFT", K_SHIFT, "#str_07029"}, - {"LWIN", K_LWIN, "#str_07030"}, - {"RWIN", K_RWIN, "#str_07031"}, - {"MENU", K_MENU, "#str_07032"}, + {"LWIN", K_LWIN, "#str_07030"}, + {"RWIN", K_RWIN, "#str_07031"}, + {"MENU", K_MENU, "#str_07032"}, {"COMMAND", K_COMMAND, "#str_07033"}, {"CAPSLOCK", K_CAPSLOCK, "#str_07034"}, {"SCROLL", K_SCROLL, "#str_07035"}, {"PRINTSCREEN", K_PRINT_SCR, "#str_07179"}, - - {"F1", K_F1, "#str_07036"}, - {"F2", K_F2, "#str_07037"}, - {"F3", K_F3, "#str_07038"}, - {"F4", K_F4, "#str_07039"}, - {"F5", K_F5, "#str_07040"}, - {"F6", K_F6, "#str_07041"}, - {"F7", K_F7, "#str_07042"}, - {"F8", K_F8, "#str_07043"}, - {"F9", K_F9, "#str_07044"}, - {"F10", K_F10, "#str_07045"}, - {"F11", K_F11, "#str_07046"}, - {"F12", K_F12, "#str_07047"}, - {"INS", K_INS, "#str_07048"}, - {"DEL", K_DEL, "#str_07049"}, - {"PGDN", K_PGDN, "#str_07050"}, - {"PGUP", K_PGUP, "#str_07051"}, - {"HOME", K_HOME, "#str_07052"}, + {"F1", K_F1, "#str_07036"}, + {"F2", K_F2, "#str_07037"}, + {"F3", K_F3, "#str_07038"}, + {"F4", K_F4, "#str_07039"}, + {"F5", K_F5, "#str_07040"}, + {"F6", K_F6, "#str_07041"}, + {"F7", K_F7, "#str_07042"}, + {"F8", K_F8, "#str_07043"}, + {"F9", K_F9, "#str_07044"}, + {"F10", K_F10, "#str_07045"}, + {"F11", K_F11, "#str_07046"}, + {"F12", K_F12, "#str_07047"}, + + {"INS", K_INS, "#str_07048"}, + {"DEL", K_DEL, "#str_07049"}, + {"PGDN", K_PGDN, "#str_07050"}, + {"PGUP", K_PGUP, "#str_07051"}, + {"HOME", K_HOME, "#str_07052"}, {"END", K_END, "#str_07053"}, - {"MOUSE1", K_MOUSE1, "#str_07054"}, - {"MOUSE2", K_MOUSE2, "#str_07055"}, - {"MOUSE3", K_MOUSE3, "#str_07056"}, - {"MOUSE4", K_MOUSE4, "#str_07057"}, - {"MOUSE5", K_MOUSE5, "#str_07058"}, - {"MOUSE6", K_MOUSE6, "#str_07059"}, - {"MOUSE7", K_MOUSE7, "#str_07060"}, - {"MOUSE8", K_MOUSE8, "#str_07061"}, + {"MOUSE1", K_MOUSE1, "#str_07054"}, + {"MOUSE2", K_MOUSE2, "#str_07055"}, + {"MOUSE3", K_MOUSE3, "#str_07056"}, + {"MOUSE4", K_MOUSE4, "#str_07057"}, + {"MOUSE5", K_MOUSE5, "#str_07058"}, + {"MOUSE6", K_MOUSE6, "#str_07059"}, + {"MOUSE7", K_MOUSE7, "#str_07060"}, + {"MOUSE8", K_MOUSE8, "#str_07061"}, {"MWHEELUP", K_MWHEELUP, "#str_07131"}, {"MWHEELDOWN", K_MWHEELDOWN, "#str_07132"}, - {"JOY1", K_JOY1, "#str_07062"}, - {"JOY2", K_JOY2, "#str_07063"}, - {"JOY3", K_JOY3, "#str_07064"}, - {"JOY4", K_JOY4, "#str_07065"}, - {"JOY5", K_JOY5, "#str_07066"}, - {"JOY6", K_JOY6, "#str_07067"}, - {"JOY7", K_JOY7, "#str_07068"}, - {"JOY8", K_JOY8, "#str_07069"}, - {"JOY9", K_JOY9, "#str_07070"}, - {"JOY10", K_JOY10, "#str_07071"}, - {"JOY11", K_JOY11, "#str_07072"}, - {"JOY12", K_JOY12, "#str_07073"}, - {"JOY13", K_JOY13, "#str_07074"}, - {"JOY14", K_JOY14, "#str_07075"}, - {"JOY15", K_JOY15, "#str_07076"}, - {"JOY16", K_JOY16, "#str_07077"}, - {"JOY17", K_JOY17, "#str_07078"}, - {"JOY18", K_JOY18, "#str_07079"}, - {"JOY19", K_JOY19, "#str_07080"}, - {"JOY20", K_JOY20, "#str_07081"}, - {"JOY21", K_JOY21, "#str_07082"}, - {"JOY22", K_JOY22, "#str_07083"}, - {"JOY23", K_JOY23, "#str_07084"}, - {"JOY24", K_JOY24, "#str_07085"}, - {"JOY25", K_JOY25, "#str_07086"}, - {"JOY26", K_JOY26, "#str_07087"}, - {"JOY27", K_JOY27, "#str_07088"}, - {"JOY28", K_JOY28, "#str_07089"}, - {"JOY29", K_JOY29, "#str_07090"}, - {"JOY30", K_JOY30, "#str_07091"}, - {"JOY31", K_JOY31, "#str_07092"}, - {"JOY32", K_JOY32, "#str_07093"}, + {"JOY1", K_JOY1, "#str_07062"}, + {"JOY2", K_JOY2, "#str_07063"}, + {"JOY3", K_JOY3, "#str_07064"}, + {"JOY4", K_JOY4, "#str_07065"}, + {"JOY5", K_JOY5, "#str_07066"}, + {"JOY6", K_JOY6, "#str_07067"}, + {"JOY7", K_JOY7, "#str_07068"}, + {"JOY8", K_JOY8, "#str_07069"}, + {"JOY9", K_JOY9, "#str_07070"}, + {"JOY10", K_JOY10, "#str_07071"}, + {"JOY11", K_JOY11, "#str_07072"}, + {"JOY12", K_JOY12, "#str_07073"}, + {"JOY13", K_JOY13, "#str_07074"}, + {"JOY14", K_JOY14, "#str_07075"}, + {"JOY15", K_JOY15, "#str_07076"}, + {"JOY16", K_JOY16, "#str_07077"}, + {"JOY17", K_JOY17, "#str_07078"}, + {"JOY18", K_JOY18, "#str_07079"}, + {"JOY19", K_JOY19, "#str_07080"}, + {"JOY20", K_JOY20, "#str_07081"}, + {"JOY21", K_JOY21, "#str_07082"}, + {"JOY22", K_JOY22, "#str_07083"}, + {"JOY23", K_JOY23, "#str_07084"}, + {"JOY24", K_JOY24, "#str_07085"}, + {"JOY25", K_JOY25, "#str_07086"}, + {"JOY26", K_JOY26, "#str_07087"}, + {"JOY27", K_JOY27, "#str_07088"}, + {"JOY28", K_JOY28, "#str_07089"}, + {"JOY29", K_JOY29, "#str_07090"}, + {"JOY30", K_JOY30, "#str_07091"}, + {"JOY31", K_JOY31, "#str_07092"}, + {"JOY32", K_JOY32, "#str_07093"}, - {"AUX1", K_AUX1, "#str_07094"}, - {"AUX2", K_AUX2, "#str_07095"}, - {"AUX3", K_AUX3, "#str_07096"}, - {"AUX4", K_AUX4, "#str_07097"}, - {"AUX5", K_AUX5, "#str_07098"}, - {"AUX6", K_AUX6, "#str_07099"}, - {"AUX7", K_AUX7, "#str_07100"}, - {"AUX8", K_AUX8, "#str_07101"}, - {"AUX9", K_AUX9, "#str_07102"}, - {"AUX10", K_AUX10, "#str_07103"}, - {"AUX11", K_AUX11, "#str_07104"}, - {"AUX12", K_AUX12, "#str_07105"}, - {"AUX13", K_AUX13, "#str_07106"}, - {"AUX14", K_AUX14, "#str_07107"}, - {"AUX15", K_AUX15, "#str_07108"}, - {"AUX16", K_AUX16, "#str_07109"}, + {"AUX1", K_AUX1, "#str_07094"}, + {"AUX2", K_AUX2, "#str_07095"}, + {"AUX3", K_AUX3, "#str_07096"}, + {"AUX4", K_AUX4, "#str_07097"}, + {"AUX5", K_AUX5, "#str_07098"}, + {"AUX6", K_AUX6, "#str_07099"}, + {"AUX7", K_AUX7, "#str_07100"}, + {"AUX8", K_AUX8, "#str_07101"}, + {"AUX9", K_AUX9, "#str_07102"}, + {"AUX10", K_AUX10, "#str_07103"}, + {"AUX11", K_AUX11, "#str_07104"}, + {"AUX12", K_AUX12, "#str_07105"}, + {"AUX13", K_AUX13, "#str_07106"}, + {"AUX14", K_AUX14, "#str_07107"}, + {"AUX15", K_AUX15, "#str_07108"}, + {"AUX16", K_AUX16, "#str_07109"}, {"KP_HOME", K_KP_HOME, "#str_07110"}, {"KP_UPARROW", K_KP_UPARROW, "#str_07111"}, {"KP_PGUP", K_KP_PGUP, "#str_07112"}, - {"KP_LEFTARROW", K_KP_LEFTARROW, "#str_07113"}, + {"KP_LEFTARROW", K_KP_LEFTARROW, "#str_07113"}, {"KP_5", K_KP_5, "#str_07114"}, {"KP_RIGHTARROW", K_KP_RIGHTARROW, "#str_07115"}, {"KP_END", K_KP_END, "#str_07116"}, {"KP_DOWNARROW", K_KP_DOWNARROW, "#str_07117"}, {"KP_PGDN", K_KP_PGDN, "#str_07118"}, {"KP_ENTER", K_KP_ENTER, "#str_07119"}, - {"KP_INS", K_KP_INS, "#str_07120"}, - {"KP_DEL", K_KP_DEL, "#str_07121"}, - {"KP_SLASH", K_KP_SLASH, "#str_07122"}, - {"KP_MINUS", K_KP_MINUS, "#str_07123"}, + {"KP_INS", K_KP_INS, "#str_07120"}, + {"KP_DEL", K_KP_DEL, "#str_07121"}, + {"KP_SLASH", K_KP_SLASH, "#str_07122"}, + {"KP_MINUS", K_KP_MINUS, "#str_07123"}, {"KP_PLUS", K_KP_PLUS, "#str_07124"}, {"KP_NUMLOCK", K_KP_NUMLOCK, "#str_07125"}, {"KP_STAR", K_KP_STAR, "#str_07126"}, {"KP_EQUALS", K_KP_EQUALS, "#str_07127"}, {"PAUSE", K_PAUSE, "#str_07128"}, - + {"SEMICOLON", ';', "#str_07129"}, // because a raw semicolon separates commands {"APOSTROPHE", '\'', "#str_07130"}, // because a raw apostrophe messes with parsing @@ -290,7 +290,7 @@ to be configured even if they don't have defined names. */ int idKeyInput::StringToKeyNum( const char *str ) { keyname_t *kn; - + if ( !str || !str[0] ) { return -1; } @@ -301,7 +301,7 @@ int idKeyInput::StringToKeyNum( const char *str ) { // check for hex code if ( str[0] == '0' && str[1] == 'x' && strlen( str ) == 4 ) { int n1, n2; - + n1 = str[2]; if ( n1 >= '0' && n1 <= '9' ) { n1 -= '0'; @@ -342,7 +342,7 @@ given keynum. =================== */ const char *idKeyInput::KeyNumToString( int keynum, bool localized ) { - keyname_t *kn; + keyname_t *kn; static char tinystr[5]; int i, j; @@ -368,11 +368,11 @@ const char *idKeyInput::KeyNumToString( int keynum, bool localized ) { return kn->name; } else { #if MACOS_X - + switch ( kn->keynum ) { - case K_ENTER: - case K_BACKSPACE: - case K_ALT: + case K_ENTER: + case K_BACKSPACE: + case K_ALT: case K_INS: case K_PRINT_SCR: return OSX_GetLocalizedString( kn->name ); @@ -466,7 +466,7 @@ void Key_Unbind_f( const idCmdArgs &args ) { common->Printf( "unbind : remove commands from a key\n" ); return; } - + b = idKeyInput::StringToKeyNum( args.Argv(1) ); if ( b == -1 ) { // If it wasn't a key, it could be a command @@ -485,7 +485,7 @@ Key_Unbindall_f */ void Key_Unbindall_f( const idCmdArgs &args ) { int i; - + for ( i = 0; i < MAX_KEYS; i++ ) { idKeyInput::SetBinding( i, "" ); } @@ -499,7 +499,7 @@ Key_Bind_f void Key_Bind_f( const idCmdArgs &args ) { int i, c, b; char cmd[MAX_STRING_CHARS]; - + c = args.Argc(); if ( c < 2 ) { @@ -521,7 +521,7 @@ void Key_Bind_f( const idCmdArgs &args ) { } return; } - + // copy the rest of the command line cmd[0] = 0; // start out with a null string for ( i = 2; i < c; i++ ) { @@ -614,7 +614,7 @@ const char *idKeyInput::KeysFromBinding( const char *bind ) { if ( keys[i].binding.Icmp( bind ) == 0 ) { if ( keyName[0] != '\0' ) { idStr::Append( keyName, sizeof( keyName ), common->GetLanguageDict()->GetString( "#str_07183" ) ); - } + } idStr::Append( keyName, sizeof( keyName ), KeyNumToString( i, true ) ); } } diff --git a/neo/framework/KeyInput.h b/neo/framework/KeyInput.h index 4e923e97..d0e773a1 100644 --- a/neo/framework/KeyInput.h +++ b/neo/framework/KeyInput.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"). @@ -115,7 +115,7 @@ typedef enum { K_KP_STAR, K_KP_EQUALS, - K_MASCULINE_ORDINATOR = 186, + K_MASCULINE_ORDINATOR = 186, // K_MOUSE enums must be contiguous (no char codes in the middle) K_MOUSE1 = 187, K_MOUSE2, diff --git a/neo/framework/Licensee.h b/neo/framework/Licensee.h index d751201c..957b4b4b 100644 --- a/neo/framework/Licensee.h +++ b/neo/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/neo/framework/Session.cpp b/neo/framework/Session.cpp index e1b385e6..abe005a9 100644 --- a/neo/framework/Session.cpp +++ b/neo/framework/Session.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"). @@ -127,7 +127,7 @@ Restart the server on a different map in developer mode static void Session_DevMap_f( const idCmdArgs &args ) { idStr map, string; findFile_t ff; - idCmdArgs rl_args; + idCmdArgs rl_args; map = args.Argv(1); if ( !map.Length() ) { @@ -285,7 +285,7 @@ static void Session_PromptKey_f( const idCmdArgs &args ) { =============================================================================== SESSION LOCAL - + =============================================================================== */ @@ -295,7 +295,7 @@ idSessionLocal::Clear =============== */ void idSessionLocal::Clear() { - + insideUpdateScreen = false; insideExecuteMapChange = false; @@ -325,7 +325,7 @@ void idSessionLocal::Clear() { timeDemo = TD_NO; waitingOnBind = false; lastPacifierTime = 0; - + msgRunning = false; guiMsgRestore = NULL; msgIgnoreButtons = false; @@ -354,10 +354,10 @@ idSessionLocal::idSessionLocal idSessionLocal::idSessionLocal() { guiInGame = guiMainMenu = guiIntro \ = guiRestartMenu = guiLoading = guiGameOver = guiActive \ - = guiTest = guiMsg = guiMsgRestore = guiTakeNotes = NULL; - + = guiTest = guiMsg = guiMsgRestore = guiTakeNotes = NULL; + menuSoundWorld = NULL; - + Clear(); } @@ -427,7 +427,7 @@ void idSessionLocal::Shutdown() { delete menuSoundWorld; menuSoundWorld = NULL; } - + mapSpawnData.serverInfo.Clear(); mapSpawnData.syncedCVars.Clear(); for ( i = 0; i < MAX_ASYNC_CLIENTS; i++ ) { @@ -847,7 +847,7 @@ void idSessionLocal::StopPlayingRenderDemo() { return; } - // Record the stop time before doing anything that could be time consuming + // Record the stop time before doing anything that could be time consuming int timeDemoStopTime = Sys_Milliseconds(); EndAVICapture(); @@ -908,7 +908,7 @@ void idSessionLocal::StartPlayingRenderDemo( idStr demoName ) { // make sure localSound / GUI intro music shuts up sw->StopAllSounds(); - sw->PlayShaderDirectly( "", 0 ); + sw->PlayShaderDirectly( "", 0 ); menuSoundWorld->StopAllSounds(); menuSoundWorld->PlayShaderDirectly( "", 0 ); @@ -959,12 +959,12 @@ idSessionLocal::TimeRenderDemo */ void idSessionLocal::TimeRenderDemo( const char *demoName, bool twice ) { idStr demo = demoName; - + // no sound in time demos soundSystem->SetMute( true ); StartPlayingRenderDemo( demo ); - + if ( twice && readDemo ) { // cycle through once to precache everything guiLoading->SetStateString( "demo", common->GetLanguageDict()->GetString( "#str_04852" ) ); @@ -978,7 +978,7 @@ void idSessionLocal::TimeRenderDemo( const char *demoName, bool twice ) { guiLoading->SetStateString( "demo", "" ); StartPlayingRenderDemo( demo ); } - + if ( !readDemo ) { return; @@ -1015,7 +1015,7 @@ void idSessionLocal::EndAVICapture() { sw->AVIClose(); // write a .roqParam file so the demo can be converted to a roq file - idFile *f = fileSystem->OpenFileWrite( va( "demos/%s/%s.roqParam", + idFile *f = fileSystem->OpenFileWrite( va( "demos/%s/%s.roqParam", aviDemoShortName.c_str(), aviDemoShortName.c_str() ) ); f->Printf( "INPUT_DIR demos/%s\n", aviDemoShortName.c_str() ); f->Printf( "FILENAME demos/%s/%s.RoQ\n", aviDemoShortName.c_str(), aviDemoShortName.c_str() ); @@ -1282,7 +1282,7 @@ This should still work after disconnecting from a level ============== */ void idSessionLocal::WriteCmdDemo( const char *demoName, bool save ) { - + if ( !demoName[0] ) { common->Printf( "idSessionLocal::WriteCmdDemo: no name specified\n" ); return; @@ -1306,7 +1306,7 @@ void idSessionLocal::WriteCmdDemo( const char *demoName, bool save ) { if ( save ) { cmdDemoFile->Write( &logIndex, sizeof( logIndex ) ); } - + SaveCmdDemoToFile( cmdDemoFile ); if ( save ) { @@ -1581,7 +1581,7 @@ void idSessionLocal::ExecuteMapChange( bool noFadeWipe ) { // and draw the loading gui instead of game draws insideExecuteMapChange = true; - // if this works out we will probably want all the sizes in a def file although this solution will + // if this works out we will probably want all the sizes in a def file although this solution will // work for new maps etc. after the first load. we can also drop the sizes into the default.cfg fileSystem->ResetReadCount(); if ( !reloadingSameMap ) { @@ -1605,8 +1605,8 @@ void idSessionLocal::ExecuteMapChange( bool noFadeWipe ) { // if net play, we get the number of clients during mapSpawnInfo processing if ( !idAsyncNetwork::IsActive() ) { numClients = 1; - } - + } + int start = Sys_Milliseconds(); common->Printf( "--------- Map Initialization ---------\n" ); @@ -1803,7 +1803,7 @@ void idSessionLocal::TakeNotes( const char *p, bool extended ) { }; #else const char *people[] = { - "Tim", "Kenneth", "Robert", + "Tim", "Kenneth", "Robert", "Matt", "Mal", "Jerry", "Steve", "Pat", "Xian", "Ed", "Fred", "James", "Eric", "Andy", "Seneca", "Patrick", "Kevin", "MrElusive", "Jim", "Brian", "John", "Adrian", "Nobody" @@ -1951,7 +1951,7 @@ bool idSessionLocal::SaveGame( const char *saveName, bool autosave ) { return false; } - // Write SaveGame Header: + // Write SaveGame Header: // Game Name / Version / Map Name / Persistant Player Info // game @@ -2037,7 +2037,7 @@ bool idSessionLocal::SaveGame( const char *saveName, bool autosave ) { idSessionLocal::LoadGame =============== */ -bool idSessionLocal::LoadGame( const char *saveName ) { +bool idSessionLocal::LoadGame( const char *saveName ) { #ifdef ID_DEDICATED common->Printf( "Dedicated servers cannot load games.\n" ); return false; @@ -2180,7 +2180,7 @@ bool idSessionLocal::ProcessEvent( const sysEvent_t *event ) { guiTest = NULL; return true; } - + static const char *cmd; cmd = guiTest->HandleEvent( event, com_frameTime ); if ( cmd && cmd[0] ) { @@ -2254,7 +2254,7 @@ void idSessionLocal::AdvanceRenderDemo( bool singleFrameOnly ) { lastDemoTic = latchedTicNumber - latchedTicNumber % USERCMD_PER_DEMO_FRAME; } else { // always advance a single frame with avidemo and timedemo - lastDemoTic = latchedTicNumber; + lastDemoTic = latchedTicNumber; } while( skipFrames > -1 ) { @@ -2377,7 +2377,7 @@ void idSessionLocal::Draw() { } if ( guiActive == guiMsg ) { guiMsg->Redraw( com_frameTime ); - } + } } else if ( guiTest ) { // if testing a gui, clear the screen and draw it // clear the background, in case the tested gui is transparent @@ -2386,12 +2386,12 @@ void idSessionLocal::Draw() { renderSystem->DrawStretchPic( 0, 0, 640, 480, 0, 0, 1, 1, declManager->FindMaterial( "_white" ) ); guiTest->Redraw( com_frameTime ); } else if ( guiActive && !guiActive->State().GetBool( "gameDraw" ) ) { - + // draw the frozen gui in the background if ( guiActive == guiMsg && guiMsgRestore ) { guiMsgRestore->Redraw( com_frameTime ); } - + // draw the menus full screen if ( guiActive == guiTakeNotes && !com_skipGameDraw.GetBool() ) { game->Draw( GetLocalClientNum() ); @@ -2453,7 +2453,7 @@ void idSessionLocal::Draw() { // draw the wipe material on top of this if it hasn't completed yet DrawWipeModel(); - + // draw debug graphs DrawCmdGraph(); @@ -2565,7 +2565,7 @@ void idSessionLocal::Frame() { if ( com_minTics.GetInteger() > 1 ) { minTic = lastGameTic + com_minTics.GetInteger(); } - + if ( readDemo ) { if ( !timeDemo && numDemoFrames != 1 ) { minTic = lastDemoTic + USERCMD_PER_DEMO_FRAME; @@ -2577,7 +2577,7 @@ void idSessionLocal::Frame() { } else if ( writeDemo ) { minTic = lastGameTic + USERCMD_PER_DEMO_FRAME; // demos are recorded at 30 hz } - + // fixedTic lets us run a forced number of usercmd each frame without timing if ( com_fixedTic.GetInteger() ) { minTic = latchedTicNumber; @@ -2760,7 +2760,7 @@ void idSessionLocal::RunGameTic() { logCmd.consistencyHash = LittleLong( logCmd.consistencyHash ); } } - + // if we didn't get one from the file, get it locally if ( !cmdDemoFile ) { // get a locally created command @@ -3098,7 +3098,7 @@ we toggled some key state to CDKEY_CHECKING. send a standalone auth packet to va void idSessionLocal::EmitGameAuth( void ) { // make sure the auth reply is empty, we use it to indicate an auth reply authMsg.Empty(); - if ( idAsyncNetwork::client.SendAuthCheck( cdkey_state == CDKEY_CHECKING ? cdkey : NULL, xpkey_state == CDKEY_CHECKING ? xpkey : NULL ) ) { + if ( idAsyncNetwork::client.SendAuthCheck( cdkey_state == CDKEY_CHECKING ? cdkey : NULL, xpkey_state == CDKEY_CHECKING ? xpkey : NULL ) ) { authEmitTimeout = Sys_Milliseconds() + CDKEY_AUTH_TIMEOUT; common->DPrintf( "authing with the master..\n" ); } else { @@ -3110,7 +3110,7 @@ void idSessionLocal::EmitGameAuth( void ) { if ( xpkey_state == CDKEY_CHECKING ) { xpkey_state = CDKEY_OK; } - } + } } /* @@ -3169,7 +3169,7 @@ bool idSessionLocal::CheckKey( const char *key, bool netConnect, bool offline_va } } } - + if ( !offline_valid[ 0 ] || !offline_valid[1] ) { return false; } @@ -3216,7 +3216,7 @@ bool idSessionLocal::CDKeysAreValid( bool strict ) { break; } } - } + } if ( cdkey_state == CDKEY_UNKNOWN ) { cdkey_state = CDKEY_CHECKING; emitAuth = true; diff --git a/neo/framework/Session.h b/neo/framework/Session.h index 5ea4962e..288c0bee 100644 --- a/neo/framework/Session.h +++ b/neo/framework/Session.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 @@ typedef struct { short combat; } logStats_t; -static const int MAX_LOGGED_STATS = 60 * 120; // log every half second +static const int MAX_LOGGED_STATS = 60 * 120; // log every half second typedef enum { MSG_OK, diff --git a/neo/framework/Session_local.h b/neo/framework/Session_local.h index 0f260682..76429bca 100644 --- a/neo/framework/Session_local.h +++ b/neo/framework/Session_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,7 +181,7 @@ public: bool insideExecuteMapChange; // draw loading screen and update // screen on prints - int bytesNeededForMapLoad; // + int bytesNeededForMapLoad; // // we don't want to redraw the loading screen for every single // console print that happens @@ -217,7 +217,7 @@ public: bool aviCaptureMode; // if true, screenshots will be taken and sound captured - idStr aviDemoShortName; // + idStr aviDemoShortName; // float aviDemoFrameCount; int aviTicStart; @@ -226,7 +226,7 @@ public: int numDemoFrames; // for timeDemo and demoShot int demoTimeOffset; renderView_t currentDemoRenderView; - // the next one will be read when + // the next one will be read when // com_frameTime + demoTimeOffset > currentDemoRenderView. // TODO: make this private (after sync networking removal and idnet tweaks) @@ -242,14 +242,14 @@ public: idUserInterface * guiGameOver; idUserInterface * guiTest; idUserInterface * guiTakeNotes; - + idUserInterface * guiMsg; idUserInterface * guiMsgRestore; // store the calling GUI for restore idStr msgFireBack[ 2 ]; bool msgRunning; int msgRetIndex; bool msgIgnoreButtons; - + bool waitingOnBind; const idMaterial * whiteMaterial; @@ -288,7 +288,7 @@ public: void AdvanceRenderDemo( bool singleFrameOnly ); void RunGameTic(); - + void FinishCmdLoad(); void LoadLoadingGui(const char *mapName); @@ -332,11 +332,11 @@ public: void SetModsMenuGuiVars( void ); void SetMainMenuSkin( void ); void SetPbMenuGuiVars( void ); - + private: bool BoxDialogSanityCheck( void ); void EmitGameAuth( void ); - + typedef enum { CDKEY_UNKNOWN, // need to perform checks on the key CDKEY_INVALID, // that key is wrong diff --git a/neo/framework/Session_menu.cpp b/neo/framework/Session_menu.cpp index dd5249fd..57377e18 100644 --- a/neo/framework/Session_menu.cpp +++ b/neo/framework/Session_menu.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"). @@ -156,7 +156,7 @@ void idSessionLocal::GetSaveGameList( idStrList &fileList, idList &f } else { files = fileSystem->ListFiles( "savegames", ".save" ); } - + fileList = files->GetList(); fileSystem->FreeFileList( files ); @@ -292,7 +292,7 @@ idSessionLocal::SetMainMenuGuiVars void idSessionLocal::SetMainMenuGuiVars( void ) { guiMainMenu->SetStateString( "serverlist_sel_0", "-1" ); - guiMainMenu->SetStateString( "serverlist_selid_0", "-1" ); + guiMainMenu->SetStateString( "serverlist_selid_0", "-1" ); guiMainMenu->SetStateInt( "com_machineSpec", com_machineSpec.GetInteger() ); @@ -367,7 +367,7 @@ bool idSessionLocal::HandleSaveGameMenuCommand( idCmdArgs &args, int &icmd ) { } else { file = fileSystem->OpenFileRead( saveFileName ); } - + if ( file != NULL ) { fileSystem->CloseFile( file ); @@ -579,7 +579,7 @@ void idSessionLocal::HandleMainMenuCommands( const char *menuCommand ) { if ( game ) { game->HandleMainMenuCommands( cmd, guiActive ); } - + if ( !idStr::Icmp( cmd, "startGame" ) ) { cvarSystem->SetCVarInteger( "g_skill", guiMainMenu->State().GetInt( "skill" ) ); if ( icmd < args.Argc() ) { @@ -591,7 +591,7 @@ void idSessionLocal::HandleMainMenuCommands( const char *menuCommand ) { StartNewGame( "game/demo_mars_city1" ); #endif } - // need to do this here to make sure com_frameTime is correct or the gui activates with a time that + // need to do this here to make sure com_frameTime is correct or the gui activates with a time that // is "however long map load took" time in the past common->GUIFrame( false, false ); SetGUI( guiIntro, NULL ); @@ -675,7 +675,7 @@ void idSessionLocal::HandleMainMenuCommands( const char *menuCommand ) { } if ( !idStr::Icmp( cmd, "LANConnect" ) ) { - int sel = guiActive->State().GetInt( "serverList_selid_0" ); + int sel = guiActive->State().GetInt( "serverList_selid_0" ); cmdSystem->BufferCommandText( CMD_EXEC_NOW, va( "Connect %d\n", sel ) ); return; } @@ -917,7 +917,7 @@ void idSessionLocal::HandleMainMenuCommands( const char *menuCommand ) { } } if ( !vcmd.Icmp( "drivar" ) ) { - cmdSystem->BufferCommandText( CMD_EXEC_NOW, "s_restart\n" ); + cmdSystem->BufferCommandText( CMD_EXEC_NOW, "s_restart\n" ); } continue; } @@ -1003,7 +1003,7 @@ void idSessionLocal::HandleMainMenuCommands( const char *menuCommand ) { guiMainMenu->SetKeyBindingNames(); continue; } - + if ( !idStr::Icmp( cmd, "systemCvars" ) ) { guiActive->HandleNamedEvent( "cvar read render" ); guiActive->HandleNamedEvent( "cvar read sound" ); @@ -1032,7 +1032,7 @@ void idSessionLocal::HandleMainMenuCommands( const char *menuCommand ) { if ( !session->CDKeysAreValid( false ) ) { cmdSystem->BufferCommandText( CMD_EXEC_NOW, "promptKey force" ); cmdSystem->ExecuteCommandBuffer(); - } + } #endif continue; } @@ -1252,9 +1252,9 @@ idSessionLocal::MessageBox ================= */ const char* idSessionLocal::MessageBox( msgBoxType_t type, const char *message, const char *title, bool wait, const char *fire_yes, const char *fire_no, bool network ) { - + common->DPrintf( "MessageBox: %s - %s\n", title ? title : "", message ? message : "" ); - + if ( !BoxDialogSanityCheck() ) { return NULL; } @@ -1310,7 +1310,7 @@ const char* idSessionLocal::MessageBox( msgBoxType_t type, const char *message, guiMsg->SetStateString( "visible_mid", "0" ); guiMsg->SetStateString( "visible_left", "1" ); guiMsg->SetStateString( "visible_right", "1" ); - guiMsg->SetStateString( "visible_entry", "1" ); + guiMsg->SetStateString( "visible_entry", "1" ); guiMsg->HandleNamedEvent( "Prompt" ); break; case MSG_CDKEY: @@ -1352,7 +1352,7 @@ const char* idSessionLocal::MessageBox( msgBoxType_t type, const char *message, guiActive->Activate( true, com_frameTime ); msgRunning = true; msgRetIndex = -1; - + if ( wait ) { // play one frame ignoring events so we don't get confused by parasite button releases msgIgnoreButtons = true; @@ -1379,7 +1379,7 @@ const char* idSessionLocal::MessageBox( msgBoxType_t type, const char *message, guiMsg->State().GetString( "visible_cdchk" ), guiMsg->State().GetString( "str_cdkey" ), guiMsg->State().GetString( "str_cdchk" ), - guiMsg->State().GetString( "visible_xpchk" ), + guiMsg->State().GetString( "visible_xpchk" ), guiMsg->State().GetString( "str_xpkey" ), guiMsg->State().GetString( "str_xpchk" ) ); return msgFireBack[ 0 ].c_str(); @@ -1614,7 +1614,7 @@ void idSessionLocal::HandleNoteCommands( const char *menuCommand ) { } sprintf( str, "recordViewNotes \"%s\" \"%s\" \"%s\"\n", workName.c_str(), noteNum.c_str(), guiTakeNotes->State().GetString( "note" ) ); - + cmdSystem->BufferCommandText( CMD_EXEC_NOW, str ); cmdSystem->ExecuteCommandBuffer(); diff --git a/neo/framework/Unzip.cpp b/neo/framework/Unzip.cpp index 4b8c7172..38248122 100644 --- a/neo/framework/Unzip.cpp +++ b/neo/framework/Unzip.cpp @@ -3,13 +3,13 @@ #include "Unzip.h" -/* unzip.h -- IO for uncompress .zip files using zlib +/* unzip.h -- IO for uncompress .zip files using zlib Version 0.15 beta, Mar 19th, 1998, Copyright (C) 1998 Gilles Vollant This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g - WinZip, InfoZip tools and compatible. + WinZip, InfoZip tools and compatible. Encryption and multi volume ZipFile (span) are not supported. Old compressions used by old PKZip 1.x are not supported @@ -29,19 +29,19 @@ freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. + misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -/* for more info about .ZIP format, see - ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip +/* for more info about .ZIP format, see + ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip PkWare has also a specification at : - ftp://ftp.pkware.com/probdesc.zip */ + ftp://ftp.pkware.com/probdesc.zip */ /* zlib.h -- interface of the 'zlib' general purpose compression library version 1.1.3, July 9th, 1998 @@ -57,11 +57,11 @@ freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. + misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Jean-loup Gailly Mark Adler @@ -75,7 +75,7 @@ /* zconf.h -- configuration of the zlib compression library * Copyright (C) 1995-1998 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id: unzip.c,v 1.2 1999/09/07 20:51:25 zoid Exp $ */ @@ -102,11 +102,11 @@ #endif /* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) + (1 << (windowBits+2)) + (1 << (memLevel+9)) that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) plus a few kilobytes for small objects. For example, if you want to reduce the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" Of course this will generally degrade compression (there's no free lunch). The memory requirements for inflate are (in bytes) 1 << windowBits @@ -114,7 +114,7 @@ for small objects. */ - /* Type declarations */ + /* Type declarations */ #ifndef OF /* function prototypes */ #define OF(args) args @@ -135,23 +135,23 @@ typedef Byte *voidp; #define ZLIB_VERSION "1.1.3" -/* - The 'zlib' compression library provides in-memory compression and +/* + The 'zlib' compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. This version of the library supports only one compression method (deflation) but other algorithms will be added later and will have the same stream interface. - Compression can be done in a single step if the buffers are large + Compression can be done in a single step if the buffers are large enough (for example if an input file is mmap'ed), or can be done by repeated calls of the compression function. In the latter case, the application must provide more input and/or consume the output (providing more output space) before each call. - The library also supports reading and writing files in gzip (.gz) format + The library also supports reading and writing files in gzip (.gz) format with an interface similar to that of stdio. - The library does not install any signal handler. The decoder checks + The library does not install any signal handler. The decoder checks the consistency of the compressed data, so the library should never crash even in case of corrupted input. */ @@ -188,7 +188,7 @@ typedef Byte *voidp; a single step). */ - /* constants */ + /* constants */ #define Z_NO_FLUSH 0 #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ @@ -234,7 +234,7 @@ typedef Byte *voidp; #define zlib_version zlibVersion() /* for compatibility with versions < 1.0.2 */ - /* basic functions */ + /* basic functions */ const char * zlibVersion OF((void)); /* The application can compare zlibVersion and ZLIB_VERSION for consistency. @@ -243,21 +243,21 @@ const char * zlibVersion OF((void)); This check is automatically made by deflateInit and inflateInit. */ -/* +/* int deflateInit OF((z_streamp strm, int level)); - Initializes the internal stream state for compression. The fields + Initializes the internal stream state for compression. The fields zalloc, zfree and opaque must be initialized before by the caller. If zalloc and zfree are set to Z_NULL, deflateInit updates them to use default allocation functions. - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION requests a default compromise between speed and compression (currently equivalent to level 6). - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if level is not a valid compression level, Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). @@ -268,24 +268,24 @@ int deflateInit OF((z_streamp strm, int level)); int deflate OF((z_streamp strm, int flush)); /* - deflate compresses as much data as possible, and stops when the input + deflate compresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. - The detailed semantics are as follows. deflate performs one or both of the + The detailed semantics are as follows. deflate performs one or both of the following actions: - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). - Provide more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). - Some output may be provided even if flush is not set. + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). + Some output may be provided even if flush is not set. Before the call of deflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming @@ -296,46 +296,46 @@ int deflate OF((z_streamp strm, int flush)); and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is flushed to the output buffer and the output is aligned on a byte boundary, so that the decompressor can get all input data available so far. (In particular avail_in is zero after the call if enough output space has been provided before the call.) Flushing may degrade compression for some compression algorithms and so it should be used only when necessary. - If flush is set to Z_FULL_FLUSH, all output is flushed as with + If flush is set to Z_FULL_FLUSH, all output is flushed as with Z_SYNC_FLUSH, and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if random access is desired. Using Z_FULL_FLUSH too often can seriously degrade the compression. - If deflate returns with avail_out == 0, this function must be called again + If deflate returns with avail_out == 0, this function must be called again with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero avail_out). - If the parameter flush is set to Z_FINISH, pending input is processed, + If the parameter flush is set to Z_FINISH, pending input is processed, pending output is flushed and deflate returns with Z_STREAM_END if there was enough output space; if deflate returns with Z_OK, this function must be called again with Z_FINISH and more output space (updated avail_out) but no more input data, until it returns with Z_STREAM_END or an error. After deflate has returned Z_STREAM_END, the only possible operations on the stream are deflateReset or deflateEnd. - - Z_FINISH can be used immediately after deflateInit if all the compression + + Z_FINISH can be used immediately after deflateInit if all the compression is to be done in a single step. In this case, avail_out must be at least 0.1% larger than avail_in plus 12 bytes. If deflate does not return Z_STREAM_END, then it must be called again as described above. - deflate() sets strm->adler to the adler32 checksum of all input read + deflate() sets strm->adler to the adler32 checksum of all input read so (that is, total_in bytes). - deflate() may update data_type if it can make a good guess about + deflate() may update data_type if it can make a good guess about the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered binary. This field is only for information purposes and does not affect the compression algorithm in any manner. - deflate() returns Z_OK if some progress has been made (more input + deflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example @@ -346,11 +346,11 @@ int deflate OF((z_streamp strm, int flush)); int deflateEnd OF((z_streamp strm)); /* - All dynamically allocated data structures for this stream are freed. + All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent, Z_DATA_ERROR if the stream was freed prematurely (some input or output was discarded). In the error case, msg may be set but then points to a static string (which must not be @@ -358,10 +358,10 @@ int deflateEnd OF((z_streamp strm)); */ -/* +/* int inflateInit OF((z_streamp strm)); - Initializes the internal stream state for decompression. The fields + Initializes the internal stream state for decompression. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. If next_in is not Z_NULL and avail_in is large enough (the exact value depends on the compression method), inflateInit determines the @@ -370,7 +370,7 @@ int inflateInit OF((z_streamp strm)); inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to use default allocation functions. - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the version assumed by the caller. msg is set to null if there is no error message. inflateInit does not perform any decompression apart from reading @@ -381,7 +381,7 @@ int inflateInit OF((z_streamp strm)); int inflate OF((z_streamp strm, int flush)); /* - inflate decompresses as much data as possible, and stops when the input + inflate decompresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may some introduce some output latency (reading input without producing any output) except when forced to flush. @@ -390,14 +390,14 @@ int inflate OF((z_streamp strm, int flush)); following actions: - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing - will resume at this point for the next call of inflate(). + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing + will resume at this point for the next call of inflate(). - Provide more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there - is no more input data or no more space in the output buffer (see below - about the flush parameter). + accordingly. inflate() provides as much output as possible, until there + is no more input data or no more space in the output buffer (see below + about the flush parameter). Before the call of inflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming @@ -408,13 +408,13 @@ int inflate OF((z_streamp strm, int flush)); must be called again after making room in the output buffer because there might be more output pending. - If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much + If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much output as possible to the output buffer. The flushing behavior of inflate is not specified for values of the flush parameter other than Z_SYNC_FLUSH and Z_FINISH, but the current implementation actually flushes as much output as possible anyway. - inflate() should normally be called until it returns Z_STREAM_END or an + inflate() should normally be called until it returns Z_STREAM_END or an error. However if all decompression is to be performed in a single step (a single call of inflate), the parameter flush should be set to Z_FINISH. In this case all pending input is processed and all pending @@ -425,16 +425,16 @@ int inflate OF((z_streamp strm, int flush)); is never required, but can be used to inform inflate that a faster routine may be used for the single inflate() call. - If a preset dictionary is needed at this point (see inflateSetDictionary + If a preset dictionary is needed at this point (see inflateSetDictionary below), inflate sets strm-adler to the adler32 checksum of the - dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise + dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise it sets strm->adler to the adler32 checksum of all output produced so (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described below. At the end of the stream, inflate() checks that its computed adler32 checksum is equal to that saved by the compressor and returns Z_STREAM_END only if the checksum is correct. - inflate() returns Z_OK if some progress has been made (more input processed + inflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if the end of the compressed data has been reached and all uncompressed output has been produced, Z_NEED_DICT if a preset dictionary is needed at this point, Z_DATA_ERROR if the input data was @@ -450,49 +450,49 @@ int inflate OF((z_streamp strm, int flush)); int inflateEnd OF((z_streamp strm)); /* - All dynamically allocated data structures for this stream are freed. + All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. - inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent. In the error case, msg may be set but then points to a static string (which must not be deallocated). */ - /* Advanced functions */ + /* Advanced functions */ /* - The following functions are needed only in some special applications. + The following functions are needed only in some special applications. */ -/* +/* int deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); + int level, + int method, + int windowBits, + int memLevel, + int strategy)); - This is another version of deflateInit with more compression options. The + This is another version of deflateInit with more compression options. The fields next_in, zalloc, zfree and opaque must be initialized before by the caller. - The method parameter is the compression method. It must be Z_DEFLATED in + The method parameter is the compression method. It must be Z_DEFLATED in this version of the library. - The windowBits parameter is the base two logarithm of the window size + The windowBits parameter is the base two logarithm of the window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. Larger values of this parameter result in better compression at the expense of memory usage. The default value is 15 if deflateInit is used instead. - The memLevel parameter specifies how much memory should be allocated + The memLevel parameter specifies how much memory should be allocated for the internal compression state. memLevel=1 uses minimum memory but is slow and reduces compression ratio; memLevel=9 uses maximum memory for optimal speed. The default value is 8. See zconf.h for total memory usage as a function of windowBits and memLevel. - The strategy parameter is used to tune the compression algorithm. Use the + The strategy parameter is used to tune the compression algorithm. Use the value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no string match). Filtered data consists mostly of small values with a @@ -503,42 +503,42 @@ int deflateInit2 OF((z_streamp strm, the compression ratio but not the correctness of the compressed output even if it is not set appropriately. - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid method). msg is set to null if there is no error message. deflateInit2 does not perform any compression: this will be done by deflate(). */ - + int deflateSetDictionary OF((z_streamp strm, - const Byte *dictionary, - uInt dictLength)); + const Byte *dictionary, + uInt dictLength)); /* - Initializes the compression dictionary from the given byte sequence + Initializes the compression dictionary from the given byte sequence without producing any compressed output. This function must be called immediately after deflateInit, deflateInit2 or deflateReset, before any call of deflate. The compressor and decompressor must use exactly the same dictionary (see inflateSetDictionary). - The dictionary should consist of strings (byte sequences) that are likely + The dictionary should consist of strings (byte sequences) that are likely to be encountered later in the data to be compressed, with the most commonly used strings preferably put towards the end of the dictionary. Using a dictionary is most useful when the data to be compressed is short and can be predicted with good accuracy; the data can then be compressed better than with the default empty dictionary. - Depending on the size of the compression data structures selected by + Depending on the size of the compression data structures selected by deflateInit or deflateInit2, a part of the dictionary may in effect be discarded, for example if the dictionary is larger than the window size in deflate or deflate2. Thus the strings most likely to be useful should be put at the end of the dictionary, not at the front. - Upon return of this function, strm->adler is set to the Adler32 value + Upon return of this function, strm->adler is set to the Adler32 value of the dictionary; the decompressor may later use this value to determine which dictionary has been used by the compressor. (The Adler32 value applies to the whole dictionary even if only a subset of the dictionary is actually used by the compressor.) - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a parameter is invalid (such as NULL dictionary) or the stream state is inconsistent (for example if deflate has already been called for this stream or if the compression method is bsort). deflateSetDictionary does not @@ -546,18 +546,18 @@ int deflateSetDictionary OF((z_streamp strm, */ int deflateCopy OF((z_streamp dest, - z_streamp source)); + z_streamp source)); /* - Sets the destination stream as a complete copy of the source stream. + Sets the destination stream as a complete copy of the source stream. - This function can be useful when several compression strategies will be + This function can be useful when several compression strategies will be tried, for example when there are several ways of pre-processing the input data with a filter. The streams that will be discarded should then be freed by calling deflateEnd. Note that deflateCopy duplicates the internal compression state which can be quite large, so this strategy is slow and can consume lots of memory. - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc being NULL). msg is left unchanged in both source and destination. @@ -565,20 +565,20 @@ int deflateCopy OF((z_streamp dest, int deflateReset OF((z_streamp strm)); /* - This function is equivalent to deflateEnd followed by deflateInit, + This function is equivalent to deflateEnd followed by deflateInit, but does not free and reallocate all the internal compression state. The stream will keep the same compression level and any other attributes that may have been set by deflateInit2. - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being NULL). */ int deflateParams OF((z_streamp strm, - int level, - int strategy)); + int level, + int strategy)); /* - Dynamically update the compression level and compression strategy. The + Dynamically update the compression level and compression strategy. The interpretation of level and strategy is as in deflateInit2. This can be used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different @@ -586,31 +586,31 @@ int deflateParams OF((z_streamp strm, is compressed with the old level (and may be flushed); the new level will take effect only at the next call of deflate(). - Before the call of deflateParams, the stream state must be set as for + Before the call of deflateParams, the stream state must be set as for a call of deflate(), since the currently available input may have to be compressed and flushed. In particular, strm->avail_out must be non-zero. - deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if strm->avail_out was zero. */ -/* +/* int inflateInit2 OF((z_streamp strm, - int windowBits)); + int windowBits)); - This is another version of inflateInit with an extra parameter. The + This is another version of inflateInit with an extra parameter. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. - The windowBits parameter is the base two logarithm of the maximum window + The windowBits parameter is the base two logarithm of the maximum window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. The default value is 15 if inflateInit is used instead. If a compressed stream with a larger window size is given as input, inflate() will return with the error code Z_DATA_ERROR instead of trying to allocate a larger window. - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative memLevel). msg is set to null if there is no error message. inflateInit2 does not perform any decompression apart from reading the zlib header if @@ -619,17 +619,17 @@ int inflateInit2 OF((z_streamp strm, */ int inflateSetDictionary OF((z_streamp strm, - const Byte *dictionary, - uInt dictLength)); + const Byte *dictionary, + uInt dictLength)); /* - Initializes the decompression dictionary from the given uncompressed byte + Initializes the decompression dictionary from the given uncompressed byte sequence. This function must be called immediately after a call of inflate if this call returned Z_NEED_DICT. The dictionary chosen by the compressor can be determined from the Adler32 value returned by this call of inflate. The compressor and decompressor must use exactly the same dictionary (see deflateSetDictionary). - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a parameter is invalid (such as NULL dictionary) or the stream state is inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the expected one (incorrect Adler32 value). inflateSetDictionary does not @@ -638,12 +638,12 @@ int inflateSetDictionary OF((z_streamp strm, */ int inflateSync OF((z_streamp strm)); -/* - Skips invalid compressed data until a full flush point (see above the +/* + Skips invalid compressed data until a full flush point (see above the description of deflate with Z_FULL_FLUSH) can be found, or until all available input is skipped. No output is provided. - inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR + inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the success case, the application may save the current current value of total_in which @@ -654,19 +654,19 @@ int inflateSync OF((z_streamp strm)); int inflateReset OF((z_streamp strm)); /* - This function is equivalent to inflateEnd followed by inflateInit, + This function is equivalent to inflateEnd followed by inflateInit, but does not free and reallocate all the internal decompression state. The stream will keep attributes that may have been set by inflateInit2. - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being NULL). */ - /* utility functions */ + /* utility functions */ /* - The following utility functions are implemented on top of the + The following utility functions are implemented on top of the basic stream-oriented functions. To simplify the interface, some default options are assumed (compression level and memory usage, standard memory allocation functions). The source code of these @@ -674,49 +674,49 @@ int inflateReset OF((z_streamp strm)); */ int compress OF((Byte *dest, uLong *destLen, - const Byte *source, uLong sourceLen)); + const Byte *source, uLong sourceLen)); /* - Compresses the source buffer into the destination buffer. sourceLen is + Compresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least 0.1% larger than sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. - This function can be used to compress a whole file at once if the + This function can be used to compress a whole file at once if the input file is mmap'ed. - compress returns Z_OK if success, Z_MEM_ERROR if there was not + compress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer. */ int compress2 OF((Byte *dest, uLong *destLen, - const Byte *source, uLong sourceLen, - int level)); + const Byte *source, uLong sourceLen, + int level)); /* - Compresses the source buffer into the destination buffer. The level + Compresses the source buffer into the destination buffer. The level parameter has the same meaning as in deflateInit. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least 0.1% larger than sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ int uncompress OF((Byte *dest, uLong *destLen, - const Byte *source, uLong sourceLen)); + const Byte *source, uLong sourceLen)); /* - Decompresses the source buffer into the destination buffer. sourceLen is + Decompresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be large enough to hold the entire uncompressed data. (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.) Upon exit, destLen is the actual size of the compressed buffer. - This function can be used to decompress a whole file at once if the + This function can be used to decompress a whole file at once if the input file is mmap'ed. - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, or Z_DATA_ERROR if the input data was corrupted. */ @@ -726,115 +726,115 @@ typedef voidp gzFile; gzFile gzopen OF((const char *path, const char *mode)); /* - Opens a gzip (.gz) file for reading or writing. The mode parameter + Opens a gzip (.gz) file for reading or writing. The mode parameter is as in fopen ("rb" or "wb") but can also include a compression level ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman only compression as in "wb1h". (See the description of deflateInit2 for more information about the strategy parameter.) - gzopen can be used to read a file which is not in gzip format; in this + gzopen can be used to read a file which is not in gzip format; in this case gzread will directly read from the file without decompression. - gzopen returns NULL if the file could not be opened or if there was + gzopen returns NULL if the file could not be opened or if there was insufficient memory to allocate the (de)compression state; errno can be checked to distinguish the two cases (if errno is zero, the zlib error is Z_MEM_ERROR). */ gzFile gzdopen OF((int fd, const char *mode)); /* - gzdopen() associates a gzFile with the file descriptor fd. File + gzdopen() associates a gzFile with the file descriptor fd. File descriptors are obtained from calls like open, dup, creat, pipe or fileno (in the file has been previously opened with fopen). The mode parameter is as in gzopen. - The next call of gzclose on the returned gzFile will also close the + The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd), mode) closes the file descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). - gzdopen returns NULL if there was insufficient memory to allocate + gzdopen returns NULL if there was insufficient memory to allocate the (de)compression state. */ int gzsetparams OF((gzFile file, int level, int strategy)); /* - Dynamically update the compression level or strategy. See the description + Dynamically update the compression level or strategy. See the description of deflateInit2 for the meaning of these parameters. - gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not opened for writing. */ int gzread OF((gzFile file, voidp buf, unsigned len)); /* - Reads the given number of uncompressed bytes from the compressed file. + Reads the given number of uncompressed bytes from the compressed file. If the input file was not in gzip format, gzread copies the given number of bytes into the buffer. - gzread returns the number of uncompressed bytes actually read (0 for + gzread returns the number of uncompressed bytes actually read (0 for end of file, -1 for error). */ -int gzwrite OF((gzFile file, +int gzwrite OF((gzFile file, const voidp buf, unsigned len)); /* - Writes the given number of uncompressed bytes into the compressed file. + Writes the given number of uncompressed bytes into the compressed file. gzwrite returns the number of uncompressed bytes actually written (0 in case of error). */ int gzprintf OF((gzFile file, const char *format, ...)); /* - Converts, formats, and writes the args to the compressed file under + Converts, formats, and writes the args to the compressed file under control of the format string, as in fprintf. gzprintf returns the number of uncompressed bytes actually written (0 in case of error). */ int gzputs OF((gzFile file, const char *s)); /* - Writes the given null-terminated string to the compressed file, excluding + Writes the given null-terminated string to the compressed file, excluding the terminating null character. - gzputs returns the number of characters written, or -1 in case of error. + gzputs returns the number of characters written, or -1 in case of error. */ char * gzgets OF((gzFile file, char *buf, int len)); /* - Reads bytes from the compressed file until len-1 characters are read, or + Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file condition is encountered. The string is then terminated with a null character. - gzgets returns buf, or Z_NULL in case of error. + gzgets returns buf, or Z_NULL in case of error. */ int gzputc OF((gzFile file, int c)); /* - Writes c, converted to an unsigned char, into the compressed file. + Writes c, converted to an unsigned char, into the compressed file. gzputc returns the value that was written, or -1 in case of error. */ int gzgetc OF((gzFile file)); /* - Reads one byte from the compressed file. gzgetc returns this byte + Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. */ int gzflush OF((gzFile file, int flush)); /* - Flushes all pending output into the compressed file. The parameter + Flushes all pending output into the compressed file. The parameter flush is as in the deflate() function. The return value is the zlib error number (see function gzerror below). gzflush returns Z_OK if the flush parameter is Z_FINISH and all output could be flushed. - gzflush should be called only when strictly necessary because it can + gzflush should be called only when strictly necessary because it can degrade compression. */ long gzseek OF((gzFile file, - long offset, int whence)); -/* - Sets the starting position for the next gzread or gzwrite on the + long offset, int whence)); +/* + Sets the starting position for the next gzread or gzwrite on the given compressed file. The offset represents a number of bytes in the uncompressed data stream. The whence parameter is defined as in lseek(2); the value SEEK_END is not supported. - If the file is opened for reading, this function is emulated but can be + If the file is opened for reading, this function is emulated but can be extremely slow. If the file is opened for writing, only forward seeks are supported; gzseek then compresses a sequence of zeroes up to the new starting position. - gzseek returns the resulting offset location as measured in bytes from + gzseek returns the resulting offset location as measured in bytes from the beginning of the uncompressed stream, or -1 in case of error, in particular if the file is opened for writing and the new starting position would be before the current position. @@ -842,14 +842,14 @@ long gzseek OF((gzFile file, int gzrewind OF((gzFile file)); /* - Rewinds the given file. This function is supported only for reading. + Rewinds the given file. This function is supported only for reading. gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) */ long gztell OF((gzFile file)); /* - Returns the starting position for the next gzread or gzwrite on the + Returns the starting position for the next gzread or gzwrite on the given compressed file. This position represents a number of bytes in the uncompressed data stream. @@ -858,30 +858,30 @@ long gztell OF((gzFile file)); int gzeof OF((gzFile file)); /* - Returns 1 when EOF has previously been detected reading the given + Returns 1 when EOF has previously been detected reading the given input stream, otherwise zero. */ int gzclose OF((gzFile file)); /* - Flushes all pending output if necessary, closes the compressed file + Flushes all pending output if necessary, closes the compressed file and deallocates all the (de)compression state. The return value is the zlib error number (see function gzerror below). */ const char * gzerror OF((gzFile file, int *errnum)); /* - Returns the error message for the last error which occurred on the + Returns the error message for the last error which occurred on the given compressed file. errnum is set to zlib error number. If an error occurred in the file system and not in the compression library, errnum is set to Z_ERRNO and the application may consult errno to get the exact error code. */ - /* checksum functions */ + /* checksum functions */ /* - These functions are not related to compression but are exported + These functions are not related to compression but are exported anyway because they might be useful in applications using the compression library. */ @@ -889,61 +889,61 @@ const char * gzerror OF((gzFile file, int *errnum)); uLong adler32 OF((uLong adler, const Byte *buf, uInt len)); /* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and + Update a running Adler-32 checksum with the bytes buf[0..len-1] and return the updated checksum. If buf is NULL, this function returns the required initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC32 but can be computed much faster. Usage example: - uLong adler = adler32(0L, Z_NULL, 0); + uLong adler = adler32(0L, Z_NULL, 0); - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); */ uLong crc32 OF((uLong crc, const Byte *buf, uInt len)); /* - Update a running crc with the bytes buf[0..len-1] and return the updated + Update a running crc with the bytes buf[0..len-1] and return the updated crc. If buf is NULL, this function returns the required initial value for the crc. Pre- and post-conditioning (one's complement) is performed within this function so it shouldn't be done by the application. Usage example: - uLong crc = crc32(0L, Z_NULL, 0); + uLong crc = crc32(0L, Z_NULL, 0); - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); */ - /* various hacks, don't look :) */ + /* various hacks, don't look :) */ /* deflateInit and inflateInit are macros to allow checking the zlib version * and the compiler's view of z_stream: */ int deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); + const char *version, int stream_size)); int inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); + const char *version, int stream_size)); int deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size)); + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); int inflateInit2_ OF((z_streamp strm, int windowBits, - const char *version, int stream_size)); + const char *version, int stream_size)); #define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) + deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) #define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) + inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, sizeof(z_stream)) + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, sizeof(z_stream)) #define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) + inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) const char * zError OF((int err)); @@ -963,7 +963,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ return (strm->msg = (char*)ERR_MSG(err), (err)) /* To be used only when the state is known to be valid */ - /* common constants */ + /* common constants */ #ifndef DEF_WBITS # define DEF_WBITS MAX_WBITS @@ -988,9 +988,9 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - /* target dependencies */ + /* target dependencies */ - /* Common defaults */ + /* Common defaults */ #ifndef OS_CODE # define OS_CODE 0x03 /* assume Unix */ @@ -1000,7 +1000,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ # define F_OPEN(name, mode) fopen((name), (mode)) #endif - /* functions */ + /* functions */ #ifdef HAVE_STRERROR extern char *strerror OF((int)); @@ -1038,13 +1038,13 @@ voidp zcalloc OF((voidp opaque, unsigned items, unsigned size)); void zcfree OF((voidp opaque, voidp ptr)); #define ZALLOC(strm, items, size) \ - (*((strm)->zalloc))((strm)->opaque, (items), (size)) + (*((strm)->zalloc))((strm)->opaque, (items), (size)) #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidp)(addr)) #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} #if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) && \ - !defined(CASESENSITIVITYDEFAULT_NO) + !defined(CASESENSITIVITYDEFAULT_NO) #define CASESENSITIVITYDEFAULT_NO #endif @@ -1070,7 +1070,7 @@ void zcfree OF((voidp opaque, voidp ptr)); /* =========================================================================== - Read a byte from a gz_stream; update next_in and avail_in. Return EOF + Read a byte from a gz_stream; update next_in and avail_in. Return EOF for end of file. IN assertion: the stream s has been sucessfully opened for reading. */ @@ -1078,25 +1078,25 @@ void zcfree OF((voidp opaque, voidp ptr)); /* static int unzlocal_getByte(FILE *fin,int *pi) { - unsigned char c; + unsigned char c; int err = fread(&c, 1, 1, fin); - if (err==1) - { - *pi = (int)c; - return UNZ_OK; - } - else - { - if (ferror(fin)) - return UNZ_ERRNO; - else - return UNZ_EOF; - } + if (err==1) + { + *pi = (int)c; + return UNZ_OK; + } + else + { + if (ferror(fin)) + return UNZ_ERRNO; + else + return UNZ_EOF; + } } */ /* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets + Reads a long in LSB order from the given gz_stream. Sets */ static int unzlocal_getShort (FILE* fin, uLong *pX) { @@ -1108,22 +1108,22 @@ static int unzlocal_getShort (FILE* fin, uLong *pX) return UNZ_OK; /* - uLong x ; - int i; - int err; + uLong x ; + int i; + int err; - err = unzlocal_getByte(fin,&i); - x = (uLong)i; - - if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); - x += ((uLong)i)<<8; - - if (err==UNZ_OK) - *pX = x; - else - *pX = 0; - return err; + err = unzlocal_getByte(fin,&i); + x = (uLong)i; + + if (err==UNZ_OK) + err = unzlocal_getByte(fin,&i); + x += ((uLong)i)<<8; + + if (err==UNZ_OK) + *pX = x; + else + *pX = 0; + return err; */ } @@ -1137,30 +1137,30 @@ static int unzlocal_getLong (FILE *fin, uLong *pX) return UNZ_OK; /* - uLong x ; - int i; - int err; + uLong x ; + int i; + int err; - err = unzlocal_getByte(fin,&i); - x = (uLong)i; - - if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); - x += ((uLong)i)<<8; + err = unzlocal_getByte(fin,&i); + x = (uLong)i; - if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); - x += ((uLong)i)<<16; + if (err==UNZ_OK) + err = unzlocal_getByte(fin,&i); + x += ((uLong)i)<<8; - if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); - x += ((uLong)i)<<24; - - if (err==UNZ_OK) - *pX = x; - else - *pX = 0; - return err; + if (err==UNZ_OK) + err = unzlocal_getByte(fin,&i); + x += ((uLong)i)<<16; + + if (err==UNZ_OK) + err = unzlocal_getByte(fin,&i); + x += ((uLong)i)<<24; + + if (err==UNZ_OK) + *pX = x; + else + *pX = 0; + return err; */ } @@ -1198,13 +1198,13 @@ static int strcmpcasenosensitive_internal (const char* fileName1,const char* fil #define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal #endif -/* +/* Compare two filename (fileName1,fileName2). If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi - or strcasecmp) + or strcasecmp) If iCaseSenisivity = 0, case sensitivity is defaut of your operating system - (like 1 on Unix, 2 on Windows) + (like 1 on Unix, 2 on Windows) */ extern int unzStringFileNameCompare (const char* fileName1,const char* fileName2,int iCaseSensitivity) @@ -1216,13 +1216,13 @@ extern int unzStringFileNameCompare (const char* fileName1,const char* fileName2 return strcmp(fileName1,fileName2); return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); -} +} #define BUFREADCOMMENT (0x400) /* Locate the Central directory of a zipfile (at the end, just before - the global comment) + the global comment) */ static uLong unzlocal_SearchCentralDir(FILE *fin) { @@ -1231,13 +1231,13 @@ static uLong unzlocal_SearchCentralDir(FILE *fin) uLong uBackRead; uLong uMaxBack=0xffff; /* maximum size of global comment */ uLong uPosFound=0; - + if (fseek(fin,0,SEEK_END) != 0) return 0; uSizeFile = ftell( fin ); - + if (uMaxBack>uSizeFile) uMaxBack = uSizeFile; @@ -1250,22 +1250,22 @@ static uLong unzlocal_SearchCentralDir(FILE *fin) { uLong uReadSize,uReadPos ; int i; - if (uBackRead+BUFREADCOMMENT>uMaxBack) + if (uBackRead+BUFREADCOMMENT>uMaxBack) uBackRead = uMaxBack; else uBackRead+=BUFREADCOMMENT; uReadPos = uSizeFile-uBackRead ; - - uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? - (BUFREADCOMMENT+4) : (uSizeFile-uReadPos); + + uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? + (BUFREADCOMMENT+4) : (uSizeFile-uReadPos); if (fseek(fin,uReadPos,SEEK_SET)!=0) break; if (fread(buf,(uInt)uReadSize,1,fin)!=1) break; - for (i=(int)uReadSize-3; (i--)>0;) - if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && + for (i=(int)uReadSize-3; (i--)>0;) + if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) { uPosFound = uReadPos+i; @@ -1284,7 +1284,7 @@ extern unzFile unzReOpen (const char* path, unzFile file) unz_s *s; FILE * fin; - fin=fopen(path,"rb"); + fin=fopen(path,"rb"); if (fin==NULL) return NULL; @@ -1292,18 +1292,18 @@ extern unzFile unzReOpen (const char* path, unzFile file) memcpy(s, (unz_s*)file, sizeof(unz_s)); s->file = fin; - s->pfile_in_zip_read = NULL; + s->pfile_in_zip_read = NULL; - return (unzFile)s; + return (unzFile)s; } /* Open a Zip file. path contain the full pathname (by example, - on a Windows NT computer "c:\\test\\zlib109.zip" or on an Unix computer + on a Windows NT computer "c:\\test\\zlib109.zip" or on an Unix computer "zlib/zlib109.zip". If the zipfile cannot be opened (file don't exist or in not valid), the return value is NULL. - Else, the return value is a unzFile Handle, usable with other function + Else, the return value is a unzFile Handle, usable with other function of this unzip package. */ extern unzFile unzOpen (const char* path) @@ -1313,17 +1313,17 @@ extern unzFile unzOpen (const char* path) uLong central_pos,uL; FILE * fin ; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current dist, used for spaning ZIP, unsupported, always 0*/ uLong number_disk_with_CD; /* number the the disk with central dir, used for spaning ZIP, unsupported, always 0*/ uLong number_entry_CD; /* total number of entries in - the central dir - (same than number_entry on nospan) */ + the central dir + (same than number_entry on nospan) */ int err=UNZ_OK; - fin=fopen(path,"rb"); + fin=fopen(path,"rb"); if (fin==NULL) return NULL; @@ -1363,8 +1363,8 @@ extern unzFile unzOpen (const char* path) if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK) err=UNZ_ERRNO; - /* offset of start of central directory with respect to the - starting disk number */ + /* offset of start of central directory with respect to the + starting disk number */ if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK) err=UNZ_ERRNO; @@ -1372,7 +1372,7 @@ extern unzFile unzOpen (const char* path) if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK) err=UNZ_ERRNO; - if ((central_pospfile_in_zip_read!=NULL) - unzCloseCurrentFile(file); + if (s->pfile_in_zip_read!=NULL) + unzCloseCurrentFile(file); fclose(s->file); TRYFREE(s); @@ -1437,29 +1437,29 @@ extern int unzGetGlobalInfo (unzFile file,unz_global_info *pglobal_info) */ static void unzlocal_DosDateToTmuDate (uLong ulDosDate, tm_unz* ptm) { - uLong uDate; - uDate = (uLong)(ulDosDate>>16); - ptm->tm_mday = (uInt)(uDate&0x1f) ; - ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ; - ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ; + uLong uDate; + uDate = (uLong)(ulDosDate>>16); + ptm->tm_mday = (uInt)(uDate&0x1f) ; + ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ; + ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ; - ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800); - ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ; - ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ; + ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800); + ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ; + ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ; } /* Get Info about the current file in the zipfile, with internal only info */ static int unzlocal_GetCurrentFileInfoInternal (unzFile file, - unz_file_info *pfile_info, - unz_file_info_internal - *pfile_info_internal, - char *szFileName, + unz_file_info *pfile_info, + unz_file_info_internal + *pfile_info_internal, + char *szFileName, uLong fileNameBufferSize, - void *extraField, + void *extraField, uLong extraFieldBufferSize, - char *szComment, + char *szComment, uLong commentBufferSize) { unz_s* s; @@ -1498,7 +1498,7 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file, if (unzlocal_getLong(s->file,&file_info.dosDate) != UNZ_OK) err=UNZ_ERRNO; - unzlocal_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date); + unzlocal_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date); if (unzlocal_getLong(s->file,&file_info.crc) != UNZ_OK) err=UNZ_ERRNO; @@ -1548,7 +1548,7 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file, lSeek -= uSizeRead; } - + if ((err==UNZ_OK) && (extraField!=NULL)) { uLong uSizeRead ; @@ -1568,9 +1568,9 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file, lSeek += file_info.size_file_extra - uSizeRead; } else - lSeek+=file_info.size_file_extra; + lSeek+=file_info.size_file_extra; + - if ((err==UNZ_OK) && (szComment!=NULL)) { uLong uSizeRead ; @@ -1647,7 +1647,7 @@ extern int unzGoToFirstFile (unzFile file) */ extern int unzGoToNextFile (unzFile file) { - unz_s* s; + unz_s* s; int err; if (file==NULL) @@ -1674,7 +1674,7 @@ extern int unzGoToNextFile (unzFile file) */ extern int unzGetCurrentFileInfoPosition (unzFile file, unsigned long *pos ) { - unz_s* s; + unz_s* s; if (file==NULL) return UNZ_PARAMERROR; @@ -1690,7 +1690,7 @@ extern int unzGetCurrentFileInfoPosition (unzFile file, unsigned long *pos ) */ extern int unzSetCurrentFileInfoPosition (unzFile file, unsigned long pos ) { - unz_s* s; + unz_s* s; int err; if (file==NULL) @@ -1715,10 +1715,10 @@ extern int unzSetCurrentFileInfoPosition (unzFile file, unsigned long pos ) */ extern int unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity) { - unz_s* s; + unz_s* s; int err; - + uLong num_fileSaved; uLong pos_in_central_dirSaved; @@ -1726,8 +1726,8 @@ extern int unzLocateFile (unzFile file, const char *szFileName, int iCaseSensiti if (file==NULL) return UNZ_PARAMERROR; - if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) - return UNZ_PARAMERROR; + if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) + return UNZ_PARAMERROR; s=(unz_s*)file; if (!s->current_file_ok) @@ -1759,9 +1759,9 @@ extern int unzLocateFile (unzFile file, const char *szFileName, int iCaseSensiti /* Read the static header of the current zipfile Check the coherency of the static header and info in the end of central - directory about this file + directory about this file store in *piSizeVar the size of extra info in static header - (filename and size of extra field data) + (filename and size of extra field data) */ static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar, uLong *poffset_local_extrafield, @@ -1801,9 +1801,9 @@ static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar, else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method)) err=UNZ_BADZIPFILE; - if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && - (s->cur_file_info.compression_method!=Z_DEFLATED)) - err=UNZ_BADZIPFILE; + if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && + (s->cur_file_info.compression_method!=Z_DEFLATED)) + err=UNZ_BADZIPFILE; if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */ err=UNZ_ERRNO; @@ -1811,7 +1811,7 @@ static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar, if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* crc */ err=UNZ_ERRNO; else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && - ((uFlags & 8)==0)) + ((uFlags & 8)==0)) err=UNZ_BADZIPFILE; if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size compr */ @@ -1822,7 +1822,7 @@ static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar, if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */ err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && ((uFlags & 8)==0)) err=UNZ_BADZIPFILE; @@ -1844,7 +1844,7 @@ static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar, return err; } - + /* Open for reading data the current file in the zipfile. If there is no error and the file is opened, the return value is UNZ_OK. @@ -1865,15 +1865,15 @@ extern int unzOpenCurrentFile (unzFile file) if (!s->current_file_ok) return UNZ_PARAMERROR; - if (s->pfile_in_zip_read != NULL) - unzCloseCurrentFile(file); + if (s->pfile_in_zip_read != NULL) + unzCloseCurrentFile(file); if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar, &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK) return UNZ_BADZIPFILE; pfile_in_zip_read_info = (file_in_zip_read_info_s*) - ALLOC(sizeof(file_in_zip_read_info_s)); + ALLOC(sizeof(file_in_zip_read_info_s)); if (pfile_in_zip_read_info==NULL) return UNZ_INTERNALERROR; @@ -1889,53 +1889,53 @@ extern int unzOpenCurrentFile (unzFile file) } pfile_in_zip_read_info->stream_initialised=0; - + if ((s->cur_file_info.compression_method!=0) && - (s->cur_file_info.compression_method!=Z_DEFLATED)) + (s->cur_file_info.compression_method!=Z_DEFLATED)) err=UNZ_BADZIPFILE; Store = s->cur_file_info.compression_method==0; pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc; pfile_in_zip_read_info->crc32=0; pfile_in_zip_read_info->compression_method = - s->cur_file_info.compression_method; + s->cur_file_info.compression_method; pfile_in_zip_read_info->file=s->file; pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile; - pfile_in_zip_read_info->stream.total_out = 0; + pfile_in_zip_read_info->stream.total_out = 0; if (!Store) { pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; pfile_in_zip_read_info->stream.zfree = (free_func)0; - pfile_in_zip_read_info->stream.opaque = (voidp)0; - + pfile_in_zip_read_info->stream.opaque = (voidp)0; + err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); if (err == Z_OK) - pfile_in_zip_read_info->stream_initialised=1; - /* windowBits is passed < 0 to tell that there is no zlib header. - * Note that in this case inflate *requires* an extra "dummy" byte - * after the compressed stream in order to complete decompression and - * return Z_STREAM_END. - * In unzip, i don't wait absolutely Z_STREAM_END because I known the - * size of both compressed and uncompressed data - */ + pfile_in_zip_read_info->stream_initialised=1; + /* windowBits is passed < 0 to tell that there is no zlib header. + * Note that in this case inflate *requires* an extra "dummy" byte + * after the compressed stream in order to complete decompression and + * return Z_STREAM_END. + * In unzip, i don't wait absolutely Z_STREAM_END because I known the + * size of both compressed and uncompressed data + */ } - pfile_in_zip_read_info->rest_read_compressed = - s->cur_file_info.compressed_size ; - pfile_in_zip_read_info->rest_read_uncompressed = - s->cur_file_info.uncompressed_size ; + pfile_in_zip_read_info->rest_read_compressed = + s->cur_file_info.compressed_size ; + pfile_in_zip_read_info->rest_read_uncompressed = + s->cur_file_info.uncompressed_size ; - - pfile_in_zip_read_info->pos_in_zipfile = - s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + + + pfile_in_zip_read_info->pos_in_zipfile = + s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + iSizeVar; - + pfile_in_zip_read_info->stream.avail_in = (uInt)0; s->pfile_in_zip_read = pfile_in_zip_read_info; - return UNZ_OK; + return UNZ_OK; } @@ -1947,7 +1947,7 @@ extern int unzOpenCurrentFile (unzFile file) return the number of byte copied if somes bytes are copied return 0 if the end of file was reached return <0 with error code if there is an error - (UNZ_ERRNO for IO error, or zLib error for uncompress error) + (UNZ_ERRNO for IO error, or zLib error for uncompress error) */ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len) { @@ -1958,7 +1958,7 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len) if (file==NULL) return UNZ_PARAMERROR; s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; + pfile_in_zip_read_info=s->pfile_in_zip_read; if (pfile_in_zip_read_info==NULL) return UNZ_PARAMERROR; @@ -1972,15 +1972,15 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len) pfile_in_zip_read_info->stream.next_out = (Byte*)buf; pfile_in_zip_read_info->stream.avail_out = (uInt)len; - + if (len>pfile_in_zip_read_info->rest_read_uncompressed) - pfile_in_zip_read_info->stream.avail_out = + pfile_in_zip_read_info->stream.avail_out = (uInt)pfile_in_zip_read_info->rest_read_uncompressed; while (pfile_in_zip_read_info->stream.avail_out>0) { if ((pfile_in_zip_read_info->stream.avail_in==0) && - (pfile_in_zip_read_info->rest_read_compressed>0)) + (pfile_in_zip_read_info->rest_read_compressed>0)) { uInt uReadThis = UNZ_BUFSIZE; if (pfile_in_zip_read_info->rest_read_compressedcur_file_info.compressed_size == pfile_in_zip_read_info->rest_read_compressed) if (fseek(pfile_in_zip_read_info->file, - pfile_in_zip_read_info->pos_in_zipfile + + pfile_in_zip_read_info->pos_in_zipfile + pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0) return UNZ_ERRNO; if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1, - pfile_in_zip_read_info->file)!=1) + pfile_in_zip_read_info->file)!=1) return UNZ_ERRNO; pfile_in_zip_read_info->pos_in_zipfile += uReadThis; pfile_in_zip_read_info->rest_read_compressed-=uReadThis; - - pfile_in_zip_read_info->stream.next_in = - (Byte*)pfile_in_zip_read_info->read_buffer; + + pfile_in_zip_read_info->stream.next_in = + (Byte*)pfile_in_zip_read_info->read_buffer; pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; } if (pfile_in_zip_read_info->compression_method==0) { uInt uDoCopy,i ; - if (pfile_in_zip_read_info->stream.avail_out < - pfile_in_zip_read_info->stream.avail_in) + if (pfile_in_zip_read_info->stream.avail_out < + pfile_in_zip_read_info->stream.avail_in) uDoCopy = pfile_in_zip_read_info->stream.avail_out ; else uDoCopy = pfile_in_zip_read_info->stream.avail_in ; - + for (i=0;istream.next_out+i) = - *(pfile_in_zip_read_info->stream.next_in+i); - + *(pfile_in_zip_read_info->stream.next_in+i); + pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, pfile_in_zip_read_info->stream.next_out, uDoCopy); @@ -2025,7 +2025,7 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len) pfile_in_zip_read_info->stream.avail_out -= uDoCopy; pfile_in_zip_read_info->stream.next_out += uDoCopy; pfile_in_zip_read_info->stream.next_in += uDoCopy; - pfile_in_zip_read_info->stream.total_out += uDoCopy; + pfile_in_zip_read_info->stream.total_out += uDoCopy; iRead += uDoCopy; } else @@ -2040,7 +2040,7 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len) /* if ((pfile_in_zip_read_info->rest_read_uncompressed == - pfile_in_zip_read_info->stream.avail_out) && + pfile_in_zip_read_info->stream.avail_out) && (pfile_in_zip_read_info->rest_read_compressed == 0)) flush = Z_FINISH; */ @@ -2048,19 +2048,19 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len) uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; uOutThis = uTotalOutAfter-uTotalOutBefore; - - pfile_in_zip_read_info->crc32 = - crc32(pfile_in_zip_read_info->crc32,bufBefore, - (uInt)(uOutThis)); + + pfile_in_zip_read_info->crc32 = + crc32(pfile_in_zip_read_info->crc32,bufBefore, + (uInt)(uOutThis)); pfile_in_zip_read_info->rest_read_uncompressed -= - uOutThis; + uOutThis; iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); - + if (err==Z_STREAM_END) return (iRead==0) ? UNZ_EOF : iRead; - if (err!=Z_OK) + if (err!=Z_OK) break; } } @@ -2081,7 +2081,7 @@ extern long unztell (unzFile file) if (file==NULL) return UNZ_PARAMERROR; s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; + pfile_in_zip_read_info=s->pfile_in_zip_read; if (pfile_in_zip_read_info==NULL) return UNZ_PARAMERROR; @@ -2091,7 +2091,7 @@ extern long unztell (unzFile file) /* - return 1 if the end of file was reached, 0 elsewhere + return 1 if the end of file was reached, 0 elsewhere */ extern int unzeof (unzFile file) { @@ -2100,11 +2100,11 @@ extern int unzeof (unzFile file) if (file==NULL) return UNZ_PARAMERROR; s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; + pfile_in_zip_read_info=s->pfile_in_zip_read; if (pfile_in_zip_read_info==NULL) return UNZ_PARAMERROR; - + if (pfile_in_zip_read_info->rest_read_uncompressed == 0) return 1; else @@ -2116,13 +2116,13 @@ extern int unzeof (unzFile file) /* Read extra field from the current file (opened by unzOpenCurrentFile) This is the static-header version of the extra field (sometimes, there is - more info in the static-header version than in the central-header) + more info in the static-header version than in the central-header) if buf==NULL, it return the size of the static extra field that can be read if buf!=NULL, len is the size of the buffer, the extra header is copied in buf. - the return value is the number of bytes copied in buf, or (if <0) + the return value is the number of bytes copied in buf, or (if <0) the error code */ extern int unzGetLocalExtrafield (unzFile file,void *buf,unsigned len) @@ -2135,17 +2135,17 @@ extern int unzGetLocalExtrafield (unzFile file,void *buf,unsigned len) if (file==NULL) return UNZ_PARAMERROR; s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; + pfile_in_zip_read_info=s->pfile_in_zip_read; if (pfile_in_zip_read_info==NULL) return UNZ_PARAMERROR; - size_to_read = (pfile_in_zip_read_info->size_local_extrafield - + size_to_read = (pfile_in_zip_read_info->size_local_extrafield - pfile_in_zip_read_info->pos_local_extrafield); if (buf==NULL) return (int)size_to_read; - + if (len>size_to_read) read_now = (uInt)size_to_read; else @@ -2153,9 +2153,9 @@ extern int unzGetLocalExtrafield (unzFile file,void *buf,unsigned len) if (read_now==0) return 0; - + if (fseek(pfile_in_zip_read_info->file, - pfile_in_zip_read_info->offset_local_extrafield + + pfile_in_zip_read_info->offset_local_extrafield + pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0) return UNZ_ERRNO; @@ -2178,7 +2178,7 @@ extern int unzCloseCurrentFile (unzFile file) if (file==NULL) return UNZ_PARAMERROR; s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; + pfile_in_zip_read_info=s->pfile_in_zip_read; if (pfile_in_zip_read_info==NULL) return UNZ_PARAMERROR; @@ -2199,7 +2199,7 @@ extern int unzCloseCurrentFile (unzFile file) pfile_in_zip_read_info->stream_initialised = 0; TRYFREE(pfile_in_zip_read_info); - s->pfile_in_zip_read=NULL; + s->pfile_in_zip_read=NULL; return err; } @@ -2226,11 +2226,11 @@ extern int unzGetGlobalComment (unzFile file, char *szComment, uLong uSizeBuf) return UNZ_ERRNO; if (uReadThis>0) - { - *szComment='\0'; + { + *szComment='\0'; if (fread(szComment,(uInt)uReadThis,1,s->file)!=1) return UNZ_ERRNO; - } + } if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment)) *(szComment+s->gi.size_comment)='\0'; @@ -2239,7 +2239,7 @@ extern int unzGetGlobalComment (unzFile file, char *szComment, uLong uSizeBuf) /* crc32.c -- compute the CRC-32 of a data stream * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id: unzip.c,v 1.2 1999/09/07 20:51:25 zoid Exp $ */ @@ -2285,14 +2285,14 @@ static void make_crc_table() /* make exclusive-or pattern from polynomial (0xedb88320L) */ poly = 0L; for (n = 0; n < sizeof(p)/sizeof(Byte); n++) - poly |= 1L << (31 - p[n]); - + poly |= 1L << (31 - p[n]); + for (n = 0; n < 256; n++) { - c = (uLong)n; - for (k = 0; k < 8; k++) - c = c & 1 ? poly ^ (c >> 1) : c >> 1; - crc_table[n] = c; + c = (uLong)n; + for (k = 0; k < 8; k++) + c = c & 1 ? poly ^ (c >> 1) : c >> 1; + crc_table[n] = c; } crc_table_empty = 0; } @@ -2376,26 +2376,26 @@ const uLong * get_crc_table() /* ========================================================================= */ uLong crc32(uLong crc, const Byte *buf, uInt len) { - if (buf == Z_NULL) return 0L; + if (buf == Z_NULL) return 0L; #ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); + if (crc_table_empty) + make_crc_table(); #endif - crc = crc ^ 0xffffffffL; - while (len >= 8) - { - DO8(buf); - len -= 8; - } - if (len) do { - DO1(buf); - } while (--len); - return crc ^ 0xffffffffL; + crc = crc ^ 0xffffffffL; + while (len >= 8) + { + DO8(buf); + len -= 8; + } + if (len) do { + DO1(buf); + } while (--len); + return crc ^ 0xffffffffL; } /* infblock.h -- header to use infblock.c * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is @@ -2407,31 +2407,31 @@ struct inflate_blocks_state; typedef struct inflate_blocks_state inflate_blocks_statef; extern inflate_blocks_statef * inflate_blocks_new OF(( - z_streamp z, - check_func c, /* check function */ - uInt w)); /* window size */ + z_streamp z, + check_func c, /* check function */ + uInt w)); /* window size */ extern int inflate_blocks OF(( - inflate_blocks_statef *, - z_streamp , - int)); /* initial return code */ + inflate_blocks_statef *, + z_streamp , + int)); /* initial return code */ extern void inflate_blocks_reset OF(( - inflate_blocks_statef *, - z_streamp , - uLong *)); /* check value on output */ + inflate_blocks_statef *, + z_streamp , + uLong *)); /* check value on output */ extern int inflate_blocks_free OF(( - inflate_blocks_statef *, - z_streamp)); + inflate_blocks_statef *, + z_streamp)); extern void inflate_set_dictionary OF(( - inflate_blocks_statef *s, - const Byte *d, /* dictionary */ - uInt n)); /* dictionary length */ + inflate_blocks_statef *s, + const Byte *d, /* dictionary */ + uInt n)); /* dictionary length */ extern int inflate_blocks_sync_point OF(( - inflate_blocks_statef *s)); + inflate_blocks_statef *s)); /* simplify the use of the inflate_huft type with some defines */ #define exop word.what.Exop @@ -2439,11 +2439,11 @@ extern int inflate_blocks_sync_point OF(( /* Table for deflate from PKZIP's appnote.txt. */ static const uInt border[] = { /* Order of the bit length code lengths */ - 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; /* inftrees.h -- header to use inftrees.c * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is @@ -2458,14 +2458,14 @@ typedef struct inflate_huft_s inflate_huft; struct inflate_huft_s { union { - struct { - Byte Exop; /* number of extra bits or operation */ - Byte Bits; /* number of bits in this code or subcode */ - } what; - uInt pad; /* pad structure to a power of 2 (4 bytes for */ + struct { + Byte Exop; /* number of extra bits or operation */ + Byte Bits; /* number of bits in this code or subcode */ + } what; + uInt pad; /* pad structure to a power of 2 (4 bytes for */ } word; /* 16-bit, 8 bytes for 32-bit int's) */ uInt base; /* literal, length base, distance base, - or table offset */ + or table offset */ }; /* Maximum size of dynamic tree. The maximum found in a long but non- @@ -2476,34 +2476,34 @@ struct inflate_huft_s { #define MANY 1440 extern int inflate_trees_bits OF(( - uInt *, /* 19 code lengths */ - uInt *, /* bits tree desired/actual depth */ - inflate_huft * *, /* bits tree result */ - inflate_huft *, /* space for trees */ - z_streamp)); /* for messages */ + uInt *, /* 19 code lengths */ + uInt *, /* bits tree desired/actual depth */ + inflate_huft * *, /* bits tree result */ + inflate_huft *, /* space for trees */ + z_streamp)); /* for messages */ extern int inflate_trees_dynamic OF(( - uInt, /* number of literal/length codes */ - uInt, /* number of distance codes */ - uInt *, /* that many (total) code lengths */ - uInt *, /* literal desired/actual bit depth */ - uInt *, /* distance desired/actual bit depth */ - inflate_huft * *, /* literal/length tree result */ - inflate_huft * *, /* distance tree result */ - inflate_huft *, /* space for trees */ - z_streamp)); /* for messages */ + uInt, /* number of literal/length codes */ + uInt, /* number of distance codes */ + uInt *, /* that many (total) code lengths */ + uInt *, /* literal desired/actual bit depth */ + uInt *, /* distance desired/actual bit depth */ + inflate_huft * *, /* literal/length tree result */ + inflate_huft * *, /* distance tree result */ + inflate_huft *, /* space for trees */ + z_streamp)); /* for messages */ extern int inflate_trees_fixed OF(( - uInt *, /* literal desired/actual bit depth */ - uInt *, /* distance desired/actual bit depth */ - inflate_huft * *, /* literal/length tree result */ - inflate_huft * *, /* distance tree result */ - z_streamp)); /* for memory allocation */ + uInt *, /* literal desired/actual bit depth */ + uInt *, /* distance desired/actual bit depth */ + inflate_huft * *, /* literal/length tree result */ + inflate_huft * *, /* distance tree result */ + z_streamp)); /* for memory allocation */ /* infcodes.h -- header to use infcodes.c * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is @@ -2515,22 +2515,22 @@ struct inflate_codes_state; typedef struct inflate_codes_state inflate_codes_statef; extern inflate_codes_statef *inflate_codes_new OF(( - uInt, uInt, - inflate_huft *, inflate_huft *, - z_streamp )); + uInt, uInt, + inflate_huft *, inflate_huft *, + z_streamp )); extern int inflate_codes OF(( - inflate_blocks_statef *, - z_streamp , - int)); + inflate_blocks_statef *, + z_streamp , + int)); extern void inflate_codes_free OF(( - inflate_codes_statef *, - z_streamp )); + inflate_codes_statef *, + z_streamp )); /* infutil.h -- types and macros common to blocks and codes * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is @@ -2542,16 +2542,16 @@ extern void inflate_codes_free OF(( #define _INFUTIL_H typedef enum { - TYPE, /* get type bits (3, including end bit) */ - LENS, /* get lengths for stored */ - STORED, /* processing stored block */ - TABLE, /* get table lengths */ - BTREE, /* get bit lengths tree for a dynamic block */ - DTREE, /* get length, distance trees for a dynamic block */ - CODES, /* processing fixed or dynamic block */ - DRY, /* output remaining window bytes */ - DONE, /* finished last block, done */ - BAD} /* got a data error--stuck here */ + TYPE, /* get type bits (3, including end bit) */ + LENS, /* get lengths for stored */ + STORED, /* processing stored block */ + TABLE, /* get table lengths */ + BTREE, /* get bit lengths tree for a dynamic block */ + DTREE, /* get length, distance trees for a dynamic block */ + CODES, /* processing fixed or dynamic block */ + DRY, /* output remaining window bytes */ + DONE, /* finished last block, done */ + BAD} /* got a data error--stuck here */ inflate_block_mode; /* inflate blocks semi-private state */ @@ -2562,18 +2562,18 @@ struct inflate_blocks_state { /* mode dependent information */ union { - uInt left; /* if STORED, bytes left to copy */ - struct { - uInt table; /* table lengths (14 bits) */ - uInt index; /* index into blens (or border) */ - uInt *blens; /* bit lengths of codes */ - uInt bb; /* bit length tree depth */ - inflate_huft *tb; /* bit length decoding tree */ - } trees; /* if DTREE, decoding info for trees */ - struct { - inflate_codes_statef - *codes; - } decode; /* if CODES, current state */ + uInt left; /* if STORED, bytes left to copy */ + struct { + uInt table; /* table lengths (14 bits) */ + uInt index; /* index into blens (or border) */ + uInt *blens; /* bit lengths of codes */ + uInt bb; /* bit length tree depth */ + inflate_huft *tb; /* bit length decoding tree */ + } trees; /* if DTREE, decoding info for trees */ + struct { + inflate_codes_statef + *codes; + } decode; /* if CODES, current state */ } sub; /* submode */ uInt last; /* true if this block is the last block */ @@ -2617,80 +2617,80 @@ struct inflate_blocks_state { /* masks for lower bits (size given to avoid silly warnings with Visual C++) */ static /* And'ing with mask[n] masks the lower n bits */ uInt inflate_mask[17] = { - 0x0000, - 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, - 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff + 0x0000, + 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, + 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff }; /* copy as much as possible from the sliding window to the output area */ extern int inflate_flush OF(( - inflate_blocks_statef *, - z_streamp , - int)); + inflate_blocks_statef *, + z_streamp , + int)); #endif - + /* Notes beyond the 1.93a appnote.txt: 1. Distance pointers never point before the beginning of the output - stream. + stream. 2. Distance pointers can point back across blocks, up to 32k away. 3. There is an implied maximum of 7 bits for the bit length table and - 15 bits for the actual data. + 15 bits for the actual data. 4. If only one code exists, then it is encoded using one bit. (Zero - would be more efficient, but perhaps a little confusing.) If two - codes exist, they are coded using one bit each (0 and 1). + would be more efficient, but perhaps a little confusing.) If two + codes exist, they are coded using one bit each (0 and 1). 5. There is no way of sending zero distance codes--a dummy must be - sent if there are none. (History: a pre 2.0 version of PKZIP would - store blocks with no distance codes, but this was discovered to be - too harsh a criterion.) Valid only for 1.93a. 2.04c does allow - zero distance codes, which is sent as one code of zero bits in - length. + sent if there are none. (History: a pre 2.0 version of PKZIP would + store blocks with no distance codes, but this was discovered to be + too harsh a criterion.) Valid only for 1.93a. 2.04c does allow + zero distance codes, which is sent as one code of zero bits in + length. 6. There are up to 286 literal/length codes. Code 256 represents the - end-of-block. Note however that the static length tree defines - 288 codes just to fill out the Huffman codes. Codes 286 and 287 - cannot be used though, since there is no length base or extra bits - defined for them. Similarily, there are up to 30 distance codes. - However, static trees define 32 codes (all 5 bits) to fill out the - Huffman codes, but the last two had better not show up in the data. + end-of-block. Note however that the static length tree defines + 288 codes just to fill out the Huffman codes. Codes 286 and 287 + cannot be used though, since there is no length base or extra bits + defined for them. Similarily, there are up to 30 distance codes. + However, static trees define 32 codes (all 5 bits) to fill out the + Huffman codes, but the last two had better not show up in the data. 7. Unzip can check dynamic Huffman blocks for complete code sets. - The exception is that a single code would not be complete (see #4). + The exception is that a single code would not be complete (see #4). 8. The five bits following the block type is really the number of - literal codes sent minus 257. + literal codes sent minus 257. 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits - (1+6+6). Therefore, to output three times the length, you output - three codes (1+1+1), whereas to output four times the same length, - you only need two codes (1+3). Hmm. + (1+6+6). Therefore, to output three times the length, you output + three codes (1+1+1), whereas to output four times the same length, + you only need two codes (1+3). Hmm. 10. In the tree reconstruction algorithm, Code = Code + Increment - only if BitLength(i) is not zero. (Pretty obvious.) + only if BitLength(i) is not zero. (Pretty obvious.) 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19) 12. Note: length code 284 can represent 227-258, but length code 285 - really is 258. The last length deserves its own, short code - since it gets used a lot in very redundant files. The length - 258 is special since 258 - 3 (the min match length) is 255. + really is 258. The last length deserves its own, short code + since it gets used a lot in very redundant files. The length + 258 is special since 258 - 3 (the min match length) is 255. 13. The literal/length and distance code bit lengths are read as a - single stream of lengths. It is possible (and advantageous) for - a repeat code (16, 17, or 18) to go across the boundary between - the two sets of lengths. + single stream of lengths. It is possible (and advantageous) for + a repeat code (16, 17, or 18) to go across the boundary between + the two sets of lengths. */ void inflate_blocks_reset(inflate_blocks_statef *s, z_streamp z, uLong *c) { if (c != Z_NULL) - *c = s->check; + *c = s->check; if (s->mode == BTREE || s->mode == DTREE) - ZFREE(z, s->sub.trees.blens); + ZFREE(z, s->sub.trees.blens); if (s->mode == CODES) - inflate_codes_free(s->sub.decode.codes, z); + inflate_codes_free(s->sub.decode.codes, z); s->mode = TYPE; s->bitk = 0; s->bitb = 0; s->read = s->write = s->window; if (s->checkfn != Z_NULL) - z->adler = s->check = (*s->checkfn)(0L, (const Byte *)Z_NULL, 0); + z->adler = s->check = (*s->checkfn)(0L, (const Byte *)Z_NULL, 0); Tracev(("inflate: blocks reset\n")); } @@ -2700,19 +2700,19 @@ inflate_blocks_statef *inflate_blocks_new(z_streamp z, check_func c, uInt w) inflate_blocks_statef *s; if ((s = (inflate_blocks_statef *)ZALLOC - (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL) - return s; + (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL) + return s; if ((s->hufts = - (inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL) + (inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL) { - ZFREE(z, s); - return Z_NULL; + ZFREE(z, s); + return Z_NULL; } if ((s->window = (Byte *)ZALLOC(z, 1, w)) == Z_NULL) { - ZFREE(z, s->hufts); - ZFREE(z, s); - return Z_NULL; + ZFREE(z, s->hufts); + ZFREE(z, s); + return Z_NULL; } s->end = s->window + w; s->checkfn = c; @@ -2739,77 +2739,77 @@ int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r) /* process input based on current state */ while (1) switch (s->mode) { - case TYPE: - NEEDBITS(3) - t = (uInt)b & 7; - s->last = t & 1; - switch (t >> 1) - { - case 0: /* stored */ - Tracev(("inflate: stored block%s\n", - s->last ? " (last)" : "")); - DUMPBITS(3) - t = k & 7; /* go to byte boundary */ - DUMPBITS(t) - s->mode = LENS; /* get length of stored block */ - break; - case 1: /* fixed */ - Tracev(("inflate: fixed codes block%s\n", - s->last ? " (last)" : "")); - { - uInt bl, bd; - inflate_huft *tl, *td; + case TYPE: + NEEDBITS(3) + t = (uInt)b & 7; + s->last = t & 1; + switch (t >> 1) + { + case 0: /* stored */ + Tracev(("inflate: stored block%s\n", + s->last ? " (last)" : "")); + DUMPBITS(3) + t = k & 7; /* go to byte boundary */ + DUMPBITS(t) + s->mode = LENS; /* get length of stored block */ + break; + case 1: /* fixed */ + Tracev(("inflate: fixed codes block%s\n", + s->last ? " (last)" : "")); + { + uInt bl, bd; + inflate_huft *tl, *td; - inflate_trees_fixed(&bl, &bd, &tl, &td, z); - s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z); - if (s->sub.decode.codes == Z_NULL) - { - r = Z_MEM_ERROR; - LEAVE - } - } - DUMPBITS(3) - s->mode = CODES; - break; - case 2: /* dynamic */ - Tracev(("inflate: dynamic codes block%s\n", - s->last ? " (last)" : "")); - DUMPBITS(3) - s->mode = TABLE; - break; - case 3: /* illegal */ - DUMPBITS(3) - s->mode = BAD; - z->msg = (char*)"invalid block type"; - r = Z_DATA_ERROR; - LEAVE - } - break; - case LENS: - NEEDBITS(32) - if ((((~b) >> 16) & 0xffff) != (b & 0xffff)) - { - s->mode = BAD; - z->msg = (char*)"invalid stored block lengths"; - r = Z_DATA_ERROR; - LEAVE - } - s->sub.left = (uInt)b & 0xffff; - b = k = 0; /* dump bits */ - Tracev(("inflate: stored length %u\n", s->sub.left)); - s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE); - break; - case STORED: - if (n == 0) - LEAVE - NEEDOUT - t = s->sub.left; - if (t > n) t = n; - if (t > m) t = m; + inflate_trees_fixed(&bl, &bd, &tl, &td, z); + s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z); + if (s->sub.decode.codes == Z_NULL) + { + r = Z_MEM_ERROR; + LEAVE + } + } + DUMPBITS(3) + s->mode = CODES; + break; + case 2: /* dynamic */ + Tracev(("inflate: dynamic codes block%s\n", + s->last ? " (last)" : "")); + DUMPBITS(3) + s->mode = TABLE; + break; + case 3: /* illegal */ + DUMPBITS(3) + s->mode = BAD; + z->msg = (char*)"invalid block type"; + r = Z_DATA_ERROR; + LEAVE + } + break; + case LENS: + NEEDBITS(32) + if ((((~b) >> 16) & 0xffff) != (b & 0xffff)) + { + s->mode = BAD; + z->msg = (char*)"invalid stored block lengths"; + r = Z_DATA_ERROR; + LEAVE + } + s->sub.left = (uInt)b & 0xffff; + b = k = 0; /* dump bits */ + Tracev(("inflate: stored length %u\n", s->sub.left)); + s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE); + break; + case STORED: + if (n == 0) + LEAVE + NEEDOUT + t = s->sub.left; + if (t > n) t = n; + if (t > m) t = m; #ifdef MACOS_X // Optimization if (t>64) { zmemcpy(q, p, t); - } + } else { int t1; for (t1=0; t1sub.left -= t) != 0) - break; - Tracev(("inflate: stored end, %lu total out\n", - z->total_out + (q >= s->read ? q - s->read : - (s->end - s->read) + (q - s->window)))); - s->mode = s->last ? DRY : TYPE; - break; - case TABLE: - NEEDBITS(14) - s->sub.trees.table = t = (uInt)b & 0x3fff; + p += t; n -= t; + q += t; m -= t; + if ((s->sub.left -= t) != 0) + break; + Tracev(("inflate: stored end, %lu total out\n", + z->total_out + (q >= s->read ? q - s->read : + (s->end - s->read) + (q - s->window)))); + s->mode = s->last ? DRY : TYPE; + break; + case TABLE: + NEEDBITS(14) + s->sub.trees.table = t = (uInt)b & 0x3fff; #ifndef PKZIP_BUG_WORKAROUND - if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29) - { - s->mode = BAD; - z->msg = (char*)"too many length or distance symbols"; - r = Z_DATA_ERROR; - LEAVE - } + if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29) + { + s->mode = BAD; + z->msg = (char*)"too many length or distance symbols"; + r = Z_DATA_ERROR; + LEAVE + } #endif - t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f); - if ((s->sub.trees.blens = (uInt*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL) - { - r = Z_MEM_ERROR; - LEAVE - } - DUMPBITS(14) - s->sub.trees.index = 0; - Tracev(("inflate: table sizes ok\n")); - s->mode = BTREE; - case BTREE: - while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10)) - { - NEEDBITS(3) - s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7; - DUMPBITS(3) - } - while (s->sub.trees.index < 19) - s->sub.trees.blens[border[s->sub.trees.index++]] = 0; - s->sub.trees.bb = 7; - t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb, - &s->sub.trees.tb, s->hufts, z); - if (t != Z_OK) - { - ZFREE(z, s->sub.trees.blens); - r = t; - if (r == Z_DATA_ERROR) - s->mode = BAD; - LEAVE - } - s->sub.trees.index = 0; - Tracev(("inflate: bits tree ok\n")); - s->mode = DTREE; - case DTREE: - while (t = s->sub.trees.table, - s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f)) - { - inflate_huft *h; - uInt i, j, c; + t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f); + if ((s->sub.trees.blens = (uInt*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL) + { + r = Z_MEM_ERROR; + LEAVE + } + DUMPBITS(14) + s->sub.trees.index = 0; + Tracev(("inflate: table sizes ok\n")); + s->mode = BTREE; + case BTREE: + while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10)) + { + NEEDBITS(3) + s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7; + DUMPBITS(3) + } + while (s->sub.trees.index < 19) + s->sub.trees.blens[border[s->sub.trees.index++]] = 0; + s->sub.trees.bb = 7; + t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb, + &s->sub.trees.tb, s->hufts, z); + if (t != Z_OK) + { + ZFREE(z, s->sub.trees.blens); + r = t; + if (r == Z_DATA_ERROR) + s->mode = BAD; + LEAVE + } + s->sub.trees.index = 0; + Tracev(("inflate: bits tree ok\n")); + s->mode = DTREE; + case DTREE: + while (t = s->sub.trees.table, + s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f)) + { + inflate_huft *h; + uInt i, j, c; - t = s->sub.trees.bb; - NEEDBITS(t) - h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]); - t = h->bits; - c = h->base; - if (c < 16) - { - DUMPBITS(t) - s->sub.trees.blens[s->sub.trees.index++] = c; - } - else /* c == 16..18 */ - { - i = c == 18 ? 7 : c - 14; - j = c == 18 ? 11 : 3; - NEEDBITS(t + i) - DUMPBITS(t) - j += (uInt)b & inflate_mask[i]; - DUMPBITS(i) - i = s->sub.trees.index; - t = s->sub.trees.table; - if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) || - (c == 16 && i < 1)) - { - ZFREE(z, s->sub.trees.blens); - s->mode = BAD; - z->msg = (char*)"invalid bit length repeat"; - r = Z_DATA_ERROR; - LEAVE - } - c = c == 16 ? s->sub.trees.blens[i - 1] : 0; - do { - s->sub.trees.blens[i++] = c; - } while (--j); - s->sub.trees.index = i; - } - } - s->sub.trees.tb = Z_NULL; - { - uInt bl, bd; - inflate_huft *tl, *td; - inflate_codes_statef *c; + t = s->sub.trees.bb; + NEEDBITS(t) + h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]); + t = h->bits; + c = h->base; + if (c < 16) + { + DUMPBITS(t) + s->sub.trees.blens[s->sub.trees.index++] = c; + } + else /* c == 16..18 */ + { + i = c == 18 ? 7 : c - 14; + j = c == 18 ? 11 : 3; + NEEDBITS(t + i) + DUMPBITS(t) + j += (uInt)b & inflate_mask[i]; + DUMPBITS(i) + i = s->sub.trees.index; + t = s->sub.trees.table; + if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) || + (c == 16 && i < 1)) + { + ZFREE(z, s->sub.trees.blens); + s->mode = BAD; + z->msg = (char*)"invalid bit length repeat"; + r = Z_DATA_ERROR; + LEAVE + } + c = c == 16 ? s->sub.trees.blens[i - 1] : 0; + do { + s->sub.trees.blens[i++] = c; + } while (--j); + s->sub.trees.index = i; + } + } + s->sub.trees.tb = Z_NULL; + { + uInt bl, bd; + inflate_huft *tl, *td; + inflate_codes_statef *c; - bl = 9; /* must be <= 9 for lookahead assumptions */ - bd = 6; /* must be <= 9 for lookahead assumptions */ - t = s->sub.trees.table; - t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f), - s->sub.trees.blens, &bl, &bd, &tl, &td, - s->hufts, z); - ZFREE(z, s->sub.trees.blens); - if (t != Z_OK) - { - if (t == (uInt)Z_DATA_ERROR) - s->mode = BAD; - r = t; - LEAVE - } - Tracev(("inflate: trees ok\n")); - if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL) - { - r = Z_MEM_ERROR; - LEAVE - } - s->sub.decode.codes = c; - } - s->mode = CODES; - case CODES: - UPDATE - if ((r = inflate_codes(s, z, r)) != Z_STREAM_END) - return inflate_flush(s, z, r); - r = Z_OK; - inflate_codes_free(s->sub.decode.codes, z); - LOAD - Tracev(("inflate: codes end, %lu total out\n", - z->total_out + (q >= s->read ? q - s->read : - (s->end - s->read) + (q - s->window)))); - if (!s->last) - { - s->mode = TYPE; - break; - } - s->mode = DRY; - case DRY: - FLUSH - if (s->read != s->write) - LEAVE - s->mode = DONE; - case DONE: - r = Z_STREAM_END; - LEAVE - case BAD: - r = Z_DATA_ERROR; - LEAVE - default: - r = Z_STREAM_ERROR; - LEAVE + bl = 9; /* must be <= 9 for lookahead assumptions */ + bd = 6; /* must be <= 9 for lookahead assumptions */ + t = s->sub.trees.table; + t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f), + s->sub.trees.blens, &bl, &bd, &tl, &td, + s->hufts, z); + ZFREE(z, s->sub.trees.blens); + if (t != Z_OK) + { + if (t == (uInt)Z_DATA_ERROR) + s->mode = BAD; + r = t; + LEAVE + } + Tracev(("inflate: trees ok\n")); + if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL) + { + r = Z_MEM_ERROR; + LEAVE + } + s->sub.decode.codes = c; + } + s->mode = CODES; + case CODES: + UPDATE + if ((r = inflate_codes(s, z, r)) != Z_STREAM_END) + return inflate_flush(s, z, r); + r = Z_OK; + inflate_codes_free(s->sub.decode.codes, z); + LOAD + Tracev(("inflate: codes end, %lu total out\n", + z->total_out + (q >= s->read ? q - s->read : + (s->end - s->read) + (q - s->window)))); + if (!s->last) + { + s->mode = TYPE; + break; + } + s->mode = DRY; + case DRY: + FLUSH + if (s->read != s->write) + LEAVE + s->mode = DONE; + case DONE: + r = Z_STREAM_END; + LEAVE + case BAD: + r = Z_DATA_ERROR; + LEAVE + default: + r = Z_STREAM_ERROR; + LEAVE } } @@ -2998,7 +2998,7 @@ void inflate_set_dictionary(inflate_blocks_statef *s, const Byte *d, uInt n) /* Returns true if inflate is currently at the end of a block generated - * by Z_SYNC_FLUSH or Z_FULL_FLUSH. + * by Z_SYNC_FLUSH or Z_FULL_FLUSH. * IN assertion: s != Z_NULL */ int inflate_blocks_sync_point(inflate_blocks_statef *s) @@ -3028,7 +3028,7 @@ int inflate_flush(inflate_blocks_statef *s, z_streamp z, int r) /* update check information */ if (s->checkfn != Z_NULL) - z->adler = s->check = (*s->checkfn)(s->check, q, n); + z->adler = s->check = (*s->checkfn)(s->check, q, n); /* copy as as end of window */ #ifdef MACOS_X // Optimization @@ -3050,25 +3050,25 @@ int inflate_flush(inflate_blocks_statef *s, z_streamp z, int r) /* see if more to copy at beginning of window */ if (q == s->end) { - /* wrap pointers */ - q = s->window; - if (s->write == s->end) - s->write = s->window; + /* wrap pointers */ + q = s->window; + if (s->write == s->end) + s->write = s->window; - /* compute bytes to copy */ - n = (uInt)(s->write - q); - if (n > z->avail_out) n = z->avail_out; - if (n && r == Z_BUF_ERROR) r = Z_OK; + /* compute bytes to copy */ + n = (uInt)(s->write - q); + if (n > z->avail_out) n = z->avail_out; + if (n && r == Z_BUF_ERROR) r = Z_OK; - /* update counters */ - z->avail_out -= n; - z->total_out += n; + /* update counters */ + z->avail_out -= n; + z->total_out += n; - /* update check information */ - if (s->checkfn != Z_NULL) - z->adler = s->check = (*s->checkfn)(s->check, q, n); + /* update check information */ + if (s->checkfn != Z_NULL) + z->adler = s->check = (*s->checkfn)(s->check, q, n); - /* copy */ + /* copy */ #ifdef MACOS_X // Optimization if (n>64) { zmemcpy(p, q, n); @@ -3080,10 +3080,10 @@ int inflate_flush(inflate_blocks_statef *s, z_streamp z, int r) } } #else - zmemcpy(p, q, n); + zmemcpy(p, q, n); #endif - p += n; - q += n; + p += n; + q += n; } /* update pointers */ @@ -3096,7 +3096,7 @@ int inflate_flush(inflate_blocks_statef *s, z_streamp z, int r) /* inftrees.c -- generate Huffman trees for efficient decoding * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ const char inflate_copyright[] = @@ -3114,33 +3114,33 @@ const char inflate_copyright[] = static int huft_build OF(( - uInt *, /* code lengths in bits */ - uInt, /* number of codes */ - uInt, /* number of "simple" codes */ - const uInt *, /* list of base values for non-simple codes */ - const uInt *, /* list of extra bits for non-simple codes */ - inflate_huft **, /* result: starting table */ - uInt *, /* maximum lookup bits (returns actual) */ - inflate_huft *, /* space for trees */ - uInt *, /* hufts used in space */ - uInt * )); /* space for values */ + uInt *, /* code lengths in bits */ + uInt, /* number of codes */ + uInt, /* number of "simple" codes */ + const uInt *, /* list of base values for non-simple codes */ + const uInt *, /* list of extra bits for non-simple codes */ + inflate_huft **, /* result: starting table */ + uInt *, /* maximum lookup bits (returns actual) */ + inflate_huft *, /* space for trees */ + uInt *, /* hufts used in space */ + uInt * )); /* space for values */ /* Tables for deflate from PKZIP's appnote.txt. */ static const uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; - /* see note #13 above about 258 */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; + /* see note #13 above about 258 */ static const uInt cplext[31] = { /* Extra bits for literal codes 257..285 */ - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, - 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112}; /* 112==invalid */ + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, + 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112}; /* 112==invalid */ static const uInt cpdist[30] = { /* Copy offsets for distance codes 0..29 */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577}; + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577}; static const uInt cpdext[30] = { /* Extra bits for distance codes */ - 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, - 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, - 12, 12, 13, 13}; + 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, + 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, + 12, 12, 13, 13}; /* Huffman code decoding is performed using a multi-level table lookup. @@ -3225,39 +3225,39 @@ static int huft_build(uInt *b, uInt n, uInt s, const uInt *d, const uInt *e, inf C4 /* clear c[]--assume BMAX+1 is 16 */ p = b; i = n; do { - c[*p++]++; /* assume all entries <= BMAX */ + c[*p++]++; /* assume all entries <= BMAX */ } while (--i); if (c[0] == n) /* null input--all zero length codes */ { - *t = (inflate_huft *)Z_NULL; - *m = 0; - return Z_OK; + *t = (inflate_huft *)Z_NULL; + *m = 0; + return Z_OK; } /* Find minimum and maximum length, bound *m by those */ l = *m; for (j = 1; j <= BMAX; j++) - if (c[j]) - break; + if (c[j]) + break; k = j; /* minimum code length */ if ((uInt)l < j) - l = j; + l = j; for (i = BMAX; i; i--) - if (c[i]) - break; + if (c[i]) + break; g = i; /* maximum code length */ if ((uInt)l > i) - l = i; + l = i; *m = l; /* Adjust last length count to fill out codes, if needed */ for (y = 1 << j; j < i; j++, y <<= 1) - if ((y -= c[j]) < 0) - return Z_DATA_ERROR; + if ((y -= c[j]) < 0) + return Z_DATA_ERROR; if ((y -= c[i]) < 0) - return Z_DATA_ERROR; + return Z_DATA_ERROR; c[i] += y; @@ -3265,15 +3265,15 @@ static int huft_build(uInt *b, uInt n, uInt s, const uInt *d, const uInt *e, inf x[1] = j = 0; p = c + 1; xp = x + 2; while (--i) { /* note that i == g from above */ - *xp++ = (j += *p++); + *xp++ = (j += *p++); } /* Make a table of values in order of bit lengths */ p = b; i = 0; do { - if ((j = *p++) != 0) - v[x[j]++] = i; + if ((j = *p++) != 0) + v[x[j]++] = i; } while (++i < n); n = x[g]; /* set n to length of v */ @@ -3290,87 +3290,87 @@ static int huft_build(uInt *b, uInt n, uInt s, const uInt *d, const uInt *e, inf /* go through the bit lengths (k already is bits in shortest code) */ for (; k <= g; k++) { - a = c[k]; - while (a--) - { - /* here i is the Huffman code of length k bits for value *p */ - /* make tables up to required level */ - while (k > w + l) - { - h++; - w += l; /* previous table always l bits */ + a = c[k]; + while (a--) + { + /* here i is the Huffman code of length k bits for value *p */ + /* make tables up to required level */ + while (k > w + l) + { + h++; + w += l; /* previous table always l bits */ - /* compute minimum size table less than or equal to l bits */ - z = g - w; - z = z > (uInt)l ? l : z; /* table size upper limit */ - if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ - { /* too few codes for k-w bit table */ - f -= a + 1; /* deduct codes from patterns left */ - xp = c + k; - if (j < z) - while (++j < z) /* try smaller tables up to z bits */ - { - if ((f <<= 1) <= *++xp) - break; /* enough codes to use up j bits */ - f -= *xp; /* else deduct codes from patterns */ - } - } - z = 1 << j; /* table entries for j-bit table */ + /* compute minimum size table less than or equal to l bits */ + z = g - w; + z = z > (uInt)l ? l : z; /* table size upper limit */ + if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ + { /* too few codes for k-w bit table */ + f -= a + 1; /* deduct codes from patterns left */ + xp = c + k; + if (j < z) + while (++j < z) /* try smaller tables up to z bits */ + { + if ((f <<= 1) <= *++xp) + break; /* enough codes to use up j bits */ + f -= *xp; /* else deduct codes from patterns */ + } + } + z = 1 << j; /* table entries for j-bit table */ - /* allocate new table */ - if (*hn + z > MANY) /* (note: doesn't matter for fixed) */ - return Z_MEM_ERROR; /* not enough memory */ - u[h] = q = hp + *hn; - *hn += z; + /* allocate new table */ + if (*hn + z > MANY) /* (note: doesn't matter for fixed) */ + return Z_MEM_ERROR; /* not enough memory */ + u[h] = q = hp + *hn; + *hn += z; - /* connect to last table, if there is one */ - if (h) - { - x[h] = i; /* save pattern for backing up */ - r.bits = (Byte)l; /* bits to dump before this table */ - r.exop = (Byte)j; /* bits in this table */ - j = i >> (w - l); - r.base = (uInt)(q - u[h-1] - j); /* offset to this table */ - u[h-1][j] = r; /* connect to last table */ - } - else - *t = q; /* first table is returned result */ - } + /* connect to last table, if there is one */ + if (h) + { + x[h] = i; /* save pattern for backing up */ + r.bits = (Byte)l; /* bits to dump before this table */ + r.exop = (Byte)j; /* bits in this table */ + j = i >> (w - l); + r.base = (uInt)(q - u[h-1] - j); /* offset to this table */ + u[h-1][j] = r; /* connect to last table */ + } + else + *t = q; /* first table is returned result */ + } - /* set up table entry in r */ - r.bits = (Byte)(k - w); - if (p >= v + n) - r.exop = 128 + 64; /* out of values--invalid code */ - else if (*p < s) - { - r.exop = (Byte)(*p < 256 ? 0 : 32 + 64); /* 256 is end-of-block */ - r.base = *p++; /* simple code is just the value */ - } - else - { - r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */ - r.base = d[*p++ - s]; - } + /* set up table entry in r */ + r.bits = (Byte)(k - w); + if (p >= v + n) + r.exop = 128 + 64; /* out of values--invalid code */ + else if (*p < s) + { + r.exop = (Byte)(*p < 256 ? 0 : 32 + 64); /* 256 is end-of-block */ + r.base = *p++; /* simple code is just the value */ + } + else + { + r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */ + r.base = d[*p++ - s]; + } - /* fill code-like entries with r */ - f = 1 << (k - w); - for (j = i >> w; j < z; j += f) - q[j] = r; + /* fill code-like entries with r */ + f = 1 << (k - w); + for (j = i >> w; j < z; j += f) + q[j] = r; - /* backwards increment the k-bit code i */ - for (j = 1 << (k - 1); i & j; j >>= 1) - i ^= j; - i ^= j; + /* backwards increment the k-bit code i */ + for (j = 1 << (k - 1); i & j; j >>= 1) + i ^= j; + i ^= j; - /* backup over finished tables */ - mask = (1 << w) - 1; /* needed on HP, cc -O bug */ - while ((i & mask) != x[h]) - { - h--; /* don't need to update q */ - w -= l; - mask = (1 << w) - 1; - } - } + /* backup over finished tables */ + mask = (1 << w) - 1; /* needed on HP, cc -O bug */ + while ((i & mask) != x[h]) + { + h--; /* don't need to update q */ + w -= l; + mask = (1 << w) - 1; + } + } } @@ -3391,15 +3391,15 @@ int inflate_trees_bits(uInt *c, uInt *bb, inflate_huft * *tb, inflate_huft *hp, uInt *v; /* work area for huft_build */ if ((v = (uInt*)ZALLOC(z, 19, sizeof(uInt))) == Z_NULL) - return Z_MEM_ERROR; + return Z_MEM_ERROR; r = huft_build(c, 19, 19, (uInt*)Z_NULL, (uInt*)Z_NULL, - tb, bb, hp, &hn, v); + tb, bb, hp, &hn, v); if (r == Z_DATA_ERROR) - z->msg = (char*)"oversubscribed dynamic bit lengths tree"; + z->msg = (char*)"oversubscribed dynamic bit lengths tree"; else if (r == Z_BUF_ERROR || *bb == 0) { - z->msg = (char*)"incomplete dynamic bit lengths tree"; - r = Z_DATA_ERROR; + z->msg = (char*)"incomplete dynamic bit lengths tree"; + r = Z_DATA_ERROR; } ZFREE(z, v); return r; @@ -3423,44 +3423,44 @@ int inflate_trees_dynamic(uInt nl, uInt nd, uInt *c, uInt *bl, uInt *bd, inflate /* allocate work area */ if ((v = (uInt*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL) - return Z_MEM_ERROR; + return Z_MEM_ERROR; /* build literal/length tree */ r = huft_build(c, nl, 257, cplens, cplext, tl, bl, hp, &hn, v); if (r != Z_OK || *bl == 0) { - if (r == Z_DATA_ERROR) - z->msg = (char*)"oversubscribed literal/length tree"; - else if (r != Z_MEM_ERROR) - { - z->msg = (char*)"incomplete literal/length tree"; - r = Z_DATA_ERROR; - } - ZFREE(z, v); - return r; + if (r == Z_DATA_ERROR) + z->msg = (char*)"oversubscribed literal/length tree"; + else if (r != Z_MEM_ERROR) + { + z->msg = (char*)"incomplete literal/length tree"; + r = Z_DATA_ERROR; + } + ZFREE(z, v); + return r; } /* build distance tree */ r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, hp, &hn, v); if (r != Z_OK || (*bd == 0 && nl > 257)) { - if (r == Z_DATA_ERROR) - z->msg = (char*)"oversubscribed distance tree"; - else if (r == Z_BUF_ERROR) { + if (r == Z_DATA_ERROR) + z->msg = (char*)"oversubscribed distance tree"; + else if (r == Z_BUF_ERROR) { #ifdef PKZIP_BUG_WORKAROUND - r = Z_OK; - } + r = Z_OK; + } #else - z->msg = (char*)"incomplete distance tree"; - r = Z_DATA_ERROR; - } - else if (r != Z_MEM_ERROR) - { - z->msg = (char*)"empty distance tree with lengths"; - r = Z_DATA_ERROR; - } - ZFREE(z, v); - return r; + z->msg = (char*)"incomplete distance tree"; + r = Z_DATA_ERROR; + } + else if (r != Z_MEM_ERROR) + { + z->msg = (char*)"empty distance tree with lengths"; + r = Z_DATA_ERROR; + } + ZFREE(z, v); + return r; #endif } @@ -3481,144 +3481,144 @@ int inflate_trees_dynamic(uInt nl, uInt nd, uInt *c, uInt *bl, uInt *bd, inflate static uInt fixed_bl = 9; static uInt fixed_bd = 5; static inflate_huft fixed_tl[] = { - {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115}, - {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192}, - {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160}, - {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},224}, - {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144}, - {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208}, - {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176}, - {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},240}, - {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227}, - {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200}, - {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168}, - {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232}, - {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},152}, - {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},216}, - {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184}, - {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248}, - {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163}, - {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},196}, - {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},164}, - {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228}, - {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148}, - {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212}, - {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},180}, - {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},244}, - {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0}, - {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204}, - {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172}, - {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},236}, - {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},156}, - {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220}, - {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188}, - {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252}, - {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131}, - {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},194}, - {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162}, - {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226}, - {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146}, - {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},210}, - {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},178}, - {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242}, - {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258}, - {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202}, - {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},170}, - {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},234}, - {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154}, - {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218}, - {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186}, - {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},250}, - {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195}, - {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198}, - {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166}, - {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230}, - {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},150}, - {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},214}, - {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182}, - {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246}, - {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0}, - {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},206}, - {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},174}, - {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238}, - {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158}, - {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222}, - {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},190}, - {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},254}, - {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115}, - {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193}, - {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161}, - {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},225}, - {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},145}, - {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209}, - {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177}, - {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241}, - {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227}, - {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},201}, - {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169}, - {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233}, - {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153}, - {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},217}, - {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},185}, - {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249}, - {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163}, - {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197}, - {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},165}, - {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},229}, - {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149}, - {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213}, - {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181}, - {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},245}, - {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0}, - {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205}, - {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173}, - {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237}, - {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},157}, - {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},221}, - {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189}, - {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253}, - {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131}, - {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},195}, - {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},163}, - {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227}, - {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147}, - {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211}, - {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},179}, - {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},243}, - {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258}, - {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203}, - {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171}, - {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},235}, - {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},155}, - {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219}, - {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187}, - {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251}, - {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195}, - {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},199}, - {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167}, - {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231}, - {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151}, - {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},215}, - {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},183}, - {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247}, - {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0}, - {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207}, - {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},175}, - {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},239}, - {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159}, - {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223}, - {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191}, - {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255} + {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115}, + {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192}, + {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160}, + {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},224}, + {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144}, + {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208}, + {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176}, + {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},240}, + {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227}, + {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200}, + {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168}, + {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232}, + {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},152}, + {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},216}, + {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184}, + {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248}, + {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163}, + {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},196}, + {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},164}, + {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228}, + {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148}, + {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212}, + {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},180}, + {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},244}, + {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0}, + {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204}, + {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172}, + {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},236}, + {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},156}, + {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220}, + {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188}, + {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252}, + {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131}, + {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},194}, + {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162}, + {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226}, + {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146}, + {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},210}, + {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},178}, + {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242}, + {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258}, + {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202}, + {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},170}, + {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},234}, + {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154}, + {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218}, + {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186}, + {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},250}, + {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195}, + {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198}, + {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166}, + {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230}, + {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},150}, + {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},214}, + {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182}, + {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246}, + {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0}, + {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},206}, + {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},174}, + {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238}, + {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158}, + {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222}, + {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},190}, + {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},254}, + {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115}, + {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193}, + {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161}, + {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},225}, + {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},145}, + {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209}, + {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177}, + {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241}, + {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227}, + {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},201}, + {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169}, + {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233}, + {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153}, + {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},217}, + {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},185}, + {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249}, + {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163}, + {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197}, + {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},165}, + {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},229}, + {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149}, + {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213}, + {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181}, + {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},245}, + {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0}, + {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205}, + {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173}, + {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237}, + {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},157}, + {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},221}, + {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189}, + {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253}, + {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131}, + {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},195}, + {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},163}, + {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227}, + {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147}, + {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211}, + {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},179}, + {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},243}, + {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258}, + {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203}, + {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171}, + {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},235}, + {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},155}, + {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219}, + {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187}, + {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251}, + {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195}, + {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},199}, + {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167}, + {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231}, + {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151}, + {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},215}, + {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},183}, + {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247}, + {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0}, + {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207}, + {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},175}, + {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},239}, + {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159}, + {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223}, + {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191}, + {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255} }; static inflate_huft fixed_td[] = { - {{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097}, - {{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385}, - {{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193}, - {{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{192,5}},24577}, - {{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145}, - {{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577}, - {{{80,5}},4}, {{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289}, - {{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577} + {{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097}, + {{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385}, + {{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193}, + {{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{192,5}},24577}, + {{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145}, + {{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577}, + {{{80,5}},4}, {{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289}, + {{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577} }; int inflate_trees_fixed(uInt *bl, uInt *bd, inflate_huft * *tl, inflate_huft * *td, z_streamp z) @@ -3673,112 +3673,112 @@ int inflate_fast(uInt bl, uInt bd, inflate_huft *tl, inflate_huft *td, inflate_b /* do until not enough input or output space for fast loop */ do { /* assume called with m >= 258 && n >= 10 */ - /* get literal/length code */ - GRABBITS(20) /* max bits for literal/length code */ - if ((e = (t = tl + ((uInt)b & ml))->exop) == 0) - { - DUMPBITS(t->bits) - Tracevv((t->base >= 0x20 && t->base < 0x7f ? - "inflate: * literal '%c'\n" : - "inflate: * literal 0x%02x\n", t->base)); - *q++ = (Byte)t->base; - m--; - continue; - } - do { - DUMPBITS(t->bits) - if (e & 16) - { - /* get extra bits for length */ - e &= 15; - c = t->base + ((uInt)b & inflate_mask[e]); - DUMPBITS(e) - Tracevv(("inflate: * length %u\n", c)); + /* get literal/length code */ + GRABBITS(20) /* max bits for literal/length code */ + if ((e = (t = tl + ((uInt)b & ml))->exop) == 0) + { + DUMPBITS(t->bits) + Tracevv((t->base >= 0x20 && t->base < 0x7f ? + "inflate: * literal '%c'\n" : + "inflate: * literal 0x%02x\n", t->base)); + *q++ = (Byte)t->base; + m--; + continue; + } + do { + DUMPBITS(t->bits) + if (e & 16) + { + /* get extra bits for length */ + e &= 15; + c = t->base + ((uInt)b & inflate_mask[e]); + DUMPBITS(e) + Tracevv(("inflate: * length %u\n", c)); - /* decode distance base of block to copy */ - GRABBITS(15); /* max bits for distance code */ - e = (t = td + ((uInt)b & md))->exop; - do { - DUMPBITS(t->bits) - if (e & 16) - { - /* get extra bits to add to distance base */ - e &= 15; - GRABBITS(e) /* get extra bits (up to 13) */ - d = t->base + ((uInt)b & inflate_mask[e]); - DUMPBITS(e) - Tracevv(("inflate: * distance %u\n", d)); + /* decode distance base of block to copy */ + GRABBITS(15); /* max bits for distance code */ + e = (t = td + ((uInt)b & md))->exop; + do { + DUMPBITS(t->bits) + if (e & 16) + { + /* get extra bits to add to distance base */ + e &= 15; + GRABBITS(e) /* get extra bits (up to 13) */ + d = t->base + ((uInt)b & inflate_mask[e]); + DUMPBITS(e) + Tracevv(("inflate: * distance %u\n", d)); - /* do the copy */ - m -= c; - if ((uInt)(q - s->window) >= d) /* offset before dest */ - { /* just copy */ - r = q - d; - *q++ = *r++; c--; /* minimum count is three, */ - *q++ = *r++; c--; /* so unroll loop a little */ - } - else /* else offset after destination */ - { - e = d - (uInt)(q - s->window); /* bytes from offset to end */ - r = s->end - e; /* pointer to offset */ - if (c > e) /* if source crosses, */ - { - c -= e; /* copy to end of window */ - do { - *q++ = *r++; - } while (--e); - r = s->window; /* copy rest from start of window */ - } - } - do { /* copy all or what's left */ - *q++ = *r++; - } while (--c); - break; - } - else if ((e & 64) == 0) - { - t += t->base; - e = (t += ((uInt)b & inflate_mask[e]))->exop; - } - else - { - z->msg = (char*)"invalid distance code"; - UNGRAB - UPDATE - return Z_DATA_ERROR; - } - } while (1); - break; - } - if ((e & 64) == 0) - { - t += t->base; - if ((e = (t += ((uInt)b & inflate_mask[e]))->exop) == 0) - { - DUMPBITS(t->bits) - Tracevv((t->base >= 0x20 && t->base < 0x7f ? - "inflate: * literal '%c'\n" : - "inflate: * literal 0x%02x\n", t->base)); - *q++ = (Byte)t->base; - m--; - break; - } - } - else if (e & 32) - { - Tracevv(("inflate: * end of block\n")); - UNGRAB - UPDATE - return Z_STREAM_END; - } - else - { - z->msg = (char*)"invalid literal/length code"; - UNGRAB - UPDATE - return Z_DATA_ERROR; - } - } while (1); + /* do the copy */ + m -= c; + if ((uInt)(q - s->window) >= d) /* offset before dest */ + { /* just copy */ + r = q - d; + *q++ = *r++; c--; /* minimum count is three, */ + *q++ = *r++; c--; /* so unroll loop a little */ + } + else /* else offset after destination */ + { + e = d - (uInt)(q - s->window); /* bytes from offset to end */ + r = s->end - e; /* pointer to offset */ + if (c > e) /* if source crosses, */ + { + c -= e; /* copy to end of window */ + do { + *q++ = *r++; + } while (--e); + r = s->window; /* copy rest from start of window */ + } + } + do { /* copy all or what's left */ + *q++ = *r++; + } while (--c); + break; + } + else if ((e & 64) == 0) + { + t += t->base; + e = (t += ((uInt)b & inflate_mask[e]))->exop; + } + else + { + z->msg = (char*)"invalid distance code"; + UNGRAB + UPDATE + return Z_DATA_ERROR; + } + } while (1); + break; + } + if ((e & 64) == 0) + { + t += t->base; + if ((e = (t += ((uInt)b & inflate_mask[e]))->exop) == 0) + { + DUMPBITS(t->bits) + Tracevv((t->base >= 0x20 && t->base < 0x7f ? + "inflate: * literal '%c'\n" : + "inflate: * literal 0x%02x\n", t->base)); + *q++ = (Byte)t->base; + m--; + break; + } + } + else if (e & 32) + { + Tracevv(("inflate: * end of block\n")); + UNGRAB + UPDATE + return Z_STREAM_END; + } + else + { + z->msg = (char*)"invalid literal/length code"; + UNGRAB + UPDATE + return Z_DATA_ERROR; + } + } while (1); } while (m >= 258 && n >= 10); /* not enough input or output--restore pointers and return */ @@ -3789,7 +3789,7 @@ int inflate_fast(uInt bl, uInt bd, inflate_huft *tl, inflate_huft *td, inflate_b /* infcodes.c -- process literals and length/distance pairs * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* simplify the use of the inflate_huft type with some defines */ @@ -3797,16 +3797,16 @@ int inflate_fast(uInt bl, uInt bd, inflate_huft *tl, inflate_huft *td, inflate_b #define bits word.what.Bits typedef enum { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */ - START, /* x: set up for LEN */ - LEN, /* i: get length/literal/eob next */ - LENEXT, /* i: getting length extra (have base) */ - DIST, /* i: get distance next */ - DISTEXT, /* i: getting distance extra */ - COPY, /* o: copying bytes in window, waiting for space */ - LIT, /* o: got literal, waiting for output space */ - WASH, /* o: got eob, possibly still output waiting */ - END, /* x: got eob and all data flushed */ - BADCODE} /* x: got error */ + START, /* x: set up for LEN */ + LEN, /* i: get length/literal/eob next */ + LENEXT, /* i: getting length extra (have base) */ + DIST, /* i: get distance next */ + DISTEXT, /* i: getting distance extra */ + COPY, /* o: copying bytes in window, waiting for space */ + LIT, /* o: got literal, waiting for output space */ + WASH, /* o: got eob, possibly still output waiting */ + END, /* x: got eob and all data flushed */ + BADCODE} /* x: got error */ inflate_codes_mode; /* inflate codes private state */ @@ -3818,15 +3818,15 @@ struct inflate_codes_state { /* mode dependent information */ uInt len; union { - struct { - inflate_huft *tree; /* pointer into tree */ - uInt need; /* bits needed */ - } code; /* if LEN or DIST, where in tree */ - uInt lit; /* if LIT, literal */ - struct { - uInt get; /* bits to get for extra */ - uInt dist; /* distance back to copy from */ - } copy; /* if EXT or COPY, where and how much */ + struct { + inflate_huft *tree; /* pointer into tree */ + uInt need; /* bits needed */ + } code; /* if LEN or DIST, where in tree */ + uInt lit; /* if LIT, literal */ + struct { + uInt get; /* bits to get for extra */ + uInt dist; /* distance back to copy from */ + } copy; /* if EXT or COPY, where and how much */ } sub; /* submode */ /* mode independent information */ @@ -3843,14 +3843,14 @@ inflate_codes_statef *inflate_codes_new(uInt bl, uInt bd, inflate_huft *tl, infl inflate_codes_statef *c; if ((c = (inflate_codes_statef *) - ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL) + ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL) { - c->mode = START; - c->lbits = (Byte)bl; - c->dbits = (Byte)bd; - c->ltree = tl; - c->dtree = td; - Tracev(("inflate: codes new\n")); + c->mode = START; + c->lbits = (Byte)bl; + c->dbits = (Byte)bd; + c->ltree = tl; + c->dtree = td; + Tracev(("inflate: codes new\n")); } return c; } @@ -3876,146 +3876,146 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r) /* process input and output based on current state */ while (1) switch (c->mode) { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */ - case START: /* x: set up for LEN */ + case START: /* x: set up for LEN */ #ifndef SLOW - if (m >= 258 && n >= 10) - { - UPDATE - r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z); - LOAD - if (r != Z_OK) - { - c->mode = r == Z_STREAM_END ? WASH : BADCODE; - break; - } - } + if (m >= 258 && n >= 10) + { + UPDATE + r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z); + LOAD + if (r != Z_OK) + { + c->mode = r == Z_STREAM_END ? WASH : BADCODE; + break; + } + } #endif /* !SLOW */ - c->sub.code.need = c->lbits; - c->sub.code.tree = c->ltree; - c->mode = LEN; - case LEN: /* i: get length/literal/eob next */ - j = c->sub.code.need; - NEEDBITS(j) - t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); - DUMPBITS(t->bits) - e = (uInt)(t->exop); - if (e == 0) /* literal */ - { - c->sub.lit = t->base; - Tracevv((t->base >= 0x20 && t->base < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", t->base)); - c->mode = LIT; - break; - } - if (e & 16) /* length */ - { - c->sub.copy.get = e & 15; - c->len = t->base; - c->mode = LENEXT; - break; - } - if ((e & 64) == 0) /* next table */ - { - c->sub.code.need = e; - c->sub.code.tree = t + t->base; - break; - } - if (e & 32) /* end of block */ - { - Tracevv(("inflate: end of block\n")); - c->mode = WASH; - break; - } - c->mode = BADCODE; /* invalid code */ - z->msg = (char*)"invalid literal/length code"; - r = Z_DATA_ERROR; - LEAVE - case LENEXT: /* i: getting length extra (have base) */ - j = c->sub.copy.get; - NEEDBITS(j) - c->len += (uInt)b & inflate_mask[j]; - DUMPBITS(j) - c->sub.code.need = c->dbits; - c->sub.code.tree = c->dtree; - Tracevv(("inflate: length %u\n", c->len)); - c->mode = DIST; - case DIST: /* i: get distance next */ - j = c->sub.code.need; - NEEDBITS(j) - t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); - DUMPBITS(t->bits) - e = (uInt)(t->exop); - if (e & 16) /* distance */ - { - c->sub.copy.get = e & 15; - c->sub.copy.dist = t->base; - c->mode = DISTEXT; - break; - } - if ((e & 64) == 0) /* next table */ - { - c->sub.code.need = e; - c->sub.code.tree = t + t->base; - break; - } - c->mode = BADCODE; /* invalid code */ - z->msg = (char*)"invalid distance code"; - r = Z_DATA_ERROR; - LEAVE - case DISTEXT: /* i: getting distance extra */ - j = c->sub.copy.get; - NEEDBITS(j) - c->sub.copy.dist += (uInt)b & inflate_mask[j]; - DUMPBITS(j) - Tracevv(("inflate: distance %u\n", c->sub.copy.dist)); - c->mode = COPY; - case COPY: /* o: copying bytes in window, waiting for space */ + c->sub.code.need = c->lbits; + c->sub.code.tree = c->ltree; + c->mode = LEN; + case LEN: /* i: get length/literal/eob next */ + j = c->sub.code.need; + NEEDBITS(j) + t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); + DUMPBITS(t->bits) + e = (uInt)(t->exop); + if (e == 0) /* literal */ + { + c->sub.lit = t->base; + Tracevv((t->base >= 0x20 && t->base < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", t->base)); + c->mode = LIT; + break; + } + if (e & 16) /* length */ + { + c->sub.copy.get = e & 15; + c->len = t->base; + c->mode = LENEXT; + break; + } + if ((e & 64) == 0) /* next table */ + { + c->sub.code.need = e; + c->sub.code.tree = t + t->base; + break; + } + if (e & 32) /* end of block */ + { + Tracevv(("inflate: end of block\n")); + c->mode = WASH; + break; + } + c->mode = BADCODE; /* invalid code */ + z->msg = (char*)"invalid literal/length code"; + r = Z_DATA_ERROR; + LEAVE + case LENEXT: /* i: getting length extra (have base) */ + j = c->sub.copy.get; + NEEDBITS(j) + c->len += (uInt)b & inflate_mask[j]; + DUMPBITS(j) + c->sub.code.need = c->dbits; + c->sub.code.tree = c->dtree; + Tracevv(("inflate: length %u\n", c->len)); + c->mode = DIST; + case DIST: /* i: get distance next */ + j = c->sub.code.need; + NEEDBITS(j) + t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); + DUMPBITS(t->bits) + e = (uInt)(t->exop); + if (e & 16) /* distance */ + { + c->sub.copy.get = e & 15; + c->sub.copy.dist = t->base; + c->mode = DISTEXT; + break; + } + if ((e & 64) == 0) /* next table */ + { + c->sub.code.need = e; + c->sub.code.tree = t + t->base; + break; + } + c->mode = BADCODE; /* invalid code */ + z->msg = (char*)"invalid distance code"; + r = Z_DATA_ERROR; + LEAVE + case DISTEXT: /* i: getting distance extra */ + j = c->sub.copy.get; + NEEDBITS(j) + c->sub.copy.dist += (uInt)b & inflate_mask[j]; + DUMPBITS(j) + Tracevv(("inflate: distance %u\n", c->sub.copy.dist)); + c->mode = COPY; + case COPY: /* o: copying bytes in window, waiting for space */ #ifndef __TURBOC__ /* Turbo C bug for following expression */ - f = (uInt)(q - s->window) < c->sub.copy.dist ? - s->end - (c->sub.copy.dist - (q - s->window)) : - q - c->sub.copy.dist; + f = (uInt)(q - s->window) < c->sub.copy.dist ? + s->end - (c->sub.copy.dist - (q - s->window)) : + q - c->sub.copy.dist; #else - f = q - c->sub.copy.dist; - if ((uInt)(q - s->window) < c->sub.copy.dist) - f = s->end - (c->sub.copy.dist - (uInt)(q - s->window)); + f = q - c->sub.copy.dist; + if ((uInt)(q - s->window) < c->sub.copy.dist) + f = s->end - (c->sub.copy.dist - (uInt)(q - s->window)); #endif - while (c->len) - { - NEEDOUT - OUTBYTE(*f++) - if (f == s->end) - f = s->window; - c->len--; - } - c->mode = START; - break; - case LIT: /* o: got literal, waiting for output space */ - NEEDOUT - OUTBYTE(c->sub.lit) - c->mode = START; - break; - case WASH: /* o: got eob, possibly more output */ - if (k > 7) /* return unused byte, if any */ - { - Assert(k < 16, "inflate_codes grabbed too many bytes") - k -= 8; - n++; - p--; /* can always return one */ - } - FLUSH - if (s->read != s->write) - LEAVE - c->mode = END; - case END: - r = Z_STREAM_END; - LEAVE - case BADCODE: /* x: got error */ - r = Z_DATA_ERROR; - LEAVE - default: - r = Z_STREAM_ERROR; - LEAVE + while (c->len) + { + NEEDOUT + OUTBYTE(*f++) + if (f == s->end) + f = s->window; + c->len--; + } + c->mode = START; + break; + case LIT: /* o: got literal, waiting for output space */ + NEEDOUT + OUTBYTE(c->sub.lit) + c->mode = START; + break; + case WASH: /* o: got eob, possibly more output */ + if (k > 7) /* return unused byte, if any */ + { + Assert(k < 16, "inflate_codes grabbed too many bytes") + k -= 8; + n++; + p--; /* can always return one */ + } + FLUSH + if (s->read != s->write) + LEAVE + c->mode = END; + case END: + r = Z_STREAM_END; + LEAVE + case BADCODE: /* x: got error */ + r = Z_DATA_ERROR; + LEAVE + default: + r = Z_STREAM_ERROR; + LEAVE } #ifdef NEED_DUMMY_RETURN return Z_STREAM_ERROR; /* Some dumb compilers complain without this */ @@ -4031,7 +4031,7 @@ void inflate_codes_free(inflate_codes_statef *c, z_streamp z) /* adler32.c -- compute the Adler-32 checksum of a data stream * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ #define BASE 65521L /* largest prime smaller than 65536 */ @@ -4052,35 +4052,35 @@ void inflate_codes_free(inflate_codes_statef *c, z_streamp z) /* ========================================================================= */ uLong adler32(uLong adler, const Byte *buf, uInt len) { - unsigned long s1 = adler & 0xffff; - unsigned long s2 = (adler >> 16) & 0xffff; - int k; + unsigned long s1 = adler & 0xffff; + unsigned long s2 = (adler >> 16) & 0xffff; + int k; - if (buf == Z_NULL) return 1L; + if (buf == Z_NULL) return 1L; - while (len > 0) { - k = len < NMAX ? len : NMAX; - len -= k; - while (k >= 16) { - DO16(buf); - buf += 16; - k -= 16; - } - if (k != 0) do { - s1 += *buf++; - s2 += s1; - } while (--k); - s1 %= BASE; - s2 %= BASE; - } - return (s2 << 16) | s1; + while (len > 0) { + k = len < NMAX ? len : NMAX; + len -= k; + while (k >= 16) { + DO16(buf); + buf += 16; + k -= 16; + } + if (k != 0) do { + s1 += *buf++; + s2 += s1; + } while (--k); + s1 %= BASE; + s2 %= BASE; + } + return (s2 << 16) | s1; } /* @(#) $Id: unzip.c,v 1.2 1999/09/07 20:51:25 zoid Exp $ */ /* infblock.h -- header to use infblock.c * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is @@ -4089,47 +4089,47 @@ uLong adler32(uLong adler, const Byte *buf, uInt len) */ extern inflate_blocks_statef * inflate_blocks_new OF(( - z_streamp z, - check_func c, /* check function */ - uInt w)); /* window size */ + z_streamp z, + check_func c, /* check function */ + uInt w)); /* window size */ extern int inflate_blocks OF(( - inflate_blocks_statef *, - z_streamp , - int)); /* initial return code */ + inflate_blocks_statef *, + z_streamp , + int)); /* initial return code */ extern void inflate_blocks_reset OF(( - inflate_blocks_statef *, - z_streamp , - uLong *)); /* check value on output */ + inflate_blocks_statef *, + z_streamp , + uLong *)); /* check value on output */ extern int inflate_blocks_free OF(( - inflate_blocks_statef *, - z_streamp)); + inflate_blocks_statef *, + z_streamp)); extern void inflate_set_dictionary OF(( - inflate_blocks_statef *s, - const Byte *d, /* dictionary */ - uInt n)); /* dictionary length */ + inflate_blocks_statef *s, + const Byte *d, /* dictionary */ + uInt n)); /* dictionary length */ extern int inflate_blocks_sync_point OF(( - inflate_blocks_statef *s)); + inflate_blocks_statef *s)); typedef enum { - imMETHOD, /* waiting for method byte */ - imFLAG, /* waiting for flag byte */ - imDICT4, /* four dictionary check bytes to go */ - imDICT3, /* three dictionary check bytes to go */ - imDICT2, /* two dictionary check bytes to go */ - imDICT1, /* one dictionary check byte to go */ - imDICT0, /* waiting for inflateSetDictionary */ - imBLOCKS, /* decompressing blocks */ - imCHECK4, /* four check bytes to go */ - imCHECK3, /* three check bytes to go */ - imCHECK2, /* two check bytes to go */ - imCHECK1, /* one check byte to go */ - imDONE, /* finished check, done */ - imBAD} /* got an error--stay here */ + imMETHOD, /* waiting for method byte */ + imFLAG, /* waiting for flag byte */ + imDICT4, /* four dictionary check bytes to go */ + imDICT3, /* three dictionary check bytes to go */ + imDICT2, /* two dictionary check bytes to go */ + imDICT1, /* one dictionary check byte to go */ + imDICT0, /* waiting for inflateSetDictionary */ + imBLOCKS, /* decompressing blocks */ + imCHECK4, /* four check bytes to go */ + imCHECK3, /* three check bytes to go */ + imCHECK2, /* two check bytes to go */ + imCHECK1, /* one check byte to go */ + imDONE, /* finished check, done */ + imBAD} /* got an error--stay here */ inflate_mode; /* inflate private state */ @@ -4140,19 +4140,19 @@ struct internal_state { /* mode dependent information */ union { - uInt method; /* if FLAGS, method byte */ - struct { - uLong was; /* computed check value */ - uLong need; /* stream check value */ - } check; /* if CHECK, check values to compare */ - uInt marker; /* if BAD, inflateSync's marker bytes count */ + uInt method; /* if FLAGS, method byte */ + struct { + uLong was; /* computed check value */ + uLong need; /* stream check value */ + } check; /* if CHECK, check values to compare */ + uInt marker; /* if BAD, inflateSync's marker bytes count */ } sub; /* submode */ /* mode independent information */ int nowrap; /* flag for no wrapper */ uInt wbits; /* log2(window size) (8..15, defaults to 15) */ - inflate_blocks_statef - *blocks; /* current inflate_blocks state */ + inflate_blocks_statef + *blocks; /* current inflate_blocks state */ }; @@ -4160,7 +4160,7 @@ struct internal_state { int inflateReset(z_streamp z) { if (z == Z_NULL || z->state == Z_NULL) - return Z_STREAM_ERROR; + return Z_STREAM_ERROR; z->total_in = z->total_out = 0; z->msg = Z_NULL; z->state->mode = z->state->nowrap ? imBLOCKS : imMETHOD; @@ -4173,9 +4173,9 @@ int inflateReset(z_streamp z) int inflateEnd(z_streamp z) { if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL) - return Z_STREAM_ERROR; + return Z_STREAM_ERROR; if (z->state->blocks != Z_NULL) - inflate_blocks_free(z->state->blocks, z); + inflate_blocks_free(z->state->blocks, z); ZFREE(z, z->state); z->state = Z_NULL; Tracev(("inflate: end\n")); @@ -4187,47 +4187,47 @@ int inflateEnd(z_streamp z) int inflateInit2_(z_streamp z, int w, const char *version, int stream_size) { if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != sizeof(z_stream)) - return Z_VERSION_ERROR; + stream_size != sizeof(z_stream)) + return Z_VERSION_ERROR; /* initialize state */ if (z == Z_NULL) - return Z_STREAM_ERROR; + return Z_STREAM_ERROR; z->msg = Z_NULL; if (z->zalloc == Z_NULL) { - z->zalloc = (void *(*)(void *, unsigned, unsigned))zcalloc; - z->opaque = (voidp)0; + z->zalloc = (void *(*)(void *, unsigned, unsigned))zcalloc; + z->opaque = (voidp)0; } if (z->zfree == Z_NULL) z->zfree = (void (*)(void *, void *))zcfree; if ((z->state = (struct internal_state *) - ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL) - return Z_MEM_ERROR; + ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL) + return Z_MEM_ERROR; z->state->blocks = Z_NULL; /* handle undocumented nowrap option (no zlib header or check) */ z->state->nowrap = 0; if (w < 0) { - w = - w; - z->state->nowrap = 1; + w = - w; + z->state->nowrap = 1; } /* set window size */ if (w < 8 || w > 15) { - inflateEnd(z); - return Z_STREAM_ERROR; + inflateEnd(z); + return Z_STREAM_ERROR; } z->state->wbits = (uInt)w; /* create inflate_blocks state */ if ((z->state->blocks = - inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, (uInt)1 << w)) - == Z_NULL) + inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, (uInt)1 << w)) + == Z_NULL) { - inflateEnd(z); - return Z_MEM_ERROR; + inflateEnd(z); + return Z_MEM_ERROR; } Tracev(("inflate: allocated\n")); @@ -4252,119 +4252,119 @@ int inflate(z_streamp z, int f) uInt b; if (z == Z_NULL || z->state == Z_NULL || z->next_in == Z_NULL) - return Z_STREAM_ERROR; + return Z_STREAM_ERROR; f = f == Z_FINISH ? Z_BUF_ERROR : Z_OK; r = Z_BUF_ERROR; while (1) switch (z->state->mode) { - case imMETHOD: - iNEEDBYTE - if (((z->state->sub.method = iNEXTBYTE) & 0xf) != Z_DEFLATED) - { - z->state->mode = imBAD; - z->msg = (char*)"unknown compression method"; - z->state->sub.marker = 5; /* can't try inflateSync */ - break; - } - if ((z->state->sub.method >> 4) + 8 > z->state->wbits) - { - z->state->mode = imBAD; - z->msg = (char*)"invalid window size"; - z->state->sub.marker = 5; /* can't try inflateSync */ - break; - } - z->state->mode = imFLAG; - case imFLAG: - iNEEDBYTE - b = iNEXTBYTE; - if (((z->state->sub.method << 8) + b) % 31) - { - z->state->mode = imBAD; - z->msg = (char*)"incorrect header check"; - z->state->sub.marker = 5; /* can't try inflateSync */ - break; - } - Tracev(("inflate: zlib header ok\n")); - if (!(b & PRESET_DICT)) - { - z->state->mode = imBLOCKS; - break; - } - z->state->mode = imDICT4; - case imDICT4: - iNEEDBYTE - z->state->sub.check.need = (uLong)iNEXTBYTE << 24; - z->state->mode = imDICT3; - case imDICT3: - iNEEDBYTE - z->state->sub.check.need += (uLong)iNEXTBYTE << 16; - z->state->mode = imDICT2; - case imDICT2: - iNEEDBYTE - z->state->sub.check.need += (uLong)iNEXTBYTE << 8; - z->state->mode = imDICT1; - case imDICT1: - iNEEDBYTE - z->state->sub.check.need += (uLong)iNEXTBYTE; - z->adler = z->state->sub.check.need; - z->state->mode = imDICT0; - return Z_NEED_DICT; - case imDICT0: - z->state->mode = imBAD; - z->msg = (char*)"need dictionary"; - z->state->sub.marker = 0; /* can try inflateSync */ - return Z_STREAM_ERROR; - case imBLOCKS: - r = inflate_blocks(z->state->blocks, z, r); - if (r == Z_DATA_ERROR) - { - z->state->mode = imBAD; - z->state->sub.marker = 0; /* can try inflateSync */ - break; - } - if (r == Z_OK) - r = f; - if (r != Z_STREAM_END) - return r; - r = f; - inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was); - if (z->state->nowrap) - { - z->state->mode = imDONE; - break; - } - z->state->mode = imCHECK4; - case imCHECK4: - iNEEDBYTE - z->state->sub.check.need = (uLong)iNEXTBYTE << 24; - z->state->mode = imCHECK3; - case imCHECK3: - iNEEDBYTE - z->state->sub.check.need += (uLong)iNEXTBYTE << 16; - z->state->mode = imCHECK2; - case imCHECK2: - iNEEDBYTE - z->state->sub.check.need += (uLong)iNEXTBYTE << 8; - z->state->mode = imCHECK1; - case imCHECK1: - iNEEDBYTE - z->state->sub.check.need += (uLong)iNEXTBYTE; + case imMETHOD: + iNEEDBYTE + if (((z->state->sub.method = iNEXTBYTE) & 0xf) != Z_DEFLATED) + { + z->state->mode = imBAD; + z->msg = (char*)"unknown compression method"; + z->state->sub.marker = 5; /* can't try inflateSync */ + break; + } + if ((z->state->sub.method >> 4) + 8 > z->state->wbits) + { + z->state->mode = imBAD; + z->msg = (char*)"invalid window size"; + z->state->sub.marker = 5; /* can't try inflateSync */ + break; + } + z->state->mode = imFLAG; + case imFLAG: + iNEEDBYTE + b = iNEXTBYTE; + if (((z->state->sub.method << 8) + b) % 31) + { + z->state->mode = imBAD; + z->msg = (char*)"incorrect header check"; + z->state->sub.marker = 5; /* can't try inflateSync */ + break; + } + Tracev(("inflate: zlib header ok\n")); + if (!(b & PRESET_DICT)) + { + z->state->mode = imBLOCKS; + break; + } + z->state->mode = imDICT4; + case imDICT4: + iNEEDBYTE + z->state->sub.check.need = (uLong)iNEXTBYTE << 24; + z->state->mode = imDICT3; + case imDICT3: + iNEEDBYTE + z->state->sub.check.need += (uLong)iNEXTBYTE << 16; + z->state->mode = imDICT2; + case imDICT2: + iNEEDBYTE + z->state->sub.check.need += (uLong)iNEXTBYTE << 8; + z->state->mode = imDICT1; + case imDICT1: + iNEEDBYTE + z->state->sub.check.need += (uLong)iNEXTBYTE; + z->adler = z->state->sub.check.need; + z->state->mode = imDICT0; + return Z_NEED_DICT; + case imDICT0: + z->state->mode = imBAD; + z->msg = (char*)"need dictionary"; + z->state->sub.marker = 0; /* can try inflateSync */ + return Z_STREAM_ERROR; + case imBLOCKS: + r = inflate_blocks(z->state->blocks, z, r); + if (r == Z_DATA_ERROR) + { + z->state->mode = imBAD; + z->state->sub.marker = 0; /* can try inflateSync */ + break; + } + if (r == Z_OK) + r = f; + if (r != Z_STREAM_END) + return r; + r = f; + inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was); + if (z->state->nowrap) + { + z->state->mode = imDONE; + break; + } + z->state->mode = imCHECK4; + case imCHECK4: + iNEEDBYTE + z->state->sub.check.need = (uLong)iNEXTBYTE << 24; + z->state->mode = imCHECK3; + case imCHECK3: + iNEEDBYTE + z->state->sub.check.need += (uLong)iNEXTBYTE << 16; + z->state->mode = imCHECK2; + case imCHECK2: + iNEEDBYTE + z->state->sub.check.need += (uLong)iNEXTBYTE << 8; + z->state->mode = imCHECK1; + case imCHECK1: + iNEEDBYTE + z->state->sub.check.need += (uLong)iNEXTBYTE; - if (z->state->sub.check.was != z->state->sub.check.need) - { - z->state->mode = imBAD; - z->msg = (char*)"incorrect data check"; - z->state->sub.marker = 5; /* can't try inflateSync */ - break; - } - Tracev(("inflate: zlib check ok\n")); - z->state->mode = imDONE; - case imDONE: - return Z_STREAM_END; - case imBAD: - return Z_DATA_ERROR; - default: - return Z_STREAM_ERROR; + if (z->state->sub.check.was != z->state->sub.check.need) + { + z->state->mode = imBAD; + z->msg = (char*)"incorrect data check"; + z->state->sub.marker = 5; /* can't try inflateSync */ + break; + } + Tracev(("inflate: zlib check ok\n")); + z->state->mode = imDONE; + case imDONE: + return Z_STREAM_END; + case imBAD: + return Z_DATA_ERROR; + default: + return Z_STREAM_ERROR; } #ifdef NEED_DUMMY_RETURN return Z_STREAM_ERROR; /* Some dumb compilers complain without this */ @@ -4377,15 +4377,15 @@ int inflateSetDictionary(z_streamp z, const Byte *dictionary, uInt dictLength) uInt length = dictLength; if (z == Z_NULL || z->state == Z_NULL || z->state->mode != imDICT0) - return Z_STREAM_ERROR; + return Z_STREAM_ERROR; if (adler32(1L, dictionary, dictLength) != z->adler) return Z_DATA_ERROR; z->adler = 1L; if (length >= ((uInt)1<state->wbits)) { - length = (1<state->wbits)-1; - dictionary += dictLength - length; + length = (1<state->wbits)-1; + dictionary += dictLength - length; } inflate_set_dictionary(z->state->blocks, dictionary, length); z->state->mode = imBLOCKS; @@ -4402,28 +4402,28 @@ int inflateSync(z_streamp z) /* set up */ if (z == Z_NULL || z->state == Z_NULL) - return Z_STREAM_ERROR; + return Z_STREAM_ERROR; if (z->state->mode != imBAD) { - z->state->mode = imBAD; - z->state->sub.marker = 0; + z->state->mode = imBAD; + z->state->sub.marker = 0; } if ((n = z->avail_in) == 0) - return Z_BUF_ERROR; + return Z_BUF_ERROR; p = z->next_in; m = z->state->sub.marker; /* search */ while (n && m < 4) { - static const Byte mark[4] = {0, 0, 0xff, 0xff}; - if (*p == mark[m]) - m++; - else if (*p) - m = 0; - else - m = 4 - m; - p++, n--; + static const Byte mark[4] = {0, 0, 0xff, 0xff}; + if (*p == mark[m]) + m++; + else if (*p) + m = 0; + else + m = 4 - m; + p++, n--; } /* restore */ @@ -4434,7 +4434,7 @@ int inflateSync(z_streamp z) /* return no joy or set up to restart on a new block */ if (m != 4) - return Z_DATA_ERROR; + return Z_DATA_ERROR; r = z->total_in; w = z->total_out; inflateReset(z); z->total_in = r; z->total_out = w; @@ -4453,18 +4453,18 @@ int inflateSync(z_streamp z) int inflateSyncPoint(z_streamp z) { if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL) - return Z_STREAM_ERROR; + return Z_STREAM_ERROR; return inflate_blocks_sync_point(z->state->blocks); } voidp zcalloc (voidp opaque, unsigned items, unsigned size) { - if (opaque) items += size - size; /* make compiler happy */ - return (voidp)Mem_ClearedAlloc(items*size); + if (opaque) items += size - size; /* make compiler happy */ + return (voidp)Mem_ClearedAlloc(items*size); } void zcfree (voidp opaque, voidp ptr) { - Mem_Free(ptr); - if (opaque) return; /* make compiler happy */ + Mem_Free(ptr); + if (opaque) return; /* make compiler happy */ } diff --git a/neo/framework/Unzip.h b/neo/framework/Unzip.h index 43ab62fe..a98c4d34 100644 --- a/neo/framework/Unzip.h +++ b/neo/framework/Unzip.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"). @@ -32,15 +32,15 @@ If you have questions concerning this license or the applicable additional terms #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) /* like the STRICT of WIN32, we define a pointer that cannot be converted - from (void*) without cast */ -typedef struct TagunzFile__ { int unused; } unzFile__; + from (void*) without cast */ +typedef struct TagunzFile__ { int unused; } unzFile__; typedef unzFile__ *unzFile; #else typedef void* unzFile; #endif /* tm_unz contain date/time info */ -typedef struct tm_unz_s +typedef struct tm_unz_s { unsigned int tm_sec; /* seconds after the minute - [0,59] */ unsigned int tm_min; /* minutes after the hour - [0,59] */ @@ -62,29 +62,29 @@ typedef struct unz_global_info_s /* unz_file_info contain information about a file in the zipfile */ typedef struct unz_file_info_s { - unsigned long version; /* version made by 2 unsigned chars */ - unsigned long version_needed; /* version needed to extract 2 unsigned chars */ - unsigned long flag; /* general purpose bit flag 2 unsigned chars */ - unsigned long compression_method; /* compression method 2 unsigned chars */ - unsigned long dosDate; /* last mod file date in Dos fmt 4 unsigned chars */ - unsigned long crc; /* crc-32 4 unsigned chars */ - unsigned long compressed_size; /* compressed size 4 unsigned chars */ - unsigned long uncompressed_size; /* uncompressed size 4 unsigned chars */ - unsigned long size_filename; /* filename length 2 unsigned chars */ - unsigned long size_file_extra; /* extra field length 2 unsigned chars */ - unsigned long size_file_comment; /* file comment length 2 unsigned chars */ + unsigned long version; /* version made by 2 unsigned chars */ + unsigned long version_needed; /* version needed to extract 2 unsigned chars */ + unsigned long flag; /* general purpose bit flag 2 unsigned chars */ + unsigned long compression_method; /* compression method 2 unsigned chars */ + unsigned long dosDate; /* last mod file date in Dos fmt 4 unsigned chars */ + unsigned long crc; /* crc-32 4 unsigned chars */ + unsigned long compressed_size; /* compressed size 4 unsigned chars */ + unsigned long uncompressed_size; /* uncompressed size 4 unsigned chars */ + unsigned long size_filename; /* filename length 2 unsigned chars */ + unsigned long size_file_extra; /* extra field length 2 unsigned chars */ + unsigned long size_file_comment; /* file comment length 2 unsigned chars */ - unsigned long disk_num_start; /* disk number start 2 unsigned chars */ - unsigned long internal_fa; /* internal file attributes 2 unsigned chars */ - unsigned long external_fa; /* external file attributes 4 unsigned chars */ + unsigned long disk_num_start; /* disk number start 2 unsigned chars */ + unsigned long internal_fa; /* internal file attributes 2 unsigned chars */ + unsigned long external_fa; /* external file attributes 4 unsigned chars */ - tm_unz tmu_date; + tm_unz tmu_date; } unz_file_info; /* unz_file_info_interntal contain internal info about a file in zipfile*/ typedef struct unz_file_info_internal_s { - unsigned long offset_curfile;/* relative offset of static header 4 unsigned chars */ + unsigned long offset_curfile;/* relative offset of static header 4 unsigned chars */ } unz_file_info_internal; typedef void* (*alloc_func) (void* opaque, unsigned int items, unsigned int size); @@ -93,31 +93,31 @@ typedef void (*free_func) (void* opaque, void* address); struct internal_state; typedef struct z_stream_s { - unsigned char *next_in; /* next input unsigned char */ - unsigned int avail_in; /* number of unsigned chars available at next_in */ - unsigned long total_in; /* total nb of input unsigned chars read so */ + unsigned char *next_in; /* next input unsigned char */ + unsigned int avail_in; /* number of unsigned chars available at next_in */ + unsigned long total_in; /* total nb of input unsigned chars read so */ - unsigned char *next_out; /* next output unsigned char should be put there */ - unsigned int avail_out; /* remaining free space at next_out */ - unsigned long total_out; /* total nb of unsigned chars output so */ + unsigned char *next_out; /* next output unsigned char should be put there */ + unsigned int avail_out; /* remaining free space at next_out */ + unsigned long total_out; /* total nb of unsigned chars output so */ - char *msg; /* last error message, NULL if no error */ - struct internal_state *state; /* not visible by applications */ + char *msg; /* last error message, NULL if no error */ + struct internal_state *state; /* not visible by applications */ - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - unsigned char* opaque; /* private data object passed to zalloc and zfree */ + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + unsigned char* opaque; /* private data object passed to zalloc and zfree */ - int data_type; /* best guess about the data type: ascii or binary */ - unsigned long adler; /* adler32 value of the uncompressed data */ - unsigned long reserved; /* reserved for future use */ + int data_type; /* best guess about the data type: ascii or binary */ + unsigned long adler; /* adler32 value of the uncompressed data */ + unsigned long reserved; /* reserved for future use */ } z_stream; typedef z_stream *z_streamp; /* file_in_zip_read_info_s contain internal information about a file in zipfile, - when reading and decompress it */ + when reading and decompress it */ typedef struct { char *read_buffer; /* internal buffer for compressed data */ @@ -158,8 +158,8 @@ typedef struct unz_file_info cur_file_info; /* public info about the current file in zip*/ unz_file_info_internal cur_file_info_internal; /* private info about it*/ - file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current - file if we are decompressing it */ + file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current + file if we are decompressing it */ } unz_s; #define UNZ_OK (0) @@ -191,11 +191,11 @@ extern unzFile unzReOpen (const char* path, unzFile file); /* Open a Zip file. path contain the full pathname (by example, - on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer + on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer "zlib/zlib111.zip". If the zipfile cannot be opened (file don't exist or in not valid), the return value is NULL. - Else, the return value is a unzFile Handle, usable with other function + Else, the return value is a unzFile Handle, usable with other function of this unzip package. */ @@ -204,7 +204,7 @@ extern int unzClose (unzFile file); /* Close a ZipFile opened with unzipOpen. If there is files inside the .Zip opened with unzOpenCurrentFile (see later), - these files MUST be closed with unzipCloseCurrentFile before call unzipClose. + these files MUST be closed with unzipCloseCurrentFile before call unzipClose. return UNZ_OK if there is no problem. */ extern int unzGetGlobalInfo (unzFile file, unz_global_info *pglobal_info); @@ -273,7 +273,7 @@ extern int unzGetCurrentFileInfo (unzFile file, unz_file_info *pfile_info, char /* Get Info about the current file if pfile_info!=NULL, the *pfile_info structure will contain somes info about - the current file + the current file if szFileName!=NULL, the filemane string will be copied in szFileName (fileNameBufferSize is the size of the buffer) if extraField!=NULL, the extra field information will be copied in extraField @@ -302,7 +302,7 @@ extern int unzCloseCurrentFile (unzFile file); Return UNZ_CRCERROR if all the file was read but the CRC is not good */ - + extern int unzReadCurrentFile (unzFile file, void* buf, unsigned len); /* @@ -313,7 +313,7 @@ extern int unzReadCurrentFile (unzFile file, void* buf, unsigned len); return the number of unsigned char copied if somes unsigned chars are copied return 0 if the end of file was reached return <0 with error code if there is an error - (UNZ_ERRNO for IO error, or zLib error for uncompress error) + (UNZ_ERRNO for IO error, or zLib error for uncompress error) */ extern long unztell(unzFile file); @@ -325,7 +325,7 @@ extern long unztell(unzFile file); extern int unzeof (unzFile file); /* - return 1 if the end of file was reached, 0 elsewhere + return 1 if the end of file was reached, 0 elsewhere */ extern int unzGetLocalExtrafield (unzFile file, void* buf, unsigned len); @@ -333,13 +333,13 @@ extern int unzGetLocalExtrafield (unzFile file, void* buf, unsigned len); /* Read extra field from the current file (opened by unzOpenCurrentFile) This is the local-header version of the extra field (sometimes, there is - more info in the local-header version than in the central-header) + more info in the local-header version than in the central-header) if buf==NULL, it return the size of the local extra field if buf!=NULL, len is the size of the buffer, the extra header is copied in buf. - the return value is the number of unsigned chars copied in buf, or (if <0) + the return value is the number of unsigned chars copied in buf, or (if <0) the error code */ diff --git a/neo/framework/UsercmdGen.cpp b/neo/framework/UsercmdGen.cpp index cd8f0529..efbb93f9 100644 --- a/neo/framework/UsercmdGen.cpp +++ b/neo/framework/UsercmdGen.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"). @@ -48,7 +48,7 @@ void usercmd_t::ByteSwap( void ) { usercmd_t::operator== ================ */ -bool usercmd_t::operator==( const usercmd_t &rhs ) const { +bool usercmd_t::operator==( const usercmd_t &rhs ) const { return ( buttons == rhs.buttons && forwardmove == rhs.forwardmove && rightmove == rhs.rightmove && @@ -309,7 +309,7 @@ const int MAX_CHAT_BUFFER = 127; class idUsercmdGenLocal : public idUsercmdGen { public: idUsercmdGenLocal( void ); - + void Init( void ); void InitForNewMap( void ); @@ -526,7 +526,7 @@ Moves the local angle positions */ void idUsercmdGenLocal::AdjustAngles( void ) { float speed; - + if ( toggled_run.on ^ ( in_alwaysRun.GetBool() && idAsyncNetwork::IsActive() ) ) { speed = idMath::M_MS2SEC * USERCMD_MSEC * in_angleSpeedKey.GetFloat(); } else { @@ -587,7 +587,7 @@ void idUsercmdGenLocal::MouseMove( void ) { history[historyCounter&7][0] = mouseDx; history[historyCounter&7][1] = mouseDy; - + // allow mouse movement to be smoothed together int smooth = m_smooth.GetInteger(); if ( smooth < 1 ) { @@ -764,7 +764,7 @@ void idUsercmdGenLocal::MakeCurrent( void ) { int i; oldAngles = viewangles; - + if ( !Inhibited() ) { // update toggled key states toggled_crouch.SetKeyState( ButtonState( UB_DOWN ), in_toggleCrouch.GetBool() ); @@ -791,7 +791,7 @@ void idUsercmdGenLocal::MakeCurrent( void ) { viewangles[PITCH] = oldAngles[PITCH] + 90; } else if ( oldAngles[PITCH] - viewangles[PITCH] > 90 ) { viewangles[PITCH] = oldAngles[PITCH] - 90; - } + } } else { mouseDx = 0; mouseDy = 0; @@ -870,7 +870,7 @@ idUsercmdGenLocal::Clear ================ */ void idUsercmdGenLocal::Clear( void ) { - // clears all key states + // clears all key states memset( buttonState, 0, sizeof( buttonState ) ); memset( keyState, false, sizeof( keyState ) ); @@ -966,7 +966,7 @@ void idUsercmdGenLocal::Mouse( void ) { if ( numEvents ) { // - // Study each of the buffer elements and process them. + // Study each of the buffer elements and process them. // for( i = 0; i < numEvents; i++ ) { int action, value; @@ -1015,7 +1015,7 @@ void idUsercmdGenLocal::Keyboard( void ) { if ( numEvents ) { // - // Study each of the buffer elements and process them. + // Study each of the buffer elements and process them. // int key; bool state; diff --git a/neo/framework/UsercmdGen.h b/neo/framework/UsercmdGen.h index 91d059f4..17e88fe8 100644 --- a/neo/framework/UsercmdGen.h +++ b/neo/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/neo/framework/async/AsyncClient.cpp b/neo/framework/async/AsyncClient.cpp index 8d4f62ba..c4c3cfcd 100644 --- a/neo/framework/async/AsyncClient.cpp +++ b/neo/framework/async/AsyncClient.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 idAsyncClient::ConnectToServer( const netadr_t adr ) { // trash any currently pending packets ClearPendingPackets(); - + serverAddress = adr; // clear the client state @@ -298,7 +298,7 @@ idAsyncClient::GetServerInfo void idAsyncClient::GetServerInfo( const netadr_t adr ) { idBitMsg msg; byte msgBuf[MAX_MESSAGE_SIZE]; - + if ( !InitPort() ) { return; } @@ -308,7 +308,7 @@ void idAsyncClient::GetServerInfo( const netadr_t adr ) { msg.WriteString( "getInfo" ); msg.WriteLong( serverList.GetChallenge() ); // challenge - clientPort.SendPacket( adr, msg.GetData(), msg.GetSize() ); + clientPort.SendPacket( adr, msg.GetData(), msg.GetSize() ); } /* @@ -446,7 +446,7 @@ void idAsyncClient::RemoteConsole( const char *command ) { } else { Sys_StringToNetAdr( idAsyncNetwork::clientRemoteConsoleAddress.GetString(), &adr, true ); } - + if ( !adr.port ) { adr.port = PORT_SERVER; } @@ -460,7 +460,7 @@ void idAsyncClient::RemoteConsole( const char *command ) { msg.WriteString( idAsyncNetwork::clientRemoteConsolePassword.GetString() ); msg.WriteString( command ); - clientPort.SendPacket( adr, msg.GetData(), msg.GetSize() ); + clientPort.SendPacket( adr, msg.GetData(), msg.GetSize() ); } /* @@ -586,7 +586,7 @@ void idAsyncClient::SendUserInfoToServer( void ) { } info = *cvarSystem->MoveCVarsToDict( CVAR_USERINFO ); - + // send reliable client info to server msg.Init( msgBuf, sizeof( msgBuf ) ); msg.WriteByte( CLIENT_RELIABLE_MESSAGE_CLIENTINFO ); @@ -892,7 +892,7 @@ void idAsyncClient::ProcessReliableMessagePure( const idBitMsg &msg ) { } if ( !ValidatePureServerChecksums( serverAddress, msg ) ) { - + return; } @@ -1053,7 +1053,7 @@ void idAsyncClient::ProcessReliableServerMessages( void ) { idAsyncClient::ProcessChallengeResponseMessage ================== */ -void idAsyncClient::ProcessChallengeResponseMessage( const netadr_t from, const idBitMsg &msg ) { +void idAsyncClient::ProcessChallengeResponseMessage( const netadr_t from, const idBitMsg &msg ) { char serverGame[ MAX_STRING_CHARS ], serverGameBase[ MAX_STRING_CHARS ]; if ( clientState != CS_CHALLENGING ) { @@ -1229,7 +1229,7 @@ void idAsyncClient::ProcessPrintMessage( const netadr_t from, const idBitMsg &ms if ( retpass ) { // #790 cvarSystem->SetCVarString( "password", "" ); - cvarSystem->SetCVarString( "password", retpass ); + cvarSystem->SetCVarString( "password", retpass ); } else { cmdSystem->BufferCommandText( CMD_EXEC_NOW, "disconnect" ); } @@ -1313,7 +1313,7 @@ void idAsyncClient::ProcessAuthKeyMessage( const netadr_t from, const idBitMsg & break; } common->DPrintf( "auth deny: %s\n", auth_msg.c_str() ); - + // keys to be cleared. applies to both net connect and game auth session->ClearCDKey( valid ); @@ -1408,7 +1408,7 @@ bool idAsyncClient::ValidatePureServerChecksums( const netadr_t from, const idBi // need to restart the filesystem with a different pure configuration cmdSystem->BufferCommandText( CMD_EXEC_NOW, "disconnect" ); // restart with the right FS configuration and get back to the server - clientState = CS_PURERESTART; + clientState = CS_PURERESTART; fileSystem->SetRestartChecksums( inChecksums, inGamePakChecksum ); cmdSystem->BufferCommandText( CMD_EXEC_NOW, "reloadEngine" ); return false; @@ -1540,7 +1540,7 @@ void idAsyncClient::ConnectionlessMessage( const netadr_t from, const idBitMsg & ProcessServersListMessage( from, msg ); return; } - + if ( idStr::Icmp( string, "authKey" ) == 0 ) { ProcessAuthKeyMessage( from, msg ); return; @@ -1685,7 +1685,7 @@ void idAsyncClient::SetupConnection( void ) { // do not make the protocol depend on PB msg.WriteShort( 0 ); clientPort.SendPacket( serverAddress, msg.GetData(), msg.GetSize() ); - + if ( idAsyncNetwork::LANServer.GetBool() ) { common->Printf( "net_LANServer is set, connecting in LAN mode\n" ); } else { @@ -1973,7 +1973,7 @@ void idAsyncClient::HandleDownloads( void ) { } else if ( backgroundDownload.completed ) { // only enter these if the download slot is free if ( updateState == UPDATE_READY ) { - // + // if ( session->MessageBox( MSG_YESNO, updateMSG, common->GetLanguageDict()->GetString ( "#str_04330" ), true, "yes" )[0] ) { if ( !updateDirectDownload ) { sys->OpenURL( updateURL, true ); @@ -1999,7 +1999,7 @@ void idAsyncClient::HandleDownloads( void ) { SendVersionDLUpdate( 0 ); session->DownloadProgressBox( &backgroundDownload, va( "Downloading %s\n", updateFile.c_str() ) ); updateState = UPDATE_DONE; - if ( backgroundDownload.url.status == DL_DONE ) { + if ( backgroundDownload.url.status == DL_DONE ) { SendVersionDLUpdate( 1 ); idStr fullPath = f->GetFullPath(); fileSystem->CloseFile( f ); @@ -2076,7 +2076,7 @@ void idAsyncClient::HandleDownloads( void ) { progress_end = 100; } session->DownloadProgressBox( &backgroundDownload, dltitle, progress_start, progress_end ); - if ( backgroundDownload.url.status == DL_DONE ) { + if ( backgroundDownload.url.status == DL_DONE ) { idFile *saveas; const int CHUNK_SIZE = 1024 * 1024; byte *buf; @@ -2111,7 +2111,7 @@ void idAsyncClient::HandleDownloads( void ) { fileSystem->CloseFile( saveas ); common->Printf( "saved as %s\n", finalPath.c_str() ); Mem_Free( buf ); - + // add that file to our paks list checksum = fileSystem->AddZipFile( dlList[ 0 ].filename ); @@ -2125,7 +2125,7 @@ void idAsyncClient::HandleDownloads( void ) { } currentDlSize += dlList[ 0 ].size; - + } else { common->Warning( "download failed: %s", dlList[ 0 ].url.c_str() ); if ( backgroundDownload.url.dlerror[ 0 ] ) { @@ -2139,9 +2139,9 @@ void idAsyncClient::HandleDownloads( void ) { } pakCount++; - dlList.RemoveIndex( 0 ); + dlList.RemoveIndex( 0 ); } while ( dlList.Num() ); - + // all downloads successful - do the dew cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "reconnect\n" ); } @@ -2196,7 +2196,7 @@ void idAsyncClient::ProcessDownloadInfoMessage( const netadr_t from, const idBit int infoType = msg.ReadByte(); int pakDl; int pakIndex; - + pakDlEntry_t entry; bool gotAllFiles = true; idStr sizeStr; @@ -2258,7 +2258,7 @@ void idAsyncClient::ProcessDownloadInfoMessage( const netadr_t from, const idBit } } else { assert( pakDl == SERVER_PAK_END ); - } + } } while ( pakDl != SERVER_PAK_END ); if ( dlList.Num() < dlCount ) { common->Printf( "%d files were ignored by the server\n", dlCount - dlList.Num() ); diff --git a/neo/framework/async/AsyncClient.h b/neo/framework/async/AsyncClient.h index 594d87aa..63752fd7 100644 --- a/neo/framework/async/AsyncClient.h +++ b/neo/framework/async/AsyncClient.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"). @@ -133,7 +133,7 @@ private: int serverId; // server identification int serverChallenge; // challenge from server int serverMessageSequence; // sequence number of last server message - + netadr_t lastRconAddress; // last rcon address we emitted to int lastRconTime; // when last rcon emitted diff --git a/neo/framework/async/AsyncNetwork.cpp b/neo/framework/async/AsyncNetwork.cpp index bfe23fdb..a1f0e0b1 100644 --- a/neo/framework/async/AsyncNetwork.cpp +++ b/neo/framework/async/AsyncNetwork.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"). @@ -129,7 +129,7 @@ idAsyncNetwork::GetMasterAddress bool idAsyncNetwork::GetMasterAddress( int index, netadr_t &adr ) { if ( !masters[ index ].var ) { return false; - } + } if ( masters[ index ].var->GetString()[0] == '\0' ) { return false; } @@ -203,7 +203,7 @@ void idAsyncNetwork::WriteUserCmdDelta( idBitMsg &msg, const usercmd_t &cmd, con msg.WriteLong( cmd.gameTime ); msg.WriteByte( cmd.buttons ); - msg.WriteShort( cmd.mx ); + msg.WriteShort( cmd.mx ); msg.WriteShort( cmd.my ); msg.WriteChar( cmd.forwardmove ); msg.WriteChar( cmd.rightmove ); @@ -236,8 +236,8 @@ void idAsyncNetwork::ReadUserCmdDelta( const idBitMsg &msg, usercmd_t &cmd, cons } cmd.gameTime = msg.ReadLong(); - cmd.buttons = msg.ReadByte(); - cmd.mx = msg.ReadShort(); + cmd.buttons = msg.ReadByte(); + cmd.mx = msg.ReadShort(); cmd.my = msg.ReadShort(); cmd.forwardmove = msg.ReadChar(); cmd.rightmove = msg.ReadChar(); @@ -434,7 +434,7 @@ void idAsyncNetwork::Kick_f( const idCmdArgs &args ) { return; } iclient = atoi( clientId ); - + if ( server.GetLocalClientNum() == iclient ) { common->Printf( "can't kick the host\n" ); return; @@ -458,7 +458,7 @@ idAsyncNetwork::CheckNewVersion_f ================== */ void idAsyncNetwork::CheckNewVersion_f( const idCmdArgs &args ) { - client.SendVersionCheck(); + client.SendVersionCheck(); } /* @@ -508,6 +508,5 @@ void idAsyncNetwork::BuildInvalidKeyMsg( idStr &msg, bool valid[ 2 ] ) { msg += common->GetLanguageDict()->GetString( "#str_07195" ); } msg += "\n"; - msg += common->GetLanguageDict()->GetString( "#str_04304" ); + msg += common->GetLanguageDict()->GetString( "#str_04304" ); } - diff --git a/neo/framework/async/AsyncNetwork.h b/neo/framework/async/AsyncNetwork.h index 26e55037..7d25c742 100644 --- a/neo/framework/async/AsyncNetwork.h +++ b/neo/framework/async/AsyncNetwork.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"). @@ -159,14 +159,14 @@ public: static bool GetMasterAddress( int index, netadr_t &adr ); // get the hardcoded idnet master, equivalent to GetMasterAddress( 0, .. ) static netadr_t GetMasterAddress( void ); - + static void GetNETServers( ); - + static void ExecuteSessionCommand( const char *sessCmd ); static idAsyncServer server; static idAsyncClient client; - + static idCVar verbose; // verbose output static idCVar allowCheats; // allow cheats static idCVar serverDedicated; // if set run a dedicated server diff --git a/neo/framework/async/AsyncServer.cpp b/neo/framework/async/AsyncServer.cpp index 591a3f05..2e02331a 100644 --- a/neo/framework/async/AsyncServer.cpp +++ b/neo/framework/async/AsyncServer.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"). @@ -1131,7 +1131,7 @@ void idAsyncServer::SendGameInitToClient( int clientNum ) { // clear the unsent fragments. might flood winsock but that's ok while( client.channel.UnsentFragmentsLeft() ) { client.channel.SendNextFragment( serverPort, serverTime ); - } + } msg.Init( msgBuf, sizeof( msgBuf ) ); msg.WriteLong( gameInitId ); @@ -1236,7 +1236,7 @@ void idAsyncServer::ProcessUnreliableClientMessage( int clientNum, const idBitMs // while loading a map the client may send empty messages to keep the connection alive if ( clientGameInitId == GAME_INIT_ID_MAP_LOAD ) { - if ( idAsyncNetwork::verbose.GetInteger() ) { + if ( idAsyncNetwork::verbose.GetInteger() ) { common->Printf( "ignore unreliable msg from client %d, gameInitId == ID_MAP_LOAD\n", clientNum ); } return; @@ -1402,7 +1402,7 @@ void idAsyncServer::ProcessAuthMessage( const idBitMsg &msg ) { authReply_t reply; authReplyMsg_t replyMsg = AUTH_REPLY_WAITING; idStr replyPrintMsg; - + reply = (authReply_t)msg.ReadByte(); if ( reply <= 0 || reply >= AUTH_MAXSTATES ) { common->DPrintf( "auth: invalid reply %d\n", reply ); @@ -1411,7 +1411,7 @@ void idAsyncServer::ProcessAuthMessage( const idBitMsg &msg ) { clientId = msg.ReadShort( ); msg.ReadNetadr( &client_from ); msg.ReadString( client_guid, sizeof( client_guid ) ); - if ( reply != AUTH_OK ) { + if ( reply != AUTH_OK ) { replyMsg = (authReplyMsg_t)msg.ReadByte(); if ( replyMsg <= 0 || replyMsg >= AUTH_REPLY_MAXSTATES ) { common->DPrintf( "auth: invalid reply msg %d\n", replyMsg ); @@ -1426,7 +1426,7 @@ void idAsyncServer::ProcessAuthMessage( const idBitMsg &msg ) { lastAuthTime = serverTime; // no message parsing below - + for ( i = 0; i < MAX_CHALLENGES; i++ ) { if ( !challenges[i].connected && challenges[ i ].clientId == clientId ) { // return if something is wrong @@ -1455,7 +1455,7 @@ void idAsyncServer::ProcessAuthMessage( const idBitMsg &msg ) { common->DWarning( "auth: challenge 0x%x %s authState %d != CDK_WAIT", challenges[ i ].challenge, Sys_NetAdrToString( challenges[ i ].address ), challenges[ i ].authState ); return; } - + idStr::snPrintf( challenges[ i ].guid, 12, client_guid ); if ( reply == AUTH_OK ) { challenges[ i ].authState = CDK_OK; @@ -1726,7 +1726,7 @@ void idAsyncServer::ProcessConnectMessage( const netadr_t from, const idBitMsg & msg = challenges[ ichallenge ].authReplyPrint.c_str(); } l_msg = common->GetLanguageDict()->GetString( msg ); - + common->DPrintf( "%s: %s\n", Sys_NetAdrToString( from ), l_msg ); if ( challenges[ ichallenge ].authReplyMsg == AUTH_REPLY_UNKNOWN || challenges[ ichallenge ].authReplyMsg == AUTH_REPLY_WAITING ) { @@ -1739,9 +1739,9 @@ void idAsyncServer::ProcessConnectMessage( const netadr_t from, const idBitMsg & outMsg.WriteString( "authrequired" ); serverPort.SendPacket( from, outMsg.GetData(), outMsg.GetSize() ); } - + PrintOOB( from, SERVER_PRINT_MISC, msg ); - + // update the guid in the challenges idStr::snPrintf( challenges[ ichallenge ].guid, sizeof( challenges[ ichallenge ].guid ), guid ); @@ -1754,7 +1754,7 @@ void idAsyncServer::ProcessConnectMessage( const netadr_t from, const idBitMsg & outMsg.WriteLong( ASYNC_PROTOCOL_VERSION ); outMsg.WriteNetadr( from ); outMsg.WriteLong( clientId ); - outMsg.WriteString( guid ); + outMsg.WriteString( guid ); // protocol 1.37 addition outMsg.WriteByte( fileSystem->RunningD3XP() ); serverPort.SendPacket( idAsyncNetwork::GetMasterAddress(), outMsg.GetData(), outMsg.GetSize() ); @@ -1867,7 +1867,7 @@ void idAsyncServer::ProcessConnectMessage( const netadr_t from, const idBitMsg & outMsg.WriteDeltaDict( sessLocal.mapSpawnData.serverInfo, NULL ); serverPort.SendPacket( from, outMsg.GetData(), outMsg.GetSize() ); - + InitClient( clientNum, clientId, clientRate ); clients[clientNum].gameInitSequence = 1; @@ -1970,7 +1970,7 @@ void idAsyncServer::ProcessReliablePure( int clientNum, const idBitMsg &msg ) { idBitMsg outMsg; byte msgBuf[MAX_MESSAGE_SIZE]; int clientGameInitId; - + clientGameInitId = msg.ReadLong(); if ( clientGameInitId != gameInitId ) { common->DPrintf( "client %d: ignoring reliable pure from an old gameInit (%d)\n", clientNum, clientGameInitId ); @@ -2106,7 +2106,7 @@ see (client) "getInfo" -> (server) "infoResponse" -> (client)ProcessGetInfoMessa void idAsyncServer::PrintLocalServerInfo( void ) { int i; - common->Printf( "server '%s' IP = %s\nprotocol %d.%d OS mask 0x%x\n", + common->Printf( "server '%s' IP = %s\nprotocol %d.%d OS mask 0x%x\n", sessLocal.mapSpawnData.serverInfo.GetString( "si_name" ), Sys_NetAdrToString( serverPort.GetAdr() ), ASYNC_PROTOCOL_MAJOR, @@ -2170,10 +2170,10 @@ bool idAsyncServer::ConnectionlessMessage( const netadr_t from, const idBitMsg & } // download request - if ( idStr::Icmp( string, "downloadRequest" ) == 0 ) { + if ( idStr::Icmp( string, "downloadRequest" ) == 0 ) { ProcessDownloadRequestMessage( from, msg ); } - + // auth server if ( idStr::Icmp( string, "auth" ) == 0 ) { if ( !Sys_CompareNetAdrBase( from, idAsyncNetwork::GetMasterAddress() ) ) { @@ -2244,7 +2244,7 @@ bool idAsyncServer::ProcessMessage( const netadr_t from, idBitMsg &msg ) { return false; } - + // if we received a sequenced packet from an address we don't recognize, // send an out of band disconnect packet to it outMsg.Init( msgBuf, sizeof( msgBuf ) ); @@ -2308,7 +2308,7 @@ void idAsyncServer::SendReliableGameMessageExcluding( int clientNum, const idBit continue; } SendReliableMessage( i, outMsg ); - } + } } /* @@ -2389,7 +2389,7 @@ void idAsyncServer::RunFrame( void ) { ProcessConnectionLessMessages(); return; } - + gameTimeResidual += msec; // spin in place processing incoming packets until enough time lapsed to run a new game frame @@ -2515,7 +2515,7 @@ void idAsyncServer::RunFrame( void ) { // dedicated will verbose to console if ( idAsyncNetwork::serverDedicated.GetBool() && serverTime >= nextAsyncStatsTime ) { - common->Printf( "delay = %d msec, total outgoing rate = %d KB/s, total incoming rate = %d KB/s\n", GetDelay(), + common->Printf( "delay = %d msec, total outgoing rate = %d KB/s, total incoming rate = %d KB/s\n", GetDelay(), GetOutgoingRate() >> 10, GetIncomingRate() >> 10 ); for ( i = 0; i < MAX_ASYNC_CLIENTS; i++ ) { @@ -2698,7 +2698,7 @@ void idAsyncServer::ProcessDownloadRequestMessage( const netadr_t from, const id common->DPrintf( "client %s: got download request message, not in CDK_PUREWAIT\n", Sys_NetAdrToString( from ) ); return; } - + // the first token of the pak names list passed to the game will be empty if no game pak is requested dlGamePak = msg.ReadLong(); if ( dlGamePak ) { @@ -2758,7 +2758,7 @@ void idAsyncServer::ProcessDownloadRequestMessage( const netadr_t from, const id if ( next ) { *next = '\0'; } - + if ( type == 0 ) { type = atoi( token ); } else if ( type == SERVER_DL_REDIRECT ) { @@ -2773,7 +2773,7 @@ void idAsyncServer::ProcessDownloadRequestMessage( const netadr_t from, const id common->DPrintf( "wrong op type %d\n", type ); next = token = NULL; } - + if ( next ) { token = next + 1; next = strchr( token, ';' ); @@ -2785,10 +2785,10 @@ void idAsyncServer::ProcessDownloadRequestMessage( const netadr_t from, const id if ( type == SERVER_DL_LIST ) { int totalDlSize = 0; int numActualPaks = 0; - + // put the answer packet together - outMsg.WriteByte( SERVER_DL_LIST ); - + outMsg.WriteByte( SERVER_DL_LIST ); + tmpMsg.Init( tmpBuf, MAX_MESSAGE_SIZE ); for ( i = 0; i < pakURLs.Num(); i++ ) { @@ -2805,7 +2805,7 @@ void idAsyncServer::ProcessDownloadRequestMessage( const netadr_t from, const id tmpMsg.WriteString( pakURLs[ i ] ); tmpMsg.WriteLong( dlSize[ i ] ); } - + // keep last 5 bytes for an 'end of message' - SERVER_PAK_END and the totalDlSize long if ( outMsg.GetRemainingSpace() - tmpMsg.GetSize() > 5 ) { outMsg.WriteData( tmpMsg.GetData(), tmpMsg.GetSize() ); diff --git a/neo/framework/async/AsyncServer.h b/neo/framework/async/AsyncServer.h index 102a4698..6069948a 100644 --- a/neo/framework/async/AsyncServer.h +++ b/neo/framework/async/AsyncServer.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"). @@ -197,7 +197,7 @@ private: int gameTimeResidual; // left over time from previous frame netadr_t rconAddress; - + int nextHeartbeatTime; int nextAsyncStatsTime; diff --git a/neo/framework/async/MsgChannel.cpp b/neo/framework/async/MsgChannel.cpp index d5e63de3..a32d608a 100644 --- a/neo/framework/async/MsgChannel.cpp +++ b/neo/framework/async/MsgChannel.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/neo/framework/async/MsgChannel.h b/neo/framework/async/MsgChannel.h index 175e1f6d..4b552498 100644 --- a/neo/framework/async/MsgChannel.h +++ b/neo/framework/async/MsgChannel.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/neo/framework/async/NetworkSystem.cpp b/neo/framework/async/NetworkSystem.cpp index 3d28b137..473df7ea 100644 --- a/neo/framework/async/NetworkSystem.cpp +++ b/neo/framework/async/NetworkSystem.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/neo/framework/async/NetworkSystem.h b/neo/framework/async/NetworkSystem.h index c0cceedf..4d5dc261 100644 --- a/neo/framework/async/NetworkSystem.h +++ b/neo/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/neo/framework/async/ServerScan.cpp b/neo/framework/async/ServerScan.cpp index e6bacdba..7749599b 100644 --- a/neo/framework/async/ServerScan.cpp +++ b/neo/framework/async/ServerScan.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,7 +108,7 @@ void idServerScan::Shutdown( ) { idServerScan::SetupLANScan ================ */ -void idServerScan::SetupLANScan( ) { +void idServerScan::SetupLANScan( ) { Clear(); GUIUpdateSelected(); scan_state = LAN_SCAN; @@ -134,7 +134,7 @@ int idServerScan::InfoResponse( networkServer_t &server ) { return false; } - if ( scan_state == NET_SCAN ) { + if ( scan_state == NET_SCAN ) { const idKeyValue *info = net_info.FindKey( serv.c_str() ); if ( !info ) { common->DPrintf( "idServerScan::InfoResponse NET_SCAN: reply from unknown %s\n", serv.c_str() ); @@ -188,11 +188,11 @@ idServerScan::AddServer */ void idServerScan::AddServer( int id, const char *srv ) { inServer_t s; - + incoming_net = true; incoming_lastTime = Sys_Milliseconds() + INCOMING_TIMEOUT; s.id = id; - + // using IPs, not hosts if ( !Sys_StringToNetAdr( srv, &s.adr, false ) ) { common->DPrintf( "idServerScan::AddServer: failed to parse server %s\n", srv ); @@ -201,7 +201,7 @@ void idServerScan::AddServer( int id, const char *srv ) { if ( !s.adr.port ) { s.adr.port = PORT_SERVER; } - + net_servers.Append( s ); } @@ -215,7 +215,7 @@ void idServerScan::EndServers( ) { l_serverScan = this; m_sortedServers.Sort( idServerScan::Cmp ); ApplyFilter(); -} +} /* ================ @@ -267,7 +267,7 @@ void idServerScan::NetScan( ) { scan_state = NET_SCAN; challenge++; - + idList::Clear(); m_sortedServers.Clear(); cur_info = 0; @@ -275,7 +275,7 @@ void idServerScan::NetScan( ) { listGUI->Clear(); GUIUpdateSelected(); common->DPrintf( "NetScan with challenge %d\n", challenge ); - + while ( cur_info < Min( net_servers.Num(), MAX_PINGREQUESTS ) ) { netadr_t serv = net_servers[ cur_info ].adr; EmitGetInfo( serv ); @@ -293,18 +293,18 @@ idServerScan::ServerScanFrame void idServerScan::RunFrame( ) { if ( scan_state == IDLE ) { return; - } - + } + if ( scan_state == WAIT_ON_INIT ) { if ( Sys_Milliseconds() >= endWaitTime ) { scan_state = IDLE; NetScan(); } return; - } - + } + int timeout_limit = Sys_Milliseconds() - REPLY_TIMEOUT; - + if ( scan_state == LAN_SCAN ) { if ( timeout_limit > lan_pingtime ) { common->Printf( "Scanned for servers on the LAN\n" ); @@ -312,9 +312,9 @@ void idServerScan::RunFrame( ) { } return; } - + // if scan_state == NET_SCAN - + // check for timeouts int i = 0; while ( i < net_info.GetNumKeyVals() ) { @@ -325,7 +325,7 @@ void idServerScan::RunFrame( ) { i++; } } - + // possibly send more queries while ( cur_info < net_servers.Num() && net_info.GetNumKeyVals() < MAX_PINGREQUESTS ) { netadr_t serv = net_servers[ cur_info ].adr; @@ -334,7 +334,7 @@ void idServerScan::RunFrame( ) { net_info.SetInt( Sys_NetAdrToString( serv ), cur_info ); cur_info++; } - + // update state if ( ( !incoming_net || ( incoming_useTimeout && Sys_Milliseconds() > incoming_lastTime ) ) && net_info.GetNumKeyVals() == 0 ) { EndServers(); @@ -636,4 +636,3 @@ void idServerScan::SetSorting( serverSort_t sort ) { // trigger a redraw ApplyFilter(); } - diff --git a/neo/framework/async/ServerScan.h b/neo/framework/async/ServerScan.h index f8a4f2c1..6d958fcb 100644 --- a/neo/framework/async/ServerScan.h +++ b/neo/framework/async/ServerScan.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 @@ typedef struct { short pings[ MAX_ASYNC_CLIENTS ]; int rate[ MAX_ASYNC_CLIENTS ]; int OSMask; - int challenge; + int challenge; } networkServer_t; typedef enum { @@ -70,9 +70,9 @@ typedef enum { } serverSort_t; class idServerScan : public idList { -public: +public: idServerScan( ); - + int InfoResponse( networkServer_t &server ); // add an internet server - ( store a numeric id along with it ) @@ -92,7 +92,7 @@ public: // called each game frame. Updates the scanner state, takes care of ongoing scans void RunFrame( ); - + typedef enum { IDLE = 0, WAIT_ON_INIT, @@ -102,7 +102,7 @@ public: scan_state_t GetState() { return scan_state; } void SetState( scan_state_t ); - + bool GetBestPing( networkServer_t &serv ); // prepare for a LAN scan. idAsyncClient does the network job (UDP broadcast), we do the storage @@ -122,23 +122,23 @@ public: int GetChallenge( ); private: - static const int MAX_PINGREQUESTS = 32; // how many servers to query at once - static const int REPLY_TIMEOUT = 999; // how long should we wait for a reply from a game server + static const int MAX_PINGREQUESTS = 32; // how many servers to query at once + static const int REPLY_TIMEOUT = 999; // how long should we wait for a reply from a game server static const int INCOMING_TIMEOUT = 1500; // when we got an incoming server list, how long till we decide the list is done static const int REFRESH_START = 10000; // how long to wait when sending the initial refresh request scan_state_t scan_state; - + bool incoming_net; // set to true while new servers are fed through AddServer bool incoming_useTimeout; int incoming_lastTime; - + int lan_pingtime; // holds the time of LAN scan - + // servers we're waiting for a reply from // won't exceed MAX_PINGREQUESTS elements // holds index of net_servers elements, indexed by 'from' string - idDict net_info; + idDict net_info; idList net_servers; // where we are in net_servers list for getInfo emissions ( NET_SCAN only ) @@ -154,7 +154,7 @@ private: idStr screenshot; int challenge; // challenge for current scan - + int endWaitTime; // when to stop waiting on a port init private: diff --git a/neo/game/AF.cpp b/neo/game/AF.cpp index ff37d060..526c8cfd 100644 --- a/neo/game/AF.cpp +++ b/neo/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/neo/game/AF.h b/neo/game/AF.h index 754925df..63807073 100644 --- a/neo/game/AF.h +++ b/neo/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/neo/game/AFEntity.cpp b/neo/game/AFEntity.cpp index 86695ba7..31151309 100644 --- a/neo/game/AFEntity.cpp +++ b/neo/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/neo/game/AFEntity.h b/neo/game/AFEntity.h index d14400ea..f89a305e 100644 --- a/neo/game/AFEntity.h +++ b/neo/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/neo/game/Actor.cpp b/neo/game/Actor.cpp index 78f7b347..ec20ab76 100644 --- a/neo/game/Actor.cpp +++ b/neo/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/neo/game/Actor.h b/neo/game/Actor.h index c9811671..0c257027 100644 --- a/neo/game/Actor.h +++ b/neo/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/neo/game/BrittleFracture.cpp b/neo/game/BrittleFracture.cpp index 401b25b4..5a24871b 100644 --- a/neo/game/BrittleFracture.cpp +++ b/neo/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/neo/game/BrittleFracture.h b/neo/game/BrittleFracture.h index a90bfbd9..03622ef1 100644 --- a/neo/game/BrittleFracture.h +++ b/neo/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/neo/game/Camera.cpp b/neo/game/Camera.cpp index 965063ef..7d3665ad 100644 --- a/neo/game/Camera.cpp +++ b/neo/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/neo/game/Camera.h b/neo/game/Camera.h index 1146c88e..3d6016e8 100644 --- a/neo/game/Camera.h +++ b/neo/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/neo/game/EndLevel.cpp b/neo/game/EndLevel.cpp index 3794995c..21f1ec9f 100644 --- a/neo/game/EndLevel.cpp +++ b/neo/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/neo/game/EndLevel.h b/neo/game/EndLevel.h index 0157502d..b2d6b046 100644 --- a/neo/game/EndLevel.h +++ b/neo/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/neo/game/Entity.cpp b/neo/game/Entity.cpp index 03690938..b7d6896a 100644 --- a/neo/game/Entity.cpp +++ b/neo/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/neo/game/Entity.h b/neo/game/Entity.h index 379f3800..57e437f2 100644 --- a/neo/game/Entity.h +++ b/neo/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/neo/game/Fx.cpp b/neo/game/Fx.cpp index 8b93c6bb..6fc7e549 100644 --- a/neo/game/Fx.cpp +++ b/neo/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/neo/game/Fx.h b/neo/game/Fx.h index ca75c55d..f546d418 100644 --- a/neo/game/Fx.h +++ b/neo/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/neo/game/Game.h b/neo/game/Game.h index 15038c0c..a14c2c66 100644 --- a/neo/game/Game.h +++ b/neo/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/neo/game/GameEdit.cpp b/neo/game/GameEdit.cpp index f8f19c73..a5be11e2 100644 --- a/neo/game/GameEdit.cpp +++ b/neo/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/neo/game/GameEdit.h b/neo/game/GameEdit.h index 5fc74e58..4e63f67e 100644 --- a/neo/game/GameEdit.h +++ b/neo/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/neo/game/Game_local.cpp b/neo/game/Game_local.cpp index 02d6e229..a06d6e43 100644 --- a/neo/game/Game_local.cpp +++ b/neo/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/neo/game/Game_local.h b/neo/game/Game_local.h index fe84bbcb..bb0e4aae 100644 --- a/neo/game/Game_local.h +++ b/neo/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/neo/game/Game_network.cpp b/neo/game/Game_network.cpp index 5746dcc4..e2be04d6 100644 --- a/neo/game/Game_network.cpp +++ b/neo/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/neo/game/IK.cpp b/neo/game/IK.cpp index 3076dc3d..1844ba2e 100644 --- a/neo/game/IK.cpp +++ b/neo/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/neo/game/IK.h b/neo/game/IK.h index dbc4e373..2e71b813 100644 --- a/neo/game/IK.h +++ b/neo/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/neo/game/Item.cpp b/neo/game/Item.cpp index bccee6e4..fa0f28de 100644 --- a/neo/game/Item.cpp +++ b/neo/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/neo/game/Item.h b/neo/game/Item.h index 28c6c480..ac9e2092 100644 --- a/neo/game/Item.h +++ b/neo/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/neo/game/Light.cpp b/neo/game/Light.cpp index 98967e9c..c5a4cdf2 100644 --- a/neo/game/Light.cpp +++ b/neo/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/neo/game/Light.h b/neo/game/Light.h index 20d31e61..123c8f2f 100644 --- a/neo/game/Light.h +++ b/neo/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/neo/game/Misc.cpp b/neo/game/Misc.cpp index c0f110ee..0736877f 100644 --- a/neo/game/Misc.cpp +++ b/neo/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/neo/game/Misc.h b/neo/game/Misc.h index 619d66d7..1fda06f4 100644 --- a/neo/game/Misc.h +++ b/neo/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/neo/game/Moveable.cpp b/neo/game/Moveable.cpp index 0cf8b34b..a49468e3 100644 --- a/neo/game/Moveable.cpp +++ b/neo/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/neo/game/Moveable.h b/neo/game/Moveable.h index 4ec5dd06..71b96781 100644 --- a/neo/game/Moveable.h +++ b/neo/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/neo/game/Mover.cpp b/neo/game/Mover.cpp index 9d5f51cc..739b86f4 100644 --- a/neo/game/Mover.cpp +++ b/neo/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/neo/game/Mover.h b/neo/game/Mover.h index 650c632c..f72af1c2 100644 --- a/neo/game/Mover.h +++ b/neo/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/neo/game/MultiplayerGame.cpp b/neo/game/MultiplayerGame.cpp index 70bbfc10..8d740af9 100644 --- a/neo/game/MultiplayerGame.cpp +++ b/neo/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/neo/game/MultiplayerGame.h b/neo/game/MultiplayerGame.h index a27de12f..5275ab3b 100644 --- a/neo/game/MultiplayerGame.h +++ b/neo/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/neo/game/Player.cpp b/neo/game/Player.cpp index e58bef29..f33d10fd 100644 --- a/neo/game/Player.cpp +++ b/neo/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/neo/game/Player.h b/neo/game/Player.h index d50b410d..23377d0f 100644 --- a/neo/game/Player.h +++ b/neo/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/neo/game/PlayerIcon.cpp b/neo/game/PlayerIcon.cpp index 1e64fa15..33bfa453 100644 --- a/neo/game/PlayerIcon.cpp +++ b/neo/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/neo/game/PlayerIcon.h b/neo/game/PlayerIcon.h index bee94165..9890d000 100644 --- a/neo/game/PlayerIcon.h +++ b/neo/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/neo/game/PlayerView.cpp b/neo/game/PlayerView.cpp index ce6548fb..93643392 100644 --- a/neo/game/PlayerView.cpp +++ b/neo/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/neo/game/PlayerView.h b/neo/game/PlayerView.h index 04a40852..bb7c9b01 100644 --- a/neo/game/PlayerView.h +++ b/neo/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/neo/game/Projectile.cpp b/neo/game/Projectile.cpp index 50fdbdaa..d7cfac25 100644 --- a/neo/game/Projectile.cpp +++ b/neo/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/neo/game/Projectile.h b/neo/game/Projectile.h index c43e6fdb..ed68c437 100644 --- a/neo/game/Projectile.h +++ b/neo/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/neo/game/Pvs.cpp b/neo/game/Pvs.cpp index 3caa1821..f8bd5d04 100644 --- a/neo/game/Pvs.cpp +++ b/neo/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/neo/game/Pvs.h b/neo/game/Pvs.h index 1d24c2fa..46f004d9 100644 --- a/neo/game/Pvs.h +++ b/neo/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/neo/game/SecurityCamera.cpp b/neo/game/SecurityCamera.cpp index dfd8bd00..44df1aab 100644 --- a/neo/game/SecurityCamera.cpp +++ b/neo/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/neo/game/SecurityCamera.h b/neo/game/SecurityCamera.h index cf9ab3ec..02600df6 100644 --- a/neo/game/SecurityCamera.h +++ b/neo/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/neo/game/SmokeParticles.cpp b/neo/game/SmokeParticles.cpp index d4b17841..6a64d0ff 100644 --- a/neo/game/SmokeParticles.cpp +++ b/neo/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/neo/game/SmokeParticles.h b/neo/game/SmokeParticles.h index bee7e2df..4fcda97a 100644 --- a/neo/game/SmokeParticles.h +++ b/neo/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/neo/game/Sound.cpp b/neo/game/Sound.cpp index c1d80442..949324dc 100644 --- a/neo/game/Sound.cpp +++ b/neo/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/neo/game/Sound.h b/neo/game/Sound.h index 1bc291b1..55d84973 100644 --- a/neo/game/Sound.h +++ b/neo/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/neo/game/Target.cpp b/neo/game/Target.cpp index 3ed59457..018ed16e 100644 --- a/neo/game/Target.cpp +++ b/neo/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/neo/game/Target.h b/neo/game/Target.h index fbfb0d11..9131c2f4 100644 --- a/neo/game/Target.h +++ b/neo/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/neo/game/Trigger.cpp b/neo/game/Trigger.cpp index 29bfa4a3..df7cacc0 100644 --- a/neo/game/Trigger.cpp +++ b/neo/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/neo/game/Trigger.h b/neo/game/Trigger.h index f75be162..9f20952a 100644 --- a/neo/game/Trigger.h +++ b/neo/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/neo/game/Weapon.cpp b/neo/game/Weapon.cpp index e5595719..40f6daa7 100644 --- a/neo/game/Weapon.cpp +++ b/neo/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/neo/game/Weapon.h b/neo/game/Weapon.h index 2ee67c0e..c214f144 100644 --- a/neo/game/Weapon.h +++ b/neo/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/neo/game/WorldSpawn.cpp b/neo/game/WorldSpawn.cpp index 0c368c44..9e2ce5d3 100644 --- a/neo/game/WorldSpawn.cpp +++ b/neo/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/neo/game/WorldSpawn.h b/neo/game/WorldSpawn.h index 7b65dddc..bf882439 100644 --- a/neo/game/WorldSpawn.h +++ b/neo/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/neo/game/ai/AAS.cpp b/neo/game/ai/AAS.cpp index 1abb78d5..9fd1ac88 100644 --- a/neo/game/ai/AAS.cpp +++ b/neo/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/neo/game/ai/AAS.h b/neo/game/ai/AAS.h index a1e22ddc..8f272b46 100644 --- a/neo/game/ai/AAS.h +++ b/neo/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/neo/game/ai/AAS_debug.cpp b/neo/game/ai/AAS_debug.cpp index 56057121..0c4ba482 100644 --- a/neo/game/ai/AAS_debug.cpp +++ b/neo/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/neo/game/ai/AAS_local.h b/neo/game/ai/AAS_local.h index afab2ded..5b9af242 100644 --- a/neo/game/ai/AAS_local.h +++ b/neo/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/neo/game/ai/AAS_pathing.cpp b/neo/game/ai/AAS_pathing.cpp index 07a57ef5..7805c0a7 100644 --- a/neo/game/ai/AAS_pathing.cpp +++ b/neo/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/neo/game/ai/AAS_routing.cpp b/neo/game/ai/AAS_routing.cpp index f44631aa..acb59ac9 100644 --- a/neo/game/ai/AAS_routing.cpp +++ b/neo/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/neo/game/ai/AI.cpp b/neo/game/ai/AI.cpp index 2fa6f42d..a097c828 100644 --- a/neo/game/ai/AI.cpp +++ b/neo/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/neo/game/ai/AI.h b/neo/game/ai/AI.h index 882f185d..aeb4f373 100644 --- a/neo/game/ai/AI.h +++ b/neo/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/neo/game/ai/AI_Vagary.cpp b/neo/game/ai/AI_Vagary.cpp index 6bcb4f02..24c7a861 100644 --- a/neo/game/ai/AI_Vagary.cpp +++ b/neo/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/neo/game/ai/AI_events.cpp b/neo/game/ai/AI_events.cpp index 87cb7de2..fc96076f 100644 --- a/neo/game/ai/AI_events.cpp +++ b/neo/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/neo/game/ai/AI_pathing.cpp b/neo/game/ai/AI_pathing.cpp index 1af38900..c67135a3 100644 --- a/neo/game/ai/AI_pathing.cpp +++ b/neo/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/neo/game/anim/Anim.cpp b/neo/game/anim/Anim.cpp index 44de2372..39043428 100644 --- a/neo/game/anim/Anim.cpp +++ b/neo/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/neo/game/anim/Anim.h b/neo/game/anim/Anim.h index b3ccdfcb..b58d44fa 100644 --- a/neo/game/anim/Anim.h +++ b/neo/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/neo/game/anim/Anim_Blend.cpp b/neo/game/anim/Anim_Blend.cpp index 93e9dd0e..db336587 100644 --- a/neo/game/anim/Anim_Blend.cpp +++ b/neo/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/neo/game/anim/Anim_Import.cpp b/neo/game/anim/Anim_Import.cpp index ef3b76cc..cf97f92b 100644 --- a/neo/game/anim/Anim_Import.cpp +++ b/neo/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/neo/game/anim/Anim_Testmodel.cpp b/neo/game/anim/Anim_Testmodel.cpp index b23964df..e64251d2 100644 --- a/neo/game/anim/Anim_Testmodel.cpp +++ b/neo/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/neo/game/anim/Anim_Testmodel.h b/neo/game/anim/Anim_Testmodel.h index a752577d..e63a7c49 100644 --- a/neo/game/anim/Anim_Testmodel.h +++ b/neo/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/neo/game/gamesys/Callbacks.cpp b/neo/game/gamesys/Callbacks.cpp index 0f7f7f60..caacc102 100644 --- a/neo/game/gamesys/Callbacks.cpp +++ b/neo/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/neo/game/gamesys/Class.cpp b/neo/game/gamesys/Class.cpp index 617a50b3..7c39cb0b 100644 --- a/neo/game/gamesys/Class.cpp +++ b/neo/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/neo/game/gamesys/Class.h b/neo/game/gamesys/Class.h index 7557a90a..21e6873b 100644 --- a/neo/game/gamesys/Class.h +++ b/neo/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/neo/game/gamesys/DebugGraph.cpp b/neo/game/gamesys/DebugGraph.cpp index 9c28470c..f79c6274 100644 --- a/neo/game/gamesys/DebugGraph.cpp +++ b/neo/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/neo/game/gamesys/DebugGraph.h b/neo/game/gamesys/DebugGraph.h index 00b357ba..0729d498 100644 --- a/neo/game/gamesys/DebugGraph.h +++ b/neo/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/neo/game/gamesys/Event.cpp b/neo/game/gamesys/Event.cpp index 6753e8e5..49dc2501 100644 --- a/neo/game/gamesys/Event.cpp +++ b/neo/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/neo/game/gamesys/Event.h b/neo/game/gamesys/Event.h index 4150202f..a265a6f8 100644 --- a/neo/game/gamesys/Event.h +++ b/neo/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/neo/game/gamesys/NoGameTypeInfo.h b/neo/game/gamesys/NoGameTypeInfo.h index 23d46523..5b5618e5 100644 --- a/neo/game/gamesys/NoGameTypeInfo.h +++ b/neo/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/neo/game/gamesys/SaveGame.cpp b/neo/game/gamesys/SaveGame.cpp index ea8a559b..432f19fc 100644 --- a/neo/game/gamesys/SaveGame.cpp +++ b/neo/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/neo/game/gamesys/SaveGame.h b/neo/game/gamesys/SaveGame.h index fc6f2e4a..7b3be8e6 100644 --- a/neo/game/gamesys/SaveGame.h +++ b/neo/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/neo/game/gamesys/SysCmds.cpp b/neo/game/gamesys/SysCmds.cpp index 32a79e0f..1e4dc88b 100644 --- a/neo/game/gamesys/SysCmds.cpp +++ b/neo/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/neo/game/gamesys/SysCmds.h b/neo/game/gamesys/SysCmds.h index dbba941e..2b1abcd8 100644 --- a/neo/game/gamesys/SysCmds.h +++ b/neo/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/neo/game/gamesys/SysCvar.cpp b/neo/game/gamesys/SysCvar.cpp index a2727ddb..93e7b49c 100644 --- a/neo/game/gamesys/SysCvar.cpp +++ b/neo/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/neo/game/gamesys/SysCvar.h b/neo/game/gamesys/SysCvar.h index 9fd12ade..bcecd1db 100644 --- a/neo/game/gamesys/SysCvar.h +++ b/neo/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/neo/game/gamesys/TypeInfo.cpp b/neo/game/gamesys/TypeInfo.cpp index 94b67431..9e711923 100644 --- a/neo/game/gamesys/TypeInfo.cpp +++ b/neo/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/neo/game/gamesys/TypeInfo.h b/neo/game/gamesys/TypeInfo.h index 36717d04..cd47bfda 100644 --- a/neo/game/gamesys/TypeInfo.h +++ b/neo/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/neo/game/physics/Clip.cpp b/neo/game/physics/Clip.cpp index 9ee75184..e6a30fe0 100644 --- a/neo/game/physics/Clip.cpp +++ b/neo/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/neo/game/physics/Clip.h b/neo/game/physics/Clip.h index 7d5d857a..1d79c84a 100644 --- a/neo/game/physics/Clip.h +++ b/neo/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/neo/game/physics/Force.cpp b/neo/game/physics/Force.cpp index e06d97f4..a835a555 100644 --- a/neo/game/physics/Force.cpp +++ b/neo/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/neo/game/physics/Force.h b/neo/game/physics/Force.h index bf178751..ff6f4481 100644 --- a/neo/game/physics/Force.h +++ b/neo/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/neo/game/physics/Force_Constant.cpp b/neo/game/physics/Force_Constant.cpp index 8ef517d7..2b15096c 100644 --- a/neo/game/physics/Force_Constant.cpp +++ b/neo/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/neo/game/physics/Force_Constant.h b/neo/game/physics/Force_Constant.h index 875bc3f8..0466b3a0 100644 --- a/neo/game/physics/Force_Constant.h +++ b/neo/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/neo/game/physics/Force_Drag.cpp b/neo/game/physics/Force_Drag.cpp index a21ed778..ee41c7f7 100644 --- a/neo/game/physics/Force_Drag.cpp +++ b/neo/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/neo/game/physics/Force_Drag.h b/neo/game/physics/Force_Drag.h index 3979716d..97465ae3 100644 --- a/neo/game/physics/Force_Drag.h +++ b/neo/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/neo/game/physics/Force_Field.cpp b/neo/game/physics/Force_Field.cpp index 44248d72..23f50af9 100644 --- a/neo/game/physics/Force_Field.cpp +++ b/neo/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/neo/game/physics/Force_Field.h b/neo/game/physics/Force_Field.h index 4b47cadb..e3bfc837 100644 --- a/neo/game/physics/Force_Field.h +++ b/neo/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/neo/game/physics/Force_Spring.cpp b/neo/game/physics/Force_Spring.cpp index 1df7d11a..93a6d19b 100644 --- a/neo/game/physics/Force_Spring.cpp +++ b/neo/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/neo/game/physics/Force_Spring.h b/neo/game/physics/Force_Spring.h index e87a8638..06db7063 100644 --- a/neo/game/physics/Force_Spring.h +++ b/neo/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/neo/game/physics/Physics.cpp b/neo/game/physics/Physics.cpp index 3d2e8f4d..bb487047 100644 --- a/neo/game/physics/Physics.cpp +++ b/neo/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/neo/game/physics/Physics.h b/neo/game/physics/Physics.h index 92d3c97f..3d70adb9 100644 --- a/neo/game/physics/Physics.h +++ b/neo/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/neo/game/physics/Physics_AF.cpp b/neo/game/physics/Physics_AF.cpp index 924e2c56..13f3e593 100644 --- a/neo/game/physics/Physics_AF.cpp +++ b/neo/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/neo/game/physics/Physics_AF.h b/neo/game/physics/Physics_AF.h index 2dc51794..4d712b1f 100644 --- a/neo/game/physics/Physics_AF.h +++ b/neo/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/neo/game/physics/Physics_Actor.cpp b/neo/game/physics/Physics_Actor.cpp index 6bdb726e..52372725 100644 --- a/neo/game/physics/Physics_Actor.cpp +++ b/neo/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/neo/game/physics/Physics_Actor.h b/neo/game/physics/Physics_Actor.h index 3c0b0f4e..0e4fec1a 100644 --- a/neo/game/physics/Physics_Actor.h +++ b/neo/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/neo/game/physics/Physics_Base.cpp b/neo/game/physics/Physics_Base.cpp index 57a85188..ee421c77 100644 --- a/neo/game/physics/Physics_Base.cpp +++ b/neo/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/neo/game/physics/Physics_Base.h b/neo/game/physics/Physics_Base.h index 6ff655c4..a0ac05b1 100644 --- a/neo/game/physics/Physics_Base.h +++ b/neo/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/neo/game/physics/Physics_Monster.cpp b/neo/game/physics/Physics_Monster.cpp index f9859125..c5b919c2 100644 --- a/neo/game/physics/Physics_Monster.cpp +++ b/neo/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/neo/game/physics/Physics_Monster.h b/neo/game/physics/Physics_Monster.h index 9ae7303f..54923242 100644 --- a/neo/game/physics/Physics_Monster.h +++ b/neo/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/neo/game/physics/Physics_Parametric.cpp b/neo/game/physics/Physics_Parametric.cpp index 3628d73d..2208b94d 100644 --- a/neo/game/physics/Physics_Parametric.cpp +++ b/neo/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/neo/game/physics/Physics_Parametric.h b/neo/game/physics/Physics_Parametric.h index b13f48bb..3cbd6a5c 100644 --- a/neo/game/physics/Physics_Parametric.h +++ b/neo/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/neo/game/physics/Physics_Player.cpp b/neo/game/physics/Physics_Player.cpp index b32e6d5c..bc042d31 100644 --- a/neo/game/physics/Physics_Player.cpp +++ b/neo/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/neo/game/physics/Physics_Player.h b/neo/game/physics/Physics_Player.h index 494fdb20..f3aa8521 100644 --- a/neo/game/physics/Physics_Player.h +++ b/neo/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/neo/game/physics/Physics_RigidBody.cpp b/neo/game/physics/Physics_RigidBody.cpp index 850c8fcb..aaefd041 100644 --- a/neo/game/physics/Physics_RigidBody.cpp +++ b/neo/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/neo/game/physics/Physics_RigidBody.h b/neo/game/physics/Physics_RigidBody.h index bce2009e..1e9874d1 100644 --- a/neo/game/physics/Physics_RigidBody.h +++ b/neo/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/neo/game/physics/Physics_Static.cpp b/neo/game/physics/Physics_Static.cpp index 0c65ec76..4ff07e2c 100644 --- a/neo/game/physics/Physics_Static.cpp +++ b/neo/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/neo/game/physics/Physics_Static.h b/neo/game/physics/Physics_Static.h index 650d2367..e8002e15 100644 --- a/neo/game/physics/Physics_Static.h +++ b/neo/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/neo/game/physics/Physics_StaticMulti.cpp b/neo/game/physics/Physics_StaticMulti.cpp index 57f840ec..7b87b5b0 100644 --- a/neo/game/physics/Physics_StaticMulti.cpp +++ b/neo/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/neo/game/physics/Physics_StaticMulti.h b/neo/game/physics/Physics_StaticMulti.h index 65d7dd39..a6055f92 100644 --- a/neo/game/physics/Physics_StaticMulti.h +++ b/neo/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/neo/game/physics/Push.cpp b/neo/game/physics/Push.cpp index 1b908330..3cb5c34c 100644 --- a/neo/game/physics/Push.cpp +++ b/neo/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/neo/game/physics/Push.h b/neo/game/physics/Push.h index 9a38dce9..b122d016 100644 --- a/neo/game/physics/Push.h +++ b/neo/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/neo/game/script/Script_Compiler.cpp b/neo/game/script/Script_Compiler.cpp index 2f94bad8..f427bcf1 100644 --- a/neo/game/script/Script_Compiler.cpp +++ b/neo/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/neo/game/script/Script_Compiler.h b/neo/game/script/Script_Compiler.h index 3e26d8ec..f943379f 100644 --- a/neo/game/script/Script_Compiler.h +++ b/neo/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/neo/game/script/Script_Interpreter.cpp b/neo/game/script/Script_Interpreter.cpp index 04484b3b..921ee1c7 100644 --- a/neo/game/script/Script_Interpreter.cpp +++ b/neo/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/neo/game/script/Script_Interpreter.h b/neo/game/script/Script_Interpreter.h index 4c305796..add78af8 100644 --- a/neo/game/script/Script_Interpreter.h +++ b/neo/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/neo/game/script/Script_Program.cpp b/neo/game/script/Script_Program.cpp index 2d8a8b97..a2fdefae 100644 --- a/neo/game/script/Script_Program.cpp +++ b/neo/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/neo/game/script/Script_Program.h b/neo/game/script/Script_Program.h index a82f4f24..e9a04f9f 100644 --- a/neo/game/script/Script_Program.h +++ b/neo/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/neo/game/script/Script_Thread.cpp b/neo/game/script/Script_Thread.cpp index 62bb45ac..e05d181f 100644 --- a/neo/game/script/Script_Thread.cpp +++ b/neo/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/neo/game/script/Script_Thread.h b/neo/game/script/Script_Thread.h index d5b2b208..232f6cc4 100644 --- a/neo/game/script/Script_Thread.h +++ b/neo/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/neo/idlib/Base64.cpp b/neo/idlib/Base64.cpp index 1274e3d6..ce024b84 100644 --- a/neo/idlib/Base64.cpp +++ b/neo/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/neo/idlib/Base64.h b/neo/idlib/Base64.h index 9cd6142c..632d0119 100644 --- a/neo/idlib/Base64.h +++ b/neo/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/neo/idlib/BitMsg.cpp b/neo/idlib/BitMsg.cpp index af28bf2d..f6f3b7f2 100644 --- a/neo/idlib/BitMsg.cpp +++ b/neo/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/neo/idlib/BitMsg.h b/neo/idlib/BitMsg.h index e162fac7..ad727fe1 100644 --- a/neo/idlib/BitMsg.h +++ b/neo/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/neo/idlib/CmdArgs.cpp b/neo/idlib/CmdArgs.cpp index 68c55d4e..34d28894 100644 --- a/neo/idlib/CmdArgs.cpp +++ b/neo/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/neo/idlib/CmdArgs.h b/neo/idlib/CmdArgs.h index df2b8d86..61a32db4 100644 --- a/neo/idlib/CmdArgs.h +++ b/neo/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/neo/idlib/Dict.cpp b/neo/idlib/Dict.cpp index 68f436aa..c49a5cae 100644 --- a/neo/idlib/Dict.cpp +++ b/neo/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/neo/idlib/Dict.h b/neo/idlib/Dict.h index e751e872..29b9dd33 100644 --- a/neo/idlib/Dict.h +++ b/neo/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/neo/idlib/Heap.cpp b/neo/idlib/Heap.cpp index a3a8bb04..0aca5c21 100644 --- a/neo/idlib/Heap.cpp +++ b/neo/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/neo/idlib/Heap.h b/neo/idlib/Heap.h index 11ea4d5f..f02d3b59 100644 --- a/neo/idlib/Heap.h +++ b/neo/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/neo/idlib/LangDict.cpp b/neo/idlib/LangDict.cpp index 9c06d91a..426d9096 100644 --- a/neo/idlib/LangDict.cpp +++ b/neo/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/neo/idlib/LangDict.h b/neo/idlib/LangDict.h index eccb1819..a1cd1f5a 100644 --- a/neo/idlib/LangDict.h +++ b/neo/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/neo/idlib/Lexer.cpp b/neo/idlib/Lexer.cpp index c34676c7..99165229 100644 --- a/neo/idlib/Lexer.cpp +++ b/neo/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/neo/idlib/Lexer.h b/neo/idlib/Lexer.h index c0e4d167..ba56b156 100644 --- a/neo/idlib/Lexer.h +++ b/neo/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/neo/idlib/Lib.cpp b/neo/idlib/Lib.cpp index 4bfe2028..08b7e43e 100644 --- a/neo/idlib/Lib.cpp +++ b/neo/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/neo/idlib/Lib.h b/neo/idlib/Lib.h index 9261ad9a..0a013c7d 100644 --- a/neo/idlib/Lib.h +++ b/neo/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/neo/idlib/MapFile.cpp b/neo/idlib/MapFile.cpp index 646ce0b5..fe896f06 100644 --- a/neo/idlib/MapFile.cpp +++ b/neo/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/neo/idlib/MapFile.h b/neo/idlib/MapFile.h index 4f6b62eb..ba5d3577 100644 --- a/neo/idlib/MapFile.h +++ b/neo/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/neo/idlib/Parser.cpp b/neo/idlib/Parser.cpp index 9a52ceec..927e3d3a 100644 --- a/neo/idlib/Parser.cpp +++ b/neo/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/neo/idlib/Parser.h b/neo/idlib/Parser.h index 8d69c2ff..6843b053 100644 --- a/neo/idlib/Parser.h +++ b/neo/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/neo/idlib/Str.cpp b/neo/idlib/Str.cpp index 896604b0..bc54504c 100644 --- a/neo/idlib/Str.cpp +++ b/neo/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/neo/idlib/Str.h b/neo/idlib/Str.h index cc8f2581..ec879446 100644 --- a/neo/idlib/Str.h +++ b/neo/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/neo/idlib/Timer.cpp b/neo/idlib/Timer.cpp index 57733ec4..51a3fe03 100644 --- a/neo/idlib/Timer.cpp +++ b/neo/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/neo/idlib/Timer.h b/neo/idlib/Timer.h index 3d69295b..39110c67 100644 --- a/neo/idlib/Timer.h +++ b/neo/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/neo/idlib/Token.cpp b/neo/idlib/Token.cpp index f1560136..73fd1630 100644 --- a/neo/idlib/Token.cpp +++ b/neo/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/neo/idlib/Token.h b/neo/idlib/Token.h index c369a5e2..af6df0c3 100644 --- a/neo/idlib/Token.h +++ b/neo/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/neo/idlib/bv/Bounds.cpp b/neo/idlib/bv/Bounds.cpp index 160fda50..10207ce4 100644 --- a/neo/idlib/bv/Bounds.cpp +++ b/neo/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/neo/idlib/bv/Bounds.h b/neo/idlib/bv/Bounds.h index 96e93a46..5fb97cc1 100644 --- a/neo/idlib/bv/Bounds.h +++ b/neo/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/neo/idlib/bv/Box.cpp b/neo/idlib/bv/Box.cpp index f616c94c..28acecf7 100644 --- a/neo/idlib/bv/Box.cpp +++ b/neo/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/neo/idlib/bv/Box.h b/neo/idlib/bv/Box.h index 83e91ac4..2d8e3cb8 100644 --- a/neo/idlib/bv/Box.h +++ b/neo/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/neo/idlib/bv/Frustum.cpp b/neo/idlib/bv/Frustum.cpp index 1010255e..37213f13 100644 --- a/neo/idlib/bv/Frustum.cpp +++ b/neo/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/neo/idlib/bv/Frustum.h b/neo/idlib/bv/Frustum.h index 1052a034..73403683 100644 --- a/neo/idlib/bv/Frustum.h +++ b/neo/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/neo/idlib/bv/Frustum_gcc.cpp b/neo/idlib/bv/Frustum_gcc.cpp index 991f5ef7..be4ec326 100644 --- a/neo/idlib/bv/Frustum_gcc.cpp +++ b/neo/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/neo/idlib/bv/Sphere.cpp b/neo/idlib/bv/Sphere.cpp index f05db487..f06d813c 100644 --- a/neo/idlib/bv/Sphere.cpp +++ b/neo/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/neo/idlib/bv/Sphere.h b/neo/idlib/bv/Sphere.h index dff09713..a5e2e5f7 100644 --- a/neo/idlib/bv/Sphere.h +++ b/neo/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/neo/idlib/containers/BTree.h b/neo/idlib/containers/BTree.h index 29ea10d3..c04bedd8 100644 --- a/neo/idlib/containers/BTree.h +++ b/neo/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/neo/idlib/containers/BinSearch.h b/neo/idlib/containers/BinSearch.h index b94b9cc4..724aee7b 100644 --- a/neo/idlib/containers/BinSearch.h +++ b/neo/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/neo/idlib/containers/HashIndex.cpp b/neo/idlib/containers/HashIndex.cpp index f879cc9b..1bfb38bb 100644 --- a/neo/idlib/containers/HashIndex.cpp +++ b/neo/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/neo/idlib/containers/HashIndex.h b/neo/idlib/containers/HashIndex.h index ed5555b8..6385074f 100644 --- a/neo/idlib/containers/HashIndex.h +++ b/neo/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/neo/idlib/containers/HashTable.h b/neo/idlib/containers/HashTable.h index 73ed3ac8..aab3d1ab 100644 --- a/neo/idlib/containers/HashTable.h +++ b/neo/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/neo/idlib/containers/Hierarchy.h b/neo/idlib/containers/Hierarchy.h index 620b752c..79143aa1 100644 --- a/neo/idlib/containers/Hierarchy.h +++ b/neo/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/neo/idlib/containers/LinkList.h b/neo/idlib/containers/LinkList.h index 3d2a0412..06247a20 100644 --- a/neo/idlib/containers/LinkList.h +++ b/neo/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/neo/idlib/containers/List.h b/neo/idlib/containers/List.h index 5b3d722c..7389267e 100644 --- a/neo/idlib/containers/List.h +++ b/neo/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/neo/idlib/containers/PlaneSet.h b/neo/idlib/containers/PlaneSet.h index 51b94775..bd5912fd 100644 --- a/neo/idlib/containers/PlaneSet.h +++ b/neo/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/neo/idlib/containers/Queue.h b/neo/idlib/containers/Queue.h index 2409aa08..cc93e69a 100644 --- a/neo/idlib/containers/Queue.h +++ b/neo/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/neo/idlib/containers/Stack.h b/neo/idlib/containers/Stack.h index 904ddcba..c43fdeb0 100644 --- a/neo/idlib/containers/Stack.h +++ b/neo/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/neo/idlib/containers/StaticList.h b/neo/idlib/containers/StaticList.h index 639eb12e..4ae72f72 100644 --- a/neo/idlib/containers/StaticList.h +++ b/neo/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/neo/idlib/containers/StrList.h b/neo/idlib/containers/StrList.h index bf466e4e..1a2916d8 100644 --- a/neo/idlib/containers/StrList.h +++ b/neo/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/neo/idlib/containers/StrPool.h b/neo/idlib/containers/StrPool.h index 0318df29..104bf8c4 100644 --- a/neo/idlib/containers/StrPool.h +++ b/neo/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/neo/idlib/containers/VectorSet.h b/neo/idlib/containers/VectorSet.h index fc4bea38..4e18daab 100644 --- a/neo/idlib/containers/VectorSet.h +++ b/neo/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/neo/idlib/geometry/DrawVert.cpp b/neo/idlib/geometry/DrawVert.cpp index ecffd16b..cd14b22b 100644 --- a/neo/idlib/geometry/DrawVert.cpp +++ b/neo/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/neo/idlib/geometry/DrawVert.h b/neo/idlib/geometry/DrawVert.h index d8f1bbda..b33c6601 100644 --- a/neo/idlib/geometry/DrawVert.h +++ b/neo/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/neo/idlib/geometry/JointTransform.cpp b/neo/idlib/geometry/JointTransform.cpp index 28d5510d..fe8badd9 100644 --- a/neo/idlib/geometry/JointTransform.cpp +++ b/neo/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/neo/idlib/geometry/JointTransform.h b/neo/idlib/geometry/JointTransform.h index cf405c65..ceaa1c8a 100644 --- a/neo/idlib/geometry/JointTransform.h +++ b/neo/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/neo/idlib/geometry/Surface.cpp b/neo/idlib/geometry/Surface.cpp index 04ebfa18..eb45485f 100644 --- a/neo/idlib/geometry/Surface.cpp +++ b/neo/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/neo/idlib/geometry/Surface.h b/neo/idlib/geometry/Surface.h index 738b32d3..847c67e1 100644 --- a/neo/idlib/geometry/Surface.h +++ b/neo/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/neo/idlib/geometry/Surface_Patch.cpp b/neo/idlib/geometry/Surface_Patch.cpp index 43b12a4d..06413d1a 100644 --- a/neo/idlib/geometry/Surface_Patch.cpp +++ b/neo/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/neo/idlib/geometry/Surface_Patch.h b/neo/idlib/geometry/Surface_Patch.h index 2b57c1da..dae0e5b6 100644 --- a/neo/idlib/geometry/Surface_Patch.h +++ b/neo/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/neo/idlib/geometry/Surface_Polytope.cpp b/neo/idlib/geometry/Surface_Polytope.cpp index a027a532..87a344c5 100644 --- a/neo/idlib/geometry/Surface_Polytope.cpp +++ b/neo/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/neo/idlib/geometry/Surface_Polytope.h b/neo/idlib/geometry/Surface_Polytope.h index df72d2c2..be1336a6 100644 --- a/neo/idlib/geometry/Surface_Polytope.h +++ b/neo/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/neo/idlib/geometry/Surface_SweptSpline.cpp b/neo/idlib/geometry/Surface_SweptSpline.cpp index 38f6f500..c004ad16 100644 --- a/neo/idlib/geometry/Surface_SweptSpline.cpp +++ b/neo/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/neo/idlib/geometry/Surface_SweptSpline.h b/neo/idlib/geometry/Surface_SweptSpline.h index 0849397e..3ccb1315 100644 --- a/neo/idlib/geometry/Surface_SweptSpline.h +++ b/neo/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/neo/idlib/geometry/TraceModel.cpp b/neo/idlib/geometry/TraceModel.cpp index 04098681..2bd7d6b7 100644 --- a/neo/idlib/geometry/TraceModel.cpp +++ b/neo/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/neo/idlib/geometry/TraceModel.h b/neo/idlib/geometry/TraceModel.h index 72865c0d..bd7ada30 100644 --- a/neo/idlib/geometry/TraceModel.h +++ b/neo/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/neo/idlib/geometry/Winding.cpp b/neo/idlib/geometry/Winding.cpp index 83aa9769..09f3454e 100644 --- a/neo/idlib/geometry/Winding.cpp +++ b/neo/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/neo/idlib/geometry/Winding.h b/neo/idlib/geometry/Winding.h index 444870de..7636e350 100644 --- a/neo/idlib/geometry/Winding.h +++ b/neo/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/neo/idlib/geometry/Winding2D.cpp b/neo/idlib/geometry/Winding2D.cpp index 60847f41..c88edbe1 100644 --- a/neo/idlib/geometry/Winding2D.cpp +++ b/neo/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/neo/idlib/geometry/Winding2D.h b/neo/idlib/geometry/Winding2D.h index 83d828fa..6a27e195 100644 --- a/neo/idlib/geometry/Winding2D.h +++ b/neo/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/neo/idlib/hashing/MD4.cpp b/neo/idlib/hashing/MD4.cpp index f2139e60..ab91595a 100644 --- a/neo/idlib/hashing/MD4.cpp +++ b/neo/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/neo/idlib/hashing/MD5.cpp b/neo/idlib/hashing/MD5.cpp index 89000892..03fe414b 100644 --- a/neo/idlib/hashing/MD5.cpp +++ b/neo/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/neo/idlib/math/Angles.cpp b/neo/idlib/math/Angles.cpp index 7e3da8a8..f7ee4462 100644 --- a/neo/idlib/math/Angles.cpp +++ b/neo/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/neo/idlib/math/Angles.h b/neo/idlib/math/Angles.h index 927f9395..51c93124 100644 --- a/neo/idlib/math/Angles.h +++ b/neo/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/neo/idlib/math/Complex.cpp b/neo/idlib/math/Complex.cpp index e9035bd4..dfb74c40 100644 --- a/neo/idlib/math/Complex.cpp +++ b/neo/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/neo/idlib/math/Complex.h b/neo/idlib/math/Complex.h index 082ecf34..d4ef2eea 100644 --- a/neo/idlib/math/Complex.h +++ b/neo/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/neo/idlib/math/Curve.h b/neo/idlib/math/Curve.h index c9c6e2bb..37f97300 100644 --- a/neo/idlib/math/Curve.h +++ b/neo/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/neo/idlib/math/Extrapolate.h b/neo/idlib/math/Extrapolate.h index 970d4725..1c8ec1a6 100644 --- a/neo/idlib/math/Extrapolate.h +++ b/neo/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/neo/idlib/math/Interpolate.h b/neo/idlib/math/Interpolate.h index 03ddbc6c..2659dd88 100644 --- a/neo/idlib/math/Interpolate.h +++ b/neo/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/neo/idlib/math/Lcp.cpp b/neo/idlib/math/Lcp.cpp index 7f1da8e8..f41dbbc9 100644 --- a/neo/idlib/math/Lcp.cpp +++ b/neo/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/neo/idlib/math/Lcp.h b/neo/idlib/math/Lcp.h index 83496fff..e800fae0 100644 --- a/neo/idlib/math/Lcp.h +++ b/neo/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/neo/idlib/math/Math.cpp b/neo/idlib/math/Math.cpp index 08d93d9a..3745259f 100644 --- a/neo/idlib/math/Math.cpp +++ b/neo/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/neo/idlib/math/Matrix.h b/neo/idlib/math/Matrix.h index 03867d0f..40f444c2 100644 --- a/neo/idlib/math/Matrix.h +++ b/neo/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/neo/idlib/math/Ode.cpp b/neo/idlib/math/Ode.cpp index 1f9d41e2..1ce6db37 100644 --- a/neo/idlib/math/Ode.cpp +++ b/neo/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/neo/idlib/math/Ode.h b/neo/idlib/math/Ode.h index 11b7aafc..ae3ea228 100644 --- a/neo/idlib/math/Ode.h +++ b/neo/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/neo/idlib/math/Plane.cpp b/neo/idlib/math/Plane.cpp index f77a6b5f..7336053e 100644 --- a/neo/idlib/math/Plane.cpp +++ b/neo/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/neo/idlib/math/Plane.h b/neo/idlib/math/Plane.h index c0188bb4..075687c4 100644 --- a/neo/idlib/math/Plane.h +++ b/neo/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/neo/idlib/math/Pluecker.cpp b/neo/idlib/math/Pluecker.cpp index b35604cb..de916982 100644 --- a/neo/idlib/math/Pluecker.cpp +++ b/neo/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/neo/idlib/math/Pluecker.h b/neo/idlib/math/Pluecker.h index 22e1f10a..bc8b66b9 100644 --- a/neo/idlib/math/Pluecker.h +++ b/neo/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/neo/idlib/math/Polynomial.cpp b/neo/idlib/math/Polynomial.cpp index 5bd29250..4ee475f1 100644 --- a/neo/idlib/math/Polynomial.cpp +++ b/neo/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/neo/idlib/math/Polynomial.h b/neo/idlib/math/Polynomial.h index f0195190..2ceac0c0 100644 --- a/neo/idlib/math/Polynomial.h +++ b/neo/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/neo/idlib/math/Quat.cpp b/neo/idlib/math/Quat.cpp index d0392142..af2885e3 100644 --- a/neo/idlib/math/Quat.cpp +++ b/neo/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/neo/idlib/math/Quat.h b/neo/idlib/math/Quat.h index 0d57e4da..1bc03605 100644 --- a/neo/idlib/math/Quat.h +++ b/neo/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/neo/idlib/math/Random.h b/neo/idlib/math/Random.h index 1de20709..a908cf08 100644 --- a/neo/idlib/math/Random.h +++ b/neo/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/neo/idlib/math/Rotation.cpp b/neo/idlib/math/Rotation.cpp index 11adb21b..606b8cdc 100644 --- a/neo/idlib/math/Rotation.cpp +++ b/neo/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/neo/idlib/math/Rotation.h b/neo/idlib/math/Rotation.h index 02bdf781..6250643e 100644 --- a/neo/idlib/math/Rotation.h +++ b/neo/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/neo/idlib/math/Simd.cpp b/neo/idlib/math/Simd.cpp index 986cc0b3..ff3b0db6 100644 --- a/neo/idlib/math/Simd.cpp +++ b/neo/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/neo/idlib/math/Simd.h b/neo/idlib/math/Simd.h index 84e19bcb..309c364f 100644 --- a/neo/idlib/math/Simd.h +++ b/neo/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/neo/idlib/math/Simd_3DNow.cpp b/neo/idlib/math/Simd_3DNow.cpp index 1565eaaa..798ef86e 100644 --- a/neo/idlib/math/Simd_3DNow.cpp +++ b/neo/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/neo/idlib/math/Simd_3DNow.h b/neo/idlib/math/Simd_3DNow.h index 91108f5b..9f3d0b1e 100644 --- a/neo/idlib/math/Simd_3DNow.h +++ b/neo/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/neo/idlib/math/Simd_AltiVec.cpp b/neo/idlib/math/Simd_AltiVec.cpp index 17bc3277..e5a2d8f6 100644 --- a/neo/idlib/math/Simd_AltiVec.cpp +++ b/neo/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/neo/idlib/math/Simd_AltiVec.h b/neo/idlib/math/Simd_AltiVec.h index fcf04e9d..e7bdac3b 100644 --- a/neo/idlib/math/Simd_AltiVec.h +++ b/neo/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/neo/idlib/math/Simd_Generic.cpp b/neo/idlib/math/Simd_Generic.cpp index 9b8e60d4..e5ad6623 100644 --- a/neo/idlib/math/Simd_Generic.cpp +++ b/neo/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/neo/idlib/math/Simd_Generic.h b/neo/idlib/math/Simd_Generic.h index 31e0d9d3..6af6b262 100644 --- a/neo/idlib/math/Simd_Generic.h +++ b/neo/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/neo/idlib/math/Simd_MMX.cpp b/neo/idlib/math/Simd_MMX.cpp index 05482eb7..ea02ae84 100644 --- a/neo/idlib/math/Simd_MMX.cpp +++ b/neo/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/neo/idlib/math/Simd_MMX.h b/neo/idlib/math/Simd_MMX.h index d0c1a8ae..a9c23f5d 100644 --- a/neo/idlib/math/Simd_MMX.h +++ b/neo/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/neo/idlib/math/Simd_SSE.cpp b/neo/idlib/math/Simd_SSE.cpp index 43f2a59d..f4b63655 100644 --- a/neo/idlib/math/Simd_SSE.cpp +++ b/neo/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/neo/idlib/math/Simd_SSE.h b/neo/idlib/math/Simd_SSE.h index 13404c2e..f5054440 100644 --- a/neo/idlib/math/Simd_SSE.h +++ b/neo/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/neo/idlib/math/Simd_SSE2.cpp b/neo/idlib/math/Simd_SSE2.cpp index 15ef637d..72a6badf 100644 --- a/neo/idlib/math/Simd_SSE2.cpp +++ b/neo/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/neo/idlib/math/Simd_SSE2.h b/neo/idlib/math/Simd_SSE2.h index db1d341c..81863b85 100644 --- a/neo/idlib/math/Simd_SSE2.h +++ b/neo/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/neo/idlib/math/Simd_SSE3.cpp b/neo/idlib/math/Simd_SSE3.cpp index 67901bd5..72bc0626 100644 --- a/neo/idlib/math/Simd_SSE3.cpp +++ b/neo/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/neo/idlib/math/Simd_SSE3.h b/neo/idlib/math/Simd_SSE3.h index b5644ddd..83715f34 100644 --- a/neo/idlib/math/Simd_SSE3.h +++ b/neo/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/neo/idlib/math/Vector.cpp b/neo/idlib/math/Vector.cpp index e53e8149..c29f4b14 100644 --- a/neo/idlib/math/Vector.cpp +++ b/neo/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/neo/idlib/math/Vector.h b/neo/idlib/math/Vector.h index ecc001dd..773bf433 100644 --- a/neo/idlib/math/Vector.h +++ b/neo/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/neo/idlib/precompiled.cpp b/neo/idlib/precompiled.cpp index d319bfbe..18003bfb 100644 --- a/neo/idlib/precompiled.cpp +++ b/neo/idlib/precompiled.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/neo/idlib/precompiled.h b/neo/idlib/precompiled.h index 2654d7ad..dca42d7b 100644 --- a/neo/idlib/precompiled.h +++ b/neo/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/neo/openal/idal.py b/neo/openal/idal.py index 3a8151b0..40d5814b 100644 --- a/neo/openal/idal.py +++ b/neo/openal/idal.py @@ -10,94 +10,94 @@ import time funcs = [ - [ 'ALenum', 'alGetError', 'ALvoid' ], - [ 'ALvoid', 'alGenBuffers', 'ALsizei', 'ALuint *' ], - [ 'ALboolean', 'alIsSource', 'ALuint' ], - [ 'ALvoid', 'alSourceStop', 'ALuint' ], - [ 'ALvoid', 'alGetSourcei', 'ALuint', 'ALenum', 'ALint *' ], - [ 'ALint', 'alGetInteger', 'ALenum' ], - [ 'ALCvoid', 'alcSuspendContext', 'ALCcontext *' ], - [ 'ALCboolean', 'alcMakeContextCurrent', 'ALCcontext *' ], - [ 'ALCvoid', 'alcProcessContext', 'ALCcontext *' ], - [ 'ALCvoid', 'alcDestroyContext', 'ALCcontext *' ], - [ 'ALCubyte *', 'alcGetString', 'ALCdevice *', 'ALCenum' ], - [ 'ALvoid', 'alBufferData', 'ALuint', 'ALenum', 'ALvoid *', 'ALsizei', 'ALsizei' ], - [ 'ALvoid', 'alDeleteBuffers', 'ALsizei', 'ALuint *' ], - [ 'ALboolean', 'alIsExtensionPresent', 'ALubyte *' ], - [ 'ALvoid', 'alDeleteSources', 'ALsizei', 'ALuint *' ], - [ 'ALenum', 'alGetEnumValue', 'ALubyte *' ], - [ 'ALvoid *', 'alGetProcAddress', 'ALubyte *' ], - [ 'ALCcontext *', 'alcCreateContext', 'ALCdevice *', 'ALCint *' ], - [ 'ALCdevice *', 'alcOpenDevice', 'ALubyte *' ], - [ 'ALvoid', 'alListenerfv', 'ALenum', 'ALfloat*' ], - [ 'ALvoid', 'alSourceQueueBuffers', 'ALuint', 'ALsizei', 'ALuint *' ], - [ 'ALvoid', 'alSourcei', 'ALuint', 'ALenum', 'ALint' ], - [ 'ALvoid', 'alListenerf', 'ALenum', 'ALfloat' ], - [ 'ALCvoid', 'alcCloseDevice', 'ALCdevice *' ], - [ 'ALboolean', 'alIsBuffer', 'ALuint' ], - [ 'ALvoid', 'alSource3f', 'ALuint', 'ALenum', 'ALfloat', 'ALfloat', 'ALfloat' ], - [ 'ALvoid', 'alGenSources', 'ALsizei', 'ALuint *' ], - [ 'ALvoid', 'alSourcef', 'ALuint', 'ALenum', 'ALfloat' ], - [ 'ALvoid', 'alSourceUnqueueBuffers', 'ALuint', 'ALsizei', 'ALuint *' ], - [ 'ALvoid', 'alSourcePlay', 'ALuint' ], - ] + [ 'ALenum', 'alGetError', 'ALvoid' ], + [ 'ALvoid', 'alGenBuffers', 'ALsizei', 'ALuint *' ], + [ 'ALboolean', 'alIsSource', 'ALuint' ], + [ 'ALvoid', 'alSourceStop', 'ALuint' ], + [ 'ALvoid', 'alGetSourcei', 'ALuint', 'ALenum', 'ALint *' ], + [ 'ALint', 'alGetInteger', 'ALenum' ], + [ 'ALCvoid', 'alcSuspendContext', 'ALCcontext *' ], + [ 'ALCboolean', 'alcMakeContextCurrent', 'ALCcontext *' ], + [ 'ALCvoid', 'alcProcessContext', 'ALCcontext *' ], + [ 'ALCvoid', 'alcDestroyContext', 'ALCcontext *' ], + [ 'ALCubyte *', 'alcGetString', 'ALCdevice *', 'ALCenum' ], + [ 'ALvoid', 'alBufferData', 'ALuint', 'ALenum', 'ALvoid *', 'ALsizei', 'ALsizei' ], + [ 'ALvoid', 'alDeleteBuffers', 'ALsizei', 'ALuint *' ], + [ 'ALboolean', 'alIsExtensionPresent', 'ALubyte *' ], + [ 'ALvoid', 'alDeleteSources', 'ALsizei', 'ALuint *' ], + [ 'ALenum', 'alGetEnumValue', 'ALubyte *' ], + [ 'ALvoid *', 'alGetProcAddress', 'ALubyte *' ], + [ 'ALCcontext *', 'alcCreateContext', 'ALCdevice *', 'ALCint *' ], + [ 'ALCdevice *', 'alcOpenDevice', 'ALubyte *' ], + [ 'ALvoid', 'alListenerfv', 'ALenum', 'ALfloat*' ], + [ 'ALvoid', 'alSourceQueueBuffers', 'ALuint', 'ALsizei', 'ALuint *' ], + [ 'ALvoid', 'alSourcei', 'ALuint', 'ALenum', 'ALint' ], + [ 'ALvoid', 'alListenerf', 'ALenum', 'ALfloat' ], + [ 'ALCvoid', 'alcCloseDevice', 'ALCdevice *' ], + [ 'ALboolean', 'alIsBuffer', 'ALuint' ], + [ 'ALvoid', 'alSource3f', 'ALuint', 'ALenum', 'ALfloat', 'ALfloat', 'ALfloat' ], + [ 'ALvoid', 'alGenSources', 'ALsizei', 'ALuint *' ], + [ 'ALvoid', 'alSourcef', 'ALuint', 'ALenum', 'ALfloat' ], + [ 'ALvoid', 'alSourceUnqueueBuffers', 'ALuint', 'ALsizei', 'ALuint *' ], + [ 'ALvoid', 'alSourcePlay', 'ALuint' ], + ] def warningHeader( f ): - f.write( '// generated header. do not edit\n' ) - f.write( '// ' + __file__ + '\n' ) - f.write( '// ' + time.asctime() + '\n\n' ) + f.write( '// generated header. do not edit\n' ) + f.write( '// ' + __file__ + '\n' ) + f.write( '// ' + time.asctime() + '\n\n' ) def genIDALFunc( f, declare ): - if ( declare ): - extern = 'extern ' - else: - extern = '' - for func in funcs: - f.write( extern + func[0] + ' ( ALAPIENTRY * id' + func[1] + ' )( ' ) - i = 2 - while ( i < len( func ) ): - if ( i != 2 ): - f.write( ', ' ) - f.write( func[i] ) - i += 1 - if ( declare ): - f.write( ' );\n' ) - else: - f.write( ' ) = NULL;\n' ) + if ( declare ): + extern = 'extern ' + else: + extern = '' + for func in funcs: + f.write( extern + func[0] + ' ( ALAPIENTRY * id' + func[1] + ' )( ' ) + i = 2 + while ( i < len( func ) ): + if ( i != 2 ): + f.write( ', ' ) + f.write( func[i] ) + i += 1 + if ( declare ): + f.write( ' );\n' ) + else: + f.write( ' ) = NULL;\n' ) def genDefineMapping( f ): - for func in funcs: - fname = func[1] - f.write( '#define %s id%s\n' % ( fname, fname ) ) + for func in funcs: + fname = func[1] + f.write( '#define %s id%s\n' % ( fname, fname ) ) def genIDALInit( f ): - for func in funcs: - # annoying casting - cast = func[0] + ' ( ALAPIENTRY * ) ( ' - i = 2 - while ( i < len( func ) ): - if ( i != 2 ): - cast += ', ' - cast += func[i] - i += 1 - cast += ' )' - # function - f.write( 'id' + func[1] + ' = ( ' + cast + ' )GetProcAddress( h, "' + func[1] + '" );\n' ) - f.write( 'if ( !id' + func[1] + ') {\n return "' + func[1] + '";\n}\n' ) + for func in funcs: + # annoying casting + cast = func[0] + ' ( ALAPIENTRY * ) ( ' + i = 2 + while ( i < len( func ) ): + if ( i != 2 ): + cast += ', ' + cast += func[i] + i += 1 + cast += ' )' + # function + f.write( 'id' + func[1] + ' = ( ' + cast + ' )GetProcAddress( h, "' + func[1] + '" );\n' ) + f.write( 'if ( !id' + func[1] + ') {\n return "' + func[1] + '";\n}\n' ) if __name__ == '__main__': - f = open( 'idal.h', 'w' ) - warningHeader( f ) - genIDALFunc( f, True ) - f.write( '\n' ) - genDefineMapping( f ) - f.close() - f = open( 'idal.cpp', 'w' ) - warningHeader( f ) - genIDALFunc( f, False ) - f.write( '\n' ); - f.write( 'const char* InitializeIDAL( HMODULE h ) {\n' ) - genIDALInit( f ) - f.write( 'return NULL;\n' ); - f.write( '};\n' ) - f.close() + f = open( 'idal.h', 'w' ) + warningHeader( f ) + genIDALFunc( f, True ) + f.write( '\n' ) + genDefineMapping( f ) + f.close() + f = open( 'idal.cpp', 'w' ) + warningHeader( f ) + genIDALFunc( f, False ) + f.write( '\n' ); + f.write( 'const char* InitializeIDAL( HMODULE h ) {\n' ) + genIDALInit( f ) + f.write( 'return NULL;\n' ); + f.write( '};\n' ) + f.close() diff --git a/neo/openal/stubs.cpp b/neo/openal/stubs.cpp index 23e05aa8..4de11253 100644 --- a/neo/openal/stubs.cpp +++ b/neo/openal/stubs.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 @@ AL_API void* AL_APIENTRY alGetProcAddress( const ALchar* fname ) { } ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *dev, - const ALCint* attrlist ) { + const ALCint* attrlist ) { return NULL; } @@ -124,7 +124,7 @@ AL_API ALboolean AL_APIENTRY alIsBuffer( ALuint buffer ) { } AL_API void AL_APIENTRY alSource3f( ALuint sid, ALenum param, - ALfloat f1, ALfloat f2, ALfloat f3 ) { } + ALfloat f1, ALfloat f2, ALfloat f3 ) { } AL_API void AL_APIENTRY alGenSources( ALsizei n, ALuint* sources ) { } diff --git a/neo/renderer/Cinematic.cpp b/neo/renderer/Cinematic.cpp index 3f655509..eae09bc4 100644 --- a/neo/renderer/Cinematic.cpp +++ b/neo/renderer/Cinematic.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"). @@ -158,7 +158,7 @@ void idCinematic::InitCinematic( void ) { t_vg = (0.71414f/2.0f) * (float)(1<<6) + 0.5f; for( i = 0; i < 256; i++ ) { float x = (float)(2 * i - 255); - + ROQ_UB_tab[i] = (long)( ( t_ub * x) + (1<<5)); ROQ_VR_tab[i] = (long)( ( t_vr * x) + (1<<5)); ROQ_UG_tab[i] = (long)( (-t_ug * x) ); @@ -358,8 +358,8 @@ void idCinematicLocal::Close() { idCinematicLocal::AnimationLength ============== */ -int idCinematicLocal::AnimationLength() { - return animationLength; +int idCinematicLocal::AnimationLength() { + return animationLength; } /* @@ -820,9 +820,9 @@ void idCinematicLocal::blitVQQuad32fs( byte **status, unsigned char *data ) { newd = 0; celdata = 0; index = 0; - + do { - if (!newd) { + if (!newd) { newd = 7; celdata = data[0] + data[1]*256; data += 2; @@ -830,9 +830,9 @@ void idCinematicLocal::blitVQQuad32fs( byte **status, unsigned char *data ) { newd--; } - code = (unsigned short)(celdata&0xc000); + code = (unsigned short)(celdata&0xc000); celdata <<= 2; - + switch (code) { case 0x8000: // vq code blit8_32( (byte *)&vq8[(*data)*128], status[index], samplesPerLine ); @@ -842,15 +842,15 @@ void idCinematicLocal::blitVQQuad32fs( byte **status, unsigned char *data ) { case 0xc000: // drop index++; // skip 8x8 for(i=0;i<4;i++) { - if (!newd) { + if (!newd) { newd = 7; celdata = data[0] + data[1]*256; data += 2; } else { newd--; } - - code = (unsigned short)(celdata&0xc000); celdata <<= 2; + + code = (unsigned short)(celdata&0xc000); celdata <<= 2; switch (code) { // code in top two bits of code case 0x8000: // 4x4 vq code @@ -888,7 +888,7 @@ void idCinematicLocal::blitVQQuad32fs( byte **status, unsigned char *data ) { } #define VQ2TO4(a,b,c,d) { \ - *c++ = a[0]; \ + *c++ = a[0]; \ *d++ = a[0]; \ *d++ = a[0]; \ *c++ = a[1]; \ @@ -909,7 +909,7 @@ void idCinematicLocal::blitVQQuad32fs( byte **status, unsigned char *data ) { *d++ = b[1]; \ *d++ = b[1]; \ a += 2; b += 2; } - + #define VQ2TO2(a,b,c,d) { \ *c++ = *a; \ *d++ = *a; \ @@ -928,13 +928,13 @@ void idCinematicLocal::blitVQQuad32fs( byte **status, unsigned char *data ) { idCinematicLocal::yuv_to_rgb ============== */ -unsigned short idCinematicLocal::yuv_to_rgb( long y, long u, long v ) { +unsigned short idCinematicLocal::yuv_to_rgb( long y, long u, long v ) { long r,g,b,YY = (long)(ROQ_YY_tab[(y)]); r = (YY + ROQ_VR_tab[v]) >> 9; g = (YY + ROQ_UG_tab[u] + ROQ_VG_tab[v]) >> 8; b = (YY + ROQ_UB_tab[u]) >> 9; - + if (r<0) r = 0; if (g<0) g = 0; if (b<0) b = 0; if (r > 31) r = 31; if (g > 63) g = 63; if (b > 31) b = 31; @@ -946,16 +946,16 @@ unsigned short idCinematicLocal::yuv_to_rgb( long y, long u, long v ) { idCinematicLocal::yuv_to_rgb24 ============== */ -unsigned int idCinematicLocal::yuv_to_rgb24( long y, long u, long v ) { +unsigned int idCinematicLocal::yuv_to_rgb24( long y, long u, long v ) { long r,g,b,YY = (long)(ROQ_YY_tab[(y)]); r = (YY + ROQ_VR_tab[v]) >> 6; g = (YY + ROQ_UG_tab[u] + ROQ_VG_tab[v]) >> 6; b = (YY + ROQ_UB_tab[u]) >> 6; - + if (r<0) r = 0; if (g<0) g = 0; if (b<0) b = 0; if (r > 255) r = 255; if (g > 255) g = 255; if (b > 255) b = 255; - + return LittleLong((r)+(g<<8)+(b<<16)); } @@ -1003,7 +1003,7 @@ void idCinematicLocal::decodeCodeBook( byte *input, unsigned short roq_flags ) { cptr = (unsigned short *)vq4; dptr = (unsigned short *)vq8; - + for(i=0;iSeek( 0, FS_SEEK_SET ); iFile->Read( file, 16 ); RoQ_init(); @@ -1339,14 +1339,14 @@ static boolean fill_input_buffer( j_decompress_ptr cinfo ) nbytes = INPUT_BUF_SIZE; if (nbytes > src->memsize) nbytes = src->memsize; if (nbytes == 0) { - /* Insert a fake EOI marker */ - src->buffer[0] = (JOCTET) 0xFF; - src->buffer[1] = (JOCTET) JPEG_EOI; - nbytes = 2; + /* Insert a fake EOI marker */ + src->buffer[0] = (JOCTET) 0xFF; + src->buffer[1] = (JOCTET) JPEG_EOI; + nbytes = 2; } else { memcpy( src->buffer, src->infile, INPUT_BUF_SIZE ); src->infile = src->infile + nbytes; - src->memsize = src->memsize - INPUT_BUF_SIZE; + src->memsize = src->memsize - INPUT_BUF_SIZE; } src->pub.next_input_byte = src->buffer; src->pub.bytes_in_buffer = nbytes; @@ -1394,8 +1394,8 @@ skip_input_data (j_decompress_ptr cinfo, long num_bytes) */ if (num_bytes > 0) { src->infile = src->infile + num_bytes; - src->pub.next_input_byte += (size_t) num_bytes; - src->pub.bytes_in_buffer -= (size_t) num_bytes; + src->pub.next_input_byte += (size_t) num_bytes; + src->pub.bytes_in_buffer -= (size_t) num_bytes; } } @@ -1438,12 +1438,12 @@ jpeg_memory_src (j_decompress_ptr cinfo, byte *infile, int size) * manager serially with the same JPEG object. Caveat programmer. */ if (cinfo->src == NULL) { /* first time for this JPEG object? */ - cinfo->src = (struct jpeg_source_mgr *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + cinfo->src = (struct jpeg_source_mgr *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(my_source_mgr)); - src = (my_src_ptr) cinfo->src; - src->buffer = (JOCTET *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + src = (my_src_ptr) cinfo->src; + src->buffer = (JOCTET *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, INPUT_BUF_SIZE * sizeof(JOCTET)); } @@ -1503,11 +1503,11 @@ int JPEGBlit( byte *wStatus, byte *data, int datasize ) /* Step 5: Start decompressor */ cinfo.dct_method = JDCT_IFAST; - cinfo.dct_method = JDCT_FASTEST; + cinfo.dct_method = JDCT_FASTEST; cinfo.dither_mode = JDITHER_NONE; - cinfo.do_fancy_upsampling = FALSE; + cinfo.do_fancy_upsampling = FALSE; // cinfo.out_color_space = JCS_GRAYSCALE; - + (void) jpeg_start_decompress(&cinfo); /* We can ignore the return value since suspension is not possible * with the stdio data source. @@ -1518,7 +1518,7 @@ int JPEGBlit( byte *wStatus, byte *data, int datasize ) * output image dimensions available, as well as the output colormap * if we asked for color quantization. * In this example, we need to make an output work buffer of the right size. - */ + */ /* JSAMPLEs per row in output buffer */ row_stride = cinfo.output_width * cinfo.output_components; @@ -1532,16 +1532,16 @@ int JPEGBlit( byte *wStatus, byte *data, int datasize ) /* Here we use the library's state variable cinfo.output_scanline as the * loop counter, so that we don't have to keep track ourselves. */ - + wStatus += (cinfo.output_height-1)*row_stride; while (cinfo.output_scanline < cinfo.output_height) { - /* jpeg_read_scanlines expects an array of pointers to scanlines. - * Here the array is only one element long, but you could ask for - * more than one scanline at a time if that's more convenient. - */ - (void) jpeg_read_scanlines(&cinfo, &buffer[0], 1); + /* jpeg_read_scanlines expects an array of pointers to scanlines. + * Here the array is only one element long, but you could ask for + * more than one scanline at a time if that's more convenient. + */ + (void) jpeg_read_scanlines(&cinfo, &buffer[0], 1); - /* Assume put_scanline_someplace wants a pointer and sample count. */ + /* Assume put_scanline_someplace wants a pointer and sample count. */ memcpy( wStatus, &buffer[0][0], row_stride ); /* int x; @@ -1588,13 +1588,13 @@ void idCinematicLocal::RoQInterrupt(void) { byte *framedata; iFile->Read( file, RoQFrameSize+8 ); - if ( RoQPlayed >= ROQSize ) { + if ( RoQPlayed >= ROQSize ) { if (looping) { RoQReset(); } else { status = FMV_EOF; } - return; + return; } framedata = file; @@ -1602,19 +1602,19 @@ void idCinematicLocal::RoQInterrupt(void) { // new frame is ready // redump: - switch(roq_id) + switch(roq_id) { case ROQ_QUAD_VQ: if ((numQuads&1)) { normalBuffer0 = t[1]; RoQPrepMcomp( roqF0, roqF1 ); blitVQQuad32fs( qStatus[1], framedata); - buf = image + screenDelta; + buf = image + screenDelta; } else { normalBuffer0 = t[0]; RoQPrepMcomp( roqF0, roqF1 ); blitVQQuad32fs( qStatus[0], framedata ); - buf = image; + buf = image; } if (numQuads == 0) { // first frame memcpy(image+screenDelta, image, samplesPerLine*ysize); @@ -1644,7 +1644,7 @@ redump: RoQFrameSize = 0; break; case ROQ_QUAD_JPEG: - if (!numQuads) { + if (!numQuads) { normalBuffer0 = t[0]; JPEGBlit( image, framedata, RoQFrameSize ); memcpy(image+screenDelta, image, samplesPerLine*ysize); @@ -1654,19 +1654,19 @@ redump: default: status = FMV_EOF; break; - } + } // // read in next frame data // - if ( RoQPlayed >= ROQSize ) { + if ( RoQPlayed >= ROQSize ) { if (looping) { RoQReset(); } else { status = FMV_EOF; } - return; + return; } - + framedata += RoQFrameSize; roq_id = framedata[0] + framedata[1]*256; RoQFrameSize = framedata[2] + framedata[3]*256 + framedata[4]*65536; @@ -1682,8 +1682,8 @@ redump: } return; } - if (inMemory && (status != FMV_EOF)) { - inMemory = false; framedata += 8; goto redump; + if (inMemory && (status != FMV_EOF)) { + inMemory = false; framedata += 8; goto redump; } // // one more frame hits the dust @@ -1704,7 +1704,7 @@ void idCinematicLocal::RoQ_init( void ) { /* get frame rate */ roqFPS = file[ 6] + file[ 7]*256; - + if (!roqFPS) roqFPS = 30; numQuads = -1; diff --git a/neo/renderer/Cinematic.h b/neo/renderer/Cinematic.h index 26dbd4e4..93bc2b06 100644 --- a/neo/renderer/Cinematic.h +++ b/neo/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/neo/renderer/GuiModel.cpp b/neo/renderer/GuiModel.cpp index dabd10be..8248815e 100644 --- a/neo/renderer/GuiModel.cpp +++ b/neo/renderer/GuiModel.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,18 +78,18 @@ void idGuiModel::WriteToDemo( idDemoFile *demo ) { demo->WriteUnsignedChar( verts[j].color[2] ); demo->WriteUnsignedChar( verts[j].color[3] ); } - + i = indexes.Num(); demo->WriteInt( i ); for ( j = 0; j < i; j++ ) { demo->WriteInt(indexes[j] ); } - + i = surfaces.Num(); demo->WriteInt( i ); for ( j = 0 ; j < i ; j++ ) { guiModelSurface_t *surf = &surfaces[j]; - + demo->WriteInt( (int&)surf->material ); demo->WriteFloat( surf->color[0] ); demo->WriteFloat( surf->color[1] ); @@ -126,20 +126,20 @@ void idGuiModel::ReadFromDemo( idDemoFile *demo ) { demo->ReadUnsignedChar( verts[j].color[2] ); demo->ReadUnsignedChar( verts[j].color[3] ); } - + i = indexes.Num(); demo->ReadInt( i ); indexes.SetNum( i, false ); for ( j = 0; j < i; j++ ) { demo->ReadInt(indexes[j] ); } - + i = surfaces.Num(); demo->ReadInt( i ); surfaces.SetNum( i, false ); for ( j = 0 ; j < i ; j++ ) { guiModelSurface_t *surf = &surfaces[j]; - + demo->ReadInt( (int&)surf->material ); demo->ReadFloat( surf->color[0] ); demo->ReadFloat( surf->color[1] ); @@ -208,7 +208,7 @@ EmitToCurrentView void idGuiModel::EmitToCurrentView( float modelMatrix[16], bool depthHack ) { float modelViewMatrix[16]; - myGlMultMatrix( modelMatrix, tr.viewDef->worldSpace.modelViewMatrix, + myGlMultMatrix( modelMatrix, tr.viewDef->worldSpace.modelViewMatrix, modelViewMatrix ); for ( int i = 0 ; i < surfaces.Num() ; i++ ) { @@ -250,7 +250,7 @@ void idGuiModel::EmitFullScreen( void ) { viewDef->renderView.y = tr.viewDef->renderView.y; viewDef->renderView.width = tr.viewDef->renderView.width; viewDef->renderView.height = tr.viewDef->renderView.height; - + viewDef->viewport.x1 = tr.viewDef->renderView.x; viewDef->viewport.x2 = tr.viewDef->renderView.x + tr.viewDef->renderView.width; viewDef->viewport.y1 = tr.viewDef->renderView.y; @@ -356,7 +356,7 @@ void idGuiModel::SetColor( float r, float g, float b, float a ) { DrawStretchPic ============= */ -void idGuiModel::DrawStretchPic( const idDrawVert *dverts, const glIndex_t *dindexes, int vertCount, int indexCount, const idMaterial *hShader, +void idGuiModel::DrawStretchPic( const idDrawVert *dverts, const glIndex_t *dindexes, int vertCount, int indexCount, const idMaterial *hShader, bool clip, float min_x, float min_y, float max_x, float max_y ) { if ( !glConfig.isInitialized ) { return; @@ -487,7 +487,7 @@ void idGuiModel::DrawStretchPic( float x, float y, float w, float h, float s1, f t2 -= ( t2 - t1 ) * ( y + h - 480 ) / h; h = 480 - y; } - + if ( w <= 0 || h <= 0 ) { return; // completely clipped away } @@ -649,4 +649,3 @@ void idGuiModel::DrawStretchTri( idVec2 p1, idVec2 p2, idVec2 p3, idVec2 t1, idV memcpy( &verts[numVerts], tempVerts, vertCount * sizeof( verts[0] ) ); } - diff --git a/neo/renderer/GuiModel.h b/neo/renderer/GuiModel.h index e8b606bc..1ff36890 100644 --- a/neo/renderer/GuiModel.h +++ b/neo/renderer/GuiModel.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,8 +43,8 @@ public: void Clear(); void WriteToDemo( idDemoFile *demo ); - void ReadFromDemo( idDemoFile *demo ); - + void ReadFromDemo( idDemoFile *demo ); + void EmitToCurrentView( float modelMatrix[16], bool depthHack ); void EmitFullScreen(); @@ -67,4 +67,3 @@ private: idList indexes; idList verts; }; - diff --git a/neo/renderer/Image.h b/neo/renderer/Image.h index 259df9ce..49c49cc8 100644 --- a/neo/renderer/Image.h +++ b/neo/renderer/Image.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"). @@ -91,30 +91,30 @@ const unsigned long DDSF_MIPMAP = 0x00400000l; #define DDS_MAKEFOURCC(a, b, c, d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24)) typedef struct { - unsigned long dwSize; - unsigned long dwFlags; - unsigned long dwFourCC; - unsigned long dwRGBBitCount; - unsigned long dwRBitMask; - unsigned long dwGBitMask; - unsigned long dwBBitMask; - unsigned long dwABitMask; + unsigned long dwSize; + unsigned long dwFlags; + unsigned long dwFourCC; + unsigned long dwRGBBitCount; + unsigned long dwRBitMask; + unsigned long dwGBitMask; + unsigned long dwBBitMask; + unsigned long dwABitMask; } ddsFilePixelFormat_t; typedef struct { - unsigned long dwSize; - unsigned long dwFlags; - unsigned long dwHeight; - unsigned long dwWidth; - unsigned long dwPitchOrLinearSize; - unsigned long dwDepth; - unsigned long dwMipMapCount; - unsigned long dwReserved1[11]; - ddsFilePixelFormat_t ddspf; - unsigned long dwCaps1; - unsigned long dwCaps2; - unsigned long dwReserved2[3]; + unsigned long dwSize; + unsigned long dwFlags; + unsigned long dwHeight; + unsigned long dwWidth; + unsigned long dwPitchOrLinearSize; + unsigned long dwDepth; + unsigned long dwMipMapCount; + unsigned long dwReserved1[11]; + ddsFilePixelFormat_t ddspf; + unsigned long dwCaps1; + unsigned long dwCaps2; + unsigned long dwReserved2[3]; } ddsFileHeader_t; @@ -163,14 +163,14 @@ public: // data goes from the bottom to the top line of the image, as OpenGL expects it // These perform an implicit Bind() on the current texture unit // FIXME: should we implement cinematics this way, instead of with explicit calls? - void GenerateImage( const byte *pic, int width, int height, - textureFilter_t filter, bool allowDownSize, + void GenerateImage( const byte *pic, int width, int height, + textureFilter_t filter, bool allowDownSize, textureRepeat_t repeat, textureDepth_t depth ); void Generate3DImage( const byte *pic, int width, int height, int depth, - textureFilter_t filter, bool allowDownSize, + textureFilter_t filter, bool allowDownSize, textureRepeat_t repeat, textureDepth_t minDepth ); - void GenerateCubeImage( const byte *pic[6], int size, - textureFilter_t filter, bool allowDownSize, + void GenerateCubeImage( const byte *pic[6], int size, + textureFilter_t filter, bool allowDownSize, textureDepth_t depth ); void CopyFramebuffer( int x, int y, int width, int height, bool useOversizedBuffer ); @@ -249,7 +249,7 @@ public: int uploadWidth, uploadHeight, uploadDepth; // after power of two, downsample, and MAX_TEXTURE_SIZE int internalFormat; - idImage *cacheUsagePrev, *cacheUsageNext; // for dynamic cache purging of old images + idImage *cacheUsagePrev, *cacheUsageNext; // for dynamic cache purging of old images idImage * hashNext; // for hash chains to speed lookup @@ -412,7 +412,7 @@ public: idImage * borderClampImage; // white inside, black outside //-------------------------------------------------------- - + idImage * AllocImage( const char *name ); void SetNormalPalette(); void ChangeTextureFilter(); @@ -455,9 +455,9 @@ FIXME: make an "imageBlock" type to hold byte*,width,height? ==================================================================== */ -byte *R_Dropsample( const byte *in, int inwidth, int inheight, +byte *R_Dropsample( const byte *in, int inwidth, int inheight, int outwidth, int outheight ); -byte *R_ResampleTexture( const byte *in, int inwidth, int inheight, +byte *R_ResampleTexture( const byte *in, int inwidth, int inheight, int outwidth, int outheight ); byte *R_MipMapWithAlphaSpecularity( const byte *in, int width, int height ); byte *R_MipMap( const byte *in, int width, int height, bool preserveBorder ); @@ -493,4 +493,3 @@ IMAGEPROGRAM void R_LoadImageProgram( const char *name, byte **pic, int *width, int *height, ID_TIME_T *timestamp, textureDepth_t *depth = NULL ); const char *R_ParsePastImageProgram( idLexer &src ); - diff --git a/neo/renderer/Image_files.cpp b/neo/renderer/Image_files.cpp index f4e8a7b8..3ebe39fb 100644 --- a/neo/renderer/Image_files.cpp +++ b/neo/renderer/Image_files.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"). @@ -174,19 +174,19 @@ PCX files are used for 8 bit images */ typedef struct { - char manufacturer; - char version; - char encoding; - char bits_per_pixel; - unsigned short xmin,ymin,xmax,ymax; - unsigned short hres,vres; - unsigned char palette[48]; - char reserved; - char color_planes; - unsigned short bytes_per_line; - unsigned short palette_type; - char filler[58]; - unsigned char data; // unbounded + char manufacturer; + char version; + char encoding; + char bits_per_pixel; + unsigned short xmin,ymin,xmax,ymax; + unsigned short hres,vres; + unsigned char palette[48]; + char reserved; + char color_planes; + unsigned short bytes_per_line; + unsigned short palette_type; + char filler[58]; + unsigned char data; // unbounded } pcx_t; @@ -199,7 +199,7 @@ TGA files are used for 24/32 bit images */ typedef struct _TargaHeader { - unsigned char id_length, colormap_type, image_type; + unsigned char id_length, colormap_type, image_type; unsigned short colormap_index, colormap_length; unsigned char colormap_size; unsigned short x_origin, y_origin, width, height; @@ -304,7 +304,7 @@ static void LoadBMP( const char *name, byte **pic, int *width, int *height, ID_T if ( bmpHeader.bitsPerPixel == 8 ) buf_p += 1024; - if ( bmpHeader.id[0] != 'B' && bmpHeader.id[1] != 'M' ) + if ( bmpHeader.id[0] != 'B' && bmpHeader.id[1] != 'M' ) { common->Error( "LoadBMP: only Windows-style BMP files supported (%s)\n", name ); } @@ -327,7 +327,7 @@ static void LoadBMP( const char *name, byte **pic, int *width, int *height, ID_T rows = -rows; numPixels = columns * rows; - if ( width ) + if ( width ) *width = columns; if ( height ) *height = rows; @@ -409,7 +409,7 @@ PCX LOADING LoadPCX ============== */ -static void LoadPCX ( const char *filename, byte **pic, byte **palette, int *width, int *height, +static void LoadPCX ( const char *filename, byte **pic, byte **palette, int *width, int *height, ID_TIME_T *timestamp ) { byte *raw; pcx_t *pcx; @@ -441,8 +441,8 @@ static void LoadPCX ( const char *filename, byte **pic, byte **palette, int *wid pcx = (pcx_t *)raw; raw = &pcx->data; - xmax = LittleShort(pcx->xmax); - ymax = LittleShort(pcx->ymax); + xmax = LittleShort(pcx->xmax); + ymax = LittleShort(pcx->ymax); if (pcx->manufacturer != 0x0a || pcx->version != 5 @@ -582,7 +582,7 @@ static void LoadTGA( const char *name, byte **pic, int *width, int *height, ID_T targa_header.id_length = *buf_p++; targa_header.colormap_type = *buf_p++; targa_header.image_type = *buf_p++; - + targa_header.colormap_index = LittleShort ( *(short *)buf_p ); buf_p += 2; targa_header.colormap_length = LittleShort ( *(short *)buf_p ); @@ -635,9 +635,9 @@ static void LoadTGA( const char *name, byte **pic, int *width, int *height, ID_T if ( targa_header.id_length != 0 ) { buf_p += targa_header.id_length; // skip TARGA image comment } - + if ( targa_header.image_type == 2 || targa_header.image_type == 3 ) - { + { // Uncompressed RGB or gray scale image for( row = rows - 1; row >= 0; row-- ) { @@ -647,7 +647,7 @@ static void LoadTGA( const char *name, byte **pic, int *width, int *height, ID_T unsigned char red,green,blue,alphabyte; switch( targa_header.pixel_size ) { - + case 8: blue = *buf_p++; green = blue; @@ -715,7 +715,7 @@ static void LoadTGA( const char *name, byte **pic, int *width, int *height, ID_T common->Error( "LoadTGA( %s ): illegal pixel_size '%d'\n", name, targa_header.pixel_size ); break; } - + for( j = 0; j < packetSize; j++ ) { *pixbuf++=red; *pixbuf++=green; @@ -770,7 +770,7 @@ static void LoadTGA( const char *name, byte **pic, int *width, int *height, ID_T goto breakOut; } pixbuf = targa_rgba + row*columns*4; - } + } } } } @@ -898,12 +898,12 @@ static void LoadJPG( const char *filename, unsigned char **pic, int *width, int * output image dimensions available, as well as the output colormap * if we asked for color quantization. * In this example, we need to make an output work buffer of the right size. - */ + */ /* JSAMPLEs per row in output buffer */ row_stride = cinfo.output_width * cinfo.output_components; if (cinfo.output_components!=4) { - common->DWarning( "JPG %s is unsupported color depth (%d)", + common->DWarning( "JPG %s is unsupported color depth (%d)", filename, cinfo.output_components); } out = (byte *)R_StaticAlloc(cinfo.output_width*cinfo.output_height*4); @@ -919,13 +919,13 @@ static void LoadJPG( const char *filename, unsigned char **pic, int *width, int * loop counter, so that we don't have to keep track ourselves. */ while (cinfo.output_scanline < cinfo.output_height) { - /* jpeg_read_scanlines expects an array of pointers to scanlines. - * Here the array is only one element long, but you could ask for - * more than one scanline at a time if that's more convenient. - */ + /* jpeg_read_scanlines expects an array of pointers to scanlines. + * Here the array is only one element long, but you could ask for + * more than one scanline at a time if that's more convenient. + */ bbuf = ((out+(row_stride*cinfo.output_scanline))); buffer = &bbuf; - (void) jpeg_read_scanlines(&cinfo, buffer, 1); + (void) jpeg_read_scanlines(&cinfo, buffer, 1); } // clear all the alphas to 255 @@ -1084,9 +1084,9 @@ Loads six files with proper extensions */ bool R_LoadCubeImages( const char *imgName, cubeFiles_t extensions, byte *pics[6], int *outSize, ID_TIME_T *timestamp ) { int i, j; - char *cameraSides[6] = { "_forward.tga", "_back.tga", "_left.tga", "_right.tga", + char *cameraSides[6] = { "_forward.tga", "_back.tga", "_left.tga", "_right.tga", "_up.tga", "_down.tga" }; - char *axisSides[6] = { "_px.tga", "_nx.tga", "_py.tga", "_ny.tga", + char *axisSides[6] = { "_px.tga", "_nx.tga", "_py.tga", "_ny.tga", "_pz.tga", "_nz.tga" }; char **sides; char fullName[MAX_IMAGE_NAME]; diff --git a/neo/renderer/Image_init.cpp b/neo/renderer/Image_init.cpp index f520852a..02d5fcb5 100644 --- a/neo/renderer/Image_init.cpp +++ b/neo/renderer/Image_init.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,7 +67,7 @@ idCVar idImageManager::image_downSizeBump( "image_downSizeBump", "0", CVAR_RENDE idCVar idImageManager::image_downSizeSpecularLimit( "image_downSizeSpecularLimit", "64", CVAR_RENDERER | CVAR_ARCHIVE, "controls specular downsampled limit" ); idCVar idImageManager::image_downSizeBumpLimit( "image_downSizeBumpLimit", "128", CVAR_RENDERER | CVAR_ARCHIVE, "controls normal map downsample limit" ); idCVar idImageManager::image_ignoreHighQuality( "image_ignoreHighQuality", "0", CVAR_RENDERER | CVAR_ARCHIVE, "ignore high quality setting on materials" ); -idCVar idImageManager::image_downSizeLimit( "image_downSizeLimit", "256", CVAR_RENDERER | CVAR_ARCHIVE, "controls diffuse map downsample limit" ); +idCVar idImageManager::image_downSizeLimit( "image_downSizeLimit", "256", CVAR_RENDERER | CVAR_ARCHIVE, "controls diffuse map downsample limit" ); // do this with a pointer, in case we want to make the actual manager // a private virtual subclass idImageManager imageManager; @@ -134,13 +134,13 @@ static void R_RampImage( idImage *image ) { byte data[256][4]; for (x=0 ; x<256 ; x++) { - data[x][0] = - data[x][1] = - data[x][2] = - data[x][3] = x; + data[x][0] = + data[x][1] = + data[x][2] = + data[x][3] = x; } - image->GenerateImage( (byte *)data, 256, 1, + image->GenerateImage( (byte *)data, 256, 1, TF_NEAREST, false, TR_CLAMP, TD_HIGH_QUALITY ); } @@ -170,13 +170,13 @@ static void R_SpecularTableImage( idImage *image ) { #endif int b = (int)(f * 255); - data[x][0] = - data[x][1] = - data[x][2] = + data[x][0] = + data[x][1] = + data[x][2] = data[x][3] = b; } - image->GenerateImage( (byte *)data, 256, 1, + image->GenerateImage( (byte *)data, 256, 1, TF_LINEAR, false, TR_CLAMP, TD_HIGH_QUALITY ); } @@ -204,9 +204,9 @@ static void R_Specular2DTableImage( idImage *image ) { break; } - data[y][x][0] = - data[y][x][1] = - data[y][x][2] = + data[y][x][0] = + data[y][x][1] = + data[y][x][2] = data[y][x][3] = b; } } @@ -228,13 +228,13 @@ static void R_AlphaRampImage( idImage *image ) { byte data[256][4]; for (x=0 ; x<256 ; x++) { - data[x][0] = - data[x][1] = + data[x][0] = + data[x][1] = data[x][2] = 255; - data[x][3] = x; + data[x][3] = x; } - image->GenerateImage( (byte *)data, 256, 1, + image->GenerateImage( (byte *)data, 256, 1, TF_NEAREST, false, TR_CLAMP, TD_HIGH_QUALITY ); } @@ -297,8 +297,8 @@ void idImage::MakeDefault() { } } - GenerateImage( (byte *)data, - DEFAULT_SIZE, DEFAULT_SIZE, + GenerateImage( (byte *)data, + DEFAULT_SIZE, DEFAULT_SIZE, TF_DEFAULT, true, TR_REPEAT, TD_DEFAULT ); defaulted = true; @@ -313,7 +313,7 @@ static void R_WhiteImage( idImage *image ) { // solid white texture memset( data, 255, sizeof( data ) ); - image->GenerateImage( (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, + image->GenerateImage( (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, TF_DEFAULT, false, TR_REPEAT, TD_DEFAULT ); } @@ -322,7 +322,7 @@ static void R_BlackImage( idImage *image ) { // solid black texture memset( data, 0, sizeof( data ) ); - image->GenerateImage( (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, + image->GenerateImage( (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, TF_DEFAULT, false, TR_REPEAT, TD_DEFAULT ); } @@ -335,28 +335,28 @@ static void R_BorderClampImage( idImage *image ) { // solid white texture with a single pixel black border memset( data, 255, sizeof( data ) ); for ( int i = 0 ; i < BORDER_CLAMP_SIZE ; i++ ) { - data[i][0][0] = - data[i][0][1] = - data[i][0][2] = - data[i][0][3] = + data[i][0][0] = + data[i][0][1] = + data[i][0][2] = + data[i][0][3] = - data[i][BORDER_CLAMP_SIZE-1][0] = - data[i][BORDER_CLAMP_SIZE-1][1] = - data[i][BORDER_CLAMP_SIZE-1][2] = - data[i][BORDER_CLAMP_SIZE-1][3] = + data[i][BORDER_CLAMP_SIZE-1][0] = + data[i][BORDER_CLAMP_SIZE-1][1] = + data[i][BORDER_CLAMP_SIZE-1][2] = + data[i][BORDER_CLAMP_SIZE-1][3] = - data[0][i][0] = - data[0][i][1] = - data[0][i][2] = - data[0][i][3] = + data[0][i][0] = + data[0][i][1] = + data[0][i][2] = + data[0][i][3] = - data[BORDER_CLAMP_SIZE-1][i][0] = - data[BORDER_CLAMP_SIZE-1][i][1] = - data[BORDER_CLAMP_SIZE-1][i][2] = + data[BORDER_CLAMP_SIZE-1][i][0] = + data[BORDER_CLAMP_SIZE-1][i][1] = + data[BORDER_CLAMP_SIZE-1][i][2] = data[BORDER_CLAMP_SIZE-1][i][3] = 0; } - image->GenerateImage( (byte *)data, BORDER_CLAMP_SIZE, BORDER_CLAMP_SIZE, + image->GenerateImage( (byte *)data, BORDER_CLAMP_SIZE, BORDER_CLAMP_SIZE, TF_LINEAR /* TF_NEAREST */, false, TR_CLAMP_TO_BORDER, TD_DEFAULT ); if ( !glConfig.isInitialized ) { @@ -378,7 +378,7 @@ static void R_RGBA8Image( idImage *image ) { data[0][0][2] = 48; data[0][0][3] = 96; - image->GenerateImage( (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, + image->GenerateImage( (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, TF_DEFAULT, false, TR_REPEAT, TD_HIGH_QUALITY ); } @@ -391,7 +391,7 @@ static void R_RGB8Image( idImage *image ) { data[0][0][2] = 48; data[0][0][3] = 255; - image->GenerateImage( (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, + image->GenerateImage( (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, TF_DEFAULT, false, TR_REPEAT, TD_HIGH_QUALITY ); } @@ -405,7 +405,7 @@ static void R_AlphaNotchImage( idImage *image ) { data[1][0] = data[1][1] = data[1][2] = 255; data[1][3] = 255; - image->GenerateImage( (byte *)data, 2, 1, + image->GenerateImage( (byte *)data, 2, 1, TF_NEAREST, false, TR_CLAMP, TD_HIGH_QUALITY ); } @@ -422,7 +422,7 @@ static void R_FlatNormalImage( idImage *image ) { data[0][i][2] = 255; data[0][i][alpha] = 255; } - image->GenerateImage( (byte *)data, 2, 2, + image->GenerateImage( (byte *)data, 2, 2, TF_DEFAULT, true, TR_REPEAT, TD_HIGH_QUALITY ); } @@ -538,8 +538,8 @@ void CreatePitFogImage( void ) { #if 0 if ( i > 14 ) { a = 0; - } else -#endif + } else +#endif { a = i * 255 / 15; if ( a > 255 ) { @@ -603,35 +603,35 @@ static void getCubeVector(int i, int cubesize, int x, int y, float *vector) { switch (i) { case 0: - vector[0] = 1.0; - vector[1] = -tc; - vector[2] = -sc; - break; + vector[0] = 1.0; + vector[1] = -tc; + vector[2] = -sc; + break; case 1: - vector[0] = -1.0; - vector[1] = -tc; - vector[2] = sc; - break; + vector[0] = -1.0; + vector[1] = -tc; + vector[2] = sc; + break; case 2: - vector[0] = sc; - vector[1] = 1.0; - vector[2] = tc; - break; + vector[0] = sc; + vector[1] = 1.0; + vector[2] = tc; + break; case 3: - vector[0] = sc; - vector[1] = -1.0; - vector[2] = -tc; - break; + vector[0] = sc; + vector[1] = -1.0; + vector[2] = -tc; + break; case 4: - vector[0] = sc; - vector[1] = -tc; - vector[2] = 1.0; - break; + vector[0] = sc; + vector[1] = -tc; + vector[2] = 1.0; + break; case 5: - vector[0] = -sc; - vector[1] = -tc; - vector[2] = -1.0; - break; + vector[0] = -sc; + vector[1] = -tc; + vector[2] = -1.0; + break; } mag = idMath::InvSqrt(vector[0]*vector[0] + vector[1]*vector[1] + vector[2]*vector[2]); @@ -669,7 +669,7 @@ static void makeNormalizeVectorCubeMap( idImage *image ) { } image->GenerateCubeImage( (const byte **)pixels, size, - TF_LINEAR, false, TD_HIGH_QUALITY ); + TF_LINEAR, false, TD_HIGH_QUALITY ); Mem_Free(pixels[0]); } @@ -729,7 +729,7 @@ for ( i = 0 ; i < 256 ; i++ ) { for (y=0 ; yGenerateImage( (byte *)data, FOG_SIZE, FOG_SIZE, + image->GenerateImage( (byte *)data, FOG_SIZE, FOG_SIZE, TF_LINEAR, false, TR_CLAMP, TD_HIGH_QUALITY ); } @@ -858,7 +858,7 @@ void R_FogEnterImage( idImage *image ) { } // if mipmapped, acutely viewed surfaces fade wrong - image->GenerateImage( (byte *)data, FOG_ENTER_SIZE, FOG_ENTER_SIZE, + image->GenerateImage( (byte *)data, FOG_ENTER_SIZE, FOG_ENTER_SIZE, TF_LINEAR, false, TR_CLAMP, TD_HIGH_QUALITY ); } @@ -886,7 +886,7 @@ void R_QuadraticImage( idImage *image ) { d = idMath::Fabs( d ); d -= 0.5; d /= QUADRATIC_WIDTH/2; - + d = 1.0 - d; d = d * d; @@ -903,7 +903,7 @@ void R_QuadraticImage( idImage *image ) { } } - image->GenerateImage( (byte *)data, QUADRATIC_WIDTH, QUADRATIC_HEIGHT, + image->GenerateImage( (byte *)data, QUADRATIC_WIDTH, QUADRATIC_HEIGHT, TF_DEFAULT, false, TR_CLAMP, TD_HIGH_QUALITY ); } @@ -997,7 +997,7 @@ static filterName_t textureFilters[] = { } if ( glConfig.anisotropicAvailable ) { qglTexParameterf(texEnum, GL_TEXTURE_MAX_ANISOTROPY_EXT, globalImages->textureAnisotropy ); - } + } if ( glConfig.textureLODBiasAvailable ) { qglTexParameterf(texEnum, GL_TEXTURE_LOD_BIAS_EXT, globalImages->textureLODBias ); } @@ -1246,7 +1246,7 @@ void R_ListImages_f( const idCmdArgs &args ) { sortedArray[i].image->Print(); partialSize += sortedArray[i].image->StorageSize(); if ( ( (i+1) % 10 ) == 0 ) { - common->Printf( "-------- %5.1f of %5.1f megs --------\n", + common->Printf( "-------- %5.1f of %5.1f megs --------\n", partialSize / (1024*1024.0), totalSize / (1024*1024.0) ); } } @@ -1573,7 +1573,7 @@ idImage *idImageManager::ImageFromFile( const char *_name, textureFilter_t filte image->type = TT_2D; image->cubeFiles = cubeMap; image->filter = filter; - + image->levelLoadReferenced = true; // also create a shrunken version if we are going to dynamically cache the full size image diff --git a/neo/renderer/Image_load.cpp b/neo/renderer/Image_load.cpp index 09f9e4df..10ea10a0 100644 --- a/neo/renderer/Image_load.cpp +++ b/neo/renderer/Image_load.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 @@ PROBLEM: compressed textures may break the zero clamp rule! */ static bool FormatIsDXT( int internalFormat ) { - if ( internalFormat < GL_COMPRESSED_RGB_S3TC_DXT1_EXT + if ( internalFormat < GL_COMPRESSED_RGB_S3TC_DXT1_EXT || internalFormat > GL_COMPRESSED_RGBA_S3TC_DXT5_EXT ) { return false; } @@ -233,7 +233,7 @@ GLenum idImage::SelectInternalFormat( const byte **dataPtrs, int numDataPtrs, in cor = scan[0] | scan[1] | scan[2]; cand = scan[0] & scan[1] & scan[2]; - + // if rgb are all the same, the or and and will match rgbDiffer |= ( cor ^ cand ); @@ -278,7 +278,7 @@ GLenum idImage::SelectInternalFormat( const byte **dataPtrs, int numDataPtrs, in return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; } else { // we always need the alpha channel for bump maps for swizzling - return GL_RGBA8; + return GL_RGBA8; } } @@ -506,8 +506,8 @@ There is no way to specify explicit mip map levels ================ */ -void idImage::GenerateImage( const byte *pic, int width, int height, - textureFilter_t filterParm, bool allowDownSizeParm, +void idImage::GenerateImage( const byte *pic, int width, int height, + textureFilter_t filterParm, bool allowDownSizeParm, textureRepeat_t repeatParm, textureDepth_t depthParm ) { bool preserveBorder; byte *scaledBuffer; @@ -706,7 +706,7 @@ void idImage::GenerateImage( const byte *pic, int width, int height, if ( internalFormat == GL_COLOR_INDEX8_EXT ) { UploadCompressedNormalMap( scaled_width, scaled_height, scaledBuffer, miplevel ); } else { - qglTexImage2D( GL_TEXTURE_2D, miplevel, internalFormat, scaled_width, scaled_height, + qglTexImage2D( GL_TEXTURE_2D, miplevel, internalFormat, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaledBuffer ); } } @@ -728,7 +728,7 @@ Generate3DImage ================== */ void idImage::Generate3DImage( const byte *pic, int width, int height, int picDepth, - textureFilter_t filterParm, bool allowDownSizeParm, + textureFilter_t filterParm, bool allowDownSizeParm, textureRepeat_t repeatParm, textureDepth_t minDepthParm ) { int scaled_width, scaled_height, scaled_depth; @@ -863,8 +863,8 @@ GenerateCubeImage Non-square cube sides are not allowed ==================== */ -void idImage::GenerateCubeImage( const byte *pic[6], int size, - textureFilter_t filterParm, bool allowDownSizeParm, +void idImage::GenerateCubeImage( const byte *pic[6], int size, + textureFilter_t filterParm, bool allowDownSizeParm, textureDepth_t depthParm ) { int scaled_width, scaled_height; int width, height; @@ -932,7 +932,7 @@ void idImage::GenerateCubeImage( const byte *pic[6], int size, // upload the base level // FIXME: support GL_COLOR_INDEX8_EXT? for ( i = 0 ; i < 6 ; i++ ) { - qglTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT+i, 0, internalFormat, scaled_width, scaled_height, 0, + qglTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT+i, 0, internalFormat, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pic[i] ); } @@ -950,8 +950,8 @@ void idImage::GenerateCubeImage( const byte *pic[6], int size, for ( i = 0 ; i < 6 ; i++ ) { byte *shrunken; - qglTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT+i, miplevel, internalFormat, - scaled_width / 2, scaled_height / 2, 0, + qglTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT+i, miplevel, internalFormat, + scaled_width / 2, scaled_height / 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, shrunk[i] ); if ( scaled_width > 2 ) { @@ -1070,7 +1070,7 @@ void idImage::WritePrecompressedImage() { case GL_COLOR_INDEX8_EXT: case GL_COLOR_INDEX: // this will not work with dds viewers but we need it in this format to save disk - // load speed ( i.e. size ) + // load speed ( i.e. size ) altInternalFormat = GL_COLOR_INDEX; bitSize = 24; break; @@ -1465,36 +1465,36 @@ void idImage::UploadPrecompressedImage( byte *data, int len ) { uploadWidth = header->dwWidth; uploadHeight = header->dwHeight; - if ( header->ddspf.dwFlags & DDSF_FOURCC ) { - switch ( header->ddspf.dwFourCC ) { - case DDS_MAKEFOURCC( 'D', 'X', 'T', '1' ): + if ( header->ddspf.dwFlags & DDSF_FOURCC ) { + switch ( header->ddspf.dwFourCC ) { + case DDS_MAKEFOURCC( 'D', 'X', 'T', '1' ): if ( header->ddspf.dwFlags & DDSF_ALPHAPIXELS ) { internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; } else { internalFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; } - break; - case DDS_MAKEFOURCC( 'D', 'X', 'T', '3' ): - internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; - break; - case DDS_MAKEFOURCC( 'D', 'X', 'T', '5' ): - internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; - break; + break; + case DDS_MAKEFOURCC( 'D', 'X', 'T', '3' ): + internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; + break; + case DDS_MAKEFOURCC( 'D', 'X', 'T', '5' ): + internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; + break; case DDS_MAKEFOURCC( 'R', 'X', 'G', 'B' ): internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break; - default: - common->Warning( "Invalid compressed internal format\n" ); - return; - } - } else if ( ( header->ddspf.dwFlags & DDSF_RGBA ) && header->ddspf.dwRGBBitCount == 32 ) { + default: + common->Warning( "Invalid compressed internal format\n" ); + return; + } + } else if ( ( header->ddspf.dwFlags & DDSF_RGBA ) && header->ddspf.dwRGBBitCount == 32 ) { externalFormat = GL_BGRA_EXT; internalFormat = GL_RGBA8; - } else if ( ( header->ddspf.dwFlags & DDSF_RGB ) && header->ddspf.dwRGBBitCount == 32 ) { - externalFormat = GL_BGRA_EXT; + } else if ( ( header->ddspf.dwFlags & DDSF_RGB ) && header->ddspf.dwRGBBitCount == 32 ) { + externalFormat = GL_BGRA_EXT; internalFormat = GL_RGBA8; - } else if ( ( header->ddspf.dwFlags & DDSF_RGB ) && header->ddspf.dwRGBBitCount == 24 ) { - if ( header->ddspf.dwFlags & DDSF_ID_INDEXCOLOR ) { + } else if ( ( header->ddspf.dwFlags & DDSF_RGB ) && header->ddspf.dwRGBBitCount == 24 ) { + if ( header->ddspf.dwFlags & DDSF_ID_INDEXCOLOR ) { externalFormat = GL_COLOR_INDEX; internalFormat = GL_COLOR_INDEX8_EXT; } else { @@ -1984,14 +1984,14 @@ void idImage::UploadScratch( const byte *data, int cols, int rows ) { // upload the base level for ( i = 0 ; i < 6 ; i++ ) { - qglTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT+i, 0, GL_RGB8, cols, rows, 0, + qglTexImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT+i, 0, GL_RGB8, cols, rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, data + cols*rows*4*i ); } } else { // otherwise, just subimage upload it so that drivers can tell we are going to be changing // it and don't try and do a texture compression for ( i = 0 ; i < 6 ; i++ ) { - qglTexSubImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT+i, 0, 0, 0, cols, rows, + qglTexSubImage2D( GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT+i, 0, 0, 0, cols, rows, GL_RGBA, GL_UNSIGNED_BYTE, data + cols*rows*4*i ); } } @@ -2026,10 +2026,10 @@ void idImage::UploadScratch( const byte *data, int cols, int rows ) { // a smear across the entire polygon #if 1 qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); - qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); #else qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); - qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); + qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); #endif } } @@ -2205,7 +2205,7 @@ void idImage::Print() const { common->Printf( "", repeat ); break; } - + common->Printf( "%4ik ", StorageSize() / 1024 ); common->Printf( " %s\n", imgName.c_str() ); diff --git a/neo/renderer/Image_process.cpp b/neo/renderer/Image_process.cpp index 1288852f..c605ffed 100644 --- a/neo/renderer/Image_process.cpp +++ b/neo/renderer/Image_process.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"). @@ -39,12 +39,12 @@ Used to resample images in a more general than quartering fashion. This will only have filter coverage if the resampled size is greater than half the original size. -If a larger shrinking is needed, use the mipmap function +If a larger shrinking is needed, use the mipmap function after resampling to the next lower power of two. ================ */ #define MAX_DIMENSION 4096 -byte *R_ResampleTexture( const byte *in, int inwidth, int inheight, +byte *R_ResampleTexture( const byte *in, int inwidth, int inheight, int outwidth, int outheight ) { int i, j; const byte *inrow, *inrow2; @@ -103,7 +103,7 @@ Used to resample images in a more general than quartering fashion. Normal maps and such should not be bilerped. ================ */ -byte *R_Dropsample( const byte *in, int inwidth, int inheight, +byte *R_Dropsample( const byte *in, int inwidth, int inheight, int outwidth, int outheight ) { int i, j, k; const byte *inrow; @@ -618,4 +618,3 @@ void R_RotatePic( byte *data, int width ) { R_StaticFree( temp ); } - diff --git a/neo/renderer/Image_program.cpp b/neo/renderer/Image_program.cpp index aaca3831..df22968b 100644 --- a/neo/renderer/Image_program.cpp +++ b/neo/renderer/Image_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"). @@ -118,7 +118,7 @@ static void R_HeightmapToNormalMap( byte *data, int width, int height, float sca dir2[1] = a1 * scale; dir2[2] = 1; dir2.NormalizeFast(); - + dir += dir2; dir.NormalizeFast(); @@ -395,7 +395,7 @@ static bool R_ParseImageProgram_r( idLexer &src, byte **pic, int *width, int *he src.ReadToken( &token ); AppendToken( token ); scale = token.GetFloatValue(); - + // process it if ( pic ) { R_HeightmapToNormalMap( *pic, *width, *height, scale ); @@ -427,7 +427,7 @@ static bool R_ParseImageProgram_r( idLexer &src, byte **pic, int *width, int *he } return false; } - + // process it if ( pic ) { R_AddNormalMaps( *pic, *width, *height, pic2, width2, height2 ); @@ -478,7 +478,7 @@ static bool R_ParseImageProgram_r( idLexer &src, byte **pic, int *width, int *he } return false; } - + // process it if ( pic ) { R_ImageAdd( *pic, *width, *height, pic2, width2, height2 ); @@ -553,8 +553,8 @@ static bool R_ParseImageProgram_r( idLexer &src, byte **pic, int *width, int *he int c; c = *width * *height * 4; for ( i = 0 ; i < c ; i+=4 ) { - (*pic)[i+1] = - (*pic)[i+2] = + (*pic)[i+1] = + (*pic)[i+2] = (*pic)[i+3] = (*pic)[i]; } } @@ -576,8 +576,8 @@ static bool R_ParseImageProgram_r( idLexer &src, byte **pic, int *width, int *he c = *width * *height * 4; for ( i = 0 ; i < c ; i+=4 ) { (*pic)[i+3] = ( (*pic)[i+0] + (*pic)[i+1] + (*pic)[i+2] ) / 3; - (*pic)[i+0] = - (*pic)[i+1] = + (*pic)[i+0] = + (*pic)[i+1] = (*pic)[i+2] = 255; } } @@ -641,4 +641,3 @@ const char *R_ParsePastImageProgram( idLexer &src ) { R_ParseImageProgram_r( src, NULL, NULL, NULL, NULL, NULL ); return parseBuffer; } - diff --git a/neo/renderer/Interaction.cpp b/neo/renderer/Interaction.cpp index ad002798..a14327ea 100644 --- a/neo/renderer/Interaction.cpp +++ b/neo/renderer/Interaction.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"). @@ -213,7 +213,7 @@ static int R_ChopWinding( clipTri_t clipTris[2], int inNum, const idPlane plane out->numVerts = 0; for ( i = 0 ; i < in->numVerts ; i++ ) { idVec3 &p1 = in->verts[i]; - + if ( sides[i] == SIDE_FRONT ) { out->verts[out->numVerts] = p1; out->numVerts++; @@ -222,15 +222,15 @@ static int R_ChopWinding( clipTri_t clipTris[2], int inNum, const idPlane plane if ( sides[i+1] == sides[i] ) { continue; } - + // generate a split point idVec3 &p2 = in->verts[i+1]; - + dot = dists[i] / ( dists[i] - dists[i+1] ); for ( j = 0; j < 3; j++ ) { mid[j] = p1[j] + dot * ( p2[j] - p1[j] ); } - + out->verts[out->numVerts] = mid; out->numVerts++; @@ -277,7 +277,7 @@ The resulting surface will be a subset of the original triangles, it will never clip triangles, but it may cull on a per-triangle basis. ==================== */ -static srfTriangles_t *R_CreateLightTris( const idRenderEntityLocal *ent, +static srfTriangles_t *R_CreateLightTris( const idRenderEntityLocal *ent, const srfTriangles_t *tri, const idRenderLightLocal *light, const idMaterial *shader, srfCullInfo_t &cullInfo ) { int i; @@ -858,7 +858,7 @@ void idInteraction::CreateInteraction( const idRenderModel *model ) { for ( int c = 0 ; c < model->NumSurfaces() ; c++ ) { const modelSurface_t *surf; srfTriangles_t *tri; - + surf = model->Surface( c ); tri = surf->geometry; @@ -1157,13 +1157,13 @@ void idInteraction::AddActiveInteraction( void ) { // there will only be localSurfaces if the light casts shadows and // there are surfaces with NOSELFSHADOW if ( sint->shader->Coverage() == MC_TRANSLUCENT ) { - R_LinkLightSurf( &vLight->translucentInteractions, lightTris, + R_LinkLightSurf( &vLight->translucentInteractions, lightTris, vEntity, lightDef, shader, lightScissor, false ); } else if ( !lightDef->parms.noShadows && sint->shader->TestMaterialFlag(MF_NOSELFSHADOW) ) { - R_LinkLightSurf( &vLight->localInteractions, lightTris, + R_LinkLightSurf( &vLight->localInteractions, lightTris, vEntity, lightDef, shader, lightScissor, false ); } else { - R_LinkLightSurf( &vLight->globalInteractions, lightTris, + R_LinkLightSurf( &vLight->globalInteractions, lightTris, vEntity, lightDef, shader, lightScissor, false ); } } @@ -1175,7 +1175,7 @@ void idInteraction::AddActiveInteraction( void ) { // the shadows will always have to be added, unless we can tell they // are from a surface in an unconnected area if ( shadowTris ) { - + // check for view specific shadow suppression (player shadows, etc) if ( !r_skipSuppress.GetBool() ) { if ( entityDef->parms.suppressShadowInViewID && diff --git a/neo/renderer/Interaction.h b/neo/renderer/Interaction.h index 1af0c3f4..6396fe7f 100644 --- a/neo/renderer/Interaction.h +++ b/neo/renderer/Interaction.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"). @@ -61,7 +61,7 @@ typedef struct { } srfCullInfo_t; -typedef struct { +typedef struct { // if lightTris == LIGHT_TRIS_DEFERRED, then the calculation of the // lightTris has been deferred, and must be done if ambientTris is visible srfTriangles_t * lightTris; @@ -100,7 +100,7 @@ public: // be present as a surfaceInteraction_t with a NULL ambientTris, but // possibly having a shader to specify the shadow sorting order surfaceInteraction_t * surfaces; - + // get space from here, if NULL, it is a pre-generated shadow volume from dmap idRenderEntityLocal * entityDef; idRenderLightLocal * lightDef; diff --git a/neo/renderer/Material.cpp b/neo/renderer/Material.cpp index af219a4e..80dea92a 100644 --- a/neo/renderer/Material.cpp +++ b/neo/renderer/Material.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"). @@ -1010,7 +1010,7 @@ void idMaterial::ParseFragmentMap( idLexer &src, newShaderStage_t *newStage ) { } str = R_ParsePastImageProgram( src ); - newStage->fragmentProgramImages[unit] = + newStage->fragmentProgramImages[unit] = globalImages->ImageFromFile( str, tf, allowPicmip, trp, td, cubeMap ); if ( !newStage->fragmentProgramImages[unit] ) { newStage->fragmentProgramImages[unit] = globalImages->defaultImage; @@ -1040,7 +1040,7 @@ void idMaterial::MultiplyTextureMatrix( textureStage_t *ts, int registers[2][3] ts->matrix[0][1] = EmitOp( EmitOp( old[0][0], registers[0][1], OP_TYPE_MULTIPLY ), EmitOp( old[0][1], registers[1][1], OP_TYPE_MULTIPLY ), OP_TYPE_ADD ); - ts->matrix[0][2] = EmitOp( + ts->matrix[0][2] = EmitOp( EmitOp( EmitOp( old[0][0], registers[0][2], OP_TYPE_MULTIPLY ), EmitOp( old[0][1], registers[1][2], OP_TYPE_MULTIPLY ), OP_TYPE_ADD ), @@ -1052,7 +1052,7 @@ void idMaterial::MultiplyTextureMatrix( textureStage_t *ts, int registers[2][3] ts->matrix[1][1] = EmitOp( EmitOp( old[1][0], registers[0][1], OP_TYPE_MULTIPLY ), EmitOp( old[1][1], registers[1][1], OP_TYPE_MULTIPLY ), OP_TYPE_ADD ); - ts->matrix[1][2] = EmitOp( + ts->matrix[1][2] = EmitOp( EmitOp( EmitOp( old[1][0], registers[0][2], OP_TYPE_MULTIPLY ), EmitOp( old[1][1], registers[1][2], OP_TYPE_MULTIPLY ), OP_TYPE_ADD ), @@ -1390,13 +1390,13 @@ void idMaterial::ParseStage( idLexer &src, const textureRepeat_t trpDefault ) { // this subtracts 0.5, then rotates, then adds 0.5 matrix[0][0] = cosReg; matrix[0][1] = EmitOp( GetExpressionConstant( 0 ), sinReg, OP_TYPE_SUBTRACT ); - matrix[0][2] = EmitOp( EmitOp( EmitOp( GetExpressionConstant( -0.5 ), cosReg, OP_TYPE_MULTIPLY ), + matrix[0][2] = EmitOp( EmitOp( EmitOp( GetExpressionConstant( -0.5 ), cosReg, OP_TYPE_MULTIPLY ), EmitOp( GetExpressionConstant( 0.5 ), sinReg, OP_TYPE_MULTIPLY ), OP_TYPE_ADD ), GetExpressionConstant( 0.5 ), OP_TYPE_ADD ); matrix[1][0] = sinReg; matrix[1][1] = cosReg; - matrix[1][2] = EmitOp( EmitOp( EmitOp( GetExpressionConstant( -0.5 ), sinReg, OP_TYPE_MULTIPLY ), + matrix[1][2] = EmitOp( EmitOp( EmitOp( GetExpressionConstant( -0.5 ), sinReg, OP_TYPE_MULTIPLY ), EmitOp( GetExpressionConstant( -0.5 ), cosReg, OP_TYPE_MULTIPLY ), OP_TYPE_ADD ), GetExpressionConstant( 0.5 ), OP_TYPE_ADD ); @@ -1408,33 +1408,33 @@ void idMaterial::ParseStage( idLexer &src, const textureRepeat_t trpDefault ) { if ( !token.Icmp( "maskRed" ) ) { ss->drawStateBits |= GLS_REDMASK; continue; - } + } if ( !token.Icmp( "maskGreen" ) ) { ss->drawStateBits |= GLS_GREENMASK; continue; - } + } if ( !token.Icmp( "maskBlue" ) ) { ss->drawStateBits |= GLS_BLUEMASK; continue; - } + } if ( !token.Icmp( "maskAlpha" ) ) { ss->drawStateBits |= GLS_ALPHAMASK; continue; - } + } if ( !token.Icmp( "maskColor" ) ) { ss->drawStateBits |= GLS_COLORMASK; continue; - } + } if ( !token.Icmp( "maskDepth" ) ) { ss->drawStateBits |= GLS_DEPTHMASK; continue; - } + } if ( !token.Icmp( "alphaTest" ) ) { ss->hasAlphaTest = true; ss->alphaTestRegister = ParseExpression( src ); coverage = MC_PERFORATED; continue; - } + } // shorthand for 2D modulated if ( !token.Icmp( "colored" ) ) { @@ -1473,12 +1473,12 @@ void idMaterial::ParseStage( idLexer &src, const textureRepeat_t trpDefault ) { continue; } if ( !token.Icmp( "rgb" ) ) { - ss->color.registers[0] = ss->color.registers[1] = + ss->color.registers[0] = ss->color.registers[1] = ss->color.registers[2] = ParseExpression( src ); continue; } if ( !token.Icmp( "rgba" ) ) { - ss->color.registers[0] = ss->color.registers[1] = + ss->color.registers[0] = ss->color.registers[1] = ss->color.registers[2] = ss->color.registers[3] = ParseExpression( src ); continue; } @@ -1526,7 +1526,7 @@ void idMaterial::ParseStage( idLexer &src, const textureRepeat_t trpDefault ) { continue; } - if ( !token.Icmp( "fragmentMap" ) ) { + if ( !token.Icmp( "fragmentMap" ) ) { ParseFragmentMap( src, &newStage ); continue; } @@ -2167,7 +2167,7 @@ bool idMaterial::Parse( const char *text, const int textLength ) { // automatically determine coverage if not explicitly set if ( coverage == MC_BAD ) { - // automatically set MC_TRANSLUCENT if we don't have any interaction stages and + // automatically set MC_TRANSLUCENT if we don't have any interaction stages and // the first stage is blended and not an alpha test mask or a subview if ( !numStages ) { // non-visible @@ -2175,7 +2175,7 @@ bool idMaterial::Parse( const char *text, const int textLength ) { } else if ( numStages != numAmbientStages ) { // we have an interaction draw coverage = MC_OPAQUE; - } else if ( + } else if ( ( pd->parseStages[0].drawStateBits & GLS_DSTBLEND_BITS ) != GLS_DSTBLEND_ZERO || ( pd->parseStages[0].drawStateBits & GLS_SRCBLEND_BITS ) == GLS_SRCBLEND_DST_COLOR || ( pd->parseStages[0].drawStateBits & GLS_SRCBLEND_BITS ) == GLS_SRCBLEND_ONE_MINUS_DST_COLOR || @@ -2504,7 +2504,7 @@ texgen_t idMaterial::Texgen() const { } } } - + return TG_EXPLICIT; } @@ -2607,7 +2607,7 @@ void idMaterial::CheckForConstantRegisters() { return; } - // evaluate the registers once, and save them + // evaluate the registers once, and save them constantRegisters = (float *)R_ClearedStaticAlloc( GetNumRegisters() * sizeof( float ) ); float shaderParms[MAX_ENTITY_SHADER_PARMS]; @@ -2668,7 +2668,7 @@ bool idMaterial::SetDefaultText( void ) { // if there exists an image with the same name if ( 1 ) { //fileSystem->ReadFile( GetName(), NULL ) != -1 ) { char generated[2048]; - idStr::snPrintf( generated, sizeof( generated ), + idStr::snPrintf( generated, sizeof( generated ), "material %s // IMPLICITLY GENERATED\n" "{\n" "{\n" diff --git a/neo/renderer/Material.h b/neo/renderer/Material.h index ad640274..71ee936f 100644 --- a/neo/renderer/Material.h +++ b/neo/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/neo/renderer/MegaTexture.cpp b/neo/renderer/MegaTexture.cpp index 234c3666..e04938f8 100644 --- a/neo/renderer/MegaTexture.cpp +++ b/neo/renderer/MegaTexture.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 @@ static void R_EmptyLevelImage( idImage *image ) { } // FIXME: this won't live past vid mode changes - image->GenerateImage( data, MAX_LEVEL_WIDTH, MAX_LEVEL_WIDTH, + image->GenerateImage( data, MAX_LEVEL_WIDTH, MAX_LEVEL_WIDTH, TF_DEFAULT, false, TR_REPEAT, TD_HIGH_QUALITY ); } @@ -138,7 +138,7 @@ bool idMegaTexture::InitFromMegaFile( const char *fileBase ) { levels[numLevels].image = globalImages->ImageFromFunction( str, R_EmptyLevelImage ); numLevels++; - + if ( width <= TILE_PER_LEVEL && height <= TILE_PER_LEVEL ) { break; } @@ -238,7 +238,7 @@ void idMegaTexture::BindForViewOrigin( const idVec3 viewOrigin ) { qglProgramLocalParameter4fvARB( GL_VERTEX_PROGRAM_ARB, i, parms ); } else { idTextureLevel *level = &levels[ numLevels-1-i ]; - + if ( r_showMegaTexture.GetBool() ) { if ( i & 1 ) { globalImages->blackImage->Bind(); @@ -310,7 +310,7 @@ void idMegaTexture::SetViewOrigin( const idVec3 viewOrigin ) { // convert the viewOrigin to a texture center, which will // be a different conversion for each megaTexture for ( int i = 0 ; i < 2 ; i++ ) { - texCenter[i] = + texCenter[i] = viewOrigin[0] * localViewToTextureCenter[i][0] + viewOrigin[1] * localViewToTextureCenter[i][1] + viewOrigin[2] * localViewToTextureCenter[i][2] + @@ -470,7 +470,7 @@ void idTextureLevel::Invalidate() { typedef struct _TargaHeader { - unsigned char id_length, colormap_type, image_type; + unsigned char id_length, colormap_type, image_type; unsigned short colormap_index, colormap_length; unsigned char colormap_size; unsigned short x_origin, y_origin, width, height; @@ -683,7 +683,7 @@ void idMegaTexture::MakeMegaTexture_f( const idCmdArgs &args ) { targa_header.id_length = ReadByte( file ); targa_header.colormap_type = ReadByte( file ); targa_header.image_type = ReadByte( file ); - + targa_header.colormap_index = ReadShort( file ); targa_header.colormap_length = ReadShort( file ); targa_header.colormap_size = ReadByte( file ); @@ -720,7 +720,7 @@ void idMegaTexture::MakeMegaTexture_f( const idCmdArgs &args ) { if ( targa_header.id_length != 0 ) { file->Seek( targa_header.id_length, FS_SEEK_CUR ); } - + megaTextureHeader_t mtHeader; mtHeader.tileSize = TILE_SIZE; @@ -731,7 +731,7 @@ void idMegaTexture::MakeMegaTexture_f( const idCmdArgs &args ) { outName.StripFileExtension(); outName += ".mega"; - common->Printf( "Writing %i x %i size %i tiles to %s.\n", + common->Printf( "Writing %i x %i size %i tiles to %s.\n", mtHeader.tilesWide, mtHeader.tilesHigh, mtHeader.tileSize, outName.c_str() ); // open the output megatexture file @@ -749,7 +749,7 @@ void idMegaTexture::MakeMegaTexture_f( const idCmdArgs &args ) { common->Printf( "%i blockRowsRemaining\n", blockRowsRemaining ); session->UpdateScreen(); - if ( targa_header.image_type == 2 || targa_header.image_type == 3 ) { + if ( targa_header.image_type == 2 || targa_header.image_type == 3 ) { // Uncompressed RGB or gray scale image for( row = 0 ; row < TILE_SIZE ; row++ ) { pixbuf = targa_rgba + row*columns*4; @@ -822,7 +822,7 @@ void idMegaTexture::MakeMegaTexture_f( const idCmdArgs &args ) { common->Error( "LoadTGA( %s ): illegal pixel_size '%d'\n", name, targa_header.pixel_size ); break; } - + for( j = 0; j < packetSize; j++ ) { *pixbuf++=red; *pixbuf++=green; @@ -877,7 +877,7 @@ void idMegaTexture::MakeMegaTexture_f( const idCmdArgs &args ) { goto breakOut; } pixbuf = targa_rgba + row*columns*4; - } + } } } } @@ -909,5 +909,3 @@ void idMegaTexture::MakeMegaTexture_f( const idCmdArgs &args ) { } #endif } - - diff --git a/neo/renderer/MegaTexture.h b/neo/renderer/MegaTexture.h index 2fe5d37b..f25aaab3 100644 --- a/neo/renderer/MegaTexture.h +++ b/neo/renderer/MegaTexture.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"). @@ -96,4 +96,3 @@ friend class idTextureLevel; static idCVar r_skipMegaTexture; static idCVar r_terrainScale; }; - diff --git a/neo/renderer/Model.cpp b/neo/renderer/Model.cpp index d9fd1e59..9c975292 100644 --- a/neo/renderer/Model.cpp +++ b/neo/renderer/Model.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,8 +78,8 @@ idRenderModelStatic::Print void idRenderModelStatic::Print() const { common->Printf( "%s\n", name.c_str() ); common->Printf( "Static model.\n" ); - common->Printf( "bounds: (%f %f %f) to (%f %f %f)\n", - bounds[0][0], bounds[0][1], bounds[0][2], + common->Printf( "bounds: (%f %f %f) to (%f %f %f)\n", + bounds[0][0], bounds[0][1], bounds[0][2], bounds[1][0], bounds[1][1], bounds[1][2] ); common->Printf( " verts tris material\n" ); @@ -88,7 +88,7 @@ void idRenderModelStatic::Print() const { srfTriangles_t *tri = surf->geometry; const idMaterial *material = surf->shader; - + if ( !tri ) { common->Printf( "%2i: %s, NULL surface geometry\n", i, material->GetName() ); continue; @@ -100,7 +100,7 @@ void idRenderModelStatic::Print() const { } else { common->Printf( "\n" ); } - } + } } /* @@ -754,19 +754,19 @@ bool idRenderModelStatic::ConvertASEToModelSurfaces( const struct aseModel_s *as // the modeling programs can save out multiple surfaces with a common // material, but we would like to mege them together where possible // meaning that this->NumSurfaces() <= ase->objects.currentElements - mergeTo = (int *)_alloca( ase->objects.Num() * sizeof( *mergeTo ) ); + mergeTo = (int *)_alloca( ase->objects.Num() * sizeof( *mergeTo ) ); surf.geometry = NULL; if ( ase->materials.Num() == 0 ) { // if we don't have any materials, dump everything into a single surface surf.shader = tr.defaultMaterial; surf.id = 0; this->AddSurface( surf ); - for ( i = 0 ; i < ase->objects.Num() ; i++ ) { + for ( i = 0 ; i < ase->objects.Num() ; i++ ) { mergeTo[i] = 0; } } else if ( !r_mergeModelSurfaces.GetBool() ) { // don't merge any - for ( i = 0 ; i < ase->objects.Num() ; i++ ) { + for ( i = 0 ; i < ase->objects.Num() ; i++ ) { mergeTo[i] = i; object = ase->objects[i]; material = ase->materials[object->materialRef]; @@ -776,7 +776,7 @@ bool idRenderModelStatic::ConvertASEToModelSurfaces( const struct aseModel_s *as } } else { // search for material matches - for ( i = 0 ; i < ase->objects.Num() ; i++ ) { + for ( i = 0 ; i < ase->objects.Num() ; i++ ) { object = ase->objects[i]; material = ase->materials[object->materialRef]; im1 = declManager->FindMaterial( material->name ); @@ -902,7 +902,7 @@ bool idRenderModelStatic::ConvertASEToModelSurfaces( const struct aseModel_s *as common->Error( "ConvertASEToModelSurfaces: bad vertex index in ASE file %s", name.c_str() ); } - // collapse the position if it was slightly offset + // collapse the position if it was slightly offset v = vRemap[v]; // we may or may not have texcoords to compare @@ -1066,7 +1066,7 @@ bool idRenderModelStatic::ConvertLWOToModelSurfaces( const struct st_lwObject *l // the modeling programs can save out multiple surfaces with a common // material, but we would like to merge them together where possible - mergeTo = (int *)_alloca( i * sizeof( mergeTo[0] ) ); + mergeTo = (int *)_alloca( i * sizeof( mergeTo[0] ) ); memset( &surf, 0, sizeof( surf ) ); if ( !r_mergeModelSurfaces.GetBool() ) { @@ -1140,17 +1140,17 @@ bool idRenderModelStatic::ConvertLWOToModelSurfaces( const struct st_lwObject *l int offset = 0; for( lwVMap *vm = layer->vmap; vm; vm = vm->next ) { if ( vm->type == LWID_('T','X','U','V') ) { - vm->offset = offset; - for ( k = 0; k < vm->nverts; k++ ) { - tvList[k + offset].x = vm->val[k][0]; + vm->offset = offset; + for ( k = 0; k < vm->nverts; k++ ) { + tvList[k + offset].x = vm->val[k][0]; tvList[k + offset].y = 1.0f - vm->val[k][1]; // invert the t - } - offset += vm->nverts; + } + offset += vm->nverts; } } } else { common->Warning( "ConvertLWOToModelSurfaces: model \'%s\' has bad or missing uv data", name.c_str() ); - numTVertexes = 1; + numTVertexes = 1; tvList = (idVec2 *)Mem_ClearedAlloc( numTVertexes * sizeof( tvList[0] ) ); } @@ -1435,7 +1435,7 @@ struct aseModel_s *idRenderModelStatic::ConvertLWOToASE( const struct st_lwObjec mesh->numTVertexes = 0; if ( layer->nvmaps ) { - for( lwVMap *vm = layer->vmap; vm; vm = vm->next ) { + for( lwVMap *vm = layer->vmap; vm; vm = vm->next ) { if ( vm->type == LWID_('T','X','U','V') ) { mesh->numTVertexes += vm->nverts; } @@ -1443,23 +1443,23 @@ struct aseModel_s *idRenderModelStatic::ConvertLWOToASE( const struct st_lwObjec } if ( mesh->numTVertexes ) { - mesh->tvertexes = (idVec2 *)Mem_Alloc( mesh->numTVertexes * sizeof( mesh->tvertexes[0] ) ); - int offset = 0; - for( lwVMap *vm = layer->vmap; vm; vm = vm->next ) { + mesh->tvertexes = (idVec2 *)Mem_Alloc( mesh->numTVertexes * sizeof( mesh->tvertexes[0] ) ); + int offset = 0; + for( lwVMap *vm = layer->vmap; vm; vm = vm->next ) { if ( vm->type == LWID_('T','X','U','V') ) { - vm->offset = offset; - for ( k = 0; k < vm->nverts; k++ ) { - mesh->tvertexes[k + offset].x = vm->val[k][0]; + vm->offset = offset; + for ( k = 0; k < vm->nverts; k++ ) { + mesh->tvertexes[k + offset].x = vm->val[k][0]; mesh->tvertexes[k + offset].y = 1.0f - vm->val[k][1]; // invert the t - } - offset += vm->nverts; + } + offset += vm->nverts; } - } - } else { + } + } else { common->Warning( "ConvertLWOToASE: model \'%s\' has bad or missing uv data", fileName ); - mesh->numTVertexes = 1; - mesh->tvertexes = (idVec2 *)Mem_ClearedAlloc( mesh->numTVertexes * sizeof( mesh->tvertexes[0] ) ); - } + mesh->numTVertexes = 1; + mesh->tvertexes = (idVec2 *)Mem_ClearedAlloc( mesh->numTVertexes * sizeof( mesh->tvertexes[0] ) ); + } mesh->normalsParsed = true; mesh->colorsParsed = true; // because we are falling back to the surface color @@ -1477,7 +1477,7 @@ struct aseModel_s *idRenderModelStatic::ConvertLWOToASE( const struct st_lwObjec common->Warning( "ConvertLWOToASE: model %s has too many verts for a poly! Make sure you triplet it down", fileName ); continue; } - + mesh->faces[faceIndex].faceNormal.x = poly->norm[0]; mesh->faces[faceIndex].faceNormal.y = poly->norm[2]; mesh->faces[faceIndex].faceNormal.z = poly->norm[1]; @@ -1554,7 +1554,7 @@ bool idRenderModelStatic::ConvertMAToModelSurfaces (const struct maModel_s *ma ) maObject_t * object; maMesh_t * mesh; maMaterial_t * material; - + const idMaterial *im1, *im2; srfTriangles_t *tri; int objectNum; @@ -1586,7 +1586,7 @@ bool idRenderModelStatic::ConvertMAToModelSurfaces (const struct maModel_s *ma ) // the modeling programs can save out multiple surfaces with a common // material, but we would like to mege them together where possible // meaning that this->NumSurfaces() <= ma->objects.currentElements - mergeTo = (int *)_alloca( ma->objects.Num() * sizeof( *mergeTo ) ); + mergeTo = (int *)_alloca( ma->objects.Num() * sizeof( *mergeTo ) ); surf.geometry = NULL; if ( ma->materials.Num() == 0 ) { @@ -1594,12 +1594,12 @@ bool idRenderModelStatic::ConvertMAToModelSurfaces (const struct maModel_s *ma ) surf.shader = tr.defaultMaterial; surf.id = 0; this->AddSurface( surf ); - for ( i = 0 ; i < ma->objects.Num() ; i++ ) { + for ( i = 0 ; i < ma->objects.Num() ; i++ ) { mergeTo[i] = 0; } } else if ( !r_mergeModelSurfaces.GetBool() ) { // don't merge any - for ( i = 0 ; i < ma->objects.Num() ; i++ ) { + for ( i = 0 ; i < ma->objects.Num() ; i++ ) { mergeTo[i] = i; object = ma->objects[i]; if(object->materialRef >= 0) { @@ -1613,7 +1613,7 @@ bool idRenderModelStatic::ConvertMAToModelSurfaces (const struct maModel_s *ma ) } } else { // search for material matches - for ( i = 0 ; i < ma->objects.Num() ; i++ ) { + for ( i = 0 ; i < ma->objects.Num() ; i++ ) { object = ma->objects[i]; if(object->materialRef >= 0) { material = ma->materials[object->materialRef]; @@ -1660,7 +1660,7 @@ bool idRenderModelStatic::ConvertMAToModelSurfaces (const struct maModel_s *ma ) } bool normalsParsed = mesh->normalsParsed; - + // completely ignore any explict normals on surfaces with a renderbump command // which will guarantee the best contours and least vertexes. const char *rb = im1->GetRenderBump(); @@ -1747,7 +1747,7 @@ bool idRenderModelStatic::ConvertMAToModelSurfaces (const struct maModel_s *ma ) common->Error( "ConvertMAToModelSurfaces: bad vertex index in MA file %s", name.c_str() ); } - // collapse the position if it was slightly offset + // collapse the position if it was slightly offset v = vRemap[v]; // we may or may not have texcoords to compare @@ -1990,7 +1990,7 @@ bool idRenderModelStatic::LoadFLT( const char *fileName ) { // find the island above sea level int minX, maxX, minY, maxY; { - int i; + int i; for ( minX = 0 ; minX < size ; minX++ ) { for ( i = 0 ; i < size ; i++ ) { if ( data[i*size + minX] > 1.0 ) { @@ -2157,19 +2157,19 @@ void idRenderModelStatic::ReadFromDemoFile( class idDemoFile *f ) { int i, j, numSurfaces; f->ReadInt( numSurfaces ); - + for ( i = 0 ; i < numSurfaces ; i++ ) { modelSurface_t surf; - + surf.shader = declManager->FindMaterial( f->ReadHashString() ); - + srfTriangles_t *tri = R_AllocStaticTriSurf(); - + f->ReadInt( tri->numIndexes ); R_AllocStaticTriSurfIndexes( tri, tri->numIndexes ); for ( j = 0; j < tri->numIndexes; ++j ) f->ReadInt( (int&)tri->indexes[j] ); - + f->ReadInt( tri->numVerts ); R_AllocStaticTriSurfVerts( tri, tri->numVerts ); for ( j = 0; j < tri->numVerts; ++j ) { @@ -2183,9 +2183,9 @@ void idRenderModelStatic::ReadFromDemoFile( class idDemoFile *f ) { f->ReadUnsignedChar( tri->verts[j].color[2] ); f->ReadUnsignedChar( tri->verts[j].color[3] ); } - + surf.geometry = tri; - + this->AddSurface( surf ); } this->FinishSurfaces(); @@ -2211,9 +2211,9 @@ void idRenderModelStatic::WriteToDemoFile( class idDemoFile *f ) { for ( i = 0 ; i < surfaces.Num() ; i++ ) { const modelSurface_t *surf = &surfaces[i]; - + f->WriteHashString( surf->shader->GetName() ); - + srfTriangles_t *tri = surf->geometry; f->WriteInt( tri->numIndexes ); for ( j = 0; j < tri->numIndexes; ++j ) diff --git a/neo/renderer/Model.h b/neo/renderer/Model.h index 6bf1b9d9..419a64ed 100644 --- a/neo/renderer/Model.h +++ b/neo/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/neo/renderer/ModelDecal.cpp b/neo/renderer/ModelDecal.cpp index 66c645c9..62911619 100644 --- a/neo/renderer/ModelDecal.cpp +++ b/neo/renderer/ModelDecal.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"). @@ -156,16 +156,16 @@ bool idRenderModelDecal::CreateProjectionInfo( decalProjectionInfo_t &info, cons texArea = ( d0[3] * d1[4] ) - ( d0[4] * d1[3] ); inva = 1.0f / texArea; - temp[0] = ( d0[0] * d1[4] - d0[4] * d1[0] ) * inva; - temp[1] = ( d0[1] * d1[4] - d0[4] * d1[1] ) * inva; - temp[2] = ( d0[2] * d1[4] - d0[4] * d1[2] ) * inva; + temp[0] = ( d0[0] * d1[4] - d0[4] * d1[0] ) * inva; + temp[1] = ( d0[1] * d1[4] - d0[4] * d1[1] ) * inva; + temp[2] = ( d0[2] * d1[4] - d0[4] * d1[2] ) * inva; len = temp.Normalize(); info.textureAxis[0].Normal() = temp * ( 1.0f / len ); info.textureAxis[0][3] = winding[0].s - ( winding[0].ToVec3() * info.textureAxis[0].Normal() ); - temp[0] = ( d0[3] * d1[0] - d0[0] * d1[3] ) * inva; - temp[1] = ( d0[3] * d1[1] - d0[1] * d1[3] ) * inva; - temp[2] = ( d0[3] * d1[2] - d0[2] * d1[3] ) * inva; + temp[0] = ( d0[3] * d1[0] - d0[0] * d1[3] ) * inva; + temp[1] = ( d0[3] * d1[1] - d0[1] * d1[3] ) * inva; + temp[2] = ( d0[3] * d1[2] - d0[2] * d1[3] ) * inva; len = temp.Normalize(); info.textureAxis[1].Normal() = temp * ( 1.0f / len ); info.textureAxis[1][3] = winding[0].t - ( winding[0].ToVec3() * info.textureAxis[1].Normal() ); @@ -405,7 +405,7 @@ idRenderModelDecal *idRenderModelDecal::RemoveFadedDecals( idRenderModelDecal *d Free( decals ); return nextDecal; } - + decalInfo = decals->material->GetDecalInfo(); minTime = time - ( decalInfo.stayTime + decalInfo.fadeTime ); @@ -465,7 +465,7 @@ void idRenderModelDecal::AddDecalDrawSurf( viewEntity_t *space ) { int i, j, maxTime; float f; decalInfo_t decalInfo; - + if ( tri.numIndexes == 0 ) { return; } diff --git a/neo/renderer/ModelDecal.h b/neo/renderer/ModelDecal.h index 8b15d88a..3228ee2e 100644 --- a/neo/renderer/ModelDecal.h +++ b/neo/renderer/ModelDecal.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/neo/renderer/ModelManager.cpp b/neo/renderer/ModelManager.cpp index 5c1a8e5e..0ac1562c 100644 --- a/neo/renderer/ModelManager.cpp +++ b/neo/renderer/ModelManager.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"). @@ -368,7 +368,7 @@ void idRenderModelManagerLocal::FreeModel( idRenderModel *model ) { common->Error( "idRenderModelManager::FreeModel: can't free the beam model" ); return; } - if ( model == spriteModel ) { + if ( model == spriteModel ) { common->Error( "idRenderModelManager::FreeModel: can't free the sprite model" ); return; } diff --git a/neo/renderer/ModelManager.h b/neo/renderer/ModelManager.h index 62144cad..2b61f438 100644 --- a/neo/renderer/ModelManager.h +++ b/neo/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/neo/renderer/ModelOverlay.cpp b/neo/renderer/ModelOverlay.cpp index 606ed674..de13f6b1 100644 --- a/neo/renderer/ModelOverlay.cpp +++ b/neo/renderer/ModelOverlay.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"). @@ -210,7 +210,7 @@ void idRenderModelOverlay::CreateOverlay( const idRenderModel *model, const idPl } } if ( i < materials.Num() ) { - materials[i]->surfaces.Append( s ); + materials[i]->surfaces.Append( s ); } else { overlayMaterial_t *mat = new overlayMaterial_t; mat->material = mtr; diff --git a/neo/renderer/ModelOverlay.h b/neo/renderer/ModelOverlay.h index dd6a23ab..29c0ae12 100644 --- a/neo/renderer/ModelOverlay.h +++ b/neo/renderer/ModelOverlay.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/neo/renderer/Model_ase.cpp b/neo/renderer/Model_ase.cpp index e30a0ce4..1a0baadd 100644 --- a/neo/renderer/Model_ase.cpp +++ b/neo/renderer/Model_ase.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"). @@ -41,7 +41,7 @@ If you have questions concerning this license or the applicable additional terms ====================================================================== */ - + #define VERBOSE( x ) { if ( ase.verbose ) { common->Printf x ; } } @@ -89,7 +89,7 @@ static int ASE_GetToken( bool restOfLine ) // skip over crap while ( ( ( ase.curpos - ase.buffer ) < ase.len ) && - ( *ase.curpos <= 32 ) ) + ( *ase.curpos <= 32 ) ) { ase.curpos++; } @@ -326,7 +326,7 @@ static void ASE_KeyMESH_FACE_LIST( const char *token ) ASE_GetToken( false ); // skip label ASE_GetToken( false ); // first vertex pMesh->faces[ase.currentFace].vertexNum[0] = atoi( ase.token ); - + ASE_GetToken( false ); // skip label ASE_GetToken( false ); // second vertex pMesh->faces[ase.currentFace].vertexNum[2] = atoi( ase.token ); @@ -720,7 +720,7 @@ static void ASE_KeyGEOMOBJECT( const char *token ) } // ignore unused data blocks else if ( !strcmp( token, "*NODE_TM" ) || - !strcmp( token, "*TM_ANIMATION" ) ) + !strcmp( token, "*TM_ANIMATION" ) ) { ASE_ParseBracedBlock( ASE_KeyNODE_TM ); } @@ -748,7 +748,7 @@ static void ASE_KeyGEOMOBJECT( const char *token ) } // skip unused info else if ( !strcmp( token, "*PROP_MOTIONBLUR" ) || - !strcmp( token, "*PROP_CASTSHADOW" ) || + !strcmp( token, "*PROP_CASTSHADOW" ) || !strcmp( token, "*PROP_RECVSHADOW" ) ) { ASE_SkipRestOfLine(); diff --git a/neo/renderer/Model_ase.h b/neo/renderer/Model_ase.h index d062fa65..8d4b6ddf 100644 --- a/neo/renderer/Model_ase.h +++ b/neo/renderer/Model_ase.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/neo/renderer/Model_beam.cpp b/neo/renderer/Model_beam.cpp index 2cdd12fe..86890613 100644 --- a/neo/renderer/Model_beam.cpp +++ b/neo/renderer/Model_beam.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"). @@ -136,8 +136,8 @@ idRenderModel *idRenderModelBeam::InstantiateDynamicModel( const struct renderEn idVec3 localView, localTarget; float modelMatrix[16]; R_AxisToModelMatrix( renderEntity->axis, renderEntity->origin, modelMatrix ); - R_GlobalPointToLocal( modelMatrix, viewDef->renderView.vieworg, localView ); - R_GlobalPointToLocal( modelMatrix, target, localTarget ); + R_GlobalPointToLocal( modelMatrix, viewDef->renderView.vieworg, localView ); + R_GlobalPointToLocal( modelMatrix, target, localTarget ); idVec3 major = localTarget; idVec3 minor; @@ -202,7 +202,7 @@ idBounds idRenderModelBeam::Bounds( const struct renderEntity_s *renderEntity ) idVec3 localTarget; float modelMatrix[16]; R_AxisToModelMatrix( renderEntity->axis, renderEntity->origin, modelMatrix ); - R_GlobalPointToLocal( modelMatrix, target, localTarget ); + R_GlobalPointToLocal( modelMatrix, target, localTarget ); b.AddPoint( localTarget ); if ( renderEntity->shaderParms[SHADERPARM_BEAM_WIDTH] != 0.0f ) { diff --git a/neo/renderer/Model_liquid.cpp b/neo/renderer/Model_liquid.cpp index d78c990c..7bf134fb 100644 --- a/neo/renderer/Model_liquid.cpp +++ b/neo/renderer/Model_liquid.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"). @@ -50,7 +50,7 @@ idRenderModelLiquid::idRenderModelLiquid() { drop_height = 4; drop_radius = 4; drop_delay = 1000; - shader = declManager->FindMaterial( NULL ); + shader = declManager->FindMaterial( NULL ); update_tics = 33; // ~30 hz time = 0; seed = 0; @@ -299,7 +299,7 @@ void idRenderModelLiquid::Update( void ) { p2[ x - verts_x - 1 ] + p2[ x - verts_x + 1 ] + p2[ x + verts_x - 1 ] + - p2[ x + verts_x + 1 ] + + p2[ x + verts_x + 1 ] + p2[ x ] ) * ( 1.0f / 9.0f ); p1[ x ] = value * density; @@ -495,7 +495,7 @@ idRenderModel *idRenderModelLiquid::InstantiateDynamicModel( const struct render frames = LIQUID_MAX_SKIP_FRAMES; } - + while( frames > 0 ) { Update(); frames--; diff --git a/neo/renderer/Model_local.h b/neo/renderer/Model_local.h index d702b745..f566761f 100644 --- a/neo/renderer/Model_local.h +++ b/neo/renderer/Model_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"). @@ -86,7 +86,7 @@ public: virtual float DepthHack() const; void MakeDefaultModel(); - + bool LoadASE( const char *fileName ); bool LoadLWO( const char *fileName ); bool LoadFLT( const char *fileName ); @@ -142,7 +142,7 @@ public: idMD5Mesh(); ~idMD5Mesh(); - void ParseMesh( idLexer &parser, int numJoints, const idJointMat *joints ); + void ParseMesh( idLexer &parser, int numJoints, const idJointMat *joints ); void UpdateSurface( const struct renderEntity_s *ent, const idJointMat *joints, modelSurface_t *surf ); idBounds CalcBounds( const idJointMat *joints ); int NearestJoint( int a, int b, int c ) const; @@ -245,7 +245,7 @@ private: modelSurface_t GenerateSurface( float lerp ); void WaterDrop( int x, int y, float *page ); void Update( void ); - + int verts_x; int verts_y; float scale_x; @@ -256,11 +256,11 @@ private: int seed; idRandom random; - + const idMaterial * shader; struct deformInfo_s * deformInfo; // used to create srfTriangles_t from base frames // and new vertexes - + float density; float drop_height; int drop_radius; @@ -370,7 +370,7 @@ public: /* ================================================================================ - idRenderModelSprite + idRenderModelSprite ================================================================================ */ diff --git a/neo/renderer/Model_lwo.cpp b/neo/renderer/Model_lwo.cpp index c145772f..dc1b644d 100644 --- a/neo/renderer/Model_lwo.cpp +++ b/neo/renderer/Model_lwo.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,33 +49,33 @@ Free memory used by an lwClip. void lwFreeClip( lwClip *clip ) { if ( clip ) { - lwListFree( clip->ifilter, (void (__cdecl *)(void *))lwFreePlugin ); - lwListFree( clip->pfilter, (void (__cdecl *)(void *))lwFreePlugin ); + lwListFree( clip->ifilter, (void (__cdecl *)(void *))lwFreePlugin ); + lwListFree( clip->pfilter, (void (__cdecl *)(void *))lwFreePlugin ); switch( clip->type ) { case ID_STIL: { - if ( clip->source.still.name ) Mem_Free( clip->source.still.name ); + if ( clip->source.still.name ) Mem_Free( clip->source.still.name ); break; } case ID_ISEQ: { - if ( clip->source.seq.suffix ) Mem_Free( clip->source.seq.suffix ); - if ( clip->source.seq.prefix ) Mem_Free( clip->source.seq.prefix ); + if ( clip->source.seq.suffix ) Mem_Free( clip->source.seq.suffix ); + if ( clip->source.seq.prefix ) Mem_Free( clip->source.seq.prefix ); break; } case ID_ANIM: { if ( clip->source.anim.server ) Mem_Free( clip->source.anim.server ); - if ( clip->source.anim.name ) Mem_Free( clip->source.anim.name ); + if ( clip->source.anim.name ) Mem_Free( clip->source.anim.name ); break; - } + } case ID_XREF: { if ( clip->source.xref.string ) Mem_Free( clip->source.xref.string ); break; } case ID_STCC: { - if ( clip->source.cycle.name ) Mem_Free( clip->source.cycle.name ); + if ( clip->source.cycle.name ) Mem_Free( clip->source.cycle.name ); break; - } + } } - Mem_Free( clip ); + Mem_Free( clip ); } } @@ -125,40 +125,40 @@ lwClip *lwGetClip( idFile *fp, int cksize ) set_flen( 0 ); switch ( clip->type ) { - case ID_STIL: - clip->source.still.name = getS0( fp ); - break; + case ID_STIL: + clip->source.still.name = getS0( fp ); + break; - case ID_ISEQ: - clip->source.seq.digits = getU1( fp ); - clip->source.seq.flags = getU1( fp ); - clip->source.seq.offset = getI2( fp ); - clip->source.seq.start = getI2( fp ); - clip->source.seq.end = getI2( fp ); - clip->source.seq.prefix = getS0( fp ); - clip->source.seq.suffix = getS0( fp ); - break; + case ID_ISEQ: + clip->source.seq.digits = getU1( fp ); + clip->source.seq.flags = getU1( fp ); + clip->source.seq.offset = getI2( fp ); + clip->source.seq.start = getI2( fp ); + clip->source.seq.end = getI2( fp ); + clip->source.seq.prefix = getS0( fp ); + clip->source.seq.suffix = getS0( fp ); + break; - case ID_ANIM: - clip->source.anim.name = getS0( fp ); - clip->source.anim.server = getS0( fp ); - rlen = get_flen(); - clip->source.anim.data = getbytes( fp, sz - rlen ); - break; + case ID_ANIM: + clip->source.anim.name = getS0( fp ); + clip->source.anim.server = getS0( fp ); + rlen = get_flen(); + clip->source.anim.data = getbytes( fp, sz - rlen ); + break; - case ID_XREF: - clip->source.xref.index = getI4( fp ); - clip->source.xref.string = getS0( fp ); - break; + case ID_XREF: + clip->source.xref.index = getI4( fp ); + clip->source.xref.string = getS0( fp ); + break; - case ID_STCC: - clip->source.cycle.lo = getI2( fp ); - clip->source.cycle.hi = getI2( fp ); - clip->source.cycle.name = getS0( fp ); - break; + case ID_STCC: + clip->source.cycle.lo = getI2( fp ); + clip->source.cycle.hi = getI2( fp ); + clip->source.cycle.name = getS0( fp ); + break; - default: - break; + default: + break; } /* error while reading current subchunk? */ @@ -169,14 +169,14 @@ lwClip *lwGetClip( idFile *fp, int cksize ) /* skip unread parts of the current subchunk */ if ( rlen < sz ) - fp->Seek( sz - rlen, FS_SEEK_CUR ); + fp->Seek( sz - rlen, FS_SEEK_CUR ); /* end of the CLIP chunk? */ rlen = fp->Tell() - pos; if ( cksize < rlen ) goto Fail; if ( cksize == rlen ) - return clip; + return clip; /* process subchunks as they're encountered */ @@ -185,91 +185,91 @@ lwClip *lwGetClip( idFile *fp, int cksize ) if ( 0 > get_flen() ) goto Fail; while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); + sz += sz & 1; + set_flen( 0 ); - switch ( id ) { - case ID_TIME: - clip->start_time = getF4( fp ); - clip->duration = getF4( fp ); - clip->frame_rate = getF4( fp ); - break; + switch ( id ) { + case ID_TIME: + clip->start_time = getF4( fp ); + clip->duration = getF4( fp ); + clip->frame_rate = getF4( fp ); + break; - case ID_CONT: - clip->contrast.val = getF4( fp ); - clip->contrast.eindex = getVX( fp ); - break; + case ID_CONT: + clip->contrast.val = getF4( fp ); + clip->contrast.eindex = getVX( fp ); + break; - case ID_BRIT: - clip->brightness.val = getF4( fp ); - clip->brightness.eindex = getVX( fp ); - break; + case ID_BRIT: + clip->brightness.val = getF4( fp ); + clip->brightness.eindex = getVX( fp ); + break; - case ID_SATR: - clip->saturation.val = getF4( fp ); - clip->saturation.eindex = getVX( fp ); - break; + case ID_SATR: + clip->saturation.val = getF4( fp ); + clip->saturation.eindex = getVX( fp ); + break; - case ID_HUE: - clip->hue.val = getF4( fp ); - clip->hue.eindex = getVX( fp ); - break; + case ID_HUE: + clip->hue.val = getF4( fp ); + clip->hue.eindex = getVX( fp ); + break; - case ID_GAMM: - clip->gamma.val = getF4( fp ); - clip->gamma.eindex = getVX( fp ); - break; + case ID_GAMM: + clip->gamma.val = getF4( fp ); + clip->gamma.eindex = getVX( fp ); + break; - case ID_NEGA: - clip->negative = getU2( fp ); - break; + case ID_NEGA: + clip->negative = getU2( fp ); + break; - case ID_IFLT: - case ID_PFLT: - filt = (lwPlugin*)Mem_ClearedAlloc( sizeof( lwPlugin ) ); - if ( !filt ) goto Fail; + case ID_IFLT: + case ID_PFLT: + filt = (lwPlugin*)Mem_ClearedAlloc( sizeof( lwPlugin ) ); + if ( !filt ) goto Fail; - filt->name = getS0( fp ); - filt->flags = getU2( fp ); - rlen = get_flen(); - filt->data = getbytes( fp, sz - rlen ); + filt->name = getS0( fp ); + filt->flags = getU2( fp ); + rlen = get_flen(); + filt->data = getbytes( fp, sz - rlen ); - if ( id == ID_IFLT ) { - lwListAdd( (void**)&clip->ifilter, filt ); - clip->nifilters++; - } - else { - lwListAdd( (void**)&clip->pfilter, filt ); - clip->npfilters++; - } - break; + if ( id == ID_IFLT ) { + lwListAdd( (void**)&clip->ifilter, filt ); + clip->nifilters++; + } + else { + lwListAdd( (void**)&clip->pfilter, filt ); + clip->npfilters++; + } + break; - default: - break; - } + default: + break; + } - /* error while reading current subchunk? */ + /* error while reading current subchunk? */ - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) goto Fail; + rlen = get_flen(); + if ( rlen < 0 || rlen > sz ) goto Fail; - /* skip unread parts of the current subchunk */ + /* skip unread parts of the current subchunk */ - if ( rlen < sz ) - fp->Seek( sz - rlen, FS_SEEK_CUR ); + if ( rlen < sz ) + fp->Seek( sz - rlen, FS_SEEK_CUR ); - /* end of the CLIP chunk? */ + /* end of the CLIP chunk? */ - rlen = fp->Tell() - pos; - if ( cksize < rlen ) goto Fail; - if ( cksize == rlen ) break; + rlen = fp->Tell() - pos; + if ( cksize < rlen ) goto Fail; + if ( cksize == rlen ) break; - /* get the next chunk header */ + /* get the next chunk header */ - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) goto Fail; + set_flen( 0 ); + id = getU4( fp ); + sz = getU2( fp ); + if ( 6 != get_flen() ) goto Fail; } return clip; @@ -293,8 +293,8 @@ lwClip *lwFindClip( lwClip *list, int index ) clip = list; while ( clip ) { - if ( clip->index == index ) break; - clip = clip->next; + if ( clip->index == index ) break; + clip = clip->next; } return clip; } @@ -314,10 +314,10 @@ void lwFree( void *ptr ) { void lwFreeEnvelope( lwEnvelope *env ) { if ( env ) { - if ( env->name ) Mem_Free( env->name ); - lwListFree( env->key, lwFree ); - lwListFree( env->cfilter, (void (__cdecl *)(void *))lwFreePlugin ); - Mem_Free( env ); + if ( env->name ) Mem_Free( env->name ); + lwListFree( env->key, lwFree ); + lwListFree( env->cfilter, (void (__cdecl *)(void *))lwFreePlugin ); + Mem_Free( env ); } } @@ -369,98 +369,98 @@ lwEnvelope *lwGetEnvelope( idFile *fp, int cksize ) /* process subchunks as they're encountered */ while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); + sz += sz & 1; + set_flen( 0 ); - switch ( id ) { - case ID_TYPE: - env->type = getU2( fp ); - break; + switch ( id ) { + case ID_TYPE: + env->type = getU2( fp ); + break; - case ID_NAME: - env->name = getS0( fp ); - break; + case ID_NAME: + env->name = getS0( fp ); + break; - case ID_PRE: - env->behavior[ 0 ] = getU2( fp ); - break; + case ID_PRE: + env->behavior[ 0 ] = getU2( fp ); + break; - case ID_POST: - env->behavior[ 1 ] = getU2( fp ); - break; + case ID_POST: + env->behavior[ 1 ] = getU2( fp ); + break; - case ID_KEY: - key = (lwKey*)Mem_ClearedAlloc( sizeof( lwKey ) ); - if ( !key ) goto Fail; - key->time = getF4( fp ); - key->value = getF4( fp ); - lwListInsert( (void**)&env->key, key, (int (__cdecl *)(void *,void *))compare_keys ); - env->nkeys++; - break; + case ID_KEY: + key = (lwKey*)Mem_ClearedAlloc( sizeof( lwKey ) ); + if ( !key ) goto Fail; + key->time = getF4( fp ); + key->value = getF4( fp ); + lwListInsert( (void**)&env->key, key, (int (__cdecl *)(void *,void *))compare_keys ); + env->nkeys++; + break; - case ID_SPAN: - if ( !key ) goto Fail; - key->shape = getU4( fp ); + case ID_SPAN: + if ( !key ) goto Fail; + key->shape = getU4( fp ); - nparams = ( sz - 4 ) / 4; - if ( nparams > 4 ) nparams = 4; - for ( i = 0; i < nparams; i++ ) - f[ i ] = getF4( fp ); + nparams = ( sz - 4 ) / 4; + if ( nparams > 4 ) nparams = 4; + for ( i = 0; i < nparams; i++ ) + f[ i ] = getF4( fp ); - switch ( key->shape ) { - case ID_TCB: - key->tension = f[ 0 ]; - key->continuity = f[ 1 ]; - key->bias = f[ 2 ]; - break; + switch ( key->shape ) { + case ID_TCB: + key->tension = f[ 0 ]; + key->continuity = f[ 1 ]; + key->bias = f[ 2 ]; + break; - case ID_BEZI: - case ID_HERM: - case ID_BEZ2: - for ( i = 0; i < nparams; i++ ) - key->param[ i ] = f[ i ]; - break; - } - break; + case ID_BEZI: + case ID_HERM: + case ID_BEZ2: + for ( i = 0; i < nparams; i++ ) + key->param[ i ] = f[ i ]; + break; + } + break; - case ID_CHAN: - plug = (lwPlugin*)Mem_ClearedAlloc( sizeof( lwPlugin ) ); - if ( !plug ) goto Fail; + case ID_CHAN: + plug = (lwPlugin*)Mem_ClearedAlloc( sizeof( lwPlugin ) ); + if ( !plug ) goto Fail; - plug->name = getS0( fp ); - plug->flags = getU2( fp ); - plug->data = getbytes( fp, sz - get_flen() ); + plug->name = getS0( fp ); + plug->flags = getU2( fp ); + plug->data = getbytes( fp, sz - get_flen() ); - lwListAdd( (void**)&env->cfilter, plug ); - env->ncfilters++; - break; + lwListAdd( (void**)&env->cfilter, plug ); + env->ncfilters++; + break; - default: - break; - } + default: + break; + } - /* error while reading current subchunk? */ + /* error while reading current subchunk? */ - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) goto Fail; + rlen = get_flen(); + if ( rlen < 0 || rlen > sz ) goto Fail; - /* skip unread parts of the current subchunk */ + /* skip unread parts of the current subchunk */ - if ( rlen < sz ) - fp->Seek( sz - rlen, FS_SEEK_CUR ); + if ( rlen < sz ) + fp->Seek( sz - rlen, FS_SEEK_CUR ); - /* end of the ENVL chunk? */ + /* end of the ENVL chunk? */ - rlen = fp->Tell() - pos; - if ( cksize < rlen ) goto Fail; - if ( cksize == rlen ) break; + rlen = fp->Tell() - pos; + if ( cksize < rlen ) goto Fail; + if ( cksize == rlen ) break; - /* get the next subchunk header */ + /* get the next subchunk header */ - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) goto Fail; + set_flen( 0 ); + id = getU4( fp ); + sz = getU2( fp ); + if ( 6 != get_flen() ) goto Fail; } return env; @@ -484,8 +484,8 @@ lwEnvelope *lwFindEnvelope( lwEnvelope *list, int index ) env = list; while ( env ) { - if ( env->index == index ) break; - env = env->next; + if ( env->index == index ) break; + env = env->next; } return env; } @@ -509,8 +509,8 @@ static float range( float v, float lo, float hi, int *i ) float v2, r = hi - lo; if ( r == 0.0 ) { - if ( i ) *i = 0; - return lo; + if ( i ) *i = 0; + return lo; } v2 = lo + v - r * ( float ) floor(( double ) v / r ); @@ -581,14 +581,14 @@ static float bez2_time( float x0, float x1, float x2, float x3, float time, t = *t0 + ( *t1 - *t0 ) * 0.5f; v = bezier( x0, x1, x2, x3, t ); if ( idMath::Fabs( time - v ) > .0001f ) { - if ( v > time ) - *t1 = t; - else - *t0 = t; - return bez2_time( x0, x1, x2, x3, time, t0, t1 ); + if ( v > time ) + *t1 = t; + else + *t0 = t; + return bez2_time( x0, x1, x2, x3, time, t0, t1 ); } else - return t; + return t; } @@ -604,17 +604,17 @@ static float bez2( lwKey *key0, lwKey *key1, float time ) float x, y, t, t0 = 0.0f, t1 = 1.0f; if ( key0->shape == ID_BEZ2 ) - x = key0->time + key0->param[ 2 ]; + x = key0->time + key0->param[ 2 ]; else - x = key0->time + ( key1->time - key0->time ) / 3.0f; + x = key0->time + ( key1->time - key0->time ) / 3.0f; t = bez2_time( key0->time, x, key1->time + key1->param[ 0 ], key1->time, - time, &t0, &t1 ); + time, &t0, &t1 ); if ( key0->shape == ID_BEZ2 ) - y = key0->value + key0->param[ 3 ]; + y = key0->value + key0->param[ 3 ]; else - y = key0->value + key0->param[ 1 ] / 3.0f; + y = key0->value + key0->param[ 1 ] / 3.0f; return bezier( key0->value, y, key1->param[ 1 ] + key1->value, key1->value, t ); } @@ -635,52 +635,52 @@ static float outgoing( lwKey *key0, lwKey *key1 ) switch ( key0->shape ) { - case ID_TCB: - a = ( 1.0f - key0->tension ) - * ( 1.0f + key0->continuity ) - * ( 1.0f + key0->bias ); - b = ( 1.0f - key0->tension ) - * ( 1.0f - key0->continuity ) - * ( 1.0f - key0->bias ); - d = key1->value - key0->value; + case ID_TCB: + a = ( 1.0f - key0->tension ) + * ( 1.0f + key0->continuity ) + * ( 1.0f + key0->bias ); + b = ( 1.0f - key0->tension ) + * ( 1.0f - key0->continuity ) + * ( 1.0f - key0->bias ); + d = key1->value - key0->value; - if ( key0->prev ) { - t = ( key1->time - key0->time ) / ( key1->time - key0->prev->time ); - out = t * ( a * ( key0->value - key0->prev->value ) + b * d ); - } - else - out = b * d; - break; + if ( key0->prev ) { + t = ( key1->time - key0->time ) / ( key1->time - key0->prev->time ); + out = t * ( a * ( key0->value - key0->prev->value ) + b * d ); + } + else + out = b * d; + break; - case ID_LINE: - d = key1->value - key0->value; - if ( key0->prev ) { - t = ( key1->time - key0->time ) / ( key1->time - key0->prev->time ); - out = t * ( key0->value - key0->prev->value + d ); - } - else - out = d; - break; + case ID_LINE: + d = key1->value - key0->value; + if ( key0->prev ) { + t = ( key1->time - key0->time ) / ( key1->time - key0->prev->time ); + out = t * ( key0->value - key0->prev->value + d ); + } + else + out = d; + break; - case ID_BEZI: - case ID_HERM: - out = key0->param[ 1 ]; - if ( key0->prev ) - out *= ( key1->time - key0->time ) / ( key1->time - key0->prev->time ); - break; + case ID_BEZI: + case ID_HERM: + out = key0->param[ 1 ]; + if ( key0->prev ) + out *= ( key1->time - key0->time ) / ( key1->time - key0->prev->time ); + break; - case ID_BEZ2: - out = key0->param[ 3 ] * ( key1->time - key0->time ); - if ( idMath::Fabs( key0->param[ 2 ] ) > 1e-5f ) - out /= key0->param[ 2 ]; - else - out *= 1e5f; - break; + case ID_BEZ2: + out = key0->param[ 3 ] * ( key1->time - key0->time ); + if ( idMath::Fabs( key0->param[ 2 ] ) > 1e-5f ) + out /= key0->param[ 2 ]; + else + out *= 1e5f; + break; - case ID_STEP: - default: - out = 0.0f; - break; + case ID_STEP: + default: + out = 0.0f; + break; } return out; @@ -701,53 +701,53 @@ static float incoming( lwKey *key0, lwKey *key1 ) switch ( key1->shape ) { - case ID_LINE: - d = key1->value - key0->value; - if ( key1->next ) { - t = ( key1->time - key0->time ) / ( key1->next->time - key0->time ); - in = t * ( key1->next->value - key1->value + d ); - } - else - in = d; - break; + case ID_LINE: + d = key1->value - key0->value; + if ( key1->next ) { + t = ( key1->time - key0->time ) / ( key1->next->time - key0->time ); + in = t * ( key1->next->value - key1->value + d ); + } + else + in = d; + break; - case ID_TCB: - a = ( 1.0f - key1->tension ) - * ( 1.0f - key1->continuity ) - * ( 1.0f + key1->bias ); - b = ( 1.0f - key1->tension ) - * ( 1.0f + key1->continuity ) - * ( 1.0f - key1->bias ); - d = key1->value - key0->value; + case ID_TCB: + a = ( 1.0f - key1->tension ) + * ( 1.0f - key1->continuity ) + * ( 1.0f + key1->bias ); + b = ( 1.0f - key1->tension ) + * ( 1.0f + key1->continuity ) + * ( 1.0f - key1->bias ); + d = key1->value - key0->value; - if ( key1->next ) { - t = ( key1->time - key0->time ) / ( key1->next->time - key0->time ); - in = t * ( b * ( key1->next->value - key1->value ) + a * d ); - } - else - in = a * d; - break; + if ( key1->next ) { + t = ( key1->time - key0->time ) / ( key1->next->time - key0->time ); + in = t * ( b * ( key1->next->value - key1->value ) + a * d ); + } + else + in = a * d; + break; - case ID_BEZI: - case ID_HERM: - in = key1->param[ 0 ]; - if ( key1->next ) - in *= ( key1->time - key0->time ) / ( key1->next->time - key0->time ); - break; - return in; + case ID_BEZI: + case ID_HERM: + in = key1->param[ 0 ]; + if ( key1->next ) + in *= ( key1->time - key0->time ) / ( key1->next->time - key0->time ); + break; + return in; - case ID_BEZ2: - in = key1->param[ 1 ] * ( key1->time - key0->time ); - if ( idMath::Fabs( key1->param[ 0 ] ) > 1e-5f ) - in /= key1->param[ 0 ]; - else - in *= 1e5f; - break; + case ID_BEZ2: + in = key1->param[ 1 ] * ( key1->time - key0->time ); + if ( idMath::Fabs( key1->param[ 0 ] ) > 1e-5f ) + in /= key1->param[ 0 ]; + else + in *= 1e5f; + break; - case ID_STEP: - default: - in = 0.0f; - break; + case ID_STEP: + default: + in = 0.0f; + break; } return in; @@ -776,7 +776,7 @@ float evalEnvelope( lwEnvelope *env, float time ) /* if there's only one key, the value is constant */ if ( env->nkeys == 1 ) - return env->key->value; + return env->key->value; /* find the first and last keys */ @@ -786,82 +786,82 @@ float evalEnvelope( lwEnvelope *env, float time ) /* use pre-behavior if time is before first key time */ if ( time < skey->time ) { - switch ( env->behavior[ 0 ] ) - { - case BEH_RESET: - return 0.0f; + switch ( env->behavior[ 0 ] ) + { + case BEH_RESET: + return 0.0f; - case BEH_CONSTANT: - return skey->value; + case BEH_CONSTANT: + return skey->value; - case BEH_REPEAT: - time = range( time, skey->time, ekey->time, NULL ); - break; + case BEH_REPEAT: + time = range( time, skey->time, ekey->time, NULL ); + break; - case BEH_OSCILLATE: - time = range( time, skey->time, ekey->time, &noff ); - if ( noff % 2 ) - time = ekey->time - skey->time - time; - break; + case BEH_OSCILLATE: + time = range( time, skey->time, ekey->time, &noff ); + if ( noff % 2 ) + time = ekey->time - skey->time - time; + break; - case BEH_OFFSET: - time = range( time, skey->time, ekey->time, &noff ); - offset = noff * ( ekey->value - skey->value ); - break; + case BEH_OFFSET: + time = range( time, skey->time, ekey->time, &noff ); + offset = noff * ( ekey->value - skey->value ); + break; - case BEH_LINEAR: - out = outgoing( skey, skey->next ) - / ( skey->next->time - skey->time ); - return out * ( time - skey->time ) + skey->value; - } + case BEH_LINEAR: + out = outgoing( skey, skey->next ) + / ( skey->next->time - skey->time ); + return out * ( time - skey->time ) + skey->value; + } } /* use post-behavior if time is after last key time */ else if ( time > ekey->time ) { - switch ( env->behavior[ 1 ] ) - { - case BEH_RESET: - return 0.0f; + switch ( env->behavior[ 1 ] ) + { + case BEH_RESET: + return 0.0f; - case BEH_CONSTANT: - return ekey->value; + case BEH_CONSTANT: + return ekey->value; - case BEH_REPEAT: - time = range( time, skey->time, ekey->time, NULL ); - break; + case BEH_REPEAT: + time = range( time, skey->time, ekey->time, NULL ); + break; - case BEH_OSCILLATE: - time = range( time, skey->time, ekey->time, &noff ); - if ( noff % 2 ) - time = ekey->time - skey->time - time; - break; + case BEH_OSCILLATE: + time = range( time, skey->time, ekey->time, &noff ); + if ( noff % 2 ) + time = ekey->time - skey->time - time; + break; - case BEH_OFFSET: - time = range( time, skey->time, ekey->time, &noff ); - offset = noff * ( ekey->value - skey->value ); - break; + case BEH_OFFSET: + time = range( time, skey->time, ekey->time, &noff ); + offset = noff * ( ekey->value - skey->value ); + break; - case BEH_LINEAR: - in = incoming( ekey->prev, ekey ) - / ( ekey->time - ekey->prev->time ); - return in * ( time - ekey->time ) + ekey->value; - } + case BEH_LINEAR: + in = incoming( ekey->prev, ekey ) + / ( ekey->time - ekey->prev->time ); + return in * ( time - ekey->time ) + ekey->value; + } } /* get the endpoints of the interval being evaluated */ key0 = env->key; while ( time > key0->next->time ) - key0 = key0->next; + key0 = key0->next; key1 = key0->next; /* check for singularities first */ if ( time == key0->time ) - return key0->value + offset; + return key0->value + offset; else if ( time == key1->time ) - return key1->value + offset; + return key1->value + offset; /* get interval length, time in [0, 1] */ @@ -871,25 +871,25 @@ float evalEnvelope( lwEnvelope *env, float time ) switch ( key1->shape ) { - case ID_TCB: - case ID_BEZI: - case ID_HERM: - out = outgoing( key0, key1 ); - in = incoming( key0, key1 ); - hermite( t, &h1, &h2, &h3, &h4 ); - return h1 * key0->value + h2 * key1->value + h3 * out + h4 * in + offset; + case ID_TCB: + case ID_BEZI: + case ID_HERM: + out = outgoing( key0, key1 ); + in = incoming( key0, key1 ); + hermite( t, &h1, &h2, &h3, &h4 ); + return h1 * key0->value + h2 * key1->value + h3 * out + h4 * in + offset; - case ID_BEZ2: - return bez2( key0, key1, time ) + offset; + case ID_BEZ2: + return bez2( key0, key1, time ) + offset; - case ID_LINE: - return key0->value + t * ( key1->value - key0->value ) + offset; + case ID_LINE: + return key0->value + t * ( key1->value - key0->value ) + offset; - case ID_STEP: - return key0->value + offset; + case ID_STEP: + return key0->value + offset; - default: - return offset; + default: + return offset; } } @@ -908,9 +908,9 @@ void lwListFree( void *list, void ( *freeNode )( void * )) node = ( lwNode * ) list; while ( node ) { - next = node->next; - freeNode( node ); - node = next; + next = node->next; + freeNode( node ); + node = next; } } @@ -928,12 +928,12 @@ void lwListAdd( void **list, void *node ) head = *(( lwNode ** ) list ); if ( !head ) { - *list = node; - return; + *list = node; + return; } while ( head ) { - tail = head; - head = head->next; + tail = head; + head = head->next; } tail->next = ( lwNode * ) node; (( lwNode * ) node )->prev = tail; @@ -952,8 +952,8 @@ void lwListInsert( void **vlist, void *vitem, int ( *compare )( void *, void * ) lwNode **list, *item, *node, *prev; if ( !*vlist ) { - *vlist = vitem; - return; + *vlist = vitem; + return; } list = ( lwNode ** ) vlist; @@ -962,25 +962,25 @@ void lwListInsert( void **vlist, void *vitem, int ( *compare )( void *, void * ) prev = NULL; while ( node ) { - if ( 0 < compare( node, item )) break; - prev = node; - node = node->next; + if ( 0 < compare( node, item )) break; + prev = node; + node = node->next; } if ( !prev ) { - *list = item; - node->prev = item; - item->next = node; + *list = item; + node->prev = item; + item->next = node; } else if ( !node ) { - prev->next = item; - item->prev = prev; + prev->next = item; + item->prev = prev; } else { - item->next = node; - item->prev = prev; - prev->next = item; - node->prev = item; + item->next = node; + item->prev = prev; + prev->next = item; + node->prev = item; } } @@ -1009,18 +1009,18 @@ void *getbytes( idFile *fp, int size ) if ( flen == FLEN_ERROR ) return NULL; if ( size < 0 ) { - flen = FLEN_ERROR; - return NULL; + flen = FLEN_ERROR; + return NULL; } data = Mem_ClearedAlloc( size ); if ( !data ) { - flen = FLEN_ERROR; - return NULL; + flen = FLEN_ERROR; + return NULL; } if ( size != fp->Read( data, size ) ) { - flen = FLEN_ERROR; - Mem_Free( data ); - return NULL; + flen = FLEN_ERROR; + Mem_Free( data ); + return NULL; } flen += size; @@ -1032,9 +1032,9 @@ void skipbytes( idFile *fp, int n ) { if ( flen == FLEN_ERROR ) return; if ( fp->Seek( n, FS_SEEK_CUR )) - flen = FLEN_ERROR; + flen = FLEN_ERROR; else - flen += n; + flen += n; } @@ -1046,8 +1046,8 @@ int getI1( idFile *fp ) c = 0; i = fp->Read(&c, 1); if ( i < 0 ) { - flen = FLEN_ERROR; - return 0; + flen = FLEN_ERROR; + return 0; } if ( c > 127 ) c -= 256; flen += 1; @@ -1061,8 +1061,8 @@ short getI2( idFile *fp ) if ( flen == FLEN_ERROR ) return 0; if ( 2 != fp->Read( &i, 2 )) { - flen = FLEN_ERROR; - return 0; + flen = FLEN_ERROR; + return 0; } BigRevBytes( &i, 2, 1 ); flen += 2; @@ -1076,8 +1076,8 @@ int getI4( idFile *fp ) if ( flen == FLEN_ERROR ) return 0; if ( 4 != fp->Read( &i, 4 )) { - flen = FLEN_ERROR; - return 0; + flen = FLEN_ERROR; + return 0; } BigRevBytes( &i, 4, 1 ); flen += 4; @@ -1093,8 +1093,8 @@ unsigned char getU1( idFile *fp ) c = 0; i = fp->Read(&c, 1); if ( i < 0 ) { - flen = FLEN_ERROR; - return 0; + flen = FLEN_ERROR; + return 0; } flen += 1; return c; @@ -1107,8 +1107,8 @@ unsigned short getU2( idFile *fp ) if ( flen == FLEN_ERROR ) return 0; if ( 2 != fp->Read( &i, 2 )) { - flen = FLEN_ERROR; - return 0; + flen = FLEN_ERROR; + return 0; } BigRevBytes( &i, 2, 1 ); flen += 2; @@ -1122,8 +1122,8 @@ unsigned int getU4( idFile *fp ) if ( flen == FLEN_ERROR ) return 0; if ( 4 != fp->Read( &i, 4 )) { - flen = FLEN_ERROR; - return 0; + flen = FLEN_ERROR; + return 0; } BigRevBytes( &i, 4, 1 ); flen += 4; @@ -1133,7 +1133,7 @@ unsigned int getU4( idFile *fp ) int getVX( idFile *fp ) { - byte c; + byte c; int i; if ( flen == FLEN_ERROR ) return 0; @@ -1144,31 +1144,31 @@ int getVX( idFile *fp ) } if ( c != 0xFF ) { - i = c << 8; + i = c << 8; c = 0; if (fp->Read(&c, 1) == -1) { return 0; } - i |= c; - flen += 2; + i |= c; + flen += 2; } else { c = 0; if (fp->Read(&c, 1) == -1) { return 0; } - i = c << 16; + i = c << 16; c = 0; if (fp->Read(&c, 1) == -1) { return 0; } - i |= c << 8; + i |= c << 8; c = 0; if (fp->Read(&c, 1) == -1) { return 0; } - i |= c; - flen += 4; + i |= c; + flen += 4; } return i; @@ -1181,8 +1181,8 @@ float getF4( idFile *fp ) if ( flen == FLEN_ERROR ) return 0.0f; if ( 4 != fp->Read( &f, 4 ) ) { - flen = FLEN_ERROR; - return 0.0f; + flen = FLEN_ERROR; + return 0.0f; } BigRevBytes( &f, 4, 1 ); flen += 4; @@ -1212,27 +1212,27 @@ char *getS0( idFile *fp ) } if ( i == 1 ) { - if ( fp->Seek( pos + 2, FS_SEEK_SET )) - flen = FLEN_ERROR; - else - flen += 2; - return NULL; + if ( fp->Seek( pos + 2, FS_SEEK_SET )) + flen = FLEN_ERROR; + else + flen += 2; + return NULL; } len = i + ( i & 1 ); s = (char*)Mem_ClearedAlloc( len ); if ( !s ) { - flen = FLEN_ERROR; - return NULL; + flen = FLEN_ERROR; + return NULL; } if ( fp->Seek( pos, FS_SEEK_SET )) { - flen = FLEN_ERROR; - return NULL; + flen = FLEN_ERROR; + return NULL; } if ( len != fp->Read( s, len )) { - flen = FLEN_ERROR; - return NULL; + flen = FLEN_ERROR; + return NULL; } flen += len; @@ -1325,14 +1325,14 @@ int sgetVX( unsigned char **bp ) if ( flen == FLEN_ERROR ) return 0; if ( buf[ 0 ] != 0xFF ) { - i = buf[ 0 ] << 8 | buf[ 1 ]; - flen += 2; - *bp += 2; + i = buf[ 0 ] << 8 | buf[ 1 ]; + flen += 2; + *bp += 2; } else { - i = ( buf[ 1 ] << 16 ) | ( buf[ 2 ] << 8 ) | buf[ 3 ]; - flen += 4; - *bp += 4; + i = ( buf[ 1 ] << 16 ) | ( buf[ 2 ] << 8 ) | buf[ 3 ]; + flen += 4; + *bp += 4; } return i; } @@ -1365,15 +1365,15 @@ char *sgetS0( unsigned char **bp ) len = strlen( (const char*)buf ) + 1; if ( len == 1 ) { - flen += 2; - *bp += 2; - return NULL; + flen += 2; + *bp += 2; + return NULL; } len += len & 1; s = (char*)Mem_ClearedAlloc( len ); if ( !s ) { - flen = FLEN_ERROR; - return NULL; + flen = FLEN_ERROR; + return NULL; } memcpy( s, buf, len ); @@ -1392,11 +1392,11 @@ Free memory used by an lwLayer. void lwFreeLayer( lwLayer *layer ) { if ( layer ) { - if ( layer->name ) Mem_Free( layer->name ); - lwFreePoints( &layer->point ); - lwFreePolygons( &layer->polygon ); - lwListFree( layer->vmap, (void (__cdecl *)(void *))lwFreeVMap ); - Mem_Free( layer ); + if ( layer->name ) Mem_Free( layer->name ); + lwFreePoints( &layer->point ); + lwFreePolygons( &layer->polygon ); + lwListFree( layer->vmap, (void (__cdecl *)(void *))lwFreeVMap ); + Mem_Free( layer ); } } @@ -1411,12 +1411,12 @@ Free memory used by an lwObject. void lwFreeObject( lwObject *object ) { if ( object ) { - lwListFree( object->layer, (void (__cdecl *)(void *))lwFreeLayer ); - lwListFree( object->env, (void (__cdecl *)(void *))lwFreeEnvelope ); - lwListFree( object->clip, (void (__cdecl *)(void *))lwFreeClip ); - lwListFree( object->surf, (void (__cdecl *)(void *))lwFreeSurface ); - lwFreeTags( &object->taglist ); - Mem_Free( object ); + lwListFree( object->layer, (void (__cdecl *)(void *))lwFreeLayer ); + lwListFree( object->env, (void (__cdecl *)(void *))lwFreeEnvelope ); + lwListFree( object->clip, (void (__cdecl *)(void *))lwFreeClip ); + lwListFree( object->surf, (void (__cdecl *)(void *))lwFreeSurface ); + lwFreeTags( &object->taglist ); + Mem_Free( object ); } } @@ -1430,14 +1430,14 @@ NULL if the file couldn't be loaded. On failure, failID and failpos can be used to diagnose the cause. 1. If the file isn't an LWO2 or an LWOB, failpos will contain 12 and - failID will be unchanged. + failID will be unchanged. 2. If an error occurs while reading, failID will contain the most - recently read IFF chunk ID, and failpos will contain the value - returned by fp->Tell() at the time of the failure. + recently read IFF chunk ID, and failpos will contain the value + returned by fp->Tell() at the time of the failure. 3. If the file couldn't be opened, or an error occurs while reading - the first 12 bytes, both failID and failpos will be unchanged. + the first 12 bytes, both failID and failpos will be unchanged. If you don't need this information, failID and failpos can be NULL. ====================================================================== */ @@ -1463,26 +1463,26 @@ lwObject *lwGetObject( const char *filename, unsigned int *failID, int *failpos formsize = getU4( fp ); type = getU4( fp ); if ( 12 != get_flen() ) { - fileSystem->CloseFile( fp ); - return NULL; + fileSystem->CloseFile( fp ); + return NULL; } /* is this a LW object? */ if ( id != ID_FORM ) { - fileSystem->CloseFile( fp ); - if ( failpos ) *failpos = 12; - return NULL; + fileSystem->CloseFile( fp ); + if ( failpos ) *failpos = 12; + return NULL; } if ( type != ID_LWO2 ) { fileSystem->CloseFile( fp ); - if ( type == ID_LWOB ) - return lwGetObject5( filename, failID, failpos ); - else { - if ( failpos ) *failpos = 12; - return NULL; - } + if ( type == ID_LWOB ) + return lwGetObject5( filename, failID, failpos ); + else { + if ( failpos ) *failpos = 12; + return NULL; + } } /* allocate an object and a default layer */ @@ -1505,134 +1505,134 @@ lwObject *lwGetObject( const char *filename, unsigned int *failID, int *failpos /* process chunks as they're encountered */ while ( 1 ) { - cksize += cksize & 1; + cksize += cksize & 1; - switch ( id ) - { - case ID_LAYR: - if ( object->nlayers > 0 ) { - layer = (lwLayer*)Mem_ClearedAlloc( sizeof( lwLayer ) ); - if ( !layer ) goto Fail; - lwListAdd( (void**)&object->layer, layer ); - } - object->nlayers++; + switch ( id ) + { + case ID_LAYR: + if ( object->nlayers > 0 ) { + layer = (lwLayer*)Mem_ClearedAlloc( sizeof( lwLayer ) ); + if ( !layer ) goto Fail; + lwListAdd( (void**)&object->layer, layer ); + } + object->nlayers++; - set_flen( 0 ); - layer->index = getU2( fp ); - layer->flags = getU2( fp ); - layer->pivot[ 0 ] = getF4( fp ); - layer->pivot[ 1 ] = getF4( fp ); - layer->pivot[ 2 ] = getF4( fp ); - layer->name = getS0( fp ); + set_flen( 0 ); + layer->index = getU2( fp ); + layer->flags = getU2( fp ); + layer->pivot[ 0 ] = getF4( fp ); + layer->pivot[ 1 ] = getF4( fp ); + layer->pivot[ 2 ] = getF4( fp ); + layer->name = getS0( fp ); - rlen = get_flen(); - if ( rlen < 0 || rlen > cksize ) goto Fail; - if ( rlen <= cksize - 2 ) - layer->parent = getU2( fp ); - rlen = get_flen(); - if ( rlen < cksize ) - fp->Seek( cksize - rlen, FS_SEEK_CUR ); - break; + rlen = get_flen(); + if ( rlen < 0 || rlen > cksize ) goto Fail; + if ( rlen <= cksize - 2 ) + layer->parent = getU2( fp ); + rlen = get_flen(); + if ( rlen < cksize ) + fp->Seek( cksize - rlen, FS_SEEK_CUR ); + break; - case ID_PNTS: - if ( !lwGetPoints( fp, cksize, &layer->point )) - goto Fail; - break; + case ID_PNTS: + if ( !lwGetPoints( fp, cksize, &layer->point )) + goto Fail; + break; - case ID_POLS: - if ( !lwGetPolygons( fp, cksize, &layer->polygon, - layer->point.offset )) - goto Fail; - break; + case ID_POLS: + if ( !lwGetPolygons( fp, cksize, &layer->polygon, + layer->point.offset )) + goto Fail; + break; - case ID_VMAP: - case ID_VMAD: - node = ( lwNode * ) lwGetVMap( fp, cksize, layer->point.offset, - layer->polygon.offset, id == ID_VMAD ); - if ( !node ) goto Fail; - lwListAdd( (void**)&layer->vmap, node ); - layer->nvmaps++; - break; + case ID_VMAP: + case ID_VMAD: + node = ( lwNode * ) lwGetVMap( fp, cksize, layer->point.offset, + layer->polygon.offset, id == ID_VMAD ); + if ( !node ) goto Fail; + lwListAdd( (void**)&layer->vmap, node ); + layer->nvmaps++; + break; - case ID_PTAG: - if ( !lwGetPolygonTags( fp, cksize, &object->taglist, - &layer->polygon )) - goto Fail; - break; + case ID_PTAG: + if ( !lwGetPolygonTags( fp, cksize, &object->taglist, + &layer->polygon )) + goto Fail; + break; - case ID_BBOX: - set_flen( 0 ); - for ( i = 0; i < 6; i++ ) - layer->bbox[ i ] = getF4( fp ); - rlen = get_flen(); - if ( rlen < 0 || rlen > cksize ) goto Fail; - if ( rlen < cksize ) - fp->Seek( cksize - rlen, FS_SEEK_CUR ); - break; + case ID_BBOX: + set_flen( 0 ); + for ( i = 0; i < 6; i++ ) + layer->bbox[ i ] = getF4( fp ); + rlen = get_flen(); + if ( rlen < 0 || rlen > cksize ) goto Fail; + if ( rlen < cksize ) + fp->Seek( cksize - rlen, FS_SEEK_CUR ); + break; - case ID_TAGS: - if ( !lwGetTags( fp, cksize, &object->taglist )) - goto Fail; - break; + case ID_TAGS: + if ( !lwGetTags( fp, cksize, &object->taglist )) + goto Fail; + break; - case ID_ENVL: - node = ( lwNode * ) lwGetEnvelope( fp, cksize ); - if ( !node ) goto Fail; - lwListAdd( (void**)&object->env, node ); - object->nenvs++; - break; + case ID_ENVL: + node = ( lwNode * ) lwGetEnvelope( fp, cksize ); + if ( !node ) goto Fail; + lwListAdd( (void**)&object->env, node ); + object->nenvs++; + break; - case ID_CLIP: - node = ( lwNode * ) lwGetClip( fp, cksize ); - if ( !node ) goto Fail; - lwListAdd( (void**)&object->clip, node ); - object->nclips++; - break; + case ID_CLIP: + node = ( lwNode * ) lwGetClip( fp, cksize ); + if ( !node ) goto Fail; + lwListAdd( (void**)&object->clip, node ); + object->nclips++; + break; - case ID_SURF: - node = ( lwNode * ) lwGetSurface( fp, cksize ); - if ( !node ) goto Fail; - lwListAdd( (void**)&object->surf, node ); - object->nsurfs++; - break; + case ID_SURF: + node = ( lwNode * ) lwGetSurface( fp, cksize ); + if ( !node ) goto Fail; + lwListAdd( (void**)&object->surf, node ); + object->nsurfs++; + break; - case ID_DESC: - case ID_TEXT: - case ID_ICON: - default: - fp->Seek( cksize, FS_SEEK_CUR ); - break; - } + case ID_DESC: + case ID_TEXT: + case ID_ICON: + default: + fp->Seek( cksize, FS_SEEK_CUR ); + break; + } - /* end of the file? */ + /* end of the file? */ - if ( formsize <= fp->Tell() - 8 ) break; + if ( formsize <= fp->Tell() - 8 ) break; - /* get the next chunk header */ + /* get the next chunk header */ - set_flen( 0 ); - id = getU4( fp ); - cksize = getU4( fp ); - if ( 8 != get_flen() ) goto Fail; + set_flen( 0 ); + id = getU4( fp ); + cksize = getU4( fp ); + if ( 8 != get_flen() ) goto Fail; } fileSystem->CloseFile( fp ); fp = NULL; if ( object->nlayers == 0 ) - object->nlayers = 1; + object->nlayers = 1; layer = object->layer; while ( layer ) { - lwGetBoundingBox( &layer->point, layer->bbox ); - lwGetPolyNormals( &layer->point, &layer->polygon ); - if ( !lwGetPointPolygons( &layer->point, &layer->polygon )) goto Fail; - if ( !lwResolvePolySurfaces( &layer->polygon, &object->taglist, - &object->surf, &object->nsurfs )) goto Fail; - lwGetVertNormals( &layer->point, &layer->polygon ); - if ( !lwGetPointVMaps( &layer->point, layer->vmap )) goto Fail; - if ( !lwGetPolyVMaps( &layer->polygon, layer->vmap )) goto Fail; - layer = layer->next; + lwGetBoundingBox( &layer->point, layer->bbox ); + lwGetPolyNormals( &layer->point, &layer->polygon ); + if ( !lwGetPointPolygons( &layer->point, &layer->polygon )) goto Fail; + if ( !lwResolvePolySurfaces( &layer->polygon, &object->taglist, + &object->surf, &object->nsurfs )) goto Fail; + lwGetVertNormals( &layer->point, &layer->polygon ); + if ( !lwGetPointVMaps( &layer->point, layer->vmap )) goto Fail; + if ( !lwGetPolyVMaps( &layer->polygon, layer->vmap )) goto Fail; + layer = layer->next; } return object; @@ -1640,8 +1640,8 @@ lwObject *lwGetObject( const char *filename, unsigned int *failID, int *failpos Fail: if ( failID ) *failID = id; if ( fp ) { - if ( failpos ) *failpos = fp->Tell(); - fileSystem->CloseFile( fp ); + if ( failpos ) *failpos = fp->Tell(); + fileSystem->CloseFile( fp ); } lwFreeObject( object ); return NULL; @@ -1704,14 +1704,14 @@ static int add_clip( char *s, lwClip **clist, int *nclips ) clip->gamma.val = 1.0f; if ( p = strstr( s, "(sequence)" )) { - p[ -1 ] = 0; - clip->type = ID_ISEQ; - clip->source.seq.prefix = s; - clip->source.seq.digits = 3; + p[ -1 ] = 0; + clip->type = ID_ISEQ; + clip->source.seq.prefix = s; + clip->source.seq.digits = 3; } else { - clip->type = ID_STIL; - clip->source.still.name = s; + clip->type = ID_STIL; + clip->source.still.name = s; } *nclips++; @@ -1738,32 +1738,32 @@ static int add_tvel( float pos[], float vel[], lwEnvelope **elist, int *nenvs ) int i; for ( i = 0; i < 3; i++ ) { - env = (lwEnvelope*)Mem_ClearedAlloc( sizeof( lwEnvelope ) ); - key0 = (lwKey*)Mem_ClearedAlloc( sizeof( lwKey ) ); - key1 = (lwKey*)Mem_ClearedAlloc( sizeof( lwKey ) ); - if ( !env || !key0 || !key1 ) return 0; + env = (lwEnvelope*)Mem_ClearedAlloc( sizeof( lwEnvelope ) ); + key0 = (lwKey*)Mem_ClearedAlloc( sizeof( lwKey ) ); + key1 = (lwKey*)Mem_ClearedAlloc( sizeof( lwKey ) ); + if ( !env || !key0 || !key1 ) return 0; - key0->next = key1; - key0->value = pos[ i ]; - key0->time = 0.0f; - key1->prev = key0; - key1->value = pos[ i ] + vel[ i ] * 30.0f; - key1->time = 1.0f; - key0->shape = key1->shape = ID_LINE; + key0->next = key1; + key0->value = pos[ i ]; + key0->time = 0.0f; + key1->prev = key0; + key1->value = pos[ i ] + vel[ i ] * 30.0f; + key1->time = 1.0f; + key0->shape = key1->shape = ID_LINE; - env->index = *nenvs + i + 1; - env->type = 0x0301 + i; - env->name = (char*)Mem_ClearedAlloc( 11 ); - if ( env->name ) { - strcpy( env->name, "Position.X" ); - env->name[ 9 ] += i; - } - env->key = key0; - env->nkeys = 2; - env->behavior[ 0 ] = BEH_LINEAR; - env->behavior[ 1 ] = BEH_LINEAR; + env->index = *nenvs + i + 1; + env->type = 0x0301 + i; + env->name = (char*)Mem_ClearedAlloc( 11 ); + if ( env->name ) { + strcpy( env->name, "Position.X" ); + env->name[ 9 ] += i; + } + env->key = key0; + env->nkeys = 2; + env->behavior[ 0 ] = BEH_LINEAR; + env->behavior[ 1 ] = BEH_LINEAR; - lwListAdd( (void**)elist, env ); + lwListAdd( (void**)elist, env ); } *nenvs += 3; @@ -1792,19 +1792,19 @@ static lwTexture *get_texture( char *s ) tex->enabled = 1; if ( strstr( s, "Image Map" )) { - tex->type = ID_IMAP; - if ( strstr( s, "Planar" )) tex->param.imap.projection = 0; - else if ( strstr( s, "Cylindrical" )) tex->param.imap.projection = 1; - else if ( strstr( s, "Spherical" )) tex->param.imap.projection = 2; - else if ( strstr( s, "Cubic" )) tex->param.imap.projection = 3; - else if ( strstr( s, "Front" )) tex->param.imap.projection = 4; - tex->param.imap.aa_strength = 1.0f; - tex->param.imap.amplitude.val = 1.0f; - Mem_Free( s ); + tex->type = ID_IMAP; + if ( strstr( s, "Planar" )) tex->param.imap.projection = 0; + else if ( strstr( s, "Cylindrical" )) tex->param.imap.projection = 1; + else if ( strstr( s, "Spherical" )) tex->param.imap.projection = 2; + else if ( strstr( s, "Cubic" )) tex->param.imap.projection = 3; + else if ( strstr( s, "Front" )) tex->param.imap.projection = 4; + tex->param.imap.aa_strength = 1.0f; + tex->param.imap.amplitude.val = 1.0f; + Mem_Free( s ); } else { - tex->type = ID_PROC; - tex->param.proc.name = s; + tex->type = ID_PROC; + tex->param.proc.name = s; } return tex; @@ -1864,249 +1864,249 @@ lwSurface *lwGetSurface5( idFile *fp, int cksize, lwObject *obj ) /* process subchunks as they're encountered */ while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); + sz += sz & 1; + set_flen( 0 ); - switch ( id ) { - case ID_COLR: - surf->color.rgb[ 0 ] = getU1( fp ) / 255.0f; - surf->color.rgb[ 1 ] = getU1( fp ) / 255.0f; - surf->color.rgb[ 2 ] = getU1( fp ) / 255.0f; - break; + switch ( id ) { + case ID_COLR: + surf->color.rgb[ 0 ] = getU1( fp ) / 255.0f; + surf->color.rgb[ 1 ] = getU1( fp ) / 255.0f; + surf->color.rgb[ 2 ] = getU1( fp ) / 255.0f; + break; - case ID_FLAG: - flags = getU2( fp ); - if ( flags & 4 ) surf->smooth = 1.56207f; - if ( flags & 8 ) surf->color_hilite.val = 1.0f; - if ( flags & 16 ) surf->color_filter.val = 1.0f; - if ( flags & 128 ) surf->dif_sharp.val = 0.5f; - if ( flags & 256 ) surf->sideflags = 3; - if ( flags & 512 ) surf->add_trans.val = 1.0f; - break; + case ID_FLAG: + flags = getU2( fp ); + if ( flags & 4 ) surf->smooth = 1.56207f; + if ( flags & 8 ) surf->color_hilite.val = 1.0f; + if ( flags & 16 ) surf->color_filter.val = 1.0f; + if ( flags & 128 ) surf->dif_sharp.val = 0.5f; + if ( flags & 256 ) surf->sideflags = 3; + if ( flags & 512 ) surf->add_trans.val = 1.0f; + break; - case ID_LUMI: - surf->luminosity.val = getI2( fp ) / 256.0f; - break; + case ID_LUMI: + surf->luminosity.val = getI2( fp ) / 256.0f; + break; - case ID_VLUM: - surf->luminosity.val = getF4( fp ); - break; + case ID_VLUM: + surf->luminosity.val = getF4( fp ); + break; - case ID_DIFF: - surf->diffuse.val = getI2( fp ) / 256.0f; - break; + case ID_DIFF: + surf->diffuse.val = getI2( fp ) / 256.0f; + break; - case ID_VDIF: - surf->diffuse.val = getF4( fp ); - break; + case ID_VDIF: + surf->diffuse.val = getF4( fp ); + break; - case ID_SPEC: - surf->specularity.val = getI2( fp ) / 256.0f; - break; + case ID_SPEC: + surf->specularity.val = getI2( fp ) / 256.0f; + break; - case ID_VSPC: - surf->specularity.val = getF4( fp ); - break; + case ID_VSPC: + surf->specularity.val = getF4( fp ); + break; - case ID_GLOS: - surf->glossiness.val = ( float ) logf( ( float) getU2( fp )) / 20.7944f; - break; + case ID_GLOS: + surf->glossiness.val = ( float ) logf( ( float) getU2( fp )) / 20.7944f; + break; - case ID_SMAN: - surf->smooth = getF4( fp ); - break; + case ID_SMAN: + surf->smooth = getF4( fp ); + break; - case ID_REFL: - surf->reflection.val.val = getI2( fp ) / 256.0f; - break; + case ID_REFL: + surf->reflection.val.val = getI2( fp ) / 256.0f; + break; - case ID_RFLT: - surf->reflection.options = getU2( fp ); - break; + case ID_RFLT: + surf->reflection.options = getU2( fp ); + break; - case ID_RIMG: - s = getS0( fp ); - surf->reflection.cindex = add_clip( s, &obj->clip, &obj->nclips ); - surf->reflection.options = 3; - break; + case ID_RIMG: + s = getS0( fp ); + surf->reflection.cindex = add_clip( s, &obj->clip, &obj->nclips ); + surf->reflection.options = 3; + break; - case ID_RSAN: - surf->reflection.seam_angle = getF4( fp ); - break; + case ID_RSAN: + surf->reflection.seam_angle = getF4( fp ); + break; - case ID_TRAN: - surf->transparency.val.val = getI2( fp ) / 256.0f; - break; + case ID_TRAN: + surf->transparency.val.val = getI2( fp ) / 256.0f; + break; - case ID_RIND: - surf->eta.val = getF4( fp ); - break; + case ID_RIND: + surf->eta.val = getF4( fp ); + break; - case ID_BTEX: - s = (char*)getbytes( fp, sz ); - tex = get_texture( s ); - lwListAdd( (void**)&surf->bump.tex, tex ); - break; + case ID_BTEX: + s = (char*)getbytes( fp, sz ); + tex = get_texture( s ); + lwListAdd( (void**)&surf->bump.tex, tex ); + break; - case ID_CTEX: - s = (char*)getbytes( fp, sz ); - tex = get_texture( s ); - lwListAdd( (void**)&surf->color.tex, tex ); - break; + case ID_CTEX: + s = (char*)getbytes( fp, sz ); + tex = get_texture( s ); + lwListAdd( (void**)&surf->color.tex, tex ); + break; - case ID_DTEX: - s = (char*)getbytes( fp, sz ); - tex = get_texture( s ); - lwListAdd( (void**)&surf->diffuse.tex, tex ); - break; + case ID_DTEX: + s = (char*)getbytes( fp, sz ); + tex = get_texture( s ); + lwListAdd( (void**)&surf->diffuse.tex, tex ); + break; - case ID_LTEX: - s = (char*)getbytes( fp, sz ); - tex = get_texture( s ); - lwListAdd( (void**)&surf->luminosity.tex, tex ); - break; + case ID_LTEX: + s = (char*)getbytes( fp, sz ); + tex = get_texture( s ); + lwListAdd( (void**)&surf->luminosity.tex, tex ); + break; - case ID_RTEX: - s = (char*)getbytes( fp, sz ); - tex = get_texture( s ); - lwListAdd( (void**)&surf->reflection.val.tex, tex ); - break; + case ID_RTEX: + s = (char*)getbytes( fp, sz ); + tex = get_texture( s ); + lwListAdd( (void**)&surf->reflection.val.tex, tex ); + break; - case ID_STEX: - s = (char*)getbytes( fp, sz ); - tex = get_texture( s ); - lwListAdd( (void**)&surf->specularity.tex, tex ); - break; + case ID_STEX: + s = (char*)getbytes( fp, sz ); + tex = get_texture( s ); + lwListAdd( (void**)&surf->specularity.tex, tex ); + break; - case ID_TTEX: - s = (char*)getbytes( fp, sz ); - tex = get_texture( s ); - lwListAdd( (void**)&surf->transparency.val.tex, tex ); - break; + case ID_TTEX: + s = (char*)getbytes( fp, sz ); + tex = get_texture( s ); + lwListAdd( (void**)&surf->transparency.val.tex, tex ); + break; - case ID_TFLG: - flags = getU2( fp ); + case ID_TFLG: + flags = getU2( fp ); - if ( flags & 1 ) i = 0; - if ( flags & 2 ) i = 1; - if ( flags & 4 ) i = 2; - tex->axis = i; - if ( tex->type == ID_IMAP ) - tex->param.imap.axis = i; - else - tex->param.proc.axis = i; + if ( flags & 1 ) i = 0; + if ( flags & 2 ) i = 1; + if ( flags & 4 ) i = 2; + tex->axis = i; + if ( tex->type == ID_IMAP ) + tex->param.imap.axis = i; + else + tex->param.proc.axis = i; - if ( flags & 8 ) tex->tmap.coord_sys = 1; - if ( flags & 16 ) tex->negative = 1; - if ( flags & 32 ) tex->param.imap.pblend = 1; - if ( flags & 64 ) { - tex->param.imap.aa_strength = 1.0f; - tex->param.imap.aas_flags = 1; - } - break; + if ( flags & 8 ) tex->tmap.coord_sys = 1; + if ( flags & 16 ) tex->negative = 1; + if ( flags & 32 ) tex->param.imap.pblend = 1; + if ( flags & 64 ) { + tex->param.imap.aa_strength = 1.0f; + tex->param.imap.aas_flags = 1; + } + break; - case ID_TSIZ: - for ( i = 0; i < 3; i++ ) - tex->tmap.size.val[ i ] = getF4( fp ); - break; + case ID_TSIZ: + for ( i = 0; i < 3; i++ ) + tex->tmap.size.val[ i ] = getF4( fp ); + break; - case ID_TCTR: - for ( i = 0; i < 3; i++ ) - tex->tmap.center.val[ i ] = getF4( fp ); - break; + case ID_TCTR: + for ( i = 0; i < 3; i++ ) + tex->tmap.center.val[ i ] = getF4( fp ); + break; - case ID_TFAL: - for ( i = 0; i < 3; i++ ) - tex->tmap.falloff.val[ i ] = getF4( fp ); - break; + case ID_TFAL: + for ( i = 0; i < 3; i++ ) + tex->tmap.falloff.val[ i ] = getF4( fp ); + break; - case ID_TVEL: - for ( i = 0; i < 3; i++ ) - v[ i ] = getF4( fp ); - tex->tmap.center.eindex = add_tvel( tex->tmap.center.val, v, - &obj->env, &obj->nenvs ); - break; + case ID_TVEL: + for ( i = 0; i < 3; i++ ) + v[ i ] = getF4( fp ); + tex->tmap.center.eindex = add_tvel( tex->tmap.center.val, v, + &obj->env, &obj->nenvs ); + break; - case ID_TCLR: - if ( tex->type == ID_PROC ) - for ( i = 0; i < 3; i++ ) - tex->param.proc.value[ i ] = getU1( fp ) / 255.0f; - break; + case ID_TCLR: + if ( tex->type == ID_PROC ) + for ( i = 0; i < 3; i++ ) + tex->param.proc.value[ i ] = getU1( fp ) / 255.0f; + break; - case ID_TVAL: - tex->param.proc.value[ 0 ] = getI2( fp ) / 256.0f; - break; + case ID_TVAL: + tex->param.proc.value[ 0 ] = getI2( fp ) / 256.0f; + break; - case ID_TAMP: - if ( tex->type == ID_IMAP ) - tex->param.imap.amplitude.val = getF4( fp ); - break; + case ID_TAMP: + if ( tex->type == ID_IMAP ) + tex->param.imap.amplitude.val = getF4( fp ); + break; - case ID_TIMG: - s = getS0( fp ); - tex->param.imap.cindex = add_clip( s, &obj->clip, &obj->nclips ); - break; + case ID_TIMG: + s = getS0( fp ); + tex->param.imap.cindex = add_clip( s, &obj->clip, &obj->nclips ); + break; - case ID_TAAS: - tex->param.imap.aa_strength = getF4( fp ); - tex->param.imap.aas_flags = 1; - break; + case ID_TAAS: + tex->param.imap.aa_strength = getF4( fp ); + tex->param.imap.aas_flags = 1; + break; - case ID_TREF: - tex->tmap.ref_object = (char*)getbytes( fp, sz ); - break; + case ID_TREF: + tex->tmap.ref_object = (char*)getbytes( fp, sz ); + break; - case ID_TOPC: - tex->opacity.val = getF4( fp ); - break; + case ID_TOPC: + tex->opacity.val = getF4( fp ); + break; - case ID_TFP0: - if ( tex->type == ID_IMAP ) - tex->param.imap.wrapw.val = getF4( fp ); - break; + case ID_TFP0: + if ( tex->type == ID_IMAP ) + tex->param.imap.wrapw.val = getF4( fp ); + break; - case ID_TFP1: - if ( tex->type == ID_IMAP ) - tex->param.imap.wraph.val = getF4( fp ); - break; + case ID_TFP1: + if ( tex->type == ID_IMAP ) + tex->param.imap.wraph.val = getF4( fp ); + break; - case ID_SHDR: - shdr = (lwPlugin*)Mem_ClearedAlloc( sizeof( lwPlugin ) ); - if ( !shdr ) goto Fail; - shdr->name = (char*)getbytes( fp, sz ); - lwListAdd( (void**)&surf->shader, shdr ); - surf->nshaders++; - break; + case ID_SHDR: + shdr = (lwPlugin*)Mem_ClearedAlloc( sizeof( lwPlugin ) ); + if ( !shdr ) goto Fail; + shdr->name = (char*)getbytes( fp, sz ); + lwListAdd( (void**)&surf->shader, shdr ); + surf->nshaders++; + break; - case ID_SDAT: - shdr->data = getbytes( fp, sz ); - break; + case ID_SDAT: + shdr->data = getbytes( fp, sz ); + break; - default: - break; - } + default: + break; + } - /* error while reading current subchunk? */ + /* error while reading current subchunk? */ - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) goto Fail; + rlen = get_flen(); + if ( rlen < 0 || rlen > sz ) goto Fail; - /* skip unread parts of the current subchunk */ + /* skip unread parts of the current subchunk */ - if ( rlen < sz ) - fp->Seek( sz - rlen, FS_SEEK_CUR ); + if ( rlen < sz ) + fp->Seek( sz - rlen, FS_SEEK_CUR ); - /* end of the SURF chunk? */ + /* end of the SURF chunk? */ - if ( cksize <= fp->Tell() - pos ) - break; + if ( cksize <= fp->Tell() - pos ) + break; - /* get the next subchunk header */ + /* get the next subchunk header */ - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) goto Fail; + set_flen( 0 ); + id = getU4( fp ); + sz = getU2( fp ); + if ( 6 != get_flen() ) goto Fail; } return surf; @@ -2148,16 +2148,16 @@ int lwGetPolygons5( idFile *fp, int cksize, lwPolygonList *plist, int ptoffset ) bp = buf; while ( bp < buf + cksize ) { - nv = sgetU2( &bp ); - nverts += nv; - npols++; - bp += 2 * nv; - i = sgetI2( &bp ); - if ( i < 0 ) bp += 2; /* detail polygons */ + nv = sgetU2( &bp ); + nverts += nv; + npols++; + bp += 2 * nv; + i = sgetI2( &bp ); + if ( i < 0 ) bp += 2; /* detail polygons */ } if ( !lwAllocPolygons( plist, npols, nverts )) - goto Fail; + goto Fail; /* fill in the new polygons */ @@ -2166,23 +2166,23 @@ int lwGetPolygons5( idFile *fp, int cksize, lwPolygonList *plist, int ptoffset ) pv = plist->pol[ 0 ].v + plist->voffset; for ( i = 0; i < npols; i++ ) { - nv = sgetU2( &bp ); + nv = sgetU2( &bp ); - pp->nverts = nv; - pp->type = ID_FACE; - if ( !pp->v ) pp->v = pv; - for ( j = 0; j < nv; j++ ) - pv[ j ].index = sgetU2( &bp ) + ptoffset; - j = sgetI2( &bp ); - if ( j < 0 ) { - j = -j; - bp += 2; - } - j -= 1; - pp->surf = ( lwSurface * ) j; + pp->nverts = nv; + pp->type = ID_FACE; + if ( !pp->v ) pp->v = pv; + for ( j = 0; j < nv; j++ ) + pv[ j ].index = sgetU2( &bp ) + ptoffset; + j = sgetI2( &bp ); + if ( j < 0 ) { + j = -j; + bp += 2; + } + j -= 1; + pp->surf = ( lwSurface * ) j; - pp++; - pv += nv; + pp++; + pv += nv; } Mem_Free( buf ); @@ -2204,14 +2204,14 @@ file couldn't be loaded. On failure, failID and failpos can be used to diagnose the cause. 1. If the file isn't an LWOB, failpos will contain 12 and failID will - be unchanged. + be unchanged. 2. If an error occurs while reading an LWOB, failID will contain the - most recently read IFF chunk ID, and failpos will contain the - value returned by fp->Tell() at the time of the failure. + most recently read IFF chunk ID, and failpos will contain the + value returned by fp->Tell() at the time of the failure. 3. If the file couldn't be opened, or an error occurs while reading - the first 12 bytes, both failID and failpos will be unchanged. + the first 12 bytes, both failID and failpos will be unchanged. If you don't need this information, failID and failpos can be NULL. ====================================================================== */ @@ -2241,16 +2241,16 @@ lwObject *lwGetObject5( const char *filename, unsigned int *failID, int *failpos formsize = getU4( fp ); type = getU4( fp ); if ( 12 != get_flen() ) { - fileSystem->CloseFile( fp ); - return NULL; + fileSystem->CloseFile( fp ); + return NULL; } /* LWOB? */ if ( id != ID_FORM || type != ID_LWOB ) { - fileSystem->CloseFile( fp ); - if ( failpos ) *failpos = 12; - return NULL; + fileSystem->CloseFile( fp ); + if ( failpos ) *failpos = 12; + return NULL; } /* allocate an object and a default layer */ @@ -2272,48 +2272,48 @@ lwObject *lwGetObject5( const char *filename, unsigned int *failID, int *failpos /* process chunks as they're encountered */ while ( 1 ) { - cksize += cksize & 1; + cksize += cksize & 1; - switch ( id ) - { - case ID_PNTS: - if ( !lwGetPoints( fp, cksize, &layer->point )) - goto Fail2; - break; + switch ( id ) + { + case ID_PNTS: + if ( !lwGetPoints( fp, cksize, &layer->point )) + goto Fail2; + break; - case ID_POLS: - if ( !lwGetPolygons5( fp, cksize, &layer->polygon, - layer->point.offset )) - goto Fail2; - break; + case ID_POLS: + if ( !lwGetPolygons5( fp, cksize, &layer->polygon, + layer->point.offset )) + goto Fail2; + break; - case ID_SRFS: - if ( !lwGetTags( fp, cksize, &object->taglist )) - goto Fail2; - break; + case ID_SRFS: + if ( !lwGetTags( fp, cksize, &object->taglist )) + goto Fail2; + break; - case ID_SURF: - node = ( lwNode * ) lwGetSurface5( fp, cksize, object ); - if ( !node ) goto Fail2; - lwListAdd( (void**)&object->surf, node ); - object->nsurfs++; - break; + case ID_SURF: + node = ( lwNode * ) lwGetSurface5( fp, cksize, object ); + if ( !node ) goto Fail2; + lwListAdd( (void**)&object->surf, node ); + object->nsurfs++; + break; - default: - fp->Seek( cksize, FS_SEEK_CUR ); - break; - } + default: + fp->Seek( cksize, FS_SEEK_CUR ); + break; + } - /* end of the file? */ + /* end of the file? */ - if ( formsize <= fp->Tell() - 8 ) break; + if ( formsize <= fp->Tell() - 8 ) break; - /* get the next chunk header */ + /* get the next chunk header */ - set_flen( 0 ); - id = getU4( fp ); - cksize = getU4( fp ); - if ( 8 != get_flen() ) goto Fail2; + set_flen( 0 ); + id = getU4( fp ); + cksize = getU4( fp ); + if ( 8 != get_flen() ) goto Fail2; } fileSystem->CloseFile( fp ); @@ -2323,7 +2323,7 @@ lwObject *lwGetObject5( const char *filename, unsigned int *failID, int *failpos lwGetPolyNormals( &layer->point, &layer->polygon ); if ( !lwGetPointPolygons( &layer->point, &layer->polygon )) goto Fail2; if ( !lwResolvePolySurfaces( &layer->polygon, &object->taglist, - &object->surf, &object->nsurfs )) goto Fail2; + &object->surf, &object->nsurfs )) goto Fail2; lwGetVertNormals( &layer->point, &layer->polygon ); return object; @@ -2331,8 +2331,8 @@ lwObject *lwGetObject5( const char *filename, unsigned int *failID, int *failpos Fail2: if ( failID ) *failID = id; if ( fp ) { - if ( failpos ) *failpos = fp->Tell(); - fileSystem->CloseFile( fp ); + if ( failpos ) *failpos = fp->Tell(); + fileSystem->CloseFile( fp ); } lwFreeObject( object ); return NULL; @@ -2350,14 +2350,14 @@ void lwFreePoints( lwPointList *point ) int i; if ( point ) { - if ( point->pt ) { - for ( i = 0; i < point->count; i++ ) { - if ( point->pt[ i ].pol ) Mem_Free( point->pt[ i ].pol ); - if ( point->pt[ i ].vm ) Mem_Free( point->pt[ i ].vm ); - } - Mem_Free( point->pt ); - } - memset( point, 0, sizeof( lwPointList )); + if ( point->pt ) { + for ( i = 0; i < point->count; i++ ) { + if ( point->pt[ i ].pol ) Mem_Free( point->pt[ i ].pol ); + if ( point->pt[ i ].vm ) Mem_Free( point->pt[ i ].vm ); + } + Mem_Free( point->pt ); + } + memset( point, 0, sizeof( lwPointList )); } } @@ -2374,19 +2374,19 @@ void lwFreePolygons( lwPolygonList *plist ) int i, j; if ( plist ) { - if ( plist->pol ) { - for ( i = 0; i < plist->count; i++ ) { - if ( plist->pol[ i ].v ) { - for ( j = 0; j < plist->pol[ i ].nverts; j++ ) - if ( plist->pol[ i ].v[ j ].vm ) - Mem_Free( plist->pol[ i ].v[ j ].vm ); - } - } - if ( plist->pol[ 0 ].v ) - Mem_Free( plist->pol[ 0 ].v ); - Mem_Free( plist->pol ); - } - memset( plist, 0, sizeof( lwPolygonList )); + if ( plist->pol ) { + for ( i = 0; i < plist->count; i++ ) { + if ( plist->pol[ i ].v ) { + for ( j = 0; j < plist->pol[ i ].nverts; j++ ) + if ( plist->pol[ i ].v[ j ].vm ) + Mem_Free( plist->pol[ i ].v[ j ].vm ); + } + } + if ( plist->pol[ 0 ].v ) + Mem_Free( plist->pol[ 0 ].v ); + Mem_Free( plist->pol ); + } + memset( plist, 0, sizeof( lwPolygonList )); } } @@ -2544,16 +2544,16 @@ int lwGetPolygons( idFile *fp, int cksize, lwPolygonList *plist, int ptoffset ) bp = buf; while ( bp < buf + cksize - 4 ) { - nv = sgetU2( &bp ); - nv &= 0x03FF; - nverts += nv; - npols++; - for ( i = 0; i < nv; i++ ) - j = sgetVX( &bp ); + nv = sgetU2( &bp ); + nv &= 0x03FF; + nverts += nv; + npols++; + for ( i = 0; i < nv; i++ ) + j = sgetVX( &bp ); } if ( !lwAllocPolygons( plist, npols, nverts )) - goto Fail; + goto Fail; /* fill in the new polygons */ @@ -2562,19 +2562,19 @@ int lwGetPolygons( idFile *fp, int cksize, lwPolygonList *plist, int ptoffset ) pv = plist->pol[ 0 ].v + plist->voffset; for ( i = 0; i < npols; i++ ) { - nv = sgetU2( &bp ); - flags = nv & 0xFC00; - nv &= 0x03FF; + nv = sgetU2( &bp ); + flags = nv & 0xFC00; + nv &= 0x03FF; - pp->nverts = nv; - pp->flags = flags; - pp->type = type; - if ( !pp->v ) pp->v = pv; - for ( j = 0; j < nv; j++ ) - pp->v[ j ].index = sgetVX( &bp ) + ptoffset; + pp->nverts = nv; + pp->flags = flags; + pp->type = type; + if ( !pp->v ) pp->v = pv; + for ( j = 0; j < nv; j++ ) + pp->v[ j ].index = sgetVX( &bp ) + ptoffset; - pp++; - pv += nv; + pp++; + pv += nv; } Mem_Free( buf ); @@ -2602,22 +2602,22 @@ void lwGetPolyNormals( lwPointList *point, lwPolygonList *polygon ) float p1[ 3 ], p2[ 3 ], pn[ 3 ], v1[ 3 ], v2[ 3 ]; for ( i = 0; i < polygon->count; i++ ) { - if ( polygon->pol[ i ].nverts < 3 ) continue; - for ( j = 0; j < 3; j++ ) { + if ( polygon->pol[ i ].nverts < 3 ) continue; + for ( j = 0; j < 3; j++ ) { // FIXME: track down why indexes are way out of range - p1[ j ] = point->pt[ polygon->pol[ i ].v[ 0 ].index ].pos[ j ]; - p2[ j ] = point->pt[ polygon->pol[ i ].v[ 1 ].index ].pos[ j ]; - pn[ j ] = point->pt[ polygon->pol[ i ].v[ polygon->pol[ i ].nverts - 1 ].index ].pos[ j ]; - } + p1[ j ] = point->pt[ polygon->pol[ i ].v[ 0 ].index ].pos[ j ]; + p2[ j ] = point->pt[ polygon->pol[ i ].v[ 1 ].index ].pos[ j ]; + pn[ j ] = point->pt[ polygon->pol[ i ].v[ polygon->pol[ i ].nverts - 1 ].index ].pos[ j ]; + } - for ( j = 0; j < 3; j++ ) { - v1[ j ] = p2[ j ] - p1[ j ]; - v2[ j ] = pn[ j ] - p1[ j ]; - } + for ( j = 0; j < 3; j++ ) { + v1[ j ] = p2[ j ] - p1[ j ]; + v2[ j ] = pn[ j ] - p1[ j ]; + } - cross( v1, v2, polygon->pol[ i ].norm ); - normalize( polygon->pol[ i ].norm ); + cross( v1, v2, polygon->pol[ i ].norm ); + normalize( polygon->pol[ i ].norm ); } } @@ -2638,26 +2638,26 @@ int lwGetPointPolygons( lwPointList *point, lwPolygonList *polygon ) /* count the number of polygons per point */ for ( i = 0; i < polygon->count; i++ ) - for ( j = 0; j < polygon->pol[ i ].nverts; j++ ) - ++point->pt[ polygon->pol[ i ].v[ j ].index ].npols; + for ( j = 0; j < polygon->pol[ i ].nverts; j++ ) + ++point->pt[ polygon->pol[ i ].v[ j ].index ].npols; /* alloc per-point polygon arrays */ for ( i = 0; i < point->count; i++ ) { - if ( point->pt[ i ].npols == 0 ) continue; - point->pt[ i ].pol = (int*)Mem_ClearedAlloc( point->pt[ i ].npols * sizeof( int ) ); - if ( !point->pt[ i ].pol ) return 0; - point->pt[ i ].npols = 0; + if ( point->pt[ i ].npols == 0 ) continue; + point->pt[ i ].pol = (int*)Mem_ClearedAlloc( point->pt[ i ].npols * sizeof( int ) ); + if ( !point->pt[ i ].pol ) return 0; + point->pt[ i ].npols = 0; } /* fill in polygon array for each point */ for ( i = 0; i < polygon->count; i++ ) { - for ( j = 0; j < polygon->pol[ i ].nverts; j++ ) { - k = polygon->pol[ i ].v[ j ].index; - point->pt[ k ].pol[ point->pt[ k ].npols ] = i; - ++point->pt[ k ].npols; - } + for ( j = 0; j < polygon->pol[ i ].nverts; j++ ) { + k = polygon->pol[ i ].v[ j ].index; + point->pt[ k ].pol[ point->pt[ k ].npols ] = i; + ++point->pt[ k ].npols; + } } return 1; @@ -2685,29 +2685,29 @@ int lwResolvePolySurfaces( lwPolygonList *polygon, lwTagList *tlist, if ( !s ) return 0; for ( i = 0; i < tlist->count; i++ ) { - st = *surf; - while ( st ) { - if ( !strcmp( st->name, tlist->tag[ i ] )) { - s[ i ] = st; - break; - } - st = st->next; - } + st = *surf; + while ( st ) { + if ( !strcmp( st->name, tlist->tag[ i ] )) { + s[ i ] = st; + break; + } + st = st->next; + } } for ( i = 0; i < polygon->count; i++ ) { - index = ( int ) polygon->pol[ i ].surf; - if ( index < 0 || index > tlist->count ) return 0; - if ( !s[ index ] ) { - s[ index ] = lwDefaultSurface(); - if ( !s[ index ] ) return 0; - s[ index ]->name = (char*)Mem_ClearedAlloc( strlen( tlist->tag[ index ] ) + 1 ); - if ( !s[ index ]->name ) return 0; - strcpy( s[ index ]->name, tlist->tag[ index ] ); - lwListAdd( (void**)surf, s[ index ] ); - *nsurfs = *nsurfs + 1; - } - polygon->pol[ i ].surf = s[ index ]; + index = ( int ) polygon->pol[ i ].surf; + if ( index < 0 || index > tlist->count ) return 0; + if ( !s[ index ] ) { + s[ index ] = lwDefaultSurface(); + if ( !s[ index ] ) return 0; + s[ index ]->name = (char*)Mem_ClearedAlloc( strlen( tlist->tag[ index ] ) + 1 ); + if ( !s[ index ]->name ) return 0; + strcpy( s[ index ]->name, tlist->tag[ index ] ); + lwListAdd( (void**)surf, s[ index ] ); + *nsurfs = *nsurfs + 1; + } + polygon->pol[ i ].surf = s[ index ]; } Mem_Free( s ); @@ -2736,29 +2736,29 @@ void lwGetVertNormals( lwPointList *point, lwPolygonList *polygon ) float a; for ( j = 0; j < polygon->count; j++ ) { - for ( n = 0; n < polygon->pol[ j ].nverts; n++ ) { - for ( k = 0; k < 3; k++ ) - polygon->pol[ j ].v[ n ].norm[ k ] = polygon->pol[ j ].norm[ k ]; + for ( n = 0; n < polygon->pol[ j ].nverts; n++ ) { + for ( k = 0; k < 3; k++ ) + polygon->pol[ j ].v[ n ].norm[ k ] = polygon->pol[ j ].norm[ k ]; - if ( polygon->pol[ j ].surf->smooth <= 0 ) continue; + if ( polygon->pol[ j ].surf->smooth <= 0 ) continue; - p = polygon->pol[ j ].v[ n ].index; + p = polygon->pol[ j ].v[ n ].index; - for ( g = 0; g < point->pt[ p ].npols; g++ ) { - h = point->pt[ p ].pol[ g ]; - if ( h == j ) continue; + for ( g = 0; g < point->pt[ p ].npols; g++ ) { + h = point->pt[ p ].pol[ g ]; + if ( h == j ) continue; - if ( polygon->pol[ j ].smoothgrp != polygon->pol[ h ].smoothgrp ) - continue; - a = vecangle( polygon->pol[ j ].norm, polygon->pol[ h ].norm ); - if ( a > polygon->pol[ j ].surf->smooth ) continue; + if ( polygon->pol[ j ].smoothgrp != polygon->pol[ h ].smoothgrp ) + continue; + a = vecangle( polygon->pol[ j ].norm, polygon->pol[ h ].norm ); + if ( a > polygon->pol[ j ].surf->smooth ) continue; - for ( k = 0; k < 3; k++ ) - polygon->pol[ j ].v[ n ].norm[ k ] += polygon->pol[ h ].norm[ k ]; - } + for ( k = 0; k < 3; k++ ) + polygon->pol[ j ].v[ n ].norm[ k ] += polygon->pol[ h ].norm[ k ]; + } - normalize( polygon->pol[ j ].v[ n ].norm ); - } + normalize( polygon->pol[ j ].v[ n ].norm ); + } } } @@ -3274,55 +3274,55 @@ int lwGetProcedural( idFile *fp, int rsz, lwTexture *tex ) if ( 0 > get_flen() ) return 0; while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); + sz += sz & 1; + set_flen( 0 ); - switch ( id ) { - case ID_TMAP: - if ( !lwGetTMap( fp, sz, &tex->tmap )) return 0; - break; + switch ( id ) { + case ID_TMAP: + if ( !lwGetTMap( fp, sz, &tex->tmap )) return 0; + break; - case ID_AXIS: - tex->param.proc.axis = getU2( fp ); - break; + case ID_AXIS: + tex->param.proc.axis = getU2( fp ); + break; - case ID_VALU: - tex->param.proc.value[ 0 ] = getF4( fp ); - if ( sz >= 8 ) tex->param.proc.value[ 1 ] = getF4( fp ); - if ( sz >= 12 ) tex->param.proc.value[ 2 ] = getF4( fp ); - break; + case ID_VALU: + tex->param.proc.value[ 0 ] = getF4( fp ); + if ( sz >= 8 ) tex->param.proc.value[ 1 ] = getF4( fp ); + if ( sz >= 12 ) tex->param.proc.value[ 2 ] = getF4( fp ); + break; - case ID_FUNC: - tex->param.proc.name = getS0( fp ); - rlen = get_flen(); - tex->param.proc.data = getbytes( fp, sz - rlen ); - break; + case ID_FUNC: + tex->param.proc.name = getS0( fp ); + rlen = get_flen(); + tex->param.proc.data = getbytes( fp, sz - rlen ); + break; - default: - break; - } + default: + break; + } - /* error while reading the current subchunk? */ + /* error while reading the current subchunk? */ - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) return 0; + rlen = get_flen(); + if ( rlen < 0 || rlen > sz ) return 0; - /* skip unread parts of the current subchunk */ + /* skip unread parts of the current subchunk */ - if ( rlen < sz ) - fp->Seek( sz - rlen, FS_SEEK_CUR ); + if ( rlen < sz ) + fp->Seek( sz - rlen, FS_SEEK_CUR ); - /* end of the procedural block? */ + /* end of the procedural block? */ - if ( rsz <= fp->Tell() - pos ) - break; + if ( rsz <= fp->Tell() - pos ) + break; - /* get the next subchunk header */ + /* get the next subchunk header */ - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) return 0; + set_flen( 0 ); + id = getU4( fp ); + sz = getU2( fp ); + if ( 6 != get_flen() ) return 0; } set_flen( fp->Tell() - pos ); @@ -3349,78 +3349,78 @@ int lwGetGradient( idFile *fp, int rsz, lwTexture *tex ) if ( 0 > get_flen() ) return 0; while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); + sz += sz & 1; + set_flen( 0 ); - switch ( id ) { - case ID_TMAP: - if ( !lwGetTMap( fp, sz, &tex->tmap )) return 0; - break; + switch ( id ) { + case ID_TMAP: + if ( !lwGetTMap( fp, sz, &tex->tmap )) return 0; + break; - case ID_PNAM: - tex->param.grad.paramname = getS0( fp ); - break; + case ID_PNAM: + tex->param.grad.paramname = getS0( fp ); + break; - case ID_INAM: - tex->param.grad.itemname = getS0( fp ); - break; + case ID_INAM: + tex->param.grad.itemname = getS0( fp ); + break; - case ID_GRST: - tex->param.grad.start = getF4( fp ); - break; + case ID_GRST: + tex->param.grad.start = getF4( fp ); + break; - case ID_GREN: - tex->param.grad.end = getF4( fp ); - break; + case ID_GREN: + tex->param.grad.end = getF4( fp ); + break; - case ID_GRPT: - tex->param.grad.repeat = getU2( fp ); - break; + case ID_GRPT: + tex->param.grad.repeat = getU2( fp ); + break; - case ID_FKEY: - nkeys = sz / sizeof( lwGradKey ); - tex->param.grad.key = (lwGradKey*)Mem_ClearedAlloc( nkeys * sizeof( lwGradKey ) ); - if ( !tex->param.grad.key ) return 0; - for ( i = 0; i < nkeys; i++ ) { - tex->param.grad.key[ i ].value = getF4( fp ); - for ( j = 0; j < 4; j++ ) - tex->param.grad.key[ i ].rgba[ j ] = getF4( fp ); - } - break; + case ID_FKEY: + nkeys = sz / sizeof( lwGradKey ); + tex->param.grad.key = (lwGradKey*)Mem_ClearedAlloc( nkeys * sizeof( lwGradKey ) ); + if ( !tex->param.grad.key ) return 0; + for ( i = 0; i < nkeys; i++ ) { + tex->param.grad.key[ i ].value = getF4( fp ); + for ( j = 0; j < 4; j++ ) + tex->param.grad.key[ i ].rgba[ j ] = getF4( fp ); + } + break; - case ID_IKEY: - nkeys = sz / 2; - tex->param.grad.ikey = (short*)Mem_ClearedAlloc( nkeys * sizeof( short ) ); - if ( !tex->param.grad.ikey ) return 0; - for ( i = 0; i < nkeys; i++ ) - tex->param.grad.ikey[ i ] = getU2( fp ); - break; + case ID_IKEY: + nkeys = sz / 2; + tex->param.grad.ikey = (short*)Mem_ClearedAlloc( nkeys * sizeof( short ) ); + if ( !tex->param.grad.ikey ) return 0; + for ( i = 0; i < nkeys; i++ ) + tex->param.grad.ikey[ i ] = getU2( fp ); + break; - default: - break; - } + default: + break; + } - /* error while reading the current subchunk? */ + /* error while reading the current subchunk? */ - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) return 0; + rlen = get_flen(); + if ( rlen < 0 || rlen > sz ) return 0; - /* skip unread parts of the current subchunk */ + /* skip unread parts of the current subchunk */ - if ( rlen < sz ) - fp->Seek( sz - rlen, FS_SEEK_CUR ); + if ( rlen < sz ) + fp->Seek( sz - rlen, FS_SEEK_CUR ); - /* end of the gradient? */ + /* end of the gradient? */ - if ( rsz <= fp->Tell() - pos ) - break; + if ( rsz <= fp->Tell() - pos ) + break; - /* get the next subchunk header */ + /* get the next subchunk header */ - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) return 0; + set_flen( 0 ); + id = getU4( fp ); + sz = getU2( fp ); + if ( 6 != get_flen() ) return 0; } set_flen( fp->Tell() - pos ); @@ -3453,22 +3453,22 @@ lwTexture *lwGetTexture( idFile *fp, int bloksz, unsigned int type ) sz = getU2( fp ); if ( !lwGetTHeader( fp, sz, tex )) { - Mem_Free( tex ); - return NULL; + Mem_Free( tex ); + return NULL; } sz = bloksz - sz - 6; switch ( type ) { - case ID_IMAP: ok = lwGetImageMap( fp, sz, tex ); break; - case ID_PROC: ok = lwGetProcedural( fp, sz, tex ); break; - case ID_GRAD: ok = lwGetGradient( fp, sz, tex ); break; - default: - ok = !fp->Seek( sz, FS_SEEK_CUR ); + case ID_IMAP: ok = lwGetImageMap( fp, sz, tex ); break; + case ID_PROC: ok = lwGetProcedural( fp, sz, tex ); break; + case ID_GRAD: ok = lwGetGradient( fp, sz, tex ); break; + default: + ok = !fp->Seek( sz, FS_SEEK_CUR ); } if ( !ok ) { - lwFreeTexture( tex ); - return NULL; + lwFreeTexture( tex ); + return NULL; } set_flen( bloksz ); @@ -3502,17 +3502,17 @@ lwPlugin *lwGetShader( idFile *fp, int bloksz ) if ( 0 > get_flen() ) goto Fail; while ( hsz > 0 ) { - sz += sz & 1; - hsz -= sz; - if ( id == ID_ENAB ) { - shdr->flags = getU2( fp ); - break; - } - else { - fp->Seek( sz, FS_SEEK_CUR ); - id = getU4( fp ); - sz = getU2( fp ); - } + sz += sz & 1; + hsz -= sz; + if ( id == ID_ENAB ) { + shdr->flags = getU2( fp ); + break; + } + else { + fp->Seek( sz, FS_SEEK_CUR ); + id = getU4( fp ); + sz = getU2( fp ); + } } id = getU4( fp ); @@ -3520,41 +3520,41 @@ lwPlugin *lwGetShader( idFile *fp, int bloksz ) if ( 0 > get_flen() ) goto Fail; while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); + sz += sz & 1; + set_flen( 0 ); - switch ( id ) { - case ID_FUNC: - shdr->name = getS0( fp ); - rlen = get_flen(); - shdr->data = getbytes( fp, sz - rlen ); - break; + switch ( id ) { + case ID_FUNC: + shdr->name = getS0( fp ); + rlen = get_flen(); + shdr->data = getbytes( fp, sz - rlen ); + break; - default: - break; - } + default: + break; + } - /* error while reading the current subchunk? */ + /* error while reading the current subchunk? */ - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) goto Fail; + rlen = get_flen(); + if ( rlen < 0 || rlen > sz ) goto Fail; - /* skip unread parts of the current subchunk */ + /* skip unread parts of the current subchunk */ - if ( rlen < sz ) - fp->Seek( sz - rlen, FS_SEEK_CUR ); + if ( rlen < sz ) + fp->Seek( sz - rlen, FS_SEEK_CUR ); - /* end of the shader block? */ + /* end of the shader block? */ - if ( bloksz <= fp->Tell() - pos ) - break; + if ( bloksz <= fp->Tell() - pos ) + break; - /* get the next subchunk header */ + /* get the next subchunk header */ - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) goto Fail; + set_flen( 0 ); + id = getU4( fp ); + sz = getU2( fp ); + if ( 6 != get_flen() ) goto Fail; } set_flen( fp->Tell() - pos ); @@ -3600,17 +3600,17 @@ static int add_texture( lwSurface *surf, lwTexture *tex ) lwTexture **list; switch ( tex->chan ) { - case ID_COLR: list = &surf->color.tex; break; - case ID_LUMI: list = &surf->luminosity.tex; break; - case ID_DIFF: list = &surf->diffuse.tex; break; - case ID_SPEC: list = &surf->specularity.tex; break; - case ID_GLOS: list = &surf->glossiness.tex; break; - case ID_REFL: list = &surf->reflection.val.tex; break; - case ID_TRAN: list = &surf->transparency.val.tex; break; - case ID_RIND: list = &surf->eta.tex; break; - case ID_TRNL: list = &surf->translucency.tex; break; - case ID_BUMP: list = &surf->bump.tex; break; - default: return 0; + case ID_COLR: list = &surf->color.tex; break; + case ID_LUMI: list = &surf->luminosity.tex; break; + case ID_DIFF: list = &surf->diffuse.tex; break; + case ID_SPEC: list = &surf->specularity.tex; break; + case ID_GLOS: list = &surf->glossiness.tex; break; + case ID_REFL: list = &surf->reflection.val.tex; break; + case ID_TRAN: list = &surf->transparency.val.tex; break; + case ID_RIND: list = &surf->eta.tex; break; + case ID_TRNL: list = &surf->translucency.tex; break; + case ID_BUMP: list = &surf->bump.tex; break; + default: return 0; } lwListInsert( (void**)list, tex, (int (__cdecl *)(void *,void *))compare_textures ); @@ -3697,179 +3697,179 @@ lwSurface *lwGetSurface( idFile *fp, int cksize ) /* process subchunks as they're encountered */ while ( 1 ) { - sz += sz & 1; - set_flen( 0 ); + sz += sz & 1; + set_flen( 0 ); - switch ( id ) { - case ID_COLR: - surf->color.rgb[ 0 ] = getF4( fp ); - surf->color.rgb[ 1 ] = getF4( fp ); - surf->color.rgb[ 2 ] = getF4( fp ); - surf->color.eindex = getVX( fp ); - break; + switch ( id ) { + case ID_COLR: + surf->color.rgb[ 0 ] = getF4( fp ); + surf->color.rgb[ 1 ] = getF4( fp ); + surf->color.rgb[ 2 ] = getF4( fp ); + surf->color.eindex = getVX( fp ); + break; - case ID_LUMI: - surf->luminosity.val = getF4( fp ); - surf->luminosity.eindex = getVX( fp ); - break; + case ID_LUMI: + surf->luminosity.val = getF4( fp ); + surf->luminosity.eindex = getVX( fp ); + break; - case ID_DIFF: - surf->diffuse.val = getF4( fp ); - surf->diffuse.eindex = getVX( fp ); - break; + case ID_DIFF: + surf->diffuse.val = getF4( fp ); + surf->diffuse.eindex = getVX( fp ); + break; - case ID_SPEC: - surf->specularity.val = getF4( fp ); - surf->specularity.eindex = getVX( fp ); - break; + case ID_SPEC: + surf->specularity.val = getF4( fp ); + surf->specularity.eindex = getVX( fp ); + break; - case ID_GLOS: - surf->glossiness.val = getF4( fp ); - surf->glossiness.eindex = getVX( fp ); - break; + case ID_GLOS: + surf->glossiness.val = getF4( fp ); + surf->glossiness.eindex = getVX( fp ); + break; - case ID_REFL: - surf->reflection.val.val = getF4( fp ); - surf->reflection.val.eindex = getVX( fp ); - break; + case ID_REFL: + surf->reflection.val.val = getF4( fp ); + surf->reflection.val.eindex = getVX( fp ); + break; - case ID_RFOP: - surf->reflection.options = getU2( fp ); - break; + case ID_RFOP: + surf->reflection.options = getU2( fp ); + break; - case ID_RIMG: - surf->reflection.cindex = getVX( fp ); - break; + case ID_RIMG: + surf->reflection.cindex = getVX( fp ); + break; - case ID_RSAN: - surf->reflection.seam_angle = getF4( fp ); - break; + case ID_RSAN: + surf->reflection.seam_angle = getF4( fp ); + break; - case ID_TRAN: - surf->transparency.val.val = getF4( fp ); - surf->transparency.val.eindex = getVX( fp ); - break; + case ID_TRAN: + surf->transparency.val.val = getF4( fp ); + surf->transparency.val.eindex = getVX( fp ); + break; - case ID_TROP: - surf->transparency.options = getU2( fp ); - break; + case ID_TROP: + surf->transparency.options = getU2( fp ); + break; - case ID_TIMG: - surf->transparency.cindex = getVX( fp ); - break; + case ID_TIMG: + surf->transparency.cindex = getVX( fp ); + break; - case ID_RIND: - surf->eta.val = getF4( fp ); - surf->eta.eindex = getVX( fp ); - break; + case ID_RIND: + surf->eta.val = getF4( fp ); + surf->eta.eindex = getVX( fp ); + break; - case ID_TRNL: - surf->translucency.val = getF4( fp ); - surf->translucency.eindex = getVX( fp ); - break; + case ID_TRNL: + surf->translucency.val = getF4( fp ); + surf->translucency.eindex = getVX( fp ); + break; - case ID_BUMP: - surf->bump.val = getF4( fp ); - surf->bump.eindex = getVX( fp ); - break; + case ID_BUMP: + surf->bump.val = getF4( fp ); + surf->bump.eindex = getVX( fp ); + break; - case ID_SMAN: - surf->smooth = getF4( fp ); - break; + case ID_SMAN: + surf->smooth = getF4( fp ); + break; - case ID_SIDE: - surf->sideflags = getU2( fp ); - break; + case ID_SIDE: + surf->sideflags = getU2( fp ); + break; - case ID_CLRH: - surf->color_hilite.val = getF4( fp ); - surf->color_hilite.eindex = getVX( fp ); - break; + case ID_CLRH: + surf->color_hilite.val = getF4( fp ); + surf->color_hilite.eindex = getVX( fp ); + break; - case ID_CLRF: - surf->color_filter.val = getF4( fp ); - surf->color_filter.eindex = getVX( fp ); - break; + case ID_CLRF: + surf->color_filter.val = getF4( fp ); + surf->color_filter.eindex = getVX( fp ); + break; - case ID_ADTR: - surf->add_trans.val = getF4( fp ); - surf->add_trans.eindex = getVX( fp ); - break; + case ID_ADTR: + surf->add_trans.val = getF4( fp ); + surf->add_trans.eindex = getVX( fp ); + break; - case ID_SHRP: - surf->dif_sharp.val = getF4( fp ); - surf->dif_sharp.eindex = getVX( fp ); - break; + case ID_SHRP: + surf->dif_sharp.val = getF4( fp ); + surf->dif_sharp.eindex = getVX( fp ); + break; - case ID_GVAL: - surf->glow.val = getF4( fp ); - surf->glow.eindex = getVX( fp ); - break; + case ID_GVAL: + surf->glow.val = getF4( fp ); + surf->glow.eindex = getVX( fp ); + break; - case ID_LINE: - surf->line.enabled = 1; - if ( sz >= 2 ) surf->line.flags = getU2( fp ); - if ( sz >= 6 ) surf->line.size.val = getF4( fp ); - if ( sz >= 8 ) surf->line.size.eindex = getVX( fp ); - break; + case ID_LINE: + surf->line.enabled = 1; + if ( sz >= 2 ) surf->line.flags = getU2( fp ); + if ( sz >= 6 ) surf->line.size.val = getF4( fp ); + if ( sz >= 8 ) surf->line.size.eindex = getVX( fp ); + break; - case ID_ALPH: - surf->alpha_mode = getU2( fp ); - surf->alpha = getF4( fp ); - break; + case ID_ALPH: + surf->alpha_mode = getU2( fp ); + surf->alpha = getF4( fp ); + break; - case ID_AVAL: - surf->alpha = getF4( fp ); - break; + case ID_AVAL: + surf->alpha = getF4( fp ); + break; - case ID_BLOK: - type = getU4( fp ); + case ID_BLOK: + type = getU4( fp ); - switch ( type ) { - case ID_IMAP: - case ID_PROC: - case ID_GRAD: - tex = lwGetTexture( fp, sz - 4, type ); - if ( !tex ) goto Fail; - if ( !add_texture( surf, tex )) - lwFreeTexture( tex ); - set_flen( 4 + get_flen() ); - break; - case ID_SHDR: - shdr = lwGetShader( fp, sz - 4 ); - if ( !shdr ) goto Fail; - lwListInsert( (void**)&surf->shader, shdr, (int (__cdecl *)(void *,void *))compare_shaders ); - ++surf->nshaders; - set_flen( 4 + get_flen() ); - break; - } - break; + switch ( type ) { + case ID_IMAP: + case ID_PROC: + case ID_GRAD: + tex = lwGetTexture( fp, sz - 4, type ); + if ( !tex ) goto Fail; + if ( !add_texture( surf, tex )) + lwFreeTexture( tex ); + set_flen( 4 + get_flen() ); + break; + case ID_SHDR: + shdr = lwGetShader( fp, sz - 4 ); + if ( !shdr ) goto Fail; + lwListInsert( (void**)&surf->shader, shdr, (int (__cdecl *)(void *,void *))compare_shaders ); + ++surf->nshaders; + set_flen( 4 + get_flen() ); + break; + } + break; - default: - break; - } + default: + break; + } - /* error while reading current subchunk? */ + /* error while reading current subchunk? */ - rlen = get_flen(); - if ( rlen < 0 || rlen > sz ) goto Fail; + rlen = get_flen(); + if ( rlen < 0 || rlen > sz ) goto Fail; - /* skip unread parts of the current subchunk */ + /* skip unread parts of the current subchunk */ - if ( rlen < sz ) - fp->Seek( sz - rlen, FS_SEEK_CUR ); + if ( rlen < sz ) + fp->Seek( sz - rlen, FS_SEEK_CUR ); - /* end of the SURF chunk? */ + /* end of the SURF chunk? */ - if ( cksize <= fp->Tell() - pos ) - break; + if ( cksize <= fp->Tell() - pos ) + break; - /* get the next subchunk header */ + /* get the next subchunk header */ - set_flen( 0 ); - id = getU4( fp ); - sz = getU2( fp ); - if ( 6 != get_flen() ) goto Fail; + set_flen( 0 ); + id = getU4( fp ); + sz = getU2( fp ); + if ( 6 != get_flen() ) goto Fail; } return surf; @@ -3900,9 +3900,9 @@ void normalize( float v[] ) r = ( float ) idMath::Sqrt( dot( v, v )); if ( r > 0 ) { - v[ 0 ] /= r; - v[ 1 ] /= r; - v[ 2 ] /= r; + v[ 0 ] /= r; + v[ 1 ] /= r; + v[ 2 ] /= r; } } @@ -3916,14 +3916,14 @@ Free memory used by an lwVMap. void lwFreeVMap( lwVMap *vmap ) { if ( vmap ) { - if ( vmap->name ) Mem_Free( vmap->name ); - if ( vmap->vindex ) Mem_Free( vmap->vindex ); - if ( vmap->pindex ) Mem_Free( vmap->pindex ); - if ( vmap->val ) { - if ( vmap->val[ 0 ] ) Mem_Free( vmap->val[ 0 ] ); - Mem_Free( vmap->val ); - } - Mem_Free( vmap ); + if ( vmap->name ) Mem_Free( vmap->name ); + if ( vmap->vindex ) Mem_Free( vmap->vindex ); + if ( vmap->pindex ) Mem_Free( vmap->pindex ); + if ( vmap->val ) { + if ( vmap->val[ 0 ] ) Mem_Free( vmap->val[ 0 ] ); + Mem_Free( vmap->val ); + } + Mem_Free( vmap ); } } @@ -3952,8 +3952,8 @@ lwVMap *lwGetVMap( idFile *fp, int cksize, int ptoffset, int poloffset, vmap = (lwVMap*)Mem_ClearedAlloc( sizeof( lwVMap ) ); if ( !vmap ) { - Mem_Free( buf ); - return NULL; + Mem_Free( buf ); + return NULL; } /* initialize the vmap */ @@ -3971,11 +3971,11 @@ lwVMap *lwGetVMap( idFile *fp, int cksize, int ptoffset, int poloffset, npts = 0; while ( bp < buf + cksize ) { - i = sgetVX( &bp ); - if ( perpoly ) - i = sgetVX( &bp ); - bp += vmap->dim * sizeof( float ); - ++npts; + i = sgetVX( &bp ); + if ( perpoly ) + i = sgetVX( &bp ); + bp += vmap->dim * sizeof( float ); + ++npts; } /* allocate the vmap */ @@ -3984,28 +3984,28 @@ lwVMap *lwGetVMap( idFile *fp, int cksize, int ptoffset, int poloffset, vmap->vindex = (int*)Mem_ClearedAlloc( npts * sizeof( int ) ); if ( !vmap->vindex ) goto Fail; if ( perpoly ) { - vmap->pindex = (int*)Mem_ClearedAlloc( npts * sizeof( int ) ); - if ( !vmap->pindex ) goto Fail; + vmap->pindex = (int*)Mem_ClearedAlloc( npts * sizeof( int ) ); + if ( !vmap->pindex ) goto Fail; } if ( vmap->dim > 0 ) { - vmap->val = (float**)Mem_ClearedAlloc( npts * sizeof( float * ) ); - if ( !vmap->val ) goto Fail; - f = (float*)Mem_ClearedAlloc( npts * vmap->dim * sizeof( float ) ); - if ( !f ) goto Fail; - for ( i = 0; i < npts; i++ ) - vmap->val[ i ] = f + i * vmap->dim; + vmap->val = (float**)Mem_ClearedAlloc( npts * sizeof( float * ) ); + if ( !vmap->val ) goto Fail; + f = (float*)Mem_ClearedAlloc( npts * vmap->dim * sizeof( float ) ); + if ( !f ) goto Fail; + for ( i = 0; i < npts; i++ ) + vmap->val[ i ] = f + i * vmap->dim; } /* fill in the vmap values */ bp = buf + rlen; for ( i = 0; i < npts; i++ ) { - vmap->vindex[ i ] = sgetVX( &bp ); - if ( perpoly ) - vmap->pindex[ i ] = sgetVX( &bp ); - for ( j = 0; j < vmap->dim; j++ ) - vmap->val[ i ][ j ] = sgetF4( &bp ); + vmap->vindex[ i ] = sgetVX( &bp ); + if ( perpoly ) + vmap->pindex[ i ] = sgetVX( &bp ); + for ( j = 0; j < vmap->dim; j++ ) + vmap->val[ i ][ j ] = sgetF4( &bp ); } Mem_Free( buf ); @@ -4034,36 +4034,36 @@ int lwGetPointVMaps( lwPointList *point, lwVMap *vmap ) vm = vmap; while ( vm ) { - if ( !vm->perpoly ) - for ( i = 0; i < vm->nverts; i++ ) - ++point->pt[ vm->vindex[ i ]].nvmaps; - vm = vm->next; + if ( !vm->perpoly ) + for ( i = 0; i < vm->nverts; i++ ) + ++point->pt[ vm->vindex[ i ]].nvmaps; + vm = vm->next; } /* allocate vmap references for each mapped point */ for ( i = 0; i < point->count; i++ ) { - if ( point->pt[ i ].nvmaps ) { - point->pt[ i ].vm = (lwVMapPt*)Mem_ClearedAlloc( point->pt[ i ].nvmaps * sizeof( lwVMapPt ) ); - if ( !point->pt[ i ].vm ) return 0; - point->pt[ i ].nvmaps = 0; - } + if ( point->pt[ i ].nvmaps ) { + point->pt[ i ].vm = (lwVMapPt*)Mem_ClearedAlloc( point->pt[ i ].nvmaps * sizeof( lwVMapPt ) ); + if ( !point->pt[ i ].vm ) return 0; + point->pt[ i ].nvmaps = 0; + } } /* fill in vmap references for each mapped point */ vm = vmap; while ( vm ) { - if ( !vm->perpoly ) { - for ( i = 0; i < vm->nverts; i++ ) { - j = vm->vindex[ i ]; - n = point->pt[ j ].nvmaps; - point->pt[ j ].vm[ n ].vmap = vm; - point->pt[ j ].vm[ n ].index = i; - ++point->pt[ j ].nvmaps; - } - } - vm = vm->next; + if ( !vm->perpoly ) { + for ( i = 0; i < vm->nverts; i++ ) { + j = vm->vindex[ i ]; + n = point->pt[ j ].nvmaps; + point->pt[ j ].vm[ n ].vmap = vm; + point->pt[ j ].vm[ n ].index = i; + ++point->pt[ j ].nvmaps; + } + } + vm = vm->next; } return 1; @@ -4087,51 +4087,51 @@ int lwGetPolyVMaps( lwPolygonList *polygon, lwVMap *vmap ) vm = vmap; while ( vm ) { - if ( vm->perpoly ) { - for ( i = 0; i < vm->nverts; i++ ) { - for ( j = 0; j < polygon->pol[ vm->pindex[ i ]].nverts; j++ ) { - pv = &polygon->pol[ vm->pindex[ i ]].v[ j ]; - if ( vm->vindex[ i ] == pv->index ) { - ++pv->nvmaps; - break; - } - } - } - } - vm = vm->next; + if ( vm->perpoly ) { + for ( i = 0; i < vm->nverts; i++ ) { + for ( j = 0; j < polygon->pol[ vm->pindex[ i ]].nverts; j++ ) { + pv = &polygon->pol[ vm->pindex[ i ]].v[ j ]; + if ( vm->vindex[ i ] == pv->index ) { + ++pv->nvmaps; + break; + } + } + } + } + vm = vm->next; } /* allocate vmap references for each mapped vertex */ for ( i = 0; i < polygon->count; i++ ) { - for ( j = 0; j < polygon->pol[ i ].nverts; j++ ) { - pv = &polygon->pol[ i ].v[ j ]; - if ( pv->nvmaps ) { - pv->vm = (lwVMapPt*)Mem_ClearedAlloc( pv->nvmaps * sizeof( lwVMapPt ) ); - if ( !pv->vm ) return 0; - pv->nvmaps = 0; - } - } + for ( j = 0; j < polygon->pol[ i ].nverts; j++ ) { + pv = &polygon->pol[ i ].v[ j ]; + if ( pv->nvmaps ) { + pv->vm = (lwVMapPt*)Mem_ClearedAlloc( pv->nvmaps * sizeof( lwVMapPt ) ); + if ( !pv->vm ) return 0; + pv->nvmaps = 0; + } + } } /* fill in vmap references for each mapped point */ vm = vmap; while ( vm ) { - if ( vm->perpoly ) { - for ( i = 0; i < vm->nverts; i++ ) { - for ( j = 0; j < polygon->pol[ vm->pindex[ i ]].nverts; j++ ) { - pv = &polygon->pol[ vm->pindex[ i ]].v[ j ]; - if ( vm->vindex[ i ] == pv->index ) { - pv->vm[ pv->nvmaps ].vmap = vm; - pv->vm[ pv->nvmaps ].index = i; - ++pv->nvmaps; - break; - } - } - } - } - vm = vm->next; + if ( vm->perpoly ) { + for ( i = 0; i < vm->nverts; i++ ) { + for ( j = 0; j < polygon->pol[ vm->pindex[ i ]].nverts; j++ ) { + pv = &polygon->pol[ vm->pindex[ i ]].v[ j ]; + if ( vm->vindex[ i ] == pv->index ) { + pv->vm[ pv->nvmaps ].vmap = vm; + pv->vm[ pv->nvmaps ].index = i; + ++pv->nvmaps; + break; + } + } + } + } + vm = vm->next; } return 1; diff --git a/neo/renderer/Model_lwo.h b/neo/renderer/Model_lwo.h index 123d483b..f7b2b655 100644 --- a/neo/renderer/Model_lwo.h +++ b/neo/renderer/Model_lwo.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"). @@ -291,11 +291,11 @@ typedef struct st_lwClip { int index; unsigned int type; /* ID_STIL, ID_ISEQ, etc. */ union { - lwClipStill still; - lwClipSeq seq; - lwClipAnim anim; - lwClipXRef xref; - lwClipCycle cycle; + lwClipStill still; + lwClipSeq seq; + lwClipAnim anim; + lwClipXRef xref; + lwClipCycle cycle; } source; float start_time; float duration; @@ -386,9 +386,9 @@ typedef struct st_lwTexture { short negative; short axis; union { - lwImageMap imap; - lwProcedural proc; - lwGradient grad; + lwImageMap imap; + lwProcedural proc; + lwGradient grad; } param; lwTMap tmap; } lwTexture; diff --git a/neo/renderer/Model_ma.cpp b/neo/renderer/Model_ma.cpp index 7863830b..b7b70150 100644 --- a/neo/renderer/Model_ma.cpp +++ b/neo/renderer/Model_ma.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"). @@ -38,7 +38,7 @@ If you have questions concerning this license or the applicable additional terms ====================================================================== */ - + #define MA_VERBOSE( x ) { if ( maGlobal.verbose ) { common->Printf x ; } } @@ -74,7 +74,7 @@ void MA_ParseNodeHeader(idParser& parser, maNodeHeader_t* header) { } bool MA_ParseHeaderIndex(maAttribHeader_t* header, int& minIndex, int& maxIndex, const char* headerType, const char* skipString) { - + idParser miniParse; idToken token; @@ -98,7 +98,7 @@ bool MA_ParseHeaderIndex(maAttribHeader_t* header, int& minIndex, int& maxIndex, } bool MA_ParseAttribHeader(idParser &parser, maAttribHeader_t* header) { - + idToken token; memset(header, 0, sizeof(maAttribHeader_t)); @@ -188,7 +188,7 @@ bool MA_ParseTransform(idParser& parser) { transform->parent = *parent; } } - + //Add this transform to the list maGlobal.model->transforms.Set(header.name, transform); return true; @@ -207,18 +207,18 @@ bool MA_ParseVertex(idParser& parser, maAttribHeader_t* header) { //Get the start and end index for this attribute int minIndex, maxIndex; - if(!MA_ParseHeaderIndex(header, minIndex, maxIndex, "VertexHeader", NULL)) { + if(!MA_ParseHeaderIndex(header, minIndex, maxIndex, "VertexHeader", NULL)) { //This was just a header return true; } - + //Read each vert for(int i = minIndex; i <= maxIndex; i++) { pMesh->vertexes[i].x = parser.ParseFloat(); pMesh->vertexes[i].z = parser.ParseFloat(); pMesh->vertexes[i].y = -parser.ParseFloat(); } - + return true; } @@ -320,7 +320,7 @@ bool MA_ParseNormal(idParser& parser, maAttribHeader_t* header) { return true; } - + parser.ReadToken(&token); if(!token.Icmp("-")) { idToken tk2; @@ -334,7 +334,7 @@ bool MA_ParseNormal(idParser& parser, maAttribHeader_t* header) { } else { parser.UnreadToken(&token); } - + //Read each vert for(int i = minIndex; i <= maxIndex; i++) { @@ -468,7 +468,7 @@ bool MA_ParseColor(idParser& parser, maAttribHeader_t* header) { } bool MA_ParseTVert(idParser& parser, maAttribHeader_t* header) { - + maMesh_t* pMesh = &maGlobal.currentObject->mesh; idToken token; @@ -519,10 +519,10 @@ bool MA_ParseTVert(idParser& parser, maAttribHeader_t* header) { * Quick check to see if the vert participates in a shared normal */ bool MA_QuickIsVertShared(int faceIndex, int vertIndex) { - + maMesh_t* pMesh = &maGlobal.currentObject->mesh; int vertNum = pMesh->faces[faceIndex].vertexNum[vertIndex]; - + for( int i = 0; i < 3; i++) { int edge = pMesh->faces[faceIndex].edge[i]; if(edge < 0) { @@ -655,7 +655,7 @@ void MA_ParseMesh(idParser& parser) { if(MA_QuickIsVertShared(i, j)) { MA_GetSharedFace(i, j, sharedFace, sharedVert); } - + if(sharedFace != -1) { //Get the normal from the share pMesh->faces[i].vertexNormals[j] = pMesh->faces[sharedFace].vertexNormals[sharedVert]; @@ -678,7 +678,7 @@ void MA_ParseMesh(idParser& parser) { int tmp = pMesh->faces[i].vertexNum[1]; pMesh->faces[i].vertexNum[1] = pMesh->faces[i].vertexNum[2]; pMesh->faces[i].vertexNum[2] = tmp; - + idVec3 tmpVec = pMesh->faces[i].vertexNormals[1]; pMesh->faces[i].vertexNormals[1] = pMesh->faces[i].vertexNormals[2]; pMesh->faces[i].vertexNormals[2] = tmpVec; @@ -696,14 +696,14 @@ void MA_ParseMesh(idParser& parser) { for(int i = 0; i < pMesh->numVertTransforms; i++) { pMesh->vertexes[(int)pMesh->vertTransforms[i].w] += pMesh->vertTransforms[i].ToVec3(); } - + MA_VERBOSE((va("MESH %s - parent %s\n", header.name, header.parent))); MA_VERBOSE((va("\tverts:%d\n",maGlobal.currentObject->mesh.numVertexes))); MA_VERBOSE((va("\tfaces:%d\n",maGlobal.currentObject->mesh.numFaces))); } void MA_ParseFileNode(idParser& parser) { - + //Get the header info from the node maNodeHeader_t header; MA_ParseNodeHeader(parser, &header); @@ -750,7 +750,7 @@ void MA_ParseMaterialNode(idParser& parser) { memset(matNode, 0, sizeof(maMaterialNode_t)); strcpy(matNode->name, header.name); - + maGlobal.model->materialNodes.Set(matNode->name, matNode); } @@ -772,7 +772,7 @@ void MA_ParseCreateNode(idParser& parser) { int MA_AddMaterial(const char* materialName) { - + maMaterialNode_t** destNode; maGlobal.model->materialNodes.Get(materialName, &destNode); @@ -784,16 +784,16 @@ int MA_AddMaterial(const char* materialName) { matNode = matNode->child; } if(matNode && matNode->file) { - + //Got the file maMaterial_t *material; material = (maMaterial_t *)Mem_Alloc( sizeof( maMaterial_t ) ); memset( material, 0, sizeof( maMaterial_t ) ); - + //Remove the OS stuff idStr qPath; qPath = fileSystem->OSPathToRelativePath( matNode->file->path ); - + strcpy(material->name, qPath.c_str()); maGlobal.model->materials.Append( material ); @@ -833,7 +833,7 @@ bool MA_ParseConnectAttr(idParser& parser) { destType = temp.Right(temp.Length()-dot-1); if(srcType.Find("oc") != -1) { - + //Is this attribute a material node attribute maMaterialNode_t** matNode; maGlobal.model->materialNodes.Get(srcName, &matNode); @@ -862,7 +862,7 @@ bool MA_ParseConnectAttr(idParser& parser) { for(int i = 0; i < maGlobal.model->objects.Num(); i++) { if(!strcmp(maGlobal.model->objects[i]->name, srcName)) { //maGlobal.model->objects[i]->materialRef = MA_AddMaterial(destName); - strcpy(maGlobal.model->objects[i]->materialName, destName); + strcpy(maGlobal.model->objects[i]->materialName, destName); break; } } @@ -908,12 +908,12 @@ void MA_BuildAxisRotation(idMat4& mat, float ang, int axis) { } void MA_ApplyTransformation(maModel_t *model) { - + for(int i = 0; i < model->objects.Num(); i++) { maMesh_t* mesh = &model->objects[i]->mesh; maTransform_t* transform = mesh->transform; - - + + while(transform) { @@ -943,10 +943,10 @@ void MA_ApplyTransformation(maModel_t *model) { mesh->vertexes[j] = rotx * mesh->vertexes[j]; mesh->vertexes[j] = rotz * mesh->vertexes[j]; mesh->vertexes[j] = roty * mesh->vertexes[j]; - + mesh->vertexes[j] = mesh->vertexes[j] + transform->translate; } - + transform = transform->parent; } } @@ -962,16 +962,16 @@ maModel_t *MA_Parse( const char *buffer, const char* filename, bool verbose ) { maGlobal.verbose = verbose; - - - + + + maGlobal.currentObject = NULL; // NOTE: using new operator because aseModel_t contains idList class objects maGlobal.model = new maModel_t; maGlobal.model->objects.Resize( 32, 32 ); maGlobal.model->materials.Resize( 32, 32 ); - + idParser parser; parser.SetFlags(LEXFL_NOSTRINGCONCAT); @@ -992,7 +992,7 @@ maModel_t *MA_Parse( const char *buffer, const char* filename, bool verbose ) { maGlobal.model->objects[i]->materialRef = MA_AddMaterial(maGlobal.model->objects[i]->materialName); } - + //Apply Transformation MA_ApplyTransformation(maGlobal.model); @@ -1047,10 +1047,10 @@ void MA_Free( maModel_t *ma ) { } for ( i = 0; i < ma->objects.Num(); i++ ) { obj = ma->objects[i]; - + // free the base nesh mesh = &obj->mesh; - + if ( mesh->vertexes ) { Mem_Free( mesh->vertexes ); } diff --git a/neo/renderer/Model_ma.h b/neo/renderer/Model_ma.h index 06444c7c..ebb577ac 100644 --- a/neo/renderer/Model_ma.h +++ b/neo/renderer/Model_ma.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 struct maTransform_s { idVec3 translate; idVec3 rotate; idVec3 scale; - maTransform_s* parent; + maTransform_s* parent; } maTransform_t; typedef struct { @@ -63,7 +63,7 @@ typedef struct { } maFace_t; typedef struct { - + //Transform to be applied maTransform_t* transform; @@ -132,7 +132,7 @@ typedef struct maModel_s { idList materials; idList objects; idHashTable transforms; - + //Material Resolution idHashTable fileNodes; idHashTable materialNodes; diff --git a/neo/renderer/Model_md3.cpp b/neo/renderer/Model_md3.cpp index fecccaa3..e541f3cb 100644 --- a/neo/renderer/Model_md3.cpp +++ b/neo/renderer/Model_md3.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"). @@ -48,7 +48,7 @@ idRenderModelMD3::InitFromFile void idRenderModelMD3::InitFromFile( const char *fileName ) { int i, j; md3Header_t *pinmodel; - md3Frame_t *frame; + md3Frame_t *frame; md3Surface_t *surf; md3Shader_t *shader; md3Triangle_t *tri; @@ -83,60 +83,60 @@ void idRenderModelMD3::InitFromFile( const char *fileName ) { memcpy (md3, buffer, LittleLong(pinmodel->ofsEnd) ); - LL(md3->ident); - LL(md3->version); - LL(md3->numFrames); - LL(md3->numTags); - LL(md3->numSurfaces); - LL(md3->ofsFrames); - LL(md3->ofsTags); - LL(md3->ofsSurfaces); - LL(md3->ofsEnd); + LL(md3->ident); + LL(md3->version); + LL(md3->numFrames); + LL(md3->numTags); + LL(md3->numSurfaces); + LL(md3->ofsFrames); + LL(md3->ofsTags); + LL(md3->ofsSurfaces); + LL(md3->ofsEnd); if ( md3->numFrames < 1 ) { common->Warning( "InitFromFile: %s has no frames", fileName ); fileSystem->FreeFile( buffer ); return; } - + // swap all the frames - frame = (md3Frame_t *) ( (byte *)md3 + md3->ofsFrames ); - for ( i = 0 ; i < md3->numFrames ; i++, frame++) { - frame->radius = LittleFloat( frame->radius ); - for ( j = 0 ; j < 3 ; j++ ) { - frame->bounds[0][j] = LittleFloat( frame->bounds[0][j] ); - frame->bounds[1][j] = LittleFloat( frame->bounds[1][j] ); - frame->localOrigin[j] = LittleFloat( frame->localOrigin[j] ); - } + frame = (md3Frame_t *) ( (byte *)md3 + md3->ofsFrames ); + for ( i = 0 ; i < md3->numFrames ; i++, frame++) { + frame->radius = LittleFloat( frame->radius ); + for ( j = 0 ; j < 3 ; j++ ) { + frame->bounds[0][j] = LittleFloat( frame->bounds[0][j] ); + frame->bounds[1][j] = LittleFloat( frame->bounds[1][j] ); + frame->localOrigin[j] = LittleFloat( frame->localOrigin[j] ); + } } // swap all the tags - tag = (md3Tag_t *) ( (byte *)md3 + md3->ofsTags ); - for ( i = 0 ; i < md3->numTags * md3->numFrames ; i++, tag++) { - for ( j = 0 ; j < 3 ; j++ ) { + tag = (md3Tag_t *) ( (byte *)md3 + md3->ofsTags ); + for ( i = 0 ; i < md3->numTags * md3->numFrames ; i++, tag++) { + for ( j = 0 ; j < 3 ; j++ ) { tag->origin[j] = LittleFloat( tag->origin[j] ); tag->axis[0][j] = LittleFloat( tag->axis[0][j] ); tag->axis[1][j] = LittleFloat( tag->axis[1][j] ); tag->axis[2][j] = LittleFloat( tag->axis[2][j] ); - } + } } // swap all the surfaces surf = (md3Surface_t *) ( (byte *)md3 + md3->ofsSurfaces ); for ( i = 0 ; i < md3->numSurfaces ; i++) { - LL(surf->ident); - LL(surf->flags); - LL(surf->numFrames); - LL(surf->numShaders); - LL(surf->numTriangles); - LL(surf->ofsTriangles); - LL(surf->numVerts); - LL(surf->ofsShaders); - LL(surf->ofsSt); - LL(surf->ofsXyzNormals); - LL(surf->ofsEnd); - + LL(surf->ident); + LL(surf->flags); + LL(surf->numFrames); + LL(surf->numShaders); + LL(surf->numTriangles); + LL(surf->ofsTriangles); + LL(surf->numVerts); + LL(surf->ofsShaders); + LL(surf->ofsSt); + LL(surf->ofsXyzNormals); + LL(surf->ofsEnd); + if ( surf->numVerts > SHADER_MAX_VERTEXES ) { common->Error( "InitFromFile: %s has more than %i verts on a surface (%i)", fileName, SHADER_MAX_VERTEXES, surf->numVerts ); @@ -145,7 +145,7 @@ void idRenderModelMD3::InitFromFile( const char *fileName ) { common->Error( "InitFromFile: %s has more than %i triangles on a surface (%i)", fileName, SHADER_MAX_INDEXES / 3, surf->numTriangles ); } - + // change to surface identifier surf->ident = 0; //SF_MD3; @@ -162,14 +162,14 @@ void idRenderModelMD3::InitFromFile( const char *fileName ) { surf->name[j-2] = 0; } - // register the shaders - shader = (md3Shader_t *) ( (byte *)surf + surf->ofsShaders ); - for ( j = 0 ; j < surf->numShaders ; j++, shader++ ) { - const idMaterial *sh; + // register the shaders + shader = (md3Shader_t *) ( (byte *)surf + surf->ofsShaders ); + for ( j = 0 ; j < surf->numShaders ; j++, shader++ ) { + const idMaterial *sh; - sh = declManager->FindMaterial( shader->name ); + sh = declManager->FindMaterial( shader->name ); shader->shader = sh; - } + } // swap all the triangles tri = (md3Triangle_t *) ( (byte *)surf + surf->ofsTriangles ); @@ -180,28 +180,28 @@ void idRenderModelMD3::InitFromFile( const char *fileName ) { } // swap all the ST - st = (md3St_t *) ( (byte *)surf + surf->ofsSt ); - for ( j = 0 ; j < surf->numVerts ; j++, st++ ) { - st->st[0] = LittleFloat( st->st[0] ); - st->st[1] = LittleFloat( st->st[1] ); - } + st = (md3St_t *) ( (byte *)surf + surf->ofsSt ); + for ( j = 0 ; j < surf->numVerts ; j++, st++ ) { + st->st[0] = LittleFloat( st->st[0] ); + st->st[1] = LittleFloat( st->st[1] ); + } // swap all the XyzNormals - xyz = (md3XyzNormal_t *) ( (byte *)surf + surf->ofsXyzNormals ); - for ( j = 0 ; j < surf->numVerts * surf->numFrames ; j++, xyz++ ) + xyz = (md3XyzNormal_t *) ( (byte *)surf + surf->ofsXyzNormals ); + for ( j = 0 ; j < surf->numVerts * surf->numFrames ; j++, xyz++ ) { - xyz->xyz[0] = LittleShort( xyz->xyz[0] ); - xyz->xyz[1] = LittleShort( xyz->xyz[1] ); - xyz->xyz[2] = LittleShort( xyz->xyz[2] ); + xyz->xyz[0] = LittleShort( xyz->xyz[0] ); + xyz->xyz[1] = LittleShort( xyz->xyz[1] ); + xyz->xyz[2] = LittleShort( xyz->xyz[2] ); - xyz->normal = LittleShort( xyz->normal ); - } + xyz->normal = LittleShort( xyz->normal ); + } // find the next surface surf = (md3Surface_t *)( (byte *)surf + surf->ofsEnd ); } - + fileSystem->FreeFile( buffer ); } @@ -264,7 +264,7 @@ void idRenderModelMD3::LerpMeshVertexes ( srfTriangles_t *tri, const struct md3S tri->numVerts++; } - } + } } /* @@ -368,4 +368,3 @@ idBounds idRenderModelMD3::Bounds(const struct renderEntity_s *ent) const { return ret; } - diff --git a/neo/renderer/Model_md3.h b/neo/renderer/Model_md3.h index ecbbaf65..96d2affb 100644 --- a/neo/renderer/Model_md3.h +++ b/neo/renderer/Model_md3.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 @@ typedef struct md3Tag_s { */ typedef struct md3Surface_s { - int ident; // + int ident; // char name[MAX_MD3PATH]; // polyset name @@ -131,7 +131,7 @@ typedef struct md3Header_s { int flags; int numFrames; - int numTags; + int numTags; int numSurfaces; int numSkins; diff --git a/neo/renderer/Model_md5.cpp b/neo/renderer/Model_md5.cpp index d1cb09f5..8d8e28f9 100644 --- a/neo/renderer/Model_md5.cpp +++ b/neo/renderer/Model_md5.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"). @@ -116,7 +116,7 @@ void idMD5Mesh::ParseMesh( idLexer &parser, int numJoints, const idJointMat *joi parser.ReadToken( &token ); shaderName = token; - shader = declManager->FindMaterial( shaderName ); + shader = declManager->FindMaterial( shaderName ); // // parse texture coordinates @@ -384,7 +384,7 @@ int idMD5Mesh::NearestJoint( int a, int b, int c ) const { } // find the first weight for this vertex - weightVertNum = 0; + weightVertNum = 0; for( i = 0; weightVertNum < vertNum; i++ ) { weightVertNum += weightIndex[i*2+1]; } @@ -594,7 +594,7 @@ void idRenderModelMD5::Print() const { totalTris += mesh->NumTris(); totalWeights += mesh->NumWeights(); common->Printf( "%2i: %5i %5i %7i %s\n", i, mesh->NumVerts(), mesh->NumTris(), mesh->NumWeights(), mesh->shader->GetName() ); - } + } common->Printf( "-----\n" ); common->Printf( "%4i verts.\n", totalVerts ); common->Printf( "%4i tris.\n", totalTris ); @@ -682,7 +682,7 @@ void idRenderModelMD5::DrawJoints( const renderEntity_t *ent, const struct viewD num = ent->numJoints; joint = ent->joints; - md5Joint = joints.Ptr(); + md5Joint = joints.Ptr(); for( i = 0; i < num; i++, joint++, md5Joint++ ) { pos = ent->origin + joint->ToVec3() * ent->axis; if ( md5Joint->parent ) { @@ -775,9 +775,9 @@ idRenderModel *idRenderModelMD5::InstantiateDynamicModel( const struct renderEnt // avoid deforming the surface if it will be a nodraw due to a skin remapping // FIXME: may have to still deform clipping hulls const idMaterial *shader = mesh->shader; - + shader = R_RemapShaderBySkin( shader, ent->customSkin, ent->customShader ); - + if ( !shader || ( !shader->IsDrawn() && !shader->SurfaceCastsShadow() ) ) { staticModel->DeleteSurfaceWithId( i ); mesh->surfaceNum = -1; @@ -854,7 +854,7 @@ idRenderModelMD5::GetJointHandle jointHandle_t idRenderModelMD5::GetJointHandle( const char *name ) const { const idMD5Joint *joint; int i; - + joint = joints.Ptr(); for( i = 0; i < joints.Num(); i++, joint++ ) { if ( idStr::Icmp( joint->name.c_str(), name ) == 0 ) { diff --git a/neo/renderer/Model_prt.cpp b/neo/renderer/Model_prt.cpp index f9af994a..81ecf736 100644 --- a/neo/renderer/Model_prt.cpp +++ b/neo/renderer/Model_prt.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 @@ idRenderModel *idRenderModelPrt::InstantiateDynamicModel( const struct renderEnt steppingRandom.RandomInt(); steppingRandom2.RandomInt(); - // calculate local age for this index + // calculate local age for this index int bunchOffset = stage->particleLife * 1000 * stage->spawnBunching * index / stage->totalParticles; int particleAge = stageAge - bunchOffset; @@ -189,7 +189,7 @@ idRenderModel *idRenderModelPrt::InstantiateDynamicModel( const struct renderEnt int inCycleTime = particleAge - particleCycle * stage->cycleMsec; - if ( renderEntity->shaderParms[SHADERPARM_PARTICLE_STOPTIME] && + if ( renderEntity->shaderParms[SHADERPARM_PARTICLE_STOPTIME] && g.renderView->time - inCycleTime >= renderEntity->shaderParms[SHADERPARM_PARTICLE_STOPTIME]*1000 ) { // don't fire any more particles continue; diff --git a/neo/renderer/Model_sprite.cpp b/neo/renderer/Model_sprite.cpp index 471b0116..e562d841 100644 --- a/neo/renderer/Model_sprite.cpp +++ b/neo/renderer/Model_sprite.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/neo/renderer/RenderEntity.cpp b/neo/renderer/RenderEntity.cpp index 3b771ae3..822dbfc8 100644 --- a/neo/renderer/RenderEntity.cpp +++ b/neo/renderer/RenderEntity.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/neo/renderer/RenderSystem.cpp b/neo/renderer/RenderSystem.cpp index 9dcc3479..6578489f 100644 --- a/neo/renderer/RenderSystem.cpp +++ b/neo/renderer/RenderSystem.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,7 +44,7 @@ only be called when the back end thread is idle. */ static void R_PerformanceCounters( void ) { if ( r_showPrimitives.GetInteger() != 0 ) { - + float megaBytes = globalImages->SumOfUsedImages() / ( 1024*1024.0 ); if ( r_showPrimitives.GetInteger() > 1 ) { @@ -79,15 +79,15 @@ static void R_PerformanceCounters( void ) { tr.pc.c_deformedIndexes/3, tr.pc.c_tangentIndexes/3, tr.pc.c_guiSurfs - ); + ); } if ( r_showCull.GetBool() ) { common->Printf( "%i sin %i sclip %i sout %i bin %i bout\n", - tr.pc.c_sphere_cull_in, tr.pc.c_sphere_cull_clip, tr.pc.c_sphere_cull_out, + tr.pc.c_sphere_cull_in, tr.pc.c_sphere_cull_clip, tr.pc.c_sphere_cull_out, tr.pc.c_box_cull_in, tr.pc.c_box_cull_out ); } - + if ( r_showAlloc.GetBool() ) { common->Printf( "alloc:%i free:%i\n", tr.pc.c_alloc, tr.pc.c_free ); } @@ -95,13 +95,13 @@ static void R_PerformanceCounters( void ) { if ( r_showInteractions.GetBool() ) { common->Printf( "createInteractions:%i createLightTris:%i createShadowVolumes:%i\n", tr.pc.c_createInteractions, tr.pc.c_createLightTris, tr.pc.c_createShadowVolumes ); - } + } if ( r_showDefs.GetBool() ) { common->Printf( "viewEntities:%i shadowEntities:%i viewLights:%i\n", tr.pc.c_visibleViewEntities, tr.pc.c_shadowViewEntities, tr.pc.c_viewLights ); } if ( r_showUpdates.GetBool() ) { - common->Printf( "entityUpdates:%i entityRefs:%i lightUpdates:%i lightRefs:%i\n", + common->Printf( "entityUpdates:%i entityRefs:%i lightUpdates:%i lightRefs:%i\n", tr.pc.c_entityUpdates, tr.pc.c_entityReferences, tr.pc.c_lightUpdates, tr.pc.c_lightReferences ); } @@ -152,7 +152,7 @@ static void R_IssueRenderCommands( void ) { ============ R_GetCommandBuffer -Returns memory for a command buffer (stretchPicCommand_t, +Returns memory for a command buffer (stretchPicCommand_t, drawSurfsCommand_t, etc) and links it to the end of the current command chain. ============ @@ -250,11 +250,11 @@ void R_LockSurfaceScene( viewDef_t *parms ) { // set the matrix for world space to eye space R_SetViewMatrix( parms ); tr.lockSurfacesCmd.viewDef->worldSpace = parms->worldSpace; - + // update the view origin and axis, and all // the entity matricies for( vModel = tr.lockSurfacesCmd.viewDef->viewEntitys ; vModel ; vModel = vModel->next ) { - myGlMultMatrix( vModel->modelMatrix, + myGlMultMatrix( vModel->modelMatrix, tr.lockSurfacesCmd.viewDef->worldSpace.modelViewMatrix, vModel->modelViewMatrix ); } @@ -329,7 +329,7 @@ void idRenderSystemLocal::SetColor4( float r, float g, float b, float a ) { DrawStretchPic ============= */ -void idRenderSystemLocal::DrawStretchPic( const idDrawVert *verts, const glIndex_t *indexes, int vertCount, int indexCount, const idMaterial *material, +void idRenderSystemLocal::DrawStretchPic( const idDrawVert *verts, const glIndex_t *indexes, int vertCount, int indexCount, const idMaterial *material, bool clip, float min_x, float min_y, float max_x, float max_y ) { guiModel->DrawStretchPic( verts, indexes, vertCount, indexCount, material, clip, min_x, min_y, max_x, max_y ); @@ -406,8 +406,8 @@ void idRenderSystemLocal::DrawSmallChar( int x, int y, int ch, const idMaterial size = 0.0625f; DrawStretchPic( x, y, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, - fcol, frow, - fcol + size, frow + size, + fcol, frow, + fcol + size, frow + size, material ); } @@ -479,8 +479,8 @@ void idRenderSystemLocal::DrawBigChar( int x, int y, int ch, const idMaterial *m size = 0.0625f; DrawStretchPic( x, y, BIGCHAR_WIDTH, BIGCHAR_HEIGHT, - fcol, frow, - fcol + size, frow + size, + fcol, frow, + fcol + size, frow + size, material ); } @@ -730,7 +730,7 @@ void idRenderSystemLocal::EndFrame( int *frontEndMsec, int *backEndMsec ) { // check for dynamic changes that require some initialization R_CheckCvars(); - // check for errors + // check for errors GL_CheckErrors(); // add the swapbuffers command @@ -965,8 +965,8 @@ void idRenderSystemLocal::CaptureRenderToFile( const char *fileName, bool fixAlp // include extra space for OpenGL padding to word boundaries int c = ( rc->width + 3 ) * rc->height; byte *data = (byte *)R_StaticAlloc( c * 3 ); - - qglReadPixels( rc->x, rc->y, rc->width, rc->height, GL_RGB, GL_UNSIGNED_BYTE, data ); + + qglReadPixels( rc->x, rc->y, rc->width, rc->height, GL_RGB, GL_UNSIGNED_BYTE, data ); byte *data2 = (byte *)R_StaticAlloc( c * 4 ); diff --git a/neo/renderer/RenderSystem.h b/neo/renderer/RenderSystem.h index 51524ff4..806734c5 100644 --- a/neo/renderer/RenderSystem.h +++ b/neo/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/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index d47de37c..27bd8651 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.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 @@ idCVar r_testGammaBias( "r_testGammaBias", "0", CVAR_RENDERER | CVAR_FLOAT, "if idCVar r_testStepGamma( "r_testStepGamma", "0", CVAR_RENDERER | CVAR_FLOAT, "if > 0 draw a grid pattern to test gamma levels" ); idCVar r_lightScale( "r_lightScale", "2", CVAR_RENDERER | CVAR_FLOAT, "all light intensities are multiplied by this" ); idCVar r_lightSourceRadius( "r_lightSourceRadius", "0", CVAR_RENDERER | CVAR_FLOAT, "for soft-shadow sampling" ); -idCVar r_flareSize( "r_flareSize", "1", CVAR_RENDERER | CVAR_FLOAT, "scale the flare deforms from the material def" ); +idCVar r_flareSize( "r_flareSize", "1", CVAR_RENDERER | CVAR_FLOAT, "scale the flare deforms from the material def" ); idCVar r_useExternalShadows( "r_useExternalShadows", "1", CVAR_RENDERER | CVAR_INTEGER, "1 = skip drawing caps when outside the light volume, 2 = force to no caps for testing", 0, 2, idCmdSystem::ArgCompletion_Integer<0,2> ); idCVar r_useOptimizedShadows( "r_useOptimizedShadows", "1", CVAR_RENDERER | CVAR_BOOL, "use the dmap generated static shadow volumes" ); @@ -209,7 +209,7 @@ idCVar r_showSkel( "r_showSkel", "0", CVAR_RENDERER | CVAR_INTEGER, "draw the sk idCVar r_jointNameScale( "r_jointNameScale", "0.02", CVAR_RENDERER | CVAR_FLOAT, "size of joint names when r_showskel is set to 1" ); idCVar r_jointNameOffset( "r_jointNameOffset", "0.5", CVAR_RENDERER | CVAR_FLOAT, "offset of joint names when r_showskel is set to 1" ); -idCVar r_cgVertexProfile( "r_cgVertexProfile", "best", CVAR_RENDERER | CVAR_ARCHIVE, "arbvp1, vp20, vp30" ); +idCVar r_cgVertexProfile( "r_cgVertexProfile", "best", CVAR_RENDERER | CVAR_ARCHIVE, "arbvp1, vp20, vp30" ); idCVar r_cgFragmentProfile( "r_cgFragmentProfile", "best", CVAR_RENDERER | CVAR_ARCHIVE, "arbfp1, fp30" ); idCVar r_debugLineDepthTest( "r_debugLineDepthTest", "0", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "perform depth test on debug lines" ); @@ -232,7 +232,7 @@ void ( APIENTRY *qglCombinerParameterfNV )( GLenum pname, const GLfloat param ); void ( APIENTRY *qglCombinerParameteriNV )( GLenum pname, const GLint param ); void ( APIENTRY *qglCombinerInputNV )( GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage ); -void ( APIENTRY *qglCombinerOutputNV )( GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, +void ( APIENTRY *qglCombinerOutputNV )( GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum ); void ( APIENTRY *qglFinalCombinerInputNV )( GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage ); @@ -406,7 +406,7 @@ static void R_CheckPortableExtensions( void ) { // GL_EXT_texture3D (not currently used for anything) glConfig.texture3DAvailable = R_CheckExtension( "GL_EXT_texture3D" ); if ( glConfig.texture3DAvailable ) { - qglTexImage3D = + qglTexImage3D = (void (APIENTRY *)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *) ) GLimp_ExtensionPointer( "glTexImage3D" ); } @@ -437,7 +437,7 @@ static void R_CheckPortableExtensions( void ) { qglCombinerInputNV = (void (APIENTRY *)( GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage )) GLimp_ExtensionPointer( "glCombinerInputNV" ); - qglCombinerOutputNV = (void (APIENTRY *)( GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, + qglCombinerOutputNV = (void (APIENTRY *)( GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum )) GLimp_ExtensionPointer( "glCombinerOutputNV" ); @@ -529,11 +529,11 @@ static void R_CheckPortableExtensions( void ) { common->Error( common->GetLanguageDict()->GetString( "#str_06780" ) ); } - // GL_EXT_depth_bounds_test - glConfig.depthBoundsTestAvailable = R_CheckExtension( "EXT_depth_bounds_test" ); - if ( glConfig.depthBoundsTestAvailable ) { - qglDepthBoundsEXT = (PFNGLDEPTHBOUNDSEXTPROC)GLimp_ExtensionPointer( "glDepthBoundsEXT" ); - } + // GL_EXT_depth_bounds_test + glConfig.depthBoundsTestAvailable = R_CheckExtension( "EXT_depth_bounds_test" ); + if ( glConfig.depthBoundsTestAvailable ) { + qglDepthBoundsEXT = (PFNGLDEPTHBOUNDSEXTPROC)GLimp_ExtensionPointer( "glDepthBoundsEXT" ); + } } @@ -549,20 +549,20 @@ will be used instead. ==================== */ typedef struct vidmode_s { - const char *description; - int width, height; + const char *description; + int width, height; } vidmode_t; vidmode_t r_vidModes[] = { - { "Mode 0: 320x240", 320, 240 }, - { "Mode 1: 400x300", 400, 300 }, - { "Mode 2: 512x384", 512, 384 }, - { "Mode 3: 640x480", 640, 480 }, - { "Mode 4: 800x600", 800, 600 }, - { "Mode 5: 1024x768", 1024, 768 }, - { "Mode 6: 1152x864", 1152, 864 }, - { "Mode 7: 1280x1024", 1280, 1024 }, - { "Mode 8: 1600x1200", 1600, 1200 }, + { "Mode 0: 320x240", 320, 240 }, + { "Mode 1: 400x300", 400, 300 }, + { "Mode 2: 512x384", 512, 384 }, + { "Mode 3: 640x480", 640, 480 }, + { "Mode 4: 800x600", 800, 600 }, + { "Mode 5: 1024x768", 1024, 768 }, + { "Mode 6: 1152x864", 1152, 864 }, + { "Mode 7: 1280x1024", 1280, 1024 }, + { "Mode 8: 1600x1200", 1600, 1200 }, }; static int s_numVidModes = ( sizeof( r_vidModes ) / sizeof( r_vidModes[0] ) ); @@ -573,8 +573,8 @@ static bool R_GetModeInfo( int *width, int *height, int mode ) { #endif vidmode_t *vm; - if ( mode < -1 ) { - return false; + if ( mode < -1 ) { + return false; } if ( mode >= s_numVidModes ) { return false; @@ -595,7 +595,7 @@ static bool R_GetModeInfo( int *width, int *height, int mode ) { *height = vm->height; } - return true; + return true; } @@ -737,8 +737,8 @@ GL_CheckErrors ================== */ void GL_CheckErrors( void ) { - int err; - char s[64]; + int err; + char s[64]; int i; // check for up to 10 errors pending @@ -787,7 +787,7 @@ Reload the material displayed by r_showSurfaceInfo static void R_ReloadSurface_f( const idCmdArgs &args ) { modelTrace_t mt; idVec3 start, end; - + // start far enough away that we don't hit the player model start = tr.primaryView->renderView.vieworg + tr.primaryView->renderView.viewaxis[0] * 16; end = start + tr.primaryView->renderView.viewaxis[0] * 1000.0f; @@ -1054,13 +1054,13 @@ void R_ReportImageDuplication_f( const idCmdArgs &args ) { common->Printf( "%i / %i collisions\n", count, globalImages->images.Num() ); } -/* -============================================================================== - +/* +============================================================================== + THROUGHPUT BENCHMARKING - -============================================================================== -*/ + +============================================================================== +*/ /* ================ @@ -1133,13 +1133,13 @@ void R_Benchmark_f( const idCmdArgs &args ) { } -/* -============================================================================== - - SCREEN SHOTS - -============================================================================== -*/ +/* +============================================================================== + + SCREEN SHOTS + +============================================================================== +*/ /* ==================== @@ -1187,7 +1187,7 @@ void R_ReadTiledPixels( int width, int height, byte *buffer, renderView_t *ref = } qglReadBuffer( GL_FRONT ); - qglReadPixels( 0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, temp ); + qglReadPixels( 0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, temp ); int row = ( w * 3 + 3 ) & ~3; // OpenGL pads to dword boundaries @@ -1213,7 +1213,7 @@ void R_ReadTiledPixels( int width, int height, byte *buffer, renderView_t *ref = /* -================== +================== TakeScreenshot Move to tr_imagefiles.c... @@ -1221,8 +1221,8 @@ Move to tr_imagefiles.c... Will automatically tile render large screen shots if necessary Downsample is the number of steps to mipmap the image before saving it If ref == NULL, session->updateScreen will be used -================== -*/ +================== +*/ void idRenderSystemLocal::TakeScreenshot( int width, int height, const char *fileName, int blends, renderView_t *ref ) { byte *buffer; int i, j, c, temp; @@ -1290,16 +1290,16 @@ void idRenderSystemLocal::TakeScreenshot( int width, int height, const char *fil } -/* -================== +/* +================== R_ScreenshotFilename Returns a filename with digits appended if we have saved a previous screenshot, don't scan from the beginning, because recording demo avis can involve thousands of shots -================== -*/ +================== +*/ void R_ScreenshotFilename( int &lastNumber, const char *base, idStr &fileName ) { int a,b,c,d, e; @@ -1337,15 +1337,15 @@ void R_ScreenshotFilename( int &lastNumber, const char *base, idStr &fileName ) } /* -================== +================== R_BlendedScreenShot screenshot screenshot [filename] screenshot [width] [height] screenshot [width] [height] [samples] -================== -*/ +================== +*/ #define MAX_BLENDS 256 // to keep the accumulation in shorts void R_ScreenShot_f( const idCmdArgs &args ) { static int lastNumber = 0; @@ -1422,7 +1422,7 @@ void R_StencilShot( void ) { byte *byteBuffer = (byte *)Mem_Alloc(pix); - qglReadPixels( 0, 0, width, height, GL_STENCIL_INDEX , GL_UNSIGNED_BYTE, byteBuffer ); + qglReadPixels( 0, 0, width, height, GL_STENCIL_INDEX , GL_UNSIGNED_BYTE, byteBuffer ); for ( i = 0 ; i < pix ; i++ ) { buffer[18+i*3] = @@ -1442,18 +1442,18 @@ void R_StencilShot( void ) { fileSystem->WriteFile( "screenshots/stencilShot.tga", buffer, c, "fs_savepath" ); Mem_Free( buffer ); - Mem_Free( byteBuffer ); + Mem_Free( byteBuffer ); } -/* -================== +/* +================== R_EnvShot_f envshot Saves out env/_ft.tga, etc -================== -*/ +================== +*/ void R_EnvShot_f( const idCmdArgs &args ) { idStr fullname; const char *baseName; @@ -1462,7 +1462,7 @@ void R_EnvShot_f( const idCmdArgs &args ) { renderView_t ref; viewDef_t primary; int blends; - char *extensions[6] = { "_px.tga", "_nx.tga", "_py.tga", "_ny.tga", + char *extensions[6] = { "_px.tga", "_nx.tga", "_py.tga", "_ny.tga", "_pz.tga", "_nz.tga" }; int size; @@ -1528,7 +1528,7 @@ void R_EnvShot_f( const idCmdArgs &args ) { } common->Printf( "Wrote %s, etc\n", fullname.c_str() ); -} +} //============================================================================ @@ -1586,15 +1586,15 @@ void R_SampleCubeMap( const idVec3 &dir, int size, byte *buffers[6], byte result result[3] = buffers[axis][(y*size+x)*4+3]; } -/* -================== +/* +================== R_MakeAmbientMap_f R_MakeAmbientMap_f [size] Saves out env/_amb_ft.tga, etc -================== -*/ +================== +*/ void R_MakeAmbientMap_f( const idCmdArgs &args ) { idStr fullname; const char *baseName; @@ -1602,7 +1602,7 @@ void R_MakeAmbientMap_f( const idCmdArgs &args ) { renderView_t ref; viewDef_t primary; int downSample; - char *extensions[6] = { "_px.tga", "_nx.tga", "_py.tga", "_ny.tga", + char *extensions[6] = { "_px.tga", "_nx.tga", "_py.tga", "_ny.tga", "_pz.tga", "_nz.tga" }; int outSize; byte *buffers[6]; @@ -1725,7 +1725,7 @@ void R_MakeAmbientMap_f( const idCmdArgs &args ) { Mem_Free( buffers[i] ); } } -} +} //============================================================================ @@ -1838,7 +1838,7 @@ void GfxInfo_f( const idCmdArgs &args ) { common->Printf( "glFinish not forced\n" ); } -#ifdef _WIN32 +#ifdef _WIN32 // WGL_EXT_swap_interval typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); extern PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT; @@ -1849,7 +1849,7 @@ extern PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT; common->Printf( "swapInterval not forced\n" ); } #endif - + bool tss = glConfig.twoSidedStencilAvailable || glConfig.atiTwoSidedStencilAvailable; if ( !r_useTwoSidedStencil.GetBool() && tss ) { @@ -2120,7 +2120,7 @@ void idRenderSystemLocal::Clear( void ) { idRenderSystemLocal::Init =============== */ -void idRenderSystemLocal::Init( void ) { +void idRenderSystemLocal::Init( void ) { common->Printf( "------- Initializing renderSystem --------\n" ); @@ -2177,7 +2177,7 @@ void idRenderSystemLocal::Init( void ) { idRenderSystemLocal::Shutdown =============== */ -void idRenderSystemLocal::Shutdown( void ) { +void idRenderSystemLocal::Shutdown( void ) { common->Printf( "idRenderSystem::Shutdown()\n" ); R_DoneFreeType( ); @@ -2321,4 +2321,3 @@ void idRenderSystemLocal::GetCardCaps( bool &oldCard, bool &nv10or20 ) { nv10or20 = ( tr.backEndRenderer == BE_NV10 || tr.backEndRenderer == BE_NV20 ); oldCard = ( tr.backEndRenderer == BE_ARB || tr.backEndRenderer == BE_R200 || tr.backEndRenderer == BE_NV10 || tr.backEndRenderer == BE_NV20 ); } - diff --git a/neo/renderer/RenderWorld.cpp b/neo/renderer/RenderWorld.cpp index 1ad4bc0a..70f79901 100644 --- a/neo/renderer/RenderWorld.cpp +++ b/neo/renderer/RenderWorld.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"). @@ -188,7 +188,7 @@ qhandle_t idRenderWorldLocal::AddEntityDef( const renderEntity_t *re ){ } UpdateEntityDef( entityHandle, re ); - + return entityHandle; } @@ -405,7 +405,7 @@ void idRenderWorldLocal::UpdateLightDef( qhandle_t lightHandle, const renderLigh rlight->noShadows == light->parms.noShadows && rlight->origin == light->parms.origin && rlight->parallel == light->parms.parallel && rlight->pointLight == light->parms.pointLight && rlight->right == light->parms.right && rlight->start == light->parms.start && - rlight->target == light->parms.target && rlight->up == light->parms.up && + rlight->target == light->parms.target && rlight->up == light->parms.up && rlight->shader == light->lightShader && rlight->prelightModel == light->parms.prelightModel ) { justUpdate = true; } else { @@ -724,7 +724,7 @@ void idRenderWorldLocal::RenderScene( const renderView_t *renderView ) { parms->floatTime = parms->renderView.time * 0.001f; parms->renderWorld = this; - // use this time for any subsequent 2D rendering, so damage blobs/etc + // use this time for any subsequent 2D rendering, so damage blobs/etc // can use level time tr.frameShaderTime = parms->floatTime; @@ -861,7 +861,7 @@ int idRenderWorldLocal::PointInArea( const idVec3 &point ) const { areaNode_t *node; int nodeNum; float d; - + node = areaNodes; if ( !node ) { return -1; @@ -885,7 +885,7 @@ int idRenderWorldLocal::PointInArea( const idVec3 &point ) const { } node = areaNodes + nodeNum; } - + return -1; } @@ -985,7 +985,7 @@ guiPoint_t idRenderWorldLocal::GuiTrace( qhandle_t entityHandle, const idVec3 st return pt; } - idRenderEntityLocal *def = entityDefs[entityHandle]; + idRenderEntityLocal *def = entityDefs[entityHandle]; if ( !def ) { common->Printf( "idRenderWorld::GuiTrace: handle %i is NULL\n", entityHandle ); return pt; @@ -1539,7 +1539,7 @@ to prevent double checking areas. We might alternatively choose to do this with an area flow. ================== */ -void idRenderWorldLocal::PushVolumeIntoTree_r( idRenderEntityLocal *def, idRenderLightLocal *light, const idSphere *sphere, int numPoints, const idVec3 (*points), +void idRenderWorldLocal::PushVolumeIntoTree_r( idRenderEntityLocal *def, idRenderLightLocal *light, const idSphere *sphere, int numPoints, const idVec3 (*points), int nodeNum ) { int i; areaNode_t *node; @@ -1609,30 +1609,30 @@ void idRenderWorldLocal::PushVolumeIntoTree_r( idRenderEntityLocal *def, idRende D0 = points[i+0] * norm + plane3; D1 = points[i+1] * norm + plane3; if ( !front && D0 >= 0.0f ) { - front = true; + front = true; } else if ( !back && D0 <= 0.0f ) { - back = true; + back = true; } D2 = points[i+1] * norm + plane3; if ( !front && D1 >= 0.0f ) { - front = true; + front = true; } else if ( !back && D1 <= 0.0f ) { - back = true; + back = true; } D3 = points[i+1] * norm + plane3; if ( !front && D2 >= 0.0f ) { - front = true; + front = true; } else if ( !back && D2 <= 0.0f ) { - back = true; + back = true; } - + if ( !front && D3 >= 0.0f ) { - front = true; + front = true; } else if ( !back && D3 <= 0.0f ) { - back = true; + back = true; } if ( back && front ) { - break; + break; } } if(!(back && front)) { @@ -1647,7 +1647,7 @@ void idRenderWorldLocal::PushVolumeIntoTree_r( idRenderEntityLocal *def, idRende if ( back && front ) { break; } - } + } } #else for ( i = 0 ; i < numPoints ; i++ ) { @@ -1655,12 +1655,12 @@ void idRenderWorldLocal::PushVolumeIntoTree_r( idRenderEntityLocal *def, idRende d = points[i] * node->plane.Normal() + node->plane[3]; if ( d >= 0.0f ) { - front = true; + front = true; } else if ( d <= 0.0f ) { - back = true; + back = true; } if ( back && front ) { - break; + break; } } #endif @@ -2105,7 +2105,7 @@ bool R_GlobalShaderOverride( const idMaterial **shader ) { *shader = declManager->FindMaterial( r_materialOverride.GetString() ); return true; } - + return false; } diff --git a/neo/renderer/RenderWorld.h b/neo/renderer/RenderWorld.h index ad590a12..8507d293 100644 --- a/neo/renderer/RenderWorld.h +++ b/neo/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/neo/renderer/RenderWorld_demo.cpp b/neo/renderer/RenderWorld_demo.cpp index 1c61cecf..d449c4c0 100644 --- a/neo/renderer/RenderWorld_demo.cpp +++ b/neo/renderer/RenderWorld_demo.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 @@ ProcessDemoCommand */ bool idRenderWorldLocal::ProcessDemoCommand( idDemoFile *readDemo, renderView_t *renderView, int *demoTimeOffset ) { bool newMap = false; - + if ( !readDemo ) { return false; } @@ -143,7 +143,7 @@ bool idRenderWorldLocal::ProcessDemoCommand( idDemoFile *readDemo, renderView_t if ( !readDemo->ReadInt( (int&)renderView->globalMaterial ) ) { return false; } - + if ( r_showDemo.GetBool() ) { common->Printf( "DC_RENDERVIEW: %i\n", renderView->time ); } @@ -236,7 +236,7 @@ bool idRenderWorldLocal::ProcessDemoCommand( idDemoFile *readDemo, renderView_t common->Printf( "DC_SET_PORTAL_STATE: %i %i\n", data[0], data[1] ); } } - + break; case DC_END_FRAME: return true; @@ -274,7 +274,7 @@ void idRenderWorldLocal::WriteLoadMap() { session->writeDemo->WriteInt( header.sizeofRenderLight ); for ( int i = 0; i < 256; i++ ) session->writeDemo->WriteChar( header.mapname[i] ); - + if ( r_showDemo.GetBool() ) { common->Printf( "write DC_DELETE_LIGHTDEF: %s\n", mapName.c_str() ); } @@ -334,7 +334,7 @@ void idRenderWorldLocal::WriteRenderView( const renderView_t *renderView ) { if ( this != session->rw ) { return; } - + // write the actual view command session->writeDemo->WriteInt( DS_RENDER ); session->writeDemo->WriteInt( DC_RENDERVIEW ); @@ -356,7 +356,7 @@ void idRenderWorldLocal::WriteRenderView( const renderView_t *renderView ) { for ( i = 0; i < MAX_GLOBAL_SHADER_PARMS; i++ ) session->writeDemo->WriteFloat( renderView->shaderParms[i] ); session->writeDemo->WriteInt( (int&)renderView->globalMaterial ); - + if ( r_showDemo.GetBool() ) { common->Printf( "write DC_RENDERVIEW: %i\n", renderView->time ); } @@ -531,7 +531,7 @@ void idRenderWorldLocal::WriteRenderEntity( qhandle_t handle, const renderEntity session->writeDemo->WriteInt( DS_RENDER ); session->writeDemo->WriteInt( DC_UPDATE_ENTITYDEF ); session->writeDemo->WriteInt( handle ); - + session->writeDemo->WriteInt( (int&)ent->hModel ); session->writeDemo->WriteInt( ent->entityNum ); session->writeDemo->WriteInt( ent->bodyId ); @@ -682,7 +682,7 @@ void idRenderWorldLocal::ReadRenderEntity() { ent.referenceSound = session->sw->EmitterForIndex( index ); } if ( ent.numJoints ) { - ent.joints = (idJointMat *)Mem_Alloc16( ent.numJoints * sizeof( ent.joints[0] ) ); + ent.joints = (idJointMat *)Mem_Alloc16( ent.numJoints * sizeof( ent.joints[0] ) ); for ( int i = 0; i < ent.numJoints; i++) { float *data = ent.joints[i].ToFloatPtr(); for ( int j = 0; j < 12; ++j) diff --git a/neo/renderer/RenderWorld_load.cpp b/neo/renderer/RenderWorld_load.cpp index 436e8c7b..ba2137bf 100644 --- a/neo/renderer/RenderWorld_load.cpp +++ b/neo/renderer/RenderWorld_load.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 @@ void idRenderWorldLocal::FreeWorld() { areaNodes = NULL; } - // free all the inline idRenderModels + // free all the inline idRenderModels for ( i = 0 ; i < localModels.Num() ; i++ ) { renderModelManager->RemoveModel( localModels[i] ); delete localModels[i]; @@ -291,7 +291,7 @@ void idRenderWorldLocal::ParseInterAreaPortals( idLexer *src ) { return; } - doublePortals = (doublePortal_t *)R_ClearedStaticAlloc( numInterAreaPortals * + doublePortals = (doublePortal_t *)R_ClearedStaticAlloc( numInterAreaPortals * sizeof( doublePortals [0] ) ); for ( i = 0 ; i < numInterAreaPortals ; i++ ) { diff --git a/neo/renderer/RenderWorld_local.h b/neo/renderer/RenderWorld_local.h index 6efcdc39..6960f6e2 100644 --- a/neo/renderer/RenderWorld_local.h +++ b/neo/renderer/RenderWorld_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"). @@ -232,7 +232,7 @@ public: void WriteRenderEntity( qhandle_t handle, const renderEntity_t *ent ); void ReadRenderEntity(); void ReadRenderLight(); - + //-------------------------- // RenderWorld.cpp diff --git a/neo/renderer/RenderWorld_portals.cpp b/neo/renderer/RenderWorld_portals.cpp index 56d9730e..f7ca13cb 100644 --- a/neo/renderer/RenderWorld_portals.cpp +++ b/neo/renderer/RenderWorld_portals.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"). @@ -149,7 +149,7 @@ bool idRenderWorldLocal::PortalIsFoggedOut( const portal_t *p ) { FloodViewThroughArea_r =================== */ -void idRenderWorldLocal::FloodViewThroughArea_r( const idVec3 origin, int areaNum, +void idRenderWorldLocal::FloodViewThroughArea_r( const idVec3 origin, int areaNum, const struct portalStack_s *ps ) { portal_t* p; float d; @@ -231,7 +231,7 @@ void idRenderWorldLocal::FloodViewThroughArea_r( const idVec3 origin, int areaNu // find the screen pixel bounding box of the remaining portal // so we can scissor things outside it newStack.rect = ScreenRectFromWinding( &w, &tr.identitySpace ); - + // slop might have spread it a pixel outside, so trim it back newStack.rect.Intersect( ps->rect ); @@ -325,7 +325,7 @@ void idRenderWorldLocal::FlowViewThroughPortals( const idVec3 origin, int numPla FloodLightThroughArea_r =================== */ -void idRenderWorldLocal::FloodLightThroughArea_r( idRenderLightLocal *light, int areaNum, +void idRenderWorldLocal::FloodLightThroughArea_r( idRenderLightLocal *light, int areaNum, const struct portalStack_s *ps ) { portal_t* p; float d; @@ -340,7 +340,7 @@ void idRenderWorldLocal::FloodLightThroughArea_r( idRenderLightLocal *light, int area = &portalAreas[ areaNum ]; // add an areaRef - AddLightRefToArea( light, area ); + AddLightRefToArea( light, area ); // go through all the portals for ( p = area->portals; p; p = p->next ) { @@ -585,7 +585,7 @@ bool idRenderWorldLocal::CullEntityByPortals( const idRenderEntityLocal *entity, AddAreaEntityRefs Any models that are visible through the current portalStack will -have their scissor +have their scissor =================== */ void idRenderWorldLocal::AddAreaEntityRefs( int areaNum, const portalStack_t *ps ) { @@ -614,7 +614,7 @@ void idRenderWorldLocal::AddAreaEntityRefs( int areaNum, const portalStack_t *ps && entity->parms.suppressSurfaceInViewID == tr.viewDef->renderView.viewID ) { continue; } - if ( entity->parms.allowSurfaceInViewID + if ( entity->parms.allowSurfaceInViewID && entity->parms.allowSurfaceInViewID != tr.viewDef->renderView.viewID ) { continue; } diff --git a/neo/renderer/VertexCache.cpp b/neo/renderer/VertexCache.cpp index fd25f451..5e92f39e 100644 --- a/neo/renderer/VertexCache.cpp +++ b/neo/renderer/VertexCache.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,9 +121,9 @@ void *idVertexCache::Position( vertCache_t *buffer ) { if ( buffer->vbo ) { if ( r_showVertexCache.GetInteger() == 2 ) { if ( buffer->tag == TAG_TEMP ) { - common->Printf( "GL_ARRAY_BUFFER_ARB = %i + %i (%i bytes)\n", buffer->vbo, buffer->offset, buffer->size ); + common->Printf( "GL_ARRAY_BUFFER_ARB = %i + %i (%i bytes)\n", buffer->vbo, buffer->offset, buffer->size ); } else { - common->Printf( "GL_ARRAY_BUFFER_ARB = %i (%i bytes)\n", buffer->vbo, buffer->size ); + common->Printf( "GL_ARRAY_BUFFER_ARB = %i (%i bytes)\n", buffer->vbo, buffer->size ); } } if ( buffer->indexBuffer ) { diff --git a/neo/renderer/VertexCache.h b/neo/renderer/VertexCache.h index 0d82c8ac..796c2775 100644 --- a/neo/renderer/VertexCache.h +++ b/neo/renderer/VertexCache.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"). @@ -93,7 +93,7 @@ public: // this block won't have to zero a buffer pointer when it is purged, // but it must still wait for the frames to pass, in case the GPU // is still referencing it - void Free( vertCache_t *buffer ); + void Free( vertCache_t *buffer ); // updates the counter for determining which temp space to use // and which blocks can be purged diff --git a/neo/renderer/cg_explicit.cpp b/neo/renderer/cg_explicit.cpp index baeaeac4..0b623a22 100644 --- a/neo/renderer/cg_explicit.cpp +++ b/neo/renderer/cg_explicit.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"). @@ -162,262 +162,262 @@ bool init_explicit_Cg() #else bool init_explicit_Cg() { - HMODULE hmod; - int failed = 0; - - hmod = LoadLibrary("cg.dll"); - - if(0 == (cgCreateContext = (PFNCGCREATECONTEXTPROC)GetProcAddress( hmod, "cgCreateContext" ))) - failed++; - if(0 == (cgDestroyContext = (PFNCGDESTROYCONTEXTPROC)GetProcAddress( hmod, "cgDestroyContext" ))) - failed++; - if(0 == (cgIsContext = (PFNCGISCONTEXTPROC)GetProcAddress( hmod, "cgIsContext" ))) - failed++; - if(0 == (cgGetLastListing = (PFNCGGETLASTLISTINGPROC)GetProcAddress( hmod, "cgGetLastListing" ))) - failed++; - if(0 == (cgCreateProgram = (PFNCGCREATEPROGRAMPROC)GetProcAddress( hmod, "cgCreateProgram" ))) - failed++; - if(0 == (cgCreateProgramFromFile = (PFNCGCREATEPROGRAMFROMFILEPROC)GetProcAddress( hmod, "cgCreateProgramFromFile" ))) - failed++; - if(0 == (cgCopyProgram = (PFNCGCOPYPROGRAMPROC)GetProcAddress( hmod, "cgCopyProgram" ))) - failed++; - if(0 == (cgDestroyProgram = (PFNCGDESTROYPROGRAMPROC)GetProcAddress( hmod, "cgDestroyProgram" ))) - failed++; - if(0 == (cgGetFirstProgram = (PFNCGGETFIRSTPROGRAMPROC)GetProcAddress( hmod, "cgGetFirstProgram" ))) - failed++; - if(0 == (cgGetNextProgram = (PFNCGGETNEXTPROGRAMPROC)GetProcAddress( hmod, "cgGetNextProgram" ))) - failed++; - if(0 == (cgGetProgramContext = (PFNCGGETPROGRAMCONTEXTPROC)GetProcAddress( hmod, "cgGetProgramContext" ))) - failed++; - if(0 == (cgIsProgram = (PFNCGISPROGRAMPROC)GetProcAddress( hmod, "cgIsProgram" ))) - failed++; - if(0 == (cgCompileProgram = (PFNCGCOMPILEPROGRAMPROC)GetProcAddress( hmod, "cgCompileProgram" ))) - failed++; - if(0 == (cgIsProgramCompiled = (PFNCGISPROGRAMCOMPILEDPROC)GetProcAddress( hmod, "cgIsProgramCompiled" ))) - failed++; - if(0 == (cgGetProgramString = (PFNCGGETPROGRAMSTRINGPROC)GetProcAddress( hmod, "cgGetProgramString" ))) - failed++; - if(0 == (cgGetProgramProfile = (PFNCGGETPROGRAMPROFILEPROC)GetProcAddress( hmod, "cgGetProgramProfile" ))) - failed++; - if(0 == (cgGetNamedParameter = (PFNCGGETNAMEDPARAMETERPROC)GetProcAddress( hmod, "cgGetNamedParameter" ))) - failed++; - if(0 == (cgGetFirstParameter = (PFNCGGETFIRSTPARAMETERPROC)GetProcAddress( hmod, "cgGetFirstParameter" ))) - failed++; - if(0 == (cgGetNextParameter = (PFNCGGETNEXTPARAMETERPROC)GetProcAddress( hmod, "cgGetNextParameter" ))) - failed++; - if(0 == (cgGetFirstLeafParameter = (PFNCGGETFIRSTLEAFPARAMETERPROC)GetProcAddress( hmod, "cgGetFirstLeafParameter" ))) - failed++; - if(0 == (cgGetNextLeafParameter = (PFNCGGETNEXTLEAFPARAMETERPROC)GetProcAddress( hmod, "cgGetNextLeafParameter" ))) - failed++; - if(0 == (cgGetFirstStructParameter = (PFNCGGETFIRSTSTRUCTPARAMETERPROC)GetProcAddress( hmod, "cgGetFirstStructParameter" ))) - failed++; - if(0 == (cgGetFirstDependentParameter = (PFNCGGETFIRSTDEPENDENTPARAMETERPROC)GetProcAddress( hmod, "cgGetFirstDependentParameter" ))) - failed++; - if(0 == (cgGetArrayParameter = (PFNCGGETARRAYPARAMETERPROC)GetProcAddress( hmod, "cgGetArrayParameter" ))) - failed++; - if(0 == (cgGetArrayDimension = (PFNCGGETARRAYDIMENSIONPROC)GetProcAddress( hmod, "cgGetArrayDimension" ))) - failed++; - if(0 == (cgGetArraySize = (PFNCGGETARRAYSIZEPROC)GetProcAddress( hmod, "cgGetArraySize" ))) - failed++; - if(0 == (cgGetParameterProgram = (PFNCGGETPARAMETERPROGRAMPROC)GetProcAddress( hmod, "cgGetParameterProgram" ))) - failed++; - if(0 == (cgIsParameter = (PFNCGISPARAMETERPROC)GetProcAddress( hmod, "cgIsParameter" ))) - failed++; - if(0 == (cgGetParameterName = (PFNCGGETPARAMETERNAMEPROC)GetProcAddress( hmod, "cgGetParameterName" ))) - failed++; - if(0 == (cgGetParameterType = (PFNCGGETPARAMETERTYPEPROC)GetProcAddress( hmod, "cgGetParameterType" ))) - failed++; - if(0 == (cgGetParameterSemantic = (PFNCGGETPARAMETERSEMANTICPROC)GetProcAddress( hmod, "cgGetParameterSemantic" ))) - failed++; - if(0 == (cgGetParameterResource = (PFNCGGETPARAMETERRESOURCEPROC)GetProcAddress( hmod, "cgGetParameterResource" ))) - failed++; - if(0 == (cgGetParameterBaseResource = (PFNCGGETPARAMETERBASERESOURCEPROC)GetProcAddress( hmod, "cgGetParameterBaseResource" ))) - failed++; - if(0 == (cgGetParameterResourceIndex = (PFNCGGETPARAMETERRESOURCEINDEXPROC)GetProcAddress( hmod, "cgGetParameterResourceIndex" ))) - failed++; - if(0 == (cgGetParameterVariability = (PFNCGGETPARAMETERVARIABILITYPROC)GetProcAddress( hmod, "cgGetParameterVariability" ))) - failed++; - if(0 == (cgGetParameterDirection = (PFNCGGETPARAMETERDIRECTIONPROC)GetProcAddress( hmod, "cgGetParameterDirection" ))) - failed++; - if(0 == (cgIsParameterReferenced = (PFNCGISPARAMETERREFERENCEDPROC)GetProcAddress( hmod, "cgIsParameterReferenced" ))) - failed++; - if(0 == (cgGetParameterValues = (PFNCGGETPARAMETERVALUESPROC)GetProcAddress( hmod, "cgGetParameterValues" ))) - failed++; - if(0 == (cgGetTypeString = (PFNCGGETTYPESTRINGPROC)GetProcAddress( hmod, "cgGetTypeString" ))) - failed++; - if(0 == (cgGetType = (PFNCGGETTYPEPROC)GetProcAddress( hmod, "cgGetType" ))) - failed++; - if(0 == (cgGetResourceString = (PFNCGGETRESOURCESTRINGPROC)GetProcAddress( hmod, "cgGetResourceString" ))) - failed++; - if(0 == (cgGetResource = (PFNCGGETRESOURCEPROC)GetProcAddress( hmod, "cgGetResource" ))) - failed++; - if(0 == (cgGetProfileString = (PFNCGGETPROFILESTRINGPROC)GetProcAddress( hmod, "cgGetProfileString" ))) - failed++; - if(0 == (cgGetProfile = (PFNCGGETPROFILEPROC)GetProcAddress( hmod, "cgGetProfile" ))) - failed++; - if(0 == (cgGetError = (PFNCGGETERRORPROC)GetProcAddress( hmod, "cgGetError" ))) - failed++; - if(0 == (cgGetErrorString = (PFNCGGETERRORSTRINGPROC)GetProcAddress( hmod, "cgGetErrorString" ))) - failed++; - if(0 == (cgSetErrorCallback = (PFNCGSETERRORCALLBACKPROC)GetProcAddress( hmod, "cgSetErrorCallback" ))) - failed++; - if(0 == (cgGetErrorCallback = (PFNCGGETERRORCALLBACKPROC)GetProcAddress( hmod, "cgGetErrorCallback" ))) - failed++; + HMODULE hmod; + int failed = 0; - - - hmod = LoadLibrary("cgGL.dll"); + hmod = LoadLibrary("cg.dll"); + + if(0 == (cgCreateContext = (PFNCGCREATECONTEXTPROC)GetProcAddress( hmod, "cgCreateContext" ))) + failed++; + if(0 == (cgDestroyContext = (PFNCGDESTROYCONTEXTPROC)GetProcAddress( hmod, "cgDestroyContext" ))) + failed++; + if(0 == (cgIsContext = (PFNCGISCONTEXTPROC)GetProcAddress( hmod, "cgIsContext" ))) + failed++; + if(0 == (cgGetLastListing = (PFNCGGETLASTLISTINGPROC)GetProcAddress( hmod, "cgGetLastListing" ))) + failed++; + if(0 == (cgCreateProgram = (PFNCGCREATEPROGRAMPROC)GetProcAddress( hmod, "cgCreateProgram" ))) + failed++; + if(0 == (cgCreateProgramFromFile = (PFNCGCREATEPROGRAMFROMFILEPROC)GetProcAddress( hmod, "cgCreateProgramFromFile" ))) + failed++; + if(0 == (cgCopyProgram = (PFNCGCOPYPROGRAMPROC)GetProcAddress( hmod, "cgCopyProgram" ))) + failed++; + if(0 == (cgDestroyProgram = (PFNCGDESTROYPROGRAMPROC)GetProcAddress( hmod, "cgDestroyProgram" ))) + failed++; + if(0 == (cgGetFirstProgram = (PFNCGGETFIRSTPROGRAMPROC)GetProcAddress( hmod, "cgGetFirstProgram" ))) + failed++; + if(0 == (cgGetNextProgram = (PFNCGGETNEXTPROGRAMPROC)GetProcAddress( hmod, "cgGetNextProgram" ))) + failed++; + if(0 == (cgGetProgramContext = (PFNCGGETPROGRAMCONTEXTPROC)GetProcAddress( hmod, "cgGetProgramContext" ))) + failed++; + if(0 == (cgIsProgram = (PFNCGISPROGRAMPROC)GetProcAddress( hmod, "cgIsProgram" ))) + failed++; + if(0 == (cgCompileProgram = (PFNCGCOMPILEPROGRAMPROC)GetProcAddress( hmod, "cgCompileProgram" ))) + failed++; + if(0 == (cgIsProgramCompiled = (PFNCGISPROGRAMCOMPILEDPROC)GetProcAddress( hmod, "cgIsProgramCompiled" ))) + failed++; + if(0 == (cgGetProgramString = (PFNCGGETPROGRAMSTRINGPROC)GetProcAddress( hmod, "cgGetProgramString" ))) + failed++; + if(0 == (cgGetProgramProfile = (PFNCGGETPROGRAMPROFILEPROC)GetProcAddress( hmod, "cgGetProgramProfile" ))) + failed++; + if(0 == (cgGetNamedParameter = (PFNCGGETNAMEDPARAMETERPROC)GetProcAddress( hmod, "cgGetNamedParameter" ))) + failed++; + if(0 == (cgGetFirstParameter = (PFNCGGETFIRSTPARAMETERPROC)GetProcAddress( hmod, "cgGetFirstParameter" ))) + failed++; + if(0 == (cgGetNextParameter = (PFNCGGETNEXTPARAMETERPROC)GetProcAddress( hmod, "cgGetNextParameter" ))) + failed++; + if(0 == (cgGetFirstLeafParameter = (PFNCGGETFIRSTLEAFPARAMETERPROC)GetProcAddress( hmod, "cgGetFirstLeafParameter" ))) + failed++; + if(0 == (cgGetNextLeafParameter = (PFNCGGETNEXTLEAFPARAMETERPROC)GetProcAddress( hmod, "cgGetNextLeafParameter" ))) + failed++; + if(0 == (cgGetFirstStructParameter = (PFNCGGETFIRSTSTRUCTPARAMETERPROC)GetProcAddress( hmod, "cgGetFirstStructParameter" ))) + failed++; + if(0 == (cgGetFirstDependentParameter = (PFNCGGETFIRSTDEPENDENTPARAMETERPROC)GetProcAddress( hmod, "cgGetFirstDependentParameter" ))) + failed++; + if(0 == (cgGetArrayParameter = (PFNCGGETARRAYPARAMETERPROC)GetProcAddress( hmod, "cgGetArrayParameter" ))) + failed++; + if(0 == (cgGetArrayDimension = (PFNCGGETARRAYDIMENSIONPROC)GetProcAddress( hmod, "cgGetArrayDimension" ))) + failed++; + if(0 == (cgGetArraySize = (PFNCGGETARRAYSIZEPROC)GetProcAddress( hmod, "cgGetArraySize" ))) + failed++; + if(0 == (cgGetParameterProgram = (PFNCGGETPARAMETERPROGRAMPROC)GetProcAddress( hmod, "cgGetParameterProgram" ))) + failed++; + if(0 == (cgIsParameter = (PFNCGISPARAMETERPROC)GetProcAddress( hmod, "cgIsParameter" ))) + failed++; + if(0 == (cgGetParameterName = (PFNCGGETPARAMETERNAMEPROC)GetProcAddress( hmod, "cgGetParameterName" ))) + failed++; + if(0 == (cgGetParameterType = (PFNCGGETPARAMETERTYPEPROC)GetProcAddress( hmod, "cgGetParameterType" ))) + failed++; + if(0 == (cgGetParameterSemantic = (PFNCGGETPARAMETERSEMANTICPROC)GetProcAddress( hmod, "cgGetParameterSemantic" ))) + failed++; + if(0 == (cgGetParameterResource = (PFNCGGETPARAMETERRESOURCEPROC)GetProcAddress( hmod, "cgGetParameterResource" ))) + failed++; + if(0 == (cgGetParameterBaseResource = (PFNCGGETPARAMETERBASERESOURCEPROC)GetProcAddress( hmod, "cgGetParameterBaseResource" ))) + failed++; + if(0 == (cgGetParameterResourceIndex = (PFNCGGETPARAMETERRESOURCEINDEXPROC)GetProcAddress( hmod, "cgGetParameterResourceIndex" ))) + failed++; + if(0 == (cgGetParameterVariability = (PFNCGGETPARAMETERVARIABILITYPROC)GetProcAddress( hmod, "cgGetParameterVariability" ))) + failed++; + if(0 == (cgGetParameterDirection = (PFNCGGETPARAMETERDIRECTIONPROC)GetProcAddress( hmod, "cgGetParameterDirection" ))) + failed++; + if(0 == (cgIsParameterReferenced = (PFNCGISPARAMETERREFERENCEDPROC)GetProcAddress( hmod, "cgIsParameterReferenced" ))) + failed++; + if(0 == (cgGetParameterValues = (PFNCGGETPARAMETERVALUESPROC)GetProcAddress( hmod, "cgGetParameterValues" ))) + failed++; + if(0 == (cgGetTypeString = (PFNCGGETTYPESTRINGPROC)GetProcAddress( hmod, "cgGetTypeString" ))) + failed++; + if(0 == (cgGetType = (PFNCGGETTYPEPROC)GetProcAddress( hmod, "cgGetType" ))) + failed++; + if(0 == (cgGetResourceString = (PFNCGGETRESOURCESTRINGPROC)GetProcAddress( hmod, "cgGetResourceString" ))) + failed++; + if(0 == (cgGetResource = (PFNCGGETRESOURCEPROC)GetProcAddress( hmod, "cgGetResource" ))) + failed++; + if(0 == (cgGetProfileString = (PFNCGGETPROFILESTRINGPROC)GetProcAddress( hmod, "cgGetProfileString" ))) + failed++; + if(0 == (cgGetProfile = (PFNCGGETPROFILEPROC)GetProcAddress( hmod, "cgGetProfile" ))) + failed++; + if(0 == (cgGetError = (PFNCGGETERRORPROC)GetProcAddress( hmod, "cgGetError" ))) + failed++; + if(0 == (cgGetErrorString = (PFNCGGETERRORSTRINGPROC)GetProcAddress( hmod, "cgGetErrorString" ))) + failed++; + if(0 == (cgSetErrorCallback = (PFNCGSETERRORCALLBACKPROC)GetProcAddress( hmod, "cgSetErrorCallback" ))) + failed++; + if(0 == (cgGetErrorCallback = (PFNCGGETERRORCALLBACKPROC)GetProcAddress( hmod, "cgGetErrorCallback" ))) + failed++; + + + + hmod = LoadLibrary("cgGL.dll"); + + + + if(0 == (cgGLIsProfileSupported = (PFNCGGLISPROFILESUPPORTEDPROC)GetProcAddress( hmod, "cgGLIsProfileSupported" ))) + failed++; + if(0 == (cgGLEnableProfile = (PFNCGGLENABLEPROFILEPROC)GetProcAddress( hmod, "cgGLEnableProfile" ))) + failed++; + if(0 == (cgGLDisableProfile = (PFNCGGLDISABLEPROFILEPROC)GetProcAddress( hmod, "cgGLDisableProfile" ))) + failed++; + if(0 == (cgGLGetLatestProfile = (PFNCGGLGETLATESTPROFILEPROC)GetProcAddress( hmod, "cgGLGetLatestProfile" ))) + failed++; + if(0 == (cgGLSetOptimalOptions = (PFNCGGLSETOPTIMALOPTIONSPROC)GetProcAddress( hmod, "cgGLSetOptimalOptions" ))) + failed++; + if(0 == (cgGLLoadProgram = (PFNCGGLLOADPROGRAMPROC)GetProcAddress( hmod, "cgGLLoadProgram" ))) + failed++; + if(0 == (cgGLBindProgram = (PFNCGGLBINDPROGRAMPROC)GetProcAddress( hmod, "cgGLBindProgram" ))) + failed++; + if(0 == (cgGLSetParameter1f = (PFNCGGLSETPARAMETER1FPROC)GetProcAddress( hmod, "cgGLSetParameter1f" ))) + failed++; + if(0 == (cgGLSetParameter2f = (PFNCGGLSETPARAMETER2FPROC)GetProcAddress( hmod, "cgGLSetParameter2f" ))) + failed++; + if(0 == (cgGLSetParameter3f = (PFNCGGLSETPARAMETER3FPROC)GetProcAddress( hmod, "cgGLSetParameter3f" ))) + failed++; + if(0 == (cgGLSetParameter4f = (PFNCGGLSETPARAMETER4FPROC)GetProcAddress( hmod, "cgGLSetParameter4f" ))) + failed++; + if(0 == (cgGLSetParameter1fv = (PFNCGGLSETPARAMETER1FVPROC)GetProcAddress( hmod, "cgGLSetParameter1fv" ))) + failed++; + if(0 == (cgGLSetParameter2fv = (PFNCGGLSETPARAMETER2FVPROC)GetProcAddress( hmod, "cgGLSetParameter2fv" ))) + failed++; + if(0 == (cgGLSetParameter3fv = (PFNCGGLSETPARAMETER3FVPROC)GetProcAddress( hmod, "cgGLSetParameter3fv" ))) + failed++; + if(0 == (cgGLSetParameter4fv = (PFNCGGLSETPARAMETER4FVPROC)GetProcAddress( hmod, "cgGLSetParameter4fv" ))) + failed++; + if(0 == (cgGLSetParameter1d = (PFNCGGLSETPARAMETER1DPROC)GetProcAddress( hmod, "cgGLSetParameter1d" ))) + failed++; + if(0 == (cgGLSetParameter2d = (PFNCGGLSETPARAMETER2DPROC)GetProcAddress( hmod, "cgGLSetParameter2d" ))) + failed++; + if(0 == (cgGLSetParameter3d = (PFNCGGLSETPARAMETER3DPROC)GetProcAddress( hmod, "cgGLSetParameter3d" ))) + failed++; + if(0 == (cgGLSetParameter4d = (PFNCGGLSETPARAMETER4DPROC)GetProcAddress( hmod, "cgGLSetParameter4d" ))) + failed++; + if(0 == (cgGLSetParameter1dv = (PFNCGGLSETPARAMETER1DVPROC)GetProcAddress( hmod, "cgGLSetParameter1dv" ))) + failed++; + if(0 == (cgGLSetParameter2dv = (PFNCGGLSETPARAMETER2DVPROC)GetProcAddress( hmod, "cgGLSetParameter2dv" ))) + failed++; + if(0 == (cgGLSetParameter3dv = (PFNCGGLSETPARAMETER3DVPROC)GetProcAddress( hmod, "cgGLSetParameter3dv" ))) + failed++; + if(0 == (cgGLSetParameter4dv = (PFNCGGLSETPARAMETER4DVPROC)GetProcAddress( hmod, "cgGLSetParameter4dv" ))) + failed++; + if(0 == (cgGLSetParameter4dv = (PFNCGGLSETPARAMETER4DVPROC)GetProcAddress( hmod, "cgGLSetParameter4dv" ))) + failed++; + if(0 == (cgGLGetParameter1f = (PFNCGGLGETPARAMETER1FPROC)GetProcAddress( hmod, "cgGLGetParameter1f" ))) + failed++; + if(0 == (cgGLGetParameter2f = (PFNCGGLGETPARAMETER2FPROC)GetProcAddress( hmod, "cgGLGetParameter2f" ))) + failed++; + if(0 == (cgGLGetParameter3f = (PFNCGGLGETPARAMETER3FPROC)GetProcAddress( hmod, "cgGLGetParameter3f" ))) + failed++; + if(0 == (cgGLGetParameter4f = (PFNCGGLGETPARAMETER4FPROC)GetProcAddress( hmod, "cgGLGetParameter4f" ))) + failed++; + if(0 == (cgGLGetParameter1d = (PFNCGGLGETPARAMETER1DPROC)GetProcAddress( hmod, "cgGLGetParameter1d" ))) + failed++; + if(0 == (cgGLGetParameter2d = (PFNCGGLGETPARAMETER2DPROC)GetProcAddress( hmod, "cgGLGetParameter2d" ))) + failed++; + if(0 == (cgGLGetParameter3d = (PFNCGGLGETPARAMETER3DPROC)GetProcAddress( hmod, "cgGLGetParameter3d" ))) + failed++; + if(0 == (cgGLGetParameter4d = (PFNCGGLGETPARAMETER4DPROC)GetProcAddress( hmod, "cgGLGetParameter4d" ))) + failed++; + if(0 == (cgGLSetParameterArray1f = (PFNCGGLSETPARAMETERARRAY1FPROC)GetProcAddress( hmod, "cgGLSetParameterArray1f" ))) + failed++; + if(0 == (cgGLSetParameterArray2f = (PFNCGGLSETPARAMETERARRAY2FPROC)GetProcAddress( hmod, "cgGLSetParameterArray2f" ))) + failed++; + if(0 == (cgGLSetParameterArray3f = (PFNCGGLSETPARAMETERARRAY3FPROC)GetProcAddress( hmod, "cgGLSetParameterArray3f" ))) + failed++; + if(0 == (cgGLSetParameterArray4f = (PFNCGGLSETPARAMETERARRAY4FPROC)GetProcAddress( hmod, "cgGLSetParameterArray4f" ))) + failed++; + if(0 == (cgGLSetParameterArray1d = (PFNCGGLSETPARAMETERARRAY1DPROC)GetProcAddress( hmod, "cgGLSetParameterArray1d" ))) + failed++; + if(0 == (cgGLSetParameterArray2d = (PFNCGGLSETPARAMETERARRAY2DPROC)GetProcAddress( hmod, "cgGLSetParameterArray2d" ))) + failed++; + if(0 == (cgGLSetParameterArray3d = (PFNCGGLSETPARAMETERARRAY3DPROC)GetProcAddress( hmod, "cgGLSetParameterArray3d" ))) + failed++; + if(0 == (cgGLSetParameterArray4d = (PFNCGGLSETPARAMETERARRAY4DPROC)GetProcAddress( hmod, "cgGLSetParameterArray4d" ))) + failed++; + if(0 == (cgGLGetParameterArray1f = (PFNCGGLGETPARAMETERARRAY1FPROC)GetProcAddress( hmod, "cgGLGetParameterArray1f" ))) + failed++; + if(0 == (cgGLGetParameterArray2f = (PFNCGGLGETPARAMETERARRAY2FPROC)GetProcAddress( hmod, "cgGLGetParameterArray2f" ))) + failed++; + if(0 == (cgGLGetParameterArray3f = (PFNCGGLGETPARAMETERARRAY3FPROC)GetProcAddress( hmod, "cgGLGetParameterArray3f" ))) + failed++; + if(0 == (cgGLGetParameterArray4f = (PFNCGGLGETPARAMETERARRAY4FPROC)GetProcAddress( hmod, "cgGLGetParameterArray4f" ))) + failed++; + if(0 == (cgGLGetParameterArray1d = (PFNCGGLGETPARAMETERARRAY1DPROC)GetProcAddress( hmod, "cgGLGetParameterArray1d" ))) + failed++; + if(0 == (cgGLGetParameterArray2d = (PFNCGGLGETPARAMETERARRAY2DPROC)GetProcAddress( hmod, "cgGLGetParameterArray2d" ))) + failed++; + if(0 == (cgGLGetParameterArray3d = (PFNCGGLGETPARAMETERARRAY3DPROC)GetProcAddress( hmod, "cgGLGetParameterArray3d" ))) + failed++; + if(0 == (cgGLGetParameterArray4d = (PFNCGGLGETPARAMETERARRAY4DPROC)GetProcAddress( hmod, "cgGLGetParameterArray4d" ))) + failed++; + if(0 == (cgGLSetParameterPointer = (PFNCGGLSETPARAMETERPOINTERPROC)GetProcAddress( hmod, "cgGLSetParameterPointer" ))) + failed++; + if(0 == (cgGLEnableClientState = (PFNCGGLENABLECLIENTSTATEPROC)GetProcAddress( hmod, "cgGLEnableClientState" ))) + failed++; + if(0 == (cgGLDisableClientState = (PFNCGGLDISABLECLIENTSTATEPROC)GetProcAddress( hmod, "cgGLDisableClientState" ))) + failed++; + if(0 == (cgGLSetMatrixParameterdr = (PFNCGGLSETMATRIXPARAMETERDRPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterdr" ))) + failed++; + if(0 == (cgGLSetMatrixParameterfr = (PFNCGGLSETMATRIXPARAMETERFRPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterfr" ))) + failed++; + if(0 == (cgGLSetMatrixParameterdc = (PFNCGGLSETMATRIXPARAMETERDCPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterdc" ))) + failed++; + if(0 == (cgGLSetMatrixParameterfc = (PFNCGGLSETMATRIXPARAMETERFCPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterfc" ))) + failed++; + if(0 == (cgGLGetMatrixParameterdr = (PFNCGGLGETMATRIXPARAMETERDRPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterdr" ))) + failed++; + if(0 == (cgGLGetMatrixParameterfr = (PFNCGGLGETMATRIXPARAMETERFRPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterfr" ))) + failed++; + if(0 == (cgGLGetMatrixParameterdc = (PFNCGGLGETMATRIXPARAMETERDCPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterdc" ))) + failed++; + if(0 == (cgGLGetMatrixParameterfc = (PFNCGGLGETMATRIXPARAMETERFCPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterfc" ))) + failed++; + if(0 == (cgGLSetStateMatrixParameter = (PFNCGGLSETSTATEMATRIXPARAMETERPROC)GetProcAddress( hmod, "cgGLSetStateMatrixParameter" ))) + failed++; + //if(0 == (cgGLSetMatrixParameterArrayfc = (PFNCGGLSETMATRIXPARAMETERARRAYFCPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterArrayfc" ))) + // failed++; + //if(0 == (cgGLSetMatrixParameterArrayfr = (PFNCGGLSETMATRIXPARAMETERARRAYFRPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterArrayfr" ))) + // failed++; + //if(0 == (cgGLSetMatrixParameterArraydc = (PFNCGGLSETMATRIXPARAMETERARRAYDCPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterArraydc" ))) + // failed++; + //if(0 == (cgGLSetMatrixParameterArraydr = (PFNCGGLSETMATRIXPARAMETERARRAYDRPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterArraydr" ))) + // failed++; + //if(0 == (cgGLGetMatrixParameterArrayfc = (PFNCGGLGETMATRIXPARAMETERARRAYFCPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterArrayfc" ))) + // failed++; + //if(0 == (cgGLGetMatrixParameterArrayfr = (PFNCGGLGETMATRIXPARAMETERARRAYFRPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterArrayfr" ))) + // failed++; + //if(0 == (cgGLGetMatrixParameterArraydc = (PFNCGGLGETMATRIXPARAMETERARRAYDCPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterArraydc" ))) + // failed++; + //if(0 == (cgGLGetMatrixParameterArraydr = (PFNCGGLGETMATRIXPARAMETERARRAYDRPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterArraydr" ))) + // failed++; + if(0 == (cgGLSetTextureParameter = (PFNCGGLSETTEXTUREPARAMETERPROC)GetProcAddress( hmod, "cgGLSetTextureParameter" ))) + failed++; + if(0 == (cgGLGetTextureParameter = (PFNCGGLGETTEXTUREPARAMETERPROC)GetProcAddress( hmod, "cgGLGetTextureParameter" ))) + failed++; + if(0 == (cgGLEnableTextureParameter = (PFNCGGLENABLETEXTUREPARAMETERPROC)GetProcAddress( hmod, "cgGLEnableTextureParameter" ))) + failed++; + if(0 == (cgGLDisableTextureParameter = (PFNCGGLDISABLETEXTUREPARAMETERPROC)GetProcAddress( hmod, "cgGLDisableTextureParameter" ))) + failed++; + if(0 == (cgGLGetTextureEnum = (PFNCGGLGETTEXTUREENUMPROC)GetProcAddress( hmod, "cgGLGetTextureEnum" ))) + failed++; + + return failed == 0; - - - if(0 == (cgGLIsProfileSupported = (PFNCGGLISPROFILESUPPORTEDPROC)GetProcAddress( hmod, "cgGLIsProfileSupported" ))) - failed++; - if(0 == (cgGLEnableProfile = (PFNCGGLENABLEPROFILEPROC)GetProcAddress( hmod, "cgGLEnableProfile" ))) - failed++; - if(0 == (cgGLDisableProfile = (PFNCGGLDISABLEPROFILEPROC)GetProcAddress( hmod, "cgGLDisableProfile" ))) - failed++; - if(0 == (cgGLGetLatestProfile = (PFNCGGLGETLATESTPROFILEPROC)GetProcAddress( hmod, "cgGLGetLatestProfile" ))) - failed++; - if(0 == (cgGLSetOptimalOptions = (PFNCGGLSETOPTIMALOPTIONSPROC)GetProcAddress( hmod, "cgGLSetOptimalOptions" ))) - failed++; - if(0 == (cgGLLoadProgram = (PFNCGGLLOADPROGRAMPROC)GetProcAddress( hmod, "cgGLLoadProgram" ))) - failed++; - if(0 == (cgGLBindProgram = (PFNCGGLBINDPROGRAMPROC)GetProcAddress( hmod, "cgGLBindProgram" ))) - failed++; - if(0 == (cgGLSetParameter1f = (PFNCGGLSETPARAMETER1FPROC)GetProcAddress( hmod, "cgGLSetParameter1f" ))) - failed++; - if(0 == (cgGLSetParameter2f = (PFNCGGLSETPARAMETER2FPROC)GetProcAddress( hmod, "cgGLSetParameter2f" ))) - failed++; - if(0 == (cgGLSetParameter3f = (PFNCGGLSETPARAMETER3FPROC)GetProcAddress( hmod, "cgGLSetParameter3f" ))) - failed++; - if(0 == (cgGLSetParameter4f = (PFNCGGLSETPARAMETER4FPROC)GetProcAddress( hmod, "cgGLSetParameter4f" ))) - failed++; - if(0 == (cgGLSetParameter1fv = (PFNCGGLSETPARAMETER1FVPROC)GetProcAddress( hmod, "cgGLSetParameter1fv" ))) - failed++; - if(0 == (cgGLSetParameter2fv = (PFNCGGLSETPARAMETER2FVPROC)GetProcAddress( hmod, "cgGLSetParameter2fv" ))) - failed++; - if(0 == (cgGLSetParameter3fv = (PFNCGGLSETPARAMETER3FVPROC)GetProcAddress( hmod, "cgGLSetParameter3fv" ))) - failed++; - if(0 == (cgGLSetParameter4fv = (PFNCGGLSETPARAMETER4FVPROC)GetProcAddress( hmod, "cgGLSetParameter4fv" ))) - failed++; - if(0 == (cgGLSetParameter1d = (PFNCGGLSETPARAMETER1DPROC)GetProcAddress( hmod, "cgGLSetParameter1d" ))) - failed++; - if(0 == (cgGLSetParameter2d = (PFNCGGLSETPARAMETER2DPROC)GetProcAddress( hmod, "cgGLSetParameter2d" ))) - failed++; - if(0 == (cgGLSetParameter3d = (PFNCGGLSETPARAMETER3DPROC)GetProcAddress( hmod, "cgGLSetParameter3d" ))) - failed++; - if(0 == (cgGLSetParameter4d = (PFNCGGLSETPARAMETER4DPROC)GetProcAddress( hmod, "cgGLSetParameter4d" ))) - failed++; - if(0 == (cgGLSetParameter1dv = (PFNCGGLSETPARAMETER1DVPROC)GetProcAddress( hmod, "cgGLSetParameter1dv" ))) - failed++; - if(0 == (cgGLSetParameter2dv = (PFNCGGLSETPARAMETER2DVPROC)GetProcAddress( hmod, "cgGLSetParameter2dv" ))) - failed++; - if(0 == (cgGLSetParameter3dv = (PFNCGGLSETPARAMETER3DVPROC)GetProcAddress( hmod, "cgGLSetParameter3dv" ))) - failed++; - if(0 == (cgGLSetParameter4dv = (PFNCGGLSETPARAMETER4DVPROC)GetProcAddress( hmod, "cgGLSetParameter4dv" ))) - failed++; - if(0 == (cgGLSetParameter4dv = (PFNCGGLSETPARAMETER4DVPROC)GetProcAddress( hmod, "cgGLSetParameter4dv" ))) - failed++; - if(0 == (cgGLGetParameter1f = (PFNCGGLGETPARAMETER1FPROC)GetProcAddress( hmod, "cgGLGetParameter1f" ))) - failed++; - if(0 == (cgGLGetParameter2f = (PFNCGGLGETPARAMETER2FPROC)GetProcAddress( hmod, "cgGLGetParameter2f" ))) - failed++; - if(0 == (cgGLGetParameter3f = (PFNCGGLGETPARAMETER3FPROC)GetProcAddress( hmod, "cgGLGetParameter3f" ))) - failed++; - if(0 == (cgGLGetParameter4f = (PFNCGGLGETPARAMETER4FPROC)GetProcAddress( hmod, "cgGLGetParameter4f" ))) - failed++; - if(0 == (cgGLGetParameter1d = (PFNCGGLGETPARAMETER1DPROC)GetProcAddress( hmod, "cgGLGetParameter1d" ))) - failed++; - if(0 == (cgGLGetParameter2d = (PFNCGGLGETPARAMETER2DPROC)GetProcAddress( hmod, "cgGLGetParameter2d" ))) - failed++; - if(0 == (cgGLGetParameter3d = (PFNCGGLGETPARAMETER3DPROC)GetProcAddress( hmod, "cgGLGetParameter3d" ))) - failed++; - if(0 == (cgGLGetParameter4d = (PFNCGGLGETPARAMETER4DPROC)GetProcAddress( hmod, "cgGLGetParameter4d" ))) - failed++; - if(0 == (cgGLSetParameterArray1f = (PFNCGGLSETPARAMETERARRAY1FPROC)GetProcAddress( hmod, "cgGLSetParameterArray1f" ))) - failed++; - if(0 == (cgGLSetParameterArray2f = (PFNCGGLSETPARAMETERARRAY2FPROC)GetProcAddress( hmod, "cgGLSetParameterArray2f" ))) - failed++; - if(0 == (cgGLSetParameterArray3f = (PFNCGGLSETPARAMETERARRAY3FPROC)GetProcAddress( hmod, "cgGLSetParameterArray3f" ))) - failed++; - if(0 == (cgGLSetParameterArray4f = (PFNCGGLSETPARAMETERARRAY4FPROC)GetProcAddress( hmod, "cgGLSetParameterArray4f" ))) - failed++; - if(0 == (cgGLSetParameterArray1d = (PFNCGGLSETPARAMETERARRAY1DPROC)GetProcAddress( hmod, "cgGLSetParameterArray1d" ))) - failed++; - if(0 == (cgGLSetParameterArray2d = (PFNCGGLSETPARAMETERARRAY2DPROC)GetProcAddress( hmod, "cgGLSetParameterArray2d" ))) - failed++; - if(0 == (cgGLSetParameterArray3d = (PFNCGGLSETPARAMETERARRAY3DPROC)GetProcAddress( hmod, "cgGLSetParameterArray3d" ))) - failed++; - if(0 == (cgGLSetParameterArray4d = (PFNCGGLSETPARAMETERARRAY4DPROC)GetProcAddress( hmod, "cgGLSetParameterArray4d" ))) - failed++; - if(0 == (cgGLGetParameterArray1f = (PFNCGGLGETPARAMETERARRAY1FPROC)GetProcAddress( hmod, "cgGLGetParameterArray1f" ))) - failed++; - if(0 == (cgGLGetParameterArray2f = (PFNCGGLGETPARAMETERARRAY2FPROC)GetProcAddress( hmod, "cgGLGetParameterArray2f" ))) - failed++; - if(0 == (cgGLGetParameterArray3f = (PFNCGGLGETPARAMETERARRAY3FPROC)GetProcAddress( hmod, "cgGLGetParameterArray3f" ))) - failed++; - if(0 == (cgGLGetParameterArray4f = (PFNCGGLGETPARAMETERARRAY4FPROC)GetProcAddress( hmod, "cgGLGetParameterArray4f" ))) - failed++; - if(0 == (cgGLGetParameterArray1d = (PFNCGGLGETPARAMETERARRAY1DPROC)GetProcAddress( hmod, "cgGLGetParameterArray1d" ))) - failed++; - if(0 == (cgGLGetParameterArray2d = (PFNCGGLGETPARAMETERARRAY2DPROC)GetProcAddress( hmod, "cgGLGetParameterArray2d" ))) - failed++; - if(0 == (cgGLGetParameterArray3d = (PFNCGGLGETPARAMETERARRAY3DPROC)GetProcAddress( hmod, "cgGLGetParameterArray3d" ))) - failed++; - if(0 == (cgGLGetParameterArray4d = (PFNCGGLGETPARAMETERARRAY4DPROC)GetProcAddress( hmod, "cgGLGetParameterArray4d" ))) - failed++; - if(0 == (cgGLSetParameterPointer = (PFNCGGLSETPARAMETERPOINTERPROC)GetProcAddress( hmod, "cgGLSetParameterPointer" ))) - failed++; - if(0 == (cgGLEnableClientState = (PFNCGGLENABLECLIENTSTATEPROC)GetProcAddress( hmod, "cgGLEnableClientState" ))) - failed++; - if(0 == (cgGLDisableClientState = (PFNCGGLDISABLECLIENTSTATEPROC)GetProcAddress( hmod, "cgGLDisableClientState" ))) - failed++; - if(0 == (cgGLSetMatrixParameterdr = (PFNCGGLSETMATRIXPARAMETERDRPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterdr" ))) - failed++; - if(0 == (cgGLSetMatrixParameterfr = (PFNCGGLSETMATRIXPARAMETERFRPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterfr" ))) - failed++; - if(0 == (cgGLSetMatrixParameterdc = (PFNCGGLSETMATRIXPARAMETERDCPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterdc" ))) - failed++; - if(0 == (cgGLSetMatrixParameterfc = (PFNCGGLSETMATRIXPARAMETERFCPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterfc" ))) - failed++; - if(0 == (cgGLGetMatrixParameterdr = (PFNCGGLGETMATRIXPARAMETERDRPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterdr" ))) - failed++; - if(0 == (cgGLGetMatrixParameterfr = (PFNCGGLGETMATRIXPARAMETERFRPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterfr" ))) - failed++; - if(0 == (cgGLGetMatrixParameterdc = (PFNCGGLGETMATRIXPARAMETERDCPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterdc" ))) - failed++; - if(0 == (cgGLGetMatrixParameterfc = (PFNCGGLGETMATRIXPARAMETERFCPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterfc" ))) - failed++; - if(0 == (cgGLSetStateMatrixParameter = (PFNCGGLSETSTATEMATRIXPARAMETERPROC)GetProcAddress( hmod, "cgGLSetStateMatrixParameter" ))) - failed++; - //if(0 == (cgGLSetMatrixParameterArrayfc = (PFNCGGLSETMATRIXPARAMETERARRAYFCPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterArrayfc" ))) - // failed++; - //if(0 == (cgGLSetMatrixParameterArrayfr = (PFNCGGLSETMATRIXPARAMETERARRAYFRPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterArrayfr" ))) - // failed++; - //if(0 == (cgGLSetMatrixParameterArraydc = (PFNCGGLSETMATRIXPARAMETERARRAYDCPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterArraydc" ))) - // failed++; - //if(0 == (cgGLSetMatrixParameterArraydr = (PFNCGGLSETMATRIXPARAMETERARRAYDRPROC)GetProcAddress( hmod, "cgGLSetMatrixParameterArraydr" ))) - // failed++; - //if(0 == (cgGLGetMatrixParameterArrayfc = (PFNCGGLGETMATRIXPARAMETERARRAYFCPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterArrayfc" ))) - // failed++; - //if(0 == (cgGLGetMatrixParameterArrayfr = (PFNCGGLGETMATRIXPARAMETERARRAYFRPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterArrayfr" ))) - // failed++; - //if(0 == (cgGLGetMatrixParameterArraydc = (PFNCGGLGETMATRIXPARAMETERARRAYDCPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterArraydc" ))) - // failed++; - //if(0 == (cgGLGetMatrixParameterArraydr = (PFNCGGLGETMATRIXPARAMETERARRAYDRPROC)GetProcAddress( hmod, "cgGLGetMatrixParameterArraydr" ))) - // failed++; - if(0 == (cgGLSetTextureParameter = (PFNCGGLSETTEXTUREPARAMETERPROC)GetProcAddress( hmod, "cgGLSetTextureParameter" ))) - failed++; - if(0 == (cgGLGetTextureParameter = (PFNCGGLGETTEXTUREPARAMETERPROC)GetProcAddress( hmod, "cgGLGetTextureParameter" ))) - failed++; - if(0 == (cgGLEnableTextureParameter = (PFNCGGLENABLETEXTUREPARAMETERPROC)GetProcAddress( hmod, "cgGLEnableTextureParameter" ))) - failed++; - if(0 == (cgGLDisableTextureParameter = (PFNCGGLDISABLETEXTUREPARAMETERPROC)GetProcAddress( hmod, "cgGLDisableTextureParameter" ))) - failed++; - if(0 == (cgGLGetTextureEnum = (PFNCGGLGETTEXTUREENUMPROC)GetProcAddress( hmod, "cgGLGetTextureEnum" ))) - failed++; - - return failed == 0; - } #endif diff --git a/neo/renderer/cg_explicit.h b/neo/renderer/cg_explicit.h index c37388df..d066d932 100644 --- a/neo/renderer/cg_explicit.h +++ b/neo/renderer/cg_explicit.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"). @@ -39,828 +39,827 @@ typedef struct _CGparameter *CGparameter; typedef enum { - CG_UNKNOWN_TYPE, - CG_STRUCT, - CG_ARRAY, - - CG_TYPE_START_ENUM = 1024, - - - CG_HALF , - CG_HALF2 , - CG_HALF3 , - CG_HALF4 , - CG_HALF1x1 , - CG_HALF1x2 , - CG_HALF1x3 , - CG_HALF1x4 , - CG_HALF2x1 , - CG_HALF2x2 , - CG_HALF2x3 , - CG_HALF2x4 , - CG_HALF3x1 , - CG_HALF3x2 , - CG_HALF3x3 , - CG_HALF3x4 , - CG_HALF4x1 , - CG_HALF4x2 , - CG_HALF4x3 , - CG_HALF4x4 , - CG_FLOAT , - CG_FLOAT2 , - CG_FLOAT3 , - CG_FLOAT4 , - CG_FLOAT1x1 , - CG_FLOAT1x2 , - CG_FLOAT1x3 , - CG_FLOAT1x4 , - CG_FLOAT2x1 , - CG_FLOAT2x2 , - CG_FLOAT2x3 , - CG_FLOAT2x4 , - CG_FLOAT3x1 , - CG_FLOAT3x2 , - CG_FLOAT3x3 , - CG_FLOAT3x4 , - CG_FLOAT4x1 , - CG_FLOAT4x2 , - CG_FLOAT4x3 , - CG_FLOAT4x4 , - CG_SAMPLER1D , - CG_SAMPLER2D , - CG_SAMPLER3D , - CG_SAMPLERRECT , - CG_SAMPLERCUBE , - CG_FIXED , - CG_FIXED2 , - CG_FIXED3 , - CG_FIXED4 , - CG_FIXED1x1 , - CG_FIXED1x2 , - CG_FIXED1x3 , - CG_FIXED1x4 , - CG_FIXED2x1 , - CG_FIXED2x2 , - CG_FIXED2x3 , - CG_FIXED2x4 , - CG_FIXED3x1 , - CG_FIXED3x2 , - CG_FIXED3x3 , - CG_FIXED3x4 , - CG_FIXED4x1 , - CG_FIXED4x2 , - CG_FIXED4x3 , - CG_FIXED4x4 , - CG_HALF1 , - CG_FLOAT1 , - CG_FIXED1 , - - + CG_UNKNOWN_TYPE, + CG_STRUCT, + CG_ARRAY, + + CG_TYPE_START_ENUM = 1024, + + + CG_HALF , + CG_HALF2 , + CG_HALF3 , + CG_HALF4 , + CG_HALF1x1 , + CG_HALF1x2 , + CG_HALF1x3 , + CG_HALF1x4 , + CG_HALF2x1 , + CG_HALF2x2 , + CG_HALF2x3 , + CG_HALF2x4 , + CG_HALF3x1 , + CG_HALF3x2 , + CG_HALF3x3 , + CG_HALF3x4 , + CG_HALF4x1 , + CG_HALF4x2 , + CG_HALF4x3 , + CG_HALF4x4 , + CG_FLOAT , + CG_FLOAT2 , + CG_FLOAT3 , + CG_FLOAT4 , + CG_FLOAT1x1 , + CG_FLOAT1x2 , + CG_FLOAT1x3 , + CG_FLOAT1x4 , + CG_FLOAT2x1 , + CG_FLOAT2x2 , + CG_FLOAT2x3 , + CG_FLOAT2x4 , + CG_FLOAT3x1 , + CG_FLOAT3x2 , + CG_FLOAT3x3 , + CG_FLOAT3x4 , + CG_FLOAT4x1 , + CG_FLOAT4x2 , + CG_FLOAT4x3 , + CG_FLOAT4x4 , + CG_SAMPLER1D , + CG_SAMPLER2D , + CG_SAMPLER3D , + CG_SAMPLERRECT , + CG_SAMPLERCUBE , + CG_FIXED , + CG_FIXED2 , + CG_FIXED3 , + CG_FIXED4 , + CG_FIXED1x1 , + CG_FIXED1x2 , + CG_FIXED1x3 , + CG_FIXED1x4 , + CG_FIXED2x1 , + CG_FIXED2x2 , + CG_FIXED2x3 , + CG_FIXED2x4 , + CG_FIXED3x1 , + CG_FIXED3x2 , + CG_FIXED3x3 , + CG_FIXED3x4 , + CG_FIXED4x1 , + CG_FIXED4x2 , + CG_FIXED4x3 , + CG_FIXED4x4 , + CG_HALF1 , + CG_FLOAT1 , + CG_FIXED1 , + + } CGtype; typedef enum { - - CG_TEXUNIT0 = 2048, - CG_TEXUNIT1 = 2049, - CG_TEXUNIT2 = 2050, - CG_TEXUNIT3 = 2051, - CG_TEXUNIT4 = 2052, - CG_TEXUNIT5 = 2053, - CG_TEXUNIT6 = 2054, - CG_TEXUNIT7 = 2055, - CG_TEXUNIT8 = 2056, - CG_TEXUNIT9 = 2057, - CG_TEXUNIT10 = 2058, - CG_TEXUNIT11 = 2059, - CG_TEXUNIT12 = 2060, - CG_TEXUNIT13 = 2061, - CG_TEXUNIT14 = 2062, - CG_TEXUNIT15 = 2063, - - CG_ATTR0 = 2113, - CG_ATTR1 = 2114, - CG_ATTR2 = 2115, - CG_ATTR3 = 2116, - CG_ATTR4 = 2117, - CG_ATTR5 = 2118, - CG_ATTR6 = 2119, - CG_ATTR7 = 2120, - CG_ATTR8 = 2121, - CG_ATTR9 = 2122, - CG_ATTR10 = 2123, - CG_ATTR11 = 2124, - CG_ATTR12 = 2125, - CG_ATTR13 = 2126, - CG_ATTR14 = 2127, - CG_ATTR15 = 2128, - - CG_C = 2178, - - CG_TEX0 = 2179, - CG_TEX1 = 2180, - CG_TEX2 = 2181, - CG_TEX3 = 2192, - CG_TEX4 = 2193, - CG_TEX5 = 2194, - CG_TEX6 = 2195, - CG_TEX7 = 2196, - - CG_HPOS = 2243, - CG_COL0 = 2245, - CG_COL1 = 2246, - CG_COL2 = 2247, - CG_COL3 = 2248, - CG_PSIZ = 2309, - CG_WPOS = 2373, - - CG_POSITION0 = 2437, - CG_POSITION1 = 2438, - CG_POSITION2 = 2439, - CG_POSITION3 = 2440, - CG_POSITION4 = 2441, - CG_POSITION5 = 2442, - CG_POSITION6 = 2443, - CG_POSITION7 = 2444, - CG_POSITION8 = 2445, - CG_POSITION9 = 2446, - CG_POSITION10 = 2447, - CG_POSITION11 = 2448, - CG_POSITION12 = 2449, - CG_POSITION13 = 2450, - CG_POSITION14 = 2451, - CG_POSITION15 = 2452, - CG_DIFFUSE0 = 2501, - CG_TANGENT0 = 2565, - CG_TANGENT1 = 2566, - CG_TANGENT2 = 2567, - CG_TANGENT3 = 2568, - CG_TANGENT4 = 2569, - CG_TANGENT5 = 2570, - CG_TANGENT6 = 2571, - CG_TANGENT7 = 2572, - CG_TANGENT8 = 2573, - CG_TANGENT9 = 2574, - CG_TANGENT10 = 2575, - CG_TANGENT11 = 2576, - CG_TANGENT12 = 2577, - CG_TANGENT13 = 2578, - CG_TANGENT14 = 2579, - CG_TANGENT15 = 2580, - CG_SPECULAR0 = 2629, - CG_BLENDINDICES0 = 2693, - CG_BLENDINDICES1 = 2694, - CG_BLENDINDICES2 = 2695, - CG_BLENDINDICES3 = 2696, - CG_BLENDINDICES4 = 2697, - CG_BLENDINDICES5 = 2698, - CG_BLENDINDICES6 = 2699, - CG_BLENDINDICES7 = 2700, - CG_BLENDINDICES8 = 2701, - CG_BLENDINDICES9 = 2702, - CG_BLENDINDICES10 = 2703, - CG_BLENDINDICES11 = 2704, - CG_BLENDINDICES12 = 2705, - CG_BLENDINDICES13 = 2706, - CG_BLENDINDICES14 = 2707, - CG_BLENDINDICES15 = 2708, - CG_COLOR0 = 2757, - CG_COLOR1 = 2758, - CG_COLOR2 = 2759, - CG_COLOR3 = 2760, - CG_COLOR4 = 2761, - CG_COLOR5 = 2762, - CG_COLOR6 = 2763, - CG_COLOR7 = 2764, - CG_COLOR8 = 2765, - CG_COLOR9 = 2766, - CG_COLOR10 = 2767, - CG_COLOR11 = 2768, - CG_COLOR12 = 2769, - CG_COLOR13 = 2770, - CG_COLOR14 = 2771, - CG_COLOR15 = 2772, - CG_PSIZE0 = 2821, - CG_PSIZE1 = 2822, - CG_PSIZE2 = 2823, - CG_PSIZE3 = 2824, - CG_PSIZE4 = 2825, - CG_PSIZE5 = 2826, - CG_PSIZE6 = 2827, - CG_PSIZE7 = 2828, - CG_PSIZE8 = 2829, - CG_PSIZE9 = 2830, - CG_PSIZE10 = 2831, - CG_PSIZE11 = 2832, - CG_PSIZE12 = 2833, - CG_PSIZE13 = 2834, - CG_PSIZE14 = 2835, - CG_PSIZE15 = 2836, - CG_BINORMAL0 = 2885, - CG_BINORMAL1 = 2886, - CG_BINORMAL2 = 2887, - CG_BINORMAL3 = 2888, - CG_BINORMAL4 = 2889, - CG_BINORMAL5 = 2890, - CG_BINORMAL6 = 2891, - CG_BINORMAL7 = 2892, - CG_BINORMAL8 = 2893, - CG_BINORMAL9 = 2894, - CG_BINORMAL10 = 2895, - CG_BINORMAL11 = 2896, - CG_BINORMAL12 = 2897, - CG_BINORMAL13 = 2898, - CG_BINORMAL14 = 2899, - CG_BINORMAL15 = 2900, - CG_FOG0 = 2917, - CG_FOG1 = 2918, - CG_FOG2 = 2919, - CG_FOG3 = 2920, - CG_FOG4 = 2921, - CG_FOG5 = 2922, - CG_FOG6 = 2923, - CG_FOG7 = 2924, - CG_FOG8 = 2925, - CG_FOG9 = 2926, - CG_FOG10 = 2927, - CG_FOG11 = 2928, - CG_FOG12 = 2929, - CG_FOG13 = 2930, - CG_FOG14 = 2931, - CG_FOG15 = 2932, - CG_DEPTH0 = 2933, - CG_DEPTH1 = 2934, - CG_DEPTH2 = 2935, - CG_DEPTH3 = 2936, - CG_DEPTH4 = 2937, - CG_DEPTH5 = 2938, - CG_DEPTH6 = 2939, - CG_DEPTH7 = 2940, - CG_DEPTH8 = 2941, - CG_DEPTH9 = 29542, - CG_DEPTH10 = 2943, - CG_DEPTH11 = 2944, - CG_DEPTH12 = 2945, - CG_DEPTH13 = 2946, - CG_DEPTH14 = 2947, - CG_DEPTH15 = 2948, - CG_SAMPLE0 = 2949, - CG_SAMPLE1 = 2950, - CG_SAMPLE2 = 2951, - CG_SAMPLE3 = 2952, - CG_SAMPLE4 = 2953, - CG_SAMPLE5 = 2954, - CG_SAMPLE6 = 2955, - CG_SAMPLE7 = 2956, - CG_SAMPLE8 = 2957, - CG_SAMPLE9 = 2958, - CG_SAMPLE10 = 2959, - CG_SAMPLE11 = 2960, - CG_SAMPLE12 = 2961, - CG_SAMPLE13 = 2962, - CG_SAMPLE14 = 2963, - CG_SAMPLE15 = 2964, - CG_BLENDWEIGHT0 = 3028, - CG_BLENDWEIGHT1 = 3029, - CG_BLENDWEIGHT2 = 3030, - CG_BLENDWEIGHT3 = 3031, - CG_BLENDWEIGHT4 = 3032, - CG_BLENDWEIGHT5 = 3033, - CG_BLENDWEIGHT6 = 3034, - CG_BLENDWEIGHT7 = 3035, - CG_BLENDWEIGHT8 = 3036, - CG_BLENDWEIGHT9 = 3037, - CG_BLENDWEIGHT10 = 3038, - CG_BLENDWEIGHT11 = 3039, - CG_BLENDWEIGHT12 = 3040, - CG_BLENDWEIGHT13 = 3041, - CG_BLENDWEIGHT14 = 3042, - CG_BLENDWEIGHT15 = 3043, - CG_NORMAL0 = 3092, - CG_NORMAL1 = 3093, - CG_NORMAL2 = 3094, - CG_NORMAL3 = 3095, - CG_NORMAL4 = 3096, - CG_NORMAL5 = 3097, - CG_NORMAL6 = 3098, - CG_NORMAL7 = 3099, - CG_NORMAL8 = 3100, - CG_NORMAL9 = 3101, - CG_NORMAL10 = 3102, - CG_NORMAL11 = 3103, - CG_NORMAL12 = 3104, - CG_NORMAL13 = 3105, - CG_NORMAL14 = 3106, - CG_NORMAL15 = 3107, - CG_FOGCOORD = 3156, - CG_TEXCOORD0 = 3220, - CG_TEXCOORD1 = 3221, - CG_TEXCOORD2 = 3222, - CG_TEXCOORD3 = 3223, - CG_TEXCOORD4 = 3224, - CG_TEXCOORD5 = 3225, - CG_TEXCOORD6 = 3226, - CG_TEXCOORD7 = 3227, - CG_TEXCOORD8 = 3228, - CG_TEXCOORD9 = 3229, - CG_TEXCOORD10 = 3230, - CG_TEXCOORD11 = 3231, - CG_TEXCOORD12 = 3232, - CG_TEXCOORD13 = 3233, - CG_TEXCOORD14 = 3234, - CG_TEXCOORD15 = 3235, - CG_COMBINER_CONST0 = 3284, - CG_COMBINER_CONST1 = 3285, - CG_COMBINER_STAGE_CONST0 = 3286, - CG_COMBINER_STAGE_CONST1 = 3287, - CG_OFFSET_TEXTURE_MATRIX = 3288, - CG_OFFSET_TEXTURE_SCALE = 3289, - CG_OFFSET_TEXTURE_BIAS = 3290, - CG_CONST_EYE = 3291, - CG_TESSFACTOR = 3255, - - - CG_UNDEFINED, - + + CG_TEXUNIT0 = 2048, + CG_TEXUNIT1 = 2049, + CG_TEXUNIT2 = 2050, + CG_TEXUNIT3 = 2051, + CG_TEXUNIT4 = 2052, + CG_TEXUNIT5 = 2053, + CG_TEXUNIT6 = 2054, + CG_TEXUNIT7 = 2055, + CG_TEXUNIT8 = 2056, + CG_TEXUNIT9 = 2057, + CG_TEXUNIT10 = 2058, + CG_TEXUNIT11 = 2059, + CG_TEXUNIT12 = 2060, + CG_TEXUNIT13 = 2061, + CG_TEXUNIT14 = 2062, + CG_TEXUNIT15 = 2063, + + CG_ATTR0 = 2113, + CG_ATTR1 = 2114, + CG_ATTR2 = 2115, + CG_ATTR3 = 2116, + CG_ATTR4 = 2117, + CG_ATTR5 = 2118, + CG_ATTR6 = 2119, + CG_ATTR7 = 2120, + CG_ATTR8 = 2121, + CG_ATTR9 = 2122, + CG_ATTR10 = 2123, + CG_ATTR11 = 2124, + CG_ATTR12 = 2125, + CG_ATTR13 = 2126, + CG_ATTR14 = 2127, + CG_ATTR15 = 2128, + + CG_C = 2178, + + CG_TEX0 = 2179, + CG_TEX1 = 2180, + CG_TEX2 = 2181, + CG_TEX3 = 2192, + CG_TEX4 = 2193, + CG_TEX5 = 2194, + CG_TEX6 = 2195, + CG_TEX7 = 2196, + + CG_HPOS = 2243, + CG_COL0 = 2245, + CG_COL1 = 2246, + CG_COL2 = 2247, + CG_COL3 = 2248, + CG_PSIZ = 2309, + CG_WPOS = 2373, + + CG_POSITION0 = 2437, + CG_POSITION1 = 2438, + CG_POSITION2 = 2439, + CG_POSITION3 = 2440, + CG_POSITION4 = 2441, + CG_POSITION5 = 2442, + CG_POSITION6 = 2443, + CG_POSITION7 = 2444, + CG_POSITION8 = 2445, + CG_POSITION9 = 2446, + CG_POSITION10 = 2447, + CG_POSITION11 = 2448, + CG_POSITION12 = 2449, + CG_POSITION13 = 2450, + CG_POSITION14 = 2451, + CG_POSITION15 = 2452, + CG_DIFFUSE0 = 2501, + CG_TANGENT0 = 2565, + CG_TANGENT1 = 2566, + CG_TANGENT2 = 2567, + CG_TANGENT3 = 2568, + CG_TANGENT4 = 2569, + CG_TANGENT5 = 2570, + CG_TANGENT6 = 2571, + CG_TANGENT7 = 2572, + CG_TANGENT8 = 2573, + CG_TANGENT9 = 2574, + CG_TANGENT10 = 2575, + CG_TANGENT11 = 2576, + CG_TANGENT12 = 2577, + CG_TANGENT13 = 2578, + CG_TANGENT14 = 2579, + CG_TANGENT15 = 2580, + CG_SPECULAR0 = 2629, + CG_BLENDINDICES0 = 2693, + CG_BLENDINDICES1 = 2694, + CG_BLENDINDICES2 = 2695, + CG_BLENDINDICES3 = 2696, + CG_BLENDINDICES4 = 2697, + CG_BLENDINDICES5 = 2698, + CG_BLENDINDICES6 = 2699, + CG_BLENDINDICES7 = 2700, + CG_BLENDINDICES8 = 2701, + CG_BLENDINDICES9 = 2702, + CG_BLENDINDICES10 = 2703, + CG_BLENDINDICES11 = 2704, + CG_BLENDINDICES12 = 2705, + CG_BLENDINDICES13 = 2706, + CG_BLENDINDICES14 = 2707, + CG_BLENDINDICES15 = 2708, + CG_COLOR0 = 2757, + CG_COLOR1 = 2758, + CG_COLOR2 = 2759, + CG_COLOR3 = 2760, + CG_COLOR4 = 2761, + CG_COLOR5 = 2762, + CG_COLOR6 = 2763, + CG_COLOR7 = 2764, + CG_COLOR8 = 2765, + CG_COLOR9 = 2766, + CG_COLOR10 = 2767, + CG_COLOR11 = 2768, + CG_COLOR12 = 2769, + CG_COLOR13 = 2770, + CG_COLOR14 = 2771, + CG_COLOR15 = 2772, + CG_PSIZE0 = 2821, + CG_PSIZE1 = 2822, + CG_PSIZE2 = 2823, + CG_PSIZE3 = 2824, + CG_PSIZE4 = 2825, + CG_PSIZE5 = 2826, + CG_PSIZE6 = 2827, + CG_PSIZE7 = 2828, + CG_PSIZE8 = 2829, + CG_PSIZE9 = 2830, + CG_PSIZE10 = 2831, + CG_PSIZE11 = 2832, + CG_PSIZE12 = 2833, + CG_PSIZE13 = 2834, + CG_PSIZE14 = 2835, + CG_PSIZE15 = 2836, + CG_BINORMAL0 = 2885, + CG_BINORMAL1 = 2886, + CG_BINORMAL2 = 2887, + CG_BINORMAL3 = 2888, + CG_BINORMAL4 = 2889, + CG_BINORMAL5 = 2890, + CG_BINORMAL6 = 2891, + CG_BINORMAL7 = 2892, + CG_BINORMAL8 = 2893, + CG_BINORMAL9 = 2894, + CG_BINORMAL10 = 2895, + CG_BINORMAL11 = 2896, + CG_BINORMAL12 = 2897, + CG_BINORMAL13 = 2898, + CG_BINORMAL14 = 2899, + CG_BINORMAL15 = 2900, + CG_FOG0 = 2917, + CG_FOG1 = 2918, + CG_FOG2 = 2919, + CG_FOG3 = 2920, + CG_FOG4 = 2921, + CG_FOG5 = 2922, + CG_FOG6 = 2923, + CG_FOG7 = 2924, + CG_FOG8 = 2925, + CG_FOG9 = 2926, + CG_FOG10 = 2927, + CG_FOG11 = 2928, + CG_FOG12 = 2929, + CG_FOG13 = 2930, + CG_FOG14 = 2931, + CG_FOG15 = 2932, + CG_DEPTH0 = 2933, + CG_DEPTH1 = 2934, + CG_DEPTH2 = 2935, + CG_DEPTH3 = 2936, + CG_DEPTH4 = 2937, + CG_DEPTH5 = 2938, + CG_DEPTH6 = 2939, + CG_DEPTH7 = 2940, + CG_DEPTH8 = 2941, + CG_DEPTH9 = 29542, + CG_DEPTH10 = 2943, + CG_DEPTH11 = 2944, + CG_DEPTH12 = 2945, + CG_DEPTH13 = 2946, + CG_DEPTH14 = 2947, + CG_DEPTH15 = 2948, + CG_SAMPLE0 = 2949, + CG_SAMPLE1 = 2950, + CG_SAMPLE2 = 2951, + CG_SAMPLE3 = 2952, + CG_SAMPLE4 = 2953, + CG_SAMPLE5 = 2954, + CG_SAMPLE6 = 2955, + CG_SAMPLE7 = 2956, + CG_SAMPLE8 = 2957, + CG_SAMPLE9 = 2958, + CG_SAMPLE10 = 2959, + CG_SAMPLE11 = 2960, + CG_SAMPLE12 = 2961, + CG_SAMPLE13 = 2962, + CG_SAMPLE14 = 2963, + CG_SAMPLE15 = 2964, + CG_BLENDWEIGHT0 = 3028, + CG_BLENDWEIGHT1 = 3029, + CG_BLENDWEIGHT2 = 3030, + CG_BLENDWEIGHT3 = 3031, + CG_BLENDWEIGHT4 = 3032, + CG_BLENDWEIGHT5 = 3033, + CG_BLENDWEIGHT6 = 3034, + CG_BLENDWEIGHT7 = 3035, + CG_BLENDWEIGHT8 = 3036, + CG_BLENDWEIGHT9 = 3037, + CG_BLENDWEIGHT10 = 3038, + CG_BLENDWEIGHT11 = 3039, + CG_BLENDWEIGHT12 = 3040, + CG_BLENDWEIGHT13 = 3041, + CG_BLENDWEIGHT14 = 3042, + CG_BLENDWEIGHT15 = 3043, + CG_NORMAL0 = 3092, + CG_NORMAL1 = 3093, + CG_NORMAL2 = 3094, + CG_NORMAL3 = 3095, + CG_NORMAL4 = 3096, + CG_NORMAL5 = 3097, + CG_NORMAL6 = 3098, + CG_NORMAL7 = 3099, + CG_NORMAL8 = 3100, + CG_NORMAL9 = 3101, + CG_NORMAL10 = 3102, + CG_NORMAL11 = 3103, + CG_NORMAL12 = 3104, + CG_NORMAL13 = 3105, + CG_NORMAL14 = 3106, + CG_NORMAL15 = 3107, + CG_FOGCOORD = 3156, + CG_TEXCOORD0 = 3220, + CG_TEXCOORD1 = 3221, + CG_TEXCOORD2 = 3222, + CG_TEXCOORD3 = 3223, + CG_TEXCOORD4 = 3224, + CG_TEXCOORD5 = 3225, + CG_TEXCOORD6 = 3226, + CG_TEXCOORD7 = 3227, + CG_TEXCOORD8 = 3228, + CG_TEXCOORD9 = 3229, + CG_TEXCOORD10 = 3230, + CG_TEXCOORD11 = 3231, + CG_TEXCOORD12 = 3232, + CG_TEXCOORD13 = 3233, + CG_TEXCOORD14 = 3234, + CG_TEXCOORD15 = 3235, + CG_COMBINER_CONST0 = 3284, + CG_COMBINER_CONST1 = 3285, + CG_COMBINER_STAGE_CONST0 = 3286, + CG_COMBINER_STAGE_CONST1 = 3287, + CG_OFFSET_TEXTURE_MATRIX = 3288, + CG_OFFSET_TEXTURE_SCALE = 3289, + CG_OFFSET_TEXTURE_BIAS = 3290, + CG_CONST_EYE = 3291, + CG_TESSFACTOR = 3255, + + + CG_UNDEFINED, + } CGresource; - + typedef enum { - CG_PROFILE_START = 6144, - CG_PROFILE_UNKNOWN, - - CG_PROFILE_VP20 = 6146, - CG_PROFILE_FP20 = 6147, - CG_PROFILE_VP30 = 6148, - CG_PROFILE_FP30 = 6149, - CG_PROFILE_ARBVP1 = 6150, - CG_PROFILE_ARBFP1 = 7000, - - - CG_PROFILE_VS_1_1 = 6153, - CG_PROFILE_VS_2_0 = 6154, - CG_PROFILE_VS_2_X = 6155, - - CG_PROFILE_PS_1_1 = 6159, - CG_PROFILE_PS_1_2 = 6160, - CG_PROFILE_PS_1_3 = 6161, - CG_PROFILE_PS_2_0 = 6162, - CG_PROFILE_PS_2_X = 6163, - - CG_PROFILE_MAX, + CG_PROFILE_START = 6144, + CG_PROFILE_UNKNOWN, + + CG_PROFILE_VP20 = 6146, + CG_PROFILE_FP20 = 6147, + CG_PROFILE_VP30 = 6148, + CG_PROFILE_FP30 = 6149, + CG_PROFILE_ARBVP1 = 6150, + CG_PROFILE_ARBFP1 = 7000, + + + CG_PROFILE_VS_1_1 = 6153, + CG_PROFILE_VS_2_0 = 6154, + CG_PROFILE_VS_2_X = 6155, + + CG_PROFILE_PS_1_1 = 6159, + CG_PROFILE_PS_1_2 = 6160, + CG_PROFILE_PS_1_3 = 6161, + CG_PROFILE_PS_2_0 = 6162, + CG_PROFILE_PS_2_X = 6163, + + CG_PROFILE_MAX, } CGprofile; - + typedef enum { - - - CG_NO_ERROR = 0, - CG_COMPILER_ERROR = 1, - CG_INVALID_PARAMETER_ERROR = 2, - CG_INVALID_PROFILE_ERROR = 3, - CG_PROGRAM_LOAD_ERROR = 4, - CG_PROGRAM_BIND_ERROR = 5, - CG_PROGRAM_NOT_LOADED_ERROR = 6, - CG_UNSUPPORTED_GL_EXTENSION_ERROR = 7, - CG_INVALID_VALUE_TYPE_ERROR = 8, - CG_NOT_MATRIX_PARAM_ERROR = 9, - CG_INVALID_ENUMERANT_ERROR = 10, - CG_NOT_4x4_MATRIX_ERROR = 11, - CG_FILE_READ_ERROR = 12, - CG_FILE_WRITE_ERROR = 13, - CG_NVPARSE_ERROR = 14, - CG_MEMORY_ALLOC_ERROR = 15, - CG_INVALID_CONTEXT_HANDLE_ERROR = 16, - CG_INVALID_PROGRAM_HANDLE_ERROR = 17, - CG_INVALID_PARAM_HANDLE_ERROR = 18, - CG_UNKNOWN_PROFILE_ERROR = 19, - CG_VAR_ARG_ERROR = 20, - CG_INVALID_DIMENSION_ERROR = 21, - CG_ARRAY_PARAM_ERROR = 22, - CG_OUT_OF_ARRAY_BOUNDS_ERROR = 23, + + + CG_NO_ERROR = 0, + CG_COMPILER_ERROR = 1, + CG_INVALID_PARAMETER_ERROR = 2, + CG_INVALID_PROFILE_ERROR = 3, + CG_PROGRAM_LOAD_ERROR = 4, + CG_PROGRAM_BIND_ERROR = 5, + CG_PROGRAM_NOT_LOADED_ERROR = 6, + CG_UNSUPPORTED_GL_EXTENSION_ERROR = 7, + CG_INVALID_VALUE_TYPE_ERROR = 8, + CG_NOT_MATRIX_PARAM_ERROR = 9, + CG_INVALID_ENUMERANT_ERROR = 10, + CG_NOT_4x4_MATRIX_ERROR = 11, + CG_FILE_READ_ERROR = 12, + CG_FILE_WRITE_ERROR = 13, + CG_NVPARSE_ERROR = 14, + CG_MEMORY_ALLOC_ERROR = 15, + CG_INVALID_CONTEXT_HANDLE_ERROR = 16, + CG_INVALID_PROGRAM_HANDLE_ERROR = 17, + CG_INVALID_PARAM_HANDLE_ERROR = 18, + CG_UNKNOWN_PROFILE_ERROR = 19, + CG_VAR_ARG_ERROR = 20, + CG_INVALID_DIMENSION_ERROR = 21, + CG_ARRAY_PARAM_ERROR = 22, + CG_OUT_OF_ARRAY_BOUNDS_ERROR = 23, } CGerror; - + typedef enum { - CG_UNKNOWN = 4096, - CG_IN, - CG_OUT, - CG_INOUT, - CG_MIXED, - CG_VARYING, - CG_UNIFORM, - CG_CONSTANT, - CG_PROGRAM_SOURCE, - CG_PROGRAM_ENTRY, - CG_COMPILED_PROGRAM, - CG_PROGRAM_PROFILE, - - CG_GLOBAL, - CG_PROGRAM, - - CG_DEFAULT, - CG_ERROR, - - CG_SOURCE, - CG_OBJECT, - + CG_UNKNOWN = 4096, + CG_IN, + CG_OUT, + CG_INOUT, + CG_MIXED, + CG_VARYING, + CG_UNIFORM, + CG_CONSTANT, + CG_PROGRAM_SOURCE, + CG_PROGRAM_ENTRY, + CG_COMPILED_PROGRAM, + CG_PROGRAM_PROFILE, + + CG_GLOBAL, + CG_PROGRAM, + + CG_DEFAULT, + CG_ERROR, + + CG_SOURCE, + CG_OBJECT, + } CGenum; - - + + extern "C" { - - typedef void (*CGerrorCallbackFunc)(void); - - - - typedef CGcontext (*PFNCGCREATECONTEXTPROC)(void); - typedef void (*PFNCGDESTROYCONTEXTPROC)(CGcontext ctx); - typedef CGbool (*PFNCGISCONTEXTPROC)(CGcontext ctx); - typedef const char * (*PFNCGGETLASTLISTINGPROC)(CGcontext ctx); - typedef CGprogram (*PFNCGCREATEPROGRAMPROC)(CGcontext ctx, - CGenum program_type, - const char *program, - CGprofile profile, - const char *entry, - const char **args); - typedef CGprogram (*PFNCGCREATEPROGRAMFROMFILEPROC)(CGcontext ctx, - CGenum program_type, - const char *program_file, - CGprofile profile, - const char *entry, - const char **args); - typedef CGprogram (*PFNCGCOPYPROGRAMPROC)(CGprogram program); - typedef void (*PFNCGDESTROYPROGRAMPROC)(CGprogram program); - typedef CGprogram (*PFNCGGETFIRSTPROGRAMPROC)(CGcontext ctx); - typedef CGprogram (*PFNCGGETNEXTPROGRAMPROC)(CGprogram current); - typedef CGcontext (*PFNCGGETPROGRAMCONTEXTPROC)(CGprogram prog); - typedef CGbool (*PFNCGISPROGRAMPROC)(CGprogram program); - typedef void (*PFNCGCOMPILEPROGRAMPROC)(CGprogram program); - typedef CGbool (*PFNCGISPROGRAMCOMPILEDPROC)(CGprogram program); - typedef const char * (*PFNCGGETPROGRAMSTRINGPROC)(CGprogram prog, CGenum pname); - typedef CGprofile (*PFNCGGETPROGRAMPROFILEPROC)(CGprogram prog); - typedef CGparameter (*PFNCGGETNAMEDPARAMETERPROC)(CGprogram prog, const char *name); - typedef CGparameter (*PFNCGGETFIRSTPARAMETERPROC)(CGprogram prog, CGenum name_space); - typedef CGparameter (*PFNCGGETNEXTPARAMETERPROC)(CGparameter current); - typedef CGparameter (*PFNCGGETFIRSTLEAFPARAMETERPROC)(CGprogram prog, CGenum name_space); - typedef CGparameter (*PFNCGGETNEXTLEAFPARAMETERPROC)(CGparameter current); - typedef CGparameter (*PFNCGGETFIRSTSTRUCTPARAMETERPROC)(CGparameter param); - typedef CGparameter (*PFNCGGETFIRSTDEPENDENTPARAMETERPROC)(CGparameter param); - typedef CGparameter (*PFNCGGETARRAYPARAMETERPROC)(CGparameter aparam, int index); - typedef int (*PFNCGGETARRAYDIMENSIONPROC)(CGparameter param); - typedef int (*PFNCGGETARRAYSIZEPROC)(CGparameter param, int dimension); - typedef CGprogram (*PFNCGGETPARAMETERPROGRAMPROC)(CGparameter prog); - typedef CGbool (*PFNCGISPARAMETERPROC)(CGparameter param); - typedef const char * (*PFNCGGETPARAMETERNAMEPROC)(CGparameter param); - typedef CGtype (*PFNCGGETPARAMETERTYPEPROC)(CGparameter param); - typedef const char * (*PFNCGGETPARAMETERSEMANTICPROC)(CGparameter param); - typedef CGresource (*PFNCGGETPARAMETERRESOURCEPROC)(CGparameter param); - typedef CGresource (*PFNCGGETPARAMETERBASERESOURCEPROC)(CGparameter param); - typedef unsigned long (*PFNCGGETPARAMETERRESOURCEINDEXPROC)(CGparameter param); - typedef CGenum (*PFNCGGETPARAMETERVARIABILITYPROC)(CGparameter param); - typedef CGenum (*PFNCGGETPARAMETERDIRECTIONPROC)(CGparameter param); - typedef CGbool (*PFNCGISPARAMETERREFERENCEDPROC)(CGparameter param); - typedef void (*PFNCGGETPARAMETERVALUESPROC)(CGparameter param, - CGenum value_type, - int *nvalues); - typedef const char * (*PFNCGGETTYPESTRINGPROC)(CGtype type); - typedef CGtype (*PFNCGGETTYPEPROC)(const char *type_string); - typedef const char * (*PFNCGGETRESOURCESTRINGPROC)(CGresource resource); - typedef CGresource (*PFNCGGETRESOURCEPROC)(const char *resource_string); - typedef const char * (*PFNCGGETPROFILESTRINGPROC)(CGprofile profile); - typedef CGprofile (*PFNCGGETPROFILEPROC)(const char *profile_string); - typedef CGerror (*PFNCGGETERRORPROC)(void); - typedef const char * (*PFNCGGETERRORSTRINGPROC)(CGerror error); - typedef void (*PFNCGSETERRORCALLBACKPROC)(CGerrorCallbackFunc func); - typedef CGerrorCallbackFunc (*PFNCGGETERRORCALLBACKPROC)(void); - - - extern PFNCGCREATECONTEXTPROC cgCreateContext; - extern PFNCGDESTROYCONTEXTPROC cgDestroyContext; - extern PFNCGISCONTEXTPROC cgIsContext; - extern PFNCGGETLASTLISTINGPROC cgGetLastListing; - extern PFNCGCREATEPROGRAMPROC cgCreateProgram; - extern PFNCGCREATEPROGRAMFROMFILEPROC cgCreateProgramFromFile; - extern PFNCGCOPYPROGRAMPROC cgCopyProgram; - extern PFNCGDESTROYPROGRAMPROC cgDestroyProgram; - extern PFNCGGETFIRSTPROGRAMPROC cgGetFirstProgram; - extern PFNCGGETNEXTPROGRAMPROC cgGetNextProgram; - extern PFNCGGETPROGRAMCONTEXTPROC cgGetProgramContext; - extern PFNCGISPROGRAMPROC cgIsProgram; - extern PFNCGCOMPILEPROGRAMPROC cgCompileProgram; - extern PFNCGISPROGRAMCOMPILEDPROC cgIsProgramCompiled; - extern PFNCGGETPROGRAMSTRINGPROC cgGetProgramString; - extern PFNCGGETPROGRAMPROFILEPROC cgGetProgramProfile; - extern PFNCGGETNAMEDPARAMETERPROC cgGetNamedParameter; - extern PFNCGGETFIRSTPARAMETERPROC cgGetFirstParameter; - extern PFNCGGETNEXTPARAMETERPROC cgGetNextParameter; - extern PFNCGGETFIRSTLEAFPARAMETERPROC cgGetFirstLeafParameter; - extern PFNCGGETNEXTLEAFPARAMETERPROC cgGetNextLeafParameter; - extern PFNCGGETFIRSTSTRUCTPARAMETERPROC cgGetFirstStructParameter; - extern PFNCGGETFIRSTDEPENDENTPARAMETERPROC cgGetFirstDependentParameter; - extern PFNCGGETARRAYPARAMETERPROC cgGetArrayParameter; - extern PFNCGGETARRAYDIMENSIONPROC cgGetArrayDimension; - extern PFNCGGETARRAYSIZEPROC cgGetArraySize; - extern PFNCGGETPARAMETERPROGRAMPROC cgGetParameterProgram; - extern PFNCGISPARAMETERPROC cgIsParameter; - extern PFNCGGETPARAMETERNAMEPROC cgGetParameterName; - extern PFNCGGETPARAMETERTYPEPROC cgGetParameterType; - extern PFNCGGETPARAMETERSEMANTICPROC cgGetParameterSemantic; - extern PFNCGGETPARAMETERRESOURCEPROC cgGetParameterResource; - extern PFNCGGETPARAMETERBASERESOURCEPROC cgGetParameterBaseResource; - extern PFNCGGETPARAMETERRESOURCEINDEXPROC cgGetParameterResourceIndex; - extern PFNCGGETPARAMETERVARIABILITYPROC cgGetParameterVariability; - extern PFNCGGETPARAMETERDIRECTIONPROC cgGetParameterDirection; - extern PFNCGISPARAMETERREFERENCEDPROC cgIsParameterReferenced; - extern PFNCGGETPARAMETERVALUESPROC cgGetParameterValues; - extern PFNCGGETTYPESTRINGPROC cgGetTypeString; - extern PFNCGGETTYPEPROC cgGetType; - extern PFNCGGETRESOURCESTRINGPROC cgGetResourceString; - extern PFNCGGETRESOURCEPROC cgGetResource; - extern PFNCGGETPROFILESTRINGPROC cgGetProfileString; - extern PFNCGGETPROFILEPROC cgGetProfile; - extern PFNCGGETERRORPROC cgGetError; - extern PFNCGGETERRORSTRINGPROC cgGetErrorString; - extern PFNCGSETERRORCALLBACKPROC cgSetErrorCallback; - extern PFNCGGETERRORCALLBACKPROC cgGetErrorCallback; - - + + typedef void (*CGerrorCallbackFunc)(void); + + + + typedef CGcontext (*PFNCGCREATECONTEXTPROC)(void); + typedef void (*PFNCGDESTROYCONTEXTPROC)(CGcontext ctx); + typedef CGbool (*PFNCGISCONTEXTPROC)(CGcontext ctx); + typedef const char * (*PFNCGGETLASTLISTINGPROC)(CGcontext ctx); + typedef CGprogram (*PFNCGCREATEPROGRAMPROC)(CGcontext ctx, + CGenum program_type, + const char *program, + CGprofile profile, + const char *entry, + const char **args); + typedef CGprogram (*PFNCGCREATEPROGRAMFROMFILEPROC)(CGcontext ctx, + CGenum program_type, + const char *program_file, + CGprofile profile, + const char *entry, + const char **args); + typedef CGprogram (*PFNCGCOPYPROGRAMPROC)(CGprogram program); + typedef void (*PFNCGDESTROYPROGRAMPROC)(CGprogram program); + typedef CGprogram (*PFNCGGETFIRSTPROGRAMPROC)(CGcontext ctx); + typedef CGprogram (*PFNCGGETNEXTPROGRAMPROC)(CGprogram current); + typedef CGcontext (*PFNCGGETPROGRAMCONTEXTPROC)(CGprogram prog); + typedef CGbool (*PFNCGISPROGRAMPROC)(CGprogram program); + typedef void (*PFNCGCOMPILEPROGRAMPROC)(CGprogram program); + typedef CGbool (*PFNCGISPROGRAMCOMPILEDPROC)(CGprogram program); + typedef const char * (*PFNCGGETPROGRAMSTRINGPROC)(CGprogram prog, CGenum pname); + typedef CGprofile (*PFNCGGETPROGRAMPROFILEPROC)(CGprogram prog); + typedef CGparameter (*PFNCGGETNAMEDPARAMETERPROC)(CGprogram prog, const char *name); + typedef CGparameter (*PFNCGGETFIRSTPARAMETERPROC)(CGprogram prog, CGenum name_space); + typedef CGparameter (*PFNCGGETNEXTPARAMETERPROC)(CGparameter current); + typedef CGparameter (*PFNCGGETFIRSTLEAFPARAMETERPROC)(CGprogram prog, CGenum name_space); + typedef CGparameter (*PFNCGGETNEXTLEAFPARAMETERPROC)(CGparameter current); + typedef CGparameter (*PFNCGGETFIRSTSTRUCTPARAMETERPROC)(CGparameter param); + typedef CGparameter (*PFNCGGETFIRSTDEPENDENTPARAMETERPROC)(CGparameter param); + typedef CGparameter (*PFNCGGETARRAYPARAMETERPROC)(CGparameter aparam, int index); + typedef int (*PFNCGGETARRAYDIMENSIONPROC)(CGparameter param); + typedef int (*PFNCGGETARRAYSIZEPROC)(CGparameter param, int dimension); + typedef CGprogram (*PFNCGGETPARAMETERPROGRAMPROC)(CGparameter prog); + typedef CGbool (*PFNCGISPARAMETERPROC)(CGparameter param); + typedef const char * (*PFNCGGETPARAMETERNAMEPROC)(CGparameter param); + typedef CGtype (*PFNCGGETPARAMETERTYPEPROC)(CGparameter param); + typedef const char * (*PFNCGGETPARAMETERSEMANTICPROC)(CGparameter param); + typedef CGresource (*PFNCGGETPARAMETERRESOURCEPROC)(CGparameter param); + typedef CGresource (*PFNCGGETPARAMETERBASERESOURCEPROC)(CGparameter param); + typedef unsigned long (*PFNCGGETPARAMETERRESOURCEINDEXPROC)(CGparameter param); + typedef CGenum (*PFNCGGETPARAMETERVARIABILITYPROC)(CGparameter param); + typedef CGenum (*PFNCGGETPARAMETERDIRECTIONPROC)(CGparameter param); + typedef CGbool (*PFNCGISPARAMETERREFERENCEDPROC)(CGparameter param); + typedef void (*PFNCGGETPARAMETERVALUESPROC)(CGparameter param, + CGenum value_type, + int *nvalues); + typedef const char * (*PFNCGGETTYPESTRINGPROC)(CGtype type); + typedef CGtype (*PFNCGGETTYPEPROC)(const char *type_string); + typedef const char * (*PFNCGGETRESOURCESTRINGPROC)(CGresource resource); + typedef CGresource (*PFNCGGETRESOURCEPROC)(const char *resource_string); + typedef const char * (*PFNCGGETPROFILESTRINGPROC)(CGprofile profile); + typedef CGprofile (*PFNCGGETPROFILEPROC)(const char *profile_string); + typedef CGerror (*PFNCGGETERRORPROC)(void); + typedef const char * (*PFNCGGETERRORSTRINGPROC)(CGerror error); + typedef void (*PFNCGSETERRORCALLBACKPROC)(CGerrorCallbackFunc func); + typedef CGerrorCallbackFunc (*PFNCGGETERRORCALLBACKPROC)(void); + + + extern PFNCGCREATECONTEXTPROC cgCreateContext; + extern PFNCGDESTROYCONTEXTPROC cgDestroyContext; + extern PFNCGISCONTEXTPROC cgIsContext; + extern PFNCGGETLASTLISTINGPROC cgGetLastListing; + extern PFNCGCREATEPROGRAMPROC cgCreateProgram; + extern PFNCGCREATEPROGRAMFROMFILEPROC cgCreateProgramFromFile; + extern PFNCGCOPYPROGRAMPROC cgCopyProgram; + extern PFNCGDESTROYPROGRAMPROC cgDestroyProgram; + extern PFNCGGETFIRSTPROGRAMPROC cgGetFirstProgram; + extern PFNCGGETNEXTPROGRAMPROC cgGetNextProgram; + extern PFNCGGETPROGRAMCONTEXTPROC cgGetProgramContext; + extern PFNCGISPROGRAMPROC cgIsProgram; + extern PFNCGCOMPILEPROGRAMPROC cgCompileProgram; + extern PFNCGISPROGRAMCOMPILEDPROC cgIsProgramCompiled; + extern PFNCGGETPROGRAMSTRINGPROC cgGetProgramString; + extern PFNCGGETPROGRAMPROFILEPROC cgGetProgramProfile; + extern PFNCGGETNAMEDPARAMETERPROC cgGetNamedParameter; + extern PFNCGGETFIRSTPARAMETERPROC cgGetFirstParameter; + extern PFNCGGETNEXTPARAMETERPROC cgGetNextParameter; + extern PFNCGGETFIRSTLEAFPARAMETERPROC cgGetFirstLeafParameter; + extern PFNCGGETNEXTLEAFPARAMETERPROC cgGetNextLeafParameter; + extern PFNCGGETFIRSTSTRUCTPARAMETERPROC cgGetFirstStructParameter; + extern PFNCGGETFIRSTDEPENDENTPARAMETERPROC cgGetFirstDependentParameter; + extern PFNCGGETARRAYPARAMETERPROC cgGetArrayParameter; + extern PFNCGGETARRAYDIMENSIONPROC cgGetArrayDimension; + extern PFNCGGETARRAYSIZEPROC cgGetArraySize; + extern PFNCGGETPARAMETERPROGRAMPROC cgGetParameterProgram; + extern PFNCGISPARAMETERPROC cgIsParameter; + extern PFNCGGETPARAMETERNAMEPROC cgGetParameterName; + extern PFNCGGETPARAMETERTYPEPROC cgGetParameterType; + extern PFNCGGETPARAMETERSEMANTICPROC cgGetParameterSemantic; + extern PFNCGGETPARAMETERRESOURCEPROC cgGetParameterResource; + extern PFNCGGETPARAMETERBASERESOURCEPROC cgGetParameterBaseResource; + extern PFNCGGETPARAMETERRESOURCEINDEXPROC cgGetParameterResourceIndex; + extern PFNCGGETPARAMETERVARIABILITYPROC cgGetParameterVariability; + extern PFNCGGETPARAMETERDIRECTIONPROC cgGetParameterDirection; + extern PFNCGISPARAMETERREFERENCEDPROC cgIsParameterReferenced; + extern PFNCGGETPARAMETERVALUESPROC cgGetParameterValues; + extern PFNCGGETTYPESTRINGPROC cgGetTypeString; + extern PFNCGGETTYPEPROC cgGetType; + extern PFNCGGETRESOURCESTRINGPROC cgGetResourceString; + extern PFNCGGETRESOURCEPROC cgGetResource; + extern PFNCGGETPROFILESTRINGPROC cgGetProfileString; + extern PFNCGGETPROFILEPROC cgGetProfile; + extern PFNCGGETERRORPROC cgGetError; + extern PFNCGGETERRORSTRINGPROC cgGetErrorString; + extern PFNCGSETERRORCALLBACKPROC cgSetErrorCallback; + extern PFNCGGETERRORCALLBACKPROC cgGetErrorCallback; + + } - - - + + + extern "C" { - - typedef enum - { - CG_GL_MATRIX_IDENTITY = 0, - CG_GL_MATRIX_TRANSPOSE = 1, - CG_GL_MATRIX_INVERSE = 2, - CG_GL_MATRIX_INVERSE_TRANSPOSE = 3, - - CG_GL_MODELVIEW_MATRIX, - CG_GL_PROJECTION_MATRIX, - CG_GL_TEXTURE_MATRIX, - CG_GL_MODELVIEW_PROJECTION_MATRIX, - - CG_GL_VERTEX, - CG_GL_FRAGMENT, - - } CGGLenum; - - - - - typedef CGbool (*PFNCGGLISPROFILESUPPORTEDPROC)(CGprofile profile); - typedef void (*PFNCGGLENABLEPROFILEPROC)(CGprofile profile); - typedef void (*PFNCGGLDISABLEPROFILEPROC)(CGprofile profile); - typedef CGprofile (*PFNCGGLGETLATESTPROFILEPROC)(CGGLenum profile_type); - typedef void (*PFNCGGLSETOPTIMALOPTIONSPROC)(CGprofile profile); - typedef void (*PFNCGGLLOADPROGRAMPROC)(CGprogram program); - typedef void (*PFNCGGLBINDPROGRAMPROC)(CGprogram program); - typedef void (*PFNCGGLSETPARAMETER1FPROC)(CGparameter param, - float x); - typedef void (*PFNCGGLSETPARAMETER2FPROC)(CGparameter param, - float x, - float y); - typedef void (*PFNCGGLSETPARAMETER3FPROC)(CGparameter param, - float x, - float y, - float z); - typedef void (*PFNCGGLSETPARAMETER4FPROC)(CGparameter param, - float x, - float y, - float z, - float w); - typedef void (*PFNCGGLSETPARAMETER1FVPROC)(CGparameter param, const float *v); - typedef void (*PFNCGGLSETPARAMETER2FVPROC)(CGparameter param, const float *v); - typedef void (*PFNCGGLSETPARAMETER3FVPROC)(CGparameter param, const float *v); - typedef void (*PFNCGGLSETPARAMETER4FVPROC)(CGparameter param, const float *v); - typedef void (*PFNCGGLSETPARAMETER1DPROC)(CGparameter param, - double x); - typedef void (*PFNCGGLSETPARAMETER2DPROC)(CGparameter param, - double x, - double y); - typedef void (*PFNCGGLSETPARAMETER3DPROC)(CGparameter param, - double x, - double y, - double z); - typedef void (*PFNCGGLSETPARAMETER4DPROC)(CGparameter param, - double x, - double y, - double z, - double w); - typedef void (*PFNCGGLSETPARAMETER1DVPROC)(CGparameter param, const double *v); - typedef void (*PFNCGGLSETPARAMETER2DVPROC)(CGparameter param, const double *v); - typedef void (*PFNCGGLSETPARAMETER3DVPROC)(CGparameter param, const double *v); - typedef void (*PFNCGGLSETPARAMETER4DVPROC)(CGparameter param, const double *v); - typedef void (*PFNCGGLSETPARAMETER4DVPROC)(CGparameter param, const double *v); - typedef void (*PFNCGGLGETPARAMETER1FPROC)(CGparameter param, float *v); - typedef void (*PFNCGGLGETPARAMETER2FPROC)(CGparameter param, float *v); - typedef void (*PFNCGGLGETPARAMETER3FPROC)(CGparameter param, float *v); - typedef void (*PFNCGGLGETPARAMETER4FPROC)(CGparameter param, float *v); - typedef void (*PFNCGGLGETPARAMETER1DPROC)(CGparameter param, double *v); - typedef void (*PFNCGGLGETPARAMETER2DPROC)(CGparameter param, double *v); - typedef void (*PFNCGGLGETPARAMETER3DPROC)(CGparameter param, double *v); - typedef void (*PFNCGGLGETPARAMETER4DPROC)(CGparameter param, double *v); - typedef void (*PFNCGGLSETPARAMETERARRAY1FPROC)(CGparameter param, - long offset, - long nelements, - const float *v); - typedef void (*PFNCGGLSETPARAMETERARRAY2FPROC)(CGparameter param, - long offset, - long nelements, - const float *v); - typedef void (*PFNCGGLSETPARAMETERARRAY3FPROC)(CGparameter param, - long offset, - long nelements, - const float *v); - typedef void (*PFNCGGLSETPARAMETERARRAY4FPROC)(CGparameter param, - long offset, - long nelements, - const float *v); - typedef void (*PFNCGGLSETPARAMETERARRAY1DPROC)(CGparameter param, - long offset, - long nelements, - const double *v); - typedef void (*PFNCGGLSETPARAMETERARRAY2DPROC)(CGparameter param, - long offset, - long nelements, - const double *v); - typedef void (*PFNCGGLSETPARAMETERARRAY3DPROC)(CGparameter param, - long offset, - long nelements, - const double *v); - typedef void (*PFNCGGLSETPARAMETERARRAY4DPROC)(CGparameter param, - long offset, - long nelements, - const double *v); - typedef void (*PFNCGGLGETPARAMETERARRAY1FPROC)(CGparameter param, - long offset, - long nelements, - float *v); - typedef void (*PFNCGGLGETPARAMETERARRAY2FPROC)(CGparameter param, - long offset, - long nelements, - float *v); - typedef void (*PFNCGGLGETPARAMETERARRAY3FPROC)(CGparameter param, - long offset, - long nelements, - float *v); - typedef void (*PFNCGGLGETPARAMETERARRAY4FPROC)(CGparameter param, - long offset, - long nelements, - float *v); - typedef void (*PFNCGGLGETPARAMETERARRAY1DPROC)(CGparameter param, - long offset, - long nelements, - double *v); - typedef void (*PFNCGGLGETPARAMETERARRAY2DPROC)(CGparameter param, - long offset, - long nelements, - double *v); - typedef void (*PFNCGGLGETPARAMETERARRAY3DPROC)(CGparameter param, - long offset, - long nelements, - double *v); - typedef void (*PFNCGGLGETPARAMETERARRAY4DPROC)(CGparameter param, - long offset, - long nelements, - double *v); - typedef void (*PFNCGGLSETPARAMETERPOINTERPROC)(CGparameter param, - GLint fsize, - GLenum type, - GLsizei stride, - GLvoid *pointer); - typedef void (*PFNCGGLENABLECLIENTSTATEPROC)(CGparameter param); - typedef void (*PFNCGGLDISABLECLIENTSTATEPROC)(CGparameter param); - typedef void (*PFNCGGLSETMATRIXPARAMETERDRPROC)(CGparameter param, const double *matrix); - typedef void (*PFNCGGLSETMATRIXPARAMETERFRPROC)(CGparameter param, const float *matrix); - typedef void (*PFNCGGLSETMATRIXPARAMETERDCPROC)(CGparameter param, const double *matrix); - typedef void (*PFNCGGLSETMATRIXPARAMETERFCPROC)(CGparameter param, const float *matrix); - typedef void (*PFNCGGLGETMATRIXPARAMETERDRPROC)(CGparameter param, double *matrix); - typedef void (*PFNCGGLGETMATRIXPARAMETERFRPROC)(CGparameter param, float *matrix); - typedef void (*PFNCGGLGETMATRIXPARAMETERDCPROC)(CGparameter param, double *matrix); - typedef void (*PFNCGGLGETMATRIXPARAMETERFCPROC)(CGparameter param, float *matrix); - typedef void (*PFNCGGLSETSTATEMATRIXPARAMETERPROC)(CGparameter param, - GLenum matrix, - GLenum transform); - typedef void (*PFNCGGLSETMATRIXPARAMETERARRAYFCPROC)(CGparameter param, - long offset, - long nelements, - const float *matrices); - typedef void (*PFNCGGLSETMATRIXPARAMETERARRAYFRPROC)(CGparameter param, - long offset, - long nelements, - const float *matrices); - typedef void (*PFNCGGLSETMATRIXPARAMETERARRAYDCPROC)(CGparameter param, - long offset, - long nelements, - const double *matrices); - typedef void (*PFNCGGLSETMATRIXPARAMETERARRAYDRPROC)(CGparameter param, - long offset, - long nelements, - const double *matrices); - typedef void (*PFNCGGLGETMATRIXPARAMETERARRAYFCPROC)(CGparameter param, - long offset, - long nelements, - float *matrices); - typedef void (*PFNCGGLGETMATRIXPARAMETERARRAYFRPROC)(CGparameter param, - long offset, - long nelements, - float *matrices); - typedef void (*PFNCGGLGETMATRIXPARAMETERARRAYDCPROC)(CGparameter param, - long offset, - long nelements, - double *matrices); - typedef void (*PFNCGGLGETMATRIXPARAMETERARRAYDRPROC)(CGparameter param, - long offset, - long nelements, - double *matrices); - typedef void (*PFNCGGLSETTEXTUREPARAMETERPROC)(CGparameter param, GLuint texobj); - typedef GLuint (*PFNCGGLGETTEXTUREPARAMETERPROC)(CGparameter param); - typedef void (*PFNCGGLENABLETEXTUREPARAMETERPROC)(CGparameter param); - typedef void (*PFNCGGLDISABLETEXTUREPARAMETERPROC)(CGparameter param); - typedef GLenum (*PFNCGGLGETTEXTUREENUMPROC)(CGparameter param); - - - extern PFNCGGLISPROFILESUPPORTEDPROC cgGLIsProfileSupported; - extern PFNCGGLENABLEPROFILEPROC cgGLEnableProfile; - extern PFNCGGLDISABLEPROFILEPROC cgGLDisableProfile; - extern PFNCGGLGETLATESTPROFILEPROC cgGLGetLatestProfile; - extern PFNCGGLSETOPTIMALOPTIONSPROC cgGLSetOptimalOptions; - extern PFNCGGLLOADPROGRAMPROC cgGLLoadProgram; - extern PFNCGGLBINDPROGRAMPROC cgGLBindProgram; - extern PFNCGGLSETPARAMETER1FPROC cgGLSetParameter1f; - extern PFNCGGLSETPARAMETER2FPROC cgGLSetParameter2f; - extern PFNCGGLSETPARAMETER3FPROC cgGLSetParameter3f; - extern PFNCGGLSETPARAMETER4FPROC cgGLSetParameter4f; - extern PFNCGGLSETPARAMETER1FVPROC cgGLSetParameter1fv; - extern PFNCGGLSETPARAMETER2FVPROC cgGLSetParameter2fv; - extern PFNCGGLSETPARAMETER3FVPROC cgGLSetParameter3fv; - extern PFNCGGLSETPARAMETER4FVPROC cgGLSetParameter4fv; - extern PFNCGGLSETPARAMETER1DPROC cgGLSetParameter1d; - extern PFNCGGLSETPARAMETER2DPROC cgGLSetParameter2d; - extern PFNCGGLSETPARAMETER3DPROC cgGLSetParameter3d; - extern PFNCGGLSETPARAMETER4DPROC cgGLSetParameter4d; - extern PFNCGGLSETPARAMETER1DVPROC cgGLSetParameter1dv; - extern PFNCGGLSETPARAMETER2DVPROC cgGLSetParameter2dv; - extern PFNCGGLSETPARAMETER3DVPROC cgGLSetParameter3dv; - extern PFNCGGLSETPARAMETER4DVPROC cgGLSetParameter4dv; - extern PFNCGGLGETPARAMETER1FPROC cgGLGetParameter1f; - extern PFNCGGLGETPARAMETER2FPROC cgGLGetParameter2f; - extern PFNCGGLGETPARAMETER3FPROC cgGLGetParameter3f; - extern PFNCGGLGETPARAMETER4FPROC cgGLGetParameter4f; - extern PFNCGGLGETPARAMETER1DPROC cgGLGetParameter1d; - extern PFNCGGLGETPARAMETER2DPROC cgGLGetParameter2d; - extern PFNCGGLGETPARAMETER3DPROC cgGLGetParameter3d; - extern PFNCGGLGETPARAMETER4DPROC cgGLGetParameter4d; - extern PFNCGGLSETPARAMETERARRAY1FPROC cgGLSetParameterArray1f; - extern PFNCGGLSETPARAMETERARRAY2FPROC cgGLSetParameterArray2f; - extern PFNCGGLSETPARAMETERARRAY3FPROC cgGLSetParameterArray3f; - extern PFNCGGLSETPARAMETERARRAY4FPROC cgGLSetParameterArray4f; - extern PFNCGGLSETPARAMETERARRAY1DPROC cgGLSetParameterArray1d; - extern PFNCGGLSETPARAMETERARRAY2DPROC cgGLSetParameterArray2d; - extern PFNCGGLSETPARAMETERARRAY3DPROC cgGLSetParameterArray3d; - extern PFNCGGLSETPARAMETERARRAY4DPROC cgGLSetParameterArray4d; - extern PFNCGGLGETPARAMETERARRAY1FPROC cgGLGetParameterArray1f; - extern PFNCGGLGETPARAMETERARRAY2FPROC cgGLGetParameterArray2f; - extern PFNCGGLGETPARAMETERARRAY3FPROC cgGLGetParameterArray3f; - extern PFNCGGLGETPARAMETERARRAY4FPROC cgGLGetParameterArray4f; - extern PFNCGGLGETPARAMETERARRAY1DPROC cgGLGetParameterArray1d; - extern PFNCGGLGETPARAMETERARRAY2DPROC cgGLGetParameterArray2d; - extern PFNCGGLGETPARAMETERARRAY3DPROC cgGLGetParameterArray3d; - extern PFNCGGLGETPARAMETERARRAY4DPROC cgGLGetParameterArray4d; - extern PFNCGGLSETPARAMETERPOINTERPROC cgGLSetParameterPointer; - extern PFNCGGLENABLECLIENTSTATEPROC cgGLEnableClientState; - extern PFNCGGLDISABLECLIENTSTATEPROC cgGLDisableClientState; - extern PFNCGGLSETMATRIXPARAMETERDRPROC cgGLSetMatrixParameterdr; - extern PFNCGGLSETMATRIXPARAMETERFRPROC cgGLSetMatrixParameterfr; - extern PFNCGGLSETMATRIXPARAMETERDCPROC cgGLSetMatrixParameterdc; - extern PFNCGGLSETMATRIXPARAMETERFCPROC cgGLSetMatrixParameterfc; - extern PFNCGGLGETMATRIXPARAMETERDRPROC cgGLGetMatrixParameterdr; - extern PFNCGGLGETMATRIXPARAMETERFRPROC cgGLGetMatrixParameterfr; - extern PFNCGGLGETMATRIXPARAMETERDCPROC cgGLGetMatrixParameterdc; - extern PFNCGGLGETMATRIXPARAMETERFCPROC cgGLGetMatrixParameterfc; - extern PFNCGGLSETSTATEMATRIXPARAMETERPROC cgGLSetStateMatrixParameter; - extern PFNCGGLSETMATRIXPARAMETERARRAYFCPROC cgGLSetMatrixParameterArrayfc; - extern PFNCGGLSETMATRIXPARAMETERARRAYFRPROC cgGLSetMatrixParameterArrayfr; - extern PFNCGGLSETMATRIXPARAMETERARRAYDCPROC cgGLSetMatrixParameterArraydc; - extern PFNCGGLSETMATRIXPARAMETERARRAYDRPROC cgGLSetMatrixParameterArraydr; - extern PFNCGGLGETMATRIXPARAMETERARRAYFCPROC cgGLGetMatrixParameterArrayfc; - extern PFNCGGLGETMATRIXPARAMETERARRAYFRPROC cgGLGetMatrixParameterArrayfr; - extern PFNCGGLGETMATRIXPARAMETERARRAYDCPROC cgGLGetMatrixParameterArraydc; - extern PFNCGGLGETMATRIXPARAMETERARRAYDRPROC cgGLGetMatrixParameterArraydr; - extern PFNCGGLSETTEXTUREPARAMETERPROC cgGLSetTextureParameter; - extern PFNCGGLGETTEXTUREPARAMETERPROC cgGLGetTextureParameter; - extern PFNCGGLENABLETEXTUREPARAMETERPROC cgGLEnableTextureParameter; - extern PFNCGGLDISABLETEXTUREPARAMETERPROC cgGLDisableTextureParameter; - extern PFNCGGLGETTEXTUREENUMPROC cgGLGetTextureEnum; - - + + typedef enum + { + CG_GL_MATRIX_IDENTITY = 0, + CG_GL_MATRIX_TRANSPOSE = 1, + CG_GL_MATRIX_INVERSE = 2, + CG_GL_MATRIX_INVERSE_TRANSPOSE = 3, + + CG_GL_MODELVIEW_MATRIX, + CG_GL_PROJECTION_MATRIX, + CG_GL_TEXTURE_MATRIX, + CG_GL_MODELVIEW_PROJECTION_MATRIX, + + CG_GL_VERTEX, + CG_GL_FRAGMENT, + + } CGGLenum; + + + + + typedef CGbool (*PFNCGGLISPROFILESUPPORTEDPROC)(CGprofile profile); + typedef void (*PFNCGGLENABLEPROFILEPROC)(CGprofile profile); + typedef void (*PFNCGGLDISABLEPROFILEPROC)(CGprofile profile); + typedef CGprofile (*PFNCGGLGETLATESTPROFILEPROC)(CGGLenum profile_type); + typedef void (*PFNCGGLSETOPTIMALOPTIONSPROC)(CGprofile profile); + typedef void (*PFNCGGLLOADPROGRAMPROC)(CGprogram program); + typedef void (*PFNCGGLBINDPROGRAMPROC)(CGprogram program); + typedef void (*PFNCGGLSETPARAMETER1FPROC)(CGparameter param, + float x); + typedef void (*PFNCGGLSETPARAMETER2FPROC)(CGparameter param, + float x, + float y); + typedef void (*PFNCGGLSETPARAMETER3FPROC)(CGparameter param, + float x, + float y, + float z); + typedef void (*PFNCGGLSETPARAMETER4FPROC)(CGparameter param, + float x, + float y, + float z, + float w); + typedef void (*PFNCGGLSETPARAMETER1FVPROC)(CGparameter param, const float *v); + typedef void (*PFNCGGLSETPARAMETER2FVPROC)(CGparameter param, const float *v); + typedef void (*PFNCGGLSETPARAMETER3FVPROC)(CGparameter param, const float *v); + typedef void (*PFNCGGLSETPARAMETER4FVPROC)(CGparameter param, const float *v); + typedef void (*PFNCGGLSETPARAMETER1DPROC)(CGparameter param, + double x); + typedef void (*PFNCGGLSETPARAMETER2DPROC)(CGparameter param, + double x, + double y); + typedef void (*PFNCGGLSETPARAMETER3DPROC)(CGparameter param, + double x, + double y, + double z); + typedef void (*PFNCGGLSETPARAMETER4DPROC)(CGparameter param, + double x, + double y, + double z, + double w); + typedef void (*PFNCGGLSETPARAMETER1DVPROC)(CGparameter param, const double *v); + typedef void (*PFNCGGLSETPARAMETER2DVPROC)(CGparameter param, const double *v); + typedef void (*PFNCGGLSETPARAMETER3DVPROC)(CGparameter param, const double *v); + typedef void (*PFNCGGLSETPARAMETER4DVPROC)(CGparameter param, const double *v); + typedef void (*PFNCGGLSETPARAMETER4DVPROC)(CGparameter param, const double *v); + typedef void (*PFNCGGLGETPARAMETER1FPROC)(CGparameter param, float *v); + typedef void (*PFNCGGLGETPARAMETER2FPROC)(CGparameter param, float *v); + typedef void (*PFNCGGLGETPARAMETER3FPROC)(CGparameter param, float *v); + typedef void (*PFNCGGLGETPARAMETER4FPROC)(CGparameter param, float *v); + typedef void (*PFNCGGLGETPARAMETER1DPROC)(CGparameter param, double *v); + typedef void (*PFNCGGLGETPARAMETER2DPROC)(CGparameter param, double *v); + typedef void (*PFNCGGLGETPARAMETER3DPROC)(CGparameter param, double *v); + typedef void (*PFNCGGLGETPARAMETER4DPROC)(CGparameter param, double *v); + typedef void (*PFNCGGLSETPARAMETERARRAY1FPROC)(CGparameter param, + long offset, + long nelements, + const float *v); + typedef void (*PFNCGGLSETPARAMETERARRAY2FPROC)(CGparameter param, + long offset, + long nelements, + const float *v); + typedef void (*PFNCGGLSETPARAMETERARRAY3FPROC)(CGparameter param, + long offset, + long nelements, + const float *v); + typedef void (*PFNCGGLSETPARAMETERARRAY4FPROC)(CGparameter param, + long offset, + long nelements, + const float *v); + typedef void (*PFNCGGLSETPARAMETERARRAY1DPROC)(CGparameter param, + long offset, + long nelements, + const double *v); + typedef void (*PFNCGGLSETPARAMETERARRAY2DPROC)(CGparameter param, + long offset, + long nelements, + const double *v); + typedef void (*PFNCGGLSETPARAMETERARRAY3DPROC)(CGparameter param, + long offset, + long nelements, + const double *v); + typedef void (*PFNCGGLSETPARAMETERARRAY4DPROC)(CGparameter param, + long offset, + long nelements, + const double *v); + typedef void (*PFNCGGLGETPARAMETERARRAY1FPROC)(CGparameter param, + long offset, + long nelements, + float *v); + typedef void (*PFNCGGLGETPARAMETERARRAY2FPROC)(CGparameter param, + long offset, + long nelements, + float *v); + typedef void (*PFNCGGLGETPARAMETERARRAY3FPROC)(CGparameter param, + long offset, + long nelements, + float *v); + typedef void (*PFNCGGLGETPARAMETERARRAY4FPROC)(CGparameter param, + long offset, + long nelements, + float *v); + typedef void (*PFNCGGLGETPARAMETERARRAY1DPROC)(CGparameter param, + long offset, + long nelements, + double *v); + typedef void (*PFNCGGLGETPARAMETERARRAY2DPROC)(CGparameter param, + long offset, + long nelements, + double *v); + typedef void (*PFNCGGLGETPARAMETERARRAY3DPROC)(CGparameter param, + long offset, + long nelements, + double *v); + typedef void (*PFNCGGLGETPARAMETERARRAY4DPROC)(CGparameter param, + long offset, + long nelements, + double *v); + typedef void (*PFNCGGLSETPARAMETERPOINTERPROC)(CGparameter param, + GLint fsize, + GLenum type, + GLsizei stride, + GLvoid *pointer); + typedef void (*PFNCGGLENABLECLIENTSTATEPROC)(CGparameter param); + typedef void (*PFNCGGLDISABLECLIENTSTATEPROC)(CGparameter param); + typedef void (*PFNCGGLSETMATRIXPARAMETERDRPROC)(CGparameter param, const double *matrix); + typedef void (*PFNCGGLSETMATRIXPARAMETERFRPROC)(CGparameter param, const float *matrix); + typedef void (*PFNCGGLSETMATRIXPARAMETERDCPROC)(CGparameter param, const double *matrix); + typedef void (*PFNCGGLSETMATRIXPARAMETERFCPROC)(CGparameter param, const float *matrix); + typedef void (*PFNCGGLGETMATRIXPARAMETERDRPROC)(CGparameter param, double *matrix); + typedef void (*PFNCGGLGETMATRIXPARAMETERFRPROC)(CGparameter param, float *matrix); + typedef void (*PFNCGGLGETMATRIXPARAMETERDCPROC)(CGparameter param, double *matrix); + typedef void (*PFNCGGLGETMATRIXPARAMETERFCPROC)(CGparameter param, float *matrix); + typedef void (*PFNCGGLSETSTATEMATRIXPARAMETERPROC)(CGparameter param, + GLenum matrix, + GLenum transform); + typedef void (*PFNCGGLSETMATRIXPARAMETERARRAYFCPROC)(CGparameter param, + long offset, + long nelements, + const float *matrices); + typedef void (*PFNCGGLSETMATRIXPARAMETERARRAYFRPROC)(CGparameter param, + long offset, + long nelements, + const float *matrices); + typedef void (*PFNCGGLSETMATRIXPARAMETERARRAYDCPROC)(CGparameter param, + long offset, + long nelements, + const double *matrices); + typedef void (*PFNCGGLSETMATRIXPARAMETERARRAYDRPROC)(CGparameter param, + long offset, + long nelements, + const double *matrices); + typedef void (*PFNCGGLGETMATRIXPARAMETERARRAYFCPROC)(CGparameter param, + long offset, + long nelements, + float *matrices); + typedef void (*PFNCGGLGETMATRIXPARAMETERARRAYFRPROC)(CGparameter param, + long offset, + long nelements, + float *matrices); + typedef void (*PFNCGGLGETMATRIXPARAMETERARRAYDCPROC)(CGparameter param, + long offset, + long nelements, + double *matrices); + typedef void (*PFNCGGLGETMATRIXPARAMETERARRAYDRPROC)(CGparameter param, + long offset, + long nelements, + double *matrices); + typedef void (*PFNCGGLSETTEXTUREPARAMETERPROC)(CGparameter param, GLuint texobj); + typedef GLuint (*PFNCGGLGETTEXTUREPARAMETERPROC)(CGparameter param); + typedef void (*PFNCGGLENABLETEXTUREPARAMETERPROC)(CGparameter param); + typedef void (*PFNCGGLDISABLETEXTUREPARAMETERPROC)(CGparameter param); + typedef GLenum (*PFNCGGLGETTEXTUREENUMPROC)(CGparameter param); + + + extern PFNCGGLISPROFILESUPPORTEDPROC cgGLIsProfileSupported; + extern PFNCGGLENABLEPROFILEPROC cgGLEnableProfile; + extern PFNCGGLDISABLEPROFILEPROC cgGLDisableProfile; + extern PFNCGGLGETLATESTPROFILEPROC cgGLGetLatestProfile; + extern PFNCGGLSETOPTIMALOPTIONSPROC cgGLSetOptimalOptions; + extern PFNCGGLLOADPROGRAMPROC cgGLLoadProgram; + extern PFNCGGLBINDPROGRAMPROC cgGLBindProgram; + extern PFNCGGLSETPARAMETER1FPROC cgGLSetParameter1f; + extern PFNCGGLSETPARAMETER2FPROC cgGLSetParameter2f; + extern PFNCGGLSETPARAMETER3FPROC cgGLSetParameter3f; + extern PFNCGGLSETPARAMETER4FPROC cgGLSetParameter4f; + extern PFNCGGLSETPARAMETER1FVPROC cgGLSetParameter1fv; + extern PFNCGGLSETPARAMETER2FVPROC cgGLSetParameter2fv; + extern PFNCGGLSETPARAMETER3FVPROC cgGLSetParameter3fv; + extern PFNCGGLSETPARAMETER4FVPROC cgGLSetParameter4fv; + extern PFNCGGLSETPARAMETER1DPROC cgGLSetParameter1d; + extern PFNCGGLSETPARAMETER2DPROC cgGLSetParameter2d; + extern PFNCGGLSETPARAMETER3DPROC cgGLSetParameter3d; + extern PFNCGGLSETPARAMETER4DPROC cgGLSetParameter4d; + extern PFNCGGLSETPARAMETER1DVPROC cgGLSetParameter1dv; + extern PFNCGGLSETPARAMETER2DVPROC cgGLSetParameter2dv; + extern PFNCGGLSETPARAMETER3DVPROC cgGLSetParameter3dv; + extern PFNCGGLSETPARAMETER4DVPROC cgGLSetParameter4dv; + extern PFNCGGLGETPARAMETER1FPROC cgGLGetParameter1f; + extern PFNCGGLGETPARAMETER2FPROC cgGLGetParameter2f; + extern PFNCGGLGETPARAMETER3FPROC cgGLGetParameter3f; + extern PFNCGGLGETPARAMETER4FPROC cgGLGetParameter4f; + extern PFNCGGLGETPARAMETER1DPROC cgGLGetParameter1d; + extern PFNCGGLGETPARAMETER2DPROC cgGLGetParameter2d; + extern PFNCGGLGETPARAMETER3DPROC cgGLGetParameter3d; + extern PFNCGGLGETPARAMETER4DPROC cgGLGetParameter4d; + extern PFNCGGLSETPARAMETERARRAY1FPROC cgGLSetParameterArray1f; + extern PFNCGGLSETPARAMETERARRAY2FPROC cgGLSetParameterArray2f; + extern PFNCGGLSETPARAMETERARRAY3FPROC cgGLSetParameterArray3f; + extern PFNCGGLSETPARAMETERARRAY4FPROC cgGLSetParameterArray4f; + extern PFNCGGLSETPARAMETERARRAY1DPROC cgGLSetParameterArray1d; + extern PFNCGGLSETPARAMETERARRAY2DPROC cgGLSetParameterArray2d; + extern PFNCGGLSETPARAMETERARRAY3DPROC cgGLSetParameterArray3d; + extern PFNCGGLSETPARAMETERARRAY4DPROC cgGLSetParameterArray4d; + extern PFNCGGLGETPARAMETERARRAY1FPROC cgGLGetParameterArray1f; + extern PFNCGGLGETPARAMETERARRAY2FPROC cgGLGetParameterArray2f; + extern PFNCGGLGETPARAMETERARRAY3FPROC cgGLGetParameterArray3f; + extern PFNCGGLGETPARAMETERARRAY4FPROC cgGLGetParameterArray4f; + extern PFNCGGLGETPARAMETERARRAY1DPROC cgGLGetParameterArray1d; + extern PFNCGGLGETPARAMETERARRAY2DPROC cgGLGetParameterArray2d; + extern PFNCGGLGETPARAMETERARRAY3DPROC cgGLGetParameterArray3d; + extern PFNCGGLGETPARAMETERARRAY4DPROC cgGLGetParameterArray4d; + extern PFNCGGLSETPARAMETERPOINTERPROC cgGLSetParameterPointer; + extern PFNCGGLENABLECLIENTSTATEPROC cgGLEnableClientState; + extern PFNCGGLDISABLECLIENTSTATEPROC cgGLDisableClientState; + extern PFNCGGLSETMATRIXPARAMETERDRPROC cgGLSetMatrixParameterdr; + extern PFNCGGLSETMATRIXPARAMETERFRPROC cgGLSetMatrixParameterfr; + extern PFNCGGLSETMATRIXPARAMETERDCPROC cgGLSetMatrixParameterdc; + extern PFNCGGLSETMATRIXPARAMETERFCPROC cgGLSetMatrixParameterfc; + extern PFNCGGLGETMATRIXPARAMETERDRPROC cgGLGetMatrixParameterdr; + extern PFNCGGLGETMATRIXPARAMETERFRPROC cgGLGetMatrixParameterfr; + extern PFNCGGLGETMATRIXPARAMETERDCPROC cgGLGetMatrixParameterdc; + extern PFNCGGLGETMATRIXPARAMETERFCPROC cgGLGetMatrixParameterfc; + extern PFNCGGLSETSTATEMATRIXPARAMETERPROC cgGLSetStateMatrixParameter; + extern PFNCGGLSETMATRIXPARAMETERARRAYFCPROC cgGLSetMatrixParameterArrayfc; + extern PFNCGGLSETMATRIXPARAMETERARRAYFRPROC cgGLSetMatrixParameterArrayfr; + extern PFNCGGLSETMATRIXPARAMETERARRAYDCPROC cgGLSetMatrixParameterArraydc; + extern PFNCGGLSETMATRIXPARAMETERARRAYDRPROC cgGLSetMatrixParameterArraydr; + extern PFNCGGLGETMATRIXPARAMETERARRAYFCPROC cgGLGetMatrixParameterArrayfc; + extern PFNCGGLGETMATRIXPARAMETERARRAYFRPROC cgGLGetMatrixParameterArrayfr; + extern PFNCGGLGETMATRIXPARAMETERARRAYDCPROC cgGLGetMatrixParameterArraydc; + extern PFNCGGLGETMATRIXPARAMETERARRAYDRPROC cgGLGetMatrixParameterArraydr; + extern PFNCGGLSETTEXTUREPARAMETERPROC cgGLSetTextureParameter; + extern PFNCGGLGETTEXTUREPARAMETERPROC cgGLGetTextureParameter; + extern PFNCGGLENABLETEXTUREPARAMETERPROC cgGLEnableTextureParameter; + extern PFNCGGLDISABLETEXTUREPARAMETERPROC cgGLDisableTextureParameter; + extern PFNCGGLGETTEXTUREENUMPROC cgGLGetTextureEnum; + + } bool init_explicit_Cg(); #endif - diff --git a/neo/renderer/draw_arb.cpp b/neo/renderer/draw_arb.cpp index d4597c6e..2c64bf5a 100644 --- a/neo/renderer/draw_arb.cpp +++ b/neo/renderer/draw_arb.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"). @@ -138,7 +138,7 @@ qglDisable( GL_TEXTURE_GEN_Q ); #endif #if 0 -GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO | GLS_DEPTHMASK +GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO | GLS_DEPTHMASK | backEnd.depthFunc ); // the texccords are the non-normalized vector towards the light origin GL_SelectTexture( 0 ); @@ -155,7 +155,7 @@ return; // // draw the bump map result onto the alpha channel // - GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_ZERO | GLS_COLORMASK | GLS_DEPTHMASK + GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_ZERO | GLS_COLORMASK | GLS_DEPTHMASK | backEnd.depthFunc ); // texture 0 will be the per-surface bump map @@ -204,7 +204,7 @@ return; // //----------------------------------------------------- // don't trash alpha - GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_ONE | GLS_ALPHAMASK | GLS_DEPTHMASK + GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_ONE | GLS_ALPHAMASK | GLS_DEPTHMASK | backEnd.depthFunc ); // texture 0 will get the surface color texture @@ -291,7 +291,7 @@ static void RB_ARB_DrawThreeTextureInteraction( const drawInteraction_t *din ) { // // bump map dot cubeMap into the alpha channel // - GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO | GLS_COLORMASK | GLS_DEPTHMASK + GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO | GLS_COLORMASK | GLS_DEPTHMASK | backEnd.depthFunc ); // texture 0 will be the per-surface bump map @@ -340,7 +340,7 @@ static void RB_ARB_DrawThreeTextureInteraction( const drawInteraction_t *din ) { // //----------------------------------------------------- // multiply result by alpha, but don't trash alpha - GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_ONE | GLS_ALPHAMASK | GLS_DEPTHMASK + GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_ONE | GLS_ALPHAMASK | GLS_DEPTHMASK | backEnd.depthFunc ); // texture 0 will get the surface color texture @@ -481,7 +481,7 @@ static void RB_RenderViewLight( viewLight_t *vLight ) { if ( vLight->globalShadows || vLight->localShadows ) { backEnd.currentScissor = vLight->scissorRect; if ( r_useScissor.GetBool() ) { - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); @@ -526,4 +526,3 @@ void RB_ARB_DrawInteractions( void ) { RB_RenderViewLight( vLight ); } } - diff --git a/neo/renderer/draw_arb2.cpp b/neo/renderer/draw_arb2.cpp index 78ce39f5..8c80068f 100644 --- a/neo/renderer/draw_arb2.cpp +++ b/neo/renderer/draw_arb2.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"). @@ -272,7 +272,7 @@ void RB_ARB2_DrawInteractions( void ) { if ( vLight->globalShadows || vLight->localShadows ) { backEnd.currentScissor = vLight->scissorRect; if ( r_useScissor.GetBool() ) { - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); @@ -534,4 +534,3 @@ void R_ARB2_Init( void ) { glConfig.allowARB2Path = true; } - diff --git a/neo/renderer/draw_common.cpp b/neo/renderer/draw_common.cpp index a337c8ad..ad3a7566 100644 --- a/neo/renderer/draw_common.cpp +++ b/neo/renderer/draw_common.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"). @@ -361,7 +361,7 @@ void RB_T_FillDepthBuffer( const drawSurf_t *surf ) { // update the clip plane if needed if ( backEnd.viewDef->numClipPlanes && surf->space != backEnd.currentSpace ) { GL_SelectTexture( 1 ); - + idPlane plane; R_GlobalPlaneToLocal( surf->space->modelMatrix, backEnd.viewDef->clipPlanes[0], plane ); @@ -394,7 +394,7 @@ void RB_T_FillDepthBuffer( const drawSurf_t *surf ) { regs = surf->shaderRegisters; // if all stages of a material have been conditioned off, don't do anything - for ( stage = 0; stage < shader->GetNumStages() ; stage++ ) { + for ( stage = 0; stage < shader->GetNumStages() ; stage++ ) { pStage = shader->GetStage(stage); // check the stage enable condition if ( regs[ pStage->conditionRegister ] != 0 ) { @@ -415,7 +415,7 @@ void RB_T_FillDepthBuffer( const drawSurf_t *surf ) { if ( shader->GetSort() == SS_SUBVIEW ) { GL_State( GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO | GLS_DEPTHFUNC_LESS ); color[0] = - color[1] = + color[1] = color[2] = ( 1.0 / backEnd.overBright ); color[3] = 1; } else { @@ -444,7 +444,7 @@ void RB_T_FillDepthBuffer( const drawSurf_t *surf ) { qglEnable( GL_ALPHA_TEST ); // perforated surfaces may have multiple alpha tested stages - for ( stage = 0; stage < shader->GetNumStages() ; stage++ ) { + for ( stage = 0; stage < shader->GetNumStages() ; stage++ ) { pStage = shader->GetStage(stage); if ( !pStage->hasAlphaTest ) { @@ -718,7 +718,7 @@ void RB_STD_T_RenderShaderPasses( const drawSurf_t *surf ) { // change the scissor if needed if ( r_useScissor.GetBool() && !backEnd.currentScissor.Equals( surf->scissorRect ) ) { backEnd.currentScissor = surf->scissorRect; - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); @@ -745,7 +745,7 @@ void RB_STD_T_RenderShaderPasses( const drawSurf_t *surf ) { qglEnable( GL_POLYGON_OFFSET_FILL ); qglPolygonOffset( r_offsetFactor.GetFloat(), r_offsetUnits.GetFloat() * shader->GetPolygonOffset() ); } - + if ( surf->space->weaponDepthHack ) { RB_EnterWeaponDepthHack(); } @@ -758,7 +758,7 @@ void RB_STD_T_RenderShaderPasses( const drawSurf_t *surf ) { qglVertexPointer( 3, GL_FLOAT, sizeof( idDrawVert ), ac->xyz.ToFloatPtr() ); qglTexCoordPointer( 2, GL_FLOAT, sizeof( idDrawVert ), reinterpret_cast(&ac->st) ); - for ( stage = 0; stage < shader->GetNumStages() ; stage++ ) { + for ( stage = 0; stage < shader->GetNumStages() ; stage++ ) { pStage = shader->GetStage(stage); // check the enable condition @@ -803,7 +803,7 @@ void RB_STD_T_RenderShaderPasses( const drawSurf_t *surf ) { qglEnableClientState( GL_NORMAL_ARRAY ); GL_State( pStage->drawStateBits ); - + qglBindProgramARB( GL_VERTEX_PROGRAM_ARB, newStage->vertexProgram ); qglEnable( GL_VERTEX_PROGRAM_ARB ); @@ -873,7 +873,7 @@ void RB_STD_T_RenderShaderPasses( const drawSurf_t *surf ) { color[3] = regs[ pStage->color.registers[3] ]; // skip the entire stage if an add would be black - if ( ( pStage->drawStateBits & (GLS_SRCBLEND_BITS|GLS_DSTBLEND_BITS) ) == ( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE ) + if ( ( pStage->drawStateBits & (GLS_SRCBLEND_BITS|GLS_DSTBLEND_BITS) ) == ( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE ) && color[0] <= 0 && color[1] <= 0 && color[2] <= 0 ) { continue; } @@ -934,14 +934,14 @@ void RB_STD_T_RenderShaderPasses( const drawSurf_t *surf ) { // set the state GL_State( pStage->drawStateBits ); - + RB_PrepareStageTexturing( pStage, surf, ac ); // draw it RB_DrawElementsWithCounters( tri ); RB_FinishStageTexturing( pStage, surf, ac ); - + if ( pStage->vertexColor != SVC_IGNORE ) { qglDisableClientState( GL_COLOR_ARRAY ); @@ -1079,7 +1079,7 @@ static void RB_T_Shadow( const drawSurf_t *surf ) { numIndexes = tri->numIndexes; } else if ( r_useExternalShadows.GetInteger() == 2 ) { // force to no caps for testing numIndexes = tri->numShadowIndexesNoCaps; - } else if ( !(surf->dsFlags & DSF_VIEW_INSIDE_SHADOW) ) { + } else if ( !(surf->dsFlags & DSF_VIEW_INSIDE_SHADOW) ) { // if we aren't inside the shadow projection, no caps are ever needed needed numIndexes = tri->numShadowIndexesNoCaps; external = true; @@ -1532,7 +1532,7 @@ RB_STD_FogAllLights void RB_STD_FogAllLights( void ) { viewLight_t *vLight; - if ( r_skipFogLights.GetBool() || r_showOverDraw.GetInteger() != 0 + if ( r_skipFogLights.GetBool() || r_showOverDraw.GetInteger() != 0 || backEnd.viewDef->isXraySubview /* dont fog in xray mode*/ ) { return; @@ -1556,7 +1556,7 @@ void RB_STD_FogAllLights( void ) { // units from the origin backEnd.currentScissor = vLight->scissorRect; if ( r_useScissor.GetBool() ) { - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); @@ -1610,8 +1610,8 @@ void RB_STD_LightScale( void ) { // the scissor may be smaller than the viewport for subviews if ( r_useScissor.GetBool() ) { - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.viewDef->scissor.x1, - backEnd.viewDef->viewport.y1 + backEnd.viewDef->scissor.y1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.viewDef->scissor.x1, + backEnd.viewDef->viewport.y1 + backEnd.viewDef->scissor.y1, backEnd.viewDef->scissor.x2 - backEnd.viewDef->scissor.x1 + 1, backEnd.viewDef->scissor.y2 - backEnd.viewDef->scissor.y1 + 1 ); backEnd.currentScissor = backEnd.viewDef->scissor; @@ -1621,8 +1621,8 @@ void RB_STD_LightScale( void ) { qglLoadIdentity(); qglMatrixMode( GL_PROJECTION ); qglPushMatrix(); - qglLoadIdentity(); - qglOrtho( 0, 1, 0, 1, -1, 1 ); + qglLoadIdentity(); + qglOrtho( 0, 1, 0, 1, -1, 1 ); GL_State( GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_SRC_COLOR ); GL_Cull( CT_TWO_SIDED ); // so mirror views also get it @@ -1641,10 +1641,10 @@ void RB_STD_LightScale( void ) { v = v * f * 2; qglBegin( GL_QUADS ); - qglVertex2f( 0,0 ); + qglVertex2f( 0,0 ); qglVertex2f( 0,1 ); - qglVertex2f( 1,1 ); - qglVertex2f( 1,0 ); + qglVertex2f( 1,1 ); + qglVertex2f( 1,0 ); qglEnd(); } diff --git a/neo/renderer/draw_exp.cpp b/neo/renderer/draw_exp.cpp index dc3f8eae..499daa39 100644 --- a/neo/renderer/draw_exp.cpp +++ b/neo/renderer/draw_exp.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"). @@ -245,7 +245,7 @@ static void R_CheckWglErrors( void ) { MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, - NULL + NULL ); #endif err &= 0xffff; @@ -286,7 +286,7 @@ static void R_BindTexImage( HPBUFFERARB pbuffer ) { static void R_ReportTextureParms( void ) { int parms[8]; -// q glGetTexParameteriv( GL_TEXTURE_RECTANGLE_NV, +// q glGetTexParameteriv( GL_TEXTURE_RECTANGLE_NV, qglGetIntegerv( GL_TEXTURE_BINDING_RECTANGLE_NV, parms ); } @@ -342,13 +342,13 @@ static void R_CreateShadowBufferImage( idImage *image ) { memset( data, 0, lightBufferSize*lightBufferSize ); - image->GenerateImage( (byte *)data, 4, 4, + image->GenerateImage( (byte *)data, 4, 4, TF_LINEAR, false, TR_CLAMP_TO_BORDER, TD_HIGH_QUALITY ); // now reset it to a shadow depth image GL_CheckErrors(); - image->uploadWidth = image->uploadHeight = lightBufferSize; - qglTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24_ARB, lightBufferSize, lightBufferSize, + image->uploadWidth = image->uploadHeight = lightBufferSize; + qglTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24_ARB, lightBufferSize, lightBufferSize, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, data ); qglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE ); @@ -375,7 +375,7 @@ static void R_CreateViewAlphaImage( idImage *image ) { } memset( data, 0, viewBufferSize*viewBufferSize ); - image->GenerateImage( (byte *)data, viewBufferSize, viewBufferSize, + image->GenerateImage( (byte *)data, viewBufferSize, viewBufferSize, TF_LINEAR, false, TR_CLAMP, TD_HIGH_QUALITY ); } @@ -413,7 +413,7 @@ static void R_CreateJitterImage16( idImage *image ) { } } - image->GenerateImage( (byte *)data, JITTER_SIZE*16, JITTER_SIZE, + image->GenerateImage( (byte *)data, JITTER_SIZE*16, JITTER_SIZE, TF_NEAREST, false, TR_REPEAT, TD_HIGH_QUALITY ); } @@ -434,7 +434,7 @@ static void R_CreateJitterImage4( idImage *image ) { } } - image->GenerateImage( (byte *)data, JITTER_SIZE*4, JITTER_SIZE, + image->GenerateImage( (byte *)data, JITTER_SIZE*4, JITTER_SIZE, TF_NEAREST, false, TR_REPEAT, TD_HIGH_QUALITY ); } @@ -450,7 +450,7 @@ static void R_CreateJitterImage1( idImage *image ) { } } - image->GenerateImage( (byte *)data, JITTER_SIZE, JITTER_SIZE, + image->GenerateImage( (byte *)data, JITTER_SIZE, JITTER_SIZE, TF_NEAREST, false, TR_REPEAT, TD_HIGH_QUALITY ); } @@ -466,7 +466,7 @@ static void R_CreateRandom256Image( idImage *image ) { } } - image->GenerateImage( (byte *)data, 256, 256, + image->GenerateImage( (byte *)data, 256, 256, TF_NEAREST, false, TR_REPEAT, TD_HIGH_QUALITY ); } @@ -530,7 +530,7 @@ void R_Exp_Allocate( void ) { *atr_p++ = 0; *atr_p++ = 0; - ret = wglChoosePixelFormatARB( win32.hDC, iAttributes, fAttributes, + ret = wglChoosePixelFormatARB( win32.hDC, iAttributes, fAttributes, sizeof( pixelformats ) / sizeof( pixelformats[0] ), pixelformats, &numFormats ); #if 0 @@ -543,7 +543,7 @@ void R_Exp_Allocate( void ) { // allocate a pbuffer with this pixel format int pbiAttributesTexture[] = { - WGL_TEXTURE_FORMAT_ARB, WGL_TEXTURE_FLOAT_RGBA_NV, + WGL_TEXTURE_FORMAT_ARB, WGL_TEXTURE_FLOAT_RGBA_NV, WGL_TEXTURE_TARGET_ARB, WGL_TEXTURE_RECTANGLE_NV, // WGL_TEXTURE_2D_ARB, 0, 0}; @@ -577,7 +577,7 @@ void R_Exp_Allocate( void ) { floatPbufferQuarterImage = globalImages->ImageFromFunction( "floatPbufferQuarter", R_CreateStubImage ); // create a new GL context for this pixel format and share textures - floatContext = wglCreateContext( floatPbufferDC ); + floatContext = wglCreateContext( floatPbufferDC ); if ( !floatContext ) { common->Printf( "failed to create context for floatPbufferDC.\n" ); GL_CheckErrors(); @@ -589,7 +589,7 @@ void R_Exp_Allocate( void ) { // create a rendering context for this pixel format and share textures - // allocate a texture for the rendering + // allocate a texture for the rendering #endif @@ -617,11 +617,11 @@ void R_Exp_Allocate( void ) { *atr_p++ = 0; *atr_p++ = 0; - ret = wglChoosePixelFormatARB( win32.hDC, iAttributes, fAttributes, + ret = wglChoosePixelFormatARB( win32.hDC, iAttributes, fAttributes, sizeof( pixelformats ) / sizeof( pixelformats[0] ), pixelformats, &numFormats ); #if 0 for ( int i = 0 ; i < (int)numFormats ; i++ ) { - R_PrintPixelFormat( pixelformats[i] ); + R_PrintPixelFormat( pixelformats[i] ); } #endif common->Printf( "\nshadowPbuffer:\n" ); @@ -812,7 +812,7 @@ void RB_EXP_RenderOccluders( viewLight_t *vLight ) { // render it const srfTriangles_t *tri = surfInt->ambientTris; if ( !tri->ambientCache ) { - R_CreateAmbientCache( const_cast(tri), false ); + R_CreateAmbientCache( const_cast(tri), false ); } idDrawVert *ac = (idDrawVert *)vertexCache.Position( tri->ambientCache ); qglVertexPointer( 3, GL_FLOAT, sizeof( idDrawVert ), ac->xyz.ToFloatPtr() ); @@ -1076,7 +1076,7 @@ qglEnableClientState( GL_TEXTURE_COORD_ARRAY ); // draw a full screen quad qglMatrixMode( GL_PROJECTION ); - qglLoadIdentity(); + qglLoadIdentity(); qglOrtho( 0, 1, 0, 1, -1, 1 ); qglMatrixMode( GL_MODELVIEW ); qglLoadIdentity(); @@ -1212,7 +1212,7 @@ qglProgramEnvParameter4fvARB( GL_VERTEX_PROGRAM_ARB, 21, qRow ); qglProgramLocalParameter4fvARB( GL_FRAGMENT_PROGRAM_ARB, 2, parm ); // jitter tex scale - parm[0] = + parm[0] = parm[1] = r_sb_jitterScale.GetFloat() * lightBufferSizeFraction; parm[2] = -r_sb_biasScale.GetFloat(); parm[3] = 0; @@ -1403,21 +1403,21 @@ GL_State( GLS_DEPTHMASK | GLS_DEPTHFUNC_ALWAYS );//!@# } void InvertByTranspose( const float a[16], float r[16] ) { - r[ 0] = a[ 0]; - r[ 1] = a[ 4]; - r[ 2] = a[ 8]; + r[ 0] = a[ 0]; + r[ 1] = a[ 4]; + r[ 2] = a[ 8]; r[ 3] = 0; - r[ 4] = a[ 1]; - r[ 5] = a[ 5]; - r[ 6] = a[ 9]; + r[ 4] = a[ 1]; + r[ 5] = a[ 5]; + r[ 6] = a[ 9]; r[ 7] = 0; - r[ 8] = a[ 2]; - r[ 9] = a[ 6]; - r[10] = a[10]; + r[ 8] = a[ 2]; + r[ 9] = a[ 6]; + r[10] = a[10]; r[11] = 0; - r[12] = -(r[ 0]*a[12] + r[ 4]*a[13] + r[ 8]*a[14]); - r[13] = -(r[ 1]*a[12] + r[ 5]*a[13] + r[ 9]*a[14]); - r[14] = -(r[ 2]*a[12] + r[ 6]*a[13] + r[10]*a[14]); + r[12] = -(r[ 0]*a[12] + r[ 4]*a[13] + r[ 8]*a[14]); + r[13] = -(r[ 1]*a[12] + r[ 5]*a[13] + r[ 9]*a[14]); + r[14] = -(r[ 2]*a[12] + r[ 6]*a[13] + r[10]*a[14]); r[15] = 1; } @@ -1600,8 +1600,8 @@ void RB_Exp_SelectFrustum( viewLight_t *vLight, int side ) { GL_Cull( CT_FRONT_SIDED ); RB_DrawElementsWithCounters( tri ); - - // draw back faces of the light frustum with + + // draw back faces of the light frustum with // depth test greater // stencil test of equal 1 // zero stencil stencil when depth test passes, so subsequent surface drawing @@ -1766,7 +1766,7 @@ PARAM jitterTexOffset = program.local[9]; qglProgramLocalParameter4fvARB( GL_FRAGMENT_PROGRAM_ARB, 7, parm ); // jitter tex scale - parm[0] = + parm[0] = parm[1] = r_sb_jitterScale.GetFloat() * lightBufferSizeFraction; parm[2] = -r_sb_biasScale.GetFloat(); parm[3] = 0; @@ -1895,12 +1895,12 @@ void R_EXP_RenderViewDepthImage( void ) { qglLoadMatrixf( backEnd.viewDef->projectionMatrix ); qglMatrixMode( GL_MODELVIEW ); - qglViewport( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1, - tr.viewportOffset[1] + backEnd.viewDef->viewport.y1, + qglViewport( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1, + tr.viewportOffset[1] + backEnd.viewDef->viewport.y1, backEnd.viewDef->viewport.x2 + 1 - backEnd.viewDef->viewport.x1, backEnd.viewDef->viewport.y2 + 1 - backEnd.viewDef->viewport.y1 ); - qglScissor( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1, - tr.viewportOffset[1] + backEnd.viewDef->viewport.y1, + qglScissor( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1, + tr.viewportOffset[1] + backEnd.viewDef->viewport.y1, backEnd.viewDef->viewport.x2 + 1 - backEnd.viewDef->viewport.x1, backEnd.viewDef->viewport.y2 + 1 - backEnd.viewDef->viewport.y1 ); @@ -1925,14 +1925,14 @@ void RB_EXP_SetNativeBuffer( void ) { // set the normal screen drawable current R_MakeCurrent( win32.hDC, win32.hGLRC, NULL ); - qglViewport( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1, - tr.viewportOffset[1] + backEnd.viewDef->viewport.y1, + qglViewport( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1, + tr.viewportOffset[1] + backEnd.viewDef->viewport.y1, backEnd.viewDef->viewport.x2 + 1 - backEnd.viewDef->viewport.x1, backEnd.viewDef->viewport.y2 + 1 - backEnd.viewDef->viewport.y1 ); backEnd.currentScissor = backEnd.viewDef->viewport; if ( r_useScissor.GetBool() ) { - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); @@ -1956,8 +1956,8 @@ void RB_EXP_SetRenderBuffer( viewLight_t *vLight ) { } } - qglViewport( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1, - tr.viewportOffset[1] + backEnd.viewDef->viewport.y1, + qglViewport( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1, + tr.viewportOffset[1] + backEnd.viewDef->viewport.y1, backEnd.viewDef->viewport.x2 + 1 - backEnd.viewDef->viewport.x1, backEnd.viewDef->viewport.y2 + 1 - backEnd.viewDef->viewport.y1 ); @@ -1967,7 +1967,7 @@ void RB_EXP_SetRenderBuffer( viewLight_t *vLight ) { backEnd.currentScissor = vLight->scissorRect; } if ( r_useScissor.GetBool() ) { - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); @@ -2013,8 +2013,8 @@ void RB_shadowResampleAlpha( void ) { // set fragment / vertex program? RB_DrawElementsWithCounters( tri ); - - // draw back faces of the light frustum with + + // draw back faces of the light frustum with // depth test greater // stencil test of equal 1 // zero stencil stencil when depth test passes, so subsequent interaction drawing @@ -2077,7 +2077,7 @@ RB_EXP_CoverScreen void RB_EXP_CoverScreen( void ) { // draw a full screen quad qglMatrixMode( GL_PROJECTION ); - qglLoadIdentity(); + qglLoadIdentity(); qglOrtho( 0, 1, 0, 1, -1, 1 ); qglMatrixMode( GL_MODELVIEW ); qglLoadIdentity(); @@ -2122,9 +2122,9 @@ void RB_EXP_ReadFloatBuffer( void ) { GL_State( GLS_DEPTHFUNC_ALWAYS ); qglColor3f( 1, 1, 1 ); qglPushMatrix(); - qglLoadIdentity(); + qglLoadIdentity(); qglDisable( GL_TEXTURE_2D ); - qglOrtho( 0, 1, 0, 1, -1, 1 ); + qglOrtho( 0, 1, 0, 1, -1, 1 ); qglRasterPos2f( 0.01f, 0.01f ); qglDrawPixels( glConfig.vidWidth, glConfig.vidHeight, GL_RGBA, GL_FLOAT, buf ); qglPopMatrix(); @@ -2399,7 +2399,7 @@ void RB_Exp_DrawInteractions( void ) { } else { nativeViewBuffer = false; } - + // set up for either point sampled or percentage-closer filtering for the shadow sampling shadowImage[0]->BindFragment(); if ( r_sb_linearFilter.GetBool() ) { @@ -2468,7 +2468,7 @@ void RB_Exp_DrawInteractions( void ) { } if ( !vLight->frustumTris->ambientCache ) { - R_CreateAmbientCache( const_cast(vLight->frustumTris), false ); + R_CreateAmbientCache( const_cast(vLight->frustumTris), false ); } // all light side projections must currently match, so non-centered diff --git a/neo/renderer/draw_exp_stub.cpp b/neo/renderer/draw_exp_stub.cpp index b61ad673..ae75084a 100644 --- a/neo/renderer/draw_exp_stub.cpp +++ b/neo/renderer/draw_exp_stub.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/neo/renderer/draw_nv10.cpp b/neo/renderer/draw_nv10.cpp index ca44aff3..90c3532d 100644 --- a/neo/renderer/draw_nv10.cpp +++ b/neo/renderer/draw_nv10.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 @@ static void RB_RenderInteraction( const drawSurf_t *surf ) { const srfTriangles_t *tri = surf->geo; const shaderStage_t *lastBumpStage = NULL; - RB_LogComment( "---------- RB_RenderInteraction %s on %s ----------\n", + RB_LogComment( "---------- RB_RenderInteraction %s on %s ----------\n", lightShader->GetName(), surfaceShader->GetName() ); // change the matrix and light projection vectors if needed @@ -78,7 +78,7 @@ static void RB_RenderInteraction( const drawSurf_t *surf ) { // change the scissor if needed if ( r_useScissor.GetBool() && !backEnd.currentScissor.Equals( surf->scissorRect ) ) { backEnd.currentScissor = surf->scissorRect; - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); @@ -166,20 +166,20 @@ static void RB_RenderInteraction( const drawSurf_t *surf ) { qglCombinerParameterfvNV( GL_CONSTANT_COLOR0_NV, tr.ambientLightVector.ToFloatPtr() ); // stage 0 sets primary_color = bump dot constant color - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_CONSTANT_COLOR0_NV, GL_EXPAND_NORMAL_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_TEXTURE0_ARB, GL_EXPAND_NORMAL_NV, GL_RGB ); - qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, GL_PRIMARY_COLOR_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE ); // stage 1 alpha sets primary_color = primary_color * falloff - qglCombinerInputNV( GL_COMBINER1_NV, GL_ALPHA, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER1_NV, GL_ALPHA, GL_VARIABLE_A_NV, GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_BLUE ); - qglCombinerInputNV( GL_COMBINER1_NV, GL_ALPHA, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER1_NV, GL_ALPHA, GL_VARIABLE_B_NV, GL_TEXTURE1_ARB, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA ); - qglCombinerOutputNV( GL_COMBINER1_NV, GL_ALPHA, + qglCombinerOutputNV( GL_COMBINER1_NV, GL_ALPHA, GL_PRIMARY_COLOR_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE ); @@ -219,7 +219,7 @@ static void RB_RenderInteraction( const drawSurf_t *surf ) { // make sure a combiner output doesn't step on the texture qglCombinerParameteriNV( GL_NUM_GENERAL_COMBINERS_NV, 1 ); - qglCombinerOutputNV( GL_COMBINER0_NV, GL_ALPHA, + qglCombinerOutputNV( GL_COMBINER0_NV, GL_ALPHA, GL_DISCARD_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE ); @@ -243,7 +243,7 @@ static void RB_RenderInteraction( const drawSurf_t *surf ) { // // draw the bump map result onto the alpha channel // - GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_ZERO | GLS_COLORMASK | GLS_DEPTHMASK + GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_ZERO | GLS_COLORMASK | GLS_DEPTHMASK | backEnd.depthFunc ); // texture 0 will be the per-surface bump map @@ -266,11 +266,11 @@ static void RB_RenderInteraction( const drawSurf_t *surf ) { // stage 0 rgb performs the dot product // SPARE0 = TEXTURE0 dot TEXTURE1 - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE1_ARB, GL_EXPAND_NORMAL_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_TEXTURE0_ARB, GL_EXPAND_NORMAL_NV, GL_RGB ); - qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE ); @@ -321,7 +321,7 @@ static void RB_RenderInteraction( const drawSurf_t *surf ) { continue; } - GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_SRC_ALPHA | GLS_COLORMASK | GLS_DEPTHMASK + GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_SRC_ALPHA | GLS_COLORMASK | GLS_DEPTHMASK | backEnd.depthFunc ); // texture 0 will be the per-surface bump map @@ -347,32 +347,32 @@ static void RB_RenderInteraction( const drawSurf_t *surf ) { // stage 0 rgb performs the dot product // GL_PRIMARY_COLOR_NV = ( TEXTURE0 dot TEXTURE1 - 0.5 ) * 2 // the scale and bias steepen the specular curve - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE1_ARB, GL_EXPAND_NORMAL_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_TEXTURE0_ARB, GL_EXPAND_NORMAL_NV, GL_RGB ); - qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, GL_PRIMARY_COLOR_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_SCALE_BY_TWO_NV, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_TRUE, GL_FALSE, GL_FALSE ); // stage 0 alpha does nothing - qglCombinerOutputNV( GL_COMBINER0_NV, GL_ALPHA, + qglCombinerOutputNV( GL_COMBINER0_NV, GL_ALPHA, GL_DISCARD_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE ); // stage 1 rgb does nothing - qglCombinerOutputNV( GL_COMBINER1_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER1_NV, GL_RGB, GL_PRIMARY_COLOR_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE ); // stage 1 alpha takes bump * bump // PRIMARY_COLOR = ( GL_PRIMARY_COLOR_NV * GL_PRIMARY_COLOR_NV - 0.5 ) * 2 // the scale and bias steepen the specular curve - qglCombinerInputNV( GL_COMBINER1_NV, GL_ALPHA, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER1_NV, GL_ALPHA, GL_VARIABLE_A_NV, GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_BLUE ); - qglCombinerInputNV( GL_COMBINER1_NV, GL_ALPHA, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER1_NV, GL_ALPHA, GL_VARIABLE_B_NV, GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_BLUE ); - qglCombinerOutputNV( GL_COMBINER1_NV, GL_ALPHA, + qglCombinerOutputNV( GL_COMBINER1_NV, GL_ALPHA, GL_PRIMARY_COLOR_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_SCALE_BY_TWO_NV, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE ); @@ -412,7 +412,7 @@ static void RB_RenderInteraction( const drawSurf_t *surf ) { //----------------------------------------------------- if ( surfaceStage->lighting == SL_DIFFUSE || surfaceStage->lighting == SL_SPECULAR ) { // don't trash alpha - GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_ONE | GLS_ALPHAMASK | GLS_DEPTHMASK + GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_ONE | GLS_ALPHAMASK | GLS_DEPTHMASK | backEnd.depthFunc ); // texture 0 will get the surface color texture @@ -441,27 +441,27 @@ static void RB_RenderInteraction( const drawSurf_t *surf ) { // SPARE0 = TEXTURE0 * PRIMARY_COLOR // SPARE1 = TEXTURE1 * CONSTANT_COLOR - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); // variable B will be overriden based on the stage vertexColor option if ( surfaceStage->vertexColor == SVC_MODULATE ) { - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); qglEnableClientState( GL_COLOR_ARRAY ); } else if ( surfaceStage->vertexColor == SVC_INVERSE_MODULATE ) { - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_PRIMARY_COLOR_NV, GL_UNSIGNED_INVERT_NV, GL_RGB ); qglEnableClientState( GL_COLOR_ARRAY ); } else { // SVC_IGNORE - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_RGB ); qglDisableClientState( GL_COLOR_ARRAY ); } - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV, GL_TEXTURE1_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV, GL_CONSTANT_COLOR1_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, GL_SPARE0_NV, GL_SPARE1_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE ); @@ -583,7 +583,7 @@ static void RB_RenderViewLight( viewLight_t *vLight ) { if ( vLight->globalShadows || vLight->localShadows ) { backEnd.currentScissor = vLight->scissorRect; if ( r_useScissor.GetBool() ) { - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); diff --git a/neo/renderer/draw_nv20.cpp b/neo/renderer/draw_nv20.cpp index 78b3124d..08466f94 100644 --- a/neo/renderer/draw_nv20.cpp +++ b/neo/renderer/draw_nv20.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,22 +80,22 @@ static void RB_NV20_BumpAndLightFragment( void ) { // stage 0 rgb performs the dot product // SPARE0 = TEXTURE0 dot TEXTURE1 - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE1_ARB, GL_EXPAND_NORMAL_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_TEXTURE0_ARB, GL_EXPAND_NORMAL_NV, GL_RGB ); - qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE ); // stage 1 rgb multiplies texture 2 and 3 together // SPARE1 = TEXTURE2 * TEXTURE3 - qglCombinerInputNV( GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE2_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV, GL_TEXTURE3_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerOutputNV( GL_COMBINER1_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER1_NV, GL_RGB, GL_SPARE1_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE ); @@ -103,21 +103,21 @@ static void RB_NV20_BumpAndLightFragment( void ) { // stage 2 color multiplies spare0 * spare 1 just for debugging // SPARE0 = SPARE0 * SPARE1 - qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_A_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_B_NV, GL_SPARE1_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerOutputNV( GL_COMBINER2_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER2_NV, GL_RGB, GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE ); // stage 2 alpha multiples spare0 * spare 1 // SPARE0 = SPARE0 * SPARE1 - qglCombinerInputNV( GL_COMBINER2_NV, GL_ALPHA, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER2_NV, GL_ALPHA, GL_VARIABLE_A_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_BLUE ); - qglCombinerInputNV( GL_COMBINER2_NV, GL_ALPHA, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER2_NV, GL_ALPHA, GL_VARIABLE_B_NV, GL_SPARE1_NV, GL_UNSIGNED_IDENTITY_NV, GL_BLUE ); - qglCombinerOutputNV( GL_COMBINER2_NV, GL_ALPHA, + qglCombinerOutputNV( GL_COMBINER2_NV, GL_ALPHA, GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE ); @@ -221,15 +221,15 @@ static void RB_NV20_DiffuseColorFragment( void ) { // stage 0 is free, so we always do the multiply of the vertex color // when the vertex color is inverted, qglCombinerInputNV(GL_VARIABLE_B_NV) will be changed - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, GL_TEXTURE0_ARB, GL_DISCARD_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE ); - qglCombinerOutputNV( GL_COMBINER0_NV, GL_ALPHA, + qglCombinerOutputNV( GL_COMBINER0_NV, GL_ALPHA, GL_DISCARD_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE ); @@ -261,7 +261,7 @@ RB_NV20_DI_DiffuseColorPass static void RB_NV20_DI_DiffuseColorPass( const drawInteraction_t *din ) { RB_LogComment( "---------- RB_NV20_DiffuseColorPass ----------\n" ); - GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_ONE | GLS_DEPTHMASK | GLS_ALPHAMASK + GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_ONE | GLS_DEPTHMASK | GLS_ALPHAMASK | backEnd.depthFunc ); // texture 0 will be the per-surface diffuse map @@ -305,7 +305,7 @@ static void RB_NV20_DI_DiffuseColorPass( const drawInteraction_t *din ) { // override one parameter for inverted vertex color if ( din->vertexColor == SVC_INVERSE_MODULATE ) { - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_PRIMARY_COLOR_NV, GL_UNSIGNED_INVERT_NV, GL_RGB ); } @@ -335,11 +335,11 @@ static void RB_NV20_SpecularColorFragment( void ) { // GL_SPARE0_NV = ( TEXTURE0 dot TEXTURE1 - 0.5 ) * 2 // TEXTURE2 = TEXTURE2 * PRIMARY_COLOR // the scale and bias steepen the specular curve - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE1_ARB, GL_EXPAND_NORMAL_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_TEXTURE0_ARB, GL_EXPAND_NORMAL_NV, GL_RGB ); - qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_SCALE_BY_TWO_NV, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_TRUE, GL_FALSE, GL_FALSE ); @@ -348,11 +348,11 @@ static void RB_NV20_SpecularColorFragment( void ) { // stage 1 color takes bump * bump // GL_SPARE0_NV = ( GL_SPARE0_NV * GL_SPARE0_NV - 0.5 ) * 2 // the scale and bias steepen the specular curve - qglCombinerInputNV( GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerOutputNV( GL_COMBINER1_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER1_NV, GL_RGB, GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_SCALE_BY_TWO_NV, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE ); @@ -361,15 +361,15 @@ static void RB_NV20_SpecularColorFragment( void ) { // stage 2 color // GL_SPARE0_NV = GL_SPARE0_NV * TEXTURE3 // SECONDARY_COLOR = CONSTANT_COLOR * TEXTURE2 - qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_A_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_B_NV, GL_TEXTURE3_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_C_NV, + qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_C_NV, GL_CONSTANT_COLOR1_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_D_NV, + qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_D_NV, GL_TEXTURE2_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerOutputNV( GL_COMBINER2_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER2_NV, GL_RGB, GL_SPARE0_NV, GL_SECONDARY_COLOR_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE ); @@ -377,11 +377,11 @@ static void RB_NV20_SpecularColorFragment( void ) { // stage 3 scales the texture by the vertex color - qglCombinerInputNV( GL_COMBINER3_NV, GL_RGB, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER3_NV, GL_RGB, GL_VARIABLE_A_NV, GL_SECONDARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER3_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER3_NV, GL_RGB, GL_VARIABLE_B_NV, GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerOutputNV( GL_COMBINER3_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER3_NV, GL_RGB, GL_SECONDARY_COLOR_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE ); @@ -458,7 +458,7 @@ static void RB_NV20_DI_SpecularColorPass( const drawInteraction_t *din ) { // override one parameter for inverted vertex color if ( din->vertexColor == SVC_INVERSE_MODULATE ) { - qglCombinerInputNV( GL_COMBINER3_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER3_NV, GL_RGB, GL_VARIABLE_B_NV, GL_PRIMARY_COLOR_NV, GL_UNSIGNED_INVERT_NV, GL_RGB ); } @@ -489,11 +489,11 @@ static void RB_NV20_DiffuseAndSpecularColorFragment( void ) { // stage 0 rgb performs the dot product // GL_SECONDARY_COLOR_NV = ( TEXTURE0 dot TEXTURE1 - 0.5 ) * 2 // the scale and bias steepen the specular curve - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE1_ARB, GL_EXPAND_NORMAL_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_TEXTURE0_ARB, GL_EXPAND_NORMAL_NV, GL_RGB ); - qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER0_NV, GL_RGB, GL_SECONDARY_COLOR_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_SCALE_BY_TWO_NV, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_TRUE, GL_FALSE, GL_FALSE ); @@ -502,11 +502,11 @@ static void RB_NV20_DiffuseAndSpecularColorFragment( void ) { // stage 1 color takes bump * bump // PRIMARY_COLOR = ( GL_SECONDARY_COLOR_NV * GL_SECONDARY_COLOR_NV - 0.5 ) * 2 // the scale and bias steepen the specular curve - qglCombinerInputNV( GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV, GL_SECONDARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV, GL_SECONDARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerOutputNV( GL_COMBINER1_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER1_NV, GL_RGB, GL_SECONDARY_COLOR_NV, GL_DISCARD_NV, GL_DISCARD_NV, GL_SCALE_BY_TWO_NV, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE ); @@ -515,15 +515,15 @@ static void RB_NV20_DiffuseAndSpecularColorFragment( void ) { // stage 2 color // PRIMARY_COLOR = ( PRIMARY_COLOR * TEXTURE3 ) * 2 // SPARE0 = 1.0 * 1.0 (needed for final combiner) - qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_A_NV, + qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_A_NV, GL_SECONDARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_B_NV, + qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_B_NV, GL_TEXTURE3_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_C_NV, + qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_C_NV, GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_RGB ); - qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_D_NV, + qglCombinerInputNV( GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_D_NV, GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_RGB ); - qglCombinerOutputNV( GL_COMBINER2_NV, GL_RGB, + qglCombinerOutputNV( GL_COMBINER2_NV, GL_RGB, GL_SECONDARY_COLOR_NV, GL_SPARE0_NV, GL_DISCARD_NV, GL_SCALE_BY_TWO_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE ); @@ -643,7 +643,7 @@ static void RB_NV20_DrawInteraction( const drawInteraction_t *din ) { // monochrome light is two passes int internalFormat = din->lightImage->internalFormat; - if ( ( r_useNV20MonoLights.GetInteger() == 2 ) || + if ( ( r_useNV20MonoLights.GetInteger() == 2 ) || ( din->lightImage->isMonochrome && r_useNV20MonoLights.GetInteger() ) ) { // do a two-pass rendering RB_NV20_DI_BumpAndLightPass( din, true ); @@ -723,15 +723,15 @@ static void RB_NV20_CreateDrawInteractions( const drawSurf_t *surf ) { GL_SelectTexture( 3 ); globalImages->BindNull(); qglDisableClientState( GL_TEXTURE_COORD_ARRAY ); - + GL_SelectTexture( 2 ); globalImages->BindNull(); qglDisableClientState( GL_TEXTURE_COORD_ARRAY ); - + GL_SelectTexture( 1 ); globalImages->BindNull(); qglDisableClientState( GL_TEXTURE_COORD_ARRAY ); -#else +#else GL_SelectTextureNoClient( 3 ); globalImages->BindNull(); @@ -787,7 +787,7 @@ void RB_NV20_DrawInteractions( void ) { if ( vLight->globalShadows || vLight->localShadows ) { backEnd.currentScissor = vLight->scissorRect; if ( r_useScissor.GetBool() ) { - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); @@ -882,4 +882,3 @@ void R_NV20_Init( void ) { glConfig.allowNV20Path = true; } - diff --git a/neo/renderer/draw_r200.cpp b/neo/renderer/draw_r200.cpp index efa76394..d65b9015 100644 --- a/neo/renderer/draw_r200.cpp +++ b/neo/renderer/draw_r200.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"). @@ -295,7 +295,7 @@ void RB_R200_DrawInteractions( void ) { if ( vLight->globalShadows || vLight->localShadows ) { backEnd.currentScissor = vLight->scissorRect; if ( r_useScissor.GetBool() ) { - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); @@ -414,7 +414,7 @@ static void R_BuildSurfaceFragmentProgram( int programNum ) { // normalize the specular halfangle qglSampleMapATI( GL_REG_5_ATI, GL_TEXTURE4_ARB, GL_SWIZZLE_STR_ATI ); - + // R1 = halfangle dot surfaceNormal qglColorFragmentOp2ATI( GL_DOT3_ATI, GL_REG_1_ATI, GL_NONE, GL_SATURATE_BIT_ATI, GL_REG_4_ATI, GL_NONE, GL_2X_BIT_ATI | GL_BIAS_BIT_ATI, diff --git a/neo/renderer/glext.h b/neo/renderer/glext.h index 7f15730f..38262d99 100644 --- a/neo/renderer/glext.h +++ b/neo/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/neo/renderer/qgl.h b/neo/renderer/qgl.h index b3154444..855d0e65 100644 --- a/neo/renderer/qgl.h +++ b/neo/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/neo/renderer/qgl_linked.h b/neo/renderer/qgl_linked.h index 832c6ef2..f5bfc7a3 100644 --- a/neo/renderer/qgl_linked.h +++ b/neo/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/neo/renderer/simplex.h b/neo/renderer/simplex.h index b9847a91..0df50026 100644 --- a/neo/renderer/simplex.h +++ b/neo/renderer/simplex.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"). @@ -34,13 +34,13 @@ const static int simplex[NUM_SIMPLEX_CHARS][112] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 8,10, /* Ascii 33 */ - 5,21, 5, 7,-1,-1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2,-1,-1,-1,-1,-1,-1,-1, + 5,21, 5, 7,-1,-1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 5,16, /* Ascii 34 */ - 4,21, 4,14,-1,-1,12,21,12,14,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 4,21, 4,14,-1,-1,12,21,12,14,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, @@ -52,9 +52,9 @@ const static int simplex[NUM_SIMPLEX_CHARS][112] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 26,20, /* Ascii 36 */ - 8,25, 8,-4,-1,-1,12,25,12,-4,-1,-1,17,18,15,20,12,21, 8,21, 5,20, 3, + 8,25, 8,-4,-1,-1,12,25,12,-4,-1,-1,17,18,15,20,12,21, 8,21, 5,20, 3, 18, 3,16, 4,14, 5,13, 7,12,13,10,15, 9,16, 8,17, 6,17, 3,15, 1,12, 0, - 8, 0, 5, 1, 3, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 8, 0, 5, 1, 3, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 31,24, /* Ascii 37 */ @@ -65,12 +65,12 @@ const static int simplex[NUM_SIMPLEX_CHARS][112] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 34,26, /* Ascii 38 */ 23,12,23,13,22,14,21,14,20,13,19,11,17, 6,15, 3,13, 1,11, 0, 7, 0, 5, - 1, 4, 2, 3, 4, 3, 6, 4, 8, 5, 9,12,13,13,14,14,16,14,18,13,20,11,21, - 9,20, 8,18, 8,16, 9,13,11,10,16, 3,18, 1,20, 0,22, 0,23, 1,23, 2,-1, + 1, 4, 2, 3, 4, 3, 6, 4, 8, 5, 9,12,13,13,14,14,16,14,18,13,20,11,21, + 9,20, 8,18, 8,16, 9,13,11,10,16, 3,18, 1,20, 0,22, 0,23, 1,23, 2,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 7,10, /* Ascii 39 */ - 5,19, 4,20, 5,21, 6,20, 6,18, 5,16, 4,15,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 5,19, 4,20, 5,21, 6,20, 6,18, 5,16, 4,15,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, @@ -82,13 +82,13 @@ const static int simplex[NUM_SIMPLEX_CHARS][112] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 10,14, /* Ascii 41 */ - 3,25, 5,23, 7,20, 9,16,10,11,10, 7, 9, 2, 7,-2, 5,-5, 3,-7,-1,-1,-1, + 3,25, 5,23, 7,20, 9,16,10,11,10, 7, 9, 2, 7,-2, 5,-5, 3,-7,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 8,16, /* Ascii 42 */ - 8,21, 8, 9,-1,-1, 3,18,13,12,-1,-1,13,18, 3,12,-1,-1,-1,-1,-1,-1,-1, + 8,21, 8, 9,-1,-1, 3,18,13,12,-1,-1,13,18, 3,12,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, @@ -100,19 +100,19 @@ const static int simplex[NUM_SIMPLEX_CHARS][112] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 8,10, /* Ascii 44 */ - 6, 1, 5, 0, 4, 1, 5, 2, 6, 1, 6,-1, 5,-3, 4,-4,-1,-1,-1,-1,-1,-1,-1, + 6, 1, 5, 0, 4, 1, 5, 2, 6, 1, 6,-1, 5,-3, 4,-4,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 2,26, /* Ascii 45 */ - 4, 9,22, 9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 4, 9,22, 9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 5,10, /* Ascii 46 */ - 5, 2, 4, 1, 5, 0, 6, 1, 5, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 5, 2, 4, 1, 5, 0, 6, 1, 5, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, @@ -124,26 +124,26 @@ const static int simplex[NUM_SIMPLEX_CHARS][112] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 17,20, /* Ascii 48 */ - 9,21, 6,20, 4,17, 3,12, 3, 9, 4, 4, 6, 1, 9, 0,11, 0,14, 1,16, 4,17, - 9,17,12,16,17,14,20,11,21, 9,21,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 9,21, 6,20, 4,17, 3,12, 3, 9, 4, 4, 6, 1, 9, 0,11, 0,14, 1,16, 4,17, + 9,17,12,16,17,14,20,11,21, 9,21,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 4,20, /* Ascii 49 */ - 6,17, 8,18,11,21,11, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 6,17, 8,18,11,21,11, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 14,20, /* Ascii 50 */ - 4,16, 4,17, 5,19, 6,20, 8,21,12,21,14,20,15,19,16,17,16,15,15,13,13, + 4,16, 4,17, 5,19, 6,20, 8,21,12,21,14,20,15,19,16,17,16,15,15,13,13, 10, 3, 0,17, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 15,20, /* Ascii 51 */ - 5,21,16,21,10,13,13,13,15,12,16,11,17, 8,17, 6,16, 3,14, 1,11, 0, 8, - 0, 5, 1, 4, 2, 3, 4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 5,21,16,21,10,13,13,13,15,12,16,11,17, 8,17, 6,16, 3,14, 1,11, 0, 8, + 0, 5, 1, 4, 2, 3, 4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, @@ -155,13 +155,13 @@ const static int simplex[NUM_SIMPLEX_CHARS][112] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 17,20, /* Ascii 53 */ 15,21, 5,21, 4,12, 5,13, 8,14,11,14,14,13,16,11,17, 8,17, 6,16, 3,14, - 1,11, 0, 8, 0, 5, 1, 4, 2, 3, 4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 1,11, 0, 8, 0, 5, 1, 4, 2, 3, 4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 23,20, /* Ascii 54 */ 16,18,15,20,12,21,10,21, 7,20, 5,17, 4,12, 4, 7, 5, 3, 7, 1,10, 0,11, - 0,14, 1,16, 3,17, 6,17, 7,16,10,14,12,11,13,10,13, 7,12, 5,10, 4, 7, + 0,14, 1,16, 3,17, 6,17, 7,16,10,14,12,11,13,10,13, 7,12, 5,10, 4, 7, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, @@ -172,8 +172,8 @@ const static int simplex[NUM_SIMPLEX_CHARS][112] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 29,20, /* Ascii 56 */ - 8,21, 5,20, 4,18, 4,16, 5,14, 7,13,11,12,14,11,16, 9,17, 7,17, 4,16, - 2,15, 1,12, 0, 8, 0, 5, 1, 4, 2, 3, 4, 3, 7, 4, 9, 6,11, 9,12,13,13, + 8,21, 5,20, 4,18, 4,16, 5,14, 7,13,11,12,14,11,16, 9,17, 7,17, 4,16, + 2,15, 1,12, 0, 8, 0, 5, 1, 4, 2, 3, 4, 3, 7, 4, 9, 6,11, 9,12,13,13, 15,14,16,16,16,18,15,20,12,21, 8,21,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, @@ -184,13 +184,13 @@ const static int simplex[NUM_SIMPLEX_CHARS][112] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 11,10, /* Ascii 58 */ - 5,14, 4,13, 5,12, 6,13, 5,14,-1,-1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2,-1, + 5,14, 4,13, 5,12, 6,13, 5,14,-1,-1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 14,10, /* Ascii 59 */ - 5,14, 4,13, 5,12, 6,13, 5,14,-1,-1, 6, 1, 5, 0, 4, 1, 5, 2, 6, 1, 6, + 5,14, 4,13, 5,12, 6,13, 5,14,-1,-1, 6, 1, 5, 0, 4, 1, 5, 2, 6, 1, 6, -1, 5,-3, 4,-4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, @@ -202,79 +202,79 @@ const static int simplex[NUM_SIMPLEX_CHARS][112] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 5,26, /* Ascii 61 */ - 4,12,22,12,-1,-1, 4, 6,22, 6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 4,12,22,12,-1,-1, 4, 6,22, 6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 3,24, /* Ascii 62 */ - 4,18,20, 9, 4, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 4,18,20, 9, 4, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 20,18, /* Ascii 63 */ - 3,16, 3,17, 4,19, 5,20, 7,21,11,21,13,20,14,19,15,17,15,15,14,13,13, + 3,16, 3,17, 4,19, 5,20, 7,21,11,21,13,20,14,19,15,17,15,15,14,13,13, 12, 9,10, 9, 7,-1,-1, 9, 2, 8, 1, 9, 0,10, 1, 9, 2,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 55,27, /* Ascii 64 */ 18,13,17,15,15,16,12,16,10,15, 9,14, 8,11, 8, 8, 9, 6,11, 5,14, 5,16, - 6,17, 8,-1,-1,12,16,10,14, 9,11, 9, 8,10, 6,11, 5,-1,-1,18,16,17, 8, + 6,17, 8,-1,-1,12,16,10,14, 9,11, 9, 8,10, 6,11, 5,-1,-1,18,16,17, 8, 17, 6,19, 5,21, 5,23, 7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12, 21, 9,20, 7,19, 5,17, 4,15, 3,12, 3, 9, 4, 6, 5, 4, 7, 2, 9, 1,12, 0, 15, 0,18, 1,20, 2,21, 3,-1,-1,19,16,18, 8,18, 6,19, 5 }, { 8,18, /* Ascii 65 */ - 9,21, 1, 0,-1,-1, 9,21,17, 0,-1,-1, 4, 7,14, 7,-1,-1,-1,-1,-1,-1,-1, + 9,21, 1, 0,-1,-1, 9,21,17, 0,-1,-1, 4, 7,14, 7,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 23,21, /* Ascii 66 */ - 4,21, 4, 0,-1,-1, 4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13, + 4,21, 4, 0,-1,-1, 4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13, 11,-1,-1, 4,11,13,11,16,10,17, 9,18, 7,18, 4,17, 2,16, 1,13, 0, 4, 0, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 18,21, /* Ascii 67 */ 18,16,17,18,15,20,13,21, 9,21, 7,20, 5,18, 4,16, 3,13, 3, 8, 4, 5, 5, - 3, 7, 1, 9, 0,13, 0,15, 1,17, 3,18, 5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 3, 7, 1, 9, 0,13, 0,15, 1,17, 3,18, 5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 15,21, /* Ascii 68 */ - 4,21, 4, 0,-1,-1, 4,21,11,21,14,20,16,18,17,16,18,13,18, 8,17, 5,16, - 3,14, 1,11, 0, 4, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 4,21, 4, 0,-1,-1, 4,21,11,21,14,20,16,18,17,16,18,13,18, 8,17, 5,16, + 3,14, 1,11, 0, 4, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 11,19, /* Ascii 69 */ - 4,21, 4, 0,-1,-1, 4,21,17,21,-1,-1, 4,11,12,11,-1,-1, 4, 0,17, 0,-1, + 4,21, 4, 0,-1,-1, 4,21,17,21,-1,-1, 4,11,12,11,-1,-1, 4, 0,17, 0,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 8,18, /* Ascii 70 */ - 4,21, 4, 0,-1,-1, 4,21,17,21,-1,-1, 4,11,12,11,-1,-1,-1,-1,-1,-1,-1, + 4,21, 4, 0,-1,-1, 4,21,17,21,-1,-1, 4,11,12,11,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 22,21, /* Ascii 71 */ 18,16,17,18,15,20,13,21, 9,21, 7,20, 5,18, 4,16, 3,13, 3, 8, 4, 5, 5, - 3, 7, 1, 9, 0,13, 0,15, 1,17, 3,18, 5,18, 8,-1,-1,13, 8,18, 8,-1,-1, + 3, 7, 1, 9, 0,13, 0,15, 1,17, 3,18, 5,18, 8,-1,-1,13, 8,18, 8,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 8,22, /* Ascii 72 */ - 4,21, 4, 0,-1,-1,18,21,18, 0,-1,-1, 4,11,18,11,-1,-1,-1,-1,-1,-1,-1, + 4,21, 4, 0,-1,-1,18,21,18, 0,-1,-1, 4,11,18,11,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 2, 8, /* Ascii 73 */ - 4,21, 4, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 4,21, 4, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, @@ -286,91 +286,91 @@ const static int simplex[NUM_SIMPLEX_CHARS][112] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 8,21, /* Ascii 75 */ - 4,21, 4, 0,-1,-1,18,21, 4, 7,-1,-1, 9,12,18, 0,-1,-1,-1,-1,-1,-1,-1, + 4,21, 4, 0,-1,-1,18,21, 4, 7,-1,-1, 9,12,18, 0,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 5,17, /* Ascii 76 */ - 4,21, 4, 0,-1,-1, 4, 0,16, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 4,21, 4, 0,-1,-1, 4, 0,16, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 11,24, /* Ascii 77 */ - 4,21, 4, 0,-1,-1, 4,21,12, 0,-1,-1,20,21,12, 0,-1,-1,20,21,20, 0,-1, + 4,21, 4, 0,-1,-1, 4,21,12, 0,-1,-1,20,21,12, 0,-1,-1,20,21,20, 0,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 8,22, /* Ascii 78 */ - 4,21, 4, 0,-1,-1, 4,21,18, 0,-1,-1,18,21,18, 0,-1,-1,-1,-1,-1,-1,-1, + 4,21, 4, 0,-1,-1, 4,21,18, 0,-1,-1,18,21,18, 0,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 21,22, /* Ascii 79 */ - 9,21, 7,20, 5,18, 4,16, 3,13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0,13, 0,15, - 1,17, 3,18, 5,19, 8,19,13,18,16,17,18,15,20,13,21, 9,21,-1,-1,-1,-1, + 9,21, 7,20, 5,18, 4,16, 3,13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0,13, 0,15, + 1,17, 3,18, 5,19, 8,19,13,18,16,17,18,15,20,13,21, 9,21,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 13,21, /* Ascii 80 */ - 4,21, 4, 0,-1,-1, 4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13, + 4,21, 4, 0,-1,-1, 4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13, 10, 4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 24,22, /* Ascii 81 */ - 9,21, 7,20, 5,18, 4,16, 3,13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0,13, 0,15, - 1,17, 3,18, 5,19, 8,19,13,18,16,17,18,15,20,13,21, 9,21,-1,-1,12, 4, + 9,21, 7,20, 5,18, 4,16, 3,13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0,13, 0,15, + 1,17, 3,18, 5,19, 8,19,13,18,16,17,18,15,20,13,21, 9,21,-1,-1,12, 4, 18,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 16,21, /* Ascii 82 */ - 4,21, 4, 0,-1,-1, 4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13, + 4,21, 4, 0,-1,-1, 4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13, 11, 4,11,-1,-1,11,11,18, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 20,20, /* Ascii 83 */ 17,18,15,20,12,21, 8,21, 5,20, 3,18, 3,16, 4,14, 5,13, 7,12,13,10,15, - 9,16, 8,17, 6,17, 3,15, 1,12, 0, 8, 0, 5, 1, 3, 3,-1,-1,-1,-1,-1,-1, + 9,16, 8,17, 6,17, 3,15, 1,12, 0, 8, 0, 5, 1, 3, 3,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 5,16, /* Ascii 84 */ - 8,21, 8, 0,-1,-1, 1,21,15,21,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 8,21, 8, 0,-1,-1, 1,21,15,21,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 10,22, /* Ascii 85 */ - 4,21, 4, 6, 5, 3, 7, 1,10, 0,12, 0,15, 1,17, 3,18, 6,18,21,-1,-1,-1, + 4,21, 4, 6, 5, 3, 7, 1,10, 0,12, 0,15, 1,17, 3,18, 6,18,21,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 5,18, /* Ascii 86 */ - 1,21, 9, 0,-1,-1,17,21, 9, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 1,21, 9, 0,-1,-1,17,21, 9, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 11,24, /* Ascii 87 */ - 2,21, 7, 0,-1,-1,12,21, 7, 0,-1,-1,12,21,17, 0,-1,-1,22,21,17, 0,-1, + 2,21, 7, 0,-1,-1,12,21, 7, 0,-1,-1,12,21,17, 0,-1,-1,22,21,17, 0,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 5,20, /* Ascii 88 */ - 3,21,17, 0,-1,-1,17,21, 3, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 3,21,17, 0,-1,-1,17,21, 3, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 6,18, /* Ascii 89 */ - 1,21, 9,11, 9, 0,-1,-1,17,21, 9,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 1,21, 9,11, 9, 0,-1,-1,17,21, 9,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, @@ -382,68 +382,68 @@ const static int simplex[NUM_SIMPLEX_CHARS][112] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 11,14, /* Ascii 91 */ - 4,25, 4,-7,-1,-1, 5,25, 5,-7,-1,-1, 4,25,11,25,-1,-1, 4,-7,11,-7,-1, + 4,25, 4,-7,-1,-1, 5,25, 5,-7,-1,-1, 4,25,11,25,-1,-1, 4,-7,11,-7,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 2,14, /* Ascii 92 */ - 0,21,14,-3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 0,21,14,-3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 11,14, /* Ascii 93 */ - 9,25, 9,-7,-1,-1,10,25,10,-7,-1,-1, 3,25,10,25,-1,-1, 3,-7,10,-7,-1, + 9,25, 9,-7,-1,-1,10,25,10,-7,-1,-1, 3,25,10,25,-1,-1, 3,-7,10,-7,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 10,16, /* Ascii 94 */ - 6,15, 8,18,10,15,-1,-1, 3,12, 8,17,13,12,-1,-1, 8,17, 8, 0,-1,-1,-1, + 6,15, 8,18,10,15,-1,-1, 3,12, 8,17,13,12,-1,-1, 8,17, 8, 0,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 2,16, /* Ascii 95 */ - 0,-2,16,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 0,-2,16,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 7,10, /* Ascii 96 */ - 6,21, 5,20, 4,18, 4,16, 5,15, 6,16, 5,17,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 6,21, 5,20, 4,18, 4,16, 5,15, 6,16, 5,17,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 17,19, /* Ascii 97 */ 15,14,15, 0,-1,-1,15,11,13,13,11,14, 8,14, 6,13, 4,11, 3, 8, 3, 6, 4, - 3, 6, 1, 8, 0,11, 0,13, 1,15, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 3, 6, 1, 8, 0,11, 0,13, 1,15, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 17,19, /* Ascii 98 */ - 4,21, 4, 0,-1,-1, 4,11, 6,13, 8,14,11,14,13,13,15,11,16, 8,16, 6,15, - 3,13, 1,11, 0, 8, 0, 6, 1, 4, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 4,21, 4, 0,-1,-1, 4,11, 6,13, 8,14,11,14,13,13,15,11,16, 8,16, 6,15, + 3,13, 1,11, 0, 8, 0, 6, 1, 4, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 14,18, /* Ascii 99 */ 15,11,13,13,11,14, 8,14, 6,13, 4,11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0,11, - 0,13, 1,15, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 0,13, 1,15, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 17,19, /* Ascii 100 */ 15,21,15, 0,-1,-1,15,11,13,13,11,14, 8,14, 6,13, 4,11, 3, 8, 3, 6, 4, - 3, 6, 1, 8, 0,11, 0,13, 1,15, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 3, 6, 1, 8, 0,11, 0,13, 1,15, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 17,18, /* Ascii 101 */ - 3, 8,15, 8,15,10,14,12,13,13,11,14, 8,14, 6,13, 4,11, 3, 8, 3, 6, 4, - 3, 6, 1, 8, 0,11, 0,13, 1,15, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 3, 8,15, 8,15,10,14,12,13,13,11,14, 8,14, 6,13, 4,11, 3, 8, 3, 6, 4, + 3, 6, 1, 8, 0,11, 0,13, 1,15, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, @@ -460,109 +460,109 @@ const static int simplex[NUM_SIMPLEX_CHARS][112] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 10,19, /* Ascii 104 */ - 4,21, 4, 0,-1,-1, 4,10, 7,13, 9,14,12,14,14,13,15,10,15, 0,-1,-1,-1, + 4,21, 4, 0,-1,-1, 4,10, 7,13, 9,14,12,14,14,13,15,10,15, 0,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 8, 8, /* Ascii 105 */ - 3,21, 4,20, 5,21, 4,22, 3,21,-1,-1, 4,14, 4, 0,-1,-1,-1,-1,-1,-1,-1, + 3,21, 4,20, 5,21, 4,22, 3,21,-1,-1, 4,14, 4, 0,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 11,10, /* Ascii 106 */ - 5,21, 6,20, 7,21, 6,22, 5,21,-1,-1, 6,14, 6,-3, 5,-6, 3,-7, 1,-7,-1, + 5,21, 6,20, 7,21, 6,22, 5,21,-1,-1, 6,14, 6,-3, 5,-6, 3,-7, 1,-7,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 8,17, /* Ascii 107 */ - 4,21, 4, 0,-1,-1,14,14, 4, 4,-1,-1, 8, 8,15, 0,-1,-1,-1,-1,-1,-1,-1, + 4,21, 4, 0,-1,-1,14,14, 4, 4,-1,-1, 8, 8,15, 0,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 2, 8, /* Ascii 108 */ - 4,21, 4, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 4,21, 4, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 18,30, /* Ascii 109 */ - 4,14, 4, 0,-1,-1, 4,10, 7,13, 9,14,12,14,14,13,15,10,15, 0,-1,-1,15, + 4,14, 4, 0,-1,-1, 4,10, 7,13, 9,14,12,14,14,13,15,10,15, 0,-1,-1,15, 10,18,13,20,14,23,14,25,13,26,10,26, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 10,19, /* Ascii 110 */ - 4,14, 4, 0,-1,-1, 4,10, 7,13, 9,14,12,14,14,13,15,10,15, 0,-1,-1,-1, + 4,14, 4, 0,-1,-1, 4,10, 7,13, 9,14,12,14,14,13,15,10,15, 0,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 17,19, /* Ascii 111 */ - 8,14, 6,13, 4,11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0,11, 0,13, 1,15, 3,16, - 6,16, 8,15,11,13,13,11,14, 8,14,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 8,14, 6,13, 4,11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0,11, 0,13, 1,15, 3,16, + 6,16, 8,15,11,13,13,11,14, 8,14,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 17,19, /* Ascii 112 */ - 4,14, 4,-7,-1,-1, 4,11, 6,13, 8,14,11,14,13,13,15,11,16, 8,16, 6,15, - 3,13, 1,11, 0, 8, 0, 6, 1, 4, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 4,14, 4,-7,-1,-1, 4,11, 6,13, 8,14,11,14,13,13,15,11,16, 8,16, 6,15, + 3,13, 1,11, 0, 8, 0, 6, 1, 4, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 17,19, /* Ascii 113 */ 15,14,15,-7,-1,-1,15,11,13,13,11,14, 8,14, 6,13, 4,11, 3, 8, 3, 6, 4, - 3, 6, 1, 8, 0,11, 0,13, 1,15, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 3, 6, 1, 8, 0,11, 0,13, 1,15, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 8,13, /* Ascii 114 */ - 4,14, 4, 0,-1,-1, 4, 8, 5,11, 7,13, 9,14,12,14,-1,-1,-1,-1,-1,-1,-1, + 4,14, 4, 0,-1,-1, 4, 8, 5,11, 7,13, 9,14,12,14,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 17,17, /* Ascii 115 */ 14,11,13,13,10,14, 7,14, 4,13, 3,11, 4, 9, 6, 8,11, 7,13, 6,14, 4,14, - 3,13, 1,10, 0, 7, 0, 4, 1, 3, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 3,13, 1,10, 0, 7, 0, 4, 1, 3, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 8,12, /* Ascii 116 */ - 5,21, 5, 4, 6, 1, 8, 0,10, 0,-1,-1, 2,14, 9,14,-1,-1,-1,-1,-1,-1,-1, + 5,21, 5, 4, 6, 1, 8, 0,10, 0,-1,-1, 2,14, 9,14,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 10,19, /* Ascii 117 */ - 4,14, 4, 4, 5, 1, 7, 0,10, 0,12, 1,15, 4,-1,-1,15,14,15, 0,-1,-1,-1, + 4,14, 4, 4, 5, 1, 7, 0,10, 0,12, 1,15, 4,-1,-1,15,14,15, 0,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 5,16, /* Ascii 118 */ - 2,14, 8, 0,-1,-1,14,14, 8, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 2,14, 8, 0,-1,-1,14,14, 8, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 11,22, /* Ascii 119 */ - 3,14, 7, 0,-1,-1,11,14, 7, 0,-1,-1,11,14,15, 0,-1,-1,19,14,15, 0,-1, + 3,14, 7, 0,-1,-1,11,14, 7, 0,-1,-1,11,14,15, 0,-1,-1,19,14,15, 0,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 5,17, /* Ascii 120 */ - 3,14,14, 0,-1,-1,14,14, 3, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 3,14,14, 0,-1,-1,14,14, 3, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 9,16, /* Ascii 121 */ - 2,14, 8, 0,-1,-1,14,14, 8, 0, 6,-4, 4,-6, 2,-7, 1,-7,-1,-1,-1,-1,-1, + 2,14, 8, 0,-1,-1,14,14, 8, 0, 6,-4, 4,-6, 2,-7, 1,-7,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, @@ -574,25 +574,25 @@ const static int simplex[NUM_SIMPLEX_CHARS][112] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 39,14, /* Ascii 123 */ - 9,25, 7,24, 6,23, 5,21, 5,19, 6,17, 7,16, 8,14, 8,12, 6,10,-1,-1, 7, + 9,25, 7,24, 6,23, 5,21, 5,19, 6,17, 7,16, 8,14, 8,12, 6,10,-1,-1, 7, 24, 6,22, 6,20, 7,18, 8,17, 9,15, 9,13, 8,11, 4, 9, 8, 7, 9, 5, 9, 3, - 8, 1, 7, 0, 6,-2, 6,-4, 7,-6,-1,-1, 6, 8, 8, 6, 8, 4, 7, 2, 6, 1, 5, + 8, 1, 7, 0, 6,-2, 6,-4, 7,-6,-1,-1, 6, 8, 8, 6, 8, 4, 7, 2, 6, 1, 5, -1, 5,-3, 6,-5, 7,-6, 9,-7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 2, 8, /* Ascii 124 */ - 4,25, 4,-7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + 4,25, 4,-7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 39,14, /* Ascii 125 */ - 5,25, 7,24, 8,23, 9,21, 9,19, 8,17, 7,16, 6,14, 6,12, 8,10,-1,-1, 7, + 5,25, 7,24, 8,23, 9,21, 9,19, 8,17, 7,16, 6,14, 6,12, 8,10,-1,-1, 7, 24, 8,22, 8,20, 7,18, 6,17, 5,15, 5,13, 6,11,10, 9, 6, 7, 5, 5, 5, 3, - 6, 1, 7, 0, 8,-2, 8,-4, 7,-6,-1,-1, 8, 8, 6, 6, 6, 4, 7, 2, 8, 1, 9, + 6, 1, 7, 0, 8,-2, 8,-4, 7,-6,-1,-1, 8, 8, 6, 6, 6, 4, 7, 2, 8, 1, 9, -1, 9,-3, 8,-5, 7,-6, 5,-7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, { 23,24, /* Ascii 126 */ - 3, 6, 3, 8, 4,11, 6,12, 8,12,10,11,14, 8,16, 7,18, 7,20, 8,21,10,-1, + 3, 6, 3, 8, 4,11, 6,12, 8,12,10,11,14, 8,16, 7,18, 7,20, 8,21,10,-1, -1, 3, 8, 4,10, 6,11, 8,11,10,10,14, 7,16, 6,18, 6,20, 7,21,10,21,12, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, diff --git a/neo/renderer/tr_backend.cpp b/neo/renderer/tr_backend.cpp index f0c8e00f..bf77fdf7 100644 --- a/neo/renderer/tr_backend.cpp +++ b/neo/renderer/tr_backend.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 @@ void RB_SetDefaultGLState( void ) { qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL); qglDepthMask( GL_TRUE ); qglDepthFunc( GL_ALWAYS ); - + qglCullFace( GL_FRONT_AND_BACK ); qglShadeModel( GL_SMOOTH ); @@ -238,7 +238,7 @@ This routine is responsible for setting the most commonly changed state */ void GL_State( int stateBits ) { int diff; - + if ( !r_useStateCaching.GetBool() || backEnd.glState.forceGlState ) { // make sure everything is set all the time, so we // can see if our delta checking is screwing up @@ -427,10 +427,10 @@ void RB_SetGL2D( void ) { qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } qglMatrixMode( GL_PROJECTION ); - qglLoadIdentity(); + qglLoadIdentity(); qglOrtho( 0, 640, 480, 0, 0, 1 ); // always assume 640x480 virtual coordinates qglMatrixMode( GL_MODELVIEW ); - qglLoadIdentity(); + qglLoadIdentity(); GL_State( GLS_DEPTHFUNC_ALWAYS | GLS_SRCBLEND_SRC_ALPHA | @@ -557,11 +557,11 @@ const void RB_SwapBuffers( const void *data ) { qglFinish(); } - RB_LogComment( "***************** RB_SwapBuffers *****************\n\n\n" ); + RB_LogComment( "***************** RB_SwapBuffers *****************\n\n\n" ); // don't flip if drawing to front buffer if ( !r_frontBuffer.GetBool() ) { - GLimp_SwapBuffers(); + GLimp_SwapBuffers(); } } @@ -581,7 +581,7 @@ const void RB_CopyRender( const void *data ) { return; } - RB_LogComment( "***************** RB_CopyRender *****************\n" ); + RB_LogComment( "***************** RB_CopyRender *****************\n" ); if (cmd->image) { cmd->image->CopyFramebuffer( cmd->x, cmd->y, cmd->imageWidth, cmd->imageHeight, false ); diff --git a/neo/renderer/tr_deform.cpp b/neo/renderer/tr_deform.cpp index 4e6fc101..46a3dac7 100644 --- a/neo/renderer/tr_deform.cpp +++ b/neo/renderer/tr_deform.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"). @@ -185,7 +185,7 @@ static int edgeVerts[6][2] = { // we need the view direction to project the minor axis of the tube // as the view changes idVec3 localView; - R_GlobalPointToLocal( surf->space->modelMatrix, tr.viewDef->renderView.vieworg, localView ); + R_GlobalPointToLocal( surf->space->modelMatrix, tr.viewDef->renderView.vieworg, localView ); // this srfTriangles_t and all its indexes and caches are in frame // memory, and will be automatically disposed of @@ -257,7 +257,7 @@ static int edgeVerts[6][2] = { *av2 = *(idDrawVert *)&tri->verts[i2]; l = 0.5 * lengths[j]; - + // cross this with the view direction to get minor axis idVec3 dir = mid[j] - localView; minor.Cross( major, dir ); @@ -390,7 +390,7 @@ static void R_FlareDeform( drawSurf_t *surf ) { newTri->numVerts = 4; newTri->numIndexes = 2*3; newTri->indexes = (glIndex_t *)R_FrameAlloc( newTri->numIndexes * sizeof( newTri->indexes[0] ) ); - + idDrawVert *ac = (idDrawVert *)_alloca16( newTri->numVerts * sizeof( idDrawVert ) ); // find the plane @@ -528,7 +528,7 @@ static void R_FlareDeform( drawSurf_t *surf ) { newTri->numVerts = 16; newTri->numIndexes = 18*3; newTri->indexes = (glIndex_t *)R_FrameAlloc( newTri->numIndexes * sizeof( newTri->indexes[0] ) ); - + idDrawVert *ac = (idDrawVert *)_alloca16( newTri->numVerts * sizeof( idDrawVert ) ); // find the plane @@ -587,13 +587,13 @@ static void R_FlareDeform( drawSurf_t *surf ) { idVec3 toEye = tri->verts[ indexes[i] ].xyz - localViewer; toEye.Normalize(); - idVec3 d1 = tri->verts[ indexes[(i+1)%4] ].xyz - localViewer; + idVec3 d1 = tri->verts[ indexes[(i+1)%4] ].xyz - localViewer; d1.Normalize(); edgeDir[i][1].Cross( toEye, d1 ); edgeDir[i][1].Normalize(); edgeDir[i][1] = vec3_origin - edgeDir[i][1]; - idVec3 d2 = tri->verts[ indexes[(i+3)%4] ].xyz - localViewer; + idVec3 d2 = tri->verts[ indexes[(i+3)%4] ].xyz - localViewer; d2.Normalize(); edgeDir[i][0].Cross( toEye, d2 ); edgeDir[i][0].Normalize(); @@ -673,7 +673,7 @@ static void R_FlareDeform( drawSurf_t *surf ) { #if 1 static glIndex_t triIndexes[18*3] = { - 0,4,5, 0,5,6, 0,6,7, 0,7,1, 1,7,8, 1,8,9, + 0,4,5, 0,5,6, 0,6,7, 0,7,1, 1,7,8, 1,8,9, 15,4,0, 15,0,3, 3,0,1, 3,1,2, 2,1,9, 2,9,10, 14,15,3, 14,3,13, 13,3,2, 13,2,12, 12,2,11, 11,2,10 }; @@ -845,14 +845,14 @@ static void AddTriangleToIsland_r( const srfTriangles_t *tri, int triangleNum, b if ( usedList[i] ) { continue; } - if ( tri->indexes[i*3+0] == a - || tri->indexes[i*3+1] == a - || tri->indexes[i*3+2] == a - || tri->indexes[i*3+0] == b - || tri->indexes[i*3+1] == b - || tri->indexes[i*3+2] == b - || tri->indexes[i*3+0] == c - || tri->indexes[i*3+1] == c + if ( tri->indexes[i*3+0] == a + || tri->indexes[i*3+1] == a + || tri->indexes[i*3+2] == a + || tri->indexes[i*3+0] == b + || tri->indexes[i*3+1] == b + || tri->indexes[i*3+2] == b + || tri->indexes[i*3+0] == c + || tri->indexes[i*3+1] == c || tri->indexes[i*3+2] == c ) { AddTriangleToIsland_r( tri, i, usedList, island ); } @@ -1025,7 +1025,7 @@ static void R_ParticleDeform( drawSurf_t *surf, bool useArea ) { } #if 0 - if ( renderEntity->shaderParms[SHADERPARM_PARTICLE_STOPTIME] && + if ( renderEntity->shaderParms[SHADERPARM_PARTICLE_STOPTIME] && viewDef->renderView.time*0.001 >= renderEntity->shaderParms[SHADERPARM_PARTICLE_STOPTIME] ) { // the entire system has faded out return NULL; @@ -1113,7 +1113,7 @@ static void R_ParticleDeform( drawSurf_t *surf, bool useArea ) { steppingRandom.RandomInt(); steppingRandom2.RandomInt(); - // calculate local age for this index + // calculate local age for this index int bunchOffset = stage->particleLife * 1000 * stage->spawnBunching * index / totalParticles; int particleAge = stageAge - bunchOffset; @@ -1135,7 +1135,7 @@ static void R_ParticleDeform( drawSurf_t *surf, bool useArea ) { int inCycleTime = particleAge - particleCycle * stage->cycleMsec; - if ( renderEntity->shaderParms[SHADERPARM_PARTICLE_STOPTIME] && + if ( renderEntity->shaderParms[SHADERPARM_PARTICLE_STOPTIME] && g.renderView->time - inCycleTime >= renderEntity->shaderParms[SHADERPARM_PARTICLE_STOPTIME]*1000 ) { // don't fire any more particles continue; @@ -1194,7 +1194,7 @@ static void R_ParticleDeform( drawSurf_t *surf, bool useArea ) { // don't increment the verts tri->numVerts += stage->CreateParticle( &g, tri->verts + tri->numVerts ); } - + if ( tri->numVerts > 0 ) { // build the index list int indexes = 0; diff --git a/neo/renderer/tr_font.cpp b/neo/renderer/tr_font.cpp index 1c98ad50..19b18eb5 100644 --- a/neo/renderer/tr_font.cpp +++ b/neo/renderer/tr_font.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 @@ If you have questions concerning this license or the applicable additional terms #define _CEIL(x) (((x)+63) & -64) #define _TRUNC(x) ((x) >> 6) -FT_Library ftLibrary = NULL; +FT_Library ftLibrary = NULL; #endif @@ -78,7 +78,7 @@ FT_Bitmap *R_RenderGlyph(FT_GlyphSlot glyph, glyphInfo_t* glyphOut) { R_GetGlyphInfo(glyph, &left, &right, &width, &top, &bottom, &height, &pitch); if ( glyph->format == ft_glyph_format_outline ) { - size = pitch*height; + size = pitch*height; bit2 = Mem_Alloc(sizeof(FT_Bitmap)); @@ -143,7 +143,7 @@ glyphInfo_t *RE_ConstructGlyphInfo( unsigned char *imageOut, int *xOut, int *yOu } /* - // need to convert to power of 2 sizes so we do not get + // need to convert to power of 2 sizes so we do not get // any scaling from the gl upload for (scaled_width = 1 ; scaled_width < glyph.pitch ; scaled_width<<=1) ; @@ -192,7 +192,7 @@ glyphInfo_t *RE_ConstructGlyphInfo( unsigned char *imageOut, int *xOut, int *yOu *_dst = 0xff; } mask >>= 1; - + if ( mask == 0 ) { mask = 0x80; } @@ -211,7 +211,7 @@ glyphInfo_t *RE_ConstructGlyphInfo( unsigned char *imageOut, int *xOut, int *yOu } } - // we now have an 8 bit per pixel grey scale bitmap + // we now have an 8 bit per pixel grey scale bitmap // that is width wide and pf->ftSize->metrics.y_ppem tall glyph.imageHeight = scaled_height; @@ -325,7 +325,7 @@ bool idRenderSystemLocal::RegisterFont( const char *fontName, fontInfoEx_t &font pointSize = 48; } // we also need to adjust the scale based on point size relative to 48 points as the ui scaling is based on a 48 point font - float glyphScale = 1.0f; // change the scale to be relative to 1 based on 72 dpi ( so dpi of 144 means a scale of .5 ) + float glyphScale = 1.0f; // change the scale to be relative to 1 based on 72 dpi ( so dpi of 144 means a scale of .5 ) glyphScale *= 48.0f / pointSize; idStr::snPrintf( name, sizeof(name), "%s/fontImage_%i.dat", fontName, pointSize ); @@ -365,7 +365,7 @@ bool idRenderSystemLocal::RegisterFont( const char *fontName, fontInfoEx_t &font outFont->glyphs[i].s2 = readFloat(); outFont->glyphs[i].t2 = readFloat(); int junk /* font.glyphs[i].glyph */ = readInt(); - //FIXME: the +6, -6 skips the embedded fonts/ + //FIXME: the +6, -6 skips the embedded fonts/ memcpy( outFont->glyphs[i].shaderName, &fdFile[fdOffset + 6], 32 - 6 ); fdOffset += 32; } @@ -402,7 +402,7 @@ bool idRenderSystemLocal::RegisterFont( const char *fontName, fontInfoEx_t &font return true ; #ifndef BUILD_FREETYPE - common->Warning( "RegisterFont: couldn't load FreeType code %s", name ); + common->Warning( "RegisterFont: couldn't load FreeType code %s", name ); #else if (ftLibrary == NULL) { @@ -430,7 +430,7 @@ bool idRenderSystemLocal::RegisterFont( const char *fontName, fontInfoEx_t &font // font = registeredFonts[registeredFontCount++]; - // make a 256x256 image buffer, once it is full, register it, clean it and keep going + // make a 256x256 image buffer, once it is full, register it, clean it and keep going // until all glyphs are rendered out = Mem_Alloc( 1024*1024 ); @@ -459,7 +459,7 @@ bool idRenderSystemLocal::RegisterFont( const char *fontName, fontInfoEx_t &font if (xOut == -1 || yOut == -1 || i == GLYPH_END) { // ran out of room // we need to create an image from the bitmap, set all the handles in the glyphs to this point - // + // scaledSize = 256*256; newSize = scaledSize * 4; @@ -485,7 +485,7 @@ bool idRenderSystemLocal::RegisterFont( const char *fontName, fontInfoEx_t &font } idStr::snprintf( name, sizeof(name), "fonts/fontImage_%i_%i.tga", imageNumber++, pointSize ); - if (r_saveFontData->integer) { + if (r_saveFontData->integer) { R_WriteTGA(name, imageBuff, 256, 256); } @@ -512,7 +512,7 @@ bool idRenderSystemLocal::RegisterFont( const char *fontName, fontInfoEx_t &font font.glyphScale = glyphScale; memcpy( ®isteredFont[registeredFontCount++], &font, sizeof( fontInfo_t ) ); - if ( r_saveFontData->integer ) { + if ( r_saveFontData->integer ) { fileSystem->WriteFile( va( "fonts/fontImage_%i.dat", pointSize), &font, sizeof( fontInfo_t ) ); } diff --git a/neo/renderer/tr_guisurf.cpp b/neo/renderer/tr_guisurf.cpp index 9e956e52..c4113a3d 100644 --- a/neo/renderer/tr_guisurf.cpp +++ b/neo/renderer/tr_guisurf.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"). @@ -54,7 +54,7 @@ void R_SurfaceToTextureAxis( const srfTriangles_t *tri, idVec3 &origin, idVec3 a float boundsOrg[2]; int i, j; float v; - + // find the bounds of the texture bounds[0][0] = bounds[0][1] = 999999; bounds[1][0] = bounds[1][1] = -999999; @@ -98,13 +98,13 @@ void R_SurfaceToTextureAxis( const srfTriangles_t *tri, idVec3 &origin, idVec3 a } inva = 1.0 / area; - axis[0][0] = (d0[0] * d1[4] - d0[4] * d1[0]) * inva; - axis[0][1] = (d0[1] * d1[4] - d0[4] * d1[1]) * inva; - axis[0][2] = (d0[2] * d1[4] - d0[4] * d1[2]) * inva; - - axis[1][0] = (d0[3] * d1[0] - d0[0] * d1[3]) * inva; - axis[1][1] = (d0[3] * d1[1] - d0[1] * d1[3]) * inva; - axis[1][2] = (d0[3] * d1[2] - d0[2] * d1[3]) * inva; + axis[0][0] = (d0[0] * d1[4] - d0[4] * d1[0]) * inva; + axis[0][1] = (d0[1] * d1[4] - d0[4] * d1[1]) * inva; + axis[0][2] = (d0[2] * d1[4] - d0[4] * d1[2]) * inva; + + axis[1][0] = (d0[3] * d1[0] - d0[0] * d1[3]) * inva; + axis[1][1] = (d0[3] * d1[1] - d0[1] * d1[3]) * inva; + axis[1][2] = (d0[3] * d1[2] - d0[2] * d1[3]) * inva; idPlane plane; plane.FromPoints( a->xyz, b->xyz, c->xyz ); @@ -166,7 +166,7 @@ void R_RenderGuiSurf( idUserInterface *gui, drawSurf_t *drawSurf ) { guiModelMatrix[11] = 0; guiModelMatrix[15] = 1; - myGlMultMatrix( guiModelMatrix, drawSurf->space->modelMatrix, + myGlMultMatrix( guiModelMatrix, drawSurf->space->modelMatrix, modelMatrix ); tr.guiRecursionLevel++; diff --git a/neo/renderer/tr_light.cpp b/neo/renderer/tr_light.cpp index 099bd015..244e9ffc 100644 --- a/neo/renderer/tr_light.cpp +++ b/neo/renderer/tr_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"). @@ -580,7 +580,7 @@ void idRenderWorldLocal::CreateLightDefInteractions( idRenderLightLocal *ldef ) } // if any of the edef's interaction match this light, we don't - // need to consider it. + // need to consider it. if ( r_useInteractionTable.GetBool() && this->interactionTable ) { // allocating these tables may take several megs on big maps, but it saves 3% to 5% of // the CPU time. The table is updated at interaction::AllocAndLink() and interaction::UnlinkAndFree() @@ -655,7 +655,7 @@ void idRenderWorldLocal::CreateLightDefInteractions( idRenderLightLocal *ldef ) R_LinkLightSurf ================= */ -void R_LinkLightSurf( const drawSurf_t **link, const srfTriangles_t *tri, const viewEntity_t *space, +void R_LinkLightSurf( const drawSurf_t **link, const srfTriangles_t *tri, const viewEntity_t *space, const idRenderLightLocal *light, const idMaterial *shader, const idScreenRect &scissor, bool viewInsideShadow ) { drawSurf_t *drawSurf; @@ -896,7 +896,7 @@ void R_AddLightSurfaces( void ) { light->viewCount = -1; continue; } - if ( light->parms.allowLightInViewID + if ( light->parms.allowLightInViewID && light->parms.allowLightInViewID != tr.viewDef->renderView.viewID ) { *ptr = vLight->next; light->viewCount = -1; @@ -1369,7 +1369,7 @@ static void R_AddAmbientDrawsurfs( viewEntity_t *vEntity ) { R_GlobalShaderOverride( &shader ); - if ( !shader ) { + if ( !shader ) { continue; } if ( !shader->IsDrawn() ) { diff --git a/neo/renderer/tr_lightrun.cpp b/neo/renderer/tr_lightrun.cpp index 0bb0f357..eee596df 100644 --- a/neo/renderer/tr_lightrun.cpp +++ b/neo/renderer/tr_lightrun.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"). @@ -187,7 +187,7 @@ void R_CreateEntityRefs( idRenderEntityLocal *def ) { return; } - if ( r_showUpdates.GetBool() && + if ( r_showUpdates.GetBool() && ( def->referenceBounds[1][0] - def->referenceBounds[0][0] > 1024 || def->referenceBounds[1][1] - def->referenceBounds[0][1] > 1024 ) ) { common->Printf( "big entityRef: %f,%f\n", def->referenceBounds[1][0] - def->referenceBounds[0][0], @@ -199,7 +199,7 @@ void R_CreateEntityRefs( idRenderEntityLocal *def ) { v[1] = def->referenceBounds[(i>>1)&1][1]; v[2] = def->referenceBounds[(i>>2)&1][2]; - R_LocalPointToGlobal( def->modelMatrix, v, transformed[i] ); + R_LocalPointToGlobal( def->modelMatrix, v, transformed[i] ); } // bump the view count so we can tell if an @@ -383,7 +383,7 @@ void R_DeriveLightData( idRenderLightLocal *light ) { if ( !light->parms.pointLight ) { // projected light - R_SetLightProject( light->lightProject, vec3_origin /* light->parms.origin */, light->parms.target, + R_SetLightProject( light->lightProject, vec3_origin /* light->parms.origin */, light->parms.target, light->parms.right, light->parms.up, light->parms.start, light->parms.end); } else { // point light @@ -505,7 +505,7 @@ void R_RenderLightFrustum( const renderLight_t &renderLight, idPlane lightFrustu fakeLight.parms = renderLight; R_DeriveLightData( &fakeLight ); - + R_FreeStaticTriSurf( fakeLight.frustumTris ); for ( int i = 0 ; i < 6 ; i++ ) { @@ -572,11 +572,11 @@ void R_CreateLightDefFogPortals( idRenderLightLocal *ldef ) { // we only handle a single fog volume covering a portal // this will never cause incorrect drawing, but it may - // fail to cull a portal + // fail to cull a portal if ( dp->fogLight ) { continue; } - + if ( WindingCompletelyInsideLight( prt->w, ldef ) ) { dp->fogLight = ldef; dp->nextFoggedPortal = ldef->foggedPortals; @@ -683,7 +683,7 @@ void R_FreeEntityDefDerivedData( idRenderEntityLocal *def, bool keepDecals, bool // put it back on the free list for reuse def->world->areaReferenceAllocator.Free( ref ); - } + } def->entityRefs = NULL; } diff --git a/neo/renderer/tr_local.h b/neo/renderer/tr_local.h index 06705d67..a958c7cd 100644 --- a/neo/renderer/tr_local.h +++ b/neo/renderer/tr_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"). @@ -53,7 +53,7 @@ const float FOG_ENTER = (FOG_ENTER_SIZE+1.0f)/(FOG_ENTER_SIZE*2); class idScreenRect { public: short x1, y1, x2, y2; // inclusive pixel bounds inside viewport - float zmin, zmax; // for depth bounds test + float zmin, zmax; // for depth bounds test void Clear(); // clear to backwards values void AddPoint( float x, float y ); // adds a point @@ -312,7 +312,7 @@ typedef struct viewLight_s { // true if globalLightOrigin is inside the view frustum, even if it may // be obscured by geometry. This allows us to skip shadows from non-visible objects - bool viewSeesGlobalLightOrigin; + bool viewSeesGlobalLightOrigin; // if !viewInsideLight, the corresponding bit for each of the shadowFrustum // projection planes that the view is on the negative side of will be set, @@ -403,7 +403,7 @@ typedef struct viewDef_s { // these are real physical pixel values, possibly scaled and offset from the // renderView x/y/width/height - struct viewDef_s * superView; // never go into an infinite subview loop + struct viewDef_s * superView; // never go into an infinite subview loop struct drawSurf_s * subviewSurface; // drawSurfs are the visible surfaces of the viewEntities, sorted @@ -446,7 +446,7 @@ typedef struct { idVec4 specularColor; // may have a light color baked into it, will be < tr.backEndRendererMaxLight stageVertexColor_t vertexColor; // applies to both diffuse and specular - int ambientLight; // use tr.ambientNormalMap instead of normalization cube map + int ambientLight; // use tr.ambientNormalMap instead of normalization cube map // (not a bool just to avoid an uninitialized memory check of the pad region by valgrind) // these are loaded into the vertex program @@ -536,7 +536,7 @@ typedef struct { int memoryHighwater; // max used on any frame - // the currently building command list + // the currently building command list // commands can be inserted at the front if needed, as for required // dynamically generated textures emptyCommand_t *cmdHead, *cmdTail; // may be of other command type based on commandId @@ -628,7 +628,7 @@ typedef struct { int c_shadowVertexes; int c_vboIndexes; - float c_overDraw; + float c_overDraw; float maxLightValue; // for light scale int msec; // total msec for backend run @@ -1093,8 +1093,8 @@ void GLimp_SwapBuffers( void ); // other system specific cvar checks that happen every frame. // This will not be called if 'r_drawBuffer GL_FRONT' -void GLimp_SetGamma( unsigned short red[256], - unsigned short green[256], +void GLimp_SetGamma( unsigned short red[256], + unsigned short green[256], unsigned short blue[256] ); // Sets the hardware gamma ramps for gamma and brightness adjustment. // These are now taken as 16 bit values, so we can take full advantage @@ -1181,7 +1181,7 @@ viewLight_t *R_SetLightDefViewLight( idRenderLightLocal *def ); void R_AddDrawSurf( const srfTriangles_t *tri, const viewEntity_t *space, const renderEntity_t *renderEntity, const idMaterial *shader, const idScreenRect &scissor ); -void R_LinkLightSurf( const drawSurf_t **link, const srfTriangles_t *tri, const viewEntity_t *space, +void R_LinkLightSurf( const drawSurf_t **link, const srfTriangles_t *tri, const viewEntity_t *space, const idRenderLightLocal *light, const idMaterial *shader, const idScreenRect &scissor, bool viewInsideShadow ); bool R_CreateAmbientCache( srfTriangles_t *tri, bool needsLighting ); @@ -1251,9 +1251,9 @@ void RB_LeaveDepthHack(); void RB_DrawElementsImmediate( const srfTriangles_t *tri ); void RB_RenderTriangleSurface( const srfTriangles_t *tri ); void RB_T_RenderTriangleSurface( const drawSurf_t *surf ); -void RB_RenderDrawSurfListWithFunction( drawSurf_t **drawSurfs, int numDrawSurfs, +void RB_RenderDrawSurfListWithFunction( drawSurf_t **drawSurfs, int numDrawSurfs, void (*triFunc_)( const drawSurf_t *) ); -void RB_RenderDrawSurfChainWithFunction( const drawSurf_t *drawSurfs, +void RB_RenderDrawSurfChainWithFunction( const drawSurf_t *drawSurfs, void (*triFunc_)( const drawSurf_t *) ); void RB_DrawShaderPasses( drawSurf_t **drawSurfs, int numDrawSurfs ); void RB_LoadShaderTextureMatrix( const float *shaderRegisters, const textureStage_t *texture ); @@ -1451,7 +1451,7 @@ typedef struct { int totalIndexes; } optimizedShadow_t; -optimizedShadow_t SuperOptimizeOccluders( idVec4 *verts, glIndex_t *indexes, int numIndexes, +optimizedShadow_t SuperOptimizeOccluders( idVec4 *verts, glIndex_t *indexes, int numIndexes, idPlane projectionPlane, idVec3 projectionOrigin ); void CleanupOptimizedShadowTris( srfTriangles_t *tri ); @@ -1675,8 +1675,8 @@ TR_SHADOWBOUNDS ============================================================= */ idScreenRect R_CalcIntersectionScissor( const idRenderLightLocal * lightDef, - const idRenderEntityLocal * entityDef, - const viewDef_t * viewDef ); + const idRenderEntityLocal * entityDef, + const viewDef_t * viewDef ); //============================================= diff --git a/neo/renderer/tr_main.cpp b/neo/renderer/tr_main.cpp index 3b40d862..a1fbfcc2 100644 --- a/neo/renderer/tr_main.cpp +++ b/neo/renderer/tr_main.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"). @@ -305,7 +305,7 @@ void *R_StaticAlloc( int bytes ) { tr.staticAllocCount += bytes; - buf = Mem_Alloc( bytes ); + buf = Mem_Alloc( bytes ); // don't exit on failure on zero length allocations since the old code didn't if ( !buf && ( bytes != 0 ) ) { @@ -334,7 +334,7 @@ R_StaticFree */ void R_StaticFree( void *data ) { tr.pc.c_free++; - Mem_Free( data ); + Mem_Free( data ); } /* @@ -366,7 +366,7 @@ void *R_FrameAlloc( int bytes ) { frameData_t *frame; frameMemoryBlock_t *block; void *buf; - + bytes = (bytes+16)&~15; // see if it can be satisfied in the current block frame = frameData; @@ -475,16 +475,16 @@ void R_LocalPointToGlobal( const float modelMatrix[16], const idVec3 &in, idVec3 i0 = in[0]; i1 = in[1]; i2 = in[2]; - + m0 = _mm_loadu_ps(&modelMatrix[0]); m1 = _mm_loadu_ps(&modelMatrix[4]); m2 = _mm_loadu_ps(&modelMatrix[8]); m3 = _mm_loadu_ps(&modelMatrix[12]); - + in0 = _mm_load1_ps(&i0); in1 = _mm_load1_ps(&i1); in2 = _mm_load1_ps(&i2); - + m0 = _mm_mul_ps(m0, in0); m1 = _mm_mul_ps(m1, in1); m2 = _mm_mul_ps(m2, in2); @@ -492,13 +492,13 @@ void R_LocalPointToGlobal( const float modelMatrix[16], const idVec3 &in, idVec3 m0 = _mm_add_ps(m0, m1); m0 = _mm_add_ps(m0, m2); m0 = _mm_add_ps(m0, m3); - + _mm_store_ss(&out[0], m0); m1 = (__m128) _mm_shuffle_epi32((__m128i)m0, 0x55); _mm_store_ss(&out[1], m1); m2 = _mm_movehl_ps(m2, m0); _mm_store_ss(&out[2], m2); -#else +#else out[0] = in[0] * modelMatrix[0] + in[1] * modelMatrix[4] + in[2] * modelMatrix[8] + modelMatrix[12]; out[1] = in[0] * modelMatrix[1] + in[1] * modelMatrix[5] @@ -688,7 +688,7 @@ void R_TransformModelToClip( const idVec3 &src, const float *modelMatrix, const int i; for ( i = 0 ; i < 4 ; i++ ) { - eye[i] = + eye[i] = src[0] * modelMatrix[ i + 0 * 4 ] + src[1] * modelMatrix[ i + 1 * 4 ] + src[2] * modelMatrix[ i + 2 * 4 ] + @@ -696,7 +696,7 @@ void R_TransformModelToClip( const idVec3 &src, const float *modelMatrix, const } for ( i = 0 ; i < 4 ; i++ ) { - dst[i] = + dst[i] = eye[0] * projectionMatrix[ i + 0 * 4 ] + eye[1] * projectionMatrix[ i + 1 * 4 ] + eye[2] * projectionMatrix[ i + 2 * 4 ] + @@ -720,7 +720,7 @@ void R_GlobalToNormalizedDeviceCoordinates( const idVec3 &global, idVec3 &ndc ) if ( !tr.viewDef ) { for ( i = 0 ; i < 4 ; i ++ ) { - view[i] = + view[i] = global[0] * tr.primaryView->worldSpace.modelViewMatrix[ i + 0 * 4 ] + global[1] * tr.primaryView->worldSpace.modelViewMatrix[ i + 1 * 4 ] + global[2] * tr.primaryView->worldSpace.modelViewMatrix[ i + 2 * 4 ] + @@ -728,7 +728,7 @@ void R_GlobalToNormalizedDeviceCoordinates( const idVec3 &global, idVec3 &ndc ) } for ( i = 0 ; i < 4 ; i ++ ) { - clip[i] = + clip[i] = view[0] * tr.primaryView->projectionMatrix[ i + 0 * 4 ] + view[1] * tr.primaryView->projectionMatrix[ i + 1 * 4 ] + view[2] * tr.primaryView->projectionMatrix[ i + 2 * 4 ] + @@ -738,7 +738,7 @@ void R_GlobalToNormalizedDeviceCoordinates( const idVec3 &global, idVec3 &ndc ) } else { for ( i = 0 ; i < 4 ; i ++ ) { - view[i] = + view[i] = global[0] * tr.viewDef->worldSpace.modelViewMatrix[ i + 0 * 4 ] + global[1] * tr.viewDef->worldSpace.modelViewMatrix[ i + 1 * 4 ] + global[2] * tr.viewDef->worldSpace.modelViewMatrix[ i + 2 * 4 ] + @@ -747,7 +747,7 @@ void R_GlobalToNormalizedDeviceCoordinates( const idVec3 &global, idVec3 &ndc ) for ( i = 0 ; i < 4 ; i ++ ) { - clip[i] = + clip[i] = view[0] * tr.viewDef->projectionMatrix[ i + 0 * 4 ] + view[1] * tr.viewDef->projectionMatrix[ i + 1 * 4 ] + view[2] * tr.viewDef->projectionMatrix[ i + 2 * 4 ] + diff --git a/neo/renderer/tr_orderIndexes.cpp b/neo/renderer/tr_orderIndexes.cpp index 712500e0..264bd6e9 100644 --- a/neo/renderer/tr_orderIndexes.cpp +++ b/neo/renderer/tr_orderIndexes.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"). @@ -209,4 +209,3 @@ void R_OrderIndexes( int numIndexes, glIndex_t *indexes ) { */ - diff --git a/neo/renderer/tr_polytope.cpp b/neo/renderer/tr_polytope.cpp index 87858704..8b606188 100644 --- a/neo/renderer/tr_polytope.cpp +++ b/neo/renderer/tr_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/neo/renderer/tr_render.cpp b/neo/renderer/tr_render.cpp index cbafdc70..33b6e727 100644 --- a/neo/renderer/tr_render.cpp +++ b/neo/renderer/tr_render.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"). @@ -91,7 +91,7 @@ void RB_DrawElementsWithCounters( const srfTriangles_t *tri ) { } if ( tri->indexCache && r_useIndexBuffers.GetBool() ) { - qglDrawElements( GL_TRIANGLES, + qglDrawElements( GL_TRIANGLES, r_singleTriangle.GetBool() ? 3 : tri->numIndexes, GL_INDEX_TYPE, (int *)vertexCache.Position( tri->indexCache ) ); @@ -100,7 +100,7 @@ void RB_DrawElementsWithCounters( const srfTriangles_t *tri ) { if ( r_useIndexBuffers.GetBool() ) { vertexCache.UnbindIndex(); } - qglDrawElements( GL_TRIANGLES, + qglDrawElements( GL_TRIANGLES, r_singleTriangle.GetBool() ? 3 : tri->numIndexes, GL_INDEX_TYPE, tri->indexes ); @@ -120,7 +120,7 @@ void RB_DrawShadowElementsWithCounters( const srfTriangles_t *tri, int numIndexe backEnd.pc.c_shadowVertexes += tri->numVerts; if ( tri->indexCache && r_useIndexBuffers.GetBool() ) { - qglDrawElements( GL_TRIANGLES, + qglDrawElements( GL_TRIANGLES, r_singleTriangle.GetBool() ? 3 : numIndexes, GL_INDEX_TYPE, (int *)vertexCache.Position( tri->indexCache ) ); @@ -129,7 +129,7 @@ void RB_DrawShadowElementsWithCounters( const srfTriangles_t *tri, int numIndexe if ( r_useIndexBuffers.GetBool() ) { vertexCache.UnbindIndex(); } - qglDrawElements( GL_TRIANGLES, + qglDrawElements( GL_TRIANGLES, r_singleTriangle.GetBool() ? 3 : numIndexes, GL_INDEX_TYPE, tri->indexes ); @@ -229,7 +229,7 @@ matrix will already have been loaded, and backEnd.currentSpace will be updated after the triangle function completes. ==================== */ -void RB_RenderDrawSurfListWithFunction( drawSurf_t **drawSurfs, int numDrawSurfs, +void RB_RenderDrawSurfListWithFunction( drawSurf_t **drawSurfs, int numDrawSurfs, void (*triFunc_)( const drawSurf_t *) ) { int i; const drawSurf_t *drawSurf; @@ -255,7 +255,7 @@ void RB_RenderDrawSurfListWithFunction( drawSurf_t **drawSurfs, int numDrawSurfs // change the scissor if needed if ( r_useScissor.GetBool() && !backEnd.currentScissor.Equals( drawSurf->scissorRect ) ) { backEnd.currentScissor = drawSurf->scissorRect; - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); @@ -277,7 +277,7 @@ void RB_RenderDrawSurfListWithFunction( drawSurf_t **drawSurfs, int numDrawSurfs RB_RenderDrawSurfChainWithFunction ====================== */ -void RB_RenderDrawSurfChainWithFunction( const drawSurf_t *drawSurfs, +void RB_RenderDrawSurfChainWithFunction( const drawSurf_t *drawSurfs, void (*triFunc_)( const drawSurf_t *) ) { const drawSurf_t *drawSurf; @@ -300,7 +300,7 @@ void RB_RenderDrawSurfChainWithFunction( const drawSurf_t *drawSurfs, // change the scissor if needed if ( r_useScissor.GetBool() && !backEnd.currentScissor.Equals( drawSurf->scissorRect ) ) { backEnd.currentScissor = drawSurf->scissorRect; - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); @@ -449,9 +449,9 @@ RB_FinishStageTexture ====================== */ void RB_FinishStageTexture( const textureStage_t *texture, const drawSurf_t *surf ) { - if ( texture->texgen == TG_DIFFUSE_CUBE || texture->texgen == TG_SKYBOX_CUBE + if ( texture->texgen == TG_DIFFUSE_CUBE || texture->texgen == TG_SKYBOX_CUBE || texture->texgen == TG_WOBBLESKY_CUBE ) { - qglTexCoordPointer( 2, GL_FLOAT, sizeof( idDrawVert ), + qglTexCoordPointer( 2, GL_FLOAT, sizeof( idDrawVert ), (void *)&(((idDrawVert *)vertexCache.Position( surf->geo->ambientCache ))->st) ); } @@ -559,14 +559,14 @@ void RB_BeginDrawingView (void) { qglMatrixMode(GL_MODELVIEW); // set the window clipping - qglViewport( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1, - tr.viewportOffset[1] + backEnd.viewDef->viewport.y1, + qglViewport( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1, + tr.viewportOffset[1] + backEnd.viewDef->viewport.y1, backEnd.viewDef->viewport.x2 + 1 - backEnd.viewDef->viewport.x1, backEnd.viewDef->viewport.y2 + 1 - backEnd.viewDef->viewport.y1 ); // the scissor may be smaller than the viewport for subviews - qglScissor( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1 + backEnd.viewDef->scissor.x1, - tr.viewportOffset[1] + backEnd.viewDef->viewport.y1 + backEnd.viewDef->scissor.y1, + qglScissor( tr.viewportOffset[0] + backEnd.viewDef->viewport.x1 + backEnd.viewDef->scissor.x1, + tr.viewportOffset[1] + backEnd.viewDef->viewport.y1 + backEnd.viewDef->scissor.y1, backEnd.viewDef->scissor.x2 + 1 - backEnd.viewDef->scissor.x1, backEnd.viewDef->scissor.y2 + 1 - backEnd.viewDef->scissor.y1 ); backEnd.currentScissor = backEnd.viewDef->scissor; @@ -667,12 +667,12 @@ static void RB_SubmittInteraction( drawInteraction_t *din, void (*DrawInteractio } // if we wouldn't draw anything, don't call the Draw function - if ( - ( ( din->diffuseColor[0] > 0 || - din->diffuseColor[1] > 0 || + if ( + ( ( din->diffuseColor[0] > 0 || + din->diffuseColor[1] > 0 || din->diffuseColor[2] > 0 ) && din->diffuseImage != globalImages->blackImage ) - || ( ( din->specularColor[0] > 0 || - din->specularColor[1] > 0 || + || ( ( din->specularColor[0] > 0 || + din->specularColor[1] > 0 || din->specularColor[2] > 0 ) && din->specularImage != globalImages->blackImage ) ) { DrawInteraction( din ); } @@ -711,7 +711,7 @@ void RB_CreateSingleDrawInteractions( const drawSurf_t *surf, void (*DrawInterac // change the scissor if needed if ( r_useScissor.GetBool() && !backEnd.currentScissor.Equals( surf->scissorRect ) ) { backEnd.currentScissor = surf->scissorRect; - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); @@ -852,7 +852,7 @@ void RB_DrawView( const void *data ) { cmd = (const drawSurfsCommand_t *)data; backEnd.viewDef = cmd->viewDef; - + // we will need to do a new copyTexSubImage of the screen // when a SS_POST_PROCESS material is used backEnd.currentRenderCopied = false; diff --git a/neo/renderer/tr_rendertools.cpp b/neo/renderer/tr_rendertools.cpp index d84ada3e..c8684491 100644 --- a/neo/renderer/tr_rendertools.cpp +++ b/neo/renderer/tr_rendertools.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"). @@ -132,7 +132,7 @@ void RB_SimpleSurfaceSetup( const drawSurf_t *drawSurf ) { // change the scissor if needed if ( r_useScissor.GetBool() && !backEnd.currentScissor.Equals( drawSurf->scissorRect ) ) { backEnd.currentScissor = drawSurf->scissorRect; - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); @@ -149,7 +149,7 @@ void RB_SimpleWorldSetup( void ) { qglLoadMatrixf( backEnd.viewDef->worldSpace.modelViewMatrix ); backEnd.currentScissor = backEnd.viewDef->scissor; - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); @@ -413,8 +413,8 @@ void RB_ShowIntensity( void ) { qglMatrixMode( GL_PROJECTION ); GL_State( GLS_DEPTHFUNC_ALWAYS ); qglPushMatrix(); - qglLoadIdentity(); - qglOrtho( 0, 1, 0, 1, -1, 1 ); + qglLoadIdentity(); + qglOrtho( 0, 1, 0, 1, -1, 1 ); qglRasterPos2f( 0, 0 ); qglPopMatrix(); qglColor3f( 1, 1, 1 ); @@ -445,8 +445,8 @@ void RB_ShowDepthBuffer( void ) { qglLoadIdentity(); qglMatrixMode( GL_PROJECTION ); qglPushMatrix(); - qglLoadIdentity(); - qglOrtho( 0, 1, 0, 1, -1, 1 ); + qglLoadIdentity(); + qglOrtho( 0, 1, 0, 1, -1, 1 ); qglRasterPos2f( 0, 0 ); qglPopMatrix(); qglMatrixMode( GL_MODELVIEW ); @@ -463,8 +463,8 @@ void RB_ShowDepthBuffer( void ) { #if 0 for ( i = 0 ; i < glConfig.vidWidth * glConfig.vidHeight ; i++ ) { - ((byte *)depthReadback)[i*4] = - ((byte *)depthReadback)[i*4+1] = + ((byte *)depthReadback)[i*4] = + ((byte *)depthReadback)[i*4+1] = ((byte *)depthReadback)[i*4+2] = 255 * ((float *)depthReadback)[i]; ((byte *)depthReadback)[i*4+3] = 1; } @@ -566,7 +566,7 @@ void RB_ShowSilhouette( void ) { GL_Cull( CT_TWO_SIDED ); qglDisable( GL_DEPTH_TEST ); - RB_RenderDrawSurfListWithFunction( backEnd.viewDef->drawSurfs, backEnd.viewDef->numDrawSurfs, + RB_RenderDrawSurfListWithFunction( backEnd.viewDef->drawSurfs, backEnd.viewDef->numDrawSurfs, RB_T_RenderTriangleSurface ); @@ -653,7 +653,7 @@ static void RB_ShowShadowCount( void ) { for ( vLight = backEnd.viewDef->viewLights ; vLight ; vLight = vLight->next ) { for ( i = 0 ; i < 2 ; i++ ) { - for ( surf = i ? vLight->localShadows : vLight->globalShadows + for ( surf = i ? vLight->localShadows : vLight->globalShadows ; surf ; surf = (drawSurf_t *)surf->nextOnLight ) { RB_SimpleSurfaceSetup( surf ); const srfTriangles_t *tri = surf->geo; @@ -787,7 +787,7 @@ Debugging tool static void RB_ShowSurfaceInfo( drawSurf_t **drawSurfs, int numDrawSurfs ) { modelTrace_t mt; idVec3 start, end; - + if ( !r_showSurfaceInfo.GetBool() ) { return; } @@ -819,7 +819,7 @@ static void RB_ShowSurfaceInfo( drawSurf_t **drawSurfs, int numDrawSurfs ) { tr.primaryWorld->DrawText( mt.entity->hModel->Name(), mt.point + tr.primaryView->renderView.viewaxis[2] * 12, 0.35f, colorRed, tr.primaryView->renderView.viewaxis ); - tr.primaryWorld->DrawText( mt.material->GetName(), mt.point, + tr.primaryWorld->DrawText( mt.material->GetName(), mt.point, 0.35f, colorBlue, tr.primaryView->renderView.viewaxis ); qglEnable( GL_DEPTH_TEST ); @@ -1060,13 +1060,13 @@ static void RB_ShowTangentSpace( drawSurf_t **drawSurfs, int numDrawSurfs ) { v = &tri->verts[tri->indexes[j]]; if ( r_showTangentSpace.GetInteger() == 1 ) { - qglColor4f( 0.5 + 0.5 * v->tangents[0][0], 0.5 + 0.5 * v->tangents[0][1], + qglColor4f( 0.5 + 0.5 * v->tangents[0][0], 0.5 + 0.5 * v->tangents[0][1], 0.5 + 0.5 * v->tangents[0][2], 0.5 ); } else if ( r_showTangentSpace.GetInteger() == 2 ) { - qglColor4f( 0.5 + 0.5 * v->tangents[1][0], 0.5 + 0.5 * v->tangents[1][1], + qglColor4f( 0.5 + 0.5 * v->tangents[1][0], 0.5 + 0.5 * v->tangents[1][1], 0.5 + 0.5 * v->tangents[1][2], 0.5 ); } else { - qglColor4f( 0.5 + 0.5 * v->normal[0], 0.5 + 0.5 * v->normal[1], + qglColor4f( 0.5 + 0.5 * v->normal[0], 0.5 + 0.5 * v->normal[1], 0.5 + 0.5 * v->normal[2], 0.5 ); } qglVertex3fv( v->xyz.ToFloatPtr() ); @@ -1199,7 +1199,7 @@ static void RB_ShowNormals( drawSurf_t **drawSurfs, int numDrawSurfs ) { if ( !tri->verts ) { continue; } - + for ( j = 0 ; j < tri->numVerts ; j++ ) { R_LocalPointToGlobal( drawSurf->space->modelMatrix, tri->verts[j].xyz + tri->verts[j].tangents[0] + tri->verts[j].normal * 0.2f, pos ); RB_DrawText( va( "%d", j ), pos, 0.01f, colorWhite, backEnd.viewDef->renderView.viewaxis, 1 ); @@ -1365,7 +1365,7 @@ static void RB_ShowTextureVectors( drawSurf_t **drawSurfs, int numDrawSurfs ) { temp[2] = (d0[2] * d1[4] - d0[4] * d1[2]) * inva; temp.Normalize(); tangents[0] = temp; - + temp[0] = (d0[3] * d1[0] - d0[0] * d1[3]) * inva; temp[1] = (d0[3] * d1[1] - d0[1] * d1[3]) * inva; temp[2] = (d0[3] * d1[2] - d0[2] * d1[3]) * inva; @@ -1733,18 +1733,18 @@ float RB_DrawTextLength( const char *text, float scale, int len ) { spacing = simplex[charIndex][1]; index = 2; - while( index - 2 < num ) { - if ( simplex[charIndex][index] < 0) { + while( index - 2 < num ) { + if ( simplex[charIndex][index] < 0) { index++; - continue; - } + continue; + } index += 2; - if ( simplex[charIndex][index] < 0) { + if ( simplex[charIndex][index] < 0) { index++; - continue; - } - } - textLen += spacing * scale; + continue; + } + } + textLen += spacing * scale; } } return textLen; @@ -1805,9 +1805,9 @@ static void RB_DrawText( const char *text, const idVec3 &origin, float scale, co index = 2; while( index - 2 < num ) { - if ( simplex[charIndex][index] < 0) { + if ( simplex[charIndex][index] < 0) { index++; - continue; + continue; } p1 = org + scale * simplex[charIndex][index] * -viewAxis[1] + scale * simplex[charIndex][index+1] * viewAxis[2]; index += 2; @@ -2193,9 +2193,9 @@ void RB_TestGamma( void ) { GL_State( GLS_DEPTHFUNC_ALWAYS ); qglColor3f( 1, 1, 1 ); qglPushMatrix(); - qglLoadIdentity(); + qglLoadIdentity(); qglDisable( GL_TEXTURE_2D ); - qglOrtho( 0, 1, 0, 1, -1, 1 ); + qglOrtho( 0, 1, 0, 1, -1, 1 ); qglRasterPos2f( 0.01f, 0.01f ); qglDrawPixels( G_WIDTH, G_HEIGHT, GL_RGBA, GL_UNSIGNED_BYTE, image ); qglPopMatrix(); @@ -2243,9 +2243,9 @@ static void RB_TestGammaBias( void ) { GL_State( GLS_DEPTHFUNC_ALWAYS ); qglColor3f( 1, 1, 1 ); qglPushMatrix(); - qglLoadIdentity(); + qglLoadIdentity(); qglDisable( GL_TEXTURE_2D ); - qglOrtho( 0, 1, 0, 1, -1, 1 ); + qglOrtho( 0, 1, 0, 1, -1, 1 ); qglRasterPos2f( 0.01f, 0.01f ); qglDrawPixels( G_WIDTH, G_HEIGHT, GL_RGBA, GL_UNSIGNED_BYTE, image ); qglPopMatrix(); @@ -2297,12 +2297,12 @@ void RB_TestImage( void ) { GL_State( GLS_DEPTHFUNC_ALWAYS | GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA ); qglColor3f( 1, 1, 1 ); qglPushMatrix(); - qglLoadIdentity(); - qglOrtho( 0, 1, 0, 1, -1, 1 ); + qglLoadIdentity(); + qglOrtho( 0, 1, 0, 1, -1, 1 ); tr.testImage->Bind(); qglBegin( GL_QUADS ); - + qglTexCoord2f( 0, 1 ); qglVertex2f( 0.5 - w, 0 ); @@ -2336,7 +2336,7 @@ void RB_RenderDebugTools( drawSurf_t **drawSurfs, int numDrawSurfs ) { GL_State( GLS_DEFAULT ); backEnd.currentScissor = backEnd.viewDef->scissor; - qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, + qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1, backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1, backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1, backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 ); diff --git a/neo/renderer/tr_shadowbounds.cpp b/neo/renderer/tr_shadowbounds.cpp index 6174b5c5..3221609f 100644 --- a/neo/renderer/tr_shadowbounds.cpp +++ b/neo/renderer/tr_shadowbounds.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"). @@ -34,7 +34,7 @@ If you have questions concerning this license or the applicable additional terms // Compute conservative shadow bounds as the intersection // of the object's bounds' shadow volume and the light's bounds. -// +// // --cass @@ -84,9 +84,9 @@ typedef MyArray MyArrayVec4; struct poly { - MyArrayInt vi; - MyArrayInt ni; - idVec4 plane; + MyArrayInt vi; + MyArrayInt ni; + idVec4 plane; }; typedef MyArray MyArrayPoly; @@ -94,8 +94,8 @@ typedef MyArray MyArrayPoly; struct edge { - int vi[2]; - int pi[2]; + int vi[2]; + int pi[2]; }; typedef MyArray MyArrayEdge; @@ -103,153 +103,153 @@ typedef MyArray MyArrayEdge; MyArrayInt four_ints(int a, int b, int c, int d) { - MyArrayInt vi; - vi.push_back(a); - vi.push_back(b); - vi.push_back(c); - vi.push_back(d); - return vi; + MyArrayInt vi; + vi.push_back(a); + vi.push_back(b); + vi.push_back(c); + vi.push_back(d); + return vi; } idVec3 homogeneous_difference(idVec4 a, idVec4 b) { - idVec3 v; + idVec3 v; v.x = b.x * a.w - a.x * b.w; v.y = b.y * a.w - a.y * b.w; v.z = b.z * a.w - a.z * b.w; - return v; + return v; } // handles positive w only idVec4 compute_homogeneous_plane(idVec4 a, idVec4 b, idVec4 c) { - idVec4 v, t; + idVec4 v, t; - if(a[3] == 0) - { t = a; a = b; b = c; c = t; } - if(a[3] == 0) - { t = a; a = b; b = c; c = t; } + if(a[3] == 0) + { t = a; a = b; b = c; c = t; } + if(a[3] == 0) + { t = a; a = b; b = c; c = t; } - // can't handle 3 infinite points - if( a[3] == 0 ) - return v; + // can't handle 3 infinite points + if( a[3] == 0 ) + return v; + + idVec3 vb = homogeneous_difference(a, b); + idVec3 vc = homogeneous_difference(a, c); + + idVec3 n = vb.Cross(vc); + n.Normalize(); - idVec3 vb = homogeneous_difference(a, b); - idVec3 vc = homogeneous_difference(a, c); - - idVec3 n = vb.Cross(vc); - n.Normalize(); - v.x = n.x; v.y = n.y; v.z = n.z; v.w = - (n * idVec3(a.x, a.y, a.z)) / a.w ; - return v; + return v; } struct polyhedron { - MyArrayVec4 v; - MyArrayPoly p; - MyArrayEdge e; + MyArrayVec4 v; + MyArrayPoly p; + MyArrayEdge e; - void add_quad( int va, int vb, int vc, int vd ) - { - poly pg; - pg.vi = four_ints(va, vb, vc, vd); - pg.ni = four_ints(-1, -1, -1, -1); - pg.plane = compute_homogeneous_plane(v[va], v[vb], v[vc]); - p.push_back(pg); - } + void add_quad( int va, int vb, int vc, int vd ) + { + poly pg; + pg.vi = four_ints(va, vb, vc, vd); + pg.ni = four_ints(-1, -1, -1, -1); + pg.plane = compute_homogeneous_plane(v[va], v[vb], v[vc]); + p.push_back(pg); + } - void discard_neighbor_info() - { - for(unsigned int i = 0; i < p.size(); i++ ) - { - MyArrayInt & ni = p[i].ni; - for(unsigned int j = 0; j < ni.size(); j++) - ni[j] = -1; - } - } + void discard_neighbor_info() + { + for(unsigned int i = 0; i < p.size(); i++ ) + { + MyArrayInt & ni = p[i].ni; + for(unsigned int j = 0; j < ni.size(); j++) + ni[j] = -1; + } + } - void compute_neighbors() - { + void compute_neighbors() + { e.empty(); - discard_neighbor_info(); + discard_neighbor_info(); - bool found; - int P = p.size(); - // for each polygon - for(int i = 0; i < P-1; i++ ) - { - const MyArrayInt & vi = p[i].vi; - MyArrayInt & ni = p[i].ni; - int Si = vi.size(); + bool found; + int P = p.size(); + // for each polygon + for(int i = 0; i < P-1; i++ ) + { + const MyArrayInt & vi = p[i].vi; + MyArrayInt & ni = p[i].ni; + int Si = vi.size(); - // for each edge of that polygon - for(int ii=0; ii < Si; ii++) - { - int ii0 = ii; - int ii1 = (ii+1) % Si; + // for each edge of that polygon + for(int ii=0; ii < Si; ii++) + { + int ii0 = ii; + int ii1 = (ii+1) % Si; - // continue if we've already found this neighbor - if(ni[ii] != -1) - continue; - found = false; - // check all remaining polygons - for(int j = i+1; j < P; j++ ) - { - const MyArrayInt & vj = p[j].vi; - MyArrayInt & nj = p[j].ni; - int Sj = vj.size(); + // continue if we've already found this neighbor + if(ni[ii] != -1) + continue; + found = false; + // check all remaining polygons + for(int j = i+1; j < P; j++ ) + { + const MyArrayInt & vj = p[j].vi; + MyArrayInt & nj = p[j].ni; + int Sj = vj.size(); - for( int jj = 0; jj < Sj; jj++ ) - { - int jj0 = jj; - int jj1 = (jj+1) % Sj; - if(vi[ii0] == vj[jj1] && vi[ii1] == vj[jj0]) - { - edge ed; - ed.vi[0] = vi[ii0]; - ed.vi[1] = vi[ii1]; - ed.pi[0] = i; - ed.pi[1] = j; - e.push_back(ed); - ni[ii] = j; - nj[jj] = i; - found = true; - break; - } - else if ( vi[ii0] == vj[jj0] && vi[ii1] == vj[jj1] ) - { - fprintf(stderr,"why am I here?\n"); - } - } - if( found ) - break; - } - } - } - } + for( int jj = 0; jj < Sj; jj++ ) + { + int jj0 = jj; + int jj1 = (jj+1) % Sj; + if(vi[ii0] == vj[jj1] && vi[ii1] == vj[jj0]) + { + edge ed; + ed.vi[0] = vi[ii0]; + ed.vi[1] = vi[ii1]; + ed.pi[0] = i; + ed.pi[1] = j; + e.push_back(ed); + ni[ii] = j; + nj[jj] = i; + found = true; + break; + } + else if ( vi[ii0] == vj[jj0] && vi[ii1] == vj[jj1] ) + { + fprintf(stderr,"why am I here?\n"); + } + } + if( found ) + break; + } + } + } + } - void recompute_planes() - { - // for each polygon - for(unsigned int i = 0; i < p.size(); i++ ) - { - p[i].plane = compute_homogeneous_plane(v[p[i].vi[0]], v[p[i].vi[1]], v[p[i].vi[2]]); - } - } + void recompute_planes() + { + // for each polygon + for(unsigned int i = 0; i < p.size(); i++ ) + { + p[i].plane = compute_homogeneous_plane(v[p[i].vi[0]], v[p[i].vi[1]], v[p[i].vi[2]]); + } + } - void transform(const idMat4 & m) - { - for(unsigned int i=0; i < v.size(); i++ ) - v[i] = m * v[i]; - recompute_planes(); - } + void transform(const idMat4 & m) + { + for(unsigned int i=0; i < v.size(); i++ ) + v[i] = m * v[i]; + recompute_planes(); + } }; @@ -309,7 +309,7 @@ polyhedron PolyhedronFromBounds( const idBounds & b ) p2.v.push_back(idVec4( min.x, max.y, min.z, 1)); p2.recompute_planes(); - return p2; + return p2; } @@ -329,13 +329,13 @@ polyhedron make_sv(const polyhedron & oc, idVec4 light) ph = oc; int V = ph.v.size(); - for( int j = 0; j < V; j++ ) + for( int j = 0; j < V; j++ ) { idVec3 proj = homogeneous_difference( light, ph.v[j] ); ph.v.push_back( idVec4(proj.x, proj.y, proj.z, 0) ); } - ph.p.empty(); + ph.p.empty(); for(unsigned int i=0; i < oc.p.size(); i++) { @@ -384,16 +384,16 @@ polyhedron make_sv(const polyhedron & oc, idVec4 light) // initalize vertices ph2.v = oc.v; int V = ph2.v.size(); - for( int j = 0; j < V; j++ ) + for( int j = 0; j < V; j++ ) { idVec3 proj = homogeneous_difference( light, ph2.v[j] ); ph2.v.push_back( idVec4(proj.x, proj.y, proj.z, 0) ); } - // need to compute planes for the shadow volume (sv) - ph2.recompute_planes(); + // need to compute planes for the shadow volume (sv) + ph2.recompute_planes(); - return ph2; + return ph2; } typedef MyArray MySegments; @@ -402,77 +402,77 @@ typedef MyArray MySegments; void polyhedron_edges(polyhedron & a, MySegments & e) { e.empty(); - if(a.e.size() == 0 && a.p.size() != 0) - a.compute_neighbors(); + if(a.e.size() == 0 && a.p.size() != 0) + a.compute_neighbors(); - for(unsigned int i = 0; i < a.e.size(); i++) - { - e.push_back(a.v[a.e[i].vi[0]]); - e.push_back(a.v[a.e[i].vi[1]]); - } + for(unsigned int i = 0; i < a.e.size(); i++) + { + e.push_back(a.v[a.e[i].vi[0]]); + e.push_back(a.v[a.e[i].vi[1]]); + } } // clip the segments of e by the planes of polyhedron a. void clip_segments(const polyhedron & ph, MySegments & is, MySegments & os) { - const MyArrayPoly & p = ph.p; + const MyArrayPoly & p = ph.p; - for(unsigned int i = 0; i < is.size(); i+=2 ) - { - idVec4 a = is[i ]; - idVec4 b = is[i+1]; - idVec4 c; + for(unsigned int i = 0; i < is.size(); i+=2 ) + { + idVec4 a = is[i ]; + idVec4 b = is[i+1]; + idVec4 c; - bool discard = false; + bool discard = false; - for(unsigned int j = 0; j < p.size(); j++ ) - { - float da = a * p[j].plane; - float db = b * p[j].plane; - float rdw = 1/(da - db); + for(unsigned int j = 0; j < p.size(); j++ ) + { + float da = a * p[j].plane; + float db = b * p[j].plane; + float rdw = 1/(da - db); - int code = 0; - if( da > 0 ) - code = 2; - if( db > 0 ) - code |= 1; + int code = 0; + if( da > 0 ) + code = 2; + if( db > 0 ) + code |= 1; - switch ( code ) - { - case 3: - discard = true; - break; + switch ( code ) + { + case 3: + discard = true; + break; - case 2: - c = -db * rdw * a + da * rdw * b; - a = c; - break; + case 2: + c = -db * rdw * a + da * rdw * b; + a = c; + break; - case 1: - c = -db * rdw * a + da * rdw * b; - b = c; - break; + case 1: + c = -db * rdw * a + da * rdw * b; + b = c; + break; - case 0: - break; + case 0: + break; - default: - common->Printf("bad clip code!\n"); - break; - } + default: + common->Printf("bad clip code!\n"); + break; + } - if( discard ) - break; - } + if( discard ) + break; + } - if( ! discard ) - { - os.push_back(a); - os.push_back(b); - } - } + if( ! discard ) + { + os.push_back(a); + os.push_back(b); + } + } } @@ -510,7 +510,7 @@ void world_to_hclip( const viewDef_t *viewDef, const idVec4 &global, idVec4 &cli idVec4 view; for ( i = 0 ; i < 4 ; i ++ ) { - view[i] = + view[i] = global[0] * viewDef->worldSpace.modelViewMatrix[ i + 0 * 4 ] + global[1] * viewDef->worldSpace.modelViewMatrix[ i + 1 * 4 ] + global[2] * viewDef->worldSpace.modelViewMatrix[ i + 2 * 4 ] + @@ -519,7 +519,7 @@ void world_to_hclip( const viewDef_t *viewDef, const idVec4 &global, idVec4 &cli for ( i = 0 ; i < 4 ; i ++ ) { - clip[i] = + clip[i] = view[0] * viewDef->projectionMatrix[ i + 0 * 4 ] + view[1] * viewDef->projectionMatrix[ i + 1 * 4 ] + view[2] * viewDef->projectionMatrix[ i + 2 * 4 ] + @@ -528,7 +528,7 @@ void world_to_hclip( const viewDef_t *viewDef, const idVec4 &global, idVec4 &cli } idScreenRect R_CalcIntersectionScissor( const idRenderLightLocal * lightDef, - const idRenderEntityLocal * entityDef, + const idRenderEntityLocal * entityDef, const viewDef_t * viewDef ) { idMat4 omodel = make_idMat4( entityDef->modelMatrix ); @@ -551,7 +551,7 @@ idScreenRect R_CalcIntersectionScissor( const idRenderLightLocal * lightDef, //viewDef->renderWorld->DebugBox( colorBlue, idBox( model->Bounds(), entityDef->parms.origin, entityDef->parms.axis ) ); // transform it into world space - vol.transform( omodel ); + vol.transform( omodel ); // debug // if ( r_useInteractionScissors.GetInteger() == -2 ) { @@ -565,21 +565,21 @@ idScreenRect R_CalcIntersectionScissor( const idRenderLightLocal * lightDef, 1.0f ); // generate shadow volume "polyhedron" - polyhedron sv = make_sv(vol, lightpos); + polyhedron sv = make_sv(vol, lightpos); - MySegments in_segs, out_segs; + MySegments in_segs, out_segs; // get shadow volume edges - polyhedron_edges(sv, in_segs); + polyhedron_edges(sv, in_segs); // clip them against light bounds planes - clip_segments(lvol, in_segs, out_segs); + clip_segments(lvol, in_segs, out_segs); // get light bounds edges polyhedron_edges(lvol, in_segs); // clip them by the shadow volume - clip_segments(sv, in_segs, out_segs); + clip_segments(sv, in_segs, out_segs); - // debug // + // debug // if ( r_useInteractionScissors.GetInteger() == -2 ) { draw_segments( viewDef, out_segs, colorGreen ); } diff --git a/neo/renderer/tr_stencilshadow.cpp b/neo/renderer/tr_stencilshadow.cpp index 42d5f66f..539b42f4 100644 --- a/neo/renderer/tr_stencilshadow.cpp +++ b/neo/renderer/tr_stencilshadow.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 @@ If you have questions concerning this license or the applicable additional terms If a triangle has no points outside the frustum, it does not need to be clipped. - + USING THE STENCIL BUFFER FOR SHADOWING @@ -86,7 +86,7 @@ If you have questions concerning this license or the applicable additional terms issues with silhouette optimizations the shapes of shadow projections are poor for sphere or box culling - + the gouraud shading problem @@ -425,12 +425,12 @@ static int R_ChopWinding( clipTri_t clipTris[2], int inNum, const idPlane &plane || (sides[i] == SIDE_BACK && sides[i+1] == SIDE_FRONT) ) { // generate a split point p2 = &in->verts[i+1]; - + dot = dists[i] / (dists[i]-dists[i+1]); for ( j=0 ; j<3 ; j++ ) { mid[j] = (*p1)[j] + dot*((*p2)[j]-(*p1)[j]); } - + out->verts[out->numVerts] = mid; // set the edge flag @@ -536,7 +536,7 @@ If one point is clearly clipped by the plane and the other point is on the plane, it will be completely removed. =================== */ -static bool R_ClipLineToLight( const idVec3 &a, const idVec3 &b, const idPlane frustum[4], +static bool R_ClipLineToLight( const idVec3 &a, const idVec3 &b, const idPlane frustum[4], idVec3 &p1, idVec3 &p2 ) { float *clip; int j; @@ -680,7 +680,7 @@ static void R_AddSilEdges( const srfTriangles_t *tri, unsigned short *pointCull, } v1 = numShadowVerts; v2 = v1 + 2; - if ( !R_ClipLineToLight( tri->verts[ sil->v1 ].xyz, tri->verts[ sil->v2 ].xyz, + if ( !R_ClipLineToLight( tri->verts[ sil->v1 ].xyz, tri->verts[ sil->v2 ].xyz, frustum, shadowVerts[v1].ToVec3(), shadowVerts[v2].ToVec3() ) ) { continue; // clipped away } @@ -721,7 +721,7 @@ static void R_AddSilEdges( const srfTriangles_t *tri, unsigned short *pointCull, shadowIndexes[numShadowIndexes++] = v1+1; shadowIndexes[numShadowIndexes++] = v2+1; } - } else { + } else { if ( PointsOrdered( shadowVerts[ v1 ].ToVec3(), shadowVerts[ v2 ].ToVec3() ) ) { shadowIndexes[numShadowIndexes++] = v1; shadowIndexes[numShadowIndexes++] = v2; @@ -808,9 +808,9 @@ If the frustum is just part of a point light, clipped planes don't need to be added. ================= */ -static void R_CreateShadowVolumeInFrustum( const idRenderEntityLocal *ent, +static void R_CreateShadowVolumeInFrustum( const idRenderEntityLocal *ent, const srfTriangles_t *tri, - const idRenderLightLocal *light, + const idRenderLightLocal *light, const idVec3 lightOrigin, const idPlane frustum[6], const idPlane &farPlane, @@ -888,7 +888,7 @@ static void R_CreateShadowVolumeInFrustum( const idRenderEntityLocal *ent, cullBits = ( ( pointCull[ i1 ] ^ 0xfc0 ) | ( pointCull[ i2 ] ^ 0xfc0 ) | ( pointCull[ i3 ] ^ 0xfc0 ) ) >> 6; // this will also define clip edges that will become // silhouette planes - if ( R_ClipTriangleToLight( tri->verts[i1].xyz, tri->verts[i2].xyz, + if ( R_ClipTriangleToLight( tri->verts[i1].xyz, tri->verts[i2].xyz, tri->verts[i3].xyz, cullBits, frustum ) ) { faceCastsShadow[i] = 1; } @@ -924,7 +924,7 @@ static void R_CreateShadowVolumeInFrustum( const idRenderEntityLocal *ent, // to remove internal sil edges and optimize the caps if ( callOptimizer ) { optimizedShadow_t opt; - + // project all of the vertexes to the shadow plane, generating // an equal number of back vertexes // R_ProjectPointsToFarPlane( ent, light, farPlane, firstShadowVert, numShadowVerts ); @@ -936,7 +936,7 @@ static void R_CreateShadowVolumeInFrustum( const idRenderEntityLocal *ent, numShadowVerts = firstShadowVert; // add the optimized data - if ( numShadowIndexes + opt.totalIndexes > MAX_SHADOW_INDEXES + if ( numShadowIndexes + opt.totalIndexes > MAX_SHADOW_INDEXES || numShadowVerts + opt.numVerts > MAX_SHADOW_VERTS ) { overflowed = true; common->Printf( "WARNING: overflowed MAX_SHADOW tables, shadow discarded\n" ); @@ -1065,7 +1065,7 @@ void R_MakeShadowFrustums( idRenderLightLocal *light ) { light->numShadowFrustums++; } #else - // exact projection,taking into account asymetric frustums when + // exact projection,taking into account asymetric frustums when // globalLightOrigin isn't centered static int faceCorners[6][4] = { @@ -1162,7 +1162,7 @@ void R_MakeShadowFrustums( idRenderLightLocal *light ) { #endif return; } - + // projected light light->numShadowFrustums = 1; @@ -1180,7 +1180,7 @@ void R_MakeShadowFrustums( idRenderLightLocal *light ) { plane.SetNormal( -light->frustum[i].Normal() ); plane.SetDist( -light->frustum[i].Dist() ); } - + frust->numPlanes = 6; frust->makeClippedPlanes = true; @@ -1361,7 +1361,7 @@ srfTriangles_t *R_CreateShadowVolume( const idRenderEntityLocal *ent, newTri->numShadowIndexesNoCaps = 0; for ( i = 0 ; i < indexFrustumNumber ; i++ ) { int c = indexRef[i].end - indexRef[i].silStart; - SIMDProcessor->Memcpy( newTri->indexes+newTri->numShadowIndexesNoCaps, + SIMDProcessor->Memcpy( newTri->indexes+newTri->numShadowIndexesNoCaps, shadowIndexes+indexRef[i].silStart, c * sizeof( newTri->indexes[0] ) ); newTri->numShadowIndexesNoCaps += c; } @@ -1369,7 +1369,7 @@ srfTriangles_t *R_CreateShadowVolume( const idRenderEntityLocal *ent, newTri->numShadowIndexesNoFrontCaps = newTri->numShadowIndexesNoCaps; for ( i = 0 ; i < indexFrustumNumber ; i++ ) { int c = indexRef[i].silStart - indexRef[i].rearCapStart; - SIMDProcessor->Memcpy( newTri->indexes+newTri->numShadowIndexesNoFrontCaps, + SIMDProcessor->Memcpy( newTri->indexes+newTri->numShadowIndexesNoFrontCaps, shadowIndexes+indexRef[i].rearCapStart, c * sizeof( newTri->indexes[0] ) ); newTri->numShadowIndexesNoFrontCaps += c; } @@ -1377,7 +1377,7 @@ srfTriangles_t *R_CreateShadowVolume( const idRenderEntityLocal *ent, newTri->numIndexes = newTri->numShadowIndexesNoFrontCaps; for ( i = 0 ; i < indexFrustumNumber ; i++ ) { int c = indexRef[i].rearCapStart - indexRef[i].frontCapStart; - SIMDProcessor->Memcpy( newTri->indexes+newTri->numIndexes, + SIMDProcessor->Memcpy( newTri->indexes+newTri->numIndexes, shadowIndexes+indexRef[i].frontCapStart, c * sizeof( newTri->indexes[0] ) ); newTri->numIndexes += c; } diff --git a/neo/renderer/tr_subview.cpp b/neo/renderer/tr_subview.cpp index 5c98a4a8..17c2e0bc 100644 --- a/neo/renderer/tr_subview.cpp +++ b/neo/renderer/tr_subview.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"). @@ -100,7 +100,7 @@ R_PreciseCullSurface Check the surface for visibility on a per-triangle basis for cases when it is going to be VERY expensive to draw (subviews) -If not culled, also returns the bounding box of the surface in +If not culled, also returns the bounding box of the surface in Normalized Device Coordinates, so it can be used to crop the scissor rect. OPTIMIZE: we could also take exact portal passing into consideration @@ -259,7 +259,7 @@ static viewDef_t *R_MirrorViewBySurface( drawSurf_t *drawSurf ) { parms->clipPlanes[0] = -camera.axis[0]; parms->clipPlanes[0][3] = -( camera.origin * parms->clipPlanes[0].Normal() ); - + return parms; } diff --git a/neo/renderer/tr_trace.cpp b/neo/renderer/tr_trace.cpp index a41933bd..63442225 100644 --- a/neo/renderer/tr_trace.cpp +++ b/neo/renderer/tr_trace.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"). @@ -146,7 +146,7 @@ localTrace_t R_LocalTrace( const idVec3 &start, const idVec3 &end, const float r if ( f < 0.0f ) { continue; // shouldn't happen } - + if ( f >= hit.fraction ) { continue; // have already hit something closer } @@ -271,7 +271,7 @@ localTrace_t R_LocalTrace( const idVec3 &start, const idVec3 &end, const float r #ifdef TEST_TRACE trace_timer.Stop(); - common->Printf( "testVerts:%i c_testPlanes:%i c_testEdges:%i c_intersect:%i msec:%1.4f\n", + common->Printf( "testVerts:%i c_testPlanes:%i c_testEdges:%i c_intersect:%i msec:%1.4f\n", tri->numVerts, c_testPlanes, c_testEdges, c_intersect, trace_timer.Milliseconds() ); #endif diff --git a/neo/renderer/tr_trisurf.cpp b/neo/renderer/tr_trisurf.cpp index 380d940c..770c693c 100644 --- a/neo/renderer/tr_trisurf.cpp +++ b/neo/renderer/tr_trisurf.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"). @@ -957,7 +957,7 @@ static void R_DefineEdge( int v1, int v2, int planeNum ) { common->DWarning( "MAX_SIL_EDGES" ); return; } - + silEdgeHash.Add( hashKey, numSilEdges ); silEdges[numSilEdges].p1 = planeNum; @@ -1213,27 +1213,27 @@ static void R_DeriveFaceTangents( const srfTriangles_t *tri, faceTangents_t *fac #ifdef USE_INVA float inva = area < 0.0f ? -1 : 1; // was = 1.0f / area; - temp[0] = (d0[0] * d1[4] - d0[4] * d1[0]) * inva; - temp[1] = (d0[1] * d1[4] - d0[4] * d1[1]) * inva; - temp[2] = (d0[2] * d1[4] - d0[4] * d1[2]) * inva; + temp[0] = (d0[0] * d1[4] - d0[4] * d1[0]) * inva; + temp[1] = (d0[1] * d1[4] - d0[4] * d1[1]) * inva; + temp[2] = (d0[2] * d1[4] - d0[4] * d1[2]) * inva; temp.Normalize(); ft->tangents[0] = temp; - - temp[0] = (d0[3] * d1[0] - d0[0] * d1[3]) * inva; - temp[1] = (d0[3] * d1[1] - d0[1] * d1[3]) * inva; - temp[2] = (d0[3] * d1[2] - d0[2] * d1[3]) * inva; + + temp[0] = (d0[3] * d1[0] - d0[0] * d1[3]) * inva; + temp[1] = (d0[3] * d1[1] - d0[1] * d1[3]) * inva; + temp[2] = (d0[3] * d1[2] - d0[2] * d1[3]) * inva; temp.Normalize(); ft->tangents[1] = temp; #else - temp[0] = (d0[0] * d1[4] - d0[4] * d1[0]); - temp[1] = (d0[1] * d1[4] - d0[4] * d1[1]); - temp[2] = (d0[2] * d1[4] - d0[4] * d1[2]); + temp[0] = (d0[0] * d1[4] - d0[4] * d1[0]); + temp[1] = (d0[1] * d1[4] - d0[4] * d1[1]); + temp[2] = (d0[2] * d1[4] - d0[4] * d1[2]); temp.Normalize(); ft->tangents[0] = temp; - - temp[0] = (d0[3] * d1[0] - d0[0] * d1[3]); - temp[1] = (d0[3] * d1[1] - d0[1] * d1[3]); - temp[2] = (d0[3] * d1[2] - d0[2] * d1[3]); + + temp[0] = (d0[3] * d1[0] - d0[0] * d1[3]); + temp[1] = (d0[3] * d1[1] - d0[1] * d1[3]); + temp[2] = (d0[3] * d1[2] - d0[2] * d1[3]); temp.Normalize(); ft->tangents[1] = temp; #endif @@ -1292,7 +1292,7 @@ static void R_DuplicateMirroredVertexes( srfTriangles_t *tri ) { vert = &tverts[i]; if ( vert->polarityUsed[0] && vert->polarityUsed[1] ) { vert->negativeRemap = totalVerts; - totalVerts++; + totalVerts++; } } @@ -1329,7 +1329,7 @@ static void R_DuplicateMirroredVertexes( srfTriangles_t *tri ) { tri->numVerts = totalVerts; // change the indexes for ( i = 0 ; i < tri->numIndexes ; i++ ) { - if ( tverts[tri->indexes[i]].negativeRemap && + if ( tverts[tri->indexes[i]].negativeRemap && R_FaceNegativePolarity( tri, 3*(i/3) ) ) { tri->indexes[i] = tverts[tri->indexes[i]].negativeRemap; } @@ -1492,7 +1492,7 @@ void R_BuildDominantTris( srfTriangles_t *tri ) { int i1 = tri->indexes[ind[i+j].faceNum * 3 + 0]; int i2 = tri->indexes[ind[i+j].faceNum * 3 + 1]; int i3 = tri->indexes[ind[i+j].faceNum * 3 + 2]; - + a = tri->verts + i1; b = tri->verts + i2; c = tri->verts + i3; @@ -1549,7 +1549,7 @@ void R_BuildDominantTris( srfTriangles_t *tri ) { len = 0.001f; } dt[vertNum].normalizationScale[0] = ( area > 0 ? 1 : -1 ) / len; // tangents[0] - + bitangent[0] = ( d0[3] * d1[0] - d0[0] * d1[3] ); bitangent[1] = ( d0[3] * d1[1] - d0[1] * d1[3] ); bitangent[2] = ( d0[3] * d1[2] - d0[2] * d1[3] ); @@ -1712,24 +1712,24 @@ void R_DeriveTangents( srfTriangles_t *tri, bool allocFacePlanes ) { float area = d0[3] * d1[4] - d0[4] * d1[3]; float inva = area < 0.0f ? -1 : 1; // was = 1.0f / area; - temp[0] = (d0[0] * d1[4] - d0[4] * d1[0]) * inva; - temp[1] = (d0[1] * d1[4] - d0[4] * d1[1]) * inva; - temp[2] = (d0[2] * d1[4] - d0[4] * d1[2]) * inva; + temp[0] = (d0[0] * d1[4] - d0[4] * d1[0]) * inva; + temp[1] = (d0[1] * d1[4] - d0[4] * d1[1]) * inva; + temp[2] = (d0[2] * d1[4] - d0[4] * d1[2]) * inva; VectorNormalizeFast2( temp, tangents[0] ); - - temp[0] = (d0[3] * d1[0] - d0[0] * d1[3]) * inva; - temp[1] = (d0[3] * d1[1] - d0[1] * d1[3]) * inva; - temp[2] = (d0[3] * d1[2] - d0[2] * d1[3]) * inva; + + temp[0] = (d0[3] * d1[0] - d0[0] * d1[3]) * inva; + temp[1] = (d0[3] * d1[1] - d0[1] * d1[3]) * inva; + temp[2] = (d0[3] * d1[2] - d0[2] * d1[3]) * inva; VectorNormalizeFast2( temp, tangents[1] ); #else - temp[0] = (d0[0] * d1[4] - d0[4] * d1[0]); - temp[1] = (d0[1] * d1[4] - d0[4] * d1[1]); - temp[2] = (d0[2] * d1[4] - d0[4] * d1[2]); + temp[0] = (d0[0] * d1[4] - d0[4] * d1[0]); + temp[1] = (d0[1] * d1[4] - d0[4] * d1[1]); + temp[2] = (d0[2] * d1[4] - d0[4] * d1[2]); VectorNormalizeFast2( temp, tangents[0] ); - - temp[0] = (d0[3] * d1[0] - d0[0] * d1[3]); - temp[1] = (d0[3] * d1[1] - d0[1] * d1[3]); - temp[2] = (d0[3] * d1[2] - d0[2] * d1[3]); + + temp[0] = (d0[3] * d1[0] - d0[0] * d1[3]); + temp[1] = (d0[3] * d1[1] - d0[1] * d1[3]); + temp[2] = (d0[3] * d1[2] - d0[2] * d1[3]); VectorNormalizeFast2( temp, tangents[1] ); #endif @@ -2271,4 +2271,3 @@ int R_DeformInfoMemoryUsed( deformInfo_t *deformInfo ) { total += sizeof( *deformInfo ); return total; } - diff --git a/neo/renderer/tr_turboshadow.cpp b/neo/renderer/tr_turboshadow.cpp index db3cec82..f7327342 100644 --- a/neo/renderer/tr_turboshadow.cpp +++ b/neo/renderer/tr_turboshadow.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 @@ R_CreateVertexProgramTurboShadowVolume are dangling edges that are outside the light frustum still making planes? ===================== */ -srfTriangles_t *R_CreateVertexProgramTurboShadowVolume( const idRenderEntityLocal *ent, +srfTriangles_t *R_CreateVertexProgramTurboShadowVolume( const idRenderEntityLocal *ent, const srfTriangles_t *tri, const idRenderLightLocal *light, srfCullInfo_t &cullInfo ) { int i, j; diff --git a/neo/renderer/wglext.h b/neo/renderer/wglext.h index 0a8cc91d..a93d1b90 100644 --- a/neo/renderer/wglext.h +++ b/neo/renderer/wglext.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) @@ -609,4 +609,3 @@ typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWO #endif #endif - diff --git a/neo/sound/snd_cache.cpp b/neo/sound/snd_cache.cpp index d08decd5..a3d2d343 100644 --- a/neo/sound/snd_cache.cpp +++ b/neo/sound/snd_cache.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 @@ const idSoundSample* idSoundCache::GetObject( const int index ) const { if (index<0 || index>listCache.Num()) { return NULL; } - return listCache[index]; + return listCache[index]; } /* @@ -321,7 +321,7 @@ int idSoundSample::LengthIn44kHzSamples( void ) const { } else if ( objectInfo.nSamplesPerSec == 22050 ) { return objectSize << 1; } else { - return objectSize << 0; + return objectSize << 0; } } @@ -330,7 +330,7 @@ int idSoundSample::LengthIn44kHzSamples( void ) const { idSoundSample::MakeDefault =================== */ -void idSoundSample::MakeDefault( void ) { +void idSoundSample::MakeDefault( void ) { int i; float v; int sample; @@ -361,7 +361,7 @@ void idSoundSample::MakeDefault( void ) { if ( alGetError() != AL_NO_ERROR ) { common->Error( "idSoundCache: error generating OpenAL hardware buffer" ); } - + alGetError(); alBufferData( openalBuffer, objectInfo.nChannels==1?AL_FORMAT_MONO16:AL_FORMAT_STEREO16, nonCacheData, objectMemSize, objectInfo.nSamplesPerSec ); if ( alGetError() != AL_NO_ERROR ) { @@ -431,7 +431,7 @@ idSoundSample::Load Loads based on name, possibly doing a MakeDefault if necessary =================== */ -void idSoundSample::Load( void ) { +void idSoundSample::Load( void ) { defaultSound = false; purged = false; hardwareBuffer = false; @@ -485,7 +485,7 @@ void idSoundSample::Load( void ) { // optionally convert it to 22kHz to save memory CheckForDownSample(); - // create hardware audio buffers + // create hardware audio buffers if ( idSoundSystemLocal::useOpenAL ) { // PCM loads directly if ( objectInfo.wFormatTag == WAVE_FORMAT_TAG_PCM ) { @@ -524,8 +524,8 @@ void idSoundSample::Load( void ) { hardwareBuffer = true; } } - } - + } + // OGG decompressed at load time (when smaller than s_decompressionLimit seconds, 6 seconds by default) if ( objectInfo.wFormatTag == WAVE_FORMAT_TAG_OGG ) { #if defined(MACOS_X) @@ -540,7 +540,7 @@ void idSoundSample::Load( void ) { if ( alIsBuffer( openalBuffer ) ) { idSampleDecoder *decoder = idSampleDecoder::Alloc(); float *destData = (float *)soundCacheAllocator.Alloc( ( LengthIn44kHzSamples() + 1 ) * sizeof( float ) ); - + // Decoder *always* outputs 44 kHz data decoder->Decode( this, 0, LengthIn44kHzSamples(), destData ); @@ -590,7 +590,7 @@ void idSoundSample::Load( void ) { for ( i = 0; i < objectSize; i+=blockSize ) { short min = 32767; short max = -32768; - + int j; for ( j = 0; j < Min( objectSize - i, blockSize ); j++ ) { min = ((short *)destData)[ i + j ] < min ? ((short *)destData)[ i + j ] : min; @@ -600,7 +600,7 @@ void idSoundSample::Load( void ) { ((short *)amplitudeData)[ ( i / blockSize ) * 2 ] = min; ((short *)amplitudeData)[ ( i / blockSize ) * 2 + 1 ] = max; } - + hardwareBuffer = true; } diff --git a/neo/sound/snd_decoder.cpp b/neo/sound/snd_decoder.cpp index 74e4ebb5..957b3519 100644 --- a/neo/sound/snd_decoder.cpp +++ b/neo/sound/snd_decoder.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/neo/sound/snd_efxfile.cpp b/neo/sound/snd_efxfile.cpp index f7bb2e24..3ce98d5f 100644 --- a/neo/sound/snd_efxfile.cpp +++ b/neo/sound/snd_efxfile.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 @@ idEFXFile::ReadEffect */ bool idEFXFile::ReadEffect( idLexer &src, idSoundEffect *effect ) { idToken name, token; - + if ( !src.ReadToken( &token ) ) return false; @@ -90,18 +90,18 @@ bool idEFXFile::ReadEffect( idLexer &src, idSoundEffect *effect ) { if ( reverb ) { src.ReadTokenOnLine( &token ); name = token; - + if ( !src.ReadToken( &token ) ) { Mem_Free( reverb ); return false; } - + if ( token != "{" ) { src.Error( "idEFXFile::ReadEffect: { not found, found %s", token.c_str() ); Mem_Free( reverb ); return false; } - + do { if ( !src.ReadToken( &token ) ) { src.Error( "idEFXFile::ReadEffect: EOF without closing brace" ); @@ -210,7 +210,7 @@ bool idEFXFile::LoadFile( const char *filename, bool OSPath ) { src.Error( "idEFXFile::LoadFile: Unknown file version" ); return false; } - + while ( !src.EndOfFile() ) { idSoundEffect *effect = new idSoundEffect; if ( ReadEffect( src, effect ) ) { diff --git a/neo/sound/snd_emitter.cpp b/neo/sound/snd_emitter.cpp index 9e218cfe..8592ad96 100644 --- a/neo/sound/snd_emitter.cpp +++ b/neo/sound/snd_emitter.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"). @@ -107,7 +107,7 @@ int Factorial( int val ) { return fact; } -void GeneratePermutedList( int *list, int listLength, int permute ) { +void GeneratePermutedList( int *list, int listLength, int permute ) { for ( int i = 0 ; i < listLength ; i++ ) { list[i] = i; } @@ -274,7 +274,7 @@ void idSoundChannel::GatherChannelSamples( int sampleOffset44k, int sampleCount4 sampleCount44k -= len; sampleOffset44k += len; } - + // grab part of the leadin sample idSoundSample *leadin = leadinSample; if ( !leadin || sampleOffset44k < 0 || sampleCount44k <= 0 ) { @@ -337,10 +337,10 @@ void idSoundChannel::GatherChannelSamples( int sampleOffset44k, int sampleCount4 /* =============== idSoundEmitterLocal::idSoundEmitterLocal - + =============== */ -idSoundEmitterLocal::idSoundEmitterLocal( void ) { +idSoundEmitterLocal::idSoundEmitterLocal( void ) { soundWorld = NULL; Clear(); } @@ -387,7 +387,7 @@ void idSoundEmitterLocal::Clear( void ) { idSoundEmitterLocal::OverrideParms ================== */ -void idSoundEmitterLocal::OverrideParms( const soundShaderParms_t *base, +void idSoundEmitterLocal::OverrideParms( const soundShaderParms_t *base, const soundShaderParms_t *over, soundShaderParms_t *out ) { if ( !over ) { *out = *base; @@ -471,7 +471,7 @@ void idSoundEmitterLocal::CheckForCompletion( int current44kHzTime ) { // free hardware resources chan->ALStop(); - + // if this was an onDemand sound, purge the sample now if ( chan->leadinSample->onDemand ) { chan->leadinSample->PurgeSoundSample(); @@ -687,7 +687,7 @@ int idSoundEmitterLocal::StartSound( const idSoundShader *shader, const s_channe // this is the sample time it will be first mixed int start44kHz; - + if ( soundWorld->fpa[0] ) { // if we are recording an AVI demo, don't use hardware time start44kHz = soundWorld->lastAVI44kHz + MIXBUFFER_SAMPLES; @@ -764,7 +764,7 @@ int idSoundEmitterLocal::StartSound( const idSoundShader *shader, const s_channe if ( idSoundSystemLocal::s_showStartSound.GetInteger() ) { common->Printf( "(override %s)", chan->soundShader->base->GetName() ); } - + chan->Stop(); // if this was an onDemand sound, purge the sample now @@ -860,7 +860,7 @@ int idSoundEmitterLocal::StartSound( const idSoundShader *shader, const s_channe chan->triggerGame44kHzTime -= diversity * length; chan->triggerGame44kHzTime &= ~7; } - + length *= 1000 / (float)PRIMARYFREQ; Sys_LeaveCriticalSection(); @@ -1007,7 +1007,7 @@ void idSoundEmitterLocal::FadeSound( const s_channelType channel, float to, floa } // if it is already fading to this volume at this rate, don't change it - if ( chan->channelFade.fadeEndVolume == to && + if ( chan->channelFade.fadeEndVolume == to && chan->channelFade.fadeEnd44kHz - chan->channelFade.fadeStart44kHz == length44kHz ) { continue; } diff --git a/neo/sound/snd_local.h b/neo/sound/snd_local.h index 2961960d..409e244a 100644 --- a/neo/sound/snd_local.h +++ b/neo/sound/snd_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"). @@ -40,7 +40,7 @@ If you have questions concerning this license or the applicable additional terms #include #include #define ID_ALCHAR -#else +#else #include #include #define ID_ALCHAR @@ -94,25 +94,25 @@ class idSoundWorldLocal; #pragma pack (push, 1) #endif struct waveformatex_s { - word wFormatTag; /* format type */ - word nChannels; /* number of channels (i.e. mono, stereo...) */ - dword nSamplesPerSec; /* sample rate */ - dword nAvgBytesPerSec; /* for buffer estimation */ - word nBlockAlign; /* block size of data */ - word wBitsPerSample; /* Number of bits per sample of mono data */ - word cbSize; /* The count in bytes of the size of - extra information (after cbSize) */ + word wFormatTag; /* format type */ + word nChannels; /* number of channels (i.e. mono, stereo...) */ + dword nSamplesPerSec; /* sample rate */ + dword nAvgBytesPerSec; /* for buffer estimation */ + word nBlockAlign; /* block size of data */ + word wBitsPerSample; /* Number of bits per sample of mono data */ + word cbSize; /* The count in bytes of the size of + extra information (after cbSize) */ } PACKED; typedef waveformatex_s waveformatex_t; /* OLD general waveform format structure (information common to all formats) */ struct waveformat_s { - word wFormatTag; /* format type */ - word nChannels; /* number of channels (i.e. mono, stereo, etc.) */ - dword nSamplesPerSec; /* sample rate */ - dword nAvgBytesPerSec; /* for buffer estimation */ - word nBlockAlign; /* block size of data */ + word wFormatTag; /* format type */ + word nChannels; /* number of channels (i.e. mono, stereo, etc.) */ + dword nSamplesPerSec; /* sample rate */ + dword nAvgBytesPerSec; /* for buffer estimation */ + word nBlockAlign; /* block size of data */ } PACKED; typedef waveformat_s waveformat_t; @@ -125,8 +125,8 @@ enum { /* specific waveform format structure for PCM data */ struct pcmwaveformat_s { - waveformat_t wf; - word wBitsPerSample; + waveformat_t wf; + word wBitsPerSample; } PACKED; typedef pcmwaveformat_s pcmwaveformat_t; @@ -140,15 +140,15 @@ typedef pcmwaveformat_s pcmwaveformat_t; #define fourcc_riff mmioFOURCC('R', 'I', 'F', 'F') struct waveformatextensible_s { - waveformatex_t Format; - union { - word wValidBitsPerSample; /* bits of precision */ - word wSamplesPerBlock; /* valid if wBitsPerSample==0*/ - word wReserved; /* If neither applies, set to zero*/ - } Samples; - dword dwChannelMask; /* which channels are */ - /* present in stream */ - int SubFormat; + waveformatex_t Format; + union { + word wValidBitsPerSample; /* bits of precision */ + word wSamplesPerBlock; /* valid if wBitsPerSample==0*/ + word wReserved; /* If neither applies, set to zero*/ + } Samples; + dword dwChannelMask; /* which channels are */ + /* present in stream */ + int SubFormat; } PACKED; typedef waveformatextensible_s waveformatextensible_t; @@ -182,42 +182,42 @@ idWaveFile class idWaveFile { public: - idWaveFile( void ); + idWaveFile( void ); ~idWaveFile( void ); - int Open( const char* strFileName, waveformatex_t* pwfx = NULL ); - int OpenFromMemory( short* pbData, int ulDataSize, waveformatextensible_t* pwfx ); - int Read( byte* pBuffer, int dwSizeToRead, int *pdwSizeRead ); + int Open( const char* strFileName, waveformatex_t* pwfx = NULL ); + int OpenFromMemory( short* pbData, int ulDataSize, waveformatextensible_t* pwfx ); + int Read( byte* pBuffer, int dwSizeToRead, int *pdwSizeRead ); int Seek( int offset ); - int Close( void ); - int ResetFile( void ); + int Close( void ); + int ResetFile( void ); int GetOutputSize( void ) { return mdwSize; } int GetMemorySize( void ) { return mMemSize; } - waveformatextensible_t mpwfx; // Pointer to waveformatex structure + waveformatextensible_t mpwfx; // Pointer to waveformatex structure private: idFile * mhmmio; // I/O handle for the WAVE - mminfo_t mck; // Multimedia RIFF chunk - mminfo_t mckRiff; // used when opening a WAVE file - dword mdwSize; // size in samples + mminfo_t mck; // Multimedia RIFF chunk + mminfo_t mckRiff; // used when opening a WAVE file + dword mdwSize; // size in samples dword mMemSize; // size of the wave data in memory dword mseekBase; ID_TIME_T mfileTime; - bool mbIsReadingFromMemory; - short * mpbData; - short * mpbDataCur; - dword mulDataSize; + bool mbIsReadingFromMemory; + short * mpbData; + short * mpbDataCur; + dword mulDataSize; void * ogg; // only !NULL when !s_realTimeDecoding bool isOgg; private: - int ReadMMIO( void ); + int ReadMMIO( void ); - int OpenOGG( const char* strFileName, waveformatex_t* pwfx = NULL ); + int OpenOGG( const char* strFileName, waveformatex_t* pwfx = NULL ); int ReadOGG( byte* pBuffer, int dwSizeToRead, int *pdwSizeRead ); int CloseOGG( void ); }; @@ -235,14 +235,14 @@ class idAudioHardware { public: static idAudioHardware *Alloc(); - virtual ~idAudioHardware(); + virtual ~idAudioHardware(); - virtual bool Initialize( ) = 0; + virtual bool Initialize( ) = 0; virtual bool Lock( void **pDSLockedBuffer, ulong *dwDSLockedBufferSize ) = 0; virtual bool Unlock( void *pDSLockedBuffer, dword dwDSLockedBufferSize ) = 0; virtual bool GetCurrentPosition( ulong *pdwCurrentWriteCursor ) = 0; - + // try to write as many sound samples to the device as possible without blocking and prepare for a possible new mixing call // returns wether there is *some* space for writing available virtual bool Flush( void ) = 0; @@ -265,11 +265,11 @@ Encapsulates functionality of a DirectSound buffer. class idAudioBuffer { public: - virtual int Play( dword dwPriority=0, dword dwFlags=0 ) = 0; - virtual int Stop( void ) = 0; - virtual int Reset( void ) = 0; - virtual bool IsSoundPlaying( void ) = 0; - virtual void SetVolume( float x ) = 0; + virtual int Play( dword dwPriority=0, dword dwFlags=0 ) = 0; + virtual int Stop( void ) = 0; + virtual int Reset( void ) = 0; + virtual bool IsSoundPlaying( void ) = 0; + virtual void SetVolume( float x ) = 0; }; @@ -479,7 +479,7 @@ public: removeStatus_t removeStatus; idVec3 origin; - int listenerId; + int listenerId; soundShaderParms_t parms; // default overrides for all channels @@ -591,12 +591,12 @@ public: // SaveGame Support virtual void WriteToSaveGame( idFile *savefile ); virtual void ReadFromSaveGame( idFile *savefile ); - + virtual void ReadFromSaveGameSoundChannel( idFile *saveGame, idSoundChannel *ch ); virtual void ReadFromSaveGameSoundShaderParams( idFile *saveGame, soundShaderParms_t *params ); virtual void WriteToSaveGameSoundChannel( idFile *saveGame, idSoundChannel *ch ); virtual void WriteToSaveGameSoundShaderParams( idFile *saveGame, soundShaderParms_t *params ); - + virtual void SetSlowmo( bool active ); virtual void SetSlowmoSpeed( float speed ); virtual void SetEnviroSuit( bool active ); @@ -743,7 +743,7 @@ public: unsigned int nextWriteBlock; - float realAccum[6*MIXBUFFER_SAMPLES+16]; + float realAccum[6*MIXBUFFER_SAMPLES+16]; float * finalMixBuffer; // points inside realAccum at a 16 byte aligned boundary bool isInitialized; @@ -841,7 +841,7 @@ public: ~idSoundSample(); idStr name; // name of the sample file - ID_TIME_T timestamp; // the most recent of all images used in creation, for reloadImages command + ID_TIME_T timestamp; // the most recent of all images used in creation, for reloadImages command waveformatex_t objectInfo; // what are we caching int objectSize; // size of waveform in samples, excludes the header @@ -856,7 +856,7 @@ public: bool levelLoadReferenced; // so we can tell which samples aren't needed any more int LengthIn44kHzSamples() const; - ID_TIME_T GetNewTimeStamp( void ) const; + ID_TIME_T GetNewTimeStamp( void ) const; void MakeDefault(); // turns it into a beep void Load(); // loads the current sound based on name void Reload( bool force ); // reloads if timestamp has changed, or always if force diff --git a/neo/sound/snd_shader.cpp b/neo/sound/snd_shader.cpp index 61eb6bdf..93106eb7 100644 --- a/neo/sound/snd_shader.cpp +++ b/neo/sound/snd_shader.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"). @@ -97,7 +97,7 @@ bool idSoundShader::SetDefaultText( void ) { // if there exists a wav file with the same name if ( 1 ) { //fileSystem->ReadFile( wavname, NULL ) != -1 ) { char generated[2048]; - idStr::snPrintf( generated, sizeof( generated ), + idStr::snPrintf( generated, sizeof( generated ), "sound %s // IMPLICITLY GENERATED\n" "{\n" "%s\n" @@ -281,7 +281,7 @@ bool idSoundShader::ParseShader( idLexer &src ) { parms.soundShaderFlags |= SSF_NO_FLICKER; } // plain - else if ( !token.Icmp( "plain" ) ) { + else if ( !token.Icmp( "plain" ) ) { // no longer supported } // looping @@ -352,7 +352,7 @@ bool idSoundShader::ParseShader( idLexer &src ) { token = work; } } - } + } entries[ numEntries ] = soundSystemLocal.soundCache->FindSound( token.c_str(), onDemand ); numEntries++; } diff --git a/neo/sound/snd_system.cpp b/neo/sound/snd_system.cpp index c211e42d..849ba5ca 100644 --- a/neo/sound/snd_system.cpp +++ b/neo/sound/snd_system.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"). @@ -372,17 +372,17 @@ void idSoundSystemLocal::Init() { common->Printf( "OpenAL: disabling ( no EAX ). Using legacy mixer.\n" ); alcMakeContextCurrent( NULL ); - + alcDestroyContext( openalContext ); openalContext = NULL; - + alcCloseDevice( openalDevice ); openalDevice = NULL; } else { - ALuint handle; + ALuint handle; openalSourceCount = 0; - + while ( openalSourceCount < 256 ) { alGetError(); alGenSources( 1, &handle ); @@ -441,7 +441,7 @@ void idSoundSystemLocal::Shutdown() { // destroy openal sources if ( useOpenAL ) { - + efxloaded = false; // adjust source count back up to allow for freeing of all resources @@ -451,7 +451,7 @@ void idSoundSystemLocal::Shutdown() { // stop source alSourceStop( openalSources[i].handle ); alSourcei( openalSources[i].handle, AL_BUFFER, 0 ); - + // delete source alDeleteSources( 1, &openalSources[i].handle ); @@ -472,10 +472,10 @@ void idSoundSystemLocal::Shutdown() { // destroy openal device and context if ( useOpenAL ) { alcMakeContextCurrent( NULL ); - + alcDestroyContext( openalContext ); openalContext = NULL; - + alcCloseDevice( openalDevice ); openalDevice = NULL; } @@ -561,7 +561,7 @@ int idSoundSystemLocal::GetCurrent44kHzTime( void ) const { return CurrentSoundTime; } else { // NOTE: this would overflow 31bits within about 1h20 ( not that important since we get a snd_audio_hw right away pbly ) - //return ( ( Sys_Milliseconds()*441 ) / 10 ) * 4; + //return ( ( Sys_Milliseconds()*441 ) / 10 ) * 4; return idMath::FtoiFast( (float)Sys_Milliseconds() * 176.4f ); } } @@ -606,14 +606,14 @@ int idSoundSystemLocal::AsyncMix( int soundTime, float *mixBuffer ) { inTime = Sys_Milliseconds(); numSpeakers = snd_audio_hw->GetNumberOfSpeakers(); - + // let the active sound world mix all the channels in unless muted or avi demo recording if ( !muted && currentSoundWorld && !currentSoundWorld->fpa[0] ) { currentSoundWorld->MixLoop( soundTime, numSpeakers, mixBuffer ); } CurrentSoundTime = soundTime; - + return Sys_Milliseconds() - inTime; } @@ -687,7 +687,7 @@ int idSoundSystemLocal::AsyncUpdate( int inTime ) { // newSoundTime is in multi-channel samples since the sound system was started int newSoundTime = ( buffers * MIXBUFFER_SAMPLES * ROOM_SLICES_IN_BUFFER ) + nextWriteSamples; - + // check for impending overflow // FIXME: we don't handle sound wrap-around correctly yet if ( newSoundTime > 0x6fffffff ) { @@ -769,7 +769,7 @@ int idSoundSystemLocal::AsyncUpdateWrite( int inTime ) { Sys_Printf( "missed %d sound updates\n", dwCurrentBlock - nextWriteBlock ); } - int sampleTime = dwCurrentBlock * MIXBUFFER_SAMPLES; + int sampleTime = dwCurrentBlock * MIXBUFFER_SAMPLES; int numSpeakers = snd_audio_hw->GetNumberOfSpeakers(); if ( useOpenAL ) { @@ -823,7 +823,7 @@ float idSoundSystemLocal::dB2Scale( const float val ) const { } else if ( val <= -60.0f ) { return 0.0f; } else if ( val >= 60.0f ) { - return powf( 2.0f, val * ( 1.0f / 6.0f ) ); + return powf( 2.0f, val * ( 1.0f / 6.0f ) ); } int ival = (int)( ( val + 60.0f ) * 10.0f ); return volumesDB[ival]; @@ -1115,7 +1115,7 @@ void idSoundSystemLocal::BeginLevelLoad() { return; } soundCache->BeginLevelLoad(); - + if ( efxloaded ) { EFXDatabase.UnloadFile(); efxloaded = false; diff --git a/neo/sound/snd_wavefile.cpp b/neo/sound/snd_wavefile.cpp index ac19dc9b..c644d6ac 100644 --- a/neo/sound/snd_wavefile.cpp +++ b/neo/sound/snd_wavefile.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,9 +33,9 @@ If you have questions concerning this license or the applicable additional terms //----------------------------------------------------------------------------- // Name: idWaveFile::idWaveFile() -// Desc: Constructs the class. Call Open() to open a wave file for reading. -// Then call Read() as needed. Calling the destructor or Close() -// will close the file. +// Desc: Constructs the class. Call Open() to open a wave file for reading. +// Then call Read() as needed. Calling the destructor or Close() +// will close the file. //----------------------------------------------------------------------------- idWaveFile::idWaveFile( void ) { memset( &mpwfx, 0, sizeof( waveformatextensible_t ) ); @@ -142,11 +142,11 @@ int idWaveFile::OpenFromMemory( short* pbData, int ulDataSize, waveformatextensi // Name: idWaveFile::ReadMMIO() // Desc: Support function for reading from a multimedia I/O stream. // mhmmio must be valid before calling. This function uses it to -// update mckRiff, and mpwfx. +// update mckRiff, and mpwfx. //----------------------------------------------------------------------------- int idWaveFile::ReadMMIO( void ) { mminfo_t ckIn; // chunk info. for general use. - pcmwaveformat_t pcmWaveFormat; // Temp PCM structure to load in. + pcmwaveformat_t pcmWaveFormat; // Temp PCM structure to load in. memset( &mpwfx, 0, sizeof( waveformatextensible_t ) ); @@ -222,8 +222,8 @@ int idWaveFile::ReadMMIO( void ) { //----------------------------------------------------------------------------- // Name: idWaveFile::ResetFile() -// Desc: Resets the internal mck pointer so reading starts from the -// beginning of the file again +// Desc: Resets the internal mck pointer so reading starts from the +// beginning of the file again //----------------------------------------------------------------------------- int idWaveFile::ResetFile( void ) { if( mbIsReadingFromMemory ) { @@ -247,22 +247,22 @@ int idWaveFile::ResetFile( void ) { } mck.ckid = (mck.ckid>>8) | (ioin<<24); } while (mck.ckid != mmioFOURCC('d', 'a', 't', 'a')); - + mhmmio->Read( &mck.cksize, 4 ); assert( !isOgg ); mck.cksize = LittleLong( mck.cksize ); mseekBase = mhmmio->Tell(); } - + return 0; } //----------------------------------------------------------------------------- // Name: idWaveFile::Read() -// Desc: Reads section of data from a wave file into pBuffer and returns +// Desc: Reads section of data from a wave file into pBuffer and returns // how much read in pdwSizeRead, reading not more than dwSizeToRead. -// This uses mck to determine where to start reading from. So -// subsequent calls will be continue where the last left off unless +// This uses mck to determine where to start reading from. So +// subsequent calls will be continue where the last left off unless // Reset() is called. //----------------------------------------------------------------------------- int idWaveFile::Read( byte* pBuffer, int dwSizeToRead, int *pdwSizeRead ) { @@ -279,7 +279,7 @@ int idWaveFile::Read( byte* pBuffer, int dwSizeToRead, int *pdwSizeRead ) { if( (byte*)(mpbDataCur + dwSizeToRead) > (byte*)(mpbData + mulDataSize) ) { dwSizeToRead = mulDataSize - (int)(mpbDataCur - mpbData); } - SIMDProcessor->Memcpy( pBuffer, mpbDataCur, dwSizeToRead ); + SIMDProcessor->Memcpy( pBuffer, mpbDataCur, dwSizeToRead ); mpbDataCur += dwSizeToRead; if ( pdwSizeRead != NULL ) { @@ -296,7 +296,7 @@ int idWaveFile::Read( byte* pBuffer, int dwSizeToRead, int *pdwSizeRead ) { if( pBuffer == NULL ) { return -1; } - + dwSizeToRead = mhmmio->Read( pBuffer, dwSizeToRead ); // this is hit by ogg code, which does it's own byte swapping internally if ( !isOgg ) { @@ -313,7 +313,7 @@ int idWaveFile::Read( byte* pBuffer, int dwSizeToRead, int *pdwSizeRead ) { //----------------------------------------------------------------------------- // Name: idWaveFile::Close() -// Desc: Closes the wave file +// Desc: Closes the wave file //----------------------------------------------------------------------------- int idWaveFile::Close( void ) { if ( ogg != NULL ) { diff --git a/neo/sound/snd_world.cpp b/neo/sound/snd_world.cpp index b334bf18..62efb324 100644 --- a/neo/sound/snd_world.cpp +++ b/neo/sound/snd_world.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"). @@ -276,7 +276,7 @@ void idSoundWorldLocal::ProcessDemoCommand( idDemoFile *readDemo ) { readDemo->ReadMat3( axis ); readDemo->ReadInt( listenerId ); readDemo->ReadInt( gameTime ); - + PlaceListener( origin, axis, listenerId, gameTime, "" ); }; break; @@ -426,7 +426,7 @@ void idSoundWorldLocal::MixLoop( int current44kHz, int numSpeakers, float *final if ( idSoundSystemLocal::useOpenAL ) alListenerf( AL_GAIN, 0.0f ); return; - } + } // update the listener position and orientation if ( idSoundSystemLocal::useOpenAL ) { @@ -457,17 +457,17 @@ void idSoundWorldLocal::MixLoop( int current44kHz, int numSpeakers, float *final int EnvironmentID = -1; idStr defaultStr( "default" ); idStr listenerAreaStr( listenerArea ); - + soundSystemLocal.EFXDatabase.FindEffect( listenerAreaStr, &effect, &EnvironmentID ); if (!effect) soundSystemLocal.EFXDatabase.FindEffect( listenerAreaName, &effect, &EnvironmentID ); if (!effect) soundSystemLocal.EFXDatabase.FindEffect( defaultStr, &effect, &EnvironmentID ); - - // only update if change in settings + + // only update if change in settings if ( soundSystemLocal.s_muteEAXReverb.GetBool() || ( listenerEnvironmentID != EnvironmentID ) ) { EAXREVERBPROPERTIES EnvironmentParameters; - + // get area reverb setting from EAX Manager if ( ( effect ) && ( effect->data) && ( memcpy( &EnvironmentParameters, effect->data, effect->datasize ) ) ) { if ( soundSystemLocal.s_muteEAXReverb.GetBool() ) { @@ -576,7 +576,7 @@ This can be used to write wave files even if no sound hardware exists */ void idSoundWorldLocal::AVIUpdate() { int numSpeakers; - + if ( game44kHz - lastAVI44kHz < MIXBUFFER_SAMPLES ) { return; } @@ -665,12 +665,12 @@ void idSoundWorldLocal::AVIClose( void ) { int numSamples = rL->Length()/2; mminfo_t info; pcmwaveformat_t format; - + info.ckid = fourcc_riff; info.fccType = mmioFOURCC( 'W', 'A', 'V', 'E' ); info.cksize = (rL->Length()*2) - 8 + 4 + 16 + 8 + 8; info.dwDataOffset = 12; - + wO->Write( &info, 12 ); info.ckid = mmioFOURCC( 'f', 'm', 't', ' ' ); @@ -888,7 +888,7 @@ idSoundWorldLocal::PlaceListener this is called by the main thread =================== */ -void idSoundWorldLocal::PlaceListener( const idVec3& origin, const idMat3& axis, +void idSoundWorldLocal::PlaceListener( const idVec3& origin, const idMat3& axis, const int listenerId, const int gameTime, const idStr& areaName ) { int current44kHzTime; @@ -1130,7 +1130,7 @@ void idSoundWorldLocal::WriteToSaveGame( idFile *savefile ) { WriteToSaveGameSoundShaderParams( savefile, &def->parms ); savefile->WriteFloat( def->amplitude ); savefile->WriteInt( def->ampTime ); - for (int k = 0; k < SOUND_MAX_CHANNELS; k++) + for (int k = 0; k < SOUND_MAX_CHANNELS; k++) WriteToSaveGameSoundChannel( savefile, &def->channels[k] ); savefile->WriteFloat( def->distance ); savefile->WriteBool( def->hasShakes ); @@ -1153,7 +1153,7 @@ void idSoundWorldLocal::WriteToSaveGame( idFile *savefile ) { // write the pointers out separately name = chan->soundShader->GetName(); savefile->WriteString( name ); - + name = chan->leadinSample->name; savefile->WriteString( name ); } @@ -1274,7 +1274,7 @@ void idSoundWorldLocal::ReadFromSaveGame( idFile *savefile ) { ReadFromSaveGameSoundShaderParams( savefile, &def->parms ); savefile->ReadFloat( def->amplitude ); savefile->ReadInt( def->ampTime ); - for (int k = 0; k < SOUND_MAX_CHANNELS; k++) + for (int k = 0; k < SOUND_MAX_CHANNELS; k++) ReadFromSaveGameSoundChannel( savefile, &def->channels[k] ); savefile->ReadFloat( def->distance ); savefile->ReadBool( def->hasShakes ); @@ -1549,9 +1549,9 @@ void idSoundWorldLocal::CalcEars( int numSpeakers, idVec3 spatializedOrigin, idV ears[1] = idSoundSystemLocal::s_minVolume2.GetFloat(); } - ears[2] = - ears[3] = - ears[4] = + ears[2] = + ears[3] = + ears[4] = ears[5] = 0.0f; } } @@ -1601,7 +1601,7 @@ void idSoundWorldLocal::AddChannelContribution( idSoundEmitterLocal *sound, idSo float maxd = parms->maxDistance; float mind = parms->minDistance; - + int mask = shader->speakerMask; bool omni = ( parms->soundShaderFlags & SSF_OMNIDIRECTIONAL) != 0; bool looping = ( parms->soundShaderFlags & SSF_LOOPING ) != 0; @@ -1626,7 +1626,7 @@ void idSoundWorldLocal::AddChannelContribution( idSoundEmitterLocal *sound, idSo // // see if it's in range // - + // convert volumes from decibels to float scale // leadin volume scale for shattering lights @@ -1649,7 +1649,7 @@ void idSoundWorldLocal::AddChannelContribution( idSoundEmitterLocal *sound, idSo fadeDb = soundClassFade[parms->soundClass].FadeDbAt44kHz( current44kHz ); volume *= soundSystemLocal.dB2Scale( fadeDb ); - + // // if it's a global sound then @@ -1717,14 +1717,14 @@ void idSoundWorldLocal::AddChannelContribution( idSoundEmitterLocal *sound, idSo // // allocate and initialize hardware source - // + // if ( idSoundSystemLocal::useOpenAL && sound->removeStatus < REMOVE_STATUS_SAMPLEFINISHED ) { if ( !alIsSource( chan->openalSource ) ) { chan->openalSource = soundSystemLocal.AllocOpenALSource( chan, !chan->leadinSample->hardwareBuffer || !chan->soundShader->entries[0]->hardwareBuffer || looping, chan->leadinSample->objectInfo.nChannels == 2 ); } if ( alIsSource( chan->openalSource ) ) { - + // stop source if needed.. if ( chan->triggered ) { alSourceStop( chan->openalSource ); @@ -1741,7 +1741,7 @@ void idSoundWorldLocal::AddChannelContribution( idSoundEmitterLocal *sound, idSo alSourcef( chan->openalSource, AL_GAIN, ( volume ) < ( 1.0f ) ? ( volume ) : ( 1.0f ) ); } alSourcei( chan->openalSource, AL_LOOPING, ( looping && chan->soundShader->entries[0]->hardwareBuffer ) ? AL_TRUE : AL_FALSE ); -#if !defined(MACOS_X) +#if !defined(MACOS_X) alSourcef( chan->openalSource, AL_REFERENCE_DISTANCE, mind ); alSourcef( chan->openalSource, AL_MAX_DISTANCE, maxd ); #endif @@ -1802,7 +1802,7 @@ void idSoundWorldLocal::AddChannelContribution( idSoundEmitterLocal *sound, idSo alSourceQueueBuffers( chan->openalSource, finishedbuffers, &buffers[0] ); } } - + // (re)start if needed.. if ( chan->triggered ) { alSourcePlay( chan->openalSource ); @@ -1923,7 +1923,7 @@ idSoundWorldLocal::FindAmplitude which would be problematic in multiplayer =============== */ -float idSoundWorldLocal::FindAmplitude( idSoundEmitterLocal *sound, const int localTime, const idVec3 *listenerPosition, +float idSoundWorldLocal::FindAmplitude( idSoundEmitterLocal *sound, const int localTime, const idVec3 *listenerPosition, const s_channelType channel, bool shakesOnly ) { int i, j; soundShaderParms_t *parms; @@ -1986,7 +1986,7 @@ float idSoundWorldLocal::FindAmplitude( idSoundEmitterLocal *sound, const int lo volume *= shakes; } - if ( listenerPosition && !( parms->soundShaderFlags & SSF_GLOBAL ) ) { + if ( listenerPosition && !( parms->soundShaderFlags & SSF_GLOBAL ) ) { // check for overrides float maxd = parms->maxDistance; float mind = parms->minDistance; @@ -2021,7 +2021,7 @@ float idSoundWorldLocal::FindAmplitude( idSoundEmitterLocal *sound, const int lo int offset = (localTime - localTriggerTimes); // offset in samples int size = ( looping ? chan->soundShader->entries[0]->LengthIn44kHzSamples() : chan->leadinSample->LengthIn44kHzSamples() ); short *amplitudeData = (short *)( looping ? chan->soundShader->entries[0]->amplitudeData : chan->leadinSample->amplitudeData ); - + if ( amplitudeData ) { // when the amplitudeData is present use that fill a dummy sourceBuffer // this is to allow for amplitude based effect on hardware audio solutions @@ -2092,7 +2092,7 @@ void idSoundWorldLocal::FadeSoundClasses( const int soundClass, const float to, int length44kHz = soundSystemLocal.MillisecondsToSamples( over * 1000 ); // if it is already fading to this volume at this rate, don't change it - if ( fade->fadeEndVolume == to && + if ( fade->fadeEndVolume == to && fade->fadeEnd44kHz - fade->fadeStart44kHz == length44kHz ) { return; } diff --git a/neo/sound/sound.h b/neo/sound/sound.h index 8475eca9..226d455e 100644 --- a/neo/sound/sound.h +++ b/neo/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/neo/sys/gllog/gl_def.m4 b/neo/sys/gllog/gl_def.m4 index 9de8e755..74f9f870 100644 --- a/neo/sys/gllog/gl_def.m4 +++ b/neo/sys/gllog/gl_def.m4 @@ -1096,4 +1096,3 @@ define(`f362_params', ``Display *dpy, GLXDrawable drawable'') define(`f363_ret', `GLExtension_t') define(`f363_name', `GetProcAddressARB') define(`f363_params', ``const GLubyte *procname'') - diff --git a/neo/sys/gllog/gl_extensions.cpp.m4 b/neo/sys/gllog/gl_extensions.cpp.m4 index aaae369c..7acc129f 100644 --- a/neo/sys/gllog/gl_extensions.cpp.m4 +++ b/neo/sys/gllog/gl_extensions.cpp.m4 @@ -5,12 +5,12 @@ dnl ===================================================== dnl utils dnl ===================================================== -define(`forloop', +define(`forloop', `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') define(`_forloop', `$4`'ifelse($1, `$3', , `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') - + dnl ===================================================== dnl GL extensions dnl ===================================================== @@ -46,7 +46,7 @@ GLExtension_t GLimp_ExtensionPointer( const char *name ) { } #endif GLExtension_t ret; - #if defined(__linux__) + #if defined(__linux__) // for some reason glXGetProcAddressARB doesn't work on RH9? ret = qglXGetProcAddressARB((const GLubyte *) name); if ( !ret ) { @@ -54,7 +54,7 @@ GLExtension_t GLimp_ExtensionPointer( const char *name ) { return StubFunction; } #else - #error Need OS define + #error Need OS define #endif return ret; #endif diff --git a/neo/sys/gllog/logfunc.py b/neo/sys/gllog/logfunc.py index 3a9e46f0..320f8b75 100644 --- a/neo/sys/gllog/logfunc.py +++ b/neo/sys/gllog/logfunc.py @@ -26,7 +26,7 @@ def do_logfunc(f_in, f_out): for i in base_params: regex = re.compile('([a-zA-Z0-9]*)$') name = regex.search(i).group(1) - type = string.strip(i[0:len(i)-len(name)]) + type = string.strip(i[0:len(i)-len(name)]) # catch type with no name if (len(type) == 0): type = name @@ -70,6 +70,6 @@ def do_logfunc(f_in, f_out): f_out.write(i) f_out.write(');\n') f_out.write('}\n\n') - + if __name__ == '__main__': do_logfunc(sys.stdin, sys.stdout) diff --git a/neo/sys/gllog/read.py b/neo/sys/gllog/read.py index 502322d4..fec3a1e3 100644 --- a/neo/sys/gllog/read.py +++ b/neo/sys/gllog/read.py @@ -22,5 +22,5 @@ def read_gl(f_in): else: sys.stderr.write('ERROR: unknown type %s\n' % tokens[1]) raise "abort" - + return (gl, wgl, glX) diff --git a/neo/sys/gllog/wgl.api b/neo/sys/gllog/wgl.api index 736600e9..7ba7ceca 100644 --- a/neo/sys/gllog/wgl.api +++ b/neo/sys/gllog/wgl.api @@ -1,4 +1,4 @@ -int ;qwgl;SwapIntervalEXT; int interval +int ;qwgl;SwapIntervalEXT; int interval int ;qwgl;ChoosePixelFormat ;HDC, CONST PIXELFORMATDESCRIPTOR * int ;qwgl;DescribePixelFormat;HDC, int, UINT, LPPIXELFORMATDESCRIPTOR int ;qwgl;GetPixelFormat;HDC diff --git a/neo/sys/linux/dedicated.cpp b/neo/sys/linux/dedicated.cpp index 3224efe2..6338495b 100644 --- a/neo/sys/linux/dedicated.cpp +++ b/neo/sys/linux/dedicated.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"). @@ -76,8 +76,8 @@ void GLimp_EnableLogging( bool enable ) { } bool GLimp_Init( glimpParms_t a ) { return true; } -void GLimp_SetGamma( unsigned short red[256], - unsigned short green[256], +void GLimp_SetGamma( unsigned short red[256], + unsigned short green[256], unsigned short blue[256] ) { } void GLimp_Shutdown( void ) { } @@ -89,4 +89,3 @@ void GLimp_DeactivateContext( void ) { } void GLimp_ActivateContext( void ) { } bool GLimp_SetScreenParms( glimpParms_t parms ) { return true; } - diff --git a/neo/sys/linux/glimp.cpp b/neo/sys/linux/glimp.cpp index 201dbe02..333c9266 100644 --- a/neo/sys/linux/glimp.cpp +++ b/neo/sys/linux/glimp.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"). @@ -113,7 +113,7 @@ void GLimp_SaveGamma() { } assert( dpy ); - + XF86VidModeGetGammaRampSize( dpy, scrnum, &save_rampsize); save_red = (unsigned short *)malloc(save_rampsize*sizeof(unsigned short)); save_green = (unsigned short *)malloc(save_rampsize*sizeof(unsigned short)); @@ -131,9 +131,9 @@ save and restore the original gamma of the system void GLimp_RestoreGamma() { if (!save_rampsize) return; - + XF86VidModeSetGammaRamp( dpy, scrnum, save_rampsize, save_red, save_green, save_blue); - + free(save_red); free(save_green); free(save_blue); save_rampsize = 0; } @@ -147,9 +147,9 @@ the size of the gamma ramp can not be changed on X (I need to confirm this) ================= */ void GLimp_SetGamma(unsigned short red[256], unsigned short green[256], unsigned short blue[256]) { - if ( dpy ) { + if ( dpy ) { int size; - + GLimp_SaveGamma(); XF86VidModeGetGammaRampSize( dpy, scrnum, &size); common->DPrintf("XF86VidModeGetGammaRampSize: %d\n", size); @@ -168,7 +168,7 @@ void GLimp_SetGamma(unsigned short red[256], unsigned short green[256], unsigned r_f -= (float)r_i; l_red[i] = (int)round((1.0f-r_f)*(float)red[r_i]+r_f*(float)red[r_i+1]); l_green[i] = (int)round((1.0f-r_f)*(float)green[r_i]+r_f*(float)green[r_i+1]); - l_blue[i] = (int)round((1.0f-r_f)*(float)blue[r_i]+r_f*(float)blue[r_i+1]); + l_blue[i] = (int)round((1.0f-r_f)*(float)blue[r_i]+r_f*(float)blue[r_i+1]); } l_red[size-1] = red[255]; l_green[size-1] = green[255]; l_blue[size-1] = blue[255]; XF86VidModeSetGammaRamp( dpy, scrnum, size, l_red, l_green, l_blue ); @@ -181,17 +181,17 @@ void GLimp_SetGamma(unsigned short red[256], unsigned short green[256], unsigned void GLimp_Shutdown() { if ( dpy ) { - + Sys_XUninstallGrabs(); - + GLimp_RestoreGamma(); qglXDestroyContext( dpy, ctx ); - + #if !defined( ID_GL_HARDLINK ) GLimp_dlclose(); #endif - + XDestroyWindow( dpy, win ); if ( vidmode_active ) { XF86VidModeSwitchToMode( dpy, scrnum, vidmodes[0] ); @@ -235,7 +235,7 @@ void GLX_TestDGA() { dga_found = true; } #else - dga_found = false; + dga_found = false; #endif } @@ -274,7 +274,7 @@ bool GLimp_OpenDisplay( void ) { common->Printf("XInitThreads failed\n"); return false; } - + // set up our custom error handler for X failures XSetErrorHandler( &idXErrorHandler ); @@ -455,7 +455,7 @@ int GLX_Init(glimpParms_t a) { attrib[ATTR_GREEN_IDX] = 4; attrib[ATTR_BLUE_IDX] = 4; } - + attrib[ATTR_DEPTH_IDX] = tdepthbits; // default to 24 depth attrib[ATTR_STENCIL_IDX] = tstencilbits; @@ -528,18 +528,18 @@ int GLX_Init(glimpParms_t a) { glstring = (const char *) qglGetString(GL_RENDERER); common->Printf("GL_RENDERER: %s\n", glstring); - + glstring = (const char *) qglGetString(GL_EXTENSIONS); common->Printf("GL_EXTENSIONS: %s\n", glstring); // FIXME: here, software GL test glConfig.isFullscreen = a.fullScreen; - + if ( glConfig.isFullscreen ) { Sys_GrabMouseCursor( true ); } - + return true; } @@ -563,17 +563,17 @@ bool GLimp_Init( glimpParms_t a ) { if ( !GLimp_OpenDisplay() ) { return false; } - + #ifndef ID_GL_HARDLINK if ( !GLimp_dlopen() ) { return false; } #endif - + if (!GLX_Init(a)) { return false; } - + return true; } diff --git a/neo/sys/linux/glimp_dlopen.cpp.m4 b/neo/sys/linux/glimp_dlopen.cpp.m4 index a4ec7482..cbca8038 100644 --- a/neo/sys/linux/glimp_dlopen.cpp.m4 +++ b/neo/sys/linux/glimp_dlopen.cpp.m4 @@ -9,12 +9,12 @@ dnl ===================================================== dnl utils dnl ===================================================== -define(`forloop', +define(`forloop', `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') define(`_forloop', `$4`'ifelse($1, `$3', , `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') - + dnl ===================================================== dnl the gl wgl glX definitions dnl ===================================================== @@ -90,9 +90,9 @@ bool GLimp_dlopen() { common->DPrintf("dlopen(%s) failed: %s\n", driverName, dlerror()); return false; } - + // dlsym the symbols - + define(`dlsym_funcptr', `dll`$2' = ( `$1' ( APIENTRY *)(`$3') ) dlsym( glHandle, "gl`$2'" );') define(`safe_dlsym_funcptr', `dlsym_funcptr(`$1', `$2', `$3') if (!dll`$2') { GLimp_dlsym_failed("gl`$2'"); return false; }') @@ -119,11 +119,11 @@ GLimp_dlclose void GLimp_dlclose() { if ( !glHandle ) { common->DPrintf("dlclose: GL handle is NULL\n"); - } else { + } else { dlclose( glHandle ); glHandle = NULL; } - + define(`reset_funcptr', `qgl`$1' = NULL;') forloop(`i', gl_start, gl_end, `reset_funcptr(indir(`f'i`_name')) ') diff --git a/neo/sys/linux/glimp_glenum.h b/neo/sys/linux/glimp_glenum.h index 5ab88538..0693a02b 100644 --- a/neo/sys/linux/glimp_glenum.h +++ b/neo/sys/linux/glimp_glenum.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/neo/sys/linux/glimp_local.h.m4 b/neo/sys/linux/glimp_local.h.m4 index a43785e5..5e2d08ba 100644 --- a/neo/sys/linux/glimp_local.h.m4 +++ b/neo/sys/linux/glimp_local.h.m4 @@ -2,12 +2,12 @@ dnl ===================================================== dnl utils dnl ===================================================== -define(`forloop', +define(`forloop', `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') define(`_forloop', `$4`'ifelse($1, `$3', , `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') - + dnl ===================================================== dnl the gl wgl glX definitions dnl ===================================================== diff --git a/neo/sys/linux/glimp_logging.cpp.m4 b/neo/sys/linux/glimp_logging.cpp.m4 index 0145e509..f8de0a30 100644 --- a/neo/sys/linux/glimp_logging.cpp.m4 +++ b/neo/sys/linux/glimp_logging.cpp.m4 @@ -11,12 +11,12 @@ dnl ===================================================== dnl utils dnl ===================================================== -define(`forloop', +define(`forloop', `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') define(`_forloop', `$4`'ifelse($1, `$3', , `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') - + dnl ===================================================== dnl the gl wgl glX definitions dnl ===================================================== @@ -160,7 +160,7 @@ void GLimp_EnableLogging(bool enable) { #else // scan for an unused filename for ( i = 0 ; i < 9999 ; i++ ) { - sprintf( qpath, "renderlog_%i.txt", i ); + sprintf( qpath, "renderlog_%i.txt", i ); if ( fileSystem->ReadFile( qpath, NULL, NULL ) == -1 ) { break; // use this name } diff --git a/neo/sys/linux/glimp_stub.cpp.m4 b/neo/sys/linux/glimp_stub.cpp.m4 index 4c622156..9521171a 100644 --- a/neo/sys/linux/glimp_stub.cpp.m4 +++ b/neo/sys/linux/glimp_stub.cpp.m4 @@ -9,12 +9,12 @@ dnl ===================================================== dnl utils dnl ===================================================== -define(`forloop', +define(`forloop', `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') define(`_forloop', `$4`'ifelse($1, `$3', , `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') - + dnl ===================================================== dnl the gl wgl glX definitions dnl ===================================================== diff --git a/neo/sys/linux/input.cpp b/neo/sys/linux/input.cpp index fda20f16..7c15d5d5 100644 --- a/neo/sys/linux/input.cpp +++ b/neo/sys/linux/input.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"). @@ -117,7 +117,7 @@ void Sys_InitInput(void) { //#define XEVT_DBG2 static Cursor Sys_XCreateNullCursor( Display *display, Window root ) { - Pixmap cursormask; + Pixmap cursormask; XGCValues xgc; GC gc; XColor dummycolour; @@ -147,7 +147,7 @@ static void Sys_XInstallGrabs( void ) { XSync( dpy, False ); XDefineCursor( dpy, win, Sys_XCreateNullCursor( dpy, win ) ); - + XGrabPointer( dpy, win, False, MOUSE_MASK, @@ -158,18 +158,18 @@ static void Sys_XInstallGrabs( void ) { XGetPointerControl( dpy, &mouse_accel_numerator, &mouse_accel_denominator, &mouse_threshold ); - + XChangePointerControl( dpy, True, True, 1, 1, 0 ); - + XSync( dpy, False ); - + mouse_reset_time = Sys_Milliseconds (); - + if ( in_dgamouse.GetBool() && !dga_found ) { common->Printf("XF86DGA not available, forcing DGA mouse off\n"); in_dgamouse.SetBool( false ); } - + if ( in_dgamouse.GetBool() ) { #if defined( ID_ENABLE_DGA ) XF86DGADirectVideo( dpy, DefaultScreen( dpy ), XF86DGADirectMouse ); @@ -180,12 +180,12 @@ static void Sys_XInstallGrabs( void ) { mwy = glConfig.vidHeight / 2; mx = my = 0; } - + XGrabKeyboard( dpy, win, False, GrabModeAsync, GrabModeAsync, CurrentTime ); - + XSync( dpy, False ); mouse_active = true; @@ -200,17 +200,17 @@ void Sys_XUninstallGrabs(void) { XF86DGADirectVideo( dpy, DefaultScreen( dpy ), 0 ); } #endif - - XChangePointerControl( dpy, true, true, mouse_accel_numerator, + + XChangePointerControl( dpy, true, true, mouse_accel_numerator, mouse_accel_denominator, mouse_threshold ); - + XUngrabPointer( dpy, CurrentTime ); XUngrabKeyboard( dpy, CurrentTime ); - + XWarpPointer( dpy, None, win, 0, 0, 0, 0, glConfig.vidWidth / 2, glConfig.vidHeight / 2); - + XUndefineCursor( dpy, win ); mouse_active = false; @@ -228,7 +228,7 @@ void Sys_GrabMouseCursor( bool grabIt ) { #endif return; } - + if ( glConfig.isFullscreen ) { if ( !grabIt ) { return; // never ungrab while fullscreen @@ -238,7 +238,7 @@ void Sys_GrabMouseCursor( bool grabIt ) { in_nograb.SetBool( false ); } } - + if ( in_nograb.GetBool() ) { if ( in_dgamouse.GetBool() ) { common->DPrintf("in_nograb 1, forcing forcing DGA mouse off\n"); @@ -260,7 +260,7 @@ void Sys_GrabMouseCursor( bool grabIt ) { } /** - * XPending() actually performs a blocking read + * XPending() actually performs a blocking read * if no events available. From Fakk2, by way of * Heretic2, by way of SDL, original idea GGI project. * The benefit of this approach over the quite @@ -268,8 +268,8 @@ void Sys_GrabMouseCursor( bool grabIt ) { * focus handling for free, which is a major win * with debug and windowed mode. It rests on the * assumption that the X server will use the - * same timestamp on press/release event pairs - * for key repeats. + * same timestamp on press/release event pairs + * for key repeats. */ static bool Sys_XPendingInput( void ) { // Flush the display connection @@ -284,12 +284,12 @@ static bool Sys_XPendingInput( void ) { int x11_fd; fd_set fdset; - x11_fd = ConnectionNumber( dpy ); - FD_ZERO( &fdset ); - FD_SET( x11_fd, &fdset ); - if ( select( x11_fd+1, &fdset, NULL, NULL, &zero_time ) == 1 ) { + x11_fd = ConnectionNumber( dpy ); + FD_ZERO( &fdset ); + FD_SET( x11_fd, &fdset ); + if ( select( x11_fd+1, &fdset, NULL, NULL, &zero_time ) == 1 ) { return XPending( dpy ); - } + } // Oh well, nothing is ready .. return false; @@ -324,7 +324,7 @@ static bool Sys_XRepeatPress( XEvent *event ) { Posix_QueEvent( SE_KEY, s_scantokey[peekevent.xkey.keycode], false, 0, NULL); } } - } + } return repeated; } @@ -338,14 +338,14 @@ void Posix_PollInput() { static char buf[16]; static XEvent event; static XKeyEvent *key_event = (XKeyEvent*)&event; - int lookupRet; + int lookupRet; int b, dx, dy; - KeySym keysym; - + KeySym keysym; + if ( !dpy ) { return; } - + // NOTE: Sys_GetEvent only calls when there are no events left // but here we pump all X events that have accumulated // pump one by one? or use threaded input? @@ -376,8 +376,8 @@ void Posix_PollInput() { } if (!Posix_AddKeyboardPollEvent( s_scantokey[key_event->keycode], true )) return; - break; - + break; + case KeyRelease: if (Sys_XRepeatPress(&event)) { #ifdef XEVT_DBG2 @@ -397,7 +397,7 @@ void Posix_PollInput() { if (!Posix_AddKeyboardPollEvent( s_scantokey[key_event->keycode], false )) return; break; - + case ButtonPress: if (event.xbutton.button == 4) { Posix_QueEvent( SE_KEY, K_MWHEELUP, true, 0, NULL); @@ -457,7 +457,7 @@ void Posix_PollInput() { } } break; - + case MotionNotify: if (!mouse_active) break; @@ -495,7 +495,7 @@ void Posix_PollInput() { mwx = event.xmotion.x; mwy = event.xmotion.y; - XWarpPointer(dpy,None,win,0,0,0,0, (glConfig.vidWidth/2),(glConfig.vidHeight/2)); + XWarpPointer(dpy,None,win,0,0,0,0, (glConfig.vidWidth/2),(glConfig.vidHeight/2)); } break; } @@ -527,7 +527,7 @@ unsigned char Sys_MapCharForKey( int _key ) { } // query the current keyboard group, must be passed as bit 13-14 in the constructed XEvent - // see X Keyboard Extension library specifications + // see X Keyboard Extension library specifications XkbGetState( dpy, XkbUseCoreKbd, &kbd_state ); // lookup scancode from doom key code. unique hits diff --git a/neo/sys/linux/local.h b/neo/sys/linux/local.h index b7f1d8fa..6fea5405 100644 --- a/neo/sys/linux/local.h +++ b/neo/sys/linux/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/neo/sys/linux/main.cpp b/neo/sys/linux/main.cpp index b1c6f60a..534f1bc9 100644 --- a/neo/sys/linux/main.cpp +++ b/neo/sys/linux/main.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"). @@ -69,17 +69,17 @@ void Sys_AsyncThread( void ) { ticked = now >> 4; while (1) { // sleep - now = Sys_Milliseconds(); + now = Sys_Milliseconds(); next = ( now & 0xFFFFFFF0 ) + 0x10; want_sleep = ( next-now-1 ) * 1000; if ( want_sleep > 0 ) { usleep( want_sleep ); // sleep 1ms less than true target } - + // compensate if we slept too long now = Sys_Milliseconds(); to_ticked = now >> 4; - + // show ticking statistics - every 100 ticks, print a summary #if 0 #define STAT_BUF 100 @@ -100,7 +100,7 @@ void Sys_AsyncThread( void ) { counter = 0; } #endif - + while ( ticked < to_ticked ) { common->Async(); ticked++; @@ -271,7 +271,7 @@ double MeasureClockTicks( void ) { t0 = Sys_GetClockTicks( ); Sys_Sleep( 1000 ); - t1 = Sys_GetClockTicks( ); + t1 = Sys_GetClockTicks( ); return t1 - t0; } @@ -297,7 +297,7 @@ double Sys_ClockTicksPerSecond(void) { ret = MeasureClockTicks(); init = true; common->Printf( "measured CPU frequency: %g MHz\n", ret / 1000000.0 ); - return ret; + return ret; } len = read( fd, buf, 4096 ); close( fd ); @@ -314,7 +314,7 @@ double Sys_ClockTicksPerSecond(void) { ret = MeasureClockTicks(); init = true; common->Printf( "measured CPU frequency: %g MHz\n", ret / 1000000.0 ); - return ret; + return ret; } common->Printf( "/proc/cpuinfo CPU frequency: %g MHz\n", ret ); ret *= 1000000; @@ -327,7 +327,7 @@ double Sys_ClockTicksPerSecond(void) { ret = MeasureClockTicks(); init = true; common->Printf( "measured CPU frequency: %g MHz\n", ret / 1000000.0 ); - return ret; + return ret; } /* @@ -344,7 +344,7 @@ int Sys_GetSystemRam( void ) { if ( count == -1 ) { common->Printf( "GetSystemRam: sysconf _SC_PHYS_PAGES failed\n" ); return 512; - } + } page_size = sysconf( _SC_PAGE_SIZE ); if ( page_size == -1 ) { common->Printf( "GetSystemRam: sysconf _SC_PAGE_SIZE failed\n" ); @@ -365,7 +365,7 @@ the no-fork lets you keep the terminal when you're about to spawn an installer if the command contains spaces, system() is used. Otherwise the more straightforward execl ( system() blows though ) ================== */ -void Sys_DoStartProcess( const char *exeName, bool dofork ) { +void Sys_DoStartProcess( const char *exeName, bool dofork ) { bool use_system = false; if ( strchr( exeName, ' ' ) ) { use_system = true; @@ -431,7 +431,7 @@ void idSysLocal::OpenURL( const char *url, bool quit ) { } common->Printf( "Open URL: %s\n", url ); - // opening an URL on *nix can mean a lot of things .. + // opening an URL on *nix can mean a lot of things .. // just spawn a script instead of deciding for the user :-) // look in the savepath first, then in the basepath @@ -548,7 +548,7 @@ int main(int argc, const char **argv) { mcheck( abrt_func ); Sys_Printf( "memory consistency checking enabled\n" ); #endif - + Posix_EarlyInit( ); if ( argc > 1 ) { diff --git a/neo/sys/linux/pk4/id_utils.py b/neo/sys/linux/pk4/id_utils.py index 53f978bb..77fae730 100644 --- a/neo/sys/linux/pk4/id_utils.py +++ b/neo/sys/linux/pk4/id_utils.py @@ -4,36 +4,36 @@ import os, zipfile, md5, pdb # sorts in reverse alphabetical order like doom does for searching def list_paks( path ): - files = os.listdir( path ) - for i in files: - if ( i[-4:] != '.pk4' ): - files.remove( i ) + files = os.listdir( path ) + for i in files: + if ( i[-4:] != '.pk4' ): + files.remove( i ) files.sort() files.reverse() - return files + return files def list_files_in_pak( pak ): - files = [] - zippy = zipfile.ZipFile( pak ) - files += zippy.namelist() - files.sort() - return files + files = [] + zippy = zipfile.ZipFile( pak ) + files += zippy.namelist() + files.sort() + return files # no sorting, blunt list of everything def list_files_in_paks( path ): - files = [] - zippies = list_paks( path ) - for fname in zippies: - print fname - zippy = zipfile.ZipFile( os.path.join( path, fname ) ) - files += zippy.namelist() - # sort and remove dupes - dico = {} - for f in files: - dico[ f ] = 1 - files = dico.keys() - files.sort() - return files + files = [] + zippies = list_paks( path ) + for fname in zippies: + print fname + zippy = zipfile.ZipFile( os.path.join( path, fname ) ) + files += zippy.namelist() + # sort and remove dupes + dico = {} + for f in files: + dico[ f ] = 1 + files = dico.keys() + files.sort() + return files # build a dictionary of names -> ( pak name, md5 ) from a path of pk4s def md5_in_paks( path ): @@ -93,27 +93,27 @@ def list_updated_files( pak_path, base_path, case_match = False ): # find which files are missing in the expanded path, and extract the directories # returns ( files, dirs, missing ) def status_files_for_path( path, infiles ): - files = [] - dirs = [] - missing = [] - for i in infiles: - test_path = os.path.join( path, i ) - if ( os.path.isfile( test_path ) ): - files.append( i ) - elif ( os.path.isdir( test_path ) ): - dirs.append( i ) - else: - missing.append( i ) - return ( files, dirs, missing ) + files = [] + dirs = [] + missing = [] + for i in infiles: + test_path = os.path.join( path, i ) + if ( os.path.isfile( test_path ) ): + files.append( i ) + elif ( os.path.isdir( test_path ) ): + dirs.append( i ) + else: + missing.append( i ) + return ( files, dirs, missing ) # build a pak from a base path and a list of files def build_pak( pak, path, files ): - zippy = zipfile.ZipFile( pak, 'w', zipfile.ZIP_DEFLATED ) - for i in files: - source_path = os.path.join( path, i ) - print source_path - zippy.write( source_path, i ) - zippy.close() + zippy = zipfile.ZipFile( pak, 'w', zipfile.ZIP_DEFLATED ) + for i in files: + source_path = os.path.join( path, i ) + print source_path + zippy.write( source_path, i ) + zippy.close() # process the list of files after a run to update media # dds/ -> verify all the .dds are present in zip ( case insensitive ) @@ -238,4 +238,3 @@ def ifind_list( base, files ): else: notfound.append( i ) return [ cased, notfound ] - diff --git a/neo/sys/linux/pk4/packup-nocase.sh b/neo/sys/linux/pk4/packup-nocase.sh index 278a288d..0e15b599 100644 --- a/neo/sys/linux/pk4/packup-nocase.sh +++ b/neo/sys/linux/pk4/packup-nocase.sh @@ -4,4 +4,3 @@ flip -u $2 mkdir -p `dirname $1` cd /var/local/Doom/base cat $2 | zip $1 -@ - diff --git a/neo/sys/linux/pk4/packup.sh b/neo/sys/linux/pk4/packup.sh index 362a17ed..d86299c6 100644 --- a/neo/sys/linux/pk4/packup.sh +++ b/neo/sys/linux/pk4/packup.sh @@ -4,4 +4,3 @@ flip -u $2 mkdir -p `dirname $1` cd /var/local/Doom/base cat $2 | while read i ; do find . -ipath "./$i" ; done | cut -b 3- | tee /home/timo/cased.log | zip $1 -@ - diff --git a/neo/sys/linux/pk4/updatepaks.sh b/neo/sys/linux/pk4/updatepaks.sh index ad2cd8df..174768f3 100644 --- a/neo/sys/linux/pk4/updatepaks.sh +++ b/neo/sys/linux/pk4/updatepaks.sh @@ -24,4 +24,3 @@ cat $TMPDIR/sorted-unique.log | zip -b $TMPDIR $3 -@ 1>/dev/null md5sum $3 echo "done." - diff --git a/neo/sys/linux/process_undef.pl b/neo/sys/linux/process_undef.pl index 9a5ee7fa..fd33d23e 100644 --- a/neo/sys/linux/process_undef.pl +++ b/neo/sys/linux/process_undef.pl @@ -17,4 +17,3 @@ foreach (@sorted) { print "$symbols{$_} : $_\n"; }; - diff --git a/neo/sys/linux/qgl_enforce.h b/neo/sys/linux/qgl_enforce.h index d8de3061..3a201eae 100644 --- a/neo/sys/linux/qgl_enforce.h +++ b/neo/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/neo/sys/linux/qgl_enforce.h.m4 b/neo/sys/linux/qgl_enforce.h.m4 index 2fb2029d..d9cd79be 100644 --- a/neo/sys/linux/qgl_enforce.h.m4 +++ b/neo/sys/linux/qgl_enforce.h.m4 @@ -2,12 +2,12 @@ dnl ===================================================== dnl utils dnl ===================================================== -define(`forloop', +define(`forloop', `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') define(`_forloop', `$4`'ifelse($1, `$3', , `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') - + dnl ===================================================== dnl the gl wgl glX definitions dnl ===================================================== @@ -21,4 +21,3 @@ forloop(`i', gl_start, gl_end, `define_out(indir(`f'i`_name')) ') forloop(`i', glX_start, glX_end, `define_out(indir(`f'i`_name')) ') - diff --git a/neo/sys/linux/runner/runner_lib.py b/neo/sys/linux/runner/runner_lib.py index 9e258834..01072b20 100644 --- a/neo/sys/linux/runner/runner_lib.py +++ b/neo/sys/linux/runner/runner_lib.py @@ -28,7 +28,7 @@ class doomClientProtocol( protocol.ProcessProtocol ): def connectionMade( self ): self.logfile.write( 'connectionMade\n' ) - + def outReceived( self, data ): print data self.logfile.write( data ) @@ -36,22 +36,22 @@ class doomClientProtocol( protocol.ProcessProtocol ): def errReceived( self, data ): print 'stderr: ' + data self.logfile.write( 'stderr: ' + data ) - + def inConnectionLost( self ): self.logfile.write( 'inConnectionLost\n' ) - + def outConnectionLost( self ): self.logfile.write( 'outConnectionLost\n' ) - + def errConnectionLost( self ): self.logfile.write( 'errConnectionLost\n' ) - + def processEnded( self, status_object ): self.logfile.write( 'processEnded %s\n' % repr( status_object ) ) self.logfile.write( time.strftime( '%H:%M:%S', time.localtime( time.time() ) ) + '\n' ) self.logfile.close() self.deferred.callback( None ) - + # mac management def __init__( self, logfilename, deferred ): self.logfilename = logfilename @@ -138,7 +138,7 @@ class doomService( service.Service ): print 'sleepAVGReply %s%%' % s if ( s == '0' ): # need twice in a row - if ( self.state == 2 ): + if ( self.state == 2 ): print 'child process is interactive' self.p_transport.write( 'quit\n' ) else: @@ -167,7 +167,7 @@ class doomService( service.Service ): return defer = utils.getProcessOutput( '/bin/bash', [ '-c', 'cat /proc/%d/status | grep SleepAVG' % self.p_transport.pid ] ) defer.addCallback( self.sleepAVGReply ) - defer.setTimeout( 2, self.sleepAVGTimeout ) + defer.setTimeout( 2, self.sleepAVGTimeout ) def nextMap( self ): self.state = 0 @@ -183,7 +183,7 @@ class doomService( service.Service ): cmdline = [ self.bin ] + self.cmdline if ( name != 'blankrun' ): cmdline += [ '+devmap', name ] - print 'Command line: ' + repr( cmdline ) + print 'Command line: ' + repr( cmdline ) self.deferred = defer.Deferred() self.deferred.addCallback( self.processEnded ) self.p_transport = reactor.spawnProcess( doomClientProtocol( logfile, self.deferred ), self.bin, cmdline , path = os.path.dirname( self.bin ), env = os.environ ) @@ -200,7 +200,7 @@ class doomService( service.Service ): def stopService( self ): print 'doomService stopService' - if ( not self.p_transport.pid is None ): + if ( not self.p_transport.pid is None ): self.p_transport.signalProcess( 'KILL' ) # serialize print 'saving status to %s' % self.pickle_file diff --git a/neo/sys/linux/setup/brandelf.c b/neo/sys/linux/setup/brandelf.c index 941a54ad..e2f12397 100644 --- a/neo/sys/linux/setup/brandelf.c +++ b/neo/sys/linux/setup/brandelf.c @@ -218,7 +218,7 @@ printelftypes() for (elfwalk = 0; elfwalk < sizeof(elftypes)/sizeof(elftypes[0]); elfwalk++) - fprintf(stderr, "%s(%u) ", elftypes[elfwalk].str, + fprintf(stderr, "%s(%u) ", elftypes[elfwalk].str, elftypes[elfwalk].value); fprintf(stderr, "\n"); } diff --git a/neo/sys/linux/setup/image-base/setup.sh b/neo/sys/linux/setup/image-base/setup.sh index 8e92ae77..b9a5b71f 100644 --- a/neo/sys/linux/setup/image-base/setup.sh +++ b/neo/sys/linux/setup/image-base/setup.sh @@ -36,7 +36,7 @@ DetectARCH() i?86 | i86*) echo "x86" status=0;; - 90*/*) + 90*/*) echo "hppa" status=0;; *) @@ -44,9 +44,9 @@ DetectARCH() IRIX*) echo "mips" status=0;; - AIX*) - echo "ppc" - status=0;; + AIX*) + echo "ppc" + status=0;; *) arch=`uname -p 2> /dev/null || uname -m` if test "$arch" = powerpc; then @@ -76,10 +76,10 @@ DetectLIBC() # if [ fgrep GLIBC_2.1 /lib/libc.so.6* 2> $NULL >> $NULL ]; then # echo "glibc-2.1" # status=0 -# else +# else # echo "glibc-2.0" # status=0 -# fi +# fi elif [ -f /lib/libc.so.5 ]; then echo "libc5" status=0 @@ -109,7 +109,7 @@ args="" # Import preferences from a secondary script if [ -f setup.data/config.sh ]; then - . setup.data/config.sh + . setup.data/config.sh elif [ -f SETUP.DAT/CONFIG.SH\;1 ]; then # HP-UX and other systems unable to get LFN correctly . SETUP.DAT/CONFIG.SH\;1 @@ -137,71 +137,71 @@ fi # PARAMETERS_PASSED: additional arguments passed to the setup script try_run() { - absolute=0 - if [ "$1" = "-absolute" ]; then - absolute=1 - shift - fi + absolute=0 + if [ "$1" = "-absolute" ]; then + absolute=1 + shift + fi - fatal=0 - # older bash < 2.* don't like == operator, using = - if [ "$1" = "-fatal" ]; then - # got fatal - fatal=1 - shift - fi + fatal=0 + # older bash < 2.* don't like == operator, using = + if [ "$1" = "-fatal" ]; then + # got fatal + fatal=1 + shift + fi - setup=$1 - shift - - # First find the binary we want to run - failed=0 - if [ "$absolute" -eq 0 ] - then - setup_bin="setup.data/bin/$os/$arch/$libc/$setup" - # trying $setup_bin - if [ ! -f "$setup_bin" ]; then - setup_bin="setup.data/bin/$os/$arch/$setup" - # libc dependant version failed, trying again - if [ ! -f "$setup_bin" ]; then - failed=1 - fi - fi - if [ "$failed" -eq 1 ]; then - if [ "$fatal" -eq 1 ]; then - cat <<__EOF__ + setup=$1 + shift + + # First find the binary we want to run + failed=0 + if [ "$absolute" -eq 0 ] + then + setup_bin="setup.data/bin/$os/$arch/$libc/$setup" + # trying $setup_bin + if [ ! -f "$setup_bin" ]; then + setup_bin="setup.data/bin/$os/$arch/$setup" + # libc dependant version failed, trying again + if [ ! -f "$setup_bin" ]; then + failed=1 + fi + fi + if [ "$failed" -eq 1 ]; then + if [ "$fatal" -eq 1 ]; then + cat <<__EOF__ This installation doesn't support $libc on $os / $arch (tried to run $setup) $FATAL_ERROR __EOF__ - fi - return $failed - fi + fi + return $failed + fi - # Try to run the binary ($setup_bin) - # The executable is here but we can't execute it from CD - # NOTE TTimo: this is dangerous, we also use $setup to store the name of the try_run - setup="$HOME/.setup$$" - rm -f "$setup" - cp "$setup_bin" "$setup" - chmod 700 "$setup" + # Try to run the binary ($setup_bin) + # The executable is here but we can't execute it from CD + # NOTE TTimo: this is dangerous, we also use $setup to store the name of the try_run + setup="$HOME/.setup$$" + rm -f "$setup" + cp "$setup_bin" "$setup" + chmod 700 "$setup" trap "rm -f $setup" 1 2 3 15 - fi + fi # echo Running "$setup" "$@" - if [ "$fatal" -eq 0 ]; then - "$setup" "$@" - failed="$?" - else - "$setup" "$@" 2>> $NULL - failed="$?" - fi - if [ "$absolute" -eq 0 ] - then - # don't attempt removal when we are passed an absolute path - # no, I don't want to imagine a faulty try_run as root on /bin/su - rm -f "$setup" - fi - return "$failed" + if [ "$fatal" -eq 0 ]; then + "$setup" "$@" + failed="$?" + else + "$setup" "$@" 2>> $NULL + failed="$?" + fi + if [ "$absolute" -eq 0 ] + then + # don't attempt removal when we are passed an absolute path + # no, I don't want to imagine a faulty try_run as root on /bin/su + rm -f "$setup" + fi + return "$failed" } if [ "$GET_ROOT" -eq 3 ] @@ -225,51 +225,51 @@ then if [ "$USE_XHOST" -eq 1 ]; then xhost +127.0.0.1 2> $NULL > $NULL fi - if [ "$GET_ROOT" -eq 1 ] - then - try_run xsu -e -a -u root -c "sh `pwd`/setup.sh -auth" $XSU_ICON -m "$XSU_MESSAGE" - else - try_run xsu -e -a -u root -c "sh `pwd`/setup.sh -auth" $XSU_ICON - fi - status="$?" - # echo "got $status" - # if try_run successfully executed xsu, it will return xsu's exit code - # xsu returns 2 if ran and cancelled (i.e. the user 'doesn't want' to auth) - # it will return 0 if the command was executed correctly - # summing up, if we get 1, something failed - if [ "$status" -eq 0 ] - then - # the auth command was properly executed - exit 0 - elif [ "$status" -eq 1 ] - then - # xsu wasn't found, or failed to run - # if xsu actually ran and the auth was cancelled, $status is > 1 - # try with su - # su will return 1 if auth failed - # we need to distinguish between su auth failed and su working, and still get setup.sh return code - printf "$SU_MESSAGE\n" - try_run -absolute /bin/su root -c "export DISPLAY=$DISPLAY;sh `pwd`/setup.sh -auth" - status="$?" + if [ "$GET_ROOT" -eq 1 ] + then + try_run xsu -e -a -u root -c "sh `pwd`/setup.sh -auth" $XSU_ICON -m "$XSU_MESSAGE" + else + try_run xsu -e -a -u root -c "sh `pwd`/setup.sh -auth" $XSU_ICON + fi + status="$?" + # echo "got $status" + # if try_run successfully executed xsu, it will return xsu's exit code + # xsu returns 2 if ran and cancelled (i.e. the user 'doesn't want' to auth) + # it will return 0 if the command was executed correctly + # summing up, if we get 1, something failed + if [ "$status" -eq 0 ] + then + # the auth command was properly executed + exit 0 + elif [ "$status" -eq 1 ] + then + # xsu wasn't found, or failed to run + # if xsu actually ran and the auth was cancelled, $status is > 1 + # try with su + # su will return 1 if auth failed + # we need to distinguish between su auth failed and su working, and still get setup.sh return code + printf "$SU_MESSAGE\n" + try_run -absolute /bin/su root -c "export DISPLAY=$DISPLAY;sh `pwd`/setup.sh -auth" + status="$?" if [ "$status" -eq 1 ] && [ "$GET_ROOT" -eq 1 ] - then - echo "Running setup as user" - else - exit $status - fi - elif [ "$status" -eq 3 ] - then - if [ "$GET_ROOT" -eq 1 ] - then - echo "Running setup as user" - else - # the auth failed or was canceled - # we don't want to even start the setup if not root - echo "Please run this installation as the super user" - exit 1 - fi - fi - # continue running as is + then + echo "Running setup as user" + else + exit $status + fi + elif [ "$status" -eq 3 ] + then + if [ "$GET_ROOT" -eq 1 ] + then + echo "Running setup as user" + else + # the auth failed or was canceled + # we don't want to even start the setup if not root + echo "Please run this installation as the super user" + exit 1 + fi + fi + # continue running as is fi fi @@ -283,8 +283,8 @@ try_run setup $args $* status="$?" if [ "$auth" -eq 1 ] && [ "$status" -ne 0 ] then - # distinguish between failed su and failed su'ed setup.sh - exit 2 + # distinguish between failed su and failed su'ed setup.sh + exit 2 fi exit $status fi diff --git a/neo/sys/linux/setup/image-demo/setup.data/postinstall.sh b/neo/sys/linux/setup/image-demo/setup.data/postinstall.sh index 5bd60066..b352254c 100644 --- a/neo/sys/linux/setup/image-demo/setup.data/postinstall.sh +++ b/neo/sys/linux/setup/image-demo/setup.data/postinstall.sh @@ -11,19 +11,19 @@ cd \"$1\" export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:. exec ./$BINARY \"\$@\" " > "$1/$TARGET" - + chmod a+x "$1/$TARGET" - + # and then we must symlink to this # can't be done from setup.xml because it would symlink the binary if [ -n "$SETUP_SYMLINKSPATH" ] && [ -d "$SETUP_SYMLINKSPATH" ] then - # the symlink might already exists, in case we will remove it - if [ -h "$SETUP_SYMLINKSPATH/$TARGET" ] - then - echo "Removing existing $TARGET symlink" - rm "$SETUP_SYMLINKSPATH/$TARGET" - fi + # the symlink might already exists, in case we will remove it + if [ -h "$SETUP_SYMLINKSPATH/$TARGET" ] + then + echo "Removing existing $TARGET symlink" + rm "$SETUP_SYMLINKSPATH/$TARGET" + fi echo "Installing symlink $SETUP_SYMLINKSPATH/$TARGET -> $1/$TARGET" ln -s "$1/$TARGET" "$SETUP_SYMLINKSPATH/$TARGET" fi diff --git a/neo/sys/linux/setup/image/setup.data/postinstall.sh b/neo/sys/linux/setup/image/setup.data/postinstall.sh index cfe31f89..b2529bfa 100644 --- a/neo/sys/linux/setup/image/setup.data/postinstall.sh +++ b/neo/sys/linux/setup/image/setup.data/postinstall.sh @@ -11,19 +11,19 @@ cd \"$1\" export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:. exec ./$BINARY \"\$@\" " > "$1/$TARGET" - + chmod a+x "$1/$TARGET" - + # and then we must symlink to this # can't be done from setup.xml because it would symlink the binary if [ -n "$SETUP_SYMLINKSPATH" ] && [ -d "$SETUP_SYMLINKSPATH" ] then - # the symlink might already exists, in case we will remove it - if [ -h "$SETUP_SYMLINKSPATH/$TARGET" ] - then - echo "Removing existing $TARGET symlink" - rm "$SETUP_SYMLINKSPATH/$TARGET" - fi + # the symlink might already exists, in case we will remove it + if [ -h "$SETUP_SYMLINKSPATH/$TARGET" ] + then + echo "Removing existing $TARGET symlink" + rm "$SETUP_SYMLINKSPATH/$TARGET" + fi echo "Installing symlink $SETUP_SYMLINKSPATH/$TARGET -> $1/$TARGET" ln -s "$1/$TARGET" "$SETUP_SYMLINKSPATH/$TARGET" fi diff --git a/neo/sys/linux/setup/makeself/makeself-header.sh b/neo/sys/linux/setup/makeself/makeself-header.sh index 5519e364..d9886679 100644 --- a/neo/sys/linux/setup/makeself/makeself-header.sh +++ b/neo/sys/linux/setup/makeself/makeself-header.sh @@ -15,37 +15,37 @@ keep=$KEEP print_cmd_arg="" if type printf > /dev/null; then - print_cmd="printf" + print_cmd="printf" elif test -x /usr/ucb/echo; then - print_cmd="/usr/ucb/echo" + print_cmd="/usr/ucb/echo" else - print_cmd="echo" + print_cmd="echo" fi MS_Printf() { - \$print_cmd \$print_cmd_arg "\$1" + \$print_cmd \$print_cmd_arg "\$1" } MS_Progress() { - while read a; do + while read a; do MS_Printf . - done + done } MS_dd() { - blocks=\`expr \$3 / 1024\` - bytes=\`expr \$3 % 1024\` - dd if="\$1" ibs=\$2 skip=1 obs=1024 conv=sync 2> /dev/null | \\ - { test \$blocks -gt 0 && dd ibs=1024 obs=1024 count=\$blocks ; \\ - test \$bytes -gt 0 && dd ibs=1 obs=1024 count=\$bytes ; } 2> /dev/null + blocks=\`expr \$3 / 1024\` + bytes=\`expr \$3 % 1024\` + dd if="\$1" ibs=\$2 skip=1 obs=1024 conv=sync 2> /dev/null | \\ + { test \$blocks -gt 0 && dd ibs=1024 obs=1024 count=\$blocks ; \\ + test \$bytes -gt 0 && dd ibs=1 obs=1024 count=\$bytes ; } 2> /dev/null } MS_Help() { - cat << EOH >&2 + cat << EOH >&2 Makeself version $MS_VERSION 1) Getting help or info about \$0 : \$0 --help Print this message @@ -53,7 +53,7 @@ Makeself version $MS_VERSION \$0 --lsm Print embedded lsm entry (or no LSM) \$0 --list Print the list of files in the archive \$0 --check Checks integrity of the archive - + 2) Running \$0 : \$0 [options] [--] [additional arguments to embedded script] with following options (in that order) @@ -71,17 +71,17 @@ EOH MS_Check() { - OLD_PATH=\$PATH - PATH=\${GUESS_MD5_PATH:-"\$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"} - MD5_PATH=\`exec 2>&-; which md5sum || type md5sum\` - MD5_PATH=\${MD5_PATH:-\`exec 2>&-; which md5 || type md5\`} - PATH=\$OLD_PATH - MS_Printf "Verifying archive integrity..." - offset=\`head -n $SKIP "\$1" | wc -c | tr -d " "\` - verb=\$2 - i=1 - for s in \$filesizes - do + OLD_PATH=\$PATH + PATH=\${GUESS_MD5_PATH:-"\$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"} + MD5_PATH=\`exec 2>&-; which md5sum || type md5sum\` + MD5_PATH=\${MD5_PATH:-\`exec 2>&-; which md5 || type md5\`} + PATH=\$OLD_PATH + MS_Printf "Verifying archive integrity..." + offset=\`head -n $SKIP "\$1" | wc -c | tr -d " "\` + verb=\$2 + i=1 + for s in \$filesizes + do crc=\`echo \$CRCsum | cut -d" " -f\$i\` if test -x "\$MD5_PATH"; then md5=\`echo \$MD5 | cut -d" " -f\$i\` @@ -111,13 +111,13 @@ MS_Check() fi i=\`expr \$i + 1\` offset=\`expr \$offset + \$s\` - done - echo " All good." + done + echo " All good." } UnTAR() { - tar \$1vf - 2>&1 || { echo Extraction failed. > /dev/tty; kill -15 \$$; } + tar \$1vf - 2>&1 || { echo Extraction failed. > /dev/tty; kill -15 \$$; } } finish=true @@ -131,12 +131,12 @@ initargs="\$@" while true do - case "\$1" in - -h | --help) + case "\$1" in + -h | --help) MS_Help exit 0 ;; - --info) + --info) echo Identification: "\$label" echo Target directory: "\$targetdir" echo Uncompressed size: $USIZE KB @@ -158,7 +158,7 @@ do fi exit 0 ;; - --dumpconf) + --dumpconf) echo LABEL=\"\$label\" echo SCRIPT=\"\$script\" echo SCRIPTARGS=\"\$scriptargs\" @@ -172,7 +172,7 @@ do echo OLDSKIP=`expr $SKIP + 1` exit 0 ;; - --lsm) + --lsm) cat << EOLSM EOF eval "$LSM_CMD" @@ -180,7 +180,7 @@ cat << EOF >> "$archname" EOLSM exit 0 ;; - --list) + --list) echo Target directory: \$targetdir offset=\`head -n $SKIP "\$0" | wc -c | tr -d " "\` for s in \$filesizes @@ -201,11 +201,11 @@ EOLSM done exit 0 ;; - --check) + --check) MS_Check "\$0" y exit 0 ;; - --confirm) + --confirm) verbose=y shift ;; @@ -213,110 +213,110 @@ EOLSM script="" shift ;; - --keep) + --keep) keep=y shift ;; - --target) + --target) keep=y targetdir=\${2:-.} shift 2 ;; - --nox11) + --nox11) nox11=y shift ;; - --nochown) + --nochown) ownership=n shift ;; - --xwin) + --xwin) finish="echo Press Return to close this window...; read junk" xterm_loop=1 shift ;; - --phase2) + --phase2) copy=phase2 shift ;; - --) + --) shift break ;; - -*) + -*) echo Unrecognized flag : "\$1" >&2 MS_Help exit 1 ;; - *) + *) break ;; - esac + esac done case "\$copy" in copy) - tmpdir=\$TMPROOT/makeself.\$RANDOM.\`date +"%y%m%d%H%M%S"\`.\$\$ - mkdir "\$tmpdir" || { + tmpdir=\$TMPROOT/makeself.\$RANDOM.\`date +"%y%m%d%H%M%S"\`.\$\$ + mkdir "\$tmpdir" || { echo "Could not create temporary directory \$tmpdir" >&2 exit 1 - } - SCRIPT_COPY="\$tmpdir/makeself" - echo "Copying to a temporary location..." >&2 - cp "\$0" "\$SCRIPT_COPY" - chmod +x "\$SCRIPT_COPY" - cd "\$TMPROOT" - exec "\$SCRIPT_COPY" --phase2 - ;; + } + SCRIPT_COPY="\$tmpdir/makeself" + echo "Copying to a temporary location..." >&2 + cp "\$0" "\$SCRIPT_COPY" + chmod +x "\$SCRIPT_COPY" + cd "\$TMPROOT" + exec "\$SCRIPT_COPY" --phase2 + ;; phase2) - finish="\$finish ; rm -rf \`dirname \$0\`" - ;; + finish="\$finish ; rm -rf \`dirname \$0\`" + ;; esac if test "\$nox11" = "n"; then - if tty -s; then # Do we have a terminal? + if tty -s; then # Do we have a terminal? : - else - if test x"\$DISPLAY" != x -a x"\$xterm_loop" = x; then # No, but do we have X? - if xset q > /dev/null 2>&1; then # Check for valid DISPLAY variable - GUESS_XTERMS="xterm rxvt dtterm eterm Eterm kvt konsole aterm" - for a in \$GUESS_XTERMS; do - if type \$a >/dev/null 2>&1; then - XTERM=\$a - break - fi - done - chmod a+x \$0 || echo Please add execution rights on \$0 - if test \`echo "\$0" | cut -c1\` = "/"; then # Spawn a terminal! - exec \$XTERM -title "\$label" -e "\$0" --xwin "\$initargs" - else - exec \$XTERM -title "\$label" -e "./\$0" --xwin "\$initargs" - fi - fi - fi - fi + else + if test x"\$DISPLAY" != x -a x"\$xterm_loop" = x; then # No, but do we have X? + if xset q > /dev/null 2>&1; then # Check for valid DISPLAY variable + GUESS_XTERMS="xterm rxvt dtterm eterm Eterm kvt konsole aterm" + for a in \$GUESS_XTERMS; do + if type \$a >/dev/null 2>&1; then + XTERM=\$a + break + fi + done + chmod a+x \$0 || echo Please add execution rights on \$0 + if test \`echo "\$0" | cut -c1\` = "/"; then # Spawn a terminal! + exec \$XTERM -title "\$label" -e "\$0" --xwin "\$initargs" + else + exec \$XTERM -title "\$label" -e "./\$0" --xwin "\$initargs" + fi + fi + fi + fi fi if test "\$targetdir" = "."; then - tmpdir="." + tmpdir="." else - if test "\$keep" = y; then + if test "\$keep" = y; then echo "Creating directory \$targetdir" >&2 tmpdir="\$targetdir" dashp="-p" - else + else tmpdir="\$TMPROOT/selfgz\$\$\$RANDOM" dashp="" - fi - mkdir \$dashp \$tmpdir || { + fi + mkdir \$dashp \$tmpdir || { echo 'Cannot create target directory' \$tmpdir >&2 echo 'You should try option --target OtherDirectory' >&2 eval \$finish exit 1 - } + } fi location="\`pwd\`" if test x\$SETUP_NOCHECK != x1; then - MS_Check "\$0" + MS_Check "\$0" fi offset=\`head -n $SKIP "\$0" | wc -c | tr -d " "\` @@ -331,43 +331,43 @@ fi MS_Printf "Uncompressing \$label" res=3 if test "\$keep" = n; then - trap 'echo Signal caught, cleaning up >&2; cd \$TMPROOT; /bin/rm -rf \$tmpdir; eval \$finish; exit 15' 1 2 3 15 + trap 'echo Signal caught, cleaning up >&2; cd \$TMPROOT; /bin/rm -rf \$tmpdir; eval \$finish; exit 15' 1 2 3 15 fi for s in \$filesizes do - if MS_dd "\$0" \$offset \$s | eval "$GUNZIP_CMD" | ( cd "\$tmpdir"; UnTAR x ) | MS_Progress; then + if MS_dd "\$0" \$offset \$s | eval "$GUNZIP_CMD" | ( cd "\$tmpdir"; UnTAR x ) | MS_Progress; then if test x"\$ownership" = xy; then (PATH=/usr/xpg4/bin:\$PATH; cd "\$tmpdir"; chown -R \`id -u\` .; chgrp -R \`id -g\` .) fi - else + else echo echo "Unable to decompress \$0" >&2 eval \$finish; exit 1 - fi - offset=\`expr \$offset + \$s\` + fi + offset=\`expr \$offset + \$s\` done echo cd "\$tmpdir" res=0 if test x"\$script" != x; then - if test x"\$verbose" = xy; then + if test x"\$verbose" = xy; then MS_Printf "OK to execute: \$script \$scriptargs \$* ? [Y/n] " read yn if test x"\$yn" = x -o x"\$yn" = xy -o x"\$yn" = xY; then eval \$script \$scriptargs \$*; res=\$?; fi - else + else eval \$script \$scriptargs \$*; res=\$? - fi - if test \$res -ne 0; then + fi + if test \$res -ne 0; then test x"\$verbose" = xy && echo "The program '\$script' returned an error code (\$res)" >&2 - fi + fi fi if test "\$keep" = n; then - cd \$TMPROOT - /bin/rm -rf \$tmpdir + cd \$TMPROOT + /bin/rm -rf \$tmpdir fi eval \$finish; exit \$res EOF diff --git a/neo/sys/linux/setup/makeself/makeself.sh b/neo/sys/linux/setup/makeself/makeself.sh index 1d903f58..e02739b4 100644 --- a/neo/sys/linux/setup/makeself/makeself.sh +++ b/neo/sys/linux/setup/makeself/makeself.sh @@ -22,13 +22,13 @@ # support for non-temporary archives. Ideas thanks to Francois Petitjean # - 1.3 : More patches from Bjarni R. Einarsson and Francois Petitjean: # Support for no compression (--nocomp), script is no longer mandatory, -# automatic launch in an xterm, optional verbose output, and -target +# automatic launch in an xterm, optional verbose output, and -target # archive option to indicate where to extract the files. # - 1.4 : Improved UNIX compatibility (Francois Petitjean) # Automatic integrity checking, support of LSM files (Francois Petitjean) # - 1.5 : Many bugfixes. Optionally disable xterm spawning. # - 1.5.1 : More bugfixes, added archive options -list and -check. -# - 1.5.2 : Cosmetic changes to inform the user of what's going on with big +# - 1.5.2 : Cosmetic changes to inform the user of what's going on with big # archives (Quake III demo) # - 1.5.3 : Check for validity of the DISPLAY variable before launching an xterm. # More verbosity in xterms and check for embedded command's return value. @@ -66,49 +66,49 @@ MS_VERSION=2.1.4 MS_COMMAND="$0" for f in "${1+"$@"}"; do - MS_COMMAND="$MS_COMMAND \\\\ - \\\"$f\\\"" + MS_COMMAND="$MS_COMMAND \\\\ + \\\"$f\\\"" done # Procedures MS_Usage() { - echo "Usage: $0 [params] archive_dir file_name label [startup_script] [args]" - echo "params can be one or more of the following :" - echo " --version | -v : Print out Makeself version number and exit" - echo " --help | -h : Print out this help message" - echo " --gzip : Compress using gzip (default if detected)" - echo " --bzip2 : Compress using bzip2 instead of gzip" - echo " --compress : Compress using the UNIX 'compress' command" - echo " --nocomp : Do not compress the data" - echo " --notemp : The archive will create archive_dir in the" - echo " current directory and uncompress in ./archive_dir" - echo " --copy : Upon extraction, the archive will first copy itself to" - echo " a temporary directory" - echo " --append : Append more files to an existing Makeself archive" - echo " The label and startup scripts will then be ignored" - echo " --current : Files will be extracted to the current directory." - echo " Implies --notemp." - echo " --nomd5 : Don't calculate an MD5 for archive" - echo " --nocrc : Don't calculate a CRC for archive" - echo " --header file : Specify location of the header script" - echo " --follow : Follow the symlinks in the archive" - echo " --nox11 : Disable automatic spawn of a xterm" - echo " --nowait : Do not wait for user input after executing embedded" - echo " program from an xterm" - echo " --lsm file : LSM file describing the package" - echo - echo "Do not forget to give a fully qualified startup script name" - echo "(i.e. with a ./ prefix if inside the archive)." - exit 1 + echo "Usage: $0 [params] archive_dir file_name label [startup_script] [args]" + echo "params can be one or more of the following :" + echo " --version | -v : Print out Makeself version number and exit" + echo " --help | -h : Print out this help message" + echo " --gzip : Compress using gzip (default if detected)" + echo " --bzip2 : Compress using bzip2 instead of gzip" + echo " --compress : Compress using the UNIX 'compress' command" + echo " --nocomp : Do not compress the data" + echo " --notemp : The archive will create archive_dir in the" + echo " current directory and uncompress in ./archive_dir" + echo " --copy : Upon extraction, the archive will first copy itself to" + echo " a temporary directory" + echo " --append : Append more files to an existing Makeself archive" + echo " The label and startup scripts will then be ignored" + echo " --current : Files will be extracted to the current directory." + echo " Implies --notemp." + echo " --nomd5 : Don't calculate an MD5 for archive" + echo " --nocrc : Don't calculate a CRC for archive" + echo " --header file : Specify location of the header script" + echo " --follow : Follow the symlinks in the archive" + echo " --nox11 : Disable automatic spawn of a xterm" + echo " --nowait : Do not wait for user input after executing embedded" + echo " program from an xterm" + echo " --lsm file : LSM file describing the package" + echo + echo "Do not forget to give a fully qualified startup script name" + echo "(i.e. with a ./ prefix if inside the archive)." + exit 1 } # Default settings if type gzip 2>&1 > /dev/null; then - COMPRESS=gzip + COMPRESS=gzip else - COMPRESS=Unix + COMPRESS=Unix fi KEEP=n CURRENT=n @@ -123,146 +123,146 @@ LSM_CMD="echo No LSM. >> \"\$archname\"" while true do - case "$1" in - --version | -v) + case "$1" in + --version | -v) echo Makeself version $MS_VERSION exit 0 ;; - --bzip2) + --bzip2) COMPRESS=bzip2 shift ;; - --gzip) + --gzip) COMPRESS=gzip shift ;; - --compress) + --compress) COMPRESS=Unix shift ;; - --nocomp) + --nocomp) COMPRESS=none shift ;; - --notemp) + --notemp) KEEP=y shift ;; - --copy) + --copy) COPY=copy shift ;; - --current) + --current) CURRENT=y KEEP=y shift ;; - --header) + --header) HEADER="$2" shift 2 ;; - --follow) + --follow) TAR_ARGS=cvfh shift ;; - --nox11) + --nox11) NOX11=y shift ;; - --nowait) + --nowait) shift ;; - --nomd5) + --nomd5) NOMD5=y shift ;; - --nocrc) + --nocrc) NOCRC=y shift ;; - --append) + --append) APPEND=y shift ;; - --lsm) + --lsm) LSM_CMD="cat \"$2\" >> \"\$archname\"" shift 2 ;; - -h | --help) + -h | --help) MS_Usage ;; - -*) + -*) echo Unrecognized flag : "$1" MS_Usage ;; - *) + *) break ;; - esac + esac done archdir="$1" archname="$2" if test "$APPEND" = y; then - if test $# -lt 2; then + if test $# -lt 2; then MS_Usage - fi + fi - # Gather the info from the original archive - OLDENV=`sh "$archname" --dumpconf` - if test $? -ne 0; then + # Gather the info from the original archive + OLDENV=`sh "$archname" --dumpconf` + if test $? -ne 0; then echo "Unable to update archive: $archname" >&2 exit 1 - else + else eval "$OLDENV" - fi + fi else - if test "$KEEP" = n -a $# = 3; then + if test "$KEEP" = n -a $# = 3; then echo "ERROR: Making a temporary archive with no embedded command does not make sense!" >&2 echo MS_Usage - fi - # We don't really want to create an absolute directory... - if test "$CURRENT" = y; then + fi + # We don't really want to create an absolute directory... + if test "$CURRENT" = y; then archdirname="." - else + else archdirname=`basename "$1"` - fi + fi - if test $# -lt 3; then + if test $# -lt 3; then MS_Usage - fi + fi - LABEL="$3" - SCRIPT="$4" - test x$SCRIPT = x || shift 1 - shift 3 - SCRIPTARGS="$*" + LABEL="$3" + SCRIPT="$4" + test x$SCRIPT = x || shift 1 + shift 3 + SCRIPTARGS="$*" fi if test "$KEEP" = n -a "$CURRENT" = y; then - echo "ERROR: It is A VERY DANGEROUS IDEA to try to combine --notemp and --current." >&2 - exit 1 + echo "ERROR: It is A VERY DANGEROUS IDEA to try to combine --notemp and --current." >&2 + exit 1 fi case $COMPRESS in gzip) - GZIP_CMD="gzip -c9" - GUNZIP_CMD="gzip -cd" - ;; + GZIP_CMD="gzip -c9" + GUNZIP_CMD="gzip -cd" + ;; bzip2) - GZIP_CMD="bzip2 -9" - GUNZIP_CMD="bzip2 -d" - ;; + GZIP_CMD="bzip2 -9" + GUNZIP_CMD="bzip2 -d" + ;; Unix) - GZIP_CMD="compress -cf" - GUNZIP_CMD="exec 2>&-; uncompress -c || test \\\$? -eq 2 || gzip -cd" - ;; + GZIP_CMD="compress -cf" + GUNZIP_CMD="exec 2>&-; uncompress -c || test \\\$? -eq 2 || gzip -cd" + ;; none) - GZIP_CMD="cat" - GUNZIP_CMD="cat" - ;; + GZIP_CMD="cat" + GUNZIP_CMD="cat" + ;; esac tmpfile="${TMPDIR:=/tmp}/mkself$$" @@ -272,25 +272,25 @@ if test -f $HEADER; then archname="$tmpfile" # Generate a fake header to count its lines SKIP=0 - . $HEADER - SKIP=`cat "$tmpfile" |wc -l` + . $HEADER + SKIP=`cat "$tmpfile" |wc -l` # Get rid of any spaces SKIP=`expr $SKIP` rm -f "$tmpfile" - echo Header is $SKIP lines long >&2 + echo Header is $SKIP lines long >&2 archname="$oldarchname" else - echo "Unable to open header file: $HEADER" >&2 - exit 1 + echo "Unable to open header file: $HEADER" >&2 + exit 1 fi echo if test "$APPEND" = n; then - if test -f "$archname"; then + if test -f "$archname"; then echo "WARNING: Overwriting existing file: $archname" >&2 - fi + fi fi USIZE=`du -ks $archdir | cut -f1` @@ -340,35 +340,35 @@ else fi if test "$APPEND" = y; then - mv "$archname" "$archname".bak || exit + mv "$archname" "$archname".bak || exit - # Prepare entry for new archive - filesizes="$filesizes $fsize" - CRCsum="$CRCsum $crcsum" - MD5sum="$MD5sum $md5sum" - USIZE=`expr $USIZE + $OLDUSIZE` - # Generate the header - . $HEADER - # Append the original data - tail -n +$OLDSKIP "$archname".bak >> "$archname" - # Append the new data - cat "$tmpfile" >> "$archname" + # Prepare entry for new archive + filesizes="$filesizes $fsize" + CRCsum="$CRCsum $crcsum" + MD5sum="$MD5sum $md5sum" + USIZE=`expr $USIZE + $OLDUSIZE` + # Generate the header + . $HEADER + # Append the original data + tail -n +$OLDSKIP "$archname".bak >> "$archname" + # Append the new data + cat "$tmpfile" >> "$archname" - chmod +x "$archname" - rm -f "$archname".bak - echo Self-extractible archive \"$archname\" successfully updated. + chmod +x "$archname" + rm -f "$archname".bak + echo Self-extractible archive \"$archname\" successfully updated. else - filesizes="$fsize" - CRCsum="$crcsum" - MD5sum="$md5sum" + filesizes="$fsize" + CRCsum="$crcsum" + MD5sum="$md5sum" - # Generate the header - . $HEADER + # Generate the header + . $HEADER - # Append the compressed tar data after the stub - echo - cat "$tmpfile" >> "$archname" - chmod +x "$archname" - echo Self-extractible archive \"$archname\" successfully created. + # Append the compressed tar data after the stub + echo + cat "$tmpfile" >> "$archname" + chmod +x "$archname" + echo Self-extractible archive \"$archname\" successfully created. fi rm -f "$tmpfile" diff --git a/neo/sys/linux/sound.cpp b/neo/sys/linux/sound.cpp index 7bfa2016..6ecd8bb4 100644 --- a/neo/sys/linux/sound.cpp +++ b/neo/sys/linux/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"). @@ -76,12 +76,12 @@ idAudioHardware::~idAudioHardware =============== */ idAudioHardware::~idAudioHardware() { } - + /* ================= idAudioHardwareOSS::~idAudioHardwareOSS -================= -*/ +================= +*/ idAudioHardwareOSS::~idAudioHardwareOSS() { Release(); } @@ -89,8 +89,8 @@ idAudioHardwareOSS::~idAudioHardwareOSS() { /* ================= idAudioHardwareOSS::Release -================= -*/ +================= +*/ void idAudioHardwareOSS::Release( bool bSilent ) { if (m_audio_fd) { if (!bSilent) { @@ -101,7 +101,7 @@ void idAudioHardwareOSS::Release( bool bSilent ) { m_buffer = NULL; m_buffer_size = 0; } - common->Printf("close sound device\n"); + common->Printf("close sound device\n"); if (close(m_audio_fd) == -1) { common->Warning( "failed to close sound device: %s", strerror(errno) ); } @@ -110,13 +110,13 @@ void idAudioHardwareOSS::Release( bool bSilent ) { common->Printf("--------------------------------\n"); } } -} +} /* ================= idAudioHardwareOSS::InitFailed -================= -*/ +================= +*/ void idAudioHardwareOSS::InitFailed() { Release( true ); cvarSystem->SetCVarBool( "s_noSound", true ); @@ -127,8 +127,8 @@ void idAudioHardwareOSS::InitFailed() { /* ================= idAudioHardwareOSS::ExtractOSSVersion -================= -*/ +================= +*/ void idAudioHardwareOSS::ExtractOSSVersion( int version, idStr &str ) const { sprintf( str, "%d.%d.%d", ( version & 0xFF0000 ) >> 16, ( version & 0xFF00 ) >> 8, version & 0xFF ); } @@ -142,7 +142,7 @@ though OSS API docs (1.1) advertise AFMT_S32_LE, AFMT_S16_LE is the only output BSD NOTE: With the GNU library, you can use free to free the blocks that memalign, posix_memalign, and valloc return. That does not work in BSD, however--BSD does not provide any way to free such blocks. -================= +================= */ idCVar s_device( "s_dsp", "/dev/dsp", CVAR_SYSTEM | CVAR_ARCHIVE, "" ); @@ -154,11 +154,11 @@ bool idAudioHardwareOSS::Initialize( ) { struct audio_buf_info info; memset( &info, 0, sizeof( info ) ); - + if (m_audio_fd) { Release(); } - + // open device ------------------------------------------------ if ((m_audio_fd = open( s_device.GetString(), O_WRONLY | O_NONBLOCK, 0)) == -1) { m_audio_fd = 0; @@ -179,9 +179,9 @@ bool idAudioHardwareOSS::Initialize( ) { InitFailed(); return false; } - + common->Printf("opened sound device '%s'\n", s_device.GetString()); - + // verify capabilities ----------------------------------------- // may only be available starting with OSS API v4.0 @@ -218,7 +218,7 @@ bool idAudioHardwareOSS::Initialize( ) { InitFailed(); return false; } - + // sample format ----------------------------------------------- requested_sample_format = AFMT_S16_LE; m_sample_format = requested_sample_format; @@ -232,7 +232,7 @@ bool idAudioHardwareOSS::Initialize( ) { InitFailed(); return false; } - + // channels ---------------------------------------------------- // sanity over number of speakers @@ -269,7 +269,7 @@ bool idAudioHardwareOSS::Initialize( ) { } } assert( (int)m_channels == idSoundSystemLocal::s_numberOfSpeakers.GetInteger() ); - + // sampling rate ------------------------------------------------ m_speed = PRIMARYFREQ; if ( ioctl( m_audio_fd, SNDCTL_DSP_SPEED, &m_speed ) == -1 ) { @@ -285,7 +285,7 @@ bool idAudioHardwareOSS::Initialize( ) { return false; } common->Printf("%s - bit rate: %d, channels: %d, frequency: %d\n", s_device.GetString(), m_sample_format, m_channels, m_speed); - + // output buffer ------------------------------------------------ // allocate a final buffer target, the sound engine locks, writes, and we write back to the device // we want m_buffer_size ( will have to rename those ) @@ -298,7 +298,7 @@ bool idAudioHardwareOSS::Initialize( ) { common->Printf( "allocated a mix buffer of %d bytes\n", m_buffer_size ); // toggle sound ------------------------------------------------- - + // toggle off before toggling on. that's what OSS source code samples recommends int flag = 0; if (ioctl(m_audio_fd, SNDCTL_DSP_SETTRIGGER, &flag) == -1) { @@ -337,7 +337,7 @@ bool idAudioHardwareOSS::Flush( void ) { ================= idAudioHardwareOSS::GetMixBufferSize ================= -*/ +*/ int idAudioHardwareOSS::GetMixBufferSize() { // return MIXBUFFER_SAMPLES * 2 * m_channels; return m_buffer_size; @@ -347,7 +347,7 @@ int idAudioHardwareOSS::GetMixBufferSize() { ================= idAudioHardwareOSS::GetMixBuffer ================= -*/ +*/ short* idAudioHardwareOSS::GetMixBuffer() { return (short *)m_buffer; } @@ -396,4 +396,3 @@ void idAudioHardwareOSS::Write( bool flushing ) { bool Sys_LoadOpenAL( void ) { return false; } - diff --git a/neo/sys/linux/sound.h b/neo/sys/linux/sound.h index a6320c87..f57dedd0 100644 --- a/neo/sys/linux/sound.h +++ b/neo/sys/linux/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"). @@ -38,17 +38,17 @@ class idAudioHardwareOSS : public idAudioHardware { unsigned int m_speed; void *m_buffer; int m_buffer_size; - + // counting the loops through the dma buffer int m_loops; - + // how many chunks we have left to write in cases where we need to split int m_writeChunks; // how many chunks we can write to the audio device without blocking int m_freeWriteChunks; - + public: - idAudioHardwareOSS() { + idAudioHardwareOSS() { m_audio_fd = 0; m_sample_format = 0; m_channels = 0; @@ -67,14 +67,14 @@ public: bool Lock( void **pDSLockedBuffer, ulong *dwDSLockedBufferSize ) { return false; } bool Unlock( void *pDSLockedBuffer, dword dwDSLockedBufferSize ) { return false; } bool GetCurrentPosition( ulong *pdwCurrentWriteCursor ) { return false; } - + bool Flush(); void Write( bool flushing ); int GetNumberOfSpeakers() { return m_channels; } int GetMixBufferSize(); short* GetMixBuffer(); - + private: void Release( bool bSilent = false ); void InitFailed(); @@ -125,7 +125,7 @@ private: int m_remainingFrames; void *m_handle; - + public: idAudioHardwareALSA() { m_pcm_handle = NULL; @@ -140,14 +140,14 @@ public: // dlopen the lib ( check minimum version ) bool DLOpen(); - bool Initialize( void ); + bool Initialize( void ); // Linux driver doesn't support memory map API bool Lock( void **pDSLockedBuffer, ulong *dwDSLockedBufferSize ) { return false; } bool Unlock( void *pDSLockedBuffer, dword dwDSLockedBufferSize ) { return false; } bool GetCurrentPosition( ulong *pdwCurrentWriteCursor ) { return false; } - + bool Flush(); void Write( bool flushing ); diff --git a/neo/sys/linux/sound_alsa.cpp b/neo/sys/linux/sound_alsa.cpp index 04d78d31..1d7c4110 100644 --- a/neo/sys/linux/sound_alsa.cpp +++ b/neo/sys/linux/sound_alsa.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 @@ idAudioHardwareALSA::DLOpen */ bool idAudioHardwareALSA::DLOpen( void ) { const char *version; - + if ( m_handle ) { return true; } @@ -57,7 +57,7 @@ bool idAudioHardwareALSA::DLOpen( void ) { common->Printf( "dlsym(\"snd_asoundlib_version\") failed: %s\n", dlerror() ); common->Warning( "please consider upgrading alsa to a more recent version." ); } else { - version = id_snd_asoundlib_version(); + version = id_snd_asoundlib_version(); common->Printf( "asoundlib version: %s\n", version ); } // dlsym the symbols @@ -105,8 +105,8 @@ void idAudioHardwareALSA::Release() { /* ================= idAudioHardwareALSA::InitFailed -================= -*/ +================= +*/ void idAudioHardwareALSA::InitFailed() { Release(); cvarSystem->SetCVarBool( "s_noSound", true ); @@ -121,7 +121,7 @@ idAudioHardwareALSA::Initialize */ bool idAudioHardwareALSA::Initialize( void ) { int err; - + common->Printf( "------ Alsa Sound Initialization -----\n" ); if ( !DLOpen() ) { InitFailed(); @@ -230,7 +230,7 @@ bool idAudioHardwareALSA::Initialize( void ) { snd_pcm_state_t curstate = id_snd_pcm_state( m_pcm_handle ); assert( curstate == SND_PCM_STATE_PREPARED ); #endif - + common->Printf( "--------------------------------------\n" ); return true; } @@ -250,7 +250,7 @@ idAudioHardwareALSA::~idAudioHardwareALSA() { ================= idAudioHardwareALSA::GetMixBufferSize ================= -*/ +*/ int idAudioHardwareALSA::GetMixBufferSize() { return m_buffer_size; } @@ -259,7 +259,7 @@ int idAudioHardwareALSA::GetMixBufferSize() { ================= idAudioHardwareALSA::GetMixBuffer ================= -*/ +*/ short* idAudioHardwareALSA::GetMixBuffer() { return (short *)m_buffer; } diff --git a/neo/sys/linux/stack.cpp b/neo/sys/linux/stack.cpp index b01e4c1c..a942ea2f 100644 --- a/neo/sys/linux/stack.cpp +++ b/neo/sys/linux/stack.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 @@ Sys_GetCallStack */ void Sys_GetCallStack( address_t *callStack, const int callStackSize ) { int i; - i = backtrace( (void **)callStack, callStackSize ); + i = backtrace( (void **)callStack, callStackSize ); while( i < callStackSize ) { callStack[i++] = 0; } @@ -101,14 +101,14 @@ const char * Sys_GetCallStackStr( const address_t *callStack, int callStackSize static char string[MAX_STRING_CHARS*2]; char **strings; int i; - + strings = backtrace_symbols( (void **)callStack, callStackSize ); string[ 0 ] = '\0'; for ( i = 0; i < callStackSize; i++ ) { idStr::snPrintf( string + strlen( string ), MAX_STRING_CHARS*2 - strlen( string ) - 1, "%s\n", strings[ i ] ); } free( strings ); - return string; + return string; } @@ -120,7 +120,7 @@ Sys_GetCallStackStr const char * Sys_GetCallStackCurStr( int depth ) { address_t array[ 32 ]; size_t size; - + size = backtrace( (void **)array, Min( 32, depth ) ); return Sys_GetCallStackStr( array, (int)size ); } diff --git a/neo/sys/linux/test_scheduler.c b/neo/sys/linux/test_scheduler.c index 8b9f1f16..f1e2b33b 100644 --- a/neo/sys/linux/test_scheduler.c +++ b/neo/sys/linux/test_scheduler.c @@ -2,7 +2,7 @@ =========================================================================== Doom 3 GPL Source Code -Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. +Copyright (C) 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,13 +37,13 @@ Sys_Milliseconds ================ */ /* base time in seconds, that's our origin - timeval:tv_sec is an int: + timeval:tv_sec is an int: assuming this wraps every 0x7fffffff - ~68 years since the Epoch (1970) - we're safe till 2038 using unsigned long data type to work right with Sys_XTimeToSysTime */ unsigned long sys_timeBase = 0; /* current time in ms, using sys_timeBase as origin NOTE: sys_timeBase*1000 + curtime -> ms since the Epoch - 0x7fffffff ms - ~24 days + 0x7fffffff ms - ~24 days or is it 48 days? the specs say int, but maybe it's casted from unsigned int? */ int Sys_Milliseconds(void) @@ -66,14 +66,14 @@ int Sys_Milliseconds(void) #define STAT_BUF 100 int main(int argc, void *argv[]) { - int start = 30; // start waiting with 30 ms + int start = 30; // start waiting with 30 ms int dec = 2; // decrement by 2 ms int min = 4; // min wait test int i, j, now, next; int stats[STAT_BUF]; struct sched_param parm; - + Sys_Milliseconds(); // init // set schedule policy to see if that affects usleep @@ -84,13 +84,13 @@ int main(int argc, void *argv[]) { } else { printf("sched_setscheduler SCHED_RR ok\n"); } - + // now run the test for( i = start ; i >= min ; i -= dec ) { printf( "sleep %d ms", i ); for( j = 0 ; j < STAT_BUF ; j++ ) { now = Sys_Milliseconds(); - usleep(i*1000); + usleep(i*1000); stats[j] = Sys_Milliseconds() - now; } for( j = 0; j < STAT_BUF; j++) { diff --git a/neo/sys/osx/DOOMController.mm b/neo/sys/osx/DOOMController.mm index b1e13fd1..30c71341 100644 --- a/neo/sys/osx/DOOMController.mm +++ b/neo/sys/osx/DOOMController.mm @@ -2,7 +2,7 @@ =========================================================================== Doom 3 GPL Source Code -Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. +Copyright (C) 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 @@ static idStr savepath; extern bool key_overstrikeMode; -#define TEST_FPU_EXCEPTIONS \ +#define TEST_FPU_EXCEPTIONS \ FPU_EXCEPTION_INVALID_OPERATION | \ FPU_EXCEPTION_DENORMALIZED_OPERAND | \ FPU_EXCEPTION_DIVIDE_BY_ZERO | \ @@ -68,7 +68,7 @@ static const ControlID kRegCode1EditText = { 'RegC', 1 }; struct RegCodeInfo { char prefRegCode1[256]; - bool okPressed; + bool okPressed; WindowRef window; ControlRef regCode1EditText; }; @@ -87,13 +87,13 @@ static OSErr DoRegCodeDialog( char* ioRegCode1 ); /* + (void)initialize; { - static bool initialized = NO; + static bool initialized = NO; - [super initialize]; - if ( initialized ) { - return; + [super initialize]; + if ( initialized ) { + return; } - initialized = YES; + initialized = YES; } */ @@ -101,23 +101,23 @@ static OSErr DoRegCodeDialog( char* ioRegCode1 ); - (void)applicationDidFinishLaunching:(NSNotification *)notification; { - NS_DURING { + NS_DURING { NSAssert(sizeof(bool) == 1, @"sizeof(bool) should equal 1 byte"); - [self quakeMain]; - } NS_HANDLER { - Sys_Error( (const char *)[ [ localException reason ] cString ] ); - } NS_ENDHANDLER; - Sys_Quit(); + [self quakeMain]; + } NS_HANDLER { + Sys_Error( (const char *)[ [ localException reason ] cString ] ); + } NS_ENDHANDLER; + Sys_Quit(); } - (void)applicationWillHide:(NSNotification *)notification; { - Sys_ShutdownInput(); + Sys_ShutdownInput(); } - (void)applicationWillUnhide:(NSNotification *)notification; { - Sys_InitInput(); + Sys_InitInput(); } - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender @@ -131,20 +131,20 @@ static OSErr DoRegCodeDialog( char* ioRegCode1 ); - (IBAction)paste:(id)sender; { - int shiftWasDown, insertWasDown; - unsigned int currentTime; + int shiftWasDown, insertWasDown; + unsigned int currentTime; - currentTime = Sys_Milliseconds(); - // Save the original keyboard state - shiftWasDown = keys[K_SHIFT].down; - insertWasDown = keys[K_INS].down; - // Fake a Shift-Insert keyboard event - keys[K_SHIFT].down = true; - Posix_QueEvent(currentTime, SE_KEY, K_INS, true, 0, NULL); - Posix_QueEvent(currentTime, SE_KEY, K_INS, false, 0, NULL); - // Restore the original keyboard state - keys[K_SHIFT].down = shiftWasDown; - keys[K_INS].down = insertWasDown; + currentTime = Sys_Milliseconds(); + // Save the original keyboard state + shiftWasDown = keys[K_SHIFT].down; + insertWasDown = keys[K_INS].down; + // Fake a Shift-Insert keyboard event + keys[K_SHIFT].down = true; + Posix_QueEvent(currentTime, SE_KEY, K_INS, true, 0, NULL); + Posix_QueEvent(currentTime, SE_KEY, K_INS, false, 0, NULL); + // Restore the original keyboard state + keys[K_SHIFT].down = shiftWasDown; + keys[K_INS].down = insertWasDown; } extern void CL_Quit_f(void); @@ -153,81 +153,81 @@ extern void CL_Quit_f(void); - (IBAction)requestTerminate:(id)sender; { - //osxQuit(); + //osxQuit(); common->Quit(); } - (void)showBanner; { - static bool hasShownBanner = NO; + static bool hasShownBanner = NO; - if (!hasShownBanner) { - //cvar_t *showBanner; + if (!hasShownBanner) { + //cvar_t *showBanner; - hasShownBanner = YES; - //showBanner = Cvar_Get("cl_showBanner", "1", 0); - //if ( showBanner->integer != 0 ) { + hasShownBanner = YES; + //showBanner = Cvar_Get("cl_showBanner", "1", 0); + //if ( showBanner->integer != 0 ) { if ( true ) { - NSPanel *splashPanel; - NSImage *bannerImage; - NSRect bannerRect; - NSImageView *bannerImageView; - - bannerImage = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:@"banner.jpg"]]; - bannerRect = NSMakeRect(0.0, 0.0, [bannerImage size].width, [bannerImage size].height); - - splashPanel = [[NSPanel alloc] initWithContentRect:bannerRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; - - bannerImageView = [[NSImageView alloc] initWithFrame:bannerRect]; - [bannerImageView setImage:bannerImage]; - [splashPanel setContentView:bannerImageView]; - [bannerImageView release]; - - [splashPanel center]; - [splashPanel setHasShadow:YES]; - [splashPanel orderFront: nil]; - [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:2.5]]; - [splashPanel close]; - - [bannerImage release]; - } - } + NSPanel *splashPanel; + NSImage *bannerImage; + NSRect bannerRect; + NSImageView *bannerImageView; + + bannerImage = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:@"banner.jpg"]]; + bannerRect = NSMakeRect(0.0, 0.0, [bannerImage size].width, [bannerImage size].height); + + splashPanel = [[NSPanel alloc] initWithContentRect:bannerRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; + + bannerImageView = [[NSImageView alloc] initWithFrame:bannerRect]; + [bannerImageView setImage:bannerImage]; + [splashPanel setContentView:bannerImageView]; + [bannerImageView release]; + + [splashPanel center]; + [splashPanel setHasShadow:YES]; + [splashPanel orderFront: nil]; + [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:2.5]]; + [splashPanel close]; + + [bannerImage release]; + } + } } // Services - (void)connectToServer:(NSPasteboard *)pasteboard userData:(NSString *)data error:(NSString **)error; { - NSArray *pasteboardTypes; + NSArray *pasteboardTypes; - pasteboardTypes = [pasteboard types]; - if ([pasteboardTypes containsObject:NSStringPboardType]) { - NSString *requestedServer; + pasteboardTypes = [pasteboard types]; + if ([pasteboardTypes containsObject:NSStringPboardType]) { + NSString *requestedServer; - requestedServer = [pasteboard stringForType:NSStringPboardType]; - if (requestedServer) { - Cbuf_AddText( va( "connect %s\n", [requestedServer cString])); - return; - } - } - *error = @"Unable to connect to server: could not find string on pasteboard"; + requestedServer = [pasteboard stringForType:NSStringPboardType]; + if (requestedServer) { + Cbuf_AddText( va( "connect %s\n", [requestedServer cString])); + return; + } + } + *error = @"Unable to connect to server: could not find string on pasteboard"; } - (void)performCommand:(NSPasteboard *)pasteboard userData:(NSString *)data error:(NSString **)error; { - NSArray *pasteboardTypes; + NSArray *pasteboardTypes; - pasteboardTypes = [pasteboard types]; - if ([pasteboardTypes containsObject:NSStringPboardType]) { - NSString *requestedCommand; + pasteboardTypes = [pasteboard types]; + if ([pasteboardTypes containsObject:NSStringPboardType]) { + NSString *requestedCommand; - requestedCommand = [pasteboard stringForType:NSStringPboardType]; - if (requestedCommand) { - Cbuf_AddText(va("%s\n", [requestedCommand cString])); - return; - } - } - *error = @"Unable to perform command: could not find string on pasteboard"; + requestedCommand = [pasteboard stringForType:NSStringPboardType]; + if (requestedCommand) { + Cbuf_AddText(va("%s\n", [requestedCommand cString])); + return; + } + } + *error = @"Unable to perform command: could not find string on pasteboard"; } #endif // commented out all the banners and actions @@ -238,82 +238,82 @@ extern void CL_Quit_f(void); - (void)quakeMain { - NSAutoreleasePool *pool; - int argc = 0; - const char *argv[MAX_ARGC]; - NSProcessInfo *processInfo; - NSArray *arguments; - unsigned int argumentIndex, argumentCount; - //const char *cddir; - //NSFileManager *defaultManager; - //bool tryAgain; + NSAutoreleasePool *pool; + int argc = 0; + const char *argv[MAX_ARGC]; + NSProcessInfo *processInfo; + NSArray *arguments; + unsigned int argumentIndex, argumentCount; + //const char *cddir; + //NSFileManager *defaultManager; + //bool tryAgain; - pool = [[NSAutoreleasePool alloc] init]; + pool = [[NSAutoreleasePool alloc] init]; - [NSApp setServicesProvider:self]; + [NSApp setServicesProvider:self]; - processInfo = [NSProcessInfo processInfo]; - arguments = [processInfo arguments]; - argumentCount = [arguments count]; - for (argumentIndex = 0; argumentIndex < argumentCount; argumentIndex++) { - argv[argc++] = strdup([[arguments objectAtIndex:argumentIndex] cString]); - } - if (![[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] resourcePath]]) { - Sys_Error("Could not access application resources"); - } - //cddir = macosx_scanForLibraryDirectory(); - /* - do { - tryAgain = NO; - defaultManager = [NSFileManager defaultManager]; - if (![defaultManager fileExistsAtPath:@"./base/default.cfg"] && (!cddir || *cddir == '\0' || ![defaultManager fileExistsAtPath:[NSString stringWithFormat:@"%s/baseq3/pak0.pk3", cddir]])) { - NSString *message; + processInfo = [NSProcessInfo processInfo]; + arguments = [processInfo arguments]; + argumentCount = [arguments count]; + for (argumentIndex = 0; argumentIndex < argumentCount; argumentIndex++) { + argv[argc++] = strdup([[arguments objectAtIndex:argumentIndex] cString]); + } + if (![[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] resourcePath]]) { + Sys_Error("Could not access application resources"); + } + //cddir = macosx_scanForLibraryDirectory(); + /* + do { + tryAgain = NO; + defaultManager = [NSFileManager defaultManager]; + if (![defaultManager fileExistsAtPath:@"./base/default.cfg"] && (!cddir || *cddir == '\0' || ![defaultManager fileExistsAtPath:[NSString stringWithFormat:@"%s/baseq3/pak0.pk3", cddir]])) { + NSString *message; - if (!cddir || *cddir == '\0') { - message = [NSString stringWithFormat:@"Could not find DOOM levels."]; - } else if (![defaultManager fileExistsAtPath:[NSString stringWithFormat:@"%s", cddir]]) { - message = [NSString stringWithFormat:@"Could not find DOOM levels: '%s' does not exist.", cddir]; - } else { - message = [NSString stringWithFormat:@"Could not find DOOM levels: '%s' is not a complete DOOM installation.", cddir]; - } - switch (NSRunAlertPanel(@"DOOM", @"%@", @"Quit", @"Find...", nil, message)) { - case NSAlertDefaultReturn: - default: - Sys_Quit(); - break; - case NSAlertAlternateReturn: - tryAgain = YES; - break; - } - if (tryAgain) { - NSOpenPanel *openPanel; - int result; + if (!cddir || *cddir == '\0') { + message = [NSString stringWithFormat:@"Could not find DOOM levels."]; + } else if (![defaultManager fileExistsAtPath:[NSString stringWithFormat:@"%s", cddir]]) { + message = [NSString stringWithFormat:@"Could not find DOOM levels: '%s' does not exist.", cddir]; + } else { + message = [NSString stringWithFormat:@"Could not find DOOM levels: '%s' is not a complete DOOM installation.", cddir]; + } + switch (NSRunAlertPanel(@"DOOM", @"%@", @"Quit", @"Find...", nil, message)) { + case NSAlertDefaultReturn: + default: + Sys_Quit(); + break; + case NSAlertAlternateReturn: + tryAgain = YES; + break; + } + if (tryAgain) { + NSOpenPanel *openPanel; + int result; - openPanel = [NSOpenPanel openPanel]; - [openPanel setAllowsMultipleSelection:NO]; - [openPanel setCanChooseDirectories:YES]; - [openPanel setCanChooseFiles:NO]; - result = [openPanel runModalForDirectory:nil file:nil]; - if (result == NSOKButton) { - NSArray *filenames; + openPanel = [NSOpenPanel openPanel]; + [openPanel setAllowsMultipleSelection:NO]; + [openPanel setCanChooseDirectories:YES]; + [openPanel setCanChooseFiles:NO]; + result = [openPanel runModalForDirectory:nil file:nil]; + if (result == NSOKButton) { + NSArray *filenames; - filenames = [openPanel filenames]; - if ([filenames count] == 1) { - NSString *cdPath; + filenames = [openPanel filenames]; + if ([filenames count] == 1) { + NSString *cdPath; - cdPath = [filenames objectAtIndex:0]; - [[NSUserDefaults standardUserDefaults] setObject:cdPath forKey:@"CDPath"]; - cddir = strdup([cdPath cString]); - } - } - } - } - } while (tryAgain); - */ + cdPath = [filenames objectAtIndex:0]; + [[NSUserDefaults standardUserDefaults] setObject:cdPath forKey:@"CDPath"]; + cddir = strdup([cdPath cString]); + } + } + } + } + } while (tryAgain); + */ /* - if (cddir && *cddir != '\0') { - SetProgramPath([[[NSString stringWithCString:cddir] stringByAppendingPathComponent:@"/x"] cString]); - } + if (cddir && *cddir != '\0') { + SetProgramPath([[[NSString stringWithCString:cddir] stringByAppendingPathComponent:@"/x"] cString]); + } */ //Sys_FPU_EnableExceptions( TEST_FPU_EXCEPTIONS ); @@ -324,12 +324,12 @@ extern void CL_Quit_f(void); if ( [self checkOS] == FALSE) { common->Quit(); } - + if ( [self checkDVD] == FALSE) { common->Quit(); } #endif - + // need strncmp, can't use idlib before init #undef strncmp // Finder passes the process serial number as only argument after the program path @@ -342,12 +342,12 @@ extern void CL_Quit_f(void); Posix_LateInit( ); - [NSApp activateIgnoringOtherApps:YES]; + [NSApp activateIgnoringOtherApps:YES]; - while (1) { + while (1) { #ifdef OMNI_TIMER - OTPeriodicTimerReset(); - OTNodeStart(RootNode); + OTPeriodicTimerReset(); + OTNodeStart(RootNode); #endif // maintain exceptions in case system calls are turning them off (is that needed) @@ -355,15 +355,15 @@ extern void CL_Quit_f(void); common->Frame(); - // We should think about doing this less frequently than every frame - [pool release]; - pool = [[NSAutoreleasePool alloc] init]; + // We should think about doing this less frequently than every frame + [pool release]; + pool = [[NSAutoreleasePool alloc] init]; #ifdef OMNI_TIMER - OTNodeStop(RootNode); + OTNodeStop(RootNode); #endif - } + } - [pool release]; + [pool release]; } - (BOOL)checkRegCodes @@ -371,10 +371,10 @@ extern void CL_Quit_f(void); BOOL retval; NSString *cdKey; NSUserDefaults *userDefaults; - + userDefaults = [NSUserDefaults standardUserDefaults]; cdKey = [userDefaults stringForKey:kRegKey]; - + retval = TRUE; if ( cdKey == nil || [cdKey length] == 0 ) { char regCode[256]; @@ -501,7 +501,7 @@ http://developer.apple.com/documentation/Performance/Conceptual/Mac_OSX_Numerics */ #define fegetenvd(x) asm volatile( "mffs %0" : "=f" (x) ); -#define fesetenvd(x) asm volatile( "mtfsf 255,%0" : : "f" (x) ); +#define fesetenvd(x) asm volatile( "mtfsf 255,%0" : : "f" (x) ); enum { FE_ENABLE_INEXACT = 0x8, FE_ENABLE_DIVBYZERO = 0x10, @@ -655,11 +655,11 @@ Sys_ClockTicksPerSecond */ double Sys_ClockTicksPerSecond(void) { // Our strategy is to query both Gestalt & IOKit and then take the larger of the two values. - + long gestaltSpeed, ioKitSpeed = -1; - + // GESTALT - + // gestaltProcClkSpeedMHz available in 10.3 needs to be used because CPU speeds have now // exceeded the signed long that Gestalt returns. long osVers; @@ -671,30 +671,30 @@ double Sys_ClockTicksPerSecond(void) { { err = Gestalt(gestaltProcClkSpeed, &gestaltSpeed); if (err == noErr) - gestaltSpeed = gestaltSpeed / 1000000; - } - + gestaltSpeed = gestaltSpeed / 1000000; + } + // IO KIT - - mach_port_t masterPort; + + mach_port_t masterPort; CFMutableDictionaryRef matchDict = nil; io_iterator_t itThis; io_service_t service = nil; - - if (IOMasterPort(MACH_PORT_NULL, &masterPort)) + + if (IOMasterPort(MACH_PORT_NULL, &masterPort)) goto bail; - - matchDict = IOServiceNameMatching("cpus"); + + matchDict = IOServiceNameMatching("cpus"); if (IOServiceGetMatchingServices(masterPort, matchDict, &itThis)) goto bail; - + service = IOIteratorNext(itThis); - while(service) - { + while(service) + { io_service_t ioCpu = NULL; if (IORegistryEntryGetChildEntry(service, kIODeviceTreePlane, &ioCpu)) goto bail; - + if (ioCpu) { CFDataRef data = (CFDataRef)IORegistryEntryCreateCFProperty(ioCpu, CFSTR("clock-frequency"),kCFAllocatorDefault,0); @@ -703,9 +703,9 @@ double Sys_ClockTicksPerSecond(void) { } service = IOIteratorNext(itThis); } - + // Return the larger value - + bail: return ( ioKitSpeed > gestaltSpeed ? ioKitSpeed : gestaltSpeed ) * 1000000.f; } @@ -718,7 +718,7 @@ returns in megabytes */ int Sys_GetSystemRam( void ) { long ramSize; - + if ( Gestalt( gestaltPhysicalRAMSize, &ramSize ) == noErr ) { return ramSize / (1024*1024); } @@ -742,7 +742,7 @@ int Sys_GetVideoRam( void ) { CGDirectDisplayID displays[MAXDISPLAYS]; CGGetOnlineDisplayList( MAXDISPLAYS, displays, &displayCount ); - + for ( i = 0; i < displayCount; i++ ) { if ( Sys_DisplayToUse() == displays[i] ) { dspPorts[i] = CGDisplayIOServicePort(displays[i]); @@ -761,7 +761,7 @@ bool OSX_GetCPUIdentification( int& cpuId, bool& oldArchitecture ) { long cpu; Gestalt(gestaltNativeCPUtype, &cpu); - + cpuId = cpu; oldArchitecture = cpuId < gestaltCPU970; return true; @@ -769,57 +769,57 @@ bool OSX_GetCPUIdentification( int& cpuId, bool& oldArchitecture ) void OSX_GetVideoCard( int& outVendorId, int& outDeviceId ) { - kern_return_t err; - mach_port_t masterPort; - io_iterator_t itThis; - io_service_t service; - + kern_return_t err; + mach_port_t masterPort; + io_iterator_t itThis; + io_service_t service; + outVendorId = -1; outDeviceId = -1; - + // Get a mach port for us and check for errors - err = IOMasterPort(MACH_PORT_NULL, &masterPort); - if(err) + err = IOMasterPort(MACH_PORT_NULL, &masterPort); + if(err) return; - // Grab all the PCI devices out of the registry - err = IOServiceGetMatchingServices(masterPort, IOServiceMatching("IOPCIDevice"), &itThis); - if(err) + // Grab all the PCI devices out of the registry + err = IOServiceGetMatchingServices(masterPort, IOServiceMatching("IOPCIDevice"), &itThis); + if(err) return; - - // Yank everything out of the iterator + + // Yank everything out of the iterator // We could walk through all devices and try to determine the best card. But for now, // we'll just look at the first card. - while(1) - { + while(1) + { service = IOIteratorNext(itThis); io_name_t dName; - + // Make sure we have a valid service if(service) { // Get the classcode so we know what we're looking at CFDataRef classCode = (CFDataRef)IORegistryEntryCreateCFProperty(service,CFSTR("class-code"),kCFAllocatorDefault,0); - // Only accept devices that are + // Only accept devices that are // PCI Spec - 0x00030000 is a display device if((*(UInt32*)CFDataGetBytePtr(classCode) & 0x00ff0000) == 0x00030000) { // Get the name of the service (hw) IORegistryEntryGetName(service, dName); - + CFDataRef vendorID, deviceID; - + // Get the information for the device we've selected from the list vendorID = (CFDataRef)IORegistryEntryCreateCFProperty(service, CFSTR("vendor-id"),kCFAllocatorDefault,0); deviceID = (CFDataRef)IORegistryEntryCreateCFProperty(service, CFSTR("device-id"),kCFAllocatorDefault,0); - + outVendorId = *((long*)CFDataGetBytePtr(vendorID)); outDeviceId = *((long*)CFDataGetBytePtr(deviceID)); - + CFRelease(vendorID); CFRelease(deviceID); } CFRelease(classCode); - + // Stop after finding the first device if (outVendorId != -1) break; @@ -843,7 +843,7 @@ int main( int argc, const char *argv[] ) { bool FormatRegCode(const char* inRegCode, char* outRegCode) -{ +{ // Clean up the reg code. Remove spaces. Accept only numbers/letters. char* dst = outRegCode; const char* src = inRegCode; @@ -856,7 +856,7 @@ bool FormatRegCode(const char* inRegCode, char* outRegCode) src++; } *dst = 0; - + // Reg codes are 18 characters in length return strlen(outRegCode) == 18; } @@ -872,13 +872,13 @@ static pascal OSStatus RegCodeHandler( EventHandlerCallRef inHandler, EventRef i #if 1 // FIXME: the CD key API has changed for startup check support and expansion pack key support return noErr; -#else +#else HICommand cmd; OSStatus result = eventNotHandledErr; RegCodeInfo* regCodeInfo = (RegCodeInfo*)inUserData; - + GetEventParameter( inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof( cmd ), NULL, &cmd ); - + switch ( cmd.commandID ) { case kHICommandOK: bool fValid; @@ -886,7 +886,7 @@ static pascal OSStatus RegCodeHandler( EventHandlerCallRef inHandler, EventRef i char cntrl[256]; char doomKey[256]; char strippedKey[256]; - + fValid = false; strippedKey[0] = doomKey[0] = NULL; GetControlData ( regCodeInfo->regCode1EditText, kControlEntireControl, kControlEditTextTextTag, 256, cntrl, &actualSize ); @@ -902,36 +902,36 @@ static pascal OSStatus RegCodeHandler( EventHandlerCallRef inHandler, EventRef i session->SetCDKey( doomKey ); } else { - unsigned char theError[512]; + unsigned char theError[512]; unsigned char theExplanation[512]; CFStringRef theErrorStr = CFCopyLocalizedString( CFSTR("DVD_KEY_ERROR"), "" ); CFStringRef theExplanationStr = CFCopyLocalizedString( CFSTR("DVD_KEY_EXPLANATION"), "" ); c2pstrcpy( theError, CFStringGetCStringPtr( theErrorStr, kCFStringEncodingMacRoman ) ); c2pstrcpy( theExplanation, CFStringGetCStringPtr( theExplanationStr, kCFStringEncodingMacRoman ) ); - + StandardAlert(kAlertStopAlert, theError, theExplanation, NULL, NULL); - + // Highlight the invalid reg code ClearKeyboardFocus(regCodeInfo->window); SetKeyboardFocus( regCodeInfo->window, regCodeInfo->regCode1EditText, kControlEditTextPart ); ControlEditTextSelectionRec sel = {0, 32000}; SetControlData (regCodeInfo->regCode1EditText, kControlEntireControl, kControlEditTextSelectionTag, sizeof(sel), &sel); - break; + break; } - + regCodeInfo->okPressed = true; QuitAppModalLoopForWindow( regCodeInfo->window ); result = noErr; - + break; - + case kHICommandCancel: regCodeInfo->okPressed = false; QuitAppModalLoopForWindow( regCodeInfo->window ); result = noErr; break; - - } + + } return result; #endif } @@ -946,36 +946,36 @@ static OSErr DoRegCodeDialog( char* ioRegCode1 ) OSErr err; RegCodeInfo regCodeInfo; memset(®CodeInfo, 0, sizeof(regCodeInfo)); - + IBNibRef aslNib; CFBundleRef theBundle = CFBundleGetMainBundle(); err = CreateNibReferenceWithCFBundle( theBundle, CFSTR("ASLCore"), &aslNib ); err = ::CreateWindowFromNib( aslNib, CFSTR("Reg Code Sheet"), ®CodeInfo.window ); if (err != noErr) return err; - + GetControlByID( regCodeInfo.window, &kRegCode1EditText, ®CodeInfo.regCode1EditText ); assert( regCodeInfo.regCode1EditText ); SetKeyboardFocus( regCodeInfo.window, regCodeInfo.regCode1EditText, kControlEditTextPart ); ControlEditTextSelectionRec sel = {0, 32000}; SetControlData (regCodeInfo.regCode1EditText, kControlEntireControl, kControlEditTextSelectionTag, sizeof(sel), &sel); - + EventTypeSpec cmdEvent = { kEventClassCommand, kEventCommandProcess }; EventHandlerUPP handler = NewEventHandlerUPP( RegCodeHandler ); InstallWindowEventHandler( regCodeInfo.window, handler, 1, &cmdEvent, ®CodeInfo, NULL ); - + RepositionWindow( regCodeInfo.window, NULL, kWindowAlertPositionOnMainScreen ); ShowWindow( regCodeInfo.window ); - + RunAppModalLoopForWindow( regCodeInfo.window ); - + DisposeWindow( regCodeInfo.window ); - - if (regCodeInfo.okPressed) { + + if (regCodeInfo.okPressed) { strcpy(ioRegCode1, regCodeInfo.prefRegCode1); } - - return regCodeInfo.okPressed ? (OSErr)noErr : (OSErr)userCanceledErr; + + return regCodeInfo.okPressed ? (OSErr)noErr : (OSErr)userCanceledErr; } /* @@ -1024,9 +1024,9 @@ void Sys_FPU_SetFTZ( bool enable ) { void Sys_FPU_SetDAZ( bool enable ) { uint32_t dwData; uint32_t enable_l = (uint32_t) enable; - + enable_l = enable_l & 1; - enable_l = enable_l << 6; + enable_l = enable_l << 6; dwData = _mm_getcsr(); // store MXCSR to dwData dwData = dwData & 0xffbf; dwData = dwData | enable_l; @@ -1039,12 +1039,12 @@ void Sys_FPU_SetDAZ( bool enable ) { ================ */ void Sys_FPU_SetFTZ( bool enable ) { - + uint32_t dwData; uint32_t enable_l = (uint32_t) enable; - + enable_l = enable_l & 1; - enable_l = enable_l << 15; + enable_l = enable_l << 15; dwData = _mm_getcsr(); // store MXCSR to dwData dwData = dwData & 0x7fff; dwData = dwData | enable_l; diff --git a/neo/sys/osx/PickMonitor.cpp b/neo/sys/osx/PickMonitor.cpp index 9eb7457a..e2fa8da0 100644 --- a/neo/sys/osx/PickMonitor.cpp +++ b/neo/sys/osx/PickMonitor.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,11 +80,11 @@ static RGBColor rgbGray = { 0x5252, 0x8A8A, 0xCCCC }; // this is the blue used //----------------------------------------------------------------------------- // SetupUserPaneProcs //----------------------------------------------------------------------------- -// Call this to initialize the specified user pane control before displaying +// Call this to initialize the specified user pane control before displaying // the dialog window. Pass NULL for any user pane procs you don't need to install. OSErr SetupUserPaneProcs( ControlRef inUserPane, - ControlUserPaneDrawProcPtr inDrawProc, + ControlUserPaneDrawProcPtr inDrawProc, ControlUserPaneHitTestProcPtr inHitTestProc, ControlUserPaneTrackingProcPtr inTrackingProc) { @@ -92,9 +92,9 @@ OSErr SetupUserPaneProcs( ControlRef inUserPane, ControlUserPaneDrawUPP drawUPP; ControlUserPaneHitTestUPP hitTestUPP; ControlUserPaneTrackingUPP trackingUPP; - + if (0 == inUserPane) return paramErr; - + if (inDrawProc && noErr == err) { drawUPP = NewControlUserPaneDrawUPP(inDrawProc); @@ -116,7 +116,7 @@ OSErr SetupUserPaneProcs( ControlRef inUserPane, err = memFullErr; else err = SetControlData( inUserPane, - kControlEntireControl, + kControlEntireControl, kControlUserPaneHitTestProcTag, sizeof(ControlUserPaneHitTestUPP), (Ptr)&hitTestUPP); @@ -124,17 +124,17 @@ OSErr SetupUserPaneProcs( ControlRef inUserPane, if (inTrackingProc && noErr == err) { trackingUPP = NewControlUserPaneTrackingUPP(inTrackingProc); - + if (0 == trackingUPP) err = memFullErr; else err = SetControlData( inUserPane, - kControlEntireControl, + kControlEntireControl, kControlUserPaneTrackingProcTag, sizeof(ControlUserPaneTrackingUPP), (Ptr)&trackingUPP); } - + return err; } @@ -142,16 +142,16 @@ OSErr SetupUserPaneProcs( ControlRef inUserPane, //----------------------------------------------------------------------------- // DisposeUserPaneProcs //----------------------------------------------------------------------------- -// Call this to clean up when you're done with the specified user pane control. +// Call this to clean up when you're done with the specified user pane control. OSErr DisposeUserPaneProcs(ControlRef inUserPane) -{ +{ ControlUserPaneDrawUPP drawUPP; ControlUserPaneHitTestUPP hitTestUPP; ControlUserPaneTrackingUPP trackingUPP; Size actualSize; OSErr err; - + err = GetControlData(inUserPane, kControlEntireControl, kControlUserPaneDrawProcTag, sizeof(ControlUserPaneDrawUPP), (Ptr)&drawUPP, &actualSize); if (err == noErr) DisposeControlUserPaneDrawUPP(drawUPP); @@ -174,20 +174,20 @@ OSErr DisposeUserPaneProcs(ControlRef inUserPane) static pascal void drawProc(ControlRef inControl, SInt16 inPart) { #pragma unused(inControl, inPart) - + int i; RGBColor saveForeColor; RGBColor saveBackColor; PenState savePenState; - GetForeColor(&saveForeColor); - GetBackColor(&saveBackColor); + GetForeColor(&saveForeColor); + GetBackColor(&saveBackColor); GetPenState(&savePenState); RGBForeColor(&rgbBlack); RGBBackColor(&rgbWhite); PenNormal(); - + for (i = 0; i < sNumMonitors; i++) { RGBForeColor(&rgbGray); @@ -217,10 +217,10 @@ static pascal void drawProc(ControlRef inControl, SInt16 inPart) FrameRect(&sMonitors[i].scaledRect); } } - + // restore the original pen state and colors - RGBForeColor(&saveForeColor); - RGBBackColor(&saveBackColor); + RGBForeColor(&saveForeColor); + RGBBackColor(&saveBackColor); SetPenState(&savePenState); } @@ -266,7 +266,7 @@ static pascal ControlPartCode trackingProc ( break; } } - + return kControlNoPart; } @@ -286,7 +286,7 @@ OSErr SetupPickMonitorPane(ControlRef inPane, DisplayIDType inDefaultMonitor) { GDHandle dev = GetDeviceList(); OSErr err = noErr; - + // make the default monitor the selected device if (inDefaultMonitor) DMGetGDeviceByDisplayID(inDefaultMonitor, &sSelectedDevice, true); @@ -314,20 +314,20 @@ OSErr SetupPickMonitorPane(ControlRef inPane, DisplayIDType inDefaultMonitor) Rect origGrayRect, grayRect, scaledGrayRect; float srcAspect, dstAspect, scale; int i; - + GetControlBounds(inPane, &origPaneRect); paneRect = origPaneRect; OffsetRect(&paneRect, -paneRect.left, -paneRect.top); - + GetRegionBounds(GetGrayRgn(), &origGrayRect); grayRect = origGrayRect; OffsetRect(&grayRect, -grayRect.left, -grayRect.top); - + srcAspect = (float)grayRect.right / (float)grayRect.bottom; dstAspect = (float)paneRect.right / (float)paneRect.bottom; - + scaledGrayRect = paneRect; - + if (srcAspect < dstAspect) { scaledGrayRect.right = (float)paneRect.bottom * srcAspect; @@ -338,24 +338,24 @@ OSErr SetupPickMonitorPane(ControlRef inPane, DisplayIDType inDefaultMonitor) scaledGrayRect.bottom = (float)paneRect.right / srcAspect; scale = (float)scaledGrayRect.bottom / grayRect.bottom; } - + for (i = 0; i < sNumMonitors; i++) { Rect r = sMonitors[i].origRect; Rect r2 = r; - + // normalize rect and scale OffsetRect(&r, -r.left, -r.top); r.bottom = (float)r.bottom * scale; r.right = (float)r.right * scale; - + // offset rect wrt gray region - OffsetRect(&r, (float)(r2.left - origGrayRect.left) * scale, + OffsetRect(&r, (float)(r2.left - origGrayRect.left) * scale, (float)(r2.top - origGrayRect.top) * scale); sMonitors[i].scaledRect = r; } - + // center scaledGrayRect in the pane OffsetRect(&scaledGrayRect, (paneRect.right - scaledGrayRect.right) / 2, (paneRect.bottom - scaledGrayRect.bottom) / 2); @@ -366,7 +366,7 @@ OSErr SetupPickMonitorPane(ControlRef inPane, DisplayIDType inDefaultMonitor) } else return paramErr; - + // setup the procs for the pick monitor user pane err = SetupUserPaneProcs(inPane, drawProc, hitTestProc, trackingProc); return err; @@ -397,7 +397,7 @@ OSErr TearDownPickMonitorPane(ControlRef inPane) static pascal OSStatus PickMonitorHandler( EventHandlerCallRef inHandler, EventRef inEvent, void* inUserData ) { #pragma unused( inHandler ) - + HICommand cmd; OSStatus result = eventNotHandledErr; WindowRef theWindow = (WindowRef)inUserData; @@ -409,19 +409,19 @@ static pascal OSStatus PickMonitorHandler( EventHandlerCallRef inHandler, EventR switch ( cmd.commandID ) { - case kHICommandOK: + case kHICommandOK: QuitAppModalLoopForWindow( theWindow ); result = noErr; break; - - case kHICommandCancel: + + case kHICommandCancel: // Setting sSelectedDevice to zero will signal that the user cancelled. sSelectedDevice = 0; QuitAppModalLoopForWindow( theWindow ); result = noErr; break; - } + } return result; } @@ -438,7 +438,7 @@ Boolean CanUserPickMonitor (void) GDHandle dev = GetDeviceList(); OSErr err = noErr; int numMonitors; - + // build the list of monitors numMonitors = 0; while (dev && numMonitors < kMaxMonitors) @@ -463,8 +463,8 @@ OSStatus PickMonitor (DisplayIDType *inOutDisplayID, WindowRef parentWindow) { WindowRef theWindow; OSStatus status = noErr; - static const ControlID kUserPane = { 'MONI', 1 }; - + static const ControlID kUserPane = { 'MONI', 1 }; + // Fetch the dialog IBNibRef aslNib; @@ -485,7 +485,7 @@ OSStatus PickMonitor (DisplayIDType *inOutDisplayID, WindowRef parentWindow) FormatPStringWithGameName(windowTitle); SetWTitle(theWindow, windowTitle); #endif - + // Set up the controls ControlRef monitorPane; @@ -499,7 +499,7 @@ OSStatus PickMonitor (DisplayIDType *inOutDisplayID, WindowRef parentWindow) EventTypeSpec cmdEvent = { kEventClassCommand, kEventCommandProcess }; EventHandlerUPP handler = NewEventHandlerUPP( PickMonitorHandler ); InstallWindowEventHandler( theWindow, handler, 1, &cmdEvent, theWindow, NULL ); - + // Show the window if (parentWindow) diff --git a/neo/sys/osx/PickMonitor.h b/neo/sys/osx/PickMonitor.h index 1731b0b8..2a19219c 100644 --- a/neo/sys/osx/PickMonitor.h +++ b/neo/sys/osx/PickMonitor.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/neo/sys/osx/PreferencesDialog.cpp b/neo/sys/osx/PreferencesDialog.cpp index 77f3ce72..5a9b431d 100644 --- a/neo/sys/osx/PreferencesDialog.cpp +++ b/neo/sys/osx/PreferencesDialog.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"). @@ -39,11 +39,11 @@ static idCVar r_stretched( "r_stretched", "0", CVAR_ARCHIVE | CVAR_BOOL, "Used s #define kPref_PrefsDialogOpenAL CFSTR("UseOpenAL") #ifndef kAppCreator -#define kAppCreator 'DOM3' // Creator type +#define kAppCreator 'DOM3' // Creator type #endif -const UInt32 kRes_Stretched = (1 << 0); // set if the resolution is a stretched mode (kCGDisplayModeIsStretched) -const UInt32 kRes_Safe = (1 << 1); // ¥¥¥Ê(currently unused) set if the resolution is safe (kCGDisplayModeIsSafeForHardware) +const UInt32 kRes_Stretched = (1 << 0); // set if the resolution is a stretched mode (kCGDisplayModeIsStretched) +const UInt32 kRes_Safe = (1 << 1); // ¥¥¥Ê(currently unused) set if the resolution is safe (kCGDisplayModeIsSafeForHardware) // Data to be presented and edited in the prefs dialog struct PrefInfo @@ -58,9 +58,9 @@ struct PrefInfo UInt32 prefResFlags; Boolean prefAlways; Boolean prefOpenAL; - + bool okPressed; // Set to true if the user pressed the OK button - + // The following are private data passed from GameDisplayPreferencesDialog() to it's command handler. WindowRef window; ControlRef fullscreenBtn; @@ -70,9 +70,9 @@ struct PrefInfo ControlRef chooseMonitorsBtn; ControlRef alwaysBtn; ControlRef openALBtn; - + ValidModeCallbackProc callback; // To validate display modes - + bool multiMonitor; // Does user have multiple monitors std::list refreshRates; // List of refresh rates available for the selected monitor SInt32 freqMenuIndex; @@ -106,7 +106,7 @@ static CGDirectDisplayID GetDisplayIDForScreenIndex( int inScreenIndex ) { OSErr err; int r_screen = -1; CGDisplayCount count; - + err = CGGetActiveDisplayList(0, NULL, &count); if (noErr == err) { CGDirectDisplayID displays[count]; @@ -119,10 +119,10 @@ static CGDirectDisplayID GetDisplayIDForScreenIndex( int inScreenIndex ) { return (CGDirectDisplayID)r_screen; } - + void Sys_DoPreferences( void ) { - + // An NSKeyDown event is not fired if the user holds down Cmd during startup. // Cmd is treated purely as a modifier. To capture the user // holding down Cmd, you would need to override NSApplication's @@ -132,16 +132,16 @@ void Sys_DoPreferences( void ) { const int kMacKeyCodeCommand = 0x37; KeyMap *keymap = (KeyMap*)&km; GetKeys(*keymap); - + Boolean prefAways, keyFound, useOpenAL; prefAways = CFPreferencesGetAppBooleanValue ( kPref_PrefsDialogAlways, kCFPreferencesCurrentApplication, &keyFound ); bool fAlways = prefAways && keyFound; - + if ( fAlways || ( km[kMacKeyCodeCommand>>3] >> ( kMacKeyCodeCommand & 7 ) ) & 1 ) { GameDisplayInfo info; info.mode = cvarSystem->GetCVarBool( "r_fullscreen" ) ? kFullScreen : kWindow; info.displayID = GetDisplayIDForScreenIndex( cvarSystem->GetCVarInteger( "r_screen" ) ); - + int w = 800, h = 600; R_GetModeInfo( &w, &h, cvarSystem->GetCVarInteger( "r_mode" ) ); info.width = w; @@ -154,7 +154,7 @@ void Sys_DoPreferences( void ) { info.resFlags = 0; if ( r_stretched.GetBool() ) info.resFlags |= kRes_Stretched; - + WindowRef prefWindow; if ( CreateGameDisplayPreferencesDialog( &info, &prefWindow ) == noErr ) { if ( RunGameDisplayPreferencesDialog( &info, prefWindow ) == noErr ) { @@ -180,14 +180,14 @@ void Sys_DoPreferences( void ) { cvarSystem->SetCVarInteger( "r_aspectRatio", 2 ); // 16:10 else cvarSystem->SetCVarInteger( "r_aspectRatio", 0 ); // 4:3 - + r_stretched.SetBool( info.resFlags & kRes_Stretched ); cvarSystem->SetCVarInteger( "r_screen", GetScreenIndexForDisplayID( info.displayID ) ); cvarSystem->SetCVarInteger( "r_minDisplayRefresh", (int)FixedToFloat( info.frequency ) ); cvarSystem->SetCVarInteger( "r_maxDisplayRefresh", (int)FixedToFloat( info.frequency ) ); } else { - Sys_Quit(); + Sys_Quit(); } } } @@ -220,13 +220,13 @@ enum }; // Control IDs used in the NIB file -static const ControlID kFullscreenBtn = { 'PREF', 1 }; -static const ControlID kInAWindowBtn = { 'PREF', 2 }; -static const ControlID kResolutionPopup = { 'PREF', 3 }; -static const ControlID kRefreshRatePopup = { 'PREF', 4 }; -static const ControlID kChooseMonitorsBtn = { 'PREF', 5 }; -static const ControlID kAlwaysBtn = { 'PREF', 6 }; -static const ControlID kOpenALBtn = { 'PREF', 7 }; +static const ControlID kFullscreenBtn = { 'PREF', 1 }; +static const ControlID kInAWindowBtn = { 'PREF', 2 }; +static const ControlID kResolutionPopup = { 'PREF', 3 }; +static const ControlID kRefreshRatePopup = { 'PREF', 4 }; +static const ControlID kChooseMonitorsBtn = { 'PREF', 5 }; +static const ControlID kAlwaysBtn = { 'PREF', 6 }; +static const ControlID kOpenALBtn = { 'PREF', 7 }; struct Res { @@ -270,7 +270,7 @@ static bool ValidDisplayID (CGDirectDisplayID inDisplayID) unsigned int i; CGDisplayErr err; CGDisplayCount count; - + err = CGGetActiveDisplayList(0, NULL, &count); if (noErr == err) { @@ -290,7 +290,7 @@ static int BuildResolutionList(CGDirectDisplayID inDisplayID, Res *ioList, Valid { std::set modes; int i, total = 0; - + if (inDisplayID == (CGDirectDisplayID)-1) // special case, not associated with any display { Res stdModes[] = { { 640, 480 }, { 800, 600 }, { 1024, 768 }, { 1152, 768 }, @@ -303,59 +303,59 @@ static int BuildResolutionList(CGDirectDisplayID inDisplayID, Res *ioList, Valid } } else - { + { CGDirectDisplayID displayID = inDisplayID ? inDisplayID : kCGDirectMainDisplay; CFArrayRef modeArrayRef = CGDisplayAvailableModes(displayID); CFIndex numModes = CFArrayGetCount(modeArrayRef); - + for (i = 0; i < numModes; i++) { CFDictionaryRef modeRef = (CFDictionaryRef)CFArrayGetValueAtIndex(modeArrayRef, i); - + long value = 0; CFNumberRef valueRef; Boolean success; - + valueRef = (CFNumberRef)CFDictionaryGetValue(modeRef, kCGDisplayBitsPerPixel); success = CFNumberGetValue(valueRef, kCFNumberLongType, &value); int depth = value; if (depth != 32) continue; - + valueRef = (CFNumberRef)CFDictionaryGetValue(modeRef, kCGDisplayWidth); success = CFNumberGetValue(valueRef, kCFNumberLongType, &value); int width = value; - + valueRef = (CFNumberRef)CFDictionaryGetValue(modeRef, kCGDisplayHeight); success = CFNumberGetValue(valueRef, kCFNumberLongType, &value); int height = value; - + UInt32 resFlags = 0; CFBooleanRef boolRef; if (CFDictionaryGetValueIfPresent (modeRef, kCGDisplayModeIsStretched, (const void **)&boolRef)) if (CFBooleanGetValue (boolRef)) resFlags |= kRes_Stretched; - - + + if (inCallback) success = inCallback(displayID, width, height, depth, 0); else success = true; - + if (success) modes.insert(MakeRes(width, height, depth, resFlags)); } } - + total = modes.size(); - + if (ioList) { std::set::iterator it = modes.begin(); for (i = 0; it != modes.end(); i++) ioList[i] = *it++; } - - return total; + + return total; } @@ -364,33 +364,33 @@ static int BuildResolutionList(CGDirectDisplayID inDisplayID, Res *ioList, Valid static void BuildRefreshRates(CGDirectDisplayID inDisplayID, int inWidth, int inHeight, std::list* inList, ValidModeCallbackProc inCallback) { CGDirectDisplayID displayID = inDisplayID ? inDisplayID : kCGDirectMainDisplay; - + CFArrayRef modeArrayRef = CGDisplayAvailableModes(displayID); CFIndex numModes = CFArrayGetCount(modeArrayRef); inList->clear(); - + for (int i = 0; i < numModes; i++) { CFDictionaryRef modeRef = (CFDictionaryRef)CFArrayGetValueAtIndex(modeArrayRef, i); - + long value = 0; CFNumberRef valueRef; Boolean success; - + valueRef = (CFNumberRef)CFDictionaryGetValue(modeRef, kCGDisplayBitsPerPixel); success = CFNumberGetValue(valueRef, kCFNumberLongType, &value); int depth = value; if (depth != 32) continue; - + valueRef = (CFNumberRef)CFDictionaryGetValue(modeRef, kCGDisplayWidth); success = CFNumberGetValue(valueRef, kCFNumberLongType, &value); int width = value; - + valueRef = (CFNumberRef)CFDictionaryGetValue(modeRef, kCGDisplayHeight); success = CFNumberGetValue(valueRef, kCFNumberLongType, &value); int height = value; - + if (width == inWidth && height == inHeight) { double freqDouble; @@ -408,9 +408,9 @@ static void BuildRefreshRates(CGDirectDisplayID inDisplayID, int inWidth, int in // Disallow 0, which we reserve to mean "automatic" inList->remove(0); - + inList->sort(); - + // Remove duplicates - yes they can occur. inList->unique(); } @@ -423,14 +423,14 @@ static void BuildRefreshPopupButton(ControlRef inControl, std::list* inLi // The menu has two permanent items - "Auto" & a divider line. Delete everything else. DeleteMenuItems(menu, 3, CountMenuItems(menu)-2); - + for (std::list::const_iterator iter = inList->begin(); iter != inList->end(); ++iter) { float value = FixedToFloat(*iter); CFStringRef menuString = CFStringCreateWithFormat (kCFAllocatorDefault, 0, CFSTR("%g Hz"), value); InsertMenuItemTextWithCFString(menu, menuString, CountMenuItems(menu), 0, 0); } - + SetControlMaximum(inControl, CountMenuItems(menu)); } @@ -452,7 +452,7 @@ static void BuildResolutionPopupButton(ControlRef inControl, CGDirectDisplayID i int count = BuildResolutionList(inDisplayID, NULL, inCallback); Res resList[count]; BuildResolutionList(inDisplayID, resList, inCallback); - + // Clear the menu MenuRef menu = GetControlPopupMenuRef(inControl); assert(menu); @@ -468,7 +468,7 @@ static void BuildResolutionPopupButton(ControlRef inControl, CGDirectDisplayID i InsertMenuItemTextWithCFString (menu, menuString, 0, 0, 0); err = SetMenuItemProperty (menu, 1, kAppCreator, 'Res ', sizeof(resList[count]), &resList[count]); } - + SetControlMaximum(inControl, CountMenuItems(menu)); } @@ -477,7 +477,7 @@ static void GetResolutionFromPopupMenuItem(ControlRef inControl, MenuItemIndex i MenuRef menu = GetControlPopupMenuRef(inControl); Res res; OSStatus err; - + err = GetMenuItemProperty (menu, inItem, kAppCreator, 'Res ', sizeof(res), NULL, &res); if (!err) { @@ -498,13 +498,13 @@ static void AdjustResolutionPopupMenu(ControlRef inControl, CGDirectDisplayID in screenX = (int)CGDisplayPixelsWide(inDisplayID); screenY = (int)CGDisplayPixelsHigh(inDisplayID); } - + MenuRef menu = GetControlPopupMenuRef(inControl); int resX, resY, depth; UInt32 resFlags; int count = CountMenuItems(menu); int item; - + for( item = 1; item <= count; item++) { GetResolutionFromPopupMenuItem(inControl, item, &resX, &resY, &depth, &resFlags); @@ -513,11 +513,11 @@ static void AdjustResolutionPopupMenu(ControlRef inControl, CGDirectDisplayID in DisablePopupMenuItem(inControl, item); else EnablePopupMenuItem(inControl, item); - + if (resX == screenwidth && resY == screenheight && depth == screendepth && resFlags == screenResFlags) SetControlValue(inControl, item); } - + // If we just disabled the current item, then choose something else. if (!IsPopupMenuItemEnabled(inControl, GetControlValue (inControl))) { @@ -549,9 +549,9 @@ static void AdjustDisplayControls(PrefInfo *prefInfo) EnableControl(prefInfo->chooseMonitorsBtn); } AdjustResolutionPopupMenu(prefInfo->resolutionPopup, prefInfo->prefDisplayID, - prefInfo->prefGameDisplayMode == kFullScreen, + prefInfo->prefGameDisplayMode == kFullScreen, prefInfo->prefWidth, prefInfo->prefHeight, prefInfo->prefDepth, prefInfo->prefResFlags); - + // Build new refresh popup and select appropriate rate BuildRefreshRates(prefInfo->prefDisplayID, prefInfo->prefWidth, prefInfo->prefHeight, &prefInfo->refreshRates, prefInfo->callback); @@ -582,7 +582,7 @@ static void AdjustDisplayControls(PrefInfo *prefInfo) static pascal OSStatus PrefHandler( EventHandlerCallRef inHandler, EventRef inEvent, void* inUserData ) { #pragma unused( inHandler ) - + HICommand cmd; OSStatus result = eventNotHandledErr; PrefInfo* prefInfo = (PrefInfo*)inUserData; @@ -595,34 +595,34 @@ static pascal OSStatus PrefHandler( EventHandlerCallRef inHandler, EventRef inEv switch ( cmd.commandID ) { case kHICommandOK: - + prefInfo->okPressed = true; - + prefInfo->prefAlways = GetControlValue (prefInfo->alwaysBtn); prefInfo->prefOpenAL = GetControlValue (prefInfo->openALBtn); - - CFPreferencesSetAppValue (kPref_PrefsDialogAlways, + + CFPreferencesSetAppValue (kPref_PrefsDialogAlways, prefInfo->prefAlways ? kCFBooleanTrue : kCFBooleanFalse, kCFPreferencesCurrentApplication); - CFPreferencesSetAppValue (kPref_PrefsDialogOpenAL, + CFPreferencesSetAppValue (kPref_PrefsDialogOpenAL, prefInfo->prefOpenAL ? kCFBooleanTrue : kCFBooleanFalse, kCFPreferencesCurrentApplication); - + CFPreferencesAppSynchronize (kCFPreferencesCurrentApplication); QuitAppModalLoopForWindow( prefInfo->window ); result = noErr; break; - + case kHICommandCancel: - + prefInfo->okPressed = false; - + QuitAppModalLoopForWindow( prefInfo->window ); result = noErr; break; - + case kCmdFullscreen: case kCmdInAWindow: if (cmd.commandID == kCmdFullscreen) @@ -633,18 +633,18 @@ static pascal OSStatus PrefHandler( EventHandlerCallRef inHandler, EventRef inEv SetControlValue (prefInfo->inAWindowBtn, 1 - (prefInfo->prefGameDisplayMode == kFullScreen)); if (prefInfo->prefGameDisplayMode == kFullScreen) EnableControl (prefInfo->refreshRatePopup); - else + else DisableControl (prefInfo->refreshRatePopup); if (prefInfo->multiMonitor) EnableControl (prefInfo->chooseMonitorsBtn); else DisableControl (prefInfo->chooseMonitorsBtn); - + // Adjust resolutions, refresh rates AdjustDisplayControls(prefInfo); result = noErr; break; - + case kCmdChooseMonitors: { @@ -659,7 +659,7 @@ static pascal OSStatus PrefHandler( EventHandlerCallRef inHandler, EventRef inEv // Pick a new resolution int item = GetControlValue(prefInfo->resolutionPopup); GetResolutionFromPopupMenuItem(prefInfo->resolutionPopup, item, &prefInfo->prefWidth, &prefInfo->prefHeight, &prefInfo->prefDepth, &prefInfo->prefResFlags); - + // Adjust refresh menu BuildRefreshRates(prefInfo->prefDisplayID, prefInfo->prefWidth, prefInfo->prefHeight, &prefInfo->refreshRates, prefInfo->callback); BuildRefreshPopupButton(prefInfo->refreshRatePopup, &prefInfo->refreshRates); @@ -673,7 +673,7 @@ static pascal OSStatus PrefHandler( EventHandlerCallRef inHandler, EventRef inEv DisableControl (prefInfo->refreshRatePopup); else EnableControl (prefInfo->refreshRatePopup); - + break; } @@ -694,7 +694,7 @@ static pascal OSStatus PrefHandler( EventHandlerCallRef inHandler, EventRef inEv } - } + } return result; } @@ -706,14 +706,14 @@ OSStatus CreateGameDisplayPreferencesDialog(const GameDisplayInfo *inGDInfo, WindowRef *outWindow, ValidModeCallbackProc inCallback) { OSStatus err = noErr; - + // Build up a structure to pass to the window handler we are about // to install. We store the window itself, as well as the original // states of our settings. We use this to revert if the user clicks // the cancel button. - + static PrefInfo prefInfo; - + prefInfo.prefGameDisplayMode = inGDInfo->mode; prefInfo.prefDisplayID = inGDInfo->displayID; prefInfo.prefWidth = inGDInfo->width; @@ -723,24 +723,24 @@ OSStatus CreateGameDisplayPreferencesDialog(const GameDisplayInfo *inGDInfo, prefInfo.prefResFlags = inGDInfo->resFlags; prefInfo.window = NULL; prefInfo.okPressed = false; - + Boolean result; Boolean keyFound; result = CFPreferencesGetAppBooleanValue (kPref_PrefsDialogAlways, kCFPreferencesCurrentApplication, &keyFound); prefInfo.prefAlways = result && keyFound; result = CFPreferencesGetAppBooleanValue (kPref_PrefsDialogOpenAL, kCFPreferencesCurrentApplication, &keyFound); prefInfo.prefOpenAL = result && keyFound; - + prefInfo.callback = inCallback; - + // If DoPreferences is called at the start of the game, prefInfo.prefDisplayID needs to be checked // to see if it is still a valid display ID. - + if (!ValidDisplayID(prefInfo.prefDisplayID)) prefInfo.prefDisplayID = kCGDirectMainDisplay; // revert to main - + // Fetch the dialog - + IBNibRef aslNib; CFBundleRef theBundle = CFBundleGetMainBundle(); err = CreateNibReferenceWithCFBundle(theBundle, CFSTR("ASLCore"), &aslNib); @@ -748,9 +748,9 @@ OSStatus CreateGameDisplayPreferencesDialog(const GameDisplayInfo *inGDInfo, if (err != noErr) return err; SetWRefCon(prefInfo.window, (long)&prefInfo); - + // Locate all the controls - + GetControlByID( prefInfo.window, &kFullscreenBtn, &prefInfo.fullscreenBtn ); assert(prefInfo.fullscreenBtn); GetControlByID( prefInfo.window, &kInAWindowBtn, &prefInfo.inAWindowBtn ); assert(prefInfo.inAWindowBtn); GetControlByID( prefInfo.window, &kResolutionPopup, &prefInfo.resolutionPopup ); assert(prefInfo.resolutionPopup); @@ -758,43 +758,43 @@ OSStatus CreateGameDisplayPreferencesDialog(const GameDisplayInfo *inGDInfo, GetControlByID( prefInfo.window, &kChooseMonitorsBtn, &prefInfo.chooseMonitorsBtn ); assert(prefInfo.chooseMonitorsBtn); GetControlByID( prefInfo.window, &kAlwaysBtn, &prefInfo.alwaysBtn ); assert(prefInfo.alwaysBtn); GetControlByID( prefInfo.window, &kOpenALBtn, &prefInfo.openALBtn ); assert(prefInfo.openALBtn); - - - + + + // Disable the "choose monitor" button if we've only got one to pick from - + prefInfo.multiMonitor = CanUserPickMonitor(); - + if (!prefInfo.multiMonitor) { DisableControl (prefInfo.chooseMonitorsBtn); prefInfo.prefDisplayID = 0; } - + // Prepare the resolutions and refresh rates popup menus AdjustDisplayControls(&prefInfo); - + // Set up the controls - + SetControlValue (prefInfo.refreshRatePopup, prefInfo.freqMenuIndex); SetControlValue (prefInfo.fullscreenBtn, prefInfo.prefGameDisplayMode == kFullScreen); SetControlValue (prefInfo.inAWindowBtn, prefInfo.prefGameDisplayMode == kWindow); SetControlValue (prefInfo.alwaysBtn, prefInfo.prefAlways); SetControlValue (prefInfo.openALBtn, prefInfo.prefOpenAL); - + // Create our UPP and install the handler. - + EventTypeSpec cmdEvent = { kEventClassCommand, kEventCommandProcess }; EventHandlerUPP handler = GetPrefHandlerUPP(); InstallWindowEventHandler( prefInfo.window, handler, 1, &cmdEvent, &prefInfo, NULL ); - + // Position and show the window RepositionWindow( prefInfo.window, NULL, kWindowAlertPositionOnMainScreen ); - + if (outWindow) *outWindow = prefInfo.window; - + return err; } @@ -807,23 +807,23 @@ OSStatus CreateGameDisplayPreferencesDialog(const GameDisplayInfo *inGDInfo, OSStatus RunGameDisplayPreferencesDialog(GameDisplayInfo *outGDInfo, WindowRef inWindow) { PrefInfo *prefInfo = (PrefInfo*)GetWRefCon(inWindow); - + ShowWindow( inWindow ); - + // Now we run modally. We will remain here until the PrefHandler // calls QuitAppModalLoopForWindow if the user clicks OK or // Cancel. - + RunAppModalLoopForWindow( inWindow ); - + // OK, we're done. Dispose of our window. // TODO: Are we supposed to uninstall event handlers? DisposeWindow( inWindow ); - + // Return settings to caller - + if (prefInfo->okPressed) - { + { outGDInfo->mode = prefInfo->prefGameDisplayMode; outGDInfo->width = prefInfo->prefWidth; outGDInfo->height = prefInfo->prefHeight; @@ -832,7 +832,7 @@ OSStatus RunGameDisplayPreferencesDialog(GameDisplayInfo *outGDInfo, WindowRef i outGDInfo->resFlags = prefInfo->prefResFlags; outGDInfo->displayID = prefInfo->prefDisplayID; } - + return prefInfo->okPressed ? noErr : userCanceledErr; } diff --git a/neo/sys/osx/PreferencesDialog.h b/neo/sys/osx/PreferencesDialog.h index 59de8fdd..dd56ef06 100644 --- a/neo/sys/osx/PreferencesDialog.h +++ b/neo/sys/osx/PreferencesDialog.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 @@ typedef struct tagPOINT LONG y; } POINT; -typedef struct +typedef struct { GameDisplayMode mode; // Indicates if the game is in full screen mode or window mode. CGDirectDisplayID displayID; // Display used for the full screen mode. @@ -65,7 +65,7 @@ OSStatus CreateGameDisplayPreferencesDialog( ValidModeCallbackProc inCallback = NULL); OSStatus RunGameDisplayPreferencesDialog( - GameDisplayInfo *outGDInfo, + GameDisplayInfo *outGDInfo, WindowRef inWindow); diff --git a/neo/sys/osx/macosx_event.mm b/neo/sys/osx/macosx_event.mm index a35afa1d..c95a3b20 100644 --- a/neo/sys/osx/macosx_event.mm +++ b/neo/sys/osx/macosx_event.mm @@ -2,7 +2,7 @@ =========================================================================== Doom 3 GPL Source Code -Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. +Copyright (C) 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 @@ int vkeyToDoom3Key[256] = { /*0x58*/ K_KP_RIGHTARROW, K_KP_HOME, '?', K_KP_UPARROW, K_KP_PGUP, '?', '?', '?', /*0x60*/ K_F5, K_F6, K_F7, K_F3, K_F8, K_F9, '?', K_F11, /*0x68*/ '?', K_PRINT_SCR, '?', K_F14, '?', K_F10, '?', K_F12, - /*0x70*/ '?', K_F15, K_INS, K_HOME, K_PGUP, K_DEL, K_F4, K_END, + /*0x70*/ '?', K_F15, K_INS, K_HOME, K_PGUP, K_DEL, K_F4, K_END, /*0x78*/ K_F2, K_PGDN, K_F1, K_LEFTARROW, K_RIGHTARROW, K_DOWNARROW, K_UPARROW, K_POWER }; @@ -93,7 +93,7 @@ int vkeyToDoom3Key_French[256] = { /*0x58*/ K_KP_RIGHTARROW, K_KP_HOME, '?', K_KP_UPARROW, K_KP_PGUP, '?', '?', '?', /*0x60*/ K_F5, K_F6, K_F7, K_F3, K_F8, K_F9, '?', K_F11, /*0x68*/ '?', K_PRINT_SCR, '?', K_F14, '?', K_F10, '?', K_F12, - /*0x70*/ '?', K_F15, K_INS, K_HOME, K_PGUP, K_DEL, K_F4, K_END, + /*0x70*/ '?', K_F15, K_INS, K_HOME, K_PGUP, K_DEL, K_F4, K_END, /*0x78*/ K_F2, K_PGDN, K_F1, K_LEFTARROW, K_RIGHTARROW, K_DOWNARROW, K_UPARROW, K_POWER }; @@ -112,11 +112,11 @@ int vkeyToDoom3Key_German[256] = { /*0x58*/ K_KP_RIGHTARROW, K_KP_HOME, '?', K_KP_UPARROW, K_KP_PGUP, '?', '?', '?', /*0x60*/ K_F5, K_F6, K_F7, K_F3, K_F8, K_F9, '?', K_F11, /*0x68*/ '?', K_PRINT_SCR, '?', K_F14, '?', K_F10, '?', K_F12, - /*0x70*/ '?', K_F15, K_INS, K_HOME, K_PGUP, K_DEL, K_F4, K_END, + /*0x70*/ '?', K_F15, K_INS, K_HOME, K_PGUP, K_DEL, K_F4, K_END, /*0x78*/ K_F2, K_PGDN, K_F1, K_LEFTARROW, K_RIGHTARROW, K_DOWNARROW, K_UPARROW, K_POWER }; -static const int *vkeyTable = vkeyToDoom3Key; +static const int *vkeyTable = vkeyToDoom3Key; /* =========== @@ -125,7 +125,7 @@ static const int *vkeyTable = vkeyToDoom3Key; */ void Sys_InitScanTable( void ) { KeyboardLayoutRef kbLayout; - + idStr lang = cvarSystem->GetCVarString( "sys_lang" ); if ( lang.Length() == 0 ) { lang = "english"; @@ -156,12 +156,12 @@ void Sys_InitScanTable( void ) { void Sys_InitInput( void ) { common->Printf( "------- Input Initialization -------\n" ); - + if ( !distantPast ) { distantPast = [ [ NSDate distantPast ] retain ]; } - IN_ActivateMouse(); + IN_ActivateMouse(); inputActive = true; } @@ -169,79 +169,79 @@ void Sys_InitInput( void ) { void Sys_ShutdownInput( void ) { common->Printf( "------- Input Shutdown -------\n" ); - if ( !inputActive ) { - return; - } - inputActive = false; - if ( mouseActive ) { + if ( !inputActive ) { + return; + } + inputActive = false; + if ( mouseActive ) { IN_DeactivateMouse(); - } - - common->Printf( "------------------------------\n" ); + } + + common->Printf( "------------------------------\n" ); } void processMouseMovedEvent( NSEvent *mouseMovedEvent ) { - CGMouseDelta dx, dy; - - if ( !mouseActive ) { - return; + CGMouseDelta dx, dy; + + if ( !mouseActive ) { + return; } #if 0 #define ACT_LIKE_WINDOWS #ifdef ACT_LIKE_WINDOWS - cvar_t *in_mouseLowEndSlope = Cvar_Get("in_mouseLowEndSlope", "3.5", CVAR_ARCHIVE); - if (in_mouseLowEndSlope->value < 1) { - Cvar_Set("in_mouseLowEndSlope", "1"); - } + cvar_t *in_mouseLowEndSlope = Cvar_Get("in_mouseLowEndSlope", "3.5", CVAR_ARCHIVE); + if (in_mouseLowEndSlope->value < 1) { + Cvar_Set("in_mouseLowEndSlope", "1"); + } #else - cvar_t *in_mouseLowEndSlope = Cvar_Get("in_mouseLowEndSlope", "1", CVAR_ARCHIVE); - if (in_mouseLowEndSlope->value < 1) { - Cvar_Set("in_mouseLowEndSlope", "1"); - } + cvar_t *in_mouseLowEndSlope = Cvar_Get("in_mouseLowEndSlope", "1", CVAR_ARCHIVE); + if (in_mouseLowEndSlope->value < 1) { + Cvar_Set("in_mouseLowEndSlope", "1"); + } #endif - cvar_t *in_mouseHighEndCutoff = Cvar_Get("in_mouseHighEndCutoff", "20", CVAR_ARCHIVE); - if (in_mouseLowEndSlope->value < 1) { - Cvar_Set("in_mouseHighEndCutoff", "1"); - } + cvar_t *in_mouseHighEndCutoff = Cvar_Get("in_mouseHighEndCutoff", "20", CVAR_ARCHIVE); + if (in_mouseLowEndSlope->value < 1) { + Cvar_Set("in_mouseHighEndCutoff", "1"); + } #endif - CGGetLastMouseDelta(&dx, &dy); - - if ( dx || dy ) { - #if 0 // this is be handled by the mouse driver clean me out later - CGMouseDelta distSqr; - float m0, N; - - distSqr = dx * dx + dy * dy; - //Com_Printf("distSqr = %d\n", distSqr); + CGGetLastMouseDelta(&dx, &dy); - /* This code is here to help people that like the feel of the Logitech USB Gaming Mouse with the Win98 drivers. By empirical testing, the Windows drivers seem to be more heavily accelerated at the low end of the curve. */ - //N = in_mouseHighEndCutoff->value; + if ( dx || dy ) { + #if 0 // this is be handled by the mouse driver clean me out later + CGMouseDelta distSqr; + float m0, N; + + distSqr = dx * dx + dy * dy; + //Com_Printf("distSqr = %d\n", distSqr); + + /* This code is here to help people that like the feel of the Logitech USB Gaming Mouse with the Win98 drivers. By empirical testing, the Windows drivers seem to be more heavily accelerated at the low end of the curve. */ + //N = in_mouseHighEndCutoff->value; N = 1; - if (distSqr < N*N) { - float dist, accel, scale; - - //m0 = in_mouseLowEndSlope->value; - m0 = 1; - dist = sqrt(distSqr); - accel = (((m0 - 1.0)/(N*N) * dist + (2.0 - 2.0*m0)/N) * dist + m0) * dist; - - scale = accel / dist; - //Com_Printf("dx = %d, dy = %d, dist = %f, accel = %f, scale = %f\n", dx, dy, dist, accel, scale); + if (distSqr < N*N) { + float dist, accel, scale; - dx *= scale; - dy *= scale; - } + //m0 = in_mouseLowEndSlope->value; + m0 = 1; + dist = sqrt(distSqr); + accel = (((m0 - 1.0)/(N*N) * dist + (2.0 - 2.0*m0)/N) * dist + m0) * dist; + + scale = accel / dist; + //Com_Printf("dx = %d, dy = %d, dist = %f, accel = %f, scale = %f\n", dx, dy, dist, accel, scale); + + dx *= scale; + dy *= scale; + } #endif - Posix_QueEvent( SE_MOUSE, dx, dy, 0, NULL ); + Posix_QueEvent( SE_MOUSE, dx, dy, 0, NULL ); Posix_AddMousePollEvent( M_DELTAX, dx ); Posix_AddMousePollEvent( M_DELTAY, dy ); - } + } } inline bool OSX_LookupCharacter(unsigned short vkey, unsigned int modifiers, bool keyDownFlag, unsigned char *outChar) @@ -251,7 +251,7 @@ inline bool OSX_LookupCharacter(unsigned short vkey, unsigned int modifiers, boo UniChar unicodeString[16]; UniCharCount actualStringLength = 0; static UInt32 keyTranslateState = 0; - + // Only want character if Translate() returns a single character if ( sKLuchrData ) { UCKeyTranslate( (UCKeyboardLayout*)sKLuchrData, vkey, keyDownFlag ? kUCKeyActionDown : kUCKeyActionUp, modifiers, @@ -288,92 +288,92 @@ void OSX_ProcessKeyEvent( NSEvent *keyEvent, bool keyDownFlag ) { if ( [ keyEvent modifierFlags ] & NSCommandKeyMask ) modifiers |= cmdKey; modifiers >>= 8; - + int doomKey = (unsigned char)vkeyTable[vkey]; Posix_QueEvent( SE_KEY, doomKey, keyDownFlag, 0, NULL ); if ( keyDownFlag ) { - if ( OSX_LookupCharacter(vkey, modifiers, keyDownFlag, &character ) && + if ( OSX_LookupCharacter(vkey, modifiers, keyDownFlag, &character ) && character != Sys_GetConsoleKey( false ) && character != Sys_GetConsoleKey( true ) ) { Posix_QueEvent( SE_CHAR, character, 0, 0, NULL); } } Posix_AddKeyboardPollEvent( doomKey, keyDownFlag ); - + return; } void sendEventForMaskChangeInFlags( int quakeKey, unsigned int modifierMask, unsigned int oldModifierFlags, unsigned int newModifierFlags ) { - bool oldHadModifier, newHasModifier; + bool oldHadModifier, newHasModifier; - oldHadModifier = (oldModifierFlags & modifierMask) != 0; - newHasModifier = (newModifierFlags & modifierMask) != 0; - if (oldHadModifier != newHasModifier) { - //NSLog(@"Key %d posted for modifier mask modifierMask", quakeKey); - Posix_QueEvent( SE_KEY, quakeKey, newHasModifier, 0, NULL); + oldHadModifier = (oldModifierFlags & modifierMask) != 0; + newHasModifier = (newModifierFlags & modifierMask) != 0; + if (oldHadModifier != newHasModifier) { + //NSLog(@"Key %d posted for modifier mask modifierMask", quakeKey); + Posix_QueEvent( SE_KEY, quakeKey, newHasModifier, 0, NULL); Posix_AddKeyboardPollEvent( quakeKey, newHasModifier ); - } + } } void processFlagsChangedEvent( NSEvent *flagsChangedEvent ) { - static int oldModifierFlags; - int newModifierFlags; + static int oldModifierFlags; + int newModifierFlags; - newModifierFlags = [flagsChangedEvent modifierFlags]; - sendEventForMaskChangeInFlags( K_ALT, NSAlternateKeyMask, oldModifierFlags, newModifierFlags ); - sendEventForMaskChangeInFlags( K_CTRL, NSControlKeyMask, oldModifierFlags, newModifierFlags ); - sendEventForMaskChangeInFlags( K_SHIFT, NSShiftKeyMask, oldModifierFlags, newModifierFlags ); - oldModifierFlags = newModifierFlags; + newModifierFlags = [flagsChangedEvent modifierFlags]; + sendEventForMaskChangeInFlags( K_ALT, NSAlternateKeyMask, oldModifierFlags, newModifierFlags ); + sendEventForMaskChangeInFlags( K_CTRL, NSControlKeyMask, oldModifierFlags, newModifierFlags ); + sendEventForMaskChangeInFlags( K_SHIFT, NSShiftKeyMask, oldModifierFlags, newModifierFlags ); + oldModifierFlags = newModifierFlags; } void processSystemDefinedEvent( NSEvent *systemDefinedEvent ) { - static int oldButtons = 0; - int buttonsDelta; - int buttons; - int isDown; - - if ( [systemDefinedEvent subtype] == 7 ) { + static int oldButtons = 0; + int buttonsDelta; + int buttons; + int isDown; + + if ( [systemDefinedEvent subtype] == 7 ) { + + if ( !mouseActive ) { + return; + } - if ( !mouseActive ) { - return; - } - buttons = [systemDefinedEvent data2]; - buttonsDelta = oldButtons ^ buttons; - - //common->Printf( "uberbuttons: %08lx %08lx\n", buttonsDelta, buttons ); + buttonsDelta = oldButtons ^ buttons; + + //common->Printf( "uberbuttons: %08lx %08lx\n", buttonsDelta, buttons ); if (buttonsDelta & 1) { - isDown = buttons & 1; - Posix_QueEvent( SE_KEY, K_MOUSE1, isDown, 0, NULL); + isDown = buttons & 1; + Posix_QueEvent( SE_KEY, K_MOUSE1, isDown, 0, NULL); Posix_AddMousePollEvent( M_ACTION1, isDown ); } if (buttonsDelta & 2) { - isDown = buttons & 2; - Posix_QueEvent( SE_KEY, K_MOUSE2, isDown, 0, NULL); + isDown = buttons & 2; + Posix_QueEvent( SE_KEY, K_MOUSE2, isDown, 0, NULL); Posix_AddMousePollEvent( M_ACTION2, isDown ); } if (buttonsDelta & 4) { - isDown = buttons & 4; - Posix_QueEvent( SE_KEY, K_MOUSE3, isDown, 0, NULL); + isDown = buttons & 4; + Posix_QueEvent( SE_KEY, K_MOUSE3, isDown, 0, NULL); Posix_AddMousePollEvent( M_ACTION3, isDown ); } if (buttonsDelta & 8) { - isDown = buttons & 8; - Posix_QueEvent( SE_KEY, K_MOUSE4, isDown, 0, NULL); + isDown = buttons & 8; + Posix_QueEvent( SE_KEY, K_MOUSE4, isDown, 0, NULL); Posix_AddMousePollEvent( M_ACTION4, isDown ); - } - + } + if (buttonsDelta & 16) { - isDown = buttons & 16; - Posix_QueEvent( SE_KEY, K_MOUSE5, isDown, 0, NULL); + isDown = buttons & 16; + Posix_QueEvent( SE_KEY, K_MOUSE5, isDown, 0, NULL); Posix_AddMousePollEvent( M_ACTION5, isDown ); } - - oldButtons = buttons; - } + + oldButtons = buttons; + } } void processEvent( NSEvent *event ) { @@ -392,7 +392,7 @@ void processEvent( NSEvent *event ) { case NSRightMouseDown: case NSRightMouseUp: //NSLog( @"ignore simple mouse event %@", event ); - return; + return; case NSMouseMoved: case NSLeftMouseDragged: case NSRightMouseDragged: @@ -428,16 +428,16 @@ void processEvent( NSEvent *event ) { //NSLog( @"handle event %@", event ); break; } - [NSApp sendEvent:event]; + [NSApp sendEvent:event]; } void Posix_PollInput( void ) { - NSEvent *event; - unsigned int eventMask; - - eventMask = NSAnyEventMask; - - while ( ( event = [ NSApp nextEventMatchingMask: eventMask + NSEvent *event; + unsigned int eventMask; + + eventMask = NSAnyEventMask; + + while ( ( event = [ NSApp nextEventMatchingMask: eventMask untilDate: distantPast inMode: NSDefaultRunLoopMode dequeue:YES ] ) ) { @@ -446,74 +446,74 @@ void Posix_PollInput( void ) { } void Sys_PreventMouseMovement( CGPoint point ) { - CGEventErr err; + CGEventErr err; - //common->Printf( "**** Calling CGAssociateMouseAndMouseCursorPosition(false)\n" ); - err = CGAssociateMouseAndMouseCursorPosition( false ); - if ( err != CGEventNoErr ) { - common->Error( "Could not disable mouse movement, CGAssociateMouseAndMouseCursorPosition returned %d\n", err ); - } + //common->Printf( "**** Calling CGAssociateMouseAndMouseCursorPosition(false)\n" ); + err = CGAssociateMouseAndMouseCursorPosition( false ); + if ( err != CGEventNoErr ) { + common->Error( "Could not disable mouse movement, CGAssociateMouseAndMouseCursorPosition returned %d\n", err ); + } - // Put the mouse in the position we want to leave it at - err = CGWarpMouseCursorPosition( point ); - if ( err != CGEventNoErr ) { - common->Error( "Could not disable mouse movement, CGWarpMouseCursorPosition returned %d\n", err ); - } + // Put the mouse in the position we want to leave it at + err = CGWarpMouseCursorPosition( point ); + if ( err != CGEventNoErr ) { + common->Error( "Could not disable mouse movement, CGWarpMouseCursorPosition returned %d\n", err ); + } } void Sys_ReenableMouseMovement() { - CGEventErr err; + CGEventErr err; - //common->Printf( "**** Calling CGAssociateMouseAndMouseCursorPosition(true)\n" ); - err = CGAssociateMouseAndMouseCursorPosition( true ); - if ( err != CGEventNoErr ) { - common->Error( "Could not reenable mouse movement, CGAssociateMouseAndMouseCursorPosition returned %d\n", err ); - } + //common->Printf( "**** Calling CGAssociateMouseAndMouseCursorPosition(true)\n" ); + err = CGAssociateMouseAndMouseCursorPosition( true ); + if ( err != CGEventNoErr ) { + common->Error( "Could not reenable mouse movement, CGAssociateMouseAndMouseCursorPosition returned %d\n", err ); + } - // Leave the mouse where it was -- don't warp here. + // Leave the mouse where it was -- don't warp here. } void Sys_LockMouseInInputRect(CGRect rect) { - CGPoint center; + CGPoint center; - center.x = rect.origin.x + rect.size.width / 2.0; - center.y = rect.origin.y + rect.size.height / 2.0; + center.x = rect.origin.x + rect.size.width / 2.0; + center.y = rect.origin.y + rect.size.height / 2.0; - // Now, put the mouse in the middle of the input rect (anywhere over it would do) - // and don't allow it to move. This means that the user won't be able to accidentally - // select another application. - Sys_PreventMouseMovement(center); + // Now, put the mouse in the middle of the input rect (anywhere over it would do) + // and don't allow it to move. This means that the user won't be able to accidentally + // select another application. + Sys_PreventMouseMovement(center); } void Sys_SetMouseInputRect(CGRect newRect) { - inputRectValid = YES; - inputRect = newRect; + inputRectValid = YES; + inputRect = newRect; - if ( mouseActive ) { - Sys_LockMouseInInputRect( inputRect ); + if ( mouseActive ) { + Sys_LockMouseInInputRect( inputRect ); } } void IN_ActivateMouse( void ) { - if ( mouseActive ) { - return; - } - if ( inputRectValid ) { - // Make sure that if window moved we don't hose the user... - Sys_UpdateWindowMouseInputRect(); - } - Sys_LockMouseInInputRect( inputRect ); - CGDisplayHideCursor( Sys_DisplayToUse() ); - mouseActive = true; + if ( mouseActive ) { + return; + } + if ( inputRectValid ) { + // Make sure that if window moved we don't hose the user... + Sys_UpdateWindowMouseInputRect(); + } + Sys_LockMouseInInputRect( inputRect ); + CGDisplayHideCursor( Sys_DisplayToUse() ); + mouseActive = true; } void IN_DeactivateMouse( void ) { - if ( !mouseActive ) { - return; - } - Sys_ReenableMouseMovement(); - CGDisplayShowCursor( Sys_DisplayToUse() ); - mouseActive = false; + if ( !mouseActive ) { + return; + } + Sys_ReenableMouseMovement(); + CGDisplayShowCursor( Sys_DisplayToUse() ); + mouseActive = false; } /* diff --git a/neo/sys/osx/macosx_glimp.mm b/neo/sys/osx/macosx_glimp.mm index ded63e05..c3a68057 100644 --- a/neo/sys/osx/macosx_glimp.mm +++ b/neo/sys/osx/macosx_glimp.mm @@ -2,7 +2,7 @@ =========================================================================== Doom 3 GPL Source Code -Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. +Copyright (C) 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 @@ static bool isHidden = false; CheckErrors ============ */ -void CheckErrors( void ) { +void CheckErrors( void ) { GLenum err; err = qglGetError(); @@ -90,7 +90,7 @@ void QGLErrorBreak(void) { } void QGLCheckError( const char *message ) { GLenum error; static unsigned int errorCount = 0; - + error = _glGetError(); if (error != GL_NO_ERROR) { if (errorCount == 100) { @@ -120,18 +120,18 @@ bool GLimp_SetMode( glimpParms_t parms ) { glConfig.vidWidth = parms.width; glConfig.vidHeight = parms.height; glConfig.isFullscreen = parms.fullScreen; - - // draw something to show that GL is alive + + // draw something to show that GL is alive qglClearColor( 0.5, 0.5, 0.7, 0 ); qglClear( GL_COLOR_BUFFER_BIT ); GLimp_SwapBuffers(); - + qglClearColor( 0.5, 0.5, 0.7, 0 ); qglClear( GL_COLOR_BUFFER_BIT ); GLimp_SwapBuffers(); Sys_UnfadeScreen( Sys_DisplayToUse(), NULL ); - + CheckErrors(); return true; @@ -166,9 +166,9 @@ static NSOpenGLPixelFormatAttribute *GetPixelAttributes( unsigned int multisampl unsigned int depthBits; unsigned int stencilBits; unsigned int buffers; - + verbose = 0; - + pixelAttributes = (NSOpenGLPixelFormatAttribute *)NSZoneMalloc(NULL, sizeof(*pixelAttributes) * attributeSize); // only greater or equal attributes will be selected @@ -181,7 +181,7 @@ static NSOpenGLPixelFormatAttribute *GetPixelAttributes( unsigned int multisampl ADD_ATTR(NSOpenGLPFAScreenMask); ADD_ATTR(CGDisplayIDToOpenGLDisplayMask(Sys_DisplayToUse())); - + // Require hardware acceleration ADD_ATTR(NSOpenGLPFAAccelerated); @@ -215,19 +215,19 @@ static NSOpenGLPixelFormatAttribute *GetPixelAttributes( unsigned int multisampl if ( multisamples ) { buffers = 1; - ADD_ATTR( NSOpenGLPFASampleBuffers ); + ADD_ATTR( NSOpenGLPFASampleBuffers ); ADD_ATTR( buffers ); - ADD_ATTR( NSOpenGLPFASamples ); + ADD_ATTR( NSOpenGLPFASamples ); ADD_ATTR( multisamples ); } // Terminate the list ADD_ATTR(0); - + return pixelAttributes; } -void Sys_UpdateWindowMouseInputRect(void) { +void Sys_UpdateWindowMouseInputRect(void) { NSRect windowRect, screenRect; NSScreen *screen; @@ -246,7 +246,7 @@ void Sys_UpdateWindowMouseInputRect(void) { */ Sys_SetMouseInputRect( CGDisplayBounds( glw_state.display ) ); -} +} // This is needed since CGReleaseAllDisplays() restores the gamma on the displays and we want to fade it up rather than just flickering all the displays static void ReleaseAllDisplays() { @@ -269,9 +269,9 @@ static bool CreateGameWindow( glimpParms_t parms ) { NSOpenGLPixelFormat *pixelFormat; CGDisplayErr err; unsigned int multisamples; - const long swap_limit = false; - int nsOpenGLCPSwapLimit = 203; - + const long swap_limit = false; + int nsOpenGLCPSwapLimit = 203; + glw_state.display = Sys_DisplayToUse(); glw_state.desktopMode = (NSDictionary *)CGDisplayCurrentMode( glw_state.display ); if ( !glw_state.desktopMode ) { @@ -281,7 +281,7 @@ static bool CreateGameWindow( glimpParms_t parms ) { common->Printf( " %d %d %s\n", parms.width, parms.height, windowed[ parms.fullScreen ] ); if (parms.fullScreen) { - + // We'll set up the screen resolution first in case that effects the list of pixel // formats that are available (for example, a smaller frame buffer might mean more // bits for depth/stencil buffers). Allow stretched video modes if we are in fallback mode. @@ -293,7 +293,7 @@ static bool CreateGameWindow( glimpParms_t parms ) { // Fade all screens to black // Sys_FadeScreens(); - + err = Sys_CaptureActiveDisplays(); if ( err != CGDisplayNoErr ) { CGDisplayRestoreColorSyncSettings(); @@ -311,7 +311,7 @@ static bool CreateGameWindow( glimpParms_t parms ) { } else { glw_state.gameMode = glw_state.desktopMode; } - + // Get the GL pixel format pixelFormat = nil; multisamples = cvarSystem->GetCVarInteger( "r_multiSamples" ); @@ -323,8 +323,8 @@ static bool CreateGameWindow( glimpParms_t parms ) { break; multisamples >>= 1; } - cvarSystem->SetCVarInteger( "r_multiSamples", multisamples ); - + cvarSystem->SetCVarInteger( "r_multiSamples", multisamples ); + if (!pixelFormat) { CGDisplayRestoreColorSyncSettings(); CGDisplaySwitchToMode(glw_state.display, (CFDictionaryRef)glw_state.desktopMode); @@ -349,13 +349,13 @@ static bool CreateGameWindow( glimpParms_t parms ) { [ OSX_GetNSGLContext() setValues: &swap_limit forParameter: (NSOpenGLContextParameter)nsOpenGLCPSwapLimit ]; } #endif - + if ( !parms.fullScreen ) { NSScreen* screen; NSRect windowRect; int displayIndex; int displayCount; - + displayIndex = r_screen.GetInteger(); displayCount = [[NSScreen screens] count]; if ( displayIndex < 0 || displayIndex >= displayCount ) { @@ -369,10 +369,10 @@ static bool CreateGameWindow( glimpParms_t parms ) { windowRect.origin.y = ((short)r.size.height - parms.height) / 2; windowRect.size.width = parms.width; windowRect.size.height = parms.height; - + glw_state.window = [NSWindow alloc]; [glw_state.window initWithContentRect:windowRect styleMask:NSTitledWindowMask backing:NSBackingStoreRetained defer:NO screen:screen]; - + [glw_state.window setTitle: @GAME_NAME]; [glw_state.window orderFront: nil]; @@ -380,7 +380,7 @@ static bool CreateGameWindow( glimpParms_t parms ) { // Always get mouse moved events (if mouse support is turned off (rare) // the event system will filter them out. [glw_state.window setAcceptsMouseMovedEvents: YES]; - + // Direct the context to draw in this window [OSX_GetNSGLContext() setView: [glw_state.window contentView]]; @@ -390,7 +390,7 @@ static bool CreateGameWindow( glimpParms_t parms ) { CGLError err; glw_state.window = NULL; - + err = CGLSetFullScreen(OSX_GetCGLContext()); if (err) { CGDisplayRestoreColorSyncSettings(); @@ -414,7 +414,7 @@ static bool CreateGameWindow( glimpParms_t parms ) { [pixelFormat getValues: (long *) &glConfig.stencilBits forAttribute: NSOpenGLPFAStencilSize forVirtualScreen: 0]; glConfig.displayFrequency = [[glw_state.gameMode objectForKey: (id)kCGDisplayRefreshRate] intValue]; - + common->Printf( "ok\n" ); return true; @@ -424,7 +424,7 @@ static bool CreateGameWindow( glimpParms_t parms ) { void Sys_PauseGL () { if (!glw_state.glPauseCount) { qglFinish (); // must do this to ensure the queue is complete - + // Have to call both to actually deallocate kernel resources and free the NSSurface CGLClearDrawable(OSX_GetCGLContext()); [OSX_GetNSGLContext() clearDrawable]; @@ -441,7 +441,7 @@ void Sys_ResumeGL () { [OSX_GetNSGLContext() setView: [glw_state.window contentView]]; } else { CGLError err; - + err = CGLSetFullScreen(OSX_GetCGLContext()); if (err) common->Printf("CGLSetFullScreen -> %d (%s)\n", err, CGLErrorString(err)); @@ -471,11 +471,11 @@ bool GLimp_Init( glimpParms_t parms ) { common->Printf( " fullscreen: %s\n", cvarSystem->GetCVarBool( "r_fullscreen" ) ? "yes" : "no" ); Sys_StoreGammaTables(); - + if ( !Sys_QueryVideoMemory() ) { common->Error( "Could not initialize OpenGL. There does not appear to be an OpenGL-supported video card in your system.\n" ); } - + if ( !GLimp_SetMode( parms ) ) { common->Warning( "Could not initialize OpenGL\n" ); return false; @@ -500,7 +500,7 @@ bool GLimp_Init( glimpParms_t parms ) { GLW_InitExtensions(); - /* + /* #ifndef USE_CGLMACROS if (!r_enablerender->integer) OSX_GLContextClearCurrent(); @@ -512,7 +512,7 @@ bool GLimp_Init( glimpParms_t parms ) { /* ** GLimp_SwapBuffers -** +** ** Responsible for doing a swapbuffers and possibly for other stuff ** as yet to be determined. Probably better not to make this a GLimp ** function and instead do a call to GLimp_SwapBuffers. @@ -531,7 +531,7 @@ void GLimp_SwapBuffers( void ) { [OSX_GetNSGLContext() flushBuffer]; } - /* + /* // Enable turning off GL at any point for performance testing if (OSX_GLContextIsCurrent() != r_enablerender->integer) { if (r_enablerender->integer) { @@ -557,7 +557,7 @@ void GLimp_SwapBuffers( void ) { static void _GLimp_RestoreOriginalVideoSettings() { CGDisplayErr err; - + // CGDisplayCurrentMode lies because we've captured the display and thus we won't // get any notifications about what the current display mode really is. For now, // we just always force it back to what mode we remember the desktop being in. @@ -576,7 +576,7 @@ void GLimp_Shutdown( void ) { common->Printf("----- Shutting down GL -----\n"); Sys_FadeScreen(Sys_DisplayToUse()); - + if (OSX_GetNSGLContext()) { #ifndef USE_CGLMACROS OSX_GLContextClearCurrent(); @@ -584,13 +584,13 @@ void GLimp_Shutdown( void ) { // Have to call both to actually deallocate kernel resources and free the NSSurface CGLClearDrawable(OSX_GetCGLContext()); [OSX_GetNSGLContext() clearDrawable]; - + [OSX_GetNSGLContext() release]; OSX_SetGLContext((id)nil); } _GLimp_RestoreOriginalVideoSettings(); - + Sys_UnfadeScreens(); // Restore the original gamma if needed. @@ -625,7 +625,7 @@ void GLimp_Shutdown( void ) { free(glw_state.inGameTable.blue); free(glw_state.inGameTable.green); } - + memset(&glConfig, 0, sizeof(glConfig)); // memset(&glState, 0, sizeof(glState)); memset(&glw_state, 0, sizeof(glw_state)); @@ -646,23 +646,23 @@ GLimp_SetGamma =============== */ void GLimp_SetGamma(unsigned short red[256], - unsigned short green[256], - unsigned short blue[256]) { + unsigned short green[256], + unsigned short blue[256]) { CGGammaValue redGamma[256], greenGamma[256], blueGamma[256]; CGTableCount i; CGDisplayErr err; - + for (i = 0; i < 256; i++) { redGamma[i] = red[i] / 65535.0; greenGamma[i] = green[i] / 65535.0; blueGamma[i] = blue[i] / 65535.0; } - + err = CGSetDisplayTransferByTable(glw_state.display, 256, redGamma, greenGamma, blueGamma); if (err != CGDisplayNoErr) { common->Printf("GLimp_SetGamma: CGSetDisplayTransferByByteTable returned %d.\n", err); } - + // Store the gamma table that we ended up using so we can reapply it later when unhiding or to work around the bug where if you leave the game sitting and the monitor sleeps, when it wakes, the gamma isn't reset. glw_state.inGameTable.display = glw_state.display; Sys_GetGammaTable(&glw_state.inGameTable); @@ -707,11 +707,11 @@ void glBeginFragmentShaderATI (void) { sConstString[0] = 0; for (i = 0; i < 8; i ++) sConst[i] = 0; - + sOpUsed = 0; sPassString[0][0] = 0; sPassString[1][0] = 0; - + sCurrentPass = 0; sGeneratingProgram = 1; } @@ -720,12 +720,12 @@ void glEndFragmentShaderATI (void) { GLint errPos; int i; char fragString[4096]; - + sGeneratingProgram = 0; // header strcpy(fragString, "!!ATIfs1.0\n"); - + // constants if (sConstString[0] || sConstUsed) { strcat (fragString, "StartConstants;\n"); @@ -791,11 +791,11 @@ void glSetFragmentShaderConstantATI (GLuint num, const GLfloat *val) { char *makeArgStr(GLuint arg) { // Since we return "str", it needs to be static to ensure that it retains - // its value outside this routine. + // its value outside this routine. static char str[128]; - + strcpy (str, ""); - + if ( arg >= GL_REG_0_ATI && arg <= GL_REG_5_ATI ) { sprintf(str, "r%d", arg - GL_REG_0_ATI); } else if(arg >= GL_CON_0_ATI && arg <= GL_CON_7_ATI) { @@ -807,7 +807,7 @@ char *makeArgStr(GLuint arg) { } else if( arg >= GL_TEXTURE0_ARB && arg <= GL_TEXTURE31_ARB ) { sprintf(str, "t%d", arg - GL_TEXTURE0_ARB); } else if( arg == GL_PRIMARY_COLOR_ARB ) { - strcpy(str, "color0"); + strcpy(str, "color0"); } else if(arg == GL_SECONDARY_INTERPOLATOR_ATI) { strcpy(str, "color1"); } else if (arg == GL_ZERO) { @@ -870,11 +870,11 @@ void glSampleMapATI (GLuint dst, GLuint interp, GLenum swizzle) { char *makeMaskStr(GLuint mask) { // Since we return "str", it needs to be static to ensure that it retains - // its value outside this routine. + // its value outside this routine. static char str[128]; - + strcpy (str, ""); - + switch (mask) { case GL_NONE: str[0] = '\0'; @@ -907,17 +907,17 @@ char *makeMaskStr(GLuint mask) { strcat(str, "b"); break; } - + return str; } char *makeDstModStr(GLuint mod) { // Since we return "str", it needs to be static to ensure that it retains - // its value outside this routine. + // its value outside this routine. static char str[128]; - + strcpy (str, ""); - + if( mod == GL_NONE) { str[0] = '\0'; return str; @@ -941,7 +941,7 @@ char *makeDstModStr(GLuint mod) { if( mod & GL_HALF_BIT_ATI) { strcat(str, ".half"); } - + if( mod & GL_QUARTER_BIT_ATI) { strcat(str, ".quarter"); } @@ -951,15 +951,15 @@ char *makeDstModStr(GLuint mod) { } return str; -} +} char *makeArgModStr(GLuint mod) { // Since we return "str", it needs to be static to ensure that it retains - // its value outside this routine. + // its value outside this routine. static char str[128]; - + strcpy (str, ""); - + if( mod == GL_NONE) { str[0] = '\0'; return str; @@ -975,19 +975,19 @@ char *makeArgModStr(GLuint mod) { if( mod & GL_BIAS_BIT_ATI) { strcat(str, ".bias"); } - + if( mod & GL_COMP_BIT_ATI) { strcat(str, ".comp"); } - + return str; } void glColorFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod) { char str[128] = "\0"; - + sOpUsed = 1; - + switch(op) { // Unary operators case GL_MOV_ATI: @@ -1003,12 +1003,12 @@ void glColorFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod else { strcat(str, ".rgb" ); } - + if(dstMod != GL_NONE) { strcat(str, makeDstModStr(dstMod)); } strcat(str, ", "); - + strcat(str, makeArgStr(arg1)); if(arg1Rep != GL_NONE) { strcat(str, makeMaskStr(arg1Rep)); @@ -1017,17 +1017,17 @@ void glColorFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod strcat(str, makeArgModStr(arg1Mod)); } strcat(str, ";\n"); - + strcat(sPassString[sCurrentPass], str); } void glColorFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod) { char str[128] = "\0"; - + if (!sOpUsed) sprintf(str,"\n"); sOpUsed = 1; - + switch(op) { // Unary operators - fall back to Op1 routine. case GL_MOV_ATI: @@ -1064,31 +1064,31 @@ void glColorFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod strcat(str, makeDstModStr(dstMod)); } strcat(str, ", "); - + strcat(str, makeArgStr(arg1)); -// if(arg1Rep != GL_NONE) +// if(arg1Rep != GL_NONE) strcat(str, makeMaskStr(arg1Rep)); if(arg1Mod != GL_NONE) { strcat(str, makeArgModStr(arg1Mod)); } strcat(str, ", "); - + strcat(str, makeArgStr(arg2)); -// if(arg2Rep != GL_NONE) +// if(arg2Rep != GL_NONE) strcat(str, makeMaskStr(arg2Rep)); if(arg2Mod != GL_NONE) { - strcat(str, makeArgModStr(arg2Mod)); + strcat(str, makeArgModStr(arg2Mod)); } strcat(str, ";\n"); - + strcat(sPassString[sCurrentPass], str); } void glColorFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod) { char str[128] = "\0"; - + sOpUsed = 1; - + switch(op) { // Unary operators - fall back to Op1 routine. case GL_MOV_ATI: @@ -1135,7 +1135,7 @@ void glColorFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod strcat(str, makeDstModStr(dstMod)); } strcat(str, ", "); - + strcat(str, makeArgStr(arg1)); if(arg1Rep != GL_NONE) { strcat(str, makeMaskStr(arg1Rep)); @@ -1144,7 +1144,7 @@ void glColorFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod strcat(str, makeArgModStr(arg1Mod)); } strcat(str, ", "); - + strcat(str, makeArgStr(arg2)); if(arg2Rep != GL_NONE) { strcat(str, makeMaskStr(arg2Rep)); @@ -1153,7 +1153,7 @@ void glColorFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod strcat(str, makeArgModStr(arg2Mod)); } strcat(str, ", "); - + strcat(str, makeArgStr(arg3)); if(arg3Rep != GL_NONE) { strcat(str, makeMaskStr(arg3Rep)); @@ -1162,7 +1162,7 @@ void glColorFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod strcat(str, makeArgModStr(arg3Mod)); } strcat(str, ";\n"); - + strcat(sPassString[sCurrentPass], str); } @@ -1267,18 +1267,18 @@ unsigned long Sys_QueryVideoMemory() { long accelerated; long rendererID; long totalRenderers = 0; - + err = CGLQueryRendererInfo(CGDisplayIDToOpenGLDisplayMask(Sys_DisplayToUse()), rendererInfos, &rendererInfoCount); if (err) { common->Printf("CGLQueryRendererInfo -> %d\n", err); return vram; } - + //common->Printf("rendererInfoCount = %d\n", rendererInfoCount); for (rendererInfoIndex = 0; rendererInfoIndex < rendererInfoCount && totalRenderers < rendererInfoCount; rendererInfoIndex++) { rendererInfo = rendererInfos[rendererInfoIndex]; //common->Printf("rendererInfo: 0x%08x\n", rendererInfo); - + err = CGLDescribeRenderer(rendererInfo, 0, kCGLRPRendererCount, &rendererCount); if (err) { @@ -1290,7 +1290,7 @@ unsigned long Sys_QueryVideoMemory() { for (rendererIndex = 0; rendererIndex < rendererCount; rendererIndex++) { totalRenderers++; //common->Printf(" rendererIndex: %d\n", rendererIndex); - + rendererID = 0xffffffff; err = CGLDescribeRenderer(rendererInfo, rendererIndex, kCGLRPRendererID, &rendererID); if (err) { @@ -1298,7 +1298,7 @@ unsigned long Sys_QueryVideoMemory() { continue; } //common->Printf(" rendererID: 0x%08x\n", rendererID); - + accelerated = 0; err = CGLDescribeRenderer(rendererInfo, rendererIndex, kCGLRPAccelerated, &accelerated); if (err) { @@ -1308,7 +1308,7 @@ unsigned long Sys_QueryVideoMemory() { //common->Printf(" accelerated: %d\n", accelerated); if (!accelerated) continue; - + vram = 0; err = CGLDescribeRenderer(rendererInfo, rendererIndex, kCGLRPVideoMemory, &vram); if (err) { @@ -1316,12 +1316,12 @@ unsigned long Sys_QueryVideoMemory() { continue; } //common->Printf(" vram: 0x%08x\n", vram); - + // presumably we'll be running on the best card, so we'll take the max of the vrams if (vram > maxVRAM) maxVRAM = vram; } - + #if 0 err = CGLDestroyRendererInfo(rendererInfo); if (err) { @@ -1340,12 +1340,12 @@ bool Sys_Hide() { // Eh? return false; } - + if ( !r_fullscreen.GetBool() ) { // We only support hiding in fullscreen mode right now return false; } - + isHidden = true; // Don't need to store the current gamma since we always keep it around in glw_state.inGameTable. @@ -1356,7 +1356,7 @@ bool Sys_Hide() { // Have to call both to actually deallocate kernel resources and free the NSSurface CGLClearDrawable(OSX_GetCGLContext()); [OSX_GetNSGLContext() clearDrawable]; - + // Restore the original video mode _GLimp_RestoreOriginalVideoSettings(); @@ -1367,15 +1367,15 @@ bool Sys_Hide() { // Release the screen(s) ReleaseAllDisplays(); - + Sys_UnfadeScreens(); - + // Shut down the input system so the mouse and keyboard settings are restore to normal Sys_ShutdownInput(); - + // Hide the application so that when the user clicks on our app icon, we'll get an unhide notification [NSApp hide: nil]; - + return true; } @@ -1395,12 +1395,12 @@ CGDisplayErr Sys_CaptureActiveDisplays(void) { bool Sys_Unhide() { CGDisplayErr err; CGLError glErr; - + if ( !isHidden) { // Eh? return false; } - + Sys_FadeScreens(); // Capture the screen(s) @@ -1410,7 +1410,7 @@ bool Sys_Unhide() { common->Printf( "Unhide failed -- cannot capture the display again.\n" ); return false; } - + // Restore the game mode err = CGDisplaySwitchToMode(glw_state.display, (CFDictionaryRef)glw_state.gameMode); if ( err != CGDisplayNoErr ) { @@ -1431,13 +1431,13 @@ bool Sys_Unhide() { // Restore the current context [OSX_GetNSGLContext() makeCurrentContext]; - + // Restore the gamma that the game had set Sys_UnfadeScreen(Sys_DisplayToUse(), &glw_state.inGameTable); - + // Restore the input system (last so if something goes wrong we don't eat the mouse) Sys_InitInput(); - + isHidden = false; return true; } @@ -1480,7 +1480,7 @@ NSDictionary *Sys_GetMatchingDisplayMode( glimpParms_t parms ) { // cvar_t *cMinFreq, *cMaxFreq; int minFreq, maxFreq; unsigned int colorDepth; - + verbose = 0; colorDepth = 32; @@ -1490,25 +1490,25 @@ NSDictionary *Sys_GetMatchingDisplayMode( glimpParms_t parms ) { if ( minFreq > maxFreq ) { common->Error( "r_minDisplayRefresh must be less than or equal to r_maxDisplayRefresh" ); } - + displayModes = (NSArray *)CGDisplayAvailableModes(glw_state.display); if (!displayModes) { common->Error( "CGDisplayAvailableModes returned NULL -- 0x%0x is an invalid display", glw_state.display); } - + modeCount = [displayModes count]; if (verbose) { common->Printf( "%d modes avaliable\n", modeCount); common->Printf( "Current mode is %s\n", [[(id)CGDisplayCurrentMode(glw_state.display) description] cString]); } - + // Default to the current desktop mode bestModeIndex = 0xFFFFFFFF; - + for ( modeIndex = 0; modeIndex < modeCount; ++modeIndex ) { id object; int refresh; - + mode = [displayModes objectAtIndex: modeIndex]; if (verbose) { common->Printf( " mode %d -- %s\n", modeIndex, [[mode description] cString]); @@ -1557,7 +1557,7 @@ NSDictionary *Sys_GetMatchingDisplayMode( glimpParms_t parms ) { continue; } } - + bestModeIndex = modeIndex; if (verbose) common->Printf( " -- OK\n", bestModeIndex); @@ -1570,7 +1570,7 @@ NSDictionary *Sys_GetMatchingDisplayMode( glimpParms_t parms ) { common->Printf( "No suitable display mode available.\n"); return nil; } - + return [displayModes objectAtIndex: bestModeIndex]; } @@ -1580,7 +1580,7 @@ NSDictionary *Sys_GetMatchingDisplayMode( glimpParms_t parms ) { void Sys_GetGammaTable(glwgamma_t *table) { CGTableCount tableSize = 512; CGDisplayErr err; - + table->tableSize = tableSize; if (table->red) free(table->red); @@ -1591,7 +1591,7 @@ void Sys_GetGammaTable(glwgamma_t *table) { if (table->blue) free(table->blue); table->blue = (float *)malloc(tableSize * sizeof(*table->blue)); - + // TJW: We _could_ loop here if we get back the same size as our table, increasing the table size. err = CGGetDisplayTransferByTable(table->display, tableSize, table->red, table->green, table->blue, &table->tableSize); @@ -1612,7 +1612,7 @@ void Sys_StoreGammaTables() { err = CGGetActiveDisplayList(MAX_DISPLAYS, displays, &glw_state.displayCount); if (err != CGDisplayNoErr) Sys_Error("Cannot get display list -- CGGetActiveDisplayList returned %d.\n", err); - + glw_state.originalDisplayGammaTables = (glwgamma_t *)calloc(glw_state.displayCount, sizeof(*glw_state.originalDisplayGammaTables)); for (displayIndex = 0; displayIndex < glw_state.displayCount; displayIndex++) { glwgamma_t *table; @@ -1629,16 +1629,16 @@ void Sys_SetScreenFade(glwgamma_t *table, float fraction) { CGTableCount tableSize; CGGammaValue *red, *blue, *green; CGTableCount gammaIndex; - + // if (!glConfig.deviceSupportsGamma) // return; if (!(tableSize = table->tableSize)) // we couldn't get the table for this display for some reason return; - + // common->Printf("0x%08x %f\n", table->display, fraction); - + red = glw_state.tempTable.red; green = glw_state.tempTable.green; blue = glw_state.tempTable.blue; @@ -1657,7 +1657,7 @@ void Sys_SetScreenFade(glwgamma_t *table, float fraction) { blue[gammaIndex] = table->blue[gammaIndex] * fraction; green[gammaIndex] = table->green[gammaIndex] * fraction; } - + CGSetDisplayTransferByTable(table->display, table->tableSize, red, green, blue); } @@ -1670,12 +1670,12 @@ void Sys_FadeScreens() { glwgamma_t *table; NSTimeInterval start, current; float time; - + // if (!glConfig.deviceSupportsGamma) // return; common->Printf("Fading all displays\n"); - + start = [NSDate timeIntervalSinceReferenceDate]; time = 0.0; while (time != FADE_DURATION) { @@ -1683,8 +1683,8 @@ void Sys_FadeScreens() { time = current - start; if (time > FADE_DURATION) time = FADE_DURATION; - - for (displayIndex = 0; displayIndex < glw_state.displayCount; displayIndex++) { + + for (displayIndex = 0; displayIndex < glw_state.displayCount; displayIndex++) { table = &glw_state.originalDisplayGammaTables[displayIndex]; Sys_SetScreenFade(table, 1.0 - time / FADE_DURATION); } @@ -1697,9 +1697,9 @@ void Sys_FadeScreen(CGDirectDisplayID display) { int stepIndex; common->Printf( "FIXME: Sys_FadeScreen\n" ); - + return; - + // if (!glConfig.deviceSupportsGamma) // return; @@ -1709,7 +1709,7 @@ void Sys_FadeScreen(CGDirectDisplayID display) { if (display == glw_state.originalDisplayGammaTables[displayIndex].display) { NSTimeInterval start, current; float time; - + start = [NSDate timeIntervalSinceReferenceDate]; time = 0.0; @@ -1737,12 +1737,12 @@ void Sys_UnfadeScreens() { float time; common->Printf( "FIXME: Sys_UnfadeScreens\n" ); - + return; - + // if (!glConfig.deviceSupportsGamma) // return; - + common->Printf("Unfading all displays\n"); start = [NSDate timeIntervalSinceReferenceDate]; @@ -1752,8 +1752,8 @@ void Sys_UnfadeScreens() { time = current - start; if (time > FADE_DURATION) time = FADE_DURATION; - - for (displayIndex = 0; displayIndex < glw_state.displayCount; displayIndex++) { + + for (displayIndex = 0; displayIndex < glw_state.displayCount; displayIndex++) { table = &glw_state.originalDisplayGammaTables[displayIndex]; Sys_SetScreenFade(table, time / FADE_DURATION); } @@ -1763,24 +1763,24 @@ void Sys_UnfadeScreens() { void Sys_UnfadeScreen(CGDirectDisplayID display, glwgamma_t *table) { CGDisplayCount displayIndex; int stepIndex; - + common->Printf( "FIXME: Sys_UnfadeScreen\n" ); return; // if (!glConfig.deviceSupportsGamma) // return; - + common->Printf("Unfading display 0x%08x\n", display); if (table) { CGTableCount i; - + common->Printf("Given table:\n"); for (i = 0; i < table->tableSize; i++) { common->Printf(" %f %f %f\n", table->red[i], table->blue[i], table->green[i]); } } - + // Search for the original gamma table for the display if (!table) { for (displayIndex = 0; displayIndex < glw_state.displayCount; displayIndex++) { @@ -1790,11 +1790,11 @@ void Sys_UnfadeScreen(CGDirectDisplayID display, glwgamma_t *table) { } } } - + if (table) { NSTimeInterval start, current; float time; - + start = [NSDate timeIntervalSinceReferenceDate]; time = 0.0; @@ -1807,7 +1807,7 @@ void Sys_UnfadeScreen(CGDirectDisplayID display, glwgamma_t *table) { } return; } - + common->Printf("Unable to find display to unfade it\n"); } @@ -1816,17 +1816,17 @@ void Sys_UnfadeScreen(CGDirectDisplayID display, glwgamma_t *table) { CGDirectDisplayID Sys_DisplayToUse(void) { static bool gotDisplay = NO; static CGDirectDisplayID displayToUse; - + CGDisplayErr err; CGDirectDisplayID displays[MAX_DISPLAYS]; CGDisplayCount displayCount; int displayIndex; - + if ( gotDisplay ) { return displayToUse; } - gotDisplay = YES; - + gotDisplay = YES; + err = CGGetActiveDisplayList( MAX_DISPLAYS, displays, &displayCount ); if ( err != CGDisplayNoErr ) { common->Error("Cannot get display list -- CGGetActiveDisplayList returned %d.\n", err ); @@ -1834,7 +1834,7 @@ CGDirectDisplayID Sys_DisplayToUse(void) { // -1, the default, means to use the main screen displayIndex = r_screen.GetInteger(); - + if ( displayIndex < 0 || displayIndex >= displayCount ) { // This is documented (in CGDirectDisplay.h) to be the main display. We want to // return this instead of kCGDirectMainDisplay since this will allow us to compare diff --git a/neo/sys/osx/macosx_local.h b/neo/sys/osx/macosx_local.h index 9422d83e..e72ceb27 100644 --- a/neo/sys/osx/macosx_local.h +++ b/neo/sys/osx/macosx_local.h @@ -6,8 +6,8 @@ void OutputDebugString( const char *text ); // input -void Sys_InitInput( void ); -void Sys_ShutdownInput( void ); +void Sys_InitInput( void ); +void Sys_ShutdownInput( void ); void IN_DeactivateMouse( void); void IN_ActivateMouse( void); diff --git a/neo/sys/osx/macosx_misc.mm b/neo/sys/osx/macosx_misc.mm index 3486905b..a964685a 100644 --- a/neo/sys/osx/macosx_misc.mm +++ b/neo/sys/osx/macosx_misc.mm @@ -2,7 +2,7 @@ =========================================================================== Doom 3 GPL Source Code -Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. +Copyright (C) 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,8 +47,8 @@ void idSysLocal::OpenURL( const char *url, bool doexit ) { common->Printf("Open URL: %s\n", url); - - [[ NSWorkspace sharedWorkspace] openURL: [ NSURL URLWithString: + + [[ NSWorkspace sharedWorkspace] openURL: [ NSURL URLWithString: [ NSString stringWithCString: url ] ] ]; if ( doexit ) { diff --git a/neo/sys/osx/macosx_sound.cpp b/neo/sys/osx/macosx_sound.cpp index 5c472df0..1fbb4be4 100644 --- a/neo/sys/osx/macosx_sound.cpp +++ b/neo/sys/osx/macosx_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"). @@ -37,23 +37,23 @@ idCVar s_device( "s_device", "-1", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_INTEGER, "S class idAudioHardwareOSX : public idAudioHardware { public: idAudioHardwareOSX(); - ~idAudioHardwareOSX(); + ~idAudioHardwareOSX(); - bool Initialize( ); + bool Initialize( ); // OSX driver doesn't support memory map API bool Lock( void **pDSLockedBuffer, ulong *dwDSLockedBufferSize ) { return false; } bool Unlock( void *pDSLockedBuffer, dword dwDSLockedBufferSize ) { return false; } bool GetCurrentPosition( ulong *pdwCurrentWriteCursor ) { return false; } int GetMixBufferSize( void ) { return 0; } - + int GetNumberOfSpeakers( void ); // OSX driver doesn't support write API bool Flush( void ) { return false; } void Write( bool ) { } short* GetMixBuffer( void ) { return NULL; } - + private: AudioDeviceID selectedDevice; bool activeIOProc; @@ -65,7 +65,7 @@ private: // AudioDevicePropertyListenerProc static OSStatus DeviceListener( AudioDeviceID inDevice, - UInt32 inChannel, + UInt32 inChannel, Boolean isInput, AudioDevicePropertyID inPropertyID, void* inClientData ); @@ -75,7 +75,7 @@ private: const AudioTimeStamp* inNow, const AudioBufferList* inInputData, const AudioTimeStamp* inInputTime, - AudioBufferList* outOutputData, + AudioBufferList* outOutputData, const AudioTimeStamp* inOutputTime, void* inClientData ); }; @@ -139,8 +139,8 @@ void idAudioHardwareOSX::Reset() { /* ================= idAudioHardwareOSX::InitFailed -================= -*/ +================= +*/ void idAudioHardwareOSX::InitFailed() { Reset(); cvarSystem->SetCVarBool( "s_noSound", true ); @@ -171,7 +171,7 @@ OSStatus idAudioHardwareOSX::DeviceIOProc( AudioDeviceID inDevice, const AudioTimeStamp* inNow, const AudioBufferList* inInputData, const AudioTimeStamp* inInputTime, - AudioBufferList* outOutputData, + AudioBufferList* outOutputData, const AudioTimeStamp* inOutputTime, void* inClientData ) { @@ -300,7 +300,7 @@ bool idAudioHardwareOSX::Initialize( ) { GetAvailableNominalSampleRates(); sampleRate = PRIMARYFREQ; - common->Printf( "setting rate to: %g\n", sampleRate ); + common->Printf( "setting rate to: %g\n", sampleRate ); status = AudioDeviceSetProperty( selectedDevice, NULL, 0, false, kAudioDevicePropertyNominalSampleRate, size, &sampleRate ); if ( status != kAudioHardwareNoError ) { common->Warning( "AudioDeviceSetProperty %d kAudioDevicePropertyNominalSampleRate %g failed. status: %s", selectedDevice, sampleRate, ExtractStatus( status ) ); @@ -354,7 +354,7 @@ bool idAudioHardwareOSX::Initialize( ) { } UInt32 channels[ 2 ]; size = 2 * sizeof( UInt32 ); - status = AudioDeviceGetProperty( selectedDevice, 0, false, kAudioDevicePropertyPreferredChannelsForStereo, &size, &channels ); + status = AudioDeviceGetProperty( selectedDevice, 0, false, kAudioDevicePropertyPreferredChannelsForStereo, &size, &channels ); if ( status != kAudioHardwareNoError ) { common->Warning( "AudioDeviceGetProperty %d kAudioDevicePropertyPreferredChannelsForStereo failed. status: %s", selectedDevice, ExtractStatus( status ) ); InitFailed(); @@ -396,7 +396,7 @@ idAudioHardwareOSX::GetAvailableNominalSampleRates void idAudioHardwareOSX::GetAvailableNominalSampleRates( void ) { UInt32 size; OSStatus status; - int i, rangeCount; + int i, rangeCount; AudioValueRange *rangeArray; status = AudioDeviceGetPropertyInfo( selectedDevice, 0, false, kAudioDevicePropertyAvailableNominalSampleRates, &size, NULL ); diff --git a/neo/sys/osx/macosx_sys.h b/neo/sys/osx/macosx_sys.h index 7dcf08bb..0968726b 100644 --- a/neo/sys/osx/macosx_sys.h +++ b/neo/sys/osx/macosx_sys.h @@ -25,42 +25,42 @@ bool Sys_Hide(); bool Sys_Unhide(); typedef struct { - CGDirectDisplayID display; - CGTableCount tableSize; - CGGammaValue *red; - CGGammaValue *blue; - CGGammaValue *green; + CGDirectDisplayID display; + CGTableCount tableSize; + CGGammaValue *red; + CGGammaValue *blue; + CGGammaValue *green; } glwgamma_t; typedef struct { - CGDirectDisplayID display; - NSDictionary *desktopMode; - NSDictionary *gameMode; + CGDirectDisplayID display; + NSDictionary *desktopMode; + NSDictionary *gameMode; - CGDisplayCount displayCount; - glwgamma_t *originalDisplayGammaTables; - glwgamma_t inGameTable; - glwgamma_t tempTable; - - NSOpenGLContext *_ctx; - CGLContextObj _cgl_ctx; - bool _ctx_is_current; - NSWindow *window; - - FILE *log_fp; - - unsigned int bufferSwapCount; - unsigned int glPauseCount; + CGDisplayCount displayCount; + glwgamma_t *originalDisplayGammaTables; + glwgamma_t inGameTable; + glwgamma_t tempTable; + + NSOpenGLContext *_ctx; + CGLContextObj _cgl_ctx; + bool _ctx_is_current; + NSWindow *window; + + FILE *log_fp; + + unsigned int bufferSwapCount; + unsigned int glPauseCount; } glwstate_t; extern glwstate_t glw_state; #define OSX_SetGLContext(context) \ do { \ - NSOpenGLContext *_context = (context); \ - glw_state._ctx = _context; \ - glw_state._cgl_ctx = [_context cglContext]; \ + NSOpenGLContext *_context = (context); \ + glw_state._ctx = _context; \ + glw_state._cgl_ctx = [_context cglContext]; \ } while (0) #define OSX_GetNSGLContext() glw_state._ctx diff --git a/neo/sys/osx/macosx_sys.mm b/neo/sys/osx/macosx_sys.mm index ab239614..872fc417 100644 --- a/neo/sys/osx/macosx_sys.mm +++ b/neo/sys/osx/macosx_sys.mm @@ -2,7 +2,7 @@ =========================================================================== Doom 3 GPL Source Code -Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. +Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). @@ -59,13 +59,13 @@ void Sys_Print( const char *msg ); //=========================================================================== int main(int argc, const char *argv[]) { - return NSApplicationMain(argc, argv); + return NSApplicationMain(argc, argv); } //=========================================================================== void Sys_Sleep( const int time ) { - sleep( time ); + sleep( time ); } void EditorPrintConsole( const char *test ) { @@ -90,29 +90,29 @@ Used to load a development dll instead of a virtual machine extern char *FS_BuildOSPath( const char *base, const char *game, const char *qpath ); void *Sys_LoadDll( const char *name, int (**entryPoint)(int, ...), - int (*systemcalls)(int, ...) ) + int (*systemcalls)(int, ...) ) { - return NULL; + return NULL; } //=========================================================================== char *Sys_GetClipboardData(void) // FIXME { - NSPasteboard *pasteboard; - NSArray *pasteboardTypes; + NSPasteboard *pasteboard; + NSArray *pasteboardTypes; - pasteboard = [NSPasteboard generalPasteboard]; - pasteboardTypes = [pasteboard types]; - if ([pasteboardTypes containsObject:NSStringPboardType]) { - NSString *clipboardString; + pasteboard = [NSPasteboard generalPasteboard]; + pasteboardTypes = [pasteboard types]; + if ([pasteboardTypes containsObject:NSStringPboardType]) { + NSString *clipboardString; - clipboardString = [pasteboard stringForType:NSStringPboardType]; - if (clipboardString && [clipboardString length] > 0) { - return strdup([clipboardString cString]); - } - } - return NULL; + clipboardString = [pasteboard stringForType:NSStringPboardType]; + if (clipboardString && [clipboardString length] > 0) { + return strdup([clipboardString cString]); + } + } + return NULL; } //=========================================================================== @@ -137,7 +137,7 @@ The cvar and file system has been setup, so configurations are loaded void Sys_Init(void) { // Sys_InitNetwork(); - Sys_InitInput(); + Sys_InitInput(); } /* @@ -147,33 +147,33 @@ Sys_Shutdown */ void Sys_Shutdown(void) { - common->Printf( "----- Sys_Shutdown -----\n" ); - Sys_EndProfiling(); - Sys_ShutdownInput(); - common->Printf( "------------------------\n" ); + common->Printf( "----- Sys_Shutdown -----\n" ); + Sys_EndProfiling(); + Sys_ShutdownInput(); + common->Printf( "------------------------\n" ); } void Sys_Error(const char *error, ...) { - va_list argptr; - NSString *formattedString; + va_list argptr; + NSString *formattedString; - Sys_Shutdown(); + Sys_Shutdown(); - va_start(argptr,error); - formattedString = [[NSString alloc] initWithFormat:[NSString stringWithCString:error] arguments:argptr]; - va_end(argptr); + va_start(argptr,error); + formattedString = [[NSString alloc] initWithFormat:[NSString stringWithCString:error] arguments:argptr]; + va_end(argptr); - NSLog(@"Sys_Error: %@", formattedString); - NSRunAlertPanel(@"DOOM Error", formattedString, nil, nil, nil); + NSLog(@"Sys_Error: %@", formattedString); + NSRunAlertPanel(@"DOOM Error", formattedString, nil, nil, nil); - Sys_Quit(); + Sys_Quit(); } void Sys_Quit(void) { - Sys_Shutdown(); - [NSApp terminate:nil]; + Sys_Shutdown(); + [NSApp terminate:nil]; } /* @@ -194,7 +194,7 @@ char *ansiColors[8] = "\033[36m" , /* ANSI Cyan */ "\033[35m" , /* ANSI Magenta */ "\033[37m" }; /* ANSI White */ - + void Sys_Print(const char *text) { #if 0 @@ -202,29 +202,29 @@ void Sys_Print(const char *text) char *scan = text; char code; int index; - + /* Make sure terminal mode is reset at the start of the line... */ fputs("\033[0m", stdout); - + while(*scan) { - /* See if we have a color control code. If so, snarf the character, + /* See if we have a color control code. If so, snarf the character, print what we have so far, print the ANSI Terminal color code, skip over the color control code and continue */ if(Q_IsColorString(scan)) { index = ColorIndex(scan[1]); - + /* Flush current message */ if(scan != text) { fwrite(text, scan - text, 1, stdout); } - + /* Write ANSI color code */ fputs(ansiColors[index], stdout); - + /* Reset search */ text = scan+2; scan = text; - continue; + continue; } scan++; } @@ -236,16 +236,16 @@ void Sys_Print(const char *text) fputs("\033[0m", stdout); #else - fputs(text, stdout); -#endif + fputs(text, stdout); +#endif } void OutputDebugString( const char *text ) { - Sys_Print( text ); + Sys_Print( text ); } void Sys_OutputDebugString( const char *text ) { - OutputDebugString( text ); + OutputDebugString( text ); } /* @@ -256,5 +256,5 @@ Return true if the proper CD is in the drive ================ */ bool Sys_CheckCD( void ) { - return macosx_scanForLibraryDirectory() != NULL; + return macosx_scanForLibraryDirectory() != NULL; } diff --git a/neo/sys/osx/macosx_utils.mm b/neo/sys/osx/macosx_utils.mm index 145cb10a..f714c328 100644 --- a/neo/sys/osx/macosx_utils.mm +++ b/neo/sys/osx/macosx_utils.mm @@ -2,7 +2,7 @@ =========================================================================== Doom 3 GPL Source Code -Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. +Copyright (C) 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 @@ If you have questions concerning this license or the applicable additional terms const char *macosx_scanForLibraryDirectory(void) { - return "/Library/DOOM"; + return "/Library/DOOM"; } // EEEK! @@ -52,65 +52,65 @@ static long size_save; void *osxAllocateMemoryNV(long size, float readFrequency, float writeFrequency, float priority) { - kern_return_t kr; - vm_address_t buffer; - - kr = vm_allocate(mach_task_self(), - (vm_address_t *)&buffer, - size, - VM_FLAGS_ANYWHERE); - if(kr == 0) { - size_save = size; - return buffer; - } - else - { - size_save = 0; - return NULL; - } + kern_return_t kr; + vm_address_t buffer; + + kr = vm_allocate(mach_task_self(), + (vm_address_t *)&buffer, + size, + VM_FLAGS_ANYWHERE); + if(kr == 0) { + size_save = size; + return buffer; + } + else + { + size_save = 0; + return NULL; + } } void osxFreeMemoryNV(void *pointer) { - if(size_save) { - vm_deallocate(mach_task_self(), - (vm_address_t)pointer, - size_save); - size_save = 0; - } + if(size_save) { + vm_deallocate(mach_task_self(), + (vm_address_t)pointer, + size_save); + size_save = 0; + } } void *osxAllocateMemory(long size) { - kern_return_t kr; - vm_address_t buffer; - - size += sizeof( int ); - kr = vm_allocate(mach_task_self(), - (vm_address_t *)&buffer, - size, - VM_FLAGS_ANYWHERE); - if(kr == 0) { - int *ptr = buffer; - *ptr = size; - ptr = ptr + 1; - return ptr; - } - else - { - return NULL; - } + kern_return_t kr; + vm_address_t buffer; + + size += sizeof( int ); + kr = vm_allocate(mach_task_self(), + (vm_address_t *)&buffer, + size, + VM_FLAGS_ANYWHERE); + if(kr == 0) { + int *ptr = buffer; + *ptr = size; + ptr = ptr + 1; + return ptr; + } + else + { + return NULL; + } } void osxFreeMemory(void *pointer) { - int size; - int *ptr = pointer; - ptr = ptr - 1; - size = *ptr; - vm_deallocate(mach_task_self(), (vm_address_t)ptr, size); + int size; + int *ptr = pointer; + ptr = ptr - 1; + size = *ptr; + vm_deallocate(mach_task_self(), (vm_address_t)ptr, size); } static inline void __eieio(void) @@ -130,39 +130,39 @@ static inline void __isync(void) static inline void __dcbf(void *base, unsigned long offset) { - __asm__ ("dcbf %0, %1" - : - : "r" (base), "r" (offset) - : "r0"); + __asm__ ("dcbf %0, %1" + : + : "r" (base), "r" (offset) + : "r0"); } static inline void __dcbst(void *base, unsigned long offset) { - __asm__ ("dcbst %0, %1" - : - : "r" (base), "r" (offset) - : "r0"); + __asm__ ("dcbst %0, %1" + : + : "r" (base), "r" (offset) + : "r0"); } static inline void __dcbz(void *base, unsigned long offset) { - __asm__ ("dcbz %0, %1" - : - : "r" (base), "r" (offset) - : "r0"); + __asm__ ("dcbz %0, %1" + : + : "r" (base), "r" (offset) + : "r0"); } void Sys_FlushCacheMemory( void *base, int bytes ) { unsigned long i; - - for(i = 0; i < bytes; i+= 32) { - __dcbf(base,i); - } - __sync(); - __isync(); - __dcbf(base, i); - __sync(); - __isync(); - *(volatile unsigned long *)(base + i); - __isync(); + + for(i = 0; i < bytes; i+= 32) { + __dcbf(base,i); + } + __sync(); + __isync(); + __dcbf(base, i); + __sync(); + __isync(); + *(volatile unsigned long *)(base + i); + __isync(); } diff --git a/neo/sys/osx/showcursor.c b/neo/sys/osx/showcursor.c index cb889102..e4cc4fc8 100644 --- a/neo/sys/osx/showcursor.c +++ b/neo/sys/osx/showcursor.c @@ -10,45 +10,45 @@ mach_port_t masterPort; io_connect_t OpenEventDriver( void ) { - register kern_return_t kr; - mach_port_t ev, service, iter; + register kern_return_t kr; + mach_port_t ev, service, iter; - kr = IOServiceGetMatchingServices( masterPort, IOServiceMatching( kIOHIDSystemClass ), &iter); - assert( KERN_SUCCESS == kr); + kr = IOServiceGetMatchingServices( masterPort, IOServiceMatching( kIOHIDSystemClass ), &iter); + assert( KERN_SUCCESS == kr); - service = IOIteratorNext( iter ); - assert(service); + service = IOIteratorNext( iter ); + assert(service); - kr = IOServiceOpen( service, mach_task_self(), kIOHIDParamConnectType, &ev); - assert( KERN_SUCCESS == kr ); + kr = IOServiceOpen( service, mach_task_self(), kIOHIDParamConnectType, &ev); + assert( KERN_SUCCESS == kr ); - IOObjectRelease( service ); - IOObjectRelease( iter ); + IOObjectRelease( service ); + IOObjectRelease( iter ); - return( ev ); + return( ev ); } void TestParams( io_connect_t ev, boolean_t show ) { - kern_return_t kr; + kern_return_t kr; - kr = IOHIDSetCursorEnable( ev, show ); - assert(KERN_SUCCESS == kr); + kr = IOHIDSetCursorEnable( ev, show ); + assert(KERN_SUCCESS == kr); } int main(int argc, char **argv) { - kern_return_t kr; - boolean_t show; + kern_return_t kr; + boolean_t show; - if (argc != 2) - show = 1; - else - show = (atoi(argv[0]) != 0); + if (argc != 2) + show = 1; + else + show = (atoi(argv[0]) != 0); - assert( KERN_SUCCESS == ( kr = IOMasterPort( bootstrap_port, &masterPort) )); - TestParams( OpenEventDriver(), show); + assert( KERN_SUCCESS == ( kr = IOMasterPort( bootstrap_port, &masterPort) )); + TestParams( OpenEventDriver(), show); - return( 0 ); + return( 0 ); } diff --git a/neo/sys/posix/posix_input.cpp b/neo/sys/posix/posix_input.cpp index fe7083d2..ec4e5f13 100644 --- a/neo/sys/posix/posix_input.cpp +++ b/neo/sys/posix/posix_input.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 typedef struct poll_keyboard_event_s { int key; - bool state; + bool state; } poll_keyboard_event_t; typedef struct poll_mouse_event_s @@ -105,7 +105,7 @@ int Sys_ReturnKeyboardInputEvent( const int n, int &key, bool &state ) { void Sys_EndKeyboardInputEvents( void ) { //isn't this were it's supposed to be, was missing some key strokes with it set below - poll_keyboard_event_count = 0; + poll_keyboard_event_count = 0; } int Sys_PollMouseInputEvents( void ) { diff --git a/neo/sys/posix/posix_main.cpp b/neo/sys/posix/posix_main.cpp index 3fb6ecf7..db521308 100644 --- a/neo/sys/posix/posix_main.cpp +++ b/neo/sys/posix/posix_main.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"). @@ -156,13 +156,13 @@ Sys_Milliseconds ================ */ /* base time in seconds, that's our origin - timeval:tv_sec is an int: + timeval:tv_sec is an int: assuming this wraps every 0x7fffffff - ~68 years since the Epoch (1970) - we're safe till 2038 using unsigned long data type to work right with Sys_XTimeToSysTime */ unsigned long sys_timeBase = 0; /* current time in ms, using sys_timeBase as origin NOTE: sys_timeBase*1000 + curtime -> ms since the Epoch - 0x7fffffff ms - ~24 days + 0x7fffffff ms - ~24 days or is it 48 days? the specs say int, but maybe it's casted from unsigned int? */ int Sys_Milliseconds( void ) { @@ -202,20 +202,20 @@ int Sys_ListFiles( const char *directory, const char *extension, idStrList &list char search[MAX_OSPATH]; struct stat st; bool debug; - + list.Clear(); debug = cvarSystem->GetCVarBool( "fs_debug" ); - + if (!extension) extension = ""; - + // passing a slash as extension will find directories if (extension[0] == '/' && extension[1] == 0) { extension = ""; dironly = true; } - + // search // NOTE: case sensitivity of directory path can screw us up here if ((fdir = opendir(directory)) == NULL) { @@ -224,7 +224,7 @@ int Sys_ListFiles( const char *directory, const char *extension, idStrList &list } return -1; } - + while ((d = readdir(fdir)) != NULL) { idStr::snPrintf(search, sizeof(search), "%s/%s", directory, d->d_name); if (stat(search, &st) == -1) @@ -245,11 +245,11 @@ int Sys_ListFiles( const char *directory, const char *extension, idStrList &list } closedir(fdir); - + if ( debug ) { common->Printf( "Sys_ListFiles: %d entries in %s\n", list.Num(), directory ); } - + return list.Num(); } @@ -460,7 +460,7 @@ char *Sys_GetClipboardData(void) { void Sys_SetClipboardData( const char *string ) { Sys_Printf( "TODO: Sys_SetClipboardData\n" ); } - + // stub pretty much everywhere - heavy calling void Sys_FlushCacheMemory(void *base, int bytes) @@ -589,11 +589,11 @@ void Posix_InitConsoleInput( void ) { /* ECHO: don't echo input characters ICANON: enable canonical mode. This enables the special - characters EOF, EOL, EOL2, ERASE, KILL, REPRINT, - STATUS, and WERASE, and buffers by lines. + characters EOF, EOL, EOL2, ERASE, KILL, REPRINT, + STATUS, and WERASE, and buffers by lines. ISIG: when any of the characters INTR, QUIT, SUSP, or - DSUSP are received, generate the corresponding signal - */ + DSUSP are received, generate the corresponding signal + */ tc.c_lflag &= ~(ECHO | ICANON); /* ISTRIP strip off bit 8 @@ -825,7 +825,7 @@ char *Posix_ConsoleInput( void ) { } // all terms input_field.KeyDownEvent( K_INS ); - break; + break; } case 52: { ret = read( STDIN_FILENO, &key, 1 ); @@ -857,7 +857,7 @@ char *Posix_ConsoleInput( void ) { tty_FlushIn(); assert( hidden ); tty_Show(); - return NULL; + return NULL; } case 65: case 66: { @@ -883,7 +883,7 @@ char *Posix_ConsoleInput( void ) { int index = -1; if ( history_current == 0 ) { input_field = history_backup; - } else { + } else { index = history_start + Min( COMMAND_HISTORY, history_count ) - history_current; index %= COMMAND_HISTORY; assert( index >= 0 && index < COMMAND_HISTORY ); diff --git a/neo/sys/posix/posix_net.cpp b/neo/sys/posix/posix_net.cpp index 9f1792f4..30ef44dc 100644 --- a/neo/sys/posix/posix_net.cpp +++ b/neo/sys/posix/posix_net.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"). @@ -56,7 +56,7 @@ typedef struct { unsigned long mask; } net_interface; -#define MAX_INTERFACES 32 +#define MAX_INTERFACES 32 int num_interfaces = 0; net_interface netint[MAX_INTERFACES]; @@ -151,8 +151,8 @@ static bool StringToSockaddr( const char *s, struct sockaddr_in *sadr, bool doDN // try to remove the port first, otherwise the DNS gets confused into multiple timeouts // failed or not failed, buf is expected to contain the appropriate host to resolve if ( ExtractPort( s, buf, sizeof( buf ), &port ) ) { - sadr->sin_port = htons( port ); - } + sadr->sin_port = htons( port ); + } if ( !( h = gethostbyname( buf ) ) ) { return false; } @@ -278,14 +278,14 @@ void Sys_InitNetworking(void) #if MACOS_X unsigned int ip, mask; struct ifaddrs *ifap, *ifp; - + num_interfaces = 0; - + if( getifaddrs( &ifap ) < 0 ) { common->FatalError( "InitNetworking: SIOCGIFCONF error - %s\n", strerror( errno ) ); return; } - + for( ifp = ifap; ifp; ifp = ifp->ifa_next ) { if ( ifp->ifa_addr->sa_family != AF_INET ) continue; @@ -298,10 +298,10 @@ void Sys_InitNetworking(void) if ( !ifp->ifa_netmask ) continue; - + ip = ntohl( *( unsigned long *)&ifp->ifa_addr->sa_data[2] ); mask = ntohl( *( unsigned long *)&ifp->ifa_netmask->sa_data[2] ); - + if ( ip == INADDR_LOOPBACK ) { common->Printf( "loopback\n" ); } else { @@ -343,7 +343,7 @@ void Sys_InitNetworking(void) // find the type - ignore interfaces for which we can find we can't get IP and mask ( not configured ) ifr = (ifreq*)( ifc.ifc_buf + ifindex ); if ( ioctl( s, SIOCGIFADDR, ifr ) < 0 ) { - common->Printf( "SIOCGIFADDR failed: %s\n", strerror( errno ) ); + common->Printf( "SIOCGIFADDR failed: %s\n", strerror( errno ) ); } else { if ( ifr->ifr_addr.sa_family != AF_INET ) { common->Printf( "not AF_INET\n" ); @@ -488,11 +488,11 @@ bool idPort::GetPacket( netadr_t &net_from, void *data, int &size, int maxSize ) int ret; struct sockaddr_in from; int fromlen; - + if ( !netSocket ) { return false; } - + fromlen = sizeof( from ); ret = recvfrom( netSocket, data, maxSize, 0, (struct sockaddr *) &from, (socklen_t *) &fromlen ); @@ -521,7 +521,7 @@ bool idPort::GetPacketBlocking( netadr_t &net_from, void *data, int &size, int m fd_set set; struct timeval tv; int ret; - + if ( !netSocket ) { return false; } @@ -641,31 +641,31 @@ bool idTCP::Init( const char *host, short port ) { if (!address.port) { address.port = port; } - common->Printf( "\"%s\" resolved to %i.%i.%i.%i:%i\n", host, + common->Printf( "\"%s\" resolved to %i.%i.%i.%i:%i\n", host, address.ip[0], address.ip[1], address.ip[2], address.ip[3], address.port ); NetadrToSockadr(&address, &sadr); if (fd) { common->Warning("idTCP::Init: already initialized?\n"); } - + if ((fd = socket(PF_INET, SOCK_STREAM, 0)) == -1) { fd = 0; common->Printf("ERROR: idTCP::Init: socket: %s\n", strerror(errno)); return false; } - + if ( connect( fd, (const sockaddr *)&sadr, sizeof( sadr ) ) == -1 ) { - common->Printf( "ERROR: idTCP::Init: connect: %s\n", strerror( errno ) ); + common->Printf( "ERROR: idTCP::Init: connect: %s\n", strerror( errno ) ); close( fd ); fd = 0; return false; } - + int status; if ((status = fcntl(fd, F_GETFL, 0)) != -1) { - status |= O_NONBLOCK; /* POSIX */ - status = fcntl(fd, F_SETFL, status); + status |= O_NONBLOCK; /* POSIX */ + status = fcntl(fd, F_SETFL, status); } if (status == -1) { common->Printf("ERROR: idTCP::Init: fcntl / O_NONBLOCK: %s\n", strerror(errno)); @@ -673,7 +673,7 @@ bool idTCP::Init( const char *host, short port ) { fd = 0; return false; } - + common->DPrintf("Opened TCP connection\n"); return true; } @@ -697,7 +697,7 @@ idTCP::Read */ int idTCP::Read(void *data, int size) { int nbytes; - + if (!fd) { common->Printf("idTCP::Read: not initialized\n"); return -1; @@ -719,13 +719,13 @@ int idTCP::Read(void *data, int size) { Close(); return -1; } - + // a successful read of 0 bytes indicates remote has closed the connection if ( nbytes == 0 ) { common->DPrintf( "idTCP::Read: read 0 bytes - assume connection closed\n" ); return -1; } - + return nbytes; } @@ -741,31 +741,31 @@ static void got_SIGPIPE( int signum ) { int idTCP::Write(void *data, int size) { int nbytes; - + if ( !fd ) { common->Printf( "idTCP::Write: not initialized\n"); return -1; } - + struct sigaction bak_action; struct sigaction action; action.sa_handler = got_SIGPIPE; sigemptyset( &action.sa_mask ); action.sa_flags = 0; - + if ( sigaction( SIGPIPE, &action, &bak_action ) != 0 ) { common->Printf( "ERROR: idTCP::Write: failed to set temporary SIGPIPE handler\n" ); Close(); return -1; } -#if defined(_GNU_SOURCE) +#if defined(_GNU_SOURCE) // handle EINTR interrupted system call with TEMP_FAILURE_RETRY - this is probably GNU libc specific if ( ( nbytes = TEMP_FAILURE_RETRY ( write( fd, data, size ) ) ) == -1 ) { #else do { - nbytes = write( fd, data, size ); + nbytes = write( fd, data, size ); } while ( nbytes == -1 && errno == EINTR ); if ( nbytes == -1 ) { #endif @@ -773,12 +773,12 @@ int idTCP::Write(void *data, int size) { Close(); return -1; } - + if ( sigaction( SIGPIPE, &bak_action, NULL ) != 0 ) { common->Printf( "ERROR: idTCP::Write: failed to reset SIGPIPE handler\n" ); Close(); return -1; } - - return nbytes; + + return nbytes; } diff --git a/neo/sys/posix/posix_public.h b/neo/sys/posix/posix_public.h index 82e92595..97193d0a 100644 --- a/neo/sys/posix/posix_public.h +++ b/neo/sys/posix/posix_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"). @@ -63,4 +63,3 @@ void Sys_DoStartProcess( const char *exeName, bool dofork = true ); // if not f void Sys_AsyncThread( void ); #endif - diff --git a/neo/sys/posix/posix_signal.cpp b/neo/sys/posix/posix_signal.cpp index 5ebbb8cf..01ee758b 100644 --- a/neo/sys/posix/posix_signal.cpp +++ b/neo/sys/posix/posix_signal.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 @@ Posix_ClearSigs void Posix_ClearSigs( ) { struct sigaction action; int i; - + /* Set up the structure */ action.sa_handler = SIG_DFL; sigemptyset( &action.sa_mask ); @@ -94,17 +94,17 @@ sig_handler */ static void sig_handler( int signum, siginfo_t *info, void *context ) { static bool double_fault = false; - + if ( double_fault ) { Sys_Printf( "double fault %s, bailing out\n", strsignal( signum ) ); Posix_Exit( signum ); } - + double_fault = true; - + // NOTE: see sigaction man page, could verbose the whole siginfo_t and print human readable si_code - Sys_Printf( "signal caught: %s\nsi_code %d\n", strsignal( signum ), info->si_code ); - + Sys_Printf( "signal caught: %s\nsi_code %d\n", strsignal( signum ), info->si_code ); + #ifndef ID_BT_STUB Sys_Printf( "callstack:\n%s", Sys_GetCallStackCurStr( 30 ) ); #endif @@ -112,11 +112,11 @@ static void sig_handler( int signum, siginfo_t *info, void *context ) { if ( fatalError[ 0 ] ) { Sys_Printf( "Was in fatal error shutdown: %s\n", fatalError ); } - + Sys_Printf( "Trying to exit gracefully..\n" ); - + Posix_SetExit( signum ); - + common->Quit(); } @@ -130,7 +130,7 @@ void Posix_InitSigs( ) { int i; fatalError[0] = '\0'; - + /* Set up the structure */ action.sa_sigaction = sig_handler; sigemptyset( &action.sa_mask ); @@ -153,7 +153,7 @@ void Posix_InitSigs( ) { // if the process is backgrounded (running non interactively) // then SIGTTIN or SIGTOU could be emitted, if not caught, turns into a SIGSTP signal( SIGTTIN, SIG_IGN ); - signal( SIGTTOU, SIG_IGN ); + signal( SIGTTOU, SIG_IGN ); } /* diff --git a/neo/sys/posix/posix_threads.cpp b/neo/sys/posix/posix_threads.cpp index b6255a1e..75ed045a 100644 --- a/neo/sys/posix/posix_threads.cpp +++ b/neo/sys/posix/posix_threads.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,7 +40,7 @@ If you have questions concerning this license or the applicable additional terms #include "posix_public.h" #if defined(_DEBUG) -// #define ID_VERBOSE_PTHREADS +// #define ID_VERBOSE_PTHREADS #endif /* @@ -60,13 +60,13 @@ Sys_EnterCriticalSection */ void Sys_EnterCriticalSection( int index ) { assert( index >= 0 && index < MAX_LOCAL_CRITICAL_SECTIONS ); -#ifdef ID_VERBOSE_PTHREADS +#ifdef ID_VERBOSE_PTHREADS if ( pthread_mutex_trylock( &global_lock[index] ) == EBUSY ) { Sys_Printf( "busy lock %d in thread '%s'\n", index, Sys_GetThreadName() ); if ( pthread_mutex_lock( &global_lock[index] ) == EDEADLK ) { Sys_Printf( "FATAL: DEADLOCK %d, in thread '%s'\n", index, Sys_GetThreadName() ); } - } + } #else pthread_mutex_lock( &global_lock[index] ); #endif @@ -133,7 +133,7 @@ Sys_TriggerEvent void Sys_TriggerEvent( int index ) { assert( index >= 0 && index < MAX_TRIGGER_EVENTS ); Sys_EnterCriticalSection( MAX_LOCAL_CRITICAL_SECTIONS - 1 ); - if ( waiting[ index ] ) { + if ( waiting[ index ] ) { pthread_cond_signal( &event_cond[ index ] ); } else { // emulate windows behaviour: if no thread is waiting, leave the signal on so next wait keeps going @@ -162,7 +162,7 @@ Sys_CreateThread ================== */ void Sys_CreateThread( xthread_t function, void *parms, xthreadPriority priority, xthreadInfo& info, const char *name, xthreadInfo **threads, int *thread_count ) { - Sys_EnterCriticalSection( ); + Sys_EnterCriticalSection( ); pthread_attr_t attr; pthread_attr_init( &attr ); if ( pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE ) != 0 ) { @@ -287,6 +287,5 @@ void Posix_InitPThreads( ) { // init threads table for ( i = 0; i < MAX_THREADS; i++ ) { g_threads[ i ] = NULL; - } + } } - diff --git a/neo/sys/scons/SConscript.core b/neo/sys/scons/SConscript.core index a55d174d..55ed108e 100644 --- a/neo/sys/scons/SConscript.core +++ b/neo/sys/scons/SConscript.core @@ -145,7 +145,7 @@ aas_string = ' \ AASFileManager.cpp \ Brush.cpp \ BrushBSP.cpp' - + aas_list = scons_utils.BuildList( 'tools/compilers/aas', aas_string ) roq_string = ' \ @@ -258,7 +258,7 @@ local_env.Append( LIBS = [ 'pthread', 'dl', 'jpeg', 'vorbisfile' ] ) if ( local_curl == 1 ): local_env.Append( LIBS = [ 'curl', 'z' ] ) if ( local_dedicated == 0 ): - local_env.Append( LIBS = [ 'X11', 'Xext', 'Xxf86vm' ] ) # 'Xxf86dga', + local_env.Append( LIBS = [ 'X11', 'Xext', 'Xxf86vm' ] ) # 'Xxf86dga', local_env.Append( LIBPATH = [ '/usr/X11R6/lib' ] ) # local_env.Append( LIBS = [ 'openal' ] ) diff --git a/neo/sys/scons/SConscript.game b/neo/sys/scons/SConscript.game index f5d4da0b..9c40d26a 100644 --- a/neo/sys/scons/SConscript.game +++ b/neo/sys/scons/SConscript.game @@ -107,5 +107,3 @@ else: for i in game_list: ret_list += local_env.StaticObject( source = i ) Return( 'ret_list' ) - - diff --git a/neo/sys/scons/SConscript.gl b/neo/sys/scons/SConscript.gl index a7053a19..593c4efb 100644 --- a/neo/sys/scons/SConscript.gl +++ b/neo/sys/scons/SConscript.gl @@ -31,21 +31,21 @@ def build_logfuncs(env, target, source): f_in = open( gllog_path + '/gl.api', 'r') do_logfunc(f_in, f_out) f_in.close() - + f_out.write('\n#ifdef __linux__\n\n') f_in = open( gllog_path + '/glX.api', 'r') do_logfunc(f_in, f_out) f_in.close() f_out.write('\n#endif\n\n') - + f_out.write('\n#ifdef WIN32\n\n') f_in = open( gllog_path + '/wgl.api', 'r') do_logfunc(f_in, f_out) f_in.close() f_out.write('\n#endif\n\n') - + f_out.close() - + print 'Generated %s' % target[0] gl_env = g_env.Clone() diff --git a/neo/sys/scons/SDK.py b/neo/sys/scons/SDK.py index 05bef26b..966c464a 100644 --- a/neo/sys/scons/SDK.py +++ b/neo/sys/scons/SDK.py @@ -3,7 +3,7 @@ import os, sys import scons_utils class idSDK( scons_utils.idSetupBase ): - + def PreBuildSDK( self, build_path ): self.build_path = build_path print 'PreBuildSDK: ' + repr( build_path ) diff --git a/neo/sys/scons/Setup.py b/neo/sys/scons/Setup.py index 42750a76..b659c63f 100644 --- a/neo/sys/scons/Setup.py +++ b/neo/sys/scons/Setup.py @@ -66,7 +66,7 @@ class idSetup( scons_utils.idSetupBase ): if ( demo_build ): self.SimpleCommand( 'cp -R -f sys/linux/setup/image-demo/* ' + base_dirname ) else: - self.SimpleCommand( 'cp -R -f sys/linux/setup/image/* ' + base_dirname ) + self.SimpleCommand( 'cp -R -f sys/linux/setup/image/* ' + base_dirname ) # process M4 stuff if ( demo_build ): m4_dict = { 'M4_PRODUCT' : 'doom3-demo', 'M4_DESC' : 'DOOM III demo', 'M4_VERSION' : '%s.%s' % ( main_version, version ) } @@ -90,7 +90,7 @@ class idSetup( scons_utils.idSetupBase ): # game_zip.write( game_path, 'gamex86.so' ) # game_zip.write( 'sys/linux/setup/binary.conf', 'binary.conf' ) # game_zip.printdir() -# game_zip.close() +# game_zip.close() # print 'zipping together d3xp game01.pk4' # game_zip = zipfile.ZipFile( 'sys/linux/setup/media/d3xp/game01.pk4', 'w', zipfile.ZIP_DEFLATED ) # game_zip.write( d3xp_path, 'gamex86.so' ) @@ -157,4 +157,3 @@ class idSetup( scons_utils.idSetupBase ): self.SimpleCommand( 'rm -rf %s' % temp_dir ) # success return None - diff --git a/neo/sys/scons/scons_utils.py b/neo/sys/scons/scons_utils.py index d8ef9222..a457f0c6 100644 --- a/neo/sys/scons/scons_utils.py +++ b/neo/sys/scons/scons_utils.py @@ -25,10 +25,10 @@ class idBuffering: if ( retval != 0 or not self.silent ): sys.stdout.write( stdout.getvalue() ) sys.stderr.write( stderr.getvalue() ) - return retval + return retval class idSetupBase: - + def SimpleCommand( self, cmd ): print cmd ret = commands.getstatusoutput( cmd ) @@ -50,7 +50,7 @@ class idSetupBase: for ( key, val ) in d.items(): cmd += '--define=%s="%s" ' % ( key, val ) cmd += '%s > %s' % ( file, file_out ) - self.SimpleCommand( cmd ) + self.SimpleCommand( cmd ) def ExtractProtocolVersion( self ): f = open( 'framework/Licensee.h' ) @@ -73,8 +73,8 @@ class idSetupBase: for i in l: if ( p.match( i ) ): minor = p.match( i ).group(1) - break - + break + return '%s.%s' % ( major, minor ) def ExtractEngineVersion( self ): @@ -88,7 +88,7 @@ class idSetupBase: if ( p.match( i ) ): version = p.match( i ).group(1) break - + return version def ExtractBuildVersion( self ): diff --git a/neo/sys/stub/stub_gl.cpp b/neo/sys/stub/stub_gl.cpp index 7700cb28..df742a22 100644 --- a/neo/sys/stub/stub_gl.cpp +++ b/neo/sys/stub/stub_gl.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/neo/sys/stub/sys_stub.cpp b/neo/sys/stub/sys_stub.cpp index 98e365fd..5dba9c0e 100644 --- a/neo/sys/stub/sys_stub.cpp +++ b/neo/sys/stub/sys_stub.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,12 +173,12 @@ int Sys_ListFiles( const char *directory, const char *extension, idStrList &list if (stat(search, &st) == -1) continue; if (!dironly) { - idStr look(search); - idStr ext; - look.ExtractFileExtension( ext ); - if ( extension && extension[0] && ext.Icmp( &extension[1] ) != 0 ) { + idStr look(search); + idStr ext; + look.ExtractFileExtension( ext ); + if ( extension && extension[0] && ext.Icmp( &extension[1] ) != 0 ) { continue; - } + } } if ((dironly && !(st.st_mode & S_IFDIR)) || (!dironly && (st.st_mode & S_IFDIR))) diff --git a/neo/sys/stub/util_stub.cpp b/neo/sys/stub/util_stub.cpp index 180d5ec5..99e710e8 100644 --- a/neo/sys/stub/util_stub.cpp +++ b/neo/sys/stub/util_stub.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/neo/sys/sys_local.cpp b/neo/sys/sys_local.cpp index d52a2d48..0cfca73e 100644 --- a/neo/sys/sys_local.cpp +++ b/neo/sys/sys_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"). @@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms #include "sys_local.h" const char * sysLanguageNames[] = { - "english", "spanish", "italian", "german", "french", "russian", + "english", "spanish", "italian", "german", "french", "russian", "polish", "korean", "japanese", "chinese", NULL }; @@ -167,7 +167,7 @@ const char *Sys_TimeStampToStr( ID_TIME_T timeStamp ) { tm* time = localtime( &timeStamp ); idStr out; - + idStr lang = cvarSystem->GetCVarString( "sys_lang" ); if ( lang.Icmp( "english" ) == 0 ) { // english gets "month/day/year hour:min" + "am" or "pm" @@ -207,4 +207,3 @@ const char *Sys_TimeStampToStr( ID_TIME_T timeStamp ) { return timeString; } - diff --git a/neo/sys/sys_local.h b/neo/sys/sys_local.h index 12289ba5..16b5134b 100644 --- a/neo/sys/sys_local.h +++ b/neo/sys/sys_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/neo/sys/sys_public.h b/neo/sys/sys_public.h index 8fa7850d..c76bc38e 100644 --- a/neo/sys/sys_public.h +++ b/neo/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/neo/sys/win32/eax.h b/neo/sys/win32/eax.h index 8e420b05..d857cc01 100644 --- a/neo/sys/win32/eax.h +++ b/neo/sys/win32/eax.h @@ -20,36 +20,36 @@ extern "C" { /* * EAX Wrapper Interface (using Direct X 7) {4FF53B81-1CE0-11d3-AAB8-00A0C95949D5} */ - DEFINE_GUID(CLSID_EAXDirectSound, - 0x4ff53b81, - 0x1ce0, - 0x11d3, - 0xaa, 0xb8, 0x0, 0xa0, 0xc9, 0x59, 0x49, 0xd5); - + DEFINE_GUID(CLSID_EAXDirectSound, + 0x4ff53b81, + 0x1ce0, + 0x11d3, + 0xaa, 0xb8, 0x0, 0xa0, 0xc9, 0x59, 0x49, 0xd5); + /* * EAX Wrapper Interface (using Direct X 8) {CA503B60-B176-11d4-A094-D0C0BF3A560C} */ - DEFINE_GUID(CLSID_EAXDirectSound8, + DEFINE_GUID(CLSID_EAXDirectSound8, 0xca503b60, 0xb176, 0x11d4, 0xa0, 0x94, 0xd0, 0xc0, 0xbf, 0x3a, 0x56, 0xc); - -#ifdef DIRECTSOUND_VERSION + +#ifdef DIRECTSOUND_VERSION #if DIRECTSOUND_VERSION == 0x0800 __declspec(dllimport) HRESULT WINAPI EAXDirectSoundCreate8(GUID*, LPDIRECTSOUND8*, IUnknown FAR *); typedef HRESULT (FAR PASCAL *LPEAXDIRECTSOUNDCREATE8)(GUID*, LPDIRECTSOUND*, IUnknown FAR*); #endif #endif - + __declspec(dllimport) HRESULT WINAPI EAXDirectSoundCreate(GUID*, LPDIRECTSOUND*, IUnknown FAR *); typedef HRESULT (FAR PASCAL *LPEAXDIRECTSOUNDCREATE)(GUID*, LPDIRECTSOUND*, IUnknown FAR*); #else // OPENAL #include "..\Sdk\OpenAL\Include\al.h" - + #ifndef GUID_DEFINED #define GUID_DEFINED typedef struct _GUID @@ -70,7 +70,7 @@ extern "C" { extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } #endif // INITGUID #endif // DEFINE_GUID - + /* * EAX OpenAL Extension @@ -84,10 +84,10 @@ extern "C" { /* * EAX 3.0 listener property set {A8FA6880-B476-11d3-BDB9-00C0F02DDF87} */ -DEFINE_GUID(DSPROPSETID_EAX30_ListenerProperties, - 0xa8fa6882, - 0xb476, - 0x11d3, +DEFINE_GUID(DSPROPSETID_EAX30_ListenerProperties, + 0xa8fa6882, + 0xb476, + 0x11d3, 0xbd, 0xb9, 0x00, 0xc0, 0xf0, 0x2d, 0xdf, 0x87); // For compatibility with future EAX versions: @@ -95,39 +95,39 @@ DEFINE_GUID(DSPROPSETID_EAX30_ListenerProperties, typedef enum { - DSPROPERTY_EAXLISTENER_NONE, - DSPROPERTY_EAXLISTENER_ALLPARAMETERS, - DSPROPERTY_EAXLISTENER_ENVIRONMENT, - DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE, - DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION, - DSPROPERTY_EAXLISTENER_ROOM, - DSPROPERTY_EAXLISTENER_ROOMHF, - DSPROPERTY_EAXLISTENER_ROOMLF, - DSPROPERTY_EAXLISTENER_DECAYTIME, - DSPROPERTY_EAXLISTENER_DECAYHFRATIO, - DSPROPERTY_EAXLISTENER_DECAYLFRATIO, - DSPROPERTY_EAXLISTENER_REFLECTIONS, - DSPROPERTY_EAXLISTENER_REFLECTIONSDELAY, - DSPROPERTY_EAXLISTENER_REFLECTIONSPAN, - DSPROPERTY_EAXLISTENER_REVERB, - DSPROPERTY_EAXLISTENER_REVERBDELAY, - DSPROPERTY_EAXLISTENER_REVERBPAN, - DSPROPERTY_EAXLISTENER_ECHOTIME, - DSPROPERTY_EAXLISTENER_ECHODEPTH, - DSPROPERTY_EAXLISTENER_MODULATIONTIME, - DSPROPERTY_EAXLISTENER_MODULATIONDEPTH, - DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF, - DSPROPERTY_EAXLISTENER_HFREFERENCE, - DSPROPERTY_EAXLISTENER_LFREFERENCE, - DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR, - DSPROPERTY_EAXLISTENER_FLAGS + DSPROPERTY_EAXLISTENER_NONE, + DSPROPERTY_EAXLISTENER_ALLPARAMETERS, + DSPROPERTY_EAXLISTENER_ENVIRONMENT, + DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE, + DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION, + DSPROPERTY_EAXLISTENER_ROOM, + DSPROPERTY_EAXLISTENER_ROOMHF, + DSPROPERTY_EAXLISTENER_ROOMLF, + DSPROPERTY_EAXLISTENER_DECAYTIME, + DSPROPERTY_EAXLISTENER_DECAYHFRATIO, + DSPROPERTY_EAXLISTENER_DECAYLFRATIO, + DSPROPERTY_EAXLISTENER_REFLECTIONS, + DSPROPERTY_EAXLISTENER_REFLECTIONSDELAY, + DSPROPERTY_EAXLISTENER_REFLECTIONSPAN, + DSPROPERTY_EAXLISTENER_REVERB, + DSPROPERTY_EAXLISTENER_REVERBDELAY, + DSPROPERTY_EAXLISTENER_REVERBPAN, + DSPROPERTY_EAXLISTENER_ECHOTIME, + DSPROPERTY_EAXLISTENER_ECHODEPTH, + DSPROPERTY_EAXLISTENER_MODULATIONTIME, + DSPROPERTY_EAXLISTENER_MODULATIONDEPTH, + DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF, + DSPROPERTY_EAXLISTENER_HFREFERENCE, + DSPROPERTY_EAXLISTENER_LFREFERENCE, + DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR, + DSPROPERTY_EAXLISTENER_FLAGS } DSPROPERTY_EAX_LISTENERPROPERTY; // OR these flags with property id #define DSPROPERTY_EAXLISTENER_IMMEDIATE 0x00000000 // changes take effect immediately #define DSPROPERTY_EAXLISTENER_DEFERRED 0x80000000 // changes take effect later #define DSPROPERTY_EAXLISTENER_COMMITDEFERREDSETTINGS (DSPROPERTY_EAXLISTENER_NONE | \ - DSPROPERTY_EAXLISTENER_IMMEDIATE) + DSPROPERTY_EAXLISTENER_IMMEDIATE) typedef struct _EAXVECTOR { float x; @@ -147,70 +147,70 @@ typedef struct _EAXVECTOR { // myListener.dwFlags = myFlags /* see EAXLISTENERFLAGS below */ ; // instead of: // myListener = { -1000, -100, ... , 0x00000009 }; -// If you want to save and load presets in binary form, you +// If you want to save and load presets in binary form, you // should define your own structure to insure future compatibility. // typedef struct _EAXLISTENERPROPERTIES { - unsigned long ulEnvironment; // sets all listener properties - float flEnvironmentSize; // environment size in meters - float flEnvironmentDiffusion; // environment diffusion - long lRoom; // room effect level (at mid frequencies) - long lRoomHF; // relative room effect level at high frequencies - long lRoomLF; // relative room effect level at low frequencies - float flDecayTime; // reverberation decay time at mid frequencies - float flDecayHFRatio; // high-frequency to mid-frequency decay time ratio - float flDecayLFRatio; // low-frequency to mid-frequency decay time ratio - long lReflections; // early reflections level relative to room effect - float flReflectionsDelay; // initial reflection delay time - EAXVECTOR vReflectionsPan; // early reflections panning vector - long lReverb; // late reverberation level relative to room effect - float flReverbDelay; // late reverberation delay time relative to initial reflection - EAXVECTOR vReverbPan; // late reverberation panning vector - float flEchoTime; // echo time - float flEchoDepth; // echo depth - float flModulationTime; // modulation time - float flModulationDepth; // modulation depth - float flAirAbsorptionHF; // change in level per meter at high frequencies - float flHFReference; // reference high frequency - float flLFReference; // reference low frequency - float flRoomRolloffFactor; // like DS3D flRolloffFactor but for room effect - unsigned long ulFlags; // modifies the behavior of properties + unsigned long ulEnvironment; // sets all listener properties + float flEnvironmentSize; // environment size in meters + float flEnvironmentDiffusion; // environment diffusion + long lRoom; // room effect level (at mid frequencies) + long lRoomHF; // relative room effect level at high frequencies + long lRoomLF; // relative room effect level at low frequencies + float flDecayTime; // reverberation decay time at mid frequencies + float flDecayHFRatio; // high-frequency to mid-frequency decay time ratio + float flDecayLFRatio; // low-frequency to mid-frequency decay time ratio + long lReflections; // early reflections level relative to room effect + float flReflectionsDelay; // initial reflection delay time + EAXVECTOR vReflectionsPan; // early reflections panning vector + long lReverb; // late reverberation level relative to room effect + float flReverbDelay; // late reverberation delay time relative to initial reflection + EAXVECTOR vReverbPan; // late reverberation panning vector + float flEchoTime; // echo time + float flEchoDepth; // echo depth + float flModulationTime; // modulation time + float flModulationDepth; // modulation depth + float flAirAbsorptionHF; // change in level per meter at high frequencies + float flHFReference; // reference high frequency + float flLFReference; // reference low frequency + float flRoomRolloffFactor; // like DS3D flRolloffFactor but for room effect + unsigned long ulFlags; // modifies the behavior of properties } EAXLISTENERPROPERTIES, *LPEAXLISTENERPROPERTIES; // used by DSPROPERTY_EAXLISTENER_ENVIRONMENT enum { - EAX_ENVIRONMENT_GENERIC, - EAX_ENVIRONMENT_PADDEDCELL, - EAX_ENVIRONMENT_ROOM, - EAX_ENVIRONMENT_BATHROOM, - EAX_ENVIRONMENT_LIVINGROOM, - EAX_ENVIRONMENT_STONEROOM, - EAX_ENVIRONMENT_AUDITORIUM, - EAX_ENVIRONMENT_CONCERTHALL, - EAX_ENVIRONMENT_CAVE, - EAX_ENVIRONMENT_ARENA, - EAX_ENVIRONMENT_HANGAR, - EAX_ENVIRONMENT_CARPETEDHALLWAY, - EAX_ENVIRONMENT_HALLWAY, - EAX_ENVIRONMENT_STONECORRIDOR, - EAX_ENVIRONMENT_ALLEY, - EAX_ENVIRONMENT_FOREST, - EAX_ENVIRONMENT_CITY, - EAX_ENVIRONMENT_MOUNTAINS, - EAX_ENVIRONMENT_QUARRY, - EAX_ENVIRONMENT_PLAIN, - EAX_ENVIRONMENT_PARKINGLOT, - EAX_ENVIRONMENT_SEWERPIPE, - EAX_ENVIRONMENT_UNDERWATER, - EAX_ENVIRONMENT_DRUGGED, - EAX_ENVIRONMENT_DIZZY, - EAX_ENVIRONMENT_PSYCHOTIC, + EAX_ENVIRONMENT_GENERIC, + EAX_ENVIRONMENT_PADDEDCELL, + EAX_ENVIRONMENT_ROOM, + EAX_ENVIRONMENT_BATHROOM, + EAX_ENVIRONMENT_LIVINGROOM, + EAX_ENVIRONMENT_STONEROOM, + EAX_ENVIRONMENT_AUDITORIUM, + EAX_ENVIRONMENT_CONCERTHALL, + EAX_ENVIRONMENT_CAVE, + EAX_ENVIRONMENT_ARENA, + EAX_ENVIRONMENT_HANGAR, + EAX_ENVIRONMENT_CARPETEDHALLWAY, + EAX_ENVIRONMENT_HALLWAY, + EAX_ENVIRONMENT_STONECORRIDOR, + EAX_ENVIRONMENT_ALLEY, + EAX_ENVIRONMENT_FOREST, + EAX_ENVIRONMENT_CITY, + EAX_ENVIRONMENT_MOUNTAINS, + EAX_ENVIRONMENT_QUARRY, + EAX_ENVIRONMENT_PLAIN, + EAX_ENVIRONMENT_PARKINGLOT, + EAX_ENVIRONMENT_SEWERPIPE, + EAX_ENVIRONMENT_UNDERWATER, + EAX_ENVIRONMENT_DRUGGED, + EAX_ENVIRONMENT_DIZZY, + EAX_ENVIRONMENT_PSYCHOTIC, - EAX_ENVIRONMENT_UNDEFINED, + EAX_ENVIRONMENT_UNDEFINED, - EAX_ENVIRONMENT_COUNT + EAX_ENVIRONMENT_COUNT }; // Used by DSPROPERTY_EAXLISTENER_FLAGS @@ -232,7 +232,7 @@ enum // This flag limits high-frequency decay time according to air absorption. #define EAXLISTENERFLAGS_DECAYHFLIMIT 0x00000020 - + #define EAXLISTENERFLAGS_RESERVED 0xFFFFFF00 // reserved future use // Property ranges and defaults: @@ -322,21 +322,21 @@ enum #define EAXLISTENER_DEFAULTROOMROLLOFFFACTOR 0.0f #define EAXLISTENER_DEFAULTFLAGS (EAXLISTENERFLAGS_DECAYTIMESCALE | \ - EAXLISTENERFLAGS_REFLECTIONSSCALE | \ - EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE | \ - EAXLISTENERFLAGS_REVERBSCALE | \ - EAXLISTENERFLAGS_REVERBDELAYSCALE | \ - EAXLISTENERFLAGS_DECAYHFLIMIT) + EAXLISTENERFLAGS_REFLECTIONSSCALE | \ + EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE | \ + EAXLISTENERFLAGS_REVERBSCALE | \ + EAXLISTENERFLAGS_REVERBDELAYSCALE | \ + EAXLISTENERFLAGS_DECAYHFLIMIT) /* * EAX 3.0 buffer property set {A8FA6881-B476-11d3-BDB9-00C0F02DDF87} */ -DEFINE_GUID(DSPROPSETID_EAX30_BufferProperties, - 0xa8fa6881, - 0xb476, - 0x11d3, +DEFINE_GUID(DSPROPSETID_EAX30_BufferProperties, + 0xa8fa6881, + 0xb476, + 0x11d3, 0xbd, 0xb9, 0x0, 0xc0, 0xf0, 0x2d, 0xdf, 0x87); // For compatibility with future EAX versions: @@ -345,36 +345,36 @@ DEFINE_GUID(DSPROPSETID_EAX30_BufferProperties, typedef enum { - DSPROPERTY_EAXBUFFER_NONE, - DSPROPERTY_EAXBUFFER_ALLPARAMETERS, - DSPROPERTY_EAXBUFFER_OBSTRUCTIONPARAMETERS, - DSPROPERTY_EAXBUFFER_OCCLUSIONPARAMETERS, - DSPROPERTY_EAXBUFFER_EXCLUSIONPARAMETERS, - DSPROPERTY_EAXBUFFER_DIRECT, - DSPROPERTY_EAXBUFFER_DIRECTHF, - DSPROPERTY_EAXBUFFER_ROOM, - DSPROPERTY_EAXBUFFER_ROOMHF, - DSPROPERTY_EAXBUFFER_OBSTRUCTION, - DSPROPERTY_EAXBUFFER_OBSTRUCTIONLFRATIO, - DSPROPERTY_EAXBUFFER_OCCLUSION, - DSPROPERTY_EAXBUFFER_OCCLUSIONLFRATIO, - DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO, - DSPROPERTY_EAXBUFFER_OCCLUSIONDIRECTRATIO, - DSPROPERTY_EAXBUFFER_EXCLUSION, - DSPROPERTY_EAXBUFFER_EXCLUSIONLFRATIO, - DSPROPERTY_EAXBUFFER_OUTSIDEVOLUMEHF, - DSPROPERTY_EAXBUFFER_DOPPLERFACTOR, - DSPROPERTY_EAXBUFFER_ROLLOFFFACTOR, - DSPROPERTY_EAXBUFFER_ROOMROLLOFFFACTOR, - DSPROPERTY_EAXBUFFER_AIRABSORPTIONFACTOR, - DSPROPERTY_EAXBUFFER_FLAGS -} DSPROPERTY_EAX_BUFFERPROPERTY; + DSPROPERTY_EAXBUFFER_NONE, + DSPROPERTY_EAXBUFFER_ALLPARAMETERS, + DSPROPERTY_EAXBUFFER_OBSTRUCTIONPARAMETERS, + DSPROPERTY_EAXBUFFER_OCCLUSIONPARAMETERS, + DSPROPERTY_EAXBUFFER_EXCLUSIONPARAMETERS, + DSPROPERTY_EAXBUFFER_DIRECT, + DSPROPERTY_EAXBUFFER_DIRECTHF, + DSPROPERTY_EAXBUFFER_ROOM, + DSPROPERTY_EAXBUFFER_ROOMHF, + DSPROPERTY_EAXBUFFER_OBSTRUCTION, + DSPROPERTY_EAXBUFFER_OBSTRUCTIONLFRATIO, + DSPROPERTY_EAXBUFFER_OCCLUSION, + DSPROPERTY_EAXBUFFER_OCCLUSIONLFRATIO, + DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO, + DSPROPERTY_EAXBUFFER_OCCLUSIONDIRECTRATIO, + DSPROPERTY_EAXBUFFER_EXCLUSION, + DSPROPERTY_EAXBUFFER_EXCLUSIONLFRATIO, + DSPROPERTY_EAXBUFFER_OUTSIDEVOLUMEHF, + DSPROPERTY_EAXBUFFER_DOPPLERFACTOR, + DSPROPERTY_EAXBUFFER_ROLLOFFFACTOR, + DSPROPERTY_EAXBUFFER_ROOMROLLOFFFACTOR, + DSPROPERTY_EAXBUFFER_AIRABSORPTIONFACTOR, + DSPROPERTY_EAXBUFFER_FLAGS +} DSPROPERTY_EAX_BUFFERPROPERTY; // OR these flags with property id #define DSPROPERTY_EAXBUFFER_IMMEDIATE 0x00000000 // changes take effect immediately #define DSPROPERTY_EAXBUFFER_DEFERRED 0x80000000 // changes take effect later #define DSPROPERTY_EAXBUFFER_COMMITDEFERREDSETTINGS (DSPROPERTY_EAXBUFFER_NONE | \ - DSPROPERTY_EAXBUFFER_IMMEDIATE) + DSPROPERTY_EAXBUFFER_IMMEDIATE) // Use this structure for DSPROPERTY_EAXBUFFER_ALLPARAMETERS // - all levels are hundredths of decibels @@ -391,47 +391,47 @@ typedef enum // typedef struct _EAXBUFFERPROPERTIES { - long lDirect; // direct path level (at low and mid frequencies) - long lDirectHF; // relative direct path level at high frequencies - long lRoom; // room effect level (at low and mid frequencies) - long lRoomHF; // relative room effect level at high frequencies - long lObstruction; // main obstruction control (attenuation at high frequencies) - float flObstructionLFRatio; // obstruction low-frequency level re. main control - long lOcclusion; // main occlusion control (attenuation at high frequencies) - float flOcclusionLFRatio; // occlusion low-frequency level re. main control - float flOcclusionRoomRatio; // relative occlusion control for room effect - float flOcclusionDirectRatio; // relative occlusion control for direct path - long lExclusion; // main exlusion control (attenuation at high frequencies) - float flExclusionLFRatio; // exclusion low-frequency level re. main control - long lOutsideVolumeHF; // outside sound cone level at high frequencies - float flDopplerFactor; // like DS3D flDopplerFactor but per source - float flRolloffFactor; // like DS3D flRolloffFactor but per source - float flRoomRolloffFactor; // like DS3D flRolloffFactor but for room effect - float flAirAbsorptionFactor; // multiplies DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF - unsigned long ulFlags; // modifies the behavior of properties + long lDirect; // direct path level (at low and mid frequencies) + long lDirectHF; // relative direct path level at high frequencies + long lRoom; // room effect level (at low and mid frequencies) + long lRoomHF; // relative room effect level at high frequencies + long lObstruction; // main obstruction control (attenuation at high frequencies) + float flObstructionLFRatio; // obstruction low-frequency level re. main control + long lOcclusion; // main occlusion control (attenuation at high frequencies) + float flOcclusionLFRatio; // occlusion low-frequency level re. main control + float flOcclusionRoomRatio; // relative occlusion control for room effect + float flOcclusionDirectRatio; // relative occlusion control for direct path + long lExclusion; // main exlusion control (attenuation at high frequencies) + float flExclusionLFRatio; // exclusion low-frequency level re. main control + long lOutsideVolumeHF; // outside sound cone level at high frequencies + float flDopplerFactor; // like DS3D flDopplerFactor but per source + float flRolloffFactor; // like DS3D flRolloffFactor but per source + float flRoomRolloffFactor; // like DS3D flRolloffFactor but for room effect + float flAirAbsorptionFactor; // multiplies DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF + unsigned long ulFlags; // modifies the behavior of properties } EAXBUFFERPROPERTIES, *LPEAXBUFFERPROPERTIES; // Use this structure for DSPROPERTY_EAXBUFFER_OBSTRUCTION, typedef struct _EAXOBSTRUCTIONPROPERTIES { - long lObstruction; - float flObstructionLFRatio; + long lObstruction; + float flObstructionLFRatio; } EAXOBSTRUCTIONPROPERTIES, *LPEAXOBSTRUCTIONPROPERTIES; // Use this structure for DSPROPERTY_EAXBUFFER_OCCLUSION typedef struct _EAXOCCLUSIONPROPERTIES { - long lOcclusion; - float flOcclusionLFRatio; - float flOcclusionRoomRatio; - float flOcclusionDirectRatio; + long lOcclusion; + float flOcclusionLFRatio; + float flOcclusionRoomRatio; + float flOcclusionDirectRatio; } EAXOCCLUSIONPROPERTIES, *LPEAXOCCLUSIONPROPERTIES; // Use this structure for DSPROPERTY_EAXBUFFER_EXCLUSION typedef struct _EAXEXCLUSIONPROPERTIES { - long lExclusion; - float flExclusionLFRatio; + long lExclusion; + float flExclusionLFRatio; } EAXEXCLUSIONPROPERTIES, *LPEAXEXCLUSIONPROPERTIES; // Used by DSPROPERTY_EAXBUFFER_FLAGS @@ -521,8 +521,8 @@ typedef struct _EAXEXCLUSIONPROPERTIES #define EAXBUFFER_DEFAULTAIRABSORPTIONFACTOR 1.0f #define EAXBUFFER_DEFAULTFLAGS (EAXBUFFERFLAGS_DIRECTHFAUTO | \ - EAXBUFFERFLAGS_ROOMAUTO | \ - EAXBUFFERFLAGS_ROOMHFAUTO ) + EAXBUFFERFLAGS_ROOMAUTO | \ + EAXBUFFERFLAGS_ROOMHFAUTO ) #pragma pack(pop) diff --git a/neo/sys/win32/gl_logfuncs.cpp b/neo/sys/win32/gl_logfuncs.cpp index 61f54a85..28e68787 100644 --- a/neo/sys/win32/gl_logfuncs.cpp +++ b/neo/sys/win32/gl_logfuncs.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/neo/sys/win32/rc/AFEditor_resource.h b/neo/sys/win32/rc/AFEditor_resource.h index 643120e6..5b1b27fc 100644 --- a/neo/sys/win32/rc/AFEditor_resource.h +++ b/neo/sys/win32/rc/AFEditor_resource.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"). @@ -357,7 +357,7 @@ If you have questions concerning this license or the applicable additional terms // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 diff --git a/neo/sys/win32/rc/Common_resource.h b/neo/sys/win32/rc/Common_resource.h index 7350f7cc..6cabc3b1 100644 --- a/neo/sys/win32/rc/Common_resource.h +++ b/neo/sys/win32/rc/Common_resource.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"). @@ -46,7 +46,7 @@ If you have questions concerning this license or the applicable additional terms // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 diff --git a/neo/sys/win32/rc/CreateResourceIDs.cpp b/neo/sys/win32/rc/CreateResourceIDs.cpp index 87941ff9..dc2523e7 100644 --- a/neo/sys/win32/rc/CreateResourceIDs.cpp +++ b/neo/sys/win32/rc/CreateResourceIDs.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/neo/sys/win32/rc/CreateResourceIDs.h b/neo/sys/win32/rc/CreateResourceIDs.h index f582466b..1bba222a 100644 --- a/neo/sys/win32/rc/CreateResourceIDs.h +++ b/neo/sys/win32/rc/CreateResourceIDs.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/neo/sys/win32/rc/Debugger_resource.h b/neo/sys/win32/rc/Debugger_resource.h index d8e8b8b1..55a6613e 100644 --- a/neo/sys/win32/rc/Debugger_resource.h +++ b/neo/sys/win32/rc/Debugger_resource.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 @@ If you have questions concerning this license or the applicable additional terms #define ID_DBG_HELP_ABOUT 22024 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 diff --git a/neo/sys/win32/rc/DeclEditor_resource.h b/neo/sys/win32/rc/DeclEditor_resource.h index 71da31e9..904dff7f 100644 --- a/neo/sys/win32/rc/DeclEditor_resource.h +++ b/neo/sys/win32/rc/DeclEditor_resource.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 @@ If you have questions concerning this license or the applicable additional terms #define ID_DECLEDITOR_GOTOLINE 23001 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 diff --git a/neo/sys/win32/rc/GuiEd_resource.h b/neo/sys/win32/rc/GuiEd_resource.h index 4e19ec10..96c1660c 100644 --- a/neo/sys/win32/rc/GuiEd_resource.h +++ b/neo/sys/win32/rc/GuiEd_resource.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"). @@ -195,7 +195,7 @@ If you have questions concerning this license or the applicable additional terms #define ID_GUIED_VIEWER_START 25064 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 diff --git a/neo/sys/win32/rc/MaterialEditor_Resource.h b/neo/sys/win32/rc/MaterialEditor_Resource.h index 89e772f0..8dabd125 100644 --- a/neo/sys/win32/rc/MaterialEditor_Resource.h +++ b/neo/sys/win32/rc/MaterialEditor_Resource.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"). @@ -118,7 +118,7 @@ If you have questions concerning this license or the applicable additional terms #define ID_ME_EDIT_FIND_NEXT 26061 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 diff --git a/neo/sys/win32/rc/PDAEditor_resource.h b/neo/sys/win32/rc/PDAEditor_resource.h index 6dd3934b..b18fc78d 100644 --- a/neo/sys/win32/rc/PDAEditor_resource.h +++ b/neo/sys/win32/rc/PDAEditor_resource.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"). @@ -64,7 +64,7 @@ If you have questions concerning this license or the applicable additional terms // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 diff --git a/neo/sys/win32/rc/ParticleEditor_resource.h b/neo/sys/win32/rc/ParticleEditor_resource.h index 04c09201..2d2b9634 100644 --- a/neo/sys/win32/rc/ParticleEditor_resource.h +++ b/neo/sys/win32/rc/ParticleEditor_resource.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"). @@ -139,7 +139,7 @@ If you have questions concerning this license or the applicable additional terms // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 diff --git a/neo/sys/win32/rc/PropTree_resource.h b/neo/sys/win32/rc/PropTree_resource.h index 1d36b826..d6ec82b0 100644 --- a/neo/sys/win32/rc/PropTree_resource.h +++ b/neo/sys/win32/rc/PropTree_resource.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 @@ If you have questions concerning this license or the applicable additional terms #define IDC_FPOINT 9201 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 diff --git a/neo/sys/win32/rc/Radiant_resource.h b/neo/sys/win32/rc/Radiant_resource.h index 1ef034fa..c2540fe1 100644 --- a/neo/sys/win32/rc/Radiant_resource.h +++ b/neo/sys/win32/rc/Radiant_resource.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"). @@ -876,7 +876,7 @@ If you have questions concerning this license or the applicable additional terms #define ID_ENTITY_END 45000 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 diff --git a/neo/sys/win32/rc/ScriptEditor_resource.h b/neo/sys/win32/rc/ScriptEditor_resource.h index bc61d83c..47ecbb08 100644 --- a/neo/sys/win32/rc/ScriptEditor_resource.h +++ b/neo/sys/win32/rc/ScriptEditor_resource.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"). @@ -35,7 +35,7 @@ If you have questions concerning this license or the applicable additional terms #define ID_SCRIPTEDITOR_GOTOLINE 31001 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 diff --git a/neo/sys/win32/rc/SoundEditor_resource.h b/neo/sys/win32/rc/SoundEditor_resource.h index 9c8191af..d7c3a6a2 100644 --- a/neo/sys/win32/rc/SoundEditor_resource.h +++ b/neo/sys/win32/rc/SoundEditor_resource.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 @@ If you have questions concerning this license or the applicable additional terms // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 diff --git a/neo/sys/win32/rc/doom_resource.h b/neo/sys/win32/rc/doom_resource.h index 057d88cd..3967400c 100644 --- a/neo/sys/win32/rc/doom_resource.h +++ b/neo/sys/win32/rc/doom_resource.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"). @@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 diff --git a/neo/sys/win32/sdk/prepare.py b/neo/sys/win32/sdk/prepare.py index 60de91f5..3151cd4d 100644 --- a/neo/sys/win32/sdk/prepare.py +++ b/neo/sys/win32/sdk/prepare.py @@ -7,49 +7,49 @@ media = '../../../../../media-sdk' media = os.path.abspath( media ) try: - shutil.rmtree( 'Doom3_SDK' ) + shutil.rmtree( 'Doom3_SDK' ) except: - print 'Could not remove Doom3_SDK' - pass + print 'Could not remove Doom3_SDK' + pass # copy source from list f = open( 'source.list' ) l = [ s[:-1] for s in f.readlines() ] f.close() for p in l: - sp = os.path.join( '../../..', p ) - dp = os.path.join( 'Doom3_SDK/src', p ) - try: - os.makedirs( os.path.dirname( dp ) ) - except: - pass - print 'cp ' + sp + ' -> ' + dp - shutil.copy( sp, dp ) + sp = os.path.join( '../../..', p ) + dp = os.path.join( 'Doom3_SDK/src', p ) + try: + os.makedirs( os.path.dirname( dp ) ) + except: + pass + print 'cp ' + sp + ' -> ' + dp + shutil.copy( sp, dp ) # copy explicit media content over for root, dirs, files in os.walk( media ): - if '.svn' in dirs: - dirs.remove( '.svn' ) - for f in files: - sp = os.path.join( root, f ) - dp = os.path.join( 'Doom3_SDK', sp[ len( media ) + 1: ] ) - try: - os.makedirs( os.path.dirname( dp ) ) - except: - pass - print 'cp ' + sp + ' -> ' + dp - shutil.copy( sp, dp ) + if '.svn' in dirs: + dirs.remove( '.svn' ) + for f in files: + sp = os.path.join( root, f ) + dp = os.path.join( 'Doom3_SDK', sp[ len( media ) + 1: ] ) + try: + os.makedirs( os.path.dirname( dp ) ) + except: + pass + print 'cp ' + sp + ' -> ' + dp + shutil.copy( sp, dp ) def makewritable( path ): - for root, dirs, files in os.walk( path ): - for f in files: - os.chmod( os.path.join( root, f ), stat.S_IWRITE ) + for root, dirs, files in os.walk( path ): + for f in files: + os.chmod( os.path.join( root, f ), stat.S_IWRITE ) # cleanup '.svn' for root, dirs, files in os.walk( 'Doom3_SDK' ): - if '.svn' in dirs: - print 'remove ' + os.path.join( root, '.svn' ) - # SVN sets readonly on some files, which causes rmtree failure on win32 - makewritable( os.path.join( root, '.svn' ) ) - shutil.rmtree( os.path.join( root, '.svn' ) ) - dirs.remove( '.svn' ) + if '.svn' in dirs: + print 'remove ' + os.path.join( root, '.svn' ) + # SVN sets readonly on some files, which causes rmtree failure on win32 + makewritable( os.path.join( root, '.svn' ) ) + shutil.rmtree( os.path.join( root, '.svn' ) ) + dirs.remove( '.svn' ) diff --git a/neo/sys/win32/win_cpu.cpp b/neo/sys/win32/win_cpu.cpp index 8e2f3b6b..1b09e77f 100644 --- a/neo/sys/win32/win_cpu.cpp +++ b/neo/sys/win32/win_cpu.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"). @@ -130,7 +130,7 @@ HasCPUID ================ */ static bool HasCPUID( void ) { - __asm + __asm { pushfd // save eflags pop eax @@ -341,8 +341,8 @@ LogicalProcPerPhysicalProc ================ */ #define NUM_LOGICAL_BITS 0x00FF0000 // EBX[23:16] Bit 16-23 in ebx contains the number of logical - // processors per physical processor when execute cpuid with - // eax set to 1 + // processors per physical processor when execute cpuid with + // eax set to 1 static unsigned char LogicalProcPerPhysicalProc( void ) { unsigned int regebx = 0; __asm { @@ -358,9 +358,9 @@ static unsigned char LogicalProcPerPhysicalProc( void ) { GetAPIC_ID ================ */ -#define INITIAL_APIC_ID_BITS 0xFF000000 // EBX[31:24] Bits 24-31 (8 bits) return the 8-bit unique - // initial APIC ID for the processor this code is running on. - // Default value = 0xff if HT is not supported +#define INITIAL_APIC_ID_BITS 0xFF000000 // EBX[31:24] Bits 24-31 (8 bits) return the 8-bit unique + // initial APIC ID for the processor this code is running on. + // Default value = 0xff if HT is not supported static unsigned char GetAPIC_ID( void ) { unsigned int regebx = 0; __asm { @@ -376,7 +376,7 @@ static unsigned char GetAPIC_ID( void ) { CPUCount logicalNum is the number of logical CPU per physical CPU - physicalNum is the total number of physical processor + physicalNum is the total number of physical processor returns one of the HT_* flags ================ */ @@ -399,7 +399,7 @@ int CPUCount( int &logicalNum, int &physicalNum ) { // Number of physical processors in a non-Intel system // or in a 32-bit Intel system with Hyper-Threading technology disabled - physicalNum = info.dwNumberOfProcessors; + physicalNum = info.dwNumberOfProcessors; unsigned char HT_Enabled = 0; @@ -411,17 +411,17 @@ int CPUCount( int &logicalNum, int &physicalNum ) { DWORD dwSystemAffinity; DWORD dwAffinityMask; - // Calculate the appropriate shifts and mask based on the + // Calculate the appropriate shifts and mask based on the // number of logical processors. unsigned char i = 1, PHY_ID_MASK = 0xFF, PHY_ID_SHIFT = 0; while( i < logicalNum ) { i *= 2; - PHY_ID_MASK <<= 1; + PHY_ID_MASK <<= 1; PHY_ID_SHIFT++; } - + hCurrentProcessHandle = GetCurrentProcess(); GetProcessAffinityMask( hCurrentProcessHandle, &dwProcessAffinity, &dwSystemAffinity ); @@ -453,10 +453,10 @@ int CPUCount( int &logicalNum, int &physicalNum ) { } dwAffinityMask = dwAffinityMask << 1; } - + // Reset the processor affinity SetProcessAffinityMask( hCurrentProcessHandle, dwProcessAffinity ); - + if ( logicalNum == 1 ) { // Normal P4 : HT is disabled in hardware statusFlag = HT_DISABLED; } else { diff --git a/neo/sys/win32/win_gamma.cpp b/neo/sys/win32/win_gamma.cpp index 402f28de..d8095bc5 100644 --- a/neo/sys/win32/win_gamma.cpp +++ b/neo/sys/win32/win_gamma.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/neo/sys/win32/win_glimp.cpp b/neo/sys/win32/win_glimp.cpp index b988a331..80310c65 100644 --- a/neo/sys/win32/win_glimp.cpp +++ b/neo/sys/win32/win_glimp.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"). @@ -69,7 +69,7 @@ PFNWGLRELEASEPBUFFERDCARBPROC wglReleasePbufferDCARB; PFNWGLDESTROYPBUFFERARBPROC wglDestroyPbufferARB; PFNWGLQUERYPBUFFERARBPROC wglQueryPbufferARB; -// WGL_ARB_render_texture +// WGL_ARB_render_texture PFNWGLBINDTEXIMAGEARBPROC wglBindTexImageARB; PFNWGLRELEASETEXIMAGEARBPROC wglReleaseTexImageARB; PFNWGLSETPBUFFERATTRIBARBPROC wglSetPbufferAttribARB; @@ -222,13 +222,13 @@ Only used to get wglExtensions ==================== */ LONG WINAPI FakeWndProc ( - HWND hWnd, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) { + HWND hWnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) { if ( uMsg == WM_DESTROY ) { - PostQuitMessage(0); + PostQuitMessage(0); } if ( uMsg != WM_CREATE ) { @@ -256,20 +256,20 @@ LONG WINAPI FakeWndProc ( HDC hDC; HGLRC hGLRC; - hDC = GetDC(hWnd); + hDC = GetDC(hWnd); - // Set up OpenGL - pixelFormat = ChoosePixelFormat(hDC, &pfd); - SetPixelFormat(hDC, pixelFormat, &pfd); - hGLRC = qwglCreateContext(hDC); - qwglMakeCurrent(hDC, hGLRC); + // Set up OpenGL + pixelFormat = ChoosePixelFormat(hDC, &pfd); + SetPixelFormat(hDC, pixelFormat, &pfd); + hGLRC = qwglCreateContext(hDC); + qwglMakeCurrent(hDC, hGLRC); // free things - wglMakeCurrent(NULL, NULL); - wglDeleteContext(hGLRC); - ReleaseDC(hWnd, hDC); + wglMakeCurrent(NULL, NULL); + wglDeleteContext(hGLRC); + ReleaseDC(hWnd, hDC); - return DefWindowProc(hWnd, uMsg, wParam, lParam); + return DefWindowProc(hWnd, uMsg, wParam, lParam); } @@ -303,7 +303,7 @@ void GLW_CheckWGLExtensions( HDC hDC ) { wglDestroyPbufferARB = (PFNWGLDESTROYPBUFFERARBPROC)GLimp_ExtensionPointer("wglDestroyPbufferARB"); wglQueryPbufferARB = (PFNWGLQUERYPBUFFERARBPROC)GLimp_ExtensionPointer("wglQueryPbufferARB"); - // WGL_ARB_render_texture + // WGL_ARB_render_texture wglBindTexImageARB = (PFNWGLBINDTEXIMAGEARBPROC)GLimp_ExtensionPointer("wglBindTexImageARB"); wglReleaseTexImageARB = (PFNWGLRELEASETEXIMAGEARBPROC)GLimp_ExtensionPointer("wglReleaseTexImageARB"); wglSetPbufferAttribARB = (PFNWGLSETPBUFFERATTRIBARBPROC)GLimp_ExtensionPointer("wglSetPbufferAttribARB"); @@ -316,32 +316,32 @@ GLW_GetWGLExtensionsWithFakeWindow */ static void GLW_GetWGLExtensionsWithFakeWindow( void ) { HWND hWnd; - MSG msg; + MSG msg; - // Create a window for the sole purpose of getting + // Create a window for the sole purpose of getting // a valid context to get the wglextensions - hWnd = CreateWindow(WIN32_FAKE_WINDOW_CLASS_NAME, GAME_NAME, - WS_OVERLAPPEDWINDOW, - 40, 40, - 640, - 480, - NULL, NULL, win32.hInstance, NULL ); - if ( !hWnd ) { - common->FatalError( "GLW_GetWGLExtensionsWithFakeWindow: Couldn't create fake window" ); - } + hWnd = CreateWindow(WIN32_FAKE_WINDOW_CLASS_NAME, GAME_NAME, + WS_OVERLAPPEDWINDOW, + 40, 40, + 640, + 480, + NULL, NULL, win32.hInstance, NULL ); + if ( !hWnd ) { + common->FatalError( "GLW_GetWGLExtensionsWithFakeWindow: Couldn't create fake window" ); + } - HDC hDC = GetDC( hWnd ); + HDC hDC = GetDC( hWnd ); HGLRC gRC = wglCreateContext( hDC ); wglMakeCurrent( hDC, gRC ); GLW_CheckWGLExtensions( hDC ); wglDeleteContext( gRC ); ReleaseDC( hWnd, hDC ); - DestroyWindow( hWnd ); - while ( GetMessage( &msg, NULL, 0, 0 ) ) { - TranslateMessage( &msg ); - DispatchMessage( &msg ); - } + DestroyWindow( hWnd ); + while ( GetMessage( &msg, NULL, 0, 0 ) ) { + TranslateMessage( &msg ); + DispatchMessage( &msg ); + } } //============================================================================= @@ -365,7 +365,7 @@ shown, and create the rendering context ==================== */ static bool GLW_InitDriver( glimpParms_t parms ) { - PIXELFORMATDESCRIPTOR src = + PIXELFORMATDESCRIPTOR src = { sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd 1, // version number @@ -378,14 +378,14 @@ static bool GLW_InitDriver( glimpParms_t parms ) { 8, // 8 bit destination alpha 0, // shift bit ignored 0, // no accumulation buffer - 0, 0, 0, 0, // accum bits ignored - 24, // 24-bit z-buffer + 0, 0, 0, 0, // accum bits ignored + 24, // 24-bit z-buffer 8, // 8-bit stencil buffer 0, // no auxiliary buffer PFD_MAIN_PLANE, // main layer 0, // reserved 0, 0, 0 // layer masks ignored - }; + }; common->Printf( "Initializing OpenGL driver\n" ); @@ -402,7 +402,7 @@ static bool GLW_InitDriver( glimpParms_t parms ) { common->Printf( "succeeded\n" ); } - // the multisample path uses the wgl + // the multisample path uses the wgl if ( wglChoosePixelFormatARB && parms.multiSamples > 1 ) { int iAttributes[20]; FLOAT fAttributes[] = {0, 0}; @@ -589,7 +589,7 @@ static bool GLW_CreateWindow( glimpParms_t parms ) { x = win32.win_xpos.GetInteger(); y = win32.win_ypos.GetInteger(); - // adjust window coordinates if necessary + // adjust window coordinates if necessary // so that the window is completely on screen if ( x + w > win32.desktopWidth ) { x = ( win32.desktopWidth - w ); @@ -606,7 +606,7 @@ static bool GLW_CreateWindow( glimpParms_t parms ) { } win32.hWnd = CreateWindowEx ( - exstyle, + exstyle, WIN32_WINDOW_CLASS_NAME, GAME_NAME, stylebits, @@ -730,9 +730,9 @@ static bool GLW_SetFullScreen( glimpParms_t parms ) { dm.dmDisplayFrequency = parms.displayHz; dm.dmFields |= DM_DISPLAYFREQUENCY; } - + common->Printf( "...calling CDS: " ); - + // try setting the exact mode requested, because some drivers don't report // the low res modes in EnumDisplaySettings, but still work if ( ( cdsRet = ChangeDisplaySettings( &dm, CDS_FULLSCREEN ) ) == DISP_CHANGE_SUCCESSFUL ) { @@ -745,11 +745,11 @@ static bool GLW_SetFullScreen( glimpParms_t parms ) { // the exact mode failed, so scan EnumDisplaySettings for the next largest mode // common->Printf( "^3failed^0, " ); - + PrintCDSError( cdsRet ); common->Printf( "...trying next higher resolution:" ); - + // we could do a better matching job here... for ( modeNum = 0 ; ; modeNum++ ) { if ( !EnumDisplaySettings( NULL, modeNum, &devmode ) ) { @@ -861,7 +861,7 @@ bool GLimp_Init( glimpParms_t parms ) { =================== GLimp_SetScreenParms -Sets up the screen based on passed parms.. +Sets up the screen based on passed parms.. =================== */ bool GLimp_SetScreenParms( glimpParms_t parms ) { @@ -905,7 +905,7 @@ bool GLimp_SetScreenParms( glimpParms_t parms ) { x = win32.win_xpos.GetInteger(); y = win32.win_ypos.GetInteger(); - // adjust window coordinates if necessary + // adjust window coordinates if necessary // so that the window is completely on screen if ( x + w > win32.desktopWidth ) { x = ( win32.desktopWidth - w ); @@ -1091,7 +1091,7 @@ bool GLimp_SpawnRenderThread( void (*function)( void ) ) { if ( info.dwNumberOfProcessors < 2 ) { return false; } - + // create the IPC elements win32.renderCommandsEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); win32.renderCompletedEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); diff --git a/neo/sys/win32/win_input.cpp b/neo/sys/win32/win_input.cpp index ed4c010c..8c27eda9 100644 --- a/neo/sys/win32/win_input.cpp +++ b/neo/sys/win32/win_input.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"). @@ -59,199 +59,199 @@ static DIOBJECTDATAFORMAT rgodf[] = { //========================================================================== -static const unsigned char s_scantokey[256] = { +static const unsigned char s_scantokey[256] = { // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F - 0, 27, '1', '2', '3', '4', '5', '6', + 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0 - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', K_ENTER,K_CTRL, 'a', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', + 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', K_SHIFT, '\\', 'z', 'x', 'c', 'v', // 2 - 'b', 'n', 'm', ',', '.', '/', K_SHIFT, K_KP_STAR, + 'b', 'n', 'm', ',', '.', '/', K_SHIFT, K_KP_STAR, K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, K_UPARROW, K_PGUP, K_KP_MINUS,K_LEFTARROW,K_KP_5, K_RIGHTARROW,K_KP_PLUS,K_END, // 4 - K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, 0, K_F11, + K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, 0, K_F11, K_F12, 0, 0, K_LWIN, K_RWIN, K_MENU, 0, 0, // 5 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7 // shifted - 0, 27, '!', '@', '#', '$', '%', '^', + 0, 27, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', K_BACKSPACE, 9, // 0 - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', K_ENTER,K_CTRL, 'a', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', + 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '~', K_SHIFT, '\\', 'z', 'x', 'c', 'v', // 2 - 'b', 'n', 'm', ',', '.', '/', K_SHIFT, K_KP_STAR, + 'b', 'n', 'm', ',', '.', '/', K_SHIFT, K_KP_STAR, K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, K_UPARROW, K_PGUP, K_KP_MINUS,K_LEFTARROW,K_KP_5, K_RIGHTARROW,K_KP_PLUS,K_END, // 4 - K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, 0, K_F11, + K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, 0, K_F11, K_F12, 0, 0, K_LWIN, K_RWIN, K_MENU, 0, 0, // 5 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 7 -}; +}; static const unsigned char s_scantokey_german[256] = { // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F - 0, 27, '1', '2', '3', '4', '5', '6', + 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '?', '\'', K_BACKSPACE, 9, // 0 - 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', + 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', '=', '+', K_ENTER,K_CTRL, 'a', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', '[', + 'd', 'f', 'g', 'h', 'j', 'k', 'l', '[', ']', '`', K_SHIFT, '#', 'y', 'x', 'c', 'v', // 2 - 'b', 'n', 'm', ',', '.', '-', K_SHIFT, K_KP_STAR, + 'b', 'n', 'm', ',', '.', '-', K_SHIFT, K_KP_STAR, K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, K_UPARROW, K_PGUP, K_KP_MINUS,K_LEFTARROW,K_KP_5, K_RIGHTARROW,K_KP_PLUS,K_END, // 4 - K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, + K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, K_F12, 0, 0, K_LWIN, K_RWIN, K_MENU, 0, 0, // 5 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7 // shifted - 0, 27, '1', '2', '3', '4', '5', '6', + 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '?', '\'', K_BACKSPACE, 9, // 0 - 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', + 'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', 'o', 'p', '=', '+', K_ENTER,K_CTRL, 'a', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', '[', + 'd', 'f', 'g', 'h', 'j', 'k', 'l', '[', ']', '`', K_SHIFT, '#', 'y', 'x', 'c', 'v', // 2 - 'b', 'n', 'm', ',', '.', '-', K_SHIFT, K_KP_STAR, + 'b', 'n', 'm', ',', '.', '-', K_SHIFT, K_KP_STAR, K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, K_UPARROW, K_PGUP, K_KP_MINUS,K_LEFTARROW,K_KP_5, K_RIGHTARROW,K_KP_PLUS,K_END, // 4 - K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, + K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, K_F12, 0, 0, K_LWIN, K_RWIN, K_MENU, 0, 0, // 5 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 7 -}; +}; static const unsigned char s_scantokey_french[256] = { // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F - 0, 27, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', ')', '=', K_BACKSPACE, 9, // 0 - 'a', 'z', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', '^', '$', K_ENTER,K_CTRL, 'q', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', - 'ù', '`', K_SHIFT, '*', 'w', 'x', 'c', 'v', // 2 + 0, 27, '1', '2', '3', '4', '5', '6', + '7', '8', '9', '0', ')', '=', K_BACKSPACE, 9, // 0 + 'a', 'z', 'e', 'r', 't', 'y', 'u', 'i', + 'o', 'p', '^', '$', K_ENTER,K_CTRL, 'q', 's', // 1 + 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', + 'ù', '`', K_SHIFT, '*', 'w', 'x', 'c', 'v', // 2 'b', 'n', ',', ';', ':', '!', K_SHIFT, K_KP_STAR, K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, K_UPARROW, K_PGUP, K_KP_MINUS,K_LEFTARROW,K_KP_5, K_RIGHTARROW,K_KP_PLUS,K_END, // 4 - K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, + K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, K_F12, 0, 0, K_LWIN, K_RWIN, K_MENU, 0, 0, // 5 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7 // shifted - 0, 27, '&', 'é', '\"', '\'', '(', '-', - 'è', '_', 'ç', 'à', '°', '+', K_BACKSPACE, 9, // 0 - 'a', 'z', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', '^', '$', K_ENTER,K_CTRL, 'q', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', - 'ù', 0, K_SHIFT, '*', 'w', 'x', 'c', 'v', // 2 + 0, 27, '&', 'é', '\"', '\'', '(', '-', + 'è', '_', 'ç', 'à', '°', '+', K_BACKSPACE, 9, // 0 + 'a', 'z', 'e', 'r', 't', 'y', 'u', 'i', + 'o', 'p', '^', '$', K_ENTER,K_CTRL, 'q', 's', // 1 + 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', + 'ù', 0, K_SHIFT, '*', 'w', 'x', 'c', 'v', // 2 'b', 'n', ',', ';', ':', '!', K_SHIFT, K_KP_STAR, K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, K_UPARROW, K_PGUP, K_KP_MINUS,K_LEFTARROW,K_KP_5, K_RIGHTARROW,K_KP_PLUS,K_END, // 4 - K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, + K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, K_F12, 0, 0, K_LWIN, K_RWIN, K_MENU, 0, 0, // 5 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 7 -}; +}; -static const unsigned char s_scantokey_spanish[256] = { +static const unsigned char s_scantokey_spanish[256] = { // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F - 0, 27, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '\'', '¡', K_BACKSPACE, 9, // 0 - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', '`', '+', K_ENTER,K_CTRL, 'a', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ñ', - '´', 'º', K_SHIFT, 'ç', 'z', 'x', 'c', 'v', // 2 - 'b', 'n', 'm', ',', '.', '-', K_SHIFT, K_KP_STAR, + 0, 27, '1', '2', '3', '4', '5', '6', + '7', '8', '9', '0', '\'', '¡', K_BACKSPACE, 9, // 0 + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', + 'o', 'p', '`', '+', K_ENTER,K_CTRL, 'a', 's', // 1 + 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ñ', + '´', 'º', K_SHIFT, 'ç', 'z', 'x', 'c', 'v', // 2 + 'b', 'n', 'm', ',', '.', '-', K_SHIFT, K_KP_STAR, K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, K_UPARROW, K_PGUP, K_KP_MINUS,K_LEFTARROW,K_KP_5, K_RIGHTARROW,K_KP_PLUS,K_END, // 4 - K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, + K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, K_F12, 0, 0, K_LWIN, K_RWIN, K_MENU, 0, 0, // 5 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7 // shifted - 0, 27, '!', '\"', '·', '$', '%', '&', - '/', '(', ')', '=', '?', '¿', K_BACKSPACE, 9, // 0 - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', '^', '*', K_ENTER,K_CTRL, 'a', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'Ñ', - '¨', 'ª', K_SHIFT, 'Ç', 'z', 'x', 'c', 'v', // 2 - 'b', 'n', 'm', ',', '.', '-', K_SHIFT, K_KP_STAR, + 0, 27, '!', '\"', '·', '$', '%', '&', + '/', '(', ')', '=', '?', '¿', K_BACKSPACE, 9, // 0 + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', + 'o', 'p', '^', '*', K_ENTER,K_CTRL, 'a', 's', // 1 + 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'Ñ', + '¨', 'ª', K_SHIFT, 'Ç', 'z', 'x', 'c', 'v', // 2 + 'b', 'n', 'm', ',', '.', '-', K_SHIFT, K_KP_STAR, K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, K_UPARROW, K_PGUP, K_KP_MINUS,K_LEFTARROW,K_KP_5, K_RIGHTARROW,K_KP_PLUS,K_END, // 4 - K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, + K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, K_F12, 0, 0, K_LWIN, K_RWIN, K_MENU, 0, 0, // 5 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 7 -}; +}; -static const unsigned char s_scantokey_italian[256] = { +static const unsigned char s_scantokey_italian[256] = { // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F - 0, 27, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '\'', 'ì', K_BACKSPACE, 9, // 0 - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', 'è', '+', K_ENTER,K_CTRL, 'a', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ò', - 'à', '\\', K_SHIFT, 'ù', 'z', 'x', 'c', 'v', // 2 - 'b', 'n', 'm', ',', '.', '-', K_SHIFT, K_KP_STAR, + 0, 27, '1', '2', '3', '4', '5', '6', + '7', '8', '9', '0', '\'', 'ì', K_BACKSPACE, 9, // 0 + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', + 'o', 'p', 'è', '+', K_ENTER,K_CTRL, 'a', 's', // 1 + 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ò', + 'à', '\\', K_SHIFT, 'ù', 'z', 'x', 'c', 'v', // 2 + 'b', 'n', 'm', ',', '.', '-', K_SHIFT, K_KP_STAR, K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, K_UPARROW, K_PGUP, K_KP_MINUS,K_LEFTARROW,K_KP_5, K_RIGHTARROW,K_KP_PLUS,K_END, // 4 - K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, + K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, K_F12, 0, 0, K_LWIN, K_RWIN, K_MENU, 0, 0, // 5 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7 // shifted - 0, 27, '!', '\"', '£', '$', '%', '&', - '/', '(', ')', '=', '?', '^', K_BACKSPACE, 9, // 0 - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', 'é', '*', K_ENTER,K_CTRL, 'a', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ç', - '°', '|', K_SHIFT, '§', 'z', 'x', 'c', 'v', // 2 - 'b', 'n', 'm', ',', '.', '-', K_SHIFT, K_KP_STAR, + 0, 27, '!', '\"', '£', '$', '%', '&', + '/', '(', ')', '=', '?', '^', K_BACKSPACE, 9, // 0 + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', + 'o', 'p', 'é', '*', K_ENTER,K_CTRL, 'a', 's', // 1 + 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ç', + '°', '|', K_SHIFT, '§', 'z', 'x', 'c', 'v', // 2 + 'b', 'n', 'm', ',', '.', '-', K_SHIFT, K_KP_STAR, K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, K_UPARROW, K_PGUP, K_KP_MINUS,K_LEFTARROW,K_KP_5, K_RIGHTARROW,K_KP_PLUS,K_END, // 4 - K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, + K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, '<', K_F11, K_F12, 0, 0, K_LWIN, K_RWIN, K_MENU, 0, 0, // 5 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 7 - -}; -static const unsigned char *keyScanTable = s_scantokey; +}; + +static const unsigned char *keyScanTable = s_scantokey; // this should be part of the scantables and the scan tables should be 512 bytes // (256 scan codes, shifted and unshifted). Changing everything to use 512 byte @@ -281,12 +281,12 @@ DIRECT INPUT KEYBOARD CONTROL */ bool IN_StartupKeyboard( void ) { - HRESULT hr; - bool bExclusive; - bool bForeground; - bool bImmediate; - bool bDisableWindowsKey; - DWORD dwCoopFlags; + HRESULT hr; + bool bExclusive; + bool bForeground; + bool bImmediate; + bool bDisableWindowsKey; + DWORD dwCoopFlags; if (!win32.g_pdi) { common->Printf("keyboard: DirectInput has not been started\n"); @@ -298,82 +298,82 @@ bool IN_StartupKeyboard( void ) { win32.g_pKeyboard = NULL; } - // Detrimine where the buffer would like to be allocated - bExclusive = false; - bForeground = true; - bImmediate = false; - bDisableWindowsKey = true; + // Detrimine where the buffer would like to be allocated + bExclusive = false; + bForeground = true; + bImmediate = false; + bDisableWindowsKey = true; - if( bExclusive ) - dwCoopFlags = DISCL_EXCLUSIVE; - else - dwCoopFlags = DISCL_NONEXCLUSIVE; + if( bExclusive ) + dwCoopFlags = DISCL_EXCLUSIVE; + else + dwCoopFlags = DISCL_NONEXCLUSIVE; - if( bForeground ) - dwCoopFlags |= DISCL_FOREGROUND; - else - dwCoopFlags |= DISCL_BACKGROUND; + if( bForeground ) + dwCoopFlags |= DISCL_FOREGROUND; + else + dwCoopFlags |= DISCL_BACKGROUND; - // Disabling the windows key is only allowed only if we are in foreground nonexclusive - if( bDisableWindowsKey && !bExclusive && bForeground ) - dwCoopFlags |= DISCL_NOWINKEY; + // Disabling the windows key is only allowed only if we are in foreground nonexclusive + if( bDisableWindowsKey && !bExclusive && bForeground ) + dwCoopFlags |= DISCL_NOWINKEY; - // Obtain an interface to the system keyboard device. - if( FAILED( hr = win32.g_pdi->CreateDevice( GUID_SysKeyboard, &win32.g_pKeyboard, NULL ) ) ) { + // Obtain an interface to the system keyboard device. + if( FAILED( hr = win32.g_pdi->CreateDevice( GUID_SysKeyboard, &win32.g_pKeyboard, NULL ) ) ) { common->Printf("keyboard: couldn't find a keyboard device\n"); - return false; - } - - // Set the data format to "keyboard format" - a predefined data format - // - // A data format specifies which controls on a device we - // are interested in, and how they should be reported. - // - // This tells DirectInput that we will be passing an array - // of 256 bytes to IDirectInputDevice::GetDeviceState. - if( FAILED( hr = win32.g_pKeyboard->SetDataFormat( &c_dfDIKeyboard ) ) ) - return false; - - // Set the cooperativity level to let DirectInput know how - // this device should interact with the system and with other - // DirectInput applications. - hr = win32.g_pKeyboard->SetCooperativeLevel( win32.hWnd, dwCoopFlags ); - if( hr == DIERR_UNSUPPORTED && !bForeground && bExclusive ) { - common->Printf("keyboard: SetCooperativeLevel() returned DIERR_UNSUPPORTED.\nFor security reasons, background exclusive keyboard access is not allowed.\n"); - return false; - } - - if( FAILED(hr) ) { - return false; + return false; } - if( !bImmediate ) { - // IMPORTANT STEP TO USE BUFFERED DEVICE DATA! - // - // DirectInput uses unbuffered I/O (buffer size = 0) by default. - // If you want to read buffered data, you need to set a nonzero - // buffer size. - // - // Set the buffer size to DINPUT_BUFFERSIZE (defined above) elements. - // - // The buffer size is a DWORD property associated with the device. - DIPROPDWORD dipdw; + // Set the data format to "keyboard format" - a predefined data format + // + // A data format specifies which controls on a device we + // are interested in, and how they should be reported. + // + // This tells DirectInput that we will be passing an array + // of 256 bytes to IDirectInputDevice::GetDeviceState. + if( FAILED( hr = win32.g_pKeyboard->SetDataFormat( &c_dfDIKeyboard ) ) ) + return false; - dipdw.diph.dwSize = sizeof(DIPROPDWORD); - dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); - dipdw.diph.dwObj = 0; - dipdw.diph.dwHow = DIPH_DEVICE; - dipdw.dwData = DINPUT_BUFFERSIZE; // Arbitary buffer size + // Set the cooperativity level to let DirectInput know how + // this device should interact with the system and with other + // DirectInput applications. + hr = win32.g_pKeyboard->SetCooperativeLevel( win32.hWnd, dwCoopFlags ); + if( hr == DIERR_UNSUPPORTED && !bForeground && bExclusive ) { + common->Printf("keyboard: SetCooperativeLevel() returned DIERR_UNSUPPORTED.\nFor security reasons, background exclusive keyboard access is not allowed.\n"); + return false; + } - if( FAILED( hr = win32.g_pKeyboard->SetProperty( DIPROP_BUFFERSIZE, &dipdw.diph ) ) ) - return false; - } + if( FAILED(hr) ) { + return false; + } - // Acquire the newly created device - win32.g_pKeyboard->Acquire(); + if( !bImmediate ) { + // IMPORTANT STEP TO USE BUFFERED DEVICE DATA! + // + // DirectInput uses unbuffered I/O (buffer size = 0) by default. + // If you want to read buffered data, you need to set a nonzero + // buffer size. + // + // Set the buffer size to DINPUT_BUFFERSIZE (defined above) elements. + // + // The buffer size is a DWORD property associated with the device. + DIPROPDWORD dipdw; + + dipdw.diph.dwSize = sizeof(DIPROPDWORD); + dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); + dipdw.diph.dwObj = 0; + dipdw.diph.dwHow = DIPH_DEVICE; + dipdw.dwData = DINPUT_BUFFERSIZE; // Arbitary buffer size + + if( FAILED( hr = win32.g_pKeyboard->SetProperty( DIPROP_BUFFERSIZE, &dipdw.diph ) ) ) + return false; + } + + // Acquire the newly created device + win32.g_pKeyboard->Acquire(); common->Printf( "keyboard: DirectInput initialized.\n"); - return true; + return true; } /* @@ -500,7 +500,7 @@ IN_InitDirectInput */ void IN_InitDirectInput( void ) { - HRESULT hr; + HRESULT hr; common->Printf( "Initializing DirectInput...\n" ); @@ -509,12 +509,12 @@ void IN_InitDirectInput( void ) { win32.g_pdi = NULL; } - // Register with the DirectInput subsystem and get a pointer - // to a IDirectInput interface we can use. - // Create the base DirectInput object + // Register with the DirectInput subsystem and get a pointer + // to a IDirectInput interface we can use. + // Create the base DirectInput object if ( FAILED( hr = DirectInput8Create( GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&win32.g_pdi, NULL ) ) ) { common->Printf ("DirectInputCreate failed\n"); - } + } } /* @@ -523,7 +523,7 @@ IN_InitDIMouse ======================== */ bool IN_InitDIMouse( void ) { - HRESULT hr; + HRESULT hr; if ( win32.g_pdi == NULL) { return false; @@ -537,18 +537,18 @@ bool IN_InitDIMouse( void ) { return false; } - // Set the data format to "mouse format" - a predefined data format - // - // A data format specifies which controls on a device we - // are interested in, and how they should be reported. - // - // This tells DirectInput that we will be passing a - // DIMOUSESTATE2 structure to IDirectInputDevice::GetDeviceState. - if( FAILED( hr = win32.g_pMouse->SetDataFormat( &c_dfDIMouse2 ) ) ) { + // Set the data format to "mouse format" - a predefined data format + // + // A data format specifies which controls on a device we + // are interested in, and how they should be reported. + // + // This tells DirectInput that we will be passing a + // DIMOUSESTATE2 structure to IDirectInputDevice::GetDeviceState. + if( FAILED( hr = win32.g_pMouse->SetDataFormat( &c_dfDIMouse2 ) ) ) { common->Printf ("mouse: Couldn't set DI mouse format\n"); return false; } - + // set the cooperativity level. hr = win32.g_pMouse->SetCooperativeLevel( win32.hWnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND); @@ -558,23 +558,23 @@ bool IN_InitDIMouse( void ) { } - // IMPORTANT STEP TO USE BUFFERED DEVICE DATA! - // - // DirectInput uses unbuffered I/O (buffer size = 0) by default. - // If you want to read buffered data, you need to set a nonzero - // buffer size. - // - // Set the buffer size to SAMPLE_BUFFER_SIZE (defined above) elements. - // - // The buffer size is a DWORD property associated with the device. - DIPROPDWORD dipdw; - dipdw.diph.dwSize = sizeof(DIPROPDWORD); - dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); - dipdw.diph.dwObj = 0; - dipdw.diph.dwHow = DIPH_DEVICE; - dipdw.dwData = DINPUT_BUFFERSIZE; // Arbitary buffer size + // IMPORTANT STEP TO USE BUFFERED DEVICE DATA! + // + // DirectInput uses unbuffered I/O (buffer size = 0) by default. + // If you want to read buffered data, you need to set a nonzero + // buffer size. + // + // Set the buffer size to SAMPLE_BUFFER_SIZE (defined above) elements. + // + // The buffer size is a DWORD property associated with the device. + DIPROPDWORD dipdw; + dipdw.diph.dwSize = sizeof(DIPROPDWORD); + dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); + dipdw.diph.dwObj = 0; + dipdw.diph.dwHow = DIPH_DEVICE; + dipdw.dwData = DINPUT_BUFFERSIZE; // Arbitary buffer size - if( FAILED( hr = win32.g_pMouse->SetProperty( DIPROP_BUFFERSIZE, &dipdw.diph ) ) ) { + if( FAILED( hr = win32.g_pMouse->SetProperty( DIPROP_BUFFERSIZE, &dipdw.diph ) ) ) { common->Printf ("mouse: Couldn't set DI buffersize\n"); return false; } @@ -674,12 +674,12 @@ void Sys_ShutdownInput( void ) { win32.g_pKeyboard = NULL; } - if ( win32.g_pMouse ) { + if ( win32.g_pMouse ) { win32.g_pMouse->Release(); win32.g_pMouse = NULL; } - if ( win32.g_pdi ) { + if ( win32.g_pdi ) { win32.g_pdi->Release(); win32.g_pdi = NULL; } @@ -717,7 +717,7 @@ void Sys_InitScanTable( void ) { } if ( lang.Icmp( "english" ) == 0 ) { keyScanTable = s_scantokey; - // the only reason that english right alt binds as K_ALT is so that + // the only reason that english right alt binds as K_ALT is so that // users who were using right-alt before the patch don't suddenly find // that only left-alt is working. rightAltKey = K_ALT; @@ -809,7 +809,7 @@ void Sys_GrabMouseCursor( bool grabIt ) { //===================================================================================== -static DIDEVICEOBJECTDATA polled_didod[ DINPUT_BUFFERSIZE ]; // Receives buffered data +static DIDEVICEOBJECTDATA polled_didod[ DINPUT_BUFFERSIZE ]; // Receives buffered data static int diFetch; static byte toggleFetch[2][ 256 ]; @@ -825,27 +825,27 @@ Sys_PollKeyboardInputEvents ==================== */ int Sys_PollKeyboardInputEvents( void ) { - DWORD dwElements; - HRESULT hr; + DWORD dwElements; + HRESULT hr; - if( win32.g_pKeyboard == NULL ) { - return 0; + if( win32.g_pKeyboard == NULL ) { + return 0; } - - dwElements = DINPUT_BUFFERSIZE; - hr = win32.g_pKeyboard->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), - polled_didod, &dwElements, 0 ); - if( hr != DI_OK ) - { - // We got an error or we got DI_BUFFEROVERFLOW. - // - // Either way, it means that continuous contact with the - // device has been lost, either due to an external - // interruption, or because the buffer overflowed - // and some events were lost. - hr = win32.g_pKeyboard->Acquire(); - + dwElements = DINPUT_BUFFERSIZE; + hr = win32.g_pKeyboard->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), + polled_didod, &dwElements, 0 ); + if( hr != DI_OK ) + { + // We got an error or we got DI_BUFFEROVERFLOW. + // + // Either way, it means that continuous contact with the + // device has been lost, either due to an external + // interruption, or because the buffer overflowed + // and some events were lost. + hr = win32.g_pKeyboard->Acquire(); + + // nuke the garbage if (!FAILED(hr)) { @@ -855,13 +855,13 @@ int Sys_PollKeyboardInputEvents( void ) { win32.g_pKeyboard->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), NULL, &dwElements, 0 ); dwElements = 0; } - // hr may be DIERR_OTHERAPPHASPRIO or other errors. This - // may occur when the app is minimized or in the process of - // switching, so just try again later - } + // hr may be DIERR_OTHERAPPHASPRIO or other errors. This + // may occur when the app is minimized or in the process of + // switching, so just try again later + } - if( FAILED(hr) ) { - return 0; + if( FAILED(hr) ) { + return 0; } return dwElements; @@ -878,34 +878,34 @@ and checking transitions ==================== */ int Sys_PollKeyboardInputEvents( void ) { - HRESULT hr; + HRESULT hr; - if( win32.g_pKeyboard == NULL ) { - return 0; + if( win32.g_pKeyboard == NULL ) { + return 0; } - + hr = win32.g_pKeyboard->GetDeviceState( sizeof( toggleFetch[ diFetch ] ), toggleFetch[ diFetch ] ); - if( hr != DI_OK ) - { - // We got an error or we got DI_BUFFEROVERFLOW. - // - // Either way, it means that continuous contact with the - // device has been lost, either due to an external - // interruption, or because the buffer overflowed - // and some events were lost. - hr = win32.g_pKeyboard->Acquire(); + if( hr != DI_OK ) + { + // We got an error or we got DI_BUFFEROVERFLOW. + // + // Either way, it means that continuous contact with the + // device has been lost, either due to an external + // interruption, or because the buffer overflowed + // and some events were lost. + hr = win32.g_pKeyboard->Acquire(); // nuke the garbage if (!FAILED(hr)) { hr = win32.g_pKeyboard->GetDeviceState( sizeof( toggleFetch[ diFetch ] ), toggleFetch[ diFetch ] ); } - // hr may be DIERR_OTHERAPPHASPRIO or other errors. This - // may occur when the app is minimized or in the process of - // switching, so just try again later - } + // hr may be DIERR_OTHERAPPHASPRIO or other errors. This + // may occur when the app is minimized or in the process of + // switching, so just try again later + } - if( FAILED(hr) ) { - return 0; + if( FAILED(hr) ) { + return 0; } // build faked events @@ -989,19 +989,19 @@ int Sys_PollMouseInputEvents( void ) { return 0; } - dwElements = DINPUT_BUFFERSIZE; - hr = win32.g_pMouse->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), polled_didod, &dwElements, 0 ); + dwElements = DINPUT_BUFFERSIZE; + hr = win32.g_pMouse->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), polled_didod, &dwElements, 0 ); - if( hr != DI_OK ) { - hr = win32.g_pMouse->Acquire(); + if( hr != DI_OK ) { + hr = win32.g_pMouse->Acquire(); // clear the garbage if (!FAILED(hr)) { win32.g_pMouse->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), polled_didod, &dwElements, 0 ); } - } + } - if( FAILED(hr) ) { - return 0; + if( FAILED(hr) ) { + return 0; } Sys_QueMouseEvents( dwElements ); diff --git a/neo/sys/win32/win_local.h b/neo/sys/win32/win_local.h index 23d1a647..4b0a6b7b 100644 --- a/neo/sys/win32/win_local.h +++ b/neo/sys/win32/win_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"). @@ -50,7 +50,7 @@ extern PFNWGLRELEASEPBUFFERDCARBPROC wglReleasePbufferDCARB; extern PFNWGLDESTROYPBUFFERARBPROC wglDestroyPbufferARB; extern PFNWGLQUERYPBUFFERARBPROC wglQueryPbufferARB; -// WGL_ARB_render_texture +// WGL_ARB_render_texture extern PFNWGLBINDTEXIMAGEARBPROC wglBindTexImageARB; extern PFNWGLRELEASETEXIMAGEARBPROC wglReleaseTexImageARB; extern PFNWGLSETPBUFFERATTRIBARBPROC wglSetPbufferAttribARB; @@ -120,7 +120,7 @@ typedef struct { HDC hDC; // handle to device context HGLRC hGLRC; // handle to GL rendering context - PIXELFORMATDESCRIPTOR pfd; + PIXELFORMATDESCRIPTOR pfd; int pixelformat; HINSTANCE hinstOpenGL; // HINSTANCE for the OpenGL library diff --git a/neo/sys/win32/win_main.cpp b/neo/sys/win32/win_main.cpp index 860901f5..bd871199 100644 --- a/neo/sys/win32/win_main.cpp +++ b/neo/sys/win32/win_main.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"). @@ -239,14 +239,14 @@ Sys_AllocHook called for every malloc/new/free/delete ================== */ -int Sys_AllocHook( int nAllocType, void *pvData, size_t nSize, int nBlockUse, long lRequest, const unsigned char * szFileName, int nLine ) +int Sys_AllocHook( int nAllocType, void *pvData, size_t nSize, int nBlockUse, long lRequest, const unsigned char * szFileName, int nLine ) { CrtMemBlockHeader *pHead; byte *temp; if ( nBlockUse == _CRT_BLOCK ) { - return( TRUE ); + return( TRUE ); } // get a pointer to memory block header @@ -294,8 +294,8 @@ Sys_DebugMemory_f ================== */ void Sys_DebugMemory_f( void ) { - common->Printf( "Total allocation %8dk in %d blocks\n", debug_total_alloc / 1024, debug_total_alloc_count ); - common->Printf( "Current allocation %8dk in %d blocks\n", debug_current_alloc / 1024, debug_current_alloc_count ); + common->Printf( "Total allocation %8dk in %d blocks\n", debug_total_alloc / 1024, debug_total_alloc_count ); + common->Printf( "Current allocation %8dk in %d blocks\n", debug_current_alloc / 1024, debug_current_alloc_count ); } /* @@ -335,7 +335,7 @@ Show the early console as an error dialog void Sys_Error( const char *error, ... ) { va_list argptr; char text[4096]; - MSG msg; + MSG msg; va_start( argptr, error ); vsprintf( text, error, argptr ); @@ -359,7 +359,7 @@ void Sys_Error( const char *error, ... ) { common->Quit(); } TranslateMessage( &msg ); - DispatchMessage( &msg ); + DispatchMessage( &msg ); } Sys_DestroyConsole(); @@ -596,7 +596,7 @@ char *Sys_GetClipboardData( void ) { data = (char *)Mem_Alloc( GlobalSize( hClipboardData ) + 1 ); strcpy( data, cliptext ); GlobalUnlock( hClipboardData ); - + strtok( data, "\n\r\b" ); } } @@ -677,7 +677,7 @@ Sys_DLL_GetProcAddress ===================== */ void *Sys_DLL_GetProcAddress( int dllHandle, const char *procName ) { - return GetProcAddress( (HINSTANCE)dllHandle, procName ); + return GetProcAddress( (HINSTANCE)dllHandle, procName ); } /* @@ -699,7 +699,7 @@ void Sys_DLL_Unload( int dllHandle ) { MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, - NULL + NULL ); Sys_Error( "Sys_DLL_Unload: FreeLibrary failed - %s (%d)", lpMsgBuf, lastError ); } @@ -759,7 +759,7 @@ This allows windows to be moved during renderbump ============= */ void Sys_PumpEvents( void ) { - MSG msg; + MSG msg; // pump the message loop while( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) { @@ -769,20 +769,20 @@ void Sys_PumpEvents( void ) { // save the msg time, because wndprocs don't have access to the timestamp if ( win32.sysMsgTime && win32.sysMsgTime > (int)msg.time ) { - // don't ever let the event times run backwards + // don't ever let the event times run backwards // common->Printf( "Sys_PumpEvents: win32.sysMsgTime (%i) > msg.time (%i)\n", win32.sysMsgTime, msg.time ); } else { win32.sysMsgTime = msg.time; } #ifdef ID_ALLOW_TOOLS - if ( GUIEditorHandleMessage ( &msg ) ) { + if ( GUIEditorHandleMessage ( &msg ) ) { continue; } #endif - + TranslateMessage (&msg); - DispatchMessage (&msg); + DispatchMessage (&msg); } } @@ -844,7 +844,7 @@ sysEvent_t Sys_GetEvent( void ) { return eventQue[ ( eventTail - 1 ) & MASK_QUED_EVENTS ]; } - // return the empty event + // return the empty event memset( &ev, 0, sizeof( ev ) ); return ev; @@ -878,7 +878,7 @@ static void Sys_AsyncThread( void *parm ) { wakeNumber = 0; while ( 1 ) { -#ifdef WIN32 +#ifdef WIN32 // this will trigger 60 times a second int r = WaitForSingleObject( hTimer, 100 ); if ( r != WAIT_OBJECT_0 ) { @@ -922,7 +922,7 @@ void Sys_StartAsyncThread( void ) { Sys_CreateThread( (xthread_t)Sys_AsyncThread, NULL, THREAD_ABOVE_NORMAL, threadInfo, "Async", g_threads, &g_thread_count ); -#ifdef SET_THREAD_AFFINITY +#ifdef SET_THREAD_AFFINITY // give the async thread an affinity for the second cpu SetThreadAffinityMask( (HANDLE)threadInfo.threadHandle, 2 ); #endif @@ -1029,9 +1029,9 @@ void Sys_Init( void ) { } } else if( win32.osversion.dwMajorVersion == 4 && win32.osversion.dwMinorVersion == 90 ) { // WinMe - win32.sys_arch.SetString( "WinMe (95)" ); + win32.sys_arch.SetString( "WinMe (95)" ); } else { - win32.sys_arch.SetString( "Unknown 95 variant" ); + win32.sys_arch.SetString( "Unknown 95 variant" ); } } else { win32.sys_arch.SetString( "unknown Windows variant" ); @@ -1070,7 +1070,7 @@ void Sys_Init( void ) { string += "SSE & "; } if ( win32.cpuid & CPUID_SSE2 ) { - string += "SSE2 & "; + string += "SSE2 & "; } if ( win32.cpuid & CPUID_SSE3 ) { string += "SSE3 & "; @@ -1135,7 +1135,7 @@ Sys_GetProcessorId ================ */ cpuid_t Sys_GetProcessorId( void ) { - return win32.cpuid; + return win32.cpuid; } /* @@ -1244,7 +1244,7 @@ void EmailCrashReport( LPSTR messageText ) { lastEmailTime = Sys_Milliseconds(); - HINSTANCE mapi = LoadLibrary( "MAPI32.DLL" ); + HINSTANCE mapi = LoadLibrary( "MAPI32.DLL" ); if( mapi ) { MAPISendMail = ( LPMAPISENDMAIL )GetProcAddress( mapi, "MAPISendMail" ); if( MAPISendMail ) { @@ -1298,7 +1298,7 @@ EXCEPTION_DISPOSITION __cdecl _except_handler( struct _EXCEPTION_RECORD *Excepti ContextRecord->FloatSave.DataSelector ); - sprintf( msg, + sprintf( msg, "Please describe what you were doing when DOOM 3 crashed!\n" "If this text did not pop into your email client please copy and email it to programmers@idsoftware.com\n" "\n" @@ -1345,8 +1345,8 @@ EXCEPTION_DISPOSITION __cdecl _except_handler( struct _EXCEPTION_RECORD *Excepti EmailCrashReport( msg ); common->FatalError( msg ); - // Tell the OS to restart the faulting instruction - return ExceptionContinueExecution; + // Tell the OS to restart the faulting instruction + return ExceptionContinueExecution; } #define TEST_FPU_EXCEPTIONS /* FPU_EXCEPTION_INVALID_OPERATION | */ \ @@ -1371,13 +1371,13 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin Sys_GetCurrentMemoryStatus( exeLaunchMemoryStats ); #if 0 - DWORD handler = (DWORD)_except_handler; - __asm - { // Build EXCEPTION_REGISTRATION record: - push handler // Address of handler function - push FS:[0] // Address of previous handler - mov FS:[0],ESP // Install new EXECEPTION_REGISTRATION - } + DWORD handler = (DWORD)_except_handler; + __asm + { // Build EXCEPTION_REGISTRATION record: + push handler // Address of handler function + push FS:[0] // Address of previous handler + mov FS:[0],ESP // Install new EXECEPTION_REGISTRATION + } #endif win32.hInstance = hInstance; @@ -1425,7 +1425,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin Sys_ShowConsole( 0, false ); } -#ifdef SET_THREAD_AFFINITY +#ifdef SET_THREAD_AFFINITY // give the main thread an affinity for the first cpu SetThreadAffinityMask( GetCurrentThread(), 1 ); #endif @@ -1440,7 +1440,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin ::SetFocus( win32.hWnd ); - // main game loop + // main game loop while( 1 ) { Win_Frame(); @@ -1517,27 +1517,27 @@ __declspec( naked ) void clrstk( void ) { // eax = bytes to add to stack __asm { mov [parmBytes],eax - neg eax ; compute new stack pointer in eax - add eax,esp - add eax,4 - xchg eax,esp - mov eax,dword ptr [eax] ; copy the return address - push eax - - ; clear to zero - push edi - push ecx - mov edi,esp - add edi,12 - mov ecx,[parmBytes] + neg eax ; compute new stack pointer in eax + add eax,esp + add eax,4 + xchg eax,esp + mov eax,dword ptr [eax] ; copy the return address + push eax + + ; clear to zero + push edi + push ecx + mov edi,esp + add edi,12 + mov ecx,[parmBytes] shr ecx,2 - xor eax,eax + xor eax,eax cld - rep stosd - pop ecx - pop edi - - ret + rep stosd + pop ecx + pop edi + + ret } } @@ -1589,7 +1589,7 @@ void idSysLocal::StartProcess( const char *exePath, bool doexit ) { strncpy( szPathOrig, exePath, _MAX_PATH ); if( !CreateProcess( NULL, szPathOrig, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ) ) { - common->Error( "Could not start process: '%s' ", szPathOrig ); + common->Error( "Could not start process: '%s' ", szPathOrig ); return; } diff --git a/neo/sys/win32/win_net.cpp b/neo/sys/win32/win_net.cpp index 25a2f4a0..ed557497 100644 --- a/neo/sys/win32/win_net.cpp +++ b/neo/sys/win32/win_net.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"). @@ -60,7 +60,7 @@ typedef struct { unsigned long mask; } net_interface; -#define MAX_INTERFACES 32 +#define MAX_INTERFACES 32 int num_interfaces = 0; net_interface netint[MAX_INTERFACES]; @@ -197,7 +197,7 @@ static bool Net_StringToSockaddr( const char *s, struct sockaddr *sadr, bool doD struct hostent *h; char buf[256]; int port; - + memset( sadr, 0, sizeof( *sadr ) ); ((struct sockaddr_in *)sadr)->sin_family = AF_INET; @@ -223,7 +223,7 @@ static bool Net_StringToSockaddr( const char *s, struct sockaddr *sadr, bool doD // try to remove the port first, otherwise the DNS gets confused into multiple timeouts // failed or not failed, buf is expected to contain the appropriate host to resolve if ( Net_ExtractPort( s, buf, sizeof( buf ), &port ) ) { - ((struct sockaddr_in *)sadr)->sin_port = htons( port ); + ((struct sockaddr_in *)sadr)->sin_port = htons( port ); } h = gethostbyname( buf ); if ( h == 0 ) { @@ -231,7 +231,7 @@ static bool Net_StringToSockaddr( const char *s, struct sockaddr *sadr, bool doD } *(int *)&((struct sockaddr_in *)sadr)->sin_addr = *(int *)h->h_addr_list[0]; } - + return true; } @@ -527,7 +527,7 @@ Net_GetUDPPacket ================== */ bool Net_GetUDPPacket( int netSocket, netadr_t &net_from, char *data, int &size, int maxSize ) { - int ret; + int ret; struct sockaddr from; int fromlen; int err; @@ -664,7 +664,7 @@ void Sys_InitNetworking( void ) { // the necessary size into the ulOutBufLen variable if( GetAdaptersInfo( pAdapterInfo, &ulOutBufLen ) == ERROR_BUFFER_OVERFLOW ) { free( pAdapterInfo ); - pAdapterInfo = (IP_ADAPTER_INFO *)malloc( ulOutBufLen ); + pAdapterInfo = (IP_ADAPTER_INFO *)malloc( ulOutBufLen ); if( !pAdapterInfo ) { common->FatalError( "Sys_InitNetworking: Couldn't malloc( %ld )", ulOutBufLen ); } @@ -736,11 +736,11 @@ Sys_StringToNetAdr */ bool Sys_StringToNetAdr( const char *s, netadr_t *a, bool doDNSResolve ) { struct sockaddr sadr; - + if ( !Net_StringToSockaddr( s, &sadr, doDNSResolve ) ) { return false; } - + Net_SockadrToNetadr( &sadr, a ); return true; } @@ -794,13 +794,13 @@ bool Sys_IsLANAddress( const netadr_t adr ) { unsigned long ip; p_ip = (unsigned long *)&adr.ip[0]; ip = ntohl( *p_ip ); - + for( i=0; i < num_interfaces; i++ ) { if( ( netint[i].ip & netint[i].mask ) == ( ip & netint[i].mask ) ) { return true; } - } - } + } + } return false; } @@ -1101,27 +1101,27 @@ bool idTCP::Init( const char *host, short port ) { if ( !address.port ) { address.port = port; } - common->Printf( "\"%s\" resolved to %i.%i.%i.%i:%i\n", host, + common->Printf( "\"%s\" resolved to %i.%i.%i.%i:%i\n", host, address.ip[0], address.ip[1], address.ip[2], address.ip[3], address.port ); Net_NetadrToSockadr( &address, &sadr ); if ( fd ) { common->Warning( "idTCP::Init: already initialized?" ); } - + if ( ( fd = socket( AF_INET, SOCK_STREAM, 0 ) ) == INVALID_SOCKET ) { fd = 0; common->Printf( "ERROR: idTCP::Init: socket: %s\n", NET_ErrorString() ); return false; } - + if ( connect( fd, &sadr, sizeof(sadr)) == SOCKET_ERROR ) { common->Printf( "ERROR: idTCP::Init: connect: %s\n", NET_ErrorString() ); closesocket( fd ); fd = 0; return false; } - + // make it non-blocking if( ioctlsocket( fd, FIONBIO, &_true ) == SOCKET_ERROR ) { common->Printf( "ERROR: idTCP::Init: ioctl FIONBIO: %s\n", NET_ErrorString() ); @@ -1129,7 +1129,7 @@ bool idTCP::Init( const char *host, short port ) { fd = 0; return false; } - + common->DPrintf( "Opened TCP connection\n" ); return true; } @@ -1153,12 +1153,12 @@ idTCP::Read */ int idTCP::Read( void *data, int size ) { int nbytes; - + if ( !fd ) { common->Printf("idTCP::Read: not initialized\n"); return -1; } - + if ( ( nbytes = recv( fd, (char *)data, size, 0 ) ) == SOCKET_ERROR ) { if ( WSAGetLastError() == WSAEWOULDBLOCK ) { return 0; @@ -1184,7 +1184,7 @@ idTCP::Write */ int idTCP::Write( void *data, int size ) { int nbytes; - + if ( !fd ) { common->Printf("idTCP::Write: not initialized\n"); return -1; @@ -1195,6 +1195,6 @@ int idTCP::Write( void *data, int size ) { Close(); return -1; } - + return nbytes; } diff --git a/neo/sys/win32/win_qgl.cpp b/neo/sys/win32/win_qgl.cpp index f7dc75b5..d667e996 100644 --- a/neo/sys/win32/win_qgl.cpp +++ b/neo/sys/win32/win_qgl.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"). @@ -61,14 +61,14 @@ BOOL ( WINAPI * qwglShareLists)(HGLRC, HGLRC); BOOL ( WINAPI * qwglUseFontBitmaps)(HDC, DWORD, DWORD, DWORD); BOOL ( WINAPI * qwglUseFontOutlines)(HDC, DWORD, DWORD, DWORD, FLOAT, - FLOAT, int, LPGLYPHMETRICSFLOAT); + FLOAT, int, LPGLYPHMETRICSFLOAT); BOOL ( WINAPI * qwglDescribeLayerPlane)(HDC, int, int, UINT, - LPLAYERPLANEDESCRIPTOR); + LPLAYERPLANEDESCRIPTOR); int ( WINAPI * qwglSetLayerPaletteEntries)(HDC, int, int, int, - CONST COLORREF *); + CONST COLORREF *); int ( WINAPI * qwglGetLayerPaletteEntries)(HDC, int, int, int, - COLORREF *); + COLORREF *); BOOL ( WINAPI * qwglRealizeLayerPalette)(HDC, int, BOOL); BOOL ( WINAPI * qwglSwapLayerBuffers)(HDC, UINT); @@ -1681,8 +1681,8 @@ void QGL_Shutdown( void ) /* ** QGL_Init ** -** This is responsible for binding our qgl function pointers to -** the appropriate GL stuff. In Windows this means doing a +** This is responsible for binding our qgl function pointers to +** the appropriate GL stuff. In Windows this means doing a ** LoadLibrary and a bunch of calls to GetProcAddress. On other ** operating systems we need to do the right thing, whatever that ** might be. @@ -1774,270 +1774,270 @@ bool QGL_Init( const char *dllname ) qglEdgeFlag = dllEdgeFlag = glEdgeFlag; qglEdgeFlagPointer = dllEdgeFlagPointer = glEdgeFlagPointer; qglEdgeFlagv = dllEdgeFlagv = glEdgeFlagv; - qglEnable = dllEnable = glEnable; - qglEnableClientState = dllEnableClientState = glEnableClientState; - qglEnd = dllEnd = glEnd; - qglEndList = dllEndList = glEndList; - qglEvalCoord1d = dllEvalCoord1d = glEvalCoord1d; - qglEvalCoord1dv = dllEvalCoord1dv = glEvalCoord1dv; - qglEvalCoord1f = dllEvalCoord1f = glEvalCoord1f; - qglEvalCoord1fv = dllEvalCoord1fv = glEvalCoord1fv; - qglEvalCoord2d = dllEvalCoord2d = glEvalCoord2d; - qglEvalCoord2dv = dllEvalCoord2dv = glEvalCoord2dv; - qglEvalCoord2f = dllEvalCoord2f = glEvalCoord2f; - qglEvalCoord2fv = dllEvalCoord2fv = glEvalCoord2fv; - qglEvalMesh1 = dllEvalMesh1 = glEvalMesh1; - qglEvalMesh2 = dllEvalMesh2 = glEvalMesh2; - qglEvalPoint1 = dllEvalPoint1 = glEvalPoint1; - qglEvalPoint2 = dllEvalPoint2 = glEvalPoint2; - qglFeedbackBuffer = dllFeedbackBuffer = glFeedbackBuffer; - qglFinish = dllFinish = glFinish; - qglFlush = dllFlush = glFlush; - qglFogf = dllFogf = glFogf; - qglFogfv = dllFogfv = glFogfv; - qglFogi = dllFogi = glFogi; - qglFogiv = dllFogiv = glFogiv; - qglFrontFace = dllFrontFace = glFrontFace; - qglFrustum = dllFrustum = glFrustum; - qglGenLists = dllGenLists = ( GLuint (__stdcall * )(int) ) glGenLists; - qglGenTextures = dllGenTextures = glGenTextures; - qglGetBooleanv = dllGetBooleanv = glGetBooleanv; - qglGetClipPlane = dllGetClipPlane = glGetClipPlane; - qglGetDoublev = dllGetDoublev = glGetDoublev; - qglGetError = dllGetError = ( GLenum (__stdcall * )(void) ) glGetError; - qglGetFloatv = dllGetFloatv = glGetFloatv; - qglGetIntegerv = dllGetIntegerv = glGetIntegerv; - qglGetLightfv = dllGetLightfv = glGetLightfv; - qglGetLightiv = dllGetLightiv = glGetLightiv; - qglGetMapdv = dllGetMapdv = glGetMapdv; - qglGetMapfv = dllGetMapfv = glGetMapfv; - qglGetMapiv = dllGetMapiv = glGetMapiv; - qglGetMaterialfv = dllGetMaterialfv = glGetMaterialfv; - qglGetMaterialiv = dllGetMaterialiv = glGetMaterialiv; - qglGetPixelMapfv = dllGetPixelMapfv = glGetPixelMapfv; - qglGetPixelMapuiv = dllGetPixelMapuiv = glGetPixelMapuiv; - qglGetPixelMapusv = dllGetPixelMapusv = glGetPixelMapusv; - qglGetPointerv = dllGetPointerv = glGetPointerv; - qglGetPolygonStipple = dllGetPolygonStipple = glGetPolygonStipple; - qglGetString = dllGetString = glGetString; - qglGetTexEnvfv = dllGetTexEnvfv = glGetTexEnvfv; - qglGetTexEnviv = dllGetTexEnviv = glGetTexEnviv; - qglGetTexGendv = dllGetTexGendv = glGetTexGendv; - qglGetTexGenfv = dllGetTexGenfv = glGetTexGenfv; - qglGetTexGeniv = dllGetTexGeniv = glGetTexGeniv; - qglGetTexImage = dllGetTexImage = glGetTexImage; - qglGetTexLevelParameterfv = dllGetTexLevelParameterfv = glGetTexLevelParameterfv; - qglGetTexLevelParameteriv = dllGetTexLevelParameteriv = glGetTexLevelParameteriv; - qglGetTexParameterfv = dllGetTexParameterfv = glGetTexParameterfv; - qglGetTexParameteriv = dllGetTexParameteriv = glGetTexParameteriv; - qglHint = dllHint = glHint; - qglIndexMask = dllIndexMask = glIndexMask; - qglIndexPointer = dllIndexPointer = glIndexPointer; - qglIndexd = dllIndexd = glIndexd; - qglIndexdv = dllIndexdv = glIndexdv; - qglIndexf = dllIndexf = glIndexf; - qglIndexfv = dllIndexfv = glIndexfv; - qglIndexi = dllIndexi = glIndexi; - qglIndexiv = dllIndexiv = glIndexiv; - qglIndexs = dllIndexs = glIndexs; - qglIndexsv = dllIndexsv = glIndexsv; - qglIndexub = dllIndexub = glIndexub; - qglIndexubv = dllIndexubv = glIndexubv; - qglInitNames = dllInitNames = glInitNames; - qglInterleavedArrays = dllInterleavedArrays = glInterleavedArrays; - qglIsEnabled = dllIsEnabled = glIsEnabled; - qglIsList = dllIsList = glIsList; - qglIsTexture = dllIsTexture = glIsTexture; - qglLightModelf = dllLightModelf = glLightModelf; - qglLightModelfv = dllLightModelfv = glLightModelfv; - qglLightModeli = dllLightModeli = glLightModeli; - qglLightModeliv = dllLightModeliv = glLightModeliv; - qglLightf = dllLightf = glLightf; - qglLightfv = dllLightfv = glLightfv; - qglLighti = dllLighti = glLighti; - qglLightiv = dllLightiv = glLightiv; - qglLineStipple = dllLineStipple = glLineStipple; - qglLineWidth = dllLineWidth = glLineWidth; - qglListBase = dllListBase = glListBase; - qglLoadIdentity = dllLoadIdentity = glLoadIdentity; - qglLoadMatrixd = dllLoadMatrixd = glLoadMatrixd; - qglLoadMatrixf = dllLoadMatrixf = glLoadMatrixf; - qglLoadName = dllLoadName = glLoadName; - qglLogicOp = dllLogicOp = glLogicOp; - qglMap1d = dllMap1d = glMap1d; - qglMap1f = dllMap1f = glMap1f; - qglMap2d = dllMap2d = glMap2d; - qglMap2f = dllMap2f = glMap2f; - qglMapGrid1d = dllMapGrid1d = glMapGrid1d; - qglMapGrid1f = dllMapGrid1f = glMapGrid1f; - qglMapGrid2d = dllMapGrid2d = glMapGrid2d; - qglMapGrid2f = dllMapGrid2f = glMapGrid2f; - qglMaterialf = dllMaterialf = glMaterialf; - qglMaterialfv = dllMaterialfv = glMaterialfv; - qglMateriali = dllMateriali = glMateriali; - qglMaterialiv = dllMaterialiv = glMaterialiv; - qglMatrixMode = dllMatrixMode = glMatrixMode; - qglMultMatrixd = dllMultMatrixd = glMultMatrixd; - qglMultMatrixf = dllMultMatrixf = glMultMatrixf; - qglNewList = dllNewList = glNewList; - qglNormal3b = dllNormal3b = glNormal3b; - qglNormal3bv = dllNormal3bv = glNormal3bv; - qglNormal3d = dllNormal3d = glNormal3d; - qglNormal3dv = dllNormal3dv = glNormal3dv; - qglNormal3f = dllNormal3f = glNormal3f; - qglNormal3fv = dllNormal3fv = glNormal3fv; - qglNormal3i = dllNormal3i = glNormal3i; - qglNormal3iv = dllNormal3iv = glNormal3iv; - qglNormal3s = dllNormal3s = glNormal3s; - qglNormal3sv = dllNormal3sv = glNormal3sv; - qglNormalPointer = dllNormalPointer = glNormalPointer; - qglOrtho = dllOrtho = glOrtho; - qglPassThrough = dllPassThrough = glPassThrough; - qglPixelMapfv = dllPixelMapfv = glPixelMapfv; - qglPixelMapuiv = dllPixelMapuiv = glPixelMapuiv; - qglPixelMapusv = dllPixelMapusv = glPixelMapusv; - qglPixelStoref = dllPixelStoref = glPixelStoref; - qglPixelStorei = dllPixelStorei = glPixelStorei; - qglPixelTransferf = dllPixelTransferf = glPixelTransferf; - qglPixelTransferi = dllPixelTransferi = glPixelTransferi; - qglPixelZoom = dllPixelZoom = glPixelZoom; - qglPointSize = dllPointSize = glPointSize; - qglPolygonMode = dllPolygonMode = glPolygonMode; - qglPolygonOffset = dllPolygonOffset = glPolygonOffset; - qglPolygonStipple = dllPolygonStipple = glPolygonStipple; - qglPopAttrib = dllPopAttrib = glPopAttrib; - qglPopClientAttrib = dllPopClientAttrib = glPopClientAttrib; - qglPopMatrix = dllPopMatrix = glPopMatrix; - qglPopName = dllPopName = glPopName; - qglPrioritizeTextures = dllPrioritizeTextures = glPrioritizeTextures; - qglPushAttrib = dllPushAttrib = glPushAttrib; - qglPushClientAttrib = dllPushClientAttrib = glPushClientAttrib; - qglPushMatrix = dllPushMatrix = glPushMatrix; - qglPushName = dllPushName = glPushName; - qglRasterPos2d = dllRasterPos2d = glRasterPos2d; - qglRasterPos2dv = dllRasterPos2dv = glRasterPos2dv; - qglRasterPos2f = dllRasterPos2f = glRasterPos2f; - qglRasterPos2fv = dllRasterPos2fv = glRasterPos2fv; - qglRasterPos2i = dllRasterPos2i = glRasterPos2i; - qglRasterPos2iv = dllRasterPos2iv = glRasterPos2iv; - qglRasterPos2s = dllRasterPos2s = glRasterPos2s; - qglRasterPos2sv = dllRasterPos2sv = glRasterPos2sv; - qglRasterPos3d = dllRasterPos3d = glRasterPos3d; - qglRasterPos3dv = dllRasterPos3dv = glRasterPos3dv; - qglRasterPos3f = dllRasterPos3f = glRasterPos3f; - qglRasterPos3fv = dllRasterPos3fv = glRasterPos3fv; - qglRasterPos3i = dllRasterPos3i = glRasterPos3i; - qglRasterPos3iv = dllRasterPos3iv = glRasterPos3iv; - qglRasterPos3s = dllRasterPos3s = glRasterPos3s; - qglRasterPos3sv = dllRasterPos3sv = glRasterPos3sv; - qglRasterPos4d = dllRasterPos4d = glRasterPos4d; - qglRasterPos4dv = dllRasterPos4dv = glRasterPos4dv; - qglRasterPos4f = dllRasterPos4f = glRasterPos4f; - qglRasterPos4fv = dllRasterPos4fv = glRasterPos4fv; - qglRasterPos4i = dllRasterPos4i = glRasterPos4i; - qglRasterPos4iv = dllRasterPos4iv = glRasterPos4iv; - qglRasterPos4s = dllRasterPos4s = glRasterPos4s; - qglRasterPos4sv = dllRasterPos4sv = glRasterPos4sv; - qglReadBuffer = dllReadBuffer = glReadBuffer; - qglReadPixels = dllReadPixels = glReadPixels; - qglRectd = dllRectd = glRectd; - qglRectdv = dllRectdv = glRectdv; - qglRectf = dllRectf = glRectf; - qglRectfv = dllRectfv = glRectfv; - qglRecti = dllRecti = glRecti; - qglRectiv = dllRectiv = glRectiv; - qglRects = dllRects = glRects; - qglRectsv = dllRectsv = glRectsv; - qglRenderMode = dllRenderMode = glRenderMode; - qglRotated = dllRotated = glRotated; - qglRotatef = dllRotatef = glRotatef; - qglScaled = dllScaled = glScaled; - qglScalef = dllScalef = glScalef; - qglScissor = dllScissor = glScissor; - qglSelectBuffer = dllSelectBuffer = glSelectBuffer; - qglShadeModel = dllShadeModel = glShadeModel; - qglStencilFunc = dllStencilFunc = glStencilFunc; - qglStencilMask = dllStencilMask = glStencilMask; - qglStencilOp = dllStencilOp = glStencilOp; - qglTexCoord1d = dllTexCoord1d = glTexCoord1d; - qglTexCoord1dv = dllTexCoord1dv = glTexCoord1dv; - qglTexCoord1f = dllTexCoord1f = glTexCoord1f; - qglTexCoord1fv = dllTexCoord1fv = glTexCoord1fv; - qglTexCoord1i = dllTexCoord1i = glTexCoord1i; - qglTexCoord1iv = dllTexCoord1iv = glTexCoord1iv; - qglTexCoord1s = dllTexCoord1s = glTexCoord1s; - qglTexCoord1sv = dllTexCoord1sv = glTexCoord1sv; - qglTexCoord2d = dllTexCoord2d = glTexCoord2d; - qglTexCoord2dv = dllTexCoord2dv = glTexCoord2dv; - qglTexCoord2f = dllTexCoord2f = glTexCoord2f; - qglTexCoord2fv = dllTexCoord2fv = glTexCoord2fv; - qglTexCoord2i = dllTexCoord2i = glTexCoord2i; - qglTexCoord2iv = dllTexCoord2iv = glTexCoord2iv; - qglTexCoord2s = dllTexCoord2s = glTexCoord2s; - qglTexCoord2sv = dllTexCoord2sv = glTexCoord2sv; - qglTexCoord3d = dllTexCoord3d = glTexCoord3d; - qglTexCoord3dv = dllTexCoord3dv = glTexCoord3dv; - qglTexCoord3f = dllTexCoord3f = glTexCoord3f; - qglTexCoord3fv = dllTexCoord3fv = glTexCoord3fv; - qglTexCoord3i = dllTexCoord3i = glTexCoord3i; - qglTexCoord3iv = dllTexCoord3iv = glTexCoord3iv; - qglTexCoord3s = dllTexCoord3s = glTexCoord3s; - qglTexCoord3sv = dllTexCoord3sv = glTexCoord3sv; - qglTexCoord4d = dllTexCoord4d = glTexCoord4d; - qglTexCoord4dv = dllTexCoord4dv = glTexCoord4dv; - qglTexCoord4f = dllTexCoord4f = glTexCoord4f; - qglTexCoord4fv = dllTexCoord4fv = glTexCoord4fv; - qglTexCoord4i = dllTexCoord4i = glTexCoord4i; - qglTexCoord4iv = dllTexCoord4iv = glTexCoord4iv; - qglTexCoord4s = dllTexCoord4s = glTexCoord4s; - qglTexCoord4sv = dllTexCoord4sv = glTexCoord4sv; - qglTexCoordPointer = dllTexCoordPointer = glTexCoordPointer; - qglTexEnvf = dllTexEnvf = glTexEnvf; - qglTexEnvfv = dllTexEnvfv = glTexEnvfv; - qglTexEnvi = dllTexEnvi = glTexEnvi; - qglTexEnviv = dllTexEnviv = glTexEnviv; - qglTexGend = dllTexGend = glTexGend; - qglTexGendv = dllTexGendv = glTexGendv; - qglTexGenf = dllTexGenf = glTexGenf; - qglTexGenfv = dllTexGenfv = glTexGenfv; - qglTexGeni = dllTexGeni = glTexGeni; - qglTexGeniv = dllTexGeniv = glTexGeniv; - qglTexImage1D = dllTexImage1D = glTexImage1D; - qglTexImage2D = dllTexImage2D = glTexImage2D; - qglTexParameterf = dllTexParameterf = glTexParameterf; - qglTexParameterfv = dllTexParameterfv = glTexParameterfv; - qglTexParameteri = dllTexParameteri = glTexParameteri; - qglTexParameteriv = dllTexParameteriv = glTexParameteriv; - qglTexSubImage1D = dllTexSubImage1D = glTexSubImage1D; - qglTexSubImage2D = dllTexSubImage2D = glTexSubImage2D; - qglTranslated = dllTranslated = glTranslated; - qglTranslatef = dllTranslatef = glTranslatef; - qglVertex2d = dllVertex2d = glVertex2d; - qglVertex2dv = dllVertex2dv = glVertex2dv; - qglVertex2f = dllVertex2f = glVertex2f; - qglVertex2fv = dllVertex2fv = glVertex2fv; - qglVertex2i = dllVertex2i = glVertex2i; - qglVertex2iv = dllVertex2iv = glVertex2iv; - qglVertex2s = dllVertex2s = glVertex2s; - qglVertex2sv = dllVertex2sv = glVertex2sv; - qglVertex3d = dllVertex3d = glVertex3d; - qglVertex3dv = dllVertex3dv = glVertex3dv; - qglVertex3f = dllVertex3f = glVertex3f; - qglVertex3fv = dllVertex3fv = glVertex3fv; - qglVertex3i = dllVertex3i = glVertex3i; - qglVertex3iv = dllVertex3iv = glVertex3iv; - qglVertex3s = dllVertex3s = glVertex3s; - qglVertex3sv = dllVertex3sv = glVertex3sv; - qglVertex4d = dllVertex4d = glVertex4d; - qglVertex4dv = dllVertex4dv = glVertex4dv; - qglVertex4f = dllVertex4f = glVertex4f; - qglVertex4fv = dllVertex4fv = glVertex4fv; - qglVertex4i = dllVertex4i = glVertex4i; - qglVertex4iv = dllVertex4iv = glVertex4iv; - qglVertex4s = dllVertex4s = glVertex4s; - qglVertex4sv = dllVertex4sv = glVertex4sv; - qglVertexPointer = dllVertexPointer = glVertexPointer; - qglViewport = dllViewport = glViewport; + qglEnable = dllEnable = glEnable; + qglEnableClientState = dllEnableClientState = glEnableClientState; + qglEnd = dllEnd = glEnd; + qglEndList = dllEndList = glEndList; + qglEvalCoord1d = dllEvalCoord1d = glEvalCoord1d; + qglEvalCoord1dv = dllEvalCoord1dv = glEvalCoord1dv; + qglEvalCoord1f = dllEvalCoord1f = glEvalCoord1f; + qglEvalCoord1fv = dllEvalCoord1fv = glEvalCoord1fv; + qglEvalCoord2d = dllEvalCoord2d = glEvalCoord2d; + qglEvalCoord2dv = dllEvalCoord2dv = glEvalCoord2dv; + qglEvalCoord2f = dllEvalCoord2f = glEvalCoord2f; + qglEvalCoord2fv = dllEvalCoord2fv = glEvalCoord2fv; + qglEvalMesh1 = dllEvalMesh1 = glEvalMesh1; + qglEvalMesh2 = dllEvalMesh2 = glEvalMesh2; + qglEvalPoint1 = dllEvalPoint1 = glEvalPoint1; + qglEvalPoint2 = dllEvalPoint2 = glEvalPoint2; + qglFeedbackBuffer = dllFeedbackBuffer = glFeedbackBuffer; + qglFinish = dllFinish = glFinish; + qglFlush = dllFlush = glFlush; + qglFogf = dllFogf = glFogf; + qglFogfv = dllFogfv = glFogfv; + qglFogi = dllFogi = glFogi; + qglFogiv = dllFogiv = glFogiv; + qglFrontFace = dllFrontFace = glFrontFace; + qglFrustum = dllFrustum = glFrustum; + qglGenLists = dllGenLists = ( GLuint (__stdcall * )(int) ) glGenLists; + qglGenTextures = dllGenTextures = glGenTextures; + qglGetBooleanv = dllGetBooleanv = glGetBooleanv; + qglGetClipPlane = dllGetClipPlane = glGetClipPlane; + qglGetDoublev = dllGetDoublev = glGetDoublev; + qglGetError = dllGetError = ( GLenum (__stdcall * )(void) ) glGetError; + qglGetFloatv = dllGetFloatv = glGetFloatv; + qglGetIntegerv = dllGetIntegerv = glGetIntegerv; + qglGetLightfv = dllGetLightfv = glGetLightfv; + qglGetLightiv = dllGetLightiv = glGetLightiv; + qglGetMapdv = dllGetMapdv = glGetMapdv; + qglGetMapfv = dllGetMapfv = glGetMapfv; + qglGetMapiv = dllGetMapiv = glGetMapiv; + qglGetMaterialfv = dllGetMaterialfv = glGetMaterialfv; + qglGetMaterialiv = dllGetMaterialiv = glGetMaterialiv; + qglGetPixelMapfv = dllGetPixelMapfv = glGetPixelMapfv; + qglGetPixelMapuiv = dllGetPixelMapuiv = glGetPixelMapuiv; + qglGetPixelMapusv = dllGetPixelMapusv = glGetPixelMapusv; + qglGetPointerv = dllGetPointerv = glGetPointerv; + qglGetPolygonStipple = dllGetPolygonStipple = glGetPolygonStipple; + qglGetString = dllGetString = glGetString; + qglGetTexEnvfv = dllGetTexEnvfv = glGetTexEnvfv; + qglGetTexEnviv = dllGetTexEnviv = glGetTexEnviv; + qglGetTexGendv = dllGetTexGendv = glGetTexGendv; + qglGetTexGenfv = dllGetTexGenfv = glGetTexGenfv; + qglGetTexGeniv = dllGetTexGeniv = glGetTexGeniv; + qglGetTexImage = dllGetTexImage = glGetTexImage; + qglGetTexLevelParameterfv = dllGetTexLevelParameterfv = glGetTexLevelParameterfv; + qglGetTexLevelParameteriv = dllGetTexLevelParameteriv = glGetTexLevelParameteriv; + qglGetTexParameterfv = dllGetTexParameterfv = glGetTexParameterfv; + qglGetTexParameteriv = dllGetTexParameteriv = glGetTexParameteriv; + qglHint = dllHint = glHint; + qglIndexMask = dllIndexMask = glIndexMask; + qglIndexPointer = dllIndexPointer = glIndexPointer; + qglIndexd = dllIndexd = glIndexd; + qglIndexdv = dllIndexdv = glIndexdv; + qglIndexf = dllIndexf = glIndexf; + qglIndexfv = dllIndexfv = glIndexfv; + qglIndexi = dllIndexi = glIndexi; + qglIndexiv = dllIndexiv = glIndexiv; + qglIndexs = dllIndexs = glIndexs; + qglIndexsv = dllIndexsv = glIndexsv; + qglIndexub = dllIndexub = glIndexub; + qglIndexubv = dllIndexubv = glIndexubv; + qglInitNames = dllInitNames = glInitNames; + qglInterleavedArrays = dllInterleavedArrays = glInterleavedArrays; + qglIsEnabled = dllIsEnabled = glIsEnabled; + qglIsList = dllIsList = glIsList; + qglIsTexture = dllIsTexture = glIsTexture; + qglLightModelf = dllLightModelf = glLightModelf; + qglLightModelfv = dllLightModelfv = glLightModelfv; + qglLightModeli = dllLightModeli = glLightModeli; + qglLightModeliv = dllLightModeliv = glLightModeliv; + qglLightf = dllLightf = glLightf; + qglLightfv = dllLightfv = glLightfv; + qglLighti = dllLighti = glLighti; + qglLightiv = dllLightiv = glLightiv; + qglLineStipple = dllLineStipple = glLineStipple; + qglLineWidth = dllLineWidth = glLineWidth; + qglListBase = dllListBase = glListBase; + qglLoadIdentity = dllLoadIdentity = glLoadIdentity; + qglLoadMatrixd = dllLoadMatrixd = glLoadMatrixd; + qglLoadMatrixf = dllLoadMatrixf = glLoadMatrixf; + qglLoadName = dllLoadName = glLoadName; + qglLogicOp = dllLogicOp = glLogicOp; + qglMap1d = dllMap1d = glMap1d; + qglMap1f = dllMap1f = glMap1f; + qglMap2d = dllMap2d = glMap2d; + qglMap2f = dllMap2f = glMap2f; + qglMapGrid1d = dllMapGrid1d = glMapGrid1d; + qglMapGrid1f = dllMapGrid1f = glMapGrid1f; + qglMapGrid2d = dllMapGrid2d = glMapGrid2d; + qglMapGrid2f = dllMapGrid2f = glMapGrid2f; + qglMaterialf = dllMaterialf = glMaterialf; + qglMaterialfv = dllMaterialfv = glMaterialfv; + qglMateriali = dllMateriali = glMateriali; + qglMaterialiv = dllMaterialiv = glMaterialiv; + qglMatrixMode = dllMatrixMode = glMatrixMode; + qglMultMatrixd = dllMultMatrixd = glMultMatrixd; + qglMultMatrixf = dllMultMatrixf = glMultMatrixf; + qglNewList = dllNewList = glNewList; + qglNormal3b = dllNormal3b = glNormal3b; + qglNormal3bv = dllNormal3bv = glNormal3bv; + qglNormal3d = dllNormal3d = glNormal3d; + qglNormal3dv = dllNormal3dv = glNormal3dv; + qglNormal3f = dllNormal3f = glNormal3f; + qglNormal3fv = dllNormal3fv = glNormal3fv; + qglNormal3i = dllNormal3i = glNormal3i; + qglNormal3iv = dllNormal3iv = glNormal3iv; + qglNormal3s = dllNormal3s = glNormal3s; + qglNormal3sv = dllNormal3sv = glNormal3sv; + qglNormalPointer = dllNormalPointer = glNormalPointer; + qglOrtho = dllOrtho = glOrtho; + qglPassThrough = dllPassThrough = glPassThrough; + qglPixelMapfv = dllPixelMapfv = glPixelMapfv; + qglPixelMapuiv = dllPixelMapuiv = glPixelMapuiv; + qglPixelMapusv = dllPixelMapusv = glPixelMapusv; + qglPixelStoref = dllPixelStoref = glPixelStoref; + qglPixelStorei = dllPixelStorei = glPixelStorei; + qglPixelTransferf = dllPixelTransferf = glPixelTransferf; + qglPixelTransferi = dllPixelTransferi = glPixelTransferi; + qglPixelZoom = dllPixelZoom = glPixelZoom; + qglPointSize = dllPointSize = glPointSize; + qglPolygonMode = dllPolygonMode = glPolygonMode; + qglPolygonOffset = dllPolygonOffset = glPolygonOffset; + qglPolygonStipple = dllPolygonStipple = glPolygonStipple; + qglPopAttrib = dllPopAttrib = glPopAttrib; + qglPopClientAttrib = dllPopClientAttrib = glPopClientAttrib; + qglPopMatrix = dllPopMatrix = glPopMatrix; + qglPopName = dllPopName = glPopName; + qglPrioritizeTextures = dllPrioritizeTextures = glPrioritizeTextures; + qglPushAttrib = dllPushAttrib = glPushAttrib; + qglPushClientAttrib = dllPushClientAttrib = glPushClientAttrib; + qglPushMatrix = dllPushMatrix = glPushMatrix; + qglPushName = dllPushName = glPushName; + qglRasterPos2d = dllRasterPos2d = glRasterPos2d; + qglRasterPos2dv = dllRasterPos2dv = glRasterPos2dv; + qglRasterPos2f = dllRasterPos2f = glRasterPos2f; + qglRasterPos2fv = dllRasterPos2fv = glRasterPos2fv; + qglRasterPos2i = dllRasterPos2i = glRasterPos2i; + qglRasterPos2iv = dllRasterPos2iv = glRasterPos2iv; + qglRasterPos2s = dllRasterPos2s = glRasterPos2s; + qglRasterPos2sv = dllRasterPos2sv = glRasterPos2sv; + qglRasterPos3d = dllRasterPos3d = glRasterPos3d; + qglRasterPos3dv = dllRasterPos3dv = glRasterPos3dv; + qglRasterPos3f = dllRasterPos3f = glRasterPos3f; + qglRasterPos3fv = dllRasterPos3fv = glRasterPos3fv; + qglRasterPos3i = dllRasterPos3i = glRasterPos3i; + qglRasterPos3iv = dllRasterPos3iv = glRasterPos3iv; + qglRasterPos3s = dllRasterPos3s = glRasterPos3s; + qglRasterPos3sv = dllRasterPos3sv = glRasterPos3sv; + qglRasterPos4d = dllRasterPos4d = glRasterPos4d; + qglRasterPos4dv = dllRasterPos4dv = glRasterPos4dv; + qglRasterPos4f = dllRasterPos4f = glRasterPos4f; + qglRasterPos4fv = dllRasterPos4fv = glRasterPos4fv; + qglRasterPos4i = dllRasterPos4i = glRasterPos4i; + qglRasterPos4iv = dllRasterPos4iv = glRasterPos4iv; + qglRasterPos4s = dllRasterPos4s = glRasterPos4s; + qglRasterPos4sv = dllRasterPos4sv = glRasterPos4sv; + qglReadBuffer = dllReadBuffer = glReadBuffer; + qglReadPixels = dllReadPixels = glReadPixels; + qglRectd = dllRectd = glRectd; + qglRectdv = dllRectdv = glRectdv; + qglRectf = dllRectf = glRectf; + qglRectfv = dllRectfv = glRectfv; + qglRecti = dllRecti = glRecti; + qglRectiv = dllRectiv = glRectiv; + qglRects = dllRects = glRects; + qglRectsv = dllRectsv = glRectsv; + qglRenderMode = dllRenderMode = glRenderMode; + qglRotated = dllRotated = glRotated; + qglRotatef = dllRotatef = glRotatef; + qglScaled = dllScaled = glScaled; + qglScalef = dllScalef = glScalef; + qglScissor = dllScissor = glScissor; + qglSelectBuffer = dllSelectBuffer = glSelectBuffer; + qglShadeModel = dllShadeModel = glShadeModel; + qglStencilFunc = dllStencilFunc = glStencilFunc; + qglStencilMask = dllStencilMask = glStencilMask; + qglStencilOp = dllStencilOp = glStencilOp; + qglTexCoord1d = dllTexCoord1d = glTexCoord1d; + qglTexCoord1dv = dllTexCoord1dv = glTexCoord1dv; + qglTexCoord1f = dllTexCoord1f = glTexCoord1f; + qglTexCoord1fv = dllTexCoord1fv = glTexCoord1fv; + qglTexCoord1i = dllTexCoord1i = glTexCoord1i; + qglTexCoord1iv = dllTexCoord1iv = glTexCoord1iv; + qglTexCoord1s = dllTexCoord1s = glTexCoord1s; + qglTexCoord1sv = dllTexCoord1sv = glTexCoord1sv; + qglTexCoord2d = dllTexCoord2d = glTexCoord2d; + qglTexCoord2dv = dllTexCoord2dv = glTexCoord2dv; + qglTexCoord2f = dllTexCoord2f = glTexCoord2f; + qglTexCoord2fv = dllTexCoord2fv = glTexCoord2fv; + qglTexCoord2i = dllTexCoord2i = glTexCoord2i; + qglTexCoord2iv = dllTexCoord2iv = glTexCoord2iv; + qglTexCoord2s = dllTexCoord2s = glTexCoord2s; + qglTexCoord2sv = dllTexCoord2sv = glTexCoord2sv; + qglTexCoord3d = dllTexCoord3d = glTexCoord3d; + qglTexCoord3dv = dllTexCoord3dv = glTexCoord3dv; + qglTexCoord3f = dllTexCoord3f = glTexCoord3f; + qglTexCoord3fv = dllTexCoord3fv = glTexCoord3fv; + qglTexCoord3i = dllTexCoord3i = glTexCoord3i; + qglTexCoord3iv = dllTexCoord3iv = glTexCoord3iv; + qglTexCoord3s = dllTexCoord3s = glTexCoord3s; + qglTexCoord3sv = dllTexCoord3sv = glTexCoord3sv; + qglTexCoord4d = dllTexCoord4d = glTexCoord4d; + qglTexCoord4dv = dllTexCoord4dv = glTexCoord4dv; + qglTexCoord4f = dllTexCoord4f = glTexCoord4f; + qglTexCoord4fv = dllTexCoord4fv = glTexCoord4fv; + qglTexCoord4i = dllTexCoord4i = glTexCoord4i; + qglTexCoord4iv = dllTexCoord4iv = glTexCoord4iv; + qglTexCoord4s = dllTexCoord4s = glTexCoord4s; + qglTexCoord4sv = dllTexCoord4sv = glTexCoord4sv; + qglTexCoordPointer = dllTexCoordPointer = glTexCoordPointer; + qglTexEnvf = dllTexEnvf = glTexEnvf; + qglTexEnvfv = dllTexEnvfv = glTexEnvfv; + qglTexEnvi = dllTexEnvi = glTexEnvi; + qglTexEnviv = dllTexEnviv = glTexEnviv; + qglTexGend = dllTexGend = glTexGend; + qglTexGendv = dllTexGendv = glTexGendv; + qglTexGenf = dllTexGenf = glTexGenf; + qglTexGenfv = dllTexGenfv = glTexGenfv; + qglTexGeni = dllTexGeni = glTexGeni; + qglTexGeniv = dllTexGeniv = glTexGeniv; + qglTexImage1D = dllTexImage1D = glTexImage1D; + qglTexImage2D = dllTexImage2D = glTexImage2D; + qglTexParameterf = dllTexParameterf = glTexParameterf; + qglTexParameterfv = dllTexParameterfv = glTexParameterfv; + qglTexParameteri = dllTexParameteri = glTexParameteri; + qglTexParameteriv = dllTexParameteriv = glTexParameteriv; + qglTexSubImage1D = dllTexSubImage1D = glTexSubImage1D; + qglTexSubImage2D = dllTexSubImage2D = glTexSubImage2D; + qglTranslated = dllTranslated = glTranslated; + qglTranslatef = dllTranslatef = glTranslatef; + qglVertex2d = dllVertex2d = glVertex2d; + qglVertex2dv = dllVertex2dv = glVertex2dv; + qglVertex2f = dllVertex2f = glVertex2f; + qglVertex2fv = dllVertex2fv = glVertex2fv; + qglVertex2i = dllVertex2i = glVertex2i; + qglVertex2iv = dllVertex2iv = glVertex2iv; + qglVertex2s = dllVertex2s = glVertex2s; + qglVertex2sv = dllVertex2sv = glVertex2sv; + qglVertex3d = dllVertex3d = glVertex3d; + qglVertex3dv = dllVertex3dv = glVertex3dv; + qglVertex3f = dllVertex3f = glVertex3f; + qglVertex3fv = dllVertex3fv = glVertex3fv; + qglVertex3i = dllVertex3i = glVertex3i; + qglVertex3iv = dllVertex3iv = glVertex3iv; + qglVertex3s = dllVertex3s = glVertex3s; + qglVertex3sv = dllVertex3sv = glVertex3sv; + qglVertex4d = dllVertex4d = glVertex4d; + qglVertex4dv = dllVertex4dv = glVertex4dv; + qglVertex4f = dllVertex4f = glVertex4f; + qglVertex4fv = dllVertex4fv = glVertex4fv; + qglVertex4i = dllVertex4i = glVertex4i; + qglVertex4iv = dllVertex4iv = glVertex4iv; + qglVertex4s = dllVertex4s = glVertex4s; + qglVertex4sv = dllVertex4sv = glVertex4sv; + qglVertexPointer = dllVertexPointer = glVertexPointer; + qglViewport = dllViewport = glViewport; qwglCopyContext = wglCopyContext; qwglCreateContext = wglCreateContext; @@ -2115,7 +2115,7 @@ void GLimp_EnableLogging( bool enable ) { // scan for an unused filename for ( i = 0 ; i < 9999 ; i++ ) { - sprintf( qpath, "renderlog_%i.txt", i ); + sprintf( qpath, "renderlog_%i.txt", i ); if ( fileSystem->ReadFile( qpath, NULL, NULL ) == -1 ) { break; // use this name } @@ -2204,270 +2204,270 @@ void GLimp_EnableLogging( bool enable ) { qglEdgeFlag = logEdgeFlag ; qglEdgeFlagPointer = logEdgeFlagPointer ; qglEdgeFlagv = logEdgeFlagv ; - qglEnable = logEnable ; - qglEnableClientState = logEnableClientState ; - qglEnd = logEnd ; - qglEndList = logEndList ; - qglEvalCoord1d = logEvalCoord1d ; - qglEvalCoord1dv = logEvalCoord1dv ; - qglEvalCoord1f = logEvalCoord1f ; - qglEvalCoord1fv = logEvalCoord1fv ; - qglEvalCoord2d = logEvalCoord2d ; - qglEvalCoord2dv = logEvalCoord2dv ; - qglEvalCoord2f = logEvalCoord2f ; - qglEvalCoord2fv = logEvalCoord2fv ; - qglEvalMesh1 = logEvalMesh1 ; - qglEvalMesh2 = logEvalMesh2 ; - qglEvalPoint1 = logEvalPoint1 ; - qglEvalPoint2 = logEvalPoint2 ; - qglFeedbackBuffer = logFeedbackBuffer ; - qglFinish = logFinish ; - qglFlush = logFlush ; - qglFogf = logFogf ; - qglFogfv = logFogfv ; - qglFogi = logFogi ; - qglFogiv = logFogiv ; - qglFrontFace = logFrontFace ; - qglFrustum = logFrustum ; - qglGenLists = logGenLists ; - qglGenTextures = logGenTextures ; - qglGetBooleanv = logGetBooleanv ; - qglGetClipPlane = logGetClipPlane ; - qglGetDoublev = logGetDoublev ; - qglGetError = logGetError ; - qglGetFloatv = logGetFloatv ; - qglGetIntegerv = logGetIntegerv ; - qglGetLightfv = logGetLightfv ; - qglGetLightiv = logGetLightiv ; - qglGetMapdv = logGetMapdv ; - qglGetMapfv = logGetMapfv ; - qglGetMapiv = logGetMapiv ; - qglGetMaterialfv = logGetMaterialfv ; - qglGetMaterialiv = logGetMaterialiv ; - qglGetPixelMapfv = logGetPixelMapfv ; - qglGetPixelMapuiv = logGetPixelMapuiv ; - qglGetPixelMapusv = logGetPixelMapusv ; - qglGetPointerv = logGetPointerv ; - qglGetPolygonStipple = logGetPolygonStipple ; - qglGetString = logGetString ; - qglGetTexEnvfv = logGetTexEnvfv ; - qglGetTexEnviv = logGetTexEnviv ; - qglGetTexGendv = logGetTexGendv ; - qglGetTexGenfv = logGetTexGenfv ; - qglGetTexGeniv = logGetTexGeniv ; - qglGetTexImage = logGetTexImage ; - qglGetTexLevelParameterfv = logGetTexLevelParameterfv ; - qglGetTexLevelParameteriv = logGetTexLevelParameteriv ; - qglGetTexParameterfv = logGetTexParameterfv ; - qglGetTexParameteriv = logGetTexParameteriv ; - qglHint = logHint ; - qglIndexMask = logIndexMask ; - qglIndexPointer = logIndexPointer ; - qglIndexd = logIndexd ; - qglIndexdv = logIndexdv ; - qglIndexf = logIndexf ; - qglIndexfv = logIndexfv ; - qglIndexi = logIndexi ; - qglIndexiv = logIndexiv ; - qglIndexs = logIndexs ; - qglIndexsv = logIndexsv ; - qglIndexub = logIndexub ; - qglIndexubv = logIndexubv ; - qglInitNames = logInitNames ; - qglInterleavedArrays = logInterleavedArrays ; - qglIsEnabled = logIsEnabled ; - qglIsList = logIsList ; - qglIsTexture = logIsTexture ; - qglLightModelf = logLightModelf ; - qglLightModelfv = logLightModelfv ; - qglLightModeli = logLightModeli ; - qglLightModeliv = logLightModeliv ; - qglLightf = logLightf ; - qglLightfv = logLightfv ; - qglLighti = logLighti ; - qglLightiv = logLightiv ; - qglLineStipple = logLineStipple ; - qglLineWidth = logLineWidth ; - qglListBase = logListBase ; - qglLoadIdentity = logLoadIdentity ; - qglLoadMatrixd = logLoadMatrixd ; - qglLoadMatrixf = logLoadMatrixf ; - qglLoadName = logLoadName ; - qglLogicOp = logLogicOp ; - qglMap1d = logMap1d ; - qglMap1f = logMap1f ; - qglMap2d = logMap2d ; - qglMap2f = logMap2f ; - qglMapGrid1d = logMapGrid1d ; - qglMapGrid1f = logMapGrid1f ; - qglMapGrid2d = logMapGrid2d ; - qglMapGrid2f = logMapGrid2f ; - qglMaterialf = logMaterialf ; - qglMaterialfv = logMaterialfv ; - qglMateriali = logMateriali ; - qglMaterialiv = logMaterialiv ; - qglMatrixMode = logMatrixMode ; - qglMultMatrixd = logMultMatrixd ; - qglMultMatrixf = logMultMatrixf ; - qglNewList = logNewList ; - qglNormal3b = logNormal3b ; - qglNormal3bv = logNormal3bv ; - qglNormal3d = logNormal3d ; - qglNormal3dv = logNormal3dv ; - qglNormal3f = logNormal3f ; - qglNormal3fv = logNormal3fv ; - qglNormal3i = logNormal3i ; - qglNormal3iv = logNormal3iv ; - qglNormal3s = logNormal3s ; - qglNormal3sv = logNormal3sv ; - qglNormalPointer = logNormalPointer ; - qglOrtho = logOrtho ; - qglPassThrough = logPassThrough ; - qglPixelMapfv = logPixelMapfv ; - qglPixelMapuiv = logPixelMapuiv ; - qglPixelMapusv = logPixelMapusv ; - qglPixelStoref = logPixelStoref ; - qglPixelStorei = logPixelStorei ; - qglPixelTransferf = logPixelTransferf ; - qglPixelTransferi = logPixelTransferi ; - qglPixelZoom = logPixelZoom ; - qglPointSize = logPointSize ; - qglPolygonMode = logPolygonMode ; - qglPolygonOffset = logPolygonOffset ; - qglPolygonStipple = logPolygonStipple ; - qglPopAttrib = logPopAttrib ; - qglPopClientAttrib = logPopClientAttrib ; - qglPopMatrix = logPopMatrix ; - qglPopName = logPopName ; - qglPrioritizeTextures = logPrioritizeTextures ; - qglPushAttrib = logPushAttrib ; - qglPushClientAttrib = logPushClientAttrib ; - qglPushMatrix = logPushMatrix ; - qglPushName = logPushName ; - qglRasterPos2d = logRasterPos2d ; - qglRasterPos2dv = logRasterPos2dv ; - qglRasterPos2f = logRasterPos2f ; - qglRasterPos2fv = logRasterPos2fv ; - qglRasterPos2i = logRasterPos2i ; - qglRasterPos2iv = logRasterPos2iv ; - qglRasterPos2s = logRasterPos2s ; - qglRasterPos2sv = logRasterPos2sv ; - qglRasterPos3d = logRasterPos3d ; - qglRasterPos3dv = logRasterPos3dv ; - qglRasterPos3f = logRasterPos3f ; - qglRasterPos3fv = logRasterPos3fv ; - qglRasterPos3i = logRasterPos3i ; - qglRasterPos3iv = logRasterPos3iv ; - qglRasterPos3s = logRasterPos3s ; - qglRasterPos3sv = logRasterPos3sv ; - qglRasterPos4d = logRasterPos4d ; - qglRasterPos4dv = logRasterPos4dv ; - qglRasterPos4f = logRasterPos4f ; - qglRasterPos4fv = logRasterPos4fv ; - qglRasterPos4i = logRasterPos4i ; - qglRasterPos4iv = logRasterPos4iv ; - qglRasterPos4s = logRasterPos4s ; - qglRasterPos4sv = logRasterPos4sv ; - qglReadBuffer = logReadBuffer ; - qglReadPixels = logReadPixels ; - qglRectd = logRectd ; - qglRectdv = logRectdv ; - qglRectf = logRectf ; - qglRectfv = logRectfv ; - qglRecti = logRecti ; - qglRectiv = logRectiv ; - qglRects = logRects ; - qglRectsv = logRectsv ; - qglRenderMode = logRenderMode ; - qglRotated = logRotated ; - qglRotatef = logRotatef ; - qglScaled = logScaled ; - qglScalef = logScalef ; - qglScissor = logScissor ; - qglSelectBuffer = logSelectBuffer ; - qglShadeModel = logShadeModel ; - qglStencilFunc = logStencilFunc ; - qglStencilMask = logStencilMask ; - qglStencilOp = logStencilOp ; - qglTexCoord1d = logTexCoord1d ; - qglTexCoord1dv = logTexCoord1dv ; - qglTexCoord1f = logTexCoord1f ; - qglTexCoord1fv = logTexCoord1fv ; - qglTexCoord1i = logTexCoord1i ; - qglTexCoord1iv = logTexCoord1iv ; - qglTexCoord1s = logTexCoord1s ; - qglTexCoord1sv = logTexCoord1sv ; - qglTexCoord2d = logTexCoord2d ; - qglTexCoord2dv = logTexCoord2dv ; - qglTexCoord2f = logTexCoord2f ; - qglTexCoord2fv = logTexCoord2fv ; - qglTexCoord2i = logTexCoord2i ; - qglTexCoord2iv = logTexCoord2iv ; - qglTexCoord2s = logTexCoord2s ; - qglTexCoord2sv = logTexCoord2sv ; - qglTexCoord3d = logTexCoord3d ; - qglTexCoord3dv = logTexCoord3dv ; - qglTexCoord3f = logTexCoord3f ; - qglTexCoord3fv = logTexCoord3fv ; - qglTexCoord3i = logTexCoord3i ; - qglTexCoord3iv = logTexCoord3iv ; - qglTexCoord3s = logTexCoord3s ; - qglTexCoord3sv = logTexCoord3sv ; - qglTexCoord4d = logTexCoord4d ; - qglTexCoord4dv = logTexCoord4dv ; - qglTexCoord4f = logTexCoord4f ; - qglTexCoord4fv = logTexCoord4fv ; - qglTexCoord4i = logTexCoord4i ; - qglTexCoord4iv = logTexCoord4iv ; - qglTexCoord4s = logTexCoord4s ; - qglTexCoord4sv = logTexCoord4sv ; - qglTexCoordPointer = logTexCoordPointer ; - qglTexEnvf = logTexEnvf ; - qglTexEnvfv = logTexEnvfv ; - qglTexEnvi = logTexEnvi ; - qglTexEnviv = logTexEnviv ; - qglTexGend = logTexGend ; - qglTexGendv = logTexGendv ; - qglTexGenf = logTexGenf ; - qglTexGenfv = logTexGenfv ; - qglTexGeni = logTexGeni ; - qglTexGeniv = logTexGeniv ; - qglTexImage1D = logTexImage1D ; - qglTexImage2D = logTexImage2D ; - qglTexParameterf = logTexParameterf ; - qglTexParameterfv = logTexParameterfv ; - qglTexParameteri = logTexParameteri ; - qglTexParameteriv = logTexParameteriv ; - qglTexSubImage1D = logTexSubImage1D ; - qglTexSubImage2D = logTexSubImage2D ; - qglTranslated = logTranslated ; - qglTranslatef = logTranslatef ; - qglVertex2d = logVertex2d ; - qglVertex2dv = logVertex2dv ; - qglVertex2f = logVertex2f ; - qglVertex2fv = logVertex2fv ; - qglVertex2i = logVertex2i ; - qglVertex2iv = logVertex2iv ; - qglVertex2s = logVertex2s ; - qglVertex2sv = logVertex2sv ; - qglVertex3d = logVertex3d ; - qglVertex3dv = logVertex3dv ; - qglVertex3f = logVertex3f ; - qglVertex3fv = logVertex3fv ; - qglVertex3i = logVertex3i ; - qglVertex3iv = logVertex3iv ; - qglVertex3s = logVertex3s ; - qglVertex3sv = logVertex3sv ; - qglVertex4d = logVertex4d ; - qglVertex4dv = logVertex4dv ; - qglVertex4f = logVertex4f ; - qglVertex4fv = logVertex4fv ; - qglVertex4i = logVertex4i ; - qglVertex4iv = logVertex4iv ; - qglVertex4s = logVertex4s ; - qglVertex4sv = logVertex4sv ; - qglVertexPointer = logVertexPointer ; - qglViewport = logViewport ; + qglEnable = logEnable ; + qglEnableClientState = logEnableClientState ; + qglEnd = logEnd ; + qglEndList = logEndList ; + qglEvalCoord1d = logEvalCoord1d ; + qglEvalCoord1dv = logEvalCoord1dv ; + qglEvalCoord1f = logEvalCoord1f ; + qglEvalCoord1fv = logEvalCoord1fv ; + qglEvalCoord2d = logEvalCoord2d ; + qglEvalCoord2dv = logEvalCoord2dv ; + qglEvalCoord2f = logEvalCoord2f ; + qglEvalCoord2fv = logEvalCoord2fv ; + qglEvalMesh1 = logEvalMesh1 ; + qglEvalMesh2 = logEvalMesh2 ; + qglEvalPoint1 = logEvalPoint1 ; + qglEvalPoint2 = logEvalPoint2 ; + qglFeedbackBuffer = logFeedbackBuffer ; + qglFinish = logFinish ; + qglFlush = logFlush ; + qglFogf = logFogf ; + qglFogfv = logFogfv ; + qglFogi = logFogi ; + qglFogiv = logFogiv ; + qglFrontFace = logFrontFace ; + qglFrustum = logFrustum ; + qglGenLists = logGenLists ; + qglGenTextures = logGenTextures ; + qglGetBooleanv = logGetBooleanv ; + qglGetClipPlane = logGetClipPlane ; + qglGetDoublev = logGetDoublev ; + qglGetError = logGetError ; + qglGetFloatv = logGetFloatv ; + qglGetIntegerv = logGetIntegerv ; + qglGetLightfv = logGetLightfv ; + qglGetLightiv = logGetLightiv ; + qglGetMapdv = logGetMapdv ; + qglGetMapfv = logGetMapfv ; + qglGetMapiv = logGetMapiv ; + qglGetMaterialfv = logGetMaterialfv ; + qglGetMaterialiv = logGetMaterialiv ; + qglGetPixelMapfv = logGetPixelMapfv ; + qglGetPixelMapuiv = logGetPixelMapuiv ; + qglGetPixelMapusv = logGetPixelMapusv ; + qglGetPointerv = logGetPointerv ; + qglGetPolygonStipple = logGetPolygonStipple ; + qglGetString = logGetString ; + qglGetTexEnvfv = logGetTexEnvfv ; + qglGetTexEnviv = logGetTexEnviv ; + qglGetTexGendv = logGetTexGendv ; + qglGetTexGenfv = logGetTexGenfv ; + qglGetTexGeniv = logGetTexGeniv ; + qglGetTexImage = logGetTexImage ; + qglGetTexLevelParameterfv = logGetTexLevelParameterfv ; + qglGetTexLevelParameteriv = logGetTexLevelParameteriv ; + qglGetTexParameterfv = logGetTexParameterfv ; + qglGetTexParameteriv = logGetTexParameteriv ; + qglHint = logHint ; + qglIndexMask = logIndexMask ; + qglIndexPointer = logIndexPointer ; + qglIndexd = logIndexd ; + qglIndexdv = logIndexdv ; + qglIndexf = logIndexf ; + qglIndexfv = logIndexfv ; + qglIndexi = logIndexi ; + qglIndexiv = logIndexiv ; + qglIndexs = logIndexs ; + qglIndexsv = logIndexsv ; + qglIndexub = logIndexub ; + qglIndexubv = logIndexubv ; + qglInitNames = logInitNames ; + qglInterleavedArrays = logInterleavedArrays ; + qglIsEnabled = logIsEnabled ; + qglIsList = logIsList ; + qglIsTexture = logIsTexture ; + qglLightModelf = logLightModelf ; + qglLightModelfv = logLightModelfv ; + qglLightModeli = logLightModeli ; + qglLightModeliv = logLightModeliv ; + qglLightf = logLightf ; + qglLightfv = logLightfv ; + qglLighti = logLighti ; + qglLightiv = logLightiv ; + qglLineStipple = logLineStipple ; + qglLineWidth = logLineWidth ; + qglListBase = logListBase ; + qglLoadIdentity = logLoadIdentity ; + qglLoadMatrixd = logLoadMatrixd ; + qglLoadMatrixf = logLoadMatrixf ; + qglLoadName = logLoadName ; + qglLogicOp = logLogicOp ; + qglMap1d = logMap1d ; + qglMap1f = logMap1f ; + qglMap2d = logMap2d ; + qglMap2f = logMap2f ; + qglMapGrid1d = logMapGrid1d ; + qglMapGrid1f = logMapGrid1f ; + qglMapGrid2d = logMapGrid2d ; + qglMapGrid2f = logMapGrid2f ; + qglMaterialf = logMaterialf ; + qglMaterialfv = logMaterialfv ; + qglMateriali = logMateriali ; + qglMaterialiv = logMaterialiv ; + qglMatrixMode = logMatrixMode ; + qglMultMatrixd = logMultMatrixd ; + qglMultMatrixf = logMultMatrixf ; + qglNewList = logNewList ; + qglNormal3b = logNormal3b ; + qglNormal3bv = logNormal3bv ; + qglNormal3d = logNormal3d ; + qglNormal3dv = logNormal3dv ; + qglNormal3f = logNormal3f ; + qglNormal3fv = logNormal3fv ; + qglNormal3i = logNormal3i ; + qglNormal3iv = logNormal3iv ; + qglNormal3s = logNormal3s ; + qglNormal3sv = logNormal3sv ; + qglNormalPointer = logNormalPointer ; + qglOrtho = logOrtho ; + qglPassThrough = logPassThrough ; + qglPixelMapfv = logPixelMapfv ; + qglPixelMapuiv = logPixelMapuiv ; + qglPixelMapusv = logPixelMapusv ; + qglPixelStoref = logPixelStoref ; + qglPixelStorei = logPixelStorei ; + qglPixelTransferf = logPixelTransferf ; + qglPixelTransferi = logPixelTransferi ; + qglPixelZoom = logPixelZoom ; + qglPointSize = logPointSize ; + qglPolygonMode = logPolygonMode ; + qglPolygonOffset = logPolygonOffset ; + qglPolygonStipple = logPolygonStipple ; + qglPopAttrib = logPopAttrib ; + qglPopClientAttrib = logPopClientAttrib ; + qglPopMatrix = logPopMatrix ; + qglPopName = logPopName ; + qglPrioritizeTextures = logPrioritizeTextures ; + qglPushAttrib = logPushAttrib ; + qglPushClientAttrib = logPushClientAttrib ; + qglPushMatrix = logPushMatrix ; + qglPushName = logPushName ; + qglRasterPos2d = logRasterPos2d ; + qglRasterPos2dv = logRasterPos2dv ; + qglRasterPos2f = logRasterPos2f ; + qglRasterPos2fv = logRasterPos2fv ; + qglRasterPos2i = logRasterPos2i ; + qglRasterPos2iv = logRasterPos2iv ; + qglRasterPos2s = logRasterPos2s ; + qglRasterPos2sv = logRasterPos2sv ; + qglRasterPos3d = logRasterPos3d ; + qglRasterPos3dv = logRasterPos3dv ; + qglRasterPos3f = logRasterPos3f ; + qglRasterPos3fv = logRasterPos3fv ; + qglRasterPos3i = logRasterPos3i ; + qglRasterPos3iv = logRasterPos3iv ; + qglRasterPos3s = logRasterPos3s ; + qglRasterPos3sv = logRasterPos3sv ; + qglRasterPos4d = logRasterPos4d ; + qglRasterPos4dv = logRasterPos4dv ; + qglRasterPos4f = logRasterPos4f ; + qglRasterPos4fv = logRasterPos4fv ; + qglRasterPos4i = logRasterPos4i ; + qglRasterPos4iv = logRasterPos4iv ; + qglRasterPos4s = logRasterPos4s ; + qglRasterPos4sv = logRasterPos4sv ; + qglReadBuffer = logReadBuffer ; + qglReadPixels = logReadPixels ; + qglRectd = logRectd ; + qglRectdv = logRectdv ; + qglRectf = logRectf ; + qglRectfv = logRectfv ; + qglRecti = logRecti ; + qglRectiv = logRectiv ; + qglRects = logRects ; + qglRectsv = logRectsv ; + qglRenderMode = logRenderMode ; + qglRotated = logRotated ; + qglRotatef = logRotatef ; + qglScaled = logScaled ; + qglScalef = logScalef ; + qglScissor = logScissor ; + qglSelectBuffer = logSelectBuffer ; + qglShadeModel = logShadeModel ; + qglStencilFunc = logStencilFunc ; + qglStencilMask = logStencilMask ; + qglStencilOp = logStencilOp ; + qglTexCoord1d = logTexCoord1d ; + qglTexCoord1dv = logTexCoord1dv ; + qglTexCoord1f = logTexCoord1f ; + qglTexCoord1fv = logTexCoord1fv ; + qglTexCoord1i = logTexCoord1i ; + qglTexCoord1iv = logTexCoord1iv ; + qglTexCoord1s = logTexCoord1s ; + qglTexCoord1sv = logTexCoord1sv ; + qglTexCoord2d = logTexCoord2d ; + qglTexCoord2dv = logTexCoord2dv ; + qglTexCoord2f = logTexCoord2f ; + qglTexCoord2fv = logTexCoord2fv ; + qglTexCoord2i = logTexCoord2i ; + qglTexCoord2iv = logTexCoord2iv ; + qglTexCoord2s = logTexCoord2s ; + qglTexCoord2sv = logTexCoord2sv ; + qglTexCoord3d = logTexCoord3d ; + qglTexCoord3dv = logTexCoord3dv ; + qglTexCoord3f = logTexCoord3f ; + qglTexCoord3fv = logTexCoord3fv ; + qglTexCoord3i = logTexCoord3i ; + qglTexCoord3iv = logTexCoord3iv ; + qglTexCoord3s = logTexCoord3s ; + qglTexCoord3sv = logTexCoord3sv ; + qglTexCoord4d = logTexCoord4d ; + qglTexCoord4dv = logTexCoord4dv ; + qglTexCoord4f = logTexCoord4f ; + qglTexCoord4fv = logTexCoord4fv ; + qglTexCoord4i = logTexCoord4i ; + qglTexCoord4iv = logTexCoord4iv ; + qglTexCoord4s = logTexCoord4s ; + qglTexCoord4sv = logTexCoord4sv ; + qglTexCoordPointer = logTexCoordPointer ; + qglTexEnvf = logTexEnvf ; + qglTexEnvfv = logTexEnvfv ; + qglTexEnvi = logTexEnvi ; + qglTexEnviv = logTexEnviv ; + qglTexGend = logTexGend ; + qglTexGendv = logTexGendv ; + qglTexGenf = logTexGenf ; + qglTexGenfv = logTexGenfv ; + qglTexGeni = logTexGeni ; + qglTexGeniv = logTexGeniv ; + qglTexImage1D = logTexImage1D ; + qglTexImage2D = logTexImage2D ; + qglTexParameterf = logTexParameterf ; + qglTexParameterfv = logTexParameterfv ; + qglTexParameteri = logTexParameteri ; + qglTexParameteriv = logTexParameteriv ; + qglTexSubImage1D = logTexSubImage1D ; + qglTexSubImage2D = logTexSubImage2D ; + qglTranslated = logTranslated ; + qglTranslatef = logTranslatef ; + qglVertex2d = logVertex2d ; + qglVertex2dv = logVertex2dv ; + qglVertex2f = logVertex2f ; + qglVertex2fv = logVertex2fv ; + qglVertex2i = logVertex2i ; + qglVertex2iv = logVertex2iv ; + qglVertex2s = logVertex2s ; + qglVertex2sv = logVertex2sv ; + qglVertex3d = logVertex3d ; + qglVertex3dv = logVertex3dv ; + qglVertex3f = logVertex3f ; + qglVertex3fv = logVertex3fv ; + qglVertex3i = logVertex3i ; + qglVertex3iv = logVertex3iv ; + qglVertex3s = logVertex3s ; + qglVertex3sv = logVertex3sv ; + qglVertex4d = logVertex4d ; + qglVertex4dv = logVertex4dv ; + qglVertex4f = logVertex4f ; + qglVertex4fv = logVertex4fv ; + qglVertex4i = logVertex4i ; + qglVertex4iv = logVertex4iv ; + qglVertex4s = logVertex4s ; + qglVertex4sv = logVertex4sv ; + qglVertexPointer = logVertexPointer ; + qglViewport = logViewport ; } else { @@ -2543,269 +2543,269 @@ void GLimp_EnableLogging( bool enable ) { qglEdgeFlag = dllEdgeFlag ; qglEdgeFlagPointer = dllEdgeFlagPointer ; qglEdgeFlagv = dllEdgeFlagv ; - qglEnable = dllEnable ; - qglEnableClientState = dllEnableClientState ; - qglEnd = dllEnd ; - qglEndList = dllEndList ; - qglEvalCoord1d = dllEvalCoord1d ; - qglEvalCoord1dv = dllEvalCoord1dv ; - qglEvalCoord1f = dllEvalCoord1f ; - qglEvalCoord1fv = dllEvalCoord1fv ; - qglEvalCoord2d = dllEvalCoord2d ; - qglEvalCoord2dv = dllEvalCoord2dv ; - qglEvalCoord2f = dllEvalCoord2f ; - qglEvalCoord2fv = dllEvalCoord2fv ; - qglEvalMesh1 = dllEvalMesh1 ; - qglEvalMesh2 = dllEvalMesh2 ; - qglEvalPoint1 = dllEvalPoint1 ; - qglEvalPoint2 = dllEvalPoint2 ; - qglFeedbackBuffer = dllFeedbackBuffer ; - qglFinish = dllFinish ; - qglFlush = dllFlush ; - qglFogf = dllFogf ; - qglFogfv = dllFogfv ; - qglFogi = dllFogi ; - qglFogiv = dllFogiv ; - qglFrontFace = dllFrontFace ; - qglFrustum = dllFrustum ; - qglGenLists = dllGenLists ; - qglGenTextures = dllGenTextures ; - qglGetBooleanv = dllGetBooleanv ; - qglGetClipPlane = dllGetClipPlane ; - qglGetDoublev = dllGetDoublev ; - qglGetError = dllGetError ; - qglGetFloatv = dllGetFloatv ; - qglGetIntegerv = dllGetIntegerv ; - qglGetLightfv = dllGetLightfv ; - qglGetLightiv = dllGetLightiv ; - qglGetMapdv = dllGetMapdv ; - qglGetMapfv = dllGetMapfv ; - qglGetMapiv = dllGetMapiv ; - qglGetMaterialfv = dllGetMaterialfv ; - qglGetMaterialiv = dllGetMaterialiv ; - qglGetPixelMapfv = dllGetPixelMapfv ; - qglGetPixelMapuiv = dllGetPixelMapuiv ; - qglGetPixelMapusv = dllGetPixelMapusv ; - qglGetPointerv = dllGetPointerv ; - qglGetPolygonStipple = dllGetPolygonStipple ; - qglGetString = dllGetString ; - qglGetTexEnvfv = dllGetTexEnvfv ; - qglGetTexEnviv = dllGetTexEnviv ; - qglGetTexGendv = dllGetTexGendv ; - qglGetTexGenfv = dllGetTexGenfv ; - qglGetTexGeniv = dllGetTexGeniv ; - qglGetTexImage = dllGetTexImage ; - qglGetTexLevelParameterfv = dllGetTexLevelParameterfv ; - qglGetTexLevelParameteriv = dllGetTexLevelParameteriv ; - qglGetTexParameterfv = dllGetTexParameterfv ; - qglGetTexParameteriv = dllGetTexParameteriv ; - qglHint = dllHint ; - qglIndexMask = dllIndexMask ; - qglIndexPointer = dllIndexPointer ; - qglIndexd = dllIndexd ; - qglIndexdv = dllIndexdv ; - qglIndexf = dllIndexf ; - qglIndexfv = dllIndexfv ; - qglIndexi = dllIndexi ; - qglIndexiv = dllIndexiv ; - qglIndexs = dllIndexs ; - qglIndexsv = dllIndexsv ; - qglIndexub = dllIndexub ; - qglIndexubv = dllIndexubv ; - qglInitNames = dllInitNames ; - qglInterleavedArrays = dllInterleavedArrays ; - qglIsEnabled = dllIsEnabled ; - qglIsList = dllIsList ; - qglIsTexture = dllIsTexture ; - qglLightModelf = dllLightModelf ; - qglLightModelfv = dllLightModelfv ; - qglLightModeli = dllLightModeli ; - qglLightModeliv = dllLightModeliv ; - qglLightf = dllLightf ; - qglLightfv = dllLightfv ; - qglLighti = dllLighti ; - qglLightiv = dllLightiv ; - qglLineStipple = dllLineStipple ; - qglLineWidth = dllLineWidth ; - qglListBase = dllListBase ; - qglLoadIdentity = dllLoadIdentity ; - qglLoadMatrixd = dllLoadMatrixd ; - qglLoadMatrixf = dllLoadMatrixf ; - qglLoadName = dllLoadName ; - qglLogicOp = dllLogicOp ; - qglMap1d = dllMap1d ; - qglMap1f = dllMap1f ; - qglMap2d = dllMap2d ; - qglMap2f = dllMap2f ; - qglMapGrid1d = dllMapGrid1d ; - qglMapGrid1f = dllMapGrid1f ; - qglMapGrid2d = dllMapGrid2d ; - qglMapGrid2f = dllMapGrid2f ; - qglMaterialf = dllMaterialf ; - qglMaterialfv = dllMaterialfv ; - qglMateriali = dllMateriali ; - qglMaterialiv = dllMaterialiv ; - qglMatrixMode = dllMatrixMode ; - qglMultMatrixd = dllMultMatrixd ; - qglMultMatrixf = dllMultMatrixf ; - qglNewList = dllNewList ; - qglNormal3b = dllNormal3b ; - qglNormal3bv = dllNormal3bv ; - qglNormal3d = dllNormal3d ; - qglNormal3dv = dllNormal3dv ; - qglNormal3f = dllNormal3f ; - qglNormal3fv = dllNormal3fv ; - qglNormal3i = dllNormal3i ; - qglNormal3iv = dllNormal3iv ; - qglNormal3s = dllNormal3s ; - qglNormal3sv = dllNormal3sv ; - qglNormalPointer = dllNormalPointer ; - qglOrtho = dllOrtho ; - qglPassThrough = dllPassThrough ; - qglPixelMapfv = dllPixelMapfv ; - qglPixelMapuiv = dllPixelMapuiv ; - qglPixelMapusv = dllPixelMapusv ; - qglPixelStoref = dllPixelStoref ; - qglPixelStorei = dllPixelStorei ; - qglPixelTransferf = dllPixelTransferf ; - qglPixelTransferi = dllPixelTransferi ; - qglPixelZoom = dllPixelZoom ; - qglPointSize = dllPointSize ; - qglPolygonMode = dllPolygonMode ; - qglPolygonOffset = dllPolygonOffset ; - qglPolygonStipple = dllPolygonStipple ; - qglPopAttrib = dllPopAttrib ; - qglPopClientAttrib = dllPopClientAttrib ; - qglPopMatrix = dllPopMatrix ; - qglPopName = dllPopName ; - qglPrioritizeTextures = dllPrioritizeTextures ; - qglPushAttrib = dllPushAttrib ; - qglPushClientAttrib = dllPushClientAttrib ; - qglPushMatrix = dllPushMatrix ; - qglPushName = dllPushName ; - qglRasterPos2d = dllRasterPos2d ; - qglRasterPos2dv = dllRasterPos2dv ; - qglRasterPos2f = dllRasterPos2f ; - qglRasterPos2fv = dllRasterPos2fv ; - qglRasterPos2i = dllRasterPos2i ; - qglRasterPos2iv = dllRasterPos2iv ; - qglRasterPos2s = dllRasterPos2s ; - qglRasterPos2sv = dllRasterPos2sv ; - qglRasterPos3d = dllRasterPos3d ; - qglRasterPos3dv = dllRasterPos3dv ; - qglRasterPos3f = dllRasterPos3f ; - qglRasterPos3fv = dllRasterPos3fv ; - qglRasterPos3i = dllRasterPos3i ; - qglRasterPos3iv = dllRasterPos3iv ; - qglRasterPos3s = dllRasterPos3s ; - qglRasterPos3sv = dllRasterPos3sv ; - qglRasterPos4d = dllRasterPos4d ; - qglRasterPos4dv = dllRasterPos4dv ; - qglRasterPos4f = dllRasterPos4f ; - qglRasterPos4fv = dllRasterPos4fv ; - qglRasterPos4i = dllRasterPos4i ; - qglRasterPos4iv = dllRasterPos4iv ; - qglRasterPos4s = dllRasterPos4s ; - qglRasterPos4sv = dllRasterPos4sv ; - qglReadBuffer = dllReadBuffer ; - qglReadPixels = dllReadPixels ; - qglRectd = dllRectd ; - qglRectdv = dllRectdv ; - qglRectf = dllRectf ; - qglRectfv = dllRectfv ; - qglRecti = dllRecti ; - qglRectiv = dllRectiv ; - qglRects = dllRects ; - qglRectsv = dllRectsv ; - qglRenderMode = dllRenderMode ; - qglRotated = dllRotated ; - qglRotatef = dllRotatef ; - qglScaled = dllScaled ; - qglScalef = dllScalef ; - qglScissor = dllScissor ; - qglSelectBuffer = dllSelectBuffer ; - qglShadeModel = dllShadeModel ; - qglStencilFunc = dllStencilFunc ; - qglStencilMask = dllStencilMask ; - qglStencilOp = dllStencilOp ; - qglTexCoord1d = dllTexCoord1d ; - qglTexCoord1dv = dllTexCoord1dv ; - qglTexCoord1f = dllTexCoord1f ; - qglTexCoord1fv = dllTexCoord1fv ; - qglTexCoord1i = dllTexCoord1i ; - qglTexCoord1iv = dllTexCoord1iv ; - qglTexCoord1s = dllTexCoord1s ; - qglTexCoord1sv = dllTexCoord1sv ; - qglTexCoord2d = dllTexCoord2d ; - qglTexCoord2dv = dllTexCoord2dv ; - qglTexCoord2f = dllTexCoord2f ; - qglTexCoord2fv = dllTexCoord2fv ; - qglTexCoord2i = dllTexCoord2i ; - qglTexCoord2iv = dllTexCoord2iv ; - qglTexCoord2s = dllTexCoord2s ; - qglTexCoord2sv = dllTexCoord2sv ; - qglTexCoord3d = dllTexCoord3d ; - qglTexCoord3dv = dllTexCoord3dv ; - qglTexCoord3f = dllTexCoord3f ; - qglTexCoord3fv = dllTexCoord3fv ; - qglTexCoord3i = dllTexCoord3i ; - qglTexCoord3iv = dllTexCoord3iv ; - qglTexCoord3s = dllTexCoord3s ; - qglTexCoord3sv = dllTexCoord3sv ; - qglTexCoord4d = dllTexCoord4d ; - qglTexCoord4dv = dllTexCoord4dv ; - qglTexCoord4f = dllTexCoord4f ; - qglTexCoord4fv = dllTexCoord4fv ; - qglTexCoord4i = dllTexCoord4i ; - qglTexCoord4iv = dllTexCoord4iv ; - qglTexCoord4s = dllTexCoord4s ; - qglTexCoord4sv = dllTexCoord4sv ; - qglTexCoordPointer = dllTexCoordPointer ; - qglTexEnvf = dllTexEnvf ; - qglTexEnvfv = dllTexEnvfv ; - qglTexEnvi = dllTexEnvi ; - qglTexEnviv = dllTexEnviv ; - qglTexGend = dllTexGend ; - qglTexGendv = dllTexGendv ; - qglTexGenf = dllTexGenf ; - qglTexGenfv = dllTexGenfv ; - qglTexGeni = dllTexGeni ; - qglTexGeniv = dllTexGeniv ; - qglTexImage1D = dllTexImage1D ; - qglTexImage2D = dllTexImage2D ; - qglTexParameterf = dllTexParameterf ; - qglTexParameterfv = dllTexParameterfv ; - qglTexParameteri = dllTexParameteri ; - qglTexParameteriv = dllTexParameteriv ; - qglTexSubImage1D = dllTexSubImage1D ; - qglTexSubImage2D = dllTexSubImage2D ; - qglTranslated = dllTranslated ; - qglTranslatef = dllTranslatef ; - qglVertex2d = dllVertex2d ; - qglVertex2dv = dllVertex2dv ; - qglVertex2f = dllVertex2f ; - qglVertex2fv = dllVertex2fv ; - qglVertex2i = dllVertex2i ; - qglVertex2iv = dllVertex2iv ; - qglVertex2s = dllVertex2s ; - qglVertex2sv = dllVertex2sv ; - qglVertex3d = dllVertex3d ; - qglVertex3dv = dllVertex3dv ; - qglVertex3f = dllVertex3f ; - qglVertex3fv = dllVertex3fv ; - qglVertex3i = dllVertex3i ; - qglVertex3iv = dllVertex3iv ; - qglVertex3s = dllVertex3s ; - qglVertex3sv = dllVertex3sv ; - qglVertex4d = dllVertex4d ; - qglVertex4dv = dllVertex4dv ; - qglVertex4f = dllVertex4f ; - qglVertex4fv = dllVertex4fv ; - qglVertex4i = dllVertex4i ; - qglVertex4iv = dllVertex4iv ; - qglVertex4s = dllVertex4s ; - qglVertex4sv = dllVertex4sv ; - qglVertexPointer = dllVertexPointer ; - qglViewport = dllViewport ; + qglEnable = dllEnable ; + qglEnableClientState = dllEnableClientState ; + qglEnd = dllEnd ; + qglEndList = dllEndList ; + qglEvalCoord1d = dllEvalCoord1d ; + qglEvalCoord1dv = dllEvalCoord1dv ; + qglEvalCoord1f = dllEvalCoord1f ; + qglEvalCoord1fv = dllEvalCoord1fv ; + qglEvalCoord2d = dllEvalCoord2d ; + qglEvalCoord2dv = dllEvalCoord2dv ; + qglEvalCoord2f = dllEvalCoord2f ; + qglEvalCoord2fv = dllEvalCoord2fv ; + qglEvalMesh1 = dllEvalMesh1 ; + qglEvalMesh2 = dllEvalMesh2 ; + qglEvalPoint1 = dllEvalPoint1 ; + qglEvalPoint2 = dllEvalPoint2 ; + qglFeedbackBuffer = dllFeedbackBuffer ; + qglFinish = dllFinish ; + qglFlush = dllFlush ; + qglFogf = dllFogf ; + qglFogfv = dllFogfv ; + qglFogi = dllFogi ; + qglFogiv = dllFogiv ; + qglFrontFace = dllFrontFace ; + qglFrustum = dllFrustum ; + qglGenLists = dllGenLists ; + qglGenTextures = dllGenTextures ; + qglGetBooleanv = dllGetBooleanv ; + qglGetClipPlane = dllGetClipPlane ; + qglGetDoublev = dllGetDoublev ; + qglGetError = dllGetError ; + qglGetFloatv = dllGetFloatv ; + qglGetIntegerv = dllGetIntegerv ; + qglGetLightfv = dllGetLightfv ; + qglGetLightiv = dllGetLightiv ; + qglGetMapdv = dllGetMapdv ; + qglGetMapfv = dllGetMapfv ; + qglGetMapiv = dllGetMapiv ; + qglGetMaterialfv = dllGetMaterialfv ; + qglGetMaterialiv = dllGetMaterialiv ; + qglGetPixelMapfv = dllGetPixelMapfv ; + qglGetPixelMapuiv = dllGetPixelMapuiv ; + qglGetPixelMapusv = dllGetPixelMapusv ; + qglGetPointerv = dllGetPointerv ; + qglGetPolygonStipple = dllGetPolygonStipple ; + qglGetString = dllGetString ; + qglGetTexEnvfv = dllGetTexEnvfv ; + qglGetTexEnviv = dllGetTexEnviv ; + qglGetTexGendv = dllGetTexGendv ; + qglGetTexGenfv = dllGetTexGenfv ; + qglGetTexGeniv = dllGetTexGeniv ; + qglGetTexImage = dllGetTexImage ; + qglGetTexLevelParameterfv = dllGetTexLevelParameterfv ; + qglGetTexLevelParameteriv = dllGetTexLevelParameteriv ; + qglGetTexParameterfv = dllGetTexParameterfv ; + qglGetTexParameteriv = dllGetTexParameteriv ; + qglHint = dllHint ; + qglIndexMask = dllIndexMask ; + qglIndexPointer = dllIndexPointer ; + qglIndexd = dllIndexd ; + qglIndexdv = dllIndexdv ; + qglIndexf = dllIndexf ; + qglIndexfv = dllIndexfv ; + qglIndexi = dllIndexi ; + qglIndexiv = dllIndexiv ; + qglIndexs = dllIndexs ; + qglIndexsv = dllIndexsv ; + qglIndexub = dllIndexub ; + qglIndexubv = dllIndexubv ; + qglInitNames = dllInitNames ; + qglInterleavedArrays = dllInterleavedArrays ; + qglIsEnabled = dllIsEnabled ; + qglIsList = dllIsList ; + qglIsTexture = dllIsTexture ; + qglLightModelf = dllLightModelf ; + qglLightModelfv = dllLightModelfv ; + qglLightModeli = dllLightModeli ; + qglLightModeliv = dllLightModeliv ; + qglLightf = dllLightf ; + qglLightfv = dllLightfv ; + qglLighti = dllLighti ; + qglLightiv = dllLightiv ; + qglLineStipple = dllLineStipple ; + qglLineWidth = dllLineWidth ; + qglListBase = dllListBase ; + qglLoadIdentity = dllLoadIdentity ; + qglLoadMatrixd = dllLoadMatrixd ; + qglLoadMatrixf = dllLoadMatrixf ; + qglLoadName = dllLoadName ; + qglLogicOp = dllLogicOp ; + qglMap1d = dllMap1d ; + qglMap1f = dllMap1f ; + qglMap2d = dllMap2d ; + qglMap2f = dllMap2f ; + qglMapGrid1d = dllMapGrid1d ; + qglMapGrid1f = dllMapGrid1f ; + qglMapGrid2d = dllMapGrid2d ; + qglMapGrid2f = dllMapGrid2f ; + qglMaterialf = dllMaterialf ; + qglMaterialfv = dllMaterialfv ; + qglMateriali = dllMateriali ; + qglMaterialiv = dllMaterialiv ; + qglMatrixMode = dllMatrixMode ; + qglMultMatrixd = dllMultMatrixd ; + qglMultMatrixf = dllMultMatrixf ; + qglNewList = dllNewList ; + qglNormal3b = dllNormal3b ; + qglNormal3bv = dllNormal3bv ; + qglNormal3d = dllNormal3d ; + qglNormal3dv = dllNormal3dv ; + qglNormal3f = dllNormal3f ; + qglNormal3fv = dllNormal3fv ; + qglNormal3i = dllNormal3i ; + qglNormal3iv = dllNormal3iv ; + qglNormal3s = dllNormal3s ; + qglNormal3sv = dllNormal3sv ; + qglNormalPointer = dllNormalPointer ; + qglOrtho = dllOrtho ; + qglPassThrough = dllPassThrough ; + qglPixelMapfv = dllPixelMapfv ; + qglPixelMapuiv = dllPixelMapuiv ; + qglPixelMapusv = dllPixelMapusv ; + qglPixelStoref = dllPixelStoref ; + qglPixelStorei = dllPixelStorei ; + qglPixelTransferf = dllPixelTransferf ; + qglPixelTransferi = dllPixelTransferi ; + qglPixelZoom = dllPixelZoom ; + qglPointSize = dllPointSize ; + qglPolygonMode = dllPolygonMode ; + qglPolygonOffset = dllPolygonOffset ; + qglPolygonStipple = dllPolygonStipple ; + qglPopAttrib = dllPopAttrib ; + qglPopClientAttrib = dllPopClientAttrib ; + qglPopMatrix = dllPopMatrix ; + qglPopName = dllPopName ; + qglPrioritizeTextures = dllPrioritizeTextures ; + qglPushAttrib = dllPushAttrib ; + qglPushClientAttrib = dllPushClientAttrib ; + qglPushMatrix = dllPushMatrix ; + qglPushName = dllPushName ; + qglRasterPos2d = dllRasterPos2d ; + qglRasterPos2dv = dllRasterPos2dv ; + qglRasterPos2f = dllRasterPos2f ; + qglRasterPos2fv = dllRasterPos2fv ; + qglRasterPos2i = dllRasterPos2i ; + qglRasterPos2iv = dllRasterPos2iv ; + qglRasterPos2s = dllRasterPos2s ; + qglRasterPos2sv = dllRasterPos2sv ; + qglRasterPos3d = dllRasterPos3d ; + qglRasterPos3dv = dllRasterPos3dv ; + qglRasterPos3f = dllRasterPos3f ; + qglRasterPos3fv = dllRasterPos3fv ; + qglRasterPos3i = dllRasterPos3i ; + qglRasterPos3iv = dllRasterPos3iv ; + qglRasterPos3s = dllRasterPos3s ; + qglRasterPos3sv = dllRasterPos3sv ; + qglRasterPos4d = dllRasterPos4d ; + qglRasterPos4dv = dllRasterPos4dv ; + qglRasterPos4f = dllRasterPos4f ; + qglRasterPos4fv = dllRasterPos4fv ; + qglRasterPos4i = dllRasterPos4i ; + qglRasterPos4iv = dllRasterPos4iv ; + qglRasterPos4s = dllRasterPos4s ; + qglRasterPos4sv = dllRasterPos4sv ; + qglReadBuffer = dllReadBuffer ; + qglReadPixels = dllReadPixels ; + qglRectd = dllRectd ; + qglRectdv = dllRectdv ; + qglRectf = dllRectf ; + qglRectfv = dllRectfv ; + qglRecti = dllRecti ; + qglRectiv = dllRectiv ; + qglRects = dllRects ; + qglRectsv = dllRectsv ; + qglRenderMode = dllRenderMode ; + qglRotated = dllRotated ; + qglRotatef = dllRotatef ; + qglScaled = dllScaled ; + qglScalef = dllScalef ; + qglScissor = dllScissor ; + qglSelectBuffer = dllSelectBuffer ; + qglShadeModel = dllShadeModel ; + qglStencilFunc = dllStencilFunc ; + qglStencilMask = dllStencilMask ; + qglStencilOp = dllStencilOp ; + qglTexCoord1d = dllTexCoord1d ; + qglTexCoord1dv = dllTexCoord1dv ; + qglTexCoord1f = dllTexCoord1f ; + qglTexCoord1fv = dllTexCoord1fv ; + qglTexCoord1i = dllTexCoord1i ; + qglTexCoord1iv = dllTexCoord1iv ; + qglTexCoord1s = dllTexCoord1s ; + qglTexCoord1sv = dllTexCoord1sv ; + qglTexCoord2d = dllTexCoord2d ; + qglTexCoord2dv = dllTexCoord2dv ; + qglTexCoord2f = dllTexCoord2f ; + qglTexCoord2fv = dllTexCoord2fv ; + qglTexCoord2i = dllTexCoord2i ; + qglTexCoord2iv = dllTexCoord2iv ; + qglTexCoord2s = dllTexCoord2s ; + qglTexCoord2sv = dllTexCoord2sv ; + qglTexCoord3d = dllTexCoord3d ; + qglTexCoord3dv = dllTexCoord3dv ; + qglTexCoord3f = dllTexCoord3f ; + qglTexCoord3fv = dllTexCoord3fv ; + qglTexCoord3i = dllTexCoord3i ; + qglTexCoord3iv = dllTexCoord3iv ; + qglTexCoord3s = dllTexCoord3s ; + qglTexCoord3sv = dllTexCoord3sv ; + qglTexCoord4d = dllTexCoord4d ; + qglTexCoord4dv = dllTexCoord4dv ; + qglTexCoord4f = dllTexCoord4f ; + qglTexCoord4fv = dllTexCoord4fv ; + qglTexCoord4i = dllTexCoord4i ; + qglTexCoord4iv = dllTexCoord4iv ; + qglTexCoord4s = dllTexCoord4s ; + qglTexCoord4sv = dllTexCoord4sv ; + qglTexCoordPointer = dllTexCoordPointer ; + qglTexEnvf = dllTexEnvf ; + qglTexEnvfv = dllTexEnvfv ; + qglTexEnvi = dllTexEnvi ; + qglTexEnviv = dllTexEnviv ; + qglTexGend = dllTexGend ; + qglTexGendv = dllTexGendv ; + qglTexGenf = dllTexGenf ; + qglTexGenfv = dllTexGenfv ; + qglTexGeni = dllTexGeni ; + qglTexGeniv = dllTexGeniv ; + qglTexImage1D = dllTexImage1D ; + qglTexImage2D = dllTexImage2D ; + qglTexParameterf = dllTexParameterf ; + qglTexParameterfv = dllTexParameterfv ; + qglTexParameteri = dllTexParameteri ; + qglTexParameteriv = dllTexParameteriv ; + qglTexSubImage1D = dllTexSubImage1D ; + qglTexSubImage2D = dllTexSubImage2D ; + qglTranslated = dllTranslated ; + qglTranslatef = dllTranslatef ; + qglVertex2d = dllVertex2d ; + qglVertex2dv = dllVertex2dv ; + qglVertex2f = dllVertex2f ; + qglVertex2fv = dllVertex2fv ; + qglVertex2i = dllVertex2i ; + qglVertex2iv = dllVertex2iv ; + qglVertex2s = dllVertex2s ; + qglVertex2sv = dllVertex2sv ; + qglVertex3d = dllVertex3d ; + qglVertex3dv = dllVertex3dv ; + qglVertex3f = dllVertex3f ; + qglVertex3fv = dllVertex3fv ; + qglVertex3i = dllVertex3i ; + qglVertex3iv = dllVertex3iv ; + qglVertex3s = dllVertex3s ; + qglVertex3sv = dllVertex3sv ; + qglVertex4d = dllVertex4d ; + qglVertex4dv = dllVertex4dv ; + qglVertex4f = dllVertex4f ; + qglVertex4fv = dllVertex4fv ; + qglVertex4i = dllVertex4i ; + qglVertex4iv = dllVertex4iv ; + qglVertex4s = dllVertex4s ; + qglVertex4sv = dllVertex4sv ; + qglVertexPointer = dllVertexPointer ; + qglViewport = dllViewport ; } } diff --git a/neo/sys/win32/win_shared.cpp b/neo/sys/win32/win_shared.cpp index e9ec16ea..036141ea 100644 --- a/neo/sys/win32/win_shared.cpp +++ b/neo/sys/win32/win_shared.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"). @@ -130,7 +130,7 @@ int Sys_GetVideoRam( void ) { return retSize; } - // Switch the security level to IMPERSONATE so that provider will grant access to system-level objects. + // Switch the security level to IMPERSONATE so that provider will grant access to system-level objects. hr = CoSetProxyBlanket( spServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE ); if ( hr != S_OK ) { return retSize; @@ -138,7 +138,7 @@ int Sys_GetVideoRam( void ) { // Get the vid controller CComPtr spEnumInst = NULL; - hr = spServices->CreateInstanceEnum( CComBSTR( "Win32_VideoController" ), WBEM_FLAG_SHALLOW, NULL, &spEnumInst ); + hr = spServices->CreateInstanceEnum( CComBSTR( "Win32_VideoController" ), WBEM_FLAG_SHALLOW, NULL, &spEnumInst ); if ( hr != WBEM_S_NO_ERROR || spEnumInst == NULL ) { return retSize; } @@ -250,7 +250,7 @@ char *Sys_GetCurrentUser( void ) { } return s_userName; -} +} /* @@ -600,14 +600,14 @@ void Sym_GetFuncInfo( long addr, idStr &module, idStr &funcName ) { MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, - NULL + NULL ); LocalFree( lpMsgBuf ); // Couldn't retrieve symbol (no debug info?, can't load dbghelp.dll?) sprintf( funcName, "0x%08x", addr ); module = ""; - } + } } #else diff --git a/neo/sys/win32/win_snd.cpp b/neo/sys/win32/win_snd.cpp index 8f8119a9..c3c5e373 100644 --- a/neo/sys/win32/win_snd.cpp +++ b/neo/sys/win32/win_snd.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,48 +44,48 @@ If you have questions concerning this license or the applicable additional terms class idAudioBufferWIN32 : public idAudioBuffer { public: - idAudioBufferWIN32( LPDIRECTSOUNDBUFFER apDSBuffer, dword dwDSBufferSize, idWaveFile* pWaveFile=NULL ); - ~idAudioBufferWIN32(); + idAudioBufferWIN32( LPDIRECTSOUNDBUFFER apDSBuffer, dword dwDSBufferSize, idWaveFile* pWaveFile=NULL ); + ~idAudioBufferWIN32(); - int FillBufferWithSound( LPDIRECTSOUNDBUFFER pDSB, bool bRepeatWavIfBufferLarger ); + int FillBufferWithSound( LPDIRECTSOUNDBUFFER pDSB, bool bRepeatWavIfBufferLarger ); bool Lock( void **pDSLockedBuffer, ulong *dwDSLockedBufferSize ); bool Unlock(void *pDSLockedBuffer, dword dwDSLockedBufferSize ); bool GetCurrentPosition( ulong *pdwCurrentWriteCursor ); - int Play( dword dwPriority=0, dword dwFlags=0 ); - int Stop( void ); - int Reset( void ); - bool IsSoundPlaying( void ); + int Play( dword dwPriority=0, dword dwFlags=0 ); + int Stop( void ); + int Reset( void ); + bool IsSoundPlaying( void ); void SetVolume( float x); - idWaveFile* m_pWaveFile; + idWaveFile* m_pWaveFile; private: - LPDIRECTSOUNDBUFFER m_apDSBuffer; - dword m_dwDSBufferSize; + LPDIRECTSOUNDBUFFER m_apDSBuffer; + dword m_dwDSBufferSize; - int RestoreBuffer( LPDIRECTSOUNDBUFFER pDSB, bool* pbWasRestored ); + int RestoreBuffer( LPDIRECTSOUNDBUFFER pDSB, bool* pbWasRestored ); }; class idAudioHardwareWIN32 : public idAudioHardware { public: - idAudioHardwareWIN32(); - ~idAudioHardwareWIN32(); + idAudioHardwareWIN32(); + ~idAudioHardwareWIN32(); - bool Initialize( ); + bool Initialize( ); bool InitializeSpeakers( byte *buffer, int bufferSize, dword dwPrimaryFreq, dword dwPrimaryBitRate, dword dwSpeakers ); void SetPrimaryBufferFormat( dword dwPrimaryFreq, dword dwPrimaryBitRate, dword dwSpeakers ); - int Create( idWaveFile* pWaveFile, idAudioBuffer** ppiab ); - int Create( idAudioBuffer** ppSound, const char* strWaveFileName, dword dwCreationFlags = 0 ); - int CreateFromMemory( idAudioBufferWIN32** ppSound, byte* pbData, ulong ulDataSize, waveformatextensible_t *pwfx, dword dwCreationFlags = 0 ); + int Create( idWaveFile* pWaveFile, idAudioBuffer** ppiab ); + int Create( idAudioBuffer** ppSound, const char* strWaveFileName, dword dwCreationFlags = 0 ); + int CreateFromMemory( idAudioBufferWIN32** ppSound, byte* pbData, ulong ulDataSize, waveformatextensible_t *pwfx, dword dwCreationFlags = 0 ); bool Lock( void **pDSLockedBuffer, ulong *dwDSLockedBufferSize ); bool Unlock( void *pDSLockedBuffer, dword dwDSLockedBufferSize ); bool GetCurrentPosition( ulong *pdwCurrentWriteCursor ); - + int GetNumberOfSpeakers() { return numSpeakers; } int GetMixBufferSize() { return MIXBUFFER_SAMPLES * blockAlign; } @@ -95,8 +95,8 @@ public: short* GetMixBuffer( void ) { return NULL; } private: - LPDIRECTSOUND m_pDS; - LPDIRECTSOUNDBUFFER pDSBPrimary; + LPDIRECTSOUND m_pDS; + LPDIRECTSOUNDBUFFER pDSBPrimary; idAudioBufferWIN32 *speakers; int numSpeakers; @@ -114,7 +114,7 @@ idAudioHardwareWIN32::idAudioHardware ================ */ idAudioHardwareWIN32::idAudioHardwareWIN32() { - m_pDS = NULL; + m_pDS = NULL; pDSBPrimary = NULL; speakers = NULL; } @@ -127,7 +127,7 @@ idAudioHardwareWIN32::~idAudioHardware idAudioHardwareWIN32::~idAudioHardwareWIN32() { SAFE_DELETE( speakers ); SAFE_RELEASE( pDSBPrimary ); - SAFE_RELEASE( m_pDS ); + SAFE_RELEASE( m_pDS ); } /* @@ -136,20 +136,20 @@ idAudioHardwareWIN32::Initialize =============== */ bool idAudioHardwareWIN32::Initialize( void ) { - int hr; + int hr; bufferSize = 0; numSpeakers = 0; blockAlign = 0; - SAFE_RELEASE( m_pDS ); + SAFE_RELEASE( m_pDS ); - // Create IDirectSound using the primary sound device - if( FAILED( hr = DirectSoundCreate( NULL, &m_pDS, NULL ) )) { - return false; + // Create IDirectSound using the primary sound device + if( FAILED( hr = DirectSoundCreate( NULL, &m_pDS, NULL ) )) { + return false; } - // Set primary buffer format + // Set primary buffer format SetPrimaryBufferFormat( PRIMARYFREQ, 16, idSoundSystemLocal::s_numberOfSpeakers.GetInteger() ); return true; } @@ -162,11 +162,11 @@ idAudioHardwareWIN32::InitializeSpeakers bool idAudioHardwareWIN32::InitializeSpeakers( byte *speakerData, int bufferSize, dword dwPrimaryFreq, dword dwPrimaryBitRate, dword dwSpeakers ) { if ( dwSpeakers == 2 ) { WAVEFORMATEXTENSIBLE wfx; - ZeroMemory( &wfx, sizeof(WAVEFORMATEXTENSIBLE) ); - wfx.Format.wFormatTag = WAVE_FORMAT_PCM; - wfx.Format.nChannels = 2; + ZeroMemory( &wfx, sizeof(WAVEFORMATEXTENSIBLE) ); + wfx.Format.wFormatTag = WAVE_FORMAT_PCM; + wfx.Format.nChannels = 2; wfx.Format.nSamplesPerSec = dwPrimaryFreq; - wfx.Format.wBitsPerSample = dwPrimaryBitRate; + wfx.Format.wBitsPerSample = dwPrimaryBitRate; wfx.Format.nBlockAlign = wfx.Format.wBitsPerSample / 8 * wfx.Format.nChannels; wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign; wfx.Format.cbSize = sizeof(WAVEFORMATEX); @@ -175,10 +175,10 @@ bool idAudioHardwareWIN32::InitializeSpeakers( byte *speakerData, int bufferSize common->Printf("sound: STEREO\n"); } else { - WAVEFORMATEXTENSIBLE waveFormatPCMEx; - ZeroMemory( &waveFormatPCMEx, sizeof(WAVEFORMATEXTENSIBLE) ); + WAVEFORMATEXTENSIBLE waveFormatPCMEx; + ZeroMemory( &waveFormatPCMEx, sizeof(WAVEFORMATEXTENSIBLE) ); - waveFormatPCMEx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + waveFormatPCMEx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; waveFormatPCMEx.Format.nChannels = 6; waveFormatPCMEx.Format.nSamplesPerSec = dwPrimaryFreq; waveFormatPCMEx.Format.wBitsPerSample = dwPrimaryBitRate; @@ -209,42 +209,42 @@ bool idAudioHardwareWIN32::InitializeSpeakers( byte *speakerData, int bufferSize /* =============== idAudioHardwareWIN32::SetPrimaryBufferFormat -Set primary buffer to a specified format +Set primary buffer to a specified format For example, to set the primary buffer format to 22kHz stereo, 16-bit then: dwPrimaryChannels = 2 - dwPrimaryFreq = 22050, - dwPrimaryBitRate = 16 + dwPrimaryFreq = 22050, + dwPrimaryBitRate = 16 =============== */ void idAudioHardwareWIN32::SetPrimaryBufferFormat( dword dwPrimaryFreq, dword dwPrimaryBitRate, dword dwSpeakers ) { - HRESULT hr; + HRESULT hr; - if( m_pDS == NULL ) { - return; + if( m_pDS == NULL ) { + return; } ulong cfgSpeakers; m_pDS->GetSpeakerConfig( &cfgSpeakers ); - DSCAPS dscaps; - dscaps.dwSize = sizeof(DSCAPS); - m_pDS->GetCaps(&dscaps); + DSCAPS dscaps; + dscaps.dwSize = sizeof(DSCAPS); + m_pDS->GetCaps(&dscaps); if (dscaps.dwFlags & DSCAPS_EMULDRIVER) { return; } - // Get the primary buffer - DSBUFFERDESC dsbd; - ZeroMemory( &dsbd, sizeof(DSBUFFERDESC) ); - dsbd.dwSize = sizeof(DSBUFFERDESC); - dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER; - dsbd.dwBufferBytes = 0; - dsbd.lpwfxFormat = NULL; - - // Obtain write-primary cooperative level. + // Get the primary buffer + DSBUFFERDESC dsbd; + ZeroMemory( &dsbd, sizeof(DSBUFFERDESC) ); + dsbd.dwSize = sizeof(DSBUFFERDESC); + dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER; + dsbd.dwBufferBytes = 0; + dsbd.lpwfxFormat = NULL; + + // Obtain write-primary cooperative level. if( FAILED( hr = m_pDS->SetCooperativeLevel(win32.hWnd, DSSCL_PRIORITY ) ) ) { - DXTRACE_ERR( TEXT("SetPrimaryBufferFormat"), hr ); + DXTRACE_ERR( TEXT("SetPrimaryBufferFormat"), hr ); return; } @@ -253,13 +253,13 @@ void idAudioHardwareWIN32::SetPrimaryBufferFormat( dword dwPrimaryFreq, dword dw } if ( dwSpeakers == 6 && (cfgSpeakers == DSSPEAKER_5POINT1 || cfgSpeakers == DSSPEAKER_SURROUND) ) { - WAVEFORMATEXTENSIBLE waveFormatPCMEx; - ZeroMemory( &waveFormatPCMEx, sizeof(WAVEFORMATEXTENSIBLE) ); + WAVEFORMATEXTENSIBLE waveFormatPCMEx; + ZeroMemory( &waveFormatPCMEx, sizeof(WAVEFORMATEXTENSIBLE) ); - waveFormatPCMEx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + waveFormatPCMEx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; waveFormatPCMEx.Format.nChannels = 6; waveFormatPCMEx.Format.nSamplesPerSec = dwPrimaryFreq; - waveFormatPCMEx.Format.wBitsPerSample = (WORD) dwPrimaryBitRate; + waveFormatPCMEx.Format.wBitsPerSample = (WORD) dwPrimaryBitRate; waveFormatPCMEx.Format.nBlockAlign = waveFormatPCMEx.Format.wBitsPerSample / 8 * waveFormatPCMEx.Format.nChannels; waveFormatPCMEx.Format.nAvgBytesPerSec = waveFormatPCMEx.Format.nSamplesPerSec * waveFormatPCMEx.Format.nBlockAlign; waveFormatPCMEx.dwChannelMask = KSAUDIO_SPEAKER_5POINT1; @@ -281,11 +281,11 @@ void idAudioHardwareWIN32::SetPrimaryBufferFormat( dword dwPrimaryFreq, dword dw common->Printf("sound: hardware reported unable to use multisound, defaulted to stereo\n"); } WAVEFORMATEX wfx; - ZeroMemory( &wfx, sizeof(WAVEFORMATEX) ); - wfx.wFormatTag = WAVE_FORMAT_PCM; - wfx.nChannels = 2; - wfx.nSamplesPerSec = dwPrimaryFreq; - wfx.wBitsPerSample = (WORD) dwPrimaryBitRate; + ZeroMemory( &wfx, sizeof(WAVEFORMATEX) ); + wfx.wFormatTag = WAVE_FORMAT_PCM; + wfx.nChannels = 2; + wfx.nSamplesPerSec = dwPrimaryFreq; + wfx.wBitsPerSample = (WORD) dwPrimaryBitRate; wfx.nBlockAlign = wfx.wBitsPerSample / 8 * wfx.nChannels; wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; wfx.cbSize = sizeof(WAVEFORMATEX); @@ -310,59 +310,59 @@ void idAudioHardwareWIN32::SetPrimaryBufferFormat( dword dwPrimaryFreq, dword dw idAudioHardwareWIN32::Create =============== */ -int idAudioHardwareWIN32::Create( idAudioBuffer** ppSound, - const char* strWaveFileName, +int idAudioHardwareWIN32::Create( idAudioBuffer** ppSound, + const char* strWaveFileName, dword dwCreationFlags ) { - int hr; - LPDIRECTSOUNDBUFFER apDSBuffer = NULL; - dword dwDSBufferSize = NULL; - idWaveFile* pWaveFile = NULL; + int hr; + LPDIRECTSOUNDBUFFER apDSBuffer = NULL; + dword dwDSBufferSize = NULL; + idWaveFile* pWaveFile = NULL; - if( m_pDS == NULL ) - return -1; - if( strWaveFileName == NULL || ppSound == NULL ) - return -1; + if( m_pDS == NULL ) + return -1; + if( strWaveFileName == NULL || ppSound == NULL ) + return -1; pWaveFile = new idWaveFile(); - pWaveFile->Open( strWaveFileName, NULL ); + pWaveFile->Open( strWaveFileName, NULL ); - if( pWaveFile->GetOutputSize() == 0 ) { - // Wave is blank, so don't create it. - hr = E_FAIL; - goto LFail; - } + if( pWaveFile->GetOutputSize() == 0 ) { + // Wave is blank, so don't create it. + hr = E_FAIL; + goto LFail; + } - // Make the DirectSound buffer the same size as the wav file - dwDSBufferSize = pWaveFile->GetOutputSize(); + // Make the DirectSound buffer the same size as the wav file + dwDSBufferSize = pWaveFile->GetOutputSize(); - // Create the direct sound buffer, and only request the flags needed - // since each requires some overhead and limits if the buffer can - // be hardware accelerated - DSBUFFERDESC dsbd; - memset( &dsbd, 0, sizeof(DSBUFFERDESC) ); - dsbd.dwSize = sizeof(DSBUFFERDESC); - dsbd.dwFlags = dwCreationFlags; - dsbd.dwBufferBytes = dwDSBufferSize; - dsbd.guid3DAlgorithm = GUID_NULL; - dsbd.lpwfxFormat = (WAVEFORMATEX*)&pWaveFile->mpwfx; + // Create the direct sound buffer, and only request the flags needed + // since each requires some overhead and limits if the buffer can + // be hardware accelerated + DSBUFFERDESC dsbd; + memset( &dsbd, 0, sizeof(DSBUFFERDESC) ); + dsbd.dwSize = sizeof(DSBUFFERDESC); + dsbd.dwFlags = dwCreationFlags; + dsbd.dwBufferBytes = dwDSBufferSize; + dsbd.guid3DAlgorithm = GUID_NULL; + dsbd.lpwfxFormat = (WAVEFORMATEX*)&pWaveFile->mpwfx; - // DirectSound is only guarenteed to play PCM data. Other - // formats may or may not work depending the sound card driver. - if( FAILED( hr = m_pDS->CreateSoundBuffer( &dsbd, &apDSBuffer, NULL ) ) ) + // DirectSound is only guarenteed to play PCM data. Other + // formats may or may not work depending the sound card driver. + if( FAILED( hr = m_pDS->CreateSoundBuffer( &dsbd, &apDSBuffer, NULL ) ) ) return -1; - // Create the sound - *ppSound = new idAudioBufferWIN32( apDSBuffer, dwDSBufferSize, pWaveFile ); - - pWaveFile->Close(); + // Create the sound + *ppSound = new idAudioBufferWIN32( apDSBuffer, dwDSBufferSize, pWaveFile ); - return 0; + pWaveFile->Close(); + + return 0; LFail: - // Cleanup - SAFE_DELETE( pWaveFile ); - return -1; + // Cleanup + SAFE_DELETE( pWaveFile ); + return -1; } /* @@ -371,99 +371,99 @@ idAudioHardwareWIN32::Create =============== */ int idAudioHardwareWIN32::Create( idWaveFile* pWaveFile, idAudioBuffer** ppiab ) { - int hr; - LPDIRECTSOUNDBUFFER apDSBuffer = NULL; - dword dwDSBufferSize = NULL; + int hr; + LPDIRECTSOUNDBUFFER apDSBuffer = NULL; + dword dwDSBufferSize = NULL; - if( m_pDS == NULL ) - return -1; + if( m_pDS == NULL ) + return -1; - if( pWaveFile == NULL ) - return -1; + if( pWaveFile == NULL ) + return -1; *ppiab = NULL; - if( pWaveFile->GetOutputSize() == 0 ) { - // Wave is blank, so don't create it. - hr = E_FAIL; - goto LFail; - } + if( pWaveFile->GetOutputSize() == 0 ) { + // Wave is blank, so don't create it. + hr = E_FAIL; + goto LFail; + } - // Make the DirectSound buffer the same size as the wav file - dwDSBufferSize = pWaveFile->GetOutputSize(); + // Make the DirectSound buffer the same size as the wav file + dwDSBufferSize = pWaveFile->GetOutputSize(); - // Create the direct sound buffer, and only request the flags needed - // since each requires some overhead and limits if the buffer can - // be hardware accelerated - DSBUFFERDESC dsbd; - memset( &dsbd, 0, sizeof(DSBUFFERDESC) ); - dsbd.dwSize = sizeof(DSBUFFERDESC); - dsbd.dwFlags = 0; - dsbd.dwBufferBytes = dwDSBufferSize; - dsbd.guid3DAlgorithm = GUID_NULL; - dsbd.lpwfxFormat = (WAVEFORMATEX*)&pWaveFile->mpwfx; + // Create the direct sound buffer, and only request the flags needed + // since each requires some overhead and limits if the buffer can + // be hardware accelerated + DSBUFFERDESC dsbd; + memset( &dsbd, 0, sizeof(DSBUFFERDESC) ); + dsbd.dwSize = sizeof(DSBUFFERDESC); + dsbd.dwFlags = 0; + dsbd.dwBufferBytes = dwDSBufferSize; + dsbd.guid3DAlgorithm = GUID_NULL; + dsbd.lpwfxFormat = (WAVEFORMATEX*)&pWaveFile->mpwfx; - // DirectSound is only guarenteed to play PCM data. Other - // formats may or may not work depending the sound card driver. - if( FAILED( hr = m_pDS->CreateSoundBuffer( &dsbd, &apDSBuffer, NULL ) ) ) + // DirectSound is only guarenteed to play PCM data. Other + // formats may or may not work depending the sound card driver. + if( FAILED( hr = m_pDS->CreateSoundBuffer( &dsbd, &apDSBuffer, NULL ) ) ) return -1; - // Create the sound - *ppiab = new idAudioBufferWIN32( apDSBuffer, dwDSBufferSize, pWaveFile ); - - return 0; + // Create the sound + *ppiab = new idAudioBufferWIN32( apDSBuffer, dwDSBufferSize, pWaveFile ); + + return 0; LFail: - // Cleanup - SAFE_DELETE( pWaveFile ); - return -1; + // Cleanup + SAFE_DELETE( pWaveFile ); + return -1; } //----------------------------------------------------------------------------- // Name: idAudioHardwareWIN32::CreateFromMemory() -// Desc: +// Desc: //----------------------------------------------------------------------------- -int idAudioHardwareWIN32::CreateFromMemory( idAudioBufferWIN32** ppSound, - byte* pbData, - ulong ulDataSize, - waveformatextensible_t* pwfx, +int idAudioHardwareWIN32::CreateFromMemory( idAudioBufferWIN32** ppSound, + byte* pbData, + ulong ulDataSize, + waveformatextensible_t* pwfx, dword dwCreationFlags ) { - int hr; - LPDIRECTSOUNDBUFFER apDSBuffer = NULL; - dword dwDSBufferSize = NULL; - idWaveFile* pWaveFile = NULL; + int hr; + LPDIRECTSOUNDBUFFER apDSBuffer = NULL; + dword dwDSBufferSize = NULL; + idWaveFile* pWaveFile = NULL; - if( m_pDS == NULL ) - return -1; - if( pbData == NULL || ppSound == NULL ) - return -1; - - pWaveFile = new idWaveFile(); - - pWaveFile->OpenFromMemory( (short *)pbData, ulDataSize, (waveformatextensible_t *)pwfx); - - - // Make the DirectSound buffer the same size as the wav file - dwDSBufferSize = ulDataSize; - - // Create the direct sound buffer, and only request the flags needed - // since each requires some overhead and limits if the buffer can - // be hardware accelerated - DSBUFFERDESC dsbd; - memset( &dsbd, 0, sizeof(DSBUFFERDESC) ); - dsbd.dwSize = sizeof(DSBUFFERDESC); - dsbd.dwFlags = dwCreationFlags | DSBCAPS_GETCURRENTPOSITION2; - dsbd.dwBufferBytes = dwDSBufferSize; - dsbd.guid3DAlgorithm = GUID_NULL; - dsbd.lpwfxFormat = (WAVEFORMATEX *)pwfx; - - if( FAILED( hr = m_pDS->CreateSoundBuffer( &dsbd, &apDSBuffer, NULL ) ) ) + if( m_pDS == NULL ) + return -1; + if( pbData == NULL || ppSound == NULL ) return -1; - // Create the sound - *ppSound = new idAudioBufferWIN32( apDSBuffer, dwDSBufferSize, pWaveFile ); + pWaveFile = new idWaveFile(); - return S_OK; + pWaveFile->OpenFromMemory( (short *)pbData, ulDataSize, (waveformatextensible_t *)pwfx); + + + // Make the DirectSound buffer the same size as the wav file + dwDSBufferSize = ulDataSize; + + // Create the direct sound buffer, and only request the flags needed + // since each requires some overhead and limits if the buffer can + // be hardware accelerated + DSBUFFERDESC dsbd; + memset( &dsbd, 0, sizeof(DSBUFFERDESC) ); + dsbd.dwSize = sizeof(DSBUFFERDESC); + dsbd.dwFlags = dwCreationFlags | DSBCAPS_GETCURRENTPOSITION2; + dsbd.dwBufferBytes = dwDSBufferSize; + dsbd.guid3DAlgorithm = GUID_NULL; + dsbd.lpwfxFormat = (WAVEFORMATEX *)pwfx; + + if( FAILED( hr = m_pDS->CreateSoundBuffer( &dsbd, &apDSBuffer, NULL ) ) ) + return -1; + + // Create the sound + *ppSound = new idAudioBufferWIN32( apDSBuffer, dwDSBufferSize, pWaveFile ); + + return S_OK; } /* @@ -553,10 +553,10 @@ idAudioBufferWIN32::idAudioBuffer */ idAudioBufferWIN32::idAudioBufferWIN32( LPDIRECTSOUNDBUFFER apDSBuffer, dword dwDSBufferSize, idWaveFile* pWaveFile ) { - m_apDSBuffer = apDSBuffer; + m_apDSBuffer = apDSBuffer; - m_dwDSBufferSize = dwDSBufferSize; - m_pWaveFile = pWaveFile; + m_dwDSBufferSize = dwDSBufferSize; + m_pWaveFile = pWaveFile; if (pWaveFile) { FillBufferWithSound( m_apDSBuffer, false ); @@ -572,7 +572,7 @@ idAudioBufferWIN32::~idAudioBuffer */ idAudioBufferWIN32::~idAudioBufferWIN32() { SAFE_DELETE(m_pWaveFile); - SAFE_RELEASE( m_apDSBuffer ); + SAFE_RELEASE( m_apDSBuffer ); m_pWaveFile = NULL; m_apDSBuffer = NULL; } @@ -583,150 +583,150 @@ idAudioBufferWIN32::FillBufferWithSound =============== */ int idAudioBufferWIN32::FillBufferWithSound( LPDIRECTSOUNDBUFFER pDSB, bool bRepeatWavIfBufferLarger ) { - int hr; - void* pDSLockedBuffer = NULL; // Pointer to locked buffer memory - ulong dwDSLockedBufferSize = 0; // Size of the locked DirectSound buffer - int dwWavDataRead = 0; // Amount of data read from the wav file + int hr; + void* pDSLockedBuffer = NULL; // Pointer to locked buffer memory + ulong dwDSLockedBufferSize = 0; // Size of the locked DirectSound buffer + int dwWavDataRead = 0; // Amount of data read from the wav file - if( pDSB == NULL ) - return -1; + if( pDSB == NULL ) + return -1; // we may not even have a wavefile if (m_pWaveFile==NULL) { return -1; } - // Make sure we have focus, and we didn't just switch in from - // an app which had a DirectSound device - if( FAILED( hr = RestoreBuffer( pDSB, NULL ) ) ) { - DXTRACE_ERR( TEXT("RestoreBuffer"), hr ); + // Make sure we have focus, and we didn't just switch in from + // an app which had a DirectSound device + if( FAILED( hr = RestoreBuffer( pDSB, NULL ) ) ) { + DXTRACE_ERR( TEXT("RestoreBuffer"), hr ); return -1; } - // Lock the buffer down - if( FAILED( hr = pDSB->Lock( 0, m_dwDSBufferSize, &pDSLockedBuffer, &dwDSLockedBufferSize, NULL, NULL, 0L ) ) ) { - DXTRACE_ERR( TEXT("Lock"), hr ); + // Lock the buffer down + if( FAILED( hr = pDSB->Lock( 0, m_dwDSBufferSize, &pDSLockedBuffer, &dwDSLockedBufferSize, NULL, NULL, 0L ) ) ) { + DXTRACE_ERR( TEXT("Lock"), hr ); return -1; } - // Reset the wave file to the beginning - m_pWaveFile->ResetFile(); + // Reset the wave file to the beginning + m_pWaveFile->ResetFile(); - if( FAILED( hr = m_pWaveFile->Read( (byte*) pDSLockedBuffer, dwDSLockedBufferSize, &dwWavDataRead ) ) ) { - return DXTRACE_ERR( TEXT("Read"), hr ); + if( FAILED( hr = m_pWaveFile->Read( (byte*) pDSLockedBuffer, dwDSLockedBufferSize, &dwWavDataRead ) ) ) { + return DXTRACE_ERR( TEXT("Read"), hr ); } - if( dwWavDataRead == 0 ) { - // Wav is blank, so just fill with silence - memset( pDSLockedBuffer, (byte)(m_pWaveFile->mpwfx.Format.wBitsPerSample == 8 ? 128 : 0 ), dwDSLockedBufferSize ); - } else if( dwWavDataRead < (int)dwDSLockedBufferSize ) { - // If the wav file was smaller than the DirectSound buffer, - // we need to fill the remainder of the buffer with data - if( bRepeatWavIfBufferLarger ) { - // Reset the file and fill the buffer with wav data - int dwReadSoFar = dwWavDataRead; // From previous call above. - while( dwReadSoFar < (int)dwDSLockedBufferSize ) { - // This will keep reading in until the buffer is full - // for very short files - if( FAILED( hr = m_pWaveFile->ResetFile() ) ) { - return DXTRACE_ERR( TEXT("ResetFile"), hr ); + if( dwWavDataRead == 0 ) { + // Wav is blank, so just fill with silence + memset( pDSLockedBuffer, (byte)(m_pWaveFile->mpwfx.Format.wBitsPerSample == 8 ? 128 : 0 ), dwDSLockedBufferSize ); + } else if( dwWavDataRead < (int)dwDSLockedBufferSize ) { + // If the wav file was smaller than the DirectSound buffer, + // we need to fill the remainder of the buffer with data + if( bRepeatWavIfBufferLarger ) { + // Reset the file and fill the buffer with wav data + int dwReadSoFar = dwWavDataRead; // From previous call above. + while( dwReadSoFar < (int)dwDSLockedBufferSize ) { + // This will keep reading in until the buffer is full + // for very short files + if( FAILED( hr = m_pWaveFile->ResetFile() ) ) { + return DXTRACE_ERR( TEXT("ResetFile"), hr ); } - hr = m_pWaveFile->Read( (byte*)pDSLockedBuffer + dwReadSoFar, dwDSLockedBufferSize - dwReadSoFar, &dwWavDataRead ); - if( FAILED(hr) ) { - return DXTRACE_ERR( TEXT("Read"), hr ); + hr = m_pWaveFile->Read( (byte*)pDSLockedBuffer + dwReadSoFar, dwDSLockedBufferSize - dwReadSoFar, &dwWavDataRead ); + if( FAILED(hr) ) { + return DXTRACE_ERR( TEXT("Read"), hr ); } - dwReadSoFar += dwWavDataRead; - } - } else { - // Don't repeat the wav file, just fill in silence - memset( (byte*) pDSLockedBuffer + dwWavDataRead, (byte)(m_pWaveFile->mpwfx.Format.wBitsPerSample == 8 ? 128 : 0 ), dwDSLockedBufferSize - dwWavDataRead); - } - } + dwReadSoFar += dwWavDataRead; + } + } else { + // Don't repeat the wav file, just fill in silence + memset( (byte*) pDSLockedBuffer + dwWavDataRead, (byte)(m_pWaveFile->mpwfx.Format.wBitsPerSample == 8 ? 128 : 0 ), dwDSLockedBufferSize - dwWavDataRead); + } + } - // Unlock the buffer, we don't need it anymore. - pDSB->Unlock( pDSLockedBuffer, dwDSLockedBufferSize, NULL, 0 ); + // Unlock the buffer, we don't need it anymore. + pDSB->Unlock( pDSLockedBuffer, dwDSLockedBufferSize, NULL, 0 ); - return S_OK; + return S_OK; } /* =============== idAudioBufferWIN32::RestoreBuffer -Desc: Restores the lost buffer. *pbWasRestored returns true if the buffer was - restored. It can also NULL if the information is not needed. +Desc: Restores the lost buffer. *pbWasRestored returns true if the buffer was + restored. It can also NULL if the information is not needed. =============== */ int idAudioBufferWIN32::RestoreBuffer( LPDIRECTSOUNDBUFFER pDSB, bool* pbWasRestored ) { - int hr; + int hr; - if( pDSB == NULL ) { - return -1; + if( pDSB == NULL ) { + return -1; } - if( pbWasRestored ) { - *pbWasRestored = false; + if( pbWasRestored ) { + *pbWasRestored = false; } - ulong dwStatus; - if( FAILED( hr = pDSB->GetStatus( &dwStatus ) ) ) { - return DXTRACE_ERR( TEXT("GetStatus"), hr ); + ulong dwStatus; + if( FAILED( hr = pDSB->GetStatus( &dwStatus ) ) ) { + return DXTRACE_ERR( TEXT("GetStatus"), hr ); } - if( dwStatus & DSBSTATUS_BUFFERLOST ) { - // Since the app could have just been activated, then - // DirectSound may not be giving us control yet, so - // the restoring the buffer may fail. - // If it does, sleep until DirectSound gives us control. - do { - hr = pDSB->Restore(); - if( hr == DSERR_BUFFERLOST ) { - Sleep( 10 ); + if( dwStatus & DSBSTATUS_BUFFERLOST ) { + // Since the app could have just been activated, then + // DirectSound may not be giving us control yet, so + // the restoring the buffer may fail. + // If it does, sleep until DirectSound gives us control. + do { + hr = pDSB->Restore(); + if( hr == DSERR_BUFFERLOST ) { + Sleep( 10 ); } hr = pDSB->Restore(); - } while( hr ); + } while( hr ); - if( pbWasRestored != NULL ) { - *pbWasRestored = true; + if( pbWasRestored != NULL ) { + *pbWasRestored = true; } - return S_OK; - } else { - return S_FALSE; - } + return S_OK; + } else { + return S_FALSE; + } } /* =============== idAudioBufferWIN32::Play Desc: Plays the sound using voice management flags. Pass in DSBPLAY_LOOPING - in the dwFlags to loop the sound + in the dwFlags to loop the sound =============== */ int idAudioBufferWIN32::Play( dword dwPriority, dword dwFlags ) { - int hr; - bool bRestored; + int hr; + bool bRestored; - if( m_apDSBuffer == NULL ) { - return -1; + if( m_apDSBuffer == NULL ) { + return -1; } - // Restore the buffer if it was lost - if( FAILED( hr = RestoreBuffer( m_apDSBuffer, &bRestored ) ) ) { - common->Error( TEXT("RestoreBuffer"), hr ); + // Restore the buffer if it was lost + if( FAILED( hr = RestoreBuffer( m_apDSBuffer, &bRestored ) ) ) { + common->Error( TEXT("RestoreBuffer"), hr ); } - if( bRestored ) { - // The buffer was restored, so we need to fill it with new data - if( FAILED( hr = FillBufferWithSound( m_apDSBuffer, false ) ) ) { - common->Error( TEXT("FillBufferWithSound"), hr ); + if( bRestored ) { + // The buffer was restored, so we need to fill it with new data + if( FAILED( hr = FillBufferWithSound( m_apDSBuffer, false ) ) ) { + common->Error( TEXT("FillBufferWithSound"), hr ); } - // Make DirectSound do pre-processing on sound effects - Reset(); - } + // Make DirectSound do pre-processing on sound effects + Reset(); + } - m_apDSBuffer->Play( 0, dwPriority, dwFlags ); + m_apDSBuffer->Play( 0, dwPriority, dwFlags ); return 0; } @@ -737,13 +737,13 @@ Desc: Stops the sound from playing =============== */ int idAudioBufferWIN32::Stop() { - if( this == NULL || m_apDSBuffer == NULL ) { - return -1; + if( this == NULL || m_apDSBuffer == NULL ) { + return -1; } m_apDSBuffer->Stop(); - return 0; + return 0; } /* @@ -753,13 +753,13 @@ Desc: Reset all of the sound buffers =============== */ int idAudioBufferWIN32::Reset() { - if( m_apDSBuffer == NULL ) { - return -1; + if( m_apDSBuffer == NULL ) { + return -1; } - m_apDSBuffer->SetCurrentPosition( 0 ); + m_apDSBuffer->SetCurrentPosition( 0 ); - return 0; + return 0; } /* @@ -769,14 +769,14 @@ Desc: Checks to see if a buffer is playing and returns true if it =============== */ bool idAudioBufferWIN32::IsSoundPlaying( ) { - if( m_apDSBuffer == NULL ) { - return false; + if( m_apDSBuffer == NULL ) { + return false; } - if( m_apDSBuffer ) { + if( m_apDSBuffer ) { ulong dwStatus = 0; - m_apDSBuffer->GetStatus( &dwStatus ); - if ( dwStatus & DSBSTATUS_PLAYING ) { + m_apDSBuffer->GetStatus( &dwStatus ); + if ( dwStatus & DSBSTATUS_PLAYING ) { return true; } } @@ -790,15 +790,15 @@ idAudioBufferWIN32::Lock */ bool idAudioBufferWIN32::Lock( void **pDSLockedBuffer, ulong *dwDSLockedBufferSize ) { int hr; - // Restore the buffer if it was lost - bool bRestored; - if( FAILED( hr = RestoreBuffer( m_apDSBuffer, &bRestored ) ) ) { - return false; + // Restore the buffer if it was lost + bool bRestored; + if( FAILED( hr = RestoreBuffer( m_apDSBuffer, &bRestored ) ) ) { + return false; } - // Lock the DirectSound buffer - if( FAILED( hr = m_apDSBuffer->Lock( 0, m_dwDSBufferSize, pDSLockedBuffer, dwDSLockedBufferSize, NULL, NULL, 0 ) ) ) { - return false; + // Lock the DirectSound buffer + if( FAILED( hr = m_apDSBuffer->Lock( 0, m_dwDSBufferSize, pDSLockedBuffer, dwDSLockedBufferSize, NULL, NULL, 0 ) ) ) { + return false; } return true; } @@ -809,8 +809,8 @@ idAudioBufferWIN32::Unlock =============== */ bool idAudioBufferWIN32::Unlock(void *pDSLockedBuffer, dword dwDSLockedBufferSize ) { - // Unlock the DirectSound buffer - m_apDSBuffer->Unlock( pDSLockedBuffer, dwDSLockedBufferSize, NULL, 0 ); + // Unlock the DirectSound buffer + m_apDSBuffer->Unlock( pDSLockedBuffer, dwDSLockedBufferSize, NULL, 0 ); return true; } @@ -822,15 +822,15 @@ idAudioBufferWIN32::GetCurrentPosition bool idAudioBufferWIN32::GetCurrentPosition( ulong *pdwCurrentWriteCursor ) { int hr; - // Make sure we have focus, and we didn't just switch in from - // an app which had a DirectSound device - if( FAILED( hr = RestoreBuffer( m_apDSBuffer, NULL ) ) ) { - DXTRACE_ERR( TEXT("RestoreBuffer"), hr ); + // Make sure we have focus, and we didn't just switch in from + // an app which had a DirectSound device + if( FAILED( hr = RestoreBuffer( m_apDSBuffer, NULL ) ) ) { + DXTRACE_ERR( TEXT("RestoreBuffer"), hr ); return false; } - if( FAILED( hr = m_apDSBuffer->GetCurrentPosition( NULL, pdwCurrentWriteCursor ) ) ) { - return false; + if( FAILED( hr = m_apDSBuffer->GetCurrentPosition( NULL, pdwCurrentWriteCursor ) ) ) { + return false; } return true; } diff --git a/neo/sys/win32/win_syscon.cpp b/neo/sys/win32/win_syscon.cpp index f9f1102e..61f3d22d 100644 --- a/neo/sys/win32/win_syscon.cpp +++ b/neo/sys/win32/win_syscon.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 @@ typedef struct { char consoleText[512], returnedText[512]; bool quitOnClose; int windowWidth, windowHeight; - + WNDPROC SysInputLineWndProc; idEditField historyEditLines[COMMAND_HISTORY]; @@ -170,7 +170,7 @@ static LONG WINAPI ConWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara assert( oldObject != 0 ); if ( oldObject ) { - StretchBlt( ( HDC ) wParam, 0, 0, s_wcd.windowWidth, s_wcd.windowHeight, + StretchBlt( ( HDC ) wParam, 0, 0, s_wcd.windowWidth, s_wcd.windowHeight, hdcScaled, 0, 0, 512, 384, SRCCOPY ); } @@ -187,9 +187,9 @@ static LONG WINAPI ConWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara } } break; - } + } - return DefWindowProc( hWnd, uMsg, wParam, lParam ); + return DefWindowProc( hWnd, uMsg, wParam, lParam ); } LONG WINAPI InputLineWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -267,7 +267,7 @@ LONG WINAPI InputLineWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam } // clear autocompletion buffer on normal key input - if ( ( key >= K_SPACE && key <= K_BACKSPACE ) || + if ( ( key >= K_SPACE && key <= K_BACKSPACE ) || ( key >= K_KP_SLASH && key <= K_KP_PLUS ) || ( key >= K_KP_STAR && key <= K_KP_EQUALS ) ) { s_wcd.consoleField.ClearAutoComplete(); } @@ -350,10 +350,10 @@ void Sys_CreateConsole( void ) { // // create the input line // - s_wcd.hwndInputLine = CreateWindow( "edit", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER | + s_wcd.hwndInputLine = CreateWindow( "edit", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | ES_AUTOHSCROLL, 6, 400, 528, 20, - s_wcd.hWnd, + s_wcd.hWnd, ( HMENU ) INPUT_ID, // child window ID win32.hInstance, NULL ); @@ -362,21 +362,21 @@ void Sys_CreateConsole( void ) { // s_wcd.hwndButtonCopy = CreateWindow( "button", NULL, BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 5, 425, 72, 24, - s_wcd.hWnd, + s_wcd.hWnd, ( HMENU ) COPY_ID, // child window ID win32.hInstance, NULL ); SendMessage( s_wcd.hwndButtonCopy, WM_SETTEXT, 0, ( LPARAM ) "copy" ); s_wcd.hwndButtonClear = CreateWindow( "button", NULL, BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 82, 425, 72, 24, - s_wcd.hWnd, + s_wcd.hWnd, ( HMENU ) CLEAR_ID, // child window ID win32.hInstance, NULL ); SendMessage( s_wcd.hwndButtonClear, WM_SETTEXT, 0, ( LPARAM ) "clear" ); s_wcd.hwndButtonQuit = CreateWindow( "button", NULL, BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 462, 425, 72, 24, - s_wcd.hWnd, + s_wcd.hWnd, ( HMENU ) QUIT_ID, // child window ID win32.hInstance, NULL ); SendMessage( s_wcd.hwndButtonQuit, WM_SETTEXT, 0, ( LPARAM ) "quit" ); @@ -385,10 +385,10 @@ void Sys_CreateConsole( void ) { // // create the scrollbuffer // - s_wcd.hwndBuffer = CreateWindow( "edit", NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | + s_wcd.hwndBuffer = CreateWindow( "edit", NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY, 6, 40, 526, 354, - s_wcd.hWnd, + s_wcd.hWnd, ( HMENU ) EDIT_ID, // child window ID win32.hInstance, NULL ); SendMessage( s_wcd.hwndBuffer, WM_SETFONT, ( WPARAM ) s_wcd.hfBufferFont, 0 ); @@ -457,14 +457,14 @@ void Sys_ShowConsole( int visLevel, bool quitOnClose ) { ** Sys_ConsoleInput */ char *Sys_ConsoleInput( void ) { - + if ( s_wcd.consoleText[0] == 0 ) { return NULL; } - + strcpy( s_wcd.returnedText, s_wcd.consoleText ); s_wcd.consoleText[0] = 0; - + return s_wcd.returnedText; } @@ -545,7 +545,7 @@ void Win_SetErrorText( const char *buf ) { if ( !s_wcd.hwndErrorBox ) { s_wcd.hwndErrorBox = CreateWindow( "static", NULL, WS_CHILD | WS_VISIBLE | SS_SUNKEN, 6, 5, 526, 30, - s_wcd.hWnd, + s_wcd.hWnd, ( HMENU ) ERRORBOX_ID, // child window ID win32.hInstance, NULL ); SendMessage( s_wcd.hwndErrorBox, WM_SETFONT, ( WPARAM ) s_wcd.hfBufferFont, 0 ); diff --git a/neo/sys/win32/win_taskkeyhook.cpp b/neo/sys/win32/win_taskkeyhook.cpp index fd427747..f41e196a 100644 --- a/neo/sys/win32/win_taskkeyhook.cpp +++ b/neo/sys/win32/win_taskkeyhook.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"). @@ -138,7 +138,7 @@ void DisableTaskKeys( BOOL bDisable, BOOL bBeep, BOOL bTaskMgr ) { DWORD val = 1; RegSetValueEx( hk, VAL_DisableTaskMgr, NULL, REG_DWORD, (BYTE*)&val, sizeof(val) ); } else { - // enable TM: remove policy + // enable TM: remove policy RegDeleteValue( hk,VAL_DisableTaskMgr ); } } diff --git a/neo/sys/win32/win_wndproc.cpp b/neo/sys/win32/win_wndproc.cpp index 2ddfe44a..f89b81a2 100644 --- a/neo/sys/win32/win_wndproc.cpp +++ b/neo/sys/win32/win_wndproc.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,49 +134,49 @@ void WIN_Sizing(WORD side, RECT *rect) // Keep this in sync with the one in win_input.cpp // This one is used in the menu, the other one is used in game -static byte s_scantokey[128] = -{ +static byte s_scantokey[128] = +{ // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F - 0, 27, '1', '2', '3', '4', '5', '6', + 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0 - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', K_ENTER,K_CTRL, 'a', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', + 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', K_SHIFT, '\\', 'z', 'x', 'c', 'v', // 2 - 'b', 'n', 'm', ',', '.', '/', K_SHIFT, K_KP_STAR, + 'b', 'n', 'm', ',', '.', '/', K_SHIFT, K_KP_STAR, K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, K_UPARROW, K_PGUP, K_KP_MINUS,K_LEFTARROW,K_KP_5, K_RIGHTARROW,K_KP_PLUS,K_END, // 4 - K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, 0, K_F11, + K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, 0, K_F11, K_F12, 0, 0, K_LWIN, K_RWIN, K_MENU, 0, 0, // 5 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 7 -}; +}; -static byte s_scantoshift[128] = -{ +static byte s_scantoshift[128] = +{ // 0 1 2 3 4 5 6 7 // 8 9 A B C D E F - 0, 27, '!', '@', '#', '$', '%', '^', - '&', '*', '(', ')', '_', '+', K_BACKSPACE, 9, // 0 - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', - 'O', 'P', '{', '}', K_ENTER,K_CTRL, 'A', 'S', // 1 - 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', - '|' , '~', K_SHIFT, '\\', 'Z', 'X', 'C', 'V', // 2 - 'B', 'N', 'M', '<', '>', '?', K_SHIFT, K_KP_STAR, + 0, 27, '!', '@', '#', '$', '%', '^', + '&', '*', '(', ')', '_', '+', K_BACKSPACE, 9, // 0 + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', + 'O', 'P', '{', '}', K_ENTER,K_CTRL, 'A', 'S', // 1 + 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', + '|' , '~', K_SHIFT, '\\', 'Z', 'X', 'C', 'V', // 2 + 'B', 'N', 'M', '<', '>', '?', K_SHIFT, K_KP_STAR, K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME, K_UPARROW, K_PGUP, K_KP_MINUS,K_LEFTARROW,K_KP_5, K_RIGHTARROW,K_KP_PLUS,K_END, // 4 - K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, 0, K_F11, + K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, 0, K_F11, K_F12, 0, 0, K_LWIN, K_RWIN, K_MENU, 0, 0, // 5 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6 - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 7 -}; +}; /* @@ -351,8 +351,8 @@ LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { if (!win32.cdsFullscreen ) { - xPos = (short) LOWORD(lParam); // horizontal position - yPos = (short) HIWORD(lParam); // vertical position + xPos = (short) LOWORD(lParam); // horizontal position + yPos = (short) HIWORD(lParam); // vertical position r.left = 0; r.top = 0; @@ -452,5 +452,5 @@ LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { } } - return DefWindowProc( hWnd, uMsg, wParam, lParam ); + return DefWindowProc( hWnd, uMsg, wParam, lParam ); } diff --git a/neo/tools/af/DialogAF.cpp b/neo/tools/af/DialogAF.cpp index 9f72fcac..1a43a610 100644 --- a/neo/tools/af/DialogAF.cpp +++ b/neo/tools/af/DialogAF.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"). @@ -235,7 +235,7 @@ BOOL DialogAF::OnInitDialog() { CDialog::OnInitDialog(); com_editors |= EDITOR_AF; - + // initialize list with articulated figure files InitAFList(); @@ -270,7 +270,7 @@ BOOL DialogAF::OnInitDialog() { GetDlgItem( IDC_BUTTON_AF_SAVE )->EnableWindow( false ); return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } diff --git a/neo/tools/af/DialogAF.h b/neo/tools/af/DialogAF.h index fdab96e6..cafcc799 100644 --- a/neo/tools/af/DialogAF.h +++ b/neo/tools/af/DialogAF.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/neo/tools/af/DialogAFBody.cpp b/neo/tools/af/DialogAFBody.cpp index e8000e28..ee3848e0 100644 --- a/neo/tools/af/DialogAFBody.cpp +++ b/neo/tools/af/DialogAFBody.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"). @@ -699,7 +699,7 @@ BOOL DialogAFBody::OnInitDialog() { InitNewRenameDeleteButtons(); return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } /* diff --git a/neo/tools/af/DialogAFBody.h b/neo/tools/af/DialogAFBody.h index 5b5bc3ac..8e93da9f 100644 --- a/neo/tools/af/DialogAFBody.h +++ b/neo/tools/af/DialogAFBody.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/neo/tools/af/DialogAFConstraint.cpp b/neo/tools/af/DialogAFConstraint.cpp index 88839ea2..f471d43e 100644 --- a/neo/tools/af/DialogAFConstraint.cpp +++ b/neo/tools/af/DialogAFConstraint.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"). @@ -406,7 +406,7 @@ BOOL DialogAFConstraint::OnInitDialog() { InitNewRenameDeleteButtons(); return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } /* diff --git a/neo/tools/af/DialogAFConstraint.h b/neo/tools/af/DialogAFConstraint.h index 8e0f9b5b..634d5e98 100644 --- a/neo/tools/af/DialogAFConstraint.h +++ b/neo/tools/af/DialogAFConstraint.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/neo/tools/af/DialogAFConstraintBallAndSocket.cpp b/neo/tools/af/DialogAFConstraintBallAndSocket.cpp index 5a729f77..88680cbf 100644 --- a/neo/tools/af/DialogAFConstraintBallAndSocket.cpp +++ b/neo/tools/af/DialogAFConstraintBallAndSocket.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/neo/tools/af/DialogAFConstraintBallAndSocket.h b/neo/tools/af/DialogAFConstraintBallAndSocket.h index b5b85ed8..35a9a273 100644 --- a/neo/tools/af/DialogAFConstraintBallAndSocket.h +++ b/neo/tools/af/DialogAFConstraintBallAndSocket.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/neo/tools/af/DialogAFConstraintFixed.cpp b/neo/tools/af/DialogAFConstraintFixed.cpp index 686b03e5..9ca96e83 100644 --- a/neo/tools/af/DialogAFConstraintFixed.cpp +++ b/neo/tools/af/DialogAFConstraintFixed.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/neo/tools/af/DialogAFConstraintFixed.h b/neo/tools/af/DialogAFConstraintFixed.h index caca248c..64af6f39 100644 --- a/neo/tools/af/DialogAFConstraintFixed.h +++ b/neo/tools/af/DialogAFConstraintFixed.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/neo/tools/af/DialogAFConstraintHinge.cpp b/neo/tools/af/DialogAFConstraintHinge.cpp index 1199ef0e..5bf51b01 100644 --- a/neo/tools/af/DialogAFConstraintHinge.cpp +++ b/neo/tools/af/DialogAFConstraintHinge.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/neo/tools/af/DialogAFConstraintHinge.h b/neo/tools/af/DialogAFConstraintHinge.h index eca0ade6..b98bd606 100644 --- a/neo/tools/af/DialogAFConstraintHinge.h +++ b/neo/tools/af/DialogAFConstraintHinge.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/neo/tools/af/DialogAFConstraintSlider.cpp b/neo/tools/af/DialogAFConstraintSlider.cpp index e0005a12..d726c967 100644 --- a/neo/tools/af/DialogAFConstraintSlider.cpp +++ b/neo/tools/af/DialogAFConstraintSlider.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/neo/tools/af/DialogAFConstraintSlider.h b/neo/tools/af/DialogAFConstraintSlider.h index cb9a4eff..cbbdf11a 100644 --- a/neo/tools/af/DialogAFConstraintSlider.h +++ b/neo/tools/af/DialogAFConstraintSlider.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/neo/tools/af/DialogAFConstraintSpring.cpp b/neo/tools/af/DialogAFConstraintSpring.cpp index e92d9efd..436eb790 100644 --- a/neo/tools/af/DialogAFConstraintSpring.cpp +++ b/neo/tools/af/DialogAFConstraintSpring.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/neo/tools/af/DialogAFConstraintSpring.h b/neo/tools/af/DialogAFConstraintSpring.h index b81f8551..31e48719 100644 --- a/neo/tools/af/DialogAFConstraintSpring.h +++ b/neo/tools/af/DialogAFConstraintSpring.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/neo/tools/af/DialogAFConstraintUniversal.cpp b/neo/tools/af/DialogAFConstraintUniversal.cpp index eac1c39e..933a3799 100644 --- a/neo/tools/af/DialogAFConstraintUniversal.cpp +++ b/neo/tools/af/DialogAFConstraintUniversal.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/neo/tools/af/DialogAFConstraintUniversal.h b/neo/tools/af/DialogAFConstraintUniversal.h index f2ab026e..927f6cfd 100644 --- a/neo/tools/af/DialogAFConstraintUniversal.h +++ b/neo/tools/af/DialogAFConstraintUniversal.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/neo/tools/af/DialogAFName.cpp b/neo/tools/af/DialogAFName.cpp index 5894652b..0a409a0f 100644 --- a/neo/tools/af/DialogAFName.cpp +++ b/neo/tools/af/DialogAFName.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/neo/tools/af/DialogAFName.h b/neo/tools/af/DialogAFName.h index 3ae09bc6..933262a2 100644 --- a/neo/tools/af/DialogAFName.h +++ b/neo/tools/af/DialogAFName.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/neo/tools/af/DialogAFProperties.cpp b/neo/tools/af/DialogAFProperties.cpp index a08c82f9..0b22c329 100644 --- a/neo/tools/af/DialogAFProperties.cpp +++ b/neo/tools/af/DialogAFProperties.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/neo/tools/af/DialogAFProperties.h b/neo/tools/af/DialogAFProperties.h index 858f72f4..2abf7d32 100644 --- a/neo/tools/af/DialogAFProperties.h +++ b/neo/tools/af/DialogAFProperties.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/neo/tools/af/DialogAFView.cpp b/neo/tools/af/DialogAFView.cpp index a0a5675c..97939f52 100644 --- a/neo/tools/af/DialogAFView.cpp +++ b/neo/tools/af/DialogAFView.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/neo/tools/af/DialogAFView.h b/neo/tools/af/DialogAFView.h index 83690ebc..da2f411b 100644 --- a/neo/tools/af/DialogAFView.h +++ b/neo/tools/af/DialogAFView.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/neo/tools/comafx/CDIB.cpp b/neo/tools/comafx/CDIB.cpp index 8b987dc3..d1c290cd 100644 --- a/neo/tools/comafx/CDIB.cpp +++ b/neo/tools/comafx/CDIB.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,9 +42,9 @@ If you have questions concerning this license or the applicable additional terms #define BIG_DISTANCE 10000000L #define DIST(r1,g1,b1,r2,g2,b2) \ - (long) (3L*(long)((r1)-(r2))*(long)((r1)-(r2)) + \ - 4L*(long)((g1)-(g2))*(long)((g1)-(g2)) + \ - 2L*(long)((b1)-(b2))*(long)((b1)-(b2))) + (long) (3L*(long)((r1)-(r2))*(long)((r1)-(r2)) + \ + 4L*(long)((g1)-(g2))*(long)((g1)-(g2)) + \ + 2L*(long)((b1)-(b2))*(long)((b1)-(b2))) static unsigned char masktable[] = { 0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01 }; @@ -86,7 +86,7 @@ BOOL CDIB::Create(int width,int height,int bits) // ASSERT(bits == 24 || bits == 8); BITMAPINFOHEADER bmInfo; - + memset(&bmInfo,0,sizeof(BITMAPINFOHEADER)); bmInfo.biSize = sizeof(BITMAPINFOHEADER); bmInfo.biWidth = width; @@ -291,7 +291,7 @@ void CDIB::InitDIB(COLORREF color) { int i,j; unsigned char *ptr; - + if(m_pInfo->bmiHeader.biBitCount == 24) { unsigned char col[3]; @@ -340,13 +340,13 @@ void CDIB::ExpandBlt(int nXDest,int nYDest,int xRatio,int yRatio,CDIB& dibSrc,in void CDIB::Expand(int nXDest,int nYDest,int xRatio,int yRatio,CDIB& dibSrc,int xSrc,int ySrc,int nSWidth,int nSHeight) { -int xNum,yNum,xErr,yErr; +int xNum,yNum,xErr,yErr; int nDWidth,nDHeight; - + nDWidth = nSWidth*xRatio; nDHeight = nSHeight*yRatio; - nDWidth = nXDest+nDWidth > width ? width-nXDest : nDWidth ; + nDWidth = nXDest+nDWidth > width ? width-nXDest : nDWidth ; nDHeight = nYDest+nDHeight > height ? height-nYDest : nDHeight; xNum = nDWidth/xRatio; @@ -356,7 +356,7 @@ int nDWidth,nDHeight; unsigned char *buffer,*srcPtr,*destPtr,*ptr; int i,j,k; - + buffer = (unsigned char *)malloc(nDWidth+20); if(!buffer) return; @@ -373,13 +373,13 @@ int i,j,k; for(j=0; j < yRatio ; j++,nYDest++) { destPtr = GetLinePtr(nYDest) + nXDest; - memcpy(destPtr,buffer,nDWidth); + memcpy(destPtr,buffer,nDWidth); } } for(j=0; j < yErr; j++,nYDest++) { destPtr = GetLinePtr(nYDest) + nXDest; - memcpy(destPtr,buffer,nDWidth); + memcpy(destPtr,buffer,nDWidth); } free(buffer); } @@ -387,7 +387,7 @@ int i,j,k; void CDIB::StretchBlt(int nXDest,int nYDest,int nDWidth,int nDHeight,CDIB& dibSrc,int xSrc,int ySrc,int nSWidth,int nSHeight) { SetPalette(dibSrc.m_pRGB); - nDWidth = nXDest+nDWidth > width ? width-nXDest : nDWidth ; + nDWidth = nXDest+nDWidth > width ? width-nXDest : nDWidth ; nDHeight = nYDest+nDHeight > height ? height-nYDest : nDHeight; nSWidth = xSrc+nSWidth > dibSrc.width ? dibSrc.width-xSrc : nSWidth; @@ -490,7 +490,7 @@ void CDIB::BitBlt(int nXDest,int nYDest,int nWidth,int nHeight,CDIB& dibSrc,int nHeight += nSrcY; nSrcY=0; } - nWidth = nXDest+nWidth > width ? width-nXDest : nWidth ; + nWidth = nXDest+nWidth > width ? width-nXDest : nWidth ; nHeight = nYDest+nHeight > height ? height-nYDest : nHeight; nWidth = nSrcX+nWidth > dibSrc.width ? dibSrc.width-nSrcX : nWidth; @@ -544,7 +544,7 @@ unsigned char *CDIB::GetLinePtr(int line) return ptr;*/ return m_pLinePtr[line]; } - + BOOL CDIB::CopyDIB(CDIB& dib) { if(Create(dib.m_pInfo->bmiHeader)) @@ -559,7 +559,7 @@ BOOL CDIB::CopyDIB(CDIB& dib) void CDIB::ReplaceColor(unsigned char oldColor,unsigned char newColor) { int i,j; -unsigned char *ptr; +unsigned char *ptr; for(i=0; i < height; i++) { ptr = GetLinePtr(i); @@ -630,14 +630,14 @@ RGBQUAD *pRgb; width = pHead->biWidth; height = pHead->biHeight; m_nBits = pHead->biBitCount; - if(pHead->biCompression != BI_RGB) + if(pHead->biCompression != BI_RGB) { GlobalUnlock(lpVoid); return FALSE; } if(pHead->biBitCount >= 15) { - if(pHead->biBitCount != 24) + if(pHead->biBitCount != 24) { GlobalUnlock(lpVoid); return FALSE; @@ -670,7 +670,7 @@ void CDIB::CreateGammaCurve() int i; for(i=0;i<256;++i) { - Gamma[i]=(int)(255 * powf((double)i/255,m_fGamma) + (double)0.5); + Gamma[i]=(int)(255 * powf((double)i/255,m_fGamma) + (double)0.5); } } @@ -687,7 +687,7 @@ void CDIB::GetPixel(UINT x,UINT y,int& pixel) BOOL CDIB::Make8Bit(CDIB& dib) { -int nBits; +int nBits; ASSERT(Width() == dib.Width()); ASSERT(Height() == dib.Height()); nBits = dib.GetBitCount(); @@ -775,7 +775,7 @@ unsigned char cols[16]; for(j=0 ; j < w; j++,dPtr++) { if(!(j&1)) n = (*sPtr & 0xf0)>>4; - else + else { n = *sPtr & 0x0f; sPtr++; @@ -820,7 +820,7 @@ unsigned int pSize=GetPaletteSize(); { if(CachePtr[i]) { - if(!memcmp((void *)&CacheQuad[i],(void *)pRgb,3)) + if(!memcmp((void *)&CacheQuad[i],(void *)pRgb,3)) { return i; } @@ -829,13 +829,13 @@ unsigned int pSize=GetPaletteSize(); for(i=0; i < pSize; i++,pQuad++) { d = Distance(*pRgb,*pQuad); - if(!d) + if(!d) { CacheQuad[i]=*pRgb; CachePtr[i]=1; return i; - } - if(dist > d) + } + if(dist > d) { c = i; dist = d; diff --git a/neo/tools/comafx/CDIB.h b/neo/tools/comafx/CDIB.h index 9f3baf32..113e108c 100644 --- a/neo/tools/comafx/CDIB.h +++ b/neo/tools/comafx/CDIB.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: void SetFlags(int flag) { m_nFlags = flag; } int Height() { return height ; } int Width() { return width ; } - unsigned char *GetLinePtr(int line); + unsigned char *GetLinePtr(int line); inline int GetBitCount() { return m_pInfo->bmiHeader.biBitCount; } BOOL Make8Bit( CDIB &dib ); BOOL SwitchFromOne( CDIB &dib ); @@ -103,7 +103,7 @@ protected: unsigned char * m_pBits; PBITMAPINFO m_pInfo; RGBQUAD * m_pRGB; - void * m_pVoid; + void * m_pVoid; BYTE ** m_pLinePtr; int height; int bytes; diff --git a/neo/tools/comafx/CPathTreeCtrl.cpp b/neo/tools/comafx/CPathTreeCtrl.cpp index 1000b0a2..bb862f57 100644 --- a/neo/tools/comafx/CPathTreeCtrl.cpp +++ b/neo/tools/comafx/CPathTreeCtrl.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"). @@ -271,7 +271,7 @@ BOOL CPathTreeCtrl::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult ) *pResult = 0; - // Do not process the message from built in tooltip + // Do not process the message from built in tooltip if( nID == (UINT)m_hWnd && (( pNMHDR->code == TTN_NEEDTEXTA && pTTTA->uFlags & TTF_IDISHWND ) || ( pNMHDR->code == TTN_NEEDTEXTW && pTTTW->uFlags & TTF_IDISHWND ) ) ) { diff --git a/neo/tools/comafx/CPathTreeCtrl.h b/neo/tools/comafx/CPathTreeCtrl.h index 60c164e7..6441e456 100644 --- a/neo/tools/comafx/CPathTreeCtrl.h +++ b/neo/tools/comafx/CPathTreeCtrl.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/neo/tools/comafx/CSyntaxRichEditCtrl.cpp b/neo/tools/comafx/CSyntaxRichEditCtrl.cpp index 5f664a9c..2cfcc153 100644 --- a/neo/tools/comafx/CSyntaxRichEditCtrl.cpp +++ b/neo/tools/comafx/CSyntaxRichEditCtrl.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"). @@ -514,7 +514,7 @@ CHARRANGE CSyntaxRichEditCtrl::GetVisibleRange( void ) const { firstLine = GetFirstVisibleLine(); GetClientRect( &rectArea ); lastLine = firstLine + ( rectArea.bottom / ( defaultCharFormat.yHeight / 20 ) ); - + if ( lastLine >= GetLineCount() ) { lastLine = GetLineCount() - 1; } @@ -1364,14 +1364,14 @@ CSyntaxRichEditCtrl::OnToolHitTest int CSyntaxRichEditCtrl::OnToolHitTest( CPoint point, TOOLINFO* pTI ) const { CRichEditCtrl::OnToolHitTest( point, pTI ); - pTI->hwnd = GetSafeHwnd(); - pTI->uId = (UINT_PTR)GetSafeHwnd(); + pTI->hwnd = GetSafeHwnd(); + pTI->uId = (UINT_PTR)GetSafeHwnd(); pTI->uFlags |= TTF_IDISHWND; - pTI->lpszText = LPSTR_TEXTCALLBACK; - pTI->rect = CRect( point, point ); + pTI->lpszText = LPSTR_TEXTCALLBACK; + pTI->rect = CRect( point, point ); pTI->rect.right += 100; pTI->rect.bottom += 20; - return pTI->uId; + return pTI->uId; } /* diff --git a/neo/tools/comafx/CSyntaxRichEditCtrl.h b/neo/tools/comafx/CSyntaxRichEditCtrl.h index e00d513d..274b8417 100644 --- a/neo/tools/comafx/CSyntaxRichEditCtrl.h +++ b/neo/tools/comafx/CSyntaxRichEditCtrl.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,11 +52,11 @@ If you have questions concerning this license or the applicable additional terms // no_namespace: no longer using this option, which avoids variable redifinition compile errors on Vista //#define GENERATE_TLH #ifdef GENERATE_TLH -# import "riched20.dll" raw_interfaces_only, raw_native_types, named_guids, no_auto_exclude, no_implementation, rename( "FindText", "FindShit" ) +# import "riched20.dll" raw_interfaces_only, raw_native_types, named_guids, no_auto_exclude, no_implementation, rename( "FindText", "FindShit" ) #else # include "riched20.tlh" #endif - + static const char * FONT_NAME = "Courier"; static const int FONT_HEIGHT = 10; static const int FONT_WIDTH = 8; @@ -153,7 +153,7 @@ protected: COLORREF stringColor[2]; COLORREF literalColor; COLORREF braceHighlightColor; - + typedef enum { CT_WHITESPACE, CT_COMMENT, diff --git a/neo/tools/comafx/DialogColorPicker.cpp b/neo/tools/comafx/DialogColorPicker.cpp index c66d0a4c..cbf693e5 100644 --- a/neo/tools/comafx/DialogColorPicker.cpp +++ b/neo/tools/comafx/DialogColorPicker.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,36 +40,36 @@ If you have questions concerning this license or the applicable additional terms // Old color picker -class CMyColorDialog : public CColorDialog +class CMyColorDialog : public CColorDialog { DECLARE_DYNCREATE(CMyColorDialog); - // Construction + // Construction public: - CMyColorDialog( COLORREF clrInit = 0, DWORD dwFlags = 0, CWnd *pParentWnd = NULL ); - virtual int DoModal(); + CMyColorDialog( COLORREF clrInit = 0, DWORD dwFlags = 0, CWnd *pParentWnd = NULL ); + virtual int DoModal(); protected: - enum { NCUSTCOLORS = 16 }; - static COLORREF c_CustColors[NCUSTCOLORS]; - static COLORREF c_LastCustColors[NCUSTCOLORS]; - static bool c_NeedToInitCustColors; - static void InitCustColors(); - static void SaveCustColors(); + enum { NCUSTCOLORS = 16 }; + static COLORREF c_CustColors[NCUSTCOLORS]; + static COLORREF c_LastCustColors[NCUSTCOLORS]; + static bool c_NeedToInitCustColors; + static void InitCustColors(); + static void SaveCustColors(); // Dialog Data - //{{AFX_DATA(CMyColorDialog) - //}}AFX_DATA + //{{AFX_DATA(CMyColorDialog) + //}}AFX_DATA protected: - // ClassWizard generate virtual function overrides - //{{AFX_VIRTUAL(CMyColorDialog) - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CMyColorDialog) + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL // Generated message map functions - //{{AFX_MSG(CMyColorDialog) - //}}AFX_MSG - DECLARE_MESSAGE_MAP() + //{{AFX_MSG(CMyColorDialog) + //}}AFX_MSG + DECLARE_MESSAGE_MAP() }; IMPLEMENT_DYNCREATE( CMyColorDialog, CColorDialog ) @@ -109,28 +109,28 @@ void CMyColorDialog::SaveCustColors() { } } -CMyColorDialog::CMyColorDialog( COLORREF clrInit, DWORD dwFlags, +CMyColorDialog::CMyColorDialog( COLORREF clrInit, DWORD dwFlags, CWnd* pParentWnd) : CColorDialog(clrInit,dwFlags,pParentWnd) { - //{{AFX_DATA_INIT(CMyColorDialog) - //}}AFX_DATA_INIT - if (c_NeedToInitCustColors) { - InitCustColors(); - } - m_cc.lpCustColors = c_CustColors; + //{{AFX_DATA_INIT(CMyColorDialog) + //}}AFX_DATA_INIT + if (c_NeedToInitCustColors) { + InitCustColors(); + } + m_cc.lpCustColors = c_CustColors; } int CMyColorDialog::DoModal() { - int code = CColorDialog::DoModal(); - SaveCustColors(); - return code; + int code = CColorDialog::DoModal(); + SaveCustColors(); + return code; } void CMyColorDialog::DoDataExchange(CDataExchange* pDX) { - // overridden (calls this base class) - CColorDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CMyColorDialog) - //}}AFX_DATA_MAP + // overridden (calls this base class) + CColorDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CMyColorDialog) + //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CMyColorDialog, CColorDialog) @@ -226,7 +226,7 @@ double FindC(LineDesc& l) CPoint PointOnLine(CPoint pt1,CPoint pt2,int len,int maxlen ) { double x,y,m,a,c,C,A; - double a2,c2,m2,B; + double a2,c2,m2,B; CPoint opt = pt1; CPoint pt; @@ -245,14 +245,14 @@ CPoint PointOnLine(CPoint pt1,CPoint pt2,int len,int maxlen ) A = 1.0; - + x = pt1.x; B = 2.0 * pt1.x; x *= x; C = x - a2/(m2 + 1); - + x = (B + idMath::Sqrt(B*B - (4.0*A*C)))/(2.0*A); y = m*x + c; pt = CPoint((int)x,(int)y); @@ -292,7 +292,7 @@ int Distance(CPoint pt1,CPoint pt2) x = (pt1.x - pt2.x); x *= x; - + a = (double)x + (double)y ; a = idMath::Sqrt(a); return (int)a; @@ -342,7 +342,7 @@ RGBType HSVType::toRGB() } double min,max,delta,hue; - + max = v; delta = (max * s)/255.0; min = max - delta; @@ -406,10 +406,10 @@ HSVType RGBType::toHSV() double min,max,delta,temp; - min = __min(r,__min(g,b)); + min = __min(r,__min(g,b)); max = __max(r,__max(g,b)); delta = max - min; - + hsv.v = (int)max; if(!delta) { @@ -545,11 +545,11 @@ void CDialogColorPicker::OnLButtonDown(UINT nFlags, CPoint point) { nIndex = BLUE; } } - + CDialog::OnLButtonDown(nFlags, point); } -void CDialogColorPicker::OnLButtonUp(UINT nFlags, CPoint point) +void CDialogColorPicker::OnLButtonUp(UINT nFlags, CPoint point) { if(GetCapture() == this) { @@ -559,7 +559,7 @@ void CDialogColorPicker::OnLButtonUp(UINT nFlags, CPoint point) CDialog::OnLButtonUp(nFlags, point); } -void CDialogColorPicker::OnMouseMove(UINT nFlags, CPoint point) +void CDialogColorPicker::OnMouseMove(UINT nFlags, CPoint point) { if(GetCapture() == this && m_nMouseIn) { @@ -655,7 +655,7 @@ void CDialogColorPicker::OnMouseMove(UINT nFlags, CPoint point) CDialog::OnMouseMove(nFlags, point); } -void CDialogColorPicker::OnPaint() +void CDialogColorPicker::OnPaint() { CPaintDC dc(this); // device context for painting @@ -663,10 +663,10 @@ void CDialogColorPicker::OnPaint() DrawRGB(&dc); } -BOOL CDialogColorPicker::OnInitDialog() +BOOL CDialogColorPicker::OnInitDialog() { CDialog::OnInitDialog(); - + GetDlgItem(IDC_STATIC_RGB_RECT)->GetWindowRect(&rgbRect); GetDlgItem(IDC_STATIC_HSB_RECT)->GetWindowRect(&hsbRect); ScreenToClient(&rgbRect); @@ -675,12 +675,12 @@ BOOL CDialogColorPicker::OnInitDialog() GetDlgItem(IDC_STATIC_NEWCOLOR)->GetWindowRect(&NewColorRect); ScreenToClient(&NewColorRect); - + CWindowDC dc(NULL); CSize bmSize; // Set Up HSB - + memDC.CreateCompatibleDC(&dc); LoadMappedBitmap(m_HsbBitmap,IDB_BITMAP_HSB,bmSize); @@ -736,7 +736,7 @@ BOOL CDialogColorPicker::OnInitDialog() SetTimer(0, 50, NULL); return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } void CDialogColorPicker::DrawMarkers(CDC *pDC) @@ -788,7 +788,7 @@ void CDialogColorPicker::TrackPoint(CPoint pt) CClientDC dc(this); DrawMarkers(&dc); - + hsvColor.h = (int)RAD2DEG(AngleFromPoint(pt,m_Centre)); if(hsvColor.h < 0) { @@ -869,11 +869,11 @@ void CDialogColorPicker::CalcRects() CPoint pt; pt = PtFromAngle(hsvColor.h,hsvColor.s,m_Centre); - m_CurrentRect = CRect(pt.x - RECT_WIDTH,pt.y - RECT_WIDTH,pt.x+RECT_WIDTH,pt.y + RECT_WIDTH); - + m_CurrentRect = CRect(pt.x - RECT_WIDTH,pt.y - RECT_WIDTH,pt.x+RECT_WIDTH,pt.y + RECT_WIDTH); + int y; - y = (int)(((double)hsvColor.v/255)*brightRect.Height()); + y = (int)(((double)hsvColor.v/255)*brightRect.Height()); y = brightRect.bottom - y; brightMark = CRect(brightRect.left - 2, y - 4, brightRect.right+2,y+4); } @@ -929,8 +929,8 @@ void CDialogColorPicker::DrawLines(CDC *pDC) /* Draw the following lines : - - 1 -2 + + 1 -2 2 -3 3 - 4 4- 5 @@ -950,7 +950,7 @@ void CDialogColorPicker::DrawLines(CDC *pDC) pDC->LineTo(m_Cuboid[6]); pDC->LineTo(m_Cuboid[7]); pDC->LineTo(m_Cuboid[4]); - + pDC->MoveTo(m_Cuboid[1]); pDC->LineTo(m_Cuboid[6]); @@ -1006,8 +1006,8 @@ void CDialogColorPicker::CalcSlopes() 7 = Blue Axis Draw the following lines : - - 1 -2 + + 1 -2 2 -3 3 - 4 4- 5 @@ -1040,7 +1040,7 @@ void CDialogColorPicker::CalcCuboid() l[3].x = m_Cuboid[1].x; l[3].y = m_Cuboid[1].y; l[3].c = FindC(l[3]); - + l[4].slope = lines[RED].slope; l[4].x = m_Cuboid[3].x; l[4].y = m_Cuboid[3].y; @@ -1050,7 +1050,7 @@ void CDialogColorPicker::CalcCuboid() l[5].x = m_Cuboid[3].x; l[5].y = m_Cuboid[3].y; l[5].c = FindC(l[5]); - + l[6].slope = lines[GREEN].slope; l[6].x = m_Cuboid[7].x; l[6].y = m_Cuboid[7].y; @@ -1060,7 +1060,7 @@ void CDialogColorPicker::CalcCuboid() l[10].x = m_Cuboid[1].x; l[10].y = m_Cuboid[1].y; l[10].c = FindC(l[10]); - + l[11].slope = lines[RED].slope; l[11].x = m_Cuboid[7].x; l[11].y = m_Cuboid[7].y; @@ -1074,14 +1074,14 @@ void CDialogColorPicker::CalcCuboid() l[7].x = m_Cuboid[4].x; l[7].y = m_Cuboid[4].y; l[7].c = FindC(l[7]); - + l[8].slope = lines[BLUE].slope; l[8].x = m_Cuboid[2].x; l[8].y = m_Cuboid[2].y; l[8].c = FindC(l[8]); m_Cuboid[5] = Intersection(l[7],l[8]); - + } void CDialogColorPicker::SetSpinVals() @@ -1110,7 +1110,7 @@ void CDialogColorPicker::SetEditVals() } -void CDialogColorPicker::OnChangeEditBlue() +void CDialogColorPicker::OnChangeEditBlue() { int b; @@ -1125,10 +1125,10 @@ void CDialogColorPicker::OnChangeEditBlue() } } -void CDialogColorPicker::OnChangeEditGreen() +void CDialogColorPicker::OnChangeEditGreen() { int g; - + g = GetDlgItemInt(IDC_EDIT_GREEN); if(g != color.g && m_bInitOver) { @@ -1140,7 +1140,7 @@ void CDialogColorPicker::OnChangeEditGreen() } } -void CDialogColorPicker::OnChangeEditRed() +void CDialogColorPicker::OnChangeEditRed() { int r; @@ -1155,7 +1155,7 @@ void CDialogColorPicker::OnChangeEditRed() } } -void CDialogColorPicker::OnChangeEditHue() +void CDialogColorPicker::OnChangeEditHue() { int h; @@ -1170,7 +1170,7 @@ void CDialogColorPicker::OnChangeEditHue() } } -void CDialogColorPicker::OnChangeEditSat() +void CDialogColorPicker::OnChangeEditSat() { int s; @@ -1185,7 +1185,7 @@ void CDialogColorPicker::OnChangeEditSat() } } -void CDialogColorPicker::OnChangeEditVal() +void CDialogColorPicker::OnChangeEditVal() { int v; @@ -1238,16 +1238,16 @@ void CDialogColorPicker::DrawFilledColor(CDC *pDC,CRect cr,COLORREF c) void CDialogColorPicker::LoadMappedBitmap(CBitmap& bitmap,UINT nIdResource,CSize& size) { CBitmap *pOldBitmap; - + if(bitmap.GetSafeHandle()) bitmap.DeleteObject(); - + if(bitmap.LoadBitmap(nIdResource)) { int width,height; BITMAP bmInfo; - ::GetObject(bitmap.m_hObject,sizeof(bmInfo),&bmInfo); + ::GetObject(bitmap.m_hObject,sizeof(bmInfo),&bmInfo); width = bmInfo.bmWidth; height = bmInfo.bmHeight; @@ -1255,9 +1255,9 @@ void CDialogColorPicker::LoadMappedBitmap(CBitmap& bitmap,UINT nIdResource,CSize COLORREF sourceColor = RGB(192,192,192); pOldBitmap = (CBitmap *)memDC.SelectObject(&bitmap); - + int i,j; - + for(i=0; i < height; i++) { for(j=0; j < width; j++) diff --git a/neo/tools/comafx/DialogColorPicker.h b/neo/tools/comafx/DialogColorPicker.h index 63071382..f71527a8 100644 --- a/neo/tools/comafx/DialogColorPicker.h +++ b/neo/tools/comafx/DialogColorPicker.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"). @@ -128,7 +128,7 @@ protected: void DrawMarkers(CDC *pDC); void TrackPoint(CPoint pt); void CalcRects(); - + BOOL InCircle(CPoint pt); BOOL InBright(CPoint pt); BOOL InOverBright(CPoint pt); @@ -159,7 +159,7 @@ protected: CRect brightRect; CRect overBrightRect; - HSVType hsvColor; + HSVType hsvColor; RGBType color; RGBType m_OldColor; diff --git a/neo/tools/comafx/DialogGoToLine.cpp b/neo/tools/comafx/DialogGoToLine.cpp index cdd28f93..0a999e53 100644 --- a/neo/tools/comafx/DialogGoToLine.cpp +++ b/neo/tools/comafx/DialogGoToLine.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"). @@ -81,7 +81,7 @@ DialogGoToLine::SetRange ================ */ void DialogGoToLine::SetRange( int firstLine, int lastLine ) { - this->firstLine = firstLine; + this->firstLine = firstLine; this->lastLine = lastLine; } @@ -110,7 +110,7 @@ BOOL DialogGoToLine::OnInitDialog() { numberEdit.SetFocus(); return FALSE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } diff --git a/neo/tools/comafx/DialogGoToLine.h b/neo/tools/comafx/DialogGoToLine.h index 9a815978..207e9ced 100644 --- a/neo/tools/comafx/DialogGoToLine.h +++ b/neo/tools/comafx/DialogGoToLine.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/neo/tools/comafx/DialogName.cpp b/neo/tools/comafx/DialogName.cpp index 3950d07e..bec4f377 100644 --- a/neo/tools/comafx/DialogName.cpp +++ b/neo/tools/comafx/DialogName.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"). @@ -54,14 +54,14 @@ void DialogName::DoDataExchange(CDataExchange* pDX) //}}AFX_DATA_MAP } -BOOL DialogName::OnInitDialog() +BOOL DialogName::OnInitDialog() { CDialog::OnInitDialog(); SetWindowText(m_strCaption); - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } BEGIN_MESSAGE_MAP(DialogName, CDialog) @@ -72,7 +72,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // DialogName message handlers -void DialogName::OnOK() +void DialogName::OnOK() { CDialog::OnOK(); } diff --git a/neo/tools/comafx/DialogName.h b/neo/tools/comafx/DialogName.h index d7aa976e..900162c7 100644 --- a/neo/tools/comafx/DialogName.h +++ b/neo/tools/comafx/DialogName.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/neo/tools/comafx/StdAfx.cpp b/neo/tools/comafx/StdAfx.cpp index 70edee51..5767fa21 100644 --- a/neo/tools/comafx/StdAfx.cpp +++ b/neo/tools/comafx/StdAfx.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/neo/tools/comafx/StdAfx.h b/neo/tools/comafx/StdAfx.h index 2ab2f396..6b336fa1 100644 --- a/neo/tools/comafx/StdAfx.h +++ b/neo/tools/comafx/StdAfx.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/neo/tools/comafx/VectorCtl.cpp b/neo/tools/comafx/VectorCtl.cpp index 082eba57..a582fb5e 100644 --- a/neo/tools/comafx/VectorCtl.cpp +++ b/neo/tools/comafx/VectorCtl.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"). @@ -41,27 +41,27 @@ BEGIN_MESSAGE_MAP(CVectorCtl, CButton) END_MESSAGE_MAP() CVectorCtl::CVectorCtl () : - m_bBmpCreated (FALSE), - m_bImageChange (TRUE), - m_bBackgroundBitmapUsed (FALSE), - m_clrDiffuse (DEFAULT_DIFFUSE), - m_clrAmbient (DEFAULT_AMBIENT), - m_clrLight (DEFAULT_LIGHT), - m_clrBackgroundStart (DEFAULT_START_BACKGROUND_COLOR), - m_clrBackgroundEnd (DEFAULT_END_BACKGROUND_COLOR), - m_dSpecularExponent (DEFAULT_SPEC_EXP), - m_bHasFocus (FALSE), - m_bSelected (FALSE), - m_bFrontVector (FALSE), - m_dSensitivity (20.0), - m_procVectorChanging (NULL), - m_procVectorChanged (NULL) + m_bBmpCreated (FALSE), + m_bImageChange (TRUE), + m_bBackgroundBitmapUsed (FALSE), + m_clrDiffuse (DEFAULT_DIFFUSE), + m_clrAmbient (DEFAULT_AMBIENT), + m_clrLight (DEFAULT_LIGHT), + m_clrBackgroundStart (DEFAULT_START_BACKGROUND_COLOR), + m_clrBackgroundEnd (DEFAULT_END_BACKGROUND_COLOR), + m_dSpecularExponent (DEFAULT_SPEC_EXP), + m_bHasFocus (FALSE), + m_bSelected (FALSE), + m_bFrontVector (FALSE), + m_dSensitivity (20.0), + m_procVectorChanging (NULL), + m_procVectorChanged (NULL) { - double DefaultVec[3] = DEFAULT_VEC; - for (int i=0; i<3; i++) { - m_dVec[i] = DefaultVec[i]; - pCtl[i] = NULL; - } + double DefaultVec[3] = DEFAULT_VEC; + for (int i=0; i<3; i++) { + m_dVec[i] = DefaultVec[i]; + pCtl[i] = NULL; + } rotationQuat.Set( 0.0f, 0.0f, 0.0f, 1.0f ); lastPress.Zero(); @@ -69,141 +69,141 @@ CVectorCtl::CVectorCtl () : } -CVectorCtl::~CVectorCtl () +CVectorCtl::~CVectorCtl () { - if (m_bBmpCreated) - m_dcMem.SelectObject (m_pOldBitmap); - ClearBackgroundBitmap (); + if (m_bBmpCreated) + m_dcMem.SelectObject (m_pOldBitmap); + ClearBackgroundBitmap (); } // Owner-drawn control service function: void CVectorCtl::DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct ) { - CDC *pDC = CDC::FromHandle (lpDrawItemStruct->hDC); // Get CDC to draw + CDC *pDC = CDC::FromHandle (lpDrawItemStruct->hDC); // Get CDC to draw - if (!m_bSelected && lpDrawItemStruct->itemState & ODS_SELECTED) { - // Just got re-selected (user starts a new mouse dragging session) - } else if (m_bSelected && // Last state was selected - !(lpDrawItemStruct->itemState & ODS_SELECTED) && // New state is NOT selected - (lpDrawItemStruct->itemState & ODS_FOCUS) && // New state is still in focus - m_procVectorChanged) // User asked for a callback - // User has left the track-ball and asked for a callback. - m_procVectorChanged ( rotationQuat ); - - m_bHasFocus = lpDrawItemStruct->itemState & ODS_FOCUS; // Update focus status - m_bSelected = lpDrawItemStruct->itemState & ODS_SELECTED; // Update selection status + if (!m_bSelected && lpDrawItemStruct->itemState & ODS_SELECTED) { + // Just got re-selected (user starts a new mouse dragging session) + } else if (m_bSelected && // Last state was selected + !(lpDrawItemStruct->itemState & ODS_SELECTED) && // New state is NOT selected + (lpDrawItemStruct->itemState & ODS_FOCUS) && // New state is still in focus + m_procVectorChanged) // User asked for a callback + // User has left the track-ball and asked for a callback. + m_procVectorChanged ( rotationQuat ); - if (!m_bBmpCreated) // 1st time - InitBitmap (lpDrawItemStruct, pDC); - if (m_bImageChange) { // Image has changes - recalc it! - if (m_procVectorChanging) // User has specified a callback - m_procVectorChanging ( rotationQuat ); // Call it! - BuildImage (lpDrawItemStruct); - m_bImageChange = FALSE; - } - pDC->BitBlt (0,0,m_iWidth, m_iHeight, &m_dcMem, 0, 0, SRCCOPY); // Update screen + m_bHasFocus = lpDrawItemStruct->itemState & ODS_FOCUS; // Update focus status + m_bSelected = lpDrawItemStruct->itemState & ODS_SELECTED; // Update selection status + + if (!m_bBmpCreated) // 1st time + InitBitmap (lpDrawItemStruct, pDC); + if (m_bImageChange) { // Image has changes - recalc it! + if (m_procVectorChanging) // User has specified a callback + m_procVectorChanging ( rotationQuat ); // Call it! + BuildImage (lpDrawItemStruct); + m_bImageChange = FALSE; + } + pDC->BitBlt (0,0,m_iWidth, m_iHeight, &m_dcMem, 0, 0, SRCCOPY); // Update screen } -// Mouse was dragged +// Mouse was dragged void CVectorCtl::OnMouseDrag (int ixMove, int iyMove) { - RotateByXandY (double(-iyMove) / m_dSensitivity, - double(ixMove) / m_dSensitivity); + RotateByXandY (double(-iyMove) / m_dSensitivity, + double(ixMove) / m_dSensitivity); } // Recalc ball image void CVectorCtl::BuildImage (LPDRAWITEMSTRUCT lpDrawItemStruct) { - int xf, yf; + int xf, yf; - for (int x=0; x EPS) { - Norm = sqrt (Norm); - m_dVec[0] /= Norm; - m_dVec[1] /= Norm; - m_dVec[2] /= Norm; - return TRUE; - } else { // Reset to defualt vector - double DefaultVec[3] = DEFAULT_VEC; - for (int i=0; i<3; i++) - m_dVec[i] = DefaultVec[i]; - return FALSE; - } + if (Norm > EPS) { + Norm = sqrt (Norm); + m_dVec[0] /= Norm; + m_dVec[1] /= Norm; + m_dVec[2] /= Norm; + return TRUE; + } else { // Reset to defualt vector + double DefaultVec[3] = DEFAULT_VEC; + for (int i=0; i<3; i++) + m_dVec[i] = DefaultVec[i]; + return FALSE; + } } // Calculate lightning effect for specific pixel on ball's surface COLORREF CVectorCtl::CalcLight (double dx, double dy, double dz) { - double NL = dx * m_dVec[0] + dy * m_dVec[1] + dz * m_dVec[2], - RV = 2.0 * NL, - rx = m_dVec[0] - (dx * RV), - ry = m_dVec[1] - (dy * RV), - rz = m_dVec[2] - (dz * RV); + double NL = dx * m_dVec[0] + dy * m_dVec[1] + dz * m_dVec[2], + RV = 2.0 * NL, + rx = m_dVec[0] - (dx * RV), + ry = m_dVec[1] - (dy * RV), + rz = m_dVec[2] - (dz * RV); - if (NL < 0.0) // Diffuse coefficient - NL = 0.0; + if (NL < 0.0) // Diffuse coefficient + NL = 0.0; - RV = max (0.0, -rz); - RV = double(pow (RV, m_dSpecularExponent)); + RV = max (0.0, -rz); + RV = double(pow (RV, m_dSpecularExponent)); - int r = int ( double(GetRValue(m_clrDiffuse)) * NL + // Diffuse - double(GetRValue(m_clrLight)) * RV + // Specular - double(GetRValue(m_clrAmbient))), // Ambient + int r = int ( double(GetRValue(m_clrDiffuse)) * NL + // Diffuse + double(GetRValue(m_clrLight)) * RV + // Specular + double(GetRValue(m_clrAmbient))), // Ambient - g = int ( double(GetGValue(m_clrDiffuse)) * NL + // Diffuse - double(GetGValue(m_clrLight)) * RV + // Specular - double(GetGValue(m_clrAmbient))), // Ambient + g = int ( double(GetGValue(m_clrDiffuse)) * NL + // Diffuse + double(GetGValue(m_clrLight)) * RV + // Specular + double(GetGValue(m_clrAmbient))), // Ambient - b = int ( double(GetBValue(m_clrDiffuse)) * NL + // Diffuse - double(GetBValue(m_clrLight)) * RV + // Specular - double(GetBValue(m_clrAmbient))); // Ambient + b = int ( double(GetBValue(m_clrDiffuse)) * NL + // Diffuse + double(GetBValue(m_clrLight)) * RV + // Specular + double(GetBValue(m_clrAmbient))); // Ambient - r = min (255, r); // Cutoff highlight - g = min (255, g); - b = min (255, b); - return RGB(BYTE(r),BYTE(g),BYTE(b)); + r = min (255, r); // Cutoff highlight + g = min (255, g); + b = min (255, b); + return RGB(BYTE(r),BYTE(g),BYTE(b)); } // Start memory buffer bitmap and measure it void CVectorCtl::InitBitmap (LPDRAWITEMSTRUCT lpDrawItemStruct, CDC *pDC) { - m_iWidth = lpDrawItemStruct->rcItem.right - lpDrawItemStruct->rcItem.left; - m_iHeight = lpDrawItemStruct->rcItem.bottom - lpDrawItemStruct->rcItem.top; - m_bmpBuffer.CreateCompatibleBitmap (pDC, m_iWidth, m_iHeight); - m_bBmpCreated = TRUE; - m_dcMem.CreateCompatibleDC (pDC); - m_pOldBitmap = m_dcMem.SelectObject (&m_bmpBuffer); - SetRadius (max (min (m_iWidth, m_iHeight) - 2, 0) / 2); - SetCenter (m_iWidth / 2, m_iHeight / 2); - CreateBackground (); + m_iWidth = lpDrawItemStruct->rcItem.right - lpDrawItemStruct->rcItem.left; + m_iHeight = lpDrawItemStruct->rcItem.bottom - lpDrawItemStruct->rcItem.top; + m_bmpBuffer.CreateCompatibleBitmap (pDC, m_iWidth, m_iHeight); + m_bBmpCreated = TRUE; + m_dcMem.CreateCompatibleDC (pDC); + m_pOldBitmap = m_dcMem.SelectObject (&m_bmpBuffer); + SetRadius (max (min (m_iWidth, m_iHeight) - 2, 0) / 2); + SetCenter (m_iWidth / 2, m_iHeight / 2); + CreateBackground (); } // Set new specular intensity BOOL CVectorCtl::SetSpecularExponent (double dExp) { - if (dExp < 1.0 || dExp > 200.0) - return FALSE; - m_dSpecularExponent = dExp; - Redraw (); - return TRUE; + if (dExp < 1.0 || dExp > 200.0) + return FALSE; + m_dSpecularExponent = dExp; + Redraw (); + return TRUE; } // Rotate our vector around the X and Y axis @@ -214,165 +214,165 @@ void CVectorCtl::RotateByXandY (double XRot, double YRot) return; } - double cx = cos(XRot), - sx = sin(XRot), - cy = cos(YRot), - sy = sin(YRot), - dx = m_dVec[0] * cy + m_dVec[1] * sx * sy + m_dVec[2] * cx * sy, - dy = m_dVec[1] * cx - m_dVec[2] * sx, - dz = -m_dVec[0] * sy + m_dVec[1] * sx * cy + m_dVec[2] * cx * cy; + double cx = cos(XRot), + sx = sin(XRot), + cy = cos(YRot), + sy = sin(YRot), + dx = m_dVec[0] * cy + m_dVec[1] * sx * sy + m_dVec[2] * cx * sy, + dy = m_dVec[1] * cx - m_dVec[2] * sx, + dz = -m_dVec[0] * sy + m_dVec[1] * sx * cy + m_dVec[2] * cx * cy; - if (!m_bFrontVector || dz >= 0.0) { // Vector is bounds free - m_dVec[0] = dx; - m_dVec[1] = dy; - m_dVec[2] = dz; - } else { // Otherwise, do not allow Z to be negative (light shines from behind) - m_dVec[2] = 0.0; - m_dVec[0] = dx; - m_dVec[1] = dy; - Normalize (); - } - Redraw (); + if (!m_bFrontVector || dz >= 0.0) { // Vector is bounds free + m_dVec[0] = dx; + m_dVec[1] = dy; + m_dVec[2] = dz; + } else { // Otherwise, do not allow Z to be negative (light shines from behind) + m_dVec[2] = 0.0; + m_dVec[0] = dx; + m_dVec[1] = dy; + Normalize (); + } + Redraw (); } - + void CVectorCtl::UpdateAxisControls () { - CString cs; - for (int i=0; i<3; i++) - if (pCtl[i]) { - cs.Format ("%+1.5f",m_dVec[i]); - pCtl[i]->SetWindowText (cs); - } -} + CString cs; + for (int i=0; i<3; i++) + if (pCtl[i]) { + cs.Format ("%+1.5f",m_dVec[i]); + pCtl[i]->SetWindowText (cs); + } +} void CVectorCtl::SetAxisControl (int nXCtl, int nYCtl, int nZCtl) { - pCtl[0] = GetParent()->GetDlgItem(nXCtl); - pCtl[1] = GetParent()->GetDlgItem(nYCtl); - pCtl[2] = GetParent()->GetDlgItem(nZCtl); + pCtl[0] = GetParent()->GetDlgItem(nXCtl); + pCtl[1] = GetParent()->GetDlgItem(nYCtl); + pCtl[2] = GetParent()->GetDlgItem(nZCtl); } void CVectorCtl::SetRadius (UINT uRadius) { - m_iRadius = uRadius; - m_iSqrRadius = m_iRadius * m_iRadius; - CreateBackground (); - Redraw (TRUE); + m_iRadius = uRadius; + m_iSqrRadius = m_iRadius * m_iRadius; + CreateBackground (); + Redraw (TRUE); } void CVectorCtl::SetCenter (UINT uHorizPos, UINT uVertPos) { - m_iXCenter = uHorizPos; - m_iYCenter = uVertPos; - CreateBackground (); - Redraw (TRUE); + m_iXCenter = uHorizPos; + m_iYCenter = uVertPos; + CreateBackground (); + Redraw (TRUE); } void CVectorCtl::SetAxis (double d, int nAxis) { - if (fabs(d)>=1.0) { - m_dVec[nAxis]=d > 1.0 ? 1.0 : -1.0; - m_dVec[(nAxis+1) %3]=m_dVec[(nAxis+2) %3]=0.0; - Redraw (); - return; - } - m_dVec[nAxis] = d; - Normalize (); - Redraw (); + if (fabs(d)>=1.0) { + m_dVec[nAxis]=d > 1.0 ? 1.0 : -1.0; + m_dVec[(nAxis+1) %3]=m_dVec[(nAxis+2) %3]=0.0; + Redraw (); + return; + } + m_dVec[nAxis] = d; + Normalize (); + Redraw (); } void CVectorCtl::SetVector (double dx, double dy, double dz) { - m_dVec[0] = dx; - m_dVec[1] = dy; - m_dVec[2] = dz; - Normalize (); - Redraw (); + m_dVec[0] = dx; + m_dVec[1] = dy; + m_dVec[2] = dz; + Normalize (); + Redraw (); } void CVectorCtl::SetBackgroundColor (COLORREF clrStart, COLORREF clrEnd) { - ClearBackgroundBitmap (); - m_clrBackgroundStart = clrStart; - m_clrBackgroundEnd = clrEnd; - CreateBackground (); + ClearBackgroundBitmap (); + m_clrBackgroundStart = clrStart; + m_clrBackgroundEnd = clrEnd; + CreateBackground (); } BOOL CVectorCtl::SetBackgroundImage (UINT uBackgroundBitmapID) { - if (m_bBackgroundBitmapUsed) { - ClearBackgroundBitmap (); - CreateBackground (); - } - if (!m_bmpBack.LoadBitmap (uBackgroundBitmapID)) - return FALSE; - m_bBackgroundBitmapUsed = TRUE; - CreateBackground (); - return TRUE; + if (m_bBackgroundBitmapUsed) { + ClearBackgroundBitmap (); + CreateBackground (); + } + if (!m_bmpBack.LoadBitmap (uBackgroundBitmapID)) + return FALSE; + m_bBackgroundBitmapUsed = TRUE; + CreateBackground (); + return TRUE; } void CVectorCtl::CreateBackground () { - if (!m_bBmpCreated) - return; // No image yet - if (!m_bBackgroundBitmapUsed) { // No background used - fill with gradient color - double r = GetRValue (m_clrBackgroundStart), - g = GetGValue (m_clrBackgroundStart), - b = GetBValue (m_clrBackgroundStart), - rd = double (GetRValue (m_clrBackgroundEnd) - r) / double (m_iHeight), - gd = double (GetGValue (m_clrBackgroundEnd) - g) / double (m_iHeight), - bd = double (GetBValue (m_clrBackgroundEnd) - b) / double (m_iHeight); - for (int j=0; jtop; ptsArrow[2].x = pRect->right; ptsArrow[2].y = pRect->bottom; - + HBRUSH arrowBrush = CreateSolidBrush ( color ); HPEN arrowPen = CreatePen ( PS_SOLID, 1, color ); - + HGDIOBJ oldBrush = SelectObject ( hDC, arrowBrush ); HGDIOBJ oldPen = SelectObject ( hDC, arrowPen ); - + SetPolyFillMode(hDC, WINDING); Polygon(hDC, ptsArrow, 3); - + SelectObject ( hDC, oldBrush ); SelectObject ( hDC, oldPen ); - + DeleteObject ( arrowBrush ); DeleteObject ( arrowPen ); } @@ -86,25 +86,25 @@ LRESULT CALLBACK AlphaSlider_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARA { RECT rClient; float v; - + GetClientRect ( hwnd, &rClient ); v = (float)((short)LOWORD(lParam)-5) / (float)(rClient.right - rClient.left - 10); if ( v < 0 ) v = 0; if ( v > 1.0f ) v = 1.0f; SetWindowLong ( hwnd, GWL_USERDATA, MAKELONG(0x8000,(unsigned short)(255.0f * v)) ); InvalidateRect ( hwnd, NULL, FALSE ); - + SetCapture ( hwnd ); - + break; } - - case WM_MOUSEMOVE: + + case WM_MOUSEMOVE: if ( LOWORD(GetWindowLong ( hwnd, GWL_USERDATA ) ) & 0x8000 ) { RECT rClient; float v; - + GetClientRect ( hwnd, &rClient ); v = (float)((short)LOWORD(lParam)-5) / (float)(rClient.right - rClient.left - 10); if ( v < 0 ) v = 0; @@ -114,12 +114,12 @@ LRESULT CALLBACK AlphaSlider_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARA } break; - case WM_LBUTTONUP: + case WM_LBUTTONUP: if ( LOWORD(GetWindowLong ( hwnd, GWL_USERDATA ) ) & 0x8000 ) { RECT rClient; float v; - + GetClientRect ( hwnd, &rClient ); v = (float)((short)LOWORD(lParam)-5) / (float)(rClient.right - rClient.left - 10); if ( v < 0 ) v = 0; @@ -130,7 +130,7 @@ LRESULT CALLBACK AlphaSlider_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARA SendMessage ( GetParent ( hwnd ), WM_COMMAND, MAKELONG(GetWindowLong (hwnd,GWL_ID),0), 0 ); } break; - + case WM_PAINT: { PAINTSTRUCT ps; @@ -144,24 +144,24 @@ LRESULT CALLBACK AlphaSlider_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARA CopyRect ( &rDraw, &rClient ); rDraw.left += 5; rDraw.right -= 5; - rDraw.bottom -= 6; + rDraw.bottom -= 6; // Draw the gradient int parts = 20; RECT rColor; float step = (float)(rDraw.right-rDraw.left) / (float)parts; - CopyRect ( &rColor, &rDraw ); + CopyRect ( &rColor, &rDraw ); for ( int i = 0; i < parts; i ++ ) { float color = ((float)i / (float)parts) * 255.0f; - + rColor.left = rDraw.left + i * step; rColor.right = rColor.left + step + 1; - + HBRUSH brush = CreateSolidBrush ( RGB((int)color,(int)color,(int)color) ); FillRect ( hDC, &rColor, brush ); DeleteObject ( brush ); - } + } // Draw a frame around the gradient FrameRect (hDC, &rDraw, (HBRUSH)GetStockObject ( BLACK_BRUSH ) ); @@ -186,7 +186,7 @@ LRESULT CALLBACK AlphaSlider_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARA return 0; } } - + return DefWindowProc ( hwnd, msg, wParam, lParam ); } @@ -203,24 +203,24 @@ LRESULT FAR PASCAL AlphaSelectDlg_GetMsgProc(int nCode, WPARAM wParam, LPARAM lP if ( nCode >= 0 && PM_REMOVE == wParam ) { - // Don't translate non-input events. - if ( (lpMsg->message >= WM_KEYFIRST && lpMsg->message <= WM_KEYLAST) ) - { - if ( IsDialogMessage( gAlphaDlg, lpMsg) ) - { - // The value returned from this hookproc is ignored, - // and it cannot be used to tell Windows the message has been handled. - // To avoid further processing, convert the message to WM_NULL - // before returning. - lpMsg->message = WM_NULL; - lpMsg->lParam = 0; - lpMsg->wParam = 0; - } - } + // Don't translate non-input events. + if ( (lpMsg->message >= WM_KEYFIRST && lpMsg->message <= WM_KEYLAST) ) + { + if ( IsDialogMessage( gAlphaDlg, lpMsg) ) + { + // The value returned from this hookproc is ignored, + // and it cannot be used to tell Windows the message has been handled. + // To avoid further processing, convert the message to WM_NULL + // before returning. + lpMsg->message = WM_NULL; + lpMsg->lParam = 0; + lpMsg->wParam = 0; + } + } } return CallNextHookEx(gAlphaHook, nCode, wParam, lParam); -} +} /* ================ @@ -234,21 +234,21 @@ INT_PTR CALLBACK AlphaSelectDlg_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LP switch ( msg ) { case WM_INITDIALOG: - { + { int color; - + gAlphaDlg = hwnd; gAlphaHook = SetWindowsHookEx( WH_GETMESSAGE, AlphaSelectDlg_GetMsgProc, NULL, GetCurrentThreadId() ); color = GetRValue(ColorButton_GetColor ((HWND)lParam)); // The lParam for the alpha select dialog is the window handle of the button pressed SetWindowLong ( hwnd, GWL_USERDATA, lParam ); - - // Subclass the alpha + + // Subclass the alpha SetWindowLong ( GetDlgItem ( hwnd, IDC_GUIED_ALPHASLIDER ), GWL_USERDATA, MAKELONG(0,color) ); // Numbers only on the edit box and start it with the current alpha value. - NumberEdit_Attach ( GetDlgItem ( hwnd, IDC_GUIED_ALPHA ) ); + NumberEdit_Attach ( GetDlgItem ( hwnd, IDC_GUIED_ALPHA ) ); SetWindowText ( GetDlgItem ( hwnd, IDC_GUIED_ALPHA ), va("%.3f", ((float)color / 255.0f) ) ); break; } @@ -257,8 +257,8 @@ INT_PTR CALLBACK AlphaSelectDlg_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LP UnhookWindowsHookEx( gAlphaHook ); ReleaseCapture ( ); gAlphaDlg = NULL; - break; - + break; + case WM_ACTIVATE: if ( !LOWORD(wParam) ) { @@ -273,12 +273,12 @@ INT_PTR CALLBACK AlphaSelectDlg_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LP { char temp[64]; float value; - + // Get the current text in the window and convert it to a float GetDlgItemText ( hwnd, IDC_GUIED_ALPHA, temp, 64 ); value = atof ( temp ); - - if ( value < 0.0f ) + + if ( value < 0.0f ) { value = 0.0f; } @@ -291,7 +291,7 @@ INT_PTR CALLBACK AlphaSelectDlg_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LP SetWindowLong ( GetDlgItem ( hwnd, IDC_GUIED_ALPHASLIDER ), GWL_USERDATA, MAKELONG(0,(255.0f * value)) ); break; } - + case IDC_GUIED_ALPHASLIDER: case IDOK: { @@ -300,12 +300,12 @@ INT_PTR CALLBACK AlphaSelectDlg_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LP EndDialog ( hwnd, 0 ); break; } - + case IDCANCEL: EndDialog ( hwnd, 0 ); break; } - break; + break; } return FALSE; @@ -321,15 +321,15 @@ Opens the popup window under the alpha button void AlphaButton_OpenPopup ( HWND button ) { RECT rWindow; - WNDCLASSEX wndClass; + WNDCLASSEX wndClass; HWND dlg; - + // Make sure the alpha slider window class is registered memset ( &wndClass, 0, sizeof(wndClass) ); wndClass.cbSize = sizeof(WNDCLASSEX); - wndClass.lpszClassName = "GUIED_ALPHASLIDER"; + wndClass.lpszClassName = "GUIED_ALPHASLIDER"; wndClass.lpfnWndProc = AlphaSlider_WndProc; - wndClass.hInstance = win32.hInstance; + wndClass.hInstance = win32.hInstance; RegisterClassEx ( &wndClass ); GetWindowRect ( button, &rWindow ); diff --git a/neo/tools/common/ColorButton.cpp b/neo/tools/common/ColorButton.cpp index b7a4c00e..20d2f6cf 100644 --- a/neo/tools/common/ColorButton.cpp +++ b/neo/tools/common/ColorButton.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,9 +62,9 @@ void ColorButton_SetColor ( HWND hWnd, const char* color ) { return; } - + sscanf ( color, "%f,%f,%f,%f", &red, &green, &blue, &alpha ); - + ColorButton_SetColor ( hWnd, RGB(red*255.0f, green*255.0f, blue*255.0f) ); } @@ -79,9 +79,9 @@ void AlphaButton_SetColor ( HWND hWnd, const char* color ) { return; } - + sscanf ( color, "%f,%f,%f,%f", &red, &green, &blue, &alpha ); - + ColorButton_SetColor ( hWnd, RGB(alpha*255.0f, alpha*255.0f, alpha*255.0f) ); } @@ -114,19 +114,19 @@ static void ColorButton_DrawArrow ( HDC hDC, RECT* pRect, COLORREF color ) ptsArrow[1].y = pRect->top; ptsArrow[2].x = (pRect->left + pRect->right)/2; ptsArrow[2].y = pRect->bottom; - + HBRUSH arrowBrush = CreateSolidBrush ( color ); HPEN arrowPen = CreatePen ( PS_SOLID, 1, color ); - + HGDIOBJ oldBrush = SelectObject ( hDC, arrowBrush ); HGDIOBJ oldPen = SelectObject ( hDC, arrowPen ); - + SetPolyFillMode(hDC, WINDING); Polygon(hDC, ptsArrow, 3); - + SelectObject ( hDC, oldBrush ); SelectObject ( hDC, oldPen ); - + DeleteObject ( arrowBrush ); DeleteObject ( arrowPen ); } @@ -144,7 +144,7 @@ void ColorButton_DrawItem ( HWND hWnd, LPDRAWITEMSTRUCT dis ) HDC hDC = dis->hDC; UINT state = dis->itemState; - RECT rDraw = dis->rcItem; + RECT rDraw = dis->rcItem; RECT rArrow; // Draw outter edge @@ -159,7 +159,7 @@ void ColorButton_DrawItem ( HWND hWnd, LPDRAWITEMSTRUCT dis ) { uFrameState |= DFCS_INACTIVE; } - + DrawFrameControl ( hDC, &rDraw, DFC_BUTTON, uFrameState ); // Draw Focus @@ -168,15 +168,15 @@ void ColorButton_DrawItem ( HWND hWnd, LPDRAWITEMSTRUCT dis ) OffsetRect(&rDraw, 1,1); } - if (state & ODS_FOCUS) - { + if (state & ODS_FOCUS) + { RECT rFocus = {rDraw.left, rDraw.top, rDraw.right - 1, rDraw.bottom}; - - DrawFocusRect ( hDC, &rFocus ); - } + + DrawFocusRect ( hDC, &rFocus ); + } InflateRect ( &rDraw, -GetSystemMetrics(SM_CXEDGE), -GetSystemMetrics(SM_CYEDGE) ); @@ -195,7 +195,7 @@ void ColorButton_DrawItem ( HWND hWnd, LPDRAWITEMSTRUCT dis ) rDraw.right -= (GetSystemMetrics(SM_CXEDGE) * 2) + 1 ; - // Draw Color + // Draw Color if ((state & ODS_DISABLED) == 0) { HBRUSH color = CreateSolidBrush ( (COLORREF)GetWindowLong ( hWnd, GWL_USERDATA ) ); diff --git a/neo/tools/common/ColorButton.h b/neo/tools/common/ColorButton.h index a17ec0a0..775a5e1d 100644 --- a/neo/tools/common/ColorButton.h +++ b/neo/tools/common/ColorButton.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/neo/tools/common/DialogHelpers.h b/neo/tools/common/DialogHelpers.h index b04c1854..3ca22535 100644 --- a/neo/tools/common/DialogHelpers.h +++ b/neo/tools/common/DialogHelpers.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"). @@ -35,69 +35,69 @@ public: HWND mWindow; int mID; - + rvDialogItem ( int id ) { mID = id; } - + void Cache ( HWND parent ) { mWindow = GetDlgItem ( parent, mID ); } - + void Check ( bool checked ) { SendMessage ( mWindow, BM_SETCHECK, checked ? BST_CHECKED : BST_UNCHECKED, 0 ); } - + void Enable ( bool enable ) { EnableWindow ( mWindow, enable ); } - + bool IsChecked ( void ) { return SendMessage ( mWindow, BM_GETCHECK, 0, 0 ) == BST_CHECKED ? true : false; } - + void SetText ( const char* text ) { SetWindowText ( mWindow, text ); } - + void GetText ( idStr& out ) { char text[4096]; GetWindowText ( mWindow, text, 4095 ); out = text; } - + float GetFloat ( void ) { idStr text; GetText ( text ); return atof( text ); } - + void SetFloat ( float f ) { SetText ( va("%g", f ) ); } - + operator HWND( void ) const { return mWindow; } }; class rvDialogItemContainer { protected: - + void Cache ( HWND parent, int count ) { int i; unsigned char* ptr; - + ptr = (unsigned char*)this; for ( i = 0; i < count; i ++, ptr += sizeof(rvDialogItem) ) { - ((rvDialogItem*)ptr)->Cache ( parent ); + ((rvDialogItem*)ptr)->Cache ( parent ); } } }; @@ -119,7 +119,7 @@ class c##name : public rvDialogItem \ { \ public: \ c##name(int localid=id) : rvDialogItem ( localid ) { } \ -} name; +} name; #define DIALOGITEM_END() \ }; diff --git a/neo/tools/common/MaskEdit.cpp b/neo/tools/common/MaskEdit.cpp index 791927c7..fb5641c4 100644 --- a/neo/tools/common/MaskEdit.cpp +++ b/neo/tools/common/MaskEdit.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,9 +55,9 @@ LRESULT CALLBACK MaskEdit_WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LPARAM l { return 0; } - + break; - + case WM_DESTROY: delete edit; SetWindowLong ( hWnd, GWL_WNDPROC, (LONG)wndproc ); diff --git a/neo/tools/common/MaskEdit.h b/neo/tools/common/MaskEdit.h index 5a491a55..11a3355c 100644 --- a/neo/tools/common/MaskEdit.h +++ b/neo/tools/common/MaskEdit.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/neo/tools/common/OpenFileDialog.cpp b/neo/tools/common/OpenFileDialog.cpp index 5561f2a0..2d1c6286 100644 --- a/neo/tools/common/OpenFileDialog.cpp +++ b/neo/tools/common/OpenFileDialog.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"). @@ -106,7 +106,7 @@ void rvOpenFileDialog::UpdateLookIn ( void ) // Reset the combo box SendMessage ( mWndLookin, CB_RESETCONTENT, 0, 0 ); - + // Setup the common item structure components ZeroMemory ( &item, sizeof(item) ); item.mask = CBEIF_TEXT | CBEIF_INDENT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE; @@ -122,7 +122,7 @@ void rvOpenFileDialog::UpdateLookIn ( void ) while ( path.Length ( ) ) { int slash = path.Find ( "/" ); - + // Parse out the next subfolder if ( slash != -1 ) { @@ -135,13 +135,13 @@ void rvOpenFileDialog::UpdateLookIn ( void ) path.Empty ( ); } - // Add the sub folder + // Add the sub folder item.pszText = (LPSTR)file.c_str(); item.iIndent++; item.iItem = item.iIndent; - SendMessage ( mWndLookin, CBEM_INSERTITEM, 0, (LPARAM)&item ); + SendMessage ( mWndLookin, CBEM_INSERTITEM, 0, (LPARAM)&item ); } - + // Set the selection to the last one since thats the deepest folder SendMessage ( mWndLookin, CB_SETCURSEL, item.iIndent, 0 ); } @@ -161,9 +161,9 @@ void rvOpenFileDialog::UpdateFileList ( void ) HWND list = GetDlgItem ( mWnd, IDC_TOOLS_FILELIST ); int i; int filter; - + ListView_DeleteAllItems ( list ); - + // Add all the folders first files = fileSystem->ListFiles ( basepath, "/", true ); for ( i = 0; i < files->GetNumFiles(); i ++ ) @@ -172,7 +172,7 @@ void rvOpenFileDialog::UpdateFileList ( void ) { continue; } - + LVITEM item; item.mask = LVIF_TEXT; item.iItem = ListView_GetItemCount ( list ); @@ -181,11 +181,11 @@ void rvOpenFileDialog::UpdateFileList ( void ) ListView_InsertItem ( list, &item ); } fileSystem->FreeFileList( files ); - + // Add all the files in the current lookin directory that match the // current filters. for ( filter = 0; filter < mFilters.Num(); filter ++ ) - { + { files = fileSystem->ListFiles( basepath, mFilters[filter], true ); for ( i = 0; i < files->GetNumFiles(); i ++ ) { @@ -193,7 +193,7 @@ void rvOpenFileDialog::UpdateFileList ( void ) { continue; } - + LVITEM item; item.mask = LVIF_TEXT|LVIF_IMAGE; item.iImage = 2; @@ -228,7 +228,7 @@ void rvOpenFileDialog::HandleCommandOK ( void ) { return; } - + item.iImage = 2; } else @@ -242,7 +242,7 @@ void rvOpenFileDialog::HandleCommandOK ( void ) item.iItem = sel; ListView_GetItem ( mWndFileList, &item ); } - + // If the item is a folder then just open that folder if ( item.iImage == 0 ) { @@ -253,7 +253,7 @@ void rvOpenFileDialog::HandleCommandOK ( void ) idStr::Copynz( mLookin, temp, sizeof( mLookin ) ); } UpdateLookIn ( ); - UpdateFileList ( ); + UpdateFileList ( ); } // If the item is a file then build the filename and end the dialog else if ( item.iImage == 2 ) @@ -264,11 +264,11 @@ void rvOpenFileDialog::HandleCommandOK ( void ) mFilename.Append ( "/" ); } mFilename.Append ( temp ); - + // Make sure the file exists if ( mFlags & OFD_MUSTEXIST ) { - idFile* file; + idFile* file; file = fileSystem->OpenFileRead ( mFilename ); if ( !file ) { @@ -277,10 +277,10 @@ void rvOpenFileDialog::HandleCommandOK ( void ) } fileSystem->CloseFile ( file ); } - + EndDialog ( mWnd, 1 ); - } - + } + return; } @@ -301,16 +301,16 @@ void rvOpenFileDialog::HandleInitDialog ( void ) mImageList = ImageList_LoadBitmap ( mInstance, MAKEINTRESOURCE(IDB_TOOLS_OPEN),16,1,RGB(255,255,255) ); mBackBitmap = (HBITMAP)LoadImage ( mInstance, MAKEINTRESOURCE(IDB_TOOLS_BACK), IMAGE_BITMAP, 16, 16, LR_DEFAULTCOLOR|LR_LOADMAP3DCOLORS ); - // Attach the image list to the file list and lookin controls + // Attach the image list to the file list and lookin controls ListView_SetImageList ( mWndFileList, mImageList, LVSIL_SMALL ); SendMessage( mWndLookin,CBEM_SETIMAGELIST,0,(LPARAM) mImageList ); - + // Back button is a bitmap button SendMessage( GetDlgItem ( mWnd, IDC_TOOLS_BACK ), BM_SETIMAGE, IMAGE_BITMAP, (LONG) mBackBitmap ); - + // Allow custom titles SetWindowText ( mWnd, mTitle ); - + // Custom ok button title if ( mOKTitle.Length ( ) ) { @@ -344,14 +344,14 @@ Handles a selection change within the lookin control void rvOpenFileDialog::HandleLookInChange ( void ) { char temp[256]; - int sel; + int sel; int i; idStr lookin; - + temp[0] = 0; - + sel = SendMessage ( mWndLookin, CB_GETCURSEL, 0, 0 ); - + // If something other than base is selected then walk up the list // and build the new lookin path if ( sel >= 1 ) @@ -362,16 +362,16 @@ void rvOpenFileDialog::HandleLookInChange ( void ) { SendMessage ( mWndLookin, CB_GETLBTEXT, i, (LPARAM)temp ); idStr::snPrintf( mLookin, sizeof( mLookin ), "%s/%s", mLookin, temp ); - } + } } else { mLookin[0] = 0; - } + } // Update the controls with the new lookin path - UpdateLookIn ( ); - UpdateFileList ( ); + UpdateLookIn ( ); + UpdateFileList ( ); } /* @@ -385,7 +385,7 @@ void rvOpenFileDialog::SetFilter ( const char* s ) { idStr filters = s; idStr filter; - + while ( filters.Length ( ) ) { int semi = filters.Find ( ';' ); @@ -399,7 +399,7 @@ void rvOpenFileDialog::SetFilter ( const char* s ) filter = filters; filters.Empty ( ); } - + mFilters.Append ( filter.c_str() + (filter[0] == '*' ? 1 : 0) ); } } @@ -414,10 +414,10 @@ Dialog Procedure for the open file dialog INT_PTR rvOpenFileDialog::DlgProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam ) { rvOpenFileDialog* dlg = (rvOpenFileDialog*) GetWindowLong ( wnd, GWL_USERDATA ); - + switch ( msg ) { - case WM_INITDIALOG: + case WM_INITDIALOG: dlg = (rvOpenFileDialog*) lparam; SetWindowLong ( wnd, GWL_USERDATA, lparam ); dlg->mWnd = wnd; @@ -436,7 +436,7 @@ INT_PTR rvOpenFileDialog::DlgProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lp { NMLISTVIEW* nmlv = (NMLISTVIEW*)nm; if ( nmlv->uNewState & LVIS_SELECTED ) - { + { // Get the currently selected item LVITEM item; char temp[256]; @@ -445,8 +445,8 @@ INT_PTR rvOpenFileDialog::DlgProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lp item.pszText = temp; item.cchTextMax = sizeof(temp)-1; item.iItem = nmlv->iItem; - ListView_GetItem ( dlg->mWndFileList, &item ); - + ListView_GetItem ( dlg->mWndFileList, &item ); + if ( item.iImage == 2 ) { SetWindowText ( GetDlgItem ( wnd, IDC_TOOLS_FILENAME ), temp ); @@ -454,7 +454,7 @@ INT_PTR rvOpenFileDialog::DlgProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lp } break; } - + case NM_DBLCLK: dlg->HandleCommandOK ( ); break; @@ -463,7 +463,7 @@ INT_PTR rvOpenFileDialog::DlgProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lp } break; } - + case WM_COMMAND: switch ( LOWORD ( wparam ) ) { @@ -472,11 +472,11 @@ INT_PTR rvOpenFileDialog::DlgProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lp dlg->HandleCommandOK ( ); break; } - + case IDCANCEL: EndDialog ( wnd, 0 ); break; - + case IDC_TOOLS_BACK: { int sel = SendMessage ( GetDlgItem ( wnd, IDC_TOOLS_LOOKIN ), CB_GETCURSEL, 0, 0 ); @@ -486,19 +486,19 @@ INT_PTR rvOpenFileDialog::DlgProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lp SendMessage ( GetDlgItem ( wnd, IDC_TOOLS_LOOKIN ), CB_SETCURSEL, sel, 0 ); dlg->HandleLookInChange ( ); } - + break; } - + case IDC_TOOLS_LOOKIN: if ( HIWORD ( wparam ) == CBN_SELCHANGE ) { - dlg->HandleLookInChange ( ); + dlg->HandleLookInChange ( ); } break; } break; } - + return FALSE; } diff --git a/neo/tools/common/OpenFileDialog.h b/neo/tools/common/OpenFileDialog.h index a70d0463..111cfff5 100644 --- a/neo/tools/common/OpenFileDialog.h +++ b/neo/tools/common/OpenFileDialog.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"). @@ -56,22 +56,22 @@ protected: HWND mWnd; HWND mWndFileList; HWND mWndLookin; - + HINSTANCE mInstance; - + HIMAGELIST mImageList; HBITMAP mBackBitmap; - + static char mLookin[ MAX_OSPATH ]; idStr mFilename; idStr mTitle; idStr mOKTitle; idStrList mFilters; - + int mFlags; private: - + void HandleCommandOK ( void ); void HandleLookInChange ( void ); void HandleInitDialog ( void ); diff --git a/neo/tools/common/PropTree/PropTree.cpp b/neo/tools/common/PropTree/PropTree.cpp index ca9e737b..e9a42ccc 100644 --- a/neo/tools/common/PropTree/PropTree.cpp +++ b/neo/tools/common/PropTree/PropTree.cpp @@ -6,13 +6,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. @@ -42,7 +42,7 @@ HINSTANCE ghInst; if (dwReason == DLL_PROCESS_ATTACH) { TRACE0("PROPTREE.DLL Initializing!\n"); - + if (!AfxInitExtensionModule(PropTreeDLL, hInstance)) return 0; @@ -137,7 +137,7 @@ BOOL CPropTree::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT n } -int CPropTree::OnCreate(LPCREATESTRUCT lpCreateStruct) +int CPropTree::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CWnd::OnCreate(lpCreateStruct) == -1) return -1; @@ -183,7 +183,7 @@ CWnd* CPropTree::GetCtrlParent() } -void CPropTree::OnSize(UINT nType, int cx, int cy) +void CPropTree::OnSize(UINT nType, int cx, int cy) { CWnd::OnSize(nType, cx, cy); ResizeChildWindows(cx, cy); @@ -360,7 +360,7 @@ void CPropTree::SetOriginOffset(LONG nOffset) m_Origin.y = nOffset; } - + void CPropTree::UpdatedItems() { if (!IsWindow(m_hWnd)) @@ -399,7 +399,7 @@ void CPropTree::SetColumn(LONG nColumn) CRect rc; GetClientRect(rc); - + if (rc.IsRectEmpty()) nColumn = __max(PROPTREEITEM_EXPANDCOLUMN, nColumn); else @@ -762,7 +762,7 @@ CPropTreeItem* CPropTree::FocusPrev() if (pNext) SetFocusedItem(pNext); - + if (m_pFocus) { SelectItems(NULL, FALSE); @@ -893,7 +893,7 @@ LRESULT CPropTree::SendNotify(UINT nNotifyCode, CPropTreeItem* pItem) lpnm->code = nNotifyCode; lpnm->hwndFrom = m_hWnd; lpnm->idFrom = id; - + return GetParent()->SendMessage(WM_NOTIFY, (WPARAM)id, (LPARAM)lpnm); } @@ -901,18 +901,18 @@ LRESULT CPropTree::SendNotify(UINT nNotifyCode, CPropTreeItem* pItem) } -void CPropTree::OnEnable(BOOL bEnable) +void CPropTree::OnEnable(BOOL bEnable) { CWnd::OnEnable(bEnable); Invalidate(); } -void CPropTree::OnSysColorChange() +void CPropTree::OnSysColorChange() { CWnd::OnSysColorChange(); - - Invalidate(); + + Invalidate(); } diff --git a/neo/tools/common/PropTree/PropTree.h b/neo/tools/common/PropTree/PropTree.h index 64977d7e..60f616d8 100644 --- a/neo/tools/common/PropTree/PropTree.h +++ b/neo/tools/common/PropTree/PropTree.h @@ -6,13 +6,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. @@ -87,7 +87,7 @@ void InitPropTree(HINSTANCE hInstance); // CPropTree WM_NOTIFY notification structure typedef struct _NMPROPTREE { - NMHDR hdr; + NMHDR hdr; CPropTreeItem* pItem; } NMPROPTREE, *PNMPROPTREE, FAR *LPNMPROPTREE; @@ -240,7 +240,7 @@ public: // Focus on the previous item CPropTreeItem *FocusPrev(); - + // Focus on the next item CPropTreeItem *FocusNext(); diff --git a/neo/tools/common/PropTree/PropTreeInfo.cpp b/neo/tools/common/PropTree/PropTreeInfo.cpp index 4603a794..d5223c2c 100644 --- a/neo/tools/common/PropTree/PropTreeInfo.cpp +++ b/neo/tools/common/PropTree/PropTreeInfo.cpp @@ -6,13 +6,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. @@ -57,7 +57,7 @@ void CPropTreeInfo::SetPropOwner(CPropTree* pProp) m_pProp = pProp; } -void CPropTreeInfo::OnPaint() +void CPropTreeInfo::OnPaint() { CPaintDC dc(this); CRect rc; diff --git a/neo/tools/common/PropTree/PropTreeInfo.h b/neo/tools/common/PropTree/PropTreeInfo.h index 6c4a9020..9ae6ebc8 100644 --- a/neo/tools/common/PropTree/PropTreeInfo.h +++ b/neo/tools/common/PropTree/PropTreeInfo.h @@ -13,13 +13,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. diff --git a/neo/tools/common/PropTree/PropTreeItem.cpp b/neo/tools/common/PropTree/PropTreeItem.cpp index 17546a5b..90761e92 100644 --- a/neo/tools/common/PropTree/PropTreeItem.cpp +++ b/neo/tools/common/PropTree/PropTreeItem.cpp @@ -6,13 +6,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. @@ -495,13 +495,13 @@ LONG CPropTreeItem::DrawItem(CDC* pDC, const RECT& rc, LONG x, LONG y) { HGDIOBJ oPen = pDC->SelectObject(GetStockObject(NULL_PEN)); HGDIOBJ oBrush = pDC->SelectObject(GetSysColorBrush(COLOR_HIGHLIGHT)); - + CRect dr; dr = drc; dr.left = PROPTREEITEM_EXPANDCOLUMN; - + pDC->Rectangle(&dr); - + pDC->SelectObject(oPen); pDC->SelectObject(oBrush); @@ -558,7 +558,7 @@ LONG CPropTreeItem::DrawItem(CDC* pDC, const RECT& rc, LONG x, LONG y) // create clip region hRgn = CreateRectRgn(m_rc.left, m_rc.top, m_rc.right, m_rc.bottom); SelectClipRgn(pDC->m_hDC, hRgn); - + DrawAttribute(pDC, m_rc); SelectClipRgn(pDC->m_hDC, NULL); diff --git a/neo/tools/common/PropTree/PropTreeItem.h b/neo/tools/common/PropTree/PropTreeItem.h index 6eafdd2f..e09fdd8a 100644 --- a/neo/tools/common/PropTree/PropTreeItem.h +++ b/neo/tools/common/PropTree/PropTreeItem.h @@ -6,13 +6,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. diff --git a/neo/tools/common/PropTree/PropTreeItemButton.cpp b/neo/tools/common/PropTree/PropTreeItemButton.cpp index fe095c97..ea7e1021 100644 --- a/neo/tools/common/PropTree/PropTreeItemButton.cpp +++ b/neo/tools/common/PropTree/PropTreeItemButton.cpp @@ -6,13 +6,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. diff --git a/neo/tools/common/PropTree/PropTreeItemButton.h b/neo/tools/common/PropTree/PropTreeItemButton.h index 84922cb2..741b9c80 100644 --- a/neo/tools/common/PropTree/PropTreeItemButton.h +++ b/neo/tools/common/PropTree/PropTreeItemButton.h @@ -8,13 +8,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. diff --git a/neo/tools/common/PropTree/PropTreeItemCheck.cpp b/neo/tools/common/PropTree/PropTreeItemCheck.cpp index 7189e76e..256c2c39 100644 --- a/neo/tools/common/PropTree/PropTreeItemCheck.cpp +++ b/neo/tools/common/PropTree/PropTreeItemCheck.cpp @@ -6,13 +6,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. @@ -75,9 +75,9 @@ void CPropTreeItemCheck::DrawAttribute(CDC* pDC, const RECT& rc) } void CPropTreeItemCheck::SetCheckState(BOOL state) - { - checkState = state; - + { + checkState = state; + SetCheck(checkState ? BST_CHECKED : BST_UNCHECKED); } diff --git a/neo/tools/common/PropTree/PropTreeItemCheck.h b/neo/tools/common/PropTree/PropTreeItemCheck.h index b1e7f99f..c3401c50 100644 --- a/neo/tools/common/PropTree/PropTreeItemCheck.h +++ b/neo/tools/common/PropTree/PropTreeItemCheck.h @@ -8,13 +8,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. @@ -64,7 +64,7 @@ public: protected: BOOL checkState; CRect checkRect; - + // Operations public: @@ -82,9 +82,9 @@ protected: //}}AFX_MSG DECLARE_MESSAGE_MAP() - + public: - + afx_msg void OnBnKillfocus(); afx_msg void OnBnClicked(); }; diff --git a/neo/tools/common/PropTree/PropTreeItemColor.cpp b/neo/tools/common/PropTree/PropTreeItemColor.cpp index bf369587..26b167ed 100644 --- a/neo/tools/common/PropTree/PropTreeItemColor.cpp +++ b/neo/tools/common/PropTree/PropTreeItemColor.cpp @@ -6,13 +6,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. @@ -38,52 +38,52 @@ typedef struct _ColorTableEntry RECT rcSpot; } ColorTableEntry; -static ColorTableEntry _crColors[] = +static ColorTableEntry _crColors[] = { - {RGB(0x00, 0x00, 0x00)}, - {RGB(0xA5, 0x2A, 0x00)}, - {RGB(0x00, 0x40, 0x40)}, - {RGB(0x00, 0x55, 0x00)}, - {RGB(0x00, 0x00, 0x5E)}, - {RGB(0x00, 0x00, 0x8B)}, - {RGB(0x4B, 0x00, 0x82)}, - {RGB(0x28, 0x28, 0x28)}, + {RGB(0x00, 0x00, 0x00)}, + {RGB(0xA5, 0x2A, 0x00)}, + {RGB(0x00, 0x40, 0x40)}, + {RGB(0x00, 0x55, 0x00)}, + {RGB(0x00, 0x00, 0x5E)}, + {RGB(0x00, 0x00, 0x8B)}, + {RGB(0x4B, 0x00, 0x82)}, + {RGB(0x28, 0x28, 0x28)}, - {RGB(0x8B, 0x00, 0x00)}, - {RGB(0xFF, 0x68, 0x20)}, - {RGB(0x8B, 0x8B, 0x00)}, - {RGB(0x00, 0x93, 0x00)}, - {RGB(0x38, 0x8E, 0x8E)}, - {RGB(0x00, 0x00, 0xFF)}, - {RGB(0x7B, 0x7B, 0xC0)}, - {RGB(0x66, 0x66, 0x66)}, + {RGB(0x8B, 0x00, 0x00)}, + {RGB(0xFF, 0x68, 0x20)}, + {RGB(0x8B, 0x8B, 0x00)}, + {RGB(0x00, 0x93, 0x00)}, + {RGB(0x38, 0x8E, 0x8E)}, + {RGB(0x00, 0x00, 0xFF)}, + {RGB(0x7B, 0x7B, 0xC0)}, + {RGB(0x66, 0x66, 0x66)}, - {RGB(0xFF, 0x00, 0x00)}, - {RGB(0xFF, 0xAD, 0x5B)}, - {RGB(0x32, 0xCD, 0x32)}, - {RGB(0x3C, 0xB3, 0x71)}, - {RGB(0x7F, 0xFF, 0xD4)}, - {RGB(0x7D, 0x9E, 0xC0)}, - {RGB(0x80, 0x00, 0x80)}, - {RGB(0x7F, 0x7F, 0x7F)}, + {RGB(0xFF, 0x00, 0x00)}, + {RGB(0xFF, 0xAD, 0x5B)}, + {RGB(0x32, 0xCD, 0x32)}, + {RGB(0x3C, 0xB3, 0x71)}, + {RGB(0x7F, 0xFF, 0xD4)}, + {RGB(0x7D, 0x9E, 0xC0)}, + {RGB(0x80, 0x00, 0x80)}, + {RGB(0x7F, 0x7F, 0x7F)}, - {RGB(0xFF, 0xC0, 0xCB)}, - {RGB(0xFF, 0xD7, 0x00)}, - {RGB(0xFF, 0xFF, 0x00)}, - {RGB(0x00, 0xFF, 0x00)}, - {RGB(0x40, 0xE0, 0xD0)}, - {RGB(0xC0, 0xFF, 0xFF)}, - {RGB(0x48, 0x00, 0x48)}, - {RGB(0xC0, 0xC0, 0xC0)}, + {RGB(0xFF, 0xC0, 0xCB)}, + {RGB(0xFF, 0xD7, 0x00)}, + {RGB(0xFF, 0xFF, 0x00)}, + {RGB(0x00, 0xFF, 0x00)}, + {RGB(0x40, 0xE0, 0xD0)}, + {RGB(0xC0, 0xFF, 0xFF)}, + {RGB(0x48, 0x00, 0x48)}, + {RGB(0xC0, 0xC0, 0xC0)}, - {RGB(0xFF, 0xE4, 0xE1)}, - {RGB(0xD2, 0xB4, 0x8C)}, - {RGB(0xFF, 0xFF, 0xE0)}, - {RGB(0x98, 0xFB, 0x98)}, - {RGB(0xAF, 0xEE, 0xEE)}, - {RGB(0x68, 0x83, 0x8B)}, - {RGB(0xE6, 0xE6, 0xFA)}, - {RGB(0xFF, 0xFF, 0xFF)} + {RGB(0xFF, 0xE4, 0xE1)}, + {RGB(0xD2, 0xB4, 0x8C)}, + {RGB(0xFF, 0xFF, 0xE0)}, + {RGB(0x98, 0xFB, 0x98)}, + {RGB(0xAF, 0xEE, 0xEE)}, + {RGB(0x68, 0x83, 0x8B)}, + {RGB(0xE6, 0xE6, 0xFA)}, + {RGB(0xFF, 0xFF, 0xFF)} }; static void ColorBox(CDC* pDC, CPoint pt, COLORREF clr, BOOL bHover) @@ -160,7 +160,7 @@ void CPropTreeItemColor::DrawAttribute(CDC* pDC, const RECT& rc) ASSERT(m_pProp!=NULL); CRect r(rc); - + pDC->SelectObject(IsReadOnly() ? m_pProp->GetNormalFont() : m_pProp->GetBoldFont()); if (!m_pProp->IsWindowEnabled()) @@ -233,7 +233,7 @@ void CPropTreeItemColor::OnActivate(int activateType, CPoint point) LPCTSTR pszClassName; pszClassName = AfxRegisterWndClass(CS_VREDRAW|CS_HREDRAW, LoadCursor(NULL, IDC_ARROW), (HBRUSH)(COLOR_BTNFACE + 1)); - + DWORD dwStyle = WS_POPUP|WS_DLGFRAME; CreateEx(0, pszClassName, _T(""), dwStyle, r, m_pProp->GetCtrlParent(), 0); @@ -245,20 +245,20 @@ void CPropTreeItemColor::OnActivate(int activateType, CPoint point) } -void CPropTreeItemColor::OnKillFocus(CWnd* pNewWnd) +void CPropTreeItemColor::OnKillFocus(CWnd* pNewWnd) { CWnd::OnKillFocus(pNewWnd); - + if (!m_bInDialog) CommitChanges(); } -void CPropTreeItemColor::OnPaint() +void CPropTreeItemColor::OnPaint() { CPaintDC dc(this); CPoint pt; - + for (LONG i=0; i<40; i++) { pt.x = (i & 7) * 18 + 3; @@ -281,13 +281,13 @@ void CPropTreeItemColor::OnPaint() } -void CPropTreeItemColor::OnClose() +void CPropTreeItemColor::OnClose() { CommitChanges(); } -void CPropTreeItemColor::OnMouseMove(UINT, CPoint point) +void CPropTreeItemColor::OnMouseMove(UINT, CPoint point) { BOOL bButton; LONG nSpot; @@ -309,7 +309,7 @@ void CPropTreeItemColor::OnMouseMove(UINT, CPoint point) } -BOOL CPropTreeItemColor::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) +BOOL CPropTreeItemColor::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { if (nHitTest==HTCLIENT) { @@ -330,7 +330,7 @@ BOOL CPropTreeItemColor::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) } -void CPropTreeItemColor::OnLButtonDown(UINT, CPoint point) +void CPropTreeItemColor::OnLButtonDown(UINT, CPoint point) { if (m_nSpot!=-1) { diff --git a/neo/tools/common/PropTree/PropTreeItemColor.h b/neo/tools/common/PropTree/PropTreeItemColor.h index be0b1d59..e62b928f 100644 --- a/neo/tools/common/PropTree/PropTreeItemColor.h +++ b/neo/tools/common/PropTree/PropTreeItemColor.h @@ -12,13 +12,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. diff --git a/neo/tools/common/PropTree/PropTreeItemCombo.cpp b/neo/tools/common/PropTree/PropTreeItemCombo.cpp index d4444475..0816a7dc 100644 --- a/neo/tools/common/PropTree/PropTreeItemCombo.cpp +++ b/neo/tools/common/PropTree/PropTreeItemCombo.cpp @@ -6,13 +6,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. @@ -117,7 +117,7 @@ void CPropTreeItemCombo::OnRefresh() void CPropTreeItemCombo::OnCommit() { LONG idx; - + // store combo box item data if ((idx = GetCurSel())==CB_ERR) m_lComboData = 0; @@ -198,7 +198,7 @@ BOOL CPropTreeItemCombo::CreateComboBoxBool() LONG CPropTreeItemCombo::FindCBData(LPARAM lParam) { LONG idx; - + for (idx = 0; idx < GetCount(); idx++) { if (GetItemData(idx)==(DWORD)lParam) @@ -209,13 +209,13 @@ LONG CPropTreeItemCombo::FindCBData(LPARAM lParam) } -void CPropTreeItemCombo::OnSelchange() +void CPropTreeItemCombo::OnSelchange() { CommitChanges(); } -void CPropTreeItemCombo::OnKillfocus() +void CPropTreeItemCombo::OnKillfocus() { CommitChanges(); } diff --git a/neo/tools/common/PropTree/PropTreeItemCombo.h b/neo/tools/common/PropTree/PropTreeItemCombo.h index 35f19214..94321868 100644 --- a/neo/tools/common/PropTree/PropTreeItemCombo.h +++ b/neo/tools/common/PropTree/PropTreeItemCombo.h @@ -12,13 +12,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. diff --git a/neo/tools/common/PropTree/PropTreeItemEdit.cpp b/neo/tools/common/PropTree/PropTreeItemEdit.cpp index 87384df1..bc04e464 100644 --- a/neo/tools/common/PropTree/PropTreeItemEdit.cpp +++ b/neo/tools/common/PropTree/PropTreeItemEdit.cpp @@ -6,13 +6,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. @@ -177,9 +177,9 @@ void CPropTreeItemEdit::OnActivate(int activateType, CPoint point) DWORD dwStyle; dwStyle = WS_CHILD|ES_AUTOHSCROLL; - Create(dwStyle, m_rc, m_pProp->GetCtrlParent(), GetCtrlID()); + Create(dwStyle, m_rc, m_pProp->GetCtrlParent(), GetCtrlID()); } - + SendMessage(WM_SETFONT, (WPARAM)m_pProp->GetNormalFont()->m_hObject); SetPasswordChar((TCHAR)(m_bPassword ? '*' : 0)); @@ -191,22 +191,22 @@ void CPropTreeItemEdit::OnActivate(int activateType, CPoint point) } -UINT CPropTreeItemEdit::OnGetDlgCode() +UINT CPropTreeItemEdit::OnGetDlgCode() { return CEdit::OnGetDlgCode()|DLGC_WANTALLKEYS; } -void CPropTreeItemEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +void CPropTreeItemEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { if (nChar==VK_RETURN) CommitChanges(); - + CEdit::OnKeyDown(nChar, nRepCnt, nFlags); } -void CPropTreeItemEdit::OnKillfocus() +void CPropTreeItemEdit::OnKillfocus() { - CommitChanges(); + CommitChanges(); } diff --git a/neo/tools/common/PropTree/PropTreeItemEdit.h b/neo/tools/common/PropTree/PropTreeItemEdit.h index 610df013..a2321eed 100644 --- a/neo/tools/common/PropTree/PropTreeItemEdit.h +++ b/neo/tools/common/PropTree/PropTreeItemEdit.h @@ -12,13 +12,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. @@ -57,7 +57,7 @@ public: // Called to activate the item virtual void OnActivate(int activateType, CPoint point); - + enum ValueFormat { ValueFormatText, @@ -67,7 +67,7 @@ public: // Set to specifify format of SetItemValue/GetItemValue void SetValueFormat(ValueFormat nFormat); - + // Set to TRUE for to use a password edit control void SetAsPassword(BOOL bPassword); diff --git a/neo/tools/common/PropTree/PropTreeItemEditButton.cpp b/neo/tools/common/PropTree/PropTreeItemEditButton.cpp index 977fee35..bd07d41c 100644 --- a/neo/tools/common/PropTree/PropTreeItemEditButton.cpp +++ b/neo/tools/common/PropTree/PropTreeItemEditButton.cpp @@ -6,13 +6,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. @@ -230,13 +230,13 @@ void CPropTreeItemEditButton::OnActivate(int activateType, CPoint point) } -UINT CPropTreeItemEditButton::OnGetDlgCode() +UINT CPropTreeItemEditButton::OnGetDlgCode() { return CEdit::OnGetDlgCode()|DLGC_WANTALLKEYS; } -void CPropTreeItemEditButton::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +void CPropTreeItemEditButton::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { if (nChar==VK_RETURN) CommitChanges(); @@ -245,9 +245,9 @@ void CPropTreeItemEditButton::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) } -void CPropTreeItemEditButton::OnKillfocus() +void CPropTreeItemEditButton::OnKillfocus() { - CommitChanges(); + CommitChanges(); } BOOL CPropTreeItemEditButton::HitButton( const POINT& pt ) { diff --git a/neo/tools/common/PropTree/PropTreeItemEditButton.h b/neo/tools/common/PropTree/PropTreeItemEditButton.h index 1ad26702..4a69aa09 100644 --- a/neo/tools/common/PropTree/PropTreeItemEditButton.h +++ b/neo/tools/common/PropTree/PropTreeItemEditButton.h @@ -13,13 +13,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. diff --git a/neo/tools/common/PropTree/PropTreeItemFileEdit.cpp b/neo/tools/common/PropTree/PropTreeItemFileEdit.cpp index 2e956508..dda056db 100644 --- a/neo/tools/common/PropTree/PropTreeItemFileEdit.cpp +++ b/neo/tools/common/PropTree/PropTreeItemFileEdit.cpp @@ -31,7 +31,7 @@ BEGIN_MESSAGE_MAP(CPropTreeItemFileEdit, CPropTreeItemEdit) //}}AFX_MSG_MAP ON_WM_CONTEXTMENU() ON_WM_CREATE() - + ON_COMMAND(ID_EDITMENU_INSERTFILE, OnInsertFile) ON_COMMAND(ID_EDIT_UNDO, OnEditUndo) ON_COMMAND(ID_EDIT_CUT, OnEditCut) @@ -82,26 +82,26 @@ int CPropTreeItemFileEdit::OnCreate(LPCREATESTRUCT lpCreateStruct) void CPropTreeItemFileEdit::OnInsertFile() { CFileDialog dlg(TRUE); dlg.m_ofn.Flags |= OFN_FILEMUSTEXIST; - + int startSel, endSel; GetSel(startSel, endSel); if( dlg.DoModal()== IDOK) { - + idStr currentText = (char*)GetItemValue(); idStr newText = currentText.Left(startSel) + currentText.Right(currentText.Length() - endSel); - + idStr filename = fileSystem->OSPathToRelativePath(dlg.m_ofn.lpstrFile); filename.BackSlashesToSlashes(); - + newText.Insert(filename, startSel); SetItemValue((LPARAM)newText.c_str()); m_pProp->RefreshItems(this); m_pProp->SendNotify(PTN_ITEMCHANGED, this); - + } } diff --git a/neo/tools/common/PropTree/PropTreeItemFileEdit.h b/neo/tools/common/PropTree/PropTreeItemFileEdit.h index 8d959d0e..44580b1c 100644 --- a/neo/tools/common/PropTree/PropTreeItemFileEdit.h +++ b/neo/tools/common/PropTree/PropTreeItemFileEdit.h @@ -32,13 +32,13 @@ protected: //{{AFX_MSG(CPropTreeItemFileEdit) //}}AFX_MSG - afx_msg void OnInsertFile(); - afx_msg void OnEditUndo(); - afx_msg void OnEditCut(); - afx_msg void OnEditCopy(); - afx_msg void OnEditPaste(); - afx_msg void OnEditDelete(); - afx_msg void OnEditSelectAll(); + afx_msg void OnInsertFile(); + afx_msg void OnEditUndo(); + afx_msg void OnEditCut(); + afx_msg void OnEditCopy(); + afx_msg void OnEditPaste(); + afx_msg void OnEditDelete(); + afx_msg void OnEditSelectAll(); DECLARE_MESSAGE_MAP() public: @@ -51,4 +51,4 @@ public: //{{AFX_INSERT_LOCATION}} -#endif +#endif diff --git a/neo/tools/common/PropTree/PropTreeItemStatic.cpp b/neo/tools/common/PropTree/PropTreeItemStatic.cpp index c87e7f43..b13d7c4a 100644 --- a/neo/tools/common/PropTree/PropTreeItemStatic.cpp +++ b/neo/tools/common/PropTree/PropTreeItemStatic.cpp @@ -6,13 +6,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. diff --git a/neo/tools/common/PropTree/PropTreeItemStatic.h b/neo/tools/common/PropTree/PropTreeItemStatic.h index e39fa2df..c2b0845a 100644 --- a/neo/tools/common/PropTree/PropTreeItemStatic.h +++ b/neo/tools/common/PropTree/PropTreeItemStatic.h @@ -6,13 +6,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. diff --git a/neo/tools/common/PropTree/PropTreeList.cpp b/neo/tools/common/PropTree/PropTreeList.cpp index 60d0e577..042231d0 100644 --- a/neo/tools/common/PropTree/PropTreeList.cpp +++ b/neo/tools/common/PropTree/PropTreeList.cpp @@ -6,13 +6,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. @@ -88,7 +88,7 @@ BOOL CPropTreeList::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UI } -void CPropTreeList::OnSize(UINT nType, int cx, int cy) +void CPropTreeList::OnSize(UINT nType, int cx, int cy) { CWnd::OnSize(nType, cx, cy); @@ -151,7 +151,7 @@ void CPropTreeList::UpdateResize() } -void CPropTreeList::OnPaint() +void CPropTreeList::OnPaint() { CPaintDC dc(this); CDC memdc; @@ -212,7 +212,7 @@ void CPropTreeList::OnPaint() } -BOOL CPropTreeList::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) +BOOL CPropTreeList::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { if (nHitTest==HTCLIENT) { @@ -241,7 +241,7 @@ BOOL CPropTreeList::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) } -void CPropTreeList::OnLButtonDown(UINT, CPoint point) +void CPropTreeList::OnLButtonDown(UINT, CPoint point) { ASSERT(m_pProp!=NULL); @@ -343,7 +343,7 @@ void CPropTreeList::OnLButtonDown(UINT, CPoint point) } -void CPropTreeList::OnLButtonUp(UINT, CPoint point) +void CPropTreeList::OnLButtonUp(UINT, CPoint point) { if (m_bColDrag) { @@ -451,7 +451,7 @@ void CPropTreeList::OnMouseMove(UINT, CPoint point) } -BOOL CPropTreeList::OnMouseWheel(UINT, short zDelta, CPoint) +BOOL CPropTreeList::OnMouseWheel(UINT, short zDelta, CPoint) { SCROLLINFO si; @@ -474,7 +474,7 @@ BOOL CPropTreeList::OnMouseWheel(UINT, short zDelta, CPoint) } -void CPropTreeList::OnKeyDown(UINT nChar, UINT, UINT) +void CPropTreeList::OnKeyDown(UINT nChar, UINT, UINT) { CPropTreeItem* pItem; @@ -554,13 +554,13 @@ void CPropTreeList::OnKeyDown(UINT nChar, UINT, UINT) } -UINT CPropTreeList::OnGetDlgCode() +UINT CPropTreeList::OnGetDlgCode() { return DLGC_WANTARROWS|DLGC_WANTCHARS|DLGC_WANTALLKEYS; } -void CPropTreeList::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar*) +void CPropTreeList::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar*) { SCROLLINFO si; CRect rc; @@ -618,7 +618,7 @@ void CPropTreeList::CheckVisibleFocus() ASSERT(m_pProp!=NULL); CPropTreeItem* pItem; - + if ((pItem = m_pProp->GetFocusedItem())==NULL) return; diff --git a/neo/tools/common/PropTree/PropTreeList.h b/neo/tools/common/PropTree/PropTreeList.h index fe25c921..90832d04 100644 --- a/neo/tools/common/PropTree/PropTreeList.h +++ b/neo/tools/common/PropTree/PropTreeList.h @@ -12,13 +12,13 @@ // // This material is provided "as is", with absolutely no warranty expressed // or implied. Any use is at your own risk. -// -// Permission to use or copy this software for any purpose is hereby granted +// +// Permission to use or copy this software for any purpose is hereby granted // without fee, provided the above notices are retained on all copies. // Permission to modify the code and to distribute modified code is granted, // provided the above notices are retained, and a notice that the code was // modified is included with the above copyright notice. -// +// // If you use this code, drop me an email. I'd like to know if you find the code // useful. diff --git a/neo/tools/common/PropTree/PropTreeView.cpp b/neo/tools/common/PropTree/PropTreeView.cpp index 1ccc9a2c..88252205 100644 --- a/neo/tools/common/PropTree/PropTreeView.cpp +++ b/neo/tools/common/PropTree/PropTreeView.cpp @@ -93,7 +93,7 @@ void CPropTreeView::OnSize(UINT nType, int cx, int cy) CView::OnSize(nType, cx, cy); if (::IsWindow(m_Tree.GetSafeHwnd())) - m_Tree.SetWindowPos(NULL, -1, -1, cx, cy, SWP_NOMOVE|SWP_NOZORDER); + m_Tree.SetWindowPos(NULL, -1, -1, cx, cy, SWP_NOMOVE|SWP_NOZORDER); } diff --git a/neo/tools/common/PropTree/PropTreeView.h b/neo/tools/common/PropTree/PropTreeView.h index c3d98678..d39b5ce0 100644 --- a/neo/tools/common/PropTree/PropTreeView.h +++ b/neo/tools/common/PropTree/PropTreeView.h @@ -32,10 +32,8 @@ public: virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL); - + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnPaint(); }; - - diff --git a/neo/tools/common/PropertyGrid.cpp b/neo/tools/common/PropertyGrid.cpp index bb9e8417..efb3bba4 100644 --- a/neo/tools/common/PropertyGrid.cpp +++ b/neo/tools/common/PropertyGrid.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"). @@ -39,7 +39,7 @@ public: rvPropertyGridItem ( ) { } - + idStr mName; idStr mValue; rvPropertyGrid::EItemType mType; @@ -75,7 +75,7 @@ bool rvPropertyGrid::Create ( HWND parent, int id, int style ) mStyle = style; // Create the List view - mWindow = CreateWindowEx ( 0, "LISTBOX", "", WS_VSCROLL|WS_CHILD|WS_VISIBLE|LBS_OWNERDRAWFIXED|LBS_NOINTEGRALHEIGHT|LBS_NOTIFY, 0, 0, 0, 0, parent, (HMENU)id, win32.hInstance, 0 ); + mWindow = CreateWindowEx ( 0, "LISTBOX", "", WS_VSCROLL|WS_CHILD|WS_VISIBLE|LBS_OWNERDRAWFIXED|LBS_NOINTEGRALHEIGHT|LBS_NOTIFY, 0, 0, 0, 0, parent, (HMENU)id, win32.hInstance, 0 ); mListWndProc = (WNDPROC)GetWindowLong ( mWindow, GWL_WNDPROC ); SetWindowLong ( mWindow, GWL_USERDATA, (LONG)this ); SetWindowLong ( mWindow, GWL_WNDPROC, (LONG)WndProc ); @@ -87,17 +87,17 @@ bool rvPropertyGrid::Create ( HWND parent, int id, int style ) // Set the font of the list box HDC dc; LOGFONT lf; - + dc = GetDC ( mWindow ); ZeroMemory ( &lf, sizeof(lf) ); lf.lfHeight = -MulDiv(8, GetDeviceCaps(dc, LOGPIXELSY), 72); - strcpy ( lf.lfFaceName, "MS Shell Dlg" ); - SendMessage ( mWindow, WM_SETFONT, (WPARAM)CreateFontIndirect ( &lf ), 0 ); - SendMessage ( mEdit, WM_SETFONT, (WPARAM)CreateFontIndirect ( &lf ), 0 ); + strcpy ( lf.lfFaceName, "MS Shell Dlg" ); + SendMessage ( mWindow, WM_SETFONT, (WPARAM)CreateFontIndirect ( &lf ), 0 ); + SendMessage ( mEdit, WM_SETFONT, (WPARAM)CreateFontIndirect ( &lf ), 0 ); ReleaseDC ( mWindow, dc ); RemoveAllItems ( ); - + return true; } @@ -124,13 +124,13 @@ void rvPropertyGrid::StartEdit ( int item, bool label ) { rvPropertyGridItem* gitem; RECT rItem; - + gitem = (rvPropertyGridItem*)SendMessage ( mWindow, LB_GETITEMDATA, item, 0 ); if ( NULL == gitem ) { return; } - + SendMessage ( mWindow, LB_GETITEMRECT, item, (LPARAM)&rItem ); if ( label ) { @@ -144,13 +144,13 @@ void rvPropertyGrid::StartEdit ( int item, bool label ) mState = STATE_EDIT; mEditItem = item; mEditLabel = label; - - SetWindowText ( mEdit, label?gitem->mName:gitem->mValue ); + + SetWindowText ( mEdit, label?gitem->mName:gitem->mValue ); MoveWindow ( mEdit, rItem.left, rItem.top + 2, rItem.right - rItem.left, rItem.bottom - rItem.top - 2, TRUE ); - ShowWindow ( mEdit, SW_SHOW ); - + ShowWindow ( mEdit, SW_SHOW ); + SetFocus ( mEdit ); } @@ -166,29 +166,29 @@ void rvPropertyGrid::FinishEdit ( void ) char value[1024]; rvPropertyGridItem* item; bool update; - + if ( mState != STATE_EDIT ) { return; } assert ( mEditItem >= 0 ); - + mState = STATE_FINISHEDIT; - + update = false; item = (rvPropertyGridItem*)SendMessage ( mWindow, LB_GETITEMDATA, mEditItem, 0 ); - assert ( item ); - + assert ( item ); + GetWindowText ( mEdit, value, 1023 ); - + if ( !value[0] ) { mState = STATE_EDIT; MessageBeep ( MB_ICONASTERISK ); return; } - + if ( !mEditLabel && item->mValue.Cmp ( value ) ) { NMPROPGRID nmpg; @@ -196,7 +196,7 @@ void rvPropertyGrid::FinishEdit ( void ) nmpg.hdr.hwndFrom = mWindow; nmpg.hdr.idFrom = GetWindowLong ( mWindow, GWL_ID ); nmpg.mName = item->mName; - nmpg.mValue = value; + nmpg.mValue = value; if ( !SendMessage ( GetParent ( mWindow ), WM_NOTIFY, 0, (LONG)&nmpg ) ) { @@ -209,7 +209,7 @@ void rvPropertyGrid::FinishEdit ( void ) item = (rvPropertyGridItem*)SendMessage ( mWindow, LB_GETITEMDATA, mEditItem, 0 ); if ( item ) { - item->mValue = value; + item->mValue = value; update = true; } } @@ -220,14 +220,14 @@ void rvPropertyGrid::FinishEdit ( void ) SetCurSel ( sel ); StartEdit ( sel, false ); return; - } + } SetCurSel ( mEditItem ); mState = STATE_NORMAL; mEditItem = -1; - ShowWindow ( mEdit, SW_HIDE ); + ShowWindow ( mEdit, SW_HIDE ); SetFocus ( mWindow ); } @@ -244,7 +244,7 @@ void rvPropertyGrid::CancelEdit ( void ) { if ( !*GetItemValue ( mEditItem ) ) { - RemoveItem ( mEditItem ); + RemoveItem ( mEditItem ); } } @@ -252,7 +252,7 @@ void rvPropertyGrid::CancelEdit ( void ) mEditItem = -1; mState = STATE_NORMAL; ShowWindow ( mEdit, SW_HIDE ); - SetFocus ( mWindow ); + SetFocus ( mWindow ); SetCurSel ( mSelectedItem ); } @@ -278,9 +278,9 @@ int rvPropertyGrid::AddItem ( const char* name, const char* value, EItemType typ item->mName = name; item->mValue = value; item->mType = type; - + insert = SendMessage(mWindow,LB_GETCOUNT,0,0) - ((mStyle&PGS_ALLOWINSERT)?1:0); - + return SendMessage ( mWindow, LB_INSERTSTRING, insert, (LONG)item ); } @@ -297,9 +297,9 @@ void rvPropertyGrid::RemoveItem ( int index ) { return; } - + delete (rvPropertyGridItem*)SendMessage ( mWindow, LB_GETITEMDATA, index, 0 ); - + SendMessage ( mWindow, LB_DELETESTRING, index, 0 ); } @@ -313,15 +313,15 @@ Remove all items from the property grid void rvPropertyGrid::RemoveAllItems ( void ) { int i; - + // free the memory for all the items for ( i = SendMessage ( mWindow, LB_GETCOUNT, 0, 0 ); i > 0; i -- ) - { + { delete (rvPropertyGridItem*)SendMessage ( mWindow, LB_GETITEMDATA, i - 1, 0 ); } // remove all items from the listbox itself - SendMessage ( mWindow, LB_RESETCONTENT, 0, 0 ); + SendMessage ( mWindow, LB_RESETCONTENT, 0, 0 ); if ( mStyle & PGS_ALLOWINSERT ) { @@ -344,16 +344,16 @@ Return name of item at given index const char* rvPropertyGrid::GetItemName ( int index ) { rvPropertyGridItem* item; - + item = (rvPropertyGridItem*)SendMessage ( mWindow, LB_GETITEMDATA, index, 0 ); if ( !item ) { return ""; } - + return item->mName; } - + /* ================ rvPropertyGrid::GetItemValue @@ -364,13 +364,13 @@ Return value of item at given index const char* rvPropertyGrid::GetItemValue ( int index ) { rvPropertyGridItem* item; - + item = (rvPropertyGridItem*)SendMessage ( mWindow, LB_GETITEMDATA, index, 0 ); if ( !item ) { return ""; } - + return item->mValue; } @@ -384,13 +384,13 @@ Window procedure for property grid LRESULT CALLBACK rvPropertyGrid::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { rvPropertyGrid* grid = (rvPropertyGrid*) GetWindowLong ( hWnd, GWL_USERDATA ); - + switch ( msg ) - { + { case WM_SETFOCUS: // grid->mEditItem = -1; break; - + case WM_KEYDOWN: { NMKEY nmkey; @@ -399,10 +399,10 @@ LRESULT CALLBACK rvPropertyGrid::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L nmkey.nVKey = wParam; nmkey.uFlags = HIWORD(lParam); nmkey.hdr.idFrom = GetWindowLong ( hWnd, GWL_ID ); - SendMessage ( GetParent ( hWnd ), WM_NOTIFY, nmkey.hdr.idFrom, (LPARAM)&nmkey ); + SendMessage ( GetParent ( hWnd ), WM_NOTIFY, nmkey.hdr.idFrom, (LPARAM)&nmkey ); break; } - + case WM_CHAR: { switch ( wParam ) @@ -416,11 +416,11 @@ LRESULT CALLBACK rvPropertyGrid::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L } break; } - + case WM_KILLFOCUS: grid->mSelectedItem = -1; break; - + case WM_NOTIFY: { NMHDR* hdr; @@ -439,12 +439,12 @@ LRESULT CALLBACK rvPropertyGrid::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L case VK_TAB: grid->FinishEdit ( ); return 1; - + case VK_ESCAPE: grid->CancelEdit ( ); return 1; } - } + } if ( filter->msg == WM_CHAR || filter->msg == WM_KEYUP ) { @@ -460,7 +460,7 @@ LRESULT CALLBACK rvPropertyGrid::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L } break; } - + case WM_COMMAND: if ( lParam == (long)grid->mEdit ) { @@ -474,7 +474,7 @@ LRESULT CALLBACK rvPropertyGrid::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L case WM_LBUTTONDBLCLK: grid->mSelectedItem = SendMessage ( hWnd, LB_ITEMFROMPOINT, 0, lParam ); - + // fall through case WM_LBUTTONDOWN: @@ -483,18 +483,18 @@ LRESULT CALLBACK rvPropertyGrid::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L rvPropertyGridItem* gitem; RECT rItem; POINT pt; - + if ( grid->mState == rvPropertyGrid::STATE_EDIT ) { break; } - + item = (short)LOWORD(SendMessage ( hWnd, LB_ITEMFROMPOINT, 0, lParam )); if ( item == -1 ) { break; } - + gitem = (rvPropertyGridItem*)SendMessage ( hWnd, LB_GETITEMDATA, item, 0 ); pt.x = LOWORD(lParam); pt.y = HIWORD(lParam); @@ -511,14 +511,14 @@ LRESULT CALLBACK rvPropertyGrid::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L } } else if ( grid->mSelectedItem == item ) - { + { rItem.left = rItem.left + grid->mSplitter + 1; if ( PtInRect ( &rItem, pt) ) { grid->StartEdit ( item, false ); } } - + if ( grid->mState == rvPropertyGrid::STATE_EDIT ) { ClientToScreen ( hWnd, &pt ); @@ -526,10 +526,10 @@ LRESULT CALLBACK rvPropertyGrid::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L SendMessage ( grid->mEdit, WM_LBUTTONDOWN, wParam, MAKELONG(pt.x,pt.y) ); return 0; } - + break; } - + case WM_ERASEBKGND: { RECT rClient; @@ -537,11 +537,11 @@ LRESULT CALLBACK rvPropertyGrid::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L FillRect ( (HDC)wParam, &rClient, GetSysColorBrush ( COLOR_3DFACE ) ); return TRUE; } - + case WM_SETCURSOR: { POINT point; - GetCursorPos ( &point ); + GetCursorPos ( &point ); ScreenToClient ( hWnd, &point ); if ( point.x >= grid->mSplitter - 2 && point.x <= grid->mSplitter + 2 ) { @@ -551,7 +551,7 @@ LRESULT CALLBACK rvPropertyGrid::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L break; } } - + return CallWindowProc ( grid->mListWndProc, hWnd, msg, wParam, lParam ); } @@ -565,7 +565,7 @@ Handle messages sent to the parent window bool rvPropertyGrid::ReflectMessage ( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { switch ( msg ) - { + { case WM_COMMAND: { if ( (HWND)lParam == mWindow ) @@ -579,11 +579,11 @@ bool rvPropertyGrid::ReflectMessage ( HWND hWnd, UINT msg, WPARAM wParam, LPARAM } break; } - + case WM_DRAWITEM: HandleDrawItem ( wParam, lParam ); return true; - + case WM_MEASUREITEM: { MEASUREITEMSTRUCT* mis = (MEASUREITEMSTRUCT*) lParam; @@ -591,7 +591,7 @@ bool rvPropertyGrid::ReflectMessage ( HWND hWnd, UINT msg, WPARAM wParam, LPARAM return true; } } - + return false; } @@ -608,7 +608,7 @@ int rvPropertyGrid::HandleDrawItem ( WPARAM wParam, LPARAM lParam ) rvPropertyGridItem* item = (rvPropertyGridItem*) dis->itemData; RECT rTemp; HBRUSH brush; - + if ( !item ) { return 0; @@ -619,11 +619,11 @@ int rvPropertyGrid::HandleDrawItem ( WPARAM wParam, LPARAM lParam ) { brush = GetSysColorBrush ( COLOR_SCROLLBAR ); rTemp.right = rTemp.left + 10; - FillRect ( dis->hDC, &rTemp, brush ); + FillRect ( dis->hDC, &rTemp, brush ); rTemp.left = rTemp.right; rTemp.right = dis->rcItem.right; } - + if ( item->mType == PGIT_HEADER ) { brush = GetSysColorBrush ( COLOR_SCROLLBAR ); @@ -634,7 +634,7 @@ int rvPropertyGrid::HandleDrawItem ( WPARAM wParam, LPARAM lParam ) } else { - brush = GetSysColorBrush ( COLOR_WINDOW ); + brush = GetSysColorBrush ( COLOR_WINDOW ); } FillRect ( dis->hDC, &rTemp, brush ); @@ -652,7 +652,7 @@ int rvPropertyGrid::HandleDrawItem ( WPARAM wParam, LPARAM lParam ) LineTo ( dis->hDC, dis->rcItem.left + mSplitter, dis->rcItem.bottom ); } SelectObject ( dis->hDC, oldpen ); - DeleteObject ( pen ); + DeleteObject ( pen ); int colorIndex = ( (dis->itemState & ODS_SELECTED ) ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT ); SetTextColor ( dis->hDC, GetSysColor ( colorIndex ) ); @@ -665,10 +665,10 @@ int rvPropertyGrid::HandleDrawItem ( WPARAM wParam, LPARAM lParam ) rText.left += 2; DrawText ( dis->hDC, item->mName, item->mName.Length(), &rText, DT_LEFT|DT_VCENTER|DT_SINGLELINE ); - + rText.left = dis->rcItem.left + mSplitter + 2; rText.right = dis->rcItem.right; DrawText ( dis->hDC, item->mValue, item->mValue.Length(), &rText, DT_LEFT|DT_VCENTER|DT_SINGLELINE ); - + return 0; } \ No newline at end of file diff --git a/neo/tools/common/PropertyGrid.h b/neo/tools/common/PropertyGrid.h index 82fa999a..0dda312b 100644 --- a/neo/tools/common/PropertyGrid.h +++ b/neo/tools/common/PropertyGrid.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"). @@ -39,7 +39,7 @@ typedef struct NMHDR hdr; int mItem; const char* mName; - const char* mValue; + const char* mValue; } NMPROPGRID; @@ -55,7 +55,7 @@ public: }; rvPropertyGrid ( ); - + bool Create ( HWND parent, int id, int style = 0 ); void Move ( int x, int y, int w, int h, BOOL redraw = FALSE ); @@ -63,10 +63,10 @@ public: bool ReflectMessage ( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); int AddItem ( const char* name, const char* value, EItemType type = PGIT_STRING ); - + void RemoveItem ( int index ); void RemoveAllItems ( void ); - + void SetCurSel ( int index ); int GetCurSel ( void ); @@ -98,7 +98,7 @@ protected: int mSplitter; int mStyle; EState mState; - + private: static LRESULT CALLBACK WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); diff --git a/neo/tools/common/RegistryOptions.cpp b/neo/tools/common/RegistryOptions.cpp index 4073390c..fcf0902f 100644 --- a/neo/tools/common/RegistryOptions.cpp +++ b/neo/tools/common/RegistryOptions.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"). @@ -54,7 +54,7 @@ void rvRegistryOptions::Init( const char *key ) { ================ rvRegistryOptions::Save -Write the options to the registry +Write the options to the registry ================ */ bool rvRegistryOptions::Save ( void ) @@ -72,14 +72,14 @@ bool rvRegistryOptions::Save ( void ) for ( i = 0; i < mValues.GetNumKeyVals(); i ++ ) { const idKeyValue* key = mValues.GetKeyVal ( i ); - assert ( key ); + assert ( key ); RegSetValueEx ( hKey, key->GetKey().c_str(), 0, REG_SZ, (BYTE*)key->GetValue().c_str(), key->GetValue().Length() ); } // Write Recent Files - for ( i = 0; i < mRecentFiles.Num(); i ++ ) + for ( i = 0; i < mRecentFiles.Num(); i ++ ) { - RegSetValueEx ( hKey, va("mru%d",i), 0, REG_SZ, (BYTE*)mRecentFiles[i].c_str(), mRecentFiles[i].Length() ); + RegSetValueEx ( hKey, va("mru%d",i), 0, REG_SZ, (BYTE*)mRecentFiles[i].c_str(), mRecentFiles[i].Length() ); } return true; @@ -114,9 +114,9 @@ bool rvRegistryOptions::Load ( void ) dwSize = MAX_PATH; for ( i = 0; RegEnumValue ( hKey, i, keyname, &dwSize, NULL, NULL, NULL, NULL ) == ERROR_SUCCESS; i ++ ) { - temp[0] = '\0'; + temp[0] = '\0'; dwSize = MAX_PATH; - + if ( ERROR_SUCCESS != RegQueryValueEx ( hKey, keyname, NULL, &dwType, (LPBYTE)temp, &dwSize ) ) { continue; @@ -129,19 +129,19 @@ bool rvRegistryOptions::Load ( void ) { continue; } - + mValues.Set ( keyname, temp ); - } + } // Read Recent Files for ( i = 0; i < MAX_MRU_SIZE; i ++ ) { dwSize = MAX_PATH; if ( ERROR_SUCCESS != RegQueryValueEx ( hKey, va("mru%d", i ), NULL, &dwType, (LPBYTE)temp, &dwSize ) ) - { + { continue; } - + AddRecentFile ( temp ); } @@ -158,12 +158,12 @@ Set a window placement in the options void rvRegistryOptions::SetWindowPlacement ( const char* name, HWND hwnd ) { WINDOWPLACEMENT wp; - + wp.length = sizeof(wp); ::GetWindowPlacement ( hwnd, &wp ); - + idStr out; - + out = va("%d %d %d %d %d %d %d %d %d %d", wp.flags, wp.ptMaxPosition.x, @@ -175,8 +175,8 @@ void rvRegistryOptions::SetWindowPlacement ( const char* name, HWND hwnd ) wp.rcNormalPosition.right, wp.rcNormalPosition.bottom, wp.showCmd ); - - mValues.Set ( name, out ); + + mValues.Set ( name, out ); } /* @@ -208,9 +208,9 @@ bool rvRegistryOptions::GetWindowPlacement ( const char* name, HWND hwnd ) &wp.rcNormalPosition.right, &wp.rcNormalPosition.bottom, &wp.showCmd ); - + ::SetWindowPlacement ( hwnd, &wp ); - + return true; } @@ -224,7 +224,7 @@ Adds the given filename to the MRU list void rvRegistryOptions::AddRecentFile ( const char* filename ) { int i; - + idStr path = filename; // Remove duplicates first @@ -236,14 +236,14 @@ void rvRegistryOptions::AddRecentFile ( const char* filename ) break; } } - + // Alwasy trip to the max MRU size while ( mRecentFiles.Num ( ) >= MAX_MRU_SIZE ) { mRecentFiles.RemoveIndex ( 0 ); } - - mRecentFiles.Append ( path ); + + mRecentFiles.Append ( path ); } /* @@ -258,14 +258,14 @@ void rvRegistryOptions::SetColumnWidths ( const char* name, HWND list ) LVCOLUMN col; int index; idStr widths; - - col.mask = LVCF_WIDTH; - + + col.mask = LVCF_WIDTH; + for ( index = 0; ListView_GetColumn ( list, index, &col ); index ++ ) { widths += va("%d ", col.cx ); } - + mValues.Set ( name, widths ); } @@ -282,18 +282,18 @@ void rvRegistryOptions::GetColumnWidths ( const char* name, HWND list ) const char* parse; const char* next; int index; - + widths = mValues.GetString ( name ); parse = widths; index = 0; - + while ( NULL != (next = strchr ( parse, ' ' ) ) ) { int width; - + sscanf ( parse, "%d", &width ); parse = next + 1; - + ListView_SetColumnWidth ( list, index++, width ); } } @@ -312,7 +312,7 @@ void rvRegistryOptions::SetBinary ( const char* name, const unsigned char* data, { binary += va("%02x", *data ); } - + mValues.Set ( name, binary ); } @@ -332,5 +332,5 @@ void rvRegistryOptions::GetBinary ( const char* name, unsigned char* data, int s int value; sscanf ( parse, "%02x", &value ); *data = (unsigned char)value; - } + } } diff --git a/neo/tools/common/RegistryOptions.h b/neo/tools/common/RegistryOptions.h index 96d45f68..edb59a84 100644 --- a/neo/tools/common/RegistryOptions.h +++ b/neo/tools/common/RegistryOptions.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 @@ public: // Write the options to the registery bool Save ( void ); - + // Read the options from the registry bool Load ( void ); @@ -71,7 +71,7 @@ public: // MRU related methods void AddRecentFile ( const char* filename ); - const char* GetRecentFile ( int index ); + const char* GetRecentFile ( int index ); int GetRecentFileCount ( void ); private: diff --git a/neo/tools/common/RenderBumpFlatDialog.cpp b/neo/tools/common/RenderBumpFlatDialog.cpp index 2ca200f5..d105271d 100644 --- a/neo/tools/common/RenderBumpFlatDialog.cpp +++ b/neo/tools/common/RenderBumpFlatDialog.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"). @@ -53,20 +53,20 @@ static bool CheckPow2(int Num) extern void Com_WriteConfigToFile( const char *filename ); -static BOOL CALLBACK RBFProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_INITDIALOG: +static BOOL CALLBACK RBFProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_INITDIALOG: SetDlgItemInt(hwndDlg, IDC_RBF_WIDTH, rbfg_DefaultWidth.GetInteger(), FALSE); SetDlgItemInt(hwndDlg, IDC_RBF_HEIGHT, rbfg_DefaultHeight.GetInteger(), FALSE); SetDlgItemText(hwndDlg, IDC_RBF_FILENAME, RBFName); - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case IDOK: + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDOK: { int width, height; @@ -83,20 +83,20 @@ static BOOL CALLBACK RBFProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM l return TRUE; } - DestroyWindow(hwndDlg); + DestroyWindow(hwndDlg); cmdSystem->BufferCommandText( CMD_EXEC_APPEND, va("renderbumpflat -size %d %d %s\n", width, height, RBFName.c_str() ) ); - return TRUE; + return TRUE; } - - case IDCANCEL: - DestroyWindow(hwndDlg); - return TRUE; - } - } - return FALSE; -} + case IDCANCEL: + DestroyWindow(hwndDlg); + return TRUE; + } + } + + return FALSE; +} void DoRBFDialog(const char *FileName) { @@ -104,7 +104,7 @@ void DoRBFDialog(const char *FileName) Sys_GrabMouseCursor( false ); - DialogBox(0, MAKEINTRESOURCE(IDD_RENDERBUMPFLAT), 0, (DLGPROC)RBFProc); + DialogBox(0, MAKEINTRESOURCE(IDD_RENDERBUMPFLAT), 0, (DLGPROC)RBFProc); Sys_GrabMouseCursor( true ); } diff --git a/neo/tools/common/RenderBumpFlatDialog.h b/neo/tools/common/RenderBumpFlatDialog.h index 08650566..5e169bd2 100644 --- a/neo/tools/common/RenderBumpFlatDialog.h +++ b/neo/tools/common/RenderBumpFlatDialog.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"). @@ -32,4 +32,3 @@ If you have questions concerning this license or the applicable additional terms void DoRBFDialog(const char *FileName); #endif // __RENDERBUMPFLATDIALOG_H - diff --git a/neo/tools/common/RollupPanel.cpp b/neo/tools/common/RollupPanel.cpp index 73f569b1..85cbe3d8 100644 --- a/neo/tools/common/RollupPanel.cpp +++ b/neo/tools/common/RollupPanel.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"). @@ -45,7 +45,7 @@ If you have questions concerning this license or the applicable additional terms #define RP_IDM_COLLAPSEALL 0x101 #define RP_IDM_STARTITEMS 0x102 -idList rvRollupPanel::mDialogs; +idList rvRollupPanel::mDialogs; HHOOK rvRollupPanel::mDialogHook = NULL; #define DEFERPOS @@ -94,29 +94,29 @@ bool rvRollupPanel::Create ( DWORD dwStyle, const RECT& rect, HWND parent, unsig wndClass.cbSize = sizeof(WNDCLASSEX); wndClass.lpszClassName = "ROLLUP_PANEL"; wndClass.lpfnWndProc = WindowProc; - wndClass.hbrBackground = (HBRUSH)GetSysColorBrush ( COLOR_3DFACE ); - wndClass.hCursor = LoadCursor((HINSTANCE) NULL, IDC_ARROW); + wndClass.hbrBackground = (HBRUSH)GetSysColorBrush ( COLOR_3DFACE ); + wndClass.hCursor = LoadCursor((HINSTANCE) NULL, IDC_ARROW); wndClass.lpszMenuName = NULL; - wndClass.hInstance = win32.hInstance; + wndClass.hInstance = win32.hInstance; wndClass.style = CS_VREDRAW | CS_HREDRAW; RegisterClassEx ( &wndClass ); - mWindow = CreateWindowEx ( WS_EX_TOOLWINDOW, - "ROLLUP_PANEL", - "", - dwStyle|WS_CLIPSIBLINGS, + mWindow = CreateWindowEx ( WS_EX_TOOLWINDOW, + "ROLLUP_PANEL", + "", + dwStyle|WS_CLIPSIBLINGS, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, - parent, - NULL, - win32.hInstance, + parent, + NULL, + win32.hInstance, this ); - + if ( !mWindow ) { return false; } - return true; + return true; } /* @@ -131,23 +131,23 @@ int rvRollupPanel::InsertItem ( const char* caption, HWND dialog, bool autoDestr assert ( caption ); assert ( dialog ); - // -1 means add to the end + // -1 means add to the end if ( index > 0 && index >= mItems.Num() ) { index = -1; } - // Get client rect + // Get client rect RECT r; GetClientRect(mWindow,&r); // Create the GroupBox control - HWND groupbox = CreateWindow ( "BUTTON", "", WS_CHILD|BS_GROUPBOX, + HWND groupbox = CreateWindow ( "BUTTON", "", WS_CHILD|BS_GROUPBOX, r.left, r.top, r.right-r.left, r.bottom-r.top, mWindow, 0, win32.hInstance, NULL ); - + // Create the expand button - HWND button = CreateWindow ( "BUTTON", caption, WS_CHILD|BS_AUTOCHECKBOX|BS_PUSHLIKE|BS_FLAT, + HWND button = CreateWindow ( "BUTTON", caption, WS_CHILD|BS_AUTOCHECKBOX|BS_PUSHLIKE|BS_FLAT, r.left, r.top, r.right-r.left, r.bottom-r.top, mWindow, 0, win32.hInstance, NULL ); @@ -155,7 +155,7 @@ int rvRollupPanel::InsertItem ( const char* caption, HWND dialog, bool autoDestr SendMessage ( button, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0 ); // Add item to the item list - RPITEM* item = new RPITEM; + RPITEM* item = new RPITEM; item->mExpanded = false; item->mEnable = true; item->mDialog = dialog; @@ -171,11 +171,11 @@ int rvRollupPanel::InsertItem ( const char* caption, HWND dialog, bool autoDestr index = mItems.Append ( item ); } else - { + { mItems.Insert ( item, index ); } - // Store data with the dialog window in its user data + // Store data with the dialog window in its user data SetWindowLong ( dialog, GWL_USERDATA, (LONG)item ); // Attach item to button through user data @@ -197,7 +197,7 @@ int rvRollupPanel::InsertItem ( const char* caption, HWND dialog, bool autoDestr { mDialogHook = SetWindowsHookEx( WH_GETMESSAGE, GetMsgProc, NULL, GetCurrentThreadId() ); } - + mDialogs.Append ( dialog ); return index; @@ -222,7 +222,7 @@ void rvRollupPanel::RemoveItem ( int index ) _RemoveItem( index ); // update the layout - RecallLayout ( ); + RecallLayout ( ); } /* @@ -266,7 +266,7 @@ void rvRollupPanel::_RemoveItem ( int index ) } // destroy windows - if ( item->mButton ) + if ( item->mButton ) { DestroyWindow ( item->mButton ); } @@ -277,7 +277,7 @@ void rvRollupPanel::_RemoveItem ( int index ) if ( item->mDialog && item->mAutoDestroy ) { DestroyWindow ( item->mDialog ); - mDialogs.Remove ( item->mDialog ); + mDialogs.Remove ( item->mDialog ); } if ( mDialogs.Num () <= 0 ) @@ -288,7 +288,7 @@ void rvRollupPanel::_RemoveItem ( int index ) // finish up mItems.RemoveIndex ( index ); - delete item; + delete item; } /* @@ -327,7 +327,7 @@ expand or collapse the item at the given index void rvRollupPanel::ExpandAllItems( bool expand ) { int i; - + // expand all items for ( i=0; i < mItems.Num(); i ++ ) { @@ -397,12 +397,12 @@ enable/disable all items in the panel void rvRollupPanel::EnableAllItems ( bool enable ) { int i; - + for ( i=0; i < mItems.Num(); i++ ) { _EnableItem ( mItems[i], enable ); } - + RecallLayout ( ); } @@ -428,8 +428,8 @@ void rvRollupPanel::_EnableItem ( RPITEM* item, bool enable ) item->mEnable = enable; if ( item->mExpanded ) - { - mItemHeight -= (ir.bottom-ir.top); + { + mItemHeight -= (ir.bottom-ir.top); item->mExpanded = false; } } @@ -438,14 +438,14 @@ void rvRollupPanel::_EnableItem ( RPITEM* item, bool enable ) ================ rvRollupPanel::ScrollToItem -Scroll a page at the top of the Rollup Panel if top = true or just ensure -item visibility into view if top = false +Scroll a page at the top of the Rollup Panel if top = true or just ensure +item visibility into view if top = false ================ */ void rvRollupPanel::ScrollToItem ( int index, bool top ) { // safety check - if ( index >= mItems.Num() || index < 0 ) + if ( index >= mItems.Num() || index < 0 ) { return; } @@ -494,13 +494,13 @@ int rvRollupPanel::MoveItemAt ( int index, int newIndex ) index = mItems.Append( item ); } else - { + { mItems.Insert ( item, newIndex ); index = newIndex; } RecallLayout ( ); - + return index; } @@ -517,7 +517,7 @@ void rvRollupPanel::RecallLayout ( void ) RECT r; int posy; int i; - + // check StartPosY GetClientRect ( mWindow, &r ); bottomPagePos = mStartYPos + mItemHeight; @@ -532,7 +532,7 @@ void rvRollupPanel::RecallLayout ( void ) } // update layout -#ifdef DEFERPOS +#ifdef DEFERPOS HDWP hdwp; hdwp = BeginDeferWindowPos ( mItems.Num() * 3 ); #endif @@ -547,72 +547,72 @@ void rvRollupPanel::RecallLayout ( void ) EnableWindow ( item->mButton, item->mEnable ); // Expanded - if ( item->mExpanded && item->mEnable ) + if ( item->mExpanded && item->mEnable ) { RECT ir; GetWindowRect ( item->mDialog, &ir ); // update GroupBox position and size -#ifdef DEFERPOS - DeferWindowPos ( hdwp, +#ifdef DEFERPOS + DeferWindowPos ( hdwp, #else - SetWindowPos ( + SetWindowPos ( #endif - item->mGroupBox, 0, 2, posy, - (r.right-r.left)-3-RP_SCROLLBARWIDTH, - (ir.bottom-ir.top)+RP_PGBUTTONHEIGHT+RP_GRPBOXINDENT-4, + item->mGroupBox, 0, 2, posy, + (r.right-r.left)-3-RP_SCROLLBARWIDTH, + (ir.bottom-ir.top)+RP_PGBUTTONHEIGHT+RP_GRPBOXINDENT-4, SWP_NOZORDER|SWP_SHOWWINDOW); //Update Dialog position and size -#ifdef DEFERPOS - DeferWindowPos ( hdwp, +#ifdef DEFERPOS + DeferWindowPos ( hdwp, #else - SetWindowPos ( + SetWindowPos ( #endif - item->mDialog, 0, RP_GRPBOXINDENT, posy+RP_PGBUTTONHEIGHT, - (r.right-r.left)-RP_SCROLLBARWIDTH-(RP_GRPBOXINDENT*2), + item->mDialog, 0, RP_GRPBOXINDENT, posy+RP_PGBUTTONHEIGHT, + (r.right-r.left)-RP_SCROLLBARWIDTH-(RP_GRPBOXINDENT*2), ir.bottom-ir.top, SWP_NOZORDER|SWP_SHOWWINDOW); //Update Button's position and size -#ifdef DEFERPOS - DeferWindowPos ( hdwp, +#ifdef DEFERPOS + DeferWindowPos ( hdwp, #else - SetWindowPos ( + SetWindowPos ( #endif - item->mButton, 0, RP_GRPBOXINDENT, posy, - (r.right-r.left)-RP_SCROLLBARWIDTH-(RP_GRPBOXINDENT*2), + item->mButton, 0, RP_GRPBOXINDENT, posy, + (r.right-r.left)-RP_SCROLLBARWIDTH-(RP_GRPBOXINDENT*2), RP_PGBUTTONHEIGHT, SWP_NOZORDER|SWP_SHOWWINDOW); posy += (ir.bottom-ir.top) + RP_PGBUTTONHEIGHT; - } + } // collapsed - else + else { // update GroupBox position and size -#ifdef DEFERPOS - DeferWindowPos ( hdwp, +#ifdef DEFERPOS + DeferWindowPos ( hdwp, #else - SetWindowPos ( + SetWindowPos ( #endif - item->mGroupBox, 0, 2, posy, + item->mGroupBox, 0, 2, posy, (r.right-r.left)-3-RP_SCROLLBARWIDTH, 16, SWP_NOZORDER|SWP_SHOWWINDOW); // update Dialog position and size -#ifdef DEFERPOS - DeferWindowPos ( hdwp, +#ifdef DEFERPOS + DeferWindowPos ( hdwp, #else - SetWindowPos ( + SetWindowPos ( #endif item->mDialog, 0, RP_GRPBOXINDENT, 0, 0, 0,SWP_NOZORDER|SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE); // update Button's position and size -#ifdef DEFERPOS - DeferWindowPos ( hdwp, +#ifdef DEFERPOS + DeferWindowPos ( hdwp, #else - SetWindowPos ( + SetWindowPos ( #endif - item->mButton, 0, RP_GRPBOXINDENT, posy, - (r.right-r.left)-RP_SCROLLBARWIDTH-(RP_GRPBOXINDENT*2), + item->mButton, 0, RP_GRPBOXINDENT, posy, + (r.right-r.left)-RP_SCROLLBARWIDTH-(RP_GRPBOXINDENT*2), RP_PGBUTTONHEIGHT, SWP_NOZORDER|SWP_SHOWWINDOW); posy += RP_PGBUTTONHEIGHT; @@ -621,14 +621,14 @@ void rvRollupPanel::RecallLayout ( void ) posy += (RP_GRPBOXINDENT/2); } - -#ifdef DEFERPOS + +#ifdef DEFERPOS EndDeferWindowPos ( hdwp ); #endif // update Scroll Bar RECT br; - SetRect ( &br, r.right-RP_SCROLLBARWIDTH,r.top,r.right,r.bottom); + SetRect ( &br, r.right-RP_SCROLLBARWIDTH,r.top,r.right,r.bottom); InvalidateRect( mWindow, &br, FALSE ); UpdateWindow ( mWindow ); } @@ -643,7 +643,7 @@ Return -1 if no matching item was found, otherwise the index of the item int rvRollupPanel::GetItemIndex ( HWND wnd ) { int i; - + //Search matching button's hwnd for ( i=0; i < mItems.Num(); i++ ) { @@ -659,7 +659,7 @@ int rvRollupPanel::GetItemIndex ( HWND wnd ) int rvRollupPanel::GetItemIndex ( const char* caption ) { int i; - + //Search matching button's hwnd for ( i=0; i < mItems.Num(); i++ ) { @@ -682,7 +682,7 @@ Return NULL if the index is invalid RPITEM* rvRollupPanel::GetItem ( int index ) { // safety check - if ( index >= mItems.Num() || index < 0 ) + if ( index >= mItems.Num() || index < 0 ) { return NULL; } @@ -707,7 +707,7 @@ LRESULT CALLBACK rvRollupPanel::DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, if ( _this->mItemHeight > r.bottom-r.top ) { - switch (uMsg) + switch (uMsg) { case WM_LBUTTONDOWN: case WM_MBUTTONDOWN: @@ -723,15 +723,15 @@ LRESULT CALLBACK rvRollupPanel::DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, case WM_MBUTTONUP: { if ( ::GetCapture() == hWnd ) - { - ::ReleaseCapture(); - return 0; + { + ::ReleaseCapture(); + return 0; } break; } case WM_MOUSEMOVE: - if ( (::GetCapture() == hWnd) && (wParam==MK_LBUTTON || wParam==MK_MBUTTON)) + if ( (::GetCapture() == hWnd) && (wParam==MK_LBUTTON || wParam==MK_MBUTTON)) { POINT pos; GetCursorPos(&pos); @@ -746,9 +746,9 @@ LRESULT CALLBACK rvRollupPanel::DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, case WM_SETCURSOR: if ( (HWND)wParam == hWnd) - { - SetCursor ( LoadCursor (NULL, RP_ROLLCURSOR) ); - return TRUE; + { + SetCursor ( LoadCursor (NULL, RP_ROLLCURSOR) ); + return TRUE; } break; } @@ -771,7 +771,7 @@ LRESULT CALLBACK rvRollupPanel::ButtonProc (HWND hWnd, UINT uMsg, WPARAM wParam, return FALSE; } - RPITEM* item = (RPITEM*)GetWindowLong(hWnd, GWL_USERDATA); + RPITEM* item = (RPITEM*)GetWindowLong(hWnd, GWL_USERDATA); return ::CallWindowProc( item->mOldButtonProc, hWnd, uMsg, wParam, lParam ); } @@ -785,8 +785,8 @@ Window procedure for rollup panel LRESULT CALLBACK rvRollupPanel::WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { rvRollupPanel* panel; - panel = (rvRollupPanel*)GetWindowLong (hWnd, GWL_USERDATA); - + panel = (rvRollupPanel*)GetWindowLong (hWnd, GWL_USERDATA); + switch ( uMsg ) { case WM_CREATE: @@ -799,41 +799,41 @@ LRESULT CALLBACK rvRollupPanel::WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, SetWindowLong ( hWnd, GWL_USERDATA, (LONG)panel ); break; } - + case WM_COMMAND: panel->HandleCommand ( wParam, lParam ); break; - + case WM_PAINT: - return panel->HandlePaint ( wParam, lParam ); - + return panel->HandlePaint ( wParam, lParam ); + case WM_SIZE: return panel->HandleSize ( wParam, lParam ); - + case WM_LBUTTONDOWN: panel->HandleLButtonDown ( wParam, lParam ); break; - + case WM_LBUTTONUP: panel->HandleLButtonUp ( wParam, lParam ); break; - + case WM_MOUSEMOVE: panel->HandleMouseMove ( wParam, lParam ); break; - + case WM_MOUSEWHEEL: panel->HandleMouseWheel ( wParam, lParam ); break; - + case WM_MOUSEACTIVATE: panel->HandleMouseActivate ( wParam, lParam ); break; - + case WM_CONTEXTMENU: - return panel->HandleContextMenu ( wParam, lParam ); + return panel->HandleContextMenu ( wParam, lParam ); } - + return DefWindowProc ( hWnd, uMsg, wParam, lParam ); } @@ -844,7 +844,7 @@ rvRollupPanel::HandleCommand Handle the WM_COMMAND message ================ */ -int rvRollupPanel::HandleCommand ( WPARAM wParam, LPARAM lParam ) +int rvRollupPanel::HandleCommand ( WPARAM wParam, LPARAM lParam ) { // popup menu command to expand or collapse pages if ( LOWORD(wParam) == RP_IDM_EXPANDALL ) @@ -857,7 +857,7 @@ int rvRollupPanel::HandleCommand ( WPARAM wParam, LPARAM lParam ) } // popupMenu command to expand page - else if ( LOWORD(wParam) >= RP_IDM_STARTITEMS && + else if ( LOWORD(wParam) >= RP_IDM_STARTITEMS && LOWORD(wParam) < RP_IDM_STARTITEMS + GetItemCount ( ) ) { int index = LOWORD(wParam)-RP_IDM_STARTITEMS; @@ -868,7 +868,7 @@ int rvRollupPanel::HandleCommand ( WPARAM wParam, LPARAM lParam ) else if ( HIWORD(wParam) == BN_CLICKED ) { int index = GetItemIndex ((HWND)lParam); - if ( index != -1 ) + if ( index != -1 ) { ExpandItem ( index, !IsItemExpanded ( index ) ); return 0; @@ -885,7 +885,7 @@ rvRollupPanel::HandlePaint Handle the WM_PAINT message ================ */ -int rvRollupPanel::HandlePaint( WPARAM wParam, LPARAM lParam ) +int rvRollupPanel::HandlePaint( WPARAM wParam, LPARAM lParam ) { HDC dc; PAINTSTRUCT ps; @@ -894,7 +894,7 @@ int rvRollupPanel::HandlePaint( WPARAM wParam, LPARAM lParam ) int sbPos; int sbSize; int clientHeight; - + dc = BeginPaint ( mWindow, &ps ); // scrollbar @@ -906,12 +906,12 @@ int rvRollupPanel::HandlePaint( WPARAM wParam, LPARAM lParam ) sbSize = 0; clientHeight = (r.bottom-r.top) - 4; - if ( mItemHeight > (r.bottom-r.top) ) + if ( mItemHeight > (r.bottom-r.top) ) { sbSize = clientHeight - (((mItemHeight-(r.bottom-r.top)) * clientHeight ) / mItemHeight ); sbPos = -(mStartYPos * clientHeight) / mItemHeight; - } - else + } + else { sbSize = clientHeight; } @@ -931,7 +931,7 @@ int rvRollupPanel::HandlePaint( WPARAM wParam, LPARAM lParam ) SetRect ( &r, br.left,br.bottom,br.right,2+clientHeight ); FillRect ( dc, &r, (HBRUSH)GetStockObject ( BLACK_BRUSH ) ); - + return 0; } @@ -956,12 +956,12 @@ rvRollupPanel::HandleLButtonDown Handle the WM_LBUTTONDOWN message ================ */ -int rvRollupPanel::HandleLButtonDown ( WPARAM wParam, LPARAM lParam ) +int rvRollupPanel::HandleLButtonDown ( WPARAM wParam, LPARAM lParam ) { RECT r; RECT br; POINT point; - + GetClientRect ( mWindow, &r ); if ( mItemHeight <= r.bottom - r.top ) { @@ -973,7 +973,7 @@ int rvRollupPanel::HandleLButtonDown ( WPARAM wParam, LPARAM lParam ) SetRect ( &br, r.right - RP_SCROLLBARWIDTH, r.top, r.right, r.bottom ); - if ( (wParam & MK_LBUTTON) && PtInRect ( &br, point ) ) + if ( (wParam & MK_LBUTTON) && PtInRect ( &br, point ) ) { SetCapture( mWindow ); @@ -983,16 +983,16 @@ int rvRollupPanel::HandleLButtonDown ( WPARAM wParam, LPARAM lParam ) int sbPos = -(mStartYPos * clientHeight) / mItemHeight; // click inside scrollbar cursor - if ( (point.y < (sbPos + sbSize)) && (point.y > sbPos )) + if ( (point.y < (sbPos + sbSize)) && (point.y > sbPos )) { - mSBOffset = sbPos - point.y + 1; - } + mSBOffset = sbPos - point.y + 1; + } // click outside scrollbar cursor (2 cases => above or below cursor) - else + else { - int distup = point.y - sbPos; + int distup = point.y - sbPos; int distdown = (sbPos + sbSize) - point.y; - + if ( distup < distdown ) { //above @@ -1012,7 +1012,7 @@ int rvRollupPanel::HandleLButtonDown ( WPARAM wParam, LPARAM lParam ) // update RecallLayout(); } - + return 0; } @@ -1023,13 +1023,13 @@ rvRollupPanel::HandleLButtonUp Handle the WM_LBUTTONUP message ================ */ -int rvRollupPanel::HandleLButtonUp ( WPARAM wParam, LPARAM lParam ) +int rvRollupPanel::HandleLButtonUp ( WPARAM wParam, LPARAM lParam ) { if ( GetCapture() == mWindow ) { ReleaseCapture(); } - + return 0; } @@ -1040,12 +1040,12 @@ rvRollupPanel::HandleMouseMove Handle the WM_MOUSEMOVE message ================ */ -int rvRollupPanel::HandleMouseMove ( WPARAM wParam, LPARAM lParam ) +int rvRollupPanel::HandleMouseMove ( WPARAM wParam, LPARAM lParam ) { RECT r; RECT br; POINT point; - + GetClientRect ( mWindow, &r ); if ( mItemHeight <= r.bottom - r.top ) { @@ -1057,17 +1057,17 @@ int rvRollupPanel::HandleMouseMove ( WPARAM wParam, LPARAM lParam ) SetRect ( &br, r.right - RP_SCROLLBARWIDTH, r.top, r.right, r.bottom ); - if ( (wParam & MK_LBUTTON) && (GetCapture() == mWindow )) + if ( (wParam & MK_LBUTTON) && (GetCapture() == mWindow )) { // calc new m_nStartYPos from mouse pos int clientHeight = (r.bottom-r.top) - 4; int targetPos = point.y + mSBOffset; - + mStartYPos =- (targetPos * mItemHeight) / clientHeight; RecallLayout ( ); - - InvalidateRect ( mWindow, NULL, FALSE ); + + InvalidateRect ( mWindow, NULL, FALSE ); // UpdateWindow ( mWindow ); } @@ -1081,7 +1081,7 @@ rvRollupPanel::HandleMouseWheel Handle the WM_MOUSEWHEEL message ================ */ -int rvRollupPanel::HandleMouseWheel ( WPARAM wParam, LPARAM lParam ) +int rvRollupPanel::HandleMouseWheel ( WPARAM wParam, LPARAM lParam ) { // calc new m_nStartYPos mStartYPos += (HIWORD(wParam) / 4); @@ -1098,7 +1098,7 @@ rvRollupPanel::HandleMouseActivate Handle the WM_MOUSEACTIVATE message ================ */ -int rvRollupPanel::HandleMouseActivate ( WPARAM wParam, LPARAM lParam ) +int rvRollupPanel::HandleMouseActivate ( WPARAM wParam, LPARAM lParam ) { SetFocus ( mWindow ); return 0; @@ -1116,7 +1116,7 @@ int rvRollupPanel::HandleContextMenu ( WPARAM wParam, LPARAM lParam ) HMENU menu; int i; POINT point; - + menu = CreatePopupMenu ( ); if ( !menu ) { @@ -1135,7 +1135,7 @@ int rvRollupPanel::HandleContextMenu ( WPARAM wParam, LPARAM lParam ) { char itemName[1024]; GetWindowText ( mItems[i]->mButton, itemName, 1023 ); - AppendMenu ( menu, MF_STRING, RP_IDM_STARTITEMS + i, itemName ); + AppendMenu ( menu, MF_STRING, RP_IDM_STARTITEMS + i, itemName ); if ( mItems[i]->mExpanded ) { @@ -1144,7 +1144,7 @@ int rvRollupPanel::HandleContextMenu ( WPARAM wParam, LPARAM lParam ) TrackPopupMenu ( menu, TPM_LEFTALIGN|TPM_LEFTBUTTON, point.x, point.y, 0, mWindow, NULL ); } - + return 0; } @@ -1169,9 +1169,9 @@ LRESULT FAR PASCAL rvRollupPanel::GetMsgProc ( int nCode, WPARAM wParam, LPARAM { if ( IsDialogMessage( mDialogs[i], lpMsg) ) { - // The value returned from this hookproc is ignored, + // The value returned from this hookproc is ignored, // and it cannot be used to tell Windows the message has been handled. - // To avoid further processing, convert the message to WM_NULL + // To avoid further processing, convert the message to WM_NULL // before returning. lpMsg->message = WM_NULL; lpMsg->lParam = 0; @@ -1183,7 +1183,7 @@ LRESULT FAR PASCAL rvRollupPanel::GetMsgProc ( int nCode, WPARAM wParam, LPARAM } return CallNextHookEx ( mDialogHook, nCode, wParam, lParam); -} +} /* ================ @@ -1207,9 +1207,8 @@ void rvRollupPanel::AutoSize ( void ) width = w; } } - + RECT cr; GetWindowRect ( mWindow, &cr ); SetWindowPos ( mWindow, NULL, 0, 0, width, cr.bottom-cr.top, SWP_NOMOVE|SWP_NOZORDER ); } - diff --git a/neo/tools/common/RollupPanel.h b/neo/tools/common/RollupPanel.h index b9f21500..1a754ab6 100644 --- a/neo/tools/common/RollupPanel.h +++ b/neo/tools/common/RollupPanel.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"). @@ -75,14 +75,14 @@ public: int MoveItemAt ( int index, int newIndex ); bool IsItemExpanded ( int index ); bool IsItemEnabled ( int index ); - + HWND GetWindow ( void ); - + void AutoSize ( void ); protected: - void RecallLayout ( void ); + void RecallLayout ( void ); void _RemoveItem ( int index ); void _ExpandItem ( RPITEM* item, bool expand ); void _EnableItem ( RPITEM* item, bool enable ); @@ -94,8 +94,8 @@ protected: int HandleLButtonUp ( WPARAM wParam, LPARAM lParam ); int HandleMouseMove ( WPARAM wParam, LPARAM lParam ); int HandleMouseWheel ( WPARAM wParam, LPARAM lParam ); - int HandleMouseActivate ( WPARAM wParam, LPARAM lParam ); - int HandleContextMenu ( WPARAM wParam, LPARAM lParam ); + int HandleMouseActivate ( WPARAM wParam, LPARAM lParam ); + int HandleContextMenu ( WPARAM wParam, LPARAM lParam ); // Datas idList mItems; @@ -109,15 +109,15 @@ protected: static LRESULT CALLBACK WindowProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); static LRESULT CALLBACK DialogProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); static LRESULT CALLBACK ButtonProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); - + static LRESULT FAR PASCAL GetMsgProc ( int nCode, WPARAM wParam, LPARAM lParam ); - static idList mDialogs; + static idList mDialogs; static HHOOK mDialogHook; }; ID_INLINE int rvRollupPanel::GetItemCount ( void ) { - return mItems.Num(); + return mItems.Num(); } ID_INLINE bool rvRollupPanel::IsItemExpanded ( int index ) diff --git a/neo/tools/common/SpinButton.cpp b/neo/tools/common/SpinButton.cpp index 052c9d50..f2b78fb4 100644 --- a/neo/tools/common/SpinButton.cpp +++ b/neo/tools/common/SpinButton.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"). @@ -38,19 +38,19 @@ void SpinButton_SetIncrement ( HWND hWnd, float inc ) void SpinButton_SetRange ( HWND hWnd, float minRange, float maxRange ) { - SendMessage ( hWnd, UDM_SETRANGE32, (LONG)(minRange*100.0f), (LONG)(maxRange*100.0f) ); + SendMessage ( hWnd, UDM_SETRANGE32, (LONG)(minRange*100.0f), (LONG)(maxRange*100.0f) ); } void SpinButton_HandleNotify ( NMHDR* hdr ) { - // Return if incorrect data in edit box + // Return if incorrect data in edit box NM_UPDOWN* udhdr= (NM_UPDOWN*)hdr; - // Change with 0.1 on each click + // Change with 0.1 on each click char strValue[64]; - float value; + float value; GetWindowText ( (HWND)SendMessage ( hdr->hwndFrom, UDM_GETBUDDY, 0, 0 ), strValue, 63 ); - + float inc = (float)GetWindowLong ( hdr->hwndFrom, GWL_USERDATA ); if ( inc == 0 ) { @@ -58,20 +58,20 @@ void SpinButton_HandleNotify ( NMHDR* hdr ) SetWindowLong ( hdr->hwndFrom, GWL_USERDATA, 100 ); } inc /= 100.0f; - + if ( GetAsyncKeyState ( VK_SHIFT ) & 0x8000 ) { inc *= 10.0f; } - - value = atof(strValue); + + value = atof(strValue); value += (udhdr->iDelta)*(inc); - // Avoid round-off errors + // Avoid round-off errors value = floor(value*1e3+0.5)/1e3; - + LONG minRange; - LONG maxRange; + LONG maxRange; SendMessage ( hdr->hwndFrom, UDM_GETRANGE32, (LONG)&minRange, (LONG)&maxRange ); if ( minRange != 0 || maxRange != 0 ) { @@ -84,8 +84,8 @@ void SpinButton_HandleNotify ( NMHDR* hdr ) if ( value < minRangef ) { value = minRangef; - } + } } - + SetWindowText ( (HWND)SendMessage ( hdr->hwndFrom, UDM_GETBUDDY, 0, 0 ), va("%g",value) ); } diff --git a/neo/tools/common/SpinButton.h b/neo/tools/common/SpinButton.h index e393a9b5..8f174b54 100644 --- a/neo/tools/common/SpinButton.h +++ b/neo/tools/common/SpinButton.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/neo/tools/compilers/aas/AASBuild.cpp b/neo/tools/compilers/aas/AASBuild.cpp index 4a9a451e..c8efc273 100644 --- a/neo/tools/compilers/aas/AASBuild.cpp +++ b/neo/tools/compilers/aas/AASBuild.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/neo/tools/compilers/aas/AASBuild_file.cpp b/neo/tools/compilers/aas/AASBuild_file.cpp index 62ba8d56..d37b19c0 100644 --- a/neo/tools/compilers/aas/AASBuild_file.cpp +++ b/neo/tools/compilers/aas/AASBuild_file.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"). @@ -117,7 +117,7 @@ idAASBuild::GetVertex bool idAASBuild::GetVertex( const idVec3 &v, int *vertexNum ) { int i, hashKey, vn; aasVertex_t vert, *p; - + for (i = 0; i < 3; i++) { if ( idMath::Fabs(v[i] - idMath::Rint(v[i])) < INTEGRAL_EPSILON ) { vert[i] = idMath::Rint(v[i]); diff --git a/neo/tools/compilers/aas/AASBuild_gravity.cpp b/neo/tools/compilers/aas/AASBuild_gravity.cpp index 7dfaaf7c..63638ba2 100644 --- a/neo/tools/compilers/aas/AASBuild_gravity.cpp +++ b/neo/tools/compilers/aas/AASBuild_gravity.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/neo/tools/compilers/aas/AASBuild_ledge.cpp b/neo/tools/compilers/aas/AASBuild_ledge.cpp index 05f3e606..b1aaec52 100644 --- a/neo/tools/compilers/aas/AASBuild_ledge.cpp +++ b/neo/tools/compilers/aas/AASBuild_ledge.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/neo/tools/compilers/aas/AASBuild_local.h b/neo/tools/compilers/aas/AASBuild_local.h index 1c3c77f4..bc8b2869 100644 --- a/neo/tools/compilers/aas/AASBuild_local.h +++ b/neo/tools/compilers/aas/AASBuild_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/neo/tools/compilers/aas/AASBuild_merge.cpp b/neo/tools/compilers/aas/AASBuild_merge.cpp index 22e7ab2a..96cd7fdb 100644 --- a/neo/tools/compilers/aas/AASBuild_merge.cpp +++ b/neo/tools/compilers/aas/AASBuild_merge.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/neo/tools/compilers/aas/AASCluster.cpp b/neo/tools/compilers/aas/AASCluster.cpp index f7dd1b17..2f07374e 100644 --- a/neo/tools/compilers/aas/AASCluster.cpp +++ b/neo/tools/compilers/aas/AASCluster.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/neo/tools/compilers/aas/AASCluster.h b/neo/tools/compilers/aas/AASCluster.h index ea437d03..4cd7611e 100644 --- a/neo/tools/compilers/aas/AASCluster.h +++ b/neo/tools/compilers/aas/AASCluster.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"). @@ -25,7 +25,7 @@ If you have questions concerning this license or the applicable additional terms =========================================================================== */ - + #ifndef __AASCLUSTER_H__ #define __AASCLUSTER_H__ diff --git a/neo/tools/compilers/aas/AASFile.cpp b/neo/tools/compilers/aas/AASFile.cpp index 6a287fca..6b92e0b8 100644 --- a/neo/tools/compilers/aas/AASFile.cpp +++ b/neo/tools/compilers/aas/AASFile.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/neo/tools/compilers/aas/AASFile.h b/neo/tools/compilers/aas/AASFile.h index 76d1dc21..d066f6e2 100644 --- a/neo/tools/compilers/aas/AASFile.h +++ b/neo/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/neo/tools/compilers/aas/AASFileManager.cpp b/neo/tools/compilers/aas/AASFileManager.cpp index cd779c98..e66a6d9e 100644 --- a/neo/tools/compilers/aas/AASFileManager.cpp +++ b/neo/tools/compilers/aas/AASFileManager.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/neo/tools/compilers/aas/AASFileManager.h b/neo/tools/compilers/aas/AASFileManager.h index 8ca1d379..a3abaf82 100644 --- a/neo/tools/compilers/aas/AASFileManager.h +++ b/neo/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/neo/tools/compilers/aas/AASFile_local.h b/neo/tools/compilers/aas/AASFile_local.h index 5f717ea3..110e60f0 100644 --- a/neo/tools/compilers/aas/AASFile_local.h +++ b/neo/tools/compilers/aas/AASFile_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"). @@ -43,7 +43,7 @@ class idAASFileLocal : public idAASFile { friend class idAASCluster; public: idAASFileLocal( void ); - virtual ~idAASFileLocal( void ); + virtual ~idAASFileLocal( void ); public: virtual idVec3 EdgeCenter( int edgeNum ) const; diff --git a/neo/tools/compilers/aas/AASFile_optimize.cpp b/neo/tools/compilers/aas/AASFile_optimize.cpp index 6b3f1d1c..7a25d315 100644 --- a/neo/tools/compilers/aas/AASFile_optimize.cpp +++ b/neo/tools/compilers/aas/AASFile_optimize.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/neo/tools/compilers/aas/AASFile_sample.cpp b/neo/tools/compilers/aas/AASFile_sample.cpp index 76256355..907d383a 100644 --- a/neo/tools/compilers/aas/AASFile_sample.cpp +++ b/neo/tools/compilers/aas/AASFile_sample.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"). @@ -391,7 +391,7 @@ bool idAASFileLocal::Trace( aasTrace_t &trace, const idVec3 &start, const idVec3 tstack_p->planeNum = 0; tstack_p->nodeNum = 1; //start with the root of the tree tstack_p++; - + while( 1 ) { tstack_p--; diff --git a/neo/tools/compilers/aas/AASReach.cpp b/neo/tools/compilers/aas/AASReach.cpp index e678b285..6fa2c798 100644 --- a/neo/tools/compilers/aas/AASReach.cpp +++ b/neo/tools/compilers/aas/AASReach.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/neo/tools/compilers/aas/AASReach.h b/neo/tools/compilers/aas/AASReach.h index 1ec827be..2545f0ca 100644 --- a/neo/tools/compilers/aas/AASReach.h +++ b/neo/tools/compilers/aas/AASReach.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/neo/tools/compilers/aas/Brush.cpp b/neo/tools/compilers/aas/Brush.cpp index 29986212..5560968b 100644 --- a/neo/tools/compilers/aas/Brush.cpp +++ b/neo/tools/compilers/aas/Brush.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/neo/tools/compilers/aas/Brush.h b/neo/tools/compilers/aas/Brush.h index 54c66a22..d04b6db1 100644 --- a/neo/tools/compilers/aas/Brush.h +++ b/neo/tools/compilers/aas/Brush.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/neo/tools/compilers/aas/BrushBSP.cpp b/neo/tools/compilers/aas/BrushBSP.cpp index eb4bad8d..05255912 100644 --- a/neo/tools/compilers/aas/BrushBSP.cpp +++ b/neo/tools/compilers/aas/BrushBSP.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"). @@ -90,7 +90,7 @@ void idBrushBSPPortal::AddToNodes( idBrushBSPNode *front, idBrushBSPNode *back ) nodes[0] = front; next[0] = front->portals; front->portals = this; - + nodes[1] = back; next[1] = back->portals; back->portals = this; @@ -127,13 +127,13 @@ void idBrushBSPPortal::RemoveFromNode( idBrushBSPNode *l ) { common->Error( "idBrushBSPPortal::RemoveFromNode: portal not bounding node" ); } } - + if ( nodes[0] == l ) { *pp = next[0]; nodes[0] = NULL; } else if ( nodes[1] == l ) { - *pp = next[1]; + *pp = next[1]; nodes[1] = NULL; } else { @@ -1226,7 +1226,7 @@ void idBrushBSP::SplitNodePortals( idBrushBSPNode *node ) { } continue; } - + // the winding is split newPortal = new idBrushBSPPortal(); *newPortal = *p; @@ -1326,7 +1326,7 @@ void idBrushBSP::MakeOutsidePortals( void ) { portals[n] = p; } } - + // clip the base windings with all the other planes for ( i = 0; i < 6; i++ ) { for ( j = 0; j < 6; j++ ) { @@ -1663,7 +1663,7 @@ void idBrushBSP::MergeLeafNodePortals( idBrushBSPNode *node, int skipContents ) nextp2 = p2->Next(s2); // if both portals seperate the same leaf nodes - if ( p1->nodes[!s1] == p2->nodes[!s2] ) { + if ( p1->nodes[!s1] == p2->nodes[!s2] ) { // add the winding of p2 to the winding of p1 p1->winding->AddToConvexHull( p2->winding, p1->plane.Normal() ); @@ -1943,7 +1943,7 @@ bool idBrushBSP::TryMergeLeafNodes( idBrushBSPPortal *portal, int side ) { for ( p = node1->portals; p; p = nextp ) { s = (p->nodes[1] == node1); nextp = p->next[s]; - + if ( p->nodes[!s] == node2 ) { p->RemoveFromNode( p->nodes[0] ); p->RemoveFromNode( p->nodes[1] ); @@ -1995,7 +1995,7 @@ void idBrushBSP::MeltFlood_r( idBrushBSPNode *node, int skipContents, idBounds & for ( p1 = node->GetPortals(); p1; p1 = p1->Next(s1) ) { s1 = (p1->GetNode(1) == node); - + if ( p1->GetNode( !s1 )->GetFlags() & NODE_VISITED ) { continue; } diff --git a/neo/tools/compilers/aas/BrushBSP.h b/neo/tools/compilers/aas/BrushBSP.h index 806f390d..c21d1ec7 100644 --- a/neo/tools/compilers/aas/BrushBSP.h +++ b/neo/tools/compilers/aas/BrushBSP.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/neo/tools/compilers/compiler_public.h b/neo/tools/compilers/compiler_public.h index 383f8289..cdb8d30e 100644 --- a/neo/tools/compilers/compiler_public.h +++ b/neo/tools/compilers/compiler_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"). diff --git a/neo/tools/compilers/dmap/dmap.cpp b/neo/tools/compilers/dmap/dmap.cpp index 5e1894e1..916e134a 100644 --- a/neo/tools/compilers/dmap/dmap.cpp +++ b/neo/tools/compilers/dmap/dmap.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"). @@ -147,13 +147,13 @@ DmapHelp */ void DmapHelp( void ) { common->Printf( - + "Usage: dmap [options] mapfile\n" "Options:\n" "noCurves = don't process curves\n" "noCM = don't create collision map\n" "noAAS = don't create AAS files\n" - + ); } diff --git a/neo/tools/compilers/dmap/dmap.h b/neo/tools/compilers/dmap/dmap.h index b37fd5ea..f8274761 100644 --- a/neo/tools/compilers/dmap/dmap.h +++ b/neo/tools/compilers/dmap/dmap.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"). @@ -309,7 +309,7 @@ node_t *AllocNode( void ); // map.cpp -bool LoadDMapFile( const char *filename ); +bool LoadDMapFile( const char *filename ); void FreeOptimizeGroupList( optimizeGroup_t *groups ); void FreeDMapFile( void ); diff --git a/neo/tools/compilers/dmap/facebsp.cpp b/neo/tools/compilers/dmap/facebsp.cpp index 42804302..d09e41d6 100644 --- a/neo/tools/compilers/dmap/facebsp.cpp +++ b/neo/tools/compilers/dmap/facebsp.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"). @@ -496,4 +496,3 @@ bspface_t *MakeVisibleBspFaceList( primitive_t *list ) { return flist; } - diff --git a/neo/tools/compilers/dmap/gldraw.cpp b/neo/tools/compilers/dmap/gldraw.cpp index c1ea1a56..383052fa 100644 --- a/neo/tools/compilers/dmap/gldraw.cpp +++ b/neo/tools/compilers/dmap/gldraw.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,12 +65,12 @@ void Draw_ClearWindow( void ) { g = w > h ? w : h; glLoadIdentity (); - gluPerspective (90, 1, 2, 16384); + gluPerspective (90, 1, 2, 16384); gluLookAt (mx, my, draw_maxs[2] + g/2, mx , my, draw_maxs[2], 0, 1, 0); #else glMatrixMode( GL_PROJECTION ); glLoadIdentity (); - glOrtho( dmapGlobals.drawBounds[0][0], dmapGlobals.drawBounds[1][0], + glOrtho( dmapGlobals.drawBounds[0][0], dmapGlobals.drawBounds[1][0], dmapGlobals.drawBounds[0][1], dmapGlobals.drawBounds[1][1], -1, 1 ); glMatrixMode( GL_MODELVIEW ); @@ -182,7 +182,7 @@ void DrawLine( idVec3 v1, idVec3 v2, int color ) { case 6: glColor3f( 1, 1, 0 ); break; case 7: glColor3f( 1, 1, 1 ); break; } - + glBegin( GL_LINES ); @@ -203,7 +203,7 @@ int draw_socket; void GLS_BeginScene (void) { WSADATA winsockdata; - WORD wVersionRequested; + WORD wVersionRequested; struct sockaddr_in address; int r; @@ -211,7 +211,7 @@ void GLS_BeginScene (void) { wins_init = true; - wVersionRequested = MAKEWORD(1, 1); + wVersionRequested = MAKEWORD(1, 1); r = WSAStartup (MAKEWORD(1, 1), &winsockdata); diff --git a/neo/tools/compilers/dmap/glfile.cpp b/neo/tools/compilers/dmap/glfile.cpp index 5db457e4..b470007a 100644 --- a/neo/tools/compilers/dmap/glfile.cpp +++ b/neo/tools/compilers/dmap/glfile.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"). @@ -155,4 +155,3 @@ void WriteGLView( tree_t *tree, char *source ) common->Printf( "%5i c_glfaces\n", c_glfaces ); } - diff --git a/neo/tools/compilers/dmap/leakfile.cpp b/neo/tools/compilers/dmap/leakfile.cpp index 59c34555..7cbe5ae5 100644 --- a/neo/tools/compilers/dmap/leakfile.cpp +++ b/neo/tools/compilers/dmap/leakfile.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,4 +109,3 @@ void LeakFile (tree_t *tree) fclose (linefile); } - diff --git a/neo/tools/compilers/dmap/map.cpp b/neo/tools/compilers/dmap/map.cpp index 1660b08b..17486a42 100644 --- a/neo/tools/compilers/dmap/map.cpp +++ b/neo/tools/compilers/dmap/map.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,13 +35,13 @@ If you have questions concerning this license or the applicable additional terms After parsing, there will be a list of entities that each has a list of primitives. - + Primitives are either brushes, triangle soups, or model references. Curves are tesselated to triangle soups at load time, but model - references are - Brushes will have - + references are + Brushes will have + brushes, each of which has a side definition. */ @@ -219,7 +219,7 @@ static void AdjustEntityForOrigin( uEntity_t *ent ) { plane = dmapGlobals.mapPlanes[s->planenum]; plane[3] += plane.Normal() * ent->origin; - + s->planenum = FindFloatPlane( plane ); s->texVec.v[0][3] += DotProduct( ent->origin, s->texVec.v[0] ); @@ -510,7 +510,7 @@ static void CreateMapLights( const idMapFile *dmapFile ) { LoadDMapFile ================ */ -bool LoadDMapFile( const char *filename ) { +bool LoadDMapFile( const char *filename ) { primitive_t *prim; idBounds mapBounds; int brushes, triSurfs; @@ -518,7 +518,7 @@ bool LoadDMapFile( const char *filename ) { int size; common->Printf( "--- LoadDMapFile ---\n" ); - common->Printf( "loading %s\n", filename ); + common->Printf( "loading %s\n", filename ); // load and parse the map file into canonical form dmapGlobals.dmapFile = new idMapFile(); diff --git a/neo/tools/compilers/dmap/optimize.cpp b/neo/tools/compilers/dmap/optimize.cpp index decc23c8..811e5f3b 100644 --- a/neo/tools/compilers/dmap/optimize.cpp +++ b/neo/tools/compilers/dmap/optimize.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"). @@ -212,7 +212,7 @@ static optVertex_t *FindOptVertex( idDrawVert *v, optimizeGroup_t *opt ) { common->Error( "MAX_OPT_VERTEXES" ); return NULL; } - + numOptVerts++; vert = &optVerts[i]; @@ -345,7 +345,7 @@ This should only be called if PointsStraddleLine returned true Will return NULL if the lines are colinear ==================== */ -static optVertex_t *EdgeIntersection( const optVertex_t *p1, const optVertex_t *p2, +static optVertex_t *EdgeIntersection( const optVertex_t *p1, const optVertex_t *p2, const optVertex_t *l1, const optVertex_t *l2, optimizeGroup_t *opt ) { float f; idDrawVert *v; @@ -715,7 +715,7 @@ static void RemoveIfColinear( optVertex_t *ov, optIsland_t *island ) { // sliver triangle out of existance, and all the edges // can be removed for ( e = island->edges ; e ; e = e->islandLink ) { - if ( ( e->v1 == v1 && e->v2 == v3 ) + if ( ( e->v1 == v1 && e->v2 == v3 ) || ( e->v1 == v3 && e->v2 == v1 ) ) { UnlinkEdge( e, island ); RemoveIfColinear( v1, island ); @@ -1183,7 +1183,7 @@ for ( e1 = ov->edges ; e1 ; e1 = e1Next ) { continue; } - if ( IsTriangleValid( ov, second, middle ) + if ( IsTriangleValid( ov, second, middle ) && IsTriangleValid( ov, middle, third ) ) { break; // should use the subdivided ones } @@ -1516,7 +1516,7 @@ void SplitOriginalEdgesAtCrossings( optimizeGroup_t *opt ) { newVert = EdgeIntersection( v1, v2, v3, v4, opt ); if ( !newVert ) { -//common->Printf( "lines %i (%i to %i) and %i (%i to %i) are colinear\n", i, v1 - optVerts, v2 - optVerts, +//common->Printf( "lines %i (%i to %i) and %i (%i to %i) are colinear\n", i, v1 - optVerts, v2 - optVerts, // j, v3 - optVerts, v4 - optVerts ); // !@# // colinear, so add both verts of each edge to opposite if ( VertexBetween( v3, v1, v2 ) ) { @@ -1551,10 +1551,10 @@ void SplitOriginalEdgesAtCrossings( optimizeGroup_t *opt ) { } #if 0 if ( newVert && newVert != v1 && newVert != v2 && newVert != v3 && newVert != v4 ) { -common->Printf( "lines %i (%i to %i) and %i (%i to %i) cross at new point %i\n", i, v1 - optVerts, v2 - optVerts, +common->Printf( "lines %i (%i to %i) and %i (%i to %i) cross at new point %i\n", i, v1 - optVerts, v2 - optVerts, j, v3 - optVerts, v4 - optVerts, newVert - optVerts ); } else if ( newVert ) { -common->Printf( "lines %i (%i to %i) and %i (%i to %i) intersect at old point %i\n", i, v1 - optVerts, v2 - optVerts, +common->Printf( "lines %i (%i to %i) and %i (%i to %i) intersect at old point %i\n", i, v1 - optVerts, v2 - optVerts, j, v3 - optVerts, v4 - optVerts, newVert - optVerts ); } #endif @@ -1631,7 +1631,7 @@ common->Printf( "lines %i (%i to %i) and %i (%i to %i) intersect at old point %i // check for duplicated edges for ( i = 0 ; i < numOptEdges ; i++ ) { for ( j = i+1 ; j < numOptEdges ; j++ ) { - if ( ( optEdges[i].v1 == optEdges[j].v1 && optEdges[i].v2 == optEdges[j].v2 ) + if ( ( optEdges[i].v1 == optEdges[j].v1 && optEdges[i].v2 == optEdges[j].v2 ) || ( optEdges[i].v1 == optEdges[j].v2 && optEdges[i].v2 == optEdges[j].v1 ) ) { common->Printf( "duplicated optEdge\n" ); } diff --git a/neo/tools/compilers/dmap/optimize_gcc.cpp b/neo/tools/compilers/dmap/optimize_gcc.cpp index fed03405..6187d3a5 100644 --- a/neo/tools/compilers/dmap/optimize_gcc.cpp +++ b/neo/tools/compilers/dmap/optimize_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"). @@ -68,7 +68,7 @@ optVertex_t *FindOptVertex( idDrawVert *v, optimizeGroup_t *opt ) { common->Error( "MAX_OPT_VERTEXES" ); return NULL; } - + numOptVerts++; vert = &optVerts[i]; diff --git a/neo/tools/compilers/dmap/output.cpp b/neo/tools/compilers/dmap/output.cpp index 75e74fa2..332efe60 100644 --- a/neo/tools/compilers/dmap/output.cpp +++ b/neo/tools/compilers/dmap/output.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 @@ static bool MatchVert( const idDrawVert *a, const idDrawVert *b ) { } // if the normal is 0 (smoothed normals), consider it a match - if ( a->normal[0] == 0 && a->normal[1] == 0 && a->normal[2] == 0 + if ( a->normal[0] == 0 && a->normal[1] == 0 && a->normal[2] == 0 && b->normal[0] == 0 && b->normal[1] == 0 && b->normal[2] == 0 ) { return true; } @@ -265,7 +265,7 @@ static void WriteUTriangles( const srfTriangles_t *uTris ) { int i; // emit this chain - procFile->WriteFloatString( "/* numVerts = */ %i /* numIndexes = */ %i\n", + procFile->WriteFloatString( "/* numVerts = */ %i /* numIndexes = */ %i\n", uTris->numVerts, uTris->numIndexes ); // verts @@ -323,7 +323,7 @@ static void WriteShadowTriangles( const srfTriangles_t *tri ) { int i; // emit this chain - procFile->WriteFloatString( "/* numVerts = */ %i /* noCaps = */ %i /* noFrontCaps = */ %i /* numIndexes = */ %i /* planeBits = */ %i\n", + procFile->WriteFloatString( "/* numVerts = */ %i /* noCaps = */ %i /* noFrontCaps = */ %i /* numIndexes = */ %i /* planeBits = */ %i\n", tri->numVerts, tri->numShadowIndexesNoCaps, tri->numShadowIndexesNoFrontCaps, tri->numIndexes, tri->shadowCapPlaneBits ); // verts @@ -406,7 +406,7 @@ typedef struct interactionTris_s { if ( entityNum == 0 ) { - procFile->WriteFloatString( "model { /* name = */ \"_area%i\" /* numSurfaces = */ %i\n\n", + procFile->WriteFloatString( "model { /* name = */ \"_area%i\" /* numSurfaces = */ %i\n\n", areaNum, numSurfaces ); } else { const char *name; @@ -415,7 +415,7 @@ typedef struct interactionTris_s { if ( !name[0] ) { common->Error( "Entity %i has surfaces, but no name key", entityNum ); } - procFile->WriteFloatString( "model { /* name = */ \"%s\" /* numSurfaces = */ %i\n\n", + procFile->WriteFloatString( "model { /* name = */ \"%s\" /* numSurfaces = */ %i\n\n", name, numSurfaces ); } @@ -578,7 +578,7 @@ static void WriteOutputPortals( uEntity_t *e ) { interAreaPortal_t *iap; idWinding *w; - procFile->WriteFloatString( "interAreaPortals { /* numAreas = */ %i /* numIAP = */ %i\n\n", + procFile->WriteFloatString( "interAreaPortals { /* numAreas = */ %i /* numIAP = */ %i\n\n", e->numAreas, numInterAreaPortals ); procFile->WriteFloatString( "/* interAreaPortal format is: numPoints positiveSideArea negativeSideArea ( point) ... */\n" ); for ( i = 0 ; i < numInterAreaPortals ; i++ ) { @@ -655,7 +655,7 @@ void WriteOutputFile( void ) { // write the entity models and information, writing entities first for ( i=dmapGlobals.num_entities - 1 ; i >= 0 ; i-- ) { entity = &dmapGlobals.uEntities[i]; - + if ( !entity->primitives ) { continue; } diff --git a/neo/tools/compilers/dmap/portals.cpp b/neo/tools/compilers/dmap/portals.cpp index 90551f58..82855d86 100644 --- a/neo/tools/compilers/dmap/portals.cpp +++ b/neo/tools/compilers/dmap/portals.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,14 +47,14 @@ AllocPortal uPortal_t *AllocPortal (void) { uPortal_t *p; - + c_active_portals++; if (c_active_portals > c_peak_portals) c_peak_portals = c_active_portals; - + p = (uPortal_t *)Mem_Alloc (sizeof(uPortal_t )); memset (p, 0, sizeof(uPortal_t )); - + return p; } @@ -111,7 +111,7 @@ void AddPortalToNodes (uPortal_t *p, node_t *front, node_t *back) { p->nodes[0] = front; p->next[0] = front->portals; front->portals = p; - + p->nodes[1] = back; p->next[1] = back->portals; back->portals = p; @@ -126,14 +126,14 @@ RemovePortalFromNode void RemovePortalFromNode (uPortal_t *portal, node_t *l) { uPortal_t **pp, *t; - + // remove reference to the current portal pp = &l->portals; while (1) { t = *pp; if (!t) - common->Error( "RemovePortalFromNode: portal not in leaf"); + common->Error( "RemovePortalFromNode: portal not in leaf"); if ( t == portal ) break; @@ -145,15 +145,15 @@ void RemovePortalFromNode (uPortal_t *portal, node_t *l) else common->Error( "RemovePortalFromNode: portal not bounding leaf"); } - + if ( portal->nodes[0] == l ) { *pp = portal->next[0]; portal->nodes[0] = NULL; } else if ( portal->nodes[1] == l ) { - *pp = portal->next[1]; + *pp = portal->next[1]; portal->nodes[1] = NULL; } else { - common->Error( "RemovePortalFromNode: mislinked" ); + common->Error( "RemovePortalFromNode: mislinked" ); } } @@ -163,7 +163,7 @@ void PrintPortal (uPortal_t *p) { int i; idWinding *w; - + w = p->winding; for ( i = 0; i < w->GetNumPoints(); i++ ) common->Printf("(%5.0f,%5.0f,%5.0f)\n",(*w)[i][0], (*w)[i][1], (*w)[i][2]); @@ -204,14 +204,14 @@ static void MakeHeadnodePortals( tree_t *tree ) { common->Error( "Backwards tree volume" ); } } - + for (i=0 ; i<3 ; i++) { for (j=0 ; j<2 ; j++) { n = j*3 + i; p = AllocPortal (); portals[n] = p; - + pl = &bplanes[n]; memset (pl, 0, sizeof(*pl)); if (j) { @@ -293,7 +293,7 @@ static void MakeNodePortal( node_t *node ) { w = BaseWindingForNode (node); // clip the portal by all the other portals in the node - for (p = node->portals ; p && w; p = p->next[side]) + for (p = node->portals ; p && w; p = p->next[side]) { idPlane plane; @@ -331,7 +331,7 @@ static void MakeNodePortal( node_t *node ) { new_portal = AllocPortal (); new_portal->plane = dmapGlobals.mapPlanes[node->planenum]; new_portal->onnode = node; - new_portal->winding = w; + new_portal->winding = w; AddPortalToNodes (new_portal, node->children[0], node->children[1]); } @@ -412,7 +412,7 @@ static void SplitNodePortals( node_t *node ) { AddPortalToNodes (p, other_node, f); continue; } - + // the winding is split new_portal = AllocPortal (); *new_portal = *p; diff --git a/neo/tools/compilers/dmap/shadowopt3.cpp b/neo/tools/compilers/dmap/shadowopt3.cpp index d1952ba3..525169fe 100644 --- a/neo/tools/compilers/dmap/shadowopt3.cpp +++ b/neo/tools/compilers/dmap/shadowopt3.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,11 +62,11 @@ If you have questions concerning this license or the applicable additional terms if triangles on both sides have two verts in common continue make a sil edge from one triangle to the other - - classify triangles on common planes, so they can be optimized + + classify triangles on common planes, so they can be optimized what about interpenetrating triangles??? @@ -91,7 +91,7 @@ If you have questions concerning this license or the applicable additional terms for each vertex project onto the apropriate plane and mark plane bit as in use for each triangle - if points project onto different planes, clip + if points project onto different planes, clip */ @@ -207,7 +207,7 @@ static bool TriOutsideTri( const shadowTri_t *a, const shadowTri_t *b ) { static bool TriBehindTri( const shadowTri_t *a, const shadowTri_t *b ) { float d; - + d = b->plane.Distance( a->v[0] ); if ( d > 0 ) { return true; @@ -269,7 +269,7 @@ static void ClipTriangle_r( const shadowTri_t *tri, int startTri, int skipTri, i // recursively clip these triangles to all subsequent triangles for ( int k = 2 ; k < back->GetNumPoints() ; k++ ) { shadowTri_t fragment = *tri; - + fragment.v[0] = (*back)[0].ToVec3(); fragment.v[1] = (*back)[k-1].ToVec3(); fragment.v[2] = (*back)[k].ToVec3(); @@ -309,7 +309,7 @@ Generates outputTris by clipping all the triangles against each other, retaining only those closest to the projectionOrigin ==================== */ -static void ClipOccluders( idVec4 *verts, glIndex_t *indexes, int numIndexes, +static void ClipOccluders( idVec4 *verts, glIndex_t *indexes, int numIndexes, idVec3 projectionOrigin ) { int numTris = numIndexes / 3; int i; @@ -328,7 +328,7 @@ static void ClipOccluders( idVec4 *verts, glIndex_t *indexes, int numIndexes, idVec3 d1 = tri->v[1] - tri->v[0]; idVec3 d2 = tri->v[2] - tri->v[0]; - + tri->plane.ToVec4().ToVec3().Cross( d2, d1 ); tri->plane.ToVec4().ToVec3().Normalize(); tri->plane[3] = - ( tri->v[0] * tri->plane.ToVec4().ToVec3() ); @@ -434,7 +434,7 @@ static void OptimizeOutputTris( void ) { tri->v[2] = mtri->v[2].xyz; } } - FreeOptimizeGroupList( optGroups ); + FreeOptimizeGroupList( optGroups ); } //================================================================================== @@ -620,7 +620,7 @@ In theory, we should never have more than one edge clipping a given fragment, but it is more robust if we check them all =================== */ -static void FragmentSilQuad( silQuad_t quad, silPlane_t *silPlane, +static void FragmentSilQuad( silQuad_t quad, silPlane_t *silPlane, shadowOptEdge_t *startEdge, shadowOptEdge_t *skipEdge ) { if ( quad.nearV[0] == quad.nearV[1] ) { return; @@ -966,7 +966,7 @@ ProjectUniqued ====================== */ static void ProjectUniqued( idVec3 projectionOrigin, idPlane projectionPlane ) { - // calculate the projection + // calculate the projection idVec4 mat[4]; R_LightProjectionMatrix( projectionOrigin, projectionPlane, mat ); @@ -1006,7 +1006,7 @@ verts have been culled against individual frustums of point lights ==================== */ -optimizedShadow_t SuperOptimizeOccluders( idVec4 *verts, glIndex_t *indexes, int numIndexes, +optimizedShadow_t SuperOptimizeOccluders( idVec4 *verts, glIndex_t *indexes, int numIndexes, idPlane projectionPlane, idVec3 projectionOrigin ) { memset( &ret, 0, sizeof( ret ) ); @@ -1045,7 +1045,7 @@ optimizedShadow_t SuperOptimizeOccluders( idVec4 *verts, glIndex_t *indexes, int } ret.totalIndexes = 0; - + maxRetIndexes = ret.numFrontCapIndexes + ret.numRearCapIndexes + ret.numSilPlaneIndexes; ret.indexes = (glIndex_t *)Mem_Alloc( maxRetIndexes * sizeof( ret.indexes[0] ) ); @@ -1063,7 +1063,7 @@ optimizedShadow_t SuperOptimizeOccluders( idVec4 *verts, glIndex_t *indexes, int ret.totalIndexes = ret.numFrontCapIndexes + ret.numRearCapIndexes; if ( dmapGlobals.shadowOptLevel >= SO_CLIP_SILS ) { - // re-optimize the sil planes, cutting + // re-optimize the sil planes, cutting EmitFragmentedSilQuads(); } else { // indexes for silhouette edges diff --git a/neo/tools/compilers/dmap/tritjunction.cpp b/neo/tools/compilers/dmap/tritjunction.cpp index 0b48d406..93fefce5 100644 --- a/neo/tools/compilers/dmap/tritjunction.cpp +++ b/neo/tools/compilers/dmap/tritjunction.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"). @@ -46,16 +46,16 @@ If you have questions concerning this license or the applicable additional terms Snaping verts can drag some triangles backwards or collapse them to points, which will cause them to be removed. - + When snapping to ints, a point can move a maximum of sqrt(3)/2 distance Two points that were an epsilon apart can then become sqrt(3) apart A case that causes recursive overflow with point to triangle fixing: - A + A C D - B + B Triangle ABC tests against point D and splits into triangles ADC and DBC Triangle DBC then tests against point A again and splits into ABC and ADB @@ -148,7 +148,7 @@ struct hashVert_s *GetHashVert( idVec3 &v ) { #endif } - // create a new one + // create a new one hv = (hashVert_t *)Mem_Alloc( sizeof( *hv ) ); hv->next = hashVerts[block[0]][block[1]][block[2]]; @@ -614,7 +614,7 @@ void FixGlobalTjunctions( uEntity_t *e ) { } else { axis.Identity(); } - } + } idVec3 origin = entity->mapEntity->epairs.GetVector( "origin" ); diff --git a/neo/tools/compilers/dmap/tritools.cpp b/neo/tools/compilers/dmap/tritools.cpp index 72b67e49..b5e18bfe 100644 --- a/neo/tools/compilers/dmap/tritools.cpp +++ b/neo/tools/compilers/dmap/tritools.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"). @@ -277,20 +277,20 @@ void TriVertsFromOriginal( mapTri_t *tri, const mapTri_t *original ) { for ( i = 0 ; i < 3 ; i++ ) { float a, b, c; - + // find the barycentric coordinates a = idWinding::TriangleArea( tri->v[i].xyz, original->v[1].xyz, original->v[2].xyz ) / denom; b = idWinding::TriangleArea( tri->v[i].xyz, original->v[2].xyz, original->v[0].xyz ) / denom; c = idWinding::TriangleArea( tri->v[i].xyz, original->v[0].xyz, original->v[1].xyz ) / denom; // regenerate the interpolated values - tri->v[i].st[0] = a * original->v[0].st[0] + tri->v[i].st[0] = a * original->v[0].st[0] + b * original->v[1].st[0] + c * original->v[2].st[0]; - tri->v[i].st[1] = a * original->v[0].st[1] + tri->v[i].st[1] = a * original->v[0].st[1] + b * original->v[1].st[1] + c * original->v[2].st[1]; for ( j = 0 ; j < 3 ; j++ ) { - tri->v[i].normal[j] = a * original->v[0].normal[j] + tri->v[i].normal[j] = a * original->v[0].normal[j] + b * original->v[1].normal[j] + c * original->v[2].normal[j]; } tri->v[i].normal.Normalize(); @@ -353,7 +353,7 @@ mapTri_t *WindingToTriList( const idWinding *w, const mapTri_t *originalTri ) { ClipTriList ================== */ -void ClipTriList( const mapTri_t *list, const idPlane &plane, float epsilon, +void ClipTriList( const mapTri_t *list, const idPlane &plane, float epsilon, mapTri_t **front, mapTri_t **back ) { const mapTri_t *tri; mapTri_t *newList; diff --git a/neo/tools/compilers/dmap/ubrush.cpp b/neo/tools/compilers/dmap/ubrush.cpp index 1073e5d8..e456f659 100644 --- a/neo/tools/compilers/dmap/ubrush.cpp +++ b/neo/tools/compilers/dmap/ubrush.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,7 +123,7 @@ void FreeBrushList (uBrush_t *brushes) next = brushes->next; FreeBrush (brushes); - } + } } /* @@ -138,7 +138,7 @@ uBrush_t *CopyBrush (uBrush_t *brush) uBrush_t *newbrush; int size; int i; - + size = BrushSizeForSides( brush->numsides ); newbrush = AllocBrush (brush->numsides); @@ -217,7 +217,7 @@ bool BoundBrush (uBrush_t *brush) { } for ( i = 0; i < 3; i++ ) { - if (brush->bounds[0][i] < MIN_WORLD_COORD || brush->bounds[1][i] > MAX_WORLD_COORD + if (brush->bounds[0][i] < MIN_WORLD_COORD || brush->bounds[1][i] > MAX_WORLD_COORD || brush->bounds[0][i] >= brush->bounds[1][i] ) { return false; } diff --git a/neo/tools/compilers/dmap/usurface.cpp b/neo/tools/compilers/dmap/usurface.cpp index a7075a5f..587b0bb6 100644 --- a/neo/tools/compilers/dmap/usurface.cpp +++ b/neo/tools/compilers/dmap/usurface.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"). @@ -125,16 +125,16 @@ static void TexVecForTri( textureVectors_t *texVec, mapTri_t *tri ) { area = d0[3] * d1[4] - d0[4] * d1[3]; inva = 1.0 / area; - temp[0] = (d0[0] * d1[4] - d0[4] * d1[0]) * inva; - temp[1] = (d0[1] * d1[4] - d0[4] * d1[1]) * inva; - temp[2] = (d0[2] * d1[4] - d0[4] * d1[2]) * inva; + temp[0] = (d0[0] * d1[4] - d0[4] * d1[0]) * inva; + temp[1] = (d0[1] * d1[4] - d0[4] * d1[1]) * inva; + temp[2] = (d0[2] * d1[4] - d0[4] * d1[2]) * inva; temp.Normalize(); texVec->v[0].ToVec3() = temp; texVec->v[0][3] = tri->v[0].xyz * texVec->v[0].ToVec3() - tri->v[0].st[0]; - temp[0] = (d0[3] * d1[0] - d0[0] * d1[3]) * inva; - temp[1] = (d0[3] * d1[1] - d0[1] * d1[3]) * inva; - temp[2] = (d0[3] * d1[2] - d0[2] * d1[3]) * inva; + temp[0] = (d0[3] * d1[0] - d0[0] * d1[3]) * inva; + temp[1] = (d0[3] * d1[1] - d0[1] * d1[3]) * inva; + temp[2] = (d0[3] * d1[2] - d0[2] * d1[3]) * inva; temp.Normalize(); texVec->v[1].ToVec3() = temp; texVec->v[1][3] = tri->v[0].xyz * texVec->v[0].ToVec3() - tri->v[0].st[1]; @@ -176,7 +176,7 @@ mapTri_t *TriListForSide( const side_t *s, const idWinding *w ) { triList = NULL; for ( i = 2 ; i < w->GetNumPoints() ; i++ ) { tri = AllocTri(); - tri->material = si; + tri->material = si; tri->next = triList; triList = tri; @@ -198,7 +198,7 @@ mapTri_t *TriListForSide( const side_t *s, const idWinding *w ) { #else VectorCopy( *vec, dv->xyz ); #endif - + // calculate texture s/t from brush primitive texture matrix dv->st[0] = DotProduct( dv->xyz, s->texVec.v[0] ) + s->texVec.v[0][3]; dv->st[1] = DotProduct( dv->xyz, s->texVec.v[1] ) + s->texVec.v[1][3]; @@ -218,7 +218,7 @@ mapTri_t *TriListForSide( const side_t *s, const idWinding *w ) { idVec3 midPoint; tri = AllocTri(); - tri->material = si; + tri->material = si; tri->next = triList; triList = tri; @@ -235,7 +235,7 @@ mapTri_t *TriListForSide( const side_t *s, const idWinding *w ) { dv = tri->v + j; VectorCopy( *vec, dv->xyz ); - + // calculate texture s/t from brush primitive texture matrix dv->st[0] = DotProduct( dv->xyz, s->texVec.v[0] ) + s->texVec.v[0][3]; dv->st[1] = DotProduct( dv->xyz, s->texVec.v[1] ) + s->texVec.v[1][3]; @@ -653,7 +653,7 @@ void PutPrimitivesInAreas( uEntity_t *e ) { } else { axis.Identity(); } - } + } idVec3 origin = entity->mapEntity->epairs.GetVector( "origin" ); @@ -701,7 +701,7 @@ If clipping was required, the outside fragments will be planar clips, which will benefit from re-optimization. ================= */ -static void ClipTriByLight( const mapLight_t *light, const mapTri_t *tri, +static void ClipTriByLight( const mapLight_t *light, const mapTri_t *tri, mapTri_t **in, mapTri_t **out ) { idWinding *inside, *oldInside; idWinding *outside[6]; @@ -889,7 +889,7 @@ static void BuildLightShadows( uEntity_t *e, mapLight_t *light ) { if ( light->shadowTris && hasPerforatedSurface ) { // can't ever remove front faces, because we can see through some of them - light->shadowTris->numShadowIndexesNoCaps = light->shadowTris->numShadowIndexesNoFrontCaps = + light->shadowTris->numShadowIndexesNoCaps = light->shadowTris->numShadowIndexesNoFrontCaps = light->shadowTris->numIndexes; } @@ -921,7 +921,7 @@ static void CarveGroupsByLight( uEntity_t *e, mapLight_t *light ) { nextGroup = group->nextGroup; // if the surface doesn't get lit, don't carve it up if ( ( light->def.lightShader->IsFogLight() && !group->material->ReceivesFog() ) - || ( !light->def.lightShader->IsFogLight() && !group->material->ReceivesLighting() ) + || ( !light->def.lightShader->IsFogLight() && !group->material->ReceivesLighting() ) || !group->bounds.IntersectsBounds( light->def.frustumTris->bounds ) ) { group->nextGroup = carvedGroups; @@ -1002,7 +1002,7 @@ void Prelight( uEntity_t *e ) { if ( dmapGlobals.entityNum != 0 ) { return; } - + if ( dmapGlobals.shadowOptLevel > 0 ) { common->Printf( "----- BuildLightShadows -----\n" ); start = Sys_Milliseconds(); @@ -1041,6 +1041,3 @@ void Prelight( uEntity_t *e ) { } } - - - diff --git a/neo/tools/compilers/renderbump/renderbump.cpp b/neo/tools/compilers/renderbump/renderbump.cpp index 5fd38d82..0714c257 100644 --- a/neo/tools/compilers/renderbump/renderbump.cpp +++ b/neo/tools/compilers/renderbump/renderbump.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"). @@ -99,7 +99,7 @@ typedef struct { float traceDist; srfTriangles_t *mesh; // high poly mesh idRenderModel *highModel; - triHash_t *hash; + triHash_t *hash; } renderBump_t; static float traceFraction; @@ -404,7 +404,7 @@ Returns the distance from the point to the intersection, or DIST_NO_INTERSECTION ================= */ #define DIST_NO_INTERSECTION -999999999.0f -static float TraceToMeshFace( const srfTriangles_t *highMesh, int faceNum, +static float TraceToMeshFace( const srfTriangles_t *highMesh, int faceNum, float minDist, float maxDist, const idVec3 &point, const idVec3 &normal, idVec3 &sampledNormal, byte sampledColor[4] ) { @@ -506,14 +506,14 @@ static float TraceToMeshFace( const srfTriangles_t *highMesh, int faceNum, ================ SampleHighMesh -Find the best surface normal in the high poly mesh +Find the best surface normal in the high poly mesh for a ray coming from the surface of the low poly mesh Returns false if the trace doesn't hit anything ================ */ static bool SampleHighMesh( const renderBump_t *rb, - const idVec3 &point, const idVec3 &direction, idVec3 &sampledNormal, + const idVec3 &point, const idVec3 &direction, idVec3 &sampledNormal, byte sampledColor[4] ) { idVec3 p; binLink_t *bl; @@ -573,7 +573,7 @@ static bool SampleHighMesh( const renderBump_t *rb, link = &rb->hash->linkBlocks[ linkNum / MAX_LINKS_PER_BLOCK ][ linkNum % MAX_LINKS_PER_BLOCK ]; faceNum = link->faceNum; - dist = TraceToMeshFace( rb->mesh, faceNum, + dist = TraceToMeshFace( rb->mesh, faceNum, bestDist, maxDist, point, normal, sampledNormal, sampledColor ); if ( dist == DIST_NO_INTERSECTION ) { continue; @@ -607,7 +607,7 @@ static float TriTextureArea( const float a[2], const float b[2], const float c[2 d2[0] = c[0] - a[0]; d2[1] = c[1] - a[1]; d2[2] = 0; - + cross = d1.Cross( d2 ); area = 0.5 * cross.Length(); @@ -683,7 +683,7 @@ static void RasterizeTriangle( const srfTriangles_t *lowMesh, const idVec3 *lowM // calculate edge vectors for ( i = 0 ; i < 3 ; i++ ) { float *v1, *v2; - + v1 = verts[i]; v2 = verts[(i+1)%3]; @@ -1208,7 +1208,7 @@ void RenderBump_f( const idCmdArgs &args ) { // parse the renderbump parameters for this surface cmdLine = ms->shader->GetRenderBump(); - common->Printf( "surface %i, shader %s\nrenderBump = %s ", i, + common->Printf( "surface %i, shader %s\nrenderBump = %s ", i, ms->shader->GetName(), cmdLine ); if ( !ms->geometry ) { @@ -1283,8 +1283,8 @@ void RenderBump_f( const idCmdArgs &args ) { continue; } // all the other parameters must match, or it is an error - if ( idStr::Icmp( rb->highName, opt.highName) || rb->width != opt.width || - rb->height != opt.height || rb->antiAlias != opt.antiAlias || + if ( idStr::Icmp( rb->highName, opt.highName) || rb->width != opt.width || + rb->height != opt.height || rb->antiAlias != opt.antiAlias || rb->traceFrac != opt.traceFrac ) { common->Error( "mismatched renderbump parameters on image %s", rb->outputName ); continue; @@ -1421,10 +1421,10 @@ void RenderBumpFlat_f( const idCmdArgs &args ) { qglEnable( GL_CULL_FACE ); qglCullFace( GL_FRONT ); - qglDisable( GL_STENCIL_TEST ); - qglDisable( GL_SCISSOR_TEST ); - qglDisable( GL_ALPHA_TEST ); - qglDisable( GL_BLEND ); + qglDisable( GL_STENCIL_TEST ); + qglDisable( GL_SCISSOR_TEST ); + qglDisable( GL_ALPHA_TEST ); + qglDisable( GL_BLEND ); qglEnable( GL_DEPTH_TEST ); qglDisable( GL_TEXTURE_2D ); qglDepthMask( GL_TRUE ); @@ -1434,7 +1434,7 @@ void RenderBumpFlat_f( const idCmdArgs &args ) { qglMatrixMode( GL_PROJECTION ); qglLoadIdentity(); - qglOrtho( bounds[0][0], bounds[1][0], bounds[0][2], + qglOrtho( bounds[0][0], bounds[1][0], bounds[0][2], bounds[1][2], -( bounds[0][1] - 1 ), -( bounds[1][1] + 1 ) ); qglMatrixMode( GL_MODELVIEW ); @@ -1548,7 +1548,7 @@ void RenderBumpFlat_f( const idCmdArgs &args ) { qglEnd(); qglFlush(); GLimp_SwapBuffers(); - qglReadPixels( 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer ); + qglReadPixels( 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer ); if ( colorPass ) { // add to the sum buffer diff --git a/neo/tools/compilers/roqvq/NSBitmapImageRep.cpp b/neo/tools/compilers/roqvq/NSBitmapImageRep.cpp index 163fc244..a35668af 100644 --- a/neo/tools/compilers/roqvq/NSBitmapImageRep.cpp +++ b/neo/tools/compilers/roqvq/NSBitmapImageRep.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"). @@ -102,4 +102,3 @@ NSBitmapImageRep &NSBitmapImageRep::operator=( const NSBitmapImageRep &a ) { return *this; } - diff --git a/neo/tools/compilers/roqvq/codec.cpp b/neo/tools/compilers/roqvq/codec.cpp index dabb683c..9f4ede70 100644 --- a/neo/tools/compilers/roqvq/codec.cpp +++ b/neo/tools/compilers/roqvq/codec.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,12 +42,12 @@ codec::codec() { common->Printf("init: initing.....\n"); codebooksize = 256; codebook2 = (VQDATA **) Mem_ClearedAlloc(256*sizeof(VQDATA *)); - for(i=0; i < 256; i++) { - codebook2[i] = (VQDATA *) Mem_ClearedAlloc(16*sizeof(VQDATA)); + for(i=0; i < 256; i++) { + codebook2[i] = (VQDATA *) Mem_ClearedAlloc(16*sizeof(VQDATA)); } codebook4 = (VQDATA **) Mem_ClearedAlloc(256*sizeof(VQDATA *)); - for(i=0; i < 256; i++) { - codebook4[i] = (VQDATA *) Mem_ClearedAlloc(64*sizeof(VQDATA)); + for(i=0; i < 256; i++) { + codebook4[i] = (VQDATA *) Mem_ClearedAlloc(64*sizeof(VQDATA)); } previousImage[0] = 0; previousImage[1] = 0; @@ -75,42 +75,42 @@ codec::~codec() return; } -/* Because Shellsort is a variation on Insertion Sort, it has the same - * inconsistency that I noted in the InsertionSort class. Notice where I +/* Because Shellsort is a variation on Insertion Sort, it has the same + * inconsistency that I noted in the InsertionSort class. Notice where I * subtract a move to compensate for calling a swap for visual purposes. */ void codec::Sort( float *list, int *intIndex, int numElements ) { -#define STRIDE_FACTOR 3 // good value for stride factor is not well-understood +#define STRIDE_FACTOR 3 // good value for stride factor is not well-understood // 3 is a fairly good choice (Sedgewick) - int c,d, stride; - bool found; + int c,d, stride; + bool found; - stride = 1; - while (stride <= numElements) - stride = stride*STRIDE_FACTOR +1; - - while (stride>(STRIDE_FACTOR-1)) { // loop to sort for each value of stride - stride = stride / STRIDE_FACTOR; + stride = 1; + while (stride <= numElements) + stride = stride*STRIDE_FACTOR +1; + + while (stride>(STRIDE_FACTOR-1)) { // loop to sort for each value of stride + stride = stride / STRIDE_FACTOR; for (c = stride; c < numElements; c++){ - found = false; - d = c-stride; - while ((d >= 0) && !found) { // move to left until correct place - if (list[d]= 0) && !found) { // move to left until correct place + if (list[d]Read( lineout, x ) != x ) { - doopen = true; - common->Printf("failed....\n"); + doopen = true; + common->Printf("failed....\n"); } fileSystem->CloseFile( fpcb ); } @@ -168,7 +168,7 @@ void codec::Segment( int *alist, float *flist, int numElements, float rmse) dst = cbook; int numEntries = 0; for (i=0; i= MIN_SNR*4) { + if (qStatus[i].size == 8 && qStatus[i].rsnr >= MIN_SNR*4) { for(y=qStatus[i].yat;yPrintf("segment: %d 4x4 cels to vq\n", numEntries ); VQ( numEntries, dimension4, cbook, snrBook, codebook4, true ); - + dst = cbook; numEntries = 0; @@ -211,9 +211,9 @@ void codec::Segment( int *alist, float *flist, int numElements, float rmse) } } common->Printf("segment: %d 2x2 cels to vq\n", numEntries); - + VQ( numEntries, dimension2, cbook, snrBook, codebook2, false ); - + Mem_Free(cbook); Mem_Free(snrBook); @@ -306,7 +306,7 @@ void codec::Segment( int *alist, float *flist, int numElements, float rmse) codebook4[onf][temp+2] = codebook2[best][numc++]; //b codebook4[onf][temp+3] = codebook2[best][numc++]; //r a codebook4[onf][temp+4] = codebook2[best][numc++]; //g r - codebook4[onf][temp+5] = codebook2[best][numc++]; //b g + codebook4[onf][temp+5] = codebook2[best][numc++]; //b g } } } @@ -357,7 +357,7 @@ int codec::BestCodeword( unsigned char *tempvector, int dimension, VQDATA **code } } return bestIndex; -} +} void codec::SetPreviousImage( const char*filename, NSBitmapImageRep *timage ) { @@ -368,11 +368,11 @@ void codec::SetPreviousImage( const char*filename, NSBitmapImageRep *timage ) delete previousImage[1]; } common->Printf("setPreviousImage:%s\n", filename); - + previousImage[0] = new NSBitmapImageRep( ); previousImage[1] = new NSBitmapImageRep( ); whichFrame=1; - + *previousImage[0] = *timage; *previousImage[1] = *timage; @@ -400,7 +400,7 @@ bool diff; rgbmap = previousImage[(whichFrame&1)]->bitmapData(); if ((whichFrame&1) == 1) { - fccdictionary = previousImage[0]->bitmapData(); + fccdictionary = previousImage[0]->bitmapData(); } else { fccdictionary = previousImage[1]->bitmapData(); } @@ -425,11 +425,11 @@ bool diff; if (rgbmap[pluck+1] != codebook4[ind][xx+1]) diff = true; if (rgbmap[pluck+2] != codebook4[ind][xx+2]) diff = true; if (dimension4 == 64 && rgbmap[pluck+3] != codebook4[ind][xx+3]) diff = true; - + rgbmap[pluck+0] = (byte)codebook4[ind][xx+0]; rgbmap[pluck+1] = (byte)codebook4[ind][xx+1]; rgbmap[pluck+2] = (byte)codebook4[ind][xx+2]; - if (dimension4 == 64) + if (dimension4 == 64) rgbmap[pluck+3] = (byte)codebook4[ind][xx+3]; else rgbmap[pluck+3] = 255; @@ -449,11 +449,11 @@ bool diff; if (rgbmap[pluck+1] != codebook4[ind][xx+1]) diff = true; if (rgbmap[pluck+2] != codebook4[ind][xx+2]) diff = true; if (dimension4 == 64 && rgbmap[pluck+3] != codebook4[ind][xx+3]) diff = true; - + rgbmap[pluck+0] = (byte)codebook4[ind][xx+0]; rgbmap[pluck+1] = (byte)codebook4[ind][xx+1]; rgbmap[pluck+2] = (byte)codebook4[ind][xx+2]; - if (dimension4 == 64) + if (dimension4 == 64) rgbmap[pluck+3] = (byte)codebook4[ind][xx+3]; else rgbmap[pluck+3] = 255; @@ -476,7 +476,7 @@ bool diff; if (rgbmap[pluck+1] != codebook2[ind][dy+1]) diff = true; if (rgbmap[pluck+2] != codebook2[ind][dy+2]) diff = true; if (dimension4 == 64 && rgbmap[pluck+3] != codebook2[ind][dy+3]) diff = true; - + rgbmap[pluck+0] = (byte)codebook2[ind][dy+0]; rgbmap[pluck+1] = (byte)codebook2[ind][dy+1]; rgbmap[pluck+2] = (byte)codebook2[ind][dy+2]; @@ -519,7 +519,7 @@ bool diff; dy = pquad[i].yat - ((pquad[i].domain & 0xff) - 128)*2; } // if (pquad[i].yat == 0) common->Printf("dx = %d, dy = %d, xat = %d\n", dx, dy, pquad[i].xat); - + ind = (dy*pWide+dx)*4; for( dy=0; dysamplesPerPixel(); index1++; } @@ -606,9 +606,9 @@ int bigx, bigy, lowx, lowy; lowx = lowy = 0; bigx = pixelsWide & 0xfff0; bigy = pixelsHigh & 0xfff0; - + if ( (startX >= lowx) && (startX+quadSize) <= (bigx) && (startY+quadSize) <= (bigy) && (startY >= lowy) && quadSize <= MAXSIZE) { - qStatus[onQuad].size = quadSize; + qStatus[onQuad].size = quadSize; qStatus[onQuad].xat = startX; qStatus[onQuad].yat = startY; qStatus[onQuad].rsnr = 999999; @@ -753,7 +753,7 @@ float fsnr; register int ind; ind = 0; - + for(i=0; ipixelsWide(); yLen = previousImage[0]->pixelsHigh(); ripl = xLen-size; - + breakHigh = 99999999; fabort = 0; @@ -824,13 +824,13 @@ void codec::FvqData( byte *bitmap, int size, int realx, int realy, quadcel *pqu searchX = 8; //32; //if (xLen == (yLen*4)) depthx = 2; //if (theRoQ->Scaleable()) depthx = depthy = 2; - + if (clamp) { searchX = searchY = 8; } searchX = searchX*depthx; searchY = searchY*depthy; xxMean = dxMean*depthx; yyMean = dyMean*depthy; - + if (((realx-xxMean)+searchX)<0 ||(((realx-xxMean)-searchX)+depthx+size)>xLen || ((realy-yyMean)+searchY)<0 || (((realy-yyMean)-searchY)+depthy+size)>yLen) { pquad->snr[FCC] = 9999; return; @@ -845,35 +845,35 @@ void codec::FvqData( byte *bitmap, int size, int realx, int realy, quadcel *pqu ripl = (xLen-size)*bpp; mblur0 = 0; bitma2 = bitmap; - scale1 = previousImage[((whichFrame+1)&1)]->bitmapData() + temp1*bpp; + scale1 = previousImage[((whichFrame+1)&1)]->bitmapData() + temp1*bpp; // mblur0 = 0; // bitma2 = luty; // scale1 = luti + temp1; for( y=0; y breakHigh) { + for( x=0; x breakHigh) { break; - } - scale1 += ripl; + } + scale1 += ripl; } if (breakHigh > mblur0) { - breakHigh = mblur0; - lowX = sX; - lowY = sY; + breakHigh = mblur0; + lowX = sX; + lowY = sY; + } } - } } } - + if (lowX != -1 && lowY != -1) { bpp = previousImage[0]->samplesPerPixel(); ripl = (xLen-size)*bpp; mblur0 = 0; bitma2 = bitmap; - scale1 = previousImage[((whichFrame+1)&1)]->bitmapData() + (xLen*lowY+lowX)*bpp; + scale1 = previousImage[((whichFrame+1)&1)]->bitmapData() + (xLen*lowY+lowX)*bpp; for( y=0; y0;i--) { if ( qtemp->snr[i]*quickadd[i] < wtemp ) { *status = i; - *snr = qtemp->snr[i]; - wtemp = qtemp->snr[i]*quickadd[i]; + *snr = qtemp->snr[i]; + wtemp = qtemp->snr[i]*quickadd[i]; } } @@ -979,7 +979,7 @@ int codec::GetCurrentQuadOutputSize( quadcel *pquad ) { int totalbits, i, totalbytes; int quickadd[DEAD+1]; - + totalbits = 0; quickadd[DEP] = 2; @@ -1022,12 +1022,12 @@ float newsnr, cmul; byte *idataA, *idataB; if (lownum != -1) { - + if (pquad[lownum].size == 8) { nx = 1; nsize = 4; cmul = 1; } else { nx = 5; nsize = 8; cmul = 4; - } + } newsnr = 0; idataA = (byte *)Mem_Alloc(8*8*4); idataB = (byte *)Mem_Alloc(8*8*4); @@ -1050,11 +1050,11 @@ byte *idataA, *idataB; Mem_Free(idataA); Mem_Free(idataB); newsnr /= 4; LowestQuad( &pquad[lownum], &pquad[lownum].status, &pquad[lownum].rsnr, false ); - + if ( pquad[lownum+nx*0+1].status == MOT && pquad[lownum+nx*1+1].status == MOT - && pquad[lownum+nx*2+1].status == MOT && pquad[lownum+nx*3+1].status == MOT + && pquad[lownum+nx*2+1].status == MOT && pquad[lownum+nx*3+1].status == MOT && nsize == 4) { newsnr = 9999; pquad[lownum].status = MOT; } - + if ( pquad[lownum].rsnr > newsnr ) { pquad[lownum].status = DEP; pquad[lownum].rsnr = 0; @@ -1063,14 +1063,14 @@ byte *idataA, *idataB; } } else { theRoQ->MarkQuadx( pquad[lownum].xat, pquad[lownum].yat, nsize*2, pquad[lownum].rsnr, qStatus[lownum].status ); - pquad[lownum+nx*0+1].status = 0; - pquad[lownum+nx*1+1].status = 0; - pquad[lownum+nx*2+1].status = 0; - pquad[lownum+nx*3+1].status = 0; - pquad[lownum+nx*0+1].size = 0; - pquad[lownum+nx*1+1].size = 0; - pquad[lownum+nx*2+1].size = 0; - pquad[lownum+nx*3+1].size = 0; + pquad[lownum+nx*0+1].status = 0; + pquad[lownum+nx*1+1].status = 0; + pquad[lownum+nx*2+1].status = 0; + pquad[lownum+nx*3+1].status = 0; + pquad[lownum+nx*0+1].size = 0; + pquad[lownum+nx*1+1].size = 0; + pquad[lownum+nx*2+1].size = 0; + pquad[lownum+nx*3+1].size = 0; } } else { lownum = -1; @@ -1122,10 +1122,10 @@ byte *idataA, *idataB; } fsize += (slop/50); if (fsize > 64000) { - fsize = 64000; + fsize = 64000; } if (previousImage[0] && fsize > theRoQ->NormalFrameSize()*2) { - fsize = theRoQ->NormalFrameSize()*2; + fsize = theRoQ->NormalFrameSize()*2; } dxMean = dyMean = 0; if (previousImage[0]) wtype = 1; else wtype = 0; @@ -1168,7 +1168,7 @@ byte *idataA, *idataB; if (theRoQ->IsQuiet() == false) { common->Printf("sparseEncode: rmse of quad0 is %f, size is %d (meant to be %d)\n", sRMSE, GetCurrentQuadOutputSize(qStatus), fsize ); } - + onf = 0; for(i=0;iPrintf("sparseEncode: dx/dy mean is %d,%d\n", dxMean, dyMean); @@ -1206,13 +1206,13 @@ byte *idataA, *idataB; int dx,dy; dx = (qStatus[i].domain >> 8 ) - 128 - dxMean + 8; dy = (qStatus[i].domain & 0xff) - 128 - dyMean + 8; - if (dx<0||dx>15||dy<0||dy>15) { + if (dx<0||dx>15||dy<0||dy>15) { qStatus[i].snr[FCC] = 9999; temp++; FvqData( idataA, qStatus[i].size, qStatus[i].xat, qStatus[i].yat, &qStatus[i], true ); dx = (qStatus[i].domain >> 8 ) - 128 - dxMean + 8; dy = (qStatus[i].domain & 0xff) - 128 - dyMean + 8; - if ((dx<0||dx>15||dy<0||dy>15)&&qStatus[i].snr[FCC]!=9999&&qStatus[i].status==FCC) { + if ((dx<0||dx>15||dy<0||dy>15)&&qStatus[i].snr[FCC]!=9999&&qStatus[i].status==FCC) { common->Printf("sparseEncode: something is wrong here, dx/dy is %d,%d after being clamped\n", dx, dy); common->Printf("xat: %d\n", qStatus[i].xat); common->Printf("yat: %d\n", qStatus[i].yat); @@ -1248,7 +1248,7 @@ byte *idataA, *idataB; common->Printf("sparseEncode: rmse of quad0 is %f, size is %d (meant to be %d)\n", GetCurrentRMSE( qStatus ), GetCurrentQuadOutputSize( qStatus ), fsize ); common->Printf("sparseEncode: %d outside fcc limits\n", temp); } - + onf = 0; for(i=0;i 0 && qStatus[ilist[ong]].mark == false) { -// badsnr = [self getCurrentRMSE: qStatus]; +// badsnr = [self getCurrentRMSE: qStatus]; osize = AddQuad( qStatus, ilist[ong++] ); // if ([self getCurrentRMSE: qStatus] >= badsnr) { // break; @@ -1273,10 +1273,10 @@ byte *idataA, *idataB; if ( GetCurrentQuadOutputSize( qStatus ) < fsize) { ong = 0; while ( GetCurrentQuadOutputSize(qStatus) < fsize && ong < onf) { -// badsnr = [self getCurrentRMSE: qStatus]; +// badsnr = [self getCurrentRMSE: qStatus]; i = ilist[ong++]; if (qStatus[i].mark) { - detail = false; + detail = false; qStatus[i].mark = false; GetData( idataA, qStatus[i].size, qStatus[i].xat, qStatus[i].yat, image ); if (qStatus[i].size == 8) VqData8( idataA, &qStatus[i] ); @@ -1287,7 +1287,7 @@ byte *idataA, *idataB; } LowestQuad( &qStatus[i], &qStatus[i].status, &qStatus[i].rsnr, wtype ); if (qStatus[i].rsnr <= MIN_SNR) { - break; + break; } theRoQ->MarkQuadx( qStatus[i].xat, qStatus[i].yat, qStatus[i].size, qStatus[i].rsnr, qStatus[i].status ); } @@ -1297,7 +1297,7 @@ byte *idataA, *idataB; } ong = 0; while ( GetCurrentQuadOutputSize( qStatus ) < fsize && ong < onf && flist[ong] > 0) { -// badsnr = [self getCurrentRMSE: qStatus]; +// badsnr = [self getCurrentRMSE: qStatus]; i = ilist[ong++]; // if (qStatus[i].rsnr <= MIN_SNR) { // break; @@ -1313,12 +1313,12 @@ byte *idataA, *idataB; common->Printf("sparseEncode: rmse of frame %d is %f, size is %d\n", whichFrame, GetCurrentRMSE(qStatus), GetCurrentQuadOutputSize(qStatus) ); if (previousImage[0]) - fsize = theRoQ->NormalFrameSize(); + fsize = theRoQ->NormalFrameSize(); else - fsize = theRoQ->FirstFrameSize(); - + fsize = theRoQ->FirstFrameSize(); + slop += (fsize - GetCurrentQuadOutputSize(qStatus)); - + if (theRoQ->IsQuiet() == false) { for(i=0;iNormalFrameSize(); else fsize = theRoQ->FirstFrameSize(); if (theRoQ->HasSound() && fsize > 6000 && previousImage[0]) fsize = 6000; } - + dxMean = dyMean = 0; if (previousImage[0]) wtype = 1; else wtype = 0; @@ -1419,7 +1419,7 @@ byte *idataA, *idataB; common->Printf("sparseEncode: rmse of frame %d is %f, size is %d\n", whichFrame, sRMSE, GetCurrentQuadOutputSize( qStatus ) ); - + if (theRoQ->IsQuiet() == false) { for(i=0;iPrintf("First vq = %d\n ", i); @@ -1693,4 +1693,3 @@ void codec::VQ( const int numEntries, const int dimension, const unsigned char * int endMsec = Sys_Milliseconds(); common->Printf( "VQ took %i msec\n", endMsec - startMsec ); } - diff --git a/neo/tools/compilers/roqvq/codec.h b/neo/tools/compilers/roqvq/codec.h index c232c6f9..d4f9b3ad 100644 --- a/neo/tools/compilers/roqvq/codec.h +++ b/neo/tools/compilers/roqvq/codec.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 @@ public: void SetPreviousImage( const char*filename, NSBitmapImageRep *timage ); int BestCodeword( unsigned char *tempvector, int dimension, VQDATA **codebook ); private: - + void VQ( const int numEntries, const int dimension, const unsigned char *vectors, float *snr, VQDATA **codebook, const bool optimize ); void Sort( float *list, int *intIndex, int numElements ); void Segment( int *alist, float *flist, int numElements, float rmse); @@ -77,14 +77,14 @@ private: NSBitmapImageRep *image; NSBitmapImageRep *newImage; - NSBitmapImageRep *previousImage[2]; // the ones in video ram and offscreen ram + NSBitmapImageRep *previousImage[2]; // the ones in video ram and offscreen ram int numQuadCels; int whichFrame; int slop; - bool detail; - int onQuad; + bool detail; + int onQuad; int initRGBtab; - quadcel *qStatus; + quadcel *qStatus; int dxMean; int dyMean; int codebooksize; diff --git a/neo/tools/compilers/roqvq/gdefs.h b/neo/tools/compilers/roqvq/gdefs.h index bce3fef7..5b6b3eb2 100644 --- a/neo/tools/compilers/roqvq/gdefs.h +++ b/neo/tools/compilers/roqvq/gdefs.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,10 +40,10 @@ typedef unsigned short word; #define CLAMP(v,l,h) ((v)<(l) ? (l) : (v)>(h) ? (h) : v) #define xswap(a,b) { a^=b; b^=a; a^=b; } #define lum(a) ( 0.2990*(a>>16) + 0.5870*((a>>8)&0xff) + 0.1140*(a&0xff) ) -#define gsign(a) ((a) < 0 ? -1 : 1) +#define gsign(a) ((a) < 0 ? -1 : 1) #define mnint(a) ((a) < 0 ? (int)(a - 0.5) : (int)(a + 0.5)) -#define mmax(a, b) ((a) > (b) ? (a) : (b)) -#define mmin(a, b) ((a) < (b) ? (a) : (b)) +#define mmax(a, b) ((a) > (b) ? (a) : (b)) +#define mmin(a, b) ((a) < (b) ? (a) : (b)) #define RGBDIST( src0, src1 ) ( ((src0[0]-src1[0])*(src0[0]-src1[0])) + \ ((src0[1]-src1[1])*(src0[1]-src1[1])) + \ ((src0[2]-src1[2])*(src0[2]-src1[2])) ) @@ -55,7 +55,7 @@ typedef unsigned short word; #define RMULT 0.2990f // use these for televisions -#define GMULT 0.5870f +#define GMULT 0.5870f #define BMULT 0.1140f #define RIEMULT -0.16874f diff --git a/neo/tools/compilers/roqvq/quaddefs.h b/neo/tools/compilers/roqvq/quaddefs.h index 7a826109..1bb49d13 100644 --- a/neo/tools/compilers/roqvq/quaddefs.h +++ b/neo/tools/compilers/roqvq/quaddefs.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 @@ If you have questions concerning this license or the applicable additional terms #define MAXSIZE 16 #define MINSIZE 4 -#define RoQ_ID 0x1084 +#define RoQ_ID 0x1084 #define RoQ_QUAD 0x1000 #define RoQ_PUZZLE_QUAD 0x1003 #define RoQ_QUAD_HANG 0x1013 @@ -71,13 +71,13 @@ If you have questions concerning this license or the applicable additional terms typedef struct { byte size; // 32, 16, 8, or 4 word xat; // where is it at on the screen - word yat; // + word yat; // } shortQuadCel; typedef struct { byte size; // 32, 16, 8, or 4 word xat; // where is it at on the screen - word yat; // + word yat; // float cccsnr; // ccc bitmap snr to actual image float fccsnr; // fcc bitmap snr to actual image @@ -95,7 +95,7 @@ typedef struct { unsigned int colpatb; unsigned int colpats; unsigned int bitmap; // ccc bitmap - + word domain; // where to copy from for fcc word patten[5]; // which pattern diff --git a/neo/tools/compilers/roqvq/roq.cpp b/neo/tools/compilers/roqvq/roq.cpp index bde79f0e..0200b587 100644 --- a/neo/tools/compilers/roqvq/roq.cpp +++ b/neo/tools/compilers/roqvq/roq.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"). @@ -117,33 +117,33 @@ void roq::EncodeStream( const char *paramInputFile ) int morestuff; onFrame = 1; - + encoder = new codec; paramFile = new roqParam; paramFile->numInputFiles = 0; - + paramFile->InitFromFile( paramInputFile ); if (!paramFile->NumberOfFrames()) { return; } - + InitRoQFile( paramFile->outputFilename); numberOfFrames = paramFile->NumberOfFrames(); if (paramFile->NoAlpha()==true) common->Printf("encodeStream: eluding alpha\n"); - + f0 = ""; f1 = paramFile->GetNextImageFilename(); if (( paramFile->MoreFrames() == true )) { f2 = paramFile->GetNextImageFilename(); } morestuff = numberOfFrames; - + while( morestuff ) { LoadAndDisplayImage( f1 ); - + if (onFrame==1) { encoder->SparseEncode(); // WriteLossless(); @@ -179,7 +179,7 @@ void roq::EncodeStream( const char *paramInputFile ) void roq::Write16Word( word *aWord, idFile *stream ) { byte a, b; - + a = *aWord & 0xff; b = *aWord >> 8; @@ -190,7 +190,7 @@ void roq::Write16Word( word *aWord, idFile *stream ) void roq::Write32Word( unsigned int *aWord, idFile *stream ) { byte a, b, c, d; - + a = *aWord & 0xff; b = (*aWord >> 8) & 0xff; c = (*aWord >> 16) & 0xff; @@ -278,10 +278,10 @@ boolean roq::JPEGEmptyOutputBuffer (j_compress_ptr cinfo) { void roq::JPEGStartCompress (j_compress_ptr cinfo, bool write_all_tables) { if (cinfo->global_state != CSTATE_START) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); if (write_all_tables) - jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */ + jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */ /* (Re)initialize error mgr and destination modules */ (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); @@ -317,15 +317,15 @@ JDIMENSION roq::JPEGWriteScanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION row_ctr, rows_left; if (cinfo->global_state != CSTATE_SCANNING) - ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); if (cinfo->next_scanline >= cinfo->image_height) - WARNMS(cinfo, JWRN_TOO_MUCH_DATA); + WARNMS(cinfo, JWRN_TOO_MUCH_DATA); /* Call progress monitor hook if present */ if (cinfo->progress != NULL) { - cinfo->progress->pass_counter = (long) cinfo->next_scanline; - cinfo->progress->pass_limit = (long) cinfo->image_height; - (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); + cinfo->progress->pass_counter = (long) cinfo->next_scanline; + cinfo->progress->pass_limit = (long) cinfo->image_height; + (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); } /* Give master control module another chance if this is first call to @@ -334,12 +334,12 @@ JDIMENSION roq::JPEGWriteScanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines, * jpeg_start_compress and jpeg_write_scanlines. */ if (cinfo->master->call_pass_startup) - (*cinfo->master->pass_startup) (cinfo); + (*cinfo->master->pass_startup) (cinfo); /* Ignore any extra scanlines at bottom of image. */ rows_left = cinfo->image_height - cinfo->next_scanline; if (num_lines > rows_left) - num_lines = rows_left; + num_lines = rows_left; row_ctr = 0; (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, num_lines); @@ -381,8 +381,8 @@ void roq::JPEGDest (j_compress_ptr cinfo, byte* outfile, int size) { * sizes may be different. Caveat programmer. */ if (cinfo->dest == NULL) { /* first time for this JPEG object? */ - cinfo->dest = (struct jpeg_destination_mgr *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + cinfo->dest = (struct jpeg_destination_mgr *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(my_destination_mgr)); } @@ -454,10 +454,10 @@ void roq::WriteLossless( void ) { /* First we supply a description of the input image. * Four fields of the cinfo struct must be filled in: */ - cinfo.image_width = image->pixelsWide(); /* image width and height, in pixels */ + cinfo.image_width = image->pixelsWide(); /* image width and height, in pixels */ cinfo.image_height = image->pixelsHigh(); cinfo.input_components = 4; /* # of color components per pixel */ - cinfo.in_color_space = JCS_RGB; /* colorspace of input image */ + cinfo.in_color_space = JCS_RGB; /* colorspace of input image */ /* Now use the library's routine to set default compression parameters. * (You must set at least cinfo.in_color_space before calling this, * since the defaults depend on the source color space.) @@ -605,7 +605,7 @@ word direct; common->Printf("writeCodeBook: false VQ DATA!!!!\n"); return; } - + direct = RoQ_QUAD_CODEBOOK; Write16Word( &direct, RoQFile); @@ -635,7 +635,7 @@ byte *cccList; bool *use2, *use4; int dx,dy,dxMean,dyMean,index2[256],index4[256], dimension; - cccList = (byte *)Mem_Alloc( numQuadCels * 8); // maximum length + cccList = (byte *)Mem_Alloc( numQuadCels * 8); // maximum length use2 = (bool *)Mem_Alloc(256*sizeof(bool)); use4 = (bool *)Mem_Alloc(256*sizeof(bool)); @@ -783,7 +783,7 @@ int dx,dy,dxMean,dyMean,index2[256],index4[256], dimension; } direct = RoQ_QUAD_VQ; - + Write16Word( &direct, RoQFile); j = onCCC; @@ -798,7 +798,7 @@ int dx,dy,dxMean,dyMean,index2[256],index4[256], dimension; common->Printf("writeFrame: outputting %d bytes to RoQ_QUAD_VQ\n", j); previousSize = j; - + RoQFile->Write( cccList, onCCC ); Mem_Free( cccList ); @@ -818,7 +818,7 @@ void roq::LoadAndDisplayImage( const char * filename ) currentFile = filename; image = new NSBitmapImageRep( filename ); - + numQuadCels = ((image->pixelsWide() & 0xfff0)*(image->pixelsHigh() & 0xfff0))/(MINSIZE*MINSIZE); numQuadCels += numQuadCels/4 + numQuadCels/16; @@ -827,7 +827,7 @@ void roq::LoadAndDisplayImage( const char * filename ) // imageData = [image data]; // memset( imageData, 0, image->pixelsWide()*image->pixelsHigh()*[image samplesPerPixel]); // } - + if (!quietMode) common->Printf("loadAndDisplayImage: %dx%d\n", image->pixelsWide(), image->pixelsHigh()); } diff --git a/neo/tools/compilers/roqvq/roq.h b/neo/tools/compilers/roqvq/roq.h index 694069fd..927d0dbf 100644 --- a/neo/tools/compilers/roqvq/roq.h +++ b/neo/tools/compilers/roqvq/roq.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"). @@ -49,21 +49,21 @@ public: ~NSBitmapImageRep(); NSBitmapImageRep & operator=( const NSBitmapImageRep &a ); - + int samplesPerPixel( void ); int pixelsWide( void ); int pixelsHigh( void ); byte * bitmapData( void ); bool hasAlpha( void ); bool isPlanar( void ); - + private: byte * bmap; int width; int height; ID_TIME_T timestamp; - + }; class roq { @@ -103,12 +103,12 @@ private: int SizeFile( idFile *ftosize ); void CloseRoQFile( void ); void WriteCodeBookToStream( byte *codebook, int csize, word cflags ); - + #if 0 static void JPEGInitDestination( j_compress_ptr cinfo ); static boolean JPEGEmptyOutputBuffer( j_compress_ptr cinfo ); static void JPEGTermDestination( j_compress_ptr cinfo ); - + void JPEGStartCompress( j_compress_ptr cinfo, bool write_all_tables ); JDIMENSION JPEGWriteScanlines( j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines ); void JPEGDest( j_compress_ptr cinfo, byte* outfile, int size ); @@ -123,15 +123,15 @@ private: int numQuadCels; bool quietMode; bool lastFrame; - idStr roqOutfile; - idStr currentFile; + idStr roqOutfile; + idStr currentFile; int numberOfFrames; int previousSize; - byte codes[4096]; + byte codes[4096]; bool dataStuff; }; -extern roq *theRoQ; // current roq +extern roq *theRoQ; // current roq #endif /* !__roq_h__ */ diff --git a/neo/tools/compilers/roqvq/roqParam.cpp b/neo/tools/compilers/roqvq/roqParam.cpp index 9b47e623..36d5a9d1 100644 --- a/neo/tools/compilers/roqvq/roqParam.cpp +++ b/neo/tools/compilers/roqvq/roqParam.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"). @@ -37,7 +37,7 @@ If you have questions concerning this license or the applicable additional terms int parseRange(const char *rangeStr,int field, int skipnum[], int startnum[], int endnum[],int numfiles[],bool padding[],int numpadding[] ); int parseTimecodeRange(const char *rangeStr,int field, int skipnum[], int startnum[], int endnum[],int numfiles[],bool padding[],int numpadding[] ); -void roqParam::InitFromFile( const char *fileName ) +void roqParam::InitFromFile( const char *fileName ) { idParser *src; idToken token; @@ -50,7 +50,7 @@ void roqParam::InitFromFile( const char *fileName ) common->Printf("Error: can't open param file %s\n", fileName); return; } - + common->Printf("initFromFile: %s\n", fileName); fullSearch = false; @@ -83,7 +83,7 @@ void roqParam::InitFromFile( const char *fileName ) if ( !src->ReadToken( &token ) ) { break; } - + readarg = 0; // input dir if (token.Icmp( "input_dir") == 0) { @@ -153,7 +153,7 @@ void roqParam::InitFromFile( const char *fileName ) hasSound = true; continue; } -// outfile +// outfile if (token.Icmp( "filename") == 0) { src->ReadToken( &token ); outputFilename = token; @@ -196,7 +196,7 @@ void roqParam::InitFromFile( const char *fileName ) readarg++; continue; } -// key_color r g b +// key_color r g b if (token.Icmp( "key_color") == 0) { keyR = src->ParseInt(); keyG = src->ParseInt(); @@ -265,7 +265,7 @@ void roqParam::InitFromFile( const char *fileName ) field = 0; realnum = 0; - do { + do { src->ReadToken(&token); if ( token.Icmp( "end_input") != 0 ) { idStr arg1, arg2, arg3; @@ -295,7 +295,7 @@ void roqParam::InitFromFile( const char *fileName ) range[field] = 0; numfiles[field] = 1; realnum++; - } + } else { if ( arg1[0] == '[' ) { @@ -311,7 +311,7 @@ void roqParam::InitFromFile( const char *fileName ) } else if (( arg1[0] != '[' ) && ( arg2[0] == '[') && ( arg3[0] =='[')) { //a double ranger... int files1,files2; - + file2[field] = arg1; range[field] = 2; files1 = parseRange(arg2, field, skipnum, startnum, endnum, numfiles, padding, numpadding); @@ -328,7 +328,7 @@ void roqParam::InitFromFile( const char *fileName ) else { common->Error("Error: invalid range on open (%s %s %s)\n", arg1.c_str(), arg2.c_str(), arg3.c_str() ); } - } + } field++; } } while (token.Icmp( "end_input")); @@ -347,29 +347,29 @@ void roqParam::GetNthInputFileName( idStr &fileName, int n ) { if ( n > realnum ) n = realnum; // overcome starting at zero by ++ing and then --ing. if (TwentyFourToThirty()) { n++; n = (n/5) * 4 + (n % 5); n--; } - + i = 0; myfield = 0; - + while (i <= n) { i += numfiles[myfield++]; } myfield--; i -= numfiles[myfield]; - + if ( range[myfield] == 1 ) { - + strcpy( left, file[myfield] ); strp = strstr( left, "*" ); *strp++ = 0; sprintf(right, "%s", strp); - + if ( startnum[myfield] <= endnum[myfield] ) { index = startnum[myfield] + ((n-i)*skipnum[myfield]); } else { index = startnum[myfield] - ((n-i)*skipnum[myfield]); } - + if ( padding[myfield] == true ) { if (useTimecodeForRange) { hrs = index/(30*60*60) ; @@ -395,18 +395,18 @@ void roqParam::GetNthInputFileName( idStr &fileName, int n ) { } } } else if ( range[myfield] == 2 ) { - + strcpy( left, file[myfield] ); strp = strstr( left, "*" ); *strp++ = 0; sprintf(right, "%s", strp); - + if ( startnum[myfield] <= endnum[myfield] ) { index = startnum[myfield] + ((n-i)*skipnum[myfield]); } else { index = startnum[myfield] - ((n-i)*skipnum[myfield]); } - + if ( padding[myfield] == true ) { sprintf(tempfile, "%032d", index ); sprintf(fileName, "%s%s%s", left, &tempfile[ 32-numpadding[myfield] ], right ); @@ -418,13 +418,13 @@ void roqParam::GetNthInputFileName( idStr &fileName, int n ) { strp = strstr( left, "*" ); *strp++ = 0; sprintf(right, "%s", strp); - + if ( startnum2[myfield] <= endnum2[myfield] ) { index = startnum2[myfield] + ((n-i)*skipnum2[myfield]); } else { index = startnum2[myfield] - ((n-i)*skipnum2[myfield]); } - + if ( padding2[myfield] == true ) { sprintf(tempfile, "%032d", index ); fileName += va( "\n%s%s%s", left, &tempfile[ 32-numpadding2[myfield] ], right ); @@ -446,19 +446,19 @@ const char* roqParam::GetNextImageFilename( void ) { onFrame--; justDeltaFlag = false; } - + if ( addPath == true ) { currentFile = currentPath + "/" + tempBuffer; } else { currentFile = tempBuffer; - } + } len = currentFile.Length(); for(i=0;iCreate ( instance ) ) { delete mDebuggerWindow; @@ -87,7 +87,7 @@ bool rvDebuggerApp::Initialize ( HINSTANCE instance ) if ( !mClient.Initialize ( ) ) { return false; - } + } mAccelerators = LoadAccelerators ( mInstance, MAKEINTRESOURCE(IDR_DBG_ACCELERATORS) ); @@ -107,11 +107,11 @@ bool rvDebuggerApp::ProcessWindowMessages ( void ) while ( PeekMessage ( &msg, NULL, 0, 0, PM_NOREMOVE ) ) { - if ( !GetMessage (&msg, NULL, 0, 0) ) + if ( !GetMessage (&msg, NULL, 0, 0) ) { return false; } - + if ( !TranslateAccelerator ( &msg ) ) { TranslateMessage(&msg); @@ -135,7 +135,7 @@ bool rvDebuggerApp::TranslateAccelerator ( LPMSG msg ) { return true; } - + return false; } @@ -147,20 +147,19 @@ Main Loop for the debugger application ================ */ int rvDebuggerApp::Run ( void ) -{ +{ // Main message loop: while ( ProcessWindowMessages ( ) ) { mClient.ProcessMessages ( ); - + Sleep ( 0 ); } - + mClient.Shutdown ( ); mOptions.Save ( ); - + delete mDebuggerWindow; - + return 1; } - diff --git a/neo/tools/debugger/DebuggerApp.h b/neo/tools/debugger/DebuggerApp.h index c16a3d2a..d659b1d4 100644 --- a/neo/tools/debugger/DebuggerApp.h +++ b/neo/tools/debugger/DebuggerApp.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"). @@ -59,15 +59,15 @@ public: bool Initialize ( HINSTANCE hInstance ); int Run ( void ); - + rvRegistryOptions& GetOptions ( void ); rvDebuggerClient& GetClient ( void ); rvDebuggerWindow& GetWindow ( void ); - + HINSTANCE GetInstance ( void ); bool TranslateAccelerator ( LPMSG msg ); - + protected: rvRegistryOptions mOptions; @@ -75,7 +75,7 @@ protected: HINSTANCE mInstance; rvDebuggerClient mClient; HACCEL mAccelerators; - + private: bool ProcessNetMessages ( void ); diff --git a/neo/tools/debugger/DebuggerBreakpoint.cpp b/neo/tools/debugger/DebuggerBreakpoint.cpp index 0c1c5234..312ff85e 100644 --- a/neo/tools/debugger/DebuggerBreakpoint.cpp +++ b/neo/tools/debugger/DebuggerBreakpoint.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"). @@ -39,12 +39,12 @@ rvDebuggerBreakpoint::rvDebuggerBreakpoint ( const char* filename, int linenumbe mFilename = filename; mLineNumber = linenumber; mEnabled = true; - + if ( id == -1 ) - { + { mID = mNextID++; - } - else + } + else { mID = id; } diff --git a/neo/tools/debugger/DebuggerBreakpoint.h b/neo/tools/debugger/DebuggerBreakpoint.h index f264f103..a1f07a68 100644 --- a/neo/tools/debugger/DebuggerBreakpoint.h +++ b/neo/tools/debugger/DebuggerBreakpoint.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 #ifndef DEBUGGERBREAKPOINT_H_ #define DEBUGGERBREAKPOINT_H_ -class rvDebuggerBreakpoint +class rvDebuggerBreakpoint { public: @@ -46,7 +46,7 @@ protected: int mID; int mLineNumber; idStr mFilename; - + private: static int mNextID; diff --git a/neo/tools/debugger/DebuggerClient.cpp b/neo/tools/debugger/DebuggerClient.cpp index 55adf662..04102e46 100644 --- a/neo/tools/debugger/DebuggerClient.cpp +++ b/neo/tools/debugger/DebuggerClient.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 @@ rvDebuggerClient::~rvDebuggerClient */ rvDebuggerClient::~rvDebuggerClient ( ) { - ClearBreakpoints ( ); + ClearBreakpoints ( ); ClearCallstack ( ); ClearThreads ( ); } @@ -75,13 +75,13 @@ bool rvDebuggerClient::Initialize ( void ) // Server must be running on the local host on port 28980 Sys_StringToNetAdr ( "localhost", &mServerAdrt, true ); mServerAdr.port = 27980; - + // Attempt to let the server know we are here. The server may not be running so this // message will just get ignored. SendMessage ( DBMSG_CONNECT ); return true; -} +} /* ================ @@ -97,7 +97,7 @@ void rvDebuggerClient::Shutdown ( void ) { SendMessage ( DBMSG_DISCONNECT ); mConnected = false; - } + } } /* @@ -127,13 +127,13 @@ bool rvDebuggerClient::ProcessMessages ( void ) } command = (unsigned short) MSG_ReadShort ( &msg ); - + // Is this what we are waiting for? if ( command == mWaitFor ) { mWaitFor = DBMSG_UNKNOWN; } - + switch ( command ) { case DBMSG_CONNECT: @@ -141,37 +141,37 @@ bool rvDebuggerClient::ProcessMessages ( void ) SendMessage ( DBMSG_CONNECTED ); SendBreakpoints ( ); break; - + case DBMSG_CONNECTED: mConnected = true; SendBreakpoints ( ); break; - + case DBMSG_DISCONNECT: mConnected = false; break; - + case DBMSG_BREAK: - HandleBreak ( &msg ); + HandleBreak ( &msg ); break; - + // Callstack being send to the client case DBMSG_INSPECTCALLSTACK: HandleInspectCallstack ( &msg ); break; - + // Thread list is being sent to the client case DBMSG_INSPECTTHREADS: HandleInspectThreads ( &msg ); break; - + case DBMSG_INSPECTVARIABLE: HandleInspectVariable ( &msg ); - break; - } - + break; + } + // Give the window a chance to process the message - msg.readcount = 0; + msg.readcount = 0; msg.bit = 0; gDebuggerApp.GetWindow().ProcessNetMessage ( &msg ); } @@ -184,7 +184,7 @@ bool rvDebuggerClient::ProcessMessages ( void ) rvDebuggerClient::HandleBreak Handle the DBMSG_BREAK message send from the server. This message is handled -by caching the file and linenumber where the break occured. +by caching the file and linenumber where the break occured. ================ */ void rvDebuggerClient::HandleBreak ( msg_t* msg ) @@ -195,18 +195,18 @@ void rvDebuggerClient::HandleBreak ( msg_t* msg ) // Line number mBreakLineNumber = MSG_ReadLong ( msg ); - + // Filename MSG_ReadString ( msg, filename, MAX_PATH ); mBreakFilename = filename; - + // Clear the variables mVariables.Clear ( ); // Request the callstack and threads SendMessage ( DBMSG_INSPECTCALLSTACK ); WaitFor ( DBMSG_INSPECTCALLSTACK, 2000 ); - + SendMessage ( DBMSG_INSPECTTHREADS ); WaitFor ( DBMSG_INSPECTTHREADS, 2000 ); } @@ -224,12 +224,12 @@ void rvDebuggerClient::InspectVariable ( const char* name, int callstackDepth ) { msg_t msg; byte buffer[MAX_MSGLEN]; - + MSG_Init( &msg, buffer, sizeof( buffer ) ); MSG_WriteShort ( &msg, (int)DBMSG_INSPECTVARIABLE ); MSG_WriteShort ( &msg, (short)(mCallstack.Num()-callstackDepth) ); MSG_WriteString ( &msg, name ); - + SendPacket ( msg.data, msg.cursize ); } @@ -243,15 +243,15 @@ is handled by adding the callstack entries to a list for later lookup. */ void rvDebuggerClient::HandleInspectCallstack ( msg_t* msg ) { - int depth; - + int depth; + ClearCallstack ( ); - // Read all of the callstack entries specfied in the message + // Read all of the callstack entries specfied in the message for ( depth = (short)MSG_ReadShort ( msg ) ; depth > 0; depth -- ) { rvDebuggerCallstack* entry = new rvDebuggerCallstack; - + char temp[1024]; // Function name @@ -284,11 +284,11 @@ void rvDebuggerClient::HandleInspectThreads ( msg_t* msg ) ClearThreads ( ); - // Loop over the number of threads in the message + // Loop over the number of threads in the message for ( count = (short)MSG_ReadShort ( msg ) ; count > 0; count -- ) { rvDebuggerThread* entry = new rvDebuggerThread; - + char temp[1024]; // Thread name @@ -322,47 +322,47 @@ void rvDebuggerClient::HandleInspectVariable ( msg_t* msg ) char var[1024]; char value[1024]; int callDepth; - + callDepth = (short)MSG_ReadShort ( msg ); MSG_ReadString ( msg, var, 1024 ); MSG_ReadString ( msg, value, 1024 ); - - mVariables.Set ( va("%d:%s", mCallstack.Num()-callDepth, var), value ); + + mVariables.Set ( va("%d:%s", mCallstack.Num()-callDepth, var), value ); } /* ================ rvDebuggerClient::WaitFor -Waits the given amount of time for the specified message to be received by the +Waits the given amount of time for the specified message to be received by the debugger client. ================ */ bool rvDebuggerClient::WaitFor ( EDebuggerMessage msg, int time ) { int start; - + // Cant wait if not connected if ( !mConnected ) { return false; } - + start = Sys_Milliseconds ( ); mWaitFor = msg; - + while ( mWaitFor != DBMSG_UNKNOWN && Sys_Milliseconds()-start < time ) { ProcessMessages ( ); Sleep ( 0 ); } - + if ( mWaitFor != DBMSG_UNKNOWN ) { mWaitFor = DBMSG_UNKNOWN; return false; } - + return true; } @@ -376,17 +376,17 @@ Searches for a breakpoint that maches the given filename and linenumber rvDebuggerBreakpoint* rvDebuggerClient::FindBreakpoint ( const char* filename, int linenumber ) { int i; - + for ( i = 0; i < mBreakpoints.Num(); i ++ ) { rvDebuggerBreakpoint* bp = mBreakpoints[i]; - + if ( linenumber == bp->GetLineNumber ( ) && !idStr::Icmp ( bp->GetFilename ( ), filename ) ) { return bp; } } - + return NULL; } @@ -400,16 +400,16 @@ Removes all breakpoints from the client and server void rvDebuggerClient::ClearBreakpoints ( void ) { int i; - + for ( i = 0; i < GetBreakpointCount(); i ++ ) { rvDebuggerBreakpoint* bp = mBreakpoints[i]; assert ( bp ); - + SendRemoveBreakpoint ( *bp ); - delete bp; + delete bp; } - + mBreakpoints.Clear ( ); } @@ -422,10 +422,10 @@ Adds a breakpoint to the client and server with the give nfilename and linenumbe */ int rvDebuggerClient::AddBreakpoint ( const char* filename, int lineNumber, bool onceOnly ) { - int index = mBreakpoints.Append ( new rvDebuggerBreakpoint ( filename, lineNumber ) ); - + int index = mBreakpoints.Append ( new rvDebuggerBreakpoint ( filename, lineNumber ) ); + SendAddBreakpoint ( *mBreakpoints[index] ); - + return index; } @@ -439,9 +439,9 @@ Removes the breakpoint with the given ID from the client and server bool rvDebuggerClient::RemoveBreakpoint ( int bpID ) { int index; - + for ( index = 0; index < GetBreakpointCount(); index ++ ) - { + { if ( mBreakpoints[index]->GetID ( ) == bpID ) { SendRemoveBreakpoint ( *mBreakpoints[index] ); @@ -450,7 +450,7 @@ bool rvDebuggerClient::RemoveBreakpoint ( int bpID ) return true; } } - + return false; } @@ -468,7 +468,7 @@ void rvDebuggerClient::SendMessage ( EDebuggerMessage dbmsg ) MSG_Init( &msg, buffer, sizeof( buffer ) ); MSG_WriteShort ( &msg, (int)dbmsg ); - + SendPacket ( msg.data, msg.cursize ); } @@ -487,7 +487,7 @@ void rvDebuggerClient::SendBreakpoints ( void ) { return; } - + // Send all the breakpoints to the server for ( i = 0; i < mBreakpoints.Num(); i ++ ) { @@ -506,19 +506,19 @@ void rvDebuggerClient::SendAddBreakpoint ( rvDebuggerBreakpoint& bp, bool onceOn { msg_t msg; byte buffer[MAX_MSGLEN]; - + if ( !mConnected ) { return; } - + MSG_Init( &msg, buffer, sizeof( buffer ) ); MSG_WriteShort ( &msg, (int)DBMSG_ADDBREAKPOINT ); MSG_WriteBits ( &msg, onceOnly?1:0, 1 ); MSG_WriteLong ( &msg, (unsigned long) bp.GetLineNumber ( ) ); MSG_WriteLong ( &msg, bp.GetID ( ) ); MSG_WriteString ( &msg, bp.GetFilename() ); - + SendPacket ( msg.data, msg.cursize ); } @@ -538,11 +538,11 @@ void rvDebuggerClient::SendRemoveBreakpoint ( rvDebuggerBreakpoint& bp ) { return; } - + MSG_Init( &msg, buffer, sizeof( buffer ) ); MSG_WriteShort ( &msg, (int)DBMSG_REMOVEBREAKPOINT ); MSG_WriteLong ( &msg, bp.GetID() ); - + SendPacket ( msg.data, msg.cursize ); } @@ -556,7 +556,7 @@ Clear all callstack entries void rvDebuggerClient::ClearCallstack ( void ) { int depth; - + for ( depth = 0; depth < mCallstack.Num(); depth ++ ) { delete mCallstack[depth]; @@ -575,12 +575,11 @@ Clear all thread entries void rvDebuggerClient::ClearThreads ( void ) { int i; - + for ( i = 0; i < mThreads.Num(); i ++ ) { delete mThreads[i]; } - + mThreads.Clear ( ); } - diff --git a/neo/tools/debugger/DebuggerClient.h b/neo/tools/debugger/DebuggerClient.h index c514e268..dfc67717 100644 --- a/neo/tools/debugger/DebuggerClient.h +++ b/neo/tools/debugger/DebuggerClient.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,19 +68,19 @@ public: void Shutdown ( void ); bool ProcessMessages ( void ); bool WaitFor ( EDebuggerMessage msg, int time ); - + bool IsConnected ( void ); bool IsStopped ( void ); - + int GetActiveBreakpointID ( void ); const char* GetBreakFilename ( void ); int GetBreakLineNumber ( void ); rvDebuggerCallstackList& GetCallstack ( void ); rvDebuggerThreadList& GetThreads ( void ); const char* GetVariableValue ( const char* name, int stackDepth ); - + void InspectVariable ( const char* name, int callstackDepth ); - + void Break ( void ); void Resume ( void ); void StepInto ( void ); @@ -93,7 +93,7 @@ public: int GetBreakpointCount ( void ); rvDebuggerBreakpoint* GetBreakpoint ( int index ); rvDebuggerBreakpoint* FindBreakpoint ( const char* filename, int linenumber ); - + protected: void SendMessage ( EDebuggerMessage dbmsg ); @@ -105,27 +105,27 @@ protected: bool mConnected; netadr_t mServerAdr; idPort mPort; - + bool mBreak; int mBreakID; int mBreakLineNumber; idStr mBreakFilename; - + idDict mVariables; rvDebuggerCallstackList mCallstack; - rvDebuggerThreadList mThreads; + rvDebuggerThreadList mThreads; rvDebuggerBreakpointList mBreakpoints; EDebuggerMessage mWaitFor; - + private: void ClearCallstack ( void ); void ClearThreads ( void ); - + void UpdateWatches ( void ); - + // Network message handlers void HandleBreak ( msg_t* msg ); void HandleInspectCallstack ( msg_t* msg ); diff --git a/neo/tools/debugger/DebuggerFindDlg.cpp b/neo/tools/debugger/DebuggerFindDlg.cpp index 7e13025d..074bc3a0 100644 --- a/neo/tools/debugger/DebuggerFindDlg.cpp +++ b/neo/tools/debugger/DebuggerFindDlg.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,7 +52,7 @@ Launch the dialog ================ */ bool rvDebuggerFindDlg::DoModal ( rvDebuggerWindow* parent ) -{ +{ if ( DialogBoxParam ( parent->GetInstance(), MAKEINTRESOURCE(IDD_DBG_FIND), parent->GetWindow(), DlgProc, (LONG)this ) ) { return true; @@ -71,20 +71,20 @@ Dialog Procedure for the find dialog INT_PTR CALLBACK rvDebuggerFindDlg::DlgProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam ) { rvDebuggerFindDlg* dlg = (rvDebuggerFindDlg*) GetWindowLong ( wnd, GWL_USERDATA ); - + switch ( msg ) - { + { case WM_CLOSE: EndDialog ( wnd, 0 ); break; - - case WM_INITDIALOG: + + case WM_INITDIALOG: dlg = (rvDebuggerFindDlg*) lparam; SetWindowLong ( wnd, GWL_USERDATA, (LONG) dlg ); dlg->mWnd = wnd; SetWindowText ( GetDlgItem ( dlg->mWnd, IDC_DBG_FIND ), dlg->mFindText ); return TRUE; - + case WM_COMMAND: switch ( LOWORD(wparam) ) { @@ -94,13 +94,13 @@ INT_PTR CALLBACK rvDebuggerFindDlg::DlgProc ( HWND wnd, UINT msg, WPARAM wparam, EndDialog ( wnd, 1 ); break; } - + case IDCANCEL: EndDialog ( wnd, 0 ); break; } break; } - + return FALSE; } diff --git a/neo/tools/debugger/DebuggerFindDlg.h b/neo/tools/debugger/DebuggerFindDlg.h index 896100c4..15940161 100644 --- a/neo/tools/debugger/DebuggerFindDlg.h +++ b/neo/tools/debugger/DebuggerFindDlg.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/neo/tools/debugger/DebuggerMessages.h b/neo/tools/debugger/DebuggerMessages.h index a113f7b9..6e0cba43 100644 --- a/neo/tools/debugger/DebuggerMessages.h +++ b/neo/tools/debugger/DebuggerMessages.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/neo/tools/debugger/DebuggerQuickWatchDlg.cpp b/neo/tools/debugger/DebuggerQuickWatchDlg.cpp index a5bb7ada..c7cbf827 100644 --- a/neo/tools/debugger/DebuggerQuickWatchDlg.cpp +++ b/neo/tools/debugger/DebuggerQuickWatchDlg.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"). @@ -54,7 +54,7 @@ bool rvDebuggerQuickWatchDlg::DoModal ( rvDebuggerWindow* window, int callstackD mCallstackDepth = callstackDepth; mDebuggerWindow = window; mVariable = variable?variable:""; - + DialogBoxParam ( window->GetInstance(), MAKEINTRESOURCE(IDD_DBG_QUICKWATCH), window->GetWindow(), DlgProc, (LONG)this ); return true; @@ -70,7 +70,7 @@ Dialog Procedure for the quick watch dialog INT_PTR CALLBACK rvDebuggerQuickWatchDlg::DlgProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam ) { rvDebuggerQuickWatchDlg* dlg = (rvDebuggerQuickWatchDlg*) GetWindowLong ( wnd, GWL_USERDATA ); - + switch ( msg ) { case WM_GETMINMAXINFO: @@ -80,18 +80,18 @@ INT_PTR CALLBACK rvDebuggerQuickWatchDlg::DlgProc ( HWND wnd, UINT msg, WPARAM w mmi->ptMinTrackSize.y = 200; break; } - + case WM_CLOSE: gDebuggerApp.GetOptions().SetWindowPlacement ( "wp_quickwatch", wnd ); gDebuggerApp.GetOptions().SetColumnWidths ( "cw_quickwatch", GetDlgItem ( wnd, IDC_DBG_CURVALUE ) ); EndDialog ( wnd, 0 ); break; - + case WM_SIZE: { RECT client; RECT button; - + GetClientRect ( wnd, &client ); GetWindowRect ( GetDlgItem ( wnd, IDC_DBG_RECALC ), &button ); ScreenToClient ( wnd, (POINT*)&button ); @@ -101,28 +101,28 @@ INT_PTR CALLBACK rvDebuggerQuickWatchDlg::DlgProc ( HWND wnd, UINT msg, WPARAM w GetWindowRect ( GetDlgItem ( wnd, IDC_DBG_CLOSE ), &button ); ScreenToClient ( wnd, (POINT*)&button ); ScreenToClient ( wnd, (POINT*)&button.right ); - MoveWindow ( GetDlgItem ( wnd, IDC_DBG_CLOSE ), client.right - dlg->mButtonFromRight, button.top, button.right-button.left,button.bottom-button.top, TRUE ); + MoveWindow ( GetDlgItem ( wnd, IDC_DBG_CLOSE ), client.right - dlg->mButtonFromRight, button.top, button.right-button.left,button.bottom-button.top, TRUE ); GetWindowRect ( GetDlgItem ( wnd, IDC_DBG_ADDWATCH ), &button ); ScreenToClient ( wnd, (POINT*)&button ); ScreenToClient ( wnd, (POINT*)&button.right ); - MoveWindow ( GetDlgItem ( wnd, IDC_DBG_ADDWATCH ), client.right - dlg->mButtonFromRight, button.top, button.right-button.left,button.bottom-button.top, TRUE ); + MoveWindow ( GetDlgItem ( wnd, IDC_DBG_ADDWATCH ), client.right - dlg->mButtonFromRight, button.top, button.right-button.left,button.bottom-button.top, TRUE ); GetWindowRect ( GetDlgItem ( wnd, IDC_DBG_VARIABLE ), &button ); ScreenToClient ( wnd, (POINT*)&button ); ScreenToClient ( wnd, (POINT*)&button.right ); - MoveWindow ( GetDlgItem ( wnd, IDC_DBG_VARIABLE ), button.left, button.top, client.right-button.left-dlg->mEditFromRight, button.bottom-button.top, TRUE ); + MoveWindow ( GetDlgItem ( wnd, IDC_DBG_VARIABLE ), button.left, button.top, client.right-button.left-dlg->mEditFromRight, button.bottom-button.top, TRUE ); GetWindowRect ( GetDlgItem ( wnd, IDC_DBG_CURVALUE ), &button ); ScreenToClient ( wnd, (POINT*)&button ); ScreenToClient ( wnd, (POINT*)&button.right ); - MoveWindow ( GetDlgItem ( wnd, IDC_DBG_CURVALUE ), button.left, button.top, client.right-button.left-dlg->mEditFromRight, client.bottom-button.top - dlg->mEditFromBottom, TRUE ); - + MoveWindow ( GetDlgItem ( wnd, IDC_DBG_CURVALUE ), button.left, button.top, client.right-button.left-dlg->mEditFromRight, client.bottom-button.top - dlg->mEditFromBottom, TRUE ); + break; } - - case WM_INITDIALOG: - { + + case WM_INITDIALOG: + { RECT client; RECT button; @@ -130,18 +130,18 @@ INT_PTR CALLBACK rvDebuggerQuickWatchDlg::DlgProc ( HWND wnd, UINT msg, WPARAM w dlg = (rvDebuggerQuickWatchDlg*) lparam; SetWindowLong ( wnd, GWL_USERDATA, lparam ); dlg->mWnd = wnd; - + GetClientRect ( wnd, &client ); GetWindowRect ( GetDlgItem ( wnd, IDC_DBG_RECALC ), &button ); - ScreenToClient ( wnd, (POINT*)&button ); + ScreenToClient ( wnd, (POINT*)&button ); dlg->mButtonFromRight = client.right - button.left; GetWindowRect ( GetDlgItem ( wnd, IDC_DBG_CURVALUE ), &button ); ScreenToClient ( wnd, (POINT*)&button.right ); dlg->mEditFromRight = client.right - button.right; dlg->mEditFromBottom = client.bottom - button.bottom; - + // Disable the value controls until a variable is entered EnableWindow ( GetDlgItem ( wnd, IDC_DBG_ADDWATCH ), false ); EnableWindow ( GetDlgItem ( wnd, IDC_DBG_RECALC ), false ); @@ -157,7 +157,7 @@ INT_PTR CALLBACK rvDebuggerQuickWatchDlg::DlgProc ( HWND wnd, UINT msg, WPARAM w col.cx = 150; col.pszText = "Value"; ListView_InsertColumn ( GetDlgItem ( wnd, IDC_DBG_CURVALUE ), 1, &col ); - + // Set the initial variable if one was given if ( dlg->mVariable.Length() ) { @@ -167,19 +167,19 @@ INT_PTR CALLBACK rvDebuggerQuickWatchDlg::DlgProc ( HWND wnd, UINT msg, WPARAM w gDebuggerApp.GetOptions().GetWindowPlacement ( "wp_quickwatch", wnd ); gDebuggerApp.GetOptions().GetColumnWidths ( "cw_quickwatch", GetDlgItem ( wnd, IDC_DBG_CURVALUE ) ); - + return TRUE; } - + case WM_COMMAND: switch ( LOWORD(wparam) ) { case IDC_DBG_CLOSE: SendMessage ( wnd, WM_CLOSE, 0, 0 ); break; - + case IDC_DBG_VARIABLE: - // When the variable text changes to something other than empty + // When the variable text changes to something other than empty // we can enable the addwatch and recalc buttons if ( HIWORD(wparam) == EN_CHANGE ) { @@ -192,22 +192,22 @@ INT_PTR CALLBACK rvDebuggerQuickWatchDlg::DlgProc ( HWND wnd, UINT msg, WPARAM w case IDC_DBG_ADDWATCH: { char varname[1024]; - GetWindowText ( GetDlgItem ( wnd, IDC_DBG_VARIABLE ), varname, 1023 ); + GetWindowText ( GetDlgItem ( wnd, IDC_DBG_VARIABLE ), varname, 1023 ); dlg->mDebuggerWindow->AddWatch ( varname ); break; } - + case IDC_DBG_RECALC: { char varname[1024]; - GetWindowText ( GetDlgItem ( wnd, IDC_DBG_VARIABLE ), varname, 1023 ); + GetWindowText ( GetDlgItem ( wnd, IDC_DBG_VARIABLE ), varname, 1023 ); dlg->SetVariable ( varname ); break; } } break; } - + return FALSE; } @@ -226,7 +226,7 @@ void rvDebuggerQuickWatchDlg::SetVariable ( const char* varname, bool force ) return; } - // Throw up a wait cursor + // Throw up a wait cursor SetCursor ( LoadCursor ( NULL, IDC_WAIT ) ); // Clear the current value list control @@ -235,12 +235,12 @@ void rvDebuggerQuickWatchDlg::SetVariable ( const char* varname, bool force ) // Get the value of the new variable gDebuggerApp.GetClient().InspectVariable ( varname, mCallstackDepth ); - // Wait for the variable value to be sent over from the debugger server + // Wait for the variable value to be sent over from the debugger server if ( !gDebuggerApp.GetClient().WaitFor ( DBMSG_INSPECTVARIABLE, 2500 ) ) { return; } - + // Make sure we got the value of the variable if ( !gDebuggerApp.GetClient().GetVariableValue(varname, mCallstackDepth)[0] ) { @@ -251,14 +251,14 @@ void rvDebuggerQuickWatchDlg::SetVariable ( const char* varname, bool force ) mVariable = varname; EnableWindow ( GetDlgItem ( mWnd, IDC_DBG_CURVALUE ), true ); EnableWindow ( GetDlgItem ( mWnd, IDC_DBG_CURVALUE_STATIC ), true ); - - // Add the variablae value to the list control + + // Add the variablae value to the list control LVITEM item; item.mask = LVIF_TEXT; item.pszText = (LPSTR)varname; item.iItem = 0; item.iSubItem = 0; - ListView_InsertItem ( GetDlgItem ( mWnd, IDC_DBG_CURVALUE ), &item ); + ListView_InsertItem ( GetDlgItem ( mWnd, IDC_DBG_CURVALUE ), &item ); ListView_SetItemText ( GetDlgItem ( mWnd, IDC_DBG_CURVALUE ), 0, 1, (LPSTR)gDebuggerApp.GetClient().GetVariableValue(varname,mCallstackDepth) ); // Give focus back to the variable edit control and set the cursor back to an arrow diff --git a/neo/tools/debugger/DebuggerQuickWatchDlg.h b/neo/tools/debugger/DebuggerQuickWatchDlg.h index c1189e81..2de75400 100644 --- a/neo/tools/debugger/DebuggerQuickWatchDlg.h +++ b/neo/tools/debugger/DebuggerQuickWatchDlg.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/neo/tools/debugger/DebuggerScript.cpp b/neo/tools/debugger/DebuggerScript.cpp index 848bdf63..3b5a1834 100644 --- a/neo/tools/debugger/DebuggerScript.cpp +++ b/neo/tools/debugger/DebuggerScript.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,26 +67,26 @@ Unload the script from memory void rvDebuggerScript::Unload ( void ) { delete[] mContents; - + if ( mInterface ) { delete mInterface; } else - { + { delete mProgram; } - + mContents = NULL; mProgram = NULL; mInterface = NULL; -} +} /* ================ rvDebuggerScript::Load -Loads the debugger script and attempts to compile it using the method +Loads the debugger script and attempts to compile it using the method appropriate for the file being loaded. If the script cant be compiled the loading of the script fails ================ @@ -101,23 +101,23 @@ bool rvDebuggerScript::Load ( const char* filename ) // Cache the filename used to load the script mFilename = filename; - + // Read in the file - size = fileSystem->ReadFile ( filename, &buffer, &mModifiedTime ); + size = fileSystem->ReadFile ( filename, &buffer, &mModifiedTime ); if ( buffer == NULL ) { return false; } - + // Copy the buffer over mContents = new char [ size + 1 ]; memcpy ( mContents, buffer, size ); - mContents[size] = 0; - + mContents[size] = 0; + // Cleanup fileSystem->FreeFile ( buffer ); - // Now compile the script so we can tell what a valid line is, etc.. If its + // Now compile the script so we can tell what a valid line is, etc.. If its // a gui file then we need to parse it using the userinterface system rather // than the normal script compiler. try @@ -126,7 +126,7 @@ bool rvDebuggerScript::Load ( const char* filename ) mProgram = new idProgram; mProgram->BeginCompilation ( ); mProgram->CompileFile ( SCRIPT_DEFAULT ); - + //BSM Nerve: Loads a game specific main script file idStr gamedir = cvarSystem->GetCVarString( "fs_game" ); if(gamedir.Length() > 0) { @@ -137,7 +137,7 @@ bool rvDebuggerScript::Load ( const char* filename ) } } - + // Make sure the file isnt already compiled before trying to compile it again for ( int f = mProgram->NumFilenames() - 1; f >= 0; f -- ) { @@ -149,12 +149,12 @@ bool rvDebuggerScript::Load ( const char* filename ) break; } } - + if ( f < 0 ) { mProgram->CompileText ( filename, mContents, false ); } - + mProgram->FinishCompilation ( ); } catch ( idException& ) @@ -164,9 +164,9 @@ bool rvDebuggerScript::Load ( const char* filename ) mProgram = NULL; delete[] mContents; mContents = NULL; - + // TODO: Should cache the error for the dialog box - + return false; } @@ -181,7 +181,7 @@ Reload the contents of the script ================ */ bool rvDebuggerScript::Reload ( void ) -{ +{ return Load ( mFilename ); } @@ -195,7 +195,7 @@ Determines whether or not the given line number within the script is a valid lin bool rvDebuggerScript::IsLineCode ( int linenumber ) { int i; - + assert ( mProgram ); // Run through all the statements in the program and see if any match the @@ -207,7 +207,7 @@ bool rvDebuggerScript::IsLineCode ( int linenumber ) return true; } } - + return false; } @@ -222,11 +222,11 @@ it was loaded. bool rvDebuggerScript::IsFileModified ( bool updateTime ) { ID_TIME_T t; - bool result = false; + bool result = false; // Grab the filetime and shut the file down fileSystem->ReadFile ( mFilename, NULL, &t ); - + // Has the file been modified? if ( t > mModifiedTime ) { @@ -239,6 +239,6 @@ bool rvDebuggerScript::IsFileModified ( bool updateTime ) { mModifiedTime = t; } - - return result; + + return result; } diff --git a/neo/tools/debugger/DebuggerScript.h b/neo/tools/debugger/DebuggerScript.h index 4bd7e9e5..d60086a3 100644 --- a/neo/tools/debugger/DebuggerScript.h +++ b/neo/tools/debugger/DebuggerScript.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"). @@ -31,14 +31,14 @@ If you have questions concerning this license or the applicable additional terms class idProgram; class idUserInterfaceLocal; -class rvDebuggerScript +class rvDebuggerScript { public: rvDebuggerScript ( void ); ~rvDebuggerScript ( void ); - bool Load ( const char* filename ); + bool Load ( const char* filename ); bool Reload ( void ); const char* GetFilename ( void ); @@ -47,7 +47,7 @@ public: idProgram& GetProgram ( void ); bool IsLineCode ( int linenumber ); - bool IsFileModified ( bool updateTime = false ); + bool IsFileModified ( bool updateTime = false ); protected: diff --git a/neo/tools/debugger/DebuggerServer.cpp b/neo/tools/debugger/DebuggerServer.cpp index 29bc2013..2ad78a50 100644 --- a/neo/tools/debugger/DebuggerServer.cpp +++ b/neo/tools/debugger/DebuggerServer.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"). @@ -92,17 +92,17 @@ bool rvDebuggerServer::Initialize ( void ) // Server must be running on the local host on port 28980 Sys_StringToNetAdr ( "localhost", &mClientAdr, true ); mClientAdr.port = 27981; - + // Attempt to let the server know we are here. The server may not be running so this // message will just get ignored. SendMessage ( DBMSG_CONNECT ); - + return true; -} +} void rvDebuggerServer::OSPathToRelativePath( const char *osPath, idStr &qpath ) { - if ( strchr( osPath, ':' ) ) + if ( strchr( osPath, ':' ) ) { qpath = fileSystem->OSPathToRelativePath( osPath ); } @@ -159,42 +159,42 @@ bool rvDebuggerServer::ProcessMessages ( void ) { continue; } - + command = (unsigned short) MSG_ReadShort ( &msg ); - + switch ( command ) { case DBMSG_CONNECT: mConnected = true; SendMessage ( DBMSG_CONNECTED ); break; - + case DBMSG_CONNECTED: mConnected = true; break; - + case DBMSG_DISCONNECT: ClearBreakpoints ( ); - Resume ( ); + Resume ( ); mConnected = false; break; - + case DBMSG_ADDBREAKPOINT: HandleAddBreakpoint ( &msg ); break; - + case DBMSG_REMOVEBREAKPOINT: HandleRemoveBreakpoint ( &msg ); break; - + case DBMSG_RESUME: Resume ( ); break; - + case DBMSG_BREAK: mBreakNext = true; break; - + case DBMSG_STEPOVER: mBreakStepOver = true; mBreakStepOverDepth = mBreakInterpreter->GetCallstackDepth ( ); @@ -214,19 +214,19 @@ bool rvDebuggerServer::ProcessMessages ( void ) mBreakStepInto = true; Resume ( ); break; - + case DBMSG_INSPECTVARIABLE: HandleInspectVariable ( &msg ); break; - + case DBMSG_INSPECTCALLSTACK: HandleInspectCallstack ( &msg ); break; - + case DBMSG_INSPECTTHREADS: HandleInspectThreads ( &msg ); break; - } + } } return true; @@ -246,7 +246,7 @@ void rvDebuggerServer::SendMessage ( EDebuggerMessage dbmsg ) MSG_Init( &msg, buffer, sizeof( buffer ) ); MSG_WriteShort ( &msg, (int)dbmsg ); - + SendPacket ( msg.data, msg.cursize ); } @@ -265,16 +265,16 @@ void rvDebuggerServer::HandleAddBreakpoint ( msg_t* msg ) long lineNumber; long id; char filename[MAX_PATH]; - + // Read the breakpoint info - onceOnly = MSG_ReadBits ( msg, 1 ) ? true : false; + onceOnly = MSG_ReadBits ( msg, 1 ) ? true : false; lineNumber = MSG_ReadLong ( msg ); id = MSG_ReadLong ( msg ); - + MSG_ReadString ( msg, filename, MAX_PATH ); - - // Since breakpoints are used by both threads we need to - // protect them with a crit section + + // Since breakpoints are used by both threads we need to + // protect them with a crit section EnterCriticalSection ( &mCriticalSection ); mBreakpoints.Append ( new rvDebuggerBreakpoint ( filename, lineNumber, id ) ); LeaveCriticalSection ( &mCriticalSection ); @@ -285,7 +285,7 @@ void rvDebuggerServer::HandleAddBreakpoint ( msg_t* msg ) rvDebuggerServer::HandleRemoveBreakpoint Handle the DBMSG_REMOVEBREAKPOINT message being sent by the debugger client. This -message is handled by removing the breakpoint that matches the given id from the +message is handled by removing the breakpoint that matches the given id from the list. ================ */ @@ -293,14 +293,14 @@ void rvDebuggerServer::HandleRemoveBreakpoint ( msg_t* msg ) { int i; int id; - + // ID that we are to remove id = MSG_ReadLong ( msg ); - // Since breakpoints are used by both threads we need to - // protect them with a crit section + // Since breakpoints are used by both threads we need to + // protect them with a crit section EnterCriticalSection ( &mCriticalSection ); - + // Find the breakpoint that matches the given id and remove it from the list for ( i = 0; i < mBreakpoints.Num(); i ++ ) { @@ -328,7 +328,7 @@ void rvDebuggerServer::MSG_WriteCallstackFunc ( msg_t* msg, const prstack_t* sta const function_t* func; func = stack->f; - + // If the function is unknown then just fill in with default data. if ( !func ) { @@ -348,16 +348,16 @@ void rvDebuggerServer::MSG_WriteCallstackFunc ( msg_t* msg, const prstack_t* sta if ( st ) { idStr qpath; - OSPathToRelativePath(mBreakProgram->GetFilename( st->file ), qpath); + OSPathToRelativePath(mBreakProgram->GetFilename( st->file ), qpath); qpath.BackSlashesToSlashes ( ); MSG_WriteString ( msg, qpath ); - MSG_WriteLong ( msg, st->linenumber ); + MSG_WriteLong ( msg, st->linenumber ); } else { MSG_WriteString ( msg, "" ); MSG_WriteLong ( msg, 0 ); - } + } } /* @@ -376,7 +376,7 @@ void rvDebuggerServer::HandleInspectCallstack ( msg_t* in_msg ) prstack_t temp; MSG_Init( &msg, buffer, sizeof( buffer ) ); - MSG_WriteShort ( &msg, (int)DBMSG_INSPECTCALLSTACK ); + MSG_WriteShort ( &msg, (int)DBMSG_INSPECTCALLSTACK ); MSG_WriteShort ( &msg, (int)mBreakInterpreter->GetCallstackDepth ( ) ); @@ -384,14 +384,14 @@ void rvDebuggerServer::HandleInspectCallstack ( msg_t* in_msg ) temp.f = mBreakInterpreter->GetCurrentFunction ( ); temp.s = 0; temp.stackbase = 0; - MSG_WriteCallstackFunc ( &msg, &temp ); + MSG_WriteCallstackFunc ( &msg, &temp ); - // Run through all of the callstack and write each to the msg + // Run through all of the callstack and write each to the msg for ( i = mBreakInterpreter->GetCallstackDepth ( ) - 1; i > 0; i -- ) { - MSG_WriteCallstackFunc ( &msg, mBreakInterpreter->GetCallstack ( ) + i ); + MSG_WriteCallstackFunc ( &msg, mBreakInterpreter->GetCallstack ( ) + i ); } - + SendPacket ( msg.data, msg.cursize ); } @@ -410,8 +410,8 @@ void rvDebuggerServer::HandleInspectThreads ( msg_t* in_msg ) // Initialize the message MSG_Init( &msg, buffer, sizeof( buffer ) ); - MSG_WriteShort ( &msg, (int)DBMSG_INSPECTTHREADS ); - + MSG_WriteShort ( &msg, (int)DBMSG_INSPECTTHREADS ); + // Write the number of threads to the message MSG_WriteShort ( &msg, (int)idThread::GetThreads().Num() ); @@ -419,11 +419,11 @@ void rvDebuggerServer::HandleInspectThreads ( msg_t* in_msg ) for ( i = 0; i < idThread::GetThreads().Num(); i ++ ) { idThread* thread = idThread::GetThreads()[i]; - + MSG_WriteString ( &msg, thread->GetThreadName ( ) ); MSG_WriteLong ( &msg, thread->GetThreadNum ( ) ); - - MSG_WriteBits ( &msg, (int)(thread == mBreakInterpreter->GetThread ( )), 1 ); + + MSG_WriteBits ( &msg, (int)(thread == mBreakInterpreter->GetThread ( )), 1 ); MSG_WriteBits ( &msg, (int)thread->IsDoneProcessing(), 1 ); MSG_WriteBits ( &msg, (int)thread->IsWaiting(), 1 ); MSG_WriteBits ( &msg, (int)thread->IsDying(), 1 ); @@ -444,12 +444,12 @@ void rvDebuggerServer::HandleInspectVariable ( msg_t* in_msg ) { char varname[256]; int scopeDepth; - + if ( !mBreak ) { return; } - + scopeDepth = (short)MSG_ReadShort ( in_msg ); MSG_ReadString ( in_msg, varname, 256 ); @@ -460,17 +460,17 @@ void rvDebuggerServer::HandleInspectVariable ( msg_t* in_msg ) // Initialize the message MSG_Init( &msg, buffer, sizeof( buffer ) ); - MSG_WriteShort ( &msg, (int)DBMSG_INSPECTVARIABLE ); - + MSG_WriteShort ( &msg, (int)DBMSG_INSPECTVARIABLE ); + if ( !mBreakInterpreter->GetRegisterValue ( varname, varvalue, scopeDepth ) ) { varvalue = "???"; } - + MSG_WriteShort ( &msg, (short)scopeDepth ); MSG_WriteString ( &msg, varname ); MSG_WriteString ( &msg, varvalue ); - + SendPacket ( msg.data, msg.cursize ); } @@ -478,7 +478,7 @@ void rvDebuggerServer::HandleInspectVariable ( msg_t* in_msg ) ================ rvDebuggerServer::CheckBreakpoints -Check to see if any breakpoints have been hit. This includes "break next", +Check to see if any breakpoints have been hit. This includes "break next", "step into", and "step over" break points ================ */ @@ -495,7 +495,7 @@ void rvDebuggerServer::CheckBreakpoints ( idInterpreter* interpreter, idProgram* // Grab the current statement and the filename that it came from st = &program->GetStatement ( instructionPointer ); filename = program->GetFilename ( st->file ); - + // Operate on lines, not statements if ( mLastStatementLine == st->linenumber && mLastStatementFile == st->file ) { @@ -511,7 +511,7 @@ void rvDebuggerServer::CheckBreakpoints ( idInterpreter* interpreter, idProgram* if ( st->op == OP_RETURN && interpreter->GetCallstackDepth ( ) <= 1 ) { mBreakStepOver = false; - mBreakStepInto = false; + mBreakStepInto = false; } // See if we are supposed to break on the next script line @@ -521,18 +521,18 @@ void rvDebuggerServer::CheckBreakpoints ( idInterpreter* interpreter, idProgram* return; } - // Only break on the same callstack depth and thread as the break over + // Only break on the same callstack depth and thread as the break over if ( mBreakStepOver ) - { - if ( ( interpreter->GetCurrentFunction ( ) == mBreakStepOverFunc1 || - interpreter->GetCurrentFunction ( ) == mBreakStepOverFunc2 )&& - ( interpreter->GetCallstackDepth ( ) <= mBreakStepOverDepth ) ) + { + if ( ( interpreter->GetCurrentFunction ( ) == mBreakStepOverFunc1 || + interpreter->GetCurrentFunction ( ) == mBreakStepOverFunc2 )&& + ( interpreter->GetCallstackDepth ( ) <= mBreakStepOverDepth ) ) { Break ( interpreter, program, instructionPointer ); return; - } + } } - + // See if we are supposed to break on the next line if ( mBreakStepInto ) { @@ -542,7 +542,7 @@ void rvDebuggerServer::CheckBreakpoints ( idInterpreter* interpreter, idProgram* } idStr qpath; - OSPathToRelativePath(filename,qpath); + OSPathToRelativePath(filename,qpath); qpath.BackSlashesToSlashes ( ); EnterCriticalSection ( &mCriticalSection ); @@ -551,7 +551,7 @@ void rvDebuggerServer::CheckBreakpoints ( idInterpreter* interpreter, idProgram* for ( i = 0; i < mBreakpoints.Num ( ); i ++ ) { rvDebuggerBreakpoint* bp = mBreakpoints[i]; - + // Skip if not match of the line number if ( st->linenumber != bp->GetLineNumber ( ) ) { @@ -561,22 +561,22 @@ void rvDebuggerServer::CheckBreakpoints ( idInterpreter* interpreter, idProgram* // Skip if no match of the filename if ( idStr::Icmp ( bp->GetFilename(), qpath ) ) { - continue; + continue; } - - // Pop out of the critical section so we dont get stuck + + // Pop out of the critical section so we dont get stuck LeaveCriticalSection ( &mCriticalSection ); - + // We hit a breakpoint, so break Break ( interpreter, program, instructionPointer ); - - // Back into the critical section since we are going to have to leave it + + // Back into the critical section since we are going to have to leave it EnterCriticalSection ( &mCriticalSection ); - + break; } - - LeaveCriticalSection ( &mCriticalSection ); + + LeaveCriticalSection ( &mCriticalSection ); } /* @@ -598,52 +598,52 @@ void rvDebuggerServer::Break ( idInterpreter* interpreter, idProgram* program, i mBreakStepOver = false; mBreakStepInto = false; mBreakNext = false; - + // Grab the current statement and the filename that it came from st = &program->GetStatement ( instructionPointer ); filename = program->GetFilename ( st->file ); idStr qpath; - OSPathToRelativePath(filename, qpath); + OSPathToRelativePath(filename, qpath); qpath.BackSlashesToSlashes ( ); // Give the mouse cursor back to the world - Sys_GrabMouseCursor( false ); - + Sys_GrabMouseCursor( false ); + // Set the break variable so we know the main thread is stopped mBreak = true; mBreakProgram = program; mBreakInterpreter = interpreter; mBreakInstructionPointer = instructionPointer; - + // Inform the debugger of the breakpoint hit MSG_Init( &msg, buffer, sizeof( buffer ) ); MSG_WriteShort ( &msg, (int)DBMSG_BREAK ); MSG_WriteLong ( &msg, st->linenumber ); MSG_WriteString ( &msg, qpath ); SendPacket ( msg.data, msg.cursize ); - + // Suspend the game thread. Since this will be called from within the main game thread // execution wont return until after the thread is resumed - SuspendThread ( mGameThread ); - + SuspendThread ( mGameThread ); + // Let the debugger client know that we have started back up again SendMessage ( DBMSG_RESUMED ); - // This is to give some time between the keypress that + // This is to give some time between the keypress that // told us to resume and the setforeground window. Otherwise the quake window // would just flash Sleep ( 150 ); - // Bring the window back to the foreground + // Bring the window back to the foreground SetForegroundWindow ( win32.hWnd ); SetActiveWindow ( win32.hWnd ); UpdateWindow ( win32.hWnd ); - SetFocus ( win32.hWnd ); - + SetFocus ( win32.hWnd ); + // Give the mouse cursor back to the game - Sys_GrabMouseCursor( true ); - + Sys_GrabMouseCursor( true ); + // Clear all commands that were generated before we went into suspended mode. This is // to ensure we dont have mouse downs with no ups because the context was changed. idKeyInput::ClearStates(); @@ -663,10 +663,10 @@ void rvDebuggerServer::Resume ( void ) { return; } - + mBreak = false; - // Start the game thread back up + // Start the game thread back up ResumeThread ( mGameThread ); } @@ -680,12 +680,12 @@ Remove all known breakpoints void rvDebuggerServer::ClearBreakpoints ( void ) { int i; - + for ( i = 0; i < mBreakpoints.Num(); i ++ ) { delete mBreakpoints[i]; } - + mBreakpoints.Clear ( ); } @@ -708,7 +708,7 @@ void rvDebuggerServer::Print ( const char* text ) MSG_Init( &msg, buffer, sizeof( buffer ) ); MSG_WriteShort ( &msg, (int)DBMSG_PRINT ); - MSG_WriteString ( &msg, text ); - + MSG_WriteString ( &msg, text ); + SendPacket ( msg.data, msg.cursize ); -} +} diff --git a/neo/tools/debugger/DebuggerServer.h b/neo/tools/debugger/DebuggerServer.h index 829fce0c..04b9782d 100644 --- a/neo/tools/debugger/DebuggerServer.h +++ b/neo/tools/debugger/DebuggerServer.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,17 +52,17 @@ public: bool Initialize ( void ); void Shutdown ( void ); - + bool ProcessMessages ( void ); - + bool IsConnected ( void ); - + void CheckBreakpoints ( idInterpreter* interpreter, idProgram* program, int instructionPointer ); - + void Print ( const char* text ); void OSPathToRelativePath( const char *osPath, idStr &qpath ); - + protected: // protected member variables @@ -71,9 +71,9 @@ protected: idPort mPort; idList mBreakpoints; CRITICAL_SECTION mCriticalSection; - + HANDLE mGameThread; - + bool mBreak; bool mBreakNext; bool mBreakStepOver; @@ -84,10 +84,10 @@ protected: idProgram* mBreakProgram; int mBreakInstructionPointer; idInterpreter* mBreakInterpreter; - + idStr mLastStatementFile; - int mLastStatementLine; - + int mLastStatementLine; + private: void ClearBreakpoints ( void ); @@ -105,7 +105,7 @@ private: void HandleInspectVariable ( msg_t* msg ); void HandleInspectCallstack ( msg_t* msg ); void HandleInspectThreads ( msg_t* msg ); - + // MSG helper routines void MSG_WriteCallstackFunc ( msg_t* msg, const prstack_t* stack ); }; diff --git a/neo/tools/debugger/DebuggerWindow.cpp b/neo/tools/debugger/DebuggerWindow.cpp index ff42a9db..8d8266d3 100644 --- a/neo/tools/debugger/DebuggerWindow.cpp +++ b/neo/tools/debugger/DebuggerWindow.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,17 +86,17 @@ Destructor rvDebuggerWindow::~rvDebuggerWindow ( ) { int i; - + if ( mWnd ) { DestroyWindow ( mWnd ); } - + if ( mImageList ) { ImageList_Destroy ( mImageList ); } - + for ( i = 0; i < mScripts.Num (); i ++ ) { delete mScripts[i]; @@ -115,7 +115,7 @@ bool rvDebuggerWindow::RegisterClass ( void ) { WNDCLASSEX wcex; - wcex.cbSize = sizeof(WNDCLASSEX); + wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; @@ -152,7 +152,7 @@ bool rvDebuggerWindow::Create ( HINSTANCE instance ) mClient = &gDebuggerApp.GetClient(); // Create the debugger window - mWnd = CreateWindow( DEBUGGERWINDOWCLASS, "", + mWnd = CreateWindow( DEBUGGERWINDOWCLASS, "", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, mInstance, this); @@ -166,14 +166,14 @@ bool rvDebuggerWindow::Create ( HINSTANCE instance ) mWindowMenuPos = GetMenuItemCount ( mWindowMenu ); UpdateTitle ( ); - + Printf ( "Quake 4 Script Debugger v0.1\n\n" ); - + ShowWindow ( mWnd, SW_SHOW ); - UpdateWindow ( mWnd ); + UpdateWindow ( mWnd ); return true; -} +} /* ================ @@ -188,12 +188,12 @@ int CALLBACK rvDebuggerWindow::ScriptWordBreakProc (LPTSTR text, int current, in { static TCHAR delimiters[]=TEXT("!@#$%^&*()-+=[]{}|\\;:'\"/,.<>? \t\r\n") ; - switch ( action ) + switch ( action ) { default: break; - - case WB_ISDELIMITER: + + case WB_ISDELIMITER: return _tcschr ( delimiters, *(text + current * 2) ) ? TRUE : FALSE; case WB_MOVEWORDLEFT: @@ -210,7 +210,7 @@ int CALLBACK rvDebuggerWindow::ScriptWordBreakProc (LPTSTR text, int current, in { return current + 1; } - + // Going backwards current--; } @@ -218,9 +218,9 @@ int CALLBACK rvDebuggerWindow::ScriptWordBreakProc (LPTSTR text, int current, in return current; case WB_MOVEWORDRIGHT: - case WB_RIGHT: - - // If we are already on a delimiter then just return the current index + case WB_RIGHT: + + // If we are already on a delimiter then just return the current index if ( _tcschr ( delimiters, *(text + current * 2) ) ) { return current; @@ -239,9 +239,9 @@ int CALLBACK rvDebuggerWindow::ScriptWordBreakProc (LPTSTR text, int current, in } return current; - } - - return 0; + } + + return 0; } LRESULT CALLBACK rvDebuggerWindow::ScriptWndProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam ) @@ -250,15 +250,15 @@ LRESULT CALLBACK rvDebuggerWindow::ScriptWndProc ( HWND wnd, UINT msg, WPARAM wp static int lastEnd = -1; rvDebuggerWindow* window = (rvDebuggerWindow*)GetWindowLong ( wnd, GWL_USERDATA ); WNDPROC wndproc = window->mOldScriptProc; - + switch ( msg ) - { + { case WM_RBUTTONUP: return SendMessage ( wnd, WM_LBUTTONUP, wparam, lparam ); case WM_RBUTTONDOWN: { - POINT point = { LOWORD(lparam), HIWORD(lparam) }; + POINT point = { LOWORD(lparam), HIWORD(lparam) }; HMENU menu; SendMessage ( wnd, WM_LBUTTONDOWN, wparam, lparam ); menu = LoadMenu ( window->mInstance, MAKEINTRESOURCE(IDR_DBG_SCRIPT_POPUP) ); @@ -267,7 +267,7 @@ LRESULT CALLBACK rvDebuggerWindow::ScriptWndProc ( HWND wnd, UINT msg, WPARAM wp DestroyMenu ( menu ); return 0; } - + case WM_MOUSEMOVE: { // Figure out the start and end of the mouse is over @@ -275,14 +275,14 @@ LRESULT CALLBACK rvDebuggerWindow::ScriptWndProc ( HWND wnd, UINT msg, WPARAM wp int c = SendMessage ( wnd, EM_CHARFROMPOS, 0, (WPARAM)&pos ); int start = SendMessage ( wnd, EM_FINDWORDBREAK, WB_LEFT, c ); int end = SendMessage ( wnd, EM_FINDWORDBREAK, WB_RIGHT, c ); - + // If the start and the end of the word we are over havent changed // then the word hasnt changed so no need to re-setup the tool tip if ( lastStart == start && lastEnd == end ) { break; } - + // Save the current start and end for the next mouse move lastStart = start; lastEnd = end; @@ -297,13 +297,13 @@ LRESULT CALLBACK rvDebuggerWindow::ScriptWndProc ( HWND wnd, UINT msg, WPARAM wp SendMessage ( window->mWndToolTips, TTM_DELTOOL, 0, (LPARAM) (LPTOOLINFO) &ti ); window->mTooltipVar.Empty ( ); } - - // If there is no word then ignore it + + // If there is no word then ignore it if ( start == end ) { break; } - + TEXTRANGE range; TOOLINFO ti; @@ -332,7 +332,7 @@ LRESULT CALLBACK rvDebuggerWindow::ScriptWndProc ( HWND wnd, UINT msg, WPARAM wp // from the end character. The bottom is the top from the start character // plus the height of one line SendMessage ( wnd, EM_POSFROMCHAR, (WPARAM)&pos, start ); - ti.rect.left = pos.x; + ti.rect.left = pos.x; ti.rect.top = pos.y; SendMessage ( wnd, EM_POSFROMCHAR, (WPARAM)&pos, end ); ti.rect.right = pos.x; @@ -344,20 +344,20 @@ LRESULT CALLBACK rvDebuggerWindow::ScriptWndProc ( HWND wnd, UINT msg, WPARAM wp // Add the new tool tip to the control SendMessage ( window->mWndToolTips, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti ); SendMessage ( window->mWndToolTips, TTM_UPDATE, 0, 0 ); - - break; + + break; } } - + return CallWindowProc ( wndproc, wnd, msg, wparam, lparam ); } LRESULT CALLBACK rvDebuggerWindow::MarginWndProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam ) { rvDebuggerWindow* window = (rvDebuggerWindow*) GetWindowLong ( wnd, GWL_USERDATA ); - + switch ( msg ) - { + { case WM_RBUTTONDOWN: return SendMessage ( window->mWndScript, WM_RBUTTONDOWN, wparam, lparam ); @@ -370,36 +370,36 @@ LRESULT CALLBACK rvDebuggerWindow::MarginWndProc ( HWND wnd, UINT msg, WPARAM wp window->ToggleBreakpoint ( ); return result; } - + case WM_LBUTTONDOWN: { int result = SendMessage ( window->mWndScript, WM_LBUTTONDOWN, wparam, lparam ); window->ToggleBreakpoint ( ); return result; } - + case WM_LBUTTONUP: return SendMessage ( window->mWndScript, WM_LBUTTONUP, wparam, lparam ); - + case WM_PAINT: { HDC dc; int size = window->mMarginSize - 2; - + PAINTSTRUCT ps; RECT rect; GetClientRect ( wnd, &rect ); - dc = BeginPaint ( wnd, &ps ); + dc = BeginPaint ( wnd, &ps ); FillRect ( dc, &rect, GetSysColorBrush ( COLOR_3DFACE ) ); - + if ( window->mScripts.Num ( ) ) { for ( int i = 0; i < window->mClient->GetBreakpointCount(); i ++ ) { rvDebuggerBreakpoint* bp = window->mClient->GetBreakpoint ( i ); assert( bp ); - + if ( !idStr::Icmp ( window->mScripts[window->mActiveScript]->GetFilename ( ), bp->GetFilename ( ) ) ) { int c; @@ -410,7 +410,7 @@ LRESULT CALLBACK rvDebuggerWindow::MarginWndProc ( HWND wnd, UINT msg, WPARAM wp ImageList_DrawEx ( window->mImageList, 2, dc, rect.left, pos.y, size, size, CLR_NONE, CLR_NONE, ILD_NORMAL ); } } - + if ( window->mClient->IsStopped ( ) ) { if ( !idStr::Icmp ( window->mClient->GetBreakFilename(), @@ -420,11 +420,11 @@ LRESULT CALLBACK rvDebuggerWindow::MarginWndProc ( HWND wnd, UINT msg, WPARAM wp POINTL pos; c = SendMessage ( window->mWndScript, EM_LINEINDEX, window->mClient->GetBreakLineNumber() - 1, 0 ); - SendMessage ( window->mWndScript, EM_POSFROMCHAR, (WPARAM)&pos, c ); + SendMessage ( window->mWndScript, EM_POSFROMCHAR, (WPARAM)&pos, c ); ImageList_DrawEx ( window->mImageList, 3, dc, rect.left, pos.y, size, size, CLR_NONE, CLR_NONE, ILD_NORMAL ); } } - + if ( window->mCurrentStackDepth != 0 ) { if ( !window->mClient->GetCallstack()[window->mCurrentStackDepth]->mFilename.Icmp ( window->mScripts[window->mActiveScript]->GetFilename ( ) ) ) @@ -433,12 +433,12 @@ LRESULT CALLBACK rvDebuggerWindow::MarginWndProc ( HWND wnd, UINT msg, WPARAM wp POINTL pos; c = SendMessage ( window->mWndScript, EM_LINEINDEX, window->mClient->GetCallstack()[window->mCurrentStackDepth]->mLineNumber - 1, 0 ); - SendMessage ( window->mWndScript, EM_POSFROMCHAR, (WPARAM)&pos, c ); + SendMessage ( window->mWndScript, EM_POSFROMCHAR, (WPARAM)&pos, c ); ImageList_DrawEx ( window->mImageList, 1, dc, rect.left, pos.y, size, size, CLR_NONE, CLR_NONE, ILD_NORMAL ); } } } - + rect.right-=2; rect.left = rect.right + 1; HPEN pen = CreatePen ( PS_SOLID, 1, GetSysColor ( COLOR_3DSHADOW ) ); @@ -451,7 +451,7 @@ LRESULT CALLBACK rvDebuggerWindow::MarginWndProc ( HWND wnd, UINT msg, WPARAM wp break; } } - + return DefWindowProc ( wnd, msg, wparam, lparam ); } @@ -465,9 +465,9 @@ Updates the window title of the script debugger to show a few states void rvDebuggerWindow::UpdateTitle ( void ) { idStr title; - + title = "Quake 4 Script Debugger - "; - + if ( mClient->IsConnected ( ) ) { if ( mClient->IsStopped ( ) ) @@ -475,7 +475,7 @@ void rvDebuggerWindow::UpdateTitle ( void ) title += "[break]"; } else - { + { title += "[run]"; } } @@ -483,16 +483,16 @@ void rvDebuggerWindow::UpdateTitle ( void ) { title += "[disconnected]"; } - + if ( mScripts.Num ( ) ) { title += " - ["; title += idStr( mScripts[mActiveScript]->GetFilename() ).StripPath ( ); title += "]"; } - + SetWindowText ( mWnd, title ); -} +} /* ================ @@ -507,7 +507,7 @@ void rvDebuggerWindow::UpdateScript ( void ) // Dont reupdate if the given active script is the one being displayed. if ( mActiveScript == mLastActiveScript ) - { + { return; } @@ -524,12 +524,12 @@ void rvDebuggerWindow::UpdateScript ( void ) { ShowWindow ( mWndScript, SW_SHOW ); } - + // Update the script SendMessage ( mWndScript, EM_SETSEL, 0, -1 ); SendMessage ( mWndScript, EM_REPLACESEL, 0, (LPARAM)"" ); SendMessage ( mWndScript, EM_SETSEL, 0, -1 ); - SendMessage ( mWndScript, EM_REPLACESEL, 0, (LPARAM)mScripts[mActiveScript]->GetContents ( ) ); + SendMessage ( mWndScript, EM_REPLACESEL, 0, (LPARAM)mScripts[mActiveScript]->GetContents ( ) ); } /* @@ -545,12 +545,12 @@ void rvDebuggerWindow::UpdateWindowMenu ( void ) { DeleteMenu ( mWindowMenu, mWindowMenuPos, MF_BYPOSITION ); } - + if ( mScripts.Num() ) { AppendMenu ( mWindowMenu, MF_SEPARATOR, 0, "" ); } - + int i; for ( i = 0; i < mScripts.Num(); i ++ ) { @@ -575,15 +575,15 @@ void rvDebuggerWindow::UpdateCallstack ( void ) ListView_DeleteAllItems ( mWndCallstack ); ZeroMemory ( &item, sizeof(item) ); item.mask = LVIF_TEXT|LVIF_IMAGE; - + for ( int i = 0; i < mClient->GetCallstack().Num(); i ++ ) - { + { rvDebuggerCallstack* entry = mClient->GetCallstack()[i]; item.iItem = ListView_GetItemCount ( mWndCallstack ); item.pszText = ""; item.iImage = (i == mCurrentStackDepth) ? 1 : 0; ListView_InsertItem ( mWndCallstack, &item ); - + ListView_SetItemText ( mWndCallstack, item.iItem, 1, (LPSTR)entry->mFunction.c_str() ); ListView_SetItemText ( mWndCallstack, item.iItem, 2, va("%d", entry->mLineNumber ) ); ListView_SetItemText ( mWndCallstack, item.iItem, 3, (LPSTR)entry->mFilename.c_str() ); @@ -600,14 +600,14 @@ Updates the contents of the watch window void rvDebuggerWindow::UpdateWatch ( void ) { int i; - + // Inspect all the variables we are watching for ( i = 0; i < mWatches.Num(); i ++ ) { mWatches[i]->mModified = false; mClient->InspectVariable ( mWatches[i]->mVariable, mCurrentStackDepth ); } - + InvalidateRect ( mWndWatch, NULL, FALSE ); UpdateWindow ( mWndWatch ); } @@ -619,23 +619,23 @@ rvDebuggerWindow::HandleInitMenu Handles the initialization of the main menu ================ */ -int rvDebuggerWindow::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) -{ - int cMenuItems = GetMenuItemCount((HMENU)wParam); - int nPos; - int id; - UINT flags; - HMENU hmenu; - +int rvDebuggerWindow::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) +{ + int cMenuItems = GetMenuItemCount((HMENU)wParam); + int nPos; + int id; + UINT flags; + HMENU hmenu; + hmenu = (HMENU) wParam; // Run through all the menu items in the menu and see if any of them need // modification in any way - for (nPos = 0; nPos < cMenuItems; nPos++) - { - id = GetMenuItemID(hmenu, nPos); - flags = 0; - + for (nPos = 0; nPos < cMenuItems; nPos++) + { + id = GetMenuItemID(hmenu, nPos); + flags = 0; + // Handle popup menus too if ( id < 0 ) { @@ -646,7 +646,7 @@ int rvDebuggerWindow::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) continue; } } - + // Handle the dynamic menu items specially if ( id >= ID_DBG_WINDOWMIN && id <= ID_DBG_WINDOWMAX ) { @@ -660,7 +660,7 @@ int rvDebuggerWindow::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) } continue; } - + // Menu items that are completely unrelated to the workspace switch ( id ) { @@ -671,10 +671,10 @@ int rvDebuggerWindow::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) info.cbSize = sizeof(info); info.fMask = MIIM_TYPE|MIIM_STATE; - info.fType = MFT_STRING; - + info.fType = MFT_STRING; + if ( !mClient->IsConnected() ) - { + { run = "Run"; info.fState = MFS_ENABLED; } @@ -688,12 +688,12 @@ int rvDebuggerWindow::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) info.cch = run.Length ( ); SendMessage ( mWndToolbar, TB_ENABLEBUTTON, id, MAKELONG(((info.fState==MFS_ENABLED) ? TRUE : FALSE), 0) ); - + SetMenuItemInfo ( hmenu, id, FALSE, &info ); - + break; } - + case ID_DBG_DEBUG_BREAK: if ( !mClient->IsConnected() || mClient->IsStopped() ) { @@ -705,8 +705,8 @@ int rvDebuggerWindow::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) EnableMenuItem ( hmenu, nPos, MF_ENABLED|MF_BYPOSITION); SendMessage ( mWndToolbar, TB_ENABLEBUTTON, id, MAKELONG(TRUE,0) ); } - break; - + break; + case ID_DBG_DEBUG_RUNTOCURSOR: case ID_DBG_DEBUG_STEPOUT: case ID_DBG_DEBUG_STEPOVER: @@ -715,16 +715,16 @@ int rvDebuggerWindow::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) // case ID_DBG_DEBUG_QUICKWATCH: if ( !mClient->IsConnected() || !mClient->IsStopped() ) { - EnableMenuItem ( hmenu, nPos, MF_GRAYED|MF_BYPOSITION ); + EnableMenuItem ( hmenu, nPos, MF_GRAYED|MF_BYPOSITION ); SendMessage ( mWndToolbar, TB_ENABLEBUTTON, id, MAKELONG(FALSE,0) ); } else { - EnableMenuItem ( hmenu, nPos, MF_ENABLED|MF_BYPOSITION ); + EnableMenuItem ( hmenu, nPos, MF_ENABLED|MF_BYPOSITION ); SendMessage ( mWndToolbar, TB_ENABLEBUTTON, id, MAKELONG(TRUE,0) ); } break; - + case ID_DBG_WINDOW_CLOSEALL: case ID_DBG_FILE_CLOSE: case ID_DBG_DEBUG_TOGGLEBREAKPOINT: @@ -733,7 +733,7 @@ int rvDebuggerWindow::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) break; } } - + return 0; } @@ -744,7 +744,7 @@ rvDebuggerWindow::HandleCreate Handles the WM_CREATE command ================ */ -int rvDebuggerWindow::HandleCreate ( WPARAM wparam, LPARAM lparam ) +int rvDebuggerWindow::HandleCreate ( WPARAM wparam, LPARAM lparam ) { UINT tabsize = 16; TEXTMETRIC tm; @@ -756,7 +756,7 @@ int rvDebuggerWindow::HandleCreate ( WPARAM wparam, LPARAM lparam ) // Create the main toolbar CreateToolbar ( ); - + // Create the script window LoadLibrary ( "Riched20.dll" ); mWndScript = CreateWindow ( "RichEdit20A", "", WS_CHILD|WS_BORDER|ES_NOHIDESEL|ES_READONLY|ES_MULTILINE|ES_WANTRETURN|ES_AUTOVSCROLL|ES_AUTOHSCROLL|WS_VSCROLL|WS_HSCROLL, 0, 0, 100, 100, mWnd, (HMENU) IDC_DBG_SCRIPT, mInstance, 0 ); @@ -772,8 +772,8 @@ int rvDebuggerWindow::HandleCreate ( WPARAM wparam, LPARAM lparam ) GetTextMetrics ( dc, &tm ); ZeroMemory ( &lf, sizeof(lf) ); lf.lfHeight = tm.tmHeight; - strcpy ( lf.lfFaceName, "Courier New" ); - + strcpy ( lf.lfFaceName, "Courier New" ); + SendMessage ( mWndScript, WM_SETFONT, (WPARAM)CreateFontIndirect ( &lf ), 0 ); SendMessage ( mWndScript, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN, MAKELONG(18,10) ); SendMessage ( mWndScript, EM_SETBKGNDCOLOR, 0, GetSysColor ( COLOR_3DFACE ) ); @@ -782,11 +782,11 @@ int rvDebuggerWindow::HandleCreate ( WPARAM wparam, LPARAM lparam ) SendMessage ( mWndOutput, WM_SETFONT, (WPARAM)CreateFontIndirect ( &lf ), 0 ); SendMessage ( mWndOutput, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN, MAKELONG(18,10) ); SendMessage ( mWndOutput, EM_SETBKGNDCOLOR, 0, GetSysColor ( COLOR_3DFACE ) ); - + mWndConsole = CreateWindow ( "RichEdit20A", "", WS_CHILD|ES_READONLY|ES_MULTILINE|ES_WANTRETURN|ES_AUTOVSCROLL|ES_AUTOHSCROLL|WS_VSCROLL|WS_HSCROLL, 0, 0, 100, 100, mWnd, (HMENU) IDC_DBG_CONSOLE, mInstance, 0 ); SendMessage ( mWndConsole, WM_SETFONT, (WPARAM)CreateFontIndirect ( &lf ), 0 ); SendMessage ( mWndConsole, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN, MAKELONG(18,10) ); - SendMessage ( mWndConsole, EM_SETBKGNDCOLOR, 0, GetSysColor ( COLOR_3DFACE ) ); + SendMessage ( mWndConsole, EM_SETBKGNDCOLOR, 0, GetSysColor ( COLOR_3DFACE ) ); mWndMargin = CreateWindow ( "STATIC", "", WS_VISIBLE|WS_CHILD, 0, 0, 0, 0, mWndScript, (HMENU)IDC_DBG_SPLITTER, mInstance, NULL ); SetWindowLong ( mWndMargin, GWL_USERDATA, (LONG)this ); @@ -800,7 +800,7 @@ int rvDebuggerWindow::HandleCreate ( WPARAM wparam, LPARAM lparam ) mWndTabs = CreateWindow ( WC_TABCONTROL, "", TCS_BOTTOM|WS_CHILD|WS_VISIBLE|TCS_FOCUSNEVER, 0, 0, 0, 0, mWnd, (HMENU)IDC_DBG_TABS, mInstance, NULL ); lf.lfHeight = -MulDiv(8, GetDeviceCaps(dc, LOGPIXELSY), 72); - strcpy ( lf.lfFaceName, "Arial" ); + strcpy ( lf.lfFaceName, "Arial" ); SendMessage ( mWndTabs, WM_SETFONT, (WPARAM)CreateFontIndirect ( &lf ), 0 ); ReleaseDC ( mWndScript, dc ); @@ -856,7 +856,7 @@ int rvDebuggerWindow::HandleCreate ( WPARAM wparam, LPARAM lparam ) col.pszText = "Value"; ListView_InsertColumn ( mWndWatch, 1, &col ); - // Create the image list that is used by the threads window, callstack window, and + // Create the image list that is used by the threads window, callstack window, and // margin window mImageList = ImageList_Create ( 16, 16, ILC_COLOR|ILC_MASK, 0, 2 ); ImageList_AddIcon ( mImageList, (HICON)LoadImage ( mInstance, MAKEINTRESOURCE(IDI_DBG_EMPTY), IMAGE_ICON, 16, 16, LR_DEFAULTSIZE|LR_DEFAULTCOLOR) ); @@ -876,9 +876,9 @@ int rvDebuggerWindow::HandleCreate ( WPARAM wparam, LPARAM lparam ) gDebuggerApp.GetOptions().GetColumnWidths ( "cw_watch", mWndWatch ); mWndToolTips = CreateWindowEx ( WS_EX_TOPMOST, - TOOLTIPS_CLASS, + TOOLTIPS_CLASS, NULL, - WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, + WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, @@ -888,24 +888,24 @@ int rvDebuggerWindow::HandleCreate ( WPARAM wparam, LPARAM lparam ) mInstance, NULL ); - + SendMessage ( mWndToolTips, TTM_SETDELAYTIME, TTDT_INITIAL, MAKELONG(400,0) ); SendMessage ( mWndToolTips, TTM_SETDELAYTIME, TTDT_RESHOW, MAKELONG(400,0) ); SetWindowPos( mWndToolTips, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - + LVITEM lvItem; lvItem.iItem = 0; lvItem.iSubItem = 0; lvItem.mask = LVIF_TEXT; lvItem.pszText = ""; ListView_InsertItem ( mWndWatch, &lvItem ); - ListView_SetExtendedListViewStyle ( mWndWatch, LVS_EX_FULLROWSELECT ); + ListView_SetExtendedListViewStyle ( mWndWatch, LVS_EX_FULLROWSELECT ); // Recent files InitRecentFiles ( ); UpdateRecentFiles ( ); - + HandleInitMenu ( (WPARAM)GetMenu ( mWnd ), 0 ); // Read in the watches @@ -916,10 +916,10 @@ int rvDebuggerWindow::HandleCreate ( WPARAM wparam, LPARAM lparam ) { break; } - + AddWatch ( s ); } - + return 0; } @@ -930,12 +930,12 @@ rvDebuggerWindow::HandleCommand Handles the WM_COMMAND message for this window ================ */ -int rvDebuggerWindow::HandleCommand ( WPARAM wparam, LPARAM lparam ) -{ +int rvDebuggerWindow::HandleCommand ( WPARAM wparam, LPARAM lparam ) +{ int event = HIWORD(wparam); int id = LOWORD(wparam); - // The window menu list needs to be handled specially + // The window menu list needs to be handled specially if ( id >= ID_DBG_WINDOWMIN && id <= ID_DBG_WINDOWMAX ) { mActiveScript = id - ID_DBG_WINDOWMIN; @@ -954,25 +954,25 @@ int rvDebuggerWindow::HandleCommand ( WPARAM wparam, LPARAM lparam ) } return 0; } - + switch ( id ) { case ID_DBG_EDIT_FINDSELECTED: { - idStr text; - GetSelectedText ( text ); + idStr text; + GetSelectedText ( text ); FindNext ( text ); break; } - + case ID_DBG_EDIT_FINDSELECTEDPREV: { - idStr text; - GetSelectedText ( text ); + idStr text; + GetSelectedText ( text ); FindPrev ( text ); break; } - + case ID_DBG_EDIT_FINDNEXT: FindNext ( ); break; @@ -980,34 +980,34 @@ int rvDebuggerWindow::HandleCommand ( WPARAM wparam, LPARAM lparam ) case ID_DBG_EDIT_FINDPREV: FindPrev ( ); break; - + case ID_DBG_DEBUG_QUICKWATCH: { idStr text; - + GetSelectedText ( text ); rvDebuggerQuickWatchDlg dlg; dlg.DoModal ( this, mCurrentStackDepth, text ); break; } - + case ID_DBG_HELP_ABOUT: DialogBox ( mInstance, MAKEINTRESOURCE(IDD_DBG_ABOUT), mWnd, AboutDlgProc ); break; - + case ID_DBG_DEBUG_BREAK: mClient->Break ( ); - break; + break; case ID_DBG_DEBUG_STEPOVER: EnableWindows ( FALSE ); mClient->StepOver ( ); - break; + break; case ID_DBG_DEBUG_STEPINTO: EnableWindows ( FALSE ); mClient->StepInto ( ); - break; + break; case ID_DBG_DEBUG_RUN: // Run the game if its not running @@ -1018,9 +1018,9 @@ int rvDebuggerWindow::HandleCommand ( WPARAM wparam, LPARAM lparam ) STARTUPINFO startup; PROCESS_INFORMATION process; - + ZeroMemory ( &startup, sizeof(startup) ); - startup.cb = sizeof(startup); + startup.cb = sizeof(startup); GetCurrentDirectory ( MAX_PATH, curDir ); @@ -1042,13 +1042,13 @@ int rvDebuggerWindow::HandleCommand ( WPARAM wparam, LPARAM lparam ) } break; - + case IDC_DBG_SCRIPT: { - RECT t; + RECT t; LONG num; LONG dem; - + SendMessage ( mWndScript, EM_GETZOOM, (LONG)&num, (LONG)&dem ); if ( num != mZoomScaleNum || dem != mZoomScaleDem ) { @@ -1058,20 +1058,20 @@ int rvDebuggerWindow::HandleCommand ( WPARAM wparam, LPARAM lparam ) SendMessage ( mWnd, WM_SIZE, 0, MAKELPARAM(t.right-t.left,t.bottom-t.top) ); } else - { + { InvalidateRect ( mWndMargin, NULL, TRUE ); } break; } - + case ID_DBG_DEBUG_TOGGLEBREAKPOINT: ToggleBreakpoint ( ); break; - + case ID_DBG_FILE_EXIT: PostMessage ( mWnd, WM_CLOSE, 0, 0 ); break; - + case ID_DBG_FILE_CLOSE: if ( mScripts.Num() ) { @@ -1085,7 +1085,7 @@ int rvDebuggerWindow::HandleCommand ( WPARAM wparam, LPARAM lparam ) UpdateScript ( ); } break; - + case ID_DBG_FILE_NEXT: if ( mScripts.Num ( ) > 0 ) { @@ -1095,10 +1095,10 @@ int rvDebuggerWindow::HandleCommand ( WPARAM wparam, LPARAM lparam ) mActiveScript = 0; } UpdateWindowMenu ( ); - UpdateScript ( ); + UpdateScript ( ); } break; - + case ID_DBG_FILE_OPEN: { rvOpenFileDialog dlg; @@ -1106,7 +1106,7 @@ int rvDebuggerWindow::HandleCommand ( WPARAM wparam, LPARAM lparam ) dlg.SetFilter ( "*.script; *.gui; *.state" ); dlg.SetFlags ( OFD_MUSTEXIST ); if ( dlg.DoModal ( mWnd ) ) - { + { if ( !OpenScript ( dlg.GetFilename ( ) ) ) { MessageBox ( mWnd, va("Failed to open script '%s'",dlg.GetFilename ( )), "Quake 4 Script Debugger", MB_OK ); @@ -1114,7 +1114,7 @@ int rvDebuggerWindow::HandleCommand ( WPARAM wparam, LPARAM lparam ) } break; } - + case ID_DBG_EDIT_FIND: { rvDebuggerFindDlg dlg; @@ -1124,26 +1124,26 @@ int rvDebuggerWindow::HandleCommand ( WPARAM wparam, LPARAM lparam ) } break; } - + case ID_DBG_WINDOW_CLOSEALL: { for ( int i = 0; i < mScripts.Num(); i ++ ) { delete mScripts[i]; } - + mScripts.Clear ( ); mActiveScript = -1; - + UpdateWindowMenu ( ); UpdateScript ( ); break; - } + } } - + return 0; } - + /* ================ rvDebuggerWindow::WndProc @@ -1154,7 +1154,7 @@ Window procedure for the deubgger window LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam ) { rvDebuggerWindow* window = (rvDebuggerWindow*) GetWindowLong ( wnd, GWL_USERDATA ); - + switch ( msg ) { case WM_INITMENUPOPUP: @@ -1164,29 +1164,29 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, case WM_DESTROY: { gDebuggerApp.GetOptions().SetColumnWidths ( "cw_callstack", window->mWndCallstack ); - gDebuggerApp.GetOptions().SetColumnWidths ( "cw_threads", window->mWndThreads ); + gDebuggerApp.GetOptions().SetColumnWidths ( "cw_threads", window->mWndThreads ); gDebuggerApp.GetOptions().SetColumnWidths ( "cw_watch", window->mWndWatch ); gDebuggerApp.GetOptions().SetWindowPlacement ( "wp_main", wnd ); - + int i; for ( i = 0; i < window->mWatches.Num ( ); i ++ ) { gDebuggerApp.GetOptions().SetString ( va("watch%d", i ), window->mWatches[i]->mVariable ); } gDebuggerApp.GetOptions().SetString ( va("watch%d", i ), "" ); - + window->mWnd = NULL; - SetWindowLong ( wnd, GWL_USERDATA, 0 ); + SetWindowLong ( wnd, GWL_USERDATA, 0 ); break; } - + case WM_ERASEBKGND: return 0; - + case WM_COMMAND: window->HandleCommand ( wparam, lparam ); - break; - + break; + case WM_SETCURSOR: { POINT point; @@ -1199,25 +1199,25 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, } break; } - + case WM_SIZE: { RECT rect; window->mMarginSize = window->mZoomScaleDem ? ((long)(18.0f * (float)window->mZoomScaleNum / (float)window->mZoomScaleDem)):18; window->mSplitterRect.left = 0; window->mSplitterRect.right = LOWORD(lparam); - + SendMessage ( window->mWndToolbar, TB_AUTOSIZE, 0, 0 ); GetWindowRect ( window->mWndToolbar, &rect ); MoveWindow ( window->mWndScript, 0, rect.bottom-rect.top, LOWORD(lparam), window->mSplitterRect.top-(rect.bottom-rect.top), TRUE ); MoveWindow ( window->mWndMargin, 0, 0, window->mMarginSize, window->mSplitterRect.top-(rect.bottom-rect.top), TRUE ); - + SetRect ( &rect, 0, window->mSplitterRect.bottom, LOWORD(lparam), HIWORD(lparam) ); MoveWindow ( window->mWndTabs, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE ); SendMessage ( window->mWndTabs, TCM_ADJUSTRECT, FALSE, (LPARAM)&rect ); rect.bottom -= 4 ; MoveWindow ( window->mWndBorder, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE ); - InflateRect ( &rect, -1, -1 ); + InflateRect ( &rect, -1, -1 ); MoveWindow ( window->mWndOutput, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE ); MoveWindow ( window->mWndConsole, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE ); MoveWindow ( window->mWndCallstack, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE ); @@ -1225,13 +1225,13 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, MoveWindow ( window->mWndThreads, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE ); break; } - + case WM_PAINT: { PAINTSTRUCT ps; - HDC dc = BeginPaint ( wnd, &ps ); + HDC dc = BeginPaint ( wnd, &ps ); FillRect ( dc, &window->mSplitterRect, GetSysColorBrush ( COLOR_3DFACE ) ); - + if ( !window->mScripts.Num() ) { RECT rect; @@ -1239,11 +1239,11 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, rect.bottom = window->mSplitterRect.top; FillRect ( dc, &rect, GetSysColorBrush ( COLOR_APPWORKSPACE ) ); } - + EndPaint ( wnd, &ps ); break; } - + case WM_LBUTTONDOWN: { POINT pt = { LOWORD(lparam),HIWORD(lparam) }; @@ -1251,33 +1251,33 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, { window->mSplitterDrag = true; SetCapture ( wnd ); - + HDC dc = GetDC ( wnd ); DrawFocusRect ( dc, &window->mSplitterRect ); ReleaseDC ( wnd, dc ); } break; } - + case WM_LBUTTONUP: if ( window->mSplitterDrag ) { HDC dc = GetDC ( wnd ); DrawFocusRect ( dc, &window->mSplitterRect ); ReleaseDC ( wnd, dc ); - + window->mSplitterDrag = false; - + RECT client; GetClientRect ( wnd, &client ); SendMessage ( wnd, WM_SIZE, 0, MAKELPARAM(client.right-client.left,client.bottom-client.top) ); - + InvalidateRect ( wnd, NULL, TRUE ); - + ReleaseCapture ( ); - } + } break; - + case WM_MOUSEMOVE: { if ( window->mSplitterDrag ) @@ -1290,10 +1290,10 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, { break; } - + RECT client; GetClientRect ( wnd, &client ); - + window->mSplitterRect.top = HIWORD(lparam); if ( window->mSplitterRect.top < client.top ) { @@ -1310,14 +1310,14 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, ReleaseDC ( wnd, dc ); } break; - } - + } + case WM_DRAWITEM: window->HandleDrawItem ( wparam, lparam ); break; - + case WM_CREATE: - { + { CREATESTRUCT* cs = (CREATESTRUCT*) lparam; window = (rvDebuggerWindow*) cs->lpCreateParams; SetWindowLong ( wnd, GWL_USERDATA, (LONG)cs->lpCreateParams ); @@ -1328,10 +1328,10 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, break; } - case WM_ACTIVATE: + case WM_ACTIVATE: window->HandleActivate ( wparam, lparam ); break; - + case WM_NOTIFY: { NMHDR* hdr; @@ -1345,7 +1345,7 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, } switch ( hdr->idFrom ) - { + { case IDC_DBG_WATCH: switch ( hdr->code ) { @@ -1364,24 +1364,24 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, item.mask = LVIF_PARAM; ListView_GetItem ( hdr->hwndFrom, &item ); ListView_DeleteItem ( hdr->hwndFrom, sel ); - + window->mWatches.Remove ( (rvDebuggerWatch*)item.lParam ); delete (rvDebuggerWatch*)item.lParam; - ListView_SetItemState ( hdr->hwndFrom, - sel, - LVIS_SELECTED, LVIS_SELECTED ); - + ListView_SetItemState ( hdr->hwndFrom, + sel, + LVIS_SELECTED, LVIS_SELECTED ); + if ( ListView_GetNextItem ( hdr->hwndFrom, -1, LVNI_SELECTED ) == -1 ) { - ListView_SetItemState ( hdr->hwndFrom, - ListView_GetItemCount ( hdr->hwndFrom ) - 1, - LVIS_SELECTED, LVIS_SELECTED ); + ListView_SetItemState ( hdr->hwndFrom, + ListView_GetItemCount ( hdr->hwndFrom ) - 1, + LVIS_SELECTED, LVIS_SELECTED ); } - } + } break; } - + case VK_RETURN: { int sel = ListView_GetNextItem ( hdr->hwndFrom, -1, LVNI_SELECTED ); @@ -1394,7 +1394,7 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, } break; } - + case LVN_BEGINLABELEDIT: { NMLVDISPINFO* di = (NMLVDISPINFO*)hdr; @@ -1402,27 +1402,27 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, DWORD style = GetWindowLong ( ListView_GetEditControl ( hdr->hwndFrom ), GWL_STYLE ); SetWindowLong ( ListView_GetEditControl ( hdr->hwndFrom ), GWL_STYLE, style & (~WS_BORDER) ); - rvDebuggerWatch* watch = (rvDebuggerWatch*)di->item.lParam; + rvDebuggerWatch* watch = (rvDebuggerWatch*)di->item.lParam; if ( watch ) { SetWindowText ( ListView_GetEditControl ( hdr->hwndFrom ), watch->mVariable ); } - + return FALSE; } - + case LVN_ENDLABELEDIT: { NMLVDISPINFO* di = (NMLVDISPINFO*)hdr; - + if ( di->item.iItem == ListView_GetItemCount ( hdr->hwndFrom ) - 1 ) { if ( !di->item.pszText || !di->item.pszText[0] ) { return FALSE; } - - window->AddWatch ( ((NMLVDISPINFO*)hdr)->item.pszText ); + + window->AddWatch ( ((NMLVDISPINFO*)hdr)->item.pszText ); window->UpdateWatch ( ); return FALSE; } @@ -1439,7 +1439,7 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, } } break; - + case IDC_DBG_CALLSTACK: if ( hdr->code == NM_DBLCLK ) { @@ -1451,7 +1451,7 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, window->UpdateWatch ( ); window->OpenScript ( window->mClient->GetCallstack()[window->mCurrentStackDepth]->mFilename, window->mClient->GetCallstack()[window->mCurrentStackDepth]->mLineNumber ); - } + } } break; case IDC_DBG_TABS: @@ -1489,7 +1489,7 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, } break; } - + case WM_CLOSE: if ( window->mClient->IsConnected ( ) ) { @@ -1497,7 +1497,7 @@ LRESULT CALLBACK rvDebuggerWindow::WndProc ( HWND wnd, UINT msg, WPARAM wparam, { return 0; } - } + } PostQuitMessage ( 0 ); break; } @@ -1516,15 +1516,15 @@ and activated then true will be returned. bool rvDebuggerWindow::Activate ( void ) { HWND find; - + find = FindWindow ( DEBUGGERWINDOWCLASS, NULL ); if ( !find ) { return false; } - + SetForegroundWindow ( find ); - + return true; } @@ -1538,9 +1538,9 @@ Process an incoming network message void rvDebuggerWindow::ProcessNetMessage ( msg_t* msg ) { unsigned short command; - + command = (unsigned short)MSG_ReadShort ( msg ); - + switch ( command ) { case DBMSG_RESUMED: @@ -1553,7 +1553,7 @@ void rvDebuggerWindow::ProcessNetMessage ( msg_t* msg ) char temp[1024]; char temp2[1024]; int i; - + MSG_ReadShort ( msg ); MSG_ReadString ( msg, temp, 1024 ); MSG_ReadString ( msg, temp2, 1024 ); @@ -1568,29 +1568,29 @@ void rvDebuggerWindow::ProcessNetMessage ( msg_t* msg ) info.hinst = mInstance; info.lpszText = va("%s=%s", mTooltipVar.c_str(), mTooltipValue.c_str() ); SendMessage ( mWndToolTips, TTM_UPDATETIPTEXT, 0, (LPARAM)&info ); - SendMessage ( mWndToolTips, TTM_UPDATE, 0, 0 ); + SendMessage ( mWndToolTips, TTM_UPDATE, 0, 0 ); } // See if any of the watches were updated by this inspect for ( i = 0; i < mWatches.Num(); i ++ ) { rvDebuggerWatch* watch = mWatches[i]; - + // See if the name matches the variable if ( watch->mVariable.Cmp ( temp ) ) - { + { continue; } - + // Has the value changed? if ( !watch->mValue.Cmp ( temp2 ) ) { continue; } - - watch->mModified = true; - watch->mValue = temp2; - + + watch->mModified = true; + watch->mValue = temp2; + // Find the list view item that is storing this watch info and redraw it for ( int l = 0; l < ListView_GetItemCount(mWndWatch); l ++ ) { @@ -1598,23 +1598,23 @@ void rvDebuggerWindow::ProcessNetMessage ( msg_t* msg ) item.mask = LVIF_PARAM; item.iItem = l; ListView_GetItem ( mWndWatch, &item ); - if ( item.lParam == (LPARAM) watch ) - { + if ( item.lParam == (LPARAM) watch ) + { ListView_RedrawItems ( mWndWatch, l, l ); UpdateWindow ( mWndWatch ); break; } } } - + break; - } - + } + case DBMSG_CONNECT: case DBMSG_CONNECTED: UpdateTitle ( ); UpdateToolbar ( ); - Printf ( "Connected...\n" ); + Printf ( "Connected...\n" ); break; case DBMSG_DISCONNECT: @@ -1622,20 +1622,20 @@ void rvDebuggerWindow::ProcessNetMessage ( msg_t* msg ) UpdateToolbar ( ); Printf ( "Disconnected...\n" ); break; - + case DBMSG_PRINT: SendMessage ( mWndConsole, EM_SETSEL, -1, -1 ); - SendMessage ( mWndConsole, EM_REPLACESEL, 0, (LPARAM)(const char*)(msg->data) + msg->readcount ); - SendMessage ( mWndConsole, EM_SCROLLCARET, 0, 0 ); + SendMessage ( mWndConsole, EM_REPLACESEL, 0, (LPARAM)(const char*)(msg->data) + msg->readcount ); + SendMessage ( mWndConsole, EM_SCROLLCARET, 0, 0 ); break; - + case DBMSG_BREAK: { Printf ( "Break: line=%d file='%s'\n", mClient->GetBreakLineNumber ( ), mClient->GetBreakFilename() ); - + mCurrentStackDepth = 0; mClient->InspectVariable ( mTooltipVar, mCurrentStackDepth ); - UpdateWatch ( ); + UpdateWatch ( ); EnableWindows ( TRUE ); OpenScript ( mClient->GetBreakFilename(), mClient->GetBreakLineNumber() - 1 ); UpdateTitle ( ); @@ -1643,31 +1643,31 @@ void rvDebuggerWindow::ProcessNetMessage ( msg_t* msg ) SetForegroundWindow ( mWnd ); break; } - + case DBMSG_INSPECTCALLSTACK: { UpdateCallstack ( ); break; } - + case DBMSG_INSPECTTHREADS: { LVITEM item; ListView_DeleteAllItems ( mWndThreads ); ZeroMemory ( &item, sizeof(item) ); item.mask = LVIF_TEXT|LVIF_IMAGE; - + for ( int i = 0; i < mClient->GetThreads().Num(); i ++ ) - { + { rvDebuggerThread* entry = mClient->GetThreads()[i]; item.iItem = ListView_GetItemCount ( mWndThreads ); item.pszText = ""; item.iImage = entry->mCurrent ? 1 : 0; - ListView_InsertItem ( mWndThreads, &item ); + ListView_InsertItem ( mWndThreads, &item ); ListView_SetItemText ( mWndThreads, item.iItem, 1, (LPSTR)va("%d", entry->mID) ); ListView_SetItemText ( mWndThreads, item.iItem, 2, (LPSTR)entry->mName.c_str() ); - + if ( entry->mDying ) { ListView_SetItemText ( mWndThreads, item.iItem, 3, "Dying" ); @@ -1680,7 +1680,7 @@ void rvDebuggerWindow::ProcessNetMessage ( msg_t* msg ) { ListView_SetItemText ( mWndThreads, item.iItem, 3, "Stopped" ); } - else + else { ListView_SetItemText ( mWndThreads, item.iItem, 3, "Running" ); } @@ -1707,8 +1707,8 @@ void rvDebuggerWindow::Printf ( const char* fmt, ... ) va_end (argptr); SendMessage ( mWndOutput, EM_SETSEL, -1, -1 ); - SendMessage ( mWndOutput, EM_REPLACESEL, 0, (LPARAM)msg ); - SendMessage ( mWndOutput, EM_SCROLLCARET, 0, 0 ); + SendMessage ( mWndOutput, EM_REPLACESEL, 0, (LPARAM)msg ); + SendMessage ( mWndOutput, EM_SCROLLCARET, 0, 0 ); } /* @@ -1726,7 +1726,7 @@ bool rvDebuggerWindow::OpenScript ( const char* filename, int lineNumber ) SetCursor ( LoadCursor ( NULL, IDC_WAIT ) ); mActiveScript = -1; - + // See if the script is already loaded for ( i = 0; i < mScripts.Num(); i ++ ) { @@ -1739,12 +1739,12 @@ bool rvDebuggerWindow::OpenScript ( const char* filename, int lineNumber ) } } } - + // If the script isnt open already then open it if ( mActiveScript == -1 ) { rvDebuggerScript* script = new rvDebuggerScript; - + // Load the script if ( !script->Load ( filename ) ) { @@ -1761,26 +1761,26 @@ bool rvDebuggerWindow::OpenScript ( const char* filename, int lineNumber ) // Test code that will place a breakpoint on all valid lines of code #if 0 - + for ( i = 0; i < mScripts[mActiveScript]->GetProgram().NumStatements(); i ++ ) { dstatement_t* st = &mScripts[mActiveScript]->GetProgram().GetStatement ( i ); rvDebuggerBreakpoint* bp = new rvDebuggerBreakpoint ( filename, st->linenumber ); mBreakpoints.Append ( bp ); } - + #endif - UpdateScript ( ); + UpdateScript ( ); UpdateWindowMenu ( ); // Move to a specific line number? if ( lineNumber != -1 ) { int c; - + // Put the caret on the line number specified and scroll it into position. - // This is a bit of a hack since we set the selection twice, but setting the + // This is a bit of a hack since we set the selection twice, but setting the // selection to (c,c) didnt work for scrolling the caret so we do (c,c+1) // and then scroll before going back to (c,c). // NOTE: We scroll to the line before the one we want so its more visible @@ -1794,14 +1794,14 @@ bool rvDebuggerWindow::OpenScript ( const char* filename, int lineNumber ) else { SendMessage ( mWndScript, EM_SETSEL, 0, 0 ); - } + } // Make sure the script window is visible ShowWindow ( mWndScript, SW_SHOW ); - UpdateWindow ( mWndScript ); - + UpdateWindow ( mWndScript ); + SetCursor ( LoadCursor ( NULL, IDC_ARROW ) ); - + return true; } @@ -1817,23 +1817,23 @@ void rvDebuggerWindow::ToggleBreakpoint ( void ) rvDebuggerBreakpoint* bp; DWORD sel; int line; - + // Find the currently selected line SendMessage ( mWndScript, EM_GETSEL, (WPARAM)&sel, 0 ); line = SendMessage ( mWndScript, EM_LINEFROMCHAR, sel, 0 ) + 1; - + // If there is already a breakpoint there then just remove it, otherwise // we need to create a new breakpoint bp = mClient->FindBreakpoint ( mScripts[mActiveScript]->GetFilename ( ), line ); if ( !bp ) - { - // Make sure the line is code before letting them add a breakpoint there + { + // Make sure the line is code before letting them add a breakpoint there if ( !mScripts[mActiveScript]->IsLineCode ( line ) ) { MessageBeep ( MB_ICONEXCLAMATION ); return; } - + mClient->AddBreakpoint ( mScripts[mActiveScript]->GetFilename(), line ); } else @@ -1877,10 +1877,10 @@ void rvDebuggerWindow::CreateToolbar ( void ) mWndToolbar = CreateWindowEx ( 0, TOOLBARCLASSNAME, "", WS_CHILD|WS_VISIBLE,0,0,0,0, mWnd, (HMENU)IDC_DBG_TOOLBAR, mInstance, NULL ); // Initialize the toolbar - SendMessage ( mWndToolbar, TB_BUTTONSTRUCTSIZE, ( WPARAM )sizeof( TBBUTTON ), 0 ); - SendMessage ( mWndToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(16,16) ); + SendMessage ( mWndToolbar, TB_BUTTONSTRUCTSIZE, ( WPARAM )sizeof( TBBUTTON ), 0 ); + SendMessage ( mWndToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(16,16) ); SendMessage ( mWndToolbar, TB_SETSTYLE, 0, SendMessage ( mWndToolbar, TB_GETSTYLE, 0, 0 ) | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS ); - + TBMETRICS tbmet; tbmet.cbSize = sizeof(TBMETRICS); SendMessage ( mWndToolbar, TB_GETMETRICS, 0, (LPARAM)&tbmet ); @@ -1888,11 +1888,11 @@ void rvDebuggerWindow::CreateToolbar ( void ) tbmet.cyBarPad = 0; SendMessage ( mWndToolbar, TB_SETMETRICS, 0, (LPARAM)&tbmet ); - // Add the bitmap containing button images to the toolbar. - TBADDBITMAP tbab; - tbab.hInst = mInstance; - tbab.nID = IDB_DBG_TOOLBAR; - SendMessage( mWndToolbar, TB_ADDBITMAP, (WPARAM)4, (LPARAM) &tbab ); + // Add the bitmap containing button images to the toolbar. + TBADDBITMAP tbab; + tbab.hInst = mInstance; + tbab.nID = IDB_DBG_TOOLBAR; + SendMessage( mWndToolbar, TB_ADDBITMAP, (WPARAM)4, (LPARAM) &tbab ); // Add the buttons to the toolbar TBBUTTON tbb[] = { { 0, 0, TBSTATE_ENABLED, BTNS_SEP, 0, 0, -1 }, @@ -1906,7 +1906,7 @@ void rvDebuggerWindow::CreateToolbar ( void ) { 6, ID_DBG_DEBUG_STEPOUT, TBSTATE_ENABLED, BTNS_BUTTON, 0, 0, -1 }, { 0, 0, TBSTATE_ENABLED, BTNS_SEP, 0, 0, -1 } }; - SendMessage( mWndToolbar, TB_ADDBUTTONS, (WPARAM)sizeof(tbb)/sizeof(TBBUTTON), (LPARAM) tbb ); + SendMessage( mWndToolbar, TB_ADDBUTTONS, (WPARAM)sizeof(tbb)/sizeof(TBBUTTON), (LPARAM) tbb ); } /* @@ -1925,7 +1925,7 @@ void rvDebuggerWindow::HandleTooltipGetDispInfo ( WPARAM wparam, LPARAM lparam ) case ID_DBG_FILE_OPEN: strcpy ( ttdi->szText, "Open Script" ); break; - + case ID_DBG_DEBUG_STEPINTO: strcpy ( ttdi->szText, "Step Into" ); break; @@ -1933,7 +1933,7 @@ void rvDebuggerWindow::HandleTooltipGetDispInfo ( WPARAM wparam, LPARAM lparam ) case ID_DBG_DEBUG_STEPOVER: strcpy ( ttdi->szText, "Step Over" ); break; - + case ID_DBG_DEBUG_STEPOUT: strcpy ( ttdi->szText, "Step Out" ); break; @@ -1941,7 +1941,7 @@ void rvDebuggerWindow::HandleTooltipGetDispInfo ( WPARAM wparam, LPARAM lparam ) case ID_DBG_DEBUG_BREAK: strcpy ( ttdi->szText, "Break" ); break; - + case ID_DBG_DEBUG_RUN: if ( mClient->IsConnected() ) { @@ -1952,7 +1952,7 @@ void rvDebuggerWindow::HandleTooltipGetDispInfo ( WPARAM wparam, LPARAM lparam ) strcpy ( ttdi->szText, "Run" ); } break; - + default: strcpy ( ttdi->szText, "" ); break; @@ -1977,23 +1977,23 @@ int rvDebuggerWindow::HandleActivate ( WPARAM wparam, LPARAM lparam ) { return 0; } - + // Run through all of the loaded scripts and see if any of them have been modified for ( i = 0; i < mScripts.Num(); i ++ ) { if ( mScripts[i]->IsFileModified ( true ) ) { if ( IDYES == MessageBox ( mWnd, va("%s\n\nThis file has been modified outside of the debugger.\nDo you want to reload it?", mScripts[i]->GetFilename() ), "Quake 4 Script Debugger", MB_YESNO|MB_ICONQUESTION ) ) - { + { mScripts[i]->Reload ( ); - // Update the script if it was the active one + // Update the script if it was the active one if ( mActiveScript == i ) { mLastActiveScript = -1; UpdateScript ( ); } - + // Loop through the breakpoints and see if any of them have // moved to invalid lines within the script. If so then just remove // them. @@ -2001,19 +2001,19 @@ int rvDebuggerWindow::HandleActivate ( WPARAM wparam, LPARAM lparam ) { rvDebuggerBreakpoint* bp = mClient->GetBreakpoint(b); assert ( bp ); - + if ( !idStr::Icmp ( bp->GetFilename(), mScripts[i]->GetFilename() ) ) { if ( !mScripts[i]->IsLineCode ( bp->GetLineNumber ( ) ) ) { mClient->RemoveBreakpoint ( bp->GetID ( ) ); - } - } + } + } } } } - } - + } + return 1; } @@ -2036,14 +2036,14 @@ void rvDebuggerWindow::EnableWindows ( bool state ) ================ rvDebuggerWindow::AddWatch -Add a variable to the watch window. If update is set to true then also query the +Add a variable to the watch window. If update is set to true then also query the debugger client for the value ================ */ void rvDebuggerWindow::AddWatch ( const char* varname, bool update ) { rvDebuggerWatch* watch; - + watch = new rvDebuggerWatch; watch->mVariable = varname; watch->mModified = false; @@ -2056,8 +2056,8 @@ void rvDebuggerWindow::AddWatch ( const char* varname, bool update ) item.iItem = ListView_GetItemCount ( mWndWatch ) - 1; item.iSubItem = 0; item.lParam = (LPARAM)watch; - ListView_InsertItem ( mWndWatch, &item ); - + ListView_InsertItem ( mWndWatch, &item ); + // If update is set then request the value from the debugger client if ( update ) { @@ -2080,7 +2080,7 @@ bool rvDebuggerWindow::InitRecentFiles ( void ) mRecentFileMenu = GetSubMenu ( GetMenu(mWnd), 0 ); count = GetMenuItemCount ( mRecentFileMenu ); - + for ( i = 0; i < count; i ++ ) { if ( GetMenuItemID ( mRecentFileMenu, i ) == ID_DBG_FILE_MRU ) @@ -2090,7 +2090,7 @@ bool rvDebuggerWindow::InitRecentFiles ( void ) return true; } } - + return false; } @@ -2107,8 +2107,8 @@ void rvDebuggerWindow::UpdateRecentFiles ( void ) int j; // Make sure everything is initialized - if ( !mRecentFileMenu ) - { + if ( !mRecentFileMenu ) + { InitRecentFiles ( ); } @@ -2116,7 +2116,7 @@ void rvDebuggerWindow::UpdateRecentFiles ( void ) for ( i = 0; i < rvRegistryOptions::MAX_MRU_SIZE; i ++ ) { DeleteMenu ( mRecentFileMenu, ID_DBG_FILE_MRU1 + i, MF_BYCOMMAND ); - } + } // Make sure there is a separator after the recent files if ( gDebuggerApp.GetOptions().GetRecentFileCount() ) @@ -2139,14 +2139,14 @@ void rvDebuggerWindow::UpdateRecentFiles ( void ) idStr str = va("&%d ", j+1); str.Append ( gDebuggerApp.GetOptions().GetRecentFile ( i ) ); InsertMenu ( mRecentFileMenu, mRecentFileInsertPos+j+1, MF_BYPOSITION|MF_STRING|MF_ENABLED, id, str ); - } + } } /* ================ rvDebuggerWindow::GetSelectedText -Function to retrieve the text that is currently selected in the +Function to retrieve the text that is currently selected in the script control ================ */ @@ -2156,9 +2156,9 @@ int rvDebuggerWindow::GetSelectedText ( idStr& text ) int start; int end; char* temp; - + text.Empty ( ); - + if ( mScripts.Num ( ) ) { SendMessage ( mWndScript, EM_GETSEL, (WPARAM)&start, (LPARAM)&end ); @@ -2167,7 +2167,7 @@ int rvDebuggerWindow::GetSelectedText ( idStr& text ) end = SendMessage ( mWndScript, EM_FINDWORDBREAK, WB_RIGHT, start ); start = SendMessage ( mWndScript, EM_FINDWORDBREAK, WB_LEFT, start ); } - + temp = new char[end-start+10]; range.chrg.cpMin = start; range.chrg.cpMax = end; @@ -2175,10 +2175,10 @@ int rvDebuggerWindow::GetSelectedText ( idStr& text ) SendMessage ( mWndScript, EM_GETTEXTRANGE, 0, (LPARAM) &range ); text = temp; delete[] temp; - + return start; } - + return -1; } @@ -2188,11 +2188,11 @@ rvDebuggerWindow::FindNext Finds the next match of the find text in the active script. The next is always relative to the current selection. If the text parameter is NULL -then the last text used will be searched for. +then the last text used will be searched for. ================ */ bool rvDebuggerWindow::FindNext ( const char* text ) -{ +{ int start; FINDTEXT ft; @@ -2208,7 +2208,7 @@ bool rvDebuggerWindow::FindNext ( const char* text ) SendMessage ( mWndScript, EM_GETSEL, (WPARAM)&start, (LPARAM)0 ); if ( start < 0 ) - { + { start = 0; } @@ -2223,16 +2223,16 @@ bool rvDebuggerWindow::FindNext ( const char* text ) ft.chrg.cpMax = -1; ft.lpstrText = mFind.c_str(); start = SendMessage ( mWndScript, EM_FINDTEXT, FR_DOWN, (LPARAM)&ft ); - + if ( start < 0 ) { return false; } } - + SendMessage ( mWndScript, EM_SETSEL, start, start + mFind.Length() ); SendMessage ( mWndScript, EM_SCROLLCARET, 0, 0 ); - + return true; } @@ -2242,11 +2242,11 @@ rvDebuggerWindow::FindPrev Finds the previous match of the find text in the active script. The previous is always relative to the current selection. If the text parameter is NULL -then the last text used will be searched for. +then the last text used will be searched for. ================ */ bool rvDebuggerWindow::FindPrev ( const char* text ) -{ +{ int start; FINDTEXT ft; @@ -2262,7 +2262,7 @@ bool rvDebuggerWindow::FindPrev ( const char* text ) SendMessage ( mWndScript, EM_GETSEL, (WPARAM)&start, (LPARAM)0 ); if ( start < 0 ) - { + { start = 0; } @@ -2280,16 +2280,16 @@ bool rvDebuggerWindow::FindPrev ( const char* text ) ft.chrg.cpMax = 0; ft.lpstrText = mFind.c_str(); start = SendMessage ( mWndScript, EM_FINDTEXT, 0, (LPARAM)&ft ); - + if ( start < 0 ) { return false; } } - + SendMessage ( mWndScript, EM_SETSEL, start, start + mFind.Length() ); SendMessage ( mWndScript, EM_SCROLLCARET, 0, 0 ); - + return true; } @@ -2309,11 +2309,11 @@ int rvDebuggerWindow::HandleDrawItem ( WPARAM wparam, LPARAM lparam ) RECT rect; rvDebuggerWatch* watch; bool selected; - - dis = (DRAWITEMSTRUCT*) lparam; + + dis = (DRAWITEMSTRUCT*) lparam; watch = (rvDebuggerWatch*)dis->itemData; - col.mask = LVCF_WIDTH; + col.mask = LVCF_WIDTH; rect = dis->rcItem; rect.left = rect.left - 1; rect.right = rect.left; @@ -2328,15 +2328,15 @@ int rvDebuggerWindow::HandleDrawItem ( WPARAM wparam, LPARAM lparam ) } else { - FillRect ( dis->hDC, &dis->rcItem, GetSysColorBrush ( IsWindowEnabled ( mWndWatch ) ? COLOR_WINDOW : COLOR_3DFACE ) ); + FillRect ( dis->hDC, &dis->rcItem, GetSysColorBrush ( IsWindowEnabled ( mWndWatch ) ? COLOR_WINDOW : COLOR_3DFACE ) ); } - - // Run through the columns and draw each with a frame around it and the text + + // Run through the columns and draw each with a frame around it and the text // vertically centered in it for ( index = 0; ListView_GetColumn ( mWndWatch, index, &col ); index ++ ) { rect.right = rect.left + col.cx; - FrameRect ( dis->hDC, &rect, GetSysColorBrush ( COLOR_3DFACE ) ); + FrameRect ( dis->hDC, &rect, GetSysColorBrush ( COLOR_3DFACE ) ); // Draw info on the watch if available if ( watch ) @@ -2344,12 +2344,12 @@ int rvDebuggerWindow::HandleDrawItem ( WPARAM wparam, LPARAM lparam ) RECT textrect; textrect = rect; textrect.left += 5; - + switch ( index ) { case 0: SetTextColor ( dis->hDC, GetSysColor ( selected ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT ) ); - DrawText ( dis->hDC, watch->mVariable, -1, &textrect, DT_LEFT|DT_VCENTER ); + DrawText ( dis->hDC, watch->mVariable, -1, &textrect, DT_LEFT|DT_VCENTER ); break; case 1: @@ -2361,13 +2361,13 @@ int rvDebuggerWindow::HandleDrawItem ( WPARAM wparam, LPARAM lparam ) { SetTextColor ( dis->hDC, GetSysColor ( selected ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT ) ); } - DrawText ( dis->hDC, watch->mValue, -1, &textrect, DT_LEFT|DT_VCENTER ); + DrawText ( dis->hDC, watch->mValue, -1, &textrect, DT_LEFT|DT_VCENTER ); break; - } + } } rect.left = rect.right - 1; - } - + } + return 0; } \ No newline at end of file diff --git a/neo/tools/debugger/DebuggerWindow.h b/neo/tools/debugger/DebuggerWindow.h index 1c1692b4..d1e57476 100644 --- a/neo/tools/debugger/DebuggerWindow.h +++ b/neo/tools/debugger/DebuggerWindow.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"). @@ -48,25 +48,25 @@ class rvDebuggerClient; class rvDebuggerWindow { public: - + rvDebuggerWindow ( ); ~rvDebuggerWindow ( ); - bool Create ( HINSTANCE hInstance ); - + bool Create ( HINSTANCE hInstance ); + static bool Activate ( void ); void ProcessNetMessage ( msg_t* msg ); void Printf ( const char* format, ... ); - + HWND GetWindow ( void ); void AddWatch ( const char* name, bool update = true ); - + HINSTANCE GetInstance ( void ); - -protected: + +protected: bool FindPrev ( const char* text = NULL ); bool FindNext ( const char* text = NULL ); @@ -84,7 +84,7 @@ protected: int GetSelectedText ( idStr& text ); void ToggleBreakpoint ( void ); - + HWND mWnd; HWND mWndScript; HWND mWndOutput; @@ -97,18 +97,18 @@ protected: HWND mWndThreads; HWND mWndToolTips; HWND mWndToolbar; - + HMENU mRecentFileMenu; int mRecentFileInsertPos; - + WNDPROC mOldWatchProc; WNDPROC mOldScriptProc; idStr mTooltipVar; idStr mTooltipValue; - + HINSTANCE mInstance; HIMAGELIST mImageList; - + RECT mSplitterRect; bool mSplitterDrag; @@ -116,23 +116,23 @@ protected: int mActiveScript; int mLastActiveScript; int mCurrentStackDepth; - + HMENU mWindowMenu; int mWindowMenuPos; - + int mZoomScaleNum; int mZoomScaleDem; int mMarginSize; - + idStr mFind; - + rvDebuggerClient* mClient; rvDebuggerWatchList mWatches; - + private: - bool RegisterClass ( void ); + bool RegisterClass ( void ); void CreateToolbar ( void ); bool InitRecentFiles ( void ); @@ -141,7 +141,7 @@ private: int HandleCreate ( WPARAM wparam, LPARAM lparam ); int HandleActivate ( WPARAM wparam, LPARAM lparam ); int HandleDrawItem ( WPARAM wparam, LPARAM lparam ); - void HandleTooltipGetDispInfo ( WPARAM wparam, LPARAM lparam ); + void HandleTooltipGetDispInfo ( WPARAM wparam, LPARAM lparam ); static LRESULT CALLBACK WndProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam ); static LRESULT CALLBACK MarginWndProc ( HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam ); @@ -181,4 +181,3 @@ ID_INLINE HINSTANCE rvDebuggerWindow::GetInstance ( void ) } #endif // DEBUGGERWINDOW_H_ - diff --git a/neo/tools/debugger/debugger.cpp b/neo/tools/debugger/debugger.cpp index 22220fef..67e654b6 100644 --- a/neo/tools/debugger/debugger.cpp +++ b/neo/tools/debugger/debugger.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"). @@ -54,7 +54,7 @@ Main entry point for the debugger application ================ */ void DebuggerClientInit( const char *cmdline ) -{ +{ // See if the debugger is already running if ( rvDebuggerWindow::Activate ( ) ) { @@ -99,9 +99,9 @@ void DebuggerClientLaunch ( void ) STARTUPINFO startup; PROCESS_INFORMATION process; - + ZeroMemory ( &startup, sizeof(startup) ); - startup.cb = sizeof(startup); + startup.cb = sizeof(startup); GetCurrentDirectory ( MAX_PATH, curDir ); @@ -124,7 +124,7 @@ Thread proc for the debugger server DWORD CALLBACK DebuggerServerThread ( LPVOID param ) { assert ( gDebuggerServer ); - + while ( !gDebuggerServerQuit ) { gDebuggerServer->ProcessMessages ( ); @@ -155,7 +155,7 @@ bool DebuggerServerInit ( void ) { return false; } - + // Initialize the debugger server if ( !gDebuggerServer->Initialize ( ) ) { @@ -163,10 +163,10 @@ bool DebuggerServerInit ( void ) gDebuggerServer = NULL; return false; } - + // Start the debugger server thread gDebuggerServerThread = CreateThread ( NULL, 0, DebuggerServerThread, 0, 0, &gDebuggerServerThreadID ); - + return true; } @@ -183,16 +183,16 @@ void DebuggerServerShutdown ( void ) { // Signal the debugger server to quit gDebuggerServerQuit = true; - + // Wait for the thread to finish WaitForSingleObject ( gDebuggerServerThread, INFINITE ); - + // Shutdown the server now gDebuggerServer->Shutdown(); delete gDebuggerServer; gDebuggerServer = NULL; - + // Cleanup the thread handle CloseHandle ( gDebuggerServerThread ); gDebuggerServerThread = NULL; @@ -212,7 +212,7 @@ void DebuggerServerCheckBreakpoint ( idInterpreter* interpreter, idProgram* prog { return; } - + gDebuggerServer->CheckBreakpoints ( interpreter, program, instructionPointer ); } @@ -229,7 +229,6 @@ void DebuggerServerPrint ( const char* text ) { return; } - + gDebuggerServer->Print ( text ); } - diff --git a/neo/tools/decl/DialogDeclBrowser.cpp b/neo/tools/decl/DialogDeclBrowser.cpp index 152ff23d..d06e5e81 100644 --- a/neo/tools/decl/DialogDeclBrowser.cpp +++ b/neo/tools/decl/DialogDeclBrowser.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"). @@ -433,7 +433,7 @@ BOOL DialogDeclBrowser::OnInitDialog() { EnableToolTips( TRUE ); return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } /* @@ -851,7 +851,7 @@ void DialogDeclBrowser::OnBnClickedFind() { findTextEdit.GetWindowText( windowText ); findTextString = windowText; findTextString.Strip( ' ' ); - + numListedDecls = baseDeclTree.SearchTree( DeclBrowserCompareDecl, this, declTree ); statusBar.SetWindowText( va( "%d decls listed", numListedDecls ) ); diff --git a/neo/tools/decl/DialogDeclBrowser.h b/neo/tools/decl/DialogDeclBrowser.h index c2bf2e85..928909e6 100644 --- a/neo/tools/decl/DialogDeclBrowser.h +++ b/neo/tools/decl/DialogDeclBrowser.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/neo/tools/decl/DialogDeclEditor.cpp b/neo/tools/decl/DialogDeclEditor.cpp index 7dd9a78f..43e67ce2 100644 --- a/neo/tools/decl/DialogDeclEditor.cpp +++ b/neo/tools/decl/DialogDeclEditor.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"). @@ -288,7 +288,7 @@ BOOL DialogDeclEditor::OnInitDialog() { UpdateStatusBar(); return FALSE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } @@ -552,9 +552,9 @@ LRESULT DialogDeclEditor::OnFindDialogMessage( WPARAM wParam, LPARAM lParam ) { } if ( findDlg->IsTerminating() ) { - findDlg = NULL; - return 0; - } + findDlg = NULL; + return 0; + } if( findDlg->FindNext() ) { findStr = findDlg->GetFindString(); @@ -563,7 +563,7 @@ LRESULT DialogDeclEditor::OnFindDialogMessage( WPARAM wParam, LPARAM lParam ) { searchForward = findDlg->SearchDown() != FALSE; OnEditFindNext(); - } + } if ( findDlg->ReplaceCurrent() ) { long selStart, selEnd; diff --git a/neo/tools/decl/DialogDeclEditor.h b/neo/tools/decl/DialogDeclEditor.h index 3c445ae5..4c67a095 100644 --- a/neo/tools/decl/DialogDeclEditor.h +++ b/neo/tools/decl/DialogDeclEditor.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"). @@ -64,7 +64,7 @@ protected: afx_msg void OnEditFind(); afx_msg void OnEditFindNext(); afx_msg void OnEditReplace(); - afx_msg LRESULT OnFindDialogMessage( WPARAM wParam, LPARAM lParam ); + afx_msg LRESULT OnFindDialogMessage( WPARAM wParam, LPARAM lParam ); afx_msg void OnEnChangeEdit( NMHDR *pNMHDR, LRESULT *pResult ); afx_msg void OnEnInputEdit( NMHDR *pNMHDR, LRESULT *pResult ); afx_msg void OnBnClickedTest(); diff --git a/neo/tools/decl/DialogDeclNew.cpp b/neo/tools/decl/DialogDeclNew.cpp index 740c935e..ccd654a5 100644 --- a/neo/tools/decl/DialogDeclNew.cpp +++ b/neo/tools/decl/DialogDeclNew.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"). @@ -124,7 +124,7 @@ BOOL DialogDeclNew::OnInitDialog() { EnableToolTips( TRUE ); return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } diff --git a/neo/tools/decl/DialogDeclNew.h b/neo/tools/decl/DialogDeclNew.h index 0fc9b5c9..66eeb511 100644 --- a/neo/tools/decl/DialogDeclNew.h +++ b/neo/tools/decl/DialogDeclNew.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/neo/tools/decl/DialogEntityDefEditor.cpp b/neo/tools/decl/DialogEntityDefEditor.cpp index d5e58c7a..2eb4d5a3 100644 --- a/neo/tools/decl/DialogEntityDefEditor.cpp +++ b/neo/tools/decl/DialogEntityDefEditor.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"). @@ -354,7 +354,7 @@ BOOL DialogEntityDefEditor::OnInitDialog() { UpdateStatusBar(); return FALSE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } diff --git a/neo/tools/decl/DialogEntityDefEditor.h b/neo/tools/decl/DialogEntityDefEditor.h index aee5c345..f08124aa 100644 --- a/neo/tools/decl/DialogEntityDefEditor.h +++ b/neo/tools/decl/DialogEntityDefEditor.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,7 +60,7 @@ protected: afx_msg void OnMove( int x, int y ); afx_msg void OnSize( UINT nType, int cx, int cy ); afx_msg void OnSizing( UINT nSide, LPRECT lpRect ); - afx_msg LRESULT OnFindDialogMessage( WPARAM wParam, LPARAM lParam ); + afx_msg LRESULT OnFindDialogMessage( WPARAM wParam, LPARAM lParam ); afx_msg void OnEditChange(); afx_msg void OnInheritChange(); afx_msg void OnEnInputEdit( NMHDR *pNMHDR, LRESULT *pResult ); diff --git a/neo/tools/edit_public.h b/neo/tools/edit_public.h index 0486dd10..4beb585b 100644 --- a/neo/tools/edit_public.h +++ b/neo/tools/edit_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"). diff --git a/neo/tools/edit_stub.cpp b/neo/tools/edit_stub.cpp index 7836e208..b9901d7f 100644 --- a/neo/tools/edit_stub.cpp +++ b/neo/tools/edit_stub.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/neo/tools/guied/GEApp.cpp b/neo/tools/guied/GEApp.cpp index c661a8a1..70c94363 100644 --- a/neo/tools/guied/GEApp.cpp +++ b/neo/tools/guied/GEApp.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,9 +47,9 @@ static INT_PTR CALLBACK AboutDlg_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, L { case WM_COMMAND: EndDialog ( hwnd, 1 ); - break; + break; } - + return FALSE; } @@ -83,39 +83,39 @@ bool rvGEApp::Initialize ( void ) com_editors = EDITOR_GUI; Sys_GrabMouseCursor( false ); - + // Load the options - mOptions.Load ( ); + mOptions.Load ( ); mInstance = win32.hInstance; // Create the accelerators mAccelerators = LoadAccelerators ( mInstance, MAKEINTRESOURCE(IDR_GUIED_ACCELERATORS) ); - // Register the window classes for the main frame and the mdi child window + // Register the window classes for the main frame and the mdi child window WNDCLASSEX wndClass; memset ( &wndClass, 0, sizeof(wndClass) ); wndClass.cbSize = sizeof(WNDCLASSEX); - wndClass.lpszClassName = "QUAKE4_GUIEDITOR_CLASS"; + wndClass.lpszClassName = "QUAKE4_GUIEDITOR_CLASS"; wndClass.lpfnWndProc = FrameWndProc; - wndClass.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE + 1); - wndClass.hCursor = LoadCursor((HINSTANCE) NULL, IDC_ARROW); + wndClass.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE + 1); + wndClass.hCursor = LoadCursor((HINSTANCE) NULL, IDC_ARROW); wndClass.lpszMenuName = MAKEINTRESOURCE(IDR_GUIED_MAIN); - wndClass.hInstance = mInstance; + wndClass.hInstance = mInstance; RegisterClassEx ( &wndClass ); wndClass.lpszMenuName = NULL; wndClass.lpfnWndProc = MDIChildProc; wndClass.lpszClassName = "QUAKE4_GUIEDITOR_CHILD_CLASS"; wndClass.style = CS_OWNDC|CS_DBLCLKS|CS_BYTEALIGNWINDOW|CS_VREDRAW|CS_HREDRAW; - wndClass.hbrBackground = (HBRUSH)GetStockObject( LTGRAY_BRUSH ); + wndClass.hbrBackground = (HBRUSH)GetStockObject( LTGRAY_BRUSH ); RegisterClassEx ( &wndClass ); - + // Create the main window - mMDIFrame = CreateWindow ( "QUAKE4_GUIEDITOR_CLASS", - "Quake IV GUI Editor", - WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + mMDIFrame = CreateWindow ( "QUAKE4_GUIEDITOR_CLASS", + "Quake IV GUI Editor", + WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, mInstance, (LPVOID)this ); if ( !mMDIFrame ) @@ -124,15 +124,15 @@ bool rvGEApp::Initialize ( void ) } SetClassLong( mMDIFrame, GCL_HICON, ( LONG )LoadIcon( win32.hInstance, MAKEINTRESOURCE( IDI_GUIED ) ) ); - + // Create the MDI window CLIENTCREATESTRUCT ccs; ccs.hWindowMenu = GetSubMenu ( GetMenu ( mMDIFrame ), 5 ); ccs.idFirstChild = IDM_WINDOWCHILD; - mMDIClient = CreateWindow ( "MDICLIENT", NULL, - WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, - 0, 0, 1000, 1000, - mMDIFrame, NULL, + mMDIClient = CreateWindow ( "MDICLIENT", NULL, + WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + 0, 0, 1000, 1000, + mMDIFrame, NULL, mInstance, &ccs ); if ( !mMDIClient ) @@ -143,15 +143,15 @@ bool rvGEApp::Initialize ( void ) // hide the doom window by default ::ShowWindow ( win32.hWnd, SW_HIDE ); - + // Show both windows mOptions.GetWindowPlacement ( "mdiframe", mMDIFrame ); - ShowWindow ( mMDIFrame, SW_SHOW ); + ShowWindow ( mMDIFrame, SW_SHOW ); UpdateWindow ( mMDIFrame ); ShowWindow ( mMDIClient, SW_SHOW ); UpdateWindow ( mMDIClient ); - + return true; } @@ -166,9 +166,9 @@ workspace then it will return NULL */ rvGEWorkspace* rvGEApp::GetActiveWorkspace ( HWND* ret ) { - rvGEWorkspace* workspace; - HWND active; - + rvGEWorkspace* workspace; + HWND active; + workspace = NULL; active = (HWND)SendMessage ( mMDIClient, WM_MDIGETACTIVE, 0, NULL ); @@ -182,7 +182,7 @@ rvGEWorkspace* rvGEApp::GetActiveWorkspace ( HWND* ret ) { return NULL; } - + return rvGEWorkspace::GetWorkspace ( active ); } @@ -199,8 +199,8 @@ bool rvGEApp::TranslateAccelerator ( LPMSG msg ) if ( msg->message == WM_SYSCHAR ) { - SetFocus ( GetMDIClient ( ) ); - msg->hwnd = GetMDIClient ( ); + SetFocus ( GetMDIClient ( ) ); + msg->hwnd = GetMDIClient ( ); } if ( mViewer ) @@ -219,12 +219,12 @@ bool rvGEApp::TranslateAccelerator ( LPMSG msg ) return true; } } - + if ( TranslateMDISysAccel ( mMDIClient, msg ) ) { return true; } - + return false; } @@ -241,12 +241,12 @@ void rvGEApp::RunFrame ( void ) rvGEWorkspace* workspace = GetActiveWorkspace ( &wnd ); if ( workspace ) - { + { // Render the workspace using a temp DC - HDC hDC = GetDC ( wnd ); - workspace->Render ( hDC ); - ReleaseDC ( wnd, hDC ); - + HDC hDC = GetDC ( wnd ); + workspace->Render ( hDC ); + ReleaseDC ( wnd, hDC ); + if ( mViewer ) { mViewer->RunFrame ( ); @@ -266,15 +266,15 @@ LRESULT CALLBACK rvGEApp::FrameWndProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LP rvGEApp* app = (rvGEApp*) GetWindowLong ( hWnd, GWL_USERDATA ); switch ( uMsg ) - { + { case WM_SIZE: { RECT rStatus; RECT rClient; - // Tell the status bar to resize + // Tell the status bar to resize app->mStatusBar.Resize ( LOWORD(lParam), HIWORD(lParam) ); - + // Calculate the new client window rectangle (minus the status bar) GetWindowRect ( app->mStatusBar.GetWindow ( ), &rStatus ); GetClientRect ( hWnd, &rClient ); @@ -284,24 +284,24 @@ LRESULT CALLBACK rvGEApp::FrameWndProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LP rClient.bottom -= (rStatus.bottom-rStatus.top); } MoveWindow ( app->mMDIClient, 0, 0, rClient.right-rClient.left, rClient.bottom-rClient.top, FALSE ); - + return 0; } - + case WM_ENABLE: - { + { int i; - // Synchronise all toolwindows to the same state. + // Synchronise all toolwindows to the same state. for(i = 0; i < app->mToolWindows.Num(); i++) { - if(app->mToolWindows[i] != hWnd) + if(app->mToolWindows[i] != hWnd) { EnableWindow(app->mToolWindows[i], wParam); } - } - break; - } + } + break; + } case WM_NCACTIVATE: return app->ToolWindowActivate ( hWnd, uMsg, wParam, lParam ); @@ -314,7 +314,7 @@ LRESULT CALLBACK rvGEApp::FrameWndProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LP app->HandleInitMenu ( wParam, lParam ); break; - case WM_CLOSE: + case WM_CLOSE: while ( app->mWorkspaces.Num ( ) ) { SendMessage ( app->mWorkspaces[0]->GetWindow ( ), WM_CLOSE, 0, 0 ); @@ -323,9 +323,9 @@ LRESULT CALLBACK rvGEApp::FrameWndProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LP case WM_DESTROY: app->mOptions.SetWindowPlacement ( "mdiframe", hWnd ); - app->mOptions.Save ( ); + app->mOptions.Save ( ); ExitProcess(0); - break; + break; case WM_COMMAND: { @@ -335,26 +335,26 @@ LRESULT CALLBACK rvGEApp::FrameWndProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LP if ( -1 != result ) { return result; - } + } break; } case WM_CREATE: - { + { LPCREATESTRUCT cs; - + cs = (LPCREATESTRUCT) lParam; app = (rvGEApp*)cs->lpCreateParams; assert ( app ); - + SetWindowLong ( hWnd, GWL_USERDATA, (LONG)app ); app->mMDIFrame = hWnd; - + app->InitRecentFiles ( ); app->UpdateRecentFiles ( ); - app->mNavigator.Create ( hWnd, gApp.mOptions.GetNavigatorVisible ( ) ); + app->mNavigator.Create ( hWnd, gApp.mOptions.GetNavigatorVisible ( ) ); app->mTransformer.Create ( hWnd, gApp.mOptions.GetTransformerVisible ( ) ); app->mStatusBar.Create ( hWnd, 9999, gApp.mOptions.GetStatusBarVisible ( ) ); app->mProperties.Create ( hWnd, gApp.mOptions.GetPropertiesVisible ( ) ); @@ -364,10 +364,10 @@ LRESULT CALLBACK rvGEApp::FrameWndProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LP app->mToolWindows.Append ( app->mNavigator.GetWindow ( ) ); app->mToolWindows.Append ( app->mProperties.GetWindow ( ) ); app->mToolWindows.Append ( app->mTransformer.GetWindow ( ) ); - + SendMessage ( app->mNavigator.GetWindow ( ), WM_NCACTIVATE, true, (LONG)-1 ); SendMessage ( app->mProperties.GetWindow ( ), WM_NCACTIVATE, true, (LONG)-1 ); - SendMessage ( app->mTransformer.GetWindow ( ), WM_NCACTIVATE, true, (LONG)-1 ); + SendMessage ( app->mTransformer.GetWindow ( ), WM_NCACTIVATE, true, (LONG)-1 ); break; } @@ -385,7 +385,7 @@ MDI Child window procedure */ LRESULT CALLBACK rvGEApp::MDIChildProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { - rvGEWorkspace* workspace = (rvGEWorkspace*)GetWindowLong ( hWnd, GWL_USERDATA ); + rvGEWorkspace* workspace = (rvGEWorkspace*)GetWindowLong ( hWnd, GWL_USERDATA ); // Give the active workspace a chance to play with it if ( workspace ) @@ -400,28 +400,28 @@ LRESULT CALLBACK rvGEApp::MDIChildProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LP break; case WM_CREATE: - { + { LPMDICREATESTRUCT mdics; LPCREATESTRUCT cs; - + // MDI windows have their creation params buried two levels deep, extract // that param since it is the workspace pointer cs = (LPCREATESTRUCT) lParam; mdics = (LPMDICREATESTRUCT) cs->lpCreateParams; - + // Attach the workspace to the window workspace = (rvGEWorkspace*) mdics->lParam; - workspace->Attach ( hWnd ); + workspace->Attach ( hWnd ); + + workspace->GetApplication ( )->mWorkspaces.Append ( workspace ); - workspace->GetApplication ( )->mWorkspaces.Append ( workspace ); - break; } case WM_MDIACTIVATE: assert ( workspace ); if ( (HWND)lParam == hWnd ) - { + { workspace->GetApplication ( )->GetNavigator().SetWorkspace(workspace); workspace->GetApplication ( )->GetTransformer().SetWorkspace(workspace); workspace->GetApplication ( )->GetProperties().SetWorkspace(workspace); @@ -431,7 +431,7 @@ LRESULT CALLBACK rvGEApp::MDIChildProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LP { gApp.GetStatusBar ( ).SetSimple ( true ); } - break; + break; case WM_DESTROY: assert ( workspace ); @@ -449,20 +449,20 @@ LRESULT CALLBACK rvGEApp::MDIChildProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LP { HDC dc; PAINTSTRUCT ps; - - dc = BeginPaint(hWnd, &ps); - + + dc = BeginPaint(hWnd, &ps); + if ( workspace ) { workspace->Render ( dc ); } - - EndPaint(hWnd, &ps); - + + EndPaint(hWnd, &ps); + break; } } - + return DefMDIChildProc ( hWnd, uMsg, wParam, lParam ); } @@ -476,7 +476,7 @@ Handles the ID_GUIED_FILE_SAVE and ID_GUIED_FILE_SAVEAS commands void rvGEApp::HandleCommandSave ( rvGEWorkspace* workspace, const char* filename ) { idStr realFilename; - + // See if we need to browse for a filename if ( workspace->IsNew ( ) || filename == NULL ) { @@ -495,8 +495,8 @@ void rvGEApp::HandleCommandSave ( rvGEWorkspace* workspace, const char* filename ofn.nFilterIndex = 1; ofn.Flags = OFN_PATHMUSTEXIST; - // Display the save dialog box. - if ( !GetSaveFileName(&ofn) ) + // Display the save dialog box. + if ( !GetSaveFileName(&ofn) ) { return; } @@ -517,7 +517,7 @@ void rvGEApp::HandleCommandSave ( rvGEWorkspace* workspace, const char* filename else { realFilename = filename; - } + } // Now performe the file save if ( workspace->SaveFile ( realFilename ) ) @@ -549,15 +549,15 @@ int rvGEApp::HandleCommand ( WPARAM wParam, LPARAM lParam ) OpenFile ( mOptions.GetRecentFile ( mOptions.GetRecentFileCount() - (LOWORD(wParam)-ID_GUIED_FILE_MRU1) - 1 ) ); return 0; } - + switch ( LOWORD ( wParam ) ) - { + { case ID_GUIED_SOURCECONTROL_CHECKIN: assert ( workspace ); HandleCommandSave ( workspace, workspace->GetFilename ( ) ); workspace->CheckIn ( ); break; - + case ID_GUIED_SOURCECONTROL_CHECKOUT: assert ( workspace ); workspace->CheckOut ( ); @@ -570,14 +570,14 @@ int rvGEApp::HandleCommand ( WPARAM wParam, LPARAM lParam ) workspace->UndoCheckout ( ); } break; - + case ID_GUIED_TOOLS_RELOADMATERIALS: SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_WAIT) ) ); cmdSystem->BufferCommandText( CMD_EXEC_NOW, "reloadImages\n" ); cmdSystem->BufferCommandText( CMD_EXEC_NOW, "reloadMaterials\n" ); SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_ARROW) ) ); break; - + case ID_GUIED_EDIT_COPY: assert ( workspace ); workspace->Copy ( ); @@ -587,37 +587,37 @@ int rvGEApp::HandleCommand ( WPARAM wParam, LPARAM lParam ) assert ( workspace ); workspace->Paste ( ); break; - + case ID_GUIED_HELP_ABOUT: DialogBox ( GetInstance(), MAKEINTRESOURCE(IDD_GUIED_ABOUT), mMDIFrame, AboutDlg_WndProc ); break; - + case ID_GUIED_TOOLS_VIEWER: { if ( mViewer ) { break; } - + mViewer = new rvGEViewer; if ( !mViewer->Create ( mMDIFrame ) ) { delete mViewer; mViewer = NULL; } - + if ( workspace ) - { + { if ( !workspace->IsModified () || HandleCommand ( MAKELONG(ID_GUIED_FILE_SAVE,0), 0 ) ) { mViewer->OpenFile ( workspace->GetFilename ( ) ); } } - + SetActiveWindow ( mViewer->GetWindow ( ) ); break; } - + case ID_GUIED_ITEM_MAKESAMESIZEWIDTH: assert ( workspace ); workspace->MakeSelectedSameSize ( true, false ); @@ -632,7 +632,7 @@ int rvGEApp::HandleCommand ( WPARAM wParam, LPARAM lParam ) assert ( workspace ); workspace->MakeSelectedSameSize ( false, true ); break; - + case ID_GUIED_ITEM_ALIGNLEFTS: assert ( workspace ); workspace->AlignSelected ( rvGEWorkspace::ALIGN_LEFTS ); @@ -662,32 +662,32 @@ int rvGEApp::HandleCommand ( WPARAM wParam, LPARAM lParam ) assert ( workspace ); workspace->AlignSelected ( rvGEWorkspace::ALIGN_BOTTOMS ); break; - + case ID_GUIED_ITEM_ARRANGESENDBACKWARD: assert ( workspace ); workspace->SendSelectedBackward ( ); - break; + break; case ID_GUIED_ITEM_ARRANGESENDTOBACK: assert ( workspace ); workspace->SendSelectedToBack( ); - break; + break; case ID_GUIED_ITEM_ARRANGEBRINGFORWARD: assert ( workspace ); workspace->BringSelectedForward ( ); - break; + break; case ID_GUIED_ITEM_ARRANGEBRINGTOFRONT: assert ( workspace ); workspace->BringSelectedToFront ( ); - break; - + break; + case ID_GUIED_ITEM_ARRANGEMAKECHILD: assert ( workspace ); workspace->MakeSelectedAChild ( ); break; - + case ID_GUIED_ITEM_PROPERTIES: assert ( workspace ); workspace->EditSelectedProperties ( ); @@ -697,7 +697,7 @@ int rvGEApp::HandleCommand ( WPARAM wParam, LPARAM lParam ) assert ( workspace ); workspace->EditSelectedScripts ( ); break; - + case ID_GUIED_ITEM_NEWWINDOWDEF: assert ( workspace ); workspace->AddWindow ( rvGEWindowWrapper::WT_NORMAL ); @@ -737,38 +737,38 @@ int rvGEApp::HandleCommand ( WPARAM wParam, LPARAM lParam ) assert ( workspace ); workspace->AddWindow ( rvGEWindowWrapper::WT_RENDER ); break; - + case ID_GUIED_WINDOW_TILE: SendMessage ( mMDIClient, WM_MDITILE, 0, 0 ); - break; + break; case ID_GUIED_WINDOW_CASCADE: SendMessage ( mMDIClient, WM_MDICASCADE, 0, 0 ); - break; + break; case ID_GUIED_VIEW_STATUSBAR: { RECT rWindow; - + mStatusBar.Show ( mOptions.GetStatusBarVisible()?false:true ); - + GetWindowRect ( mMDIFrame, &rWindow ); - SendMessage ( mMDIFrame, WM_SIZE, 0, MAKELONG ( rWindow.right-rWindow.left, rWindow.bottom-rWindow.top ) ); + SendMessage ( mMDIFrame, WM_SIZE, 0, MAKELONG ( rWindow.right-rWindow.left, rWindow.bottom-rWindow.top ) ); break; } case ID_GUIED_WINDOW_SHOWNAVIGATOR: mNavigator.Show ( mOptions.GetNavigatorVisible()?false:true ); - break; - + break; + case ID_GUIED_WINDOW_SHOWPROPERTIES: mProperties.Show ( mOptions.GetPropertiesVisible()?false:true ); break; - + case ID_GUIED_WINDOW_SHOWTRANSFORMER: mTransformer.Show ( mOptions.GetTransformerVisible()?false:true ); - break; - + break; + case ID_GUIED_EDIT_DELETE: assert ( workspace ); workspace->DeleteSelected ( ); @@ -783,12 +783,12 @@ int rvGEApp::HandleCommand ( WPARAM wParam, LPARAM lParam ) assert ( workspace ); workspace->UnhideSelected ( ); break; - + case ID_GUIED_VIEW_SHOWHIDDEN: assert ( workspace ); workspace->ShowHidden ( ); break; - + case ID_GUIED_EDIT_UNDO: assert ( workspace ); workspace->GetModifierStack().Undo ( ); @@ -802,29 +802,29 @@ int rvGEApp::HandleCommand ( WPARAM wParam, LPARAM lParam ) mNavigator.Update ( ); mTransformer.Update ( ); break; - + case ID_GUIED_VIEW_OPTIONS: GEOptionsDlg_DoModal ( mMDIFrame ); break; - + case ID_GUIED_VIEW_SHOWGRID: - mOptions.SetGridVisible ( mOptions.GetGridVisible()?false:true ); + mOptions.SetGridVisible ( mOptions.GetGridVisible()?false:true ); break; case ID_GUIED_VIEW_SNAPTOGRID: - mOptions.SetGridSnap ( mOptions.GetGridSnap ()?false:true ); + mOptions.SetGridSnap ( mOptions.GetGridSnap ()?false:true ); break; - + case ID_GUIED_VIEW_ZOOMIN: assert ( workspace ); workspace->ZoomIn ( ); break; - + case ID_GUIED_VIEW_ZOOMOUT: assert ( workspace ); workspace->ZoomOut ( ); break; - + case ID_GUIED_FILE_EXIT: DestroyWindow ( mMDIFrame ); break; @@ -836,7 +836,7 @@ int rvGEApp::HandleCommand ( WPARAM wParam, LPARAM lParam ) SendMessage ( active, WM_CLOSE, 0, 0 ); } break; - + case ID_GUIED_FILE_NEW: NewFile ( ); break; @@ -849,8 +849,8 @@ int rvGEApp::HandleCommand ( WPARAM wParam, LPARAM lParam ) case ID_GUIED_FILE_SAVEAS: assert ( workspace ); HandleCommandSave ( workspace, NULL ); - break; - + break; + case ID_GUIED_FILE_OPEN: { OPENFILENAME ofn; @@ -869,15 +869,15 @@ int rvGEApp::HandleCommand ( WPARAM wParam, LPARAM lParam ) ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; - // Display the Open dialog box. - if (GetOpenFileName(&ofn)==TRUE) - { + // Display the Open dialog box. + if (GetOpenFileName(&ofn)==TRUE) + { OpenFile ( ofn.lpstrFile ); } break; - } + } } - + return -1; } @@ -888,25 +888,25 @@ rvGEApp::HandleInitMenu Handles the initialization of the main menu ================ */ -int rvGEApp::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) -{ - int cMenuItems = GetMenuItemCount((HMENU)wParam); - int nPos; - int id; - UINT flags; - rvGEWorkspace* workspace; - HMENU hmenu; - +int rvGEApp::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) +{ + int cMenuItems = GetMenuItemCount((HMENU)wParam); + int nPos; + int id; + UINT flags; + rvGEWorkspace* workspace; + HMENU hmenu; + hmenu = (HMENU) wParam; workspace = GetActiveWorkspace ( ); // Run through all the menu items in the menu and see if any of them need // modification in any way - for (nPos = 0; nPos < cMenuItems; nPos++) - { - id = GetMenuItemID(hmenu, nPos); - flags = 0; - + for (nPos = 0; nPos < cMenuItems; nPos++) + { + id = GetMenuItemID(hmenu, nPos); + flags = 0; + // Handle popup menus too if ( id < 0 ) { @@ -917,31 +917,31 @@ int rvGEApp::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) continue; } } - + // Menu items that are completely unrelated to the workspace switch ( id ) { case ID_GUIED_VIEW_STATUSBAR: flags = MF_BYCOMMAND | (mOptions.GetStatusBarVisible()?MF_CHECKED:MF_UNCHECKED); CheckMenuItem ( hmenu, id, flags ); - break; + break; case ID_GUIED_WINDOW_SHOWNAVIGATOR: flags = MF_BYCOMMAND | (mOptions.GetNavigatorVisible()?MF_CHECKED:MF_UNCHECKED); CheckMenuItem ( hmenu, id, flags ); - break; - + break; + case ID_GUIED_WINDOW_SHOWPROPERTIES: flags = MF_BYCOMMAND | (mOptions.GetPropertiesVisible()?MF_CHECKED:MF_UNCHECKED); CheckMenuItem ( hmenu, id, flags ); - break; + break; case ID_GUIED_WINDOW_SHOWTRANSFORMER: flags = MF_BYCOMMAND | (mOptions.GetTransformerVisible()?MF_CHECKED:MF_UNCHECKED); CheckMenuItem ( hmenu, id, flags ); - break; + break; } - + // Handle the basic case where an item is disabled because // there is no workspace available if ( !workspace ) @@ -980,7 +980,7 @@ int rvGEApp::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) case ID_GUIED_FILE_SAVE: case ID_GUIED_FILE_SAVEAS: case ID_GUIED_EDIT_COPY: - case ID_GUIED_EDIT_PASTE: + case ID_GUIED_EDIT_PASTE: case ID_GUIED_ITEM_ARRANGEMAKECHILD: case ID_GUIED_SOURCECONTROL_GETLATESTVERSION: case ID_GUIED_SOURCECONTROL_CHECKIN: @@ -994,8 +994,8 @@ int rvGEApp::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) continue; } - switch (id) - { + switch (id) + { // Undo is greyed out when there is noting to undo and the text is // modified to include the name of the modifier that will be undone case ID_GUIED_EDIT_UNDO: @@ -1006,9 +1006,9 @@ int rvGEApp::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) info.cbSize = sizeof(info); info.fMask = MIIM_STATE|MIIM_TYPE; info.fType = MFT_STRING; - + if ( !workspace->GetModifierStack().CanUndo ( ) ) - { + { undo = "Undo\tCtrl+Z"; info.fState = MFS_GRAYED; } @@ -1022,7 +1022,7 @@ int rvGEApp::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) info.dwTypeData = (LPSTR)undo.c_str(); info.cch = undo.Length ( ); - + SetMenuItemInfo ( hmenu, id, FALSE, &info ); break; @@ -1036,9 +1036,9 @@ int rvGEApp::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) info.cbSize = sizeof(info); info.fMask = MIIM_STATE|MIIM_TYPE; info.fType = MFT_STRING; - + if ( !workspace || !workspace->GetModifierStack().CanRedo ( ) ) - { + { undo = "Redo\tCtrl+Y"; info.fState = MFS_GRAYED; } @@ -1052,22 +1052,22 @@ int rvGEApp::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) info.dwTypeData = (LPSTR)undo.c_str(); info.cch = undo.Length ( ); - + SetMenuItemInfo ( hmenu, id, FALSE, &info ); break; } - + case ID_GUIED_VIEW_SHOWGRID: flags = MF_BYCOMMAND | (mOptions.GetGridVisible()?MF_CHECKED:MF_UNCHECKED); CheckMenuItem ( hmenu, id, flags ); - break; + break; case ID_GUIED_VIEW_SNAPTOGRID: flags = MF_BYCOMMAND | (mOptions.GetGridSnap()?MF_CHECKED:MF_UNCHECKED); CheckMenuItem ( hmenu, id, flags ); - break; - + break; + // All menu items that are greyed out when there is no workspace case ID_GUIED_WINDOW_TILE: case ID_GUIED_WINDOW_CASCADE: @@ -1091,10 +1091,10 @@ int rvGEApp::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) break; // Enable paste if the clipboard has something in it - case ID_GUIED_EDIT_PASTE: + case ID_GUIED_EDIT_PASTE: EnableMenuItem ( hmenu, nPos, MF_BYPOSITION|(workspace->GetClipboard().Num()>0?MF_ENABLED:MF_GRAYED) ); break; - + // All menu items that are greyed out unless a single item is selected case ID_GUIED_ITEM_ARRANGEBRINGTOFRONT: case ID_GUIED_ITEM_ARRANGEBRINGFORWARD: @@ -1127,14 +1127,14 @@ int rvGEApp::HandleInitMenu ( WPARAM wParam, LPARAM lParam ) case ID_GUIED_SOURCECONTROL_CHECKOUT: EnableMenuItem ( hmenu, nPos, MF_BYPOSITION|((workspace->GetSourceControlState()==rvGEWorkspace::SCS_CHECKEDIN)?MF_ENABLED:MF_GRAYED) ); break; - + default: continue; - } + } } - + return 0; -} +} /* ================ @@ -1149,7 +1149,7 @@ bool rvGEApp::NewFile ( void ) if ( workspace->NewFile ( ) ) { HWND child; - + child = CreateMDIWindow("QUAKE4_GUIEDITOR_CHILD_CLASS", "Untitled.gui", WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_HSCROLL|WS_VSCROLL|WS_MAXIMIZE, @@ -1160,7 +1160,7 @@ bool rvGEApp::NewFile ( void ) mMDIClient, mInstance, (LONG)workspace ); - + ShowWindow ( child, SW_SHOW ); } @@ -1200,7 +1200,7 @@ bool rvGEApp::OpenFile ( const char* filename ) if ( workspace->LoadFile ( filename, &error ) ) { HWND child; - + child = CreateMDIWindow("QUAKE4_GUIEDITOR_CHILD_CLASS", "Unamed.gui", WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_HSCROLL|WS_VSCROLL|WS_MAXIMIZE, @@ -1211,10 +1211,10 @@ bool rvGEApp::OpenFile ( const char* filename ) mMDIClient, mInstance, (LONG)workspace ); - + ShowWindow ( child, SW_SHOW ); - - mOptions.AddRecentFile ( filename ); + + mOptions.AddRecentFile ( filename ); UpdateRecentFiles ( ); result = true; @@ -1225,7 +1225,7 @@ bool rvGEApp::OpenFile ( const char* filename ) } SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_ARROW ) ) ); - + return result;; } @@ -1244,7 +1244,7 @@ bool rvGEApp::InitRecentFiles ( void ) mRecentFileMenu = GetSubMenu ( GetMenu(mMDIFrame), 0 ); count = GetMenuItemCount ( mRecentFileMenu ); - + for ( i = 0; i < count; i ++ ) { if ( GetMenuItemID ( mRecentFileMenu, i ) == ID_GUIED_FILE_MRU ) @@ -1254,7 +1254,7 @@ bool rvGEApp::InitRecentFiles ( void ) return true; } } - + return false; } @@ -1271,8 +1271,8 @@ void rvGEApp::UpdateRecentFiles ( void ) int j; // Make sure everything is initialized - if ( !mRecentFileMenu ) - { + if ( !mRecentFileMenu ) + { InitRecentFiles ( ); } @@ -1280,7 +1280,7 @@ void rvGEApp::UpdateRecentFiles ( void ) for ( i = 0; i < rvGEOptions::MAX_MRU_SIZE; i ++ ) { DeleteMenu ( mRecentFileMenu, ID_GUIED_FILE_MRU1 + i, MF_BYCOMMAND ); - } + } // Make sure there is a separator after the recent files if ( mOptions.GetRecentFileCount() ) @@ -1303,7 +1303,7 @@ void rvGEApp::UpdateRecentFiles ( void ) idStr str = va("&%d ", j+1); str.Append ( mOptions.GetRecentFile ( i ) ); InsertMenu ( mRecentFileMenu, mRecentFileInsertPos+j+1, MF_BYPOSITION|MF_STRING|MF_ENABLED, id, str ); - } + } } /* @@ -1319,7 +1319,7 @@ void rvGEApp::CloseViewer ( void ) { return; } - + mViewer->Destroy ( ); delete mViewer; mViewer = NULL; @@ -1337,20 +1337,20 @@ int rvGEApp::ToolWindowActivate ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa bool keepActive; bool syncOthers; int i; - + keepActive = ( wParam != 0 ); syncOthers = true; - + for ( i = 0; i < mToolWindows.Num (); i ++ ) { - if ( (HWND)lParam == mToolWindows[i] ) + if ( (HWND)lParam == mToolWindows[i] ) { keepActive = true; syncOthers = false; break; } } - + if ( lParam == -1 ) { return DefWindowProc ( hwnd, WM_NCACTIVATE, keepActive, 0 ); @@ -1366,7 +1366,7 @@ int rvGEApp::ToolWindowActivate ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa } } } - + return DefWindowProc ( hwnd, WM_NCACTIVATE, keepActive, lParam ); } @@ -1374,11 +1374,10 @@ int rvGEApp::ToolWindowActivate ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa ================ rvGEApp::MessageBox -Displays a modal message box +Displays a modal message box ================ */ int rvGEApp::MessageBox ( const char* text, int flags ) { return ::MessageBox ( mMDIFrame, text, "Quake 4 GUI Editor", flags ); } - diff --git a/neo/tools/guied/GEApp.h b/neo/tools/guied/GEApp.h index 901a9caa..fe6bf916 100644 --- a/neo/tools/guied/GEApp.h +++ b/neo/tools/guied/GEApp.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"). @@ -92,19 +92,19 @@ public: HWND GetMDIFrame ( void ); HWND GetMDIClient ( void ); rvGEStatusBar& GetStatusBar ( void ); - + bool OpenFile ( const char* filename ); bool SaveFile ( const char* filename ); bool NewFile ( void ); - - bool IsActive ( void ); + + bool IsActive ( void ); void CloseViewer ( void ); int ToolWindowActivate ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); int MessageBox ( const char* text, int flags ); - + protected: int HandleCommand ( WPARAM wParam, LPARAM lParam ); @@ -117,19 +117,19 @@ protected: HWND mMDIFrame; HWND mMDIClient; - HINSTANCE mInstance; + HINSTANCE mInstance; rvGEOptions mOptions; HACCEL mAccelerators; rvGENavigator mNavigator; rvGETransformer mTransformer; rvGEStatusBar mStatusBar; rvGEProperties mProperties; - + HMENU mRecentFileMenu; - int mRecentFileInsertPos; - + int mRecentFileInsertPos; + rvGEViewer* mViewer; - + idList mWorkspaces; idList mToolWindows; diff --git a/neo/tools/guied/GECheckInDlg.cpp b/neo/tools/guied/GECheckInDlg.cpp index 856ac029..6b53efe0 100644 --- a/neo/tools/guied/GECheckInDlg.cpp +++ b/neo/tools/guied/GECheckInDlg.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"). @@ -37,7 +37,7 @@ typedef struct { const char* mFilename; idStr* mComment; - + } GECHECKINDLG; /* @@ -50,16 +50,16 @@ Dialog procedure for the check in dialog static INT_PTR CALLBACK GECheckInDlg_GeneralProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { GECHECKINDLG* dlg = (GECHECKINDLG*) GetWindowLong ( hwnd, GWL_USERDATA ); - + switch ( msg ) { - case WM_INITDIALOG: + case WM_INITDIALOG: SetWindowLong ( hwnd, GWL_USERDATA, lParam ); dlg = (GECHECKINDLG*) lParam; - + SetWindowText ( GetDlgItem ( hwnd, IDC_GUIED_FILENAME ), dlg->mFilename ); break; - + case WM_COMMAND: switch ( LOWORD ( wParam ) ) { @@ -67,26 +67,26 @@ static INT_PTR CALLBACK GECheckInDlg_GeneralProc ( HWND hwnd, UINT msg, WPARAM w { char* temp; int tempsize; - + tempsize = GetWindowTextLength ( GetDlgItem ( hwnd, IDC_GUIED_COMMENT ) ); temp = new char [ tempsize + 2 ]; GetWindowText ( GetDlgItem ( hwnd, IDC_GUIED_COMMENT ), temp, tempsize + 1 ); - + *dlg->mComment = temp; - + delete[] temp; - + EndDialog ( hwnd, 1 ); break; } - + case IDCANCEL: EndDialog ( hwnd, 0 ); break; } break; } - + return FALSE; } @@ -100,15 +100,14 @@ Starts the check in dialog bool GECheckInDlg_DoModal ( HWND parent, const char* filename, idStr* comment ) { GECHECKINDLG dlg; - + dlg.mComment = comment; dlg.mFilename = filename; - + if ( !DialogBoxParam ( gApp.GetInstance(), MAKEINTRESOURCE(IDD_GUIED_CHECKIN), parent, GECheckInDlg_GeneralProc, (LPARAM) &dlg ) ) { return false; } - + return true; } - diff --git a/neo/tools/guied/GEDeleteModifier.cpp b/neo/tools/guied/GEDeleteModifier.cpp index eeb42390..95c9dc3e 100644 --- a/neo/tools/guied/GEDeleteModifier.cpp +++ b/neo/tools/guied/GEDeleteModifier.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,7 +47,7 @@ Apply the delete modifier by setting the deleted flag in the wrapper bool rvGEDeleteModifier::Apply ( void ) { mWrapper->SetDeleted ( true ); - + return true; } @@ -61,7 +61,6 @@ Undo the delete modifier by unsetting the deleted flag in the wrapper bool rvGEDeleteModifier::Undo ( void ) { mWrapper->SetDeleted ( false ); - + return true; } - diff --git a/neo/tools/guied/GEDeleteModifier.h b/neo/tools/guied/GEDeleteModifier.h index e29b526c..784e7e7c 100644 --- a/neo/tools/guied/GEDeleteModifier.h +++ b/neo/tools/guied/GEDeleteModifier.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 @@ class rvGEDeleteModifier : public rvGEModifier public: rvGEDeleteModifier ( const char* name, idWindow* window ); - + virtual bool Apply ( void ); virtual bool Undo ( void ); }; diff --git a/neo/tools/guied/GEHideModifier.cpp b/neo/tools/guied/GEHideModifier.cpp index 4d749894..a51ce92c 100644 --- a/neo/tools/guied/GEHideModifier.cpp +++ b/neo/tools/guied/GEHideModifier.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"). @@ -69,7 +69,7 @@ bool rvGEHideModifier::Apply ( void ) { rvGEWindowWrapper::GetWrapper ( mParent )->SetHidden ( mHide ); } - + return true; } @@ -88,7 +88,6 @@ bool rvGEHideModifier::Undo ( void ) { rvGEWindowWrapper::GetWrapper ( mParent )->SetHidden ( mUndoHide ); } - + return true; } - diff --git a/neo/tools/guied/GEHideModifier.h b/neo/tools/guied/GEHideModifier.h index 522429b1..cc855ebf 100644 --- a/neo/tools/guied/GEHideModifier.h +++ b/neo/tools/guied/GEHideModifier.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 @@ class rvGEHideModifier : public rvGEModifier public: rvGEHideModifier ( const char* name, idWindow* window, bool hide ); - + virtual bool Apply ( void ); virtual bool Undo ( void ); diff --git a/neo/tools/guied/GEInsertModifier.cpp b/neo/tools/guied/GEInsertModifier.cpp index 1a776dd6..73d8851e 100644 --- a/neo/tools/guied/GEInsertModifier.cpp +++ b/neo/tools/guied/GEInsertModifier.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"). @@ -41,29 +41,29 @@ rvGEInsertModifier::rvGEInsertModifier ( const char* name, idWindow* window, idW assert ( mParent ); mUndoParent = window->GetParent ( ); - mUndoBefore = NULL; + mUndoBefore = NULL; mUndoRect = mWrapper->GetClientRect ( ); mRect = mWrapper->GetClientRect ( ); - + // Find the child window the window being inserted is before if ( mUndoParent ) { int index; rvGEWindowWrapper* pwrapper; - + pwrapper = rvGEWindowWrapper::GetWrapper ( mUndoParent ); - + index = mUndoParent->GetChildIndex ( mWindow ); - + if ( index + 1 < pwrapper->GetChildCount ( ) ) { mUndoBefore = pwrapper->GetChild ( index + 1 ); } - } + } // Since rectangles are relative to the parent rectangle we need to figure - // out the new x and y coordinate as if this window were a child - rvGEWindowWrapper* parentWrapper; + // out the new x and y coordinate as if this window were a child + rvGEWindowWrapper* parentWrapper; parentWrapper = rvGEWindowWrapper::GetWrapper ( mParent ); mRect.x = mWrapper->GetScreenRect( )[0] - parentWrapper->GetScreenRect()[0]; mRect.y = mWrapper->GetScreenRect( )[1] - parentWrapper->GetScreenRect()[1]; @@ -83,10 +83,10 @@ bool rvGEInsertModifier::Apply ( void ) { mUndoParent->RemoveChild ( mWindow ); } - + mParent->InsertChild ( mWindow, mBefore ); mWrapper->SetRect ( mRect ); - + return true; } @@ -101,13 +101,12 @@ added to and re-inserting it back into its original parent bool rvGEInsertModifier::Undo ( void ) { mParent->RemoveChild ( mWindow ); - + if ( mUndoParent ) { mUndoParent->InsertChild ( mWindow, mUndoBefore ); mWrapper->SetRect ( mUndoRect ); } - + return true; } - diff --git a/neo/tools/guied/GEInsertModifier.h b/neo/tools/guied/GEInsertModifier.h index 2e7137ec..affd5361 100644 --- a/neo/tools/guied/GEInsertModifier.h +++ b/neo/tools/guied/GEInsertModifier.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,14 +37,14 @@ class rvGEInsertModifier : public rvGEModifier public: rvGEInsertModifier ( const char* name, idWindow* window, idWindow* parent, idWindow* before ); - + virtual bool Apply ( void ); virtual bool Undo ( void ); protected: idWindow* mUndoParent; - idWindow* mUndoBefore; + idWindow* mUndoBefore; idWindow* mParent; idWindow* mBefore; idRectangle mRect; diff --git a/neo/tools/guied/GEItemPropsDlg.cpp b/neo/tools/guied/GEItemPropsDlg.cpp index ef5b0736..cde38c88 100644 --- a/neo/tools/guied/GEItemPropsDlg.cpp +++ b/neo/tools/guied/GEItemPropsDlg.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"). @@ -38,21 +38,21 @@ If you have questions concerning this license or the applicable additional terms #include "GEPropertyPage.h" enum -{ +{ RVITEMPROPS_GENERAL = 0, RVITEMPROPS_IMAGE, RVITEMPROPS_TEXT, RVITEMPROPS_KEYS, - - RVITEMPROPS_MAX -}; -class rvGEItemPropsImagePage : public rvGEPropertyPage + RVITEMPROPS_MAX +}; + +class rvGEItemPropsImagePage : public rvGEPropertyPage { public: rvGEItemPropsImagePage ( idDict* dictValues ); - + virtual bool Init ( void ); virtual bool SetActive ( void ); virtual bool KillActive ( void ); @@ -63,7 +63,7 @@ protected: void UpdateCheckedStates ( void ); idDict* mDict; -}; +}; rvGEItemPropsImagePage::rvGEItemPropsImagePage ( idDict* dict ) { @@ -82,7 +82,7 @@ bool rvGEItemPropsImagePage::Init ( void ) NumberEdit_Attach ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATSCALEX ) ); NumberEdit_Attach ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATSCALEY ) ); NumberEdit_Attach ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERSIZE ) ); - + return true; } @@ -102,12 +102,12 @@ void rvGEItemPropsImagePage::UpdateCheckedStates ( void ) bool enable; enable = !IsExpression ( mDict->GetString ( "backcolor", "1,1,1,1" ) ); - EnableWindow ( GetDlgItem ( mPage, IDC_GUIED_USEBACKCOLOR ), enable ); + EnableWindow ( GetDlgItem ( mPage, IDC_GUIED_USEBACKCOLOR ), enable ); state = IsDlgButtonChecked ( mPage, IDC_GUIED_USEBACKCOLOR ) && IsWindowEnabled ( GetDlgItem ( mPage, IDC_GUIED_USEBACKCOLOR ) ); EnableWindow ( GetDlgItem ( mPage, IDC_GUIED_ITEMBACKCOLOR ), state ); EnableWindow ( GetDlgItem ( mPage, IDC_GUIED_ITEMBACKCOLORALPHA ), state ); - + state = IsDlgButtonChecked ( mPage, IDC_GUIED_USEMATERIAL) != 0; EnableWindow ( GetDlgItem ( mPage, IDC_GUIED_ITEMBACKGROUND ), state ); EnableWindow ( GetDlgItem ( mPage, IDC_GUIED_ITEMVARIABLEBACKGROUND ), state ); @@ -119,7 +119,7 @@ void rvGEItemPropsImagePage::UpdateCheckedStates ( void ) GetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERSIZE ), temp, 64 ); enable = !IsExpression ( mDict->GetString ( "bordersize", "0" ) ); EnableWindow ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERSIZE ), enable ); - + state = atol( temp ) ? true : false; rstate = IsDlgButtonChecked ( mPage, IDC_GUIED_USEBORDERCOLOR ) != 0; enable = !IsExpression ( mDict->GetString ( "bordercolor", "1,1,1,1" ) ); @@ -131,7 +131,7 @@ void rvGEItemPropsImagePage::UpdateCheckedStates ( void ) state = (state && !rstate) || IsDlgButtonChecked ( mPage, IDC_GUIED_USEMATERIAL); enable = !IsExpression ( mDict->GetString ( "matcolor", "1,1,1,1" ) ); - EnableWindow ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATCOLORSTATIC ), state && enable ); + EnableWindow ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATCOLORSTATIC ), state && enable ); EnableWindow ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATCOLOR ), state && enable ); EnableWindow ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATCOLORALPHA ), state && enable ); } @@ -146,21 +146,21 @@ Handles messages for the text item properties page int rvGEItemPropsImagePage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lParam ) { switch ( msg ) - { + { case WM_DRAWITEM: - ColorButton_DrawItem ( GetDlgItem ( mPage, wParam ), (LPDRAWITEMSTRUCT)lParam ); + ColorButton_DrawItem ( GetDlgItem ( mPage, wParam ), (LPDRAWITEMSTRUCT)lParam ); return TRUE; - + case WM_COMMAND: switch ( LOWORD(wParam) ) - { + { case IDC_GUIED_ITEMBORDERSIZE: if ( HIWORD(wParam) == EN_CHANGE ) { UpdateCheckedStates ( ); } break; - + case IDC_GUIED_USEBORDERCOLOR: case IDC_GUIED_USEBORDERMATERIAL: case IDC_GUIED_USEBACKCOLOR: @@ -175,7 +175,7 @@ int rvGEItemPropsImagePage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lPar AlphaButton_OpenPopup ( GetDlgItem ( mPage, LOWORD(wParam) ) ); break; } - + case IDC_GUIED_ITEMBORDERCOLOR: case IDC_GUIED_ITEMBACKCOLOR: case IDC_GUIED_ITEMMATCOLOR: @@ -197,7 +197,7 @@ int rvGEItemPropsImagePage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lPar } break; } - + return rvGEPropertyPage::HandleMessage ( msg, wParam, lParam ); } @@ -212,22 +212,22 @@ window into the controls bool rvGEItemPropsImagePage::SetActive ( void ) { gApp.GetOptions().SetLastOptionsPage ( RVITEMPROPS_IMAGE ); - - ColorButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMBACKCOLOR ), mDict->GetString ( "backcolor", "1,1,1,1" ) ); - AlphaButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMBACKCOLORALPHA ), mDict->GetString ( "backcolor", "1,1,1,1" ) ); - ColorButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATCOLOR ), mDict->GetString ( "matcolor", "1,1,1,1" ) ); - AlphaButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATCOLORALPHA ), mDict->GetString ( "matcolor", "1,1,1,1" ) ); + ColorButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMBACKCOLOR ), mDict->GetString ( "backcolor", "1,1,1,1" ) ); + AlphaButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMBACKCOLORALPHA ), mDict->GetString ( "backcolor", "1,1,1,1" ) ); - ColorButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERCOLOR ), mDict->GetString ( "bordercolor", "0,0,0,1" ) ); - AlphaButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERCOLORALPHA ), mDict->GetString ( "bordercolor", "0,0,0,1" ) ); - - SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMBACKGROUND ), idStr(mDict->GetString ( "background", "" )).StripQuotes ( ) ); - SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERMATERIAL ), idStr(mDict->GetString ( "borderShader", "" )).StripQuotes ( ) ); - SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERSIZE ), idStr(mDict->GetString ( "bordersize", "0" )).StripQuotes ( ) ); + ColorButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATCOLOR ), mDict->GetString ( "matcolor", "1,1,1,1" ) ); + AlphaButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATCOLORALPHA ), mDict->GetString ( "matcolor", "1,1,1,1" ) ); - SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATSCALEX ), idStr(mDict->GetString ( "matscalex", "1" )).StripQuotes ( ) ); - SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATSCALEY ), idStr(mDict->GetString ( "matscaley", "1" )).StripQuotes ( ) ); + ColorButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERCOLOR ), mDict->GetString ( "bordercolor", "0,0,0,1" ) ); + AlphaButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERCOLORALPHA ), mDict->GetString ( "bordercolor", "0,0,0,1" ) ); + + SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMBACKGROUND ), idStr(mDict->GetString ( "background", "" )).StripQuotes ( ) ); + SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERMATERIAL ), idStr(mDict->GetString ( "borderShader", "" )).StripQuotes ( ) ); + SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERSIZE ), idStr(mDict->GetString ( "bordersize", "0" )).StripQuotes ( ) ); + + SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATSCALEX ), idStr(mDict->GetString ( "matscalex", "1" )).StripQuotes ( ) ); + SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATSCALEY ), idStr(mDict->GetString ( "matscaley", "1" )).StripQuotes ( ) ); CheckDlgButton ( mPage, IDC_GUIED_ITEMVARIABLEBACKGROUND, mDict->GetBool ( "variablebackground", "0" ) ); @@ -254,11 +254,11 @@ bool rvGEItemPropsImagePage::KillActive ( void ) char temp[1024]; bool matcolor = false; idStr s; - + if ( IsDlgButtonChecked ( mPage, IDC_GUIED_USEMATERIAL ) ) { float val; - + GetWindowText ( GetDlgItem(mPage,IDC_GUIED_ITEMBACKGROUND), temp, 1024 ); s = "\""; s.Append(temp); @@ -287,7 +287,7 @@ bool rvGEItemPropsImagePage::KillActive ( void ) { mDict->Set ( "matscaley", idStr::FloatArrayToString( &val, 1, 8 ) ); } - + if ( IsDlgButtonChecked ( mPage, IDC_GUIED_ITEMVARIABLEBACKGROUND ) ) { mDict->Set ( "variablebackground", "1" ); @@ -311,7 +311,7 @@ bool rvGEItemPropsImagePage::KillActive ( void ) { COLORREF color = ColorButton_GetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMBACKCOLOR ) ); COLORREF alpha = ColorButton_GetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMBACKCOLORALPHA ) ); - mDict->Set ( "backcolor", StringFromVec4 ( idVec4((float)GetRValue ( color ) / 255.0f, (float)GetGValue ( color ) / 255.0f, (float)GetBValue ( color ) / 255.0f, (float)GetRValue(alpha )/255.0f ) ) ); + mDict->Set ( "backcolor", StringFromVec4 ( idVec4((float)GetRValue ( color ) / 255.0f, (float)GetGValue ( color ) / 255.0f, (float)GetBValue ( color ) / 255.0f, (float)GetRValue(alpha )/255.0f ) ) ); } } else @@ -322,18 +322,18 @@ bool rvGEItemPropsImagePage::KillActive ( void ) GetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERSIZE ), temp, 1024 ); if ( atoi ( temp ) ) { - if ( IsWindowEnabled ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERSIZE) ) ) + if ( IsWindowEnabled ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERSIZE) ) ) { mDict->Set ( "bordersize", va("%d", atoi(temp) ) ); } if ( IsDlgButtonChecked ( mPage, IDC_GUIED_USEBORDERCOLOR ) ) { - if ( IsWindowEnabled ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERCOLOR ) ) ) + if ( IsWindowEnabled ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERCOLOR ) ) ) { COLORREF color = ColorButton_GetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERCOLOR ) ); COLORREF alpha = ColorButton_GetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMBORDERCOLORALPHA ) ); - mDict->Set ( "bordercolor", StringFromVec4 ( idVec4((float)GetRValue ( color ) / 255.0f, (float)GetGValue ( color ) / 255.0f, (float)GetBValue ( color ) / 255.0f, (float)GetRValue(alpha )/255.0f ) ) ); + mDict->Set ( "bordercolor", StringFromVec4 ( idVec4((float)GetRValue ( color ) / 255.0f, (float)GetGValue ( color ) / 255.0f, (float)GetBValue ( color ) / 255.0f, (float)GetRValue(alpha )/255.0f ) ) ); } mDict->Delete ( "borderShader" ); } @@ -361,23 +361,23 @@ bool rvGEItemPropsImagePage::KillActive ( void ) { COLORREF color = ColorButton_GetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATCOLOR ) ); COLORREF alpha = ColorButton_GetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMMATCOLORALPHA ) ); - mDict->Set ( "matcolor", StringFromVec4 ( idVec4((float)GetRValue ( color ) / 255.0f, (float)GetGValue ( color ) / 255.0f, (float)GetBValue ( color ) / 255.0f, (float)GetRValue(alpha )/255.0f ) ) ); + mDict->Set ( "matcolor", StringFromVec4 ( idVec4((float)GetRValue ( color ) / 255.0f, (float)GetGValue ( color ) / 255.0f, (float)GetBValue ( color ) / 255.0f, (float)GetRValue(alpha )/255.0f ) ) ); } } else { mDict->Delete ( "matcolor" ); } - + return true; } -class rvGEItemPropsTextPage : public rvGEPropertyPage +class rvGEItemPropsTextPage : public rvGEPropertyPage { public: rvGEItemPropsTextPage ( idDict* dictValues ); - + virtual bool Init ( void ); virtual bool SetActive ( void ); virtual bool KillActive ( void ); @@ -386,9 +386,9 @@ public: protected: void UpdateCheckedStates ( void ); - + idDict* mDict; -}; +}; rvGEItemPropsTextPage::rvGEItemPropsTextPage ( idDict* dict ) { @@ -413,17 +413,17 @@ bool rvGEItemPropsTextPage::Init ( void ) SendMessage ( GetDlgItem ( mPage, IDC_GUIED_ITEMTEXTALIGN ), CB_ADDSTRING, 0, (LPARAM)"Right" ); SendMessage ( GetDlgItem ( mPage, IDC_GUIED_ITEMTEXTFONT ), CB_ADDSTRING, 0, (LONG)"" ); - + idFileList *folders; int i; - + folders = fileSystem->ListFiles( "fonts", "/" ); - + for ( i = 0; i < folders->GetNumFiles(); i++ ) { if ( folders->GetFile(i)[0] == '.' ) { continue; } - + SendMessage ( GetDlgItem ( mPage, IDC_GUIED_ITEMTEXTFONT ), CB_ADDSTRING, 0, (LONG)folders->GetFile(i) ); } @@ -478,17 +478,17 @@ Handles messages for the text item properties page int rvGEItemPropsTextPage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lParam ) { switch ( msg ) - { + { case WM_DRAWITEM: - ColorButton_DrawItem ( GetDlgItem ( mPage, wParam ), (LPDRAWITEMSTRUCT)lParam ); + ColorButton_DrawItem ( GetDlgItem ( mPage, wParam ), (LPDRAWITEMSTRUCT)lParam ); return TRUE; - + case WM_COMMAND: switch ( LOWORD(wParam) ) - { + { case IDC_GUIED_ITEMTEXTFONT: break; - + case IDC_GUIED_USETEXT: UpdateCheckedStates ( ); break; @@ -496,7 +496,7 @@ int rvGEItemPropsTextPage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lPara case IDC_GUIED_ITEMFORECOLORALPHA: AlphaButton_OpenPopup ( GetDlgItem ( mPage, LOWORD(wParam) ) ); break; - + case IDC_GUIED_ITEMFORECOLOR: { CHOOSECOLOR col; @@ -516,7 +516,7 @@ int rvGEItemPropsTextPage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lPara } break; } - + return rvGEPropertyPage::HandleMessage ( msg, wParam, lParam ); } @@ -532,10 +532,10 @@ bool rvGEItemPropsTextPage::SetActive ( void ) { gApp.GetOptions().SetLastOptionsPage ( RVITEMPROPS_TEXT ); - ColorButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMFORECOLOR ), mDict->GetString ( "forecolor", "1,1,1,1" ) ); - AlphaButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMFORECOLORALPHA ), mDict->GetString ( "forecolor", "1,1,1,1" ) ); + ColorButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMFORECOLOR ), mDict->GetString ( "forecolor", "1,1,1,1" ) ); + AlphaButton_SetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMFORECOLORALPHA ), mDict->GetString ( "forecolor", "1,1,1,1" ) ); - SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMTEXT ), idStr(mDict->GetString ( "text", "" )).StripQuotes ( ) ); + SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMTEXT ), idStr(mDict->GetString ( "text", "" )).StripQuotes ( ) ); SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMTEXTSCALE ), mDict->GetString ( "textscale", "1.0" ) ); SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMTEXTALIGNX ), mDict->GetString ( "textalignx", "0" ) ); SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMTEXTALIGNY ), mDict->GetString ( "textaligny", "0" ) ); @@ -572,14 +572,14 @@ bool rvGEItemPropsTextPage::KillActive ( void ) char temp[1024]; int i; float f; - + if ( IsDlgButtonChecked ( mPage, IDC_GUIED_USETEXT ) ) { if ( IsWindowEnabled ( GetDlgItem ( mPage, IDC_GUIED_ITEMFORECOLOR ) ) ) { COLORREF color = ColorButton_GetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMFORECOLOR ) ); COLORREF alpha = ColorButton_GetColor ( GetDlgItem ( mPage, IDC_GUIED_ITEMFORECOLORALPHA ) ); - mDict->Set ( "forecolor", StringFromVec4 ( idVec4((float)GetRValue ( color ) / 255.0f, (float)GetGValue ( color ) / 255.0f, (float)GetBValue ( color ) / 255.0f, (float)GetRValue(alpha )/255.0f ) ) ); + mDict->Set ( "forecolor", StringFromVec4 ( idVec4((float)GetRValue ( color ) / 255.0f, (float)GetGValue ( color ) / 255.0f, (float)GetBValue ( color ) / 255.0f, (float)GetRValue(alpha )/255.0f ) ) ); } GetWindowText ( GetDlgItem(mPage,IDC_GUIED_ITEMTEXT), temp, 1024 ); @@ -613,7 +613,7 @@ bool rvGEItemPropsTextPage::KillActive ( void ) { mDict->Delete ( "textalignx" ); } - + GetWindowText ( GetDlgItem(mPage,IDC_GUIED_ITEMTEXTALIGNY), temp, 1024 ); i = atoi(temp); if ( i ) @@ -624,7 +624,7 @@ bool rvGEItemPropsTextPage::KillActive ( void ) { mDict->Delete ( "textaligny" ); } - + int fontSel = SendMessage ( GetDlgItem ( mPage, IDC_GUIED_ITEMTEXTFONT ), CB_GETCURSEL, 0, 0 ); if ( fontSel == 0 ) { @@ -634,9 +634,9 @@ bool rvGEItemPropsTextPage::KillActive ( void ) { char fontName[MAX_PATH]; SendMessage ( GetDlgItem ( mPage, IDC_GUIED_ITEMTEXTFONT ), CB_GETLBTEXT, fontSel, (LONG)fontName ); - mDict->Set ( "font", idStr("\"fonts/") + idStr(fontName) + idStr("\"" ) ); + mDict->Set ( "font", idStr("\"fonts/") + idStr(fontName) + idStr("\"" ) ); } - + if ( IsDlgButtonChecked ( mPage, IDC_GUIED_ITEMTEXTNOWRAP ) ) { mDict->Set ( "nowrap", "1" ); @@ -660,12 +660,12 @@ bool rvGEItemPropsTextPage::KillActive ( void ) return true; } -class rvGEItemPropsKeysPage : public rvGEPropertyPage +class rvGEItemPropsKeysPage : public rvGEPropertyPage { public: rvGEItemPropsKeysPage ( idDict* dictValues, rvGEWindowWrapper* wrapper ); - + virtual bool Init ( void ); virtual bool SetActive ( void ); virtual int HandleMessage ( UINT msg, WPARAM wParam, LPARAM lParam ); @@ -674,8 +674,8 @@ protected: idDict* mDict; rvGEWindowWrapper* mWrapper; -}; - +}; + rvGEItemPropsKeysPage::rvGEItemPropsKeysPage ( idDict* dict, rvGEWindowWrapper* wrapper ) { mDict = dict; @@ -695,21 +695,21 @@ INT_PTR CALLBACK ModifyItemKeyDlg_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, { if ( !idStr::Icmp ( keyValue->GetKey(), "name" ) || !idStr::Icmp ( keyValue->GetKey(), "rect" ) ) { - // Dont allow editing the name keyname + // Dont allow editing the name keyname EnableWindow ( GetDlgItem ( hwnd, IDC_GUIED_ITEMKEY ), FALSE ); } SetWindowText ( GetDlgItem ( hwnd, IDC_GUIED_ITEMKEY ), keyValue->GetKey() ); SetFocus ( GetDlgItem ( hwnd, IDC_GUIED_ITEMVALUE ) ); - SendMessage( GetDlgItem ( hwnd, IDC_GUIED_ITEMVALUE ), EM_SETSEL, 0, -1 ); - + SendMessage( GetDlgItem ( hwnd, IDC_GUIED_ITEMVALUE ), EM_SETSEL, 0, -1 ); + SetWindowText ( hwnd, "New Item Key" ); } - + SetWindowLong ( hwnd, GWL_USERDATA, lParam ); return FALSE; } - + case WM_COMMAND: switch ( LOWORD(wParam) ) { @@ -717,15 +717,15 @@ INT_PTR CALLBACK ModifyItemKeyDlg_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, { char key[1024]; char value[1024]; - + const idKeyValue* keyValue = (const idKeyValue*) GetWindowLong ( hwnd, GWL_USERDATA ); - + GetWindowText ( GetDlgItem ( hwnd, IDC_GUIED_ITEMKEY ), key, 1024 ); GetWindowText ( GetDlgItem ( hwnd, IDC_GUIED_ITEMVALUE ), value, 1024 ); if ( strlen ( key ) < 1 ) { - gApp.MessageBox ( va("Invalid key name '%s'", key), MB_OK|MB_ICONERROR ); + gApp.MessageBox ( va("Invalid key name '%s'", key), MB_OK|MB_ICONERROR ); } else { @@ -737,7 +737,7 @@ INT_PTR CALLBACK ModifyItemKeyDlg_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, } break; } - + case IDCANCEL: EndDialog ( hwnd, 0 ); break; @@ -755,8 +755,8 @@ int rvGEItemPropsKeysPage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lPara case WM_NOTIFY: { NMHDR* nm = (NMHDR*) lParam; - - // There are a few protected keys that need to dissallow deleting so + + // There are a few protected keys that need to dissallow deleting so // check to see if the newly selected key is one of them and if so then // disable the delete button if ( nm->code == LVN_ITEMCHANGED ) @@ -779,7 +779,7 @@ int rvGEItemPropsKeysPage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lPara } break; } - + case WM_COMMAND: switch ( LOWORD(wParam) ) { @@ -788,13 +788,13 @@ int rvGEItemPropsKeysPage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lPara HWND list = GetDlgItem ( mPage, IDC_GUIED_ITEMKEYS ); mDict->Set( "guied_temp", "" ); const idKeyValue* key = mDict->FindKey ( "guied_temp" ); - + idStr old = key->GetValue(); while ( 1 ) - { + { if ( DialogBoxParam ( gApp.GetInstance (), MAKEINTRESOURCE(IDD_GUIED_ITEMKEY), mPage, ModifyItemKeyDlg_WndProc, (LPARAM)key ) ) { - idStr finalValue; + idStr finalValue; finalValue = key->GetValue(); if ( !mWrapper->VerfiyStateKey ( key->GetKey(), finalValue ) ) @@ -818,10 +818,10 @@ int rvGEItemPropsKeysPage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lPara item.pszText = (LPSTR)key->GetKey().c_str ( ); item.lParam = (LONG) key; int index = ListView_InsertItem ( list, &item ); - + finalValue.StripQuotes ( ); ListView_SetItemText ( list, index, 1, (LPSTR)finalValue.c_str ( ) ); - + break; } else @@ -850,8 +850,8 @@ int rvGEItemPropsKeysPage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lPara { if ( DialogBoxParam ( gApp.GetInstance (), MAKEINTRESOURCE(IDD_GUIED_ITEMKEY), mPage, ModifyItemKeyDlg_WndProc, (LPARAM)key ) ) { - idStr finalValue; - + idStr finalValue; + finalValue = key->GetValue(); if ( !mWrapper->VerfiyStateKey ( key->GetKey(), finalValue ) ) { @@ -872,14 +872,14 @@ int rvGEItemPropsKeysPage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lPara ListView_SetItemText ( list, index, 0, (LPSTR)key->GetKey().c_str() ); finalValue.StripQuotes ( ); - ListView_SetItemText ( list, index, 1, (LPSTR)finalValue.c_str() ); + ListView_SetItemText ( list, index, 1, (LPSTR)finalValue.c_str() ); break; } - } + } } break; } - + case IDC_GUIED_DELETEKEY: { HWND list = GetDlgItem ( mPage, IDC_GUIED_ITEMKEYS ); @@ -892,17 +892,17 @@ int rvGEItemPropsKeysPage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lPara ListView_GetItem ( list, &item ); const idKeyValue* key = (const idKeyValue*)item.lParam; assert ( key ); - + mDict->Delete ( key->GetKey() ); - + ListView_DeleteItem ( list, index ); - } + } break; } } - break; + break; } - + return rvGEPropertyPage::HandleMessage ( msg, wParam, lParam ); } @@ -939,7 +939,7 @@ bool rvGEItemPropsKeysPage::Init ( void ) col.pszText = "Value"; col.cx = (rWindow.right - rWindow.left) - col.cx; ListView_InsertColumn ( list, 1, &col ); - + return true; } @@ -968,9 +968,9 @@ bool rvGEItemPropsKeysPage::SetActive ( void ) // Add each key in the properties dictionary for ( i = 0; i < mDict->GetNumKeyVals(); i ++ ) { - const idKeyValue* key = mDict->GetKeyVal ( i ); - assert ( key ); - + const idKeyValue* key = mDict->GetKeyVal ( i ); + assert ( key ); + // Add the item LVITEM item; ZeroMemory ( &item, sizeof(item) ); @@ -979,27 +979,27 @@ bool rvGEItemPropsKeysPage::SetActive ( void ) item.pszText = (LPSTR)key->GetKey().c_str ( ); item.lParam = (LONG) key; int index = ListView_InsertItem ( list, &item ); - + idStr value; - value = key->GetValue(); + value = key->GetValue(); value.StripQuotes ( ); ListView_SetItemText ( list, index, 1, (LPSTR)value.c_str() ); - } + } return true; } - + class rvGEItemPropsGeneralPage : public rvGEPropertyPage { public: rvGEItemPropsGeneralPage ( idDict* dict, rvGEWindowWrapper::EWindowType type ); - + virtual bool SetActive ( void ); virtual bool KillActive ( void ); virtual bool Init ( void ); virtual int HandleMessage ( UINT msg, WPARAM wParam, LPARAM lParam ); - + protected: void UpdateCheckedStates ( void ); @@ -1034,9 +1034,9 @@ Handles messages for the general item properties page */ int rvGEItemPropsGeneralPage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lParam ) { -/* +/* switch ( msg ) - { + { case WM_COMMAND: switch ( LOWORD(wParam) ) { @@ -1044,7 +1044,7 @@ int rvGEItemPropsGeneralPage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lP break; } */ - + return rvGEPropertyPage::HandleMessage ( msg, wParam, lParam ); } @@ -1058,7 +1058,7 @@ Subclass the custom controls on the page bool rvGEItemPropsGeneralPage::Init ( void ) { MaskEdit_Attach ( GetDlgItem ( mPage, IDC_GUIED_ITEMNAME ), " \t\n\r" ); - + return true; } @@ -1074,10 +1074,10 @@ bool rvGEItemPropsGeneralPage::SetActive ( void ) { bool enable; idStr result; - + gApp.GetOptions().SetLastOptionsPage ( RVITEMPROPS_GENERAL ); - SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMNAME ), idStr(mDict->GetString ( "name", "unnamed" )).StripQuotes ( ) ); + SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_ITEMNAME ), idStr(mDict->GetString ( "name", "unnamed" )).StripQuotes ( ) ); enable = !IsExpression ( mDict->GetString ( "visible", "1" ) ); CheckDlgButton ( mPage, IDC_GUIED_ITEMVISIBLE, atol(idStr(mDict->GetString ( "visible", "1" )).StripQuotes ( ))?BST_CHECKED:BST_UNCHECKED ); @@ -1100,7 +1100,7 @@ bool rvGEItemPropsGeneralPage::SetActive ( void ) CheckDlgButton ( mPage, IDC_GUIED_ITEMNOCURSOR, atol(idStr(mDict->GetString ( "nocursor", "0" )).StripQuotes ( ))?BST_CHECKED:BST_UNCHECKED ); SetWindowText ( GetDlgItem ( mPage, IDC_GUIED_TYPE ), mType ); - + UpdateCheckedStates ( ); return true; @@ -1117,14 +1117,14 @@ Applys the settings currently stored in the property page back into the attached bool rvGEItemPropsGeneralPage::KillActive ( void ) { char temp[1024]; - - GetWindowText ( GetDlgItem(mPage,IDC_GUIED_ITEMNAME), temp, 1024 ); + + GetWindowText ( GetDlgItem(mPage,IDC_GUIED_ITEMNAME), temp, 1024 ); mDict->Set ( "name", temp ); if ( IsWindowEnabled ( GetDlgItem ( mPage, IDC_GUIED_ITEMVISIBLE ) ) ) { if ( IsDlgButtonChecked ( mPage, IDC_GUIED_ITEMVISIBLE ) ) - { + { mDict->Set ( "visible" , "1" ); } else @@ -1136,7 +1136,7 @@ bool rvGEItemPropsGeneralPage::KillActive ( void ) if ( IsWindowEnabled ( GetDlgItem ( mPage, IDC_GUIED_ITEMNOTIME ) ) ) { if ( IsDlgButtonChecked ( mPage, IDC_GUIED_ITEMNOTIME ) ) - { + { mDict->Set ( "notime" , "1" ); } else @@ -1144,11 +1144,11 @@ bool rvGEItemPropsGeneralPage::KillActive ( void ) mDict->Delete ( "notime" ); } } - + if ( IsWindowEnabled ( GetDlgItem ( mPage, IDC_GUIED_ITEMNOEVENTS ) ) ) { if ( IsDlgButtonChecked ( mPage, IDC_GUIED_ITEMNOEVENTS ) ) - { + { mDict->Set ( "noevents" , "1" ); } else @@ -1160,7 +1160,7 @@ bool rvGEItemPropsGeneralPage::KillActive ( void ) if ( IsWindowEnabled ( GetDlgItem ( mPage, IDC_GUIED_ITEMNOCLIP ) ) ) { if ( IsDlgButtonChecked ( mPage, IDC_GUIED_ITEMNOCLIP ) ) - { + { mDict->Set ( "noclip" , "1" ); } else @@ -1172,7 +1172,7 @@ bool rvGEItemPropsGeneralPage::KillActive ( void ) if ( IsWindowEnabled ( GetDlgItem ( mPage, IDC_GUIED_ITEMNOCURSOR ) ) ) { if ( IsDlgButtonChecked ( mPage, IDC_GUIED_ITEMNOCURSOR ) ) - { + { mDict->Set ( "nocursor" , "1" ); } else @@ -1197,14 +1197,14 @@ bool GEItemPropsDlg_DoModal ( HWND parent, idWindow* window, idDict& dict ) PROPSHEETPAGE propsp[4]; rvGEWindowWrapper* wrapper; bool result; - + wrapper = rvGEWindowWrapper::GetWrapper ( window ); assert ( wrapper ); - + // Start the destination dictionary with the values in the window dictionary dict.Clear ( ); dict.Copy ( wrapper->GetStateDict ( )); - + propsp[RVITEMPROPS_GENERAL].dwSize = sizeof(PROPSHEETPAGE); propsp[RVITEMPROPS_GENERAL].dwFlags = PSP_USETITLE; propsp[RVITEMPROPS_GENERAL].hInstance = win32.hInstance; @@ -1239,21 +1239,20 @@ bool GEItemPropsDlg_DoModal ( HWND parent, idWindow* window, idDict& dict ) propsh.dwSize = sizeof(PROPSHEETHEADER); propsh.nStartPage = gApp.GetOptions().GetLastOptionsPage ( ); - propsh.dwFlags = PSH_PROPSHEETPAGE|PSH_NOAPPLYNOW|PSH_NOCONTEXTHELP; - propsh.hwndParent = parent; + propsh.dwFlags = PSH_PROPSHEETPAGE|PSH_NOAPPLYNOW|PSH_NOCONTEXTHELP; + propsh.hwndParent = parent; propsh.pszCaption = "Item Properties"; propsh.nPages = RVITEMPROPS_MAX; propsh.ppsp = (LPCPROPSHEETPAGE)&propsp; - + // Bring up the item properties dialog now result = PropertySheet ( &propsh ) != NULL; - + // Cleanup delete (rvGEItemPropsGeneralPage*) propsp[0].lParam; delete (rvGEItemPropsImagePage*) propsp[1].lParam; delete (rvGEItemPropsTextPage*) propsp[2].lParam; delete (rvGEItemPropsKeysPage*) propsp[3].lParam; - + return result; } - \ No newline at end of file diff --git a/neo/tools/guied/GEItemPropsDlg.h b/neo/tools/guied/GEItemPropsDlg.h index b5cf7a33..0db47697 100644 --- a/neo/tools/guied/GEItemPropsDlg.h +++ b/neo/tools/guied/GEItemPropsDlg.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/neo/tools/guied/GEItemScriptsDlg.cpp b/neo/tools/guied/GEItemScriptsDlg.cpp index 8ec1b749..062e039d 100644 --- a/neo/tools/guied/GEItemScriptsDlg.cpp +++ b/neo/tools/guied/GEItemScriptsDlg.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"). @@ -37,7 +37,7 @@ If you have questions concerning this license or the applicable additional terms LRESULT CALLBACK GEScriptEdit_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { WNDPROC wndproc = (WNDPROC) GetWindowLong ( hwnd, GWL_USERDATA ); - + switch ( msg ) { case WM_CHAR: @@ -46,35 +46,35 @@ LRESULT CALLBACK GEScriptEdit_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPAR SendMessage ( GetParent ( hwnd ), WM_CLOSE, 0, 0 ); } break; - + case WM_GETDLGCODE: return DLGC_WANTALLKEYS; } - + return CallWindowProc ( wndproc, hwnd, msg, wParam, lParam ); -} +} bool GEItescriptsDlg_Init ( HWND hwnd ) { idWindow* window; rvGEWindowWrapper* wrapper; HWND script; - + // Extract the window pointer from the win32 windows user data long window = (idWindow*)GetWindowLong ( hwnd, GWL_USERDATA ); assert ( window ); - + // Get the window wrapper of the script window wrapper = rvGEWindowWrapper::GetWrapper ( window ); assert ( wrapper ); - + // Get the edit box used to edit the script script = GetDlgItem ( hwnd, IDC_GUIED_SCRIPT ); UINT tabsize = 16; SendMessage ( script, EM_SETTABSTOPS, 1, (LPARAM)&tabsize ); SetWindowLong ( script, GWL_USERDATA, GetWindowLong ( script, GWL_WNDPROC ) ); - SetWindowLong ( script, GWL_WNDPROC, (LONG) GEScriptEdit_WndProc ); + SetWindowLong ( script, GWL_WNDPROC, (LONG) GEScriptEdit_WndProc ); TEXTMETRIC tm; HDC dc; @@ -85,8 +85,8 @@ bool GEItescriptsDlg_Init ( HWND hwnd ) LOGFONT lf; ZeroMemory ( &lf, sizeof(lf) ); lf.lfHeight = tm.tmHeight; - strcpy ( lf.lfFaceName, "Courier New" ); - + strcpy ( lf.lfFaceName, "Courier New" ); + SendMessage ( script, WM_SETFONT, (WPARAM)CreateFontIndirect ( &lf ), 0 ); SendMessage ( script, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN, MAKELONG(10,10) ); @@ -96,39 +96,39 @@ bool GEItescriptsDlg_Init ( HWND hwnd ) for ( i = 0; i < wrapper->GetVariableDict().GetNumKeyVals ( ); i ++ ) { const idKeyValue* key = wrapper->GetVariableDict().GetKeyVal ( i ); - + SendMessage ( script, EM_SETSEL, -1, -1 ); - SendMessage ( script, EM_REPLACESEL, FALSE, (LPARAM)key->GetKey().c_str() ); + SendMessage ( script, EM_REPLACESEL, FALSE, (LPARAM)key->GetKey().c_str() ); SendMessage ( script, EM_SETSEL, -1, -1 ); - SendMessage ( script, EM_REPLACESEL, FALSE, (LPARAM)"\t" ); + SendMessage ( script, EM_REPLACESEL, FALSE, (LPARAM)"\t" ); SendMessage ( script, EM_SETSEL, -1, -1 ); - SendMessage ( script, EM_REPLACESEL, FALSE, (LPARAM)key->GetValue().c_str() ); + SendMessage ( script, EM_REPLACESEL, FALSE, (LPARAM)key->GetValue().c_str() ); SendMessage ( script, EM_SETSEL, -1, -1 ); - SendMessage ( script, EM_REPLACESEL, FALSE, (LPARAM)"\r\n" ); + SendMessage ( script, EM_REPLACESEL, FALSE, (LPARAM)"\r\n" ); } - + if ( i ) { SendMessage ( script, EM_SETSEL, -1, -1 ); - SendMessage ( script, EM_REPLACESEL, FALSE, (LPARAM)"\r\n" ); + SendMessage ( script, EM_REPLACESEL, FALSE, (LPARAM)"\r\n" ); } - + for ( i = 0; i < wrapper->GetScriptDict().GetNumKeyVals ( ); i ++ ) { const idKeyValue* key = wrapper->GetScriptDict().GetKeyVal ( i ); - + SendMessage ( script, EM_SETSEL, -1, -1 ); SendMessage ( script, EM_REPLACESEL, FALSE, (LPARAM)va("%s\r\n", key->GetKey().c_str() ) ); SendMessage ( script, EM_SETSEL, -1, -1 ); SendMessage ( script, EM_REPLACESEL, FALSE, (LPARAM)key->GetValue().c_str() ); SendMessage ( script, EM_SETSEL, -1, -1 ); - SendMessage ( script, EM_REPLACESEL, FALSE, (LPARAM)"\r\n\r\n" ); + SendMessage ( script, EM_REPLACESEL, FALSE, (LPARAM)"\r\n\r\n" ); } SendMessage ( script, EM_SETSEL, 0, 0 ); SendMessage ( script, EM_SCROLLCARET, 0, 0 ); - - return true; + + return true; } bool GEItescriptsDlg_Apply ( HWND hwnd ) @@ -136,15 +136,15 @@ bool GEItescriptsDlg_Apply ( HWND hwnd ) idWindow* window; rvGEWindowWrapper* wrapper; HWND script; - + // Extract the window pointer from the win32 windows user data long window = (idWindow*)GetWindowLong ( hwnd, GWL_USERDATA ); assert ( window ); - + // Get the window wrapper of the script window wrapper = rvGEWindowWrapper::GetWrapper ( window ); assert ( wrapper ); - + // Get the edit box used to edit the script script = GetDlgItem ( hwnd, IDC_GUIED_SCRIPT ); @@ -153,9 +153,9 @@ bool GEItescriptsDlg_Apply ( HWND hwnd ) textLen.flags = GTL_DEFAULT|GTL_USECRLF; textLen.codepage = CP_ACP; chars = SendMessage ( script, EM_GETTEXTLENGTHEX, (WPARAM)&textLen, 0 ); - + char* text = new char[chars+1]; - + GETTEXTEX getText; getText.cb = chars+1; getText.codepage = CP_ACP; @@ -163,11 +163,11 @@ bool GEItescriptsDlg_Apply ( HWND hwnd ) getText.lpDefaultChar = NULL; getText.lpUsedDefChar = NULL; SendMessage ( script, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM)text ); - + idStr parse = text; delete[] text; - - try + + try { idParser src ( parse, parse.Length(), "", LEXFL_ALLOWMULTICHARLITERALS | LEXFL_NOSTRINGCONCAT | LEXFL_ALLOWBACKSLASHSTRINGCONCAT ); idToken token; @@ -176,7 +176,7 @@ bool GEItescriptsDlg_Apply ( HWND hwnd ) wrapper->GetScriptDict().Clear ( ); while ( src.ReadToken ( &token ) ) - { + { idStr scriptName; idStr out; @@ -196,7 +196,7 @@ bool GEItescriptsDlg_Apply ( HWND hwnd ) idWindow tempwin ( &ui ); idStr out; int i; - + src.SetMarker ( ); for ( i = 0; i < 3; i ++ ) { @@ -204,9 +204,9 @@ bool GEItescriptsDlg_Apply ( HWND hwnd ) src.ExpectTokenString(","); } - tempwin.ParseExpression ( &src, &var ); + tempwin.ParseExpression ( &src, &var ); src.GetStringFromMarker ( out, true ); - + wrapper->GetVariableDict().Set ( token + "\t\"" + token2 + "\"", out ); continue; @@ -221,7 +221,7 @@ bool GEItescriptsDlg_Apply ( HWND hwnd ) src.Error ( "expected define name" ); return false; } - + idWinFloat var; idUserInterfaceLocal ui; idWindow tempwin ( &ui ); @@ -232,10 +232,10 @@ bool GEItescriptsDlg_Apply ( HWND hwnd ) src.GetStringFromMarker ( out, true ); wrapper->GetVariableDict().Set ( token + "\t\"" + token2 + "\"", out ); - + continue; - } - // If the token is a scriptdef then just parse out the + } + // If the token is a scriptdef then just parse out the // braced section and add it to the list. Right now only // one scriptdef per window is supported else if ( !token.Icmp ( "scriptdef" ) ) @@ -249,7 +249,7 @@ bool GEItescriptsDlg_Apply ( HWND hwnd ) src.Error ( "expected time" ); return false; } - + scriptName = "onTime "; scriptName.Append ( token ); } @@ -260,14 +260,14 @@ bool GEItescriptsDlg_Apply ( HWND hwnd ) src.Error ( "expected time" ); return false; } - + scriptName = "onEvent "; scriptName.Append ( token ); } else { int i; - + for( i = 0; i < idWindow::SCRIPT_COUNT; i ++ ) { if ( idStr::Icmp ( idWindow::ScriptNames[i], token ) == 0 ) @@ -275,29 +275,29 @@ bool GEItescriptsDlg_Apply ( HWND hwnd ) scriptName = idWindow::ScriptNames[i]; break; } - } + } if ( i >= idWindow::SCRIPT_COUNT ) { src.Error ( "expected script name" ); return false; } - } - + } + if ( !src.ParseBracedSectionExact ( out, 1) ) { return false; } - + wrapper->GetScriptDict().Set ( scriptName, out ); } } catch ( idException &e ) - { + { MessageBox ( hwnd, e.error, "Script Error", MB_OK|MB_ICONERROR); return false; } - + return true; } @@ -317,10 +317,10 @@ INT_PTR CALLBACK GEItescriptsDlg_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, L { RECT rClient; GetClientRect ( hwnd, &rClient ); - MoveWindow ( GetDlgItem ( hwnd, IDC_GUIED_SCRIPT ), - rClient.left, rClient.top, + MoveWindow ( GetDlgItem ( hwnd, IDC_GUIED_SCRIPT ), + rClient.left, rClient.top, rClient.right - rClient.left, - rClient.bottom - rClient.top, + rClient.bottom - rClient.top, FALSE ); break; } @@ -328,7 +328,7 @@ INT_PTR CALLBACK GEItescriptsDlg_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, L case WM_ERASEBKGND: return TRUE; - + case WM_CLOSE: if ( !GEItescriptsDlg_Apply ( hwnd ) ) { @@ -338,7 +338,7 @@ INT_PTR CALLBACK GEItescriptsDlg_WndProc ( HWND hwnd, UINT msg, WPARAM wParam, L EndDialog ( hwnd, 1 ); break; } - + return FALSE; } @@ -357,7 +357,6 @@ bool GEItemScriptsDlg_DoModal ( HWND parent, idWindow* window ) { return true; } - + return false; } - \ No newline at end of file diff --git a/neo/tools/guied/GEItemScriptsDlg.h b/neo/tools/guied/GEItemScriptsDlg.h index c69605a4..4bb477d0 100644 --- a/neo/tools/guied/GEItemScriptsDlg.h +++ b/neo/tools/guied/GEItemScriptsDlg.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/neo/tools/guied/GEKeyValueModifier.cpp b/neo/tools/guied/GEKeyValueModifier.cpp index e1542f4a..c864e98a 100644 --- a/neo/tools/guied/GEKeyValueModifier.cpp +++ b/neo/tools/guied/GEKeyValueModifier.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 #include "GEApp.h" #include "GEKeyValueModifier.h" -rvGEKeyValueModifier::rvGEKeyValueModifier ( const char* name, idWindow* window, const char* key, const char* value ) : +rvGEKeyValueModifier::rvGEKeyValueModifier ( const char* name, idWindow* window, const char* key, const char* value ) : rvGEModifier ( name, window ), mKey ( key ), mValue ( value ) @@ -65,7 +65,7 @@ bool rvGEKeyValueModifier::Merge ( rvGEModifier* mergebase ) { rvGEKeyValueModifier* merge = (rvGEKeyValueModifier*) mergebase; - mValue = merge->mValue; - + mValue = merge->mValue; + return true; -} +} diff --git a/neo/tools/guied/GEKeyValueModifier.h b/neo/tools/guied/GEKeyValueModifier.h index fc985a9a..6ca26c02 100644 --- a/neo/tools/guied/GEKeyValueModifier.h +++ b/neo/tools/guied/GEKeyValueModifier.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,19 +37,19 @@ class rvGEKeyValueModifier : public rvGEModifier public: rvGEKeyValueModifier ( const char* name, idWindow* window, const char* key, const char* value ); - + virtual bool Apply ( void ); virtual bool Undo ( void ); virtual bool CanMerge ( rvGEModifier* merge ); virtual bool Merge ( rvGEModifier* merge ); - + protected: - + idStr mKey; idStr mValue; idStr mUndoValue; -}; +}; ID_INLINE bool rvGEKeyValueModifier::CanMerge ( rvGEModifier* merge ) { diff --git a/neo/tools/guied/GEModifier.cpp b/neo/tools/guied/GEModifier.cpp index 4c681e81..41ac976e 100644 --- a/neo/tools/guied/GEModifier.cpp +++ b/neo/tools/guied/GEModifier.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,5 +40,4 @@ rvGEModifier::rvGEModifier ( const char* name, idWindow* window ) { mWrapper = rvGEWindowWrapper::GetWrapper ( window ); } -} - +} diff --git a/neo/tools/guied/GEModifier.h b/neo/tools/guied/GEModifier.h index 7ae1ee58..208a94a3 100644 --- a/neo/tools/guied/GEModifier.h +++ b/neo/tools/guied/GEModifier.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"). @@ -39,19 +39,19 @@ public: virtual ~rvGEModifier ( ) { } virtual bool Apply ( void ) = 0; - virtual bool Undo ( void ) = 0; + virtual bool Undo ( void ) = 0; virtual const char* GetName ( void ); virtual bool CanMerge ( rvGEModifier* merge ); - + virtual bool IsValid ( void ); - + virtual bool Merge ( rvGEModifier* merge ); - + idWindow* GetWindow ( void ); - - + + protected: - + idWindow* mWindow; rvGEWindowWrapper* mWrapper; idStr mName; diff --git a/neo/tools/guied/GEModifierGroup.cpp b/neo/tools/guied/GEModifierGroup.cpp index 19f28388..52310d0b 100644 --- a/neo/tools/guied/GEModifierGroup.cpp +++ b/neo/tools/guied/GEModifierGroup.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,18 +33,18 @@ If you have questions concerning this license or the applicable additional terms rvGEModifierGroup::rvGEModifierGroup ( ) : rvGEModifier ( "Group", NULL ) -{ +{ } rvGEModifierGroup::~rvGEModifierGroup ( ) { int i; - + for ( i = 0; i < mModifiers.Num(); i ++ ) { delete mModifiers[i]; } - + mModifiers.Clear ( ); } @@ -65,7 +65,7 @@ bool rvGEModifierGroup::Append ( rvGEModifier* mod ) bool rvGEModifierGroup::IsValid ( void ) { int i; - + for ( i = 0; i < mModifiers.Num(); i ++ ) { if ( !mModifiers[i]->IsValid ( ) ) @@ -73,31 +73,31 @@ bool rvGEModifierGroup::IsValid ( void ) return false; } } - + return true; } bool rvGEModifierGroup::Apply ( void ) { int i; - + for ( i = 0; i < mModifiers.Num(); i ++ ) { mModifiers[i]->Apply ( ); } - + return true; } bool rvGEModifierGroup::Undo ( void ) { int i; - + for ( i = 0; i < mModifiers.Num(); i ++ ) { mModifiers[i]->Undo ( ); } - + return true; } @@ -105,12 +105,12 @@ bool rvGEModifierGroup::CanMerge ( rvGEModifier* mergebase ) { rvGEModifierGroup* merge = (rvGEModifierGroup*) mergebase; int i; - + if ( mModifiers.Num() != merge->mModifiers.Num ( ) ) { return false; } - + // Double check the merge is possible for ( i = 0; i < mModifiers.Num(); i ++ ) { @@ -118,7 +118,7 @@ bool rvGEModifierGroup::CanMerge ( rvGEModifier* mergebase ) { return false; } - + if ( idStr::Icmp ( mModifiers[i]->GetName ( ), merge->mModifiers[i]->GetName ( ) ) ) { return false; @@ -137,12 +137,12 @@ bool rvGEModifierGroup::Merge ( rvGEModifier* mergebase ) { rvGEModifierGroup* merge = (rvGEModifierGroup*) mergebase; int i; - + // Double check the merge is possible for ( i = 0; i < mModifiers.Num(); i ++ ) { mModifiers[i]->Merge ( merge->mModifiers[i] ); } - + return true; } diff --git a/neo/tools/guied/GEModifierGroup.h b/neo/tools/guied/GEModifierGroup.h index a8063dcd..821efdd4 100644 --- a/neo/tools/guied/GEModifierGroup.h +++ b/neo/tools/guied/GEModifierGroup.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,19 +43,19 @@ public: virtual bool Undo ( void ); virtual bool CanMerge ( rvGEModifier* merge ); - + virtual bool Merge ( rvGEModifier* merge ); - + virtual bool IsValid ( void ); - bool Append ( rvGEModifier* mod ); + bool Append ( rvGEModifier* mod ); int GetCount ( void ); - - + + protected: idList mModifiers; - + }; ID_INLINE int rvGEModifierGroup::GetCount( void ) diff --git a/neo/tools/guied/GEModifierStack.cpp b/neo/tools/guied/GEModifierStack.cpp index 2046ce12..a13ac362 100644 --- a/neo/tools/guied/GEModifierStack.cpp +++ b/neo/tools/guied/GEModifierStack.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"). @@ -29,7 +29,7 @@ If you have questions concerning this license or the applicable additional terms #include "../../idlib/precompiled.h" #pragma hdrstop -#include "GEApp.h" +#include "GEApp.h" #include "GEModifierStack.h" rvGEModifierStack::rvGEModifierStack ( ) @@ -45,12 +45,12 @@ rvGEModifierStack::~rvGEModifierStack ( ) void rvGEModifierStack::Reset ( void ) { int i; - + for ( i = 0; i < mModifiers.Num ( ); i ++ ) { delete mModifiers[i]; } - + mModifiers.Clear ( ); } @@ -68,11 +68,11 @@ bool rvGEModifierStack::Append ( rvGEModifier* modifier ) delete mModifiers[mModifiers.Num()-1]; mModifiers.RemoveIndex ( mModifiers.Num()-1 ); } - + if ( !mMergeBlock && mModifiers.Num ( ) ) { rvGEModifier* top = mModifiers[mModifiers.Num()-1]; - + // See if the two modifiers can merge if ( top->GetWindow() == modifier->GetWindow() && !idStr::Icmp ( top->GetName ( ), modifier->GetName ( ) ) && @@ -82,21 +82,21 @@ bool rvGEModifierStack::Append ( rvGEModifier* modifier ) if ( top->Merge ( modifier ) ) { top->Apply ( ); - + gApp.GetProperties().Update ( ); gApp.GetTransformer().Update ( ); - + delete modifier; return true; - } + } } } - + mModifiers.Append ( modifier ); mCurrentModifier = mModifiers.Num ( ) - 1; - + modifier->Apply ( ); - + mMergeBlock = false; gApp.GetProperties().Update ( ); @@ -111,7 +111,7 @@ bool rvGEModifierStack::Undo ( void ) { return false; } - + mModifiers[mCurrentModifier]->Undo ( ); mCurrentModifier--; @@ -134,4 +134,3 @@ bool rvGEModifierStack::Redo ( void ) return true; } - diff --git a/neo/tools/guied/GEModifierStack.h b/neo/tools/guied/GEModifierStack.h index 8c62b4a4..d87843d3 100644 --- a/neo/tools/guied/GEModifierStack.h +++ b/neo/tools/guied/GEModifierStack.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,15 +44,15 @@ public: bool Append ( rvGEModifier* modifier ); bool Undo ( void ); bool Redo ( void ); - + void Reset ( void ); - + bool CanUndo ( void ); bool CanRedo ( void ); - + rvGEModifier* GetUndoModifier ( void ); rvGEModifier* GetRedoModifier ( void ); - + protected: idList mModifiers; diff --git a/neo/tools/guied/GEMoveModifier.cpp b/neo/tools/guied/GEMoveModifier.cpp index 79a68fe1..08b93b34 100644 --- a/neo/tools/guied/GEMoveModifier.cpp +++ b/neo/tools/guied/GEMoveModifier.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"). @@ -46,14 +46,14 @@ rvGEMoveModifier::rvGEMoveModifier ( const char* name, idWindow* window, float x bool rvGEMoveModifier::Merge ( rvGEModifier* mergebase ) { rvGEMoveModifier* merge = (rvGEMoveModifier*) mergebase; - + mNewRect = merge->mNewRect; - + return true; -} +} bool rvGEMoveModifier::Apply ( void ) -{ +{ mWrapper->SetRect ( mNewRect ); return true; @@ -62,7 +62,7 @@ bool rvGEMoveModifier::Apply ( void ) bool rvGEMoveModifier::Undo ( void ) { mWrapper->SetRect ( mOldRect ); - + return true; } @@ -72,6 +72,6 @@ bool rvGEMoveModifier::IsValid ( void ) { return false; } - + return true; } diff --git a/neo/tools/guied/GEMoveModifier.h b/neo/tools/guied/GEMoveModifier.h index 4b91c4c9..83c5aa41 100644 --- a/neo/tools/guied/GEMoveModifier.h +++ b/neo/tools/guied/GEMoveModifier.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"). @@ -36,18 +36,18 @@ public: virtual bool CanMerge ( rvGEModifier* merge ); virtual bool Merge ( rvGEModifier* merge ); - + virtual bool Apply ( void ); virtual bool Undo ( void ); - + virtual bool IsValid ( void ); - + protected: idRectangle mNewRect; idRectangle mOldRect; }; - + ID_INLINE bool rvGEMoveModifier::CanMerge ( rvGEModifier* merge ) { return true; diff --git a/neo/tools/guied/GENavigator.cpp b/neo/tools/guied/GENavigator.cpp index 6025c06e..5baeeacb 100644 --- a/neo/tools/guied/GENavigator.cpp +++ b/neo/tools/guied/GENavigator.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"). @@ -57,31 +57,31 @@ bool rvGENavigator::Create ( HWND parent, bool visible ) WNDCLASSEX wndClass; memset ( &wndClass, 0, sizeof(wndClass) ); wndClass.cbSize = sizeof(WNDCLASSEX); - wndClass.lpszClassName = "GUIEDITOR_NAVIGATOR_CLASS"; + wndClass.lpszClassName = "GUIEDITOR_NAVIGATOR_CLASS"; wndClass.lpfnWndProc = rvGENavigator::WndProc; - wndClass.hbrBackground = (HBRUSH)GetStockObject( LTGRAY_BRUSH );; - wndClass.hCursor = LoadCursor((HINSTANCE) NULL, IDC_ARROW); + wndClass.hbrBackground = (HBRUSH)GetStockObject( LTGRAY_BRUSH );; + wndClass.hCursor = LoadCursor((HINSTANCE) NULL, IDC_ARROW); wndClass.lpszMenuName = NULL; - wndClass.hInstance = win32.hInstance; + wndClass.hInstance = win32.hInstance; RegisterClassEx ( &wndClass ); mVisibleIcon = (HICON)LoadImage ( win32.hInstance, MAKEINTRESOURCE(IDI_GUIED_NAV_VISIBLE), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR|LR_LOADMAP3DCOLORS ); mScriptsIcon = (HICON)LoadImage ( win32.hInstance, MAKEINTRESOURCE(IDI_GUIED_NAV_SCRIPTS), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); - mScriptsLightIcon = (HICON)LoadImage ( win32.hInstance, MAKEINTRESOURCE(IDI_GUIED_NAV_SCRIPTSHI), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); + mScriptsLightIcon = (HICON)LoadImage ( win32.hInstance, MAKEINTRESOURCE(IDI_GUIED_NAV_SCRIPTSHI), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); mVisibleIconDisabled = (HICON)LoadImage ( win32.hInstance, MAKEINTRESOURCE(IDI_GUIED_NAV_VISIBLEDISABLED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR|LR_LOADMAP3DCOLORS ); mExpandIcon = (HICON)LoadImage ( win32.hInstance, MAKEINTRESOURCE(IDI_GUIED_NAV_EXPAND), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR|LR_LOADMAP3DCOLORS ); mCollapseIcon = (HICON)LoadImage ( win32.hInstance, MAKEINTRESOURCE(IDI_GUIED_NAV_COLLAPSE), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR|LR_LOADMAP3DCOLORS ); - mWnd = CreateWindowEx ( WS_EX_TOOLWINDOW, - "GUIEDITOR_NAVIGATOR_CLASS", - "Navigator", - WS_SYSMENU|WS_THICKFRAME|WS_CAPTION|WS_POPUP|WS_OVERLAPPED|WS_BORDER|WS_CLIPSIBLINGS|WS_CHILD, + mWnd = CreateWindowEx ( WS_EX_TOOLWINDOW, + "GUIEDITOR_NAVIGATOR_CLASS", + "Navigator", + WS_SYSMENU|WS_THICKFRAME|WS_CAPTION|WS_POPUP|WS_OVERLAPPED|WS_BORDER|WS_CLIPSIBLINGS|WS_CHILD, 0, 0, 200,300, - parent, - NULL, - win32.hInstance, + parent, + NULL, + win32.hInstance, this ); - + if ( !mWnd ) { return false; @@ -91,19 +91,19 @@ bool rvGENavigator::Create ( HWND parent, bool visible ) { RECT rParent; RECT rNav; - + GetWindowRect ( parent, &rParent ); - GetWindowRect ( mWnd, &rNav ); + GetWindowRect ( mWnd, &rNav ); SetWindowPos ( mWnd, NULL, rParent.right - 10 - (rNav.right-rNav.left), rParent.bottom - 10 - (rNav.bottom-rNav.top), 0,0, SWP_NOZORDER|SWP_NOSIZE ); } - + Show ( visible ); - - return true; + + return true; } /* @@ -116,25 +116,25 @@ Draws a 3d rectangle using the given brushes void Draw3dRect ( HDC hDC, RECT* rect, HBRUSH topLeft, HBRUSH bottomRight ) { RECT rOut; - + SetRect ( &rOut, rect->left, rect->top, rect->right - 1, rect->top + 1 ); - FillRect ( hDC,&rOut, topLeft ); - + FillRect ( hDC,&rOut, topLeft ); + SetRect ( &rOut, rect->left, rect->top, rect->left + 1, rect->bottom ); - FillRect( hDC,&rOut, topLeft ); + FillRect( hDC,&rOut, topLeft ); SetRect ( &rOut, rect->right, rect->top, rect->right -1, rect->bottom ); - FillRect( hDC,&rOut, bottomRight ); + FillRect( hDC,&rOut, bottomRight ); SetRect ( &rOut, rect->left, rect->bottom, rect->right, rect->bottom - 1 ); - FillRect( hDC,&rOut, bottomRight ); + FillRect( hDC,&rOut, bottomRight ); } /* ================ rvGENavigator::WndProc -Window Procedure +Window Procedure ================ */ LRESULT CALLBACK rvGENavigator::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) @@ -145,28 +145,28 @@ LRESULT CALLBACK rvGENavigator::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LP { case WM_INITMENUPOPUP: return SendMessage ( gApp.GetMDIFrame ( ), msg, wParam, lParam ); - + case WM_ACTIVATE: common->ActivateTool( LOWORD( wParam ) != WA_INACTIVE ); break; case WM_ERASEBKGND: return TRUE; - + case WM_DESTROY: gApp.GetOptions().SetWindowPlacement ( "navigator", hWnd ); break; - - case WM_CLOSE: + + case WM_CLOSE: gApp.GetOptions().SetNavigatorVisible ( false ); nav->Show ( false ); return 0; case WM_DRAWITEM: - { + { DRAWITEMSTRUCT* dis = (DRAWITEMSTRUCT*) lParam; idWindow* window = (idWindow*)dis->itemData; - + if ( window ) { rvGEWindowWrapper* wrapper = rvGEWindowWrapper::GetWrapper ( window ); @@ -184,10 +184,10 @@ LRESULT CALLBACK rvGENavigator::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LP { disabled = true; } - + offset += 10; } - + CopyRect ( &rDraw, &dis->rcItem ); rDraw.right = rDraw.left + GENAV_ITEMHEIGHT; rDraw.top ++; @@ -195,14 +195,14 @@ LRESULT CALLBACK rvGENavigator::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LP rDraw.right ++; FrameRect ( dis->hDC, &rDraw, (HBRUSH)GetStockObject ( BLACK_BRUSH ) ); rDraw.right --; - + FillRect ( dis->hDC, &rDraw, GetSysColorBrush ( COLOR_3DFACE ) ); Draw3dRect ( dis->hDC, &rDraw, GetSysColorBrush ( COLOR_3DHILIGHT ), GetSysColorBrush ( COLOR_3DSHADOW ) ); InflateRect ( &rDraw, -3, -3 ); Draw3dRect ( dis->hDC, &rDraw, GetSysColorBrush ( COLOR_3DSHADOW ), GetSysColorBrush ( COLOR_3DHILIGHT ) ); - + if ( !wrapper->IsHidden ( ) ) { DrawIconEx ( dis->hDC, rDraw.left, rDraw.top, disabled?nav->mVisibleIconDisabled:nav->mVisibleIcon, 16, 16,0, NULL, DI_NORMAL ); @@ -211,10 +211,10 @@ LRESULT CALLBACK rvGENavigator::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LP CopyRect ( &rDraw, &dis->rcItem ); rDraw.left += GENAV_ITEMHEIGHT; rDraw.left += 1; - + if ( dis->itemState & ODS_SELECTED ) { - FillRect ( dis->hDC, &rDraw, GetSysColorBrush ( COLOR_HIGHLIGHT ) ); + FillRect ( dis->hDC, &rDraw, GetSysColorBrush ( COLOR_HIGHLIGHT ) ); } else { @@ -225,14 +225,14 @@ LRESULT CALLBACK rvGENavigator::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LP { if ( wrapper->IsExpanded ( ) ) { - DrawIconEx ( dis->hDC, rDraw.left + offset, rDraw.top + 3, nav->mCollapseIcon, 16, 16,0, NULL, DI_NORMAL ); + DrawIconEx ( dis->hDC, rDraw.left + offset, rDraw.top + 3, nav->mCollapseIcon, 16, 16,0, NULL, DI_NORMAL ); } else { - DrawIconEx ( dis->hDC, rDraw.left + offset, rDraw.top + 3, nav->mExpandIcon, 16, 16,0, NULL, DI_NORMAL ); + DrawIconEx ( dis->hDC, rDraw.left + offset, rDraw.top + 3, nav->mExpandIcon, 16, 16,0, NULL, DI_NORMAL ); } } - + HPEN pen = CreatePen ( PS_SOLID, 1, GetSysColor ( COLOR_3DSHADOW ) ); HPEN oldpen = (HPEN)SelectObject ( dis->hDC, pen ); MoveToEx ( dis->hDC, rDraw.left, dis->rcItem.top, NULL ); @@ -240,36 +240,36 @@ LRESULT CALLBACK rvGENavigator::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LP MoveToEx ( dis->hDC, rDraw.left, dis->rcItem.bottom, NULL ); LineTo ( dis->hDC, dis->rcItem.right, dis->rcItem.bottom); SelectObject ( dis->hDC, oldpen ); - DeleteObject ( pen ); + DeleteObject ( pen ); rDraw.left += offset; rDraw.left += 20; - + int colorIndex = ( (dis->itemState & ODS_SELECTED ) ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT ); SetTextColor ( dis->hDC, GetSysColor ( colorIndex ) ); DrawText ( dis->hDC, name, name.Length(), &rDraw, DT_LEFT|DT_VCENTER|DT_SINGLELINE ); - + if ( wrapper->GetVariableDict().GetNumKeyVals ( ) || wrapper->GetScriptDict().GetNumKeyVals ( ) ) { DrawIconEx ( dis->hDC, dis->rcItem.right - 16, (dis->rcItem.bottom+dis->rcItem.top)/2-6, (dis->itemState & ODS_SELECTED)?nav->mScriptsLightIcon:nav->mScriptsIcon, 13, 13,0, NULL, DI_NORMAL ); } } - + break; } - + case WM_MEASUREITEM: { MEASUREITEMSTRUCT* mis = (MEASUREITEMSTRUCT*) lParam; mis->itemHeight = 22; break; } - + case WM_CREATE: { LPCREATESTRUCT cs; LVCOLUMN col; - + // Attach the class to the window first cs = (LPCREATESTRUCT) lParam; nav = (rvGENavigator*) cs->lpCreateParams; @@ -285,40 +285,40 @@ LRESULT CALLBACK rvGENavigator::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LP SetWindowLong ( nav->mTree, GWL_WNDPROC, (LONG)ListWndProc ); // Insert the only column - col.mask = 0; + col.mask = 0; ListView_InsertColumn ( nav->mTree, 0, &col ); - + break; } - + case WM_SIZE: { RECT rClient; MoveWindow ( nav->mTree, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE ); - GetClientRect ( nav->mTree, &rClient ); + GetClientRect ( nav->mTree, &rClient ); ListView_SetColumnWidth ( nav->mTree, 0, rClient.right-rClient.left-1 ); break; } case WM_NCACTIVATE: return gApp.ToolWindowActivate ( gApp.GetMDIFrame(), msg, wParam, lParam ); - + case WM_NOTIFY: { LPNMHDR nh; - + nh = (LPNMHDR) lParam; - + switch ( nh->code ) - { + { case NM_CLICK: case NM_DBLCLK: { - DWORD dwpos = GetMessagePos(); + DWORD dwpos = GetMessagePos(); LVHITTESTINFO info; info.pt.x = LOWORD(dwpos); - info.pt.y = HIWORD(dwpos); - MapWindowPoints(HWND_DESKTOP, nh->hwndFrom, &info.pt, 1); + info.pt.y = HIWORD(dwpos); + MapWindowPoints(HWND_DESKTOP, nh->hwndFrom, &info.pt, 1); int index = ListView_HitTest ( nav->mTree, &info ); if ( index != -1 ) { @@ -344,7 +344,7 @@ LRESULT CALLBACK rvGENavigator::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LP { nav->mWorkspace->UnhideWindow ( window ); } - } + } else if ( info.pt.x > GENAV_ITEMHEIGHT + offset && info.pt.x < GENAV_ITEMHEIGHT + offset + 16 ) { if ( wrapper->CanHaveChildren ( ) && window->GetChildCount ( ) ) @@ -364,32 +364,32 @@ LRESULT CALLBACK rvGENavigator::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LP else if ( nh->code == NM_DBLCLK ) { SendMessage ( gApp.GetMDIFrame ( ), WM_COMMAND, MAKELONG(ID_GUIED_ITEM_PROPERTIES,0), 0 ); - } + } } - + break; } - + case NM_RCLICK: { - DWORD dwpos = GetMessagePos(); + DWORD dwpos = GetMessagePos(); LVHITTESTINFO info; info.pt.x = LOWORD(dwpos); - info.pt.y = HIWORD(dwpos); - MapWindowPoints(HWND_DESKTOP, nh->hwndFrom, &info.pt, 1); + info.pt.y = HIWORD(dwpos); + MapWindowPoints(HWND_DESKTOP, nh->hwndFrom, &info.pt, 1); int index = ListView_HitTest ( nav->mTree, &info ); - + if ( index != -1 ) - { + { ClientToScreen ( hWnd, &info.pt ); HMENU menu = GetSubMenu ( LoadMenu ( gApp.GetInstance(), MAKEINTRESOURCE(IDR_GUIED_ITEM_POPUP) ), 0 ); TrackPopupMenu ( menu, TPM_RIGHTBUTTON|TPM_LEFTALIGN, info.pt.x, info.pt.y, 0, gApp.GetMDIFrame ( ), NULL ); DestroyMenu ( menu ); } - - break; + + break; } - + case LVN_ITEMCHANGED: { NMLISTVIEW* nml = (NMLISTVIEW*) nh; @@ -399,7 +399,7 @@ LRESULT CALLBACK rvGENavigator::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LP item.iItem = nml->iItem; item.mask = LVIF_PARAM; ListView_GetItem ( nav->mTree, &item ); - + if ( nml->uNewState & LVIS_SELECTED ) { nav->mWorkspace->GetSelectionMgr().Add ( (idWindow*)item.lParam, false ); @@ -407,14 +407,14 @@ LRESULT CALLBACK rvGENavigator::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LP else { nav->mWorkspace->GetSelectionMgr().Remove ( (idWindow*)item.lParam ); - } + } } break; } } - + break; - } + } } return DefWindowProc ( hWnd, msg, wParam, lParam ); @@ -424,14 +424,14 @@ LRESULT CALLBACK rvGENavigator::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LP ================ rvGENavigator::ListWndProc -Window Procedure for the embedded list control +Window Procedure for the embedded list control ================ */ LRESULT CALLBACK rvGENavigator::ListWndProc ( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { rvGENavigator* nav = (rvGENavigator*) GetWindowLong ( hWnd, GWL_USERDATA ); assert ( nav ); - + switch ( msg ) { case WM_KEYDOWN: @@ -443,7 +443,7 @@ LRESULT CALLBACK rvGENavigator::ListWndProc ( HWND hWnd, UINT msg, WPARAM wParam } break; } - + return CallWindowProc ( nav->mListWndProc, hWnd, msg, wParam, lParam ); } @@ -459,36 +459,36 @@ void rvGENavigator::AddWindow ( idWindow* window ) int index; LVITEM item; rvGEWindowWrapper* wrapper; - + wrapper = rvGEWindowWrapper::GetWrapper ( window ); - + // Dont add deleted windows if ( !wrapper || wrapper->IsDeleted ( ) ) { return; } - + // Insert the window into the tree ZeroMemory ( &item, sizeof(item) ); item.mask = LVIF_PARAM|LVIF_STATE|LVIF_IMAGE; - item.iItem = ListView_GetItemCount ( mTree ); + item.iItem = ListView_GetItemCount ( mTree ); item.lParam = (LONG) window; item.iImage = 0; item.state = rvGEWindowWrapper::GetWrapper(window)->IsSelected ()? LVIS_SELECTED:0; item.stateMask = LVIS_SELECTED; ListView_InsertItem ( mTree, &item ); - + if ( item.state & LVIS_SELECTED ) { ListView_EnsureVisible ( mTree, item.iItem, false ); } - + // Dont continue if not expanded. if ( !wrapper->IsExpanded ( ) ) { return; } - + // Insert all the child windows into the tree for ( index = 0; index < wrapper->GetChildCount(); index ++ ) { @@ -507,7 +507,7 @@ void rvGENavigator::SetWorkspace ( rvGEWorkspace* workspace ) { mWorkspace = workspace; - Update ( ); + Update ( ); } /* @@ -525,13 +525,13 @@ void rvGENavigator::Update ( void ) // Add starting with the desktop window if ( mWorkspace ) { - AddWindow ( mWorkspace->GetInterface ( )->GetDesktop ( ) ); - } + AddWindow ( mWorkspace->GetInterface ( )->GetDesktop ( ) ); + } // For some reason the horizontal scrollbar wants to show up initially after an update // so this forces it not to RECT rClient; - GetClientRect ( mTree, &rClient ); + GetClientRect ( mTree, &rClient ); ListView_SetColumnWidth ( mTree, 0, rClient.right-rClient.left-1 ); } @@ -546,26 +546,26 @@ void rvGENavigator::UpdateSelections ( void ) { int count = ListView_GetItemCount ( mTree ); int i; - + for ( i = 0; i < count; i++ ) { LVITEM item; idWindow* window; rvGEWindowWrapper* wrapper; - + item.iItem = i; item.mask = LVIF_PARAM; ListView_GetItem ( mTree, &item ); - window = (idWindow*) item.lParam; + window = (idWindow*) item.lParam; wrapper = rvGEWindowWrapper::GetWrapper ( window ); ListView_SetItemState ( mTree, i, wrapper->IsSelected ( )?LVIS_SELECTED:0, LVIS_SELECTED ); - + if ( wrapper->IsSelected ( ) ) { ListView_EnsureVisible ( mTree, i, false ); } - } + } } /* @@ -593,4 +593,3 @@ void rvGENavigator::Show ( bool visible ) gApp.GetOptions().SetNavigatorVisible ( visible ); ShowWindow ( mWnd, visible?SW_SHOW:SW_HIDE ); } - diff --git a/neo/tools/guied/GENavigator.h b/neo/tools/guied/GENavigator.h index f6c7b9ee..0053405c 100644 --- a/neo/tools/guied/GENavigator.h +++ b/neo/tools/guied/GENavigator.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"). @@ -36,17 +36,17 @@ class rvGENavigator public: rvGENavigator ( ); - + bool Create ( HWND parent, bool visible ); void Show ( bool visibile ); void Refresh ( void ); void SetWorkspace ( rvGEWorkspace* workspace ); - - void Update ( void ); + + void Update ( void ); void UpdateSelections ( void ); - + HWND GetWindow ( void ); protected: diff --git a/neo/tools/guied/GEOptions.cpp b/neo/tools/guied/GEOptions.cpp index 34dc4882..64178f17 100644 --- a/neo/tools/guied/GEOptions.cpp +++ b/neo/tools/guied/GEOptions.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 @@ rvGEOptions::rvGEOptions() { mWorkspaceColor.Set ( 0.0f, 0.0f, 0.0f, 1.0f ); mSelectionColor.Set ( 0.5f, 0.5f, 1.0f, 1.0f ); - + memset ( mCustomColors, 0, sizeof(mCustomColors) ); } @@ -73,15 +73,15 @@ bool rvGEOptions::Save ( void ) { // Write the last page we visited mRegistry.SetLong ( "lastOptionsPage", mLastOptionsPage ); - + // Write the grid settings mRegistry.SetVec4 ( "gridColor", idVec4(mGridColor[0],mGridColor[1],mGridColor[2],1.0f) ); mRegistry.SetLong ( "gridWidth", mGridWidth ); mRegistry.SetLong ( "gridHeight", mGridHeight ); mRegistry.SetBool ( "gridSnap", mGridSnap ); mRegistry.SetBool ( "gridVisible", mGridVisible ); - - // Tool window states + + // Tool window states mRegistry.SetBool ( "navigatorVisible", mNavigatorVisible ); mRegistry.SetBool ( "PropertiesVisible", mPropertiesVisible ); mRegistry.SetBool ( "transformerVisible", mTransformerVisible ); @@ -118,13 +118,13 @@ bool rvGEOptions::Load ( void ) // Read the general stuff mLastOptionsPage = mRegistry.GetLong ( "lastOptionsPage" ); - // Read the grid settings + // Read the grid settings mGridColor = mRegistry.GetVec4 ( "gridColor" ); mGridWidth = mRegistry.GetLong ( "gridWidth" ); mGridHeight = mRegistry.GetLong ( "gridHeight" ); mGridSnap = mRegistry.GetBool ( "gridSnap" ); mGridVisible = mRegistry.GetBool ( "gridVisible" ); - + // Tool window states mNavigatorVisible = mRegistry.GetBool ( "navigatorVisible" ); mPropertiesVisible = mRegistry.GetBool ( "PropertiesVisible" ); @@ -141,7 +141,7 @@ bool rvGEOptions::Load ( void ) { mCustomColors[i] = mRegistry.GetLong ( va("customcol%d",i) ); } - + return true; } @@ -163,13 +163,13 @@ void rvGEOptions::SnapRectToGrid ( idRectangle& rect, bool snapLeft, bool snapTo } if ( snapWidth ) - { + { float offset = (int)(rect.x + rect.w + GetGridWidth() / 2) / GetGridWidth() * GetGridWidth(); offset -= rect.x; offset -= rect.w; rect.w += offset; } - + if ( snapTop ) { float offset = (int)(rect.y + GetGridHeight() / 2) / GetGridHeight() * GetGridHeight(); @@ -179,12 +179,10 @@ void rvGEOptions::SnapRectToGrid ( idRectangle& rect, bool snapLeft, bool snapTo } if ( snapHeight ) - { + { float offset = (int)(rect.y + rect.h + GetGridHeight() / 2) / GetGridHeight() * GetGridHeight(); offset -= rect.y; offset -= rect.h; rect.h += offset; - } + } } - - diff --git a/neo/tools/guied/GEOptions.h b/neo/tools/guied/GEOptions.h index 0d5d012c..905dc5f4 100644 --- a/neo/tools/guied/GEOptions.h +++ b/neo/tools/guied/GEOptions.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"). @@ -47,10 +47,10 @@ public: // Write the options to the registery bool Save ( void ); - + // Read the options from the registry bool Load ( void ); - + void SetSelectionColor ( idVec4& color ); void SetSelectionColor ( COLORREF color ); void SetGridColor ( idVec4& color ); @@ -69,11 +69,11 @@ public: void AddRecentFile ( const char* filename ); int GetRecentFileCount ( void ); const char* GetRecentFile ( int index ); - + idVec4& GetGridColor ( void ); int GetGridWidth ( void ); int GetGridHeight ( void ); - bool GetGridVisible ( void ); + bool GetGridVisible ( void ); bool GetGridSnap ( void ); int GetLastOptionsPage ( void ); idVec4& GetWorkspaceColor ( void ); @@ -89,7 +89,7 @@ public: bool GetWindowPlacement ( const char* name, HWND hwnd ); void SnapRectToGrid ( idRectangle& rect, bool snapLeft = true, bool snapTop = true, bool snapWidth = true, bool snapHeight = true ); - + protected: void ConvertColor ( COLORREF src, idVec4& dest ); @@ -103,20 +103,20 @@ protected: int mGridHeight; bool mGridSnap; bool mGridVisible; - + idVec4 mWorkspaceColor; idVec4 mSelectionColor; - + bool mNavigatorVisible; bool mPropertiesVisible; bool mTransformerVisible; bool mStatusBarVisible; bool mIgnoreDesktopSelect; - + idList mRecentFiles; - - COLORREF mCustomColors[16]; - + + COLORREF mCustomColors[16]; + rvRegistryOptions mRegistry; }; @@ -311,4 +311,3 @@ ID_INLINE const char* rvGEOptions::GetRecentFile ( int index ) } #endif // _GEOPTIONS_H_ - diff --git a/neo/tools/guied/GEOptionsDlg.cpp b/neo/tools/guied/GEOptionsDlg.cpp index 2afa118a..22b6b547 100644 --- a/neo/tools/guied/GEOptionsDlg.cpp +++ b/neo/tools/guied/GEOptionsDlg.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"). @@ -46,10 +46,10 @@ static INT_PTR CALLBACK GEOptionsDlg_GeneralProc ( HWND hwnd, UINT msg, WPARAM w switch ( msg ) { case WM_INITDIALOG: - ColorButton_SetColor ( GetDlgItem ( hwnd, IDC_GUIED_SELECTIONCOLOR ), + ColorButton_SetColor ( GetDlgItem ( hwnd, IDC_GUIED_SELECTIONCOLOR ), RGB(gApp.GetOptions().GetSelectionColor()[0]*255, gApp.GetOptions().GetSelectionColor()[1]*255, - gApp.GetOptions().GetSelectionColor()[2]*255) ); + gApp.GetOptions().GetSelectionColor()[2]*255) ); CheckDlgButton ( hwnd, IDC_GUIED_IGNOREDESKTOP, gApp.GetOptions().GetIgnoreDesktopSelect()?BST_CHECKED:BST_UNCHECKED ); break; @@ -76,13 +76,13 @@ static INT_PTR CALLBACK GEOptionsDlg_GeneralProc ( HWND hwnd, UINT msg, WPARAM w break; case WM_DRAWITEM: - ColorButton_DrawItem ( GetDlgItem ( hwnd, wParam ), (LPDRAWITEMSTRUCT)lParam ); + ColorButton_DrawItem ( GetDlgItem ( hwnd, wParam ), (LPDRAWITEMSTRUCT)lParam ); return TRUE; - + case WM_NOTIFY: switch (((NMHDR FAR *) lParam)->code) - { - case PSN_APPLY: + { + case PSN_APPLY: gApp.GetOptions().SetLastOptionsPage ( PropSheet_HwndToIndex ( GetParent ( hwnd ), PropSheet_GetCurrentPageHwnd ( GetParent ( hwnd ) ) ) ); gApp.GetOptions().SetSelectionColor ( ColorButton_GetColor ( GetDlgItem ( hwnd, IDC_GUIED_SELECTIONCOLOR ) ) ); gApp.GetOptions().SetIgnoreDesktopSelect ( IsDlgButtonChecked ( hwnd, IDC_GUIED_IGNOREDESKTOP ) != 0 ); @@ -90,7 +90,7 @@ static INT_PTR CALLBACK GEOptionsDlg_GeneralProc ( HWND hwnd, UINT msg, WPARAM w } break; } - + return FALSE; } @@ -113,18 +113,18 @@ static INT_PTR CALLBACK GEOptionsDlg_GridProc ( HWND hwnd, UINT msg, WPARAM wPar CheckDlgButton ( hwnd, IDC_GUIED_GRIDVISIBLE, gApp.GetOptions().GetGridVisible()?BST_CHECKED:BST_UNCHECKED ); CheckDlgButton ( hwnd, IDC_GUIED_GRIDSNAP, gApp.GetOptions().GetGridSnap()?BST_CHECKED:BST_UNCHECKED ); return TRUE; - + case WM_DRAWITEM: - ColorButton_DrawItem ( GetDlgItem ( hwnd, wParam ), (LPDRAWITEMSTRUCT)lParam ); + ColorButton_DrawItem ( GetDlgItem ( hwnd, wParam ), (LPDRAWITEMSTRUCT)lParam ); return TRUE; - + case WM_NOTIFY: switch (((NMHDR FAR *) lParam)->code) { case PSN_APPLY: { char temp[32]; - + // Copy the dialog control data back to the options GetWindowText ( GetDlgItem ( hwnd, IDC_GUIED_SPACINGWIDTH ), temp, 32 ); gApp.GetOptions().SetGridWidth(atol(temp)); @@ -137,7 +137,7 @@ static INT_PTR CALLBACK GEOptionsDlg_GridProc ( HWND hwnd, UINT msg, WPARAM wPar } } break; - + case WM_COMMAND: switch ( LOWORD ( wParam ) ) { @@ -159,7 +159,7 @@ static INT_PTR CALLBACK GEOptionsDlg_GridProc ( HWND hwnd, UINT msg, WPARAM wPar } } return TRUE; - } + } return FALSE; } @@ -175,7 +175,7 @@ bool GEOptionsDlg_DoModal ( HWND parent ) { PROPSHEETHEADER propsh; PROPSHEETPAGE propsp[2]; - + propsp[0].dwSize = sizeof(PROPSHEETPAGE); propsp[0].dwFlags = PSP_USETITLE; propsp[0].hInstance = win32.hInstance; @@ -194,17 +194,17 @@ bool GEOptionsDlg_DoModal ( HWND parent ) propsh.dwSize = sizeof(PROPSHEETHEADER); propsh.nStartPage = gApp.GetOptions().GetLastOptionsPage ( ); - propsh.dwFlags = PSH_PROPSHEETPAGE|PSH_NOAPPLYNOW|PSH_NOCONTEXTHELP; - propsh.hwndParent = parent; + propsh.dwFlags = PSH_PROPSHEETPAGE|PSH_NOAPPLYNOW|PSH_NOCONTEXTHELP; + propsh.hwndParent = parent; propsh.pszCaption = "Options"; propsh.nPages = 2; propsh.ppsp = (LPCPROPSHEETPAGE)&propsp; - + if ( PropertySheet ( &propsh ) ) { gApp.GetOptions().Save ( ); return true; } - + return false; } diff --git a/neo/tools/guied/GEOptionsDlg.h b/neo/tools/guied/GEOptionsDlg.h index d4767660..a7b818ef 100644 --- a/neo/tools/guied/GEOptionsDlg.h +++ b/neo/tools/guied/GEOptionsDlg.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/neo/tools/guied/GEProperties.cpp b/neo/tools/guied/GEProperties.cpp index 1a951ced..ded3d1d0 100644 --- a/neo/tools/guied/GEProperties.cpp +++ b/neo/tools/guied/GEProperties.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"). @@ -64,22 +64,22 @@ bool rvGEProperties::Create ( HWND parent, bool visible ) wndClass.cbSize = sizeof(WNDCLASSEX); wndClass.lpszClassName = "GUIEDITOR_PROPERTIES_CLASS"; wndClass.lpfnWndProc = WndProc; - wndClass.hbrBackground = (HBRUSH)GetSysColorBrush ( COLOR_3DFACE ); - wndClass.hCursor = LoadCursor((HINSTANCE) NULL, IDC_ARROW); + wndClass.hbrBackground = (HBRUSH)GetSysColorBrush ( COLOR_3DFACE ); + wndClass.hCursor = LoadCursor((HINSTANCE) NULL, IDC_ARROW); wndClass.lpszMenuName = NULL; - wndClass.hInstance = win32.hInstance; + wndClass.hInstance = win32.hInstance; RegisterClassEx ( &wndClass ); - mWnd = CreateWindowEx ( WS_EX_TOOLWINDOW, - "GUIEDITOR_PROPERTIES_CLASS", - "Properties", - WS_SYSMENU|WS_THICKFRAME|WS_CAPTION|WS_POPUP|WS_OVERLAPPED|WS_BORDER|WS_CLIPSIBLINGS|WS_CHILD, + mWnd = CreateWindowEx ( WS_EX_TOOLWINDOW, + "GUIEDITOR_PROPERTIES_CLASS", + "Properties", + WS_SYSMENU|WS_THICKFRAME|WS_CAPTION|WS_POPUP|WS_OVERLAPPED|WS_BORDER|WS_CLIPSIBLINGS|WS_CHILD, 0, 0, 200,300, - parent, - NULL, - win32.hInstance, + parent, + NULL, + win32.hInstance, this ); - + if ( !mWnd ) { return false; @@ -89,7 +89,7 @@ bool rvGEProperties::Create ( HWND parent, bool visible ) { RECT rParent; RECT rClient; - + GetWindowRect ( parent, &rParent ); GetWindowRect ( mWnd, &rClient ); SetWindowPos ( mWnd, NULL, @@ -98,10 +98,10 @@ bool rvGEProperties::Create ( HWND parent, bool visible ) 0,0, SWP_NOZORDER|SWP_NOSIZE ); } - + Show ( visible ); - - return true; + + return true; } /* @@ -130,7 +130,7 @@ void rvGEProperties::Update ( void ) if ( mWorkspace && mWorkspace->GetSelectionMgr ( ).Num ( ) == 1 ) { - mWrapper = rvGEWindowWrapper::GetWrapper ( mWorkspace->GetSelectionMgr()[0] ); + mWrapper = rvGEWindowWrapper::GetWrapper ( mWorkspace->GetSelectionMgr()[0] ); } else { @@ -138,7 +138,7 @@ void rvGEProperties::Update ( void ) } ShowWindow ( mGrid.GetWindow ( ), mWrapper?SW_SHOW:SW_HIDE ); - + mGrid.RemoveAllItems ( ); if ( mWrapper ) @@ -151,7 +151,7 @@ void rvGEProperties::Update ( void ) temp.StripQuotes ( ); mGrid.AddItem ( kv->GetKey(), temp ); } - } + } } /* @@ -163,9 +163,9 @@ Add a state modifier for the given key / value pair */ bool rvGEProperties::AddModifier ( const char* name, const char* value ) { - idDict tempstate; + idDict tempstate; idStr tempvalue; - + tempvalue = value; if ( !mWrapper->VerfiyStateKey ( name, tempvalue ) ) { @@ -178,16 +178,16 @@ bool rvGEProperties::AddModifier ( const char* name, const char* value ) return false; } } - + tempstate = mWrapper->GetStateDict ( ); - + tempstate.Set ( name, tempvalue ); - - mWorkspace->GetModifierStack().Append ( new rvGEStateModifier ( "Property Change", mWrapper->GetWindow(), tempstate ) ); + + mWorkspace->GetModifierStack().Append ( new rvGEStateModifier ( "Property Change", mWrapper->GetWindow(), tempstate ) ); mWorkspace->SetModified ( true ); - gApp.GetNavigator().Update ( ); - - return true; + gApp.GetNavigator().Update ( ); + + return true; } /* @@ -207,7 +207,7 @@ LRESULT CALLBACK rvGEProperties::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L } switch ( msg ) - { + { case WM_ACTIVATE: common->ActivateTool( LOWORD( wParam ) != WA_INACTIVE ); break; @@ -223,7 +223,7 @@ LRESULT CALLBACK rvGEProperties::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L { case PGN_ITEMCHANGED: return (int)kv->AddModifier ( nmpg->mName, nmpg->mValue ); -/* +/* case NM_KEYDOWN: { NMKEY* nmkey = (NMKEY*)hdr; @@ -233,10 +233,10 @@ LRESULT CALLBACK rvGEProperties::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L if ( sel != -1 ) { const char* prop; - + prop = kv->mGrid.GetItemName(sel); - if ( !idStr::Icmp ( prop, "rect" ) || - !idStr::Icmp ( prop, "visible" ) || + if ( !idStr::Icmp ( prop, "rect" ) || + !idStr::Icmp ( prop, "visible" ) || !idStr::Icmp ( prop, "name" ) ) { MessageBeep ( MB_ICONASTERISK ); @@ -263,7 +263,7 @@ LRESULT CALLBACK rvGEProperties::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L } break; } - + case WM_CREATE: { LPCREATESTRUCT cs; @@ -273,11 +273,11 @@ LRESULT CALLBACK rvGEProperties::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L kv = (rvGEProperties*) cs->lpCreateParams; SetWindowLong ( hWnd, GWL_USERDATA, (LONG)kv ); - kv->mGrid.Create ( hWnd, 999, PGS_ALLOWINSERT ); - + kv->mGrid.Create ( hWnd, 999, PGS_ALLOWINSERT ); + kv->SetWorkspace ( NULL ); kv->Update ( ); - + break; } @@ -292,11 +292,11 @@ LRESULT CALLBACK rvGEProperties::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L kv->mGrid.Move ( 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE ); break; - case WM_CLOSE: + case WM_CLOSE: gApp.GetOptions().SetPropertiesVisible ( false ); kv->Show ( false ); return 0; - + case WM_NCACTIVATE: return gApp.ToolWindowActivate ( hWnd, msg, wParam, lParam ); @@ -304,8 +304,6 @@ LRESULT CALLBACK rvGEProperties::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, L gApp.GetOptions().SetWindowPlacement ( "properties", hWnd ); break; } - + return DefWindowProc ( hWnd, msg, wParam, lParam ); } - - diff --git a/neo/tools/guied/GEProperties.h b/neo/tools/guied/GEProperties.h index 99483e1b..f37b47ff 100644 --- a/neo/tools/guied/GEProperties.h +++ b/neo/tools/guied/GEProperties.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,16 +41,16 @@ class rvGEProperties public: rvGEProperties ( ); - + bool Create ( HWND parent, bool visible ); void Show ( bool visibile ); void SetWorkspace ( rvGEWorkspace* workspace ); - void Update ( void ); + void Update ( void ); HWND GetWindow ( void ); - + protected: bool AddModifier ( const char* name, const char* value ); @@ -60,7 +60,7 @@ protected: HWND mWnd; rvPropertyGrid mGrid; rvGEWindowWrapper* mWrapper; - rvGEWorkspace* mWorkspace; + rvGEWorkspace* mWorkspace; }; ID_INLINE HWND rvGEProperties::GetWindow ( void ) diff --git a/neo/tools/guied/GEPropertyPage.cpp b/neo/tools/guied/GEPropertyPage.cpp index dae0c74b..1405e123 100644 --- a/neo/tools/guied/GEPropertyPage.cpp +++ b/neo/tools/guied/GEPropertyPage.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"). @@ -37,7 +37,7 @@ rvGEPropertyPage::rvGEPropertyPage ( ) { mPage = NULL; } - + /* ================ rvGEPropertyPage::WndProc @@ -48,26 +48,26 @@ Window procedure for the property page class. INT_PTR CALLBACK rvGEPropertyPage::WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { rvGEPropertyPage* page = (rvGEPropertyPage*) GetWindowLong ( hwnd, GWL_USERDATA ); - + // Pages dont get the init dialog since their Init method is called instead if ( msg == WM_INITDIALOG ) { PROPSHEETPAGE* psp = (PROPSHEETPAGE*) lParam; - + page = (rvGEPropertyPage*) psp->lParam; - + SetWindowLong ( hwnd, GWL_USERDATA, (LONG)page ); page->mPage = hwnd; - + page->Init ( ); - + return FALSE; } else if ( !page ) { return FALSE; } - + // See if the derived class wants to handle the message return page->HandleMessage ( msg, wParam, lParam ); } @@ -85,26 +85,25 @@ int rvGEPropertyPage::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lParam ) { case WM_NOTIFY: switch (((NMHDR FAR *) lParam)->code) - { - case PSN_APPLY: + { + case PSN_APPLY: if ( !Apply ( ) ) { SetWindowLong ( mPage, DWL_MSGRESULT, PSNRET_INVALID ); return TRUE; } - break; - + break; + case PSN_SETACTIVE: SetActive ( ); break; - + case PSN_KILLACTIVE: KillActive ( ); - break; + break; } break; } - + return FALSE; } - diff --git a/neo/tools/guied/GEPropertyPage.h b/neo/tools/guied/GEPropertyPage.h index 8efcab57..54857a29 100644 --- a/neo/tools/guied/GEPropertyPage.h +++ b/neo/tools/guied/GEPropertyPage.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"). @@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms class rvGEPropertyPage { public: - + rvGEPropertyPage ( ); virtual bool Init ( void ) { return true; } @@ -42,10 +42,10 @@ public: virtual int HandleMessage ( UINT msg, WPARAM wParam, LPARAM lParam ); static INT_PTR CALLBACK WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); - + protected: - HWND mPage; + HWND mPage; }; #endif // GEPROPERTYPAGE_H_ \ No newline at end of file diff --git a/neo/tools/guied/GESelectionMgr.cpp b/neo/tools/guied/GESelectionMgr.cpp index cb04d91d..3867bf75 100644 --- a/neo/tools/guied/GESelectionMgr.cpp +++ b/neo/tools/guied/GESelectionMgr.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"). @@ -54,7 +54,7 @@ void rvGESelectionMgr::Set ( idWindow* window ) { // Get rid of any current selections Clear ( ); - + // Add this selection now return Add ( window ); } @@ -69,7 +69,7 @@ Adds the given window to the selection list void rvGESelectionMgr::Add ( idWindow* window, bool expand ) { rvGEWindowWrapper* wrapper; - + wrapper = rvGEWindowWrapper::GetWrapper ( window ); assert ( wrapper ); @@ -80,9 +80,9 @@ void rvGESelectionMgr::Add ( idWindow* window, bool expand ) } wrapper->SetSelected ( true ); - - mSelections.Append ( window ); - + + mSelections.Append ( window ); + if ( expand && wrapper->Expand ( ) ) { gApp.GetNavigator ( ).Update ( ); @@ -92,7 +92,7 @@ void rvGESelectionMgr::Add ( idWindow* window, bool expand ) gApp.GetNavigator ( ).Refresh ( ); gApp.GetTransformer ( ).Update ( ); gApp.GetProperties().Update ( ); - + UpdateExpression ( ); } @@ -106,7 +106,7 @@ Removes the selection from the current workspace void rvGESelectionMgr::Remove ( idWindow* window ) { rvGEWindowWrapper* wrapper; - + wrapper = rvGEWindowWrapper::GetWrapper ( window ); assert ( wrapper ); @@ -117,14 +117,14 @@ void rvGESelectionMgr::Remove ( idWindow* window ) } wrapper->SetSelected ( false ); - + mSelections.Remove ( window ); gApp.GetNavigator ( ).UpdateSelections ( ); gApp.GetNavigator ( ).Refresh ( ); gApp.GetTransformer ( ).Update ( ); gApp.GetProperties().Update ( ); - + UpdateExpression ( ); } @@ -145,12 +145,12 @@ void rvGESelectionMgr::Clear ( void ) } mSelections.Clear ( ); - + gApp.GetNavigator ( ).UpdateSelections ( ); gApp.GetNavigator ( ).Refresh ( ); gApp.GetTransformer ( ).Update ( ); gApp.GetProperties().Update ( ); - + mExpression = false; } @@ -170,32 +170,32 @@ void rvGESelectionMgr::Render ( void ) qglEnable(GL_BLEND); qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - + UpdateRectangle ( ); qglPolygonMode(GL_FRONT_AND_BACK, GL_LINE ); - + idVec4& color = gApp.GetOptions().GetSelectionColor ( ); - qglColor4f ( color[0],color[1],color[2], 1.0f ); - - qglBegin(GL_LINE_LOOP ); + qglColor4f ( color[0],color[1],color[2], 1.0f ); + + qglBegin(GL_LINE_LOOP ); qglVertex2f ( mRect.x, mRect.y ); qglVertex2f ( mRect.x + mRect.w, mRect.y ); qglVertex2f ( mRect.x + mRect.w, mRect.y + mRect.h); qglVertex2f ( mRect.x, mRect.y + mRect.h); - qglEnd ( ); + qglEnd ( ); - qglColor4f ( color[0],color[1],color[2], 0.75f ); + qglColor4f ( color[0],color[1],color[2], 0.75f ); int i; for ( i = 0; i < mSelections.Num(); i ++ ) { rvGEWindowWrapper* wrapper; idRectangle rect; - + wrapper = rvGEWindowWrapper::GetWrapper ( mSelections[i] ); assert ( wrapper ); - + rect = wrapper->GetScreenRect ( ); mWorkspace->WorkspaceToWindow ( rect ); @@ -207,23 +207,23 @@ void rvGESelectionMgr::Render ( void ) qglVertex2f ( rect.x + GUIED_GRABSIZE, rect.y ); qglVertex2f ( rect.x, rect.y + GUIED_GRABSIZE ); qglEnd ( ); - } - + } + qglPolygonMode(GL_FRONT_AND_BACK, GL_LINE ); - qglBegin(GL_LINE_LOOP ); + qglBegin(GL_LINE_LOOP ); qglVertex2f ( rect.x, rect.y ); qglVertex2f ( rect.x + rect.w, rect.y ); qglVertex2f ( rect.x + rect.w, rect.y + rect.h); qglVertex2f ( rect.x, rect.y + rect.h); - qglEnd ( ); + qglEnd ( ); qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL ); - qglBegin( GL_QUADS ); + qglBegin( GL_QUADS ); qglVertex2f ( rect.x + (rect.w - GUIED_CENTERSIZE) / 2, rect.y + (rect.h - GUIED_CENTERSIZE) / 2 ); qglVertex2f ( rect.x + (rect.w + GUIED_CENTERSIZE) / 2, rect.y + (rect.h - GUIED_CENTERSIZE) / 2 ); qglVertex2f ( rect.x + (rect.w + GUIED_CENTERSIZE) / 2, rect.y + (rect.h + GUIED_CENTERSIZE) / 2 ); qglVertex2f ( rect.x + (rect.w - GUIED_CENTERSIZE) / 2, rect.y + (rect.h + GUIED_CENTERSIZE) / 2 ); - qglEnd ( ); + qglEnd ( ); } if ( mExpression ) @@ -232,10 +232,10 @@ void rvGESelectionMgr::Render ( void ) } qglPolygonMode(GL_FRONT_AND_BACK, GL_LINE ); - - qglColor4f ( color[0],color[1],color[2], 1.0f ); - qglBegin(GL_QUADS); - + + qglColor4f ( color[0],color[1],color[2], 1.0f ); + qglBegin(GL_QUADS); + // Top Left qglVertex2f ( mRect.x - GUIED_GRABSIZE, mRect.y - GUIED_GRABSIZE ); qglVertex2f ( mRect.x - 1, mRect.y - GUIED_GRABSIZE ); @@ -302,28 +302,28 @@ void rvGESelectionMgr::UpdateRectangle ( void ) idVec2 point; assert ( mWorkspace ); - + if ( mSelections.Num ( ) <= 0 ) { return; } - + // Start with the first selections retangle mRect = rvGEWindowWrapper::GetWrapper( mSelections[0] )->GetScreenRect ( ); - + // Its easier to do the calculates with it being top left and bottom right // so temporarly convert width and height to right and bottom mRect.w += mRect.x; mRect.h += mRect.y; - + // Merge all the rest of the rectangles to make the actual selection rectangle for ( i = 1; i < mSelections.Num(); i ++ ) { idRectangle selRect; selRect = rvGEWindowWrapper::GetWrapper ( mSelections[i] )->GetScreenRect ( ); - + mRect.w = max(selRect.x+selRect.w,mRect.w); - mRect.h = max(selRect.y+selRect.h,mRect.h); + mRect.h = max(selRect.y+selRect.h,mRect.h); mRect.x = min(selRect.x,mRect.x); mRect.y = min(selRect.y,mRect.y); } @@ -344,7 +344,7 @@ Update whether or not the selection has an expression in it void rvGESelectionMgr::UpdateExpression ( void ) { int i; - + mExpression = false; for ( i = 0; i < mSelections.Num(); i ++ ) { @@ -356,7 +356,7 @@ void rvGESelectionMgr::UpdateExpression ( void ) break; } } -} +} /* ================ @@ -380,7 +380,7 @@ rvGESelectionMgr::EHitTest rvGESelectionMgr::HitTest ( float x, float y ) { return mExpression?HT_SELECT:HT_MOVE; } - + if ( mExpression ) { return HT_NONE; @@ -449,26 +449,26 @@ idWindow* rvGESelectionMgr::GetBottomMost ( void ) idWindow* bottom; int depth; int i; - + depth = 9999; bottom = NULL; - + // Loop through all the selections and find the bottom most window for ( i = 0; i < mSelections.Num(); i ++ ) { idWindow* parent; int tempDepth; - + // Calculate the depth of the window by iterating back through the windows parents for ( tempDepth = 0, parent = mSelections[i]; parent; parent = parent->GetParent ( ), tempDepth++ ); - - // If the new depth is less than the current depth then this window is below + + // If the new depth is less than the current depth then this window is below if ( tempDepth < depth ) { depth = tempDepth; - bottom = mSelections[i]; + bottom = mSelections[i]; } } - + return bottom; } diff --git a/neo/tools/guied/GESelectionMgr.h b/neo/tools/guied/GESelectionMgr.h index b82cf7e3..e0d55d35 100644 --- a/neo/tools/guied/GESelectionMgr.h +++ b/neo/tools/guied/GESelectionMgr.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 Add ( idWindow* window, bool expand = true ); void Remove ( idWindow* ); void Clear ( void ); - + int Num ( void ); - + void Render ( void ); - + EHitTest HitTest ( float x, float y ); - + bool IsSelected ( idWindow* window ); bool IsExpression ( void ); - + idRectangle& GetRect ( void ); idWindow* GetBottomMost ( void ); @@ -89,7 +89,7 @@ ID_INLINE int rvGESelectionMgr::Num ( void ) return mSelections.Num ( ); } -ID_INLINE idWindow*& rvGESelectionMgr::operator[]( int index ) +ID_INLINE idWindow*& rvGESelectionMgr::operator[]( int index ) { assert( index >= 0 ); assert( index < mSelections.Num() ); diff --git a/neo/tools/guied/GESizeModifier.cpp b/neo/tools/guied/GESizeModifier.cpp index dc0764ed..af421ff2 100644 --- a/neo/tools/guied/GESizeModifier.cpp +++ b/neo/tools/guied/GESizeModifier.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"). @@ -46,11 +46,11 @@ rvGESizeModifier::rvGESizeModifier ( const char* name, idWindow* window, float l bool rvGESizeModifier::Merge ( rvGEModifier* mergebase ) { rvGESizeModifier* merge = (rvGESizeModifier*) mergebase; - + mNewRect = merge->mNewRect; - + return true; -} +} bool rvGESizeModifier::Apply ( void ) { @@ -62,7 +62,7 @@ bool rvGESizeModifier::Apply ( void ) bool rvGESizeModifier::Undo ( void ) { mWrapper->SetRect ( mOldRect ); - + return true; } @@ -72,6 +72,6 @@ bool rvGESizeModifier::IsValid ( void ) { return false; } - + return true; } diff --git a/neo/tools/guied/GESizeModifier.h b/neo/tools/guied/GESizeModifier.h index d98cd3a7..63324cee 100644 --- a/neo/tools/guied/GESizeModifier.h +++ b/neo/tools/guied/GESizeModifier.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"). @@ -32,22 +32,22 @@ class rvGESizeModifier : public rvGEModifier { public: - rvGESizeModifier ( const char* name, idWindow* window, float l, float t, float r, float b ); + rvGESizeModifier ( const char* name, idWindow* window, float l, float t, float r, float b ); virtual bool CanMerge ( rvGEModifier* merge ); virtual bool Merge ( rvGEModifier* merge ); - + virtual bool Apply ( void ); virtual bool Undo ( void ); - + virtual bool IsValid ( void ); - + protected: idRectangle mNewRect; idRectangle mOldRect; }; - + ID_INLINE bool rvGESizeModifier::CanMerge ( rvGEModifier* merge ) { return true; diff --git a/neo/tools/guied/GEStateModifier.cpp b/neo/tools/guied/GEStateModifier.cpp index 0658fc14..fcb3f45d 100644 --- a/neo/tools/guied/GEStateModifier.cpp +++ b/neo/tools/guied/GEStateModifier.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"). @@ -50,7 +50,7 @@ Applys the new state dictionary to the window ================ */ bool rvGEStateModifier::Apply ( void ) -{ +{ return SetState ( mDict ); } @@ -77,7 +77,7 @@ bool rvGEStateModifier::SetState ( idDict& dict ) { const idKeyValue* key; int i; - + // Delete any key thats gone in the new dict for ( i = 0; i < mWrapper->GetStateDict().GetNumKeyVals(); i ++ ) { @@ -87,9 +87,8 @@ bool rvGEStateModifier::SetState ( idDict& dict ) continue; } } - + mWrapper->SetState ( dict ); - + return true; } - diff --git a/neo/tools/guied/GEStateModifier.h b/neo/tools/guied/GEStateModifier.h index 9b439acc..bd3392b0 100644 --- a/neo/tools/guied/GEStateModifier.h +++ b/neo/tools/guied/GEStateModifier.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,10 +37,10 @@ class rvGEStateModifier : public rvGEModifier public: rvGEStateModifier ( const char* name, idWindow* window, idDict& dict ); - + virtual bool Apply ( void ); virtual bool Undo ( void ); - + protected: bool SetState ( idDict& dict ); @@ -49,6 +49,6 @@ protected: rvGEWindowWrapper::EWindowType mUndoWindowType; idDict mDict; idDict mUndoDict; -}; +}; #endif // GESTATEMODIFIER_H_ \ No newline at end of file diff --git a/neo/tools/guied/GEStatusBar.cpp b/neo/tools/guied/GEStatusBar.cpp index b070293d..712710ef 100644 --- a/neo/tools/guied/GEStatusBar.cpp +++ b/neo/tools/guied/GEStatusBar.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"). @@ -48,14 +48,14 @@ Creates a new status bar bool rvGEStatusBar::Create ( HWND parent, UINT id, bool visible ) { mWnd = CreateStatusWindow ( WS_CHILD|WS_VISIBLE|WS_BORDER, "", parent, id ); - + if ( !mWnd ) { return false; } Show ( visible ); - + return true; } @@ -85,7 +85,7 @@ void rvGEStatusBar::Update ( void ) RECT rStatus; SIZE zoomSize; SIZE trisSize; - int parts[5]; + int parts[5]; GetWindowRect ( mWnd, &rStatus ); @@ -93,7 +93,7 @@ void rvGEStatusBar::Update ( void ) { parts[0] = -1; - SendMessage ( mWnd, SB_SETPARTS, 1, (LONG)parts ); + SendMessage ( mWnd, SB_SETPARTS, 1, (LONG)parts ); SendMessage ( mWnd, SB_SETTEXT, 1, (LPARAM) "" ); } else @@ -107,7 +107,7 @@ void rvGEStatusBar::Update ( void ) parts[3] = parts[2] + 40; parts[4] = -1; - SendMessage ( mWnd, SB_SETPARTS, 5, (LONG)parts ); + SendMessage ( mWnd, SB_SETPARTS, 5, (LONG)parts ); SendMessage ( mWnd, SB_SETTEXT, 0, (LPARAM) "" ); SendMessage ( mWnd, SB_SETTEXT, 1, (LPARAM) va(" Tris: %d", mTriangles ) ); SendMessage ( mWnd, SB_SETTEXT, 2, (LPARAM) va(" Zoom: %d%%", mZoom ) ); @@ -118,11 +118,11 @@ void rvGEStatusBar::Update ( void ) ================ rvGEStatusBar::Show -Shows and hides the status bar +Shows and hides the status bar ================ */ void rvGEStatusBar::Show ( bool visible ) { - gApp.GetOptions().SetStatusBarVisible ( visible ); + gApp.GetOptions().SetStatusBarVisible ( visible ); ShowWindow ( mWnd, visible?SW_SHOW:SW_HIDE ); } diff --git a/neo/tools/guied/GEStatusBar.h b/neo/tools/guied/GEStatusBar.h index beedf6d0..8e28a60b 100644 --- a/neo/tools/guied/GEStatusBar.h +++ b/neo/tools/guied/GEStatusBar.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"). @@ -35,17 +35,17 @@ public: rvGEStatusBar ( ); bool Create ( HWND parent, UINT id, bool visible = true ); - void Resize ( int width, int height ); - + void Resize ( int width, int height ); + HWND GetWindow ( void ); void SetZoom ( int zoom ); void SetTriangles ( int tris ); void SetSimple ( bool simple ); - + void Show ( bool state ); void Update ( void ); - + protected: HWND mWnd; diff --git a/neo/tools/guied/GETransformer.cpp b/neo/tools/guied/GETransformer.cpp index 19fdce31..417e3405 100644 --- a/neo/tools/guied/GETransformer.cpp +++ b/neo/tools/guied/GETransformer.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"). @@ -48,24 +48,24 @@ bool rvGETransformer::Create ( HWND parent, bool visible ) WNDCLASSEX wndClass; memset ( &wndClass, 0, sizeof(wndClass) ); wndClass.cbSize = sizeof(WNDCLASSEX); - wndClass.lpszClassName = "GUIEDITOR_TRANSFORMER_CLASS"; + wndClass.lpszClassName = "GUIEDITOR_TRANSFORMER_CLASS"; wndClass.lpfnWndProc = rvGETransformer::WndProc; - wndClass.hbrBackground = (HBRUSH)GetStockObject( LTGRAY_BRUSH );; - wndClass.hCursor = LoadCursor((HINSTANCE) NULL, IDC_ARROW); + wndClass.hbrBackground = (HBRUSH)GetStockObject( LTGRAY_BRUSH );; + wndClass.hCursor = LoadCursor((HINSTANCE) NULL, IDC_ARROW); wndClass.lpszMenuName = NULL; - wndClass.hInstance = win32.hInstance; + wndClass.hInstance = win32.hInstance; RegisterClassEx ( &wndClass ); - mWnd = CreateWindowEx ( WS_EX_TOOLWINDOW, - "GUIEDITOR_TRANSFORMER_CLASS", - "Transformer", - WS_SYSMENU|WS_CAPTION|WS_POPUP|WS_OVERLAPPED|WS_BORDER|WS_CLIPSIBLINGS|WS_CHILD, + mWnd = CreateWindowEx ( WS_EX_TOOLWINDOW, + "GUIEDITOR_TRANSFORMER_CLASS", + "Transformer", + WS_SYSMENU|WS_CAPTION|WS_POPUP|WS_OVERLAPPED|WS_BORDER|WS_CLIPSIBLINGS|WS_CHILD, 0, 0, 200,100, - parent, - NULL, - win32.hInstance, + parent, + NULL, + win32.hInstance, this ); - + if ( !mWnd ) { return false; @@ -75,19 +75,19 @@ bool rvGETransformer::Create ( HWND parent, bool visible ) { RECT rParent; RECT rTrans; - + GetWindowRect ( parent, &rParent ); - GetWindowRect ( mWnd, &rTrans ); + GetWindowRect ( mWnd, &rTrans ); SetWindowPos ( mWnd, NULL, rParent.right - 10 - (rTrans.right-rTrans.left), rParent.bottom - 10 - (rTrans.bottom-rTrans.top), 0,0, SWP_NOZORDER|SWP_NOSIZE ); } - + Show ( visible ); - - return true; + + return true; } LRESULT CALLBACK rvGETransformer::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) @@ -113,36 +113,36 @@ LRESULT CALLBACK rvGETransformer::WndProc ( HWND hWnd, UINT msg, WPARAM wParam, case WM_CREATE: { LPCREATESTRUCT cs; - + // Attach the class to the window first cs = (LPCREATESTRUCT) lParam; trans = (rvGETransformer*) cs->lpCreateParams; SetWindowLong ( hWnd, GWL_USERDATA, (LONG)trans ); - + trans->mWnd = hWnd; - trans->mDlg = CreateDialogParam ( gApp.GetInstance(), MAKEINTRESOURCE(IDD_GUIED_TRANSFORMER), + trans->mDlg = CreateDialogParam ( gApp.GetInstance(), MAKEINTRESOURCE(IDD_GUIED_TRANSFORMER), hWnd, DlgProc, (LPARAM)trans ); - + RECT rDlg; RECT rWindow; RECT rClient; - + GetWindowRect ( trans->mWnd, &rWindow ); GetClientRect ( trans->mWnd, &rClient ); GetWindowRect ( trans->mDlg, &rDlg ); - SetWindowPos ( trans->mWnd, NULL, 0, 0, + SetWindowPos ( trans->mWnd, NULL, 0, 0, (rWindow.right-rWindow.left)-(rClient.right-rClient.left) + (rDlg.right-rDlg.left), (rWindow.bottom-rWindow.top)-(rClient.bottom-rClient.top) + (rDlg.bottom-rDlg.top), SWP_NOZORDER ); ShowWindow ( trans->mDlg, SW_SHOW ); UpdateWindow ( trans->mDlg ); - + break; } } - + return DefWindowProc ( hWnd, msg, wParam, lParam ); } @@ -151,7 +151,7 @@ INT_PTR CALLBACK rvGETransformer::DlgProc ( HWND hWnd, UINT msg, WPARAM wParam, rvGETransformer* trans = (rvGETransformer*) GetWindowLong ( hWnd, GWL_USERDATA ); switch ( msg ) - { + { case WM_DESTROY: if ( gTransHook ) { @@ -159,7 +159,7 @@ INT_PTR CALLBACK rvGETransformer::DlgProc ( HWND hWnd, UINT msg, WPARAM wParam, } gTransDlg = NULL; break; - + case WM_INITDIALOG: trans = (rvGETransformer*) lParam; trans->mDlg = hWnd; @@ -171,7 +171,7 @@ INT_PTR CALLBACK rvGETransformer::DlgProc ( HWND hWnd, UINT msg, WPARAM wParam, gTransDlg = hWnd; gTransHook = SetWindowsHookEx( WH_GETMESSAGE, GetMsgProc, NULL, GetCurrentThreadId() ); break; - + case WM_COMMAND: if ( LOWORD ( wParam ) == IDOK ) { @@ -183,10 +183,10 @@ INT_PTR CALLBACK rvGETransformer::DlgProc ( HWND hWnd, UINT msg, WPARAM wParam, int value; GetWindowText ( GetDlgItem ( hWnd, LOWORD(wParam) ), temp, 64 ); value = atoi ( temp ); - + idRectangle rect = trans->mWorkspace->GetSelectionMgr().GetRect ( ); trans->mWorkspace->WindowToWorkspace ( rect ); - + // The transformer coords are relative to the botto most selected window's parent so // adjust the rect accordingly if ( trans->mRelative ) @@ -195,31 +195,31 @@ INT_PTR CALLBACK rvGETransformer::DlgProc ( HWND hWnd, UINT msg, WPARAM wParam, rect.x -= screenRect.x; rect.y -= screenRect.y; } - + switch ( LOWORD ( wParam ) ) { - case IDC_GUIED_ITEMRECTX: + case IDC_GUIED_ITEMRECTX: if ( value - rect[0] ) { trans->mWorkspace->AddModifierMove ( "Transform Move", value - rect[0], 0, false ); } break; - case IDC_GUIED_ITEMRECTY: + case IDC_GUIED_ITEMRECTY: if ( value - rect[1] ) { trans->mWorkspace->AddModifierMove ( "Transform Move", 0, value - rect[1], false ); } break; - case IDC_GUIED_ITEMRECTW: + case IDC_GUIED_ITEMRECTW: if ( value - rect[2] ) { trans->mWorkspace->AddModifierSize ( "Transform Size", 0, 0, value - rect[2], 0, false ); } break; - case IDC_GUIED_ITEMRECTH: + case IDC_GUIED_ITEMRECTH: if ( value - rect[3] ) { trans->mWorkspace->AddModifierSize ( "Transform Size", 0, 0, 0, value - rect[3], false ); @@ -229,7 +229,7 @@ INT_PTR CALLBACK rvGETransformer::DlgProc ( HWND hWnd, UINT msg, WPARAM wParam, } break; } - + return FALSE; } @@ -242,7 +242,7 @@ Shows and hides the transformer window */ void rvGETransformer::Show ( bool visible ) { - gApp.GetOptions().SetTransformerVisible ( visible ); + gApp.GetOptions().SetTransformerVisible ( visible ); ShowWindow ( mWnd, visible?SW_SHOW:SW_HIDE ); Update ( ); } @@ -258,7 +258,7 @@ void rvGETransformer::SetWorkspace ( rvGEWorkspace* workspace ) { mWorkspace = workspace; - Update ( ); + Update ( ); } /* @@ -272,15 +272,15 @@ the rectangle coordinates void rvGETransformer::Update ( void ) { bool state = false; - + mRelative = NULL; - + if ( mWorkspace && mWorkspace->GetSelectionMgr ( ).Num ( ) ) { state = true; mRelative = mWorkspace->GetSelectionMgr().GetBottomMost ( ); mRelative = mRelative->GetParent ( ); - + idRectangle rect = mWorkspace->GetSelectionMgr ( ).GetRect ( ); mWorkspace->WindowToWorkspace ( rect ); @@ -291,7 +291,7 @@ void rvGETransformer::Update ( void ) rect.x -= screenRect.x; rect.y -= screenRect.y; } - + SetWindowText ( GetDlgItem ( mDlg, IDC_GUIED_ITEMRECTX ), va("%d",(int)rect[0]) ); SetWindowText ( GetDlgItem ( mDlg, IDC_GUIED_ITEMRECTY ), va("%d",(int)rect[1]) ); SetWindowText ( GetDlgItem ( mDlg, IDC_GUIED_ITEMRECTW ), va("%d",(int)rect[2]) ); @@ -305,7 +305,7 @@ void rvGETransformer::Update ( void ) SetWindowText ( GetDlgItem ( mDlg, IDC_GUIED_ITEMRECTW ), "" ); SetWindowText ( GetDlgItem ( mDlg, IDC_GUIED_ITEMRECTH ), "" ); } - + EnableWindow ( GetDlgItem ( mDlg, IDC_GUIED_ITEMRECTX ), state ); EnableWindow ( GetDlgItem ( mDlg, IDC_GUIED_ITEMRECTY ), state ); EnableWindow ( GetDlgItem ( mDlg, IDC_GUIED_ITEMRECTW ), state ); @@ -325,21 +325,21 @@ LRESULT FAR PASCAL rvGETransformer::GetMsgProc ( int nCode, WPARAM wParam, LPARA if ( nCode >= 0 && PM_REMOVE == wParam ) { - // Don't translate non-input events. - if ( lpMsg->message != WM_SYSCHAR && (lpMsg->message >= WM_KEYFIRST && lpMsg->message <= WM_KEYLAST) ) - { - if ( IsDialogMessage( gTransDlg, lpMsg) ) - { - // The value returned from this hookproc is ignored, + // Don't translate non-input events. + if ( lpMsg->message != WM_SYSCHAR && (lpMsg->message >= WM_KEYFIRST && lpMsg->message <= WM_KEYLAST) ) + { + if ( IsDialogMessage( gTransDlg, lpMsg) ) + { + // The value returned from this hookproc is ignored, // and it cannot be used to tell Windows the message has been handled. - // To avoid further processing, convert the message to WM_NULL + // To avoid further processing, convert the message to WM_NULL // before returning. lpMsg->message = WM_NULL; lpMsg->lParam = 0; lpMsg->wParam = 0; - } - } + } + } } return CallNextHookEx(gTransHook, nCode, wParam, lParam); -} +} diff --git a/neo/tools/guied/GETransformer.h b/neo/tools/guied/GETransformer.h index e7ecfffc..63e6e5d3 100644 --- a/neo/tools/guied/GETransformer.h +++ b/neo/tools/guied/GETransformer.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"). @@ -35,21 +35,21 @@ public: rvGETransformer ( ); - bool Create ( HWND parent, bool visible ); + bool Create ( HWND parent, bool visible ); void Show ( bool show ); - + void SetWorkspace ( rvGEWorkspace* workspace ); void Update ( void ); - + HWND GetWindow ( void ); - + protected: HWND mWnd; HWND mDlg; - rvGEWorkspace* mWorkspace; + rvGEWorkspace* mWorkspace; idWindow* mRelative; - + private: static LRESULT CALLBACK WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); diff --git a/neo/tools/guied/GEViewer.cpp b/neo/tools/guied/GEViewer.cpp index 134896cd..46113ad4 100644 --- a/neo/tools/guied/GEViewer.cpp +++ b/neo/tools/guied/GEViewer.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,28 +44,28 @@ rvGEViewer::rvGEViewer ( ) bool rvGEViewer::Create ( HWND parent ) { - WNDCLASSEX wndClass; - + WNDCLASSEX wndClass; + // Make sure the alpha slider window class is registered - memset ( &wndClass, 0, sizeof(wndClass) ); + memset ( &wndClass, 0, sizeof(wndClass) ); wndClass.cbSize = sizeof(WNDCLASSEX); - wndClass.lpszClassName = "GUIED_VIEWER"; + wndClass.lpszClassName = "GUIED_VIEWER"; wndClass.lpfnWndProc = rvGEViewer::WndProc; - wndClass.hInstance = gApp.GetInstance ( ); + wndClass.hInstance = gApp.GetInstance ( ); wndClass.style = CS_OWNDC|CS_BYTEALIGNWINDOW|CS_VREDRAW|CS_HREDRAW; - wndClass.hbrBackground = (HBRUSH) (COLOR_3DFACE + 1); + wndClass.hbrBackground = (HBRUSH) (COLOR_3DFACE + 1); RegisterClassEx ( &wndClass ); - mWnd = CreateWindowEx ( WS_EX_TOOLWINDOW, "GUIED_VIEWER", "GUI Viewer", - WS_SYSMENU|WS_THICKFRAME|WS_CAPTION|WS_POPUP|WS_OVERLAPPED|WS_BORDER|WS_CLIPSIBLINGS|WS_CHILD, - CW_USEDEFAULT, CW_USEDEFAULT, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, + mWnd = CreateWindowEx ( WS_EX_TOOLWINDOW, "GUIED_VIEWER", "GUI Viewer", + WS_SYSMENU|WS_THICKFRAME|WS_CAPTION|WS_POPUP|WS_OVERLAPPED|WS_BORDER|WS_CLIPSIBLINGS|WS_CHILD, + CW_USEDEFAULT, CW_USEDEFAULT, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, parent, NULL, gApp.GetInstance(), this ); gApp.GetOptions().GetWindowPlacement ( "viewer", mWnd ); ShowWindow ( mWnd, SW_SHOW ); - UpdateWindow ( mWnd ); + UpdateWindow ( mWnd ); return true; } @@ -94,7 +94,7 @@ void rvGEViewer::Pause ( void ) { return; } - + mPaused = true; TBBUTTONINFO tbinfo; @@ -118,9 +118,9 @@ bool rvGEViewer::OpenFile ( const char* filename ) { idStr tempfile; idStr ospath; - + delete mInterface; - + tempfile = filename; tempfile.StripPath (); tempfile.StripFileExtension ( ); @@ -150,7 +150,7 @@ bool rvGEViewer::OpenFile ( const char* filename ) DeleteFile ( ospath ); Play ( ); - + return true; } @@ -229,7 +229,7 @@ static int MapKey (int key) LRESULT CALLBACK rvGEViewer::WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { rvGEViewer* viewer = (rvGEViewer*) GetWindowLong ( hwnd, GWL_USERDATA ); - + switch ( msg ) { @@ -245,7 +245,7 @@ LRESULT CALLBACK rvGEViewer::WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARA break; } break; - + case WM_SIZE: { RECT rToolbar; @@ -254,28 +254,28 @@ LRESULT CALLBACK rvGEViewer::WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARA viewer->mToolbarHeight = rToolbar.bottom - rToolbar.top; break; } - + case WM_ACTIVATE: common->ActivateTool( LOWORD( wParam ) != WA_INACTIVE ); break; case WM_ERASEBKGND: return TRUE; - + case WM_PAINT: assert ( viewer ); viewer->HandlePaint ( wParam, lParam ); break; - + case WM_LBUTTONDOWN: if ( viewer->mInterface ) { - sysEvent_t event; + sysEvent_t event; bool visuals; ZeroMemory ( &event, sizeof(event) ) ; event.evType = SE_KEY; - event.evValue = K_MOUSE1; - event.evValue2 = true; + event.evValue = K_MOUSE1; + event.evValue2 = true; viewer->mInterface->HandleEvent ( &event, viewer->mTime, &visuals ); } break; @@ -283,12 +283,12 @@ LRESULT CALLBACK rvGEViewer::WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARA case WM_LBUTTONUP: if ( viewer->mInterface ) { - sysEvent_t event; + sysEvent_t event; bool visuals; ZeroMemory ( &event, sizeof(event) ) ; event.evType = SE_KEY; - event.evValue = K_MOUSE1; - event.evValue2 = false; + event.evValue = K_MOUSE1; + event.evValue2 = false; viewer->mInterface->HandleEvent ( &event, viewer->mTime, &visuals ); } break; @@ -296,12 +296,12 @@ LRESULT CALLBACK rvGEViewer::WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARA case WM_KEYDOWN: if ( viewer->mInterface ) { - sysEvent_t event; + sysEvent_t event; bool visuals; ZeroMemory ( &event, sizeof(event) ) ; event.evType = SE_KEY; - event.evValue = MapKey( lParam ); - event.evValue2 = true; + event.evValue = MapKey( lParam ); + event.evValue2 = true; viewer->mInterface->HandleEvent ( &event, viewer->mTime, &visuals ); } break; @@ -310,12 +310,12 @@ LRESULT CALLBACK rvGEViewer::WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARA case WM_KEYUP: if ( viewer->mInterface ) { - sysEvent_t event; + sysEvent_t event; bool visuals; ZeroMemory ( &event, sizeof(event) ) ; event.evType = SE_KEY; - event.evValue = MapKey( lParam ); - event.evValue2 = false; + event.evValue = MapKey( lParam ); + event.evValue2 = false; viewer->mInterface->HandleEvent ( &event, viewer->mTime, &visuals ); } break; @@ -330,22 +330,22 @@ LRESULT CALLBACK rvGEViewer::WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARA if ( viewer->mInterface ) { - sysEvent_t event; + sysEvent_t event; bool visuals; ZeroMemory ( &event, sizeof(event) ) ; event.evType = SE_CHAR; - event.evValue = wParam; - event.evValue2 = false; + event.evValue = wParam; + event.evValue2 = false; viewer->mInterface->HandleEvent ( &event, viewer->mTime, &visuals ); } break; - + case WM_MOUSEMOVE: if ( viewer->mInterface ) { float x = (float)(LOWORD(lParam)) / (float)viewer->mWindowWidth * SCREEN_WIDTH; float y = (float)(HIWORD(lParam)) / (float)(viewer->mWindowHeight - viewer->mToolbarHeight) * SCREEN_HEIGHT; - sysEvent_t event; + sysEvent_t event; bool visuals; ZeroMemory ( &event, sizeof(event) ) ; @@ -360,25 +360,25 @@ LRESULT CALLBACK rvGEViewer::WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARA viewer->mInterface = NULL; gApp.CloseViewer ( ); return 0; - + case WM_CREATE: { CREATESTRUCT* cs = (CREATESTRUCT*) lParam; SetWindowLong ( hwnd, GWL_USERDATA, (LONG)cs->lpCreateParams ); - + viewer = (rvGEViewer*)cs->lpCreateParams; viewer->mWnd = hwnd; viewer->SetupPixelFormat ( ); viewer->mToolbar = CreateWindowEx ( 0, TOOLBARCLASSNAME, "", CCS_BOTTOM|WS_CHILD|WS_VISIBLE,0,0,0,0, hwnd, (HMENU)IDR_GUIED_VIEWERTOOLBAR, gApp.GetInstance(), NULL ); - // Send the TB_BUTTONSTRUCTSIZE message, which is required for backward compatibility. + // Send the TB_BUTTONSTRUCTSIZE message, which is required for backward compatibility. SendMessage( viewer->mToolbar, TB_BUTTONSTRUCTSIZE, ( WPARAM )sizeof( TBBUTTON ), 0 ); - + SendMessage ( viewer->mToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(16,15) ); - + SendMessage ( viewer->mToolbar, TB_SETSTYLE, 0, SendMessage ( viewer->mToolbar, TB_GETSTYLE, 0, 0 ) | TBSTYLE_FLAT ); - + TBMETRICS tbmet; tbmet.cbSize = sizeof(TBMETRICS); SendMessage ( viewer->mToolbar, TB_GETMETRICS, 0, (LPARAM)&tbmet ); @@ -386,43 +386,43 @@ LRESULT CALLBACK rvGEViewer::WndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARA tbmet.cyBarPad = 0; SendMessage ( viewer->mToolbar, TB_SETMETRICS, 0, (LPARAM)&tbmet ); - // Add the bitmap containing button images to the toolbar. - TBADDBITMAP tbab; - tbab.hInst = win32.hInstance; - tbab.nID = IDR_GUIED_VIEWERTOOLBAR; - SendMessage( viewer->mToolbar, TB_ADDBITMAP, (WPARAM)4, (LPARAM) &tbab ); + // Add the bitmap containing button images to the toolbar. + TBADDBITMAP tbab; + tbab.hInst = win32.hInstance; + tbab.nID = IDR_GUIED_VIEWERTOOLBAR; + SendMessage( viewer->mToolbar, TB_ADDBITMAP, (WPARAM)4, (LPARAM) &tbab ); - TBBUTTON tbb[4]; - tbb[0].fsStyle = BTNS_SEP; + TBBUTTON tbb[4]; + tbb[0].fsStyle = BTNS_SEP; tbb[0].fsState = 0; - tbb[1].idCommand = ID_GUIED_VIEWER_START; - tbb[1].iBitmap = 2; - tbb[1].fsState = 0; - tbb[1].fsStyle = BTNS_BUTTON; - tbb[1].dwData = 0; - tbb[1].iString = -1; + tbb[1].idCommand = ID_GUIED_VIEWER_START; + tbb[1].iBitmap = 2; + tbb[1].fsState = 0; + tbb[1].fsStyle = BTNS_BUTTON; + tbb[1].dwData = 0; + tbb[1].iString = -1; - tbb[2].idCommand = ID_GUIED_VIEWER_PAUSE; - tbb[2].iBitmap = 1; - tbb[2].fsState = TBSTATE_ENABLED; - tbb[2].fsStyle = BTNS_BUTTON; - tbb[2].dwData = 0; - tbb[2].iString = -1; + tbb[2].idCommand = ID_GUIED_VIEWER_PAUSE; + tbb[2].iBitmap = 1; + tbb[2].fsState = TBSTATE_ENABLED; + tbb[2].fsStyle = BTNS_BUTTON; + tbb[2].dwData = 0; + tbb[2].iString = -1; - tbb[3].fsStyle = BTNS_SEP; + tbb[3].fsStyle = BTNS_SEP; tbb[3].fsState = 0; - SendMessage( viewer->mToolbar, TB_ADDBUTTONS, (WPARAM)4, (LPARAM) &tbb ); + SendMessage( viewer->mToolbar, TB_ADDBUTTONS, (WPARAM)4, (LPARAM) &tbb ); break; } - + case WM_SETCURSOR: SetCursor ( NULL ); break; } - + return DefWindowProc ( hwnd, msg, wParam, lParam ); } @@ -434,9 +434,9 @@ LRESULT rvGEViewer::HandlePaint ( WPARAM wParam, LPARAM lParam ) dc = BeginPaint ( mWnd, &ps ); Render ( dc ); - + EndPaint ( mWnd, &ps ); - + return 1; } @@ -453,18 +453,18 @@ bool rvGEViewer::SetupPixelFormat ( void ) bool result = true; int pixelFormat = ChoosePixelFormat(hDC, &win32.pfd); - if (pixelFormat > 0) + if (pixelFormat > 0) { - if (SetPixelFormat(hDC, pixelFormat, &win32.pfd) == NULL) + if (SetPixelFormat(hDC, pixelFormat, &win32.pfd) == NULL) { result = false; } } - else + else { result = false; } - + ReleaseDC ( mWnd, hDC ); return result; @@ -474,20 +474,20 @@ void rvGEViewer::Render ( HDC dc ) { int frontEnd; int backEnd; - + // Switch GL contexts to our dc - if (!qwglMakeCurrent( dc, win32.hGLRC )) + if (!qwglMakeCurrent( dc, win32.hGLRC )) { common->Printf("ERROR: wglMakeCurrent failed.. Error:%i\n", qglGetError()); common->Printf("Please restart Q3Radiant if the Map view is not working\n"); - return; + return; } if ( !mPaused ) { mTime += eventLoop->Milliseconds() - mLastTime; mLastTime = eventLoop->Milliseconds(); - } + } RECT rClient; RECT rToolbar; @@ -528,10 +528,10 @@ void rvGEViewer::Render ( HDC dc ) // Prepare the renderSystem view to draw the GUI in renderSystem->BeginFrame(mWindowWidth, mWindowHeight ); - + // Draw the gui mInterface->Redraw ( mTime ); - + // We are done using the renderSystem now renderSystem->EndFrame( &frontEnd, &backEnd ); } @@ -544,8 +544,8 @@ void rvGEViewer::RunFrame ( void ) { if ( !mPaused ) { - HDC hDC = GetDC ( mWnd ); - Render ( hDC ); + HDC hDC = GetDC ( mWnd ); + Render ( hDC ); ReleaseDC ( mWnd, hDC ); } } diff --git a/neo/tools/guied/GEViewer.h b/neo/tools/guied/GEViewer.h index 194a6207..9efe8546 100644 --- a/neo/tools/guied/GEViewer.h +++ b/neo/tools/guied/GEViewer.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,11 +38,11 @@ public: bool Create ( HWND parent ); bool Destroy ( void ); bool OpenFile ( const char* filename ); - + void RunFrame ( void ); - + HWND GetWindow ( void ); - + protected: void Render ( HDC dc ); @@ -58,9 +58,9 @@ protected: HWND mToolbar; int mLastTime; int mTime; - + LRESULT HandlePaint ( WPARAM wParam, LPARAM lParam ); - + private: bool SetupPixelFormat ( void ); diff --git a/neo/tools/guied/GEWindowWrapper.cpp b/neo/tools/guied/GEWindowWrapper.cpp index 5c7eb7fe..2b994412 100644 --- a/neo/tools/guied/GEWindowWrapper.cpp +++ b/neo/tools/guied/GEWindowWrapper.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"). @@ -88,7 +88,7 @@ Static method that returns the window wrapper for the given window class */ rvGEWindowWrapper * rvGEWindowWrapper::GetWrapper( idWindow *window ) { idWinInt *var; - var = dynamic_cast< idWinInt*>(window->GetWinVarByName("guied_wrapper")); + var = dynamic_cast< idWinInt*>(window->GetWinVarByName("guied_wrapper")); return var ? ((rvGEWindowWrapper *) (int) (*var)) : NULL; } @@ -96,7 +96,7 @@ rvGEWindowWrapper * rvGEWindowWrapper::GetWrapper( idWindow *window ) { ================ rvGEWindowWrapper::UpdateRect -Updates the gui editor's representation of the window rectangle from the +Updates the gui editor's representation of the window rectangle from the windows rectangle ================ */ @@ -185,7 +185,7 @@ void rvGEWindowWrapper::SetRect( idRectangle &rect ) { const char *s; mClientRect = rect; - CalcScreenRect(); + CalcScreenRect(); s = va("%d,%d,%d,%d", (int) (rect.x + 0.5f), (int) (rect.y + 0.5f), (int) ((rect.w + 0.5f) * (mFlippedHorz ? -1 : 1)), (int) ((rect.h + 0.5f) * (mFlippedVert ? -1 : 1))); @@ -198,7 +198,7 @@ void rvGEWindowWrapper::SetRect( idRectangle &rect ) { ================ rvGEWindowWrapper::SetHidden -Sets the wrappers hidden state +Sets the wrappers hidden state ================ */ void rvGEWindowWrapper::SetHidden( bool h ) { @@ -243,7 +243,7 @@ void rvGEWindowWrapper::SetState( const idDict &dict ) { ================ rvGEWindowWrapper::SetStateKey -Sets the given state key and updates the +Sets the given state key and updates the ================ */ void rvGEWindowWrapper::SetStateKey( const char *key,const char *value,bool update ) { @@ -263,7 +263,7 @@ void rvGEWindowWrapper::SetStateKey( const char *key,const char *value,bool upda ================ rvGEWindowWrapper::DeleteStateKey -Sets the given state key and updates the +Sets the given state key and updates the ================ */ void rvGEWindowWrapper::DeleteStateKey( const char *key ) { @@ -278,7 +278,7 @@ void rvGEWindowWrapper::DeleteStateKey( const char *key ) { ================ rvGEWindowWrapper::UpdateWindowState -Updates the windows real state with wrappers internal state. Visibility is +Updates the windows real state with wrappers internal state. Visibility is handled specially ================ */ @@ -559,14 +559,14 @@ bool rvGEWindowWrapper::VerfiyStateKey( const char *name,const char *value,idStr } } catch ( idException &) { failed = true; - } + } // Restore the old value idParser src2(old, old.Length(), "", LEXFL_NOFATALERRORS | LEXFL_NOSTRINGCONCAT | LEXFL_ALLOWMULTICHARLITERALS | LEXFL_ALLOWBACKSLASHSTRINGCONCAT); if ( !mWindow->ParseInternalVar(name, &src2) ) { if ( !mWindow->ParseRegEntry(name, &src2) ) { } - } + } // Check to see if the old value matches the new value idStr before; @@ -587,4 +587,3 @@ bool rvGEWindowWrapper::VerfiyStateKey( const char *name,const char *value,idStr return true; } - diff --git a/neo/tools/guied/GEWindowWrapper.h b/neo/tools/guied/GEWindowWrapper.h index 86f92c05..e4424272 100644 --- a/neo/tools/guied/GEWindowWrapper.h +++ b/neo/tools/guied/GEWindowWrapper.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"). @@ -54,8 +54,8 @@ public: rvGEWindowWrapper ( idWindow* window, EWindowType type ); - static rvGEWindowWrapper* GetWrapper ( idWindow* window ); - + static rvGEWindowWrapper* GetWrapper ( idWindow* window ); + idWindow* GetWindow ( void ); idDict& GetStateDict ( void ); idDict& GetVariableDict ( void ); @@ -66,13 +66,13 @@ public: int GetChildCount ( void ); int GetDepth ( void ); idWindow* GetChild ( int index ); - + void SetRect ( idRectangle& rect ); void SetState ( const idDict& dict ); void SetStateKey ( const char* key, const char* value, bool update = true ); void DeleteStateKey ( const char* key ); bool VerfiyStateKey ( const char* name, const char* value, idStr* result = NULL ); - + bool IsFlippedHorz ( void ); bool IsFlippedVert ( void ); bool IsHidden ( void ); @@ -82,7 +82,7 @@ public: bool CanHaveChildren ( void ); bool CanMoveAndSize ( void ); - + void SetFlippedHorz ( bool f ); void SetFlippedVert ( bool f ); void SetHidden ( bool v ); @@ -96,17 +96,17 @@ public: bool EnumChildren ( PFNENUMCHILDRENPROC proc, void* data ); idWindow* WindowFromPoint ( float x, float y, bool visibleOnly = true ); - + void Finish ( void ); - + static EWindowType StringToWindowType ( const char* string ); static const char* WindowTypeToString ( EWindowType type ); - + protected: void CalcScreenRect ( void ); void UpdateRect ( void ); - void UpdateWindowState ( void ); + void UpdateWindowState ( void ); idRectangle mClientRect; idRectangle mScreenRect; @@ -145,16 +145,16 @@ ID_INLINE bool rvGEWindowWrapper::IsFlippedHorz ( void ) return mFlippedHorz; } -ID_INLINE bool rvGEWindowWrapper::IsFlippedVert ( void ) +ID_INLINE bool rvGEWindowWrapper::IsFlippedVert ( void ) { return mFlippedVert; } -ID_INLINE bool rvGEWindowWrapper::IsExpanded ( void ) +ID_INLINE bool rvGEWindowWrapper::IsExpanded ( void ) { return mExpanded; } - + ID_INLINE void rvGEWindowWrapper::SetFlippedHorz ( bool f ) { mFlippedHorz = f; diff --git a/neo/tools/guied/GEWindowWrapper_stub.cpp b/neo/tools/guied/GEWindowWrapper_stub.cpp index 08fb8a82..4587bc88 100644 --- a/neo/tools/guied/GEWindowWrapper_stub.cpp +++ b/neo/tools/guied/GEWindowWrapper_stub.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/neo/tools/guied/GEWorkspace.cpp b/neo/tools/guied/GEWorkspace.cpp index ba7848fb..cf3574e7 100644 --- a/neo/tools/guied/GEWorkspace.cpp +++ b/neo/tools/guied/GEWorkspace.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,20 +62,20 @@ idList rvGEWorkspace::mClipboard; rvGEWorkspace::rvGEWorkspace ( rvGEApp* app ) : mApplication ( app ) { - mWnd = 0; - mInterface = 0; - mZoom = ZOOM_100; - mScrollHorz = false; - mScrollVert = false; - mModified = false; + mWnd = 0; + mInterface = 0; + mZoom = ZOOM_100; + mScrollHorz = false; + mScrollVert = false; + mModified = false; mNew = false; - mDragScroll = false; + mDragScroll = false; mSourceControlState = SCS_CHECKEDOUT; - mFilename = "guis/Untitled.gui"; + mFilename = "guis/Untitled.gui"; mDragType = rvGESelectionMgr::HT_NONE; - mHandCursor = LoadCursor ( app->GetInstance(), MAKEINTRESOURCE(IDC_GUIED_HAND) ); + mHandCursor = LoadCursor ( app->GetInstance(), MAKEINTRESOURCE(IDC_GUIED_HAND) ); mDontAdd = false; - + mSelections.SetWorkspace ( this ); } @@ -86,7 +86,7 @@ rvGEWorkspace::~rvGEWorkspace ( ) DestroyCursor ( mHandCursor ); - delete mInterface; + delete mInterface; } /* @@ -99,14 +99,14 @@ Window enumeration procedure that deletes all the wrapper classes bool rvGEWorkspace::CleanupEnumProc ( rvGEWindowWrapper* wrapper, void* data ) { bool result; - + if ( !wrapper ) { return true; } - + result = wrapper->EnumChildren ( CleanupEnumProc, data ); - + // Cleanup the window wrapper delete wrapper; @@ -136,18 +136,18 @@ window is created and the file has been loaded. bool rvGEWorkspace::Attach ( HWND wnd ) { assert ( wnd ); - + mWnd = wnd; // Initialize the pixel format for this window SetupPixelFormat ( ); - // Jam the workspace pointer into the userdata window long so + // Jam the workspace pointer into the userdata window long so // we can retrieve the workspace from the window later SetWindowLong ( mWnd, GWL_USERDATA, (LONG) this ); - + UpdateTitle ( ); - + return true; } @@ -161,7 +161,7 @@ Detaches the workspace from the window it is currently attached to void rvGEWorkspace::Detach ( void ) { assert ( mWnd ); - + SetWindowLong ( mWnd, GWL_USERDATA, 0 ); mWnd = NULL; } @@ -179,18 +179,18 @@ bool rvGEWorkspace::SetupPixelFormat ( void ) bool result = true; int pixelFormat = ChoosePixelFormat(hDC, &win32.pfd); - if (pixelFormat > 0) + if (pixelFormat > 0) { - if (SetPixelFormat(hDC, pixelFormat, &win32.pfd) == NULL) + if (SetPixelFormat(hDC, pixelFormat, &win32.pfd) == NULL) { result = false; } } - else + else { result = false; } - + ReleaseDC ( mWnd, hDC ); return result; @@ -218,9 +218,9 @@ void rvGEWorkspace::RenderGrid ( void ) qglEnable(GL_BLEND); qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - + qglColor4f ( color[0], color[1], color[2], 0.5f ); - + qglBegin ( GL_LINES ); step = mApplication->GetOptions().GetGridWidth ( ) * g_ZoomScales[mZoom]; for ( x = mRect.x + mRect.w; x >= mRect.x ; x -= step ) @@ -238,7 +238,7 @@ void rvGEWorkspace::RenderGrid ( void ) qglDisable(GL_BLEND); qglColor3f ( color[0], color[1], color[2] ); - + qglBegin ( GL_LINES ); step = mApplication->GetOptions().GetGridWidth ( ) * g_ZoomScales[mZoom]; for ( x = mRect.x + mRect.w; x >= mRect.x ; x -= step * 4 ) @@ -267,15 +267,15 @@ void rvGEWorkspace::Render ( HDC hdc ) int front; int back; float scale; - + scale = g_ZoomScales[mZoom]; // Switch GL contexts to our dc - if (!qwglMakeCurrent( hdc, win32.hGLRC )) + if (!qwglMakeCurrent( hdc, win32.hGLRC )) { common->Printf("ERROR: wglMakeCurrent failed.. Error:%i\n", qglGetError()); common->Printf("Please restart Q3Radiant if the Map view is not working\n"); - return; + return; } // Prepare the view and clear it @@ -295,7 +295,7 @@ void rvGEWorkspace::Render ( HDC hdc ) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - qglColor3f ( mApplication->GetOptions().GetWorkspaceColor()[0], mApplication->GetOptions().GetWorkspaceColor()[1], mApplication->GetOptions().GetWorkspaceColor()[2] ); + qglColor3f ( mApplication->GetOptions().GetWorkspaceColor()[0], mApplication->GetOptions().GetWorkspaceColor()[1], mApplication->GetOptions().GetWorkspaceColor()[2] ); qglBegin ( GL_QUADS ); qglVertex2f ( mRect.x, mRect.y ); qglVertex2f ( mRect.x + mRect.w, mRect.y ); @@ -317,7 +317,7 @@ void rvGEWorkspace::Render ( HDC hdc ) tr.viewDef->scissor.y2 = mRect.h; tr.viewDef->isEditor = true; renderSystem->BeginFrame(mWindowWidth, mWindowHeight ); - + // Draw the gui mInterface->Redraw ( 0 ); // eventLoop->Milliseconds() ); @@ -334,7 +334,7 @@ void rvGEWorkspace::Render ( HDC hdc ) qglDisable( GL_TEXTURE_CUBE_MAP_EXT ); // qglDisable(GL_BLEND); qglDisable(GL_CULL_FACE); - + qglViewport(0, 0, mWindowWidth, mWindowHeight ); qglScissor(0, 0, mWindowWidth, mWindowHeight ); glMatrixMode(GL_PROJECTION); @@ -344,9 +344,9 @@ void rvGEWorkspace::Render ( HDC hdc ) glLoadIdentity(); RenderGrid ( ); - + mSelections.Render ( ); - + qglFinish ( ); qwglSwapBuffers(hdc); @@ -382,14 +382,14 @@ void rvGEWorkspace::UpdateRectangle ( bool useScroll ) float x; float y; float scale; - + scale = g_ZoomScales[mZoom]; // Grab the current client rectangle of the window and cache off the width and height GetClientRect ( mWnd, &rcClient ); mWindowWidth = rcClient.right - rcClient.left; mWindowHeight = rcClient.bottom - rcClient.top; - + // The workspace is always centered in the window x = mRect.x = mWindowWidth / 2 - (SCREEN_WIDTH * scale) / 2; y = mRect.y = mWindowHeight / 2 - (SCREEN_HEIGHT * scale) / 2; @@ -424,7 +424,7 @@ void rvGEWorkspace::Scroll ( int scrollbar, int offset ) { return; } - + // Get all the vertial scroll bar information si.cbSize = sizeof (si); si.fMask = SIF_ALL; @@ -435,7 +435,7 @@ void rvGEWorkspace::Scroll ( int scrollbar, int offset ) si.nPos += (1000 * offset); if ( si.nPos < si.nMin ) si.nPos = si.nMin; if ( si.nPos > si.nMax ) si.nPos = si.nMax; - + si.fMask = SIF_POS; SetScrollInfo (mWnd, scrollbar, &si, TRUE); GetScrollInfo (mWnd, scrollbar, &si); @@ -443,10 +443,10 @@ void rvGEWorkspace::Scroll ( int scrollbar, int offset ) UpdateRectangle ( ); } -int rvGEWorkspace::HandleScroll ( int scrollbar, WPARAM wParam, LPARAM lParam ) +int rvGEWorkspace::HandleScroll ( int scrollbar, WPARAM wParam, LPARAM lParam ) { SCROLLINFO si; - + // Get all the vertial scroll bar information si.cbSize = sizeof (si); si.fMask = SIF_ALL; @@ -457,30 +457,30 @@ int rvGEWorkspace::HandleScroll ( int scrollbar, WPARAM wParam, LPARAM lParam ) switch (LOWORD (wParam)) { // user clicked left or up arrow - case SB_LINELEFT: + case SB_LINELEFT: si.nPos -= 1000; break; - + // user clicked right or down arrow - case SB_LINERIGHT: + case SB_LINERIGHT: si.nPos += 1000; break; - + // user clicked shaft left of the scroll box case SB_PAGELEFT: si.nPos -= si.nPage; break; - + // user clicked shaft right of the scroll box case SB_PAGERIGHT: si.nPos += si.nPage; break; - + // user dragged the scroll box - case SB_THUMBTRACK: + case SB_THUMBTRACK: si.nPos = si.nTrackPos; break; - + default : break; } @@ -492,7 +492,7 @@ int rvGEWorkspace::HandleScroll ( int scrollbar, WPARAM wParam, LPARAM lParam ) GetScrollInfo (mWnd, scrollbar, &si); UpdateRectangle ( ); - + return 0; } @@ -514,7 +514,7 @@ void rvGEWorkspace::UpdateScrollbars ( void ) // Setup the veritcal scrollbar info.cbSize = sizeof(info); info.fMask = SIF_RANGE|SIF_PAGE; - info.nMax = (mRect.h - mWindowHeight + 10) * 1000 / 2; + info.nMax = (mRect.h - mWindowHeight + 10) * 1000 / 2; info.nMin = -info.nMax; info.nPage = (int)((float)info.nMax * (float)((float)mWindowHeight / mRect.h)); info.nMax += info.nPage; @@ -528,18 +528,18 @@ void rvGEWorkspace::UpdateScrollbars ( void ) mScrollVert = true; ShowScrollBar ( mWnd, SB_VERT, mScrollVert ); } - SetScrollInfo ( mWnd, SB_VERT, &info, TRUE ); + SetScrollInfo ( mWnd, SB_VERT, &info, TRUE ); } // Nothing to scroll, turn off the scrollbar if its on. else if ( mScrollVert ) - { + { mScrollVert = false; SetScrollPos ( mWnd, SB_VERT, 0, FALSE ); ShowScrollBar ( mWnd, SB_VERT, mScrollVert ); } // Setup the horizontal scrollbar - info.nMax = (mRect.w - mWindowWidth + 10) * 1000 / 2; + info.nMax = (mRect.w - mWindowWidth + 10) * 1000 / 2; info.nMin = -info.nMax; info.nPage = (int)((float)info.nMax * (float)((float)mWindowWidth / mRect.w)); info.nMax += info.nPage; @@ -553,18 +553,18 @@ void rvGEWorkspace::UpdateScrollbars ( void ) mScrollHorz = true; ShowScrollBar ( mWnd, SB_HORZ, mScrollHorz ); } - + SetScrollInfo ( mWnd, SB_HORZ, &info, TRUE ); } // Nothing to scroll, turn off the scrollbar if its on. else if ( mScrollHorz ) - { + { mScrollHorz = false; SetScrollPos ( mWnd, SB_HORZ, 0, FALSE ); ShowScrollBar ( mWnd, SB_HORZ, mScrollHorz ); } - // Need to update the rectangle again to take the scrollbar changes into account + // Need to update the rectangle again to take the scrollbar changes into account UpdateRectangle ( true ); } @@ -582,7 +582,7 @@ void rvGEWorkspace::UpdateCursor ( rvGESelectionMgr::EHitTest type ) case rvGESelectionMgr::HT_SELECT: SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_ARROW) ) ); break; - + case rvGESelectionMgr::HT_MOVE: SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_SIZEALL) ) ); break; @@ -607,19 +607,19 @@ void rvGEWorkspace::UpdateCursor ( rvGESelectionMgr::EHitTest type ) SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_SIZENWSE ) ) ); break; } -} +} void rvGEWorkspace::UpdateCursor ( float x, float y ) { idVec2 point; rvGESelectionMgr::EHitTest type; - + // First convert the worspace coord to a window coord point = WorkspaceToWindow ( idVec2( x, y ) ); - // See if it hits anything + // See if it hits anything type = mSelections.HitTest ( point.x, point.y ); - + // If it hits something then use it to update the cursor if ( rvGESelectionMgr::HT_NONE != type ) { @@ -663,7 +663,7 @@ void rvGEWorkspace::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lParam ) { case WM_CLOSE: { - + if ( IsModified ( ) ) { if ( IDYES == gApp.MessageBox ( va("Save changes to the document \"%s\" before closing?", GetFilename() ), MB_YESNO|MB_ICONQUESTION ) ) @@ -671,14 +671,14 @@ void rvGEWorkspace::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lParam ) SendMessage ( mApplication->GetMDIFrame(), WM_COMMAND, MAKELONG(ID_GUIED_FILE_SAVE,0), 0 ); } } - - GetApplication ( )->GetNavigator().SetWorkspace(NULL); + + GetApplication ( )->GetNavigator().SetWorkspace(NULL); GetApplication ( )->GetTransformer().SetWorkspace(NULL); GetApplication ( )->GetProperties().SetWorkspace(NULL); break; } - + case WM_CAPTURECHANGED: if ( (HWND)lParam != mWnd ) { @@ -704,7 +704,7 @@ void rvGEWorkspace::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lParam ) } break; } - + case WM_MOUSEWHEEL: if ( (short)HIWORD(wParam) > 0 ) { @@ -715,43 +715,43 @@ void rvGEWorkspace::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lParam ) ZoomOut ( ); } break; - + case WM_MOUSEMOVE: HandleMouseMove ( wParam, lParam ); break; - + case WM_MBUTTONDOWN: HandleMButtonDown ( wParam, lParam ); break; - + case WM_MBUTTONUP: HandleMButtonUp ( wParam, lParam ); break; - + case WM_LBUTTONDOWN: HandleLButtonDown ( wParam, lParam ); break; - + case WM_LBUTTONUP: HandleLButtonUp ( wParam, lParam ); break; - + case WM_LBUTTONDBLCLK: HandleLButtonDblClk ( wParam, lParam ); break; - case WM_INITMENUPOPUP: + case WM_INITMENUPOPUP: SendMessage ( mApplication->GetMDIFrame(), msg, wParam, lParam ); break; - + case WM_COMMAND: HandleCommand ( wParam, lParam ); break; - + case WM_RBUTTONDOWN: HandleRButtonDown ( wParam, lParam ); break; - + case WM_SIZE: UpdateScrollbars(); break; @@ -763,10 +763,10 @@ void rvGEWorkspace::HandleMessage ( UINT msg, WPARAM wParam, LPARAM lParam ) case WM_HSCROLL: HandleScroll ( SB_HORZ, wParam, lParam ); break; - + case WM_KEYDOWN: HandleKeyDown ( wParam, lParam ); - break; + break; } } /* @@ -784,7 +784,7 @@ int rvGEWorkspace::HandleCommand ( WPARAM wParam, LPARAM lParam ) { idWindow* window = mSelectMenu[LOWORD(wParam)-ID_GUIED_SELECT_FIRST]; rvGEWindowWrapper* wrapper = rvGEWindowWrapper::GetWrapper ( window ); - + // Handle multi select as well if ( GetAsyncKeyState ( VK_SHIFT ) & 0x8000 ) { @@ -798,7 +798,7 @@ int rvGEWorkspace::HandleCommand ( WPARAM wParam, LPARAM lParam ) } } else - { + { mSelections.Set ( window ); } } @@ -819,7 +819,7 @@ int rvGEWorkspace::HandleMButtonDown ( WPARAM wParam, LPARAM lParam ) { return 0; } - + mDragPoint.Set ( LOWORD(lParam), HIWORD(lParam) ); mDragScroll = true; SetCursor ( mHandCursor ); @@ -857,28 +857,28 @@ Handles the left mouse down message in the workspace */ int rvGEWorkspace::HandleRButtonDown ( WPARAM wParam, LPARAM lParam ) { - POINT point = { LOWORD(lParam), HIWORD(lParam) }; + POINT point = { LOWORD(lParam), HIWORD(lParam) }; HMENU menu; // Add the select menu mSelectMenu.Clear ( ); - - // Cache where the menu is being brought up so we can + + // Cache where the menu is being brought up so we can // figure out which windows are under the point mSelectMenuPos[0] = point.x; mSelectMenuPos[1] = point.y; - WindowToWorkspace ( mSelectMenuPos ); - + WindowToWorkspace ( mSelectMenuPos ); + // Build a list of all the windows under the menu point rvGEWindowWrapper::GetWrapper ( mInterface->GetDesktop() )->EnumChildren ( BuildSelectMenuEnumProc, this ); - + // Add the desktop window always mSelectMenu.Append ( mInterface->GetDesktop() ); - // + // menu = GetSubMenu ( LoadMenu ( mApplication->GetInstance(), MAKEINTRESOURCE(IDR_GUIED_ITEM_POPUP) ), 0 ); - - HMENU popup = CreatePopupMenu ( ); + + HMENU popup = CreatePopupMenu ( ); int i; for ( i = 0; i < mSelectMenu.Num(); i ++ ) @@ -913,7 +913,7 @@ int rvGEWorkspace::HandleLButtonDown ( WPARAM wParam, LPARAM lParam ) return 0; } - idVec2 point ( LOWORD(lParam), HIWORD(lParam) ); + idVec2 point ( LOWORD(lParam), HIWORD(lParam) ); WindowToWorkspace ( point ); // Make sure whatever modifications get generated cant be merged into whats already there @@ -932,7 +932,7 @@ int rvGEWorkspace::HandleLButtonDown ( WPARAM wParam, LPARAM lParam ) rvGEWindowWrapper* wrapper; wrapper = rvGEWindowWrapper::GetWrapper ( mInterface->GetDesktop ( ) ); - + idWindow* window = wrapper->WindowFromPoint ( point.x, point.y ); // dissallow selection of the desktop. @@ -948,7 +948,7 @@ int rvGEWorkspace::HandleLButtonDown ( WPARAM wParam, LPARAM lParam ) bool selected; selected = mSelections.IsSelected ( window ); - + if ( GetAsyncKeyState ( VK_SHIFT ) & 0x8000 ) { if ( !selected ) @@ -1005,10 +1005,10 @@ int rvGEWorkspace::HandleLButtonUp ( WPARAM wParam, LPARAM lParam ) // Update the transformer mApplication->GetTransformer().Update ( ); } - + // No more dragging mDragType = rvGESelectionMgr::HT_NONE; - + return 0; } @@ -1035,10 +1035,10 @@ Handles the moving of the mouse for dragging and cursor updating int rvGEWorkspace::HandleMouseMove ( WPARAM wParam, LPARAM lParam ) { idVec2 cursor; - + cursor.Set ( (short)LOWORD(lParam), (short)HIWORD(lParam) ); - // Convert the window point to the workspace before updating the + // Convert the window point to the workspace before updating the // cursor with the position WindowToWorkspace ( cursor ); @@ -1047,13 +1047,13 @@ int rvGEWorkspace::HandleMouseMove ( WPARAM wParam, LPARAM lParam ) { Scroll ( SB_HORZ, mDragPoint.x - cursor.x ); Scroll ( SB_VERT, mDragPoint.y - cursor.y ); - + SetCursor ( mHandCursor ); - + mDragPoint = cursor; - + return 0; - } + } // If not dragging then just update the cursor and return if ( mDragType == rvGESelectionMgr::HT_NONE ) @@ -1074,19 +1074,19 @@ int rvGEWorkspace::HandleMouseMove ( WPARAM wParam, LPARAM lParam ) cursor.x = (float)(((int)cursor.x + gApp.GetOptions().GetGridWidth()/2) / gApp.GetOptions().GetGridWidth() * gApp.GetOptions().GetGridWidth()); cursor.y = (float)(((int)cursor.y + gApp.GetOptions().GetGridWidth()/2) / gApp.GetOptions().GetGridWidth() * gApp.GetOptions().GetGridWidth()); } - + // If the cursor hasnt moved then there is nothing to update with the drag if ( (int) cursor.x == (int) mDragPoint.x && (int) cursor.y == (int) mDragPoint.y ) { return 0; } - + switch ( mDragType ) - { + { case rvGESelectionMgr::HT_MOVE: AddModifierMove ( "Move", cursor.x - mDragPoint.x, cursor.y - mDragPoint.y, mApplication->GetOptions().GetGridSnap ( ) ); break; - + case rvGESelectionMgr::HT_SIZE_BOTTOM: AddModifierSize ( "Size", 0, 0, 0, cursor.y - mDragPoint.y, mApplication->GetOptions().GetGridSnap ( ) ); break; @@ -1133,7 +1133,7 @@ int rvGEWorkspace::HandleMouseMove ( WPARAM wParam, LPARAM lParam ) { mDragPoint.y = cursor.y; } - + return 0; } @@ -1159,18 +1159,18 @@ int rvGEWorkspace::HandleKeyDown ( WPARAM wParam, LPARAM lParam ) { AddModifierMoveNudge ( -1, 0, false ); } - break; + break; case VK_RIGHT: if ( shift ) { - AddModifierSizeNudge ( 1, 0, false ); + AddModifierSizeNudge ( 1, 0, false ); } else { - AddModifierMoveNudge ( 1, 0, false ); + AddModifierMoveNudge ( 1, 0, false ); } - break; + break; case VK_DOWN: if ( shift ) @@ -1181,25 +1181,25 @@ int rvGEWorkspace::HandleKeyDown ( WPARAM wParam, LPARAM lParam ) { AddModifierMoveNudge ( 0, 1, false ); } - break; + break; case VK_UP: if ( shift ) { - AddModifierSizeNudge ( 0, -1, false ); + AddModifierSizeNudge ( 0, -1, false ); } else { - AddModifierMoveNudge ( 0, -1, false ); + AddModifierMoveNudge ( 0, -1, false ); } - break; - + break; + case VK_ESCAPE: mSelections.Clear ( ); mApplication->GetNavigator().Update ( ); - break; + break; } - + return 0; } @@ -1267,12 +1267,12 @@ rvGEWorkspace::EZoomLevel rvGEWorkspace::ZoomIn ( void ) { mZoom = ZOOM_MAX - 1; } - + UpdateScrollbars ( ); UpdateTitle ( ); InvalidateRect ( mWnd, NULL, FALSE ); - + return (EZoomLevel)mZoom; } @@ -1295,7 +1295,7 @@ rvGEWorkspace::EZoomLevel rvGEWorkspace::ZoomOut ( void ) UpdateTitle ( ); InvalidateRect ( mWnd, NULL, FALSE ); - + return (EZoomLevel)mZoom; } @@ -1303,32 +1303,32 @@ rvGEWorkspace::EZoomLevel rvGEWorkspace::ZoomOut ( void ) ================ rvGEWorkspace::CreateModifier -Creates a new modifier of the given type for the given window. This function is called +Creates a new modifier of the given type for the given window. This function is called specifically from the add modifiers function with the variable args list forwarded. ================ */ rvGEModifier* rvGEWorkspace::CreateModifier ( EModifierType type, idWindow* window, va_list args ) { - rvGEModifier* mod; + rvGEModifier* mod; switch ( type ) { case MOD_DELETE: mod = new rvGEDeleteModifier ( "Delete", window ); break; - + case MOD_HIDE: mod = new rvGEHideModifier ( "Hide", window, true ); break; - + case MOD_UNHIDE: mod = new rvGEHideModifier ( "Hide", window, false ); - break; + break; case MOD_SEND_BACKWARD: mod = new rvGEZOrderModifier ( "Send Backward", window, rvGEZOrderModifier::ZO_BACKWARD ); break; - + case MOD_SEND_BACK: mod = new rvGEZOrderModifier ( "Send to Back", window, rvGEZOrderModifier::ZO_BACK ); break; @@ -1340,12 +1340,12 @@ rvGEModifier* rvGEWorkspace::CreateModifier ( EModifierType type, idWindow* wind case MOD_BRING_FRONT: mod = new rvGEZOrderModifier ( "Bring to Front", window, rvGEZOrderModifier::ZO_FRONT ); break; - + default: mod = NULL; break; } - + return mod; } @@ -1359,7 +1359,7 @@ Add the specific modifier for the given window void rvGEWorkspace::AddModifiers ( idWindow* window, EModifierType type, ... ) { va_list args; - + va_start(args,type) ; mModifiers.Append ( CreateModifier ( type, window, args ) ); va_end (args) ; @@ -1370,7 +1370,7 @@ void rvGEWorkspace::AddModifiers ( idWindow* window, EModifierType type, ... ) void rvGEWorkspace::AddModifiers ( EModifierType type, ... ) { va_list args; - + // Nothing to move if there is no selection if ( !mSelections.Num ( ) ) { @@ -1381,7 +1381,7 @@ void rvGEWorkspace::AddModifiers ( EModifierType type, ... ) { rvGEModifierGroup* group = new rvGEModifierGroup; int i; - + for ( i = 0; i < mSelections.Num(); i ++ ) { va_start(args,type); @@ -1397,15 +1397,15 @@ void rvGEWorkspace::AddModifiers ( EModifierType type, ... ) va_start(args,type) ; mModifiers.Append ( CreateModifier ( type, mSelections[0], args ) ); va_end (args) ; - } + } SetModified ( true ); } bool rvGEWorkspace::BuildSelectMenuEnumProc ( rvGEWindowWrapper* wrapper, void* data ) { - rvGEWorkspace* workspace; - + rvGEWorkspace* workspace; + workspace = (rvGEWorkspace*) data; assert ( workspace ); @@ -1413,42 +1413,42 @@ bool rvGEWorkspace::BuildSelectMenuEnumProc ( rvGEWindowWrapper* wrapper, void* { return true; } - + wrapper->EnumChildren ( BuildSelectMenuEnumProc, data ); - + if ( wrapper->IsDeleted ( ) || wrapper->IsHidden ( ) ) - { + { return true; } - + if ( wrapper->GetScreenRect ( ).Contains ( workspace->mSelectMenuPos[0], workspace->mSelectMenuPos[1] ) ) { workspace->mSelectMenu.Append ( wrapper->GetWindow ( )); } - + return true; } bool rvGEWorkspace::ShowAllEnumProc ( rvGEWindowWrapper* wrapper, void* data ) { rvGEModifierGroup* group = (rvGEModifierGroup*) data; - + wrapper->EnumChildren ( ShowAllEnumProc, data ); - + if ( wrapper->IsHidden ( ) ) { group->Append ( new rvGEHideModifier ( "Show Hidden", wrapper->GetWindow ( ), false ) ); } - + return true; } void rvGEWorkspace::AddModifierShowAll ( void ) { rvGEModifierGroup* group = new rvGEModifierGroup; - + rvGEWindowWrapper::GetWrapper( mInterface->GetDesktop ( ) )->EnumChildren ( ShowAllEnumProc, group ); - + if ( !group->GetCount ( ) ) { delete group; @@ -1472,7 +1472,7 @@ void rvGEWorkspace::DeleteSelected ( void ) ================ rvGEWorkspace::NewWindow -Create a new window +Create a new window ================ */ idWindow* rvGEWorkspace::NewWindow ( idDict* state, rvGEWindowWrapper::EWindowType type ) @@ -1487,7 +1487,7 @@ idWindow* rvGEWorkspace::NewWindow ( idDict* state, rvGEWindowWrapper::EWindowTy case rvGEWindowWrapper::WT_NORMAL: window = new idWindow ( mInterface->GetDesktop()->GetDC(), mInterface ); break; - + case rvGEWindowWrapper::WT_BIND: window = new idBindWindow ( mInterface->GetDesktop()->GetDC(), mInterface ); break; @@ -1495,7 +1495,7 @@ idWindow* rvGEWorkspace::NewWindow ( idDict* state, rvGEWindowWrapper::EWindowTy case rvGEWindowWrapper::WT_RENDER: window = new idRenderWindow ( mInterface->GetDesktop()->GetDC(), mInterface ); break; - + case rvGEWindowWrapper::WT_CHOICE: window = new idChoiceWindow ( mInterface->GetDesktop()->GetDC(), mInterface ); break; @@ -1503,7 +1503,7 @@ idWindow* rvGEWorkspace::NewWindow ( idDict* state, rvGEWindowWrapper::EWindowTy case rvGEWindowWrapper::WT_EDIT: window = new idEditWindow ( mInterface->GetDesktop()->GetDC(), mInterface ); break; - + default: assert ( false ); return NULL; @@ -1513,7 +1513,7 @@ idWindow* rvGEWorkspace::NewWindow ( idDict* state, rvGEWindowWrapper::EWindowTy baseName.StripQuotes ( ); count = 0; - if ( mInterface->GetDesktop()->FindChildByName ( baseName ) ) + if ( mInterface->GetDesktop()->FindChildByName ( baseName ) ) { count = 1; while ( 1 ) @@ -1535,7 +1535,7 @@ idWindow* rvGEWorkspace::NewWindow ( idDict* state, rvGEWindowWrapper::EWindowTy idStr winName; idStr winTemplate; - + if ( count ) { winName = va("%s%d", baseName.c_str(), count ); @@ -1545,39 +1545,39 @@ idWindow* rvGEWorkspace::NewWindow ( idDict* state, rvGEWindowWrapper::EWindowTy winName = baseName; } winTemplate = winName + " { }"; - + idParser src( winTemplate, winTemplate.Length(), "", LEXFL_ALLOWMULTICHARLITERALS | LEXFL_NOSTRINGCONCAT | LEXFL_ALLOWBACKSLASHSTRINGCONCAT ); window->Parse ( &src ); wrapper = rvGEWindowWrapper::GetWrapper ( window ); - + if ( state ) { wrapper->SetState ( *state ); } - + wrapper->SetStateKey ( "name", winName ); wrapper->Finish ( ); SetModified ( true ); - - + + return window; } idWindow* rvGEWorkspace::AddWindow ( rvGEWindowWrapper::EWindowType type ) { - idWindow* window; + idWindow* window; idDict state; - + state.Set ( "rect", "0,0,100,100" ); state.Set ( "visible", "1" ); - + window = NewWindow ( &state, type ); assert ( window ); mModifiers.Append ( new rvGEInsertModifier ( "New", window, mInterface->GetDesktop(), NULL ) ); - + mSelections.Set ( window ); mApplication->GetNavigator().Update ( ); mApplication->GetTransformer().Update ( ); @@ -1592,18 +1592,18 @@ bool rvGEWorkspace::EditSelectedProperties ( void ) { return false; } - + idDict dict; if ( GEItemPropsDlg_DoModal ( mWnd, mSelections[0], dict ) ) { mModifiers.Append ( new rvGEStateModifier ( "Item Properties", mSelections[0], dict ) ); SetModified ( true ); - } - - mApplication->GetNavigator().Update ( ); + } + + mApplication->GetNavigator().Update ( ); mApplication->GetTransformer().Update ( ); mApplication->GetProperties().Update ( ); - + return true; } @@ -1614,32 +1614,32 @@ bool rvGEWorkspace::EditSelectedScripts ( void ) gApp.GetNavigator().Refresh ( ); SetModified ( true ); } - + return true; -} +} void rvGEWorkspace::BringSelectedForward ( void ) { AddModifiers ( MOD_BRING_FORWARD ); - mApplication->GetNavigator().Update ( ); + mApplication->GetNavigator().Update ( ); } void rvGEWorkspace::BringSelectedToFront ( void ) { AddModifiers ( MOD_BRING_FRONT ); - mApplication->GetNavigator().Update ( ); + mApplication->GetNavigator().Update ( ); } void rvGEWorkspace::SendSelectedToBack ( void ) { AddModifiers ( MOD_SEND_BACK ); - mApplication->GetNavigator().Update ( ); + mApplication->GetNavigator().Update ( ); } void rvGEWorkspace::SendSelectedBackward ( void ) { AddModifiers ( MOD_SEND_BACKWARD ); - mApplication->GetNavigator().Update ( ); + mApplication->GetNavigator().Update ( ); } /* @@ -1660,28 +1660,28 @@ void rvGEWorkspace::MakeSelectedSameSize ( bool changeWidth, bool changeHeight ) rectTo = rvGEWindowWrapper::GetWrapper ( mSelections[0] )->GetClientRect ( ); for ( i = 1; i < mSelections.Num(); i ++ ) - { + { idRectangle rectFrom; float width = 0; float height = 0; - rectFrom = rvGEWindowWrapper::GetWrapper(mSelections[i])->GetClientRect (); - + rectFrom = rvGEWindowWrapper::GetWrapper(mSelections[i])->GetClientRect (); + if ( changeWidth ) { width = rectTo.w - rectFrom.w; } - + if ( changeHeight ) { height = rectTo.h - rectFrom.h; } - - group->Append ( new rvGESizeModifier ( "Make Same Size", mSelections[i], 0, 0, width, height ) ); + + group->Append ( new rvGESizeModifier ( "Make Same Size", mSelections[i], 0, 0, width, height ) ); } mModifiers.Append ( group ); - + // Cant merge alignments mModifiers.BlockNextMerge ( ); @@ -1701,16 +1701,16 @@ void rvGEWorkspace::AlignSelected ( EItemAlign align ) int i; idStr modName; rvGEModifierGroup* group; - + assert ( mSelections.Num() > 1 ); modName = "Align " + idStr(alignNames[align]); - + group = new rvGEModifierGroup ( ); idRectangle rectTo; rectTo = rvGEWindowWrapper::GetWrapper ( mSelections[0] )->GetScreenRect ( ); - + // Everything gets aligned to the first selection so run // through all other selections and move them. for ( i = 1; i < mSelections.Num(); i ++ ) @@ -1720,49 +1720,49 @@ void rvGEWorkspace::AlignSelected ( EItemAlign align ) idRectangle rectFrom; rectFrom = rvGEWindowWrapper::GetWrapper ( mSelections[i] )->GetScreenRect ( ); - + switch ( align ) { case ALIGN_LEFTS: x = rectTo[0] - rectFrom[0]; y = 0; break; - + case ALIGN_RIGHTS: x = (rectTo[0]+rectTo[2]) - (rectFrom[0]+rectFrom[2]); y = 0; break; - + case ALIGN_CENTERS: x = (rectTo[0]+rectTo[2]/2) - (rectFrom[0]+rectFrom[2]/2); y = 0; break; - + case ALIGN_TOPS: y = rectTo[1] - rectFrom[1]; x = 0; break; - + case ALIGN_BOTTOMS: x = 0; y = (rectTo[1]+rectTo[3]) - (rectFrom[1]+rectFrom[3]); break; - + case ALIGN_MIDDLES: x = 0; y = (rectTo[1]+rectTo[3]/2) - (rectFrom[1]+rectFrom[3]/2); break; - + default: assert ( false ); break; } - + group->Append ( new rvGEMoveModifier ( modName, mSelections[i], x, y ) ); } - + mModifiers.Append ( group ); - + // Cant merge alignments mModifiers.BlockNextMerge ( ); @@ -1782,7 +1782,7 @@ void rvGEWorkspace::AddModifierMove ( const char* modName, float x, float y, boo idRectangle newRect; scaleRect = mSelections.GetRect ( ); - WindowToWorkspace ( scaleRect ); + WindowToWorkspace ( scaleRect ); newRect = scaleRect; newRect.x += x; newRect.y += y; @@ -1799,7 +1799,7 @@ void rvGEWorkspace::AddModifierMove ( const char* modName, float x, float y, boo { continue; } - + // IF the parent window is being moved around as well then dont move this one. if ( rvGEWindowWrapper::GetWrapper ( mSelections[i]->GetParent ( ) )->IsSelected ( ) ) { @@ -1808,10 +1808,10 @@ void rvGEWorkspace::AddModifierMove ( const char* modName, float x, float y, boo group->Append ( new rvGEMoveModifier ( modName, mSelections[i], 0, 0 ) ); continue; } - + group->Append ( new rvGEMoveModifier ( modName, mSelections[i], newRect.x-scaleRect.x, newRect.y-scaleRect.y ) ); } - + mModifiers.Append ( group ); SetModified ( true ); @@ -1829,9 +1829,9 @@ void rvGEWorkspace::AddModifierSize ( const char* modName, float l, float t, flo idRectangle scaleRect; idRectangle sizeRect; idRectangle newRect; - + scaleRect = mSelections.GetRect ( ); - WindowToWorkspace ( scaleRect ); + WindowToWorkspace ( scaleRect ); newRect = scaleRect; newRect.x += l; newRect.y += t; @@ -1868,17 +1868,17 @@ void rvGEWorkspace::AddModifierSize ( const char* modName, float l, float t, flo { gApp.GetOptions ().SnapRectToGrid ( newRect, l != 0.0f, t != 0.0f, r != 0.0f, b != 0.0f ); } - + rvGEModifierGroup* group = new rvGEModifierGroup; for ( int i = 0; i < mSelections.Num(); i ++ ) { - sizeRect = rvGEWindowWrapper::GetWrapper ( mSelections[i] )->GetScreenRect ( ); - + sizeRect = rvGEWindowWrapper::GetWrapper ( mSelections[i] )->GetScreenRect ( ); + l = (newRect.x + ((sizeRect.x - scaleRect.x) / scaleRect.w) * newRect.w) - sizeRect.x; t = (newRect.y + ((sizeRect.y - scaleRect.y) / scaleRect.h) * newRect.h) - sizeRect.y; r = (sizeRect.w / scaleRect.w * newRect.w) - sizeRect.w + l; b = (sizeRect.h / scaleRect.h * newRect.h) - sizeRect.h + t; - + // This is sorta crufty but needs to be done. When a parent is being sized at the same // time as a child you will get double movement because the child is relative to the parent. Therefore // we need to subtract out the closest parents sizing. @@ -1887,31 +1887,31 @@ void rvGEWorkspace::AddModifierSize ( const char* modName, float l, float t, flo { rvGEWindowWrapper* pwrapper = rvGEWindowWrapper::GetWrapper ( parent ); float offset; - + if ( !pwrapper->IsSelected ( ) ) { continue; } - - sizeRect = pwrapper->GetScreenRect ( ); - + + sizeRect = pwrapper->GetScreenRect ( ); + // Subtract out the left and right modifications offset = ((newRect.x + ((sizeRect.x - scaleRect.x) / scaleRect.w) * newRect.w) - sizeRect.x); l -= offset; r -= offset; - + // Subtract out the top and bottom modifications offset = ((newRect.y + ((sizeRect.y - scaleRect.y) / scaleRect.h) * newRect.h) - sizeRect.y); t -= offset; b -= offset; - + break; - } - - group->Append ( new rvGESizeModifier ( modName, mSelections[i], l, t, r, b ) ); + } + + group->Append ( new rvGESizeModifier ( modName, mSelections[i], l, t, r, b ) ); } - mModifiers.Append ( group ); + mModifiers.Append ( group ); SetModified ( true ); } @@ -1927,14 +1927,14 @@ void rvGEWorkspace::MakeSelectedAChild ( void ) { rvGEModifierGroup* group; int i; - + if ( !rvGEWindowWrapper::GetWrapper ( mSelections[0] )->CanHaveChildren ( ) ) { gApp.MessageBox ( "Cannot add children to an htmlDef item", MB_OK|MB_ICONERROR ); return; } - - group = new rvGEModifierGroup; + + group = new rvGEModifierGroup; for ( i = 1; i < mSelections.Num(); i ++ ) { @@ -1942,17 +1942,17 @@ void rvGEWorkspace::MakeSelectedAChild ( void ) { continue; } - + if ( !mSelections[i]->GetParent ( ) ) - { + { continue; - } + } group->Append ( new rvGEInsertModifier ( "Make Child", mSelections[i], mSelections[0], NULL ) ); } mModifiers.Append ( group ); - + // Navigator needs an update since the ordering has changed gApp.GetNavigator().Update ( ); @@ -1962,27 +1962,27 @@ void rvGEWorkspace::MakeSelectedAChild ( void ) void rvGEWorkspace::Copy ( void ) { int i; - - // Clear the current clipboard + + // Clear the current clipboard for ( i = 0; i < mClipboard.Num(); i ++ ) { delete mClipboard[i]; } - + mClipboard.Clear ( ); - + for ( i = 0; i < mSelections.Num(); i ++ ) { rvGEWindowWrapper* wrapper = rvGEWindowWrapper::GetWrapper ( mSelections[i] ); assert ( wrapper ); - + rvGEClipboardItem* item = new rvGEClipboardItem; item->mStateDict = wrapper->GetStateDict ( ); item->mScriptDict = wrapper->GetScriptDict ( ); item->mVarDict = wrapper->GetVariableDict ( ); item->mStateDict.Set ( "windowType", rvGEWindowWrapper::WindowTypeToString ( wrapper->GetWindowType ( ) ) ); - + mClipboard.Append ( item ); } } @@ -1990,32 +1990,32 @@ void rvGEWorkspace::Copy ( void ) void rvGEWorkspace::Paste ( void ) { int i; - + rvGEModifierGroup* group = new rvGEModifierGroup; mSelections.Clear ( ); - + for ( i = 0; i < mClipboard.Num(); i ++ ) { idDict state; rvGEWindowWrapper::EWindowType type; - + state.Copy ( mClipboard[i]->mStateDict ); type = rvGEWindowWrapper::StringToWindowType ( state.GetString ( "windowType", "windowDef" ) ); state.Delete ( "windowType" ); - + idWindow* window = NewWindow ( &state, type ); group->Append ( new rvGEInsertModifier ( "Paste", window, mInterface->GetDesktop(), NULL ) ); mSelections.Add ( window ); - + rvGEWindowWrapper::GetWrapper ( window )->GetScriptDict ( ) = mClipboard[i]->mScriptDict; rvGEWindowWrapper::GetWrapper ( window )->GetVariableDict ( ) = mClipboard[i]->mVarDict; } - + mModifiers.Append ( group ); mApplication->GetNavigator().Update ( ); - + SetModified ( true ); } diff --git a/neo/tools/guied/GEWorkspace.h b/neo/tools/guied/GEWorkspace.h index 7ec199a9..17002722 100644 --- a/neo/tools/guied/GEWorkspace.h +++ b/neo/tools/guied/GEWorkspace.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 @@ public: ZOOM_300, ZOOM_MAX }; - + enum EItemAlign { ALIGN_LEFTS, @@ -85,24 +85,24 @@ public: rvGEWorkspace ( rvGEApp* app ); ~rvGEWorkspace ( ); - + // Attach the workspace to a win32 window bool Attach ( HWND wnd ); - + // Detach the workspace from the current win32 window void Detach ( void ); - - bool NewFile ( void ); + + bool NewFile ( void ); bool LoadFile ( const char* filename, idStr* error = NULL ); bool SaveFile ( const char* filename ); const char* GetFilename ( void ); - + // Source control methods bool CheckOut ( void ); - bool CheckIn ( void ); + bool CheckIn ( void ); bool UndoCheckout ( void ); - ESourceControlState GetSourceControlState ( void ); - + ESourceControlState GetSourceControlState ( void ); + void Render ( HDC hDC ); rvGEApp* GetApplication ( void ); @@ -125,12 +125,12 @@ public: void HideWindow ( idWindow* window ); void UnhideWindow ( idWindow* window ); - EZoomLevel ZoomIn ( void ); - EZoomLevel ZoomOut ( void ); + EZoomLevel ZoomIn ( void ); + EZoomLevel ZoomOut ( void ); EZoomLevel GetZoom ( void ); float GetZoomScale ( void ); - - static rvGEWorkspace* GetWorkspace ( HWND wnd ); + + static rvGEWorkspace* GetWorkspace ( HWND wnd ); rvGEModifierStack& GetModifierStack ( void ); idUserInterfaceLocal* GetInterface ( void ); rvGESelectionMgr& GetSelectionMgr ( void ); @@ -138,17 +138,17 @@ public: HWND GetWindow ( void ); void HandleMessage ( UINT msg, WPARAM wParam, LPARAM lParam ); - + idVec2& WindowToWorkspace ( idVec2& point ); idVec2& WorkspaceToWindow ( idVec2& point ); idRectangle& WindowToWorkspace ( idRectangle& rect ); idRectangle& WorkspaceToWindow ( idRectangle& rect ); - + bool IsModified ( void ); bool IsNew ( void ); idWindow* AddWindow ( rvGEWindowWrapper::EWindowType type ); - + // void Cut ( void ); void Copy ( void ); void Paste ( void ); @@ -209,37 +209,37 @@ protected: void AddModifierMoveNudge( float x, float y, bool snap ); void AddModifierSizeNudge( float w, float h, bool snap ); void AddModifierShowAll ( void ); - + void AddModifiers ( EModifierType type, ... ); void AddModifiers ( idWindow* window, EModifierType type, ... ); rvGEModifier* CreateModifier ( EModifierType type, idWindow* window, va_list args ); idUserInterfaceLocal* mInterface; - HWND mWnd; - + HWND mWnd; + int mZoom; idRectangle mRect; - + bool mScrollHorz; bool mScrollVert; - + int mWindowWidth; int mWindowHeight; - + idStr mFilename; - + rvGEModifierStack mModifiers; rvGESelectionMgr mSelections; - + rvGESelectionMgr::EHitTest mDragType; idVec2 mDragPoint; int mDragTime; bool mDragX; bool mDragY; bool mDragScroll; - + rvGEApp* mApplication; - + static idList mClipboard; idList mSelectMenu; idVec2 mSelectMenuPos; @@ -255,7 +255,7 @@ private: bool mNew; bool mDontAdd; ESourceControlState mSourceControlState; - + // Resources HCURSOR mHandCursor; }; diff --git a/neo/tools/guied/GEWorkspaceFile.cpp b/neo/tools/guied/GEWorkspaceFile.cpp index 00a5c1fe..725f96cf 100644 --- a/neo/tools/guied/GEWorkspaceFile.cpp +++ b/neo/tools/guied/GEWorkspaceFile.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"). @@ -46,16 +46,16 @@ bool rvGEWorkspace::SaveFile ( const char* filename ) idWindow* window; SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_WAIT ) ) ); - + mFilename = filename; - - // Since quake can only write to its path we will write a temp file then copy it over + + // Since quake can only write to its path we will write a temp file then copy it over idStr tempfile; idStr ospath; - + tempfile = "guis/temp.guied"; ospath = fileSystem->RelativePathToOSPath ( tempfile, "fs_basepath" ); - + // Open the output file for write if ( !(file = fileSystem->OpenFileWrite ( tempfile ) ) ) { @@ -63,29 +63,29 @@ bool rvGEWorkspace::SaveFile ( const char* filename ) SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_ARROW ) ) ); return false; } - + window = mInterface->GetDesktop ( ); - + WriteWindow ( file, 1, window ); - + fileSystem->CloseFile ( file ); - + if ( !CopyFile ( ospath, filename, FALSE ) ) { DeleteFile ( ospath ); SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_ARROW ) ) ); return false; } - + DeleteFile ( ospath ); mFilename = filename; mModified = false; mNew = false; - UpdateTitle ( ); + UpdateTitle ( ); SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_ARROW ) ) ); - + return true; } @@ -99,7 +99,7 @@ Writes the given number of tabs to the given file void rvGEWorkspace::WriteTabs ( idFile* file, int depth ) { int i; - + for ( i = 0; i < depth; i ++ ) { file->Write ( "\t", 1 ); @@ -130,54 +130,54 @@ bool rvGEWorkspace::WriteWindow ( idFile* file, int depth, idWindow* window ) return true; } - // Window def header + // Window def header WriteTabs ( file, depth - 1 ); - - out = wrapper->WindowTypeToString ( wrapper->GetWindowType ( ) ); + + out = wrapper->WindowTypeToString ( wrapper->GetWindowType ( ) ); out.Append ( " " ); - file->Write ( out, out.Length() ); + file->Write ( out, out.Length() ); out = window->GetName ( ); file->Write ( out, out.Length() ); file->Write ( "\r\n", 2 ); - + WriteTabs ( file, depth - 1 ); - + out = "{\r\n"; file->Write ( out, out.Length() ); file->ForceFlush ( ); for ( i = 0; i < wrapper->GetStateDict().GetNumKeyVals(); i ++ ) { - const idKeyValue* key = wrapper->GetStateDict().GetKeyVal ( i ); + const idKeyValue* key = wrapper->GetStateDict().GetKeyVal ( i ); // Dont write name to the files if ( !key->GetKey().Icmp ( "name" ) ) { continue; } - + WriteTabs ( file, depth ); - + out = key->GetKey(); out.Append ( "\t" ); file->Write ( out, out.Length() ); const char* p; for ( p = key->GetValue().c_str(); *p; p ++ ) - { + { switch ( *p ) { case '\n': file->Write ( "\\n", 2 ); break; - + default: file->Write ( p, 1 ); break; } } - + file->Write ( "\r\n", 2 ); } @@ -191,7 +191,7 @@ bool rvGEWorkspace::WriteWindow ( idFile* file, int depth, idWindow* window ) out.Append ( "\t" ); out.Append ( key->GetValue() ); out.Append ( "\r\n" ); - + file->Write ( out, out.Length() ); } @@ -205,13 +205,13 @@ bool rvGEWorkspace::WriteWindow ( idFile* file, int depth, idWindow* window ) const idKeyValue* key = wrapper->GetScriptDict().GetKeyVal ( i ); WriteTabs ( file, depth ); - + file->Write ( key->GetKey(), key->GetKey().Length() ); file->Write ( " ", 1 ); idLexer src( key->GetValue(), key->GetValue().Length(), "", LEXFL_ALLOWMULTICHARLITERALS | LEXFL_NOSTRINGCONCAT | LEXFL_ALLOWBACKSLASHSTRINGCONCAT ); - src.ParseBracedSectionExact ( out, depth + 1); - + src.ParseBracedSectionExact ( out, depth + 1); + file->Write ( out, out.Length() ); file->Write ( "\r\n", 2 ); file->Write ( "\r\n", 2 ); @@ -220,17 +220,17 @@ bool rvGEWorkspace::WriteWindow ( idFile* file, int depth, idWindow* window ) for ( i = 0; i < wrapper->GetChildCount(); i ++ ) { idWindow* child = wrapper->GetChild ( i ); - - WriteWindow ( file, depth + 1, child ); + + WriteWindow ( file, depth + 1, child ); } // Window def footer WriteTabs ( file, depth - 1 ); - + out = "}\r\n"; file->Write ( out, out.Length() ); file->ForceFlush ( ); - + return true; } @@ -244,20 +244,20 @@ Opens a new file for editing bool rvGEWorkspace::NewFile ( void ) { idStr empty; - idStr ospath; + idStr ospath; idFile* file; - // Make a temporary file with nothing in it so we can just use + // Make a temporary file with nothing in it so we can just use // load to do all the work ospath = fileSystem->RelativePathToOSPath ( "guis/Untitled.guiednew", "fs_basepath" ); DeleteFile ( ospath ); - + file = fileSystem->OpenFileWrite ( "guis/Untitled.guiednew" ); if ( NULL == file ) { return false; } - + empty = "windowDef Desktop { rect 0,0,640,480 }"; file->Write ( empty, empty.Length() ); fileSystem->CloseFile ( file ); @@ -269,18 +269,18 @@ bool rvGEWorkspace::NewFile ( void ) DeleteFile ( ospath ); return false; } - + mNew = true; - + // Ensure the temp file doesnt hang around DeleteFile ( ospath ); - + // Go back to using a .gui extensions ospath.StripFileExtension ( ); ospath.Append ( ".gui" ); - + mFilename = ospath; - + return true; } @@ -298,7 +298,7 @@ bool rvGEWorkspace::LoadFile ( const char* filename, idStr* error ) idStr tempfile; idStr ospath; bool result; - + tempfile = "guis/temp.guied"; ospath = fileSystem->RelativePathToOSPath ( tempfile, "fs_basepath" ); @@ -317,17 +317,17 @@ bool rvGEWorkspace::LoadFile ( const char* filename, idStr* error ) } return false; } - + SetFileAttributes ( ospath, FILE_ATTRIBUTE_NORMAL ); mFilename = filename; UpdateTitle ( ); - + // Let the real window system parse it first mInterface = NULL; result = true; - try - { + try + { mInterface = reinterpret_cast< idUserInterfaceLocal* >( uiManager->FindGui( tempfile, true, true ) ); if ( !mInterface && error ) { @@ -351,7 +351,7 @@ bool rvGEWorkspace::LoadFile ( const char* filename, idStr* error ) else { DeleteFile ( ospath ); - } + } return result; } @@ -392,4 +392,3 @@ bool rvGEWorkspace::UndoCheckout ( void ) { return false; } - diff --git a/neo/tools/guied/GEZOrderModifier.cpp b/neo/tools/guied/GEZOrderModifier.cpp index 199ff8b9..5ca9a07b 100644 --- a/neo/tools/guied/GEZOrderModifier.cpp +++ b/neo/tools/guied/GEZOrderModifier.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"). @@ -39,16 +39,16 @@ rvGEZOrderModifier::rvGEZOrderModifier ( const char* name, idWindow* window, EZO int count; int index; idWindow* parent; - + parent = window->GetParent ( ); - if ( !parent ) + if ( !parent ) { return; } - + count = parent->GetChildCount ( ); index = parent->GetChildIndex ( mWindow ); - + if ( index + 1 >= count ) { mUndoBefore = NULL; @@ -57,13 +57,13 @@ rvGEZOrderModifier::rvGEZOrderModifier ( const char* name, idWindow* window, EZO { mUndoBefore = parent->GetChild ( index + 1 ); } - + switch ( change ) { case ZO_FORWARD: - index+=2; + index+=2; break; - + case ZO_BACKWARD: if ( index == 0 ) { @@ -74,11 +74,11 @@ rvGEZOrderModifier::rvGEZOrderModifier ( const char* name, idWindow* window, EZO index-=1; } break; - + case ZO_BACK: index = 0; break; - + case ZO_FRONT: index = count; break; @@ -97,11 +97,11 @@ rvGEZOrderModifier::rvGEZOrderModifier ( const char* name, idWindow* window, EZO bool rvGEZOrderModifier::Apply ( void ) { idWindow* parent; - + parent = mWindow->GetParent ( ); - + parent->RemoveChild ( mWindow ); - parent->InsertChild ( mWindow, mBefore ); + parent->InsertChild ( mWindow, mBefore ); return true; } @@ -109,12 +109,12 @@ bool rvGEZOrderModifier::Apply ( void ) bool rvGEZOrderModifier::Undo ( void ) { idWindow* parent; - + parent = mWindow->GetParent ( ); - + parent->RemoveChild ( mWindow ); - parent->InsertChild ( mWindow, mUndoBefore ); - + parent->InsertChild ( mWindow, mUndoBefore ); + return true; } @@ -124,6 +124,6 @@ bool rvGEZOrderModifier::IsValid ( void ) { return false; } - + return true; } diff --git a/neo/tools/guied/GEZOrderModifier.h b/neo/tools/guied/GEZOrderModifier.h index c38ceb6c..2c3e6dab 100644 --- a/neo/tools/guied/GEZOrderModifier.h +++ b/neo/tools/guied/GEZOrderModifier.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,15 +45,15 @@ public: }; rvGEZOrderModifier ( const char* name, idWindow* window, EZOrderChange change ); - + virtual bool Apply ( void ); virtual bool Undo ( void ); virtual bool IsValid ( void ); - + protected: - + idWindow* mBefore; idWindow* mUndoBefore; -}; +}; #endif // GEZORDERMODIFIER_H_ \ No newline at end of file diff --git a/neo/tools/guied/guied.cpp b/neo/tools/guied/guied.cpp index d12d2d55..50d4e929 100644 --- a/neo/tools/guied/guied.cpp +++ b/neo/tools/guied/guied.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"). @@ -39,7 +39,7 @@ If you have questions concerning this license or the applicable additional terms #include "GEApp.h" rvGEApp gApp; - + /* ================ GUIEditorInit @@ -47,7 +47,7 @@ GUIEditorInit Start the gui editor ================ */ -void GUIEditorInit( void ) +void GUIEditorInit( void ) { gApp.Initialize(); } @@ -81,26 +81,26 @@ bool GUIEditorHandleMessage ( void *msg ) ================ GUIEditorRun -Run a frame +Run a frame ================ */ -void GUIEditorRun() +void GUIEditorRun() { - MSG msg; + MSG msg; // pump the message loop - while (PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE)) + while (PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE)) { - if ( !GetMessage (&msg, NULL, 0, 0) ) + if ( !GetMessage (&msg, NULL, 0, 0) ) { common->Quit(); } // save the msg time, because wndprocs don't have access to the timestamp - if ( win32.sysMsgTime && win32.sysMsgTime > (int)msg.time ) + if ( win32.sysMsgTime && win32.sysMsgTime > (int)msg.time ) { - } - else + } + else { win32.sysMsgTime = msg.time; } @@ -109,13 +109,13 @@ void GUIEditorRun() { continue; } - + TranslateMessage (&msg); DispatchMessage (&msg); } gApp.RunFrame ( ); - + // The GUI editor runs too hot so we need to slow it down a bit. Sleep ( 1 ); } @@ -145,9 +145,9 @@ Returns true if the given string is an expression */ bool IsExpression ( const char* s ) { - idParser src( s, strlen ( s ), "", - LEXFL_ALLOWMULTICHARLITERALS | - LEXFL_NOSTRINGCONCAT | + idParser src( s, strlen ( s ), "", + LEXFL_ALLOWMULTICHARLITERALS | + LEXFL_NOSTRINGCONCAT | LEXFL_ALLOWBACKSLASHSTRINGCONCAT | LEXFL_NOFATALERRORS ); @@ -162,19 +162,19 @@ bool IsExpression ( const char* s ) needComma = true; needNumber = false; break; - + case TT_PUNCTUATION: if ( needNumber ) { return true; - } + } if ( token[0] == ',' ) { if ( !needComma ) { return true; } - + needComma = false; break; } @@ -189,11 +189,11 @@ bool IsExpression ( const char* s ) needNumber = true; } break; - + default: return true; } } - + return false; } diff --git a/neo/tools/materialeditor/ConsoleView.cpp b/neo/tools/materialeditor/ConsoleView.cpp index a2aabe38..cb633324 100644 --- a/neo/tools/materialeditor/ConsoleView.cpp +++ b/neo/tools/materialeditor/ConsoleView.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 @@ void ConsoleView::AddText( const char *msg ) { } editConsole.SetSel( len, len ); editConsole.ReplaceSel( work ); - + //Hack: scrolls down a bit editConsole.LineScroll(100); } @@ -114,19 +114,19 @@ void ConsoleView::ExecuteCommand ( const idStr& cmd ) { editInput.GetWindowText(str); } - if ( str != "" ) { + if ( str != "" ) { editInput.SetWindowText(""); - common->Printf("%s\n", str.GetBuffer(0)); + common->Printf("%s\n", str.GetBuffer(0)); //avoid adding multiple identical commands in a row int index = consoleHistory.Num (); - if ( index == 0 || str.GetBuffer(0) != consoleHistory[index-1]) { + if ( index == 0 || str.GetBuffer(0) != consoleHistory[index-1]) { //keep the history to 16 commands, removing the oldest command if ( consoleHistory.Num () > 16 ) { consoleHistory.RemoveIndex ( 0 ); } - currentHistoryPosition = consoleHistory.Append ( str.GetBuffer (0) ); + currentHistoryPosition = consoleHistory.Append ( str.GetBuffer (0) ); } else { currentHistoryPosition = consoleHistory.Num () - 1; @@ -151,7 +151,7 @@ void ConsoleView::ExecuteCommand ( const idStr& cmd ) { } /** -* Handles keyboard input to process the "Enter" key to execute +* Handles keyboard input to process the "Enter" key to execute * commands and command history. */ BOOL ConsoleView::PreTranslateMessage(MSG* pMsg) { @@ -163,7 +163,7 @@ BOOL ConsoleView::PreTranslateMessage(MSG* pMsg) { return TRUE; } - if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_UP ) { + if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_UP ) { //save off the current in-progress command so we can get back to it if ( saveCurrentCommand == true ) { CString str; @@ -186,7 +186,7 @@ BOOL ConsoleView::PreTranslateMessage(MSG* pMsg) { return TRUE; } - if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_DOWN ) { + if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_DOWN ) { int selLocation = 0; if ( currentHistoryPosition < consoleHistory.Num () - 1 ) { ++currentHistoryPosition; @@ -204,7 +204,7 @@ BOOL ConsoleView::PreTranslateMessage(MSG* pMsg) { return TRUE; } - if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB ) { + if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB ) { common->Printf ( "Command History\n----------------\n" ); for ( int i = 0 ; i < consoleHistory.Num ();i++ ) { @@ -212,20 +212,20 @@ BOOL ConsoleView::PreTranslateMessage(MSG* pMsg) { } common->Printf ( "----------------\n" ); } - if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_NEXT) { - editConsole.LineScroll ( 10 ); + if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_NEXT) { + editConsole.LineScroll ( 10 ); } - if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_PRIOR ) { - editConsole.LineScroll ( -10 ); + if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_PRIOR ) { + editConsole.LineScroll ( -10 ); } - if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_HOME ) { - editConsole.LineScroll ( -editConsole.GetLineCount() ); + if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_HOME ) { + editConsole.LineScroll ( -editConsole.GetLineCount() ); } - if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_END ) { - editConsole.LineScroll ( editConsole.GetLineCount() ); + if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_END ) { + editConsole.LineScroll ( editConsole.GetLineCount() ); } } @@ -246,7 +246,7 @@ void ConsoleView::DoDataExchange(CDataExchange* pDX) { * Transfers data to and from the controls in the console. */ void ConsoleView::OnInitialUpdate() { - + CFormView::OnInitialUpdate(); CRect rect; diff --git a/neo/tools/materialeditor/ConsoleView.h b/neo/tools/materialeditor/ConsoleView.h index 1367b0c8..ca2ade5a 100644 --- a/neo/tools/materialeditor/ConsoleView.h +++ b/neo/tools/materialeditor/ConsoleView.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"). @@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms /** * View in the Material Editor that functions as a Doom III -* console. It allows users to view console output as well as issue +* console. It allows users to view console output as well as issue * console commands to the engine. */ class ConsoleView : public CFormView @@ -42,7 +42,7 @@ public: CEdit editConsole; CEdit editInput; - + idStr consoleStr; idStrList consoleHistory; idStr currentCommand; @@ -56,8 +56,8 @@ public: void AddText(const char *msg); void SetConsoleText ( const idStr& text ); void ExecuteCommand ( const idStr& cmd = "" ); - - + + protected: ConsoleView(); DECLARE_DYNCREATE(ConsoleView) @@ -69,7 +69,7 @@ protected: //Message Handlers afx_msg void OnSize(UINT nType, int cx, int cy); - DECLARE_MESSAGE_MAP() + DECLARE_MESSAGE_MAP() //Protected Operations const char* TranslateString(const char *buf); diff --git a/neo/tools/materialeditor/FindDialog.cpp b/neo/tools/materialeditor/FindDialog.cpp index b468c265..33178585 100644 --- a/neo/tools/materialeditor/FindDialog.cpp +++ b/neo/tools/materialeditor/FindDialog.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"). @@ -76,7 +76,7 @@ void FindDialog::DoDataExchange(CDataExchange* pDX) { } /** -* Called while the dialog is being initialized to load the find parameters +* Called while the dialog is being initialized to load the find parameters * from the registry and set the focus to the correct control. */ BOOL FindDialog::OnInitDialog() { @@ -122,7 +122,7 @@ void FindDialog::LoadFindSettings() { searchData.searchScope = (int)registry.GetFloat("searchScope"); registry.GetWindowPlacement("findDialog", GetSafeHwnd()); - + UpdateData(FALSE); } @@ -136,10 +136,8 @@ void FindDialog::SaveFindSettings() { registry.SetString("searchText", searchData.searchText); registry.SetFloat("nameOnly", searchData.nameOnly); registry.SetFloat("searchScope", searchData.searchScope); - + registry.SetWindowPlacement("findDialog", GetSafeHwnd()); registry.Save(); } - - diff --git a/neo/tools/materialeditor/FindDialog.h b/neo/tools/materialeditor/FindDialog.h index a41f3b72..bab04d97 100644 --- a/neo/tools/materialeditor/FindDialog.h +++ b/neo/tools/materialeditor/FindDialog.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"). @@ -42,7 +42,7 @@ class FindDialog : public CDialog public: enum { IDD = IDD_FIND }; - + public: FindDialog(CWnd* pParent = NULL); virtual ~FindDialog(); diff --git a/neo/tools/materialeditor/MEMainFrame.cpp b/neo/tools/materialeditor/MEMainFrame.cpp index a5b8a9c2..c628c2b4 100644 --- a/neo/tools/materialeditor/MEMainFrame.cpp +++ b/neo/tools/materialeditor/MEMainFrame.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,7 +47,7 @@ BEGIN_MESSAGE_MAP(MEMainFrame, CFrameWnd) ON_WM_SIZE() ON_NOTIFY(TCN_SELCHANGE, TAB_CONTROL, OnTcnSelChange) - + ON_COMMAND(ID_ME_FILE_EXIT, OnFileExit) ON_COMMAND(ID_ME_FILE_SAVEMATERIAL, OnFileSaveMaterial) ON_COMMAND(ID_ME_FILE_SAVEFILE, OnFileSaveFile) @@ -55,7 +55,7 @@ BEGIN_MESSAGE_MAP(MEMainFrame, CFrameWnd) ON_UPDATE_COMMAND_UI(ID_ME_FILE_SAVEMATERIAL, OnFileSaveMaterialUpdate ) ON_UPDATE_COMMAND_UI(ID_ME_FILE_SAVEFILE, OnFileSaveFileUpdate ) ON_UPDATE_COMMAND_UI(ID_ME_FILE_SAVE, OnFileSaveAllUpdate ) - + ON_COMMAND(ID_ME_PREVIEW_APPLYCHANGES, OnApplyMaterial) ON_COMMAND(ID_ME_PREVIEW_APPLYFILE, OnApplyFile) ON_COMMAND(ID_ME_PREVIEW_APPLYALL, OnApplyAll) @@ -81,10 +81,10 @@ BEGIN_MESSAGE_MAP(MEMainFrame, CFrameWnd) ON_COMMAND(ID_ME_EDIT_REDO, OnEditRedo) ON_UPDATE_COMMAND_UI(ID_ME_EDIT_UNDO, OnEditUndoUpdate ) ON_UPDATE_COMMAND_UI(ID_ME_EDIT_REDO, OnEditRedoUpdate ) - + ON_COMMAND(ID_VIEW_INCLUDEFILENAME, OnViewIncludeFile) ON_COMMAND(ID_PREVIEW_RELOADARBPROGRAMS, OnReloadArbPrograms) - ON_COMMAND(ID_PREVIEW_RELOADIMAGES, OnReloadImages ) + ON_COMMAND(ID_PREVIEW_RELOADIMAGES, OnReloadImages ) END_MESSAGE_MAP() static UINT indicators[] = @@ -99,7 +99,7 @@ static UINT indicators[] = * Constructor for MEMainFrame. Initialize some member data and load the options. */ MEMainFrame::MEMainFrame() { - + currentDoc = NULL; m_find = NULL; @@ -128,10 +128,10 @@ void MEMainFrame::PrintConsoleMessage(const char *msg) { BOOL MEMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; - + cs.dwExStyle &= ~WS_EX_CLIENTEDGE; cs.lpszClass = AfxRegisterWndClass(0); - + return TRUE; } @@ -153,7 +153,7 @@ BOOL MEMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) m_splitterWnd.CreateStatic(this, 2, 1); - + m_editSplitter.CreateStatic(&m_splitterWnd, 1, 2, WS_CHILD | WS_VISIBLE | WS_BORDER, m_splitterWnd.IdFromRowCol(0, 0)); if(!m_editSplitter.CreateView(0, 0, RUNTIME_CLASS(MaterialTreeView), CSize(300, 200), pContext)) { @@ -210,7 +210,7 @@ BOOL MEMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) val = 300; m_previewSplitter.SetColumnInfo(0, val, 0); - + //Register the views with the document manager materialDocManager.RegisterMaterialView(this); @@ -260,7 +260,7 @@ BOOL MEMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) int MEMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; - + if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_ME_MAINFRAME)) @@ -269,7 +269,7 @@ int MEMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { return -1; // fail to create } - + if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, @@ -352,7 +352,7 @@ void MEMainFrame::OnSize(UINT nType, int cx, int cy) } /** -* Called when the user changes the editor/console tab selection. This methods shows and hides +* Called when the user changes the editor/console tab selection. This methods shows and hides * the appropriate windows. */ void MEMainFrame::OnTcnSelChange(NMHDR *pNMHDR, LRESULT *pResult) { @@ -398,7 +398,7 @@ void MEMainFrame::OnFileSaveMaterial() { * Saves the selected file. */ void MEMainFrame::OnFileSaveFile() { - + idStr filename = m_materialTreeView->GetSaveFilename(); if(filename.Length() > 0) { materialDocManager.SaveFile(filename); @@ -453,7 +453,7 @@ void MEMainFrame::OnFileSaveFileUpdate(CCmdUI *pCmdUI) { * Enables the Save All menu item if there are any materials that have been modified. */ void MEMainFrame::OnFileSaveAllUpdate(CCmdUI *pCmdUI) { - + if(pCmdUI->m_pMenu == NULL) { pCmdUI->Enable(TRUE); return; @@ -480,7 +480,7 @@ void MEMainFrame::OnApplyMaterial() { * Applies all modified materials in the selected file. */ void MEMainFrame::OnApplyFile() { - + idStr filename = m_materialTreeView->GetSaveFilename(); if(filename.Length() > 0) { materialDocManager.ApplyFile(filename); @@ -537,12 +537,12 @@ void MEMainFrame::OnApplyFileUpdate(CCmdUI *pCmdUI) { * to be applied. */ void MEMainFrame::OnApplyAllUpdate(CCmdUI *pCmdUI) { - + if(pCmdUI->m_pMenu == NULL) { pCmdUI->Enable(TRUE); return; } - + if(materialDocManager.DoesAnyNeedApply()) { pCmdUI->Enable(TRUE); } else { @@ -794,7 +794,7 @@ void MEMainFrame::OnEditFindNext() { * Performs an undo operation. */ void MEMainFrame::OnEditUndo() { - + //Check for undo operation on special windows CWnd* focus = GetFocus(); if(focus) { @@ -811,7 +811,7 @@ void MEMainFrame::OnEditUndo() { * Performs a redo operation. */ void MEMainFrame::OnEditRedo() { - + //Check for redo operation on special windows CWnd* focus = GetFocus(); if(focus) { @@ -828,7 +828,7 @@ void MEMainFrame::OnEditRedo() { * Enables the undo menu item if an undo is available. */ void MEMainFrame::OnEditUndoUpdate(CCmdUI *pCmdUI) { - + if(pCmdUI->m_pMenu == NULL) { pCmdUI->Enable(TRUE); return; @@ -849,7 +849,7 @@ void MEMainFrame::OnEditUndoUpdate(CCmdUI *pCmdUI) { * Enables the redo menu item if a redo is available. */ void MEMainFrame::OnEditRedoUpdate(CCmdUI *pCmdUI) { - + if(pCmdUI->m_pMenu == NULL) { pCmdUI->Enable(TRUE); return; @@ -870,9 +870,9 @@ void MEMainFrame::OnEditRedoUpdate(CCmdUI *pCmdUI) { * Toggles between including the file into the material list and not. */ void MEMainFrame::OnViewIncludeFile() { - + CMenu* mmenu = GetMenu(); - + UINT state = mmenu->GetMenuState(ID_VIEW_INCLUDEFILENAME, MF_BYCOMMAND); ASSERT(state != 0xFFFFFFFF); @@ -897,7 +897,7 @@ void MEMainFrame::OnReloadArbPrograms() { * of the editor. */ void MEMainFrame::OnReloadImages() { - cmdSystem->BufferCommandText(CMD_EXEC_NOW, "reloadImages"); + cmdSystem->BufferCommandText(CMD_EXEC_NOW, "reloadImages"); } /** @@ -933,5 +933,5 @@ void MEMainFrame::FindNext(MaterialSearchData_t* search) { * @param pMaterial The newly selected material. */ void MEMainFrame::MV_OnMaterialSelectionChange(MaterialDoc* pMaterial) { - + } diff --git a/neo/tools/materialeditor/MEMainFrame.h b/neo/tools/materialeditor/MEMainFrame.h index 96ad656c..80c8a044 100644 --- a/neo/tools/materialeditor/MEMainFrame.h +++ b/neo/tools/materialeditor/MEMainFrame.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"). @@ -46,7 +46,7 @@ If you have questions concerning this license or the applicable additional terms */ class MEMainFrame : public CFrameWnd, public MaterialView { - + public: MEMainFrame(); virtual ~MEMainFrame(); @@ -54,58 +54,58 @@ public: //Public Operations void PrintConsoleMessage(const char *msg); -protected: +protected: DECLARE_DYNAMIC(MEMainFrame) // Overrides - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext); + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext); //Message Handlers afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnDestroy(); - afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg void OnTcnSelChange(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnDestroy(); + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg void OnTcnSelChange(NMHDR *pNMHDR, LRESULT *pResult); //Menu Message Handlers - afx_msg void OnFileExit(); - afx_msg void OnFileSaveMaterial(); - afx_msg void OnFileSaveFile(); - afx_msg void OnFileSaveAll(); - afx_msg void OnFileSaveMaterialUpdate(CCmdUI *pCmdUI); - afx_msg void OnFileSaveFileUpdate(CCmdUI *pCmdUI); - afx_msg void OnFileSaveAllUpdate(CCmdUI *pCmdUI); + afx_msg void OnFileExit(); + afx_msg void OnFileSaveMaterial(); + afx_msg void OnFileSaveFile(); + afx_msg void OnFileSaveAll(); + afx_msg void OnFileSaveMaterialUpdate(CCmdUI *pCmdUI); + afx_msg void OnFileSaveFileUpdate(CCmdUI *pCmdUI); + afx_msg void OnFileSaveAllUpdate(CCmdUI *pCmdUI); - afx_msg void OnApplyMaterial(); - afx_msg void OnApplyFile(); - afx_msg void OnApplyAll(); - afx_msg void OnApplyMaterialUpdate(CCmdUI *pCmdUI); - afx_msg void OnApplyFileUpdate(CCmdUI *pCmdUI); - afx_msg void OnApplyAllUpdate(CCmdUI *pCmdUI); + afx_msg void OnApplyMaterial(); + afx_msg void OnApplyFile(); + afx_msg void OnApplyAll(); + afx_msg void OnApplyMaterialUpdate(CCmdUI *pCmdUI); + afx_msg void OnApplyFileUpdate(CCmdUI *pCmdUI); + afx_msg void OnApplyAllUpdate(CCmdUI *pCmdUI); - afx_msg void OnEditCut(); - afx_msg void OnEditCopy(); - afx_msg void OnEditPaste(); - afx_msg void OnEditDelete(); - afx_msg void OnEditRename(); - afx_msg void OnEditCutUpdate(CCmdUI *pCmdUI); - afx_msg void OnEditCopyUpdate(CCmdUI *pCmdUI); - afx_msg void OnEditPasteUpdate(CCmdUI *pCmdUI); - afx_msg void OnEditDeleteUpdate(CCmdUI *pCmdUI); - afx_msg void OnEditRenameUpdate(CCmdUI *pCmdUI); + afx_msg void OnEditCut(); + afx_msg void OnEditCopy(); + afx_msg void OnEditPaste(); + afx_msg void OnEditDelete(); + afx_msg void OnEditRename(); + afx_msg void OnEditCutUpdate(CCmdUI *pCmdUI); + afx_msg void OnEditCopyUpdate(CCmdUI *pCmdUI); + afx_msg void OnEditPasteUpdate(CCmdUI *pCmdUI); + afx_msg void OnEditDeleteUpdate(CCmdUI *pCmdUI); + afx_msg void OnEditRenameUpdate(CCmdUI *pCmdUI); - afx_msg void OnEditFind(); - afx_msg void OnEditFindNext(); + afx_msg void OnEditFind(); + afx_msg void OnEditFindNext(); + + afx_msg void OnEditUndo(); + afx_msg void OnEditRedo(); + afx_msg void OnEditUndoUpdate(CCmdUI *pCmdUI); + afx_msg void OnEditRedoUpdate(CCmdUI *pCmdUI); + + afx_msg void OnViewIncludeFile(); + afx_msg void OnReloadArbPrograms(); + afx_msg void OnReloadImages(); - afx_msg void OnEditUndo(); - afx_msg void OnEditRedo(); - afx_msg void OnEditUndoUpdate(CCmdUI *pCmdUI); - afx_msg void OnEditRedoUpdate(CCmdUI *pCmdUI); - - afx_msg void OnViewIncludeFile(); - afx_msg void OnReloadArbPrograms(); - afx_msg void OnReloadImages(); - DECLARE_MESSAGE_MAP() //Methods for Find interactions @@ -114,12 +114,12 @@ protected: void FindNext(MaterialSearchData_t* search); //MaterialView Interface - virtual void MV_OnMaterialSelectionChange(MaterialDoc* pMaterial); - + virtual void MV_OnMaterialSelectionChange(MaterialDoc* pMaterial); + protected: //Status and Toolbars - CStatusBar m_wndStatusBar; - CToolBar m_wndToolBar; + CStatusBar m_wndStatusBar; + CToolBar m_wndToolBar; //Splitter windows CTabCtrl m_tabs; @@ -150,5 +150,3 @@ protected: MEOptions options; }; - - diff --git a/neo/tools/materialeditor/MEOptions.cpp b/neo/tools/materialeditor/MEOptions.cpp index 2d543404..e3b24fdd 100644 --- a/neo/tools/materialeditor/MEOptions.cpp +++ b/neo/tools/materialeditor/MEOptions.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"). @@ -34,7 +34,7 @@ If you have questions concerning this license or the applicable additional terms * Constructor for MEOptions. */ MEOptions::MEOptions ( ) { - + registry.Init("Software\\id Software\\DOOM3\\Tools\\MaterialEditor"); materialTreeWidth = 0; @@ -71,11 +71,11 @@ bool MEOptions::Save (void) { * Loads the material editor options from the registry. */ bool MEOptions::Load (void) { - + if(!registry.Load()) { return false; } - + materialTreeWidth = (int)registry.GetFloat("materialTreeWidth"); stageWidth = (int)registry.GetFloat("stageWidth"); previewPropertiesWidth = (int)registry.GetFloat("previewPropertiesWidth"); @@ -84,5 +84,5 @@ bool MEOptions::Load (void) { previewPropHeadingWidth = (int)registry.GetFloat("previewPropHeadingWidth"); return true; - + } \ No newline at end of file diff --git a/neo/tools/materialeditor/MEOptions.h b/neo/tools/materialeditor/MEOptions.h index 8b48242b..4e04fa43 100644 --- a/neo/tools/materialeditor/MEOptions.h +++ b/neo/tools/materialeditor/MEOptions.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"). @@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms /** * Wrapper class that is responsible for reading and writing Material Editor -* settings to the registry. Settings are written to +* settings to the registry. Settings are written to * Software\\id Software\\DOOM3\\Tools\\MaterialEditor */ class MEOptions { diff --git a/neo/tools/materialeditor/MaterialDef.cpp b/neo/tools/materialeditor/MaterialDef.cpp index 11495c5f..3fe26ac1 100644 --- a/neo/tools/materialeditor/MaterialDef.cpp +++ b/neo/tools/materialeditor/MaterialDef.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"). @@ -71,7 +71,7 @@ MaterialDefList MaterialDefManager::materialDefs[MaterialDefManager::MATERIAL_DE * and groups the definitions. */ void MaterialDefManager::InitializeMaterialDefLists() { - + char *buffer; int length = fileSystem->ReadFile( MATERIAL_DEF_FILE, (void **)&buffer); @@ -178,7 +178,7 @@ void MaterialDefManager::InitializeMaterialDefList(idLexer* src, const char* typ * Destroys all MaterialDef instances and clears the material attribute grouping lists. */ void MaterialDefManager::DestroyMaterialDefLists() { - + for(int i = 0; i < MATERIAL_DEF_NUM; i++) { for(int j = 0; j < materialDefs[i].Num(); j++) { delete materialDefs[i][j]; diff --git a/neo/tools/materialeditor/MaterialDef.h b/neo/tools/materialeditor/MaterialDef.h index 852a6b08..fe3b00d5 100644 --- a/neo/tools/materialeditor/MaterialDef.h +++ b/neo/tools/materialeditor/MaterialDef.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"). @@ -46,16 +46,16 @@ public: MATERIAL_DEF_TYPE_FLOAT, MATERIAL_DEF_TYPE_INT }; - + int type; idStr dictName; idStr displayName; idStr displayInfo; bool quotes; idHashTable viewData; - + public: - + MaterialDef(void); virtual ~MaterialDef(void); @@ -89,14 +89,14 @@ public: MATERIAL_DEF_NUM }; - static void InitializeMaterialDefLists(); + static void InitializeMaterialDefLists(); static void InitializeMaterialDefList(idLexer* src, const char* typeName, MaterialDefList* list); - + static void DestroyMaterialDefLists(); static MaterialDefList* GetMaterialDefs(int type); protected: - static MaterialDefList materialDefs[MATERIAL_DEF_NUM]; + static MaterialDefList materialDefs[MATERIAL_DEF_NUM]; }; diff --git a/neo/tools/materialeditor/MaterialDoc.cpp b/neo/tools/materialeditor/MaterialDoc.cpp index 6dc2edd9..4005ddea 100644 --- a/neo/tools/materialeditor/MaterialDoc.cpp +++ b/neo/tools/materialeditor/MaterialDoc.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"). @@ -48,8 +48,8 @@ MaterialDoc::~MaterialDoc(void) { } /** -* Initializes the MaterialDoc instance with a specific idMaterial. This method will -* parse the material into the internal dictionary representation and optionally +* Initializes the MaterialDoc instance with a specific idMaterial. This method will +* parse the material into the internal dictionary representation and optionally * allow the idMaterial object to reparse the source. * @param material The idMaterial instance to use. * @param parseMaterial Flag to determine if the material should be parsed into the editor representation. @@ -60,7 +60,7 @@ void MaterialDoc::SetRenderMaterial(idMaterial* material, bool parseMaterial, bo renderMaterial = material; - if(!parseMaterial || !renderMaterial) + if(!parseMaterial || !renderMaterial) return; if(parseRenderMatierial) { @@ -101,7 +101,7 @@ int MaterialDoc::GetStageCount() { * @param name The name of the stage to find. */ int MaterialDoc::FindStage(int stageType, const char* name) { - + for(int i = 0; i < editMaterial.stages.Num(); i++) { int type = GetAttributeInt(i, "stagetype"); idStr localname = GetAttribute(i, "name"); @@ -226,11 +226,11 @@ bool MaterialDoc::GetAttributeBool(int stage, const char* attribName, const char * @param addUndo Flag that specifies if the system should add an undo operation. */ void MaterialDoc::SetAttribute(int stage, const char* attribName, const char* value, bool addUndo) { - + //Make sure we need to set the attribute idStr orig = GetAttribute(stage, attribName); if(orig.Icmp(value)) { - + idDict* dict; if(stage == -1) { dict = &editMaterial.materialData; @@ -246,7 +246,7 @@ void MaterialDoc::SetAttribute(int stage, const char* attribName, const char* va } dict->Set(attribName, value); - + manager->AttributeChanged(this, stage, attribName); OnMaterialChanged(); } @@ -347,9 +347,9 @@ void MaterialDoc::SetAttributeBool(int stage, const char* attribName, bool value void MaterialDoc::SetMaterialName(const char* materialName, bool addUndo) { idStr oldName = name; - declManager->RenameDecl(DECL_MATERIAL, oldName, materialName); + declManager->RenameDecl(DECL_MATERIAL, oldName, materialName); name = renderMaterial->GetName(); - + if(addUndo) { RenameMaterialModifier* mod = new RenameMaterialModifier(manager, name, oldName); manager->AddMaterialUndoModifier(mod); @@ -385,7 +385,7 @@ void MaterialDoc::SetData(int stage, idDict* data) { * @param text The new source text. */ void MaterialDoc::SourceModify(SourceModifyOwner* owner) { - + sourceModifyOwner = owner; sourceModify = true; OnMaterialChanged(); @@ -402,9 +402,9 @@ bool MaterialDoc::IsSourceModified() { * Applies any source changes to the edit representation of the material. */ void MaterialDoc::ApplySourceModify(idStr& text) { - + if(sourceModify) { - + //Changes in the source need to clear any undo redo buffer because we have no idea what has changed manager->ClearUndo(); manager->ClearRedo(); @@ -414,7 +414,7 @@ void MaterialDoc::ApplySourceModify(idStr& text) { idLexer src; src.LoadMemory(text, text.Length(), "Material"); - src.SetFlags( + src.SetFlags( LEXFL_NOSTRINGCONCAT | // multiple strings seperated by whitespaces are not concatenated LEXFL_NOSTRINGESCAPECHARS | // no escape characters inside strings LEXFL_ALLOWPATHNAMES | // allow path seperators in names @@ -428,7 +428,7 @@ void MaterialDoc::ApplySourceModify(idStr& text) { src.Warning( "Missing decl name" ); return; } - + ParseMaterial(&src); sourceModify = false; @@ -583,7 +583,7 @@ void MaterialDoc::ApplyMaterialChanges(bool force) { renderMaterial->GetText( declText ); renderMaterial->GetText(declText); - + ParseMaterialText(declText); applyWaiting = false; @@ -649,7 +649,7 @@ void MaterialDoc::ParseMaterialText(const char* source) { /*idLexer src; src.LoadMemory(source, strlen(source), "material"); - src.SetFlags( + src.SetFlags( LEXFL_NOSTRINGCONCAT | // multiple strings seperated by whitespaces are not concatenated LEXFL_NOSTRINGESCAPECHARS | // no escape characters inside strings LEXFL_ALLOWPATHNAMES | // allow path seperators in names @@ -676,7 +676,7 @@ void MaterialDoc::ParseMaterial(idLexer* src) { //Parse past the name src->SkipUntilString("{"); - + while ( 1 ) { if ( !src->ExpectAnyToken( &token ) ) { //Todo: Add some error checking here @@ -690,7 +690,7 @@ void MaterialDoc::ParseMaterial(idLexer* src) { if(ParseMaterialDef(&token, src, MaterialDefManager::MATERIAL_DEF_MATERIAL, &editMaterial.materialData)) { continue; } - + if ( !token.Icmp( "diffusemap" ) ) { //Added as a special stage idStr str; @@ -714,22 +714,22 @@ void MaterialDoc::ParseMaterial(idLexer* src) { } /** -* Parses a single stage from the source text from an idMaterial and initializes the editor dictionary +* Parses a single stage from the source text from an idMaterial and initializes the editor dictionary * representation of the material. * @param src The idLexer object that contains the material text. */ void MaterialDoc::ParseStage(idLexer* src) { - + MEStage_t* newStage = new MEStage_t(); int index = editMaterial.stages.Append(newStage); - + newStage->stageData.SetInt("stagetype", STAGE_TYPE_NORMAL); newStage->enabled = true; idToken token; while ( 1 ) { - + if ( !src->ExpectAnyToken( &token ) ) { //Todo: Add some error checking here return; @@ -784,7 +784,7 @@ void MaterialDoc::AddSpecialMapStage(const char* stageName, const char* map) { * @param dict The dictionary to initialize. */ bool MaterialDoc::ParseMaterialDef(idToken* token, idLexer* src, int type, idDict* dict) { - + MaterialDefList* defs = MaterialDefManager::GetMaterialDefs(type); for(int i = 0; i < defs->Num(); i++) { @@ -870,7 +870,7 @@ const char* MaterialDoc::GenerateSourceText() { } /** -* Writes the internal dictionary data to the standard format and replaces the +* Writes the internal dictionary data to the standard format and replaces the * idMaterial source text with the newly generated text. */ void MaterialDoc::ReplaceSourceText() { @@ -899,7 +899,7 @@ void MaterialDoc::WriteStage(int stage, idFile_Memory* file) { } WriteMaterialDef(stage, file, MaterialDefManager::MATERIAL_DEF_STAGE, 2); file->WriteFloatString( "\t}\n" ); - + } /** @@ -963,4 +963,3 @@ void MaterialDoc::WriteMaterialDef(int stage, idFile_Memory* file, int type, int } } } - diff --git a/neo/tools/materialeditor/MaterialDoc.h b/neo/tools/materialeditor/MaterialDoc.h index 694a1ea9..e9fb56d8 100644 --- a/neo/tools/materialeditor/MaterialDoc.h +++ b/neo/tools/materialeditor/MaterialDoc.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"). @@ -71,14 +71,14 @@ public: idStr name; idMaterial* renderMaterial; MEMaterial_t editMaterial; - + bool modified; bool applyWaiting; bool deleted; bool sourceModify; SourceModifyOwner* sourceModifyOwner; - + public: MaterialDoc(void); ~MaterialDoc(void); @@ -132,12 +132,12 @@ public: void ApplyMaterialChanges(bool force = false); void Save(); void Delete(); - + protected: //Internal Notifications void OnMaterialChanged(); - + //Load Material Methods void ParseMaterialText(const char* source); void ParseMaterial(idLexer* src); @@ -153,4 +153,3 @@ protected: void WriteSpecialMapStage(int stage, idFile_Memory* file); void WriteMaterialDef(int stage, idFile_Memory* file, int type, int indent); }; - diff --git a/neo/tools/materialeditor/MaterialDocManager.cpp b/neo/tools/materialeditor/MaterialDocManager.cpp index fc8d8b16..5dfb0ffd 100644 --- a/neo/tools/materialeditor/MaterialDocManager.cpp +++ b/neo/tools/materialeditor/MaterialDocManager.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"). @@ -81,7 +81,7 @@ void MaterialDocManager::UnRegisterMaterialView(MaterialView* view) { * notifications. */ void MaterialDocManager::UnRegisterAllMaterialViews() { - + //Remove the reference to myself int c = materialViews.Num(); for(int i = 0; i < c; i++) { @@ -112,7 +112,7 @@ void MaterialDocManager::SetSelectedMaterial(idMaterial* material) { change = true; } } - + //Now make the change if(change) { if(currentMaterial) { @@ -127,7 +127,7 @@ void MaterialDocManager::SetSelectedMaterial(idMaterial* material) { MaterialDoc** tempDoc; if(material && inProgressMaterials.Get(material->GetName(), &tempDoc)) { currentMaterial = *tempDoc; - + } else { currentMaterial = CreateMaterialDoc(material); } @@ -187,7 +187,7 @@ bool MaterialDocManager::IsAnyModified() { * @param addUndo Can this operation be undone. */ void MaterialDocManager::AddMaterial(const char* name, const char* filename, const char* sourceText, bool addUndo) { - + if(addUndo) { AddMaterialModifier* mod = new AddMaterialModifier(this, name, filename); AddMaterialUndoModifier(mod); @@ -196,9 +196,9 @@ void MaterialDocManager::AddMaterial(const char* name, const char* filename, con MaterialDoc* newDoc = new MaterialDoc(); newDoc->manager = this; newDoc->modified = true; - + idMaterial* rendMat = (idMaterial*)declManager->CreateNewDecl(DECL_MATERIAL, name, filename); - + if(sourceText) { rendMat->SetText(sourceText); } @@ -206,7 +206,7 @@ void MaterialDocManager::AddMaterial(const char* name, const char* filename, con newDoc->SetRenderMaterial(rendMat, true, sourceText ? true : false); inProgressMaterials.Set(newDoc->name.c_str(), newDoc); - + NotifyViews(newDoc, MATERIAL_ADD); //Force an apply so the text will be generated to match the new file @@ -215,9 +215,9 @@ void MaterialDocManager::AddMaterial(const char* name, const char* filename, con } /** -* Used to redo an add material and undo a delete material. +* Used to redo an add material and undo a delete material. * The undo for adding a material deletes the material. Instead of adding a completely -* new material RedoAddMaterial finds the one that was just deleted and uses that. +* new material RedoAddMaterial finds the one that was just deleted and uses that. * @param name The name of the material that was added/deleted. * @param clearData Should the material definition be reset to the default definition. */ @@ -250,7 +250,7 @@ void MaterialDocManager::RedoAddMaterial(const char* name, bool clearData) { * @param addUndo Can this operation be undone. */ void MaterialDocManager::DeleteMaterial(MaterialDoc* material, bool addUndo) { - + assert(material); //This will just flag for delete. The actual delete will happen during the save @@ -278,7 +278,7 @@ void MaterialDocManager::ApplyMaterial(MaterialDoc* materialDoc) { * @param filename The file to apply. */ void MaterialDocManager::ApplyFile(const char* filename) { - + for(int i = 0; i < inProgressMaterials.Num(); i++) { MaterialDoc** pDoc = inProgressMaterials.GetIndex(i); if(!strcmp((*pDoc)->renderMaterial->GetFileName(), filename)) @@ -310,7 +310,7 @@ void MaterialDocManager::SaveMaterial(MaterialDoc* material) { * @param filename The file to save. */ void MaterialDocManager::SaveFile(const char* filename) { - + for(int i = inProgressMaterials.Num()-1; i >= 0; i--) { MaterialDoc** pDoc = inProgressMaterials.GetIndex(i); if(!strcmp((*pDoc)->renderMaterial->GetFileName(), filename)) @@ -336,9 +336,9 @@ void MaterialDocManager::SaveAllMaterials() { * @param filename The file to reload. */ void MaterialDocManager::ReloadFile(const char *filename) { - + declManager->ReloadFile(filename, true); - + //purge the changes of any in progress materials for(int j = inProgressMaterials.Num()-1; j >= 0; j--) { MaterialDoc** pDoc = inProgressMaterials.GetIndex(j); @@ -347,7 +347,7 @@ void MaterialDocManager::ReloadFile(const char *filename) { inProgressMaterials.Remove((*pDoc)->name); } } - + //Reparse the current material if(currentMaterial) { currentMaterial->SetRenderMaterial(currentMaterial->renderMaterial); @@ -360,18 +360,18 @@ void MaterialDocManager::ReloadFile(const char *filename) { } /** -* Creates a MaterialDoc object for the specified material name. If a MaterialDoc +* Creates a MaterialDoc object for the specified material name. If a MaterialDoc * object already exists then it is used. * @param materialName The name of the material for which to create a MaterialDoc object. */ MaterialDoc* MaterialDocManager::CreateMaterialDoc(const char* materialName) { - + const idMaterial* material = declManager->FindMaterial(materialName); return CreateMaterialDoc(const_cast(material)); } /** -* Creates a MaterialDoc object for the specified material. If a MaterialDoc +* Creates a MaterialDoc object for the specified material. If a MaterialDoc * object already exists then it is used. * @param material The material for which to create a MaterialDoc object. */ @@ -390,7 +390,7 @@ MaterialDoc* MaterialDocManager::CreateMaterialDoc(idMaterial* material) { MaterialDoc* newDoc = new MaterialDoc(); newDoc->manager = this; newDoc->SetRenderMaterial(material); - + return newDoc; } @@ -421,7 +421,7 @@ MaterialDoc* MaterialDocManager::GetInProgressDoc(idMaterial* material) { * @param cut Is this a cut operation. */ void MaterialDocManager::CopyMaterial(MaterialDoc* materialDoc, bool cut) { - + cutMaterial = cut; if(materialDoc) @@ -457,7 +457,7 @@ idStr MaterialDocManager::GetCopyMaterialName() { * @param filename The file to paste the material in. */ void MaterialDocManager::PasteMaterial(const char* name, const char* filename) { - + if(!IsCopyMaterial()) { return; } @@ -486,7 +486,7 @@ void MaterialDocManager::PasteMaterial(const char* name, const char* filename) { ClearCopy(); } - + } /** @@ -500,7 +500,7 @@ void MaterialDocManager::CopyStage(MaterialDoc* materialDoc, int stageNum) { copyStageMaterial = materialDoc->name; copyStage = materialDoc->GetStage(stageNum); - + idStr stageName = copyStage.stageData.GetString("name"); } @@ -592,9 +592,9 @@ void MaterialDocManager::Redo() { mod->Redo(); - //Done with the mod because the redo process will set + //Done with the mod because the redo process will set //attributes and create the appropriate redo modifier - AddMaterialUndoModifier(mod, false); + AddMaterialUndoModifier(mod, false); } } @@ -656,7 +656,7 @@ bool MaterialDocManager::FindMaterial(const char* name, MaterialSearchData_t* se //Fast way of finding the material without parsing const idMaterial* material = static_cast(declManager->FindDeclWithoutParsing(DECL_MATERIAL, name, false)); - + if(material) { int findPos; @@ -680,7 +680,7 @@ bool MaterialDocManager::FindMaterial(const char* name, MaterialSearchData_t* se if(start != -1) { text = text.Right(text.Length()-start); } - + findPos = text.Find(searchData->searchText, false); if(findPos != -1) { //Todo: Include match whole word diff --git a/neo/tools/materialeditor/MaterialDocManager.h b/neo/tools/materialeditor/MaterialDocManager.h index e59d9f97..318d7a7b 100644 --- a/neo/tools/materialeditor/MaterialDocManager.h +++ b/neo/tools/materialeditor/MaterialDocManager.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: //Material Selection void SetSelectedMaterial(idMaterial* material); MaterialDoc* GetCurrentMaterialDoc() { return currentMaterial; }; - + //State Checking Methods bool DoesFileNeedApply(const char* filename); bool DoesAnyNeedApply(); @@ -79,9 +79,9 @@ public: //Used to get and/or create a MaterialDoc object for editing - MaterialDoc* CreateMaterialDoc(const char* materialName); - MaterialDoc* CreateMaterialDoc(idMaterial* material); - MaterialDoc* GetInProgressDoc(idMaterial* material); + MaterialDoc* CreateMaterialDoc(const char* materialName); + MaterialDoc* CreateMaterialDoc(idMaterial* material); + MaterialDoc* GetInProgressDoc(idMaterial* material); //Copy Paste void CopyMaterial(MaterialDoc* materialDoc = NULL, bool cut = false); @@ -111,9 +111,9 @@ public: //Misc idStr GetUniqueMaterialName(idStr name); - + protected: - + /** * View notification types */ diff --git a/neo/tools/materialeditor/MaterialEditView.cpp b/neo/tools/materialeditor/MaterialEditView.cpp index 5ef6ce8c..8d78d3d8 100644 --- a/neo/tools/materialeditor/MaterialEditView.cpp +++ b/neo/tools/materialeditor/MaterialEditView.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"). @@ -53,7 +53,7 @@ END_MESSAGE_MAP() */ MaterialEditView::MaterialEditView() : CFormView(MaterialEditView::IDD) { - + initHack = false; sourceInit = false; sourceChanged = false; @@ -145,7 +145,7 @@ void MaterialEditView::GetMaterialSource() { m_textView.SetText(text); sourceInit = false; } - } + } } /** @@ -181,7 +181,7 @@ void MaterialEditView::DoDataExchange(CDataExchange* pDX) { * Called by the MFC framework when the view is being created. */ void MaterialEditView::OnInitialUpdate() { - + CFormView::OnInitialUpdate(); if(!initHack) { @@ -261,7 +261,7 @@ void MaterialEditView::OnSize(UINT nType, int cx, int cy) { } /** -* Called when the user changes the properties/text tab selection. This methods shows and hides +* Called when the user changes the properties/text tab selection. This methods shows and hides * the appropriate windows. */ void MaterialEditView::OnTcnSelChange(NMHDR *pNMHDR, LRESULT *pResult) { @@ -276,7 +276,7 @@ void MaterialEditView::OnTcnSelChange(NMHDR *pNMHDR, LRESULT *pResult) { ApplyMaterialSource(); m_stageView->RefreshStageList(); - + break; case 1: m_editSplitter.ShowWindow(SW_HIDE); @@ -299,10 +299,3 @@ void MaterialEditView::OnEnChangeEdit( NMHDR *pNMHDR, LRESULT *pResult ) { } } } - - - - - - - diff --git a/neo/tools/materialeditor/MaterialEditView.h b/neo/tools/materialeditor/MaterialEditView.h index dd68f69a..6c9670cd 100644 --- a/neo/tools/materialeditor/MaterialEditView.h +++ b/neo/tools/materialeditor/MaterialEditView.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"). @@ -49,17 +49,17 @@ public: MaterialPropTreeView* m_materialPropertyView; CTabCtrl m_tabs; CSyntaxRichEditCtrl m_textView; - + public: virtual ~MaterialEditView(); - + //MaterialView Interface virtual void MV_OnMaterialSelectionChange(MaterialDoc* pMaterial); virtual void MV_OnMaterialNameChanged(MaterialDoc* pMaterial, const char* oldName); //SourceModifyOwner Interface virtual idStr GetSourceText(); - + protected: MaterialEditView(); DECLARE_DYNCREATE(MaterialEditView) @@ -70,13 +70,13 @@ protected: //CFormView Overrides virtual void DoDataExchange(CDataExchange* pDX); virtual void OnInitialUpdate(); - + //Message Handlers afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg void OnTcnSelChange(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnTcnSelChange(NMHDR *pNMHDR, LRESULT *pResult); afx_msg void OnEnChangeEdit( NMHDR *pNMHDR, LRESULT *pResult ); - DECLARE_MESSAGE_MAP() + DECLARE_MESSAGE_MAP() protected: bool initHack; diff --git a/neo/tools/materialeditor/MaterialEditor.cpp b/neo/tools/materialeditor/MaterialEditor.cpp index 177d6814..6f6e3c0d 100644 --- a/neo/tools/materialeditor/MaterialEditor.cpp +++ b/neo/tools/materialeditor/MaterialEditor.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"). @@ -88,14 +88,14 @@ void MaterialEditorInit( void ) { // To create the main window, this code creates a new frame window // object and then sets it as the application's main window object meMainFrame = new MEMainFrame; - + // create and load the frame with its resources meMainFrame->LoadFrame(IDR_ME_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL); // hide the doom window by default ::ShowWindow ( win32.hWnd, SW_HIDE ); - + // The one and only window has been initialized, so show and update it meMainFrame->ShowWindow(SW_SHOW); meMainFrame->UpdateWindow(); @@ -107,7 +107,7 @@ void MaterialEditorInit( void ) { void MaterialEditorRun( void ) { MSG *msg = AfxGetCurrentMessage(); - + while( ::PeekMessage(msg, NULL, NULL, NULL, PM_NOREMOVE) ) { // pump message if ( !AfxGetApp()->PumpMessage() ) { @@ -119,14 +119,14 @@ void MaterialEditorRun( void ) { * Called by the doom engine when the material editor needs to be destroyed. */ void MaterialEditorShutdown( void ) { - + delete meMainFrame; delete materialEditorFont; meMainFrame = NULL; } - + /** * Allows the doom engine to reflect console output to the material editors console. */ @@ -173,4 +173,3 @@ void CAboutDlg::DoDataExchange(CDataExchange* pDX) { BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) END_MESSAGE_MAP() - diff --git a/neo/tools/materialeditor/MaterialEditor.h b/neo/tools/materialeditor/MaterialEditor.h index 02e4c232..87bd9263 100644 --- a/neo/tools/materialeditor/MaterialEditor.h +++ b/neo/tools/materialeditor/MaterialEditor.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/neo/tools/materialeditor/MaterialModifier.cpp b/neo/tools/materialeditor/MaterialModifier.cpp index b7f0f79e..35fb6c1a 100644 --- a/neo/tools/materialeditor/MaterialModifier.cpp +++ b/neo/tools/materialeditor/MaterialModifier.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"). @@ -51,12 +51,12 @@ MaterialModifier::MaterialModifier(MaterialDocManager* manager, const char* mate /** * Constructor for AttributeMaterialModifier */ -AttributeMaterialModifier::AttributeMaterialModifier(MaterialDocManager* manager, const char* materialName, int stage, const char* key) +AttributeMaterialModifier::AttributeMaterialModifier(MaterialDocManager* manager, const char* materialName, int stage, const char* key) : MaterialModifier(manager, materialName) { - + this->stage = stage; this->key = key; - + } ////////////////////////////////////////////////////////////////////////////// @@ -66,7 +66,7 @@ AttributeMaterialModifier::AttributeMaterialModifier(MaterialDocManager* manager /** * Constructor for AttributeMaterialModifierString */ -AttributeMaterialModifierString::AttributeMaterialModifierString(MaterialDocManager* manager, const char* materialName, int stage, const char* key, const char* value, const char* oldValue) +AttributeMaterialModifierString::AttributeMaterialModifierString(MaterialDocManager* manager, const char* materialName, int stage, const char* key, const char* value, const char* oldValue) : AttributeMaterialModifier(manager, materialName, stage, key) { this->value = value; @@ -96,7 +96,7 @@ void AttributeMaterialModifierString::Redo() { /** * Constructor for AttributeMaterialModifierBool */ -AttributeMaterialModifierBool::AttributeMaterialModifierBool(MaterialDocManager* manager, const char* materialName, int stage, const char* key, bool value, bool oldValue) +AttributeMaterialModifierBool::AttributeMaterialModifierBool(MaterialDocManager* manager, const char* materialName, int stage, const char* key, bool value, bool oldValue) : AttributeMaterialModifier(manager, materialName, stage, key) { this->value = value; @@ -155,7 +155,7 @@ void StageMoveModifier::Redo() { /** * Constructor for StageDeleteModifier */ -StageDeleteModifier::StageDeleteModifier(MaterialDocManager* manager, const char* materialName, int stageNum, idDict stageData) +StageDeleteModifier::StageDeleteModifier(MaterialDocManager* manager, const char* materialName, int stageNum, idDict stageData) : MaterialModifier(manager, materialName) { this->stageNum = stageNum; this->stageData = stageData; @@ -253,15 +253,15 @@ DeleteMaterialModifier::DeleteMaterialModifier(MaterialDocManager* manager, cons * Performs an undo operation of a deleted material. */ void DeleteMaterialModifier::Undo() { - - manager->RedoAddMaterial(materialName, false); + + manager->RedoAddMaterial(materialName, false); } /** * Performs a redo operation of a deleted material. */ void DeleteMaterialModifier::Redo() { - + MaterialDoc* material = manager->CreateMaterialDoc(materialName); manager->DeleteMaterial(material, false); } @@ -284,7 +284,7 @@ MoveMaterialModifier::MoveMaterialModifier(MaterialDocManager* manager, const ch * Performs an undo operation of a moved material */ void MoveMaterialModifier::Undo() { - + //Delete New Material MaterialDoc* material = manager->CreateMaterialDoc(materialName); manager->DeleteMaterial(material, false); @@ -329,7 +329,7 @@ void RenameMaterialModifier::Undo() { * Performs a redo operation of a renamed material. */ void RenameMaterialModifier::Redo() { - + MaterialDoc* material = manager->CreateMaterialDoc(oldName); material->SetMaterialName(materialName, false); } @@ -408,7 +408,7 @@ DeleteMaterialFolderModifier::DeleteMaterialFolderModifier(MaterialDocManager* m * Performs an undo operation of a deleted material folder. */ void DeleteMaterialFolderModifier::Undo() { - + //Add the folder back and save the folder position for the redo item = view->AddFolder(materialName, parent); @@ -425,4 +425,3 @@ void DeleteMaterialFolderModifier::Redo() { view->DeleteFolder(item, false); } - diff --git a/neo/tools/materialeditor/MaterialModifier.h b/neo/tools/materialeditor/MaterialModifier.h index 885cbea5..47effd41 100644 --- a/neo/tools/materialeditor/MaterialModifier.h +++ b/neo/tools/materialeditor/MaterialModifier.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,8 +58,8 @@ public: AttributeMaterialModifier(MaterialDocManager* manager, const char* materialName, int stage, const char* key); virtual ~AttributeMaterialModifier() {}; - virtual void Undo() = 0; - virtual void Redo() = 0; + virtual void Undo() = 0; + virtual void Redo() = 0; protected: int stage; @@ -75,8 +75,8 @@ public: AttributeMaterialModifierString(MaterialDocManager* manager, const char* materialName, int stage, const char* key, const char* value, const char* oldValue); virtual ~AttributeMaterialModifierString() {}; - virtual void Undo(); - virtual void Redo(); + virtual void Undo(); + virtual void Redo(); protected: idStr value; @@ -93,8 +93,8 @@ public: AttributeMaterialModifierBool(MaterialDocManager* manager, const char* materialName, int stage, const char* key, bool value, bool oldValue); virtual ~AttributeMaterialModifierBool() {}; - virtual void Undo(); - virtual void Redo(); + virtual void Undo(); + virtual void Redo(); protected: bool value; @@ -111,8 +111,8 @@ public: StageMoveModifier(MaterialDocManager* manager, const char* materialName, int from, int to); virtual ~StageMoveModifier() {}; - virtual void Undo(); - virtual void Redo(); + virtual void Undo(); + virtual void Redo(); protected: int from; @@ -127,8 +127,8 @@ public: StageDeleteModifier(MaterialDocManager* manager, const char* materialName, int stageNum, idDict stageData); virtual ~StageDeleteModifier() {}; - virtual void Undo(); - virtual void Redo(); + virtual void Undo(); + virtual void Redo(); protected: int stageNum; @@ -149,7 +149,7 @@ public: protected: int stageNum; int stageType; - idStr stageName; + idStr stageName; }; /** @@ -179,7 +179,7 @@ public: virtual void Redo(); protected: - + }; /** @@ -265,4 +265,3 @@ protected: HTREEITEM item; HTREEITEM parent; }; - diff --git a/neo/tools/materialeditor/MaterialPreviewPropView.cpp b/neo/tools/materialeditor/MaterialPreviewPropView.cpp index 96d9488b..04b3e3f0 100644 --- a/neo/tools/materialeditor/MaterialPreviewPropView.cpp +++ b/neo/tools/materialeditor/MaterialPreviewPropView.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 @@ void MaterialPreviewPropView::InitializePropTree( void ) { pCombo->SetItemData( 5, 5 ); pCombo->SetItemData( 6, 6 ); pCombo->SetItemData( 7, 7 ); - + pCombo->SetCurSel( 0 ); // Custom model entry @@ -271,7 +271,7 @@ void MaterialPreviewPropView::OnPropertyChangeNotification( NMHDR *nmhdr, LRESUL } idStr itemLabel = item->GetLabelText(); - + if ( itemLabel == "Model Type" ) { materialPreview->OnModelChange( item->GetItemValue() ); diff --git a/neo/tools/materialeditor/MaterialPreviewPropView.h b/neo/tools/materialeditor/MaterialPreviewPropView.h index 84d255bf..54c4762d 100644 --- a/neo/tools/materialeditor/MaterialPreviewPropView.h +++ b/neo/tools/materialeditor/MaterialPreviewPropView.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"). @@ -64,5 +64,3 @@ protected: DECLARE_MESSAGE_MAP() }; - - diff --git a/neo/tools/materialeditor/MaterialPreviewView.cpp b/neo/tools/materialeditor/MaterialPreviewView.cpp index 39f14b0f..be453469 100644 --- a/neo/tools/materialeditor/MaterialPreviewView.cpp +++ b/neo/tools/materialeditor/MaterialPreviewView.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"). @@ -239,7 +239,7 @@ void idGLDrawableView::ResetView( void ) { } void idGLDrawableView::InitWorld() { - + if ( world == NULL ) { world = renderSystem->AllocRenderWorld(); } @@ -334,7 +334,7 @@ void idGLDrawableView::mouseMove(float x, float y) { // Go through the lights and move the ones that are set to allow movement for ( i = 0; i < viewLights.Num(); i++ ) { lightInfo_t *vLight = &viewLights[i]; - + if ( vLight->allowMove ) { vLight->origin += lightMove; } @@ -652,4 +652,3 @@ void idGLDrawableView::setCustomModel( const idStr modelName ) { void idGLDrawableView::setShowLights( bool _showLights ) { showLights = _showLights; } - diff --git a/neo/tools/materialeditor/MaterialPreviewView.h b/neo/tools/materialeditor/MaterialPreviewView.h index e44edabc..d567b782 100644 --- a/neo/tools/materialeditor/MaterialPreviewView.h +++ b/neo/tools/materialeditor/MaterialPreviewView.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"). @@ -146,4 +146,3 @@ public: afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnSize(UINT nType, int cx, int cy); }; - diff --git a/neo/tools/materialeditor/MaterialPropTreeView.cpp b/neo/tools/materialeditor/MaterialPropTreeView.cpp index 2af57d4c..a8be5888 100644 --- a/neo/tools/materialeditor/MaterialPropTreeView.cpp +++ b/neo/tools/materialeditor/MaterialPropTreeView.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"). @@ -98,7 +98,7 @@ void MaterialPropTreeView::SetPropertyListType(int listType, int stageNum) { break; case MaterialDef::MATERIAL_DEF_TYPE_STRING: { - //pCurrentNode = m_Tree.InsertItem(new CPropTreeItemEdit(), pCurrentGroup); + //pCurrentNode = m_Tree.InsertItem(new CPropTreeItemEdit(), pCurrentGroup); pCurrentNode = m_Tree.InsertItem(new CPropTreeItemFileEdit(), pCurrentGroup); } @@ -134,7 +134,7 @@ void MaterialPropTreeView::SaveSettings() { * @param pMaterial The selected material. */ void MaterialPropTreeView::MV_OnMaterialChange(MaterialDoc* pMaterial) { - + if(materialDocManager->GetCurrentMaterialDoc()) { idStr currentName = materialDocManager->GetCurrentMaterialDoc()->name; if(!internalChange && !pMaterial->name.Icmp(currentName)) { @@ -166,7 +166,7 @@ void MaterialPropTreeView::OnPropertyChangeNotification( NMHDR *nmhdr, LRESULT * break; case MaterialDef::MATERIAL_DEF_TYPE_STRING: { - idStr val = (LPCTSTR)item->GetItemValue(); + idStr val = (LPCTSTR)item->GetItemValue(); materialDoc->SetAttribute(currentStage, propItem->dictName, val); } break; @@ -212,13 +212,13 @@ MaterialDef* MaterialPropTreeView::FindDefForTreeID(UINT treeID) { * Initializes the property tree with the data from the currently selected material. */ void MaterialPropTreeView::RefreshProperties() { - + MaterialDefList* propList = MaterialDefManager::GetMaterialDefs(currentListType); if(!propList) return; - MaterialDoc* materialDoc = materialDocManager->GetCurrentMaterialDoc(); + MaterialDoc* materialDoc = materialDocManager->GetCurrentMaterialDoc(); for(int i = 0; i < propList->Num(); i++) { switch((*propList)[i]->type) { @@ -241,8 +241,3 @@ void MaterialPropTreeView::RefreshProperties() { Invalidate(); } - - - - - diff --git a/neo/tools/materialeditor/MaterialPropTreeView.h b/neo/tools/materialeditor/MaterialPropTreeView.h index 1171e90c..273c9381 100644 --- a/neo/tools/materialeditor/MaterialPropTreeView.h +++ b/neo/tools/materialeditor/MaterialPropTreeView.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,10 +38,10 @@ If you have questions concerning this license or the applicable additional terms * View that displays material and stage properties and allows the user to edit the properties. */ class MaterialPropTreeView : public CPropTreeView, public MaterialView { - + public: virtual ~MaterialPropTreeView(); - + void SetPropertyListType(int listType, int stageNum = -1); void LoadSettings(); @@ -49,7 +49,7 @@ public: //Material Interface virtual void MV_OnMaterialChange(MaterialDoc* pMaterial); - + protected: MaterialPropTreeView(); DECLARE_DYNCREATE(MaterialPropTreeView) @@ -57,12 +57,12 @@ protected: afx_msg void OnPropertyChangeNotification( NMHDR *nmhdr, LRESULT *lresult ); afx_msg void OnPropertyItemExpanding( NMHDR *nmhdr, LRESULT *lresult ); DECLARE_MESSAGE_MAP() - + MaterialDef* FindDefForTreeID(UINT treeID); void RefreshProperties(); - + protected: - + MaterialDoc* currentMaterial; int currentListType; int currentStage; @@ -70,5 +70,3 @@ protected: rvRegistryOptions registry; bool internalChange; }; - - diff --git a/neo/tools/materialeditor/MaterialTreeView.cpp b/neo/tools/materialeditor/MaterialTreeView.cpp index 92cbb072..921a4d5c 100644 --- a/neo/tools/materialeditor/MaterialTreeView.cpp +++ b/neo/tools/materialeditor/MaterialTreeView.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,10 +74,10 @@ BEGIN_MESSAGE_MAP(MaterialTreeView, CTreeView) ON_COMMAND(ID_POPUP_PASTE, OnPaste) ON_MESSAGE(MSG_RENAME_FOLDER_COMPLETE, OnRenameFolderComplete) - ON_MESSAGE(MSG_RENAME_MATERIAL_COMPLETE, OnRenameMaterialComplete) + ON_MESSAGE(MSG_RENAME_MATERIAL_COMPLETE, OnRenameMaterialComplete) END_MESSAGE_MAP() -/** +/** * Constructor for MaterialTreeView */ MaterialTreeView::MaterialTreeView() { @@ -87,13 +87,13 @@ MaterialTreeView::MaterialTreeView() { internalChange = false; } -/** +/** * Destructor for MaterialTreeView */ MaterialTreeView::~MaterialTreeView() { } -/** +/** * Clears the tree and rebuilds it. * @param includeFile Should the list include the filename * @param filename The file to load or NULL to load all files. @@ -112,7 +112,7 @@ void MaterialTreeView::InitializeMaterialList(bool includeFile, const char* file BuildMaterialList(includeFile, filename); } -/** +/** * Builds the tree of materials. * @param includeFile Should the list include the filename * @param filename The file to load or NULL to load all files. @@ -190,7 +190,7 @@ void MaterialTreeView::MV_OnMaterialChange(MaterialDoc* pMaterial) { } /** -* Called when the material changes have been applied. +* Called when the material changes have been applied. * @param pMaterial The selected material. */ void MaterialTreeView::MV_OnMaterialApply(MaterialDoc* pMaterial) { @@ -207,7 +207,7 @@ void MaterialTreeView::MV_OnMaterialApply(MaterialDoc* pMaterial) { } /** -* Called when the material changes have been saved. +* Called when the material changes have been saved. * @param pMaterial The saved material. */ void MaterialTreeView::MV_OnMaterialSaved(MaterialDoc* pMaterial) { @@ -257,7 +257,7 @@ void MaterialTreeView::MV_OnMaterialAdd(MaterialDoc* pMaterial) { } list.Append(temp); - AddStrList(NULL, &list, treeWithFile); + AddStrList(NULL, &list, treeWithFile); //Keep the items sorted HTREEITEM* item = NULL; @@ -298,7 +298,7 @@ void MaterialTreeView::MV_OnMaterialNameChanged(MaterialDoc* pMaterial, const ch CTreeCtrl& tree = GetTreeCtrl(); if(!internalChange) { - + //Delete the old tree item HTREEITEM* item = NULL; materialToTree.Get(oldName, &item); @@ -306,7 +306,7 @@ void MaterialTreeView::MV_OnMaterialNameChanged(MaterialDoc* pMaterial, const ch HTREEITEM tempItem = *item; CleanLookupTrees(tempItem); tree.DeleteItem(tempItem); - + //Now add it back idStrList list(1024); @@ -322,7 +322,7 @@ void MaterialTreeView::MV_OnMaterialNameChanged(MaterialDoc* pMaterial, const ch } list.Append(temp); - AddStrList(NULL, &list, treeWithFile); + AddStrList(NULL, &list, treeWithFile); //Keep the items sorted //item = NULL; @@ -643,7 +643,7 @@ HTREEITEM MaterialTreeView::AddFolder(const char* name, HTREEITEM parent) { HTREEITEM newItem = tree.InsertItem(name, parent); tree.SetItemImage(newItem, IMAGE_MATERIAL_FOLDER, IMAGE_MATERIAL_FOLDER); tree.SetItemData(newItem, TYPE_MATERIAL_FOLDER); - tree.Expand(newItem, TVE_EXPAND); + tree.Expand(newItem, TVE_EXPAND); //Make sure the tree is still sorted tree.SortChildren(parent); @@ -675,7 +675,7 @@ void MaterialTreeView::RenameFolder(HTREEITEM item, const char* name) { tree.SetItemText(item, name); - PostMessage(MSG_RENAME_FOLDER_COMPLETE); + PostMessage(MSG_RENAME_FOLDER_COMPLETE); } /** @@ -706,7 +706,7 @@ int MaterialTreeView::OnCreate(LPCREATESTRUCT lpCreateStruct) { CTreeCtrl& tree = GetTreeCtrl(); m_image.Create(IDB_ME_TREEBITMAP, 16, 1, RGB(255, 255, 255)); tree.SetImageList(&m_image, TVSIL_NORMAL); - + return 0; } @@ -714,9 +714,9 @@ int MaterialTreeView::OnCreate(LPCREATESTRUCT lpCreateStruct) { * Changes the selected material when the select tree item changes. */ void MaterialTreeView::OnTvnSelchanged(NMHDR *pNMHDR, LRESULT *pResult) { - + LPNMTREEVIEW pNMTreeView = reinterpret_cast(pNMHDR); - + if(pNMTreeView->itemNew.hItem) { CTreeCtrl& tree = GetTreeCtrl(); @@ -724,16 +724,16 @@ void MaterialTreeView::OnTvnSelchanged(NMHDR *pNMHDR, LRESULT *pResult) { if(type == TYPE_MATERIAL) { idStr mediaName = GetMediaPath(pNMTreeView->itemNew.hItem, type); const idMaterial* material = declManager->FindMaterial(mediaName); - + materialDocManager->SetSelectedMaterial(const_cast(material)); - + } else { - + materialDocManager->SetSelectedMaterial(NULL); } } else { - + materialDocManager->SetSelectedMaterial(NULL); } @@ -744,7 +744,7 @@ void MaterialTreeView::OnTvnSelchanged(NMHDR *pNMHDR, LRESULT *pResult) { * Determines if a tree item's label can be edited. */ void MaterialTreeView::OnTvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult) { - + LPNMTVDISPINFO pTVDispInfo = reinterpret_cast(pNMHDR); CTreeCtrl& tree = GetTreeCtrl(); @@ -759,7 +759,7 @@ void MaterialTreeView::OnTvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult) { } /** -* Makes sure that a rename operation can be performed after a label edit is complete and +* Makes sure that a rename operation can be performed after a label edit is complete and * performs the folder or material rename. */ void MaterialTreeView::OnTvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult) { @@ -769,7 +769,7 @@ void MaterialTreeView::OnTvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult) { *pResult = 0; if(pTVDispInfo->item.pszText) { - + //Convert any edited text to lower case to keep the name canonical idStr newLabel = pTVDispInfo->item.pszText; newLabel.ToLower(); @@ -810,7 +810,7 @@ void MaterialTreeView::OnTvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult) { internalChange = false; renamedFolder = pTVDispInfo->item.hItem; - PostMessage(MSG_RENAME_MATERIAL_COMPLETE); + PostMessage(MSG_RENAME_MATERIAL_COMPLETE); *pResult = 1; } @@ -826,7 +826,7 @@ void MaterialTreeView::OnTvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult) { affectedMaterials.Clear(); GetMaterialPaths(renamedFolder, &affectedMaterials); - PostMessage(MSG_RENAME_FOLDER_COMPLETE); + PostMessage(MSG_RENAME_FOLDER_COMPLETE); RenameMaterialFolderModifier* mod = new RenameMaterialFolderModifier(materialDocManager, pTVDispInfo->item.pszText, this, pTVDispInfo->item.hItem, tree.GetItemText(pTVDispInfo->item.hItem)); materialDocManager->AddMaterialUndoModifier(mod); @@ -1336,7 +1336,7 @@ void MaterialTreeView::OnPaste() { //Paste materialDocManager->PasteMaterial(materialName, filename); - } + } } /** @@ -1527,12 +1527,12 @@ void MaterialTreeView::GetMaterialPaths(HTREEITEM item, idListc_str(); @@ -1620,21 +1620,21 @@ void MaterialTreeView::AddStrList(const char *root, idStrList *list, bool includ if (quickTree.Get(qt, &check)) { newItem = *check; } - + bool thisisfile = false; if(out == filename) { thisisfile = true; afterFile = true; } - + if (newItem == NULL) { newItem = treeMedia.InsertItem(out, item); qt = root; qt += "/"; qt += path; quickTree.Set(qt, newItem); - + if(!afterFile || thisisfile) { if(thisisfile) { @@ -1658,7 +1658,7 @@ void MaterialTreeView::AddStrList(const char *root, idStrList *list, bool includ } } - + item = newItem; name.Right(name.Length() - index - 1, out); name = out; @@ -1701,7 +1701,7 @@ void MaterialTreeView::PopupMenu(CPoint* pt) { CMenu FloatingMenu; VERIFY(FloatingMenu.LoadMenu(IDR_ME_MATERIALTREE_POPUP)); CMenu* pPopupMenu = FloatingMenu.GetSubMenu (0); - + DWORD itemType = tree.GetItemData(item); //Enable/Disable based on the state @@ -1792,7 +1792,7 @@ void MaterialTreeView::PopupMenu(CPoint* pt) { } else { pPopupMenu->EnableMenuItem(ID_POPUP_RELOADFILE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); } - + pPopupMenu->TrackPopupMenu (TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt->x, pt->y, &GetTreeCtrl()); } @@ -1913,14 +1913,3 @@ idStr MaterialTreeView::GetQuicktreePath(HTREEITEM item) { } return qt; } - - - - - - - - - - - diff --git a/neo/tools/materialeditor/MaterialTreeView.h b/neo/tools/materialeditor/MaterialTreeView.h index c76df604..f86d582a 100644 --- a/neo/tools/materialeditor/MaterialTreeView.h +++ b/neo/tools/materialeditor/MaterialTreeView.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"). @@ -50,7 +50,7 @@ public: void InitializeMaterialList(bool includeFile = true, const char* filename = NULL); void BuildMaterialList(bool includeFile = true, const char* filename = NULL); - + //Material Interface virtual void MV_OnMaterialChange(MaterialDoc* pMaterial); virtual void MV_OnMaterialApply(MaterialDoc* pMaterial); @@ -59,7 +59,7 @@ public: virtual void MV_OnMaterialDelete(MaterialDoc* pMaterial); virtual void MV_OnMaterialNameChanged(MaterialDoc* pMaterial, const char* oldName); virtual void MV_OnFileReload(const char* filename); - + bool CanCopy(); bool CanPaste(); bool CanCut(); @@ -75,7 +75,7 @@ public: void DeleteFolder(HTREEITEM item, bool addUndo = true); HTREEITEM AddFolder(const char* name, HTREEITEM parent); void RenameFolder(HTREEITEM item, const char* name); - + protected: MaterialTreeView(); @@ -97,38 +97,38 @@ protected: //Window Messages afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnTvnSelchanged(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnTvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnTvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); - afx_msg void OnNMRclick(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnTvnSelchanged(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnTvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnTvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); + afx_msg void OnNMRclick(NMHDR *pNMHDR, LRESULT *pResult); afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); - afx_msg void OnTvnBegindrag(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnMouseMove(UINT nFlags, CPoint point); - afx_msg void OnLButtonUp(UINT nFlags, CPoint point); + afx_msg void OnTvnBegindrag(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnMouseMove(UINT nFlags, CPoint point); + afx_msg void OnLButtonUp(UINT nFlags, CPoint point); //Menu Commands - afx_msg void OnApplyMaterial(); - afx_msg void OnApplyFile(); - afx_msg void OnApplyAll(); - afx_msg void OnSaveMaterial(); - afx_msg void OnSaveFile(); - afx_msg void OnSaveAll(); - afx_msg void OnRenameMaterial(); - afx_msg void OnAddMaterial(); - afx_msg void OnAddFolder(); - afx_msg void OnDeleteMaterial(); - afx_msg void OnReloadFile(); - afx_msg void OnCut(); - afx_msg void OnCopy(); - afx_msg void OnPaste(); + afx_msg void OnApplyMaterial(); + afx_msg void OnApplyFile(); + afx_msg void OnApplyAll(); + afx_msg void OnSaveMaterial(); + afx_msg void OnSaveFile(); + afx_msg void OnSaveAll(); + afx_msg void OnRenameMaterial(); + afx_msg void OnAddMaterial(); + afx_msg void OnAddFolder(); + afx_msg void OnDeleteMaterial(); + afx_msg void OnReloadFile(); + afx_msg void OnCut(); + afx_msg void OnCopy(); + afx_msg void OnPaste(); //Internal Messages afx_msg LRESULT OnRenameFolderComplete(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnRenameMaterialComplete(WPARAM wParam, LPARAM lParam); DECLARE_MESSAGE_MAP() - + //Utility methods void RenameMaterial(HTREEITEM item, const char* originalName); @@ -138,7 +138,7 @@ protected: void AddStrList(const char *root, idStrList *list, bool includeFile); void PopupMenu(CPoint* pt); void SetItemImage(HTREEITEM item, bool mod, bool apply, bool children); - + //Methods for working with the quicktree void CleanLookupTrees(HTREEITEM item); @@ -171,5 +171,3 @@ protected: bool internalChange; }; - - diff --git a/neo/tools/materialeditor/MaterialView.cpp b/neo/tools/materialeditor/MaterialView.cpp index c64e8da0..0659a2b9 100644 --- a/neo/tools/materialeditor/MaterialView.cpp +++ b/neo/tools/materialeditor/MaterialView.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"). @@ -29,4 +29,3 @@ If you have questions concerning this license or the applicable additional terms #pragma hdrstop #include "materialview.h" - diff --git a/neo/tools/materialeditor/MaterialView.h b/neo/tools/materialeditor/MaterialView.h index 29c19256..158bd7e1 100644 --- a/neo/tools/materialeditor/MaterialView.h +++ b/neo/tools/materialeditor/MaterialView.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,9 +30,9 @@ If you have questions concerning this license or the applicable additional terms #include "MaterialDocManager.h" /** -* MaterialView Interface. Interface to be implemented by classes that want -* notifications of material changes. Classes that implement this interface -* must register themself with the MaterialDocManager class with the +* MaterialView Interface. Interface to be implemented by classes that want +* notifications of material changes. Classes that implement this interface +* must register themself with the MaterialDocManager class with the * RegisterView method. */ class MaterialView { @@ -55,13 +55,13 @@ public: * @param docManager The material document manager for this view instance. */ virtual void SetMaterialDocManager(MaterialDocManager* docManager) { materialDocManager = docManager; }; - + /** * Called when the selected material has changed. * @param pMaterial The newly selected material. */ virtual void MV_OnMaterialSelectionChange(MaterialDoc* pMaterial) {}; - + /** * Called when the material has changed but not applied. * @param pMaterial The selected material. @@ -69,13 +69,13 @@ public: virtual void MV_OnMaterialChange(MaterialDoc* pMaterial) {}; /** - * Called when the material changes have been applied. + * Called when the material changes have been applied. * @param pMaterial The selected material. */ virtual void MV_OnMaterialApply(MaterialDoc* pMaterial) {}; /** - * Called when the material changes have been saved. + * Called when the material changes have been saved. * @param pMaterial The saved material. */ virtual void MV_OnMaterialSaved(MaterialDoc* pMaterial) {}; diff --git a/neo/tools/materialeditor/StageView.cpp b/neo/tools/materialeditor/StageView.cpp index 2da0e7f6..2d619cbf 100644 --- a/neo/tools/materialeditor/StageView.cpp +++ b/neo/tools/materialeditor/StageView.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,11 +80,11 @@ void StageView::MV_OnMaterialSelectionChange(MaterialDoc* pMaterial) { currentMaterial = pMaterial; - RefreshStageList(); + RefreshStageList(); } /** -* Called when the material changes have been saved. +* Called when the material changes have been saved. * @param pMaterial The saved material. */ void StageView::MV_OnMaterialSaved(MaterialDoc* pMaterial) { @@ -265,7 +265,7 @@ bool StageView::CanRename() { * Rebuilds the list of stages based on the currently selected material */ void StageView::RefreshStageList() { - + CListCtrl& list = GetListCtrl(); POSITION pos = list.GetFirstSelectedItemPosition(); @@ -304,7 +304,7 @@ void StageView::RefreshStageList() { } } -/** +/** * Called by the MFC framework when the view is being created. */ int StageView::OnCreate(LPCREATESTRUCT lpCreateStruct) { @@ -316,8 +316,8 @@ int StageView::OnCreate(LPCREATESTRUCT lpCreateStruct) { return 0; } -/** -* Called when the user changes the selection in the list box. This method will notify the +/** +* Called when the user changes the selection in the list box. This method will notify the * property view of the change so that it can display the appropriate properties. */ void StageView::OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult) { @@ -361,7 +361,7 @@ void StageView::OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult) { *pResult = 0; } -/** +/** * Notifies the property view that all stages have been removed. */ void StageView::OnLvnDeleteallitems(NMHDR *pNMHDR, LRESULT *pResult) { @@ -373,7 +373,7 @@ void StageView::OnLvnDeleteallitems(NMHDR *pNMHDR, LRESULT *pResult) { *pResult = 0; } -/** +/** * Starts the stage drag operation. */ void StageView::OnLvnBegindrag(NMHDR *pNMHDR, LRESULT *pResult) { @@ -413,7 +413,7 @@ void StageView::OnLvnBegindrag(NMHDR *pNMHDR, LRESULT *pResult) { *pResult = 0; } -/** +/** * Finishes a stage drag operation of the user was dragging a stage. */ void StageView::OnLButtonUp(UINT nFlags, CPoint point) { @@ -439,7 +439,7 @@ void StageView::OnLButtonUp(UINT nFlags, CPoint point) { ToggleListView::OnLButtonUp(nFlags, point); } -/** +/** * Handles drawing the drag image when a user is draging a stage. */ void StageView::OnMouseMove(UINT nFlags, CPoint point) { @@ -459,7 +459,7 @@ void StageView::OnMouseMove(UINT nFlags, CPoint point) { ToggleListView::OnMouseMove(nFlags, point); } -/** +/** * Displays the popup menu when the user performs a right mouse click. */ void StageView::OnNMRclick(NMHDR *pNMHDR, LRESULT *pResult) { @@ -478,7 +478,7 @@ void StageView::OnNMRclick(NMHDR *pNMHDR, LRESULT *pResult) { *pResult = 0; } -/** +/** * Begins a label edit when the user selects the rename menu option. */ void StageView::OnRenameStage() { @@ -492,7 +492,7 @@ void StageView::OnRenameStage() { } } -/** +/** * Deletes the selected stage when the user selects the delete menu option. */ void StageView::OnDeleteStage() { @@ -513,7 +513,7 @@ void StageView::OnDeleteStage() { } } -/** +/** * Conforms the user wants to delete all stages and then performs the operation. */ void StageView::OnDeleteAllStages() { @@ -524,7 +524,7 @@ void StageView::OnDeleteAllStages() { } } -/** +/** * Adds a new stage when the user selects the menu option. */ void StageView::OnAddStage() { @@ -534,7 +534,7 @@ void StageView::OnAddStage() { material->AddStage(MaterialDoc::STAGE_TYPE_NORMAL, name.c_str()); } -/** +/** * Adds a new bumpmap stage when the user selects the menu option. */ void StageView::OnAddBumpmapStage() { @@ -542,7 +542,7 @@ void StageView::OnAddBumpmapStage() { material->AddStage(MaterialDoc::STAGE_TYPE_SPECIALMAP, "bumpmap"); } -/** +/** * Adds a new diffusemap stage when the user selects the menu option. */ void StageView::OnAddDiffuseStage() { @@ -550,7 +550,7 @@ void StageView::OnAddDiffuseStage() { material->AddStage(MaterialDoc::STAGE_TYPE_SPECIALMAP, "diffusemap"); } -/** +/** * Adds a new specularmap stage when the user selects the menu option. */ void StageView::OnAddSpecualarStage() { @@ -558,7 +558,7 @@ void StageView::OnAddSpecualarStage() { material->AddStage(MaterialDoc::STAGE_TYPE_SPECIALMAP, "specularmap"); } -/** +/** * Performs a copy operation when the user selects the menu option. */ void StageView::OnCopy() { @@ -577,7 +577,7 @@ void StageView::OnCopy() { } } -/** +/** * Performs a paste operation when the user selects the menu option. */ void StageView::OnPaste() { @@ -603,7 +603,7 @@ void StageView::OnPaste() { } } -/** +/** * Determines is a label edit can be performed on the selected stage. */ void StageView::OnLvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult) { @@ -632,7 +632,7 @@ void StageView::OnLvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult) { *pResult = 0; } -/** +/** * Performs the stage name change after the label edit is done. */ void StageView::OnLvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult) { @@ -649,7 +649,7 @@ void StageView::OnLvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult) { } } -/** +/** * Handles keyboard shortcuts for copy and paste operations. */ void StageView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { @@ -665,7 +665,7 @@ void StageView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { ToggleListView::OnChar(nChar, nRepCnt, nFlags); } -/** +/** * Handles keyboard shortcut for the delete operations. */ BOOL StageView::PreTranslateMessage(MSG* pMsg) { @@ -681,7 +681,7 @@ BOOL StageView::PreTranslateMessage(MSG* pMsg) { return FALSE; } -/** +/** * Sets window styles before the window is created. */ BOOL StageView::PreCreateWindow(CREATESTRUCT& cs) { @@ -691,7 +691,7 @@ BOOL StageView::PreCreateWindow(CREATESTRUCT& cs) { return ToggleListView::PreCreateWindow(cs); } -/** +/** * Called by the ToggleListView when the toggle state has changed. */ void StageView::OnStateChanged(int index, int toggleState) { @@ -705,7 +705,7 @@ void StageView::OnStateChanged(int index, int toggleState) { } } -/** +/** * Dispalys the popup menu with the appropriate menu items enabled. */ void StageView::PopupMenu(CPoint* pt) { @@ -759,7 +759,7 @@ void StageView::PopupMenu(CPoint* pt) { pPopupMenu->TrackPopupMenu (TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt->x, pt->y, &list); } -/** +/** * Performs the stage move when the user has dragged and dropped a stage. */ void StageView::DropItemOnList() { @@ -777,12 +777,12 @@ void StageView::DropItemOnList() { //Move the stage data MaterialDoc* material = materialDocManager->GetCurrentMaterialDoc(); - + internalChange = true; toStage = dropIndex-1; material->MoveStage(dragIndex-1, dropIndex-1); internalChange = false; - + if(dragIndex < dropIndex) { dropIndex++; } @@ -822,7 +822,3 @@ void StageView::DropItemOnList() { } m_propView->SetPropertyListType(type, toStage); } - - - - diff --git a/neo/tools/materialeditor/StageView.h b/neo/tools/materialeditor/StageView.h index e87480ff..13de58ec 100644 --- a/neo/tools/materialeditor/StageView.h +++ b/neo/tools/materialeditor/StageView.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 @@ class StageView : public ToggleListView, public MaterialView public: virtual ~StageView(); - /** + /** * Defines the type of stages */ enum { @@ -79,29 +79,29 @@ protected: DECLARE_DYNCREATE(StageView) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnLvnDeleteallitems(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnLvnBegindrag(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnLButtonUp(UINT nFlags, CPoint point); - afx_msg void OnMouseMove(UINT nFlags, CPoint point); - afx_msg void OnNMRclick(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnLvnDeleteallitems(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnLvnBegindrag(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnLButtonUp(UINT nFlags, CPoint point); + afx_msg void OnMouseMove(UINT nFlags, CPoint point); + afx_msg void OnNMRclick(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnRenameStage(); - afx_msg void OnDeleteStage(); - afx_msg void OnDeleteAllStages(); - afx_msg void OnAddStage(); - afx_msg void OnAddBumpmapStage(); - afx_msg void OnAddDiffuseStage(); - afx_msg void OnAddSpecualarStage(); + afx_msg void OnRenameStage(); + afx_msg void OnDeleteStage(); + afx_msg void OnDeleteAllStages(); + afx_msg void OnAddStage(); + afx_msg void OnAddBumpmapStage(); + afx_msg void OnAddDiffuseStage(); + afx_msg void OnAddSpecualarStage(); - afx_msg void OnCopy(); - afx_msg void OnPaste(); - - afx_msg void OnLvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnLvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); + afx_msg void OnCopy(); + afx_msg void OnPaste(); + + afx_msg void OnLvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnLvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); DECLARE_MESSAGE_MAP() - + //Overrides virtual BOOL PreTranslateMessage(MSG* pMsg); virtual BOOL PreCreateWindow(CREATESTRUCT& cs); @@ -117,7 +117,7 @@ protected: MaterialPropTreeView* m_propView; MaterialDoc* currentMaterial; - + //Manual handing of the row dragging CImageList* dragImage; bool bDragging; @@ -128,5 +128,3 @@ protected: bool internalChange; }; - - diff --git a/neo/tools/materialeditor/ToggleListView.cpp b/neo/tools/materialeditor/ToggleListView.cpp index 8a5a07ef..97c4ca66 100644 --- a/neo/tools/materialeditor/ToggleListView.cpp +++ b/neo/tools/materialeditor/ToggleListView.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"). @@ -61,9 +61,9 @@ ToggleListView::~ToggleListView() { /** -* Sets the tree icons to dispay for each of the three states. Sets the -* icons to display for each of the three states. The values passed in -* are the resource name that can be generated using MAKEINTRESOUCE. If +* Sets the tree icons to dispay for each of the three states. Sets the +* icons to display for each of the three states. The values passed in +* are the resource name that can be generated using MAKEINTRESOUCE. If * the value passed in is NULL then an icon will not be drawn for that * state. * @param disabled The icon to draw when the state is TOGGLE_STATE_DISABLED. @@ -128,21 +128,21 @@ int ToggleListView::OnCreate(LPCREATESTRUCT lpCreateStruct) { return -1; CListCtrl& list = GetListCtrl(); - + list.SetExtendedStyle(LVS_EX_FULLROWSELECT); //Turn off the horizontal scroll bar //Todo: Figure out why the damn scroll bar pops up list.ModifyStyle(WS_HSCROLL, 0L); - - + + //Insert the one column LVCOLUMN col; col.mask = 0; list.InsertColumn(0, &col); SetToggleIcons(); - + return 0; } @@ -160,7 +160,7 @@ void ToggleListView::OnSize(UINT nType, int cx, int cy) { * Returns the size of each item in the toggle list. */ void ToggleListView::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) { - lpMeasureItemStruct->itemHeight = TOGGLELIST_ITEMHEIGHT; + lpMeasureItemStruct->itemHeight = TOGGLELIST_ITEMHEIGHT; } /** @@ -169,13 +169,13 @@ void ToggleListView::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) { void ToggleListView::OnNMClick(NMHDR *pNMHDR, LRESULT *pResult) { CListCtrl& list = GetListCtrl(); - DWORD dwpos = GetMessagePos(); + DWORD dwpos = GetMessagePos(); LVHITTESTINFO info; info.pt.x = LOWORD(dwpos); - info.pt.y = HIWORD(dwpos); + info.pt.y = HIWORD(dwpos); - ::MapWindowPoints(HWND_DESKTOP, pNMHDR->hwndFrom, &info.pt, 1); + ::MapWindowPoints(HWND_DESKTOP, pNMHDR->hwndFrom, &info.pt, 1); int index = list.HitTest(&info); if ( index != -1 ) { @@ -191,7 +191,7 @@ void ToggleListView::OnNMClick(NMHDR *pNMHDR, LRESULT *pResult) { } else { SetToggleState(index, TOGGLE_STATE_ON, true); } - } + } } } *pResult = 0; @@ -215,11 +215,11 @@ void ToggleListView::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { CListCtrl& ListCtrl=GetListCtrl(); int nItem = lpDrawItemStruct->itemID; - + // get item data LV_ITEM lvi; _TCHAR szBuff[MAX_PATH]; - + memset(&lvi, 0, sizeof(LV_ITEM)); lvi.mask = LVIF_TEXT; lvi.iItem = nItem; @@ -228,8 +228,8 @@ void ToggleListView::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { ListCtrl.GetItem(&lvi); RECT rDraw; - - + + CopyRect ( &rDraw, &lpDrawItemStruct->rcItem ); rDraw.right = rDraw.left + TOGGLELIST_ITEMHEIGHT; rDraw.top ++; @@ -262,15 +262,15 @@ void ToggleListView::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { } break; }; - + CopyRect ( &rDraw, &lpDrawItemStruct->rcItem ); rDraw.left += TOGGLELIST_ITEMHEIGHT; rDraw.left += 1; if ( lpDrawItemStruct->itemState & ODS_SELECTED ) { - FillRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_HIGHLIGHT ) ); + FillRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_HIGHLIGHT ) ); } else { - FillRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_WINDOW ) ); + FillRect ( lpDrawItemStruct->hDC, &rDraw, GetSysColorBrush ( COLOR_WINDOW ) ); } rDraw.left += TEXT_OFFSET; @@ -289,18 +289,14 @@ void ToggleListView::Draw3dRect (HDC hDC, RECT* rect, HBRUSH topLeft, HBRUSH bot RECT rOut; SetRect ( &rOut, rect->left, rect->top, rect->right - 1, rect->top + 1 ); - FillRect ( hDC,&rOut, topLeft ); + FillRect ( hDC,&rOut, topLeft ); SetRect ( &rOut, rect->left, rect->top, rect->left + 1, rect->bottom ); - FillRect( hDC,&rOut, topLeft ); + FillRect( hDC,&rOut, topLeft ); SetRect ( &rOut, rect->right, rect->top, rect->right -1, rect->bottom ); - FillRect( hDC,&rOut, bottomRight ); + FillRect( hDC,&rOut, bottomRight ); SetRect ( &rOut, rect->left, rect->bottom, rect->right, rect->bottom - 1 ); - FillRect( hDC,&rOut, bottomRight ); + FillRect( hDC,&rOut, bottomRight ); } - - - - diff --git a/neo/tools/materialeditor/ToggleListView.h b/neo/tools/materialeditor/ToggleListView.h index cfbdc612..d1e7132e 100644 --- a/neo/tools/materialeditor/ToggleListView.h +++ b/neo/tools/materialeditor/ToggleListView.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"). @@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms /** * A simple list view that supports a toggle button. ToggleListView is a simple extension * to the CListView class that support a toggle button. It is limited to a single column -* and always uses full row select. The toggle state is stored in the data for each item +* and always uses full row select. The toggle state is stored in the data for each item * so users of this class should not attempt to use the data field for storage. lparam can * be used instead. */ @@ -52,13 +52,13 @@ public: void SetToggleIcons(LPCSTR disabled = NULL, LPCSTR on = NULL, LPCSTR off = NULL); void SetToggleState(int index, int toggleState, bool notify = false); int GetToggleState(int index); - + //Windows messages afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct); - afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult); - + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct); + afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult); + DECLARE_MESSAGE_MAP() @@ -81,7 +81,5 @@ protected: HICON onIcon; HICON offIcon; HICON disabledIcon; - + }; - - diff --git a/neo/tools/particle/DialogParticleEditor.cpp b/neo/tools/particle/DialogParticleEditor.cpp index b400fb9a..1b71ed50 100644 --- a/neo/tools/particle/DialogParticleEditor.cpp +++ b/neo/tools/particle/DialogParticleEditor.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"). @@ -553,7 +553,7 @@ idDeclParticle *CDialogParticleEditor::GetCurParticle() { } void CDialogParticleEditor::UpdateParticleData() { - + listStages.ResetContent(); idDeclParticle *idp = GetCurParticle(); if ( idp == NULL ) { @@ -572,7 +572,7 @@ void CDialogParticleEditor::UpdateParticleData() { wnd->SetWindowText( va( "Particle file: %s", idp->GetFileName() ) ); } - SetParticleView(); + SetParticleView(); } void CDialogParticleEditor::OnCbnSelchangeComboParticles() { @@ -710,7 +710,7 @@ void CDialogParticleEditor::OnBnClickedImpact() { SetParticleView(); } -void CDialogParticleEditor::OnBnClickedMuzzle(){ +void CDialogParticleEditor::OnBnClickedMuzzle(){ visualization = MUZZLE; SetParticleView(); } @@ -725,8 +725,8 @@ void CDialogParticleEditor::OnBnClickedSelected() { SetParticleView(); } -void CDialogParticleEditor::SetParticleVisualization( int i ) { - visualization = i; +void CDialogParticleEditor::SetParticleVisualization( int i ) { + visualization = i; SetParticleView(); } @@ -738,7 +738,7 @@ void CDialogParticleEditor::SetParticleView() { cmdSystem->BufferCommandText( CMD_EXEC_NOW, "testmodel" ); idStr str; switch ( visualization ) { - case TESTMODEL : + case TESTMODEL : str = idp->GetName(); str.SetFileExtension( ".prt" ); cmdSystem->BufferCommandText( CMD_EXEC_NOW, va("testmodel %s\n", str.c_str() ) ); @@ -822,14 +822,14 @@ void CDialogParticleEditor::OnBnClickedEntityColor() { void CDialogParticleEditor::AddStage() { - + idDeclParticle *idp = GetCurParticle(); if ( idp == NULL ) { return; } idParticleStage *stage = new idParticleStage; - + if ((GetAsyncKeyState(VK_CONTROL) & 0x8000)) { idParticleStage *source = GetCurStage(); if ( source == NULL ) { @@ -1021,7 +1021,7 @@ void CDialogParticleEditor::CurStageToDlgVars() { initialAngle = va( "%.3f", ps->initialAngle ); boundsExpansion = va( "%.3f", ps->boundsExpansion ); randomDistribution = ps->randomDistribution; - entityColor = ps->entityColor; + entityColor = ps->entityColor; UpdateData( FALSE ); } @@ -1075,7 +1075,7 @@ void CDialogParticleEditor::DlgVarsToCurStage() { ps->cycles = atof( cycles ); ps->cycleMsec = ( ps->particleLife + ps->deadTime ) * 1000; - sscanf( customParms, "%f %f %f %f %f %f %f %f", &ps->customPathParms[0], &ps->customPathParms[1], &ps->customPathParms[2], + sscanf( customParms, "%f %f %f %f %f %f %f %f", &ps->customPathParms[0], &ps->customPathParms[1], &ps->customPathParms[2], &ps->customPathParms[3], &ps->customPathParms[4], &ps->customPathParms[5], &ps->customPathParms[6], &ps->customPathParms[7] ); @@ -1138,7 +1138,7 @@ void CDialogParticleEditor::OnBnClickedButtonSave() { } if ( strstr( idp->GetFileName(), "implicit" ) ) { - // defaulted, need to choose a file + // defaulted, need to choose a file CFileDialog dlgSave( FALSE, "prt", NULL, OFN_OVERWRITEPROMPT, "Particle Files (*.prt)|*.prt||All Files (*.*)|*.*||", AfxGetMainWnd() ); if ( dlgSave.DoModal() == IDOK ) { idStr fileName; @@ -1205,14 +1205,14 @@ void CDialogParticleEditor::SetVectorControlUpdate( idQuat rotation ) { } BOOL CDialogParticleEditor::OnInitDialog() { - + com_editors |= EDITOR_PARTICLE; particleMode = ( cvarSystem->GetCVarInteger( "g_editEntityMode" ) == 4 ); mapModified = false; CDialog::OnInitDialog(); - + sliderBunching.SetRange( 0, 20 ); sliderBunching.SetValueRange( 0.0f, 1.0f ); sliderFadeIn.SetRange( 0, 20 ); @@ -1243,7 +1243,7 @@ BOOL CDialogParticleEditor::OnInitDialog() { sliderAspectTo.SetValueRange( 0.0f, 128.0f ); sliderFadeFraction.SetRange( 0, 20 ); sliderFadeFraction.SetValueRange( 0.0f, 1.0f ); - + EnumParticles(); SetParticleView(); @@ -1258,7 +1258,7 @@ BOOL CDialogParticleEditor::OnInitDialog() { } wnd = wnd->GetWindow( GW_HWNDNEXT ); } - + wnd = GetDlgItem( IDC_BUTTON_SAVE_PARTICLEENTITIES ); if ( wnd ) { wnd->EnableWindow( FALSE ); @@ -1396,37 +1396,37 @@ void CDialogParticleEditor::UpdateSelectedOrigin( float x, float y, float z ) { } } -void CDialogParticleEditor::OnBtnYup() +void CDialogParticleEditor::OnBtnYup() { UpdateSelectedOrigin(0, 8, 0); } -void CDialogParticleEditor::OnBtnYdn() +void CDialogParticleEditor::OnBtnYdn() { UpdateSelectedOrigin(0, -8, 0); } -void CDialogParticleEditor::OnBtnXdn() +void CDialogParticleEditor::OnBtnXdn() { UpdateSelectedOrigin(-8, 0, 0); } -void CDialogParticleEditor::OnBtnXup() +void CDialogParticleEditor::OnBtnXup() { UpdateSelectedOrigin(8, 0, 0); } -void CDialogParticleEditor::OnBtnZup() +void CDialogParticleEditor::OnBtnZup() { UpdateSelectedOrigin(0, 0, 8); } -void CDialogParticleEditor::OnBtnZdn() +void CDialogParticleEditor::OnBtnZdn() { UpdateSelectedOrigin(0, 0, -8); } -void CDialogParticleEditor::OnBtnDrop() +void CDialogParticleEditor::OnBtnDrop() { idStr classname; idStr key; @@ -1438,7 +1438,7 @@ void CDialogParticleEditor::OnBtnDrop() if ( !gameEdit->PlayerIsValid() ) { return; } - + gameEdit->PlayerGetViewAngles( viewAngles ); gameEdit->PlayerGetEyePosition( org ); diff --git a/neo/tools/particle/DialogParticleEditor.h b/neo/tools/particle/DialogParticleEditor.h index 721f93ab..bde73ae4 100644 --- a/neo/tools/particle/DialogParticleEditor.h +++ b/neo/tools/particle/DialogParticleEditor.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,13 +37,13 @@ public: low = _low; high = _high; } - + void SetValuePos( float val ) { SetPos( GetRangeMin() + ( GetRangeMax() - GetRangeMin() ) * ( val - low ) / ( high - low ) ); } float GetValue() { - return low + ( high - low ) * ( float )( GetPos() - GetRangeMin() ) / ( GetRangeMax() - GetRangeMin() ); + return low + ( high - low ) * ( float )( GetPos() - GetRangeMin() ) / ( GetRangeMax() - GetRangeMin() ); } private: float low, high; diff --git a/neo/tools/pda/DialogPDAEditor.cpp b/neo/tools/pda/DialogPDAEditor.cpp index 286d520d..3e06c30a 100644 --- a/neo/tools/pda/DialogPDAEditor.cpp +++ b/neo/tools/pda/DialogPDAEditor.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"). @@ -175,17 +175,17 @@ void CDialogPDAEditor::OnDestroy() { return CDialog::OnDestroy(); } -BOOL CDialogPDAEditor::OnInitDialog() +BOOL CDialogPDAEditor::OnInitDialog() { CDialog::OnInitDialog(); - + // Indicate the PDA dialog is opened com_editors |= EDITOR_PDA; PopulatePDAList(); return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } BOOL CDialogPDAEditor::PreTranslateMessage(MSG* pMsg) @@ -278,7 +278,7 @@ void CDialogPDAEditor::OnBtnClickedSave() declText += "pda "; declText += pda->GetName(); declText += " {\n"; - + declText += "\tname \t\t\"" + shortName + "\"\n"; declText += "\tfullname\t\t\"" + fullName + "\"\n"; declText += "\ticon \t\t\"\"\n"; @@ -474,14 +474,14 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDialogPDAEditor message handlers -BOOL CDialogPDAEditEmail::OnInitDialog() +BOOL CDialogPDAEditEmail::OnInitDialog() { CDialog::OnInitDialog(); SetWindowText( "Editing Email: " + name ); return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } void CDialogPDAEditEmail::SetName( CString &_name ) @@ -525,4 +525,3 @@ CString CDialogPDAEditEmail::GetDeclText() return declText; } - diff --git a/neo/tools/pda/DialogPDAEditor.h b/neo/tools/pda/DialogPDAEditor.h index 9d8e116c..4dd7e817 100644 --- a/neo/tools/pda/DialogPDAEditor.h +++ b/neo/tools/pda/DialogPDAEditor.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"). @@ -66,7 +66,7 @@ protected: afx_msg void OnBtnClickedAudioAdd(); afx_msg void OnBtnClickedAudioEdit(); afx_msg void OnBtnClickedAudioDel(); - + afx_msg void OnBtnClickedVideoAdd(); afx_msg void OnBtnClickedVideoEdit(); afx_msg void OnBtnClickedVideoDel(); diff --git a/neo/tools/radiant/CSG.CPP b/neo/tools/radiant/CSG.CPP index 2c02946f..2fd3c748 100644 --- a/neo/tools/radiant/CSG.CPP +++ b/neo/tools/radiant/CSG.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"). @@ -50,7 +50,7 @@ void CSG_MakeHollow (void) { next = b->next; - if (b->owner->eclass->fixedsize || b->pPatch || b->hiddenBrush || b->modelHandle > 0) + if (b->owner->eclass->fixedsize || b->pPatch || b->hiddenBrush || b->modelHandle > 0) continue; for ( f = b->brush_faces; f; f = f->next ) { @@ -500,7 +500,7 @@ void CSG_Subtract (void) snext = s->next; for (i=0 ; i<3 ; i++) - if (b->mins[i] >= s->maxs[i] - ON_EPSILON + if (b->mins[i] >= s->maxs[i] - ON_EPSILON || b->maxs[i] <= s->mins[i] + ON_EPSILON) break; if (i != 3) @@ -538,7 +538,7 @@ void CSG_Subtract (void) } for (i=0 ; i<3 ; i++) - if (b->mins[i] >= s->maxs[i] - ON_EPSILON + if (b->mins[i] >= s->maxs[i] - ON_EPSILON || b->maxs[i] <= s->mins[i] + ON_EPSILON) break; if (i != 3) diff --git a/neo/tools/radiant/CamWnd.cpp b/neo/tools/radiant/CamWnd.cpp index e72f63f1..425d73e6 100644 --- a/neo/tools/radiant/CamWnd.cpp +++ b/neo/tools/radiant/CamWnd.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"). @@ -332,20 +332,20 @@ int CCamWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { QEW_SetupPixelFormat(hDC, true); HFONT hfont = CreateFont( - 12, // logical height of font - 0, // logical average character width - 0, // angle of escapement - 0, // base-line orientation angle - 0, // font weight - 0, // italic attribute flag - 0, // underline attribute flag - 0, // strikeout attribute flag - 0, // character set identifier - 0, // output precision - 0, // clipping precision - 0, // output quality - FIXED_PITCH | FF_MODERN, // pitch and family - "Lucida Console" // pointer to typeface name string + 12, // logical height of font + 0, // logical average character width + 0, // angle of escapement + 0, // base-line orientation angle + 0, // font weight + 0, // italic attribute flag + 0, // underline attribute flag + 0, // strikeout attribute flag + 0, // character set identifier + 0, // output precision + 0, // clipping precision + 0, // output quality + FIXED_PITCH | FF_MODERN, // pitch and family + "Lucida Console" // pointer to typeface name string ); if (!hfont) { @@ -580,7 +580,7 @@ void CCamWnd::Cam_MouseControl(float dtime) { VectorMA(camera.origin, xf * dtime * g_nMoveSpeed, camera.right, camera.origin); } else -#endif +#endif { xf *= 1.0f - idMath::Fabs(yf); if ( xf < 0.0f ) { @@ -749,7 +749,7 @@ bool CCamWnd::CullBrush(brush_t *b, bool cubicOnly) { } if (g_PrefsDlg.m_bCubicClipping) { - + float distance = g_PrefsDlg.m_nCubicScale * 64; idVec3 mid; @@ -862,11 +862,11 @@ extern void glLabeledPoint(idVec4 &color, idVec3 &point, float size, const char void DrawAxial(face_t *selFace) { if (g_bAxialMode) { idVec3 points[4]; - + for (int j = 0; j < selFace->face_winding->GetNumPoints(); j++) { glLabeledPoint(idVec4(1, 1, 1, 1), (*selFace->face_winding)[j].ToVec3(), 3, va("%i", j)); } - + ValidateAxialPoints(); points[0] = (*selFace->face_winding)[g_axialAnchor].ToVec3(); VectorMA (points[0], 1, selFace->plane, points[0]); @@ -888,7 +888,7 @@ void DrawAxial(face_t *selFace) { /* ======================================================================================================================= - Cam_Draw + Cam_Draw ======================================================================================================================= */ void CCamWnd::SetProjectionMatrix() { @@ -983,7 +983,7 @@ void CCamWnd::Cam_Draw() { qglTranslatef(-m_Camera.origin[0], -m_Camera.origin[1], -m_Camera.origin[2]); Cam_BuildMatrix(); - + for (brush = active_brushes.next; brush != &active_brushes; brush = brush->next) { if ( CullBrush(brush, false) ) { @@ -1044,9 +1044,9 @@ void CCamWnd::Cam_Draw() { continue; } - if ( brush->owner->eclass->entityModel ) { - continue; - } + if ( brush->owner->eclass->entityModel ) { + continue; + } for (face = brush->brush_faces; face; face = face->next) { Face_Draw(face); @@ -1061,7 +1061,7 @@ void CCamWnd::Cam_Draw() { Face_Draw(selFace); DrawAxial(selFace); } - } + } // non-zbuffered outline qglDisable(GL_BLEND); @@ -1115,7 +1115,7 @@ void CCamWnd::Cam_Draw() { } g_splineList->draw (static_cast(g_qeglobals.d_select_mode == sel_addpoint || g_qeglobals.d_select_mode == sel_editpoint)); - + if ( g_qeglobals.selectObject && (g_qeglobals.d_select_mode == sel_addpoint || g_qeglobals.d_select_mode == sel_editpoint) ) { g_qeglobals.selectObject->drawSelection(); } @@ -1424,7 +1424,7 @@ void Tris_ToOBJ(const char *outFile, idTriList *tris, idMatList *mats) { int i1, i2, i3; i1 = tri->indexes[j+2] + indexBase; i2 = tri->indexes[j+1] + indexBase; - i3 = tri->indexes[j] + indexBase; + i3 = tri->indexes[j] + indexBase; f->Printf( "f %i/%i/%i %i/%i/%i %i/%i/%i\n", i1,i1,i1, i2,i2,i2, i3,i3,i3 ); } @@ -1626,7 +1626,7 @@ int Brush_ToTris(brush_t *brush, idTriList *tris, idMatList *mats, bool models, mats->Append(face->d_texture); numSurfaces++; } - + return numSurfaces; } @@ -1722,7 +1722,7 @@ void CCamWnd::BuildRendererState() { worldModel = renderModelManager->AllocModel(); worldModel->InitEmpty( "EditorWorldModel" ); - for ( brush_t *brushList = &active_brushes ; brushList ; + for ( brush_t *brushList = &active_brushes ; brushList ; brushList = (brushList == &active_brushes) ? &selected_brushes : NULL ) { for (brush = brushList->next; brush != brushList; brush = brush->next) { @@ -1741,7 +1741,7 @@ void CCamWnd::BuildRendererState() { idTriList tris(1024); idMatList mats(1024); - + if (!IsBModel(brush)) { numSurfaces += Brush_ToTris( brush, &tris, &mats, false, false ); } @@ -1866,13 +1866,13 @@ CCamWnd::UpdateCaption ======================== */ void CCamWnd::UpdateCaption() { - + idStr strCaption; if (worldDirty) { strCaption = "*"; } - // FIXME: + // FIXME: strCaption += (renderMode) ? "RENDER" : "CAM"; if (renderMode) { strCaption += (rebuildMode) ? " (Realtime)" : ""; @@ -2047,7 +2047,7 @@ void CCamWnd::DrawEntityData() { /* ======================================================================================================================= - Cam_Render + Cam_Render This used the renderSystem to draw a fully lit view of the world ======================================================================================================================= @@ -2089,13 +2089,13 @@ void CCamWnd::Cam_Render() { // the editor uses opposite pitch convention refdef.viewaxis = idAngles( -m_Camera.angles.pitch, m_Camera.angles.yaw, m_Camera.angles.roll ).ToMat3(); - + refdef.width = SCREEN_WIDTH; refdef.height = SCREEN_HEIGHT; refdef.fov_x = 90; refdef.fov_y = 2 * atan((float)m_Camera.height / m_Camera.width) * idMath::M_RAD2DEG; - // only set in animation mode to give a consistent look + // only set in animation mode to give a consistent look if (animationMode) { refdef.time = eventLoop->Milliseconds(); } @@ -2118,7 +2118,7 @@ void CCamWnd::Cam_Render() { } -void CCamWnd::OnTimer(UINT nIDEvent) +void CCamWnd::OnTimer(UINT nIDEvent) { if (animationMode || nIDEvent == 1) { Sys_UpdateWindows(W_CAMERA); @@ -2151,7 +2151,7 @@ void CCamWnd::UpdateCameraView() { idAngles ang = v.ToMat3().ToAngles(); ang.pitch = -ang.pitch; ang.roll = 0.0f; - SetView( ent->origin, ang ); + SetView( ent->origin, ang ); Cam_BuildMatrix(); Sys_UpdateWindows( W_CAMERA ); return; @@ -2165,4 +2165,3 @@ void CCamWnd::UpdateCameraView() { saveValid = false; } } - diff --git a/neo/tools/radiant/CamWnd.h b/neo/tools/radiant/CamWnd.h index c14da77a..2bbe1bd3 100644 --- a/neo/tools/radiant/CamWnd.h +++ b/neo/tools/radiant/CamWnd.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"). @@ -50,7 +50,7 @@ typedef struct camera_draw_mode draw_mode; - idVec3 color; // background + idVec3 color; // background idVec3 forward, right, up; // move matrix idVec3 vup, vpn, vright; // view matrix diff --git a/neo/tools/radiant/CameraTargetDlg.cpp b/neo/tools/radiant/CameraTargetDlg.cpp index b1fae1ef..ab546426 100644 --- a/neo/tools/radiant/CameraTargetDlg.cpp +++ b/neo/tools/radiant/CameraTargetDlg.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"). @@ -71,8 +71,8 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CCameraTargetDlg message handlers -void CCameraTargetDlg::OnPopupNewcameraFixed() +void CCameraTargetDlg::OnPopupNewcameraFixed() { // TODO: Add your command handler code here - + } diff --git a/neo/tools/radiant/CameraTargetDlg.h b/neo/tools/radiant/CameraTargetDlg.h index d1209a29..ca3d9866 100644 --- a/neo/tools/radiant/CameraTargetDlg.h +++ b/neo/tools/radiant/CameraTargetDlg.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/neo/tools/radiant/CapDialog.cpp b/neo/tools/radiant/CapDialog.cpp index 4b315167..dcac4a93 100644 --- a/neo/tools/radiant/CapDialog.cpp +++ b/neo/tools/radiant/CapDialog.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/neo/tools/radiant/CapDialog.h b/neo/tools/radiant/CapDialog.h index 89ea54a3..e78451eb 100644 --- a/neo/tools/radiant/CapDialog.h +++ b/neo/tools/radiant/CapDialog.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/neo/tools/radiant/CommandsDlg.cpp b/neo/tools/radiant/CommandsDlg.cpp index 08fb1ac0..eb9a0387 100644 --- a/neo/tools/radiant/CommandsDlg.cpp +++ b/neo/tools/radiant/CommandsDlg.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 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CCommandsDlg message handlers -BOOL CCommandsDlg::OnInitDialog() +BOOL CCommandsDlg::OnInitDialog() { CDialog::OnInitDialog(); m_lstCommands.SetTabStops(120); @@ -113,4 +113,3 @@ BOOL CCommandsDlg::OnInitDialog() fileout.Close(); return TRUE; } - diff --git a/neo/tools/radiant/CommandsDlg.h b/neo/tools/radiant/CommandsDlg.h index 89382158..101a7d4e 100644 --- a/neo/tools/radiant/CommandsDlg.h +++ b/neo/tools/radiant/CommandsDlg.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/neo/tools/radiant/CommentsDlg.cpp b/neo/tools/radiant/CommentsDlg.cpp index ece09f63..b4837ac4 100644 --- a/neo/tools/radiant/CommentsDlg.cpp +++ b/neo/tools/radiant/CommentsDlg.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"). @@ -61,5 +61,5 @@ void CCommentsDlg::DoDataExchange(CDataExchange* pDX) BEGIN_MESSAGE_MAP(CCommentsDlg, CDialog) END_MESSAGE_MAP() - + // CCommentsDlg message handlers diff --git a/neo/tools/radiant/CommentsDlg.h b/neo/tools/radiant/CommentsDlg.h index 0c8de808..dcf90ea7 100644 --- a/neo/tools/radiant/CommentsDlg.h +++ b/neo/tools/radiant/CommentsDlg.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/neo/tools/radiant/ConsoleDlg.cpp b/neo/tools/radiant/ConsoleDlg.cpp index 8a81a83c..5f4bbfaf 100644 --- a/neo/tools/radiant/ConsoleDlg.cpp +++ b/neo/tools/radiant/ConsoleDlg.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,8 +40,8 @@ IMPLEMENT_DYNCREATE(CConsoleDlg, CDialog) CConsoleDlg::CConsoleDlg(CWnd* pParent /*=NULL*/) : CDialog(CConsoleDlg::IDD) { - currentHistoryPosition = -1; - currentCommand = ""; + currentHistoryPosition = -1; + currentCommand = ""; saveCurrentCommand = true; } @@ -124,48 +124,48 @@ BOOL CConsoleDlg::PreTranslateMessage(MSG* pMsg) return TRUE; } - if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_UP ) { - //save off the current in-progress command so we can get back to it + if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_UP ) { + //save off the current in-progress command so we can get back to it if ( saveCurrentCommand == true ) { - CString str; - editInput.GetWindowText ( str ); - currentCommand = str.GetBuffer ( 0 ); + CString str; + editInput.GetWindowText ( str ); + currentCommand = str.GetBuffer ( 0 ); saveCurrentCommand = false; } if ( consoleHistory.Num () > 0 ) { editInput.SetWindowText ( consoleHistory[currentHistoryPosition] ); - + int selLocation = consoleHistory[currentHistoryPosition].Length (); editInput.SetSel ( selLocation , selLocation + 1); } if ( currentHistoryPosition > 0) { - --currentHistoryPosition; - } + --currentHistoryPosition; + } return TRUE; } - if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_DOWN ) { - int selLocation = 0; - if ( currentHistoryPosition < consoleHistory.Num () - 1 ) { - ++currentHistoryPosition; - editInput.SetWindowText ( consoleHistory[currentHistoryPosition] ); - selLocation = consoleHistory[currentHistoryPosition].Length (); - } - else { - editInput.SetWindowText ( currentCommand ); - selLocation = currentCommand.Length (); + if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_DOWN ) { + int selLocation = 0; + if ( currentHistoryPosition < consoleHistory.Num () - 1 ) { + ++currentHistoryPosition; + editInput.SetWindowText ( consoleHistory[currentHistoryPosition] ); + selLocation = consoleHistory[currentHistoryPosition].Length (); + } + else { + editInput.SetWindowText ( currentCommand ); + selLocation = currentCommand.Length (); currentCommand.Clear (); saveCurrentCommand = true; - } - - editInput.SetSel ( selLocation , selLocation + 1); + } + + editInput.SetSel ( selLocation , selLocation + 1); return TRUE; } - if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB ) { + if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB ) { common->Printf ( "Command History\n----------------\n" ); for ( int i = 0 ; i < consoleHistory.Num ();i++ ) { @@ -173,20 +173,20 @@ BOOL CConsoleDlg::PreTranslateMessage(MSG* pMsg) } common->Printf ( "----------------\n" ); } - if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_NEXT) { - editConsole.LineScroll ( 10 ); + if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_NEXT) { + editConsole.LineScroll ( 10 ); } - if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_PRIOR ) { - editConsole.LineScroll ( -10 ); + if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_PRIOR ) { + editConsole.LineScroll ( -10 ); } - if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_HOME ) { - editConsole.LineScroll ( -editConsole.GetLineCount() ); + if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_HOME ) { + editConsole.LineScroll ( -editConsole.GetLineCount() ); } - if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_END ) { - editConsole.LineScroll ( editConsole.GetLineCount() ); + if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_END ) { + editConsole.LineScroll ( editConsole.GetLineCount() ); } } @@ -212,19 +212,19 @@ void CConsoleDlg::ExecuteCommand ( const idStr& cmd ) { editInput.GetWindowText(str); } - if ( str != "" ) { + if ( str != "" ) { editInput.SetWindowText(""); - common->Printf("%s\n", str.GetBuffer(0)); + common->Printf("%s\n", str.GetBuffer(0)); //avoid adding multiple identical commands in a row int index = consoleHistory.Num (); - if ( index == 0 || str.GetBuffer(0) != consoleHistory[index-1]) { + if ( index == 0 || str.GetBuffer(0) != consoleHistory[index-1]) { //keep the history to 16 commands, removing the oldest command if ( consoleHistory.Num () > 16 ) { consoleHistory.RemoveIndex ( 0 ); } - currentHistoryPosition = consoleHistory.Append ( str.GetBuffer (0) ); + currentHistoryPosition = consoleHistory.Append ( str.GetBuffer (0) ); } else { currentHistoryPosition = consoleHistory.Num () - 1; @@ -257,5 +257,5 @@ void CConsoleDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) if ( nState == WA_ACTIVE || nState == WA_CLICKACTIVE ) { editInput.SetFocus(); - } + } } diff --git a/neo/tools/radiant/ConsoleDlg.h b/neo/tools/radiant/ConsoleDlg.h index a06876e4..1099ef23 100644 --- a/neo/tools/radiant/ConsoleDlg.h +++ b/neo/tools/radiant/ConsoleDlg.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,11 +52,11 @@ public: void AddText(const char *msg); void SetConsoleText ( const idStr& text ); void ExecuteCommand ( const idStr& cmd = "" ); - + idStr consoleStr; - idStrList consoleHistory; - idStr currentCommand; - int currentHistoryPosition; + idStrList consoleHistory; + idStr currentCommand; + int currentHistoryPosition; bool saveCurrentCommand; afx_msg void OnSize(UINT nType, int cx, int cy); diff --git a/neo/tools/radiant/CurveDlg.cpp b/neo/tools/radiant/CurveDlg.cpp index 738df233..05e13037 100644 --- a/neo/tools/radiant/CurveDlg.cpp +++ b/neo/tools/radiant/CurveDlg.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/neo/tools/radiant/CurveDlg.h b/neo/tools/radiant/CurveDlg.h index 429cc614..b489e856 100644 --- a/neo/tools/radiant/CurveDlg.h +++ b/neo/tools/radiant/CurveDlg.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/neo/tools/radiant/DRAG.CPP b/neo/tools/radiant/DRAG.CPP index d49bd437..3e069af0 100644 --- a/neo/tools/radiant/DRAG.CPP +++ b/neo/tools/radiant/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"). @@ -173,7 +173,7 @@ static void Drag_Setup( int x, int y, int buttons, } if (g_qeglobals.d_select_mode == sel_vertex) { - + if ( radiant_entityMode.GetBool() ) { return; } @@ -188,7 +188,7 @@ static void Drag_Setup( int x, int y, int buttons, } if (g_qeglobals.d_select_mode == sel_edge) { - + if ( radiant_entityMode.GetBool() ) { return; } @@ -517,7 +517,7 @@ static void MoveSelection( const idVec3 &orgMove ) { if (g_pParentWnd->ActiveXY()->RotateMode() || g_bPatchBendMode) { float fDeg = -move[2]; float fAdj = move[2]; - int axis = 0; + int axis = 0; if (g_pParentWnd->ActiveXY()->GetViewType() == XY) { fDeg = -move[1]; fAdj = move[1]; @@ -757,7 +757,7 @@ void Drag_MouseUp(int nButtons) { Sys_UpdateWindows(W_CAMERA); } */ - + Undo_EndBrushList(&selected_brushes); Undo_End(); } diff --git a/neo/tools/radiant/DialogInfo.cpp b/neo/tools/radiant/DialogInfo.cpp index f15e6bf2..6458ce3c 100644 --- a/neo/tools/radiant/DialogInfo.cpp +++ b/neo/tools/radiant/DialogInfo.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,14 +47,14 @@ void ShowInfoDialog(const char* pText) { if (g_dlgInfo.GetSafeHwnd()) { - g_dlgInfo.m_wndInfo.SetWindowText(pText); - g_dlgInfo.ShowWindow(SW_SHOW); + g_dlgInfo.m_wndInfo.SetWindowText(pText); + g_dlgInfo.ShowWindow(SW_SHOW); } else { - g_dlgInfo.Create(IDD_DLG_INFORMATION); - g_dlgInfo.m_wndInfo.SetWindowText(pText); - g_dlgInfo.ShowWindow(SW_SHOW); + g_dlgInfo.Create(IDD_DLG_INFORMATION); + g_dlgInfo.m_wndInfo.SetWindowText(pText); + g_dlgInfo.ShowWindow(SW_SHOW); } g_pParentWnd->SetFocus(); } @@ -62,7 +62,7 @@ void ShowInfoDialog(const char* pText) void HideInfoDialog() { if (g_dlgInfo.GetSafeHwnd()) - g_dlgInfo.ShowWindow(SW_HIDE); + g_dlgInfo.ShowWindow(SW_HIDE); } @@ -91,11 +91,11 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDialogInfo message handlers -BOOL CDialogInfo::OnInitDialog() +BOOL CDialogInfo::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } diff --git a/neo/tools/radiant/DialogInfo.h b/neo/tools/radiant/DialogInfo.h index 749250ff..1b2beae1 100644 --- a/neo/tools/radiant/DialogInfo.h +++ b/neo/tools/radiant/DialogInfo.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/neo/tools/radiant/DialogTextures.cpp b/neo/tools/radiant/DialogTextures.cpp index 177dac6f..89d2d049 100644 --- a/neo/tools/radiant/DialogTextures.cpp +++ b/neo/tools/radiant/DialogTextures.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,7 +40,7 @@ If you have questions concerning this license or the applicable additional terms #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; -#endif +#endif HTREEITEM FindTreeItem(CTreeCtrl *tree, HTREEITEM root, const char *text, HTREEITEM forceParent); extern void Select_SetKeyVal(const char *key, const char *val); @@ -143,7 +143,7 @@ bool CDialogTextures::loadTree( HTREEITEM item, const idStr &name, CWaitDlg *dlg return true; } - if ( m_treeTextures.ItemHasChildren( item ) ) { + if ( m_treeTextures.ItemHasChildren( item ) ) { idStr childName; HTREEITEM nextItem; @@ -183,7 +183,7 @@ HTREEITEM CDialogTextures::findItem(const char *name, HTREEITEM item, HTREEITEM if (*foundItem || item == NULL) { return *foundItem; } - if (m_treeTextures.ItemHasChildren(item)) { + if (m_treeTextures.ItemHasChildren(item)) { HTREEITEM nextItem; HTREEITEM childItem = m_treeTextures.GetChildItem(item); while (childItem != NULL && *foundItem == NULL) { @@ -475,13 +475,13 @@ void CDialogTextures::OnClickTreeTextures(NMHDR *pNMHDR, LRESULT *pResult) { GetCursorPos(&pt); m_treeTextures.ScreenToClient(&pt); HTREEITEM item = m_treeTextures.HitTest(pt); - + if (item) { DWORD dw = m_treeTextures.GetItemData(item); mode = dw; if (mode == SOUNDS) { idStr loadName; - if (!m_treeTextures.ItemHasChildren(item)) { + if (!m_treeTextures.ItemHasChildren(item)) { loadName = m_treeTextures.GetItemText(item); idStr actionName = m_treeTextures.GetItemText(item); soundSystem->SetMute( false ); @@ -693,13 +693,13 @@ void CDialogTextures::addSounds(bool rootItems) { idStrList list(1024); idStrList list2(1024); HTREEITEM base = m_treeTextures.InsertItem(TypeNames[SOUNDS]); - + for(i = 0; i < declManager->GetNumDecls( DECL_SOUND ); i++) { const idSoundShader *poo = declManager->SoundByIndex(i, false); list.AddUnique( poo->GetFileName() ); } idStrListSortPaths( list ); - + for (i = 0; i < list.Num(); i++) { HTREEITEM child = m_treeTextures.InsertItem(list[i], base); m_treeTextures.SetItemData(child, SOUNDPARENT); @@ -711,7 +711,7 @@ void CDialogTextures::addSounds(bool rootItems) { list2.Append( poo->GetName() ); } } - idStrListSortPaths( list2 ); + idStrListSortPaths( list2 ); for (j = 0; j < list2.Num(); j++) { HTREEITEM child2 = m_treeTextures.InsertItem( list2[j], child ); m_treeTextures.SetItemData(child2, SOUNDS); @@ -720,7 +720,7 @@ void CDialogTextures::addSounds(bool rootItems) { } } - + void CDialogTextures::addStrList( const char *root, const idStrList &list, int id ) { idStr out, path; @@ -739,7 +739,7 @@ void CDialogTextures::addStrList( const char *root, const idStrList &list, int i HTREEITEM item = base; HTREEITEM add; - + int count = list.Num(); idStr last, qt; @@ -827,7 +827,7 @@ void CDialogTextures::addStrList( const char *root, const idStrList &list, int i */ void CDialogTextures::addModels(bool rootItems) { idFileList *files; - + files = fileSystem->ListFilesTree( "models", ".ase|.lwo|.ma", true ); if ( files->GetNumFiles() ) { @@ -856,7 +856,7 @@ void CDialogTextures::addGuis( bool rootItems ) { void CDialogTextures::addScripts(bool rootItems) { /* idFileList *files; - + files = fileSystem->ListFilesExt( "def", ".script" ); if ( files->GetNumFiles() ) { @@ -878,7 +878,7 @@ void CDialogTextures::OnDblclkTreeTextures(NMHDR *pNMHDR, LRESULT *pResult) { DWORD dw = m_treeTextures.GetItemData(item); mode = dw; if (mode == SOUNDS) { - if (!m_treeTextures.ItemHasChildren(item)) { + if (!m_treeTextures.ItemHasChildren(item)) { idStr shaderName = m_treeTextures.GetItemText(item); Select_SetKeyVal("s_shader", shaderName); entity_t *ent = selected_brushes.next->owner; @@ -908,7 +908,7 @@ void CDialogTextures::OnPreview() { } -//void CDialogTextures::OnSave() +//void CDialogTextures::OnSave() //{ /* CString str; @@ -919,20 +919,20 @@ void CDialogTextures::OnPreview() { */ //} -int CDialogTextures::OnCreate(LPCREATESTRUCT lpCreateStruct) +int CDialogTextures::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDialog::OnCreate(lpCreateStruct) == -1) return -1; - + // TODO: Add your specialized creation code here - + return 0; } -void CDialogTextures::OnSize(UINT nType, int cx, int cy) +void CDialogTextures::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); - + if (m_btnLoad.GetSafeHwnd() == NULL) { return; } @@ -953,7 +953,7 @@ void CDialogTextures::OnSize(UINT nType, int cx, int cy) m_chkHideRoot.GetWindowRect(rect3); m_chkHideRoot.SetWindowPos(NULL, right - rect3.Width() * 2, rect.top + 4, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); m_chkHideRoot.ShowWindow(SW_HIDE); - + int verticalSpace = (rect.Height() - rect2.Height() - 12) / 2; m_treeTextures.SetWindowPos(NULL, rect.left + 4, rect.top + 8 + rect2.Height(), (rect.Width() - 8), verticalSpace, SWP_SHOWWINDOW); @@ -962,12 +962,12 @@ void CDialogTextures::OnSize(UINT nType, int cx, int cy) RedrawWindow(); } -BOOL CDialogTextures::PreCreateWindow(CREATESTRUCT& cs) +BOOL CDialogTextures::PreCreateWindow(CREATESTRUCT& cs) { return CDialog::PreCreateWindow(cs); } -void CDialogTextures::OnCheckHideroot() +void CDialogTextures::OnCheckHideroot() { BuildTree(); } @@ -1009,7 +1009,7 @@ void CDialogTextures::OnNMRclickTreeTextures(NMHDR *pNMHDR, LRESULT *pResult) GetCursorPos(&pt); m_treeTextures.ScreenToClient(&pt); HTREEITEM item = m_treeTextures.HitTest(pt); - + if (item) { DWORD dw = m_treeTextures.GetItemData(item); mode = dw; diff --git a/neo/tools/radiant/DialogTextures.h b/neo/tools/radiant/DialogTextures.h index 1fb40c45..b98fbbff 100644 --- a/neo/tools/radiant/DialogTextures.h +++ b/neo/tools/radiant/DialogTextures.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/neo/tools/radiant/DialogThick.cpp b/neo/tools/radiant/DialogThick.cpp index c2917a38..616f7cf8 100644 --- a/neo/tools/radiant/DialogThick.cpp +++ b/neo/tools/radiant/DialogThick.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/neo/tools/radiant/DialogThick.h b/neo/tools/radiant/DialogThick.h index 1d432bb7..a7510500 100644 --- a/neo/tools/radiant/DialogThick.h +++ b/neo/tools/radiant/DialogThick.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/neo/tools/radiant/DlgCamera.cpp b/neo/tools/radiant/DlgCamera.cpp index 980350c2..6a1a0a95 100644 --- a/neo/tools/radiant/DlgCamera.cpp +++ b/neo/tools/radiant/DlgCamera.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"). @@ -56,7 +56,7 @@ void showCameraInspector() { g_dlgCamera.SetWindowPos(NULL, rct.left, rct.top, 0,0, SWP_NOSIZE | SWP_SHOWWINDOW); } Sys_UpdateWindows(W_ALL); - } + } g_dlgCamera.ShowWindow(SW_SHOW); g_dlgCamera.setupFromCamera(); } @@ -123,7 +123,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDlgCamera message handlers -void CDlgCamera::OnBtnAddevent() +void CDlgCamera::OnBtnAddevent() { CDlgEvent dlg; if (dlg.DoModal() == IDOK) { @@ -133,7 +133,7 @@ void CDlgCamera::OnBtnAddevent() } } -void CDlgCamera::OnBtnAddtarget() +void CDlgCamera::OnBtnAddtarget() { CCameraTargetDlg dlg; if (dlg.DoModal() == IDOK) { @@ -144,25 +144,25 @@ void CDlgCamera::OnBtnAddtarget() } } -void CDlgCamera::OnBtnDelevent() +void CDlgCamera::OnBtnDelevent() { // TODO: Add your control notification handler code here - + } -void CDlgCamera::OnBtnDeltarget() +void CDlgCamera::OnBtnDeltarget() { // TODO: Add your control notification handler code here - + } -void CDlgCamera::OnDblclkComboSplines() +void CDlgCamera::OnDblclkComboSplines() { // TODO: Add your control notification handler code here - + } -void CDlgCamera::OnSelchangeComboSplines() +void CDlgCamera::OnSelchangeComboSplines() { UpdateData(TRUE); g_qeglobals.d_select_mode = (m_editPoints == 0) ? sel_editpoint : sel_addpoint; @@ -184,16 +184,16 @@ void CDlgCamera::OnSelchangeComboSplines() Sys_UpdateWindows(W_ALL); } -void CDlgCamera::OnSelchangeListEvents() +void CDlgCamera::OnSelchangeListEvents() { int sel = m_wndEvents.GetCurSel(); //g_splineList->setActiveSegment(sel >= 0 ? sel : 0); } -void CDlgCamera::OnDblclkListEvents() +void CDlgCamera::OnDblclkListEvents() { // TODO: Add your control notification handler code here - + } void CDlgCamera::setupFromCamera() @@ -224,15 +224,15 @@ void CDlgCamera::setupFromCamera() UpdateData(FALSE); } -BOOL CDlgCamera::OnInitDialog() +BOOL CDlgCamera::OnInitDialog() { CDialog::OnInitDialog(); setupFromCamera(); return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } -void CDlgCamera::OnOK() +void CDlgCamera::OnOK() { g_dlgCamera.ShowWindow(SW_HIDE); g_qeglobals.d_select_mode = sel_brush; @@ -240,7 +240,7 @@ void CDlgCamera::OnOK() Sys_UpdateWindows(W_ALL); } -void CDlgCamera::OnDestroy() +void CDlgCamera::OnDestroy() { if (GetSafeHwnd()) { CRect rct; @@ -252,7 +252,7 @@ void CDlgCamera::OnDestroy() } -void CDlgCamera::OnApply() +void CDlgCamera::OnApply() { UpdateData(TRUE); g_splineList->setBaseTime(m_fSeconds); @@ -261,7 +261,7 @@ void CDlgCamera::OnApply() m_wndSegments.SetScrollRange(0, g_splineList->getTotalTime() * 4.0); } -void CDlgCamera::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +void CDlgCamera::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { CDialog::OnHScroll(nSBCode, nPos, pScrollBar); int max = g_splineList->getTotalTime() * 4; @@ -319,13 +319,13 @@ void CDlgCamera::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) Sys_UpdateWindows(W_XY | W_CAMERA); } -void CDlgCamera::OnFileNew() +void CDlgCamera::OnFileNew() { g_splineList->clear(); setupFromCamera(); } -void CDlgCamera::OnFileOpen() +void CDlgCamera::OnFileOpen() { DialogName dlg("Open Camera File"); if (dlg.DoModal() == IDOK) { @@ -334,7 +334,7 @@ void CDlgCamera::OnFileOpen() } } -void CDlgCamera::OnFileSave() +void CDlgCamera::OnFileSave() { DialogName dlg("Save Camera File"); if (dlg.DoModal() == IDOK) { @@ -342,31 +342,31 @@ void CDlgCamera::OnFileSave() } } -void CDlgCamera::OnTestcamera() +void CDlgCamera::OnTestcamera() { // TODO: Add your control notification handler code here - + } -void CDlgCamera::OnBtnDeletepoints() +void CDlgCamera::OnBtnDeletepoints() { // TODO: Add your control notification handler code here - + } -void CDlgCamera::OnBtnSelectall() +void CDlgCamera::OnBtnSelectall() { // TODO: Add your control notification handler code here - + } -void CDlgCamera::OnRadioEditpoints() +void CDlgCamera::OnRadioEditpoints() { UpdateData(TRUE); g_qeglobals.d_select_mode = sel_editpoint; } -void CDlgCamera::OnRadioAddPoints() +void CDlgCamera::OnRadioAddPoints() { UpdateData(TRUE); g_qeglobals.d_select_mode = sel_addpoint; diff --git a/neo/tools/radiant/DlgCamera.h b/neo/tools/radiant/DlgCamera.h index a710df93..aa22a722 100644 --- a/neo/tools/radiant/DlgCamera.h +++ b/neo/tools/radiant/DlgCamera.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/neo/tools/radiant/DlgEvent.cpp b/neo/tools/radiant/DlgEvent.cpp index bcb5df75..70784fc3 100644 --- a/neo/tools/radiant/DlgEvent.cpp +++ b/neo/tools/radiant/DlgEvent.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/neo/tools/radiant/DlgEvent.h b/neo/tools/radiant/DlgEvent.h index f2e295c2..d36b5735 100644 --- a/neo/tools/radiant/DlgEvent.h +++ b/neo/tools/radiant/DlgEvent.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/neo/tools/radiant/ECLASS.CPP b/neo/tools/radiant/ECLASS.CPP index c2d2cd3e..c7ebb6dd 100644 --- a/neo/tools/radiant/ECLASS.CPP +++ b/neo/tools/radiant/ECLASS.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"). @@ -99,16 +99,16 @@ void ExtendBounds(idVec3 v, idVec3 &vMin, idVec3 &vMax) for (int i = 0 ;i < 3 ;i++) { float f = v[i]; - - if (f < vMin[i]) - { - vMin[i] = f; - } - if (f > vMax[i]) - { + if (f < vMin[i]) + { + vMin[i] = f; + } + + if (f > vMax[i]) + { vMax[i] = f; - } + } } } @@ -191,7 +191,7 @@ eclass_t *EClass_InitFromDict( const idDict *d, const char *name ) { //if (str.Length()) { // e->entityModel = renderModelManager->FindModel(str); //} - + str = ""; // concatenate all editor usage comments @@ -234,7 +234,7 @@ eclass_t *EClass_InitFromDict( const idDict *d, const char *name ) { e->comments = Mem_CopyString( str.c_str() ); */ - + // concatenate all variable comments kv = d->MatchPrefix( "editor_copy" ); while (kv) { @@ -288,7 +288,7 @@ eclass_t *EClass_InitFromDict( const idDict *d, const char *name ) { e->nShowFlags |= ECLASS_PARTICLE; } else if ( idStr::Icmp(e->name, "func_liquid") == 0 ) { e->nShowFlags |= ECLASS_LIQUID; - } + } return e; } @@ -296,7 +296,7 @@ eclass_t *EClass_InitFromDict( const idDict *d, const char *name ) { void EClass_InsertSortedList(eclass_t *&pList, eclass_t *e) { eclass_t *s; - + if (!pList) { pList = e; @@ -335,7 +335,7 @@ void Eclass_InsertAlphabetized (eclass_t *e) EClass_InsertSortedList(eclass, e); #else eclass_t *s; - + if (!eclass) { eclass = e; @@ -436,7 +436,7 @@ eclass_t* GetCachedModel(entity_t *pEntity, const char *pName, idVec3 &vMin, idV VectorCopy(e->mins, vMin); VectorCopy(e->maxs, vMax); return e; - } + } } e = (eclass_t*)Mem_ClearedAlloc(sizeof(*e)); diff --git a/neo/tools/radiant/EditViewDlg.cpp b/neo/tools/radiant/EditViewDlg.cpp index b9e467ac..76259095 100644 --- a/neo/tools/radiant/EditViewDlg.cpp +++ b/neo/tools/radiant/EditViewDlg.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"). @@ -61,7 +61,7 @@ BEGIN_MESSAGE_MAP(CEditViewDlg, CDialog) ON_WM_DESTROY() ON_WM_TIMER() ON_BN_CLICKED(IDC_BUTTON_GOTO, OnBnClickedButtonGoto) - ON_REGISTERED_MESSAGE(FindDialogMessage, OnFindDialogMessage) + ON_REGISTERED_MESSAGE(FindDialogMessage, OnFindDialogMessage) END_MESSAGE_MAP() @@ -121,7 +121,7 @@ void CEditViewDlg::OnBnClickedButtonOpen() { void CEditViewDlg::OnBnClickedButtonSave() { if (fileName.Length()) { CString text; - editInfo.GetWindowText(text); + editInfo.GetWindowText(text); fileSystem->WriteFile(fileName, text.GetBuffer(0), text.GetLength(), "fs_devpath"); if (mode == MATERIALS) { declManager->Reload( false ); @@ -266,7 +266,7 @@ BOOL CEditViewDlg::PreTranslateMessage(MSG* pMsg) { // then replace that selection with a TAB editInfo.ReplaceSel("\t", TRUE); return TRUE; - } + } return CDialog::PreTranslateMessage(pMsg); } @@ -277,19 +277,19 @@ LRESULT CEditViewDlg::OnFindDialogMessage(WPARAM wParam, LPARAM lParam) { } if (findDlg->IsTerminating()) { - findDlg = NULL; - return 0; - } + findDlg = NULL; + return 0; + } // If the FR_FINDNEXT flag is set, // call the application-defined search routine // to search for the requested string. if(findDlg->FindNext()) { //read data from dialog - findStr = findDlg->GetFindString().GetBuffer(0); + findStr = findDlg->GetFindString().GetBuffer(0); CString str; editInfo.GetWindowText(str); - editText = str; + editText = str; int start, end; editInfo.GetSel(start, end); start = editText.Find(findStr, false, end); @@ -298,6 +298,6 @@ LRESULT CEditViewDlg::OnFindDialogMessage(WPARAM wParam, LPARAM lParam) { editInfo.Invalidate(); editInfo.RedrawWindow(); } - } + } return 0; } diff --git a/neo/tools/radiant/EditViewDlg.h b/neo/tools/radiant/EditViewDlg.h index 3d7a32e1..bcb31228 100644 --- a/neo/tools/radiant/EditViewDlg.h +++ b/neo/tools/radiant/EditViewDlg.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"). @@ -77,6 +77,6 @@ public: afx_msg void OnTimer(UINT nIDEvent); afx_msg void OnBnClickedButtonGoto(); virtual BOOL PreTranslateMessage(MSG* pMsg); - afx_msg LRESULT OnFindDialogMessage(WPARAM wParam, LPARAM lParam); + afx_msg LRESULT OnFindDialogMessage(WPARAM wParam, LPARAM lParam); }; diff --git a/neo/tools/radiant/EditorBrush.cpp b/neo/tools/radiant/EditorBrush.cpp index 82ec0063..c3b372c7 100644 --- a/neo/tools/radiant/EditorBrush.cpp +++ b/neo/tools/radiant/EditorBrush.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"). @@ -727,7 +727,7 @@ idWinding *Brush_MakeFaceWinding(brush_t *b, face_t *face, bool keepOnPlaneWindi if (!w) { Sys_Status("Unable to create face winding on brush\n"); - } + } return w; } @@ -1436,7 +1436,7 @@ brush_t *Brush_Parse(idVec3 origin) { if (newFormat) { //Brush_BuildWindings(b, true, true, false, false); } - + if (b == NULL) { Warning("parsing brush primitive"); return NULL; @@ -2475,7 +2475,7 @@ extern bool RayIntersectsTri const idVec3 &vert0, const idVec3 &vert1, const idVec3 &vert2, - float &scale + float &scale ); @@ -2505,11 +2505,11 @@ Brush_ModelIntersect bool Brush_ModelIntersect(brush_t *b, idVec3 origin, idVec3 dir,float &scale) { idRenderModel *model = b->modelHandle; idRenderModel *md5; - - if ( !model ) - model = b->owner->eclass->entityModel; - scale = 0; + if ( !model ) + model = b->owner->eclass->entityModel; + + scale = 0; if (model) { if ( model->IsDynamicModel() != DM_STATIC ) { if ( dynamic_cast( model ) ) { @@ -2591,7 +2591,7 @@ face_t *Brush_Ray(idVec3 origin, idVec3 dir, brush_t *b, float *dist, bool testP idVec3 p1, p2; float frac, d1, d2; int i; - float scale = HUGE_DISTANCE * 2; + float scale = HUGE_DISTANCE * 2; VectorCopy(origin, p1); for (i = 0; i < 3; i++) { p2[i] = p1[i] + dir[i] * HUGE_DISTANCE * 2; @@ -3700,11 +3700,11 @@ void DrawProjectedLight(brush_t *b, bool bSelected, bool texture) { GLCircle ================ */ -void GLCircle(float x, float y, float z, float r) -{ - float ix = 0; - float iy = r; - float ig = 3 - 2 * r; +void GLCircle(float x, float y, float z, float r) +{ + float ix = 0; + float iy = r; + float ig = 3 - 2 * r; float idgr = -6; float idgd = 4 * r - 10; qglPointSize(0.5f); @@ -3730,7 +3730,7 @@ void GLCircle(float x, float y, float z, float r) qglVertex3f(x - iy, y - ix, z); } qglEnd(); -} +} /* ================ @@ -3742,9 +3742,9 @@ void DrawSpeaker(brush_t *b, bool bSelected, bool twoD) { if (!(g_qeglobals.d_savedinfo.showSoundAlways || (g_qeglobals.d_savedinfo.showSoundWhenSelected && bSelected))) { return; } - + // convert to units ( inches ) - float min = FloatForKey(b->owner, "s_mindistance"); + float min = FloatForKey(b->owner, "s_mindistance"); float max = FloatForKey(b->owner, "s_maxdistance"); const char *s = b->owner->epairs.GetString("s_shader"); @@ -3758,12 +3758,12 @@ void DrawSpeaker(brush_t *b, bool bSelected, bool twoD) { max = shader->GetMaxDistance(); } } - } + } if (min == 0 && max == 0) { return; } - + // convert from meters to doom units min *= METERS_TO_DOOM; @@ -3812,7 +3812,7 @@ void DrawSpeaker(brush_t *b, bool bSelected, bool twoD) { qglPopMatrix(); } - + } /* @@ -3959,7 +3959,7 @@ void Brush_DrawModel( brush_t *b, bool camera, bool bSelected ) { model = b->owner->eclass->entityModel; } if ( model ) { - idRenderModel *model2; + idRenderModel *model2; model2 = NULL; bool fixedBounds = false; @@ -4023,30 +4023,30 @@ void Brush_DrawModel( brush_t *b, bool camera, bool bSelected ) { qglColor4fv( colorSave.ToFloatPtr() ); - if ( bSelected && camera ) - { - //draw selection tints + if ( bSelected && camera ) + { + //draw selection tints /* - if ( camera && g_PrefsDlg.m_nEntityShowState != ENTITY_WIREFRAME ) { - qglPolygonMode ( GL_FRONT_AND_BACK , GL_FILL ); - qglColor3fv ( g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].ToFloatPtr () ); - qglEnable ( GL_BLEND ); - qglBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); - DrawRenderModel( model, b->owner->origin, axis, camera ); - } + if ( camera && g_PrefsDlg.m_nEntityShowState != ENTITY_WIREFRAME ) { + qglPolygonMode ( GL_FRONT_AND_BACK , GL_FILL ); + qglColor3fv ( g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].ToFloatPtr () ); + qglEnable ( GL_BLEND ); + qglBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); + DrawRenderModel( model, b->owner->origin, axis, camera ); + } */ - //draw white triangle outlines + //draw white triangle outlines globalImages->BindNull(); - qglPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); - qglDisable( GL_BLEND ); + qglPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); + qglDisable( GL_BLEND ); qglDisable( GL_DEPTH_TEST ); - qglColor3f( 1.0f, 1.0f, 1.0f ); - qglPolygonOffset( 1.0f, 3.0f ); - DrawRenderModel( model, b->owner->origin, axis, false ); + qglColor3f( 1.0f, 1.0f, 1.0f ); + qglPolygonOffset( 1.0f, 3.0f ); + DrawRenderModel( model, b->owner->origin, axis, false ); qglEnable( GL_DEPTH_TEST ); - } + } if ( model2 ) { delete model2; @@ -4193,7 +4193,7 @@ void Brush_DrawAxis(brush_t *b) { wr = yr; type = 1; } - + if (g_qeglobals.flatRotation) { if (yr > wr) { wr = yr; @@ -4254,7 +4254,7 @@ void Brush_DrawEmitter(brush_t *b, bool bSelected, bool cam) { if ( !( b->owner->eclass->nShowFlags & ECLASS_PARTICLE ) ) { return; } - + if (bSelected) { qglColor4f(g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].x, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].y, g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES].z, .5); } else { @@ -4336,8 +4336,8 @@ void Brush_DrawCombatNode( brush_t *b, bool cameraView, bool bSelected ) { color = colorRed; } else { color = colorBlue; - } - + } + idVec3 leftDir( -cone_left.y, cone_left.x, 0.0f ); idVec3 rightDir( cone_right.y, -cone_right.x, 0.0f ); leftDir.NormalizeFast(); @@ -4423,7 +4423,7 @@ void Brush_Draw(brush_t *b, bool bSelected) { DrawSpeaker( b, bSelected, false ); if ( g_PrefsDlg.m_bNewLightDraw && (b->owner->eclass->nShowFlags & ECLASS_LIGHT) && !(b->modelHandle || b->entityModel) ) { - DrawLight( b, bSelected ); + DrawLight( b, bSelected ); return; } @@ -4577,7 +4577,7 @@ idSurface_SweptSpline *SplineToSweptSpline( idCurve *curve ) { Brush_DrawCurve ================ */ -void Brush_DrawCurve( brush_t *b, bool bSelected, bool cam ) { +void Brush_DrawCurve( brush_t *b, bool bSelected, bool cam ) { if ( b == NULL || b->owner->curve == NULL ) { return; } @@ -4587,7 +4587,7 @@ void Brush_DrawCurve( brush_t *b, bool bSelected, bool cam ) { qglColor3f( 0.0f, 0.0f, 1.0f ); for ( i = 0; i < maxage; i++) { - if ( bSelected && g_qeglobals.d_select_mode == sel_editpoint ) { + if ( bSelected && g_qeglobals.d_select_mode == sel_editpoint ) { idVec3 v = b->owner->curve->GetValue( i ); if ( cam ) { glBox( colorBlue, v, 6.0f ); @@ -4605,7 +4605,7 @@ void Brush_DrawCurve( brush_t *b, bool bSelected, bool cam ) { } } } -/* +/* if ( cam ) { idSurface_SweptSpline *ss = SplineToSweptSpline( b->owner->curve ); if ( ss ) { @@ -4638,10 +4638,10 @@ void Brush_DrawCurve( brush_t *b, bool bSelected, bool cam ) { for ( int j = 0; j < POINTS_PER_KNOT; j++ ) { idVec3 v = b->owner->curve->GetCurrentValue( start ); qglVertex3f( v.x, v.y, v.z ); - start += inc; + start += inc; } }*/ - // DHM - _D3XP : Makes it easier to see curve + // DHM - _D3XP : Makes it easier to see curve qglBegin( GL_LINE_STRIP ); if ( i + 1 < maxage ) { int start = b->owner->curve->GetTime( i ); @@ -4650,7 +4650,7 @@ void Brush_DrawCurve( brush_t *b, bool bSelected, bool cam ) { for ( int j = 0; j <= POINTS_PER_KNOT; j++ ) { idVec3 v = b->owner->curve->GetCurrentValue( start ); qglVertex3f( v.x, v.y, v.z ); - start += inc; + start += inc; } } qglEnd(); @@ -4702,7 +4702,7 @@ void Brush_DrawXY(brush_t *b, int nViewType, bool bSelected, bool ignoreViewType if (b->owner->eclass->fixedsize) { - DrawSpeaker(b, bSelected, true); + DrawSpeaker(b, bSelected, true); if (g_PrefsDlg.m_bNewLightDraw && (b->owner->eclass->nShowFlags & ECLASS_LIGHT) && !(b->modelHandle || b->entityModel)) { idVec3 vCorners[4]; float fMid = b->mins[2] + (b->maxs[2] - b->mins[2]) / 2; @@ -4764,7 +4764,7 @@ void Brush_DrawXY(brush_t *b, int nViewType, bool bSelected, bool ignoreViewType Brush_DrawModel( b, false, bSelected ); DrawBrushEntityName(b); qglColor4fv(colorSave.ToFloatPtr()); - return; + return; } } @@ -4886,7 +4886,7 @@ void Brush_Move(brush_t *b, const idVec3 move, bool bSnap, bool updateOrigin) { if (QE_SingleBrush(true, true)) { adjustOrigin = false; } - } + } if (adjustOrigin && updateOrigin) { b->owner->origin += move; @@ -5215,6 +5215,6 @@ void Brush_GetBounds( brush_t *b, idBounds &bo ) { for ( int i = 0; i < c; i++ ) { bo.AddPoint ( b->owner->curve->GetValue( i ) ); } - } + } } diff --git a/neo/tools/radiant/EditorBrush.h b/neo/tools/radiant/EditorBrush.h index e46205cb..d6a202e2 100644 --- a/neo/tools/radiant/EditorBrush.h +++ b/neo/tools/radiant/EditorBrush.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/neo/tools/radiant/EditorBrushPrimit.cpp b/neo/tools/radiant/EditorBrushPrimit.cpp index 8fb8e862..b721248c 100644 --- a/neo/tools/radiant/EditorBrushPrimit.cpp +++ b/neo/tools/radiant/EditorBrushPrimit.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"). @@ -190,7 +190,7 @@ void EmitBrushPrimitTextureCoordinates(face_t *f, idWinding *w, patchMesh_t *pat (*w)[i][4] = f->brushprimit_texdef.coords[1][0] * x + f->brushprimit_texdef.coords[1][1] * y + f->brushprimit_texdef.coords[1][2]; } } - + if (patch) { int j; for ( i = 0; i < patch->width; i++ ) { @@ -618,7 +618,7 @@ void Face_FitTexture_BrushPrimit(face_t *f, idVec3 mins, idVec3 maxs, float heig idVec3D Mf[2]; - + //memset(f->brushprimit_texdef.coords, 0, sizeof(f->brushprimit_texdef.coords)); //f->brushprimit_texdef.coords[0][0] = 1.0f; //f->brushprimit_texdef.coords[1][1] = 1.0f; @@ -1125,7 +1125,7 @@ void Face_FlipTexture_BrushPrimit(face_t *f, bool y) { Os *= s; Os /= f->d_texture->GetEditorImage()->uploadWidth; - + if (y) { Face_FitTexture_BrushPrimit(f, texS, texT, -Ot, 1.0); } else { @@ -1167,7 +1167,7 @@ void Face_SetAxialScale_BrushPrimit(face_t *face, bool y) { } } } - + idVec3 len; if (g_bAxialMode) { @@ -1236,4 +1236,3 @@ void Face_SetAxialScale_BrushPrimit(face_t *face, bool y) { */ } - diff --git a/neo/tools/radiant/EditorEntity.cpp b/neo/tools/radiant/EditorEntity.cpp index 65725a1c..fcf9bbf3 100644 --- a/neo/tools/radiant/EditorEntity.cpp +++ b/neo/tools/radiant/EditorEntity.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"). @@ -60,7 +60,7 @@ const char *GetKeyString(entity_t *ent, int iIndex) // // assert(0); // return NULL; - + if ( iIndex < GetNumKeys(ent) ) { return ent->epairs.GetKeyVal(iIndex)->GetKey().c_str(); @@ -159,9 +159,9 @@ void SetKeyMat3(entity_t *ent, const char *key, idMat3 m) { } idStr str; - + sprintf(str, "%g %g %g %g %g %g %g %g %g",m[0][0],m[0][1],m[0][2],m[1][0],m[1][1],m[1][2],m[2][0],m[2][1],m[2][2]); - + ent->epairs.Set(key, str); GetVectorForKey(ent, "origin", ent->origin); } @@ -290,7 +290,7 @@ bool GetMatrixForKey(entity_t *ent, const char *key, idMat3 &mat) { /* ======================================================================================================================= - Entity_FreeEpairs Frees the entity epairs. + Entity_FreeEpairs Frees the entity epairs. ======================================================================================================================= */ void Entity_FreeEpairs(entity_t *e) { @@ -299,7 +299,7 @@ void Entity_FreeEpairs(entity_t *e) { /* ======================================================================================================================= - Entity_AddToList + Entity_AddToList ======================================================================================================================= */ void Entity_AddToList(entity_t *e, entity_t *list) { @@ -315,7 +315,7 @@ void Entity_AddToList(entity_t *e, entity_t *list) { /* ======================================================================================================================= - Entity_RemoveFromList + Entity_RemoveFromList ======================================================================================================================= */ void Entity_RemoveFromList(entity_t *e) { @@ -330,7 +330,7 @@ void Entity_RemoveFromList(entity_t *e) { /* ======================================================================================================================= - Entity_Free Frees the entity and any brushes is has. The entity is removed from the global entities list. + Entity_Free Frees the entity and any brushes is has. The entity is removed from the global entities list. ======================================================================================================================= */ void Entity_Free( entity_t *e ) { @@ -351,11 +351,11 @@ void Entity_Free( entity_t *e ) { /* ======================================================================================================================= - Entity_MemorySize + Entity_MemorySize ======================================================================================================================= */ -int Entity_MemorySize( entity_t *e ) +int Entity_MemorySize( entity_t *e ) { brush_t *b; int size; @@ -370,7 +370,7 @@ int Entity_MemorySize( entity_t *e ) /* ======================================================================================================================= - ParseEpair + ParseEpair ======================================================================================================================= */ @@ -428,7 +428,7 @@ void ParseEpair(idDict *dict) { idStr key = token; GetToken(false); idStr val = token; - + if (key.Length() > 0) { dict->Set(key, val); } @@ -458,7 +458,7 @@ bool EntityHasModel(entity_t *ent) { */ entity_t *Entity_New() { entity_t *ent = new entity_t; - + ent->prev = ent->next = NULL; ent->brushes.prev = ent->brushes.next = NULL; ent->brushes.oprev = ent->brushes.onext = NULL; @@ -481,13 +481,13 @@ entity_t *Entity_New() { } void Entity_UpdateCurveData( entity_t *ent ) { - + if ( ent == NULL || ent->curve == NULL ) { return; } const idKeyValue *kv = ent->epairs.MatchPrefix( CURVE_TAG ); - if ( kv == NULL ) { + if ( kv == NULL ) { if ( ent->curve ) { delete ent->curve; ent->curve = NULL; @@ -595,11 +595,11 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) { } idStr str; - + if (e->defArgs.GetString("model", "", str) && e->entityModel == NULL) { e->entityModel = gameEdit->ANIM_GetModelFromEntityDef( &e->defArgs ); } - + ent->eclass = e; bool hasModel = EntityHasModel(ent); @@ -681,7 +681,7 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) { bool convertAngles = GetFloatForKey(ent, "angle", &yaw); extern void Brush_Rotate(brush_t *b, idMat3 matrix, idVec3 origin, bool bBuild); extern void Brush_Rotate(brush_t *b, idVec3 rot, idVec3 origin, bool bBuild); - + if (convertAngles) { idVec3 rot(0, 0, yaw); Brush_Rotate(b, rot, ent->origin, false); @@ -790,8 +790,8 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) { /* ======================================================================================================================= - Entity_Parse If onlypairs is set, the classname info will not be looked up, and the entity will not be added to the - global list. Used for parsing the project. + Entity_Parse If onlypairs is set, the classname info will not be looked up, and the entity will not be added to the + global list. Used for parsing the project. ======================================================================================================================= */ entity_t *Entity_Parse(bool onlypairs, brush_t *pList) { @@ -860,7 +860,7 @@ void VectorMidpoint(idVec3 va, idVec3 vb, idVec3 &out) { /* ======================================================================================================================= - Entity_Write + Entity_Write ======================================================================================================================= */ void Entity_Write(entity_t *e, FILE *f, bool use_region) { @@ -984,7 +984,7 @@ void Entity_WriteSelected(entity_t *e, FILE *f) { } fprintf(f, "{\n"); - + count = e->epairs.GetNumKeyVals(); for (int j = 0; j < count; j++) { fprintf(f, "\"%s\" \"%s\"\n", e->epairs.GetKeyVal(j)->GetKey().c_str(), e->epairs.GetKeyVal(j)->GetValue().c_str()); @@ -1122,8 +1122,8 @@ void Entity_Name(entity_t *e, bool force) { /* ======================================================================================================================= - Entity_Create Creates a new entity out of the selected_brushes list. If the entity class is fixed size, the brushes - are only used to find a midpoint. Otherwise, the brushes have their ownership transfered to the new entity. + Entity_Create Creates a new entity out of the selected_brushes list. If the entity class is fixed size, the brushes + are only used to find a midpoint. Otherwise, the brushes have their ownership transfered to the new entity. ======================================================================================================================= */ entity_t *Entity_Create(eclass_t *c, bool forceFixed) { @@ -1230,7 +1230,7 @@ void Brush_MakeDirty(brush_t *b) { } /* ======================================================================================================================= - Entity_LinkBrush + Entity_LinkBrush ======================================================================================================================= */ void Entity_LinkBrush(entity_t *e, brush_t *b) { @@ -1250,7 +1250,7 @@ void Entity_LinkBrush(entity_t *e, brush_t *b) { /* ======================================================================================================================= - Entity_UnlinkBrush + Entity_UnlinkBrush ======================================================================================================================= */ void Entity_UnlinkBrush(brush_t *b) { @@ -1267,7 +1267,7 @@ void Entity_UnlinkBrush(brush_t *b) { /* ======================================================================================================================= - Entity_Clone + Entity_Clone ======================================================================================================================= */ entity_t *Entity_Clone(entity_t *e) { @@ -1371,7 +1371,7 @@ void Entity_UpdateSoundEmitter( entity_t *ent ) { // if an entity doesn't have any brushes at all, don't do anything // if the brush isn't displayed (filtered or culled), don't do anything - if ( g_pParentWnd->GetCamera()->GetSoundMode() + if ( g_pParentWnd->GetCamera()->GetSoundMode() && ent->brushes.onext != &ent->brushes && !FilterBrush(ent->brushes.onext) ) { // check for sounds const char *v = ValueForKey( ent, "s_shader" ); @@ -1398,4 +1398,3 @@ void Entity_UpdateSoundEmitter( entity_t *ent ) { } } - diff --git a/neo/tools/radiant/EditorEntity.h b/neo/tools/radiant/EditorEntity.h index 6a524e77..d3810295 100644 --- a/neo/tools/radiant/EditorEntity.h +++ b/neo/tools/radiant/EditorEntity.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"). @@ -42,9 +42,9 @@ typedef struct entity_s { idDict epairs; eclass_t * md3Class; idMat3 rotation; - idVec3 lightOrigin; // for lights that have been combined with models + idVec3 lightOrigin; // for lights that have been combined with models idMat3 lightRotation; // '' - bool trackLightOrigin; + bool trackLightOrigin; idCurve *curve; } entity_t; diff --git a/neo/tools/radiant/EditorMap.cpp b/neo/tools/radiant/EditorMap.cpp index 50cf2293..432c6b25 100644 --- a/neo/tools/radiant/EditorMap.cpp +++ b/neo/tools/radiant/EditorMap.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"). @@ -211,7 +211,7 @@ bool Entity_NameIsUnique(const char *name) { /* ======================================================================================================================= - Map_Free + Map_Free ======================================================================================================================= */ void Map_Free(void) { @@ -418,7 +418,7 @@ entity_t *EntityFromMapEntity(idMapEntity *mapent, CWaitDlg *dlg) { extern entity_t *Entity_PostParse(entity_t *ent, brush_t *pList); /* ======================================================================================================================= - Map_LoadFile + Map_LoadFile ======================================================================================================================= */ void Map_LoadFile(const char *filename) { @@ -518,7 +518,7 @@ void Map_LoadFile(const char *filename) { ent = AngledEntity(); g_pParentWnd->GetCamera()->Camera().angles[PITCH] = 0; - + if (ent) { GetVectorForKey(ent, "origin", g_pParentWnd->GetCamera()->Camera().origin); GetVectorForKey(ent, "origin", g_pParentWnd->GetXYWnd()->GetOrigin()); @@ -619,7 +619,7 @@ idMapEntity *EntityToMapEntity(entity_t *e, bool use_region, CWaitDlg *dlg) { long lastUpdate = 0; if ( !EntityHasModel( e ) ) { for ( brush_t *b = e->brushes.onext; b != &e->brushes; b = b->onext ) { - count++; + count++; if ( e->eclass->fixedsize && !b->entityModel ) { continue; } @@ -639,7 +639,7 @@ idMapEntity *EntityToMapEntity(entity_t *e, bool use_region, CWaitDlg *dlg) { if ( prim ) { mapent->AddPrimitive( prim ); } - } + } } } return mapent; @@ -647,7 +647,7 @@ idMapEntity *EntityToMapEntity(entity_t *e, bool use_region, CWaitDlg *dlg) { /* ======================================================================================================================= - Map_SaveFile + Map_SaveFile ======================================================================================================================= */ bool Map_SaveFile(const char *filename, bool use_region, bool autosave) { @@ -659,7 +659,7 @@ bool Map_SaveFile(const char *filename, bool use_region, bool autosave) { int len = strlen(filename); WIN32_FIND_DATA FileData; - if (FindFirstFile(filename, &FileData) != INVALID_HANDLE_VALUE) { + if (FindFirstFile(filename, &FileData) != INVALID_HANDLE_VALUE) { // the file exists; if (len > 0 && GetFileAttributes(filename) & FILE_ATTRIBUTE_READONLY) { g_pParentWnd->MessageBox("File is read only", "Read Only", MB_OK); @@ -727,7 +727,7 @@ bool Map_SaveFile(const char *filename, bool use_region, bool autosave) { if ( use_region ) { idStr buf; - sprintf( buf, "{\n\"classname\" \"info_player_start\"\n\"origin\"\t \"%i %i %i\"\n\"angle\"\t \"%i\"\n}\n", + sprintf( buf, "{\n\"classname\" \"info_player_start\"\n\"origin\"\t \"%i %i %i\"\n\"angle\"\t \"%i\"\n}\n", (int)g_pParentWnd->GetCamera()->Camera().origin[0], (int)g_pParentWnd->GetCamera()->Camera().origin[1], (int)g_pParentWnd->GetCamera()->Camera().origin[2], @@ -768,8 +768,8 @@ bool Map_SaveFile(const char *filename, bool use_region, bool autosave) { if (use_region && !idStr::Icmp(ValueForKey(e, "classname"), "info_player_start")) { continue; - } - + } + idStr classname = e->epairs.GetString("classname"); sprintf(status, "Saving entity %i (%s)...", count, classname.c_str()); dlg.SetText(status); @@ -801,7 +801,7 @@ bool Map_SaveFile(const char *filename, bool use_region, bool autosave) { /* ======================================================================================================================= - Map_New + Map_New ======================================================================================================================= */ void Map_New(void) { @@ -840,7 +840,7 @@ brush_t *region_sides[6]; /* ======================================================================================================================= - AddRegionBrushes a regioned map will have temp walls put up at the region boundary + AddRegionBrushes a regioned map will have temp walls put up at the region boundary ======================================================================================================================= */ void AddRegionBrushes(void) { @@ -943,7 +943,7 @@ bool Map_IsBrushFiltered(brush_t *b) { /* ======================================================================================================================= - Map_RegionOff Other filtering options may still be on + Map_RegionOff Other filtering options may still be on ======================================================================================================================= */ void Map_RegionOff(void) { @@ -997,7 +997,7 @@ void Map_ApplyRegion(void) { /* ======================================================================================================================= - Map_RegionSelectedBrushes + Map_RegionSelectedBrushes ======================================================================================================================= */ void Map_RegionSelectedBrushes(void) { @@ -1032,7 +1032,7 @@ void Map_RegionSelectedBrushes(void) { /* ======================================================================================================================= - Map_RegionXY + Map_RegionXY ======================================================================================================================= */ void Map_RegionXY(void) { @@ -1061,7 +1061,7 @@ void Map_RegionXY(void) { /* ======================================================================================================================= - Map_RegionTallBrush + Map_RegionTallBrush ======================================================================================================================= */ void Map_RegionTallBrush(void) { @@ -1086,7 +1086,7 @@ void Map_RegionTallBrush(void) { /* ======================================================================================================================= - Map_RegionBrush + Map_RegionBrush ======================================================================================================================= */ void Map_RegionBrush(void) { @@ -1132,7 +1132,7 @@ void UniqueTargetName(idStr &rStr) { } } } - + sprintf(rStr, "t%i", maxtarg + 1); } @@ -1284,7 +1284,7 @@ void Map_ImportBuffer(char *buf, bool renameEntities) { { LPCSTR psNewTargetName = RemappedNames.GetString( cstrTargetNameOld ); if (psNewTargetName && psNewTargetName[0]) - { + { SetKeyValue(pEntNew, "target", psNewTargetName); } } diff --git a/neo/tools/radiant/EditorMap.h b/neo/tools/radiant/EditorMap.h index 36aaea86..7b9c216a 100644 --- a/neo/tools/radiant/EditorMap.h +++ b/neo/tools/radiant/EditorMap.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"). @@ -48,8 +48,8 @@ extern int modified; // for quit confirmations extern idVec3 region_mins, region_maxs; extern bool region_active; -void Map_LoadFile (const char *filename); -bool Map_SaveFile (const char *filename, bool use_region, bool autosave = false); +void Map_LoadFile (const char *filename); +bool Map_SaveFile (const char *filename, bool use_region, bool autosave = false); void Map_New (void); void Map_BuildBrushData(void); diff --git a/neo/tools/radiant/EntKeyFindReplace.cpp b/neo/tools/radiant/EntKeyFindReplace.cpp index 18fe7e75..ff1cee11 100644 --- a/neo/tools/radiant/EntKeyFindReplace.cpp +++ b/neo/tools/radiant/EntKeyFindReplace.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"). @@ -53,10 +53,10 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CEntKeyFindReplace dialog -CEntKeyFindReplace::CEntKeyFindReplace( CString* p_strFindKey, - CString* p_strFindValue, - CString* p_strReplaceKey, - CString* p_strReplaceValue, +CEntKeyFindReplace::CEntKeyFindReplace( CString* p_strFindKey, + CString* p_strFindValue, + CString* p_strReplaceKey, + CString* p_strReplaceValue, bool* p_bWholeStringMatchOnly, bool* p_bSelectAllMatchingEnts, CWnd* pParent /*=NULL*/) @@ -106,12 +106,12 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CEntKeyFindReplace message handlers -void CEntKeyFindReplace::OnCancel() -{ +void CEntKeyFindReplace::OnCancel() +{ CDialog::OnCancel(); } -void CEntKeyFindReplace::OnReplace() +void CEntKeyFindReplace::OnReplace() { // quick check, if no key value is specified then there's not much to do... // @@ -149,7 +149,7 @@ void CEntKeyFindReplace::OnFind() ErrorBox("Empty FIND fields!"); } else - { + { // if (m_strFindKey.IsEmpty() && m_bSelectAllMatchingEnts) // { // if (GetYesNo("Warning! Having a blank FIND and ticking \"Select all matching ents\" can take a LONG time to do (and is probably a wrong choice anyway?)\n\nProceed?")) @@ -179,21 +179,20 @@ void CEntKeyFindReplace::CopyFields() } -void CEntKeyFindReplace::OnKeycopy() +void CEntKeyFindReplace::OnKeycopy() { UpdateData(DIALOG_TO_DATA); m_strReplaceKey = m_strFindKey; - UpdateData(DATA_TO_DIALOG); + UpdateData(DATA_TO_DIALOG); } -void CEntKeyFindReplace::OnValuecopy() +void CEntKeyFindReplace::OnValuecopy() { UpdateData(DIALOG_TO_DATA); m_strReplaceValue = m_strFindValue; - UpdateData(DATA_TO_DIALOG); + UpdateData(DATA_TO_DIALOG); } - diff --git a/neo/tools/radiant/EntKeyFindReplace.h b/neo/tools/radiant/EntKeyFindReplace.h index becdd5e8..35426e0d 100644 --- a/neo/tools/radiant/EntKeyFindReplace.h +++ b/neo/tools/radiant/EntKeyFindReplace.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"). @@ -48,10 +48,10 @@ class CEntKeyFindReplace : public CDialog { // Construction public: - CEntKeyFindReplace(CString* p_strFindKey, - CString* p_strFindValue, - CString* p_strReplaceKey, - CString* p_strReplaceValue, + CEntKeyFindReplace(CString* p_strFindKey, + CString* p_strFindValue, + CString* p_strReplaceKey, + CString* p_strReplaceValue, bool* p_bWholeStringMatchOnly, bool* p_bSelectAllMatchingEnts, CWnd* pParent = NULL); // standard constructor diff --git a/neo/tools/radiant/EntityDlg.cpp b/neo/tools/radiant/EntityDlg.cpp index f7c73b85..b0b05c22 100644 --- a/neo/tools/radiant/EntityDlg.cpp +++ b/neo/tools/radiant/EntityDlg.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,8 +196,8 @@ void CEntityDlg::OnSize(UINT nType, int cx, int cy) btnSound.SetWindowPos(NULL, rect.right - 4 - crect.Width(), top + 12 + crect.Height(), crect.Width(), crect.Height(), SWP_SHOWWINDOW); btnGui.SetWindowPos(NULL, rect.right - 4 - crect.Width(), top + 16 + crect.Height() * 2, crect.Width(), crect.Height(), SWP_SHOWWINDOW); btnParticle.SetWindowPos(NULL, rect.right - 8 - (crect.Width() * 2), top + 16 + crect.Height() * 2, crect.Width(), crect.Height(), SWP_SHOWWINDOW); - btnSkin.SetWindowPos( NULL, rect.right - 8 - ( crect.Width() * 2 ), top + 12 + crect.Height(), crect.Width(), crect.Height(), SWP_SHOWWINDOW ); - btnCurve.SetWindowPos( NULL, rect.right - 8 - ( crect.Width() * 2 ), top + 8, crect.Width(), crect.Height(), SWP_SHOWWINDOW ); + btnSkin.SetWindowPos( NULL, rect.right - 8 - ( crect.Width() * 2 ), top + 12 + crect.Height(), crect.Width(), crect.Height(), SWP_SHOWWINDOW ); + btnCurve.SetWindowPos( NULL, rect.right - 8 - ( crect.Width() * 2 ), top + 8, crect.Width(), crect.Height(), SWP_SHOWWINDOW ); //************************************* //animation controls @@ -526,7 +526,7 @@ BOOL CEntityDlg::PreTranslateMessage(MSG* pMsg) if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_DELETE && editEntity) { DelProp(); return TRUE; - } + } } if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) { @@ -563,7 +563,7 @@ BOOL CEntityDlg::PreTranslateMessage(MSG* pMsg) } } } - + if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RIGHT && pMsg->hwnd == slFrameSlider.GetSafeHwnd()) { int pos = slFrameSlider.GetPos() + 1; pos = (pos % slFrameSlider.GetRangeMax()); @@ -590,7 +590,7 @@ BOOL CEntityDlg::PreTranslateMessage(MSG* pMsg) /* ======================================================================================================================= - AddProp + AddProp ======================================================================================================================= */ void CEntityDlg::AddProp() { @@ -613,7 +613,7 @@ void CEntityDlg::AddProp() { if (isName) { Entity_SetName(b->owner, Value); } else { - if ( ! ( ( isModel || isOrigin ) && ( b->owner->eclass->nShowFlags & ECLASS_WORLDSPAWN ) ) ) { + if ( ! ( ( isModel || isOrigin ) && ( b->owner->eclass->nShowFlags & ECLASS_WORLDSPAWN ) ) ) { SetKeyValue(b->owner, Key, Value); } } @@ -623,7 +623,7 @@ void CEntityDlg::AddProp() { if (isName) { Entity_SetName(editEntity, Value); } else { - if ( ! ( ( isModel || isOrigin ) && ( editEntity->eclass->nShowFlags & ECLASS_WORLDSPAWN ) ) ) { + if ( ! ( ( isModel || isOrigin ) && ( editEntity->eclass->nShowFlags & ECLASS_WORLDSPAWN ) ) ) { SetKeyValue(editEntity, Key, Value); } } @@ -659,7 +659,7 @@ const char *CEntityDlg::AngleKey() { if (editEntity == NULL) { return ""; } - + if (editEntity->eclass->nShowFlags & ECLASS_MOVER) { return "movedir"; } @@ -967,7 +967,7 @@ void CEntityDlg::CreateEntity() { MessageBox("You must have a selected class to create an entity", "info", 0); return; } - + CString str; comboClass.GetLBText(index, str); @@ -1079,7 +1079,7 @@ void CEntityDlg::OnNMReleasedcaptureSlider1(NMHDR *pNMHDR, LRESULT *pResult) { return; } - + UpdateFromAnimationFrame (); *pResult = 0; @@ -1119,7 +1119,7 @@ void CEntityDlg::OnCbnAnimationChange () editEntity->epairs.Set("anim" , animName.GetBuffer(0)); SetKeyValPairs(false/*don't update anims combo box :)*/ ); - + //update the slider currentAnimation = gameEdit->ANIM_GetAnimFromEntityDef(editEntity->eclass->name , animName.GetBuffer(0)); currentAnimationFrame = 0; @@ -1136,7 +1136,7 @@ void CEntityDlg::OnCbnAnimationChange () } void CEntityDlg::OnBnClickedStartAnimation() -{ +{ if (!editEntity) { return; } @@ -1154,12 +1154,12 @@ void CEntityDlg::OnTimer(UINT nIDEvent) OnBnClickedStopAnimation (); return; } - + if ( currentAnimation ) { currentAnimationFrame = ( (currentAnimationFrame++) % gameEdit->ANIM_GetNumFrames( currentAnimation ) ); editEntity->epairs.SetInt ( "frame" , currentAnimationFrame ); slFrameSlider.SetPos ( currentAnimationFrame ); - UpdateFromAnimationFrame (false/*don't update key/value display*/); + UpdateFromAnimationFrame (false/*don't update key/value display*/); Sys_UpdateWindows ( W_CAMERA | W_XY ); } @@ -1183,11 +1183,11 @@ void CEntityDlg::AddCurvePoints() { } else if ( c > 0 ) { start = editEntity->curve->GetValue( 0 ); start.x += 64; - start.y += 64; + start.y += 64; } else { start = editEntity->origin; } - + editEntity->curve->AddValue( editEntity->curve->GetNumValues() * 100, start ); if ( g_qeglobals.d_select_mode == sel_editpoint ) { @@ -1273,7 +1273,7 @@ void CEntityDlg::InsertCurvePoint() { } } newCurve->AddValue( newCurve->GetNumValues() * 100, start ); - } + } newCurve->AddValue( newCurve->GetNumValues() * 100, editEntity->curve->GetValue( j ) ); } delete editEntity->curve; @@ -1319,7 +1319,7 @@ void CEntityDlg::DeleteCurvePoint() { void CEntityDlg::UpdateEntityCurve() { - + if ( editEntity == NULL ) { return; } @@ -1374,4 +1374,3 @@ void CEntityDlg::SelectCurvePointByRay(const idVec3 &org, const idVec3 &dir, int assert ( besti < editEntity->curve->GetNumValues() ); g_qeglobals.d_move_points[ g_qeglobals.d_num_move_points++ ] = editEntity->curve->GetValueAddress( besti ); } - diff --git a/neo/tools/radiant/EntityDlg.h b/neo/tools/radiant/EntityDlg.h index 5dae0f5a..708427ed 100644 --- a/neo/tools/radiant/EntityDlg.h +++ b/neo/tools/radiant/EntityDlg.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: static CPreviewDlg *ShowMaterialChooser(); static CPreviewDlg *ShowParticleChooser(); static CPreviewDlg *ShowSkinChooser( entity_t *ent ); - + void SetKeyVal(const char *key, const char *val) { editKey.SetWindowText(key); editVal.SetWindowText(val); diff --git a/neo/tools/radiant/EntityListDlg.cpp b/neo/tools/radiant/EntityListDlg.cpp index b94c8317..94a3547d 100644 --- a/neo/tools/radiant/EntityListDlg.cpp +++ b/neo/tools/radiant/EntityListDlg.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"). @@ -46,7 +46,7 @@ CEntityListDlg g_EntityListDlg; void CEntityListDlg::ShowDialog() { if (g_EntityListDlg.GetSafeHwnd() == NULL) { g_EntityListDlg.Create(IDD_DLG_ENTITYLIST); - } + } g_EntityListDlg.UpdateList(); g_EntityListDlg.ShowWindow(SW_SHOW); @@ -82,7 +82,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CEntityListDlg message handlers -void CEntityListDlg::OnSelect() +void CEntityListDlg::OnSelect() { int index = listEntities.GetCurSel(); if (index != LB_ERR) { @@ -115,10 +115,10 @@ void CEntityListDlg::OnCancel() { DestroyWindow(); } -BOOL CEntityListDlg::OnInitDialog() +BOOL CEntityListDlg::OnInitDialog() { CDialog::OnInitDialog(); - + UpdateList(); CRect rct; @@ -127,9 +127,9 @@ BOOL CEntityListDlg::OnInitDialog() m_lstEntity.InsertColumn(1, "Value", LVCFMT_LEFT, rct.Width() / 2); m_lstEntity.DeleteColumn(2); UpdateData(FALSE); - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } void CEntityListDlg::OnClose() { @@ -142,7 +142,7 @@ void CEntityListDlg::OnLbnSelchangeListEntities() if (index != LB_ERR) { m_lstEntity.DeleteAllItems(); entity_t* pEntity = reinterpret_cast(listEntities.GetItemDataPtr(index)); - if (pEntity) { + if (pEntity) { int count = pEntity->epairs.GetNumKeyVals(); for (int i = 0; i < count; i++) { int nParent = m_lstEntity.InsertItem(0, pEntity->epairs.GetKeyVal(i)->GetKey()); diff --git a/neo/tools/radiant/EntityListDlg.h b/neo/tools/radiant/EntityListDlg.h index 541a6d06..c516a4f3 100644 --- a/neo/tools/radiant/EntityListDlg.h +++ b/neo/tools/radiant/EntityListDlg.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/neo/tools/radiant/FindTextureDlg.cpp b/neo/tools/radiant/FindTextureDlg.cpp index 8110e7d6..967d1103 100644 --- a/neo/tools/radiant/FindTextureDlg.cpp +++ b/neo/tools/radiant/FindTextureDlg.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"). @@ -50,14 +50,14 @@ void CFindTextureDlg::updateTextures(const char *p) { if (isOpen()) { - if (g_bFindActive) - { - setFindStr(p); - } - else - { - setReplaceStr(p); - } + if (g_bFindActive) + { + setFindStr(p); + } + else + { + setReplaceStr(p); + } } } @@ -95,7 +95,7 @@ BEGIN_MESSAGE_MAP(CFindTextureDlg, CDialog) //}}AFX_MSG_MAP END_MESSAGE_MAP() -void CFindTextureDlg::OnBtnApply() +void CFindTextureDlg::OnBtnApply() { UpdateData(TRUE); CRect rct; @@ -104,7 +104,7 @@ void CFindTextureDlg::OnBtnApply() FindReplaceTextures( m_strFind, m_strReplace, ( m_bSelectedOnly != FALSE ), ( m_bForce != FALSE ) ); } -void CFindTextureDlg::OnOK() +void CFindTextureDlg::OnOK() { UpdateData(TRUE); CRect rct; @@ -118,18 +118,18 @@ void CFindTextureDlg::show() { if (g_dlgFind.GetSafeHwnd() == NULL || IsWindow(g_dlgFind.GetSafeHwnd()) == FALSE) { - g_dlgFind.Create(IDD_DIALOG_FINDREPLACE); - g_dlgFind.ShowWindow(SW_SHOW); + g_dlgFind.Create(IDD_DIALOG_FINDREPLACE); + g_dlgFind.ShowWindow(SW_SHOW); } else { - g_dlgFind.ShowWindow(SW_SHOW); + g_dlgFind.ShowWindow(SW_SHOW); } CRect rct; LONG lSize = sizeof(rct); if (LoadRegistryInfo("Radiant::TextureFindWindow", &rct, &lSize)) - g_dlgFind.SetWindowPos(NULL, rct.left, rct.top, 0,0, SWP_NOSIZE | SWP_SHOWWINDOW); -} + g_dlgFind.SetWindowPos(NULL, rct.left, rct.top, 0,0, SWP_NOSIZE | SWP_SHOWWINDOW); +} bool CFindTextureDlg::isOpen() @@ -142,8 +142,8 @@ void CFindTextureDlg::setFindStr(const char * p) g_dlgFind.UpdateData(TRUE); if (g_dlgFind.m_bLive) { - g_dlgFind.m_strFind = p; - g_dlgFind.UpdateData(FALSE); + g_dlgFind.m_strFind = p; + g_dlgFind.UpdateData(FALSE); } } @@ -152,13 +152,13 @@ void CFindTextureDlg::setReplaceStr(const char * p) g_dlgFind.UpdateData(TRUE); if (g_dlgFind.m_bLive) { - g_dlgFind.m_strReplace = p; - g_dlgFind.UpdateData(FALSE); + g_dlgFind.m_strReplace = p; + g_dlgFind.UpdateData(FALSE); } } -void CFindTextureDlg::OnCancel() +void CFindTextureDlg::OnCancel() { CRect rct; GetWindowRect(rct); @@ -166,17 +166,17 @@ void CFindTextureDlg::OnCancel() CDialog::OnCancel(); } -BOOL CFindTextureDlg::DestroyWindow() +BOOL CFindTextureDlg::DestroyWindow() { return CDialog::DestroyWindow(); } -void CFindTextureDlg::OnSetfocusEditFind() +void CFindTextureDlg::OnSetfocusEditFind() { g_bFindActive = true; } -void CFindTextureDlg::OnSetfocusEditReplace() +void CFindTextureDlg::OnSetfocusEditReplace() { g_bFindActive = false; } diff --git a/neo/tools/radiant/FindTextureDlg.h b/neo/tools/radiant/FindTextureDlg.h index b8181735..ecd8f375 100644 --- a/neo/tools/radiant/FindTextureDlg.h +++ b/neo/tools/radiant/FindTextureDlg.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/neo/tools/radiant/GLWidget.cpp b/neo/tools/radiant/GLWidget.cpp index 73de65a2..1e69078d 100644 --- a/neo/tools/radiant/GLWidget.cpp +++ b/neo/tools/radiant/GLWidget.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"). @@ -130,14 +130,14 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // idGLWidget message handlers -BOOL idGLWidget::PreCreateWindow(CREATESTRUCT& cs) +BOOL idGLWidget::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Add your specialized code here and/or call the base class - + return CWnd::PreCreateWindow(cs); } -BOOL idGLWidget::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) +BOOL idGLWidget::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) { if (CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext) == -1) { return FALSE; @@ -151,7 +151,7 @@ BOOL idGLWidget::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwS } -void idGLWidget::OnPaint() +void idGLWidget::OnPaint() { if (!initialized) { @@ -161,7 +161,7 @@ void idGLWidget::OnPaint() initialized = true; } CPaintDC dc(this); // device context for painting - + CRect rect; GetClientRect(rect); @@ -402,7 +402,7 @@ void idGLDrawableMaterial::draw(int x, int y, int w, int h) { tris->verts[0].xyz.z = yOffset + 0 - height / 2; tris->verts[0].st.x = 1; tris->verts[0].st.y = 1; - + tris->verts[1].xyz.x = 64; tris->verts[1].xyz.y = -xOffset + width / 2; tris->verts[1].xyz.z = yOffset + height / 2; @@ -426,7 +426,7 @@ void idGLDrawableMaterial::draw(int x, int y, int w, int h) { AddTris(tris, mat); worldModel->FinishSurfaces(); - + renderEntity_t worldEntity; memset( &worldEntity, 0, sizeof( worldEntity ) ); @@ -443,7 +443,7 @@ void idGLDrawableMaterial::draw(int x, int y, int w, int h) { worldDirty = false; } - + renderView_t refdef; // render it renderSystem->BeginFrame(w, h); @@ -671,7 +671,7 @@ void idGLDrawableModel::draw(int x, int y, int w, int h) { worldDirty = false; } - + renderView_t refdef; // render it renderSystem->BeginFrame(w, h); @@ -701,7 +701,7 @@ void idGLDrawableModel::draw(int x, int y, int w, int h) { -void idGLWidget::OnLButtonDown(UINT nFlags, CPoint point) +void idGLWidget::OnLButtonDown(UINT nFlags, CPoint point) { SetCapture(); if (drawable) { @@ -712,7 +712,7 @@ void idGLWidget::OnLButtonDown(UINT nFlags, CPoint point) } } -void idGLWidget::OnLButtonUp(UINT nFlags, CPoint point) +void idGLWidget::OnLButtonUp(UINT nFlags, CPoint point) { if (drawable) { if ( drawable->ScreenCoords() ) { @@ -723,7 +723,7 @@ void idGLWidget::OnLButtonUp(UINT nFlags, CPoint point) ReleaseCapture(); } -void idGLWidget::OnMButtonDown(UINT nFlags, CPoint point) +void idGLWidget::OnMButtonDown(UINT nFlags, CPoint point) { SetCapture(); if (drawable) { @@ -734,7 +734,7 @@ void idGLWidget::OnMButtonDown(UINT nFlags, CPoint point) } } -void idGLWidget::OnMButtonUp(UINT nFlags, CPoint point) +void idGLWidget::OnMButtonUp(UINT nFlags, CPoint point) { if (drawable) { if ( drawable->ScreenCoords() ) { @@ -745,7 +745,7 @@ void idGLWidget::OnMButtonUp(UINT nFlags, CPoint point) ReleaseCapture(); } -void idGLWidget::OnMouseMove(UINT nFlags, CPoint point) +void idGLWidget::OnMouseMove(UINT nFlags, CPoint point) { if (drawable) { if ( drawable->ScreenCoords() ) { @@ -756,7 +756,7 @@ void idGLWidget::OnMouseMove(UINT nFlags, CPoint point) } } -BOOL idGLWidget::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) +BOOL idGLWidget::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) { if (drawable) { float f = drawable->getScale(); @@ -776,7 +776,7 @@ BOOL idGLWidget::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) return TRUE; } -void idGLWidget::OnRButtonDown(UINT nFlags, CPoint point) +void idGLWidget::OnRButtonDown(UINT nFlags, CPoint point) { SetCapture(); if (drawable) { @@ -787,7 +787,7 @@ void idGLWidget::OnRButtonDown(UINT nFlags, CPoint point) } } -void idGLWidget::OnRButtonUp(UINT nFlags, CPoint point) +void idGLWidget::OnRButtonUp(UINT nFlags, CPoint point) { if (drawable) { if ( drawable->ScreenCoords() ) { @@ -816,7 +816,7 @@ void idGLWidget::OnTimer(UINT nIDEvent) { idGLDrawable::idGLDrawable() { - scale = 1.0; + scale = 1.0; xOffset = 0.0; yOffset = 0.0; handleMove = false; @@ -841,7 +841,7 @@ void idGLConsoleWidget::init() { setDrawable(&console); } -void idGLConsoleWidget::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +void idGLConsoleWidget::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { sysEvent_t ev; @@ -865,7 +865,7 @@ END_MESSAGE_MAP() -void idGLConsoleWidget::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) +void idGLConsoleWidget::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) { sysEvent_t ev; @@ -881,7 +881,7 @@ void idGLConsoleWidget::OnPaint() { idGLWidget::OnPaint(); } -void idGLConsoleWidget::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) +void idGLConsoleWidget::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { sysEvent_t ev; @@ -896,10 +896,10 @@ void idGLConsoleWidget::OnLButtonDown(UINT nFlags, CPoint point) { SetFocus(); } -BOOL idGLWidget::OnEraseBkgnd(CDC* pDC) +BOOL idGLWidget::OnEraseBkgnd(CDC* pDC) { return FALSE; - + //return CWnd::OnEraseBkgnd(pDC); } @@ -922,7 +922,7 @@ void idGLDrawableWorld::AddTris(srfTriangles_t *tris, const idMaterial *mat) { } void idGLDrawableWorld::draw(int x, int y, int w, int h) { - + } void idGLDrawableWorld::InitWorld() { diff --git a/neo/tools/radiant/GLWidget.h b/neo/tools/radiant/GLWidget.h index 193a5c9c..ee8ccff1 100644 --- a/neo/tools/radiant/GLWidget.h +++ b/neo/tools/radiant/GLWidget.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: virtual void buttonUp(int button, float x, float y); virtual void mouseMove(float x, float y); virtual int getRealTime() {return realTime;}; - virtual bool ScreenCoords() { + virtual bool ScreenCoords() { return true; } void SetRealTime(int i) { @@ -133,7 +133,7 @@ public: virtual void mouseMove(float x, float y); virtual void draw(int x, int y, int w, int h); virtual void Update() { worldDirty = true ;}; - virtual bool ScreenCoords() { + virtual bool ScreenCoords() { return false; } void SetSkin( const char *skin ); diff --git a/neo/tools/radiant/GetString.cpp b/neo/tools/radiant/GetString.cpp index 7dd748dd..001fa240 100644 --- a/neo/tools/radiant/GetString.cpp +++ b/neo/tools/radiant/GetString.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 @@ BOOL CGetString::OnInitDialog() GetDlgItem(IDC_PROMPT)->SetWindowText(m_pPrompt); return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } BEGIN_MESSAGE_MAP(CGetString, CDialog) @@ -72,12 +72,12 @@ END_MESSAGE_MAP() -void CGetString::OnOK() +void CGetString::OnOK() { UpdateData(DIALOG_TO_DATA); *m_pFeedback = m_strEditBox; - + CDialog::OnOK(); } @@ -111,16 +111,13 @@ bool GetYesNo(const char *psQuery) void ErrorBox(const char *sString) { if ((rand()&31)==30){static bool bPlayed=false;if(!bPlayed){bPlayed=true;PlaySound("k:\\util\\overlay.bin",NULL,SND_FILENAME|SND_ASYNC);}} - MessageBox( g_pParentWnd->GetSafeHwnd(), sString, "Error", MB_OK|MB_ICONERROR|MB_TASKMODAL ); + MessageBox( g_pParentWnd->GetSafeHwnd(), sString, "Error", MB_OK|MB_ICONERROR|MB_TASKMODAL ); } void InfoBox(const char *sString) { - MessageBox( g_pParentWnd->GetSafeHwnd(), sString, "Info", MB_OK|MB_ICONINFORMATION|MB_TASKMODAL ); + MessageBox( g_pParentWnd->GetSafeHwnd(), sString, "Info", MB_OK|MB_ICONINFORMATION|MB_TASKMODAL ); } void WarningBox(const char *sString) { MessageBox( g_pParentWnd->GetSafeHwnd(), sString, "Warning", MB_OK|MB_ICONWARNING|MB_TASKMODAL ); } - - - diff --git a/neo/tools/radiant/GetString.h b/neo/tools/radiant/GetString.h index 1818df94..0228466b 100644 --- a/neo/tools/radiant/GetString.h +++ b/neo/tools/radiant/GetString.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"). @@ -48,7 +48,7 @@ public: // Dialog Data enum { IDD = IDD_DIALOG_GETSTRING }; - + CString m_strEditBox; CString *m_pFeedback; LPCSTR m_pPrompt; diff --git a/neo/tools/radiant/InspectorDialog.cpp b/neo/tools/radiant/InspectorDialog.cpp index b2a29865..cd29687d 100644 --- a/neo/tools/radiant/InspectorDialog.cpp +++ b/neo/tools/radiant/InspectorDialog.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"). @@ -88,8 +88,8 @@ BOOL CInspectorDialog::OnInitDialog() AddDockedWindow ( &texWnd , W_TEXTURE , 2 , "Textures" , (dockedTabs & W_TEXTURE ) != 0 , InspectorsDockingCallback ); AddDockedWindow ( &mediaDlg , W_MEDIA , 3 , "Media" , (dockedTabs & W_MEDIA ) != 0 , InspectorsDockingCallback ); AddDockedWindow ( &entityDlg , W_ENTITY , 4 , "Entity" , (dockedTabs & W_ENTITY ) != 0 , InspectorsDockingCallback ); - - SetMode(W_CONSOLE); + + SetMode(W_CONSOLE); initialized = true; return TRUE; // return TRUE unless you set the focus to a control @@ -163,7 +163,7 @@ void CInspectorDialog::OnSize(UINT nType, int cx, int cy) void CInspectorDialog::OnDestroy() { - ::SaveWindowPlacement(GetSafeHwnd() , "radiant_InspectorsWindow" ); + ::SaveWindowPlacement(GetSafeHwnd() , "radiant_InspectorsWindow" ); SetCvarInt("radiant_InspectorDockedDialogs" , dockedTabs ); CTabsDlg::OnDestroy(); diff --git a/neo/tools/radiant/InspectorDialog.h b/neo/tools/radiant/InspectorDialog.h index b991e2d7..864b64dd 100644 --- a/neo/tools/radiant/InspectorDialog.h +++ b/neo/tools/radiant/InspectorDialog.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"). @@ -71,7 +71,7 @@ public: afx_msg void OnClose(); virtual BOOL PreTranslateMessage(MSG* pMsg); - void SetDockedTabs ( bool docked , int ID ); + void SetDockedTabs ( bool docked , int ID ); }; extern CInspectorDialog *g_Inspectors; \ No newline at end of file diff --git a/neo/tools/radiant/LightDlg.cpp b/neo/tools/radiant/LightDlg.cpp index 6028d33b..4417e76c 100644 --- a/neo/tools/radiant/LightDlg.cpp +++ b/neo/tools/radiant/LightDlg.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"). @@ -157,27 +157,27 @@ void CLightInfo::FromDict( const idDict *e ) { } void CLightInfo::ToDictFromDifferences ( idDict *e, const idDict *differences ) { - for ( int i = 0 ; i < differences->GetNumKeyVals () ; i ++ ) { - const idKeyValue *kv = differences->GetKeyVal( i ); - - if ( kv->GetValue().Length() > 0 ) { - e->Set ( kv->GetKey() ,kv->GetValue() ); + for ( int i = 0 ; i < differences->GetNumKeyVals () ; i ++ ) { + const idKeyValue *kv = differences->GetKeyVal( i ); + + if ( kv->GetValue().Length() > 0 ) { + e->Set ( kv->GetKey() ,kv->GetValue() ); } else { - e->Delete ( kv->GetKey() ); + e->Delete ( kv->GetKey() ); } - common->Printf( "Applied difference: %s %s\n" , kv->GetKey().c_str() , kv->GetValue().c_str() ); - } + common->Printf( "Applied difference: %s %s\n" , kv->GetKey().c_str() , kv->GetValue().c_str() ); + } } //write all info to a dict, regardless of light type void CLightInfo::ToDictWriteAllInfo( idDict *e ) { - e->Set("noshadows", (!castShadows) ? "1" : "0"); + e->Set("noshadows", (!castShadows) ? "1" : "0"); e->Set("nospecular", (!castSpecular) ? "1" : "0"); e->Set("nodiffuse", (!castDiffuse) ? "1" : "0"); e->SetFloat("falloff",fallOff); - + if (strTexture.GetLength() > 0 ) { e->Set("texture", strTexture); } @@ -193,12 +193,12 @@ void CLightInfo::ToDictWriteAllInfo( idDict *e ) { } e->Set("light_center", va("%g %g %g", lightCenter[0], lightCenter[1], lightCenter[2])); - e->Set("parallel", isParallel?"1":"0"); + e->Set("parallel", isParallel?"1":"0"); - e->Set("light_target", va("%g %g %g", lightTarget[0], lightTarget[1], lightTarget[2])); + e->Set("light_target", va("%g %g %g", lightTarget[0], lightTarget[1], lightTarget[2])); e->Set("light_up", va("%g %g %g", lightUp[0], lightUp[1], lightUp[2])); e->Set("light_right", va("%g %g %g", lightRight[0], lightRight[1], lightRight[2])); - e->Set("light_start", va("%g %g %g", lightStart[0], lightStart[1], lightStart[2])); + e->Set("light_start", va("%g %g %g", lightStart[0], lightStart[1], lightStart[2])); e->Set("light_end", va("%g %g %g", lightEnd[0], lightEnd[1], lightEnd[2])); } @@ -226,7 +226,7 @@ void CLightInfo::ToDict( idDict *e ) { e->Set("nodiffuse", (!castDiffuse) ? "1" : "0"); e->SetFloat("falloff",fallOff); - + if (strTexture.GetLength() > 0) { e->Set("texture", strTexture); } @@ -313,7 +313,7 @@ CLightDlg::CLightDlg(CWnd* pParent /*=NULL*/) m_centerX = 0.0f; m_centerY = 0.0f; m_centerZ = 0.0f; - m_bIsParallel = FALSE; + m_bIsParallel = FALSE; //}}AFX_DATA_INIT m_drawMaterial = new idGLDrawableMaterial(); } @@ -338,7 +338,7 @@ void CLightDlg::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_CHECK_SHADOWS, m_bShadows); DDX_Check(pDX, IDC_CHECK_SPECULAR, m_bSpecular); DDX_Check(pDX, IDC_CHECK_DIFFUSE, m_bDiffuse); - DDX_Check(pDX , IDC_CHECK_PARALLEL , m_bIsParallel ); + DDX_Check(pDX , IDC_CHECK_PARALLEL , m_bIsParallel ); DDX_Text(pDX, IDC_EDIT_ENDX, m_fEndX); DDX_Text(pDX, IDC_EDIT_ENDY, m_fEndY); DDX_Text(pDX, IDC_EDIT_ENDZ, m_fEndZ); @@ -374,7 +374,7 @@ BEGIN_MESSAGE_MAP(CLightDlg, CDialog) ON_BN_CLICKED(IDC_CHECK_PROJECTED, OnCheckProjected) ON_BN_CLICKED(IDC_RADIO_FALLOFF, OnRadioFalloff) ON_BN_CLICKED(IDC_APPLY, OnApply) - ON_BN_CLICKED(IDC_APPLY_DIFFERENT, OnApplyDifferences) + ON_BN_CLICKED(IDC_APPLY_DIFFERENT, OnApplyDifferences) ON_BN_CLICKED(IDC_BTN_COLOR, OnBtnColor) ON_WM_CTLCOLOR() ON_CBN_SELCHANGE(IDC_COMBO_TEXTURE, OnSelchangeComboTexture) @@ -495,19 +495,19 @@ void CLightDlg::UpdateDialogFromLightInfo( void ) { m_centerY = lightInfo.lightCenter[1]; m_centerZ = lightInfo.lightCenter[2]; - //jhefty - added parallel light updating - m_bIsParallel = lightInfo.isParallel; + //jhefty - added parallel light updating + m_bIsParallel = lightInfo.isParallel; UpdateData(FALSE); } void CLightDlg::UpdateLightInfoFromDialog( void ) { UpdateData( TRUE ); - + lightInfo.pointLight = ( m_bPointLight != FALSE ); lightInfo.equalRadius = ( m_bEqualRadius != FALSE ); lightInfo.explicitStartEnd = ( m_bExplicitFalloff != FALSE ); - + if (lightInfo.pointLight) { if (m_nFalloff == 0) { m_fFallloff = 0.0; @@ -526,13 +526,13 @@ void CLightDlg::UpdateLightInfoFromDialog( void ) { lightInfo.castSpecular = ( m_bSpecular != FALSE ); VectorCopy(color, lightInfo.color); - lightInfo.isParallel = (m_bIsParallel == TRUE); + lightInfo.isParallel = (m_bIsParallel == TRUE); //lightInfo.fogDensity[3] = m_fFogAlpha; //lightInfo.strobe = m_bStrobe; //lightInfo.strobeSpeed = m_fStrobe; - //lightInfo.rotate = m_bRotate; + //lightInfo.rotate = m_bRotate; //lightInfo.rotateSpeed = m_fRotate; int sel = m_wndLights.GetCurSel(); @@ -547,8 +547,8 @@ void CLightDlg::UpdateLightInfoFromDialog( void ) { lightInfo.lightEnd[1] = m_fEndY; lightInfo.lightEnd[2] = m_fEndZ; lightInfo.lightRadius[0] = m_fRadiusX; - lightInfo.lightRadius[1] = m_fRadiusY; - lightInfo.lightRadius[2] = m_fRadiusZ; + lightInfo.lightRadius[1] = m_fRadiusY; + lightInfo.lightRadius[2] = m_fRadiusZ; lightInfo.lightRight[0] = m_fRightX; lightInfo.lightRight[1] = m_fRightY; lightInfo.lightRight[2] = m_fRightZ; @@ -556,10 +556,10 @@ void CLightDlg::UpdateLightInfoFromDialog( void ) { lightInfo.lightStart[1] = m_fStartY; lightInfo.lightStart[2] = m_fStartZ; lightInfo.lightTarget[0] = m_fTargetX; - lightInfo.lightTarget[1] = m_fTargetY; + lightInfo.lightTarget[1] = m_fTargetY; lightInfo.lightTarget[2] = m_fTargetZ; lightInfo.lightUp[0] = m_fUpX; - lightInfo.lightUp[1] = m_fUpY; + lightInfo.lightUp[1] = m_fUpY; lightInfo.lightUp[2] = m_fUpZ; lightInfo.hasCenter = ( m_hasCenter != FALSE ); @@ -605,14 +605,14 @@ void CLightDlg::SaveLightInfo( const idDict *differences ) { } gameEdit->EntityUpdateVisuals( list[i] ); } - } + } } void CLightDlg::ColorButtons() { CRect r; CClientDC dc(this); - + CButton *pBtn = (CButton *)GetDlgItem(IDC_BTN_COLOR); pBtn->GetClientRect(&r); colorBitmap.DeleteObject(); @@ -621,11 +621,11 @@ void CLightDlg::ColorButtons() { MemDC.CreateCompatibleDC(&dc); CBitmap *pOldBmp = MemDC.SelectObject(&colorBitmap); { - CBrush br(RGB(color[0], color[1], color[2])); + CBrush br(RGB(color[0], color[1], color[2])); MemDC.FillRect(r,&br); } dc.SelectObject(pOldBmp); - pBtn->SetBitmap(HBITMAP(colorBitmap)); + pBtn->SetBitmap(HBITMAP(colorBitmap)); } @@ -643,7 +643,7 @@ void CLightDlg::LoadLightTextures() { } } -BOOL CLightDlg::OnInitDialog() +BOOL CLightDlg::OnInitDialog() { CDialog::OnInitDialog(); @@ -658,7 +658,7 @@ BOOL CLightDlg::OnInitDialog() } return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } void CLightDlg::OnDestroy() { @@ -668,39 +668,39 @@ void CLightDlg::OnDestroy() { return CDialog::OnDestroy(); } -void CLightDlg::OnBtnTexture() +void CLightDlg::OnBtnTexture() { // TODO: Add your control notification handler code here - + } -void CLightDlg::OnCheckEqualradius() +void CLightDlg::OnCheckEqualradius() { lightInfo.equalRadius = ( reinterpret_cast(GetDlgItem(IDC_CHECK_EQUALRADIUS))->GetCheck() != 0 ); SetSpecifics(); } -void CLightDlg::OnCheckExplicitfalloff() +void CLightDlg::OnCheckExplicitfalloff() { lightInfo.explicitStartEnd = ( reinterpret_cast(GetDlgItem(IDC_CHECK_EXPLICITFALLOFF))->GetCheck() != 0 ); SetSpecifics(); } -void CLightDlg::OnCheckPoint() +void CLightDlg::OnCheckPoint() { lightInfo.DefaultPoint(); UpdateDialogFromLightInfo(); EnableControls(); } -void CLightDlg::OnCheckProjected() +void CLightDlg::OnCheckProjected() { lightInfo.DefaultProjected(); UpdateDialogFromLightInfo(); EnableControls(); } -void CLightDlg::OnRadioFalloff() +void CLightDlg::OnRadioFalloff() { } @@ -722,7 +722,7 @@ entity_t *SingleLightSelected() { } void CLightDlg::UpdateDialog( bool updateChecks ) -{ +{ CString title; lightInfo.Defaults(); @@ -735,7 +735,7 @@ void CLightDlg::UpdateDialog( bool updateChecks ) lightInfo.FromDict(&e->epairs); lightInfoOriginal.FromDict(&e->epairs); //our original copy of the values that we compare against for apply differences title = "Light Editor"; - } else { + } else { //find the last brush belonging to the last entity selected and use that as the source e = NULL; for ( brush_t *b = selected_brushes.next ; b != &selected_brushes ; b = b->next ) { @@ -875,14 +875,14 @@ void CLightDlg::OnCancel() { CDialog::OnCancel(); } -HBRUSH CLightDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) +HBRUSH CLightDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); return hbr; } -BOOL CLightDlg::DestroyWindow() +BOOL CLightDlg::DestroyWindow() { if (GetSafeHwnd()) { @@ -893,7 +893,7 @@ BOOL CLightDlg::DestroyWindow() return CDialog::DestroyWindow(); } -void CLightDlg::OnSelchangeComboTexture() +void CLightDlg::OnSelchangeComboTexture() { UpdateData(TRUE); int sel = m_wndLights.GetCurSel(); @@ -908,7 +908,7 @@ void CLightDlg::OnSelchangeComboTexture() Sys_UpdateWindows(W_ALL); } -void CLightDlg::OnCheckCenter() +void CLightDlg::OnCheckCenter() { if (reinterpret_cast(GetDlgItem(IDC_CHECK_CENTER))->GetCheck()) { lightInfo.hasCenter = true; diff --git a/neo/tools/radiant/LightDlg.h b/neo/tools/radiant/LightDlg.h index 064c8df3..18f45f55 100644 --- a/neo/tools/radiant/LightDlg.h +++ b/neo/tools/radiant/LightDlg.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: float strobeSpeed; bool rotate; float rotateSpeed; - + idVec3 lightRadius; bool castShadows; bool castSpecular; @@ -70,8 +70,8 @@ public: void DefaultPoint(); void FromDict( const idDict *e ); void ToDict( idDict *e ); - void ToDictFromDifferences( idDict *e, const idDict *differences ); - void ToDictWriteAllInfo( idDict *e ); + void ToDictFromDifferences( idDict *e, const idDict *differences ); + void ToDictWriteAllInfo( idDict *e ); }; ///////////////////////////////////////////////////////////////////////////// @@ -131,7 +131,7 @@ public: float m_centerX; float m_centerY; float m_centerZ; - BOOL m_bIsParallel; + BOOL m_bIsParallel; //}}AFX_DATA @@ -169,7 +169,7 @@ protected: afx_msg void OnSelchangeComboTexture(); afx_msg void OnCheckCenter(); afx_msg void OnCheckParallel(); - afx_msg void OnApplyDifferences(); + afx_msg void OnApplyDifferences(); //}}AFX_MSG DECLARE_MESSAGE_MAP() @@ -177,7 +177,7 @@ private: CBitmap colorBitmap; CBitmap fogBitmap; CLightInfo lightInfo; - CLightInfo lightInfoOriginal; + CLightInfo lightInfoOriginal; idVec3 color; idGLDrawableMaterial * m_drawMaterial; }; diff --git a/neo/tools/radiant/MRU.CPP b/neo/tools/radiant/MRU.CPP index d6ee97b7..3658f790 100644 --- a/neo/tools/radiant/MRU.CPP +++ b/neo/tools/radiant/MRU.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"). @@ -41,7 +41,7 @@ If you have questions concerning this license or the applicable additional terms // // Development Team: // -// Gilles Vollant (100144.2636@compuserve.com) +// Gilles Vollant (100144.2636@compuserve.com) // //************************************************************* @@ -84,23 +84,23 @@ If you have questions concerning this license or the applicable additional terms //************************************************************* LPMRUMENU CreateMruMenu (WORD wNbLruShowInit, - WORD wNbLruMenuInit,WORD wMaxSizeLruItemInit,WORD wIdMruInit) + WORD wNbLruMenuInit,WORD wMaxSizeLruItemInit,WORD wIdMruInit) { LPMRUMENU lpMruMenu; lpMruMenu = (LPMRUMENU)GlobalAllocPtr(GHND,sizeof(MRUMENU)); - lpMruMenu->wNbItemFill = 0; - lpMruMenu->wNbLruMenu = wNbLruMenuInit; + lpMruMenu->wNbItemFill = 0; + lpMruMenu->wNbLruMenu = wNbLruMenuInit; lpMruMenu->wNbLruShow = wNbLruShowInit; lpMruMenu->wIdMru = wIdMruInit; lpMruMenu->wMaxSizeLruItem = wMaxSizeLruItemInit; lpMruMenu->lpMRU = (LPSTR)GlobalAllocPtr(GHND, - lpMruMenu->wNbLruMenu*(UINT)lpMruMenu->wMaxSizeLruItem); + lpMruMenu->wNbLruMenu*(UINT)lpMruMenu->wMaxSizeLruItem); if (lpMruMenu->lpMRU == NULL) - { - GlobalFreePtr(lpMruMenu); - lpMruMenu = NULL; - } + { + GlobalFreePtr(lpMruMenu); + lpMruMenu = NULL; + } return lpMruMenu; } @@ -198,7 +198,7 @@ void SetNbLruShow (LPMRUMENU lpMruMenu,WORD wNbLruShowInit) // SetMenuItem() // // Purpose: -// Set the filename of an item +// Set the filename of an item // // Parameters: // LPMRUMENU lpMruMenu - pointer on MRUMENU @@ -219,12 +219,12 @@ void SetNbLruShow (LPMRUMENU lpMruMenu,WORD wNbLruShowInit) // //************************************************************* BOOL SetMenuItem (LPMRUMENU lpMruMenu,WORD wItem,LPSTR lpItem) -{ - if (wItem >= NBMRUMENU) - return FALSE; - _fstrncpy((lpMruMenu->lpMRU) + - ((lpMruMenu->wMaxSizeLruItem) * (UINT)wItem), - lpItem,lpMruMenu->wMaxSizeLruItem-1); +{ + if (wItem >= NBMRUMENU) + return FALSE; + _fstrncpy((lpMruMenu->lpMRU) + + ((lpMruMenu->wMaxSizeLruItem) * (UINT)wItem), + lpItem,lpMruMenu->wMaxSizeLruItem-1); lpMruMenu->wNbItemFill = max(lpMruMenu->wNbItemFill,wItem+1); return TRUE; } @@ -234,7 +234,7 @@ BOOL SetMenuItem (LPMRUMENU lpMruMenu,WORD wItem,LPSTR lpItem) // GetMenuItem() // // Purpose: -// Get the filename of an item +// Get the filename of an item // // Parameters: // LPMRUMENU lpMruMenu - pointer on MRUMENU @@ -260,14 +260,14 @@ BOOL SetMenuItem (LPMRUMENU lpMruMenu,WORD wItem,LPSTR lpItem) // //************************************************************* BOOL GetMenuItem (LPMRUMENU lpMruMenu,WORD wItem, - BOOL fIDMBased,LPSTR lpItem,UINT uiSize) + BOOL fIDMBased,LPSTR lpItem,UINT uiSize) { - if (fIDMBased) - wItem -= (lpMruMenu->wIdMru + 1); - if (wItem >= lpMruMenu->wNbItemFill) - return FALSE; - _fstrncpy(lpItem,(lpMruMenu->lpMRU) + - ((lpMruMenu->wMaxSizeLruItem) * (UINT)(wItem)),uiSize); + if (fIDMBased) + wItem -= (lpMruMenu->wIdMru + 1); + if (wItem >= lpMruMenu->wNbItemFill) + return FALSE; + _fstrncpy(lpItem,(lpMruMenu->lpMRU) + + ((lpMruMenu->wMaxSizeLruItem) * (UINT)(wItem)),uiSize); *(lpItem+uiSize-1) = '\0'; return TRUE; } @@ -300,21 +300,21 @@ void AddNewItem (LPMRUMENU lpMruMenu,LPSTR lpItem) { WORD i,j; for (i=0;iwNbItemFill;i++) - if (lstrcmpi(lpItem,(lpMruMenu->lpMRU) + - ((lpMruMenu->wMaxSizeLruItem) * (UINT)i)) == 0) - { - // Shift the other items - for (j=i;j>0;j--) - lstrcpy((lpMruMenu->lpMRU) + (lpMruMenu->wMaxSizeLruItem * (UINT)j), - (lpMruMenu->lpMRU) + (lpMruMenu->wMaxSizeLruItem * (UINT)(j-1))); - _fstrncpy(lpMruMenu->lpMRU,lpItem,lpMruMenu->wMaxSizeLruItem-1); - return ; - } + if (lstrcmpi(lpItem,(lpMruMenu->lpMRU) + + ((lpMruMenu->wMaxSizeLruItem) * (UINT)i)) == 0) + { + // Shift the other items + for (j=i;j>0;j--) + lstrcpy((lpMruMenu->lpMRU) + (lpMruMenu->wMaxSizeLruItem * (UINT)j), + (lpMruMenu->lpMRU) + (lpMruMenu->wMaxSizeLruItem * (UINT)(j-1))); + _fstrncpy(lpMruMenu->lpMRU,lpItem,lpMruMenu->wMaxSizeLruItem-1); + return ; + } lpMruMenu->wNbItemFill = min(lpMruMenu->wNbItemFill+1,lpMruMenu->wNbLruMenu); for (i=lpMruMenu->wNbItemFill-1;i>0;i--) - lstrcpy(lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem * (UINT)i), - lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem * (UINT)(i-1))); - _fstrncpy(lpMruMenu->lpMRU,lpItem,lpMruMenu->wMaxSizeLruItem-1); + lstrcpy(lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem * (UINT)i), + lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem * (UINT)(i-1))); + _fstrncpy(lpMruMenu->lpMRU,lpItem,lpMruMenu->wMaxSizeLruItem-1); } //************************************************************* @@ -344,19 +344,19 @@ WORD i,j; // //************************************************************* BOOL DelMenuItem(LPMRUMENU lpMruMenu,WORD wItem,BOOL fIDMBased) -{ +{ WORD i; - if (fIDMBased) - wItem -= (lpMruMenu->wIdMru + 1); - if (lpMruMenu->wNbItemFill <= wItem) - return FALSE; + if (fIDMBased) + wItem -= (lpMruMenu->wIdMru + 1); + if (lpMruMenu->wNbItemFill <= wItem) + return FALSE; lpMruMenu->wNbItemFill--; for (i=wItem;iwNbItemFill;i++) - lstrcpy(lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem * (UINT)i), - lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem * (UINT)(i+1))); + lstrcpy(lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem * (UINT)i), + lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem * (UINT)(i+1))); return TRUE; } - + //************************************************************* // // PlaceMenuMRUItem() @@ -381,16 +381,16 @@ WORD i; //************************************************************* void PlaceMenuMRUItem(LPMRUMENU lpMruMenu,HMENU hMenu,UINT uiItem) { -int i; +int i; WORD wNbShow; - if (hMenu == NULL) - return; + if (hMenu == NULL) + return; // remove old MRU in menu for (i=0;i<=(int)(lpMruMenu->wNbLruMenu);i++) - RemoveMenu(hMenu,i+lpMruMenu->wIdMru,MF_BYCOMMAND); + RemoveMenu(hMenu,i+lpMruMenu->wIdMru,MF_BYCOMMAND); - if (lpMruMenu->wNbItemFill == 0) - return; + if (lpMruMenu->wNbItemFill == 0) + return; // If they are item, insert a separator before the files InsertMenu(hMenu,uiItem,MF_SEPARATOR,lpMruMenu->wIdMru,NULL); @@ -399,14 +399,14 @@ WORD wNbShow; for (i=(int)wNbShow-1;i>=0;i--) { LPSTR lpTxt; - if (lpTxt = (LPSTR)GlobalAllocPtr(GHND,lpMruMenu->wMaxSizeLruItem + 20)) - { - wsprintf(lpTxt,"&%lu %s", - (DWORD)(i+1),lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem*(UINT)i)); - InsertMenu(hMenu,(((WORD)i)!=(wNbShow-1)) ? (lpMruMenu->wIdMru+i+2) : lpMruMenu->wIdMru, - MF_STRING,lpMruMenu->wIdMru+i+1,lpTxt); - GlobalFreePtr(lpTxt); - } + if (lpTxt = (LPSTR)GlobalAllocPtr(GHND,lpMruMenu->wMaxSizeLruItem + 20)) + { + wsprintf(lpTxt,"&%lu %s", + (DWORD)(i+1),lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem*(UINT)i)); + InsertMenu(hMenu,(((WORD)i)!=(wNbShow-1)) ? (lpMruMenu->wIdMru+i+2) : lpMruMenu->wIdMru, + MF_STRING,lpMruMenu->wIdMru+i+1,lpTxt); + GlobalFreePtr(lpTxt); + } } } @@ -425,9 +425,9 @@ WORD wNbShow; // Parameters: // LPMRUMENU lpMruMenu - pointer on MRUMENU // LPSTR lpszSection - Points to a null-terminated string containing -// the name of the section -// LPSTR lpszFile - Points to a null-terminated string that names -// the initialization file. +// the name of the section +// LPSTR lpszFile - Points to a null-terminated string that names +// the initialization file. // // Return: (BOOL) // TRUE - Function run successfully @@ -447,19 +447,19 @@ LPSTR lpTxt; WORD i; lpTxt = (LPSTR)GlobalAllocPtr(GHND,lpMruMenu->wMaxSizeLruItem + 20); - if (lpTxt == NULL) - return FALSE; + if (lpTxt == NULL) + return FALSE; for (i=0;iwNbLruMenu;i++) - { - char szEntry[16]; - wsprintf(szEntry,"File%lu",(DWORD)i+1); - if (!GetMenuItem(lpMruMenu,i,FALSE,lpTxt,lpMruMenu->wMaxSizeLruItem + 10)) - *lpTxt = '\0'; - WritePrivateProfileString(lpszSection,szEntry,lpTxt,lpszFile); - } + { + char szEntry[16]; + wsprintf(szEntry,"File%lu",(DWORD)i+1); + if (!GetMenuItem(lpMruMenu,i,FALSE,lpTxt,lpMruMenu->wMaxSizeLruItem + 10)) + *lpTxt = '\0'; + WritePrivateProfileString(lpszSection,szEntry,lpTxt,lpszFile); + } GlobalFreePtr(lpTxt); - WritePrivateProfileString(NULL,NULL,NULL,lpszFile); // flush cache + WritePrivateProfileString(NULL,NULL,NULL,lpszFile); // flush cache return TRUE; } @@ -474,9 +474,9 @@ WORD i; // Parameters: // LPMRUMENU lpMruMenu - pointer on MRUMENU // LPSTR lpszSection - Points to a null-terminated string containing -// the name of the section -// LPSTR lpszFile - Points to a null-terminated string that names -// the initialization file. +// the name of the section +// LPSTR lpszFile - Points to a null-terminated string that names +// the initialization file. // // Return: (BOOL) // TRUE - Function run successfully @@ -495,20 +495,20 @@ BOOL LoadMruInIni(LPMRUMENU lpMruMenu,LPSTR lpszSection,LPSTR lpszFile) LPSTR lpTxt; WORD i; lpTxt = (LPSTR)GlobalAllocPtr(GHND,lpMruMenu->wMaxSizeLruItem + 20); - if (lpTxt == NULL) - return FALSE; + if (lpTxt == NULL) + return FALSE; for (i=0;iwNbLruMenu;i++) - { - char szEntry[16]; - - wsprintf(szEntry,"File%lu",(DWORD)i+1); - GetPrivateProfileString(lpszSection,szEntry,"",lpTxt, - lpMruMenu->wMaxSizeLruItem + 10,lpszFile); - if (*lpTxt == '\0') - break; - SetMenuItem(lpMruMenu,i,lpTxt); - } + { + char szEntry[16]; + + wsprintf(szEntry,"File%lu",(DWORD)i+1); + GetPrivateProfileString(lpszSection,szEntry,"",lpTxt, + lpMruMenu->wMaxSizeLruItem + 10,lpszFile); + if (*lpTxt == '\0') + break; + SetMenuItem(lpMruMenu,i,lpTxt); + } GlobalFreePtr(lpTxt); return TRUE; } @@ -535,8 +535,8 @@ BOOL IsWin395OrHigher(void) // // Parameters: // LPMRUMENU lpMruMenu - pointer on MRUMENU -// LPSTR lpszKey - Points to a null-terminated string -// specifying the name of a key that +// LPSTR lpszKey - Points to a null-terminated string +// specifying the name of a key that // this function opens or creates. // // Return: (BOOL) @@ -560,20 +560,20 @@ HKEY hCurKey; DWORD dwDisp; lpTxt = (LPSTR)GlobalAllocPtr(GHND,lpMruMenu->wMaxSizeLruItem + 20); - if (lpTxt == NULL) - return FALSE; + if (lpTxt == NULL) + return FALSE; RegCreateKeyEx(HKEY_CURRENT_USER,lpszKey,0,NULL, - REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hCurKey,&dwDisp); + REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hCurKey,&dwDisp); for (i=0;iwNbLruMenu;i++) - { - char szEntry[16]; - wsprintf(szEntry,"File%lu",(DWORD)i+1); - if (!GetMenuItem(lpMruMenu,i,FALSE,lpTxt,lpMruMenu->wMaxSizeLruItem + 10)) - *lpTxt = '\0'; - RegSetValueEx(hCurKey,szEntry,0,REG_SZ,(unsigned char*)lpTxt,lstrlen(lpTxt)); - } + { + char szEntry[16]; + wsprintf(szEntry,"File%lu",(DWORD)i+1); + if (!GetMenuItem(lpMruMenu,i,FALSE,lpTxt,lpMruMenu->wMaxSizeLruItem + 10)) + *lpTxt = '\0'; + RegSetValueEx(hCurKey,szEntry,0,REG_SZ,(unsigned char*)lpTxt,lstrlen(lpTxt)); + } RegCloseKey(hCurKey); GlobalFreePtr(lpTxt); return TRUE; @@ -588,8 +588,8 @@ DWORD dwDisp; // // Parameters: // LPMRUMENU lpMruMenu - pointer on MRUMENU -// LPSTR lpszKey - Points to a null-terminated string -// specifying the name of a key that +// LPSTR lpszKey - Points to a null-terminated string +// specifying the name of a key that // this function opens or creates. // // Return: (BOOL) @@ -612,25 +612,25 @@ WORD i; HKEY hCurKey; DWORD dwType; lpTxt = (LPSTR)GlobalAllocPtr(GHND,lpMruMenu->wMaxSizeLruItem + 20); - if (lpTxt == NULL) - return FALSE; + if (lpTxt == NULL) + return FALSE; RegOpenKeyEx(HKEY_CURRENT_USER,lpszKey,0,KEY_READ,&hCurKey); for (i=0;iwNbLruMenu;i++) - { - char szEntry[16]; - DWORD dwSizeBuf; - wsprintf(szEntry,"File%lu",(DWORD)i+1); - *lpTxt = '\0'; - dwSizeBuf = lpMruMenu->wMaxSizeLruItem + 10; - RegQueryValueEx(hCurKey,szEntry,NULL,&dwType,(LPBYTE)lpTxt,&dwSizeBuf); - *(lpTxt+dwSizeBuf)='\0'; - if (*lpTxt == '\0') - break; - SetMenuItem(lpMruMenu,i,lpTxt); - } + { + char szEntry[16]; + DWORD dwSizeBuf; + wsprintf(szEntry,"File%lu",(DWORD)i+1); + *lpTxt = '\0'; + dwSizeBuf = lpMruMenu->wMaxSizeLruItem + 10; + RegQueryValueEx(hCurKey,szEntry,NULL,&dwType,(LPBYTE)lpTxt,&dwSizeBuf); + *(lpTxt+dwSizeBuf)='\0'; + if (*lpTxt == '\0') + break; + SetMenuItem(lpMruMenu,i,lpTxt); + } RegCloseKey(hCurKey); GlobalFreePtr(lpTxt); return TRUE; @@ -667,13 +667,13 @@ BOOL IsWin395OrHigher(void); WORD wVer; if ((GetVersion() & 0x80000000) == 0) - return WINNT; + return WINNT; wVer = LOWORD(GetVersion()); wVer = (((WORD)LOBYTE(wVer)) << 8) | (WORD)HIBYTE(wVer); if (wVer >= 0x035F) - return WIN95ORGREATHER; + return WIN95ORGREATHER; else - return WIN32S; + return WIN32S; } #endif diff --git a/neo/tools/radiant/MRU.H b/neo/tools/radiant/MRU.H index 3fb9a308..18c1ee16 100644 --- a/neo/tools/radiant/MRU.H +++ b/neo/tools/radiant/MRU.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,24 +52,24 @@ typedef MRUMENU FAR * LPMRUMENU; #ifdef __cplusplus LPMRUMENU CreateMruMenu (WORD wNbLruShowInit=NBMRUMENUSHOW, - WORD wNbLruMenuInit=NBMRUMENU, - WORD wMaxSizeLruItemInit=MAXSIZEMRUITEM, - WORD wIdMruInit=IDMRU); + WORD wNbLruMenuInit=NBMRUMENU, + WORD wMaxSizeLruItemInit=MAXSIZEMRUITEM, + WORD wIdMruInit=IDMRU); #else LPMRUMENU CreateMruMenu (WORD wNbLruShowInit, - WORD wNbLruMenuInit, - WORD wMaxSizeLruItemInit, - WORD wIdMruInit); + WORD wNbLruMenuInit, + WORD wMaxSizeLruItemInit, + WORD wIdMruInit); #endif LPMRUMENU CreateMruMenuDefault(); -void DeleteMruMenu (LPMRUMENU lpMruMenu); +void DeleteMruMenu (LPMRUMENU lpMruMenu); void SetNbLruShow (LPMRUMENU lpMruMenu,WORD wNbLruShowInit); BOOL SetMenuItem (LPMRUMENU lpMruMenu,WORD wItem, - LPSTR lpItem); + LPSTR lpItem); BOOL GetMenuItem (LPMRUMENU lpMruMenu,WORD wItem, - BOOL fIDMBased,LPSTR lpItem,UINT uiSize); + BOOL fIDMBased,LPSTR lpItem,UINT uiSize); BOOL DelMenuItem (LPMRUMENU lpMruMenu,WORD wItem,BOOL fIDMBased); void AddNewItem (LPMRUMENU lpMruMenu,LPSTR lpItem); void PlaceMenuMRUItem(LPMRUMENU lpMruMenu,HMENU hMenu,UINT uiItem); @@ -80,7 +80,7 @@ BOOL LoadMruInIni (LPMRUMENU lpMruMenu,LPSTR lpszSection,LPSTR lpsz BOOL SaveMruInReg (LPMRUMENU lpMruMenu,LPSTR lpszKey); BOOL LoadMruInReg (LPMRUMENU lpMruMenu,LPSTR lpszKey); -typedef enum +typedef enum { WIN32S, WINNT, diff --git a/neo/tools/radiant/MainFrm.cpp b/neo/tools/radiant/MainFrm.cpp index 3a8a9f92..df956f7c 100644 --- a/neo/tools/radiant/MainFrm.cpp +++ b/neo/tools/radiant/MainFrm.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"). @@ -252,7 +252,7 @@ SCommandInfo g_Commands[] = { { "Selection_Connect", 'K', RAD_CONTROL, ID_SELECTION_CONNECT }, { "Selection_Ungroup", 'G', RAD_SHIFT, ID_SELECTION_UNGROUPENTITY }, { "Selection_CSGMerge", 'M', RAD_SHIFT, ID_SELECTION_CSGMERGE }, - + { "Selection_CenterOrigin", 'O', RAD_SHIFT, ID_SELECTION_CENTER_ORIGIN }, { "Selection_SelectCompleteEntity", 'E' , RAD_CONTROL|RAD_ALT|RAD_SHIFT , ID_SELECT_COMPLETE_ENTITY }, { "Selection_SelectAllOfType", 'A', RAD_SHIFT, ID_SELECT_ALL }, @@ -274,7 +274,7 @@ SCommandInfo g_Commands[] = { { "Render_Toggle", VK_F3, 0, ID_VIEW_RENDERMODE }, { "Find_Textures", 'F', RAD_SHIFT, ID_TEXTURE_REPLACEALL }, - { "Find_Entity", VK_F3, RAD_CONTROL, ID_MISC_FINDORREPLACEENTITY}, + { "Find_Entity", VK_F3, RAD_CONTROL, ID_MISC_FINDORREPLACEENTITY}, { "Find_NextEntity", VK_F3,RAD_SHIFT, ID_MISC_FINDNEXTENT}, { "_ShowDOOM", VK_F2, 0, ID_SHOW_DOOM }, @@ -679,7 +679,7 @@ BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) ON_COMMAND(ID_SOUND_SHOWSOUNDVOLUMES, OnSoundShowsoundvolumes) ON_COMMAND(ID_SOUND_SHOWSELECTEDSOUNDVOLUMES, OnSoundShowselectedsoundvolumes) ON_COMMAND(ID_PATCH_NURBEDITOR, OnNurbEditor) - ON_COMMAND(ID_SELECT_COMPLETE_ENTITY, OnSelectCompleteEntity) + ON_COMMAND(ID_SELECT_COMPLETE_ENTITY, OnSelectCompleteEntity) ON_COMMAND(ID_PRECISION_CURSOR_CYCLE , OnPrecisionCursorCycle) ON_COMMAND(ID_MATERIALS_GENERATEMATERIALSLIST,OnGenerateMaterialsList) ON_COMMAND(ID_SELECTION_VIEW_WIREFRAMEON, OnSelectionWireFrameOn) @@ -693,7 +693,7 @@ BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) ON_COMMAND_RANGE(ID_VIEW_NEAREST, ID_TEXTURES_FLATSHADE, OnViewNearest) ON_COMMAND_RANGE(ID_GRID_POINT0625, ID_GRID_64, OnGrid1) #if _MSC_VER < 1300 - ON_REGISTERED_MESSAGE(g_msgBSPDone, OnBSPDone) + ON_REGISTERED_MESSAGE(g_msgBSPDone, OnBSPDone) ON_REGISTERED_MESSAGE(g_msgBSPStatus, OnBSPStatus) ON_MESSAGE(WM_DISPLAYCHANGE, OnDisplayChange) #endif @@ -738,7 +738,7 @@ void CMainFrame::OnBSPStatus(UINT wParam, long lParam) { void CMainFrame::OnBSPDone(UINT wParam, long lParam) { idStr str = cvarSystem->GetCVarString( "radiant_bspdone" ); if (str.Length()) { - sndPlaySound(str.c_str(), SND_FILENAME | SND_ASYNC); + sndPlaySound(str.c_str(), SND_FILENAME | SND_ASYNC); } } @@ -1026,7 +1026,7 @@ void MFCCreate( HINSTANCE hInstance ) g_qeglobals.d_savedinfo.fGamma = 1.0; g_qeglobals.d_savedinfo.iTexMenu = ID_VIEW_BILINEARMIPMAP; g_qeglobals.d_savedinfo.m_nTextureTweak = 1.0; - + //g_qeglobals.d_savedinfo.exclude = INCLUDE_EASY | INCLUDE_NORMAL | INCLUDE_HARD | INCLUDE_DEATHMATCH; g_qeglobals.d_savedinfo.show_coordinates = true; g_qeglobals.d_savedinfo.show_names = false; @@ -1711,7 +1711,7 @@ BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext) { //stupid hack to get the window resize itself properly r.DeflateRect(0,0,0,1); - g_Inspectors->MoveWindow(r); + g_Inspectors->MoveWindow(r); r.InflateRect(0,0,0,1); g_Inspectors->MoveWindow(r); @@ -2069,7 +2069,7 @@ BOOL DoMru(HWND hWnd,WORD wId) AddNewItem(g_qeglobals.d_lpMruMenu,(LPSTR)szFileName); // Now perform opening this file !!! - Map_LoadFile (szFileName); + Map_LoadFile (szFileName); } else // Remove the file on MRU. @@ -2173,10 +2173,10 @@ void RunBsp (const char *command) { } else { idStr::snPrintf( sys, sizeof(sys), "%s %s +set r_fullscreen 0 +dmap editorOutput %s +quit", buff, paths.c_str(), in ); } - + ::GetStartupInfo (&startupinfo); if (!CreateProcess(NULL, sys, NULL, NULL, FALSE, 0, NULL, NULL, &startupinfo, &ProcessInformation)) { - common->Printf("Could not start bsp process %s %s/n", buff, sys); + common->Printf("Could not start bsp process %s %s/n", buff, sys); } g_pParentWnd->SetFocus(); @@ -2728,7 +2728,7 @@ LPCSTR String_ToLower(LPCSTR psString) bool FindNextBrush(brush_t* pPrevFoundBrush) // can be NULL for fresh search -{ +{ bool bFoundSomething = false; entity_t *pLastFoundEnt; brush_t *pLastFoundBrush; @@ -2756,15 +2756,15 @@ bool FindNextBrush(brush_t* pPrevFoundBrush) // can be NULL for fresh search } // now do the search proper... - // + // int iBrushesScanned = 0; int iBrushesSelected=0; int iEntsScanned = 0; - brush_t* pNextBrush; + brush_t* pNextBrush; for (brush_t* b = pStartBrush; b != &active_brushes ; b = pNextBrush) - { - // setup the ptr before going any further (because selecting a brush down below moves it to a + { + // setup the ptr before going any further (because selecting a brush down below moves it to a // different link list), but we need to ensure that the next brush has a different ent-owner than the current // one, or multi-brush ents will confuse the list process if they get selected (infinite loop badness)... // @@ -2781,7 +2781,7 @@ bool FindNextBrush(brush_t* pPrevFoundBrush) // can be NULL for fresh search // static int iDotBodge=0; if (!(++iDotBodge&15)) - common->Printf("."); // cut down on printing + common->Printf("."); // cut down on printing bool bMatch = false; entity_t* ent = b->owner; @@ -2789,8 +2789,8 @@ bool FindNextBrush(brush_t* pPrevFoundBrush) // can be NULL for fresh search if (ent && ent!= world_entity) // needed! { iEntsScanned++; - if (FilterBrush (b)) - continue; + if (FilterBrush (b)) + continue; // only check the find-key if there was one specified... // @@ -2857,7 +2857,7 @@ bool FindNextBrush(brush_t* pPrevFoundBrush) // can be NULL for fresh search iBrushesSelected++; g_bScreenUpdates = false; // !!!!!!!!!!!!!!!!!!!!!!!!!!!! - + Select_Brush(b); g_bScreenUpdates = true; // !!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -2919,7 +2919,7 @@ void CMainFrame::OnMiscFindOrReplaceEntity() switch (FindReplace.DoModal()) { case ID_RET_REPLACE: - { + { brush_t* next = NULL; int iOccurences = 0; for (brush_t* b = active_brushes.next ; b != &active_brushes ; b = next) @@ -2929,8 +2929,8 @@ void CMainFrame::OnMiscFindOrReplaceEntity() if (ent) // needed! { - if (FilterBrush (b)) - continue; + if (FilterBrush (b)) + continue; const char *psEntFoundValue = ValueForKey(ent, strFindKey); @@ -3163,7 +3163,7 @@ void CMainFrame::OnBrushFlipx() { Brush_Build(b); } } - Patch_ToggleInverted(); + Patch_ToggleInverted(); Undo_EndBrushList(&selected_brushes); Undo_End(); } @@ -3207,7 +3207,7 @@ void CMainFrame::OnBrushFlipy() { Brush_Build(b); } } - Patch_ToggleInverted(); + Patch_ToggleInverted(); Undo_EndBrushList(&selected_brushes); Undo_End(); } @@ -3527,7 +3527,7 @@ void CMainFrame::OnSelectionUngroupentity() { void CMainFrame::OnAutocaulk() { - Select_AutoCaulk(); + Select_AutoCaulk(); } void CMainFrame::OnUpdateAutocaulk(CCmdUI* pCmdUI) { @@ -3573,7 +3573,7 @@ void CMainFrame::OnViewChange() { */ void CMainFrame::OnViewCameraupdate() { g_qeglobals.flatRotation++; - + if (g_qeglobals.flatRotation > 2) { g_qeglobals.flatRotation = 0; } @@ -4317,7 +4317,7 @@ void CMainFrame::OnColorSetMax() { g_qeglobals.d_savedinfo.colors[COLOR_GRIDMAJOR][i] = 0.89f; g_qeglobals.d_savedinfo.colors[COLOR_CAMERABACK][i] = 0.25f; } - + g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][0] = 1.0f; g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][1] = 1.0f; g_qeglobals.d_savedinfo.colors[COLOR_GRIDBLOCK][2] = 1.0f; @@ -4344,9 +4344,9 @@ void CMainFrame::OnColorSetMax() { g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][0] = 1.0f; g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][1] = 0.0f; g_qeglobals.d_savedinfo.colors[COLOR_PRECISION_CROSSHAIR][2] = 1.0f; - + Sys_UpdateWindows (W_ALL); - + } /* @@ -5681,7 +5681,7 @@ void CMainFrame::OnPatchTab() { Select_Brush(b2, false); Sys_UpdateWindows(W_ALL); } - } + } } } @@ -6481,13 +6481,13 @@ void CMainFrame::OnSelectionMoveonly() { m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SELECTION_MOVEONLY, (g_moveOnly) ? TRUE : FALSE); } -void CMainFrame::OnSelectBrushlight() +void CMainFrame::OnSelectBrushlight() { // TODO: Add your command handler code here - + } -void CMainFrame::OnSelectionCombine() +void CMainFrame::OnSelectionCombine() { if (g_qeglobals.d_select_count < 2) { Sys_Status("Must have at least two things selected.", 0); @@ -6507,7 +6507,7 @@ void CMainFrame::OnSelectionCombine() idMat3 mat; idVec3 v; if (e1->eclass->nShowFlags & ECLASS_LIGHT) { - // copy the lights origin and rotation matrix to + // copy the lights origin and rotation matrix to // light_origin and light_rotation e1->trackLightOrigin = true; e1->brushes.onext->trackLightOrigin = true; @@ -6575,7 +6575,7 @@ void CMainFrame::OnPatchCombine() { } } -void CMainFrame::OnShowDoom() +void CMainFrame::OnShowDoom() { int show = ::IsWindowVisible(win32.hWnd) ? SW_HIDE : SW_NORMAL; if (show == SW_NORMAL) { @@ -6584,14 +6584,14 @@ void CMainFrame::OnShowDoom() ::ShowWindow(win32.hWnd, show); } -void CMainFrame::OnViewRendermode() +void CMainFrame::OnViewRendermode() { m_pCamWnd->ToggleRenderMode(); CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_RENDERMODE, MF_BYCOMMAND | (m_pCamWnd->GetRenderMode()) ? MF_CHECKED : MF_UNCHECKED); Sys_UpdateWindows(W_ALL); } -void CMainFrame::OnViewRebuildrenderdata() +void CMainFrame::OnViewRebuildrenderdata() { m_pCamWnd->BuildRendererState(); if (!m_pCamWnd->GetRenderMode()) { @@ -6600,21 +6600,21 @@ void CMainFrame::OnViewRebuildrenderdata() Sys_UpdateWindows(W_ALL); } -void CMainFrame::OnViewRealtimerebuild() +void CMainFrame::OnViewRealtimerebuild() { m_pCamWnd->ToggleRebuildMode(); CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_REALTIMEREBUILD, MF_BYCOMMAND | (m_pCamWnd->GetRebuildMode()) ? MF_CHECKED : MF_UNCHECKED); Sys_UpdateWindows(W_ALL); } -void CMainFrame::OnViewRenderentityoutlines() +void CMainFrame::OnViewRenderentityoutlines() { m_pCamWnd->ToggleEntityMode(); CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_RENDERENTITYOUTLINES, MF_BYCOMMAND | (m_pCamWnd->GetEntityMode()) ? MF_CHECKED : MF_UNCHECKED); Sys_UpdateWindows(W_ALL); } -void CMainFrame::OnViewMaterialanimation() +void CMainFrame::OnViewMaterialanimation() { m_pCamWnd->ToggleAnimationMode(); CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_MATERIALANIMATION, MF_BYCOMMAND | (m_pCamWnd->GetAnimationMode()) ? MF_CHECKED : MF_UNCHECKED); @@ -6625,7 +6625,7 @@ extern void Face_SetAxialScale_BrushPrimit(face_t *face, bool y); void CMainFrame::OnAxialTextureByWidth() { // temp test code int faceCount = g_ptrSelectedFaces.GetSize(); - + if (faceCount > 0) { for (int i = 0; i < faceCount; i++) { face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(i)); @@ -6639,7 +6639,7 @@ void CMainFrame::OnAxialTextureByWidth() { void CMainFrame::OnAxialTextureByHeight() { // temp test code int faceCount = g_ptrSelectedFaces.GetSize(); - + if (faceCount > 0) { for (int i = 0; i < faceCount; i++) { face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(i)); @@ -6663,7 +6663,7 @@ void CMainFrame::OnAxialTextureArbitrary() { } extern void Select_ToOBJ(); -void CMainFrame::OnSelectionExportToobj() +void CMainFrame::OnSelectionExportToobj() { Select_ToOBJ(); } @@ -6691,20 +6691,20 @@ void CMainFrame::OnSelectionVisibleOff() { } -void CMainFrame::OnViewRenderselection() +void CMainFrame::OnViewRenderselection() { m_pCamWnd->ToggleSelectMode(); CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_RENDERSELECTION, MF_BYCOMMAND | (m_pCamWnd->GetSelectMode()) ? MF_CHECKED : MF_UNCHECKED); Sys_UpdateWindows(W_CAMERA); } -void CMainFrame::OnSelectNomodels() +void CMainFrame::OnSelectNomodels() { g_PrefsDlg.m_selectNoModels ^= 1; m_wndToolBar.GetToolBarCtrl().CheckButton(ID_SELECT_NOMODELS, (g_PrefsDlg.m_selectNoModels) ? TRUE : FALSE); } -void CMainFrame::OnViewShowShowvisportals() +void CMainFrame::OnViewShowShowvisportals() { if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_VISPORTALS) & EXCLUDE_VISPORTALS) { CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOW_SHOWVISPORTALS, MF_BYCOMMAND | MF_UNCHECKED); @@ -6716,7 +6716,7 @@ void CMainFrame::OnViewShowShowvisportals() Sys_UpdateWindows(W_XY | W_CAMERA); } -void CMainFrame::OnViewShowNoDraw() +void CMainFrame::OnViewShowNoDraw() { if ((g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_NODRAW) & EXCLUDE_NODRAW) { CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_SHOW_NODRAW, MF_BYCOMMAND | MF_UNCHECKED); @@ -6730,7 +6730,7 @@ void CMainFrame::OnViewShowNoDraw() -void CMainFrame::OnViewRendersound() +void CMainFrame::OnViewRendersound() { m_pCamWnd->ToggleSoundMode(); CheckMenuItem(::GetMenu(GetSafeHwnd()), ID_VIEW_RENDERSOUND, MF_BYCOMMAND | (m_pCamWnd->GetSoundMode()) ? MF_CHECKED : MF_UNCHECKED); @@ -6738,7 +6738,7 @@ void CMainFrame::OnViewRendersound() } -void CMainFrame::OnSoundShowsoundvolumes() +void CMainFrame::OnSoundShowsoundvolumes() { g_qeglobals.d_savedinfo.showSoundAlways ^= 1; if (g_qeglobals.d_savedinfo.showSoundAlways) { @@ -6760,7 +6760,7 @@ void CMainFrame::OnNurbEditor() { temp += "\r\n"; if (OpenClipboard()) { ::EmptyClipboard(); - HGLOBAL clip; + HGLOBAL clip; char* buff; clip = ::GlobalAlloc(GMEM_DDESHARE, temp.Length()+1); buff = (char*)::GlobalLock(clip); @@ -6774,7 +6774,7 @@ void CMainFrame::OnNurbEditor() { } -void CMainFrame::OnSoundShowselectedsoundvolumes() +void CMainFrame::OnSoundShowselectedsoundvolumes() { g_qeglobals.d_savedinfo.showSoundWhenSelected ^= 1; if (g_qeglobals.d_savedinfo.showSoundWhenSelected) { @@ -6793,26 +6793,26 @@ void CMainFrame::OnSelectAlltargets() void CMainFrame::OnSelectCompleteEntity() { - brush_t* b = NULL; - entity_t* e = NULL; + brush_t* b = NULL; + entity_t* e = NULL; - b = selected_brushes.next; - if ( b == &selected_brushes ) - { - return; //no brushes selected - } - - e = b->owner; - if ( b->owner == world_entity ) - { - return; //don't select the world entity - } + b = selected_brushes.next; + if ( b == &selected_brushes ) + { + return; //no brushes selected + } - for (b = e->brushes.onext; b != &e->brushes; b = b->onext) - { - Select_Brush ( b , false ); - } - Sys_UpdateWindows ( W_ALL ); + e = b->owner; + if ( b->owner == world_entity ) + { + return; //don't select the world entity + } + + for (b = e->brushes.onext; b != &e->brushes; b = b->onext) + { + Select_Brush ( b , false ); + } + Sys_UpdateWindows ( W_ALL ); } @@ -6820,7 +6820,7 @@ void CMainFrame::OnSelectCompleteEntity() //--------------------------------------------------------------------------- // OnPrecisionCursorCycle -// +// // Called when the user presses the "cycle precision cursor mode" key. // Cycles the precision cursor among the following three modes: // PRECISION_CURSOR_NONE @@ -6837,7 +6837,7 @@ void CMainFrame::OnGenerateMaterialsList() idStrList mtrList; idStr mtrName,mtrFileName; - + g_Inspectors->consoleWnd.ExecuteCommand ( "clear" ); Sys_BeginWait (); common->Printf ( "Generating list of active materials...\n" ); @@ -6859,14 +6859,14 @@ void CMainFrame::OnGenerateMaterialsList() } } - } + } } mtrList.Sort(); for ( int i = 0 ; i < mtrList.Num() ; i++ ) { common->Printf ( "%s\n" , mtrList[i].c_str()); } - + mtrFileName = currentmap; // mtrFileName.ExtractFileName( mtrFileName ); mtrFileName = mtrFileName.StripPath(); diff --git a/neo/tools/radiant/MainFrm.h b/neo/tools/radiant/MainFrm.h index d94edd8f..d6ec9019 100644 --- a/neo/tools/radiant/MainFrm.h +++ b/neo/tools/radiant/MainFrm.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 @@ class CMainFrame : public CFrameWnd DECLARE_DYNAMIC(CMainFrame) public: CMainFrame(); - void HandleKey(UINT nChar, UINT nRepCnt, UINT nFlags, bool bDown = true) + void HandleKey(UINT nChar, UINT nRepCnt, UINT nFlags, bool bDown = true) { if (bDown) OnKeyDown(nChar, nRepCnt, nFlags); @@ -123,7 +123,7 @@ public: CCamWnd* GetCamera() {return m_pCamWnd;}; CZWnd* GetZWnd() {return m_pZWnd;}; - void SetActiveXY(CXYWnd* p) + void SetActiveXY(CXYWnd* p) { if (m_pActiveXY) m_pActiveXY->SetActive(false); diff --git a/neo/tools/radiant/MapInfo.cpp b/neo/tools/radiant/MapInfo.cpp index 98c24c99..d7a82ed1 100644 --- a/neo/tools/radiant/MapInfo.cpp +++ b/neo/tools/radiant/MapInfo.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 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMapInfo message handlers -BOOL CMapInfo::OnInitDialog() +BOOL CMapInfo::OnInitDialog() { CDialog::OnInitDialog(); @@ -83,9 +83,9 @@ BOOL CMapInfo::OnInitDialog() m_nNet = 0; for (brush_t* pBrush=active_brushes.next ; pBrush != &active_brushes ; pBrush=pBrush->next) { - m_nTotalBrushes++; - if (pBrush->owner == world_entity) - m_nNet++; + m_nTotalBrushes++; + if (pBrush->owner == world_entity) + m_nNet++; } @@ -94,11 +94,11 @@ BOOL CMapInfo::OnInitDialog() int nValue = 0; for (entity_t* pEntity=entities.next ; pEntity != &entities ; pEntity=pEntity->next) { - m_nTotalEntities++; - nValue = 0; - mapEntity.Lookup(pEntity->eclass->name, reinterpret_cast(nValue)); - nValue++ ; - mapEntity.SetAt(pEntity->eclass->name, reinterpret_cast(nValue)); + m_nTotalEntities++; + nValue = 0; + mapEntity.Lookup(pEntity->eclass->name, reinterpret_cast(nValue)); + nValue++ ; + mapEntity.SetAt(pEntity->eclass->name, reinterpret_cast(nValue)); } m_lstEntity.ResetContent(); @@ -107,14 +107,14 @@ BOOL CMapInfo::OnInitDialog() POSITION pos = mapEntity.GetStartPosition(); while (pos) { - mapEntity.GetNextAssoc(pos, strKey, reinterpret_cast(nValue)); - CString strList; - strList.Format("%s\t%i", strKey, nValue); - m_lstEntity.AddString(strList); + mapEntity.GetNextAssoc(pos, strKey, reinterpret_cast(nValue)); + CString strList; + strList.Format("%s\t%i", strKey, nValue); + m_lstEntity.AddString(strList); } UpdateData(FALSE); - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } diff --git a/neo/tools/radiant/MapInfo.h b/neo/tools/radiant/MapInfo.h index 2a6ff6ee..e3fd50c1 100644 --- a/neo/tools/radiant/MapInfo.h +++ b/neo/tools/radiant/MapInfo.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/neo/tools/radiant/MediaPreviewDlg.cpp b/neo/tools/radiant/MediaPreviewDlg.cpp index ea99022c..6210988e 100644 --- a/neo/tools/radiant/MediaPreviewDlg.cpp +++ b/neo/tools/radiant/MediaPreviewDlg.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 @@ BOOL CMediaPreviewDlg::OnInitDialog() GetClientRect(rct); int h = (mode == GUIS) ? (rct.Width() - 8) / 1.333333f : rct.Height() - 8; wndPreview.SetWindowPos(NULL, 4, 4, rct.Width() - 8, h, SWP_SHOWWINDOW); - + return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } diff --git a/neo/tools/radiant/MediaPreviewDlg.h b/neo/tools/radiant/MediaPreviewDlg.h index 7c3c0017..768afae6 100644 --- a/neo/tools/radiant/MediaPreviewDlg.h +++ b/neo/tools/radiant/MediaPreviewDlg.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/neo/tools/radiant/NewProjDlg.cpp b/neo/tools/radiant/NewProjDlg.cpp index df038b5e..373d2234 100644 --- a/neo/tools/radiant/NewProjDlg.cpp +++ b/neo/tools/radiant/NewProjDlg.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/neo/tools/radiant/NewProjDlg.h b/neo/tools/radiant/NewProjDlg.h index df639de9..4db6a7e7 100644 --- a/neo/tools/radiant/NewProjDlg.h +++ b/neo/tools/radiant/NewProjDlg.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/neo/tools/radiant/NewTexWnd.cpp b/neo/tools/radiant/NewTexWnd.cpp index 8bbb8c40..8388f155 100644 --- a/neo/tools/radiant/NewTexWnd.cpp +++ b/neo/tools/radiant/NewTexWnd.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"). @@ -353,7 +353,7 @@ void CNewTexWnd::OnPaint() { } qglCallLists(strlen(name), GL_UNSIGNED_BYTE, name); //qglCallLists(va("%s -- %d, %d" strlen(name), GL_UNSIGNED_BYTE, name); - } + } } g_qeglobals.d_texturewin.m_nTotalHeight = abs(draw.y) + 100; @@ -430,7 +430,7 @@ BOOL CNewTexWnd::DestroyWindow() { /* ======================================================================================================================= ======================================================================================================================= - */ + */ BOOL CNewTexWnd::Create ( LPCTSTR lpszClassName, @@ -473,7 +473,7 @@ const idMaterial *CNewTexWnd::getMaterialAtPoint(CPoint point) { if (point.x > draw.x && point.x - draw.x < width && my < draw.y && draw.y - my < height + FONT_HEIGHT) { return mat; } - + } } @@ -623,7 +623,7 @@ void CNewTexWnd::LoadMaterials() { void Texture_SetTexture(texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, bool bSetSelection) { - + if (texdef->name[0] == '(') { Sys_Status("Can't select an entity texture\n", 0); return; @@ -640,7 +640,7 @@ void Texture_SetTexture(texdef_t *texdef, brushprimit_texdef_t *brushprimit_texd } g_dlgFind.updateTextures(texdef->name); - + if (!g_dlgFind.isOpen() && bSetSelection) { Select_SetTexture(texdef, brushprimit_texdef, bFitScale); } @@ -745,7 +745,7 @@ bool texture_showinuse = true; /* ======================================================================================================================= - Texture_SetMode + Texture_SetMode ======================================================================================================================= */ void Texture_SetMode(int iMenu) { @@ -869,13 +869,13 @@ BOOL CNewTexWnd::OnToolTipNotify( UINT id, NMHDR * pNMHDR, LRESULT * pResult ) { const idMaterial *mat = getMaterialAtPoint(point); if (mat) { - TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR; + TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR; strcpy(tip, mat->GetDescription()); - pTTT->lpszText = tip; - pTTT->hinst = NULL; - return(TRUE); - } - return(FALSE); + pTTT->lpszText = tip; + pTTT->hinst = NULL; + return(TRUE); + } + return(FALSE); } int CNewTexWnd::OnToolHitTest(CPoint point, TOOLINFO * pTI) @@ -887,7 +887,7 @@ int CNewTexWnd::OnToolHitTest(CPoint point, TOOLINFO * pTI) return -1; } -BOOL CNewTexWnd::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) +BOOL CNewTexWnd::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) { OnVScroll((zDelta >= 0) ? SB_LINEUP : SB_LINEDOWN, 0, NULL); OnVScroll((zDelta >= 0) ? SB_LINEUP : SB_LINEDOWN, 0, NULL); diff --git a/neo/tools/radiant/NewTexWnd.h b/neo/tools/radiant/NewTexWnd.h index 39972e96..b0561412 100644 --- a/neo/tools/radiant/NewTexWnd.h +++ b/neo/tools/radiant/NewTexWnd.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/neo/tools/radiant/PARSE.CPP b/neo/tools/radiant/PARSE.CPP index 7695adfc..7e84183f 100644 --- a/neo/tools/radiant/PARSE.CPP +++ b/neo/tools/radiant/PARSE.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"). @@ -95,8 +95,8 @@ skipspace: if (*script_p == '"') { script_p++; - //if (*script_p == '"') // handle double quotes i suspect they are put in by other editors cccasionally - // script_p++; + //if (*script_p == '"') // handle double quotes i suspect they are put in by other editors cccasionally + // script_p++; while ( *script_p != '"' ) { if (!*script_p) @@ -106,8 +106,8 @@ skipspace: Error ("Token too large on line %i",scriptline); } script_p++; - //if (*script_p == '"') // handle double quotes i suspect they are put in by other editors cccasionally - // script_p++; + //if (*script_p == '"') // handle double quotes i suspect they are put in by other editors cccasionally + // script_p++; } else while ( *script_p > 32 ) { @@ -117,7 +117,7 @@ skipspace: } *token_p = 0; - + return true; } @@ -154,4 +154,3 @@ bool TokenAvailable (void) return true; } - diff --git a/neo/tools/radiant/PARSE.H b/neo/tools/radiant/PARSE.H index 287e168d..bd43e5bc 100644 --- a/neo/tools/radiant/PARSE.H +++ b/neo/tools/radiant/PARSE.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"). @@ -36,4 +36,3 @@ void StartTokenParsing (const char *data); bool WINAPI GetToken (bool crossline); void WINAPI UngetToken (void); bool TokenAvailable (void); - diff --git a/neo/tools/radiant/PMESH.CPP b/neo/tools/radiant/PMESH.CPP index 56bf7798..c774c067 100644 --- a/neo/tools/radiant/PMESH.CPP +++ b/neo/tools/radiant/PMESH.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"). @@ -191,7 +191,7 @@ void Patch_Combine( patchMesh_t *p,patchMesh_t *p2,int sourceCol1,int sourceCol2 if ( sourceCol1 != 0 ) { adj1 = -1; col1 = p->width - 1; - } + } if ( sourceCol2 != 0 ) { adj2 = -1; col2 = p2->width - 2; @@ -225,7 +225,7 @@ void Patch_Combine( patchMesh_t *p,patchMesh_t *p2,int sourceCol1,int sourceCol2 if ( sourceCol1 != 0 ) { adj1 = -1; col1 = p->width - 1; - } + } if ( sourceRow2 != 0 ) { adj2 = -1; row2 = p2->height - 2; @@ -262,7 +262,7 @@ void Patch_Combine( patchMesh_t *p,patchMesh_t *p2,int sourceCol1,int sourceCol2 if ( sourceRow1 != 0 ) { adj1 = -1; row1 = p->height - 1; - } + } if ( sourceRow2 != 0 ) { adj2 = -1; row2 = p2->height - 2; @@ -296,7 +296,7 @@ void Patch_Combine( patchMesh_t *p,patchMesh_t *p2,int sourceCol1,int sourceCol2 if ( sourceRow1 != 0 ) { adj1 = -1; row1 = p->height - 1; - } + } if ( sourceCol2 != 0 ) { adj2 = -1; col2 = p2->width - 2; @@ -335,7 +335,7 @@ void Patch_Combine( patchMesh_t *p,patchMesh_t *p2,int sourceCol1,int sourceCol2 void Patch_Weld( patchMesh_t *p,patchMesh_t *p2 ) { // check against all 4 edges of p2 // could roll this up but left it out for some semblence of clarity - // + // if ( p->width == p2->width ) { int row = 0; @@ -565,9 +565,9 @@ void Patch_Weld( patchMesh_t *p,patchMesh_t *p2 ) { // used for a save spot patchMesh_t *patchSave = NULL; -// Tracks the selected patch for point manipulation/update. FIXME: Need to revert back to a generalized +// Tracks the selected patch for point manipulation/update. FIXME: Need to revert back to a generalized // brush approach -//--int g_nSelectedPatch = -1; +//--int g_nSelectedPatch = -1; // HACK: for tracking which view generated the click // as we dont want to deselect a point on a same point @@ -815,7 +815,7 @@ Brush_RebuildBrush */ void Brush_RebuildBrush( brush_t *b,idVec3 vMins,idVec3 vMaxs,bool patch ) { // - // Total hack job + // Total hack job // Rebuilds a brush int i, j; face_t *f, *next; @@ -1242,7 +1242,7 @@ brush_t * Cap( patchMesh_t *pParent,bool bByColumn,bool bFirst ) { vMax[0] = vMax[1] = vMax[2] = -99999; // we seam the column edge, FIXME: this might need to be able to seem either edge - // + // int nSize = (bByColumn) ? pParent->width : pParent->height; int nIndex = (bFirst) ? 0 : (bByColumn) ? pParent->height - 1 : pParent->width - 1; @@ -1447,7 +1447,7 @@ void Patch_CapCurrent( bool bInvertedBevel,bool bInvertedEndcap ) { pParent = pb->pPatch; // decide which if any ends we are going to cap // if any of these compares hit, it is a closed patch and as such - // the generic capping will work.. if we do not find a closed edge + // the generic capping will work.. if we do not find a closed edge // then we need to ask which kind of cap to add if ( pParent->ctrl(0, 0).xyz.Compare(pParent->ctrl(pParent->width - 1, 0).xyz) ) { pCap = Cap(pParent, true, false); @@ -1847,8 +1847,8 @@ void Patch_BrushToMesh( bool bCone,bool bBevel,bool bEndcap,bool bSquare,int nHe if ( bCone ) { p->type = PATCH_CONE; - float xc = (b->maxs[0] + b->mins[0]) * 0.5; - float yc = (b->maxs[1] + b->mins[1]) * 0.5; + float xc = (b->maxs[0] + b->mins[0]) * 0.5; + float yc = (b->maxs[1] + b->mins[1]) * 0.5; for ( i = 0 ; i < p->width ; i ++ ) { p->ctrl(i, 2).xyz[0] = xc; @@ -2688,7 +2688,7 @@ Patch_Select ================== */ void Patch_Select( patchMesh_t *p ) { - // maintained for point manip.. which i need to fix as this + // maintained for point manip.. which i need to fix as this // is pf error prone //--g_nSelectedPatch = n; p->bSelected = true; @@ -2743,7 +2743,7 @@ void Patch_Scale( patchMesh_t *p,const idVec3 vOrigin,const idVec3 vAmt,bool bRe p->ctrl(w, h).xyz[i] += vOrigin[i]; } } - } + } if ( bRebuild ) { idVec3 vMin, vMax; Patch_CalcBounds(p, vMin, vMax); @@ -3027,10 +3027,10 @@ void Patch_DisperseRows() { patchMesh_t *p = pb->pPatch; Patch_Rebuild(p); for ( w = 0; w < p->width; w++ ) { - // for each row, we need to evenly disperse p->height number + // for each row, we need to evenly disperse p->height number // of points across the old bounds - // calc total distance to interpolate + // calc total distance to interpolate VectorSubtract(p->ctrl(w, p->height - 1).xyz, p->ctrl(w, 0).xyz, vTemp); //vTemp[0] = vTemp[1] = vTemp[2] = 0; @@ -3070,10 +3070,10 @@ void Patch_DisperseColumns() { Patch_Rebuild(p); for ( h = 0; h < p->height; h++ ) { - // for each column, we need to evenly disperse p->width number + // for each column, we need to evenly disperse p->width number // of points across the old bounds - // calc total distance to interpolate + // calc total distance to interpolate VectorSubtract(p->ctrl(p->width - 1, h).xyz, p->ctrl(0, h).xyz, vTemp); // amount per cycle @@ -3171,7 +3171,7 @@ brush_t * Patch_Parse( bool bOld ) { // texture def GetToken(true); - // band-aid + // band-aid if ( strcmp(token, "(") ) { if ( g_qeglobals.mapVersion < 2.0f ) { tex = Texture_ForName(va("textures/%s", token)); @@ -3181,7 +3181,7 @@ brush_t * Patch_Parse( bool bOld ) { GetToken(true); } else { common->Printf("Warning: Patch read with no texture, using notexture... \n"); - } + } if ( strcmp(token, "(") ) { return NULL; @@ -3234,10 +3234,10 @@ brush_t * Patch_Parse( bool bOld ) { for ( w = 0; w < pm->width; w++ ) { for ( h = 0; h < pm->height; h++ ) { - pm->ctrl(w, h).xyz[0] = ctrl[w][h][0]; - pm->ctrl(w, h).xyz[1] = ctrl[w][h][1]; - pm->ctrl(w, h).xyz[2] = ctrl[w][h][2]; - pm->ctrl(w, h).st[0] = ctrl[w][h][3]; + pm->ctrl(w, h).xyz[0] = ctrl[w][h][0]; + pm->ctrl(w, h).xyz[1] = ctrl[w][h][1]; + pm->ctrl(w, h).xyz[2] = ctrl[w][h][2]; + pm->ctrl(w, h).st[0] = ctrl[w][h][3]; pm->ctrl(w, h).st[1] = ctrl[w][h][4]; } } @@ -3264,7 +3264,7 @@ brush_t * Patch_Parse( bool bOld ) { /* ================== -Patch_Write +Patch_Write ================== */ void Patch_Write( patchMesh_t *p,CMemFile *file ) { @@ -3514,7 +3514,7 @@ void Patch_InvertTexture( bool bY ) { ================== Patch_Save ================== - Saves patch ctrl info (originally to deal with a + Saves patch ctrl info (originally to deal with a cancel in the surface dialog */ void Patch_Save( patchMesh_t *p ) { @@ -3729,7 +3729,7 @@ void Patch_BendHandleENTER() { } else if ( g_nPatchBendState == BEND_SELECT_EDGE ) { g_bPatchLowerEdge = true; } else if ( g_nPatchBendState == BEND_BENDIT ) { - // basically we go into rotation mode, set the axis to the center of the + // basically we go into rotation mode, set the axis to the center of the } } else { // done @@ -4077,7 +4077,7 @@ void Patch_Thicken( int nAmount,bool bSeam ) { if ( bSeam ) { // FIXME: this should detect if any edges of the patch are closed and act appropriately - // + // if ( !(p->type & PATCH_CYLINDER) ) { b = Patch_GenericMesh(3, p->height, 2, false, true, p); pSeam = b->pPatch; @@ -4404,7 +4404,7 @@ void Patch_SetEpair( patchMesh_t *p,const char *pKey,const char *pValue ) { } } -/* +/* ================= Patch_GetKeyValue ================= @@ -4456,6 +4456,3 @@ g:\quake3\baseq3\textures\common Feature Addition: View/Hide Hint Brushes -- This should be a specific case. */ - - - diff --git a/neo/tools/radiant/PMESH.H b/neo/tools/radiant/PMESH.H index a378f4ae..f9716f7e 100644 --- a/neo/tools/radiant/PMESH.H +++ b/neo/tools/radiant/PMESH.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"). @@ -31,7 +31,7 @@ patchMesh_t* MakeNewPatch(int width, int height); brush_t* AddBrushForPatch(patchMesh_t *pm, bool bLinkToWorld = true); brush_t* Patch_GenericMesh(int nWidth, int nHeight, int nOrientation = 2, bool bDeleteSource = true, bool bOverride = false, patchMesh_t *parent = NULL); void Patch_ReadFile (char *name); -void Patch_WriteFile (char *name); +void Patch_WriteFile (char *name); void Patch_BuildPoints (brush_t *b); void Patch_Move(patchMesh_t *p, const idVec3 vMove, bool bRebuild = false); //++timo had to add a default value for bSnap (see Patch_ApplyMatrix call from Select_ApplyMatrix in select.cpp) diff --git a/neo/tools/radiant/PatchDensityDlg.cpp b/neo/tools/radiant/PatchDensityDlg.cpp index dca9d95e..bedf007f 100644 --- a/neo/tools/radiant/PatchDensityDlg.cpp +++ b/neo/tools/radiant/PatchDensityDlg.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"). @@ -71,7 +71,7 @@ END_MESSAGE_MAP() int g_nXLat[] = {3,5,7,9,11,13,15}; -void CPatchDensityDlg::OnOK() +void CPatchDensityDlg::OnOK() { int nWidth = m_wndWidth.GetCurSel(); int nHeight = m_wndHeight.GetCurSel(); @@ -79,18 +79,18 @@ void CPatchDensityDlg::OnOK() if (nWidth >= 0 && nWidth <= 6 && nHeight >= 0 && nHeight <= 6) { Patch_GenericMesh(g_nXLat[nWidth], g_nXLat[nHeight], g_pParentWnd->ActiveXY()->GetViewType()); - Sys_UpdateWindows(W_ALL); + Sys_UpdateWindows(W_ALL); } CDialog::OnOK(); } -BOOL CPatchDensityDlg::OnInitDialog() +BOOL CPatchDensityDlg::OnInitDialog() { CDialog::OnInitDialog(); m_wndWidth.SetCurSel(0); m_wndHeight.SetCurSel(0); return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } diff --git a/neo/tools/radiant/PatchDensityDlg.h b/neo/tools/radiant/PatchDensityDlg.h index 13827a38..81d42c7c 100644 --- a/neo/tools/radiant/PatchDensityDlg.h +++ b/neo/tools/radiant/PatchDensityDlg.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/neo/tools/radiant/PatchDialog.cpp b/neo/tools/radiant/PatchDialog.cpp index e9f7584c..b2f3ef4e 100644 --- a/neo/tools/radiant/PatchDialog.cpp +++ b/neo/tools/radiant/PatchDialog.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"). @@ -113,25 +113,25 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CPatchDialog message handlers -void CPatchDialog::OnBtnPatchdetails() +void CPatchDialog::OnBtnPatchdetails() { Patch_NaturalizeSelected(true); Sys_UpdateWindows(W_ALL); } -void CPatchDialog::OnBtnPatchfit() +void CPatchDialog::OnBtnPatchfit() { Patch_FitTexturing(); Sys_UpdateWindows(W_ALL); } -void CPatchDialog::OnBtnPatchnatural() +void CPatchDialog::OnBtnPatchnatural() { Patch_NaturalizeSelected(); Sys_UpdateWindows(W_ALL); } -void CPatchDialog::OnBtnPatchreset() +void CPatchDialog::OnBtnPatchreset() { //CTextureLayout dlg; //if (dlg.DoModal() == IDOK) @@ -141,40 +141,40 @@ void CPatchDialog::OnBtnPatchreset() //Sys_UpdateWindows(W_ALL); } -void CPatchDialog::OnSelchangeComboCol() +void CPatchDialog::OnSelchangeComboCol() { UpdateRowColInfo(); } -void CPatchDialog::OnSelchangeComboRow() +void CPatchDialog::OnSelchangeComboRow() { UpdateRowColInfo(); } -void CPatchDialog::OnSelchangeComboType() +void CPatchDialog::OnSelchangeComboType() { // TODO: Add your control notification handler code here - + } -void CPatchDialog::OnOK() +void CPatchDialog::OnOK() { m_Patch = NULL; - + CDialog::OnOK(); } -void CPatchDialog::OnDeltaposSpin(NMHDR* pNMHDR, LRESULT* pResult) +void CPatchDialog::OnDeltaposSpin(NMHDR* pNMHDR, LRESULT* pResult) { NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; UpdateSpinners((pNMUpDown->iDelta > 0), pNMUpDown->hdr.idFrom); *pResult = 0; } -BOOL CPatchDialog::OnInitDialog() +BOOL CPatchDialog::OnInitDialog() { CDialog::OnInitDialog(); - + m_wndHScale.SetRange(0, 1000); m_wndVScale.SetRange(0, 1000); m_wndHShift.SetRange(0, 1000); @@ -184,9 +184,9 @@ BOOL CPatchDialog::OnInitDialog() GetPatchInfo(); // TODO: Add extra initialization here - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } @@ -196,22 +196,22 @@ void CPatchDialog::GetPatchInfo() m_Patch = SinglePatchSelected(); if (m_Patch != NULL) { - CString str; - int i; - m_wndRows.ResetContent(); - for (i = 0; i < m_Patch->height; i++) - { - str.Format("%i", i); - m_wndRows.AddString(str); - } - m_wndRows.SetCurSel(0); - m_wndCols.ResetContent(); - for (i = 0; i < m_Patch->width; i++) - { - str.Format("%i", i); - m_wndCols.AddString(str); - } - m_wndCols.SetCurSel(0); + CString str; + int i; + m_wndRows.ResetContent(); + for (i = 0; i < m_Patch->height; i++) + { + str.Format("%i", i); + m_wndRows.AddString(str); + } + m_wndRows.SetCurSel(0); + m_wndCols.ResetContent(); + for (i = 0; i < m_Patch->width; i++) + { + str.Format("%i", i); + m_wndCols.AddString(str); + } + m_wndCols.SetCurSel(0); } UpdateRowColInfo(); } @@ -225,13 +225,13 @@ void DoPatchInspector() { if (g_PatchDialog.GetSafeHwnd() == NULL) { - g_PatchDialog.Create(IDD_DIALOG_PATCH); - CRect rct; + g_PatchDialog.Create(IDD_DIALOG_PATCH); + CRect rct; LONG lSize = sizeof(rct); if (LoadRegistryInfo("Radiant::PatchWindow", &rct, &lSize)) - { - g_PatchDialog.SetWindowPos(NULL, rct.left, rct.top, 0,0, SWP_NOSIZE); - } + { + g_PatchDialog.SetWindowPos(NULL, rct.left, rct.top, 0,0, SWP_NOSIZE); + } } g_PatchDialog.ShowWindow(SW_SHOW); g_PatchDialog.GetPatchInfo(); @@ -241,17 +241,17 @@ void UpdatePatchInspector() { if (g_PatchDialog.GetSafeHwnd() != NULL) { - g_PatchDialog.UpdateInfo(); + g_PatchDialog.UpdateInfo(); } } -void CPatchDialog::OnDestroy() +void CPatchDialog::OnDestroy() { if (GetSafeHwnd()) { - CRect rct; - GetWindowRect(rct); + CRect rct; + GetWindowRect(rct); SaveRegistryInfo("Radiant::PatchWindow", &rct, sizeof(rct)); } CDialog::OnDestroy(); @@ -263,16 +263,16 @@ void CPatchDialog::UpdateRowColInfo() if (m_Patch != NULL) { - int r = m_wndRows.GetCurSel(); - int c = m_wndCols.GetCurSel(); - if (r >= 0 && r < m_Patch->height && c >= 0 && c < m_Patch->width) - { - m_fX = m_Patch->ctrl(c,r).xyz[0]; - m_fY = m_Patch->ctrl(c,r).xyz[1]; - m_fZ = m_Patch->ctrl(c,r).xyz[2]; - m_fS = m_Patch->ctrl(c,r).st[0]; - m_fT = m_Patch->ctrl(c,r).st[1]; - } + int r = m_wndRows.GetCurSel(); + int c = m_wndCols.GetCurSel(); + if (r >= 0 && r < m_Patch->height && c >= 0 && c < m_Patch->width) + { + m_fX = m_Patch->ctrl(c,r).xyz[0]; + m_fY = m_Patch->ctrl(c,r).xyz[1]; + m_fZ = m_Patch->ctrl(c,r).xyz[2]; + m_fS = m_Patch->ctrl(c,r).st[0]; + m_fT = m_Patch->ctrl(c,r).st[1]; + } } UpdateData(FALSE); } @@ -282,23 +282,23 @@ void CPatchDialog::UpdateInfo() GetPatchInfo(); } -void CPatchDialog::OnApply() +void CPatchDialog::OnApply() { UpdateData(TRUE); if (m_Patch != NULL) { - int r = m_wndRows.GetCurSel(); - int c = m_wndCols.GetCurSel(); - if (r >= 0 && r < m_Patch->height && c >= 0 && c < m_Patch->width) - { - m_Patch->ctrl(c,r).xyz[0] = m_fX; - m_Patch->ctrl(c,r).xyz[1] = m_fY; - m_Patch->ctrl(c,r).xyz[2] = m_fZ; - m_Patch->ctrl(c,r).st[0] = m_fS; - m_Patch->ctrl(c,r).st[1] = m_fT; + int r = m_wndRows.GetCurSel(); + int c = m_wndCols.GetCurSel(); + if (r >= 0 && r < m_Patch->height && c >= 0 && c < m_Patch->width) + { + m_Patch->ctrl(c,r).xyz[0] = m_fX; + m_Patch->ctrl(c,r).xyz[1] = m_fY; + m_Patch->ctrl(c,r).xyz[2] = m_fZ; + m_Patch->ctrl(c,r).st[0] = m_fS; + m_Patch->ctrl(c,r).st[1] = m_fT; Patch_MakeDirty(m_Patch); - Sys_UpdateWindows(W_ALL); - } + Sys_UpdateWindows(W_ALL); + } } } @@ -324,18 +324,18 @@ void CPatchDialog::UpdateSpinners(bool bUp, int nID) else if (nID == IDC_SPIN_HSCALE) { if (bUp) - td.scale[0] = 1 - m_fHScale; + td.scale[0] = 1 - m_fHScale; else td.scale[0] = 1 + m_fHScale; - } + } else if (nID == IDC_SPIN_VSCALE) { if (bUp) td.scale[1] = 1 - m_fVScale; else td.scale[1] = 1 + m_fVScale; - } - + } + else if (nID == IDC_SPIN_HSHIFT) { if (bUp) @@ -346,13 +346,11 @@ void CPatchDialog::UpdateSpinners(bool bUp, int nID) else if (nID == IDC_SPIN_VSHIFT) { if (bUp) - td.shift[1] = m_fVShift; + td.shift[1] = m_fVShift; else td.shift[1] = -m_fVShift; } - + Patch_SetTextureInfo(&td); Sys_UpdateWindows(W_CAMERA); } - - diff --git a/neo/tools/radiant/PatchDialog.h b/neo/tools/radiant/PatchDialog.h index f8c876df..b571e2d9 100644 --- a/neo/tools/radiant/PatchDialog.h +++ b/neo/tools/radiant/PatchDialog.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/neo/tools/radiant/PointFile.cpp b/neo/tools/radiant/PointFile.cpp index 788f7a29..81fced8b 100644 --- a/neo/tools/radiant/PointFile.cpp +++ b/neo/tools/radiant/PointFile.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,4 +160,3 @@ void Pointfile_Clear (void) g_qeglobals.d_pointfile_display_list = 0; Sys_UpdateWindows (W_ALL); } - diff --git a/neo/tools/radiant/PrefsDlg.cpp b/neo/tools/radiant/PrefsDlg.cpp index c0c51023..b9ad780e 100644 --- a/neo/tools/radiant/PrefsDlg.cpp +++ b/neo/tools/radiant/PrefsDlg.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"). @@ -215,7 +215,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CPrefsDlg message handlers -BOOL CPrefsDlg::OnInitDialog() +BOOL CPrefsDlg::OnInitDialog() { CDialog::OnInitDialog(); m_wndSpin.SetRange(1,60); @@ -237,7 +237,7 @@ BOOL CPrefsDlg::OnInitDialog() // EXCEPTION: OCX Property Pages should return FALSE } -void CPrefsDlg::OnOK() +void CPrefsDlg::OnOK() { m_nMoveSpeed = m_wndCamSpeed.GetPos(); m_nAngleSpeed = (float)m_nMoveSpeed * 0.50; diff --git a/neo/tools/radiant/PrefsDlg.h b/neo/tools/radiant/PrefsDlg.h index 624493d5..78db9c5c 100644 --- a/neo/tools/radiant/PrefsDlg.h +++ b/neo/tools/radiant/PrefsDlg.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/neo/tools/radiant/PreviewDlg.cpp b/neo/tools/radiant/PreviewDlg.cpp index 61d9de39..6668f1aa 100644 --- a/neo/tools/radiant/PreviewDlg.cpp +++ b/neo/tools/radiant/PreviewDlg.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 @@ BOOL CPreviewDlg::OnInitDialog() } else { wndPreview.setDrawable(&m_testDrawable); } - + SetMode(currentMode); BuildTree(); @@ -106,7 +106,7 @@ void CPreviewDlg::BuildTree() { treeMedia.DeleteAllItems(); idFileList *files; - + if ( currentMode == GUIS ) { files = fileSystem->ListFilesTree( "guis", ".gui" ); AddStrList( "base", files->GetList(), GUIS ); @@ -173,7 +173,7 @@ void CPreviewDlg::AddCommentedItems() { } } } - + void CPreviewDlg::AddStrList( const char *root, const idStrList &list, int id ) { @@ -193,7 +193,7 @@ void CPreviewDlg::AddStrList( const char *root, const idStrList &list, int id ) HTREEITEM item = base; HTREEITEM add; - + int count = list.Num(); idStr last, qt; @@ -492,13 +492,13 @@ void CPreviewDlg::AddSounds(bool rootItems) { idStrList list(1024); idStrList list2(1024); HTREEITEM base = treeMedia.InsertItem("Sound Shaders"); - + for( i = 0; i < declManager->GetNumDecls( DECL_SOUND ); i++ ) { const idSoundShader *poo = declManager->SoundByIndex( i, false ); list.AddUnique( poo->GetFileName() ); } list.Sort(); - + for ( i = 0; i < list.Num(); i++ ) { HTREEITEM child = treeMedia.InsertItem(list[i], base); treeMedia.SetItemData(child, SOUNDPARENT); @@ -510,7 +510,7 @@ void CPreviewDlg::AddSounds(bool rootItems) { list2.Append( poo->GetName() ); } } - list2.Sort(); + list2.Sort(); for (j = 0; j < list2.Num(); j++) { HTREEITEM child2 = treeMedia.InsertItem( list2[j], child ); treeMedia.SetItemData(child2, SOUNDS); @@ -520,12 +520,12 @@ void CPreviewDlg::AddSounds(bool rootItems) { idFileList *files; files = fileSystem->ListFilesTree( "sound", ".wav" ); - AddStrList( "Wave files", files->GetList(), WAVES ); + AddStrList( "Wave files", files->GetList(), WAVES ); fileSystem->FreeFileList( files ); } void CPreviewDlg::SetMode( int mode, const char *preSelect ) { - + currentMode = mode; if ( preSelect ) { mediaName = preSelect; @@ -665,5 +665,5 @@ void CPreviewDlg::AddSkins( bool rootItems ) { void CPreviewDlg::OnShowWindow( BOOL bShow, UINT status ) { if ( bShow && AfxGetApp()->GetMainWnd() == GetParent() && GetParent() ) { GetParent()->EnableWindow( FALSE ); - } + } } diff --git a/neo/tools/radiant/PreviewDlg.h b/neo/tools/radiant/PreviewDlg.h index 67072c26..d609781a 100644 --- a/neo/tools/radiant/PreviewDlg.h +++ b/neo/tools/radiant/PreviewDlg.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"). @@ -49,7 +49,7 @@ public: void SetDisablePreview( bool b ) { disablePreview = b; } - + idStr mediaName; int returnCode; @@ -84,7 +84,7 @@ protected: void AddMaterials(bool rootItems); void AddParticles(bool rootItems); void AddSkins( bool rootItems ); - + DECLARE_MESSAGE_MAP() public: diff --git a/neo/tools/radiant/PropertyList.cpp b/neo/tools/radiant/PropertyList.cpp index 0ae70557..f45c1114 100644 --- a/neo/tools/radiant/PropertyList.cpp +++ b/neo/tools/radiant/PropertyList.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"). @@ -129,7 +129,7 @@ void CPropertyList::DrawItem(LPDRAWITEMSTRUCT lpDIS) { } dc.DrawEdge(rect2,EDGE_SUNKEN,BF_BOTTOMRIGHT); dc.DrawEdge(rect,EDGE_SUNKEN,BF_BOTTOM); - + if (lpDIS->itemState == ODS_SELECTED) { dc.DrawFocusRect(rect2); } @@ -207,7 +207,7 @@ void CPropertyList::OnSelchange() { m_nLastBox = 0; if (m_cmbBox) { m_cmbBox.MoveWindow(rect); - } else { + } else { rect.bottom += 300; m_cmbBox.Create(CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_CHILD | WS_BORDER,rect,this,IDC_PROPCMBBOX); m_cmbBox.SetFont(&m_SSerif8Font); @@ -216,9 +216,9 @@ void CPropertyList::OnSelchange() { //add the choices for this particular property CString cmbItems = pItem->m_cmbItems; lBoxSelText = pItem->m_curValue; - + m_cmbBox.ResetContent(); - m_cmbBox.AddString(""); + m_cmbBox.AddString(""); int i,i2; i=0; while ((i2=cmbItems.Find('|',i)) != -1) { @@ -236,7 +236,7 @@ void CPropertyList::OnSelchange() { } else { m_cmbBox.SetCurSel(0); } - //m_cmbBox.ShowDropDown(); + //m_cmbBox.ShowDropDown(); } else if (pItem->m_nItemType==PIT_EDIT) { //display edit box @@ -245,7 +245,7 @@ void CPropertyList::OnSelchange() { rect.bottom -= 3; if (m_editBox) { m_editBox.MoveWindow(rect); - } else { + } else { m_editBox.Create(ES_LEFT | ES_AUTOHSCROLL | WS_VISIBLE | WS_CHILD | WS_BORDER,rect,this,IDC_PROPEDITBOX); m_editBox.SetFont(&m_SSerif8Font); } @@ -276,7 +276,7 @@ void CPropertyList::DisplayButton(CRect region) { if (m_btnCtrl) { m_btnCtrl.MoveWindow(region); - } else { + } else { m_btnCtrl.Create("...",BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD,region,this,IDC_PROPBTNCTRL); m_btnCtrl.SetFont(&m_SSerif8Font); } @@ -330,7 +330,7 @@ void CPropertyList::OnSelchangeCmbBox() { void CPropertyList::OnChangeEditBox() { CString newStr; m_editBox.GetWindowText(newStr); - + CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(m_curSel); pItem->m_curValue = newStr; } @@ -362,11 +362,11 @@ void CPropertyList::OnButton() { m_btnCtrl.ShowWindow(SW_HIDE); Invalidate(); } else if (pItem->m_nItemType == PIT_FILE) { - CString SelectedFile; + CString SelectedFile; CString Filter("Gif Files (*.gif)|*.gif||"); - + CFileDialog FileDlg(TRUE, NULL, NULL, NULL, Filter); - + CString currPath = pItem->m_curValue; FileDlg.m_ofn.lpstrTitle = "Select file"; if (currPath.GetLength() > 0) { @@ -379,7 +379,7 @@ void CPropertyList::OnButton() { pItem->m_curValue = SelectedFile; Invalidate(); } - } else if (pItem->m_nItemType == PIT_FONT) { + } else if (pItem->m_nItemType == PIT_FONT) { CFontDialog FontDlg(NULL,CF_EFFECTS | CF_SCREENFONTS,NULL,this); if(IDOK == FontDlg.DoModal()) { CString faceName = FontDlg.GetFaceName(); @@ -425,7 +425,7 @@ void CPropertyList::OnLButtonUp(UINT nFlags, CPoint point) { //if columns were being resized then this indicates //that mouse is up so resizing is done. Need to redraw //columns to reflect their new widths. - + m_bTracking = FALSE; //if mouse was captured then release it if (GetCapture()==this) { @@ -458,7 +458,7 @@ void CPropertyList::OnLButtonDown(UINT nFlags, CPoint point) { windowRect.left += 10; windowRect.right -= 10; //do not let mouse leave the list box boundary ::ClipCursor(windowRect); - + if (m_cmbBox) { m_cmbBox.ShowWindow(SW_HIDE); } @@ -485,7 +485,7 @@ void CPropertyList::OnLButtonDown(UINT nFlags, CPoint point) { } } -void CPropertyList::OnMouseMove(UINT nFlags, CPoint point) { +void CPropertyList::OnMouseMove(UINT nFlags, CPoint point) { if (m_bTracking) { //move divider line to the mouse pos. if columns are //currently being resized @@ -525,16 +525,15 @@ void CPropertyList::PreSubclassWindow() { void CPropertyList::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { if (m_cmbBox) { - m_cmbBox.ShowWindow(SW_HIDE); - } - if (m_editBox) { - m_editBox.ShowWindow(SW_HIDE); - } - if (m_btnCtrl) { - m_btnCtrl.ShowWindow(SW_HIDE); - } - Invalidate(); - - CListBox::OnVScroll(nSBCode, nPos, pScrollBar); -} + m_cmbBox.ShowWindow(SW_HIDE); + } + if (m_editBox) { + m_editBox.ShowWindow(SW_HIDE); + } + if (m_btnCtrl) { + m_btnCtrl.ShowWindow(SW_HIDE); + } + Invalidate(); + CListBox::OnVScroll(nSBCode, nPos, pScrollBar); +} diff --git a/neo/tools/radiant/PropertyList.h b/neo/tools/radiant/PropertyList.h index 03728843..b2ce253e 100644 --- a/neo/tools/radiant/PropertyList.h +++ b/neo/tools/radiant/PropertyList.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 @@ protected: CEdit m_editBox; CButton m_btnCtrl; CFont m_SSerif8Font; - + int m_curSel,m_prevSel; int m_nDivider; int m_nDivTop; diff --git a/neo/tools/radiant/QE3.CPP b/neo/tools/radiant/QE3.CPP index 1952e683..d930e4a1 100644 --- a/neo/tools/radiant/QE3.CPP +++ b/neo/tools/radiant/QE3.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 @@ void Map_Snapshot() { /* ======================================================================================================================= - QE_CheckAutoSave If five minutes have passed since making a change and the map hasn't been saved, save it out. + QE_CheckAutoSave If five minutes have passed since making a change and the map hasn't been saved, save it out. ======================================================================================================================= */ void QE_CheckAutoSave(void) { @@ -209,7 +209,7 @@ const int g_nPathFixupCount = sizeof(g_pPathFixups) / sizeof (const char *); /* ======================================================================================================================= - QE_LoadProject + QE_LoadProject ======================================================================================================================= */ bool QE_LoadProject(char *projectfile) { @@ -256,7 +256,7 @@ bool QE_LoadProject(char *projectfile) { /* ======================================================================================================================= - QE_SaveProject £ + QE_SaveProject £ ======================================================================================================================= */ bool QE_SaveProject(const char *pProjectFile) { @@ -286,7 +286,7 @@ bool QE_SaveProject(const char *pProjectFile) { /* ======================================================================================================================= - ConnectEntities Sets target / name on the two entities selected from the first selected to the secon + ConnectEntities Sets target / name on the two entities selected from the first selected to the secon ======================================================================================================================= */ void ConnectEntities(void) { @@ -437,4 +437,3 @@ void QE_CountBrushesAndUpdateStatusBar(void) { s_didonce = true; } } - diff --git a/neo/tools/radiant/QE3.H b/neo/tools/radiant/QE3.H index c9dd5d29..de9db600 100644 --- a/neo/tools/radiant/QE3.H +++ b/neo/tools/radiant/QE3.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"). @@ -130,51 +130,51 @@ typedef struct int rotateAxis; // 0, 1 or 2 int flatRotation; // 0, 1 or 2, 0 == off, 1 == rotate about the rotation origin, 1 == rotate about the selection mid point - + int d_num_entities; - + entity_t *d_project_entity; idVec3 d_new_brush_bottom, d_new_brush_top; - + HINSTANCE d_hInstance; - + idVec3 d_points[MAX_POINTS]; int d_numpoints; pedge_t d_edges[MAX_EDGES]; int d_numedges; - + int d_num_move_points; idVec3 *d_move_points[MAX_MOVE_POINTS]; int d_num_move_planes; idPlane *d_move_planes[MAX_MOVE_PLANES]; - + qtexture_t *d_qtextures; - + texturewin_t d_texturewin; - + int d_pointfile_display_list; - + LPMRUMENU d_lpMruMenu; - + SavedInfo_t d_savedinfo; - + int d_workcount; - + // connect entities uses the last two brushes selected int d_select_count; brush_t *d_select_order[MAX_MAP_ENTITIES]; idVec3 d_select_translate; // for dragging w/o making new display lists select_t d_select_mode; - idPointListInterface *selectObject; // - + idPointListInterface *selectObject; // + int d_font_list; - + int d_parsed_brushes; - + bool show_blocks; - + // Timo // tells if we are internally using brush primitive (texture coordinates and map format) // this is a shortcut for IntForKey( g_qeglobals.d_project_entity, "brush_primit" ) @@ -187,21 +187,21 @@ typedef struct bool bOldBrushes; bool bPrimitBrushes; float mapVersion; - + idVec3 d_vAreaTL; idVec3 d_vAreaBR; - + // tells if we are using .INI files for prefs instead of registry bool use_ini; // even in .INI mode we use the registry for all void* prefs char use_ini_registry[64]; - + //Timo // tells we have surface properties plugin bool bSurfacePropertiesPlugin; // tells we are using a BSP frontend plugin bool bBSPFrontendPlugin; - + // the editor has its own soundWorld and renderWorld, completely distinct from the game idRenderWorld *rw; idSoundWorld *sw; @@ -260,10 +260,10 @@ void FillTextureMenu (CStringArray* pArray = NULL); void FillBSPMenu (void); BOOL CALLBACK Win_Dialog ( - HWND hwndDlg, // handle to dialog box - UINT uMsg, // message - WPARAM wParam, // first message parameter - LPARAM lParam // second message parameter + HWND hwndDlg, // handle to dialog box + UINT uMsg, // message + WPARAM wParam, // first message parameter + LPARAM lParam // second message parameter ); @@ -479,7 +479,7 @@ extern bool ByeByeSurfaceDialog(); extern void UpdateSurfaceDialog(); extern void UpdateLightInspector(); -BOOL UpdateEntitySel(eclass_t *pec); +BOOL UpdateEntitySel(eclass_t *pec); void SetInspectorMode(int iType); BOOL GetSelectAllCriteria(CString &strKey, CString &strVal); diff --git a/neo/tools/radiant/QEDEFS.H b/neo/tools/radiant/QEDEFS.H index 7eb06a51..d9e9b42e 100644 --- a/neo/tools/radiant/QEDEFS.H +++ b/neo/tools/radiant/QEDEFS.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 @@ If you have questions concerning this license or the applicable additional terms #define _3DFXCAMERA_WINDOW_CLASS "Q3DFXCamera" #define CAMERA_WINDOW_CLASS "QCamera" #define XY_WINDOW_CLASS "QXY" -#define Z_WINDOW_CLASS "QZ" +#define Z_WINDOW_CLASS "QZ" #define ENT_WINDOW_CLASS "QENT" #define TEXTURE_WINDOW_CLASS "QTEX" @@ -165,7 +165,7 @@ enum { // menu settings #define ENTITY_WIRE 0x00001 -#define ENTITY_SKINNED 0x00002 +#define ENTITY_SKINNED 0x00002 #endif diff --git a/neo/tools/radiant/QERTYPES.H b/neo/tools/radiant/QERTYPES.H index 80768ae9..e18623f9 100644 --- a/neo/tools/radiant/QERTYPES.H +++ b/neo/tools/radiant/QERTYPES.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 @@ public: { name = ""; shift[0] = shift[1] = 0.0; - rotate = 0; + rotate = 0; scale[0] = scale[1] = 0; value = 0; } @@ -133,7 +133,7 @@ typedef struct qtexture_s int flags; int value; int texture_number; // gl bind number - + // name of the .shader file char shadername[1024]; // old shader stuff bool bFromShader; // created from a shader @@ -193,7 +193,7 @@ typedef struct { #define MIN_PATCH_WIDTH 3 -#define MIN_PATCH_HEIGHT 3 +#define MIN_PATCH_HEIGHT 3 #define MAX_PATCH_WIDTH 64 #define MAX_PATCH_HEIGHT 64 @@ -220,9 +220,9 @@ typedef struct { #define PATCH_BEZIER 0x00000000 // default bezier #define PATCH_BSPLINE 0x10000000 // bspline -#define PATCH_TYPEMASK 0x00000fff // -#define PATCH_BTYPEMASK 0x0000f000 // -#define PATCH_STYLEMASK 0xffff0000 // +#define PATCH_TYPEMASK 0x00000fff // +#define PATCH_BTYPEMASK 0x0000f000 // +#define PATCH_STYLEMASK 0xffff0000 // struct brush_s; @@ -267,7 +267,7 @@ enum { LIGHT_RADIUS, LIGHT_X, LIGHT_Y, - LIGHT_Z, + LIGHT_Z, LIGHT_START, LIGHT_END, LIGHT_CENTER @@ -362,7 +362,7 @@ typedef struct trimodel_t enum EVAR_TYPES { EVAR_STRING, - EVAR_INT, + EVAR_INT, EVAR_FLOAT, EVAR_BOOL, EVAR_COLOR, @@ -419,8 +419,8 @@ extern eclass_t *eclass; #define W_CAMERA_IFON 0x0100 #define W_XZ 0x0200 //--| only used for patch vertex manip stuff #define W_YZ 0x0400 //--| -#define W_MEDIA 0x1000 -#define W_GAME 0x2000 +#define W_MEDIA 0x1000 +#define W_GAME 0x2000 #define W_ALL 0xFFFFFFFF // used in some Drawing routines diff --git a/neo/tools/radiant/Radiant.cpp b/neo/tools/radiant/Radiant.cpp index d6fde3eb..808bcfa6 100644 --- a/neo/tools/radiant/Radiant.cpp +++ b/neo/tools/radiant/Radiant.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"). @@ -245,7 +245,7 @@ BOOL CRadiantApp::InitInstance() { // this key doesn't exist, so it's the one we'll use strcpy( g_qeglobals.use_ini_registry, key.GetBuffer(0) ); - RegCreateKeyEx( HKEY_CURRENT_USER, key, 0, NULL, + RegCreateKeyEx( HKEY_CURRENT_USER, key, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkResult, &dwDisp ); RegSetValueEx( hkResult, "RadiantName", 0, REG_SZ, reinterpret_cast(RadiantPath), strlen( RadiantPath )+1 ); RegCloseKey( hkResult ); @@ -310,7 +310,7 @@ BOOL CRadiantApp::InitInstance() if (pMainFrame->m_hAccelTable) { ::DestroyAcceleratorTable(pMainFrame->m_hAccelTable); } - + pMainFrame->LoadAccelTable(MAKEINTRESOURCE(IDR_MINIACCEL)); m_pMainWnd = pMainFrame; @@ -325,7 +325,7 @@ BOOL CRadiantApp::InitInstance() ///////////////////////////////////////////////////////////////////////////// // CRadiantApp commands -int CRadiantApp::ExitInstance() +int CRadiantApp::ExitInstance() { common->Shutdown(); g_pParentWnd = NULL; @@ -348,7 +348,7 @@ void CRadiantApp::OnHelp() ShellExecute(m_pMainWnd->GetSafeHwnd(), "open", "http://www.idDevNet.com", NULL, NULL, SW_SHOW); } -int CRadiantApp::Run( void ) +int CRadiantApp::Run( void ) { BOOL bIdle = TRUE; LONG lIdleCount = 0; @@ -412,9 +412,9 @@ bool SaveWindowState(HWND hWnd, const char *pszName) RECT rc; GetWindowRect(hWnd, &rc); if (hWnd != g_pParentWnd->GetSafeHwnd()) { - if (::GetParent(hWnd) != g_pParentWnd->GetSafeHwnd()) { - ::SetParent(hWnd, g_pParentWnd->GetSafeHwnd()); - } + if (::GetParent(hWnd) != g_pParentWnd->GetSafeHwnd()) { + ::SetParent(hWnd, g_pParentWnd->GetSafeHwnd()); + } MapWindowPoints(NULL, g_pParentWnd->GetSafeHwnd(), (POINT *)&rc, 2); } return SaveRegistryInfo(pszName, &rc, sizeof(rc)); diff --git a/neo/tools/radiant/Radiant.h b/neo/tools/radiant/Radiant.h index 82edcc1d..dc7c3e51 100644 --- a/neo/tools/radiant/Radiant.h +++ b/neo/tools/radiant/Radiant.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/neo/tools/radiant/RotateDlg.cpp b/neo/tools/radiant/RotateDlg.cpp index ce275cc7..47ef444d 100644 --- a/neo/tools/radiant/RotateDlg.cpp +++ b/neo/tools/radiant/RotateDlg.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,51 +80,51 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRotateDlg message handlers -void CRotateDlg::OnOK() +void CRotateDlg::OnOK() { OnApply(); CDialog::OnOK(); } -void CRotateDlg::OnApply() +void CRotateDlg::OnApply() { UpdateData(TRUE); float f = atof(m_strX); if (f != 0.0) - Select_RotateAxis(0,f); + Select_RotateAxis(0,f); f = atof(m_strY); if (f != 0.0) - Select_RotateAxis(1,f); + Select_RotateAxis(1,f); f = atof(m_strZ); if (f != 0.0) - Select_RotateAxis(2,f); + Select_RotateAxis(2,f); } -BOOL CRotateDlg::OnInitDialog() +BOOL CRotateDlg::OnInitDialog() { CDialog::OnInitDialog(); m_wndSpin1.SetRange(0, 359); m_wndSpin2.SetRange(0, 359); m_wndSpin3.SetRange(0, 359); return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } -void CRotateDlg::OnDeltaposSpin1(NMHDR* pNMHDR, LRESULT* pResult) +void CRotateDlg::OnDeltaposSpin1(NMHDR* pNMHDR, LRESULT* pResult) { NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; Select_RotateAxis(0, pNMUpDown->iDelta); *pResult = 0; } -void CRotateDlg::OnDeltaposSpin2(NMHDR* pNMHDR, LRESULT* pResult) +void CRotateDlg::OnDeltaposSpin2(NMHDR* pNMHDR, LRESULT* pResult) { NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; Select_RotateAxis(1, pNMUpDown->iDelta); *pResult = 0; } -void CRotateDlg::OnDeltaposSpin3(NMHDR* pNMHDR, LRESULT* pResult) +void CRotateDlg::OnDeltaposSpin3(NMHDR* pNMHDR, LRESULT* pResult) { NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; Select_RotateAxis(2, pNMUpDown->iDelta); diff --git a/neo/tools/radiant/RotateDlg.h b/neo/tools/radiant/RotateDlg.h index 493c50f7..5bf83d4d 100644 --- a/neo/tools/radiant/RotateDlg.h +++ b/neo/tools/radiant/RotateDlg.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/neo/tools/radiant/SELECT.CPP b/neo/tools/radiant/SELECT.CPP index 124b9b50..15c7bcf8 100644 --- a/neo/tools/radiant/SELECT.CPP +++ b/neo/tools/radiant/SELECT.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"). @@ -146,7 +146,7 @@ qertrace_t Test_Ray(const idVec3 &origin, const idVec3 &dir, int flags) { if (g_PrefsDlg.m_selectNoModels) { if (brush->modelHandle > 0) { continue; - } + } } face = Brush_Ray(origin, dir, brush, &dist, true); @@ -156,7 +156,7 @@ qertrace_t Test_Ray(const idVec3 &origin, const idVec3 &dir, int flags) { t.face = face; t.selected = false; } - } + } } for (brush = selected_brushes.next; brush != &selected_brushes; brush = brush->next) { @@ -203,7 +203,7 @@ extern idVec3 Brush_TransformedPoint(brush_t *b, const idVec3 &in); /* ======================================================================================================================= - Select_Brush + Select_Brush ======================================================================================================================= */ void Select_Brush(brush_t *brush, bool bComplete, bool bStatus) { @@ -256,7 +256,7 @@ singleselect: if (p && *p) { g_Inspectors->mediaDlg.SelectCurrentItem(true, p, CDialogTextures::SOUNDS); } - + } if ( ( e->eclass->nShowFlags & ECLASS_LIGHT ) && !brush->entityModel ) { if (brush->pointLight) { @@ -274,7 +274,7 @@ singleselect: AddSelectablePoint(brush, Brush_TransformedPoint(brush, brush->lightEnd), LIGHT_END, false); } } - UpdateLightInspector(); + UpdateLightInspector(); } if (e->eclass->nShowFlags & ECLASS_CAMERAVIEW) { g_pParentWnd->GetCamera()->UpdateCameraView(); @@ -295,7 +295,7 @@ singleselect: /* ======================================================================================================================= - Select_Ray If the origin is inside a brush, that brush will be ignored. + Select_Ray If the origin is inside a brush, that brush will be ignored. ======================================================================================================================= */ void Select_Ray(idVec3 origin, idVec3 dir, int flags) { @@ -477,7 +477,7 @@ void Select_Deselect(bool bDeselectFaces) { /* ======================================================================================================================= - Select_Move + Select_Move ======================================================================================================================= */ void Select_Move(idVec3 delta, bool bSnap) { @@ -512,8 +512,8 @@ void Select_Move(idVec3 delta, bool bSnap) { /* ======================================================================================================================= - Select_Clone Creates an exact duplicate of the selection in place, then moves the selected brushes off of their old - positions + Select_Clone Creates an exact duplicate of the selection in place, then moves the selected brushes off of their old + positions ======================================================================================================================= */ void Select_Clone(void) { @@ -529,11 +529,11 @@ void Select_Clone(void) { /* ======================================================================================================================= - Select_SetTexture Timo:: bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo:: - brush primitive texturing the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes - ) Timo:: texture plugin, added an IPluginTexdef* parameter must be casted to an IPluginTexdef! if not NULL, get - ->Copy() of it into each face or brush ( and remember to hook ) if NULL, means we have no information, ask for a - default + Select_SetTexture Timo:: bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo:: + brush primitive texturing the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes + ) Timo:: texture plugin, added an IPluginTexdef* parameter must be casted to an IPluginTexdef! if not NULL, get + ->Copy() of it into each face or brush ( and remember to hook ) if NULL, means we have no information, ask for a + default ======================================================================================================================= */ void WINAPI Select_SetTexture(texdef_t *texdef,brushprimit_texdef_t *brushprimit_texdef,bool bFitScale,void *pPlugTexdef,bool update) { @@ -546,7 +546,7 @@ void WINAPI Select_SetTexture(texdef_t *texdef,brushprimit_texdef_t *brushprimit face_t *selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(i)); brush_t *selBrush = reinterpret_cast < brush_t * > (g_ptrSelectedFaceBrushes.GetAt(i)); Undo_AddBrush(selBrush); - SetFaceTexdef(selBrush,selFace,texdef,brushprimit_texdef,bFitScale); + SetFaceTexdef(selBrush,selFace,texdef,brushprimit_texdef,bFitScale); Brush_Build(selBrush, bFitScale); Undo_EndBrush(selBrush); } @@ -584,7 +584,7 @@ void WINAPI Select_SetTexture(texdef_t *texdef,brushprimit_texdef_t *brushprimit /* ======================================================================================================================= - TRANSFORMATIONS + TRANSFORMATIONS ======================================================================================================================= */ void Select_GetBounds(idVec3 &mins, idVec3 &maxs) { @@ -758,7 +758,7 @@ void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) { entity_t *lastOwner = NULL; for (b = selected_brushes.next; b != &selected_brushes; b = b->next) { - + bool doBrush = true; if (!(b->owner->eclass->nShowFlags & ECLASS_WORLDSPAWN) && b->owner != lastOwner) { if (b->modelHandle || b->owner->eclass->nShowFlags & ECLASS_ROTATABLE) { @@ -808,7 +808,7 @@ void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) { bo.FromTransformedBounds(bo2, b->owner->origin, b->owner->rotation); Brush_Resize(b, bo[0], bo[1]); doBrush = false; - } + } if (b->owner->eclass->fixedsize) { doBrush = false; } @@ -822,8 +822,8 @@ void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) { SetKeyValue(b->owner, "origin", text); } - - + + if (OkForRotationKey(b)) { sprintf(str, "%g %g %g %g %g %g %g %g %g",b->owner->rotation[0][0],b->owner->rotation[0][1],b->owner->rotation[0][2], @@ -831,7 +831,7 @@ void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) { b->owner->rotation[2][1],b->owner->rotation[2][2]); SetKeyValue(b->owner, "rotation", str); } - + if (b->trackLightOrigin) { sprintf(str, "%g %g %g %g %g %g %g %g %g",b->owner->lightRotation[0][0],b->owner->lightRotation[0][1],b->owner->lightRotation[0][2], b->owner->lightRotation[1][0],b->owner->lightRotation[1][1],b->owner->lightRotation[1][2],b->owner->lightRotation[2][0], @@ -845,7 +845,7 @@ void Select_ApplyMatrix(bool bSnap, bool rotateOrigins) { if (doBrush) { for (f = b->brush_faces; f; f = f->next) { for (i = 0; i < 3; i++) { - f->planepts[i] = ( ((g_bRotateMode) ? f->orgplanepts[i] : f->planepts[i]) - select_origin ) * ((g_bRotateMode) ? select_bmatrix : select_matrix) + select_origin; + f->planepts[i] = ( ((g_bRotateMode) ? f->orgplanepts[i] : f->planepts[i]) - select_origin ) * ((g_bRotateMode) ? select_bmatrix : select_matrix) + select_origin; } if ( select_fliporder ) { @@ -1185,7 +1185,7 @@ void AbsoluteToLocal( const idPlane &normal2, face_t *f, idVec3 &p1, idVec3 &p2, void Select_FlipAxis(int axis) { Select_GetMid( select_origin ); - + for ( int i = 0; i < 3; i++) { VectorCopy(vec3_origin, select_matrix[i]); select_matrix[i][i] = 1; @@ -1274,7 +1274,7 @@ void Select_Scale(float x, float y, float z) { /* ======================================================================================================================= - GROUP SELECTIONS + GROUP SELECTIONS ======================================================================================================================= */ void Select_CompleteTall(void) { @@ -1461,7 +1461,7 @@ void Select_Inside(void) { /* ======================================================================================================================= - Select_Ungroup Turn the currently selected entity back into normal brushes + Select_Ungroup Turn the currently selected entity back into normal brushes ======================================================================================================================= */ void Select_Ungroup() { @@ -1915,7 +1915,7 @@ void Select_ShowAllHidden() { /* ======================================================================================================================= - Select_Invert + Select_Invert ======================================================================================================================= */ void Select_Invert(void) { @@ -1954,7 +1954,7 @@ void Select_Invert(void) { /* ======================================================================================================================= - Select_Name + Select_Name ======================================================================================================================= */ void Select_Name(const char *pName) { @@ -2098,7 +2098,7 @@ void Select_UpdateTextureName(const char *name) { void Select_FlipTexture(bool y) { int faceCount = g_ptrSelectedFaces.GetSize(); - + Undo_Start("Select_FlipTexture"); for (brush_t *b = selected_brushes.next; b != &selected_brushes; b = b->next) { if (b->pPatch) { @@ -2125,7 +2125,7 @@ void Select_FlipTexture(bool y) { /* ======================================================================================================================= - Select_SetKeyVal + Select_SetKeyVal sets values on non-world entities ======================================================================================================================= */ @@ -2159,7 +2159,7 @@ void Select_CopyPatchTextureCoords( patchMesh_t *p ) { /* ======================================================================================================================= - Select_SetProjectFaceOntoPatch + Select_SetProjectFaceOntoPatch ======================================================================================================================= */ void Select_ProjectFaceOntoPatch( face_t *face ) { @@ -2173,7 +2173,7 @@ void Select_ProjectFaceOntoPatch( face_t *face ) { /* ======================================================================================================================= - Select_SetPatchFit + Select_SetPatchFit ======================================================================================================================= */ extern float Patch_Width(patchMesh_t *p); diff --git a/neo/tools/radiant/SELECT.H b/neo/tools/radiant/SELECT.H index 5fed9d7a..bc8e0369 100644 --- a/neo/tools/radiant/SELECT.H +++ b/neo/tools/radiant/SELECT.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/neo/tools/radiant/ScaleDialog.cpp b/neo/tools/radiant/ScaleDialog.cpp index d4e49cce..de1cf546 100644 --- a/neo/tools/radiant/ScaleDialog.cpp +++ b/neo/tools/radiant/ScaleDialog.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/neo/tools/radiant/ScaleDialog.h b/neo/tools/radiant/ScaleDialog.h index c82bdcb6..d0a7b9cb 100644 --- a/neo/tools/radiant/ScaleDialog.h +++ b/neo/tools/radiant/ScaleDialog.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/neo/tools/radiant/SurfaceDlg.cpp b/neo/tools/radiant/SurfaceDlg.cpp index 2cd94d65..b545ec04 100644 --- a/neo/tools/radiant/SurfaceDlg.cpp +++ b/neo/tools/radiant/SurfaceDlg.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"). @@ -178,7 +178,7 @@ void CSurfaceDlg::SetTexMods() { selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(0)); } else { if (selected_brushes.next != &selected_brushes) { - brush_t *b = selected_brushes.next; + brush_t *b = selected_brushes.next; if (!b->pPatch) { selFace = b->brush_faces; } @@ -187,7 +187,7 @@ void CSurfaceDlg::SetTexMods() { if (selFace) { float rot; - Face_GetScale_BrushPrimit(selFace, &m_horzScale, &m_vertScale, &rot); + Face_GetScale_BrushPrimit(selFace, &m_horzScale, &m_vertScale, &rot); } else { m_horzScale = 1.0f; m_vertScale = 1.0f; @@ -213,16 +213,16 @@ void CSurfaceDlg::UpdateSpinners(bool up, int nID) { float hdiv = 0.0f; float vdiv = 0.0f; switch (nID) { - case IDC_SPIN_ROTATE : + case IDC_SPIN_ROTATE : Select_RotateTexture((up) ? m_rotate : -m_rotate); break; - case IDC_SPIN_HSCALE : + case IDC_SPIN_HSCALE : m_horzScale += (up) ? 0.1f : -0.1f; hdiv = (m_horzScale == 0.0f) ? 1.0f : m_horzScale; Select_ScaleTexture( 1.0f / hdiv, 0.0f, true, ( m_absolute != FALSE ) ); UpdateData(FALSE); break; - case IDC_SPIN_VSCALE : + case IDC_SPIN_VSCALE : m_vertScale += (up) ? 0.1f : -0.1f; vdiv = (m_vertScale == 0.0f) ? 1.0f : m_vertScale; Select_ScaleTexture( 0.0f, 1.0f / vdiv, true, ( m_absolute != FALSE ) ); @@ -309,7 +309,7 @@ void DoSurface (void) { g_dlgSurface.SetTexMods (); g_dlgSurface.ShowWindow(SW_SHOW); } -} +} bool ByeByeSurfaceDialog() { if (g_surfwin) { @@ -516,37 +516,37 @@ void CSurfaceDlg::OnCheckSubdivide() { Sys_UpdateWindows( W_CAMERA | W_XY ); } -void CSurfaceDlg::OnChangeEditHorz() +void CSurfaceDlg::OnChangeEditHorz() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. - + // TODO: Add your control notification handler code here UpdateData(TRUE); // turn any patches in explicit subdivides Patch_SubdivideSelected( ( m_subdivide != FALSE ), m_nHorz, m_nVert ); Sys_UpdateWindows(W_CAMERA | W_XY); - + } -void CSurfaceDlg::OnChangeEditVert() +void CSurfaceDlg::OnChangeEditVert() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. - + // TODO: Add your control notification handler code here UpdateData(TRUE); // turn any patches in explicit subdivides Patch_SubdivideSelected( ( m_subdivide != FALSE ), m_nHorz, m_nVert ); Sys_UpdateWindows(W_CAMERA | W_XY); - + } -BOOL CSurfaceDlg::PreTranslateMessage(MSG* pMsg) +BOOL CSurfaceDlg::PreTranslateMessage(MSG* pMsg) { if (pMsg->message == WM_KEYDOWN) { if (pMsg->wParam == VK_RETURN) { @@ -568,62 +568,62 @@ BOOL CSurfaceDlg::PreTranslateMessage(MSG* pMsg) return CDialog::PreTranslateMessage(pMsg); } -void CSurfaceDlg::OnSetfocusHscale() +void CSurfaceDlg::OnSetfocusHscale() { - focusControl = &m_wndHScale; + focusControl = &m_wndHScale; } -void CSurfaceDlg::OnKillfocusHscale() +void CSurfaceDlg::OnKillfocusHscale() { focusControl = NULL; } -void CSurfaceDlg::OnKillfocusVscale() +void CSurfaceDlg::OnKillfocusVscale() { focusControl = NULL; } -void CSurfaceDlg::OnSetfocusVscale() +void CSurfaceDlg::OnSetfocusVscale() { - focusControl = &m_wndVScale; + focusControl = &m_wndVScale; } -void CSurfaceDlg::OnKillfocusEditWidth() +void CSurfaceDlg::OnKillfocusEditWidth() { focusControl = NULL; } -void CSurfaceDlg::OnSetfocusEditWidth() +void CSurfaceDlg::OnSetfocusEditWidth() { - focusControl = &m_wndWidth; + focusControl = &m_wndWidth; } -void CSurfaceDlg::OnKillfocusEditHeight() +void CSurfaceDlg::OnKillfocusEditHeight() { focusControl = NULL; } -void CSurfaceDlg::OnSetfocusEditHeight() +void CSurfaceDlg::OnSetfocusEditHeight() { - focusControl = &m_wndHeight; + focusControl = &m_wndHeight; } -void CSurfaceDlg::OnBtnFlipx() +void CSurfaceDlg::OnBtnFlipx() { Select_FlipTexture(false); } -void CSurfaceDlg::OnBtnFlipy() +void CSurfaceDlg::OnBtnFlipy() { Select_FlipTexture(true); } -void CSurfaceDlg::OnKillfocusRotate() +void CSurfaceDlg::OnKillfocusRotate() { focusControl = NULL; } -void CSurfaceDlg::OnSetfocusRotate() +void CSurfaceDlg::OnSetfocusRotate() { focusControl = &m_wndRotateEdit; } diff --git a/neo/tools/radiant/SurfaceDlg.h b/neo/tools/radiant/SurfaceDlg.h index caa22f16..ea5a602c 100644 --- a/neo/tools/radiant/SurfaceDlg.h +++ b/neo/tools/radiant/SurfaceDlg.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/neo/tools/radiant/TabsDlg.cpp b/neo/tools/radiant/TabsDlg.cpp index 14f9bace..6ef70f27 100644 --- a/neo/tools/radiant/TabsDlg.cpp +++ b/neo/tools/radiant/TabsDlg.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"). @@ -91,18 +91,18 @@ void CTabsDlg::DockWindow ( int ID , bool dock ) ASSERT ( info ); ASSERT ( m_Tabs.GetSafeHwnd() ); - + ShowAllWindows ( FALSE ); if ( !dock ) - { + { //make a containing window and assign the dialog to it CRect rect; CString classname = AfxRegisterWndClass ( CS_DBLCLKS , 0 , 0 , 0 ); info->m_State = DockedWindowInfo::FLOATING; info->m_Window->GetWindowRect(rect); - info->m_Container.CreateEx ( WS_EX_TOOLWINDOW , classname , info->m_Title , WS_THICKFRAME | WS_SYSMENU | WS_POPUP | WS_CAPTION, rect , this , 0 ); + info->m_Container.CreateEx ( WS_EX_TOOLWINDOW , classname , info->m_Title , WS_THICKFRAME | WS_SYSMENU | WS_POPUP | WS_CAPTION, rect , this , 0 ); info->m_Window->SetParent ( &info->m_Container ); info->m_Window->ShowWindow(TRUE); @@ -113,25 +113,25 @@ void CTabsDlg::DockWindow ( int ID , bool dock ) if (info->m_TabControlIndex >= 0 ) { m_Tabs.DeleteItem( info->m_TabControlIndex ); - } + } if ( m_Tabs.GetItemCount() > 0 ) { m_Tabs.SetCurFocus( 0 ); - } + } CString placementName = info->m_Title + "Placement"; LoadWindowPlacement(info->m_Container , placementName); } else - { - info->m_State = DockedWindowInfo::DOCKED; - - info->m_TabControlIndex = m_Tabs.InsertItem( TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM , 0 , info->m_Title , info->m_ImageID , (LPARAM)info); + { + info->m_State = DockedWindowInfo::DOCKED; - info->m_Window->SetParent ( this ); + info->m_TabControlIndex = m_Tabs.InsertItem( TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM , 0 , info->m_Title , info->m_ImageID , (LPARAM)info); + + info->m_Window->SetParent ( this ); info->m_Window->ShowWindow (TRUE); - + info->m_Container.SetDockManager( NULL ); //so it doesn't try to call back and redock this window info->m_Container.DestroyWindow (); @@ -140,9 +140,9 @@ void CTabsDlg::DockWindow ( int ID , bool dock ) //stupid hack to get the window reitself properly rect.DeflateRect(0,0,0,1); - MoveWindow(rect); + MoveWindow(rect); rect.InflateRect(0,0,0,1); - MoveWindow(rect); + MoveWindow(rect); } UpdateTabControlIndices (); @@ -192,9 +192,9 @@ void CTabsDlg::OnLButtonDown(UINT nFlags, CPoint point) } void CTabsDlg::OnLButtonUp(UINT nFlags, CPoint point) -{ +{ if ( m_DragTabActive && ((abs ( point.x - m_DragDownPoint.x ) > 50) || (abs ( point.y - m_DragDownPoint.y ) > 50))) - { + { HandleUndock(); m_DragTabActive = false; } @@ -251,7 +251,7 @@ void CTabsDlg::ShowAllWindows ( bool show ) if ( info->m_State == DockedWindowInfo::DOCKED ) { info->m_Window->ShowWindow( show ); - } + } } } @@ -260,9 +260,9 @@ void CTabsDlg::FocusWindow ( int ID ) DockedWindowInfo* info = NULL; m_Windows.Lookup( (WORD)ID , (void*&)info); - ASSERT ( info ); + ASSERT ( info ); ASSERT ( info->m_Window ); - + if ( info->m_State == DockedWindowInfo::DOCKED ) { TabCtrl_SetCurFocus ( m_Tabs.GetSafeHwnd() , info->m_TabControlIndex ); @@ -274,13 +274,13 @@ void CTabsDlg::FocusWindow ( int ID ) } void CTabsDlg::UpdateTabControlIndices () -{ +{ TCITEM item; item.mask = TCIF_PARAM; DockedWindowInfo* info = NULL; int itemCount = m_Tabs.GetItemCount(); - + for ( int i = 0 ; i < itemCount ; i ++ ) { if ( !m_Tabs.GetItem( i , &item ) ) @@ -306,7 +306,7 @@ void CTabsDlg::OnDestroy() ASSERT( info ); delete info; - } + } CDialog::OnDestroy(); } @@ -316,7 +316,7 @@ bool CTabsDlg::IsDocked ( CWnd* wnd ) bool docked = false; DockedWindowInfo* info = NULL; - CString placementName; + CString placementName; POSITION pos; WORD wID; @@ -332,11 +332,11 @@ bool CTabsDlg::IsDocked ( CWnd* wnd ) return docked; } -void CTabsDlg::SaveWindowPlacement( int ID ) +void CTabsDlg::SaveWindowPlacement( int ID ) { DockedWindowInfo* info = NULL; - - CString placementName; + + CString placementName; POSITION pos; WORD wID = ID; diff --git a/neo/tools/radiant/TabsDlg.h b/neo/tools/radiant/TabsDlg.h index b4dd7a5c..8134aaf9 100644 --- a/neo/tools/radiant/TabsDlg.h +++ b/neo/tools/radiant/TabsDlg.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 @@ class CTabsDlg : public CDialog // DECLARE_DYNAMIC ( CTabsDlg ) // Construction public: - + CTabsDlg(UINT ID ,CWnd* pParent = NULL); // standard constructor typedef void (*pfnOnDockEvent)( bool , int , CWnd* ); @@ -78,7 +78,7 @@ protected: if ( title.GetLength() == 0 ) { m_Window->GetWindowText( m_Title ); - + } else { @@ -87,10 +87,10 @@ protected: m_State = DOCKED; m_DockCallback = dockCallback; } - + enum eState {DOCKED,FLOATING} ; CTearoffContainerWindow m_Container; //the floating window that will hold m_Window when it's undocked - CWnd* m_Window; + CWnd* m_Window; CString m_Title; int m_ImageID; int m_ID; @@ -101,7 +101,7 @@ protected: void ShowAllWindows ( bool show = true ); void HandleUndock (); - void UpdateTabControlIndices (); + void UpdateTabControlIndices (); // Generated message map functions virtual BOOL OnInitDialog(); diff --git a/neo/tools/radiant/TearoffContainerWindow.cpp b/neo/tools/radiant/TearoffContainerWindow.cpp index 91842185..0b155977 100644 --- a/neo/tools/radiant/TearoffContainerWindow.cpp +++ b/neo/tools/radiant/TearoffContainerWindow.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"). @@ -77,18 +77,18 @@ void CTearoffContainerWindow::SetDialog ( CWnd* dlg , int ID ) { m_DialogID = ID; m_ContainedDialog = dlg; - + CRect rect; CPoint point (-10 , -10); m_ContainedDialog->GetWindowRect ( rect ); - + rect.OffsetRect(point); //move the window slightly so you can tell it's been popped up //stupid hack to get the window resize itself properly rect.DeflateRect(0,0,0,1); - MoveWindow(rect); + MoveWindow(rect); rect.InflateRect(0,0,0,1); - MoveWindow(rect); + MoveWindow(rect); } void CTearoffContainerWindow::SetDockManager ( CTabsDlg* dlg ) @@ -97,7 +97,7 @@ void CTearoffContainerWindow::SetDockManager ( CTabsDlg* dlg ) } void CTearoffContainerWindow::OnClose() { - if ( m_DockManager ) + if ( m_DockManager ) { //send it back to the docking window (for now at least) m_DockManager->DockWindow ( m_DialogID , true ); @@ -105,7 +105,7 @@ void CTearoffContainerWindow::OnClose() } -BOOL CTearoffContainerWindow:: PreTranslateMessage( MSG* pMsg ) +BOOL CTearoffContainerWindow:: PreTranslateMessage( MSG* pMsg ) { if ( pMsg->message == WM_NCLBUTTONUP ) { @@ -124,11 +124,11 @@ BOOL CTearoffContainerWindow:: PreTranslateMessage( MSG* pMsg ) } void CTearoffContainerWindow::OnSize(UINT nType, int cx, int cy) { - if ( m_ContainedDialog ) + if ( m_ContainedDialog ) { - m_ContainedDialog->MoveWindow ( 0,0,cx,cy); + m_ContainedDialog->MoveWindow ( 0,0,cx,cy); } - + CWnd::OnSize(nType, cx, cy); } @@ -142,7 +142,7 @@ void CTearoffContainerWindow::OnDestroy() void CTearoffContainerWindow::OnSetFocus(CWnd* pOldWnd) { CWnd::OnSetFocus(pOldWnd); - if ( m_ContainedDialog ) + if ( m_ContainedDialog ) { m_ContainedDialog->SetFocus(); } diff --git a/neo/tools/radiant/TearoffContainerWindow.h b/neo/tools/radiant/TearoffContainerWindow.h index 6106550f..ed7ccd41 100644 --- a/neo/tools/radiant/TearoffContainerWindow.h +++ b/neo/tools/radiant/TearoffContainerWindow.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: protected: DECLARE_MESSAGE_MAP() - bool m_DragPreviewActive; + bool m_DragPreviewActive; public: afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point); void SetDialog ( CWnd* dlg , int ID ); @@ -55,5 +55,3 @@ public: afx_msg void OnDestroy(); afx_msg void OnSetFocus(CWnd* pOldWnd); }; - - diff --git a/neo/tools/radiant/TextureBar.cpp b/neo/tools/radiant/TextureBar.cpp index ea659333..1551e1c4 100644 --- a/neo/tools/radiant/TextureBar.cpp +++ b/neo/tools/radiant/TextureBar.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"). @@ -94,36 +94,36 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CTextureBar message handlers -void CTextureBar::OnDeltaposSpinHshift(NMHDR* pNMHDR, LRESULT* pResult) +void CTextureBar::OnDeltaposSpinHshift(NMHDR* pNMHDR, LRESULT* pResult) { NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; *pResult = 0; if (pNMUpDown->iDelta < 0) - Select_ShiftTexture(abs(g_qeglobals.d_savedinfo.m_nTextureTweak), 0); + Select_ShiftTexture(abs(g_qeglobals.d_savedinfo.m_nTextureTweak), 0); else - Select_ShiftTexture(-abs(g_qeglobals.d_savedinfo.m_nTextureTweak), 0); + Select_ShiftTexture(-abs(g_qeglobals.d_savedinfo.m_nTextureTweak), 0); GetSurfaceAttributes(); } -void CTextureBar::OnDeltaposSpinVshift(NMHDR* pNMHDR, LRESULT* pResult) +void CTextureBar::OnDeltaposSpinVshift(NMHDR* pNMHDR, LRESULT* pResult) { NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; // TODO: Add your control notification handler code here - + *pResult = 0; if (pNMUpDown->iDelta < 0) - Select_ShiftTexture(0, abs(g_qeglobals.d_savedinfo.m_nTextureTweak)); + Select_ShiftTexture(0, abs(g_qeglobals.d_savedinfo.m_nTextureTweak)); else - Select_ShiftTexture(0, -abs(g_qeglobals.d_savedinfo.m_nTextureTweak)); + Select_ShiftTexture(0, -abs(g_qeglobals.d_savedinfo.m_nTextureTweak)); GetSurfaceAttributes(); } -void CTextureBar::OnDeltaposSpinHScale(NMHDR* pNMHDR, LRESULT* pResult) +void CTextureBar::OnDeltaposSpinHScale(NMHDR* pNMHDR, LRESULT* pResult) { NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; // TODO: Add your control notification handler code here - + *pResult = 0; if (pNMUpDown->iDelta < 0) Select_ScaleTexture((float)abs(g_qeglobals.d_savedinfo.m_nTextureTweak),0); @@ -132,11 +132,11 @@ void CTextureBar::OnDeltaposSpinHScale(NMHDR* pNMHDR, LRESULT* pResult) GetSurfaceAttributes(); } -void CTextureBar::OnDeltaposSpinVScale(NMHDR* pNMHDR, LRESULT* pResult) +void CTextureBar::OnDeltaposSpinVScale(NMHDR* pNMHDR, LRESULT* pResult) { NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; // TODO: Add your control notification handler code here - + *pResult = 0; if (pNMUpDown->iDelta < 0) Select_ScaleTexture(0, (float)abs(g_qeglobals.d_savedinfo.m_nTextureTweak)); @@ -145,26 +145,26 @@ void CTextureBar::OnDeltaposSpinVScale(NMHDR* pNMHDR, LRESULT* pResult) GetSurfaceAttributes(); } -void CTextureBar::OnDeltaposSpinRotate(NMHDR* pNMHDR, LRESULT* pResult) +void CTextureBar::OnDeltaposSpinRotate(NMHDR* pNMHDR, LRESULT* pResult) { NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; *pResult = 0; UpdateData(TRUE); if (pNMUpDown->iDelta < 0) - Select_RotateTexture(abs(m_nRotateAmt)); + Select_RotateTexture(abs(m_nRotateAmt)); else - Select_RotateTexture(-abs(m_nRotateAmt)); + Select_RotateTexture(-abs(m_nRotateAmt)); GetSurfaceAttributes(); } -void CTextureBar::OnSelectionPrint() +void CTextureBar::OnSelectionPrint() { // TODO: Add your command handler code here - + } -int CTextureBar::OnCreate(LPCREATESTRUCT lpCreateStruct) +int CTextureBar::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDialogBar::OnCreate(lpCreateStruct) == -1) return -1; @@ -172,7 +172,7 @@ int CTextureBar::OnCreate(LPCREATESTRUCT lpCreateStruct) } -void CTextureBar::OnBtnApplytexturestuff() +void CTextureBar::OnBtnApplytexturestuff() { SetSurfaceAttributes(); } @@ -183,12 +183,12 @@ void CTextureBar::GetSurfaceAttributes() if (pt) { - m_nHShift = pt->shift[0]; - m_nVShift = pt->shift[1]; - m_nHScale = pt->scale[0]; - m_nVScale = pt->scale[1]; - m_nRotate = pt->rotate; - UpdateData(FALSE); + m_nHShift = pt->shift[0]; + m_nVShift = pt->shift[1]; + m_nHScale = pt->scale[0]; + m_nVScale = pt->scale[1]; + m_nRotate = pt->rotate; + UpdateData(FALSE); } } @@ -198,18 +198,18 @@ void CTextureBar::SetSurfaceAttributes() if (g_ptrSelectedFaces.GetSize() > 0) { if (g_qeglobals.m_bBrushPrimitMode) - { + { common->Printf("Warning : brush primitive mode not implemented in CTextureBar"); - } - face_t *selFace = reinterpret_cast(g_ptrSelectedFaces.GetAt(0)); + } + face_t *selFace = reinterpret_cast(g_ptrSelectedFaces.GetAt(0)); texdef_t* pt = &selFace->texdef; - UpdateData(TRUE); - pt->shift[0] = m_nHShift; - pt->shift[1] = m_nVShift; - pt->scale[0] = m_nHScale; - pt->scale[1] = m_nVScale; - pt->rotate = m_nRotate; - Sys_UpdateWindows(W_CAMERA); + UpdateData(TRUE); + pt->shift[0] = m_nHShift; + pt->shift[1] = m_nVShift; + pt->scale[0] = m_nHScale; + pt->scale[1] = m_nVScale; + pt->rotate = m_nRotate; + Sys_UpdateWindows(W_CAMERA); } } diff --git a/neo/tools/radiant/TextureBar.h b/neo/tools/radiant/TextureBar.h index 2baf6012..c4e8d17a 100644 --- a/neo/tools/radiant/TextureBar.h +++ b/neo/tools/radiant/TextureBar.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/neo/tools/radiant/Textures.h b/neo/tools/radiant/Textures.h index 06cab05c..0ca8e3fa 100644 --- a/neo/tools/radiant/Textures.h +++ b/neo/tools/radiant/Textures.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/neo/tools/radiant/Undo.cpp b/neo/tools/radiant/Undo.cpp index 58a647df..ed0dd952 100644 --- a/neo/tools/radiant/Undo.cpp +++ b/neo/tools/radiant/Undo.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"). @@ -282,7 +282,7 @@ void Undo_GeneralStart(char *operation) undo->prev = g_lastundo; undo->next = NULL; g_lastundo = undo; - + undo->time = Sys_DoubleTime(); // if (g_undoId > g_undoMaxSize * 2) g_undoId = 1; @@ -711,7 +711,7 @@ void Undo_Undo(void) { g_undoMemorySize -= Brush_MemorySize(pBrush); Brush_RemoveFromList(pBrush); - Brush_AddToList(pBrush, &active_brushes); + Brush_AddToList(pBrush, &active_brushes); for (pEntity = entities.next; pEntity != NULL && pEntity != &entities; pEntity = pEntity->next) { if (pEntity->entityId == pBrush->ownerId) @@ -729,7 +729,7 @@ void Undo_Undo(void) //Brush_Build(pBrush); Select_Brush(pBrush); pBrush->redoId = redo->id; - } + } // common->Printf("%s undone.\n", undo->operation); // free the undo @@ -752,8 +752,8 @@ void Undo_Undo(void) } Sys_EndWait(); - g_bScreenUpdates = true; - Sys_UpdateWindows(W_ALL); + g_bScreenUpdates = true; + Sys_UpdateWindows(W_ALL); } /* @@ -851,7 +851,7 @@ void Undo_Redo(void) for (pBrush = redo->brushlist.next; pBrush != NULL && pBrush != &redo->brushlist; pBrush = redo->brushlist.next) { Brush_RemoveFromList(pBrush); - Brush_AddToList(pBrush, &active_brushes); + Brush_AddToList(pBrush, &active_brushes); for (pEntity = entities.next; pEntity != NULL && pEntity != &entities; pEntity = pEntity->next) { if (pEntity->entityId == pBrush->ownerId) @@ -868,7 +868,7 @@ void Undo_Redo(void) //build the brush //Brush_Build(pBrush); Select_Brush(pBrush); - } + } // Undo_End(); // @@ -878,8 +878,8 @@ void Undo_Redo(void) // free the undo Mem_Free(redo); // - g_bScreenUpdates = true; - Sys_UpdateWindows(W_ALL); + g_bScreenUpdates = true; + Sys_UpdateWindows(W_ALL); } /* diff --git a/neo/tools/radiant/Undo.h b/neo/tools/radiant/Undo.h index f4f5c96c..998ab2b5 100644 --- a/neo/tools/radiant/Undo.h +++ b/neo/tools/radiant/Undo.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"). @@ -62,4 +62,3 @@ void Undo_SetMaxMemorySize(int size); int Undo_GetMaxMemorySize(void); //returns the amount of memory used by undo int Undo_MemorySize(void); - diff --git a/neo/tools/radiant/VERTSEL.CPP b/neo/tools/radiant/VERTSEL.CPP index 20ea81ea..8b5624f6 100644 --- a/neo/tools/radiant/VERTSEL.CPP +++ b/neo/tools/radiant/VERTSEL.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"). @@ -89,7 +89,7 @@ int FindEdge(int p1, int p2, face_t *f) { void MakeFace (brush_t * b, face_t * f) #else void MakeFace (face_t * f) -#endif +#endif { idWinding *w; int i; @@ -146,7 +146,7 @@ void SetupVertexSelection(void) { void SelectFaceEdge (brush_t * b, face_t * f, int p1, int p2) #else void SelectFaceEdge (face_t * f, int p1, int p2) -#endif +#endif { idWinding *w; int i, j, k; diff --git a/neo/tools/radiant/WIN_DLG.CPP b/neo/tools/radiant/WIN_DLG.CPP index 7981dfa4..576e520d 100644 --- a/neo/tools/radiant/WIN_DLG.CPP +++ b/neo/tools/radiant/WIN_DLG.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,10 +32,10 @@ If you have questions concerning this license or the applicable additional terms #include "qe3.h" BOOL CALLBACK EditCommandDlgProc ( - HWND hwndDlg, // handle to dialog box - UINT uMsg, // message - WPARAM wParam, // first message parameter - LPARAM lParam // second message parameter + HWND hwndDlg, // handle to dialog box + UINT uMsg, // message + WPARAM wParam, // first message parameter + LPARAM lParam // second message parameter ) { char key[1024]; @@ -43,27 +43,27 @@ BOOL CALLBACK EditCommandDlgProc ( const char *temp; int index; HWND hOwner; - + hOwner = GetParent (hwndDlg); switch (uMsg) - { + { case WM_INITDIALOG: index = SendDlgItemMessage (hOwner, IDC_CMD_LIST, LB_GETCURSEL, 0, 0); - if (index >= 0) - { + if (index >= 0) + { SendDlgItemMessage(hOwner, IDC_CMD_LIST, LB_GETTEXT, index, (LPARAM) (LPCTSTR) key); temp = ValueForKey (g_qeglobals.d_project_entity, key); strcpy (value, temp); SetDlgItemText(hwndDlg, IDC_CMDMENUTEXT, key); SetDlgItemText(hwndDlg, IDC_CMDCOMMAND, value); - } + } return FALSE; break; - case WM_COMMAND: - switch (LOWORD(wParam)) - { + case WM_COMMAND: + switch (LOWORD(wParam)) + { case IDOK: if (!GetDlgItemText(hwndDlg, IDC_CMDMENUTEXT, key, 64)) { @@ -97,20 +97,20 @@ BOOL CALLBACK EditCommandDlgProc ( } BOOL CALLBACK AddCommandDlgProc ( - HWND hwndDlg, // handle to dialog box - UINT uMsg, // message - WPARAM wParam, // first message parameter - LPARAM lParam // second message parameter + HWND hwndDlg, // handle to dialog box + UINT uMsg, // message + WPARAM wParam, // first message parameter + LPARAM lParam // second message parameter ) { char key[64]; char value[128]; switch (uMsg) - { - case WM_COMMAND: - switch (LOWORD(wParam)) - { + { + case WM_COMMAND: + switch (LOWORD(wParam)) + { case IDOK: if (!GetDlgItemText(hwndDlg, IDC_CMDMENUTEXT, key, 64)) { @@ -162,10 +162,10 @@ void UpdateBSPCommandList (HWND hwndDlg) // FIXME: turn this into an MFC dialog BOOL CALLBACK ProjectDlgProc ( - HWND hwndDlg, // handle to dialog box - UINT uMsg, // message - WPARAM wParam, // first message parameter - LPARAM lParam // second message parameter + HWND hwndDlg, // handle to dialog box + UINT uMsg, // message + WPARAM wParam, // first message parameter + LPARAM lParam // second message parameter ) { char key[1024]; @@ -173,7 +173,7 @@ BOOL CALLBACK ProjectDlgProc ( int index; switch (uMsg) - { + { case WM_INITDIALOG: SetDlgItemText(hwndDlg, IDC_PRJBASEPATH, ValueForKey (g_qeglobals.d_project_entity, "basepath")); SetDlgItemText(hwndDlg, IDC_PRJMAPSPATH, ValueForKey (g_qeglobals.d_project_entity, "mapspath")); @@ -188,9 +188,9 @@ BOOL CALLBACK ProjectDlgProc ( // SendMessage( ::GetDlgItem( hwndDlg, IDC_CHECK_BPRIMIT ), BM_SETCHECK, (WPARAM) g_qeglobals.m_bBrushPrimitMode, 0 ); return TRUE; - case WM_COMMAND: - switch (LOWORD(wParam)) - { + case WM_COMMAND: + switch (LOWORD(wParam)) + { case IDC_ADDCMD: // DialogBox(g_qeglobals.d_hInstance, (char *)IDD_ADDCMD, g_qeglobals.d_hwndMain, AddCommandDlgProc); DialogBox(g_qeglobals.d_hInstance, (char *)IDD_ADDCMD, hwndDlg, AddCommandDlgProc); @@ -256,24 +256,24 @@ void DoProjectSettings() BOOL CALLBACK GammaDlgProc ( - HWND hwndDlg, // handle to dialog box - UINT uMsg, // message - WPARAM wParam, // first message parameter - LPARAM lParam // second message parameter + HWND hwndDlg, // handle to dialog box + UINT uMsg, // message + WPARAM wParam, // first message parameter + LPARAM lParam // second message parameter ) { char sz[256]; switch (uMsg) - { + { case WM_INITDIALOG: - sprintf(sz, "%1.1f", g_qeglobals.d_savedinfo.fGamma); + sprintf(sz, "%1.1f", g_qeglobals.d_savedinfo.fGamma); SetWindowText(GetDlgItem(hwndDlg, IDC_G_EDIT), sz); return TRUE; - case WM_COMMAND: - switch (LOWORD(wParam)) - { - + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDOK: GetWindowText(GetDlgItem(hwndDlg, IDC_G_EDIT), sz, 255); g_qeglobals.d_savedinfo.fGamma = atof(sz); @@ -295,7 +295,7 @@ void DoGamma(void) if ( DialogBox(g_qeglobals.d_hInstance, (char *)IDD_GAMMA, g_pParentWnd->GetSafeHwnd(), GammaDlgProc)) { } -} +} //================================================ @@ -345,14 +345,14 @@ void SelectBrush (int entitynum, int brushnum) Sys_UpdateWindows (W_ALL); for (i=0 ; i<3 ; i++) { - if (g_pParentWnd->GetXYWnd()) - g_pParentWnd->GetXYWnd()->GetOrigin()[i] = (b->mins[i] + b->maxs[i])/2; + if (g_pParentWnd->GetXYWnd()) + g_pParentWnd->GetXYWnd()->GetOrigin()[i] = (b->mins[i] + b->maxs[i])/2; - if (g_pParentWnd->GetXZWnd()) - g_pParentWnd->GetXZWnd()->GetOrigin()[i] = (b->mins[i] + b->maxs[i])/2; - - if (g_pParentWnd->GetYZWnd()) - g_pParentWnd->GetYZWnd()->GetOrigin()[i] = (b->mins[i] + b->maxs[i])/2; + if (g_pParentWnd->GetXZWnd()) + g_pParentWnd->GetXZWnd()->GetOrigin()[i] = (b->mins[i] + b->maxs[i])/2; + + if (g_pParentWnd->GetYZWnd()) + g_pParentWnd->GetYZWnd()->GetOrigin()[i] = (b->mins[i] + b->maxs[i])/2; } Sys_Status ("Selected.", 0); @@ -378,23 +378,23 @@ void GetSelectionIndex (int *ent, int *brush) if (b->owner != world_entity) { (*ent)++; - for (entity = entities.next ; entity != &entities + for (entity = entities.next ; entity != &entities ; entity=entity->next, (*ent)++) ; } // find brush - for (b2=b->owner->brushes.onext + for (b2=b->owner->brushes.onext ; b2 != b && b2 != &b->owner->brushes ; b2=b2->onext, (*brush)++) ; } BOOL CALLBACK FindBrushDlgProc ( - HWND hwndDlg, // handle to dialog box - UINT uMsg, // message - WPARAM wParam, // first message parameter - LPARAM lParam // second message parameter + HWND hwndDlg, // handle to dialog box + UINT uMsg, // message + WPARAM wParam, // first message parameter + LPARAM lParam // second message parameter ) { char entstr[256]; @@ -403,7 +403,7 @@ BOOL CALLBACK FindBrushDlgProc ( int ent, brush; switch (uMsg) - { + { case WM_INITDIALOG: // set entity and brush number GetSelectionIndex (&ent, &brush); @@ -416,9 +416,9 @@ BOOL CALLBACK FindBrushDlgProc ( SetFocus (h); return FALSE; - case WM_COMMAND: - switch (LOWORD(wParam)) - { + case WM_COMMAND: + switch (LOWORD(wParam)) + { case IDOK: GetWindowText(GetDlgItem(hwndDlg, IDC_FIND_ENTITY), entstr, 255); GetWindowText(GetDlgItem(hwndDlg, IDC_FIND_BRUSH), brushstr, 255); @@ -429,7 +429,7 @@ BOOL CALLBACK FindBrushDlgProc ( case IDCANCEL: EndDialog(hwndDlg, 0); return TRUE; - } + } } return FALSE; } @@ -439,8 +439,8 @@ BOOL CALLBACK FindBrushDlgProc ( void DoFind(void) { DialogBox(g_qeglobals.d_hInstance, (char *)IDD_FINDBRUSH, g_pParentWnd->GetSafeHwnd(), FindBrushDlgProc); -} - +} + /* =================================================== @@ -451,10 +451,10 @@ void DoFind(void) BOOL CALLBACK RotateDlgProc ( - HWND hwndDlg, // handle to dialog box - UINT uMsg, // message - WPARAM wParam, // first message parameter - LPARAM lParam // second message parameter + HWND hwndDlg, // handle to dialog box + UINT uMsg, // message + WPARAM wParam, // first message parameter + LPARAM lParam // second message parameter ) { char str[256]; @@ -462,16 +462,16 @@ BOOL CALLBACK RotateDlgProc ( float v; switch (uMsg) - { + { case WM_INITDIALOG: h = GetDlgItem(hwndDlg, IDC_FIND_ENTITY); SetFocus (h); return FALSE; - case WM_COMMAND: - switch (LOWORD(wParam)) - { - + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDOK: GetWindowText(GetDlgItem(hwndDlg, IDC_ROTX), str, 255); v = atof(str); @@ -494,7 +494,7 @@ BOOL CALLBACK RotateDlgProc ( case IDCANCEL: EndDialog(hwndDlg, 0); return TRUE; - } + } } return FALSE; @@ -506,7 +506,7 @@ void DoRotate(void) { DialogBox(g_qeglobals.d_hInstance, (char *)IDD_ROTATE, g_pParentWnd->GetSafeHwnd(), RotateDlgProc); } - + /* =================================================== @@ -518,32 +518,32 @@ void DoRotate(void) bool g_bDoCone = false; bool g_bDoSphere = false; BOOL CALLBACK SidesDlgProc ( - HWND hwndDlg, // handle to dialog box - UINT uMsg, // message - WPARAM wParam, // first message parameter - LPARAM lParam // second message parameter + HWND hwndDlg, // handle to dialog box + UINT uMsg, // message + WPARAM wParam, // first message parameter + LPARAM lParam // second message parameter ) { char str[256]; HWND h; switch (uMsg) - { + { case WM_INITDIALOG: h = GetDlgItem(hwndDlg, IDC_SIDES); SetFocus (h); return FALSE; - case WM_COMMAND: - switch (LOWORD(wParam)) { - + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDOK: GetWindowText(GetDlgItem(hwndDlg, IDC_SIDES), str, 255); - if (g_bDoCone) + if (g_bDoCone) Brush_MakeSidedCone(atoi(str)); - else if (g_bDoSphere) + else if (g_bDoSphere) Brush_MakeSidedSphere(atoi(str)); - else + else Brush_MakeSided (atoi(str)); EndDialog(hwndDlg, 1); @@ -552,7 +552,7 @@ BOOL CALLBACK SidesDlgProc ( case IDCANCEL: EndDialog(hwndDlg, 0); break; - } + } default: return FALSE; } @@ -565,7 +565,7 @@ void DoSides(bool bCone, bool bSphere, bool bTorus) g_bDoSphere = bSphere; //g_bDoTorus = bTorus; DialogBox(g_qeglobals.d_hInstance, (char *)IDD_SIDES, g_pParentWnd->GetSafeHwnd(), SidesDlgProc); -} +} //====================================================================== @@ -576,12 +576,12 @@ DoAbout =================== */ BOOL CALLBACK AboutDlgProc( HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam ) + UINT uMsg, + WPARAM wParam, + LPARAM lParam ) { switch (uMsg) - { + { case WM_INITDIALOG: { char buffer[1024]; @@ -631,5 +631,3 @@ void DoAbout(void) { DialogBox( g_qeglobals.d_hInstance, ( char * ) IDD_ABOUT, g_pParentWnd->GetSafeHwnd(), AboutDlgProc ); } - - diff --git a/neo/tools/radiant/WIN_QE3.CPP b/neo/tools/radiant/WIN_QE3.CPP index ef1dbd2f..5734ea87 100644 --- a/neo/tools/radiant/WIN_QE3.CPP +++ b/neo/tools/radiant/WIN_QE3.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"). @@ -240,7 +240,7 @@ int WINAPI QEW_SetupPixelFormat(HDC hDC, bool zbuffer) /* ======================================================================================================================= - Error For abnormal program terminations + Error For abnormal program terminations ======================================================================================================================= */ void Error(char *error, ...) { @@ -296,7 +296,7 @@ void Warning(char *error, ...) { /* ======================================================================================================================= - FILE DIALOGS + FILE DIALOGS ======================================================================================================================= */ bool ConfirmModified(void) { diff --git a/neo/tools/radiant/WaitDlg.cpp b/neo/tools/radiant/WaitDlg.cpp index fc16f71c..fbb0c40f 100644 --- a/neo/tools/radiant/WaitDlg.cpp +++ b/neo/tools/radiant/WaitDlg.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,21 +74,21 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CWaitDlg message handlers -BOOL CWaitDlg::OnInitDialog() +BOOL CWaitDlg::OnInitDialog() { CDialog::OnInitDialog(); //GetDlgItem(IDC_WAITSTR)->SetWindowText(waitStr); GetDlgItem(IDC_WAITSTR)->SetFocus(); UpdateData(FALSE); ShowWindow(SW_SHOW); - + // cancel disabled by default AllowCancel( false ); // TODO: Add extra initialization here - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } void CWaitDlg::SetText(const char *msg, bool append) { diff --git a/neo/tools/radiant/WaitDlg.h b/neo/tools/radiant/WaitDlg.h index 8259a636..2b0dd93f 100644 --- a/neo/tools/radiant/WaitDlg.h +++ b/neo/tools/radiant/WaitDlg.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/neo/tools/radiant/WaveOpen.cpp b/neo/tools/radiant/WaveOpen.cpp index e09bd2ad..e17a7434 100644 --- a/neo/tools/radiant/WaveOpen.cpp +++ b/neo/tools/radiant/WaveOpen.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,38 +68,38 @@ void CWaveOpen::OnFileNameChange() CWnd *pWnd = GetDlgItem(IDC_BTN_PLAY); if (pWnd == NULL) { - return; + return; } if (str.Find(".wav") >= 0) { - pWnd->EnableWindow(TRUE); + pWnd->EnableWindow(TRUE); } else { - pWnd->EnableWindow(FALSE); + pWnd->EnableWindow(FALSE); } } -void CWaveOpen::OnBtnPlay() +void CWaveOpen::OnBtnPlay() { sndPlaySound(NULL, NULL); CString str = GetPathName(); if (str.GetLength() > 0) { - sndPlaySound(str, SND_FILENAME | SND_ASYNC); + sndPlaySound(str, SND_FILENAME | SND_ASYNC); } } -BOOL CWaveOpen::OnInitDialog() +BOOL CWaveOpen::OnInitDialog() { CFileDialog::OnInitDialog(); - + CWnd *pWnd = GetDlgItem(IDC_BTN_PLAY); if (pWnd != NULL) { - pWnd->EnableWindow(FALSE); + pWnd->EnableWindow(FALSE); } - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } diff --git a/neo/tools/radiant/WaveOpen.h b/neo/tools/radiant/WaveOpen.h index aec0d494..23b550e2 100644 --- a/neo/tools/radiant/WaveOpen.h +++ b/neo/tools/radiant/WaveOpen.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/neo/tools/radiant/XYWnd.cpp b/neo/tools/radiant/XYWnd.cpp index 5afb45c1..7d58e994 100644 --- a/neo/tools/radiant/XYWnd.cpp +++ b/neo/tools/radiant/XYWnd.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"). @@ -283,9 +283,9 @@ void VectorToAngles(idVec3 vec, idVec3 angles) { /* ======================================================================================================================= - RotateLight target is relative to the light origin up and right are relative to the target up and right are - perpendicular and are on a plane through the target with the target vector as normal delta is the movement of the - target relative to the light + RotateLight target is relative to the light origin up and right are relative to the target up and right are + perpendicular and are on a plane through the target with the target vector as normal delta is the movement of the + target relative to the light ======================================================================================================================= */ void VectorSnapGrid(idVec3 &v) { @@ -638,7 +638,7 @@ static unsigned s_stipple[32] = { /* ======================================================================================================================= - WXY_WndProc + WXY_WndProc ======================================================================================================================= */ LONG WINAPI XYWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -1368,7 +1368,7 @@ void CXYWnd::OnMouseMove(UINT nFlags, CPoint point) { SetCursor(::LoadCursor(NULL, IDC_ARROW)); } - /// If precision crosshair is active, force redraw of the 2d view on mouse move + /// If precision crosshair is active, force redraw of the 2d view on mouse move if( m_precisionCrosshairMode != PRECISION_CROSSHAIR_NONE ) { /// Force 2d view redraw (so that the precision cursor moves with the mouse) @@ -2097,7 +2097,7 @@ bool MergeMenu(CMenu * pMenuDestination, const CMenu * pMenuAdd, bool bTopLevel // insert the new popup menu into the destination menu HMENU hNewMenu = NewPopupMenu.GetSafeHmenu(); if (pMenuDestination->InsertMenu(iInsertPosDefault, - MF_BYPOSITION | MF_POPUP | MF_ENABLED, + MF_BYPOSITION | MF_POPUP | MF_ENABLED, (UINT)hNewMenu, sMenuAddString )) { // don't forget to correct the item count @@ -2109,7 +2109,7 @@ bool MergeMenu(CMenu * pMenuDestination, const CMenu * pMenuAdd, bool bTopLevel return false; } - // don't destroy the new menu + // don't destroy the new menu NewPopupMenu.Detach(); } // if (pSubMenu) } // for (iLoop) @@ -2130,7 +2130,7 @@ void CXYWnd::HandleDrop() { if (!m_mnuDrop.GetSafeHmenu()) { // first time, load it up m_mnuDrop.CreatePopupMenu(); - + CMenu *drop = new CMenu; drop->LoadMenu( IDR_MENU_DROP ); @@ -2517,7 +2517,7 @@ bool CXYWnd::DragDelta(int x, int y, idVec3 &move) { /* ======================================================================================================================= - NewBrushDrag + NewBrushDrag ======================================================================================================================= */ void CXYWnd::NewBrushDrag(int x, int y) { @@ -2584,7 +2584,7 @@ void CXYWnd::NewBrushDrag(int x, int y) { /* ======================================================================================================================= - XY_MouseMoved + XY_MouseMoved ======================================================================================================================= */ bool CXYWnd::XY_MouseMoved(int x, int y, int buttons) { @@ -2734,8 +2734,8 @@ bool CXYWnd::XY_MouseMoved(int x, int y, int buttons) { /* ======================================================================================================================= - DRAWING £ - XY_DrawGrid + DRAWING £ + XY_DrawGrid ======================================================================================================================= */ void CXYWnd::XY_DrawGrid() { @@ -2785,7 +2785,7 @@ void CXYWnd::XY_DrawGrid() { int stepSize = 64 * 0.1 / m_fScale; if (stepSize < 64) { - stepSize = max ( 64 , g_qeglobals.d_gridsize ); + stepSize = max ( 64 , g_qeglobals.d_gridsize ); } else { int i; @@ -2863,10 +2863,10 @@ void CXYWnd::XY_DrawGrid() { qglEnd (); qglLineWidth(1); } - } + } } - + // draw coordinate text if needed @@ -2916,7 +2916,7 @@ void CXYWnd::XY_DrawGrid() { /* ======================================================================================================================= - XY_DrawBlockGrid + XY_DrawBlockGrid ======================================================================================================================= */ void CXYWnd::XY_DrawBlockGrid() { @@ -2990,7 +2990,7 @@ void CXYWnd::XY_DrawBlockGrid() { } void GLColoredBoxWithLabel(float x, float y, float size, idVec4 color, const char *text, idVec4 textColor, float xofs, float yofs, float lineSize) { - globalImages->BindNull(); + globalImages->BindNull(); qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL); qglDisable(GL_CULL_FACE); qglDisable(GL_BLEND); @@ -3092,7 +3092,7 @@ void CXYWnd::DrawCameraIcon() { a = g_pParentWnd->GetCamera()->Camera().angles[PITCH] * idMath::M_DEG2RAD; } - float scale = 1.0/m_fScale; //jhefty - keep the camera icon proportionally the same size + float scale = 1.0/m_fScale; //jhefty - keep the camera icon proportionally the same size qglColor3f(0.0, 0.0, 1.0); qglBegin(GL_LINE_STRIP); @@ -3161,11 +3161,11 @@ void CXYWnd::DrawZIcon(void) { /* ======================================================================================================================= - FilterBrush + FilterBrush ======================================================================================================================= */ bool FilterBrush(brush_t *pb) { - + if (!pb->owner) { return false; // during construction } @@ -3186,7 +3186,7 @@ bool FilterBrush(brush_t *pb) { // if (pb->mins[2] > g_pParentWnd->GetZWnd()->m_pZClip->GetTop() // brush bottom edge is above clip top || - pb->maxs[2] < g_pParentWnd->GetZWnd()->m_pZClip->GetBottom()// brush top edge is below clip bottom + pb->maxs[2] < g_pParentWnd->GetZWnd()->m_pZClip->GetBottom()// brush top edge is below clip bottom ) { return TRUE; @@ -3261,7 +3261,7 @@ bool FilterBrush(brush_t *pb) { if (pb->modelHandle > 0) { idRenderModel *model = pb->modelHandle; if ( dynamic_cast(model) ) { - return true; + return true; } } } @@ -3306,9 +3306,9 @@ bool FilterBrush(brush_t *pb) { /* ======================================================================================================================= - PATH LINES £ - DrawPathLines Draws connections between entities. Needs to consider all entities, not just ones on screen, because - the lines can be visible when neither end is. Called for both camera view and xy view. + PATH LINES £ + DrawPathLines Draws connections between entities. Needs to consider all entities, not just ones on screen, because + the lines can be visible when neither end is. Called for both camera view and xy view. ======================================================================================================================= */ void DrawPathLines(void) { @@ -3792,7 +3792,7 @@ void CXYWnd::XY_Draw() { // area selection hack if (g_qeglobals.d_select_mode == sel_area) { qglEnable(GL_BLEND); - qglPolygonMode ( GL_FRONT_AND_BACK , GL_FILL ); + qglPolygonMode ( GL_FRONT_AND_BACK , GL_FILL ); qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qglColor4f(0.0, 0.0, 1.0, 0.25); qglRectf @@ -3803,7 +3803,7 @@ void CXYWnd::XY_Draw() { g_qeglobals.d_vAreaBR[nDim2] ); qglDisable(GL_BLEND); - qglPolygonMode ( GL_FRONT_AND_BACK , GL_LINE ); + qglPolygonMode ( GL_FRONT_AND_BACK , GL_LINE ); qglColor3f(1.0f, 1.0f, 1.0f); qglRectf ( @@ -3823,7 +3823,7 @@ void CXYWnd::XY_Draw() { DrawRotateIcon(); } - /// Draw a "precision crosshair" if enabled + /// Draw a "precision crosshair" if enabled if( m_precisionCrosshairMode != PRECISION_CROSSHAIR_NONE ) DrawPrecisionCrosshair(); @@ -4383,7 +4383,7 @@ void CXYWnd::OnTimer(UINT nIDEvent) { // m_vOrigin[nDim1] -= m_ptDrag.x / m_fScale; m_vOrigin[nDim1] -= m_ptDrag.x / // m_fScale; // - } + } } /* @@ -4450,7 +4450,7 @@ BOOL CXYWnd::OnEraseBkgnd(CDC *pDC) { } extern void AssignModel(); -void CXYWnd::OnDropNewmodel() +void CXYWnd::OnDropNewmodel() { CPoint point; GetCursorPos(&point); @@ -4459,7 +4459,7 @@ void CXYWnd::OnDropNewmodel() g_Inspectors->AssignModel(); } -BOOL CXYWnd::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) +BOOL CXYWnd::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) { if (zDelta > 0) { g_pParentWnd->OnViewZoomin(); @@ -4474,7 +4474,7 @@ BOOL CXYWnd::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) //--------------------------------------------------------------------------- // CyclePrecisionCrosshairMode - // + // // Called when the user presses the "cycle precision cursor mode" key. // Cycles the precision cursor among the following three modes: // PRECISION_CURSOR_NONE @@ -4493,11 +4493,11 @@ BOOL CXYWnd::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) } //--------------------------------------------------------------------------- -// DrawPrecisionCrosshair -// +// DrawPrecisionCrosshair +// // Draws a precision crosshair beneath the cursor in the 2d (XY) view, // depending on one of the following values for m_precisionCrosshairMode: -// +// // PRECISION_CROSSHAIR_NONE No crosshair is drawn. Do not force refresh of XY view. // PRECISION_CROSSHAIR_SNAP Crosshair snaps to grid size. Force refresh of XY view. // PRECISION_CROSSHAIR_FREE Crosshair does not snap to grid. Force refresh of XY view. @@ -4511,7 +4511,7 @@ void CXYWnd::DrawPrecisionCrosshair( void ) float x, y; idVec4 crossEndColor (1.0f, 0.0f, 1.0f, 1.0f); // the RGBA color of the precision crosshair at its ends idVec4 crossMidColor; // the RGBA color of the precision crosshair at the crossing point - + /// Transform the mouse coordinates into axis-correct map-coordinates if( m_precisionCrosshairMode == PRECISION_CROSSHAIR_SNAP ) SnapToPoint( m_mouseX, m_mouseY, mouse3dPos ); @@ -4519,7 +4519,7 @@ void CXYWnd::DrawPrecisionCrosshair( void ) XY_ToPoint( m_mouseX, m_mouseY, mouse3dPos ); x = mouse3dPos[ m_axisHoriz ]; y = mouse3dPos[ m_axisVert ]; - + /// Use the color specified by the user crossEndColor[0] = g_qeglobals.d_savedinfo.colors[ COLOR_PRECISION_CROSSHAIR ][0]; @@ -4531,13 +4531,13 @@ void CXYWnd::DrawPrecisionCrosshair( void ) if( m_precisionCrosshairMode == PRECISION_CROSSHAIR_FREE ) crossMidColor[ 3 ] = 0.0f; // intersection-color is 100% transparent (alpha = 0.0f) - + /// Set up OpenGL states (for drawing smooth-shaded plain-colored lines) qglEnable( GL_BLEND ); qglDisable( GL_TEXTURE_2D ); qglShadeModel( GL_SMOOTH ); qglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); - + /// Draw a fullscreen-sized crosshair over the cursor qglBegin( GL_LINES ); { @@ -4550,7 +4550,7 @@ void CXYWnd::DrawPrecisionCrosshair( void ) qglVertex2f( x, y ); qglColor4fv( crossEndColor.ToFloatPtr() ); qglVertex2f( m_mcRight, y ); - + /// Draw the vertical precision line (in two pieces) qglColor4fv( crossEndColor.ToFloatPtr() ); qglVertex2f( x, m_mcTop ); @@ -4562,7 +4562,7 @@ void CXYWnd::DrawPrecisionCrosshair( void ) qglVertex2f( x, m_mcBottom ); } qglEnd(); // GL_LINES - + // Radiant was in opaque, flat-shaded mode by default; restore this to prevent possible slowdown qglShadeModel( GL_FLAT ); qglDisable( GL_BLEND ); diff --git a/neo/tools/radiant/XYWnd.h b/neo/tools/radiant/XYWnd.h index c8c3e854..94b36cbd 100644 --- a/neo/tools/radiant/XYWnd.h +++ b/neo/tools/radiant/XYWnd.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"). @@ -160,9 +160,9 @@ public: void UpdateViewDependencies( void ); - void DrawPrecisionCrosshair(); + void DrawPrecisionCrosshair(); void CyclePrecisionCrosshairMode(); - enum + enum { PRECISION_CROSSHAIR_NONE = 0, PRECISION_CROSSHAIR_SNAP = 1, @@ -197,7 +197,7 @@ protected: int m_axisHoriz; // and are one of AXIS_X, AXIS_Y, AXIS_Z and int m_axisVert; // reflect which axes are represented horizontally and vertically in the 2d view (XY, XZ, etc) - /// Each of the following _mc fields are stored in map-coordinates, NOT screen-pixels + /// Each of the following _mc fields are stored in map-coordinates, NOT screen-pixels float m_mcWidth; float m_mcHeight; float m_mcLeft; diff --git a/neo/tools/radiant/Z.CPP b/neo/tools/radiant/Z.CPP index ddbbd6d4..515e5150 100644 --- a/neo/tools/radiant/Z.CPP +++ b/neo/tools/radiant/Z.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"). @@ -37,7 +37,7 @@ z_t z; /* ======================================================================================================================= - Z_Init + Z_Init ======================================================================================================================= */ void Z_Init(void) { @@ -53,7 +53,7 @@ static int cursorx, cursory; /* ======================================================================================================================= - Z_MouseDown + Z_MouseDown ======================================================================================================================= */ void Z_MouseDown(int x, int y, int buttons) { @@ -103,40 +103,40 @@ void Z_MouseDown(int x, int y, int buttons) { bReset = (GetKeyState(VK_F4) & 0x8000) != 0; } else - { + { // 3 button mice... // bToggle = (buttons == (MK_RBUTTON|MK_SHIFT|MK_CONTROL)); bSetTop = (buttons == (MK_RBUTTON|MK_SHIFT)); bSetBot = (buttons == (MK_RBUTTON|MK_CONTROL)); bReset = (GetKeyState(VK_F4) & 0x8000) != 0; - } - + } + if (bToggle) { g_pParentWnd->GetZWnd()->m_pZClip->Enable(!(g_pParentWnd->GetZWnd()->m_pZClip->IsEnabled())); - Sys_UpdateWindows (W_ALL); + Sys_UpdateWindows (W_ALL); return; } if (bSetTop) { g_pParentWnd->GetZWnd()->m_pZClip->SetTop(org[2]); - Sys_UpdateWindows (W_ALL); + Sys_UpdateWindows (W_ALL); return; } - + if (bSetBot) { g_pParentWnd->GetZWnd()->m_pZClip->SetBottom(org[2]); - Sys_UpdateWindows (W_ALL); + Sys_UpdateWindows (W_ALL); return; } if (bReset) { g_pParentWnd->GetZWnd()->m_pZClip->Reset(); - Sys_UpdateWindows (W_ALL); + Sys_UpdateWindows (W_ALL); return; } } @@ -175,7 +175,7 @@ void Z_MouseDown(int x, int y, int buttons) { /* ======================================================================================================================= - Z_MouseUp + Z_MouseUp ======================================================================================================================= */ void Z_MouseUp(int x, int y, int buttons) { @@ -184,7 +184,7 @@ void Z_MouseUp(int x, int y, int buttons) { /* ======================================================================================================================= - Z_MouseMoved + Z_MouseMoved ======================================================================================================================= */ void Z_MouseMoved(int x, int y, int buttons) { @@ -212,7 +212,7 @@ void Z_MouseMoved(int x, int y, int buttons) { // control mbutton = move camera int nMouseButton = g_PrefsDlg.m_nMouseButtons == 2 ? MK_RBUTTON : MK_MBUTTON; - if ((buttons == (MK_CONTROL | nMouseButton)) || (buttons == (MK_CONTROL | MK_LBUTTON))) { + if ((buttons == (MK_CONTROL | nMouseButton)) || (buttons == (MK_CONTROL | MK_LBUTTON))) { g_pParentWnd->GetCamera()->Camera().origin[2] = z.origin[2] + (y - (z.height / 2)) / z.scale; Sys_UpdateWindows(W_CAMERA | W_XY_OVERLAY | W_Z); } @@ -220,8 +220,8 @@ void Z_MouseMoved(int x, int y, int buttons) { /* ======================================================================================================================= - DRAWING £ - Z_DrawGrid + DRAWING £ + Z_DrawGrid ======================================================================================================================= */ void Z_DrawGrid(void) { @@ -322,7 +322,7 @@ void ZDrawCameraIcon(void) { void ZDrawZClip() { float x,y; - + x = 0; y = g_pParentWnd->GetCamera()->Camera().origin[2]; @@ -335,7 +335,7 @@ GLbitfield glbitClear = GL_COLOR_BUFFER_BIT; // HACK /* ======================================================================================================================= - Z_Draw + Z_Draw ======================================================================================================================= */ void Z_Draw(void) { diff --git a/neo/tools/radiant/Z.H b/neo/tools/radiant/Z.H index 9d55c03b..42d9d606 100644 --- a/neo/tools/radiant/Z.H +++ b/neo/tools/radiant/Z.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,4 +43,3 @@ void Z_MouseDown (int x, int y, int buttons); void Z_MouseUp (int x, int y, int buttons); void Z_MouseMoved (int x, int y, int buttons); void Z_Draw (void); - diff --git a/neo/tools/radiant/ZClip.cpp b/neo/tools/radiant/ZClip.cpp index 0826821a..012de77d 100644 --- a/neo/tools/radiant/ZClip.cpp +++ b/neo/tools/radiant/ZClip.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,8 +36,8 @@ If you have questions concerning this license or the applicable additional terms CZClip::CZClip() -{ - LONG +{ + LONG lSize = sizeof(m_bEnabled); if (!LoadRegistryInfo("radiant_ZClipEnabled", &m_bEnabled, &lSize)) m_bEnabled = false; @@ -106,7 +106,7 @@ void CZClip::SetTop(int iNewZ) { m_iZClipTop = iNewZ; - Legalise(); + Legalise(); } void CZClip::SetBottom(int iNewZ) @@ -143,7 +143,7 @@ void CZClip::Paint(void) x = 0; y = m_iZClipTop; - if (m_bEnabled) + if (m_bEnabled) qglBegin(GL_QUADS); else qglBegin(GL_LINE_LOOP); @@ -159,7 +159,7 @@ void CZClip::Paint(void) if (m_bEnabled) qglBegin(GL_TRIANGLES); else - qglBegin(GL_LINE_LOOP); + qglBegin(GL_LINE_LOOP); qglVertex3f (x,(y+ZCLIP_BAR_THICKNESS),0); qglVertex3f (x-xCam,(y+ZCLIP_BAR_THICKNESS)+(ZCLIP_ARROWHEIGHT/2),0); qglVertex3f (x+xCam,(y+ZCLIP_BAR_THICKNESS)+(ZCLIP_ARROWHEIGHT/2),0); @@ -171,7 +171,7 @@ void CZClip::Paint(void) x = 0; y = m_iZClipBottom; - if (m_bEnabled) + if (m_bEnabled) qglBegin(GL_QUADS); else qglBegin(GL_LINE_LOOP); @@ -186,7 +186,7 @@ void CZClip::Paint(void) if (m_bEnabled) qglBegin(GL_TRIANGLES); else - qglBegin(GL_LINE_LOOP); + qglBegin(GL_LINE_LOOP); qglVertex3f (x,(y-ZCLIP_BAR_THICKNESS),0); qglVertex3f (x-xCam,(y-ZCLIP_BAR_THICKNESS)-(ZCLIP_ARROWHEIGHT/2),0); qglVertex3f (x+xCam,(y-ZCLIP_BAR_THICKNESS)-(ZCLIP_ARROWHEIGHT/2),0); @@ -195,5 +195,3 @@ void CZClip::Paint(void) ///////////////// eof /////////////////// - - diff --git a/neo/tools/radiant/ZClip.h b/neo/tools/radiant/ZClip.h index 7394db74..b4aa31e4 100644 --- a/neo/tools/radiant/ZClip.h +++ b/neo/tools/radiant/ZClip.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"). @@ -64,5 +64,3 @@ protected: ///////////// eof /////////////// - - diff --git a/neo/tools/radiant/ZWnd.cpp b/neo/tools/radiant/ZWnd.cpp index 1f66cd04..4b3c050f 100644 --- a/neo/tools/radiant/ZWnd.cpp +++ b/neo/tools/radiant/ZWnd.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"). @@ -81,7 +81,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CZWnd message handlers -int CZWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) +int CZWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CWnd::OnCreate(lpCreateStruct) == -1) return -1; @@ -89,12 +89,12 @@ int CZWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) m_dcZ = ::GetDC(GetSafeHwnd()); QEW_SetupPixelFormat(m_dcZ, false); - m_pZClip = new CZClip(); + m_pZClip = new CZClip(); return 0; } -void CZWnd::OnDestroy() +void CZWnd::OnDestroy() { if (m_pZClip) { @@ -105,12 +105,12 @@ void CZWnd::OnDestroy() CWnd::OnDestroy(); } -void CZWnd::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +void CZWnd::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { g_pParentWnd->HandleKey(nChar, nRepCnt, nFlags); } -void CZWnd::OnLButtonDown(UINT nFlags, CPoint point) +void CZWnd::OnLButtonDown(UINT nFlags, CPoint point) { SetFocus(); SetCapture(); @@ -119,7 +119,7 @@ void CZWnd::OnLButtonDown(UINT nFlags, CPoint point) Z_MouseDown (point.x, rctZ.Height() - 1 - point.y , nFlags); } -void CZWnd::OnMButtonDown(UINT nFlags, CPoint point) +void CZWnd::OnMButtonDown(UINT nFlags, CPoint point) { SetFocus(); SetCapture(); @@ -128,7 +128,7 @@ void CZWnd::OnMButtonDown(UINT nFlags, CPoint point) Z_MouseDown (point.x, rctZ.Height() - 1 - point.y , nFlags); } -void CZWnd::OnRButtonDown(UINT nFlags, CPoint point) +void CZWnd::OnRButtonDown(UINT nFlags, CPoint point) { SetFocus(); SetCapture(); @@ -137,33 +137,33 @@ void CZWnd::OnRButtonDown(UINT nFlags, CPoint point) Z_MouseDown (point.x, rctZ.Height() - 1 - point.y , nFlags); } -void CZWnd::OnPaint() +void CZWnd::OnPaint() { CPaintDC dc(this); // device context for painting //if (!wglMakeCurrent(m_dcZ, m_hglrcZ)) //if (!qwglMakeCurrent(dc.m_hDC, m_hglrcZ)) if (!qwglMakeCurrent(dc.m_hDC, win32.hGLRC)) { - common->Printf("ERROR: wglMakeCurrent failed..\n "); - common->Printf("Please restart " EDITOR_WINDOWTEXT " if the Z view is not working\n"); + common->Printf("ERROR: wglMakeCurrent failed..\n "); + common->Printf("Please restart " EDITOR_WINDOWTEXT " if the Z view is not working\n"); } else { QE_CheckOpenGLForErrors(); - Z_Draw (); + Z_Draw (); //qwglSwapBuffers(m_dcZ); qwglSwapBuffers(dc.m_hDC); - TRACE("Z Paint\n"); + TRACE("Z Paint\n"); } } -void CZWnd::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) +void CZWnd::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { lpMMI->ptMinTrackSize.x = ZWIN_WIDTH; } -void CZWnd::OnMouseMove(UINT nFlags, CPoint point) +void CZWnd::OnMouseMove(UINT nFlags, CPoint point) { CRect rctZ; GetClientRect(rctZ); @@ -175,7 +175,7 @@ void CZWnd::OnMouseMove(UINT nFlags, CPoint point) Z_MouseMoved (point.x, rctZ.Height() - 1 - point.y, nFlags); } -void CZWnd::OnSize(UINT nType, int cx, int cy) +void CZWnd::OnSize(UINT nType, int cx, int cy) { CWnd::OnSize(nType, cx, cy); CRect rctZ; @@ -183,88 +183,88 @@ void CZWnd::OnSize(UINT nType, int cx, int cy) z.width = rctZ.right; z.height = rctZ.bottom; if (z.width < 10) - z.width = 10; + z.width = 10; if (z.height < 10) - z.height = 10; + z.height = 10; Invalidate(); } -void CZWnd::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp) +void CZWnd::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp) { CWnd::OnNcCalcSize(bCalcValidRects, lpncsp); } -void CZWnd::OnKillFocus(CWnd* pNewWnd) +void CZWnd::OnKillFocus(CWnd* pNewWnd) { CWnd::OnKillFocus(pNewWnd); SendMessage(WM_NCACTIVATE, FALSE , 0 ); } -void CZWnd::OnSetFocus(CWnd* pOldWnd) +void CZWnd::OnSetFocus(CWnd* pOldWnd) { CWnd::OnSetFocus(pOldWnd); SendMessage(WM_NCACTIVATE, TRUE , 0 ); } -void CZWnd::OnClose() +void CZWnd::OnClose() { CWnd::OnClose(); } -void CZWnd::OnLButtonUp(UINT nFlags, CPoint point) +void CZWnd::OnLButtonUp(UINT nFlags, CPoint point) { CRect rctZ; GetClientRect(rctZ); Z_MouseUp (point.x, rctZ.bottom - 1 - point.y, nFlags); if (! (nFlags & (MK_LBUTTON|MK_RBUTTON|MK_MBUTTON))) - ReleaseCapture (); + ReleaseCapture (); } -void CZWnd::OnMButtonUp(UINT nFlags, CPoint point) +void CZWnd::OnMButtonUp(UINT nFlags, CPoint point) { CRect rctZ; GetClientRect(rctZ); Z_MouseUp (point.x, rctZ.bottom - 1 - point.y, nFlags); if (! (nFlags & (MK_LBUTTON|MK_RBUTTON|MK_MBUTTON))) - ReleaseCapture (); + ReleaseCapture (); } -void CZWnd::OnRButtonUp(UINT nFlags, CPoint point) +void CZWnd::OnRButtonUp(UINT nFlags, CPoint point) { CRect rctZ; GetClientRect(rctZ); Z_MouseUp (point.x, rctZ.bottom - 1 - point.y, nFlags); if (! (nFlags & (MK_LBUTTON|MK_RBUTTON|MK_MBUTTON))) - ReleaseCapture (); + ReleaseCapture (); } -BOOL CZWnd::PreCreateWindow(CREATESTRUCT& cs) +BOOL CZWnd::PreCreateWindow(CREATESTRUCT& cs) { WNDCLASS wc; HINSTANCE hInstance = AfxGetInstanceHandle(); if (::GetClassInfo(hInstance, Z_WINDOW_CLASS, &wc) == FALSE) { - // Register a new class - memset (&wc, 0, sizeof(wc)); - wc.style = CS_NOCLOSE;// | CS_OWNDC; - wc.lpszClassName = Z_WINDOW_CLASS; - wc.hCursor = LoadCursor (NULL,IDC_ARROW); - wc.lpfnWndProc = ::DefWindowProc; - if (AfxRegisterClass(&wc) == FALSE) - Error ("CZWnd RegisterClass: failed"); + // Register a new class + memset (&wc, 0, sizeof(wc)); + wc.style = CS_NOCLOSE;// | CS_OWNDC; + wc.lpszClassName = Z_WINDOW_CLASS; + wc.hCursor = LoadCursor (NULL,IDC_ARROW); + wc.lpfnWndProc = ::DefWindowProc; + if (AfxRegisterClass(&wc) == FALSE) + Error ("CZWnd RegisterClass: failed"); } cs.lpszClass = Z_WINDOW_CLASS; cs.lpszName = "Z"; if (cs.style != QE3_CHILDSTYLE) - cs.style = QE3_SPLITTER_STYLE; + cs.style = QE3_SPLITTER_STYLE; return CWnd::PreCreateWindow(cs); } -void CZWnd::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) +void CZWnd::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) { g_pParentWnd->HandleKey(nChar, nRepCnt, nFlags, false); } diff --git a/neo/tools/radiant/ZWnd.h b/neo/tools/radiant/ZWnd.h index 16794f20..49ffa4bb 100644 --- a/neo/tools/radiant/ZWnd.h +++ b/neo/tools/radiant/ZWnd.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/neo/tools/radiant/autocaulk.cpp b/neo/tools/radiant/autocaulk.cpp index 2ce6f6bd..f2478a9f 100644 --- a/neo/tools/radiant/autocaulk.cpp +++ b/neo/tools/radiant/autocaulk.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,11 +33,11 @@ If you have questions concerning this license or the applicable additional terms #include "Radiant.h" #include "autocaulk.h" -// Note: the code in here looks pretty goofy in places, and probably doesn't use the new Q4 class stuff fully, +// Note: the code in here looks pretty goofy in places, and probably doesn't use the new Q4 class stuff fully, // but I just got it in and compiling from the JK2/SOF2 Radiants via some ugly code replaces, and it works, so there. // Also, a bunch of Radiant fields no longer exist in this codebase, likewise the whole point of passing in the bool // to this code, but I've just left it as-is. A designer tested it and pronounced it fine. - + //#pragma warning( disable : 4786) //#include //using namespace std; @@ -57,7 +57,7 @@ void ClearBounds (idVec3 &mins, idVec3 &maxs) maxs[0] = maxs[1] = maxs[2] = -99999; } -void AddPointToBounds( const idVec3 &v, idVec3 &mins, idVec3 &maxs ) +void AddPointToBounds( const idVec3 &v, idVec3 &mins, idVec3 &maxs ) { int i; float val; @@ -95,7 +95,7 @@ struct PairBrushFace_t idList < PairBrushFace_t > FacesToCaulk; void Select_AutoCaulk() { - /*Sys_Printf*/common->Printf("Caulking...\n"); + /*Sys_Printf*/common->Printf("Caulking...\n"); FacesToCaulk.Clear(); @@ -106,7 +106,7 @@ void Select_AutoCaulk() for (brush_t *pSelectedBrush = selected_brushes.next ; pSelectedBrush != &selected_brushes ; pSelectedBrush = next) { next = pSelectedBrush->next; - + if (pSelectedBrush->owner->eclass->fixedsize) continue; // apparently this means it's a model, so skip it... @@ -114,7 +114,7 @@ void Select_AutoCaulk() // bool bSystemFacePresent = false; for ( pSelectedFace = pSelectedBrush->brush_faces; pSelectedFace; pSelectedFace = pSelectedFace->next) - { + { if (!strnicmp(pSelectedFace->d_texture->GetName(),"system/",7)) { bSystemFacePresent = true; @@ -125,10 +125,10 @@ void Select_AutoCaulk() { iSystemBrushesSkipped++; continue; // verboten to caulk this. - } + } for (int iBrushListToScan = 0; iBrushListToScan<2; iBrushListToScan++) - { + { brush_t *snext; for (brush_t *pScannedBrush = (iBrushListToScan?active_brushes.next:selected_brushes.next); pScannedBrush != (iBrushListToScan?&active_brushes:&selected_brushes) ; pScannedBrush = snext) { @@ -136,19 +136,19 @@ void Select_AutoCaulk() if ( pScannedBrush == pSelectedBrush) continue; - + if (pScannedBrush->owner->eclass->fixedsize || pScannedBrush->pPatch || pScannedBrush->hiddenBrush) continue; - if (FilterBrush(pScannedBrush)) + if (FilterBrush(pScannedBrush)) continue; -// idMaterial stuff no longer support this, not sure what else to do. +// idMaterial stuff no longer support this, not sure what else to do. // Searching for other occurences of QER_NOCARVE just shows people REMing the code and ignoring ths issue... -// +// // if (pScannedBrush->brush_faces->d_texture->bFromShader && (pScannedBrush->brush_faces->d_texture->TestMaterialFlag(QER_NOCARVE))) // continue; - + // basic-reject first to see if brushes can even possibly touch (coplanar counts as touching) // int i; @@ -197,18 +197,18 @@ void Select_AutoCaulk() // WindingToSquaredFace( &ScannedSquaredFace, pScannedWinding); /* if (VectorCompare(ScannedSquaredFace.v3NormalisedRotationVector, SelectedSquaredFace.v3NormalisedRotationVector) - && + && VectorCompare(ScannedSquaredFace.v3NormalisedElevationVector, SelectedSquaredFace.v3NormalisedElevationVector) ) */ { // brush faces are in parallel planes to each other, so check that their normals // are opposite, by adding them together and testing for zero... - // (if normals are opposite, then faces can be against/touching each other?) + // (if normals are opposite, then faces can be against/touching each other?) // - idVec3 v3ZeroTest; + idVec3 v3ZeroTest; idVec3 v3Zero;v3Zero.Zero(); //static idVec3 v3Zero={0,0,0}; - + VectorAdd(pSelectedFace->plane.Normal(),pScannedFace->plane.Normal(),v3ZeroTest); if (v3ZeroTest == v3Zero) { @@ -219,13 +219,13 @@ void Select_AutoCaulk() float fTotalDist = 0; for (int _i=0; _i<3; _i++) { - fTotalDist += fabs( DotProduct(pSelectedFace->plane.Normal(),(*pSelectedWinding)[0]) - - + fTotalDist += fabs( DotProduct(pSelectedFace->plane.Normal(),(*pSelectedWinding)[0]) + - DotProduct(pSelectedFace->plane.Normal(),(*pScannedWinding)[i]) ); } //OutputDebugString(va("Dist = %g\n",fTotalDist)); - + if (fTotalDist > 0.01) continue; @@ -245,7 +245,7 @@ void Select_AutoCaulk() // FloorBounds(v3ScannedBoundsMins, v3ScannedBoundsMaxs); - + // now check points from selected face... // bool bWithin = true; @@ -256,7 +256,7 @@ void Select_AutoCaulk() float f = floor((*pSelectedWinding)[iPoint][iXYZ] + 0.5); if (! ( - f >= v3ScannedBoundsMins[iXYZ] + f >= v3ScannedBoundsMins[iXYZ] && f <= v3ScannedBoundsMaxs[iXYZ] ) @@ -272,17 +272,17 @@ void Select_AutoCaulk() PairBrushFace_t PairBrushFace; PairBrushFace.pFace = pSelectedFace; PairBrushFace.pBrush= pSelectedBrush; - FacesToCaulk.Append(PairBrushFace); + FacesToCaulk.Append(PairBrushFace); } } } } - } + } } } } - + // apply caulk... // int iFacesCaulked = 0; @@ -313,14 +313,14 @@ void Select_AutoCaulk() face_t *pFace = PairBrushFace.pFace; brush_t*pBrush= PairBrushFace.pBrush; - pFace->d_texture = pCaulk; + pFace->d_texture = pCaulk; pFace->texdef = tex; Face_FitTexture(pFace, 1, 1); // this doesn't work here for some reason... duh. Brush_Build(pBrush); iFacesCaulked++; - } + } } else { diff --git a/neo/tools/radiant/autocaulk.h b/neo/tools/radiant/autocaulk.h index 5e42f50f..22aa2af4 100644 --- a/neo/tools/radiant/autocaulk.h +++ b/neo/tools/radiant/autocaulk.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"). @@ -36,4 +36,3 @@ void Select_AutoCaulk(); #endif // AUTOCAULK_H ///////////////// eof ////////////// - diff --git a/neo/tools/radiant/cmdlib.cpp b/neo/tools/radiant/cmdlib.cpp index 8e909b0e..ea36508c 100644 --- a/neo/tools/radiant/cmdlib.cpp +++ b/neo/tools/radiant/cmdlib.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/neo/tools/radiant/cmdlib.h b/neo/tools/radiant/cmdlib.h index c4931292..c4a8bb56 100644 --- a/neo/tools/radiant/cmdlib.h +++ b/neo/tools/radiant/cmdlib.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"). @@ -39,10 +39,10 @@ If you have questions concerning this license or the applicable additional terms int LoadFile( const char *filename, void **bufferptr ); -void DefaultExtension( char *path, char *extension ); -void DefaultPath( char *path, char *basepath ); -void StripFilename( char *path ); -void StripExtension( char *path ); +void DefaultExtension( char *path, char *extension ); +void DefaultPath( char *path, char *basepath ); +void StripFilename( char *path ); +void StripExtension( char *path ); // error and printf functions typedef void (PFN_ERR)( const char *pFormat, ... ); diff --git a/neo/tools/radiant/splines.cpp b/neo/tools/radiant/splines.cpp index f13968ad..babcd531 100644 --- a/neo/tools/radiant/splines.cpp +++ b/neo/tools/radiant/splines.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"). @@ -84,7 +84,7 @@ void glBox(idVec4 &color, idVec3 &point, float size) { qglEnd(); qglBegin(GL_LINES); - qglVertex3f(mins[0],mins[1],mins[2]); + qglVertex3f(mins[0],mins[1],mins[2]); qglVertex3f(mins[0],mins[1],maxs[2]); qglVertex3f(mins[0],maxs[1],maxs[2]); qglVertex3f(mins[0],maxs[1],mins[2]); @@ -349,7 +349,7 @@ void idSplineList::addToRenderer() { if (controlPoints.Num() == 0) { return; } - + for(i = 0; i < controlPoints.Num(); i++) { VectorCopy(*controlPoints[i], mins); VectorCopy(mins, maxs); @@ -363,12 +363,12 @@ void idSplineList::addToRenderer() { debugLine( colorYellow, maxs[0], mins[1], mins[2], maxs[0], maxs[1], mins[2]); debugLine( colorYellow, maxs[0], maxs[1], mins[2], mins[0], maxs[1], mins[2]); debugLine( colorYellow, mins[0], maxs[1], mins[2], mins[0], mins[1], mins[2]); - + debugLine( colorYellow, mins[0], mins[1], maxs[2], maxs[0], mins[1], maxs[2]); debugLine( colorYellow, maxs[0], mins[1], maxs[2], maxs[0], maxs[1], maxs[2]); debugLine( colorYellow, maxs[0], maxs[1], maxs[2], mins[0], maxs[1], maxs[2]); debugLine( colorYellow, mins[0], maxs[1], maxs[2], mins[0], mins[1], maxs[2]); - + } int step = 0; @@ -428,8 +428,8 @@ idSplineList::draw ================ */ void idSplineList::draw(bool editMode) { - int i; - + int i; + if (controlPoints.Num() == 0) { return; } @@ -441,13 +441,13 @@ void idSplineList::draw(bool editMode) { qglColor3fv( controlColor.ToFloatPtr() ); qglPointSize( 5 ); - + qglBegin(GL_POINTS); for (i = 0; i < controlPoints.Num(); i++) { qglVertex3fv( (*controlPoints[i]).ToFloatPtr() ); } qglEnd(); - + if (editMode) { for(i = 0; i < controlPoints.Num(); i++) { glBox(activeColor, *controlPoints[i], 4); @@ -490,7 +490,7 @@ idSplineList::totalDistance float idSplineList::totalDistance() { // FIXME: save dist and return - // + // if (controlPoints.Num() == 0) { return 0.0f; } @@ -613,7 +613,7 @@ const idVec3 *idSplineList::getPosition(long t) { float timePassed = t - lastTime; lastTime = t; - // convert to seconds + // convert to seconds timePassed /= 1000; float distToTravel = timePassed * velocity; @@ -638,7 +638,7 @@ const idVec3 *idSplineList::getPosition(long t) { } else { double timeHi = splineTime[i + 1]; double timeLo = splineTime[i - 1]; - double percent = (timeHi - t) / (timeHi - timeLo); + double percent = (timeHi - t) / (timeHi - timeLo); idVec3 v1 = *splinePoints[i - 1]; idVec3 v2 = *splinePoints[i + 1]; v2 *= (1.0f - percent); @@ -655,7 +655,7 @@ const idVec3 *idSplineList::getPosition(long t) { double timeHi = splineTime[activeSegment + 1]; double timeLo = splineTime[activeSegment - 1]; //float percent = (float)(baseTime + time - t) / time; - double percent = (timeHi - t) / (timeHi - timeLo); + double percent = (timeHi - t) / (timeHi - timeLo); // pick two bounding points idVec3 v1 = *splinePoints[activeSegment-1]; idVec3 v2 = *splinePoints[activeSegment+1]; @@ -860,8 +860,8 @@ idCameraDef::draw ================ */ void idCameraDef::draw( bool editMode ) { - // gcc doesn't allow casting away from bools - // why? I've no idea... + // gcc doesn't allow casting away from bools + // why? I've no idea... if (cameraPosition) { cameraPosition->draw((bool)((editMode || cameraRunning) && cameraEdit)); int count = targetPositions.Num(); @@ -958,7 +958,7 @@ void idCameraDef::getActiveSegmentInfo(int segment, idVec3 &origin, idVec3 &dire buildCamera(); } origin = *cameraSpline.getSegmentPoint(segment); - + idVec3 temp; @@ -1014,7 +1014,7 @@ bool idCameraDef::getCameraInfo(long time, idVec3 &origin, idVec3 &direction, fl strcpy(buff, events[i]->getParam()); const char *param1 = strtok(buff, " \t,\0"); const char *param2 = strtok(NULL, " \t,\0"); - fov.reset(fov.GetFOV(time), atof(param1), time, atoi(param2)); + fov.reset(fov.GetFOV(time), atof(param1), time, atoi(param2)); //*fv = fov = atof(events[i]->getParam()); } else if (events[i]->getType() == idCameraEvent::EVENT_CAMERA) { } else if (events[i]->getType() == idCameraEvent::EVENT_STOP) { @@ -1026,7 +1026,7 @@ bool idCameraDef::getCameraInfo(long time, idVec3 &origin, idVec3 &direction, fl } origin = *cameraPosition->getPosition(time); - + *fv = fov.GetFOV(time); idVec3 temp = origin; @@ -1048,7 +1048,7 @@ bool idCameraDef::getCameraInfo(long time, idVec3 &origin, idVec3 &direction, fl } else { temp = *getActiveTarget()->getPosition(time); } - + temp -= origin; temp.Normalize(); direction = temp; @@ -1066,7 +1066,7 @@ bool idCameraDef::waitEvent(int index) { // if (events[i]->getSegment() == index && events[i]->getType() == idCameraEvent::EVENT_WAIT) { // return true; // } - //} + //} return false; } @@ -1128,7 +1128,7 @@ void idCameraDef::buildCamera() { waits.Append(atof(events[i]->getParam())); //FIXME: this is quite hacky for Wolf E3, accel and decel needs - // do be parameter based etc.. + // do be parameter based etc.. long startTime = events[i]->getTime() - 1000; if (startTime < 0) { startTime = 0; @@ -1173,7 +1173,7 @@ void idCameraDef::buildCamera() { // multiply that by the adjustment double newTotal = total * adjust; - // what is the difference.. + // what is the difference.. newTotal -= total; totalTime += newTotal / 1000; @@ -1197,7 +1197,7 @@ void idCameraDef::buildCamera() { totalTime += waits[i]; } - // on a new target switch, we need to take time to this point ( since last target switch ) + // on a new target switch, we need to take time to this point ( since last target switch ) // and allocate it across the active target, then reset time to this point long timeSoFar = 0; long total = totalTime * 1000; @@ -1366,7 +1366,7 @@ int idCameraDef::sortEvents(const void *p1, const void *p2) { if (ev1->getTime() < ev2->getTime()) { return 1; } - return 0; + return 0; } /* @@ -1675,7 +1675,7 @@ void idInterpolatedPosition::start( long t ) { idInterpolatedPosition::getPosition ================ */ -const idVec3 *idInterpolatedPosition::getPosition( long t ) { +const idVec3 *idInterpolatedPosition::getPosition( long t ) { static idVec3 interpolatedPos; if (t - startTime > 6000) { @@ -1686,7 +1686,7 @@ const idVec3 *idInterpolatedPosition::getPosition( long t ) { float timePassed = t - lastTime; lastTime = t; - // convert to seconds + // convert to seconds timePassed /= 1000; if (velocity != getBaseVelocity()) { @@ -1940,7 +1940,7 @@ void idSplinePosition::parse( idParser *src ) { target.parse( src ); } else { - idCameraPosition::parseToken( token, src ); + idCameraPosition::parseToken( token, src ); } } } @@ -1969,7 +1969,7 @@ const idVec3 *idSplinePosition::getPosition(long t) { float timePassed = t - lastTime; lastTime = t; - // convert to seconds + // convert to seconds timePassed /= 1000; float distToTravel = timePassed * velocity; @@ -2009,7 +2009,7 @@ const idVec3 *idSplinePosition::getPosition(long t) { #if 0 double timeHi = target.getSegmentTime(i + 1); double timeLo = target.getSegmentTime(i - 1); - double percent = (timeHi - t) / (timeHi - timeLo); + double percent = (timeHi - t) / (timeHi - timeLo); idVec3 v1 = *target.getSegmentPoint(i - 1); idVec3 v2 = *target.getSegmentPoint(i + 1); v2 *= (1.0f - percent); @@ -2025,7 +2025,7 @@ const idVec3 *idSplinePosition::getPosition(long t) { idVec3 v1 = *target.getSegmentPoint(i - 1); idVec3 v2 = *target.getSegmentPoint(i); - double percent = (lastDistance2 - targetDistance) / (lastDistance2 - lastDistance1); + double percent = (lastDistance2 - targetDistance) / (lastDistance2 - lastDistance1); v2 *= (1.0f - percent); v1 *= percent; v2 += v1; diff --git a/neo/tools/radiant/splines.h b/neo/tools/radiant/splines.h index f1f66a3d..978d3398 100644 --- a/neo/tools/radiant/splines.h +++ b/neo/tools/radiant/splines.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,13 +37,13 @@ class idPointListInterface { public: idPointListInterface() { selectedPoints.Clear(); }; ~idPointListInterface() {}; - + virtual int numPoints() { return 0; } virtual void addPoint( const float x, const float y, const float z ) {} virtual void addPoint( const idVec3 &v ) {} virtual void removePoint( int index ) {} virtual idVec3 * getPoint( int index ) { return NULL; } - + int numSelectedPoints() { return selectedPoints.Num(); } idVec3 * getSelectedPoint( int index ); int selectPointByRay( const idVec3 &origin, const idVec3 &direction, bool single ); @@ -130,7 +130,7 @@ protected: long time; }; -// time in milliseconds +// time in milliseconds // velocity where 1.0 equal rough walking speed struct idVelocity { idVelocity( long start, long duration, float s ) { startTime = start; time = duration; speed = s; } @@ -142,7 +142,7 @@ struct idVelocity { // can either be a look at or origin position for a camera class idCameraPosition : public idPointListInterface { public: - + idCameraPosition() { time = 0; name = "position"; } idCameraPosition( const char *p ) { name = p; } idCameraPosition( long t ) { time = t; } diff --git a/neo/tools/script/DialogScriptEditor.cpp b/neo/tools/script/DialogScriptEditor.cpp index 8d092aa5..e5073462 100644 --- a/neo/tools/script/DialogScriptEditor.cpp +++ b/neo/tools/script/DialogScriptEditor.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"). @@ -239,7 +239,7 @@ void DialogScriptEditor::OpenFile( const char *fileName ) { idStr( fileName ).ExtractFileExtension( extension ); if ( extension.Icmp( "script" ) == 0 ) { - InitScriptEvents(); + InitScriptEvents(); scriptEdit.SetCaseSensitive( true ); scriptEdit.LoadKeyWordsFromFile( "editors/script.def" ); scriptEdit.SetObjectMemberCallback( GetScriptEvents ); @@ -334,7 +334,7 @@ BOOL DialogScriptEditor::OnInitDialog() { UpdateStatusBar(); return FALSE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } BEGIN_MESSAGE_MAP(DialogScriptEditor, CDialog) @@ -651,9 +651,9 @@ LRESULT DialogScriptEditor::OnFindDialogMessage( WPARAM wParam, LPARAM lParam ) } if ( findDlg->IsTerminating() ) { - findDlg = NULL; - return 0; - } + findDlg = NULL; + return 0; + } if( findDlg->FindNext() ) { findStr = findDlg->GetFindString(); @@ -662,7 +662,7 @@ LRESULT DialogScriptEditor::OnFindDialogMessage( WPARAM wParam, LPARAM lParam ) searchForward = findDlg->SearchDown() != FALSE; OnEditFindNext(); - } + } if ( findDlg->ReplaceCurrent() ) { long selStart, selEnd; diff --git a/neo/tools/script/DialogScriptEditor.h b/neo/tools/script/DialogScriptEditor.h index cee585ad..32f4e6a9 100644 --- a/neo/tools/script/DialogScriptEditor.h +++ b/neo/tools/script/DialogScriptEditor.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 @@ protected: afx_msg void OnEditFind(); afx_msg void OnEditFindNext(); afx_msg void OnEditReplace(); - afx_msg LRESULT OnFindDialogMessage( WPARAM wParam, LPARAM lParam ); + afx_msg LRESULT OnFindDialogMessage( WPARAM wParam, LPARAM lParam ); afx_msg void OnEnChangeEdit( NMHDR *pNMHDR, LRESULT *pResult ); afx_msg void OnEnInputEdit( NMHDR *pNMHDR, LRESULT *pResult ); afx_msg void OnBnClickedOk(); diff --git a/neo/tools/sound/DialogSound.cpp b/neo/tools/sound/DialogSound.cpp index 5067ced4..8d71b357 100644 --- a/neo/tools/sound/DialogSound.cpp +++ b/neo/tools/sound/DialogSound.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 SoundEditorInit( const idDict *spawnArgs ) { g_SoundDialog->ShowWindow( SW_SHOW ); g_SoundDialog->SetFocus(); - + if ( spawnArgs ) { const char *name = spawnArgs->GetString( "name" ); const idDict *dict = gameEdit->MapGetEntityDict( name ); @@ -278,13 +278,13 @@ void CDialogSound::Get( idDict *source ) { source->SetFloat( "s_shakes", shakes ); } -void CDialogSound::OnBtnSavemap() +void CDialogSound::OnBtnSavemap() { OnBtnApply(); gameEdit->MapSave(); } -void CDialogSound::OnBtnSwitchtogame() +void CDialogSound::OnBtnSwitchtogame() { ::SetFocus(win32.hWnd); } @@ -315,7 +315,7 @@ void CDialogSound::SetVolume( float vol ) { gameEdit->EntityUpdateChangeableSpawnArgs( list[i], dict2 ); fVolume = vol; UpdateData( FALSE ); - } + } } } } @@ -373,20 +373,20 @@ void CDialogSound::ApplyChanges( bool volumeOnly, bool updateInUseTree ) { } } -void CDialogSound::OnBtnApply() +void CDialogSound::OnBtnApply() { ApplyChanges(); } -void CDialogSound::OnChangeEditVolume() +void CDialogSound::OnChangeEditVolume() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. - + // TODO: Add your control notification handler code here - + } HTREEITEM CDialogSound::AddStrList(const char *root, const idStrList &list, int id) { @@ -471,13 +471,13 @@ void CDialogSound::AddSounds(bool rootItems) { idStrList list(1024); idStrList list2(1024); HTREEITEM base = treeSounds.InsertItem("Sound Shaders"); - + for( i = 0; i < declManager->GetNumDecls( DECL_SOUND ) ; i++ ) { const idSoundShader *poo = declManager->SoundByIndex(i, false); list.AddUnique( poo->GetFileName() ); } list.Sort(); - + for ( i = 0; i < list.Num(); i++ ) { HTREEITEM child = treeSounds.InsertItem(list[i], base); treeSounds.SetItemData(child, SOUNDPARENT); @@ -489,7 +489,7 @@ void CDialogSound::AddSounds(bool rootItems) { list2.Append( poo->GetName() ); } } - list2.Sort(); + list2.Sort(); for (j = 0; j < list2.Num(); j++) { HTREEITEM child2 = treeSounds.InsertItem( list2[j], child ); treeSounds.SetItemData(child2, SOUNDS); @@ -499,7 +499,7 @@ void CDialogSound::AddSounds(bool rootItems) { idFileList *files; files = fileSystem->ListFilesTree( "sound", ".wav|.ogg", true ); - AddStrList( "Wave files", files->GetList(), WAVES ); + AddStrList( "Wave files", files->GetList(), WAVES ); fileSystem->FreeFileList( files ); } @@ -555,7 +555,7 @@ void CDialogSound::AddSpeakers() { CString group( "" ); if (bGroupOnly && comboGroups.GetCurSel() >= 0) { comboGroups.GetLBText( comboGroups.GetCurSel(), group ); - } + } int count = gameEdit->MapGetEntitiesMatchingClassWithString( "speaker", group, list.Ptr(), list.Num() ); for ( int i = 0; i < count; i++ ) { @@ -563,13 +563,13 @@ void CDialogSound::AddSpeakers() { } } -BOOL CDialogSound::OnInitDialog() +BOOL CDialogSound::OnInitDialog() { CDialog::OnInitDialog(); - + // Indicate the sound dialog is opened com_editors |= EDITOR_SOUND; - + inUseTree = NULL; AddSounds(true); AddGroups(); @@ -578,10 +578,10 @@ BOOL CDialogSound::OnInitDialog() SetWaveSize(); return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } -void CDialogSound::OnBtnRefresh() +void CDialogSound::OnBtnRefresh() { CWaitCursor cursor; treeSounds.DeleteAllItems(); @@ -590,7 +590,7 @@ void CDialogSound::OnBtnRefresh() AddSounds(true); } -void CDialogSound::OnBtnPlaysound() +void CDialogSound::OnBtnPlaysound() { if (playSound.GetLength()) { // we might be in either the game or the editor @@ -599,17 +599,17 @@ void CDialogSound::OnBtnPlaysound() sw->PlayShaderDirectly(playSound); } } - + } -void CDialogSound::OnDblclkTreeSounds(NMHDR* pNMHDR, LRESULT* pResult) +void CDialogSound::OnDblclkTreeSounds(NMHDR* pNMHDR, LRESULT* pResult) { *pResult = 0; CPoint pt; GetCursorPos( &pt ); treeSounds.ScreenToClient( &pt ); HTREEITEM item = treeSounds.HitTest( pt ); - + if (item) { DWORD dw = treeSounds.GetItemData( item ); if ( dw == SOUNDS || dw == INUSESOUNDS ) { @@ -634,7 +634,7 @@ void CDialogSound::SetWaveSize( const char *p ) { } } -void CDialogSound::OnSelchangedTreeSounds(NMHDR* pNMHDR, LRESULT* pResult) +void CDialogSound::OnSelchangedTreeSounds(NMHDR* pNMHDR, LRESULT* pResult) { NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; HTREEITEM item = treeSounds.GetSelectedItem(); @@ -655,22 +655,22 @@ void CDialogSound::OnSelchangedTreeSounds(NMHDR* pNMHDR, LRESULT* pResult) } } } - + *pResult = 0; } -void CDialogSound::OnCheckPlay() +void CDialogSound::OnCheckPlay() { UpdateData(TRUE); } -void CDialogSound::OnBtnEdit() +void CDialogSound::OnBtnEdit() { const idDecl *decl = declManager->FindDeclWithoutParsing( DECL_SOUND, strShader, false ); if ( decl ) { DialogDeclEditor *declEditor; - + declEditor = new DialogDeclEditor; declEditor->Create( IDD_DIALOG_DECLEDITOR, GetParent() ); declEditor->LoadDecl( const_cast( decl ) ); @@ -679,7 +679,7 @@ void CDialogSound::OnBtnEdit() } } -void CDialogSound::OnBtnDrop() +void CDialogSound::OnBtnDrop() { idStr classname; idStr key; @@ -735,7 +735,7 @@ void CDialogSound::OnBtnDrop() AddSpeakers(); } -void CDialogSound::OnBtnGroup() +void CDialogSound::OnBtnGroup() { idList list; @@ -773,7 +773,7 @@ void CDialogSound::OnBtnGroup() } -void CDialogSound::OnBtnSavemapas() +void CDialogSound::OnBtnSavemapas() { CFileDialog dlgSave(FALSE,"map",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,"Map Files (*.map)|*.map||",AfxGetMainWnd()); if (dlgSave.DoModal() == IDOK) { @@ -803,7 +803,7 @@ idStr CDialogSound::RebuildItemName(const char *root, HTREEITEM item) { break; } } - return strParent; + return strParent; } @@ -830,32 +830,32 @@ void CDialogSound::UpdateSelectedOrigin( float x, float y, float z ) { } } -void CDialogSound::OnBtnYup() +void CDialogSound::OnBtnYup() { UpdateSelectedOrigin(0, 8, 0); } -void CDialogSound::OnBtnYdn() +void CDialogSound::OnBtnYdn() { UpdateSelectedOrigin(0, -8, 0); } -void CDialogSound::OnBtnXdn() +void CDialogSound::OnBtnXdn() { UpdateSelectedOrigin(-8, 0, 0); } -void CDialogSound::OnBtnXup() +void CDialogSound::OnBtnXup() { UpdateSelectedOrigin(8, 0, 0); } -void CDialogSound::OnBtnZup() +void CDialogSound::OnBtnZup() { UpdateSelectedOrigin(0, 0, 8); } -void CDialogSound::OnBtnZdn() +void CDialogSound::OnBtnZdn() { UpdateSelectedOrigin(0, 0, -8); } @@ -868,7 +868,7 @@ void CDialogSound::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { } -void CDialogSound::OnCheckGrouponly() +void CDialogSound::OnCheckGrouponly() { AddSpeakers(); } @@ -925,13 +925,13 @@ void CDialogSound::OnBtnUp() { ApplyChanges( true, false ); } -void CDialogSound::OnBtnRefreshspeakers() +void CDialogSound::OnBtnRefreshspeakers() { AddGroups(); AddSpeakers(); } -void CDialogSound::OnBtnRefreshwave() +void CDialogSound::OnBtnRefreshwave() { HTREEITEM item = treeSounds.GetSelectedItem(); if (item && treeSounds.GetItemData( item ) == WAVEDIR) { @@ -956,7 +956,7 @@ void CDialogSound::OnBtnRefreshwave() treeSounds.SetItemImage( child, 2, 2 ); } fileSystem->FreeFileList( files ); - } + } } BOOL CDialogSound::PreTranslateMessage(MSG* pMsg) diff --git a/neo/tools/sound/DialogSound.h b/neo/tools/sound/DialogSound.h index 23a3bff8..5cc0bbb3 100644 --- a/neo/tools/sound/DialogSound.h +++ b/neo/tools/sound/DialogSound.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/neo/tools/sound/DialogSoundGroup.cpp b/neo/tools/sound/DialogSoundGroup.cpp index 3656927e..6f928ff1 100644 --- a/neo/tools/sound/DialogSoundGroup.cpp +++ b/neo/tools/sound/DialogSoundGroup.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"). @@ -63,7 +63,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDialogSoundGroup message handlers -void CDialogSoundGroup::OnOK() +void CDialogSoundGroup::OnOK() { CString str; int count = lstGroups.GetSelCount(); @@ -71,19 +71,19 @@ void CDialogSoundGroup::OnOK() lstGroups.GetText(i, str); list.Append(str.GetBuffer(0)); } - + CDialog::OnOK(); } -BOOL CDialogSoundGroup::OnInitDialog() +BOOL CDialogSoundGroup::OnInitDialog() { CDialog::OnInitDialog(); - + int count = list.Num(); for (int i = 0; i < count; i++) { lstGroups.AddString(list[i]); } - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } diff --git a/neo/tools/sound/DialogSoundGroup.h b/neo/tools/sound/DialogSoundGroup.h index 035e4467..50f2a046 100644 --- a/neo/tools/sound/DialogSoundGroup.h +++ b/neo/tools/sound/DialogSoundGroup.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/neo/ui/BindWindow.cpp b/neo/ui/BindWindow.cpp index 83407298..a3e9b8a6 100644 --- a/neo/ui/BindWindow.cpp +++ b/neo/ui/BindWindow.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"). @@ -58,7 +58,7 @@ idBindWindow::~idBindWindow() { const char *idBindWindow::HandleEvent(const sysEvent_t *event, bool *updateVisuals) { static char ret[ 256 ]; - + if (!(event->evType == SE_KEY && event->evValue2)) { return ""; } diff --git a/neo/ui/BindWindow.h b/neo/ui/BindWindow.h index 3364cf97..7dd9f035 100644 --- a/neo/ui/BindWindow.h +++ b/neo/ui/BindWindow.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"). @@ -39,12 +39,12 @@ public: virtual void PostParse(); virtual void Draw(int time, float x, float y); virtual size_t Allocated(){return idWindow::Allocated();}; -// -// +// +// virtual idWinVar *GetWinVarByName(const char *_name, bool winLookup = false, drawWin_t** owner = NULL ); -// +// virtual void Activate( bool activate, idStr &act ); - + private: void CommonInit(); idWinStr bindName; diff --git a/neo/ui/ChoiceWindow.cpp b/neo/ui/ChoiceWindow.cpp index 1135232c..277edc6f 100644 --- a/neo/ui/ChoiceWindow.cpp +++ b/neo/ui/ChoiceWindow.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"). @@ -85,7 +85,7 @@ idChoiceWindow::~idChoiceWindow() { void idChoiceWindow::RunNamedEvent( const char* eventName ) { idStr event, group; - + if ( !idStr::Cmpn( eventName, "cvar read ", 10 ) ) { event = eventName; group = event.Mid( 10, event.Length() - 10 ); @@ -108,7 +108,7 @@ void idChoiceWindow::UpdateVars( bool read, bool force ) { cvarStr.Set( cvar->GetString() ); } else { cvar->SetString( cvarStr.c_str() ); - } + } } if ( !read && guiStr.NeedsUpdate() ) { guiStr.Set( va( "%i", currentChoice ) ); @@ -199,7 +199,7 @@ const char *idChoiceWindow::HandleEvent(const sysEvent_t *event, bool *updateVis if ( runAction2 ) { RunScript( ON_ACTIONRELEASE ); } - + return cmd; } @@ -216,7 +216,7 @@ void idChoiceWindow::UpdateChoice() { if ( !updateStr.Num() ) { return; } - UpdateVars( true ); + UpdateVars( true ); updateStr.Update(); if ( choiceType == 0 ) { // ChoiceType 0 stores current as an integer in either cvar or gui @@ -274,7 +274,7 @@ idWinVar *idChoiceWindow::GetWinVarByName(const char *_name, bool fixup, drawWin if ( idStr::Icmp( _name, "updateGroup" ) == 0 ) { return &updateGroup; } - + return idWindow::GetWinVarByName(_name, fixup, owner); } @@ -322,7 +322,7 @@ void idChoiceWindow::UpdateChoicesAndVals( void ) { if (token == "-") { negNum = true; continue; - } + } if (token == ";") { if (str2.Length()) { str2.StripTrailingWhitespace(); diff --git a/neo/ui/ChoiceWindow.h b/neo/ui/ChoiceWindow.h index 4733e2fb..b18dff16 100644 --- a/neo/ui/ChoiceWindow.h +++ b/neo/ui/ChoiceWindow.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,21 +38,21 @@ public: virtual ~idChoiceWindow(); virtual const char *HandleEvent(const sysEvent_t *event, bool *updateVisuals); - virtual void PostParse(); - virtual void Draw(int time, float x, float y); + virtual void PostParse(); + virtual void Draw(int time, float x, float y); virtual void Activate( bool activate, idStr &act ); - virtual size_t Allocated(){return idWindow::Allocated();}; - + virtual size_t Allocated(){return idWindow::Allocated();}; + virtual idWinVar *GetWinVarByName(const char *_name, bool winLookup = false, drawWin_t** owner = NULL); void RunNamedEvent( const char* eventName ); - + private: virtual bool ParseInternalVar(const char *name, idParser *src); void CommonInit(); void UpdateChoice(); void ValidateChoice(); - + void InitVars(); // true: read the updated cvar from cvar system, gui from dict // false: write to the cvar system, to the gui dict @@ -60,7 +60,7 @@ private: void UpdateVars( bool read, bool force = false ); void UpdateChoicesAndVals( void ); - + int currentChoice; int choiceType; idStr latchedChoices; diff --git a/neo/ui/DeviceContext.cpp b/neo/ui/DeviceContext.cpp index 9d26383d..42308f8b 100644 --- a/neo/ui/DeviceContext.cpp +++ b/neo/ui/DeviceContext.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 @@ void idDeviceContext::SetupFonts() { fonts.SetGranularity( 1 ); fontLang = cvarSystem->GetCVarString( "sys_lang" ); - + // western european languages can use the english font if ( fontLang == "french" || fontLang == "german" || fontLang == "spanish" || fontLang == "italian" ) { fontLang = "english"; @@ -160,14 +160,14 @@ void idDeviceContext::SetTransformInfo(const idVec3 &org, const idMat3 &m) { mat = m; } -// +// // added method void idDeviceContext::GetTransformInfo(idVec3& org, idMat3& m ) { m = mat; org = origin; } -// +// void idDeviceContext::PopClipRect() { if (clipRects.Num()) { @@ -192,7 +192,7 @@ bool idDeviceContext::ClippedCoords(float *x, float *y, float *w, float *h, floa int c = clipRects.Num(); while( --c > 0 ) { idRectangle *clipRect = &clipRects[c]; - + float ox = *x; float oy = *y; float ow = *w; @@ -335,7 +335,7 @@ void idDeviceContext::DrawStretchPic(float x, float y, float w, float h, float s verts[3].tangents[1][0] = 0; verts[3].tangents[1][1] = 1; verts[3].tangents[1][2] = 0; - + bool ident = !mat.IsIdentity(); if ( ident ) { verts[0].xyz -= origin; @@ -353,7 +353,7 @@ void idDeviceContext::DrawStretchPic(float x, float y, float w, float h, float s } renderSystem->DrawStretchPic( &verts[0], &indexes[0], 4, 6, shader, ident ); - + } @@ -362,8 +362,8 @@ void idDeviceContext::DrawMaterial(float x, float y, float w, float h, const idM renderSystem->SetColor(color); float s0, s1, t0, t1; -// -// handle negative scales as well +// +// handle negative scales as well if ( scalex < 0 ) { w *= -1; @@ -374,7 +374,7 @@ void idDeviceContext::DrawMaterial(float x, float y, float w, float h, const idM h *= -1; scaley *= -1; } -// +// if( w < 0 ) { // flip about vertical w = -w; s0 = 1 * scalex; @@ -405,12 +405,12 @@ void idDeviceContext::DrawMaterial(float x, float y, float w, float h, const idM } void idDeviceContext::DrawMaterialRotated(float x, float y, float w, float h, const idMaterial *mat, const idVec4 &color, float scalex, float scaley, float angle) { - + renderSystem->SetColor(color); float s0, s1, t0, t1; - // - // handle negative scales as well + // + // handle negative scales as well if ( scalex < 0 ) { w *= -1; @@ -421,7 +421,7 @@ void idDeviceContext::DrawMaterialRotated(float x, float y, float w, float h, co h *= -1; scaley *= -1; } - // + // if( w < 0 ) { // flip about vertical w = -w; s0 = 1 * scalex; @@ -452,7 +452,7 @@ void idDeviceContext::DrawMaterialRotated(float x, float y, float w, float h, co } void idDeviceContext::DrawStretchPicRotated(float x, float y, float w, float h, float s1, float t1, float s2, float t2, const idMaterial *shader, float angle) { - + idDrawVert verts[4]; glIndex_t indexes[6]; indexes[0] = 3; @@ -572,7 +572,7 @@ void idDeviceContext::DrawFilledRect( float x, float y, float w, float h, const } renderSystem->SetColor(color); - + if (ClippedCoords(&x, &y, &w, &h, NULL, NULL, NULL, NULL)) { return; } @@ -589,7 +589,7 @@ void idDeviceContext::DrawRect( float x, float y, float w, float h, float size, } renderSystem->SetColor(color); - + if (ClippedCoords(&x, &y, &w, &h, NULL, NULL, NULL, NULL)) { return; } @@ -877,7 +877,7 @@ idRegion *idDeviceContext::GetTextRegion(const char *text, float textScale, idRe return; } - y = lineSkip + rectDraw.y + yStart; + y = lineSkip + rectDraw.y + yStart; len = 0; buff[0] = '\0'; newLine = 0; @@ -896,7 +896,7 @@ idRegion *idDeviceContext::GetTextRegion(const char *text, float textScale, idRe if (len) { float x = rectDraw.x ; - + buff[newLine] = '\0'; DrawText(x, y, textScale, color, buff, 0, 0, 0); if (!wrap) { @@ -931,7 +931,7 @@ void idDeviceContext::DrawEditCursor( float x, float y, float scale ) { float useScale = scale * useFont->glyphScale; const glyphInfo_t *glyph2 = &useFont->glyphs[(overStrikeMode) ? '_' : '|']; float yadj = useScale * glyph2->top; - PaintChar(x, y - yadj,glyph2->imageWidth,glyph2->imageHeight,useScale,glyph2->s,glyph2->t,glyph2->s2,glyph2->t2,glyph2->glyph); + PaintChar(x, y - yadj,glyph2->imageWidth,glyph2->imageHeight,useScale,glyph2->s,glyph2->t,glyph2->s2,glyph2->t2,glyph2->glyph); } int idDeviceContext::DrawText( const char *text, float textScale, int textAlign, idVec4 color, idRectangle rectDraw, bool wrap, int cursor, bool calcOnly, idList *breaks, int limit ) { @@ -963,7 +963,7 @@ int idDeviceContext::DrawText( const char *text, float textScale, int textAlign, textPtr = text; - y = lineSkip + rectDraw.y; + y = lineSkip + rectDraw.y; len = 0; buff[0] = '\0'; newLine = 0; diff --git a/neo/ui/DeviceContext.h b/neo/ui/DeviceContext.h index effcf926..b83c3aca 100644 --- a/neo/ui/DeviceContext.h +++ b/neo/ui/DeviceContext.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"). @@ -42,7 +42,7 @@ class idDeviceContext { public: idDeviceContext(); ~idDeviceContext() { } - + void Init(); void Shutdown(); bool Initialized() { return initialized; } @@ -150,7 +150,7 @@ private: int cursor; idList clipRects; - + static idList fonts; idStr fontLang; diff --git a/neo/ui/EditWindow.cpp b/neo/ui/EditWindow.cpp index e3d030fa..7551fcb2 100644 --- a/neo/ui/EditWindow.cpp +++ b/neo/ui/EditWindow.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"). @@ -61,7 +61,7 @@ bool idEditWindow::ParseInternalVar( const char *_name, idParser *src ) { ParseString( src, sourceFile ); return true; } - if ( idStr::Icmp( _name, "password" ) == 0 ) { + if ( idStr::Icmp( _name, "password" ) == 0 ) { password = src->ParseBool(); return true; } @@ -146,7 +146,7 @@ void idEditWindow::Draw( int time, float x, float y ) { idStr pass; const char* buffer; - if ( password ) { + if ( password ) { const char* temp = text; for ( ; *temp; temp++ ) { pass += "*"; @@ -221,7 +221,7 @@ const char *idEditWindow::HandleEvent(const sysEvent_t *event, bool *updateVisua if ( maxChars && len > maxChars ) { len = maxChars; } - + if ( ( key == K_ENTER || key == K_KP_ENTER ) && event->evValue2 ) { RunScript( ON_ACTION ); RunScript( ON_ENTER ); @@ -238,7 +238,7 @@ const char *idEditWindow::HandleEvent(const sysEvent_t *event, bool *updateVisua } if ( key == 'h' - 'a' + 1 || key == K_BACKSPACE ) { // ctrl-h is backspace - if ( cursorPos > 0 ) { + if ( cursorPos > 0 ) { if ( cursorPos >= len ) { buffer[len - 1] = 0; cursorPos = len - 1; @@ -253,11 +253,11 @@ const char *idEditWindow::HandleEvent(const sysEvent_t *event, bool *updateVisua } return ""; - } + } - // - // ignore any non printable chars (except enter when wrap is enabled) - // + // + // ignore any non printable chars (except enter when wrap is enabled) + // if ( wrap && (key == K_ENTER || key == K_KP_ENTER) ) { } else if ( !idStr::CharIsPrintable( key ) ) { return ""; @@ -265,17 +265,17 @@ const char *idEditWindow::HandleEvent(const sysEvent_t *event, bool *updateVisua if ( numeric ) { if ( ( key < '0' || key > '9' ) && key != '.' ) { - return ""; + return ""; } } if ( dc->GetOverStrike() ) { if ( maxChars && cursorPos >= maxChars ) { - return ""; + return ""; } } else { if ( ( len == MAX_EDITFIELD - 1 ) || ( maxChars && len >= maxChars ) ) { - return ""; + return ""; } memmove( &buffer[ cursorPos + 1 ], &buffer[ cursorPos ], len + 1 - cursorPos ); } @@ -326,7 +326,7 @@ const char *idEditWindow::HandleEvent(const sysEvent_t *event, bool *updateVisua cursorPos++; } } - } + } EnsureCursorVisible(); @@ -356,7 +356,7 @@ const char *idEditWindow::HandleEvent(const sysEvent_t *event, bool *updateVisua if ( key == K_HOME ) { if ( idKeyInput::IsDown( K_CTRL ) || cursorLine <= 0 || ( cursorLine >= breaks.Num() ) ) { - cursorPos = 0; + cursorPos = 0; } else { cursorPos = breaks[cursorLine]; } @@ -631,7 +631,7 @@ idEditWindow::RunNamedEvent */ void idEditWindow::RunNamedEvent( const char* eventName ) { idStr event, group; - + if ( !idStr::Cmpn( eventName, "cvar read ", 10 ) ) { event = eventName; group = event.Mid( 10, event.Length() - 10 ); diff --git a/neo/ui/EditWindow.h b/neo/ui/EditWindow.h index 65392ad0..4c03a01c 100644 --- a/neo/ui/EditWindow.h +++ b/neo/ui/EditWindow.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,21 +40,21 @@ class idEditWindow : public idWindow { public: idEditWindow(idUserInterfaceLocal *gui); idEditWindow(idDeviceContext *d, idUserInterfaceLocal *gui); - virtual ~idEditWindow(); + virtual ~idEditWindow(); virtual void Draw( int time, float x, float y ); virtual const char *HandleEvent( const sysEvent_t *event, bool *updateVisuals ); virtual void PostParse(); virtual void GainFocus(); virtual size_t Allocated(){return idWindow::Allocated();}; - + virtual idWinVar * GetWinVarByName(const char *_name, bool winLookup = false, drawWin_t** owner = NULL ); - - virtual void HandleBuddyUpdate(idWindow *buddy); + + virtual void HandleBuddyUpdate(idWindow *buddy); virtual void Activate(bool activate, idStr &act); - + void RunNamedEvent( const char* eventName ); - + private: virtual bool ParseInternalVar(const char *name, idParser *src); @@ -64,11 +64,11 @@ private: // false: write to the cvar system // force == true overrides liveUpdate 0 void UpdateCvar( bool read, bool force = false ); - + void CommonInit(); void EnsureCursorVisible(); void InitScroller( bool horizontal ); - + int maxChars; int paintOffset; int cursorPos; @@ -83,7 +83,7 @@ private: float sizeBias; int textIndex; int lastTextLength; - bool forceScroll; + bool forceScroll; idWinBool password; idWinStr cvarStr; diff --git a/neo/ui/FieldWindow.cpp b/neo/ui/FieldWindow.cpp index 15ad078e..70f33296 100644 --- a/neo/ui/FieldWindow.cpp +++ b/neo/ui/FieldWindow.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"). @@ -102,4 +102,3 @@ void idFieldWindow::Draw(int time, float x, float y) { } dc->DrawText(&text[paintOffset], scale, 0, foreColor, rect, false, ((flags & WIN_FOCUS) || showCursor) ? cursorPos - paintOffset : -1); } - diff --git a/neo/ui/FieldWindow.h b/neo/ui/FieldWindow.h index 916fde3f..b92c4799 100644 --- a/neo/ui/FieldWindow.h +++ b/neo/ui/FieldWindow.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 @@ public: virtual ~idFieldWindow(); virtual void Draw(int time, float x, float y); - + private: virtual bool ParseInternalVar(const char *name, idParser *src); void CommonInit(); diff --git a/neo/ui/GameBearShootWindow.cpp b/neo/ui/GameBearShootWindow.cpp index b2afcbbf..6fc85b54 100644 --- a/neo/ui/GameBearShootWindow.cpp +++ b/neo/ui/GameBearShootWindow.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,7 +47,7 @@ idCVar bearTurretForce( "bearTurretForce", "200", CVAR_FLOAT, "" ); /* ***************************************************************************** -* BSEntity +* BSEntity **************************************************************************** */ BSEntity::BSEntity(idGameBearShootWindow* _game) { @@ -154,7 +154,7 @@ BSEntity::Update ====================== */ void BSEntity::Update( float timeslice ) { - + if ( !visible ) { return; } @@ -451,7 +451,7 @@ const char *idGameBearShootWindow::HandleEvent(const sysEvent_t *event, bool *up return ret; } if ( key == K_MOUSE1) { - // Mouse was clicked + // Mouse was clicked } else { return ret; } @@ -496,11 +496,11 @@ idWinVar *idGameBearShootWindow::GetWinVarByName(const char *_name, bool winLook if ( idStr::Icmp(_name, "gamerunning") == 0 ) { retVar = &gamerunning; - } else if ( idStr::Icmp(_name, "onFire") == 0 ) { + } else if ( idStr::Icmp(_name, "onFire") == 0 ) { retVar = &onFire; - } else if ( idStr::Icmp(_name, "onContinue") == 0 ) { + } else if ( idStr::Icmp(_name, "onContinue") == 0 ) { retVar = &onContinue; - } else if ( idStr::Icmp(_name, "onNewGame") == 0 ) { + } else if ( idStr::Icmp(_name, "onNewGame") == 0 ) { retVar = &onNewGame; } @@ -681,7 +681,7 @@ void idGameBearShootWindow::UpdateBear() { goal->entColor.w = 0.f; goal->fadeIn = true; goal->fadeOut = false; - + helicopter->SetVisible( true ); helicopter->SetMaterial( "game/bearshoot/helicopter" ); helicopter->position.x = 550; diff --git a/neo/ui/GameBearShootWindow.h b/neo/ui/GameBearShootWindow.h index 95600594..07afc0a2 100644 --- a/neo/ui/GameBearShootWindow.h +++ b/neo/ui/GameBearShootWindow.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"). @@ -47,7 +47,7 @@ public: bool fadeOut; idGameBearShootWindow * game; - + public: BSEntity(idGameBearShootWindow* _game); virtual ~BSEntity(); diff --git a/neo/ui/GameBustOutWindow.cpp b/neo/ui/GameBustOutWindow.cpp index ff95ef07..2a4e3b69 100644 --- a/neo/ui/GameBustOutWindow.cpp +++ b/neo/ui/GameBustOutWindow.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,7 +44,7 @@ If you have questions concerning this license or the applicable additional terms /* ***************************************************************************** -* BOEntity +* BOEntity **************************************************************************** */ BOEntity::BOEntity(idGameBustOutWindow* _game) { @@ -163,7 +163,7 @@ BOEntity::Update ====================== */ void BOEntity::Update( float timeslice, int guiTime ) { - + if ( !visible ) { return; } @@ -729,13 +729,13 @@ idWinVar *idGameBustOutWindow::GetWinVarByName(const char *_name, bool winLookup if ( idStr::Icmp(_name, "gamerunning") == 0 ) { retVar = &gamerunning; - } else if ( idStr::Icmp(_name, "onFire") == 0 ) { + } else if ( idStr::Icmp(_name, "onFire") == 0 ) { retVar = &onFire; - } else if ( idStr::Icmp(_name, "onContinue") == 0 ) { + } else if ( idStr::Icmp(_name, "onContinue") == 0 ) { retVar = &onContinue; - } else if ( idStr::Icmp(_name, "onNewGame") == 0 ) { + } else if ( idStr::Icmp(_name, "onNewGame") == 0 ) { retVar = &onNewGame; - } else if ( idStr::Icmp(_name, "onNewLevel") == 0 ) { + } else if ( idStr::Icmp(_name, "onNewLevel") == 0 ) { retVar = &onNewLevel; } @@ -1170,7 +1170,7 @@ void idGameBustOutWindow::UpdateBall( void ) { if ( ball->velocity.y > 0 ) { idVec2 paddleVec( paddleVelocity*2, 0 ); float centerX; - + if ( bigPaddleTime > gui->GetTime() ) { centerX = paddle->x + 80.f; } else { diff --git a/neo/ui/GameBustOutWindow.h b/neo/ui/GameBustOutWindow.h index 5ad41158..30b757a1 100644 --- a/neo/ui/GameBustOutWindow.h +++ b/neo/ui/GameBustOutWindow.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"). @@ -53,7 +53,7 @@ public: bool fadeOut; idGameBustOutWindow * game; - + public: BOEntity(idGameBustOutWindow* _game); virtual ~BOEntity(); diff --git a/neo/ui/GameSSDWindow.cpp b/neo/ui/GameSSDWindow.cpp index 95df13ae..1fa00677 100644 --- a/neo/ui/GameSSDWindow.cpp +++ b/neo/ui/GameSSDWindow.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"). @@ -59,7 +59,7 @@ SSDCrossHair::~SSDCrossHair() { } void SSDCrossHair::WriteToSaveGame( idFile *savefile ) { - + savefile->Write(¤tCrosshair, sizeof(currentCrosshair)); savefile->Write(&crosshairWidth, sizeof(crosshairWidth)); savefile->Write(&crosshairHeight, sizeof(crosshairHeight)); @@ -77,7 +77,7 @@ void SSDCrossHair::ReadFromSaveGame( idFile *savefile ) { } void SSDCrossHair::InitCrosshairs() { - + crosshairMaterial[CROSSHAIR_STANDARD] = declManager->FindMaterial( CROSSHAIR_STANDARD_MATERIAL ); crosshairMaterial[CROSSHAIR_SUPER] = declManager->FindMaterial( CROSSHAIR_SUPER_MATERIAL ); @@ -94,24 +94,24 @@ void SSDCrossHair::Draw(idDeviceContext *dc, const idVec2& cursor) { x = cursor.x-(crosshairWidth/2); y = cursor.y-(crosshairHeight/2); dc->DrawMaterial(x, y, crosshairWidth, crosshairHeight, crosshairMaterial[currentCrosshair], colorWhite, 1.0f, 1.0f); - + } /* ***************************************************************************** -* SSDEntity +* SSDEntity **************************************************************************** */ SSDEntity::SSDEntity() { - EntityInit(); + EntityInit(); } -SSDEntity::~SSDEntity() { +SSDEntity::~SSDEntity() { } void SSDEntity::WriteToSaveGame( idFile *savefile ) { - + savefile->Write(&type, sizeof(type)); game->WriteSaveGameString(materialName, savefile); savefile->Write(&position, sizeof(position)); @@ -121,11 +121,11 @@ void SSDEntity::WriteToSaveGame( idFile *savefile ) { savefile->Write(&rotation, sizeof(rotation)); savefile->Write(&matColor, sizeof(matColor)); - + game->WriteSaveGameString(text, savefile); savefile->Write(&textScale, sizeof(textScale)); savefile->Write(&foreColor, sizeof(foreColor)); - + savefile->Write(¤tTime, sizeof(currentTime)); savefile->Write(&lastUpdate, sizeof(lastUpdate)); savefile->Write(&elapsed, sizeof(elapsed)); @@ -173,7 +173,7 @@ void SSDEntity::EntityInit() { type = SSD_ENTITY_BASE; - + materialName = ""; material = NULL; position.Zero(); @@ -307,7 +307,7 @@ idBounds SSDEntity::WorldToScreen(const idBounds worldBounds) { } idVec3 SSDEntity::WorldToScreen(const idVec3& worldPos) { - + float d = 0.5f*V_WIDTH*idMath::Tan(DEG2RAD(90.0f)/2.0f); //World To Camera Coordinates @@ -337,7 +337,7 @@ idVec3 SSDEntity::ScreenToWorld(const idVec3& screenPos) { /* ***************************************************************************** -* SSDMover +* SSDMover **************************************************************************** */ @@ -349,7 +349,7 @@ SSDMover::~SSDMover() { void SSDMover::WriteToSaveGame( idFile *savefile ) { SSDEntity::WriteToSaveGame(savefile); - + savefile->Write(&speed, sizeof(speed)); savefile->Write(&rotationSpeed, sizeof(rotationSpeed)); } @@ -362,13 +362,13 @@ void SSDMover::ReadFromSaveGame( idFile *savefile, idGameSSDWindow* _game ) { } void SSDMover::MoverInit(const idVec3& _speed, float _rotationSpeed) { - + speed = _speed; rotationSpeed = _rotationSpeed; } void SSDMover::EntityUpdate() { - + SSDEntity::EntityUpdate(); //Move forward based on speed (units per second) @@ -382,13 +382,13 @@ void SSDMover::EntityUpdate() { } if(rotation < 0) { rotation += 360.0f; - } + } } /* ***************************************************************************** -* SSDAsteroid +* SSDAsteroid **************************************************************************** */ @@ -399,7 +399,7 @@ SSDAsteroid SSDAsteroid::asteroidPool[MAX_ASTEROIDS]; SSDAsteroid::SSDAsteroid() { } -SSDAsteroid::~SSDAsteroid() { +SSDAsteroid::~SSDAsteroid() { } void SSDAsteroid::WriteToSaveGame( idFile *savefile ) { @@ -418,7 +418,7 @@ void SSDAsteroid::Init(idGameSSDWindow* _game, const idVec3& startPosition, cons EntityInit(); MoverInit(idVec3(0,0, -_speed), rotate); - + SetGame(_game); type = SSD_ENTITY_ASTEROID; @@ -428,14 +428,14 @@ void SSDAsteroid::Init(idGameSSDWindow* _game, const idVec3& startPosition, cons SetRadius(Max(size.x, size.y), 0.3f); SetRotation(game->random.RandomInt(360)); - + position = startPosition; health = _health; } void SSDAsteroid::EntityUpdate() { - + SSDMover::EntityUpdate(); } @@ -473,7 +473,7 @@ void SSDAsteroid::WriteAsteroids(idFile* savefile) { } void SSDAsteroid::ReadAsteroids(idFile* savefile, idGameSSDWindow* _game) { - + int count; savefile->Read(&count, sizeof(count)); for(int i = 0; i < count; i++) { @@ -497,7 +497,7 @@ SSDAstronaut SSDAstronaut::astronautPool[MAX_ASTRONAUT]; SSDAstronaut::SSDAstronaut() { } -SSDAstronaut::~SSDAstronaut() { +SSDAstronaut::~SSDAstronaut() { } void SSDAstronaut::WriteToSaveGame( idFile *savefile ) { @@ -525,7 +525,7 @@ void SSDAstronaut::Init(idGameSSDWindow* _game, const idVec3& startPosition, flo SetSize(idVec2(256,256)); SetRadius(Max(size.x, size.y), 0.3f); SetRotation(game->random.RandomInt(360)); - + position = startPosition; health = _health; } @@ -544,7 +544,7 @@ SSDAstronaut* SSDAstronaut::GetNewAstronaut(idGameSSDWindow* _game, const idVec3 SSDAstronaut* SSDAstronaut::GetSpecificAstronaut(int id) { return &astronautPool[id]; - + } void SSDAstronaut::WriteAstronauts(idFile* savefile) { @@ -577,7 +577,7 @@ void SSDAstronaut::ReadAstronauts(idFile* savefile, idGameSSDWindow* _game) { /* ***************************************************************************** -* SSDExplosion +* SSDExplosion **************************************************************************** */ @@ -610,7 +610,7 @@ void SSDExplosion::WriteToSaveGame( idFile *savefile ) { savefile->Write(&endTime, sizeof(endTime)); savefile->Write(&explosionType, sizeof(explosionType)); - + savefile->Write(&(buddy->type), sizeof(buddy->type)); savefile->Write(&(buddy->id), sizeof(buddy->id)); @@ -639,7 +639,7 @@ void SSDExplosion::ReadFromSaveGame( idFile *savefile, idGameSSDWindow* _game } void SSDExplosion::Init(idGameSSDWindow* _game, const idVec3& _position, const idVec2& _size, int _length, int _type, SSDEntity* _buddy, bool _killBuddy, bool _followBuddy) { - + EntityInit(); SetGame(_game); @@ -651,7 +651,7 @@ void SSDExplosion::Init(idGameSSDWindow* _game, const idVec3& _position, const i SetPosition(_position); position.z -= 50; - finalSize = _size; + finalSize = _size; length = _length; beginTime = game->ssdTime; endTime = beginTime + length; @@ -668,7 +668,7 @@ void SSDExplosion::Init(idGameSSDWindow* _game, const idVec3& _position, const i } void SSDExplosion::EntityUpdate() { - + SSDEntity::EntityUpdate(); //Always set my position to my buddies position except change z to be on top @@ -686,7 +686,7 @@ void SSDExplosion::EntityUpdate() { //Destroy myself after the explosion is done if(currentTime > endTime) { destroyed = true; - + if(killBuddy) { //Destroy the exploding object buddy->destroyed = true; @@ -765,7 +765,7 @@ void SSDPoints::WriteToSaveGame( idFile *savefile ) { savefile->Write(&beginColor, sizeof(beginColor)); savefile->Write(&endColor, sizeof(endColor)); - + } void SSDPoints::ReadFromSaveGame( idFile *savefile, idGameSSDWindow* _game ) { @@ -786,7 +786,7 @@ void SSDPoints::ReadFromSaveGame( idFile *savefile, idGameSSDWindow* _game ) { void SSDPoints::Init(idGameSSDWindow* _game, SSDEntity* _ent, int _points, int _length, int _distance, const idVec4& color) { EntityInit(); - + SetGame(_game); length = _length; @@ -818,7 +818,7 @@ void SSDPoints::Init(idGameSSDWindow* _game, SSDEntity* _ent, int _points, int _ //beginColor.Set(0,1,0,1); endColor.Set(1,1,1,0); - + beginColor = color; beginColor.w = 1; @@ -924,7 +924,7 @@ void SSDProjectile::ReadFromSaveGame( idFile *savefile, idGameSSDWindow* _game } void SSDProjectile::Init(idGameSSDWindow* _game, const idVec3& _beginPosition, const idVec3& _endPosition, float _speed, float _size) { - + EntityInit(); SetGame(_game); @@ -1021,7 +1021,7 @@ const char* powerupMaterials[][2] = { SSDPowerup SSDPowerup::powerupPool[MAX_POWERUPS]; SSDPowerup::SSDPowerup() { - + } SSDPowerup::~SSDPowerup() { @@ -1048,7 +1048,7 @@ void SSDPowerup::OnHit(int key) { //Small explosion to indicate it is opened SSDExplosion* explosion = SSDExplosion::GetNewExplosion(game, position, size*2.0f, 300, SSDExplosion::EXPLOSION_NORMAL, this, false, true); game->entities.Append(explosion); - + powerupState = POWERUP_STATE_OPEN; SetMaterial(powerupMaterials[powerupType][powerupState]); @@ -1064,7 +1064,7 @@ void SSDPowerup::OnHit(int key) { } void SSDPowerup::OnStrikePlayer() { - + if(powerupState == POWERUP_STATE_OPEN) { //The powerup was open so activate it OnActivatePowerup(); @@ -1126,7 +1126,7 @@ void SSDPowerup::Init(idGameSSDWindow* _game, float _speed, float _rotation) { SetRadius(Max(size.x, size.y), 0.3f); type = SSD_ENTITY_POWERUP; - + idVec3 startPosition; startPosition.x = game->random.RandomInt(V_WIDTH)-(V_WIDTH/2.0f); startPosition.y = game->random.RandomInt(V_HEIGHT)-(V_HEIGHT/2.0f); @@ -1288,7 +1288,7 @@ void idGameSSDWindow::ReadFromSaveGame( idFile *savefile ) { SSDAstronautData_t newAstronaut; savefile->Read(&newAstronaut, sizeof(SSDAstronautData_t)); astronautData.Append(newAstronaut); - + SSDPowerupData_t newPowerup; savefile->Read(&newPowerup, sizeof(SSDPowerupData_t)); powerupData.Append(newPowerup); @@ -1302,7 +1302,7 @@ void idGameSSDWindow::ReadFromSaveGame( idFile *savefile ) { } savefile->Read(&superBlasterTimeout, sizeof(superBlasterTimeout)); - + savefile->Read(&gameStats, sizeof(SSDGameStats_t)); //Reset this because it is no longer valid gameStats.levelStats.targetEnt = NULL; @@ -1330,7 +1330,7 @@ void idGameSSDWindow::ReadFromSaveGame( idFile *savefile ) { } const char *idGameSSDWindow::HandleEvent(const sysEvent_t *event, bool *updateVisuals) { - + // need to call this to allow proper focus and capturing on embedded children const char *ret = idWindow::HandleEvent(event, updateVisuals); @@ -1347,7 +1347,7 @@ const char *idGameSSDWindow::HandleEvent(const sysEvent_t *event, bool *updateVi } if ( key == K_MOUSE1 || key == K_MOUSE2) { - FireWeapon(key); + FireWeapon(key); } else { return ret; } @@ -1373,7 +1373,7 @@ idWinVar *idGameSSDWindow::GetWinVarByName (const char *_name, bool winLookup, d if (idStr::Icmp(_name, "refreshGuiData") == 0) { retVar = &refreshGuiData; } - + if(retVar) { return retVar; @@ -1428,7 +1428,7 @@ bool idGameSSDWindow::ParseInternalVar(const char *_name, idParser *src) { refreshGuiData = src->ParseBool(); return true; } - + if(idStr::Icmp(_name, "levelcount") == 0) { levelCount = src->ParseInt(); for(int i = 0; i < levelCount; i++) { @@ -1532,13 +1532,13 @@ void idGameSSDWindow::ParseAsteroidData(int level, const idStr& asteroidDataStri idToken token; parser.LoadMemory(asteroidDataString.c_str(), asteroidDataString.Length(), "AsteroidData"); - asteroidData[level].speedMin = parser.ParseFloat(); //Speed Min + asteroidData[level].speedMin = parser.ParseFloat(); //Speed Min asteroidData[level].speedMax = parser.ParseFloat(); //Speed Max - asteroidData[level].sizeMin = parser.ParseFloat(); //Size Min + asteroidData[level].sizeMin = parser.ParseFloat(); //Size Min asteroidData[level].sizeMax = parser.ParseFloat(); //Size Max - asteroidData[level].rotateMin = parser.ParseFloat(); //Rotate Min (rotations per second) + asteroidData[level].rotateMin = parser.ParseFloat(); //Rotate Min (rotations per second) asteroidData[level].rotateMax = parser.ParseFloat(); //Rotate Max (rotations per second) asteroidData[level].spawnMin = parser.ParseInt(); //Spawn Min @@ -1550,15 +1550,15 @@ void idGameSSDWindow::ParseAsteroidData(int level, const idStr& asteroidDataStri } void idGameSSDWindow::ParsePowerupData(int level, const idStr& powerupDataString) { - + idParser parser; idToken token; parser.LoadMemory(powerupDataString.c_str(), powerupDataString.Length(), "PowerupData"); - powerupData[level].speedMin = parser.ParseFloat(); //Speed Min + powerupData[level].speedMin = parser.ParseFloat(); //Speed Min powerupData[level].speedMax = parser.ParseFloat(); //Speed Max - powerupData[level].rotateMin = parser.ParseFloat(); //Rotate Min (rotations per second) + powerupData[level].rotateMin = parser.ParseFloat(); //Rotate Min (rotations per second) powerupData[level].rotateMax = parser.ParseFloat(); //Rotate Max (rotations per second) powerupData[level].spawnMin = parser.ParseInt(); //Spawn Min @@ -1572,21 +1572,21 @@ void idGameSSDWindow::ParseWeaponData(int weapon, const idStr& weaponDataString) idToken token; parser.LoadMemory(weaponDataString.c_str(), weaponDataString.Length(), "WeaponData"); - weaponData[weapon].speed = parser.ParseFloat(); + weaponData[weapon].speed = parser.ParseFloat(); weaponData[weapon].damage = parser.ParseFloat(); weaponData[weapon].size = parser.ParseFloat(); } void idGameSSDWindow::ParseAstronautData(int level, const idStr& astronautDataString) { - + idParser parser; idToken token; parser.LoadMemory(astronautDataString.c_str(), astronautDataString.Length(), "AstronautData"); - astronautData[level].speedMin = parser.ParseFloat(); //Speed Min + astronautData[level].speedMin = parser.ParseFloat(); //Speed Min astronautData[level].speedMax = parser.ParseFloat(); //Speed Max - astronautData[level].rotateMin = parser.ParseFloat(); //Rotate Min (rotations per second) + astronautData[level].rotateMin = parser.ParseFloat(); //Rotate Min (rotations per second) astronautData[level].rotateMax = parser.ParseFloat(); //Rotate Max (rotations per second) astronautData[level].spawnMin = parser.ParseInt(); //Spawn Min @@ -1627,7 +1627,7 @@ void idGameSSDWindow::CommonInit() { declManager->FindMaterial(powerupMaterials[i][0]); declManager->FindMaterial(powerupMaterials[i][1]); } - + // Precache sounds declManager->FindSound( "arcade_blaster" ); declManager->FindSound( "arcade_capture " ); @@ -1645,16 +1645,16 @@ void idGameSSDWindow::ResetGameStats() { gameStats.health = 100; -} +} void idGameSSDWindow::ResetLevelStats() { - + ResetEntities(); - + //Reset the level statistics structure memset(&gameStats.levelStats, 0, sizeof(gameStats.levelStats)); - + } void idGameSSDWindow::ResetEntities() { @@ -1666,25 +1666,25 @@ void idGameSSDWindow::ResetEntities() { } void idGameSSDWindow::StartGame() { - + gameStats.gameRunning = true; } void idGameSSDWindow::StopGame() { - + gameStats.gameRunning = false; } void idGameSSDWindow::GameOver() { - + StopGame(); gui->HandleNamedEvent("gameOver"); } void idGameSSDWindow::BeginLevel(int level) { - + ResetLevelStats(); gameStats.currentLevel = level; @@ -1696,13 +1696,13 @@ void idGameSSDWindow::BeginLevel(int level) { * Continue game resets the players health */ void idGameSSDWindow::ContinueGame() { - gameStats.health = 100; + gameStats.health = 100; StartGame(); } void idGameSSDWindow::LevelComplete() { - + gameStats.prebonusscore = gameStats.score; // Add the bonuses @@ -1820,7 +1820,7 @@ void idGameSSDWindow::UpdateGame() { } void idGameSSDWindow::CheckForHits() { - + //See if the entity has gotten close enough for(int i = 0; i < entities.Num(); i++) { SSDEntity* ent = entities[i]; @@ -1857,20 +1857,20 @@ void idGameSSDWindow::CheckForHits() { void idGameSSDWindow::ZOrderEntities() { //Z-Order the entities //Using a simple sorting method - for (int i = entities.Num()-1; i >= 0; i--) { + for (int i = entities.Num()-1; i >= 0; i--) { bool flipped = false; - for (int j = 0; jposition.z > entities[j+1]->position.z) { + for (int j = 0; jposition.z > entities[j+1]->position.z) { SSDEntity* ent = entities[j]; - entities[j] = entities[j+1]; - entities[j+1] = ent; - flipped = true; - } - } - if (!flipped) { + entities[j] = entities[j+1]; + entities[j+1] = ent; + flipped = true; + } + } + if (!flipped) { //Jump out because it is sorted - break; - } + break; + } } } @@ -1894,10 +1894,10 @@ void idGameSSDWindow::SpawnAsteroid() { float speed = random.RandomInt(asteroidData[gameStats.currentLevel].speedMax - asteroidData[gameStats.currentLevel].speedMin) + asteroidData[gameStats.currentLevel].speedMin; float size = random.RandomInt(asteroidData[gameStats.currentLevel].sizeMax - asteroidData[gameStats.currentLevel].sizeMin) + asteroidData[gameStats.currentLevel].sizeMin; float rotate = (random.RandomFloat() * (asteroidData[gameStats.currentLevel].rotateMax - asteroidData[gameStats.currentLevel].rotateMin)) + asteroidData[gameStats.currentLevel].rotateMin; - + SSDAsteroid* asteroid = SSDAsteroid::GetNewAsteroid(this, startPosition, idVec2(size, size), speed, rotate, asteroidData[gameStats.currentLevel].asteroidHealth); entities.Append(asteroid); - + gameStats.levelStats.nextAsteroidSpawnTime = currentTime + random.RandomInt(asteroidData[gameStats.currentLevel].spawnMax - asteroidData[gameStats.currentLevel].spawnMin) + asteroidData[gameStats.currentLevel].spawnMin; } @@ -1910,9 +1910,9 @@ void idGameSSDWindow::FireWeapon(int key) { cursor.y = gui->CursorY(); if(key == K_MOUSE1) { - + gameStats.levelStats.shotCount++; - + if(gameStats.levelStats.targetEnt) { //Aim the projectile from the bottom of the screen directly at the ent //SSDProjectile* newProj = new SSDProjectile(this, idVec3(320,0,0), gameStats.levelStats.targetEnt->position, weaponData[gameStats.currentWeapon].speed, weaponData[gameStats.currentWeapon].size); @@ -1941,8 +1941,8 @@ void idGameSSDWindow::FireWeapon(int key) { idVec3 vec = idVec3(cursorWorld.x, cursorWorld.y, (Z_FAR-Z_NEAR)/8.0f); vec *= 8; SSDProjectile* newProj = SSDProjectile::GetNewProjectile(this, idVec3(0,-180,0), vec, weaponData[gameStats.currentWeapon].speed, weaponData[gameStats.currentWeapon].size); - entities.Append(newProj); - + entities.Append(newProj); + } @@ -1972,12 +1972,12 @@ SSDEntity* idGameSSDWindow::EntityHitTest(const idVec2& pt) { void idGameSSDWindow::HitAsteroid(SSDAsteroid* asteroid, int key) { - + asteroid->health -= weaponData[gameStats.currentWeapon].damage; if(asteroid->health <= 0) { - + //The asteroid has been destroyed SSDExplosion* explosion = SSDExplosion::GetNewExplosion(this, asteroid->position, asteroid->size*2, 300, SSDExplosion::EXPLOSION_NORMAL, asteroid); entities.Append(explosion); @@ -1985,7 +1985,7 @@ void idGameSSDWindow::HitAsteroid(SSDAsteroid* asteroid, int key) { AddScore(asteroid, asteroidData[gameStats.currentLevel].asteroidPoints); - //Don't let the player hit it anymore because + //Don't let the player hit it anymore because asteroid->noHit = true; gameStats.levelStats.destroyedAsteroids++; @@ -2004,7 +2004,7 @@ void idGameSSDWindow::AsteroidStruckPlayer(SSDAsteroid* asteroid) { asteroid->noPlayerDamage = true; asteroid->noHit = true; - + AddDamage(asteroidData[gameStats.currentLevel].asteroidDamage); SSDExplosion* explosion = SSDExplosion::GetNewExplosion(this, asteroid->position, asteroid->size*2, 300, SSDExplosion::EXPLOSION_NORMAL, asteroid); @@ -2015,7 +2015,7 @@ void idGameSSDWindow::AsteroidStruckPlayer(SSDAsteroid* asteroid) { void idGameSSDWindow::AddScore(SSDEntity* ent, int points) { SSDPoints* pointsEnt; - + if(points > 0) { pointsEnt = SSDPoints::GetNewPoints(this, ent, points, 1000, 50, idVec4(0,1,0,1)); } else { @@ -2046,28 +2046,28 @@ void idGameSSDWindow::AddHealth(int health) { void idGameSSDWindow::OnNuke() { - + gui->HandleNamedEvent("nuke"); //Destory All Asteroids for(int i = 0 ; i < entities.Num(); i++) { if(entities[i]->type == SSD_ENTITY_ASTEROID) { - + //The asteroid has been destroyed SSDExplosion* explosion = SSDExplosion::GetNewExplosion(this, entities[i]->position, entities[i]->size*2, 300, SSDExplosion::EXPLOSION_NORMAL, entities[i]); entities.Append(explosion); AddScore(entities[i], asteroidData[gameStats.currentLevel].asteroidPoints); - //Don't let the player hit it anymore because + //Don't let the player hit it anymore because entities[i]->noHit = true; gameStats.levelStats.destroyedAsteroids++; } } PlaySound("arcade_explode"); - + //Check to see if a nuke ends the level /*if(gameStats.levelStats.destroyedAsteroids >= levelData[gameStats.currentLevel].needToWin) { LevelComplete(); @@ -2076,7 +2076,7 @@ void idGameSSDWindow::OnNuke() { } void idGameSSDWindow::OnRescueAll() { - + gui->HandleNamedEvent("rescueAll"); //Rescue All Astronauts @@ -2090,7 +2090,7 @@ void idGameSSDWindow::OnRescueAll() { } void idGameSSDWindow::OnSuperBlaster() { - + StartSuperBlaster(); } @@ -2144,7 +2144,7 @@ void idGameSSDWindow::RefreshGuiData() { } idVec2 idGameSSDWindow::GetCursorWorld() { - + idVec2 cursor; //GetCursor(cursor); cursor.x = gui->CursorX(); @@ -2155,7 +2155,7 @@ idVec2 idGameSSDWindow::GetCursorWorld() { } void idGameSSDWindow::SpawnAstronaut() { - + int currentTime = ssdTime; if(currentTime < gameStats.levelStats.nextAstronautSpawnTime) { @@ -2248,7 +2248,7 @@ void idGameSSDWindow::SpawnPowerup() { } void idGameSSDWindow::StartSuperBlaster() { - + gui->HandleNamedEvent("startSuperBlaster"); gameStats.currentWeapon = 1; superBlasterTimeout = ssdTime + 10000; diff --git a/neo/ui/GameSSDWindow.h b/neo/ui/GameSSDWindow.h index 7da1db28..63b32378 100644 --- a/neo/ui/GameSSDWindow.h +++ b/neo/ui/GameSSDWindow.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"). @@ -94,7 +94,7 @@ public: bool inUse; - + public: SSDEntity(); virtual ~SSDEntity(); @@ -113,7 +113,7 @@ public: void Update(); bool HitTest(const idVec2& pt); - + virtual void EntityUpdate() {}; virtual void Draw(idDeviceContext *dc); @@ -131,7 +131,7 @@ public: /* ***************************************************************************** -* SSDMover +* SSDMover **************************************************************************** */ @@ -157,7 +157,7 @@ public: /* ***************************************************************************** -* SSDAsteroid +* SSDAsteroid **************************************************************************** */ @@ -185,15 +185,15 @@ public: static void ReadAsteroids(idFile* savefile, idGameSSDWindow* _game); - + protected: static SSDAsteroid asteroidPool[MAX_ASTEROIDS]; - + }; /* ***************************************************************************** -* SSDAstronaut +* SSDAstronaut **************************************************************************** */ #define MAX_ASTRONAUT 8 @@ -207,7 +207,7 @@ public: public: SSDAstronaut(); ~SSDAstronaut(); - + virtual void WriteToSaveGame( idFile *savefile ); virtual void ReadFromSaveGame( idFile *savefile, idGameSSDWindow* _game ); @@ -225,7 +225,7 @@ protected: /* ***************************************************************************** -* SSDExplosion +* SSDExplosion **************************************************************************** */ #define MAX_EXPLOSIONS 64 @@ -283,7 +283,7 @@ class SSDPoints : public SSDEntity { idVec4 beginColor; idVec4 endColor; - + public: SSDPoints(); ~SSDPoints(); @@ -336,7 +336,7 @@ protected: #define MAX_POWERUPS 64 -/** +/** * Powerups work in two phases: * 1.) Closed container hurls at you * If you shoot the container it open @@ -385,7 +385,7 @@ public: void OnOpenPowerup(); void OnActivatePowerup(); - + void Init(idGameSSDWindow* _game, float _speed, float _rotation); @@ -436,7 +436,7 @@ typedef struct { int size; } SSDWeaponData_t; -/** +/** * SSDLevelStats_t * Data that is used for each level. This data is reset * each new level. @@ -459,7 +459,7 @@ typedef struct { SSDEntity* targetEnt; } SSDLevelStats_t; -/** +/** * SSDGameStats_t * Data that is used for the game that is currently running. Memset this * to completely reset the game @@ -491,8 +491,8 @@ public: virtual const char* HandleEvent(const sysEvent_t *event, bool *updateVisuals); virtual idWinVar* GetWinVarByName (const char *_name, bool winLookup = false, drawWin_t** owner = NULL); - - + + virtual void Draw(int time, float x, float y); void AddHealth(int health); @@ -510,11 +510,11 @@ public: - static idRandom random; + static idRandom random; int ssdTime; - + private: - + //Initialization virtual bool ParseInternalVar(const char *name, idParser *src); void ParseLevelData(int level, const idStr& levelDataString); @@ -541,7 +541,7 @@ private: void LevelComplete(); void GameComplete(); - + void UpdateGame(); void CheckForHits(); @@ -555,10 +555,10 @@ private: void HitAsteroid(SSDAsteroid* asteroid, int key); void AsteroidStruckPlayer(SSDAsteroid* asteroid); - - - + + + void RefreshGuiData(); idVec2 GetCursorWorld(); @@ -577,7 +577,7 @@ private: //void FreeSoundEmitter( bool immediate ); - + public: @@ -598,7 +598,7 @@ public: idList astronautData; idList powerupData; - + //Weapon Data int weaponCount; idList weaponData; @@ -610,7 +610,7 @@ public: idList entities; int currentSound; - + }; #endif //__GAME_SSD_WINDOW_H__ diff --git a/neo/ui/GameWindow.cpp b/neo/ui/GameWindow.cpp index c535e158..282d0bd4 100644 --- a/neo/ui/GameWindow.cpp +++ b/neo/ui/GameWindow.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,4 +49,3 @@ idGameWindowProxy::Draw void idGameWindowProxy::Draw( int time, float x, float y ) { common->Printf( "TODO: idGameWindowProxy::Draw\n" ); } - diff --git a/neo/ui/GameWindow.h b/neo/ui/GameWindow.h index 8c1912fd..5ac340eb 100644 --- a/neo/ui/GameWindow.h +++ b/neo/ui/GameWindow.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/neo/ui/GuiScript.cpp b/neo/ui/GuiScript.cpp index ac1f9aaa..4eb5fb4c 100644 --- a/neo/ui/GuiScript.cpp +++ b/neo/ui/GuiScript.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"). @@ -61,7 +61,7 @@ void Script_Set(idWindow *window, idList *src) { window->AddCommand(*dest); } return; - } + } } (*src)[0].var->Set((*src)[1].var->c_str()); (*src)[0].var->SetEval(false); @@ -186,26 +186,26 @@ void Script_Transition(idWindow *window, idList *src) { if (src->Num() >= 4) { idWinRectangle *rect = NULL; idWinVec4 *vec4 = dynamic_cast((*src)[0].var); - // + // // added float variable idWinFloat* val = NULL; - // + // if (vec4 == NULL) { rect = dynamic_cast((*src)[0].var); - // - // added float variable + // + // added float variable if ( NULL == rect ) { val = dynamic_cast((*src)[0].var); } - // + // } idWinVec4 *from = dynamic_cast((*src)[1].var); idWinVec4 *to = dynamic_cast((*src)[2].var); idWinStr *timeStr = dynamic_cast((*src)[3].var); - // - // added float variable + // + // added float variable if (!((vec4 || rect || val) && from && to && timeStr)) { - // + // common->Warning("Bad transition in gui %s in window %s\n", window->GetGui()->GetSourceFile(), window->GetName()); return; } @@ -219,16 +219,16 @@ void Script_Transition(idWindow *window, idList *src) { ac = atof(*acv); dc = atof(*dcv); } - + if (vec4) { vec4->SetEval(false); window->AddTransition(vec4, *from, *to, time, ac, dc); - // - // added float variable + // + // added float variable } else if ( val ) { val->SetEval ( false ); window->AddTransition(val, *from, *to, time, ac, dc); - // + // } else { rect->SetEval(false); window->AddTransition(rect, *from, *to, time, ac, dc); @@ -344,7 +344,7 @@ idGuiScript::Parse */ bool idGuiScript::Parse(idParser *src) { int i; - + // first token should be function call // then a potentially variable set of parms // ended with a ; @@ -355,7 +355,7 @@ bool idGuiScript::Parse(idParser *src) { } handler = NULL; - + for ( i = 0; i < scriptCommandCount ; i++ ) { if ( idStr::Icmp(token, commandList[i].name) == 0 ) { handler = commandList[i].handler; @@ -367,14 +367,14 @@ bool idGuiScript::Parse(idParser *src) { src->Error("Uknown script call %s", token.c_str()); } // now read parms til ; - // all parms are read as idWinStr's but will be fixed up later + // all parms are read as idWinStr's but will be fixed up later // to be proper types while (1) { if ( !src->ReadToken(&token) ) { src->Error( "Unexpected end of file" ); return false; } - + if (idStr::Icmp(token, ";") == 0) { break; } @@ -392,12 +392,12 @@ bool idGuiScript::Parse(idParser *src) { parms.Append( wv ); } - // + // // verify min/max params if ( handler && (parms.Num() < commandList[i].mMinParms || parms.Num() > commandList[i].mMaxParms ) ) { src->Error("incorrect number of parameters for script %s", commandList[i].name ); } - // + // return true; } @@ -453,7 +453,7 @@ void idGuiScript::FixupParms(idWindow *win) { } int parmCount = parms.Num(); for (int i = 1; i < parmCount; i++) { - idWinStr *str = dynamic_cast(parms[i].var); + idWinStr *str = dynamic_cast(parms[i].var); if (idStr::Icmpn(*str, "gui::", 5) == 0) { // always use a string here, no point using a float if it is one @@ -472,12 +472,12 @@ void idGuiScript::FixupParms(idWindow *win) { // parms[i].var = dest; // parms[i].own = false; //} - // + // } else if ((*str[0]) == '$') { - // + // // dont include the $ when asking for variable dest = win->GetGui()->GetDesktop()->GetWinVarByName((const char*)(*str) + 1, true); - // + // if (dest) { delete parms[i].var; parms[i].var = dest; @@ -505,15 +505,15 @@ void idGuiScript::FixupParms(idWindow *win) { } } else if (handler == &Script_Transition) { if (parms.Num() < 4) { - common->Warning("Window %s in gui %s has a bad transition definition", win->GetName(), win->GetGui()->GetSourceFile()); + common->Warning("Window %s in gui %s has a bad transition definition", win->GetName(), win->GetGui()->GetSourceFile()); } idWinStr *str = dynamic_cast(parms[0].var); assert(str); - // + // drawWin_t *destowner; idWinVar *dest = win->GetWinVarByName(*str, true, &destowner ); - // + // if (dest) { delete parms[0].var; @@ -523,8 +523,8 @@ void idGuiScript::FixupParms(idWindow *win) { common->Warning("Window %s in gui %s: a transition does not have a valid destination var %s", win->GetName(), win->GetGui()->GetSourceFile(),str->c_str()); } - // - // support variables as parameters + // + // support variables as parameters int c; for ( c = 1; c < 3; c ++ ) { str = dynamic_cast(parms[c].var); @@ -541,15 +541,15 @@ void idGuiScript::FixupParms(idWindow *win) { dest = NULL; } - if ( dest ) { + if ( dest ) { idWindow* ownerparent; idWindow* destparent; if ( owner ) { ownerparent = owner->simp?owner->simp->GetParent():owner->win->GetParent(); destparent = destowner->simp?destowner->simp->GetParent():destowner->win->GetParent(); - // If its the rectangle they are referencing then adjust it - if ( ownerparent && destparent && + // If its the rectangle they are referencing then adjust it + if ( ownerparent && destparent && (dest == (owner->simp?owner->simp->GetWinVarByName ( "rect" ):owner->win->GetWinVarByName ( "rect" ) ) ) ) { idRectangle rect; @@ -565,11 +565,11 @@ void idGuiScript::FixupParms(idWindow *win) { } } else { v4->Set(*str); - } - + } + delete str; - } - // + } + // } else { int c = parms.Num(); diff --git a/neo/ui/GuiScript.h b/neo/ui/GuiScript.h index c9317a53..e948927b 100644 --- a/neo/ui/GuiScript.h +++ b/neo/ui/GuiScript.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/neo/ui/ListGUI.cpp b/neo/ui/ListGUI.cpp index 6e95b882..bab0c52a 100644 --- a/neo/ui/ListGUI.cpp +++ b/neo/ui/ListGUI.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,7 +44,7 @@ void idListGUILocal::StateChanged() { } for( i = 0; i < Num(); i++ ) { - m_pGUI->SetStateString( va( "%s_item_%i", m_name.c_str(), i ), (*this)[i].c_str() ); + m_pGUI->SetStateString( va( "%s_item_%i", m_name.c_str(), i ), (*this)[i].c_str() ); } for( i = Num() ; i < m_water ; i++ ) { m_pGUI->SetStateString( va( "%s_item_%i", m_name.c_str(), i ), "" ); @@ -68,7 +68,7 @@ idListGUILocal::GetSelection ==================== */ int idListGUILocal::GetSelection( char *s, int size, int _sel ) const { - if ( s ) { + if ( s ) { s[ 0 ] = '\0'; } int sel = m_pGUI->State().GetInt( va( "%s_sel_%i", m_name.c_str(), _sel ), "-1" ); @@ -82,7 +82,7 @@ int idListGUILocal::GetSelection( char *s, int size, int _sel ) const { if ( sel >= m_ids.Num() ) { sel = 0; } - m_pGUI->SetStateInt( va( "%s_selid_0", m_name.c_str() ), m_ids[ sel ] ); + m_pGUI->SetStateInt( va( "%s_selid_0", m_name.c_str() ), m_ids[ sel ] ); return m_ids[ sel ]; } diff --git a/neo/ui/ListGUI.h b/neo/ui/ListGUI.h index 16dd7cf8..044dfe91 100644 --- a/neo/ui/ListGUI.h +++ b/neo/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/neo/ui/ListGUILocal.h b/neo/ui/ListGUILocal.h index d6384fc7..5b1b7d63 100644 --- a/neo/ui/ListGUILocal.h +++ b/neo/ui/ListGUILocal.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/neo/ui/ListWindow.cpp b/neo/ui/ListWindow.cpp index ca0e46c0..d57a12a0 100644 --- a/neo/ui/ListWindow.cpp +++ b/neo/ui/ListWindow.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"). @@ -277,7 +277,7 @@ bool idListWindow::ParseInternalVar(const char *_name, idParser *src) { ParseString(src, tabIconVOffsetStr); return true; } - + idStr strName = _name; if(idStr::Icmp(strName.Left(4), "mtr_") == 0) { idStr matName; @@ -360,7 +360,7 @@ void idListWindow::PostParse() { } idVec2 size; size.x = atoi(tok); - + src.ReadToken(&tok); //"," src.ReadToken(&tok); @@ -516,7 +516,7 @@ void idListWindow::Draw(int time, float x, float y) { if ( tabInfo[tab].type == TAB_TYPE_TEXT ) { dc->DrawText(work, scale, tabInfo[tab].align, color, rect, false, -1); } else if (tabInfo[tab].type == TAB_TYPE_ICON) { - + const idMaterial **hashMat; const idMaterial *iconMat; @@ -627,4 +627,3 @@ void idListWindow::UpdateList() { void idListWindow::StateChanged( bool redraw ) { UpdateList(); } - diff --git a/neo/ui/ListWindow.h b/neo/ui/ListWindow.h index 11b94281..624b13c9 100644 --- a/neo/ui/ListWindow.h +++ b/neo/ui/ListWindow.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,7 +60,7 @@ public: virtual idWinVar* GetWinVarByName(const char *_name, bool winLookup = false, drawWin_t** owner = NULL); void UpdateList(); - + private: virtual bool ParseInternalVar(const char *name, idParser *src); void CommonInit(); @@ -81,7 +81,7 @@ private: idStr tabTypeStr; idStr tabIconSizeStr; idStr tabIconVOffsetStr; - idHashTable iconMaterials; + idHashTable iconMaterials; bool multipleSel; idStrList listItems; diff --git a/neo/ui/MarkerWindow.cpp b/neo/ui/MarkerWindow.cpp index b78abc7c..fad543e1 100644 --- a/neo/ui/MarkerWindow.cpp +++ b/neo/ui/MarkerWindow.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"). @@ -343,7 +343,7 @@ void idMarkerWindow::Activate(bool activate, idStr &act) { } const shaderStage_t *stage = background->GetStage(0); if (stage) { - stage->texture.image->UploadScratch((byte*)imageBuff, 512, 64); + stage->texture.image->UploadScratch((byte*)imageBuff, 512, 64); } Mem_Free(imageBuff); } diff --git a/neo/ui/MarkerWindow.h b/neo/ui/MarkerWindow.h index 9c02bef2..f77b2af3 100644 --- a/neo/ui/MarkerWindow.h +++ b/neo/ui/MarkerWindow.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: virtual void MouseExit(); virtual void MouseEnter(); - + private: virtual bool ParseInternalVar(const char *name, idParser *src); void CommonInit(); diff --git a/neo/ui/Rectangle.h b/neo/ui/Rectangle.h index 1a29b646..629d46e7 100644 --- a/neo/ui/Rectangle.h +++ b/neo/ui/Rectangle.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 @@ public: idRectangle(float ix, float iy, float iw, float ih) { x = ix; y = iy; w = iw; h = ih; } float Bottom() const { return y + h; } float Right() const { return x + w; } - void Offset (float x, float y) { + void Offset (float x, float y) { this->x += x; this->y += y; } diff --git a/neo/ui/RegExp.cpp b/neo/ui/RegExp.cpp index b430180b..3d95e551 100644 --- a/neo/ui/RegExp.cpp +++ b/neo/ui/RegExp.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"). @@ -113,7 +113,7 @@ void idRegister::GetFromRegs( float *registers ) { for ( int i = 0; i < regCount; i++ ) { v[i] = registers[regs[i]]; } - + switch( type ) { case VEC4: { *dynamic_cast(var) = v; @@ -194,7 +194,7 @@ void idRegister::WriteToSaveGame( idFile *savefile ) { savefile->Write( &type, sizeof( type ) ); savefile->Write( ®Count, sizeof( regCount ) ); savefile->Write( ®s[0], sizeof( regs ) ); - + len = name.Length(); savefile->Write( &len, sizeof( len ) ); savefile->Write( name.c_str(), len ); diff --git a/neo/ui/RegExp.h b/neo/ui/RegExp.h index a78e9c6d..4cb0ae2f 100644 --- a/neo/ui/RegExp.h +++ b/neo/ui/RegExp.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/neo/ui/RegExp_old.h b/neo/ui/RegExp_old.h index 7f30040c..a8ae0006 100644 --- a/neo/ui/RegExp_old.h +++ b/neo/ui/RegExp_old.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,10 +67,10 @@ public: class idRegisterList { idList regs; public: - - // + + // void RemoveReg ( const char* name ); - // + // void AddReg(const char *name, int type, idParser *src, idWindow *win); void AddReg(const char *name, int type, idVec4 data, idWindow *win); diff --git a/neo/ui/RenderWindow.cpp b/neo/ui/RenderWindow.cpp index a8527b54..5e9cb277 100644 --- a/neo/ui/RenderWindow.cpp +++ b/neo/ui/RenderWindow.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"). @@ -46,7 +46,7 @@ idRenderWindow::idRenderWindow(idUserInterfaceLocal *g) : idWindow(g) { } idRenderWindow::~idRenderWindow() { - renderSystem->FreeRenderWorld( world ); + renderSystem->FreeRenderWorld( world ); } void idRenderWindow::CommonInit() { @@ -65,7 +65,7 @@ void idRenderWindow::CommonInit() { void idRenderWindow::BuildAnimation(int time) { - + if (!updateAnimation) { return; } @@ -168,10 +168,10 @@ void idRenderWindow::PostParse() { idWindow::PostParse(); } -// -// +// +// idWinVar *idRenderWindow::GetWinVarByName(const char *_name, bool fixup, drawWin_t** owner ) { -// +// if (idStr::Icmp(_name, "model") == 0) { return &modelName; } @@ -197,10 +197,10 @@ idWinVar *idRenderWindow::GetWinVarByName(const char *_name, bool fixup, drawWin return &needsRender; } -// -// +// +// return idWindow::GetWinVarByName(_name, fixup, owner); -// +// } bool idRenderWindow::ParseInternalVar(const char *_name, idParser *src) { diff --git a/neo/ui/RenderWindow.h b/neo/ui/RenderWindow.h index cbee6f89..bdbd10c0 100644 --- a/neo/ui/RenderWindow.h +++ b/neo/ui/RenderWindow.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,11 +38,11 @@ public: virtual void PostParse(); virtual void Draw(int time, float x, float y); virtual size_t Allocated(){return idWindow::Allocated();}; -// -// +// +// virtual idWinVar *GetWinVarByName(const char *_name, bool winLookup = false, drawWin_t** owner = NULL); -// - +// + private: void CommonInit(); virtual bool ParseInternalVar(const char *name, idParser *src); diff --git a/neo/ui/SimpleWindow.cpp b/neo/ui/SimpleWindow.cpp index 359c8adf..2989e46b 100644 --- a/neo/ui/SimpleWindow.cpp +++ b/neo/ui/SimpleWindow.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,10 +72,10 @@ idSimpleWindow::idSimpleWindow(idWindow *win) { } backGroundName.SetMaterialPtr(&background); -// +// // added parent mParent = win->GetParent(); -// +// hideCursor = win->hideCursor; @@ -122,7 +122,7 @@ idSimpleWindow::~idSimpleWindow() { } void idSimpleWindow::StateChanged( bool redraw ) { - if ( redraw && background && background->CinematicLength() ) { + if ( redraw && background && background->CinematicLength() ) { background->UpdateCinematic( gui->GetTime() ); } } @@ -189,7 +189,7 @@ void idSimpleWindow::CalcClientRect(float xofs, float yofs) { drawRect.x = rect.x() - rect.w(); drawRect.y = rect.y() - rect.h(); } - + drawRect.x += xofs; drawRect.y += yofs; @@ -205,7 +205,7 @@ void idSimpleWindow::CalcClientRect(float xofs, float yofs) { textRect = clientRect; textRect.x += 2.0; - textRect.w -= 2.0; + textRect.w -= 2.0; textRect.y += 2.0; textRect.h -= 2.0; textRect.x += textAlignx; @@ -218,7 +218,7 @@ void idSimpleWindow::CalcClientRect(float xofs, float yofs) { void idSimpleWindow::Redraw(float x, float y) { - + if (!visible) { return; } diff --git a/neo/ui/SimpleWindow.h b/neo/ui/SimpleWindow.h index 112ea210..b31342e8 100644 --- a/neo/ui/SimpleWindow.h +++ b/neo/ui/SimpleWindow.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,25 +58,25 @@ public: virtual void ReadFromSaveGame( idFile *savefile ); protected: - void CalcClientRect(float xofs, float yofs); - void SetupTransforms(float x, float y); - void DrawBackground(const idRectangle &drawRect); - void DrawBorderAndCaption(const idRectangle &drawRect); + void CalcClientRect(float xofs, float yofs); + void SetupTransforms(float x, float y); + void DrawBackground(const idRectangle &drawRect); + void DrawBorderAndCaption(const idRectangle &drawRect); idUserInterfaceLocal *gui; idDeviceContext *dc; - int flags; - idRectangle drawRect; // overall rect - idRectangle clientRect; // client area - idRectangle textRect; + int flags; + idRectangle drawRect; // overall rect + idRectangle clientRect; // client area + idRectangle textRect; idVec2 origin; - int fontNum; - float matScalex; - float matScaley; - float borderSize; - int textAlign; - float textAlignx; - float textAligny; + int fontNum; + float matScalex; + float matScaley; + float borderSize; + int textAlign; + float textAlignx; + float textAligny; int textShadow; idWinStr text; @@ -92,7 +92,7 @@ protected: idWinBackground backGroundName; const idMaterial* background; - + idWindow * mParent; idWinBool hideCursor; diff --git a/neo/ui/SliderWindow.cpp b/neo/ui/SliderWindow.cpp index 9ecdd5b2..9bf1325f 100644 --- a/neo/ui/SliderWindow.cpp +++ b/neo/ui/SliderWindow.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"). @@ -106,7 +106,7 @@ bool idSliderWindow::ParseInternalVar(const char *_name, idParser *src) { } idWinVar *idSliderWindow::GetWinVarByName(const char *_name, bool fixup, drawWin_t** owner) { - + if (idStr::Icmp(_name, "value") == 0) { return &value; } @@ -119,7 +119,7 @@ idWinVar *idSliderWindow::GetWinVarByName(const char *_name, bool fixup, drawWin if ( idStr::Icmp( _name, "cvarGroup" ) == 0 ) { return &cvarGroup; } - + return idWindow::GetWinVarByName(_name, fixup, owner); } @@ -135,7 +135,7 @@ const char *idSliderWindow::HandleEvent(const sysEvent_t *event, bool *updateVis SetCapture(this); RouteMouseCoords(0.0f, 0.0f); return ""; - } + } if ( key == K_RIGHTARROW || key == K_KP_RIGHTARROW || ( key == K_MOUSE2 && gui->CursorY() > thumbRect.y ) ) { value = value + stepSize; @@ -398,7 +398,7 @@ idSliderWindow::RunNamedEvent */ void idSliderWindow::RunNamedEvent( const char* eventName ) { idStr event, group; - + if ( !idStr::Cmpn( eventName, "cvar read ", 10 ) ) { event = eventName; group = event.Mid( 10, event.Length() - 10 ); @@ -413,4 +413,3 @@ void idSliderWindow::RunNamedEvent( const char* eventName ) { } } } - diff --git a/neo/ui/SliderWindow.h b/neo/ui/SliderWindow.h index 01f13a60..6936a8df 100644 --- a/neo/ui/SliderWindow.h +++ b/neo/ui/SliderWindow.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: virtual void SetBuddy(idWindow *buddy); void RunNamedEvent( const char* eventName ); - + private: virtual bool ParseInternalVar(const char *name, idParser *src); void CommonInit(); @@ -66,7 +66,7 @@ private: // false: write to the cvar system // force == true overrides liveUpdate 0 void UpdateCvar( bool read, bool force = false ); - + idWinFloat value; float low; float high; @@ -81,13 +81,12 @@ private: bool scrollbar; idWindow * buddyWin; idStr thumbShader; - + idWinStr cvarStr; idCVar * cvar; bool cvar_init; idWinBool liveUpdate; - idWinStr cvarGroup; + idWinStr cvarGroup; }; #endif /* !__SLIDERWINDOW_H__ */ - diff --git a/neo/ui/UserInterface.cpp b/neo/ui/UserInterface.cpp index 2c66a131..12000cbb 100644 --- a/neo/ui/UserInterface.cpp +++ b/neo/ui/UserInterface.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,9 +266,9 @@ bool idUserInterfaceLocal::IsInteractive() const { return interactive; } -bool idUserInterfaceLocal::InitFromFile( const char *qpath, bool rebuild, bool cache ) { +bool idUserInterfaceLocal::InitFromFile( const char *qpath, bool rebuild, bool cache ) { - if ( !( qpath && *qpath ) ) { + if ( !( qpath && *qpath ) ) { // FIXME: Memory leak!! return false; } @@ -329,7 +329,7 @@ bool idUserInterfaceLocal::InitFromFile( const char *qpath, bool rebuild, bool c loading = false; - return true; + return true; } const char *idUserInterfaceLocal::HandleEvent( const sysEvent_t *event, int _time, bool *updateVisuals ) { @@ -356,7 +356,7 @@ const char *idUserInterfaceLocal::HandleEvent( const sysEvent_t *event, int _tim if ( desktop ) { return desktop->HandleEvent( event, updateVisuals ); - } + } return ""; } @@ -414,7 +414,7 @@ const char* idUserInterfaceLocal::GetStateString( const char *varName, const cha } bool idUserInterfaceLocal::GetStateBool( const char *varName, const char* defaultString ) const { - return state.GetBool(varName, defaultString); + return state.GetBool(varName, defaultString); } int idUserInterfaceLocal::GetStateInt( const char *varName, const char* defaultString ) const { @@ -468,8 +468,8 @@ void idUserInterfaceLocal::ReadFromDemoFile( class idDemoFile *f ) { if (desktop == NULL) { f->Log("creating new gui\n"); desktop = new idWindow(this); - desktop->SetFlag( WIN_DESKTOP ); - desktop->SetDC( &uiManagerLocal.dc ); + desktop->SetFlag( WIN_DESKTOP ); + desktop->SetDC( &uiManagerLocal.dc ); desktop->ReadFromDemoFile(f); } else { f->Log("re-using gui\n"); @@ -564,7 +564,7 @@ bool idUserInterfaceLocal::ReadFromSaveGame( idFile *savefile ) { savefile->Read( &len, sizeof( len ) ); value.Fill( ' ', len ); savefile->Read( &value[0], len ); - + state.Set( key, value ); } @@ -637,4 +637,3 @@ void idUserInterfaceLocal::SetCursor( float x, float y ) { cursorX = x; cursorY = y; } - diff --git a/neo/ui/UserInterface.h b/neo/ui/UserInterface.h index dae7d9cb..82aac377 100644 --- a/neo/ui/UserInterface.h +++ b/neo/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"). diff --git a/neo/ui/UserInterfaceLocal.h b/neo/ui/UserInterfaceLocal.h index 24bf90ce..d6fccbb4 100644 --- a/neo/ui/UserInterfaceLocal.h +++ b/neo/ui/UserInterfaceLocal.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/neo/ui/Window.cpp b/neo/ui/Window.cpp index ccd3d19a..adcd6ab8 100644 --- a/neo/ui/Window.cpp +++ b/neo/ui/Window.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"). @@ -45,7 +45,7 @@ If you have questions concerning this license or the applicable additional terms #include "GameBearShootWindow.h" #include "GameBustOutWindow.h" -// +// // gui editor is more integrated into the window now #include "../tools/guied/GEWindowWrapper.h" @@ -222,7 +222,7 @@ idWindow::idWindow(idUserInterfaceLocal *ui) { gui = ui; CommonInit(); } - + /* ================ idWindow::idWindow @@ -247,7 +247,7 @@ void idWindow::CleanUp() { // ensure the register list gets cleaned up regList.Reset ( ); - + // Cleanup the named events namedEvents.DeleteContents(true); @@ -351,7 +351,7 @@ idWindow::BringToTop ================ */ void idWindow::BringToTop(idWindow *w) { - + if (w && !(w->flags & WIN_MODAL)) { return; } @@ -390,7 +390,7 @@ idWindow::MouseEnter ================ */ void idWindow::MouseEnter() { - + if (noEvents) { return; } @@ -404,7 +404,7 @@ idWindow::MouseExit ================ */ void idWindow::MouseExit() { - + if (noEvents) { return; } @@ -424,7 +424,7 @@ const char *idWindow::RouteMouseCoords(float xd, float yd) { //FIXME: unkludge this whole mechanism return GetCaptureChild()->RouteMouseCoords(xd, yd); } - + if (xd == -2000 || yd == -2000) { return ""; } @@ -635,10 +635,10 @@ void idWindow::RunNamedEvent ( const char* eventName ) int i; int c; - // Find and run the event + // Find and run the event c = namedEvents.Num( ); for ( i = 0; i < c; i ++ ) { - if ( namedEvents[i]->mName.Icmp( eventName ) ) { + if ( namedEvents[i]->mName.Icmp( eventName ) ) { continue; } @@ -648,12 +648,12 @@ void idWindow::RunNamedEvent ( const char* eventName ) if (expressionRegisters.Num() && ops.Num()) { EvalRegs(-1, true); } - + RunScriptList( namedEvents[i]->mEvent ); - + break; } - + // Run the event in all the children as well c = children.Num(); for ( i = 0; i < c; i++ ) { @@ -737,7 +737,7 @@ const char *idWindow::HandleEvent(const sysEvent_t *event, bool *updateVisuals) GetCaptureChild()->LoseCapture(); gui->GetDesktop()->captureChild = NULL; return ""; - } + } int c = children.Num(); while (--c >= 0) { @@ -758,7 +758,7 @@ const char *idWindow::HandleEvent(const sysEvent_t *event, bool *updateVisuals) const char *childRet = child->HandleEvent(event, updateVisuals); if (childRet && *childRet) { return childRet; - } + } if (child->flags & WIN_MODAL) { return ""; } @@ -803,7 +803,7 @@ const char *idWindow::HandleEvent(const sysEvent_t *event, bool *updateVisuals) const char *childRet = child->HandleEvent(event, updateVisuals); if (childRet && *childRet) { return childRet; - } + } if (child->flags & WIN_MODAL) { return ""; } @@ -966,7 +966,7 @@ void idWindow::DebugDraw(int time, float x, float y) { char out[1024]; idStr str; str = text.c_str(); - + if (str.Length()) { sprintf(buff, "%s\n", str.c_str()); } @@ -985,7 +985,7 @@ void idWindow::DebugDraw(int time, float x, float y) { //tempRect.x += offsetX; //drawRect.y += offsetY; dc->DrawText(buff, textScale, textAlign, foreColor, textRect, true); - } + } dc->EnableClipping(true); } } @@ -1046,7 +1046,7 @@ idWindow::Time ================ */ void idWindow::Time() { - + if ( noTime ) { return; } @@ -1141,7 +1141,7 @@ idWindow::SetupTransforms void idWindow::SetupTransforms(float x, float y) { static idMat3 trans; static idVec3 org; - + trans.Identity(); org.Set( origin.x + x, origin.y + y, 0 ); @@ -1197,7 +1197,7 @@ void idWindow::Redraw(float x, float y) { if (r_skipGuiShaders.GetInteger() == 1 || dc == NULL ) { return; } - + int time = gui->GetTime(); if ( flags & WIN_DESKTOP && r_skipGuiShaders.GetInteger() != 3 ) { @@ -1240,7 +1240,7 @@ void idWindow::Redraw(float x, float y) { idVec3 oldOrg; idMat3 oldTrans; - + dc->GetTransformInfo( oldOrg, oldTrans ); SetupTransforms(x, y); @@ -1249,7 +1249,7 @@ void idWindow::Redraw(float x, float y) { if ( !( flags & WIN_NOCLIP) ) { dc->PushClipRect(clientRect); - } + } if ( r_skipGuiShaders.GetInteger() < 5 ) { Draw(time, x, y); @@ -1273,7 +1273,7 @@ void idWindow::Redraw(float x, float y) { if ( ! ( flags & WIN_NOCLIP ) ) { dc->PopClipRect(); - } + } if (gui_edit.GetBool() || (flags & WIN_DESKTOP && !( flags & WIN_NOCURSOR ) && !hideCursor && (gui->Active() || ( flags & WIN_MENUGUI ) ))) { dc->SetTransformInfo(vec3_origin, mat3_identity); @@ -1347,7 +1347,7 @@ void idWindow::CalcClientRect(float xofs, float yofs) { drawRect.x = rect.x() - rect.w(); drawRect.y = rect.y() - rect.h(); } - + if (flags & (WIN_HCENTER | WIN_VCENTER) && parent) { // in this case treat xofs and yofs as absolute top left coords // and ignore the original positioning @@ -1373,7 +1373,7 @@ void idWindow::CalcClientRect(float xofs, float yofs) { textRect = clientRect; textRect.x += 2.0; - textRect.w -= 2.0; + textRect.w -= 2.0; textRect.y += 2.0; textRect.h -= 2.0; @@ -1419,7 +1419,7 @@ void idWindow::SetupFromState() { if (regList.FindReg("rotate") || regList.FindReg("shear")) { flags |= WIN_TRANSFORM; } - + CalcClientRect(0,0); if ( scripts[ ON_ACTION ] ) { cursor = idDeviceContext::CURSOR_HAND; @@ -1577,14 +1577,14 @@ bool idWindow::ParseScript(idParser *src, idGuiScriptList &list, int *timeParm, // scripts start with { ( unless parm is true ) and have ; separated command lists.. commands are command, // arg.. basically we want everything between the { } as it will be interpreted at // run time - + if ( elseBlock ) { src->ReadToken ( &token ); - + if ( !token.Icmp ( "if" ) ) { ifElseBlock = true; } - + src->UnreadToken ( &token ); if ( !ifElseBlock && !src->ExpectTokenString( "{" ) ) { @@ -1630,7 +1630,7 @@ bool idWindow::ParseScript(idParser *src, idGuiScriptList &list, int *timeParm, list.Append(gs); - // if we are parsing an else if then return out so + // if we are parsing an else if then return out so // the initial "if" parser can handle the rest of the tokens if ( ifElseBlock ) { return true; @@ -1708,7 +1708,7 @@ idWindow::PostParse */ void idWindow::PostParse() { } - + /* ================ idWindow::GetWinVarOffset @@ -1869,7 +1869,7 @@ idWinVar *idWindow::GetWinVarByName(const char *_name, bool fixup, drawWin_t** o } return win->simp->GetWinVarByName(var); } - } + } } } return NULL; @@ -2066,7 +2066,7 @@ bool idWindow::ParseRegEntry(const char *name, idParser *src) { // not predefined so just read the next token and add it to the state idToken tok; - idVec4 v; + idVec4 v; idWinInt *vari; idWinFloat *varf; idWinStr *vars; @@ -2076,7 +2076,7 @@ bool idWindow::ParseRegEntry(const char *name, idParser *src) { return true; } switch (tok.type) { - case TT_NUMBER : + case TT_NUMBER : if (tok.subtype & TT_INTEGER) { vari = new idWinInt(); *vari = atoi(tok); @@ -2195,12 +2195,12 @@ bool idWindow::Parse( idParser *src, bool rebuild) { drawWindows.Append(dwt); } } - } + } else if ( token == "editDef" ) { idEditWindow *win = new idEditWindow(dc, gui); - SaveExpressionParseState(); - win->Parse(src, rebuild); - RestoreExpressionParseState(); + SaveExpressionParseState(); + win->Parse(src, rebuild); + RestoreExpressionParseState(); AddChild(win); win->SetParent(this); dwt.simp = NULL; @@ -2209,9 +2209,9 @@ bool idWindow::Parse( idParser *src, bool rebuild) { } else if ( token == "choiceDef" ) { idChoiceWindow *win = new idChoiceWindow(dc, gui); - SaveExpressionParseState(); - win->Parse(src, rebuild); - RestoreExpressionParseState(); + SaveExpressionParseState(); + win->Parse(src, rebuild); + RestoreExpressionParseState(); AddChild(win); win->SetParent(this); dwt.simp = NULL; @@ -2220,9 +2220,9 @@ bool idWindow::Parse( idParser *src, bool rebuild) { } else if ( token == "sliderDef" ) { idSliderWindow *win = new idSliderWindow(dc, gui); - SaveExpressionParseState(); - win->Parse(src, rebuild); - RestoreExpressionParseState(); + SaveExpressionParseState(); + win->Parse(src, rebuild); + RestoreExpressionParseState(); AddChild(win); win->SetParent(this); dwt.simp = NULL; @@ -2231,9 +2231,9 @@ bool idWindow::Parse( idParser *src, bool rebuild) { } else if ( token == "markerDef" ) { idMarkerWindow *win = new idMarkerWindow(dc, gui); - SaveExpressionParseState(); - win->Parse(src, rebuild); - RestoreExpressionParseState(); + SaveExpressionParseState(); + win->Parse(src, rebuild); + RestoreExpressionParseState(); AddChild(win); win->SetParent(this); dwt.simp = NULL; @@ -2242,9 +2242,9 @@ bool idWindow::Parse( idParser *src, bool rebuild) { } else if ( token == "bindDef" ) { idBindWindow *win = new idBindWindow(dc, gui); - SaveExpressionParseState(); - win->Parse(src, rebuild); - RestoreExpressionParseState(); + SaveExpressionParseState(); + win->Parse(src, rebuild); + RestoreExpressionParseState(); AddChild(win); win->SetParent(this); dwt.simp = NULL; @@ -2253,9 +2253,9 @@ bool idWindow::Parse( idParser *src, bool rebuild) { } else if ( token == "listDef" ) { idListWindow *win = new idListWindow(dc, gui); - SaveExpressionParseState(); - win->Parse(src, rebuild); - RestoreExpressionParseState(); + SaveExpressionParseState(); + win->Parse(src, rebuild); + RestoreExpressionParseState(); AddChild(win); win->SetParent(this); dwt.simp = NULL; @@ -2264,9 +2264,9 @@ bool idWindow::Parse( idParser *src, bool rebuild) { } else if ( token == "fieldDef" ) { idFieldWindow *win = new idFieldWindow(dc, gui); - SaveExpressionParseState(); - win->Parse(src, rebuild); - RestoreExpressionParseState(); + SaveExpressionParseState(); + win->Parse(src, rebuild); + RestoreExpressionParseState(); AddChild(win); win->SetParent(this); dwt.simp = NULL; @@ -2275,9 +2275,9 @@ bool idWindow::Parse( idParser *src, bool rebuild) { } else if ( token == "renderDef" ) { idRenderWindow *win = new idRenderWindow(dc, gui); - SaveExpressionParseState(); - win->Parse(src, rebuild); - RestoreExpressionParseState(); + SaveExpressionParseState(); + win->Parse(src, rebuild); + RestoreExpressionParseState(); AddChild(win); win->SetParent(this); dwt.simp = NULL; @@ -2287,7 +2287,7 @@ bool idWindow::Parse( idParser *src, bool rebuild) { else if ( token == "gameSSDDef" ) { idGameSSDWindow *win = new idGameSSDWindow(dc, gui); SaveExpressionParseState(); - win->Parse(src, rebuild); + win->Parse(src, rebuild); RestoreExpressionParseState(); AddChild(win); win->SetParent(this); @@ -2298,7 +2298,7 @@ bool idWindow::Parse( idParser *src, bool rebuild) { else if ( token == "gameBearShootDef" ) { idGameBearShootWindow *win = new idGameBearShootWindow(dc, gui); SaveExpressionParseState(); - win->Parse(src, rebuild); + win->Parse(src, rebuild); RestoreExpressionParseState(); AddChild(win); win->SetParent(this); @@ -2309,7 +2309,7 @@ bool idWindow::Parse( idParser *src, bool rebuild) { else if ( token == "gameBustOutDef" ) { idGameBustOutWindow *win = new idGameBustOutWindow(dc, gui); SaveExpressionParseState(); - win->Parse(src, rebuild); + win->Parse(src, rebuild); RestoreExpressionParseState(); AddChild(win); win->SetParent(this); @@ -2317,7 +2317,7 @@ bool idWindow::Parse( idParser *src, bool rebuild) { dwt.win = win; drawWindows.Append(dwt); } -// +// // added new onEvent else if ( token == "onNamedEvent" ) { // Read the event name @@ -2327,32 +2327,32 @@ bool idWindow::Parse( idParser *src, bool rebuild) { } rvNamedEvent* ev = new rvNamedEvent ( token ); - + src->SetMarker ( ); - + if ( !ParseScript ( src, *ev->mEvent ) ) { ret = false; break; } - // If we are in the gui editor then add the internal var to the + // If we are in the gui editor then add the internal var to the // the wrapper #ifdef ID_ALLOW_TOOLS if ( com_editors & EDITOR_GUI ) { idStr str; idStr out; - + // Grab the string from the last marker src->GetStringFromMarker ( str, false ); - + // Parse it one more time to knock unwanted tabs out idLexer src2( str, str.Length(), "", src->GetFlags() ); src2.ParseBracedSectionExact ( out, 1); - - // Save the script + + // Save the script rvGEWindowWrapper::GetWrapper ( this )->GetScriptDict().Set ( va("onEvent %s", token.c_str()), out ); } -#endif +#endif namedEvents.Append(ev); } else if ( token == "onTime" ) { @@ -2363,7 +2363,7 @@ bool idWindow::Parse( idParser *src, bool rebuild) { return false; } ev->time = atoi(token.c_str()); - + // reset the mark since we dont want it to include the time src->SetMarker ( ); @@ -2373,21 +2373,21 @@ bool idWindow::Parse( idParser *src, bool rebuild) { } // add the script to the wrappers script list - // If we are in the gui editor then add the internal var to the + // If we are in the gui editor then add the internal var to the // the wrapper #ifdef ID_ALLOW_TOOLS if ( com_editors & EDITOR_GUI ) { idStr str; idStr out; - + // Grab the string from the last marker src->GetStringFromMarker ( str, false ); - + // Parse it one more time to knock unwanted tabs out idLexer src2( str, str.Length(), "", src->GetFlags() ); src2.ParseBracedSectionExact ( out, 1); - - // Save the script + + // Save the script rvGEWindowWrapper::GetWrapper ( this )->GetScriptDict().Set ( va("onTime %d", ev->time), out ); } #endif @@ -2407,16 +2407,16 @@ bool idWindow::Parse( idParser *src, bool rebuild) { // Set the marker after the float name src->SetMarker ( ); - // Read in the float + // Read in the float regList.AddReg(work, idRegister::FLOAT, src, this, varf); // If we are in the gui editor then add the float to the defines #ifdef ID_ALLOW_TOOLS if ( com_editors & EDITOR_GUI ) { idStr str; - + // Grab the string from the last marker and save it in the wrapper - src->GetStringFromMarker ( str, true ); + src->GetStringFromMarker ( str, true ); rvGEWindowWrapper::GetWrapper ( this )->GetVariableDict().Set ( va("definefloat\t\"%s\"",token.c_str()), str ); } #endif @@ -2443,9 +2443,9 @@ bool idWindow::Parse( idParser *src, bool rebuild) { #ifdef ID_ALLOW_TOOLS if ( com_editors & EDITOR_GUI ) { idStr str; - + // Grab the string from the last marker and save it in the wrapper - src->GetStringFromMarker ( str, true ); + src->GetStringFromMarker ( str, true ); rvGEWindowWrapper::GetWrapper ( this )->GetVariableDict().Set ( va("definevec4\t\"%s\"",token.c_str()), str ); } #endif @@ -2469,36 +2469,36 @@ bool idWindow::Parse( idParser *src, bool rebuild) { #ifdef ID_ALLOW_TOOLS if ( com_editors & EDITOR_GUI ) { idStr str; - + // Grab the string from the last marker and save it in the wrapper - src->GetStringFromMarker ( str, true ); + src->GetStringFromMarker ( str, true ); rvGEWindowWrapper::GetWrapper ( this )->GetVariableDict().Set ( va("float\t\"%s\"",token.c_str()), str ); } #endif } else if (ParseScriptEntry(token, src)) { // add the script to the wrappers script list - // If we are in the gui editor then add the internal var to the + // If we are in the gui editor then add the internal var to the // the wrapper #ifdef ID_ALLOW_TOOLS if ( com_editors & EDITOR_GUI ) { idStr str; idStr out; - + // Grab the string from the last marker src->GetStringFromMarker ( str, false ); - + // Parse it one more time to knock unwanted tabs out idLexer src2( str, str.Length(), "", src->GetFlags() ); src2.ParseBracedSectionExact ( out, 1); - - // Save the script + + // Save the script rvGEWindowWrapper::GetWrapper ( this )->GetScriptDict().Set ( token, out ); } #endif } else if (ParseInternalVar(token, src)) { - // gui editor support - // If we are in the gui editor then add the internal var to the + // gui editor support + // If we are in the gui editor then add the internal var to the // the wrapper #ifdef ID_ALLOW_TOOLS if ( com_editors & EDITOR_GUI ) { @@ -2511,7 +2511,7 @@ bool idWindow::Parse( idParser *src, bool rebuild) { else { ParseRegEntry(token, src); // hook into the main window parsing for the gui editor - // If we are in the gui editor then add the internal var to the + // If we are in the gui editor then add the internal var to the // the wrapper #ifdef ID_ALLOW_TOOLS if ( com_editors & EDITOR_GUI ) { @@ -2520,7 +2520,7 @@ bool idWindow::Parse( idParser *src, bool rebuild) { rvGEWindowWrapper::GetWrapper ( this )->SetStateKey ( token, str, false ); } #endif - } + } if ( !src->ReadToken( &token ) ) { src->Error( "Unexpected end of file" ); ret = false; @@ -2536,7 +2536,7 @@ bool idWindow::Parse( idParser *src, bool rebuild) { PostParse(); // hook into the main window parsing for the gui editor - // If we are in the gui editor then add the internal var to the + // If we are in the gui editor then add the internal var to the // the wrapper #ifdef ID_ALLOW_TOOLS if ( com_editors & EDITOR_GUI ) { @@ -2560,7 +2560,7 @@ idSimpleWindow *idWindow::FindSimpleWinByName(const char *_name) { } if ( idStr::Icmp(drawWindows[i].simp->name, _name) == 0 ) { return drawWindows[i].simp; - } + } } return NULL; } @@ -2816,7 +2816,7 @@ idWindow::ParseEmitOp */ int idWindow::ParseEmitOp( idParser *src, int a, wexpOpType_t opType, int priority, wexpOp_t **opp ) { int b = ParseExpressionPriority( src, priority ); - return EmitOp( a, b, opType, opp ); + return EmitOp( a, b, opType, opp ); } @@ -2867,7 +2867,7 @@ int idWindow::ParseTerm( idParser *src, idWinVar *var, int component ) { src->ExpectTokenString("]"); return EmitOp( a, b, WOP_TYPE_TABLE ); } - + if (var == NULL) { var = GetWinVarByName(token, true); } @@ -3167,7 +3167,7 @@ void idWindow::ReadFromDemoFile( class idDemoFile *f, bool rebuild ) { if (rebuild) { CommonInit(); } - + f->SetLog(true, "window1"); backGroundName = f->ReadHashString(); f->SetLog(true, backGroundName); @@ -3239,7 +3239,7 @@ void idWindow::ReadFromDemoFile( class idDemoFile *f, bool rebuild ) { f->ReadInt ( td.offset ); float startTime, accelTime, linearTime, decelTime; - idVec4 startValue, endValue; + idVec4 startValue, endValue; f->ReadFloat( startTime ); f->ReadFloat( accelTime ); f->ReadFloat( linearTime ); @@ -3247,7 +3247,7 @@ void idWindow::ReadFromDemoFile( class idDemoFile *f, bool rebuild ) { f->ReadVec4( startValue ); f->ReadVec4( endValue ); td.interp.Init( startTime, accelTime, decelTime, accelTime + linearTime + decelTime, startValue, endValue ); - + // read this for correct data padding with the win32 savegames // the extrapolate is correctly initialized through the above Init call int extrapolationType; @@ -3286,7 +3286,7 @@ void idWindow::ReadFromDemoFile( class idDemoFile *f, bool rebuild ) { f->ReadFloat( ff ); expressionRegisters.Append(ff); } - + regList.ReadFromDemoFile(f); } @@ -3351,7 +3351,7 @@ void idWindow::WriteToDemoFile( class idDemoFile *f ) { idStr work; f->SetLog(true, work); - int i, c; + int i, c; f->SetLog(true, (work + "-transitions")); c = transitions.Num(); @@ -3359,7 +3359,7 @@ void idWindow::WriteToDemoFile( class idDemoFile *f ) { for (i = 0; i < c; i++) { f->WriteInt( 0 ); f->WriteInt( transitions[i].offset ); - + f->WriteFloat( transitions[i].interp.GetStartTime() ); f->WriteFloat( transitions[i].interp.GetAccelTime() ); f->WriteFloat( transitions[i].interp.GetLinearTime() ); @@ -3687,7 +3687,7 @@ void idWindow::ReadFromSaveGame( idFile *savefile ) { overChild = children[i]; } } - + // Scripts for ( i = 0; i < SCRIPT_COUNT; i++ ) { if ( scripts[i] ) { @@ -3868,8 +3868,8 @@ void idWindow::FixupParms() { ops[i].b = -1; } } - - + + if (flags & WIN_DESKTOP) { CalcRects(0,0); } @@ -3989,16 +3989,16 @@ idWindow* idWindow::FindChildByPoint ( float x, float y, idWindow** below ) { if ( !Contains ( drawRect, x, y ) ) { return NULL; } - + for (int i = c - 1; i >= 0 ; i-- ) { idWindow* found = children[i]->FindChildByPoint ( x, y, below ); if ( found ) { if ( *below ) { continue; } - + return found; - } + } } return this; @@ -4068,7 +4068,7 @@ void idWindow::RemoveChild ( idWindow *win ) { // Remove the child window children.Remove ( win ); - + for ( find = 0; find < drawWindows.Num(); find ++ ) { if ( drawWindows[find].win == win ) @@ -4089,7 +4089,7 @@ Inserts the given window as a child into the given location in the zorder. bool idWindow::InsertChild ( idWindow *win, idWindow* before ) { AddChild ( win ); - + win->parent = this; drawWin_t dwt; @@ -4097,7 +4097,7 @@ bool idWindow::InsertChild ( idWindow *win, idWindow* before ) dwt.win = win; // If not inserting before anything then just add it at the end - if ( before ) { + if ( before ) { int index; index = GetChildIndex ( before ); if ( index != -1 ) { @@ -4105,7 +4105,7 @@ bool idWindow::InsertChild ( idWindow *win, idWindow* before ) return true; } } - + drawWindows.Append ( dwt ); return true; } @@ -4119,12 +4119,12 @@ void idWindow::ScreenToClient ( idRectangle* r ) { int x; int y; idWindow* p; - + for ( p = this, x = 0, y = 0; p; p = p->parent ) { x += p->rect.x(); y += p->rect.y(); } - + r->x -= x; r->y -= y; } @@ -4138,25 +4138,25 @@ void idWindow::ClientToScreen ( idRectangle* r ) { int x; int y; idWindow* p; - + for ( p = this, x = 0, y = 0; p; p = p->parent ) { x += p->rect.x(); y += p->rect.y(); } - + r->x += x; - r->y += y; + r->y += y; } /* ================ idWindow::SetDefaults -Set the window do a default window with no text, no background and +Set the window do a default window with no text, no background and default colors, etc.. ================ */ -void idWindow::SetDefaults ( void ) { +void idWindow::SetDefaults ( void ) { forceAspectWidth = 640.0f; forceAspectHeight = 480.0f; matScalex = 1; @@ -4176,7 +4176,7 @@ void idWindow::SetDefaults ( void ) { hoverColor = idVec4(1, 1, 1, 1); matColor = idVec4(1, 1, 1, 1); borderColor.Zero(); - text = ""; + text = ""; background = NULL; backGroundName = ""; @@ -4187,21 +4187,21 @@ void idWindow::SetDefaults ( void ) { idWindow::UpdateFromDictionary The editor only has a dictionary to work with so the easiest way to push the -values of the dictionary onto the window is for the window to interpret the +values of the dictionary onto the window is for the window to interpret the dictionary as if were a file being parsed. ================ */ bool idWindow::UpdateFromDictionary ( idDict& dict ) { const idKeyValue* kv; int i; - + SetDefaults ( ); - + // Clear all registers since they will get recreated regList.Reset ( ); expressionRegisters.Clear ( ); ops.Clear ( ); - + for ( i = 0; i < dict.GetNumKeyVals(); i ++ ) { kv = dict.GetKeyVal ( i ); @@ -4220,11 +4220,11 @@ bool idWindow::UpdateFromDictionary ( idDict& dict ) { } } } - + EvalRegs(-1, true); SetupFromState(); PostParse(); - + return true; } diff --git a/neo/ui/Window.h b/neo/ui/Window.h index df9e070d..182d53b8 100644 --- a/neo/ui/Window.h +++ b/neo/ui/Window.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"). @@ -105,7 +105,7 @@ typedef enum { } wexpRegister_t; typedef struct { - wexpOpType_t opType; + wexpOpType_t opType; int a, b, c, d; } wexpOp_t; @@ -146,11 +146,11 @@ public: { delete mEvent; } - size_t Size() + size_t Size() { return sizeof(*this) + mEvent->Size(); } - + idStr mName; idGuiScriptList* mEvent; }; @@ -368,14 +368,14 @@ protected: float actualX; // physical coords float actualY; // '' int childID; // this childs id - unsigned int flags; // visible, focus, mouseover, cursor, border, etc.. + unsigned int flags; // visible, focus, mouseover, cursor, border, etc.. int lastTimeRun; // idRectangle drawRect; // overall rect idRectangle clientRect; // client area idVec2 origin; int timeLine; // time stamp used for various fx - float xOffset; + float xOffset; float yOffset; float forceAspectWidth; float forceAspectHeight; @@ -393,8 +393,8 @@ protected: unsigned char cursor; // signed char textAlign; - idWinBool noTime; // - idWinBool visible; // + idWinBool noTime; // + idWinBool visible; // idWinBool noEvents; idWinRectangle rect; // overall rect idWinVec4 backColor; @@ -405,17 +405,17 @@ protected: idWinFloat textScale; idWinFloat rotate; idWinStr text; - idWinBackground backGroundName; // + idWinBackground backGroundName; // idList definedVars; idList updateVars; idRectangle textRect; // text extented rect - const idMaterial *background; // background asset + const idMaterial *background; // background asset idWindow *parent; // parent window - idList children; // child windows - idList drawWindows; + idList children; // child windows + idList drawWindows; idWindow *focusedChild; // if a child window has the focus idWindow *captureChild; // if a child window has mouse capture @@ -437,9 +437,9 @@ protected: static bool registerIsTemporary[MAX_EXPRESSION_REGISTERS]; // statics to assist during parsing - idList ops; // evaluate to make expressionRegisters + idList ops; // evaluate to make expressionRegisters idList expressionRegisters; - idList *saveOps; // evaluate to make expressionRegisters + idList *saveOps; // evaluate to make expressionRegisters idList namedEvents; // added named events idList *saveRegs; diff --git a/neo/ui/Winvar.cpp b/neo/ui/Winvar.cpp index 722b8dba..1872db59 100644 --- a/neo/ui/Winvar.cpp +++ b/neo/ui/Winvar.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,20 +33,20 @@ If you have questions concerning this license or the applicable additional terms #include "Winvar.h" #include "UserInterfaceLocal.h" -idWinVar::idWinVar() { - guiDict = NULL; - name = NULL; +idWinVar::idWinVar() { + guiDict = NULL; + name = NULL; eval = true; } -idWinVar::~idWinVar() { +idWinVar::~idWinVar() { delete name; name = NULL; } -void idWinVar::SetGuiInfo(idDict *gd, const char *_name) { - guiDict = gd; - SetName(_name); +void idWinVar::SetGuiInfo(idDict *gd, const char *_name) { + guiDict = gd; + SetName(_name); } @@ -80,4 +80,3 @@ void idMultiWinVar::SetGuiInfo( idDict *dict ) { (*this)[i]->SetGuiInfo( dict, (*this)[i]->c_str() ); } } - diff --git a/neo/ui/Winvar.h b/neo/ui/Winvar.h index 2e171c74..1dc2ecdc 100644 --- a/neo/ui/Winvar.h +++ b/neo/ui/Winvar.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,21 +41,21 @@ public: virtual ~idWinVar(); void SetGuiInfo(idDict *gd, const char *_name); - const char *GetName() const { + const char *GetName() const { if (name) { if (guiDict && *name == '*') { return guiDict->GetString(&name[1]); } return name; } - return ""; + return ""; } - void SetName(const char *_name) { - delete []name; + void SetName(const char *_name) { + delete []name; name = NULL; if (_name) { - name = new char[strlen(_name)+1]; - strcpy(name, _name); + name = new char[strlen(_name)+1]; + strcpy(name, _name); } } @@ -85,7 +85,7 @@ public: bool GetEval() { return eval; } - + protected: idDict *guiDict; char *name; @@ -117,14 +117,14 @@ public: operator bool() const { return data; } - virtual void Set(const char *val) { + virtual void Set(const char *val) { data = ( atoi( val ) != 0 ); if (guiDict) { guiDict->SetBool(GetName(), data); } } - virtual void Update() { + virtual void Update() { const char *s = GetName(); if ( guiDict && s[0] != '\0' ) { data = guiDict->GetBool( s ); @@ -157,7 +157,7 @@ public: idWinVar::Init(_name, win); if (guiDict) { data = guiDict->GetString(GetName()); - } + } } int operator==( const idStr &other ) const { return (other == data); @@ -260,7 +260,7 @@ public: idWinVar::Init(_name, win); if (guiDict) { data = guiDict->GetInt(GetName()); - } + } } int &operator=( const int &other ) { data = other; @@ -319,7 +319,7 @@ public: idWinVar::Init(_name, win); if (guiDict) { data = guiDict->GetFloat(GetName()); - } + } } idWinFloat &operator=( const idWinFloat &other ) { idWinVar::operator=(other); @@ -378,9 +378,9 @@ public: data.y = v.y; data.w = v.z; data.h = v.w; - } + } } - + int operator==( const idRectangle &other ) const { return (other == data); } @@ -406,7 +406,7 @@ public: } return data; } - + operator const idRectangle&() const { return data; } @@ -481,7 +481,7 @@ public: idWinVar::Init(_name, win); if (guiDict) { data = guiDict->GetVec2(GetName()); - } + } } int operator==( const idVec2 &other ) const { return (other == data); @@ -491,7 +491,7 @@ public: data = other.data; return *this; } - + idVec2 &operator=( const idVec2 &other ) { data = other; if (guiDict) { @@ -552,7 +552,7 @@ public: idWinVar::Init(_name, win); if (guiDict) { data = guiDict->GetVec4(GetName()); - } + } } int operator==( const idVec4 &other ) const { return (other == data); @@ -640,7 +640,7 @@ public: idWinVar::Init(_name, win); if (guiDict) { data = guiDict->GetVector(GetName()); - } + } } int operator==( const idVec3 &other ) const { return (other == data); @@ -719,7 +719,7 @@ public: idWinStr::Init(_name, win); if (guiDict) { data = guiDict->GetString(GetName()); - } + } } int operator==( const idStr &other ) const { return (other == data); @@ -853,4 +853,3 @@ public: }; #endif /* !__WINVAR_H__ */ -