Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2016-06-09 06:10:22

Rangi
Member
Registered: 2016-05-09
Post 20/830

Overworld sprites in pokecrystal

As I understand it, engine/overworld.asm defines up to 23 valid overworld sprites for each map group. So if maps/BillsHouse.asm defines a "person_event SPRITE_GRAMPS", and BILLS_HOUSE is in group 7 according to constants/map_constants.asm, then SPRITE_GRAMPS should be listed under Group7Sprites.

...It isn't, but Bill's grandpa appears correctly for me anyway. On the other hand, some maps have glitched sprites even though they're listed in the appropriate group. For example, here's Cianwood City showing buggy SPRITE_ROCK and SPRITE_KRIS. It's not even consistent; when I first enter the map it looks like this. (It happens with BGB too.)

By now I've made significant changes to the original code, so it's possible I messed something up, but I don't know what. Here's my version; does anyone know what the problem is?

Last edited by Rangi (2016-06-09 06:38:19)


ROM hack: Pokémon Polished Crystal (GitHub) — version 2.2.0 released!

Offline

#2 2016-06-09 06:48:28

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

Re: Overworld sprites in pokecrystal

The sprite sets only apply to outdoor maps.

Offline

#3 2016-06-09 08:21:04

Rangi
Member
Registered: 2016-05-09
Post 22/830

Re: Overworld sprites in pokecrystal

Okay, so that explains why the SPRITE_GRAMPS in Bill's house works. (Now I see the "map_object" macro in wram.asm allows up to 15 indoor sprites plus the player sprite, and they're determined directly from the indoor map's events.) Thanks.

Still can't tell why the outdoor sprites aren't being shown correctly.


ROM hack: Pokémon Polished Crystal (GitHub) — version 2.2.0 released!

Offline

#4 2016-06-09 09:06:42

Rangi
Member
Registered: 2016-05-09
Post 23/830

Re: Overworld sprites in pokecrystal

Well, I went for the brute-force solution. Filter the list of maps (maps/map_headers.asm) to those of type TOWN or ROUTE, and include only the necessary sprites for each group (with SPRITE_SILVER_TROPHY padding each one out to 23 entries). Now the bug seems to be gone. I did check earlier that each one was 23 entries long, but maybe I miscounted?

Edit: I spoke too soon. This and this are still happening.

At least this is a hint about the problem. Those maps are both in groups with (a) more than 16 non-SILVER_TROPHY-padding sprites (the other groups all use 11 or fewer of their 23 sprite slots), and (b) more than 16 maps in the group (but other groups have even more—Group 3 has 89 maps in original Crystal, and doesn't have this bug).

Last edited by Rangi (2016-06-09 09:28:30)


ROM hack: Pokémon Polished Crystal (GitHub) — version 2.2.0 released!

Offline

#5 2016-06-09 09:23:05

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 382/435
Website

Re: Overworld sprites in pokecrystal

Just going from one map to another doesn't update the sprites. If you go from a route with no rock smash boulder sprite to another with it, it won't be loaded until you go through a warp. If there's a way to reach map b from map a without going through a warp, then the two maps should have the same spritesets.

The first pic looks like a mismatch in sprite sizes too. One of the sprites that differ from cianwood and route 42 (assuming you came from that route), also differ in the amount of moving forms they have, so it shifted all the sprites past it. Meaning that the start of one sprite in route 42 is right in the middle of another sprite in cianwood. For example some people only have down/up/left/right forms, but most also have four moving forms if they may appear moving anywhere.

Offline

#6 2016-06-09 09:50:49

Rangi
Member
Registered: 2016-05-09
Post 24/830

Re: Overworld sprites in pokecrystal

Just going from one map to another doesn't update the sprites. If you go from a route with no rock smash boulder sprite to another with it, it won't be loaded until you go through a warp. If there's a way to reach map b from map a without going through a warp, then the two maps should have the same spritesets.

I see. So since you can walk from Ecruteak City (group 4) to Route 37 (group 10), their groups need to have the same sprites. Sure enough, matching their sprites up fixed that map.

The first screenshot is still puzzling me. I flew to Cianwood City, entered Cliff Edge Gate (an indoor CAVE-type map), and exited to Route 47. All three maps are in group 22, but my character sprite still got corrupted into a trophy. Is this likely to be a size issue? Not all the sprites need to be the same size—you can definitely have a map with the unmoving SPRITE_ROCK and a moving trainer sprite—so how is this supposed to be fixed?

Last edited by Rangi (2016-06-09 09:56:59)


ROM hack: Pokémon Polished Crystal (GitHub) — version 2.2.0 released!

Offline

#7 2016-06-09 11:02:24

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 383/435
Website

Re: Overworld sprites in pokecrystal

you can definitely have a map with the unmoving SPRITE_ROCK and a moving trainer sprite—so how is this supposed to be fixed?

If you can't walk from one map to the other you are free to put whatever sprites you want in each. But if you can, they should have the same spriteset, and ideally belong to the same map group. The merged sprites are just a side effect of having two adjacent maps with different spritesets if some of the sprites also don't have the same size.

I have never really looked at how this worked and I barely remember my struggles with sprites when I hacked crystal, but consider the fact that the spriteset right before group 22's spriteset may have one sprite assigned more than usual, with that sprite being the trophy one, and group 22 could be loading it as the first sprite.

Offline

#8 2016-06-09 11:22:49

Rangi
Member
Registered: 2016-05-09
Post 26/830

Re: Overworld sprites in pokecrystal

Sometimes putting adjacent maps in different groups is necessary, to give them different roof styles.

I made the 23rd sprite in each group different from the rest, and now it's clear that the player's sprite is loaded as that one by default (warping to different maps sometimes fixes it, sometimes breaks it again). Seems like an off-by-one error, yes, but I recounted and there really are exactly 23 sprites per group, for all 26 groups. Will debug some more tomorrow; thanks for your help.

Last edited by Rangi (2016-06-09 11:28:25)


ROM hack: Pokémon Polished Crystal (GitHub) — version 2.2.0 released!

Offline

Board footer

Powered by FluxBB