Ok, my old offset-per-tile code seems to be completely different from what anomie has. Such that I wasn't even taking BG3HVOFS into account...
Thanks to the magic of copy/paste, I think I have it mostly right now...
http://byuu.cinnamonpirate.com/temp/bppu_render_bg.cpp
The OPT code is in its own block near the middle.
The main thing I'm concerned with is if I've implemented things correctly for when BG1,2,3 are set to 16x16 tiles. I wasn't able to follow what was said there. And mode6 I'm also not too sure about. I know it acts like mode2... but do I need to do anything special for it?
I also assume that the GetTile() macro in anomie's notes is supposed to take into account the SC size settings for BG3?
The code seems to work and get the CT black omen effect working, as well as most others. It does cause an off-by-one every tile error in the SNES test program though, so I obviously botched something...
Help with offset-per-tile mode
Moderator: ZSNES Mods
Nevermind, I figured it out.
http://byuu.cinnamonpirate.com/temp/bppu_render_bg.cpp
was updated to reflect the correct fixes.
anomie, your notes mention (HOFS&7)|(X&~7)... but that doesn't work because hofs should affect X as well. I see what you were saying though, you have to bind it to X with that code (so that only tile 0-31 is loaded... so HOFS=192, X=2 would still load tile 0).
However, your code causes glitches when HOFS!=0 because the HOFS counter doesn't roll over into X.
I was able to fix it with the following:
And obviously, adjust for modes 4 and 6 accordingly.
http://byuu.cinnamonpirate.com/temp/bppu_render_bg.cpp
was updated to reflect the correct fixes.
anomie, your notes mention (HOFS&7)|(X&~7)... but that doesn't work because hofs should affect X as well. I see what you were saying though, you have to bind it to X with that code (so that only tile 0-31 is loaded... so HOFS=192, X=2 would still load tile 0).
However, your code causes glitches when HOFS!=0 because the HOFS counter doesn't roll over into X.
I was able to fix it with the following:
Code: Select all
HOFS = X + BGnHOFS
VOFS = Y + BGnVOFS
optX = X + (BGnHOFS & 7)
if(optX >= 8) { //ignore first tile
hval = GetTile(BG3, (optX - 8) + (BG3HOFS & ~7), BG3VOFS);
vval = GetTile(BG3, (optX - 8) + (BG3VOFS & ~7), BG3VOFS + 8);
if(hval & validbit)HOFS = optX + (hval & ~7);
if(vval & validbit)VOFS = y + vval;
}
-
- ZSNES Shake Shake Prinny
- Posts: 5632
- Joined: Wed Jul 28, 2004 4:15 pm
- Location: PAL50, dood !
This is where I request a new wip in order to test Super Aleste.
Please. m(_v_)m
Please. m(_v_)m
皆黙って俺について来い!!
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Code: Select all
<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
-
- ZSNES Shake Shake Prinny
- Posts: 5632
- Joined: Wed Jul 28, 2004 4:15 pm
- Location: PAL50, dood !
Holy, vanilla-flavoured sweet perfection.
皆黙って俺について来い!!
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Code: Select all
<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)