- Main Page
- Classes
- Files

- File List
- File Members

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