Rewrite NormalizedMove() now that I know how the raw axes work.
This commit is contained in:
parent
e3b3558f3a
commit
d99d772b0c
2 changed files with 10 additions and 8 deletions
|
|
@ -1,3 +1,3 @@
|
|||
[default]
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r443 \cu(Tue 13 Sep 14:05:39 CEST 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r443 \cu(2022-09-13 14:05:39)\c-";
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r444 \cu(Tue 13 Sep 15:18:33 CEST 2022)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r444 \cu(2022-09-13 15:18:33)\c-";
|
||||
|
|
|
|||
|
|
@ -311,16 +311,18 @@ Class Demolitionist : PlayerPawn
|
|||
}
|
||||
return 4;
|
||||
}
|
||||
// oof
|
||||
// directional movement without straferunning
|
||||
Vector2 NormalizedMove()
|
||||
{
|
||||
if ( !(player.cmd.forwardmove|player.cmd.sidemove) )
|
||||
return (0,0);
|
||||
Vector2 mvec = (player.cmd.forwardmove,-player.cmd.sidemove/.96);
|
||||
double maxval = max(abs(mvec.x),abs(mvec.y));
|
||||
// sorry, we don't use that here specifically, that's for tweakspeed to handle
|
||||
if ( !(player.cmd.buttons&BT_RUN) ) maxval *= 2.;
|
||||
return mvec.unit()*maxval;
|
||||
int idx = !!(player.cmd.buttons&BT_RUN);
|
||||
// ratio between forwardmove and sidemove (depending on BT_RUN state)
|
||||
double fs = gameinfo.normforwardmove[idx]/gameinfo.normsidemove[idx];
|
||||
// raw axes scaled to 1:1 ratio
|
||||
Vector2 mvec = (player.cmd.forwardmove,-player.cmd.sidemove*fs);
|
||||
// multiply unit vector back to "raw" running speed (as TweakSpeed handles the "true" scaling for us later)
|
||||
return mvec.unit()*gameinfo.normforwardmove[1]*256.;
|
||||
}
|
||||
double TweakSpeed()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue