clean up example warnings
This commit is contained in:
@@ -72,7 +72,7 @@ int NewCard()
|
||||
{
|
||||
// unlinear randomness - cards with low number will be most plentiful
|
||||
int card = (int)(pow((RandFloat()*0.99f), 1.6f) * CARDTYPES);
|
||||
|
||||
|
||||
// change organization of card order - 3 groups from weakest to strongest cards
|
||||
card = (card/3) + (card % 3)*10;
|
||||
return card;
|
||||
@@ -163,7 +163,7 @@ char NumBuf[20];
|
||||
// display state of one player
|
||||
void DispState1(int player)
|
||||
{
|
||||
int i, k;
|
||||
int i;
|
||||
sPlayer* p;
|
||||
p = &Players[player];
|
||||
|
||||
@@ -248,12 +248,8 @@ void DispFlag()
|
||||
{
|
||||
int t = ((int)(time_us_64()/200000)) & 3;
|
||||
int player;
|
||||
int i, k;
|
||||
sPlayer* p;
|
||||
for (player = 0; player < 2; player++)
|
||||
{
|
||||
p = &Players[player];
|
||||
|
||||
// get castle height
|
||||
int h = Players[player].par[PAR_CASTLE]; // h is in range 0..100
|
||||
if (h > CASTLEMAX) h = CASTLEMAX;
|
||||
@@ -551,8 +547,6 @@ void WinGame(int player)
|
||||
EndGame = player;
|
||||
|
||||
// prepare castle height
|
||||
sPlayer* p = &Players[player];
|
||||
|
||||
// get castle height
|
||||
int h = Players[player].par[PAR_CASTLE]; // h is in range 0..100
|
||||
if (h > CASTLEMAX) h = CASTLEMAX;
|
||||
@@ -598,9 +592,9 @@ void WinGame(int player)
|
||||
|
||||
// save background
|
||||
DrawImg(&Save4Canvas, &Canvas, 0, 0, x, y, 128, 32);
|
||||
|
||||
|
||||
// draw image
|
||||
DrawBlit(&Canvas, &WinCanvas, x, y, player*4*128
|
||||
DrawBlit(&Canvas, &WinCanvas, x, y, player*4*128
|
||||
+ (anim>>2)*128, 0, 128, 32, TRANSCOL);
|
||||
anim++;
|
||||
if (anim >= 16) anim = 0;
|
||||
@@ -716,7 +710,7 @@ void PutCard(int pos, Bool discard)
|
||||
{
|
||||
// ruin castle
|
||||
snd = RuinCastleSnd;
|
||||
sndlen = sizeof(RuinCastleSnd);
|
||||
sndlen = sizeof(RuinCastleSnd);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -796,7 +790,7 @@ void PutCard(int pos, Bool discard)
|
||||
snd = BuildCastleSnd;
|
||||
sndlen = sizeof(BuildCastleSnd);
|
||||
break;
|
||||
|
||||
|
||||
// saboteur (enemy stocks -4)
|
||||
case 16:
|
||||
p = &Players[Player ^ 1];
|
||||
@@ -1003,7 +997,7 @@ int FindCard()
|
||||
}
|
||||
}
|
||||
|
||||
// enabled card not found - find card for discard
|
||||
// enabled card not found - find card for discard
|
||||
// (discard expensive cards, they cannot be use for a long time)
|
||||
if (foundinx < 0)
|
||||
{
|
||||
|
||||
@@ -150,17 +150,20 @@ void VideoInit()
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
spr2 = &BalloonSprites[j+lay*BALLOON_NUM];
|
||||
if ((spr->x < spr2->x + BALLOONW) &&
|
||||
(spr->x + BALLOONW > spr2->x) &&
|
||||
|
||||
((spr->y < spr2->y + BALLOONH) &&
|
||||
(spr->y + BALLOONH > spr2->y)) ||
|
||||
|
||||
((spr->y < spr2->y + HEIGHT + 2*BALLOONH) &&
|
||||
(spr->y + BALLOONH > spr2->y + HEIGHT + BALLOONH)) ||
|
||||
|
||||
((spr->y + HEIGHT + BALLOONH < spr2->y + BALLOONH) &&
|
||||
(spr->y + HEIGHT + 2*BALLOONH > spr2->y)))
|
||||
if (
|
||||
(
|
||||
(spr->x < spr2->x + BALLOONW) &&
|
||||
(spr->x + BALLOONW > spr2->x) &&
|
||||
(spr->y < spr2->y + BALLOONH) &&
|
||||
(spr->y + BALLOONH > spr2->y)
|
||||
) || (
|
||||
(spr->y < spr2->y + HEIGHT + 2*BALLOONH) &&
|
||||
(spr->y + BALLOONH > spr2->y + HEIGHT + BALLOONH)
|
||||
) || (
|
||||
(spr->y + HEIGHT + BALLOONH < spr2->y + BALLOONH) &&
|
||||
(spr->y + HEIGHT + 2*BALLOONH > spr2->y)
|
||||
)
|
||||
)
|
||||
break;
|
||||
}
|
||||
} while (j < i);
|
||||
@@ -233,7 +236,7 @@ int main()
|
||||
}
|
||||
|
||||
if (x > WIDTH - HOTAIRW)
|
||||
{
|
||||
{
|
||||
x = WIDTH - HOTAIRW;
|
||||
HotairDX[i] = -RandU8MinMax(HOTAIR_MINSPEED, HOTAIR_MAXSPEED);
|
||||
}
|
||||
@@ -247,7 +250,7 @@ int main()
|
||||
}
|
||||
|
||||
if (y > HEIGHT - HOTAIRH)
|
||||
{
|
||||
{
|
||||
y = HEIGHT - HOTAIRH;
|
||||
HotairDY[i] = -RandU8MinMax(HOTAIR_MINSPEED, HOTAIR_MAXSPEED);
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ void VideoInit()
|
||||
|
||||
int main()
|
||||
{
|
||||
int i, j, off;
|
||||
int i, j;
|
||||
int a, b;
|
||||
|
||||
// copy images
|
||||
@@ -150,7 +150,7 @@ int main()
|
||||
{
|
||||
// membranes update (by sound offset)
|
||||
int off = (SNDLEN - SoundCnt) % BEATINT;
|
||||
off = (off < BEATON) ? MEMBOFF : 0;
|
||||
off = (off < (int)BEATON) ? MEMBOFF : 0;
|
||||
LayerSetX(MEMB1LAYER, REPRO1X+MEMB1X+off);
|
||||
LayerSetY(MEMB1LAYER, MEMBY+off);
|
||||
LayerSetX(MEMB2LAYER, REPRO2X+MEMB2X+off);
|
||||
|
||||
@@ -295,7 +295,7 @@ void Run()
|
||||
b = *s++;
|
||||
|
||||
// 3 -> new cell
|
||||
if (b == 3)
|
||||
if (b == 3)
|
||||
*d = TILE_FULL;
|
||||
|
||||
// 2 -> unchanged
|
||||
@@ -343,7 +343,6 @@ void InitSlot()
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
char ch;
|
||||
|
||||
// copy tiles images to RAM buffer (flash would be too slow)
|
||||
@@ -419,7 +418,7 @@ int main()
|
||||
if (CurY < 0) CurY = MAPH-1;
|
||||
CurOn(); // set cursor on
|
||||
break;
|
||||
|
||||
|
||||
// toggle
|
||||
case ' ':
|
||||
CurFlip(); // flip cursor
|
||||
|
||||
@@ -81,7 +81,7 @@ void VideoInit()
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
int i, j, k, rr, gg, bb;
|
||||
int i, j, rr, gg, bb;
|
||||
sLine* line;
|
||||
|
||||
// initialize random number generator
|
||||
|
||||
@@ -100,7 +100,6 @@ void NewDrop(int i)
|
||||
int main()
|
||||
{
|
||||
int i, x, y;
|
||||
u8* s;
|
||||
u8* d;
|
||||
|
||||
// initialize random number generator
|
||||
@@ -140,10 +139,10 @@ int main()
|
||||
for (x = 0; x < TEXTW; x++)
|
||||
{
|
||||
i = (int)((Off[x] - y)/Len[x]*PALLEN + 0.5f);
|
||||
if ((i < 0) || (i >= PALLEN))
|
||||
if ((i < 0) || (i >= (int)PALLEN))
|
||||
*d = COL_BLACK;
|
||||
else
|
||||
*d = Pal[i];
|
||||
*d = Pal[i];
|
||||
d += 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,11 +180,8 @@ void MonoList()
|
||||
|
||||
// print modes
|
||||
int i;
|
||||
sMono* mono;
|
||||
for (i = 0; i < MONO_NUM; i++)
|
||||
for (i = 0; i < (int)MONO_NUM; i++)
|
||||
{
|
||||
mono = &Mono[i];
|
||||
|
||||
// prepare videomode configuration
|
||||
MonoCfg(i);
|
||||
|
||||
@@ -239,7 +236,7 @@ void MonoList()
|
||||
int vert = (int)(k/Vmode.htot/Vmode.vtot + 0.5f); // vertical frequency
|
||||
printf("%4u |", vert);
|
||||
|
||||
// system frequency
|
||||
// system frequency
|
||||
printf("%7u", Vmode.freq);
|
||||
|
||||
// current videomode
|
||||
@@ -258,7 +255,6 @@ void MonoList()
|
||||
int main()
|
||||
{
|
||||
char c;
|
||||
int i;
|
||||
|
||||
// run VGA core
|
||||
StartVgaCore();
|
||||
|
||||
@@ -104,7 +104,7 @@ void DispStatus()
|
||||
DrawImg(&Canvas, &StatusCanvas, i*BOTTOMH+2*BOTTOMH, 0, 0, 0, BOTTOMH, BOTTOMH);
|
||||
else
|
||||
DrawRect(&Canvas, i*BOTTOMH+2*BOTTOMH, 0, BOTTOMH, BOTTOMH, COL_BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
// level
|
||||
j = 0;
|
||||
@@ -119,7 +119,7 @@ void DispStatus()
|
||||
else
|
||||
DrawRect(&Canvas, WIDTH-3*BOTTOMH-i*BOTTOMH, 0, BOTTOMH, BOTTOMH, COL_BLACK);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add (and display) score
|
||||
@@ -143,7 +143,6 @@ void AddScore(int score)
|
||||
void BlinkPellets()
|
||||
{
|
||||
u8 b = Blink + 1;
|
||||
int i;
|
||||
u8* s;
|
||||
|
||||
if (b == 3)
|
||||
@@ -234,7 +233,7 @@ Bool Move()
|
||||
{
|
||||
// check distance to ghost
|
||||
ch2 = &Chars[j];
|
||||
if (((ch2->x - ch->x)*(ch2->x - ch->x) +
|
||||
if (((ch2->x - ch->x)*(ch2->x - ch->x) +
|
||||
(ch2->y - ch->y)*(ch2->y - ch->y)) < SPRITEW*SPRITEH)
|
||||
{
|
||||
// eat ghost
|
||||
@@ -310,7 +309,7 @@ Bool Move()
|
||||
}
|
||||
|
||||
// collect bonus fruit
|
||||
else if ((FruitCnt > 0) &&
|
||||
else if ((FruitCnt > 0) &&
|
||||
(((ch->x - FruitSprite.x)*(ch->x - FruitSprite.x) +
|
||||
((ch->y - FruitSprite.y)*(ch->y - FruitSprite.y))) < SPRITEW*SPRITEH))
|
||||
{
|
||||
@@ -525,7 +524,7 @@ Bool Move()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// find best next tile
|
||||
bestdist = 100*100;
|
||||
bestdir = dir;
|
||||
|
||||
@@ -199,9 +199,6 @@ void FlushChar()
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
char ch;
|
||||
|
||||
// initialize random number generator
|
||||
RandInitSeed();
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ int main()
|
||||
u32* s = &Acu[1];
|
||||
u32 n;
|
||||
Bool ok = True;
|
||||
u8 ch, ch2;
|
||||
u8 ch;
|
||||
int k = 2;
|
||||
int ii = LEN-2;
|
||||
if (ii > (TEXTSIZE-NUMBEG)/8) ii = (TEXTSIZE-NUMBEG)/8;
|
||||
|
||||
@@ -33,7 +33,7 @@ V3 BackCol((real)0.4, (real)0.6, 1); // background color in horizon
|
||||
void Trace(V3* rgb, V3 &orig, V3 &dir, int depth, Sphere* disable)
|
||||
{
|
||||
// find nearest intersection
|
||||
real t1best = TOOFAR, t2best = TOOFAR;
|
||||
real t1best = TOOFAR;
|
||||
Sphere* sbest = NULL;
|
||||
real t1, t2;
|
||||
uint i;
|
||||
@@ -48,7 +48,6 @@ void Trace(V3* rgb, V3 &orig, V3 &dir, int depth, Sphere* disable)
|
||||
if (t1 < t1best)
|
||||
{
|
||||
t1best = t1;
|
||||
t2best = t2;
|
||||
sbest = &Spheres[i];
|
||||
}
|
||||
}
|
||||
@@ -87,10 +86,8 @@ void Trace(V3* rgb, V3 &orig, V3 &dir, int depth, Sphere* disable)
|
||||
}
|
||||
|
||||
// if normal and ray direction are not opposited, we are inside sphere, then reverse normal
|
||||
bool inside = false;
|
||||
if (dir.Dot(norm) > 0)
|
||||
{
|
||||
inside = true;
|
||||
norm.Inv();
|
||||
}
|
||||
|
||||
@@ -191,7 +188,7 @@ void Render3DFast()
|
||||
if (green > 255) green = 255;
|
||||
if (green < 0) green = 0;
|
||||
green &= 0xe0;
|
||||
|
||||
|
||||
blue += (k<<1) + RandS8MinMax(-3, 4);
|
||||
if (blue > 255) blue = 255;
|
||||
if (blue < 0) blue = 0;
|
||||
@@ -295,7 +292,7 @@ void Render3D(Bool useaa)
|
||||
if (green > 255) green = 255;
|
||||
if (green < 0) green = 0;
|
||||
green &= 0xe0;
|
||||
|
||||
|
||||
blue += (k<<1) + RandS8MinMax(-6, 10);
|
||||
if (blue > 255) blue = 255;
|
||||
if (blue < 0) blue = 0;
|
||||
|
||||
@@ -43,7 +43,7 @@ void VideoInit()
|
||||
// initialize base layer 0 to tiles
|
||||
ScreenClear(pScreen);
|
||||
sStrip* t = ScreenAddStrip(pScreen, HEIGHT);
|
||||
sSegm* g = ScreenAddSegm(t, WIDTH);
|
||||
(void)ScreenAddSegm(t, WIDTH);
|
||||
|
||||
// setup layer 1 with player image
|
||||
memset(&LayerScreen[1], 0, sizeof(sLayer));
|
||||
|
||||
@@ -165,7 +165,6 @@ Bool AuthorSelect()
|
||||
|
||||
// select
|
||||
char c;
|
||||
int j;
|
||||
for (;;)
|
||||
{
|
||||
c = WaitChar();
|
||||
@@ -323,7 +322,6 @@ Bool CollSelect()
|
||||
|
||||
// select
|
||||
char c;
|
||||
int j;
|
||||
for (;;)
|
||||
{
|
||||
c = WaitChar();
|
||||
@@ -458,7 +456,6 @@ Bool LevSelect()
|
||||
|
||||
// select
|
||||
char c;
|
||||
int j;
|
||||
for (;;)
|
||||
{
|
||||
c = WaitChar();
|
||||
|
||||
@@ -807,7 +807,7 @@ void Game()
|
||||
|
||||
// check new position
|
||||
if (CheckBrick(BrickX+1, BrickY, Brick)) BrickX++;
|
||||
|
||||
|
||||
// display brick
|
||||
DispBrick(BrickX, BrickY, Brick);
|
||||
break;
|
||||
@@ -819,7 +819,7 @@ void Game()
|
||||
|
||||
// check new position
|
||||
if (CheckBrick(BrickX-1, BrickY, Brick)) BrickX--;
|
||||
|
||||
|
||||
// display brick
|
||||
DispBrick(BrickX, BrickY, Brick);
|
||||
break;
|
||||
@@ -850,7 +850,7 @@ void Game()
|
||||
case KEY_PAUSE:
|
||||
Pause(False);
|
||||
break;
|
||||
|
||||
|
||||
case 0:
|
||||
break;
|
||||
|
||||
@@ -867,7 +867,7 @@ void Game()
|
||||
// find demo move
|
||||
void FindDemo()
|
||||
{
|
||||
int i, rot;
|
||||
int rot;
|
||||
int score, newbrick; // current score
|
||||
int bestscore, bestx, besty, bestbrick; // best move
|
||||
int savex, savey, savebrick; // save state
|
||||
@@ -939,7 +939,7 @@ void PlayDemo()
|
||||
{
|
||||
// start demo moe
|
||||
Demo = True;
|
||||
|
||||
|
||||
// start new game
|
||||
NewGame();
|
||||
|
||||
@@ -1006,9 +1006,6 @@ void PlayDemo()
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
char ch;
|
||||
|
||||
// initialize random number generator
|
||||
RandInitSeed();
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ void InfoRow()
|
||||
char buf[10];
|
||||
DecUNum(buf, Score);
|
||||
InfoDispText(sizeof(ScoreHlp), buf, COL_YELLOW);
|
||||
|
||||
|
||||
// display text ENTER: PSW
|
||||
InfoDispText((TEXTMAX - 10)/2, LevelHlp, COL_RED);
|
||||
|
||||
@@ -183,7 +183,7 @@ void ClearLevel(u8 tile)
|
||||
{
|
||||
for(y = 0; y < MAPH; y++)
|
||||
Board[x + y*MAPW] = tile;
|
||||
|
||||
|
||||
sleep_ms(20);
|
||||
}
|
||||
}
|
||||
@@ -203,7 +203,7 @@ void OpenLevel()
|
||||
DrawFrame(&BoxCanvas, FDX1, FDX1, BOXW-2*FDX1, BOXH-2*FDX1, COL_WHITE);
|
||||
|
||||
// display current scene
|
||||
int x, x2;
|
||||
int x;
|
||||
char buf[10];
|
||||
int n = DecUNum(buf, Level);
|
||||
x = (BOXW - (6+n)*16)/2;
|
||||
@@ -596,7 +596,7 @@ Bool GameLoop()
|
||||
// Esc, restart
|
||||
case KEY_ESC:
|
||||
// break
|
||||
if (State != S_GO) return True;
|
||||
if (State != S_GO) return True;
|
||||
|
||||
// restart scene
|
||||
InitLevel();
|
||||
|
||||
22
src/vga.cpp
22
src/vga.cpp
@@ -296,7 +296,7 @@ u32* __not_in_flash_func(VgaBufRender)(u32* cbuf, u32* cbuf0, u8* dbuf, int y0)
|
||||
*cbuf2++ = 1;
|
||||
*cbuf2++ = (u32)dbuf2;
|
||||
*(u32*)dbuf2 = s->keycol;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// decode image
|
||||
@@ -340,7 +340,7 @@ u32* __not_in_flash_func(VgaBufRender)(u32* cbuf, u32* cbuf0, u8* dbuf, int y0)
|
||||
*cbuf2++ = 1;
|
||||
*cbuf2++ = (u32)dbuf2;
|
||||
*(u32*)dbuf2 = s->keycol;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// decode image
|
||||
@@ -590,7 +590,7 @@ void VgaPioInit()
|
||||
{
|
||||
int i;
|
||||
|
||||
// clear PIO instruction memory
|
||||
// clear PIO instruction memory
|
||||
pio_clear_instruction_memory(VGA_PIO);
|
||||
|
||||
// configure main program instructions
|
||||
@@ -599,7 +599,7 @@ void VgaPioInit()
|
||||
u16 cpp = (u16)CurVmode.cpp; // number of clocks per pixel
|
||||
ins[vga_offset_extra1] |= (cpp-2) << 8; // update waits
|
||||
ins[vga_offset_extra2] |= (cpp-2) << 8; // update waits
|
||||
|
||||
|
||||
// load main program into PIO's instruction memory
|
||||
struct pio_program prg;
|
||||
prg.instructions = ins;
|
||||
@@ -618,7 +618,7 @@ void VgaPioInit()
|
||||
if (extra < 0) extra = 0;
|
||||
ins[CurLayerProg.extra[i*2]] |= extra << 8; // update waits
|
||||
}
|
||||
|
||||
|
||||
// load layer program into PIO's instruction memory
|
||||
prg.instructions = ins;
|
||||
prg.length = CurLayerProg.length;
|
||||
@@ -644,7 +644,7 @@ void VgaPioInit()
|
||||
// get default config
|
||||
pio_sm_config cfg = pio_get_default_sm_config();
|
||||
|
||||
// map state machine's OUT and MOV pins
|
||||
// map state machine's OUT and MOV pins
|
||||
sm_config_set_out_pins(&cfg, LayerFirstPin[layer], LayerNumPin[layer]);
|
||||
|
||||
// join FIFO to send only
|
||||
@@ -655,7 +655,7 @@ void VgaPioInit()
|
||||
|
||||
// shift left, autopull, pull threshold
|
||||
sm_config_set_out_shift(&cfg, false, true, 32);
|
||||
|
||||
|
||||
// base layer 0
|
||||
if (layer == 0)
|
||||
{
|
||||
@@ -788,7 +788,7 @@ void VgaTerm()
|
||||
CtrlBufNext[i] = NULL;
|
||||
}
|
||||
|
||||
// clear PIO instruction memory
|
||||
// clear PIO instruction memory
|
||||
pio_clear_instruction_memory(VGA_PIO);
|
||||
}
|
||||
|
||||
@@ -981,14 +981,10 @@ void VgaInit(const sVmode* vmode)
|
||||
memcpy(&CurLayerMode[0], &LayerMode[LAYERMODE_BASE], sizeof(sLayerMode));
|
||||
memset(&LayerScreen[0], 0, sizeof(sLayer));
|
||||
|
||||
// save layer modes
|
||||
LayerModeInx[1] = vmode->mode[1];
|
||||
LayerModeInx[2] = vmode->mode[2];
|
||||
LayerModeInx[3] = vmode->mode[3];
|
||||
|
||||
LayerMask = B0; // mask of active layers
|
||||
for (i = 1; i < LAYERS; i++)
|
||||
{
|
||||
LayerModeInx[i] = vmode->mode[i]; // save layer modes
|
||||
memcpy(&CurLayerMode[i], &LayerMode[LayerModeInx[i]], sizeof(sLayerMode));
|
||||
if (LayerModeInx[i] != LAYERMODE_BASE) LayerMask |= (1 << i);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user