Week 9

This week I have been reversing action and inventory systems.

 

Action system

There are 7 action types:

  • LOOK
  • WALK
  • USE
  • TAKE
  • TALK
  • OBJUSE(HERO 1)
  • OBJUSE(HERO 2)

All of them are processed using opcodes.

Inventory in this engine is array of item IDs.

There are 3 opcodes for inventory:

  • ADDINV – adds new item
  • DELINV – deletes item
  • SETINV – replaces the current item with another

The item id is then used to show the item sprite and used in OBJUSE handler.

This screenshot shows the fixed font rendering along with star object, which is used for choosing action type.

There is only left to reverse InterfaceSequence(don’t know for what it is used) and walking system.

Considering code I need to clean it, end what hasn’t been transfered from disassembly and prepare engine for merging.

Week 8

This week I have been reversing text classes in Red Comrades engine.

 

Although, the text doesn’t render properly for now. There is a problem with font. It seems that ScummVm’s fonts don’t support cyrillic letters.

The engine consists of 4 text classes:

  • QText
  • QTextDescription
  • QTextChoice
  • QTextPhrase

QText is a base class for other classes.

QTextDescription is used to render text about item.

QTextChoice is used to make choice.

QTextPhrase is used for dialogs. It monitors the sound and notifies dialog manager when sound ends.

The text in game is stored in Windows 1251 codepage. I have used the converting funtion which I had written last year for Pink Panther engine.

I have also polished dialog manager, so the intro can be continued.  However, intro is bugged because heroes are not implemented. So they are not rendered and walk is skipped.

The plan for next week is to fix the problem with font if possible, start to implement heroes, and reverse the inventory.

Week 7

This week I have spent all time reversing dialogs bytecode format.

I have almost reversed and implemented it.

Let’s look at opcode format.

The opcodes in dialog format have size of 4 bytes. 

There are at least 10 opcodes:

  • BREAK
  • MENU
  • GOTO
  • MENURET
  • 0x05
  • RETURN
  • PLAY
  • CIRCLE
  • 0x09
  • 0xA

For example, PLAY opcode contains index of struct which contains speaker id, sound  name and subtitle. The engine executes this opcode and when the sound ends the next opcode is executed.

For now the only thing that I doesn’t understand why the file with dialogs contains data which is not used. But I assume this was used to display some useful info for developers.

Small video showing the current state of first game scene.

The next week I plan to implement drawing subtitles and polish dialogs, so that intro dialog in first game scene can be continued.

Week 6

This week I have fully implemented demo and started reversing dialogs.

 

Earlier the demo had problem with rendering 1-bit monochrome bitmaps because ScummVm doesn’t support them, I have made a little hack. All 1-bitmaps in those games are black, so instead of implemeting support for them the engine creates black surface.

The second problem was that some scripts hadn’t worked properly. This was due to handlers which had more than one PLAY opcode. When the PLAY opcode executes, the opcodes after it should wait. After animation ends END opcode is sended to object and it continues executing opcodes after PLAY.  The same algo is used when walk opcodes are used.

Also, this week I have added support for 5 new opcodes:

  1. PASSIVE
  2. ACTIVE
  3. SHOW
  4. HIDE
  5. SETPOS

Now, the first game scene can execute startup scripts without dialogs.

Dialogs in game are the most complicated part. They are using bytecode.

I have fully reversed file format where dialogs text with sounds are stored.

The format is pretty simple and standard. The only trick is that strings are stored at the end of file rather than as pascal string. The same trick is used in the game archives.

This is structure of the file where the bytecode is stored. Each object in the game can have dialogues handlers which are selected by message opcode which was sended to them. These can be obj use, taking item, etc.

The bytecode part isn’t known to me. I only know that each code has 4 bytes and first byte seems to indicate kind of operation.