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
rRP EQU $ff56 ; CGB Mode Only - Infrared Communications Port
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
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
rUNKNOWN1 EQU $ff6c ; (FEh) Bit 0 (Read/Write) - CGB Mode Only
rSVBK EQU $ff70 ; CGB Mode Only - WRAM Bank

View File

@ -1,6 +1,6 @@
# 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*
@ -80,7 +80,7 @@ Temporarily creates sprites from the top row of the player backpic, so that the
## `$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`
@ -190,19 +190,19 @@ Does nothing. Unused.
## `$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*
Sets `var` to *value*.
Sets `BattleAnimVar` to *value*.
## `$FA`: `anim_incvar`
Increments `var` by 1.
Increments `BattleAnimVar` by 1.
## `$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*

View File

@ -65,7 +65,7 @@ Callback types:
## `.CoordEvents: db` *N*
- **`coord_event` *x*, *y*, *scene id*, *script***
- **`coord_event` *x*, *y*, *scene_id*, *script***
## `.BGEvents: db` *N*
@ -90,7 +90,7 @@ BG event types:
## `.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:

View File

@ -45,7 +45,7 @@ _AnimateHPBar: ; d627
and a
jr nz, .player
ld a, [wCurHPAnimMaxHP]
cp 6 * 8
cp HP_BAR_LENGTH_PX
jr nc, .player
and a
ret
@ -203,7 +203,7 @@ LongAnim_UpdateVariables: ; d6f5
ShortHPBarAnim_UpdateTiles: ; d730
call HPBarAnim_UpdateHPRemaining
ld d, $6
ld d, HP_BAR_LENGTH
ld a, [wWhichHPBar]
and $1
ld b, a
@ -229,7 +229,7 @@ LongHPBarAnim_UpdateTiles: ; d749
ld d, a
call ComputeHPBarPixels
ld c, e
ld d, $6
ld d, HP_BAR_LENGTH
ld a, [wWhichHPBar]
and $1
ld b, a
@ -377,7 +377,7 @@ ShortHPBar_CalcPixelFrame: ; d839
ld b, 0
ld hl, 0
ld a, [wCurHPBarPixels]
cp 6 * 8
cp HP_BAR_LENGTH_PX
jr nc, .return_max
and a
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.
.loop
ld a, l
sub 6 * 8
sub HP_BAR_LENGTH_PX
ld l, a
ld a, h
sbc $0
@ -404,7 +404,7 @@ ShortHPBar_CalcPixelFrame: ; d839
add hl, bc
pop bc
ld a, l
sub 6 * 8
sub HP_BAR_LENGTH_PX
ld l, a
ld a, h
sbc $0

View File

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

View File

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

View File

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

View File

@ -935,26 +935,24 @@ TileAnimationPalette: ; fc6d7
ret nz
; 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 a, [rSVBK]
push af
ld a, 5 ; wra5: gfx
ld a, BANK(wBGPals1)
ld [rSVBK], a
; Update color 0 in order 0 1 2 1
ld a, l
and %110 ; frames 0 2 4 6
jr z, .color0
cp 4
jr z, .color2
.color1
ld hl, wBGPals1 + palette 3 + 2
ld hl, wBGPals1 palette PAL_BG_WATER + 2
ld a, [hli]
ld [rBGPD], a
ld a, [hli]
@ -962,7 +960,7 @@ TileAnimationPalette: ; fc6d7
jr .end
.color0
ld hl, wBGPals1 + palette 3
ld hl, wBGPals1 palette PAL_BG_WATER
ld a, [hli]
ld [rBGPD], a
ld a, [hli]
@ -970,7 +968,7 @@ TileAnimationPalette: ; fc6d7
jr .end
.color2
ld hl, wBGPals1 + palette 3 + 4
ld hl, wBGPals1 palette PAL_BG_WATER + 4
ld a, [hli]
ld [rBGPD], a
ld a, [hli]
@ -999,19 +997,19 @@ FlickeringCaveEntrancePalette: ; fc71e
ld a, [rSVBK]
push af
ld a, 5 ; wra5: gfx
ld a, BANK(wBGPals1)
ld [rSVBK], a
; 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 a, [hVBlankCounter]
and %00000010
and 1 << 1
jr nz, .bit1set
ld hl, wBGPals1 + palette 4
ld hl, wBGPals1 palette PAL_BG_YELLOW
jr .okay
.bit1set
ld hl, wBGPals1 + palette 4 + 2
ld hl, wBGPals1 palette PAL_BG_YELLOW + 2
.okay
ld a, [hli]