renamed more OSystem methods to follow our naming scheme; renamed NewGuiColor to OverlayColor; fixed some calls to error() in the SDL backend

svn-id: r13087
This commit is contained in:
Max Horn 2004-02-28 12:58:13 +00:00
parent 56102a1d02
commit c6752cccf5
57 changed files with 401 additions and 392 deletions

View file

@ -64,7 +64,7 @@ void OSystem_PALMOS::init_intern(UInt16 gfx_mode) {
_adjustAspectRatio = ConfMan.getBool("aspect_ratio"); _adjustAspectRatio = ConfMan.getBool("aspect_ratio");
} }
void OSystem_PALMOS::set_palette(const byte *colors, uint start, uint num) { void OSystem_PALMOS::setPalette(const byte *colors, uint start, uint num) {
if (_quitCount) if (_quitCount)
return; return;
@ -134,7 +134,7 @@ void OSystem_PALMOS::load_gfx_mode() {
_screenP = _offScreenP; _screenP = _offScreenP;
_offScreenH = WinGetDisplayWindow(); _offScreenH = WinGetDisplayWindow();
_screenH = _offScreenH; _screenH = _offScreenH;
_renderer_proc = &OSystem_PALMOS::update_screen__flipping; _renderer_proc = &OSystem_PALMOS::updateScreen__flipping;
break; break;
case GFX_WIDE: case GFX_WIDE:
case GFX_BUFFERED: case GFX_BUFFERED:
@ -153,13 +153,13 @@ void OSystem_PALMOS::load_gfx_mode() {
gVars->screenLocked = true; gVars->screenLocked = true;
_screenP = WinScreenLock(winLockErase) + _screenOffset.addr; _screenP = WinScreenLock(winLockErase) + _screenOffset.addr;
_renderer_proc = (OPTIONS_TST(kOptModeLandscape)) ? _renderer_proc = (OPTIONS_TST(kOptModeLandscape)) ?
&OSystem_PALMOS::update_screen__wide_landscape : &OSystem_PALMOS::updateScreen__wide_landscape :
&OSystem_PALMOS::update_screen__wide_portrait; &OSystem_PALMOS::updateScreen__wide_portrait;
} }
} else { } else {
_screenP = (byte *)(BmpGetBits(WinGetBitmap(_screenH))) + _screenOffset.addr; _screenP = (byte *)(BmpGetBits(WinGetBitmap(_screenH))) + _screenOffset.addr;
_renderer_proc = &OSystem_PALMOS::update_screen__buffered; _renderer_proc = &OSystem_PALMOS::updateScreen__buffered;
} }
_offScreenPitch = _screenWidth; _offScreenPitch = _screenWidth;
break; break;
@ -170,7 +170,7 @@ void OSystem_PALMOS::load_gfx_mode() {
_screenH = _offScreenH; _screenH = _offScreenH;
_offScreenP = (byte *)(BmpGetBits(WinGetBitmap(_offScreenH))) + _screenOffset.addr; _offScreenP = (byte *)(BmpGetBits(WinGetBitmap(_offScreenH))) + _screenOffset.addr;
_screenP = _offScreenP; _screenP = _offScreenP;
_renderer_proc = &OSystem_PALMOS::update_screen__direct; _renderer_proc = &OSystem_PALMOS::updateScreen__direct;
break; break;
} }
@ -178,7 +178,7 @@ void OSystem_PALMOS::load_gfx_mode() {
WinSetCoordinateSystem(kCoordinatesNative); WinSetCoordinateSystem(kCoordinatesNative);
// palette for preload dialog // palette for preload dialog
set_palette(startupPalette,0,16); setPalette(startupPalette,0,16);
// try to allocate on storage heap // try to allocate on storage heap
FtrPtrNew(appFileCreator, ftrOverlayPtr, _screenWidth * _screenHeight, (void **)&_tmpScreenP); FtrPtrNew(appFileCreator, ftrOverlayPtr, _screenWidth * _screenHeight, (void **)&_tmpScreenP);
@ -389,7 +389,7 @@ void OSystem_PALMOS::copy_rect(const byte *buf, int pitch, int x, int y, int w,
// Tapwave code will come here // Tapwave code will come here
#endif #endif
void OSystem_PALMOS::update_screen__wide_portrait() { void OSystem_PALMOS::updateScreen__wide_portrait() {
UInt8 *dst = _screenP + _screenOffset.y; UInt8 *dst = _screenP + _screenOffset.y;
UInt8 *src1 = _offScreenP + WIDE_PITCH - 1; UInt8 *src1 = _offScreenP + WIDE_PITCH - 1;
@ -437,7 +437,7 @@ void OSystem_PALMOS::update_screen__wide_portrait() {
_screenP = WinScreenLock(winLockCopy) + _screenOffset.addr; _screenP = WinScreenLock(winLockCopy) + _screenOffset.addr;
} }
void OSystem_PALMOS::update_screen__wide_landscape() { void OSystem_PALMOS::updateScreen__wide_landscape() {
UInt8 *dst = _screenP; UInt8 *dst = _screenP;
UInt8 *src = _offScreenP; UInt8 *src = _offScreenP;
@ -475,7 +475,7 @@ void OSystem_PALMOS::update_screen__wide_landscape() {
_screenP = WinScreenLock(winLockCopy) + _screenOffset.addr; _screenP = WinScreenLock(winLockCopy) + _screenOffset.addr;
} }
void OSystem_PALMOS::update_screen__flipping() { void OSystem_PALMOS::updateScreen__flipping() {
RectangleType r, dummy; RectangleType r, dummy;
Boolean shaked = false; Boolean shaked = false;
@ -511,7 +511,7 @@ void OSystem_PALMOS::update_screen__flipping() {
} }
void OSystem_PALMOS::update_screen__buffered() { void OSystem_PALMOS::updateScreen__buffered() {
UInt32 move = 0; UInt32 move = 0;
UInt32 size = _screenWidth * _screenHeight; UInt32 size = _screenWidth * _screenHeight;
@ -557,7 +557,7 @@ void OSystem_PALMOS::update_screen__buffered() {
} }
void OSystem_PALMOS::update_screen__direct() { void OSystem_PALMOS::updateScreen__direct() {
if (_current_shake_pos != _new_shake_pos) { if (_current_shake_pos != _new_shake_pos) {
if (_vibrate) { if (_vibrate) {
Boolean active = (_new_shake_pos >= 3); Boolean active = (_new_shake_pos >= 3);
@ -624,7 +624,7 @@ void OSystem_PALMOS::draw1BitGfx(UInt16 id, UInt32 x, UInt32 y, Boolean show) {
} }
} }
void OSystem_PALMOS::update_screen() { void OSystem_PALMOS::updateScreen() {
if(_quitCount) if(_quitCount)
return; return;
@ -751,10 +751,10 @@ void OSystem_PALMOS::set_timer(TimerProc callback, int timer) {
} }
/* Mutex handling */ /* Mutex handling */
OSystem::MutexRef OSystem_PALMOS::create_mutex() {return NULL;} OSystem::MutexRef OSystem_PALMOS::createMutex() {return NULL;}
void OSystem_PALMOS::lock_mutex(MutexRef mutex) {} void OSystem_PALMOS::lockMutex(MutexRef mutex) {}
void OSystem_PALMOS::unlock_mutex(MutexRef mutex) {} void OSystem_PALMOS::unlockMutex(MutexRef mutex) {}
void OSystem_PALMOS::delete_mutex(MutexRef mutex) {} void OSystem_PALMOS::deleteMutex(MutexRef mutex) {}
void OSystem_PALMOS::SimulateArrowKeys(Event *event, Int8 iHoriz, Int8 iVert, Boolean repeat) { void OSystem_PALMOS::SimulateArrowKeys(Event *event, Int8 iHoriz, Int8 iVert, Boolean repeat) {
Int16 x = _mouseCurState.x; Int16 x = _mouseCurState.x;

View file

@ -46,7 +46,7 @@ typedef struct {
class OSystem_PALMOS : public OSystem { class OSystem_PALMOS : public OSystem {
public: public:
// Set colors of the palette // Set colors of the palette
void set_palette(const byte *colors, uint start, uint num); void setPalette(const byte *colors, uint start, uint num);
// Set the size of the video bitmap. // Set the size of the video bitmap.
// Typically, 320x200 // Typically, 320x200
@ -61,7 +61,7 @@ public:
void move_screen(int dx, int dy, int height); void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen // Update the dirty areas of the screen
void update_screen(); void updateScreen();
// Either show or hide the mouse cursor // Either show or hide the mouse cursor
bool show_mouse(bool visible); bool show_mouse(bool visible);
@ -129,10 +129,10 @@ public:
void set_timer(TimerProc callback, int timer); void set_timer(TimerProc callback, int timer);
// Mutex handling // Mutex handling
MutexRef create_mutex(); MutexRef createMutex();
void lock_mutex(MutexRef mutex); void lockMutex(MutexRef mutex);
void unlock_mutex(MutexRef mutex); void unlockMutex(MutexRef mutex);
void delete_mutex(MutexRef mutex); void deleteMutex(MutexRef mutex);
// Quit // Quit
void quit(); void quit();
@ -170,12 +170,12 @@ private:
typedef void (OSystem_PALMOS::*RendererProc)(); typedef void (OSystem_PALMOS::*RendererProc)();
RendererProc _renderer_proc; RendererProc _renderer_proc;
void update_screen__flipping(); void updateScreen__flipping();
void update_screen__buffered(); void updateScreen__buffered();
void update_screen__direct(); void updateScreen__direct();
void update_screen__wide_portrait(); void updateScreen__wide_portrait();
void update_screen__wide_landscape(); void updateScreen__wide_landscape();
void update_screen__wide_zodiac(); void updateScreen__wide_zodiac();
void *ptrP[5]; // various ptr void *ptrP[5]; // various ptr

View file

@ -31,7 +31,7 @@ class OSystem_Dreamcast : public OSystem {
OSystem_Dreamcast(); OSystem_Dreamcast();
// Set colors of the palette // Set colors of the palette
void set_palette(const byte *colors, uint start, uint num); void setPalette(const byte *colors, uint start, uint num);
// Set the size of the video bitmap. // Set the size of the video bitmap.
// Typically, 320x200 // Typically, 320x200
@ -45,7 +45,7 @@ class OSystem_Dreamcast : public OSystem {
void move_screen(int dx, int dy, int height); void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen // Update the dirty areas of the screen
void update_screen(); void updateScreen();
// Either show or hide the mouse cursor // Either show or hide the mouse cursor
bool show_mouse(bool visible); bool show_mouse(bool visible);
@ -104,10 +104,10 @@ class OSystem_Dreamcast : public OSystem {
virtual void set_timer(TimerProc callback, int timer); virtual void set_timer(TimerProc callback, int timer);
// Mutex handling // Mutex handling
virtual MutexRef create_mutex(); virtual MutexRef createMutex();
virtual void lock_mutex(MutexRef mutex); virtual void lockMutex(MutexRef mutex);
virtual void unlock_mutex(MutexRef mutex); virtual void unlockMutex(MutexRef mutex);
virtual void delete_mutex(MutexRef mutex); virtual void deleteMutex(MutexRef mutex);
// Savefile handling // Savefile handling
virtual SaveFileManager *get_savefile_manager(); virtual SaveFileManager *get_savefile_manager();

View file

@ -130,20 +130,20 @@ void OSystem_Dreamcast::quit() {
} }
/* Mutex handling */ /* Mutex handling */
OSystem::MutexRef OSystem_Dreamcast::create_mutex() OSystem::MutexRef OSystem_Dreamcast::createMutex()
{ {
return NULL; return NULL;
} }
void OSystem_Dreamcast::lock_mutex(MutexRef mutex) void OSystem_Dreamcast::lockMutex(MutexRef mutex)
{ {
} }
void OSystem_Dreamcast::unlock_mutex(MutexRef mutex) void OSystem_Dreamcast::unlockMutex(MutexRef mutex)
{ {
} }
void OSystem_Dreamcast::delete_mutex(MutexRef mutex) void OSystem_Dreamcast::deleteMutex(MutexRef mutex)
{ {
} }

View file

@ -128,7 +128,7 @@ void commit_dummy_transpoly()
} }
void OSystem_Dreamcast::set_palette(const byte *colors, uint start, uint num) void OSystem_Dreamcast::setPalette(const byte *colors, uint start, uint num)
{ {
unsigned short *dst = palette + start; unsigned short *dst = palette + start;
if(num>0) if(num>0)
@ -270,7 +270,7 @@ void OSystem_Dreamcast::set_shake_pos(int shake_pos)
_current_shake_pos = shake_pos; _current_shake_pos = shake_pos;
} }
void OSystem_Dreamcast::update_screen(void) void OSystem_Dreamcast::updateScreen(void)
{ {
struct polygon_list mypoly; struct polygon_list mypoly;
struct packed_colour_vertex_list myvertex; struct packed_colour_vertex_list myvertex;

View file

@ -61,7 +61,7 @@ void Icon::create_texture()
texture = tex; texture = tex;
} }
void Icon::set_palette(int pal) void Icon::setPalette(int pal)
{ {
unsigned int (*hwpal)[64][16] = (unsigned int (*)[64][16])0xa05f9000; unsigned int (*hwpal)[64][16] = (unsigned int (*)[64][16])0xa05f9000;
for(int n = 0; n<16; n++) for(int n = 0; n<16; n++)

View file

@ -35,7 +35,7 @@ class Icon
bool load(const void *data, int len, int offs = 0); bool load(const void *data, int len, int offs = 0);
bool load(const char *filename); bool load(const char *filename);
void create_texture(); void create_texture();
void set_palette(int pal); void setPalette(int pal);
void draw(float x1, float y1, float x2, float y2, int pal, void draw(float x1, float y1, float x2, float y2, int pal,
unsigned argb = 0xffffffff); unsigned argb = 0xffffffff);
void create_vmicon(void *buffer); void create_vmicon(void *buffer);

View file

@ -426,7 +426,7 @@ int gameMenu(Game *games, int num_games)
draw_trans_quad(100.0, y, 590.0, y+32.0, draw_trans_quad(100.0, y, 590.0, y+32.0,
0x7000ff00, 0x7000ff00, 0x7000ff00, 0x7000ff00); 0x7000ff00, 0x7000ff00, 0x7000ff00, 0x7000ff00);
games[i].icon.set_palette(pal); games[i].icon.setPalette(pal);
drawGameLabel(games[i], pal, 50.0, y, (cnt == selector_pos? drawGameLabel(games[i], pal, 50.0, y, (cnt == selector_pos?
0xffff00 : 0xffffff)); 0xffff00 : 0xffffff));
y += 40.0; y += 40.0;

View file

@ -36,7 +36,7 @@ char currsurface;
FILE *fstderr, *fstdout, *fstdin; FILE *fstderr, *fstdout, *fstdin;
// Set colors of the palette // Set colors of the palette
void OSystem_GP32::set_palette(const byte *colors, uint start, uint num) { void OSystem_GP32::setPalette(const byte *colors, uint start, uint num) {
const byte *b = colors; const byte *b = colors;
uint i; uint i;
SDL_Color *base = _currentPalette + start; SDL_Color *base = _currentPalette + start;
@ -692,7 +692,7 @@ char * SDL_GetError() {
} }
// Update the dirty areas of the screen // Update the dirty areas of the screen
void OSystem_GP32::update_screen() { void OSystem_GP32::updateScreen() {
assert(sdl_hwscreen != NULL); assert(sdl_hwscreen != NULL);
// If the shake position changed, fill the dirty area with blackness // If the shake position changed, fill the dirty area with blackness
@ -1017,7 +1017,7 @@ void OSystem_GP32::hotswap_gfx_mode() {
copy_rect(bak_mem, _screenWidth, 0, 0, _screenWidth, _screenHeight); copy_rect(bak_mem, _screenWidth, 0, 0, _screenWidth, _screenHeight);
free(bak_mem); free(bak_mem);
update_screen(); updateScreen();
} }
// Get or set a property // Get or set a property
@ -1072,12 +1072,12 @@ void OSystem_GP32::update_cdrom() { }
void OSystem_GP32::set_timer(TimerProc callback, int timer) { } void OSystem_GP32::set_timer(TimerProc callback, int timer) { }
// Mutex handling // Mutex handling
OSystem::MutexRef OSystem_GP32::create_mutex() { OSystem::MutexRef OSystem_GP32::createMutex() {
return NULL; return NULL;
} }
void OSystem_GP32::lock_mutex(MutexRef mutex) { } void OSystem_GP32::lockMutex(MutexRef mutex) { }
void OSystem_GP32::unlock_mutex(MutexRef mutex) { } void OSystem_GP32::unlockMutex(MutexRef mutex) { }
void OSystem_GP32::delete_mutex(MutexRef mutex) { } void OSystem_GP32::deleteMutex(MutexRef mutex) { }
// Quit // Quit
void gphalt(int); void gphalt(int);

View file

@ -35,7 +35,7 @@
class OSystem_GP32 : public OSystem { class OSystem_GP32 : public OSystem {
public: public:
// Set colors of the palette // Set colors of the palette
void set_palette(const byte *colors, uint start, uint num); void setPalette(const byte *colors, uint start, uint num);
// Set the size of the video bitmap. // Set the size of the video bitmap.
// Typically, 320x200 // Typically, 320x200
@ -52,7 +52,7 @@ public:
void move_screen(int dx, int dy, int height); void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen // Update the dirty areas of the screen
void update_screen(); void updateScreen();
// Either show or hide the mouse cursor // Either show or hide the mouse cursor
bool show_mouse(bool visible); bool show_mouse(bool visible);
@ -103,10 +103,10 @@ public:
void set_timer(TimerProc callback, int timer); void set_timer(TimerProc callback, int timer);
// Mutex handling // Mutex handling
OSystem::MutexRef create_mutex(); OSystem::MutexRef createMutex();
void lock_mutex(MutexRef mutex); void lockMutex(MutexRef mutex);
void unlock_mutex(MutexRef mutex); void unlockMutex(MutexRef mutex);
void delete_mutex(MutexRef mutex); void deleteMutex(MutexRef mutex);
// Quit // Quit
void quit(); void quit();
@ -149,7 +149,7 @@ private:
DF_UPDATE_EXPAND_1_PIXEL = 1 << 3 DF_UPDATE_EXPAND_1_PIXEL = 1 << 3
}; };
bool _forceFull; // Force full redraw on next update_screen bool _forceFull; // Force full redraw on next updateScreen
int _scaleFactor; int _scaleFactor;
int _mode; int _mode;
bool _full_screen; bool _full_screen;

View file

@ -327,7 +327,7 @@ void OSystem_MorphOS::set_timer(TimerProc callback, int timer)
warning("set_timer() unexpectedly called"); warning("set_timer() unexpectedly called");
} }
OSystem::MutexRef OSystem_MorphOS::create_mutex() OSystem::MutexRef OSystem_MorphOS::createMutex()
{ {
SignalSemaphore *sem = (SignalSemaphore *) AllocVec(sizeof (SignalSemaphore), MEMF_PUBLIC); SignalSemaphore *sem = (SignalSemaphore *) AllocVec(sizeof (SignalSemaphore), MEMF_PUBLIC);
@ -337,17 +337,17 @@ OSystem::MutexRef OSystem_MorphOS::create_mutex()
return (MutexRef)sem; return (MutexRef)sem;
} }
void OSystem_MorphOS::lock_mutex(MutexRef mutex) void OSystem_MorphOS::lockMutex(MutexRef mutex)
{ {
ObtainSemaphore((SignalSemaphore *) mutex); ObtainSemaphore((SignalSemaphore *) mutex);
} }
void OSystem_MorphOS::unlock_mutex(MutexRef mutex) void OSystem_MorphOS::unlockMutex(MutexRef mutex)
{ {
ReleaseSemaphore((SignalSemaphore *)mutex); ReleaseSemaphore((SignalSemaphore *)mutex);
} }
void OSystem_MorphOS::delete_mutex(MutexRef mutex) void OSystem_MorphOS::deleteMutex(MutexRef mutex)
{ {
FreeVec(mutex); FreeVec(mutex);
} }
@ -519,7 +519,7 @@ void OSystem_MorphOS::quit()
#define CVT8TO32(col) ((col<<24) | (col<<16) | (col<<8) | col) #define CVT8TO32(col) ((col<<24) | (col<<16) | (col<<8) | col)
void OSystem_MorphOS::set_palette(const byte *colors, uint start, uint num) void OSystem_MorphOS::setPalette(const byte *colors, uint start, uint num)
{ {
const byte *data = colors; const byte *data = colors;
UWORD changed_colors[256]; UWORD changed_colors[256];
@ -1170,7 +1170,7 @@ bool OSystem_MorphOS::AddUpdateRect(WORD x, WORD y, WORD w, WORD h)
return true; return true;
} }
void OSystem_MorphOS::update_screen() void OSystem_MorphOS::updateScreen()
{ {
AUTO_LOCK AUTO_LOCK

View file

@ -43,7 +43,7 @@ class OSystem_MorphOS : public OSystem
bool Initialise(); bool Initialise();
// Set colors of the palette // Set colors of the palette
virtual void set_palette(const byte *colors, uint start, uint num); virtual void setPalette(const byte *colors, uint start, uint num);
// Set the size of the video bitmap. // Set the size of the video bitmap.
// Typically, 320x200 // Typically, 320x200
@ -55,7 +55,7 @@ class OSystem_MorphOS : public OSystem
void move_screen(int dx, int dy, int height); void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen // Update the dirty areas of the screen
virtual void update_screen(); virtual void updateScreen();
// Either show or hide the mouse cursor // Either show or hide the mouse cursor
virtual bool show_mouse(bool visible); virtual bool show_mouse(bool visible);
@ -88,10 +88,10 @@ class OSystem_MorphOS : public OSystem
virtual void set_timer(TimerProc callback, int timer); virtual void set_timer(TimerProc callback, int timer);
// Mutex handling // Mutex handling
virtual MutexRef create_mutex(); virtual MutexRef createMutex();
virtual void lock_mutex(MutexRef mutex); virtual void lockMutex(MutexRef mutex);
virtual void unlock_mutex(MutexRef mutex); virtual void unlockMutex(MutexRef mutex);
virtual void delete_mutex(MutexRef mutex); virtual void deleteMutex(MutexRef mutex);
// Get the next event. // Get the next event.
// Returns true if an event was retrieved. // Returns true if an event was retrieved.

View file

@ -29,11 +29,11 @@
/* NULL video driver */ /* NULL video driver */
class OSystem_NULL : public OSystem { class OSystem_NULL : public OSystem {
public: public:
void set_palette(const byte *colors, uint start, uint num) {} void setPalette(const byte *colors, uint start, uint num) {}
void initSize(uint w, uint h); void initSize(uint w, uint h);
void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h) {} void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h) {}
void move_screen(int dx, int dy) {} void move_screen(int dx, int dy) {}
void update_screen() {} void updateScreen() {}
bool show_mouse(bool visible) { return false; } bool show_mouse(bool visible) { return false; }
void set_mouse_pos(int x, int y) {} void set_mouse_pos(int x, int y) {}
void set_mouse_cursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y) {} void set_mouse_cursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y) {}

View file

@ -95,11 +95,11 @@ void OSystem_SDL_Common::init_intern() {
if (joystick_num > -1) if (joystick_num > -1)
sdlFlags |= SDL_INIT_JOYSTICK; sdlFlags |= SDL_INIT_JOYSTICK;
if (SDL_Init(sdlFlags) ==-1) { if (SDL_Init(sdlFlags) == -1) {
error("Could not initialize SDL: %s.\n", SDL_GetError()); error("Could not initialize SDL: %s", SDL_GetError());
} }
_graphicsMutex = create_mutex(); _graphicsMutex = createMutex();
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
@ -156,7 +156,7 @@ OSystem_SDL_Common::~OSystem_SDL_Common() {
free(_dirty_checksums); free(_dirty_checksums);
free(_currentPalette); free(_currentPalette);
free(_mouseBackup); free(_mouseBackup);
delete_mutex(_graphicsMutex); deleteMutex(_graphicsMutex);
SDL_ShowCursor(SDL_ENABLE); SDL_ShowCursor(SDL_ENABLE);
SDL_Quit(); SDL_Quit();
@ -229,7 +229,7 @@ void OSystem_SDL_Common::copy_rect(const byte *src, int pitch, int x, int y, int
// Try to lock the screen surface // Try to lock the screen surface
if (SDL_LockSurface(_screen) == -1) if (SDL_LockSurface(_screen) == -1)
error("SDL_LockSurface failed: %s.\n", SDL_GetError()); error("SDL_LockSurface failed: %s", SDL_GetError());
byte *dst = (byte *)_screen->pixels + y * _screenWidth + x; byte *dst = (byte *)_screen->pixels + y * _screenWidth + x;
@ -268,7 +268,7 @@ void OSystem_SDL_Common::move_screen(int dx, int dy, int height) {
// Try to lock the screen surface // Try to lock the screen surface
if (SDL_LockSurface(_screen) == -1) if (SDL_LockSurface(_screen) == -1)
error("SDL_LockSurface failed: %s.\n", SDL_GetError()); error("SDL_LockSurface failed: %s", SDL_GetError());
// vertical movement // vertical movement
if (dy > 0) { if (dy > 0) {
@ -535,7 +535,7 @@ void OSystem_SDL_Common::set_mouse_pos(int x, int y) {
_mouseCurState.x = x; _mouseCurState.x = x;
_mouseCurState.y = y; _mouseCurState.y = y;
undraw_mouse(); undraw_mouse();
update_screen(); updateScreen();
} }
} }
@ -1050,14 +1050,18 @@ void OSystem_SDL_Common::clearSoundCallback() {
SDL_CloseAudio(); SDL_CloseAudio();
} }
int OSystem_SDL_Common::getOutputSampleRate() const {
return SAMPLES_PER_SEC;
}
const OSystem::GraphicsMode *OSystem_SDL_Common::getSupportedGraphicsModes() const { const OSystem::GraphicsMode *OSystem_SDL_Common::getSupportedGraphicsModes() const {
return s_supportedGraphicsModes; return s_supportedGraphicsModes;
} }
void OSystem_SDL_Common::update_screen() { void OSystem_SDL_Common::updateScreen() {
Common::StackLock lock(_graphicsMutex, this); // Lock the mutex until this function ends Common::StackLock lock(_graphicsMutex, this); // Lock the mutex until this function ends
intern_update_screen(); internUpdateScreen();
} }
bool OSystem_SDL_Common::setGraphicsMode(int mode) { bool OSystem_SDL_Common::setGraphicsMode(int mode) {
@ -1131,7 +1135,7 @@ bool OSystem_SDL_Common::setGraphicsMode(int mode) {
_forceFull = true; _forceFull = true;
// Blit everything to the screen // Blit everything to the screen
intern_update_screen(); internUpdateScreen();
// Make sure that an EVENT_SCREEN_CHANGED gets sent later // Make sure that an EVENT_SCREEN_CHANGED gets sent later
_modeChanged = true; _modeChanged = true;
@ -1149,29 +1153,6 @@ void OSystem_SDL_Common::setWindowCaption(const char *caption) {
SDL_WM_SetCaption(caption, caption); SDL_WM_SetCaption(caption, caption);
} }
bool OSystem_SDL_Common::openCD(int drive) {
if (SDL_InitSubSystem(SDL_INIT_CDROM) == -1)
_cdrom = NULL;
else {
_cdrom = SDL_CDOpen(drive);
// Did it open? Check if _cdrom is NULL
if (!_cdrom) {
warning("Couldn't open drive: %s", SDL_GetError());
} else {
cd_num_loops = 0;
cd_stop_time = 0;
cd_end_time = 0;
}
}
return (_cdrom != NULL);
}
int OSystem_SDL_Common::getOutputSampleRate() const {
return SAMPLES_PER_SEC;
}
bool OSystem_SDL_Common::hasFeature(Feature f) { bool OSystem_SDL_Common::hasFeature(Feature f) {
return return
(f == kFeatureFullscreenMode) || (f == kFeatureFullscreenMode) ||
@ -1278,7 +1259,7 @@ void OSystem_SDL_Common::draw_mouse() {
// Draw the mouse cursor; backup the covered area in "bak" // Draw the mouse cursor; backup the covered area in "bak"
if (SDL_LockSurface(_overlayVisible ? _tmpscreen : _screen) == -1) if (SDL_LockSurface(_overlayVisible ? _tmpscreen : _screen) == -1)
error("SDL_LockSurface failed: %s.\n", SDL_GetError()); error("SDL_LockSurface failed: %s", SDL_GetError());
// Mark as dirty // Mark as dirty
add_dirty_rect(x, y, w, h); add_dirty_rect(x, y, w, h);
@ -1338,7 +1319,7 @@ void OSystem_SDL_Common::undraw_mouse() {
_mouseDrawn = false; _mouseDrawn = false;
if (SDL_LockSurface(_overlayVisible ? _tmpscreen : _screen) == -1) if (SDL_LockSurface(_overlayVisible ? _tmpscreen : _screen) == -1)
error("SDL_LockSurface failed: %s.\n", SDL_GetError()); error("SDL_LockSurface failed: %s", SDL_GetError());
const int old_mouse_x = _mouseOldState.x; const int old_mouse_x = _mouseOldState.x;
const int old_mouse_y = _mouseOldState.y; const int old_mouse_y = _mouseOldState.y;
@ -1375,6 +1356,24 @@ void OSystem_SDL_Common::undraw_mouse() {
SDL_UnlockSurface(_overlayVisible ? _tmpscreen : _screen); SDL_UnlockSurface(_overlayVisible ? _tmpscreen : _screen);
} }
bool OSystem_SDL_Common::openCD(int drive) {
if (SDL_InitSubSystem(SDL_INIT_CDROM) == -1)
_cdrom = NULL;
else {
_cdrom = SDL_CDOpen(drive);
// Did it open? Check if _cdrom is NULL
if (!_cdrom) {
warning("Couldn't open drive: %s", SDL_GetError());
} else {
cd_num_loops = 0;
cd_stop_time = 0;
cd_end_time = 0;
}
}
return (_cdrom != NULL);
}
void OSystem_SDL_Common::stop_cdrom() { /* Stop CD Audio in 1/10th of a second */ void OSystem_SDL_Common::stop_cdrom() { /* Stop CD Audio in 1/10th of a second */
cd_stop_time = SDL_GetTicks() + 100; cd_stop_time = SDL_GetTicks() + 100;
cd_num_loops = 0; cd_num_loops = 0;
@ -1488,19 +1487,19 @@ void OSystem_SDL_Common::setup_icon() {
SDL_FreeSurface(sdl_surf); SDL_FreeSurface(sdl_surf);
} }
OSystem::MutexRef OSystem_SDL_Common::create_mutex(void) { OSystem::MutexRef OSystem_SDL_Common::createMutex(void) {
return (MutexRef) SDL_CreateMutex(); return (MutexRef) SDL_CreateMutex();
} }
void OSystem_SDL_Common::lock_mutex(MutexRef mutex) { void OSystem_SDL_Common::lockMutex(MutexRef mutex) {
SDL_mutexP((SDL_mutex *) mutex); SDL_mutexP((SDL_mutex *) mutex);
} }
void OSystem_SDL_Common::unlock_mutex(MutexRef mutex) { void OSystem_SDL_Common::unlockMutex(MutexRef mutex) {
SDL_mutexV((SDL_mutex *) mutex); SDL_mutexV((SDL_mutex *) mutex);
} }
void OSystem_SDL_Common::delete_mutex(MutexRef mutex) { void OSystem_SDL_Common::deleteMutex(MutexRef mutex) {
SDL_DestroyMutex((SDL_mutex *) mutex); SDL_DestroyMutex((SDL_mutex *) mutex);
} }
@ -1560,7 +1559,7 @@ void OSystem_SDL_Common::grab_overlay(int16 *buf, int pitch) {
undraw_mouse(); undraw_mouse();
if (SDL_LockSurface(_tmpscreen) == -1) if (SDL_LockSurface(_tmpscreen) == -1)
error("SDL_LockSurface failed: %s.\n", SDL_GetError()); error("SDL_LockSurface failed: %s", SDL_GetError());
int16 *src = (int16 *)_tmpscreen->pixels + _tmpScreenWidth + 1; int16 *src = (int16 *)_tmpscreen->pixels + _tmpScreenWidth + 1;
int h = _screenHeight; int h = _screenHeight;
@ -1611,7 +1610,7 @@ void OSystem_SDL_Common::copy_rect_overlay(const int16 *buf, int pitch, int x, i
undraw_mouse(); undraw_mouse();
if (SDL_LockSurface(_tmpscreen) == -1) if (SDL_LockSurface(_tmpscreen) == -1)
error("SDL_LockSurface failed: %s.\n", SDL_GetError()); error("SDL_LockSurface failed: %s", SDL_GetError());
int16 *dst = (int16 *)_tmpscreen->pixels + (y + 1) * _tmpScreenWidth + (x + 1); int16 *dst = (int16 *)_tmpscreen->pixels + (y + 1) * _tmpScreenWidth + (x + 1);
do { do {
@ -1623,7 +1622,7 @@ void OSystem_SDL_Common::copy_rect_overlay(const int16 *buf, int pitch, int x, i
SDL_UnlockSurface(_tmpscreen); SDL_UnlockSurface(_tmpscreen);
} }
void OSystem_SDL_Common::set_palette(const byte *colors, uint start, uint num) { void OSystem_SDL_Common::setPalette(const byte *colors, uint start, uint num) {
const byte *b = colors; const byte *b = colors;
uint i; uint i;
SDL_Color *base = _currentPalette + start; SDL_Color *base = _currentPalette + start;

View file

@ -37,7 +37,7 @@ public:
void initSize(uint w, uint h); void initSize(uint w, uint h);
// Set colors of the palette // Set colors of the palette
void set_palette(const byte *colors, uint start, uint num); void setPalette(const byte *colors, uint start, uint num);
// Draw a bitmap to screen. // Draw a bitmap to screen.
// The screen will not be updated to reflect the new bitmap // The screen will not be updated to reflect the new bitmap
@ -46,7 +46,7 @@ public:
void move_screen(int dx, int dy, int height); void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen // Update the dirty areas of the screen
void update_screen(); void updateScreen();
// Either show or hide the mouse cursor // Either show or hide the mouse cursor
bool show_mouse(bool visible); bool show_mouse(bool visible);
@ -98,10 +98,10 @@ public:
void set_timer(TimerProc callback, int timer); void set_timer(TimerProc callback, int timer);
// Mutex handling // Mutex handling
MutexRef create_mutex(); MutexRef createMutex();
void lock_mutex(MutexRef mutex); void lockMutex(MutexRef mutex);
void unlock_mutex(MutexRef mutex); void unlockMutex(MutexRef mutex);
void delete_mutex(MutexRef mutex); void deleteMutex(MutexRef mutex);
// Overlay // Overlay
virtual void show_overlay(); virtual void show_overlay();
@ -159,7 +159,7 @@ protected:
DF_UPDATE_EXPAND_1_PIXEL = 1 << 1 DF_UPDATE_EXPAND_1_PIXEL = 1 << 1
}; };
bool _forceFull; // Force full redraw on next update_screen bool _forceFull; // Force full redraw on next updateScreen
ScalerProc *_scaler_proc; ScalerProc *_scaler_proc;
int _scaleFactor; int _scaleFactor;
int _mode; int _mode;
@ -217,8 +217,10 @@ protected:
SDL_Color *_currentPalette; SDL_Color *_currentPalette;
uint _paletteDirtyStart, _paletteDirtyEnd; uint _paletteDirtyStart, _paletteDirtyEnd;
// Mutex that prevents multiple threads interferring with each other /**
// when accessing the screen. * Mutex which prevents multiple threads from interfering with each other
* when accessing the screen.
*/
MutexRef _graphicsMutex; MutexRef _graphicsMutex;
@ -235,7 +237,7 @@ protected:
void toggleMouseGrab(); void toggleMouseGrab();
virtual void intern_update_screen() = 0; virtual void internUpdateScreen() = 0;
virtual void load_gfx_mode() = 0; virtual void load_gfx_mode() = 0;
virtual void unload_gfx_mode() = 0; virtual void unload_gfx_mode() = 0;

View file

@ -28,7 +28,7 @@ public:
OSystem_SDL(); OSystem_SDL();
// Update the dirty areas of the screen // Update the dirty areas of the screen
void intern_update_screen(); void internUpdateScreen();
protected: protected:
SDL_Surface *_hwscreen; // hardware screen SDL_Surface *_hwscreen; // hardware screen
@ -222,13 +222,13 @@ void OSystem_SDL::hotswap_gfx_mode() {
SDL_FreeSurface(old_tmpscreen); SDL_FreeSurface(old_tmpscreen);
// Blit everything to the screen // Blit everything to the screen
intern_update_screen(); internUpdateScreen();
// Make sure that an EVENT_SCREEN_CHANGED gets sent later // Make sure that an EVENT_SCREEN_CHANGED gets sent later
_modeChanged = true; _modeChanged = true;
} }
void OSystem_SDL::intern_update_screen() { void OSystem_SDL::internUpdateScreen() {
assert(_hwscreen != NULL); assert(_hwscreen != NULL);
// If the shake position changed, fill the dirty area with blackness // If the shake position changed, fill the dirty area with blackness

View file

@ -126,7 +126,7 @@ void OSystem_WINCE3::swap_panel_visibility() {
else else
add_dirty_rect(0, 200, 320, 40); add_dirty_rect(0, 200, 320, 40);
update_screen(); updateScreen();
} }
} }
@ -606,7 +606,7 @@ void OSystem_WINCE3::hotswap_gfx_mode() {
SDL_FreeSurface(old_tmpscreen); SDL_FreeSurface(old_tmpscreen);
// Blit everything to the screen // Blit everything to the screen
update_screen(); updateScreen();
// Make sure that an EVENT_SCREEN_CHANGED gets sent later // Make sure that an EVENT_SCREEN_CHANGED gets sent later
_modeChanged = true; _modeChanged = true;
@ -623,7 +623,7 @@ void OSystem_WINCE3::update_keyboard() {
} }
} }
void OSystem_WINCE3::update_screen() { void OSystem_WINCE3::updateScreen() {
assert(_hwscreen != NULL); assert(_hwscreen != NULL);
Common::StackLock lock(_graphicsMutex, this); // Lock the mutex until this function ends Common::StackLock lock(_graphicsMutex, this); // Lock the mutex until this function ends
@ -1254,7 +1254,7 @@ bool OSystem_WINCE3::poll_event(Event *event) {
if (_toolbarHandler.action(temp_event.mouse.x, temp_event.mouse.y, true)) { if (_toolbarHandler.action(temp_event.mouse.x, temp_event.mouse.y, true)) {
if (!_toolbarHandler.drawn()) if (!_toolbarHandler.drawn())
update_screen(); updateScreen();
if (_newOrientation != _orientationLandscape) { if (_newOrientation != _orientationLandscape) {
_orientationLandscape = _newOrientation; _orientationLandscape = _newOrientation;
ConfMan.set("CE_landscape", _orientationLandscape); ConfMan.set("CE_landscape", _orientationLandscape);
@ -1281,7 +1281,7 @@ bool OSystem_WINCE3::poll_event(Event *event) {
if (_toolbarHandler.action(temp_event.mouse.x, temp_event.mouse.y, false)) { if (_toolbarHandler.action(temp_event.mouse.x, temp_event.mouse.y, false)) {
if (!_toolbarHandler.drawn()) if (!_toolbarHandler.drawn())
update_screen(); updateScreen();
} }
else { else {
if (!_freeLook) if (!_freeLook)

View file

@ -41,7 +41,7 @@ public:
OSystem_WINCE3(); OSystem_WINCE3();
// Update the dirty areas of the screen // Update the dirty areas of the screen
void update_screen(); void updateScreen();
// Set a parameter // Set a parameter
uint32 property(int param, Property *value); uint32 property(int param, Property *value);

View file

@ -56,7 +56,7 @@
class OSystem_X11:public OSystem { class OSystem_X11:public OSystem {
public: public:
// Set colors of the palette // Set colors of the palette
void set_palette(const byte *colors, uint start, uint num); void setPalette(const byte *colors, uint start, uint num);
// Set the size of the video bitmap. // Set the size of the video bitmap.
// Typically, 320x200 // Typically, 320x200
@ -69,7 +69,7 @@ public:
void move_screen(int dx, int dy, int height); void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen // Update the dirty areas of the screen
void update_screen(); void updateScreen();
// Either show or hide the mouse cursor // Either show or hide the mouse cursor
bool show_mouse(bool visible); bool show_mouse(bool visible);
@ -126,10 +126,10 @@ public:
void set_timer(TimerProc callback, int interval); void set_timer(TimerProc callback, int interval);
// Mutex handling // Mutex handling
MutexRef create_mutex(); MutexRef createMutex();
void lock_mutex(MutexRef mutex); void lockMutex(MutexRef mutex);
void unlock_mutex(MutexRef mutex); void unlockMutex(MutexRef mutex);
void delete_mutex(MutexRef mutex); void deleteMutex(MutexRef mutex);
// Overlay handling for the new menu system // Overlay handling for the new menu system
void show_overlay(); void show_overlay();
@ -153,7 +153,7 @@ private:
void create_empty_cursor(); void create_empty_cursor();
void draw_mouse(dirty_square *dout); void draw_mouse(dirty_square *dout);
void undraw_mouse(); void undraw_mouse();
void update_screen_helper(const dirty_square * d, dirty_square * dout); void updateScreen_helper(const dirty_square * d, dirty_square * dout);
void blit_convert(const dirty_square * d, uint16 *dst, int pitch); void blit_convert(const dirty_square * d, uint16 *dst, int pitch);
uint8 *local_fb; uint8 *local_fb;
@ -477,7 +477,7 @@ void OSystem_X11::clearSoundCallback() {
} }
void OSystem_X11::set_palette(const byte *colors, uint start, uint num) void OSystem_X11::setPalette(const byte *colors, uint start, uint num)
{ {
const byte *data = colors; const byte *data = colors;
uint16 *pal = &(palette[start]); uint16 *pal = &(palette[start]);
@ -578,7 +578,7 @@ void OSystem_X11::blit_convert(const dirty_square * d, uint16 *dst, int pitch)
} }
} }
void OSystem_X11::update_screen_helper(const dirty_square * d, dirty_square * dout) void OSystem_X11::updateScreen_helper(const dirty_square * d, dirty_square * dout)
{ {
if (_overlay_visible == false) { if (_overlay_visible == false) {
blit_convert(d, (uint16 *) image->data, fb_width); blit_convert(d, (uint16 *) image->data, fb_width);
@ -603,7 +603,7 @@ void OSystem_X11::update_screen_helper(const dirty_square * d, dirty_square * do
dout->h = d->y + d->h; dout->h = d->y + d->h;
} }
void OSystem_X11::update_screen() void OSystem_X11::updateScreen()
{ {
bool full_redraw = false; bool full_redraw = false;
bool need_redraw = false; bool need_redraw = false;
@ -620,13 +620,13 @@ void OSystem_X11::update_screen()
} }
if (full_redraw) { if (full_redraw) {
update_screen_helper(&ds_full, &dout); updateScreen_helper(&ds_full, &dout);
need_redraw = true; need_redraw = true;
} else if ((num_of_dirty_square > 0) || (_mouse_state_changed == true)) { } else if ((num_of_dirty_square > 0) || (_mouse_state_changed == true)) {
need_redraw = true; need_redraw = true;
while (num_of_dirty_square > 0) { while (num_of_dirty_square > 0) {
num_of_dirty_square--; num_of_dirty_square--;
update_screen_helper(&(ds[num_of_dirty_square]), &dout); updateScreen_helper(&(ds[num_of_dirty_square]), &dout);
} }
} }
@ -1045,24 +1045,24 @@ void OSystem_X11::set_timer(TimerProc callback, int interval)
} }
} }
OSystem::MutexRef OSystem_X11::create_mutex(void) OSystem::MutexRef OSystem_X11::createMutex(void)
{ {
pthread_mutex_t *mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t)); pthread_mutex_t *mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t));
pthread_mutex_init(mutex, NULL); pthread_mutex_init(mutex, NULL);
return (MutexRef)mutex; return (MutexRef)mutex;
} }
void OSystem_X11::lock_mutex(MutexRef mutex) void OSystem_X11::lockMutex(MutexRef mutex)
{ {
pthread_mutex_lock((pthread_mutex_t *) mutex); pthread_mutex_lock((pthread_mutex_t *) mutex);
} }
void OSystem_X11::unlock_mutex(MutexRef mutex) void OSystem_X11::unlockMutex(MutexRef mutex)
{ {
pthread_mutex_unlock((pthread_mutex_t *) mutex); pthread_mutex_unlock((pthread_mutex_t *) mutex);
} }
void OSystem_X11::delete_mutex(MutexRef mutex) void OSystem_X11::deleteMutex(MutexRef mutex)
{ {
pthread_mutex_destroy((pthread_mutex_t *) mutex); pthread_mutex_destroy((pthread_mutex_t *) mutex);
free(mutex); free(mutex);

View file

@ -211,7 +211,7 @@ static int launcherDialog(GameDetector &detector, OSystem *system) {
255, 255, 255, 0, 255, 255, 255, 0,
}; };
system->set_palette(dummy_palette, 0, 16); system->setPalette(dummy_palette, 0, 16);
#ifndef _WIN32_WCE #ifndef _WIN32_WCE
GUI::LauncherDialog dlg(detector); GUI::LauncherDialog dlg(detector);

View file

@ -420,10 +420,10 @@ FORCEINLINE uint16 SWAP_BYTES_16(uint16 a) {
#if defined(NEWGUI_256) #if defined(NEWGUI_256)
// 256 color only on PalmOS // 256 color only on PalmOS
typedef byte NewGuiColor; typedef byte OverlayColor;
#else #else
// 15/16 bit color mode everywhere else... // 15/16 bit color mode everywhere else...
typedef int16 NewGuiColor; typedef int16 OverlayColor;
#endif #endif
/* /*

View file

@ -153,28 +153,32 @@ public:
virtual int16 get_width() = 0; virtual int16 get_width() = 0;
/** Set colors of the palette. */ /** Set colors of the palette. */
virtual void set_palette(const byte *colors, uint start, uint num) = 0; virtual void setPalette(const byte *colors, uint start, uint num) = 0;
/** /**
* Draw a bitmap to screen. * Draw a bitmap to screen.
* The screen will not be updated to reflect the new bitmap, you have * The screen will not be updated to reflect the new bitmap, you have
* to call update_screen to do that. * to call updateScreen to do that.
* @see update_screen * @see updateScreen
*/ */
virtual void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h) = 0; virtual void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h) = 0;
/** Update the dirty areas of the screen. */
virtual void updateScreen() = 0;
/** /**
* Moves the screen content by the offset specified via dx/dy. * Moves the screen content by the offset specified via dx/dy.
* Only the region from x=0 till x=height-1 is affected. * Only the region from x=0 till x=height-1 is affected.
* @param dx the horizontal offset. * @param dx the horizontal offset.
* @param dy the vertical offset. * @param dy the vertical offset.
* @param height the number of lines which in which the move will be done. * @param height the number of lines which in which the move will be done.
*
* @todo This is a rather special screen effect, only used by the SCUMM
* frontend - we should consider removing it from the backend API
* and instead implement the functionality in the frontend.
*/ */
virtual void move_screen(int dx, int dy, int height) = 0; virtual void move_screen(int dx, int dy, int height) = 0;
/** Update the dirty areas of the screen. */
virtual void update_screen() = 0;
/** /**
* Set current shake position, a feature needed for some SCUMM screen effects. * Set current shake position, a feature needed for some SCUMM screen effects.
* The effect causes the displayed graphics to be shifted upwards by the specified * The effect causes the displayed graphics to be shifted upwards by the specified
@ -183,31 +187,13 @@ public:
* be lost - that is, to restore the original view, the game engine only has to * be lost - that is, to restore the original view, the game engine only has to
* call this method again with a 0 offset. No calls to copy_rect are necessary. * call this method again with a 0 offset. No calls to copy_rect are necessary.
* @param shakeOffset the shake offset * @param shakeOffset the shake offset
*
* @todo This is a rather special screen effect, only used by the SCUMM
* frontend - we should consider removing it from the backend API
* and instead implement the functionality in the frontend.
*/ */
virtual void set_shake_pos(int shakeOffset) = 0; virtual void set_shake_pos(int shakeOffset) = 0;
/** Convert the given RGB triplet into a NewGuiColor. A NewGuiColor can be
* 8bit, 16bit or 32bit, depending on the target system. The default
* implementation generates a 16 bit color value, in the 565 format
* (that is, 5 bits red, 6 bits green, 5 bits blue).
* @see colorToRGB
*/
virtual NewGuiColor RGBToColor(uint8 r, uint8 g, uint8 b) {
return ((((r >> 3) & 0x1F) << 11) | (((g >> 2) & 0x3F) << 5) | ((b >> 3) & 0x1F));
}
/** Convert the given NewGuiColor into a RGB triplet. A NewGuiColor can be
* 8bit, 16bit or 32bit, depending on the target system. The default
* implementation takes a 16 bit color value and assumes it to be in 565 format
* (that is, 5 bits red, 6 bits green, 5 bits blue).
* @see RGBToColor
*/
virtual void colorToRGB(NewGuiColor color, uint8 &r, uint8 &g, uint8 &b) {
r = (((color >> 11) & 0x1F) << 3);
g = (((color >> 5) & 0x3F) << 2);
b = ((color&0x1F) << 3);
}
//@} //@}
@ -361,7 +347,7 @@ public:
*/ */
virtual void update_cdrom() = 0; virtual void update_cdrom() = 0;
//@} //@}
@ -374,19 +360,19 @@ public:
* Create a new mutex. * Create a new mutex.
* @return the newly created mutex, or 0 if an error occured. * @return the newly created mutex, or 0 if an error occured.
*/ */
virtual MutexRef create_mutex(void) = 0; virtual MutexRef createMutex(void) = 0;
/** /**
* Lock the given mutex. * Lock the given mutex.
* @param mutex the mutex to lock. * @param mutex the mutex to lock.
*/ */
virtual void lock_mutex(MutexRef mutex) = 0; virtual void lockMutex(MutexRef mutex) = 0;
/** /**
* Unlock the given mutex. * Unlock the given mutex.
* @param mutex the mutex to unlock. * @param mutex the mutex to unlock.
*/ */
virtual void unlock_mutex(MutexRef mutex) = 0; virtual void unlockMutex(MutexRef mutex) = 0;
/** /**
* Delete the given mutex. Make sure the mutex is unlocked before you delete it. * Delete the given mutex. Make sure the mutex is unlocked before you delete it.
@ -394,8 +380,8 @@ public:
* program may crash. * program may crash.
* @param mutex the mutex to delete. * @param mutex the mutex to delete.
*/ */
virtual void delete_mutex(MutexRef mutex) = 0; virtual void deleteMutex(MutexRef mutex) = 0;
//@} //@}
@ -404,11 +390,33 @@ public:
virtual void show_overlay() = 0; virtual void show_overlay() = 0;
virtual void hide_overlay() = 0; virtual void hide_overlay() = 0;
virtual void clear_overlay() = 0; virtual void clear_overlay() = 0;
virtual void grab_overlay(NewGuiColor *buf, int pitch) = 0; virtual void grab_overlay(OverlayColor *buf, int pitch) = 0;
virtual void copy_rect_overlay(const NewGuiColor *buf, int pitch, int x, int y, int w, int h) = 0; virtual void copy_rect_overlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) = 0;
virtual int16 get_overlay_height() { return get_height(); } virtual int16 get_overlay_height() { return get_height(); }
virtual int16 get_overlay_width() { return get_width(); } virtual int16 get_overlay_width() { return get_width(); }
//@}
/** Convert the given RGB triplet into a OverlayColor. A OverlayColor can be
* 8bit, 16bit or 32bit, depending on the target system. The default
* implementation generates a 16 bit color value, in the 565 format
* (that is, 5 bits red, 6 bits green, 5 bits blue).
* @see colorToRGB
*/
virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b) {
return ((((r >> 3) & 0x1F) << 11) | (((g >> 2) & 0x3F) << 5) | ((b >> 3) & 0x1F));
}
/** Convert the given OverlayColor into a RGB triplet. A OverlayColor can be
* 8bit, 16bit or 32bit, depending on the target system. The default
* implementation takes a 16 bit color value and assumes it to be in 565 format
* (that is, 5 bits red, 6 bits green, 5 bits blue).
* @see RGBToColor
*/
virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
r = (((color >> 11) & 0x1F) << 3);
g = (((color >> 5) & 0x3F) << 2);
b = ((color&0x1F) << 3);
}
//@}

View file

@ -33,7 +33,7 @@ Timer::Timer(OSystem *system) :
_timerHandler(0), _timerHandler(0),
_lastTime(0) { _lastTime(0) {
_mutex = _system->create_mutex(); _mutex = _system->createMutex();
g_timer = this; g_timer = this;
@ -71,7 +71,7 @@ Timer::~Timer() {
// it is still waiting for the _mutex. So, again depending on the backend, // it is still waiting for the _mutex. So, again depending on the backend,
// we might end up unlocking the mutex then immediately deleting it, while // we might end up unlocking the mutex then immediately deleting it, while
// the timer thread is about to lock it. // the timer thread is about to lock it.
_system->delete_mutex(_mutex); _system->deleteMutex(_mutex);
} }
int Timer::timer_handler(int t) { int Timer::timer_handler(int t) {

View file

@ -119,7 +119,7 @@ void StackLock::lock() {
if (_mutexName != NULL) if (_mutexName != NULL)
debug(6, "Locking mutex %s", _mutexName); debug(6, "Locking mutex %s", _mutexName);
_syst->lock_mutex(_mutex); _syst->lockMutex(_mutex);
} }
void StackLock::unlock() { void StackLock::unlock() {
@ -127,7 +127,7 @@ void StackLock::unlock() {
if (_mutexName != NULL) if (_mutexName != NULL)
debug(6, "Unlocking mutex %s", _mutexName); debug(6, "Unlocking mutex %s", _mutexName);
_syst->unlock_mutex(_mutex); _syst->unlockMutex(_mutex);
} }

View file

@ -241,7 +241,7 @@ void ScrollBarWidget::drawWidget(bool hilite) {
(hilite && _part == kSliderPart) ? gui->_textcolorhi : gui->_textcolor); (hilite && _part == kSliderPart) ? gui->_textcolorhi : gui->_textcolor);
gui->frameRect(_x, _y + _sliderPos, _w, _sliderHeight, gui->_color); gui->frameRect(_x, _y + _sliderPos, _w, _sliderHeight, gui->_color);
int y = _y + _sliderPos + _sliderHeight / 2; int y = _y + _sliderPos + _sliderHeight / 2;
NewGuiColor color = (hilite && _part == kSliderPart) ? gui->_color : gui->_shadowcolor; OverlayColor color = (hilite && _part == kSliderPart) ? gui->_color : gui->_shadowcolor;
gui->hLine(_x + 2, y - 2, _x + _w - 3, color); gui->hLine(_x + 2, y - 2, _x + _w - 3, color);
gui->hLine(_x + 2, y, _x + _w - 3, color); gui->hLine(_x + 2, y, _x + _w - 3, color);
gui->hLine(_x + 2, y + 2, _x + _w-3, color); gui->hLine(_x + 2, y + 2, _x + _w-3, color);

View file

@ -127,7 +127,7 @@ void TabWidget::drawWidget(bool hilite) {
// Iterate over all tabs and draw them // Iterate over all tabs and draw them
int i, x = _x + kTabLeftOffset; int i, x = _x + kTabLeftOffset;
for (i = 0; i < (int)_tabs.size(); ++i) { for (i = 0; i < (int)_tabs.size(); ++i) {
NewGuiColor color = (i == _activeTab) ? gui->_color : gui->_shadowcolor; OverlayColor color = (i == _activeTab) ? gui->_color : gui->_shadowcolor;
int yOffset = (i == _activeTab) ? 0 : 2; int yOffset = (i == _activeTab) ? 0 : 2;
gui->box(x, _y + yOffset, _tabWidth, kTabHeight - yOffset, color, color); gui->box(x, _y + yOffset, _tabWidth, kTabHeight - yOffset, color, color);
gui->drawString(_tabs[i].title, x + kTabPadding, _y + yOffset / 2 + (kTabHeight - kLineHeight - 1), _tabWidth - 2 * kTabPadding, gui->_textcolor, kTextAlignCenter); gui->drawString(_tabs[i].title, x + kTabPadding, _y + yOffset / 2 + (kTabHeight - kLineHeight - 1), _tabWidth - 2 * kTabPadding, gui->_textcolor, kTextAlignCenter);

View file

@ -146,7 +146,7 @@ void NewGui::runLoop() {
} }
animateCursor(); animateCursor();
_system->update_screen(); _system->updateScreen();
OSystem::Event event; OSystem::Event event;
uint32 time = _system->get_msecs(); uint32 time = _system->get_msecs();
@ -239,7 +239,7 @@ void NewGui::saveState() {
// whatever is visible on the screen rught now. // whatever is visible on the screen rught now.
int sys_height = _system->get_overlay_height(); int sys_height = _system->get_overlay_height();
int sys_width = _system->get_overlay_width(); int sys_width = _system->get_overlay_width();
_screen = (NewGuiColor*)calloc(sys_width * sys_height, sizeof(NewGuiColor)); _screen = (OverlayColor*)calloc(sys_width * sys_height, sizeof(OverlayColor));
_screenPitch = sys_width; _screenPitch = sys_width;
_system->grab_overlay(_screen, _screenPitch); _system->grab_overlay(_screen, _screenPitch);
@ -260,7 +260,7 @@ void NewGui::restoreState() {
_screen = 0; _screen = 0;
} }
_system->update_screen(); _system->updateScreen();
_stateIsSaved = false; _stateIsSaved = false;
} }
@ -282,11 +282,11 @@ void NewGui::closeTopDialog() {
#pragma mark - #pragma mark -
NewGuiColor *NewGui::getBasePtr(int x, int y) { OverlayColor *NewGui::getBasePtr(int x, int y) {
return _screen + x + y * _screenPitch; return _screen + x + y * _screenPitch;
} }
void NewGui::box(int x, int y, int width, int height, NewGuiColor colorA, NewGuiColor colorB) { void NewGui::box(int x, int y, int width, int height, OverlayColor colorA, OverlayColor colorB) {
hLine(x + 1, y, x + width - 2, colorA); hLine(x + 1, y, x + width - 2, colorA);
hLine(x, y + 1, x + width - 1, colorA); hLine(x, y + 1, x + width - 1, colorA);
vLine(x, y + 1, y + height - 2, colorA); vLine(x, y + 1, y + height - 2, colorA);
@ -298,8 +298,8 @@ void NewGui::box(int x, int y, int width, int height, NewGuiColor colorA, NewGui
vLine(x + width - 2, y + 1, y + height - 1, colorB); vLine(x + width - 2, y + 1, y + height - 1, colorB);
} }
void NewGui::line(int x, int y, int x2, int y2, NewGuiColor color) { void NewGui::line(int x, int y, int x2, int y2, OverlayColor color) {
NewGuiColor *ptr; OverlayColor *ptr;
if (x2 < x) if (x2 < x)
SWAP(x2, x); SWAP(x2, x);
@ -323,7 +323,7 @@ void NewGui::line(int x, int y, int x2, int y2, NewGuiColor color) {
} }
} }
void NewGui::blendRect(int x, int y, int w, int h, NewGuiColor color, int level) { void NewGui::blendRect(int x, int y, int w, int h, OverlayColor color, int level) {
#ifdef NEWGUI_256 #ifdef NEWGUI_256
fillRect(x, y, w, h, color); fillRect(x, y, w, h, color);
#else #else
@ -334,7 +334,7 @@ void NewGui::blendRect(int x, int y, int w, int h, NewGuiColor color, int level)
g = ag * level; g = ag * level;
b = ab * level; b = ab * level;
NewGuiColor *ptr = getBasePtr(x, y); OverlayColor *ptr = getBasePtr(x, y);
while (h--) { while (h--) {
for (int i = 0; i < w; i++) { for (int i = 0; i < w; i++) {
@ -348,9 +348,9 @@ void NewGui::blendRect(int x, int y, int w, int h, NewGuiColor color, int level)
#endif #endif
} }
void NewGui::fillRect(int x, int y, int w, int h, NewGuiColor color) { void NewGui::fillRect(int x, int y, int w, int h, OverlayColor color) {
int i; int i;
NewGuiColor *ptr = getBasePtr(x, y); OverlayColor *ptr = getBasePtr(x, y);
while (h--) { while (h--) {
for (i = 0; i < w; i++) { for (i = 0; i < w; i++) {
@ -360,9 +360,9 @@ void NewGui::fillRect(int x, int y, int w, int h, NewGuiColor color) {
} }
} }
void NewGui::checkerRect(int x, int y, int w, int h, NewGuiColor color) { void NewGui::checkerRect(int x, int y, int w, int h, OverlayColor color) {
int i; int i;
NewGuiColor *ptr = getBasePtr(x, y); OverlayColor *ptr = getBasePtr(x, y);
while (h--) { while (h--) {
for (i = 0; i < w; i++) { for (i = 0; i < w; i++) {
@ -373,9 +373,9 @@ void NewGui::checkerRect(int x, int y, int w, int h, NewGuiColor color) {
} }
} }
void NewGui::frameRect(int x, int y, int w, int h, NewGuiColor color) { void NewGui::frameRect(int x, int y, int w, int h, OverlayColor color) {
int i; int i;
NewGuiColor *ptr, *basePtr = getBasePtr(x, y); OverlayColor *ptr, *basePtr = getBasePtr(x, y);
if (basePtr == NULL) if (basePtr == NULL)
return; return;
@ -397,12 +397,12 @@ void NewGui::addDirtyRect(int x, int y, int w, int h) {
// For now we don't keep yet another list of dirty rects but simply // For now we don't keep yet another list of dirty rects but simply
// blit the affected area directly to the overlay. At least for our current // blit the affected area directly to the overlay. At least for our current
// GUI/widget/dialog code that is just fine. // GUI/widget/dialog code that is just fine.
NewGuiColor *buf = getBasePtr(x, y); OverlayColor *buf = getBasePtr(x, y);
_system->copy_rect_overlay(buf, _screenPitch, x, y, w, h); _system->copy_rect_overlay(buf, _screenPitch, x, y, w, h);
} }
void NewGui::drawChar(byte chr, int xx, int yy, NewGuiColor color) { void NewGui::drawChar(byte chr, int xx, int yy, OverlayColor color) {
NewGuiColor *ptr = getBasePtr(xx, yy); OverlayColor *ptr = getBasePtr(xx, yy);
uint x, y; uint x, y;
#ifdef NEW_FONT_CODE #ifdef NEW_FONT_CODE
@ -480,7 +480,7 @@ int NewGui::getCharWidth(byte c) {
#endif #endif
} }
void NewGui::drawString(const String &s, int x, int y, int w, NewGuiColor color, int align, int deltax, bool useEllipsis) { void NewGui::drawString(const String &s, int x, int y, int w, OverlayColor color, int align, int deltax, bool useEllipsis) {
const int leftX = x, rightX = x + w; const int leftX = x, rightX = x + w;
uint i; uint i;
int width = getStringWidth(s); int width = getStringWidth(s);
@ -553,7 +553,7 @@ void NewGui::drawString(const String &s, int x, int y, int w, NewGuiColor color,
// Blit from a buffer to the display // Blit from a buffer to the display
// //
void NewGui::blitFromBuffer(int x, int y, int w, int h, const byte *buf, int pitch) { void NewGui::blitFromBuffer(int x, int y, int w, int h, const byte *buf, int pitch) {
NewGuiColor *ptr = getBasePtr(x, y); OverlayColor *ptr = getBasePtr(x, y);
assert(buf); assert(buf);
while (h--) { while (h--) {
@ -567,7 +567,7 @@ void NewGui::blitFromBuffer(int x, int y, int w, int h, const byte *buf, int pit
// Blit from the display to a buffer // Blit from the display to a buffer
// //
void NewGui::blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch) { void NewGui::blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch) {
NewGuiColor *ptr = getBasePtr(x, y); OverlayColor *ptr = getBasePtr(x, y);
assert(buf); assert(buf);
while (h--) { while (h--) {
@ -580,8 +580,8 @@ void NewGui::blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch) {
// //
// Draw an 8x8 bitmap at location (x,y) // Draw an 8x8 bitmap at location (x,y)
// //
void NewGui::drawBitmap(uint32 *bitmap, int x, int y, NewGuiColor color, int h) { void NewGui::drawBitmap(uint32 *bitmap, int x, int y, OverlayColor color, int h) {
NewGuiColor *ptr = getBasePtr(x, y); OverlayColor *ptr = getBasePtr(x, y);
for (y = 0; y < h; y++) { for (y = 0; y < h; y++) {
uint32 mask = 0xF0000000; uint32 mask = 0xF0000000;

View file

@ -92,7 +92,7 @@ public:
protected: protected:
OSystem *_system; OSystem *_system;
NewGuiColor *_screen; OverlayColor *_screen;
int _screenPitch; int _screenPitch;
bool _needRedraw; bool _needRedraw;
@ -134,28 +134,28 @@ protected:
public: public:
// Theme colors // Theme colors
NewGuiColor _color, _shadowcolor; OverlayColor _color, _shadowcolor;
NewGuiColor _bgcolor; OverlayColor _bgcolor;
NewGuiColor _textcolor; OverlayColor _textcolor;
NewGuiColor _textcolorhi; OverlayColor _textcolorhi;
// Drawing primitives // Drawing primitives
NewGuiColor *getBasePtr(int x, int y); OverlayColor *getBasePtr(int x, int y);
void box(int x, int y, int width, int height, NewGuiColor colorA, NewGuiColor colorB); void box(int x, int y, int width, int height, OverlayColor colorA, OverlayColor colorB);
void line(int x, int y, int x2, int y2, NewGuiColor color); void line(int x, int y, int x2, int y2, OverlayColor color);
void blendRect(int x, int y, int w, int h, NewGuiColor color, int level = 3); void blendRect(int x, int y, int w, int h, OverlayColor color, int level = 3);
void fillRect(int x, int y, int w, int h, NewGuiColor color); void fillRect(int x, int y, int w, int h, OverlayColor color);
void checkerRect(int x, int y, int w, int h, NewGuiColor color); void checkerRect(int x, int y, int w, int h, OverlayColor color);
void frameRect(int x, int y, int w, int h, NewGuiColor color); void frameRect(int x, int y, int w, int h, OverlayColor color);
void drawChar(byte c, int x, int y, NewGuiColor color); void drawChar(byte c, int x, int y, OverlayColor color);
int getStringWidth(const String &str); int getStringWidth(const String &str);
int getCharWidth(byte c); int getCharWidth(byte c);
void drawString(const String &str, int x, int y, int w, NewGuiColor color, int align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true); void drawString(const String &str, int x, int y, int w, OverlayColor color, int align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true);
void blitFromBuffer(int x, int y, int w, int h, const byte *buf, int pitch); void blitFromBuffer(int x, int y, int w, int h, const byte *buf, int pitch);
void blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch); void blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch);
void drawBitmap(uint32 *bitmap, int x, int y, NewGuiColor color, int h = 8); void drawBitmap(uint32 *bitmap, int x, int y, OverlayColor color, int h = 8);
void addDirtyRect(int x, int y, int w, int h); void addDirtyRect(int x, int y, int w, int h);
}; };

View file

@ -57,8 +57,8 @@ void Widget::draw() {
// Draw border // Draw border
if (_flags & WIDGET_BORDER) { if (_flags & WIDGET_BORDER) {
NewGuiColor colorA = gui->_color; OverlayColor colorA = gui->_color;
NewGuiColor colorB = gui->_shadowcolor; OverlayColor colorB = gui->_shadowcolor;
if ((_flags & WIDGET_INV_BORDER) == WIDGET_INV_BORDER) if ((_flags & WIDGET_INV_BORDER) == WIDGET_INV_BORDER)
SWAP(colorA, colorB); SWAP(colorA, colorB);
gui->box(_x, _y, _w, _h, colorA, colorB); gui->box(_x, _y, _w, _h, colorA, colorB);

View file

@ -156,9 +156,9 @@ void Display::palSet(const uint8 *pal, int start, int end, bool updateScreen) {
debug(9, "Display::palSet(%d, %d)", start, end); debug(9, "Display::palSet(%d, %d)", start, end);
uint8 tempPal[256 * 4]; uint8 tempPal[256 * 4];
palConvert(tempPal, pal, start, end); palConvert(tempPal, pal, start, end);
_system->set_palette(tempPal + start * 4, start, end - start + 1); _system->setPalette(tempPal + start * 4, start, end - start + 1);
if (updateScreen) { if (updateScreen) {
_system->update_screen(); _system->updateScreen();
_vm->input()->delay(20); _vm->input()->delay(20);
} }
} }
@ -617,7 +617,7 @@ void Display::update(bool dynalum, int16 dynaX, int16 dynaY) {
} }
debug(7, "Display::update() - Dirtyblocks blit (%d)", count); debug(7, "Display::update() - Dirtyblocks blit (%d)", count);
} }
_system->update_screen(); _system->updateScreen();
} }
void Display::setupPanel() { void Display::setupPanel() {
@ -958,7 +958,7 @@ void Display::blankScreenEffect1() {
++y; ++y;
} }
_system->copy_rect(buf, 32, x, y, 32, 32); _system->copy_rect(buf, 32, x, y, 32, 32);
_system->update_screen(); _system->updateScreen();
_vm->input()->delay(10); _vm->input()->delay(10);
} }
} }
@ -991,7 +991,7 @@ void Display::blankScreenEffect2() {
p += SCREEN_W; p += SCREEN_W;
} }
_system->copy_rect(buf, SCREEN_W, x, y, 2, 2); _system->copy_rect(buf, SCREEN_W, x, y, 2, 2);
_system->update_screen(); _system->updateScreen();
_vm->input()->delay(10); _vm->input()->delay(10);
} }
} }
@ -1020,7 +1020,7 @@ void Display::blankScreenEffect3() {
++i; ++i;
_system->copy_rect(buf, SCREEN_W, x, y, 2, 2); _system->copy_rect(buf, SCREEN_W, x, y, 2, 2);
} }
_system->update_screen(); _system->updateScreen();
_vm->input()->delay(10); _vm->input()->delay(10);
} }
} }

View file

@ -786,7 +786,7 @@ void ScummDebugger::drawBox(int box) {
if (vs != NULL) if (vs != NULL)
_vm->markRectAsDirty(vs->number, 0, vs->width, 0, vs->height); _vm->markRectAsDirty(vs->number, 0, vs->width, 0, vs->height);
_vm->drawDirtyScreenParts(); _vm->drawDirtyScreenParts();
_vm->_system->update_screen(); _vm->_system->updateScreen();
} }
bool ScummDebugger::Cmd_PrintDraft(int argc, const char **argv) { bool ScummDebugger::Cmd_PrintDraft(int argc, const char **argv) {

View file

@ -2446,7 +2446,7 @@ void ScummEngine::transitionEffect(int a) {
// Draw the current state to the screen and wait half a sec so the user // Draw the current state to the screen and wait half a sec so the user
// can watch the effect taking place. // can watch the effect taking place.
_system->update_screen(); _system->updateScreen();
waitForTimer(30); waitForTimer(30);
} }
} }
@ -2552,7 +2552,7 @@ void ScummEngine::dissolveEffect(int width, int height) {
if (++blits >= blits_before_refresh) { if (++blits >= blits_before_refresh) {
blits = 0; blits = 0;
_system->update_screen(); _system->updateScreen();
waitForTimer(30); waitForTimer(30);
} }
} }
@ -2560,7 +2560,7 @@ void ScummEngine::dissolveEffect(int width, int height) {
free(offsets); free(offsets);
if (blits != 0) { if (blits != 0) {
_system->update_screen(); _system->updateScreen();
waitForTimer(30); waitForTimer(30);
} }
} }
@ -2588,7 +2588,7 @@ void ScummEngine::scrollEffect(int dir) {
vs->width, vs->width,
0, vs->height - step, 0, vs->height - step,
vs->width, step); vs->width, step);
_system->update_screen(); _system->updateScreen();
waitForTimer(kPictureDelay); waitForTimer(kPictureDelay);
y += step; y += step;
@ -2603,7 +2603,7 @@ void ScummEngine::scrollEffect(int dir) {
vs->width, vs->width,
0, 0, 0, 0,
vs->width, step); vs->width, step);
_system->update_screen(); _system->updateScreen();
waitForTimer(kPictureDelay); waitForTimer(kPictureDelay);
y += step; y += step;
@ -2618,7 +2618,7 @@ void ScummEngine::scrollEffect(int dir) {
vs->width, vs->width,
vs->width - step, 0, vs->width - step, 0,
step, vs->height); step, vs->height);
_system->update_screen(); _system->updateScreen();
waitForTimer(kPictureDelay); waitForTimer(kPictureDelay);
x += step; x += step;
@ -2633,7 +2633,7 @@ void ScummEngine::scrollEffect(int dir) {
vs->width, vs->width,
0, 0, 0, 0,
step, vs->height); step, vs->height);
_system->update_screen(); _system->updateScreen();
waitForTimer(kPictureDelay); waitForTimer(kPictureDelay);
x += step; x += step;

View file

@ -1760,10 +1760,10 @@ void IMuseInternal::copyGlobalAdlibInstrument(byte slot, Instrument *dest) {
// //
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
IMuse::IMuse(OSystem *system, IMuseInternal *target) : _system(system), _target(target) { _mutex = system->create_mutex(); } IMuse::IMuse(OSystem *system, IMuseInternal *target) : _system(system), _target(target) { _mutex = system->createMutex(); }
IMuse::~IMuse() { if (_mutex) _system->delete_mutex(_mutex); if (_target) delete _target; } IMuse::~IMuse() { if (_mutex) _system->deleteMutex(_mutex); if (_target) delete _target; }
inline void IMuse::in() const { _system->lock_mutex(_mutex); } inline void IMuse::in() const { _system->lockMutex(_mutex); }
inline void IMuse::out() const { _system->unlock_mutex(_mutex); } inline void IMuse::out() const { _system->unlockMutex(_mutex); }
void IMuse::on_timer(MidiDriver *midi) { in(); _target->on_timer(midi); out(); } void IMuse::on_timer(MidiDriver *midi) { in(); _target->on_timer(midi); out(); }
void IMuse::pause(bool paused) { in(); _target->pause(paused); out(); } void IMuse::pause(bool paused) { in(); _target->pause(paused); out(); }

View file

@ -43,7 +43,7 @@ void IMuseDigital::timer_handler(void *refCon) {
IMuseDigital::IMuseDigital(ScummEngine *scumm) IMuseDigital::IMuseDigital(ScummEngine *scumm)
: _vm(scumm) { : _vm(scumm) {
_mutex = g_system->create_mutex(); _mutex = g_system->createMutex();
_pause = false; _pause = false;
_sound = new ImuseDigiSndMgr(_vm); _sound = new ImuseDigiSndMgr(_vm);
_vm->_timer->installTimerProc(timer_handler, 1000000 / 25, this); _vm->_timer->installTimerProc(timer_handler, 1000000 / 25, this);
@ -61,7 +61,7 @@ IMuseDigital::~IMuseDigital() {
stopAllSounds(true); stopAllSounds(true);
_vm->_timer->removeTimerProc(timer_handler); _vm->_timer->removeTimerProc(timer_handler);
delete _sound; delete _sound;
g_system->delete_mutex(_mutex); g_system->deleteMutex(_mutex);
} }
void IMuseDigital::callback() { void IMuseDigital::callback() {

View file

@ -911,7 +911,7 @@ void ScummEngine::updatePalette() {
} }
} }
_system->set_palette(palette_colors, first, num); _system->setPalette(palette_colors, first, num);
_palDirtyMax = -1; _palDirtyMax = -1;
_palDirtyMin = 256; _palDirtyMin = 256;

View file

@ -349,7 +349,7 @@ Player_V2::Player_V2(ScummEngine *scumm, bool pcjr) {
_system = scumm->_system; _system = scumm->_system;
_mixer = scumm->_mixer; _mixer = scumm->_mixer;
_sample_rate = _system->getOutputSampleRate(); _sample_rate = _system->getOutputSampleRate();
_mutex = _system->create_mutex(); _mutex = _system->createMutex();
_header_len = (scumm->_features & GF_OLD_BUNDLE) ? 4 : 6; _header_len = (scumm->_features & GF_OLD_BUNDLE) ? 4 : 6;
@ -384,7 +384,7 @@ Player_V2::~Player_V2() {
// Detach the premix callback handler // Detach the premix callback handler
_mixer->setupPremix(0, 0); _mixer->setupPremix(0, 0);
mutex_down(); mutex_down();
_system->delete_mutex (_mutex); _system->deleteMutex (_mutex);
} }
void Player_V2::set_pcjr(bool pcjr) { void Player_V2::set_pcjr(bool pcjr) {

View file

@ -127,8 +127,8 @@ private:
ChannelInfo _channels[5]; ChannelInfo _channels[5];
protected: protected:
void mutex_up() { _system->lock_mutex (_mutex); } void mutex_up() { _system->lockMutex (_mutex); }
void mutex_down() { _system->unlock_mutex (_mutex); } void mutex_down() { _system->unlockMutex (_mutex); }
virtual void nextTick(); virtual void nextTick();
virtual void clear_channel(int i); virtual void clear_channel(int i);

View file

@ -1223,7 +1223,7 @@ void ScummEngine::mainRun() {
while (!_quit) { while (!_quit) {
updatePalette(); updatePalette();
_system->update_screen(); _system->updateScreen();
diff -= _system->get_msecs(); diff -= _system->get_msecs();
waitForTimer(delta * 15 + diff); waitForTimer(delta * 15 + diff);

View file

@ -902,7 +902,7 @@ void SmushPlayer::setPalette(const byte *palette) {
*p++ = 0; *p++ = 0;
} }
_vm->_system->set_palette(palette_colors, 0, 256); _vm->_system->setPalette(palette_colors, 0, 256);
} }
void SmushPlayer::setPaletteValue(int n, byte r, byte g, byte b) { void SmushPlayer::setPaletteValue(int n, byte r, byte g, byte b) {
@ -910,7 +910,7 @@ void SmushPlayer::setPaletteValue(int n, byte r, byte g, byte b) {
_pal[n * 3 + 1] = g; _pal[n * 3 + 1] = g;
_pal[n * 3 + 2] = b; _pal[n * 3 + 2] = b;
_vm->_system->set_palette(_pal, n, 1); _vm->_system->setPalette(_pal, n, 1);
} }
void SmushPlayer::updateScreen() { void SmushPlayer::updateScreen() {
@ -1046,7 +1046,7 @@ void SmushPlayer::play(const char *filename, const char *directory, int32 offset
uint32 end_time, start_time; uint32 end_time, start_time;
start_time = _vm->_system->get_msecs(); start_time = _vm->_system->get_msecs();
_vm->_system->update_screen(); _vm->_system->updateScreen();
_updateNeeded = false; _updateNeeded = false;
if (_insanity) if (_insanity)

View file

@ -56,7 +56,7 @@ MidiPlayer::MidiPlayer(OSystem *system) {
// this is where we'll initialize stuff that must persist // this is where we'll initialize stuff that must persist
// between songs. // between songs.
_system = system; _system = system;
_mutex = system->create_mutex(); _mutex = system->createMutex();
_driver = 0; _driver = 0;
_map_mt32_to_gm = false; _map_mt32_to_gm = false;
@ -74,10 +74,10 @@ MidiPlayer::MidiPlayer(OSystem *system) {
} }
MidiPlayer::~MidiPlayer() { MidiPlayer::~MidiPlayer() {
_system->lock_mutex(_mutex); _system->lockMutex(_mutex);
close(); close();
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
_system->delete_mutex(_mutex); _system->deleteMutex(_mutex);
} }
int MidiPlayer::open() { int MidiPlayer::open() {
@ -94,12 +94,12 @@ int MidiPlayer::open() {
void MidiPlayer::close() { void MidiPlayer::close() {
stop(); stop();
// _system->lock_mutex (_mutex); // _system->lockMutex (_mutex);
if (_driver) if (_driver)
_driver->close(); _driver->close();
_driver = NULL; _driver = NULL;
clearConstructs(); clearConstructs();
// _system->unlock_mutex (_mutex); // _system->unlockMutex (_mutex);
} }
void MidiPlayer::send(uint32 b) { void MidiPlayer::send(uint32 b) {
@ -150,9 +150,9 @@ void MidiPlayer::metaEvent (byte type, byte *data, uint16 length) {
// Have to unlock it before calling jump() // Have to unlock it before calling jump()
// (which locks it itself), and then relock it // (which locks it itself), and then relock it
// upon returning. // upon returning.
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
startTrack (destination); startTrack (destination);
_system->lock_mutex(_mutex); _system->lockMutex(_mutex);
} else { } else {
stop(); stop();
} }
@ -160,7 +160,7 @@ void MidiPlayer::metaEvent (byte type, byte *data, uint16 length) {
void MidiPlayer::onTimer (void *data) { void MidiPlayer::onTimer (void *data) {
MidiPlayer *p = (MidiPlayer *) data; MidiPlayer *p = (MidiPlayer *) data;
p->_system->lock_mutex(p->_mutex); p->_system->lockMutex(p->_mutex);
if (!p->_paused) { if (!p->_paused) {
if (p->_music.parser && p->_currentTrack != 255) { if (p->_music.parser && p->_currentTrack != 255) {
p->_current = &p->_music; p->_current = &p->_music;
@ -172,7 +172,7 @@ void MidiPlayer::onTimer (void *data) {
p->_sfx.parser->onTimer(); p->_sfx.parser->onTimer();
} }
p->_current = 0; p->_current = 0;
p->_system->unlock_mutex(p->_mutex); p->_system->unlockMutex(p->_mutex);
} }
void MidiPlayer::startTrack (int track) { void MidiPlayer::startTrack (int track) {
@ -183,7 +183,7 @@ void MidiPlayer::startTrack (int track) {
if (track >= _music.num_songs) if (track >= _music.num_songs)
return; return;
_system->lock_mutex(_mutex); _system->lockMutex(_mutex);
if (_music.parser) { if (_music.parser) {
_current = &_music; _current = &_music;
@ -205,9 +205,9 @@ void MidiPlayer::startTrack (int track) {
_currentTrack = (byte) track; _currentTrack = (byte) track;
_music.parser = parser; // That plugs the power cord into the wall _music.parser = parser; // That plugs the power cord into the wall
} else if (_music.parser) { } else if (_music.parser) {
_system->lock_mutex(_mutex); _system->lockMutex(_mutex);
if (!_music.parser->setTrack(track)) { if (!_music.parser->setTrack(track)) {
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
return; return;
} }
_currentTrack = (byte) track; _currentTrack = (byte) track;
@ -216,18 +216,18 @@ void MidiPlayer::startTrack (int track) {
_current = 0; _current = 0;
} }
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
} }
void MidiPlayer::stop() { void MidiPlayer::stop() {
_system->lock_mutex(_mutex); _system->lockMutex(_mutex);
if (_music.parser) { if (_music.parser) {
_current = &_music; _current = &_music;
_music.parser->jumpToTick(0); _music.parser->jumpToTick(0);
} }
_current = 0; _current = 0;
_currentTrack = 255; _currentTrack = 255;
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
} }
void MidiPlayer::pause (bool b) { void MidiPlayer::pause (bool b) {
@ -235,14 +235,14 @@ void MidiPlayer::pause (bool b) {
return; return;
_paused = b; _paused = b;
_system->lock_mutex(_mutex); _system->lockMutex(_mutex);
for (int i = 0; i < 16; ++i) { for (int i = 0; i < 16; ++i) {
if (_music.channel[i]) if (_music.channel[i])
_music.channel[i]->volume (_paused ? 0 : (_music.volume[i] * _masterVolume / 255)); _music.channel[i]->volume (_paused ? 0 : (_music.volume[i] * _masterVolume / 255));
if (_sfx.channel[i]) if (_sfx.channel[i])
_sfx.channel[i]->volume (_paused ? 0 : (_sfx.volume[i] * _masterVolume / 255)); _sfx.channel[i]->volume (_paused ? 0 : (_sfx.volume[i] * _masterVolume / 255));
} }
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
} }
void MidiPlayer::set_volume (int volume) { void MidiPlayer::set_volume (int volume) {
@ -256,7 +256,7 @@ void MidiPlayer::set_volume (int volume) {
_masterVolume = volume; _masterVolume = volume;
// Now tell all the channels this. // Now tell all the channels this.
_system->lock_mutex (_mutex); _system->lockMutex (_mutex);
if (_driver && !_paused) { if (_driver && !_paused) {
for (int i = 0; i < 16; ++i) { for (int i = 0; i < 16; ++i) {
if (_music.channel[i]) if (_music.channel[i])
@ -265,7 +265,7 @@ void MidiPlayer::set_volume (int volume) {
_sfx.channel[i]->volume(_sfx.volume[i] * _masterVolume / 255); _sfx.channel[i]->volume(_sfx.volume[i] * _masterVolume / 255);
} }
} }
_system->unlock_mutex (_mutex); _system->unlockMutex (_mutex);
} }
void MidiPlayer::set_driver(MidiDriver *md) { void MidiPlayer::set_driver(MidiDriver *md) {
@ -276,27 +276,27 @@ void MidiPlayer::set_driver(MidiDriver *md) {
} }
void MidiPlayer::mapMT32toGM (bool map) { void MidiPlayer::mapMT32toGM (bool map) {
_system->lock_mutex(_mutex); _system->lockMutex(_mutex);
_map_mt32_to_gm = map; _map_mt32_to_gm = map;
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
} }
void MidiPlayer::setLoop (bool loop) { void MidiPlayer::setLoop (bool loop) {
_system->lock_mutex(_mutex); _system->lockMutex(_mutex);
_loopTrack = loop; _loopTrack = loop;
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
} }
void MidiPlayer::queueTrack (int track, bool loop) { void MidiPlayer::queueTrack (int track, bool loop) {
_system->lock_mutex(_mutex); _system->lockMutex(_mutex);
if (_currentTrack == 255) { if (_currentTrack == 255) {
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
setLoop(loop); setLoop(loop);
startTrack(track); startTrack(track);
} else { } else {
_queuedTrack = track; _queuedTrack = track;
_loopQueuedTrack = loop; _loopQueuedTrack = loop;
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
} }
} }
@ -351,7 +351,7 @@ static int simon1_gmf_size[] = {
}; };
void MidiPlayer::loadSMF (File *in, int song, bool sfx) { void MidiPlayer::loadSMF (File *in, int song, bool sfx) {
_system->lock_mutex(_mutex); _system->lockMutex(_mutex);
MusicInfo *p = sfx ? &_sfx : &_music; MusicInfo *p = sfx ? &_sfx : &_music;
clearConstructs (*p); clearConstructs (*p);
@ -418,7 +418,7 @@ void MidiPlayer::loadSMF (File *in, int song, bool sfx) {
resetVolumeTable(); resetVolumeTable();
} }
p->parser = parser; // That plugs the power cord into the wall p->parser = parser; // That plugs the power cord into the wall
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
} }
void MidiPlayer::loadMultipleSMF (File *in, bool sfx) { void MidiPlayer::loadMultipleSMF (File *in, bool sfx) {
@ -431,14 +431,14 @@ void MidiPlayer::loadMultipleSMF (File *in, bool sfx) {
// We need to load ALL the songs and then // We need to load ALL the songs and then
// treat them as separate tracks -- for the // treat them as separate tracks -- for the
// purpose of jumps, anyway. // purpose of jumps, anyway.
_system->lock_mutex(_mutex); _system->lockMutex(_mutex);
MusicInfo *p = sfx ? &_sfx : &_music; MusicInfo *p = sfx ? &_sfx : &_music;
clearConstructs(*p); clearConstructs(*p);
p->num_songs = in->readByte(); p->num_songs = in->readByte();
if (p->num_songs > 16) { if (p->num_songs > 16) {
printf ("playMultipleSMF: %d is too many songs to keep track of!\n", (int) p->num_songs); printf ("playMultipleSMF: %d is too many songs to keep track of!\n", (int) p->num_songs);
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
return; return;
} }
@ -451,7 +451,7 @@ void MidiPlayer::loadMultipleSMF (File *in, bool sfx) {
in->read(buf, 4); in->read(buf, 4);
if (memcmp (buf, "MThd", 4)) { if (memcmp (buf, "MThd", 4)) {
printf ("Expected MThd but found '%c%c%c%c' instead!\n", buf[0], buf[1], buf[2], buf[3]); printf ("Expected MThd but found '%c%c%c%c' instead!\n", buf[0], buf[1], buf[2], buf[3]);
_system->unlock_mutex (_mutex); _system->unlockMutex (_mutex);
return; return;
} }
in->seek(in->readUint32BE() + in->pos(), SEEK_SET); in->seek(in->readUint32BE() + in->pos(), SEEK_SET);
@ -476,11 +476,11 @@ void MidiPlayer::loadMultipleSMF (File *in, bool sfx) {
_currentTrack = 255; _currentTrack = 255;
resetVolumeTable(); resetVolumeTable();
} }
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
} }
void MidiPlayer::loadXMIDI(File *in, bool sfx) { void MidiPlayer::loadXMIDI(File *in, bool sfx) {
_system->lock_mutex(_mutex); _system->lockMutex(_mutex);
MusicInfo *p = sfx ? &_sfx : &_music; MusicInfo *p = sfx ? &_sfx : &_music;
clearConstructs(*p); clearConstructs(*p);
@ -499,7 +499,7 @@ void MidiPlayer::loadXMIDI(File *in, bool sfx) {
} }
if (memcmp(buf, "CAT ", 4)) { if (memcmp(buf, "CAT ", 4)) {
warning("Could not find 'CAT ' tag to determine resource size!"); warning("Could not find 'CAT ' tag to determine resource size!");
_system->unlock_mutex (_mutex); _system->unlockMutex (_mutex);
return; return;
} }
size += 4 + in->readUint32BE(); size += 4 + in->readUint32BE();
@ -508,7 +508,7 @@ void MidiPlayer::loadXMIDI(File *in, bool sfx) {
in->read(p->data, size); in->read(p->data, size);
} else { } else {
warning("Expected 'FORM' tag but found '%c%c%c%c' instead!", buf[0], buf[1], buf[2], buf[3]); warning("Expected 'FORM' tag but found '%c%c%c%c' instead!", buf[0], buf[1], buf[2], buf[3]);
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
return; return;
} }
@ -526,18 +526,18 @@ void MidiPlayer::loadXMIDI(File *in, bool sfx) {
resetVolumeTable(); resetVolumeTable();
} }
p->parser = parser; // That plugs the power cord into the wall p->parser = parser; // That plugs the power cord into the wall
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
} }
void MidiPlayer::loadS1D (File *in, bool sfx) { void MidiPlayer::loadS1D (File *in, bool sfx) {
_system->lock_mutex(_mutex); _system->lockMutex(_mutex);
MusicInfo *p = sfx ? &_sfx : &_music; MusicInfo *p = sfx ? &_sfx : &_music;
clearConstructs(*p); clearConstructs(*p);
uint16 size = in->readUint16LE(); uint16 size = in->readUint16LE();
if (size != in->size() - 2) { if (size != in->size() - 2) {
warning("Size mismatch in simon1demo MUS file (%ld versus reported %d)", (long) in->size() - 2, (int) size); warning("Size mismatch in simon1demo MUS file (%ld versus reported %d)", (long) in->size() - 2, (int) size);
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
return; return;
} }
@ -558,7 +558,7 @@ void MidiPlayer::loadS1D (File *in, bool sfx) {
resetVolumeTable(); resetVolumeTable();
} }
p->parser = parser; // That plugs the power cord into the wall p->parser = parser; // That plugs the power cord into the wall
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
} }
} // End of namespace Simon } // End of namespace Simon

View file

@ -2477,9 +2477,9 @@ void SimonEngine::o_fade_to_black() {
palette_fadeout((uint32 *)_video_buf_1 + 32 + 16, 144); palette_fadeout((uint32 *)_video_buf_1 + 32 + 16, 144);
palette_fadeout((uint32 *)_video_buf_1 + 32 + 16 + 144 + 16, 48); palette_fadeout((uint32 *)_video_buf_1 + 32 + 16 + 144 + 16, 48);
_system->set_palette(_video_buf_1, 0, 256); _system->setPalette(_video_buf_1, 0, 256);
if (_fade) if (_fade)
_system->update_screen(); _system->updateScreen();
delay(5); delay(5);
} while (--i); } while (--i);
@ -4666,12 +4666,12 @@ void SimonEngine::dx_update_screen_and_palette() {
_video_var_9 = 0; _video_var_9 = 0;
if (memcmp(_palette, _palette_backup, 256 * 4) != 0) { if (memcmp(_palette, _palette_backup, 256 * 4) != 0) {
memcpy(_palette_backup, _palette, 256 * 4); memcpy(_palette_backup, _palette, 256 * 4);
_system->set_palette(_palette, 0, 256); _system->setPalette(_palette, 0, 256);
} }
} }
_system->copy_rect(_sdl_buf_attached, 320, 0, 0, 320, 200); _system->copy_rect(_sdl_buf_attached, 320, 0, 0, 320, 200);
_system->update_screen(); _system->updateScreen();
memcpy(_sdl_buf_attached, _sdl_buf, 320 * 200); memcpy(_sdl_buf_attached, _sdl_buf, 320 * 200);
@ -4691,7 +4691,7 @@ void SimonEngine::realizePalette() {
if (_palette_color_count & 0x8000) { if (_palette_color_count & 0x8000) {
fadeUpPalette(); fadeUpPalette();
} else { } else {
_system->set_palette(_palette, 0, _palette_color_count); _system->setPalette(_palette, 0, _palette_color_count);
} }
_palette_color_count = 0; _palette_color_count = 0;
@ -4750,7 +4750,7 @@ void SimonEngine::fadeUpPalette() {
src += 4; src += 4;
} }
_system->set_palette(_video_buf_1, 0, _video_num_pal_colors); _system->setPalette(_video_buf_1, 0, _video_num_pal_colors);
delay(5); delay(5);
} while (!done); } while (!done);
} }

View file

@ -1727,9 +1727,9 @@ void SimonEngine::vc_62_palette_thing() {
memcpy(_video_buf_1, _palette_backup, _video_num_pal_colors * sizeof(uint32)); memcpy(_video_buf_1, _palette_backup, _video_num_pal_colors * sizeof(uint32));
for (i = NUM_PALETTE_FADEOUT; i != 0; --i) { for (i = NUM_PALETTE_FADEOUT; i != 0; --i) {
palette_fadeout((uint32 *)_video_buf_1, _video_num_pal_colors); palette_fadeout((uint32 *)_video_buf_1, _video_num_pal_colors);
_system->set_palette(_video_buf_1, 0, _video_num_pal_colors); _system->setPalette(_video_buf_1, 0, _video_num_pal_colors);
if (_fade) if (_fade)
_system->update_screen(); _system->updateScreen();
delay(5); delay(5);
} }

View file

@ -378,13 +378,13 @@ void Control::animClick(ConResource *pButton) {
_text->flushForRedraw(); _text->flushForRedraw();
pButton->drawToScreen(NO_MASK); pButton->drawToScreen(NO_MASK);
_text->drawToScreen(WITH_MASK); _text->drawToScreen(WITH_MASK);
_system->update_screen(); _system->updateScreen();
delay(150); delay(150);
pButton->_curSprite--; pButton->_curSprite--;
_text->flushForRedraw(); _text->flushForRedraw();
pButton->drawToScreen(NO_MASK); pButton->drawToScreen(NO_MASK);
_text->drawToScreen(WITH_MASK); _text->drawToScreen(WITH_MASK);
_system->update_screen(); _system->updateScreen();
} }
} }
@ -431,7 +431,7 @@ void Control::doLoadSavePanel(void) {
memset(_screenBuf, 0, GAME_SCREEN_WIDTH * FULL_SCREEN_HEIGHT); memset(_screenBuf, 0, GAME_SCREEN_WIDTH * FULL_SCREEN_HEIGHT);
_system->copy_rect(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, FULL_SCREEN_HEIGHT); _system->copy_rect(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, FULL_SCREEN_HEIGHT);
_system->update_screen(); _system->updateScreen();
_skyScreen->forceRefresh(); _skyScreen->forceRefresh();
_skyScreen->setPaletteEndian((uint8 *)SkyEngine::fetchCompact(SkyEngine::_systemVars.currentPalette)); _skyScreen->setPaletteEndian((uint8 *)SkyEngine::fetchCompact(SkyEngine::_systemVars.currentPalette));
removePanel(); removePanel();
@ -468,7 +468,7 @@ void Control::doControlPanel(void) {
while (!quitPanel) { while (!quitPanel) {
_text->drawToScreen(WITH_MASK); _text->drawToScreen(WITH_MASK);
_system->update_screen(); _system->updateScreen();
_mouseClicked = false; _mouseClicked = false;
delay(50); delay(50);
if (_keyPressed == 27) { // escape pressed if (_keyPressed == 27) { // escape pressed
@ -497,7 +497,7 @@ void Control::doControlPanel(void) {
} }
memset(_screenBuf, 0, GAME_SCREEN_WIDTH * FULL_SCREEN_HEIGHT); memset(_screenBuf, 0, GAME_SCREEN_WIDTH * FULL_SCREEN_HEIGHT);
_system->copy_rect(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, FULL_SCREEN_HEIGHT); _system->copy_rect(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, FULL_SCREEN_HEIGHT);
_system->update_screen(); _system->updateScreen();
_skyScreen->forceRefresh(); _skyScreen->forceRefresh();
_skyScreen->setPaletteEndian((uint8 *)SkyEngine::fetchCompact(SkyEngine::_systemVars.currentPalette)); _skyScreen->setPaletteEndian((uint8 *)SkyEngine::fetchCompact(SkyEngine::_systemVars.currentPalette));
removePanel(); removePanel();
@ -609,7 +609,7 @@ bool Control::getYesNo(char *text) {
mouseType = wantMouse; mouseType = wantMouse;
_skyMouse->spriteMouse(mouseType, 0, 0); _skyMouse->spriteMouse(mouseType, 0, 0);
} }
_system->update_screen(); _system->updateScreen();
delay(50); delay(50);
if ((_mouseY >= 83) && (_mouseY <= 110)) { if ((_mouseY >= 83) && (_mouseY <= 110)) {
if ((_mouseX >= 77) && (_mouseX <= 114)) { // over 'yes' if ((_mouseX >= 77) && (_mouseX <= 114)) { // over 'yes'
@ -657,7 +657,7 @@ uint16 Control::doMusicSlide(void) {
} }
buttonControl(_slide2); buttonControl(_slide2);
_text->drawToScreen(WITH_MASK); _text->drawToScreen(WITH_MASK);
_system->update_screen(); _system->updateScreen();
} }
return 0; return 0;
} }
@ -685,7 +685,7 @@ uint16 Control::doSpeedSlide(void) {
} }
buttonControl(_slide); buttonControl(_slide);
_text->drawToScreen(WITH_MASK); _text->drawToScreen(WITH_MASK);
_system->update_screen(); _system->updateScreen();
} }
SkyEngine::_systemVars.gameSpeed = speedDelay; SkyEngine::_systemVars.gameSpeed = speedDelay;
return SPEED_CHANGED; return SPEED_CHANGED;
@ -705,7 +705,7 @@ uint16 Control::toggleFx(ConResource *pButton) {
} }
pButton->drawToScreen(WITH_MASK); pButton->drawToScreen(WITH_MASK);
buttonControl(pButton); buttonControl(pButton);
_system->update_screen(); _system->updateScreen();
return TOGGLED; return TOGGLED;
} }
@ -729,7 +729,7 @@ uint16 Control::toggleText(void) {
drawTextCross(flags); drawTextCross(flags);
_system->update_screen(); _system->updateScreen();
return TOGGLED; return TOGGLED;
} }
@ -848,7 +848,7 @@ uint16 Control::saveRestorePanel(bool allowSave) {
} }
_text->drawToScreen(WITH_MASK); _text->drawToScreen(WITH_MASK);
_system->update_screen(); _system->updateScreen();
_mouseClicked = false; _mouseClicked = false;
delay(50); delay(50);
if (_keyPressed == 27) { // escape pressed if (_keyPressed == 27) { // escape pressed
@ -1547,7 +1547,7 @@ uint16 Control::quickXRestore(uint16 slot) {
_skyText->fnSetFont(0); _skyText->fnSetFont(0);
_system->copy_rect(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT); _system->copy_rect(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT);
_system->update_screen(); _system->updateScreen();
if (SkyEngine::_systemVars.gameVersion < 331) if (SkyEngine::_systemVars.gameVersion < 331)
_skyScreen->setPalette(60509); _skyScreen->setPalette(60509);
@ -1571,7 +1571,7 @@ uint16 Control::quickXRestore(uint16 slot) {
} else { } else {
memset(_screenBuf, 0, FULL_SCREEN_WIDTH * FULL_SCREEN_HEIGHT); memset(_screenBuf, 0, FULL_SCREEN_WIDTH * FULL_SCREEN_HEIGHT);
_system->copy_rect(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, FULL_SCREEN_HEIGHT); _system->copy_rect(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, FULL_SCREEN_HEIGHT);
_system->update_screen(); _system->updateScreen();
_skyScreen->showScreen(_skyScreen->giveCurrent()); _skyScreen->showScreen(_skyScreen->giveCurrent());
_skyScreen->setPalette(60111); _skyScreen->setPalette(60111);
} }

View file

@ -793,7 +793,7 @@ bool Intro::floppyScrollFlirt(void) {
} while (nrToDo == 255); } while (nrToDo == 255);
} }
_system->copy_rect(scrollPos, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT); _system->copy_rect(scrollPos, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT);
_system->update_screen(); _system->updateScreen();
if (!escDelay(40)) if (!escDelay(40))
doContinue = false; doContinue = false;
} }

View file

@ -34,7 +34,7 @@ MusicBase::MusicBase(Disk *pDisk, OSystem *system) {
_musicVolume = 127; _musicVolume = 127;
_system = system; _system = system;
_numberOfChannels = _currentMusic = 0; _numberOfChannels = _currentMusic = 0;
_mutex = _system->create_mutex(); _mutex = _system->createMutex();
} }
MusicBase::~MusicBase(void) { MusicBase::~MusicBase(void) {
@ -45,7 +45,7 @@ MusicBase::~MusicBase(void) {
void MusicBase::loadSection(uint8 pSection) { void MusicBase::loadSection(uint8 pSection) {
_system->lock_mutex(_mutex); _system->lockMutex(_mutex);
if (_currentMusic) if (_currentMusic)
stopMusic(); stopMusic();
if (_musicData) if (_musicData)
@ -62,7 +62,7 @@ void MusicBase::loadSection(uint8 pSection) {
_numberOfChannels = _currentMusic = 0; _numberOfChannels = _currentMusic = 0;
setupPointers(); setupPointers();
startDriver(); startDriver();
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
} }
bool MusicBase::musicIsPlaying(void) { bool MusicBase::musicIsPlaying(void) {
@ -165,7 +165,7 @@ void MusicBase::loadNewMusic(void) {
void MusicBase::pollMusic(void) { void MusicBase::pollMusic(void) {
_system->lock_mutex(_mutex); _system->lockMutex(_mutex);
uint8 newTempo; uint8 newTempo;
if (_onNextPoll.doReInit) startDriver(); if (_onNextPoll.doReInit) startDriver();
if (_onNextPoll.doStopMusic) stopMusic(); if (_onNextPoll.doStopMusic) stopMusic();
@ -181,7 +181,7 @@ void MusicBase::pollMusic(void) {
updateTempo(); updateTempo();
} }
} }
_system->unlock_mutex(_mutex); _system->unlockMutex(_mutex);
_aktTime &= 0xFFFF; _aktTime &= 0xFFFF;
} }

View file

@ -76,7 +76,7 @@ Screen::Screen(OSystem *pSystem, Disk *pDisk) {
} }
//set the palette //set the palette
_system->set_palette(tmpPal, 0, VGA_COLOURS); _system->setPalette(tmpPal, 0, VGA_COLOURS);
_currentPalette = 0; _currentPalette = 0;
_seqInfo.framesLeft = 0; _seqInfo.framesLeft = 0;
@ -94,15 +94,15 @@ void Screen::clearScreen(void) {
memset(_currentScreen, 0, FULL_SCREEN_WIDTH * FULL_SCREEN_HEIGHT); memset(_currentScreen, 0, FULL_SCREEN_WIDTH * FULL_SCREEN_HEIGHT);
_system->copy_rect(_currentScreen, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT); _system->copy_rect(_currentScreen, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT);
_system->update_screen(); _system->updateScreen();
} }
//set a new palette, pal is a pointer to dos vga rgb components 0..63 //set a new palette, pal is a pointer to dos vga rgb components 0..63
void Screen::setPalette(uint8 *pal) { void Screen::setPalette(uint8 *pal) {
convertPalette(pal, _palette); convertPalette(pal, _palette);
_system->set_palette(_palette, 0, GAME_COLOURS); _system->setPalette(_palette, 0, GAME_COLOURS);
_system->update_screen(); _system->updateScreen();
} }
void Screen::setPaletteEndian(uint8 *pal) { void Screen::setPaletteEndian(uint8 *pal) {
@ -115,8 +115,8 @@ void Screen::setPaletteEndian(uint8 *pal) {
#else #else
convertPalette(pal, _palette); convertPalette(pal, _palette);
#endif #endif
_system->set_palette(_palette, 0, GAME_COLOURS); _system->setPalette(_palette, 0, GAME_COLOURS);
_system->update_screen(); _system->updateScreen();
} }
void Screen::halvePalette(void) { void Screen::halvePalette(void) {
@ -128,7 +128,7 @@ void Screen::halvePalette(void) {
halfPalette[(cnt << 2) | 2] = _palette[(cnt << 2) | 2] >> 1; halfPalette[(cnt << 2) | 2] = _palette[(cnt << 2) | 2] >> 1;
halfPalette[(cnt << 2) | 3] = 0; halfPalette[(cnt << 2) | 3] = 0;
} }
_system->set_palette(halfPalette, 0, GAME_COLOURS); _system->setPalette(halfPalette, 0, GAME_COLOURS);
} }
void Screen::setPalette(uint16 fileNum) { void Screen::setPalette(uint16 fileNum) {
@ -152,7 +152,7 @@ void Screen::showScreen(uint16 fileNum) {
void Screen::showScreen(uint8 *pScreen) { void Screen::showScreen(uint8 *pScreen) {
_system->copy_rect(pScreen, 320, 0, 0, GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT); _system->copy_rect(pScreen, 320, 0, 0, GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT);
_system->update_screen(); _system->updateScreen();
} }
void Screen::convertPalette(uint8 *inPal, uint8* outPal) { //convert 3 byte 0..63 rgb to 4byte 0..255 rgbx void Screen::convertPalette(uint8 *inPal, uint8* outPal) { //convert 3 byte 0..63 rgb to 4byte 0..255 rgbx
@ -221,7 +221,7 @@ void Screen::flip(bool doUpdate) {
} }
} }
if (doUpdate) if (doUpdate)
_system->update_screen(); _system->updateScreen();
} }
void Screen::fnDrawScreen(uint32 palette, uint32 scroll) { void Screen::fnDrawScreen(uint32 palette, uint32 scroll) {
@ -247,8 +247,8 @@ void Screen::fnFadeDown(uint32 scroll) {
} else { } else {
for (uint8 cnt = 0; cnt < 32; cnt++) { for (uint8 cnt = 0; cnt < 32; cnt++) {
palette_fadedown_helper((uint32 *)_palette, GAME_COLOURS); palette_fadedown_helper((uint32 *)_palette, GAME_COLOURS);
_system->set_palette(_palette, 0, GAME_COLOURS); _system->setPalette(_palette, 0, GAME_COLOURS);
_system->update_screen(); _system->updateScreen();
_system->delay_msecs(20); _system->delay_msecs(20);
} }
} }
@ -295,8 +295,8 @@ void Screen::paletteFadeUp(uint8 *pal) {
_palette[(colCnt << 2) | 1] = (tmpPal[(colCnt << 2) | 1] * cnt) >> 5; _palette[(colCnt << 2) | 1] = (tmpPal[(colCnt << 2) | 1] * cnt) >> 5;
_palette[(colCnt << 2) | 2] = (tmpPal[(colCnt << 2) | 2] * cnt) >> 5; _palette[(colCnt << 2) | 2] = (tmpPal[(colCnt << 2) | 2] * cnt) >> 5;
} }
_system->set_palette(_palette, 0, GAME_COLOURS); _system->setPalette(_palette, 0, GAME_COLOURS);
_system->update_screen(); _system->updateScreen();
_system->delay_msecs(20); _system->delay_msecs(20);
} }
} }
@ -482,7 +482,7 @@ void Screen::processSequence(void) {
} }
scrPtr += 15 * GAME_SCREEN_WIDTH; scrPtr += 15 * GAME_SCREEN_WIDTH;
} }
_system->update_screen(); _system->updateScreen();
_seqInfo.framesLeft--; _seqInfo.framesLeft--;
} }
if (_seqInfo.framesLeft == 0) { if (_seqInfo.framesLeft == 0) {

View file

@ -105,7 +105,7 @@ public:
SoundMixer::SoundMixer() { SoundMixer::SoundMixer() {
_syst = OSystem::instance(); _syst = OSystem::instance();
_mutex = _syst->create_mutex(); _mutex = _syst->createMutex();
_premixParam = 0; _premixParam = 0;
_premixProc = 0; _premixProc = 0;
@ -130,7 +130,7 @@ SoundMixer::SoundMixer() {
SoundMixer::~SoundMixer() { SoundMixer::~SoundMixer() {
_syst->clearSoundCallback(); _syst->clearSoundCallback();
stopAll(); stopAll();
_syst->delete_mutex(_mutex); _syst->deleteMutex(_mutex);
} }
void SoundMixer::setupPremix(PremixProc *proc, void *param) { void SoundMixer::setupPremix(PremixProc *proc, void *param) {

View file

@ -104,7 +104,7 @@ bool AnimationState::init(const char *name) {
palnum = 0; palnum = 0;
maxPalnum = p; maxPalnum = p;
_sys->set_palette(palettes[palnum].pal, 0, 256); _sys->setPalette(palettes[palnum].pal, 0, 256);
lut = lut2 = lookup[0]; lut = lut2 = lookup[0];
curpal = -1; curpal = -1;
cr = 0; cr = 0;
@ -113,7 +113,7 @@ bool AnimationState::init(const char *name) {
lutcalcnum = (BITDEPTH + palettes[palnum].end + 2) / (palettes[palnum].end + 2); lutcalcnum = (BITDEPTH + palettes[palnum].end + 2) / (palettes[palnum].end + 2);
#else #else
buildLookup(); buildLookup();
overlay = (NewGuiColor*)calloc(MOVIE_WIDTH * MOVIE_HEIGHT, sizeof(NewGuiColor)); overlay = (OverlayColor*)calloc(MOVIE_WIDTH * MOVIE_HEIGHT, sizeof(OverlayColor));
_sys->show_overlay(); _sys->show_overlay();
#endif #endif
@ -208,7 +208,7 @@ bool AnimationState::checkPaletteSwitch() {
if (framenum == palettes[palnum].end) { if (framenum == palettes[palnum].end) {
unsigned char *l = lut2; unsigned char *l = lut2;
palnum++; palnum++;
_sys->set_palette(palettes[palnum].pal, 0, 256); _sys->setPalette(palettes[palnum].pal, 0, 256);
lutcalcnum = (BITDEPTH + palettes[palnum].end - (framenum + 1) + 2) / (palettes[palnum].end - (framenum + 1) + 2); lutcalcnum = (BITDEPTH + palettes[palnum].end - (framenum + 1) + 2) / (palettes[palnum].end - (framenum + 1) + 2);
lut2 = lut; lut2 = lut;
lut = l; lut = l;
@ -220,13 +220,13 @@ bool AnimationState::checkPaletteSwitch() {
#else #else
NewGuiColor *AnimationState::lookup = 0; OverlayColor *AnimationState::lookup = 0;
void AnimationState::buildLookup() { void AnimationState::buildLookup() {
if (lookup) if (lookup)
return; return;
lookup = (NewGuiColor *)calloc(BITDEPTH * BITDEPTH * 256, sizeof(NewGuiColor)); lookup = (OverlayColor *)calloc(BITDEPTH * BITDEPTH * 256, sizeof(OverlayColor));
int y, cb, cr; int y, cb, cr;
int r, g, b; int r, g, b;
@ -252,9 +252,9 @@ void AnimationState::buildLookup() {
} }
} }
void AnimationState::plotYUV(NewGuiColor *lut, int width, int height, byte *const *dat) { void AnimationState::plotYUV(OverlayColor *lut, int width, int height, byte *const *dat) {
NewGuiColor *ptr = overlay + (MOVIE_HEIGHT - height) / 2 * MOVIE_WIDTH + (MOVIE_WIDTH - width) / 2; OverlayColor *ptr = overlay + (MOVIE_HEIGHT - height) / 2 * MOVIE_WIDTH + (MOVIE_WIDTH - width) / 2;
int x, y; int x, y;
@ -377,7 +377,7 @@ void MoviePlayer::play(const char *filename) {
if (anim->init(filename)) { if (anim->init(filename)) {
while (anim->decodeFrame()) { while (anim->decodeFrame()) {
#ifndef BACKEND_8BIT #ifndef BACKEND_8BIT
_sys->update_screen(); _sys->updateScreen();
#endif #endif
// FIXME: check for ESC and abbort animation be just returning from the function // FIXME: check for ESC and abbort animation be just returning from the function
OSystem::Event event; OSystem::Event event;

View file

@ -111,8 +111,8 @@ private:
byte pal[4 * 256]; byte pal[4 * 256];
} palettes[50]; } palettes[50];
#else #else
static NewGuiColor *lookup; static OverlayColor *lookup;
NewGuiColor * overlay; OverlayColor * overlay;
#endif #endif
public: public:
@ -130,7 +130,7 @@ private:
bool checkPaletteSwitch(); bool checkPaletteSwitch();
#else #else
void buildLookup(void); void buildLookup(void);
void plotYUV(NewGuiColor *lut, int width, int height, byte *const *dat); void plotYUV(OverlayColor *lut, int width, int height, byte *const *dat);
#endif #endif
}; };

View file

@ -179,7 +179,7 @@ void Control::askForCd(void) {
} }
palOut[0] = palOut[1] = palOut[2] = palOut[3] = 0; palOut[0] = palOut[1] = palOut[2] = palOut[3] = 0;
_resMan->resClose(SR_PALETTE); _resMan->resClose(SR_PALETTE);
_system->set_palette(palOut, 0, 256); _system->setPalette(palOut, 0, 256);
free(palOut); free(palOut);
File test; File test;
@ -195,7 +195,7 @@ void Control::askForCd(void) {
renderText(textA, 320, 220, TEXT_CENTER); renderText(textA, 320, 220, TEXT_CENTER);
renderText(_lStrings[STR_INSERT_CD_B], 320, 240, TEXT_CENTER); renderText(_lStrings[STR_INSERT_CD_B], 320, 240, TEXT_CENTER);
_system->copy_rect(_screenBuf, 640, 0, 0, 640, 480); _system->copy_rect(_screenBuf, 640, 0, 0, 640, 480);
_system->update_screen(); _system->updateScreen();
} }
delay(300); delay(300);
if (_keyPressed) { if (_keyPressed) {
@ -204,7 +204,7 @@ void Control::askForCd(void) {
memset(_screenBuf, 0, 640 * 480); memset(_screenBuf, 0, 640 * 480);
renderText(_lStrings[STR_INCORRECT_CD], 320, 230, TEXT_CENTER); renderText(_lStrings[STR_INCORRECT_CD], 320, 230, TEXT_CENTER);
_system->copy_rect(_screenBuf, 640, 0, 0, 640, 480); _system->copy_rect(_screenBuf, 640, 0, 0, 640, 480);
_system->update_screen(); _system->updateScreen();
delay(2000); delay(2000);
refreshText = true; refreshText = true;
} else { } else {
@ -240,7 +240,7 @@ uint8 Control::runPanel(void) {
} }
palOut[0] = palOut[1] = palOut[2] = palOut[3] = 0; palOut[0] = palOut[1] = palOut[2] = palOut[3] = 0;
_resMan->resClose(SR_PALETTE); _resMan->resClose(SR_PALETTE);
_system->set_palette(palOut, 0, 256); _system->setPalette(palOut, 0, 256);
free(palOut); free(palOut);
uint8 mode = 0, newMode = BUTTON_MAIN_PANEL; uint8 mode = 0, newMode = BUTTON_MAIN_PANEL;
bool fullRefresh = false; bool fullRefresh = false;
@ -281,7 +281,7 @@ uint8 Control::runPanel(void) {
fullRefresh = false; fullRefresh = false;
_system->copy_rect(_screenBuf, SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, 480); _system->copy_rect(_screenBuf, SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, 480);
} }
_system->update_screen(); _system->updateScreen();
delay(1000 / 12); delay(1000 / 12);
newMode = getClicks(mode, &retVal); newMode = getClicks(mode, &retVal);
} while ((newMode != 1) && (retVal == 0)); } while ((newMode != 1) && (retVal == 0));
@ -568,7 +568,7 @@ bool Control::getConfirm(const uint8 *title) {
do { do {
buttons[0]->draw(); buttons[0]->draw();
buttons[1]->draw(); buttons[1]->draw();
_system->update_screen(); _system->updateScreen();
delay(1000 / 12); delay(1000 / 12);
if (_mouseState & BS1L_BUTTON_DOWN) { if (_mouseState & BS1L_BUTTON_DOWN) {
if (buttons[0]->wasClicked(_mouseX, _mouseY)) if (buttons[0]->wasClicked(_mouseX, _mouseY))

View file

@ -114,7 +114,7 @@ Music::Music(OSystem *system, SoundMixer *pMixer) {
_system = system; _system = system;
_mixer = pMixer; _mixer = pMixer;
_mixer->setupPremix(passMixerFunc, this); _mixer->setupPremix(passMixerFunc, this);
_mutex = _system->create_mutex(); _mutex = _system->createMutex();
_converter[0] = NULL; _converter[0] = NULL;
_converter[1] = NULL; _converter[1] = NULL;
_volumeL = _volumeR = 192; _volumeL = _volumeR = 192;
@ -125,7 +125,7 @@ Music::~Music() {
delete _converter[0]; delete _converter[0];
delete _converter[1]; delete _converter[1];
if (_mutex) if (_mutex)
_system->delete_mutex(_mutex); _system->deleteMutex(_mutex);
} }
void Music::passMixerFunc(void *param, int16 *buf, uint len) { void Music::passMixerFunc(void *param, int16 *buf, uint len) {

View file

@ -108,14 +108,14 @@ void Screen::fnSetPalette(uint8 start, uint16 length, uint32 id, bool fadeUp) {
_fadingStep = 1; _fadingStep = 1;
_fadingDirection = FADE_UP; _fadingDirection = FADE_UP;
memset(_currentPalette, 0, 256 * 4); memset(_currentPalette, 0, 256 * 4);
_system->set_palette(_currentPalette, 0, 256); _system->setPalette(_currentPalette, 0, 256);
} else } else
_system->set_palette(_targetPalette + 4 * start, start, length); _system->setPalette(_targetPalette + 4 * start, start, length);
} }
void Screen::fullRefresh(void) { void Screen::fullRefresh(void) {
_fullRefresh = true; _fullRefresh = true;
_system->set_palette(_targetPalette, 0, 256); _system->setPalette(_targetPalette, 0, 256);
} }
bool Screen::stillFading(void) { bool Screen::stillFading(void) {
@ -133,7 +133,7 @@ bool Screen::showScrollFrame(void) {
uint16 avgScrlY = (uint16)(_oldScrollY + Logic::_scriptVars[SCROLL_OFFSET_Y]) / 2; uint16 avgScrlY = (uint16)(_oldScrollY + Logic::_scriptVars[SCROLL_OFFSET_Y]) / 2;
_system->copy_rect(_screenBuf + avgScrlY * _scrnSizeX + avgScrlX, _scrnSizeX, 0, 40, SCREEN_WIDTH, SCREEN_DEPTH); _system->copy_rect(_screenBuf + avgScrlY * _scrnSizeX + avgScrlX, _scrnSizeX, 0, 40, SCREEN_WIDTH, SCREEN_DEPTH);
_system->update_screen(); _system->updateScreen();
return true; return true;
} }
@ -147,7 +147,7 @@ void Screen::updateScreen(void) {
} }
if (_fadingStep) { if (_fadingStep) {
fadePalette(); fadePalette();
_system->set_palette(_currentPalette, 0, 256); _system->setPalette(_currentPalette, 0, 256);
} }
uint16 scrlX = (uint16)Logic::_scriptVars[SCROLL_OFFSET_X]; uint16 scrlX = (uint16)Logic::_scriptVars[SCROLL_OFFSET_X];
@ -241,7 +241,7 @@ void Screen::updateScreen(void) {
scrnBuf += _scrnSizeX * SCRNGRID_Y; scrnBuf += _scrnSizeX * SCRNGRID_Y;
} }
} }
_system->update_screen(); _system->updateScreen();
} }
void Screen::newScreen(uint32 screen) { void Screen::newScreen(uint32 screen) {
@ -956,7 +956,7 @@ void Screen::plotYUV(byte *lut, int width, int height, byte *const *dat) {
} }
_system->copy_rect(buf, width, (640-width)/2, (480-height)/2, width, height); _system->copy_rect(buf, width, (640-width)/2, (480-height)/2, width, height);
_system->update_screen(); _system->updateScreen();
free(buf); free(buf);

View file

@ -121,7 +121,7 @@ bool AnimationState::init(const char *name) {
lutcalcnum = (BITDEPTH + palettes[palnum].end + 2) / (palettes[palnum].end + 2); lutcalcnum = (BITDEPTH + palettes[palnum].end + 2) / (palettes[palnum].end + 2);
#else #else
buildLookup(); buildLookup();
overlay = (NewGuiColor*)calloc(MOVIE_WIDTH * MOVIE_HEIGHT, sizeof(NewGuiColor)); overlay = (OverlayColor*)calloc(MOVIE_WIDTH * MOVIE_HEIGHT, sizeof(OverlayColor));
_vm->_system->show_overlay(); _vm->_system->show_overlay();
#endif #endif
@ -229,13 +229,13 @@ bool AnimationState::checkPaletteSwitch() {
#else #else
NewGuiColor *AnimationState::lookup = 0; OverlayColor *AnimationState::lookup = 0;
void AnimationState::buildLookup() { void AnimationState::buildLookup() {
if (lookup) if (lookup)
return; return;
lookup = (NewGuiColor *)calloc(BITDEPTH * BITDEPTH * 256, sizeof(NewGuiColor)); lookup = (OverlayColor *)calloc(BITDEPTH * BITDEPTH * 256, sizeof(OverlayColor));
int y, cb, cr; int y, cb, cr;
int r, g, b; int r, g, b;
@ -262,9 +262,9 @@ void AnimationState::buildLookup() {
} }
void AnimationState::plotYUV(NewGuiColor *lut, int width, int height, byte *const *dat) { void AnimationState::plotYUV(OverlayColor *lut, int width, int height, byte *const *dat) {
NewGuiColor *ptr = overlay + (MOVIE_HEIGHT - height) / 2 * MOVIE_WIDTH + (MOVIE_WIDTH - width) / 2; OverlayColor *ptr = overlay + (MOVIE_HEIGHT - height) / 2 * MOVIE_WIDTH + (MOVIE_WIDTH - width) / 2;
int x, y; int x, y;
@ -289,12 +289,12 @@ void AnimationState::plotYUV(NewGuiColor *lut, int width, int height, byte *cons
} }
void AnimationState::drawTextObject(SpriteInfo *s, uint8 *src) { void AnimationState::drawTextObject(SpriteInfo *s, uint8 *src) {
NewGuiColor *dst = overlay + RENDERWIDE * (s->y) + s->x; OverlayColor *dst = overlay + RENDERWIDE * (s->y) + s->x;
// FIXME: These aren't the "right" colours, but look good to me. // FIXME: These aren't the "right" colours, but look good to me.
NewGuiColor pen = _vm->_system->RGBToColor(255, 255, 255); OverlayColor pen = _vm->_system->RGBToColor(255, 255, 255);
NewGuiColor border = _vm->_system->RGBToColor(0, 0, 0); OverlayColor border = _vm->_system->RGBToColor(0, 0, 0);
for (int y = 0; y < s->h; y++) { for (int y = 0; y < s->h; y++) {
for (int x = 0; x < s->w; x++) { for (int x = 0; x < s->w; x++) {
@ -315,7 +315,7 @@ void AnimationState::drawTextObject(SpriteInfo *s, uint8 *src) {
} }
void AnimationState::clearDisplay(void) { void AnimationState::clearDisplay(void) {
NewGuiColor black = _vm->_system->RGBToColor(0, 0, 0); OverlayColor black = _vm->_system->RGBToColor(0, 0, 0);
for (int i = 0; i < MOVIE_WIDTH * MOVIE_HEIGHT; i++) for (int i = 0; i < MOVIE_WIDTH * MOVIE_HEIGHT; i++)
overlay[i] = black; overlay[i] = black;

View file

@ -105,8 +105,8 @@ private:
byte pal[4 * 256]; byte pal[4 * 256];
} palettes[50]; } palettes[50];
#else #else
static NewGuiColor *lookup; static OverlayColor *lookup;
NewGuiColor *overlay; OverlayColor *overlay;
#endif #endif
public: public:
@ -130,7 +130,7 @@ private:
bool checkPaletteSwitch(); bool checkPaletteSwitch();
#else #else
void buildLookup(void); void buildLookup(void);
void plotYUV(NewGuiColor *lut, int width, int height, byte *const *dat); void plotYUV(OverlayColor *lut, int width, int height, byte *const *dat);
#endif #endif
}; };

View file

@ -54,7 +54,7 @@ static void premix_proc(void *param, int16 *data, uint len) {
Sound::Sound(Sword2Engine *vm) { Sound::Sound(Sword2Engine *vm) {
_vm = vm; _vm = vm;
_mutex = _vm->_system->create_mutex(); _mutex = _vm->_system->createMutex();
memset(_fx, 0, sizeof(_fx)); memset(_fx, 0, sizeof(_fx));
@ -83,7 +83,7 @@ Sound::~Sound() {
for (int i = 0; i < MAXFX; i++) for (int i = 0; i < MAXFX; i++)
stopFxHandle(i); stopFxHandle(i);
if (_mutex) if (_mutex)
_vm->_system->delete_mutex(_mutex); _vm->_system->deleteMutex(_mutex);
} }
void Sound::fxServer(int16 *data, uint len) { void Sound::fxServer(int16 *data, uint len) {

View file

@ -113,11 +113,11 @@ void Graphics::setPalette(int16 startEntry, int16 noEntries, uint8 *colourTable,
if (noEntries) { if (noEntries) {
memcpy(&_palCopy[startEntry][0], colourTable, noEntries * 4); memcpy(&_palCopy[startEntry][0], colourTable, noEntries * 4);
if (fadeNow == RDPAL_INSTANT) { if (fadeNow == RDPAL_INSTANT) {
_vm->_system->set_palette((const byte *) _palCopy, startEntry, noEntries); _vm->_system->setPalette((const byte *) _palCopy, startEntry, noEntries);
setNeedFullRedraw(); setNeedFullRedraw();
} }
} else { } else {
_vm->_system->set_palette((const byte *) _palCopy, 0, 256); _vm->_system->setPalette((const byte *) _palCopy, 0, 256);
setNeedFullRedraw(); setNeedFullRedraw();
} }
} }
@ -128,7 +128,7 @@ void Graphics::dimPalette(void) {
for (int i = 0; i < 256 * 4; i++) for (int i = 0; i < 256 * 4; i++)
p[i] /= 2; p[i] /= 2;
_vm->_system->set_palette(p, 0, 256); _vm->_system->setPalette(p, 0, 256);
setNeedFullRedraw(); setNeedFullRedraw();
} }
@ -230,7 +230,7 @@ void Graphics::fadeServer(void) {
} }
} }
_vm->_system->set_palette(newPalette, 0, 256); _vm->_system->setPalette(newPalette, 0, 256);
setNeedFullRedraw(); setNeedFullRedraw();
} }

View file

@ -139,7 +139,7 @@ void Graphics::updateDisplay(bool redrawScene) {
} }
// We always need to update because of fades, menu animations, etc. // We always need to update because of fades, menu animations, etc.
_vm->_system->update_screen(); _vm->_system->updateScreen();
} }
/** /**