- Main Page
- Classes
- Files

- File List
- File Members

# E:/uas2/Server/cItemModels.h

Go to the documentation of this file.

    00001 /*
    00002 * This file is part of UAS2.
    00003 *
    00004 * UAS2 is free software; you can redistribute it and/or modify
    00005 * it under the terms of the GNU General Public License as published by
    00006 * the Free Software Foundation; either version 2 of the License, or
    00007 * (at your option) any later version.
    00008 *
    00009 * UAS2 is distributed in the hope that it will be useful,
    00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012 * GNU General Public License for more details.
    00013
    00014 * You should have received a copy of the GNU General Public License
    00015 * along with UASv1; if not, write to the Free Software
    00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00017 */
    00018
    00023 #define ITEM_MODEL_TABLE_SIZE 4000
    00024
    00025 #if _MSC_VER > 1000
    00026 #pragma once
    00027 #endif // _MSC_VER > 1000
    00028 #include <winsock2.h>
    00029 #include "shared.h"
    00030
    00031 class cItemModels
    00032 {
    00033         friend class cMasterServer;
    00034         friend class cObject;
    00035         friend class cWeapon;
    00036
    00037 public:
    00038         cItemModels( DWORD dwModelID, BOOL fAddToHash = TRUE )
    00039                         :       m_dwModelID( dwModelID ),
    00040                                 m_pcPrev                ( NULL ),
    00041                                 m_pcNext                ( NULL )
    00042         {
    00043
    00044                 if( fAddToHash )
    00045                 Hash_Add( this );
    00046
    00047         }
    00048         virtual ~cItemModels()
    00049         {
    00050                 if ( m_pcPrev ) m_pcPrev->m_pcNext = m_pcNext;
    00051                 else                    m_lpcHashTable[m_dwModelID] = m_pcNext;
    00052                 if ( m_pcNext ) m_pcNext->m_pcPrev = m_pcPrev;
    00053         }
    00054
    00055         static inline void Hash_Load( )
    00056         {
    00057                 ZeroMemory( m_lpcHashTable, sizeof( m_lpcHashTable ) );
    00058         }
    00059
    00060         static inline cItemModels *Hash_New( DWORD& dwModelID )
    00061         {
    00062                 cItemModels *pcModel = Hash_Find( dwModelID );
    00063                 if ( pcModel )
    00064                         return pcModel;
    00065
    00066                 return new cItemModels( dwModelID ) ;
    00067         }
    00068
    00069         static void             Hash_Erase      ( );
    00070         static void             Hash_Remove     ( cItemModels *pcModel );
    00071         static cItemModels      *FindModel      ( DWORD dwModelID );
    00072
    00073         bool                    m_clothingModelLoaded;
    00074
    00075         std::string             m_strName;
    00076         std::string             m_strDescription;
    00077         DWORD                   m_PortalLinker;
    00078         DWORD                   m_dwModelID;
    00079
    00080         // Model vectors
    00081         BYTE                    m_bPaletteChange;
    00082         DWORD                   m_wPaletteVector;
    00083         sPaletteChange  m_vectorPal[255];
    00084
    00085         BYTE                    m_bTextureChange;
    00086         DWORD                   m_wTextureVector;
    00087         sTextureChange  m_vectorTex[255];
    00088
    00089         BYTE                    m_bModelChange;
    00090         DWORD                   m_wModelVector;
    00091         sModelChange    m_vectorMod[255];
    00092
    00093         // Model clothing vectors
    00094         BYTE                    m_bWearPaletteChange;
    00095         DWORD                   m_wWearPaletteVector;
    00096         sPaletteChange  m_WearVectorPal[255];
    00097
    00098         BYTE                    m_bWearTextureChange;
    00099         DWORD                   m_wWearTextureVector;
    00100         sTextureChange  m_WearVectorTex[255];
    00101
    00102         BYTE                    m_bWearModelChange;
    00103         DWORD                   m_wWearModelVector;
    00104         sModelChange    m_WearVectorMod[255];
    00105
    00106         WORD                    m_wPortalMode;
    00107         WORD                    m_wUnknown_1;
    00108
    00109         DWORD                   m_dwUnknownCount;
    00110         DWORD                   m_dwUnknownDword;
    00111         DWORD                   m_dwUnknown;
    00112         WORD                    m_wSeagreen8;
    00113         WORD                    m_wSeagreen10;
    00114
    00115         WORD                    m_wModel;
    00116         WORD                    m_wIcon;
    00117         WORD                    m_wSoundSet;
    00118
    00119         DWORD                   m_dwModelNumber;
    00120         DWORD                   m_dwObjectFlags1;
    00121         DWORD                   m_dwObjectFlags2;
    00122         DWORD                   m_dwFlags1;
    00123         DWORD                   m_dwFlags2;
    00124         WORD                    m_wUnknown1;
    00125         DWORD                   m_dwUnknown_Blue;
    00126         float                   m_flScale;
    00127         DWORD                   m_dwUnknown_LightGrey;
    00128         DWORD                   m_dwTrio1[3];
    00129         DWORD                   m_dwTrio2[3];
    00130         DWORD                   m_dwTrio3[3];
    00131         DWORD                   m_dwMedGrey;
    00132         DWORD                   m_dwBlueGrey;
    00133         DWORD                   m_dwUnknown_v2;
    00134         DWORD                   m_dwUnknown_v6;
    00135
    00136         //Item specific values
    00137         DWORD                   m_dwValue;
    00138         DWORD                   m_dwUseableOn;
    00139         float                   m_fApproachDistance;
    00140         DWORD                   m_dwIconHighlight;
    00141         WORD                    m_wAmmoType;
    00142         BYTE                    m_bWieldType;
    00143         WORD                    m_wUses;
    00144         WORD                    m_wUseLimit;
    00145         WORD                    m_wStack;
    00146         WORD                    m_wStackLimit;
    00147         DWORD                   m_dwContainerID;
    00148         DWORD                   m_dwVitalID;
    00149         DWORD                   m_dwEquipPossible;
    00150         DWORD                   m_dwEquipActual;
    00151         DWORD                   m_dwCoverage;
    00152         float                   m_fWorkmanship;
    00153         WORD                    m_wBurden;
    00154         DWORD                   m_dwSpellID;
    00155         //For scrolls
    00156         WORD                    m_wSpellID;
    00157         DWORD                   m_dwOwner;
    00158         WORD                    m_wHooks;
    00159         DWORD                   m_dwMaterialType;
    00160         DWORD                   m_dwQuestItemID;
    00161         UINT                    m_vital_affect;
    00162         int                             m_ItemType;
    00163
    00164         //Armor
    00165         DWORD           m_dwArmor_Level;
    00166         float           m_fProt_Slashing;
    00167         float           m_fProt_Piercing;
    00168         float           m_fProt_Bludgeon;
    00169         float           m_fProt_Fire;
    00170         float           m_fProt_Cold;
    00171         float           m_fProt_Acid;
    00172         float           m_fProt_Electric;
    00173
    00174         //Weapons
    00175         DWORD   m_dwWeaponDamage;
    00176         DWORD   m_dwWeaponSpeed;
    00177         DWORD   m_dwWeaponSkill;
    00178         DWORD   m_dwDamageType;
    00179
    00180         double  m_dWeaponVariance;
    00181         double  m_dWeaponModifier;
    00182         double  m_dWeaponPower;
    00183         double  m_dWeaponAttack;
    00184
    00185         int             m_isContainer;
    00186         int             m_isClothing;
    00187         int             m_isUAWeapon;
    00188
    00189         //Books
    00190         DWORD           m_ContentPages;
    00191         DWORD           m_UsedPages;
    00192         DWORD           m_TotalPages;
    00193         std::string m_Author;
    00194         std::string m_Title;
    00195         std::string m_Comment;
    00196         std::string m_CommentAuthor;
    00197
    00198 typedef struct Pages
    00199 {
    00200         std::string textPages;
    00201 };
    00202
    00203 Pages m_Pages[50];
    00204         /*
    00205         std::string m_Page1;
    00206         std::string m_Page2;
    00207         std::string m_Page3;
    00208         std::string m_Page4;
    00209         std::string m_Page5;
    00210         std::string m_Page6;
    00211         std::string m_Page7;
    00212         std::string m_Page8;
    00213         std::string m_Page9;
    00214         */
    00215
    00216         // Animation Arrays
    00217
    00218         cItemModels                     *m_pcNext;
    00219         cItemModels                     *m_pcPrev;
    00220         std::list< cItemModels * >      m_lstModels;
    00221
    00222 private:
    00223         static cItemModels *m_lpcHashTable[ITEM_MODEL_TABLE_SIZE];
    00224
    00225         static inline Hash_Add( cItemModels *pcItemModels )
    00226         {
    00227                 const DWORD dwModelID = pcItemModels->m_dwModelID;
    00228                 if ( !m_lpcHashTable[dwModelID] )
    00229                         m_lpcHashTable[dwModelID] = pcItemModels;
    00230                 else
    00231                 {
    00232                         pcItemModels->m_pcNext  =       m_lpcHashTable[dwModelID];
    00233                         m_lpcHashTable[dwModelID]->m_pcPrev     = pcItemModels;
    00234                         m_lpcHashTable[dwModelID]                       = pcItemModels;
    00235                 }
    00236         }
    00237
    00238         static inline cItemModels *Hash_Find( DWORD& dwModelID )
    00239         {
    00240                 const DWORD dwModel = dwModelID;
    00241                 cItemModels *pcItemModels = m_lpcHashTable[dwModel];
    00242                 while ( pcItemModels )
    00243                 {
    00244                         if ( pcItemModels->CompareModel( dwModelID ) )  return pcItemModels;
    00245                         else
    00246                                 pcItemModels = pcItemModels->m_pcNext;
    00247                 }
    00248                 return NULL;
    00249         }
    00250
    00251         inline BOOL CompareModel( DWORD& dwModelID )
    00252         {
    00253                 if ( dwModelID == m_dwModelID )
    00254                         return true;
    00255                 else
    00256                         return false;
    00257         }
    00258 };