diff options
| author | David Corrales | 2007-07-08 16:58:54 +0000 |
|---|---|---|
| committer | David Corrales | 2007-07-08 16:58:54 +0000 |
| commit | 9bfe5d53540af7dc9bf0214202f4e35b272320ea (patch) | |
| tree | 69dcaf6f735e9fd0913a3e2f163852d4b9af87e3 /common | |
| parent | 256e4d9521b79160d1f9ed670656097a96dc5a34 (diff) | |
| parent | 17da12ca07a1f18f3fe1ef5b0c2c0cd9fd8359b4 (diff) | |
| download | scummvm-rg350-9bfe5d53540af7dc9bf0214202f4e35b272320ea.tar.gz scummvm-rg350-9bfe5d53540af7dc9bf0214202f4e35b272320ea.tar.bz2 scummvm-rg350-9bfe5d53540af7dc9bf0214202f4e35b272320ea.zip | |
Merged the FSNode branch with trunk r27681:27969
svn-id: r27970
Diffstat (limited to 'common')
| -rw-r--r-- | common/frac.h | 55 | ||||
| -rw-r--r-- | common/savefile.h | 2 | ||||
| -rw-r--r-- | common/scummsys.h | 2 | ||||
| -rw-r--r-- | common/system.h | 17 |
4 files changed, 70 insertions, 6 deletions
diff --git a/common/frac.h b/common/frac.h new file mode 100644 index 0000000000..b1e6c518d1 --- /dev/null +++ b/common/frac.h @@ -0,0 +1,55 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#ifndef COMMON_FRAC_H +#define COMMON_FRAC_H + +#include "common/scummsys.h" + +/** + * The precision of the fractional (fixed point) type we define below. + * Normally you should never have to modify this value. + */ +enum { + FRAC_BITS = 16, + FRAC_LO_MASK = ((1L << FRAC_BITS) - 1), + FRAC_HI_MASK = ((1L << FRAC_BITS) - 1) << FRAC_BITS, + + FRAC_ONE = (1L << FRAC_BITS), // 1.0 + FRAC_HALF = (1L << (FRAC_BITS-1)) // 0.5 +}; + +/** + * Fixed-point fractions, used by the sound rate converter and other code. + */ +typedef int32 frac_t; + +inline frac_t doubleToFrac(double value) { return (frac_t)(value * FRAC_ONE); } +inline double fracToDouble(frac_t value) { return ((double)value) / FRAC_ONE; } + +inline frac_t intToFrac(int16 value) { return value << FRAC_BITS; } +inline int16 fracToInt(frac_t value) { return value >> FRAC_BITS; } + +#endif diff --git a/common/savefile.h b/common/savefile.h index e1a54638b5..612d6ae210 100644 --- a/common/savefile.h +++ b/common/savefile.h @@ -99,7 +99,7 @@ public: * TODO: Or even replace it with a better API. For example, one that * returns a list of strings for all present file names. */ - virtual void listSavefiles(const char * /* prefix */, bool *marks, int num) = 0; + virtual void listSavefiles(const char *prefix , bool *marks, int num) = 0; /** * Get the path to the save game directory. diff --git a/common/scummsys.h b/common/scummsys.h index 4cb8d5d8e9..fb81bcb25a 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -313,8 +313,10 @@ // #if defined(__GNUC__) #define NORETURN __attribute__((__noreturn__)) + #define PACKED_STRUCT __attribute__((packed)) #define GCC_PRINTF(x,y) __attribute__((format(printf, x, y))) #else + #define PACKED_STRUCT #define GCC_PRINTF(x,y) #endif diff --git a/common/system.h b/common/system.h index 95f970d956..79680c4655 100644 --- a/common/system.h +++ b/common/system.h @@ -73,6 +73,18 @@ public: */ virtual void initBackend() { } + /** + * Allows the backend to perform engine specific init. + * Called just before the engine is run. + */ + virtual void engineInit() { } + + /** + * Allows the backend to perform engine specific de-init. + * Called after the engine finishes. + */ + virtual void engineDone() { } + /** @name Feature flags */ //@{ @@ -587,11 +599,6 @@ public: */ virtual int16 getOverlayWidth() { return getWidth(); } - virtual int screenToOverlayX(int x) { return x; } - virtual int screenToOverlayY(int y) { return y; } - virtual int overlayToScreenX(int x) { return x; } - virtual int overlayToScreenY(int y) { return y; } - /** * Convert the given RGB triplet into an OverlayColor. A OverlayColor can * be 8bit, 16bit or 32bit, depending on the target system. The default |
