Fix IRON rust

Fix some randoms
This commit is contained in:
cracker64 2014-12-06 16:23:45 -05:00
parent a115e78952
commit 6410171bd5
3 changed files with 7 additions and 7 deletions

View File

@ -56,9 +56,9 @@ int Element_GOLD::update(UPDATE_FUNC_ARGS)
//Find nearby rusted iron (BMTL with tmp 1+)
for(int j = 0; j < 8; j++){
rndstore = rand();
rx = ((rndstore & 0xF) % 9)-4;
rx = (rndstore % 9)-4;
rndstore >>= 4;
ry = ((rndstore & 0xF) % 9)-4;
ry = (rndstore % 9)-4;
if ((!rx != !ry) && BOUNDS_CHECK) {
r = pmap[y+ry][x+rx];
if(!r) continue;
@ -101,11 +101,11 @@ int Element_GOLD::update(UPDATE_FUNC_ARGS)
int Element_GOLD::graphics(GRAPHICS_FUNC_ARGS)
{
int rndstore = rand();
*colr += (rndstore & 0xF) % 10 - 5;
*colr += (rndstore % 10) - 5;
rndstore >>= 4;
*colg += (rndstore & 0xF) % 10 - 5;
*colg += (rndstore % 10)- 5;
rndstore >>= 4;
*colb += (rndstore & 0xF) % 10 - 5;
*colb += (rndstore % 10) - 5;
return 0;
}

View File

@ -50,7 +50,7 @@ Element_IRON::Element_IRON()
int Element_IRON::update(UPDATE_FUNC_ARGS)
{
int r, rx, ry, rt;
if (!parts[i].life)
if (parts[i].life)
return 0;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)

View File

@ -127,7 +127,7 @@ int Element_VIRS::update(UPDATE_FUNC_ARGS)
parts[r>>8].pavg[0] = 0;
if (parts[i].pavg[1])
{
parts[r>>8].pavg[1] = parts[i].pavg[1] + ((rndstore & 0x3) % 3 ? 1 : 0);
parts[r>>8].pavg[1] = parts[i].pavg[1] + ((rndstore % 3) ? 1 : 0);
rndstore >>= 2;
}
else