NScumm.Scumm.ScummEngine2.RedrawV2Inventory C# (CSharp) Метод

RedrawV2Inventory() приватный Метод

private RedrawV2Inventory ( ) : void
Результат void
        void RedrawV2Inventory()
        {
            var vs = VerbVirtScreen;
            int i;
            int max_inv;
            Rect inventoryBox;
            int inventoryArea = /*(Game.Platform == Platform.NES) ? 48:*/ 32;
            int maxChars = /*(Game.Platform == Platform.NES) ? 13:*/ 18;

            _mouseOverBoxV2 = -1;

            if (!_userState.HasFlag(UserStates.IFaceInventory))  // Don't draw inventory unless active
                return;

            // Clear on all invocations
            inventoryBox.Top = vs.TopLine + inventoryArea;
            inventoryBox.Bottom = vs.TopLine + vs.Height;
            inventoryBox.Left = 0;
            inventoryBox.Right = vs.Width;
            RestoreBackground(inventoryBox);

            String[1].Charset = 1;

            max_inv = GetInventoryCountCore(Variables[VariableEgo.Value]) - _inventoryOffset;
            if (max_inv > 4)
                max_inv = 4;
            for (i = 0; i < max_inv; i++)
            {
                int obj = FindInventoryCore(Variables[VariableEgo.Value], i + 1 + _inventoryOffset);
                if (obj == 0)
                    break;

                String[1].Position = new Point(_mouseOverBoxesV2[i].rect.Left,
                    _mouseOverBoxesV2[i].rect.Top + vs.TopLine);
                String[1].Right = (short)(_mouseOverBoxesV2[i].rect.Right - 1);
                String[1].Color = _mouseOverBoxesV2[i].color;

                byte[] tmp = GetObjectOrActorName(obj);

                // Prevent inventory entries from overflowing by truncating the text
                byte[] msg = new byte[20];
                msg[maxChars] = 0;
                Array.Copy(tmp, msg, Math.Min(tmp.Length, maxChars));

                // Draw it
                DrawString(1, msg);
            }


            // If necessary, draw "up" arrow
            if (_inventoryOffset > 0)
            {
                String[1].Position = new Point(
                    _mouseOverBoxesV2[InventoryUpArrow].rect.Left,
                    _mouseOverBoxesV2[InventoryUpArrow].rect.Top + vs.TopLine);
                String[1].Right = (short)(_mouseOverBoxesV2[InventoryUpArrow].rect.Right - 1);
                String[1].Color = _mouseOverBoxesV2[InventoryUpArrow].color;
                /*if (_game.platform == Common::kPlatformNES)
                    drawString(1, (const byte *)"\x7E");
                else*/
                DrawString(1, new byte[] { (byte)' ', 1, 2 });
            }

            // If necessary, draw "down" arrow
            if (_inventoryOffset + 4 < GetInventoryCountCore(Variables[VariableEgo.Value]))
            {
                String[1].Position = new Point(
                    _mouseOverBoxesV2[InventoryDownArrow].rect.Left,
                    _mouseOverBoxesV2[InventoryDownArrow].rect.Top + vs.TopLine);
                String[1].Right = (short)(_mouseOverBoxesV2[InventoryDownArrow].rect.Right - 1);
                String[1].Color = _mouseOverBoxesV2[InventoryDownArrow].color;
                /*if (Game.Platform == Platform.NES)
                    DrawString(1, "\x7F");/
                else*/
                DrawString(1, new byte[] { (byte)' ', 3, 4 });
            }
        }
ScummEngine2