mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-13 03:44:05 +02:00
Fix IRON rust
Fix some randoms
This commit is contained in:
@@ -56,9 +56,9 @@ int Element_GOLD::update(UPDATE_FUNC_ARGS)
|
|||||||
//Find nearby rusted iron (BMTL with tmp 1+)
|
//Find nearby rusted iron (BMTL with tmp 1+)
|
||||||
for(int j = 0; j < 8; j++){
|
for(int j = 0; j < 8; j++){
|
||||||
rndstore = rand();
|
rndstore = rand();
|
||||||
rx = ((rndstore & 0xF) % 9)-4;
|
rx = (rndstore % 9)-4;
|
||||||
rndstore >>= 4;
|
rndstore >>= 4;
|
||||||
ry = ((rndstore & 0xF) % 9)-4;
|
ry = (rndstore % 9)-4;
|
||||||
if ((!rx != !ry) && BOUNDS_CHECK) {
|
if ((!rx != !ry) && BOUNDS_CHECK) {
|
||||||
r = pmap[y+ry][x+rx];
|
r = pmap[y+ry][x+rx];
|
||||||
if(!r) continue;
|
if(!r) continue;
|
||||||
@@ -101,11 +101,11 @@ int Element_GOLD::update(UPDATE_FUNC_ARGS)
|
|||||||
int Element_GOLD::graphics(GRAPHICS_FUNC_ARGS)
|
int Element_GOLD::graphics(GRAPHICS_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
int rndstore = rand();
|
int rndstore = rand();
|
||||||
*colr += (rndstore & 0xF) % 10 - 5;
|
*colr += (rndstore % 10) - 5;
|
||||||
rndstore >>= 4;
|
rndstore >>= 4;
|
||||||
*colg += (rndstore & 0xF) % 10 - 5;
|
*colg += (rndstore % 10)- 5;
|
||||||
rndstore >>= 4;
|
rndstore >>= 4;
|
||||||
*colb += (rndstore & 0xF) % 10 - 5;
|
*colb += (rndstore % 10) - 5;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,7 +50,7 @@ Element_IRON::Element_IRON()
|
|||||||
int Element_IRON::update(UPDATE_FUNC_ARGS)
|
int Element_IRON::update(UPDATE_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
int r, rx, ry, rt;
|
int r, rx, ry, rt;
|
||||||
if (!parts[i].life)
|
if (parts[i].life)
|
||||||
return 0;
|
return 0;
|
||||||
for (rx=-1; rx<2; rx++)
|
for (rx=-1; rx<2; rx++)
|
||||||
for (ry=-1; ry<2; ry++)
|
for (ry=-1; ry<2; ry++)
|
||||||
|
@@ -127,7 +127,7 @@ int Element_VIRS::update(UPDATE_FUNC_ARGS)
|
|||||||
parts[r>>8].pavg[0] = 0;
|
parts[r>>8].pavg[0] = 0;
|
||||||
if (parts[i].pavg[1])
|
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;
|
rndstore >>= 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user