Page 1 of 1

Compile warnings

Posted: Sun Oct 11, 2015 3:27 am
by orlanrod
Been getting these warnings in codeblocks. Been ignoring them until now.

src\main.c||In function `main':|
src\main.c|75|warning: passing arg 2 of `VDP_setPaletteColors' discards qualifiers from pointer target type|
src\main.c|113|warning: passing arg 2 of `SPR_initSprite' discards qualifiers from pointer target type|
src\main.c|114|warning: passing arg 2 of `SPR_initSprite' discards qualifiers from pointer target type|


Here is the code related to the errors

VDP_setPaletteColors(0, palette_black, 64);
PR_initSprite(&sprites[player1.zorder], &jason_sprite, player1.x, player1.y, TILE_ATTR(PAL1, TRUE, FALSE, FALSE));
SPR_initSprite(&sprites[czorder], &fcitizen_sprite, cxypos[0][0], cxypos[1][0], TILE_ATTR(PAL2, TRUE, FALSE, FALSE));

Re: Compile warnings

Posted: Sun Oct 11, 2015 7:46 am
by Stef
You can ignore these ones freely, that are just because of "const" versus "no const" variables ;)

Re: Compile warnings

Posted: Sun Oct 11, 2015 4:55 pm
by orlanrod
Stef wrote:You can ignore these ones freely, that are just because of "const" versus "no const" variables ;)
Ah okay. Will do. 8B

Re: Compile warnings

Posted: Mon Oct 12, 2015 1:28 pm
by tryphon
Is there a way of fixing them (I mean, apart casting everything) (some tag in the make.exe...) ?

Re: Compile warnings

Posted: Mon Oct 12, 2015 3:22 pm
by Stef
I don't think so, i can remove all the 'const' from the method declaration side, but you sometime want to have it in the variable declaration so... there is no good solution to avoid them as far i know :-/

Re: Compile warnings

Posted: Mon Oct 12, 2015 8:47 pm
by mikejmoffitt
For setting the palette, you can just do this:

Code: Select all


u32 p_addr = (u32)(address of your palette array; 16 words);
// Could be u32 p_addr = (u32)&my_pal[0];
u16 pal_number = (palette you want to set);
VDP_doCRamDMA(p_addr, pal_number * 32, 16);