diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 259a02c11..43a0227e0 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -333,7 +333,7 @@ void hud_input(int plnum) { p->yehaa_timer = 126; S_PlayActorSound(390, pact); - p->noise_radius = 16384; + p->noise_radius = 1024; madenoise(plnum); if (p->cursector->lotag == 857) { diff --git a/source/games/duke/src/noise.cpp b/source/games/duke/src/noise.cpp index f898661cc..d5ddcf59f 100644 --- a/source/games/duke/src/noise.cpp +++ b/source/games/duke/src/noise.cpp @@ -35,25 +35,22 @@ int madenoise(int snum) player_struct *p; p = &ps[snum]; p->donoise = 1; - p->noise.X = p->player_int_pos().X; - p->noise.Y = p->player_int_pos().Y; + p->noise = p->pos.XY(); return 1; } int wakeup(DDukeActor* actor, int snum) { - player_struct *p; - int radius; - p = &ps[snum]; + auto p = &ps[snum]; if (!p->donoise) return 0; if (actor->spr.pal == 30 || actor->spr.pal == 32 || actor->spr.pal == 33 || (isRRRA() && actor->spr.pal == 8)) return 0; - radius = p->noise_radius; + double radius = p->noise_radius; - if (p->noise.X - radius < actor->int_pos().X && p->noise.X + radius > actor->int_pos().X - && p->noise.Y - radius < actor->int_pos().Y && p->noise.Y + radius > actor->int_pos().Y) + if (p->noise.X - radius < actor->spr.pos.X && p->noise.X + radius > actor->spr.pos.X + && p->noise.Y - radius < actor->spr.pos.Y && p->noise.Y + radius > actor->spr.pos.Y) return 1; return 0; } diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index e63d61228..e7c4f45ef 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -612,7 +612,7 @@ static void shootrpg(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atw if (p >= 0) { - aimed = aim(actor, 48); + aimed = aim(actor, AUTO_AIM_ANGLE); if (aimed) { if (isRRRA() && atwith == RPG2) @@ -1325,7 +1325,7 @@ int doincrements_r(player_struct* p) } if (numplayers < 2) { - p->noise_radius = 16384; + p->noise_radius = 1024; madenoise(screenpeek); p->vel.XY() += p->angle.ang.ToVector(); } @@ -2734,7 +2734,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) if (p->kickback_pic == 39) { p->hbomb_on = 0; - p->noise_radius = 8192; + p->noise_radius = 512; madenoise(snum); } if (p->kickback_pic == 12) @@ -2798,7 +2798,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) { fi.shoot(pact, SHOTSPARK1); S_PlayActorSound(PISTOL_FIRE, pact); - p->noise_radius = 8192; + p->noise_radius = 512; madenoise(snum); lastvisinc = PlayClock + 32; @@ -2876,7 +2876,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) S_PlayActorSound(SHOTGUN_FIRE, pact); - p->noise_radius = 8192; + p->noise_radius = 512; madenoise(snum); lastvisinc = PlayClock + 32; @@ -2988,7 +2988,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) S_PlayActorSound(CHAINGUN_FIRE, pact); fi.shoot(pact, CHAINGUN); - p->noise_radius = 8192; + p->noise_radius = 512; madenoise(snum); lastvisinc = PlayClock + 32; p->visibility = 0; @@ -3020,7 +3020,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) { p->okickback_pic = p->kickback_pic = 0; fi.shoot(pact, GROWSPARK); - p->noise_radius = 1024; + p->noise_radius = 64; madenoise(snum); checkavailweapon(p); } @@ -3048,7 +3048,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) lastvisinc = PlayClock + 32; S_PlayActorSound(CHAINGUN_FIRE, pact); fi.shoot(pact, SHOTSPARK1); - p->noise_radius = 16384; + p->noise_radius = 1024; madenoise(snum); p->ammo_amount[TIT_WEAPON]--; checkavailweapon(p); @@ -3075,7 +3075,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) lastvisinc = PlayClock + 32; S_PlayActorSound(CHAINGUN_FIRE, pact); fi.shoot(pact, CHAINGUN); - p->noise_radius = 16384; + p->noise_radius = 1024; madenoise(snum); p->ammo_amount[MOTORCYCLE_WEAPON]--; if (p->ammo_amount[MOTORCYCLE_WEAPON] <= 0) @@ -3123,7 +3123,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) if (p->kickback_pic == 5) { S_PlayActorSound(CAT_FIRE, pact); - p->noise_radius = 2048; + p->noise_radius = 128; madenoise(snum); } else if (p->kickback_pic == 9) @@ -3176,7 +3176,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) p->ammo_amount[BOWLING_WEAPON]--; S_PlayActorSound(354, pact); fi.shoot(pact, BOWLINGBALL); - p->noise_radius = 1024; + p->noise_radius = 64; madenoise(snum); } if (p->kickback_pic < 30) @@ -3199,7 +3199,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) if (p->kickback_pic == 12) { fi.shoot(pact, KNEE); - p->noise_radius = 1024; + p->noise_radius = 64; madenoise(snum); } else if (p->kickback_pic == 16) @@ -3217,7 +3217,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) if (p->kickback_pic == 8) { fi.shoot(pact, SLINGBLADE); - p->noise_radius = 1024; + p->noise_radius = 64; madenoise(snum); } else if (p->kickback_pic == 16) @@ -3237,7 +3237,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) lastvisinc = PlayClock + 32; p->visibility = 0; fi.shoot(pact, RPG); - p->noise_radius = 32768; + p->noise_radius = 2048; madenoise(snum); checkavailweapon(p); } @@ -3255,7 +3255,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp) lastvisinc = PlayClock + 32; p->visibility = 0; fi.shoot(pact, RPG2); - p->noise_radius = 32768; + p->noise_radius = 2048; madenoise(snum); checkavailweapon(p); } diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 5c8b2544f..d13e6fe5b 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -474,8 +474,8 @@ void resetprestat(int snum,int g) p->stairs = 0; //if (!isRRRA()) p->fogtype = 0; - p->noise.X = 131072; - p->noise.Y = 131072; + p->noise.X = 8192; + p->noise.Y = 8192; p->donoise = 0; p->noise_radius = 0; diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 06334292d..b50c89713 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -289,8 +289,8 @@ struct player_struct // Items were reordered by size. int stairs; int detonate_count; // at57e - vec2_t noise; - int noise_radius; // at286, at28a, at290 + DVector2 noise; + double noise_radius; // at286, at28a, at290 int drink_timer; // at58e int eat_timer; // at592 int SlotWin; diff --git a/wadsrc/static/zscript/games/duke/dukegame.zs b/wadsrc/static/zscript/games/duke/dukegame.zs index e00799c86..7879b5d6e 100644 --- a/wadsrc/static/zscript/games/duke/dukegame.zs +++ b/wadsrc/static/zscript/games/duke/dukegame.zs @@ -217,7 +217,7 @@ struct DukePlayer // Items were reordered by size. native int stairs; native int detonate_count; // at57e - native int noise_radius; // at286, at28a, at290 + native double noise_radius; // at286, at28a, at290 native int drink_timer; // at58e native int eat_timer; // at592 native int SlotWin;