Commit graph

9588 commits

Author SHA1 Message Date
Bill Currie
c376ac1ebd Add some #define magic for SOL_IP on BSD-based stacks. 2013-01-29 12:13:59 +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
8314edce4d Merge branch 'joystick'
This give much better control over individual joystick axes. They now have
per-axis pre and post amplification, the linear controller mappings are
more intuitive, and axes can now bet setup as buttons using thresholds.

Many thanks to Johnny on Flame for his work on the "user interface".
2013-01-28 18:14:16 +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
c6f9d8b64c Reduce CFLAGS abuse a little for mingw targets.
This fixes missing debug info (useful for fixing linker errors, if nothing
else).
2013-01-28 16:21:42 +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
dffe1598b8 Strip the executables.
While nq-sdl.exe was ok (~6.5MB vs ~4.2M), qw-client-sdl.exe was crazy:
~17MB vs ~7.4.
2013-01-23 22:09:54 +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
03246e220f Update for 0.7.2. 2013-01-23 12:01:36 +09:00
Bill Currie
b7d6ffa72e Build and package win64 binaries too.
As an added benefit, this tested the "one cross dir" design of my scripts
:)
2013-01-23 11:59:54 +09:00
Bill Currie
ea7f446eff Add qfalloca.h to EXTRA_DIST.
make distcheck now passes again.
2013-01-23 11:58:45 +09:00
Bill Currie
45cfae7785 Add the new cross scripts to EXTRA_DIST
And remove the obsolete cross.sh from mingw.
2013-01-23 11:44:01 +09:00
Bill Currie
d139640755 Make fs_userpath default to ~/quakeforge on windows.
The ~ gets expanded to CSIDL_LOCAL_APPDATA, $HOME, $USERPROFILE or just
".", whichever succeeds first. The usual location will be:
"C:\windows\profiles\<user>\Local Settings\Application Data".

"." is now the fallback for *nix systems too.
2013-01-23 11:10:19 +09:00
Bill Currie
f68ae3ad5d Add support for 64bit windows via mxe (mingw).
Note that this support relies on the -multi branch (separate git repo on
github) util it gets merged.
2013-01-22 21:02:50 +09:00
Bill Currie
61bdb13c4c Remove obsolete mingw cross.sh script.
Now that mxe is here (and works nicely), this is no longer necessary
(doesn't work anyway).
2013-01-22 21:02:50 +09:00
Bill Currie
47c2d3cb2c Include stdint.h in regex.c
It seems stdint.h gets included automatically in windows builds.
2013-01-22 21:02:50 +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
5188644e75 Implement the Mersenne Twister PRNG.
This gives QF a consistent qualilty PRNG on all platforms. The
implementation is slightly different from the standard, but gives the same
results for the same speed (details in mersenne.c).
2013-01-21 20:05:16 +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
e8721122b1 Use __attribute__((gcc_struct)) on dstatement_t.
Trust Microsoft to have really weird structure layout rules. Ah, well, this
fixes the weird progs errors Sock was getting.
2013-01-20 22:13:55 +09:00
Bill Currie
f3682069e2 Ensure the float pointer to SND_Convert is aligned.
This should fix johnny's SIGBUS.
2013-01-19 16:09:32 +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
354ad844e8 Update the debian changelog. 2013-01-18 17:15:27 +09:00
Bill Currie
a6d6523cd1 Update for 0.7.1 2013-01-18 17:15:27 +09:00
Bill Currie
0186ca993d Allow the uninitialized variable warning to be suppressed. 2013-01-18 16:28:08 +09:00
Bill Currie
eacc59c016 Build the field types array for enums, too.
However, every element is the same: type_default's type_def. This fixes the
segfault building qwaq introduced by the previous enum commit.
2013-01-17 22:01:31 +09:00
Bill Currie
46d2959908 Delay calling find_type for enums.
As find_type encodes the type too, calling find_type before the enumerators
have been created causes the type encoding to lose the enumerators.
2013-01-17 20:55:25 +09:00
Bill Currie
7a504f8983 Use float for enum defs in v6 progs.
The values are (or should be!) written as floats, so don't give any
debuggers hernias when displaying enums in v6 progs.
2013-01-17 20:53:22 +09:00
Bill Currie
6b05a7e964 Add (%Ec) to OP_ADDRESS's format specifier.
This makes OP_ADDRESS and OP_LOAD_* consistent.
2013-01-17 16:43:54 +09:00
Bill Currie
c25e68ecaf Use hex output for %E opcode format specifier.
This makes %E's addresses consistent with other address output.
2013-01-17 16:42:28 +09:00
Bill Currie
00192ea1da Skip field immediates when generating progdefs.h
They break the very fragile algorithm :P.
2013-01-17 16:10:17 +09:00
Bill Currie
3c67e8f020 Fix the vector/quaternion scaling instructions.
It was pointed out by Blub\w (gmqcc) that OP_MUL_FV and friends were buggy
when the operands overlapped (eg, x = x.x * x) as the result would become
'x.x*x.x x.y*x.x*x.x x.z*x.x*x.x' (note the x.x squared for y and z). On
testing, sure enough the bug was present (and is a nice demonstration that
QF's VM does NOT have strict-aliasing bugs). As a very nice benefit: the
code produced by the fixes is actually faster than the broken version :).

The ruamoko code used for testing:
void (string fmt, ...) printf = #0;

vector foo (vector x)
{
    x = x * x.x;
    return x;
}

vector bar (vector x)
{
    x = x.x * x;
    return x;
}

int main ()
{
    vector x = '2 3 4';
    vector y = foo (x);
    vector z = bar (x);
    printf ("x=%v y=%v z=%v 2*x=%v\n", x, y, z, 2*x);
    return 0;
}
2013-01-17 10:23:02 +09:00