Changeset 427 for cafu/trunk
- Timestamp:
- 11/19/11 21:12:38 (6 months ago)
- Location:
- cafu/trunk
- Files:
-
- 38 modified
-
CaWE/ModelEditor/AnimInspector.cpp (modified) (1 diff)
-
CaWE/ModelEditor/ChildFrame.hpp (modified) (1 diff)
-
Games/DeathMatch/Code/ARGrenade.cpp (modified) (6 diffs)
-
Games/DeathMatch/Code/ARGrenade.hpp (modified) (3 diffs)
-
Games/DeathMatch/Code/Butterfly.cpp (modified) (4 diffs)
-
Games/DeathMatch/Code/Butterfly.hpp (modified) (4 diffs)
-
Games/DeathMatch/Code/Eagle.cpp (modified) (5 diffs)
-
Games/DeathMatch/Code/Eagle.hpp (modified) (3 diffs)
-
Games/DeathMatch/Code/FaceHugger.cpp (modified) (5 diffs)
-
Games/DeathMatch/Code/FaceHugger.hpp (modified) (4 diffs)
-
Games/DeathMatch/Code/GameImpl.cpp (modified) (2 diffs)
-
Games/DeathMatch/Code/HandGrenade.cpp (modified) (6 diffs)
-
Games/DeathMatch/Code/HandGrenade.hpp (modified) (3 diffs)
-
Games/DeathMatch/Code/Item.cpp (modified) (5 diffs)
-
Games/DeathMatch/Code/Item.hpp (modified) (3 diffs)
-
Games/DeathMatch/Code/ItemAmmo357.cpp (modified) (1 diff)
-
Games/DeathMatch/Code/ItemAmmoArrow.cpp (modified) (1 diff)
-
Games/DeathMatch/Code/Rocket.cpp (modified) (6 diffs)
-
Games/DeathMatch/Code/Rocket.hpp (modified) (3 diffs)
-
Games/DeathMatch/Code/StaticDetailModel.cpp (modified) (13 diffs)
-
Games/DeathMatch/Code/StaticDetailModel.hpp (modified) (2 diffs)
-
Games/DeathMatch/Code/Weapon.cpp (modified) (5 diffs)
-
Games/DeathMatch/Code/Weapon.hpp (modified) (3 diffs)
-
Games/DeathMatch/Code/Weapon357.cpp (modified) (1 diff)
-
Games/DeathMatch/Code/Weapon9mmAR.cpp (modified) (1 diff)
-
Games/DeathMatch/Code/WeaponBattleScythe.cpp (modified) (1 diff)
-
Games/DeathMatch/Code/WeaponCrossbow.cpp (modified) (1 diff)
-
Games/DeathMatch/Code/WeaponEgon.cpp (modified) (1 diff)
-
Games/DeathMatch/Code/WeaponFaceHugger.cpp (modified) (1 diff)
-
Games/DeathMatch/Code/WeaponGauss.cpp (modified) (1 diff)
-
Games/DeathMatch/Code/WeaponGrenade.cpp (modified) (1 diff)
-
Games/DeathMatch/Code/WeaponHornetGun.cpp (modified) (1 diff)
-
Games/DeathMatch/Code/WeaponPistol.cpp (modified) (1 diff)
-
Games/DeathMatch/Code/WeaponRPG.cpp (modified) (1 diff)
-
Games/DeathMatch/Code/WeaponShotgun.cpp (modified) (1 diff)
-
Games/DeathMatch/Code/WeaponTripmine.cpp (modified) (1 diff)
-
Libs/Models/Model_cmdl.cpp (modified) (1 diff)
-
Libs/Models/Model_cmdl.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cafu/trunk/CaWE/ModelEditor/AnimInspector.cpp
r322 r427 111 111 112 112 Append(new wxIntProperty("Next sequence", wxPG_LABEL, Anim.Next)); 113 114 // if (Anim.IsLastFrameDup()) 115 // { 116 // wxPGProperty* Note=Append(new wxStringProperty("Note", wxPG_LABEL, "0 == last")); 117 // DisableProperty(Note); 118 // } 113 119 } 114 120 else -
cafu/trunk/CaWE/ModelEditor/ChildFrame.hpp
r407 r427 89 89 90 90 /// Sets the type of the most recently used (clicked) model element. 91 void SetLastUsedType(ModelElementTypeT Type) { wxASSERT(Type< 5); m_LastUsedType=Type; }91 void SetLastUsedType(ModelElementTypeT Type) { wxASSERT(Type<6); m_LastUsedType=Type; } 92 92 93 93 ModelDocumentT* GetModelDoc() const { return m_ModelDoc; } -
cafu/trunk/Games/DeathMatch/Code/ARGrenade.cpp
r285 r427 19 19 ================================================================================= 20 20 */ 21 22 /*************************/23 /*** AR Grenade (Code) ***/24 /*************************/25 21 26 22 #include "ARGrenade.hpp" … … 33 29 #include "SoundSystem/SoundShaderManager.hpp" 34 30 #include "../../GameWorld.hpp" 35 #include "Models/Model_ proxy.hpp"31 #include "Models/Model_cmdl.hpp" 36 32 #include "ParticleEngine/ParticleEngineMS.hpp" 37 33 … … 73 69 0, // ActiveWeaponSequNr 74 70 0.0)), // ActiveWeaponFrameNr 75 FireSound(SoundSystem->CreateSound3D(SoundShaderManager->GetSoundShader("Weapon/Shotgun_dBarrel"))) 71 m_Model(Params.GameWorld->GetModel("Games/DeathMatch/Models/Weapons/Grenade_w.mdl")), 72 m_FireSound(SoundSystem->CreateSound3D(SoundShaderManager->GetSoundShader("Weapon/Shotgun_dBarrel"))) 76 73 { 77 74 } … … 81 78 { 82 79 // Release sound. 83 SoundSystem->DeleteSound( FireSound);80 SoundSystem->DeleteSound(m_FireSound); 84 81 } 85 82 … … 185 182 // We only receive a single event here ("Detonation!"), thus there is no need to look at 'EventID'. 186 183 // Update sound position. 187 FireSound->SetPosition(State.Origin);184 m_FireSound->SetPosition(State.Origin); 188 185 189 186 // Play the fire sound. 190 FireSound->Play();187 m_FireSound->Play(); 191 188 192 189 // Register explosion particles. … … 273 270 // glTranslatef(0.0, 0.0, 4.0); 274 271 275 static ModelProxyT ARGrenadeModel("Games/DeathMatch/Models/Weapons/Grenade_w.mdl"); 276 277 ARGrenadeModel.Draw(State.ModelSequNr, State.ModelFrameNr, LodDist); 278 } 272 AnimPoseT* Pose=m_Model->GetSharedPose(State.ModelSequNr, State.ModelFrameNr); 273 Pose->Draw(-1 /*default skin*/, LodDist); 274 } -
cafu/trunk/Games/DeathMatch/Code/ARGrenade.hpp
r285 r427 20 20 */ 21 21 22 /***************************/23 /*** AR Grenade (Header) ***/24 /***************************/25 26 22 #ifndef _ARGRENADE_HPP_ 27 23 #define _ARGRENADE_HPP_ … … 30 26 31 27 28 class CafuModelT; 32 29 class EntityCreateParamsT; 33 30 class SoundI; … … 55 52 private: 56 53 57 SoundI* FireSound; 54 const CafuModelT* m_Model; 55 SoundI* m_FireSound; 58 56 }; 59 57 -
cafu/trunk/Games/DeathMatch/Code/Butterfly.cpp
r285 r427 20 20 */ 21 21 22 /************************/23 /*** Butterfly (Code) ***/24 /************************/25 26 22 #include "Butterfly.hpp" 27 23 #include "TypeSys.hpp" 28 24 #include "EntityCreateParams.hpp" 29 25 #include "Libs/LookupTables.hpp" 30 #include "Models/Model_proxy.hpp" 26 #include "../../GameWorld.hpp" 27 #include "Models/Model_cmdl.hpp" 31 28 32 29 … … 67 64 0, // ActiveWeaponSequNr 68 65 0.0)), // ActiveWeaponFrameNr 66 m_Model(Params.GameWorld->GetModel("Games/DeathMatch/Models/LifeForms/Butterfly.mdl")), 69 67 ArcCenter(Params.Origin), 70 68 ArcPos(0) … … 92 90 void EntButterflyT::Draw(bool /*FirstPersonView*/, float LodDist) const 93 91 { 94 static ModelProxyT ButterflyModel("Games/DeathMatch/Models/LifeForms/Butterfly.mdl"); 95 96 ButterflyModel.Draw(State.ModelSequNr, State.ModelFrameNr, LodDist); 92 AnimPoseT* Pose=m_Model->GetSharedPose(State.ModelSequNr, State.ModelFrameNr); 93 Pose->Draw(-1 /*default skin*/, LodDist); 97 94 } 98 95 … … 100 97 void EntButterflyT::PostDraw(float FrameTime, bool /*FirstPersonView*/) 101 98 { 102 // Note that ModelProxyTs are *very* cheap and share common resources.103 // Thus, having here another instance of a Butterfly model is not beautiful coding, but perfectly fine otherwise.104 // Other entities do it different, I was just intending to demonstrate the effect here.105 static ModelProxyT ButterflyModel("Games/DeathMatch/Models/LifeForms/Butterfly.mdl");106 107 99 // Implicit simple "mini-prediction". 108 State.ModelFrameNr=ButterflyModel.AdvanceFrameNr(State.ModelSequNr, State.ModelFrameNr, FrameTime, true); 100 AnimPoseT* Pose=m_Model->GetSharedPose(State.ModelSequNr, State.ModelFrameNr); 101 Pose->Advance(FrameTime, true); 102 State.ModelFrameNr=Pose->GetFrameNr(); 109 103 } -
cafu/trunk/Games/DeathMatch/Code/Butterfly.hpp
r285 r427 20 20 */ 21 21 22 /**************************/23 /*** Butterfly (Header) ***/24 /**************************/25 26 22 #ifndef _BUTTERFLY_HPP_ 27 23 #define _BUTTERFLY_HPP_ … … 30 26 31 27 28 class CafuModelT; 32 29 class EntityCreateParamsT; 33 30 … … 35 32 class EntButterflyT : public BaseEntityT 36 33 { 37 private:38 39 VectorT ArcCenter;40 unsigned short ArcPos;41 42 43 34 public: 44 35 … … 53 44 static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params); 54 45 static const cf::TypeSys::TypeInfoT TypeInfo; 46 47 48 private: 49 50 const CafuModelT* m_Model; 51 VectorT ArcCenter; 52 unsigned short ArcPos; 55 53 }; 56 54 -
cafu/trunk/Games/DeathMatch/Code/Eagle.cpp
r285 r427 20 20 */ 21 21 22 /********************/23 /*** Eagle (Code) ***/24 /********************/25 26 22 #include "Eagle.hpp" 27 23 #include "EntityCreateParams.hpp" … … 33 29 #include "MaterialSystem/Material.hpp" 34 30 #include "MaterialSystem/Renderer.hpp" 31 #include "Models/Model_cmdl.hpp" 35 32 #include "SoundSystem/SoundSys.hpp" 36 33 #include "SoundSystem/Sound.hpp" … … 75 72 0, // ActiveWeaponSequNr 76 73 0.0)), // ActiveWeaponFrameNr 77 EagleModel("Games/DeathMatch/Models/LifeForms/Eagle.mdl"),74 m_Model(Params.GameWorld->GetModel("Games/DeathMatch/Models/LifeForms/Eagle.mdl")), 78 75 FlightState(CruiseFlight), 79 76 OldOrigin(), … … 229 226 MatSys::Renderer->SetCurrentEyePosition(EyePos.x, EyePos.y, EyePos.z); 230 227 231 EagleModel.Draw(State.ModelSequNr, State.ModelFrameNr, LodDist); 228 AnimPoseT* Pose=m_Model->GetSharedPose(State.ModelSequNr, State.ModelFrameNr); 229 Pose->Draw(-1 /*default skin*/, LodDist); 232 230 } 233 231 … … 235 233 void EntEagleT::PostDraw(float FrameTime, bool /*FirstPersonView*/) 236 234 { 237 State.ModelFrameNr=EagleModel.AdvanceFrameNr(State.ModelSequNr, State.ModelFrameNr, FrameTime, true); 235 AnimPoseT* Pose=m_Model->GetSharedPose(State.ModelSequNr, State.ModelFrameNr); 236 Pose->Advance(FrameTime, true); 237 State.ModelFrameNr=Pose->GetFrameNr(); 238 238 239 239 // Update sound position and velocity. -
cafu/trunk/Games/DeathMatch/Code/Eagle.hpp
r285 r427 20 20 */ 21 21 22 /**********************/23 /*** Eagle (Header) ***/24 /**********************/25 26 22 #ifndef _EAGLE_HPP_ 27 23 #define _EAGLE_HPP_ 28 24 29 25 #include "../../BaseEntity.hpp" 30 #include "Models/Model_proxy.hpp"31 26 32 27 28 class CafuModelT; 33 29 class EntityCreateParamsT; 34 30 class SoundI; … … 37 33 class EntEagleT : public BaseEntityT 38 34 { 39 private:40 41 enum FlightStateT { CruiseFlight, ControlledCruise, HalfLoopAndRoll, ClimpBackToCruiseAlt };42 43 const ModelProxyT EagleModel;44 FlightStateT FlightState;45 VectorT OldOrigin;46 VectorT LoopCenter;47 float FigureDistance;48 float FigureLeft;49 50 float TimeUntilNextCry;51 52 SoundI* EagleCry;53 54 55 35 public: 56 36 … … 66 46 static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params); 67 47 static const cf::TypeSys::TypeInfoT TypeInfo; 48 49 50 private: 51 52 enum FlightStateT { CruiseFlight, ControlledCruise, HalfLoopAndRoll, ClimpBackToCruiseAlt }; 53 54 const CafuModelT* m_Model; 55 FlightStateT FlightState; 56 VectorT OldOrigin; 57 VectorT LoopCenter; 58 float FigureDistance; 59 float FigureLeft; 60 61 float TimeUntilNextCry; 62 SoundI* EagleCry; 68 63 }; 69 64 -
cafu/trunk/Games/DeathMatch/Code/FaceHugger.cpp
r285 r427 20 20 */ 21 21 22 /**************************/23 /*** Face Hugger (Code) ***/24 /**************************/25 26 22 #include "FaceHugger.hpp" 27 23 #include "EntityCreateParams.hpp" … … 30 26 #include "Libs/Physics.hpp" // ÜBERFLÜSSIG? 31 27 #include "TypeSys.hpp" 32 #include "Models/Model_ proxy.hpp"28 #include "Models/Model_cmdl.hpp" 33 29 #include "ParticleEngine/ParticleEngineMS.hpp" 34 30 … … 69 65 0, // ActiveWeaponSlot 70 66 0, // ActiveWeaponSequNr 71 0.0)) // ActiveWeaponFrameNr 67 0.0)), // ActiveWeaponFrameNr 68 m_Model(Params.GameWorld->GetModel("Games/DeathMatch/Models/LifeForms/FaceHugger.mdl")) 72 69 { 73 70 } … … 109 106 void EntFaceHuggerT::Draw(bool /*FirstPersonView*/, float LodDist) const 110 107 { 111 static ModelProxyT FaceHuggerModel("Games/DeathMatch/Models/LifeForms/FaceHugger.mdl"); 112 113 FaceHuggerModel.Draw(State.ModelSequNr, State.ModelFrameNr, LodDist); 108 AnimPoseT* Pose=m_Model->GetSharedPose(State.ModelSequNr, State.ModelFrameNr); 109 Pose->Draw(-1 /*default skin*/, LodDist); 114 110 } 115 111 … … 117 113 void EntFaceHuggerT::PostDraw(float FrameTime, bool /*FirstPersonView*/) 118 114 { 119 // Note that ModelProxyTs are *very* cheap and share common resources. 120 // Thus, having here another instance of a Butterfly model is not beautiful coding, but perfectly fine otherwise. 121 // Other entities do it different, I was just intending to demonstrate the effect here. 122 static ModelProxyT FaceHuggerModel("Games/DeathMatch/Models/LifeForms/FaceHugger.mdl"); 115 AnimPoseT* Pose=m_Model->GetSharedPose(State.ModelSequNr, State.ModelFrameNr); 116 Pose->Advance(FrameTime, true); 123 117 124 const float OldFrameNr =State.ModelFrameNr; 125 126 State.ModelFrameNr=FaceHuggerModel.AdvanceFrameNr(State.ModelSequNr, State.ModelFrameNr, FrameTime, true); 127 128 const float NewFrameNr =State.ModelFrameNr; 129 const bool SequenceWrap=NewFrameNr<OldFrameNr; 118 const bool SequenceWrap=Pose->GetFrameNr() < State.ModelFrameNr; 119 State.ModelFrameNr=Pose->GetFrameNr(); 130 120 131 121 if (SequenceWrap) -
cafu/trunk/Games/DeathMatch/Code/FaceHugger.hpp
r285 r427 20 20 */ 21 21 22 /****************************/23 /*** Face Hugger (Header) ***/24 /****************************/25 26 22 #ifndef _FACEHUGGER_HPP_ 27 23 #define _FACEHUGGER_HPP_ … … 30 26 31 27 28 class CafuModelT; 32 29 class EntityCreateParamsT; 33 30 … … 35 32 class EntFaceHuggerT : public BaseEntityT 36 33 { 37 // private:38 39 // unsigned long TargetEntityID; // ID of the entity that this face hugger attacks.40 41 42 34 public: 43 35 … … 52 44 static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params); 53 45 static const cf::TypeSys::TypeInfoT TypeInfo; 46 47 48 private: 49 50 const CafuModelT* m_Model; 51 // unsigned long m_TargetEntityID; // ID of the entity that this face hugger attacks. 54 52 }; 55 53 -
cafu/trunk/Games/DeathMatch/Code/GameImpl.cpp
r423 r427 127 127 // On the other hand, registering materials can only be done *after* GetGame() was called. 128 128 // So a good place for registering materials that we need within this DLL is for example at the end of GetGame(), or right here. 129 // Registering the materials that our models will use is quite easy, because we just need to instantiate a ModelProxyT ofeach.129 // Registering the materials that our models will use is quite easy, because we just need to find them in the ModelMan each. 130 130 // (Nothing breaks if the following list is simply deleted, these models just aren't pre-cached then.) 131 131 // … … 138 138 { 139 139 // And the rest. Observe that static detail models are NOT mentioned (how could they?). 140 static ModelProxyT M01("Games/DeathMatch/Models/Items/Ammo_DartGun.mdl");141 static ModelProxyT M02("Games/DeathMatch/Models/Items/Ammo_DesertEagle.mdl");142 143 static ModelProxyT M03("Games/DeathMatch/Models/LifeForms/Butterfly.mdl");144 static ModelProxyT M04("Games/DeathMatch/Models/LifeForms/Eagle.mdl");145 static ModelProxyT M05("Games/DeathMatch/Models/LifeForms/FaceHugger.mdl");146 147 static ModelProxyT M06("Games/DeathMatch/Models/Weapons/9mmAR_w.mdl");148 static ModelProxyT M07("Games/DeathMatch/Models/Weapons/BattleScythe_w.mdl");149 static ModelProxyT M08("Games/DeathMatch/Models/Weapons/Bazooka_w.mdl");150 static ModelProxyT M09("Games/DeathMatch/Models/Weapons/Beretta_w.mdl");151 static ModelProxyT M10("Games/DeathMatch/Models/Weapons/DartGun_w.mdl");152 static ModelProxyT M11("Games/DeathMatch/Models/Weapons/DesertEagle_w.mdl");153 static ModelProxyT M12("Games/DeathMatch/Models/Weapons/Egon_w.mdl");154 static ModelProxyT M13("Games/DeathMatch/Models/Weapons/FaceHugger_w.mdl");155 static ModelProxyT M14("Games/DeathMatch/Models/Weapons/Gauss_w.mdl");156 static ModelProxyT M15("Games/DeathMatch/Models/Weapons/Grenade_w.mdl");157 static ModelProxyT M16("Games/DeathMatch/Models/Weapons/HornetGun_w.mdl");158 static ModelProxyT M17("Games/DeathMatch/Models/Weapons/Shotgun_w.mdl");159 static ModelProxyT M18("Games/DeathMatch/Models/Weapons/Tripmine_w.mdl");140 ModelMan.GetModel("Games/DeathMatch/Models/Items/Ammo_DartGun.mdl"); 141 ModelMan.GetModel("Games/DeathMatch/Models/Items/Ammo_DesertEagle.mdl"); 142 143 ModelMan.GetModel("Games/DeathMatch/Models/LifeForms/Butterfly.mdl"); 144 ModelMan.GetModel("Games/DeathMatch/Models/LifeForms/Eagle.mdl"); 145 ModelMan.GetModel("Games/DeathMatch/Models/LifeForms/FaceHugger.mdl"); 146 147 ModelMan.GetModel("Games/DeathMatch/Models/Weapons/9mmAR_w.mdl"); 148 ModelMan.GetModel("Games/DeathMatch/Models/Weapons/BattleScythe_w.mdl"); 149 ModelMan.GetModel("Games/DeathMatch/Models/Weapons/Bazooka_w.mdl"); 150 ModelMan.GetModel("Games/DeathMatch/Models/Weapons/Beretta_w.mdl"); 151 ModelMan.GetModel("Games/DeathMatch/Models/Weapons/DartGun_w.mdl"); 152 ModelMan.GetModel("Games/DeathMatch/Models/Weapons/DesertEagle_w.mdl"); 153 ModelMan.GetModel("Games/DeathMatch/Models/Weapons/Egon_w.mdl"); 154 ModelMan.GetModel("Games/DeathMatch/Models/Weapons/FaceHugger_w.mdl"); 155 ModelMan.GetModel("Games/DeathMatch/Models/Weapons/Gauss_w.mdl"); 156 ModelMan.GetModel("Games/DeathMatch/Models/Weapons/Grenade_w.mdl"); 157 ModelMan.GetModel("Games/DeathMatch/Models/Weapons/HornetGun_w.mdl"); 158 ModelMan.GetModel("Games/DeathMatch/Models/Weapons/Shotgun_w.mdl"); 159 ModelMan.GetModel("Games/DeathMatch/Models/Weapons/Tripmine_w.mdl"); 160 160 } 161 161 -
cafu/trunk/Games/DeathMatch/Code/HandGrenade.cpp
r285 r427 19 19 ================================================================================= 20 20 */ 21 22 /***************************/23 /*** Hand Grenade (Code) ***/24 /***************************/25 21 26 22 #include "HandGrenade.hpp" … … 33 29 #include "SoundSystem/SoundShaderManager.hpp" 34 30 #include "../../GameWorld.hpp" 35 #include "Models/Model_ proxy.hpp"31 #include "Models/Model_cmdl.hpp" 36 32 #include "ParticleEngine/ParticleEngineMS.hpp" 37 33 … … 73 69 0, // ActiveWeaponSequNr 74 70 0.0)), // ActiveWeaponFrameNr 75 FireSound(SoundSystem->CreateSound3D(SoundShaderManager->GetSoundShader("Weapon/Shotgun_dBarrel"))) 76 { 77 FireSound->SetPosition(Params.Origin); 71 m_Model(Params.GameWorld->GetModel("Games/DeathMatch/Models/Weapons/Grenade_w.mdl")), 72 m_FireSound(SoundSystem->CreateSound3D(SoundShaderManager->GetSoundShader("Weapon/Shotgun_dBarrel"))) 73 { 74 m_FireSound->SetPosition(Params.Origin); 78 75 } 79 76 … … 82 79 { 83 80 // Release sound. 84 SoundSystem->DeleteSound( FireSound);81 SoundSystem->DeleteSound(m_FireSound); 85 82 } 86 83 … … 177 174 // We only receive a single event here ("Detonation!"), thus there is no need to look at 'EventID'. 178 175 // Update sound position. 179 FireSound->SetPosition(State.Origin);176 m_FireSound->SetPosition(State.Origin); 180 177 181 178 // Play the fire sound. 182 FireSound->Play();179 m_FireSound->Play(); 183 180 184 181 // Register explosion particles. … … 256 253 if (State.ActiveWeaponFrameNr>=3.0) return; 257 254 258 static ModelProxyT HandGrenadeModel("Games/DeathMatch/Models/Weapons/Grenade_w.mdl"); 259 260 HandGrenadeModel.Draw(State.ModelSequNr, State.ModelFrameNr, LodDist); 261 } 255 AnimPoseT* Pose=m_Model->GetSharedPose(State.ModelSequNr, State.ModelFrameNr); 256 Pose->Draw(-1 /*default skin*/, LodDist); 257 } -
cafu/trunk/Games/DeathMatch/Code/HandGrenade.hpp
r285 r427 20 20 */ 21 21 22 /*****************************/23 /*** Hand Grenade (Header) ***/24 /*****************************/25 26 22 #ifndef _HANDGRENADE_HPP_ 27 23 #define _HANDGRENADE_HPP_ … … 30 26 31 27 28 class CafuModelT; 32 29 class EntityCreateParamsT; 33 30 class SoundI; … … 55 52 private: 56 53 57 SoundI* FireSound; 54 const CafuModelT* m_Model; 55 SoundI* m_FireSound; 58 56 }; 59 57 -
cafu/trunk/Games/DeathMatch/Code/Item.cpp
r285 r427 20 20 */ 21 21 22 /*******************/23 /*** Item (Code) ***/24 /*******************/25 26 22 #include "Item.hpp" 27 23 #include "EntityCreateParams.hpp" … … 32 28 #include "../../GameWorld.hpp" 33 29 #include "ConsoleCommands/Console.hpp" 34 #include "Models/Model_ proxy.hpp"30 #include "Models/Model_cmdl.hpp" 35 31 #include "TypeSys.hpp" 36 32 … … 78 74 0, // ActiveWeaponSequNr 79 75 0.0)), // ActiveWeaponFrameNr 80 ItemModel(ModelName),81 TimeLeftNotActive(2.0),76 m_ItemModel(Params.GameWorld->GetModel(ModelName)), 77 m_TimeLeftNotActive(2.0), 82 78 PickUp(SoundSystem->CreateSound3D(SoundShaderManager->GetSoundShader("Item/PickUp"))), 83 79 Respawn(SoundSystem->CreateSound3D(SoundShaderManager->GetSoundShader("Item/Respawn"))) … … 106 102 { 107 103 case StateOfExistance_NotActive: 108 TimeLeftNotActive-=FrameTime;109 if ( TimeLeftNotActive<=0.0)104 m_TimeLeftNotActive-=FrameTime; 105 if (m_TimeLeftNotActive<=0.0) 110 106 { 111 107 State.StateOfExistance=StateOfExistance_Active; … … 136 132 if (State.StateOfExistance==StateOfExistance_NotActive) return; 137 133 138 ItemModel.Draw(0, 0.0, LodDist); 134 AnimPoseT* Pose=m_ItemModel->GetSharedPose(0, 0.0f); 135 Pose->Draw(-1 /*default skin*/, LodDist); 139 136 140 137 // RotAngle += 234.0*FrameTime; if (RotAngle>360.0) RotAngle-=360.0; -
cafu/trunk/Games/DeathMatch/Code/Item.hpp
r285 r427 20 20 */ 21 21 22 /*********************/23 /*** Item (Header) ***/24 /*********************/25 26 22 #ifndef _ITEM_HPP_ 27 23 #define _ITEM_HPP_ 28 24 29 25 #include "../../BaseEntity.hpp" 30 #include "Models/Model_proxy.hpp"31 26 32 27 28 class CafuModelT; 33 29 class EntityCreateParamsT; 34 30 class SoundI; … … 37 33 class EntItemT : public BaseEntityT 38 34 { 39 protected:40 41 enum EventIDs { EventID_PickedUp, EventID_Respawn };42 43 static const char StateOfExistance_Active;44 static const char StateOfExistance_NotActive;45 46 const ModelProxyT ItemModel; // Could easily get rid of this member, but each item had to provide an own Draw() method then.47 float TimeLeftNotActive;48 49 SoundI* PickUp;50 SoundI* Respawn;51 52 53 35 public: 54 36 … … 66 48 static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params); 67 49 static const cf::TypeSys::TypeInfoT TypeInfo; 50 51 52 protected: 53 54 enum EventIDs { EventID_PickedUp, EventID_Respawn }; 55 56 static const char StateOfExistance_Active; 57 static const char StateOfExistance_NotActive; 58 59 const CafuModelT* m_ItemModel; 60 float m_TimeLeftNotActive; 61 62 SoundI* PickUp; 63 SoundI* Respawn; 68 64 }; 69 65 -
cafu/trunk/Games/DeathMatch/Code/ItemAmmo357.cpp
r285 r427 73 73 State.StateOfExistance=StateOfExistance_NotActive; 74 74 State.Events^=(1 << EventID_PickedUp); 75 TimeLeftNotActive=5.0;75 m_TimeLeftNotActive=5.0; 76 76 } -
cafu/trunk/Games/DeathMatch/Code/ItemAmmoArrow.cpp
r285 r427 73 73 State.StateOfExistance=StateOfExistance_NotActive; 74 74 State.Events^=(1 << EventID_PickedUp); 75 TimeLeftNotActive=5.0;75 m_TimeLeftNotActive=5.0; 76 76 } -
cafu/trunk/Games/DeathMatch/Code/Rocket.cpp
r285 r427 19 19 ================================================================================= 20 20 */ 21 22 /*********************/23 /*** Rocket (Code) ***/24 /*********************/25 21 26 22 #include "Rocket.hpp" … … 32 28 #include "SoundSystem/SoundShaderManager.hpp" 33 29 #include "../../GameWorld.hpp" 34 #include "Models/Model_ proxy.hpp"30 #include "Models/Model_cmdl.hpp" 35 31 #include "ParticleEngine/ParticleEngineMS.hpp" 36 32 #include "TypeSys.hpp" … … 73 69 0, // ActiveWeaponSequNr 74 70 0.0)), // ActiveWeaponFrameNr 75 FireSound(SoundSystem->CreateSound3D(SoundShaderManager->GetSoundShader("Weapon/Shotgun_dBarrel"))) 76 { 77 FireSound->SetPosition(Params.Origin); 71 m_Model(Params.GameWorld->GetModel("Games/DeathMatch/Models/Weapons/Grenade_w.mdl")), 72 m_FireSound(SoundSystem->CreateSound3D(SoundShaderManager->GetSoundShader("Weapon/Shotgun_dBarrel"))) 73 { 74 m_FireSound->SetPosition(Params.Origin); 78 75 } 79 76 … … 82 79 { 83 80 // Release sound. 84 SoundSystem->DeleteSound( FireSound);81 SoundSystem->DeleteSound(m_FireSound); 85 82 } 86 83 … … 174 171 // We only receive a single event here ("Detonation!"), thus there is no need to look at 'EventID'. 175 172 // Update souud position. 176 FireSound->SetPosition(State.Origin);173 m_FireSound->SetPosition(State.Origin); 177 174 178 175 // Play the fire sound. 179 FireSound->Play();176 m_FireSound->Play(); 180 177 181 178 // Register explosion particles. … … 257 254 if (State.ActiveWeaponFrameNr>0.0) return; 258 255 259 static ModelProxyT RocketModel("Games/DeathMatch/Models/Weapons/Grenade_w.mdl"); 260 261 RocketModel.Draw(State.ModelSequNr, State.ModelFrameNr, LodDist); 262 } 256 AnimPoseT* Pose=m_Model->GetSharedPose(State.ModelSequNr, State.ModelFrameNr); 257 Pose->Draw(-1 /*default skin*/, LodDist); 258 } -
cafu/trunk/Games/DeathMatch/Code/Rocket.hpp
r285 r427 20 20 */ 21 21 22 /***********************/23 /*** Rocket (Header) ***/24 /***********************/25 26 22 #ifndef _ROCKET_HPP_ 27 23 #define _ROCKET_HPP_ … … 30 26 31 27 28 class CafuModelT; 32 29 class EntityCreateParamsT; 33 30 class SoundI; … … 55 52 private: 56 53 57 SoundI* FireSound; 54 const CafuModelT* m_Model; 55 SoundI* m_FireSound; 58 56 }; 59 57 -
cafu/trunk/Games/DeathMatch/Code/StaticDetailModel.cpp
r318 r427 20 20 */ 21 21 22 /**********************************/23 /*** Static Detail Model (Code) ***/24 /**********************************/25 26 22 #include <stdio.h> 27 23 #include <string.h> … … 30 26 #include "StaticDetailModel.hpp" 31 27 #include "EntityCreateParams.hpp" 28 #include "../../GameWorld.hpp" 32 29 #include "TypeSys.hpp" 33 30 #include "ConsoleCommands/Console.hpp" … … 38 35 #include "MaterialSystem/Renderer.hpp" 39 36 #include "Math3D/Matrix.hpp" 37 #include "Models/Model_cmdl.hpp" 40 38 41 39 … … 135 133 0, // ActiveWeaponSequNr 136 134 0.0)), // ActiveWeaponFrameNr 137 Model(""),135 m_Model(NULL), 138 136 m_PlayAnim(State.Flags), 139 137 m_SequNr(State.ModelSequNr), … … 161 159 else if (Key=="model") 162 160 { 163 Model=ModelProxyT(std::string("Games/DeathMatch/")+Value);161 m_Model=GameWorld->GetModel(std::string("Games/DeathMatch/")+Value); 164 162 } 165 163 else if (Key=="sequence") m_SequNr=atoi(Value.c_str()); // Note that the "sequence" key is NOT guaranteed to come after the "model" key! … … 189 187 } 190 188 189 if (!m_Model) 190 m_Model=GameWorld->GetModel(""); 191 191 192 192 193 // Set the proper Dimensions bounding box for this model. … … 194 195 // and it must be properly scaled and rotated for world space. 195 196 VectorT V[8]; 196 Model.GetBB(m_SequNr, 0.0f).AsBoxOfDouble().GetCornerVertices(V);197 m_Model->GetSharedPose(m_SequNr, 0.0f)->GetBB().AsBoxOfDouble().GetCornerVertices(V); 197 198 198 199 for (unsigned int VertexNr=0; VertexNr<8; VertexNr++) … … 287 288 288 289 289 Model.Draw(m_SequNr, m_FrameNr, LodDist); 290 AnimPoseT* Pose=m_Model->GetSharedPose(m_SequNr, m_FrameNr); 291 Pose->Draw(-1 /*default skin*/, LodDist); 290 292 291 293 … … 297 299 Vector3fT GuiAxisY; 298 300 299 if ( Model.GetGuiPlane(m_SequNr, m_FrameNr, LodDist, GuiOrigin, GuiAxisX, GuiAxisY))301 if (m_Model->GetGuiPlane(m_SequNr, m_FrameNr, LodDist, GuiOrigin, GuiAxisX, GuiAxisY)) 300 302 { 301 303 #if 1 … … 344 346 { 345 347 // Advance the client-local animation. 346 m_FrameNr=Model.AdvanceFrameNr(m_SequNr, m_FrameNr, FrameTime, true); 348 AnimPoseT* Pose=m_Model->GetSharedPose(m_SequNr, m_FrameNr); 349 Pose->Advance(FrameTime, true); 350 m_FrameNr=Pose->GetFrameNr(); 347 351 } 348 352 … … 386 390 bool EntStaticDetailModelT::GetGuiPlane(Vector3fT& GuiOrigin, Vector3fT& GuiAxisX, Vector3fT& GuiAxisY) const 387 391 { 388 if (! Model.GetGuiPlane(m_SequNr, m_FrameNr, 0.0, GuiOrigin, GuiAxisX, GuiAxisY)) return false;392 if (!m_Model->GetGuiPlane(m_SequNr, m_FrameNr, 0.0, GuiOrigin, GuiAxisX, GuiAxisY)) return false; 389 393 390 394 // Okay, got the plane. Now transform it from model space into world space. … … 452 456 Ent->State.Events^=(1 << EventID_RestartSequ); 453 457 454 if (Ent->m_SequNr >=int(Ent->Model.GetNrOfSequences())) Ent->m_SequNr=0;458 if (Ent->m_SequNr >= int(Ent->m_Model->GetAnims().Size())) Ent->m_SequNr=0; 455 459 return 0; 456 460 } … … 471 475 EntStaticDetailModelT* Ent=(EntStaticDetailModelT*)cf::GameSys::ScriptStateT::GetCheckedObjectParam(LuaState, 1, TypeInfo); 472 476 473 lua_pushinteger(LuaState, Ent-> Model.GetNrOfSequences());477 lua_pushinteger(LuaState, Ent->m_Model->GetAnims().Size()); 474 478 return 1; 475 479 } -
cafu/trunk/Games/DeathMatch/Code/StaticDetailModel.hpp
r285 r427 20 20 */ 21 21 22 /************************************/23 /*** Static Detail Model (Header) ***/24 /************************************/25 26 22 #ifndef _STATIC_DETAIL_MODEL_HPP_ 27 23 #define _STATIC_DETAIL_MODEL_HPP_ 28 24 29 25 #include "../../BaseEntity.hpp" 30 #include "Models/Model_proxy.hpp"31 26 32 27 28 class CafuModelT; 33 29 class EntityCreateParamsT; 34 30 namespace cf { namespace GuiSys { class GuiI; } } … … 75 71 enum EventIDs { EventID_RestartSequ }; 76 72 77 ModelProxyTModel;73 const CafuModelT* m_Model; 78 74 char& m_PlayAnim; ///< If 1, play the animation, i.e. advance the frames over time. If 0, keep still. This is a reference to State.Flags to have it sync'ed over the network. 79 75 char& m_SequNr; ///< The number of the animation sequence to play. This is a reference to State.ModelSequNr to have it sync'ed over the network. -
cafu/trunk/Games/DeathMatch/Code/Weapon.cpp
r285 r427 20 20 */ 21 21 22 /*********************/23 /*** Weapon (Code) ***/24 /*********************/25 26 22 #include "Weapon.hpp" 27 23 #include "EntityCreateParams.hpp" … … 32 28 #include "../../GameWorld.hpp" 33 29 #include "ConsoleCommands/Console.hpp" 34 #include "Models/Model_ proxy.hpp"30 #include "Models/Model_cmdl.hpp" 35 31 #include "TypeSys.hpp" 36 32 … … 78 74 0, // ActiveWeaponSequNr 79 75 0.0)), // ActiveWeaponFrameNr 80 WeaponModel(ModelName),81 TimeLeftNotActive(2.0),76 m_WeaponModel(Params.GameWorld->GetModel(ModelName)), 77 m_TimeLeftNotActive(2.0), 82 78 PickUp(SoundSystem->CreateSound3D(SoundShaderManager->GetSoundShader("Item/PickUp"))), 83 79 Respawn(SoundSystem->CreateSound3D(SoundShaderManager->GetSoundShader("Item/Respawn"))) … … 106 102 { 107 103 case StateOfExistance_NotActive: 108 TimeLeftNotActive-=FrameTime;109 if ( TimeLeftNotActive<=0.0)104 m_TimeLeftNotActive-=FrameTime; 105 if (m_TimeLeftNotActive<=0.0) 110 106 { 111 107 State.StateOfExistance=StateOfExistance_Active; … … 136 132 if (State.StateOfExistance==StateOfExistance_NotActive) return; 137 133 138 WeaponModel.Draw(0, 0.0, LodDist); 134 AnimPoseT* Pose=m_WeaponModel->GetSharedPose(0, 0.0f); 135 Pose->Draw(-1 /*default skin*/, LodDist); 139 136 140 137 // RotAngle += 234.0*FrameTime; if (RotAngle>360.0) RotAngle-=360.0; -
cafu/trunk/Games/DeathMatch/Code/Weapon.hpp
r285 r427 20 20 */ 21 21 22 /***********************/23 /*** Weapon (Header) ***/24 /***********************/25 26 22 #ifndef _WEAPON_HPP_ 27 23 #define _WEAPON_HPP_ 28 24 29 25 #include "../../BaseEntity.hpp" 30 #include "Models/Model_proxy.hpp"31 26 32 27 28 class CafuModelT; 33 29 class EntityCreateParamsT; 34 30 class SoundI; … … 37 33 class EntWeaponT : public BaseEntityT 38 34 { 39 protected:40 41 enum EventIDs { EventID_PickedUp, EventID_Respawn };42 43 static const char StateOfExistance_Active;44 static const char StateOfExistance_NotActive;45 46 const ModelProxyT WeaponModel; // Could easily get rid of this member, but each item had to provide an own Draw() method then.47 float TimeLeftNotActive;48 49 SoundI* PickUp;50 SoundI* Respawn;51 52 53 35 public: 54 36 … … 66 48 static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params); 67 49 static const cf::TypeSys::TypeInfoT TypeInfo; 50 51 52 protected: 53 54 enum EventIDs { EventID_PickedUp, EventID_Respawn }; 55 56 static const char StateOfExistance_Active; 57 static const char StateOfExistance_NotActive; 58 59 const CafuModelT* m_WeaponModel; 60 float m_TimeLeftNotActive; 61 62 SoundI* PickUp; 63 SoundI* Respawn; 68 64 }; 69 65 -
cafu/trunk/Games/DeathMatch/Code/Weapon357.cpp
r423 r427 70 70 State.StateOfExistance=StateOfExistance_NotActive; 71 71 State.Events^=(1 << EventID_PickedUp); 72 TimeLeftNotActive=5.0;72 m_TimeLeftNotActive=5.0; 73 73 } -
cafu/trunk/Games/DeathMatch/Code/Weapon9mmAR.cpp
r423 r427 70 70 State.StateOfExistance=StateOfExistance_NotActive; 71 71 State.Events^=(1 << EventID_PickedUp); 72 TimeLeftNotActive=5.0;72 m_TimeLeftNotActive=5.0; 73 73 } -
cafu/trunk/Games/DeathMatch/Code/WeaponBattleScythe.cpp
r423 r427 70 70 State.StateOfExistance=StateOfExistance_NotActive; 71 71 State.Events^=(1 << EventID_PickedUp); 72 TimeLeftNotActive=5.0;72 m_TimeLeftNotActive=5.0; 73 73 } -
cafu/trunk/Games/DeathMatch/Code/WeaponCrossbow.cpp
r423 r427 70 70 State.StateOfExistance=StateOfExistance_NotActive; 71 71 State.Events^=(1 << EventID_PickedUp); 72 TimeLeftNotActive=5.0;72 m_TimeLeftNotActive=5.0; 73 73 } -
cafu/trunk/Games/DeathMatch/Code/WeaponEgon.cpp
r423 r427 70 70 State.StateOfExistance=StateOfExistance_NotActive; 71 71 State.Events^=(1 << EventID_PickedUp); 72 TimeLeftNotActive=5.0;72 m_TimeLeftNotActive=5.0; 73 73 } -
cafu/trunk/Games/DeathMatch/Code/WeaponFaceHugger.cpp
r423 r427 70 70 State.StateOfExistance=StateOfExistance_NotActive; 71 71 State.Events^=(1 << EventID_PickedUp); 72 TimeLeftNotActive=5.0;72 m_TimeLeftNotActive=5.0; 73 73 } -
cafu/trunk/Games/DeathMatch/Code/WeaponGauss.cpp
r423 r427 70 70 State.StateOfExistance=StateOfExistance_NotActive; 71 71 State.Events^=(1 << EventID_PickedUp); 72 TimeLeftNotActive=5.0;72 m_TimeLeftNotActive=5.0; 73 73 } -
cafu/trunk/Games/DeathMatch/Code/WeaponGrenade.cpp
r423 r427 70 70 State.StateOfExistance=StateOfExistance_NotActive; 71 71 State.Events^=(1 << EventID_PickedUp); 72 TimeLeftNotActive=5.0;72 m_TimeLeftNotActive=5.0; 73 73 } -
cafu/trunk/Games/DeathMatch/Code/WeaponHornetGun.cpp
r423 r427 75 75 State.StateOfExistance=StateOfExistance_NotActive; 76 76 State.Events^=(1 << EventID_PickedUp); 77 TimeLeftNotActive=5.0;77 m_TimeLeftNotActive=5.0; 78 78 } -
cafu/trunk/Games/DeathMatch/Code/WeaponPistol.cpp
r423 r427 70 70 State.StateOfExistance=StateOfExistance_NotActive; 71 71 State.Events^=(1 << EventID_PickedUp); 72 TimeLeftNotActive=5.0;72 m_TimeLeftNotActive=5.0; 73 73 } -
cafu/trunk/Games/DeathMatch/Code/WeaponRPG.cpp
r423 r427 70 70 State.StateOfExistance=StateOfExistance_NotActive; 71 71 State.Events^=(1 << EventID_PickedUp); 72 TimeLeftNotActive=5.0;72 m_TimeLeftNotActive=5.0; 73 73 } -
cafu/trunk/Games/DeathMatch/Code/WeaponShotgun.cpp
r423 r427 70 70 State.StateOfExistance=StateOfExistance_NotActive; 71 71 State.Events^=(1 << EventID_PickedUp); 72 TimeLeftNotActive=5.0;72 m_TimeLeftNotActive=5.0; 73 73 } -
cafu/trunk/Games/DeathMatch/Code/WeaponTripmine.cpp
r423 r427 87 87 State.StateOfExistance=StateOfExistance_NotActive; 88 88 State.Events^=(1 << EventID_PickedUp); 89 TimeLeftNotActive=5.0;89 m_TimeLeftNotActive=5.0; 90 90 } -
cafu/trunk/Libs/Models/Model_cmdl.cpp
r414 r427 205 205 } 206 206 } 207 } 208 209 210 bool CafuModelT::AnimT::IsLastFrameDup() const 211 { 212 if (Frames.Size() < 2) return false; 213 214 return Frames[0].AnimData == Frames[Frames.Size()-1].AnimData; 207 215 } 208 216 -
cafu/trunk/Libs/Models/Model_cmdl.hpp
r422 r427 210 210 void RecomputeBB(unsigned int FrameNr, const ArrayT<JointT>& Joints, const ArrayT<MeshT>& Meshes); 211 211 212 /// Returns whether the first frame in the sequence is equal to the last. 213 /// The editor may use this to ask the user if he wishes to delete the last frame. 214 bool IsLastFrameDup() const; 212 215 213 216 std::string Name; ///< Name of this animation sequence.
