コード例 #1
0
        /*
        ===================
        =
        = CheckFire
        =
        ===================
        */
        private void CheckFire()
        {
            if(gunstate == gunstates.rearming)
            {
                if((guncount += tics) > GUNARM)
                {
                    gunstate = gunstates.ready;
                    PlaySound(GUNREADYSND);
                    DrawPic(14, 40, READYPIC);
                }
                return;
            }

            if(c.button1)
            {
                // holding down button
                if(gunstate == gunstates.ready)
                {
                    gunstate = gunstates.charging;
                    DrawPic(14, 40, CHARGINGPIC);
                    guncount = 0;
                }
                if(gunstate == gunstates.charging && (guncount += tics) > GUNCHARGE)
                {
                    PlaySound(MAXPOWERSND);
                    gunstate = gunstates.maxpower;
                    DrawPic(14, 40, MAXPOWERPIC);
                }
            }
            else
                // button up
                if(gunstate > gunstates.ready) // fire small shot if charging, large if maxed
                {
                    DrawPic(14, 40, REARMINGPIC);
                    guncount = 0;

                    classtype shotType = (classtype) (classtype.pshotobj + (short) (gunstate - gunstates.charging));
                    SpawnShot(obon.x, obon.y, obon.angle, shotType);

                    gunstate = gunstates.rearming;

                    // as: Support for extra sound effects
                    if(shotType == classtype.pshotobj)
                        PlaySound(FIRESND);
                    else
                        PlaySound(SNDEX_FIRE2);
                }
        }
コード例 #2
0
        /*
        =============================================================================

                       PLAYER

        =============================================================================
        */
        /*
        ===================
        =
        = SpawnPlayer
        =
        ===================
        */
        private void SpawnPlayer(fixed_t gx, fixed_t gy)
        {
            objlist[0].x = gx;
            objlist[0].y = gy;
            objlist[0].angle = 0;
            objlist[0].think = PlayerThink;
            objlist[0]._class = classtype.playerobj;
            objlist[0].size = MINDIST;
            objlist[0].radarcolor = 15;
            objlist[0].hitpoints = 3;

            objlist[0].xl = objlist[0].x - objlist[0].size;
            objlist[0].xh = objlist[0].x + objlist[0].size;
            objlist[0].yl = objlist[0].y - objlist[0].size;
            objlist[0].yh = objlist[0].y + objlist[0].size;

            gunstate = gunstates.ready;
        }