Skip to content

Commit

Permalink
DREAMWEB: do not call updatescreen before quitting, fixed crash on do…
Browse files Browse the repository at this point in the history
…sreturn, cleaned up dosreturn stub
  • Loading branch information
whoozle committed Jun 18, 2011
1 parent 4cdc9c9 commit cf67122
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 10 deletions.
3 changes: 2 additions & 1 deletion devtools/tasmrecover/dreamweb/dreamweb.asm
Expand Up @@ -194,11 +194,12 @@ alreadyloaded: mov newlocation,255
call startup
mov commandtype,255

mainloop: call screenupdate
mainloop:
cmp quitrequested, 0
jz $1
ret
$1:
call screenupdate
cmp wongame,0
jnz endofgame
cmp mandead,1
Expand Down
6 changes: 6 additions & 0 deletions engines/dreamweb/detection.cpp
Expand Up @@ -83,6 +83,12 @@ bool DreamWebMetaEngine::hasFeature(MetaEngineFeature f) const {
}

bool DreamWeb::DreamWebEngine::hasFeature(EngineFeature f) const {
switch(f) {
case kSupportsRTL:
return true;
default:
return false;
}
return false;
}

Expand Down
8 changes: 7 additions & 1 deletion engines/dreamweb/dreamgen.cpp
Expand Up @@ -4165,6 +4165,11 @@ void DreamGenContext::delthisone() {
goto deloneloop;
}

void DreamGenContext::width160() {
STACK_CHECK;
_movsw(161);
}

void DreamGenContext::doblocks() {
STACK_CHECK;
es = data.word(kWorkspace);
Expand Down Expand Up @@ -21358,12 +21363,12 @@ void DreamGenContext::dreamweb() {
startup();
data.byte(kCommandtype) = 255;
mainloop:
screenupdate();
_cmp(data.byte(kQuitrequested), 0);
if (flags.z())
goto _tmp1;
return;
_tmp1:
screenupdate();
_cmp(data.byte(kWongame), 0);
if (!flags.z())
goto endofgame;
Expand Down Expand Up @@ -22115,6 +22120,7 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case 0xc20c: doshake(); break;
case 0xc210: zoom(); break;
case 0xc214: delthisone(); break;
case 0xc224: width160(); break;
case 0xc228: doblocks(); break;
case 0xc22c: showframe(); break;
case 0xc230: frameoutv(); break;
Expand Down
1 change: 1 addition & 0 deletions engines/dreamweb/dreamgen.h
Expand Up @@ -964,6 +964,7 @@ class DreamGenContext : public Context {
void createpanel();
void turnpathon();
void showmainops();
void width160dosreturn();
void madmanstelly();
void constant();
void loadroomssample();
Expand Down
3 changes: 3 additions & 0 deletions engines/dreamweb/dreamweb.cpp
Expand Up @@ -116,6 +116,9 @@ void DreamWebEngine::processEvents() {
int softKey, hardKey;
while (event_manager->pollEvent(event)) {
switch(event.type) {
case Common::EVENT_RTL:
quit();
break;
case Common::EVENT_KEYDOWN:
if (event.kbd.flags & Common::KBD_CTRL) {
switch (event.kbd.keycode) {
Expand Down
22 changes: 14 additions & 8 deletions engines/dreamweb/stubs.cpp
Expand Up @@ -162,6 +162,10 @@ void DreamGenContext::openfilefromc() {

void DreamGenContext::openfile() {
Common::String name = getFilename(*this);
if (name.empty()) { //fixme: this happens if you quit from new game/load screen
flags._c = true;
return;
}
debug(1, "opening file: %s", name.c_str());
engine->openFile(name);
cs.word(kHandle) = 1; //only one handle
Expand Down Expand Up @@ -361,17 +365,19 @@ void DreamGenContext::generalerror() {

void DreamGenContext::dosreturn() {
_cmp(data.byte(kCommandtype), 250);
if (flags.z()) goto alreadydos;
data.byte(kCommandtype) = 250;
al = 46;
commandonly();
alreadydos:
if (!flags.z()) {
data.byte(kCommandtype) = 250;
al = 46;
commandonly();
}

ax = data.word(kMousebutton);
_and(ax, 1);
if (flags.z()) return;
if (flags.z())
return;

quickquit2();
quickquit();
data.word(kMousebutton) = 0;
engine->quit();
}

void DreamGenContext::set16colpalette() {}
Expand Down

0 comments on commit cf67122

Please sign in to comment.