One of the functions always sorely missed by us QuakeC coders was a way
to catch the end of a frame, after all the physics and thinks had been
executed. While it's simple to stick in a call to EndFrame, it's harder
maintaining compatability with old mods when you expect a new function
to exist. Taking a cue from QW, here is the 'official' QSG
implimentation of EndFrame:
Open up PROGS.H find the line that reads extern int minimum_memory; Under it, add:
extern func_t EndFrame; This variable will obviously hold the pointer to the function
EndFrame in the QC. Open up PR_EDICT.C and scroll down to the function
PR_LoadProgs, before it we'll define it and in it we'll set the
variable up for use. Add this temporary variable declaration to the top
of PR_LoadProgs:
func_t EndFrame; Then at the bottom of the same function add this code: EndFrame = 0; Last but not least, we need to execute this bugger somewhere, the
place, of course, is in sv_phys.c, in the function called SV_Physics.
After all entities have been processes and before the retouch code,
stick the following lines. It has to be before the retouch code
otherwise you may experience weird results occasionally.
if (EndFrame) Viola! We now have an optional EndFrame function in the QC. As a test, modify world.qc, add a function EndFrame and have it print some annoying message. It will flood the console. Yipee! :) |