Esempio n. 1
0
        private void ButtonEngine1()
        {
            //checks for clicking on special item
            //"compare the size of this routine to S1 mouse_button"

            if (_mouseB != 0)
            {
                //anything pressed?
                Logic.ScriptVariables[Logic.BUTTON] = _mouseB;
                if (Logic.ScriptVariables[Logic.SPECIAL_ITEM] != 0)
                {
                    //over anything?
                    var item = _skyCompact.FetchCpt((ushort)Logic.ScriptVariables[Logic.SPECIAL_ITEM]);
                    if (item.Core.mouseClick != 0)
                    {
                        Logic.MouseScript(item.Core.mouseClick, item);
                    }
                }
            }
        }
Esempio n. 2
0
        private void PointerEngine(ushort xPos, ushort yPos)
        {
            UShortAccess currentList;
            var          currentListNum = Logic.ScriptVariables[Logic.MOUSE_LIST_NO];

            do
            {
                currentList = new UShortAccess(_skyCompact.FetchCptRaw((ushort)currentListNum), 0);
                while ((currentList[0] != 0) && (currentList[0] != 0xFFFF))
                {
                    var itemNum  = currentList[0];
                    var itemData = _skyCompact.FetchCpt(itemNum);
                    currentList.Offset += 2;
                    if ((itemData.Core.screen == Logic.ScriptVariables[Logic.SCREEN]) &&
                        ((itemData.Core.status & 16) != 0))
                    {
                        if (itemData.Core.xcood + itemData.Core.mouseRelX > xPos)
                        {
                            continue;
                        }
                        if (itemData.Core.xcood + itemData.Core.mouseRelX + itemData.Core.mouseSizeX < xPos)
                        {
                            continue;
                        }
                        if (itemData.Core.ycood + itemData.Core.mouseRelY > yPos)
                        {
                            continue;
                        }
                        if (itemData.Core.ycood + itemData.Core.mouseRelY + itemData.Core.mouseSizeY < yPos)
                        {
                            continue;
                        }
                        // we've hit the item
                        if (Logic.ScriptVariables[Logic.SPECIAL_ITEM] == itemNum)
                        {
                            return;
                        }
                        Logic.ScriptVariables[Logic.SPECIAL_ITEM] = itemNum;
                        if (Logic.ScriptVariables[Logic.GET_OFF] != 0)
                        {
                            Logic.MouseScript(Logic.ScriptVariables[Logic.GET_OFF], itemData);
                        }
                        Logic.ScriptVariables[Logic.GET_OFF] = itemData.Core.mouseOff;
                        if (itemData.Core.mouseOn != 0)
                        {
                            Logic.MouseScript(itemData.Core.mouseOn, itemData);
                        }
                        return;
                    }
                }
                if (currentList[0] == 0xFFFF)
                {
                    currentListNum = currentList[1];
                }
            } while (currentList[0] != 0);

            if (Logic.ScriptVariables[Logic.SPECIAL_ITEM] != 0)
            {
                Logic.ScriptVariables[Logic.SPECIAL_ITEM] = 0;

                if (Logic.ScriptVariables[Logic.GET_OFF] != 0)
                {
                    Logic.Script((ushort)Logic.ScriptVariables[Logic.GET_OFF], (ushort)(Logic.ScriptVariables[Logic.GET_OFF] >> 16));
                }
                Logic.ScriptVariables[Logic.GET_OFF] = 0;
            }
        }