Something went wrong. Try again.
[Mirror] Libreopolis is a cross-platform city simulation game fully compatible with SimCity 2000. gitlab.com/conasg/libreopolis
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283// sc2k/misc_layout.hpp — named byte offsets into the 4 KB MISC scalar block.//// The .SC2 MISC chunk decompresses to a uniform array of big-endian 32-bit ints (magic 0x122 = 290 at// dword 0); 16-bit globals occupy the low bits of their dword. These constants are the byte offsets the// port reads/writes through City::be32/put_be32 (and the sim's misc_be32/set_misc_be32). They replace the// raw hex literals that used to be scattered across city.hpp and ~10 sim/ui headers.//// Names follow the field's use in this port; the trailing comment carries the field's conventional name.// Where this port's findings deliberately differ from community documentation (the weather bytes at// 0x60/0x64/0x68 and the no-disasters flag at 0x1000 — both verified against real saved cities), the// name reflects THIS port's validated meaning; that is a settled behaviour question, not a naming one.//// NB: `City` has a data member also called `misc`, so inside City's own methods the unqualified name// `misc` resolves to that array, not this namespace. Always reference these as `sc2k::misc::kName`.#pragma once
namespace sc2k::misc {
// ---- header scalars (one BE32 dword each) --------------------------------------------------------------inline constexpr int kMagic = 0x00; // version magic; the MISC block must decode to 290 (0x122)inline constexpr int kCityMode = 0x04; // wCityMode: 1 play / 2 disaster (0 ⇒ real game opens map editor)inline constexpr int kViewRotation = 0x08; // wViewRotation (saved compass; also the water source-scan dir)inline constexpr int kStartYear = 0x0C; // wCityStartYear (founded year)inline constexpr int kClockDays = 0x10; // dwCityDays (day counter driving the calendar clock)inline constexpr int kFunds = 0x14; // dwCityFunds (treasury; MISC is the source of truth)inline constexpr int kBondCount = 0x18; // dwCityBonds (count of outstanding municipal bonds)inline constexpr int kCityClass = 0x1C; // wCityDifficulty = difficulty+1 (1 Easy/2 Med/3 Hard)inline constexpr int kCityStatus = 0x20; // wCityProgression (reward/size tier 0..10)inline constexpr int kLandValueTotal = 0x28; // dwCityLandValue (aggregate; MISC-mirrored global)inline constexpr int kCrimeTotal = 0x2C; // dwCityCrime (aggregate)inline constexpr int kTrafficTotal = 0x30; // dwCityTraffic (aggregate field total)inline constexpr int kPollutionTotal = 0x34; // dwCityPollution (aggregate)inline constexpr int kLifeExpectancy = 0x48; // demographics summary (refreshed by demographics_step)inline constexpr int kEducationQuotient = 0x4C; // demographics summaryinline constexpr int kEconomyBaseA = 0x50; // national economy base accumulator A (dwNationalPopulation)inline constexpr int kEconomyOscB = 0x54; // national economy oscillator B (dwNationalValue)inline constexpr int kNextBondRate = 0x58; // wNationalFedRate; new bonds issue at +1inline constexpr int kEconomyTrend = 0x5C; // wNationalEconomyTrendinline constexpr int kWeatherHeat = 0x60; // bWeatherHeat (low byte); temp = heat-100°Finline constexpr int kWeatherWind = 0x64; // bWeatherWind (low byte); feeds the wind-plant supplyinline constexpr int kWeatherRain = 0x68; // bWeatherRain (low byte); feeds the solar-plant supply
// ---- strided arrays ------------------------------------------------------------------------------------// Per-age-bucket demographic histogram (20 buckets), stride kAgeHistStride bytes.inline constexpr int kAgeHistRaw = 0x7C; // bucket populationinline constexpr int kAgeHistEduc = 0x80; // bucket education totalinline constexpr int kAgeHistLife = 0x84; // bucket life-expectancy totalinline constexpr int kAgeHistStride = 12; // 0x0C bytes between buckets// Per-industry-type model (11 types), stride kIndustryStride bytes.inline constexpr int kIndustryDemand = 0x16C; // signed-word demandinline constexpr int kIndustryTax = 0x170; // tax rate %inline constexpr int kIndustryPop = 0x174; // industry population ("Ratios")inline constexpr int kIndustryStride = 12; // 0x0C bytes between industry typesinline constexpr int kTileHistogram = 0x1F0; // dwTileCount[256], stride 4 (tile-id census)inline constexpr int kZonePops = 0x5F0; // zoned-population cats [0..7], stride 4inline constexpr int kBondRates = 0x610; // wArrBondData[50] rate array, stride 4inline constexpr int kDemand = 0x718; // wCityDemand R/C/I (-2000..2000), stride 4inline constexpr int kInventionYears = 0x738; // wCityInventionYears[17], stride 4 (0x738..0x778)
// ---- budget records (16 records, pBudgetArr), stride kBudgetStride bytes ----------------// Each record: [value, rate, revenue, then 12 interleaved (valueHist[m], rateHist[m]) pairs] = 27 dwords.inline constexpr int kBudgetValue = 0x77C; // record taxable value / cost baseinline constexpr int kBudgetRate = 0x780; // record tax % / funding %inline constexpr int kBudgetRevenue = 0x784; // record accrued revenue (live)inline constexpr int kBudgetValueHist = 0x788; // 12-month value history (interleaved, +8*m)inline constexpr int kBudgetRateHist = 0x78C; // 12-month rate history (interleaved, +8*m)inline constexpr int kBudgetStride = 0x6C; // 27 dwords between records
// ---- late scalars --------------------------------------------------------------------------------------inline constexpr int kWaterLevel = 0xE40; // wWaterLevel (global sea level)inline constexpr int kMilitaryBase = 0xE4C; // bMilitaryBaseType (0 none..5 missile)inline constexpr int kOrdinances = 0xFA0; // dwCityOrdinances (20-bit mask)inline constexpr int kUnemployment = 0xFA4; // live unemployment %inline constexpr int kAutoBudget = 0xFF0; // per-city Auto-Budget flaginline constexpr int kAutoGoto = 0xFF4; // per-city Auto-Goto flaginline constexpr int kNoDisasters = 0x1000; // per-city No-Disasters flaginline constexpr int kArcoPopulation = 0x1020; // dwArcologyPopulation (arco microsim)inline constexpr int kCityPopulation = 0x102C; // dwCityPopulation mirror (= 10·zonePop[0])inline constexpr int kValueLV = 0x1030; // land-value aggregate feeding I demandinline constexpr int kOldIndustryRatio = 0x1034; // "old industry" ratio; dword 1037
} // namespace sc2k::misc