- Main Page
- Classes
- Files

- File List
- File Members

# E:/uas2/Server/cWObjectModels.h

    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 #if _MSC_VER > 1000
    00024 #pragma once
    00025 #endif // _MSC_VER > 1000
    00026 #include <winsock2.h>
    00027 #include "shared.h"
    00028
    00029 #define WORLD_OBJECT_MODEL_TABLE_SIZE 1000
    00030
    00031 class cWObjectModels
    00032 {
    00033         friend class cMasterServer;
    00034 public:
    00035         cWObjectModels( DWORD dwModelID, BOOL fAddToHash = TRUE )
    00036                         :       m_dwModelID( dwModelID ),
    00037                                 m_pcPrev                ( NULL ),
    00038                                 m_pcNext                ( NULL )
    00039         {
    00040                 m_dwUnknownDword        =       0x0L;
    00041                 m_dwUnknown                     =       0x0L;
    00042                 m_wSeagreen10           =       0x0;
    00043                 m_dwFlags2                      =       0x00800016;
    00044                 m_dwObjectFlags1        =       0x00000010;
    00045                 m_dwObjectFlags2        =       0x00000014;
    00046                 m_wUnknown1                     =       0x0;
    00047                 m_flScale                       =       1.0f;
    00048                 m_dwTrio1[0]            =       0x0;
    00049                 m_dwTrio1[1]            =       0x0;
    00050                 m_dwTrio1[2]            =       0x0;
    00051                 m_dwTrio2[0]            =       0x0;
    00052                 m_dwTrio2[1]            =       0x0;
    00053                 m_dwTrio2[2]            =       0x0;
    00054                 m_dwTrio3[0]            =       0x0;
    00055                 m_dwTrio3[1]            =       0x0;
    00056                 m_dwTrio3[2]            =       0x0;
    00057
    00058                 if( fAddToHash )
    00059                 Hash_Add( this );
    00060
    00061         }
    00062         virtual ~cWObjectModels()
    00063         {
    00064                 if ( m_pcPrev ) m_pcPrev->m_pcNext = m_pcNext;
    00065                 else                    m_lpcHashTable[m_dwModelID] = m_pcNext;
    00066                 if ( m_pcNext ) m_pcNext->m_pcPrev = m_pcPrev;
    00067         }
    00068
    00069         static inline void Hash_Load( )
    00070         {
    00071                 ZeroMemory( m_lpcHashTable, sizeof( m_lpcHashTable ) );
    00072         }
    00073
    00074         static inline cWObjectModels *Hash_New( DWORD& dwModelID )
    00075         {
    00076                 cWObjectModels *pcModel = Hash_Find( dwModelID );
    00077                 if ( pcModel )
    00078                         return pcModel;
    00079
    00080                 return new cWObjectModels( dwModelID ) ;
    00081         }
    00082
    00083         static void             Hash_Erase      ( );
    00084         static void             Hash_Remove     ( cWObjectModels *pcModel );
    00085         static cWObjectModels   *FindModel      ( DWORD dwModelID );
    00086
    00087         std::string             m_strName;
    00088         std::string             m_strDescription;
    00089         DWORD                   m_dwModelID;
    00090
    00091         // Model vectors
    00092         BYTE                    m_bPaletteChange;
    00093         DWORD                   m_wPaletteVector;
    00094         sPaletteChange  m_vectorPal[255];
    00095
    00096         BYTE                    m_bTextureChange;
    00097         DWORD                   m_wTextureVector;
    00098         sTextureChange  m_vectorTex[255];
    00099
    00100         BYTE                    m_bModelChange;
    00101         DWORD                   m_wModelVector;
    00102         sModelChange    m_vectorMod[255];
    00103
    00104         WORD                    m_wPortalMode;
    00105         WORD                    m_wUnknown_1;
    00106
    00107         DWORD                   m_dwUnknownCount;
    00108         BYTE                    m_bInitialAnimation[200];
    00109         DWORD                   m_dwUnknownDword;
    00110
    00111         DWORD                   m_dwUnknown;
    00112         WORD                    m_wSeagreen8;
    00113         WORD                    m_wSeagreen10;
    00114
    00115         WORD                    m_wModel;
    00116         WORD                    m_wIcon;
    00117         WORD                    m_wAnimConfig;
    00118         WORD                    m_wSoundSet;
    00119
    00120
    00121         DWORD                   m_dwModelNumber;
    00122         DWORD                   m_dwObjectFlags1;
    00123         DWORD                   m_dwObjectFlags2;
    00124         DWORD                   m_dwFlags1;
    00125         DWORD                   m_dwFlags2;
    00126         WORD                    m_wUnknown1;
    00127         DWORD                   m_dwUnknown_Blue;
    00128         float                   m_flScale;
    00129         DWORD                   m_dwUnknown_LightGrey;
    00130         DWORD                   m_dwTrio1[3];
    00131         DWORD                   m_dwTrio2[3];
    00132         DWORD                   m_dwTrio3[3];
    00133         DWORD                   m_dwMedGrey;
    00134         DWORD                   m_dwBlueGrey;
    00135         DWORD                   m_dwUnknown_v2;
    00136         DWORD                   m_dwUnknown_v6;
    00137
    00138         cWObjectModels                  *m_pcNext;
    00139         cWObjectModels                  *m_pcPrev;
    00140         #pragma warning(disable:4786)
    00141         std::list< cWObjectModels * >   m_lstModels;
    00142
    00143 private:
    00144         static cWObjectModels *m_lpcHashTable[WORLD_OBJECT_MODEL_TABLE_SIZE];
    00145
    00146         static inline Hash_Add( cWObjectModels *pcModels )
    00147         {
    00148                 const DWORD dwModelID = pcModels->m_dwModelID;
    00149                 if ( !m_lpcHashTable[dwModelID] )
    00150                         m_lpcHashTable[dwModelID] = pcModels;
    00151                 else
    00152                 {
    00153                         pcModels->m_pcNext      =       m_lpcHashTable[dwModelID];
    00154                         m_lpcHashTable[dwModelID]->m_pcPrev     = pcModels;
    00155                         m_lpcHashTable[dwModelID]                       = pcModels;
    00156                 }
    00157         }
    00158
    00159
    00160         static inline cWObjectModels *Hash_Find( DWORD& dwModelID )
    00161         {
    00162                 const DWORD dwModel = dwModelID;
    00163                 cWObjectModels *pcModels = m_lpcHashTable[dwModel];
    00164                 while ( pcModels )
    00165                 {
    00166                         if ( pcModels->CompareModel( dwModelID ) )      return pcModels;
    00167                         else
    00168                                 pcModels = pcModels->m_pcNext;
    00169                 }
    00170                 return NULL;
    00171         }
    00172
    00173         inline BOOL CompareModel( DWORD& dwModelID )
    00174         {
    00175                 if ( dwModelID == m_dwModelID )
    00176                         return true;
    00177                 else
    00178                         return false;
    00179         }
    00180 };