|
|
|
@ -1,4 +1,5 @@
@@ -1,4 +1,5 @@
|
|
|
|
|
#include "game.h" |
|
|
|
|
#include <SDL2/SDL_scancode.h> |
|
|
|
|
#include <SDL2/SDL_timer.h> |
|
|
|
|
#include <SDL2/SDL_ttf.h> |
|
|
|
|
#include <SDL2/SDL_mutex.h> |
|
|
|
@ -111,8 +112,8 @@ FloorPoly* generate_floor_simple(int num_polys, bool extend_down, int st_height)
@@ -111,8 +112,8 @@ FloorPoly* generate_floor_simple(int num_polys, bool extend_down, int st_height)
|
|
|
|
|
last.y = st_height; |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < num_polys; i++) { |
|
|
|
|
double run = (rand() % 900); |
|
|
|
|
double rise = (rand() % 100) - (rand() % 100); |
|
|
|
|
double run = (get_rand(0) % 900); |
|
|
|
|
double rise = (get_rand(0) % 100) - (get_rand(0) % 100); |
|
|
|
|
next.x = last.x + run; |
|
|
|
|
next.y = last.y + rise; |
|
|
|
|
|
|
|
|
@ -578,7 +579,7 @@ void next_level() {
@@ -578,7 +579,7 @@ void next_level() {
|
|
|
|
|
destroy_physics_collection(&world.uniques_index[ROOM_W]->room->floor); |
|
|
|
|
destroy_environment(&world.uniques_index[ROOM_W]->room->env); |
|
|
|
|
|
|
|
|
|
level++; |
|
|
|
|
level+= 31;; |
|
|
|
|
get_floor_ceiling(); |
|
|
|
|
|
|
|
|
|
v = world.uniques_index[ROOM_W]->room->ceil.items[2]->collision_poly[0]; |
|
|
|
@ -1374,7 +1375,6 @@ void add_to_world(world_thing thing) {
@@ -1374,7 +1375,6 @@ void add_to_world(world_thing thing) {
|
|
|
|
|
world.uniques_index[thing.kind] = ref; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
printf("Added to world: %d\n", thing.kind); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Send a projectile from body in direction dir (in degrees) with the force of
|
|
|
|
@ -1434,7 +1434,7 @@ void startgame(SDL_Renderer * ren) {
@@ -1434,7 +1434,7 @@ void startgame(SDL_Renderer * ren) {
|
|
|
|
|
|
|
|
|
|
debug_ren = ren; |
|
|
|
|
|
|
|
|
|
level = 113; |
|
|
|
|
level = 31; |
|
|
|
|
|
|
|
|
|
world = create_world(); |
|
|
|
|
|
|
|
|
@ -1505,6 +1505,9 @@ void handle_input_event(SDL_Event event) {
@@ -1505,6 +1505,9 @@ void handle_input_event(SDL_Event event) {
|
|
|
|
|
} if (sc == input_map.player_pull_rope) { |
|
|
|
|
stop_pull_rope(); |
|
|
|
|
}
|
|
|
|
|
if (event.key.keysym.scancode == SDL_SCANCODE_F10) { |
|
|
|
|
next_level(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case SDL_MOUSEBUTTONDOWN: |
|
|
|
|
add_rope(event.button.x, event.button.y); |
|
|
|
@ -1527,6 +1530,24 @@ void handle_input_event(SDL_Event event) {
@@ -1527,6 +1530,24 @@ void handle_input_event(SDL_Event event) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int get_rand(int seed) { |
|
|
|
|
const unsigned c = 11; |
|
|
|
|
const unsigned m = (1 << 31) - 1; |
|
|
|
|
const unsigned initial_n = 1; |
|
|
|
|
const unsigned a = 48271; |
|
|
|
|
|
|
|
|
|
static unsigned n = initial_n; |
|
|
|
|
|
|
|
|
|
if (seed != 0) { |
|
|
|
|
n = seed ; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
n = (a * n + c) % m; |
|
|
|
|
return n; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void step(int interval) {
|
|
|
|
|
|
|
|
|
|
if (player.physics->position.x > world.uniques_index[ROOM_W]->room |
|
|
|
@ -1538,3 +1559,6 @@ void step(int interval) {
@@ -1538,3 +1559,6 @@ void step(int interval) {
|
|
|
|
|
|
|
|
|
|
advance_things(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|