Exemple #1
0
        public static void OnDrawAll(CDIB32 lp)
        {
            int sx, sy, ex, ey;

            sx = sy = 0;
            m_pParent.GetViewPos(ref sx, ref sy);
            sx = (-sx) >> 5; sy = (-sy) >> 5;
            ex = sx + 320 / 32; ey = sy + 224 / 32;
            TL.Saturate(sx, ref ex, m_pParent.GetWidth() - 1);
            TL.Saturate(sy, ref ey, m_pParent.GetHeight() - 1);
            foreach (var it in m_pParent.GetMapObjects(sx - 1, sy - 1, ex + 1, ey + 1, f3MapObjectType.MOT_ICESOURCE))
            {
                if (it.IsValid())
                {
                    it.OnDraw(lp);
                }
            }
        }
Exemple #2
0
        private void BreatheOut()
        {
            int p = (int)Math.Floor(m_ChargePower / 40.0f) + 1;

            TL.Saturate(1, ref p, m_nPower);
            int start = (int)(-m_Angle + (p - 1) * 16), angle;

            for (int i = 0; i < p; i++)
            {
                angle = start - 32 * i;
                new Cf3MapObjectIce(
                    m_X + CSinTable.Sin(angle) * 16 / 65536,
                    m_Y - CSinTable.Cos(angle) * 16 / 65536,
                    m_DX + CSinTable.Sin(angle) * 6 / 65536,
                    m_DY - CSinTable.Cos(angle) * 6 / 65536);
            }
            m_nPower     -= p;
            m_State       = f3fffState.BREATHEOUT;
            m_ChargePower = 10.0f;
        }
Exemple #3
0
        public override void OnMove()
        {
            if (!IsValid())
            {
                return;
            }
            if (!m_pParent.IsPlayable())
            {
                return;
            }
            if (m_bFirst)
            {
                HitCheck(); m_bFirst = false;
            }
            float Wind     = m_pParent.GetWind((int)Math.Floor(m_X / 32), (int)Math.Floor(m_Y / 32));
            float Friction = m_pParent.GetFriction((int)Math.Floor(m_X / 32), (int)Math.Floor((m_Y + 14) / 32));
            float Gravity  = GetGravity();

            if (m_pParent.ItemCompleted())
            {
                Smile();
            }
            if (Cf3Setting.theSetting.m_Hyper != 0)
            {
                m_nPower = 4;
            }
            // 動かしま~す
            if (m_State == f3MainCharaState.STANDING || m_State == f3MainCharaState.SLEEPING || m_State == f3MainCharaState.BLINKING)
            {
                // 立ってるとき
                m_DX -= WINDFACTOR * (m_DX - Wind) * RUNFRICTION;
                TL.BringClose(ref m_DX, 0.0f, Friction);
                if (m_DX == 0)
                {
                    m_Direction = f3MapObjectDirection.DIR_FRONT;
                }
                if (m_State == f3MainCharaState.STANDING && ++m_Sleepy >= 30 * 40 / 3)
                {
                    Sleep();
                }
                if (m_State == f3MainCharaState.BLINKING && --m_PoseCounter == 0)
                {
                    m_State = f3MainCharaState.STANDING;
                }
                if (m_State == f3MainCharaState.STANDING && CApp.theApp.random(120) == 0)
                {
                    Blink();
                }
                if (m_PowerY <= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_JUMP))
                {
                    StartJump();
                }
                if (m_PowerX <= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_LEFT))
                {
                    Run(f3MapObjectDirection.DIR_LEFT);
                }
                if (m_PowerX >= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_RIGHT))
                {
                    Run(f3MapObjectDirection.DIR_RIGHT);
                }
                if (m_pInput.GetKeyPressed((int)F3KEY.F3KEY_DOWN))
                {
                    Sit();
                }
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_ATTACK))
                {
                    BreatheIn();
                }
                if (!m_HitBottom)
                {
                    Fall();
                }
            }
            else if (m_State == f3MainCharaState.RUNNING)
            {
                // 走ってるとき
                int AXL = 0, AXR = 0;
                if (m_PowerX <= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_LEFT))
                {
                    AXL = 1;
                }
                if (m_PowerX >= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_RIGHT))
                {
                    AXR = 1;
                }
                m_DX -= Friction * (m_DX - Wind) * RUNFRICTION;
                m_DX += Friction * 2.0f * (AXR - AXL);
                if (AXL != 0 && AXR == 0)
                {
                    m_Direction = f3MapObjectDirection.DIR_LEFT;
                }
                if (AXR != 0 && AXL == 0)
                {
                    m_Direction = f3MapObjectDirection.DIR_RIGHT;
                }
                if (AXL == 0 && AXR == 0)
                {
                    Stop();
                }
                if (m_PowerY <= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_JUMP))
                {
                    StartJump();
                }
                if (m_pInput.GetKeyPressed((int)F3KEY.F3KEY_DOWN))
                {
                    Sit();
                }
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_ATTACK))
                {
                    BreatheIn();
                }
                if (!m_HitBottom)
                {
                    Fall();
                }
            }
            else if (m_State == f3MainCharaState.WALKING)
            {
                // 歩いてるとき
                int AXL = 0, AXR = 0;
                if (m_PowerX <= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_LEFT))
                {
                    AXL = 1;
                }
                if (m_PowerX >= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_RIGHT))
                {
                    AXR = 1;
                }
                m_DX += WALKACCEL * (AXR - AXL);
                m_DX -= m_DX * WALKFRICTION;
                if (AXL != 0 && AXR == 0)
                {
                    m_Direction = f3MapObjectDirection.DIR_LEFT;
                }
                if (AXR != 0 && AXL == 0)
                {
                    m_Direction = f3MapObjectDirection.DIR_RIGHT;
                }
                if (AXL == 0 && AXR == 0)
                {
                    m_Direction = f3MapObjectDirection.DIR_FRONT;
                }
                if (!m_pInput.GetKeyPressed((int)F3KEY.F3KEY_DOWN))
                {
                    Stop();
                }
                if (m_PowerY <= 0 && m_pInput.GetKeyPushed((int)F3KEY.F3KEY_JUMP))
                {
                    StartJump();
                }
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_ATTACK))
                {
                    BreatheIn();
                }
                if (!m_HitBottom)
                {
                    Fall();
                }
            }
            else if (m_State == f3MainCharaState.CHARGING)
            {
                // パワー充填中
                if (m_ChargePower > 0)
                {
                    m_ChargePower -= m_ChargeDec;
                    if (m_ChargePower < 0)
                    {
                        m_ChargePower = 0;
                    }
                }
                m_X -= m_DX;
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_DOWN))
                {
                    Sit();
                }
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_ATTACK))
                {
                    BreatheIn();
                }
                if (!m_pInput.GetKeyPressed((int)F3KEY.F3KEY_JUMP))
                {
                    Jump();
                }
                if (!m_HitBottom)
                {
                    Fall();
                }
            }
            else if (m_State == f3MainCharaState.JUMPING)
            {
                // 空中
                if (m_DY >= 0)
                {
                    int AXL = 0, AXR = 0;
                    if (m_PowerX <= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_LEFT))
                    {
                        AXL = 1;
                    }
                    if (m_PowerX >= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_RIGHT))
                    {
                        AXR = 1;
                    }
                    m_DX -= (m_DX - Wind) * JUMPFRICTIONX;
                    m_DX += JUMPACCEL * (AXR - AXL);
                    if (AXL != 0 && AXR == 0)
                    {
                        m_Direction = f3MapObjectDirection.DIR_LEFT;
                    }
                    if (AXR != 0 && AXL == 0)
                    {
                        m_Direction = f3MapObjectDirection.DIR_RIGHT;
                    }
                }
                if (m_HitLeft || m_HitRight)
                {
                    m_Direction = f3MapObjectDirection.DIR_FRONT;
                }
                m_DY += Gravity;
                if (m_DY >= 0)
                {
                    if (m_PowerY >= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_DOWN))
                    {
                        m_DY += Gravity * ADDGRAVITY;
                    }
                    m_DY -= m_DY * JUMPFRICTIONY;
                    if (m_pInput.GetKeyPressed((int)F3KEY.F3KEY_UP))
                    {
                        m_DY += Gravity;
                        m_DY -= m_DY * JUMPFRICTIONY;
                    }
                }
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_ATTACK))
                {
                    BreatheIn();
                }
                if (m_HitBottom)
                {
                    Land();
                }
            }
            else if (m_State == f3MainCharaState.BREATHEIN)
            {
                // 冷気充填中
                m_ChargePower += 1.0f;
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_LEFT))
                {
                    m_Direction = f3MapObjectDirection.DIR_LEFT;
                }
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_RIGHT))
                {
                    m_Direction = f3MapObjectDirection.DIR_RIGHT;
                }
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_UP))
                {
                    m_Direction = f3MapObjectDirection.DIR_FRONT;
                }
                if (m_HitBottom)
                {
                    m_DX -= WINDFACTOR * (m_DX - Wind) * RUNFRICTION;
                    TL.BringClose(ref m_DX, 0.0f, Friction);
                    if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_DOWN))
                    {
                        Sit();
                    }
                }
                else
                {
                    m_ChargePower += 1.0f;
                    if (m_DY >= 0)
                    {
                        m_DX -= (m_DX - Wind) * JUMPFRICTIONX;
                    }
                    m_DY += Gravity;
                    if (m_DY >= 0)
                    {
                        m_DY -= m_DY * JUMPFRICTIONY;
                    }
                }
                if (!m_pInput.GetKeyPressed((int)F3KEY.F3KEY_ATTACK))
                {
                    BreatheOut();
                }
            }
            else if (m_State == f3MainCharaState.BREATHEOUT)
            {
                // 冷気放出!!
                m_ChargePower -= 1.0f;
                if (m_HitBottom)
                {
                    m_DX -= WINDFACTOR * (m_DX - Wind) * RUNFRICTION;
                    TL.BringClose(ref m_DX, 0.0f, Friction);
                }
                else
                {
                    if (m_DY >= 0)
                    {
                        m_DX -= (m_DX - Wind) * JUMPFRICTIONX;
                    }
                    m_DY += Gravity;
                    if (m_DY >= 0)
                    {
                        m_DY -= m_DY * JUMPFRICTIONY;
                    }
                }
                if (m_ChargePower <= 0.0f)
                {
                    if (m_nPower != 0)
                    {
                        if (m_HitBottom)
                        {
                            Land();
                        }
                        else
                        {
                            Fall();
                        }
                    }
                    else
                    {
                        Tire();
                    }
                }
            }
            else if (m_State == f3MainCharaState.TIRED)
            {
                // ちかれたー!
                m_PoseCounter--;
                if (m_HitBottom)
                {
                    m_DX -= WINDFACTOR * (m_DX - Wind) * RUNFRICTION;
                    TL.BringClose(ref m_DX, 0.0f, Friction);
                }
                else
                {
                    m_DX -= (m_DX - Wind) * JUMPFRICTIONX;
                    if (m_HitLeft || m_HitRight)
                    {
                        m_Direction = f3MapObjectDirection.DIR_FRONT;
                    }
                    m_DY += Gravity;
                    m_DY -= m_DY * JUMPFRICTIONY;
                }
                if (m_PoseCounter == 0)
                {
                    Land();
                }
            }
            else if (m_State == f3MainCharaState.FROZEN)
            {
                // 凍っちゃった…
                m_PoseCounter--;
                if (m_HitBottom)
                {
                    m_DX -= WINDFACTOR * (m_DX - Wind) * RUNFRICTION / 5;
                    TL.BringClose(ref m_DX, 0.0f, Friction / 5);
                }
                else
                {
                    m_DX -= (m_DX - Wind) * JUMPFRICTIONX / 5;
                    m_DY += Gravity * (1 + ADDGRAVITY);
                    m_DY -= m_DY * JUMPFRICTIONY / 5;
                }
                if (m_PoseCounter == 0)
                {
                    Land();
                }
            }
            // 速度飽和(めり込み防止)
            TL.Saturate(-RUNMAX, ref m_DX, RUNMAX);
            TL.Saturate(-JUMPMAX, ref m_DY, FALLMAX);
            // 実際の移動+当たり判定
            // 1回の移動ごとに当たり判定
            // という手順ですり抜けバグは解消されるはず
            m_HitLeft = m_HitRight = m_HitTop = m_HitBottom = false;
            m_X      += m_DX;
            HitCheck();
            if (!m_HitTop && !m_HitBottom)
            {
                m_Y += m_DY;
                HitCheck();
            }
        }
Exemple #4
0
        protected void BreatheOut()
        {
            if (m_bOriginal && m_State == f3MainCharaState.SLEEPING)
            {
                CApp.theApp.GetBGM().MusicEffect(MENumber.MEN_AWAKE);
            }
            int p = (int)Math.Floor(m_ChargePower / 40.0f) + 1;

            TL.Saturate(1, ref p, m_nPower);
            var s = new temp_s[4];

            if (m_Direction == f3MapObjectDirection.DIR_FRONT)
            {
                if ((p & 1) != 0)
                {
                    s[0].x  = 0.0f;
                    s[0].y  = -16.0f;
                    s[0].dx = 0.0f;
                    s[0].dy = -6.0f;
                    s[1].x  = 16.0f * SIN30;
                    s[1].y  = -16.0f * COS30;
                    s[1].dx = 6.0f * SIN30;
                    s[1].dy = -6.0f * COS30;
                    s[2].x  = -s[1].x;
                    s[2].y  = s[1].y;
                    s[2].dx = -s[1].dx;
                    s[2].dy = s[1].dy;
                }
                else
                {
                    s[0].x  = 16.0f * SIN15;
                    s[0].y  = -16.0f * COS15;
                    s[0].dx = 6.0f * SIN15;
                    s[0].dy = -6.0f * COS15;
                    s[1].x  = -s[0].x;
                    s[1].y  = s[0].y;
                    s[1].dx = -s[0].dx;
                    s[1].dy = s[0].dy;
                    s[2].x  = 16.0f * SIN45;
                    s[2].y  = -16.0f * COS45;
                    s[2].dx = 6.0f * SIN45;
                    s[2].dy = -6.0f * COS45;
                    s[3].x  = -s[2].x;
                    s[3].y  = s[2].y;
                    s[3].dx = -s[2].dx;
                    s[3].dy = s[2].dy;
                }
            }
            else
            {
                s[0].x  = 16.0f * COS15;
                s[0].y  = -16.0f * SIN15;
                s[0].dx = 6.0f * COS15;
                s[0].dy = -6.0f * SIN15;
                s[1].x  = 16.0f * COS30;
                s[1].y  = -16.0f * SIN30;
                s[1].dx = 6.0f * COS30;
                s[1].dy = -6.0f * SIN30;
                s[2].x  = 16.0f * COS45;
                s[2].y  = -16.0f * SIN45;
                s[2].dx = 6.0f * COS45;
                s[2].dy = -6.0f * SIN45;
                s[3].x  = 16.0f * COS60;
                s[3].y  = -16.0f * SIN60;
                s[3].dx = 6.0f * COS60;
                s[3].dy = -6.0f * SIN60;
            }
            for (int i = 0; i < p; i++)
            {
                if (m_Direction == f3MapObjectDirection.DIR_LEFT)
                {
                    s[i].x = -s[i].x; s[i].dx = -s[i].dx;
                }
                new Cf3MapObjectIce(m_X + s[i].x, m_Y + s[i].y, m_DX + s[i].dx, m_DY + s[i].dy);
            }
            m_nPower     -= p;
            m_State       = f3MainCharaState.BREATHEOUT;
            m_ChargePower = 10.0f;
        }
Exemple #5
0
        public override void OnMove()
        {
            if (--m_Life <= 0)
            {
                Kill();
            }
            float Wind = m_pParent.GetWind((int)Math.Floor(m_X / 32), (int)Math.Floor(m_Y / 32));

            m_DX -= (m_DX - Wind) * FRICTION;
            m_DY += GRAVITY;
            m_DY -= m_DY * FRICTION;
            TL.Saturate(-13.0f, ref m_DX, 13.0f);
            TL.Saturate(-13.0f, ref m_DY, 13.0f);
            m_X += m_DX;
            int s = GetSize();

            if (m_DX > 0)
            {
                // 右側当たり判定
                if (m_pParent.GetHit((int)Math.Floor((m_X + s) / 32), (int)Math.Floor(m_Y / 32), HIT.HIT_LEFT))
                {
                    if ((int)Math.Floor((m_X + s) / 32) != (int)Math.Floor((m_X + s - m_DX) / 32))
                    {
                        m_DX *= -REFRECTION;
                        m_X   = (int)Math.Floor((m_X + s) / 32) * 32 - s;
                        m_Life--;
                    }
                }
            }
            else if (m_DX < 0)
            {
                // 左側当たり判定
                if (m_pParent.GetHit((int)Math.Floor((m_X - s) / 32), (int)Math.Floor(m_Y / 32), HIT.HIT_RIGHT))
                {
                    if ((int)Math.Floor((m_X - s) / 32) != (int)Math.Floor((m_X - s - m_DX) / 32))
                    {
                        m_DX *= -REFRECTION;
                        m_X   = (int)Math.Floor(m_X / 32) * 32 + s;
                        m_Life--;
                    }
                }
            }
            m_Y += m_DY;
            if (m_DY > 0)
            {
                // 下側当たり判定
                if (m_pParent.GetHit((int)Math.Floor(m_X / 32), (int)Math.Floor((m_Y + s) / 32), HIT.HIT_TOP))
                {
                    if ((int)Math.Floor((m_Y + s) / 32) != (int)Math.Floor((m_Y + s - m_DY) / 32))
                    {
                        m_DY *= -REFRECTION;
                        m_Y   = (int)Math.Floor((m_Y + s) / 32) * 32 - s;
                        m_Life--;
                    }
                }
            }
            else if (m_DY < 0)
            {
                // 上側当たり判定
                if (m_pParent.GetHit((int)Math.Floor(m_X / 32), (int)Math.Floor((m_Y - s) / 32), HIT.HIT_BOTTOM))
                {
                    if ((int)Math.Floor((m_Y - s) / 32) != (int)Math.Floor((m_Y - s - m_DY) / 32))
                    {
                        m_DY *= -REFRECTION;
                        m_Y   = (int)Math.Floor(m_Y / 32) * 32 + s;
                        m_Life--;
                    }
                }
            }
        }
Exemple #6
0
 public override void OnMove()
 {
     if (m_State == f3EelPitcherState.EELLEAF)
     {
         TL.BringClose(ref m_Y, m_RootY - m_Level * 32, 4.0f);
         m_DX = m_DX + (m_pParent.GetWind((int)Math.Floor(m_X / 32), (int)Math.Floor(m_Y / 32)) - m_DX) * m_Level * 0.1f + (m_RootX - m_X) * 0.025f;
         TL.Saturate(-14.0f, ref m_DX, 14.0f);
         m_X += m_DX;
         if (m_pParent.GetHit((int)Math.Floor((m_X - 16) / 32), (int)Math.Floor(m_Y / 32), HIT.HIT_RIGHT))
         {
             m_DX = 0;
             m_X  = (int)Math.Floor(m_X / 32) * 32 + 16;
         }
         else if (m_pParent.GetHit((int)Math.Floor((m_X + 16) / 32), (int)Math.Floor(m_Y / 32), HIT.HIT_LEFT))
         {
             m_DX = 0;
             m_X  = (int)Math.Floor(m_X / 32) * 32 + 16;
         }
     }
     else if (m_State == f3EelPitcherState.EELFROZEN)
     {
         if (--m_Delay == 0)
         {
             m_Y    += 16;
             m_State = f3EelPitcherState.EELSEED;
             m_Delay = 200;
             new Cf3MapObjectEffect(m_X, m_Y, 0);
         }
     }
     else if (m_State == f3EelPitcherState.EELSEED)
     {
         TL.BringClose(ref m_DY, 8.0f, 1.0f);
         m_DX += (m_pParent.GetWind((int)Math.Floor(m_X / 32), (int)Math.Floor(m_Y / 32)) - m_DX) * 0.2f;
         TL.Saturate(-14.0f, ref m_DX, 14.0f);
         m_X += m_DX;
         if (m_pParent.GetHit((int)Math.Floor((m_X - 16) / 32), (int)Math.Floor(m_Y / 32), HIT.HIT_RIGHT))
         {
             m_DX = 0;
             m_X  = (int)Math.Floor(m_X / 32) * 32 + 16;
         }
         else if (m_pParent.GetHit((int)Math.Floor((m_X + 16) / 32), (int)Math.Floor(m_Y / 32), HIT.HIT_LEFT))
         {
             m_DX = 0;
             m_X  = (int)Math.Floor(m_X / 32) * 32 + 16;
         }
         m_Y += m_DY;
         if ((int)Math.Floor(m_Y / 32) != (int)Math.Floor((m_Y - m_DY) / 32))
         {
             // 32ドット境界をまたいだ!!
             if (m_pParent.GetHit((int)Math.Floor(m_X / 32), (int)Math.Floor(m_Y / 32), HIT.HIT_TOP) ||
                 (int)Math.Floor(m_Y / 32) >= m_pParent.GetHeight())
             {
                 Seed();
             }
             else
             {
                 if (m_pParent.GetHit((int)Math.Floor((m_X - 16) / 32), (int)Math.Floor(m_Y / 32), HIT.HIT_RIGHT))
                 {
                     m_DX = 0;
                     m_X  = (int)Math.Floor(m_X / 32) * 32 + 16;
                 }
                 else if (m_pParent.GetHit((int)Math.Floor((m_X + 16) / 32), (int)Math.Floor(m_Y / 32), HIT.HIT_LEFT))
                 {
                     m_DX = 0;
                     m_X  = (int)Math.Floor(m_X / 32) * 32 + 16;
                 }
             }
         }
     }
     else if (m_State == f3EelPitcherState.EELBUD)
     {
         if (--m_Delay == 0)
         {
             m_State = f3EelPitcherState.EELLEAF;
         }
     }
     else if (m_State == f3EelPitcherState.EELDEAD)
     {
         Kill();
     }
 }
Exemple #7
0
 public override void OnMove()
 {
     if (!IsValid())
     {
         return;
     }
     if (m_Type == NDT.NDT_UNDEFINED)
     {
         // このタイミングで初期化
         if (m_pParent.GetHit((int)Math.Floor(m_X / 32), (int)Math.Floor((m_Y + 16) / 32), HIT.HIT_TOP))
         {
             m_Type  = NDT.NDT_HORIZONTAL;
             m_State = NDS.NDS_STOP;
         }
         else
         {
             m_Type   = NDT.NDT_VERTICAL;
             m_StartY = m_Y;
             m_State  = NDS.NDS_STOP;
         }
     }
     if (m_Type == NDT.NDT_HORIZONTAL)
     {
         if (m_State == NDS.NDS_STOP)
         {
             TL.BringClose(ref m_Speed, 0.0f, 1.0f);
             if (m_Speed == 0)
             {
                 if (!m_pParent.GetHit((int)Math.Floor((m_X + 15) / 32), (int)Math.Floor((m_Y + 16) / 32), HIT.HIT_TOP) ||
                     m_pParent.GetHit((int)Math.Floor((m_X + 15) / 32), (int)Math.Floor((m_Y) / 32), HIT.HIT_LEFT))
                 {
                     m_State = NDS.NDS_LEFT;
                 }
                 else
                 {
                     m_State = NDS.NDS_RIGHT;
                 }
             }
         }
         else if (m_State == NDS.NDS_LEFT)
         {
             m_X -= 1;
             if (!m_pParent.GetHit((int)Math.Floor((m_X - 16) / 32), (int)Math.Floor((m_Y + 16) / 32), HIT.HIT_TOP) ||
                 m_pParent.GetHit((int)Math.Floor((m_X - 16) / 32), (int)Math.Floor((m_Y) / 32), HIT.HIT_RIGHT))
             {
                 m_State = NDS.NDS_STOP;
                 m_Speed = 20;
             }
         }
         else if (m_State == NDS.NDS_RIGHT)
         {
             m_X += 1;
             if (!m_pParent.GetHit((int)Math.Floor((m_X + 15) / 32), (int)Math.Floor((m_Y + 16) / 32), HIT.HIT_TOP) ||
                 m_pParent.GetHit((int)Math.Floor((m_X + 15) / 32), (int)Math.Floor((m_Y) / 32), HIT.HIT_LEFT))
             {
                 m_State = NDS.NDS_STOP;
                 m_Speed = 20;
             }
         }
     }
     else if (m_Type == NDT.NDT_VERTICAL)
     {
         if (m_State == NDS.NDS_STOP)
         {
             if (m_Speed != 0)
             {
                 TL.BringClose(ref m_Speed, 0.0f, 1.0f);
                 if (m_Speed == 0)
                 {
                     m_State = NDS.NDS_UP;
                 }
             }
         }
         else if (m_State == NDS.NDS_UP)
         {
             TL.BringClose(ref m_Y, m_StartY, 1.0f);
             if (m_Y == m_StartY)
             {
                 m_State = NDS.NDS_STOP;
             }
         }
         else if (m_State == NDS.NDS_DOWN)
         {
             m_Speed += 0.2f;
             TL.Saturate(0.0f, ref m_Speed, 10.0f);
             m_Y += m_Speed;
             if (m_pParent.GetHit((int)Math.Floor(m_X / 32), (int)Math.Floor((m_Y + 16) / 32), HIT.HIT_TOP))
             {
                 m_Y     = (float)Math.Floor((m_Y + 16) / 32) * 32 - 15;
                 m_Speed = 20;
                 m_State = NDS.NDS_STOP;
             }
             else if (m_Y > m_pParent.GetHeight() * 32 + 16)
             {
                 m_Type = NDT.NDT_DEAD;
                 new Cf3MapObjectEffect(m_X, m_Y, 1);
             }
         }
     }
     else if (m_Type == NDT.NDT_DEAD)
     {
         Kill();
     }
 }
Exemple #8
0
        public void OnDraw(CDIB32 lp, bool bShowHit)
        {
            int       x, y, z;
            int       vx, vy;
            int       sx, sy, ex, ey;
            Rectangle r;

            lp.Clear(0);
            if (m_MapData[0] != null)
            {
                float mx = 1;
                if (m_Width[1] - 10 > 0)
                {
                    mx = (float)(m_Width[0] - 10) / (float)(m_Width[1] - 10);
                }
                float my = 1;
                if (m_Height[1] - 7 > 0)
                {
                    my = (float)(m_Height[0] - 7) / (float)(m_Height[1] - 7);
                }
                sx = sy = 0;
                GetViewPos(ref sx, ref sy, mx, my);
                sx = (-sx) >> 5; sy = (-sy) >> 5;
                ex = sx + 320 / 32; ey = sy + 224 / 32;
                TL.Saturate(sx, ref ex, m_Width[0] - 1);
                TL.Saturate(sy, ref ey, m_Height[0] - 1);
                for (y = sy; y <= ey; y++)
                {
                    for (x = sx; x <= ex; x++)
                    {
                        z  = y * m_Width[0] + x;
                        r  = new Rectangle((m_MapData[0][z] & 0xf) * 32, (m_MapData[0][z] >> 4) * 32, 32, 32);
                        vx = x * 32; vy = y * 32;
                        GetViewPos(ref vx, ref vy, mx, my);
                        lp.BltFast(m_MapChip[0], vx, vy, r);
                    }
                }
            }
            if (m_MapData[1] != null)
            {
                CDIB32 pHit = null;
                if (bShowHit)
                {
                    pHit = CDIB32.Create();
                    pHit.CreateSurface(384, 32);
                    pHit.BltFast(CResourceManager.ResourceManager.Get(RID.RID_HIT), 0, 0);
                    pHit.SubColorFast(CApp.theApp.random(0x1000000));
                }
                sx = sy = 0;
                GetViewPos(ref sx, ref sy);
                sx = (-sx) >> 5; sy = (-sy) >> 5;
                ex = sx + 320 / 32; ey = sy + 224 / 32;
                TL.Saturate(sx, ref ex, m_Width[1] - 1);
                TL.Saturate(sy, ref ey, m_Height[1] - 1);
                for (y = sy; y <= ey; y++)
                {
                    for (x = sx; x <= ex; x++)
                    {
                        z  = y * m_Width[1] + x;
                        r  = new Rectangle((m_MapData[1][z] & 0xf) * 32, (m_MapData[1][z] >> 4) * 32, 32, 32);
                        vx = x * 32; vy = y * 32;
                        GetViewPos(ref vx, ref vy);
                        if (m_MapData[0] != null)
                        {
                            lp.Blt(m_MapChip[1], vx, vy, r);
                        }
                        else
                        {
                            lp.BltFast(m_MapChip[1], vx, vy, r);
                        }
                        if (bShowHit)
                        {
                            // 当たり判定表示
                            if (GetHit(x, y, HIT.HIT_TOP))
                            {
                                int f = (byte)m_Hit[GetMapData(1, x, y)] & ~0x1f;
                                r = new Rectangle(f, 0, 32, 32);
                                lp.BlendBlt(pHit, vx, vy, 0x808080, 0x7f7f7f, r);
                            }
                            if (GetHit(x, y, HIT.HIT_BOTTOM))
                            {
                                r = new Rectangle(256, 0, 32, 32);
                                lp.BlendBlt(pHit, vx, vy, 0x808080, 0x7f7f7f, r);
                            }
                            if (GetHit(x, y, HIT.HIT_LEFT))
                            {
                                r = new Rectangle(288, 0, 32, 32);
                                lp.BlendBlt(pHit, vx, vy, 0x808080, 0x7f7f7f, r);
                            }
                            if (GetHit(x, y, HIT.HIT_RIGHT))
                            {
                                r = new Rectangle(320, 0, 32, 32);
                                lp.BlendBlt(pHit, vx, vy, 0x808080, 0x7f7f7f, r);
                            }
                            if (GetHit(x, y, HIT.HIT_DEATH))
                            {
                                r = new Rectangle(352, 0, 32, 32);
                                lp.BlendBlt(pHit, vx, vy, 0x808080, 0x7f7f7f, r);
                            }
                        }
                    }
                }
                if (bShowHit)
                {
                    pHit.Dispose();
                }
            }
            Cf3MapObjectBanana.OnDrawAll(lp);
            Cf3MapObjectmrframe.OnDrawAll(lp);
            if (m_MainChara != null)
            {
                m_MainChara.OnDraw(lp);
            }
            Cf3MapObjectGeasprin.OnDrawAll(lp);
            Cf3MapObjectNeedle.OnDrawAll(lp);
            Cf3MapObjectEelPitcher.OnDrawAll(lp);
            Cf3MapObjectIceSource.OnDrawAll(lp);
            Cf3MapObjectFire.OnDrawAll(lp);
            Cf3MapObjectIce.OnDrawAll(lp);
            Cf3MapObjectEffect.OnDrawAll(lp);
            Cf3MapObjectWind.OnDrawAll(lp);
            if (m_MapData[2] != null)
            {
                float mx = 1.0f;
                if (m_Width[1] - 10 > 0)
                {
                    mx = (float)(m_Width[2] - 10) / (m_Width[1] - 10);
                }
                float my = 1.0f;
                if (m_Height[1] - 7 > 0)
                {
                    my = (float)(m_Height[2] - 7) / (m_Height[1] - 7);
                }
                sx = sy = 0;
                GetViewPos(ref sx, ref sy, mx, my);
                sx = (-sx) >> 5; sy = (-sy) >> 5;
                ex = sx + 320 / 32; ey = sy + 224 / 32;
                TL.Saturate(sx, ref ex, m_Width[2] - 1);
                TL.Saturate(sy, ref ey, m_Height[2] - 1);
                for (y = sy; y <= ey; y++)
                {
                    for (x = sx; x <= ex; x++)
                    {
                        z  = y * m_Width[2] + x;
                        r  = new Rectangle((m_MapData[2][z] & 0xf) * 32, (m_MapData[2][z] >> 4) * 32, 32, 32);
                        vx = (int)(x * 32 * mx); vy = (int)(y * 32 * my);
                        GetViewPos(ref vx, ref vy, mx, my);
                        lp.Blt(m_MapChip[2], vx, vy, r);
                    }
                }
            }
            var lpSrc = lp;
            var lpDst = m_pDIBBuf;

            if ((m_nEffect & 1) != 0)
            {
                CPlaneTransBlt.MirrorBlt1(lpDst, lpSrc, 0, 0, 128);
                TL.swap(ref lpSrc, ref lpDst);
            }
            if ((m_nEffect & 2) != 0)
            {
                CPlaneTransBlt.MirrorBlt2(lpDst, lpSrc, 0, 0, 128);
                var rc = new Rectangle(0, 16, 320, 224);
                lpSrc.BltFast(lpDst, 0, 0, rc);
            }
            if ((m_nEffect & 4) != 0)
            {
                CPlaneTransBlt.FlushBlt1(lpDst, lpSrc, 0, 0, 128);
                TL.swap(ref lpSrc, ref lpDst);
            }
            if (lpDst == lp)
            {
                lpDst.BltFast(lpSrc, 0, 0);
            }
        }
Exemple #9
0
        public void CreateTemparatureMap(CDIB32 dib)
        {
            float objX, objY, dX, dY, fX, fY;
            var   pixel = dib.GetPtr();
            float offx = m_ScrollRX - 320 / 2, offy = m_ScrollRY - 224 / 2 - 2;

            TL.Saturate(0.0f, ref offx, m_Width[1] * 32 - 320.0f);
            TL.Saturate(0.0f, ref offy, m_Height[1] * 32 - 224.0f);
            uint i = 0;

            for (int y = 0; y < 224; y++)
            {
                for (int x = 0; x < 320; x++)
                {
                    fX = x + offx; fY = y + offy;   // GetViewPosとオフセットの掛け方が逆
                    var power = 0.0f;
                    // 氷ゾーン
                    foreach (var is_ in Cf3MapObjectIceSource.All())
                    {
                        is_.GetPos(out objX, out objY);
                        dX     = objX - fX; dY = objY - fY;
                        power += 1.0f / (dX * dX + dY * dY);
                    }
                    // 炎ゾーン
                    foreach (var fr in Cf3MapObjectFire.All())
                    {
                        if (fr.IsActive())
                        {
                            fr.GetPos(out objX, out objY);
                            dX     = objX - fX; dY = objY - fY;
                            power -= 1.0f / (dX * dX + dY * dY);
                        }
                    }
                    if (power > 1.0f / 256.0f)
                    {
                        // 凍りつくゾーン
                        pixel[i] = 0x008080;
                    }
                    else if (power > 1.0f / 4096.0f)
                    {
                        // パワーアップゾーン
                        pixel[i] = 0x00ffff;
                    }
                    else if (power < -1.0f / 256.0f)
                    {
                        // 致死ゾーン
                        pixel[i] = 0x800000;
                    }
                    else if (power < -1.0f / 4096.0f)
                    {
                        // 制限ゾーン
                        pixel[i] = 0xff0000;
                    }
                    else
                    {
                        // 普通ゾーン
                        pixel[i] = 0x000000;
                    }
                    i++;
                }
            }
            var lpSrc = dib;
            var lpDst = m_pDIBBuf;

            if ((m_nEffect & 1) != 0)
            {
                CPlaneTransBlt.MirrorBlt1(lpDst, lpSrc, 0, 0, 128);
                TL.swap(ref lpSrc, ref lpDst);
            }
            if ((m_nEffect & 2) != 0)
            {
                CPlaneTransBlt.MirrorBlt2(lpDst, lpSrc, 0, 0, 128);
                var rc = new Rectangle(0, 16, 320, 224);
                lpSrc.BltFast(lpDst, 0, 0, rc);
            }
            if (lpDst == dib)
            {
                lpDst.BltFast(lpSrc, 0, 0);
            }
        }
Exemple #10
0
 public override void OnMove()
 {
     if (!IsValid())
     {
         return;
     }
     if (m_Delay > 0)
     {
         m_Delay--;
     }
     if (m_State == f3GeasprinState.WALKING)
     {
         if (m_Direction == f3MapObjectDirection.DIR_LEFT && m_pParent.GetHit((int)Math.Floor((m_X - 17) / 32), (int)Math.Floor(m_Y / 32), HIT.HIT_RIGHT))
         {
             Blow();
         }
         else if (m_Direction == f3MapObjectDirection.DIR_RIGHT && m_pParent.GetHit((int)Math.Floor((m_X + 17) / 32), (int)Math.Floor(m_Y / 32), HIT.HIT_LEFT))
         {
             Blow();
         }
         else if (!m_pParent.GetHit((int)Math.Floor((m_X + 17 * (m_Direction == f3MapObjectDirection.DIR_LEFT ? -1 : 1)) / 32), (int)Math.Floor((m_Y + 17) / 32), HIT.HIT_TOP))
         {
             Stop();
         }
         else
         {
             if (m_Delay == 0)
             {
                 m_Delay = WalkDelay;
                 m_GX   += (m_Direction == f3MapObjectDirection.DIR_LEFT ? -1 : 1);
             }
         }
     }
     else if (m_State == f3GeasprinState.STANDING)
     {
         if (!m_pParent.GetHit((int)Math.Floor(m_X / 32), (int)Math.Floor((m_Y + 17) / 32), HIT.HIT_TOP))
         {
             Stop();
         }
         else
         {
             if (m_Delay == 0)
             {
                 Walk();
             }
         }
     }
     else if (m_State == f3GeasprinState.FALLING)
     {
         if (m_Delay == 0)
         {
             m_DY += 2;
             TL.Saturate(-60, ref m_DY, 60);
             m_GY += m_DY;
         }
         m_X = m_GX * 8; m_Y = m_GY / 8;
         if (m_DY > 0 && m_pParent.GetHit((int)Math.Floor(m_X / 32), (int)Math.Floor((m_Y + 17) / 32), HIT.HIT_TOP))
         {
             m_GY = (((int)Math.Floor((m_Y + 17) / 32) - 1) * 32 + 16) * 8;
             Laugh();
         }
         else if (m_DY < 0 && m_pParent.GetHit((int)Math.Floor(m_X / 32), (int)Math.Floor((m_Y - 15) / 32), HIT.HIT_BOTTOM))
         {
             m_GY = (m_GY + 127) & ~127;
             m_DY = 0;
         }
     }
     else if (m_State == f3GeasprinState.LAUGHING)
     {
         if (m_Delay == 0)
         {
             Stop();
         }
     }
     else if (m_State == f3GeasprinState.BLOWN)
     {
         if (m_Direction == f3MapObjectDirection.DIR_LEFT && !m_pParent.GetHit((int)Math.Floor((m_X + 17) / 32), (int)Math.Floor(m_Y / 32), HIT.HIT_LEFT))
         {
             m_GX++;
         }
         else if (m_Direction == f3MapObjectDirection.DIR_RIGHT && !m_pParent.GetHit((int)Math.Floor((m_X - 17) / 32), (int)Math.Floor(m_Y / 32), HIT.HIT_RIGHT))
         {
             m_GX--;
         }
         if (m_Delay == 0)
         {
             Stop();
         }
     }
     else if (m_State == f3GeasprinState.BACK)
     {
         if (!m_pParent.GetHit((int)Math.Floor((m_X + 17 * (m_Direction != f3MapObjectDirection.DIR_LEFT ? -1 : 1)) / 32), (int)Math.Floor((m_Y + 17) / 32), HIT.HIT_TOP))
         {
         }
         else if (m_Direction == f3MapObjectDirection.DIR_LEFT && !m_pParent.GetHit((int)Math.Floor((m_X + 17) / 32), (int)Math.Floor(m_Y / 32), HIT.HIT_LEFT))
         {
             m_GX++;
         }
         else if (m_Direction == f3MapObjectDirection.DIR_RIGHT && !m_pParent.GetHit((int)Math.Floor((m_X - 17) / 32), (int)Math.Floor(m_Y / 32), HIT.HIT_RIGHT))
         {
             m_GX--;
         }
         if (m_Delay == 0)
         {
             Laugh();
         }
     }
     else if (m_State == f3GeasprinState.FROZEN)
     {
         if (m_Delay == 0)
         {
             Stop();
         }
     }
     else if (m_State == f3GeasprinState.DEAD)
     {
         Kill();
     }
     if (m_Spring[(int)f3MapObjectDirection.DIR_FRONT] != 0)
     {
         m_Spring2[(int)f3MapObjectDirection.DIR_FRONT] = CApp.theApp.random(m_Spring[(int)f3MapObjectDirection.DIR_FRONT]);
     }
     if (m_Spring[(int)f3MapObjectDirection.DIR_LEFT] != 0)
     {
         m_Spring2[(int)f3MapObjectDirection.DIR_LEFT] = CApp.theApp.random(m_Spring[(int)f3MapObjectDirection.DIR_LEFT]);
     }
     if (m_Spring[(int)f3MapObjectDirection.DIR_RIGHT] != 0)
     {
         m_Spring2[(int)f3MapObjectDirection.DIR_RIGHT] = CApp.theApp.random(m_Spring[(int)f3MapObjectDirection.DIR_RIGHT]);
     }
     m_X = m_GX * 8; m_Y = m_GY / 8;
     if (m_Y > m_pParent.GetHeight() * 32 + 16)
     {
         Kill();
         new Cf3MapObjectEffect(m_X, m_Y, 1);
     }
 }