Commit Graph

732 Commits

Author SHA1 Message Date
Bill Currie 59ee723201 [gamecode] Rename parm to param
That misspelling bothered me from the very beginning, I'd always have
trouble getting the name right when trying to access one of those fields.
2022-01-27 10:55:06 +09:00
Bill Currie faa98d8198 [gamecode] Use a struct for offset/count pairs
This cleans up dprograms_t, making it easier to read and see what chunks
are in it (I was surprised to see only 6, the explicit pairs made it
seem to have more).
2022-01-26 19:30:25 +09:00
Bill Currie 9c51c3d2e1 [gamecode] Add a data pointer passed to builtin functions
This is part of the work for #26 (Record resource pointer with builtin
function data). Currently, the data pointer gets as far as the
per-instance VM function table (I don't feel like tackling the job of
converting all the builtin functions tonight). All the builtin modules
that register a resources data block pass that block on to
PR_RegisterBuiltins.
2022-01-24 00:20:05 +09:00
Bill Currie a6b932025c [gamecode] Provide builtins with information about their parameters
This will make it possible for the engine to set up their parameter
pointers when running Ruamoko progs. At this stage, it doesn't matter
*too* much, except for varargs functions, because no builtin yet takes
anything larger than a float quaternion, but it will be critical when
double or long vec3 and vec4 values are passed.
2022-01-23 22:27:27 +09:00
Bill Currie f72e8ef551 [qwaq] Fix a couple of errors in debug
Update qdb_get_string's mangling for qfcc's new unsigned int support and
fix an incorrect cast of the param pointer passed by prd_runerror that
caused a segfault when trying to use the string. Attempting to use
qwaq-app (ie, the qc debugger) on Ruamoko ISA progs mostly works, but
the defs are decidedly unhappy (due to the base registers).
2022-01-23 02:04:28 +09:00
Bill Currie ac785ca752 [qwaq] Send app focus event on startup
Terminal apps effectively always have focus (unless I find a way to know
when an xterm loses/gains focus). Fixes input-app not updating on evdev
events.
2022-01-21 00:44:04 +09:00
Bill Currie 4ae9474396 [ruamoko] Use pr_type_names for type sizes
short and ushort are "wrong" (1 instead of 0, because qfcc currently
uses int for short), but now the array will always be in sync with the
enum.
2022-01-19 21:26:44 +09:00
Bill Currie 25f8d3a23d [gamecode] Use pr_type_names.h for type sizes
The goal of the previous mess of commits. Ruamoko needs to wait until
qfcc has the new types.
2022-01-18 17:05:12 +09:00
Bill Currie e9e54d08c0 [gamecode] Rename func_t to pr_func_t
Even more consistency.
2022-01-18 15:36:58 +09:00
Bill Currie afd1eb775b [gamecode] Rename ev_pointer to ev_ptr
Rather short (no worse than ev_int, though) but more consistency is
usually a good thing.
2022-01-18 14:36:06 +09:00
Bill Currie 2f6c3c8ffb [ruamoko] Use pr_type_names.h for Ruamoko
Keeping the two sets of definitions in sync has always been a pain.
2022-01-18 14:21:09 +09:00
Bill Currie cfe7c44df0 [gamecode] Rename ev_integer to ev_int
And other related fields so integer is now int (and uinteger is uint). I
really don't know why I went with integer in the first place, but this
will make using macros easier for dealing with types.
2022-01-18 13:27:19 +09:00
Bill Currie 2df64384c1 [gamecode] Clean up string_t and pointer_t
They are both gone, and pr_pointer_t is now pr_ptr_t (pointer may be a
little clearer than ptr, but ptr is consistent with things like intptr,
and keeps the type name short).
2022-01-18 12:11:14 +09:00
Bill Currie 4111d44dcc [gamecode] Move progs auxiliary headers into a subdirectory
Just another step along the road of tidying up the QF include directory
(and desirable for generated data).
2022-01-09 00:26:52 +09:00
Bill Currie 14d95f81d1 [gamecode] Remove PR_Opcode_Init
It was idempotent, then it became impotent. Now it's just not needed.
2022-01-07 19:25:34 +09:00
Bill Currie be474d9937 [gamecode] Remove the wart from def and function names
I never liked the leading s_ (though I guess it means one is supposed to
interpret the int as a string pointer, but meh).
2021-12-31 15:02:31 +09:00
Bill Currie 2dc806cff5 [ruamoko] Clean up Entity a little
Hide own, and add some class spawn methods.
2021-12-30 13:26:36 +09:00
Bill Currie 8385046486 [qfcc] Warn when super dealloc invocation is missing
Forgetting to invoke [super dealloc] in a derived class's -dealloc
method has caused me to waste far too much time chasing down the
resulting memory leaks and crashes. This is actually the main focus of
issue #24, but I want to take care of multiple paths before I consider
the issue to be done.

However, as a bonus, four cases were found :)
2021-12-24 22:45:43 +09:00
Bill Currie bcf80650f3 [ruamoko] Use the right index in disabled code
I have no idea why the code is disabled (especially considering the
comment), so leaving it that way for now, but this makes the code
compile when enabled.
2021-12-24 06:45:13 +09:00
Bill Currie 2b25748cc4 [ruamoko] Correct SetIterator memory handling
This makes SetIterator more compatible with autorelease.
2021-12-24 06:45:13 +09:00
Bill Currie 3ffdaccd50 [qwaq] Add an event handler for graphics
It's very much a hack, but it will do for now until I can rewrite the
whole thing: it's not at all thread safe, but it is over eight years
old and has survived a lot of bit-rot.
2021-12-24 06:45:13 +09:00
Bill Currie f3918471d5 [ruamoko] Add bindings for the main IMT functions
IMT_SetContextCbuf is not bound as that requires cbuf to be bound.
However, imt contexts can be created, fetched and set.
2021-12-24 06:45:13 +09:00
Bill Currie 241785e952 [ruamoko] Move older math functions
The old math functions from quake and quakeworld don't belong with the
newer ones as their presence in the same object file causes invalid
builtin warnings when pr_cmds isn't present.
2021-12-24 06:45:13 +09:00
Bill Currie a89aa7fc33 [ruamoko] Clean up ruamoko/lib rules
They were ok before the update to non-recursive make, but with the extra
bits of path, the rules got very hard to read.
2021-12-24 06:45:13 +09:00
Bill Currie dcd1fa28ba [ruamoko] Get the input bindings working
With some hacks that are not included (plan on handling events and
contexts properly), button inputs, including using listeners, are
working nicely: my little game is working again. While the trampoline
code was a bit repetitive (and I do want to clean that up), connecting
button listeners directly to Ruamoko instance methods proved to be quite
nice.
2021-12-24 06:45:13 +09:00
Bill Currie 23e3b4c2e5 [ruamoko] Retrieve a plitem_t from PropertyList
And also internally for cross-builtin use.
2021-12-24 06:45:13 +09:00
Bill Currie 5e273a3693 [ruamoko] Make plitem_t easier to use
Or more accurately, struct plitem_s. Including the pointer in the
typedef made things a little awkward.
2021-12-24 06:45:13 +09:00
Bill Currie f1d097c0c4 [ruamoko] Add bindings for Mercenne Twister 2021-12-24 06:45:13 +09:00
Bill Currie 6411518603 [ruamoko] Make some progress on the input bindings 2021-12-24 06:45:13 +09:00
Bill Currie 33e48025dd [ruamoko] Replace rua_key with rua_input
And create rua_game to coordinate other game builtins.

Menus are broken for key handling, but have been since the input rewrite
anyway. rua_input adds the ability to create buttons and axes (but not
destroy them). More work needs to be done to flesh things out, though.
2021-12-24 06:45:13 +09:00
Bill Currie 8e08f5f84e [qwaq] Drop qwaq-graphics.log
For now, at least. The client console takes over Sys_Printf and breaks
the logging.
2021-12-24 06:45:13 +09:00
Bill Currie 2cb987fdb5 [build] Clean up a pile of distcheck issues 2021-12-24 06:45:13 +09:00
Bill Currie ad83422c56 [qwaq] Adapt startup code for use in a game engine
Until now, the new qwaq startup was used only in command-line tools and
console applications where things like Ruamoko security and having a
hunk were not an issue. Now the start up code (qwaq-*.c) can specify
that Ruamoko is to be secured and provide a hunk on a per-thread basis,
and the thread data is passed into the progs code via a progs resource.
2021-12-24 06:45:13 +09:00
Bill Currie d3853a2430 [qwaq] Update qwaq-x11's initialization
It now uses the advanced command line parsing used by qwaq-curses and
qwaq-cmd, but currently disables multi-threading (I don't want to deal
with threading in the engine just yet). The int file is -graphics
because qwaq-x11 is really just the X11 target, qwaq-win is built for
windows, but they use the same basic startup (I hope).
2021-12-24 06:45:13 +09:00
Bill Currie 0e7e88815c [qwaq] Fix up file headers 2021-12-24 06:45:13 +09:00
Bill Currie 97c3cbf719 [qwaq] Rename input.c
It's very specialized toward terminal input (ie, for qwaq-curses).
2021-12-24 06:45:13 +09:00
Bill Currie 7892382639 [qwaq] Remove obsolete file
I don't remember when it was last used, and deleting it saves me the
hassle of sorting out its header :P
2021-12-24 06:45:13 +09:00
Bill Currie 2086125e0b [quakefs] Take in the pointer to the global hunk
This is needed for cleaning up excess memsets when loading files because
Hunk_RawAllocName has nonnull on its hunk pointer (as the rest of the
hunk functions really should, but not just yet).
2021-12-24 06:45:13 +09:00
Bill Currie 84a24dbb34 [renderer] Make R_RenderView private
This is actually a better solution to the renderer directly accessing
client code than provided by 7e078c7f9c.

Essentially, V_RenderView should not have been calling R_RenderView, and
CL_UpdateScreen should have been calling V_RenderView directly. The
issue was that the renderers expected the world entity model to be valid
at all times. Now, R_RenderView checks the world entity model's validity
and immediately bails if it is not, and R_ClearState (which is called
whenever the client disconnects and thus no longer has a world to
render) clears the world entity model. Thus R_RenderView can (and is)
now called unconditionally from within the renderer, simplifying
renderer-specific variants.
2021-12-24 06:45:12 +09:00
Bill Currie d8a836e9da [input] Add broadcast events for app focus gain/loss
These are for when the application itself gains or loses focus, rather
than individual event handlers.
2021-11-22 14:59:32 +09:00
Bill Currie 3ac6d2aa22 [x11] Use barriers to trap the pointer in the window
This should be a much friendlier way of "grabbing" input, though I
suspect that using raw keyboard events will result in a keyboard grab,
which is part of the reason for wanting a friendly grab.

There does seem to be a problem with the mouse sneaking out of the
top-right and bottom-left corners. I currently suspect a bug in the X
server, but further investigation is needed.
2021-11-22 14:59:27 +09:00
Bill Currie 52c5f0545b [input] Add broadcast event for application window changes
This is the first step in the long-sought goal of allowing the window
size to change, but is required for passing on getting window position
and size information (though size is in viddef, it makes sense to pass
both together).
2021-11-22 13:20:13 +09:00
Bill Currie e45d19835c [x11] Add initial support for XInput2
Right now, only raw pointer motion and button events are handled, and
the mouse escapes the window, and there are some issues with focus in
focus-follows-mouse environments. However, this should be a much nicer
setup than DGA.
2021-11-21 23:42:33 +09:00
Bill Currie b892ce637a [input] Nuke IN_Move from orbit
gotta be sure :)

On a serious note, it was always a problem in that it had
client-specific code and concepts embedded in the libraries.
2021-11-19 08:58:02 +09:00
Bill Currie b95c749438 [input] Add a per-device event data pointer
This might pose a problem with multiple event targets (we'll see), but
it will make connecting input devices to bindings much easier.
2021-11-10 13:22:10 +09:00
Bill Currie 4898a44263 [console] Hook up new input system
This has smashed the keydest handling for many things, and bindings, but
seems to be a good start with the new input system: the console in
qw-client-x11 is usable (keyboard-only).

The button and axis values have been removed from the knum_t enum as
mouse events are separate from key events, and other button and axis
inputs will be handled separately.

keys.c has been disabled in the build as it is obsolute (thus much of
the breakage).
2021-11-08 11:20:04 +09:00
Bill Currie 825d8b7a49 [input] Make a start on the new binding system
Input Mapping Tables are still at the core as they are a good concept,
however they include both axis and button mappings, and the size is not
hard-coded, but dependent on the known devices. Not much actually works
yet (nq segfaults when a key is pressed).
2021-11-03 19:02:39 +09:00
Bill Currie 09e3e62a0a [input] Move in_event.h and binding defs
They now live in the include QF/input directory. This cleans up include/QF
a little, and input.h as well.
2021-11-01 13:05:05 +09:00
Bill Currie 665790f562 [video] Remove libQFjs
It is now redundant with the libQFinput, though nothing actually works yet.
2021-11-01 12:30:45 +09:00
Bill Currie abe77523ae [qwaq] Disable xterm mouse handling on shutdown
Getting mouse escape codes on the command line is not very pleasant
(even if display-only).
2021-10-29 10:16:42 +09:00