
|
Copyright info |
|
All
code in this tutorial is protected by the [GPL License]. |
|
Tutorial by: Richard Steele (Quadrant) |
||||||||||
|
This tutorial
will show you how to add a CONSOLE CLOCK to the Quake2 executable. It is a
simple & basic tutorial, But a nice touch to add to the Engine. There are no
new files needed for this tutorial & only the need to add a few lines of
code, The first step
is to actually start including some new code to the engine, so open up the
file 'console.c' and scroll down to the 'Con_DrawConsole' function near to
the bottom of this file and locate the following lines lines..
You now need
to add below them these lines...
Ok, next find the
following piece of code (still in the same function).. Find the code
section that reads...
and below it
change this piece of code from..
To read like
the below:
As you can
see, all I've done is made a small change to the version number (it now
prints 'Quake2 v2.xx' instead of just the number). In doing this, I also have
had to move where the text was drawn, to make room for it. It's now '12'
letters long instead of '5', and begins at line position '35' instead of
'44'. Drawing the
actual clock is even easier, it's the same code as above - but this time we are
writing the text from 'timebuf' (where we put the time at the beginning of
the tutorial) to 'tmpbuf', and drawing that. It's 13 letters long, and begins
at line position 25. Well, there
ends this small but useful tutorial. No more having to ALT-TAB your Quake2 to
see what time it is or how long you have been playing, Have Fun! |
Tutorial Originally found at: