#include <PalmOS.h>
#include <StringMgr.h>
#include <KeyMgr.h>
#include <StdIOPalm.h>
#include <simcity.h>
#include <savegame.h>
#include <savegame_be.h>
#include <options.h>
#include <map.h>
#include <budget.h>
#include <zakdef.h>
#include <ui.h>
#include <drawing.h>
#include <build.h>
#include <query.h>
#include <handler.h>
#include <globals.h>
#include <simulation.h>
#include <disaster.h>
#include <resCompat.h>
#include <palmutils.h>
#include <simcity_resconsts.h>
#include <mem_compat.h>
#include <minimap.h>
#include <beam.h>
#include <logging.h>
#include <locking.h>
Go to the source code of this file.
Data Structures | |
struct | _bmphandles |
Handles and resourceID's of the bitmaps. More... | |
struct | _silkKeys |
structure for mapping the silk keys to 'button keys' More... | |
struct | problemtable |
table containing the problem_table input/output function More... | |
struct | StatusPositions |
the status positions More... | |
Defines | |
#define | posAt(x) &(lrpositions[(x)]) |
get low resolution positions | |
#define | MAXLOC (sizeof (lrpositions) / sizeof (lrpositions[0])) |
maximum size of positions array | |
#define | MAX_SPEED (sizeof (speedslist) / sizeof (speedslist[0])) |
maximum speed | |
Functions | |
void | buildSilkList (void) |
find the calculator button on the screen | |
Int16 | vkDoEvent (UInt16 key) |
process a virtual key press | |
Err | RomVersionCompatible (UInt32 requiredVersion, UInt16 launchFlags) |
is the ROM on this machine compatible | |
void | cycleSpeed (void) |
cycle up to the next speed | |
void | CheckTextClick (Coord x, Coord y) |
Perform an action based on the location on screen that was clicked. | |
Int16 | doButtonEvent (ButtonEvent key) |
Do the command against the key passed. | |
Int16 | speedOffset (void) |
get the offset of the speed into the speedslist array | |
void | performPaintDisplay (void) |
actually perform all the painting This will perform all the painting that has been asked for on the display. It allows us to pool all the painting in one point; which allows for more consistent painting of the display; rather than mandating the painting at a point that would make it inefficient. | |
void | UIPostLoadGame (void) |
UI post load game handler. | |
void | UIGotoForm (Int16 n) |
BuildCode | UIGetSelectedBuildItem (void) |
get the selected item to build | |
void | UIInitGraphic (void) |
initialize the graphics | |
void | ClearLowOutPowerFlags (void) |
clear the low and out of power flags | |
void | ClearLowOutWaterFlags (void) |
clear the low and out water flags | |
void | ClearLowOutMoneyFlags (void) |
clear the low and out of money flags | |
void | UIProblemNotify (problem_t problem) |
notify that theres a problem in the city. | |
void | UIDisplayError1 (char *message) |
Display and error dialog with one parameter. | |
void | UIInitDrawing (void) |
Initialize the drawing area. | |
void | UIFinishDrawing (void) |
finish up using the drawing area | |
void | UILockScreen (void) |
lock the screen, pause any painting operations to happen | |
void | UIUnlockScreen (void) |
unlock the screen, allow any paused repainting to happen | |
void | _UIDrawRect (Int16 nTop, Int16 nLeft, Int16 nHeight, Int16 nWidth) |
in theory draw a rectangle. | |
void | UISetUpGraphic (void) |
Setup the graphics. | |
void | UIPaintCursor (UInt16 xpos, UInt16 ypos) |
draw a cursor at the location specified | |
void | PaintLossIcon (UInt16 xpos, UInt16 ypos, welem_t elem) |
Draw a generic loss icon. | |
void | UIPaintWaterLoss (UInt16 xpos, UInt16 ypos) |
Draw a water loss overlay on the screen at the specified location. | |
void | UIPaintPowerLoss (UInt16 xpos, UInt16 ypos) |
Draw a power loss overlay on the screen at the specified location. | |
void | UIPaintSpecialUnit (UInt16 xpos, UInt16 ypos, Int8 i) |
draw a special unit on the screen | |
void | UIPaintSpecialObject (UInt16 xpos, UInt16 ypos, Int8 i) |
Draw a special object. | |
void | UIPaintField (UInt16 xpos, UInt16 ypos, welem_t nGraphic) |
draw a field | |
void | UIPaintPlayArea (void) |
draw the play area | |
void | UIPaintDesires (void) |
Paint the desires on the display. | |
void | UIScrollDisplay (dirType direction) |
scroll the map in the appropriate direction | |
UInt32 | GetRandomNumber (UInt32 max) |
get a random number between 0 and max | |
void | DrawItem (loc_screen location, char *text) |
Draw a status item at the position requested. | |
Int16 | UICheckOnClick (Coord x, Coord y) |
Check a click in the display. | |
void | UIPaintDate (void) |
Draw the date on screen. | |
void | UIPaintCredits (void) |
Draw the amount of credits on screen. | |
void | UIPaintLocation (void) |
Draw the map position on screen. | |
void | UIPaintBuildIcon (void) |
Update the build icon on screen. | |
Int8 | UIClipped (UInt16 xpos, UInt16 ypos) |
check if the map location is being clipped by the game | |
void | UIPaintSpeed (void) |
Draw the speed icon on screen. | |
void | UIPaintPopulation (void) |
Draw the population on screen. | |
void | UICheckMoney (void) |
Check if we've got dosh to do what we're asking to do. | |
void | MapHasJumped (void) |
the map has jumped to another location | |
Int16 | HardButtonEvent (ButtonKey key) |
process a hard button being pressed | |
Variables | |
WinHandle | winZones |
the on screen zones | |
WinHandle | winMonsters |
the Monsters | |
WinHandle | winUnits |
The defensive units. | |
WinHandle | winSpeeds |
the offscreen window containing the speed images | |
const struct _bmphandles | handles [] |
Handles and resourceID's of the bitmaps. | |
problemtable | problem_table [] |
table containing the problem_table input/output function | |
UInt8 * | didLock = NULL |
handle for checking in the winscfeenunlock function The WinScreenLock is 'optional' depending on how much memory you have. the call may or may not succeed. by using these two APIs we can get faster, flickerless allscreen updating | |
UInt8 | lockCalls = 0 |
RectangleType | shapes [] |
the default shape/size of the various locations | |
const struct StatusPositions | lrpositions [] |
the positions of the items on screen - low resolution | |
UInt8 | speedslist [] |
list of speeds in game | |
_silkKeys | silky [] |
structure for mapping the silk keys to 'button keys' |
This file has all the routines to deal with the startup and general main loop-executionness of the program.
Definition in file simcity.c.
|
Value: VISIBILITY void \ CLEARER(void) \ { \ __state &= ~((UInt16)1<<(BIT)); \ } \ VISIBILITY void \ SETTER(void) \ { \ __state |= ((UInt16)1<<(BIT)); \ } \ VISIBILITY UInt16 \ TESTER(void) \ { \ return (__state & ((UInt16)1<<(BIT))); \ } |
|
find the calculator button on the screen The calculator button can be a favorites button on the Zire. The problem is that the Zire uses a different code on PalmOS 4 than on PalmOS 5 for the key, making it not work. Definition at line 2505 of file simcity.c. References isZireOld(), silky, UInt16, and _silkKeys::vChar. |
|
Perform an action based on the location on screen that was clicked.
Definition at line 2046 of file simcity.c. References doButtonEvent(), GETMINIMAPVISIBLE, and UICheckOnClick(). |
|
cycle up to the next speed This will loop back around to paused when you exceed turbo Definition at line 2365 of file simcity.c. References MAX_SPEED, speedslist, and UInt16. |
|
Do the command against the key passed.
Definition at line 2382 of file simcity.c. References addGraphicUpdate(), dtDown, dtLeft, dtRight, dtUp, gu_location, and ScrollDisplay(). Referenced by CheckTextClick(), and HardButtonEvent(). |
|
Draw a status item at the position requested.
Definition at line 1971 of file simcity.c. References StatusPositions::extents, Int16, StatusPositions::offset, StatusPositions::point, posAt, and shapes. Referenced by UIPaintCredits(), UIPaintDate(), UIPaintLocation(), and UIPaintPopulation(). |
|
get a random number between 0 and max
Definition at line 1868 of file simcity.c. References UInt32. |
|
process a hard button being pressed
Definition at line 2454 of file simcity.c. References ButtonKey, and doButtonEvent(). Referenced by vkDoEvent(). |
|
the map has jumped to another location Ensure that the scroll bars are moved correctly. |
|
Draw a generic loss icon. It is obtained from the zones bitmap. The location in the zones bitmap is stated by the tilex and tiley values. This specifies the overlay. The icon itself is tile pixels before this.
Definition at line 1560 of file simcity.c. References HORIZONTAL_TILESIZE, UIClipped(), UInt16, welem_t, and winZones. Referenced by UIPaintPowerLoss(), and UIPaintWaterLoss(). |
|
is the ROM on this machine compatible
|
|
get the offset of the speed into the speedslist array This is used to calculate the index into the speed bitmap for display purposes
Definition at line 2349 of file simcity.c. References MAX_SPEED, speedslist, and UInt16. Referenced by UIPaintSpeed(). |
|
Check if we've got dosh to do what we're asking to do. If we're nearly broke show us a warning dialog. If we're broke then show us a we're broke dialog. Only show them once per load cycle. Definition at line 2263 of file simcity.c. References peLowOnMoney, peOutOfMoney, and UIProblemNotify(). |
|
Check a click in the display.
Definition at line 2026 of file simcity.c. References MAXLOC, shapes, and UInt16. Referenced by CheckTextClick(). |
|
check if the map location is being clipped by the game
Definition at line 2175 of file simcity.c. References UInt16. |
|
Display and error dialog with one parameter.
|
|
finish up using the drawing area unused |
|
get the selected item to build
|
|
unused |
|
Initialize the drawing area. unused |
|
initialize the graphics
|
|
lock the screen, pause any painting operations to happen \Try to lock the screen from updates. This allows bulk updates to the screen without repainting until unlocked. |
|
draw a cursor at the location specified
Definition at line 1544 of file simcity.c. References UInt16. |
|
draw a field
Definition at line 1683 of file simcity.c. References HORIZONTAL_TILESIZE, UIClipped(), UInt16, welem_t, and winZones. |
|
Draw a power loss overlay on the screen at the specified location. The field has already been determined to not have power Definition at line 1607 of file simcity.c. References PaintLossIcon(), and UInt16. |
|
Draw a special object.
Definition at line 1651 of file simcity.c. References Int8, UIClipped(), UInt16, and winMonsters. |
|
draw a special unit on the screen
Definition at line 1619 of file simcity.c. References Int8, UIClipped(), UInt16, and winUnits. |
|
Draw a water loss overlay on the screen at the specified location. The Field has already been determined to not have water. Definition at line 1596 of file simcity.c. References PaintLossIcon(), and UInt16. |
|
UI post load game handler. unused |
|
notify that theres a problem in the city.
Definition at line 1390 of file simcity.c. References problemtable::alert, problemtable::entry, problem_t, problem_table, problemtable::set, problemtable::test, and UInt16. |
|
scroll the map in the appropriate direction
Definition at line 1780 of file simcity.c. References dirType, DrawFieldWithoutInit(), dtDown, dtLeft, dtRight, dtUp, GETMINIMAPVISIBLE, Int16, LockZone(), lz_flags, lz_world, minimapIntersect(), minimapPaint(), UIFinishDrawing(), UIInitDrawing(), UInt16, UIPaintCursor(), UIPaintLocation(), and UnlockZone(). |
|
process a virtual key press
Definition at line 2551 of file simcity.c. References _silkKeys::event, HardButtonEvent(), silky, UInt16, and _silkKeys::vChar. |
|
Initial value: { hPocketCity, hBudget, hMap , hFiles, hFilesNew, hQuickList, hExtraList, hOptions, hButtonConfig, hQuery } |
|
\ brief counter of number of calls to lock screen Definition at line 1452 of file simcity.c. Referenced by UILockScreen(), and UIUnlockScreen(). |
|
Initial value: { { {0, 0} , {0, 1}, 1 }, { {0, 0}, {0, 1}, 8 }, { {0, 0}, {0, 1}, 1 | 8 }, { {0, 0}, {0, 1}, 4 | 8 } }
|
|
Initial value: { { {0, 0}, {0, 10} }, { {0, 0}, {0, 10} }, { {0, 0}, {0, 10} }, { {0, 0}, {0, 10} } }
Definition at line 1911 of file simcity.c. Referenced by DrawItem(), UICheckOnClick(), UIPaintCredits(), UIPaintLocation(), and UIPaintPopulation(). |
|
structure for mapping the silk keys to 'button keys' The button keys are known 'event types'. Referenced by buildSilkList(), and vkDoEvent(). |
|
Initial value: list of speeds in game
Definition at line 2335 of file simcity.c. Referenced by cycleSpeed(), and speedOffset(). |