2011-02-14 09:37:27 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common/events.h"
|
|
|
|
#include "common/singleton.h"
|
|
|
|
#include "graphics/cursorman.h"
|
|
|
|
#include "common/system.h"
|
|
|
|
|
|
|
|
#include "tsage/events.h"
|
|
|
|
#include "tsage/core.h"
|
|
|
|
#include "tsage/staticres.h"
|
|
|
|
#include "tsage/tsage.h"
|
|
|
|
#include "tsage/globals.h"
|
|
|
|
|
2011-08-15 10:47:59 +00:00
|
|
|
namespace TsAGE {
|
2011-02-14 09:37:27 +00:00
|
|
|
|
2011-04-13 19:27:46 +00:00
|
|
|
EventsClass::EventsClass() {
|
2011-04-09 11:27:25 +00:00
|
|
|
_currentCursor = CURSOR_NONE;
|
2011-05-11 10:28:30 +00:00
|
|
|
_lastCursor = CURSOR_NONE;
|
2011-02-14 09:37:27 +00:00
|
|
|
_frameNumber = 0;
|
|
|
|
_priorFrameTime = 0;
|
|
|
|
_prevDelayFrame = 0;
|
2011-10-02 08:59:13 +00:00
|
|
|
g_saver->addListener(this);
|
|
|
|
g_saver->addLoadNotifier(&EventsClass::loadNotifierProc);
|
2011-02-14 09:37:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool EventsClass::pollEvent() {
|
|
|
|
uint32 milli = g_system->getMillis();
|
|
|
|
if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) {
|
|
|
|
_priorFrameTime = milli;
|
|
|
|
++_frameNumber;
|
|
|
|
|
2012-01-01 05:12:07 +00:00
|
|
|
// Update screen
|
2012-01-01 05:31:56 +00:00
|
|
|
GLOBALS._screenSurface.updateScreen();
|
2011-02-14 09:37:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!g_system->getEventManager()->pollEvent(_event)) return false;
|
|
|
|
|
|
|
|
// Handle keypress
|
|
|
|
switch (_event.type) {
|
|
|
|
case Common::EVENT_QUIT:
|
|
|
|
case Common::EVENT_RTL:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Common::EVENT_MOUSEMOVE:
|
|
|
|
case Common::EVENT_LBUTTONDOWN:
|
|
|
|
case Common::EVENT_LBUTTONUP:
|
|
|
|
case Common::EVENT_RBUTTONDOWN:
|
|
|
|
case Common::EVENT_RBUTTONUP:
|
|
|
|
// Keep a copy of the current mouse position
|
|
|
|
_mousePos = _event.mouse;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventsClass::waitForPress(int eventMask) {
|
|
|
|
Event evt;
|
2011-10-02 08:59:13 +00:00
|
|
|
while (!g_vm->shouldQuit() && !getEvent(evt, eventMask))
|
2011-02-14 09:37:27 +00:00
|
|
|
g_system->delayMillis(10);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Standard event retrieval, which only returns keyboard and mouse clicks
|
|
|
|
*/
|
|
|
|
bool EventsClass::getEvent(Event &evt, int eventMask) {
|
2011-10-02 08:59:13 +00:00
|
|
|
while (pollEvent() && !g_vm->shouldQuit()) {
|
2011-02-14 09:37:27 +00:00
|
|
|
evt.handled = false;
|
|
|
|
evt.eventType = EVENT_NONE;
|
|
|
|
evt.mousePos = _event.mouse;
|
|
|
|
evt.kbd = _event.kbd;
|
|
|
|
|
|
|
|
switch (_event.type) {
|
|
|
|
case Common::EVENT_MOUSEMOVE:
|
|
|
|
evt.eventType = EVENT_MOUSE_MOVE;
|
|
|
|
break;
|
|
|
|
case Common::EVENT_LBUTTONDOWN:
|
|
|
|
evt.eventType = EVENT_BUTTON_DOWN;
|
|
|
|
evt.btnState = BTNSHIFT_LEFT;
|
|
|
|
break;
|
|
|
|
case Common::EVENT_RBUTTONDOWN:
|
|
|
|
evt.eventType = EVENT_BUTTON_DOWN;
|
|
|
|
evt.btnState = BTNSHIFT_RIGHT;
|
|
|
|
break;
|
|
|
|
case Common::EVENT_MBUTTONDOWN:
|
|
|
|
evt.eventType = EVENT_BUTTON_DOWN;
|
|
|
|
evt.btnState = BTNSHIFT_MIDDLE;
|
|
|
|
break;
|
|
|
|
case Common::EVENT_LBUTTONUP:
|
|
|
|
case Common::EVENT_RBUTTONUP:
|
|
|
|
case Common::EVENT_MBUTTONUP:
|
|
|
|
evt.eventType = EVENT_BUTTON_UP;
|
|
|
|
evt.btnState = 0;
|
|
|
|
break;
|
|
|
|
case Common::EVENT_KEYDOWN:
|
|
|
|
evt.eventType = EVENT_KEYPRESS;
|
|
|
|
evt.kbd = _event.kbd;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (evt.eventType & eventMask)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-04-13 20:33:41 +00:00
|
|
|
evt.handled = false;
|
|
|
|
evt.eventType = EVENT_NONE;
|
|
|
|
|
2011-02-14 09:37:27 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the specified cursor
|
|
|
|
*
|
|
|
|
* @cursorType Specified cursor number
|
|
|
|
*/
|
|
|
|
void EventsClass::setCursor(CursorType cursorType) {
|
2011-05-11 10:28:30 +00:00
|
|
|
if (cursorType == _lastCursor)
|
2011-03-06 09:49:03 +00:00
|
|
|
return;
|
|
|
|
|
2011-05-11 10:28:30 +00:00
|
|
|
_lastCursor = cursorType;
|
2011-10-02 08:59:13 +00:00
|
|
|
g_globals->clearFlag(122);
|
2011-03-06 09:49:03 +00:00
|
|
|
CursorMan.showMouse(true);
|
2011-02-14 09:37:27 +00:00
|
|
|
|
|
|
|
const byte *cursor;
|
|
|
|
bool delFlag = true;
|
|
|
|
uint size;
|
2011-09-04 09:11:59 +00:00
|
|
|
bool questionEnabled = false;
|
2011-02-14 09:37:27 +00:00
|
|
|
|
|
|
|
switch (cursorType) {
|
2011-05-11 10:28:30 +00:00
|
|
|
case CURSOR_NONE:
|
|
|
|
// No cursor
|
2011-10-02 08:59:13 +00:00
|
|
|
g_globals->setFlag(122);
|
2011-05-15 12:56:35 +00:00
|
|
|
|
2011-10-22 09:44:26 +00:00
|
|
|
if ((g_vm->getFeatures() & GF_DEMO) || (g_vm->getGameID() != GType_Ringworld)) {
|
2011-05-15 12:56:35 +00:00
|
|
|
CursorMan.showMouse(false);
|
|
|
|
return;
|
|
|
|
}
|
2011-10-02 08:59:13 +00:00
|
|
|
cursor = g_resourceManager->getSubResource(4, 1, 6, &size);
|
2011-02-14 09:37:27 +00:00
|
|
|
break;
|
2011-04-13 19:27:46 +00:00
|
|
|
|
2011-02-14 09:37:27 +00:00
|
|
|
case CURSOR_LOOK:
|
|
|
|
// Look cursor
|
2011-10-22 12:45:35 +00:00
|
|
|
if (g_vm->getGameID() == GType_BlueForce) {
|
2011-10-02 08:59:13 +00:00
|
|
|
cursor = g_resourceManager->getSubResource(1, 5, 3, &size);
|
2011-10-22 12:45:35 +00:00
|
|
|
} else if (g_vm->getGameID() == GType_Ringworld2) {
|
|
|
|
cursor = g_resourceManager->getSubResource(5, 1, 5, &size);
|
|
|
|
} else {
|
2011-10-02 08:59:13 +00:00
|
|
|
cursor = g_resourceManager->getSubResource(4, 1, 5, &size);
|
2011-10-22 12:45:35 +00:00
|
|
|
}
|
2011-03-06 09:49:03 +00:00
|
|
|
_currentCursor = CURSOR_LOOK;
|
2011-02-14 09:37:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CURSOR_USE:
|
|
|
|
// Use cursor
|
2011-10-02 08:59:13 +00:00
|
|
|
if (g_vm->getGameID() == GType_BlueForce) {
|
|
|
|
cursor = g_resourceManager->getSubResource(1, 5, 2, &size);
|
2011-10-22 12:45:35 +00:00
|
|
|
} else if (g_vm->getGameID() == GType_Ringworld2) {
|
|
|
|
cursor = g_resourceManager->getSubResource(5, 1, 4, &size);
|
2011-08-29 12:01:11 +00:00
|
|
|
} else {
|
2011-10-02 08:59:13 +00:00
|
|
|
cursor = g_resourceManager->getSubResource(4, 1, 4, &size);
|
2011-08-29 12:01:11 +00:00
|
|
|
}
|
2011-03-06 09:49:03 +00:00
|
|
|
_currentCursor = CURSOR_USE;
|
2011-02-14 09:37:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CURSOR_TALK:
|
|
|
|
// Talk cursor
|
2011-10-02 08:59:13 +00:00
|
|
|
if (g_vm->getGameID() == GType_BlueForce) {
|
|
|
|
cursor = g_resourceManager->getSubResource(1, 5, 4, &size);
|
2011-10-22 12:45:35 +00:00
|
|
|
} else if (g_vm->getGameID() == GType_Ringworld2) {
|
|
|
|
cursor = g_resourceManager->getSubResource(5, 1, 6, &size);
|
2011-08-29 12:01:11 +00:00
|
|
|
} else {
|
2011-10-02 08:59:13 +00:00
|
|
|
cursor = g_resourceManager->getSubResource(4, 1, 3, &size);
|
2011-08-29 12:01:11 +00:00
|
|
|
}
|
2011-03-06 09:49:03 +00:00
|
|
|
_currentCursor = CURSOR_TALK;
|
2011-02-14 09:37:27 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-04 09:11:59 +00:00
|
|
|
case CURSOR_EXIT:
|
|
|
|
// Exit cursor (Blue Force)
|
2011-10-02 08:59:13 +00:00
|
|
|
assert(g_vm->getGameID() == GType_BlueForce);
|
|
|
|
cursor = g_resourceManager->getSubResource(1, 5, 7, &size);
|
2011-09-10 01:22:39 +00:00
|
|
|
_currentCursor = CURSOR_EXIT;
|
2011-09-04 09:11:59 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-02 05:05:56 +00:00
|
|
|
case CURSOR_PRINTER:
|
|
|
|
// Printer cursor (Blue Force)
|
2011-10-02 08:59:13 +00:00
|
|
|
assert(g_vm->getGameID() == GType_BlueForce);
|
|
|
|
cursor = g_resourceManager->getSubResource(1, 7, 6, &size);
|
2011-10-02 05:05:56 +00:00
|
|
|
_currentCursor = CURSOR_PRINTER;
|
|
|
|
break;
|
|
|
|
|
2011-02-14 09:37:27 +00:00
|
|
|
case CURSOR_ARROW:
|
|
|
|
// Arrow cursor
|
|
|
|
cursor = CURSOR_ARROW_DATA;
|
|
|
|
delFlag = false;
|
|
|
|
break;
|
|
|
|
|
2011-03-06 09:49:03 +00:00
|
|
|
case CURSOR_WALK:
|
2011-02-14 09:37:27 +00:00
|
|
|
default:
|
2011-10-31 04:11:27 +00:00
|
|
|
switch (g_vm->getGameID()) {
|
|
|
|
case GType_BlueForce:
|
2011-09-04 09:11:59 +00:00
|
|
|
if (cursorType == CURSOR_WALK) {
|
2011-10-02 08:59:13 +00:00
|
|
|
cursor = g_resourceManager->getSubResource(1, 5, 1, &size);
|
2011-09-04 09:11:59 +00:00
|
|
|
} else {
|
|
|
|
// Inventory icon
|
2011-10-02 08:59:13 +00:00
|
|
|
cursor = g_resourceManager->getSubResource(10, ((int)cursorType - 1) / 20 + 1,
|
2011-09-04 09:11:59 +00:00
|
|
|
((int)cursorType - 1) % 20 + 1, &size);
|
|
|
|
questionEnabled = true;
|
|
|
|
}
|
|
|
|
_currentCursor = cursorType;
|
2011-10-31 04:11:27 +00:00
|
|
|
break;
|
|
|
|
case GType_Ringworld2:
|
|
|
|
if (cursorType == CURSOR_WALK) {
|
|
|
|
cursor = CURSOR_WALK_DATA;
|
|
|
|
delFlag = false;
|
|
|
|
} else {
|
|
|
|
// Inventory icon
|
|
|
|
InvObject *invObject = g_globals->_inventory->getItem((int)cursorType);
|
|
|
|
cursor = g_resourceManager->getSubResource(6, invObject->_strip, invObject->_frame, &size);
|
|
|
|
questionEnabled = true;
|
|
|
|
}
|
|
|
|
_currentCursor = cursorType;
|
|
|
|
break;
|
|
|
|
default:
|
2011-09-04 09:11:59 +00:00
|
|
|
// For Ringworld, always treat as the walk cursor
|
2011-08-29 12:01:11 +00:00
|
|
|
cursor = CURSOR_WALK_DATA;
|
2011-09-04 09:11:59 +00:00
|
|
|
_currentCursor = CURSOR_WALK;
|
2011-08-29 12:01:11 +00:00
|
|
|
delFlag = false;
|
2011-10-31 04:11:27 +00:00
|
|
|
break;
|
2011-08-29 12:01:11 +00:00
|
|
|
}
|
2011-02-14 09:37:27 +00:00
|
|
|
break;
|
2011-12-01 10:30:54 +00:00
|
|
|
|
|
|
|
// Ringworld 2 specific cursors
|
|
|
|
case EXITCURSOR_N:
|
|
|
|
case EXITCURSOR_S:
|
|
|
|
case EXITCURSOR_W:
|
|
|
|
case EXITCURSOR_E:
|
|
|
|
case EXITCURSOR_LEFT_HAND:
|
|
|
|
case CURSOR_INVALID:
|
|
|
|
case EXITCURSOR_NE:
|
|
|
|
case EXITCURSOR_SE:
|
|
|
|
case EXITCURSOR_SW:
|
|
|
|
case EXITCURSOR_NW:
|
|
|
|
case SHADECURSOR_UP:
|
|
|
|
case SHADECURSOR_DOWN:
|
|
|
|
case SHADECURSOR_HAND:
|
2011-12-01 10:54:36 +00:00
|
|
|
_currentCursor = cursorType;
|
2011-12-01 10:30:54 +00:00
|
|
|
cursor = g_resourceManager->getSubResource(5, 1, cursorType - R2CURSORS_START, &size);
|
|
|
|
break;
|
2011-02-14 09:37:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Decode the cursor
|
|
|
|
GfxSurface s = surfaceFromRes(cursor);
|
|
|
|
|
|
|
|
Graphics::Surface surface = s.lockSurface();
|
|
|
|
const byte *cursorData = (const byte *)surface.getBasePtr(0, 0);
|
2011-04-14 12:12:27 +00:00
|
|
|
CursorMan.replaceCursor(cursorData, surface.w, surface.h, s._centroid.x, s._centroid.y, s._transColor);
|
2011-02-14 09:37:27 +00:00
|
|
|
s.unlockSurface();
|
|
|
|
|
|
|
|
if (delFlag)
|
|
|
|
DEALLOCATE(cursor);
|
2011-09-04 09:11:59 +00:00
|
|
|
|
2011-10-25 10:00:41 +00:00
|
|
|
// For Blue Force and Return to Ringworld, enable the question button when an inventory icon is selected
|
|
|
|
if (g_vm->getGameID() != GType_Ringworld)
|
2011-10-22 09:44:26 +00:00
|
|
|
T2_GLOBALS._uiElements._question.setEnabled(questionEnabled);
|
2011-02-14 09:37:27 +00:00
|
|
|
}
|
|
|
|
|
2011-04-28 09:14:37 +00:00
|
|
|
void EventsClass::pushCursor(CursorType cursorType) {
|
|
|
|
const byte *cursor;
|
|
|
|
bool delFlag = true;
|
|
|
|
uint size;
|
|
|
|
|
|
|
|
switch (cursorType) {
|
2011-05-11 10:28:30 +00:00
|
|
|
case CURSOR_NONE:
|
|
|
|
// No cursor
|
2011-10-02 08:59:13 +00:00
|
|
|
cursor = g_resourceManager->getSubResource(4, 1, 6, &size);
|
2011-04-28 09:14:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CURSOR_LOOK:
|
|
|
|
// Look cursor
|
2011-10-02 08:59:13 +00:00
|
|
|
cursor = g_resourceManager->getSubResource(4, 1, 5, &size);
|
2011-04-28 09:14:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CURSOR_USE:
|
|
|
|
// Use cursor
|
2011-10-02 08:59:13 +00:00
|
|
|
cursor = g_resourceManager->getSubResource(4, 1, 4, &size);
|
2011-04-28 09:14:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CURSOR_TALK:
|
|
|
|
// Talk cursor
|
2011-10-02 08:59:13 +00:00
|
|
|
cursor = g_resourceManager->getSubResource(4, 1, 3, &size);
|
2011-04-28 09:14:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CURSOR_ARROW:
|
|
|
|
// Arrow cursor
|
|
|
|
cursor = CURSOR_ARROW_DATA;
|
|
|
|
delFlag = false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CURSOR_WALK:
|
|
|
|
default:
|
|
|
|
// Walk cursor
|
|
|
|
cursor = CURSOR_WALK_DATA;
|
|
|
|
delFlag = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Decode the cursor
|
|
|
|
GfxSurface s = surfaceFromRes(cursor);
|
|
|
|
|
|
|
|
Graphics::Surface surface = s.lockSurface();
|
|
|
|
const byte *cursorData = (const byte *)surface.getBasePtr(0, 0);
|
|
|
|
CursorMan.pushCursor(cursorData, surface.w, surface.h, s._centroid.x, s._centroid.y, s._transColor);
|
|
|
|
s.unlockSurface();
|
|
|
|
|
|
|
|
if (delFlag)
|
|
|
|
DEALLOCATE(cursor);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventsClass::popCursor() {
|
|
|
|
CursorMan.popCursor();
|
|
|
|
}
|
|
|
|
|
2011-04-14 12:12:27 +00:00
|
|
|
void EventsClass::setCursor(Graphics::Surface &cursor, int transColor, const Common::Point &hotspot, CursorType cursorId) {
|
2011-02-14 09:37:27 +00:00
|
|
|
const byte *cursorData = (const byte *)cursor.getBasePtr(0, 0);
|
2011-04-14 12:12:27 +00:00
|
|
|
CursorMan.replaceCursor(cursorData, cursor.w, cursor.h, hotspot.x, hotspot.y, transColor);
|
2011-02-14 09:37:27 +00:00
|
|
|
|
|
|
|
_currentCursor = cursorId;
|
|
|
|
}
|
|
|
|
|
2011-08-26 09:07:43 +00:00
|
|
|
void EventsClass::setCursor(GfxSurface &cursor) {
|
|
|
|
Graphics::Surface s = cursor.lockSurface();
|
|
|
|
|
|
|
|
const byte *cursorData = (const byte *)s.getBasePtr(0, 0);
|
2011-09-26 22:40:10 +00:00
|
|
|
CursorMan.replaceCursor(cursorData, cursor.getBounds().width(), cursor.getBounds().height(),
|
2011-08-26 09:07:43 +00:00
|
|
|
cursor._centroid.x, cursor._centroid.y, cursor._transColor);
|
|
|
|
|
2011-08-31 12:18:11 +00:00
|
|
|
_lastCursor = CURSOR_NONE;
|
2011-08-26 09:07:43 +00:00
|
|
|
}
|
|
|
|
|
2011-02-14 09:37:27 +00:00
|
|
|
void EventsClass::setCursorFromFlag() {
|
2011-05-11 10:28:30 +00:00
|
|
|
setCursor(isCursorVisible() ? _currentCursor : CURSOR_NONE);
|
2011-02-14 09:37:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EventsClass::showCursor() {
|
2011-05-11 10:28:30 +00:00
|
|
|
setCursor(_currentCursor);
|
2011-02-14 09:37:27 +00:00
|
|
|
}
|
|
|
|
|
2011-08-26 09:07:43 +00:00
|
|
|
CursorType EventsClass::hideCursor() {
|
|
|
|
CursorType oldCursor = _currentCursor;
|
2011-05-11 10:28:30 +00:00
|
|
|
setCursor(CURSOR_NONE);
|
2011-08-26 09:07:43 +00:00
|
|
|
return oldCursor;
|
2011-02-14 09:37:27 +00:00
|
|
|
}
|
|
|
|
|
2011-06-19 22:59:48 +00:00
|
|
|
bool EventsClass::isCursorVisible() const {
|
2011-10-02 08:59:13 +00:00
|
|
|
return !g_globals->getFlag(122);
|
2011-04-28 09:14:37 +00:00
|
|
|
}
|
|
|
|
|
2011-02-14 09:37:27 +00:00
|
|
|
/**
|
|
|
|
* Delays the game for the specified number of frames, if necessary, from the
|
|
|
|
* previous time the delay method was called
|
|
|
|
*/
|
|
|
|
void EventsClass::delay(int numFrames) {
|
|
|
|
while (_frameNumber < (_prevDelayFrame + numFrames)) {
|
2011-12-17 04:38:29 +00:00
|
|
|
uint32 delayAmount = CLIP(_priorFrameTime + GAME_SCRIPT_TIME - g_system->getMillis(),
|
2011-02-14 09:37:27 +00:00
|
|
|
(uint32)0, (uint32)GAME_FRAME_TIME);
|
|
|
|
if (delayAmount > 0)
|
|
|
|
g_system->delayMillis(delayAmount);
|
|
|
|
|
|
|
|
++_frameNumber;
|
|
|
|
_priorFrameTime = g_system->getMillis();
|
|
|
|
}
|
|
|
|
|
2012-01-01 05:31:56 +00:00
|
|
|
GLOBALS._screenSurface.updateScreen();
|
2011-02-14 09:37:27 +00:00
|
|
|
_prevDelayFrame = _frameNumber;
|
|
|
|
_priorFrameTime = g_system->getMillis();
|
|
|
|
}
|
|
|
|
|
2011-06-04 12:40:51 +00:00
|
|
|
void EventsClass::listenerSynchronize(Serializer &s) {
|
|
|
|
s.syncAsUint32LE(_frameNumber);
|
|
|
|
s.syncAsUint32LE(_prevDelayFrame);
|
2011-06-19 22:59:48 +00:00
|
|
|
|
2011-06-04 12:40:51 +00:00
|
|
|
if (s.getVersion() >= 5) {
|
|
|
|
s.syncAsSint16LE(_currentCursor);
|
|
|
|
s.syncAsSint16LE(_lastCursor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-03 09:44:16 +00:00
|
|
|
void EventsClass::loadNotifierProc(bool postFlag) {
|
|
|
|
if (postFlag) {
|
2011-10-02 08:59:13 +00:00
|
|
|
if (g_globals->_events._lastCursor == CURSOR_NONE)
|
|
|
|
g_globals->_events._lastCursor = g_globals->_events._currentCursor;
|
2011-08-03 09:44:16 +00:00
|
|
|
else
|
2011-10-02 08:59:13 +00:00
|
|
|
g_globals->_events._lastCursor = CURSOR_NONE;
|
2011-08-03 09:44:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-15 10:47:59 +00:00
|
|
|
} // end of namespace TsAGE
|