#968 - whodoo - Sun Jan 12, 2003 10:02 pm
when using tiles Im storing the map like this
const u8 map[ 16 * 16 ] = {0x00,0x15,0x15...}
and then
temp = (u16*)map;
for(loop = 0; loop < 16*16/2; loop++)
bg2.mapData[loop] = map[loop];
this works..but if I just wanna sett all the tiles to e.g. 0x15..why cant I write like this:
for(loop = 0; loop < 16*16/2; loop++)
bg2.mapData[loop] = 0x15;
only the half of the tiles got the value 0x15 and the rest got 0x00
why?
#969 - whodoo - Sun Jan 12, 2003 10:13 pm
of course this aint a problem when I just wanna display a map..
but e.g. if I wanna change a tile...like..
bg2.mapData[a tile] = ...
#971 - Touchstone - Sun Jan 12, 2003 10:19 pm
What's the size of bg2.mapData? Does it match the size of the tiles in VRAM? Plus, you can only access vram by 16 or 32 bit access, not 8 bit access, but we all know this by now don't we? :)
_________________
You can't beat our meat
#976 - Splam - Sun Jan 12, 2003 10:37 pm
Are you sure the code you've posted is the code you're compiling? ie
what size map are you updating? 16x16?
whats the temp for? did you mean...
bg2.mapData[loop] = temp[loop];
If so then it would work with the /2 as you'll be writing 2 byte entries from your map each time ie 00,15 15,?? without the temp[loop] thing you'll write 1 tile entry into every other bg entry.
When you then go to clear it out you're only writing to one vram register at a time so you don't want the /2 BUT you can't write bytes so what you really need is the /2 but
bg2.mapData[loop] = 0x1515;
instead.
Make sense? hehe not to me, I hope I'm right but I'm veeery tired so I might have screwed up my explanation with too many /2's :)
#977 - whodoo - Sun Jan 12, 2003 10:42 pm
nah..I was just confused..I found it..e.g. if I wanna change tiles 0 and 1..
bg2.mapData[0] = 21 | 21<<8;
haven?t worked with this kinda of data before since you got lots of memory on the pc :)
#978 - Splam - Sun Jan 12, 2003 10:42 pm
whodoo wrote: |
of course this aint a problem when I just wanna display a map..
but e.g. if I wanna change a tile...like..
bg2.mapData[a tile] = ... |
For all of this I'm presuming you're using a rot/scale screen so if not ignore everything I've said and am about to say lol
Because the rot/scale entries are byte per tile if you want to change 1 you need to do it as part of a pair so if you had a pair of 00,15 and you wanted to change the 00 to 01 you'd have to do
bg2.mapData[a tile] =0x0115
#979 - Splam - Sun Jan 12, 2003 10:45 pm
whodoo wrote: |
nah..I was just confused..I found it..e.g. if I wanna change tiles 0 and 1..
bg2.mapData[0] = 21 | 21<<8;
haven?t worked with this kinda of data before since you got lots of memory on the pc :) |
Cool, you beat me to it ;) It's annoying not having byte access to the screen especially for drawing to the byte/pixel screen if you only want to update single pixles (say for a simple movie player) because you have to read, mask, or and write..
#988 - whodoo - Mon Jan 13, 2003 1:26 am
yeah :) but now I got another problem..
the tiles work fine, but the game wont display my sprites when using tiles..is there anything special I need to think about when using sprites and tiles..or I am just a bt tired this evning :)
#989 - whodoo - Mon Jan 13, 2003 1:32 am
doh..I forgot to load the palette sorry for that
#991 - Splam - Mon Jan 13, 2003 1:38 am
*warning* Coding whilst tired is bad m'kay ;) Many are the times I've had some code working and instead of going to bed carried on, got up in the morning only to find disaster has struck while I was half blindly typing in nonsense code, or thinking i'd finished some code only to find it was all a wonderful dream lol
#993 - whodoo - Mon Jan 13, 2003 2:00 am
thats right :)
huh feels like my english gettin too bad when Im trying to hack the GBA at this time :)