|
|
|
@ -1,4 +1,5 @@
@@ -1,4 +1,5 @@
|
|
|
|
|
#include "game.h" |
|
|
|
|
#include <SDL2/SDL_ttf.h> |
|
|
|
|
|
|
|
|
|
#define FLOOR_THICKNESS 200 |
|
|
|
|
#define MAX_ROPE_GRAB_LEN 80000 |
|
|
|
@ -11,6 +12,7 @@ player_st *glob_player;
@@ -11,6 +12,7 @@ player_st *glob_player;
|
|
|
|
|
SDL_Renderer *debug_ren; |
|
|
|
|
|
|
|
|
|
int level; |
|
|
|
|
long level_time; |
|
|
|
|
|
|
|
|
|
/* array of all the things in the world and their kinds */ |
|
|
|
|
//world_thing *world;
|
|
|
|
@ -47,6 +49,18 @@ void default_update_collision_poly(Body *body) {
@@ -47,6 +49,18 @@ void default_update_collision_poly(Body *body) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void level_timer_update(bool reset) { |
|
|
|
|
static int start_point = 0; |
|
|
|
|
long now = SDL_GetTicks(); |
|
|
|
|
if (reset) { |
|
|
|
|
level_time = 0; |
|
|
|
|
start_point = now; |
|
|
|
|
} else { |
|
|
|
|
level_time = now - start_point; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// collision poly size must be 2x shape_size + 1
|
|
|
|
|
void cast_update_collision_poly(Body *body) { |
|
|
|
|
for (int i=0; i < body->collision_shape_size; i++) { |
|
|
|
@ -762,13 +776,14 @@ void ratcheted_winch_motor_update(Motor* motor) {
@@ -762,13 +776,14 @@ void ratcheted_winch_motor_update(Motor* motor) {
|
|
|
|
|
motor->stop = true; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
winch_motor_update(motor); |
|
|
|
|
|
|
|
|
|
Vect st; |
|
|
|
|
st.x = body->position.x - body->strings[0].end_point.x; |
|
|
|
|
st.y = body->position.y - body->strings[0].end_point.y; |
|
|
|
|
|
|
|
|
|
body->strings[0].max_length = vect_mag(st); |
|
|
|
|
if (body->strings[0].max_length > vect_mag(st)) |
|
|
|
|
body->strings[0].max_length = vect_mag(st); |
|
|
|
|
winch_motor_update(motor); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1290,6 +1305,7 @@ void get_projectile(Projectile** proj) {
@@ -1290,6 +1305,7 @@ void get_projectile(Projectile** proj) {
|
|
|
|
|
void advance_things(void) { |
|
|
|
|
int numcols; |
|
|
|
|
Vect translation; |
|
|
|
|
level_timer_update(false); |
|
|
|
|
for (int i = 0; i < world.items.size; i++) { |
|
|
|
|
switch (world.get(i).kind) { |
|
|
|
|
case PLAYER_W : |
|
|
|
@ -1408,7 +1424,7 @@ void startgame(SDL_Renderer * ren) {
@@ -1408,7 +1424,7 @@ void startgame(SDL_Renderer * ren) {
|
|
|
|
|
|
|
|
|
|
debug_ren = ren; |
|
|
|
|
|
|
|
|
|
level = 0; |
|
|
|
|
level = 113; |
|
|
|
|
|
|
|
|
|
world = create_world(); |
|
|
|
|
|
|
|
|
@ -1431,6 +1447,7 @@ void startgame(SDL_Renderer * ren) {
@@ -1431,6 +1447,7 @@ void startgame(SDL_Renderer * ren) {
|
|
|
|
|
viewport_pos.x = 700; |
|
|
|
|
viewport_pos.y = 0; |
|
|
|
|
|
|
|
|
|
level_timer_update(true); |
|
|
|
|
//get_room();
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1505,6 +1522,7 @@ void step(int interval) {
@@ -1505,6 +1522,7 @@ void step(int interval) {
|
|
|
|
|
if (player.physics->position.x > world.uniques_index[ROOM_W]->room |
|
|
|
|
->floor.items[world.uniques_index[ROOM_W]->room->floor.numItems - 1]->position.x) { |
|
|
|
|
next_level(); |
|
|
|
|
level_timer_update(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
advance_things(); |
|
|
|
|