Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - gumby

Pages: [1] 2 3 ... 8
1
SCI Syntax Help / Status line vertical size
« on: May 25, 2021, 09:51:19 AM »
I'm trying to get the status line to be a few pixels taller, the font I'm using has some characters that drop below the status line and get chopped off.  I was able to get the status line code modified to be larger, but when DrawPic commands are executed, they look to be getting applied at a y=10 and effectively overwriting the status line pixels that extend the 10th y pixel.

Anyone know if making a larger status line is possible?

2
SCI Syntax Help / SCI 1.1 - Refresh Inventory Screen
« on: February 13, 2021, 02:15:37 PM »
I have a scenario where interacting with an inventory item on the inventory screen needs to change the currently displayed view for the item.  For example, the action being taken within the inventory screen is turning on a flashlight.  I want to swap out the view of the flashlight being off to a view of the flashlight being on.

A kludgey solution is to hide and show the inventory screen, but this also introduces a flicker-effect because the window is being torn down and redisplayed:

Code: [Select]
   (gInv hide:)
   (gInv show:)

What's the correct way to do this?  Is there a built-in way to ask the inventory screen to refresh itself?  Or should I instead reference the view within the inventory screen, change the view and call forceUpd - or something along these lines?

3
SCI Syntax Help / Out Of Heap - DosBox vs ScummVM
« on: January 02, 2021, 01:26:44 PM »
I'm working on an SCI1.1 game and I'm running out of heap.  In my testing I tried using DosBox and ScummVM and I found that upon starting up the game and immediately going into the debugger and viewing the available heap (alt-d, alt-r) there are differences.

In DosBox, I have 10040 bytes free.  In ScummVM, I have 32746 bytes free.  Does someone here have an explanation as to why this would be? 

4
SCI Community How To's & Tutorials / Palette Cycling Tutorial
« on: October 11, 2020, 02:41:18 PM »
The SCICompanion instructions are very good; I've put this tutorial together for someone who wants to do this in Paint.NET.  This is how I did it, there are probably different/better ways but I'm putting this out there in hopes it might help others.  I've uploaded the final result, along with all the artifacts I used to create it from the fan games section here: http://sciprogramming.com/fangames.php?action=review&id=210

Step-By-Step (geared for following the demo game)

1. In SCICompanion, create a new template game for SCI 1.1.

2. Create/import your background pic (refer to 'original background.bmp').  Right click 'Import bitmap to pic', reserving the last 2 rows (32 colors) for the palette cycling

3. Create the first gradient.  Edit the palette, select the first 8 unused colors, hit 'Gradient'.  Choose A-B as the gradient type and leave the default colors (white to black) as is.  Save the PIC (you have to save the palette to the PIC before attempting an import utilizing palette changes)

4. Create an 8 color palette file matching the gradient you created in the palette tool in Companion (I've included a 8-color and 16-color file in the demo game you can use - refer to the '8 color cycle' file).  If you are creating these from scratch, you will need to look at every color in the palette for the RGB values and make corresponding entries in the Paint.NET palette files. Drop these in the Documents\paint.net User Files\Palettes folder on your file system
   
5. In Paint.NET open the background pic (needs to be already sized to 320x190 - again, refer to 'original background.bmp')

6. Create a new layer (Layers->Add New Layer).  Make sure this new layer is on top and selected.

7. Open the 'Colors' window, and select the 8 color palette file that you just created.

8. Draw, pixel by pixel, typically in an ascending/descending pattern of colors from the 8 color palette on the top (transparent) layer.

9. When finished, delete the 'Background' layer and 'Save-As' the top layer.  Save as a PNG with a bit depth of 8 and dithering level of 0 (refer to 'pixels - range 1.png')

10. In Companion, import the PNG you just created, choosing 'Overlay on current' and 'Map to current palette', selecting the 8 color gradient that you created in step 3.

11. Save the pic and reopen.  You should now see the background merged with the the PNG that you just imported.  Change the gradient colors to whatever suits your picture. I've done a combination of the following with varying success:
   1) Use the gradient tool.  Pick a start color and end color and you are done
   2) Random copy/paste.  Choose colors that are already preexisting from the room palette and just paste them into each of the cycle indexes with little/no regard to neighboring colors
   3) If after testing out the color cycling it's too light or dark with the surrounding areas, use the 'Adjust' tool against the full cycle range and lighten/darken it (or do other color adjustments)

12. Test out the results.  Open the corresponding room script (110) and this code to the room instance (assuming that your gradient uses color indexes 224 to 232)

   (method (doit)
       (Palette palANIMATE 224 231 -20)      
   )
   
13. At this point I strongly suggest exporting the palette (assuming you are reasonably happy with the results).  This allows you to rework (add/delete pixels) on your transparent layer and re-import without having to redefine the palette every time (refer to 'pal range 1.pal').  You may also want to export the full pic resource as well to support 'mutiple passes' at giving the room  - if you don't do this, you'll just have to re-import each layer individually and reapply the palettes you defined (not a big deal).
   
14. Technically, at this point you are 'done' - but in reality you will more than likely need to work & rework your transparent image before you are satisfied.  Let's create another color cycling range and corresponding transparent layer:

15. Repeat Steps 3-11, this time with another 8 color gradient range (colors 232 - 239).   

16. Test out your new changes.  Change your Palette command to this and test the room:
        (Palette palANIMATE 224 231 -20 231 239 -50)
      
17. If you are satisified, again I recommend doing Step 13 (export the palette range and pic resource if desired)

18. Now we can move on to the last range, this time using a 16 color range (again, see included resources in the demo).  Perform the same steps (making adjustments) 15-17.  Here's the updated Palette command:
       (Palette palANIMATE 224 231 -20 232 239 -50 240 255 -35)

5
SCI Syntax Help / Views with more than 64 colors
« on: August 02, 2018, 07:57:29 AM »
I have a need for a view that will be used in multiple rooms and the built-in 64 colors aren't enough so I created a view using the first 112 palette entries.  My rooms share the same first 112 palette entries and the remainder of the palette is used for the room colors.

In the room I init the view and it nukes the current room palette, the only thing I've found that allow for the room and view to display propertly is to force the palette to be updated in the doit method.

Code: [Select]
  (method (init)
(super init:)
(thief init:)
)

(method (doit)
(Palette palSET_FROM_RESOURCE 0)
)

This feels wrong to be making the call in the doit.  I did try using a changeState method in a room script, but that didn't work - looks like the view's palette overrides the room palette.  Is there a better way to be doing this?

6
SCI Syntax Help / Repeat, continue, break
« on: July 15, 2018, 06:34:24 PM »
Just found that this combination of commands work perfect for a goto replacement.  Continue and break I'm familiar with in multiple languages, but repeat was a new one to me.  More elegant than a (while (== 1 1) loop.

7
SCI Development Tools / Creating PICs with palette cycling
« on: May 30, 2018, 06:54:37 PM »
I've been playing with palette cycling and realized very quickly how time consuming it can be to setup the overlay pic.  I'm looking for suggestions as to how to effectively create the overlays, because drawing pixel-by-pixel is pretty laborious, considering that one needs to change the drawing color each time (for something like the example in the Companion help file - specifically a water effect).

I've been doing everything outside of Companion with Paint.NET, but it isn't cutting it.  My basic process is to create two layers, load the background image as one layer and use another layer for the overlay.  I create the overlay by drawing a pixel, changing the pen color, draw another pixel, rinse-and-repeat.

Anyone done any development in this area that can recommend a more streamlined process or a particular tool-set that would help?

8
I'm having an issue which seems to be related to the number of global variables I have defined in Main (SCI 1.1 game).  When I get past about 256 values (including array indices), it causes the status bar to corrupt.  I've troubleshot it to the point where if I add/subtract a single global it either works/doesn't work as expected.

Is there a known limit to the number of global variables that can declared?

9
This game is finally released.  By no means 'complete' in the traditional sense; I've only created the first part of the game (one could consider it a 'proof of concept').  A far cry from what I started out to do which was a traditional 'port' using SCI0, but I'm very pleased with the results.  I fully intend on fully finishing this endeavor now that I have a framework in place that I can build upon.

Download it from the fan games page here: http://sciprogramming.com/fangames.php?action=review&id=203

10
I ran into a need to have a view displayed at different scales based on the room it was displayed in.  Making things more difficult, it wasn't just one view, I needed logic for N views.  No way I was going to make 20+ different versions of the same view cel for all my views to accommodate all the different scales that I needed.

I started by creating views that were 'full size', meaning either 320 on the x-axis or 190 on the y.  Then I assigned relative 'scale values' or 'sizes' between them so they would sized appropriately when displayed with any other views.  For example:

Code: [Select]
(define SWORD_SCALE 80) 
(define LAMP_SCALE 65)              ; the lamp is 80% the size of the sword
(define CLOVE_OF_GARLIC_SCALE 5)    ; the clove of garlic is 6% the size of the sword

Then determine what your room scale value should be, 1 being a 'zoomed in' room and larger values get you 'further away' from them, effectively making them scaled down.

I added this procedure in the Actor.sc script:

Code: [Select]
;;;
;;;  Calculates what the scale should be based on the relative room scale (current room) and relative view scale
;;;    viewScale - a relative scaling value between ~5 (smallest) to ~100 (largest).
;;;    roomScale - value between 1 ('closest' or 'largest views') to ~50  ('furthest' or 'smallest views')
;;;
(procedure (calcRelativeScale view loop cel viewScale roomScale &tmp width height dim tmpScale)
   (= width  (CelWide view loop cel))
   (= height (CelHigh view loop cel))
   
   (if (> width height)
      (= dim width)
    else
      (= dim height)
   )

   (= tmpScale (/ (/ (* dim viewScale) 100) roomScale))
   
   (if (< tmpScale 3)
      (= tmpScale 3)    ; smallest possible scale with full-screen views
   )
   
   (if (> tmpScale 100) 
      (= tmpScale 100) ; full size
   )
   
   (return tmpScale)
)

Then prior to initing your view, calculate the scale by passing in the view, loop, cel and your viewScale and roomScale.  Just to be safe, make sure that the computed value is sane.

Code: [Select]
   
   (= view 10)   ; the sword view
   (= loop 4)
   (= cel 0)
   (= viewScale SWORD_SCALE)
   (= roomScale 50)    ;  I actually added a new property to the Room object and set the scales for the rooms there

   (= tmpScale (calcRelativeScale view loop cel viewScale roomScale))

   ; don't attempt to scale if we have no scale value defined
   (if (> tmpScale 0)   
      (myView init: show: setScale: Scaler tmpScale tmpScale)
    else
      (myView init: show:) 
   ) 

The scaled views that I generated from a 'full size' seemed pretty good at any size but this code could be improved by having more than just one view to choose from.  We could make a 'half-size' view with max dimensions of 160x85 and perhaps another 'quarter-size' one.  Compute the scales against all 3 views and choose the one that has a resulting scale nearest to 100 - this may help with any visual degradation when the scale size gets too small.

I've attached a screenshot of 3 different views, scaled at 5 different 'room sizes' using this process:

11
SCI Syntax Help / Scaler error
« on: November 11, 2017, 10:16:51 AM »
I'm having a problem using the scaler.  When I call it with a view that has an instance explicitly declared in room (Egg) it works just fine, but when I call it on a view I create 'on-the-fly', the scaler throws an error of "<View setScale:> y value less than vanishingY".  My best guess is that I'm improperly creating the on-the-fly view, but I don't know how else to do it.

Code: [Select]
(method (init)
     (super init:)

     (Egg         view:24 loop:4 cel:0 x:100 y:100 init: setScale: Scaler 50 50)
     ((View new:) view:24 loop:4 cel:0 x:100 y:150 init: setScale: Scaler 50 50)
)
...

(instance Egg of Prop)

EDIT: Deferring the scaling doesn't seem to make a difference either.  The 'egg' instance works just fine, the dummy fails in the same way as the code above.
Code: [Select]
        (Egg view:24 loop:4 cel:0 x:100 y:100 init: )
        (Egg setScale: Scaler 50 50)
       
        (= dummy ((View new:) view:24 loop:4 cel:0 x:100 y:150 init:))
        (dummy setScale: Scaler 50 50)

EDIT2: I figured it out.  Shouldn't be using the 'View' class, should be using the 'Prop' class.  Once I changed the code to new-up a Prop it worked fine, which made perfect sense once I discovered the scaler property associated to Prop.  :-[

12
SCI Syntax Help / SCI 1.1 - DrawPic & dpOPEN_INSTANTLY
« on: November 04, 2017, 08:39:36 AM »
I'm having a problem when calling DrawPic with dpOPEN_INSTANTLY (defined as -1 in sci.sh) - I get the request room pic, but it's flipped horizontally when displayed.

Here's my code (in the room instance):
Code: [Select]
(method (handleEvent pEvent)
(super handleEvent: pEvent)
(switch ((gUser curEvent?) message?)
(V_LOOK
   (DrawPic 5 dpOPEN_INSTANTLY)
)
)
)


EDIT: I found a workaround, used the dpOPEN_NO_TRANSITION (100) option instead.

13
SCI Syntax Help / Inventory views
« on: October 18, 2017, 07:58:41 PM »
Documenting this as I haven't found this explicitly stated anywhere yet.  With SCI 1.1, when creating views, by default the template game wants/expects the following:

loop 0 = cursor view
loop 1 = inventory icon
loop 2 = icon bar

When declaring your inventory items in Inventory.sc, set the loop 1 for the views.  I noticed that if you set it to loop = 0, it'll show the loop 0 view the first time you open the inventory screen but any subsequent times it'll display loop 1.

14
SCI Syntax Help / String pain
« on: October 14, 2017, 11:12:07 AM »
The below code lives in a room script, in the doVerb method of a prop. I have a text resource that contains all of my noun names, resource 1 and in this case hard-coded to index position 35 (sword).  I've ripped everything out except for the code that I'm struggling with:

Code: [Select]
; On first invocation, prints  "The sword won't fit in the box". 
; On subsequent invocations, only prints "sword"

    (method (doVerb theVerb param2 &tmp [test1 50])
         (Printf "The %s won't fit in the box" (GetFarText 1 35))
    )

I tried this with the same results as above:
Code: [Select]
; On first invocation, prints  "The sword won't fit in the box". 
; On subsequent invocations, only prints "sword"

    (method (doVerb theVerb param2 &tmp [test1 50])
         (StrCpy @test1 (GetFarText 1 35))
         (Printf "The %s won't fit in the box" @test1)
    ) 
   
The only thing that does work is this:
Code: [Select]
; On every invocation, prints  "The sword won't fit in the box".

    (method (doVerb theVerb param2 &tmp [test1 50])
         (Printf "The %s won't fit in the box" (Format @test1 1 35))
    )   

Can someone help me understand what's going on here?  Seems like #1 & #2 should work fine, #3 sort of makes sense (I assume a pointer to @test1 is being returned from the Format call and the Printf statement is able to use it).

15
SCI Syntax Help / SCI 1.1 view palettes
« on: September 14, 2017, 07:29:46 PM »
So I'm starting to create views for my rooms.  I discovered pretty quickly that they tend to stand out because of the limited colors when creating a view.  The views I'm creating are specific to individual rooms, so conflicting palettes shouldn't be a problem. 

I suspect I can get around this by building an embedded palette? I found the 'Import' option in the palette editor, not sure how to use it - is there a way to import the palette from the corresponding PIC resource?

EDIT:  Never mind, found it.  Just open the PIC, go to the palette and export the .pal.  Then just import it into the view.  Nice.

Pages: [1] 2 3 ... 8

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

Page created in 0.126 seconds with 19 queries.