Export strafe key yaw override to zscript?

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
Caligari87
Admin
Posts: 6174
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Export strafe key yaw override to zscript?

Post by Caligari87 »

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.

8-)
User avatar
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?

Post by Caligari87 »

To add a little more detail, I found this in g_game.cpp

Code: Select all

if (strafe || lookstrafe)
    side += (int)((float)mousex * m_side);
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.

8-)
Gez
 
 
Posts: 17835
Joined: Fri Jul 06, 2007 3:22 pm

Re: Export strafe key yaw override to zscript?

Post by Gez »

The entire point of the strafe key is to convert turning into sideway move.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Export strafe key yaw override to zscript?

Post by Graf Zahl »

Caligari87 wrote:I can't override it in the player virtuals it to use the strafe key for anything else.
You shouldn't, actually. In this case you have to present your use case.
User avatar
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?

Post by Caligari87 »

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.

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
		}
	}
}
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.

8-)
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Export strafe key yaw override to zscript?

Post by Nash »

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...
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Export strafe key yaw override to zscript?

Post by Graf Zahl »

Indeed. Hijacking Strafe for this does not sound right.
User avatar
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?

Post by Caligari87 »

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.
That said, this seems to be clearly a [No] so I'll either skip the feature or find another way to make it work.

8-)
Last edited by Caligari87 on Sat Mar 24, 2018 8:55 am, edited 1 time in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Export strafe key yaw override to zscript?

Post by Graf Zahl »

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?
User avatar
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?

Post by Caligari87 »

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.

8-)
Post Reply

Return to “Feature Suggestions [GZDoom]”