Exemplo n.º 1
0
        public void Reset()
        {
            _hsyncCnt = 0;
            _capChargeStart = 0;
            _capCharging = false;
            _vblankEnabled = false;
            vblank_delay = 0;
            vblank_value = 0;
            _vsyncEnabled = false;
            _CurrentScanLine = 0;
            _audioClocks = 0;

            bus_state = 0;

             pf0_update = 0;
            pf1_update = 0;
            pf2_update = 0;
            pf0_updater = false;
            pf1_updater = false;
            pf2_updater = false;
            pf0_delay_clock = 0;
            pf1_delay_clock = 0;
            pf2_delay_clock = 0;
            pf0_max_delay = 0;
            pf1_max_delay = 0;
            pf2_max_delay = 0;

            enam0_delay = 0;
            enam1_delay = 0;
            enamb_delay = 0;
            enam0_val = false;
            enam1_val = false;
            enamb_val = false;

            p0_stuff = false;
            p1_stuff = false;
            m0_stuff = false;
            m1_stuff = false;
            b_stuff = false;

            HMP0_delay = 0;
            HMP0_val = 0;
            HMP1_delay = 0;
            HMP1_val = 0;

            prg0_delay = 0;
            prg1_delay = 0;
            prg0_val = 0;
            prg1_val = 0;

            do_ticks = false;

            _player0 = new PlayerData();
            _player1 = new PlayerData();
            _playField = new PlayfieldData();
            _hmove = new HMoveData();
            _ball = new BallData();

            _player0.ScanCnt = 8;
            _player1.ScanCnt = 8;
        }
Exemplo n.º 2
0
        public override void ExecuteCommand(ICharacter character, Identity target, string[] args)
        {
            var proxies = TeleportDao.Instance.GetAll();
            List <StatelData> statels   = new List <StatelData>();
            Function          lastFound = null;

            foreach (PlayfieldData pf in PlayfieldLoader.PFData.Values)
            {
                bool isProxy = false;
                foreach (StatelData sd in pf.Statels)
                {
                    lastFound = null;
                    isProxy   = false;
                    if (sd.Events.Count > 0)
                    {
                        foreach (Event e in sd.Events)
                        {
                            foreach (Function f in e.Functions)
                            {
                                if (f.FunctionType == (int)FunctionType.TeleportProxy)
                                {
                                    isProxy   = true;
                                    lastFound = f;
                                    if (f.Arguments.Values[1].AsInt32() < 0)
                                    {
                                        lastFound = null;
                                        isProxy   = false;
                                    }
                                    break;
                                }
                            }
                            if (isProxy)
                            {
                                break;
                            }
                        }
                    }
                    if (isProxy)
                    {
                        if (
                            !proxies.Any(
                                x =>
                                (x.statelType == (int)sd.Identity.Type) &&
                                (x.statelInstance == (uint)sd.Identity.Instance) &&
                                (x.playfield == sd.PlayfieldId)))
                        {
                            PlayfieldData dest = PlayfieldLoader.PFData[lastFound.Arguments.Values[1].AsInt32()];
                            if (dest.Statels.Count(x => x.Identity.Type == IdentityType.Door) == 1)
                            {
                                StatelData sddest = dest.Statels.First(x => x.Identity.Type == IdentityType.Door);
                                DBTeleport tel    = new DBTeleport();
                                tel.playfield            = sd.PlayfieldId;
                                tel.statelType           = 0xc748; // Door only for now
                                tel.statelInstance       = (uint)sd.Identity.Instance;
                                tel.destinationPlayfield = sddest.PlayfieldId;
                                tel.destinationType      = (int)sddest.Identity.Type;
                                tel.destinationInstance  = BitConverter.ToUInt32(BitConverter.GetBytes(sddest.Identity.Instance), 0);
                                var temp = TeleportDao.Instance.GetWhere(new { tel.playfield, tel.statelType, tel.statelInstance });
                                foreach (var t in temp)
                                {
                                    TeleportDao.Instance.Delete(t.Id);
                                }
                                TeleportDao.Instance.Add(tel);
                                isProxy = false;
                            }
                        }
                    }


                    if (isProxy)
                    {
                        // Check against proxies already found
                        if (
                            !proxies.Any(
                                x =>
                                (x.statelType == (int)sd.Identity.Type) &&
                                (x.statelInstance == (uint)sd.Identity.Instance) && (x.playfield == sd.PlayfieldId)))
                        {
                            PlayfieldData dest  = PlayfieldLoader.PFData[lastFound.Arguments.Values[1].AsInt32()];
                            StatelData    door1 = null;
                            if (dest.Statels.Count(x => x.Identity.Type == IdentityType.Door) > 0)
                            {
                                door1 = dest.Statels.First(x => x.Identity.Type == IdentityType.Door);
                                LogUtil.Debug(DebugInfoDetail.Error, sd.PlayfieldId + " " + sd.Identity.ToString());
                                character.Stats[StatIds.externaldoorinstance].BaseValue      = (uint)sd.Identity.Instance;
                                character.Stats[StatIds.externalplayfieldinstance].BaseValue = (uint)sd.PlayfieldId;
                                character.Playfield.Teleport(
                                    (Dynel)character,
                                    new Coordinate(door1.X, door1.Y + 1.0f, door1.Z),
                                    character.Heading,
                                    new Identity()
                                {
                                    Type = (IdentityType)lastFound.Arguments.Values[0].AsInt32(), Instance = door1.PlayfieldId
                                });
                                return;
                            }
                            LogUtil.Debug(DebugInfoDetail.Error, sd.PlayfieldId + " " + sd.Identity.ToString());
                            character.Stats[StatIds.externaldoorinstance].BaseValue      = 0;
                            character.Stats[StatIds.externalplayfieldinstance].BaseValue = 0;
                            character.Playfield.Teleport(
                                (Dynel)character,
                                new Coordinate(sd.X, sd.Y, sd.Z),
                                character.Heading,
                                new Identity()
                            {
                                Type = IdentityType.Playfield, Instance = sd.PlayfieldId
                            });
                            return;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
		public void Reset()
		{
			_hsyncCnt = 0;
			_capChargeStart = 0;
			_capCharging = false;
			_vblankEnabled = false;
			_vsyncEnabled = false;
			_CurrentScanLine = 0;
			_audioClocks = 0;

			_player0 = new PlayerData();
			_player1 = new PlayerData();
			_playField = new PlayfieldData();
			_hmove = new HMoveData();
			_ball = new BallData();

			_player0.ScanCnt = 8;
			_player1.ScanCnt = 8;
		}
Exemplo n.º 4
0
        public void Reset()
        {
            _hsyncCnt        = 0;
            _capChargeStart  = 0;
            _capCharging     = false;
            _vblankEnabled   = false;
            _vblankDelay     = 0;
            _vblankValue     = 0;
            _vsyncEnabled    = false;
            _currentScanLine = 0;
            AudioClocks      = 0;

            BusState = 0;

            _pf0Update     = 0;
            _pf1Update     = 0;
            _pf2Update     = 0;
            _pf0Updater    = false;
            _pf1Updater    = false;
            _pf2Updater    = false;
            _pf0DelayClock = 0;
            _pf1DelayClock = 0;
            _pf2DelayClock = 0;
            _pf0MaxDelay   = 0;
            _pf1MaxDelay   = 0;
            _pf2MaxDelay   = 0;

            _enam0Delay = 0;
            _enam1Delay = 0;
            _enambDelay = 0;
            _enam0Val   = false;
            _enam1Val   = false;
            _enambVal   = false;

            _p0Stuff = false;
            _p1Stuff = false;
            _m0Stuff = false;
            _m1Stuff = false;
            _bStuff  = false;

            _hmp0Delay = 0;
            _hmp0Val   = 0;
            _hmp1Delay = 0;
            _hmp1Val   = 0;

            _prg0Delay = 0;
            _prg1Delay = 0;
            _prg0Val   = 0;
            _prg1Val   = 0;

            _doTicks = false;

            _player0   = new PlayerData();
            _player1   = new PlayerData();
            _playField = new PlayfieldData();
            _hmove     = new HMoveData();
            _ball      = new BallData();

            _player0.ScanCnt = 8;
            _player1.ScanCnt = 8;
        }