Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2015-03-08 02:26:31

~Red
Member
Registered: 2010-10-16
Post 218/276

Tried adding a Pokemon. Sprite is messed up.

zUCkB.jpg

The pokemon itself is fully functional. I added the sprites at the end of where the krabby sprites are as that was the only available space but this keeps happening!!

Offline

#2 2015-03-08 03:35:09

ShantyTown
Member
Registered: 2013-12-04
Post 215/344

Re: Tried adding a Pokemon. Sprite is messed up.

I bet it's looking in the wrong Bank for the sprite.

This is how the game determines which Bank the sprite is in:

; uncompresses the front or back sprite of the specified mon
; assumes the corresponding mon header is already loaded
; hl contains offset to sprite pointer ($b for front or $d for back)
UncompressMonSprite:: ; 1627 (0:1627)
    ld bc,W_MONHEADER
    add hl,bc
    ld a,[hli]
    ld [W_SPRITEINPUTPTR],a    ; fetch sprite input pointer
    ld a,[hl]
    ld [W_SPRITEINPUTPTR+1],a
; define (by index number) the bank that a pokemon's image is in
; index = Mew, bank 1
; index = Kabutops fossil, bank $B
;    index < $1F, bank 9
; $1F ≤ index < $4A, bank $A
; $4A ≤ index < $74, bank $B
; $74 ≤ index < $99, bank $C
; $99 ≤ index,       bank $D
    ld a,[wcf91] ; XXX name for this ram location
    ld b,a
    cp MEW
    ld a,BANK(MewPicFront)
    jr z,.GotBank
    ld a,b
    cp FOSSIL_KABUTOPS
    ld a,BANK(FossilKabutopsPic)
    jr z,.GotBank
    ld a,b
    cp TANGELA + 1
    ld a,BANK(TangelaPicFront)
    jr c,.GotBank
    ld a,b
    cp MOLTRES + 1
    ld a,BANK(MoltresPicFront)
    jr c,.GotBank
    ld a,b
    cp BEEDRILL + 2
    ld a,BANK(BeedrillPicFront)
    jr c,.GotBank
    ld a,b
    cp STARMIE + 1
    ld a,BANK(StarmiePicFront)
    jr c,.GotBank
    ld a,BANK(VictreebelPicFront)
.GotBank
    jp UncompressSpriteData

Offline

#3 2015-03-08 19:34:23

~Red
Member
Registered: 2010-10-16
Post 219/276

Re: Tried adding a Pokemon. Sprite is messed up.

I'm using Danny-E33's graphics patch so the code is different in mine:

UncompressMonSprite:: ; 1627 (0:1627)
    ld bc,W_MONHEADER
    add hl,bc
    ld a,[hli]
    ld [W_SPRITEINPUTPTR],a    ; fetch sprite input pointer
    ld a,[hl]
    ld [W_SPRITEINPUTPTR+1],a
; define (by index number) the bank that a pokemon's image is in
; index = Mew, bank 1
; index = Kabutops fossil, bank $B
;    index < $1F, bank 9
; $1F ≤ index < $4A, bank $A
; $4A ≤ index < $74, bank $B
; $74 ≤ index < $99, bank $C
; $99 ≤ index,       bank $D
    ld a,[wcf91] ; XXX name for this ram location
    cp FOSSIL_KABUTOPS
    jr z,.RecallBank
    cp FOSSIL_AERODACTYL
    jr z,.RecallBank
    cp MON_GHOST
    jr z,.RecallBank
    ld a,[$D0D3]
    jr .GotBank
.RecallBank
    ld a,BANK(FossilKabutopsPic)
.GotBank
    jp UncompressSpriteData

I don't think I'm well aquainted enough with asm to understand this bit.

Offline

#4 2015-03-08 20:03:57

ShantyTown
Member
Registered: 2013-12-04
Post 216/344

Re: Tried adding a Pokemon. Sprite is messed up.

If you're using Danny's patch, then the Bank number for each Pokemon's sprite is defined in its BaseStats entry.  Here's Bulbasaur's: https://github.com/dannye/pokered-gen-I … basaur.asm

The last line in that file is self-explanatory.  Which pokemon did you try adding?  Can you show what its BaseStats entry looks like?  Perhaps it isn't a Bank issue at all.

EDIT:  Are you using the disassembly?  If not, then I'm guessing that you  just need to simply change that byte in the BaseStats entry for whatever pokemon you're adding.

Last edited by ShantyTown (2015-03-08 20:05:12)

Offline

#5 2015-03-09 00:28:06

~Red
Member
Registered: 2010-10-16
Post 220/276

Re: Tried adding a Pokemon. Sprite is messed up.

ShantyTown wrote:

If you're using Danny's patch, then the Bank number for each Pokemon's sprite is defined in its BaseStats entry.  Here's Bulbasaur's: https://github.com/dannye/pokered-gen-I … basaur.asm

The last line in that file is self-explanatory.  Which pokemon did you try adding?  Can you show what its BaseStats entry looks like?  Perhaps it isn't a Bank issue at all.

EDIT:  Are you using the disassembly?  If not, then I'm guessing that you  just need to simply change that byte in the BaseStats entry for whatever pokemon you're adding.


PikabluBaseStats: 
db DEX_PIKABLU ; pokedex id
db 70 ; base hp
db 20 ; base attack
db 50 ; base defense
db 40 ; base speed
db 35 ; base special
db WATER ; species type 1
db WATER ; species type 2
db 190 ; catch rate
db 82 ; base exp yield
INCBIN "pic/bmon/pikablu.pic",0,1 ; 55, sprite dimensions
dw PikabluPicFront
dw PikabluPicBack
; attacks known at lvl 0
db TACKLE
db 0
db 0
db 0
db 3 ; growth rate
; learnset
db %10100000
db %00111111
db %00001000
db %11010000
db %10000010
db %00101000
db %00010010
db BANK(PikabluPicFront)

Offline

#6 2015-03-10 11:58:36

~Red
Member
Registered: 2010-10-16
Post 221/276

Re: Tried adding a Pokemon. Sprite is messed up.

Does anyone have any ideas? Also, the Town Map is no longer working, do you think this is a problem with RAM because I've moved a bit around? I havent touched WRAM though..

Offline

#7 2015-03-10 14:35:48

Danny-E 33
Administrator
Registered: 2012-06-09
Post 865/1,034

Re: Tried adding a Pokemon. Sprite is messed up.

If you have shifted ram, it is possible you broke the routine that ShantyTown pointed out. That would be my fault though.

In wram.asm you should find:

W_MONHLEARNSET:: ; d0cc
; bit field
    flag_array 50 + 5
    ds 1

You should change this to:

W_MONHLEARNSET:: ; d0cc
; bit field
    flag_array 50 + 5

W_MONHPICBANK:: ; d0d3
    ds 1

Then change $D0D3 to W_MONHPICBANK in UncompressMonSprite. This might fix it.


Red Hack: Pokémon Prototype

Total number of registered users: 8000+
Total number of active users: ~12

Offline

#8 2015-03-10 17:05:34

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,001/3,505

Re: Tried adding a Pokemon. Sprite is messed up.

I went ahead and applied that fix to Red++ before it potentially becomes an issue in the future. I haven't run into any similar errors, but good to be safe and learn from others' mistakes.

Last edited by Mateo (2015-03-10 17:06:08)

Offline

#9 2015-03-10 21:15:43

~Red
Member
Registered: 2010-10-16
Post 222/276

Re: Tried adding a Pokemon. Sprite is messed up.

Danny-E 33 wrote:

If you have shifted ram, it is possible you broke the routine that ShantyTown pointed out. That would be my fault though.

In wram.asm you should find:

W_MONHLEARNSET:: ; d0cc
; bit field
    flag_array 50 + 5
    ds 1

You should change this to:

W_MONHLEARNSET:: ; d0cc
; bit field
    flag_array 50 + 5

W_MONHPICBANK:: ; d0d3
    ds 1

Then change $D0D3 to W_MONHPICBANK in UncompressMonSprite. This might fix it.


Applied this and I'm still getting a sprite error. I havent edited wram.asm at all, but I've added new hide_show constants, would this affect it? I've tried putting PikabluPicFront and PikabluePicBack in various different banks to no avail either. Wtf is going on :/

Offline

#10 2015-03-10 22:55:01

Danny-E 33
Administrator
Registered: 2012-06-09
Post 866/1,034

Re: Tried adding a Pokemon. Sprite is messed up.

Are you sure that everything else about the pokemon is working right? It might be that you didn't include the base stats file correctly.


Red Hack: Pokémon Prototype

Total number of registered users: 8000+
Total number of active users: ~12

Offline

#11 2015-03-11 00:35:35

comet
Member
Registered: 2012-04-09
Post 539/679

Re: Tried adding a Pokemon. Sprite is messed up.

something something git diff

Offline

#12 2015-03-11 01:38:54

~Red
Member
Registered: 2010-10-16
Post 223/276

Re: Tried adding a Pokemon. Sprite is messed up.

Danny-E 33 wrote:

Are you sure that everything else about the pokemon is working right? It might be that you didn't include the base stats file correctly.

INCLUDE "data/baseStats/pikablu.asm"

is at the end of base_stats.asm.

Offline

#13 2015-03-11 01:57:10

comet
Member
Registered: 2012-04-09
Post 540/679

Re: Tried adding a Pokemon. Sprite is messed up.

you need to put mew after mewtwo

a list of all the gotchas when starting out would be excellent

Offline

#14 2015-03-11 02:31:34

~Red
Member
Registered: 2010-10-16
Post 224/276

Re: Tried adding a Pokemon. Sprite is messed up.

comet wrote:

you need to put mew after mewtwo

a list of all the gotchas when starting out would be excellent

gotchas? Mew is after Mewtwo.

EDIT: OMG! Are you for real? Moving the INCLUDE for Mew.asm to after mewtwo and taking it from main.asm fixed it!

Now how do I fix my town map? I've implemented two different maps in this game which change depending on a certain unused bit in the RAM (taken from Mateo's gender tutorial). The GFX work perfectly, except when you press up and down while viewing the map the map order is all messed up!

The code I've changed is as follows:

LoadTownMap: ; 7109b (1c:509b)
    call GBPalWhiteOutWithDelay3
    call ClearScreen
    call UpdateSprites
    ld hl, wTileMap
    ld b, $12
    ld c, $12
    call TextBoxBorder
    call DisableLCD
    ; load correct region gfx
    ld a, [wd798] ; check ram address
    bit 2, a      ; check ram address
    jr nz, .inVermgfx
    ld hl, WorldMapTileGraphics ; $65a8
    ld de, vChars2 + $600
    ld bc, $100
    ld a, BANK(WorldMapTileGraphics)
    call FarCopyData2
    jr .contMapLoad
.inVermgfx    
    ld hl, WorldMapTileGraphics2 ; $65a8
    ld de, vChars2 + $600
    ld bc, $100
    ld a, BANK(WorldMapTileGraphics2)
    call FarCopyData2
.contMapLoad
    ld hl, MonNestIcon ; $56be
    ld de, vSprites + $40
    ld bc, $8
    ld a, BANK(MonNestIcon)
    call FarCopyDataDouble
    ; load correct region map
    ld a, [wd798] ; check ram address
    bit 2, a      ; check ram address
    jr nz, .inVerm
    ld hl, wTileMap
    ld de, CompressedMap ; $5100
    jr .asm_710d3
.inVerm
    ld hl, wTileMap
    ld de, CompressedMap2 ; $5100
.asm_710d3
    ld a, [de]
    and a
    jr z, .asm_710e9
    ld b, a
    and $f
    ld c, a
    ld a, b
    swap a
    and $f
    add $60
.asm_710e2
    ld [hli], a
    dec c
    jr nz, .asm_710e2
    inc de
    jr .asm_710d3
.asm_710e9
    call EnableLCD
    ld b, $2
    call GoPAL_SET
    call Delay3
    call GBPalNormal
    xor a
    ld [wTownMapSpriteBlinkingCounter], a
    inc a
    ld [wTownMapSpriteBlinkingEnabled], a
    ret

CompressedMap: ; 71100 (1c:5100)
; you can decompress this file with the redrle program in the extras/ dir
    INCBIN "gfx/town_map.rle"
    
CompressedMap2: ; 71100 (1c:5100)
; you can decompress this file with the redrle program in the extras/ dir
    INCBIN "gfx/town_map2.rle"

Last edited by ~Red (2015-03-11 02:38:38)

Offline

#15 2015-03-11 04:03:15

ShantyTown
Member
Registered: 2013-12-04
Post 218/344

Re: Tried adding a Pokemon. Sprite is messed up.

comet wrote:

a list of all the gotchas when starting out would be excellent

I second this.  A sticky thread in the Gen 1 section would probably be the right thing to do.

A few "gotchas" off the top of my head:

1. Mew's BaseStats struct comes after Mewtwo's, before appending new Pokemon.
2. Put new Pokemon pics in the correct Bank. (See UncompressMonSprite)
3. Warps are linked to EVENT_DISP entries, not warps.
4. What does the error "Section XXX is too big" mean?
5. What are the effects of a Dungeon tileset?  (e.g. Can't use map connections, can't fly, etc.)

EDIT:  Red, to answer your Town Map question, take a look at data/town_map_order.asm.

Last edited by ShantyTown (2015-03-11 04:05:39)

Offline

#16 2015-03-11 19:18:05

~Red
Member
Registered: 2010-10-16
Post 225/276

Re: Tried adding a Pokemon. Sprite is messed up.

ShantyTown wrote:

EDIT:  Red, to answer your Town Map question, take a look at data/town_map_order.asm.

I haven't changed anything in town_map_order.asm other than the order in which the maps are. The map works fine it just wont let me scroll through the towns/routes. It gets stuck on a loop of S.S.ANNE a few times and then POKEMON LEAGUE and POKEMON TOWER.

EDIT: Nevermind! I downloaded a fresh copy of town_map.asm from the repository and rewrote the code I did for switching the map depending on which side of the Region you're in. It now works pretty perfectly! I also found that in the town_map code there's a few numbers you have to change as the game will just keep scrolling past the list of maps in townmaporder.

EayfA.jpg  RAZSg.jpg

Last edited by ~Red (2015-03-12 15:55:58)

Offline

Board footer

Powered by FluxBB