fixed mines having seizures when moving

This commit is contained in:
Alexandre 2025-01-23 18:04:34 +01:00
parent e265292843
commit 6c8b04de69
3 changed files with 6 additions and 5 deletions

BIN
bin/back

Binary file not shown.

Binary file not shown.

View File

@ -80,12 +80,13 @@ void detectHit(float dtime, int* hp, int* dmg, cube_0* ret) {
} }
void go_to_player(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, cube_0* ret) { void go_to_player(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, cube_0* ret) {
double dx = (x+w/2 - camx) ; double dx = (x+w/2 - camx);
double dy = (y+h/2 - camy) ; double dy = (y+h/2 - camy);
double dz = (z+d/2 - camz); double dz = (z+d/2 - camz);
dx = 10.0*dx/absf(dx); double total = sqrt(dx*dx + dy*dy + dz*dz) ;
dy = 10.0*dy/absf(dy); dx = 7.0*dx/total;
dz = 10.0*dz/absf(dz); dy = 7.0*dy/total;
dz = 7.0*dz/total;
ret->x -=12.0*dtime*dx ; ret->x -=12.0*dtime*dx ;
if(is_colliding_with_map(*ret) || is_colliding_with_tp(*ret)) { if(is_colliding_with_map(*ret) || is_colliding_with_tp(*ret)) {
ret->x +=12.0*dtime*dx ; ret->x +=12.0*dtime*dx ;