aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-09-19 21:45:56 +0000
committerMax Horn2002-09-19 21:45:56 +0000
commit993974602222e979cfa0ab3ed475ba08cd5f3b2f (patch)
tree5a6bb78d66c2f5b9f3fcd492cb6951ab9ec2d85c
parent859ef578dc6faa881cab115fd0059a88b6a5899a (diff)
downloadscummvm-rg350-993974602222e979cfa0ab3ed475ba08cd5f3b2f.tar.gz
scummvm-rg350-993974602222e979cfa0ab3ed475ba08cd5f3b2f.tar.bz2
scummvm-rg350-993974602222e979cfa0ab3ed475ba08cd5f3b2f.zip
removed even more scumm dependencies from NewGUI; fixed some redraw issues (this might help the inventory-display issue in The Dig, and definitly fixes the 'vanishing volcanoe' in the FOA extro)
svn-id: r4974
-rw-r--r--gui/newgui.cpp60
-rw-r--r--gui/newgui.h11
-rw-r--r--scumm/dialogs.cpp29
-rw-r--r--scumm/scumm.h18
-rw-r--r--scumm/scummvm.cpp52
5 files changed, 81 insertions, 89 deletions
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 08d51b7c83..036619fefe 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -28,13 +28,12 @@
/*
* TODO list
- * - use a nice font
- * - implement the missing / incomplete dialogs
+ * - get a nicer font which contains diacrits (ŠšŸ§Žˆ etc.)
* - add more widgets
* - allow multi line (l/c/r aligned) text via StaticTextWidget ?
* - add "close" widget to all dialogs (with a flag to turn it off) ?
* - make dialogs "moveable" ?
- * - come up with a new look&feel / theme for the GUI
+ * - come up with a new look & feel / theme for the GUI
* - ...
*/
@@ -68,31 +67,16 @@ static byte guifont[] = {0,0,99,1,226,8,4,8,6,8,6,0,0,0,0,0,0,0,0,0,0,0,8,2,1,8,
// Constructor
NewGui::NewGui(Scumm *s) : _s(s), _system(s->_system), _screen(0),
- _use_alpha_blending(true), _need_redraw(false),_prepare_for_gui(true),
- _pauseDialog(0), _saveLoadDialog(0), _aboutDialog(0), _optionsDialog(0),
+ _use_alpha_blending(true), _need_redraw(false), _prepare_for_gui(true),
_currentKeyDown(0)
{
-}
-
-void NewGui::pauseDialog()
-{
- if (!_pauseDialog)
- _pauseDialog = new PauseDialog(this, _s);
- _pauseDialog->open();
-}
-
-void NewGui::saveloadDialog()
-{
- if (!_saveLoadDialog)
- _saveLoadDialog = new SaveLoadDialog(this, _s);
- _saveLoadDialog->open();
-}
-
-void NewGui::optionsDialog()
-{
- if (!_optionsDialog)
- _optionsDialog = new OptionsDialog(this, _s);
- _optionsDialog->open();
+ // Setup some default GUI colors.
+ // TODO - either use nicer values, or maybe make this configurable?
+ _bgcolor = RGB_TO_16(0, 0, 0);
+ _color = RGB_TO_16(80, 80, 80);
+ _shadowcolor = RGB_TO_16(64, 64, 64);
+ _textcolor = RGB_TO_16(32, 160, 32);
+ _textcolorhi = RGB_TO_16(0, 255, 0);
}
void NewGui::loop()
@@ -103,13 +87,6 @@ void NewGui::loop()
if (_prepare_for_gui) {
saveState();
- // Setup some default GUI colors
- _bgcolor = RGB_TO_16(0, 0, 0);
- _color = RGB_TO_16(80, 80, 80);
- _shadowcolor = RGB_TO_16(64, 64, 64);
- _textcolor = RGB_TO_16(32, 192, 32);
- _textcolorhi = RGB_TO_16(0, 255, 0);
-
_eventList.clear();
_currentKeyDown = 0;
@@ -203,8 +180,6 @@ void NewGui::loop()
}
_keyRepeatLoopCount++;
}
-
- _s->drawDirtyScreenParts();
}
#pragma mark -
@@ -234,8 +209,6 @@ void NewGui::saveState()
void NewGui::restoreState()
{
- _s->_fullRedraw = true;
- _s->_completeScreenRedraw = true;
_s->_cursorAnimate--;
// Restore old cursor
@@ -333,19 +306,18 @@ void NewGui::line(int x, int y, int x2, int y2, int16 color)
void NewGui::blendRect(int x, int y, int w, int h, int16 color)
{
- int r = RED_FROM_16(color) * 2;
- int g = GREEN_FROM_16(color) * 2;
- int b = BLUE_FROM_16(color) * 2;
+ int r = RED_FROM_16(color) * 3;
+ int g = GREEN_FROM_16(color) * 3;
+ int b = BLUE_FROM_16(color) * 3;
int16 *ptr = getBasePtr(x, y);
if (ptr == NULL)
return;
while (h--) {
for (int i = 0; i < w; i++) {
- ptr[i] = RGB_TO_16((RED_FROM_16(ptr[i])+r)/3,
- (GREEN_FROM_16(ptr[i])+g)/3,
- (BLUE_FROM_16(ptr[i])+b)/3);
-// ptr[i] = color;
+ ptr[i] = RGB_TO_16((RED_FROM_16(ptr[i])+r)/4,
+ (GREEN_FROM_16(ptr[i])+g)/4,
+ (BLUE_FROM_16(ptr[i])+b)/4);
}
ptr += _screen_pitch;
}
diff --git a/gui/newgui.h b/gui/newgui.h
index bf60f3ed6b..583a7d6c1c 100644
--- a/gui/newgui.h
+++ b/gui/newgui.h
@@ -68,11 +68,6 @@ public:
int16 _textcolor;
int16 _textcolorhi;
- // Dialogs
- void pauseDialog();
- void saveloadDialog();
- void optionsDialog();
-
void loop();
bool isActive() { return ! _dialogStack.empty(); }
@@ -92,12 +87,6 @@ protected:
bool _prepare_for_gui;
DialogStack _dialogStack;
- Dialog *_pauseDialog;
- Dialog *_saveLoadDialog;
- Dialog *_aboutDialog;
- Dialog *_optionsDialog;
- Dialog *_soundDialog;
-
// for continuous events (keyDown)
int _currentKeyDown, _currentKeyDownFlags;
int _keyRepeatLoopCount;
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp
index 3777fd45fc..c1292e3734 100644
--- a/scumm/dialogs.cpp
+++ b/scumm/dialogs.cpp
@@ -146,7 +146,7 @@ void ScummDialog::addResText(int x, int y, int w, int h, int resID)
const char *str = queryResString(resID);
if (!str)
str = "Dummy!";
- new StaticTextWidget(this, x, y, w, h, str, kTextAlignLeft);
+ new StaticTextWidget(this, x, y, w, h, str, kTextAlignCenter);
}
@@ -241,21 +241,19 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
case kListItemChangedCmd:
case kSaveCmd:
if (_savegameList->getSelected() >= 1 && !_savegameList->getSelectedString().isEmpty()) {
- Scumm *s = _scumm;
- s->_saveLoadSlot = _savegameList->getSelected();
- s->_saveLoadCompatible = false;
- s->_saveLoadFlag = 1; // 1 for save, I assume (Painelf)
- strcpy(s->_saveLoadName, _savegameList->getSelectedString().c_str());
+ _scumm->_saveLoadSlot = _savegameList->getSelected();
+ _scumm->_saveLoadCompatible = false;
+ _scumm->_saveLoadFlag = 1; // 1 for save, I assume (Painelf)
+ strcpy(_scumm->_saveLoadName, _savegameList->getSelectedString().c_str());
close();
}
break;
case kListItemDoubleClickedCmd:
case kLoadCmd:
if (_savegameList->getSelected() >= 0 && !_savegameList->getSelectedString().isEmpty()) {
- Scumm *s = _scumm;
- s->_saveLoadSlot = _savegameList->getSelected();
- s->_saveLoadCompatible = false;
- s->_saveLoadFlag = 2; // 2 for load. Magic number anyone?
+ _scumm->_saveLoadSlot = _savegameList->getSelected();
+ _scumm->_saveLoadCompatible = false;
+ _scumm->_saveLoadFlag = 2; // 2 for load. Magic number anyone?
close();
}
break;
@@ -263,7 +261,7 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
close();
break;
case kOptionsCmd:
- _gui->optionsDialog();
+ _scumm->optionsDialog();
break;
case kQuitCmd: {
_scumm->_system->quit();
@@ -321,7 +319,6 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
}
}
-
#pragma mark -
AboutDialog::AboutDialog(NewGui *gui, Scumm *scumm)
@@ -335,12 +332,16 @@ AboutDialog::AboutDialog(NewGui *gui, Scumm *scumm)
new StaticTextWidget(this, 10, 78, 240, 16, "Simon the Sorcerer (c) Adventuresoft", kTextAlignCenter);
}
+#pragma mark -
+
PauseDialog::PauseDialog(NewGui *gui, Scumm *scumm)
- : ScummDialog(gui, scumm, 50, 80, 220, 16)
+ : ScummDialog(gui, scumm, 35, 80, 250, 16)
{
- addResText(4, 4, 220, 16, 10);
+ addResText(4, 4, 250-8, 16, 10);
}
+#pragma mark -
+
SoundDialog::SoundDialog(NewGui *gui, Scumm *scumm)
: ScummDialog(gui, scumm, 30, 20, 260, 110)
{
diff --git a/scumm/scumm.h b/scumm/scumm.h
index be68bcc7ba..334ffa124f 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -30,6 +30,7 @@
class GameDetector;
class Gui;
class NewGui;
+class Dialog;
class Scumm;
class IMuse;
class Actor;
@@ -325,8 +326,6 @@ public:
* That results in a shorter form of the opcode
* on some architectures. */
IMuse *_imuse;
- Gui *_gui;
- NewGui *_newgui;
uint32 _features;
VerbSlot *_verbs;
ObjectData *_objs;
@@ -390,12 +389,25 @@ public:
void shutDown(int i);
void setOptions(void);
+
+ // GUI
+ Gui *_gui;
+ NewGui *_newgui;
+
+ Dialog *_pauseDialog;
+ Dialog *_optionsDialog;
+ Dialog *_saveLoadDialog;
+
+ void pauseDialog();
+ void saveloadDialog();
+ void optionsDialog();
+
+ // Misc startup/event functions
void main();
void parseCommandLine(int argc, char **argv);
void showHelpAndExit();
bool detectGame();
void processKbd();
- void clear_fullRedraw();
int checkKeyHit();
void convertKeysToClicks();
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 8e6d7a895e..28490fb82c 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -29,6 +29,7 @@
#include "scumm/bundle.h"
#include "actor.h"
#include "debug.h"
+#include "dialogs.h"
#include "gameDetector.h"
#include "gui/gui.h"
#include "gui/newgui.h"
@@ -68,9 +69,8 @@ uint Scumm::getRandomNumberRng(uint min, uint max)
return getRandomNumber(max - min) + min;
}
-
Scumm::Scumm (GameDetector *detector, OSystem *syst)
- : Engine(detector, syst)
+ : Engine(detector, syst), _pauseDialog(0), _optionsDialog(0), _saveLoadDialog(0)
{
OSystem::Property prop;
@@ -156,8 +156,17 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
Scumm::~Scumm ()
{
delete [] _actors;
+
+ if (_pauseDialog)
+ delete _pauseDialog;
+ if (_optionsDialog)
+ delete _optionsDialog;
+ if (_saveLoadDialog)
+ delete _saveLoadDialog;
+
delete _gui;
delete _newgui;
+
delete _bundle;
delete _sound;
delete _imuse;
@@ -459,7 +468,7 @@ int Scumm::scummLoop(int delta)
}
processActors();
- clear_fullRedraw();
+ _fullRedraw = false;
cyclePalette();
palManipulate();
@@ -883,12 +892,6 @@ void Scumm::dumpResource(char *tag, int idx, byte *ptr)
out.close();
}
-
-void Scumm::clear_fullRedraw()
-{
- _fullRedraw = 0;
-}
-
void Scumm::clearClickedStatus()
{
checkKeyHit();
@@ -907,7 +910,7 @@ int Scumm::checkKeyHit()
void Scumm::pauseGame(bool user)
{
//_gui->pause();
- _newgui->pauseDialog();
+ pauseDialog();
}
void Scumm::setOptions()
@@ -916,6 +919,27 @@ void Scumm::setOptions()
//_newgui->optionsDialog();
}
+void Scumm::pauseDialog()
+{
+ if (!_pauseDialog)
+ _pauseDialog = new PauseDialog(_newgui, this);
+ _pauseDialog->open();
+}
+
+void Scumm::saveloadDialog()
+{
+ if (!_saveLoadDialog)
+ _saveLoadDialog = new SaveLoadDialog(_newgui, this);
+ _saveLoadDialog->open();
+}
+
+void Scumm::optionsDialog()
+{
+ if (!_optionsDialog)
+ _optionsDialog = new OptionsDialog(_newgui, this);
+ _optionsDialog->open();
+}
+
void Scumm::shutDown(int i)
{
/* TODO: implement this */
@@ -1017,7 +1041,7 @@ void Scumm::processKbd()
_vars[VAR_CHARINC] = _defaultTalkDelay / 20;
} else if (_lastKeyHit == 321) { // F7, display new GUI
- _newgui->saveloadDialog();
+ saveloadDialog();
}
_mouseButStat = _lastKeyHit;
@@ -1510,12 +1534,6 @@ void Scumm::setupGUIColors() {
_gui->_textcolor = getDefaultGUIColor(2);
_gui->_textcolorhi = getDefaultGUIColor(6);
_gui->_shadowcolor = getDefaultGUIColor(8);
-
- _newgui->_bgcolor = _gui->_bgcolor;
- _newgui->_color = _gui->_color;
- _newgui->_textcolor = _gui->_textcolor;
- _newgui->_textcolorhi = _gui->_textcolorhi;
- _newgui->_shadowcolor = _gui->_shadowcolor;
}
}