Skip to content

Commit

Permalink
VOYEUR: Remove setVm from SVoy
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Feb 26, 2014
1 parent 55b76f7 commit ccde2d5
Show file tree
Hide file tree
Showing 10 changed files with 366 additions and 369 deletions.
8 changes: 2 additions & 6 deletions engines/voyeur/data.cpp
Expand Up @@ -38,7 +38,7 @@ void VoyeurEvent::synchronize(Common::Serializer &s) {

/*------------------------------------------------------------------------*/

SVoy::SVoy() {
SVoy::SVoy(VoyeurEngine *vm):_vm(vm) {
// Initialize all the data fields
_abortInterface = false;
_isAM = false;
Expand Down Expand Up @@ -92,10 +92,6 @@ SVoy::SVoy() {
}
}

void SVoy::setVm(VoyeurEngine *vm) {
_vm = vm;
}

void SVoy::addEvent(int hour, int minute, VoyeurEventType type, int audioVideoId,
int on, int off, int dead) {
VoyeurEvent &e = _events[_eventCount++];
Expand Down Expand Up @@ -282,7 +278,7 @@ void SVoy::reviewComputerEvent(int eventIndex) {

bool SVoy::checkForKey() {
_vm->_controlPtr->_state->_victimEvidenceIndex = 0;
if (_vm->_voy._victimMurdered)
if (_vm->_voy->_victimMurdered)
return false;

for (int eventIdx = 0; eventIdx < _eventCount; ++eventIdx) {
Expand Down
3 changes: 1 addition & 2 deletions engines/voyeur/data.h
Expand Up @@ -154,8 +154,7 @@ class SVoy {
CMapResource *_evCmPtrs[6];
VoyeurEvent _events[TOTAL_EVENTS];

SVoy();
void setVm(VoyeurEngine *vm);
SVoy(VoyeurEngine *vm);

/**
* Synchronize the data
Expand Down
26 changes: 13 additions & 13 deletions engines/voyeur/debugger.cpp
Expand Up @@ -53,7 +53,7 @@ bool Debugger::Cmd_Time(int argc, const char **argv) {
dtString += " " + timeString;

DebugPrintf("Time period = %d, date/time is: %s, time is %s\n",
_vm->_voy._transitionId, dtString.c_str(), _isTimeActive ? "on" : "off");
_vm->_voy->_transitionId, dtString.c_str(), _isTimeActive ? "on" : "off");
DebugPrintf("Format: %s [on | off | 1..17 | val <amount>]\n\n", argv[0]);
} else {
if (!strcmp(argv[1], "on")) {
Expand All @@ -64,10 +64,10 @@ bool Debugger::Cmd_Time(int argc, const char **argv) {
DebugPrintf("Time is now off\n\n");
} else if (!strcmp(argv[1], "val")) {
if (argc < 3) {
DebugPrintf("Time expired is currently %d.\n", _vm->_voy._RTVNum);
DebugPrintf("Time expired is currently %d.\n", _vm->_voy->_RTVNum);
} else {
_vm->_voy._RTVNum = atoi(argv[2]);
DebugPrintf("Time expired is now %d.\n", _vm->_voy._RTVNum);
_vm->_voy->_RTVNum = atoi(argv[2]);
DebugPrintf("Time expired is now %d.\n", _vm->_voy->_RTVNum);
}
} else {
int timeId = atoi(argv[1]);
Expand Down Expand Up @@ -104,27 +104,27 @@ bool Debugger::Cmd_Hotspots(int argc, const char **argv) {
hotspots[hotspotIdx].right, hotspots[hotspotIdx].bottom);

for (int arrIndex = 0; arrIndex < 3; ++arrIndex) {
if (_vm->_voy._audioHotspotTimes._min[arrIndex][hotspotIdx] != 9999) {
if (_vm->_voy->_audioHotspotTimes._min[arrIndex][hotspotIdx] != 9999) {
DebugPrintf("Hotspot %d %s Audio slot %d, time: %d to %d\n",
hotspotIdx, pos.c_str(), arrIndex,
_vm->_voy._audioHotspotTimes._min[arrIndex][hotspotIdx],
_vm->_voy._audioHotspotTimes._max[arrIndex][hotspotIdx]);
_vm->_voy->_audioHotspotTimes._min[arrIndex][hotspotIdx],
_vm->_voy->_audioHotspotTimes._max[arrIndex][hotspotIdx]);
}

if (_vm->_voy._evidenceHotspotTimes._min[arrIndex][hotspotIdx] != 9999) {
if (_vm->_voy->_evidenceHotspotTimes._min[arrIndex][hotspotIdx] != 9999) {
DebugPrintf("Hotspot %d %s Evidence slot %d, time: %d to %d\n",
hotspotIdx, pos.c_str(), arrIndex,
_vm->_voy._evidenceHotspotTimes._min[arrIndex][hotspotIdx],
_vm->_voy._evidenceHotspotTimes._max[arrIndex][hotspotIdx]);
_vm->_voy->_evidenceHotspotTimes._min[arrIndex][hotspotIdx],
_vm->_voy->_evidenceHotspotTimes._max[arrIndex][hotspotIdx]);
}
}

for (int arrIndex = 0; arrIndex < 8; ++arrIndex) {
if (_vm->_voy._videoHotspotTimes._min[arrIndex][hotspotIdx] != 9999) {
if (_vm->_voy->_videoHotspotTimes._min[arrIndex][hotspotIdx] != 9999) {
DebugPrintf("Hotspot %d %s Video slot %d, time: %d to %d\n",
hotspotIdx, pos.c_str(), arrIndex,
_vm->_voy._videoHotspotTimes._min[arrIndex][hotspotIdx],
_vm->_voy._videoHotspotTimes._max[arrIndex][hotspotIdx]);
_vm->_voy->_videoHotspotTimes._min[arrIndex][hotspotIdx],
_vm->_voy->_videoHotspotTimes._max[arrIndex][hotspotIdx]);
}
}
}
Expand Down
60 changes: 30 additions & 30 deletions engines/voyeur/events.cpp
Expand Up @@ -93,17 +93,17 @@ void EventsManager::startMainClockInt() {
}

void EventsManager::mainVoyeurIntFunc() {
if (!(_vm->_voy._eventFlags & EVTFLAG_TIME_DISABLED)) {
++_vm->_voy._switchBGNum;
if (!(_vm->_voy->_eventFlags & EVTFLAG_TIME_DISABLED)) {
++_vm->_voy->_switchBGNum;

if (_vm->_debugger._isTimeActive) {
// Increase camera discharge
++_vm->_voy._RTVNum;
++_vm->_voy->_RTVNum;

// If the murder threshold has been set, and is passed, then flag the victim
// as murdered, which prevents sending the tape from succeeding
if (_vm->_voy._RTVNum >= _vm->_voy._murderThreshold)
_vm->_voy._victimMurdered = true;
if (_vm->_voy->_RTVNum >= _vm->_voy->_murderThreshold)
_vm->_voy->_victimMurdered = true;
}
}
}
Expand Down Expand Up @@ -476,30 +476,30 @@ void EventsManager::vDoCycleInt() {


void EventsManager::fadeIntFunc() {
switch (_vm->_voy._fadingType) {
switch (_vm->_voy->_fadingType) {
case 1:
if (_vm->_voy._fadingAmount1 < 63)
_vm->_voy._fadingAmount1 += _vm->_voy._fadingStep1;
if (_vm->_voy._fadingAmount2 < 63)
_vm->_voy._fadingAmount2 += _vm->_voy._fadingStep2;
if (_vm->_voy._fadingAmount1 > 63)
_vm->_voy._fadingAmount1 = 63;
if (_vm->_voy._fadingAmount2 > 63)
_vm->_voy._fadingAmount2 = 63;
if ((_vm->_voy._fadingAmount1 == 63) && (_vm->_voy._fadingAmount2 == 63))
_vm->_voy._fadingType = 0;
if (_vm->_voy->_fadingAmount1 < 63)
_vm->_voy->_fadingAmount1 += _vm->_voy->_fadingStep1;
if (_vm->_voy->_fadingAmount2 < 63)
_vm->_voy->_fadingAmount2 += _vm->_voy->_fadingStep2;
if (_vm->_voy->_fadingAmount1 > 63)
_vm->_voy->_fadingAmount1 = 63;
if (_vm->_voy->_fadingAmount2 > 63)
_vm->_voy->_fadingAmount2 = 63;
if ((_vm->_voy->_fadingAmount1 == 63) && (_vm->_voy->_fadingAmount2 == 63))
_vm->_voy->_fadingType = 0;
break;
case 2:
if (_vm->_voy._fadingAmount1 > 0)
_vm->_voy._fadingAmount1 -= _vm->_voy._fadingStep1;
if (_vm->_voy._fadingAmount2 > 0)
_vm->_voy._fadingAmount2 -= _vm->_voy._fadingStep2;
if (_vm->_voy._fadingAmount1 < 0)
_vm->_voy._fadingAmount1 = 0;
if (_vm->_voy._fadingAmount2 < 0)
_vm->_voy._fadingAmount2 = 0;
if ((_vm->_voy._fadingAmount1 == 0) && (_vm->_voy._fadingAmount2 == 0))
_vm->_voy._fadingType = 0;
if (_vm->_voy->_fadingAmount1 > 0)
_vm->_voy->_fadingAmount1 -= _vm->_voy->_fadingStep1;
if (_vm->_voy->_fadingAmount2 > 0)
_vm->_voy->_fadingAmount2 -= _vm->_voy->_fadingStep2;
if (_vm->_voy->_fadingAmount1 < 0)
_vm->_voy->_fadingAmount1 = 0;
if (_vm->_voy->_fadingAmount2 < 0)
_vm->_voy->_fadingAmount2 = 0;
if ((_vm->_voy->_fadingAmount1 == 0) && (_vm->_voy->_fadingAmount2 == 0))
_vm->_voy->_fadingType = 0;
break;
default:
break;
Expand Down Expand Up @@ -560,7 +560,7 @@ void EventsManager::hideCursor() {
void EventsManager::getMouseInfo() {
pollEvents();

if (_vm->_voy._eventFlags & EVTFLAG_RECORDING) {
if (_vm->_voy->_eventFlags & EVTFLAG_RECORDING) {
if ((_gameCounter - _recordBlinkCounter) > 8) {
_recordBlinkCounter = _gameCounter;

Expand All @@ -586,7 +586,7 @@ void EventsManager::getMouseInfo() {
}

void EventsManager::startCursorBlink() {
if (_vm->_voy._eventFlags & EVTFLAG_RECORDING) {
if (_vm->_voy->_eventFlags & EVTFLAG_RECORDING) {
_vm->_graphicsManager.setOneColor(128, 55, 5, 5);
_vm->_graphicsManager.setColor(128, 220, 20, 20);
_intPtr._hasPalette = true;
Expand All @@ -606,8 +606,8 @@ void EventsManager::stopEvidDim() {
}

Common::String EventsManager::getEvidString(int eventIndex) {
assert(eventIndex <= _vm->_voy._eventCount);
VoyeurEvent &e = _vm->_voy._events[eventIndex];
assert(eventIndex <= _vm->_voy->_eventCount);
VoyeurEvent &e = _vm->_voy->_events[eventIndex];
return Common::String::format("%03d %.2d:%.2d %s %s", eventIndex + 1,
e._hour, e._minute, e._isAM ? AM : PM, EVENT_TYPE_STRINGS[e._type - 1]);
}
Expand Down
2 changes: 1 addition & 1 deletion engines/voyeur/files.cpp
Expand Up @@ -1365,7 +1365,7 @@ void ViewPortResource::drawIfaceTime() {
_state._vm->_gameMinute % 10, Common::Point(201, 25));

// AM/PM indicator
PictureResource *pic = _state._vm->_bVoy->boltEntry(_state._vm->_voy._isAM ? 272 : 273)._picResource;
PictureResource *pic = _state._vm->_bVoy->boltEntry(_state._vm->_voy->_isAM ? 272 : 273)._picResource;
_state._vm->_graphicsManager.sDrawPic(pic, *_state._vm->_graphicsManager._vPort,
Common::Point(215, 27));
}
Expand Down

0 comments on commit ccde2d5

Please sign in to comment.