GamePlanet
Planet:
-
News
- Contests
- Staff

Quake 3 Arena:
- Home
- Tutorials
- Maps
- Files
- Reviews
- Mods
- Models


Games:
- Jedi Knight
- Quake 3 Arena
- Unreal Tournament

Hosted Sites:
- Rebel Alliance Editors
- Get Hosted

Quake 3 Arena/Adding a timer:
This tutorial will add the time you've been playing down to the second. Go to CGAME and open up cg_draw.c. Go to line 432. It should look like this: (Red Text is code already their... (Green Text is code you need to add)
//
// armor
//
value = ps->stats[STAT_ARMOR];
if (value > 0 ) {
trap_R_SetColor( colors[0] );
CG_DrawField (350, 432, 3, value);
trap_R_SetColor( NULL );
// if we didn't draw a 3D icon, draw a 2D icon for armor
if ( !cg_draw3dIcons.integer && cg_drawIcons.integer ) {
CG_DrawPic( 370 + CHAR_WIDTH*3 + TEXT_ICON_SPACE, 432, ICON_SIZE, ICON_SIZE, cgs.media.armorIcon );
}

}

}

Change it to look like this:

//
// armor
//
value = ps->stats[STAT_ARMOR];
if (value > 0 ) {
trap_R_SetColor( colors[0] );
CG_DrawField (350, 432, 3, value);
trap_R_SetColor( NULL );
// if we didn't draw a 3D icon, draw a 2D icon for armor
if ( !cg_draw3dIcons.integer && cg_drawIcons.integer ) {
CG_DrawPic( 370 + CHAR_WIDTH*3 + TEXT_ICON_SPACE, 432, ICON_SIZE, ICON_SIZE, cgs.media.armorIcon );
}

}

//
//timer
//
CG_DrawTimer(1);

}

What that does is call the function CG_DrawTimer() constantly instead of only when drawing the scoreboard. The 1 is simply a value to pass to allow correct execution (CG_DrawTimer requires a float argument). Now go to line 578 in CG_DrawTimer(float y). It should look like this:

CG_DrawBigString( 635 - w, y + 2, s, 1.0F);

Change it to this:

CG_DrawBigString( 635 - w, 432, s, 1.0F);

The value 432 is the y coordinate that places the drawing just under the spread counter in the status bar. 635 - w is the x coordinate. To customize the placing of the timer a lower y coordinate moves it higher in the screen and lowering 635 moves it towards the left. Be sure to leave - w because that adds the charcter size to the space allocation. If you did it right it should look like this:

timer.jpg (52135 bytes)

Created by: Hunter-Killer of Quick Phrag Productions

Please give me some props in your mod credits if you use this.