I've been having some problems with a function I implemented. Its saying " Argument type is not compatible with formal parameter" whenever I use CheckRange. I'm stumped, I don't know what's causing it. It may have something to do with me not using pointers correctly, I don't know.
The function:
Code:
The part where it gives me an error:
Code:
The function:
Code:
void CheckRange(int x, bool* WithinScreen, bool* WithinGun)
{
if (x+225>=0 && x<=320)
{
*WithinScreen=true;
}else{
*WithinScreen=false;
}
if (x+225>=188 && x<=131)
{
*WithinGun=true;
}else{
*WithinGun=false;
}
}
The part where it gives me an error:
Code:
if (kTurn & kb_Left)
{
CheckRange(Zombie.x, Zombie.WithinScreen, Zombie.WithinGun);
if (ShowFiring)
--ShowFiring;
if (CanShoot)
--CanShoot;
if (Zombie.WithinScreen)
{
gfx_FillRectangle(Zombie.x,30,225,210);
}
if (Zombie.x>=450)
{
Zombie.x=-225;
}else{
Zombie.x+=8;
}
CheckRange(Zombie.x, Zombie.WithinScreen, Zombie.WithinGun);
if (Zombie.WithinScreen)
{
gfx_SetPalette(sprites_pal,sizeof(sprites_pal),0);
gfx_TransparentSprite(EnemySprite,Zombie.x,30);
gfx_SetPalette(xlibcsprites_pal,sizeof(xlibcsprites_pal),0);
for(i=0;i<2;i++)
{
if (Zombie.ShowBloodSplatter[i])
{
gfx_TransparentSprite(BloodSplatter,Zombie.ShowBloodSplatter[i]+Zombie.x,100);
}
}
if (Zombie.WithinGun)
{
if (ShowFiring)
{
gfx_TransparentSprite(SilencedPistolFiring,131,154);
}else{
gfx_TransparentSprite(SilencedPistol,131,174);
}
}
}
update(Zombie.x, Player.ammo);
}
if (kTurn & kb_Right)
{
CheckRange(Zombie.x, Zombie.WithinScreen, Zombie.WithinGun);
if (ShowFiring)
--ShowFiring;
if (CanShoot)
--CanShoot;
if (Zombie.WithinScreen)
{
gfx_FillRectangle(Zombie.x,30,225,210);
}
if (Zombie.x<=-225)
{
Zombie.x=450;
}else{
Zombie.x-=8;
}
CheckRange(Zombie.x, Zombie.WithinScreen, Zombie.WithinGun);
if (Zombie.WithinScreen){
gfx_SetPalette(sprites_pal,sizeof(sprites_pal),0);
gfx_TransparentSprite(EnemySprite,Zombie.x,30);
gfx_SetPalette(xlibcsprites_pal,sizeof(xlibcsprites_pal),0);
for(i=0;i<2;i++){
if (Zombie.ShowBloodSplatter[i])
{
gfx_TransparentSprite(BloodSplatter,Zombie.ShowBloodSplatter[i]+Zombie.x,100);
}
}
if (Zombie.WithinGun){
if (ShowFiring)
{
gfx_TransparentSprite(SilencedPistolFiring,131,154);
}else{
gfx_TransparentSprite(SilencedPistol,131,174);
}
}
}
update(Zombie.x, Player.ammo);
}