diff --git a/bin/back b/bin/back index f8ccef3..48616c9 100755 Binary files a/bin/back and b/bin/back differ diff --git a/obj/entities.o b/obj/entities.o index e4805c1..aac3501 100644 Binary files a/obj/entities.o and b/obj/entities.o differ diff --git a/obj/move.o b/obj/move.o index 4ee80bd..da3dab1 100644 Binary files a/obj/move.o and b/obj/move.o differ diff --git a/src/entities.c b/src/entities.c index dd1bc75..cde08bc 100644 --- a/src/entities.c +++ b/src/entities.c @@ -111,7 +111,7 @@ void translatePlayer(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret) { //printf("(%lf %lf) (%lf %lf) (%lf %lf)\n", vx, camvx, vy, camvy, vz, camvz); if(true) { double oldvx = camvx; - camvx += vx/dtime; + camvx = vx/dtime; camx -= oldvx*dtime; camx += camvx*dtime; noResetSpeed = true; @@ -121,15 +121,15 @@ void translatePlayer(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret) { camvy += vy/dtime; camy -= oldvy*dtime; camy += camvy*dtime; - noResetSpeed = true; } if(true) { double oldvz = camvz; - camvz += vz/dtime; + camvz = vz/dtime; camz -= oldvz*dtime; camz += camvz*dtime; noResetSpeed = true; } + noFriction = true; } void go_to_player(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, entity* ent, cube_0* ret) { diff --git a/src/move.c b/src/move.c index 9acdc60..56e6747 100644 --- a/src/move.c +++ b/src/move.c @@ -25,6 +25,7 @@ double min_dist = 0.7; double friction = 0.8; double gravity_factor = 9.8; bool noResetSpeed = false; +bool noFriction = false; // ---------------------------------------------------------------------------------------------------- // int player_hp; @@ -123,34 +124,43 @@ bool is_colliding(float dtime) { void movePlayerG(double dtime) { camx += camvx*dtime; noResetSpeed = false; + noFriction = false; if(is_colliding(dtime)) { camx -= camvx*dtime; if(!noResetSpeed) { camvx = 0.0; } } - camvx = camvx*(1-dtime*friction); + if(!noFriction) { + camvx = camvx*(1-dtime*friction); + } camvy -= gravity_factor*dtime; camy += camvy*dtime; noResetSpeed = false; + noFriction = false; if(is_colliding(dtime)) { camy -= camvy*dtime; if(!noResetSpeed) { camvy = 0.0; } } - camvy = camvy*(1-dtime*friction); + if(!noFriction) { + camvy = camvy*(1-dtime*friction); + } camz += camvz*dtime; noResetSpeed = false; + noFriction = false; if(is_colliding(dtime)) { camz -= camvz*dtime; if(!noResetSpeed) { camvz = 0.0; } } - camvz = camvz*(1-dtime*friction); + if(!noFriction) { + camvz = camvz*(1-dtime*friction); + } } void teleport_on_edge() { diff --git a/src/structure.h b/src/structure.h index 873389f..4dcec48 100644 --- a/src/structure.h +++ b/src/structure.h @@ -148,5 +148,6 @@ extern float rectDefault[18]; extern int triCount; extern bool noResetSpeed; +extern bool noFriction; #endif \ No newline at end of file