Known global variables

From sc2k-reverse
Jump to navigationJump to search
1195
1195
SimCopter One reporting heavy traffic!
This page or section is under significant construction. It may be a large repository of data that's constantly being updated, or there may be a large rework in progress. There is a good chance the contents of this page will have dramatically changed next time you look at it.
Please check the history before making any edits to ensure any changes you make won't conflict with anyone else's.


This is a table of global variables in SimCity 2000 that have been at least partially reverse engineered and given names. It is probably going to be unpleasant to update, but at least it looks nice and you can sort it.

Data about where in the MISC chunk certain variables are located is from dfloer's sc2k-docs repository on GitHub (CC BY-SA 4.0).

Uncategorized variables
Address Type Name MISC offset Notes
0x4C702C CWnd* pCwndMainWindow Pointer to the MFC CWnd class for the "root window"
0x4C7104 BOOL bPriscillaActivated Whether or not the debug menu has been activated
0x4C71F0 BOOL bOptionsMusicEnabled 0x0FFC Whether or not music is enabled
0x4C7318 WORD wSimulationSpeed 0x0FEC 1-5 for Paused through African Swallow
0x4C9428 WORD wIndustrialMixPollutionBonus -1 to 2 used to calculate the map wide Pollution Divisor
0x4C942C WORD wViewRotation 0x0008 0 = north, 1 = west, 2 = south, 3 = east
0x4C94C4 DWORD dwArcologyPopulation 0x1020 Population of the city specifically in arcologies
0x4CA1A0 char* pszCityName Pointer to the city name, loaded/saved as the CNAM chunk
0x4CA1BC WORD wNationalEconomyTrend 0x005C Affects interest rates, apparently
0x4CA1E8 WORD wIndustrialMixBonus This is used in RCI demand generation as a bonus (cities dominated by 1 industry receive growth bonuses)
0x4CA1DC WORD wPrisonBonus This sets if power stations get increased Police power from Prisons.
0x4CA3F0 WORD wCityNeighborConnections1500 Count of all $1500 (industrial) neighbor connections (railroad, highways)
0x4CA41C WORD wSubwayXUNDCount 0x0FE8 Seems to be mostly used for budget calculations
0x4CA420 WORD wDisasterType 0x0070 The ID of the next disaster to occur
0x4CA42C WORD wCityMode 0x0004 0 = map editor, 1 = regular gameplay, 2 = scenario mode
0x4CA440 int dwCityLandValue 0x0028 Sum of all values in XVAL
0x4CA444 int dwCityFunds 0x0014 How much money the city has
0x4CA4C8 WORD* dwTileCount Pointer to an array of tile counts for every valid iTileID
0x4CA4D0 DWORD dwCityValue 0x0024 Appears to have something to do with bond interest rates
0x4CA5F4 WORD wCityStartYear 0x000C The year the city was founded
0x4CA81C WORD wMonsterXTHGIndex Which XTHG entry the monster's Thing is
0x4CA928 DWORD dwNationalPopulation 0x0050 Population of SimNation
0x4CA934 WORD* dwMilitaryTiles Pointer to the beginning of the military tiles in the dwTileCount array
0x4CA938 WORD wNationalTax 0x0058 The national base tax rate or the "fed rate", for calculating bond interest rates
0x4CAA40 DWORD dwCityOrdinances 0x0FA0 Flags for which city ordinances are enacted
0x4CAA50 DWORD dwPowerUsedPercentage Percentage of power capacity in use
0x4CAA74 DWORD dwCityPopulation 0x102C Total city population, excluding arcologies
0x4CAD2C BOOL bYearEndFlag 0x0E3C Whether or not the first of the month is the start of a new year
0x4CAD44 BOOL bInScenario Whether or not this game is a scenario
0x4CAD58 neighbor_city_t[4] stNeighborCities 0x06D8 Array of four neighbor cities (32 bytes each), clockwise from bottom left
0x4CADE0 BYTE bWeatherHeat 0x0060 Weather heat level
0x4CAE04 DWORD dwCityDays 0x0010 How many days have elapsed since the city was founded
0x4CAE0C BYTE bWeatherWind 0x0064 Weather wind speed
0x4CB010 WORD wCityProgression 0x0078 Flags for city reward progression
0x4CB014 DWORD dwNationalValue 0x0054 Gross National Product
0x4CB018 DWORD dwCityAdvertising 0x003C City advertising effects (unknown what this actually does)
0x4CB01C WORD wCityCurrentMonth Which month of the year it is (0-indexed; calculated from dwCityDays)
0x4CB020 WORD wCityElapsedYears Years since the city was founded (calculated from dwCityDays)
0x4CB1B8 void* pArrSpriteHeaders Pointer to the array of loaded sprite headers
0x4CB3D0 BOOL bNewspaperSubscription 0x1004 Whether or not the Subscription newspaper is checked
0x4CB3D4 BYTE bWeatherHumidity 0x0068 Weather humidity value
0x4CB3DC WORD wSewerBonus Whether the city has adequate wastewater treatment facilities for use in the Pollution Divisor
0x4CB3E8 WORD wCityCurrentSeason Which season it is (0 = winter, 1 = spring, 2 = summer, 3 = autumn; calculated from dwCityDays)
0x4CB38C microsim_t* dwMicroSimArr Pointer to the array of microsims
0x4CB404 WORD wCityDifficulty 0x001C Game difficulty (0 = no city founded, 1 = easy, 2 = medium, 3 = hard)
0x4CB40C BYTE bWeatherTrend 0x006C What the current weather type is
0x4CB430 WORD[17] wCityInventionYears 0x0738 What years different technologies are invented in
0x4CB454 DWORD dwCityCrime 0x002C Sum of all values in XCRM
0x4CB464 WORD wCurrentToolGroup Currently selected tool group
0x4CC4B8 DWORD dwWaterUsedPercentage Percentage of water capacity in use
0x4CC4BC BOOL bNewspaperExtra 0x1008 Whether or not the Extra!!! newspaper is checked
0x4CC4CC void* dwBudgetArr Pointer to the budget array (needs some reverse engineering and/or documentation work)
0x4CC4D4 BOOL bNoDisasters 0x1000 Whether or not disasters should be disabled (also disables city council autonomy)
0x4CC4D8 WORD wCityNeighborConnections1000 Count of all $1000 (commercial) neighbor connections (roads)
0x4CC4E4 BYTE bMilitaryBaseType 0x0EF4 Military base type (0 = not offered yet, 1 = declined/no location, 2 = army, 3 = air force, 4 = navy, 5 = missile silos)
0x4CC8F8 WORD wCityResidentialDemand 0x0718 Residential demand (-2000 to +2000)
0x4CC8FA WORD wCityCommericalDemand 0x071C Commercial demand (-2000 to +2000)
0x4CC8FC WORD wCityIndustrialDemand 0x0720 Industrial demand (-2000 to +2000)
0x4CC910 DWORD dwCityPollution Sum of all Pollution in city.
0x4CDB68 WORD wCursorXLoc The X coordinate of the tile currently selected on the map
0x4CDB70 WORD wCursorYLoc The Y coordinate of the tile currently selected on the map
0x4CDB7C DWORD dwLFSRState Randomness state for the linear feedback shift register PRNG
0x4CDB80 DWORD dwLCGState Randomness state for the linear congruential generator PRNG
0x4CE8C0 AFX_CORE_STATE pCWinApp Pointer to a CWinApp (needs reverse engineering -- maybe IDA picked this one out on its own?)
Terrain generation variables
Address Type Name MISC offset Notes
0x4C94C0 BOOL bCityHasOcean 0x0E44 Whether or not the city was generated with an ocean
0x4CA1E0 WORD wCityTerrainSliderHills Slider value for hill coverage during terrain generation
0x4CA818 __int16 wWaterLevel 0x0E40 Water table level
0x4CAAF8 WORD wCityTerrainSliderWater Slider vvalue for water coverage during terrain generation
0x4CADD8 WORD wCityTerrainSliderTrees Slider value for tree coverage during terrain generation
0x4CB3F8 BOOL bCityHasRiver 0x0E48 Whether or not the city was generated with a river


Map data pointers
Address Type Name MISC offset Notes
0x4C9430 void* dwMapXPLC Pointer to a 32x32 "minimap" for police coverage (1 byte per 4x4 block)
0x4C9F58 void* dwMapXTER Pointer to a 128x128 map of terrain data (1 byte of type map_XTER_t per tile)
0x4CA1F0 void* dwMapXZON Pointer to a 128x128 map of zone and corner info (1 byte of type map_XZON_t per tile)
0x4CA434 void* dwMapXTHG Pointer to an array of type map_XTHG_t[256] containing Things
0x4CA448 void* dwMapXPOP Pointer to a 32x32 "minimap" for population density (1 byte per 4x4 block)
0x4CA4D8 void* dwMapXCRM Pointer to a 64x64 "minimap" for crime (1 byte per 2x2 block)
0x4CA600 void* dwMapXTXT Pointer to a 128x128 map of XTXT IDs (1 byte per tile)
0x4CA828 void* dwMapXPLT Pointer to a 64x64 "minimap" for pollution (1 byte per 2x2 block)
0x4CA940 void* dwMapXTRF Pointer to a 64x64 "minimap" for traffic (1 byte per 2x2 block)
0x4CAA78 void* dwMapXFIR Pointer to a 32x32 "minimap" for fire coverage (1 byte per 4x4 block)
0x4CAB10 void* dwMapXBIT Pointer to a 128x128 map of tile flags (1 byte of type map_XBIT_t per tile)
0x4CAE10 void* dwMapALTM Pointer to a 128x128 map of altitude data (1 byte of type map_ALTM_t per tile)
0x4CB028 void* dwMapXROG Pointer to a 32x32 "minimap" of rate of growth data (1 byte of unknown type per 4x4 block)
0x4CB0A8 void* dwMapXVAL Pointer to a 64x64 "minimap" of land value (1 byte of (full value / 1000 - 1) per 2x2 block)
0x4CB1D0 void* dwMapXUND Pointer to a 128x128 map of underground map data (1 byte of type map_XUND_t per tile)
0x4CC470 void* dwMapXGRP Pointer to the historical graph data
0x4CC4F0 void* dwMapXBLD Pointer to a 128x128 map of tile IDs (1 byte of type enumTileID per tile)
Simulation Arrays
Address Type Name MISC offset Notes
004C94B4 void* pRawPopTable Pointer to 20-item array for the Population Table
0x4CAA70 void* pLETable Pointer to 20-item array for the LE Table, these are as aggregate sums for the entire age group (LE/RawPop=AgeGroupLE).
0x4C94BC void* pEQTable Pointer to 20-item array for the EQ Table, these are as aggregate sums for the entire age group (EQ/RawPop=AgeGroupEQ).
0x4CB3F0 void* pIndividualIndPops Pointer to 11-item array for the Raw Populations for City Industries Table.
0x4CB3E0 void* pIndividualIndTaxRate Pointer to 11-item array for the each of the Industrial Group's Tax Rates.
0x4CA3F4 void* pIndividualIndDemands Pointer to 11-item array for the each of the Industrial Group's current Demand.