Author Topic: Changes to SCI 1.1 template game  (Read 15881 times)

0 Members and 1 Guest are viewing this topic.

Offline troflip

Changes to SCI 1.1 template game
« on: June 26, 2015, 01:53:22 PM »
I'll use this thread to summarize/discuss any further changes to the template game.


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

Offline troflip

Re: Changes to SCI 1.1 template game
« Reply #1 on: July 01, 2015, 01:32:36 AM »
For 3.0.0.7, there are the following changes to the template game. The polygon editor won't work properly without these changes.

main.sc has two more exports:

Code: [Select]
    13 AddPolygonsToRoom
    14 CreateNewPolygon

They look like this (add them after DebugPrint):

Code: [Select]
(procedure (CreateNewPolygonHelper polyBuffer nextPoly)
(var newPoly, pointCount)
(= newPoly (Polygon:new()))
(= pointCount (Memory(memPEEK (+ polyBuffer 2))))
(send newPoly:
dynamic(FALSE)
type(Memory(memPEEK polyBuffer))
size(pointCount)
// Use the points directly from the buffer:
points(+ polyBuffer 4)
)

// Tell the caller the position of the next poly, if they care:
(if (> paramTotal 1)
Memory(memPOKE nextPoly (+ polyBuffer (+ 4 (* 4 pointCount))))
)
return newPoly
)

(procedure public (AddPolygonsToRoom polyBuffer)
(var polyCount)
(if (< polyBuffer 100)
TextPrint("polyBuffer is not a pointer. Polygon ignored.")
)(else
(= polyCount Memory(memPEEK polyBuffer))
(+= polyBuffer 2)
(while (polyCount)
(send gRoom:addObstacle(CreateNewPolygonHelper(polyBuffer @polyBuffer)))
--polyCount
)
)
)

(procedure public (CreateNewPolygon polyBuffer nextPolyOptional)
(var polyCount)
(if (< polyBuffer 100)
TextPrint("polyBuffer is not a pointer. Polygon ignored.")
return NULL
)(else
(= polyCount Memory(memPEEK polyBuffer))
(+= polyBuffer 2)
return CreateNewPolygonHelper(polyBuffer nextPolyOptional)
)
)


In your rooms, this:
Code: [Select]
SetUpPolys_110()

should become:

Code: [Select]
AddPolygonsToRoom(@P_Default110)

(replace with the right pic number of course)

To get the .shp files converted, open the pic in question and re-save it, and the polygons will be in the new format (local vars instead of procedures). Version 3.0.0.8 will remove support for reading the old-style polygon format, so make sure to use 3.0.0.7 to convert.

There are other minor changes to the template game (just updating constants and variable names). Nothing that really needs updating if you already have a game.
https://github.com/icefallgames/SCICompanion/commit/78c1643573a661c2220d178ded8ee564fd4b5697


« Last Edit: July 01, 2015, 11:51:47 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline lskovlun

Re: Changes to SCI 1.1 template game
« Reply #2 on: July 01, 2015, 03:35:17 AM »
This bit of the diff
Code: [Select]
+(local
+ P_Default110[27] = (2 PBarredAccess 6 197 60 269 68 286 85 267 101 225 101 202 89 PBarredAccess 5 0 63 45 67 47 87 22 96 0 97 )
+ P_Bottom[10] = (PBarredAccess 4 79 146 220 155 204 168 59 166 )
looks a bit odd. The first one has a count of polygons at the very beginning, the other one does not. So I would expect one to be suitable for AddPolygonsToRoom and the other one (not in the default set) to be passed to CreateNewPolygon. There is no other indication of this - perhaps put a comment?

Other than that, it looks good.

Offline troflip

Re: Changes to SCI 1.1 template game
« Reply #3 on: July 01, 2015, 09:49:18 AM »
Yeah, originally I had a 1 in there to have both forms be consistent, but for some reason I changed it. I might change it back and just have CreateNewPolygon throw up a warning if it's passed one with more than 1 polygon.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline lskovlun

Re: Changes to SCI 1.1 template game
« Reply #4 on: July 01, 2015, 10:05:28 AM »
Another thing, you're making a new dynamic polygon out of something that is almost guaranteed to remain in memory anyhow. The point list is in local variables now, and unless you want to protect against changes in the local array, memory is being allocated (= possible fragmentation) here for no apparent reason. For most purposes, setting dynamic to FALSE and pointing points inside the original array should be sufficient.

Offline troflip

Re: Changes to SCI 1.1 template game
« Reply #5 on: July 01, 2015, 10:18:54 AM »
Good point. Originally I figured that someone could create multiple of these polygons and edit the points of just one of them? That's not a common scenario I suppose (and I suppose there is still a way for them to do that if they want). And the way I was creating the polygons before (from immediately values passed as parameters, which is how some Sierra games do it) was also causing the same kind of fragmentation - so I figured this wasn't too bad.

But yeah, seems like it might be better to just use the points directly.


Changes made as per Lars' suggestion.
« Last Edit: July 01, 2015, 11:31:07 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline troflip

Re: Changes to SCI 1.1 template game
« Reply #6 on: July 01, 2015, 11:35:33 PM »
For version 3.0.0.7, the global palette has also been changed to that of KQ5.

I added a pretty low-tech solution if you want to remap existing views to the new palette:
- make sure both palette resources exist in the game. You can make the new palette the global palette after, or now, doesn't matter.
- open the view resource
- if you want, remove the embedded palette from the view resource (view->remove embedded palette). They seem pointless anyway, and if you leave it in, you'll need to modify it to have the colors from the new global palette.
- choose Remap Palette from the view menu
- choose the "from" and "to" palettes and hit ok
- Now the view should be converted. You can see what the results look like by selected the "to" palette in the left-hand pane.
« Last Edit: July 01, 2015, 11:45:38 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Collector

Re: Changes to SCI 1.1 template game
« Reply #7 on: July 01, 2015, 11:39:36 PM »
Sounds like a pretty straight forward way of doing it.
KQII Remake Pic

Offline MusicallyInspired

Re: Changes to SCI 1.1 template game
« Reply #8 on: July 02, 2015, 12:42:07 AM »
Embedded palettes for views aren't entirely pointless. They're great for animated sections of a background that need to utilize the background's palette. Like the animated fading in of the "IV" in KQ6's title screen, for instance, or closeup cutscene/dialogue sequences in many games. Otherwise they'd stick out like a sore thumb using the default global 64 colour palette. Love this functionality, though. Thanks!
Brass Lantern Prop Competition

Offline troflip

Re: Changes to SCI 1.1 template game
« Reply #9 on: July 02, 2015, 12:57:57 AM »
Embedded palettes for views aren't entirely pointless. They're great for animated sections of a background that need to utilize the background's palette. Like the animated fading in of the "IV" in KQ6's title screen, for instance, or closeup cutscene/dialogue sequences in many games. Otherwise they'd stick out like a sore thumb using the default global 64 colour palette. Love this functionality, though. Thanks!

Hmm... I still don't get it. I just tried removing the embedded palette for the IV, and it still looked the same (since the background pic sets the palette, and it uses the same palette as the one embedded in the view).

I still don't see a case where it would be useful. And most of the embedded palettes in the views in SQ5 are just copies of the global palette. Maybe it was only useful as an editing tool, to see what the view will look like on a particular background? Or if a background is totally blank (and has no palette), then the view's palette will be used?
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: Changes to SCI 1.1 template game
« Reply #10 on: July 02, 2015, 01:43:04 AM »
Well yeah, you can't create a view animation that looks like the background without the background's palette. Otherwise it'd only be black. While you're editing, anyway.
Brass Lantern Prop Competition

Offline troflip

Re: Changes to SCI 1.1 template game
« Reply #11 on: July 02, 2015, 12:34:59 PM »
Idea for a tutorial: how to use views as animated/moving backgrounds. i.e. export palette from the pic, add a palette to a view, import that palette to the view's palette.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Kawa

Re: Changes to SCI 1.1 template game
« Reply #12 on: July 02, 2015, 01:29:25 PM »
Idea for a tutorial: how to use views as animated/moving backgrounds. i.e. export palette from the pic, add a palette to a view, import that palette to the view's palette.
I like that idea.

Offline MusicallyInspired

Re: Changes to SCI 1.1 template game
« Reply #13 on: July 03, 2015, 11:31:09 AM »
Yeah, that works great. I wasn't looking for extra functionality, just pointing out that embedded palettes in Views have a purpose, even if it's only when editing.
Brass Lantern Prop Competition

Offline MusicallyInspired

Re: Changes to SCI 1.1 template game
« Reply #14 on: July 11, 2015, 08:18:52 PM »
A small contribution. I recommend using this version of the test inventory coin item that uses the orange-ish hues as opposed to the current yellow conversion which caused some colour loss. The image is based on the coin from SQ4 which uses the same colours.
Brass Lantern Prop Competition


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

Page created in 0.018 seconds with 23 queries.