Changeset 427 for cafu/trunk

Show
Ignore:
Timestamp:
11/19/11 21:12:38 (6 months ago)
Author:
Carsten
Message:

Model code:
Replaced all remaining occurrences of obsolete class ModelProxyT with new model class CafuModelT.

Location:
cafu/trunk
Files:
38 modified

Legend:

Unmodified
Added
Removed
  • cafu/trunk/CaWE/ModelEditor/AnimInspector.cpp

    r322 r427  
    111111 
    112112        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        // } 
    113119    } 
    114120    else 
  • cafu/trunk/CaWE/ModelEditor/ChildFrame.hpp

    r407 r427  
    8989 
    9090        /// 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; } 
    9292 
    9393        ModelDocumentT* GetModelDoc() const { return m_ModelDoc; } 
  • cafu/trunk/Games/DeathMatch/Code/ARGrenade.cpp

    r285 r427  
    1919================================================================================= 
    2020*/ 
    21  
    22 /*************************/ 
    23 /*** AR Grenade (Code) ***/ 
    24 /*************************/ 
    2521 
    2622#include "ARGrenade.hpp" 
     
    3329#include "SoundSystem/SoundShaderManager.hpp" 
    3430#include "../../GameWorld.hpp" 
    35 #include "Models/Model_proxy.hpp" 
     31#include "Models/Model_cmdl.hpp" 
    3632#include "ParticleEngine/ParticleEngineMS.hpp" 
    3733 
     
    7369                               0,       // ActiveWeaponSequNr 
    7470                               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"))) 
    7673{ 
    7774} 
     
    8178{ 
    8279    // Release sound. 
    83     SoundSystem->DeleteSound(FireSound); 
     80    SoundSystem->DeleteSound(m_FireSound); 
    8481} 
    8582 
     
    185182    // We only receive a single event here ("Detonation!"), thus there is no need to look at 'EventID'. 
    186183    // Update sound position. 
    187     FireSound->SetPosition(State.Origin); 
     184    m_FireSound->SetPosition(State.Origin); 
    188185 
    189186    // Play the fire sound. 
    190     FireSound->Play(); 
     187    m_FireSound->Play(); 
    191188 
    192189    // Register explosion particles. 
     
    273270    // glTranslatef(0.0, 0.0, 4.0); 
    274271 
    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  
    2020*/ 
    2121 
    22 /***************************/ 
    23 /*** AR Grenade (Header) ***/ 
    24 /***************************/ 
    25  
    2622#ifndef _ARGRENADE_HPP_ 
    2723#define _ARGRENADE_HPP_ 
     
    3026 
    3127 
     28class CafuModelT; 
    3229class EntityCreateParamsT; 
    3330class SoundI; 
     
    5552    private: 
    5653 
    57     SoundI* FireSound; 
     54    const CafuModelT* m_Model; 
     55    SoundI*           m_FireSound; 
    5856}; 
    5957 
  • cafu/trunk/Games/DeathMatch/Code/Butterfly.cpp

    r285 r427  
    2020*/ 
    2121 
    22 /************************/ 
    23 /*** Butterfly (Code) ***/ 
    24 /************************/ 
    25  
    2622#include "Butterfly.hpp" 
    2723#include "TypeSys.hpp" 
    2824#include "EntityCreateParams.hpp" 
    2925#include "Libs/LookupTables.hpp" 
    30 #include "Models/Model_proxy.hpp" 
     26#include "../../GameWorld.hpp" 
     27#include "Models/Model_cmdl.hpp" 
    3128 
    3229 
     
    6764                               0,       // ActiveWeaponSequNr 
    6865                               0.0)),   // ActiveWeaponFrameNr 
     66      m_Model(Params.GameWorld->GetModel("Games/DeathMatch/Models/LifeForms/Butterfly.mdl")), 
    6967      ArcCenter(Params.Origin), 
    7068      ArcPos(0) 
     
    9290void EntButterflyT::Draw(bool /*FirstPersonView*/, float LodDist) const 
    9391{ 
    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); 
    9794} 
    9895 
     
    10097void EntButterflyT::PostDraw(float FrameTime, bool /*FirstPersonView*/) 
    10198{ 
    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  
    10799    // 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(); 
    109103} 
  • cafu/trunk/Games/DeathMatch/Code/Butterfly.hpp

    r285 r427  
    2020*/ 
    2121 
    22 /**************************/ 
    23 /*** Butterfly (Header) ***/ 
    24 /**************************/ 
    25  
    2622#ifndef _BUTTERFLY_HPP_ 
    2723#define _BUTTERFLY_HPP_ 
     
    3026 
    3127 
     28class CafuModelT; 
    3229class EntityCreateParamsT; 
    3330 
     
    3532class EntButterflyT : public BaseEntityT 
    3633{ 
    37     private: 
    38  
    39     VectorT        ArcCenter; 
    40     unsigned short ArcPos; 
    41  
    42  
    4334    public: 
    4435 
     
    5344    static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params); 
    5445    static const cf::TypeSys::TypeInfoT TypeInfo; 
     46 
     47 
     48    private: 
     49 
     50    const CafuModelT* m_Model; 
     51    VectorT           ArcCenter; 
     52    unsigned short    ArcPos; 
    5553}; 
    5654 
  • cafu/trunk/Games/DeathMatch/Code/Eagle.cpp

    r285 r427  
    2020*/ 
    2121 
    22 /********************/ 
    23 /*** Eagle (Code) ***/ 
    24 /********************/ 
    25  
    2622#include "Eagle.hpp" 
    2723#include "EntityCreateParams.hpp" 
     
    3329#include "MaterialSystem/Material.hpp" 
    3430#include "MaterialSystem/Renderer.hpp" 
     31#include "Models/Model_cmdl.hpp" 
    3532#include "SoundSystem/SoundSys.hpp" 
    3633#include "SoundSystem/Sound.hpp" 
     
    7572                               0,       // ActiveWeaponSequNr 
    7673                               0.0)),   // ActiveWeaponFrameNr 
    77       EagleModel("Games/DeathMatch/Models/LifeForms/Eagle.mdl"), 
     74      m_Model(Params.GameWorld->GetModel("Games/DeathMatch/Models/LifeForms/Eagle.mdl")), 
    7875      FlightState(CruiseFlight), 
    7976      OldOrigin(), 
     
    229226    MatSys::Renderer->SetCurrentEyePosition(EyePos.x, EyePos.y, EyePos.z); 
    230227 
    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); 
    232230} 
    233231 
     
    235233void EntEagleT::PostDraw(float FrameTime, bool /*FirstPersonView*/) 
    236234{ 
    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(); 
    238238 
    239239    // Update sound position and velocity. 
  • cafu/trunk/Games/DeathMatch/Code/Eagle.hpp

    r285 r427  
    2020*/ 
    2121 
    22 /**********************/ 
    23 /*** Eagle (Header) ***/ 
    24 /**********************/ 
    25  
    2622#ifndef _EAGLE_HPP_ 
    2723#define _EAGLE_HPP_ 
    2824 
    2925#include "../../BaseEntity.hpp" 
    30 #include "Models/Model_proxy.hpp" 
    3126 
    3227 
     28class CafuModelT; 
    3329class EntityCreateParamsT; 
    3430class SoundI; 
     
    3733class EntEagleT : public BaseEntityT 
    3834{ 
    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  
    5535    public: 
    5636 
     
    6646    static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params); 
    6747    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; 
    6863}; 
    6964 
  • cafu/trunk/Games/DeathMatch/Code/FaceHugger.cpp

    r285 r427  
    2020*/ 
    2121 
    22 /**************************/ 
    23 /*** Face Hugger (Code) ***/ 
    24 /**************************/ 
    25  
    2622#include "FaceHugger.hpp" 
    2723#include "EntityCreateParams.hpp" 
     
    3026#include "Libs/Physics.hpp"                         // ÜBERFLÜSSIG? 
    3127#include "TypeSys.hpp" 
    32 #include "Models/Model_proxy.hpp" 
     28#include "Models/Model_cmdl.hpp" 
    3329#include "ParticleEngine/ParticleEngineMS.hpp" 
    3430 
     
    6965                               0,       // ActiveWeaponSlot 
    7066                               0,       // ActiveWeaponSequNr 
    71                                0.0))    // ActiveWeaponFrameNr 
     67                               0.0)),   // ActiveWeaponFrameNr 
     68      m_Model(Params.GameWorld->GetModel("Games/DeathMatch/Models/LifeForms/FaceHugger.mdl")) 
    7269{ 
    7370} 
     
    109106void EntFaceHuggerT::Draw(bool /*FirstPersonView*/, float LodDist) const 
    110107{ 
    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); 
    114110} 
    115111 
     
    117113void EntFaceHuggerT::PostDraw(float FrameTime, bool /*FirstPersonView*/) 
    118114{ 
    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); 
    123117 
    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(); 
    130120 
    131121    if (SequenceWrap) 
  • cafu/trunk/Games/DeathMatch/Code/FaceHugger.hpp

    r285 r427  
    2020*/ 
    2121 
    22 /****************************/ 
    23 /*** Face Hugger (Header) ***/ 
    24 /****************************/ 
    25  
    2622#ifndef _FACEHUGGER_HPP_ 
    2723#define _FACEHUGGER_HPP_ 
     
    3026 
    3127 
     28class CafuModelT; 
    3229class EntityCreateParamsT; 
    3330 
     
    3532class EntFaceHuggerT : public BaseEntityT 
    3633{ 
    37  // private: 
    38  
    39  // unsigned long TargetEntityID;   // ID of the entity that this face hugger attacks. 
    40  
    41  
    4234    public: 
    4335 
     
    5244    static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params); 
    5345    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. 
    5452}; 
    5553 
  • cafu/trunk/Games/DeathMatch/Code/GameImpl.cpp

    r423 r427  
    127127        // On the other hand, registering materials can only be done *after* GetGame() was called. 
    128128        // 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 of each. 
     129        // Registering the materials that our models will use is quite easy, because we just need to find them in the ModelMan each. 
    130130        // (Nothing breaks if the following list is simply deleted, these models just aren't pre-cached then.) 
    131131        // 
     
    138138        { 
    139139            // 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"); 
    160160        } 
    161161 
  • cafu/trunk/Games/DeathMatch/Code/HandGrenade.cpp

    r285 r427  
    1919================================================================================= 
    2020*/ 
    21  
    22 /***************************/ 
    23 /*** Hand Grenade (Code) ***/ 
    24 /***************************/ 
    2521 
    2622#include "HandGrenade.hpp" 
     
    3329#include "SoundSystem/SoundShaderManager.hpp" 
    3430#include "../../GameWorld.hpp" 
    35 #include "Models/Model_proxy.hpp" 
     31#include "Models/Model_cmdl.hpp" 
    3632#include "ParticleEngine/ParticleEngineMS.hpp" 
    3733 
     
    7369                               0,       // ActiveWeaponSequNr 
    7470                               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); 
    7875} 
    7976 
     
    8279{ 
    8380    // Release sound. 
    84     SoundSystem->DeleteSound(FireSound); 
     81    SoundSystem->DeleteSound(m_FireSound); 
    8582} 
    8683 
     
    177174    // We only receive a single event here ("Detonation!"), thus there is no need to look at 'EventID'. 
    178175    // Update sound position. 
    179     FireSound->SetPosition(State.Origin); 
     176    m_FireSound->SetPosition(State.Origin); 
    180177 
    181178    // Play the fire sound. 
    182     FireSound->Play(); 
     179    m_FireSound->Play(); 
    183180 
    184181    // Register explosion particles. 
     
    256253    if (State.ActiveWeaponFrameNr>=3.0) return; 
    257254 
    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  
    2020*/ 
    2121 
    22 /*****************************/ 
    23 /*** Hand Grenade (Header) ***/ 
    24 /*****************************/ 
    25  
    2622#ifndef _HANDGRENADE_HPP_ 
    2723#define _HANDGRENADE_HPP_ 
     
    3026 
    3127 
     28class CafuModelT; 
    3229class EntityCreateParamsT; 
    3330class SoundI; 
     
    5552    private: 
    5653 
    57     SoundI* FireSound; 
     54    const CafuModelT* m_Model; 
     55    SoundI*           m_FireSound; 
    5856}; 
    5957 
  • cafu/trunk/Games/DeathMatch/Code/Item.cpp

    r285 r427  
    2020*/ 
    2121 
    22 /*******************/ 
    23 /*** Item (Code) ***/ 
    24 /*******************/ 
    25  
    2622#include "Item.hpp" 
    2723#include "EntityCreateParams.hpp" 
     
    3228#include "../../GameWorld.hpp" 
    3329#include "ConsoleCommands/Console.hpp" 
    34 #include "Models/Model_proxy.hpp" 
     30#include "Models/Model_cmdl.hpp" 
    3531#include "TypeSys.hpp" 
    3632 
     
    7874                               0,                           // ActiveWeaponSequNr 
    7975                               0.0)),                       // ActiveWeaponFrameNr 
    80       ItemModel(ModelName), 
    81       TimeLeftNotActive(2.0), 
     76      m_ItemModel(Params.GameWorld->GetModel(ModelName)), 
     77      m_TimeLeftNotActive(2.0), 
    8278      PickUp(SoundSystem->CreateSound3D(SoundShaderManager->GetSoundShader("Item/PickUp"))), 
    8379      Respawn(SoundSystem->CreateSound3D(SoundShaderManager->GetSoundShader("Item/Respawn"))) 
     
    106102    { 
    107103        case StateOfExistance_NotActive: 
    108             TimeLeftNotActive-=FrameTime; 
    109             if (TimeLeftNotActive<=0.0) 
     104            m_TimeLeftNotActive-=FrameTime; 
     105            if (m_TimeLeftNotActive<=0.0) 
    110106            { 
    111107                State.StateOfExistance=StateOfExistance_Active; 
     
    136132    if (State.StateOfExistance==StateOfExistance_NotActive) return; 
    137133 
    138     ItemModel.Draw(0, 0.0, LodDist); 
     134    AnimPoseT* Pose=m_ItemModel->GetSharedPose(0, 0.0f); 
     135    Pose->Draw(-1 /*default skin*/, LodDist); 
    139136 
    140137    // RotAngle  +=  234.0*FrameTime; if (RotAngle>360.0) RotAngle-=360.0; 
  • cafu/trunk/Games/DeathMatch/Code/Item.hpp

    r285 r427  
    2020*/ 
    2121 
    22 /*********************/ 
    23 /*** Item (Header) ***/ 
    24 /*********************/ 
    25  
    2622#ifndef _ITEM_HPP_ 
    2723#define _ITEM_HPP_ 
    2824 
    2925#include "../../BaseEntity.hpp" 
    30 #include "Models/Model_proxy.hpp" 
    3126 
    3227 
     28class CafuModelT; 
    3329class EntityCreateParamsT; 
    3430class SoundI; 
     
    3733class EntItemT : public BaseEntityT 
    3834{ 
    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  
    5335    public: 
    5436 
     
    6648    static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params); 
    6749    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; 
    6864}; 
    6965 
  • cafu/trunk/Games/DeathMatch/Code/ItemAmmo357.cpp

    r285 r427  
    7373    State.StateOfExistance=StateOfExistance_NotActive; 
    7474    State.Events^=(1 << EventID_PickedUp); 
    75     TimeLeftNotActive=5.0; 
     75    m_TimeLeftNotActive=5.0; 
    7676} 
  • cafu/trunk/Games/DeathMatch/Code/ItemAmmoArrow.cpp

    r285 r427  
    7373    State.StateOfExistance=StateOfExistance_NotActive; 
    7474    State.Events^=(1 << EventID_PickedUp); 
    75     TimeLeftNotActive=5.0; 
     75    m_TimeLeftNotActive=5.0; 
    7676} 
  • cafu/trunk/Games/DeathMatch/Code/Rocket.cpp

    r285 r427  
    1919================================================================================= 
    2020*/ 
    21  
    22 /*********************/ 
    23 /*** Rocket (Code) ***/ 
    24 /*********************/ 
    2521 
    2622#include "Rocket.hpp" 
     
    3228#include "SoundSystem/SoundShaderManager.hpp" 
    3329#include "../../GameWorld.hpp" 
    34 #include "Models/Model_proxy.hpp" 
     30#include "Models/Model_cmdl.hpp" 
    3531#include "ParticleEngine/ParticleEngineMS.hpp" 
    3632#include "TypeSys.hpp" 
     
    7369                               0,       // ActiveWeaponSequNr 
    7470                               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); 
    7875} 
    7976 
     
    8279{ 
    8380    // Release sound. 
    84     SoundSystem->DeleteSound(FireSound); 
     81    SoundSystem->DeleteSound(m_FireSound); 
    8582} 
    8683 
     
    174171    // We only receive a single event here ("Detonation!"), thus there is no need to look at 'EventID'. 
    175172    // Update souud position. 
    176     FireSound->SetPosition(State.Origin); 
     173    m_FireSound->SetPosition(State.Origin); 
    177174 
    178175    // Play the fire sound. 
    179     FireSound->Play(); 
     176    m_FireSound->Play(); 
    180177 
    181178    // Register explosion particles. 
     
    257254    if (State.ActiveWeaponFrameNr>0.0) return; 
    258255 
    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  
    2020*/ 
    2121 
    22 /***********************/ 
    23 /*** Rocket (Header) ***/ 
    24 /***********************/ 
    25  
    2622#ifndef _ROCKET_HPP_ 
    2723#define _ROCKET_HPP_ 
     
    3026 
    3127 
     28class CafuModelT; 
    3229class EntityCreateParamsT; 
    3330class SoundI; 
     
    5552    private: 
    5653 
    57     SoundI* FireSound; 
     54    const CafuModelT* m_Model; 
     55    SoundI*           m_FireSound; 
    5856}; 
    5957 
  • cafu/trunk/Games/DeathMatch/Code/StaticDetailModel.cpp

    r318 r427  
    2020*/ 
    2121 
    22 /**********************************/ 
    23 /*** Static Detail Model (Code) ***/ 
    24 /**********************************/ 
    25  
    2622#include <stdio.h> 
    2723#include <string.h> 
     
    3026#include "StaticDetailModel.hpp" 
    3127#include "EntityCreateParams.hpp" 
     28#include "../../GameWorld.hpp" 
    3229#include "TypeSys.hpp" 
    3330#include "ConsoleCommands/Console.hpp" 
     
    3835#include "MaterialSystem/Renderer.hpp" 
    3936#include "Math3D/Matrix.hpp" 
     37#include "Models/Model_cmdl.hpp" 
    4038 
    4139 
     
    135133                               0,       // ActiveWeaponSequNr 
    136134                               0.0)),   // ActiveWeaponFrameNr 
    137       Model(""), 
     135      m_Model(NULL), 
    138136      m_PlayAnim(State.Flags), 
    139137      m_SequNr(State.ModelSequNr), 
     
    161159        else if (Key=="model") 
    162160        { 
    163             Model=ModelProxyT(std::string("Games/DeathMatch/")+Value); 
     161            m_Model=GameWorld->GetModel(std::string("Games/DeathMatch/")+Value); 
    164162        } 
    165163        else if (Key=="sequence") m_SequNr=atoi(Value.c_str());    // Note that the "sequence" key is NOT guaranteed to come after the "model" key! 
     
    189187    } 
    190188 
     189    if (!m_Model) 
     190        m_Model=GameWorld->GetModel(""); 
     191 
    191192 
    192193    // Set the proper Dimensions bounding box for this model. 
     
    194195    // and it must be properly scaled and rotated for world space. 
    195196    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); 
    197198 
    198199    for (unsigned int VertexNr=0; VertexNr<8; VertexNr++) 
     
    287288 
    288289 
    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); 
    290292 
    291293 
     
    297299        Vector3fT GuiAxisY; 
    298300 
    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)) 
    300302        { 
    301303#if 1 
     
    344346    { 
    345347        // 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(); 
    347351    } 
    348352 
     
    386390bool EntStaticDetailModelT::GetGuiPlane(Vector3fT& GuiOrigin, Vector3fT& GuiAxisX, Vector3fT& GuiAxisY) const 
    387391{ 
    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; 
    389393 
    390394    // Okay, got the plane. Now transform it from model space into world space. 
     
    452456    Ent->State.Events^=(1 << EventID_RestartSequ); 
    453457 
    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; 
    455459    return 0; 
    456460} 
     
    471475    EntStaticDetailModelT* Ent=(EntStaticDetailModelT*)cf::GameSys::ScriptStateT::GetCheckedObjectParam(LuaState, 1, TypeInfo); 
    472476 
    473     lua_pushinteger(LuaState, Ent->Model.GetNrOfSequences()); 
     477    lua_pushinteger(LuaState, Ent->m_Model->GetAnims().Size()); 
    474478    return 1; 
    475479} 
  • cafu/trunk/Games/DeathMatch/Code/StaticDetailModel.hpp

    r285 r427  
    2020*/ 
    2121 
    22 /************************************/ 
    23 /*** Static Detail Model (Header) ***/ 
    24 /************************************/ 
    25  
    2622#ifndef _STATIC_DETAIL_MODEL_HPP_ 
    2723#define _STATIC_DETAIL_MODEL_HPP_ 
    2824 
    2925#include "../../BaseEntity.hpp" 
    30 #include "Models/Model_proxy.hpp" 
    3126 
    3227 
     28class CafuModelT; 
    3329class EntityCreateParamsT; 
    3430namespace cf { namespace GuiSys { class GuiI; } } 
     
    7571    enum EventIDs { EventID_RestartSequ }; 
    7672 
    77     ModelProxyT       Model; 
     73    const CafuModelT* m_Model; 
    7874    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. 
    7975    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  
    2020*/ 
    2121 
    22 /*********************/ 
    23 /*** Weapon (Code) ***/ 
    24 /*********************/ 
    25  
    2622#include "Weapon.hpp" 
    2723#include "EntityCreateParams.hpp" 
     
    3228#include "../../GameWorld.hpp" 
    3329#include "ConsoleCommands/Console.hpp" 
    34 #include "Models/Model_proxy.hpp" 
     30#include "Models/Model_cmdl.hpp" 
    3531#include "TypeSys.hpp" 
    3632 
     
    7874                               0,                           // ActiveWeaponSequNr 
    7975                               0.0)),                       // ActiveWeaponFrameNr 
    80       WeaponModel(ModelName), 
    81       TimeLeftNotActive(2.0), 
     76      m_WeaponModel(Params.GameWorld->GetModel(ModelName)), 
     77      m_TimeLeftNotActive(2.0), 
    8278      PickUp(SoundSystem->CreateSound3D(SoundShaderManager->GetSoundShader("Item/PickUp"))), 
    8379      Respawn(SoundSystem->CreateSound3D(SoundShaderManager->GetSoundShader("Item/Respawn"))) 
     
    106102    { 
    107103        case StateOfExistance_NotActive: 
    108             TimeLeftNotActive-=FrameTime; 
    109             if (TimeLeftNotActive<=0.0) 
     104            m_TimeLeftNotActive-=FrameTime; 
     105            if (m_TimeLeftNotActive<=0.0) 
    110106            { 
    111107                State.StateOfExistance=StateOfExistance_Active; 
     
    136132    if (State.StateOfExistance==StateOfExistance_NotActive) return; 
    137133 
    138     WeaponModel.Draw(0, 0.0, LodDist); 
     134    AnimPoseT* Pose=m_WeaponModel->GetSharedPose(0, 0.0f); 
     135    Pose->Draw(-1 /*default skin*/, LodDist); 
    139136 
    140137    // RotAngle  +=  234.0*FrameTime; if (RotAngle>360.0) RotAngle-=360.0; 
  • cafu/trunk/Games/DeathMatch/Code/Weapon.hpp

    r285 r427  
    2020*/ 
    2121 
    22 /***********************/ 
    23 /*** Weapon (Header) ***/ 
    24 /***********************/ 
    25  
    2622#ifndef _WEAPON_HPP_ 
    2723#define _WEAPON_HPP_ 
    2824 
    2925#include "../../BaseEntity.hpp" 
    30 #include "Models/Model_proxy.hpp" 
    3126 
    3227 
     28class CafuModelT; 
    3329class EntityCreateParamsT; 
    3430class SoundI; 
     
    3733class EntWeaponT : public BaseEntityT 
    3834{ 
    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  
    5335    public: 
    5436 
     
    6648    static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params); 
    6749    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; 
    6864}; 
    6965 
  • cafu/trunk/Games/DeathMatch/Code/Weapon357.cpp

    r423 r427  
    7070    State.StateOfExistance=StateOfExistance_NotActive; 
    7171    State.Events^=(1 << EventID_PickedUp); 
    72     TimeLeftNotActive=5.0; 
     72    m_TimeLeftNotActive=5.0; 
    7373} 
  • cafu/trunk/Games/DeathMatch/Code/Weapon9mmAR.cpp

    r423 r427  
    7070    State.StateOfExistance=StateOfExistance_NotActive; 
    7171    State.Events^=(1 << EventID_PickedUp); 
    72     TimeLeftNotActive=5.0; 
     72    m_TimeLeftNotActive=5.0; 
    7373} 
  • cafu/trunk/Games/DeathMatch/Code/WeaponBattleScythe.cpp

    r423 r427  
    7070    State.StateOfExistance=StateOfExistance_NotActive; 
    7171    State.Events^=(1 << EventID_PickedUp); 
    72     TimeLeftNotActive=5.0; 
     72    m_TimeLeftNotActive=5.0; 
    7373} 
  • cafu/trunk/Games/DeathMatch/Code/WeaponCrossbow.cpp

    r423 r427  
    7070    State.StateOfExistance=StateOfExistance_NotActive; 
    7171    State.Events^=(1 << EventID_PickedUp); 
    72     TimeLeftNotActive=5.0; 
     72    m_TimeLeftNotActive=5.0; 
    7373} 
  • cafu/trunk/Games/DeathMatch/Code/WeaponEgon.cpp

    r423 r427  
    7070    State.StateOfExistance=StateOfExistance_NotActive; 
    7171    State.Events^=(1 << EventID_PickedUp); 
    72     TimeLeftNotActive=5.0; 
     72    m_TimeLeftNotActive=5.0; 
    7373} 
  • cafu/trunk/Games/DeathMatch/Code/WeaponFaceHugger.cpp

    r423 r427  
    7070    State.StateOfExistance=StateOfExistance_NotActive; 
    7171    State.Events^=(1 << EventID_PickedUp); 
    72     TimeLeftNotActive=5.0; 
     72    m_TimeLeftNotActive=5.0; 
    7373} 
  • cafu/trunk/Games/DeathMatch/Code/WeaponGauss.cpp

    r423 r427  
    7070    State.StateOfExistance=StateOfExistance_NotActive; 
    7171    State.Events^=(1 << EventID_PickedUp); 
    72     TimeLeftNotActive=5.0; 
     72    m_TimeLeftNotActive=5.0; 
    7373} 
  • cafu/trunk/Games/DeathMatch/Code/WeaponGrenade.cpp

    r423 r427  
    7070    State.StateOfExistance=StateOfExistance_NotActive; 
    7171    State.Events^=(1 << EventID_PickedUp); 
    72     TimeLeftNotActive=5.0; 
     72    m_TimeLeftNotActive=5.0; 
    7373} 
  • cafu/trunk/Games/DeathMatch/Code/WeaponHornetGun.cpp

    r423 r427  
    7575    State.StateOfExistance=StateOfExistance_NotActive; 
    7676    State.Events^=(1 << EventID_PickedUp); 
    77     TimeLeftNotActive=5.0; 
     77    m_TimeLeftNotActive=5.0; 
    7878} 
  • cafu/trunk/Games/DeathMatch/Code/WeaponPistol.cpp

    r423 r427  
    7070    State.StateOfExistance=StateOfExistance_NotActive; 
    7171    State.Events^=(1 << EventID_PickedUp); 
    72     TimeLeftNotActive=5.0; 
     72    m_TimeLeftNotActive=5.0; 
    7373} 
  • cafu/trunk/Games/DeathMatch/Code/WeaponRPG.cpp

    r423 r427  
    7070    State.StateOfExistance=StateOfExistance_NotActive; 
    7171    State.Events^=(1 << EventID_PickedUp); 
    72     TimeLeftNotActive=5.0; 
     72    m_TimeLeftNotActive=5.0; 
    7373} 
  • cafu/trunk/Games/DeathMatch/Code/WeaponShotgun.cpp

    r423 r427  
    7070    State.StateOfExistance=StateOfExistance_NotActive; 
    7171    State.Events^=(1 << EventID_PickedUp); 
    72     TimeLeftNotActive=5.0; 
     72    m_TimeLeftNotActive=5.0; 
    7373} 
  • cafu/trunk/Games/DeathMatch/Code/WeaponTripmine.cpp

    r423 r427  
    8787    State.StateOfExistance=StateOfExistance_NotActive; 
    8888    State.Events^=(1 << EventID_PickedUp); 
    89     TimeLeftNotActive=5.0; 
     89    m_TimeLeftNotActive=5.0; 
    9090} 
  • cafu/trunk/Libs/Models/Model_cmdl.cpp

    r414 r427  
    205205        } 
    206206    } 
     207} 
     208 
     209 
     210bool CafuModelT::AnimT::IsLastFrameDup() const 
     211{ 
     212    if (Frames.Size() < 2) return false; 
     213 
     214    return Frames[0].AnimData == Frames[Frames.Size()-1].AnimData; 
    207215} 
    208216 
  • cafu/trunk/Libs/Models/Model_cmdl.hpp

    r422 r427  
    210210        void RecomputeBB(unsigned int FrameNr, const ArrayT<JointT>& Joints, const ArrayT<MeshT>& Meshes); 
    211211 
     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; 
    212215 
    213216        std::string        Name;            ///< Name of this animation sequence.