A few substantive changes, mostly whitespace. EVIL!

This commit is contained in:
Jeff Teunissen 2000-08-02 01:18:37 +00:00
parent 1cfc49b5b2
commit 86de6d99f0

View file

@ -99,15 +99,18 @@ static float mouse_x, mouse_y;
static float old_mouse_x, old_mouse_y;
static float old__windowed_mouse;
void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height)
void
D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height)
{
}
void D_EndDirectRect (int x, int y, int width, int height)
void
D_EndDirectRect (int x, int y, int width, int height)
{
}
void VID_Shutdown (void)
void
VID_Shutdown (void)
{
if (!vid_initialized)
return;
@ -135,12 +138,14 @@ InitSig(void)
signal(SIGTRAP, signal_handler);
signal(SIGIOT, signal_handler);
signal(SIGBUS, signal_handler);
/* signal(SIGFPE, signal_handler); */
// signal(SIGFPE, signal_handler);
signal(SIGSEGV, signal_handler);
signal(SIGTERM, signal_handler);
}
#endif
void VID_SetPalette (unsigned char *palette)
void
VID_SetPalette (unsigned char *palette)
{
byte *pal;
unsigned r,g,b;
@ -150,7 +155,7 @@ void VID_SetPalette (unsigned char *palette)
unsigned short i;
unsigned *table;
FILE *f;
char s[255];
char s[256];
float dist, bestdist;
static qboolean palflag = false;
@ -161,8 +166,7 @@ void VID_SetPalette (unsigned char *palette)
pal = palette;
table = d_8to24table;
for (i=0 ; i<256 ; i++)
{
for (i=0; i<256; i++) {
r = pal[0];
g = pal[1];
b = pal[2];
@ -219,12 +223,14 @@ void VID_SetPalette (unsigned char *palette)
}
}
void VID_ShiftPalette (unsigned char *palette)
void
VID_ShiftPalette (unsigned char *palette)
{
VID_SetPalette(palette);
}
void GL_Init (void)
void
GL_Init (void)
{
gl_vendor = glGetString (GL_VENDOR);
Con_Printf ("GL_VENDOR: %s\n", gl_vendor);
@ -236,8 +242,6 @@ void GL_Init (void)
gl_extensions = glGetString (GL_EXTENSIONS);
Con_Printf ("GL_EXTENSIONS: %s\n", gl_extensions);
// Con_Printf ("%s %s\n", gl_renderer, gl_version);
glClearColor (0,0,0,0);
glCullFace(GL_FRONT);
glEnable(GL_TEXTURE_2D);
@ -270,26 +274,30 @@ GL_BeginRendering
=================
*/
void GL_BeginRendering (int *x, int *y, int *width, int *height)
void
GL_BeginRendering (int *x, int *y, int *width, int *height)
{
*x = *y = 0;
*width = scr_width;
*height = scr_height;
}
void GL_EndRendering (void)
void
GL_EndRendering (void)
{
glFlush();
SDL_GL_SwapBuffers ();
}
qboolean VID_Is8bit(void)
qboolean
VID_Is8bit(void)
{
return is8bit;
}
#ifdef GL_EXT_SHARED
void VID_Init8bitPalette()
void
VID_Init8bitPalette (void)
{
// Check for 8bit Extensions and initialize them.
int i;
@ -315,13 +323,15 @@ void VID_Init8bitPalette()
#else
void VID_Init8bitPalette(void)
void
VID_Init8bitPalette(void)
{
}
#endif
void VID_Init (unsigned char *palette)
void
VID_Init (unsigned char *palette)
{
Uint32 flags = SDL_OPENGL;
int i;
@ -359,23 +369,24 @@ void VID_Init (unsigned char *palette)
i = COM_CheckParm ("-conheight");
if ( i != 0 ) // Set console height, but no smaller than 200 px
vid.conheight = atoi(com_argv[i+1]);
if (vid.conheight < 200)
vid.conheight = 200;
vid.conheight = max (atoi (com_argv[i+1]), 200);
// Initialize the SDL library
if (SDL_Init (SDL_INIT_VIDEO) < 0)
Sys_Error ("Couldn't initialize SDL: %s\n", SDL_GetError ());
// Check if we want fullscreen
if(vid_fullscreen->value)
{
if (vid_fullscreen->value) {
flags |= SDL_FULLSCREEN;
// Don't annoy Mesa/3dfx folks
#ifndef WIN32
// FIXME: Maybe this could be put in a different spot, but I don't know where.
// Anyway, it's to work around a 3Dfx Glide bug.
SDL_ShowCursor (0);
SDL_WM_GrabInput (SDL_GRAB_ON);
setenv ("MESA_GLX_FX", "fullscreen", 1);
} else {
setenv ("MESA_GLX_FX","disable",1);
setenv ("MESA_GLX_FX", "window", 1);
#endif
}
@ -386,8 +397,7 @@ void VID_Init (unsigned char *palette)
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 1);
if (SDL_SetVideoMode(width, height, 8, flags) == NULL)
{
if (SDL_SetVideoMode (width, height, 8, flags) == NULL) {
Sys_Error ("Couldn't set video mode: %s\n", SDL_GetError ());
SDL_Quit ();
}
@ -395,12 +405,8 @@ void VID_Init (unsigned char *palette)
scr_width = width;
scr_height = height;
if (vid.conheight > height)
vid.conheight = height;
if (vid.conwidth > width)
vid.conwidth = width;
vid.width = vid.conwidth;
vid.height = vid.conheight;
vid.height = vid.conheight = min (vid.conheight, height);
vid.width = vid.conwidth = min (vid.conwidth, width);
vid.aspect = ((float) vid.height / (float) vid.width) * (320.0 / 240.0);
vid.numpages = 2;
@ -443,23 +449,21 @@ IN_SendKeyEvents
================
*/
void IN_SendKeyEvents (void)
void
IN_SendKeyEvents (void)
{
SDL_Event event;
int sym, state, but;
int modstate;
while (SDL_PollEvent(&event))
{
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_KEYDOWN:
case SDL_KEYUP:
sym = event.key.keysym.sym;
state = event.key.state;
modstate = SDL_GetModState ();
switch(sym)
{
switch (sym) {
case SDLK_DELETE: sym = K_DEL; break;
case SDLK_BACKSPACE: sym = K_BACKSPACE; break;
case SDLK_F1: sym = K_F1; break;
@ -493,45 +497,65 @@ void IN_SendKeyEvents (void)
case SDLK_LALT: sym = K_ALT; break;
case SDLK_CAPSLOCK: sym = K_CAPSLOCK; break;
case SDLK_KP0:
if(modstate & KMOD_NUM) sym = K_INS;
else sym = SDLK_0;
if (modstate & KMOD_NUM)
sym = K_INS;
else
sym = SDLK_0;
break;
case SDLK_KP1:
if(modstate & KMOD_NUM) sym = K_END;
else sym = SDLK_1;
if (modstate & KMOD_NUM)
sym = K_END;
else
sym = SDLK_1;
break;
case SDLK_KP2:
if(modstate & KMOD_NUM) sym = K_DOWNARROW;
else sym = SDLK_2;
if (modstate & KMOD_NUM)
sym = K_DOWNARROW;
else
sym = SDLK_2;
break;
case SDLK_KP3:
if(modstate & KMOD_NUM) sym = K_PGDN;
else sym = SDLK_3;
if (modstate & KMOD_NUM)
sym = K_PGDN;
else
sym = SDLK_3;
break;
case SDLK_KP4:
if(modstate & KMOD_NUM) sym = K_LEFTARROW;
else sym = SDLK_4;
if (modstate & KMOD_NUM)
sym = K_LEFTARROW;
else
sym = SDLK_4;
break;
case SDLK_KP5: sym = SDLK_5; break;
case SDLK_KP6:
if(modstate & KMOD_NUM) sym = K_RIGHTARROW;
else sym = SDLK_6;
if (modstate & KMOD_NUM)
sym = K_RIGHTARROW;
else
sym = SDLK_6;
break;
case SDLK_KP7:
if(modstate & KMOD_NUM) sym = K_HOME;
else sym = SDLK_7;
if (modstate & KMOD_NUM)
sym = K_HOME;
else
sym = SDLK_7;
break;
case SDLK_KP8:
if(modstate & KMOD_NUM) sym = K_UPARROW;
else sym = SDLK_8;
if (modstate & KMOD_NUM)
sym = K_UPARROW;
else
sym = SDLK_8;
break;
case SDLK_KP9:
if(modstate & KMOD_NUM) sym = K_PGUP;
else sym = SDLK_9;
if (modstate & KMOD_NUM)
sym = K_PGUP;
else
sym = SDLK_9;
break;
case SDLK_KP_PERIOD:
if(modstate & KMOD_NUM) sym = K_DEL;
else sym = SDLK_PERIOD;
if (modstate & KMOD_NUM)
sym = K_DEL;
else
sym = SDLK_PERIOD;
break;
case SDLK_KP_DIVIDE: sym = SDLK_SLASH; break;
case SDLK_KP_MULTIPLY: sym = SDLK_ASTERISK; break;
@ -542,7 +566,8 @@ void IN_SendKeyEvents (void)
}
// If we're not directly handled and still above 255
// just force it to 0
if(sym > 255) sym = 0;
if (sym > 255)
sym = 0;
Key_Event(sym, state);
break;
@ -568,6 +593,8 @@ void IN_SendKeyEvents (void)
Key_Event(K_MWHEELDOWN, 1);
Key_Event(K_MWHEELDOWN, 0);
break;
default:
break;
}
break;
@ -584,9 +611,7 @@ void IN_SendKeyEvents (void)
SDL_WarpMouse(vid.width/2, vid.height/2);
}
}
}
else
{
} else {
mouse_x = event.motion.xrel*2;
mouse_y = event.motion.yrel*2;
}
@ -602,12 +627,12 @@ void IN_SendKeyEvents (void)
}
}
void IN_Init (void)
void
IN_Init (void)
{
_windowed_mouse = Cvar_Get ("_windowed_mouse","0",CVAR_ARCHIVE,"None");
_windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, "Grab mouse and keyboard input");
m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, "None");
if (COM_CheckParm ("-nomouse") && !_windowed_mouse->value)
return;
@ -618,7 +643,8 @@ void IN_Init (void)
// FIXME: disable DGA if in_dgamouse says to
}
void IN_Shutdown (void)
void
IN_Shutdown (void)
{
mouse_avail = 0;
}
@ -629,15 +655,16 @@ IN_Commands(void)
if (old__windowed_mouse != _windowed_mouse->value) {
old__windowed_mouse = _windowed_mouse->value;
if (!_windowed_mouse->value) {
/* ungrab the pointer */
SDL_WM_GrabInput (SDL_GRAB_OFF);
} else {
/* grab the pointer */
if (_windowed_mouse->value) { // grab the pointer
SDL_ShowCursor (0);
SDL_WM_GrabInput (SDL_GRAB_ON);
} else { // ungrab the pointer
SDL_WM_GrabInput (SDL_GRAB_OFF);
SDL_ShowCursor (1);
}
}
}
void
IN_Move(usercmd_t *cmd)
{
@ -663,11 +690,7 @@ IN_Move(usercmd_t *cmd)
V_StopPitchDrift ();
if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) {
cl.viewangles[PITCH] += m_pitch->value * mouse_y;
if (cl.viewangles[PITCH] > 80)
cl.viewangles[PITCH] = 80;
if (cl.viewangles[PITCH] < -70)
cl.viewangles[PITCH] = -70;
cl.viewangles[PITCH] = bound (-70, cl.viewangles[PITCH] + (m_pitch->value * mouse_y), 80);
} else {
if ((in_strafe.state & 1) && noclip_anglehack)
cmd->upmove -= m_forward->value * mouse_y;