Bugs in QuakeC Sourcecode

Before translating a QuakeC game to Python, there are a few minor bugs that should be corrected in the QC source. These things must not have bothered the QuakeC compiler or interpreter - but if they aren't corrected, the translated Python game will behave incorrectly or raise exceptions at runtime. The line numbers listed are for the source that was bundled with id's full Quake1/QuakeWorld sourcecode release.

Any games derived from the original QuakeC deathmatch probably have these bugs too. CTF for example, has all the bugs found in DM, plus a few others (line numbers for CTF 4.21d source are listed in parentheses).

grapple.qc (CTF only)

CTF: line 93

change: entity (float head) MakeLink =
to: entity () MakeLink =

The head parameter isn't used, and none of the callers supply it. If this isn't changed, an exception is raised at runtime, and the grapple behaves incorrectly.

misc.qc

line 338 (CTF: 334)

remove: local vector vec;

local declaration has same name as function parameter.

line 594 (CTF: 595)

change: makestatic();

to: makestatic(self);

makestatic is declared to expect one parameter, Python isn't happy when one is not supplied. If not corrected this will raise an exception at runtime.

status.qc (CTF only)

CTF: line 178

change: res = TeamSetStatRes2();

to: res = TeamSetStatRes2(self);

TeamSetStatRes2 expects a parameter, raises an exception at runtime if not fixed.

triggers.qc

line 432 (CTF: 430)

change: other.flags = other.flags - other.flags & FL_ONGROUND;

to: other.flags = other.flags - (other.flags & FL_ONGROUND);

Without the parentheses, the order of evaluation of the expression for Python (and most other languages including real C and Java) is such that it would always evaluate to 0. If this isn't corrected, you'll see odd behavior in the game such as not being able to pick up weapons after passing through a teleporter.

weapons.qc

line 98 (CTF: 118)

remove: local vector org;

local declaration has same name as function parameter.