145 Commits

Author SHA1 Message Date
Eugene Sandulenko
0d356d1c66 AGI: Safer string copying 2016-05-10 18:07:35 +02:00
Martin Kiewitz
e1c36a52b5 AGI: Add support for upscaling and Hercules hires font
- User option to force Hercules hires font for any rendering mode
- Also change mouse cursor hotspots from 1,1 to 0,0
- Fix inaccuracy in mouse controlled game menu
- Change render_Block(), drawBox(), drawDisplayRect() to use
  upper Y instead of lower Y. Original AGI uses lower Y, but
  upper Y makes upscaling way easier.
2016-02-27 21:44:21 +01:00
Martin Kiewitz
5484f0bc58 AGI: Add detection+workaround for endofloop+motion at the same time
Detects when end.of.loop + motions are used on the same screen
object at the same time, which would have resulted in flag
corruption in the original interpreter. We detect this
situation now, show a warning and disable the cycler in case
cycler was activated first.
This solves a new issue in kq1, when grabbing the eagle in room
22, that was previously hidden just like in the original AGI.
Fixes bug #7046
2016-02-19 10:34:37 +01:00
Martin Kiewitz
ed92ccde23 AGI: Apple IIgs time delay override MH1 completed
+ Disable hide.mouse for MH1 Apple IIgs
2016-02-18 16:55:49 +01:00
Martin Kiewitz
591e0522b9 AGI: Set.pri.base comments added (Apple IIgs KQ3+SQ2)
For KQ3 the calls are currently blocked b/c interpreter version
For SQ2 they aren't, which causes a few priority issues at the end
2016-02-16 16:51:43 +01:00
Martin Kiewitz
7b75936f56 AGI: Add heuristic to detect delay loops within scripts
And in that case poll events, delay for a few milliseconds and
update screen.
This somewhat worked before the graphics rewrite because of
a timer hack.
This one tries to detect actual inner loops.
Happens in at least Police Quest 1 when playing poker.
2016-02-14 22:43:52 +01:00
Martin Kiewitz
8eefa4e2b5 AGI: Added a few comments about KQ1
set.simple gets called when killing the witch + planting beans
Right after bowing to the king, ego faces away from him. This
issue was already present in 1.7.0. Could probably get solved
later via script patcher.
2016-02-14 15:17:57 +01:00
Martin Kiewitz
9a9ddc777e AGI: set.pri.base was actually available in AGI2.425
Was available only in 2.425 and in 2.936+.
Fixing comment accordingly. Also allowing the command for 2.425.
2016-02-14 02:01:28 +01:00
Martin Kiewitz
9f59b5ed7c AGI: Fix priority band handling
- Fix saving/loading priority bands table. Now saving the actual raw
  data
- Now also saving the flag, that defines if the priority table got
  modified by scripts
- For older saved games it will try to figure out the state of that
  flag
- Blocking set.pri.base for AGI below 2.936
- set.pri.base was actually introduced in 2.936 and not AGI3
- The set.pri.base bug was present in 2.936 as well
- Saved games created between the graphics rewrite and this
  commit may have priority issues for games, that used AGI2.936+
2016-02-13 20:42:30 +01:00
Martin Kiewitz
dbea55b36b AGI: Rename nonBlockingText -> artificialDelay
Also add a table for Apple IIgs games for music issues like in PQ1
intro, where the developers thought that loading a new room would
take X amount of time and they started loading before the music was
done. In our AGI music may get cut off because of this.

It of course also happens, when using the original interpreter,
as soon as you emulate a faster processor. Which means this
is also a workaround.

See bug #7026
2016-02-11 17:26:25 +01:00
Martin Kiewitz
c26d3fd62f AGI: Change set.simple string copy code 2016-02-09 13:51:14 +01:00
Martin Kiewitz
f5a83adc01 AGI: Fix various CIDs
CID 1350104: regression from graphics rewrite in C64 picture drawing
CID 1350101: potential buffer overflow in set.simple command
CID 1350112: uninitialized variable in TextMgr
CID 1350113: false positive uninitialized variable in SystemUI
CID 1350114: potentially uninitialized variable in IIgsSample
CID 1350117: false positive uninitialized variable in InventoryMgr
CID 1350103: code bug in CGA rendering TextMgr::charAttrib_Set()
CID 1350109: false positive in GfxFont::loadFontAmigaPseudoTopaz()
CID 1350111: original AGI uninitialized memory issue
             in SpritesMgr::showObject
2016-02-09 12:47:45 +01:00
Martin Kiewitz
e155e1bfa9 AGI: Stop set.simple getting called for <2.425
Also stop it from getting called by 2.440 AGI.
Was implemented for 2.425, removed in 2.440 and re-added
in 2.917.
The opcode is called after answering the phone at the store
(555-6969) in Apple IIgs Larry. It can't be automatic saving.
See script 22, line 678 in AGI Studio.
Stops automatic saving getting enabled for Larry 1 Apple IIgs.
Also added warning messages to other commands as well.
2016-02-07 18:05:51 +01:00
Martin Kiewitz
72a3cae20b AGI: Restrict hide.mouse to AGI3 only
Command seems to not have existed in at least 2.917 (PC).
Space Quest 2 on Apple IIgs calls it during intro, but never
calls show.mouse. SQ2 on other platforms does not make this call.
Mouse cursor is not hidden under emulator, so atm I have to assume
that it's either a dodgy script or there was something else hacked
into the interpreter back then.

This fixes Space Quest 2 Apple IIgs losing mouse cursor, when
the intro is not canceled.
2016-02-04 23:24:59 +01:00
Martin Kiewitz
4b7d49dcff AGI: Fix Hold-Key-Mode implementation
Hold-Key-Mode got introduced v2.425, it was simply not possible
to disable it until 3.098.
Now creating a AGI_KEY_STATIONARY event, so that it works properly

Fixes Mixed Up Mother Goose
2016-02-04 22:53:15 +01:00
Martin Kiewitz
9f7ff8351b AGI: Fix mouse code for transitions
Do not show mouse cursor after transition, when it's currently
switched to hidden. Do the same for hide/show.mouse opcodes.
2016-02-04 21:21:52 +01:00
Martin Kiewitz
9fecbe58a1 AGI: Remove Gold Rush workaround, no longer needed 2016-02-03 01:03:40 +01:00
Martin Kiewitz
5f41a09701 AGI: Remove inputMode, not needed anyore 2016-02-02 23:02:50 +01:00
Johannes Schickel
6778175f6d AGI: Fix formatting.
This mostly enforces tabs for indentation and spaces for formatting. But also
fixes spaces on empty lines, some extra/missing spaces.

astyle + manual fixup
2016-02-02 20:15:18 +01:00
Martin Kiewitz
05a5fc1b65 AGI: mouse support for menu 2016-02-02 17:28:58 +01:00
Martin Kiewitz
2a4a290d31 AGI: change how menus are triggered on Non-PC 2016-02-01 19:08:22 +01:00
Martin Kiewitz
9fff1686fc AGI: Pass vm pointer directly to commands
No functional change
2016-02-01 16:37:28 +01:00
Martin Kiewitz
839ac0a6a4 AGI: Rename _game.lognum to _game.curLogicNr
Also a bit of cleanup
2016-02-01 16:21:13 +01:00
Martin Kiewitz
f86d68d214 AGI: Remove old clockEnabled boolean
No longer needed
We use ScummVM system total play time functionality instead
2016-02-01 15:54:32 +01:00
Martin Kiewitz
896bf83ddc AGI: Fix pause command effectively freezing game
In game timer wasn't resumed, which caused no more cycles to
get executed.
2016-02-01 15:52:18 +01:00
Martin Kiewitz
c28e101cdb AGI: implement predictive dialog 2016-02-01 01:34:36 +01:00
Martin Kiewitz
fd9c46831d AGI: remove timer hack, implement in game timer
in game timer is now updated, when scripts read in game timer
VM variables and during main loop. ScummVM total play time feature
is used for it. Game cycle syncing is done at the same time.
2016-01-31 20:53:36 +01:00
Martin Kiewitz
4bc01ab7d5 AGI: getflag/setflag/etc. cleanup
renamed getflag() to getFlag()
renamed setflag() to setFlag()
renamed flipflag() to flipFlag()
preagi: renamed setFlag for this engine to setWinnieFlag
2016-01-31 17:56:53 +01:00
Martin Kiewitz
82b958f274 AGI: VM Var code cleanup
Don't access variables directly, but through method
Shouldn't include any functional differences
Also changed several hardcoded values to the corresponding enums.
2016-01-31 17:35:13 +01:00
Martin Kiewitz
428df3e6cb AGI: copying between var + ego screen obj fixed
We copied the wrong way see cycle.cpp
This fixes the fan game 13th disciple. bug #3563
Also cleanup
playercontrol variable is now a boolean
2016-01-31 01:04:53 +01:00
Martin Kiewitz
41620c95cc AGI: remove commented out code from CmdSetSimple()
should have been removed already.
2016-01-29 15:28:17 +01:00
Martin Kiewitz
8a595e7771 AGI: graphics rewrite + cleanup
- graphics code fully rewritten
- Apple IIgs font support
- Amiga Topaz support
- Word parser rewritten
- menu code rewritten
- removed forced 2 second delay on all room changes
  replaced with heuristic to detect situations, where it's required
- lots of naming cleanup
- new console commands show_map, screenobj, vmvars and vmflags
- all sorts of hacks/workarounds removed
- added SCI wait mouse cursor
- added Apple IIgs mouse cursor
- added Atari ST mouse cursor
- added Amiga/Apple IIgs transition
- added Atari ST transition
- user can select another render mode and
  use Apple IIgs palette + transition for PC versions
- inventory screen rewritten
- SetSimple command now properly implemented
- PreAGI Mickey: Sierra logo now shown
- saved games: now saving controller key mapping
  also saving automatic save data (SetSimple command)
- fixed invalid memory access when saving games (31 bytes were saved
  using Common::String c_ptr()

Special Thanks to:
- fuzzie for helping out with the Apple IIgs font + valgrind
- eriktorbjorn for helping out with valgrind
- LordHoto for figuring out the code, that caused invalid memory
  access in the original code, when saving a game
- sev for help out with reversing the Amiga transition

currently missing:
- mouse support for menu
- mouse support for system dialogs
- predictive dialog support
2016-01-29 13:22:22 +01:00
Eugene Sandulenko
e215a75e7b AGI: stub for AGI1 newRoom() 2015-12-05 08:03:36 +01:00
Johannes Schickel
6aac905dfd AGI: Make GPL headers consistent in themselves. 2014-02-18 02:39:32 +01:00
Eugene Sandulenko
b47c50a703 AGI: Null terminate string. CID 1003888 2013-04-27 08:43:06 +03:00
Max Horn
34aaac0a1e AGI: Silence another clang var
Reading an array without using the resulting value has no effect.
In any case, this code still looks like it may be broken, so somebody
who knows more about AGI should perhaps investigate this closer.
2013-04-18 23:50:21 +02:00
Johannes Schickel
fa967e92b7 AGI: Silence C++11 narrowing warning. 2013-01-09 07:24:37 +01:00
Johannes Schickel
89abab97e3 JANITORIAL: Remove trailing whitespaces.
Powered by:
git ls-files "*.cpp" "*.h" "*.m" "*.mm" | xargs sed -i -e 's/[ \t]*$//'
2012-09-26 04:17:55 +02:00
Max Horn
00e6ab43f8 AGI: Add FIXME to cmdCallV1 2011-12-12 17:24:06 +01:00
Filippos Karapetis
d3858c359f AGI: Commented out if statements that always evaluate to true 2011-11-03 22:55:22 +02:00
Filippos Karapetis
3fb2973ed5 AGI: Fixed several incorrect substitutions of "game" with "_game" 2011-09-26 15:42:31 +03:00
Filippos Karapetis
397b4968d9 AGI: Rewrote cmdVersion() to use Common::String
This simplifies the code and avoids heap corruption because of the long
version string
2011-09-26 15:15:39 +03:00
Filippos Karapetis
81fdf2c103 AGI: Fixed bug #3074570 - "AGI LSL1: TAB stops working after restart"
Applied eriktorbjorn's patch from that bug tracker item (slightly
modified), which is what NAGI does, and which fixes restarting in LSL1
and PQ1 (bug #2823762), and other AGI games that do not reset the
controller keys when restarting.
2011-09-26 00:56:10 +03:00
Filippos Karapetis
bd6a05bdd4 AGI: Fix bug #3080041 - "AGI Mother Goose: White bar in intro" 2011-09-26 00:11:45 +03:00
Filippos Karapetis
a1c4aa6d89 AGI: Fixed typo in restart dialog 2011-09-25 18:34:35 +03:00
Eugene Sandulenko
b83cf61bfb Checked V1 instructions till 0x42 2011-08-14 21:40:07 +01:00
Eugene Sandulenko
273e37f726 AGI: Renamed some #defines to our code conventions and moved them to enums 2011-08-14 18:48:59 +01:00
Eugene Sandulenko
3cb41b5dfc AGI: Checked V1 instructions till 0x2c 2011-08-13 23:27:32 +01:00
Eugene Sandulenko
be9c5c0427 AGI: Checked V1 instructions till 0x20 2011-08-13 23:27:29 +01:00
Eugene Sandulenko
3fb50b815e AGI: Further work on v1 opcode difference 2011-08-13 23:27:27 +01:00