# TODO
-- Code style: Replace leading spaces with tabs (space was set to 2)
-
## scope
-[ ] Mini turn based rpg
-[ ] One button per slot
- - Weapon (A)
- - Cast (B)
- - Item (Select)
-[ ]
-
## Game field
[ ] 10x8 map
[ ] Load map with pre-determined tiles
-[ ] Player - Moves from tile to tile
-[ ] Actors
- [ ] Each map may have up to 4 actors
- [ ] An actor may have dialog, be a shotkeeper
- or start combat when talked to
- [ ] actors may patrol
- [ ] actors mark the tile they are on with their actor index
- [ ] one actor update per frame
-[ ] player updates very frame
-
-[ ] on hostile maps only:
- [ ] when the player moves a danger level increments every frame
- [ ] when the danger level + rng roll from 1-16 > 64 combat starts
- [ ] each map may define up to 4 enemy sets that can appear
-[ ] each map may define 4 exits (north, west, east, south)
- that are triggered when the player presses up,left,right,down
- on the respective tiles
-[ ] each map may define one special exit that is triggere by touching a tile
- with the exit flag set
-[ ] the player may level up and gain HP or MP (choice to be made)
-
# Combat
Maps are the building blokc of the world
Each map has a header containg data about what kind of map it is,
-what tiles to load, what encounter to load etc.
+what tiles to load, what actors to load etc.
## Tiles
Each map can point to a table of tiles.
-Tiles can hold information such as tiles to render and event pointers.
-
-## Events
-
-Events can be anything that happens when a player touches the tile.
-Common events are exits, scripted encounters or cutscenes.
+Tiles can hold information such as tiles to render.
## Exits
Each map can point to a table of exits.
-This table is referenced by exit events.
+Exits point to an exit table entry in t_state.
; and call
ret
-act_shop_keeper:
- actdef ACT_T_SHOP_KEEPER, 0, 10, 10, 0, 0, NULL
-
act_bat:
- actdef ACT_T_BAT, 0, 10, 10, 0, 0, act_bat_cb
-
-act_bat_cb:
- actcbdef 1, 1, 1, 2, 0
+ actdef ACT_T_BAT, 0, 10, 10, 0, 0
.se 0
.de ACT_T_NULL, 1
.de ACT_T_PLAYER, 1
-.de ACT_T_SHOP_KEEPER, 1
.de ACT_T_BAT, 1
; actor struct
.de act_state, 1
.de act_hp, 1
.de act_mp, 1
-.de act_cb, 2
.de act_size, 0
- ; actor combat stats struct
- ; this can be shared by many actors
-.se 0
-.de act_cb_flags, 1
-.de act_cb_lvl, 1
-.de act_cb_exp, 2
-.de act_cb_atk, 1
-.de act_cb_def, 1
-.de act_cb_hp_max, 1
-.de act_cb_mp_max, 1
-.de act_cb_p0, 1
-.de act_cb_state, 1
-.de act_cb_size, 0
-
; map flags
.se 1
.de map_routine, 2
; ptr to actor table for this map
.de map_acts, 2
- ; ptr to encounter table
-.de map_encounters, 2
; ptr to exit table
.de map_exits, 2
; pointers to tile banks to be loaded
; tile type enum
.se 0
.de TT_EMPTY, 1
-.de TT_WALL, 1
+.de TT_WALL, 1
+ ; exit tiles store index in exit table
+ ; in p0
+.de TT_EXIT, 1
; tile flags
.se 1
; standing on tile
; 0 = player, 1-N = map actors
.de t_actor, 1
- ; if != 0 this points to an event
- ; that should execute when the player hits the tile
-.de t_event, 2
+.de t_p0, 1
; graphical tile
.de t_tile, 1
.de t_size, 0
-
- ; tile event types
-.se 0
- ; exit on touch
- ; p0: exit table entry
- ; p1: new y pos
- ; p2: new x pos
-.de TE_EXIT, 1
-
-
- ; tile event struct
-.se 0
-.de te_type, 1
-.de te_flags, 1
-.de te_p0, 1
-.de te_p1, 1
-.de te_p2, 1
-.de te_size, 0
; exit table entry
.se 0
; where each tile has values and its current state. The map can be drawn from this.
l1:
- mapdef 0, map_r_nop, 0, 0, 0, bank8000, bank8800, bank8C00, bank9000, tile_id_table
+ mapdef 0, map_r_nop, 0, 0, bank8000, bank8800, bank8C00, bank9000, tile_id_table
.db TWL, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS
.db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS
.db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS
; $1: flags
; $2: map routine
; $3: actors
- ; $4: encounters
- ; $5: exits
- ; $6: tile bank 0
- ; $7: tile bank 1
- ; $8: tile bank 2
- ; $9: tile bank 3
- ; $10: tile id table
+ ; $4: exits
+ ; $5: tile bank 0
+ ; $6: tile bank 1
+ ; $7: tile bank 2
+ ; $8: tile bank 3
+ ; $9: tile id table
#macro mapdef
.db $1
dw $2
dw $7
dw $8
dw $9
- dw $10
#endmacro
; define a tile
; inputs:
; $1: type
; $2: flags
- ; $3: tile gfx
+ ; $3: p0
+ ; $4: tile gfx
#macro tiledef
.db $1, $2
; t_actor
.db 0
- ; t_event
- .db 0, 0
.db $3
+ .db $4
#endmacro
- ; defines a tile event
- ; inputs:
- ; $1: type
- ; $2: flags
- ; $3: p0
- ; $4: p1
- ; $5: p2
-#macro tileeventdef
- .db $1, $2
- .db $3, $4, $5
-#endmacro
-
; defines a new actor
; inputs:
; $1: type
; $4: x
; $5: hp
; $6: mp
- ; $7: combat stats ptr (or NULL)
#macro actdef
.db $1, $2, $3, $4
; p0 and state
.db 0, 0
.db $5, $6
- .db $7
#endmacro
; defines combat stats
; fallback tile
tile_null:
- tiledef 0, 0, 0
+ tiledef 0, 0, 0, 0
tile_grass:
- tiledef TT_EMPTY, 0, GFX_GRASS
+ tiledef TT_EMPTY, 0, 0, GFX_GRASS
tile_wall:
- tiledef TT_WALL, TF_WALL, GFX_WALL
+ tiledef TT_WALL, TF_WALL, 0, GFX_WALL
; seed must never be 0
srand: .adv 2
- ; player combtat stats
-player_cb: .adv act_cb_size
; stores the last move direction
player_direction: .adv 1
player_move_timer: .adv 1