diff options
-rw-r--r-- | engines/voyeur/data.cpp | 192 | ||||
-rw-r--r-- | engines/voyeur/data.h | 140 |
2 files changed, 332 insertions, 0 deletions
diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp new file mode 100644 index 0000000000..f98478b723 --- /dev/null +++ b/engines/voyeur/data.cpp @@ -0,0 +1,192 @@ +/* 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 "voyeur/data.h" +#include "voyeur/voyeur.h" + +namespace Voyeur { + +void VoyeurEvent::synchronize(Common::Serializer &s) { + s.syncAsByte(_hour); + s.syncAsByte(_minute); + s.syncAsByte(_isAM); + s.syncAsByte(_type); + s.syncAsSint16LE(_videoId); + s.syncAsSint16LE(_computerOn); + s.syncAsSint16LE(_computerOff); + s.syncAsSint16LE(_dead); +} + +/*------------------------------------------------------------------------*/ + +void SVoy::setVm(VoyeurEngine *vm) { + _vm = vm; +} + +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; +} + +void SVoy::synchronize(Common::Serializer &s) { + s.syncAsByte(_isAM); + s.syncAsSint16LE(_RTANum); + s.syncAsSint16LE(_RTVNum); + s.syncAsSint16LE(_switchBGNum); + + for (int v1 = 0; v1 < 8; ++v1) { + for (int v2 = 0; v2 < 20; ++v2) { + s.syncAsSint16LE(_arr1[v1][v2]); + s.syncAsSint16LE(_arr2[v1][v2]); + } + } + for (int v1 = 0; v1 < 4; ++v1) { + for (int v2 = 0; v2 < 20; ++v2) { + s.syncAsSint16LE(_arr3[v1][v2]); + s.syncAsSint16LE(_arr4[v1][v2]); + } + } + for (int v1 = 0; v1 < 4; ++v1) { + for (int v2 = 0; v2 < 20; ++v2) { + s.syncAsSint16LE(_arr5[v1][v2]); + s.syncAsSint16LE(_arr6[v1][v2]); + } + } + for (int v1 = 0; v1 < 20; ++v1) { + s.syncAsSint16LE(_arr7[20]); + } + + s.syncAsSint16LE(_field468); + s.syncAsSint16LE(_field46A); + s.syncAsSint16LE(_vocSecondsOffset); + s.syncAsSint16LE(_field46E); + s.syncAsSint16LE(_field470); + s.syncAsSint16LE(_field472); + s.syncAsSint16LE(_transitionId); + s.syncAsSint16LE(_RTVLimit); + s.syncAsSint16LE(_field478); + s.syncAsSint16LE(_field47A); + + s.syncAsSint16LE(_field4AC); + s.syncAsSint16LE(_field4B8); + s.syncAsSint16LE(_computerTextId); + s.syncAsSint16LE(_field4EC); + s.syncAsSint16LE(_field4EE); + s.syncAsSint16LE(_field4F0); + s.syncAsSint16LE(_field4F2); + + // Events + s.syncAsUint16LE(_eventCount); + for (int idx = 0; idx < _eventCount; ++idx) + _events[idx].synchronize(s); + + s.syncAsSint16LE(_field4376); + s.syncAsSint16LE(_field4378); + s.syncAsSint16LE(_field437A); + s.syncAsSint16LE(_field437C); + s.syncAsSint16LE(_field437E); + s.syncAsSint16LE(_field4380); + s.syncAsSint16LE(_field4382); + s.syncAsSint16LE(_videoEventId); +} + +void SVoy::addVideoEventStart() { + VoyeurEvent &e = _events[_eventCount]; + e._hour = _vm->_gameHour; + e._minute = _vm->_gameMinute; + e._isAM = _isAM; + e._type = EVTYPE_VIDEO; + e._videoId = _vm->_videoId; + e._computerOn = _vocSecondsOffset; + e._dead = _vm->_eventsManager._videoDead; +} + +void SVoy::addVideoEventEnd() { + VoyeurEvent &e = _events[_eventCount]; + e._computerOff = _RTVNum - _field468 - _vocSecondsOffset; + if (_eventCount < (TOTAL_EVENTS - 1)) + ++_eventCount; +} + +void SVoy::addAudioEventStart() { + VoyeurEvent &e = _events[_eventCount]; + e._hour = _vm->_gameHour; + e._minute = _vm->_gameMinute; + e._isAM = _isAM; + e._type = EVTYPE_AUDIO; + e._videoId = _vm->_videoId; + e._computerOn = _field47A; + e._dead = _vm->_eventsManager._videoDead; +} + +void SVoy::addAudioEventEnd() { + VoyeurEvent &e = _events[_eventCount]; + e._computerOff = _RTVNum - _field468 - _vocSecondsOffset; + if (_eventCount < (TOTAL_EVENTS - 1)) + ++_eventCount; +} + +void SVoy::addEvidEventStart(int v) { + VoyeurEvent &e = _events[_eventCount]; + e._hour = _vm->_gameHour; + e._minute = _vm->_gameMinute; + e._isAM = _isAM; + e._type = EVTYPE_EVID; + e._videoId = _vm->_videoId; + e._computerOn = _vocSecondsOffset; + e._dead = _vm->_eventsManager._videoDead; + +} + +void SVoy::addEvidEventEnd(int dead) { + VoyeurEvent &e = _events[_eventCount]; + e._dead = dead; + if (_eventCount < (TOTAL_EVENTS - 1)) + ++_eventCount; +} + +void SVoy::addComputerEventStart() { + VoyeurEvent &e = _events[_eventCount]; + e._hour = _vm->_gameHour; + e._minute = _vm->_gameMinute; + e._isAM = _isAM; + e._type = EVTYPE_COMPUTER; + e._videoId = _vm->_playStampGroupId; + e._computerOn = _computerTextId; +} + +void SVoy::addComputerEventEnd(int v) { + VoyeurEvent &e = _events[_eventCount]; + e._computerOff = v; + if (_eventCount < (TOTAL_EVENTS - 1)) + ++_eventCount; +} + +} // End of namespace Voyeur diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h new file mode 100644 index 0000000000..03545adea3 --- /dev/null +++ b/engines/voyeur/data.h @@ -0,0 +1,140 @@ +/* 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. + * + */ + +#ifndef VOYEUR_DATA_H +#define VOYEUR_DATA_H + +#include "common/scummsys.h" +#include "common/serializer.h" +#include "voyeur/files.h" + +namespace Voyeur { + +#define TOTAL_EVENTS 1000 + +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; + + void synchronize(Common::Serializer &s); +}; + +class VoyeurEngne; + +class SVoy { +private: + VoyeurEngine *_vm; +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 _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: + void setVm(VoyeurEngine *vm); + + /** + * Synchronise the data + */ + void synchronize(Common::Serializer &s); + + /** + * 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); + + void addVideoEventStart(); + void addVideoEventEnd(); + void addAudioEventStart(); + void addAudioEventEnd(); + void addEvidEventStart(int v); + void addEvidEventEnd(int dead); + void addComputerEventStart(); + void addComputerEventEnd(int v); +}; + +} // End of namespace Voyeur + +#endif /* VOYEUR_DATA_H */ |