Ein Versuch ne Uhr in die Konsole zu bekommen

This commit is contained in:
Yamagi Burmeister 2009-03-02 23:20:48 +00:00
parent 6ee69efa1e
commit 01ce24b755
4 changed files with 42 additions and 161 deletions

View file

@ -46,20 +46,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//=============================================================================
#ifdef QMAX
#define random() ((rand () & 0x7fff) / ((float)0x7fff))
#define crandom() (2.0 * (random() - 0.5))
vec3_t clientOrg; //lerped org of client for server->client side effects
void vectoangles2 (vec3_t value1, vec3_t angles);
#include "particles.h"
int color8red (int color8);
int color8green (int color8);
int color8blue (int color8);
#endif
typedef struct
{
qboolean valid; // cleared if delta parsing was invalid
@ -279,25 +265,6 @@ extern cvar_t *cl_footsteps;
extern cvar_t *cl_noskins;
extern cvar_t *cl_autoskins;
#ifdef QMAX
//psychospaz stuff
//railgun
extern cvar_t *cl_railred;
extern cvar_t *cl_railgreen;
extern cvar_t *cl_railblue;
extern cvar_t *cl_railtype;
//3dcam
extern cvar_t *cl_3dcam;
extern cvar_t *cl_3dcam_angle;
extern cvar_t *cl_3dcam_chase;
extern cvar_t *cl_3dcam_dist;
extern cvar_t *cl_3dcam_alpha;
extern cvar_t *cl_3dcam_adjust;
extern cvar_t *cl_blood;
#endif
extern cvar_t *cl_upspeed;
extern cvar_t *cl_forwardspeed;
extern cvar_t *cl_sidespeed;
@ -391,19 +358,6 @@ void CL_ParticleEffect3 (vec3_t org, vec3_t dir, int color, int count);
//=================================================
#ifdef QMAX
typedef struct
{
qboolean isactive;
vec3_t lightcol;
float light;
float lightvel;
} cplight_t;
#define P_LIGHTS_MAX 8
#endif
// ========
// PGM
typedef struct particle_s
@ -415,38 +369,10 @@ typedef struct particle_s
vec3_t org;
vec3_t vel;
vec3_t accel;
#ifdef QMAX
vec3_t color;
vec3_t colorvel;
#else
float color;
float colorvel;
#endif
float color;
float colorvel;
float alpha;
float alphavel;
#ifdef QMAX
cplight_t lights[P_LIGHTS_MAX];
float start;
float size;
float sizevel;
vec3_t angle;
int image;
int flags;
vec3_t oldorg;
float temp;
int src_ent;
int dst_ent;
struct particle_s *link;
void (*think)(struct particle_s *p, vec3_t org, vec3_t angle, float *alpha, float *size, int *image, float *time);
qboolean thinknext;
#endif
} cparticle_t;
@ -463,11 +389,7 @@ void CL_BlasterTrail (vec3_t start, vec3_t end);
void CL_QuadTrail (vec3_t start, vec3_t end);
void CL_RailTrail (vec3_t start, vec3_t end);
void CL_BubbleTrail (vec3_t start, vec3_t end);
#ifdef QMAX
void CL_FlagTrail (vec3_t start, vec3_t end, qboolean isred);
#else
void CL_FlagTrail (vec3_t start, vec3_t end, int color);
#endif
// RAFAEL
void CL_IonripperTrail (vec3_t start, vec3_t end);
@ -606,11 +528,7 @@ extern struct model_s *gun_model;
void V_Init (void);
void V_RenderView( float stereo_separation );
void V_AddEntity (entity_t *ent);
#ifdef QMAX
void V_AddParticle (vec3_t org, vec3_t angle, vec3_t color, float alpha, float size, int image, int flags);
#else
void V_AddParticle (vec3_t org, unsigned int color, float alpha);
#endif
void V_AddLight (vec3_t org, float intensity, float r, float g, float b);
void V_AddLightStyle (int style, float r, float g, float b);
@ -672,7 +590,3 @@ void x86_TimerInit( unsigned long smallest, unsigned longest );
unsigned long *x86_TimerGetHistogram( void );
#endif
#ifdef QMAX
void SetParticleImages (void);
#endif

View file

@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// console.c
#include "client.h"
#include <time.h>
console_t con;
@ -36,11 +37,7 @@ void DrawString (int x, int y, char *s)
{
while (*s)
{
#ifdef QMAX
re.DrawChar (x, y, *s, 1);
#else
re.DrawChar (x, y, *s);
#endif
x+=8;
s++;
}
@ -50,11 +47,7 @@ void DrawAltString (int x, int y, char *s)
{
while (*s)
{
#ifdef QMAX
re.DrawChar (x, y, *s ^ 0x80, 1);
#else
re.DrawChar (x, y, *s ^ 0x80);
#endif
x+=8;
s++;
}
@ -78,7 +71,8 @@ void Con_ToggleConsole_f (void)
if (cl.attractloop)
{
Cbuf_AddText ("killserver\n");
cl.attractloop = false;
Cmd_ExecuteString ("disconnect\n");
return;
}
@ -317,9 +311,9 @@ void Con_Init (void)
Com_Printf ("Console initialized.\n");
//
// register our commands
//
//
// register our commands
//
con_notifytime = Cvar_Get ("con_notifytime", "3", 0);
Cmd_AddCommand ("toggleconsole", Con_ToggleConsole_f);
@ -476,28 +470,24 @@ void Con_DrawInput (void)
text = key_lines[edit_line];
// add the cursor frame
// add the cursor frame
text[key_linepos] = 10+((int)(cls.realtime>>8)&1);
// fill out remainder with spaces
// fill out remainder with spaces
for (i=key_linepos+1 ; i< con.linewidth ; i++)
text[i] = ' ';
// prestep if horizontally scrolling
// prestep if horizontally scrolling
if (key_linepos >= con.linewidth)
text += 1 + key_linepos - con.linewidth;
// draw it
// draw it
y = con.vislines-16;
for (i=0 ; i<con.linewidth ; i++)
#ifdef QMAX
re.DrawChar ( (i+1)<<3, con.vislines - 22, text[i], 1);
#else
re.DrawChar ( (i+1)<<3, con.vislines - 22, text[i]);
#endif
// remove cursor
// remove cursor
key_lines[edit_line][key_linepos] = 0;
}
@ -532,11 +522,7 @@ void Con_DrawNotify (void)
text = con.text + (i % con.totallines)*con.linewidth;
for (x = 0 ; x < con.linewidth ; x++)
#ifdef QMAX
re.DrawChar ( (x+1)<<3, v, text[x], 1);
#else
re.DrawChar ( (x+1)<<3, v, text[x]);
#endif
v += 8;
}
@ -561,18 +547,10 @@ void Con_DrawNotify (void)
x = 0;
while(s[x])
{
#ifdef QMAX
re.DrawChar ( (x+skip)<<3, v, s[x], 1);
#else
re.DrawChar ( (x+skip)<<3, v, s[x]);
#endif
x++;
}
#ifdef QMAX
re.DrawChar ( (x+skip)<<3, v, 10+((cls.realtime>>8)&1), 1);
#else
re.DrawChar ( (x+skip)<<3, v, 10+((cls.realtime>>8)&1));
#endif
v += 8;
}
@ -597,8 +575,10 @@ void Con_DrawConsole (float frac)
char *text;
int row;
int lines;
char version[64];
char version[24];
char dlbar[1024];
time_t t;
struct tm *today;
lines = viddef.height * frac;
if (lines <= 0)
@ -607,46 +587,34 @@ void Con_DrawConsole (float frac)
if (lines > viddef.height)
lines = viddef.height;
// draw the background
#ifdef QMAX
re.DrawStretchPic (0, -viddef.height+lines, viddef.width, viddef.height, "conback", 1);
#else
// draw the background
re.DrawStretchPic (0, -viddef.height+lines, viddef.width, viddef.height, "conback");
#endif
SCR_AddDirtyPoint (0,0);
SCR_AddDirtyPoint (viddef.width-1,lines-1);
Com_sprintf (version, sizeof(version), "v%4.2f", VERSION);
for (x=0 ; x<5 ; x++)
#ifdef QMAX
re.DrawChar (viddef.width-44+x*8, lines-12, 128+version[x],1);
#else
re.DrawChar (viddef.width-44+x*8, lines-12, 128 + version[x] );
#endif
Com_sprintf (version, sizeof(version), "r1q2 v%s", VERSION);
for (x=0 ; x<i ; x++)
re.DrawChar (viddef.width-90+x*8, lines-14, 128 + version[x] );
// draw the text
t = time (NULL);
today = localtime(&t);
i = strftime (version, sizeof(version), "%H:%M:%S", today);
for (x=0 ; x<i ; x++)
re.DrawChar (viddef.width-66+x*8, lines-22, 128 + version[x] );
// draw the text
con.vislines = lines;
#if 0
rows = (lines-8)>>3; // rows of text to draw
y = lines - 24;
#else
rows = (lines-22)>>3; // rows of text to draw
y = lines - 30;
#endif
// draw from the bottom up
// draw from the bottom up
if (con.display != con.current)
{
// draw arrows to show the buffer is backscrolled
for (x=0 ; x<con.linewidth ; x+=4)
#ifdef QMAX
re.DrawChar ( (x+1)<<3, y, '^', 1);
#else
re.DrawChar ( (x+1)<<3, y, '^');
#endif
y -= 8;
rows--;
}
@ -662,14 +630,10 @@ void Con_DrawConsole (float frac)
text = con.text + (row % con.totallines)*con.linewidth;
for (x=0 ; x<con.linewidth ; x++)
#ifdef QMAX
re.DrawChar ( (x+1)<<3, y, text[x], 1);
#else
re.DrawChar ( (x+1)<<3, y, text[x]);
#endif
}
//ZOID
//ZOID
// draw the download bar
// figure out width
if (cls.download) {
@ -710,15 +674,11 @@ void Con_DrawConsole (float frac)
// draw it
y = con.vislines-12;
for (i = 0; i < strlen(dlbar); i++)
#ifdef QMAX
re.DrawChar ( (i+1)<<3, y, dlbar[i], 1);
#else
re.DrawChar ( (i+1)<<3, y, dlbar[i]);
#endif
}
//ZOID
//ZOID
// draw the input prompt, user text, and cursor if desired
// draw the input prompt, user text, and cursor if desired
Con_DrawInput ();
}

View file

@ -1233,7 +1233,7 @@ int Q_strcasecmp (char *s1, char *s2)
void Com_sprintf (char *dest, int size, char *fmt, ...)
int Com_sprintf (char *dest, int size, char *fmt, ...)
{
int len;
va_list argptr;
@ -1242,9 +1242,16 @@ void Com_sprintf (char *dest, int size, char *fmt, ...)
va_start (argptr,fmt);
len = vsnprintf (bigbuffer,0x10000,fmt,argptr);
va_end (argptr);
if (len >= size)
if (len == -1 || len == size)
{
Com_Printf ("Com_sprintf: overflow of %i in %i\n", len, size);
strncpy (dest, bigbuffer, size-1);
len = size - -1;
}
bigbuffer[size-1] = '\0';
strcpy (dest, bigbuffer);
return len;
}
/*

View file

@ -219,7 +219,7 @@ void COM_DefaultExtension (char *path, char *extension);
char *COM_Parse (char **data_p);
// data is an in/out parm, returns a parsed out token
void Com_sprintf (char *dest, int size, char *fmt, ...);
int Com_sprintf (char *dest, int size, char *fmt, ...);
void Com_PageInMemory (byte *buffer, int size);