Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2014-04-14 19:45:41

Chamber_
Member
Registered: 2013-12-31
Post 27/119

[GOLD]Add more party icons/overworld

I'm trying to add more icons of in the party, for that I'm using the documentation of Pokecrystal as a guide.

I want reponint the routine GetIcon to another bank. This is the original routine:

GetIcon: ; 8ea1e
; Load icon graphics into VRAM starting from tile hl

; One tile is 16 bytes long
    add hl, hl
    add hl, hl
    add hl, hl
    add hl, hl
    
    ld de, VTiles0
    add hl, de
    push hl
    
; Reading the icon pointer table would only make sense if they were
; scattered. However, the icons are contiguous and in-order.
    ld a, [CurIcon]
    push hl
    ld l, a
    ld h, 0
    add hl, hl
    ld de, IconPointers
    add hl, de
    ld a, [hli]
    ld e, a
    ld d, [hl]
    pop hl
    
    ld bc, $2308
    call GetGFXUnlessMobile
    pop hl
    ret
; 8ea3f

GetGFXUnlessMobile: ; 8ea3f
    ld a, [InLinkBattle]
    cp 4 ; Mobile Link Battle
    jp nz, Request2bpp
    jp Functiondc9
; 8ea4a

this is what I did:

GetIcon:

push hl
push af
ld a,$79
ld hl,$4000
rst $8 ; $1E4000
ret


$1E4000:
pop af
pop hl
... (original routine)

So far it has not given effect, could help me to solve this?

Offline

#2 2014-04-14 21:21:43

Miksy91
Member
Registered: 2010-10-16
Post 2,092/2,306

Re: [GOLD]Add more party icons/overworld

Party icons? You're talking about the sprites used in the "Pokemon menu" that can be opened under "Pokedex" right?
If so, I have probably documentation on how to edit them since I used to work with them with DE. If you need help, I'll take a look what it is about.

Offline

#3 2014-04-14 21:42:28

comet
Member
Registered: 2012-04-09
Post 428/672

Re: [GOLD]Add more party icons/overworld

rst is a call, and FarCall calls hl. You're popping those return addresses instead of what you pushed.

Just pass your parameters through de. For functions that need all 3 register pairs, use Predef.

If you ever come across a legitimate use for this pattern, you can manipulate sp directly instead of wasting time popping and pushing values you won't use.

Offline

#4 2014-04-14 21:47:36

comet
Member
Registered: 2012-04-09
Post 429/672

Re: [GOLD]Add more party icons/overworld

By the way, if you just wanted to move the icons, Request2bpp takes bank b. In fact, it's required.

ld bc, $2308

should really be

lb bc, BANK(Icons), 8

Last edited by comet (2014-04-14 23:03:05)

Offline

#5 2014-04-14 23:34:03

Chamber_
Member
Registered: 2013-12-31
Post 30/119

Re: [GOLD]Add more party icons/overworld

@Miksy91:  I have the documentation about how to edit, what I need is to expand the routine for increment the number of OW which can be used. Currently only allows 0x26 (+2 that fit into the free space in the same bank).

@comet: I can hardly understand you because you speak more fluent English jaja

1.-You say if I will make a farcall, instead of using "push & pop" pass the content of "hl" to "de"?
2.-How can I use Predef?
3-is that ok?:

ld bc, $0008 ; BANK(Icons)
    call GetGFXUnlessMobile
    pop hl
    ret

Offline

#6 2014-04-15 07:30:02

Miksy91
Member
Registered: 2010-10-16
Post 2,093/2,306

Re: [GOLD]Add more party icons/overworld

Just relocate the sprites elsewhere then.

Pokemon overworld sprites
Picture Numbers   - 1792A     // Refers to pokemon in table "Menu sprites". Apparently I have moved the picture numbers here in DE.
Menu sprites       - 8E95B    // Refers to indexes in table "Graphics pointers"
Graphics pointers - 8EA56

I have the Graphics stored starting at 0xA4000 myself.
I'd imagine the routine tell where they are being a bit ahead of 0x8EA56.

Apparently the Graphics pointers table is accessed at 23:6779, and close by, we have "ld b, $rom bank" instruction telling the rom bank where the graphics are located. In other words, you don't even have to move the pointer table anywhrere, at least I haven't.

Edit:
What comet was trying to say there that when calling routine "Request2bpp", the rom bank of your 2bpp images must be loaded in register b and c must have the value 08. So,

ld b, BANK(ICONS)
ld c, 08

or simply

ld bc, "BANK(ICONS)" 08

Last edited by Miksy91 (2014-04-15 07:40:27)

Offline

#7 2014-04-15 17:20:55

Chamber_
Member
Registered: 2013-12-31
Post 34/119

Re: [GOLD]Add more party icons/overworld

Thank you both, the end was very easy to do everything and I was doing very complicated.

The only thing I did was change the bank animations in $8E8C0 (pokemon gold).

Offline

Board footer

Powered by FluxBB