; AtariWars - types definitions and data.

AIRPORT         = 10
ECONOMY_RAM     = $7c00
NONE            = $ff

        .enum	unit_kind
INFANTRY
TANK
RECON
HOWITZER
HELICOPTER
ANTI_AIR
        .ende

UNIT_KINDS      = unit_kind.ANTI_AIR+1

        .enum	ai_level
EASY
NORMAL
HARD
        .ende

        .enum	action_mode
MOVE
ATTACK
        .ende

        .enum	menu_command
MOVE
ATTACK
WAIT
CAPTURE
END_TURN
BUY
        .ende

MENU_ITEMS      = menu_command.BUY+1

; Message zero remains the empty HUD entry.

        .enum	message_id
SELECT          = 1
ENEMY
ACTED
OCCUPIED
BLOCKED
ATTACK
CAPTURE
VICTORY
MENU
MOVE
TARGET
COMPUTER
NO_TARGET
TARGET_READY
NEXT_MAP
FINAL_MAP
REPLAY
RETRY
CAPTURED
NO_MONEY
BOUGHT
HQ_BLOCKED
ARMY_FULL
NO_HQ
SHOP
PURCHASED
NO_BUY
MOVED
NO_REINFORCEMENTS
RANGE
RANGE_EMPTY
FUEL_LOST
NO_AIRPORT
SUPPLY_EMPTY
SUPPLY_WAIT
        .ende

        .enum	app_screen
PLAY
TITLE
COMPLETE
BRIEFING
        .ende

        .enum	play_mode
CAMPAIGN
SINGLE_MAP
        .ende

EXTRA_RAM       = $9a00
PM_RAM          = $6000
PM_BANK_BYTES   = 2048
hud             = PM_RAM+PM_BANK_BYTES
INSPECT_RAM     = PM_RAM+PM_BANK_BYTES+256
WATER_RAM       = PM_RAM+PM_BANK_BYTES*2
FRAMEBUFFER_RAM = $8010
PM_MAP_X        = 64
PM_MAP_Y        = 24
RASTER_BANDS     = 40
PM_TABLE_SIZE   = 120
BATTLE_PHASES   = 4
HELP_RAM        = $7800
KEY_HELP        = $11
KEY_HELP_ALT    = $39
KEY_SPACE       = $21
KEY_RETURN      = $0c
KEY_ESCAPE      = $1c
KEY_RESTART     = $28
KEY_MENU        = $25
KEY_TAB         = $2c
KEY_TURN        = $2a
KEY_TITLE       = $2d
KEY_BUY         = $15
KEY_RANGE       = $3d

dst             = $80
src             = $82
maskptr         = $84
scratch         = $86
pmWrite         = $88

        .struct	app_t
screen          .byte
mode            .byte
map             .byte
choice          .byte
unitCount       .byte
startingCash    .byte
copy            .byte
delta           .byte
cursorX         :2 .byte
cursorY         :2 .byte
        .ends

        .struct	game_t
team            .byte
winner          .byte
selected        .byte
cursorX         .byte
cursorY         .byte
round           .byte
mode            .byte
menuOpen        .byte
menuChoice      .byte
message         .byte
target          .byte
hit             .byte
rangeVisible    .byte
        .ends

; Structure of arrays keeps the unit index usable directly in X/Y.

        .struct	units_t
x               :MAX_UNITS .byte
y               :MAX_UNITS .byte
kind            :MAX_UNITS .byte
team            :MAX_UNITS .byte
hp              :MAX_UNITS .byte
mp              :MAX_UNITS .byte
acted           :MAX_UNITS .byte
fuel            :MAX_UNITS .byte
        .ends

        .struct	input_t
key             .byte
repeatDelay     .byte
fireNow         .byte
fireOld         .byte
consoleNow      .byte
consoleOld      .byte
direction       .byte
oldX            .byte
oldY            .byte
        .ends

        .struct	help_t
active          .byte
        .ends

        .struct	movement_t
budget          .byte
cell            .byte
cost            .byte
remaining       .byte
count           .byte
reachable       :MAP_CELLS .byte
occupied        :MAP_CELLS .byte
        .ends

        .struct	draw_t
tileX           .byte
tileY           .byte
mapIndex        .byte
unit            .byte
overlay         .byte
lines           .byte
        .ends

        .struct	menu_t
ready           .byte
total           .byte
unit            .byte
index           .byte
digits          .byte
command         .byte
column          .byte
positions       :MENU_ITEMS .byte
        .ends

        .struct	attack_t
count           .byte
cursor          .byte
unit            .byte
x               .byte
y               .byte
savedY          .byte
cover           .byte
step            .byte
targets         :MAX_UNITS .byte
        .ends

        .struct	property_t
owner           :MAP_CELLS .byte
        .ends

        .struct	economy_t
cash            :2 .byte
bought          :2 .byte
purchased       :2 .byte
cooldown        :2 .byte
buyOpen         .byte
choice          .byte
message         .byte
income          .byte
hq              .byte
slot            .byte
cost            .byte
        .ends

        .struct	battle_t
active          .byte
phase           .byte
timer           .byte
shot            .byte
lastShot        .byte
attacker        .byte
defender        .byte
beforeHP        .byte
afterHP         .byte
displayHP       .byte
attackerHP      .byte
damage          .byte
repeat          .byte
columns         .byte
side            .byte
packed          .byte
row             :8 .byte
        .ends
