summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIdain <luiscarlosholguinperez@outlook.com>2021-06-04 16:29:47 -0400
committerIdain <luiscarlosholguinperez@outlook.com>2021-06-04 16:29:47 -0400
commit955caffc58a6b8291271fd6befb4940293e74dd2 (patch)
tree031ed2368d2e1e7891aac59cf6f39fff9efd7fb8
parent91d0c1af8b5910a62e8add886a56def6717c6183 (diff)
Updating tutorial
-rw-r--r--Edit-the-male-and-female-player-colors.md80
1 files changed, 43 insertions, 37 deletions
diff --git a/Edit-the-male-and-female-player-colors.md b/Edit-the-male-and-female-player-colors.md
index 590c56e..b28f3bb 100644
--- a/Edit-the-male-and-female-player-colors.md
+++ b/Edit-the-male-and-female-player-colors.md
@@ -26,6 +26,7 @@ Edit [data/sprites/sprites.asm](../blob/master/data/sprites/sprites.asm):
```diff
OverworldSprites:
; entries correspond to SPRITE_* constants
+ table_width NUM_SPRITEDATA_FIELDS, OverworldSprites
- overworld_sprite ChrisSpriteGFX, 12, WALKING_SPRITE, PAL_OW_RED
- overworld_sprite ChrisBikeSpriteGFX, 12, WALKING_SPRITE, PAL_OW_RED
+ overworld_sprite ChrisSpriteGFX, 12, WALKING_SPRITE, PAL_OW_BROWN
@@ -47,10 +48,10 @@ Edit [engine/overworld/player_object.asm](../blob/master/engine/overworld/player
ld a, -1
ld [wObjectFollow_Leader], a
ld [wObjectFollow_Follower], a
- ld a, $0
+ ld a, PLAYER
ld hl, PlayerObjectTemplate
call CopyPlayerObjectTemplate
- ld b, $0
+ ld b, PLAYER
call PlayerSpawn_ConvertCoords
ld a, PLAYER_OBJECT
call GetMapObject
@@ -162,6 +163,7 @@ Edit [constants/sprite_anim_constants.asm](../blob/master/constants/sprite_anim_
...
const SPRITE_ANIM_INDEX_CELEBI ; 2c
+ const SPRITE_ANIM_INDEX_BROWN_WALK
+NUM_SPRITE_ANIM_INDEXES EQU const_value
```
```diff
@@ -181,6 +183,7 @@ Edit [constants/sprite_anim_constants.asm](../blob/master/constants/sprite_anim_
...
const SPRITE_ANIM_FRAMESET_CELEBI_RIGHT ; 41
+ const SPRITE_ANIM_FRAMESET_BROWN_WALK
+NUM_SPRITE_ANIM_FRAMESETS EQU const_value
```
```diff
@@ -206,6 +209,7 @@ Edit [constants/sprite_anim_constants.asm](../blob/master/constants/sprite_anim_
const SPRITE_ANIM_OAMSET_GAMEFREAK_LOGO_11 ; 8b
+ const SPRITE_ANIM_OAMSET_BROWN_WALK_1
+ const SPRITE_ANIM_OAMSET_BROWN_WALK_2
+NUM_SPRITE_ANIM_OAMSETS EQU const_value
```
As we'll see next, the `SpriteAnimSeqData` entries refer to `SpriteAnimFrameData` entries, the `SpriteAnimFrameData` entries refer to `SpriteAnimOAMData` entries, and finally the `SpriteAnimOAMData` declare the actual colors that get used.
@@ -222,19 +226,29 @@ Edit [data/sprite_anims/sequences.asm](../blob/master/data/sprite_anims/sequence
```diff
SpriteAnimSeqData:
; entries correspond to SPRITE_ANIM_INDEX_* constants
+ table_width 3, SpriteAnimSeqData
; frameset sequence, tile
- db SPRITE_ANIM_FRAMESET_PARTY_MON, SPRITE_ANIM_SEQ_PARTY_MON, $00 ; SPRITE_ANIM_INDEX_PARTY_MON
- ...
-- db SPRITE_ANIM_FRAMESET_MAGNET_TRAIN_RED, SPRITE_ANIM_SEQ_NULL, $00 ; SPRITE_ANIM_INDEX_MAGNET_TRAIN_RED
-+ db SPRITE_ANIM_FRAMESET_MAGNET_TRAIN_BROWN, SPRITE_ANIM_SEQ_NULL, $00 ; SPRITE_ANIM_INDEX_MAGNET_TRAIN_BROWN
- ...
-- db SPRITE_ANIM_FRAMESET_BLUE_WALK, SPRITE_ANIM_SEQ_NULL, $00 ; SPRITE_ANIM_INDEX_BLUE_WALK
-+ db SPRITE_ANIM_FRAMESET_GREEN_WALK, SPRITE_ANIM_SEQ_NULL, $00 ; SPRITE_ANIM_INDEX_GREEN_WALK
-- db SPRITE_ANIM_FRAMESET_MAGNET_TRAIN_BLUE, SPRITE_ANIM_SEQ_NULL, $00 ; SPRITE_ANIM_INDEX_MAGNET_TRAIN_BLUE
-+ db SPRITE_ANIM_FRAMESET_MAGNET_TRAIN_GREEN, SPRITE_ANIM_SEQ_NULL, $00 ; SPRITE_ANIM_INDEX_MAGNET_TRAIN_GREEN
- ...
- db SPRITE_ANIM_FRAMESET_CELEBI_LEFT, SPRITE_ANIM_SEQ_NULL, $00 ; SPRITE_ANIM_INDEX_CELEBI
-+ db SPRITE_ANIM_FRAMESET_BROWN_WALK, SPRITE_ANIM_SEQ_NULL, $00 ; SPRITE_ANIM_INDEX_BROWN_WALK
+ ; SPRITE_ANIM_INDEX_PARTY_MON
+ db SPRITE_ANIM_FRAMESET_PARTY_MON, SPRITE_ANIM_SEQ_PARTY_MON, SPRITE_ANIM_DICT_DEFAULT
+ ...
+-; SPRITE_ANIM_INDEX_MAGNET_TRAIN_RED
+- db SPRITE_ANIM_FRAMESET_MAGNET_TRAIN_RED, SPRITE_ANIM_SEQ_NULL, SPRITE_ANIM_DICT_DEFAULT
++; SPRITE_ANIM_INDEX_MAGNET_TRAIN_BROWN
++ db SPRITE_ANIM_FRAMESET_MAGNET_TRAIN_BROWN, SPRITE_ANIM_SEQ_NULL, SPRITE_ANIM_DICT_DEFAULT
+ ...
+-; SPRITE_ANIM_INDEX_BLUE_WALK
+- db SPRITE_ANIM_FRAMESET_BLUE_WALK, SPRITE_ANIM_SEQ_NULL, SPRITE_ANIM_DICT_DEFAULT
++; SPRITE_ANIM_INDEX_GREEN_WALK
++ db SPRITE_ANIM_FRAMESET_GREEN_WALK, SPRITE_ANIM_SEQ_NULL, SPRITE_ANIM_DICT_DEFAULT
+-; SPRITE_ANIM_INDEX_MAGNET_TRAIN_BLUE
+- db SPRITE_ANIM_FRAMESET_MAGNET_TRAIN_BLUE, SPRITE_ANIM_SEQ_NULL, SPRITE_ANIM_DICT_DEFAULT
++; SPRITE_ANIM_INDEX_MAGNET_TRAIN_GREEN
++ db SPRITE_ANIM_FRAMESET_MAGNET_TRAIN_GREEN, SPRITE_ANIM_SEQ_NULL, SPRITE_ANIM_DICT_DEFAULT
+ ...
+; SPRITE_ANIM_INDEX_CELEBI
+ db SPRITE_ANIM_FRAMESET_CELEBI_LEFT, SPRITE_ANIM_SEQ_NULL, SPRITE_ANIM_DICT_DEFAULT
++ db SPRITE_ANIM_FRAMESET_BROWN_WALK, SPRITE_ANIM_SEQ_NULL, SPRITE_ANIM_DICT_DEFAULT
+ assert_table_length NUM_SPRITE_ANIM_INDEXES
```
Edit [data/sprite_anims/framesets.asm](../blob/master/data/sprite_anims/framesets.asm):
@@ -242,6 +256,7 @@ Edit [data/sprite_anims/framesets.asm](../blob/master/data/sprite_anims/frameset
```diff
SpriteAnimFrameData:
; entries correspond to SPRITE_ANIM_FRAMESET_* constants
+ table_width 2, SpriteAnimFrameData
dw .Frameset_00
...
dw .Frameset_RedWalk
@@ -256,6 +271,7 @@ Edit [data/sprite_anims/framesets.asm](../blob/master/data/sprite_anims/frameset
...
dw .Frameset_CelebiRight
+ dw .Frameset_BrownWalk
+ assert_table_length NUM_SPRITE_ANIM_FRAMESETS
```
```diff
@@ -312,6 +328,7 @@ And edit [data/sprite_anims/oam.asm](../blob/master/data/sprite_anims/oam.asm):
```diff
SpriteAnimOAMData:
; entries correspond to SPRITE_ANIM_OAMSET_* constants
+ table_width 3, SpriteAnimOAMData
; vtile offset, data pointer
dbw $00, .OAMData_RedWalk ; SPRITE_ANIM_OAMSET_RED_WALK_1
dbw $04, .OAMData_RedWalk ; SPRITE_ANIM_OAMSET_RED_WALK_2
@@ -333,6 +350,7 @@ And edit [data/sprite_anims/oam.asm](../blob/master/data/sprite_anims/oam.asm):
dbw $00, .OAMData_GameFreakLogo4_11 ; SPRITE_ANIM_OAMSET_GAMEFREAK_LOGO_11
+ dbw $00, .OAMData_BrownWalk ; SPRITE_ANIM_OAMSET_BROWN_WALK_1
+ dbw $04, .OAMData_BrownWalk ; SPRITE_ANIM_OAMSET_BROWN_WALK_2
+ assert_table_length NUM_SPRITE_ANIM_OAMSETS
```
```diff
@@ -484,7 +502,7 @@ Edit [engine/menus/naming_screen.asm](../blob/master/engine/menus/naming_screen.
.not_kris
ld a, b
depixel 4, 4, 4, 0
- call _InitSpriteAnimStruct
+ call InitSpriteAnimStruct
ret
```
@@ -554,15 +572,16 @@ Edit [constants/trainer_constants.asm](../blob/master/constants/trainer_constant
; - BTTrainerClassGenders (see data/trainers/genders.asm)
; trainer constants are Trainers indexes, for the sub-tables of TrainerGroups (see data/trainers/parties.asm)
enum_start
- CHRIS EQU __enum__
+ CHRIS EQU __trainer_class__
trainerclass TRAINER_NONE ; 0
const PHONECONTACT_MOM
const PHONECONTACT_BIKESHOP
const PHONECONTACT_BILL
const PHONECONTACT_ELM
const PHONECONTACT_BUENA
+NUM_NONTRAINER_PHONECONTACTS EQU const_value - 1
--KRIS EQU __enum__
+-KRIS EQU __trainer_class__
trainerclass FALKNER ; 1
const FALKNER1
@@ -571,8 +590,8 @@ Edit [constants/trainer_constants.asm](../blob/master/constants/trainer_constant
trainerclass MYSTICALMAN ; 43
const EUSINE
-+KRIS EQU __enum__
- NUM_TRAINER_CLASSES EQU __enum__
++KRIS EQU __trainer_class__ - 1
+ NUM_TRAINER_CLASSES EQU __trainer_class__ - 1
```
`CHRIS` corresponds to the unusable `TRAINER_NONE`, which is fine. But `KRIS` was actually just an alias for `FALKNER`—they use the exact same sprite color. Here we've moved `KRIS` to be after the very last trainer class. Just like `CHRIS`, she won't need any trainer data except a color palette, which we'll do next.
@@ -603,6 +622,8 @@ Then edit [data/trainers/palettes.asm](../blob/master/data/trainers/palettes.asm
; Each .gbcpal is generated from the corresponding .png, and
; only the middle two colors are included, not black or white.
+ table_width PAL_COLOR_SIZE * 2, TrainerPalettes
+
-PlayerPalette: ; Chris uses the same colors as Cal
-INCBIN "gfx/trainers/cal.gbcpal", middle_colors
+PlayerPalette:
@@ -618,6 +639,7 @@ Then edit [data/trainers/palettes.asm](../blob/master/data/trainers/palettes.asm
+
+KrisPalette:
+INCLUDE "gfx/player/kris.pal"
+ assert_table_length NUM_TRAINER_CLASSES + 1
```
Previously, Chris was using the same colors as Cal (the boy player lookalike whom you battle in Viridian City's Trainer House); and Kris was literally using Falkner's palette (which makes sense, given that `KRIS` and `FALKNER` were equivalent). Now they both have their own independent palettes.
@@ -713,24 +735,8 @@ Edit [engine/gfx/cgb_layouts.asm](../blob/master/engine/gfx/cgb_layouts.asm):
call GetPredefPal
call LoadHLPaletteIntoDE
- ; fill screen with opposite-gender palette for the card border
- hlcoord 0, 0, wAttrmap
- ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
- ld a, [wPlayerGender]
- and a
- ld a, $1 ; kris
- jr z, .got_gender
- ld a, $0 ; chris
- .got_gender
- call ByteFill
- ; fill trainer sprite area with same-gender palette
- hlcoord 14, 1, wAttrmap
- lb bc, 7, 5
- ld a, [wPlayerGender]
- and a
- ld a, $0 ; chris
- jr z, .got_gender2
- ld a, $1 ; kris
+ ...
+
.got_gender2
call FillBoxCGB
- ; top-right corner still uses the border's palette