Skip to content

Commit

Permalink
Merge pull request #455 from xCrystal/master
Browse files Browse the repository at this point in the history
Use more palette(s) constants, rename BG/OBP wram addresses, and rBGPI+rOBPI auto-increment constants (from Rangi)
  • Loading branch information
yenatch authored Jan 1, 2018
2 parents 8c3905c + e5fa3f9 commit f27f794
Show file tree
Hide file tree
Showing 41 changed files with 396 additions and 396 deletions.
2 changes: 1 addition & 1 deletion constants/credits_constants.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; CreditsStrings indexes (see data/credits_text.asm)
; CreditsStrings indexes (see data/credits_strings.asm)
const_def
const SATOSHI_TAJIRI
const JUNICHI_MASUDA
Expand Down
6 changes: 4 additions & 2 deletions constants/hardware_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ OAM_X_FLIP EQU 5
OAM_Y_FLIP EQU 6
OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)

; BP Map attribute flags
; BG Map attribute flags
PALETTE_MASK EQU %111
VRAM_BANK_1 EQU 1 << OAM_TILE_BANK ; $08
OBP_NUM EQU 1 << OAM_OBP_NUM ; $10
Expand All @@ -60,7 +60,7 @@ BEHIND_BG EQU 1 << OAM_PRIORITY ; $80

; Other useful constants
LCDC_DEFAULT EQU %11100011
LY_VBLANK EQU 144
LY_VBLANK EQU 144

; Hardware registers
rJOYP EQU $ff00 ; Joypad (R/W)
Expand Down Expand Up @@ -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
Expand Down
52 changes: 26 additions & 26 deletions constants/map_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ENDM
; `mapgroup` indexes are for the sub-tables of MapGroupPointers (see maps/map_headers.asm)
const_def

newgroup ; 1
newgroup ; 1

mapgroup OLIVINE_POKECENTER_1F, 4, 5 ; 1
mapgroup OLIVINE_GYM, 8, 5 ; 2
Expand All @@ -38,7 +38,7 @@ ENDM
mapgroup ROUTE_39, 18, 10 ; 13
mapgroup OLIVINE_CITY, 18, 20 ; 14

newgroup ; 2
newgroup ; 2

mapgroup MAHOGANY_RED_GYARADOS_SPEECH_HOUSE, 4, 4 ; 1
mapgroup MAHOGANY_GYM, 9, 5 ; 2
Expand All @@ -48,7 +48,7 @@ ENDM
mapgroup ROUTE_44, 9, 30 ; 6
mapgroup MAHOGANY_TOWN, 9, 10 ; 7

newgroup ; 3
newgroup ; 3

mapgroup SPROUT_TOWER_1F, 8, 10 ; 1
mapgroup SPROUT_TOWER_2F, 8, 10 ; 2
Expand Down Expand Up @@ -142,7 +142,7 @@ ENDM
mapgroup SAFARI_ZONE_BETA, 18, 10 ; 90
mapgroup VICTORY_ROAD, 36, 10 ; 91

newgroup ; 4
newgroup ; 4

mapgroup ECRUTEAK_HOUSE, 9, 10 ; 1
mapgroup WISE_TRIOS_ROOM, 4, 4 ; 2
Expand All @@ -154,7 +154,7 @@ ENDM
mapgroup ECRUTEAK_ITEMFINDER_HOUSE, 4, 4 ; 8
mapgroup ECRUTEAK_CITY, 18, 20 ; 9

newgroup ; 5
newgroup ; 5

mapgroup BLACKTHORN_GYM_1F, 9, 5 ; 1
mapgroup BLACKTHORN_GYM_2F, 9, 5 ; 2
Expand All @@ -167,7 +167,7 @@ ENDM
mapgroup ROUTE_46, 18, 10 ; 9
mapgroup BLACKTHORN_CITY, 18, 20 ; 10

newgroup ; 6
newgroup ; 6

mapgroup CINNABAR_POKECENTER_1F, 4, 5 ; 1
mapgroup CINNABAR_POKECENTER_2F_BETA, 4, 8 ; 2
Expand All @@ -178,7 +178,7 @@ ENDM
mapgroup ROUTE_21, 18, 10 ; 7
mapgroup CINNABAR_ISLAND, 9, 10 ; 8

newgroup ; 7
newgroup ; 7

mapgroup CERULEAN_GYM_BADGE_SPEECH_HOUSE, 4, 4 ; 1
mapgroup CERULEAN_POLICE_STATION, 4, 4 ; 2
Expand All @@ -198,7 +198,7 @@ ENDM
mapgroup ROUTE_25, 9, 30 ; 16
mapgroup CERULEAN_CITY, 18, 20 ; 17

newgroup ; 8
newgroup ; 8

mapgroup AZALEA_POKECENTER_1F, 4, 5 ; 1
mapgroup CHARCOAL_KILN, 4, 4 ; 2
Expand All @@ -208,7 +208,7 @@ ENDM
mapgroup ROUTE_33, 9, 10 ; 6
mapgroup AZALEA_TOWN, 9, 20 ; 7

newgroup ; 9
newgroup ; 9

mapgroup LAKE_OF_RAGE_HIDDEN_POWER_HOUSE, 4, 4 ; 1
mapgroup LAKE_OF_RAGE_MAGIKARP_HOUSE, 4, 4 ; 2
Expand All @@ -217,7 +217,7 @@ ENDM
mapgroup ROUTE_43, 27, 10 ; 5
mapgroup LAKE_OF_RAGE, 18, 20 ; 6

newgroup ; 10
newgroup ; 10

mapgroup ROUTE_32, 45, 10 ; 1
mapgroup ROUTE_35, 18, 10 ; 2
Expand All @@ -237,7 +237,7 @@ ENDM
mapgroup ROUTE_36_RUINS_OF_ALPH_GATE, 4, 5 ; 16
mapgroup ROUTE_36_NATIONAL_PARK_GATE, 4, 5 ; 17

newgroup ; 11
newgroup ; 11

mapgroup ROUTE_34, 27, 10 ; 1
mapgroup GOLDENROD_CITY, 18, 20 ; 2
Expand All @@ -264,7 +264,7 @@ ENDM
mapgroup ROUTE_34_ILEX_FOREST_GATE, 4, 5 ; 23
mapgroup DAY_CARE, 4, 5 ; 24

newgroup ; 12
newgroup ; 12

mapgroup ROUTE_6, 9, 10 ; 1
mapgroup ROUTE_11, 9, 20 ; 2
Expand All @@ -280,7 +280,7 @@ ENDM
mapgroup ROUTE_6_SAFFRON_GATE, 4, 5 ; 12
mapgroup ROUTE_6_UNDERGROUND_PATH_ENTRANCE, 4, 4 ; 13

newgroup ; 13
newgroup ; 13

mapgroup ROUTE_1, 18, 10 ; 1
mapgroup PALLET_TOWN, 9, 10 ; 2
Expand All @@ -289,7 +289,7 @@ ENDM
mapgroup BLUES_HOUSE, 4, 4 ; 5
mapgroup OAKS_LAB, 6, 5 ; 6

newgroup ; 14
newgroup ; 14

mapgroup ROUTE_3, 9, 30 ; 1
mapgroup PEWTER_CITY, 18, 20 ; 2
Expand All @@ -300,7 +300,7 @@ ENDM
mapgroup PEWTER_POKECENTER_2F_BETA, 4, 8 ; 7
mapgroup PEWTER_SNOOZE_SPEECH_HOUSE, 4, 4 ; 8

newgroup ; 15
newgroup ; 15

mapgroup OLIVINE_PORT, 18, 10 ; 1
mapgroup VERMILION_PORT, 18, 10 ; 2
Expand All @@ -315,7 +315,7 @@ ENDM
mapgroup MOUNT_MOON_GIFT_SHOP, 4, 4 ; 11
mapgroup TIN_TOWER_ROOF, 9, 10 ; 12

newgroup ; 16
newgroup ; 16

mapgroup ROUTE_23, 9, 10 ; 1
mapgroup INDIGO_PLATEAU_POKECENTER_1F, 7, 9 ; 2
Expand All @@ -326,7 +326,7 @@ ENDM
mapgroup LANCES_ROOM, 12, 5 ; 7
mapgroup HALL_OF_FAME, 7, 5 ; 8

newgroup ; 17
newgroup ; 17

mapgroup ROUTE_13, 9, 30 ; 1
mapgroup ROUTE_14, 18, 10 ; 2
Expand All @@ -342,7 +342,7 @@ ENDM
mapgroup SAFARI_ZONE_WARDENS_HOME, 4, 5 ; 12
mapgroup ROUTE_15_FUCHSIA_GATE, 4, 5 ; 13

newgroup ; 18
newgroup ; 18

mapgroup ROUTE_8, 9, 20 ; 1
mapgroup ROUTE_12, 27, 10 ; 2
Expand All @@ -359,14 +359,14 @@ ENDM
mapgroup ROUTE_8_SAFFRON_GATE, 4, 5 ; 13
mapgroup ROUTE_12_SUPER_ROD_HOUSE, 4, 4 ; 14

newgroup ; 19
newgroup ; 19

mapgroup ROUTE_28, 9, 20 ; 1
mapgroup SILVER_CAVE_OUTSIDE, 18, 20 ; 2
mapgroup SILVER_CAVE_POKECENTER_1F, 4, 5 ; 3
mapgroup ROUTE_28_FAMOUS_SPEECH_HOUSE, 4, 4 ; 4

newgroup ; 20
newgroup ; 20

mapgroup POKECENTER_2F, 4, 8 ; 1
mapgroup TRADE_CENTER, 4, 5 ; 2
Expand All @@ -375,7 +375,7 @@ ENDM
mapgroup MOBILE_TRADE_ROOM_MOBILE, 4, 5 ; 5
mapgroup MOBILE_BATTLE_ROOM, 4, 5 ; 6

newgroup ; 21
newgroup ; 21

mapgroup ROUTE_7, 9, 10 ; 1
mapgroup ROUTE_16, 9, 10 ; 2
Expand Down Expand Up @@ -404,7 +404,7 @@ ENDM
mapgroup ROUTE_7_SAFFRON_GATE, 4, 5 ; 25
mapgroup ROUTE_17_18_GATE, 4, 5 ; 26

newgroup ; 22
newgroup ; 22

mapgroup ROUTE_40, 18, 10 ; 1
mapgroup ROUTE_41, 27, 25 ; 2
Expand All @@ -423,7 +423,7 @@ ENDM
mapgroup ROUTE_40_BATTLE_TOWER_GATE, 4, 5 ; 15
mapgroup BATTLE_TOWER_OUTSIDE, 14, 10 ; 16

newgroup ; 23
newgroup ; 23

mapgroup ROUTE_2, 27, 10 ; 1
mapgroup ROUTE_22, 9, 20 ; 2
Expand All @@ -439,7 +439,7 @@ ENDM
mapgroup ROUTE_2_GATE, 4, 5 ; 12
mapgroup VICTORY_ROAD_GATE, 9, 10 ; 13

newgroup ; 24
newgroup ; 24

mapgroup ROUTE_26, 54, 10 ; 1
mapgroup ROUTE_27, 9, 40 ; 2
Expand All @@ -455,7 +455,7 @@ ENDM
mapgroup ROUTE_27_SANDSTORM_HOUSE, 4, 4 ; 12
mapgroup ROUTE_29_46_GATE, 4, 5 ; 13

newgroup ; 25
newgroup ; 25

mapgroup ROUTE_5, 9, 10 ; 1
mapgroup SAFFRON_CITY, 18, 20 ; 2
Expand All @@ -473,7 +473,7 @@ ENDM
mapgroup ROUTE_5_SAFFRON_CITY_GATE, 4, 5 ; 14
mapgroup ROUTE_5_CLEANSE_TAG_SPEECH_HOUSE, 4, 4 ; 15

newgroup ; 26
newgroup ; 26

mapgroup ROUTE_30, 27, 10 ; 1
mapgroup ROUTE_31, 9, 20 ; 2
Expand Down
12 changes: 6 additions & 6 deletions docs/battle_anim_commands.md
Original file line number Diff line number Diff line change
@@ -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*
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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*

Expand Down
4 changes: 2 additions & 2 deletions docs/map_scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand All @@ -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:

Expand Down
12 changes: 6 additions & 6 deletions engine/battle/anim_hp_bar.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit f27f794

Please sign in to comment.