BWAPI
trunk/bwapi/BWAPI/Source/BW/Offsets.h
Go to the documentation of this file.
00001 #pragma once
00002 #pragma pack(1)
00003 
00004 #include <windows.h>
00005 #include <Util/Types.h>
00006 #include "../Storm/storm.h"
00007 
00008 #include "Position.h"
00009 #include "TilePosition.h"
00010 #include "Dialog.h"
00011 #include "Pathing.h"
00012 
00013 #include "Unit.h"
00014 #include "Sprite.h"
00015 #include "TriggerEngine.h"
00016 
00024 #define PLAYER_COUNT             12
00025 #define PLAYABLE_PLAYER_COUNT     8
00026 #define RACE_COUNT                3
00027 #define UNIT_TYPE_COUNT         228
00028 #define TECH_TYPE_COUNT          44
00029 #define UPGRADE_TYPE_COUNT       61
00030 #define WEAPON_TYPE_COUNT       130
00031 #define DAMAGE_TYPE_COUNT         5
00032 #define EXPLOSION_TYPE_COUNT     25
00033 #define FLINGY_TYPE_COUNT       209
00034 #define UNIT_ARRAY_MAX_LENGTH  1700
00035 #define BULLET_ARRAY_MAX_LENGTH 100
00036 #define MAX_SEARCH             3400
00037 
00038 namespace BW
00039 {
00040   class  Unit;
00041   class  Sprite;
00042   class  Image;
00043   struct Bullet;
00044   class  TileType;
00045   class  dialog;
00046   struct bitmap;
00047   struct dlgEvent;
00048   struct fntHead;
00049 
00050   struct DatLoad
00051   {
00052     u32   address;
00053     u32   length;
00054     u32   entries;
00055   };
00056 
00057   //----------------------------------------------- DATA TABLES ----------------------------------------------
00058 #ifdef _MAC
00059   static DatLoad *upgradesDat = (DatLoad*)0x0015AFCC;  
00060   static DatLoad *techdataDat = (DatLoad*)0x0015A6F4;
00061   static DatLoad *weaponsDat  = (DatLoad*)0x0015C19C;
00062   static DatLoad *unitsDat    = (DatLoad*)0x0015AD38;
00063   static DatLoad *flingyDat   = (DatLoad*)0x0014BC08;
00064 #else
00065   static DatLoad *upgradesDat = (DatLoad*)0x005136E0;  
00066   static DatLoad *techdataDat = (DatLoad*)0x005137D8;
00067   static DatLoad *weaponsDat  = (DatLoad*)0x00513868;
00068   static DatLoad *unitsDat    = (DatLoad*)0x00513C30;
00069   static DatLoad *flingyDat   = (DatLoad*)0x00515A38;
00070 #endif
00071   //----------------------------------------------- PLAYER DATA ----------------------------------------------
00073   struct PlayerResources
00074   {
00075     s32 minerals[PLAYER_COUNT];
00076     s32 gas[PLAYER_COUNT];
00077     s32 cumulativeGas[PLAYER_COUNT];
00078     s32 cumulativeMinerals[PLAYER_COUNT];
00079   };
00080   static PlayerResources *BWDATA_PlayerResources = (PlayerResources*) 0x0057F0F0;
00081 
00082   static u8        *BWDATA_PlayerVictory  = (u8*)       0x00650974;
00083   static Position  *BWDATA_startPositions = (Position*) 0x0058D720;
00084 
00086   struct ForceName
00087   {
00088     char  name[30];
00089   };
00090   static ForceName *BWDATA_ForceNames = (ForceName*) 0x0058D5BC;
00091 
00093   struct PlayerInfo
00094   {
00095     int  dwPlayerID;
00096     int  dwStormId;
00097     u8   nType;
00098     u8   nRace;
00099     u8   nTeam;
00100     char szName[25];
00101   };
00102   static PlayerInfo *BWDATA_Players       = (PlayerInfo*) 0x0057EEE0;
00103 
00104   static u32 *BWDATA_PlayerDownloadStatus = (u32*) 0x0068F4FC;
00105 
00107   struct PlayerAlliance
00108   {
00109     u8 player[PLAYER_COUNT];
00110   };
00111   static PlayerAlliance *BWDATA_Alliance     = (PlayerAlliance*) 0x0058D634;
00112   static u32            *BWDATA_PlayerVision = (u32*)            0x0057F1EC;
00113 
00114   // Replay Vision
00115   static u32            *BWDATA_ReplayVision = (u32*)            0x006D0F18;
00116   static u32            *BWDATA_ReplayRevealAll = (u32*)         0x006D0F1C;
00117 
00119   static u32 BWDATA_ServerMenuIn      = 0x004DD5A2;
00120   static u32 BWDATA_ServerMenuOut     = 0x004DD5C9;
00121   static u32 BWDATA_OpponentStartHack = 0x004B995D;
00122   static u32 BWDATA_SingleSpeedHack   = 0x004D99FB;
00123 
00124   struct swishTimer
00125   {
00126     WORD wIndex;
00127     WORD wType;
00128   };
00129   static swishTimer *BWDATA_commonSwishControllers  = (swishTimer*)0x005129EC;   // count: 43
00130   static swishTimer *BWDATA_gluCustmSwishController = (swishTimer*)0x0051A9F0;   // count: 5
00131   static swishTimer *BWDATA_gluCmpgnSwishController = (swishTimer*)0x00512B10;   // count: 2
00132   static swishTimer *BWDATA_gluScoreSwishController = (swishTimer*)0x0051A844;   // count: 1
00133   static swishTimer *BWDATA_gluChatSwishController  = (swishTimer*)0x0051A490;   // count: 5
00134 
00135 
00136   static u32    *BWDATA_playerStatusArray   = (u32*)      0x0057F0B8;
00138   static u32    *BWDATA_sgdwBytesInCmdQueue = (u32*)      0x00654AA0;
00139   static u8     *BWDATA_TurnBuffer          = (u8*)       0x00654880;
00140   static void  (*BWFXN_sendTurn)()          = (void(*)()) 0x00485A40;
00141   static u32    BWFXN_QueueCommand          =             0x00485BD0;
00142 
00144   static u32     OriginalSpeedModifiers[7]  =        { 167, 111, 83, 67, 56, 48, 42};
00145 #ifdef _MAC
00146   static u32     *BWDATA_GameSpeedModifiers = (u32*) 0x0014BF3C;
00147   static u32     *BWDATA_GameSpeed          = (u32*) 0x00228458;
00148 #else
00149   static u32     *BWDATA_GameSpeedModifiers = (u32*) 0x005124D8;
00150   static u32     *BWDATA_GameSpeed          = (u32*) 0x006CDFD4;
00151 #endif
00152 
00153   static u32     *BWDATA_LatencyFrames      = (u32*) 0x0051CE70;
00154   static u32     *BWDATA_FramesUntilNextTurn = (u32*)0x0051CEA0;
00155   static int     *BWDATA_FrameSkip          = (int*) 0x005124D4;
00156   static u8      *BWDATA_Latency            = (u8*)  0x006556e4;
00157   //----------------------------------------- VIDEO & DRAWING ------------------------------------------------
00159   static bool (__fastcall **BWDATA_GenericDlgInteractFxns)(dialog*,dlgEvent*)   = (bool (__fastcall**)(dialog*,dlgEvent*))    0x005014AC;
00160   static void (__fastcall **BWDATA_GenericDlgUpdateFxns)(dialog*,int,int,rect*) = (void (__fastcall**)(dialog*,int,int,rect*))0x00501504;
00161 
00162   static dialog  **BWDATA_DialogList       = (dialog**) 0x006D5E34;
00163   static fntHead **BWDATA_FontBase         = (fntHead**)0x006CE0F4;
00164   static bitmap  *BWDATA_GameScreenBuffer  = (bitmap*)  0x006CEFF0;
00165   static bitmap  *BWDATA_GameScreenConsole = (bitmap*)  0x00597240;
00166   
00167   static PALETTEENTRY        *BWDATA_GamePalette    = (PALETTEENTRY*)       0x006CE320;
00168   static LPDIRECTDRAWSURFACE *BWDATA_PrimarySurface = (LPDIRECTDRAWSURFACE*)0x006D5E00;
00169   static LPDIRECTDRAW        *BWDATA_DDInterface    = (LPDIRECTDRAW*)       0x006D5E08;
00170   static LPDIRECTDRAWPALETTE *BWDATA_PrimaryPalette = (LPDIRECTDRAWPALETTE*)0x006D5E0C;
00171   static LPDIRECTDRAWSURFACE *BWDATA_BackSurface    = (LPDIRECTDRAWSURFACE*)0x006D5E10;
00172 
00173   static void (__cdecl *BWFXN_DDrawDestroy)()   = (void(__cdecl*)())0x0041D8B0;
00174   static u32  BWDATA_DDrawInitCallPatch         = 0x004DB0A2;
00175   static void (__cdecl *BWFXN_UpdateBltMasks)() = (void(__cdecl*)())0x0041D470;
00176 
00177   static u8 *BWDATA_RefreshRegions = (u8*)0x006CEFF8;
00178   static u8 *BWDATA_PlayerColors   = (u8*)0x00581DD6;
00179 
00180   struct bounds
00181   {
00182     WORD  left;
00183     WORD  top;
00184     WORD  right;
00185     WORD  bottom;
00186     WORD  width;
00187     WORD  height;
00188   };
00189 
00190   struct layer
00191   {
00192     BYTE    buffers;
00193     BYTE    bits;
00194     WORD    left;
00195     WORD    top;
00196     WORD    width;
00197     WORD    height;
00198     WORD    alignment;
00199     bitmap  *pSurface;
00200     void (__stdcall *pUpdate)(bitmap *pSurface, bounds *pBounds);
00201   };
00202   static layer   *BWDATA_ScreenLayers = (layer*)0x006CEF50;
00203   extern void (__stdcall *pOldDrawGameProc)(BW::bitmap *pSurface, BW::bounds *pBounds);
00204   extern void (__stdcall *pOldDrawDialogProc)(BW::bitmap *pSurface, BW::bounds *pBounds);
00205 
00206   static RECT *BWDATA_ScrLimit = (RECT*)0x0051A15C;
00207   static RECT *BWDATA_ScrSize  = (RECT*)0x0051A16C;
00208   
00209   //------------------------------------------- CLIST DATA ---------------------------------------------------
00210   static Unit **BWDATA_UnitNodeList_VisibleUnit_First  = (Unit**)0x00628430;
00211   static Unit **BWDATA_UnitNodeList_HiddenUnit_First   = (Unit**)0x006283EC;
00212   static Unit **BWDATA_UnitNodeList_ScannerSweep_First = (Unit**)0x006283F4;
00213   static Unit *BWDATA_UnitNodeTable                    = (Unit*) 0x0059CCA8;
00214 
00215   static Bullet **BWDATA_BulletNodeTable_FirstElement = (Bullet**)0x0064DEC4;
00216   static Bullet *BWDATA_BulletNodeTable               = (Bullet*) 0x0064B2E8;
00217 
00218   struct unitFinder
00219   {
00220     int unitIndex;
00221     int searchValue;
00222   };
00223   // array size 3400 (1700 * 2) for each
00224   static unitFinder *BWDATA_UnitOrderingX             = (unitFinder*)0x0066FF78;
00225   static unitFinder *BWDATA_UnitOrderingY             = &BWDATA_UnitOrderingX[MAX_SEARCH];
00226 
00227   //------------------------------------------- DATA LEVEL ---------------------------------------------------
00228   /* Mode Stuff */
00229   static u8             *BWDATA_gameType       = (u8*)  0x00596820;
00230   static u32            *BWDATA_InGame         = (u32*) 0x006556E0;
00231   static u32            *BWDATA_InReplay       = (u32*) 0x006D0F14;
00232   static int            *BWDATA_NetMode        = (int*) 0x0059688C;
00233   static u32            *BWDATA_CountdownTimer = (u32*) 0x0058D6F4; // Countdown Timer (in seconds)
00234   static u32            *BWDATA_ElapsedTime    = (u32*) 0x0058D6F8; // Elapsed Game Time (in seconds)
00235 
00236   // note: unaligned because it's part of a structure that we're not using
00237   static u32            *BWDATA_ReplayFrames   = (u32*) 0x006D0F31;
00238 
00239   static u8             *BWDATA_GameState      = (u8*)  0x006D11EC;
00240   static u16            *BWDATA_gwNextGameMode = (u16*) 0x0051CE90;
00241   static u16            *BWDATA_gwGameMode     = (u16*) 0x00596904; // BW::GamePosition
00242   static u32            *BWDATA_glGluesMode    = (u32*) 0x006D11BC; // BW::MenuPosition
00243 
00244   static int *BWDATA_g_LocalHumanID = (int*) 0x00512688;
00245 
00246   static void **BWDATA_customList_UIDlgData = (void**)0x0051A350;
00247 
00248   //--------------------------------------- FOR RESOLUTION HACK ----------------------------------------------
00249   static Sprite **BWDATA_spriteGroups = (Sprite**) 0x00629688;
00250 
00251   struct _gametext
00252   {
00253     char txt[218];
00254   };
00255   static _gametext *BWDATA_Chat_GameText   = (_gametext*)0x00640B60;
00256   static u8        *BWDATA_Chat_NextLine   = (u8*)       0x00640B58;
00257   static u8        *BWDATA_Chat_ColorBytes = (u8*)       0x00641674;
00258   static u32       *BWDATA_Chat_IncrementY = (u32*)      0x00640B20;
00259 
00260   static void (__cdecl *BWFXN_drawDragSelBox)()           = (void (__cdecl*)()) 0x00470040;
00261   static void (__cdecl *BWFXN_drawAllThingys)()           = (void (__cdecl*)()) 0x00488180;
00262   static void (__cdecl *BWFXN_drawMapTiles)()             = (void (__cdecl*)()) 0x0049C780;
00263   static void (__cdecl *BWFXN_blitMapTiles)()             = (void (__cdecl*)()) 0x0040C253;
00264   static void (__cdecl *BWFXN_drawAllSprites)()           = (void (__cdecl*)()) 0x00498D40;
00265   //static void (__cdecl *BWFXN_updateImageData)()          = (void (__cdecl*)()) 0x00498CF0;
00266 
00267 
00268   static void (__fastcall **BWDATA_InputProcs)(dlgEvent*) = (void (__fastcall**)(dlgEvent*))0x005968A0;
00269   static dialog **BWDATA_EventDialogs                     = (dialog**)0x006D5E40;
00270 
00271   static u8 *BWDATA_InputFlags = (u8*)0x006CDDC0;
00272 
00273   //----------------------------------------- FUNCTION LEVEL -------------------------------------------------
00274   static Unit **BWDATA_ClientSelectionGroup = (Unit**) 0x00597208;
00275   static u8   *BWDATA_ClientSelectionCount  = (u8*)    0x0059723D;
00276   static u32  BWDATA_PlayerSelection        =          0x006284E0;
00277 
00278   static u32 *BWDATA_isGamePaused           = (u32*)0x006509C4;
00279   static u32 BWFXN_P_IsGamePaused           = 0x004D974E;
00280 
00281   // These 2 can be merged;
00282   // void __usercall refundBuildingCost(unsigned __int16 unitType<ax>, unsigned __int8 playerID<cl>)
00283   // Function takes cost of unit type, multiplies it by 3/4, and adds it to the player's resources.
00284   static u32 BWFXN_RefundMinerals                 = 0x0042ce97;//building cancel
00285   static u32 BWFXN_RefundMineralsReturnAddress    = 0x0042ce9e;//building cancel
00286   static u32 BWFXN_RefundGas                      = 0x0042ceb8;//building cancel
00287   static u32 BWFXN_RefundGasReturnAddress         = 0x0042cebe;//building cancel
00288 
00289   static u32 BWFXN_RefundMinAndGas2               = 0x0042ced9;//morphing
00290   static u32 BWFXN_RefundMinAndGas2ReturnAddress  = 0x0042cedf;//morphing
00291 
00292   static u32 BWFXN_RefundMinAndGas5               = 0x00453E62;//research cancel
00293   static u32 BWFXN_RefundMinAndGas5ReturnAddress  = 0x00453E68;//research cancel
00294 
00295   // These 2 can be merged;
00296   // void __userpurge refundUpgrade(unsigned __int8 upgradeType<al>, unsigned __int8 playerID)
00297   // Function calculates the cost of the upgrade by taking the upgrade level, multiplying 
00298   // with cost factor, and adding base cost, then adding that to player's resources.
00299   static u32 BWFXN_RefundMin4                     = 0x004541C2;//upgrade cancel
00300   static u32 BWFXN_RefundMin4ReturnAddress        = 0x004541CD;//upgrade cancel
00301   static u32 BWFXN_RefundGas4                     = 0x004541FD;//upgrade cancel
00302   static u32 BWFXN_RefundGas4ReturnAddress        = 0x00454204;//upgrade cancel
00303 
00304   // A little trickier, but can also be merged
00305   static u32 BWFXN_RefundMin3                     = 0x0045D44D;//morphing
00306   static u32 BWFXN_RefundMin3ReturnAddress        = 0x0045D454;//morphing
00307   static u32 BWFXN_RefundGas3                     = 0x0045D46e;//morphing
00308   static u32 BWFXN_RefundGas3ReturnAddress        = 0x0045D474;//morphing
00309 
00310   static u32 BWFXN_SpendRepair                    = 0x00467006;
00311   static u32 BWFXN_SpendRepairReturnAddress       = 0x0046700D;
00312 
00313   static void (*BWDATA_DSoundDestroy)()  = (void (*)()) 0x004BC180;
00314 
00315   static u32 BWFXN_NetSelectReturnMenu   = 0x004DC5B0;
00316 
00317   //------------------------------------ POSITIONS (MOUSE/SCREEN) --------------------------------------------
00318   static void (__cdecl *BWFXN_UpdateScreenPosition)()    = (void(__cdecl*)()) 0x0049BFD0;
00319   static u32            *BWDATA_MoveToX                  = (u32*)             0x0062848C;
00320   static u32            *BWDATA_MoveToY                  = (u32*)             0x006284A8;
00321   static Position       *BWDATA_MoveToTile               = (Position*)        0x0057F1D0;
00322 
00323   static POINT          *BWDATA_Mouse                    = (POINT*) 0x006CDDC4;
00324   static u32            *BWDATA_ScreenX                  = (u32*)   0x00628448;
00325   static u32            *BWDATA_ScreenY                  = (u32*)   0x00628470;
00326 
00327   static TilePosition   *BWDATA_MapSize                  = (TilePosition*) 0x0057F1D4;
00328 
00329   //--------------------------------------------- STRINGS ----------------------------------------------------
00330   static char           *BWDATA_CurrentMapFileName       = (char*) 0x0057FD3C;
00331   static char           *BWDATA_CurrentMapName           = (char*) 0x0057FE40;
00332   static char           *BWDATA_CurrentMapFolder         = (char*) 0x0059BB70;
00333   static char           *BWDATA_SaveGameFile             = (char*) 0x00685148;
00334 
00335   struct MapVectorEntry   // sizeof 1348
00336   {
00337     char  szEntryName[64];        // fixed entry name // 8
00338     BYTE  bUnknown_48;            // 72
00339     char  szMapName[32];          // 73
00340     char  szMapDescription[316];  // 105
00341     char  szTotalPlayers[35];     // 421
00342     char  szComputerSlots[35];    // 456
00343     char  szHumanSlots[35];       // 491
00344     char  szMapDimensions[35];    // 526
00345     char  szMapTileset[35];       // 561
00346     DWORD dwListEntryIndex;       // 596
00347     DWORD dwUnknown_258;          // 600  Computer slots?
00348     DWORD dwUnknown_25C;          // 604
00349     DWORD dwUnknown_260;          // 608
00350     DWORD dwUnknown_264;          // 612
00351     BYTE  bEntryFlags;            // 616
00352     char  szFullPath[MAX_PATH];   // 617
00353     char  szFileName[MAX_PATH];   // 877
00354     BYTE  bUnknown_471;           // 1137
00355     WORD  wMapWidth;              // 1138
00356     WORD  wMapHeight;             // 1140
00357     WORD  wMapTileset;            // 1142
00358     BYTE  bUnknown_478;           // 1144
00359     BYTE  bTotalPlayers;          // 1145
00360     BYTE  bComputerSlots;         // 1146
00361     BYTE  bHumanSlots;            // 1147
00362     BYTE  bUnknown_47C;           // 1148
00363     WORD  wUnknown_47D;           // 1149
00364     struct 
00365     {
00366       struct
00367       {
00368         BYTE  bCmd;             //  1151
00369         DWORD dwSeed;           //  1152
00370         BYTE  bPlayerBytes[8];  //  1156
00371       } gameInitCommand;
00372       struct
00373       {
00374         DWORD dwUnknownAlways0;   // 1164
00375         char  szPlayerName[24];   // 1168
00376         DWORD dwGameFlags;        // 1192
00377         WORD  wMapWidth;          // 1196
00378         WORD  wMapHeight;         // 1198
00379         BYTE  bActivePlayerCount; // 1200
00380         BYTE  bAvailableSlots;    // 1201
00381         BYTE  bGameSpeed;         // 1202
00382         BYTE  bGameState;         // 1203
00383         WORD  wGameType;          // 1204
00384         WORD  wGameSubType;       // 1206
00385         DWORD dwSeed;             // 1208
00386         WORD  wTileset;           // 1212
00387         BYTE  bAutosaved;         // set if it was saved as LastReplay    // 1214
00388         BYTE  bComputerPlayerCount; // 1215
00389       } gameData;
00390       char szGameName[25];  // 1216
00391       char szMapName[32];   // 1241
00392       struct
00393       {
00394         WORD  wGameType;              // 1273
00395         WORD  wGameSubType;           // 1275
00396         WORD  wSubTypeDisplay;        // 1277
00397         WORD  wSubTypeLabel;          // 1279
00398         BYTE  bVictoryCondition;      // 1281
00399         BYTE  bResourceType;          // 1282
00400         BYTE  bUseStandardUnitStats;  // 1283
00401         BYTE  bFogOfWar_Unused;       // 1284
00402         BYTE  bStartingUnits;         // 1285
00403         BYTE  bUseFixedPosition;      // 1286
00404         BYTE  bRestrictionFlags;      // 1287
00405         BYTE  bAlliesEnabled;         // 1288
00406         BYTE  bTeamsEnabled;          // 1289
00407         BYTE  bCheatsEnabled;         // 1290
00408         BYTE  bTournamentModeEnabled; // 1291
00409         DWORD dwVictoryConditionValue;  // 1292
00410         DWORD dwResourceMineralsValue;  // 1296
00411         DWORD dwResourceGasValue; // unused // 1300
00412         BYTE  __align_1; // 1304
00413       } gameTemplate;
00414     } partialReplayGameHeader;
00415     DWORD dwUnknown_519[7]; // 1305
00416     BYTE  bPlayerSlotEnabled[12];  // 1333
00417     BYTE  __align_3[3];   // 1345
00418   };  // 1348
00419 
00420   struct TransVectorEntry
00421   {
00422     HANDLE            hTrans;
00423     RECT              info;
00424     DWORD             dwReserved;
00425   };
00426 
00427 
00428   template <class _T>
00429   struct BlizzVectorEntry
00430   {
00431     BlizzVectorEntry<_T> *prev; // First entry points to begin in controller
00432     BlizzVectorEntry<_T> *next; // negative value indicates vector::end and points to &end in controller
00433     _T container;
00434   };
00435 
00436   template <class _T>
00437   struct BlizzVectorController // sizeof 12
00438   {
00439     int unknown_00;
00440     BlizzVectorEntry<_T> *end;
00441     BlizzVectorEntry<_T> *begin;
00442   };
00443 
00444   static BlizzVectorController<MapVectorEntry>    *BWDATA_MapListVector   = (BlizzVectorController<MapVectorEntry>*)    0x0051A274;
00445   static BlizzVectorController<TransVectorEntry>  *BWDATA_TransMaskVector = (BlizzVectorController<TransVectorEntry>*)  0x0051A334;
00446   static BlizzVectorController<Triggers::Trigger> *BWDATA_TriggerVectors  = (BlizzVectorController<Triggers::Trigger>*) 0x0051A280;
00447 
00448   static bool (__fastcall **BWDATA_TriggerActionFxnTable)(BW::Triggers::Action*) = (bool(__fastcall**)(BW::Triggers::Action*))0x00512800;
00449 
00450   const char            *GetStatString(int index);
00451   extern char           *BWDATA_StringTableOff;
00452 
00453   //------------------------------------------------ SUPPLIES ------------------------------------------------
00454   struct AllScores
00455   {
00456     s32 allUnitsTotal[PLAYER_COUNT];
00457     s32 allUnitsProduced[PLAYER_COUNT];
00458     s32 allUnitsOwned[PLAYER_COUNT];
00459     s32 allUnitsLost[PLAYER_COUNT];
00460     s32 allUnitsKilled[PLAYER_COUNT];
00461     s32 allUnitScore[PLAYER_COUNT];
00462     s32 allKillScore[PLAYER_COUNT];
00463     s32 allBuildingsTotal[PLAYER_COUNT];
00464     s32 allBuildingsConstructed[PLAYER_COUNT];
00465     s32 allBuildingsOwned[PLAYER_COUNT];
00466     s32 allBuildingsLost[PLAYER_COUNT];
00467     s32 allBuildingsRazed[PLAYER_COUNT];
00468     s32 allBuildingScore[PLAYER_COUNT];
00469     s32 allRazingScore[PLAYER_COUNT];
00470     s32 allFactoriesConstructed[PLAYER_COUNT];
00471     s32 allFactoriesOwned[PLAYER_COUNT];
00472     s32 allFactoriesLost[PLAYER_COUNT];
00473     s32 allFactoriesRazed[PLAYER_COUNT];
00474 
00476     struct SuppliesPerRace
00477     {
00478       s32 available[PLAYER_COUNT];
00479       s32 used[PLAYER_COUNT];
00480       s32 max[PLAYER_COUNT];
00481     };
00482     SuppliesPerRace supplies[RACE_COUNT];
00483     s32 customScore[PLAYER_COUNT];
00484 
00486     struct Counts
00487     {
00488       s32 all[UNIT_TYPE_COUNT][PLAYER_COUNT];
00489       s32 completed[UNIT_TYPE_COUNT][PLAYER_COUNT];
00490       s32 killed[UNIT_TYPE_COUNT][PLAYER_COUNT];
00491       s32 dead[UNIT_TYPE_COUNT][PLAYER_COUNT];
00492     };
00493     Counts unitCounts;
00494   };
00495   static AllScores *BWDATA_AllScores = (AllScores*) 0x00581DE4;
00496 
00497   //---------------------------------------------- UNIT DATA -------------------------------------------------
00498   static u8  *BWDATA_Unit_Graphic             = (u8*)  unitsDat[0].address;
00499   static u16 *BWDATA_Unit_SubUnit             = (u16*) unitsDat[1].address;
00500   static u32 *BWDATA_Unit_ConstructionGraphic = (u32*) unitsDat[4].address;
00501   static u8  *BWDATA_Unit_ShieldsEnabled      = (u8*)  unitsDat[6].address;
00502   static u16 *BWDATA_Unit_MaxShieldPoints     = (u16*) unitsDat[7].address;
00503   static s32 *BWDATA_Unit_MaxHitPoints        = (s32*) unitsDat[8].address;
00504   static u8  *BWDATA_Unit_Elevation           = (u8*)  unitsDat[9].address;
00505   static u8  *BWDATA_Unit_GroundWeapon        = (u8*)  unitsDat[17].address;
00506   static u8  *BWDATA_Unit_MaxGroundHits       = (u8*)  unitsDat[18].address;
00507   static u8  *BWDATA_Unit_AirWeapon           = (u8*)  unitsDat[19].address;
00508   static u8  *BWDATA_Unit_MaxAirHits          = (u8*)  unitsDat[20].address;
00509   static u32 *BWDATA_Unit_PrototypeFlags      = (u32*) unitsDat[22].address;
00510   static u8  *BWDATA_Unit_SeekRange           = (u8*)  unitsDat[23].address;
00511   static u8  *BWDATA_Unit_SightRange          = (u8*)  unitsDat[24].address;
00512   static u8  *BWDATA_Unit_ArmorUpgrade        = (u8*)  unitsDat[25].address;
00513   static u8  *BWDATA_Unit_SizeType            = (u8*)  unitsDat[26].address;
00514   static u8  *BWDATA_Unit_ArmorAmount         = (u8*)  unitsDat[27].address;
00515   static u16 *BWDATA_Unit_MineralCost         = (u16*) unitsDat[40].address;
00516   static u16 *BWDATA_Unit_GasCost             = (u16*) unitsDat[41].address;
00517   static u16 *BWDATA_Unit_TimeCost            = (u16*) unitsDat[42].address;
00518   static u8  *BWDATA_Unit_GroupFlags          = (u8*)  unitsDat[44].address;
00519   static u8  *BWDATA_Unit_SupplyProvided      = (u8*)  unitsDat[45].address;
00520   static u8  *BWDATA_Unit_SupplyRequired      = (u8*)  unitsDat[46].address;
00521   static u8  *BWDATA_Unit_SpaceRequired       = (u8*)  unitsDat[47].address;
00522   static u8  *BWDATA_Unit_SpaceProvided       = (u8*)  unitsDat[48].address;
00523   static u16 *BWDATA_Unit_BuildScore          = (u16*) unitsDat[49].address;
00524   static u16 *BWDATA_Unit_DestroyScore        = (u16*) unitsDat[50].address;
00525   static u16 *BWDATA_Unit_MapStringID         = (u16*) unitsDat[51].address;
00526   static u8  *BWDATA_Unit_BroodwarOnly        = (u8*)  unitsDat[52].address;
00527 
00529   struct UnitPlacement_type
00530   {
00531     struct Placement_Internal_type
00532     {
00533       u16 height;
00534       u16 width;
00535     } unitType[UNIT_TYPE_COUNT];
00536   };
00537   static UnitPlacement_type *BWDATA_Unit_Placement = (UnitPlacement_type*) unitsDat[36].address;
00538 
00540   struct UnitsDimensions_type
00541   {
00542     struct UnitDimensions
00543     {
00544       u16 left;
00545       u16 up;
00546       u16 right;
00547       u16 down;
00548     } units[UNIT_TYPE_COUNT];
00549   };
00550   static UnitsDimensions_type *BWDATA_Unit_Dimensions = (UnitsDimensions_type*) unitsDat[38].address;
00551 
00552   struct _uavail
00553   {
00554     u8 available[12][228];
00555   };
00556   static _uavail *BWDATA_UnitAvailability = (_uavail*)0x0057F27C;
00557 
00558   //-------------------------------------------- FLINGY DATA -------------------------------------------------
00559   static u16 *BWDATA_Flingy_SpriteID        = (u16*) flingyDat[0].address;
00560   static u32 *BWDATA_Flingy_TopSpeed        = (u32*) flingyDat[1].address;
00561   static u16 *BWDATA_Flingy_Acceleration    = (u16*) flingyDat[2].address;
00562   static u32 *BWDATA_Flingy_HaltDistance    = (u32*) flingyDat[3].address;
00563   static u8  *BWDATA_Flingy_TurnRadius      = (u8*)  flingyDat[4].address;
00564   static u8  *BWDATA_Flingy_MovementControl = (u8*)  flingyDat[6].address;
00565 
00566   //-------------------------------------------- WEAPON DATA -------------------------------------------------
00567   static u16 *BWDATA_Weapon_Label              = (u16*) weaponsDat[0].address;
00568   static u32 *BWDATA_Weapon_Graphic            = (u32*) weaponsDat[1].address;
00569   static u16 *BWDATA_Weapon_TargetFlags        = (u16*) weaponsDat[3].address;
00570   static u32 *BWDATA_Weapon_MinRange           = (u32*) weaponsDat[4].address;
00571   static u32 *BWDATA_Weapon_MaxRange           = (u32*) weaponsDat[5].address;
00572   static u8  *BWDATA_Weapon_Upgrade            = (u8*)  weaponsDat[6].address;
00573   static u8  *BWDATA_Weapon_DamageType         = (u8*)  weaponsDat[7].address;
00574   static u8  *BWDATA_Weapon_Behavior           = (u8*)  weaponsDat[8].address;
00575   static u8  *BWDATA_Weapon_RemoveAfter        = (u8*)  weaponsDat[9].address;
00576   static u8  *BWDATA_Weapon_ExplosionType      = (u8*)  weaponsDat[10].address;
00577   static u16 *BWDATA_Weapon_InnerSplashRadius  = (u16*) weaponsDat[11].address;
00578   static u16 *BWDATA_Weapon_MedianSplashRadius = (u16*) weaponsDat[12].address;
00579   static u16 *BWDATA_Weapon_OuterSplashRadius  = (u16*) weaponsDat[13].address;
00580   static u16 *BWDATA_Weapon_DamageAmount       = (u16*) weaponsDat[14].address;
00581   static u16 *BWDATA_Weapon_DamageBonus        = (u16*) weaponsDat[15].address;
00582   static u8  *BWDATA_Weapon_DamageCooldown     = (u8*)  weaponsDat[16].address;
00583   static u8  *BWDATA_Weapon_DamageFactor       = (u8*)  weaponsDat[17].address;
00584   static u8  *BWDATA_Weapon_AttackDirection    = (u8*)  weaponsDat[18].address;
00585   static u8  *BWDATA_Weapon_LaunchSpin         = (u8*)  weaponsDat[19].address;
00586   static u8  *BWDATA_Weapon_XOffset            = (u8*)  weaponsDat[20].address;
00587   static u8  *BWDATA_Weapon_YOffset            = (u8*)  weaponsDat[21].address;
00588 
00589   //------------------------------------------- UPGRADE DATA -------------------------------------------------
00590   static u16            *BWDATA_Upgrade_MineralCostBase   = (u16*)  upgradesDat[0].address;
00591   static u16            *BWDATA_Upgrade_MineralCostFactor = (u16*)  upgradesDat[1].address;
00592   static u16            *BWDATA_Upgrade_GasCostBase       = (u16*)  upgradesDat[2].address;
00593   static u16            *BWDATA_Upgrade_GasCostFactor     = (u16*)  upgradesDat[3].address;
00594   static u16            *BWDATA_Upgrade_TimeCostBase      = (u16*)  upgradesDat[4].address;
00595   static u16            *BWDATA_Upgrade_TimeCostFactor    = (u16*)  upgradesDat[5].address;
00596   static u16            *BWDATA_Upgrade_Label             = (u16*)  upgradesDat[8].address;
00597   static u8             *BWDATA_Upgrade_Race              = (u8*)   upgradesDat[9].address;
00598   static u8             *BWDATA_Upgrade_MaxRepeats        = (u8*)   upgradesDat[10].address;
00599 
00600   struct _scUpgrs {    u8 level[PLAYER_COUNT][46];  };
00601   struct _bwUpgrs {    u8 level[PLAYER_COUNT][15];  };
00602   static _scUpgrs *BWDATA_UpgradeMaxSC   = (_scUpgrs*)0x0058D088;
00603   static _scUpgrs *BWDATA_UpgradeLevelSC = (_scUpgrs*)0x0058D2B0;
00604   static _bwUpgrs *BWDATA_UpgradeMaxBW   = (_bwUpgrs*)0x0058F24A;
00605   static _bwUpgrs *BWDATA_UpgradeLevelBW = (_bwUpgrs*)0x0058F32C;
00606 
00607   static u32 BWDATA_UpgradeProgress = 0x0058F3E0;
00608 
00609   //--------------------------------------------- TECH DATA --------------------------------------------------
00610   static u16 *BWDATA_Tech_MineralCost  = (u16*) techdataDat[0].address;
00611   static u16 *BWDATA_Tech_GasCost      = (u16*) techdataDat[1].address;
00612   static u16 *BWDATA_Tech_TimeCost     = (u16*) techdataDat[2].address;
00613   static u16 *BWDATA_Tech_EnergyCost   = (u16*) techdataDat[3].address;
00614   static u16 *BWDATA_Tech_LabelIndex   = (u16*) techdataDat[7].address;
00615 
00616   struct _scTechs {    u8 enabled[PLAYER_COUNT][24];  };
00617   struct _bwTechs {    u8 enabled[PLAYER_COUNT][20];  };
00618   static _scTechs *BWDATA_TechAvailableSC = (_scTechs*)0x0058CE24;
00619   static _scTechs *BWDATA_TechResearchSC  = (_scTechs*)0x0058CF44;
00620   static _bwTechs *BWDATA_TechAvailableBW = (_bwTechs*)0x0058F050;
00621   static _bwTechs *BWDATA_TechResearchBW  = (_bwTechs*)0x0058F140;
00622 
00623   static u32 BWDATA_ResearchProgress  = 0x0058F230;
00624 
00625   //------------------------------------------------ MAPPING -------------------------------------------------
00627   typedef u16 TileID;
00628   extern TileID   *BWDATA_MapTileArray;
00629   extern TileType *BWDATA_TileSet;
00630 
00632   struct MiniTileMaps_type
00633   {
00634     struct MiniTileFlagArray
00635     {
00636       u16 miniTile[16];
00637     };
00638     MiniTileFlagArray tile[0x10000];
00639   };
00640   extern MiniTileMaps_type *BWDATA_MiniTileFlags;
00641 
00642   struct activeTile
00643   {
00644     u8 bVisibilityFlags;
00645     u8 bExploredFlags;
00646     u8 bWalkable          : 1; // Set on tiles that can be walked on
00647     u8 bUnknown1          : 1; // Unused?
00648     u8 bUnwalkable        : 1; // Set on tiles that can't be walked on
00649     u8 bUnknown2          : 3; // Unused?
00650     u8 bHasCreep          : 1; // Set when creep occupies the area
00651     u8 bAlwaysUnbuildable : 1; // always unbuildable, like water
00652     u8 bGroundHeight      : 3; // ground height
00653     u8 bCurrentlyOccupied : 1; // unbuildable but can be made buildable
00654     u8 bCreepReceeding    : 1; // Set when the nearby structure supporting the creep is destroyed
00655     u8 bCliffEdge         : 1; // Set if the tile is a cliff edge
00656     u8 bTemporaryCreep    : 1; // Set when the creep occupying the area was created. Not set if creep tiles were preplaced.
00657     u8 bUnknown3          : 1; // Unused?
00658   };
00659   extern activeTile        *BWDATA_ActiveTileArray;
00660   extern SAI_Paths         *BWDATA_SAIPathing;
00661 
00662   // EXPERIMENTAL
00663   //static int (__stdcall *BWFXN_getTileDistance)(int x, int y, int x2, int y2) = (int (__stdcall*)(int,int,int,int))0x00444100;
00664   
00665   struct baseLocation
00666   {
00667     /* 0x00 */BW::Position position;
00668     /* 0x04 */BYTE  mineralClusters;
00669     /* 0x05 */BYTE  gasGeysers;
00670     /* 0x06 */BYTE  isStartLocation; // The "base" is actually a Start Location
00671     /* 0x07 */BYTE  bFlags;
00672                     /*  0x01 - This base is currently occupied.
00673                         0x02 - An AI script has acquired this base as an expansion.
00674                     */
00675     /* 0x08 */DWORD remainingMinerals;
00676     /* 0x0C */DWORD remainingGas;
00677     /* 0x10 */DWORD unk_10[8];
00678   };
00679 
00680   // 250 entries max
00681   //static baseLocation *BWDATA_Bases = (baseLocation*)0x00692688;
00682 };
00683 #pragma pack()
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines