Skip to content

Commit

Permalink
DREAMWEB: Simplify getUnderCentre(), putUnderCentre() and move some f…
Browse files Browse the repository at this point in the history
…unctions to DreamBase
  • Loading branch information
bluegr committed Dec 12, 2011
1 parent a682734 commit e685a17
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 deletions.
4 changes: 4 additions & 0 deletions engines/dreamweb/dreambase.h
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion engines/dreamweb/people.cpp
Expand Up @@ -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) {
Expand Down
42 changes: 19 additions & 23 deletions engines/dreamweb/stubs.cpp
Expand Up @@ -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) {
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -2581,17 +2577,17 @@ 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);
workToScreenM();
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);
Expand Down Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -4306,7 +4302,7 @@ void DreamGenContext::autoAppear() {
// In alley
al = 5;
resetLocation();
setLocation(10);
DreamBase::setLocation(10);
data.byte(kDestpos) = 10;
return;
}
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions engines/dreamweb/stubs.h
Expand Up @@ -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);
Expand Down Expand Up @@ -569,8 +567,6 @@
void quitKey();
void setupTimedUse();
void entryAnims();
void getUnderCentre();
void putUnderCentre();
void triggerMessage(uint16 index);
void processTrigger();

Expand Down

0 comments on commit e685a17

Please sign in to comment.