├── .gitignore ├── CMakeLists.txt ├── COPYING.txt ├── MayaImport └── maya_main.h ├── README.md ├── cm └── CollisionModel.h ├── config.h.in ├── d3xp ├── AF.cpp ├── AF.h ├── AFEntity.cpp ├── AFEntity.h ├── Actor.cpp ├── Actor.h ├── BrittleFracture.cpp ├── BrittleFracture.h ├── Camera.cpp ├── Camera.h ├── EndLevel.cpp ├── EndLevel.h ├── Entity.cpp ├── Entity.h ├── Fx.cpp ├── Fx.h ├── GameBase.h ├── GameEdit.cpp ├── GameEdit.h ├── Game_local.cpp ├── Game_local.h ├── Game_network.cpp ├── Grabber.cpp ├── Grabber.h ├── IK.cpp ├── IK.h ├── Item.cpp ├── Item.h ├── Light.cpp ├── Light.h ├── Misc.cpp ├── Misc.h ├── Moveable.cpp ├── Moveable.h ├── Mover.cpp ├── Mover.h ├── MultiplayerGame.cpp ├── MultiplayerGame.h ├── Player.cpp ├── Player.h ├── PlayerIcon.cpp ├── PlayerIcon.h ├── PlayerView.cpp ├── PlayerView.h ├── Projectile.cpp ├── Projectile.h ├── Pvs.cpp ├── Pvs.h ├── SecurityCamera.cpp ├── SecurityCamera.h ├── SmokeParticles.cpp ├── SmokeParticles.h ├── Sound.cpp ├── Sound.h ├── Target.cpp ├── Target.h ├── Trigger.cpp ├── Trigger.h ├── Weapon.cpp ├── Weapon.h ├── WorldSpawn.cpp ├── WorldSpawn.h ├── ai │ ├── AAS.cpp │ ├── AAS.h │ ├── AAS_debug.cpp │ ├── AAS_local.h │ ├── AAS_pathing.cpp │ ├── AAS_routing.cpp │ ├── AI.cpp │ ├── AI.h │ ├── AI_Vagary.cpp │ ├── AI_events.cpp │ └── AI_pathing.cpp ├── anim │ ├── Anim.cpp │ ├── Anim.h │ ├── Anim_Blend.cpp │ ├── Anim_Import.cpp │ ├── Anim_Testmodel.cpp │ └── Anim_Testmodel.h ├── gamesys │ ├── Callbacks.cpp │ ├── Class.cpp │ ├── Class.h │ ├── DebugGraph.cpp │ ├── DebugGraph.h │ ├── Event.cpp │ ├── Event.h │ ├── NoGameTypeInfo.h │ ├── SaveGame.cpp │ ├── SaveGame.h │ ├── SysCmds.cpp │ ├── SysCmds.h │ ├── SysCvar.cpp │ ├── SysCvar.h │ ├── TypeInfo.cpp │ └── TypeInfo.h ├── physics │ ├── Clip.cpp │ ├── Clip.h │ ├── Force.cpp │ ├── Force.h │ ├── Force_Constant.cpp │ ├── Force_Constant.h │ ├── Force_Drag.cpp │ ├── Force_Drag.h │ ├── Force_Field.cpp │ ├── Force_Field.h │ ├── Force_Grab.cpp │ ├── Force_Grab.h │ ├── Force_Spring.cpp │ ├── Force_Spring.h │ ├── Physics.cpp │ ├── Physics.h │ ├── Physics_AF.cpp │ ├── Physics_AF.h │ ├── Physics_Actor.cpp │ ├── Physics_Actor.h │ ├── Physics_Base.cpp │ ├── Physics_Base.h │ ├── Physics_Monster.cpp │ ├── Physics_Monster.h │ ├── Physics_Parametric.cpp │ ├── Physics_Parametric.h │ ├── Physics_Player.cpp │ ├── Physics_Player.h │ ├── Physics_RigidBody.cpp │ ├── Physics_RigidBody.h │ ├── Physics_Static.cpp │ ├── Physics_Static.h │ ├── Physics_StaticMulti.cpp │ ├── Physics_StaticMulti.h │ ├── Push.cpp │ └── Push.h └── script │ ├── Script_Compiler.cpp │ ├── Script_Compiler.h │ ├── Script_Interpreter.cpp │ ├── Script_Interpreter.h │ ├── Script_Program.cpp │ ├── Script_Program.h │ ├── Script_Thread.cpp │ └── Script_Thread.h ├── framework ├── BuildDefines.h ├── BuildVersion.h ├── CVarSystem.h ├── CmdSystem.h ├── Common.h ├── DeclAF.h ├── DeclEntityDef.h ├── DeclFX.h ├── DeclManager.h ├── DeclPDA.h ├── DeclParticle.h ├── DeclSkin.h ├── DeclTable.h ├── File.h ├── FileSystem.h ├── Game.h ├── Licensee.h ├── UsercmdGen.h └── async │ └── NetworkSystem.h ├── game ├── AF.cpp ├── AF.h ├── AFEntity.cpp ├── AFEntity.h ├── Actor.cpp ├── Actor.h ├── BrittleFracture.cpp ├── BrittleFracture.h ├── Camera.cpp ├── Camera.h ├── EndLevel.cpp ├── EndLevel.h ├── Entity.cpp ├── Entity.h ├── Fx.cpp ├── Fx.h ├── GameBase.h ├── GameEdit.cpp ├── GameEdit.h ├── Game_local.cpp ├── Game_local.h ├── Game_network.cpp ├── IK.cpp ├── IK.h ├── Item.cpp ├── Item.h ├── Light.cpp ├── Light.h ├── Misc.cpp ├── Misc.h ├── Moveable.cpp ├── Moveable.h ├── Mover.cpp ├── Mover.h ├── MultiplayerGame.cpp ├── MultiplayerGame.h ├── Player.cpp ├── Player.h ├── PlayerIcon.cpp ├── PlayerIcon.h ├── PlayerView.cpp ├── PlayerView.h ├── Projectile.cpp ├── Projectile.h ├── Pvs.cpp ├── Pvs.h ├── SecurityCamera.cpp ├── SecurityCamera.h ├── SmokeParticles.cpp ├── SmokeParticles.h ├── Sound.cpp ├── Sound.h ├── Target.cpp ├── Target.h ├── Trigger.cpp ├── Trigger.h ├── Weapon.cpp ├── Weapon.h ├── WorldSpawn.cpp ├── WorldSpawn.h ├── ai │ ├── AAS.cpp │ ├── AAS.h │ ├── AAS_debug.cpp │ ├── AAS_local.h │ ├── AAS_pathing.cpp │ ├── AAS_routing.cpp │ ├── AI.cpp │ ├── AI.h │ ├── AI_Vagary.cpp │ ├── AI_events.cpp │ └── AI_pathing.cpp ├── anim │ ├── Anim.cpp │ ├── Anim.h │ ├── Anim_Blend.cpp │ ├── Anim_Import.cpp │ ├── Anim_Testmodel.cpp │ └── Anim_Testmodel.h ├── gamesys │ ├── Callbacks.cpp │ ├── Class.cpp │ ├── Class.h │ ├── DebugGraph.cpp │ ├── DebugGraph.h │ ├── Event.cpp │ ├── Event.h │ ├── NoGameTypeInfo.h │ ├── SaveGame.cpp │ ├── SaveGame.h │ ├── SysCmds.cpp │ ├── SysCmds.h │ ├── SysCvar.cpp │ ├── SysCvar.h │ ├── TypeInfo.cpp │ └── TypeInfo.h ├── physics │ ├── Clip.cpp │ ├── Clip.h │ ├── Force.cpp │ ├── Force.h │ ├── Force_Constant.cpp │ ├── Force_Constant.h │ ├── Force_Drag.cpp │ ├── Force_Drag.h │ ├── Force_Field.cpp │ ├── Force_Field.h │ ├── Force_Spring.cpp │ ├── Force_Spring.h │ ├── Physics.cpp │ ├── Physics.h │ ├── Physics_AF.cpp │ ├── Physics_AF.h │ ├── Physics_Actor.cpp │ ├── Physics_Actor.h │ ├── Physics_Base.cpp │ ├── Physics_Base.h │ ├── Physics_Monster.cpp │ ├── Physics_Monster.h │ ├── Physics_Parametric.cpp │ ├── Physics_Parametric.h │ ├── Physics_Player.cpp │ ├── Physics_Player.h │ ├── Physics_RigidBody.cpp │ ├── Physics_RigidBody.h │ ├── Physics_Static.cpp │ ├── Physics_Static.h │ ├── Physics_StaticMulti.cpp │ ├── Physics_StaticMulti.h │ ├── Push.cpp │ └── Push.h └── script │ ├── Script_Compiler.cpp │ ├── Script_Compiler.h │ ├── Script_Interpreter.cpp │ ├── Script_Interpreter.h │ ├── Script_Program.cpp │ ├── Script_Program.h │ ├── Script_Thread.cpp │ └── Script_Thread.h ├── idlib ├── Base64.cpp ├── Base64.h ├── BitMsg.cpp ├── BitMsg.h ├── CmdArgs.cpp ├── CmdArgs.h ├── Dict.cpp ├── Dict.h ├── Heap.cpp ├── Heap.h ├── LangDict.cpp ├── LangDict.h ├── Lexer.cpp ├── Lexer.h ├── Lib.cpp ├── Lib.h ├── MapFile.cpp ├── MapFile.h ├── Parser.cpp ├── Parser.h ├── Str.cpp ├── Str.h ├── Timer.cpp ├── Timer.h ├── Token.cpp ├── Token.h ├── bv │ ├── Bounds.cpp │ ├── Bounds.h │ ├── Box.cpp │ ├── Box.h │ ├── Frustum.cpp │ ├── Frustum.h │ ├── Sphere.cpp │ └── Sphere.h ├── containers │ ├── BTree.h │ ├── BinSearch.h │ ├── HashIndex.cpp │ ├── HashIndex.h │ ├── HashTable.h │ ├── Hierarchy.h │ ├── LinkList.h │ ├── List.h │ ├── PlaneSet.h │ ├── Queue.h │ ├── Stack.h │ ├── StaticList.h │ ├── StrList.h │ ├── StrPool.h │ └── VectorSet.h ├── geometry │ ├── DrawVert.cpp │ ├── DrawVert.h │ ├── JointTransform.cpp │ ├── JointTransform.h │ ├── Surface.cpp │ ├── Surface.h │ ├── Surface_Patch.cpp │ ├── Surface_Patch.h │ ├── Surface_Polytope.cpp │ ├── Surface_Polytope.h │ ├── Surface_SweptSpline.cpp │ ├── Surface_SweptSpline.h │ ├── TraceModel.cpp │ ├── TraceModel.h │ ├── Winding.cpp │ ├── Winding.h │ ├── Winding2D.cpp │ └── Winding2D.h ├── hashing │ ├── CRC32.cpp │ ├── CRC32.h │ ├── MD4.cpp │ ├── MD4.h │ ├── MD5.cpp │ └── MD5.h └── math │ ├── Angles.cpp │ ├── Angles.h │ ├── Complex.cpp │ ├── Complex.h │ ├── Curve.h │ ├── Extrapolate.h │ ├── Interpolate.h │ ├── Lcp.cpp │ ├── Lcp.h │ ├── Math.cpp │ ├── Math.h │ ├── Matrix.cpp │ ├── Matrix.h │ ├── Ode.cpp │ ├── Ode.h │ ├── Plane.cpp │ ├── Plane.h │ ├── Pluecker.cpp │ ├── Pluecker.h │ ├── Polynomial.cpp │ ├── Polynomial.h │ ├── Quat.cpp │ ├── Quat.h │ ├── Random.h │ ├── Rotation.cpp │ ├── Rotation.h │ ├── Simd.cpp │ ├── Simd.h │ ├── Simd_3DNow.cpp │ ├── Simd_3DNow.h │ ├── Simd_AltiVec.cpp │ ├── Simd_AltiVec.h │ ├── Simd_Generic.cpp │ ├── Simd_Generic.h │ ├── Simd_MMX.cpp │ ├── Simd_MMX.h │ ├── Simd_SSE.cpp │ ├── Simd_SSE.h │ ├── Simd_SSE2.cpp │ ├── Simd_SSE2.h │ ├── Simd_SSE3.cpp │ ├── Simd_SSE3.h │ ├── Vector.cpp │ └── Vector.h ├── renderer ├── Cinematic.h ├── Material.h ├── Model.h ├── ModelManager.h ├── RenderSystem.h ├── RenderWorld.h └── qgl.h ├── sound └── sound.h ├── sys ├── Stub_SDL_endian.h ├── platform.h └── sys_public.h ├── tools └── compilers │ └── aas │ ├── AASFile.h │ └── AASFileManager.h └── ui ├── ListGUI.h └── UserInterface.h /.gitignore: -------------------------------------------------------------------------------- 1 | /build* 2 | -------------------------------------------------------------------------------- /COPYING.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhewm/dhewm3-sdk/b782366a0852e960c17580786b9e1deec4d1de6b/COPYING.txt -------------------------------------------------------------------------------- /MayaImport/maya_main.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __MAYA_MAIN_H__ 30 | #define __MAYA_MAIN_H__ 31 | 32 | #include "framework/FileSystem.h" 33 | 34 | class idCommon; 35 | class idSys; 36 | 37 | /* 38 | ============================================================== 39 | 40 | Maya Import 41 | 42 | ============================================================== 43 | */ 44 | 45 | 46 | typedef bool ( *exporterDLLEntry_t )( int version, idCommon *common, idSys *sys ); 47 | typedef const char *( *exporterInterface_t )( const char *ospath, const char *commandline ); 48 | typedef void ( *exporterShutdown_t )( void ); 49 | 50 | #endif /* !__MAYA_MAIN_H__ */ 51 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | #ifndef __DOOM3_CONFIG_H__ 2 | #define __DOOM3_CONFIG_H__ 3 | 4 | #define BUILD_OS "@os@" 5 | #define BUILD_CPU "@cpu@" 6 | 7 | #define BUILD_IS_BIG_ENDIAN @is_big_endian@ 8 | 9 | #define BUILD_LIBRARY_SUFFIX "@CMAKE_SHARED_LIBRARY_SUFFIX@" 10 | 11 | #define BUILD_LIBDIR "@libdir@" 12 | #define BUILD_DATADIR "@datadir@" 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /d3xp/EndLevel.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAME_ENDLEVEL_H__ 30 | #define __GAME_ENDLEVEL_H__ 31 | 32 | #include "Entity.h" 33 | 34 | class idTarget_EndLevel : public idEntity { 35 | public: 36 | CLASS_PROTOTYPE( idTarget_EndLevel ); 37 | 38 | void Spawn( void ); 39 | ~idTarget_EndLevel(); 40 | 41 | void Draw(); 42 | // the endLevel will be responsible for drawing the entire screen 43 | // when it is active 44 | 45 | void PlayerCommand( int buttons ); 46 | // when an endlevel is active, plauer buttons get sent here instead 47 | // of doing anything to the player, which will allow moving to 48 | // the next level 49 | 50 | const char *ExitCommand(); 51 | // the game will check this each frame, and return it to the 52 | // session when there is something to give 53 | 54 | private: 55 | idStr exitCommand; 56 | 57 | idVec3 initialViewOrg; 58 | idVec3 initialViewAngles; 59 | // set when the player triggers the exit 60 | 61 | idUserInterface *gui; 62 | 63 | bool buttonsReleased; 64 | // don't skip out until buttons are released, then pressed 65 | 66 | bool readyToExit; 67 | bool noGui; 68 | 69 | void Event_Trigger( idEntity *activator ); 70 | }; 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /d3xp/Fx.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAME_FX_H__ 30 | #define __GAME_FX_H__ 31 | 32 | #include "renderer/RenderWorld.h" 33 | 34 | #include "Entity.h" 35 | 36 | /* 37 | =============================================================================== 38 | 39 | Special effects. 40 | 41 | =============================================================================== 42 | */ 43 | 44 | typedef struct { 45 | renderLight_t renderLight; // light presented to the renderer 46 | qhandle_t lightDefHandle; // handle to renderer light def 47 | renderEntity_t renderEntity; // used to present a model to the renderer 48 | int modelDefHandle; // handle to static renderer model 49 | float delay; 50 | int particleSystem; 51 | int start; 52 | bool soundStarted; 53 | bool shakeStarted; 54 | bool decalDropped; 55 | bool launched; 56 | } idFXLocalAction; 57 | 58 | class idEntityFx : public idEntity { 59 | public: 60 | CLASS_PROTOTYPE( idEntityFx ); 61 | 62 | idEntityFx(); 63 | virtual ~idEntityFx(); 64 | 65 | void Spawn( void ); 66 | 67 | void Save( idSaveGame *savefile ) const; 68 | void Restore( idRestoreGame *savefile ); 69 | 70 | virtual void Think(); 71 | void Setup( const char *fx ); 72 | void Run( int time ); 73 | void Start( int time ); 74 | void Stop( void ); 75 | const int Duration( void ); 76 | const char * EffectName( void ); 77 | const char * Joint( void ); 78 | const bool Done(); 79 | 80 | virtual void WriteToSnapshot( idBitMsgDelta &msg ) const; 81 | virtual void ReadFromSnapshot( const idBitMsgDelta &msg ); 82 | virtual void ClientPredictionThink( void ); 83 | 84 | static idEntityFx * StartFx( const char *fx, const idVec3 *useOrigin, const idMat3 *useAxis, idEntity *ent, bool bind ); 85 | 86 | protected: 87 | void Event_Trigger( idEntity *activator ); 88 | void Event_ClearFx( void ); 89 | 90 | void CleanUp( void ); 91 | void CleanUpSingleAction( const idFXSingleAction& fxaction, idFXLocalAction& laction ); 92 | void ApplyFade( const idFXSingleAction& fxaction, idFXLocalAction& laction, const int time, const int actualStart ); 93 | 94 | int started; 95 | int nextTriggerTime; 96 | const idDeclFX * fxEffect; // GetFX() should be called before using fxEffect as a pointer 97 | idList actions; 98 | idStr systemName; 99 | }; 100 | 101 | class idTeleporter : public idEntityFx { 102 | public: 103 | CLASS_PROTOTYPE( idTeleporter ); 104 | 105 | private: 106 | // teleporters to this location 107 | void Event_DoAction( idEntity *activator ); 108 | }; 109 | 110 | #endif /* !__GAME_FX_H__ */ 111 | -------------------------------------------------------------------------------- /d3xp/GameBase.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAMEBASE_H__ 30 | #define __GAMEBASE_H__ 31 | 32 | // default scripts 33 | #define SCRIPT_DEFAULTDEFS "script/doom_defs.script" 34 | #define SCRIPT_DEFAULT "script/doom_main.script" 35 | #define SCRIPT_DEFAULTFUNC "doom_main" 36 | 37 | #define TIME_GROUP1 0 38 | #define TIME_GROUP2 1 39 | 40 | #define LAGO_IMG_WIDTH 64 41 | #define LAGO_IMG_HEIGHT 64 42 | #define LAGO_WIDTH 64 43 | #define LAGO_HEIGHT 44 44 | #define LAGO_MATERIAL "textures/sfx/lagometer" 45 | #define LAGO_IMAGE "textures/sfx/lagometer.tga" 46 | 47 | // if set to 1 the server sends the client PVS with snapshots and the client compares against what it sees 48 | #ifndef ASYNC_WRITE_PVS 49 | #define ASYNC_WRITE_PVS 0 50 | #endif 51 | 52 | // the "gameversion" client command will print this plus compile date 53 | #define GAME_VERSION "baseDOOM-1" 54 | 55 | #define MAX_CLIENTS 32 56 | #define GENTITYNUM_BITS 12 57 | #define MAX_GENTITIES (1<>5) 65 | 66 | // content masks 67 | #define MASK_ALL (-1) 68 | #define MASK_SOLID (CONTENTS_SOLID) 69 | #define MASK_MONSTERSOLID (CONTENTS_SOLID|CONTENTS_MONSTERCLIP|CONTENTS_BODY) 70 | #define MASK_PLAYERSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_BODY) 71 | #define MASK_DEADSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP) 72 | #define MASK_WATER (CONTENTS_WATER) 73 | #define MASK_OPAQUE (CONTENTS_OPAQUE) 74 | #define MASK_SHOT_RENDERMODEL (CONTENTS_SOLID|CONTENTS_RENDERMODEL) 75 | #define MASK_SHOT_BOUNDINGBOX (CONTENTS_SOLID|CONTENTS_BODY) 76 | 77 | #define DEFAULT_GRAVITY_STRING "1066" 78 | 79 | extern void gameError( const char *fmt, ... ); 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /d3xp/Grabber.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAME_GRABBER_H__ 30 | #define __GAME_GRABBER_H__ 31 | 32 | #ifdef _D3XP 33 | 34 | #include "physics/Force_Grab.h" 35 | #include "Entity.h" 36 | 37 | /* 38 | =============================================================================== 39 | 40 | Grabber Object - Class to extend idWeapon to include functionality for 41 | manipulating physics objects. 42 | 43 | =============================================================================== 44 | */ 45 | 46 | class idBeam; 47 | 48 | class idGrabber : public idEntity { 49 | public: 50 | CLASS_PROTOTYPE( idGrabber ); 51 | 52 | idGrabber( void ); 53 | ~idGrabber( void ); 54 | 55 | void Save( idSaveGame *savefile ) const; 56 | void Restore( idRestoreGame *savefile ); 57 | 58 | void Initialize( void ); 59 | void SetDragDistance( float dist ); 60 | int Update( idPlayer *player, bool hide ); 61 | 62 | private: 63 | idEntityPtr dragEnt; // entity being dragged 64 | idForce_Grab drag; 65 | idVec3 saveGravity; 66 | 67 | int id; // id of body being dragged 68 | idVec3 localPlayerPoint; // dragged point in player space 69 | idEntityPtr owner; 70 | int oldUcmdFlags; 71 | bool holdingAF; 72 | bool shakeForceFlip; 73 | int endTime; 74 | int lastFiredTime; 75 | int dragFailTime; 76 | int startDragTime; 77 | float dragTraceDist; 78 | int savedContents; 79 | int savedClipmask; 80 | 81 | idBeam* beam; 82 | idBeam* beamTarget; 83 | 84 | int warpId; 85 | 86 | bool grabbableAI( const char *aiName ); 87 | void StartDrag( idEntity *grabEnt, int id ); 88 | void StopDrag( bool dropOnly ); 89 | void UpdateBeams( void ); 90 | void ApplyShake( void ); 91 | }; 92 | 93 | #endif 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /d3xp/PlayerIcon.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __PLAYERICON_H__ 30 | #define __PLAYERICON_H__ 31 | 32 | typedef enum { 33 | ICON_LAG, 34 | ICON_CHAT, 35 | #ifdef CTF 36 | ICON_TEAM_RED, 37 | ICON_TEAM_BLUE, 38 | #endif 39 | ICON_NONE 40 | } playerIconType_t; 41 | 42 | class idPlayerIcon { 43 | public: 44 | 45 | public: 46 | idPlayerIcon(); 47 | ~idPlayerIcon(); 48 | 49 | void Draw( idPlayer *player, jointHandle_t joint ); 50 | void Draw( idPlayer *player, const idVec3 &origin ); 51 | 52 | public: 53 | playerIconType_t iconType; 54 | renderEntity_t renderEnt; 55 | qhandle_t iconHandle; 56 | 57 | public: 58 | void FreeIcon( void ); 59 | bool CreateIcon( idPlayer* player, playerIconType_t type, const char *mtr, const idVec3 &origin, const idMat3 &axis ); 60 | bool CreateIcon( idPlayer* player, playerIconType_t type, const idVec3 &origin, const idMat3 &axis ); 61 | void UpdateIcon( idPlayer* player, const idVec3 &origin, const idMat3 &axis ); 62 | 63 | }; 64 | 65 | 66 | #endif /* !_PLAYERICON_H_ */ 67 | -------------------------------------------------------------------------------- /d3xp/SecurityCamera.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAME_SECURITYCAMERA_H__ 30 | #define __GAME_SECURITYCAMERA_H__ 31 | 32 | #include "Entity.h" 33 | 34 | /* 35 | =================================================================================== 36 | 37 | Security camera 38 | 39 | =================================================================================== 40 | */ 41 | 42 | 43 | class idSecurityCamera : public idEntity { 44 | public: 45 | CLASS_PROTOTYPE( idSecurityCamera ); 46 | 47 | void Spawn( void ); 48 | 49 | void Save( idSaveGame *savefile ) const; 50 | void Restore( idRestoreGame *savefile ); 51 | 52 | virtual void Think( void ); 53 | 54 | virtual renderView_t * GetRenderView(); 55 | virtual void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ); 56 | virtual bool Pain( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ); 57 | virtual void Present( void ); 58 | 59 | 60 | private: 61 | 62 | enum { SCANNING, LOSINGINTEREST, ALERT, ACTIVATED }; 63 | 64 | float angle; 65 | float sweepAngle; 66 | int modelAxis; 67 | bool flipAxis; 68 | float scanDist; 69 | float scanFov; 70 | 71 | float sweepStart; 72 | float sweepEnd; 73 | bool negativeSweep; 74 | bool sweeping; 75 | int alertMode; 76 | float stopSweeping; 77 | float scanFovCos; 78 | 79 | idVec3 viewOffset; 80 | 81 | int pvsArea; 82 | idPhysics_RigidBody physicsObj; 83 | idTraceModel trm; 84 | 85 | void StartSweep( void ); 86 | bool CanSeePlayer( void ); 87 | void SetAlertMode( int status ); 88 | void DrawFov( void ); 89 | const idVec3 GetAxis( void ) const; 90 | float SweepSpeed( void ) const; 91 | 92 | void Event_ReverseSweep( void ); 93 | void Event_ContinueSweep( void ); 94 | void Event_Pause( void ); 95 | void Event_Alert( void ); 96 | void Event_AddLight( void ); 97 | }; 98 | 99 | #endif /* !__GAME_SECURITYCAMERA_H__ */ 100 | -------------------------------------------------------------------------------- /d3xp/Sound.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAME_SOUND_H__ 30 | #define __GAME_SOUND_H__ 31 | 32 | #include "Entity.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Generic sound emitter. 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idSound : public idEntity { 43 | public: 44 | CLASS_PROTOTYPE( idSound ); 45 | 46 | idSound( void ); 47 | 48 | void Save( idSaveGame *savefile ) const; 49 | void Restore( idRestoreGame *savefile ); 50 | 51 | virtual void UpdateChangeableSpawnArgs( const idDict *source ); 52 | 53 | void Spawn( void ); 54 | 55 | void ToggleOnOff( idEntity *other, idEntity *activator ); 56 | void Think( void ); 57 | void SetSound( const char *sound, int channel = SND_CHANNEL_ANY ); 58 | 59 | virtual void ShowEditingDialog( void ); 60 | 61 | private: 62 | float lastSoundVol; 63 | float soundVol; 64 | float random; 65 | float wait; 66 | bool timerOn; 67 | idVec3 shakeTranslate; 68 | idAngles shakeRotate; 69 | int playingUntilTime; 70 | 71 | void Event_Trigger( idEntity *activator ); 72 | void Event_Timer( void ); 73 | void Event_On( void ); 74 | void Event_Off( void ); 75 | void DoSound( bool play ); 76 | }; 77 | 78 | #endif /* !__GAME_SOUND_H__ */ 79 | -------------------------------------------------------------------------------- /d3xp/WorldSpawn.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAME_WORLDSPAWN_H__ 30 | #define __GAME_WORLDSPAWN_H__ 31 | 32 | #include "Entity.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | World entity. 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idWorldspawn : public idEntity { 43 | public: 44 | CLASS_PROTOTYPE( idWorldspawn ); 45 | 46 | ~idWorldspawn(); 47 | 48 | void Spawn( void ); 49 | 50 | void Save( idRestoreGame *savefile ); 51 | void Restore( idRestoreGame *savefile ); 52 | 53 | private: 54 | void Event_Remove( void ); 55 | }; 56 | 57 | #endif /* !__GAME_WORLDSPAWN_H__ */ 58 | -------------------------------------------------------------------------------- /d3xp/anim/Anim_Testmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __ANIM_TESTMODEL_H__ 30 | #define __ANIM_TESTMODEL_H__ 31 | 32 | #include "physics/Physics_Parametric.h" 33 | #include "Entity.h" 34 | #include "Actor.h" 35 | 36 | /* 37 | ============================================================================================== 38 | 39 | idTestModel 40 | 41 | ============================================================================================== 42 | */ 43 | 44 | class idTestModel : public idAnimatedEntity { 45 | public: 46 | CLASS_PROTOTYPE( idTestModel ); 47 | 48 | idTestModel(); 49 | ~idTestModel(); 50 | 51 | void Save( idSaveGame *savefile ); 52 | void Restore( idRestoreGame *savefile ); 53 | 54 | void Spawn( void ); 55 | 56 | virtual bool ShouldConstructScriptObjectAtSpawn( void ) const; 57 | 58 | void NextAnim( const idCmdArgs &args ); 59 | void PrevAnim( const idCmdArgs &args ); 60 | void NextFrame( const idCmdArgs &args ); 61 | void PrevFrame( const idCmdArgs &args ); 62 | void TestAnim( const idCmdArgs &args ); 63 | void BlendAnim( const idCmdArgs &args ); 64 | 65 | static void KeepTestModel_f( const idCmdArgs &args ); 66 | static void TestModel_f( const idCmdArgs &args ); 67 | static void ArgCompletion_TestModel( const idCmdArgs &args, void(*callback)( const char *s ) ); 68 | static void TestSkin_f( const idCmdArgs &args ); 69 | static void TestShaderParm_f( const idCmdArgs &args ); 70 | static void TestParticleStopTime_f( const idCmdArgs &args ); 71 | static void TestAnim_f( const idCmdArgs &args ); 72 | static void ArgCompletion_TestAnim( const idCmdArgs &args, void(*callback)( const char *s ) ); 73 | static void TestBlend_f( const idCmdArgs &args ); 74 | static void TestModelNextAnim_f( const idCmdArgs &args ); 75 | static void TestModelPrevAnim_f( const idCmdArgs &args ); 76 | static void TestModelNextFrame_f( const idCmdArgs &args ); 77 | static void TestModelPrevFrame_f( const idCmdArgs &args ); 78 | 79 | private: 80 | idEntityPtr head; 81 | idAnimator *headAnimator; 82 | idAnim customAnim; 83 | idPhysics_Parametric physicsObj; 84 | idStr animname; 85 | int anim; 86 | int headAnim; 87 | int mode; 88 | int frame; 89 | int starttime; 90 | int animtime; 91 | 92 | idList copyJoints; 93 | 94 | virtual void Think( void ); 95 | 96 | void Event_Footstep( void ); 97 | }; 98 | 99 | #endif /* !__ANIM_TESTMODEL_H__*/ 100 | -------------------------------------------------------------------------------- /d3xp/gamesys/DebugGraph.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | #include "Player.h" 31 | #include "Game_local.h" 32 | 33 | #include "DebugGraph.h" 34 | 35 | /* 36 | ================ 37 | idDebugGraph::idDebugGraph 38 | ================ 39 | */ 40 | idDebugGraph::idDebugGraph() { 41 | index = 0; 42 | } 43 | 44 | /* 45 | ================ 46 | idDebugGraph::SetNumSamples 47 | ================ 48 | */ 49 | void idDebugGraph::SetNumSamples( int num ) { 50 | index = 0; 51 | samples.Clear(); 52 | samples.SetNum( num ); 53 | memset( samples.Ptr(), 0, samples.MemoryUsed() ); 54 | } 55 | 56 | /* 57 | ================ 58 | idDebugGraph::AddValue 59 | ================ 60 | */ 61 | void idDebugGraph::AddValue( float value ) { 62 | samples[ index ] = value; 63 | index++; 64 | if ( index >= samples.Num() ) { 65 | index = 0; 66 | } 67 | } 68 | 69 | /* 70 | ================ 71 | idDebugGraph::Draw 72 | ================ 73 | */ 74 | void idDebugGraph::Draw( const idVec4 &color, float scale ) const { 75 | int i; 76 | float value1; 77 | float value2; 78 | idVec3 vec1; 79 | idVec3 vec2; 80 | 81 | const idMat3 &axis = gameLocal.GetLocalPlayer()->viewAxis; 82 | const idVec3 pos = gameLocal.GetLocalPlayer()->GetPhysics()->GetOrigin() + axis[ 1 ] * samples.Num() * 0.5f; 83 | 84 | value1 = samples[ index ] * scale; 85 | for( i = 1; i < samples.Num(); i++ ) { 86 | value2 = samples[ ( i + index ) % samples.Num() ] * scale; 87 | 88 | vec1 = pos + axis[ 2 ] * value1 - axis[ 1 ] * ( i - 1 ) + axis[ 0 ] * samples.Num(); 89 | vec2 = pos + axis[ 2 ] * value2 - axis[ 1 ] * i + axis[ 0 ] * samples.Num(); 90 | 91 | gameRenderWorld->DebugLine( color, vec1, vec2, gameLocal.msec, false ); 92 | value1 = value2; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /d3xp/gamesys/DebugGraph.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __DEBUGGRAPH_H__ 30 | #define __DEBUGGRAPH_H__ 31 | 32 | #include "idlib/containers/List.h" 33 | #include "idlib/math/Vector.h" 34 | 35 | class idDebugGraph { 36 | public: 37 | idDebugGraph(); 38 | void SetNumSamples( int num ); 39 | void AddValue( float value ); 40 | void Draw( const idVec4 &color, float scale ) const; 41 | 42 | private: 43 | idList samples; 44 | int index; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /d3xp/gamesys/NoGameTypeInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAMETYPEINFO_H__ 30 | #define __GAMETYPEINFO_H__ 31 | 32 | /* 33 | =================================================================================== 34 | 35 | This file has been generated with the Type Info Generator v1.0 (c) 2004 id Software 36 | 37 | =================================================================================== 38 | */ 39 | 40 | typedef struct { 41 | const char * name; 42 | const char * type; 43 | const char * value; 44 | } constantInfo_t; 45 | 46 | typedef struct { 47 | const char * name; 48 | int value; 49 | } enumValueInfo_t; 50 | 51 | typedef struct { 52 | const char * typeName; 53 | const enumValueInfo_t * values; 54 | } enumTypeInfo_t; 55 | 56 | typedef struct { 57 | const char * type; 58 | const char * name; 59 | int offset; 60 | int size; 61 | } classVariableInfo_t; 62 | 63 | typedef struct { 64 | const char * typeName; 65 | const char * superType; 66 | int size; 67 | const classVariableInfo_t * variables; 68 | } classTypeInfo_t; 69 | 70 | 71 | static enumTypeInfo_t enumTypeInfo[] = { 72 | { NULL, NULL } 73 | }; 74 | 75 | static classTypeInfo_t classTypeInfo[] = { 76 | { NULL, NULL, 0, NULL } 77 | }; 78 | 79 | #endif /* !__GAMETYPEINFO_H__ */ 80 | -------------------------------------------------------------------------------- /d3xp/gamesys/SysCmds.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __SYS_CMDS_H__ 30 | #define __SYS_CMDS_H__ 31 | 32 | void D_DrawDebugLines( void ); 33 | 34 | #endif /* !__SYS_CMDS_H__ */ 35 | -------------------------------------------------------------------------------- /d3xp/gamesys/TypeInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __SYS_TYPEINFO_H__ 30 | #define __SYS_TYPEINFO_H__ 31 | 32 | #include "idlib/CmdArgs.h" 33 | 34 | class idFile; 35 | 36 | /* 37 | =================================================================================== 38 | 39 | Game Type Info 40 | 41 | =================================================================================== 42 | */ 43 | 44 | const char * GetTypeVariableName( const char *typeName, int offset ); 45 | 46 | void PrintType( const void *typePtr, const char *typeName ); 47 | void WriteTypeToFile( idFile *fp, const void *typePtr, const char *typeName ); 48 | void InitTypeVariables( const void *typePtr, const char *typeName, int value ); 49 | 50 | void ListTypeInfo_f( const idCmdArgs &args ); 51 | 52 | void WriteGameState_f( const idCmdArgs &args ); 53 | void CompareGameState_f( const idCmdArgs &args ); 54 | void TestSaveGame_f( const idCmdArgs &args ); 55 | 56 | #endif /* !__SYS_TYPEINFO_H__ */ 57 | -------------------------------------------------------------------------------- /d3xp/physics/Force.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | 31 | #include "physics/Force.h" 32 | 33 | CLASS_DECLARATION( idClass, idForce ) 34 | END_CLASS 35 | 36 | idList idForce::forceList; 37 | 38 | /* 39 | ================ 40 | idForce::idForce 41 | ================ 42 | */ 43 | idForce::idForce( void ) { 44 | forceList.Append( this ); 45 | } 46 | 47 | /* 48 | ================ 49 | idForce::~idForce 50 | ================ 51 | */ 52 | idForce::~idForce( void ) { 53 | forceList.Remove( this ); 54 | } 55 | 56 | /* 57 | ================ 58 | idForce::DeletePhysics 59 | ================ 60 | */ 61 | void idForce::DeletePhysics( const idPhysics *phys ) { 62 | int i; 63 | 64 | for ( i = 0; i < forceList.Num(); i++ ) { 65 | forceList[i]->RemovePhysics( phys ); 66 | } 67 | } 68 | 69 | /* 70 | ================ 71 | idForce::ClearForceList 72 | ================ 73 | */ 74 | void idForce::ClearForceList( void ) { 75 | forceList.Clear(); 76 | } 77 | 78 | /* 79 | ================ 80 | idForce::Evaluate 81 | ================ 82 | */ 83 | void idForce::Evaluate( int time ) { 84 | } 85 | 86 | /* 87 | ================ 88 | idForce::RemovePhysics 89 | ================ 90 | */ 91 | void idForce::RemovePhysics( const idPhysics *phys ) { 92 | } 93 | -------------------------------------------------------------------------------- /d3xp/physics/Force.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __FORCE_H__ 30 | #define __FORCE_H__ 31 | 32 | #include "gamesys/Class.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Force base class 38 | 39 | A force object applies a force to a physics object. 40 | 41 | =============================================================================== 42 | */ 43 | 44 | class idEntity; 45 | class idPhysics; 46 | 47 | class idForce : public idClass { 48 | 49 | public: 50 | CLASS_PROTOTYPE( idForce ); 51 | 52 | idForce( void ); 53 | virtual ~idForce( void ); 54 | static void DeletePhysics( const idPhysics *phys ); 55 | static void ClearForceList( void ); 56 | 57 | public: // common force interface 58 | // evalulate the force up to the given time 59 | virtual void Evaluate( int time ); 60 | // removes any pointers to the physics object 61 | virtual void RemovePhysics( const idPhysics *phys ); 62 | 63 | private: 64 | 65 | static idList forceList; 66 | }; 67 | 68 | #endif /* !__FORCE_H__ */ 69 | -------------------------------------------------------------------------------- /d3xp/physics/Force_Constant.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | #include "physics/Physics.h" 31 | #include "gamesys/SaveGame.h" 32 | 33 | #include "physics/Force_Constant.h" 34 | 35 | CLASS_DECLARATION( idForce, idForce_Constant ) 36 | END_CLASS 37 | 38 | /* 39 | ================ 40 | idForce_Constant::idForce_Constant 41 | ================ 42 | */ 43 | idForce_Constant::idForce_Constant( void ) { 44 | force = vec3_zero; 45 | physics = NULL; 46 | id = 0; 47 | point = vec3_zero; 48 | } 49 | 50 | /* 51 | ================ 52 | idForce_Constant::~idForce_Constant 53 | ================ 54 | */ 55 | idForce_Constant::~idForce_Constant( void ) { 56 | } 57 | 58 | /* 59 | ================ 60 | idForce_Constant::Save 61 | ================ 62 | */ 63 | void idForce_Constant::Save( idSaveGame *savefile ) const { 64 | savefile->WriteVec3( force ); 65 | savefile->WriteInt( id ); 66 | savefile->WriteVec3( point ); 67 | } 68 | 69 | /* 70 | ================ 71 | idForce_Constant::Restore 72 | ================ 73 | */ 74 | void idForce_Constant::Restore( idRestoreGame *savefile ) { 75 | // Owner needs to call SetPhysics!! 76 | savefile->ReadVec3( force ); 77 | savefile->ReadInt( id ); 78 | savefile->ReadVec3( point ); 79 | } 80 | 81 | /* 82 | ================ 83 | idForce_Constant::SetPosition 84 | ================ 85 | */ 86 | void idForce_Constant::SetPosition( idPhysics *physics, int id, const idVec3 &point ) { 87 | this->physics = physics; 88 | this->id = id; 89 | this->point = point; 90 | } 91 | 92 | /* 93 | ================ 94 | idForce_Constant::SetForce 95 | ================ 96 | */ 97 | void idForce_Constant::SetForce( const idVec3 &force ) { 98 | this->force = force; 99 | } 100 | 101 | /* 102 | ================ 103 | idForce_Constant::SetPhysics 104 | ================ 105 | */ 106 | void idForce_Constant::SetPhysics( idPhysics *physics ) { 107 | this->physics = physics; 108 | } 109 | 110 | /* 111 | ================ 112 | idForce_Constant::Evaluate 113 | ================ 114 | */ 115 | void idForce_Constant::Evaluate( int time ) { 116 | idVec3 p; 117 | 118 | if ( !physics ) { 119 | return; 120 | } 121 | 122 | p = physics->GetOrigin( id ) + point * physics->GetAxis( id ); 123 | 124 | physics->AddForce( id, p, force ); 125 | } 126 | 127 | /* 128 | ================ 129 | idForce_Constant::RemovePhysics 130 | ================ 131 | */ 132 | void idForce_Constant::RemovePhysics( const idPhysics *phys ) { 133 | if ( physics == phys ) { 134 | physics = NULL; 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /d3xp/physics/Force_Constant.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __FORCE_CONSTANT_H__ 30 | #define __FORCE_CONSTANT_H__ 31 | 32 | #include "physics/Force.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Constant force 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idForce_Constant : public idForce { 43 | 44 | public: 45 | CLASS_PROTOTYPE( idForce_Constant ); 46 | 47 | idForce_Constant( void ); 48 | virtual ~idForce_Constant( void ); 49 | 50 | 51 | void Save( idSaveGame *savefile ) const; 52 | void Restore( idRestoreGame *savefile ); 53 | 54 | // constant force 55 | void SetForce( const idVec3 &force ); 56 | // set force position 57 | void SetPosition( idPhysics *physics, int id, const idVec3 &point ); 58 | 59 | void SetPhysics( idPhysics *physics ); 60 | 61 | public: // common force interface 62 | virtual void Evaluate( int time ); 63 | virtual void RemovePhysics( const idPhysics *phys ); 64 | 65 | private: 66 | // force properties 67 | idVec3 force; 68 | idPhysics * physics; 69 | int id; 70 | idVec3 point; 71 | }; 72 | 73 | #endif /* !__FORCE_CONSTANT_H__ */ 74 | -------------------------------------------------------------------------------- /d3xp/physics/Force_Drag.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __FORCE_DRAG_H__ 30 | #define __FORCE_DRAG_H__ 31 | 32 | #include "physics/Force.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Drag force 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idForce_Drag : public idForce { 43 | 44 | public: 45 | CLASS_PROTOTYPE( idForce_Drag ); 46 | 47 | idForce_Drag( void ); 48 | virtual ~idForce_Drag( void ); 49 | // initialize the drag force 50 | void Init( float damping ); 51 | // set physics object being dragged 52 | void SetPhysics( idPhysics *physics, int id, const idVec3 &p ); 53 | // set position to drag towards 54 | void SetDragPosition( const idVec3 &pos ); 55 | // get the position dragged towards 56 | const idVec3 & GetDragPosition( void ) const; 57 | // get the position on the dragged physics object 58 | const idVec3 GetDraggedPosition( void ) const; 59 | 60 | public: // common force interface 61 | virtual void Evaluate( int time ); 62 | virtual void RemovePhysics( const idPhysics *phys ); 63 | 64 | private: 65 | 66 | // properties 67 | float damping; 68 | 69 | // positioning 70 | idPhysics * physics; // physics object 71 | int id; // clip model id of physics object 72 | idVec3 p; // position on clip model 73 | idVec3 dragPosition; // drag towards this position 74 | }; 75 | 76 | #endif /* !__FORCE_DRAG_H__ */ 77 | -------------------------------------------------------------------------------- /d3xp/physics/Force_Field.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __FORCE_FIELD_H__ 30 | #define __FORCE_FIELD_H__ 31 | 32 | #include "physics/Force.h" 33 | #include "physics/Clip.h" 34 | #include "Entity.h" 35 | #include "AFEntity.h" 36 | 37 | /* 38 | =============================================================================== 39 | 40 | Force field 41 | 42 | =============================================================================== 43 | */ 44 | 45 | enum forceFieldType { 46 | FORCEFIELD_UNIFORM, 47 | FORCEFIELD_EXPLOSION, 48 | FORCEFIELD_IMPLOSION 49 | }; 50 | 51 | enum forceFieldApplyType { 52 | FORCEFIELD_APPLY_FORCE, 53 | FORCEFIELD_APPLY_VELOCITY, 54 | FORCEFIELD_APPLY_IMPULSE 55 | }; 56 | 57 | class idForce_Field : public idForce { 58 | 59 | public: 60 | CLASS_PROTOTYPE( idForce_Field ); 61 | 62 | void Save( idSaveGame *savefile ) const; 63 | void Restore( idRestoreGame *savefile ); 64 | 65 | idForce_Field( void ); 66 | virtual ~idForce_Field( void ); 67 | // uniform constant force 68 | void Uniform( const idVec3 &force ); 69 | // explosion from clip model origin 70 | void Explosion( float force ); 71 | // implosion towards clip model origin 72 | void Implosion( float force ); 73 | // add random torque 74 | void RandomTorque( float force ); 75 | // should the force field apply a force, velocity or impulse 76 | void SetApplyType( const forceFieldApplyType type ) { applyType = type; } 77 | // make the force field only push players 78 | void SetPlayerOnly( bool set ) { playerOnly = set; } 79 | // make the force field only push monsters 80 | void SetMonsterOnly( bool set ) { monsterOnly = set; } 81 | // clip model describing the extents of the force field 82 | void SetClipModel( idClipModel *clipModel ); 83 | 84 | public: // common force interface 85 | virtual void Evaluate( int time ); 86 | 87 | private: 88 | // force properties 89 | forceFieldType type; 90 | forceFieldApplyType applyType; 91 | float magnitude; 92 | idVec3 dir; 93 | float randomTorque; 94 | bool playerOnly; 95 | bool monsterOnly; 96 | idClipModel * clipModel; 97 | }; 98 | 99 | #endif /* !__FORCE_FIELD_H__ */ 100 | -------------------------------------------------------------------------------- /d3xp/physics/Force_Grab.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __FORCE_GRAB_H__ 30 | #define __FORCE_GRAB_H__ 31 | 32 | #ifdef _D3XP 33 | 34 | #include "physics/Force.h" 35 | 36 | /* 37 | =============================================================================== 38 | 39 | Drag force 40 | 41 | =============================================================================== 42 | */ 43 | 44 | class idForce_Grab : public idForce { 45 | 46 | public: 47 | CLASS_PROTOTYPE( idForce_Grab ); 48 | 49 | void Save( idSaveGame *savefile ) const; 50 | void Restore( idRestoreGame *savefile ); 51 | 52 | idForce_Grab( void ); 53 | virtual ~idForce_Grab( void ); 54 | // initialize the drag force 55 | void Init( float damping ); 56 | // set physics object being dragged 57 | void SetPhysics( idPhysics *physics, int id, const idVec3 &goal ); 58 | // update the goal position 59 | void SetGoalPosition( const idVec3 &goal ); 60 | 61 | 62 | public: // common force interface 63 | virtual void Evaluate( int time ); 64 | virtual void RemovePhysics( const idPhysics *phys ); 65 | 66 | // Get the distance from object to goal position 67 | float GetDistanceToGoal( void ); 68 | 69 | private: 70 | 71 | // properties 72 | float damping; 73 | idVec3 goalPosition; 74 | 75 | float distanceToGoal; 76 | 77 | // positioning 78 | idPhysics * physics; // physics object 79 | int id; // clip model id of physics object 80 | }; 81 | 82 | #endif /* _D3XP */ 83 | #endif /* !__FORCE_GRAB_H__ */ 84 | -------------------------------------------------------------------------------- /d3xp/physics/Force_Spring.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __FORCE_SPRING_H__ 30 | #define __FORCE_SPRING_H__ 31 | 32 | #include "physics/Force.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Spring force 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idForce_Spring : public idForce { 43 | 44 | public: 45 | CLASS_PROTOTYPE( idForce_Spring ); 46 | 47 | idForce_Spring( void ); 48 | virtual ~idForce_Spring( void ); 49 | // initialize the spring 50 | void InitSpring( float Kstretch, float Kcompress, float damping, float restLength ); 51 | // set the entities and positions on these entities the spring is attached to 52 | void SetPosition( idPhysics *physics1, int id1, const idVec3 &p1, 53 | idPhysics *physics2, int id2, const idVec3 &p2 ); 54 | 55 | public: // common force interface 56 | virtual void Evaluate( int time ); 57 | virtual void RemovePhysics( const idPhysics *phys ); 58 | 59 | private: 60 | 61 | // spring properties 62 | float Kstretch; 63 | float Kcompress; 64 | float damping; 65 | float restLength; 66 | 67 | // positioning 68 | idPhysics * physics1; // first physics object 69 | int id1; // clip model id of first physics object 70 | idVec3 p1; // position on clip model 71 | idPhysics * physics2; // second physics object 72 | int id2; // clip model id of second physics object 73 | idVec3 p2; // position on clip model 74 | 75 | }; 76 | 77 | #endif /* !__FORCE_SPRING_H__ */ 78 | -------------------------------------------------------------------------------- /d3xp/physics/Physics.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | #include "Game_local.h" 31 | 32 | #include "physics/Physics.h" 33 | 34 | ABSTRACT_DECLARATION( idClass, idPhysics ) 35 | END_CLASS 36 | 37 | 38 | /* 39 | ================ 40 | idPhysics::~idPhysics 41 | ================ 42 | */ 43 | idPhysics::~idPhysics( void ) { 44 | } 45 | 46 | /* 47 | ================ 48 | idPhysics::Save 49 | ================ 50 | */ 51 | void idPhysics::Save( idSaveGame *savefile ) const { 52 | } 53 | 54 | /* 55 | ================ 56 | idPhysics::Restore 57 | ================ 58 | */ 59 | void idPhysics::Restore( idRestoreGame *savefile ) { 60 | } 61 | 62 | /* 63 | ================ 64 | idPhysics::SetClipBox 65 | ================ 66 | */ 67 | void idPhysics::SetClipBox( const idBounds &bounds, float density ) { 68 | SetClipModel( new idClipModel( idTraceModel( bounds ) ), density ); 69 | } 70 | 71 | /* 72 | ================ 73 | idPhysics::SnapTimeToPhysicsFrame 74 | ================ 75 | */ 76 | int idPhysics::SnapTimeToPhysicsFrame( int t ) { 77 | int s; 78 | s = t + USERCMD_MSEC - 1; 79 | return ( s - s % USERCMD_MSEC ); 80 | } 81 | -------------------------------------------------------------------------------- /framework/BuildVersion.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | const int BUILD_NUMBER = 1305; 29 | -------------------------------------------------------------------------------- /framework/DeclEntityDef.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __DECLENTITYDEF_H__ 30 | #define __DECLENTITYDEF_H__ 31 | 32 | #include "idlib/Dict.h" 33 | #include "framework/DeclManager.h" 34 | 35 | /* 36 | =============================================================================== 37 | 38 | idDeclEntityDef 39 | 40 | =============================================================================== 41 | */ 42 | 43 | class idDeclEntityDef : public idDecl { 44 | public: 45 | idDict dict; 46 | 47 | virtual size_t Size( void ) const; 48 | virtual const char * DefaultDefinition() const; 49 | virtual bool Parse( const char *text, const int textLength ); 50 | virtual void FreeData( void ); 51 | virtual void Print( void ) const; 52 | }; 53 | 54 | #endif /* !__DECLENTITYDEF_H__ */ 55 | -------------------------------------------------------------------------------- /framework/DeclFX.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __DECLFX_H__ 30 | #define __DECLFX_H__ 31 | 32 | #include "idlib/containers/List.h" 33 | #include "idlib/math/Matrix.h" 34 | #include "idlib/Str.h" 35 | #include "framework/DeclManager.h" 36 | 37 | /* 38 | =============================================================================== 39 | 40 | idDeclFX 41 | 42 | =============================================================================== 43 | */ 44 | 45 | enum { 46 | FX_LIGHT, 47 | FX_PARTICLE, 48 | FX_DECAL, 49 | FX_MODEL, 50 | FX_SOUND, 51 | FX_SHAKE, 52 | FX_ATTACHLIGHT, 53 | FX_ATTACHENTITY, 54 | FX_LAUNCH, 55 | FX_SHOCKWAVE 56 | }; 57 | 58 | // 59 | // single fx structure 60 | // 61 | typedef struct { 62 | int type; 63 | int sibling; 64 | 65 | idStr data; 66 | idStr name; 67 | idStr fire; 68 | 69 | float delay; 70 | float duration; 71 | float restart; 72 | float size; 73 | float fadeInTime; 74 | float fadeOutTime; 75 | float shakeTime; 76 | float shakeAmplitude; 77 | float shakeDistance; 78 | float shakeImpulse; 79 | float lightRadius; 80 | float rotate; 81 | float random1; 82 | float random2; 83 | 84 | idVec3 lightColor; 85 | idVec3 offset; 86 | idMat3 axis; 87 | 88 | bool soundStarted; 89 | bool shakeStarted; 90 | bool shakeFalloff; 91 | bool shakeIgnoreMaster; 92 | bool bindParticles; 93 | bool explicitAxis; 94 | bool noshadows; 95 | bool particleTrackVelocity; 96 | bool trackOrigin; 97 | } idFXSingleAction; 98 | 99 | // 100 | // grouped fx structures 101 | // 102 | class idDeclFX : public idDecl { 103 | public: 104 | virtual size_t Size( void ) const; 105 | virtual const char * DefaultDefinition( void ) const; 106 | virtual bool Parse( const char *text, const int textLength ); 107 | virtual void FreeData( void ); 108 | virtual void Print( void ) const; 109 | virtual void List( void ) const; 110 | 111 | idListevents; 112 | idStr joint; 113 | 114 | private: 115 | void ParseSingleFXAction( idLexer &src, idFXSingleAction& FXAction ); 116 | }; 117 | 118 | #endif /* !__DECLFX_H__ */ 119 | -------------------------------------------------------------------------------- /framework/DeclSkin.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __DECLSKIN_H__ 30 | #define __DECLSKIN_H__ 31 | 32 | #include "idlib/containers/StrList.h" 33 | #include "framework/DeclManager.h" 34 | #include "renderer/Material.h" 35 | 36 | /* 37 | =============================================================================== 38 | 39 | idDeclSkin 40 | 41 | =============================================================================== 42 | */ 43 | 44 | typedef struct { 45 | const idMaterial * from; // 0 == any unmatched shader 46 | const idMaterial * to; 47 | } skinMapping_t; 48 | 49 | class idDeclSkin : public idDecl { 50 | public: 51 | virtual size_t Size( void ) const; 52 | virtual bool SetDefaultText( void ); 53 | virtual const char * DefaultDefinition( void ) const; 54 | virtual bool Parse( const char *text, const int textLength ); 55 | virtual void FreeData( void ); 56 | 57 | const idMaterial * RemapShaderBySkin( const idMaterial *shader ) const; 58 | 59 | // model associations are just for the preview dialog in the editor 60 | const int GetNumModelAssociations() const; 61 | const char * GetAssociatedModel( int index ) const; 62 | 63 | private: 64 | idList mappings; 65 | idStrList associatedModels; 66 | }; 67 | 68 | #endif /* !__DECLSKIN_H__ */ 69 | -------------------------------------------------------------------------------- /framework/DeclTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __DECLTABLE_H__ 30 | #define __DECLTABLE_H__ 31 | 32 | #include "idlib/containers/List.h" 33 | #include "framework/DeclManager.h" 34 | 35 | /* 36 | =============================================================================== 37 | 38 | tables are used to map a floating point input value to a floating point 39 | output value, with optional wrap / clamp and interpolation 40 | 41 | =============================================================================== 42 | */ 43 | 44 | class idDeclTable : public idDecl { 45 | public: 46 | virtual size_t Size( void ) const; 47 | virtual const char * DefaultDefinition( void ) const; 48 | virtual bool Parse( const char *text, const int textLength ); 49 | virtual void FreeData( void ); 50 | 51 | float TableLookup( float index ) const; 52 | 53 | private: 54 | bool clamp; 55 | bool snap; 56 | idList values; 57 | }; 58 | 59 | #endif /* !__DECLTABLE_H__ */ 60 | -------------------------------------------------------------------------------- /framework/async/NetworkSystem.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __NETWORKSYSTEM_H__ 30 | #define __NETWORKSYSTEM_H__ 31 | 32 | #include "idlib/BitMsg.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Network System. 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idNetworkSystem { 43 | public: 44 | virtual ~idNetworkSystem( void ) {} 45 | 46 | virtual void ServerSendReliableMessage( int clientNum, const idBitMsg &msg ); 47 | virtual void ServerSendReliableMessageExcluding( int clientNum, const idBitMsg &msg ); 48 | virtual int ServerGetClientPing( int clientNum ); 49 | virtual int ServerGetClientPrediction( int clientNum ); 50 | virtual int ServerGetClientTimeSinceLastPacket( int clientNum ); 51 | virtual int ServerGetClientTimeSinceLastInput( int clientNum ); 52 | virtual int ServerGetClientOutgoingRate( int clientNum ); 53 | virtual int ServerGetClientIncomingRate( int clientNum ); 54 | virtual float ServerGetClientIncomingPacketLoss( int clientNum ); 55 | 56 | virtual void ClientSendReliableMessage( const idBitMsg &msg ); 57 | virtual int ClientGetPrediction( void ); 58 | virtual int ClientGetTimeSinceLastPacket( void ); 59 | virtual int ClientGetOutgoingRate( void ); 60 | virtual int ClientGetIncomingRate( void ); 61 | virtual float ClientGetIncomingPacketLoss( void ); 62 | }; 63 | 64 | extern idNetworkSystem * networkSystem; 65 | 66 | #endif /* !__NETWORKSYSTEM_H__ */ 67 | -------------------------------------------------------------------------------- /game/EndLevel.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAME_ENDLEVEL_H__ 30 | #define __GAME_ENDLEVEL_H__ 31 | 32 | #include "Entity.h" 33 | 34 | class idTarget_EndLevel : public idEntity { 35 | public: 36 | CLASS_PROTOTYPE( idTarget_EndLevel ); 37 | 38 | void Spawn( void ); 39 | ~idTarget_EndLevel(); 40 | 41 | void Draw(); 42 | // the endLevel will be responsible for drawing the entire screen 43 | // when it is active 44 | 45 | void PlayerCommand( int buttons ); 46 | // when an endlevel is active, plauer buttons get sent here instead 47 | // of doing anything to the player, which will allow moving to 48 | // the next level 49 | 50 | const char *ExitCommand(); 51 | // the game will check this each frame, and return it to the 52 | // session when there is something to give 53 | 54 | private: 55 | idStr exitCommand; 56 | 57 | idVec3 initialViewOrg; 58 | idVec3 initialViewAngles; 59 | // set when the player triggers the exit 60 | 61 | idUserInterface *gui; 62 | 63 | bool buttonsReleased; 64 | // don't skip out until buttons are released, then pressed 65 | 66 | bool readyToExit; 67 | bool noGui; 68 | 69 | void Event_Trigger( idEntity *activator ); 70 | }; 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /game/Fx.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAME_FX_H__ 30 | #define __GAME_FX_H__ 31 | 32 | #include "renderer/RenderWorld.h" 33 | 34 | #include "Entity.h" 35 | 36 | /* 37 | =============================================================================== 38 | 39 | Special effects. 40 | 41 | =============================================================================== 42 | */ 43 | 44 | typedef struct { 45 | renderLight_t renderLight; // light presented to the renderer 46 | qhandle_t lightDefHandle; // handle to renderer light def 47 | renderEntity_t renderEntity; // used to present a model to the renderer 48 | int modelDefHandle; // handle to static renderer model 49 | float delay; 50 | int particleSystem; 51 | int start; 52 | bool soundStarted; 53 | bool shakeStarted; 54 | bool decalDropped; 55 | bool launched; 56 | } idFXLocalAction; 57 | 58 | class idEntityFx : public idEntity { 59 | public: 60 | CLASS_PROTOTYPE( idEntityFx ); 61 | 62 | idEntityFx(); 63 | virtual ~idEntityFx(); 64 | 65 | void Spawn( void ); 66 | 67 | void Save( idSaveGame *savefile ) const; 68 | void Restore( idRestoreGame *savefile ); 69 | 70 | virtual void Think(); 71 | void Setup( const char *fx ); 72 | void Run( int time ); 73 | void Start( int time ); 74 | void Stop( void ); 75 | const int Duration( void ); 76 | const char * EffectName( void ); 77 | const char * Joint( void ); 78 | const bool Done(); 79 | 80 | virtual void WriteToSnapshot( idBitMsgDelta &msg ) const; 81 | virtual void ReadFromSnapshot( const idBitMsgDelta &msg ); 82 | virtual void ClientPredictionThink( void ); 83 | 84 | static idEntityFx * StartFx( const char *fx, const idVec3 *useOrigin, const idMat3 *useAxis, idEntity *ent, bool bind ); 85 | 86 | protected: 87 | void Event_Trigger( idEntity *activator ); 88 | void Event_ClearFx( void ); 89 | 90 | void CleanUp( void ); 91 | void CleanUpSingleAction( const idFXSingleAction& fxaction, idFXLocalAction& laction ); 92 | void ApplyFade( const idFXSingleAction& fxaction, idFXLocalAction& laction, const int time, const int actualStart ); 93 | 94 | int started; 95 | int nextTriggerTime; 96 | const idDeclFX * fxEffect; // GetFX() should be called before using fxEffect as a pointer 97 | idList actions; 98 | idStr systemName; 99 | }; 100 | 101 | class idTeleporter : public idEntityFx { 102 | public: 103 | CLASS_PROTOTYPE( idTeleporter ); 104 | 105 | private: 106 | // teleporters to this location 107 | void Event_DoAction( idEntity *activator ); 108 | }; 109 | 110 | #endif /* !__GAME_FX_H__ */ 111 | -------------------------------------------------------------------------------- /game/GameBase.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAMEBASE_H__ 30 | #define __GAMEBASE_H__ 31 | 32 | // default scripts 33 | #define SCRIPT_DEFAULTDEFS "script/doom_defs.script" 34 | #define SCRIPT_DEFAULT "script/doom_main.script" 35 | #define SCRIPT_DEFAULTFUNC "doom_main" 36 | 37 | #define LAGO_IMG_WIDTH 64 38 | #define LAGO_IMG_HEIGHT 64 39 | #define LAGO_WIDTH 64 40 | #define LAGO_HEIGHT 44 41 | #define LAGO_MATERIAL "textures/sfx/lagometer" 42 | #define LAGO_IMAGE "textures/sfx/lagometer.tga" 43 | 44 | // if set to 1 the server sends the client PVS with snapshots and the client compares against what it sees 45 | #ifndef ASYNC_WRITE_PVS 46 | #define ASYNC_WRITE_PVS 0 47 | #endif 48 | 49 | // the "gameversion" client command will print this plus compile date 50 | #define GAME_VERSION "baseDOOM-1" 51 | 52 | #define MAX_CLIENTS 32 53 | #define GENTITYNUM_BITS 12 54 | #define MAX_GENTITIES (1<>5) 62 | 63 | // content masks 64 | #define MASK_ALL (-1) 65 | #define MASK_SOLID (CONTENTS_SOLID) 66 | #define MASK_MONSTERSOLID (CONTENTS_SOLID|CONTENTS_MONSTERCLIP|CONTENTS_BODY) 67 | #define MASK_PLAYERSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_BODY) 68 | #define MASK_DEADSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP) 69 | #define MASK_WATER (CONTENTS_WATER) 70 | #define MASK_OPAQUE (CONTENTS_OPAQUE) 71 | #define MASK_SHOT_RENDERMODEL (CONTENTS_SOLID|CONTENTS_RENDERMODEL) 72 | #define MASK_SHOT_BOUNDINGBOX (CONTENTS_SOLID|CONTENTS_BODY) 73 | 74 | #define DEFAULT_GRAVITY_STRING "1066" 75 | 76 | extern void gameError( const char *fmt, ... ); 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /game/PlayerIcon.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __PLAYERICON_H__ 30 | #define __PLAYERICON_H__ 31 | 32 | typedef enum { 33 | ICON_LAG, 34 | ICON_CHAT, 35 | ICON_NONE 36 | } playerIconType_t; 37 | 38 | class idPlayerIcon { 39 | public: 40 | 41 | public: 42 | idPlayerIcon(); 43 | ~idPlayerIcon(); 44 | 45 | void Draw( idPlayer *player, jointHandle_t joint ); 46 | void Draw( idPlayer *player, const idVec3 &origin ); 47 | 48 | public: 49 | playerIconType_t iconType; 50 | renderEntity_t renderEnt; 51 | qhandle_t iconHandle; 52 | 53 | public: 54 | void FreeIcon( void ); 55 | bool CreateIcon( idPlayer* player, playerIconType_t type, const char *mtr, const idVec3 &origin, const idMat3 &axis ); 56 | bool CreateIcon( idPlayer* player, playerIconType_t type, const idVec3 &origin, const idMat3 &axis ); 57 | void UpdateIcon( idPlayer* player, const idVec3 &origin, const idMat3 &axis ); 58 | 59 | }; 60 | 61 | 62 | #endif /* !_PLAYERICON_H_ */ 63 | -------------------------------------------------------------------------------- /game/SecurityCamera.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAME_SECURITYCAMERA_H__ 30 | #define __GAME_SECURITYCAMERA_H__ 31 | 32 | #include "Entity.h" 33 | 34 | /* 35 | =================================================================================== 36 | 37 | Security camera 38 | 39 | =================================================================================== 40 | */ 41 | 42 | 43 | class idSecurityCamera : public idEntity { 44 | public: 45 | CLASS_PROTOTYPE( idSecurityCamera ); 46 | 47 | void Spawn( void ); 48 | 49 | void Save( idSaveGame *savefile ) const; 50 | void Restore( idRestoreGame *savefile ); 51 | 52 | virtual void Think( void ); 53 | 54 | virtual renderView_t * GetRenderView(); 55 | virtual void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ); 56 | virtual bool Pain( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ); 57 | virtual void Present( void ); 58 | 59 | 60 | private: 61 | 62 | enum { SCANNING, LOSINGINTEREST, ALERT, ACTIVATED }; 63 | 64 | float angle; 65 | float sweepAngle; 66 | int modelAxis; 67 | bool flipAxis; 68 | float scanDist; 69 | float scanFov; 70 | 71 | float sweepStart; 72 | float sweepEnd; 73 | bool negativeSweep; 74 | bool sweeping; 75 | int alertMode; 76 | float stopSweeping; 77 | float scanFovCos; 78 | 79 | idVec3 viewOffset; 80 | 81 | int pvsArea; 82 | idPhysics_RigidBody physicsObj; 83 | idTraceModel trm; 84 | 85 | void StartSweep( void ); 86 | bool CanSeePlayer( void ); 87 | void SetAlertMode( int status ); 88 | void DrawFov( void ); 89 | const idVec3 GetAxis( void ) const; 90 | float SweepSpeed( void ) const; 91 | 92 | void Event_ReverseSweep( void ); 93 | void Event_ContinueSweep( void ); 94 | void Event_Pause( void ); 95 | void Event_Alert( void ); 96 | void Event_AddLight( void ); 97 | }; 98 | 99 | #endif /* !__GAME_SECURITYCAMERA_H__ */ 100 | -------------------------------------------------------------------------------- /game/Sound.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAME_SOUND_H__ 30 | #define __GAME_SOUND_H__ 31 | 32 | #include "Entity.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Generic sound emitter. 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idSound : public idEntity { 43 | public: 44 | CLASS_PROTOTYPE( idSound ); 45 | 46 | idSound( void ); 47 | 48 | void Save( idSaveGame *savefile ) const; 49 | void Restore( idRestoreGame *savefile ); 50 | 51 | virtual void UpdateChangeableSpawnArgs( const idDict *source ); 52 | 53 | void Spawn( void ); 54 | 55 | void ToggleOnOff( idEntity *other, idEntity *activator ); 56 | void Think( void ); 57 | void SetSound( const char *sound, int channel = SND_CHANNEL_ANY ); 58 | 59 | virtual void ShowEditingDialog( void ); 60 | 61 | private: 62 | float lastSoundVol; 63 | float soundVol; 64 | float random; 65 | float wait; 66 | bool timerOn; 67 | idVec3 shakeTranslate; 68 | idAngles shakeRotate; 69 | int playingUntilTime; 70 | 71 | void Event_Trigger( idEntity *activator ); 72 | void Event_Timer( void ); 73 | void Event_On( void ); 74 | void Event_Off( void ); 75 | void DoSound( bool play ); 76 | }; 77 | 78 | #endif /* !__GAME_SOUND_H__ */ 79 | -------------------------------------------------------------------------------- /game/WorldSpawn.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAME_WORLDSPAWN_H__ 30 | #define __GAME_WORLDSPAWN_H__ 31 | 32 | #include "Entity.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | World entity. 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idWorldspawn : public idEntity { 43 | public: 44 | CLASS_PROTOTYPE( idWorldspawn ); 45 | 46 | ~idWorldspawn(); 47 | 48 | void Spawn( void ); 49 | 50 | void Save( idRestoreGame *savefile ); 51 | void Restore( idRestoreGame *savefile ); 52 | 53 | private: 54 | void Event_Remove( void ); 55 | }; 56 | 57 | #endif /* !__GAME_WORLDSPAWN_H__ */ 58 | -------------------------------------------------------------------------------- /game/anim/Anim_Testmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __ANIM_TESTMODEL_H__ 30 | #define __ANIM_TESTMODEL_H__ 31 | 32 | #include "physics/Physics_Parametric.h" 33 | #include "Entity.h" 34 | #include "Actor.h" 35 | 36 | /* 37 | ============================================================================================== 38 | 39 | idTestModel 40 | 41 | ============================================================================================== 42 | */ 43 | 44 | class idTestModel : public idAnimatedEntity { 45 | public: 46 | CLASS_PROTOTYPE( idTestModel ); 47 | 48 | idTestModel(); 49 | ~idTestModel(); 50 | 51 | void Save( idSaveGame *savefile ); 52 | void Restore( idRestoreGame *savefile ); 53 | 54 | void Spawn( void ); 55 | 56 | virtual bool ShouldConstructScriptObjectAtSpawn( void ) const; 57 | 58 | void NextAnim( const idCmdArgs &args ); 59 | void PrevAnim( const idCmdArgs &args ); 60 | void NextFrame( const idCmdArgs &args ); 61 | void PrevFrame( const idCmdArgs &args ); 62 | void TestAnim( const idCmdArgs &args ); 63 | void BlendAnim( const idCmdArgs &args ); 64 | 65 | static void KeepTestModel_f( const idCmdArgs &args ); 66 | static void TestModel_f( const idCmdArgs &args ); 67 | static void ArgCompletion_TestModel( const idCmdArgs &args, void(*callback)( const char *s ) ); 68 | static void TestSkin_f( const idCmdArgs &args ); 69 | static void TestShaderParm_f( const idCmdArgs &args ); 70 | static void TestParticleStopTime_f( const idCmdArgs &args ); 71 | static void TestAnim_f( const idCmdArgs &args ); 72 | static void ArgCompletion_TestAnim( const idCmdArgs &args, void(*callback)( const char *s ) ); 73 | static void TestBlend_f( const idCmdArgs &args ); 74 | static void TestModelNextAnim_f( const idCmdArgs &args ); 75 | static void TestModelPrevAnim_f( const idCmdArgs &args ); 76 | static void TestModelNextFrame_f( const idCmdArgs &args ); 77 | static void TestModelPrevFrame_f( const idCmdArgs &args ); 78 | 79 | private: 80 | idEntityPtr head; 81 | idAnimator *headAnimator; 82 | idAnim customAnim; 83 | idPhysics_Parametric physicsObj; 84 | idStr animname; 85 | int anim; 86 | int headAnim; 87 | int mode; 88 | int frame; 89 | int starttime; 90 | int animtime; 91 | 92 | idList copyJoints; 93 | 94 | virtual void Think( void ); 95 | 96 | void Event_Footstep( void ); 97 | }; 98 | 99 | #endif /* !__ANIM_TESTMODEL_H__*/ 100 | -------------------------------------------------------------------------------- /game/gamesys/DebugGraph.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | #include "Player.h" 31 | #include "Game_local.h" 32 | 33 | #include "DebugGraph.h" 34 | 35 | /* 36 | ================ 37 | idDebugGraph::idDebugGraph 38 | ================ 39 | */ 40 | idDebugGraph::idDebugGraph() { 41 | index = 0; 42 | } 43 | 44 | /* 45 | ================ 46 | idDebugGraph::SetNumSamples 47 | ================ 48 | */ 49 | void idDebugGraph::SetNumSamples( int num ) { 50 | index = 0; 51 | samples.Clear(); 52 | samples.SetNum( num ); 53 | memset( samples.Ptr(), 0, samples.MemoryUsed() ); 54 | } 55 | 56 | /* 57 | ================ 58 | idDebugGraph::AddValue 59 | ================ 60 | */ 61 | void idDebugGraph::AddValue( float value ) { 62 | samples[ index ] = value; 63 | index++; 64 | if ( index >= samples.Num() ) { 65 | index = 0; 66 | } 67 | } 68 | 69 | /* 70 | ================ 71 | idDebugGraph::Draw 72 | ================ 73 | */ 74 | void idDebugGraph::Draw( const idVec4 &color, float scale ) const { 75 | int i; 76 | float value1; 77 | float value2; 78 | idVec3 vec1; 79 | idVec3 vec2; 80 | 81 | const idMat3 &axis = gameLocal.GetLocalPlayer()->viewAxis; 82 | const idVec3 pos = gameLocal.GetLocalPlayer()->GetPhysics()->GetOrigin() + axis[ 1 ] * samples.Num() * 0.5f; 83 | 84 | value1 = samples[ index ] * scale; 85 | for( i = 1; i < samples.Num(); i++ ) { 86 | value2 = samples[ ( i + index ) % samples.Num() ] * scale; 87 | 88 | vec1 = pos + axis[ 2 ] * value1 - axis[ 1 ] * ( i - 1 ) + axis[ 0 ] * samples.Num(); 89 | vec2 = pos + axis[ 2 ] * value2 - axis[ 1 ] * i + axis[ 0 ] * samples.Num(); 90 | 91 | gameRenderWorld->DebugLine( color, vec1, vec2, gameLocal.msec, false ); 92 | value1 = value2; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /game/gamesys/DebugGraph.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __DEBUGGRAPH_H__ 30 | #define __DEBUGGRAPH_H__ 31 | 32 | #include "idlib/containers/List.h" 33 | #include "idlib/math/Vector.h" 34 | 35 | class idDebugGraph { 36 | public: 37 | idDebugGraph(); 38 | void SetNumSamples( int num ); 39 | void AddValue( float value ); 40 | void Draw( const idVec4 &color, float scale ) const; 41 | 42 | private: 43 | idList samples; 44 | int index; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /game/gamesys/NoGameTypeInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAMETYPEINFO_H__ 30 | #define __GAMETYPEINFO_H__ 31 | 32 | /* 33 | =================================================================================== 34 | 35 | This file has been generated with the Type Info Generator v1.0 (c) 2004 id Software 36 | 37 | =================================================================================== 38 | */ 39 | 40 | typedef struct { 41 | const char * name; 42 | const char * type; 43 | const char * value; 44 | } constantInfo_t; 45 | 46 | typedef struct { 47 | const char * name; 48 | int value; 49 | } enumValueInfo_t; 50 | 51 | typedef struct { 52 | const char * typeName; 53 | const enumValueInfo_t * values; 54 | } enumTypeInfo_t; 55 | 56 | typedef struct { 57 | const char * type; 58 | const char * name; 59 | int offset; 60 | int size; 61 | } classVariableInfo_t; 62 | 63 | typedef struct { 64 | const char * typeName; 65 | const char * superType; 66 | int size; 67 | const classVariableInfo_t * variables; 68 | } classTypeInfo_t; 69 | 70 | 71 | static enumTypeInfo_t enumTypeInfo[] = { 72 | { NULL, NULL } 73 | }; 74 | 75 | static classTypeInfo_t classTypeInfo[] = { 76 | { NULL, NULL, 0, NULL } 77 | }; 78 | 79 | #endif /* !__GAMETYPEINFO_H__ */ 80 | -------------------------------------------------------------------------------- /game/gamesys/SysCmds.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __SYS_CMDS_H__ 30 | #define __SYS_CMDS_H__ 31 | 32 | void D_DrawDebugLines( void ); 33 | 34 | #endif /* !__SYS_CMDS_H__ */ 35 | -------------------------------------------------------------------------------- /game/gamesys/TypeInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __SYS_TYPEINFO_H__ 30 | #define __SYS_TYPEINFO_H__ 31 | 32 | #include "idlib/CmdArgs.h" 33 | 34 | class idFile; 35 | 36 | /* 37 | =================================================================================== 38 | 39 | Game Type Info 40 | 41 | =================================================================================== 42 | */ 43 | 44 | const char * GetTypeVariableName( const char *typeName, int offset ); 45 | 46 | void PrintType( const void *typePtr, const char *typeName ); 47 | void WriteTypeToFile( idFile *fp, const void *typePtr, const char *typeName ); 48 | void InitTypeVariables( const void *typePtr, const char *typeName, int value ); 49 | 50 | void ListTypeInfo_f( const idCmdArgs &args ); 51 | 52 | void WriteGameState_f( const idCmdArgs &args ); 53 | void CompareGameState_f( const idCmdArgs &args ); 54 | void TestSaveGame_f( const idCmdArgs &args ); 55 | 56 | #endif /* !__SYS_TYPEINFO_H__ */ 57 | -------------------------------------------------------------------------------- /game/physics/Force.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | 31 | #include "physics/Force.h" 32 | 33 | CLASS_DECLARATION( idClass, idForce ) 34 | END_CLASS 35 | 36 | idList idForce::forceList; 37 | 38 | /* 39 | ================ 40 | idForce::idForce 41 | ================ 42 | */ 43 | idForce::idForce( void ) { 44 | forceList.Append( this ); 45 | } 46 | 47 | /* 48 | ================ 49 | idForce::~idForce 50 | ================ 51 | */ 52 | idForce::~idForce( void ) { 53 | forceList.Remove( this ); 54 | } 55 | 56 | /* 57 | ================ 58 | idForce::DeletePhysics 59 | ================ 60 | */ 61 | void idForce::DeletePhysics( const idPhysics *phys ) { 62 | int i; 63 | 64 | for ( i = 0; i < forceList.Num(); i++ ) { 65 | forceList[i]->RemovePhysics( phys ); 66 | } 67 | } 68 | 69 | /* 70 | ================ 71 | idForce::ClearForceList 72 | ================ 73 | */ 74 | void idForce::ClearForceList( void ) { 75 | forceList.Clear(); 76 | } 77 | 78 | /* 79 | ================ 80 | idForce::Evaluate 81 | ================ 82 | */ 83 | void idForce::Evaluate( int time ) { 84 | } 85 | 86 | /* 87 | ================ 88 | idForce::RemovePhysics 89 | ================ 90 | */ 91 | void idForce::RemovePhysics( const idPhysics *phys ) { 92 | } 93 | -------------------------------------------------------------------------------- /game/physics/Force.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __FORCE_H__ 30 | #define __FORCE_H__ 31 | 32 | #include "gamesys/Class.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Force base class 38 | 39 | A force object applies a force to a physics object. 40 | 41 | =============================================================================== 42 | */ 43 | 44 | class idEntity; 45 | class idPhysics; 46 | 47 | class idForce : public idClass { 48 | 49 | public: 50 | CLASS_PROTOTYPE( idForce ); 51 | 52 | idForce( void ); 53 | virtual ~idForce( void ); 54 | static void DeletePhysics( const idPhysics *phys ); 55 | static void ClearForceList( void ); 56 | 57 | public: // common force interface 58 | // evalulate the force up to the given time 59 | virtual void Evaluate( int time ); 60 | // removes any pointers to the physics object 61 | virtual void RemovePhysics( const idPhysics *phys ); 62 | 63 | private: 64 | 65 | static idList forceList; 66 | }; 67 | 68 | #endif /* !__FORCE_H__ */ 69 | -------------------------------------------------------------------------------- /game/physics/Force_Constant.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | #include "physics/Physics.h" 31 | #include "gamesys/SaveGame.h" 32 | 33 | #include "physics/Force_Constant.h" 34 | 35 | CLASS_DECLARATION( idForce, idForce_Constant ) 36 | END_CLASS 37 | 38 | /* 39 | ================ 40 | idForce_Constant::idForce_Constant 41 | ================ 42 | */ 43 | idForce_Constant::idForce_Constant( void ) { 44 | force = vec3_zero; 45 | physics = NULL; 46 | id = 0; 47 | point = vec3_zero; 48 | } 49 | 50 | /* 51 | ================ 52 | idForce_Constant::~idForce_Constant 53 | ================ 54 | */ 55 | idForce_Constant::~idForce_Constant( void ) { 56 | } 57 | 58 | /* 59 | ================ 60 | idForce_Constant::Save 61 | ================ 62 | */ 63 | void idForce_Constant::Save( idSaveGame *savefile ) const { 64 | savefile->WriteVec3( force ); 65 | savefile->WriteInt( id ); 66 | savefile->WriteVec3( point ); 67 | } 68 | 69 | /* 70 | ================ 71 | idForce_Constant::Restore 72 | ================ 73 | */ 74 | void idForce_Constant::Restore( idRestoreGame *savefile ) { 75 | // Owner needs to call SetPhysics!! 76 | savefile->ReadVec3( force ); 77 | savefile->ReadInt( id ); 78 | savefile->ReadVec3( point ); 79 | } 80 | 81 | /* 82 | ================ 83 | idForce_Constant::SetPosition 84 | ================ 85 | */ 86 | void idForce_Constant::SetPosition( idPhysics *physics, int id, const idVec3 &point ) { 87 | this->physics = physics; 88 | this->id = id; 89 | this->point = point; 90 | } 91 | 92 | /* 93 | ================ 94 | idForce_Constant::SetForce 95 | ================ 96 | */ 97 | void idForce_Constant::SetForce( const idVec3 &force ) { 98 | this->force = force; 99 | } 100 | 101 | /* 102 | ================ 103 | idForce_Constant::SetPhysics 104 | ================ 105 | */ 106 | void idForce_Constant::SetPhysics( idPhysics *physics ) { 107 | this->physics = physics; 108 | } 109 | 110 | /* 111 | ================ 112 | idForce_Constant::Evaluate 113 | ================ 114 | */ 115 | void idForce_Constant::Evaluate( int time ) { 116 | idVec3 p; 117 | 118 | if ( !physics ) { 119 | return; 120 | } 121 | 122 | p = physics->GetOrigin( id ) + point * physics->GetAxis( id ); 123 | 124 | physics->AddForce( id, p, force ); 125 | } 126 | 127 | /* 128 | ================ 129 | idForce_Constant::RemovePhysics 130 | ================ 131 | */ 132 | void idForce_Constant::RemovePhysics( const idPhysics *phys ) { 133 | if ( physics == phys ) { 134 | physics = NULL; 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /game/physics/Force_Constant.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __FORCE_CONSTANT_H__ 30 | #define __FORCE_CONSTANT_H__ 31 | 32 | #include "physics/Force.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Constant force 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idForce_Constant : public idForce { 43 | 44 | public: 45 | CLASS_PROTOTYPE( idForce_Constant ); 46 | 47 | idForce_Constant( void ); 48 | virtual ~idForce_Constant( void ); 49 | 50 | 51 | void Save( idSaveGame *savefile ) const; 52 | void Restore( idRestoreGame *savefile ); 53 | 54 | // constant force 55 | void SetForce( const idVec3 &force ); 56 | // set force position 57 | void SetPosition( idPhysics *physics, int id, const idVec3 &point ); 58 | 59 | void SetPhysics( idPhysics *physics ); 60 | 61 | public: // common force interface 62 | virtual void Evaluate( int time ); 63 | virtual void RemovePhysics( const idPhysics *phys ); 64 | 65 | private: 66 | // force properties 67 | idVec3 force; 68 | idPhysics * physics; 69 | int id; 70 | idVec3 point; 71 | }; 72 | 73 | #endif /* !__FORCE_CONSTANT_H__ */ 74 | -------------------------------------------------------------------------------- /game/physics/Force_Drag.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __FORCE_DRAG_H__ 30 | #define __FORCE_DRAG_H__ 31 | 32 | #include "physics/Force.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Drag force 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idForce_Drag : public idForce { 43 | 44 | public: 45 | CLASS_PROTOTYPE( idForce_Drag ); 46 | 47 | idForce_Drag( void ); 48 | virtual ~idForce_Drag( void ); 49 | // initialize the drag force 50 | void Init( float damping ); 51 | // set physics object being dragged 52 | void SetPhysics( idPhysics *physics, int id, const idVec3 &p ); 53 | // set position to drag towards 54 | void SetDragPosition( const idVec3 &pos ); 55 | // get the position dragged towards 56 | const idVec3 & GetDragPosition( void ) const; 57 | // get the position on the dragged physics object 58 | const idVec3 GetDraggedPosition( void ) const; 59 | 60 | public: // common force interface 61 | virtual void Evaluate( int time ); 62 | virtual void RemovePhysics( const idPhysics *phys ); 63 | 64 | private: 65 | 66 | // properties 67 | float damping; 68 | 69 | // positioning 70 | idPhysics * physics; // physics object 71 | int id; // clip model id of physics object 72 | idVec3 p; // position on clip model 73 | idVec3 dragPosition; // drag towards this position 74 | }; 75 | 76 | #endif /* !__FORCE_DRAG_H__ */ 77 | -------------------------------------------------------------------------------- /game/physics/Force_Field.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __FORCE_FIELD_H__ 30 | #define __FORCE_FIELD_H__ 31 | 32 | #include "physics/Force.h" 33 | #include "physics/Clip.h" 34 | #include "Entity.h" 35 | #include "AFEntity.h" 36 | 37 | /* 38 | =============================================================================== 39 | 40 | Force field 41 | 42 | =============================================================================== 43 | */ 44 | 45 | enum forceFieldType { 46 | FORCEFIELD_UNIFORM, 47 | FORCEFIELD_EXPLOSION, 48 | FORCEFIELD_IMPLOSION 49 | }; 50 | 51 | enum forceFieldApplyType { 52 | FORCEFIELD_APPLY_FORCE, 53 | FORCEFIELD_APPLY_VELOCITY, 54 | FORCEFIELD_APPLY_IMPULSE 55 | }; 56 | 57 | class idForce_Field : public idForce { 58 | 59 | public: 60 | CLASS_PROTOTYPE( idForce_Field ); 61 | 62 | void Save( idSaveGame *savefile ) const; 63 | void Restore( idRestoreGame *savefile ); 64 | 65 | idForce_Field( void ); 66 | virtual ~idForce_Field( void ); 67 | // uniform constant force 68 | void Uniform( const idVec3 &force ); 69 | // explosion from clip model origin 70 | void Explosion( float force ); 71 | // implosion towards clip model origin 72 | void Implosion( float force ); 73 | // add random torque 74 | void RandomTorque( float force ); 75 | // should the force field apply a force, velocity or impulse 76 | void SetApplyType( const forceFieldApplyType type ) { applyType = type; } 77 | // make the force field only push players 78 | void SetPlayerOnly( bool set ) { playerOnly = set; } 79 | // make the force field only push monsters 80 | void SetMonsterOnly( bool set ) { monsterOnly = set; } 81 | // clip model describing the extents of the force field 82 | void SetClipModel( idClipModel *clipModel ); 83 | 84 | public: // common force interface 85 | virtual void Evaluate( int time ); 86 | 87 | private: 88 | // force properties 89 | forceFieldType type; 90 | forceFieldApplyType applyType; 91 | float magnitude; 92 | idVec3 dir; 93 | float randomTorque; 94 | bool playerOnly; 95 | bool monsterOnly; 96 | idClipModel * clipModel; 97 | }; 98 | 99 | #endif /* !__FORCE_FIELD_H__ */ 100 | -------------------------------------------------------------------------------- /game/physics/Force_Spring.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __FORCE_SPRING_H__ 30 | #define __FORCE_SPRING_H__ 31 | 32 | #include "physics/Force.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Spring force 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idForce_Spring : public idForce { 43 | 44 | public: 45 | CLASS_PROTOTYPE( idForce_Spring ); 46 | 47 | idForce_Spring( void ); 48 | virtual ~idForce_Spring( void ); 49 | // initialize the spring 50 | void InitSpring( float Kstretch, float Kcompress, float damping, float restLength ); 51 | // set the entities and positions on these entities the spring is attached to 52 | void SetPosition( idPhysics *physics1, int id1, const idVec3 &p1, 53 | idPhysics *physics2, int id2, const idVec3 &p2 ); 54 | 55 | public: // common force interface 56 | virtual void Evaluate( int time ); 57 | virtual void RemovePhysics( const idPhysics *phys ); 58 | 59 | private: 60 | 61 | // spring properties 62 | float Kstretch; 63 | float Kcompress; 64 | float damping; 65 | float restLength; 66 | 67 | // positioning 68 | idPhysics * physics1; // first physics object 69 | int id1; // clip model id of first physics object 70 | idVec3 p1; // position on clip model 71 | idPhysics * physics2; // second physics object 72 | int id2; // clip model id of second physics object 73 | idVec3 p2; // position on clip model 74 | 75 | }; 76 | 77 | #endif /* !__FORCE_SPRING_H__ */ 78 | -------------------------------------------------------------------------------- /game/physics/Physics.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | #include "Game_local.h" 31 | 32 | #include "physics/Physics.h" 33 | 34 | ABSTRACT_DECLARATION( idClass, idPhysics ) 35 | END_CLASS 36 | 37 | 38 | /* 39 | ================ 40 | idPhysics::~idPhysics 41 | ================ 42 | */ 43 | idPhysics::~idPhysics( void ) { 44 | } 45 | 46 | /* 47 | ================ 48 | idPhysics::Save 49 | ================ 50 | */ 51 | void idPhysics::Save( idSaveGame *savefile ) const { 52 | } 53 | 54 | /* 55 | ================ 56 | idPhysics::Restore 57 | ================ 58 | */ 59 | void idPhysics::Restore( idRestoreGame *savefile ) { 60 | } 61 | 62 | /* 63 | ================ 64 | idPhysics::SetClipBox 65 | ================ 66 | */ 67 | void idPhysics::SetClipBox( const idBounds &bounds, float density ) { 68 | SetClipModel( new idClipModel( idTraceModel( bounds ) ), density ); 69 | } 70 | 71 | /* 72 | ================ 73 | idPhysics::SnapTimeToPhysicsFrame 74 | ================ 75 | */ 76 | int idPhysics::SnapTimeToPhysicsFrame( int t ) { 77 | int s; 78 | s = t + USERCMD_MSEC - 1; 79 | return ( s - s % USERCMD_MSEC ); 80 | } 81 | -------------------------------------------------------------------------------- /idlib/Base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __BASE64_H__ 30 | #define __BASE64_H__ 31 | 32 | #include "idlib/Str.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | base64 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idBase64 { 43 | public: 44 | idBase64( void ); 45 | idBase64( const idStr &s ); 46 | ~idBase64( void ); 47 | 48 | void Encode( const byte *from, int size ); 49 | void Encode( const idStr &src ); 50 | int DecodeLength( void ) const; // minimum size in bytes of destination buffer for decoding 51 | int Decode( byte *to ) const; // does not append a \0 - needs a DecodeLength() bytes buffer 52 | void Decode( idStr &dest ) const; // decodes the binary content to an idStr (a bit dodgy, \0 and other non-ascii are possible in the decoded content) 53 | void Decode( idFile *dest ) const; 54 | 55 | const char *c_str() const; 56 | 57 | void operator=( const idStr &s ); 58 | 59 | private: 60 | byte * data; 61 | int len; 62 | int alloced; 63 | 64 | void Init( void ); 65 | void Release( void ); 66 | void EnsureAlloced( int size ); 67 | }; 68 | 69 | ID_INLINE idBase64::idBase64( void ) { 70 | Init(); 71 | } 72 | 73 | ID_INLINE idBase64::idBase64( const idStr &s ) { 74 | Init(); 75 | *this = s; 76 | } 77 | 78 | ID_INLINE idBase64::~idBase64( void ) { 79 | Release(); 80 | } 81 | 82 | ID_INLINE const char *idBase64::c_str( void ) const { 83 | return (const char *)data; 84 | } 85 | 86 | ID_INLINE void idBase64::Init( void ) { 87 | len = 0; 88 | alloced = 0; 89 | data = NULL; 90 | } 91 | 92 | ID_INLINE void idBase64::Release( void ) { 93 | if ( data ) { 94 | delete[] data; 95 | } 96 | Init(); 97 | } 98 | 99 | ID_INLINE void idBase64::EnsureAlloced( int size ) { 100 | if ( size > alloced ) { 101 | Release(); 102 | } 103 | data = new byte[size]; 104 | alloced = size; 105 | } 106 | 107 | ID_INLINE void idBase64::operator=( const idStr &s ) { 108 | EnsureAlloced( s.Length()+1 ); // trailing \0 - beware, this does a Release 109 | strcpy( (char *)data, s.c_str() ); 110 | len = s.Length(); 111 | } 112 | 113 | #endif /* !__BASE64_H__ */ 114 | -------------------------------------------------------------------------------- /idlib/CmdArgs.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __CMDARGS_H__ 30 | #define __CMDARGS_H__ 31 | 32 | /* 33 | =============================================================================== 34 | 35 | Command arguments. 36 | 37 | =============================================================================== 38 | */ 39 | 40 | class idCmdArgs { 41 | public: 42 | idCmdArgs( void ) { argc = 0; } 43 | idCmdArgs( const char *text, bool keepAsStrings ) { TokenizeString( text, keepAsStrings ); } 44 | 45 | void operator=( const idCmdArgs &args ); 46 | 47 | // The functions that execute commands get their parameters with these functions. 48 | int Argc( void ) const { return argc; } 49 | // Argv() will return an empty string, not NULL if arg >= argc. 50 | const char * Argv( int arg ) const { return ( arg >= 0 && arg < argc ) ? argv[arg] : ""; } 51 | // Returns a single string containing argv(start) to argv(end) 52 | // escapeArgs is a fugly way to put the string back into a state ready to tokenize again 53 | const char * Args( int start = 1, int end = -1, bool escapeArgs = false ) const; 54 | 55 | // Takes a null terminated string and breaks the string up into arg tokens. 56 | // Does not need to be /n terminated. 57 | // Set keepAsStrings to true to only seperate tokens from whitespace and comments, ignoring punctuation 58 | void TokenizeString( const char *text, bool keepAsStrings ); 59 | 60 | void AppendArg( const char *text ); 61 | void Clear( void ) { argc = 0; } 62 | const char ** GetArgs( int *argc ); 63 | 64 | private: 65 | static const int MAX_COMMAND_ARGS = 64; 66 | static const int MAX_COMMAND_STRING = 2 * MAX_STRING_CHARS; 67 | 68 | int argc; // number of arguments 69 | char * argv[MAX_COMMAND_ARGS]; // points into tokenized 70 | char tokenized[MAX_COMMAND_STRING]; // will have 0 bytes inserted 71 | }; 72 | 73 | #endif /* !__CMDARGS_H__ */ 74 | -------------------------------------------------------------------------------- /idlib/LangDict.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __LANGDICT_H__ 30 | #define __LANGDICT_H__ 31 | 32 | #include "idlib/containers/List.h" 33 | #include "idlib/containers/HashIndex.h" 34 | #include "idlib/Str.h" 35 | 36 | /* 37 | =============================================================================== 38 | 39 | Simple dictionary specifically for the localized string tables. 40 | 41 | =============================================================================== 42 | */ 43 | 44 | class idLangKeyValue { 45 | public: 46 | idStr key; 47 | idStr value; 48 | }; 49 | 50 | class idLangDict { 51 | public: 52 | idLangDict( void ); 53 | ~idLangDict( void ); 54 | 55 | void Clear( void ); 56 | bool Load( const char *fileName, bool clear = true ); 57 | void Save( const char *fileName ); 58 | 59 | const char * AddString( const char *str ); 60 | const char * GetString( const char *str ) const; 61 | 62 | // adds the value and key as passed (doesn't generate a "#str_xxxxx" key or ensure the key/value pair is unique) 63 | void AddKeyVal( const char *key, const char *val ); 64 | 65 | int GetNumKeyVals( void ) const; 66 | const idLangKeyValue * GetKeyVal( int i ) const; 67 | 68 | void SetBaseID(int id) { baseID = id; }; 69 | 70 | private: 71 | idList args; 72 | idHashIndex hash; 73 | 74 | bool ExcludeString( const char *str ) const; 75 | int GetNextId( void ) const; 76 | int GetHashKey( const char *str ) const; 77 | 78 | int baseID; 79 | }; 80 | 81 | #endif /* !__LANGDICT_H__ */ 82 | -------------------------------------------------------------------------------- /idlib/Timer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | #include "idlib/Lib.h" 31 | #include "framework/Common.h" 32 | 33 | #include "idlib/Timer.h" 34 | 35 | /* 36 | ================= 37 | idTimerReport::idTimerReport 38 | ================= 39 | */ 40 | idTimerReport::idTimerReport() { 41 | } 42 | 43 | /* 44 | ================= 45 | idTimerReport::SetReportName 46 | ================= 47 | */ 48 | void idTimerReport::SetReportName( const char *name ) { 49 | reportName = ( name ) ? name : "Timer Report"; 50 | } 51 | 52 | /* 53 | ================= 54 | idTimerReport::~idTimerReport 55 | ================= 56 | */ 57 | idTimerReport::~idTimerReport() { 58 | Clear(); 59 | } 60 | 61 | /* 62 | ================= 63 | idTimerReport::AddReport 64 | ================= 65 | */ 66 | int idTimerReport::AddReport( const char *name ) { 67 | if ( name && *name ) { 68 | names.Append( name ); 69 | return timers.Append( new idTimer() ); 70 | } 71 | return -1; 72 | } 73 | 74 | /* 75 | ================= 76 | idTimerReport::Clear 77 | ================= 78 | */ 79 | void idTimerReport::Clear() { 80 | timers.DeleteContents( true ); 81 | names.Clear(); 82 | reportName.Clear(); 83 | } 84 | 85 | /* 86 | ================= 87 | idTimerReport::Reset 88 | ================= 89 | */ 90 | void idTimerReport::Reset() { 91 | assert ( timers.Num() == names.Num() ); 92 | for ( int i = 0; i < timers.Num(); i++ ) { 93 | timers[i]->Clear(); 94 | } 95 | } 96 | 97 | /* 98 | ================= 99 | idTimerReport::AddTime 100 | ================= 101 | */ 102 | void idTimerReport::AddTime( const char *name, idTimer *time ) { 103 | assert ( timers.Num() == names.Num() ); 104 | int i; 105 | for ( i = 0; i < names.Num(); i++ ) { 106 | if ( names[i].Icmp( name ) == 0 ) { 107 | *timers[i] += *time; 108 | break; 109 | } 110 | } 111 | if ( i == names.Num() ) { 112 | int index = AddReport( name ); 113 | if ( index >= 0 ) { 114 | timers[index]->Clear(); 115 | *timers[index] += *time; 116 | } 117 | } 118 | } 119 | 120 | /* 121 | ================= 122 | idTimerReport::PrintReport 123 | ================= 124 | */ 125 | void idTimerReport::PrintReport() { 126 | assert( timers.Num() == names.Num() ); 127 | idLib::common->Printf( "Timing Report for %s\n", reportName.c_str() ); 128 | idLib::common->Printf( "-------------------------------\n" ); 129 | unsigned int total = 0; 130 | for ( int i = 0; i < names.Num(); i++ ) { 131 | idLib::common->Printf( "%s consumed %5.2f seconds\n", names[i].c_str(), 0.001f * timers[i]->Milliseconds() ); 132 | total += timers[i]->Milliseconds(); 133 | } 134 | idLib::common->Printf( "Total time for report %s was %5.2f\n\n", reportName.c_str(), 0.001f * total ); 135 | } 136 | -------------------------------------------------------------------------------- /idlib/containers/PlaneSet.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __PLANESET_H__ 30 | #define __PLANESET_H__ 31 | 32 | #include "idlib/containers/List.h" 33 | #include "idlib/containers/HashIndex.h" 34 | #include "idlib/math/Plane.h" 35 | 36 | /* 37 | =============================================================================== 38 | 39 | Plane Set 40 | 41 | =============================================================================== 42 | */ 43 | 44 | class idPlaneSet : public idList { 45 | public: 46 | 47 | void Clear( void ) { idList::Clear(); hash.Free(); } 48 | 49 | int FindPlane( const idPlane &plane, const float normalEps, const float distEps ); 50 | 51 | private: 52 | idHashIndex hash; 53 | }; 54 | 55 | ID_INLINE int idPlaneSet::FindPlane( const idPlane &plane, const float normalEps, const float distEps ) { 56 | int i, border, hashKey; 57 | 58 | assert( distEps <= 0.125f ); 59 | 60 | hashKey = (int)( idMath::Fabs( plane.Dist() ) * 0.125f ); 61 | for ( border = -1; border <= 1; border++ ) { 62 | for ( i = hash.First( hashKey + border ); i >= 0; i = hash.Next( i ) ) { 63 | if ( (*this)[i].Compare( plane, normalEps, distEps ) ) { 64 | return i; 65 | } 66 | } 67 | } 68 | 69 | if ( plane.Type() >= PLANETYPE_NEGX && plane.Type() < PLANETYPE_TRUEAXIAL ) { 70 | Append( -plane ); 71 | hash.Add( hashKey, Num()-1 ); 72 | Append( plane ); 73 | hash.Add( hashKey, Num()-1 ); 74 | return ( Num() - 1 ); 75 | } 76 | else { 77 | Append( plane ); 78 | hash.Add( hashKey, Num()-1 ); 79 | Append( -plane ); 80 | hash.Add( hashKey, Num()-1 ); 81 | return ( Num() - 2 ); 82 | } 83 | } 84 | 85 | #endif /* !__PLANESET_H__ */ 86 | -------------------------------------------------------------------------------- /idlib/containers/Queue.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __QUEUE_H__ 30 | #define __QUEUE_H__ 31 | 32 | /* 33 | =============================================================================== 34 | 35 | Queue template 36 | 37 | =============================================================================== 38 | */ 39 | 40 | #define idQueue( type, next ) idQueueTemplatenext)> 41 | 42 | template< class type, int nextOffset > 43 | class idQueueTemplate { 44 | public: 45 | idQueueTemplate( void ); 46 | 47 | void Add( type *element ); 48 | type * Get( void ); 49 | 50 | private: 51 | type * first; 52 | type * last; 53 | }; 54 | 55 | #define QUEUE_NEXT_PTR( element ) (*((type**)(((byte*)element)+nextOffset))) 56 | 57 | template< class type, int nextOffset > 58 | idQueueTemplate::idQueueTemplate( void ) { 59 | first = last = NULL; 60 | } 61 | 62 | template< class type, int nextOffset > 63 | void idQueueTemplate::Add( type *element ) { 64 | QUEUE_NEXT_PTR(element) = NULL; 65 | if ( last ) { 66 | QUEUE_NEXT_PTR(last) = element; 67 | } else { 68 | first = element; 69 | } 70 | last = element; 71 | } 72 | 73 | template< class type, int nextOffset > 74 | type *idQueueTemplate::Get( void ) { 75 | type *element; 76 | 77 | element = first; 78 | if ( element ) { 79 | first = QUEUE_NEXT_PTR(first); 80 | if ( last == element ) { 81 | last = NULL; 82 | } 83 | QUEUE_NEXT_PTR(element) = NULL; 84 | } 85 | return element; 86 | } 87 | 88 | #endif /* !__QUEUE_H__ */ 89 | -------------------------------------------------------------------------------- /idlib/containers/Stack.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __STACK_H__ 30 | #define __STACK_H__ 31 | 32 | /* 33 | =============================================================================== 34 | 35 | Stack template 36 | 37 | =============================================================================== 38 | */ 39 | 40 | #define idStack( type, next ) idStackTemplatenext)> 41 | 42 | template< class type, int nextOffset > 43 | class idStackTemplate { 44 | public: 45 | idStackTemplate( void ); 46 | 47 | void Add( type *element ); 48 | type * Get( void ); 49 | 50 | private: 51 | type * top; 52 | type * bottom; 53 | }; 54 | 55 | #define STACK_NEXT_PTR( element ) (*(type**)(((byte*)element)+nextOffset)) 56 | 57 | template< class type, int nextOffset > 58 | idStackTemplate::idStackTemplate( void ) { 59 | top = bottom = NULL; 60 | } 61 | 62 | template< class type, int nextOffset > 63 | void idStackTemplate::Add( type *element ) { 64 | STACK_NEXT_PTR(element) = top; 65 | top = element; 66 | if ( !bottom ) { 67 | bottom = element; 68 | } 69 | } 70 | 71 | template< class type, int nextOffset > 72 | type *idStackTemplate::Get( void ) { 73 | type *element; 74 | 75 | element = top; 76 | if ( element ) { 77 | top = STACK_NEXT_PTR(top); 78 | if ( bottom == element ) { 79 | bottom = NULL; 80 | } 81 | STACK_NEXT_PTR(element) = NULL; 82 | } 83 | return element; 84 | } 85 | 86 | #endif /* !__STACK_H__ */ 87 | -------------------------------------------------------------------------------- /idlib/geometry/DrawVert.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | 31 | #include "idlib/geometry/DrawVert.h" 32 | 33 | /* 34 | ============= 35 | idDrawVert::Normalize 36 | ============= 37 | */ 38 | void idDrawVert::Normalize( void ) { 39 | normal.Normalize(); 40 | tangents[1].Cross( normal, tangents[0] ); 41 | tangents[1].Normalize(); 42 | tangents[0].Cross( tangents[1], normal ); 43 | tangents[0].Normalize(); 44 | } 45 | -------------------------------------------------------------------------------- /idlib/geometry/DrawVert.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __DRAWVERT_H__ 30 | #define __DRAWVERT_H__ 31 | 32 | #include "idlib/math/Vector.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Draw Vertex. 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idDrawVert { 43 | public: 44 | idVec3 xyz; 45 | idVec2 st; 46 | idVec3 normal; 47 | idVec3 tangents[2]; 48 | byte color[4]; 49 | #if 0 // was MACOS_X see comments concerning DRAWVERT_PADDED in Simd_Altivec.h 50 | float padding; 51 | #endif 52 | float operator[]( const int index ) const; 53 | float & operator[]( const int index ); 54 | 55 | void Clear( void ); 56 | 57 | void Lerp( const idDrawVert &a, const idDrawVert &b, const float f ); 58 | void LerpAll( const idDrawVert &a, const idDrawVert &b, const float f ); 59 | 60 | void Normalize( void ); 61 | 62 | void SetColor( dword color ); 63 | dword GetColor( void ) const; 64 | }; 65 | 66 | ID_INLINE float idDrawVert::operator[]( const int index ) const { 67 | assert( index >= 0 && index < 5 ); 68 | return ((float *)(&xyz))[index]; 69 | } 70 | ID_INLINE float &idDrawVert::operator[]( const int index ) { 71 | assert( index >= 0 && index < 5 ); 72 | return ((float *)(&xyz))[index]; 73 | } 74 | 75 | ID_INLINE void idDrawVert::Clear( void ) { 76 | xyz.Zero(); 77 | st.Zero(); 78 | normal.Zero(); 79 | tangents[0].Zero(); 80 | tangents[1].Zero(); 81 | color[0] = color[1] = color[2] = color[3] = 0; 82 | } 83 | 84 | ID_INLINE void idDrawVert::Lerp( const idDrawVert &a, const idDrawVert &b, const float f ) { 85 | xyz = a.xyz + f * ( b.xyz - a.xyz ); 86 | st = a.st + f * ( b.st - a.st ); 87 | } 88 | 89 | ID_INLINE void idDrawVert::LerpAll( const idDrawVert &a, const idDrawVert &b, const float f ) { 90 | xyz = a.xyz + f * ( b.xyz - a.xyz ); 91 | st = a.st + f * ( b.st - a.st ); 92 | normal = a.normal + f * ( b.normal - a.normal ); 93 | tangents[0] = a.tangents[0] + f * ( b.tangents[0] - a.tangents[0] ); 94 | tangents[1] = a.tangents[1] + f * ( b.tangents[1] - a.tangents[1] ); 95 | color[0] = (byte)( a.color[0] + f * ( b.color[0] - a.color[0] ) ); 96 | color[1] = (byte)( a.color[1] + f * ( b.color[1] - a.color[1] ) ); 97 | color[2] = (byte)( a.color[2] + f * ( b.color[2] - a.color[2] ) ); 98 | color[3] = (byte)( a.color[3] + f * ( b.color[3] - a.color[3] ) ); 99 | } 100 | 101 | ID_INLINE void idDrawVert::SetColor( dword color ) { 102 | *reinterpret_cast(this->color) = color; 103 | } 104 | 105 | ID_INLINE dword idDrawVert::GetColor( void ) const { 106 | return *reinterpret_cast(this->color); 107 | } 108 | 109 | #endif /* !__DRAWVERT_H__ */ 110 | -------------------------------------------------------------------------------- /idlib/geometry/JointTransform.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | 31 | #include "idlib/geometry/JointTransform.h" 32 | 33 | /* 34 | ============= 35 | idJointMat::ToJointQuat 36 | ============= 37 | */ 38 | idJointQuat idJointMat::ToJointQuat( void ) const { 39 | idJointQuat jq; 40 | float trace; 41 | float s; 42 | float t; 43 | int i; 44 | int j; 45 | int k; 46 | 47 | static int next[3] = { 1, 2, 0 }; 48 | 49 | trace = mat[0 * 4 + 0] + mat[1 * 4 + 1] + mat[2 * 4 + 2]; 50 | 51 | if ( trace > 0.0f ) { 52 | 53 | t = trace + 1.0f; 54 | s = idMath::InvSqrt( t ) * 0.5f; 55 | 56 | jq.q[3] = s * t; 57 | jq.q[0] = ( mat[1 * 4 + 2] - mat[2 * 4 + 1] ) * s; 58 | jq.q[1] = ( mat[2 * 4 + 0] - mat[0 * 4 + 2] ) * s; 59 | jq.q[2] = ( mat[0 * 4 + 1] - mat[1 * 4 + 0] ) * s; 60 | 61 | } else { 62 | 63 | i = 0; 64 | if ( mat[1 * 4 + 1] > mat[0 * 4 + 0] ) { 65 | i = 1; 66 | } 67 | if ( mat[2 * 4 + 2] > mat[i * 4 + i] ) { 68 | i = 2; 69 | } 70 | j = next[i]; 71 | k = next[j]; 72 | 73 | t = ( mat[i * 4 + i] - ( mat[j * 4 + j] + mat[k * 4 + k] ) ) + 1.0f; 74 | s = idMath::InvSqrt( t ) * 0.5f; 75 | 76 | jq.q[i] = s * t; 77 | jq.q[3] = ( mat[j * 4 + k] - mat[k * 4 + j] ) * s; 78 | jq.q[j] = ( mat[i * 4 + j] + mat[j * 4 + i] ) * s; 79 | jq.q[k] = ( mat[i * 4 + k] + mat[k * 4 + i] ) * s; 80 | } 81 | 82 | jq.t[0] = mat[0 * 4 + 3]; 83 | jq.t[1] = mat[1 * 4 + 3]; 84 | jq.t[2] = mat[2 * 4 + 3]; 85 | 86 | return jq; 87 | } 88 | -------------------------------------------------------------------------------- /idlib/geometry/Surface_Polytope.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __SURFACE_POLYTOPE_H__ 30 | #define __SURFACE_POLYTOPE_H__ 31 | 32 | #include "idlib/geometry/Surface.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Polytope surface. 38 | 39 | NOTE: vertexes are not duplicated for texture coordinates. 40 | 41 | =============================================================================== 42 | */ 43 | 44 | class idSurface_Polytope : public idSurface { 45 | public: 46 | idSurface_Polytope( void ); 47 | 48 | void FromPlanes( const idPlane *planes, const int numPlanes ); 49 | 50 | void SetupTetrahedron( const idBounds &bounds ); 51 | void SetupHexahedron( const idBounds &bounds ); 52 | void SetupOctahedron( const idBounds &bounds ); 53 | void SetupDodecahedron( const idBounds &bounds ); 54 | void SetupIcosahedron( const idBounds &bounds ); 55 | void SetupCylinder( const idBounds &bounds, const int numSides ); 56 | void SetupCone( const idBounds &bounds, const int numSides ); 57 | 58 | int SplitPolytope( const idPlane &plane, const float epsilon, idSurface_Polytope **front, idSurface_Polytope **back ) const; 59 | 60 | protected: 61 | 62 | }; 63 | 64 | /* 65 | ==================== 66 | idSurface_Polytope::idSurface_Polytope 67 | ==================== 68 | */ 69 | ID_INLINE idSurface_Polytope::idSurface_Polytope( void ) { 70 | } 71 | 72 | #endif /* !__SURFACE_POLYTOPE_H__ */ 73 | -------------------------------------------------------------------------------- /idlib/geometry/Surface_SweptSpline.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __SURFACE_SWEPTSPLINE_H__ 30 | #define __SURFACE_SWEPTSPLINE_H__ 31 | 32 | #include "idlib/geometry/Surface.h" 33 | #include "idlib/math/Curve.h" 34 | 35 | /* 36 | =============================================================================== 37 | 38 | Swept Spline surface. 39 | 40 | =============================================================================== 41 | */ 42 | 43 | class idSurface_SweptSpline : public idSurface { 44 | public: 45 | idSurface_SweptSpline( void ); 46 | ~idSurface_SweptSpline( void ); 47 | 48 | void SetSpline( idCurve_Spline *spline ); 49 | void SetSweptSpline( idCurve_Spline *sweptSpline ); 50 | void SetSweptCircle( const float radius ); 51 | 52 | void Tessellate( const int splineSubdivisions, const int sweptSplineSubdivisions ); 53 | 54 | void Clear( void ); 55 | 56 | protected: 57 | idCurve_Spline *spline; 58 | idCurve_Spline *sweptSpline; 59 | 60 | void GetFrame( const idMat3 &previousFrame, const idVec3 dir, idMat3 &newFrame ); 61 | }; 62 | 63 | /* 64 | ==================== 65 | idSurface_SweptSpline::idSurface_SweptSpline 66 | ==================== 67 | */ 68 | ID_INLINE idSurface_SweptSpline::idSurface_SweptSpline( void ) { 69 | spline = NULL; 70 | sweptSpline = NULL; 71 | } 72 | 73 | /* 74 | ==================== 75 | idSurface_SweptSpline::~idSurface_SweptSpline 76 | ==================== 77 | */ 78 | ID_INLINE idSurface_SweptSpline::~idSurface_SweptSpline( void ) { 79 | delete spline; 80 | delete sweptSpline; 81 | } 82 | 83 | /* 84 | ==================== 85 | idSurface_SweptSpline::Clear 86 | ==================== 87 | */ 88 | ID_INLINE void idSurface_SweptSpline::Clear( void ) { 89 | idSurface::Clear(); 90 | delete spline; 91 | spline = NULL; 92 | delete sweptSpline; 93 | sweptSpline = NULL; 94 | } 95 | 96 | #endif /* !__SURFACE_SWEPTSPLINE_H__ */ 97 | -------------------------------------------------------------------------------- /idlib/hashing/CRC32.h: -------------------------------------------------------------------------------- 1 | #ifndef __CRC32_H__ 2 | #define __CRC32_H__ 3 | 4 | /* 5 | =============================================================================== 6 | 7 | Calculates a checksum for a block of data 8 | using the CRC-32. 9 | 10 | =============================================================================== 11 | */ 12 | 13 | void CRC32_InitChecksum( unsigned int &crcvalue ); 14 | void CRC32_UpdateChecksum( unsigned int &crcvalue, const void *data, int length ); 15 | void CRC32_FinishChecksum( unsigned int &crcvalue ); 16 | unsigned int CRC32_BlockChecksum( const void *data, int length ); 17 | 18 | #endif /* !__CRC32_H__ */ 19 | -------------------------------------------------------------------------------- /idlib/hashing/MD4.h: -------------------------------------------------------------------------------- 1 | #ifndef __MD4_H__ 2 | #define __MD4_H__ 3 | 4 | /* 5 | =============================================================================== 6 | 7 | Calculates a checksum for a block of data 8 | using the MD4 message-digest algorithm. 9 | 10 | =============================================================================== 11 | */ 12 | 13 | unsigned int MD4_BlockChecksum( const void *data, int length ); 14 | 15 | #endif /* !__MD4_H__ */ 16 | -------------------------------------------------------------------------------- /idlib/hashing/MD5.h: -------------------------------------------------------------------------------- 1 | #ifndef __MD5_H__ 2 | #define __MD5_H__ 3 | 4 | /* 5 | =============================================================================== 6 | 7 | Calculates a checksum for a block of data 8 | using the MD5 message-digest algorithm. 9 | 10 | =============================================================================== 11 | */ 12 | 13 | unsigned int MD5_BlockChecksum( const void *data, int length ); 14 | 15 | #endif /* !__MD5_H__ */ 16 | -------------------------------------------------------------------------------- /idlib/math/Complex.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | 31 | #include "idlib/math/Complex.h" 32 | 33 | idComplex complex_origin( 0.0f, 0.0f ); 34 | 35 | /* 36 | ============= 37 | idComplex::ToString 38 | ============= 39 | */ 40 | const char *idComplex::ToString( int precision ) const { 41 | return idStr::FloatArrayToString( ToFloatPtr(), GetDimension(), precision ); 42 | } 43 | -------------------------------------------------------------------------------- /idlib/math/Lcp.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __MATH_LCP_H__ 30 | #define __MATH_LCP_H__ 31 | 32 | #include "idlib/math/Matrix.h" 33 | #include "framework/Common.h" 34 | #include "framework/CVarSystem.h" 35 | 36 | /* 37 | =============================================================================== 38 | 39 | Box Constrained Mixed Linear Complementarity Problem solver 40 | 41 | A is a matrix of dimension n*n and x, b, lo, hi are vectors of dimension n 42 | 43 | Solve: Ax = b + t, where t is a vector of dimension n, with 44 | complementarity condition: (x[i] - lo[i]) * (x[i] - hi[i]) * t[i] = 0 45 | such that for each 0 <= i < n one of the following holds: 46 | 47 | 1. lo[i] < x[i] < hi[i], t[i] == 0 48 | 2. x[i] == lo[i], t[i] >= 0 49 | 3. x[i] == hi[i], t[i] <= 0 50 | 51 | Partly bounded or unbounded variables can have lo[i] and/or hi[i] 52 | set to negative/positive idMath::INFITITY respectively. 53 | 54 | If boxIndex != NULL and boxIndex[i] != -1 then 55 | 56 | lo[i] = - fabs( lo[i] * x[boxIndex[i]] ) 57 | hi[i] = fabs( hi[i] * x[boxIndex[i]] ) 58 | boxIndex[boxIndex[i]] must be -1 59 | 60 | Before calculating any of the bounded x[i] with boxIndex[i] != -1 the 61 | solver calculates all unbounded x[i] and all x[i] with boxIndex[i] == -1. 62 | 63 | =============================================================================== 64 | */ 65 | 66 | class idLCP { 67 | public: 68 | static idLCP * AllocSquare( void ); // A must be a square matrix 69 | static idLCP * AllocSymmetric( void ); // A must be a symmetric matrix 70 | 71 | virtual ~idLCP( void ); 72 | 73 | virtual bool Solve( const idMatX &A, idVecX &x, const idVecX &b, const idVecX &lo, const idVecX &hi, const int *boxIndex = NULL ) = 0; 74 | virtual void SetMaxIterations( int max ); 75 | virtual int GetMaxIterations( void ); 76 | 77 | protected: 78 | int maxIterations; 79 | }; 80 | 81 | #endif /* !__MATH_LCP_H__ */ 82 | -------------------------------------------------------------------------------- /idlib/math/Pluecker.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | #include "idlib/math/Plane.h" 31 | #include "idlib/Str.h" 32 | 33 | #include "idlib/math/Pluecker.h" 34 | 35 | idPluecker pluecker_origin( 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f ); 36 | 37 | /* 38 | ================ 39 | idPluecker::FromPlanes 40 | 41 | pluecker coordinate for the intersection of two planes 42 | ================ 43 | */ 44 | bool idPluecker::FromPlanes( const idPlane &p1, const idPlane &p2 ) { 45 | 46 | p[0] = -( p1[2] * -p2[3] - p2[2] * -p1[3] ); 47 | p[1] = -( p2[1] * -p1[3] - p1[1] * -p2[3] ); 48 | p[2] = p1[1] * p2[2] - p2[1] * p1[2]; 49 | 50 | p[3] = -( p1[0] * -p2[3] - p2[0] * -p1[3] ); 51 | p[4] = p1[0] * p2[1] - p2[0] * p1[1]; 52 | p[5] = p1[0] * p2[2] - p2[0] * p1[2]; 53 | 54 | return ( p[2] != 0.0f || p[5] != 0.0f || p[4] != 0.0f ); 55 | } 56 | 57 | /* 58 | ================ 59 | idPluecker::Distance3DSqr 60 | 61 | calculates square of shortest distance between the two 62 | 3D lines represented by their pluecker coordinates 63 | ================ 64 | */ 65 | float idPluecker::Distance3DSqr( const idPluecker &a ) const { 66 | float d, s; 67 | idVec3 dir; 68 | 69 | dir[0] = -a.p[5] * p[4] - a.p[4] * -p[5]; 70 | dir[1] = a.p[4] * p[2] - a.p[2] * p[4]; 71 | dir[2] = a.p[2] * -p[5] - -a.p[5] * p[2]; 72 | if ( dir[0] == 0.0f && dir[1] == 0.0f && dir[2] == 0.0f ) { 73 | return -1.0f; // FIXME: implement for parallel lines 74 | } 75 | d = a.p[4] * ( p[2]*dir[1] - -p[5]*dir[0]) + 76 | a.p[5] * ( p[2]*dir[2] - p[4]*dir[0]) + 77 | a.p[2] * (-p[5]*dir[2] - p[4]*dir[1]); 78 | s = PermutedInnerProduct( a ) / d; 79 | return ( dir * dir ) * ( s * s ); 80 | } 81 | 82 | /* 83 | ============= 84 | idPluecker::ToString 85 | ============= 86 | */ 87 | const char *idPluecker::ToString( int precision ) const { 88 | return idStr::FloatArrayToString( ToFloatPtr(), GetDimension(), precision ); 89 | } 90 | -------------------------------------------------------------------------------- /idlib/math/Simd_3DNow.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __MATH_SIMD_3DNOW_H__ 30 | #define __MATH_SIMD_3DNOW_H__ 31 | 32 | #include "idlib/math/Simd_MMX.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | 3DNow! implementation of idSIMDProcessor 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idSIMD_3DNow : public idSIMD_MMX { 43 | #if defined(_MSC_VER) && defined(_M_IX86) 44 | public: 45 | virtual const char * VPCALL GetName( void ) const; 46 | 47 | virtual void VPCALL Memcpy( void *dst, const void *src, const int count ); 48 | 49 | #endif 50 | }; 51 | 52 | #endif /* !__MATH_SIMD_3DNOW_H__ */ 53 | -------------------------------------------------------------------------------- /idlib/math/Simd_MMX.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __MATH_SIMD_MMX_H__ 30 | #define __MATH_SIMD_MMX_H__ 31 | 32 | #include "idlib/math/Simd_Generic.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | MMX implementation of idSIMDProcessor 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idSIMD_MMX : public idSIMD_Generic { 43 | public: 44 | #if defined(__GNUC__) && defined(__MMX__) 45 | virtual const char * VPCALL GetName( void ) const; 46 | 47 | #elif defined(_MSC_VER) && defined(_M_IX86) 48 | virtual const char * VPCALL GetName( void ) const; 49 | 50 | virtual void VPCALL Memcpy( void *dst, const void *src, const int count ); 51 | virtual void VPCALL Memset( void *dst, const int val, const int count ); 52 | 53 | #endif 54 | }; 55 | 56 | #endif /* !__MATH_SIMD_MMX_H__ */ 57 | -------------------------------------------------------------------------------- /idlib/math/Simd_SSE2.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __MATH_SIMD_SSE2_H__ 30 | #define __MATH_SIMD_SSE2_H__ 31 | 32 | #include "idlib/math/Simd_SSE.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | SSE2 implementation of idSIMDProcessor 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idSIMD_SSE2 : public idSIMD_SSE { 43 | public: 44 | #if defined(__GNUC__) && defined(__SSE2__) 45 | using idSIMD_SSE::CmpLT; 46 | 47 | virtual const char * VPCALL GetName( void ) const; 48 | virtual void VPCALL CmpLT( byte *dst, const byte bitNum, const float *src0, const float constant, const int count ); 49 | 50 | #elif defined(_MSC_VER) && defined(_M_IX86) 51 | virtual const char * VPCALL GetName( void ) const; 52 | 53 | //virtual void VPCALL MatX_LowerTriangularSolve( const idMatX &L, float *x, const float *b, const int n, int skip = 0 ); 54 | //virtual void VPCALL MatX_LowerTriangularSolveTranspose( const idMatX &L, float *x, const float *b, const int n ); 55 | 56 | virtual void VPCALL MixedSoundToSamples( short *samples, const float *mixBuffer, const int numSamples ); 57 | 58 | #endif 59 | }; 60 | 61 | #endif /* !__MATH_SIMD_SSE2_H__ */ 62 | -------------------------------------------------------------------------------- /idlib/math/Simd_SSE3.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __MATH_SIMD_SSE3_H__ 30 | #define __MATH_SIMD_SSE3_H__ 31 | 32 | #include "idlib/math/Simd_SSE2.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | SSE3 implementation of idSIMDProcessor 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idSIMD_SSE3 : public idSIMD_SSE2 { 43 | public: 44 | #if defined(__GNUC__) && defined(__SSE3__) 45 | virtual const char * VPCALL GetName( void ) const; 46 | 47 | #elif defined(_MSC_VER) && defined(_M_IX86) 48 | virtual const char * VPCALL GetName( void ) const; 49 | 50 | virtual void VPCALL TransformVerts( idDrawVert *verts, const int numVerts, const idJointMat *joints, const idVec4 *weights, const int *index, const int numWeights ); 51 | 52 | #endif 53 | }; 54 | 55 | #endif /* !__MATH_SIMD_SSE3_H__ */ 56 | -------------------------------------------------------------------------------- /renderer/Cinematic.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __CINEMATIC_H__ 30 | #define __CINEMATIC_H__ 31 | 32 | /* 33 | =============================================================================== 34 | 35 | RoQ cinematic 36 | 37 | Multiple idCinematics can run simultaniously. 38 | A single idCinematic can be reused for multiple files if desired. 39 | 40 | =============================================================================== 41 | */ 42 | 43 | // cinematic states 44 | typedef enum { 45 | FMV_IDLE, 46 | FMV_PLAY, // play 47 | FMV_EOF, // all other conditions, i.e. stop/EOF/abort 48 | FMV_ID_BLT, 49 | FMV_ID_IDLE, 50 | FMV_LOOPED, 51 | FMV_ID_WAIT 52 | } cinStatus_t; 53 | 54 | // a cinematic stream generates an image buffer, which the caller will upload to a texture 55 | typedef struct { 56 | int imageWidth, imageHeight; // will be a power of 2 57 | const byte * image; // RGBA format, alpha will be 255 58 | int status; 59 | } cinData_t; 60 | 61 | class idCinematic { 62 | public: 63 | // initialize cinematic play back data 64 | static void InitCinematic( void ); 65 | 66 | // shutdown cinematic play back data 67 | static void ShutdownCinematic( void ); 68 | 69 | // allocates and returns a private subclass that implements the methods 70 | // This should be used instead of new 71 | static idCinematic *Alloc(); 72 | 73 | // frees all allocated memory 74 | virtual ~idCinematic(); 75 | 76 | // returns false if it failed to load 77 | virtual bool InitFromFile( const char *qpath, bool looping ); 78 | 79 | // returns the length of the animation in milliseconds 80 | virtual int AnimationLength(); 81 | 82 | // the pointers in cinData_t will remain valid until the next UpdateForTime() call 83 | virtual cinData_t ImageForTime( int milliseconds ); 84 | 85 | // closes the file and frees all allocated memory 86 | virtual void Close(); 87 | 88 | // closes the file and frees all allocated memory 89 | virtual void ResetTime(int time); 90 | }; 91 | 92 | /* 93 | =============================================== 94 | 95 | Sound meter. 96 | 97 | =============================================== 98 | */ 99 | 100 | class idSndWindow : public idCinematic { 101 | public: 102 | 103 | idSndWindow() { showWaveform = false; } 104 | ~idSndWindow() {} 105 | 106 | bool InitFromFile( const char *qpath, bool looping ); 107 | cinData_t ImageForTime( int milliseconds ); 108 | int AnimationLength(); 109 | 110 | private: 111 | bool showWaveform; 112 | }; 113 | 114 | #endif /* !__CINEMATIC_H__ */ 115 | -------------------------------------------------------------------------------- /renderer/ModelManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __MODELMANAGER_H__ 30 | #define __MODELMANAGER_H__ 31 | 32 | #include "framework/Common.h" 33 | #include "renderer/Model.h" 34 | 35 | /* 36 | =============================================================================== 37 | 38 | Model Manager 39 | 40 | Temporarily created models do not need to be added to the model manager. 41 | 42 | =============================================================================== 43 | */ 44 | 45 | class idRenderModelManager { 46 | public: 47 | virtual ~idRenderModelManager() {} 48 | 49 | // registers console commands and clears the list 50 | virtual void Init() = 0; 51 | 52 | // frees all the models 53 | virtual void Shutdown() = 0; 54 | 55 | // called only by renderer::BeginLevelLoad 56 | virtual void BeginLevelLoad() = 0; 57 | 58 | // called only by renderer::EndLevelLoad 59 | virtual void EndLevelLoad() = 0; 60 | 61 | // allocates a new empty render model. 62 | virtual idRenderModel * AllocModel() = 0; 63 | 64 | // frees a render model 65 | virtual void FreeModel( idRenderModel *model ) = 0; 66 | 67 | // returns NULL if modelName is NULL or an empty string, otherwise 68 | // it will create a default model if not loadable 69 | virtual idRenderModel * FindModel( const char *modelName ) = 0; 70 | 71 | // returns NULL if not loadable 72 | virtual idRenderModel * CheckModel( const char *modelName ) = 0; 73 | 74 | // returns the default cube model 75 | virtual idRenderModel * DefaultModel() = 0; 76 | 77 | // world map parsing will add all the inline models with this call 78 | virtual void AddModel( idRenderModel *model ) = 0; 79 | 80 | // when a world map unloads, it removes its internal models from the list 81 | // before freeing them. 82 | // There may be an issue with multiple renderWorlds that share data... 83 | virtual void RemoveModel( idRenderModel *model ) = 0; 84 | 85 | // the reloadModels console command calls this, but it can 86 | // also be explicitly invoked 87 | virtual void ReloadModels( bool forceAll = false ) = 0; 88 | 89 | // write "touchModel " commands for each non-world-map model 90 | virtual void WritePrecacheCommands( idFile *f ) = 0; 91 | 92 | // called during vid_restart 93 | virtual void FreeModelVertexCaches() = 0; 94 | 95 | // print memory info 96 | virtual void PrintMemInfo( MemInfo_t *mi ) = 0; 97 | }; 98 | 99 | // this will be statically pointed at a private implementation 100 | extern idRenderModelManager *renderModelManager; 101 | 102 | #endif /* !__MODELMANAGER_H__ */ 103 | -------------------------------------------------------------------------------- /tools/compilers/aas/AASFileManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __AASFILEMANAGER_H__ 30 | #define __AASFILEMANAGER_H__ 31 | 32 | #include "tools/compilers/aas/AASFile.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | AAS File Manager 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idAASFileManager { 43 | public: 44 | virtual ~idAASFileManager( void ) {} 45 | 46 | virtual idAASFile * LoadAAS( const char *fileName, unsigned int mapFileCRC ) = 0; 47 | virtual void FreeAAS( idAASFile *file ) = 0; 48 | }; 49 | 50 | extern idAASFileManager * AASFileManager; 51 | 52 | #endif /* !__AASFILEMANAGER_H__ */ 53 | -------------------------------------------------------------------------------- /ui/ListGUI.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __LISTGUI_H__ 30 | #define __LISTGUI_H__ 31 | 32 | #include "idlib/Str.h" 33 | 34 | class idUserInterface; 35 | 36 | /* 37 | =============================================================================== 38 | 39 | feed data to a listDef 40 | each item has an id and a display string 41 | 42 | =============================================================================== 43 | */ 44 | 45 | class idListGUI { 46 | public: 47 | virtual ~idListGUI() { } 48 | 49 | virtual void Config( idUserInterface *pGUI, const char *name ) = 0; 50 | virtual void Add( int id, const idStr& s ) = 0; 51 | // use the element count as index for the ids 52 | virtual void Push( const idStr& s ) = 0; 53 | virtual bool Del( int id ) = 0; 54 | virtual void Clear( void ) = 0; 55 | virtual int Num( void ) = 0; 56 | virtual int GetSelection( char *s, int size, int sel = 0 ) const = 0; // returns the id, not the list index (or -1) 57 | virtual void SetSelection( int sel ) = 0; 58 | virtual int GetNumSelections() = 0; 59 | virtual bool IsConfigured( void ) const = 0; 60 | // by default, any modification to the list will trigger a full GUI refresh immediately 61 | virtual void SetStateChanges( bool enable ) = 0; 62 | virtual void Shutdown( void ) = 0; 63 | }; 64 | 65 | #endif /* !__LISTGUI_H__ */ 66 | --------------------------------------------------------------------------------