diff options
author | yenatch <yenatch@gmail.com> | 2014-06-10 23:03:21 -0700 |
---|---|---|
committer | yenatch <yenatch@gmail.com> | 2014-06-10 23:03:21 -0700 |
commit | 0d682e076acd6e742bd711a43ab1c6c7c3492b3c (patch) | |
tree | c40b453250a4d9503f933e62a1e60d2ad2fbfc4a | |
parent | 61521f4458a06ae5e7b8c872ae1b48cb5dd9572c (diff) |
Fix argument handling in *coord macros. Add a "percent" shortcut.
Random returns a value from 0 to 0xff.
Instead of doing extra work, most probabilities are out of 0xff.
Convert these from percentages at build time for readability.
-rw-r--r-- | macros.asm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/macros.asm b/macros.asm index aa8876055..efd43318a 100644 --- a/macros.asm +++ b/macros.asm @@ -13,6 +13,8 @@ page EQUS "db $50," ; Start a new Pokedex page. dex EQUS "db $e8, $50" ; End a Pokedex entry. +percent EQUS "* $ff / 100" + ; macros require rst vectors to be defined FarCall EQU $08 Bankswitch EQU $10 @@ -118,15 +120,15 @@ B_ EQU 12 bccoord: MACRO - ld bc, TileMap + SCREEN_WIDTH * \2 + \1 + ld bc, TileMap + SCREEN_WIDTH * (\2) + (\1) ENDM decoord: MACRO - ld de, TileMap + SCREEN_WIDTH * \2 + \1 + ld de, TileMap + SCREEN_WIDTH * (\2) + (\1) ENDM hlcoord: MACRO - ld hl, TileMap + SCREEN_WIDTH * \2 + \1 + ld hl, TileMap + SCREEN_WIDTH * (\2) + (\1) ENDM |