diff options
author | Paul Gilbert | 2014-01-06 22:01:36 -0500 |
---|---|---|
committer | Paul Gilbert | 2014-01-06 22:01:36 -0500 |
commit | 2a206ebd7f84b41ba93518a2c003ba67bedf72df (patch) | |
tree | 84a1b758fd98935031e3943d1cdd88567ea42297 | |
parent | 6dff1574590c60eab526b7dcc4061ec9f15c0821 (diff) | |
download | scummvm-rg350-2a206ebd7f84b41ba93518a2c003ba67bedf72df.tar.gz scummvm-rg350-2a206ebd7f84b41ba93518a2c003ba67bedf72df.tar.bz2 scummvm-rg350-2a206ebd7f84b41ba93518a2c003ba67bedf72df.zip |
VOYEUR: Moved SVoy and game events to their own file
-rw-r--r-- | engines/voyeur/events.cpp | 87 | ||||
-rw-r--r-- | engines/voyeur/events.h | 100 | ||||
-rw-r--r-- | engines/voyeur/files_threads.cpp | 12 | ||||
-rw-r--r-- | engines/voyeur/module.mk | 1 | ||||
-rw-r--r-- | engines/voyeur/voyeur.cpp | 2 | ||||
-rw-r--r-- | engines/voyeur/voyeur.h | 1 | ||||
-rw-r--r-- | engines/voyeur/voyeur_game.cpp | 4 |
7 files changed, 11 insertions, 196 deletions
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp index f9e150c8a0..ba86ba8f58 100644 --- a/engines/voyeur/events.cpp +++ b/engines/voyeur/events.cpp @@ -66,21 +66,6 @@ IntData::IntData() { /*------------------------------------------------------------------------*/ -void SVoy::addEvent(int hour, int minute, VoyeurEventType type, int videoId, - int on, int off, int dead) { - VoyeurEvent &e = _events[_eventCount++]; - - e._hour = hour; - e._minute = minute; - e._isAM = hour < 12; - e._videoId = videoId; - e._computerOn = on; - e._computerOff = off; - e._dead = dead; -} - -/*------------------------------------------------------------------------*/ - EventsManager::EventsManager(): _intPtr(_gameData), _fadeIntNode(0, 0, 3), _cycleIntNode(0, 0, 3) { _cycleStatus = 0; @@ -597,78 +582,6 @@ void EventsManager::incrementTime(int amt) { mainVoyeurIntFunc(); } -void EventsManager::addVideoEventStart() { - VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount]; - e._hour = _vm->_gameHour; - e._minute = _vm->_gameMinute; - e._isAM = _vm->_voy._isAM; - e._type = EVTYPE_VIDEO; - e._videoId = _vm->_videoId; - e._computerOn = _vm->_voy._vocSecondsOffset; - e._dead = _vm->_eventsManager._videoDead; -} - -void EventsManager::addVideoEventEnd() { - VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount]; - e._computerOff = _vm->_voy._RTVNum - _vm->_voy._field468 - _vm->_voy._vocSecondsOffset; - if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1)) - ++_vm->_voy._eventCount; -} - -void EventsManager::addAudioEventStart() { - VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount]; - e._hour = _vm->_gameHour; - e._minute = _vm->_gameMinute; - e._isAM = _vm->_voy._isAM; - e._type = EVTYPE_AUDIO; - e._videoId = _vm->_videoId; - e._computerOn = _vm->_voy._field47A; - e._dead = _vm->_eventsManager._videoDead; -} - -void EventsManager::addAudioEventEnd() { - VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount]; - e._computerOff = _vm->_voy._RTVNum - _vm->_voy._field468 - _vm->_voy._vocSecondsOffset; - if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1)) - ++_vm->_voy._eventCount; -} - -void EventsManager::addEvidEventStart(int v) { - VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount]; - e._hour = _vm->_gameHour; - e._minute = _vm->_gameMinute; - e._isAM = _vm->_voy._isAM; - e._type = EVTYPE_EVID; - e._videoId = _vm->_videoId; - e._computerOn = _vm->_voy._vocSecondsOffset; - e._dead = _vm->_eventsManager._videoDead; - -} - -void EventsManager::addEvidEventEnd(int dead) { - VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount]; - e._dead = dead; - if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1)) - ++_vm->_voy._eventCount; -} - -void EventsManager::addComputerEventStart() { - VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount]; - e._hour = _vm->_gameHour; - e._minute = _vm->_gameMinute; - e._isAM = _vm->_voy._isAM; - e._type = EVTYPE_COMPUTER; - e._videoId = _vm->_playStampGroupId; - e._computerOn = _vm->_voy._computerTextId; -} - -void EventsManager::addComputerEventEnd(int v) { - VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount]; - e._computerOff = v; - if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1)) - ++_vm->_voy._eventCount; -} - void EventsManager::stopEvidDim() { deleteIntNode(&_evIntNode); } diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h index a51b66916a..d2909542e6 100644 --- a/engines/voyeur/events.h +++ b/engines/voyeur/events.h @@ -36,7 +36,6 @@ class CMapResource; #define GAME_FRAME_RATE 50 #define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE) -#define TOTAL_EVENTS 1000 typedef void (EventsManager::*EventMethodPtr)(); @@ -51,97 +50,6 @@ public: IntNode(uint16 curTime, uint16 timeReset, uint16 flags); }; -enum VoyeurEventType { EVTYPE_VIDEO = 1, EVTYPE_AUDIO = 2, EVTYPE_EVID = 3, - EVTYPE_COMPUTER = 4 }; - -struct VoyeurEvent { - int _hour; - int _minute; - bool _isAM; - VoyeurEventType _type; - int _videoId; - int _computerOn; - int _computerOff; - int _dead; -}; - -class SVoy { -public: - bool _isAM; - int _RTANum; - int _RTVNum; - int _switchBGNum; - int _arr1[8][20]; - int _arr2[8][20]; - int _arr3[3][20]; - int _arr4[3][20]; - int _arr5[3][20]; - int _arr6[3][20]; - int _arr7[20]; - - int _field468; - int _field46A; - int _vocSecondsOffset; - bool _field46E; - int _field470; - int _field472; - int _transitionId; - int _RTVLimit; - int _field478; - int _field47A; - PictureResource *_evPicPtrs[6]; - CMapResource *_evCmPtrs[6]; - int _field4AC; - int _field4AE[5]; - int _field4B8; - - int _computerTextId; - Common::Rect _rect4E4; - int _field4EC; - int _field4EE; - int _field4F0; - int _field4F2; - - /** - * Total number of game events that have occurred - */ - int _eventCount; - - /** - * List of game events that have occurred - */ - VoyeurEvent _events[TOTAL_EVENTS]; - - int _timeStart; - int _duration; - int _vidStart; - - int _audioTime; - int _phones[5]; - int _numPhonesUsed; - int _evidence[20]; - - int _field4376; - int _field4378; - int _field437A; - int _field437C; - int _field437E; - int _field4380; - int _field4382; - int _videoEventId; - RectResource *_viewBounds; - int _curICF0; - int _curICF1; - int _fadeICF0; - int _policeEvent; -public: - /** - * Add an event to the list of game events that have occurred - */ - void addEvent(int hour, int minute, VoyeurEventType type, int videoId, int on, - int off, int dead); -}; - class IntData { public: bool _field9; @@ -238,14 +146,6 @@ public: void startCursorBlink(); void incrementTime(int amt); - void addVideoEventStart(); - void addVideoEventEnd(); - void addAudioEventStart(); - void addAudioEventEnd(); - void addEvidEventStart(int v); - void addEvidEventEnd(int dead); - void addComputerEventStart(); - void addComputerEventEnd(int v); void stopEvidDim(); Common::String getEvidString(int eventIndex); diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 9f694ecaf9..1764c223d7 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -376,7 +376,7 @@ void ThreadResource::parsePlayCommands() { _vm->_videoId = -1; } else { _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; - _vm->_eventsManager.addAudioEventStart(); + _vm->_voy.addAudioEventStart(); assert(_vm->_videoId < 38); _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry( @@ -402,7 +402,7 @@ void ThreadResource::parsePlayCommands() { _vm->_voy._field478 |= 1; _vm->_soundManager.stopVOCPlay(); - _vm->_eventsManager.addAudioEventEnd(); + _vm->_voy.addAudioEventEnd(); _vm->_eventsManager.incrementTime(1); _vm->_eventsManager.incrementTime(1); @@ -430,14 +430,14 @@ void ThreadResource::parsePlayCommands() { _vm->_videoId = -1; } else { _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468; - _vm->_eventsManager.addAudioEventStart(); + _vm->_voy.addAudioEventStart(); _vm->_voy._field478 &= ~1; _vm->_voy._field478 |= 0x10; _vm->playAVideo(_vm->_videoId); _vm->_voy._field478 &= ~0x10; _vm->_voy._field478 |= 1; - _vm->_eventsManager.addVideoEventEnd(); + _vm->_voy.addVideoEventEnd(); _vm->_eventsManager.incrementTime(1); _vm->_videoId = -1; @@ -1250,14 +1250,14 @@ void ThreadResource::doRoom() { vm.getComputerBrush(); _vm->flipPageAndWait(); - vm._eventsManager.addComputerEventStart(); + vm._voy.addComputerEventStart(); vm._eventsManager._mouseClicked = false; vm._eventsManager.startCursorBlink(); int v = vm.doComputerText(9999); if (v) - vm._eventsManager.addComputerEventEnd(v); + vm._voy.addComputerEventEnd(v); vm._bVoy->freeBoltGroup(0x4900); } else { diff --git a/engines/voyeur/module.mk b/engines/voyeur/module.mk index c52502d2e2..f2a69dfe76 100644 --- a/engines/voyeur/module.mk +++ b/engines/voyeur/module.mk @@ -2,6 +2,7 @@ MODULE := engines/voyeur MODULE_OBJS := \ animation.o \ + data.o \ debugger.o \ detection.o \ events.o \ diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index af17460d91..bc2a30b0b7 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -125,7 +125,7 @@ void VoyeurEngine::initialiseManagers() { _filesManager.setVm(this); _graphicsManager.setVm(this); _soundManager.setVm(this); - + _voy.setVm(this); } void VoyeurEngine::ESP_Init() { diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h index 552b9d035e..4ee5f84b02 100644 --- a/engines/voyeur/voyeur.h +++ b/engines/voyeur/voyeur.h @@ -24,6 +24,7 @@ #define VOYEUR_VOYEUR_H #include "voyeur/debugger.h" +#include "voyeur/data.h" #include "voyeur/events.h" #include "voyeur/files.h" #include "voyeur/graphics.h" diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp index e943af63ce..a8330c02b3 100644 --- a/engines/voyeur/voyeur_game.cpp +++ b/engines/voyeur/voyeur_game.cpp @@ -1325,7 +1325,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) { _eventsManager.stopEvidDim(); if (eventId == 999) - _eventsManager.addEvidEventStart(eventId); + _voy.addEvidEventStart(eventId); _eventsManager.getMouseInfo(); @@ -1365,7 +1365,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) { } if (eventId != 999) - _eventsManager.addEvidEventEnd(evidIdx); + _voy.addEvidEventEnd(evidIdx); count = (int16)READ_LE_UINT16(dataP + evidId * 12 + 4); for (int idx = 1; idx <= count; ++idx) { |