diff options
author | Travis Howell | 2009-07-18 00:53:31 +0000 |
---|---|---|
committer | Travis Howell | 2009-07-18 00:53:31 +0000 |
commit | aa98f944fe87e21870f375581541926913a4ac82 (patch) | |
tree | b9b8d19a94f4683ad699c6b590e9e8583241c014 /engines/agos | |
parent | cdf751accda346f5d96e3fdfa2fd4a1b92ed4d19 (diff) | |
parent | 025702ba4084dcad8dbe65c07a718f086320c19c (diff) | |
download | scummvm-rg350-aa98f944fe87e21870f375581541926913a4ac82.tar.gz scummvm-rg350-aa98f944fe87e21870f375581541926913a4ac82.tar.bz2 scummvm-rg350-aa98f944fe87e21870f375581541926913a4ac82.zip |
Merged revisions 42463,42468-42484,42486-42488,42490-42495,42498-42507,42510-42513,42516-42518,42521-42525,42527-42531,42533,42536-42540,42543,42545,42548,42551-42552,42558-42561,42563-42565,42570,42572 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk
........
r42463 | drmccoy | 2009-07-14 09:42:37 +1000 (Tue, 14 Jul 2009) | 1 line
Allow resource loading from EXT even if the TOT has none again
........
r42468 | fingolfin | 2009-07-14 18:36:06 +1000 (Tue, 14 Jul 2009) | 1 line
TINSEL: Don't use ioFailed to check if a file was opened succesfuly
........
r42469 | drmccoy | 2009-07-14 18:57:55 +1000 (Tue, 14 Jul 2009) | 1 line
Removing ioFailed() usage and fixing a leak in case of error
........
r42470 | joostp | 2009-07-14 19:44:56 +1000 (Tue, 14 Jul 2009) | 2 lines
commit peres' patch for #2813472: BASS: "showgrid" enabled triggers an assert
........
r42471 | dreammaster | 2009-07-14 20:26:56 +1000 (Tue, 14 Jul 2009) | 1 line
Bugfix for player being able to walk through some objects against room walls
........
r42472 | dreammaster | 2009-07-14 20:55:51 +1000 (Tue, 14 Jul 2009) | 1 line
Bugfix to cursor updates - it previously required that both X and Y positions had changed before a cursor change could occur
........
r42473 | joostp | 2009-07-14 21:15:21 +1000 (Tue, 14 Jul 2009) | 2 lines
add workaround for #2687172: BASS: Occasional loss of speech
........
r42474 | Kirben | 2009-07-14 22:34:42 +1000 (Tue, 14 Jul 2009) | 1 line
Add workaround for bug #1538873 - SIMON1 (French): Text wrongly displayed.
........
r42475 | vinterstum | 2009-07-14 22:55:54 +1000 (Tue, 14 Jul 2009) | 1 line
Updated xcode project
........
r42476 | strangerke | 2009-07-14 23:25:38 +1000 (Tue, 14 Jul 2009) | 1 line
Add detection for Playtoons CK 3 (FR)
........
r42477 | buddha_ | 2009-07-14 23:48:31 +1000 (Tue, 14 Jul 2009) | 1 line
Fix some typos and grammar in sword1's Sound::checkSpeechFileEndianness-function's comments.
........
r42478 | Kirben | 2009-07-14 23:50:17 +1000 (Tue, 14 Jul 2009) | 1 line
Change key combination to dump all script, due to conflict.
........
r42479 | vinterstum | 2009-07-14 23:52:11 +1000 (Tue, 14 Jul 2009) | 1 line
Split the iPhone OSystem class up into several files
........
r42480 | Kirben | 2009-07-14 23:53:54 +1000 (Tue, 14 Jul 2009) | 1 line
Update workaround for bug #1538873, which effects the Polish version of Simon the Sorcerer 2 too.
........
r42481 | Kirben | 2009-07-14 23:55:10 +1000 (Tue, 14 Jul 2009) | 1 line
Remove last ioFailed() usage in AGOS game engine.
........
r42482 | buddha_ | 2009-07-15 01:02:17 +1000 (Wed, 15 Jul 2009) | 1 line
Partially fix automatic restarting of AGI games (Addresses bug #2798797 ('AGI: larry 1 doesn't restart after dying') but doesn't fully fix it. There seems to be more to the problem still. Automatic restarting after dying of an STD doesn't take away the STD-condition and Larry continues to die in a loop).
........
r42483 | strangerke | 2009-07-15 01:48:05 +1000 (Wed, 15 Jul 2009) | 1 line
Add detection for Playtoons 4 EN_ANY as supplied by goodoldgeorg in bug #2820006
........
r42484 | eriktorbjorn | 2009-07-15 02:45:18 +1000 (Wed, 15 Jul 2009) | 3 lines
Got rid of ioFailed(). I haven't actually tested it, but we don't use the MPEG
decoder at the moment, and it was only used in the BACKEND_8BIT case anyway.
........
r42486 | lordhoto | 2009-07-15 04:14:20 +1000 (Wed, 15 Jul 2009) | 1 line
Got rid of ioFailed in font code, also added another check for err() when loading bdf fonts from text files.
........
r42487 | lordhoto | 2009-07-15 04:15:07 +1000 (Wed, 15 Jul 2009) | 1 line
Fix possible memory leak.
........
r42488 | fingolfin | 2009-07-15 04:24:20 +1000 (Wed, 15 Jul 2009) | 1 line
Got rid of some more ioFailed uses (also fixed a potential leak in graphics/font.cpp, and handle eos correctly in the FLAC code)
........
r42490 | lordhoto | 2009-07-15 05:32:25 +1000 (Wed, 15 Jul 2009) | 2 lines
Replaced char usage by int8, since char is unsigned on Linux/PPC by default.
........
r42491 | fingolfin | 2009-07-15 07:46:23 +1000 (Wed, 15 Jul 2009) | 1 line
AGOS: Cleanup PN code a bit, trying to make sense out of it
........
r42492 | fingolfin | 2009-07-15 07:50:22 +1000 (Wed, 15 Jul 2009) | 1 line
AGOS: Fixed potential OOBA crash in AGOSEngine_PN::opn_opcode26
........
r42493 | lordhoto | 2009-07-15 08:47:33 +1000 (Wed, 15 Jul 2009) | 1 line
Fix graphics glitch in LoL PC98 intro.
........
r42494 | fingolfin | 2009-07-15 09:03:25 +1000 (Wed, 15 Jul 2009) | 1 line
AGOS: Some more cleanup and added some comments to the PN code
........
r42495 | buddha_ | 2009-07-15 09:03:40 +1000 (Wed, 15 Jul 2009) | 1 line
Remove ioFailed() usage from AGI engine.
........
r42498 | Kirben | 2009-07-15 12:06:26 +1000 (Wed, 15 Jul 2009) | 1 line
Fix bug #2821215 - DIG: Skipping planetarium animation disables F5 menu.
........
r42499 | Kirben | 2009-07-15 15:00:59 +1000 (Wed, 15 Jul 2009) | 1 line
Hack is no longer required, due to revision 42498.
........
r42500 | dreammaster | 2009-07-15 18:55:12 +1000 (Wed, 15 Jul 2009) | 1 line
Created a system for inserting arbitrary code fragments into game scripts, and added an initial fragment to fix the bug of being stuck in the past in the DW1 SCN version
........
r42501 | fingolfin | 2009-07-15 20:04:50 +1000 (Wed, 15 Jul 2009) | 1 line
Got rid of two more ioFailed uses
........
r42502 | buddha_ | 2009-07-15 23:04:17 +1000 (Wed, 15 Jul 2009) | 1 line
Remove ioFailed() usage from Cine engine.
........
r42503 | buddha_ | 2009-07-15 23:10:29 +1000 (Wed, 15 Jul 2009) | 1 line
Fix some typos in TransactionError-enumeration's comments.
........
r42504 | Kirben | 2009-07-15 23:19:49 +1000 (Wed, 15 Jul 2009) | 1 line
Fix recent PN regression in vc32_saveScreen().
........
r42505 | Kirben | 2009-07-15 23:53:18 +1000 (Wed, 15 Jul 2009) | 1 line
Add Discworld 1/2.
........
r42506 | Kirben | 2009-07-15 23:58:23 +1000 (Wed, 15 Jul 2009) | 1 line
Add Cruise for a Corpse and games from MADE engine.
........
r42507 | lordhoto | 2009-07-16 01:51:47 +1000 (Thu, 16 Jul 2009) | 1 line
Bugfix: Disallow GMM Save/Load while in kyragem scene.
........
r42510 | lordhoto | 2009-07-16 03:07:45 +1000 (Thu, 16 Jul 2009) | 1 line
Fix "search" filter being settings lost in launcher, when using the "Edit Game..." menu for example.
........
r42511 | lordhoto | 2009-07-16 03:23:27 +1000 (Thu, 16 Jul 2009) | 1 line
Fix bug, which caused the ListWidget to draw a widget background around the selected item, when the ListWidget had no focus.
........
r42512 | lordhoto | 2009-07-16 04:05:37 +1000 (Thu, 16 Jul 2009) | 1 line
For a smoother user experience, use different colors for inverted text of the ListWidget, depending on whether the widget has focus or not.
........
r42513 | lordhoto | 2009-07-16 04:08:54 +1000 (Thu, 16 Jul 2009) | 1 line
Fix formatting of some switch statements.
........
r42516 | robinwatts | 2009-07-16 06:51:31 +1000 (Thu, 16 Jul 2009) | 4 lines
New ARM code blending Smartphone landscale scaler for WinCE port. Seems to work
in my mockup - I don't have a smartphone resolution device to test it.
........
r42517 | lordhoto | 2009-07-16 08:19:16 +1000 (Thu, 16 Jul 2009) | 1 line
Fix ugly spacing between tabs in classic theme (as reported by sunmax on -devel).
........
r42518 | lordhoto | 2009-07-16 08:19:31 +1000 (Thu, 16 Jul 2009) | 1 line
Slightly brighten up the active tab color in the modern theme.
........
r42521 | dreammaster | 2009-07-16 12:27:26 +1000 (Thu, 16 Jul 2009) | 1 line
Game script fix for bug #2525010 - in the GRA version, the luggage blocked Rincewind's exit from the Inn, leaving him in a non-walkable area
........
r42522 | dreammaster | 2009-07-16 14:06:35 +1000 (Thu, 16 Jul 2009) | 1 line
Added no blocking fix for Present Outside Inn scene as well
........
r42523 | thebluegr | 2009-07-16 18:13:08 +1000 (Thu, 16 Jul 2009) | 1 line
Added a detection entry for Pepper's Adventures in Time, and fixed an issue with _gfxop_set_pic(), which was causing crashes in that game
........
r42524 | thebluegr | 2009-07-16 18:17:38 +1000 (Thu, 16 Jul 2009) | 1 line
Added the French version of KQ5 floppy (bug report #2812611)
........
r42525 | thebluegr | 2009-07-16 18:21:06 +1000 (Thu, 16 Jul 2009) | 1 line
Added missing information for the newly-added version of Pepper
........
r42527 | dreammaster | 2009-07-16 19:31:31 +1000 (Thu, 16 Jul 2009) | 1 line
Added game script fix for bug #2680397 - game hang when using the brochure on the Beekeeper
........
r42528 | dreammaster | 2009-07-16 19:53:19 +1000 (Thu, 16 Jul 2009) | 1 line
Prior script fix also fixes bug #2820788, with stealing wizard's mallets
........
r42529 | tanoku | 2009-07-16 21:37:36 +1000 (Thu, 16 Jul 2009) | 2 lines
Fixed issue with beveled shapes being drawn outside their shapes. Possible regressions.
........
r42530 | lordhoto | 2009-07-16 21:41:45 +1000 (Thu, 16 Jul 2009) | 1 line
Formatting.
........
r42531 | lordhoto | 2009-07-16 21:42:07 +1000 (Thu, 16 Jul 2009) | 1 line
Update classic and builtin theme after r42529.
........
r42533 | thebluegr | 2009-07-16 22:43:42 +1000 (Thu, 16 Jul 2009) | 1 line
Added a proper fix for Pepper (the previous one caused regressions in KQ6)
........
r42536 | eriktorbjorn | 2009-07-17 03:26:44 +1000 (Fri, 17 Jul 2009) | 2 lines
Fixed GCC warning.
........
r42537 | tanoku | 2009-07-17 03:29:31 +1000 (Fri, 17 Jul 2009) | 2 lines
Fixed bug 2820514 ("Help dialog causes crash")
........
r42538 | lordhoto | 2009-07-17 03:39:16 +1000 (Fri, 17 Jul 2009) | 1 line
Formatting fixes.
........
r42539 | lordhoto | 2009-07-17 03:44:05 +1000 (Fri, 17 Jul 2009) | 1 line
This commit is just for DrMcCoy. (forgot to fix two usages of whitespaces instead of tabs for indentation -.-)
........
r42540 | tanoku | 2009-07-17 03:51:12 +1000 (Fri, 17 Jul 2009) | 2 lines
Fixed bug: In-game console doesn't stay centered when switching resolutions on the fly.
........
r42543 | lordhoto | 2009-07-17 07:47:57 +1000 (Fri, 17 Jul 2009) | 1 line
Fix bug in "KyraEngine_v2::runSceneScript6", fixes text line Zanthia says, when picking up the spellbook page in the town.
........
r42545 | Kirben | 2009-07-17 10:10:10 +1000 (Fri, 17 Jul 2009) | 1 line
Fix using subtitles only setting in The Dig.
........
r42548 | Kirben | 2009-07-17 10:25:27 +1000 (Fri, 17 Jul 2009) | 1 line
Fix bug #2821986 - COMI: setting to 'subtitles only' does not disable speech.
........
r42551 | drmccoy | 2009-07-17 10:55:42 +1000 (Fri, 17 Jul 2009) | 1 line
Added some more debug warnings when resources can't be loaded
........
r42552 | drmccoy | 2009-07-17 10:55:56 +1000 (Fri, 17 Jul 2009) | 1 line
Making TOTResourceItem::size unsigned, fixing a graphics bug that crept in
........
r42558 | dreammaster | 2009-07-17 15:10:24 +1000 (Fri, 17 Jul 2009) | 1 line
Added an explicit break out of the event processing loop for mouse buttons and/or key-presses - this should allow stylus-based systems to properly process 'mouse down' events before the 'mouse up' is processed
........
r42559 | Kirben | 2009-07-17 16:26:37 +1000 (Fri, 17 Jul 2009) | 1 line
Fix input glitch regression, after pausing in PN.
........
r42560 | Kirben | 2009-07-17 19:56:03 +1000 (Fri, 17 Jul 2009) | 1 line
Fix bug #2822956 - ELVIRA2: Crash at the beginning (regression).
........
r42561 | Kirben | 2009-07-17 20:48:30 +1000 (Fri, 17 Jul 2009) | 1 line
Correct error in saveBackGround.
........
r42563 | lordhoto | 2009-07-17 23:35:56 +1000 (Fri, 17 Jul 2009) | 1 line
Replace LGPL header by GPL header.
........
r42564 | lordhoto | 2009-07-17 23:50:59 +1000 (Fri, 17 Jul 2009) | 3 lines
- Moved SoundAdlibPC definition to new header file sound_adlib.h
- Made the future versions of sound.h GPL only
- sound_adlib.h is dual licensed under GPL and LGPL (so AdPlug can still benefit from future changes)
........
r42565 | lordhoto | 2009-07-18 00:05:22 +1000 (Sat, 18 Jul 2009) | 1 line
Cleanup.
........
r42570 | drmccoy | 2009-07-18 05:22:12 +1000 (Sat, 18 Jul 2009) | 1 line
Adding a workaround for the vanishing Coh Cott bug (#1972466), which is actually an error in that video file
........
r42572 | drmccoy | 2009-07-18 06:03:41 +1000 (Sat, 18 Jul 2009) | 1 line
/Finally/ fixing the longstanding flicker bug in Woodruff. I was completely mistaken about its cause, too
........
svn-id: r42576
Diffstat (limited to 'engines/agos')
-rw-r--r-- | engines/agos/agos.h | 29 | ||||
-rw-r--r-- | engines/agos/draw.cpp | 2 | ||||
-rw-r--r-- | engines/agos/event.cpp | 2 | ||||
-rw-r--r-- | engines/agos/pn.cpp | 10 | ||||
-rw-r--r-- | engines/agos/res_snd.cpp | 2 | ||||
-rw-r--r-- | engines/agos/script_pn.cpp | 248 | ||||
-rw-r--r-- | engines/agos/string.cpp | 14 | ||||
-rw-r--r-- | engines/agos/vga.cpp | 3 | ||||
-rw-r--r-- | engines/agos/vga_e2.cpp | 22 | ||||
-rw-r--r-- | engines/agos/vga_pn.cpp | 1 |
10 files changed, 183 insertions, 150 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 093f7bb039..263811b78a 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -1265,8 +1265,8 @@ protected: #ifdef ENABLE_PN class AGOSEngine_PN : public AGOSEngine { - struct stackframe { - struct stackframe *nextframe; + struct StackFrame { + StackFrame *nextframe; int16 flag[6]; int16 param[8]; int16 classnum; @@ -1276,7 +1276,7 @@ class AGOSEngine_PN : public AGOSEngine { int16 linenum; int16 process; jmp_buf *savearea; - stackframe() { memset(this, 0, sizeof(*this)); } + StackFrame() { memset(this, 0, sizeof(*this)); } }; @@ -1284,6 +1284,7 @@ class AGOSEngine_PN : public AGOSEngine { void demoSeq(); void introSeq(); void setupBoxes(); + int readfromline(); public: AGOSEngine_PN(OSystem *system); ~AGOSEngine_PN(); @@ -1297,10 +1298,10 @@ public: int actCallD(int n); void opn_opcode00(); - void opn_opcode01(); - void opn_opcode02(); - void opn_opcode03(); - void opn_opcode04(); + void opn_add(); + void opn_sub(); + void opn_mul(); + void opn_div(); void opn_opcode05(); void opn_opcode06(); void opn_opcode07(); @@ -1313,10 +1314,10 @@ public: void opn_opcode14(); void opn_opcode15(); void opn_opcode16(); - void opn_opcode17(); - void opn_opcode18(); - void opn_opcode19(); - void opn_opcode20(); + void opn_lt(); + void opn_gt(); + void opn_eq(); + void opn_neq(); void opn_opcode21(); void opn_opcode22(); void opn_opcode23(); @@ -1357,14 +1358,14 @@ public: void opn_opcode62(); void opn_opcode63(); - stackframe *_stackbase; + StackFrame *_stackbase; byte *_dataBase, *_textBase; uint32 _dataBaseSize, _textBaseSize; HitArea _invHitAreas[45]; - char _buffer[80]; + char _buffer[80]; char _inputline[61]; char _saveFile[20]; char _sb[80]; @@ -1390,7 +1391,7 @@ public: uint16 _objects; int16 _objectCountS; - int16 _bp; + int16 _bp; int16 _xofs; int16 _havinit; uint16 _seed; diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp index d09f02c76d..45443aa335 100644 --- a/engines/agos/draw.cpp +++ b/engines/agos/draw.cpp @@ -503,7 +503,7 @@ void AGOSEngine::saveBackGround(VgaSprite *vsp) { animTable->y = y; animTable->width = READ_BE_UINT16(ptr + 6) / 16; - if (vsp->flags & 40) { + if (vsp->flags & 0x40) { animTable->width++; } diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index b9c16d3d86..cbb09e1ec7 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -484,7 +484,7 @@ void AGOSEngine::delay(uint amount) { _fastMode ^= 1; } else if (event.kbd.keycode == Common::KEYCODE_d) { _debugger->attach(); - } else if (event.kbd.keycode == Common::KEYCODE_u) { + } else if (event.kbd.keycode == Common::KEYCODE_s) { dumpAllSubroutines(); } else if (event.kbd.keycode == Common::KEYCODE_i) { dumpAllVgaImageFiles(); diff --git a/engines/agos/pn.cpp b/engines/agos/pn.cpp index fd88d63ec3..d92efa9077 100644 --- a/engines/agos/pn.cpp +++ b/engines/agos/pn.cpp @@ -269,16 +269,16 @@ void AGOSEngine_PN::processor() { _variableArray[16] = _quickshort[6]; _variableArray[17] = _quickshort[7]; _variableArray[19] = getptr(55L); + + // q indicates the process to run and is 0 the first time, + // but 1 later on (i.e., when we are "called" from badload()). setposition(q, 0); doline(0); } void AGOSEngine_PN::setqptrs() { - int a = 0; - - while (a < 11) { - _quickptr[a] = getlong(3L * a); - a++; + for (int i = 0; i < 11; ++i) { + _quickptr[i] = getlong(3 * i); } _quickptr[11] = getlong(58L); _quickptr[12] = getlong(61L); diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp index 810f953bd7..e85440d8e1 100644 --- a/engines/agos/res_snd.cpp +++ b/engines/agos/res_snd.cpp @@ -332,7 +332,7 @@ void AGOSEngine::playSting(uint16 soundId) { mus_file.seek(soundId * 2, SEEK_SET); mus_offset = mus_file.readUint16LE(); - if (mus_file.ioFailed()) + if (mus_file.err()) error("playSting: Can't read sting %d offset", soundId); mus_file.seek(mus_offset, SEEK_SET); diff --git a/engines/agos/script_pn.cpp b/engines/agos/script_pn.cpp index 62ca94e387..4f9aab2965 100644 --- a/engines/agos/script_pn.cpp +++ b/engines/agos/script_pn.cpp @@ -30,17 +30,21 @@ namespace AGOS { +enum { + kJmpClassNum = -1 +}; + #define OPCODE(x) _OPCODE(AGOSEngine_PN, x) void AGOSEngine_PN::setupOpcodes() { static const OpcodeEntryPN opcodes[] = { /* 00 */ OPCODE(opn_opcode00), - OPCODE(opn_opcode01), - OPCODE(opn_opcode02), - OPCODE(opn_opcode03), + OPCODE(opn_add), + OPCODE(opn_sub), + OPCODE(opn_mul), /* 04 */ - OPCODE(opn_opcode04), + OPCODE(opn_div), OPCODE(opn_opcode05), OPCODE(opn_opcode06), OPCODE(opn_opcode07), @@ -56,11 +60,11 @@ void AGOSEngine_PN::setupOpcodes() { OPCODE(opn_opcode15), /* 16 */ OPCODE(opn_opcode16), - OPCODE(opn_opcode17), - OPCODE(opn_opcode18), - OPCODE(opn_opcode19), + OPCODE(opn_lt), + OPCODE(opn_gt), + OPCODE(opn_eq), /* 20 */ - OPCODE(opn_opcode20), + OPCODE(opn_neq), OPCODE(opn_opcode21), OPCODE(opn_opcode22), OPCODE(opn_opcode23), @@ -122,13 +126,14 @@ void AGOSEngine_PN::setupOpcodes() { void AGOSEngine_PN::executeOpcode(int opcode) { OpcodeProcPN op = _opcodesPN[opcode].proc; - (this->*op) (); + (this->*op)(); } -#define readfromline() (_linct-- ? (int)*_workptr++ : readoverr()) - -int readoverr() { - error("readfromline: Internal Error - Line Over-run"); +int AGOSEngine_PN::readfromline() { + if (!_linct) + error("readfromline: Internal Error - Line Over-run"); + _linct--; + return *_workptr++; } // ----------------------------------------------------------------------- @@ -142,30 +147,30 @@ void AGOSEngine_PN::opn_opcode00() { setScriptReturn(true); } -void AGOSEngine_PN::opn_opcode01() { +void AGOSEngine_PN::opn_add() { uint8 *str = _workptr; int32 sp = varval() + varval(); _variableArray[12] = sp % 65536; _variableArray[13] = sp / 65536; if (sp > 65535) - sp=65535; + sp = 65535; writeval(str, (int)sp); setScriptReturn(true); } -void AGOSEngine_PN::opn_opcode02() { +void AGOSEngine_PN::opn_sub() { uint8 *str = _workptr; int32 sp = varval(); sp -= varval(); _variableArray[12] = sp % 65536; _variableArray[13] = sp / 65536; - if(sp < 0) + if (sp < 0) sp = 0; writeval(str, (int)sp); setScriptReturn(true); } -void AGOSEngine_PN::opn_opcode03() { +void AGOSEngine_PN::opn_mul() { uint8 *str = _workptr; int32 sp = varval() * varval(); _variableArray[12] = sp % 65536; @@ -176,12 +181,12 @@ void AGOSEngine_PN::opn_opcode03() { setScriptReturn(true); } -void AGOSEngine_PN::opn_opcode04() { +void AGOSEngine_PN::opn_div() { uint8 *str = _workptr; int32 sp = varval(); int32 sp2 = varval(); if (sp2 == 0) - error("Division by 0"); + error("opn_div: Division by 0"); sp = sp / sp2; _variableArray[12] = sp % 65536; _variableArray[13] = sp / 65536; @@ -234,7 +239,7 @@ void AGOSEngine_PN::opn_opcode12() { char bf[8]; int a = 0; sprintf(bf,"%d", varval()); - while(bf[a]) + while (bf[a]) pcf(bf[a++]); setScriptReturn(true); } @@ -243,7 +248,7 @@ void AGOSEngine_PN::opn_opcode13() { char bf[8]; int a = 0; sprintf(bf,"%d", varval()); - while(bf[a]) + while (bf[a]) pcf(bf[a++]); pcf((uint8)'\n'); setScriptReturn(true); @@ -271,25 +276,25 @@ void AGOSEngine_PN::opn_opcode16() { setScriptReturn((sp >= 0 && sp <= 4)); } -void AGOSEngine_PN::opn_opcode17() { +void AGOSEngine_PN::opn_lt() { int16 v1 = varval(); int16 v2 = varval(); setScriptReturn(v1 < v2); } -void AGOSEngine_PN::opn_opcode18() { +void AGOSEngine_PN::opn_gt() { int16 v1 = varval(); int16 v2 = varval(); setScriptReturn(v1 > v2); } -void AGOSEngine_PN::opn_opcode19() { +void AGOSEngine_PN::opn_eq() { int16 v1 = varval(); int16 v2 = varval(); setScriptReturn(v1 == v2); } -void AGOSEngine_PN::opn_opcode20() { +void AGOSEngine_PN::opn_neq() { int16 v1 = varval(); int16 v2 = varval(); setScriptReturn(v1 != v2); @@ -302,11 +307,10 @@ void AGOSEngine_PN::opn_opcode21() { void AGOSEngine_PN::opn_opcode22() { int pf[8]; - int a; - a = varval(); - funcentry(pf, a); + int n = varval(); + funcentry(pf, n); funccpy(pf); - setposition(a, 0); + setposition(n, 0); setScriptReturn(true); } @@ -315,19 +319,27 @@ void AGOSEngine_PN::opn_opcode23() { } void AGOSEngine_PN::opn_opcode24() { - popstack(-1); + popstack(kJmpClassNum); + // Jump back to the last doline, which will return 2-1=1. + // That value then is returned to actCallD, which once again + // returns it. In the end, this amounts to a setScriptReturn(true) + // (but possibly in a different level than the current one). longjmp(*(_stackbase->savearea), 2); setScriptReturn(false); } void AGOSEngine_PN::opn_opcode25() { - popstack(-1); + popstack(kJmpClassNum); + // Jump back to the last doline, which will return 1-1=0. + // That value then is returned to actCallD, which once again + // returns it. In the end, this amounts to a setScriptReturn(false) + // (but possibly in a different level than the current one). longjmp(*(_stackbase->savearea), 1); setScriptReturn(false); } void AGOSEngine_PN::opn_opcode26() { - while ((_stackbase->classnum != -1) && (_stackbase != NULL)) + while ((_stackbase != NULL) && (_stackbase->classnum != kJmpClassNum)) junkstack(); dumpstack(); setScriptReturn(true); @@ -347,6 +359,8 @@ void AGOSEngine_PN::opn_opcode28() { void AGOSEngine_PN::opn_opcode29() { popstack(varval()); + // Jump back to the last doline indicated by the top stackfram. + // The -1 tells it to simply go on with its business. longjmp(*(_stackbase->savearea), -1); setScriptReturn(false); } @@ -395,7 +409,8 @@ void AGOSEngine_PN::opn_opcode32() { char bf[60]; int a, slot; - if ((a = varval()) > 2) { + a = varval(); + if (a > 2) { setScriptReturn(true); return; } @@ -451,10 +466,8 @@ void AGOSEngine_PN::opn_opcode35() { } void AGOSEngine_PN::opn_opcode36() { - int ct = 0; - while (ct < _dataBase[57] + 1) - _wordcp[ct++] = 0; - ct = 1; + for (int i = 0; i < _dataBase[57] + 1; ++i) + _wordcp[i] = 0; if (isspace(*_inpp)) while ((*_inpp) && (isspace(*_inpp))) _inpp++; @@ -468,6 +481,8 @@ void AGOSEngine_PN::opn_opcode36() { setScriptReturn(true); return; } + + int ct = 1; while ((*_inpp != '.') && (*_inpp != ',') && (!isspace(*_inpp)) && (*_inpp != '\0') && (*_inpp!='"')) { if (ct < _dataBase[57]) @@ -734,37 +749,38 @@ int AGOSEngine_PN::varval() { int a; int b; - if ((a = readfromline()) < 247) { + a = readfromline(); + if (a < 247) { return a; } switch (a) { case 249: b = readfromline(); - return((int)(b + 256 * readfromline())); + return (int)(b + 256 * readfromline()); break; case 250: - return(readfromline()); + return readfromline(); case 251: - return((int)_variableArray[varval()]); + return (int)_variableArray[varval()]; case 252: b = varval(); - return((int)_dataBase[_quickptr[0] + b * _quickshort[0] + varval()]); + return (int)_dataBase[_quickptr[0] + b * _quickshort[0] + varval()]; case 254: b = varval(); - return((int)_dataBase[_quickptr[3] + b * _quickshort[2] + varval()]); + return (int)_dataBase[_quickptr[3] + b * _quickshort[2] + varval()]; case 247: b = varval(); - return((int)getptr(_quickptr[11] + (b * _quickshort[4]) + (2 * varval()))); + return (int)getptr(_quickptr[11] + (b * _quickshort[4]) + (2 * varval())); case 248: b = varval(); - return((int)getptr(_quickptr[12] + (b * _quickshort[5]) + (2 * varval()))); + return (int)getptr(_quickptr[12] + (b * _quickshort[5]) + (2 * varval())); case 253: b = varval(); - return(bitextract((int32)_quickptr[1] + b * _quickshort[1], varval())); + return bitextract((int32)_quickptr[1] + b * _quickshort[1], varval()); case 255: b = varval(); - return(bitextract((int32)_quickptr[4] + b * _quickshort[3], varval())); + return bitextract((int32)_quickptr[4] + b * _quickshort[3], varval()); default: error("VARVAL : Illegal code %d encountered", a); } @@ -834,10 +850,10 @@ void AGOSEngine_PN::setbitf(uint32 ptr, int offs, int val) { int AGOSEngine_PN::actCallD(int n) { int pf[8]; funcentry(pf, n); - addstack(-1); + addstack(kJmpClassNum); funccpy(pf); setposition(n, 0); - return(doline(1)); + return doline(1); } int AGOSEngine_PN::doaction() { @@ -859,47 +875,59 @@ int AGOSEngine_PN::doaction() { int AGOSEngine_PN::doline(int needsave) { int x; - jmp_buf *ljmpbuff = NULL; + jmp_buf *old_jmpbuf = NULL; jmp_buf *mybuf; mybuf = (jmp_buf *)malloc(sizeof(jmp_buf)); if (mybuf == NULL) error("doline: Out of memory - stack overflow"); - if ((x = setjmp(*mybuf)) > 0) { + x = setjmp(*mybuf); + // Looking at the longjmp calls below, x can be -1, 1 or 2 + // (and of course 0 when it returns directly, as always). + if (x > 0) { dumpstack(); - _cjmpbuff = ljmpbuff; + // Restore the active jmpbuf to its previous value, + // then return the longjmp value (will be 2-1=1 or 1-1=0). + _cjmpbuff = old_jmpbuf; free((char *)mybuf); return (x - 1); } if (x == -1) { + // Make this doline instance the active one (again). + // This is used to "return" over possibly multiple + // layers of nested script invocations. + // Kind of like throwing an exception. _cjmpbuff = mybuf; goto carryon; } - ljmpbuff = _cjmpbuff; + + // Remember the previous active jmpbuf (gets restored + // above when a longjmp with a positive param occurs). + old_jmpbuf = _cjmpbuff; _cjmpbuff = mybuf; if (needsave) _stackbase->savearea = mybuf; -nln: _linct = ((*_linebase) & 127) - 1; - _workptr = _linebase + 1; - if (*_linebase > 127) { - x = varval(); - if (x != (int)_variableArray[1]) - goto skipln; - } - -carryon: do { - x = doaction(); - } while (x && !shouldQuit()); + _linct = ((*_linebase) & 127) - 1; + _workptr = _linebase + 1; + if (*_linebase > 127) { + x = varval(); + if (x != (int)_variableArray[1]) + goto skipln; + } -skipln: _linebase += 127 & *_linebase; - _linembr++; +carryon: + do { + x = doaction(); + } while (x && !shouldQuit()); - if (!shouldQuit()) - goto nln; +skipln: + _linebase += 127 & *_linebase; + _linembr++; + } while (!shouldQuit()); return 0; } @@ -951,23 +979,15 @@ int AGOSEngine_PN::findset() { } void AGOSEngine_PN::funccpy(int *store) { - int a = 0; - int b = 24; - - while (a < 8) { - _variableArray[b++] = *store++; - a++; + for (int i = 24; i < 32; ++i) { + _variableArray[i] = *store++; } } void AGOSEngine_PN::funcentry(int *store, int procn) { - int ct = 0; - int nprm; - - nprm = _dataBase[getlong(_quickptr[6] + 3L * procn)]; - while (ct < nprm) { + int numParams = _dataBase[getlong(_quickptr[6] + 3 * procn)]; + for (int i = 0; i < numParams; ++i) { *store++ = varval(); - ct++; } } @@ -990,23 +1010,28 @@ int AGOSEngine_PN::gvwrd(uint8 *wptr, int mask) { int AGOSEngine_PN::setposition(int process, int line) { uint8 *ourptr; int np; - int ct = 0; - ourptr = _dataBase + getlong(_quickptr[6] + 3L * process); + int ct; + + ourptr = _dataBase + getlong(_quickptr[6] + 3 * process); np = *ourptr++; - while (ct < line) { + for (ct = 0; ct < line; ++ct) { ourptr += (127 & *ourptr); - ct++; } -x1: _linebase = ourptr; - _linct = (127 & (*ourptr)) - 1; - if (*ourptr++ > 127) { + + while (true) { + _linebase = ourptr; + _linct = (127 & *ourptr) - 1; + if (*ourptr++ <= 127) + break; + ct = varval(); - if (ct != (int)_variableArray[1]) { - ourptr += _linct - 1; - line++; - goto x1; - } + if (ct == (int)_variableArray[1]) + break; + + ourptr += _linct - 1; + line++; } + _linembr = line; _procnum = process; _variableArray[0] = process; @@ -1035,22 +1060,20 @@ int AGOSEngine_PN::wrdmatch(uint8 *word1, int mask1, uint8 *word2, int mask2) { // ----------------------------------------------------------------------- void AGOSEngine_PN::addstack(int type) { - struct stackframe *a; - int pt, ct = 0; + StackFrame *a; + int i; - a = (struct stackframe *)malloc(sizeof(struct stackframe)); + a = (StackFrame *)malloc(sizeof(StackFrame)); if (a == NULL) error("addstack: Out of memory - stack overflow"); a->nextframe = _stackbase; _stackbase = a; - pt = 0; - while (ct < 6) - a->flag[ct++] = _variableArray[pt++]; - ct = 0; - pt = 24; - while (ct < 8) - a->param[ct++] = _variableArray[pt++]; + + for (i = 0; i < 6; ++i) + a->flag[i] = _variableArray[i]; + for (i = 0; i < 8; ++i) + a->param[i] = _variableArray[24 + i]; a->classnum = type; a->ll = _linct; a->linenum = _linembr; @@ -1060,7 +1083,7 @@ void AGOSEngine_PN::addstack(int type) { } void AGOSEngine_PN::dumpstack() { - struct stackframe *a; + StackFrame *a; if (_stackbase == NULL) error("dumpstack: Stack underflow or unknown longjmp"); @@ -1071,20 +1094,20 @@ void AGOSEngine_PN::dumpstack() { } void AGOSEngine_PN::junkstack() { - struct stackframe *a; + StackFrame *a; if (_stackbase == NULL) error("junkstack: Stack underflow or unknown longjmp"); a = _stackbase->nextframe; - if (_stackbase->classnum == -1) + if (_stackbase->classnum == kJmpClassNum) free((char *)_stackbase->savearea); free((char *)_stackbase); _stackbase = a; } void AGOSEngine_PN::popstack(int type) { - int a = 0, b; + int i; while ((_stackbase != NULL) && (_stackbase->classnum != type)) junkstack(); @@ -1097,13 +1120,10 @@ void AGOSEngine_PN::popstack(int type) { _workptr = _stackbase->linpos; _procnum = _stackbase->process; _linembr = _stackbase->linenum; - b = 0; - while (a < 6) - _variableArray[b++] = _stackbase->flag[a++]; - b = 24; - a = 0; - while (a < 8) - _variableArray[b++] = _stackbase->param[a++]; + for (i = 0; i < 6; ++i) + _variableArray[i] = _stackbase->flag[i]; + for (i = 0; i < 8; ++i) + _variableArray[24 + i] = _stackbase->param[i]; } } // End of namespace AGOS diff --git a/engines/agos/string.cpp b/engines/agos/string.cpp index a466be796f..3773b1fa10 100644 --- a/engines/agos/string.cpp +++ b/engines/agos/string.cpp @@ -136,6 +136,20 @@ const byte *AGOSEngine::getStringPtrByID(uint16 stringId, bool upperCase) { strcpy((char *)dst, (const char *)stringPtr); } + // WORKAROUND bug #1538873: The French version of Simon 1 and the + // Polish version of Simon 2 used excess spaces, at the end of many + // messages, so we strip off those excess spaces. + if ((getGameType() == GType_SIMON1 && _language == Common::FR_FRA) || + (getGameType() == GType_SIMON2 && _language == Common::PL_POL)) { + uint16 len = strlen((const char *)dst) - 1; + + while (len && dst[len] == 32) { + dst[len] = 0; + len--; + } + + } + if (upperCase && *dst) { if (islower(*dst)) *dst = toupper(*dst); diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp index d2e620d86e..d37681508e 100644 --- a/engines/agos/vga.cpp +++ b/engines/agos/vga.cpp @@ -1186,7 +1186,8 @@ void AGOSEngine::vc32_saveScreen() { byte *src = (byte *)screen->pixels; for (int i = 0; i < _screenHeight; i++) { memcpy(dst, src, _screenWidth); - dst += screen->pitch; + dst += _backGroundBuf->pitch; + src += screen->pitch; } _system->unlockScreen(); } else { diff --git a/engines/agos/vga_e2.cpp b/engines/agos/vga_e2.cpp index 7f02398e13..f6e6630d43 100644 --- a/engines/agos/vga_e2.cpp +++ b/engines/agos/vga_e2.cpp @@ -207,6 +207,7 @@ void AGOSEngine::vc53_dissolveIn() { uint16 speed = vcReadNextWord() + 1; byte *src, *dst, *srcOffs, *srcOffs2, *dstOffs, *dstOffs2; + int16 xoffs, yoffs; uint8 color = 0; // Only uses Video Window 4 @@ -218,15 +219,13 @@ void AGOSEngine::vc53_dissolveIn() { uint16 dissolveDelay = dissolveCheck * 2 / speed; uint16 dissolveCount = dissolveCheck * 2 / speed; - Graphics::Surface *screen = _system->lockScreen(); - - int16 xoffs = _videoWindows[num * 4 + 0] * 16; - int16 yoffs = _videoWindows[num * 4 + 1]; - int16 offs = xoffs + yoffs * screen->pitch; + int16 x = _videoWindows[num * 4 + 0] * 16; + int16 y = _videoWindows[num * 4 + 1]; uint16 count = dissolveCheck * 2; while (count--) { - byte *dstPtr = (byte *)screen->pixels + offs; + Graphics::Surface *screen = _system->lockScreen(); + byte *dstPtr = (byte *)screen->pixels + x + y * screen->pitch; yoffs = _rnd.getRandomNumber(dissolveY); dst = dstPtr + yoffs * screen->pitch; @@ -285,6 +284,7 @@ void AGOSEngine::vc54_dissolveOut() { uint16 speed = vcReadNextWord() + 1; byte *dst, *dstOffs; + int16 xoffs, yoffs; uint16 dissolveX = _videoWindows[num * 4 + 2] * 8; uint16 dissolveY = (_videoWindows[num * 4 + 3] + 1) / 2; @@ -292,15 +292,13 @@ void AGOSEngine::vc54_dissolveOut() { uint16 dissolveDelay = dissolveCheck * 2 / speed; uint16 dissolveCount = dissolveCheck * 2 / speed; - Graphics::Surface *screen = _system->lockScreen(); - - int16 xoffs = _videoWindows[num * 4 + 0] * 16; - int16 yoffs = _videoWindows[num * 4 + 1]; - int16 offs = xoffs + yoffs * screen->pitch; + int16 x = _videoWindows[num * 4 + 0] * 16; + int16 y = _videoWindows[num * 4 + 1]; uint16 count = dissolveCheck * 2; while (count--) { - byte *dstPtr = (byte *)screen->pixels + offs; + Graphics::Surface *screen = _system->lockScreen(); + byte *dstPtr = (byte *)screen->pixels + x + y * screen->pitch; color |= dstPtr[0] & 0xF0; yoffs = _rnd.getRandomNumber(dissolveY); diff --git a/engines/agos/vga_pn.cpp b/engines/agos/vga_pn.cpp index 32c6e15f00..12846b08f1 100644 --- a/engines/agos/vga_pn.cpp +++ b/engines/agos/vga_pn.cpp @@ -129,7 +129,6 @@ void AGOSEngine::vc36_pause() { _keyPressed.reset(); windowPutChar(_windowArray[2], 13); - windowPutChar(_windowArray[2], 128); _wiped = oldWiped; _videoLockOut &= ~8; |