ScummVM API documentation
EEM::Mystery Class Reference

#include <mystery.h>

Public Member Functions

bool load (uint num, class Common::RandomSource *rng=nullptr, bool macintosh=false)
 
void clear ()
 
bool isLoaded () const
 
bool usesCompactMacData () const
 
uint number () const
 
uint16 numSites () const
 
uint8 numSuspects () const
 
uint8 numCONSITEs () const
 
uint8 numCOFFSITEs () const
 
const byte * initBlock () const
 InitBlock (case briefing) at mystery + word[0].
 
const byte * galleryData () const
 
const byte * floppySuspectEntry (uint suspectIdx) const
 
const byte * noteIndex () const
 
uint16 noteIndexCount () const
 
uint noteSectionSize () const
 
bool noteHasNotebookText (uint clueId) const
 
const byte * kdTextIndex () const
 KDTextIndex; first u16s are TextBlock offsets for host hint lines.
 
const byte * hintBlock () const
 
uint16 aChain (uint i) const
 
uint16 hintChain (uint chainIdx, uint slot) const
 
const byte * mapEntry (uint siteNum) const
 MapData entry for siteNum: 14 bytes; first u16 = sitepic, +4..7 = (x, y).
 
const byte * siteIndexEntry (uint siteNum) const
 SiteIndex entry for siteNum (6 bytes per site on CD).
 
const byte * siteData (uint siteNum) const
 SiteData (sitepic, travel, hotspot count, ...) per SiteIndex[siteNum].
 
const byte * floppySiteAnimData (uint siteNum) const
 
const byte * hotspots (uint siteNum) const
 Hotspot rectangle array for siteNum (14 bytes each: x1,y1,x2,y2 + clue).
 
uint16 hotspotCount (uint siteNum) const
 
const char * textAt (uint16 offset) const
 NUL-terminated string at TextBlock + offset.
 
const byte * blobAt (uint32 offset) const
 
uint32 dataSize () const
 
void syncState (Common::Serializer &s)
 
int selectedPoints () const
 _GetSelectedPoints @ 1df2:00bd.
 
int foundPoints () const
 _GetFoundPoints @ 1df2:0098 — sum of top 5 found notebook entries.
 
bool solvedCheck () const
 
bool londonSolved () const
 
int minCluesRemaining () const
 
bool isGuilty (uint suspectIdx) const
 
uint16 alibiTextOffset (uint suspectIdx) const
 TextBlock offset of suspect's alibi text. 0xFFFF for guilty suspect.
 
const byte * solvedClueBlock () const
 

Public Attributes

uint8 _cluesFound [kCluesFoundCap] = {}
 Per-mystery runtime state, zeroed at load time.
 
uint8 _noteSelected [kCluesFoundCap] = {}
 
uint16 _hotSpotsSeen [kHotSpotsCap] = {}
 
uint16 _inGallery [kGalleryCap] = {}
 
uint8 _newOrder [kGalleryCap] = {}
 
uint16 _visitedSite [kVisitedSiteCap] = {}
 
uint16 _onSites [kVisitedSiteCap] = {}
 
bool _sawCOFFSITEs = false
 
bool _sawCONSITEs = false
 
uint8 _seenCOFFSITEs = 0
 
uint8 _seenCONSITEs = 0
 
bool _sawHelpHint = false
 
bool _solvedPuzzle = false
 
bool _firstTry = true
 
uint16 _searchLocationNumber = 0xFFFF
 
uint16 _siteNumber = 0xFFFF
 
uint16 _lastSite = 0xFFFF
 
uint16 _pendingSiteJump = 0
 
uint16 _siteReturnDepth = 0
 
uint16 _siteReturnStack [kVisitedSiteCap] = {}
 

Static Public Attributes

static const uint kNumChains = 3
 
static const uint kChainLen = 5
 
static const uint kCluesFoundCap = 100
 
static const uint kHotSpotsCap = 100
 
static const uint kGalleryCap = 5
 
static const uint kVisitedSiteCap = 20
 

Detailed Description

Mystery file M<n>.BIN. CD header layout from _ReadMystery @ 2404:008f: word[0] InitBlock offset word[2] MapData offset word[3] SiteIndex offset word[4] TextBlock offset word[5] NoteIndex offset word[6] GalleryData offset word[7] KDTextIndex offset word[8] SolvedClues offset word[9] HintBlock offset word[10] NumSites word[13] NumSuspects (low byte) word[14] NumCONSITEs word[15] NumCOFFSITEs word[16..20] AChain (5 words) word[21..25] BChain word[26..30] CChain

Member Function Documentation

◆ load()

bool EEM::Mystery::load ( uint  num,
class Common::RandomSource rng = nullptr,
bool  macintosh = false 
)

Load M<num>.BIN and reset per-mystery state. The Mac release stores cases in the indexed MysteryData container instead of loose files.

◆ galleryData()

const byte* EEM::Mystery::galleryData ( ) const

GalleryData. DOS CD uses 0x46-byte entries; floppy/Mac use compact variable-stride entries accessed through floppySuspectEntry().

◆ floppySuspectEntry()

const byte* EEM::Mystery::floppySuspectEntry ( uint  suspectIdx) const

Compact variable-stride suspect record for floppy/Mac. Returns nullptr on CD or out-of-range. Layout: u16 picID, u16 alibiMarker (0xFFFF=guilty), u8 count, count bytes of name/clue data.

◆ noteIndex()

const byte* EEM::Mystery::noteIndex ( ) const

NoteIndex array. EEM1 CD: 4 bytes/entry (u16 textOff + u16 pts). Floppy: 7 bytes/entry. EEM2/London CD: 2 bytes/entry.

◆ noteSectionSize()

uint EEM::Mystery::noteSectionSize ( ) const

Raw byte size of the CD NoteIndex section [_noteOffset, _galleryOffset). The notebook divides this by the variant stride (EEM1 4 / London 2) to get the clue count, since noteIndexCount() assumes the 4-byte stride.

◆ noteHasNotebookText()

bool EEM::Mystery::noteHasNotebookText ( uint  clueId) const

True when clueId has a notebook text entry. Floppy dialog records may be spoken-only with zero notebook offset, skipped by _DrawNotes_Floppy.

◆ hintBlock()

const byte* EEM::Mystery::hintBlock ( ) const

HintBlock (_KDHelp @ 1560:010a). Per-clue hint TextBlock offsets indexed by _aChain[i].

◆ aChain()

uint16 EEM::Mystery::aChain ( uint  i) const
inline

Entry i of the required-clue chain. Returns 0xFFFF when out of range. Walked by _KDHelp to find unfound clues for hints.

◆ hintChain()

uint16 EEM::Mystery::hintChain ( uint  chainIdx,
uint  slot 
) const
inline

Entry slot of hint chain chainIdx (0 = A, 1 = B, 2 = C; header words 16-20 / 21-25 / 26-30). EEM2 _DoKDHelp @ 15c1:020b walks all three chains × 5 slots; EEM1 _KDHelp only chain A slots 0..1.

◆ floppySiteAnimData()

const byte* EEM::Mystery::floppySiteAnimData ( uint  siteNum) const

Floppy ANI.BIN per-site animation block. Layout: u8 cycleCount, cycleCount x {u8 start, u8 end}, u8 animCount, animCount x {u8 animId, u16 x, u8 y}.

◆ blobAt()

const byte* EEM::Mystery::blobAt ( uint32  offset) const
inline

Pointer at byte offset within the mystery blob, or null if out of range. Used to chase ClueBlock pointers stored in hotspot data.

◆ londonSolved()

bool EEM::Mystery::londonSolved ( ) const

EEM2/London _SolvedCheck @ 1ea1:0b1a. London dropped EEM1's points model for set matching: the three hint chains (_aChain/_bChain/_cChain, = Ghidra g_dwSolveSet1..3, mystery header words 16/21/26) are the accepted answer sets of up to 5 clue ids. A set is satisfied when every slot is either 0xFFFF (wildcard / unused) or has its accuse-selected flag (_noteSelected, = g_awSelectedClue) set; the accusation is solved if ANY set is satisfied. An all-wildcard set is unused and never counts.

◆ minCluesRemaining()

int EEM::Mystery::minCluesRemaining ( ) const

EEM2/London _GetMinRemaining @ 1ea1:1056. Same three sets as londonSolved() but tested against _cluesFound (clues discovered in the world, = _CluesFound): returns the fewest clues still to find across the usable sets — 0 means a full answer set has been discovered and the accusation can begin. Returns 5 when no relevant clue has been found yet.

◆ isGuilty()

bool EEM::Mystery::isGuilty ( uint  suspectIdx) const

_WITCH @ 1df2:089f. GalleryData[i*0x46 + 0x02] == 0xFFFF marks the guilty suspect; innocent suspects store their alibi TextBlock offset.

◆ solvedClueBlock()

const byte* EEM::Mystery::solvedClueBlock ( ) const

Win-clueblock at MysteryIndex[+0x10] = _solvedOffset. Used by _DisplayCorrect @ 1df2:0769 (_DisplayClue(_Mystery + MysteryIndex[+0x10], 0)).


The documentation for this class was generated from the following file: