Author Topic: SCI01 template with full-colour bitmap backgrounds (parser, QfG2 system scripts  (Read 13 times)

0 Members and 2 Guests are viewing this topic.

Offline robbo007

Hi all,

I've been working on an SCI01 template and it's ready for other people to try. The short version: the SCI01 parser interpreter, with full 16-colour EGA bitmap room backgrounds instead of vector-drawn pictures. You draw your background in any paint program, the tools convert it and put it in the room's pic, and you keep drawing priority and control in SCI Companion as usual. Please note you will need to use Kawa's SCI Companion folk.

How it works

SCI01 pics can contain an embedded EGA cel: the FE 07 extended pic command. Sierra used it themselves (Quest for Glory II has three pics built this way, e.g. pic 190). The template puts your bitmap in the pic as that command, drawn first; priority and control stay ordinary vector commands. So it's all standard SCI01 data, no interpreter changes needed for the bitmaps, and SCI Companion opens and saves these pics fine (it shows the bitmap as an "Image (320x190)" command and keeps it byte for byte). The format, with sources (ScummVM, Sierra's own pics, and probes in the real interpreter), is written up in FORMAT.md.

What's in it
  • Interpreter 1.000.172 with the parser.
  • System scripts from Quest for Glory II 1.105, recompiled in SCI Companion and cut down to a template: Main, Util (HandsOn/Off, flags, HighPrint/LowPrint/CenterPrint, NormalEgo, EgoDead, quit/restart/pause), menus, save/restore, debug mode (Alt-D: priority/control screens, teleport, cast list).
  • One sample room (room 100) with a bitmap background, features and Said handlers, plus small examples of flags (type TOUCH PILLAR twice) and the death dialog (type DIE). The README has a room script skeleton.
  • Globals cleaned up: every global the template uses has a name and a comment; all the QfG2 game-state leftovers are marked free (and the block trimmed, about 1 KB more heap).
  • Animated icons in the quit and death dialogs.
  • Bitmap Injector, an SCI Companion plugin (Windows, works on XP): Plugins > BitmapInjector, pick the pic number and an image, Inject.
  • Python tools if you prefer the command line (Python 3 + Pillow): build.sh converts every room listed in rooms.toml, injects them and starts DOSBox-X; plus a pic renderer and a global usage report.

Making a room
  • Open the template folder in SCI Companion 3.2.5 (keep SaveToPatchFiles=true in game.ini).
  • Create pic N and draw priority and control only, with visual drawing turned off.
  • Create script N and replace Companion's generated room code with the skeleton from the README (Companion's New Room code is for its SCI0 template, so names like gPreviousRoomNumber and SetUpEgo don't exist here). Compile All twice.
  • Inject your background with the plugin (or add it to rooms.toml and run build.sh).

Art and limits
  • 320x190 is native; other sizes are resized.
  • The 16 standard EGA colours, no palette: the converter dithers. Ordered dither is the default (about 32 KB per room); "none" suits flat/cartoon art (about 18 KB), Floyd-Steinberg suits painted art (42-46 KB).
  • A pic can be up to 64 KB; I've tested up to 62,874 bytes, including room changes and save/restore. A single full-screen bitmap always fits.
  • Don't draw on the visual screen in a bitmap room: it would paint over the bitmap.

A Companion + SCI01 bug you might hit in your own projects
This one cost me a long time, so it's worth sharing. SCI Companion writes an empty relocation block into compiled scripts that have no pointers; Sierra's compiler never does. The 1.000.172 loader doesn't check for an empty table, so it runs its fixup loop 65,536 times and overwrites random words of that script when it loads. You get crashes that seem impossible and move around: "Oops!" from a bad opcode, or "text.001 missing", in code that looks perfectly fine. The template's SCIV.EXE has a small patch to its loader (27 bytes) so it skips empty tables, and the tools can also strip the empty blocks from the scripts. If you're using SCI01 with SCI Companion and seeing random crashes, check for this first.

Testing
I've tested in DOSBox-X on a Mac and in DOSBox 0.74 on Windows XP. I haven't tried it on real hardware, or with sound cards other than the defaults in RESOURCE.CFG, so reports on those are very welcome.

The README in the zip has the full workflow, the rules, and the debugging keys.

Feedback, bug reports and rooms you build with it are all welcome. I'd especially like to hear if anything in the README is unclear when you make your first room.

Cheers
« Last Edit: Today at 12:46:27 PM by robbo007 »




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

Page created in 0.037 seconds with 22 queries.