Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Entities and how they relate

The game's data model

                         gameState (0xae05 bytes: the saved game)
                              │
        ┌─────────────────────┼──────────────────────────────┐
        │                     │                              │
   Party ───────────┐    records (16)                  sceneFlags / puzzleLevels
   count             │    (group, level, date)          (per-scene progress)
   Traveller[32]     │
        │            │
        │ 1 : 1      │ waitingParties / savedParty (camps, isle)
        ▼            ▼
   Traveller ──features──▶ hair, eyes, nose, feet (1-5 each: 625 kinds)
        │  place, onboard, name
        │
        │ one per Traveller, created by each scene when it opens
        ▼
     Snoid  (a View's body + more: 0x103 bytes)
        │  layers[16]: images chosen from the feature tables
        │  path / pathIndex: where it is walking on NODE/PATH tables
        │  action, pose, facingLeft, chosen (in the party), idleTicks
        ▼
     View ──────────────▶ ViewBody: cels[24], script, frame, group, clip
        │  draw / update / notify / placed callbacks
        │  prev / next: the view list (viewHead … viewTail), drawn back to front
        ▼
     Script (SCRB / SCRS from a Mohawk archive) ──events──▶ notify(view, event)
   Scene ── open / close / frame / key ──▶ owns its views, its scripts, its image banks,
     │                                      its sounds, and one GroupList of input items
     │
     ├── GroupList ─ Group ─ InputItem[]    on-screen controls (focus.cpp)
     ├── SceneButton[]                     (the same items, with their rectangles)
     └── puzzle state                      FeatureRule(s), level tables, counters

Type reference

TypeDefined inWhat it is
Scenezoombinis.h{open, close, frame, unknownC, key}: five callbacks. scenes[22] is the table.
View, ViewBody, ViewCelzoombinis.han animated thing; see Game layer
Snoidzoombinis.ha Zoombini's view body: features, layers, path, action, pose, name
Traveller, Partyzoombinis.ha Zoombini on the journey and the group of them (19 bytes; 0x266 bytes)
CampSlot, Campzoombinis.ha stored Zoombini and the camp's 625 slots with their scroll row
FeatureRule, FeatureRuleszoombinis.ha puzzle's rule(s) about features: which side, how many features, which values (bridge, tunnels)
ImageBankzoombinis.himages in one block: count and each one's offset (from 1)
InputItem, Group, GroupList, InputHandlerszoombinis.hthe focus system's items, groups and callbacks
SceneButtonzoombinis.ha button's rectangle plus 0x1c bytes of focus-system fields
SavedGame, SavedGameListzoombinis.hthe saved-game list's entries
SoundEntry, SoundChannel, SoundChannelszoombinis.hloaded sounds, the four channels per type, and the sounds views asked for in an update
Wipe, Blindszoombinis.hscreen transitions in progress
DisplayMode, MemoryInfozoombinis.hwhat WinMain asks of the display and learns of memory
Rect, ShortRect, Point, Colorzoombinis.hthe engine's QuickDraw-style value types, as the game's calls show them

Ownership and lifetime

  • A scene creates its views, groups and resources in open… and destroys them in close…. clearViews/removeDeadViews/closeViews free views; freeScripts, freeFeatureGroups, unloadSounds free the rest. Scenes keep view ids in globals (not pointers) and look them up with findView, so a view can be deleted underneath them safely.
  • A Snoid is part of its view: viewSnoid(view) casts the view's body, snoidView(snoid) goes back (-0x30).
  • Resources are loaded through the engine's resource manager as handles that the game locks while in use and the engine may purge; archives are opened per scene (openGameFile(&hotelFile, "Hotel.MHK")) and closed when it closes.
  • A party is value data in gameState; scenes copy it into travellers and write back.

Pairs and groups of views

Several puzzles move views together: groupViews(a…f) sets a shared group (1-16) so a script's motion applies to all, pairViews(a, b) links two. The camp's and the book's second input groups hold campAreaItems and bookAreaItems, the areas Zoombinis are dragged onto.