ref: 0d682e076acd6e742bd711a43ab1c6c7c3492b3c
parent: 61521f4458a06ae5e7b8c872ae1b48cb5dd9572c
author: yenatch <[email protected]>
date: Tue Jun 10 19:03:21 EDT 2014
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.
--- a/macros.asm
+++ b/macros.asm
@@ -13,6 +13,8 @@
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 @@
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