Exemplo n.º 1
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public override State Execute(Hovertank hovertank)
 {
     return hovertank.CheckKeysDebugKeysDebugMemory1();
 }
Exemplo n.º 2
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public abstract State Execute(Hovertank hovertank);
Exemplo n.º 3
0
        /// <summary>Initialises the string replacement system.</summary>
        /// <param name="hovertank">The hovertank game.</param>
        public void Initialise(Hovertank hovertank)
        {
            _replacements = new string[Strings.Count];

            Array.Copy(_originalStrings, _replacements, _originalStrings.Length);

            for(int i = 0; i < hovertank.levnames.Length; i++)
                _replacements[Strings.levnames(i)] = hovertank.levnames[i];

            for(int i = 0; i < hovertank.levtext.Length; i++)
                _replacements[Strings.levtext(i)] = hovertank.levtext[i];
        }
Exemplo n.º 4
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public override State Execute(Hovertank hovertank)
 {
     return hovertank.InputInt2();
 }
Exemplo n.º 5
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public override State Execute(Hovertank hovertank)
 {
     return hovertank.Intro7();
 }
Exemplo n.º 6
0
            /// <summary>Initialises the state.</summary>
            /// <param name="hovertank">The hover tank engine.</param>
            /// <param name="nextState">The state that will be set when PGet completes.</param>
            public void Initialise(Hovertank hovertank, State nextState)
            {
                oldx = (short) hovertank.px;

                hovertank.ClearKeys();

                _nextState = nextState;
            }
Exemplo n.º 7
0
            /// <summary>Executes the state.</summary>
            /// <param name="hovertank">The hover tank game.</param>
            /// <returns>The next state to set or null.</returns>
            public override State Execute(Hovertank hovertank)
            {
                State nextState = null;

                if(_decisionIndex != _decisions.Count - 1)
                {
                    hovertank.CenterWindow(_width, _height);

                    Decision decision = _decisions[_decisionIndex + 1];
                    switch(decision)
                    {
                        case Decision.None:
                            nextState = _nextState;
                            break;

                        case Decision.ExpWin:
                            _width += 2;
                            _height += 2;
                            break;

                        case Decision.ExpWinH:
                            _width += 2;
                            break;

                        case Decision.ExpWinV:
                            _height += 2;
                            break;
                    }
                }

                _decisionIndex--;

                if(nextState == null)
                {
                    // WaitVBL(1);
                    hovertank._stateWaitVBL.Initialise(hovertank, 1, hovertank._stateExpWin);
                    nextState = hovertank._stateWaitVBL;
                }

                return nextState;
            }
Exemplo n.º 8
0
            /// <summary>Initialises the state.</summary>
            /// <param name="hovertank">The hover tank engine.</param>
            public void Initialise(Hovertank hovertank)
            {
                sx = 160;
                sy = 180;

                /*
                =============================================================================

                          SCALED PICTURE DIRECTOR

                =============================================================================
                */

                float minz = (float) (Math.Cos(MAXANGLE) * RADIUS); // closest point
                minz += DISTANCE;
                sizescale = 256 * minz; // closest point will be full size
                float ytop = 80 - (PICHEIGHT / 2) * (sizescale / DISTANCE) / 256;
                float z = sizescale / (DISTANCE * 256);
                ytop = ytop / z; // world coordinates
                worldycenter = ytop - RADIUS;
                float xmid = (float) (Math.Sin(MAXANGLE) * RADIUS / 2);
                worldxcenter = -xmid;

                f = 1;
                page = 0;
                hovertank.inttime = 0;
                hovertank.screenofs = 0;
                pagewidth[0] = 0;
                pagewidth[1] = 0;
            }
Exemplo n.º 9
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public override State Execute(Hovertank hovertank)
 {
     return hovertank.Victory7();
 }
Exemplo n.º 10
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public override State Execute(Hovertank hovertank)
 {
     return hovertank.PlayGameLevelSelect2();
 }
Exemplo n.º 11
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public override State Execute(Hovertank hovertank)
 {
     return hovertank.BaseScreen8();
 }
Exemplo n.º 12
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public override State Execute(Hovertank hovertank)
 {
     return hovertank.PlayLoop2();
 }
Exemplo n.º 13
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public override State Execute(Hovertank hovertank)
 {
     return hovertank.CheckKeysQuit2();
 }
Exemplo n.º 14
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public override State Execute(Hovertank hovertank)
 {
     return hovertank.CheckKeysDebugKeysLevelWarp2();
 }
Exemplo n.º 15
0
            /// <summary>Executes the state.</summary>
            /// <param name="hovertank">The hover tank game.</param>
            /// <returns>The next state to set or null.</returns>
            public override State Execute(Hovertank hovertank)
            {
                if(hovertank.NBKscan > 127)
                {
                    hovertank.NBKscan &= 0x7f;
                    return _nextState;
                }

                ControlStruct c = hovertank.ControlPlayer(1);

                if(c.button1 || c.button2)
                    return _nextState;

                return null;
            }
Exemplo n.º 16
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public override State Execute(Hovertank hovertank)
 {
     return hovertank.GameOver6();
 }
Exemplo n.º 17
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public override State Execute(Hovertank hovertank)
 {
     return hovertank.WarpEffect4();
 }
Exemplo n.º 18
0
            /// <summary>Executes the state.</summary>
            /// <param name="hovertank">The hover tank game.</param>
            /// <returns>The next state to set or null.</returns>
            public override State Execute(Hovertank hovertank)
            {
                State nextState;
                if(i > 2)
                {
                    hovertank.FadeUpdate(i);

                    hovertank._stateWaitVBL.Initialise(hovertank, 6, this);
                    nextState = hovertank._stateWaitVBL;

                    i--;
                }
                else
                {
                    nextState = _nextState;
                }
                return nextState;
            }
Exemplo n.º 19
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public override State Execute(Hovertank hovertank)
 {
     return hovertank.PGet3();
 }
Exemplo n.º 20
0
 /// <summary>Initialises the state.</summary>
 /// <param name="hovertank">The hover tank engine.</param>
 /// <param name="number">The number of VBLs to wait for.</param>
 /// <param name="nextState">The state that will be set when WaitVBL completes.</param>
 public void Initialise(Hovertank hovertank, ushort number, State nextState)
 {
     hovertank.verticalBlank = false;
     _i = 0;
     _number = number;
     _nextState = nextState;
 }
Exemplo n.º 21
0
 /// <summary>Initialises the state.</summary>
 /// <param name="hovertank">The hover tank engine.</param>
 /// <param name="max">The maximum number of characters that can be entered.</param>
 /// <param name="nextState">The state that will be set when InputInt completes.</param>
 public void Initialise(Hovertank hovertank, short max, State nextState)
 {
     _string.Length = 0;
     this.max = max;
     pxt[0] = hovertank.px;
     count = 0;
     _nextState = nextState;
 }
Exemplo n.º 22
0
            /// <summary>Executes the state.</summary>
            /// <param name="hovertank">The hover tank game.</param>
            /// <returns>The next state to set or null.</returns>
            public override State Execute(Hovertank hovertank)
            {
                if(hovertank.verticalBlank)
                    _i++;

                return (_i < _number ? null : _nextState);
            }
Exemplo n.º 23
0
        /// <summary>The Intro() method - part 3.</summary>
        /// <param name="hovertank">The hover tank game.</param>
        /// <returns>The next state to set or null.</returns>
        private State Intro3(Hovertank hovertank)
        {
            _stateIntro2.page ^= 1;
            screenofs = (ushort) (0x4000 * _stateIntro2.page);

            if(_stateIntro2.f < NUMFRAMES)
            {
                _stateIntro2.f += (short) inttime;
                if(_stateIntro2.f > NUMFRAMES)
                    _stateIntro2.f = (short) NUMFRAMES;
            }
            else
            {
                _stateIntro2.f++; // last frame is shown
            }

            if(NBKscan > 0x7f)
            {
                // break;
                goto while_break;
            }

            if(_stateIntro2.f <= NUMFRAMES)
                return _stateIntro2;

        while_break:

            if(hovertank._sys.SimulateIntroSound) // as: Intro sound stops when a key is pressed
                hovertank._sfxPlayer.StopSound();

            _sys.nosound();

            _stateIntro4.Initialise();
            return _stateIntro4;
        }
Exemplo n.º 24
0
            /// <summary>Initialises the state.</summary>
            /// <param name="hovertank">The hover tank engine.</param>
            /// <param name="crtc">The crtc parameter value.</param>
            /// <param name="pel">The pel parameter value.</param>
            /// <param name="nextState">The state that will be set when SetScreen completes.</param>
            public void Initialise(Hovertank hovertank, ushort crtc, ushort pel, State nextState)
            {
                hovertank.verticalBlank = false; // as: Wait for next VBL

                _crtc = crtc;
                _pel = pel;
                _nextState = nextState;
            }
Exemplo n.º 25
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public override State Execute(Hovertank hovertank)
 {
     return hovertank.DemoLoop4();
 }
Exemplo n.º 26
0
            /// <summary>Executes the state.</summary>
            /// <param name="hovertank">The hover tank game.</param>
            /// <returns>The next state to set or null.</returns>
            public override State Execute(Hovertank hovertank)
            {
                if(!hovertank.verticalBlank)
                    return null;

                hovertank.SetScreen(_crtc, _pel);
                return _nextState;
            }
Exemplo n.º 27
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public override State Execute(Hovertank hovertank)
 {
     return hovertank.PlayGame5();
 }
Exemplo n.º 28
0
            /// <summary>Initialises the state.</summary>
            /// <param name="hovertank">The hover tank engine.</param>
            /// <param name="nextState">The state that will be set when Ack completes.</param>
            public void Initialise(Hovertank hovertank, State nextState)
            {
                hovertank.ClearKeys();

                _nextState = nextState;
            }
Exemplo n.º 29
0
        /// <summary>Updates keyboard input.</summary>
        /// <param name="hovertank">The hovertank game.</param>
        public virtual void UpdateKeyboardInput(Hovertank hovertank)
        {
            int lastScanCode = 0;
            BitArray hovertankKeyDown = hovertank.keydown;
            for(int i = 0; i < hovertankKeyDown.Length; i++)
            {
                if(_keyDown[i] && !_prevKeyDown[i])
                {
                    hovertankKeyDown[i] = true;
                    lastScanCode = i;
                }

                if(!_keyDown[i] && _prevKeyDown[i])
                    hovertankKeyDown[i] = false;
            }

            if(lastScanCode != 0)
            {
                hovertank.NBKscan = (ushort) (lastScanCode | 0x80);
                hovertank.NBKascii = hovertank.scanascii[hovertank.NBKscan & 0x7f];
            }

            // Copy _prevKeyDown to _keyDown
            _prevKeyDown.SetAll(false);
            _prevKeyDown.Or(_keyDown);
        }
Exemplo n.º 30
0
 /// <summary>Executes the state.</summary>
 /// <param name="hovertank">The hover tank game.</param>
 /// <returns>The next state to set or null.</returns>
 public override State Execute(Hovertank hovertank)
 {
     return hovertank.CheckKeysDebugKeysGodMode2();
 }