Hi all you crazy Neo Maniacs,

I am working on an Intro that has close to 200 full screen (320x224) pictures.
The pictures are compiled using DATLib and are compiled sequentially in chardata.xml.

Instead of writing a long case statement I am hoping to iterate through all 200 pictures using pointer arithmetic.
So far this line works for the picture part:. pic = ((BYTE *)pic + 1144); //I can get to the next 320x224 screen with this one!

My current problem is how to iterate to the next palette....unlike the pictures that are all 280 tiles (320x224) the palettes all have different palette counts in each palette group which makes their addresses unique...
Is there a clean way to get to the next palette group address?

I have posted my code in hopes someone could point me in the right direction!

Thanks for your time
#ifndef __INTRO_H__ #define __INTRO_H__ #include <stdio.h> #include <stdlib.h> #include <input.h> #include <DATlib.h> #include "../../externs.h" void IntroMovie() { BYTE count = 0; picture Intro; pictureInfo * pic = &IntroBlast1; paletteInfo * pal = &IntroBlast1_Palettes; initGfx(); backgroundColor(0x0000); //BG color pictureInit(&Intro, pic,1, 1, 0, 0, 0); palJobPut(1,pal->palCount,&pal->data); SCClose(); while (1) { waitVBlank(); count++; if (count == 5) { frameNum++; pic = ((BYTE *)pic + 1144);//This line works next 320 x 224 tile group pal = ((BYTE *)pal + (pal->palCount * 2)+2) ; //This Line does not output the correct palette entry-- Trying to move to the next palette entry if ((DWORD)pal &1) pal = ((unsigned char *)pal)+1; //This Line does not output the correct palette entry -- Trying to move to the next palette entry pictureInit(&Intro, pic,1, 1, 0, 0, 0);//Render next picture (works A-OK) palJobPut(1,pal->palCount,pal->data);//Render next palette group (I am lost here) count=0; } SCClose(); } } #endif


Isn't pal->palCount the total number of palettes for ALL the pictures ?
Je fais des trucs. Des fois ça marche, des fois ça marche pas.


Hi Furrtek! I can't believe you responded to this! You are epic I am a big fan!
It is amazing were able to get NGP to run on AES! That project is so kickass! I wish you could make them and distribute them!
Neo running on Neo! Straight Gangster!

In the case of:
Isn't pal->palCount the total number of palettes for ALL the pictures ?

This is what I know...

palJobPut(1, pal->palCount, pal->data);

1 is the start palette
pal->palCount.pal (is the number of pals allocated to the picture that is currently loaded...I got worried and did a print statement that output 208 which is the number of palettes in the first frame I compiled....frame 2 would be 213...218....201 etc...)
pal->palCount.data (Is the specific palette colour values related to the palCount specified...etc I'm not 100% on the specifics here)

I really wish I could get this part figured out mur


Correct offset calculation would be:

pal = ((BYTE *)pal + (pal->palCount * 32)+2); //each palette is 32 bytes + 2 header bytes

Your method however relies on data being in specific order.

A better method could be to build a catalog:

catalog.s:.globl introCatalog introCatalog: .long IntroBlast1 .long IntroBlast1_Palettes .long IntroBlast2 .long IntroBlast2_Palettes .long IntroBlast3 .long IntroBlast3_Palettes .long IntroBlast4 .long IntroBlast4_Palettes etc... .long 0x00000000 |; end marker, if wanted
code.c:typedef struct catalogItem { picture* pict; paletteInfo* pal; } catalogItem; typedef struct catalog { catalogItem item[0]; } catalog; extern catalog introCatalog; //use catalog: pictureInit(introCatalog.item[0].pict,pic,1,1,0,0,0); palJobPut(1,introCatalog.item[0].pal->palCount,introCatalog.item[0].pal->data);
Might be some typos in there, didn't build sample/compile, but you get the idea.


Two legends one post! It is truly an honour! You guys rock!top

HPMAN let me start off by saying your DATLib kicks ass!
The work you put into DATLib really shows. All my spare time is dedicated to using it. I am so thankful you made it available to us.
My goal is to not let you down and make a solid project with it.

I started back in November of 2015 and never looked back since. You have crushed it in every way.

Thanks for the math it works like a charm! (I was so frustrated)
I have never created a catalog before but I'm hyped to try it out. I can definitely see the value here.

I have something to share with the community it is small but kinda cool I'll post once I get the files together.


Glad to see people using the tools.

On your code, also watch out for # of palettes updated when switching pictures.

You can probably reload ~180 tops during vblank, assuming this is the only job to run.

Beyond that you'll have rogue pixels onscreen on the hardware and possibly wrong colors at screen top while it is still loading palettes.


Thanks for the heads up! Dually noted! beer


Thanks for the petting, my fur is now nice and soft happy
HPMAN works while I draw funny diagrams on the wiki.
Je fais des trucs. Des fois ça marche, des fois ça marche pas.