Skip to content

Commit

Permalink
split jump sway off from movement sway
Browse files Browse the repository at this point in the history
  • Loading branch information
Derpford committed Jan 19, 2022
1 parent 5b7ac47 commit 71c77bb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CVARINFO
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ nosave float sway_intensity_y = 1.0;
nosave float sway_intensity_z = 1.0;

nosave float turn_sway_intensity = 1.0;
nosave float vel_sway_intensity = 1.0;
nosave float vel_sway_intensity = 1.0;
nosave float jump_sway_intensity = 1.0;
5 changes: 3 additions & 2 deletions MENUDEF
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ OptionMenu "DampedWeaponOptions"
StaticText "Set to 0 to disable movement/turning sway.", "White"
StaticText "---", "White"
StaticText "", "White"
Slider "Movement Sway", vel_sway_intensity, 0.0, 2.0, 0.1, 1
Slider "Turning Sway", turn_sway_intensity, 0.0, 2.0, 0.1, 1
Slider "Movement Sway Intensity", vel_sway_intensity, 0.0, 2.0, 0.1, 1
Slider "Turning Sway Intensity", turn_sway_intensity, 0.0, 2.0, 0.1, 1
Slider "Jumping Sway Intensity", jump_sway_intensity, 0.0, 2.0, 0.1, 1
}

AddOptionMenu "OptionsMenu"
Expand Down
5 changes: 3 additions & 2 deletions zscript/damped.zs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mixin class DampedSpringWep
Vector3 offpos, offvel, offgoal;

CVar xint, yint, zint; // X, Y, Z intensity
CVar yawint, velint; // Yaw and Velocity intensity--separate from weapon animations
CVar yawint, velint, jumpint; // Yaw and Velocity intensity--separate from weapon animations

double ycap; // how far the sprite is allowed to go on the z axis
Property jumpcap : ycap;
Expand Down Expand Up @@ -132,6 +132,7 @@ mixin class DampedSpringWep

invoker.yawint = CVar.GetCVar("turn_sway_intensity",players[consoleplayer]);
invoker.velint = CVar.GetCVar("vel_sway_intensity",players[consoleplayer]);
invoker.jumpint = CVar.GetCVar("jump_sway_intensity",players[consoleplayer]);

let plr = invoker.owner.player;
let plrvel = (plr.cmd.sidemove,plr.cmd.forwardmove);
Expand All @@ -142,7 +143,7 @@ mixin class DampedSpringWep
plrvel = plrvel.Unit() * invoker.velint.getFloat();
}

double plrz = invoker.owner.vel.z * invoker.velint.getFloat();
double plrz = invoker.owner.vel.z * invoker.jumpint.getFloat();


/*
Expand Down

0 comments on commit 71c77bb

Please sign in to comment.