|
|
@ -241,9 +241,10 @@ FloorPoly* generate_floor_simple(int num_polys, bool extend_down, int st_height) |
|
|
|
last.x = 10; |
|
|
|
last.x = 10; |
|
|
|
last.y = st_height; |
|
|
|
last.y = st_height; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int n = 1; |
|
|
|
for (int i = 0; i < num_polys; i++) { |
|
|
|
for (int i = 0; i < num_polys; i++) { |
|
|
|
double run = (get_rand(0) % 900); |
|
|
|
double run = (get_rand(&n) % 900); |
|
|
|
double rise = (get_rand(0) % 100) - (get_rand(0) % 100); |
|
|
|
double rise = (get_rand(&n) % 100) - (get_rand(&n) % 100); |
|
|
|
next.x = last.x + run; |
|
|
|
next.x = last.x + run; |
|
|
|
next.y = last.y + rise; |
|
|
|
next.y = last.y + rise; |
|
|
|
|
|
|
|
|
|
|
@ -1663,7 +1664,8 @@ void handle_input_event(SDL_Event event) { |
|
|
|
} if (sc == input_map.mute) { |
|
|
|
} if (sc == input_map.mute) { |
|
|
|
mute = !mute; |
|
|
|
mute = !mute; |
|
|
|
} if (sc == input_map.pause) { |
|
|
|
} if (sc == input_map.pause) { |
|
|
|
game_paused = !game_paused; |
|
|
|
if (in_game)
|
|
|
|
|
|
|
|
game_paused = !game_paused; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case SDL_KEYUP: |
|
|
|
case SDL_KEYUP: |
|
|
@ -1709,19 +1711,15 @@ void handle_input_event(SDL_Event event) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int get_rand(int seed) { |
|
|
|
/* temporary storage variable *n should be initialised to 1 */ |
|
|
|
|
|
|
|
int get_rand(int *n) { |
|
|
|
const unsigned c = 11; |
|
|
|
const unsigned c = 11; |
|
|
|
const unsigned m = (1 << 31) - 1; |
|
|
|
const unsigned m = (1 << 31) - 1; |
|
|
|
const unsigned initial_n = 1; |
|
|
|
const unsigned initial_n = 1; |
|
|
|
const unsigned a = 48271; |
|
|
|
const unsigned a = 48271; |
|
|
|
static unsigned n = initial_n; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (seed != 0) { |
|
|
|
*n = (a * *n + c) % m; |
|
|
|
n = seed ; |
|
|
|
return *n; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
n = (a * n + c) % m; |
|
|
|
|
|
|
|
return n; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|