Created
September 26, 2010 02:55
-
-
Save zc00gii/597538 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
else if(t==PT_FUSE) | |
{ | |
// I do a parts[i].life hack here, the first half bits is for the burn life, the last half bits is for the pressure life | |
tempu1 = (uint16_t)(((unsigned int)parts[i].life) >> 8); | |
tempu2 = (uint16_t)(((unsigned int)parts[i].life) & 0x0000FFFF); | |
if(tempu1<=0) { | |
t = PT_NONE; | |
kill_part(i); | |
r = create_part(-1, x, y, PT_PLSM); | |
parts[r].temp = 273.15+500.0f; | |
parts[r].life = 50; | |
goto killed; | |
} else if (tempu1 < 40) { | |
tempu1--; | |
r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); | |
parts[r].life = 50; | |
parts[r].temp = 273.15+500.0f; | |
} | |
for(nx=-2; nx<3; nx++) | |
for(ny=-2; ny<3; ny++) | |
if(x+nx>=0 && y+ny>0 && | |
x+nx<XRES && y+ny<YRES && (nx || ny)) | |
{ | |
r = pmap[y+ny][x+nx]; | |
if((r>>8)>=NPART || !r) | |
continue; | |
temps1 = (uint16_t)(pv[ny+y][nx+x]); | |
if(temps1 > 5) { | |
t = PT_NONE; | |
kill_part(i); | |
r = (unsigned int) | |
(((nx=x+rand()%3-1) << 8) | (ny=y+rand()%3-1)); // HACK! temp x/y | |
r = create_part(-1, (unsigned int)(r >> 8), (unsigned int)(r & 0x0000FFFF), PT_FSEP); | |
parts[r].life = 50; | |
parts[r].temp = 273.15+500.0f; | |
} | |
if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+200.0f)) && 1>(rand()%15)) | |
{ | |
if(tempu1>40) { | |
tempu1 = 39; | |
} | |
} | |
} | |
parts[i].life = (uint32_t)(((uint32_t)tempu1 << 8) | (uint32_t)tempu1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment