Skip to content

Commit

Permalink
DREAMWEB: 'checkpathison' ported to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
tramboi committed Sep 2, 2011
1 parent 8505011 commit 98a6b33
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 22 deletions.
1 change: 1 addition & 0 deletions devtools/tasmrecover/tasm-recover
Expand Up @@ -182,6 +182,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'turnanypathoff',
'isitdescribed',
'checkifset',
'checkifpathison',
], skip_output = [
# These functions are processed but not output
'dreamweb',
Expand Down
15 changes: 0 additions & 15 deletions engines/dreamweb/dreamgen.cpp
Expand Up @@ -14882,20 +14882,6 @@ void DreamGenContext::findfirstpath() {
al = es.byte(bx+6);
}

void DreamGenContext::checkifpathison() {
STACK_CHECK;
push(ax);
getroomspaths();
ax = pop();
ah = 0;
_add(ax, ax);
_add(ax, ax);
_add(ax, ax);
_add(bx, ax);
al = es.byte(bx+6);
_cmp(al, 255);
}

void DreamGenContext::afternewroom() {
STACK_CHECK;
_cmp(data.byte(kNowinnewroom), 0);
Expand Down Expand Up @@ -17852,7 +17838,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_identifyob: identifyob(); break;
case addr_findpathofpoint: findpathofpoint(); break;
case addr_findfirstpath: findfirstpath(); break;
case addr_checkifpathison: checkifpathison(); break;
case addr_afternewroom: afternewroom(); break;
case addr_atmospheres: atmospheres(); break;
case addr_walkintoroom: walkintoroom(); break;
Expand Down
3 changes: 1 addition & 2 deletions engines/dreamweb/dreamgen.h
Expand Up @@ -110,7 +110,6 @@ class DreamGenContext : public Context {
static const uint16 addr_walkintoroom = 0xca10;
static const uint16 addr_atmospheres = 0xca0c;
static const uint16 addr_afternewroom = 0xca08;
static const uint16 addr_checkifpathison = 0xca04;
static const uint16 addr_findfirstpath = 0xc9f0;
static const uint16 addr_findpathofpoint = 0xc9ec;
static const uint16 addr_identifyob = 0xc9d4;
Expand Down Expand Up @@ -1576,7 +1575,7 @@ class DreamGenContext : public Context {
void usecooker();
void loadmenu();
void checkforemm();
void checkifpathison();
//void checkifpathison();
//void finalframe();
void receptionist();
void selectslot();
Expand Down
18 changes: 14 additions & 4 deletions engines/dreamweb/pathfind.cpp
Expand Up @@ -36,7 +36,7 @@ void DreamGenContext::turnpathon(uint8 param) {
PathNode *roomsPaths = getroomspathsCPP()->nodes;
if (param == 0xff)
return;
roomsPaths[param].b6 = 0xff;
roomsPaths[param].on = 0xff;
}

void DreamGenContext::turnpathoff() {
Expand All @@ -48,13 +48,13 @@ void DreamGenContext::turnpathoff(uint8 param) {
PathNode *roomsPaths = getroomspathsCPP()->nodes;
if (param == 0xff)
return;
roomsPaths[param].b6 = 0x00;
roomsPaths[param].on = 0x00;
}

void DreamGenContext::turnanypathon(uint8 param, uint8 room) {
findormake(param, 0xff, room + 100);
PathNode *paths = (PathNode *)segRef(data.word(kReels)).ptr(kPathdata + 144 * room, 0);
paths[param].b6 = 0xff;
paths[param].on = 0xff;
}


Expand All @@ -65,7 +65,7 @@ void DreamGenContext::turnanypathon() {
void DreamGenContext::turnanypathoff(uint8 param, uint8 room) {
findormake(param, 0x00, room + 100);
PathNode *paths = (PathNode *)segRef(data.word(kReels)).ptr(kPathdata + 144 * room, 0);
paths[param].b6 = 0x00;
paths[param].on = 0x00;
}

void DreamGenContext::turnanypathoff() {
Expand Down Expand Up @@ -128,5 +128,15 @@ void DreamGenContext::findxyfrompath() {
data.byte(kRyany) = roomsPaths[data.byte(kManspath)].y - 12;
}

void DreamGenContext::checkifpathison() {
flags._z = checkifpathison(al);
}

bool DreamGenContext::checkifpathison(uint8 index) {
RoomPaths *roomsPaths = getroomspathsCPP();
uint8 pathOn = roomsPaths->nodes[index].on;
return pathOn == 0xff;
}

} /*namespace dreamgen */

2 changes: 1 addition & 1 deletion engines/dreamweb/structs.h
Expand Up @@ -235,7 +235,7 @@ struct PathNode {
uint8 b3;
uint8 b4;
uint8 b5;
uint8 b6;
uint8 on;
uint8 dir;
};

Expand Down
2 changes: 2 additions & 0 deletions engines/dreamweb/stubs.h
Expand Up @@ -220,4 +220,6 @@
bool isitdescribed(const ObjPos *objPos);
void checkifset();
bool checkifset(uint8 x, uint8 y);
void checkifpathison();
bool checkifpathison(uint8 index);

0 comments on commit 98a6b33

Please sign in to comment.