From 45a22eb3cd3eee7e65dc444ad978f77699079fda Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 31 Aug 2020 19:06:53 +0200 Subject: [PATCH] - do proper interpolation of the snorkel in RR. --- source/games/duke/src/dispatch.cpp | 4 ++-- source/games/duke/src/duke3d.h | 2 +- source/games/duke/src/game_misc.cpp | 2 +- source/games/duke/src/hudweapon_d.cpp | 2 +- source/games/duke/src/hudweapon_r.cpp | 8 +++++--- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index 2ac6eccef..c34984cf0 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -107,8 +107,8 @@ void processinput_d(int snum); void processinput_r(int snum); void displayweapon_d(int snum, double smoothratio); void displayweapon_r(int snum, double smoothratio); -void displaymasks_d(int snum); -void displaymasks_r(int snum); +void displaymasks_d(int snum, double smoothratio); +void displaymasks_r(int snum, double smoothratio); void think_d(); void think_r(); void animatesprites_d(int x, int y, int a, int smoothratio); diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 97cc38ee5..01dfbf453 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -111,7 +111,7 @@ struct Dispatcher void (*checkweapons)(struct player_struct* p); void (*processinput)(int snum); void (*displayweapon)(int snum, double smoothratio); - void (*displaymasks)(int snum); + void (*displaymasks)(int snum, double smoothratio); void (*animatesprites)(int x, int y, int a, int smoothratio); diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 9534dc89e..078a9db3b 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -271,7 +271,7 @@ void drawoverlays(double smoothratio) { fi.displayweapon(screenpeek, smoothratio); if (pp->over_shoulder_on == 0) - fi.displaymasks(screenpeek); + fi.displaymasks(screenpeek, smoothratio); } if (!isRR()) moveclouds(); diff --git a/source/games/duke/src/hudweapon_d.cpp b/source/games/duke/src/hudweapon_d.cpp index 28773c6d7..326baa6ca 100644 --- a/source/games/duke/src/hudweapon_d.cpp +++ b/source/games/duke/src/hudweapon_d.cpp @@ -188,7 +188,7 @@ int animateknuckles(int gs, int snum, double hard_landing, double look_anghalf, // //--------------------------------------------------------------------------- -void displaymasks_d(int snum) +void displaymasks_d(int snum, double) { int p; diff --git a/source/games/duke/src/hudweapon_r.cpp b/source/games/duke/src/hudweapon_r.cpp index fc0559d85..388c8a13e 100644 --- a/source/games/duke/src/hudweapon_r.cpp +++ b/source/games/duke/src/hudweapon_r.cpp @@ -64,7 +64,7 @@ inline static void rd3myospal(double x, double y, int tilenum, int shade, int or // //--------------------------------------------------------------------------- -void displaymasks_r(int snum) +void displaymasks_r(int snum, double smoothratio) { short p; @@ -76,8 +76,10 @@ void displaymasks_r(int snum) if (ps[snum].scuba_on) { int pin = 0; + // to get the proper clock value with regards to interpolation we have add a smoothratio based offset to the value. + double interpclock = ud.levelclock + (TICSPERFRAME/65536.) * smoothratio; if (!(duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) pin = RS_STRETCH; - hud_drawsprite((320 - (tilesiz[SCUBAMASK].x >> 1) - 15), (200 - (tilesiz[SCUBAMASK].y >> 1) + (calcSinTableValue(gameclock) / 1024.)), 49152, 0, SCUBAMASK, 0, p, 2 + 16 + pin); + hud_drawsprite((320 - (tilesiz[SCUBAMASK].x >> 1) - 15), (200 - (tilesiz[SCUBAMASK].y >> 1) + (calcSinTableValue(interpclock) / 1024.)), 49152, 0, SCUBAMASK, 0, p, 2 + 16 + pin); hud_drawsprite((320 - tilesiz[SCUBAMASK + 4].x), (200 - tilesiz[SCUBAMASK + 4].y), 65536, 0, SCUBAMASK + 4, 0, p, 2 + 16 + pin); hud_drawsprite(tilesiz[SCUBAMASK + 4].x, (200 - tilesiz[SCUBAMASK + 4].y), 65536, 0, SCUBAMASK + 4, 0, p, 2 + 4 + 16 + pin); hud_drawsprite(35, (-1), 65536, 0, SCUBAMASK + 3, 0, p, 2 + 16 + pin); @@ -928,4 +930,4 @@ void displayweapon_r(int snum, double smoothratio) } } -END_DUKE_NS \ No newline at end of file +END_DUKE_NS