Merge 2d0ed11 and 355acfc from Roukaour/master

This commit is contained in:
xCrystal 2018-01-01 20:25:07 +01:00
commit a98ed77c83
9 changed files with 61 additions and 61 deletions

View File

@ -145,8 +145,10 @@ rHDMA4 EQU $ff54 ; CGB Mode Only - New DMA Destination, Low
rHDMA5 EQU $ff55 ; CGB Mode Only - New DMA Length/Mode/Start rHDMA5 EQU $ff55 ; CGB Mode Only - New DMA Length/Mode/Start
rRP EQU $ff56 ; CGB Mode Only - Infrared Communications Port rRP EQU $ff56 ; CGB Mode Only - Infrared Communications Port
rBGPI EQU $ff68 ; CGB Mode Only - Background Palette Index rBGPI EQU $ff68 ; CGB Mode Only - Background Palette Index
rBGPI_AUTO_INCREMENT EQU 7 ; increment rBGPI after write to rBGPD
rBGPD EQU $ff69 ; CGB Mode Only - Background Palette Data rBGPD EQU $ff69 ; CGB Mode Only - Background Palette Data
rOBPI EQU $ff6a ; CGB Mode Only - Sprite Palette Index rOBPI EQU $ff6a ; CGB Mode Only - Sprite Palette Index
rOBPI_AUTO_INCREMENT EQU 7 ; increment rOBPI after write to rOBPD
rOBPD EQU $ff6b ; CGB Mode Only - Sprite Palette Data rOBPD EQU $ff6b ; CGB Mode Only - Sprite Palette Data
rUNKNOWN1 EQU $ff6c ; (FEh) Bit 0 (Read/Write) - CGB Mode Only rUNKNOWN1 EQU $ff6c ; (FEh) Bit 0 (Read/Write) - CGB Mode Only
rSVBK EQU $ff70 ; CGB Mode Only - WRAM Bank rSVBK EQU $ff70 ; CGB Mode Only - WRAM Bank

View File

@ -1,6 +1,6 @@
# Battle Animation Commands # Battle Animation Commands
Defined in [macros/scripts/battle_anims.asm](/macros/scripts/battle_anims.asm) and [data/moves/animations.asm:BattleAnimations](/data/moves/animations.asm). Defined in [macros/scripts/battle_anims.asm](/macros/scripts/battle_anims.asm) and [engine/battle_anims/anim_commands.asm:BattleAnimCommands](/engine/battle_anims/anim_commands.asm).
## `$00``$CF`: `anim_wait` *length* ## `$00``$CF`: `anim_wait` *length*
@ -80,7 +80,7 @@ Temporarily creates sprites from the top row of the player backpic, so that the
## `$DB`: `anim_checkpokeball` ## `$DB`: `anim_checkpokeball`
Sets `var` to the result of [GetPokeBallWobble](/engine/battle_anims/getpokeballwobble.asm). Sets `BattleAnimVar` to the result of [GetPokeBallWobble](/engine/battle_anims/getpokeballwobble.asm).
## `$DC`: `anim_transform` ## `$DC`: `anim_transform`
@ -190,19 +190,19 @@ Does nothing. Unused.
## `$F8`: `anim_if_param_equal` *value*, *address* ## `$F8`: `anim_if_param_equal` *value*, *address*
Jumps to another script if `wKickCounter` is equal to *value*. Jumps to another script if `wBattleAnimParam` (aka `wKickCounter` or `wPresentPower`) is equal to *value*.
## `$F9`: `anim_setvar` *value* ## `$F9`: `anim_setvar` *value*
Sets `var` to *value*. Sets `BattleAnimVar` to *value*.
## `$FA`: `anim_incvar` ## `$FA`: `anim_incvar`
Increments `var` by 1. Increments `BattleAnimVar` by 1.
## `$FB`: `anim_if_var_equal` *value*, *address* ## `$FB`: `anim_if_var_equal` *value*, *address*
Jumps to another script if `var` is equal to *value*. Jumps to another script if `BattleAnimVar` is equal to *value*.
## `$FC`: `anim_jump` *address* ## `$FC`: `anim_jump` *address*

View File

@ -65,7 +65,7 @@ Callback types:
## `.CoordEvents: db` *N* ## `.CoordEvents: db` *N*
- **`coord_event` *x*, *y*, *scene id*, *script*** - **`coord_event` *x*, *y*, *scene_id*, *script***
## `.BGEvents: db` *N* ## `.BGEvents: db` *N*
@ -90,7 +90,7 @@ BG event types:
## `.ObjectEvents: db` *N* ## `.ObjectEvents: db` *N*
- **`object_event` *x*, *y*, *sprite*, *movement*, *ry*, *rx*, *h1*, *h2*, *palette*, *type*, *range*, *script*, *event_flag*** - **`object_event` *x*, *y*, *sprite*, *movement*, *rx*, *ry*, *h1*, *h2*, *palette*, *type*, *range*, *script*, *event_flag***
Movement types: Movement types:

View File

@ -45,7 +45,7 @@ _AnimateHPBar: ; d627
and a and a
jr nz, .player jr nz, .player
ld a, [wCurHPAnimMaxHP] ld a, [wCurHPAnimMaxHP]
cp 6 * 8 cp HP_BAR_LENGTH_PX
jr nc, .player jr nc, .player
and a and a
ret ret
@ -203,7 +203,7 @@ LongAnim_UpdateVariables: ; d6f5
ShortHPBarAnim_UpdateTiles: ; d730 ShortHPBarAnim_UpdateTiles: ; d730
call HPBarAnim_UpdateHPRemaining call HPBarAnim_UpdateHPRemaining
ld d, $6 ld d, HP_BAR_LENGTH
ld a, [wWhichHPBar] ld a, [wWhichHPBar]
and $1 and $1
ld b, a ld b, a
@ -229,7 +229,7 @@ LongHPBarAnim_UpdateTiles: ; d749
ld d, a ld d, a
call ComputeHPBarPixels call ComputeHPBarPixels
ld c, e ld c, e
ld d, $6 ld d, HP_BAR_LENGTH
ld a, [wWhichHPBar] ld a, [wWhichHPBar]
and $1 and $1
ld b, a ld b, a
@ -377,7 +377,7 @@ ShortHPBar_CalcPixelFrame: ; d839
ld b, 0 ld b, 0
ld hl, 0 ld hl, 0
ld a, [wCurHPBarPixels] ld a, [wCurHPBarPixels]
cp 6 * 8 cp HP_BAR_LENGTH_PX
jr nc, .return_max jr nc, .return_max
and a and a
jr z, .return_zero jr z, .return_zero
@ -388,7 +388,7 @@ ShortHPBar_CalcPixelFrame: ; d839
; by 48, the loop runs one extra time. To fix, uncomment the line below. ; by 48, the loop runs one extra time. To fix, uncomment the line below.
.loop .loop
ld a, l ld a, l
sub 6 * 8 sub HP_BAR_LENGTH_PX
ld l, a ld l, a
ld a, h ld a, h
sbc $0 sbc $0
@ -404,7 +404,7 @@ ShortHPBar_CalcPixelFrame: ; d839
add hl, bc add hl, bc
pop bc pop bc
ld a, l ld a, l
sub 6 * 8 sub HP_BAR_LENGTH_PX
ld l, a ld l, a
ld a, h ld a, h
sbc $0 sbc $0

View File

@ -908,7 +908,7 @@ InitCGBPals::
call ByteFill call ByteFill
ld a, $0 ld a, $0
ld [rVBK], a ld [rVBK], a
ld a, $80 ld a, 1 << rBGPI_AUTO_INCREMENT
ld [rBGPI], a ld [rBGPI], a
ld c, 4 * 8 ld c, 4 * 8
.bgpals_loop .bgpals_loop
@ -918,7 +918,7 @@ InitCGBPals::
ld [rBGPD], a ld [rBGPD], a
dec c dec c
jr nz, .bgpals_loop jr nz, .bgpals_loop
ld a, $80 ld a, 1 << rOBPI_AUTO_INCREMENT
ld [rOBPI], a ld [rOBPI], a
ld c, 4 * 8 ld c, 4 * 8
.obpals_loop .obpals_loop

View File

@ -161,19 +161,19 @@ Function819a7: ; 819a7
ld de, wBGPals2 ld de, wBGPals2
ld bc, 16 palettes ld bc, 16 palettes
call CopyBytes call CopyBytes
ld a, $80 ld a, 1 << rBGPI_AUTO_INCREMENT
ld [rBGPI], a ld [rBGPI], a
ld hl, Palette_819f4 ld hl, Palette_819f4
ld c, $40 ld c, 8 palettes
xor a xor a
.asm_819c8 .asm_819c8
ld [rBGPD], a ld [rBGPD], a
dec c dec c
jr nz, .asm_819c8 jr nz, .asm_819c8
ld a, $80 ld a, 1 << rOBPI_AUTO_INCREMENT
ld [rOBPI], a ld [rOBPI], a
ld hl, Palette_81a34 ld hl, Palette_81a34
ld c, $40 ld c, 8 palettes
.asm_819d6 .asm_819d6
ld a, [hli] ld a, [hli]
ld [rOBPD], a ld [rOBPD], a

View File

@ -30,7 +30,7 @@ ForceUpdateCGBPals:: ; c37
ld hl, wBGPals2 ld hl, wBGPals2
; copy 8 pals to bgpd ; copy 8 pals to bgpd
ld a, %10000000 ; auto increment, index 0 ld a, 1 << rBGPI_AUTO_INCREMENT
ld [rBGPI], a ld [rBGPI], a
ld c, LOW(rBGPD) ld c, LOW(rBGPD)
ld b, 8 / 2 ld b, 8 / 2
@ -46,7 +46,7 @@ endr
; hl is now wOBPals2 ; hl is now wOBPals2
; copy 8 pals to obpd ; copy 8 pals to obpd
ld a, %10000000 ; auto increment, index 0 ld a, 1 << rOBPI_AUTO_INCREMENT
ld [rOBPI], a ld [rOBPI], a
ld c, LOW(rOBPD) ld c, LOW(rOBPD)
ld b, 8 / 2 ld b, 8 / 2

View File

@ -935,26 +935,24 @@ TileAnimationPalette: ; fc6d7
ret nz ret nz
; Ready for BGPD input... ; Ready for BGPD input...
ld a, %10011000 ; auto increment, index $18 (pal 3 color 0)
ld a, (1 << rBGPI_AUTO_INCREMENT) palette PAL_BG_WATER
ld [rBGPI], a ld [rBGPI], a
ld a, [rSVBK] ld a, [rSVBK]
push af push af
ld a, 5 ; wra5: gfx ld a, BANK(wBGPals1)
ld [rSVBK], a ld [rSVBK], a
; Update color 0 in order 0 1 2 1 ; Update color 0 in order 0 1 2 1
ld a, l ld a, l
and %110 ; frames 0 2 4 6 and %110 ; frames 0 2 4 6
jr z, .color0 jr z, .color0
cp 4 cp 4
jr z, .color2 jr z, .color2
.color1 .color1
ld hl, wBGPals1 + palette 3 + 2 ld hl, wBGPals1 palette PAL_BG_WATER + 2
ld a, [hli] ld a, [hli]
ld [rBGPD], a ld [rBGPD], a
ld a, [hli] ld a, [hli]
@ -962,7 +960,7 @@ TileAnimationPalette: ; fc6d7
jr .end jr .end
.color0 .color0
ld hl, wBGPals1 + palette 3 ld hl, wBGPals1 palette PAL_BG_WATER
ld a, [hli] ld a, [hli]
ld [rBGPD], a ld [rBGPD], a
ld a, [hli] ld a, [hli]
@ -970,7 +968,7 @@ TileAnimationPalette: ; fc6d7
jr .end jr .end
.color2 .color2
ld hl, wBGPals1 + palette 3 + 4 ld hl, wBGPals1 palette PAL_BG_WATER + 4
ld a, [hli] ld a, [hli]
ld [rBGPD], a ld [rBGPD], a
ld a, [hli] ld a, [hli]
@ -999,19 +997,19 @@ FlickeringCaveEntrancePalette: ; fc71e
ld a, [rSVBK] ld a, [rSVBK]
push af push af
ld a, 5 ; wra5: gfx ld a, BANK(wBGPals1)
ld [rSVBK], a ld [rSVBK], a
; Ready for BGPD input... ; Ready for BGPD input...
ld a, %10100000 ; auto-increment, index $20 (pal 4 color 0) ld a, (1 << rBGPI_AUTO_INCREMENT) palette PAL_BG_YELLOW
ld [rBGPI], a ld [rBGPI], a
ld a, [hVBlankCounter] ld a, [hVBlankCounter]
and %00000010 and 1 << 1
jr nz, .bit1set jr nz, .bit1set
ld hl, wBGPals1 + palette 4 ld hl, wBGPals1 palette PAL_BG_YELLOW
jr .okay jr .okay
.bit1set .bit1set
ld hl, wBGPals1 + palette 4 + 2 ld hl, wBGPals1 palette PAL_BG_YELLOW + 2
.okay .okay
ld a, [hli] ld a, [hli]