00001
00008 #if !defined(_ZAKDEF_H_)
00009 #define _ZAKDEF_H_
00010
00011 #include <appconfig.h>
00012
00014 #define STATS_PER 4
00015
00017 #define STATS_COUNT 10
00018
00020 #define STAT_ENTRIES (STATS_PER * STATS_COUNT)
00021
00022 #define MAX_UINT16 (~(UInt16)0)
00023
00024 #define OFFSET_FOR_CASHFLOW_BC (1UL<<31)
00025
00026 #define OFFSET_FOR_CASHFLOW_STAT ((~(Uint16)0) >> 1)
00027
00029 #define CASHFLOW_STATMASK (0xffff)
00030
00032 #define SIM_GAME_LOOP_DISASTER 2
00033
00035 #define SPEED_SLOW 15
00036
00037 #define SPEED_MEDIUM 10
00038
00039 #define SPEED_FAST 5
00040
00041 #define SPEED_TURBO 1
00042
00043 #define SPEED_PAUSED 0
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00075 #define HORIZONTAL_TILESIZE 32
00076
00077 #include <tileheader.h>
00078
00079
00081 #define SUPPLY_POWER_PLANT 100
00082
00083 #define SUPPLY_NUCLEAR_PLANT 300
00084
00085 #define SUPPLY_WATER_PUMP 200
00086
00087
00089 #define INCOME_RESIDENTIAL 25
00090
00091 #define INCOME_COMMERCIAL 35
00092
00093 #define INCOME_INDUSTRIAL 30
00094
00095
00096
00098 #define UPKEEP_BRIDGE 10
00099
00100 #define UPKEEP_ROAD 2
00101
00102 #define UPKEEP_POWERLINE 1
00103
00104 #define UPKEEP_NUCLEARPLANT 500
00105
00106 #define UPKEEP_POWERPLANT 200
00107
00108 #define UPKEEP_FIRE_STATIONS 150
00109
00110 #define UPKEEP_POLICE_STATIONS 100
00111
00112 #define UPKEEP_MILITARY_BASES 500
00113
00120 #define NUM_OF_OBJECTS 10
00121
00122
00124 #define OBJ_CHANCE_OF_TURNING 5
00125
00132 #define NUM_OF_UNITS 10
00133
00134
00136 #define DEF_POLICE_START 0
00137
00138 #define DEF_POLICE_END 2
00139
00140 #define DEF_FIREMEN_START 3
00141
00142 #define DEF_FIREMEN_END 7
00143
00144 #define DEF_MILITARY_START 8
00145
00146 #define DEF_MILITARY_END 9
00147
00148
00149
00150
00152 #define GRID_POWER (UInt8)1
00153
00154 #define GRID_WATER (UInt8)2
00155
00156 #define GRID_ALL (GRID_POWER|GRID_WATER)
00157
00159 #define CITYNAMELEN 20
00160
00162 #define CONFIG_VERSION 1
00163
00165 #define SAVEGAMEVERSION "PC07"
00166
00167 #define GG game
00168
00169 #define getMapWidth() (GG.mapx)
00170
00172 #define getMapHeight() (GG.mapy)
00173
00179 #define setMapVariables(X, Y) { \
00180 GG.mapx = X; \
00181 GG.mapy = Y; \
00182 vgame.mapmul = (UInt16)GG.mapx * GG.mapy; \
00183 }
00184
00186 #define MapMul() (vgame.mapmul)
00187
00189 #define WorldSize() (vgame.mapmul)
00190
00195 #define AddGridUpdate(T) (GG.gridsToUpdate |= (T))
00196
00201 #define NeedsUpdate(T) (GG.gridsToUpdate & (T))
00202
00206 #define ClearUpdate(T) (GG.gridsToUpdate &= (UInt8)(~(UInt8)(T)))
00207
00214 #define WORLDPOS(x, y) ((x) + (y) * (getMapWidth()))
00215
00217 #define SaveSpeed() { \
00218 vgame.oldLoopSeconds = GG.gameLoopSeconds; \
00219 GG.gameLoopSeconds = SPEED_PAUSED; \
00220 }
00221
00223 #define RestoreSpeed() { \
00224 GG.gameLoopSeconds = vgame.oldLoopSeconds; \
00225 }
00226
00228 #define getMonthsElapsed() (GG.TimeElapsed >> 2)
00229
00230 #define getMapXPos() (GG.map_xpos)
00231 #define setMapXPos(x) GG.map_xpos = (x)
00232 #define getMapYPos() (GG.map_ypos)
00233 #define setMapYPos(y) GG.map_ypos = (y)
00234 #define getLoopSeconds() (GG.gameLoopSeconds)
00235 #define setLoopSeconds(L) GG.gameLoopSeconds = (L)
00236 #define getCredits() (GG.credits)
00237 #define setCredits(C) GG.credits = (C)
00238 #define incCredits(V) GG.credits += (V)
00239 #define decCredits(V) GG.credits -= (V)
00240 #define getUpkeep(K) (GG.upkeep[K])
00241 #define setUpkeep(K,V) GG.upkeep[K] = (V)
00242 #define getStatistics(K) (&(GG.statistics[K]))
00243 #define setTimeElapsed(X) GG.TimeElapsed = (X)
00244 #define incrementTimeElapsed(X) GG.TimeElapsed += (X)
00245 #define setGameVersion(V) strncpy((char *)GG.version, (char *)V, 4)
00246 #define setTax(T) GG.tax = (T)
00247 #define getTax() (GG.tax)
00248
00249
00250
00252 typedef UInt8 welem_t;
00253
00255 typedef UInt8 selem_t;
00256
00262 typedef enum {
00263 diSTART = 0,
00264 diFireOutbreak,
00265 diPlantExplosion,
00266 diMonster,
00267 diDragon,
00268 diMeteor,
00269 diEND
00270 } disaster_t;
00271
00272 typedef enum {
00273 seOutOfMemory = 1
00274 } syserror_t;
00275
00276 typedef enum {
00277 peSTART = 0,
00278 peFineOnMoney,
00279 peLowOnMoney,
00280 peOutOfMoney,
00281 peFineOnPower,
00282 peLowOnPower,
00283 peOutOfPower,
00284 peFineOnWater,
00285 peLowOnWater,
00286 peOutOfWater,
00287 peEND
00288 } problem_t;
00289
00291 typedef enum {
00292 ztWhat = 0,
00293 ztCommercial = Z_COMMERCIAL_SLUM,
00294 ztResidential,
00295 ztIndustrial
00296 } zoneType;
00297
00299 typedef enum {
00300 dtUp = 0,
00301 dtRight,
00302 dtDown,
00303 dtLeft
00304 } dirType;
00305
00307 struct zoneTypeValue {
00308 char description[255];
00309 UInt8 value;
00310 UInt8 pollution;
00311 UInt8 crime;
00312 };
00313
00323 typedef enum {
00324 st_cashflow = 0,
00325 st_pollution,
00326 st_crime,
00327 st_residential,
00328 st_commercial,
00329 st_industrial,
00330 st_tail
00331 } StatisticItem;
00332
00340 typedef struct _history {
00342 UInt16 last_ten[STATS_COUNT];
00344 UInt16 last_century[STATS_COUNT];
00345 } stat_item;
00346
00351 typedef enum {
00352 bc_count_residential = 0,
00353 bc_value_residential,
00354 bc_count_commercial,
00355 bc_value_commercial,
00356 bc_count_industrial,
00357 bc_value_industrial,
00358 bc_count_roads,
00359 bc_value_roads,
00360 bc_count_trees,
00361 bc_value_trees,
00362 bc_water,
00363 bc_coalplants,
00364 bc_nuclearplants,
00365 bc_powerlines,
00366 bc_waterpumps,
00367 bc_waterpipes,
00368 bc_waste,
00369 bc_radioactive,
00370 bc_fire,
00371 bc_fire_stations,
00372 bc_police_departments,
00373 bc_military_bases,
00374 bc_cashflow,
00375 bc_pollution,
00376 bc_crime,
00377 bc_count_rail,
00378 bc_value_rail,
00379 bc_tail
00380 } BuildCount;
00381
00383 typedef struct _moveable_object {
00384 UInt16 x;
00385 UInt16 y;
00386 UInt16 dir;
00387 UInt16 active;
00388 } MoveableObject;
00389
00391 typedef enum {
00392 obj_monster = 0,
00393 obj_dragon,
00394 obj_chopper,
00395 obj_plane,
00396 obj_ship,
00397 obj_train,
00398 obj_power,
00399 obj_water
00400 } Objects;
00401
00403 typedef enum {
00404 DuFireman = 0, DuPolice, DuMilitary
00405 } DefenceUnitTypes;
00406
00408 typedef struct _defence_unit {
00409 UInt16 x;
00410 UInt16 y;
00411 UInt16 active;
00412 DefenceUnitTypes type;
00413 } DefenceUnit;
00414
00415
00416
00423 typedef enum {
00424 ue_traffic = 0,
00425 ue_power,
00426 ue_defense,
00427 ue_tail
00428 } UpkeepEntries;
00429
00431 typedef struct _game_struct05 {
00432 UInt8 version[4];
00433 UInt8 mapsize;
00434 Int16 _visible_x;
00435 Int16 _visible_y;
00436 Int16 map_xpos;
00437 Int16 map_ypos;
00438 Int16 _cursor_xpos;
00439 Int16 _cursor_ypos;
00440 Int32 credits;
00441 UInt32 _BuildCount[20];
00442 UInt32 TimeElapsed;
00443 UInt8 tax;
00444 UInt8 gas_bits;
00445 UInt16 gameLoopSeconds;
00446 Char cityname[CITYNAMELEN];
00447 UInt8 upkeep[ue_tail];
00448 UInt8 diff_disaster;
00449 UInt8 gridsToUpdate;
00450 DefenceUnit units[NUM_OF_UNITS];
00451 MoveableObject objects[NUM_OF_OBJECTS];
00452 } GameStruct05;
00453
00462 typedef struct _game_struct06a {
00463 UInt8 version[4];
00464 UInt8 mapx;
00465 UInt8 mapy;
00466 Int8 map_xpos;
00467 Int8 map_ypos;
00468 Int32 credits;
00469 UInt32 TimeElapsed;
00470 UInt8 tax;
00471 UInt8 gameLoopSeconds;
00472 UInt8 diff_disaster;
00474 UInt8 gas_bits;
00475 Int8 cityname[20];
00476 UInt8 upkeep[ue_tail];
00477 UInt8 gridsToUpdate;
00479 UInt16 evaluation;
00481 stat_item statistics[st_tail];
00482 DefenceUnit units[NUM_OF_UNITS];
00483 MoveableObject objects[NUM_OF_OBJECTS];
00484 } GameStruct06;
00485
00487 typedef struct _stat_to_value {
00488 StatisticItem item;
00489 BuildCount offset;
00490 } stat_to_value;
00491
00493 extern stat_to_value statvalues[];
00494
00495
00496
00497
00498
00499
00500
00502 typedef GameStruct06 GameStruct;
00503
00504
00511 typedef struct _vgame_struct {
00512 UInt16 mapmul;
00513 UInt32 prior_credit;
00514 Int16 BuildCount[bc_tail];
00515 UInt16 oldLoopSeconds;
00516 } vGameStruct;
00517
00519 typedef struct _visual_tag {
00520 UInt8 TileSize;
00521 UInt8 MapTileSize;
00522 UInt16 visible_x;
00523 UInt16 visible_y;
00524 UInt16 cursor_xpos;
00525 UInt16 cursor_ypos;
00526 } vGameVisuals;
00527
00528
00529 #define mapTileSize() (visuals.MapTileSize)
00530 #define setMapTileSize(X) visuals.MapTileSize = (X)
00531 #define gameTileSize() (visuals.TileSize)
00532 #define setGameTileSize(X) visuals.TileSize = (X)
00533
00534 #define inGameTiles(X) ((X) / visuals.TileSize)
00535
00536 #define getVisibleX() (visuals.visible_x)
00537 #define getVisibleY() (visuals.visible_y)
00538 #define setVisibleX(X) visuals.visible_x = (X)
00539 #define setVisibleY(Y) visuals.visible_y = (Y)
00540
00541 #define getCursorX() (visuals.cursor_xpos)
00542 #define setCursor(X) visuals.cursor_xpos = (X)
00543 #define getCursorY() (visuals.cursor_ypos)
00544 #define setCursorY(Y) visuals.cursor_ypos = (Y)
00545
00552 typedef struct _appConfig_01 {
00553 int version;
00554 PlatformAppConfig pc;
00555 } appConfig_01_t;
00556
00558 typedef appConfig_01_t AppConfig_t;
00559
00571 char *getMonthString(UInt16 month, Char *string, UInt16 length);
00572
00573 #endif