Exemplo n.º 1
0
        public bool FnAddHuman()
        {
            //reintroduce the mouse so that the human can control the player
            //could still be switched out at high-level

            if (Logic.ScriptVariables[Logic.MOUSE_STOP] == 0)
            {
                Logic.ScriptVariables[Logic.MOUSE_STATUS] |= 6; //cursor & mouse

                if (MouseY < 2)                                 //stop mouse activating top line
                {
                    MouseY = 2;
                }

                // TODO: _system.WarpMouse(_mouseX, _mouseY);

                //force the pointer engine into running a get-off
                //even if it's over nothing

                //KWIK-FIX
                //get off may contain script to remove mouse pointer text
                //surely this script should be run just in case
                //I am going to try it anyway
                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.SPECIAL_ITEM] = 0xFFFFFFFF;
                Logic.ScriptVariables[Logic.GET_OFF]      = Logic.RESET_MOUSE;
            }

            return(true);
        }
Exemplo 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;
            }
        }