- Fix warnings reported by gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)

SVN r3293 (trunk)
This commit is contained in:
Randy Heit 2011-09-14 23:24:32 +00:00
parent d6b6a73fee
commit de8bf651f2
6 changed files with 103 additions and 13 deletions

View file

@ -513,9 +513,9 @@ bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBO
while (P_PointOnLineSide(x, y, l) != side && --fudge >= 0) while (P_PointOnLineSide(x, y, l) != side && --fudge >= 0)
{ {
if (abs(l->dx) > abs(l->dy)) if (abs(l->dx) > abs(l->dy))
y -= l->dx < 0 != side ? -1 : 1; y -= (l->dx < 0) != side ? -1 : 1;
else else
x += l->dy < 0 != side ? -1 : 1; x += (l->dy < 0) != side ? -1 : 1;
} }
// Adjust z position to be same height above ground as before. // Adjust z position to be same height above ground as before.

View file

@ -417,8 +417,6 @@ void FVoxel::Remap()
static bool VOX_ReadSpriteNames(FScanner &sc, TArray<DWORD> &vsprites) static bool VOX_ReadSpriteNames(FScanner &sc, TArray<DWORD> &vsprites)
{ {
unsigned int i;
vsprites.Clear(); vsprites.Clear();
while (sc.GetString()) while (sc.GetString())
{ {
@ -442,8 +440,7 @@ static bool VOX_ReadSpriteNames(FScanner &sc, TArray<DWORD> &vsprites)
else else
{ {
int frame = (sc.StringLen == 4) ? 255 : sc.String[4] - 'A'; int frame = (sc.StringLen == 4) ? 255 : sc.String[4] - 'A';
int i = GetSpriteIndex(sc.String, false);
i = GetSpriteIndex(sc.String, false);
if (i != -1) if (i != -1)
{ {
vsprites.Push((frame << 24) | i); vsprites.Push((frame << 24) | i);

View file

@ -186,7 +186,7 @@ int FDirectory::AddDirectory(const char *dirpath)
{ {
if (strstr(fileinfo.name, ".orig") || strstr(fileinfo.name, ".bak")) if (strstr(fileinfo.name, ".orig") || strstr(fileinfo.name, ".bak"))
{ {
// We shuuldn't add backup files to the lump directory // We shouldn't add backup files to the lump directory
continue; continue;
} }
@ -211,8 +211,8 @@ int FDirectory::AddDirectory(const char *dirpath)
DIR* directory = opendir(scanDirectories[i].GetChars()); DIR* directory = opendir(scanDirectories[i].GetChars());
if (directory == NULL) if (directory == NULL)
{ {
Printf("Could not ready directory: %s\n", strerror(errno)); Printf("Could not read directory: %s\n", strerror(errno));
return NULL; return 0;
} }
struct dirent *file; struct dirent *file;
@ -261,7 +261,7 @@ int FDirectory::AddDirectory(const char *dirpath)
if (fts == NULL) if (fts == NULL)
{ {
Printf("Failed to start directory traversal: %s\n", strerror(errno)); Printf("Failed to start directory traversal: %s\n", strerror(errno));
return NULL; return 0;
} }
while ((ent = fts_read(fts)) != NULL) while ((ent = fts_read(fts)) != NULL)
{ {

View file

@ -81,6 +81,10 @@ extern "C" int cc_install_handlers(int, char**, int, int*, const char*, int(*)(c
// EXTERNAL DATA DECLARATIONS ---------------------------------------------- // EXTERNAL DATA DECLARATIONS ----------------------------------------------
#ifdef USE_XCURSOR
extern bool UseXCursor;
#endif
// PUBLIC DATA DEFINITIONS ------------------------------------------------- // PUBLIC DATA DEFINITIONS -------------------------------------------------
#ifndef NO_GTK #ifndef NO_GTK
@ -256,7 +260,7 @@ int main (int argc, char **argv)
cc_install_handlers(argc, argv, 4, s, "zdoom-crash.log", DoomSpecificInfo); cc_install_handlers(argc, argv, 4, s, "zdoom-crash.log", DoomSpecificInfo);
} }
printf(GAMENAME" v%s - SVN revision %s - SDL version\nCompiled on %s\n\n", printf(GAMENAME" v%s - SVN revision %s - SDL version\nCompiled on %s\n",
DOTVERSIONSTR_NOREV,SVN_REVISION_STRING,__DATE__); DOTVERSIONSTR_NOREV,SVN_REVISION_STRING,__DATE__);
seteuid (getuid ()); seteuid (getuid ());
@ -279,6 +283,19 @@ int main (int argc, char **argv)
} }
atterm (SDL_Quit); atterm (SDL_Quit);
{
char viddriver[80];
if (SDL_VideoDriverName(viddriver, sizeof(viddriver)) != NULL)
{
printf("Using video driver %s\n", viddriver);
#ifdef USE_XCURSOR
UseXCursor = (strcmp(viddriver, "x11") == 0);
#endif
}
printf("\n");
}
SDL_WM_SetCaption (GAMESIG " " DOTVERSIONSTR " (" __DATE__ ")", NULL); SDL_WM_SetCaption (GAMESIG " " DOTVERSIONSTR " (" __DATE__ ")", NULL);
try try

View file

@ -79,6 +79,13 @@
#include "m_fixed.h" #include "m_fixed.h"
#include "g_level.h" #include "g_level.h"
#ifdef USE_XCURSOR
// Xlib has its own GC, so don't let it interfere.
#define GC XGC
#include <X11/Xcursor/Xcursor.h>
#undef GC
#endif
EXTERN_CVAR (String, language) EXTERN_CVAR (String, language)
extern "C" extern "C"
@ -92,6 +99,11 @@ extern bool GtkAvailable;
#elif defined(__APPLE__) #elif defined(__APPLE__)
int I_PickIWad_Cocoa (WadStuff *wads, int numwads, bool showwin, int defaultiwad); int I_PickIWad_Cocoa (WadStuff *wads, int numwads, bool showwin, int defaultiwad);
#endif #endif
#ifdef USE_XCURSOR
bool UseXCursor;
SDL_Cursor *X11Cursor;
SDL_Cursor *FirstCursor;
#endif
DWORD LanguageIDs[4] = DWORD LanguageIDs[4] =
{ {
@ -830,6 +842,47 @@ unsigned int I_MakeRNGSeed()
return seed; return seed;
} }
#ifdef USE_XCURSOR
// Hack! Hack! SDL does not provide a clean way to get the XDisplay.
// On the other hand, there are no more planned updates for SDL 1.2,
// so we should be fine making assumptions.
struct SDL_PrivateVideoData
{
int local_X11;
Display *X11_Display;
};
struct SDL_VideoDevice
{
const char *name;
int (*functions)()[9];
SDL_VideoInfo info;
SDL_PixelFormat *displayformatalphapixel;
int (*morefuncs)()[9];
Uint16 *gamma;
int (*somefuncs)()[9];
unsigned int texture; // Only here if SDL was compiled with OpenGL support. Ack!
int is_32bit;
int (*itsafuncs)()[13];
SDL_Surface *surfaces[3];
SDL_Palette *physpal;
SDL_Color *gammacols;
char *wm_strings[2];
int offsets[2];
SDL_GrabMode input_grab;
int handles_any_size;
SDL_PrivateVideoData *hidden; // Why did they have to bury this so far in?
};
extern SDL_VideDevice *current_video;
#define SDL_Display (current_video->hidden->X11_Display)
SDL_Cursor *CreateColorCursor(FTexture *cursorpic)
{
return NULL;
}
#endif
SDL_Surface *cursorSurface = NULL; SDL_Surface *cursorSurface = NULL;
SDL_Rect cursorBlit = {0, 0, 32, 32}; SDL_Rect cursorBlit = {0, 0, 32, 32};
bool I_SetCursor(FTexture *cursorpic) bool I_SetCursor(FTexture *cursorpic)
@ -842,6 +895,21 @@ bool I_SetCursor(FTexture *cursorpic)
return false; return false;
} }
#ifdef USE_XCURSOR
if (UseXCursor)
{
if (FirstCursor == NULL)
{
FirstCursor = SDL_GetCursor();
}
X11Cursor = CreateColorCursor(cursorpic);
if (X11Cursor != NULL)
{
SDL_SetCursor(X11Cursor);
return true;
}
}
#endif
if (cursorSurface == NULL) if (cursorSurface == NULL)
cursorSurface = SDL_CreateRGBSurface (0, 32, 32, 32, MAKEARGB(0,255,0,0), MAKEARGB(0,0,255,0), MAKEARGB(0,0,0,255), MAKEARGB(255,0,0,0)); cursorSurface = SDL_CreateRGBSurface (0, 32, 32, 32, MAKEARGB(0,255,0,0), MAKEARGB(0,0,255,0), MAKEARGB(0,0,0,255), MAKEARGB(255,0,0,0));
@ -863,6 +931,14 @@ bool I_SetCursor(FTexture *cursorpic)
SDL_FreeSurface(cursorSurface); SDL_FreeSurface(cursorSurface);
cursorSurface = NULL; cursorSurface = NULL;
} }
#ifdef USE_XCURSOR
if (X11Cursor != NULL)
{
SDL_SetCursor(FirstCursor);
SDL_FreeCursor(X11Cursor);
X11Cursor = NULL;
}
#endif
} }
return true; return true;
} }

View file

@ -3888,7 +3888,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_WolfAttack)
if (dpuff->flags2 & MF2_THRUGHOST && self->target->flags3 & MF3_GHOST) if (dpuff->flags2 & MF2_THRUGHOST && self->target->flags3 & MF3_GHOST)
damage = 0; damage = 0;
if (0 && dpuff->flags3 & MF3_PUFFONACTORS || !spawnblood) if ((0 && dpuff->flags3 & MF3_PUFFONACTORS) || !spawnblood)
{ {
spawnblood = false; spawnblood = false;
P_SpawnPuff(self, pufftype, dx, dy, dz, angle, 0); P_SpawnPuff(self, pufftype, dx, dy, dz, angle, 0);