From e685a171d337e13123f48789780b7f8869b2eb7c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 12 Dec 2011 22:55:29 +0200 Subject: [PATCH] DREAMWEB: Simplify getUnderCentre(), putUnderCentre() and move some functions to DreamBase --- engines/dreamweb/dreambase.h | 4 ++++ engines/dreamweb/people.cpp | 2 +- engines/dreamweb/stubs.cpp | 42 ++++++++++++++++-------------------- engines/dreamweb/stubs.h | 4 ---- 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 7ef6a9219e47..c7e954606942 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -184,6 +184,10 @@ class DreamBase : public SegmentManager { inline uint8 *workspace() { return _workspace; } void clearWork(); + uint8 getLocation(uint8 index); + void setLocation(uint8 index); + void getUnderCentre(); + void putUnderCentre(); uint8 *mapStore(); void panelToMap(); void mapToPanel(); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index efb9a028b685..84f6543a19df 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -321,7 +321,7 @@ void DreamGenContext::madmansTelly(ReelRoutine &routine) { void DreamGenContext::smokeBloke(ReelRoutine &routine) { if (data.byte(kRockstardead) == 0) { if (routine.b7 & 128) - setLocation(5); + DreamBase::setLocation(5); } if (checkSpeed(routine)) { if (routine.reelPointer() == 100) { diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 4f0661e4993f..e52ccf03f39e 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -862,16 +862,12 @@ void DreamGenContext::putUnderTimed() { multiPut(ds.ptr(si, 0), data.byte(kTimedx), y, 240, kUndertimedysize); } -void DreamGenContext::getUnderCentre() { - ds = data.word(kMapstore); - si = 0; - multiGet(ds.ptr(si, 0), 58, 72, 254, 110); +void DreamBase::getUnderCentre() { + multiGet(mapStore(), 58, 72, 254, 110); } -void DreamGenContext::putUnderCentre() { - ds = data.word(kMapstore); - si = 0; - multiPut(ds.ptr(si, 0), 58, 72, 254, 110); +void DreamBase::putUnderCentre() { + multiPut(mapStore(), 58, 72, 254, 110); } void DreamGenContext::triggerMessage(uint16 index) { @@ -890,13 +886,13 @@ void DreamGenContext::triggerMessage(uint16 index) { void DreamGenContext::processTrigger() { if (data.byte(kLasttrigger) == '1') { - setLocation(8); + DreamBase::setLocation(8); triggerMessage(45); } else if (data.byte(kLasttrigger) == '2') { - setLocation(9); + DreamBase::setLocation(9); triggerMessage(55); } else if (data.byte(kLasttrigger) == '3') { - setLocation(2); + DreamBase::setLocation(2); triggerMessage(59); } } @@ -2505,20 +2501,20 @@ void DreamGenContext::examIcon() { showFrame(engine->icons2(), 254, 5, 3, 0); } -uint8 DreamGenContext::getLocation(uint8 index) { +uint8 DreamBase::getLocation(uint8 index) { return data.byte(kRoomscango + index); } void DreamGenContext::getLocation() { - al = getLocation(al); + al = DreamBase::getLocation(al); } -void DreamGenContext::setLocation(uint8 index) { +void DreamBase::setLocation(uint8 index) { data.byte(kRoomscango + index) = 1; } void DreamGenContext::setLocation() { - setLocation(al); + DreamBase::setLocation(al); } const uint8 *DreamBase::getTextInFile1(uint16 index) { @@ -2581,8 +2577,8 @@ void DreamGenContext::lastFolder() { void DreamGenContext::folderHints() { if (data.byte(kFolderpage) == 5) { - if ((data.byte(kAidedead) != 1) && (getLocation(13) != 1)) { - setLocation(13); + if ((data.byte(kAidedead) != 1) && (DreamBase::getLocation(13) != 1)) { + DreamBase::setLocation(13); showFolder(); const uint8 *string = getTextInFile1(30); printDirect(string, 0, 86, 141, true); @@ -2590,8 +2586,8 @@ void DreamGenContext::folderHints() { hangOnP(200); } } else if (data.byte(kFolderpage) == 9) { - if (getLocation(7) != 1) { - setLocation(7); + if (DreamBase::getLocation(7) != 1) { + DreamBase::setLocation(7); showFolder(); const uint8 *string = getTextInFile1(31); printDirect(string, 0, 86, 141, true); @@ -3353,8 +3349,8 @@ void DreamGenContext::obsThatDoThings() { if (!compare(data.byte(kCommand), data.byte(kObjecttype), id)) return; // notlouiscard - if (getLocation(4) != 1) { - setLocation(4); + if (DreamBase::getLocation(4) != 1) { + DreamBase::setLocation(4); lookAtCard(); } } @@ -4306,7 +4302,7 @@ void DreamGenContext::autoAppear() { // In alley al = 5; resetLocation(); - setLocation(10); + DreamBase::setLocation(10); data.byte(kDestpos) = 10; return; } @@ -4337,7 +4333,7 @@ void DreamGenContext::autoAppear() { data.byte(kNewsitem) = 3; al = 6; resetLocation(); - setLocation(11); + DreamBase::setLocation(11); data.byte(kDestpos) = 11; } else { if (data.byte(kReallocation) == 2 && data.byte(kRockstardead) != 0) diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 5cf0466560e5..7142bec3732f 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -362,9 +362,7 @@ void lastFolder(); void folderHints(); void folderExit(); - uint8 getLocation(uint8 index); void getLocation(); - void setLocation(uint8 index); void setLocation(); void loadTempText(); void loadTempText(const char *fileName); @@ -569,8 +567,6 @@ void quitKey(); void setupTimedUse(); void entryAnims(); - void getUnderCentre(); - void putUnderCentre(); void triggerMessage(uint16 index); void processTrigger();