350 Commits

Author SHA1 Message Date
Kari Salminen
e02f94d392 Added preliminary version of drawing type 22 overlays (Such overlays are added with opcode 0xA4 (o2_loadMask22) and removed with opcode 0xA5 (o2_unloadMask22)). Things might be wrong so needs testing! WIP!
svn-id: r33713
2008-08-09 16:07:08 +00:00
Kari Salminen
80648431d9 Added updating of global variable var5 to Operation Stealth's renderOverlay function's type 20 overlay case (Previously var5 wasn't updated anywhere!). Also added a lower bound for var5's value into a comparison (Previously only the upper bound was tested for).
svn-id: r33712
2008-08-09 15:17:32 +00:00
Kari Salminen
36e6bb27b5 Removing moving with keys qweasdzxc for now because they messed with savegame name typing. One can move with the cursor keys anyway.
svn-id: r33710
2008-08-09 10:52:48 +00:00
Kari Salminen
8e33f1530c Small cleanup: Renamed rol to rolByte and made it handle all cases.
svn-id: r33708
2008-08-09 10:44:12 +00:00
Kari Salminen
c0701bfcb6 Added detection entry for the Sony published CD version of Future Wars.
Also added decrypting of the crypted AUTO00.PRC for this particular version.
Now this version should work but no CD audio support for it yet though.

svn-id: r33703
2008-08-08 18:28:13 +00:00
Kari Salminen
70760a77fd Partially fix Adlib volume setting in Cine (Now uses music volume for Adlib volume, previously always played with full volume. Doesn't differentiate between playing sound effects and music!).
svn-id: r33700
2008-08-08 14:46:19 +00:00
Kari Salminen
5cb08bd1e5 Added basic moving using keyboard (Only works in Operation Stealth at the moment):
- Should make it possible to complete the first arcade sequence legitimately
Renamed input variables (Their names were mixed up between Future Wars and Operation Stealth):
- Future Wars's inputVar1 -> egoMovedWithKeyboard
- Future Wars's inputVar2 -> xMoveKeyb
- Future Wars's inputVar3 -> yMoveKeyb
- Operation Stealth's inputVar0 -> xMoveKeyb
- Operation Stealth's inputVar1 -> yMoveKeyb

svn-id: r33698
2008-08-08 13:30:01 +00:00
Kari Salminen
092d7224b9 Implemented game speed changing by pressing - or + to e.g. ease testing.
svn-id: r33689
2008-08-07 21:46:56 +00:00
Kari Salminen
da84a54694 Added precautionary tests to background scrolling function in Operation Stealth to avoid possible memory corruptions.
svn-id: r33688
2008-08-07 19:46:06 +00:00
Kari Salminen
853f4dbbe0 Made drawPlainBox handle border cases so it won't corrupt memory so easily. This may help with some memory corruption issues when for an example trying to draw the player's command string out of screen.
svn-id: r33687
2008-08-07 19:31:12 +00:00
Kari Salminen
b8bfd5d04f Fix for popup boxes sometimes blocking animation when they shouldn't in Operation Stealth:
- Made waitForPlayerClick updating more like in the original.
- Moved removeMessages to after the frame drawing in main loop hoping to be more like the original.
- Added an additional test to Operation Stealth's implementation of overlay type 2 drawing.
- Added an additional parameter incrementing and testing to Operation Stealth's removeMessages.
Hopefully this won't cause any regressions in Future Wars!

svn-id: r33686
2008-08-07 19:04:19 +00:00
Kari Salminen
92eec1b905 HACK: In Operation Stealth after the first arcade sequence jump player's position to avoid getting stuck.
The player's position is changed only by *one* pixel but it helps
and makes it possible to carry on with the game (Previously the player was totally stuck).

svn-id: r33673
2008-08-06 23:12:25 +00:00
Kari Salminen
f5e9a3e185 Tiny comment update to loadCt-opcodes: Load collision table data.
svn-id: r33670
2008-08-06 20:58:02 +00:00
Kari Salminen
a10753e2a1 Renamed page3Raw to collisionPage so it's more apparent what it does.
svn-id: r33669
2008-08-06 20:54:38 +00:00
Kari Salminen
66fc0d6a25 Add 320x200 screen bounds checking to Operation Stealth's checkCollision function.
Fixes teleporting bug when getting out of the water after first arcade sequence.
The player previously got teleported to the beach near the hotel. Now it doesn't happen.
The player is still caught motionless and can't move after this fix though...

svn-id: r33668
2008-08-06 20:47:59 +00:00
Kari Salminen
a944497d75 HACK: Force oxygen to maximum during Operation Stealth's first arcade sequence.
This way the arcade sequence is completable now.
This hack should be removed later and the first
arcade sequence be made properly playable!

svn-id: r33667
2008-08-06 20:41:53 +00:00
Kari Salminen
df1246bf9f Workaround for missing player character animation when exiting the airport in Santa Paragua in at least the 256 color PC version of Operation Stealth.
svn-id: r33644
2008-08-05 21:20:11 +00:00
Kari Salminen
f3ecdaa6fe Made rest of resource loading functions used in loadResource return -1 on error.
This fixed a crash in Operation Stealth when walking out of the airport
(Some file couldn't be opened and the game crashed because of that.
Now it doesn't crash but handles the missing file gracefully).

svn-id: r33643
2008-08-05 19:30:16 +00:00
Kari Salminen
9417066641 Add detection entry for a previously unrecognized 16 color PC version of Operation Stealth (The John Glames variant).
svn-id: r33642
2008-08-05 18:17:55 +00:00
Kari Salminen
966b5eb94e Fix prompt updating regression introduced in r32257:
Previously prompt didn't get updated all the time,
like e.g. when selecting EXAMINE and moving the
cursor over to DOOR and then moving the cursor to
a place where there was no selectable object. The
prompt would've still shown "EXAMINE DOOR", now
it shows just "EXAMINE" which is correct AFAIK.

svn-id: r33637
2008-08-05 12:58:23 +00:00
Kari Salminen
99addb709c Fix for misplaced objects in mouse object selection (Operation Stealth specific).
- Implemented Operation Stealth specific part of getObjectUnderCursor
  which handles negative frame values.
- Fixed a test case (Should test for ydif <= 0 although tested for ydif < 0).
- Made part-value be anded with 0x0F in a test case to comply with disassembly.
- Added comment about a test case which isn't present in the disassembly.
  Removing it makes things crash sometimes so letting it be.

svn-id: r33620
2008-08-04 19:32:52 +00:00
Kari Salminen
efd4a7a72f Made loadResourcesFromSave internally use the loadResource-function.
Fixes Operation Stealth savegame loading! HURRAH! FINALLY!

svn-id: r33530
2008-08-02 15:59:38 +00:00
Kari Salminen
6307c46604 - Combined loadAbs and loadResource into one function.
- Made resource loading functions (loadSpl, loadMsk etc)
  return the number of the animDataTable entry right after
  the loaded data.
- Made resource loading functions always load multiframe
  data into directly sequential animDataTable entries
  (Hopefully this won't break anything).

svn-id: r33529
2008-08-02 15:47:25 +00:00
Kari Salminen
81cb493158 Debug printing a couple more relevant variables in addAni.
svn-id: r33446
2008-07-30 11:36:14 +00:00
Kari Salminen
4210defa29 Added some debug aids related to addAni and the processSeqList crashing.
svn-id: r33444
2008-07-30 11:03:52 +00:00
Max Horn
0be985ce83 Changed class File (and derived classes) to only support read-only access; added a new class DumpFile for writing
svn-id: r33412
2008-07-29 16:09:10 +00:00
Kari Salminen
c9051fcfbd Make sure processSeqList and purgeSeqList are only called in the main loop when running Operation Stealth. Mostly a precaution as the seqList should be totally empty when running Future Wars as it doesn't use it.
svn-id: r33410
2008-07-29 13:46:42 +00:00
Kari Salminen
d83c6d7d68 Added purgeSeqList function (Used in mainloop now). Let's see if this helps any...
Renamed functions:
* addScriptToList0 -> addScriptToGlobalScripts
* executeList0     -> executeGlobalScripts
* executeList1     -> executeObjectScripts
* purgeList1       -> purgeObjectScripts (Also added a clarifying TODO to this function)
* purgeList0       -> purgeGlobalScripts (Also added a clarifying TODO to this function)

svn-id: r33409
2008-07-29 13:44:14 +00:00
Kari Salminen
52700d59fd Added a debug message to loadTempSaveOS's to check whether we loaded the whole savefile. Made objectStruct's clearing also clear x and y member variables in resetEngine.
svn-id: r33407
2008-07-29 12:56:32 +00:00
Kari Salminen
0365c45b8c Rearranged parts of the Operation Stealth savegame loading routine.
- Emulating the Future Wars savegame loading routine and hoping for the best.
- Fixes an array out of bounds access when loading the global scripts.
Now the loading crashes in the mainloop in processSeqList!
But at least we got a bit farther this time. More fixing to come...

svn-id: r33404
2008-07-29 10:13:53 +00:00
Max Horn
09f70b6408 Fixing 'warning: comparison of unsigned expression < 0 is always false'
svn-id: r33383
2008-07-28 22:21:11 +00:00
Kari Salminen
d2639f0c84 Fixed crash when running Operation Stealth introduced in r33339 (There are actually 256 global variables although only 255 of them are saved and loaded from savegames. The last one is VAR_BYPASS_PROTECTION and it is written to in the mainLoop so that's why there was a crash).
svn-id: r33380
2008-07-28 16:46:20 +00:00
Kari Salminen
add07fceaa Added loading of temporary Operation Stealth savegames. Needs testing!
- Music related settings and adBgVar0 & adBgVar1 aren't loaded currently.
Modified resetEngine to also reset more of the Operation Stealth specific variables.
Added getter for background scrolling value.
Changed additional background indices 1 & 2 from byte to uint16.
Made savegame loading functions return !in.ioFailed() as return value instead of true as previously.

svn-id: r33379
2008-07-28 16:02:40 +00:00
Kari Salminen
b08288c1cd Added remaining load functions needed for the Operation Stealth savegame format loading (loadSeqList and loadZoneQuery). Not used yet.
svn-id: r33367
2008-07-28 10:54:53 +00:00
Kari Salminen
c23f805a7f Cut Future Wars savegame loading routine into parts that can be reused when loading the Operation Stealth savegame format.
svn-id: r33366
2008-07-28 10:44:54 +00:00
Kari Salminen
50088df80f Now detects temporary Operation Stealth savegame format and saves it. No loading yet.
svn-id: r33365
2008-07-28 10:09:00 +00:00
Kari Salminen
16fe053ab4 Made the savegame loading routine choose between loading a Future Wars or an Operation Stealth savegame format.
Added a stub for loading the Operation Stealth's temporary savegame format (Not yet implemented).
Made mouse cursor change to a disk icon when loading a savegame and back to normal after its done.

svn-id: r33362
2008-07-28 08:44:49 +00:00
Kari Salminen
06a45c49c7 Added a preliminary saving routine for Operation Stealth (Disabled by default, needs more work still. WIP!).
Added backgrounds' name saving (8 names in Operation Stealth instead of just 1 like in Future Wars).
Added 256 color palette saving and restoring (One of the palettes isn't properly handled yet though).

svn-id: r33349
2008-07-27 22:50:36 +00:00
Kari Salminen
cedbb6b2b2 Clear the confusing usage of NUM_MAX_VAR (It's 255 actually, not 256).
svn-id: r33339
2008-07-27 14:36:53 +00:00
Kari Salminen
955d0700f5 Cut savegame loading into smaller functional parts (resetEngine, loadPlainSave etc).
svn-id: r33338
2008-07-27 14:33:37 +00:00
Kari Salminen
55bf215ba4 Renamed opcodes 0x49 and 0x68:
- Opcode 0x49: setDefaultMenuColor2 -> setDefaultMenuBgColor
- Opcode 0x68: setDefaultMenuColor  -> setPlayerCommandPosY

svn-id: r33240
2008-07-23 14:19:31 +00:00
Max Horn
c92f154b90 Fix warnings in CINE
svn-id: r33202
2008-07-22 14:38:54 +00:00
Kari Salminen
a38234d6e6 Fix CineSaveGameFormat enumeration's include order (Caused problems at least with GCC).
svn-id: r33196
2008-07-22 12:17:44 +00:00
Kari Salminen
2a90435e5d Fix for bug #2019355 (FW: broken compatibility with 0.11.1 saves):
- Changed savegame loading related functions to use SeekableReadStream
  rather than InSaveFile so MemoryReadStream can be used transparently.
- Fixed loadResourcesFromSave to load multiframe animations correctly
  and to load 0.11.0/0.11.1 Future Wars savegames which used a slightly
  different format.
- Added a savegame format detector that tries to detect between the old
  Future Wars savegame format, the new one and a broken revision of the
  new one.
- Changed makeLoad to first load the savegame fully into memory and only
  then handle it (If the savegame's packed then it's unpacked first). If
  the packed savegame can't tell its unpacked size (i.e. it's using zlib
  format) then we'll try to load up to 256kB of the savegame data.
Thanks to wjp for his help with nailing this release critical bug.

svn-id: r33192
2008-07-22 10:15:58 +00:00
Kari Salminen
8757326b5f Added savefile position comments to savegame loading routine (Helpful for debugging the formats).
svn-id: r33096
2008-07-18 14:01:53 +00:00
Kari Salminen
67bef188d3 Patch #2019455: Patch for reducing the BSS size of Cine engine.
svn-id: r33087
2008-07-17 07:13:41 +00:00
Kari Salminen
60357650e0 Fix for bug #2016647 (FW: crash with italian amiga version).
- Consists of a workaround for a script bug that used local
  variable 251 when it should've used global variable 251.
- Also added a fix for a crash when failing copy protection
  in Amiga or Atari ST versions of Future Wars.
NOTE: That any of the Amiga or Atari ST versions of Future Wars
haven't crashed right in the beginning before seems like plain
luck because accessing local variable 251 is out of bounds!

svn-id: r33068
2008-07-14 23:10:51 +00:00
Kari Salminen
e74d01a59a Fix for bathroom door opening crash in Operation Stealth's start.
svn-id: r32951
2008-07-07 22:02:01 +00:00
Kari Salminen
18559708c6 Fully implemented processSeqListElement
- Added parts that were missing and fixed a couple of errors
-- One test was backwards and a global variable was written to when it shouldn't have been
Added global variable inputVar0 that's used in processSeqListElement
NOTE: inputVar0 isn't updated anywhere yet, so that's a TODO

svn-id: r32874
2008-07-02 04:31:50 +00:00
Max Horn
bd296a45fa Fixed unitialized variables
svn-id: r32865
2008-07-01 10:33:25 +00:00