Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
xttl

mouselook/freelook for vanilla Heretic, Hexen and Strife

Recommended Posts

Ever wanted to play vanilla Heretic or Hexen with mouselook or freelook like in ZDoom and other advanced ports? Well now you can!

First, disable internal mouse support from Setup (set your controller to keyboard only). Then, download this little program, place it into the same directory with your vanilla game executable file and run it.

Sensitivity and button mappings can be adjusted with command line parameters, use ravmouse -? to see how.

It works fine in demos and netgames even if the other players do not have ravmouse. It should also work fine with Heretic+, Hexen+, heretic.com and any other EXE hacks you might be using since it doesn't modify the executable at all.

Tested in DOSBox only so far but I see no reason why it wouldn't work on real hardware.

Source code (for 16-bit Open Watcom) here if you're interested.

EXE hack for Strife, this one does not support demos or multiplayer...

Share this post


Link to post

I expected slow keyboard-like handling, but I was pleasantly surprised.

Since decent mouse look is possible with the original executables, maybe Chocolate Heretic and Hexen (and Strife?) could have this option.

Share this post


Link to post

It uses this: http://doomwiki.org/wiki/External_control_driver

Because the external input driver API in Heretic and Hexen was intended to be used (among other things) by VR hardware with head tracking, it allowss setting the view pitch and yaw in the game. Since vertical aiming is always locked (when autoaim doesn't kick in, anyway) to the orientation of the camera, or your head, setting the pitch field is actually also useful for implementing real functional mouselook in vanilla even though this'd be considered a limitation in real VR use.

I don't know if this is possible to do in Strife, it definitely has support for external control drivers but since it isn't open source, I don't know the buffer format and whether it allows for something like this. If it is possible, I'll add support for Strife later. nope, but have a hacked EXE instead

I may also improve the program otherwise, would be handy to have the settings in a configuration file at least, perhaps integrate the functionality of Heretic/Hexen+ or heretic.com.

Share this post


Link to post

Edit: Disregard, this was a problem with how I setup dosbox. Neat stuff!

Neat, I got horizontal mouse movement and the mappings working, but I can't seem to get vertical mouselook to work. I created a new hexen.cfg and set it to keyboard only and tried playing with -vs values.. no dice though.

Share this post


Link to post

Turns out it is not possible to use an external input driver to do this in Strife, so here is a hacked EXE for that instead. This one will break demos and multiplayer, but since Strife does not support coop, nobody plays Strife deathmatch and vanilla Strife demo recording is broken in SP anyway I don't think it matters.

Just run that instead of strife1.exe, no way to adjust vertical sensitivity separately from horizontal, at least not yet but I hope the hardcoded divisor feels ok.

Share this post


Link to post

Will you do a little write up about your findings before you forget the specifics?

I'm talking about the strife hacked exe, since you provided the code for the tool. Also, thanks and a job well done !! I will test it out for myself in the next days.

Share this post


Link to post

Ok. The patch for Strife is actually quite simple, it works like this:

First, as in all games using the Doom engine, there is a function called G_BuildTiccmd. This function builds ticcmds based on input from keyboard, mouse, joystick, or an external control driver. As you may already know, these ticcmds are what get sent over the network in multiplayer games and (partially) recorded in demo files. Unlike Heretic and Hexen, Strife's ticcmds do not support fine control over how much the player is turning up/down on any given gametic. Instead, there are only 3 extended button flags (0/1 toggles) provided for this. (Chocolate Strife calls them BT2_CENTERVIEW, BT2_LOOKUP and BT2_LOOKDOWN)

Anyway, inside this same function, global variable mousey (set by G_Responder) is used for adjusting forwards/backwards movement for the current ticcmd. Basically, the patch works by changing "forward += mousey;" to:

players[0].pitch += mousey >> 3;
if (players[0].pitch > LOOKUPMAX)
  players[0].pitch = LOOKUPMAX;
else if (players[0].pitch < LOOKDOWNMAX)
  players[0].pitch = LOOKDOWNMAX;
Since this bypasses the ticcmd system and just writes to player #1's player_t structure directly it won't work over the network or get recorded in demos. (However, on the other hand, it actually allows for slightly finer control over looking up/down than is possible in Heretic and Hexen via ticcmds!)

I also removed this part
    if (cmd->buttons2 & BT2_CENTERVIEW)
        player->centerview = 1;

    if (player->centerview)
    {
        if (player->pitch <= 0)
        {
            if (player->pitch < 0)
                player->pitch = player->pitch + CENTERVIEWAMOUNT;
        }
        else
        {
            player->pitch = player->pitch - CENTERVIEWAMOUNT;
        }
        if (abs(player->pitch) < CENTERVIEWAMOUNT)
        {
            player->pitch = 0;
            player->centerview = 0;
        }
    }
from P_MovePlayer completely to free some space for patching the binary equivalent of the first code snippet in. Doing this also handily prevents automatic view centering every time you try to press the run key (or all the time if you're using the always run hack) or fall down from a jump.

Share this post


Link to post

Your links are all broken for me.

Nice hack though. Reminds me that I never got around to updating my Control API library code to support the -externdriver mechanism.

Share this post


Link to post

I updated the driver for Heretic and Hexen a bit. New binary and source. Source code is also available from here in case there's a problem with those links.

It supports binding actions to double clicks now. The default double click timing window is 20 gametics (approx. 0,6 seconds), the same length as the internal mouse support of those games use, this can be adjusted from the command line with -dctics. By default, double clicking the left mouse button does nothing, double clicking the right button acts as the use key and double clicking the middle button will center your view.

View centering also actually works now (from the mouse, still not from keyboard but in the previous version it didn't work at all) and is why I added double clicking support, since it's not an action I wanted to waste a button on but which can still be useful: level changes, respawns and restarting the game or loading a save from the menu can cause the game's idea and the driver's idea of the current view pitch to go out of sync with each other, which will prevent you from looking up/down all the way until you resynchronize them. In the previous version this could be done by moving the mouse enough in the direction opposite the way you couldn't look, but now you can just bind something to the centerview action.

Also, it automatically passes -nomouse to the game now so you don't have to write it yourself anymore or remember to disable internal mouse support from setup.

I wish there was a way to get notified of level changes, restarts and any other events which may reset the view pitch but seems that's not possible without patching the games (and might as well make the mlook support internal at that point...)

Share this post


Link to post

Dos your Heretic patch build onto Heretic Plus? (You know, Heretic, patched to support higher limits, like visplanes, and samegame size?). By the way, very nice modifications - this is great stuff!

Share this post


Link to post
kb1 said:

Dos your Heretic patch build onto Heretic Plus? (You know, Heretic, patched to support higher limits, like visplanes, and samegame size?). By the way, very nice modifications - this is great stuff!


It does not need to patch the EXE at all so yes, it'll work with Heretic+ or Hexen+. It would work even if you recompiled Heretic or Hexen from sources using Open Watcom with some drastic changes as long as you keep the -externdriver API intact.

Share this post


Link to post
xttl said:

It does not need to patch the EXE at all so yes, it'll work with Heretic+ or Hexen+. It would work even if you recompiled Heretic or Hexen from sources using Open Watcom with some drastic changes as long as you keep the -externdriver API intact.

Oh, duh, I got you. Very cool!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×