aboutsummaryrefslogtreecommitdiff
path: root/engines/tinsel
diff options
context:
space:
mode:
authorMax Horn2008-07-25 09:12:03 +0000
committerMax Horn2008-07-25 09:12:03 +0000
commit52a3dd758128ed442900ef57925c16e90c4c6316 (patch)
tree6c3af4cd453c55335ad58e0b445f5befb142fe86 /engines/tinsel
parent2fc0c3e85933ccbee0b3e0373b45c49d932f5159 (diff)
downloadscummvm-rg350-52a3dd758128ed442900ef57925c16e90c4c6316.tar.gz
scummvm-rg350-52a3dd758128ed442900ef57925c16e90c4c6316.tar.bz2
scummvm-rg350-52a3dd758128ed442900ef57925c16e90c4c6316.zip
TINSEL: Get rid of Graphics::Surface class
svn-id: r33275
Diffstat (limited to 'engines/tinsel')
-rw-r--r--engines/tinsel/graphics.cpp15
-rw-r--r--engines/tinsel/graphics.h27
-rw-r--r--engines/tinsel/tinsel.cpp15
-rw-r--r--engines/tinsel/tinsel.h4
4 files changed, 20 insertions, 41 deletions
diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp
index 751b8929ef..cd0937d944 100644
--- a/engines/tinsel/graphics.cpp
+++ b/engines/tinsel/graphics.cpp
@@ -369,17 +369,20 @@ static void DemoWrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool app
/**
* Clears both the screen surface buffer and screen to the specified value
*/
-void ClearScreen(uint32 val) {
- uint32 *pDest = (uint32 *)_vm->screen().getData();
- Common::set_to(pDest, (uint32 *)((byte *)pDest + SCREEN_WIDTH * SCREEN_HEIGHT), val);
- _vm->screen().update();
+void ClearScreen() {
+ void *pDest = _vm->screen().getBasePtr(0, 0);
+ memset(pDest, 0, SCREEN_WIDTH * SCREEN_HEIGHT);
+ g_system->clearScreen();
+ g_system->updateScreen();
}
/**
* Updates the screen surface within the following rectangle
*/
void UpdateScreenRect(const Common::Rect &pClip) {
- _vm->screen().updateRect(pClip);
+ byte *pDest = (byte *)_vm->screen().getBasePtr(pClip.left, pClip.top);
+ g_system->copyRectToScreen(pDest, _vm->screen().pitch, pClip.left, pClip.top, pClip.width(), pClip.height());
+ g_system->updateScreen();
}
/**
@@ -403,7 +406,7 @@ void DrawObject(DRAWOBJECT *pObj) {
}
// Get destination starting point
- destPtr = _vm->screen().getBasePtr(pObj->xPos, pObj->yPos);
+ destPtr = (byte *)_vm->screen().getBasePtr(pObj->xPos, pObj->yPos);
// Handle various draw types
uint8 typeId = pObj->flags & 0xff;
diff --git a/engines/tinsel/graphics.h b/engines/tinsel/graphics.h
index e080e08f58..85299d4873 100644
--- a/engines/tinsel/graphics.h
+++ b/engines/tinsel/graphics.h
@@ -43,31 +43,6 @@ struct PALQ;
#define SCRN_CENTRE_X ((SCREEN_WIDTH - 1) / 2) // screen centre x
#define SCRN_CENTRE_Y ((SCREEN_HEIGHT - 1) / 2) // screen centre y
-/** Class representing either a buffered surface or the physical screen. */
-class Surface : public Graphics::Surface {
-private:
- bool _isScreen;
-public:
- Surface(bool isScreen = false) { _isScreen = isScreen; }
- Surface(int Width, int Height) { create(Width, Height, 1); _isScreen = false; }
-
- // Surface methods
- byte *getData() { return (byte *)pixels; }
- byte *getBasePtr(int x, int y) { return (byte *)Graphics::Surface::getBasePtr(x, y); }
-
- void update() {
- if (_isScreen) {
- g_system->copyRectToScreen((const byte *)pixels, pitch, 0, 0, w, h);
- g_system->updateScreen();
- }
- }
- void updateRect(const Common::Rect &r) {
- g_system->copyRectToScreen(getBasePtr(r.left, r.top), pitch, r.left, r.top, r.width(), r.height());
- g_system->updateScreen();
- }
-
-};
-
/** draw object structure - only used when drawing objects */
struct DRAWOBJECT {
char *charBase; // character set base address
@@ -92,7 +67,7 @@ struct DRAWOBJECT {
|* Function Prototypes *|
\*----------------------------------------------------------------------*/
-void ClearScreen(uint32 val);
+void ClearScreen();
void DrawObject(DRAWOBJECT *pObj);
// called to update a rectangle on the video screen from a video page
diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index 946c9338ba..1f56385283 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -54,6 +54,7 @@
#include "tinsel/music.h"
#include "tinsel/object.h"
#include "tinsel/pid.h"
+#include "tinsel/polygons.h"
#include "tinsel/savescn.h"
#include "tinsel/scn.h"
#include "tinsel/serializer.h"
@@ -386,7 +387,7 @@ void MouseProcess(CORO_PARAM, const void *) {
static void MasterScriptProcess(CORO_PARAM, const void *) {
// COROUTINE
CORO_BEGIN_CONTEXT;
- PINT_CONTEXT pic;
+ INT_CONTEXT *pic;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
@@ -463,13 +464,13 @@ void syncSCdata(Serializer &s) {
static void RestoredProcess(CORO_PARAM, const void *param) {
// COROUTINE
CORO_BEGIN_CONTEXT;
- PINT_CONTEXT pic;
+ INT_CONTEXT *pic;
CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx);
// get the stuff copied to process when it was created
- _ctx->pic = *((PINT_CONTEXT *)param);
+ _ctx->pic = *((INT_CONTEXT **)param);
_ctx->pic = RestoreInterpretContext(_ctx->pic);
CORO_INVOKE_1(Interpret, _ctx->pic);
@@ -477,11 +478,11 @@ static void RestoredProcess(CORO_PARAM, const void *param) {
CORO_END_CODE;
}
-void RestoreProcess(PINT_CONTEXT pic) {
+void RestoreProcess(INT_CONTEXT *pic) {
g_scheduler->createProcess(PID_TCODE, RestoredProcess, &pic, sizeof(pic));
}
-void RestoreMasterProcess(PINT_CONTEXT pic) {
+void RestoreMasterProcess(INT_CONTEXT *pic) {
g_scheduler->createProcess(PID_MASTER_SCR, RestoredProcess, &pic, sizeof(pic));
}
@@ -516,7 +517,7 @@ void ChangeScene() {
break;
}
} else if (--CountOut == 0) {
- ClearScreen(0L);
+ ClearScreen();
NewScene(NextScene.scene, NextScene.entry);
NextScene.scene = 0;
@@ -599,7 +600,7 @@ static const GameSettings tinselSettings[] = {
};
TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) :
- Engine(syst), _gameDescription(gameDesc), _screenSurface(true) {
+ Engine(syst), _gameDescription(gameDesc) {
_vm = this;
// Setup mixer
diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h
index 6b838924e8..9ffadfe8c1 100644
--- a/engines/tinsel/tinsel.h
+++ b/engines/tinsel/tinsel.h
@@ -76,7 +76,7 @@ class TinselEngine : public ::Engine {
int _gameId;
Common::KeyState _keyPressed;
Common::RandomSource _random;
- Surface _screenSurface;
+ Graphics::Surface _screenSurface;
Common::Point _mousePos;
uint8 _dosPlayerDir;
Console *_console;
@@ -123,7 +123,7 @@ public:
Common::String getSavegamePattern() const;
Common::String getSavegameFilename(int16 saveNum) const;
Common::SaveFileManager *getSaveFileMan() { return _saveFileMan; }
- Surface &screen() { return _screenSurface; }
+ Graphics::Surface &screen() { return _screenSurface; }
Common::Point getMousePosition() const { return _mousePos; }
void setMousePosition(const Common::Point &pt) {