diff options
author | Max Horn | 2002-07-17 20:55:36 +0000 |
---|---|---|
committer | Max Horn | 2002-07-17 20:55:36 +0000 |
commit | 862e0b26bc5b1f1a564dd9f1064b2c7dde551436 (patch) | |
tree | 3445434de5128ead87fdedee1dfd98ca0a7d57f8 | |
parent | 0fe3a0c676bfcf773c15b76e4e0fc3e642f82f58 (diff) | |
download | scummvm-rg350-862e0b26bc5b1f1a564dd9f1064b2c7dde551436.tar.gz scummvm-rg350-862e0b26bc5b1f1a564dd9f1064b2c7dde551436.tar.bz2 scummvm-rg350-862e0b26bc5b1f1a564dd9f1064b2c7dde551436.zip |
moved gui/utils.* to main level; removed some unused stuff from our file accessor functions
svn-id: r4583
-rw-r--r-- | Makefile.common | 2 | ||||
-rw-r--r-- | gfx.h | 8 | ||||
-rw-r--r-- | newgui.cpp | 2 | ||||
-rw-r--r-- | newgui.h | 2 | ||||
-rw-r--r-- | scumm.h | 9 | ||||
-rw-r--r-- | sdl.cpp | 4 | ||||
-rw-r--r-- | sys.cpp | 70 | ||||
-rw-r--r-- | system.h | 8 | ||||
-rw-r--r-- | util.cpp (renamed from gui/util.cpp) | 0 | ||||
-rw-r--r-- | util.h (renamed from gui/util.h) | 0 |
10 files changed, 37 insertions, 68 deletions
diff --git a/Makefile.common b/Makefile.common index c4de5c6354..80161337d7 100644 --- a/Makefile.common +++ b/Makefile.common @@ -6,7 +6,7 @@ ZIPFILE := scummvm-`date '+%Y-%m-%d'`.zip INCS = scumm.h scummsys.h stdafx.h -OBJS += gui/widget.o gui/dialog.o gui/util.o newgui.o \ +OBJS += util.o newgui.o gui/widget.o gui/dialog.o \ gui/ListWidget.o gui/ScrollBarWidget.o \ actor.o boxes.o costume.o gfx.o object.o resource.o \ saveload.o script.o scummvm.o sound.o string.o \ @@ -20,6 +20,10 @@ * */ +#ifndef GFX_H +#define GFX_H + + enum VideoMode { /* Video scalers */ VIDEO_SCALE = 0, VIDEO_2XSAI = 1, @@ -180,3 +184,7 @@ struct Gdi { dbClear = 4 }; }; + +void blit(byte *dst, byte *src, int w, int h); + +#endif diff --git a/newgui.cpp b/newgui.cpp index 8263e23b1f..e03829b3f9 100644 --- a/newgui.cpp +++ b/newgui.cpp @@ -23,7 +23,7 @@ #include "newgui.h" #include "guimaps.h" #include "gui/dialog.h" -#include "gui/util.h" +#include "util.h" /* * TODO list @@ -23,7 +23,7 @@ #include "scummsys.h" #include "system.h" // For events -#include "gui/util.h" +#include "util.h" class Dialog; class Scumm; @@ -53,12 +53,6 @@ extern SoundMixer *g_mixer; /* System Wide Constants */ enum { -#ifdef _WIN32_WCE - SAMPLES_PER_SEC = 11025, -#else - SAMPLES_PER_SEC = 22050, -#endif - BITS_PER_SAMPLE = 16, NUM_MIXER = 4, NUM_SCRIPT_SLOT = 40, NUM_LOCALSCRIPT = 60, @@ -1022,8 +1016,6 @@ public: /* Should be in System class */ - byte _fileMode; - uint32 _whereInResToRead; void fileClose(void *file); void *fileOpen(const char *filename, int mode); void fileSeek(void *file, long offs, int whence); @@ -1499,6 +1491,5 @@ void CDECL NORETURN error(const char *s, ...); void CDECL warning(const char *s, ...); void CDECL debug(int level, const char *s, ...); void checkHeap(); -void blit(byte *dst, byte *src, int w, int h); #endif @@ -23,15 +23,15 @@ #include "stdafx.h" #include "scummsys.h" #include "system.h" -#include "scumm.h" // FIXME: remove this! Only needed for SAMPLES_PER_SEC, error() and warning() #include "mididrv.h" -#include "SDL_thread.h" #include "gameDetector.h" #include "scaler.h" +#include "scumm.h" // Only #included for error() and warning() #include "scummvm.xpm" #include <SDL.h> +#include <SDL_thread.h> #define MAX(a,b) (((a)<(b)) ? (b) : (a)) #define MIN(a,b) (((a)>(b)) ? (b) : (a)) @@ -25,23 +25,18 @@ void *Scumm::fileOpen(const char *filename, int mode) { - _fileMode = mode; - _whereInResToRead = 0; clearFileReadFailed(_fileHandle); if (mode == 1) return fopen(filename, "rb"); - if (mode == 2) { - error("fileOpen: write not supported"); - } - + error("This should not happen!"); return NULL; } void Scumm::fileClose(void *file) { - if (_fileMode == 1 || _fileMode == 2) + if (file) fclose((FILE *)file); } @@ -67,49 +62,25 @@ uint32 Scumm::filePos(void *handle) void Scumm::fileSeek(void *file, long offs, int whence) { - switch (_fileMode) { - case 1: - case 2: - if (fseek((FILE *)file, offs, whence) != 0) - clearerr((FILE *)file); - return; - case 3: - _whereInResToRead = offs; - return; - } + if (fseek((FILE *)file, offs, whence) != 0) + clearerr((FILE *)file); } void Scumm::fileRead(void *file, void *ptr, uint32 size) { byte *ptr2 = (byte *)ptr, *src; - switch (_fileMode) { - case 1: - if (size == 0) - return; - - if ((uint32)fread(ptr2, size, 1, (FILE *)file) != 1) { - clearerr((FILE *)file); - _fileReadFailed = true; - } - - do { - *ptr2++ ^= _encbyte; - } while (--size); - + if (size == 0) return; - case 3: - if (size == 0) - return; - - src = getResourceAddress(rtTemp, 3) + _whereInResToRead; - _whereInResToRead += size; - do { - *ptr2++ = *src++ ^ _encbyte; - } while (--size); - return; + if ((uint32)fread(ptr2, size, 1, (FILE *)file) != 1) { + clearerr((FILE *)file); + _fileReadFailed = true; } + + do { + *ptr2++ ^= _encbyte; + } while (--size); } int Scumm::fileReadByte() @@ -117,20 +88,11 @@ int Scumm::fileReadByte() byte b; byte *src; - switch (_fileMode) { - case 1: - if (fread(&b, 1, 1, (FILE *)_fileHandle) != 1) { - clearerr((FILE *)_fileHandle); - _fileReadFailed = true; - } - return b ^ _encbyte; - - case 3: - src = getResourceAddress(rtTemp, 3) + _whereInResToRead; - _whereInResToRead++; - return *src ^ _encbyte; + if (fread(&b, 1, 1, (FILE *)_fileHandle) != 1) { + clearerr((FILE *)_fileHandle); + _fileReadFailed = true; } - return 0; + return b ^ _encbyte; } uint Scumm::fileReadWordLE() @@ -188,4 +188,12 @@ enum { GD_DC }; +enum { +#ifdef _WIN32_WCE + SAMPLES_PER_SEC = 11025 +#else + SAMPLES_PER_SEC = 22050 +#endif +}; + #endif diff --git a/gui/util.cpp b/util.cpp index 11f3aa4716..11f3aa4716 100644 --- a/gui/util.cpp +++ b/util.cpp |