Author Topic: Hacking SQ1VGA with SCICompanion v3  (Read 3152 times)

0 Members and 1 Guest are viewing this topic.

Offline lskovlun

Re: Hacking SQ1VGA with SCICompanion v3
« Reply #15 on: March 23, 2016, 07:24:06 PM »
Quote
Is there something I'm not taking into account, here?

How are you getting to room 45 when you test these changes? If this is from a save game that has script 45 loaded and is from an older version of the code, then there could be problems. This is more likely in SCI1.1 though, since you'll get the old heap resource (from the save game) mixed with the new script resource. But things can still go wrong in SCI1.0.
No, kawa is right. The description and lookStr properties point to some of these strings. SCI Companion treats their values as numbers, but they are really pointers, which causes problems when you recompile the script (you probably don't even need to change anything, due to differences in code generation).

Offline troflip

Re: Hacking SQ1VGA with SCICompanion v3
« Reply #16 on: March 23, 2016, 07:58:20 PM »
Ah, it looks like the property value resolution (to strings/saids) is only supported for SCI1.1+. Oops.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline spiffythedog

Re: Hacking SQ1VGA with SCICompanion v3
« Reply #17 on: March 25, 2016, 03:18:47 AM »
Is there something I'm not taking into account, here?
You mean besides the fact that they're hard numbers and not the strings they should be? Nah, I think that's about it.

That actually really helped. Replacing the decimal addresses with the actual strings themselves has completely circumvented the problem.

Another problem: decompilation of script files isn't perfect, even if the program says it is. Important properties of instances seem to be almost randomly omitted for some reason, causing corrupted graphics and cursor hotspots (eg. the monitors and dials in room 8, the bartender's body and the little purple guys in the Rocket Bar, the radar in the loading bay of DBU, etc.). Simply looking through the disassembly of each script and manually re-adding these properties fixed this.

Additionally, while the script for the Deltaur armory room was successfully decompiled with no reported errors, a conditional statement involving the droid killing you if you show him the ID 3 times was corrupted somehow, as showing him the ID for the third time causes him to threaten your extermination and then just walk into the back room like he usually does. I'm currently wrangling with this one and still no dice.

Quote
Is there something I'm not taking into account, here?

How are you getting to room 45 when you test these changes? If this is from a save game that has script 45 loaded and is from an older version of the code, then there could be problems. This is more likely in SCI1.1 though, since you'll get the old heap resource (from the save game) mixed with the new script resource. But things can still go wrong in SCI1.0.

I've actually been avoiding that one (eheh) and am presently focusing on problems that are more within my current abilities (that is to say, not a lot), and I haven't exactly been going through the game room by room.

Speaking of current abilities, here are a few things I managed to fix so far:

  • About 95% of all grammar, spelling and formatting errors in the remaining narrator text strings have been cleaned up (while hopefully preserving the writers' proper intent)
  • Offering the jetpack to the salesbug produces a response via his on-screen yellow text instead of a grey narration box like usual
  • The salesbug's response to offers of common items no longer runs off-screen (as it has been properly split into two separate strings)
  • Showing 'Robbie' the bar coupon in the DBU loading bay produces a mechanical/'talking' sound effect like it should

Some other things I've noticed and plan to address:

  • The triple-breasted alien girl and the yellow slug guy in the bar have several animation loops that go completely unused (at least in my copy)
  • Some descriptions/text strings for certain environmental features in some rooms also go completely unused (eg. DBU loading bay, the Star Generator room, etc.). As a result, these rooms just feel really barren and lacking in interactivity

Script #0 ('Main') will also be another tricky one to tackle, as that contains all the inventory descriptions and doesn't decompile cleanly in SCI Companion. Wish me luck, I guess.

Offline Kawa

Re: Hacking SQ1VGA with SCICompanion v3
« Reply #18 on: March 25, 2016, 04:17:44 AM »
Good luck~

Offline lskovlun

Re: Hacking SQ1VGA with SCICompanion v3
« Reply #19 on: March 25, 2016, 04:51:24 AM »
Additionally, while the script for the Deltaur armory room was successfully decompiled with no reported errors, a conditional statement involving the droid killing you if you show him the ID 3 times was corrupted somehow, as showing him the ID for the third time causes him to threaten your extermination and then just walk into the back room like he usually does. I'm currently wrangling with this one and still no dice.
I'm not surprised that that doesn't work. it is a script bug in the original game, and I implemented a script patch for it in ScummVM. It happens to work in SSCI, but even it might be sensitive to code generation differences. The trouble is with this compound if statement:
Code: [Select]
(if
(<
(DeltaurRegion
timesShownID: (+ (DeltaurRegion timesShownID?) 1)
)
3
) ...etc...
The programmer thought that the expression (DeltaurRegion timesShownID: foo) would return foo (which would subsequently be compared to 3 in the if statement), but this is not the case. In other words, those middle three lines must be moved out of the if statement. It should read:
Code: [Select]
(DeltaurRegion timesShownID: (+ (DeltaurRegion timesShownID?) 1))
(if (< (DeltaurRegion timesShownID?) 3) ...etc...
As noted, ScummVM instead fixes this with a script patch, which a) would not decompile cleanly and b) might or might not work with altered scripts.

Offline spiffythedog

Re: Hacking SQ1VGA with SCICompanion v3
« Reply #20 on: March 25, 2016, 08:30:25 AM »
Additionally, while the script for the Deltaur armory room was successfully decompiled with no reported errors, a conditional statement involving the droid killing you if you show him the ID 3 times was corrupted somehow, as showing him the ID for the third time causes him to threaten your extermination and then just walk into the back room like he usually does. I'm currently wrangling with this one and still no dice.
I'm not surprised that that doesn't work. it is a script bug in the original game, and I implemented a script patch for it in ScummVM. It happens to work in SSCI, but even it might be sensitive to code generation differences. The trouble is with this compound if statement:
Code: [Select]
(if
(<
(DeltaurRegion
timesShownID: (+ (DeltaurRegion timesShownID?) 1)
)
3
) ...etc...
The programmer thought that the expression (DeltaurRegion timesShownID: foo) would return foo (which would subsequently be compared to 3 in the if statement), but this is not the case. In other words, those middle three lines must be moved out of the if statement. It should read:
Code: [Select]
(DeltaurRegion timesShownID: (+ (DeltaurRegion timesShownID?) 1))
(if (< (DeltaurRegion timesShownID?) 3) ...etc...
As noted, ScummVM instead fixes this with a script patch, which a) would not decompile cleanly and b) might or might not work with altered scripts.

Worked like a charm. Now it's just getting the droid's footsteps to play when he emerges from the back room (before he turns around to face you). I'm positive that its controlled by 'instant RobotWalksOut of Script', and that I need to add '(= loop 0) (= loop 5)  (proc999_5 cel 0 4))' and '(droidWalkSound number: 523 loop: -1 flags: 1 play:)' somewhere as part of a conditional statement, but I'm clueless as to how.

Offline OmerMor

Re: Hacking SQ1VGA with SCICompanion v3
« Reply #21 on: March 25, 2016, 12:53:22 PM »
You should probably go over all of ScummVM's patches for SQ1, to avoid reinventing the wheel:
https://github.com/scummvm/scummvm/blob/master/engines/sci/engine/script_patches.cpp#L3324

Offline troflip

Re: Hacking SQ1VGA with SCICompanion v3
« Reply #22 on: March 25, 2016, 02:17:08 PM »
Another problem: decompilation of script files isn't perfect, even if the program says it is. Important properties of instances seem to be almost randomly omitted for some reason, causing corrupted graphics and cursor hotspots (eg. the monitors and dials in room 8, the bartender's body and the little purple guys in the Rocket Bar, the radar in the loading bay of DBU, etc.). Simply looking through the disassembly of each script and manually re-adding these properties fixed this.

I'll take a look at why this is happening, thanks for the bug report!

[edit:] Looks like this is because the instance has more properties than the species from which it is derived declares. And we end up going down some failure path. I should be able to just have it ignore this problem I think.

Script #0 ('Main') will also be another tricky one to tackle, as that contains all the inventory descriptions and doesn't decompile cleanly in SCI Companion. Wish me luck, I guess.

What are the problems with script 0? I've attached my decompile of it (hopefully this is the same version of SQ1 VGA)

« Last Edit: March 25, 2016, 03:33:19 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline spiffythedog

Re: Hacking SQ1VGA with SCICompanion v3
« Reply #23 on: March 25, 2016, 09:45:37 PM »
Another problem: decompilation of script files isn't perfect, even if the program says it is. Important properties of instances seem to be almost randomly omitted for some reason, causing corrupted graphics and cursor hotspots (eg. the monitors and dials in room 8, the bartender's body and the little purple guys in the Rocket Bar, the radar in the loading bay of DBU, etc.). Simply looking through the disassembly of each script and manually re-adding these properties fixed this.

I'll take a look at why this is happening, thanks for the bug report!

[edit:] Looks like this is because the instance has more properties than the species from which it is derived declares. And we end up going down some failure path. I should be able to just have it ignore this problem I think.

Script #0 ('Main') will also be another tricky one to tackle, as that contains all the inventory descriptions and doesn't decompile cleanly in SCI Companion. Wish me luck, I guess.

What are the problems with script 0? I've attached my decompile of it (hopefully this is the same version of SQ1 VGA)

Decompiling my script 0 resulted in a 96% bytecount success rate with a warning ('WARNING:  ::proc0_10: Analyzing control flow: Expected node with two successors (then/else): 1 at 0384
Falling back to disassembly for proc0_10'). When I compile it and test in the game (usually from the start), the palette/colour scheme of the in-game menus and messages are completely wrong. I suspect that maybe there a few missing properties I need to reinstate.

Offline spiffythedog

Re: Hacking SQ1VGA with SCICompanion v3
« Reply #24 on: March 26, 2016, 12:31:44 AM »
Another problem: recompiling script 3 and then testing it in-game causes a minor bug during the dying scientist event. Directly after he collapses to the floor, Roger's right-facing walk cycle is briefly superimposed over the scientist's sprite and does a few rounds. Then it disappears and the scene continues as normal. I've tried looking through the decompiled script, but I can't seem to identify what's causing this behavior. Maybe it's somewhere else?

Offline spiffythedog

Re: Hacking SQ1VGA with SCICompanion v3
« Reply #25 on: July 01, 2016, 09:14:23 AM »
Now that I finally had some free time (as well as the new update for SCI Companion v3) to come back and tackle this, I think I'm almost done. Here is a list of changes:

GENERAL FIXES

  • Grammar, spelling and formatting errors in the narrator text strings have been cleaned up (while hopefully preserving the writers' original intent)
  • A number of item interactions no longer produce empty text boxes (e.g. use the bar coupon on the DBU coupon)
  • Cursor no longer switches to 'Taste' instead of 'Wait' when walking through laser fence in Kerona underground
  • Mugger sequence completely fixed
  • Offering the jetpack to the DBU salesbug prompts his unique on-screen yellow text rather than a regular grey text box
  • When offering the DBU salesbug common items as payment for a droid, his text response no longer spills off-screen (displayed with two text strings instead of one)
  • Discounted ship prices at Tiny's are now displayed correctly (144 buckazoids for the scrambler and 115 buckazoids for the saucer)
  • Tiny no longer negotiates the price of the ship after you've already bought it
  • Description of 'Enter' button when inputting Droid Navigation Code in ship no longer reuses the one for the cartridge retrieval system on the Arcada
  • Description of egg-like container of bottled-energy on top level of room 60 restored (no longer a cut-off fragment)

MISC. REVAMPS

  • Reinstated 'Orat Chow death' message
  • Restored animation loops for triple-breasted alien girl and yellow slug guy in the Rocket Bar (caused by a faulty if statement, loops only play when 'Detail' in original game is set below 2)
  • Removed the SQ4 time pod animation when leaving Kerona
  • The chimes produced by pressing the 'numpad' buttons when keying in the Navigation Coordinates now vary in pitch like they do when retrieving the cartridge on the Arcada
  • Death message for fleeing from the sight of the Deltaur originally showed Roger in his red Sarien uniform with his back turned. Now it shows Roger in his blue space suit with his back turned.
  • Added conditional to description of room 61 (now reflects which level you're standing on)
  • The Two Guys from Andromeda now have talking animations for the Restart and Quit sub-menus (currently bugged, see below)

AUDIO

  • Sound added for when mugger shoots you
  • Restored missing mechanical/'talking' sound effect when offering the DBU loading bay droid the bar coupon
  • Sound added when Roger collapses after getting shot in Deltaur airlock
  • Laser/disintegration sounds added when shot in storage, laundry or outside armory (after missing with both gas grenades)
  • Sound/animation added for getting fried by the Wally globes on the Deltaur (regardless of whether they're active or not)
  • Sounds added for jumping into the waste disposal unit and getting crushed by the anvil on the Deltaur
  • Restored some of the armory droid's footstep noises (only two loops remain silent, see below)
  • Sounds added for death sequence when giant Sarien warrior kills you
  • Sound added for getting fried by the force field surrounding the Star Generator

REMAINING BUGS

  • After buying the security droid from DBU (the one you need to assemble yourself), clicking the Hand icon 3 times on the smallest box (or simply clicking on any box twice with the Hand icon and clicking the smallest box after the second message) causes Roger to walk right into the force field barrier
  • Clicking any icon on the cleaning droid when on lower level of Deltaur 2F causes Roger to use the elevator and leave the screen
  • Armory droid's 'talking' sound effect plays for only about a millisecond after shooting him twice
  • No 'footstep' sound effects for when armory droid is just emerging from the back room
  • When unmasked, Sarien officers on the upper levels initially don't produce a laser sound effect when they shoot you. The second and subsequent shots however do produce a laser sound (compiling 703.scr, which controls this behaviour, produces a warning message "Ignoring public class for export: DeltaurRegion. Line: 331, col: 6," and the game crashes when loading a save game after the Deltaur airlock or loading one from within the Deltaur itself)
  • The death animation for the waste disposal only depicts Roger with a Sarien helmet (any good sprite artists willing to step up?)
  • Bizarrely, the talking animations for the Two Guys during the two special death sequences in the Kerona underground (as well as the ones I added for the Restart and Quit submenus) will simply stop working when you have 10 inventory items. Arriving in the underground with more than 9 items or picking up a 10th while you're there causes the animations to stop. Sounds crazy and arbitrary, but I've tested it thoroughly, and it's the exact same result each time.

TRIVIAL NONSENSE

  • Apparently, the screen was supposed to flash red when you encountered the Romulan Warbird, indicating that they destroyed you (that sequence always seemed awkward to me: they just appear and then leave!). Have no idea how to implement this


So yeah, that's all I've managed to fix so far. I probably went a little overboard on some of the text alterations, and the added sound effects might seem a little iffy (especially the digital ones). But for a first effort, I think I did a good enough job, though I'm still not quite finished. I've provided a beta for you guys to look over and give me any suggestions (is the edited 'resource.000' supposed to be this big? Just seems weird, is all). So far, this patch has only been tested in DOSBOX, so use ScummVM at your own risk.

Enjoy.


Offline Kawa

Re: Hacking SQ1VGA with SCICompanion v3
« Reply #26 on: July 01, 2016, 10:02:06 AM »
Restored animation loops for triple-breasted alien girl and yellow slug guy in the Rocket Bar (caused by a faulty if statement, loops only play when 'Detail' in original game is set below 2)
I quoted this on IRC. Shenanigans ensued:

<Kawa> So this one guy is making a "fix everything" for Space Quest 1, the SCI remake...
<Kawa> "Restored animation loops for triple-breasted alien girl and yellow slug guy in the Rocket Bar (caused by a faulty if statement, loops only play when 'Detail' in original game is set below 2)"
<Kawa> Below, not above.
<Jistuce> Why is Space Quest ripping off Star Trek 5?
<Kawa> You know ST5 isn't the only story with triple-breasted aliens right?
<Jistuce> But it was THE FIRST!
<Kawa> Eccentrica Gallumbits, the triple-breasted whore of Eroticon VI.
<Jistuce> Yeah, from Star Trek.
<Kawa> Her erogenous zones are thought to extend miles from her body.
<Jistuce> Just the way Kirk likes 'em.
<Kawa> From the Hitchhikers Guide.
<Kawa> Leave the comical denial to Flanders.
<Jistuce> Which was a shameless rip off of Star Trek.
<Kawa> Eccentrica is mentioned in the first book, released in 1979.
<Jistuce> DECADES after Star Trek.
<Kawa> Star Trek 5 was released in 1989
<Jistuce> First episode, man!
<Jistuce> You can't just distill the entire franchise down to one movie!
<Kawa> <Jistuce> Why is Space Quest ripping off Star Trek 5? <-- you started it.
<Kawa> You specifically called out ST5.
<Kawa> Also, Total Recall. 1990.
<Jistuce> I meant EPISODE FIVE, clearly. Jeez.
<Kawa> No you didn't.
<Jistuce> Prove it.
<Kawa> There was no triple-breasted anything in STTOS episode 5.
<Kawa> There WAS in movie 5.
<Jistuce> Are you counting from The Cage or The Man Trap?
<Kawa> That won't effectively change the answer.
<Jistuce> IT MAKES A DIFFERENCE.
<Kawa> Not if "the fifth episode" has no triple-breasted anythings in it no matter which one is "the fifth".
<Jistuce> Look, it is not my fault that you are BAD AT COUNTING.
<Kawa> I'm quite certain there were no triple-breasted anythings in the whole of STTOS season one.
<Jistuce> It's the one they don't air in reruns because Kirk and Spock dressed as nazis is offensive.
<Jistuce> (Most of that sentence is even true)

Offline OmerMor

Re: Hacking SQ1VGA with SCICompanion v3
« Reply #27 on: July 01, 2016, 11:59:38 AM »
Amazing work spiffythedog!

And kawa: HA!   ;D

Offline troflip

Re: Hacking SQ1VGA with SCICompanion v3
« Reply #28 on: July 01, 2016, 12:17:22 PM »
is the edited 'resource.000' supposed to be this big? Just seems weird, is all

SCI Companion doesn't use compression when saving resources to the packages, so that's probably why it's larger.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Kawa

Re: Hacking SQ1VGA with SCICompanion v3
« Reply #29 on: July 01, 2016, 12:39:33 PM »
SCI Companion doesn't use compression when saving resources to the packages, so that's probably why it's larger.
Imagine if it did. I could have space left on the Catdate demo diskette for a manual and such!


SMF 2.0.11 | SMF © 2015, Simple Machines
Simple Audio Video Embedder

Page created in 0.174 seconds with 21 queries.