[Scummvm-cvs-logs] CVS: scummvm/bs2 anims.cpp,1.31,1.32 build_display.cpp,1.33,1.34 console.cpp,1.18,1.19 controls.cpp,1.31,1.32 function.cpp,1.25,1.26 icons.cpp,1.13,1.14 layers.cpp,1.12,1.13 logic.cpp,1.20,1.21 maketext.cpp,1.22,1.23 mem_view.cpp,1.16,1.17 mouse.cpp,1.26,1.27 resman.cpp,1.53,1.54 speech.cpp,1.30,1.31 startup.cpp,1.21,1.22 sword2.cpp,1.58,1.59 sword2.h,1.21,1.22 walker.cpp,1.15,1.16
Torbj?rn Andersson
eriktorbjorn at users.sourceforge.net
Tue Oct 14 23:41:03 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v5.cpp,1.199,1.200 scummvm.cpp,2.447,2.448
- Next message: [Scummvm-cvs-logs] CVS: scummvm/bs2/driver _mouse.cpp,1.23,1.24 _mouse.h,1.4,1.5 d_draw.cpp,1.37,1.38 d_draw.h,1.10,1.11 d_sound.cpp,1.75,1.76 driver96.h,1.55,1.56 menu.cpp,1.18,1.19 palette.cpp,1.21,1.22 palette.h,1.6,1.7 rdwin.cpp,1.32,1.33 rdwin.h,1.5,1.6 render.cpp,1.35,1.36 render.h,1.9,1.10 sprite.cpp,1.28,1.29
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/bs2
In directory sc8-pr-cvs1:/tmp/cvs-serv26547
Modified Files:
anims.cpp build_display.cpp console.cpp controls.cpp
function.cpp icons.cpp layers.cpp logic.cpp maketext.cpp
mem_view.cpp mouse.cpp resman.cpp speech.cpp startup.cpp
sword2.cpp sword2.h walker.cpp
Log Message:
Dumped most of the remaining "driver" code into a new "Display" class. This
touches a lot of the code, of course, and adds yet another global variable
(temporarily, I hope), but everything still seems to work.
Knock on wood.
Index: anims.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/anims.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- anims.cpp 12 Oct 2003 13:04:46 -0000 1.31
+++ anims.cpp 15 Oct 2003 06:40:31 -0000 1.32
@@ -776,14 +776,14 @@
// now clear the screen in case the Sequence was quitted (using ESC)
// rather than fading down to black
- EraseBackBuffer();
+ g_display->clearScene();
// zero the entire palette in case we're about to fade up!
- _palEntry pal[256];
+ _palEntry pal[256];
memset(pal, 0, 256 * sizeof(_palEntry));
- BS2_SetPalette(0, 256, (uint8 *) pal, RDPAL_INSTANT);
+ g_display->setPalette(0, 256, (uint8 *) pal, RDPAL_INSTANT);
debug(5, "FN_play_sequence FINISHED");
Index: build_display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/build_display.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- build_display.cpp 11 Oct 2003 12:26:52 -0000 1.33
+++ build_display.cpp 15 Oct 2003 06:40:31 -0000 1.34
@@ -108,7 +108,6 @@
// ---------------------------------------------------------------------------
void Build_display(void) {
- bool end;
#ifdef _SWORD2_DEBUG
uint8 pal[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0 };
#endif
@@ -133,25 +132,21 @@
// there is a valid screen to run
if (!console_status && this_screen.background_layer_id) {
// set the scroll position
- SetScrollTarget(this_screen.scroll_offset_x, this_screen.scroll_offset_y);
+ g_display->setScrollTarget(this_screen.scroll_offset_x, this_screen.scroll_offset_y);
// increment the mouse frame
- AnimateMouse();
+ g_display->animateMouse();
- StartRenderCycle();
+ g_display->startRenderCycle();
while (1) {
- // START OF RENDER CYCLE
-
- // ---------------------------------------------------
// clear the back buffer, before building up the new
// screen from the back forwards
// FIXME: I'm not convinced that this is needed. Isn't
// the whole screen redrawn each time?
- // EraseBackBuffer();
+ // g_display->clearScene();
- // ---------------------------------------------------
// first background parallax + related anims
// open the screen resource
@@ -159,7 +154,7 @@
screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader));
if (screenLayerTable->bg_parallax[0]) {
- RenderParallax(FetchBackgroundParallaxLayer(file, 0), 0);
+ g_display->renderParallax(FetchBackgroundParallaxLayer(file, 0), 0);
// release the screen resource before cacheing
// the sprites
res_man.close(this_screen.background_layer_id);
@@ -169,7 +164,6 @@
res_man.close(this_screen.background_layer_id);
}
- // ---------------------------------------------------
// second background parallax + related anims
// open the screen resource
@@ -177,7 +171,7 @@
screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader));
if (screenLayerTable->bg_parallax[1]) {
- RenderParallax(FetchBackgroundParallaxLayer(file, 1), 1);
+ g_display->renderParallax(FetchBackgroundParallaxLayer(file, 1), 1);
// release the screen resource before cacheing
// the sprites
res_man.close(this_screen.background_layer_id);
@@ -187,16 +181,14 @@
res_man.close(this_screen.background_layer_id);
}
- // ---------------------------------------------------
// normal backround layer (just the one!)
// open the screen resource
file = res_man.open(this_screen.background_layer_id);
- RenderParallax(FetchBackgroundLayer(file), 2);
+ g_display->renderParallax(FetchBackgroundLayer(file), 2);
// release the screen resource
res_man.close(this_screen.background_layer_id);
- // ---------------------------------------------------
// sprites & layers
Send_back_frames(); // background sprites
@@ -204,7 +196,6 @@
Send_sort_frames(); // sorted sprites & layers
Send_fore_frames(); // foreground sprites
- // ---------------------------------------------------
// first foreground parallax + related anims
// open the screen resource
@@ -212,7 +203,7 @@
screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader));
if (screenLayerTable->fg_parallax[0]) {
- RenderParallax(FetchForegroundParallaxLayer(file, 0), 3);
+ g_display->renderParallax(FetchForegroundParallaxLayer(file, 0), 3);
// release the screen resource before cacheing
// the sprites
res_man.close(this_screen.background_layer_id);
@@ -222,7 +213,6 @@
res_man.close(this_screen.background_layer_id);
}
- //----------------------------------------------------
// second foreground parallax + related anims
// open the screen resource
@@ -230,7 +220,7 @@
screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader));
if (screenLayerTable->fg_parallax[1]) {
- RenderParallax(FetchForegroundParallaxLayer(file, 1), 4);
+ g_display->renderParallax(FetchForegroundParallaxLayer(file, 1), 4);
// release the screen resource before cacheing
// the sprites
res_man.close(this_screen.background_layer_id);
@@ -240,29 +230,24 @@
res_man.close(this_screen.background_layer_id);
}
- // ---------------------------------------------------
// walkgrid, mouse & player markers & mouse area
// rectangle
Draw_debug_graphics();
- // ---------------------------------------------------
// text blocks
// speech blocks and headup debug text
fontRenderer.printTextBlocs();
- // ---------------------------------------------------
// menu bar & icons
- ProcessMenu();
+ g_display->processMenu();
- // ---------------------------------------------------
// ready - blit to screen
- ServiceWindows();
+ g_display->updateDisplay();
- //----------------------------------------------------
// update our fps reading
frameCount++;
@@ -273,20 +258,16 @@
cycleTime = SVM_timeGetTime() + 1000;
}
- // ---------------------------------------------------
- // check if we've got time to render the screen again
+ // Check if we've got time to render the screen again
// this cycle (so drivers can smooth out the scrolling
// in between normal game cycles)
-
- EndRenderCycle(&end);
-
- // if we haven't got time to render again this cycle,
+ //
+ // If we haven't got time to render again this cycle,
// drop out of 'render cycle' while-loop
- if (end)
- break;
- // ---------------------------------------------------
- } // END OF RENDER CYCLE
+ if (g_display->endRenderCycle())
+ break;
+ }
}
#ifdef _SWORD2_DEBUG
else if (console_status) {
@@ -302,13 +283,13 @@
spriteInfo.data = console_sprite->ad;
spriteInfo.colourTable = 0;
- rv = DrawSprite(&spriteInfo);
+ rv = g_display->drawSprite(&spriteInfo);
if (rv)
error("Driver Error %.8x (drawing console)", rv);
} else{
StartConsole();
// force the palette
- BS2_SetPalette(0, 3, pal, RDPAL_INSTANT);
+ g_display->setPalette(0, 3, pal, RDPAL_INSTANT);
Print_to_console("no valid screen?");
}
#endif
@@ -329,24 +310,24 @@
warning("DisplayMsg: %s", (char *) text);
- if (GetFadeStatus() != RDFADE_BLACK) {
- FadeDown((float) 0.75);
- WaitForFade();
+ if (g_display->getFadeStatus() != RDFADE_BLACK) {
+ g_display->fadeDown();
+ g_display->waitForFade();
}
Set_mouse(0);
Set_luggage(0);
- CloseMenuImmediately();
- EraseBackBuffer();
+ g_display->closeMenuImmediately();
+ g_display->clearScene();
text_spr = fontRenderer.makeTextSprite(text, 640, 187, g_sword2->_speechFontId);
frame = (_frameHeader *) text_spr->ad;
- spriteInfo.x = screenWide / 2 - frame->width / 2;
+ spriteInfo.x = g_display->_screenWide / 2 - frame->width / 2;
if (!time)
- spriteInfo.y = screenDeep / 2 - frame->height / 2 - RDMENU_MENUDEEP;
+ spriteInfo.y = g_display->_screenDeep / 2 - frame->height / 2 - RDMENU_MENUDEEP;
else
spriteInfo.y = 400 - frame->height;
spriteInfo.w = frame->width;
@@ -359,33 +340,34 @@
spriteInfo.data = text_spr->ad + sizeof(_frameHeader);
spriteInfo.colourTable = 0;
- rv = DrawSprite(&spriteInfo);
+ rv = g_display->drawSprite(&spriteInfo);
if (rv)
error("Driver Error %.8x (in DisplayMsg)", rv);
- memcpy((char *) oldPal, (char *) palCopy, 256 * sizeof(_palEntry));
+ memcpy((char *) oldPal, (char *) g_display->_palCopy, 256 * sizeof(_palEntry));
memset(pal, 0, 256 * sizeof(_palEntry));
pal[187].red = 255;
pal[187].green = 255;
pal[187].blue = 255;
- BS2_SetPalette(0, 256, (uint8 *) pal, RDPAL_FADE);
+ g_display->setPalette(0, 256, (uint8 *) pal, RDPAL_FADE);
- FadeUp((float) 0.75);
+ g_display->fadeUp();
memory.freeMemory(text_spr);
- WaitForFade();
+ g_display->waitForFade();
uint32 targetTime = SVM_timeGetTime() + (time * 1000);
- rv = DrawSprite(&spriteInfo); // Keep the message there even when the user task swaps.
+ // Keep the message there even when the user task swaps.
+ rv = g_display->drawSprite(&spriteInfo);
if (rv)
error("Driver Error %.8x (in DisplayMsg)", rv);
sleepUntil(targetTime);
- BS2_SetPalette(0, 256, (uint8 *) oldPal, RDPAL_FADE);
+ g_display->setPalette(0, 256, (uint8 *) oldPal, RDPAL_FADE);
}
// ---------------------------------------------------------------------------
@@ -394,13 +376,13 @@
//
void RemoveMsg(void) {
- FadeDown((float) 0.75);
+ g_display->fadeDown();
- WaitForFade();
+ g_display->waitForFade();
- EraseBackBuffer();
+ g_display->clearScene();
- // FadeUp((float) 0.75);
+ // g_display->fadeUp();
// removed by JEL (08oct97) to prevent "eye" smacker corruption when
// restarting game from CD2 and also to prevent palette flicker when
// restoring game to a different CD since the "insert CD" message uses
@@ -516,7 +498,7 @@
#endif
//------------------------------------------
- rv = DrawSprite(&spriteInfo);
+ rv = g_display->drawSprite(&spriteInfo);
if (rv)
error("Driver Error %.8x in Process_layer(%d)", rv, layer_number);
@@ -559,7 +541,7 @@
// but the same compression can be decompressed using the
// RLE256 routines!
- // NOTE: If this restriction refers to DrawSprite(), I don't
+ // NOTE: If this restriction refers to drawSprite(), I don't
// think we have it any more. But I'm not sure.
if (build_unit->scale || anim_head->blend || build_unit->shadingFlag)
@@ -649,7 +631,7 @@
// }
// #endif
- rv = DrawSprite(&spriteInfo);
+ rv = g_display->drawSprite(&spriteInfo);
if (rv)
error("Driver Error %.8x with sprite %s (%d) in Process_image",
rv, FetchObjectName(build_unit->anim_resource),
@@ -933,14 +915,14 @@
// if the screen is still fading down then wait for black - could
// happen when everythings cached into a large memory model
- WaitForFade();
+ g_display->waitForFade();
// open the screen file
screenFile = res_man.open(this_screen.background_layer_id);
- UpdatePaletteMatchTable((uint8 *) FetchPaletteMatchTable(screenFile));
+ g_display->updatePaletteMatchTable((uint8 *) FetchPaletteMatchTable(screenFile));
- BS2_SetPalette(0, 256, FetchPalette(screenFile), RDPAL_FADE);
+ g_display->setPalette(0, 256, FetchPalette(screenFile), RDPAL_FADE);
// indicating that it's a screen palette
lastPaletteRes = 0;
@@ -949,8 +931,7 @@
res_man.close(this_screen.background_layer_id);
// start fade up
- // FadeUp((float) 1.75);
- FadeUp((float) 0.75);
+ g_display->fadeUp();
// reset
this_screen.new_palette = 0;
@@ -980,17 +961,17 @@
// NONE means up! can only be called when screen is fully faded up -
// multiple calls wont have strange effects
- if (GetFadeStatus() == RDFADE_NONE)
- FadeDown((float) 0.75);
+ if (g_display->getFadeStatus() == RDFADE_NONE)
+ g_display->fadeDown();
return IR_CONT;
}
int32 FN_fade_up(int32 *params) {
- WaitForFade();
+ g_display->waitForFade();
- if (GetFadeStatus() == RDFADE_BLACK)
- FadeUp((float) 0.75);
+ if (g_display->getFadeStatus() == RDFADE_BLACK)
+ g_display->fadeUp();
return IR_CONT;
}
@@ -1076,9 +1057,9 @@
file[3] = 0;
// not yet in separate palette files
- // UpdatePaletteMatchTable(file + (256 * 4));
+ // g_display->updatePaletteMatchTable(file + (256 * 4));
- BS2_SetPalette(0, 256, file, RDPAL_INSTANT);
+ g_display->setPalette(0, 256, file, RDPAL_INSTANT);
if (palRes != CONTROL_PANEL_PALETTE) { // (James 03sep97)
// indicating that it's a separate palette resource
@@ -1092,9 +1073,9 @@
if (this_screen.background_layer_id) {
// open the screen file
file = res_man.open(this_screen.background_layer_id);
- UpdatePaletteMatchTable((uint8 *) FetchPaletteMatchTable(file));
+ g_display->updatePaletteMatchTable((uint8 *) FetchPaletteMatchTable(file));
- BS2_SetPalette(0, 256, FetchPalette(file), RDPAL_INSTANT);
+ g_display->setPalette(0, 256, FetchPalette(file), RDPAL_INSTANT);
// indicating that it's a screen palette
lastPaletteRes = 0;
@@ -1115,7 +1096,7 @@
// if last screen was using a shading mask (see below)
if (this_screen.mask_flag) {
- rv = CloseLightMask();
+ rv = g_display->closeLightMask();
if (rv)
error("Driver Error %.8x [%s line %u]", rv);
Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/console.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- console.cpp 11 Oct 2003 12:26:53 -0000 1.18
+++ console.cpp 15 Oct 2003 06:40:31 -0000 1.19
@@ -164,7 +164,7 @@
con_width = screenWide; //max across
// Force a palatte for the console.
- BS2_SetPalette(CON_PEN, 1, white, RDPAL_INSTANT);
+ g_display->setPalette(CON_PEN, 1, white, RDPAL_INSTANT);
console_sprite = memory.alloc(con_width * (CON_lines * con_chr_height), MEM_float, UID_con_sprite);
@@ -213,7 +213,7 @@
StartConsole();
while (1) {
- ServiceWindows();
+ g_display->updateDisplay();
if (breakOut)
break;
@@ -460,7 +460,7 @@
case 18: // S (same as START)
Con_start(&input[1][0]);
// force the palette
- BS2_SetPalette(187, 1, pal, RDPAL_INSTANT);
+ g_display->setPalette(187, 1, pal, RDPAL_INSTANT);
return 0;
case 9: // INFO
displayDebugText = 1 - displayDebugText;
@@ -729,7 +729,7 @@
Build_display();
do {
- ServiceWindows();
+ g_display->updateDisplay();
} while (!KeyWaiting());
ReadKey(&c);
@@ -803,8 +803,8 @@
char buf[150];
uint8 white[4] = { 255, 255, 255, 0 };
- // set text colour in case screen is faded down! (James 05mar97)
- BS2_SetPalette(CON_PEN, 1, white, RDPAL_INSTANT);
+ // set text colour in case screen is faded down!
+ g_display->setPalette(CON_PEN, 1, white, RDPAL_INSTANT);
va_start(arg_ptr,format);
_vsnprintf(buf, 150, format, arg_ptr);
@@ -912,7 +912,7 @@
Build_display();
do {
- ServiceWindows();
+ g_display->updateDisplay();
} while (!KeyWaiting());
ReadKey(&c);
Index: controls.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/controls.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- controls.cpp 12 Oct 2003 19:10:15 -0000 1.31
+++ controls.cpp 15 Oct 2003 06:40:31 -0000 1.32
@@ -74,7 +74,7 @@
sprite.data = (uint8 *) (head + 1);
sprite.w = head->width;
sprite.h = head->height;
- CreateSurface(&sprite, &_glyph[i]._data);
+ g_display->createSurface(&sprite, &_glyph[i]._data);
_glyph[i]._width = head->width;
_glyph[i]._height = head->height;
}
@@ -84,7 +84,7 @@
~FontRendererGui() {
for (int i = 0; i < SIZE_OF_CHAR_SET; i++)
- DeleteSurface(_glyph[i]._data);
+ g_display->deleteSurface(_glyph[i]._data);
}
void fetchText(int textId, char *buf) {
@@ -143,7 +143,7 @@
sprite.w = _glyph[text[i] - 32]._width;
sprite.h = _glyph[text[i] - 32]._height;
- DrawSurface(&sprite, _glyph[text[i] - 32]._data);
+ g_display->drawSurface(&sprite, _glyph[text[i] - 32]._data);
sprite.x += (_glyph[(int) text[i] - 32]._width - CHARACTER_OVERLAP);
}
@@ -186,7 +186,7 @@
virtual ~Widget() {
for (int i = 0; i < _numStates; i++) {
if (_surfaces[i]._original)
- DeleteSurface(_surfaces[i]._surface);
+ g_display->deleteSurface(_surfaces[i]._surface);
}
free(_sprites);
free(_surfaces);
@@ -228,7 +228,7 @@
}
virtual void paint(Common::Rect *clipRect = NULL) {
- DrawSurface(&_sprites[_state], _surfaces[_state]._surface, clipRect);
+ g_display->drawSurface(&_sprites[_state], _surfaces[_state]._surface, clipRect);
}
virtual void onMouseEnter() {}
@@ -291,7 +291,7 @@
// Points to just after frame header, ie. start of sprite data
_sprites[state].data = (uint8 *) (frame_head + 1);
- CreateSurface(&_sprites[state], &_surfaces[state]._surface);
+ g_display->createSurface(&_sprites[state], &_surfaces[state]._surface);
_surfaces[state]._original = true;
// Release the anim resource
@@ -339,7 +339,7 @@
virtual void onAction(Widget *widget, int result = 0) {}
virtual void paint() {
- EraseBackBuffer();
+ g_display->clearScene();
for (int i = 0; i < _numWidgets; i++)
_widgets[i]->paint();
}
@@ -362,12 +362,11 @@
while (!_finish) {
// So that the menu icons will reach their full size
- ProcessMenu();
-
- ServiceWindows();
+ g_display->processMenu();
+ g_display->updateDisplay();
- int16 newMouseX = mousex;
- int16 newMouseY = mousey + 40;
+ int16 newMouseX = g_display->_mouseX;
+ int16 newMouseY = g_display->_mouseY + 40;
_mouseEvent *me = MouseEvent();
_keyboardEvent ke;
@@ -388,7 +387,7 @@
_widgets[i]->onMouseEnter();
if (oldHit && !newHit)
_widgets[i]->onMouseExit();
- if (mousex != oldMouseX || mousey != oldMouseY)
+ if (g_display->_mouseX != oldMouseX || g_display->_mouseY != oldMouseY)
_widgets[i]->onMouseMove(newMouseX, newMouseY);
if (me) {
@@ -788,8 +787,8 @@
_musicSlider->setValue(g_sound->getMusicVolume());
_speechSlider->setValue(g_sound->getSpeechVolume());
_fxSlider->setValue(g_sound->getFxVolume());
- _gfxSlider->setValue(GetRenderType());
- _gfxPreview->setState(GetRenderType());
+ _gfxSlider->setValue(g_display->getRenderLevel());
+ _gfxPreview->setState(g_display->getRenderLevel());
}
~OptionsDialog() {
@@ -901,7 +900,7 @@
buff[3] = g_sound->isMusicMute();
buff[4] = g_sound->isSpeechMute();
buff[5] = g_sound->isFxMute();
- buff[6] = GetRenderType();
+ buff[6] = g_display->getRenderLevel();
buff[7] = gui._subtitles;
buff[8] = gui._pointerTextSelected;
buff[9] = gui._stereoReversed;
@@ -1352,7 +1351,7 @@
while (1) {
_mouseEvent *me;
- ServiceWindows();
+ g_display->updateDisplay();
if (KeyWaiting()) {
_keyboardEvent ke;
@@ -1396,7 +1395,6 @@
// close engine systems down
Close_game();
- CloseAppWindow();
exit(0);
}
@@ -1410,13 +1408,13 @@
return;
}
- // Stop music instantly! (James 22aug97)
+ // Stop music instantly!
Kill_music();
//in case we were dead - well we're not anymore!
DEAD = 0;
- EraseBackBuffer();
+ g_display->clearScene();
// restart the game
// clear all memory and reset the globals
@@ -1450,9 +1448,9 @@
// FN_register_frame)
Reset_mouse_list();
- CloseMenuImmediately();
+ g_display->closeMenuImmediately();
- // FOR THE DEMO - FORCE THE SCROLLING TO BE RESET! (James29may97)
+ // FOR THE DEMO - FORCE THE SCROLLING TO BE RESET!
// - this is taken from FN_init_background
// switch on scrolling (2 means first time on screen)
@@ -1525,33 +1523,7 @@
}
void Gui::updateGraphicsLevel(uint8 newLevel) {
- switch (newLevel) {
- case 0:
- // Lowest setting: no graphics fx
- ClearTransFx();
- ClearShadowFx();
- ClearBltFx();
- break;
- case 1:
- // Medium-low setting: transparency-blending
- SetTransFx();
- ClearShadowFx();
- ClearBltFx();
- break;
- case 2:
- // Medium-high setting: transparency-blending + shading
- SetTransFx();
- SetShadowFx();
- ClearBltFx();
- break;
- case 3:
- // Highest setting: transparency-blending + shading +
- // edge-blending + improved stretching
- SetTransFx();
- SetShadowFx();
- SetBltFx();
- break;
- }
+ g_display->setRenderLevel(newLevel);
// update our global variable - which needs to be checked when dimming
// the palette in PauseGame() in sword2.cpp (since palette-matching
Index: function.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/function.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- function.cpp 8 Oct 2003 18:02:53 -0000 1.25
+++ function.cpp 15 Oct 2003 06:40:31 -0000 1.26
@@ -31,7 +31,7 @@
#include "bs2/protocol.h"
#include "bs2/resman.h"
#include "bs2/sound.h"
-#include "bs2/sword2.h" // for CloseGame()
+#include "bs2/sword2.h"
namespace Sword2 {
@@ -269,25 +269,25 @@
// what colour?
switch (params[0]) {
case WHITE:
- BS2_SetPalette(0, 1, white, RDPAL_INSTANT);
+ g_display->setPalette(0, 1, white, RDPAL_INSTANT);
break;
case RED:
- BS2_SetPalette(0, 1, red, RDPAL_INSTANT);
+ g_display->setPalette(0, 1, red, RDPAL_INSTANT);
break;
case GREEN:
- BS2_SetPalette(0, 1, green, RDPAL_INSTANT);
+ g_display->setPalette(0, 1, green, RDPAL_INSTANT);
break;
case BLUE:
- BS2_SetPalette(0, 1, blue, RDPAL_INSTANT);
+ g_display->setPalette(0, 1, blue, RDPAL_INSTANT);
break;
}
// There used to be a busy-wait loop here, so I don't know how long
// the delay was meant to be. Probably doesn't matter much.
- ServiceWindows();
+ g_display->updateDisplay();
g_system->delay_msecs(250);
- BS2_SetPalette(0, 1, black, RDPAL_INSTANT);
+ g_display->setPalette(0, 1, black, RDPAL_INSTANT);
#endif
return IR_CONT;
@@ -305,19 +305,19 @@
// what colour?
switch (params[0]) {
case BLACK:
- BS2_SetPalette(0, 1, black, RDPAL_INSTANT);
+ g_display->setPalette(0, 1, black, RDPAL_INSTANT);
break;
case WHITE:
- BS2_SetPalette(0, 1, white, RDPAL_INSTANT);
+ g_display->setPalette(0, 1, white, RDPAL_INSTANT);
break;
case RED:
- BS2_SetPalette(0, 1, red, RDPAL_INSTANT);
+ g_display->setPalette(0, 1, red, RDPAL_INSTANT);
break;
case GREEN:
- BS2_SetPalette(0, 1, green, RDPAL_INSTANT);
+ g_display->setPalette(0, 1, green, RDPAL_INSTANT);
break;
case BLUE:
- BS2_SetPalette(0, 1, blue, RDPAL_INSTANT);
+ g_display->setPalette(0, 1, blue, RDPAL_INSTANT);
break;
}
#endif
@@ -396,17 +396,17 @@
g_sound->muteSpeech(1);
g_sound->stopMusic();
- memcpy(oldPal, palCopy, 1024);
+ memcpy(oldPal, g_display->_palCopy, 1024);
memset(tmpPal, 0, 1024);
- WaitForFade();
- FadeDown(0.75);
- WaitForFade();
+ g_display->waitForFade();
+ g_display->fadeDown();
+ g_display->waitForFade();
tmpPal[4] = 255;
tmpPal[5] = 255;
tmpPal[6] = 255;
- BS2_SetPalette(0, 256, tmpPal, RDPAL_INSTANT);
+ g_display->setPalette(0, 256, tmpPal, RDPAL_INSTANT);
// Play the credits music. Is it enough with just one
// repetition of it?
@@ -419,17 +419,17 @@
debug(0, "Credits music length: ~%d ms", music_length);
- CloseMenuImmediately();
+ g_display->closeMenuImmediately();
while (g_sound->musicTimeRemaining()) {
- EraseBackBuffer();
- SetNeedRedraw();
+ g_display->clearScene();
+ g_display->setNeedFullRedraw();
// FIXME: Draw the credits text. The actual text
// messages are stored in credits.clu, and I'm guessing
// that credits.bmp or font.clu may be the font.
- ServiceWindows();
+ g_display->updateDisplay();
_keyboardEvent ke;
@@ -442,11 +442,11 @@
FN_stop_music(NULL);
g_sound->restoreMusicState();
- BS2_SetPalette(0, 256, oldPal, RDPAL_FADE);
- FadeUp(0.75);
- ServiceWindows();
+ g_display->setPalette(0, 256, oldPal, RDPAL_FADE);
+ g_display->fadeUp();
+ g_display->updateDisplay();
Build_display();
- WaitForFade();
+ g_display->waitForFade();
g_sound->muteFx(0);
g_sound->muteSpeech(0);
@@ -457,7 +457,6 @@
if (g_sword2->_gameId == GID_SWORD2_DEMO) {
Close_game(); // close engine systems down
- CloseAppWindow();
exit(0); // quit the game
}
Index: icons.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/icons.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- icons.cpp 9 Oct 2003 06:57:35 -0000 1.13
+++ icons.cpp 15 Oct 2003 06:40:31 -0000 1.14
@@ -18,6 +18,7 @@
*/
#include "stdafx.h"
+#include "bs2/sword2.h"
#include "bs2/driver/driver96.h"
#include "bs2/defs.h"
#include "bs2/icons.h"
@@ -207,23 +208,22 @@
if (icon_coloured)
icon += (RDMENU_ICONWIDE * RDMENU_ICONDEEP);
- SetMenuIcon(RDMENU_BOTTOM, j, icon);
+ g_display->setMenuIcon(RDMENU_BOTTOM, j, icon);
res_man.close(res);
} else {
// no icon here
- SetMenuIcon(RDMENU_BOTTOM, j, NULL);
+ g_display->setMenuIcon(RDMENU_BOTTOM, j, NULL);
debug(5, " NULL for %d", j);
}
}
- ShowMenu(RDMENU_BOTTOM);
+ g_display->showMenu(RDMENU_BOTTOM);
}
void Build_system_menu(void) {
// start a fresh top system menu
uint8 *icon;
- int j;
uint32 icon_list[5] = {
OPTIONS_ICON,
@@ -236,7 +236,7 @@
// build them all high in full colour - when one is clicked on all the
// rest will grey out
- for (j = 0; j < ARRAYSIZE(icon_list); j++) {
+ for (int j = 0; j < ARRAYSIZE(icon_list); j++) {
icon = res_man.open(icon_list[j]) + sizeof(_standardHeader);
// The only case when an icon is grayed is when the player
@@ -245,11 +245,11 @@
if (!DEAD || icon_list[j] != SAVE_ICON)
icon += (RDMENU_ICONWIDE * RDMENU_ICONDEEP);
- SetMenuIcon(RDMENU_TOP, j, icon);
+ g_display->setMenuIcon(RDMENU_TOP, j, icon);
res_man.close(icon_list[j]);
}
- ShowMenu(RDMENU_TOP);
+ g_display->showMenu(RDMENU_TOP);
}
} // End of namespace Sword2
Index: layers.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/layers.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- layers.cpp 7 Oct 2003 07:07:46 -0000 1.12
+++ layers.cpp 15 Oct 2003 06:40:31 -0000 1.13
@@ -26,6 +26,7 @@
// up to 2 foreground parallax layers
#include "stdafx.h"
+#include "bs2/sword2.h"
#include "bs2/build_display.h"
#include "bs2/debug.h"
#include "bs2/header.h"
@@ -67,11 +68,11 @@
#endif
// if the screen is still fading down then wait for black
- WaitForFade();
+ g_display->waitForFade();
// if last screen was using a shading mask (see below)
if (this_screen.mask_flag) {
- rv = CloseLightMask();
+ rv = g_display->closeLightMask();
if (rv)
error("Driver Error %.8x", rv);
}
@@ -80,7 +81,7 @@
// for drivers: close the previous screen if one is open
if (this_screen.background_layer_id)
- CloseBackgroundLayer();
+ g_display->closeBackgroundLayer();
this_screen.background_layer_id = params[0]; // set the res id
this_screen.new_palette = params[1]; // yes or no - palette is taken from layer file
@@ -102,7 +103,7 @@
debug(5, "res test layers=%d width=%d depth=%d", screen_head->noLayers, screen_head->width, screen_head->height);
//initialise the driver back buffer
- SetLocationMetrics(screen_head->width, screen_head->height);
+ g_display->setLocationMetrics(screen_head->width, screen_head->height);
if (screen_head->noLayers) {
for (int i = 0; i < screen_head->noLayers; i++) {
@@ -124,7 +125,7 @@
// using the screen size setup the scrolling variables
// if layer is larger than physical screen
- if (screen_head->width > screenWide || screen_head->height > screenDeep) {
+ if (screen_head->width > g_display->_screenWide || screen_head->height > g_display->_screenDeep) {
// switch on scrolling (2 means first time on screen)
this_screen.scroll_flag = 2;
@@ -139,9 +140,9 @@
// calc max allowed offsets (to prevent scrolling off edge) -
// MOVE TO NEW_SCREEN in GTM_CORE.C !!
// NB. min scroll offsets are both zero
- this_screen.max_scroll_offset_x = screen_head->width-screenWide;
+ this_screen.max_scroll_offset_x = screen_head->width - g_display->_screenWide;
// 'screenDeep' includes the menu's, so take away 80 pixels
- this_screen.max_scroll_offset_y = screen_head->height - (screenDeep - (RDMENU_MENUDEEP * 2));
+ this_screen.max_scroll_offset_y = screen_head->height - (g_display->_screenDeep - (RDMENU_MENUDEEP * 2));
} else {
// layer fits on physical screen - scrolling not required
this_screen.scroll_flag = 0; // switch off scrolling
@@ -151,7 +152,7 @@
// no inter-cycle scroll between new screens (see setScrollTarget in
// build display)
- ResetRenderEngine();
+ g_display->resetRenderEngine();
// these are the physical screen coords where the system
// will try to maintain George's actual feet coords
@@ -175,7 +176,7 @@
spriteInfo.data = FetchShadingMask(file);
spriteInfo.colourTable = 0;
- rv = OpenLightMask(&spriteInfo);
+ rv = g_display->openLightMask(&spriteInfo);
if (rv)
error("Driver Error %.8x", rv);
@@ -219,22 +220,22 @@
for (i = 0; i < 2; i++) {
if (screenLayerTable->bg_parallax[i])
- InitialiseBackgroundLayer(FetchBackgroundParallaxLayer(file, i));
+ g_display->initialiseBackgroundLayer(FetchBackgroundParallaxLayer(file, i));
else
- InitialiseBackgroundLayer(NULL);
+ g_display->initialiseBackgroundLayer(NULL);
}
// Normal backround layer
- InitialiseBackgroundLayer(FetchBackgroundLayer(file));
+ g_display->initialiseBackgroundLayer(FetchBackgroundLayer(file));
// Foreground parallax layers
for (i = 0; i < 2; i++) {
if (screenLayerTable->fg_parallax[i])
- InitialiseBackgroundLayer(FetchForegroundParallaxLayer(file, i));
+ g_display->initialiseBackgroundLayer(FetchForegroundParallaxLayer(file, i));
else
- InitialiseBackgroundLayer(NULL);
+ g_display->initialiseBackgroundLayer(NULL);
}
// close the screen file
Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/logic.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- logic.cpp 12 Oct 2003 14:40:03 -0000 1.20
+++ logic.cpp 15 Oct 2003 06:40:31 -0000 1.21
@@ -18,6 +18,7 @@
*/
#include "stdafx.h"
+#include "bs2/sword2.h"
#include "bs2/build_display.h"
#include "bs2/console.h"
#include "bs2/debug.h"
@@ -347,8 +348,8 @@
Build_display();
do {
- ServiceWindows();
- } while(!KeyWaiting());
+ g_display->updateDisplay();
+ } while (!KeyWaiting());
// kill the key we just pressed
ReadKey(&ke);
Index: maketext.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/maketext.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- maketext.cpp 11 Oct 2003 12:26:53 -0000 1.22
+++ maketext.cpp 15 Oct 2003 06:40:31 -0000 1.23
@@ -525,7 +525,7 @@
spriteInfo.data = _blocList[j].text_mem->ad + sizeof(_frameHeader);
spriteInfo.colourTable = 0;
- rv = DrawSprite(&spriteInfo);
+ rv = g_display->drawSprite(&spriteInfo);
if (rv)
error("Driver Error %.8x in Print_text_blocs", rv);
}
@@ -603,7 +603,7 @@
// GERMAN: "Baphomet's Fluch II"
// default: "Some game or other, part 86"
- SetWindowName((char *) textLine);
+ g_display->setWindowName((char *) textLine);
// now ok to close the text file
res_man.close(TEXT_RES);
Index: mem_view.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/mem_view.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- mem_view.cpp 4 Oct 2003 08:07:02 -0000 1.16
+++ mem_view.cpp 15 Oct 2003 06:40:31 -0000 1.17
@@ -18,6 +18,7 @@
*/
#include "stdafx.h"
+#include "bs2/sword2.h"
#include "bs2/build_display.h"
#include "bs2/console.h"
#include "bs2/header.h"
@@ -102,8 +103,8 @@
Build_display();
do {
- ServiceWindows();
- } while(!KeyWaiting());
+ g_display->updateDisplay();
+ } while (!KeyWaiting());
ReadKey(&ke); //kill the key we just pressed
if (ke.keycode == 27) //ESC
Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/mouse.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- mouse.cpp 11 Oct 2003 12:26:53 -0000 1.26
+++ mouse.cpp 15 Oct 2003 06:40:31 -0000 1.27
@@ -157,7 +157,7 @@
System_menu_mouse();
break;
case MOUSE_holding:
- if (mousey < 400) {
+ if (g_display->_mouseY < 400) {
mouse_mode = MOUSE_normal;
debug(5, " releasing");
}
@@ -182,10 +182,10 @@
};
// can't close when player is dead
- if (mousey > 0 && !DEAD) {
+ if (g_display->_mouseY > 0 && !DEAD) {
// close menu
mouse_mode = MOUSE_normal;
- HideMenu(RDMENU_TOP);
+ g_display->hideMenu(RDMENU_TOP);
return;
}
@@ -194,9 +194,9 @@
if (me && (me->buttons & RD_LEFTBUTTONDOWN)) {
// clicked on a top mouse pointer?
- if (mousex >= 24 && mousex < 640 - 24 && mousey < 0) {
+ if (g_display->_mouseX >= 24 && g_display->_mouseX < 640 - 24 && g_display->_mouseY < 0) {
// which are we over?
- hit = (mousex - 24) / 40;
+ hit = (g_display->_mouseX - 24) / 40;
// no save when dead
if (icon_list[hit] == SAVE_ICON && DEAD)
@@ -210,7 +210,7 @@
// change all others to grey
if (j != hit) {
icon = res_man.open(icon_list[j]) + sizeof(_standardHeader);
- SetMenuIcon(RDMENU_TOP, j, icon);
+ g_display->setMenuIcon(RDMENU_TOP, j, icon);
res_man.close( icon_list[j] );
}
}
@@ -235,9 +235,9 @@
// clear the screen & set up the new palette
// for the menus
- EraseBackBuffer();
- ProcessMenu();
- ResetRenderEngine();
+ g_display->clearScene();
+ g_display->processMenu();
+ g_display->resetRenderEngine();
// call the relevent screen
switch (hit) {
@@ -261,7 +261,7 @@
// Menu stays open on death screen
if (!DEAD) {
mouse_mode = MOUSE_normal;
- HideMenu(RDMENU_TOP);
+ g_display->hideMenu(RDMENU_TOP);
} else {
Set_mouse(NORMAL_MOUSE_ID);
Build_system_menu();
@@ -270,8 +270,8 @@
// clear the screen & restore the location
// palette
- EraseBackBuffer();
- ProcessMenu();
+ g_display->clearScene();
+ g_display->processMenu();
// reset game palette, but not after a
// successful restore or restart!
@@ -319,10 +319,10 @@
_mouseEvent *me;
uint32 pos;
- if (mousey < 400 && !menu_status) {
+ if (g_display->_mouseY < 400 && !menu_status) {
// close menu
mouse_mode = MOUSE_normal;
- HideMenu(RDMENU_BOTTOM);
+ g_display->hideMenu(RDMENU_BOTTOM);
return;
}
@@ -358,8 +358,8 @@
// these might be required by the action script about
// to be run
- MOUSE_X = (uint32) mousex + this_screen.scroll_offset_x;
- MOUSE_Y = (uint32) mousey + this_screen.scroll_offset_y;
+ MOUSE_X = (uint32) g_display->_mouseX + this_screen.scroll_offset_x;
+ MOUSE_Y = (uint32) g_display->_mouseY + this_screen.scroll_offset_y;
// for scripts to know what's been clicked (21jan97).
// First used for 'room_13_turning_script' in object
@@ -373,14 +373,14 @@
// Hide menu - back to normal menu mode
- HideMenu(RDMENU_BOTTOM);
+ g_display->hideMenu(RDMENU_BOTTOM);
mouse_mode = MOUSE_normal;
} else {
// better check for combine/cancel
// cancel puts us back in Menu_mouse mode
- if (mousex >= 24 && mousex < 640 - 24) {
+ if (g_display->_mouseX >= 24 && g_display->_mouseX < 640 - 24) {
// which are we over?
- pos = (mousex - 24) / 40;
+ pos = (g_display->_mouseX - 24) / 40;
//clicked on something - what button?
if (master_menu_list[pos].icon_resource) {
@@ -432,10 +432,10 @@
_mouseEvent *me;
uint32 pos;
- if (mousey < 400 && !menu_status) {
+ if (g_display->_mouseY < 400 && !menu_status) {
// close menu
mouse_mode = MOUSE_normal;
- HideMenu(RDMENU_BOTTOM);
+ g_display->hideMenu(RDMENU_BOTTOM);
return;
}
@@ -448,9 +448,9 @@
// there's a mouse event to be processed
// now check if we've clicked on an actual icon
- if (mousex >= 24 && mousex < 640 - 24) {
+ if (g_display->_mouseX >= 24 && g_display->_mouseX < 640 - 24) {
// which are we over?
- pos = (mousex - 24) / 40;
+ pos = (g_display->_mouseX - 24) / 40;
// clicked on something - what button?
if (master_menu_list[pos].icon_resource) {
@@ -518,7 +518,7 @@
_mouseEvent *me;
// no save in big-object menu lock situation
- if (mousey < 0 && !menu_status && !mouse_mode_locked && !OBJECT_HELD) {
+ if (g_display->_mouseY < 0 && !menu_status && !mouse_mode_locked && !OBJECT_HELD) {
mouse_mode = MOUSE_system_menu;
if (mouse_touching) {
@@ -533,7 +533,7 @@
return;
}
- if (mousey > 399 && !menu_status && !mouse_mode_locked) {
+ if (g_display->_mouseY > 399 && !menu_status && !mouse_mode_locked) {
// If an object is being held, i.e. if the mouse cursor has a
// luggage, we should be use dragging mode instead of inventory
// menu mode.
@@ -578,8 +578,8 @@
if (me && (me->buttons & (RD_LEFTBUTTONDOWN | RD_RIGHTBUTTONDOWN))) {
// set both (x1,y1) and (x2,y2) to this point
- rect_x1 = rect_x2 = (uint32) mousex + this_screen.scroll_offset_x;
- rect_y1 = rect_y2 = (uint32) mousey + this_screen.scroll_offset_y;
+ rect_x1 = rect_x2 = (uint32) g_display->_mouseX + this_screen.scroll_offset_x;
+ rect_y1 = rect_y2 = (uint32) g_display->_mouseY + this_screen.scroll_offset_y;
draggingRectangle = 1;
}
} else if (draggingRectangle == 1) {
@@ -591,8 +591,8 @@
draggingRectangle = 2;
} else {
// drag rectangle
- rect_x2 = (uint32) mousex + this_screen.scroll_offset_x;
- rect_y2 = (uint32) mousey + this_screen.scroll_offset_y;
+ rect_x2 = (uint32) g_display->_mouseX + this_screen.scroll_offset_x;
+ rect_y2 = (uint32) g_display->_mouseY + this_screen.scroll_offset_y;
}
} else {
// currently locked to avoid knocking out of place
@@ -642,8 +642,8 @@
}
// these might be required by the action script about to be run
- MOUSE_X = (uint32) mousex + this_screen.scroll_offset_x;
- MOUSE_Y = (uint32) mousey + this_screen.scroll_offset_y;
+ MOUSE_X = (uint32) g_display->_mouseX + this_screen.scroll_offset_x;
+ MOUSE_Y = (uint32) g_display->_mouseY + this_screen.scroll_offset_y;
// only left button
if (mouse_touching == EXIT_CLICK_ID && (me->buttons & RD_LEFTBUTTONDOWN)) {
@@ -701,7 +701,7 @@
// don't detect objects that are hidden behind the menu bars (ie. in
// the scrolled-off areas of the screen)
- if (mousey < 0 || mousey > 399) {
+ if (g_display->_mouseY < 0 || g_display->_mouseY > 399) {
pointer_type = 0;
mouse_touching = 0;
} else {
@@ -799,14 +799,14 @@
// loop
if (res == NORMAL_MOUSE_ID)
- SetMouseAnim(icon, len, RDMOUSE_NOFLASH);
+ g_display->setMouseAnim(icon, len, RDMOUSE_NOFLASH);
else
- SetMouseAnim(icon, len, RDMOUSE_FLASH);
+ g_display->setMouseAnim(icon, len, RDMOUSE_FLASH);
res_man.close(res);
} else {
// blank cursor
- SetMouseAnim(NULL, 0, 0);
+ g_display->setMouseAnim(NULL, 0, 0);
}
}
@@ -820,11 +820,11 @@
icon = res_man.open(res) + sizeof(_standardHeader);
len = res_man._resList[res]->size - sizeof(_standardHeader);
- SetLuggageAnim(icon, len);
+ g_display->setLuggageAnim(icon, len);
res_man.close(res);
} else
- SetLuggageAnim(NULL, 0);
+ g_display->setLuggageAnim(NULL, 0);
}
uint32 Check_mouse_list(void) {
@@ -838,10 +838,10 @@
// mouse-detection-box
if (mouse_list[j].priority == priority &&
- mousex + this_screen.scroll_offset_x >= mouse_list[j].x1 &&
- mousex + this_screen.scroll_offset_x <= mouse_list[j].x2 &&
- mousey + this_screen.scroll_offset_y >= mouse_list[j].y1 &&
- mousey + this_screen.scroll_offset_y <= mouse_list[j].y2) {
+ g_display->_mouseX + this_screen.scroll_offset_x >= mouse_list[j].x1 &&
+ g_display->_mouseX + this_screen.scroll_offset_x <= mouse_list[j].x2 &&
+ g_display->_mouseY + this_screen.scroll_offset_y >= mouse_list[j].y1 &&
+ g_display->_mouseY + this_screen.scroll_offset_y <= mouse_list[j].y2) {
// record id
mouse_touching = mouse_list[j].id;
@@ -1017,7 +1017,8 @@
// line reference number
pointer_text_bloc_no = fontRenderer.buildNewBloc(
- text + 2, mousex + xOffset, mousey + yOffset,
+ text + 2, g_display->_mouseX + xOffset,
+ g_display->_mouseY + yOffset,
POINTER_TEXT_WIDTH, POINTER_TEXT_PEN,
RDSPR_TRANS | RDSPR_DISPLAYALIGN,
g_sword2->_speechFontId, justification);
@@ -1054,12 +1055,12 @@
// dont hide menu in conversations
if (TALK_FLAG == 0)
- HideMenu(RDMENU_BOTTOM);
+ g_display->hideMenu(RDMENU_BOTTOM);
if (mouse_mode == MOUSE_system_menu) {
// close menu
mouse_mode = MOUSE_normal;
- HideMenu(RDMENU_TOP);
+ g_display->hideMenu(RDMENU_TOP);
}
// script continue
@@ -1117,7 +1118,7 @@
}
// if mouse is over menu area
- if (mousey > 399) {
+ if (g_display->_mouseY > 399) {
if (mouse_mode != MOUSE_holding) {
// VITAL - reset things & rebuild the menu
mouse_mode = MOUSE_normal;
@@ -1292,7 +1293,7 @@
// Highest priority
- ob_mouse->x1 = this_screen.scroll_offset_x + screenWide - SCROLL_MOUSE_WIDTH;
+ ob_mouse->x1 = this_screen.scroll_offset_x + g_display->_screenWide - SCROLL_MOUSE_WIDTH;
ob_mouse->y1 = 0;
ob_mouse->x2 = this_screen.screen_wide - 1;
ob_mouse->y2 = this_screen.screen_deep - 1;
@@ -1327,7 +1328,7 @@
// appropriate to keep it displayed
int32 FN_remove_chooser(int32 *params) {
- HideMenu(RDMENU_BOTTOM);
+ g_display->hideMenu(RDMENU_BOTTOM);
return IR_CONT;
}
@@ -1336,8 +1337,8 @@
mouse_mode_locked = 1;
mouse_mode = MOUSE_normal;
- HideMenu(RDMENU_TOP);
- HideMenu(RDMENU_BOTTOM);
+ g_display->hideMenu(RDMENU_TOP);
+ g_display->hideMenu(RDMENU_BOTTOM);
return IR_CONT;
}
Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/resman.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- resman.cpp 11 Oct 2003 12:26:53 -0000 1.53
+++ resman.cpp 15 Oct 2003 06:40:31 -0000 1.54
@@ -18,6 +18,7 @@
*/
#include "stdafx.h"
+#include "bs2/sword2.h"
#include "bs2/driver/driver96.h"
#include "bs2/build_display.h"
#include "bs2/console.h"
@@ -32,7 +33,6 @@
#include "bs2/protocol.h"
#include "bs2/resman.h"
#include "bs2/sound.h" // for Clear_fx_queue() called from cacheNewCluster()
-#include "bs2/sword2.h" // for CloseGame()
#include "bs2/router.h"
namespace Sword2 {
@@ -961,8 +961,8 @@
Build_display();
do {
- ServiceWindows();
- } while(!KeyWaiting());
+ g_display->updateDisplay();
+ } while (!KeyWaiting());
ReadKey(&ke);
if (ke.keycode == 27)
@@ -1033,8 +1033,8 @@
Build_display();
do {
- ServiceWindows();
- } while(!KeyWaiting());
+ g_display->updateDisplay();
+ } while (!KeyWaiting());
ReadKey(&ke); //kill the key we just pressed
@@ -1106,28 +1106,28 @@
char buf[1024];
sprintf(buf, "%sClusters\\%s", _cdPath, _resourceFiles[newCluster]);
- WaitForFade();
+ g_display->waitForFade();
- if (GetFadeStatus() != RDFADE_BLACK) {
- FadeDown((float) 0.75);
- WaitForFade();
+ if (g_display->getFadeStatus() != RDFADE_BLACK) {
+ g_display->fadeDown();
+ g_display->waitForFade();
}
- EraseBackBuffer();
+ g_display->clearScene();
Set_mouse(0);
- Set_luggage(0); //tw28Aug
+ Set_luggage(0);
uint8 *bgfile;
bgfile = res_man.open(2950); // open the screen resource
- InitialiseBackgroundLayer(NULL);
- InitialiseBackgroundLayer(NULL);
- InitialiseBackgroundLayer(FetchBackgroundLayer(bgfile));
- InitialiseBackgroundLayer(NULL);
- InitialiseBackgroundLayer(NULL);
- BS2_SetPalette(0, 256, FetchPalette(bgfile), RDPAL_FADE);
+ g_display->initialiseBackgroundLayer(NULL);
+ g_display->initialiseBackgroundLayer(NULL);
+ g_display->initialiseBackgroundLayer(FetchBackgroundLayer(bgfile));
+ g_display->initialiseBackgroundLayer(NULL);
+ g_display->initialiseBackgroundLayer(NULL);
+ g_display->setPalette(0, 256, FetchPalette(bgfile), RDPAL_FADE);
- RenderParallax(FetchBackgroundLayer(bgfile), 2);
+ g_display->renderParallax(FetchBackgroundLayer(bgfile), 2);
res_man.close(2950); // release the screen resource
// Git rid of read-only status, if it is set.
@@ -1153,8 +1153,8 @@
frame = (_frameHeader*) text_spr->ad;
- textSprite.x = screenWide /2 - frame->width / 2;
- textSprite.y = screenDeep /2 - frame->height / 2 - RDMENU_MENUDEEP;
+ textSprite.x = g_display->_screenWide /2 - frame->width / 2;
+ textSprite.y = g_display->_screenDeep /2 - frame->height / 2 - RDMENU_MENUDEEP;
textSprite.w = frame->width;
textSprite.h = frame->height;
textSprite.scale = 0;
@@ -1194,18 +1194,17 @@
int16 textX = textSprite.x;
int16 textY = textSprite.y;
- DrawSprite(&barSprite);
+ g_display->drawSprite(&barSprite);
barSprite.x = barX;
barSprite.y = barY;
textSprite.data = text_spr->ad + sizeof(_frameHeader);
- DrawSprite(&textSprite);
+ g_display->drawSprite(&textSprite);
textSprite.x = textX;
textSprite.y = textY;
- FadeUp((float) 0.75);
-
- WaitForFade();
+ g_display->fadeUp();
+ g_display->waitForFade();
uint32 size = inFile.size();
@@ -1227,19 +1226,19 @@
step = 0;
// open the screen resource
bgfile = res_man.open(2950);
- RenderParallax(FetchBackgroundLayer(bgfile), 2);
+ g_display->renderParallax(FetchBackgroundLayer(bgfile), 2);
// release the screen resource
res_man.close(2950);
loadingBar = res_man.open(2951);
frame = FetchFrameHeader(loadingBar, fr);
barSprite.data = (uint8 *) (frame + 1);
res_man.close(2951);
- DrawSprite(&barSprite);
+ g_display->drawSprite(&barSprite);
barSprite.x = barX;
barSprite.y = barY;
textSprite.data = text_spr->ad + sizeof(_frameHeader);
- DrawSprite(&textSprite);
+ g_display->drawSprite(&textSprite);
textSprite.x = textX;
textSprite.y = textY;
@@ -1247,7 +1246,7 @@
} else
step++;
- ServiceWindows();
+ g_display->updateDisplay();
} while ((read % BUFFERSIZE) == 0);
if (read != size) {
@@ -1258,11 +1257,11 @@
outFile.close();
memory.freeMemory(text_spr);
- EraseBackBuffer();
+ g_display->clearScene();
- FadeDown((float) 0.75);
- WaitForFade();
- FadeUp((float) 0.75);
+ g_display->fadeDown();
+ g_display->waitForFade();
+ g_display->fadeUp();
// Git rid of read-only status.
SVM_SetFileAttributes(_resourceFiles[newCluster], FILE_ATTRIBUTE_NORMAL);
@@ -1379,8 +1378,8 @@
frame = (_frameHeader*) text_spr->ad;
- spriteInfo.x = screenWide / 2 - frame->width / 2;
- spriteInfo.y = screenDeep / 2 - frame->height / 2 - RDMENU_MENUDEEP;
+ spriteInfo.x = g_display->_screenWide / 2 - frame->width / 2;
+ spriteInfo.y = g_display->_screenDeep / 2 - frame->height / 2 - RDMENU_MENUDEEP;
spriteInfo.w = frame->width;
spriteInfo.h = frame->height;
spriteInfo.scale = 0;
@@ -1418,10 +1417,10 @@
}
}
- ServiceWindows();
+ g_display->updateDisplay();
- EraseBackBuffer();
- DrawSprite(&spriteInfo); // Keep the message there even when the user task swaps.
+ g_display->clearScene();
+ g_display->drawSprite(&spriteInfo); // Keep the message there even when the user task swaps.
spriteInfo.y = oldY; // Drivers change the y co-ordinate, don't know why...
spriteInfo.x = oldX;
} while (!done);
Index: speech.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/speech.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- speech.cpp 11 Oct 2003 12:26:53 -0000 1.30
+++ speech.cpp 15 Oct 2003 06:40:31 -0000 1.31
@@ -220,17 +220,17 @@
if (j < IN_SUBJECT) {
debug(5, " ICON res %d for %d", subject_list[j].res, j);
icon = res_man.open(subject_list[j].res) + sizeof(_standardHeader) + RDMENU_ICONWIDE * RDMENU_ICONDEEP;
- SetMenuIcon(RDMENU_BOTTOM, (uint8) j, icon);
+ g_display->setMenuIcon(RDMENU_BOTTOM, (uint8) j, icon);
res_man.close(subject_list[j].res);
} else {
//no icon here
debug(5, " NULL for %d", j);
- SetMenuIcon(RDMENU_BOTTOM, (uint8) j, NULL);
+ g_display->setMenuIcon(RDMENU_BOTTOM, (uint8) j, NULL);
}
}
// start menus appearing
- ShowMenu(RDMENU_BOTTOM);
+ g_display->showMenu(RDMENU_BOTTOM);
// lets have the mouse pointer back
Set_mouse(NORMAL_MOUSE_ID);
@@ -253,9 +253,9 @@
// if so then end the choose, highlight only the
// chosen, blank the mouse and return the ref code * 8
- if (mousey > 399 && mousex >= 24 && mousex < 640 - 24) {
+ if (g_display->_mouseY > 399 && g_display->_mouseX >= 24 && g_display->_mouseX < 640 - 24) {
//which are we over?
- hit = (mousex - 24) / 40;
+ hit = (g_display->_mouseX - 24) / 40;
//clicked on something - what button?
if (hit < IN_SUBJECT) {
@@ -268,7 +268,7 @@
// change all others to grey
if (j != hit) {
icon = res_man.open( subject_list[j].res ) + sizeof(_standardHeader);
- SetMenuIcon(RDMENU_BOTTOM, (uint8) j, icon);
+ g_display->setMenuIcon(RDMENU_BOTTOM, (uint8) j, icon);
res_man.close(subject_list[j].res);
}
}
@@ -338,9 +338,9 @@
debug(5, "FN_end_conversation");
- HideMenu(RDMENU_BOTTOM);
+ g_display->hideMenu(RDMENU_BOTTOM);
- if (mousey > 399) {
+ if (g_display->_mouseY > 399) {
// will wait for cursor to move off the bottom menu
mouse_mode = MOUSE_holding;
debug(5, " holding");
@@ -1302,7 +1302,7 @@
#ifdef _SWORD2_DEBUG
// so that we can go to the options panel while text & speech is
// being tested
- if (SYSTEM_TESTING_TEXT == 0 || mousey > 0) {
+ if (SYSTEM_TESTING_TEXT == 0 || g_display->_mouseY > 0) {
#endif
me = MouseEvent();
Index: startup.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/startup.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- startup.cpp 12 Oct 2003 14:40:03 -0000 1.21
+++ startup.cpp 15 Oct 2003 06:40:31 -0000 1.22
@@ -196,8 +196,8 @@
do {
// Service windows
- ServiceWindows();
- } while(!KeyWaiting());
+ g_display->updateDisplay();
+ } while (!KeyWaiting());
// kill the key we just pressed
ReadKey(&ke);
Index: sword2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/sword2.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- sword2.cpp 12 Oct 2003 19:10:16 -0000 1.58
+++ sword2.cpp 15 Oct 2003 06:40:31 -0000 1.59
@@ -96,6 +96,7 @@
Sword2Engine *g_sword2 = NULL;
Sound *g_sound = NULL;
+Display *g_display = NULL;
Sword2Engine::Sword2Engine(GameDetector *detector, OSystem *syst)
: Engine(detector, syst) {
@@ -120,11 +121,13 @@
_mixer->setMusicVolume(256);
g_sound = _sound = new Sound(_mixer);
+ g_display = _display = new Display(640, 480);
}
Sword2Engine::~Sword2Engine() {
free(_targetName);
delete _sound;
+ delete _display;
}
void Sword2Engine::errorString(const char *buf1, char *buf2) {
@@ -199,7 +202,6 @@
void Close_game() {
debug(5, "Close_game() STARTING:");
- EraseBackBuffer();
// Stop music instantly!
Kill_music();
@@ -207,6 +209,8 @@
// free the memory again
memory.exit();
res_man.exit();
+
+ g_system->quit();
}
int32 GameCycle(void) {
@@ -250,8 +254,6 @@
}
void Sword2Engine::go() {
- uint32 rv;
- uint8 breakOut = 0;
_keyboardEvent ke;
// Call the application "Revolution" until the resource manager is
@@ -262,21 +264,12 @@
// manager until a window has been created as any errors are displayed
// via a window, thus time becomes a loop.
- debug(5, "CALLING: InitialiseDisplay");
- rv = InitialiseDisplay(640, 480);
-
- if (rv != RD_OK) {
- // ReportDriverError(rv);
- CloseAppWindow();
- return;
- }
-
debug(5, "CALLING: readOptionSettings");
gui.readOptionSettings();
debug(5, "CALLING: InitialiseGame");
if (InitialiseGame()) {
- CloseAppWindow();
+ Close_game();
return;
}
@@ -291,11 +284,11 @@
} else
Start_game();
- debug(5, "CALLING: InitialiseRenderCycle");
- InitialiseRenderCycle();
+ debug(5, "CALLING: initialiseRenderCycle");
+ g_display->initialiseRenderCycle();
while (1) {
- ServiceWindows();
+ g_display->updateDisplay();
#ifdef _SWORD2_DEBUG
// FIXME: If we want this, we should re-work it to use the backend's
@@ -304,10 +297,6 @@
// GrabScreenShot();
#endif
- // if we are closing down the game, break out of main game loop
- if (breakOut)
- break;
-
#ifdef _SWORD2_DEBUG
if (console_status) {
if (One_console()) {
@@ -408,7 +397,6 @@
}
Close_game(); //close engine systems down
- CloseAppWindow();
return; //quit the game
}
@@ -465,8 +453,8 @@
g_sword2->parseEvents();
// Make sure menu animations and fades don't suffer
- ProcessMenu();
- ServiceWindows();
+ g_display->processMenu();
+ g_display->updateDisplay();
g_system->delay_msecs(10);
}
@@ -481,8 +469,8 @@
// now ok to close the text file
// res_man.close(3258);
- // don't allow Pause while screen fading or while black (James 03sep97)
- if (GetFadeStatus() != RDFADE_NONE)
+ // don't allow Pause while screen fading or while black
+ if (g_display->getFadeStatus() != RDFADE_NONE)
return;
PauseAllSound();
@@ -492,8 +480,8 @@
// mouse_mode=MOUSE_normal;
- //this is the only place allowed to do it this way
- SetLuggageAnim(NULL, 0);
+ // this is the only place allowed to do it this way
+ g_display->setLuggageAnim(NULL, 0);
// blank cursor
Set_mouse(0);
@@ -513,7 +501,7 @@
// dim the palette during the pause (James26jun97)
if (stepOneCycle == 0)
- DimPalette();
+ g_display->dimPalette();
gamePaused = 1;
}
Index: sword2.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/sword2.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- sword2.h 12 Oct 2003 19:10:16 -0000 1.21
+++ sword2.h 15 Oct 2003 06:40:31 -0000 1.22
@@ -26,6 +26,7 @@
#include "common/rect.h"
#include "common/str.h"
#include "bs2/driver/d_sound.h"
+#include "bs2/driver/d_draw.h"
enum BSGameId {
GID_SWORD2 = GID_SWORD2_FIRST,
@@ -77,6 +78,7 @@
byte _gameId;
char *_targetName; // target name for saves
Sound *_sound;
+ Display *_display;
Common::RandomSource _rnd;
uint32 _speechFontId;
@@ -90,6 +92,7 @@
extern Sword2Engine *g_sword2;
extern Sound *g_sound;
+extern Display *g_display;
} // End of namespace Sword2
Index: walker.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/walker.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- walker.cpp 12 Oct 2003 14:40:04 -0000 1.15
+++ walker.cpp 15 Oct 2003 06:40:31 -0000 1.16
@@ -23,6 +23,7 @@
// on them
#include "stdafx.h"
+#include "bs2/sword2.h"
#include "bs2/console.h"
#include "bs2/defs.h"
#include "bs2/events.h"
@@ -137,7 +138,7 @@
// resource
ob_graph->anim_resource = ob_mega->megaset_res;
- } else if (EXIT_FADING && GetFadeStatus() == RDFADE_BLACK) {
+ } else if (EXIT_FADING && g_display->getFadeStatus() == RDFADE_BLACK) {
// double clicked an exit so quit the walk when screen is black
// ok, thats it - back to script and change screen
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v5.cpp,1.199,1.200 scummvm.cpp,2.447,2.448
- Next message: [Scummvm-cvs-logs] CVS: scummvm/bs2/driver _mouse.cpp,1.23,1.24 _mouse.h,1.4,1.5 d_draw.cpp,1.37,1.38 d_draw.h,1.10,1.11 d_sound.cpp,1.75,1.76 driver96.h,1.55,1.56 menu.cpp,1.18,1.19 palette.cpp,1.21,1.22 palette.h,1.6,1.7 rdwin.cpp,1.32,1.33 rdwin.h,1.5,1.6 render.cpp,1.35,1.36 render.h,1.9,1.10 sprite.cpp,1.28,1.29
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list