Opened 8 months ago

Last modified 24 hours ago

#15049 new feature request

FREESCAPE: DOS/CGA render mode need work

Reported by: neuromancer Owned by: neuromancer
Priority: normal Component: Engine: Freescape
Version: Keywords:
Cc: Game:

Description

The DOS/CGA rendering mode in Freescape games need a good amount of work to match their original implementations. A few important points:

  • The palette selection is made manually using an C++ array, while it is likely to be contained in some table in the executables.
  • Flashing colors are not correct, the information should be there, but it is unclear where.

Attachments (1)

scummvm-darkside-00001.png (47.8 KB ) - added by neuromancer 3 weeks ago.

Download all attachments as: .zip

Change History (6)

comment:1 by shdon, 3 weeks ago

The palette selection is made using a very basic check. From disassembling the DRILLC.EXE, I find this code:

mov ah, 0B
mov bx, 0100
test byte ptr ds:[1E5F], 01
jne $+1
inc bx
int 10

This is a call to INT 10h AH=0B BH=01 which selects the palette according to what is in BL (if BL=0 it sets black/green/red/brown, if BL=1 it sets black/cyan/magenta/grey). The determining factor is whether the byte at offset [1E5F] is odd or even. For even values, palette 1 is used; for odd values, palette 0 is used. The byte at offset [1E5F] is the room ID. So basically, rooms with an odd room ID use red/green/brown and rooms with an even room ID use cyan/magenta/grey.

by neuromancer, 3 weeks ago

Attachment: scummvm-darkside-00001.png added

comment:2 by neuromancer, 3 weeks ago

Thanks a lot for the missing information. One additional anomaly that I noted is related with the color of the objects. In Dark Side, the expected palette will not match the original implementation. This is an screenshot of the first level:

https://cdn.mobygames.com/screenshots/3527727-dark-side-dos-in-game-cga.png

I have attached a screenshot of same view in ScummVM. You can see some objects have different colors. It is unclear where is the issue, but it could be related with some bug in fillColorPairArray.

comment:3 by shdon, 3 weeks ago

That is because of the hardcoded stipple patterns. Freescape defines its own dither patterns with their colour selections in the palette section of the database header (the same part that remaps the EGA and Tandy palettes). In Driller, some are checkerboards, some are staggered, and one of them is in the shape of a letter Y.

comment:4 by neuromancer, 3 weeks ago

Just to clarify, stipple patterns should be already supported, but the code could have some issues. For instance, for Dark Side (CGA), we have:

Color map:
0
0
0
0
---
ff
ff
ff
ff
---
aa
aa
aa
aa
---
55
55
55
55
---
22
88
22
88
---
33
cc
33
cc
---
11
44
11
44
---
bb
ee
bb
ee
---
99
66
99
66
---
dd
77
dd
77
---
88
22
88
22
---
cc
33
cc
33
---
ee
bb
ee
bb
---
44
11
44
11
---
fe
fe
fe
fe
---

They are loaded here: https://github.com/scummvm/scummvm/blob/master/engines/freescape/loaders/8bitBinaryLoader.cpp#L806-L827

and then they are parsed into pixel patterns here: https://github.com/scummvm/scummvm/blob/master/engines/freescape/gfx.cpp#L137-L231. But it is unclear why the rendering fails to match

comment:5 by neuromancer, 24 hours ago

Type: defectfeature request
Note: See TracTickets for help on using tickets.