#6880 - einhaender - Wed Jun 04, 2003 3:20 am
Hi, I was wondering if the following was possible. I have a bunch of Sprites (30), each with 2 Animation frames.
Animation Frame 1 is unique for each Sprite and is read out of its own Sprite Data Array. Animation Frame 2 is common for each of the 30 Sprites, so I read it out of a common Array for every Sprite.
When copying the OAMData it looks in pseudocode like:
for(every sprite) {
create pointer to the array data for animation frame 1
for(animation frame 2) {
copy common sprite animation data to OAM
}
for(animation frame 1) {
copy from pointer to OAM
}
}
However, now I have copied the exact same data in Animation Frame 2,
which is the same for each sprite, 30 times into OAM. Is that neccessary or can I somehow point to a single location?
The code I have in C now looks like:
#define OAMData ((u16*)0x6010000)
int z = 0;
for(loop = it*256 ; loop < (it+1)*256 ; loop++) {
// Animation Frame 2
if(z < 128){
OAMData[loop] = tile_all_frame2Data[z];
}
// Animation Frame 1
if(z >= 128 && z < 256) {
OAMData[loop] = main_sprite_array[0][z-128];
}
z++;
}
You see that the common Animation 2 Data is written each
n*256 to n*256+128 into OAM
Animation Frame 1 is unique for each Sprite and is read out of its own Sprite Data Array. Animation Frame 2 is common for each of the 30 Sprites, so I read it out of a common Array for every Sprite.
When copying the OAMData it looks in pseudocode like:
for(every sprite) {
create pointer to the array data for animation frame 1
for(animation frame 2) {
copy common sprite animation data to OAM
}
for(animation frame 1) {
copy from pointer to OAM
}
}
However, now I have copied the exact same data in Animation Frame 2,
which is the same for each sprite, 30 times into OAM. Is that neccessary or can I somehow point to a single location?
The code I have in C now looks like:
#define OAMData ((u16*)0x6010000)
int z = 0;
for(loop = it*256 ; loop < (it+1)*256 ; loop++) {
// Animation Frame 2
if(z < 128){
OAMData[loop] = tile_all_frame2Data[z];
}
// Animation Frame 1
if(z >= 128 && z < 256) {
OAMData[loop] = main_sprite_array[0][z-128];
}
z++;
}
You see that the common Animation 2 Data is written each
n*256 to n*256+128 into OAM