Beispiel #1
0
 private void AutoFire3D()
 {
     if ((_player3D.ChargeCtr <= 1) && ((_player3D.State == 0) || (_player3D.BreachCtr != 0)))
     {
         Joy.Set("B", true, 1);
     }
     else if (_player3D.ChargeCtr > 1)
     {
         Joy.Set("B", false, 1);
     }
     Joy.Set("C", (_levelTime & 1) == 0, 1);
 }
        public override void PreFrameCallback()
        {
            Gui.ClearText();
            if (!Gui.HasGUISurface)
            {
                Gui.DrawNew("emu");
            }
            _camX = Mem.ReadS16(Addr2D.CamX) - _left;
            _camY = Mem.ReadS16(Addr2D.CamY) - _top;
            switch (Mem.ReadU8(AddrGlobal.GameMode))
            {
            // Dialog screen
            case 0x00:
                if (_autofireEnabled)
                {
                    // This doesn't fully work, but gets > 50%
                    if (Mem.ReadS16(AddrGlobal.TextYSpeed) == -3)
                    {
                        Joy.Set("C", true, 1);
                    }
                    else
                    {
                        Joy.Set("C", false, 1);
                    }
                }
                break;

            case 0xF6:
                UpdatePlayer3D();
                if (_autofireEnabled)
                {
                    AutoFire3D();
                }
                break;

            case 0x20:
            case 0x28:
            case 0xAC:
                UpdatePlayer2D();
                if (_autofireEnabled)
                {
                    AutoFire2D();
                }
                break;

            default:
                break;
            }
            if (!_mapDumpingEnabled || (_mapDumpState == 0))
            {
                Color bg = BackdropColor();
                Gui.DrawRectangle(0, 0, _left + 320 + _right, _top, bg, bg);
                Gui.DrawRectangle(0, 0, _left, _top + 224 + _bottom, bg, bg);
                Gui.DrawRectangle(_left + 320, 0, _left + 320 + _right, _top + 224 + _bottom, bg, bg);
                Gui.DrawRectangle(0, _top + 224, _left + 320 + _right, _top + 224 + _bottom, bg, bg);
            }
            switch (Mem.ReadU8(AddrGlobal.GameMode))
            {
            case 0x20:
            case 0x28:
            case 0xAC:
                if (_mapDumpState <= 1)
                {
                    Draw2DHud();
                }
                if (_mapDumpingEnabled)
                {
                    PreProcessMapDump();
                }
                break;

            case 0xF6:
                Draw3DHud();
                break;

            default:
                break;
            }
            _prevF = Mem.ReadU32(AddrGlobal.NonLagFrameCount);
        }