Opened 22 years ago

Closed 22 years ago

Last modified 6 years ago

#8148 closed patch

Handling Y/N questions (bug #647860)

Reported by: eriktorbjorn Owned by: fingolfin
Priority: normal Component: Engine: SCUMM
Version: Keywords:
Cc: Game: Monkey Island 1

Description

This patch enables the MI1/MI2 "instant win" cheats (see bug #647860). I know Fingolfin said we should close that bug as WONTFIX, but since these cheats are part of the game scripts, and I believe that we will eventually have to support other "Are you sure you want to...?" style questions, I think we should fix it after all.

There are a few things I'm uncertain about:

With this patch, unkMessage2() will always write to the VAR_KEYPRESS variable, which is a new variable that I've added. I'm almost certain this is the correct behaviour for MI1 and MI2, but for all other games it's just a guess.

To handle Ctrl-Alt-<key>, I'm adding 250 to the value _keyPressed would normally get. I don't know if this is correct, but it works well enough to handle Ctrl-Alt-W for me under Linux. It'll have to be tested with other backends and operating systems though.

Ticket imported from: #655594. Ticket imported from: patches/253.

Attachments (1)

mi-cheat.diff (3.3 KB ) - added by eriktorbjorn 22 years ago.
Patch against a December 17 CVS snapshot

Download all attachments as: .zip

Change History (11)

by eriktorbjorn, 22 years ago

Attachment: mi-cheat.diff added

Patch against a December 17 CVS snapshot

comment:1 by fingolfin, 22 years ago

Hm, I thought the shortcut was Alt-W ? Various game hint sites seem to agree with me.

comment:2 by fingolfin, 22 years ago

I checked this in minus the key detection code in scummvm.cpp - first we need to resolve if it should be Alt-W or Ctrl-Alt-W

comment:3 by fingolfin, 22 years ago

Owner: set to fingolfin

comment:4 by SF/sir_kill_a_lot, 22 years ago

I just tried it again with the original MI2 and it seems I was wrong, the cheat code for MI2 is ALT-W.

comment:5 by eriktorbjorn, 22 years ago

When playing the original with DosBox, both Alt-W and Alt-Ctrl-W work. But you're probably right that Alt-W is the correct one. That Alt-Ctrl-W works may just be an accident.

At least under Linux, the SDL backend generates keycode 119 for Alt-W, while ASCII is either 87 or 119 depending on if I press Shift (or if Caps Lock is active).

comment:6 by SF/andrej4000, 22 years ago

Well: it is Alt+W I checked it with my game and on this site: http://dlh.net/chtdb/chtview.php? lang=ger&sys=pc&disp=e3204

comment:7 by eriktorbjorn, 22 years ago

Travan has confirmed that SDL generates the same keycode/ascii for him under Windows as it does for me under Linux. Something like this would match the original behaviour pretty closely then:

} else if (event.kbd.flags & OSystem::KBD_ALT) { // The result must be 273 for Alt-W // because that's what MI2 looks for in // its "instant win" cheat. _keyPressed = event.kbd.keycode + 154; } else

Of course, we may very well want to check for event.kbd.flags == OSystem::KBD_ALT and use event.kbd.ascii instead. I'm a bit fuzzy on the difference between keycode and ascii...

comment:8 by fingolfin, 22 years ago

keycodes correspond to keys. E.g. the "A" key has one particular keycode. When you press "A" or Shift-A or Ctrl-A, you get the same keycode each time. OTOH, the ascii code differs; pressing "A" gives a different ascii code than Shift-A (upper vs. lower case), etc.

comment:9 by fingolfin, 22 years ago

Status: newclosed

comment:10 by digitall, 6 years ago

Component: Engine: SCUMM
Game: Monkey Island 1
Note: See TracTickets for help on using tickets.