Author Topic: SQ5 preliminary decompiled source  (Read 28509 times)

0 Members and 1 Guest are viewing this topic.

Offline MusicallyInspired

Re: SQ5 preliminary decompiled source
« Reply #30 on: May 05, 2015, 07:50:05 PM »
Room 535 is the room where the ship lands inside the landing bay after boarding the ship from the Xenon streets (room 45). You can also take the ship back down to the streets from the landing bay. Room 72 is the shot of Roger peering up from the manhole cover from the sewers as the ship lands. This is the only way to get the ship to land (come from room 72), so I don't understand how coming from that room sets that flag if it's failing the condition and not displaying the message in room 45...

Regarding adding helpful information, that definitely would help quite a lot. We can always make special cases if things end up being different between certain games. It seems like a few of the global variables at least are all the same as the SCI0 template game. That is, global2 is gRoom for instance but it's not named. I noticed that those names are used in your decompiled scripts, but not always and not when they're declared for the most part.
« Last Edit: May 05, 2015, 07:53:49 PM by MusicallyInspired »
Brass Lantern Prop Competition

Offline troflip

Re: SQ5 preliminary decompiled source
« Reply #31 on: May 05, 2015, 08:14:07 PM »
Entering room 40 from 72 seems to set the flag. Entering room 72 from somewhere other than 45 or 90 seems to clear it. You should be able to search for Bset(0) and Bclear(0) and try to follow the logic? Can you get to room 45 after going from 40->72, and then not going back to 72?

That is, global2 is gRoom for instance but it's not named. I noticed that those names are used in your decompiled scripts, but not always and not when they're declared for the most part.

The names are given default names depending on how the variables are used, so it's a best guess. The decompiler has functionality to rename things manually and then future decompilations will pick the new namesup.

What do you mean "not when they're declared"?
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: SQ5 preliminary decompiled source
« Reply #32 on: May 05, 2015, 10:28:33 PM »
Entering room 40 from 72 seems to set the flag. Entering room 72 from somewhere other than 45 or 90 seems to clear it. You should be able to search for Bset(0) and Bclear(0) and try to follow the logic? Can you get to room 45 after going from 40->72, and then not going back to 72?

No, it's not possible to go back to room 72 from room 40 again or anywhere else except room 90 (sewer room). Strange. It's probably impossible to trigger then. But I still don't understand why the conditional statement was created to begin with. What is the purpose of setting bit flag 0? I'll do some more experimenting.

EDIT: Ahhh...you can't physically go to room 72 from room 45 but when you take the ship back down from room 535 it temporarily switches rooms to room 72 (the manhole cover view) to show the ship coming down and landing and then switches back to room 45 to show Roger get out and run down to room 60 (beginning of the game). That's where the flag is cleared.

Quote
The names are given default names depending on how the variables are used, so it's a best guess. The decompiler has functionality to rename things manually and then future decompilations will pick the new namesup.

What do you mean "not when they're declared"?

I apologize, I'm mixing up programming terminology. I probably meant "when they're defined". As in, right at the beginning of the Main script along with all the other globals.

EDIT: I'm sorry! I was mistaken! I just realized I was reading the nested if statements wrong the whole time. It's not the Btest check at all that determines whether the message prints or not (stupid mistake). That is used probably to determine if the ship is visible or not and what the verb actions do (which explains why you can't get back to room 72 from room 40 because the ship must be there until you fly back down from the landing bay, which then flies back when you get out on the streets again). It's rather the:

Code: [Select]
(if (not script)
    proc0_2()
    (send global2:setScript(egoHides))
)(else
    Print("You're starting to show your age.")
)

...block. It's checking "if (not script)" what is this doing exactly? I can't find where script is defined. I can see it's probably a global thing, but I'm having trouble identifying what its value would be in this scenario. I'm guessing it's checking whether there are any other scripts running in the room or not. I don't know how that would be possible or not in this room, though...
« Last Edit: May 05, 2015, 10:58:38 PM by MusicallyInspired »
Brass Lantern Prop Competition

Offline troflip

Re: SQ5 preliminary decompiled source
« Reply #33 on: May 05, 2015, 11:18:13 PM »
script is a property on Prop (flap is a Prop). So if someone did a flap:setScript(someScript), then a script would be attached to flap. I don't see anywhere that does this, but it's possible it's hidden somewhere. Or maybe it was just defensive coding on their part, that if some script was running on flap, they wouldn't want to run the "egoHides" script on the room?

As for the variable naming thing... you aren't seeing anywhere where globals have their "dumb name" (e.g. global21) in some scripts, but the same variable having a "smart name" in another script, are you?

Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: SQ5 preliminary decompiled source
« Reply #34 on: May 05, 2015, 11:35:47 PM »
No, you know what I was mistaken. I originally thought that global2 was gGame. But failed to realize that gGame was already defined. So I was just remembering when I thought it wasn't. My bad. Everything looks to have one label everywhere. It seems we can match the globals to some of the ones in the SCI0 template game, though. And some others are just obvious by looking at what methods and procedures use them. For variables like global19, global20, and global21 they're obviously cursor presets because one of the values is 999 (a default cursor setting) and the setCursor method uses all of them. The font globals can be similarly deciphered.
Brass Lantern Prop Competition

Offline troflip

Re: SQ5 preliminary decompiled source
« Reply #35 on: May 06, 2015, 12:34:05 AM »
Yeah, more of them can be deciphered than I've put in heuristics for.

There are some trickier ones too. Based on the kernel tables here: https://github.com/scummvm/scummvm/blob/master/engines/sci/engine/kernel_tables.h,  global106 looks like a polyphony flag (DoSound(3)). global105 looks like it is the number of colors the display can handle (Graph(2))... and flag 21 is set based on that, so flag 21 is some kind of display color depth indicator.

And that color depth indicator is used in speedtest.sc, and in proc0_18.  And proc0_18 is used in TONS of places to choose between two color values (so it seems). And by looking at the values passed to proc0_18, you can determine that globals 155-161 appear to be colors. Oh, and it turns out they are set in script n802, along with several other global colors.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline lskovlun

Re: SQ5 preliminary decompiled source
« Reply #36 on: May 06, 2015, 06:57:20 AM »
In the debugger in that SCI interpreter which people will not use, try:
Code: [Select]
vmvars g 114 0000:8000then go north from the starting screen. room is another useful command. If you use it twice in a row with different numbers (saying 'go' in between to allow the room change to take place), the game will think you came from the first room.

Offline Cloudee1

Re: SQ5 preliminary decompiled source
« Reply #37 on: May 07, 2015, 08:59:26 PM »
Incidentally, as you're looking through these scripts, I could use feedback on what additional information would be useful for understanding the scripts.

For instance, this
(if (& (send gEgo:onControl(1)) $0080)
would be nicer if it were:
(if (& (send gEgo:onControl(1)) ctlSILVER)

In this case, it would probably be fine, but what about the instance of $0006 ... bitwise operator stuff where that actually denotes on Navy and Green control colors simultaneously. I don't mean to sound like a stickler here, but as I use the multiple color scenario, I would prefer the value... but I am probably the only one.
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline troflip

Re: SQ5 preliminary decompiled source
« Reply #38 on: May 07, 2015, 09:15:20 PM »
With a little extra work, I would make that (| ctlNAVY ctlGREEN). But you're saying you prefer just the raw number?
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Cloudee1

Re: SQ5 preliminary decompiled source
« Reply #39 on: May 07, 2015, 09:41:56 PM »
I use the raw values a lot... I mean a whole lot, and in each and every script. Almost every interaction with the point and click template makes use of control or priority hot spots.  That's why I said it's probably just me who would prefer the raw number. I would wager that almost everyone else would prefer the more readable "name" assigned to it in the sci.sh file.
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline MusicallyInspired

Re: SQ5 preliminary decompiled source
« Reply #40 on: May 07, 2015, 10:33:54 PM »
I don't understand, how would assigning the names be better for what you're doing? Are you just used to the numbers is that it?

Maybe just make it an option during compile? Whether to use sci.sh labels or not.
Brass Lantern Prop Competition

Offline Cloudee1

Re: SQ5 preliminary decompiled source
« Reply #41 on: May 07, 2015, 11:24:51 PM »
I don't understand, how would assigning the names be better for what you're doing? Are you just used to the numbers is that it?

Maybe just make it an option during compile? Whether to use sci.sh labels or not.
Correct I am just used to the numbers... That is all. Well that and when it comes to ego on control statements, as I pointed out earlier, $0006 actually means On Navy and Green... But as I don't plan to do much with decompilations besides learn from them I am good with the colors defined names. No reason even to build in the option. Defined names are fine.
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline Collector

Re: SQ5 preliminary decompiled source
« Reply #42 on: May 08, 2015, 12:02:38 AM »
I tend to use hex numbers for colors in my code, too.
KQII Remake Pic

Offline MusicallyInspired

Re: SQ5 preliminary decompiled source
« Reply #43 on: May 08, 2015, 12:12:50 AM »
I just never bothered to learn them or I might be agreeing with you.
Brass Lantern Prop Competition

Offline Collector

Re: SQ5 preliminary decompiled source
« Reply #44 on: May 08, 2015, 12:16:19 AM »
With a small fixed pallet just names might be OK, but a large enough palette ends up with enough variations that you may want an exact color that has no name.
KQII Remake Pic


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

Page created in 0.039 seconds with 23 queries.