diff options
author | Rangi <35663410+Rangi42@users.noreply.github.com> | 2020-11-04 20:11:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 20:11:52 -0500 |
commit | ed03fc4f4a3287a01647e528abba27aac1937de0 (patch) | |
tree | 32fef70a31af3a0b5ad2b0d34042c312574fb42d /macros | |
parent | 87131eaa1ba5dc898e64c7415b5bce61c6aa146d (diff) | |
parent | aae999f72bd81a3156c7e00da4ebf499f52da5a6 (diff) |
Merge pull request #59 from Rangi42/master
Start reorganizing pokeyellow
Diffstat (limited to 'macros')
-rwxr-xr-x | macros/data.asm | 9 | ||||
-rw-r--r-- | macros/farcall.asm | 57 | ||||
-rw-r--r-- | macros/gfx.asm | 12 | ||||
-rw-r--r-- | macros/scripts/gfx_anims.asm | 37 | ||||
-rw-r--r-- | macros/wram.asm | 20 |
5 files changed, 135 insertions, 0 deletions
diff --git a/macros/data.asm b/macros/data.asm index 16742d53..3f18fb6e 100755 --- a/macros/data.asm +++ b/macros/data.asm @@ -78,3 +78,12 @@ dbbw: MACRO db \1, \2 dw \3 ENDM + +sine_wave: MACRO +; \1: amplitude +x = 0 +REPT $20 + dw (sin(x) + (sin(x) & $ff)) >> 8 ; round up +x = x + (\1) * $40000 +ENDR +ENDM diff --git a/macros/farcall.asm b/macros/farcall.asm index b4af8b2d..e6ecdaae 100644 --- a/macros/farcall.asm +++ b/macros/farcall.asm @@ -31,3 +31,60 @@ homecall: MACRO pop af call BankswitchCommon ENDM + +homecall_jump: MACRO + ldh a, [hLoadedROMBank] + push af + ld a, BANK(\1) + call BankswitchCommon + call \1 + pop af + jp BankswitchCommon +ENDM + +homecall_jump_sf: MACRO + ldh a, [hLoadedROMBank] + push af + ld a, BANK(\1) + call BankswitchCommon + call \1 + pop bc + ld a, b + jp BankswitchCommon +ENDM + +homecall_sf: MACRO ; homecall but save flags by popping into bc instead of af + ldh a, [hLoadedROMBank] + push af + ld a, BANK(\1) + call BankswitchCommon + call \1 + pop bc + ld a, b + call BankswitchCommon +ENDM + +switchbank: MACRO + ld a, BANK(\1) + call BankswitchCommon +ENDM + +callbs: MACRO + ld a, BANK(\1) + call BankswitchCommon + call \1 +ENDM + +calladb_ModifyPikachuHappiness: MACRO + ld hl, ModifyPikachuHappiness + ld d, \1 + ld b, BANK(ModifyPikachuHappiness) + call Bankswitch +ENDM + +callabd_ModifyPikachuHappiness: MACRO + ld hl, ModifyPikachuHappiness + ld b, BANK(ModifyPikachuHappiness) + ld d, \1 + call Bankswitch +ENDM diff --git a/macros/gfx.asm b/macros/gfx.asm index 98eabec4..ad428eb0 100644 --- a/macros/gfx.asm +++ b/macros/gfx.asm @@ -16,6 +16,18 @@ color EQUS "+ PAL_COLOR_SIZE *" tiles EQUS "* LEN_2BPP_TILE" tile EQUS "+ LEN_2BPP_TILE *" +setpal: MACRO + ld a, \1 << 6 | \2 << 4 | \3 << 2 | \4 +ENDM + +setpalBGP: MACRO + setpal SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE +ENDM + +setpalOBP: MACRO + setpal SHADE_BLACK, SHADE_DARK, SHADE_WHITE, SHADE_WHITE +ENDM + dbsprite: MACRO ; x tile, y tile, x pixel, y pixel, vtile offset, attributes db (\2 * TILE_WIDTH) % $100 + \4, (\1 * TILE_WIDTH) % $100 + \3, \5, \6 diff --git a/macros/scripts/gfx_anims.asm b/macros/scripts/gfx_anims.asm new file mode 100644 index 00000000..f475ad8d --- /dev/null +++ b/macros/scripts/gfx_anims.asm @@ -0,0 +1,37 @@ +; pic + oam animations + +frame: MACRO + db \1 +x = \2 +IF _NARG > 2 +REPT _NARG - 2 +x = x | (\3 << 1) + shift +ENDR +ENDC + db x +ENDM + + const_def -1, -1 + + const endanim_command ; $ff +endanim: MACRO + db endanim_command +ENDM + + const dorestart_command ; $fe +dorestart: MACRO + db dorestart_command +ENDM + + const dorepeat_command ; $fd +dorepeat: MACRO + db dorepeat_command + db \1 ; command offset to jump to +ENDM + + const delanim_command ; $fc +delanim: MACRO +; Removes the object from the screen, as opposed to `endanim` which just stops all motion + db delanim_command +ENDM diff --git a/macros/wram.asm b/macros/wram.asm index 41fd1dad..10163692 100644 --- a/macros/wram.asm +++ b/macros/wram.asm @@ -95,3 +95,23 @@ spritestatedata2: MACRO ds 1 \1End:: ENDM + +animated_object: MACRO +\1Index:: db ; 0 +\1FramesetID:: db ; 1 +\1AnimSeqID:: db ; 2 +\1TileID:: db ; 3 +\1XCoord:: db ; 4 +\1YCoord:: db ; 5 +\1XOffset:: db ; 6 +\1YOffset:: db ; 7 +\1Duration:: db ; 8 +\1DurationOffset:: db ; 9 +\1FrameIndex:: db ; a +\1FieldB:: db ; b +\1FieldC:: db ; c +\1FieldD:: db ; d +\1FieldE:: db ; e +\1FieldF:: db ; f +\1End:: +ENDM |