Author Topic: Torin's Passage: I can't find 'global91' definition in SCICompanion  (Read 8667 times)

0 Members and 1 Guest are viewing this topic.

Offline ZvikaZ

Hi.
I've seen that `global91` is used to display Torin Passage's messages. It's all over the game.
However, I can't find its definition in SCICompanion - both in the original version, and in Kawa's fork (is http://helmet.kafuka.org/sci/SCICompanion.exe correct?).
All I found is in Main.sc,
Code: [Select]
(local
...
    global91

But where is the actual code?



Offline Kawa

Re: Torin's Passage: I can't find 'global91' definition in SCICompanion
« Reply #1 on: April 21, 2020, 01:27:21 PM »
global91 is just the default name for global variable #91, to be replaced by the decompiler whenever it finds that a reference to some sort of object or class is assigned to it. In most other games, that means for example global1 is renamed gGame, because the Game object assigns itself to global #1 and the decompiler notices this. And indeed, global #91 is/ the Messager in the games I checked.

What I'd like to know is how you're opening Torin's Passage in SCI Companion.

Offline ZvikaZ

Re: Torin's Passage: I can't find 'global91' definition in SCICompanion
« Reply #2 on: April 21, 2020, 02:40:25 PM »
I will check that later, thanks.

Anyway, I'm opening it with @OmerMor's suggestion at
https://github.com/icefallgames/SCICompanion/issues/10

BTW,
Maybe you'd incorporate this into your fork?

Offline lskovlun

Re: Torin's Passage: I can't find 'global91' definition in SCICompanion
« Reply #3 on: April 21, 2020, 02:54:56 PM »
Yup, that's what I've been doing all along as well. So much that I didn't understand Kawa's question at first.
Linux lets me make symlinks so I don't have to disturb the original game.

Offline Kawa

Re: Torin's Passage: I can't find 'global91' definition in SCICompanion
« Reply #4 on: April 21, 2020, 05:44:14 PM »
A'ight. Guess I'll try it myself, see why it doesn't assign a name to global91.

So what I can find here is in FRButton.sc, proc64002_14:
Code: [Select]
((= global91 (ScriptID -1504 1))
saveMessages: 1
oTextSaver: (ScriptID -1532 0)
init:
)
That does not seem right. That's an unsigned word, not signed. That's supposed to be 64032, oMessager. I'm willing to bet this is what trips it up.

I might look into fixing this, but for now at least you know to look for oMessager, in script 64032.
« Last Edit: April 21, 2020, 05:57:52 PM by Kawa »

Offline ZvikaZ

Re: Torin's Passage: I can't find 'global91' definition in SCICompanion
« Reply #5 on: April 22, 2020, 04:11:09 AM »
Kawa, I'm amazed every time from your SCI proficiency.

Thanks for your help!

BTW,
What's the link for your updated SCICompanion fork Windows executable?
And is there a place to write feature requests and suggestions?
Or is this forum the best place?

We have two requests in this thread ;-)
- https://github.com/icefallgames/SCICompanion/issues/10
- Fix the (un)signed int bug

Thanks again

Offline Kawa

Re: Torin's Passage: I can't find 'global91' definition in SCICompanion
« Reply #6 on: April 22, 2020, 07:28:26 AM »
The issues page is probably best, though I'm more likely to notice if you open 'em on my fork's: https://github.com/Kawa-oneechan/SCICompanion/issues

Offline Kawa

Re: Torin's Passage: I can't find 'global91' definition in SCICompanion
« Reply #7 on: April 22, 2020, 05:56:03 PM »
I bring tidings!

I found out why script zero in Phantasmagoria was auto-named ScaryRoom.sc instead of Main.sc. That was my bad, messing up the logic when I added a disabled feature.

I also added a massager (not messager) to force ScriptID calls to not negate on values above 32767. In other words, (ScriptID 64032 0) will no longer decompile as (ScriptID -1532 0).

The bad news is that the above fix would not do anything for the thing that set this off, that Phantasmagoria doesn't have the decompiler name global91 anything like gOMessager or whatever. That's specifically because it uses a ScriptID call there. For comparison, if it was an object in the same script, like scaryMessager, it would (and does) decompile as (= gScaryMessager scaryMessager). Also compare with the line (= global27 {x.yyy.zzz}). The decompiler can't tell that's gVersion. But at least ScriptID calls above 32767 make more sense now.

http://helmet.kafuka.org/sci/SCICompanion.exe

Offline ZvikaZ

Re: Torin's Passage: I can't find 'global91' definition in SCICompanion
« Reply #8 on: April 23, 2020, 08:17:08 AM »
Thanks for the quick fix.

Regarding the global91 identification - I have two suggestions:
- Maybe it's possible to follow those 'ScriptID' calls, and learn from them what's going on?
- Maybe it's possible to use OmerMor's SYSTEM.SH (https://github.com/OmerMor/SCI32/blob/master/SYSTEM/SYSTEM.SH) as reference, and use it as an educated guess, whenever we don't have any better source of information from the code itself?
In this file we can see our both examples:
Code: [Select]
    version             27  = 0             ;pointer to 'incver' version string
                                                    ;   WARNING!  Must be set in room 0
                                                    ;   (usually to {x.yyy    } or {x.yyy.zzz})
...
 messager                91                      ;pointer to messager (normally Messager)

Offline Kawa

Re: Torin's Passage: I can't find 'global91' definition in SCICompanion
« Reply #9 on: April 23, 2020, 09:30:11 AM »
Or maybe you can just assume global 91 is gMessager, change it yourself and redecompile.

Edit: more tidings! I cleared the SCO files for Phantasmagoria to take that screenshot and doing a fresh redeco proved me wrong! It does in fact realize that global 91 is an instance of ScaryMessager!
« Last Edit: April 23, 2020, 09:32:04 AM by Kawa »

Offline Collector

Re: Torin's Passage: I can't find 'global91' definition in SCICompanion
« Reply #10 on: April 24, 2020, 03:05:29 PM »
What are you doing to open the later games? Companion can't find any of the resources. Looking for only a RESOURCE.MAP file seems to be hardwired. If I rename the RESMAP.001 in Phant to RESOURCE.MAP it loads a bunch of empty resources. I am also curious as to how Companion handles the HEP files.
KQII Remake Pic

Offline Kawa

Re: Torin's Passage: I can't find 'global91' definition in SCICompanion
« Reply #11 on: April 24, 2020, 04:07:47 PM »
My copy of Phantasmagoria only had a RESMAP.000 to rename. Or copy, as I chose to do. And HEP files... should be handled just like any other loose resource, as long as they're in a place SCI Companion cares about.

Offline lskovlun

Re: Torin's Passage: I can't find 'global91' definition in SCICompanion
« Reply #12 on: April 25, 2020, 02:58:14 AM »
What, no RESSCI.000? You need to rename that too (to RESOURCE.000).

Offline Kawa

Re: Torin's Passage: I can't find 'global91' definition in SCICompanion
« Reply #13 on: April 25, 2020, 05:07:09 AM »
That's what it did have for me to rename, yeah.

I mean, obviously I had some sort of resource data to decompile...

Offline Collector

Re: Torin's Passage: I can't find 'global91' definition in SCICompanion
« Reply #14 on: April 25, 2020, 10:16:16 AM »
What, no RESSCI.000? You need to rename that too (to RESOURCE.000).

OK. I did not rename the actual resource volume as without knowing about the workings of the map file I assumed that it would be looking for RESSCI.000. Even though Companion was not intended for these later games, this is one change that would be nice to have; to allow Companion accept the different naming conventions.
KQII Remake Pic


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.051 seconds with 24 queries.