public override void PrintChar(int chr, bool ignoreCharsetMask) { // Indy3 / Zak256 / Loom int width, height, origWidth = 0, origHeight; VirtScreen vs; //const byte *charPtr; int is2byte = (chr >= 256 && Vm.UseCjkMode) ? 1 : 0; //assertRange(0, _curId, _vm->_numCharsets - 1, "charset"); if ((vs = Vm.FindVirtScreen(Top)) == null) { return; } if (chr == '@') { return; } var charPtr = new BinaryReader(new MemoryStream(_fontPtr)); charPtr.BaseStream.Seek(_charOffset + chr * 8, SeekOrigin.Begin); width = GetDrawWidthIntern(chr); height = GetDrawHeightIntern(chr); SetDrawCharIntern(chr); origWidth = width; origHeight = height; // Clip at the right side (to avoid drawing "outside" the screen bounds). if (Left + origWidth > Right + 1) { return; } if (_shadowMode) { width++; height++; } if (FirstChar) { Str.Left = Left; Str.Top = Top; Str.Right = Left; Str.Bottom = Top; FirstChar = false; } int drawTop = Top - vs.TopLine; Vm.MarkRectAsDirty(vs, Left, Left + width, drawTop, drawTop + height); if (!ignoreCharsetMask) { HasMask = true; TextScreen = vs; } if ((ignoreCharsetMask || !vs.HasTwoBuffers) && (Vm.Game.Platform != Platform.FMTowns)) { DrawBits1(vs.Surfaces[0], Left + vs.XStart, drawTop, charPtr, drawTop, origWidth, origHeight); } else { DrawBits1(Vm.TextSurface, Left, Top, charPtr, drawTop, origWidth, origHeight); } // if (is2byte) { // origWidth /= Vm.TextSurfaceMultiplier; // height /= _vm->_textSurfaceMultiplier; // } if (Str.Left > Left) { Str.Left = Left; } Left += origWidth; if (Str.Right < Left) { Str.Right = Left; if (_shadowMode) { Str.Right++; } } if (Str.Bottom < Top + height) { Str.Bottom = Top + height; } }
public override void PrintChar(int chr, bool ignoreCharsetMask) { VirtScreen vs; //ScummHelper.AssertRange(1, _curId, _vm._numCharsets - 1, "charset"); if ((vs = Vm.FindVirtScreen(Top)) == null && (vs = Vm.FindVirtScreen(Top + GetFontHeight())) == null) { return; } if (chr == '@') { return; } Vm.CharsetColorMap[1] = Color; if (!PrepareDraw(chr)) { return; } if (FirstChar) { Str.Left = 0; Str.Top = 0; Str.Right = 0; Str.Bottom = 0; } Top += _offsY; Left += _offsX; if (Left + _origWidth > Right + 1 || Left < 0) { Left += _origWidth; Top -= _offsY; return; } DisableOffsX = false; if (FirstChar) { Str.Left = Left; Str.Top = Top; Str.Right = Left; Str.Bottom = Top; FirstChar = false; } if (Left < Str.Left) { Str.Left = Left; } if (Top < Str.Top) { Str.Top = Top; } int drawTop = Top - vs.TopLine; Vm.MarkRectAsDirty(vs, Left, Left + _width, drawTop, drawTop + _height); // This check for kPlatformFMTowns and kMainVirtScreen is at least required for the chat with // the navigator's head in front of the ghost ship in Monkey Island 1 if (!ignoreCharsetMask || (Vm.Game.Platform == Platform.FMTowns && vs == Vm.MainVirtScreen)) { HasMask = true; TextScreen = vs; } PrintCharIntern(_fontPtr, _charPos, _origWidth, _origHeight, _width, _height, vs, ignoreCharsetMask); Left += _origWidth; if (Str.Right < Left) { Str.Right = Left; if (Vm.Game.Platform != Platform.FMTowns && _enableShadow) { Str.Right++; } } if (Str.Bottom < Top + _origHeight) { Str.Bottom = Top + _origHeight; } Top -= _offsY; }