#define SPRING_ROLL /* spring rolling off round things continues to roll */
-#define RANDOM (random_em = random_em << 31 | random_em >> 1)
+#define RANDOM_RAW (seed = seed << 31 | seed >> 1)
+#define RANDOM(x) (RANDOM_RAW & (x - 1))
-static unsigned int random_em;
+static unsigned int seed;
static int score;
static void set_nearest_player_xy(int x, int y, int *dx, int *dy)
Cave[y+1][x+1] != Xblank)
goto android_move;
- switch (RANDOM & 7)
+ switch (RANDOM(8))
{
/* randomly find an object to clone */
Next[y][x] = temp; /* the item we chose to clone */
play_element_sound(x, y, SOUND_android_clone, temp);
- switch (RANDOM & 7)
+ switch (RANDOM(8))
{
/* randomly find a direction to move */
Next[y][x] = Xblank; /* assume we will move */
temp = ((x < dx) + 1 - (x > dx)) + ((y < dy) + 1 - (y > dy)) * 3;
- if (RANDOM & 1)
+ if (RANDOM(2))
{
switch (temp)
{
return;
default:
- Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w;
+ Next[y][x] = RANDOM(2) ? Xeater_e : Xeater_w;
play_element_sound(x, y, SOUND_eater, Xeater_n);
return;
}
return;
default:
- Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s;
+ Next[y][x] = RANDOM(2) ? Xeater_n : Xeater_s;
play_element_sound(x, y, SOUND_eater, Xeater_e);
return;
}
return;
default:
- Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w;
+ Next[y][x] = RANDOM(2) ? Xeater_e : Xeater_w;
play_element_sound(x, y, SOUND_eater, Xeater_s);
return;
}
return;
default:
- Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s;
+ Next[y][x] = RANDOM(2) ? Xeater_n : Xeater_s;
play_element_sound(x, y, SOUND_eater, Xeater_w);
return;
}
set_nearest_player_xy(x, y, &dx, &dy);
}
- if (RANDOM & 1)
+ if (RANDOM(2))
{
if (y > dy)
{
case Xroundwall_2:
case Xroundwall_3:
case Xroundwall_4:
- if (RANDOM & 1)
+ if (RANDOM(2))
{
if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
{
default:
if (++lev.shine_cnt > 50)
{
- lev.shine_cnt = RANDOM & 7;
+ lev.shine_cnt = RANDOM(8);
Cave[y][x] = Xemerald_shine;
}
case Xroundwall_2:
case Xroundwall_3:
case Xroundwall_4:
- if (RANDOM & 1)
+ if (RANDOM(2))
{
if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
{
default:
if (++lev.shine_cnt > 50)
{
- lev.shine_cnt = RANDOM & 7;
+ lev.shine_cnt = RANDOM(8);
Cave[y][x] = Xdiamond_shine;
}
case Xroundwall_2:
case Xroundwall_3:
case Xroundwall_4:
- if (RANDOM & 1)
+ if (RANDOM(2))
{
if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
{
return;
case Xspring:
- if (RANDOM & 1)
+ if (RANDOM(2))
{
switch (Cave[y+1][x+1])
{
case Xroundwall_2:
case Xroundwall_3:
case Xroundwall_4:
- if (RANDOM & 1)
+ if (RANDOM(2))
{
if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
{
case Xroundwall_2:
case Xroundwall_3:
case Xroundwall_4:
- if (RANDOM & 1)
+ if (RANDOM(2))
{
if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
{
case Xroundwall_2:
case Xroundwall_3:
case Xroundwall_4:
- if (RANDOM & 1)
+ if (RANDOM(2))
{
if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
{
if (lev.ball_random)
{
- switch (RANDOM & 7)
+ switch (RANDOM(8))
{
case 0:
if (lev.ball_array[lev.ball_pos][0] != Xblank &&
return;
default:
- switch (RANDOM & 7)
+ switch (RANDOM(8))
{
case 0:
temp = Xamoeba_1;
if (lev.required > 0)
return;
- int temp = RANDOM & 63;
+ int temp = RANDOM(64);
if (temp < 21)
{
short *cave_cache = Cave[y]; /* might be a win */
int element;
- random_em = RandomEM;
+ seed = RandomEM;
score = 0;
loop:
else
game_em.game_over = TRUE;
- RandomEM = random_em;
+ RandomEM = seed;
{
void *temp = Cave;