diff --git a/Makefile b/Makefile index 98151f7ea56..a2e5ae01008 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # $Header$ CC = gcc -CFLAGS = -g -Wno-multichar +CFLAGS = -g -Wall -Wstrict-prototypes -Wno-long-long -Wno-multichar DEFINES = -DUNIX -DUSE_ADLIB LDFLAGS := INCLUDES:= `sdl-config --cflags` -I./ -I./sound diff --git a/actor.cpp b/actor.cpp index 7811345037f..fb29e174384 100644 --- a/actor.cpp +++ b/actor.cpp @@ -977,7 +977,7 @@ void Scumm::actorTalk() { _msgPtrToAdd = charset._buffer; _messagePtr = addMessageToStack(_messagePtr); - assert(_msgPtrToAdd - charset._buffer < sizeof(charset._buffer)); + assert((int)(_msgPtrToAdd - charset._buffer) < (int)(sizeof(charset._buffer))); if (_actorToPrintStrFor==0xFF) { if (!_keepText) diff --git a/debug.cpp b/debug.cpp index e22a33af536..2938fd405b8 100644 --- a/debug.cpp +++ b/debug.cpp @@ -110,7 +110,7 @@ bool ScummDebugger::do_command() { return true; case CMD_DUMPBOX: { - int num, i = 0, rows = 0; + int num, i = 0; BoxCoords box; byte *boxm = _s->getBoxMatrixBaseAddr(); num = _s->getNumBoxes(); @@ -206,11 +206,11 @@ static const DebuggerCommands debugger_commands[] = { { "a", 1, CMD_ACTOR }, { "s", 1, CMD_SCRIPTS }, { "r", 1, CMD_LOAD_ROOM }, - { "b", 1, CMD_DUMPBOX}, + { "b", 1, CMD_DUMPBOX}, { "v", 1, CMD_VAR}, { "w", 1, CMD_WATCH}, { "e", 1, CMD_EXIT }, - { 0, 0, 0 }, + { "" , 0, 0 } }; int ScummDebugger::get_command() { diff --git a/gfx.cpp b/gfx.cpp index a80132c9495..b6b3d6ad19a 100644 --- a/gfx.cpp +++ b/gfx.cpp @@ -940,7 +940,7 @@ void Gdi::decompressMaskImgOr() { void Scumm::redrawBGStrip(int start, int num) { int s = _screenStartStrip + start; - assert(s>=0 && s=0 && (size_t)ssrc, *curbuf; + byte *curbuf; uint size; diff --git a/object.cpp b/object.cpp index 08f717bf18a..df857cbb6bc 100644 --- a/object.cpp +++ b/object.cpp @@ -654,7 +654,7 @@ void Scumm::removeObjectFromRoom(int obj) { void Scumm::addObjectToDrawQue(int object) { _drawObjectQue[_drawObjectQueNr++] = object; - if (_drawObjectQueNr > sizeof(_drawObjectQue)/sizeof(_drawObjectQue[0])) + if ((unsigned int)_drawObjectQueNr > sizeof(_drawObjectQue)/sizeof(_drawObjectQue[0])) error("Draw Object Que overflow"); } diff --git a/resource.cpp b/resource.cpp index 9a2b806fe68..4edc81158a5 100644 --- a/resource.cpp +++ b/resource.cpp @@ -55,7 +55,7 @@ void Scumm::openRoom(int room) { room_offs = room ? _roomFileOffsets[room] : 0; #endif - if (room_offs == 0xFFFFFFFF) + if (room_offs == (int)0xFFFFFFFF) break; if (room_offs != 0 && room != 0) { @@ -495,7 +495,7 @@ void Scumm::readResTypeList(int id, uint32 tag, const char *name) { void Scumm::allocResTypeData(int id, uint32 tag, int num, const char *name, int mode) { debug(9, "allocResTypeData(%d,%x,%d,%s,%d)",id,FROM_LE_32(tag),num,name,mode); - assert(id>=0 && id=0 && id<(int)(sizeof(res.mode)/sizeof(res.mode[0]))); if (num>=2000) { error("Too many %ss (%d) in directory", name, num); @@ -1099,7 +1099,7 @@ void Scumm::resourceStats() { } } - printf("Total allocated size=%d, locked=%d(%d)\n", _allocatedSize, lockedSize, lockedNum); + printf("Total allocated size=%ld, locked=%ld(%ld)\n", _allocatedSize, lockedSize, lockedNum); } void Scumm::heapClear(int mode) { diff --git a/script.cpp b/script.cpp index d50adc95664..9d5a8b2ef82 100644 --- a/script.cpp +++ b/script.cpp @@ -732,12 +732,12 @@ int Scumm::getVerbEntrypoint(int obj, int entry) { void Scumm::push(int a) { - assert(_scummStackPos >=0 && _scummStackPos <= ARRAYSIZE(_scummStack)); + assert(_scummStackPos >=0 && (unsigned int)_scummStackPos <= ARRAYSIZE(_scummStack)); _scummStack[_scummStackPos++] = a; } int Scumm::pop() { - assert(_scummStackPos >0 && _scummStackPos <= ARRAYSIZE(_scummStack)); + assert(_scummStackPos >0 && (unsigned int)_scummStackPos <= ARRAYSIZE(_scummStack)); return _scummStack[--_scummStackPos]; } diff --git a/script_v1.cpp b/script_v1.cpp index b881cca4cbc..fefc32dc578 100644 --- a/script_v1.cpp +++ b/script_v1.cpp @@ -1035,7 +1035,7 @@ void Scumm::o5_drawObject() { if (_features & GF_SMALL_HEADER) { int temp = getVarOrDirectWord(0x40); - int room = getVarOrDirectWord(0x20); + getVarOrDirectWord(0x20); // Room idx = getObjectIndex(obj); if(idx==-1) @@ -1850,7 +1850,7 @@ void Scumm::o5_roomOps() { char buf[256],*s; a = getVarOrDirectByte(0x80); s = buf; - while (*s++=fetchScriptByte()); + while ((*s++=fetchScriptByte())); warning("roomops:13 save-string(%d,\"%s\") not implemented", a, buf); break; } @@ -1858,7 +1858,7 @@ void Scumm::o5_roomOps() { char buf[256],*s; a = getVarOrDirectByte(0x80); s = buf; - while (*s++=fetchScriptByte()); + while ((*s++=fetchScriptByte())); warning("roomops:14 load-string(%d,\"%s\") not implemented", a, buf); break; case 15: /* palmanip? */ @@ -2364,7 +2364,8 @@ void Scumm::o5_walkActorToObject() { int Scumm::getWordVararg(int16 *ptr) { int i; - for (i=0; i<16; i++) + + for (i=0; i<15; i++) ptr[i] = 0; i = 0; diff --git a/scumm.h b/scumm.h index 555461ae01e..715a815b720 100644 --- a/scumm.h +++ b/scumm.h @@ -99,8 +99,10 @@ struct MemBlkHeader { }; -#pragma START_PACK_STRUCTS - +#if !defined(__GNUC__) + #pragma START_PACK_STRUCTS +#endif + #define SIZEOF_BOX 20 struct Box { /* file format */ int16 ulx,uly; @@ -219,7 +221,10 @@ struct ImageHeader { /* file format */ } GCC_PACK v7; } GCC_PACK; } GCC_PACK; -#pragma END_PACK_STRUCTS + +#if !defined(__GNUC__) + #pragma END_PACK_STRUCTS +#endif struct AdjustBoxResult { int16 x,y; @@ -361,7 +366,7 @@ enum ResTypes { rtBox = 15, rtObjectName = 16, rtLast = 16, - rtNumTypes = 17, + rtNumTypes = 17 }; enum { @@ -375,7 +380,7 @@ enum { enum { CM_NORMAL = 1, CM_FOLLOW_ACTOR = 2, - CM_PANNING = 3, + CM_PANNING = 3 }; enum { @@ -395,7 +400,7 @@ enum MoveFlags { MF_NEW_LEG = 1, MF_IN_LEG = 2, MF_TURN = 4, - MF_LAST_LEG = 8, + MF_LAST_LEG = 8 }; #define _maxRooms res.num[rtRoom] @@ -745,7 +750,7 @@ struct Gdi { enum DrawBitmapFlags { dbAllowMaskOr = 1, dbDrawMaskOnBoth = 2, - dbClear = 4, + dbClear = 4 }; }; @@ -792,7 +797,7 @@ enum GameId { GID_INDY3_256 = 9, GID_LOOM = 10, GID_FT = 11, - GID_DIG = 12, + GID_DIG = 12 }; enum GameFeatures { @@ -814,7 +819,7 @@ enum GameFeatures { GF_16COLOR = 256, GF_OLD256 = 512, GF_AUDIOTRACKS = 1024, - GF_NO_SCALLING = 2048, + GF_NO_SCALLING = 2048 }; struct ScummDebugger; @@ -1941,7 +1946,7 @@ struct Scumm { enum FindObjectWhat { foCodeHeader = 1, foImageHeader = 2, - foCheckAlreadyLoaded = 4, + foCheckAlreadyLoaded = 4 }; void findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint object, uint room); @@ -2170,7 +2175,7 @@ enum AkosOpcodes{ AKC_JumpLE = 0xC093, AKC_JumpG = 0xC094, AKC_JumpGE = 0xC095, - AKC_ClearFlag = 0xC09F, + AKC_ClearFlag = 0xC09F }; diff --git a/scummsys.h b/scummsys.h index da2ae4fed9e..6a4b5f9ef19 100644 --- a/scummsys.h +++ b/scummsys.h @@ -236,31 +236,31 @@ typedef signed long int32; #define MKID(a) ((((a)>>24)&0xFF) | (((a)>>8)&0xFF00) | (((a)<<8)&0xFF0000) | (((a)<<24)&0xFF000000)) #if defined(SCUMM_NEED_ALIGNMENT) - uint FORCEINLINE READ_LE_UINT16(void *ptr) { + FORCEINLINE uint READ_LE_UINT16(void *ptr) { return (((byte*)ptr)[1]<<8)|((byte*)ptr)[0]; } #else - uint FORCEINLINE READ_LE_UINT16(void *ptr) { + FORCEINLINE uint READ_LE_UINT16(void *ptr) { return *(uint16*)(ptr); } #endif -uint FORCEINLINE READ_BE_UINT16(void *ptr) { +FORCEINLINE uint READ_BE_UINT16(void *ptr) { return (((byte*)ptr)[0]<<8)|((byte*)ptr)[1]; } #if defined(SCUMM_NEED_ALIGNMENT) - uint32 FORCEINLINE READ_LE_UINT32(void *ptr) { + FORCEINLINE uint32 READ_LE_UINT32(void *ptr) { byte *b = (byte*)ptr; return (b[3]<<24)+(b[2]<<16)+(b[1]<<8)+(b[0]); } #else - uint32 FORCEINLINE READ_LE_UINT32(void *ptr) { + FORCEINLINE uint32 READ_LE_UINT32(void *ptr) { return *(uint32*)(ptr); } #endif -uint32 FORCEINLINE READ_BE_UINT32(void *ptr) { +FORCEINLINE uint32 READ_BE_UINT32(void *ptr) { byte *b = (byte*)ptr; return (b[0]<<24)+(b[1]<<16)+(b[2]<<8)+(b[3]); } diff --git a/scummvm.cpp b/scummvm.cpp index 48ab2a882aa..69d4acdfb0b 100644 --- a/scummvm.cpp +++ b/scummvm.cpp @@ -855,7 +855,7 @@ void Scumm::initRoomSubBlocks() { searchptr = roomptr = getResourceAddress(rtRoom, _roomResource); if(_features & GF_SMALL_HEADER) { while( (ptr = findResourceSmall(MKID('LSCR'), searchptr)) != NULL ) { - int id; + int id = 0; ptr += _resourceHeaderSize; /* skip tag & size */ #ifdef DUMP_SCRIPTS do { @@ -870,7 +870,7 @@ void Scumm::initRoomSubBlocks() { } } else { while( (ptr = findResource(MKID('LSCR'), searchptr)) != NULL ) { - int id; + int id = 0; ptr += _resourceHeaderSize; /* skip tag & size */ diff --git a/sdl.cpp b/sdl.cpp index 8723812e1ee..594d1bc768d 100644 --- a/sdl.cpp +++ b/sdl.cpp @@ -658,8 +658,6 @@ void drawMouse(Scumm *s, int xdraw, int ydraw, int w, int h, byte *buf, bool vis } } -static uint32 midi_counter; - void fill_sound(void *userdata, Uint8 *stream, int len) { scumm.mixWaves((int16*)stream, len>>1); } diff --git a/sys.cpp b/sys.cpp index 044e80d3404..cbcf059ea2f 100644 --- a/sys.cpp +++ b/sys.cpp @@ -51,7 +51,6 @@ void Scumm::clearFileReadFailed(void *file) { } bool Scumm::fileEof(void *file) { - FILE *a = (FILE*)file; return feof((FILE*)file) != 0; } diff --git a/windows.cpp b/windows.cpp index 7890054c27e..5d43000ce4f 100644 --- a/windows.cpp +++ b/windows.cpp @@ -507,9 +507,9 @@ DWORD _stdcall WndMan::sound_thread(WndMan *wm) { int time = GetTickCount(), cur; while (1) { + cur = GetTickCount(); if (!snd_driv.wave_based()) { - cur = GetTickCount(); while (time < cur) { sound.on_timer(); time += 10;