console.c, gl_vidsdl.c, host_cmd.c, in_sdl.c, main.c, menu.c, net_sdl.c,

net_sdlnet.c, sys_sdl.c: a lot of space-to-tab whitespace tidy-ups in the
files created or touched by the SDL port. no actual code change.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@43 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2010-02-17 23:32:04 +00:00
parent 9d9354165c
commit 6c7d3d7205
9 changed files with 876 additions and 879 deletions

View file

@ -32,6 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MAXHEIGHT 10000
#define BASEWIDTH 320
#define BASEHEIGHT 200
#define SDL_DEFAULT_FLAGS SDL_OPENGL
typedef struct {
@ -146,10 +147,6 @@ cvar_t vid_gamma = {"gamma", "1", true}; //johnfitz -- moved here from view.c
//
//==========================================================================
//typedef int (WINAPI * RAMPFUNC)();
//RAMPFUNC wglGetDeviceGammaRamp3DFX;
//RAMPFUNC wglSetDeviceGammaRamp3DFX;
unsigned short vid_gamma_red[256];
unsigned short vid_gamma_green[256];
unsigned short vid_gamma_blue[256];
@ -279,12 +276,16 @@ int VID_SetMode (int modenum)
{
if (_windowed_mouse.value && key_dest == key_game)
{
draw_context = SDL_SetVideoMode(modelist[modenum].width, modelist[modenum].height, modelist[modenum].bpp, flags);
draw_context = SDL_SetVideoMode(modelist[modenum].width,
modelist[modenum].height,
modelist[modenum].bpp, flags);
stat = true;
}
else
{
draw_context = SDL_SetVideoMode(modelist[modenum].width, modelist[modenum].height, modelist[modenum].bpp, flags);
draw_context = SDL_SetVideoMode(modelist[modenum].width,
modelist[modenum].height,
modelist[modenum].bpp, flags);
stat = true;
}
modestate = MODE_WINDOWED;
@ -293,8 +294,9 @@ int VID_SetMode (int modenum)
else if (modelist[modenum].type == MODE_FULLSCREEN_DEFAULT)
{
flags |= SDL_FULLSCREEN;
draw_context = SDL_SetVideoMode(modelist[modenum].width, modelist[modenum].height, modelist[modenum].bpp, flags);
draw_context = SDL_SetVideoMode(modelist[modenum].width,
modelist[modenum].height,
modelist[modenum].bpp, flags);
stat = true;
modestate = MODE_FULLSCREEN_DEFAULT;
}
@ -682,14 +684,18 @@ void GL_CheckExtensions (void)
//
if (strstr(gl_extensions, "GL_EXT_swap_control"))
{
if (SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0) == -1) {
if (SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0) == -1)
{
Con_Printf("WARNING: vertical sync not supported (SDL_GL_SetAttribute failed)\n");
}
else
{
if (SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL, &swap_control) == -1) {
if (SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL, &swap_control) == -1)
{
Con_Printf("WARNING: vertical sync not supported (SDL_GL_GetAttribute failed). Make sure you don't have vertical sync disabled in your driver settings.\n");
} else if (swap_control == -1) {
}
else if (swap_control == -1)
{
// TODO: check if this is correct - I don't know what SDL returns if vertical sync is disabled
Con_Printf("WARNING: vertical sync not supported (swap interval is -1.) Make sure you don't have vertical sync disabled in your driver settings.\n");
}
@ -785,7 +791,6 @@ void GL_Init (void)
if (SDL_strncasecmp(gl_renderer,"PowerVR",7)==0)
fullsbardraw = true;
if (SDL_strncasecmp(gl_renderer,"Permedia",8)==0)
isPermedia = true;
#if 1
@ -1045,7 +1050,7 @@ void VID_DescribeModes_f (void)
VID_InitDIB
=================
*/
void VID_InitDIB ()
void VID_InitDIB (void)
{
const SDL_VideoInfo *info;
@ -1088,7 +1093,7 @@ void VID_InitDIB ()
VID_InitFullDIB
=================
*/
void VID_InitFullDIB ()
void VID_InitFullDIB (void)
{
SDL_PixelFormat format;
SDL_Rect **modes;
@ -1200,8 +1205,6 @@ void VID_Init (void)
Cmd_AddCommand ("vid_describecurrentmode", VID_DescribeCurrentMode_f);
Cmd_AddCommand ("vid_describemodes", VID_DescribeModes_f);
//InitCommonControls();
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1)
Sys_Error("Could not initialize SDL Video");

View file

@ -270,26 +270,25 @@ void ExtraMaps_Init (void)
{
sprintf (filestring,"%s/maps/",search->filename);
dir_p = opendir(filestring);
if (dir_p == NULL)
continue;
while ((dir_t = readdir(dir_p)) != NULL)
{
if (!strstr(dir_t->d_name, ".bsp") && !strstr(dir_t->d_name, ".BSP"))
continue;
COM_StripExtension(dir_t->d_name, mapname);
ExtraMaps_Add (mapname);
}
closedir(dir_p);
}
else //pakfile
{
if (!strstr(search->pack->filename, ignorepakdir)) //don't list standard id maps
{
for (i=0, pak=search->pack; i<pak->numfiles ; i++)
{
if (strstr(pak->files[i].name, ".bsp"))
{
if (pak->files[i].filelen > 32*1024) // don't list files under 32k (ammo boxes etc)
{
COM_StripExtension(pak->files[i].name + 5, mapname);
@ -298,6 +297,9 @@ void ExtraMaps_Init (void)
}
}
}
}
}
}
void ExtraMaps_Clear (void)
{
@ -402,36 +404,27 @@ void Modlist_Init (void)
{
if ((strcmp(dir_t->d_name, ".") == 0) || (strcmp(dir_t->d_name, "..") == 0))
continue;
sprintf(mod_dir_string, "%s%s/", dir_string, dir_t->d_name);
mod_dir_p = opendir(mod_dir_string);
if (mod_dir_p == NULL)
continue;
progs_found = false;
pak_found = false;
// find progs.dat and pak file(s)
while ((mod_dir_t = readdir(mod_dir_p)) != NULL)
{
if ((strcmp(mod_dir_t->d_name, ".") == 0) || (strcmp(mod_dir_t->d_name, "..") == 0))
continue;
if (Q_strcasecmp(mod_dir_t->d_name, "progs.dat") != -1)
progs_found = true;
if (strstr(mod_dir_t->d_name, ".pak") || strstr(mod_dir_t->d_name, ".PAK"))
pak_found = true;
if (progs_found || pak_found)
break;
}
closedir(mod_dir_p);
if (!progs_found && !pak_found)
continue;
Modlist_Add(dir_t->d_name);
}

View file

@ -31,7 +31,8 @@ int total_dx, total_dy = 0;
int FilterMouseEvents (const SDL_Event *event)
{
switch (event->type) {
switch (event->type)
{
case SDL_MOUSEMOTION:
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
@ -166,3 +167,4 @@ void IN_Move (usercmd_t *cmd)
void IN_ClearStates (void)
{
}

View file

@ -52,15 +52,13 @@ int main(int argc, char *argv[])
parms.memsize = Q_atoi(com_argv[t]) * 1024;
}
// TODO: dedicated server setup
parms.membase = malloc (parms.memsize);
if (!parms.membase)
Sys_Error ("Not enough memory free; check disk space\n");
// TODO: dedicated server setup
// S_BlockSound(); do I need this?
Con_Printf("\nFitzQuake Version %1.2f (c) John Fitzgibbons\n", FITZQUAKE_VERSION);
Con_Printf("SDL port (c) Sleepwalkr, Baker, and OZ\n");
Con_Printf("This version hacked by Stevenaaus and OZ\n");
@ -73,8 +71,10 @@ int main(int argc, char *argv[])
{
// TODO: dedicated server loop
while (!done && SDL_PollEvent (&event)) {
switch (event.type) {
while (!done && SDL_PollEvent (&event))
{
switch (event.type)
{
case SDL_ACTIVEEVENT:
if (event.active.state & SDL_APPACTIVE & SDL_APPINPUTFOCUS)
{
@ -94,8 +94,8 @@ int main(int argc, char *argv[])
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
switch (event.button.button) {
switch (event.button.button)
{
case SDL_BUTTON_LEFT:
Key_Event(K_MOUSE1, event.button.type == SDL_MOUSEBUTTONDOWN);
break;
@ -143,7 +143,6 @@ int main(int argc, char *argv[])
newtime = Sys_FloatTime();
time = newtime - oldtime;
Host_Frame(time);
// throttle the game loop just a little bit - noone needs more than 1000fps, I think
@ -156,3 +155,4 @@ int main(int argc, char *argv[])
Sys_Quit();
return 0;
}

View file

@ -110,3 +110,4 @@ net_landriver_t net_landrivers[MAX_NET_DRIVERS] =
};
int net_numlandrivers = 1;

View file

@ -38,37 +38,35 @@ static int net_acceptsocket = -1;
static struct qsockaddr broadcastaddr;
SDLNet_SocketSet acceptsocket_set;
IPaddress myaddr;
// contains a map of socket numbers to SDL_net UDP sockets
UDPsocket net_sockets[MAX_SOCKETS];
int socket_id (UDPsocket socket)
{
int i;
int index = -1;
int idx = -1;
for (i = 0; i < MAX_SOCKETS; i++)
{
if (net_sockets[i] == socket)
return i;
if (net_sockets[i] == NULL && index == -1)
if (net_sockets[i] == NULL && idx == -1)
{
index = i;
idx = i;
break;
}
}
if (index == -1)
if (idx == -1)
{
// todo error
}
net_sockets[index] = socket;
net_sockets[idx] = socket;
return index;
return idx;
}
char *_AddrToString (int ip, int port)
@ -221,7 +219,6 @@ void SDLN_Listen (qboolean state)
int SDLN_OpenSocket (int port)
{
UDPsocket newsocket;
static IPaddress address;
@ -315,7 +312,6 @@ int SDLN_Read (int socketid, byte *buf, int len, struct qsockaddr *addr)
}
return numrecv;
}
int SDLN_Write (int socketid, byte *buf, int len, struct qsockaddr *addr)
@ -347,7 +343,6 @@ int SDLN_Write (int socketid, byte *buf, int len, struct qsockaddr *addr)
int SDLN_Broadcast (int socketid, byte *buf, int len)
{
if (socketid != net_broadcastsocket)
{
if (net_broadcastsocket != 0)
@ -432,7 +427,8 @@ int SDLN_GetNameFromAddr (struct qsockaddr *addr, char *name)
ipaddress = (IPaddress *)&(addr->sa_data);
buf = (char *)SDLNet_ResolveIP(ipaddress);
if (buf != NULL) {
if (buf != NULL)
{
Q_strncpy(name, buf, NET_NAMELEN - 1);
return 0;
}

View file

@ -23,11 +23,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "errno.h"
#define CONSOLE_ERROR_TIMEOUT 60.0 // # of seconds to wait on Sys_Error running
#define CONSOLE_ERROR_TIMEOUT 60.0 /* # of seconds to wait on Sys_Error running */
qboolean isDedicated;
static qboolean sc_return_on_enter = false;
#define MAX_HANDLES 32 //johnfitz -- was 10
#define MAX_HANDLES 32 /* johnfitz -- was 10 */
FILE *sys_handles[MAX_HANDLES];
int findhandle (void)
@ -157,17 +157,19 @@ void Sys_Error (char *error, ...)
if (!in_sys_error3)
{
in_sys_error3 = 1;
// VID_ForceUnlockedAndReturnState (); TODO: see what this does
}
//TODO: use OS messagebox here if possible (windows, os x and linux shouldn't be a problem)
//implement this in pl_*, which contains all the platform dependent code
//TODO: use OS messagebox here if possible
// (windows, os x and linux shouldn't be a problem)
//implement this in pl_*, which contains all the
// platform dependent code
va_start (argptr, error);
vsprintf (text, error, argptr);
va_end (argptr);
if (isDedicated) {
if (isDedicated)
{
sprintf (text2, "ERROR: %s\n", text);
printf ("%s", text5);
printf ("%s", text4);
@ -198,7 +200,7 @@ void Sys_Error (char *error, ...)
if (!in_sys_error2)
{
in_sys_error2 = 1;
//DeinitConProc (); TODO: check what this does
// DeinitConProc ();
}
exit (1);
@ -219,7 +221,6 @@ void Sys_Printf (char *fmt, ...)
void Sys_Quit (void)
{
Host_Shutdown();
// if (isDedicated)
@ -241,7 +242,6 @@ char *Sys_ConsoleInput (void)
return 0;
}
void Sys_Sleep (void)
{
}
@ -253,7 +253,8 @@ void Sys_SendKeyEvents (void)
SDL_PumpEvents();
while (SDL_PollEvent (&event))
{
switch (event.type) {
switch (event.type)
{
case SDL_KEYDOWN:
case SDL_KEYUP:
Key_Event(Key_Map(&(event.key)), event.key.type == SDL_KEYDOWN);
@ -279,3 +280,4 @@ void Sys_HighFPPrecision (void)
void Sys_SetFPCW (void)
{
}