diff options
| author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-07-07 18:50:58 -0400 |
|---|---|---|
| committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-07-07 19:43:11 -0400 |
| commit | bbf2f51a02b2544f1bef32a5868503b474ae2fef (patch) | |
| tree | d73507228a57e4f3cece2fb93fe7df3a9439553f /home/palettes.asm | |
| parent | Identify SPRITESTATEDATA2_ORIGFACINGDIRECTION (diff) | |
| download | pokeyellow-bbf2f51a02b2544f1bef32a5868503b474ae2fef.tar.gz pokeyellow-bbf2f51a02b2544f1bef32a5868503b474ae2fef.tar.xz pokeyellow-bbf2f51a02b2544f1bef32a5868503b474ae2fef.zip | |
Move all code out of home.asm into home/
This results in 64 home/*.asm files, comparable to pokecrystal's 57.
Diffstat (limited to 'home/palettes.asm')
| -rw-r--r-- | home/palettes.asm | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/home/palettes.asm b/home/palettes.asm new file mode 100644 index 00000000..08dcdc85 --- /dev/null +++ b/home/palettes.asm @@ -0,0 +1,57 @@ +RestoreScreenTilesAndReloadTilePatterns:: + call ClearSprites + ld a, $1 + ld [wUpdateSpritesEnabled], a + call ReloadMapSpriteTilePatterns + call LoadScreenTilesFromBuffer2 + call LoadTextBoxTilePatterns + call RunDefaultPaletteCommand + jr Delay3 + +GBPalWhiteOutWithDelay3:: + call GBPalWhiteOut + +Delay3:: +; The bg map is updated each frame in thirds. +; Wait three frames to let the bg map fully update. + ld c, 3 + jp DelayFrames + +GBPalNormal:: +; Reset BGP and OBP0. + ld a, %11100100 ; 3210 + ldh [rBGP], a + ld a, %11010000 ; 3100 + ldh [rOBP0], a + ret + +GBPalWhiteOut:: +; White out all palettes. + xor a + ldh [rBGP], a + ldh [rOBP0], a + ldh [rOBP1], a + ret + +RunDefaultPaletteCommand:: + ld b, SET_PAL_DEFAULT +RunPaletteCommand:: + ld a, [wOnSGB] + and a + ret z + predef_jump _RunPaletteCommand + +GetHealthBarColor:: +; Return at hl the palette of +; an HP bar e pixels long. + ld a, e + cp 27 + ld d, 0 ; green + jr nc, .gotColor + cp 10 + inc d ; yellow + jr nc, .gotColor + inc d ; red +.gotColor + ld [hl], d + ret |
