Author Topic: SCI Companion V3 - alpha build notes/bugs/feature requests  (Read 70168 times)

0 Members and 1 Guest are viewing this topic.

Offline Kawa

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #870 on: October 11, 2018, 06:11:32 PM »
As mentioned on Twitter and related to the above post, my SCI Companion now has special handling for the File class. Assuming script 996 is always File.sc and Class_996_0 is File, it'll notice if it's that or gamefile_sh and call it File after all.

I also found a feature buried in Phil's experimental branch (among various nefarious features involving his own engine fork) that I copied into my own that I particularly like: Shrinkwrap Cel. This does exactly what it sounds like, cropping the blank edges off and adjusting the offset to match. Enable "affect all" and go to town!

Next in my plan list is finding and massaging Display calls to not have magic numbers all over. So, having (Display "foo" dsCOORD 8 16 dsCOLOR 14) instead of (Display "foo" 100 8 16 102 14).

Anyway, do you guys want a copy of that now or after I try to do that thing? If so do you want my personal hacks included? These include and are limited to╣ not having a 256-character limit on fonts (also affects view loops so watch out?), hardcoding a bunch of global variables▓, showing hex numbers instead of decimals in the font editor, pretending Studio syntax isn't a thing, and (mostly for my own sanity) not nagging about pasted images including the key color.

╣: These are the ones I can easily disable via defines. Others include strings with control characters being escaped, and the font preview panel being at 2x zoom instead of 3x.
▓: This should and will be wrapped in a define, as will the File class thing after a bit more study. Shrinkwrapping will not.

Offline Collector

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #871 on: October 11, 2018, 07:37:47 PM »
I wish you could get past your differences with GIT. It would make tracking your additions it easier.
KQII Remake Pic

Offline troflip

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #872 on: October 11, 2018, 07:40:11 PM »
Another idea:
You could make a new section in the decompiler.ini file (read by DecompilerConfig.cpp) and read default global variable names from there (if you can tolerate the library I use to read ini files - it's a bit verbose and weird and whomever wrote it liked shared_ptr way too much). That way you can change the variable names without needing to recompile SCI Companion.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Kawa

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #873 on: October 11, 2018, 08:43:36 PM »
I have no issues with Git as a whole. My issue is that I've never managed to push anything because lolkeys. So it's Mercurial or nothing.

The ini file is a good call, but I'd like to confirm more entries and maybe version-specific differences first.

Offline Charles

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #874 on: October 12, 2018, 10:48:05 AM »
hardcoding a bunch of global variables

Oooh, that's a feature I like the sounds of.  That sounds like it would be easy enough, with a bit more research. Sierra was a business, so it wouldn't make sense for them to make drastic changes from one version to the next, just incremental ones. From the SCI16 files OmerMor shared long ago, they originally defined the first 50 variables as global variables reserved for the system classes.
From the CLASS.TXT documentation:
Code: [Select]
                    Script Classes for Adventure Games

                          Author: Jeff Stephenson
                            Date: 5 April 1988
<snip>
                             Global Variables
Global variables 0 through 49 are reserved for use by the system classes.
Game-specific global variables start at 50.  The following global variables
are defined by the system.

ego
     The ID of a static instance of class Ego defined in game.sc.  This is
     the protagonist of the game.

curRoom
     The ID of the current Room.

userFont
     The number of the font to be used in Print statements, etc.  Default is
     1.  Set it to the font you wish to use in the init: method of your
     Game, or change it at will in the game.

cast
     The ID of a Set of Actors and Egos which constitutes the characters on
     the screen.

quit
     The main loop of the game is

          (while (not quit)
               (theGame doit:)
               (Wait speed)
          )

     so setting quit to TRUE breaks out of the main loop and terminates the
     game.

addToPics
     A Set of PicViews which have been added to the current picture.

debugOn
     A generic debugging flag.  I usually have a Debug menu item to set it,
     and trigger any debug display that I want off of it, rather than
     creating a special trigger whenever I want to debug something.

sounds
     The Set of Sounds currently playing.

inventory
     The ID of the Inventory class or instance which is the Set of all
     InvItems (inventory items) in the Game.  Inventory related issues are
     not well defined yet...

theGame
     The ID of the Game instance.

regions
     The Set of Regions currently in effect.

curRoomNum
     The number of the current Room.

prevRoomNum
     The number of the previous Room.  (So you know how you got where you
     are.)

newRoomNum
     Used by a Room to signal to the Game that it should change to a new
     Room.

showStyle
     The global style for the transition from one picture to another.  This
     may be overridden by the style property of a given room.  See the
     DrawPic kernel function for the possible styles.

overRun
     The number of timer ticks more than the Game's speed which it took to
     complete the last animation cycle.  A non-zero overRun means that the
     system is not keeping up.

However, that was the original documentation... by Hero's Quest 1 they'd expanded that to 100 variables, and the order had changed from their original documentation, and that was just 1989.
Here's the global names as best as I was able to determine them when I was was remastering the HQ1 source.  Some that I flag as unused are really because they're part of an array, like curSaveDir... I left them as individual variables because I kept hitting a bug if I tried to decompile from scratch with arrays in just the sco files.:
Code: [Select]
(local
;system-defined global variables
ego ;pointer to ego (original SSCI name)
theGame ;ID of the Game instance (original SSCI name)
curRoom ;ID of current room (original SSCI name)
gNewSpeed =  6 ;CI: used for overRun speed testing.
quit ;when TRUE, quit game (original SSCI name)
gCast ;cast ;The ID of a Set of Actors and Egos which constitutes the characters on the screen.
gRegions ;regions ;The Set of Regions currently in effect.
gTimers ;timers ;list of timers in the game
gSounds ;sounds ;set of sounds being played
inventory ;set of inventory items in game (not used in Hero's Quest)
gAddToPics ;addToPics ;list of views added to the picture
curRoomNum ;current room number
prevRoomNum ;previous room number
newRoomNum ;number of room to change to
debugOn ;generic debug flag -- set from debug menu
score ;the player's current score
possibleScore ;highest possible score
showStyle =  7 ;The global style for the transition from one picture to another.  This
      ;may be overridden by the style property of a given room.  See the
      ;DrawPic kernel function for the possible styles.
overRun ;The number of timer ticks more than the Game's speed which it took to
      ;complete the last animation cycle.  A non-zero overRun means that the
      ;system is not keeping up.
theCursor ;the number of the current cursor
normalCursor =  ARROW_CURSOR ;number of normal cursor form
waitCursor =  HAND_CURSOR ;cursor number of "wait" cursor
userFont =  USERFONT ;font to use for Print
smallFont =  4 ;small font for save/restore, etc.
lastEvent ;the last event (used by save/restore game)
modelessDialog ;the modeless Dialog known to User and Intrface
bigFont =  USERFONT ;large font
global27 =  12 ;CI: unused, unknown purpose
version =  {ego} ;pointer to 'incver' version string
;  WARNING!  Must be set in room 0
;  (usually to {x.yyy    } or {x.yyy.zzz})
theDoits ;list of objects to get doits each cycle
curSaveDir ;current save drive/directory string [20 chars long]
global31 ;unused
global32 ;unused
global33 ;unused
global34 ;unused
global35 ;unused
global36 ;unused
global37 ;unused
global38 ;unused
global39 ;unused
global40 ;unused
global41 ;unused
global42 ;unused
global43 ;unused
global44 ;unused
global45 ;unused
global46 ;unused
global47 ;unused
global48 ;unused
global49 ;unused
animationDelay =  10 ;
perspective ;player's viewing angle: degrees away
;  from vertical along y axis
gFeatures ;features ;locations that may respond to events
gSFeatures ;CI: saidFeatures?
useSortedFeatures ;enable cast & feature sorting? (default is FALSE)
isDemoGame ;enabled if this is a game demo, and not a full game.??
global56 ;unused
overlays =  -1
doMotionCue ;a motion cue has occurred - process it
systemWindow ;ID of standard system window
global60 =  3 ;unused/unknown
defaultPalette
modelessPort
global63 ;unused
global64 ;unused
global65 ;unused
global66 ;unused
global67 ;unused
global68 ;unused
global69 ;unused
global70 ;unused
global71 ;unused
global72 ;unused
global73 ;unused
global74 ;unused
global75 ;unused
global76 ;unused
global77 ;unused
global78 ;unused
global79 ;unused
global80 ;unused
global81 ;unused
global82 ;unused
global83 ;unused
global84 ;unused
global85 ;unused
global86 ;unused
global87 ;unused
global88 ;unused
global89 ;unused
global90 ;unused
global91 ;unused
global92 ;unused
global93 ;unused
global94 ;unused
global95 ;unused
global96 ;unused
global97 ;unused
global98 ;unused
global99 ;unused


Assuming script 996 is always File.sc and Class_996_0 is File, it'll notice if it's that or gamefile_sh and call it File after all.
That's probably a safe assumption. From another file from OmerMor, SYSTEM.SH:
Code: [Select]
;;;;
;;;;  SYSTEM.SH
;;;;
;;;;  (c) Sierra On-Line, Inc, 1992
;;;;
;;;;  Author: Unknown
;;;;
;;;;  This is the header file for the SCI system
;;;;
;;;;  Last Updated:
;;;;     Brian K. Hughes
;;;;     August 19, 1992


(include kernel.sh)     ;kernel external declarations


;╔════════════════╗
;║                ║
;║ Module Defines ║
;║                ║
;╚════════════════╝

(define  SYSTEM      999)
(define  ACTOR       998)
(define  MENU        997)
(define  USER        996)
(define  INVENT      995)
(define  GAME        994)
(define  FILE        993)
(define  MOTION      992)
(define  JUMP        991)
(define  SAVE        990)
(define  MUSIC       989)
(define  EGO         988)     ; was EXTRA
(define  GAUGE       987)
(define  ORBIT       986)
(define  FLAGS       985)     ; was AVOIDER
(define  REGPATH     984)     ; was SORTCOPY
(define  PATH        983)
(define  SIGHT       982)
(define  WINDOW      981)
(define  TUTORIAL    980)     ; was TEXTRA
(define  UNUSED_4    979)     ; was MOUSER
(define  GCONTROL    978)
(define  GROOPER     977)
(define  CAT         976)
(define  SCALETO     975)     ; was DEMO
(define  NAMEFIND    974)
(define  TIMER       973)
(define  CHASE       972)
(define  FOLLOW      971)
(define  WANDER      970)
(define  REVERSE     969)
(define  SMOOPER     968)
(define  DCICON      967)
(define  SORT        966)
(define  COUNT       965)
(define  DPATH       964)     ; will be merged into PATH
(define  RELDPATH    963)     ; will be merged into PATH
(define  UNUSED_7    962)     ; was QSCRIPT
(define  STOPWALK    961)
(define  UNUSED_8    960)     ; was TIMEDCUE
(define  QSOUND      959)
(define  LOADMANY    958)
(define  UNUSED_10   957)     ; was LASTLINK
(define  FORCOUNT    956)
(define  TRACK       955)
(define  DOOR        954)     ; was GOTOSAID
(define  APPROACH    953)
(define  LOGGER      952)
(define  MOVEFWD     951)
(define  FEATURE     950)
(define  BLOCK       949)
(define  WRITEFTR    948)
(define  DLGEDIT     947)     ; was DELAYEVT
(define  POLYGON     946)
(define  POLYPATH    945)
(define  FILESEL     944)
(define  POLYEDIT    943)
(define  MOVECYC     942)
(define  RANDCYC     941)
(define  UNUSED_11   940)     ; was PRINTD
(define  OSC         939)
(define  RANGEOSC    938)     ; was PCYCLE
(define  ICONBAR     937)
(define  BORDWIND    936)
(define  SCALER      935)
(define  SLIDEICON   934)
(define  PMOUSE      933)
(define  PFOLLOW     932)     ; was LANGUAGE
(define  CDACTOR     931)
(define  PCHASE      930)
(define  SYNC        929)
(define  TALKER      928)
(define  PAVOID      927)
(define  FLIPPOLY    926)
(define  CONV        925)
(define  MESSAGER    924)
(define  INSET       923)
(define  DIALOG      922)  ;Contains DIcon, DButton, DEdit, DSelector, Controls
(define  PRINT       921)  ;Front-end for dialogs

(define  INTRFACE    255)

Okay, that was a much bigger info-dump that I intended... and a bunch of stuff that's probably not news, either.   

Oooh, now that I think about it, Folder support would be a really neat feature.  You could put all the 900-scripts into a system folder, and put game scripts into a game folder to make organization easier.

Offline Kawa

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #875 on: October 12, 2018, 02:14:43 PM »
I actually did (still do) my own studies, using system.sh and comparing the globals it lists to what the games actually use.

From global 27 on, things get a little wobbly between SCI0 games (defined here as non-multilanguage, EGA with parser), and all the others. gVersion is global 28 in SCI0, but it's global 27 in all the others up to at least SCI16 (that is, the one OmerMor released and that I'm hacking, don't @ me). From there, it gets difficult to pin down, so the highest-numbered global I'm willing to pin down is global 26, gBigFont.

...At least with SCI2 the only difference in that set is that global 10 gAddToPics is now gPlanes, so if can tell from _GetGlobalVariableName which engine we're talking about I can at least handle that ;D

Offline Charles

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #876 on: October 12, 2018, 02:36:09 PM »
I actually did (still do) my own studies, using system.sh and comparing the globals it lists to what the games actually use.
Sorry, I didn't mean to imply you haven't researched it... I got overeager to contribute.

From global 27 on, things get a little wobbly between SCI0 games
Pity. :(

I've had an idea for a while now to decompile a bunch of the SCI0 and SCI01 games, then do some automated cross-comparisons against the system-level scripts to what changes if any existed between games, but it hasn't been a priority for me. There are, what, 10 classic SCI0/01 games? Have you done that kind of comparison before, yourself?

Offline Kawa

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #877 on: October 12, 2018, 03:57:33 PM »
I'd love to document those changes myself, and since I am unbelievably bored and gifted with an immense amount of free time to waste, I probably wouldn't even automate it. Last time I did automate something, it was extracting and analyzing all the fonts to see how many of them had how many characters in them (128 for American, 226 for European because ▀ is #225 in Codepage , very very few 256).

Offline Kawa

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #878 on: October 13, 2018, 01:30:15 PM »
I've set up three build targets -- Release, which is as I described earlier; Kawa, with all of my hacks defined in; and Mild, with only a few, namely taking forced script names from decompiler.ini, massaging the Display command's parameters, the hardcoded globals (yet to be listed in decompiler.ini), and renaming script 993 class 0 to "File". It does not include hex numbers in the font editor, fonts with more than 256 characters, the lack of Studio support, or the lack of transparency paste nagging.

This'll make it pretty easy for me to keep my own copy and the public release in the stash separate. In fact, have a new Mild build right now! http://helmet.kafuka.org/sci/SCICompanion.exe

To use the new script name override feature, put this in decompile.ini:
Code: [Select]
[kawaForcedScriptNames]
0 = "Main"
993 = "File"

Yeah, even Main's no longer hardcoded.

Offline Collector

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #879 on: October 13, 2018, 09:17:47 PM »
This build can't call the game properties dialog.
KQII Remake Pic

Offline Kawa

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #880 on: October 14, 2018, 03:48:31 AM »
So it can't. I'm on it.

Found the problem. Mild compiles aren't supposed to define KAWA_NOSTUDIO in the resource file, so the dialog template and the code didn't agree, trying to set up the items for a dropdown that didn't exist. Uploaded a fixed and tested version to the same place, in place.

Also, I can't quite figure out the ini thing, so I'm keeping the global variable names as I originally implemented them... for now.
« Last Edit: October 14, 2018, 04:03:50 AM by Kawa »

Offline Collector

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #881 on: October 14, 2018, 09:06:34 PM »
One minor thing. Ticking the "Select All" box in the decompiler dialog does not select all of the scripts. When tou
hit the decompile button it says that no scripts have been selected and then ask if you want to decompile all.
KQII Remake Pic

Offline Kawa

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #882 on: October 15, 2018, 03:28:36 AM »
Can't reproduce.

I open the SCICompanion.exe specifically from the site, load a random game (Castle of Dr. Brain), open the decompiler. I observe no scripts are selected. I click "Select All" and observe that all of the items in the list get a gray background (not blue, because the focus is on the checkbox). I click "Decompile", and it decompiles all the scripts. Several times because that option was also enabled.

Offline Collector

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #883 on: October 15, 2018, 12:52:48 PM »
I got what I assumed is your latest build and it stopped doing this, so it must have been from an earlier build. It seems to be OK now.
KQII Remake Pic

Offline Kawa

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #884 on: October 15, 2018, 01:38:06 PM »
Heads up, when I said "several times" I apparently meant "until I unchecked that option in the middle of a run because of a weird interaction with my global vars name thing".


SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.145 seconds with 23 queries.