Skip to content

Instantly share code, notes, and snippets.

@zc00gii
Created September 26, 2010 04:25
Show Gist options
  • Save zc00gii/597601 to your computer and use it in GitHub Desktop.
Save zc00gii/597601 to your computer and use it in GitHub Desktop.
int try_move(int i, int x, int y, int nx, int ny)
{
unsigned r;
if(nx<0 || ny<0 || nx>=XRES || ny>=YRES)
return 0;
if(x==nx && y==ny)
return 1;
r = pmap[ny][nx];
if(r && (r>>8)<NPART)
r = (r&~0xFF) | parts[r>>8].type;
if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5)))
{
return 1;
}
if((r&0xFF)==PT_VOID)
{
parts[i].type=PT_NONE;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment