[Scummvm-cvs-logs] CVS: scummvm init.cpp,1.12,1.13 newgui.cpp,1.6,1.7 newgui.h,1.6,1.7 scummvm.cpp,1.168,1.169
Max Horn
fingolfin at users.sourceforge.net
Sun Jul 7 17:11:05 CEST 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv26533
Modified Files:
init.cpp newgui.cpp newgui.h scummvm.cpp
Log Message:
delay creation of dialogs till they are used; fixed new pause dialog & use it instead of the old one; dirty area handling in new gui code is more logical/useful now
Index: init.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/init.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- init.cpp 5 Jul 2002 17:00:17 -0000 1.12
+++ init.cpp 8 Jul 2002 00:10:11 -0000 1.13
@@ -20,10 +20,10 @@
*
*/
-#include"stdafx.h"
-#include"scumm.h"
-#include"actor.h"
-#include"newgui.h"
+#include "stdafx.h"
+#include "scumm.h"
+#include "actor.h"
+#include "newgui.h"
Scumm::Scumm (void) {
_newgui = new NewGui(this);
Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- newgui.cpp 7 Jul 2002 23:37:47 -0000 1.6
+++ newgui.cpp 8 Jul 2002 00:10:11 -0000 1.7
@@ -39,31 +39,36 @@
* - ...
*/
-NewGui::NewGui(Scumm *s) : _s(s), _need_redraw(false)
+NewGui::NewGui(Scumm *s) : _s(s), _need_redraw(false), _pauseDialog(0),
+ _saveLoadDialog(0), _aboutDialog(0), _optionsDialog(0)
{
- _pauseDialog = new PauseDialog(this);
- _saveLoadDialog = new SaveLoadDialog(this);
-// _aboutDialog = new AboutDialog(this);
- _optionsDialog = new OptionsDialog(this);
}
void NewGui::pauseDialog()
{
+ if (!_pauseDialog)
+ _pauseDialog = new PauseDialog(this);
openDialog(_pauseDialog);
}
void NewGui::saveloadDialog()
{
+ if (!_saveLoadDialog)
+ _saveLoadDialog = new SaveLoadDialog(this);
openDialog(_saveLoadDialog);
}
void NewGui::aboutDialog()
{
+// if (!_aboutDialog)
+// _aboutDialog = new AboutDialog(this);
// openDialog(_aboutDialog);
}
void NewGui::optionsDialog()
{
+ if (!_optionsDialog)
+ _optionsDialog = new OptionsDialog(this);
openDialog(_optionsDialog);
}
@@ -183,10 +188,9 @@
#pragma mark -
-byte *NewGui::getBasePtr(int x, int y, VirtScreen *vs)
+byte *NewGui::getBasePtr(int x, int y)
{
- if (vs == NULL)
- vs = _s->findVirtScreen(y);
+ VirtScreen *vs = _s->findVirtScreen(y);
if (vs == NULL)
return NULL;
@@ -239,13 +243,10 @@
void NewGui::clearArea(int x, int y, int w, int h)
{
- VirtScreen *vs = _s->findVirtScreen(y);
- byte *ptr = getBasePtr(x, y, vs);
+ byte *ptr = getBasePtr(x, y);
if (ptr == NULL)
return;
- _s->setVirtscreenDirty(vs, x, y, x + w, y + h);
-
while (h--) {
for (int i = 0; i < w; i++)
ptr[i] = _bgcolor;
@@ -253,6 +254,14 @@
}
}
+void NewGui::setAreaDirty(int x, int y, int w, int h)
+{
+ VirtScreen *vs = _s->findVirtScreen(y);
+
+ if (vs != NULL)
+ _s->setVirtscreenDirty(vs, x, y, x + w, y + h);
+}
+
void NewGui::drawChar(const char str, int xx, int yy)
{
unsigned int buffer = 0, mask = 0, x, y;
@@ -309,8 +318,7 @@
*/
void NewGui::drawBitmap(uint32 bitmap[8], int x, int y, byte color)
{
- VirtScreen *vs = _s->findVirtScreen(y);
- byte *ptr = getBasePtr(x, y, vs);
+ byte *ptr = getBasePtr(x, y);
if (ptr == NULL)
return;
@@ -323,6 +331,4 @@
}
ptr += 320;
}
-
- _s->setVirtscreenDirty(vs, x, y, x + 8, y + 8);
}
Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- newgui.h 7 Jul 2002 23:37:47 -0000 1.6
+++ newgui.h 8 Jul 2002 00:10:11 -0000 1.7
@@ -25,7 +25,6 @@
class Dialog;
class Scumm;
-class VirtScreen;
// Extremly simple stack class, doesn't even do any error checking (for now)
class DialogStack {
@@ -93,10 +92,11 @@
public:
// Drawing
- byte *getBasePtr(int x, int y, VirtScreen *vs = 0);
+ byte *getBasePtr(int x, int y);
void box(int x, int y, int width, int height);
void line(int x, int y, int x2, int y2, byte color);
void clearArea(int x, int y, int w, int h);
+ void setAreaDirty(int x, int y, int w, int h);
void drawChar(const char c, int x, int y);
void drawString(const char *str, int x, int y, int w, byte color);
void drawBitmap(uint32 bitmap[8], int x, int y, byte color);
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -d -r1.168 -r1.169
--- scummvm.cpp 5 Jul 2002 17:00:18 -0000 1.168
+++ scummvm.cpp 8 Jul 2002 00:10:11 -0000 1.169
@@ -846,12 +846,14 @@
void Scumm::pauseGame(bool user)
{
- _gui->pause();
+ //_gui->pause();
+ _newgui->pauseDialog();
}
void Scumm::setOptions()
{
_gui->options();
+ //_newgui->optionsDialog();
}
void Scumm::shutDown(int i)
@@ -954,8 +956,6 @@
_defaultTalkDelay = 5;
_vars[VAR_CHARINC] = _defaultTalkDelay / 20;
- } else if (_lastKeyHit == 320) { // F6, display new GUI
- _newgui->pauseDialog();
} else if (_lastKeyHit == 321) { // F7, display new GUI
_newgui->saveloadDialog();
}
More information about the Scummvm-git-logs
mailing list