Commit graph

605 commits

Author SHA1 Message Date
Bill Currie
34e3ac1468 Fix jumpb's operand types.
Aliasing the jump table to an integer broke statement_get_targetlist with
the new alias def handling, and was really wrong anyway. I probably did
that due to being fed up with things and wanting to get qfcc working again
rather than spending time getting jumpb right.
2012-12-05 22:20:55 +09:00
Bill Currie
49ad301d3d Add improved memory checking to progs.
With pr_boundscheck >= 2, pointer access will be checked against allocated
blocks (qfvalgrind?:). Currently extremely basic, but it seems to work.
2012-11-19 20:03:21 +09:00
Bill Currie
b8b626ee81 Change the int<->float conversion opcode string.
Using "=" was rather confusing, so changing it to "<CONV>" seems to be a
good idea. As the string is used only for selecting opcodes at compile
time, only qfcc is affected.
2012-11-16 14:45:11 +09:00
Bill Currie
1f9735d0cb Correct the dump format for conj.q. 2012-10-27 11:45:10 +09:00
Bill Currie
ec42bde527 Make hash tables more const correct.
And clean up the resulting mess :/
2012-10-27 11:44:31 +09:00
Bill Currie
cc35209f86 Yet more char index issues :P 2012-08-18 12:20:08 +09:00
Bill Currie
106257d6e9 Allow reconstructed builtins to be found by name.
Certain versions of qcc (fteqcc comes to mind :P) strip the names from
builtin functions. This breaks saved games that happen to have a builtin
function in a saved function variable. The earlier builtin name
reconstruction patch happened to fix the writing of save games for such
progs, and this one fixes the reading.
2012-07-20 16:17:26 +09:00
Bill Currie
d73b5045d8 Do not do any contents evaluation if not printing contents.
Fixes a segfault when tracing progs caused by the recent entity number
change.
2012-07-18 10:46:59 +09:00
Bill Currie
8691a2fbd1 Dump a stack trace when running out of edicts. 2012-07-18 10:30:58 +09:00
Bill Currie
a9adc94aa8 Force builtin function descriptors to have a name.
That is, the descriptors loaded from the progs file. Some compilers (eg,
fteqcc :P) strip builtin names from the progs, which makes debugging
difficult.
2012-07-13 10:22:25 +09:00
Bill Currie
6e0907a6b1 Delay the "too many entities" check.
Rather than checking the raw edict count in the entities file against the
progs' max_edicts, check the allocated entity's number. This allows loading
of sophisticated maps (eg, digs04) that prune many of their entities.
2012-07-09 15:07:34 +09:00
Bill Currie
ce16750b04 Cache the max_edicts value in the progs struct.
Makes checks a little easier.
2012-07-09 15:06:42 +09:00
Bill Currie
e91b06a144 Better name for the edict count parameter to PR_LoadProgsFile. 2012-07-09 15:02:49 +09:00
Bill Currie
ac1bf2a158 Don't save unnamed fields.
There will normally be only one unnamed field (if any), and it's always the
null field. This will put an eventual end to the "'' is not a field"
messages.
2012-06-10 20:56:22 +09:00
Bill Currie
23a38738fc Massive whitespace cleanup.
Lots of trailing whitespace and otherwise blank lines.
2012-05-22 08:23:22 +09:00
Bill Currie
0036a5e113 Ensure edict_size is never 0.
Avoids division by / in NUM_FOR_EDICT
2012-05-06 21:35:42 +09:00
Bill Currie
1a0ccf6a92 Add vec = quat * vec to the progs engine. 2012-04-26 11:58:20 +09:00
Bill Currie
0a22a98b60 Fix some mis-versioned opcodes.
Many of the quaternion opcodes were marked as being available for id progs.
oops
2012-04-26 10:26:43 +09:00
Bill Currie
bc1b483525 Nuke the rcsid stuff.
It's pretty useless in git.
2012-04-22 10:56:32 +09:00
Bill Currie
3cb4cb59b5 Link QFgamecode directly into QFruamoko.
First step in the library "merge down".

QFgamecode is now a convenience library. The only things that mention it
directly now are ruamoko and qfcc.
2012-02-13 15:05:31 +09:00
Bill Currie
9fbff2f4d5 Do an audit of the Makefile.am files.
o All instances of LIBADD/LDADD have a corresponding DEPENDENCIES
    specificatiion.
  o libraries now use a lib_ldflags macro to keep things consistent
  o duplication of source/lib names has been minimized (particularly in
    the libraries; more work needs to be done for the executables)
  o automake spec blocks have been organized (again, more work needs to be
    done for the executables)
2012-02-07 16:04:19 +09:00
Bill Currie
b5019c8e33 Nuke the engine dicrectory from gamecode.
Not the contents, of course :) Anyway, finally, that totally useless
directory is gone.
2012-02-06 23:44:52 +09:00
Bill Currie
be9f05ea14 Catch progs zone errors and give a stack dump. 2012-02-06 12:48:22 +09:00
Bill Currie
cc5140e3a1 Move min/max/bound and field_offset into better locations.
min/max bound into mathlib.h (they /are/ math functions, after all) and
field_offset into qtypes.h.
2011-12-24 10:04:33 +09:00
Bill Currie
581539f7af Make debug printing a little smarter.
When a field or global name is used, the printed value reflects the type
of that variable.
2011-09-07 09:41:06 +09:00
Bill Currie
91f6b7f555 Better use of Sys_Printf. 2011-09-07 09:41:06 +09:00
Bill Currie
f75b0a611b Some compile fixes for OpenBSD 2011-08-25 22:35:20 +09:00
Bill Currie
bb065bd233 Be a little leniant with vector param stores.
qcc always used vector stores to load values into the function parameters,
but if the location of the value is too close to the end of the global data
block (the vector spans the end of the block), it would trigger the bounds
check code. Thus, allow such instructions without a murmer, so long as it
actually is a parameter write.
2011-08-16 12:10:05 +09:00
Bill Currie
d3c2afc5d7 Handle old global vector compontents.
In the original save gave format, global vectors were saved as individual
components rather than as a single vector, using the _x/_y/_z tags on the
vector name. However, recent qfcc completely dumped vector components as
separate defs, so old save games would have trouble loading with progs
built with a recent qfcc. Thus, do the component translation if necessary.
2011-08-11 15:36:51 +09:00
Antti Harri
358a844a42 Implement --version-info configure switch to override QuakeForge
library versioning. From Lasse Collin, thanks!
2011-07-09 01:23:36 +03:00
Bill Currie
74a7e07dfc Use AM_CFLAGS instead of CFLAGS.
CFLAGS is meant to be reserved for the user.
2011-05-10 12:44:44 +09:00
Bill Currie
d3771dfeba Resolve some inlining issues in recent gcc. 2011-05-04 09:31:18 +09:00
Bill Currie
2a2a431431 Register a complaint when the map has too many entities.
I was wondering why that parrot was dead.

Not realizing that negke's coag3 map had too many entities really ruined
the pleasure of playing it, so it's best to treat such situations as an
error (max_edicts can be bumped up to 32000 if need be, but 2048 is plenty
for his map).
2011-04-17 20:06:20 +09:00
Bill Currie
55cc0f9206 Bring back the unsigned type (PROGS version bump)
This is only low-level support (the unsigned keyword still does not work),
but sufficient to make switch statements using jump tables work.
2011-04-09 10:07:47 +09:00
Bill Currie
b0d1e782ee Treat allocating less than 1 byte as an error. 2011-03-24 11:10:08 +09:00
Bill Currie
025c39cc02 Ensure stdout is flushed in the progs signal_hook() 2011-03-20 13:35:59 +09:00
Bill Currie
104c29e4da Avoid a segfault when the called function is invalid.
This is most likely to occur when dumping code from qfo files with external
functions.
2011-03-20 13:35:12 +09:00
Bill Currie
f20424afe5 Make "bad type" output more useful.
Print the four (assumes non-v6) values in hex rather than "bad type".
2011-03-17 20:35:14 +09:00
Bill Currie
ebfbd7c358 Disable the unsigned comparison instructions.
They need unsigned support, or special treatment, so they have to wait.
2011-03-17 20:33:38 +09:00
Bill Currie
bce3935ea6 Add a void address instruction. 2011-03-10 19:28:03 +09:00
Bill Currie
90de6b0499 Add a movepi instruction to support indirect moves of fixed size. 2011-03-09 10:29:24 +09:00
Bill Currie
18005cc80d Rename move to movei. 2011-03-09 10:28:40 +09:00
Bill Currie
6c4563b21d Change movep's name from <MOVE> to <MOVEP>. 2011-03-09 10:25:20 +09:00
Bill Currie
4432bc0bef Make the offset in zone dumps more useful. 2011-03-08 22:44:56 +09:00
Bill Currie
5b8345eecb Do not try to print values from null entities. 2011-03-07 08:28:20 +09:00
Bill Currie
3b8a3f8302 Remove the vector component skip code from param searches.
Local defs no longer contain the vector comonents.
2011-03-06 21:02:29 +09:00
Bill Currie
4794d66f42 Change jumpb's opa type to integer.
I'm not 100% certain this is correct...
2011-03-03 19:06:17 +09:00
Bill Currie
57f735c99c Avoid another segfault when debugging. 2011-02-15 15:33:18 +09:00
Bill Currie
52010b8f7b Do not segfault with bogus debug info. 2011-02-14 23:10:45 +09:00
Bill Currie
55b7f6eee4 Avoid another segfault when debugging. 2011-02-09 10:13:08 +09:00
Bill Currie
de33cd6017 Ensure auxfunction_map is properly initialized. 2011-02-09 08:28:20 +09:00
Bill Currie
f72d6d6a27 Fix a typo in the opname for integer modulo. 2011-01-27 21:03:11 +09:00
Bill Currie
3c9991364b Add a "void return" instruction.
I got fed up with always having to explicty return something.
2011-01-13 00:29:56 +09:00
Bill Currie
6650b35201 Make PR_Get_Param_Def aware of @args. 2011-01-10 12:25:31 +09:00
Bill Currie
75ec6bf244 Clean out some unnecessary types from the progs engine and clean up the mess.
This is a nasty commit, sorry, but 99% of the commit is interdependent.
2011-01-10 12:25:31 +09:00
Bill Currie
a85c0713aa Nuke libQFbuiltins.
The gib and "common" builtins are now part of libQFruamoko.
2011-01-04 21:21:19 +09:00
Bill Currie
8e557e81b6 Break out the guts of Ed_LoadFromFile into ED_Parse.
ED_Parse does not support progs privided parsing (at this stage, anyway),
but this will allow clients to easily get at the entities in a map.
2010-12-10 17:17:29 +09:00
Bill Currie
8c4fe2f844 Rename Sys_DPrintf to Sys_MaskPrintf.
We now have finer runtime control over what gets printed. Need to do a
SYS_DEV audit, creating new masks as apropriate.
2010-11-26 16:19:26 +09:00
Bill Currie
fc2a6e0fb7 Don't be so spammy with file errors.
Record a file even if it could not be found. This way, the error message
gets printed once per file rather than every time.
2010-11-24 17:01:18 +09:00
Bill Currie
3309f483b6 Don't require pr_boundscheck for quoth.
I don't know about other FTEqcc compiled progs, but quoth doesn't try to do
anything clever (all its denormals are either vars of the wrong type, or
-0.0).
2010-11-20 14:12:40 +09:00
Bill Currie
9d6fd32206 Ensure the the progs data is aligned.
Some QuakeC compilers (eg, FTE) insert a data chunk between the progs
header and the rest of the progs data. Unfortunately, FTE does not maintain
the assumed 32-bit alignment.
2010-11-20 09:02:56 +09:00
Bill Currie
2f504709dd Print data being loaded from an entity. 2010-11-20 00:31:34 +09:00
Bill Currie
f63e505c92 Don't realloc the string pointer table.
This causes a bit of memory waste, but avoids breaking the pointers in the
string hash table.
2010-11-14 19:21:16 +09:00
Bill Currie
e6b783a616 Don't touch the watchpoint conditional when printing. 2010-11-13 14:36:33 +09:00
Bill Currie
0dfff8fd58 ignore stuff 2010-08-07 10:42:09 +00:00
Bill Currie
c1b12ed6ec fix a couple of gcc 4.5 issues that Despair pointed out (I don't have it yet) 2010-05-27 12:21:50 +00:00
Bill Currie
7827086b54 make sure we actually have a stack frame 2010-01-13 06:42:59 +00:00
Bill Currie
997102fea8 audit the usage of "only"
There are still a few iffy places (notably around certain prepositions), but
the relevant sentences are now much easier to read.
2010-01-13 06:42:26 +00:00
Bill Currie
0a203c0ab5 qccx (etc) "integer" autodetection.
Check for usage of denormal floats and if found, either bail with a
descriptive error message or give a mild warning that things will probably
break. This avoids the possibility of things like RuneQuake getting "lucky"
and doing real harm, and certainly avoids the segfaults.
2010-01-13 06:36:54 +00:00
Bill Currie
00e590f5f5 Really nail down the args param in rua_obj_msg_sendv(). 2010-01-13 06:36:16 +00:00
Bill Currie
5c788d8d44 state.f is not an id instruction 2010-01-13 06:30:07 +00:00
Bill Currie
e0d669590c plug a memory leak
the progs memory was never being freed between maps because the pointer was
being cleared at the start of PR_LoadProgsFile.
2010-01-13 06:27:19 +00:00
Bill Currie
5d6977288f implement bounds checking on all opcodes 2010-01-13 06:19:50 +00:00
Bill Currie
4a7b8f8246 don't look up aux function info when we don't have it 2009-12-21 14:07:43 +00:00
Bill Currie
fe95805d86 various gcc 4.3 fixes 2008-07-19 05:40:57 +00:00
Bill Currie
2b81eaea6c console.h include cleanup 2007-11-06 12:40:38 +00:00
Bill Currie
c04d9ef8c2 plug a potential (though unlikely) memory leak 2007-10-13 11:32:10 +00:00
Bill Currie
3e50aae01f "print" command for dumping values in the progs and add return type info to the debugging information 2007-09-15 07:47:31 +00:00
Bill Currie
ca0bbd909c correctly save and restore the parameters when calling +initialize. fixes the segfault in the qwaq test. 2007-06-09 13:44:06 +00:00
Bill Currie
4973a38cce speed up PF_VarString a little 2007-06-09 09:43:21 +00:00
Bill Currie
4d86c40113 handle float conditionals 2007-05-08 03:20:15 +00:00
Bill Currie
57bd43fc52 make the watchpoint (optionally) conditional 2007-05-08 02:25:01 +00:00
Bill Currie
fe4a4a9e55 "hardware" (haha) watch points (one!) in progs. only catches changes done by progs, and the expression parser is as flaky as anything, but it's better than nothing :) 2007-05-08 02:04:47 +00:00
Bill Currie
b167bc302b fix a segfault when doing backtraces without debug info 2007-05-07 23:10:54 +00:00
Bill Currie
beb5438484 fix messed up build order by putting bi_inputline.c where it really belongs 2007-05-07 13:02:35 +00:00
Bill Currie
ab5536ef46 strip any trailing whitespace from source lines. strips off trailing \r from dos files :) 2007-04-28 01:40:08 +00:00
Bill Currie
d08e1fe511 make PR_StackTrace visible 2007-04-10 09:45:57 +00:00
Bill Currie
48449a972f fix an uninitialized warning on some versions of gcc 2007-04-10 08:32:58 +00:00
Bill Currie
a66cbb5215 PR_ResolveGlobals needs to be visible 2007-04-09 09:00:40 +00:00
Bill Currie
61d349ec78 bah, the other part of that commit :P 2007-04-09 08:55:24 +00:00
Bill Currie
cd6ee38181 remove debuging prints 2007-04-09 06:18:14 +00:00
Bill Currie
b5e6aa4519 for pr_debug 1, don't dump disassembly when tracing, just source lines. pr_debug >= 2 forces disassembly. detailed disassembly now on pr_debug >= 3 figure out the types of arguments in a function call 2007-04-09 06:16:03 +00:00
Bill Currie
2700f4060b make PR_FreeTempStrings not free a string that looks like it's being returned, but rather transfer it to the parent stack frame. 2007-04-08 01:22:00 +00:00
Bill Currie
3e92ac51fd fix another bug caused by the function table changes 2007-04-08 00:56:35 +00:00
Bill Currie
e27b2a9e54 use PR_CatStrings for strcat and padstr. ironicly, this should work better for now, and definitely will by the time I'm done. 2007-04-08 00:00:35 +00:00
Bill Currie
124506fda2 Fix the access alignment bug on 64 bit archs. 2007-04-07 01:41:23 +00:00
Bill Currie
5b761bac83 make progs related code a little more consistent with its int type usage 2007-04-06 00:47:41 +00:00
Bill Currie
38254186da other than floats, progs should now be int size safe 2007-04-04 12:30:49 +00:00
Bill Currie
ff132bb536 64bit windows patch from phrosty 2007-04-04 07:48:14 +00:00
Bill Currie
c20a553e1a free entities that didn't get initialized (lost this in the format conversion) 2007-03-25 04:15:18 +00:00
Bill Currie
81a57bb3fa patch from phrosty for vc2005 support. includes fixes for a bunch of gcc-isms that crept in over the years. 2007-03-22 23:20:57 +00:00
Bill Currie
99c0954b47 the big dso visibility patch :). Sure, we have to have unique names for static builds, but with controlled visibitly we should get faster program loads (although this isn't C++, so it's not as bad) and complex plugins are cleaner. 2007-03-10 12:00:59 +00:00
Bill Currie
165600adc5 fix a very severe d'oh (specifying width caused a segfault) 2006-12-20 10:32:34 +00:00
Bill Currie
acd49060be why did we ever decide not to support %d? 2006-12-20 08:45:49 +00:00
Bill Currie
4dba10d613 support %c for sprintf and make sprintf return a return string rather than a temp string 2006-12-19 14:15:27 +00:00
Bill Currie
3f3ec6404d bare printf doesn't give very desirable results 2006-12-09 08:44:10 +00:00
Bill Currie
70ec9848e7 add PL_RemoveObjectForKey and make PL_D_AddObject take a normal C string for key instead of a pl string. 2006-12-09 06:00:36 +00:00
Bill Currie
c290e9a988 use plists for save-games. old save-games can still be read, but new ones will always be in the new format. might be a good idea to back up any old saves until more testing has been done. 2006-12-09 02:35:44 +00:00
Bill Currie
2a79f42eb5 progs now internally uses plists for entity/global initialization, with support for direct conversion from id's format. This means that the entity string in a map (or the external ent file) can be a plist. 2006-12-09 00:02:57 +00:00
Bill Currie
a6c50b8edd use handles rather than pointers (whatever was I thinking?) 2006-12-02 06:50:59 +00:00
Bill Currie
3fb03fc2be hah, should have been using __attribute__((used)) all that time (rather
than __attribute__((unused))). fixes the missing console in -x11
2005-08-04 15:27:09 +00:00
Bill Currie
4a21eb02c5 heh, slight oversight when implementing rcall using the param pointer
trick. ran into the exact same problem as passing addresses of locals to QC
functions. well, actually, that's exactly what it was, but done in the
engine. anyway, wound up potentially overwriting the params passed to the
function. fortunatly, due to how rcall works, only the first two params are
an issue.
2005-06-14 13:40:34 +00:00
Bill Currie
762aefc9b1 implement Raven's calling convention (rcall: first 2 params in opb and
opc). should give a general speedup to most progs.
2005-06-12 09:54:01 +00:00
Bill Currie
f65c25a7c2 oops, signage error 2005-05-01 08:30:30 +00:00
Bill Currie
a0612e27b9 d'oh, forgot to mark the string ref as freed 2005-05-01 00:01:28 +00:00
Bill Currie
f38fcd9086 catch attempts to use freed strings 2005-04-30 08:37:55 +00:00
Bill Currie
23f71485d1 more tree recovering. This includes Despair's anisotropy support work. 2005-01-02 14:23:20 +00:00
Bill Currie
4a7e2ff093 get the range of the zone right. crashing on what should be a perfectly valid value is just plain bogus :P
This is an imperfect revision of history.
2004-11-14 00:52:00 +00:00
Bill Currie
53ee50655c allow the progs code to hook into the parsing processes
This is an imperfect revision of history.
2004-11-12 11:15:00 +00:00
Bill Currie
0effc54835 don't puke over a void field when dumping entities
This is an imperfect revision of history.
2004-11-12 11:12:00 +00:00
Bill Currie
0e324d1851 use the script api for parsing ent data and savegames
This is an imperfect revision of history.
2004-11-12 02:39:00 +00:00
Bill Currie
2a36c74120 add dynamic (freeable but unchangeable) strings
This is an imperfect revision of history.
2004-11-11 09:40:00 +00:00
Bill Currie
78d98ea787 remove the time pointer (not really needed)
This is an imperfect revision of history.
2004-11-09 22:32:00 +00:00
Bill Currie
8770df39e5 start documenting things (progs building still borked)
This is an imperfect revision of history.
2004-11-08 23:27:00 +00:00
Bill Currie
780fb41858 make a common call function and fix pr_trace such that it autoclears only when the execution session it's set in is exited
This is an imperfect revision of history.
2004-11-07 03:00:00 +00:00
Bill Currie
201252c1c0 FIXME cleanup and a missed win32 compile fix
This is an imperfect revision of history.
2004-11-06 02:21:00 +00:00
Bill Currie
f5bc90a53a clean up some redundant progs functions (may be broken for a while)
This is an imperfect revision of history.
2004-11-05 11:49:00 +00:00
Bill Currie
33bc7858f7 avoid using the hunk in the progs engine (except for the override-able load and alloc functions) so tools (qfprogs and qwaq) don't need to create it.
register only the first instance of a progs provided string

This is an imperfect revision of history.
2004-11-02 04:59:00 +00:00
Bill Currie
633dada682 quaternion conjugate support (engine side) 2004-04-08 04:57:17 +00:00
Bill Currie
fc2413ff72 more quaternion work (should be working, haven't come up with tests yet) 2004-04-08 03:32:14 +00:00
Bill Currie
4882005a49 compile fixes (oops) and start working on quaternion support in qfcc 2004-04-08 02:33:20 +00:00
Bill Currie
8d6f634f30 engine side quaternion support 2004-04-08 00:56:30 +00:00
Bill Currie
ac67a50a9a handle x % 0 by giving a 0 result 2004-02-20 00:25:08 +00:00
Bill Currie
a821f048a0 change FNC to FN and fnc to fn for function based opcodes 2004-02-11 06:52:19 +00:00
Bill Currie
c3f41e3e69 new opcode: state.f. same as state, but takes a 3rd float operand to
specify the step for calculating nextthink. accessed using
[frame, think, step] (state is [frame, think])
2004-02-11 01:43:33 +00:00
Bill Currie
5c9ffad6a1 oops, fix the line number doubling the /right/ way 2004-02-10 04:42:17 +00:00
Bill Currie
a371af75ab don't double the source line number when on the function's first line 2004-02-10 01:54:33 +00:00
Bill Currie
432ae86cca don't seg if the field def can't be found 2004-02-07 01:57:31 +00:00
Bill Currie
ecf4eabe9d check return value... prevents segfault in menu code if menu.dat has issues 2004-02-07 00:04:00 +00:00
Bill Currie
080b973479 make globals without a def a lot easier to read (don't need to print the
address twice:)
2004-02-06 08:03:22 +00:00
Bill Currie
4472f943c5 minor cleanups and use escapes when printing strings 2004-01-31 08:34:01 +00:00
Bill Currie
2ac0f40f7a fix an uninitialized variable 2004-01-31 07:29:11 +00:00
Bill Currie
24294c8778 make printing of global contents in PR_PrintStatement optional so
disassembly output is cleaner
2004-01-31 04:26:01 +00:00
Bill Currie
718c708cec make global printing a little more robust 2004-01-30 08:46:14 +00:00
Bill Currie
e1afa3221c minor cleanup 2004-01-30 07:55:32 +00:00
Bill Currie
390ca99a92 first step to making qfdefs redundant. "standard" progs now get resolved
staticly rather than looking up the defs. "broken" progs should now work.
2004-01-21 08:09:47 +00:00
Bill Currie
77b2942982 several libs can now get built as dlls in windows: console, gamecode,
gamecode_builtins, gib, image, modules, object, ruamoko and util.
2004-01-19 07:47:41 +00:00
Bill Currie
ba8e959cf2 when clearing the return strings, it's a good idea to clear them completely 2004-01-18 07:50:50 +00:00
Bill Currie
249aee2e9f move the OO runtime support code from libQFgamecode to libQFruamoko where
it really belongs :)
2004-01-16 08:02:31 +00:00
Bill Currie
01392c78bb move the bulk of what whas libQFcsqc to libQFruamoko. 2004-01-16 05:46:19 +00:00