Commit Graph

1430 Commits

Author SHA1 Message Date
Bill Currie 88692f92d9 Fix the calls for Draw_Init in the gl renderers.
While namehack.h took care of the symbol mangling, I do prefer the calls to
be correct as it reduces confusion.
2013-05-09 17:58:33 +09:00
Bill Currie 0f75bdce17 Set the default joystick preamp to 0.01.
At the request of johnnyonflame. I probably should have done this when I
removed the builtin 1/100 scaling from the joystick code.
2013-04-19 13:54:30 +09:00
Bill Currie 6d7f747577 Add timerefresh to the glsl renderer.
Also, tweak the formatting of the output for the other renderers (%g
instead of %f) and make gl's timerefresh output unconditional.
2013-02-18 13:57:45 +09:00
Bill Currie 9047c3e4ad Fix the invalid keydest errors.
Once and for all: remove the default and move the Sys_Error outside the
switch (changing appropriate breaks to returns). Now gcc will let me know
when I forget to update the switch statements.
2013-02-02 15:22:09 +09:00
Bill Currie bc12567572 Clean out a leftover from the 128 dlight change.
I'd missed a set of bit->lightnum conversions that resulting in lightnum
becoming much greater than 128 and thus trashing memory when the surface
was marked.
2013-01-31 22:39:23 +09:00
Bill Currie 37dfad8e04 Add a command to simulate typing.
It doesn't support backspace or enter yet, but it got the job done for now.
2013-01-29 14:44:33 +09:00
Bill Currie 8de4db0e2d Fix some sizeof snafus.
I'd failed to notice these earlier.
2013-01-28 21:52:18 +09:00
Bill Currie bc2fa38468 Provide support for axis names.
x/y/z and pitch/yaw/roll (or p/y/r). Johnny's numbers still work, too, of
course.
2013-01-28 21:09:21 +09:00
Bill Currie 9a24c99cf6 Remove the force 1/100 scaling.
That's part of amp's (or preamp's) job.
2013-01-28 19:37:48 +09:00
Bill Currie 5c08e97b0b Ensure the axis button's state starts at 0.
realloc doesn't do that for us.
2013-01-28 19:37:12 +09:00
Bill Currie 1811d00568 Use the correct index for pressing an axis button.
Oops.
2013-01-28 19:36:25 +09:00
Bill Currie 4163a3a8f2 Reduce the default deadzone to 500.
12500 seems a tad high when the range is +/- 32767.
2013-01-28 18:10:49 +09:00
Bill Currie 0ff66268e7 Redo the button axis setup to use key names.
Johnny's number->J_AXISn mapping is preserved, but I had intended for any
key to be supported (J_AXISn was just to ensure free keys were available).
This gives both methods (and some range checking on the axis button
number).
2013-01-28 18:06:30 +09:00
Bill Currie 42c2666036 Clear out some old cruft.
With the new joystic axis system, those cvars are no longer needed.
2013-01-28 18:06:06 +09:00
Bill Currie 475d90e96f Expose Key_StringToKeynum. 2013-01-28 16:34:29 +09:00
Bill Currie 173af3a992 Tweak the deadzone code to work better with pre-amp.
Everthing was fine with pre-amp == 1, but if it was anything else, the
offset would become invalid.
2013-01-27 14:30:13 +09:00
Bill Currie f5e1983e0f Produce prettier floats in the output. 2013-01-27 14:09:48 +09:00
Bill Currie dfbb68d573 Terminate the option arrays.
Before they terminate QF.
2013-01-27 14:08:01 +09:00
Bill Currie 1a33d2f682 Do a whitespace run.
Just for long-term sanity's sake.
2013-01-27 14:05:24 +09:00
Johnny on Flame e3e0d6aaa9 Add menu commands + fixes 2013-01-27 13:17:13 +09:00
Johnny on Flame ee436d89f6 More in-game console command documentation for in_joy 2013-01-27 13:17:13 +09:00
Johnny on Flame 86e7392e7a A few fixes + boundary checks 2013-01-27 13:17:12 +09:00
Johnny on Flame 637d751aa7 Saves axes behaviours on the config file. 2013-01-27 13:17:12 +09:00
Johnny on Flame 4f92bceb4f Joystick configuration commands. 2013-01-27 13:17:12 +09:00
Bill Currie b2e92c2864 Rewrite joy_axis and JOY_Move for axis buttons.
First, this completely smashes joystick input: it will not work (though it
doesn't crash). This is because there is, as of yet, no means to configure
the system.

Each joystick axis has:
    - per-axis amplification (both pre and post).
    - per-axis offset (offset applied after pre-amp but before post amp)
    - selectable destination:
        - linear delta: position and angles (as before)
        - axis button: if the value crosses the threshold, the given key is
          pressed or released as appropriate.

The axis amplification still uses joy_amp and joy_pre_amp (and
in_amp/in_pre_amp), but now also has the per-axis settings.

The per-axis offset is most useful for axis buttons. For example, the xbox
360 controller triggers are analong but go "all the way to negative on 0
state". Offsetting the input keeps axis button thresholds simple.

Amplification and offset is applied before anything is done with the axis
value. The formula is:

    joy_amp * in_amp * axis-amp *
        (offset + value * joy_pre_amp * in_pre_amp * axis-pre_amp)

Axis button thresholds are very simple: if the sign of the value is the
same as the sign of the threshold and abs(value) >= abs(threshold), the
button is pressed. While multiple thresholds and keys can be placed on an
axis, only one can be pressed at a time. The threshold furthest from 0
wins.
2013-01-23 13:15:02 +09:00
Bill Currie 35edfae2a0 Add keys for joystick axis buttons.
The idea is to allow a joystick axis to be mapped to button presses. These
allow the buttons to be bound without consuming other possibly valid keys.
2013-01-23 13:15:02 +09:00
Bill Currie e27d7cbd2d Handle alloca "correctly".
Use AC_FUNC_ALLOCA and the #ifdef mess suggested by the autoconf docs
(hidden in qfalloca.h).
2013-01-22 21:02:50 +09:00
Bill Currie f1aefc969d Fix some 64-bit mingw compile issues.
Just one more issue to fix (alloca), but with a hack, QF compiles (no clue
yet if it works: wine doesn't seem to be an option at this stage)
2013-01-22 21:02:49 +09:00
Bill Currie cb45d248c4 Use the Mersenne Twister for particles.
The seed is currently 0xdeadbeef, but I intend on fixing that soon. Now the
particle velocities and origins use fully independent bits (though a big
chunk is wasted right now).
2013-01-21 20:06:54 +09:00
Bill Currie 3de67589a3 Fix random particle origin/velocity z component.
This is a quick fix until I get a random number generator into QF.

Mingw's RAND_MAX is only 0x7fff and so the (((rnd >> 10) & 63) - 31.5) / 63.0
used for the z component of origin and velocity would never go positive.
For now, change the 10 to 9 (reusing another bit from Y). I plan on
implementing a full 32-bit PRNG in QF so we always have a reliable
generator.
2013-01-21 14:53:13 +09:00
Bill Currie 22ca96ea46 Put the key_dest default back to key_console.
For now, anyway. This is a quick emergency fix for qw-client crashing when
a key is pressed while the client is waiting at the console on startup.
2013-01-19 12:17:57 +09:00
Bill Currie ace8d9ebc5 Implement dynamic IMTs.
Now the user can create and destroy IMTs at will, though currently
destroying IMTs is currently all or nothing (imt_drop_all).

An IMT is created via imt_create which takes the keydest name (key_game
etc), the name of the IMT (must be unique for all IMTs) and optionally the
name of the IMT to which the key binding search will fall back if there is
no binding in the current IMT, but must be already defined and on the same
keydest. This means that IMTs now have user determined fallback paths. The
requirements for the fallback IMT prevent loops and other weird behaviour.

Actual key binding via in_bind is unaffected. This is why the IMT name must
be unique across all IMTs.

The "imt" command works with the key_game keydest, but imt_keydest is
provided for specifying the active IMT for a specific keydest.

At startup, default IMTs are setup to emulate the previous static IMTs so
old configs will continue to work (mostly). New config files will be
written with commands to drop all of the current IMTs and build new ones,
with the bindings and active IMT set as well.
2013-01-16 19:48:54 +09:00
Bill Currie ec6ba8a03c Make key_dest private to keys.c
This has the bonus feature of making nq pause the game when input focus is
lost (same conditions as dropping the console or bringing up the menu).
2013-01-16 19:48:54 +09:00
Bill Currie 2a3986368e Use callbacks for key repeat control. 2013-01-16 19:48:54 +09:00
Bill Currie cf0729c818 Support more than one keydest callback. 2013-01-16 19:48:54 +09:00
Bill Currie 3cb0f3e183 Remove viddef in favor of vid in the renderers.
This fixes the status bar refresh issues in sw. The problem was that with
two viddef's hanging around, things got a little confused and recalc_refdef
wasn't getting into the renderer.
2013-01-16 11:23:47 +09:00
Bill Currie a05e7253e4 Force a full update when the fade screen is drawn. 2013-01-13 20:34:39 +09:00
Bill Currie a8542c2d48 Correct the spelling of QFK_HIRAGANA_KATAKANA.
'twas QFK_HIRAGANA_kATAKANA. Took a while to spot it :P
2013-01-13 18:54:23 +09:00
Bill Currie e3b8157469 Create a new imt_menu imt.
It seems to work nicely as F10 no longer tries to quit while the menu is
displayed.
2013-01-13 18:19:00 +09:00
Bill Currie b18305351e Rename game_target to key_target.
Much better name :P
2013-01-13 18:14:16 +09:00
Bill Currie b1ddae927b Add a command to clear specific IMTs.
in_clear <imt>... where each argument to in_clear is an imt identifier. If
any identifiers are incorrect, the incorrect ones will be displayed and no
tables will be cleared. All or nothing.
2013-01-13 18:05:41 +09:00
Bill Currie 0c81364da8 Fix scr_copyeverything in gl and glsl.
Now the gl renderers unconditionally set it to 1. This is required because
the screen is cleared every frame.
2013-01-13 17:23:00 +09:00
Bill Currie 4a95f89760 Correct the handling of r_viewsize and lineadj.
r_viewsize is meant to be clamped to 100, but not limit linadj.
2013-01-13 16:53:22 +09:00
Bill Currie 86b95629cf Complete the move of some vars into vid_render_data.
scr_fullupdate and scr_copyeverything were missed. Possibly others too, but
this is enough for the moment.
2013-01-13 16:46:41 +09:00
Bill Currie 9c812f39ce Apply some wart remover.
hungarian notation... *twitch*
2013-01-13 16:07:11 +09:00
Bill Currie ed8b289315 Make sdl's VID_SetPalette only queue a palette change.
It seems that SDL_SetColors causes a page flip, so VID_SetPalette only
queue a palette change (by checking for the need to change and storing the
requested palete) and VID_Update now checks for a queued palette change and
updates SDL's palette if required. This fixes the flickering console in sw
-sdl introduced by the cshift/centerprint change.
2013-01-13 14:55:15 +09:00
Bill Currie 82a6861233 Move the call to VID_Update out of the if blocks.
This makes it obvious that VID_Update is unconditionally called when
SCR_UpdateScreen is called.
2013-01-13 14:43:19 +09:00
Bill Currie 5bbb76194f Use stdlib.h instead of alloca.h.
While the manpage does say alloca.h, that's not very portable, it seems.
stdlib.h seems to be better (at least for mingw, anyway)
2013-01-10 21:54:37 +09:00
Bill Currie 751417ffb2 Rename R_RecursiveWorldNode to R_VisitWorldNodes.
Finally, the name reflects its actual purpose.
2013-01-07 19:59:49 +09:00
Bill Currie a852eeb711 Remove the recursive versions of R_RecursiveWorldNode.
They seem to not be needed any more.
2013-01-07 19:57:21 +09:00