Author Topic: Script patch files  (Read 23633 times)

0 Members and 1 Guest are viewing this topic.

Offline Kawa

Re: Script patch files
« Reply #45 on: September 29, 2021, 03:47:17 AM »
How will you handle the interpreter in regards to the archive? Just add the 0.000.685 requirement to the readme or would you include the interpreter in the KQIV folder?

A general question. Why are StrCmp and StrLen terminating at whitespaces? The SC docs show it using strings with spaces, but I can't get it to match {wave anchor} and StrLen thinks that's a 4 character string.
If this is about the copy protection screen might I suggest using the hashes instead of the actual string?

Code: [Select]
; Sierra's version
((not (StrCmp @userInput {BOBALU})) (gRoom newRoom: 700))

; My suggestion:
((== inputSum 437) (gRoom newRoom: 700)) ;bobalu
((== inputSum 782) (do the pirate egg thing)) ;wave anchor

(hashes for both answers created with https://helmet.kafuka.org/sci/kq4_cp.html because why not)



Edit: (FormatPrint {StrLen of %s is %d} {wave anchor} (StrLen {wave anchor})) says it's 11?
« Last Edit: September 29, 2021, 03:50:54 AM by Kawa »

Offline Collector

Re: Script patch files
« Reply #46 on: September 29, 2021, 09:38:24 AM »
"Marble" works in version 2.0. In version 2.2, the command was changed to "wave anchor".
Are you sure? I just tried this with the 5.25" and 3.5" versions of 2.2 as well as my copy of 2.3. The input at that point does not accept a space. It fails with waveanchor.
KQII Remake Pic

Offline EricOakford

Re: Script patch files
« Reply #47 on: September 29, 2021, 10:35:29 AM »
How will you handle the interpreter in regards to the archive? Just add the 0.000.685 requirement to the readme or would you include the interpreter in the KQIV folder?

The required drivers and interpreter are already in the folder. I see no issue with that, since they're from a game demo.

"Marble" works in version 2.0. In version 2.2, the command was changed to "wave anchor".
Are you sure? I just tried this with the 5.25" and 3.5" versions of 2.2 as well as my copy of 2.3. The input at that point does not accept a space. It fails with waveanchor.

You have to press ALT-D first to clear the copy protection prompt and use the regular parser. THEN you input "pirate" to bring up the pirate easter egg, or "wave anchor" to go to the title.

It's kinda wild that this is a thing we can do.

It's a lot like BG1Tutu, which ported the content of the first Baldur's Gate game into its sequel's engine, complete with all of its new features.
« Last Edit: September 29, 2021, 10:42:13 AM by EricOakford »
My SCI templates
SCI0 SCI0.1 SCI1.0 SCI1.1
SCI2.1 planned

Offline doomlazer

Re: Script patch files
« Reply #48 on: September 29, 2021, 12:23:14 PM »
Edit: (FormatPrint {StrLen of %s is %d} {wave anchor} (StrLen {wave anchor})) says it's 11?

Edit: I wasn't being clear here. In the CopyProtect source StrLen for @userInput stops at the whitespace.



I like this hash solution. I'll do some testing with "wave anchor" to see if it works, but it's sounding like the space is going to be a problem.. Can't get "wave anchor" to match using the hash. Anything without a space works as expected, of course.

If we can confirm or deny that wave anchor is working on a specific version we could probably check the code to see how they deal with the whitespace.
« Last Edit: September 29, 2021, 01:34:54 PM by doomlazer »

Offline doomlazer

Re: Script patch files
« Reply #49 on: September 29, 2021, 12:33:07 PM »
Also, EO's decompile archive is amazing in my opinion. It will open up the ability for casual devs to start easily modding the retail games without having to do all the work fixing decompiles for the entire game first - which was very daunting when I first looked into SCICompanion. I see some really exciting possibilities for not only bug patches, egg restoration, etc., but large scale mods and conversions.

The required drivers and interpreter are already in the folder. I see no issue with that, since they're from a game demo.

I was assuming you'd need to include sierra.com or some other binary for the interpreter change. I guess that's not the case.
« Last Edit: September 29, 2021, 01:03:45 PM by doomlazer »

Offline Kawa

Re: Script patch files
« Reply #50 on: September 29, 2021, 03:47:41 PM »
I like this hash solution. I'll do some testing with "wave anchor" to see if it works, but it's sounding like the space is going to be a problem.. Can't get "wave anchor" to match using the hash. Anything without a space works as expected, of course.
Eric's KQ4 decompile uses my work for the copy protect screen.
Code: [Select]
(for ((= i 0)) (< i (StrLen @userInput)) ((++ i))
(= ch (& (= ch (StrAt @userInput i)) $005f)) ;ch = userInput[i] & 0x5F -- get uppercased ch
(StrAt @userInput i ch) ;put that uppercase character back so we can detect BOBALU later on
(+= inputSum ch)
)
I think I see the problem. Space is 0x20, and 0x20 & 0x5F is null. This superfluous uppercasing thus tricks StrLen into thinking the word ends after "wave". My simulator doesn't do that. And the only reason it does that second StrAt call to put the character back is to compare it to "BOBALU"... which we can just do with a hash.

Solution:
Code: [Select]
(for ((= i 0)) (< i (StrLen @userInput)) ((++ i))
(= ch (& (= ch (StrAt @userInput i)) $005f)) ;ch = userInput[i] & 0x5F -- get uppercased ch
;;; (StrAt @userInput i ch) ;DON'T put that uppercase character back!
(+= inputSum ch)
)

Offline doomlazer

Re: Script patch files
« Reply #51 on: September 29, 2021, 04:36:41 PM »
That does it. Obviously I need to learn more about text encoding.

I've attached a draft of the pirate egg if anyone wants to critique an early version. It's mostly there - needs better centering and the midi I exported/imported from AGI is using a weird instrument, but I'll go through the sound editor documentation.

Is the AGI system font available? I'm not seeing the one they use on the wiki SV didn't have any font files. Also, if it's possible to emulate the red line around the AGI text box without patching system files, please let me know. It might be easier to fake the text prompt with a view.

Offline Kawa

Re: Script patch files
« Reply #52 on: September 29, 2021, 05:11:21 PM »
That does it. Obviously I need to learn more about text encoding.

I've attached a draft of the pirate egg if anyone wants to critique an early version. It's mostly there - needs better centering and the midi I exported/imported from AGI is using a weird instrument, but I'll go through the sound editor documentation.

Is the AGI system font available? I'm not seeing the one they use on the wiki SV didn't have any font files. Also, if it's possible to emulate the red line around the AGI text box without patching system files, please let me know. It might be easier to fake the text prompt with a view.
The AGI system font is basically just whatever the IBM PC (or PCJr I guess) itself used, specifically the 8x8 version. https://int10h.org/oldschool-pc-fonts/ may help here.

As for simulating the AGI text boxes, this was actually attempted in Space Quest 4.

Offline doomlazer

Re: Script patch files
« Reply #53 on: September 29, 2021, 07:07:40 PM »
Does the Graph procedure exist in SCI0? I can get sq1Window to compile without it.

Offline EricOakford

Re: Script patch files
« Reply #54 on: September 29, 2021, 07:31:28 PM »
Does the Graph procedure exist in SCI0? I can get sq1Window to compile without it.

Yes, it does. And it's a kernel function, so it's all in the interpreter.
However, the vocab.999 (kernel function list) tends to be out of date for each game. This leads to things like kernel_112 for games that use the Graph function, but don't have it listed in vocab.999, since the decompiler relies on that list if it's there.
My SCI templates
SCI0 SCI0.1 SCI1.0 SCI1.1
SCI2.1 planned

Offline doomlazer

Re: Script patch files
« Reply #55 on: September 29, 2021, 09:01:57 PM »
I should have made the connection to use kernel_112 because I did see that in sci.sc. Oh well, I'm still learning.

I'm getting very close on the software pirate (alignment is still off). I've already corrected the text boarder color to 4, not 5. I tried several fonts, including an "AGI" font I found that was too large, even imported at 8pt. I'll keep searching for something closer.




I've already done a lot of the leg work on the other two eggs. I've reviewed the AGI scripts and don't anticipate too much trouble translating them to SCI. 

I'm going to have to redraw the teleportation cels for SCI, because it's smaller than SCI Rosella, but once it switches rooms I'm going to reuse the AGI graphics. They look a bit different than the SCI, but I think that's the best option.

The rap "dancing" mostly re-uses Rosella's existing views, except for these two loops - might have to redraw those.



I appreciate all the help from this forum! It's been invaluable with so many idiosyncrasies to learn between versions and still being a green at coding in general.

Offline Collector

Re: Script patch files
« Reply #56 on: September 29, 2021, 10:26:36 PM »
You have to press ALT-D first to clear the copy protection prompt and use the regular parser. THEN you input "pirate" to bring up the pirate easter egg, or "wave anchor" to go to the title.

I never did that. I guess that marble and pirate worked without ALT-D because no space was required.
KQII Remake Pic

Offline doomlazer

Re: Script patch files
« Reply #57 on: September 30, 2021, 10:46:26 AM »
Just to clarify, Alt-D is required for marble and pirate as well in the AGI version. I don't believe it's technically possible to hide bobalu behind the debugger in the SCI version.

A few updates:

I think I'm going to use font 0 (if it matches SQ4's font 0) for the AGI-style text instead of trying to match the AGI system font. If that's how sierra did it in SQIV, then it's good enough for me. Isn't the pixel aspect ratio different between AGI and SCI? Probably why sierra didn't create a custom font for sq4.

I was wrong about the rap reusing views. KQ4AGI view 167 contains all the dance moves. One of the loops looks almost identical to the falling animation which threw me off at firsts. Instead of redrawing this view in SCI I've come up with what I think is a good compromise:

I recall in the SCI version that the castle cell is inaccessible after murdering Lolotte, which is the only time you can trigger the egg in the AGI version. Therefore I'm going to just unlock the cell door in the hallway post-game. I have to patch the hall anyway because you "beam me" from that location. When the player enters the cell it will transition to a new room with the AGI background and Rosella's AGI walking views. This best preserves the original egg in my opinion, but I'm also open to criticism.

Unfortunately, I'm going to have to include a vocab.000 patch since the rap is triggers with "rap kq" and kq isn't included in SCI. Rap is a synonym of Knock, so it's already there. I could trigger it with just "rap", but that doesn't feel right.




Offline MusicallyInspired

Re: Script patch files
« Reply #58 on: September 30, 2021, 02:01:33 PM »
That shouldn't be a reason for doomlazer to not do it and at the very least gain zetta experience. How many others before me have disabled the copy protection on these games, after all?

Wasn't my intention. Sorry for the confusion. Just thought maybe he could reference how he did it.

Also, regarding converting AGI Views to SCI, you can just copy and paste cel frames between AGI Studio and SCI Companion. That's how I did it with placeholder AGI Views for KQ2SCI. But the tool Collector provided would be easier if it works. You could just batch-process it for multiple resources.
« Last Edit: September 30, 2021, 02:08:43 PM by MusicallyInspired »
Brass Lantern Prop Competition

Offline Kawa

Re: Script patch files
« Reply #59 on: September 30, 2021, 05:13:45 PM »
I think I'm going to use font 0 (if it matches SQ4's font 0) for the AGI-style text instead of trying to match the AGI system font.
Or you could use my work. https://helmet.kafuka.org/sci/fonts/PxPlus%20CGA.fon
, as an SCI font resource that you can import.
Quote
If that's how sierra did it in SQIV, then it's good enough for me. Isn't the pixel aspect ratio different between AGI and SCI? Probably why sierra didn't create a custom font for sq4.
The AGI font is actually drawn in 1:1 pixels -- the graphics (including the window frame) are only 2:1 because of its PCJr origins. On the other hand there's technically no reason you can't have a 2:1 font in SCI, and the only reason AGI's is 1:1 is because that's the 8x8 font from CGA text mode, which may be different on certain systems. It's only in Hercules mode that AGI uses its own font.

(Fun fact: on a CGA video card, there's only 8x8 fonts. In 25-line mode, it doubles up the font graphics into 8x16.)


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

Page created in 0.07 seconds with 23 queries.