Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#26 2015-10-18 04:09:39

Konsty
Member
Registered: 2014-05-24
Post 15/15

Re: Mini OW Icons for RED

Danny-E 33 wrote:

That means you did not include mon_party_sprites2.asm correctly.

I literally just copy/pasted from your main.asm
Added the gfx/party_mon_sprites2
Added engine/mon_party_sprites.asm, engine/mon_party_sprites2.asm, and engine/menu/party_menu.asm.
Added wEvolutionData to wram.asm


SECTION "bank32",ROMX,BANK[$32]

PartyMonSprites:  INCBIN "gfx/party_mon_sprites.2bpp",$0,$4000


SECTION "bank33",ROMX,BANK[$33]

INCBIN "gfx/party_mon_sprites.2bpp",$4000,$1b00

INCLUDE "engine/mon_party_sprites2.asm"

Last edited by Konsty (2015-10-18 04:09:58)

Offline

#27 2015-10-18 04:54:12

megamctaco
Member
Registered: 2015-08-23
Post 53/103

Re: Mini OW Icons for RED

I'm getting a "Section 'bank32' is too big" error when I try this.

Offline

#28 2016-02-16 12:16:29

KeiTaRo
Member
Registered: 2015-12-05
Post 3/31
Website

Re: Mini OW Icons for RED

I am attempting to do this also, and get the error:

ERROR:  red/main.asm(2) -> main.asm(4760) -> engine/menu/party_menu.asm(34) :
        Macro 'coord' not defined

I'm not entirely sure why this would happen as the original party_menu.asm also used "coord" and had no problems???? Nothing has really changed that would have affected this so...

Last edited by KeiTaRo (2016-02-16 12:38:56)

Offline

#29 2016-02-16 17:46:05

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 362/411
Website

Re: Mini OW Icons for RED

Use hlCoord instead of coord hl, deCoord instead of coord hl, and aCoord instead of coord a.

Offline

#30 2016-02-16 20:31:54

KeiTaRo
Member
Registered: 2015-12-05
Post 4/31
Website

Re: Mini OW Icons for RED

Thanks for your response! I'm still really new to this, so I appreciate the help. Trying my best to learn as I go. Curious, what is the reason for using hlCoord instead of coord hl in this case (since the original seemed like it used to work, but no longer does?) Also, when attempting your fix, it gives me a different error now:

rgblink -n pokered.sym -o pokered.gbc red/audio.o red/main.o red/text.o red/wram.o
C:\pokered\cygwin64\usr\local\bin\rgblink.exe: Unknown symbol 'Func_71882'

I've really reached a dead end with this error. It seems Shichirobei had this same issue but I'm not sure if I really understood the fix. Danny-E 33 mentions that he may have been copying old code, but I was using Danny-E 33's code :P so I assume that would not be the case here. The only times I see Func_71882 mentioned even at all is in two seemingly unrelated files (naming_screen.asm and trade.asm)... using the code:

callba Func_71882

It shows up again in mon_party_sprites.asm in what I assumed was probably the culprit, but only in the comments. Also, this chunk of code does not differ from the vanilla PokeRed in this case, so I'm not sure why it would be an issue. it's listed on the following lines:

WriteMonPartySpriteOAMBySpecies: ; 71882 (1c:5882)
; Write OAM blocks for the party sprite of the species in
; [wMonPartySpriteSpecies].
xor a
ld [hPartyMonIndex], a
ld a, [wMonPartySpriteSpecies]
call GetPartyMonSpriteID
ld [wOAMBaseTile], a
jr WriteMonPartySpriteOAM

Again, I'm fairly new to this, so I apologize if I'm missing something obvious, but I'm treating this as a learning experience :P I feel like I'm missing a major step...also, I noticed that Danny-E 33's data/mon_party_sprites.asm is the same as the original....is that going to cause problems? do I need to define the new sprites somewhere? Again, I apologize if I'm asking obvious questions, I'd just like to learn as much as possible so I can hopefully be less reliant on others in the future x_x

also, if it helps to know what I've done so far, I've literally just replaced engine/mon_party_sprites.asm, engine/mon_party_sprites2.asm, and engine/menu/party_menu.asm with the ones Danny-E 33 provided. I added the approriate GFX file, and then added them to the end of main.asm by copying the code exactly as it was in the main.asm he also shared in this thread. To the best of my knowledge, I've been following the example code 1:1 (and yes, my game did compile before doing this...I was using pokered-gen-II if that has any bearing on this!)

I have not changed anything in any other file than what I've mentioned here. Really all I want to be able to do is just use the Pokemon menu icons from G/S/C :( so I guess what it comes down to is that I really just need it so the game displays two full sprite frames instead of two frames of mirrored halves. Surely it would be less complicated than all this?

Last edited by KeiTaRo (2016-02-16 22:25:32)

Offline

#31 2016-02-16 21:43:40

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

Re: Mini OW Icons for RED

What text editor are you using? That last error reminds me of the stuff that happens when you use notepad instead of Notepad++, and notepad screws up your line endings and stuff.

Offline

#32 2016-02-16 22:20:51

KeiTaRo
Member
Registered: 2015-12-05
Post 5/31
Website

Re: Mini OW Icons for RED

I've been using Notepad++ so far!

Offline

#33 2016-02-16 22:29:30

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

Re: Mini OW Icons for RED

Disregard my comment, then.

Offline

#34 2016-02-16 23:44:07

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 363/411
Website

Re: Mini OW Icons for RED

hlCoord is the old version of coord hl just like Func_71882 is the old version WriteMonPartySpriteOAMBySpecies. The code you're copying is old and some of the labels have been renamed since that code was written. Unknown symbol 'Func_71882' means that Func_71882 is referenced, but it does not exist. It indeed does not exist, because now it's called WriteMonPartySpriteOAMBySpecies. callba Func_71882 attempts to call a function called Func_71882, but since no such function exists, it doesn't know what to call. Replacing callba Func_71882 with callba WriteMonPartySpriteOAMBySpecies will fix this issue.

However, you'll run into one error like this one for every label mismatch. Copy-pasting his code straight away isn't going to work because there are a lot of functions and addresses whose labels have been updated since it was written nearly two years ago. You should stick to porting only the necessary changes of each file to your own repository, rather than the whole file because otherwise you're going to break everything. Then you would update all the labels that don't match their current name by looking at the most recent version of pokered. It's maybe a better idea to look at the related commits rather than the files. I think what you need is this commit and the nicknaming screen fix from this other commit.

Last edited by Crystal_ (2016-02-16 23:47:32)

Offline

#35 2016-04-07 09:59:52

KeiTaRo
Member
Registered: 2015-12-05
Post 15/31
Website

Re: Mini OW Icons for RED

So after playing around a bit, I decided to try and reuse the existing system and tweak it to do what I need. The way I'm intending to do it, I have each icon as an individual PNG of two animation frames versus the massive sheets I've seen used in other examples so far (laid out top to bottom, like the normal sprite sheets) since I intend to use the G/S/C icons ... works for me so far :) I then went and redid how the game displays the sprites (basically commented out the routine to check if it's the Helix and instead made it go directly to the asymmetrical sprite loading function)

I would like to be able to remap the sprite IDs to my custom icons now...Does anyone know where in the code the Helix gets assigned as Party Icon sprite ID 2? It's not located in the pointers with the others (goes straight from Ball to Clefairy...?) I've been looking around but I can't seem to figure out how it assigns the Helix sprite as a party icon in the first place. It appears that changing the pointer data for the menu Ball sprite directly affects the Helix, but only insofar as to what sprite graphics it loads...I noticed there was a function related to the two of them, but it appeared to only be animation related.

I'm actually not sure I completely understand how the stock party icon sprite are set up to begin with. At a glance, it seems like it simply goes in the order of the sprite ID's as defined in Sprite Constants, starting with the data for the first frame, then immediately followed by the data for the second frame. Weird thing here is that the sprites used by mon_ow_sprites.png seem to have separate pointers for their top and bottom halves......okay, so obviously that is less than ideal now that I have the sprites set up to be asymmetrical. The labels here are pretty good at explaining what all the various functions do, but I can't quite tell if there's any code at work which is setting which sprite ID's are behaving this way...between this and the Helix/Ball oddities, is there seriously just some sort of hardcoding going on for every entry? The ideal solution would be to just make them all behave like the Rhydon, I.E. the very first entry. Kinda feels like they took a really complicated approach to something that should have been pretty simple....

While I'm at it, I'm wondering if it is possible to expand the number of pointers in this table as well...the reason I ask is because after the pointer for the first frame of the last "MonPartySprites" character ("Quadraped"...?) it simply jumps back around to the Rhydon ("slowbro") sprite's second frame pointer...I'm sure it's just a matter of telling the game how many entries there are, but I can't quite figure out where that code is, either.

Last edited by KeiTaRo (2016-04-07 18:38:30)

Offline

#36 2016-04-08 21:28:35

KeiTaRo
Member
Registered: 2015-12-05
Post 16/31
Website

Re: Mini OW Icons for RED

Okay! Update on this issue: I was able to fix the issue with the pointers corresponding to only 1/4 of the sprite (updated the number for vSprites + [value] to be + $40 instead of + $20 from the previous) but still have no idea idea how to expand the pointer table or remove the weird functionality for the Ball and Helix entries...still, this is progress! yay!

It appears as though the second frame of every sprite is determined in the pointer table not by its physical location in the list but by the "vSprite + [value]" ...would appear whatever entry is + $400 higher than the previous entry's vSprite value become the second frame. I could be totally wrong, but by my experimenting, that is what I came across. It also severely limits how many sprites I could fit in to the list if this is true :( I will keep researching this further, unless anyone has any suggestions.

Figured it out! the answer is in the .animateSprite routine! specifically,

ld c, $40 ; amount to increase the tile id by

Increasing this means I can add on to the pointer table entries, it seems! yay! By how much? Guess I will find out :P The issue with the weird hardcoded Helix and Ball thing still stands

EDIT: Further update! under LoadMonPartySpriteGfxWithLCDDisabled, there is a "ld a, $1c" which hardcodes the entire number of entries in the pointer table. This too must be updated. That answers my question of how much I can increase it by, I guess (I hope?) Also, I was able to disable the routine which forces Ball and Helix in to a single bouncing frame as opposed to an animated sprite sprite, but still have no idea what code is at play to determine where the Helix entry is getting loaded from. If anyone has insight, that would be fantastic.

EDIT EDIT: .....oh....kay. So, it turns out all you need to do is set a pointer entry in the space between Ball and Fairy (and increase the table length to $1e) and make sure that it corresponds to vSprite + $80 and it automatically becomes assigned to the helix slot? wh....I'm not going to pretend I understand <i>how</i> this works, but it does work, so okay, not gonna argue.....heh. I'll probably write up a tutorial here in a bit on how to do all of this using the original icon engine.

Last edited by KeiTaRo (2016-04-08 23:58:22)

Offline

#37 2016-04-09 06:31:32

KeiTaRo
Member
Registered: 2015-12-05
Post 17/31
Website

Re: Mini OW Icons for RED

Update #30bajillion: Well, that was short-lived. Definitely do -not- do the above method of expanding the pointed table unless you enjoy having the font get overwritten in memory :V

oopsicon.PNG

back to the drawing board. I guess I will need to come up with a new method of loading the sprites in to memory than what the normal engine does.

Last edited by KeiTaRo (2016-04-09 08:04:45)

Offline

#38 2016-04-09 15:13:08

Danny-E 33
Administrator
Registered: 2012-06-09
Post 948/1,021

Re: Mini OW Icons for RED

This might be of some help.

Originally, there are only 10 party menu sprite ids. Since there are so few, all 10 can be loaded into vram before exactly which sprites are needed is determined.
When the sprites are being loaded, the actual address of the helix sprite, OmanyteSprite (omanyte.2bpp), is never directly referenced since it is in rom immediately after BallSprite (ball.2bpp) which also must be loaded.

You might notice that MonPartySpritePointers references BallSprite, which is a single 2x2 tile image. Since each tile is $10 bytes, this image must be $40 bytes. But MonPartySpritePointers says to load $80 bytes starting at BallSprite. This guarantees that the helix sprite will be loaded and also that it will immediately follow the ball sprite in vram.

Secondly, GetPartyMonSpriteID gets the sprite id for the currently loaded pokemon from MonPartyData. Remember that valid numbers for this id are from 0 to 9. But before this routine returns the result in a, it actually returns the id << 2.
This guarantees that instead of returning $0, $1, $2, $3, $4, $5, $6, $7, $8, or $9, it returns $0, $4, $8, $c, $10, $14, $18, $1c, $20, or $24.

If you run the game in an emulator like bgb and open the vram viewer while the party menu is open, you will see that these values correspond to the tile ids of each sprite.

For example, SPRITE_HELIX has the value 2. So 2 << 2 is 8. In the vram viewer, tile $8 is the base tile for the helix sprite.

Next, you might notice that the return value (from GetPartyMonSpriteID) that is in register a immediately gets stored in wOAMBaseTile, which gets used by WriteAsymmetricMonPartySpriteOAM and WriteSymmetricMonPartySpriteOAM when constructing the oam data for each pokemon in your party.

I'm not sure how much of this helps clear up some of your confusion, but I hope some of this information is of use to you. It should at least solve the mystery of how the helix sprite gets correctly loaded and used.


Red Hack: Pokémon Prototype

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

Offline

#39 2016-04-14 05:20:57

daMoose52
Member
Registered: 2014-11-14
Post 25/108
Website

Re: Mini OW Icons for RED

I have everything working except for the Nickname screen; managed to port in everything I believe, any special tweaks to the naming screen?


Pokemon: Project Neo A Pokemon hack 15 years in the making...

Offline

#40 2016-04-14 10:19:12

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 371/411
Website

Offline

#41 2016-04-14 12:45:09

daMoose52
Member
Registered: 2014-11-14
Post 26/108
Website

Re: Mini OW Icons for RED

That looks like the changes I was expecting to have to make!
Its been about a year and a half since I tinkered with this so I'm getting back in the saddle. Thanks for pointing that out!


Pokemon: Project Neo A Pokemon hack 15 years in the making...

Offline

#42 2016-07-29 15:01:54

triumph
Member
Registered: 2013-11-14
Post 37/45

Re: Mini OW Icons for RED

I know this is an old post, but I want to add this sprite to the party menu, should I proceed to do aaall these steps?
(Btw, the same sprite is repeated serious times because I only want to add 1, just did it that way because is based on what I found on pokered)

208cp6x.jpg

Offline

#43 2016-10-13 17:17:30

daMoose52
Member
Registered: 2014-11-14
Post 81/108
Website

Re: Mini OW Icons for RED

Following up, as it appears I imported all of the changes correctly so its got to be something odd I missed; on switching the Pokemon in the menu, the newly positioned pokemon do not match their icons, they match their old icons. Anyone else run into this?


Pokemon: Project Neo A Pokemon hack 15 years in the making...

Offline

#44 2016-10-14 13:18:13

daMoose52
Member
Registered: 2014-11-14
Post 83/108
Website

Re: Mini OW Icons for RED

pokered_partyscreen1.png
pokered_partyscreen2.png

Near as I can tell, its not updating the index properly. When I reload the menu, the sprites are the proper sprite, but do not update on shifting them.


Pokemon: Project Neo A Pokemon hack 15 years in the making...

Offline

#45 2016-10-14 19:06:57

Danny-E 33
Administrator
Registered: 2012-06-09
Post 987/1,021

Re: Mini OW Icons for RED

Take a look at the beginning of DrawPartyMenu_ in engine/menu/party_menu.asm:

DrawPartyMenu_:
    xor a
    ld [H_AUTOBGTRANSFERENABLED],a
    call ClearScreen
    call UpdateSprites
    callba LoadMonPartySpriteGfxWithLCDDisabled ; load pokemon icon graphics

RedrawPartyMenu_:

RedrawPartyMenu_ is called after two mon switch positions. The party sprites don't have to be reloaded because in the original game, every one of the party sprites is already loaded, and the order of the sprites in memory is the same no matter what, regardless of the mon in your party.
In your hack where you have added a unique sprite for each mon, obviously not every sprite is in memory all at once. Instead, only the ones that are needed are loaded, and they are deliberately in the same order as the mon in your party. So the sprite graphics need to be reloaded.

Change the beginning of the routine to this:

DrawPartyMenu_:
    xor a
    ld [H_AUTOBGTRANSFERENABLED],a
    call ClearScreen
    call UpdateSprites
RedrawPartyMenu_ReloadSprites:
    callba LoadMonPartySpriteGfxWithLCDDisabled ; load pokemon icon graphics

RedrawPartyMenu_:

And in engine/menu/start_sub_menus.asm at the end of SwitchPartyMon, change `jp RedrawPartyMenu_` to `jp RedrawPartyMenu_ReloadSprites`


Red Hack: Pokémon Prototype

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

Offline

#46 2016-10-14 22:19:58

daMoose52
Member
Registered: 2014-11-14
Post 84/108
Website

Re: Mini OW Icons for RED

There we go :D
Its exactly as I expected, but not where I expected it to be :D I knew the routine wasn't reloading the new sprites right and was looking for somewhere the refresh occurred, but I was looking in the actual party_mon files~

Quick Edit: Any way to address the flicker/garbage that appears on the redraw?

Last edited by daMoose52 (2016-10-14 22:58:03)


Pokemon: Project Neo A Pokemon hack 15 years in the making...

Offline

#47 2016-10-14 23:06:48

Danny-E 33
Administrator
Registered: 2012-06-09
Post 989/1,021

Re: Mini OW Icons for RED

I don't know what you mean by garbage.


Red Hack: Pokémon Prototype

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

Offline

#48 2016-10-14 23:59:53

daMoose52
Member
Registered: 2014-11-14
Post 86/108
Website

Re: Mini OW Icons for RED

For a split second, when it reloads the sprites, there's some garbage on the screen:
http://projectneo.retrogaminggear.com/i … licker.AVI


Pokemon: Project Neo A Pokemon hack 15 years in the making...

Offline

#49 2016-10-15 05:32:58

Danny-E 33
Administrator
Registered: 2012-06-09
Post 990/1,021

Re: Mini OW Icons for RED

Hm, I've never seen something like that. Are you sure you disabled the LCD while writing to VRAM?

EDIT: If you pause the video just right, it's actually not garbage. It's the overworld. But no sprites are drawn and its using the party menu palettes.

Last edited by Danny-E 33 (2016-10-15 05:35:46)


Red Hack: Pokémon Prototype

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

Offline

#50 2016-10-15 14:47:35

daMoose52
Member
Registered: 2014-11-14
Post 88/108
Website

Re: Mini OW Icons for RED

Yup, routines have the LCD Disabled and re-enabled as appropriate.
My core ASM is a little old so the function names don't always line up but its there~ Both on the old routines and the ones I imported as a part of this feature.

Here's my initial portion of the party_mon.asm file:

DrawPartyMenu_: ; 12cd2 (4:6cd2)
    xor a
    ld [H_AUTOBGTRANSFERENABLED],a
    call ClearScreen
    call UpdateSprites ; move sprites
RedrawPartyMenu_ReloadSprites:
    callba LoadPartyMonSprites ; load pokemon icon graphics ;callba Func_71791 ; load pokemon icon graphics

RedrawPartyMenu_: ; 12ce3 (4:6ce3)

I do note the difference in the function name, but that's mostly a difference of age and not function. Here is that routine though, straight from your mon_party_sprite2.asm file in my build:

LoadPartyMonSprites:

    call DisableLCD
    ld de, vNPCSprites
    ld hl, wPartySpecies
.loop
    ld a, [hli]
    cp $ff
    jr z, .done
    push hl
    call LoadPartyMonSprite
    pop hl
    jr .loop
.done
    jp EnableLCD

Last edited by daMoose52 (2016-10-15 17:16:16)


Pokemon: Project Neo A Pokemon hack 15 years in the making...

Offline

Board footer

Powered by FluxBB