Export strafe key yaw override to zscript?
Moderator: GZDoom Developers
- Caligari87
- Admin
- Posts: 6174
- Joined: Thu Feb 26, 2004 3:02 pm
- Preferred Pronouns: He/Him
- Contact:
Export strafe key yaw override to zscript?
I'm running GZDoom 3.2.5 on Linux.
I've noticed that the [strafe] key is hardcoded to override sidemove / mouse yaw. Is this intentional? Because it seems counterintuitive, and since it's hardcoded I can't override it in the player virtuals it to use the strafe key for anything else.
I've noticed that the [strafe] key is hardcoded to override sidemove / mouse yaw. Is this intentional? Because it seems counterintuitive, and since it's hardcoded I can't override it in the player virtuals it to use the strafe key for anything else.
- Caligari87
- Admin
- Posts: 6174
- Joined: Thu Feb 26, 2004 3:02 pm
- Preferred Pronouns: He/Him
- Contact:
Re: Export strafe key yaw override to zscript?
To add a little more detail, I found this in g_game.cpp
What effects would it have if that was changed to just "if (lookstrafe)" ? Mess with expected controller input or something? It seems to me that if lookstrafe is off, it shouldn't override the mouse movement.
Code: Select all
if (strafe || lookstrafe)
side += (int)((float)mousex * m_side);
Re: Export strafe key yaw override to zscript?
The entire point of the strafe key is to convert turning into sideway move.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Export strafe key yaw override to zscript?
You shouldn't, actually. In this case you have to present your use case.Caligari87 wrote:I can't override it in the player virtuals it to use the strafe key for anything else.
- Caligari87
- Admin
- Posts: 6174
- Joined: Thu Feb 26, 2004 3:02 pm
- Preferred Pronouns: He/Him
- Contact:
Re: Export strafe key yaw override to zscript?
I'm designing a new movement system for the mod I'm working on. In short, the player actor is just the head; the legs and torso are separate actors. Locomotion is acheived by imparting velocity to the legs, and the torso+head follows on a spring. I want idea to implement leaning (since the player's full-body hitbox is no longer relevant). To do this, I wanted to use the Strafe key as a toggle, to impart velocity to the player's head and torso instead of the legs.
This works perfectly (video demo), except for a small detail: The player's mouse yaw gets pushed into sidemove, meaning the player can no longer freelook and the leaning gets overriden by any mouse yaw behavior. I can take a video demo of this later if desired.
My suggestion is that the conversion/override should be exported to PlayerPawn, so this behavior can be overridden.
Code: Select all
void UpdateMove() {
let player = self.player;
UserCmd cmd = player.cmd;
if (player.onground) {
legs.vel.xy *= 0.75; //Decelerate
if(cmd.buttons & BT_STRAFE) {
vel.xy += rotateVector((moveVec.x, 0), angle - 90) * 5 / player.crouchfactor; //Move head
torso.vel.xy += rotateVector((moveVec.x, 0), angle - 90) * 5 / player.crouchfactor; //Move torso
legs.vel.xy += rotateVector((0, moveVec.y), angle - 90); //allow moving forward/back
}
else {
legs.vel.xy += rotateVector(moveVec, angle - 90); //Move legs
}
}
}
My suggestion is that the conversion/override should be exported to PlayerPawn, so this behavior can be overridden.
Re: Export strafe key yaw override to zscript?
Hmm sounds complicated. In most games with leaning, they just have separate key binds for leaning left and right, without messing with the move left/right keys...
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Export strafe key yaw override to zscript?
Indeed. Hijacking Strafe for this does not sound right.
- Caligari87
- Admin
- Posts: 6174
- Joined: Thu Feb 26, 2004 3:02 pm
- Preferred Pronouns: He/Him
- Contact:
Re: Export strafe key yaw override to zscript?
My reasoning:
- No one uses the strafe key for modern gameplay anymore. It's not "hijacking" if the mod is intended to be played with a mouse.
- I didn't expect the strafe key to be hardcoded in such an archaic and non-intuitive manner. Why not give it a potential use for things beyond keyboard-only Doom.
- Custom keybinds are 3rd-world citizens compared to the built-in keybinds accessible from GetPlayerInput or cmd.
- BT_USER keybinds are useless until keybindings are saved per-mod.
- I hate lean keys and wanted something closer to Arma's "stance adjust" modifier key.
Last edited by Caligari87 on Sat Mar 24, 2018 8:55 am, edited 1 time in total.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Export strafe key yaw override to zscript?
Caligari87 wrote:My reasoning:
- No one uses the strafe key for modern gameplay anymore. Why not give it a potential use for things beyond keyboard-only Doom.
That's a pretty bold assumption. Have you used all of GZDoom's users?
- Caligari87
- Admin
- Posts: 6174
- Joined: Thu Feb 26, 2004 3:02 pm
- Preferred Pronouns: He/Him
- Contact:
Re: Export strafe key yaw override to zscript?
I'm not targeting keyboard-only Doom players with this. I'm targeting modern control schemes that expect the presence of a mouse.
Feel free to move this to closed. I'll figure something else out.
Feel free to move this to closed. I'll figure something else out.