Community

SCI Programming => SCI Syntax Help => Topic started by: richruss691 on April 06, 2020, 06:27:13 PM

Title: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 06, 2020, 06:27:13 PM
I am trying to add back into QFG1 VGA the troll's cave that they removed when they did the vga remake. I am still in the very early stages. I have art made and i have the room added and the pile of stuff placed. I can enter and leave the room with no problem. That's as far as i have gotten.

Right now the problem i am running into is with messages. When add a message other than the default look/do messages to either the room or the pile of stuff it doesn't work right. I've tinkered around a bit, sometimes it might show the look message for one but not the other. Sometimes it will only show the default messages. Sometimes weird glitches show up. The do messages are always only the default.

Anybody have any thoughts? Any help would be greatly appreciated.

Thanks
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Charles on April 08, 2020, 02:28:26 PM
That sounds like an awesome project.  I love the idea of fan-added content to the Sierra games.

I'm afraid I don't really have enough experience with the SCI1 games to help though.  But a couple questions come to mind, that might help others troubleshoot you:

Did you decompile QFG1VGA yourself, or download it from the Decompilation Archive (http://sciprogramming.com/community/index.php?topic=1793.msg12056#msg12056)?
Sometimes scripts won't decompile properly, and when you recompile them it could cause the weird glitches you're seeing.

Make sure you go to Tools-->Rebuild Resources, then delete all the external patch files (all the ###.hep, .src, .v56, etc -- if the game finds those, they'll overwrite any scripts embedded in resource.000, which may be your newly created ones)

What version of SCICompanion are you using?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 08, 2020, 10:07:00 PM
Thank you for your reply.

This is a project that I've been working on for a while, I'm trying to make the vga version more like the ega version. I started with a bunch of graphical mods and have just recently started script editing.

I decompiled the scripts myself but the two rooms I've changed so far have recompiled with no errors and so far seem to run the way they should, although more testing should be done.

One of the first things i did, before decompiling, was rebuild the resources then delete all the patches from the directory.

I started with version 3.0.1.7 and after i started having the problem i switched to version 3.1.0.3 which, as far as i could find, is the newest.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: OmerMor on April 09, 2020, 02:36:44 PM
This is a cool project! I hope you manage to accomplish it.

In 2015 I had a similar idea of expanding the ending scene in QFG1VGA to match the one in QFG1EGA: http://sciprogramming.com/community/index.php?topic=1522 (http://sciprogramming.com/community/index.php?topic=1522)
Most of the artwork assets are already there so it should not be too hard.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 10, 2020, 01:58:19 AM
Thanks, i hope i can finish it too!

I had forgotten just how different the two versions of the ending are. been too long since i've played the ega, i guess. lol. that is definitely something to add to the end of my list. thanks!
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 10, 2020, 11:34:30 AM
Just a small update on solving the problem with the messages in my new room.

they still don't work but i'm narrowing down the cause. in the messages section of the explorer, the messages for the new room have a status error:

Resource load failed

so that it clearly why the messages don't display. unfortunately i have no idea what could be causing that and i don't know how it could be related to the weird stuff i was seeing before.

if anyone has any ideas why the message resource might fail to load, i'd really like to hear them!

thanks
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 10, 2020, 11:11:35 PM
I have made some progress, sort of. I decided to start over using the scripts from the Decompilation Archive as mentioned by Charles. Thank you Charles.
I have not put in the enter or exit code for the new room because i know it works and i wanted to focus on the message problem.

so, here's what i'm looking at now: i can get the messages to display now but every other message on the list is ignored, so to get all the messages to display i have to double them up or use place holder messages that don't get used. its not ideal but at least i feel like i can move forward. Any ideas as to the cause or how to fix it would be appreciated.

And i almost forgot, a big thank you to EricOakford for posting that decompile. it looks like they did an enormous amout of work changing the variable names, etc. to names that make some kind of sense.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: MusicallyInspired on April 11, 2020, 06:23:42 PM
I saw this before but never wished you luck. I love community made "mods" for Sierra games and the whole concept. This is a slightly less ambitious project than my own "Space Quest 1 VGA Retro" and "King's Quest 5 - No Dead Ends" 'MODs'. And yes, the decompilation archives are a gold mine! Following this!
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Charles on April 11, 2020, 08:45:07 PM
I donít think Eric has gotten enough praise for his work on the decimpilation archive. Iíve lost count of how many demos and full games heís decompiled into functional source code.
And the templates for brand new games in just about every significant flavor of SCI.

Is that KQV No Dead-Ends mod yours? Do you have a page for it? Thatís an ambitious project. The only thing good about that game (IMO) is the atmosphere. I think thatís the only reason the game is ever remembered fondly by anybody (myself included), because the voice acting is amateurish, and the puzzles are frustratingly illogical. Best of luck to you, if youíre trying to polish that one.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Collector on April 11, 2020, 08:52:38 PM
Could start adding pages to the Wiki for such projects.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: EricOakford on April 11, 2020, 11:00:14 PM
Thanks for the compliments. I really need to get back to that SQ1SCI decompile. After that is done, I'll go back and go over the QFG decompiles again.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 13, 2020, 09:37:54 PM
I appreciate the support, thanks. the project is making progress, though slower than i'd like. I've got massages for the walls and the pile of stuff and i've got the code to dig through the pile and add the loot to the inventory but now i'm running into another problem.

when you dig through the pile, it's set to display a message "you dig through pile, etc." then it checks to see if you've done it before. if you haven't, it puts the loot in your inventory, sets a flag, and displays a message "you got such and such loot." if you've already collected the loot it give the message "nothing more of value."

all of this works except that the first message " did through pile" pops up and immediately moves on to the next message, which ever it ends up being. i want it to wait for user input, i.e. a mouse click or enter key, what ever, before moving to the next message. anybody know how to make it do that? i'll post some code bellow.

Quote
(instance theLoot of Prop
   (properties
      view 118
      x 138
      y 160
      signal ignAct
      loop 0
      cel 0
      noun N_LOOT
      priority 09
   )

   (method (doVerb theVerb)
      (switch theVerb
         (V_DO
            (messager say: N_LOOT V_DO 0 1 self)
            (if (Btst tookLoot)
               (messager say: N_LOOT V_DO 0 5 self)
             else
                (ego setScript: robLoot)
            )
         )
         (V_LOOK
            (if (< LootLooked 1)
               (messager say: N_LOOT V_LOOK 0 1 self)
               (++ LootLooked)
            else
               (messager say: N_LOOT V_LOOK 0 3 self)
               (= LootLooked 0)
            )
         )
         (else
            (super doVerb: theVerb &rest)
         )
      )
   )
)

(instance robLoot of Script
   (properties)
   
   (method (changeState newState)
      (switch (= state newState)
         (0
            (messager say: N_LOOT V_DO 0 3 self)
            (ego get: iSilver 30)
            (ego get: iGold 5)
         )
         (1
            (Bset tookLoot)
         )
      )
   )
)

edit: I tried a (Wait 600) command which should make it wait 10 seconds but it gave a really inconsistent duration, anywhere from 2 seconds to 14 seconds. is there a way to make it wait for a mouse click/keyboard event instead of the timer? i tried dropping in evMOUSEKEYBOARD but it did nothing.

edit: I got it working. my code was not well structured. i tightened it up, now it works. lol
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 14, 2020, 03:38:52 PM
Now that that's sorted out, I guess its time to move on to the intimidating part. Time to add the Troll stuff!
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: MusicallyInspired on April 14, 2020, 05:42:53 PM
Is that KQV No Dead-Ends mod yours? Do you have a page for it? Thatís an ambitious project. The only thing good about that game (IMO) is the atmosphere. I think thatís the only reason the game is ever remembered fondly by anybody (myself included), because the voice acting is amateurish, and the puzzles are frustratingly illogical. Best of luck to you, if youíre trying to polish that one.

No page for it yet, no. I was trying to get some substantial work done on it and get it to a semi-release stage. I've removed a lot of dead ends already. For instance, the staff never breaks to open the temple door until you have both the gold coin and the genie lamp (but you can still die by being stuck inside for taking so long). The cat will always chase the rat even if you don't save it in time (much like the NES version actually). I was making 3 separate patches for the floppy versions (EGA and VGA) and CD version. Acceptable results most of the time! Just gotta get back to it.

Sorry, don't want to derail the topic. I think I had another thread dedicated to it elsewhere on the forum though.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 15, 2020, 11:39:29 PM
These messages are becoming the bane of this project! I've been having trouble with displaying messages but I thought I'd figured out a way to work around the problem. If i made every other message blank and never tried to access those empty messages, things seemed to be working fine. Unfortunately, today i decided to display one of the look messages upon entering the room. It seems to display that message fine but when i try to look around the room with the cursor, some of the messages display correctly but some display wrong. The ones that are wrong show a seemingly arbitrary talker and a gibberish message, or sometimes they might error out saying no such message exists.

I really hope someone can offer some advice on this. Its getting pretty frustrating and i don't think i can continue the project if i can't reliably display messages.

any help is appreciated,
    thanks
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: MusicallyInspired on April 16, 2020, 02:17:32 AM
I can't be sure but from the sounds of it it seems like Companion is setup to deal with implementing Messages in a certain way and QFG1 works in a different way that doesn't agree with Companion. Or maybe it's a compile issue or something? Something getting corrupted maybe? 
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 16, 2020, 03:56:19 AM
It must be something like like that. its odd though, i've recompiled a few of the existing de-compiled scripts and they seem to handle it fine. i just cant figure what could be different.

is there another way i could approach the situation? i know sci0 used Text resources, are they still compatible with sci1.1? i looked it up in the scicompanion documentation and tried to use it like the example but i got a compilation error. either i did it wrong or its not compatible.

maybe i can just put the messages directly in the script. it wouldn't be pretty but it might work
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: EricOakford on April 16, 2020, 06:48:18 AM
SCICompanion's destruction of message resources in QFG1VGA and PQ1VGA is a known issue. I reported it here (https://github.com/icefallgames/SCICompanion/issues/22). Kawa took a look at it, and confirmed that this is the result of Companion not properly supporting the older message resources that this game uses.
Maybe once I finish my new and improved decompilation of the game, I could look into creating a patch to port the game to a newer version of the interpreter, bringing it in line with the Macintosh version from 1994. That could be difficult, though.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 16, 2020, 02:00:32 PM
Thank you very much EricOakford! valuable information! in the mean time, is there anything i can do to make my thing work? can i use Text resources? I tried but couldn't figure it out. maybe someone can help?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Kawa on April 16, 2020, 06:35:26 PM
You could use text resources, if you forewent all use of the Messager class.

The Narrator and Talker classes' say method should allow you to pass a string pointer and caller. SQ5 and the template game it's based on have a Messager::sayFormat method that'd let you do something like (gMessager sayFormat: 99 "There's nothing here." self), but QFG1 seems to be missing this. And it wouldn't let you specify a text resource tuple anyway, taking only straight string pointers so you couldn't do (gMessager say: 99 scriptNumber 4 self) and load text line #4 that way anyway.

Doesn't mean you can't write a local procedure to do it yourself in just that room.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 16, 2020, 07:52:56 PM
Thanks Kawa.
I don't mind leaving out messenger class. My new room has no one to talk to so i don't need talkers. all i need is something that will display, for instance, line 4 from text resource 118. Can you help me get something like that working? i couldn't figure it out from the documentation. i must be missing somthing obvious.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Kawa on April 17, 2020, 09:15:19 AM
Code: [Select]
(procedure (Narrate line caller &tmp [buffer 1000])
(GetFarText scriptNumber line @buffer)
(gNarrator say: line caller)
)

(procedure (Say who line caller &tmp talker [buffer 1000])
(GetFarText scriptNumber line @buffer)
(= talker (gMessager findTalker: who))
(talker say: line caller)
)


(Narrate 2 self) ; have Narrator say line 2 from this script's text resource and call back after.

(Say 99 2 self) ; same, because talker 99 is the Narrator.

Put it in the script for your new room. I won't guarantee this is at all correct, I hacked it together in an external text editor. I included a version that takes a talker # just in case you decide otherwise.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 17, 2020, 11:30:34 AM
Thank you Kawa, I very much appreciate you help.

I tried both versions of the code you posted. They both compile without error but neither one works, unfortunately.

 The one without Talker support kicks back the error "Msg 999: 22 0 0.2 not found" then the game stops responding to input, the cursor moves around but won't anything else, not even bring down the menu.

 The version with Talker support give the error "<Messager findTalker:> can't find talker" then the game crashes.

Any thoughts?

I'm sorry I can't figure these things out on my own. this is my first time coding SCI and if its not in the tutorial its gonna take me a while.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Kawa on April 17, 2020, 04:33:25 PM
Hmm. Okay. So clearly I either misunderstood the Narrator/Talker-level say method, or QFG's is just that different.


Fuck it, let's not be too damn smart.
Code: [Select]
(procedure (Narrate line caller &tmp [buffer 1000])
(GetFarText scriptNumber line @buffer)
(Print addText: @buffer init: caller)
)
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 17, 2020, 06:38:16 PM
Thank you very much Kawa. it seems to be working quite well. soon i'll be able to move on to the part of the project i expected to be hard. lol

I do have one more question, for now. gMessager class by default displays the messages toword the top of the screen. this new Narrate procedure you have written displays at the middle of the screen. is it possible to modify the code so that it will disply toward the top?

Again, the help you've been is enormous, thank you
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Kawa on April 18, 2020, 03:20:17 AM
(Print addText: @buffer posn: -1 20 init: caller)

Replace the 20 as you like.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 18, 2020, 10:08:21 AM
Fantastic! Thank you so much! :)
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 24, 2020, 12:33:59 AM
I just ran into something weird! I went to put the troll in my new room and it turned the entire background pic to black. I scratched my head for a few hours over it but did eventually manage to fix it. All the unused colors in the troll's pallet were set to used, and therefore showing as black. I changed them all to unused and it seems to have fixed the problem. i hope it doesn't creep into any other views.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on May 13, 2020, 07:41:30 PM
I've made some decent progress on this room now. The room now knows whether or not the troll is dead, the troll will fight you if he's not dead and you get too close to his pile of stuff, after the fight it returns you to the room and the troll falls over dead, and you can search his pile of stuff and only get treasure once. I am, however, seeing a problem with that last one.

If i hack a game save first thing so i can beat the troll right away, the first place i go it to the troll cave. I can get in and fight the troll in the first part of the cave, the part that existed in the release, and i can go to the new part of the cave and get the loot from the pile. No troll in that part, i can only get the loot once, works perfect. However, if i play longer before visiting the cave, it thinks the loot is already taken even when it's not. the rest of the room works as expected. It's as though the flag is being set at some other point in the game but that shouldn't be possible. It uses a global variable that I added myself that shouldn't be referenced anywhere else in the game.

I'll drop some code below. If anyone has any thoughts i'd like to hear them, please.

Quote
(instance robLoot of Script
   (properties)
   
   (method (changeState newState)
      (switch (= state newState)
         (0 ;N_LOOT
            (Narrate 13 self) ;dig through loot
         )
         (1
            (if (Btst digPile)
               (= rando (Random 15 16))
               (Narrate rando self) ;already got loot
            else
               (Narrate 14 self) ;get the loot
               (ego get: iSilver 30)
               (ego get: iGold 5)
               (Bset digPile)
            )
         )
      )
   )
)
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: troflip on May 13, 2020, 08:16:11 PM
Where is digPile defined? Are you sure it's at a higher index than any other global flag?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on May 13, 2020, 09:02:57 PM
I defined it in script 000.

Quote
Are you sure it's at a higher index than any other global flag?

I don't know what that means so, no i'm not sure.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: EricOakford on May 14, 2020, 12:12:13 AM
I defined it in script 000.

Quote
Are you sure it's at a higher index than any other global flag?

I don't know what that means so, no i'm not sure.

That is, it's the last global in the list. But since this is a bit flag, you should probably have it be "SEARCHED_FRED_TREASURE" (the name I gave it in game.sh. If it's not there, make sure it's the last flag in the list!)
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on May 14, 2020, 12:48:36 AM
thank you EricOakford for saving my bacon once again! "SEARCHED_FRED_TREASURE" seems to have fixed it, unless that flag gets triggered somewhere else. I can't think why it would though. digPile was at the end of the list, i wonder why it wasn't working.

thank you troflip for your input as well, it was helpful.

next on the agenda will be to make it so you can take fred's beard, then all that'll be left for this room is bells and whistles, i think.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on May 31, 2020, 09:29:07 PM
All of the necessary parts of my new room are in and appear to function properly, just needs a little polish maybe some bells and whistles and thorough testing then it'll be done. However, I've decided to take a break from this room for a while and focus on something else. The end credits sequence suggested by OmerMor.

As OmerMor suggested, it looked like it would be fairly easy to implement the fly-over as it seemed to be mostly already done. So I copied the necessary views from QfG ega as place holders and told the script to run the code that it bypasses in the official release. Of course, the code doesn't work right. Amongst other things, and currently my biggest concern, the fly-over begins but shortly into it the game crashes with one of those "you did something we didn't expect" errors. I don't know sci well enough to figure out much of that code block beyond moving the carpet around the screen, so i don't know even where to start with debugging this one. I got it to stop displaying the error message but now the game just stops doing anything and I have to "X" out of the game.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Kawa on June 01, 2020, 05:28:44 PM
Which oops code number is it?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 01, 2020, 07:13:50 PM
looks like error 4
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Kawa on June 02, 2020, 08:00:31 AM
That'd be "not an object".

What exactly isn't an object, I don't know. E_NOT_OBJECT may be raised by the Clone, DisposeClone, and RespondsTo kernel calls. More likely, it may also be raised by trying to send to something that's not an object, such as a null variable.

(Going off of SCI11 here, just in case.)
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 02, 2020, 11:16:14 AM
Thanks. That is at least a starting point. Let's see if i can follow it somewhere.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: EricOakford on June 02, 2020, 06:38:34 PM
I've put up a significantly updated decompilation of QFG1VGA here (https://github.com/EricOakford/SCI-Decompilation-Archive/tree/master/qfg1vga). It hasn't been tested yet.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 02, 2020, 07:14:12 PM
awesome, thanks Eric
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 04, 2020, 09:13:00 PM
Solved it! Well sort of. I figured out where it was breaking and how to get around it. Still don't know why it was doing it.

There was Two things going on. First, the developers had bypassed most of the flight, I assume trying to track down the problem. That's why it was crashing early on in the flight. So all I had to do was remove one line of code and it would run through the whole flight.

The second problem is the part i'm still unclear on and was really the only problem. The flight was done with a series of setMotion statements crammed into a switch method. If they didn't need to change the view or cel for a while, they would reference an array of locations. Well, the last setMotion was referencing one of the arrays and apparently it didn't like ending ending the script right after the array reference. I was able to end the switch method with a MoveTo instead and now it works.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: OmerMor on June 05, 2020, 03:02:13 AM
Cool!
Can you upload a video to youtube? I'd love to see this.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 05, 2020, 10:53:07 AM
I'll have to figure out how to take video of game play but I'll see what I can do. Don't get too excited though, it's far from complete. The entire path is wrong so I need to adjust it. I still need to set some priorities and try to figure out the shadow. Then I can try to make The assets I took from the ega game look better and maybe implement some music. All of this should be doable even with my limited knowledge/experience but might take time.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 05, 2020, 11:58:43 AM
There you are OmerMor, as requested!

https://www.youtube.com/watch?v=T3_pmOWfTrs (https://www.youtube.com/watch?v=T3_pmOWfTrs)

I also have to get those credits worked out. And, of course, the scene that should follow I'll have to build almost from scratch. Well, actually, I suppose I might be able to grab most of it from the EGA version. We'll see how that goes.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: OmerMor on June 05, 2020, 02:17:14 PM
Looking great! Thanks for uploading the video.
I really look forward to seeing this with music and credits.... as well as the troll's cave you're adding.
Keep up the great work!
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 05, 2020, 02:43:05 PM
Thanks! I appreciate your interest and encouragement.

Do you know of anything else that was removed from the vga version? Any other significant changes? or a site that lists the differences?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: OmerMor on June 06, 2020, 02:45:39 PM
Well, the "razzle dazzle root beer" debug menu is only present in the EGA version. Since there is no parser, you can think of some other mouse-based mechanism to access a debug menu.
I can't think of any other missing content. I didn't even know about the troll's cave until you came here.  ::)

Regarding the ending scene - you can borrow missing graphic assets from AGDI's QFG2VGA fan remake. You could either try some AGS resource extractor s(I have never tried to do so, but I guess it's doable), or try to contact the developers and ask for it.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 06, 2020, 03:41:21 PM
Thanks, those are both good suggestions that I'm already considering. I've already got some placeholder assets that I pulled from QfG1 EGA. After some quick modifications, they look pretty good and I might end up keeping some of them. What do you think would be better for that last part, a dragon like the original EGA release or the genie from QfG2 VGA?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 06, 2020, 04:03:20 PM
I've got the fly over sequence put together save for music. Also I might end up changing how I did the credits. They don't advance automatically, you have to click past each one, and the animation stops for it. I'd like it to just play through automatically like the EGA version but I didn't want to spend to much time on it right now. what I've got is adequate for now.

I've started working on the part with the dragon/QfG II teaser. I created place holder assets from the EGA assets and pulled the script directly from the EGA as well. I changed the script just enough to get it to compile. Unfortunately, as soon as it gets to the dragon script the game errors out with "65535.v56 not found". It does this even before it updates the pic. The script looks pretty straight forward to me, nothing stands out as out of place. I'll post some code below. If anyone has thoughts that could point me in the right direction, I'd really appreciate it.

Code: [Select]

(instance bigCarpet of Actor
(properties)
)

(instance ii of Prop ; View
(properties
y 143
x 236
view 920
cel 3
)
)

(instance trial of Prop
(properties
y 170
x 155
view 925
loop 1
)
)

(instance quest of Prop
(properties
y 55
x 183
view 920
)
)

(instance forProp of Prop
(properties
y 92
x 163
view 920
cel 1
)
)

(instance glory of Prop
(properties
y 97
x 247
view 920
cel 2
)
)

(instance claw1 of Prop
(properties
y 92
x 51
view 916
priority 3
)
)

(instance claw2 of Prop
(properties
y 87
x 127
view 916
loop 1
cel 1
priority 3
)
)

(instance head of Prop
(properties
y 49
x 87
view 916
loop 2
)
)

(instance flame of Actor
(properties
view 917
)
)

(instance dragScript of Script
(properties)

; (method (doit)                                              I commented this stuff out because it looked like it deals with playing the music.
; (switch (gContMusic prevSignal?)         I'm not ready to deal with that stuff yet
; (60 (= local0 1))
; (70 (= local0 3))
; (80 (= local0 7))
; (90 (= local0 8))
; )
; (if (not (gContMusic loop?)) (= local0 13))
; (if (and (> local0 state) (or seconds cycles))
; (= seconds (= cycles 0))
; (self cue:)
; else
; (super doit:)
; )
; )

(method (changeState newState)
(switch (= state newState)
(0
(= local0 0)
(curRoom drawPic: 906)
(bigCarpet
init:
view: 925
setLoop: 0
posn: -10 100
setStep: 3 3
moveSpeed: 0
cycleSpeed: 1
setCycle: Forward
setMotion: MoveTo 340 92
)
(= seconds 10)
)
(1
(claw1 cel: 0 init: cycleSpeed: 2 setCycle: EndLoop self)
)
(2
(ShakeScreen 3)
(= seconds 10)
)
(3
(claw1 stopUpd: addToPic:)
(claw2 cel: 0 init: cycleSpeed: 2 setCycle: EndLoop)
(= cycles theCycles)
)
(4
(claw2 stopUpd: addToPic:)
(ShakeScreen 3)
(head
setLoop: 2
cel: 0
setPri: 6
posn: 83 68
init:
cycleSpeed: (if (== howFast 0) 0 else 2)
setCycle: EndLoop self
)
)
(5
(head
setLoop: 3
cel: 0
posn: 87 49
init:
setCycle: CycleTo 4 1
)
(= seconds 10)
)
(6
(quest init: addToPic:)
(forProp init: addToPic:)
(glory init: addToPic:)
(= seconds 20)
)
(7
(ii init: addToPic:)
(= seconds 10)
)
(8 (head setCycle: CycleTo 5 1 self))
(9
(flame
posn: 85 76
setLoop: 0
setCel: -1
cel: 0
setPri: 8
ignoreActors:
illegalBits: 0
init:
xStep: 3
yStep: 6
setMotion: MoveTo 196 228
setCycle: EndLoop self
)
)
(10
(trial init: cycleSpeed: 0 setCycle: EndLoop self)
(flame
setLoop: 1
cel: 0
cycleSpeed: (if (== howFast 0) 0 else 1)
setMotion: MoveTo 196 228
setCycle: Forward self ;
)
(head setCycle: EndLoop)
)
(11
(trial setLoop: 2 setCycle: Forward)
(self cue:)
)
(12 (= seconds 50))
(13 (NextScript))
)
)
)

Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 06, 2020, 07:06:15 PM
alright! solved that problem! apparently it didn't like bigCarpet being initialized with no properties and assigning them later. I gave it a view and position at initialization and now it works. animation for the sequence is kinda wonky but I imagine that will just take some tweeking.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: OmerMor on June 07, 2020, 08:39:11 AM
What do you think would be better for that last part, a dragon like the original EGA release or the genie from QfG2 VGA?

I'd say the genie would be more appropriate, but it's all good...  :)
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Collector on June 07, 2020, 12:05:01 PM
Any reason that you disabled embedding?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 07, 2020, 02:31:20 PM
embedding for what?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 07, 2020, 03:00:49 PM
do you mean for the video? no, no reason for disabling embedding. I just enabled it.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Collector on June 08, 2020, 10:58:57 AM
Just curious.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 08, 2020, 12:13:54 PM
I am so close to having the end credit sequence finished except for sound! Unfortunately I am having some trouble with the dragon animation. The dragon turns invisible at two points during the animation. When it switches from the first loop of animation to the second, the first cel of the second loop is invisible. It runs 4 cels then pauses. When it pauses, that 4th cel is invisible. When it starts the animation again the rest of the cels are visible. It even pauses one more time and that cel remains visible. If anyone has any thoughts on what could cause this, I'd really like to hear.

I really appreciate all the help I've gotten so far.

Thanks
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: gumby on June 09, 2020, 09:38:16 PM
Palette or transparency issues maybe?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 09, 2020, 10:53:38 PM
transparency problem was my first thought but every frame shows up normally in sci companion, like if I cycle through them in the pic viewer. I don't see anything unusual in the code and nothing that appears to effect only a few frames. Do you have anything specifically I should look out for? Would you like to see the code?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: gumby on June 10, 2020, 09:20:26 AM
My suggestion would be to import the resource into a completely new game and see if the issue is reproducible?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 12, 2020, 12:27:45 PM
excellent suggestion Gumby. I did that and it animates perfectly. Sorry it took so long for me to get to it. I just got fired, I've been distracted. I noticed something different between QfG1 and the template game, I wonder if it might play a part. The pallet for QfG1 reserves 72 plus white colors for views but the template game I used only reserves 64 colors. Could this difference be contributing?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 12, 2020, 02:34:59 PM
I tried re-importing the assets into QfG1 and there were no invisible frames. so far so good. I then adjusted the offset of each cel to align with the background image. This is when the invisible frames start to occur. So I adjusted the offset on the test game and now there are invisible cels in that game too. It seems to be a problem with changing the offset.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 16, 2020, 09:09:25 PM
I was not able to figure out why my frames where disappearing but I did figure out that it was related to adjusting the offset. I was able to adjust the positions of the frames in GIMP before importing. now all the frames show up and in the right location. Now the entire end game sequence has been restored, except for music. I can't get the music to play. I think I might leave that for further down the road.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 20, 2020, 06:09:25 PM
I think I've figured out why the sound won't play. It looks like the sound resource 99 is defective; it has two channel 11 and no channel 10. Does anyone know a way to change one of the channel 11 to channel 10?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: MusicallyInspired on June 21, 2020, 03:09:04 AM
That's....bizarre. It would need to be converted to MIDI first, edited in a standard MIDI sequencer, and then converted back. And it might not be converted back in exactly the same way it used to be. Another option is to possibly hex-edit it and change the bytes that designate which channels are which since SOUND resources have basically standard MIDI data with just new header information. Understanding the MIDI file format specification might make that the most effective route to go as with the currently available conversion tools to MIDI aren't perfect.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: lskovlun on June 21, 2020, 05:50:34 AM
This is the channel list for song 99 as included in my QFG1VGA (from GOG); the ScummVM console window was just barely big enough to screenshot, but I can't see any problems of the sort you describe? But it is clear that some devices have only channel 10, some have both 10 and 11, and some have neither. Which device driver is your SSCI set up to use? You might want to try a different one. What's not working, what do you expect to happen?

Of course, the file could still be bugged in other ways (I can't see from the code that it was used at all? so maybe it was meant for a different SCI version).
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 21, 2020, 09:14:40 AM
MusicallyInspired, thank you for your suggestions. Where can I find utilities to convert from snd to midi? In the tools section of this forum I could only find a tool to convert from midi to snd and that looks like it only works for sci0. I couldn't find a way to do it in scicompaion, though it looks like it can import directly from midi. maybe I'm missing something? Do you know a good website for learning the midi file structure so I can try the direct hex editing?

lskovlun, it is odd that scummvm shows something different from scicompanion. I don't use scummvm so I don't know how to get to that debug screen and can't verify that my copy shows the same thing. I am using the gog version too, though. My copy may be corrupted. May I ask, does your copy play any music through the end game sequence in scummvm?
Room 600, the first part of the endgame sequence, does have code that looks like it should play sound 99. Room 602, the second part of the endgame sequence, originally didn't have any code to play any sound but I have added a lot to the script for that room including code to play sound 99. I know the code works because it will play other sound resources using the same code.
Sound 99 doesn't play in either room 600 or 602. I'm pretty sure at least my copy is a bad resource.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: lskovlun on June 21, 2020, 11:06:35 AM
I have to admit I didn't look at the SCI Companion screen. So there's two issues here: The channel numbers are off by one in comparing ScummVM with Companion, this is purely aesthetic as long as you account for it. The second issue is that the MIDI streams corresponding to each channel are not necessarily the same for every hardware device. You can see this if you pay close attention to where the check marks are in Companion; the two tracks labeled 11 are never active at the same time on the same device. Similarly, channel number 10 is listed at most once in ScummVM per hardware device, but there's one version of it for Adlib/SoundBlaster and one for Tandy/CMS, as can be seen from the offsets. The curious thing is that there is only a control channel (15/16) present for MT-32 (the same one as for all the others).

I don't think this is the bug you're looking for ... unless your setup is an MT-32 or an MT-32 emulator.
In that case, could you try Adlib/SB instead and see if that works?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 21, 2020, 12:28:06 PM
that's good information, thank you. I am using adlib and i went in and turned on all channels for all devices to make sure. it only lets me turn on one of the channel 11 at a time though
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: MusicallyInspired on June 21, 2020, 01:16:35 PM
MusicallyInspired, thank you for your suggestions. Where can I find utilities to convert from snd to midi? In the tools section of this forum I could only find a tool to convert from midi to snd and that looks like it only works for sci0. I couldn't find a way to do it in scicompaion, though it looks like it can import directly from midi. maybe I'm missing something? Do you know a good website for learning the midi file structure so I can try the direct hex editing?

Check the tool NRS posted in this thread (http://sciprogramming.com/community/index.php?topic=1849.msg12893#msg12893). This will convert SCI sound resources to standard MIDI. Take note of the flags you must pass as command line parameters to convert the proper data (Adlib, MT-32, PC Speaker, or all, etc).

Check this (https://www.cs.cmu.edu/~music/cmsip/readings/Standard-MIDI-file-format-updated.pdf) and this (https://www.midi.org/specifications) out for MIDI file specs.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 21, 2020, 05:30:16 PM
awesome, thanks! I'll check those out
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 21, 2020, 06:06:44 PM
I used snd2mid to convert the snd file to  midi. It produced a file that windows media player played without difficulty but anvil studio won't open. when i try to open it in anvil, it tells me to import it like a wav file. what could be the issue there i wonder?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 21, 2020, 06:15:58 PM
then I exported a snd that I know works in-game and converted it to midi. It loads into anvil and plays without incident. I am now quite convinced there is something wrong with sound 99. Is there a way to repair midi files?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 21, 2020, 07:00:27 PM
I was able to find a program called MidiQuickFix that could load it. using that I could change one of the channel 11 to channel 10 (actually channel 10 and now channel 9 in the midi format). It loads into anvil and plays real nice! I then imported the repaired midi into the game and it plays now. Unfortunately, the cue points were not preserved so i'll have to go in and rebuild those. I hope it's not too much trouble. Thank you MusicallyInspired, I'm not sure I would have ever found that converter without your help. Can anyone direct me to some good instructions on the cue points, please? the info in the scicompanion docs is pretty sparse. it says they can be used to trigger events but it doesn't say how to do it. Also i'd like to know if they can be used to specify start and stop points in the music. If anyone can direct me to this info, it would be greatly appreciated.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: OmerMor on June 22, 2020, 03:47:22 AM
I didn't have time to check for differences, but you can find all the versions of qfg1ega that I have (including for different systems) in this Google Drive folder:
https://drive.google.com/drive/folders/1KlY9ywIX-w54lhaq8AqUfdyzPHnWSmZt?usp=sharing (https://drive.google.com/drive/folders/1KlY9ywIX-w54lhaq8AqUfdyzPHnWSmZt?usp=sharing)

Maybe they have a better version of the sound 99 resource.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 22, 2020, 09:52:40 AM
Thank you OmerMor, that's a good idea. I was going to try importing from the ega release if i couldn't get the one in vga to work. they seem nearly identical, just different instruments it sounds like. I did get the vga version working though, cue points are now restored, so I won't need to. now I need to figure out cue points, I think they will be the key to syncing the end sequence to the song. I'm thinking of releasing a video of all the stuff i've done to the game so far. If I do i'll start another thread in the games section of this forum. I might try to get that done today
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: EricOakford on June 22, 2020, 09:58:57 AM
I know that the Macintosh version plays the end music just fine.

Also, I seem to recall that in the DOS version, the music plays okay if set to Adlib or PC Speaker (and possibly MT-32). My best guess is that this particular track was not updated for the newer General MIDI driver, hence silence.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 23, 2020, 01:58:12 AM
I've started a progress thread here:

http://sciprogramming.com/community/index.php?topic=1899.0 (http://sciprogramming.com/community/index.php?topic=1899.0)

which includes a video showing my progress
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: MusicallyInspired on June 25, 2020, 11:30:52 PM
Sorry I've been away on a short 3-day vacation and just got back today. Glad you got it all working. :)
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 28, 2020, 01:42:51 PM
thank you again for your advice, it was very helpful