[Scummvm-cvs-logs] CVS: scummvm/queen input.cpp,NONE,1.1 input.h,NONE,1.1 cutaway.cpp,1.43,1.44 cutaway.h,1.20,1.21 defs.h,1.11,1.12 display.cpp,1.11,1.12 graphics.cpp,1.33,1.34 graphics.h,1.31,1.32 logic.cpp,1.54,1.55 logic.h,1.39,1.40 module.mk,1.11,1.12 queen.cpp,1.22,1.23 queen.h,1.11,1.12 sound.cpp,1.1,1.2 sound.h,1.1,1.2 talk.cpp,1.21,1.22 talk.h,1.12,1.13 walk.cpp,1.13,1.14 xref.txt,1.15,1.16
David Eriksson
twogood at users.sourceforge.net
Sat Oct 25 09:09:01 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/base gameDetector.cpp,1.41,1.42
- Next message: [Scummvm-cvs-logs] CVS: scummvm/queen defs.h,1.17,1.18 logic.h,1.44,1.45 logic.cpp,1.60,1.61 xref.txt,1.20,1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv25197/queen
Modified Files:
cutaway.cpp cutaway.h defs.h display.cpp graphics.cpp
graphics.h logic.cpp logic.h module.mk queen.cpp queen.h
sound.cpp sound.h talk.cpp talk.h walk.cpp xref.txt
Added Files:
input.cpp input.h
Log Message:
Initial version of the Input class. Some things still missing.
--- NEW FILE: input.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2003 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/queen/input.cpp,v 1.1 2003/10/23 06:44:35 twogood Exp $
*
*/
#include "stdafx.h"
#include "queen/input.h"
#include "common/system.h"
#include "common/util.h"
namespace Queen {
Input::Input(OSystem *system) :
_system(system), _fastMode(false), _keyVerb(VERB_NONE),
_cutawayRunning(false), _cutQuit(false), _talkQuit(false) {
}
void Input::delay() {
delay(_fastMode ? DELAY_SHORT : DELAY_NORMAL);
}
void Input::delay(uint amount) {
OSystem::Event event;
uint32 start = _system->get_msecs();
uint32 cur = start;
_key_pressed = 0; //reset
do {
while (_system->poll_event(&event)) {
switch (event.event_code) {
case OSystem::EVENT_KEYDOWN:
if (event.kbd.flags == OSystem::KBD_CTRL) {
if (event.kbd.keycode == 'f') {
_fastMode ^= 1;
break;
}
if (event.kbd.keycode == 'g') {
_fastMode ^= 2;
break;
}
}
debug(1, "event.kbd.keycode = %i (%c)",
event.kbd.keycode,
isprint(event.kbd.keycode) ? event.kbd.keycode : '.');
// Make sure backspace works right (this fixes a small issue on OS X)
if (event.kbd.keycode == 8)
_key_pressed = 8;
else
_key_pressed = (byte)event.kbd.ascii;
break;
case OSystem::EVENT_MOUSEMOVE:
_sdl_mouse_x = event.mouse.x;
_sdl_mouse_y = event.mouse.y;
break;
case OSystem::EVENT_LBUTTONDOWN:
#ifdef _WIN32_WCE
_sdl_mouse_x = event.mouse.x;
_sdl_mouse_y = event.mouse.y;
#endif
break;
case OSystem::EVENT_RBUTTONDOWN:
break;
case OSystem::EVENT_QUIT:
_system->quit();
break;
default:
break;
}
}
if (amount == 0)
break;
{
uint this_delay = 20; // 1?
if (this_delay > amount)
this_delay = amount;
_system->delay_msecs(this_delay);
}
cur = _system->get_msecs();
} while (cur < start + amount);
}
void Input::checkKeys() {
}
} // End of namespace Queen
--- NEW FILE: input.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2003 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/queen/input.h,v 1.1 2003/10/23 06:44:35 twogood Exp $
*
*/
#ifndef INPUT_H
#define INPUT_H
#include "queen/defs.h"
class OSystem;
namespace Queen {
class Input {
public:
//! Adjust here to change delays!
enum {
DELAY_SHORT = 10,
DELAY_NORMAL = 100
};
Input(OSystem *system);
//! calls the other delay() with a value adjusted depending on _fastMode
void delay();
//! moved QueenEngine::delay() here
void delay(uint amount);
//! convert input to verb
void checkKeys();
//! use instead of KEYVERB=0
void clearKeyVerb() { _keyVerb = VERB_NONE; }
//! _keyVerb is open/close/move/give/look at/pick up/talk to
bool verbIsPanelCommand() {
return
_keyVerb >= VERB_PANEL_COMMAND_FIRST &&
_keyVerb <= VERB_PANEL_COMMAND_LAST;
}
//! return _keyVerb if isPanelCommand() is true, otherwise VERB_NONE
Verb verbPanelCommand();
//! If _keyVerb is VERB_USE_JOURNAL
bool verbUseJournal() { return _keyVerb == VERB_USE_JOURNAL; }
//! If _keyVerb is VERB_KEY_1 to VERB_KEY_4
bool verbIsDigit() {
return
_keyVerb >= VERB_DIGIT_FIRST &&
_keyVerb <= VERB_DIGIT_LAST;
}
//! Returns 1-4 if keyDigit() is true, otherwise -1
int verbDigit();
bool cutQuit() { return _cutQuit; }
void cutQuitReset() { _cutQuit = false; }
bool talkQuit() { return _talkQuit; }
void talkQuitReset() { _talkQuit = false; }
void fastMode(bool fm) { _fastMode = fm; }
private:
//! Used to get keyboard and mouse events
OSystem *_system;
//! Some cutaways require update() run faster
bool _fastMode;
//! The current verb received from keyboard
Verb _keyVerb; // KEYVERB
//! set if a cutaway is running
bool _cutawayRunning; // CUTON
//! moved Cutaway::_quit here
bool _cutQuit; // CUTQUIT
//! moved Talk::_quit here
bool _talkQuit; // TALKQUIT
//! Set by delay();
int _key_pressed;
//! Set by delay();
int _sdl_mouse_x, _sdl_mouse_y;
};
} // End of namespace Queen
#endif
Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- cutaway.cpp 21 Oct 2003 13:18:02 -0000 1.43
+++ cutaway.cpp 23 Oct 2003 06:44:35 -0000 1.44
@@ -23,6 +23,7 @@
#include "cutaway.h"
#include "display.h"
#include "graphics.h"
+#include "input.h"
#include "sound.h"
#include "talk.h"
#include "walk.h"
@@ -64,10 +65,11 @@
const char *filename,
char *nextFilename,
Graphics *graphics,
+ Input *input,
Logic *logic,
Resource *resource,
Sound *sound) {
- Cutaway *cutaway = new Cutaway(filename, graphics, logic, resource, sound);
+ Cutaway *cutaway = new Cutaway(filename, graphics, input, logic, resource, sound);
cutaway->run(nextFilename);
delete cutaway;
}
@@ -75,10 +77,11 @@
Cutaway::Cutaway(
const char *filename,
Graphics *graphics,
+ Input *input,
Logic *logic,
Resource *resource,
Sound *sound)
-: _graphics(graphics), _logic(logic), _resource(resource), _sound(sound), _walk(logic->walk()),
+: _graphics(graphics), _input(input), _logic(logic), _resource(resource), _sound(sound), _walk(logic->walk()),
_quit(false), _personDataCount(0), _personFaceCount(0), _lastSong(0), _songBeforeComic(0) {
memset(&_bankNames, 0, sizeof(_bankNames));
load(filename);
@@ -304,7 +307,7 @@
for (i = 5; i <= 100; i +=5) {
bob->scale = i;
bob->y -= 4;
- _graphics->update();
+ _logic->update();
}
}
break;
@@ -324,9 +327,8 @@
BobSlot *bob_thugB2 = _graphics->bob(26);
_graphics->cameraBob(-1);
- // XXX fastmode = 1;
-
- _graphics->update(true);
+ _input->fastMode(true);
+ _logic->update();
int i = 4, k = 160;
@@ -372,14 +374,14 @@
bob_thugB1->x -= i * 4;
bob_thugB2->x -= i * 4;
- _graphics->update(true);
+ _logic->update();
if (_quit)
return;
}
- // XXX fastmode = 0;
+ _input->fastMode(false);
}
break;
@@ -400,9 +402,9 @@
BobSlot *bob_hands = _graphics->bob(24);
_graphics->cameraBob(-1);
- // XXX fastmode = 1;
+ _input->fastMode(true);
- _graphics->update(true);
+ _logic->update();
bob_box ->x += 280 * 2;
bob_beam ->x += 30;
@@ -427,14 +429,14 @@
bob_clock->x -= i * 2;
bob_hands->x -= i * 2;
- _graphics->update(true);
+ _logic->update();
if (_quit)
return;
}
- // XXX fastmode = 0;
+ _input->fastMode(false);
}
break;
@@ -447,7 +449,7 @@
BobSlot *bob22 = _graphics->bob(22);
_graphics->cameraBob(-1);
- // XXX fastmode = 1;
+ _input->fastMode(true);
int horizontalScroll = display->horizontalScroll();
@@ -466,14 +468,14 @@
bob22->x += i;
- _graphics->update(true);
+ _logic->update();
if (_quit)
return;
}
- // XXX fastmode = 0;
+ _input->fastMode(false);
}
break;
@@ -928,7 +930,7 @@
int j;
for (j = 0; j < objAnim[i].speed; j++)
- _graphics->update();
+ _logic->update();
}
if (_quit)
@@ -951,7 +953,7 @@
while (moving) {
moving = false;
- _graphics->update();
+ _logic->update();
for (i = 0; i < frameCount; i++) {
BobSlot *bob = _graphics->bob(objAnim[i].object);
@@ -1043,7 +1045,7 @@
char voiceFilePrefix[MAX_STRING_SIZE];
findCdCut(_basename, index, voiceFilePrefix);
Talk::speak(sentence, (object.objectNumber == OBJECT_JOE) ? NULL : &p, voiceFilePrefix,
- _graphics, _logic, _resource, _sound);
+ _graphics, _input, _logic, _resource, _sound);
}
}
@@ -1401,7 +1403,7 @@
if (0 == scumm_stricmp(right(_talkFile, 4), ".dog")) {
nextFilename[0] = '\0';
- Talk::talk(_talkFile, 0 /* XXX */, nextFilename, _graphics, _logic, _resource, _sound);
+ Talk::talk(_talkFile, 0 /* XXX */, nextFilename, _graphics, _input, _logic, _resource, _sound);
}
}
@@ -1487,7 +1489,7 @@
int i;
for (i = 0; i < spaces; i++) {
- _graphics->update();
+ _logic->update();
if (OBJECT_TYPE_TEXT_SPEAK == type || OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK == type) {
// XXX: see if speaking is finished
@@ -1504,7 +1506,7 @@
}
_graphics->textClear(0,198);
- _graphics->update();
+ _logic->update();
}
int Cutaway::countSpaces(ObjectType type, const char *segment) {
Index: cutaway.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- cutaway.h 21 Oct 2003 13:18:02 -0000 1.20
+++ cutaway.h 23 Oct 2003 06:44:35 -0000 1.21
@@ -41,6 +41,7 @@
const char *filename,
char *nextFilename,
Graphics *graphics,
+ Input *input,
Logic *logic,
Resource *resource,
Sound *sound);
@@ -136,6 +137,7 @@
};
Graphics *_graphics;
+ Input *_input;
Logic *_logic;
Resource *_resource;
Sound *_sound;
@@ -214,6 +216,7 @@
Cutaway(
const char *filename,
Graphics *graphics,
+ Input *input,
Logic *logic,
Resource *resource,
Sound *sound);
Index: defs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/defs.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- defs.h 21 Oct 2003 09:05:15 -0000 1.11
+++ defs.h 23 Oct 2003 06:44:35 -0000 1.12
@@ -108,21 +108,31 @@
enum Verb {
+ VERB_NONE = 0,
+
+ VERB_PANEL_COMMAND_FIRST = 1,
VERB_OPEN = 1,
VERB_CLOSE = 2,
VERB_MOVE = 3,
+ // no verb 4
VERB_GIVE = 5,
VERB_USE = 6,
VERB_PICK_UP = 7,
VERB_LOOK_AT = 9,
VERB_TALK_TO = 8,
+ VERB_PANEL_COMMAND_LAST = 8,
+
VERB_WALK_TO = 10,
VERB_SCROLL_UP = 11,
VERB_SCROLL_DOWN = 12,
- VERB_INV_ITEM1 = 13,
- VERB_INV_ITEM2 = 14,
- VERB_INV_ITEM3 = 15,
- VERB_INV_ITEM4 = 16,
+
+ VERB_DIGIT_FIRST = 13,
+ VERB_KEY_1 = 13,
+ VERB_KEY_2 = 14,
+ VERB_KEY_3 = 15,
+ VERB_KEY_4 = 16,
+ VERB_DIGIT_LAST = 16,
+
VERB_USE_JOURNAL = 20,
VERB_SKIP_TEXT = 101
};
Index: display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- display.cpp 21 Oct 2003 17:32:51 -0000 1.11
+++ display.cpp 23 Oct 2003 06:44:35 -0000 1.12
@@ -592,7 +592,7 @@
// set flash palette
palSet(tempPal, 0, 255, true);
// restore original palette
- palSet(_pals.screen, 0, 255, true);
+ // palSet(_pals.screen, 0, 255, true);
}
Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- graphics.cpp 21 Oct 2003 12:07:33 -0000 1.33
+++ graphics.cpp 23 Oct 2003 06:44:35 -0000 1.34
@@ -27,8 +27,8 @@
namespace Queen {
-Graphics::Graphics(Display *display, Resource *resource)
- : _cameraBob(0), _display(display), _resource(resource) {
+Graphics::Graphics(Display *display, Input *input, Resource *resource)
+ : _cameraBob(0), _display(display), _input(input), _resource(resource) {
memset(_frames, 0, sizeof(_frames));
memset(_banks, 0, sizeof(_banks));
@@ -727,7 +727,6 @@
if (room >= 90) {
_cameraBob = 0;
}
- _lastRoom = room; // TEMP
}
@@ -806,26 +805,16 @@
}
-void Graphics::update(bool fastmode) {
+void Graphics::update(uint16 room) {
// FIXME: temporary code, move to Logic::update()
bobSortAll();
if (_cameraBob >= 0) {
_display->horizontalScrollUpdate(_bobs[_cameraBob].x);
}
- // FIXME: currently, we use the _lastRoom variable only
- // to know in which current room we are. This is necessary
- // for the parallax stuff as it relies on the room number.
- // When we switch to the Logic::update() method, we will be
- // able to get rid of this variable...
- bobCustomParallax(_lastRoom);
+ bobCustomParallax(room);
_display->prepareUpdate();
bobDrawAll();
textDrawAll();
- if (!fastmode) {
- g_queen->delay(100);
- }
- _display->palCustomScroll(_lastRoom);
- _display->update(_bobs[0].active, _bobs[0].x, _bobs[0].y);
}
void Graphics::bobSetText(
Index: graphics.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- graphics.h 21 Oct 2003 12:07:33 -0000 1.31
+++ graphics.h 23 Oct 2003 06:44:35 -0000 1.32
@@ -23,6 +23,7 @@
#define QUEENGRAPHICS_H
#include "queen/queen.h"
+#include "queen/input.h"
#include "queen/defs.h"
#include "queen/structs.h"
@@ -105,11 +106,12 @@
class Display;
+class Input;
class Graphics {
public:
- Graphics(Display *display, Resource *resource);
+ Graphics(Display *display, Input *input, Resource *resource);
~Graphics();
void bankLoad(const char *bankname, uint32 bankslot); // loadbank()
@@ -161,7 +163,7 @@
void cameraBob(int bobNum);
int cameraBob() { return _cameraBob; }
- void update(bool fastmode = false);
+ void update(uint16 room);
private:
@@ -199,9 +201,8 @@
int _cameraBob; // cambob
- uint16 _lastRoom; // TEMP
-
Display *_display;
+ Input *_input;
Resource *_resource;
};
Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- logic.cpp 21 Oct 2003 12:29:37 -0000 1.54
+++ logic.cpp 23 Oct 2003 06:44:35 -0000 1.55
@@ -25,13 +25,15 @@
#include "queen/defs.h"
#include "queen/display.h"
#include "queen/graphics.h"
+#include "queen/input.h"
#include "queen/walk.h"
namespace Queen {
-Logic::Logic(Resource *resource, Graphics *graphics, Display *theDisplay, Sound *sound)
- : _resource(resource), _graphics(graphics), _display(theDisplay), _sound(sound), _talkSpeed(DEFAULT_TALK_SPEED) {
+Logic::Logic(Resource *resource, Graphics *graphics, Display *theDisplay, Input *input, Sound *sound)
+ : _resource(resource), _graphics(graphics), _display(theDisplay),
+ _input(input), _sound(sound), _talkSpeed(DEFAULT_TALK_SPEED) {
_jas = _resource->loadFile("QUEEN.JAS", 20);
_joe.x = _joe.y = 0;
_joe.scale = 100;
@@ -1124,7 +1126,7 @@
// FIXME: commented for now, to avoid color glitches when
// switching rooms during cutaway
// if (mode != RDM_NOFADE_JOE) {
- _graphics->update();
+ update();
if (_currentRoom >= 114) {
_display->palFadeIn(0, 255, _currentRoom);
}
@@ -1609,26 +1611,26 @@
if (_joe.facing == DIR_FRONT) {
if (_joe.prevFacing == DIR_BACK) {
pbs->frameNum = 33 + FRAMES_JOE_XTRA;
- _graphics->update();
+ update();
}
frame = 34;
}
else if (_joe.facing == DIR_BACK) {
if (_joe.prevFacing == DIR_FRONT) {
pbs->frameNum = 33 + FRAMES_JOE_XTRA;
- _graphics->update();
+ update();
}
frame = 35;
}
else if ((_joe.facing == DIR_LEFT && _joe.prevFacing == DIR_RIGHT)
|| (_joe.facing == DIR_RIGHT && _joe.prevFacing == DIR_LEFT)) {
pbs->frameNum = 34 + FRAMES_JOE_XTRA;
- _graphics->update();
+ update();
}
pbs->frameNum = frame + FRAMES_JOE_XTRA;
pbs->scale = _joe.scale;
pbs->xflip = (_joe.facing == DIR_LEFT);
- _graphics->update();
+ update();
_joe.prevFacing = _joe.facing;
switch (frame) {
case 33: frame = 1; break;
@@ -1755,12 +1757,12 @@
_graphics->bankUnpack(5, 29 + FRAMES_JOE_XTRA, 7);
bobJoe->xflip = (_joe.facing == DIR_LEFT);
bobJoe->scale = _joe.scale;
- _graphics->update();
+ update();
// grab up
_graphics->bankUnpack(7, 29 + FRAMES_JOE_XTRA, 7);
bobJoe->xflip = (_joe.facing == DIR_LEFT);
bobJoe->scale = _joe.scale;
- _graphics->update();
+ update();
// turn back
if (speed == 0) {
frame = 7;
@@ -1775,12 +1777,12 @@
_graphics->bankUnpack(frame, 29 + FRAMES_JOE_XTRA, 7);
bobJoe->xflip = (_joe.facing == DIR_LEFT);
bobJoe->scale = _joe.scale;
- _graphics->update();
+ update();
// extra delay for grab down
if (grab == STATE_GRAB_DOWN) {
- _graphics->update();
- _graphics->update();
+ update();
+ update();
}
if (speed > 0) {
@@ -1838,9 +1840,17 @@
void Logic::playCutaway(const char* cutFile) {
char next[20];
- Cutaway::run(cutFile, next, _graphics, this, _resource, _sound);
+ Cutaway::run(cutFile, next, _graphics, _input, this, _resource, _sound);
}
+void Logic::update() {
+ _graphics->update(_currentRoom);
+ _input->delay();
+ _display->palCustomScroll(_currentRoom);
+ BobSlot *joe = _graphics->bob(0);
+ _display->update(joe->active, joe->x, joe->y);
+ _input->checkKeys();
+}
} // End of namespace Queen
Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- logic.h 21 Oct 2003 12:29:37 -0000 1.39
+++ logic.h 23 Oct 2003 06:44:35 -0000 1.40
@@ -54,13 +54,14 @@
class Graphics;
class Resource;
class Display;
+class Input;
class Sound;
class Walk;
class Logic {
public:
- Logic(Resource *resource, Graphics *graphics, Display *display, Sound *sound);
+ Logic(Resource *resource, Graphics *graphics, Display *display, Input *input, Sound *sound);
~Logic();
uint16 currentRoom();
@@ -182,6 +183,8 @@
Display *display() { return _display; }
+ void update();
+
protected:
bool _textToggle;
bool _speechToggle;
@@ -277,6 +280,7 @@
Resource *_resource;
Graphics *_graphics;
Display *_display;
+ Input *_input;
Sound *_sound;
Walk *_walk;
Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/module.mk,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- module.mk 21 Oct 2003 12:29:37 -0000 1.11
+++ module.mk 23 Oct 2003 06:44:35 -0000 1.12
@@ -4,6 +4,7 @@
queen/cutaway.o \
queen/display.o \
queen/graphics.o \
+ queen/input.o \
queen/logic.o \
queen/queen.o \
queen/resource.o \
Index: queen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- queen.cpp 21 Oct 2003 12:29:37 -0000 1.22
+++ queen.cpp 23 Oct 2003 06:44:35 -0000 1.23
@@ -28,6 +28,7 @@
#include "queen/cutaway.h"
#include "queen/display.h"
#include "queen/graphics.h"
+#include "queen/input.h"
#include "queen/queen.h"
#include "queen/sound.h"
#include "queen/talk.h"
@@ -85,13 +86,9 @@
namespace Queen {
-QueenEngine *g_queen;
-
QueenEngine::QueenEngine(GameDetector *detector, OSystem *syst)
: Engine(detector, syst) {
- g_queen = this;
-
_game = detector->_game.id;
if (!_mixer->bindToSystem(syst))
@@ -111,8 +108,10 @@
QueenEngine::~QueenEngine() {
delete _resource;
delete _display;
+ delete _logic;
delete _graphics;
delete _logic;
+ delete _input;
}
void QueenEngine::errorString(const char *buf1, char *buf2) {
@@ -132,35 +131,33 @@
// XXX fadeout(0,223);
}
else if (_logic->currentRoom() == 95 && _logic->gameState(VAR_INTRO_PLAYED) == 0) {
- char nextFilename[20];
-
_logic->roomDisplay(_logic->roomName(_logic->currentRoom()), RDM_FADE_NOJOE, 100, 2, true);
if (_resource->isDemo()) {
if (_resource->exists("pclogo.cut"))
- Cutaway::run("pclogo.cut", nextFilename, _graphics, _logic, _resource, _sound);
+ _logic->playCutaway("pclogo.cut");
else
- Cutaway::run("clogo.cut", nextFilename, _graphics, _logic, _resource, _sound);
+ _logic->playCutaway("clogo.cut");
}
else {
- Cutaway::run("copy.cut", nextFilename, _graphics, _logic, _resource, _sound);
- Cutaway::run("clogo.cut", nextFilename, _graphics, _logic, _resource, _sound);
+ _logic->playCutaway("copy.cut");
+ _logic->playCutaway("clogo.cut");
// TODO enable talking for talkie version
- Cutaway::run("cdint.cut", nextFilename, _graphics, _logic, _resource, _sound);
+ _logic->playCutaway("cdint.cut");
// restore palette colors ranging from 144 to 256
_graphics->loadPanel();
- Cutaway::run("cred.cut", nextFilename, _graphics, _logic, _resource, _sound);
+ _logic->playCutaway("cred.cut");
}
_logic->currentRoom(73);
_logic->entryObj(584);
_logic->roomDisplay(_logic->roomName(_logic->currentRoom()), RDM_FADE_JOE, 100, 2, true);
- Cutaway::run("c70d.cut", nextFilename, _graphics, _logic, _resource, _sound);
+ _logic->playCutaway("c70d.cut");
_logic->gameState(VAR_INTRO_PLAYED, 1);
@@ -188,7 +185,7 @@
// queen.c lines 4080-4104
if (_logic->newRoom() > 0) {
_graphics->textClear(151, 151);
- _graphics->update();
+ _logic->update();
_logic->oldRoom(_logic->currentRoom());
_logic->currentRoom(_logic->newRoom());
roomChanged();
@@ -211,18 +208,15 @@
break; // XXX don't loop yet
}
-
- while (1) { //main loop
- delay(1000);
- }
}
void QueenEngine::initialise(void) {
_resource = new Resource(_gameDataPath, _detector->_game.detectname);
_display = new Display(_system);
- _graphics = new Graphics(_display, _resource);
- _sound = Sound::giveSound(_mixer, _resource, _resource->compression());
- _logic = new Logic(_resource, _graphics, _display, _sound);
+ _input = new Input(_system);
+ _graphics = new Graphics(_display, _input, _resource);
+ _sound = Sound::giveSound(_mixer, _input, _resource, _resource->compression());
+ _logic = new Logic(_resource, _graphics, _display, _input, _sound);
_timer->installTimerProc(&timerHandler, 1000000 / 50, this); //call 50 times per second
}
@@ -236,75 +230,6 @@
void QueenEngine::gotTimerTick() {
_display->handleTimer();
-}
-
-
-void QueenEngine::delay(uint amount) {
-
- OSystem::Event event;
-
- uint32 start = _system->get_msecs();
- uint32 cur = start;
- _key_pressed = 0; //reset
-
- do {
- while (_system->poll_event(&event)) {
- switch (event.event_code) {
- case OSystem::EVENT_KEYDOWN:
- if (event.kbd.flags == OSystem::KBD_CTRL) {
- if (event.kbd.keycode == 'f') {
- _fastMode ^= 1;
- break;
- }
- if (event.kbd.keycode == 'g') {
- _fastMode ^= 2;
- break;
- }
- }
-
- // Make sure backspace works right (this fixes a small issue on OS X)
- if (event.kbd.keycode == 8)
- _key_pressed = 8;
- else
- _key_pressed = (byte)event.kbd.ascii;
- break;
-
- case OSystem::EVENT_MOUSEMOVE:
- _sdl_mouse_x = event.mouse.x;
- _sdl_mouse_y = event.mouse.y;
-
- break;
-
- case OSystem::EVENT_LBUTTONDOWN:
-#ifdef _WIN32_WCE
- _sdl_mouse_x = event.mouse.x;
- _sdl_mouse_y = event.mouse.y;
-#endif
- break;
-
- case OSystem::EVENT_RBUTTONDOWN:
- break;
-
- case OSystem::EVENT_QUIT:
- _system->quit();
- break;
-
- default:
- break;
- }
- }
-
- if (amount == 0)
- break;
-
- {
- uint this_delay = 20; // 1?
- if (this_delay > amount)
- this_delay = amount;
- _system->delay_msecs(this_delay);
- }
- cur = _system->get_msecs();
- } while (cur < start + amount);
}
} // End of namespace Queen
Index: queen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- queen.h 21 Oct 2003 12:29:37 -0000 1.11
+++ queen.h 23 Oct 2003 06:44:35 -0000 1.12
@@ -33,6 +33,7 @@
namespace Queen {
class Graphics;
+class Input;
class Logic;
class Display;
class Sound;
@@ -41,18 +42,17 @@
void errorString(const char *buf_input, char *buf_output);
protected:
byte _game;
- byte _key_pressed;
bool _quickLaunch; // set when starting with -x
uint16 _debugMode;
int _numScreenUpdates;
int _number_of_savegames;
- int _sdl_mouse_x, _sdl_mouse_y;
FILE *_dump_file;
Graphics *_graphics;
+ Input *_input;
Resource *_resource;
Logic *_logic;
Display *_display;
@@ -64,8 +64,6 @@
QueenEngine(GameDetector *detector, OSystem *syst);
virtual ~QueenEngine();
- void delay(uint amount);
-
protected:
byte _fastMode;
@@ -79,9 +77,6 @@
static void timerHandler(void *ptr);
void gotTimerTick();
};
-
-// XXX: Temporary hack to allow Graphics to call delay()
-extern QueenEngine *g_queen;
} // End of namespace Queen
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/sound.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- sound.cpp 21 Oct 2003 12:29:37 -0000 1.1
+++ sound.cpp 23 Oct 2003 06:44:35 -0000 1.2
@@ -22,37 +22,38 @@
#include "stdafx.h"
#include "common/file.h"
#include "common/util.h"
+#include "queen/input.h"
#include "queen/resource.h"
#include "queen/sound.h"
-#include "queen/queen.h" //g_queen (temporary)
#define SB_HEADER_SIZE 110
namespace Queen {
-Sound::Sound(SoundMixer *mixer, Resource *resource) : _mixer(mixer), _resource(resource), _sfxHandle(0) {
+Sound::Sound(SoundMixer *mixer, Input *input, Resource *resource) :
+ _mixer(mixer), _input(input), _resource(resource), _sfxHandle(0) {
}
Sound::~Sound() {
}
-Sound *Sound::giveSound(SoundMixer *mixer, Resource *resource, uint8 compression) {
+Sound *Sound::giveSound(SoundMixer *mixer, Input *input, Resource *resource, uint8 compression) {
switch(compression) {
case COMPRESSION_NONE:
- return new SBSound(mixer, resource);
+ return new SBSound(mixer, input, resource);
break;
case COMPRESSION_MP3:
#ifndef USE_MAD
warning("Using MP3 compressed datafile, but MP3 support not compiled in");
- return new SilentSound(mixer, resource);
+ return new SilentSound(mixer, input, resource);
#else
- return new MP3Sound(mixer, resource);
+ return new MP3Sound(mixer, input, resource);
#endif
break;
default:
warning("Unknown compression type");
- return new SilentSound(mixer, resource);
+ return new SilentSound(mixer, input, resource);
}
}
@@ -76,7 +77,7 @@
strcat(name, ".SB");
while(isPlaying())
- g_queen->delay(10);
+ _input->delay(10);
if (_resource->exists(name))
playSound(_resource->loadFile(name, SB_HEADER_SIZE), _resource->fileSize(name) - SB_HEADER_SIZE);
@@ -94,7 +95,7 @@
strcat(name, ".SB");
while(isPlaying())
- g_queen->delay(10);
+ _input->delay(10);
if (_resource->exists(name))
_mixer->playMP3(&_sfxHandle, _resource->giveMP3(name), _resource->fileSize(name));
Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/sound.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- sound.h 21 Oct 2003 12:29:37 -0000 1.1
+++ sound.h 23 Oct 2003 06:44:35 -0000 1.2
@@ -28,18 +28,20 @@
namespace Queen {
+class Input;
class Resource;
class Sound {
public:
- Sound(SoundMixer *mixer, Resource *resource);
+ Sound(SoundMixer *mixer, Input *input, Resource *resource);
virtual ~Sound();
virtual void sfxPlay(const char *base) = 0;
- static Sound *giveSound(SoundMixer *mixer, Resource *resource, uint8 compression);
+ static Sound *giveSound(SoundMixer *mixer, Input *input, Resource *resource, uint8 compression);
bool isPlaying();
protected:
SoundMixer *_mixer;
+ Input *_input;
Resource *_resource;
PlayingSoundHandle _sfxHandle;
@@ -47,13 +49,13 @@
class SilentSound : public Sound {
public:
- SilentSound(SoundMixer *mixer, Resource *resource) : Sound(mixer, resource) {};
+ SilentSound(SoundMixer *mixer, Input *input, Resource *resource) : Sound(mixer, input, resource) {};
void sfxPlay(const char *base) { }
};
class SBSound : public Sound {
public:
- SBSound(SoundMixer *mixer, Resource *resource) : Sound(mixer, resource) {};
+ SBSound(SoundMixer *mixer, Input *input, Resource *resource) : Sound(mixer, input, resource) {};
int playSound(byte *sound, uint32 size);
void sfxPlay(const char *base);
};
@@ -61,7 +63,7 @@
#ifdef USE_MAD
class MP3Sound : public Sound {
public:
- MP3Sound(SoundMixer *mixer, Resource *resource) : Sound(mixer, resource) {};
+ MP3Sound(SoundMixer *mixer, Input *input, Resource *resource) : Sound(mixer, input, resource) {};
void sfxPlay(const char *base);
};
#endif
Index: talk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- talk.cpp 21 Oct 2003 13:17:11 -0000 1.21
+++ talk.cpp 23 Oct 2003 06:44:35 -0000 1.22
@@ -38,10 +38,11 @@
int personInRoom,
char *cutawayFilename,
Graphics *graphics,
+ Input *input,
Logic *logic,
Resource *resource,
Sound *sound) {
- Talk *talk = new Talk(graphics, logic, resource, sound);
+ Talk *talk = new Talk(graphics, input, logic, resource, sound);
talk->talk(filename, personInRoom, cutawayFilename);
delete talk;
}
@@ -51,10 +52,11 @@
Person *person,
const char *voiceFilePrefix,
Graphics *graphics,
+ Input *input,
Logic *logic,
Resource *resource,
Sound *sound) {
- Talk *talk = new Talk(graphics, logic, resource, sound);
+ Talk *talk = new Talk(graphics, input, logic, resource, sound);
bool result = talk->speak(sentence, person, voiceFilePrefix);
delete talk;
return result;
@@ -62,10 +64,12 @@
Talk::Talk(
Graphics *graphics,
+ Input *input,
Logic *logic,
Resource *resource,
- Sound *sound)
-: _graphics(graphics), _logic(logic), _resource(resource), _sound(sound), _fileData(NULL), _quit(false) {
+ Sound *sound) :
+ _graphics(graphics), _input(input), _logic(logic), _resource(resource),
+ _sound(sound), _fileData(NULL), _quit(false) {
//! TODO Move this to the Logic class later!
memset(_talkSelected, 0, sizeof(_talkSelected));
@@ -649,7 +653,7 @@
for (i = 0; i < 10; i++) {
if (_quit)
break;
- _graphics->update();
+ _logic->update();
}
return;
@@ -775,7 +779,7 @@
if (length == 0 && !isJoe && parameters->bf > 0) {
_graphics->bankOverpack(parameters->bf, startFrame, bankNum);
- _graphics->update();
+ _logic->update();
}
/* A12 = the frame pointer for the full body frame, well use this */
@@ -860,23 +864,23 @@
}
if (!_talkHead)
- _graphics->update();
+ _logic->update();
}
else
- _graphics->update();
+ _logic->update();
if (_logic->joeWalk() == 3) {
if (_quit)
break;
- _graphics->update();
+ _logic->update();
}
else {
if (_quit)
break;
// XXX CHECK_PLAYER();
- _graphics->update(); // XXX call it ourselves as CHECK_PLAYER is not called
+ _logic->update(); // XXX call it ourselves as CHECK_PLAYER is not called
if (_logic->joeWalk() == 2)
// Selected a command, so exit
@@ -939,7 +943,7 @@
}
}
- _graphics->update();
+ _logic->update();
}
const Talk::SpeechParameters *Talk::findSpeechParameters(
@@ -1120,7 +1124,7 @@
if (_quit)
break;
- _graphics->update();
+ _logic->update();
// XXX zone = zone(1, mouseX, mouseY);
Index: talk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- talk.h 21 Oct 2003 12:29:37 -0000 1.12
+++ talk.h 23 Oct 2003 06:44:35 -0000 1.13
@@ -41,6 +41,7 @@
int personInRoom,
char *cutawayFilename,
Graphics *graphics,
+ Input *input,
Logic *logic,
Resource *resource,
Sound *sound);
@@ -51,6 +52,7 @@
Person *person,
const char *voiceFilePrefix,
Graphics *graphics,
+ Input *input,
Logic *logic,
Resource *resource,
Sound *sound);
@@ -108,6 +110,7 @@
Common::RandomSource _randomizer;
Graphics *_graphics;
+ Input *_input;
Logic *_logic;
Resource *_resource;
Sound *_sound;
@@ -159,7 +162,7 @@
static const SpeechParameters _speechParameters[];
- Talk(Graphics *graphics, Logic *logic, Resource *resource, Sound *sound);
+ Talk(Graphics *graphics, Input *input, Logic *logic, Resource *resource, Sound *sound);
~Talk();
//! Perform talk in file and return a cutaway filename
Index: walk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/walk.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- walk.cpp 21 Oct 2003 09:05:15 -0000 1.13
+++ walk.cpp 23 Oct 2003 06:44:35 -0000 1.14
@@ -156,7 +156,7 @@
if (pbs->speed == 0) {
pbs->speed = 1;
}
- _graphics->update(); // CHECK_PLAYER();
+ _logic->update(); // CHECK_PLAYER();
if (_logic->joeWalk() == 2) { // || cutQuit
// we are about to do something else, so stop walking
interrupted = true;
@@ -290,7 +290,7 @@
}
while (pbs->moving) {
- _graphics->update();
+ _logic->update();
uint16 scale = pwd->area->calcScale(pbs->y);
pbs->scale = scale;
if (pbs->xmajor) {
Index: xref.txt
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/xref.txt,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- xref.txt 21 Oct 2003 09:05:16 -0000 1.15
+++ xref.txt 23 Oct 2003 06:44:35 -0000 1.16
@@ -142,15 +142,17 @@
INPUT
=====
+check_keys() Input::checkKeys()
+get_key() *not needed*
-
drawmouseflag
key_commands
key_language
-KEYVERB
+KEYVERB Input::_keyVerb
MKEY
MouseButton
mouseflag
-no_check_keys
+no_check_keys Input::_noCheckKeys
INVENTORY
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/base gameDetector.cpp,1.41,1.42
- Next message: [Scummvm-cvs-logs] CVS: scummvm/queen defs.h,1.17,1.18 logic.h,1.44,1.45 logic.cpp,1.60,1.61 xref.txt,1.20,1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list