Please can you help me with two things?
1)How can I add local time to hud (like in RTCWMOD , or ETPRO)
2)How can I make panzerfaust very unfriendly to aim , making it turn to left at middle of way or fire under the crosshair and more anti-panzerfaust things ?
Time counter and Panzerfaust behaviour
void CG_DrawClock( float x, float y ) {
qtime_t ct;
int mins, hour;
char *s;
trap_RealTime(&ct);
mins = ct.tm_min;
hour = ct.tm_hour;
s = va( "%02d:%02d", hour, mins);
CG_Text_Paint_Ext( x, y , 0.19f, 0.19f, color, s, 0, 0, 0, &cgs.media.limboFont1 );
}
put this , begin on line 539 in cg_draw
/*
=================
Draw Clock | Jaquboss Thanks Demoman for help , sorry can´t write your nick here :-)
=================
*/
static float CG_DrawClock( float y ) {
vec4_t color = { 0.625f, 0.625f, 0.6f, 1.0f };
vec4_t clockBackground = { 0.16f, 0.2f, 0.17f, 0.8f };
vec4_t clockBorder = { 0.5f, 0.5f, 0.5f, 0.5f };
qtime_t ct;
int seconds, mins, hour;
char *s;
int w;
trap_RealTime(&ct);
mins = ct.tm_min;
hour = ct.tm_hour;
seconds = ct.tm_sec;
s = va( "%02d:%02d:%02d", hour, mins , seconds);
w = CG_Text_Width_Ext( s, 0.19f, 0, &cgs.media.limboFont1 );
CG_FillRect( UPPERRIGHT_X - w - 2, y , w + 5, 12 + 2, clockBackground );
CG_DrawRect_FixedBorder( UPPERRIGHT_X - w - 2, y , w + 5, 12 + 2, 1, clockBorder );
CG_Text_Paint_Ext( UPPERRIGHT_X - w, y + 11, 0.19f, 0.19f, color, s, 0, 0, 0, &cgs.media.limboFont1 );
return y + 12 + 4;
}
This is better…
don´t forget also to add (about line 620 in cg_draw)
if ( cg_drawclock.integer ) {
y = CG_DrawClock( y );
}
in cg_local.h
extern vmCvar_t cg_drawclock;
in cg_main.c
vmCvar_t cg_drawclock;
theese two shall go somewhere to other cg cvars definitions
code can look like following
vmCvar_t cg_drawFPS;
vmCvar_t cg_drawclock;
vmCvar_t cg_drawSnapshot;
and finally in cg_main.c (put it to line 313 for example)
{ &cg_drawclock, "cg_drawclock", "1", CVAR_ARCHIVE },
This will make clocks just controlled by cg_drawclock cvar
Thanks /* Demoman */ for big part of source
np … of course that wasnt my function that I posted… I just broke it apart and gave you the code that is needed to get the time … I wanted to see you do the majority of the work… thats how you learn
I have to learn , there is no posibility to make mod just from posts found in forums…
But some things are still much for beginers like me (panzerfaust handling , lol I have to make it with gravity use, panzerfaust shold look like grenade launcher , why not…)
And question about XPSAVER , how can I make xpsaver write files? (No need for this , only if anyone knows)
And also how can I NULL saved XP for non campaign gametypes? (or they will be NULLED with stock ET source?)
For the gravity panzerfaust, you might want to look at BG_EvaluateTrajectory() / BG_EvaluateTrajectoryDelta() in bg_misc.c.
Afaik, the PF’s trajectory is coded there, edit it or create your own :).