Author Topic: SCI Companion Pic Editor saving bug?  (Read 8361 times)

0 Members and 1 Guest are viewing this topic.

Offline MusicallyInspired

SCI Companion Pic Editor saving bug?
« on: April 22, 2021, 01:00:01 AM »
So I was creating a Picture resource for KQ2SCI on stream yesterday and towards the end I decided to test it. I saved it and loaded up the game and half my work wasn't showing up. The commands were all there in the Pic, but it wasn't working. I tried closing the Pic and reopening it and...it was all messed up. Most of my work was lost and only some of it persisted in being saved. Since I was streaming, though, I had all the commands listed on video so I painstakingly went through the video frame by frame and reimplemented each draw tool command from the draw command list on the video. That took ages. And then....it got even worse. Commands I didn't even make started garbling the screen in the Visual, Priority, and Control screens alike.

I narrowed the problem down to the Pen tool using the randomized pattern (specifically size 2). So I figure something isn't saving right when it comes to that specific draw command. It recorded two of the pen tool draw commands fine, but by the third it randomly decided to turn on the Visual tool and start painting on coordinates that aren't even on the picture (like in the thousands) and randomly appearing in a bunch of places on the screen and the entire rest of the picture ended up being corrupted. I had to remove the Randomized Pen Pattern tool commands entirely and it saved just fine.

This may be something we're already aware of I don't know. Now that I've run into it like this, though, I do remember running into it in the past and remembered trying to avoid using the randomized pattern pen tool. I've used it on other pictures in KQ2SCI, but with those I used SCI Studio to draw the pictures way back when. So I guess I'll have to use Studio sometimes for those details. I haven't nailed down exactly how or why it's corrupting but I intend to do further testing and experimenting with the SCI Pic resource file specs closeby.


Brass Lantern Prop Competition

Offline gumby

Re: SCI Companion Pic Editor saving bug?
« Reply #1 on: April 23, 2021, 09:32:25 PM »
Do you still have the original (broken) pic and attach it here for help troubleshooting?  Which version/build of Companion are you using?
« Last Edit: April 23, 2021, 09:36:33 PM by gumby »
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline MusicallyInspired

Re: SCI Companion Pic Editor saving bug?
« Reply #2 on: April 24, 2021, 09:47:40 AM »
I'm using one of Kawa's builds from October 2018. Using a later build does the same thing though. And I recall this still being an issue way back before Companion 3 came out.

pic_hopefully.016 is the full corrupted image.
pic16_grass_test.016 was my attempt to save just the grass data with the random pattern pen tool. Same corruption.
Brass Lantern Prop Competition

Offline gumby

Re: SCI Companion Pic Editor saving bug?
« Reply #3 on: April 25, 2021, 06:31:41 PM »
Out of curiosity I did some testing with the random pattern tool.  I was able to get corruption multiple times with any size of random pen.  All I did was create a new pic, set the visual screen and just clicked a bunch of times with the random pen tool.  Saved and then went back into the pic and corruption was there in the form of off-screen lines (in the thousands), fill commands or set palette commands at the end of the command list.
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline troflip

Re: SCI Companion Pic Editor saving bug?
« Reply #4 on: April 26, 2021, 07:09:09 PM »
This looks like the fix for that bug (January 2017):

https://github.com/icefallgames/SCICompanion/commit/b97e9c5c29b037cacb9bad1d02c659382194908c#diff-a65be7d67191b6bf6f9da1b8cbf0256927977ef8d8d229c1f585d56d125d8ede

A Kawa build from 2018 should have had that fix in it though...

Sorry you lost a bunch of work.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Kawa

Re: SCI Companion Pic Editor saving bug?
« Reply #5 on: April 27, 2021, 07:20:55 AM »
That meshes with my fruitless attempts to reproduce the bug. So any build from 2018 onwards should be good.

Offline MusicallyInspired

Re: SCI Companion Pic Editor saving bug?
« Reply #6 on: April 27, 2021, 11:41:41 PM »
That meshes with my fruitless attempts to reproduce the bug. So any build from 2018 onwards should be good.

Then why does your recent Jan 19 2021 build with the Picture drawing GIF animation export feature still have the bug?
« Last Edit: April 27, 2021, 11:46:49 PM by MusicallyInspired »
Brass Lantern Prop Competition

Offline Kawa

Re: SCI Companion Pic Editor saving bug?
« Reply #7 on: April 28, 2021, 04:53:54 AM »
That's a very interesting question. The bug was fixed by Phil in January 2017, far before I started my changes ("Commit ALL the changes!" is from October 2018), and the current version still has the changes from 2017 in it. According to the commit history for PicCommands.cpp, it goes "fix long-standing bug", "commit all the changes", irrelevant formatting jank, gif. Which means if there was a regression, it was in one of two other files which I'll check now.

And I insist I couldn't reproduce it when I tried.


Edit: View.cpp and TestPicDraw were untouched since.
« Last Edit: April 28, 2021, 04:55:44 AM by Kawa »

Offline MusicallyInspired

Re: SCI Companion Pic Editor saving bug?
« Reply #8 on: April 28, 2021, 08:52:36 AM »
I have the draw commands saved in a clipboard file because there's no other way for me to save it. No matter what build of Companion I paste them into, it looks fine until I save it to a file and open it (again, doesn't matter what build). And it's always corrupted.

I used InsideClipboard to save the data and load it again so I can paste it into the Pic editor because there was no other way for me to preserve the draw commands intact.
« Last Edit: April 28, 2021, 08:54:34 AM by MusicallyInspired »
Brass Lantern Prop Competition

Offline Kawa

Re: SCI Companion Pic Editor saving bug?
« Reply #9 on: April 28, 2021, 09:45:03 AM »
Well, I'm convinced. And I have no idea.

I'm just going through the list of commands, seeing where it breaks, removing each one that does so...

137x118 pat C (2-78)
103x160 pat C (2-7A)
85x154 pat C (2-79)
122x121 pat C (2-79)
202x208 pat C (2-7E)
...

just seeing where it does something Weird and going back and forth, deleting the next command and exporting...

And there we go. From 121x119 all the way down to 125x44, with a dozen or so little clusters missing.

The next step is to keep hold of the breaking command list, part of which I bothered to transcribe above, and see why those specific commands seem to be mistaken for others, and go from there.
« Last Edit: April 28, 2021, 10:07:36 AM by Kawa »

Offline troflip

Re: SCI Companion Pic Editor saving bug?
« Reply #10 on: April 28, 2021, 12:59:46 PM »
Ok... this shouldn't be too hard to figure out... it's failing on the third pen command...
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline troflip

Re: SCI Companion Pic Editor saving bug?
« Reply #11 on: April 28, 2021, 01:52:51 PM »
Seems to have something to do with the the pattern index (the random part) being too large (>= 120) and being interpreted as a new command instead of a continuation of the pattern command. However, when you're drawing, the code clamps the value to 118, so that should never happen.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline troflip

Re: SCI Companion Pic Editor saving bug?
« Reply #12 on: April 28, 2021, 02:01:19 PM »
Musically Inspired, are you sure this image wasn't created with an old version of SCI Companion? Or some other program?

The third pen command contains an invalid random pattern:

Code: [Select]
Pen: 121x119 Pat-C (2-69)
Pen: 129x119 Pat-C (2-15)
Pen: 137x118 Pat-C (2-78)  // 78 is too big... max allowed is 76
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline troflip

Re: SCI Companion Pic Editor saving bug?
« Reply #13 on: April 28, 2021, 02:06:51 PM »
Ahh... that fix never made it into the official branch, I see.

In CPicView::_MakeRandomNR() and CPicView::_OnPatternRClick(), the 128 should be changed to 119.

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

Offline troflip

Re: SCI Companion Pic Editor saving bug?
« Reply #14 on: April 28, 2021, 02:12:01 PM »
Ok, I checked in a fix to the main branch, but I'm not set up to build (or test it, but it should be fine).
Check out my website: http://icefallgames.com
Groundhog Day Competition


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

Page created in 0.084 seconds with 22 queries.