From 39a6ab6f0e934d0b72f8903fd5555e64e7cfff08 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Jul 2020 23:44:07 +0200 Subject: [PATCH] - input update - safety commit --- source/games/duke/src/game_misc.cpp | 2 +- source/games/duke/src/gameexec.cpp | 2 +- source/games/duke/src/hudweapon_d.cpp | 216 +++++++++---------- source/games/duke/src/hudweapon_r.cpp | 96 ++++----- source/games/duke/src/player.cpp | 10 +- source/games/duke/src/player.h | 2 + source/games/duke/src/player_d.cpp | 24 +-- source/games/duke/src/player_r.cpp | 36 ++-- source/games/duke/src/premap.cpp | 6 +- source/games/duke/src/render.cpp | 10 +- source/games/duke/src/types.h | 18 +- source/games/duke/src/zz_player.cpp | 293 +++++++++++++++++++------- 12 files changed, 432 insertions(+), 283 deletions(-) diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index e24c7e0de..bed839da2 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -357,7 +357,7 @@ void displayrest(int smoothratio) double crosshair_scale = cl_crosshairscale * .001; if (isRR()) crosshair_scale *= .5; - DrawTexture(twod, tileGetTexture(a), 160 - (ps[myconnectindex].look_ang >> 1), 100, + DrawTexture(twod, tileGetTexture(a), 160 - (ps[myconnectindex].getlookang() >> 1), 100, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, crosshair_scale, DTA_ScaleY, crosshair_scale, DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y, DTA_ViewportWidth, windowxy2.x - windowxy1.x, DTA_ViewportY, windowxy2.y - windowxy1.y, TAG_DONE); } diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index ecabacb35..387299fd1 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1000,7 +1000,7 @@ int parse(void) ps[g_p].weapreccnt = 0; ps[g_p].ftq = 0; ps[g_p].posxv = ps[g_p].posyv = 0; - if (!isRR()) ps[g_p].rotscrnang = 0; + if (!isRR()) ps[g_p].setrotscrnang(0); ps[g_p].falling_counter = 0; diff --git a/source/games/duke/src/hudweapon_d.cpp b/source/games/duke/src/hudweapon_d.cpp index ef2aa6825..9da96cb25 100644 --- a/source/games/duke/src/hudweapon_d.cpp +++ b/source/games/duke/src/hudweapon_d.cpp @@ -94,7 +94,7 @@ int animatefist(int gs, int snum) if (fisti > 32) fisti = 32; if (fisti <= 0) return 0; - looking_arc = abs(ps[snum].look_ang) / 9; + looking_arc = abs(ps[snum].getlookang()) / 9; fistzoom = 65536L - (sintable[(512 + (fisti << 6)) & 2047] << 2); if (fistzoom > 90612L) @@ -129,7 +129,7 @@ int animateknee(int gs, int snum) if (ps[snum].knee_incs > 11 || ps[snum].knee_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0; - looking_arc = knee_y[ps[snum].knee_incs] + abs(ps[snum].look_ang) / 9; + looking_arc = knee_y[ps[snum].knee_incs] + abs(ps[snum].getlookang()) / 9; looking_arc -= (ps[snum].hard_landing << 3); @@ -142,7 +142,7 @@ int animateknee(int gs, int snum) pal = ps[snum].palookup; } - hud_drawpal(105 + (getavel(snum) >> 4) - (ps[snum].look_ang >> 1) + (knee_y[ps[snum].knee_incs] >> 2), looking_arc + 280 - ((ps[snum].gethoriz() - ps[snum].gethorizof()) >> 4), KNEE, gs, 4, pal); + hud_drawpal(105 + (getavel(snum) >> 4) - (ps[snum].getlookang() >> 1) + (knee_y[ps[snum].knee_incs] >> 2), looking_arc + 280 - ((ps[snum].gethoriz() - ps[snum].gethorizof()) >> 4), KNEE, gs, 4, pal); return 1; } @@ -162,7 +162,7 @@ int animateknuckles(int gs, int snum) if (ps[snum].knuckle_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0; - looking_arc = abs(ps[snum].look_ang) / 9; + looking_arc = abs(ps[snum].getlookang()) / 9; looking_arc -= (ps[snum].hard_landing << 3); @@ -172,7 +172,7 @@ int animateknuckles(int gs, int snum) pal = sector[ps[snum].cursectnum].floorpal; auto pic = isWorldTour() ? CRACKKNUCKLESWIDE : CRACKKNUCKLES; - hud_drawpal(160 + (getavel(snum) >> 4) - (ps[snum].look_ang >> 1), looking_arc + 180 - ((ps[snum].gethoriz() - ps[snum].gethorizof()) >> 4), pic + knuckle_frames[ps[snum].knuckle_incs >> 1], gs, 4, pal); + hud_drawpal(160 + (getavel(snum) >> 4) - (ps[snum].getlookang() >> 1), looking_arc + 180 - ((ps[snum].gethoriz() - ps[snum].gethorizof()) >> 4), pic + knuckle_frames[ps[snum].knuckle_incs >> 1], gs, 4, pal); return 1; } @@ -221,7 +221,7 @@ static int animatetip(int gs, int snum) if (ps[snum].tipincs == 0) return 0; - looking_arc = abs(ps[snum].look_ang) / 9; + looking_arc = abs(ps[snum].getlookang()) / 9; looking_arc -= (ps[snum].hard_landing << 3); if (sprite[ps[snum].i].pal == 1) @@ -234,7 +234,7 @@ static int animatetip(int gs, int snum) else p = wall[ps[snum].access_wallnum].pal; */ - hud_drawpal(170 + (getavel(snum) >> 4) - (ps[snum].look_ang >> 1), + hud_drawpal(170 + (getavel(snum) >> 4) - (ps[snum].getlookang() >> 1), (tip_y[ps[snum].tipincs] >> 1) + looking_arc + 240 - ((ps[snum].gethoriz() - ps[snum].gethorizof()) >> 4), TIP + ((26 - ps[snum].tipincs) >> 4), gs, 0, p); return 1; @@ -254,7 +254,7 @@ int animateaccess(int gs,int snum) if(ps[snum].access_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0; - looking_arc = access_y[ps[snum].access_incs] + abs(ps[snum].look_ang)/9; + looking_arc = access_y[ps[snum].access_incs] + abs(ps[snum].getlookang())/9; looking_arc -= (ps[snum].hard_landing<<3); if(ps[snum].access_spritenum >= 0) @@ -264,9 +264,9 @@ int animateaccess(int gs,int snum) // p = wall[ps[snum].access_wallnum].pal; if((ps[snum].access_incs-3) > 0 && (ps[snum].access_incs-3)>>3) - hud_drawpal(170+(getavel(snum)>>4)-(ps[snum].look_ang>>1)+(access_y[ps[snum].access_incs]>>2),looking_arc+266-((ps[snum].gethoriz()-ps[snum].gethorizof())>>4),HANDHOLDINGLASER+(ps[snum].access_incs>>3),gs,0,p); + hud_drawpal(170+(getavel(snum)>>4)-(ps[snum].getlookang()>>1)+(access_y[ps[snum].access_incs]>>2),looking_arc+266-((ps[snum].gethoriz()-ps[snum].gethorizof())>>4),HANDHOLDINGLASER+(ps[snum].access_incs>>3),gs,0,p); else - hud_drawpal(170+(getavel(snum)>>4)-(ps[snum].look_ang>>1)+(access_y[ps[snum].access_incs]>>2),looking_arc+266-((ps[snum].gethoriz()-ps[snum].gethorizof())>>4),HANDHOLDINGACCESS,gs,4,p); + hud_drawpal(170+(getavel(snum)>>4)-(ps[snum].getlookang()>>1)+(access_y[ps[snum].access_incs]>>2),looking_arc+266-((ps[snum].gethoriz()-ps[snum].gethorizof())>>4),HANDHOLDINGACCESS,gs,4,p); return 1; } @@ -291,7 +291,7 @@ void displayweapon_d(int snum) o = 0; - looking_arc = abs(p->look_ang)/9; + looking_arc = abs(p->getlookang())/9; gs = sprite[p->i].shade; if(gs > 24) gs = 24; @@ -348,9 +348,9 @@ void displayweapon_d(int snum) if (j < 5 || j > 9) - hud_drawpal(weapon_xoffset + 80 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 80 - (p->getlookang() >> 1), looking_arc + 250 - gun_pos, KNEE, gs, o | 4, pal); - else hud_drawpal(weapon_xoffset + 160 - 16 - (p->look_ang >> 1), + else hud_drawpal(weapon_xoffset + 160 - 16 - (p->getlookang() >> 1), looking_arc + 214 - gun_pos, KNEE + 1, gs, o | 4, pal); } @@ -366,12 +366,12 @@ void displayweapon_d(int snum) } cw = weapon_xoffset; weapon_xoffset += sintable[(fistsign) & 2047] >> 10; - hud_draw(weapon_xoffset + 250 - (p->look_ang >> 1), + hud_draw(weapon_xoffset + 250 - (p->getlookang() >> 1), looking_arc + 258 - (abs(sintable[(fistsign) & 2047] >> 8)), FIST, gs, o); weapon_xoffset = cw; weapon_xoffset -= sintable[(fistsign) & 2047] >> 10; - hud_draw(weapon_xoffset + 40 - (p->look_ang >> 1), + hud_draw(weapon_xoffset + 40 - (p->getlookang() >> 1), looking_arc + 200 + (abs(sintable[(fistsign) & 2047] >> 8)), FIST, gs, o | 4); } @@ -399,12 +399,12 @@ void displayweapon_d(int snum) if (p->kickback_pic < 5 || p->kickback_pic > 9) { - hud_drawpal(weapon_xoffset + 220 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 220 - (p->getlookang() >> 1), looking_arc + 250 - gun_pos, KNEE, gs, o, pal); } else { - hud_drawpal(weapon_xoffset + 160 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 160 - (p->getlookang() >> 1), looking_arc + 214 - gun_pos, KNEE + 1, gs, o, pal); } } @@ -430,13 +430,13 @@ void displayweapon_d(int snum) if (p->kickback_pic > 6) looking_arc += (p->kickback_pic << 3); else if (p->kickback_pic < 4) - hud_drawpal(weapon_xoffset + 142 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 142 - (p->getlookang() >> 1), looking_arc + 234 - gun_pos, HANDHOLDINGLASER + 3, gs, o, pal); - hud_drawpal(weapon_xoffset + 130 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 130 - (p->getlookang() >> 1), looking_arc + 249 - gun_pos, HANDHOLDINGLASER + (p->kickback_pic >> 2), gs, o, pal); - hud_drawpal(weapon_xoffset + 152 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 152 - (p->getlookang() >> 1), looking_arc + 249 - gun_pos, HANDHOLDINGLASER + (p->kickback_pic >> 2), gs, o | 4, pal); }; @@ -520,12 +520,12 @@ void displayweapon_d(int snum) if (*kb == 0) { - hud_drawpal(weapon_xoffset + 146 - (p->look_ang >> 1), looking_arc + 202 - gun_pos, + hud_drawpal(weapon_xoffset + 146 - (p->getlookang() >> 1), looking_arc + 202 - gun_pos, SHOTGUN, gs, o, pal); } else if (*kb <= aplWeaponTotalTime[SHOTGUN_WEAPON][snum]) { - hud_drawpal(weapon_xoffset + 146 - (p->look_ang >> 1), looking_arc + 202 - gun_pos, + hud_drawpal(weapon_xoffset + 146 - (p->getlookang() >> 1), looking_arc + 202 - gun_pos, SHOTGUN + 1, gs, o, pal); } // else we are in 'reload time' @@ -539,7 +539,7 @@ void displayweapon_d(int snum) // down gun_pos -= 10 * (p->kickback_pic - aplWeaponTotalTime[p->curr_weapon][snum]); //D // weapon_xoffset+=80*(*kb-aplWeaponTotalTime[cw][snum]); - hud_drawpal(weapon_xoffset + 146 - (p->look_ang >> 1), looking_arc + 202 - gun_pos, + hud_drawpal(weapon_xoffset + 146 - (p->getlookang() >> 1), looking_arc + 202 - gun_pos, SHOTGUN, gs, o, pal); } else @@ -549,7 +549,7 @@ void displayweapon_d(int snum) // up and left gun_pos -= 10 * (aplWeaponReload[p->curr_weapon][snum] - p->kickback_pic); //U // weapon_xoffset+=80*(*kb-aplWeaponTotalTime[cw][snum]); - hud_drawpal(weapon_xoffset + 146 - (p->look_ang >> 1), looking_arc + 202 - gun_pos, + hud_drawpal(weapon_xoffset + 146 - (p->getlookang() >> 1), looking_arc + 202 - gun_pos, SHOTGUN, gs, o, pal); } }; @@ -574,13 +574,13 @@ void displayweapon_d(int snum) { case 1: case 2: - hud_drawpal(weapon_xoffset + 168 - (p->look_ang >> 1),looking_arc + 201 - gun_pos, + hud_drawpal(weapon_xoffset + 168 - (p->getlookang() >> 1),looking_arc + 201 - gun_pos, SHOTGUN + 2,-128,o,pal); case 0: case 6: case 7: case 8: - hud_drawpal(weapon_xoffset + 146 - (p->look_ang >> 1),looking_arc + 202 - gun_pos, + hud_drawpal(weapon_xoffset + 146 - (p->getlookang() >> 1),looking_arc + 202 - gun_pos, SHOTGUN,gs,o,pal); break; case 3: @@ -595,45 +595,45 @@ void displayweapon_d(int snum) gun_pos -= 40; weapon_xoffset += 20; - hud_drawpal(weapon_xoffset + 178 - (p->look_ang >> 1),looking_arc + 194 - gun_pos, + hud_drawpal(weapon_xoffset + 178 - (p->getlookang() >> 1),looking_arc + 194 - gun_pos, SHOTGUN + 1 + ((*(kb)-1) >> 1),-128,o,pal); } - hud_drawpal(weapon_xoffset + 158 - (p->look_ang >> 1),looking_arc + 220 - gun_pos, + hud_drawpal(weapon_xoffset + 158 - (p->getlookang() >> 1),looking_arc + 220 - gun_pos, SHOTGUN + 3,gs,o,pal); break; case 13: case 14: case 15: - hud_drawpal(32 + weapon_xoffset + 166 - (p->look_ang >> 1),looking_arc + 210 - gun_pos, + hud_drawpal(32 + weapon_xoffset + 166 - (p->getlookang() >> 1),looking_arc + 210 - gun_pos, SHOTGUN + 4,gs,o,pal); break; case 16: case 17: case 18: case 19: - hud_drawpal(64 + weapon_xoffset + 170 - (p->look_ang >> 1),looking_arc + 196 - gun_pos, + hud_drawpal(64 + weapon_xoffset + 170 - (p->getlookang() >> 1),looking_arc + 196 - gun_pos, SHOTGUN + 5,gs,o,pal); break; case 20: case 21: case 22: case 23: - hud_drawpal(64 + weapon_xoffset + 176 - (p->look_ang >> 1),looking_arc + 196 - gun_pos, + hud_drawpal(64 + weapon_xoffset + 176 - (p->getlookang() >> 1),looking_arc + 196 - gun_pos, SHOTGUN + 6,gs,o,pal); break; case 24: case 25: case 26: case 27: - hud_drawpal(64 + weapon_xoffset + 170 - (p->look_ang >> 1),looking_arc + 196 - gun_pos, + hud_drawpal(64 + weapon_xoffset + 170 - (p->getlookang() >> 1),looking_arc + 196 - gun_pos, SHOTGUN + 5,gs,o,pal); break; case 28: case 29: case 30: - hud_drawpal(32 + weapon_xoffset + 156 - (p->look_ang >> 1),looking_arc + 206 - gun_pos, + hud_drawpal(32 + weapon_xoffset + 156 - (p->getlookang() >> 1),looking_arc + 206 - gun_pos, SHOTGUN + 4,gs,o,pal); break; } @@ -659,14 +659,14 @@ void displayweapon_d(int snum) if (*kb == 0) { - // hud_drawpal(weapon_xoffset+168-(p->look_ang>>1),looking_arc+260-gun_pos, + // hud_drawpal(weapon_xoffset+168-(p->getlookang()>>1),looking_arc+260-gun_pos, // CHAINGUN,gs,o,pal); - hud_drawpal(weapon_xoffset + 178 - (p->look_ang >> 1), looking_arc + 233 - gun_pos, + hud_drawpal(weapon_xoffset + 178 - (p->getlookang() >> 1), looking_arc + 233 - gun_pos, CHAINGUN + 1, gs, o, pal); } else if (*kb <= aplWeaponTotalTime[CHAINGUN_WEAPON][snum]) { - hud_drawpal(weapon_xoffset + 188 - (p->look_ang >> 1), looking_arc + 243 - gun_pos, + hud_drawpal(weapon_xoffset + 188 - (p->getlookang() >> 1), looking_arc + 243 - gun_pos, CHAINGUN + 2, gs, o, pal); } // else we are in 'reload time' @@ -696,7 +696,7 @@ void displayweapon_d(int snum) + iFifths - p->kickback_pic)); weapon_xoffset += 80 - (10 * (aplWeaponTotalTime[p->curr_weapon][snum] + iFifths - p->kickback_pic)); - hud_drawpal(weapon_xoffset + 168 - (p->look_ang >> 1), looking_arc + 260 - gun_pos, + hud_drawpal(weapon_xoffset + 168 - (p->getlookang() >> 1), looking_arc + 260 - gun_pos, 2519, gs, o, pal); } else if (p->kickback_pic < @@ -709,7 +709,7 @@ void displayweapon_d(int snum) // down gun_pos += 80; //5*(iFifthsp->kickback_pic-aplWeaponTotalTime[p->curr_weapon][snum]); //D weapon_xoffset += 80; //80*(*kb-aplWeaponTotalTime[p->curr_weapon][snum]); - hud_drawpal(weapon_xoffset + 168 - (p->look_ang >> 1), looking_arc + 260 - gun_pos, + hud_drawpal(weapon_xoffset + 168 - (p->getlookang() >> 1), looking_arc + 260 - gun_pos, 2518, gs, o, pal); } else if (p->kickback_pic < @@ -722,7 +722,7 @@ void displayweapon_d(int snum) // up gun_pos += 80;//5*(iFifths*2); weapon_xoffset += 80; //80*(*kb-aplWeaponTotalTime[p->curr_weapon][snum]); - hud_drawpal(weapon_xoffset + 168 - (p->look_ang >> 1), looking_arc + 260 - gun_pos, + hud_drawpal(weapon_xoffset + 168 - (p->getlookang() >> 1), looking_arc + 260 - gun_pos, 2517, gs, o, pal); } else if (p->kickback_pic < @@ -735,7 +735,7 @@ void displayweapon_d(int snum) // down gun_pos += 80; //5*(aplWeaponTotalTime[p->curr_weapon][snum]- p->kickback_pic); //D weapon_xoffset += 80; //80*(*kb-aplWeaponTotalTime[p->curr_weapon][snum]); - hud_drawpal(weapon_xoffset + 168 - (p->look_ang >> 1), looking_arc + 260 - gun_pos, 2518, gs, o, pal); + hud_drawpal(weapon_xoffset + 168 - (p->getlookang() >> 1), looking_arc + 260 - gun_pos, 2518, gs, o, pal); } else { @@ -746,7 +746,7 @@ void displayweapon_d(int snum) //5*(aplWeaponReload[p->curr_weapon][snum]- p->kickback_pic); //U weapon_xoffset += 10 * (aplWeaponReload[p->curr_weapon][snum] - p->kickback_pic); //80*(*kb-aplWeaponTotalTime[cw][snum]); - hud_drawpal(weapon_xoffset + 168 - (p->look_ang >> 1), looking_arc + 260 - gun_pos, 2519, gs, o, pal); + hud_drawpal(weapon_xoffset + 168 - (p->getlookang() >> 1), looking_arc + 260 - gun_pos, 2519, gs, o, pal); } } @@ -770,28 +770,28 @@ void displayweapon_d(int snum) if (*kb > 0 && sprite[p->i].pal != 1) weapon_xoffset += 1 - (rand() & 3); - hud_drawpal(weapon_xoffset + 168 - (p->look_ang >> 1), looking_arc + 260 - gun_pos, CHAINGUN, gs, o, pal); + hud_drawpal(weapon_xoffset + 168 - (p->getlookang() >> 1), looking_arc + 260 - gun_pos, CHAINGUN, gs, o, pal); switch(p->kickback_pic) { case 0: - hud_drawpal(weapon_xoffset + 178 - (p->look_ang >> 1),looking_arc + 233 - gun_pos, CHAINGUN + 1,gs,o,pal); + hud_drawpal(weapon_xoffset + 178 - (p->getlookang() >> 1),looking_arc + 233 - gun_pos, CHAINGUN + 1,gs,o,pal); break; default: if (*kb > 4 && *kb < 12) { i = 0; if (sprite[p->i].pal != 1) i = rand() & 7; - hud_drawpal(i + weapon_xoffset - 4 + 140 - (p->look_ang >> 1),i + looking_arc - (p->kickback_pic >> 1) + 208 - gun_pos, CHAINGUN + 5 + ((*kb - 4) / 5),gs,o,pal); + hud_drawpal(i + weapon_xoffset - 4 + 140 - (p->getlookang() >> 1),i + looking_arc - (p->kickback_pic >> 1) + 208 - gun_pos, CHAINGUN + 5 + ((*kb - 4) / 5),gs,o,pal); if (sprite[p->i].pal != 1) i = rand() & 7; - hud_drawpal(i + weapon_xoffset - 4 + 184 - (p->look_ang >> 1),i + looking_arc - (p->kickback_pic >> 1) + 208 - gun_pos, CHAINGUN + 5 + ((*kb - 4) / 5),gs,o,pal); + hud_drawpal(i + weapon_xoffset - 4 + 184 - (p->getlookang() >> 1),i + looking_arc - (p->kickback_pic >> 1) + 208 - gun_pos, CHAINGUN + 5 + ((*kb - 4) / 5),gs,o,pal); } if (*kb < 8) { i = rand() & 7; - hud_drawpal(i + weapon_xoffset - 4 + 162 - (p->look_ang >> 1),i + looking_arc - (p->kickback_pic >> 1) + 208 - gun_pos, CHAINGUN + 5 + ((*kb - 2) / 5),gs,o,pal); - hud_drawpal(weapon_xoffset + 178 - (p->look_ang >> 1),looking_arc + 233 - gun_pos, CHAINGUN + 1 + (p->kickback_pic >> 1),gs,o,pal); + hud_drawpal(i + weapon_xoffset - 4 + 162 - (p->getlookang() >> 1),i + looking_arc - (p->kickback_pic >> 1) + 208 - gun_pos, CHAINGUN + 5 + ((*kb - 2) / 5),gs,o,pal); + hud_drawpal(weapon_xoffset + 178 - (p->getlookang() >> 1),looking_arc + 233 - gun_pos, CHAINGUN + 1 + (p->kickback_pic >> 1),gs,o,pal); } - else hud_drawpal(weapon_xoffset + 178 - (p->look_ang >> 1),looking_arc + 233 - gun_pos, CHAINGUN + 1,gs,o,pal); + else hud_drawpal(weapon_xoffset + 178 - (p->getlookang() >> 1),looking_arc + 233 - gun_pos, CHAINGUN + 1,gs,o,pal); break; } }; @@ -822,7 +822,7 @@ void displayweapon_d(int snum) short tilenum; signed char shade; char orientation; - x = (l - (p->look_ang >> 1)); + x = (l - (p->getlookang() >> 1)); y = (looking_arc + 244 - gun_pos); tilenum = FIRSTGUN + kb_frames[*kb]; shade = gs; @@ -844,41 +844,41 @@ void displayweapon_d(int snum) const int WEAPON2_RELOAD_TIME = 50; auto reload_time = isWW2GI() ? aplWeaponReload[PISTOL_WEAPON][snum] : WEAPON2_RELOAD_TIME; if (p->kickback_pic < 10) - hud_drawpal(194 - (p->look_ang >> 1), looking_arc + 230 - gun_pos, pic + 4, gs, o|pin, pal); + hud_drawpal(194 - (p->getlookang() >> 1), looking_arc + 230 - gun_pos, pic + 4, gs, o|pin, pal); else if (p->kickback_pic < 15) { - hud_drawpal(244 - (p->kickback_pic << 3) - (p->look_ang >> 1), looking_arc + 130 - gun_pos + (p->kickback_pic << 4), pic + 6, gs, o | pin, pal); - hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); + hud_drawpal(244 - (p->kickback_pic << 3) - (p->getlookang() >> 1), looking_arc + 130 - gun_pos + (p->kickback_pic << 4), pic + 6, gs, o | pin, pal); + hud_drawpal(224 - (p->getlookang() >> 1), looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); } else if (p->kickback_pic < 20) { - hud_drawpal(124 + (p->kickback_pic << 1) - (p->look_ang >> 1), looking_arc + 430 - gun_pos - (p->kickback_pic << 3), pic + 6, gs, o | pin, pal); - hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); + hud_drawpal(124 + (p->kickback_pic << 1) - (p->getlookang() >> 1), looking_arc + 430 - gun_pos - (p->kickback_pic << 3), pic + 6, gs, o | pin, pal); + hud_drawpal(224 - (p->getlookang() >> 1), looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); } else if (p->kickback_pic < (reload_time - 12)) { - hud_drawpal(184 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, pic + 8, gs, o | pin, pal); - hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 210 - gun_pos, pic + 5, gs, o | pin, pal); + hud_drawpal(184 - (p->getlookang() >> 1), looking_arc + 235 - gun_pos, pic + 8, gs, o | pin, pal); + hud_drawpal(224 - (p->getlookang() >> 1), looking_arc + 210 - gun_pos, pic + 5, gs, o | pin, pal); } else if (p->kickback_pic < (reload_time - 6)) { - hud_drawpal(164 - (p->look_ang >> 1), looking_arc + 245 - gun_pos, pic + 8, gs, o | pin, pal); - hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); + hud_drawpal(164 - (p->getlookang() >> 1), looking_arc + 245 - gun_pos, pic + 8, gs, o | pin, pal); + hud_drawpal(224 - (p->getlookang() >> 1), looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); } else if (p->kickback_pic < (reload_time)) - hud_drawpal(194 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, pic + 5, gs, o, pal); + hud_drawpal(194 - (p->getlookang() >> 1), looking_arc + 235 - gun_pos, pic + 5, gs, o, pal); else if (p->kickback_pic < 23) { - hud_drawpal(184 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, pic + 8, gs, o | pin, pal); - hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 210 - gun_pos, pic + 5, gs, o | pin, pal); + hud_drawpal(184 - (p->getlookang() >> 1), looking_arc + 235 - gun_pos, pic + 8, gs, o | pin, pal); + hud_drawpal(224 - (p->getlookang() >> 1), looking_arc + 210 - gun_pos, pic + 5, gs, o | pin, pal); } else if (p->kickback_pic < 25) { - hud_drawpal(164 - (p->look_ang >> 1), looking_arc + 245 - gun_pos, pic + 8, gs, o | pin, pal); - hud_drawpal(224 - (p->look_ang >> 1), looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); + hud_drawpal(164 - (p->getlookang() >> 1), looking_arc + 245 - gun_pos, pic + 8, gs, o | pin, pal); + hud_drawpal(224 - (p->getlookang() >> 1), looking_arc + 220 - gun_pos, pic + 5, gs, o | pin, pal); } else if (p->kickback_pic < 27) - hud_drawpal(194 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, pic + 5, gs, o | pin, pal); + hud_drawpal(194 - (p->getlookang() >> 1), looking_arc + 235 - gun_pos, pic + 5, gs, o | pin, pal); } }; @@ -935,10 +935,10 @@ void displayweapon_d(int snum) else if (p->kickback_pic < 20) gun_pos -= 9 * (p->kickback_pic - 14); //D } - hud_drawpal(weapon_xoffset + 190 - (p->look_ang >> 1), looking_arc + 250 - gun_pos, HANDTHROW + throw_frames[p->kickback_pic], gs, o, pal); + hud_drawpal(weapon_xoffset + 190 - (p->getlookang() >> 1), looking_arc + 250 - gun_pos, HANDTHROW + throw_frames[p->kickback_pic], gs, o, pal); } else - hud_drawpal(weapon_xoffset + 190 - (p->look_ang >> 1), looking_arc + 260 - gun_pos, HANDTHROW, gs, o, pal); + hud_drawpal(weapon_xoffset + 190 - (p->getlookang() >> 1), looking_arc + 260 - gun_pos, HANDTHROW, gs, o, pal); }; //--------------------------------------------------------------------------- @@ -958,9 +958,9 @@ void displayweapon_d(int snum) weapon_xoffset = -48; if (p->kickback_pic) - hud_drawpal(weapon_xoffset + 150 - (p->look_ang >> 1), looking_arc + 258 - gun_pos, HANDREMOTE + remote_frames[p->kickback_pic], gs, o, pal); + hud_drawpal(weapon_xoffset + 150 - (p->getlookang() >> 1), looking_arc + 258 - gun_pos, HANDREMOTE + remote_frames[p->kickback_pic], gs, o, pal); else - hud_drawpal(weapon_xoffset + 150 - (p->look_ang >> 1), looking_arc + 258 - gun_pos, HANDREMOTE, gs, o, pal); + hud_drawpal(weapon_xoffset + 150 - (p->getlookang() >> 1), looking_arc + 258 - gun_pos, HANDREMOTE, gs, o, pal); }; //--------------------------------------------------------------------------- @@ -983,13 +983,13 @@ void displayweapon_d(int snum) i = sgn(p->kickback_pic >> 2); if (p->ammo_amount[p->curr_weapon] & 1) { - hud_drawpal(weapon_xoffset + 30 - (p->look_ang >> 1), looking_arc + 240 - gun_pos, DEVISTATOR, gs, o | 4, pal); - hud_drawpal(weapon_xoffset + 268 - (p->look_ang >> 1), looking_arc + 238 - gun_pos, DEVISTATOR + i, -32, o, pal); + hud_drawpal(weapon_xoffset + 30 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, DEVISTATOR, gs, o | 4, pal); + hud_drawpal(weapon_xoffset + 268 - (p->getlookang() >> 1), looking_arc + 238 - gun_pos, DEVISTATOR + i, -32, o, pal); } else { - hud_drawpal(weapon_xoffset + 30 - (p->look_ang >> 1), looking_arc + 240 - gun_pos, DEVISTATOR + i, -32, o | 4, pal); - hud_drawpal(weapon_xoffset + 268 - (p->look_ang >> 1), looking_arc + 238 - gun_pos, DEVISTATOR, gs, o, pal); + hud_drawpal(weapon_xoffset + 30 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, DEVISTATOR + i, -32, o | 4, pal); + hud_drawpal(weapon_xoffset + 268 - (p->getlookang() >> 1), looking_arc + 238 - gun_pos, DEVISTATOR, gs, o, pal); } } // else we are in 'reload time' @@ -1003,8 +1003,8 @@ void displayweapon_d(int snum) // down gun_pos -= 10 * (p->kickback_pic - aplWeaponTotalTime[p->curr_weapon][snum]); //D // weapon_xoffset+=80*(*kb-aplWeaponTotalTime[cw][snum]); - hud_drawpal(weapon_xoffset + 268 - (p->look_ang >> 1), looking_arc + 238 - gun_pos, DEVISTATOR, gs, o, pal); - hud_drawpal(weapon_xoffset + 30 - (p->look_ang >> 1), looking_arc + 240 - gun_pos, DEVISTATOR, gs, o | 4, pal); + hud_drawpal(weapon_xoffset + 268 - (p->getlookang() >> 1), looking_arc + 238 - gun_pos, DEVISTATOR, gs, o, pal); + hud_drawpal(weapon_xoffset + 30 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, DEVISTATOR, gs, o | 4, pal); } else { @@ -1013,14 +1013,14 @@ void displayweapon_d(int snum) // up and left gun_pos -= 10 * (aplWeaponReload[p->curr_weapon][snum] - p->kickback_pic); //U // weapon_xoffset+=80*(*kb-aplWeaponTotalTime[cw][snum]); - hud_drawpal(weapon_xoffset + 268 - (p->look_ang >> 1), looking_arc + 238 - gun_pos, DEVISTATOR, gs, o, pal); - hud_drawpal(weapon_xoffset + 30 - (p->look_ang >> 1), looking_arc + 240 - gun_pos, DEVISTATOR, gs, o | 4, pal); + hud_drawpal(weapon_xoffset + 268 - (p->getlookang() >> 1), looking_arc + 238 - gun_pos, DEVISTATOR, gs, o, pal); + hud_drawpal(weapon_xoffset + 30 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, DEVISTATOR, gs, o | 4, pal); } } else { - hud_drawpal(weapon_xoffset + 268 - (p->look_ang >> 1), looking_arc + 238 - gun_pos, DEVISTATOR, gs, o, pal); - hud_drawpal(weapon_xoffset + 30 - (p->look_ang >> 1), looking_arc + 240 - gun_pos, DEVISTATOR, gs, o | 4, pal); + hud_drawpal(weapon_xoffset + 268 - (p->getlookang() >> 1), looking_arc + 238 - gun_pos, DEVISTATOR, gs, o, pal); + hud_drawpal(weapon_xoffset + 30 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, DEVISTATOR, gs, o | 4, pal); } }; @@ -1045,19 +1045,19 @@ void displayweapon_d(int snum) if (p->hbomb_hold_delay) { - hud_drawpal((cycloidy[*kb] >> 1) + weapon_xoffset + 268 - (p->look_ang >> 1), cycloidy[*kb] + looking_arc + 238 - gun_pos, DEVISTATOR + i, -32, o, pal); - hud_drawpal(weapon_xoffset + 30 - (p->look_ang >> 1), looking_arc + 240 - gun_pos, DEVISTATOR, gs, o | 4, pal); + hud_drawpal((cycloidy[*kb] >> 1) + weapon_xoffset + 268 - (p->getlookang() >> 1), cycloidy[*kb] + looking_arc + 238 - gun_pos, DEVISTATOR + i, -32, o, pal); + hud_drawpal(weapon_xoffset + 30 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, DEVISTATOR, gs, o | 4, pal); } else { - hud_drawpal(-(cycloidy[*kb] >> 1) + weapon_xoffset + 30 - (p->look_ang >> 1), cycloidy[*kb] + looking_arc + 240 - gun_pos, DEVISTATOR + i, -32, o | 4, pal); - hud_drawpal(weapon_xoffset + 268 - (p->look_ang >> 1), looking_arc + 238 - gun_pos, DEVISTATOR, gs, o, pal); + hud_drawpal(-(cycloidy[*kb] >> 1) + weapon_xoffset + 30 - (p->getlookang() >> 1), cycloidy[*kb] + looking_arc + 240 - gun_pos, DEVISTATOR + i, -32, o | 4, pal); + hud_drawpal(weapon_xoffset + 268 - (p->getlookang() >> 1), looking_arc + 238 - gun_pos, DEVISTATOR, gs, o, pal); } } else { - hud_drawpal(weapon_xoffset + 268 - (p->look_ang >> 1), looking_arc + 238 - gun_pos, DEVISTATOR, gs, o, pal); - hud_drawpal(weapon_xoffset + 30 - (p->look_ang >> 1), looking_arc + 240 - gun_pos, DEVISTATOR, gs, o | 4, pal); + hud_drawpal(weapon_xoffset + 268 - (p->getlookang() >> 1), looking_arc + 238 - gun_pos, DEVISTATOR, gs, o, pal); + hud_drawpal(weapon_xoffset + 30 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, DEVISTATOR, gs, o | 4, pal); } }; @@ -1087,10 +1087,10 @@ void displayweapon_d(int snum) looking_arc += rand() & 3; } gun_pos -= 16; - hud_drawpal(weapon_xoffset + 210 - (p->look_ang >> 1), looking_arc + 261 - gun_pos, pic + 2, -32, o|pin, pal); - hud_drawpal(weapon_xoffset + 210 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, pic + 3 + cat_frames[*kb % 6], -32, o | pin, pal); + hud_drawpal(weapon_xoffset + 210 - (p->getlookang() >> 1), looking_arc + 261 - gun_pos, pic + 2, -32, o|pin, pal); + hud_drawpal(weapon_xoffset + 210 - (p->getlookang() >> 1), looking_arc + 235 - gun_pos, pic + 3 + cat_frames[*kb % 6], -32, o | pin, pal); } - else hud_drawpal(weapon_xoffset + 210 - (p->look_ang >> 1), looking_arc + 261 - gun_pos, pic, gs, o | pin, pal); + else hud_drawpal(weapon_xoffset + 210 - (p->getlookang() >> 1), looking_arc + 261 - gun_pos, pic, gs, o | pin, pal); }; //--------------------------------------------------------------------------- @@ -1112,22 +1112,22 @@ void displayweapon_d(int snum) // the 'at rest' display if (ps[snum].ammo_amount[cw] <= 0) //p->last_weapon >= 0) { - hud_drawpal(weapon_xoffset + 184 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 184 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER + 3 + (p->kickback_pic & 3), -32, o, 0); - hud_drawpal(weapon_xoffset + 188 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 188 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER + 1, gs, o, pal); } else { - hud_drawpal(weapon_xoffset + 184 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 184 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER + 2, 16 - (sintable[p->random_club_frame & 2047] >> 10), o, 0); - hud_drawpal(weapon_xoffset + 188 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 188 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER, gs, o, pal); } } @@ -1176,11 +1176,11 @@ void displayweapon_d(int snum) // draw weapon { - hud_drawpal(weapon_xoffset + 184 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 184 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER + 3 + (p->kickback_pic & 3), -32, o, 0); - hud_drawpal(weapon_xoffset + 188 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 188 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER + 1, gs, o, pal); } } @@ -1203,7 +1203,7 @@ void displayweapon_d(int snum) if (p->kickback_pic == 0) { { - hud_drawpal(weapon_xoffset + 188 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 188 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER - 2, gs, o, pal); } } @@ -1250,11 +1250,11 @@ void displayweapon_d(int snum) // display weapon { - hud_drawpal(weapon_xoffset + 184 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 184 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER + 3 + (p->kickback_pic & 3), -32, o, 2); - hud_drawpal(weapon_xoffset + 188 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 188 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER - 1, gs, o, pal); } @@ -1279,22 +1279,22 @@ void displayweapon_d(int snum) { if (cw == GROW_WEAPON) { - hud_drawpal(weapon_xoffset + 184 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 184 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER + 2, 16 - (sintable[p->random_club_frame & 2047] >> 10), o, 2); - hud_drawpal(weapon_xoffset + 188 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 188 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER - 2, gs, o, pal); } else { - hud_drawpal(weapon_xoffset + 184 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 184 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER + 2, 16 - (sintable[p->random_club_frame & 2047] >> 10), o, 0); - hud_drawpal(weapon_xoffset + 188 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 188 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER, gs, o, pal); } } @@ -1308,21 +1308,21 @@ void displayweapon_d(int snum) if (cw == GROW_WEAPON) { - hud_drawpal(weapon_xoffset + 184 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 184 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER + 3 + (p->kickback_pic & 3), -32, o, 2); - hud_drawpal(weapon_xoffset + 188 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 188 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER - 1, gs, o, pal); } else { - hud_drawpal(weapon_xoffset + 184 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 184 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER + 3 + (p->kickback_pic & 3), -32, o, 0); - hud_drawpal(weapon_xoffset + 188 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 188 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER + 1, gs, o, pal); } } @@ -1348,8 +1348,8 @@ void displayweapon_d(int snum) if (*kb < 1 || sector[p->cursectnum].lotag == 2) { - hud_drawpal(weapon_xoffset + 210 - (p->look_ang >> 1), looking_arc + 261 - gun_pos, FLAMETHROWER, gs, o, pal); - hud_drawpal(weapon_xoffset + 210 - (p->look_ang >> 1), looking_arc + 261 - gun_pos, FLAMETHROWERPILOT, gs, o, pal); + hud_drawpal(weapon_xoffset + 210 - (p->getlookang() >> 1), looking_arc + 261 - gun_pos, FLAMETHROWER, gs, o, pal); + hud_drawpal(weapon_xoffset + 210 - (p->getlookang() >> 1), looking_arc + 261 - gun_pos, FLAMETHROWERPILOT, gs, o, pal); } else { @@ -1360,8 +1360,8 @@ void displayweapon_d(int snum) looking_arc += krand() & 1; } gun_pos -= 16; - hud_drawpal(weapon_xoffset + 210 - (p->look_ang >> 1), looking_arc + 261 - gun_pos, FLAMETHROWER + 1, 32, o, pal); - hud_drawpal(weapon_xoffset + 210 - (p->look_ang >> 1), looking_arc + 235 - gun_pos, FLAMETHROWER + 2 + cat_frames[*kb % 6], -32, o, pal); + hud_drawpal(weapon_xoffset + 210 - (p->getlookang() >> 1), looking_arc + 261 - gun_pos, FLAMETHROWER + 1, 32, o, pal); + hud_drawpal(weapon_xoffset + 210 - (p->getlookang() >> 1), looking_arc + 235 - gun_pos, FLAMETHROWER + 2 + cat_frames[*kb % 6], -32, o, pal); } }; diff --git a/source/games/duke/src/hudweapon_r.cpp b/source/games/duke/src/hudweapon_r.cpp index 6f7b25af9..afde542a0 100644 --- a/source/games/duke/src/hudweapon_r.cpp +++ b/source/games/duke/src/hudweapon_r.cpp @@ -122,7 +122,7 @@ void displayweapon_r(int snum) o = 0; - looking_arc = abs(p->look_ang)/9; + looking_arc = abs(p->getlookang())/9; if (shadedsector[p->cursectnum] == 1) gs = 16; @@ -212,9 +212,9 @@ void displayweapon_r(int snum) pal = sector[p->cursectnum].floorpal; if (p->TiltStatus >= 0) - ShowMotorcycle(160-(p->look_ang>>1), 174, temp_kb, gs, 0, pal, p->TiltStatus*5); + ShowMotorcycle(160-(p->getlookang()>>1), 174, temp_kb, gs, 0, pal, p->TiltStatus*5); else if (p->TiltStatus < 0) - ShowMotorcycle(160-(p->look_ang>>1), 174, temp_kb, gs, 0, pal, p->TiltStatus*5+2047); + ShowMotorcycle(160-(p->getlookang()>>1), 174, temp_kb, gs, 0, pal, p->TiltStatus*5+2047); return; } if (p->OnBoat) @@ -287,9 +287,9 @@ void displayweapon_r(int snum) gs = -96; if (p->TiltStatus >= 0) - ShowBoat(160-(p->look_ang>>1), temp3, temp_kb, gs, 0, pal, p->TiltStatus); + ShowBoat(160-(p->getlookang()>>1), temp3, temp_kb, gs, 0, pal, p->TiltStatus); else if (p->TiltStatus < 0) - ShowBoat(160-(p->look_ang>>1), temp3, temp_kb, gs, 0, pal, p->TiltStatus+2047); + ShowBoat(160-(p->getlookang()>>1), temp3, temp_kb, gs, 0, pal, p->TiltStatus+2047); return; } @@ -304,12 +304,12 @@ void displayweapon_r(int snum) } cw = weapon_xoffset; weapon_xoffset += sintable[(fistsign)&2047]>>10; - hud_draw(weapon_xoffset+250-(p->look_ang>>1), + hud_draw(weapon_xoffset+250-(p->getlookang()>>1), looking_arc+258-(abs(sintable[(fistsign)&2047]>>8)), FIST,gs,o); weapon_xoffset = cw; weapon_xoffset -= sintable[(fistsign)&2047]>>10; - hud_draw(weapon_xoffset+40-(p->look_ang>>1), + hud_draw(weapon_xoffset+40-(p->getlookang()>>1), looking_arc+200+(abs(sintable[(fistsign)&2047]>>8)), FIST,gs,o|4); } @@ -338,7 +338,7 @@ void displayweapon_r(int snum) short y; x = weapon_xoffset + ((kb_ox[kb_frames[*kb]] >> 1) - 12); y = 200 - (244 - kb_oy[kb_frames[*kb]]); - hud_drawpal(x - (p->look_ang >> 1), looking_arc + y - gun_pos, + hud_drawpal(x - (p->getlookang() >> 1), looking_arc + y - gun_pos, KNEE + kb_frames[*kb], gs, 0, pal); }; @@ -356,7 +356,7 @@ void displayweapon_r(int snum) short x, y; x = weapon_xoffset + ((kb_ox[kb_frames[*kb]] >> 1) - 12); y = 210 - (244 - kb_oy[kb_frames[*kb]]); - hud_drawpal(x - (p->look_ang >> 1) + 20, looking_arc + y - gun_pos - 80, + hud_drawpal(x - (p->getlookang() >> 1) + 20, looking_arc + y - gun_pos - 80, SLINGBLADE + kb_frames[*kb], gs, 0, pal); }; @@ -372,12 +372,12 @@ void displayweapon_r(int snum) gun_pos -= 10; if (p->ammo_amount[BOWLING_WEAPON]) { - hud_drawpal(weapon_xoffset + 162 - (p->look_ang >> 1), + hud_drawpal(weapon_xoffset + 162 - (p->getlookang() >> 1), looking_arc + 214 - gun_pos + (*kb << 3), BOWLINGBALLH, gs, o, pal); } else { - rdmyospal(weapon_xoffset + 162 - (p->look_ang >> 1), + rdmyospal(weapon_xoffset + 162 - (p->getlookang() >> 1), looking_arc + 214 - gun_pos, HANDTHROW + 5, gs, o, pal); } }; @@ -394,14 +394,14 @@ void displayweapon_r(int snum) gun_pos -= 10; if (p->ammo_amount[POWDERKEG_WEAPON]) { - rdmyospal(weapon_xoffset + 180 - (p->look_ang >> 1), + rdmyospal(weapon_xoffset + 180 - (p->getlookang() >> 1), looking_arc + 214 - gun_pos + (*kb << 3), POWDERH, gs, o, pal); - rdmyospal(weapon_xoffset + 90 - (p->look_ang >> 1), + rdmyospal(weapon_xoffset + 90 - (p->getlookang() >> 1), looking_arc + 214 - gun_pos + (*kb << 3), POWDERH, gs, o | 4, pal); } else { - rdmyospal(weapon_xoffset + 162 - (p->look_ang >> 1), + rdmyospal(weapon_xoffset + 162 - (p->getlookang() >> 1), looking_arc + 214 - gun_pos, HANDTHROW + 5, gs, o, pal); } }; @@ -418,17 +418,17 @@ void displayweapon_r(int snum) static const uint8_t kb_frames[] = { 0,1,1,2,2,3,2,3,2,3,2,2,2,2,2,2,2,2,2,4,4,4,4,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7 }; if (kb_frames[*kb] == 2 || kb_frames[*kb] == 3) { - rdmyospal((weapon_xoffset + 200) - (p->look_ang >> 1), + rdmyospal((weapon_xoffset + 200) - (p->getlookang() >> 1), looking_arc + 250 - gun_pos, RPGGUN + kb_frames[*kb], gs, o | pin, pal); } else if (kb_frames[*kb] == 1) { - rdmyospal((weapon_xoffset + 200) - (p->look_ang >> 1), + rdmyospal((weapon_xoffset + 200) - (p->getlookang() >> 1), looking_arc + 250 - gun_pos, RPGGUN + kb_frames[*kb], 0, o | pin, pal); } else { - rdmyospal((weapon_xoffset + 210) - (p->look_ang >> 1), + rdmyospal((weapon_xoffset + 210) - (p->getlookang() >> 1), looking_arc + 255 - gun_pos, RPGGUN + kb_frames[*kb], gs, o | pin, pal); } }; @@ -447,17 +447,17 @@ void displayweapon_r(int snum) static const uint8_t kb_frames[] = { 0,1,1,2,2,3,2,3,2,3,2,2,2,2,2,2,2,2,2,4,4,4,4,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7 }; if (kb_frames[*kb] == 2 || kb_frames[*kb] == 3) { - rdmyospal((weapon_xoffset + 200) - (p->look_ang >> 1), + rdmyospal((weapon_xoffset + 200) - (p->getlookang() >> 1), looking_arc + 250 - gun_pos, RPGGUN2 + kb_frames[*kb], gs, o | pin, pal); } else if (kb_frames[*kb] == 1) { - rdmyospal((weapon_xoffset + 200) - (p->look_ang >> 1), + rdmyospal((weapon_xoffset + 200) - (p->getlookang() >> 1), looking_arc + 250 - gun_pos, RPGGUN2 + kb_frames[*kb], 0, o | pin, pal); } else { - rdmyospal((weapon_xoffset + 210) - (p->look_ang >> 1), + rdmyospal((weapon_xoffset + 210) - (p->getlookang() >> 1), looking_arc + 255 - gun_pos, RPGGUN2 + kb_frames[*kb], gs, o | pin, pal); } } @@ -467,25 +467,25 @@ void displayweapon_r(int snum) { if (chickenphase) { - rdmyospal((weapon_xoffset + 210) - (p->look_ang >> 1), + rdmyospal((weapon_xoffset + 210) - (p->getlookang() >> 1), looking_arc + 222 - gun_pos, RPGGUN2 + 7, gs, o | pin, pal); } else if ((krand() & 15) == 5) { spritesound(327, p->i); - rdmyospal((weapon_xoffset + 210) - (p->look_ang >> 1), + rdmyospal((weapon_xoffset + 210) - (p->getlookang() >> 1), looking_arc + 222 - gun_pos, RPGGUN2 + 7, gs, o | pin, pal); chickenphase = 6; } else { - rdmyospal((weapon_xoffset + 210) - (p->look_ang >> 1), + rdmyospal((weapon_xoffset + 210) - (p->getlookang() >> 1), looking_arc + 225 - gun_pos, RPGGUN2, gs, o | pin, pal); } } else { - rdmyospal((weapon_xoffset + 210) - (p->look_ang >> 1), + rdmyospal((weapon_xoffset + 210) - (p->getlookang() >> 1), looking_arc + 225 - gun_pos, RPGGUN2, gs, o | pin, pal); } } @@ -524,7 +524,7 @@ void displayweapon_r(int snum) gs = 0; x = weapon_xoffset + ((kb_ox[kb_frames[*kb]] >> 1) - 12); y = tm - (244 - kb_oy[kb_frames[*kb]]); - hud_drawpal(x + 64 - (p->look_ang >> 1), + hud_drawpal(x + 64 - (p->getlookang() >> 1), y + looking_arc - gun_pos, SHOTGUN + kb_frames[*kb], gs, 0, pal); } else @@ -548,9 +548,9 @@ void displayweapon_r(int snum) y += 30; break; } - hud_drawpal(x + 64 - (p->look_ang >> 1), y + looking_arc - gun_pos, SHOTGUN + kb_frames[*kb], gs, 0, pal); + hud_drawpal(x + 64 - (p->getlookang() >> 1), y + looking_arc - gun_pos, SHOTGUN + kb_frames[*kb], gs, 0, pal); if (kb_frames[*kb] == 21) - hud_drawpal(x + 96 - (p->look_ang >> 1), y + looking_arc - gun_pos, SHOTGUNSHELLS, gs, 0, pal); + hud_drawpal(x + 96 - (p->getlookang() >> 1), y + looking_arc - gun_pos, SHOTGUNSHELLS, gs, 0, pal); } } else @@ -563,7 +563,7 @@ void displayweapon_r(int snum) gs = 0; x = weapon_xoffset + ((kb_ox[kb_frames2[*kb]] >> 1) - 12); y = tm - (244 - kb_oy[kb_frames2[*kb]]); - hud_drawpal(x + 64 - (p->look_ang >> 1), + hud_drawpal(x + 64 - (p->getlookang() >> 1), y + looking_arc - gun_pos, SHOTGUN + kb_frames2[*kb], gs, 0, pal); } else @@ -572,7 +572,7 @@ void displayweapon_r(int snum) gs = 0; x = weapon_xoffset + ((kb_ox[kb_frames3[*kb]] >> 1) - 12); y = tm - (244 - kb_oy[kb_frames3[*kb]]); - hud_drawpal(x + 64 - (p->look_ang >> 1), + hud_drawpal(x + 64 - (p->getlookang() >> 1), y + looking_arc - gun_pos, SHOTGUN + kb_frames3[*kb], gs, 0, pal); } } @@ -597,9 +597,9 @@ void displayweapon_r(int snum) y += 30; break; } - hud_drawpal(x + 64 - (p->look_ang >> 1), y + looking_arc - gun_pos, SHOTGUN + kb_frames2[*kb], gs, 0, pal); + hud_drawpal(x + 64 - (p->getlookang() >> 1), y + looking_arc - gun_pos, SHOTGUN + kb_frames2[*kb], gs, 0, pal); if (kb_frames2[*kb] == 21) - hud_drawpal(x + 96 - (p->look_ang >> 1), y + looking_arc - gun_pos, SHOTGUNSHELLS, gs, 0, pal); + hud_drawpal(x + 96 - (p->getlookang() >> 1), y + looking_arc - gun_pos, SHOTGUNSHELLS, gs, 0, pal); } } } @@ -621,7 +621,7 @@ void displayweapon_r(int snum) switch (*kb) { case 0: - hud_drawpal(weapon_xoffset + 178 - (p->look_ang >> 1) + 30, looking_arc + 233 - gun_pos + 5, + hud_drawpal(weapon_xoffset + 178 - (p->getlookang() >> 1) + 30, looking_arc + 233 - gun_pos + 5, CHAINGUN, gs, o, pal); break; default: @@ -629,10 +629,10 @@ void displayweapon_r(int snum) if (*kb < 8) { i = rand() & 7; - hud_drawpal(weapon_xoffset + 178 - (p->look_ang >> 1) + 30, looking_arc + 233 - gun_pos + 5, + hud_drawpal(weapon_xoffset + 178 - (p->getlookang() >> 1) + 30, looking_arc + 233 - gun_pos + 5, CHAINGUN + 1, gs, o, pal); } - else hud_drawpal(weapon_xoffset + 178 - (p->look_ang >> 1) + 30, looking_arc + 233 - gun_pos + 5, + else hud_drawpal(weapon_xoffset + 178 - (p->getlookang() >> 1) + 30, looking_arc + 233 - gun_pos + 5, CHAINGUN + 2, gs, o, pal); break; } @@ -660,7 +660,7 @@ void displayweapon_r(int snum) if (kb_frames[*kb]) gs = 0; - rdmyospal(x - (p->look_ang >> 1), + rdmyospal(x - (p->getlookang() >> 1), y + looking_arc - gun_pos, FIRSTGUN + kb_frames[*kb], gs, 0, pal); } else @@ -718,7 +718,7 @@ void displayweapon_r(int snum) dx = 0; break; } - rdmyospal(x - (p->look_ang >> 1) - dx, + rdmyospal(x - (p->getlookang() >> 1) - dx, y + looking_arc - gun_pos + dy, FIRSTGUNRELOAD + kb_frames[(*kb) - 22], gs, 0, pal); } }; @@ -733,7 +733,7 @@ void displayweapon_r(int snum) { gun_pos -= 9 * (*kb); - rdmyospal(weapon_xoffset + 190 - (p->look_ang >> 1), looking_arc + 260 - gun_pos, HANDTHROW, gs, o, pal); + rdmyospal(weapon_xoffset + 190 - (p->getlookang() >> 1), looking_arc + 260 - gun_pos, HANDTHROW, gs, o, pal); }; //--------------------------------------------------------------------------- @@ -759,20 +759,20 @@ void displayweapon_r(int snum) { if ((*kb) < 5) { - rdmyospal(weapon_xoffset + x + 190 - (p->look_ang >> 1) - dx, + rdmyospal(weapon_xoffset + x + 190 - (p->getlookang() >> 1) - dx, looking_arc + 258 - gun_pos - 64 + p->detonate_count - dy, RRTILE1752, 0, o | pin, pal); } - rdmyospal(weapon_xoffset + x + 190 - (p->look_ang >> 1), + rdmyospal(weapon_xoffset + x + 190 - (p->getlookang() >> 1), looking_arc + 258 - gun_pos - dy, HANDTHROW + remote_frames[*kb], gs, o | pin, pal); } else { if ((*kb) < 5) { - rdmyospal(weapon_xoffset + x + 190 - (p->look_ang >> 1) - dx, + rdmyospal(weapon_xoffset + x + 190 - (p->getlookang() >> 1) - dx, looking_arc + 258 - gun_pos - 64 + p->detonate_count - dy, RRTILE1752, 0, o | pin, pal); } - rdmyospal(weapon_xoffset + x + 190 - (p->look_ang >> 1), + rdmyospal(weapon_xoffset + x + 190 - (p->getlookang() >> 1), looking_arc + 258 - gun_pos - dy, HANDTHROW + 1, gs, o | pin, pal); } } @@ -789,10 +789,10 @@ void displayweapon_r(int snum) if (*kb) { gs = 0; - rd3myospal(150 + (weapon_xoffset >> 1) - (p->look_ang >> 1), 266 + (looking_arc >> 1) - gun_pos, DEVISTATOR, gs, o, pal); + rd3myospal(150 + (weapon_xoffset >> 1) - (p->getlookang() >> 1), 266 + (looking_arc >> 1) - gun_pos, DEVISTATOR, gs, o, pal); } else - rd3myospal(150 + (weapon_xoffset >> 1) - (p->look_ang >> 1), 266 + (looking_arc >> 1) - gun_pos, DEVISTATOR + 1, gs, o, pal); + rd3myospal(150 + (weapon_xoffset >> 1) - (p->getlookang() >> 1), 266 + (looking_arc >> 1) - gun_pos, DEVISTATOR + 1, gs, o, pal); }; //--------------------------------------------------------------------------- @@ -807,9 +807,9 @@ void displayweapon_r(int snum) if ((*kb)) { char cat_frames[] = { 0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; - rdmyospal(weapon_xoffset + 260 - (p->look_ang >> 1), looking_arc + 215 - gun_pos, FREEZE + cat_frames[*kb], -32, o | pin, pal); + rdmyospal(weapon_xoffset + 260 - (p->getlookang() >> 1), looking_arc + 215 - gun_pos, FREEZE + cat_frames[*kb], -32, o | pin, pal); } - else rdmyospal(weapon_xoffset + 260 - (p->look_ang >> 1), looking_arc + 215 - gun_pos, FREEZE, gs, o | pin, pal); + else rdmyospal(weapon_xoffset + 260 - (p->getlookang() >> 1), looking_arc + 215 - gun_pos, FREEZE, gs, o | pin, pal); }; //--------------------------------------------------------------------------- @@ -824,7 +824,7 @@ void displayweapon_r(int snum) looking_arc += 18; if ((*kb) == 0) { - rd2myospal(weapon_xoffset + 188 - (p->look_ang >> 1), + rd2myospal(weapon_xoffset + 188 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER, gs, o, pal); } else @@ -837,14 +837,14 @@ void displayweapon_r(int snum) if (cw == BUZZSAW_WEAPON) { - rd2myospal(weapon_xoffset + 184 - (p->look_ang >> 1), + rd2myospal(weapon_xoffset + 184 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, GROWSPARK + ((*kb) & 2), gs, o, 0); } else { signed char kb_frames[] = { 1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0 }; short frm = kb_frames[*kb]; - rd2myospal(weapon_xoffset + 184 - (p->look_ang >> 1), + rd2myospal(weapon_xoffset + 184 - (p->getlookang() >> 1), looking_arc + 240 - gun_pos, SHRINKER + frm, gs, o, 0); } } diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index d0b308a1a..82dc29dc3 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -712,8 +712,12 @@ void playerLookLeft(int snum) OnEvent(EVENT_LOOKLEFT, p->i, snum, -1); if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0) { +#ifdef SYNCINPUT p->addlookang(-152); p->addrotscrnang(24); +#else + g_player[snum].lookLeft = true; +#endif } } @@ -724,8 +728,12 @@ void playerLookRight(int snum) OnEvent(EVENT_LOOKRIGHT, p->i, snum, -1); if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0) { +#ifdef SYNCINPUT p->addlookang(152); p->addrotscrnang(24); +#else + g_player[snum].lookRight = true; +#endif } } @@ -743,7 +751,7 @@ void playerCenterView(int snum) #pragma message("input stuff begins here") void horizAngleAdjust(int snum, int delta) { -#if 1 // for per-frame input +#ifndef SYNCINPUT // for per-frame input g_player[snum].horizAngleAdjust = delta; #else // for synchronous input ps[snum].addhoriz(delta); diff --git a/source/games/duke/src/player.h b/source/games/duke/src/player.h index 7b42ce642..8a7719a63 100644 --- a/source/games/duke/src/player.h +++ b/source/games/duke/src/player.h @@ -51,6 +51,8 @@ typedef struct float horizAngleAdjust; fix16_t horizSkew; double lastInputTicks; + bool lookLeft; + bool lookRight; } playerdata_t; diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 3c5c57dab..adbfaa2ea 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -2641,7 +2641,6 @@ void processinput_d(int snum) p->oq16horizoff = p->q16horizoff; #endif -#pragma message("input stuff begins here") if (p->aim_mode == 0 && p->on_ground && psectlotag != 2 && (sector[psect].floorstat & 2)) { x = p->posx + (sintable[(p->getang() + 512) & 2047] >> 5); @@ -2735,8 +2734,8 @@ void processinput_d(int snum) p->posz = sprite[i].z; p->setang(sprite[i].ang); p->posxv = p->posyv = s->xvel = 0; - p->look_ang = 0; - p->rotscrnang = 0; + p->setlookang(0); + p->setrotscrnang(0); fi.doincrements(p); @@ -2747,10 +2746,12 @@ void processinput_d(int snum) doubvel = TICSPERFRAME; - if (p->rotscrnang > 0) p->rotscrnang -= ((p->rotscrnang >> 1) + 1); - else if (p->rotscrnang < 0) p->rotscrnang += (((-p->rotscrnang) >> 1) + 1); +#ifdef SYNCINPUT + if (p->q16rotscrnang > 0) p->q16rotscrnang -= ((p->q16rotscrnang >> 1) + 1); + else if (p->q16rotscrnang < 0) p->q16rotscrnang += (((-p->q16rotscrnang) >> 1) + 1); - p->look_ang -= (p->look_ang >> 2); + p->q16look_ang -= p->q16look_ang >> 2; +#endif if (sb_snum & SKB_LOOK_LEFT) { @@ -2795,16 +2796,15 @@ void processinput_d(int snum) p->oposz = p->posz; p->opyoff = p->pyoff; -#pragma message("input stuff begins here") -#if 0 +#ifdef SYNCINPUT p->oq16ang = p->q16ang; -#endif if (p->one_eighty_count < 0) { p->one_eighty_count += 128; p->addang(128); } +#endif // Shrinking code @@ -2840,8 +2840,7 @@ void processinput_d(int snum) } else if (sb_avel) //p->ang += syncangvel * constant { //ENGINE calculates angvel for you -#pragma message("input stuff begins here") -#if 0 +#ifdef SYNCINPUT // may still be needed later for demo recording int tempang; @@ -3089,10 +3088,9 @@ HORIZONLY: p->q16horiz += 33*FRACUNIT - (p->q16horiz / 3); } -#pragma message("input stuff begins here") if (p->hard_landing > 0) { -#if 1 +#ifndef SYNCINPUT g_player[snum].horizSkew = (-(p->hard_landing << 4)) * FRACUNIT; #else p->addhoriz(-(p->hard_landing << 4)); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index acfe724bf..b186c4fcc 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3473,7 +3473,7 @@ void processinput_r(int snum) hittype[pi].floorz = fz; hittype[pi].ceilingz = cz; -#if 0 +#ifdef SYNCINPUT p->oq16horiz = p->q16horiz; p->oq16horizoff = p->q16horizoff; #endif @@ -3629,8 +3629,8 @@ void processinput_r(int snum) p->posz = sprite[i].z; p->setang(sprite[i].ang); p->posxv = p->posyv = s->xvel = 0; - p->look_ang = 0; - p->rotscrnang = 0; + p->setlookang(0); + p->setrotscrnang(0); fi.doincrements(p); @@ -3640,10 +3640,12 @@ void processinput_r(int snum) doubvel = TICSPERFRAME; - if (p->rotscrnang > 0) p->rotscrnang -= ((p->rotscrnang >> 1) + 1); - else if (p->rotscrnang < 0) p->rotscrnang += (((-p->rotscrnang) >> 1) + 1); +#ifdef SYNCINPUT + if (p->q16rotscrnang > 0) p->q16rotscrnang -= ((p->q16rotscrnang >> 1) + 1); + else if (p->q16rotscrnang < 0) p->q16rotscrnang += (((-p->q16rotscrnang) >> 1) + 1); - p->look_ang -= (p->look_ang >> 2); + p->q16look_ang -= p->q16look_ang >> 2; +#endif if ((sb_snum & SKB_LOOK_LEFT) && !p->OnMotorcycle) { @@ -3655,22 +3657,24 @@ void processinput_r(int snum) playerLookRight(snum); } +#ifdef SYNCINPUT if (isRRRA() && p->SeaSick) { if (p->SeaSick < 250) { if (p->SeaSick >= 180) - p->rotscrnang += 24; + p->addrotscrnang(24); else if (p->SeaSick >= 130) - p->rotscrnang -= 24; + p->addrotscrnang(-24); else if (p->SeaSick >= 70) - p->rotscrnang += 24; + p->addrotscrnang(24); else if (p->SeaSick >= 20) - p->rotscrnang += 24; + p->addrotscrnang(-24); } if (p->SeaSick < 250) - p->look_ang += (krand() & 255) - 128; + p->addlookang((krand() & 255) - 128); } +#endif if (p->on_crane >= 0) goto HORIZONLY; @@ -3705,6 +3709,7 @@ void processinput_r(int snum) p->oposz = p->posz; p->opyoff = p->pyoff; +#ifdef SYNCINPUT p->oq16ang = p->q16ang; if (p->one_eighty_count < 0) @@ -3712,6 +3717,7 @@ void processinput_r(int snum) p->one_eighty_count += 128; p->addang(128); } +#endif // Shrinking code @@ -3774,8 +3780,7 @@ void processinput_r(int snum) } else if (sb_avel) //p->ang += syncangvel * constant { //ENGINE calculates angvel for you -#pragma message("input stuff begins here") -#if 0 +#ifdef SYNCINPUT // may still be needed later for demo recording int tempang; @@ -4146,10 +4151,9 @@ HORIZONLY: p->q16horiz += 33*FRACUNIT - (p->q16horiz / 3); } -#pragma message("input stuff begins here") if (p->hard_landing > 0) { -#if 1 +#ifndef SYNCINPUT g_player[snum].horizSkew = (-(p->hard_landing << 4)) * FRACUNIT; #else p->addhoriz(-(p->hard_landing << 4)); @@ -4157,7 +4161,7 @@ HORIZONLY: p->hard_landing--; } -#if 0 +#ifdef SYNCINPUT if (p->aim_mode) p->horiz += sync[snum].horz >> 1; else if (!p->recoil) diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 335ae3b68..a8cfdb79a 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -138,10 +138,10 @@ void resetplayerstats(int snum) p->jetpack_on = 0; p->holoduke_on = -1; - p->look_ang = 512 - ((currentLevel->levelNumber & 1) << 10); + p->setlookang(512 - ((currentLevel->levelNumber & 1) << 10)); - p->rotscrnang = 0; - p->orotscrnang = 1; // JBF 20031220 + p->q16rotscrnang = 0; + //p->orotscrnang = 1; // JBF 20031220 p->newowner =-1; p->jumping_counter = 0; p->hard_landing = 0; diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index 94003aefa..b9628b995 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -535,15 +535,19 @@ void displayrooms(int snum, int smoothratio) setdrugmode(p, i); } +#ifndef SYNCINPUT + renderSetRollAngle(p->getrotscrnang()); +#else renderSetRollAngle(p->orotscrnang + mulscale16(((p->rotscrnang - p->orotscrnang + 1024) & 2047) - 1024, smoothratio)); p->orotscrnang = p->rotscrnang; // JBF: save it for next time +#endif if ((snum == myconnectindex) && (numplayers > 1)) { cposx = omyx + mulscale16((int)(myx - omyx), smoothratio); cposy = omyy + mulscale16((int)(myy - omyy), smoothratio); cposz = omyz + mulscale16((int)(myz - omyz), smoothratio); -#if 0 +#ifdef SYNCINPUT cang = omyang + mulscale16((int)(((myang + 1024 - omyang) & 2047) - 1024), smoothratio); choriz = omyhoriz + omyhorizoff + mulscale16((int)(myhoriz + myhorizoff - omyhoriz - omyhorizoff), smoothratio); #else @@ -557,7 +561,7 @@ void displayrooms(int snum, int smoothratio) cposx = p->oposx + mulscale16((int)(p->posx - p->oposx), smoothratio); cposy = p->oposy + mulscale16((int)(p->posy - p->oposy), smoothratio); cposz = p->oposz + mulscale16((int)(p->posz - p->oposz), smoothratio); -#if 0 +#ifdef SYNCINPUT // Original code for when the values are passed through the sync struct cang = p->getoang() + mulscale16((int)(((p->getang() + 1024 - p->getoang()) & 2047) - 1024), smoothratio); choriz = p->ohoriz+p->ohorizoff+mulscale16((int)(p->gethorizsum()-p->ohoriz-p->ohorizoff),smoothratio); @@ -567,7 +571,7 @@ void displayrooms(int snum, int smoothratio) choriz = p->gethorizsum(); #endif } - cang += p->look_ang; + cang += p->getlookang(); if (p->newowner >= 0) { diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index c48b7ddc2..e46783b1d 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -90,7 +90,7 @@ struct player_struct }; // input handles angle and horizon as fixed16 numbers. We need to account for that as well. - fixed_t q16ang, oq16ang, q16horiz, q16horizoff; // oq16horiz, oq16horizoff; // These two are currently not used but may be again later. + fixed_t q16ang, oq16ang, q16horiz, q16horizoff, q16rotscrnang, q16look_ang; // oq16horiz, oq16horizoff, orotscrnang, ; // These three are currently not used but may be again later. // using a bit field for this to save a bit of space. FixedBitArray gotweapon; @@ -114,7 +114,7 @@ struct player_struct int aim_mode, auto_aim, weaponswitch; - short angvel, cursectnum, look_ang, last_extra, subweapon; + short angvel, cursectnum, last_extra, subweapon; short ammo_amount[MAX_WEAPONS], wackedbyactor, frag, fraggedself; short curr_weapon, last_weapon, tipincs, wantweaponfire; @@ -131,7 +131,7 @@ struct player_struct short weaprecs[256], weapreccnt; unsigned int interface_toggle_flag; - short orotscrnang, rotscrnang, dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang + short dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang short scuba_amount, jetpack_amount, steroids_amount, shield_amount; short holoduke_on, pycount, weapon_pos, frag_ps; short transporter_hold, last_full_weapon, footprintshade, boot_amount; @@ -190,12 +190,12 @@ struct player_struct int8_t crouch_toggle; // Access helpers for the widened angle and horizon fields. - int getlookang() { return look_ang; } - void setlookang(int b) { look_ang = b; } - void addlookang(int b) { look_ang += b; } - int getrotscrnang() { return rotscrnang; } - void setrotscrnang(int b) { rotscrnang = b; } - void addrotscrnang(int b) { rotscrnang += b; } + int getlookang() { return q16look_ang >> FRACBITS; } + void setlookang(int b) { q16look_ang = b << FRACBITS; } + void addlookang(int b) { q16look_ang += b << FRACBITS; } + int getrotscrnang() { return q16rotscrnang >> FRACBITS; } + void setrotscrnang(int b) { q16rotscrnang = b << FRACBITS; } + void addrotscrnang(int b) { q16rotscrnang += b << FRACBITS; } int getang() { return q16ang >> FRACBITS; } int getoang() { return oq16ang >> FRACBITS; } void setang(int v) { q16ang = v << FRACBITS; } diff --git a/source/games/duke/src/zz_player.cpp b/source/games/duke/src/zz_player.cpp index 73df03304..d571da812 100644 --- a/source/games/duke/src/zz_player.cpp +++ b/source/games/duke/src/zz_player.cpp @@ -88,15 +88,13 @@ void P_GetInput(int const playerNum) { auto &thisPlayer = g_player[playerNum]; auto const pPlayer = &ps[playerNum]; + auto const pSprite = &sprite[pPlayer->i]; ControlInfo info; auto const currentHiTicks = timerGetHiTicks(); elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks; thisPlayer.lastInputTicks = currentHiTicks; - if (elapsedInputTicks == currentHiTicks) - return; - if (paused) { @@ -149,13 +147,9 @@ void P_GetInput(int const playerNum) if (!in_mouseflip) input.q16horz = -input.q16horz; - input.q16horz = fix16_ssub(input.q16horz, fix16_from_int(info.dpitch * analogTurnAmount / analogExtent)); - input.svel -= info.dx * keyMove / analogExtent; - input.fvel -= info.dz * keyMove / analogExtent; - - static double lastInputTicks; - - lastInputTicks = currentHiTicks; + input.q16horz = fix16_ssub(input.q16horz, fix16_from_dbl(scaleAdjustmentToInterval(info.dpitch))); + input.svel -= scaleAdjustmentToInterval(info.dx * keyMove); + input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove); if (buttonMap.ButtonDown(gamefunc_Strafe)) { @@ -372,6 +366,11 @@ void P_GetInput(int const playerNum) { localInput.q16avel = fix16_sadd(localInput.q16avel, input.q16avel); pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, input.q16avel) & 0x7FFFFFF; + + if (input.q16avel) + { + pPlayer->one_eighty_count = 0; + } } if (!(movementLocked & IL_NOHORIZ)) @@ -380,7 +379,55 @@ void P_GetInput(int const playerNum) pPlayer->q16horiz = fix16_clamp(fix16_sadd(pPlayer->q16horiz, input.q16horz), F16(HORIZ_MIN), F16(HORIZ_MAX)); } } + // don't adjust rotscrnang and look_ang if dead. + if (pSprite->extra > 0) + { + pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(fix16_sdiv(pPlayer->q16rotscrnang, fix16_from_int(2)))))); + if (pPlayer->q16rotscrnang && !fix16_sdiv(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(2)))) + pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(ksgn(fix16_to_int(pPlayer->q16rotscrnang))))); + + pPlayer->q16look_ang = fix16_ssub(pPlayer->q16look_ang, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(fix16_sdiv(pPlayer->q16look_ang, fix16_from_int(4)))))); + + if (pPlayer->q16look_ang && !fix16_sdiv(pPlayer->q16look_ang, fix16_from_dbl(scaleAdjustmentToInterval(4)))) + pPlayer->q16look_ang = fix16_ssub(pPlayer->q16look_ang, fix16_from_dbl(scaleAdjustmentToInterval(ksgn(fix16_to_int(pPlayer->q16look_ang))))); + + if (thisPlayer.lookLeft) + { + pPlayer->q16look_ang = fix16_ssub(pPlayer->q16look_ang, fix16_from_dbl(scaleAdjustmentToInterval(152))); + pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24))); + } + if (thisPlayer.lookRight) + { + pPlayer->q16look_ang = fix16_sadd(pPlayer->q16look_ang, fix16_from_dbl(scaleAdjustmentToInterval(152))); + pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24))); + } + +#if 0 + if (pPlayer->one_eighty_count < 0) + { + pPlayer->one_eighty_count = -fix16_to_int(fix16_abs(G_GetQ16AngleDelta(pPlayer->one_eighty_target, pPlayer->q16ang))); + pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, fix16_max(fix16_one, fix16_from_dbl(scaleAdjustmentToInterval(-pPlayer->one_eighty_count / ONEEIGHTYSCALE)))) & 0x7FFFFFF; + } +#endif + + if (isRRRA() && pPlayer->SeaSick) + { + if (pPlayer->SeaSick < 250) + { + if (pPlayer->SeaSick >= 180) + pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24))); + else if (pPlayer->SeaSick >= 130) + pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24))); + else if (pPlayer->SeaSick >= 70) + pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24))); + else if (pPlayer->SeaSick >= 20) + pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24))); + } + if (pPlayer->SeaSick < 250) + pPlayer->q16look_ang = fix16_sadd(pPlayer->q16look_ang, fix16_from_dbl(scaleAdjustmentToInterval((krand2()&255)-128))); + } + } // A horiz diff of 128 equal 45 degrees, so we convert horiz to 1024 angle units if (thisPlayer.horizAngleAdjust) @@ -391,14 +438,15 @@ void P_GetInput(int const playerNum) } else if (pPlayer->return_to_center > 0) { - pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(fix16_from_dbl(200 / 3) - fix16_sdiv(pPlayer->q16horiz, F16(1.5)))))); + pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(fix16_from_dbl(66.535) - fix16_sdiv(pPlayer->q16horiz, fix16_from_dbl(1.505)))))); - if ((pPlayer->q16horiz >= F16(99.9) && pPlayer->q16horiz <= F16(100.1))) + if (pPlayer->q16horiz >= F16(99) && pPlayer->q16horiz <= F16(101)) { pPlayer->q16horiz = F16(100); + pPlayer->return_to_center = 0; } - if (pPlayer->q16horizoff >= F16(-0.1) && pPlayer->q16horizoff <= F16(0.1)) + if (pPlayer->q16horizoff >= F16(-1) && pPlayer->q16horizoff <= F16(1)) pPlayer->q16horizoff = 0; } @@ -432,7 +480,7 @@ void P_GetInput(int const playerNum) } if (thisPlayer.horizSkew) - pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(thisPlayer.horizSkew)))); + pPlayer->q16horiz = fix16_sadd(pPlayer->q16horiz, fix16_from_dbl(scaleAdjustmentToInterval(thisPlayer.horizSkew))); pPlayer->q16horiz = fix16_clamp(pPlayer->q16horiz, F16(HORIZ_MIN), F16(HORIZ_MAX)); } @@ -441,8 +489,13 @@ void P_GetInputMotorcycle(int playerNum) { auto &thisPlayer = g_player[playerNum]; auto const pPlayer = &ps[playerNum]; + auto const pSprite = &sprite[pPlayer->i]; ControlInfo info; + auto const currentHiTicks = timerGetHiTicks(); + elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks; + thisPlayer.lastInputTicks = currentHiTicks; + if (paused) { if (!(pPlayer->gm&MODE_MENU)) @@ -466,23 +519,15 @@ void P_GetInputMotorcycle(int playerNum) // JBF: Run key behaviour is selectable int const playerRunning = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run)); - constexpr int analogTurnAmount = (NORMALTURN << 1); int const keyMove = playerRunning ? (NORMALKEYMOVE << 1) : NORMALKEYMOVE; - constexpr int analogExtent = 32767; // KEEPINSYNC sdlayer.cpp input_t input {}; - input.q16avel = fix16_sadd(input.q16avel, fix16_sdiv(fix16_from_int(info.mousex), F16(32))); - input.q16avel = fix16_sadd(input.q16avel, fix16_from_int(info.dyaw / analogExtent * (analogTurnAmount << 1))); + input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(info.mousex)); + input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw))); - input.svel -= info.dx * keyMove / analogExtent; - input.fvel -= info.dz * keyMove / analogExtent; - - static double lastInputTicks; - auto const currentHiTicks = timerGetHiTicks(); - double const elapsedInputTicks = currentHiTicks - lastInputTicks; - - lastInputTicks = currentHiTicks; + input.svel -= scaleAdjustmentToInterval(info.dx * keyMove); + input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove); pPlayer->crouch_toggle = 0; @@ -512,22 +557,18 @@ void P_GetInputMotorcycle(int playerNum) if (buttonMap.ButtonDown(gamefunc_Dpad_Aiming)) input.fvel = 0; - int turnAmount; int const turn = input.q16avel / 32; int turnLeft = buttonMap.ButtonDown(gamefunc_Turn_Left) || buttonMap.ButtonDown(gamefunc_Strafe_Left); int turnRight = buttonMap.ButtonDown(gamefunc_Turn_Right) || buttonMap.ButtonDown(gamefunc_Strafe_Right); int avelScale = F16((turnLeft || turnRight) ? 1 : 0); if (turn) { - turnAmount = (MOTOTURN << 1); avelScale = fix16_max(avelScale, fix16_clamp(fix16_mul(turn, turn),0,F16(1))); if (turn < 0) turnLeft = 1; else if (turn > 0) turnRight = 1; } - else - turnAmount = MOTOTURN; input.svel = input.fvel = input.q16avel = 0; @@ -544,13 +585,13 @@ void P_GetInputMotorcycle(int playerNum) { if (turnLeft) { - pPlayer->TiltStatus--; + pPlayer->TiltStatus -= scaleAdjustmentToInterval(1); if (pPlayer->TiltStatus < -10) pPlayer->TiltStatus = -10; } else if (turnRight) { - pPlayer->TiltStatus++; + pPlayer->TiltStatus += scaleAdjustmentToInterval(1); if (pPlayer->TiltStatus > 10) pPlayer->TiltStatus = 10; } @@ -560,43 +601,43 @@ void P_GetInputMotorcycle(int playerNum) if (turnLeft || pPlayer->moto_drink < 0) { turnHeldTime += elapsedTics; - pPlayer->TiltStatus--; + pPlayer->TiltStatus -= scaleAdjustmentToInterval(1); if (pPlayer->TiltStatus < -10) pPlayer->TiltStatus = -10; if (turnHeldTime >= TURBOTURNTIME && pPlayer->MotoSpeed > 0) { if (moveBack) - input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount))); + input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 40 : 20))); else - input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount))); + input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 40 : 20))); } else { if (moveBack) - input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / (8 / 3)))); + input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 20 : 6))); else - input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / (8 / 3)))); + input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 20 : 6))); } } else if (turnRight || pPlayer->moto_drink > 0) { turnHeldTime += elapsedTics; - pPlayer->TiltStatus++; + pPlayer->TiltStatus += scaleAdjustmentToInterval(1); if (pPlayer->TiltStatus > 10) pPlayer->TiltStatus = 10; if (turnHeldTime >= TURBOTURNTIME && pPlayer->MotoSpeed > 0) { if (moveBack) - input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount))); + input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 40 : 20))); else - input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount))); + input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 40 : 20))); } else { if (moveBack) - input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / (8 / 3)))); + input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 20 : 6))); else - input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / (8 / 3)))); + input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 20 : 6))); } } else @@ -604,12 +645,15 @@ void P_GetInputMotorcycle(int playerNum) turnHeldTime = 0; if (pPlayer->TiltStatus > 0) - pPlayer->TiltStatus--; + pPlayer->TiltStatus -= scaleAdjustmentToInterval(1); else if (pPlayer->TiltStatus < 0) - pPlayer->TiltStatus++; + pPlayer->TiltStatus += scaleAdjustmentToInterval(1); } } + if (pPlayer->TiltStatus > -0.025 && pPlayer->TiltStatus < 0.025) + pPlayer->TiltStatus = 0; + if (pPlayer->moto_underwater) { pPlayer->MotoSpeed = 0; @@ -621,18 +665,68 @@ void P_GetInputMotorcycle(int playerNum) localInput.bits |= buttonMap.ButtonDown(gamefunc_Run) << SK_CROUCH; } - input.q16avel = fix16_mul(input.q16avel, avelScale); - localInput.q16avel = fix16_sadd(localInput.q16avel, input.q16avel); - pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, input.q16avel) & 0x7FFFFFF; - localInput.fvel = clamp((input.fvel += pPlayer->MotoSpeed), -(MAXVELMOTO / 8), MAXVELMOTO); + input.fvel += pPlayer->MotoSpeed; + input.q16avel = fix16_mul(input.q16avel, avelScale); + + int const movementLocked = P_CheckLockedMovement(playerNum); + + if ((ud.scrollmode && ud.overhead_on) || (movementLocked & IL_NOTHING) == IL_NOTHING) + { + if (ud.scrollmode && ud.overhead_on) + { + ud.folfvel = input.fvel; + ud.folavel = fix16_to_int(input.q16avel); + } + + localInput.fvel = localInput.svel = 0; + localInput.q16avel = localInput.q16horz = 0; + } + else + { + if (!(movementLocked & IL_NOMOVE)) + { + localInput.fvel = clamp(input.fvel, -(MAXVELMOTO / 8), MAXVELMOTO); + } + + if (!(movementLocked & IL_NOANGLE)) + { + localInput.q16avel = fix16_sadd(localInput.q16avel, input.q16avel); + pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, input.q16avel) & 0x7FFFFFF; + } + } + + // don't adjust rotscrnang and look_ang if dead. + if (pSprite->extra > 0) + { + if (isRRRA() && pPlayer->SeaSick) + { + if (pPlayer->SeaSick < 250) + { + if (pPlayer->SeaSick >= 180) + pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24))); + else if (pPlayer->SeaSick >= 130) + pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24))); + else if (pPlayer->SeaSick >= 70) + pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24))); + else if (pPlayer->SeaSick >= 20) + pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24))); + } + if (pPlayer->SeaSick < 250) + pPlayer->q16look_ang = fix16_sadd(pPlayer->q16look_ang, fix16_from_dbl(scaleAdjustmentToInterval((krand2()&255)-128))); + } + } } void P_GetInputBoat(int playerNum) { auto &thisPlayer = g_player[playerNum]; auto const pPlayer = &ps[playerNum]; + auto const pSprite = &sprite[pPlayer->i]; ControlInfo info; + auto const currentHiTicks = timerGetHiTicks(); + elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks; + thisPlayer.lastInputTicks = currentHiTicks; if (paused) { if (!(pPlayer->gm&MODE_MENU)) @@ -662,17 +756,11 @@ void P_GetInputBoat(int playerNum) input_t input {}; - input.q16avel = fix16_sadd(input.q16avel, fix16_sdiv(fix16_from_int(info.mousex), F16(32))); - input.q16avel = fix16_sadd(input.q16avel, fix16_from_int(info.dyaw / analogExtent * (analogTurnAmount << 1))); + input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(info.mousex)); + input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw))); - input.svel -= info.dx * keyMove / analogExtent; - input.fvel -= info.dz * keyMove / analogExtent; - - static double lastInputTicks; - auto const currentHiTicks = timerGetHiTicks(); - double const elapsedInputTicks = currentHiTicks - lastInputTicks; - - lastInputTicks = currentHiTicks; + input.svel -= scaleAdjustmentToInterval(info.dx * keyMove); + input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove); pPlayer->crouch_toggle = 0; @@ -702,22 +790,18 @@ void P_GetInputBoat(int playerNum) if (buttonMap.ButtonDown(gamefunc_Dpad_Aiming)) input.fvel = 0; - int turnAmount; int const turn = input.q16avel / 32; int turnLeft = buttonMap.ButtonDown(gamefunc_Turn_Left) || buttonMap.ButtonDown(gamefunc_Strafe_Left); int turnRight = buttonMap.ButtonDown(gamefunc_Turn_Right) || buttonMap.ButtonDown(gamefunc_Strafe_Right); int avelScale = F16((turnLeft || turnRight) ? 1 : 0); if (turn) { - turnAmount = (MOTOTURN << 1); avelScale = fix16_max(avelScale, fix16_clamp(fix16_mul(turn, turn),0,F16(1))); if (turn < 0) turnLeft = 1; else if (turn > 0) turnRight = 1; } - else - turnAmount = MOTOTURN; input.svel = input.fvel = input.q16avel = 0; @@ -739,47 +823,47 @@ void P_GetInputBoat(int playerNum) turnHeldTime += elapsedTics; if (!pPlayer->NotOnWater) { - pPlayer->TiltStatus--; + pPlayer->TiltStatus -= scaleAdjustmentToInterval(1); if (pPlayer->TiltStatus < -10) pPlayer->TiltStatus = -10; if (turnHeldTime >= TURBOTURNTIME) - input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount))); + input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 40 : 20))); else - input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / (10 / 3)))); + input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 12 : 6))); } else if (turnHeldTime >= TURBOTURNTIME) - input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / 3))); + input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 12 : 6))); else - input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval((turnAmount / (10 / 3)) / 3))); + input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 4 : 2))); } else if (turnRight || pPlayer->moto_drink > 0) { turnHeldTime += elapsedTics; if (!pPlayer->NotOnWater) { - pPlayer->TiltStatus++; + pPlayer->TiltStatus += scaleAdjustmentToInterval(1); if (pPlayer->TiltStatus > 10) pPlayer->TiltStatus = 10; if (turnHeldTime >= TURBOTURNTIME) - input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount))); + input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 40 : 20))); else - input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / (10 / 3)))); + input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 12 : 6))); } else if (turnHeldTime >= TURBOTURNTIME) - input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount / 3))); + input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 12 : 6))); else - input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval((turnAmount / (10 / 3)) / 3))); + input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turn ? 4 : 2))); } else if (!pPlayer->NotOnWater) { turnHeldTime = 0; if (pPlayer->TiltStatus > 0) - pPlayer->TiltStatus--; + pPlayer->TiltStatus -= scaleAdjustmentToInterval(1); else if (pPlayer->TiltStatus < 0) - pPlayer->TiltStatus++; + pPlayer->TiltStatus += scaleAdjustmentToInterval(1); } } else if (!pPlayer->NotOnWater) @@ -787,15 +871,64 @@ void P_GetInputBoat(int playerNum) turnHeldTime = 0; if (pPlayer->TiltStatus > 0) - pPlayer->TiltStatus--; + pPlayer->TiltStatus -= scaleAdjustmentToInterval(1); else if (pPlayer->TiltStatus < 0) - pPlayer->TiltStatus++; + pPlayer->TiltStatus += scaleAdjustmentToInterval(1); } - input.q16avel = fix16_mul(input.q16avel, avelScale); - localInput.q16avel = fix16_sadd(localInput.q16avel, input.q16avel); - pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, input.q16avel) & 0x7FFFFFF; - localInput.fvel = clamp((input.fvel += pPlayer->MotoSpeed), -(MAXVELMOTO / 8), MAXVELMOTO); + if (pPlayer->TiltStatus > -0.025 && pPlayer->TiltStatus < 0.025) + pPlayer->TiltStatus = 0; + + input.fvel += pPlayer->MotoSpeed; + input.q16avel = fix16_mul(input.q16avel, avelScale); + + int const movementLocked = P_CheckLockedMovement(playerNum); + + if ((ud.scrollmode && ud.overhead_on) || (movementLocked & IL_NOTHING) == IL_NOTHING) + { + if (ud.scrollmode && ud.overhead_on) + { + ud.folfvel = input.fvel; + ud.folavel = fix16_to_int(input.q16avel); + } + + localInput.fvel = localInput.svel = 0; + localInput.q16avel = localInput.q16horz = 0; + } + else + { + if (!(movementLocked & IL_NOMOVE)) + { + localInput.fvel = clamp(input.fvel, -(MAXVELMOTO / 8), MAXVELMOTO); + } + + if (!(movementLocked & IL_NOANGLE)) + { + localInput.q16avel = fix16_sadd(localInput.q16avel, input.q16avel); + pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, input.q16avel) & 0x7FFFFFF; + } + } + + // don't adjust rotscrnang and look_ang if dead. + if (pSprite->extra > 0) + { + if (isRRRA() && pPlayer->SeaSick) + { + if (pPlayer->SeaSick < 250) + { + if (pPlayer->SeaSick >= 180) + pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24))); + else if (pPlayer->SeaSick >= 130) + pPlayer->q16rotscrnang = fix16_ssub(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24))); + else if (pPlayer->SeaSick >= 70) + pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24))); + else if (pPlayer->SeaSick >= 20) + pPlayer->q16rotscrnang = fix16_sadd(pPlayer->q16rotscrnang, fix16_from_dbl(scaleAdjustmentToInterval(24))); + } + if (pPlayer->SeaSick < 250) + pPlayer->q16look_ang = fix16_sadd(pPlayer->q16look_ang, fix16_from_dbl(scaleAdjustmentToInterval((krand2()&255)-128))); + } + } } void GetInput()