示例#1
0
        /*
         * ======================================================================
         *
         * INTERMISSION
         *
         * ======================================================================
         */

        public static void MoveClientToIntermission(edict_t ent)
        {
            if (GameBase.deathmatch.value != 0 || GameBase.coop.value != 0)
            {
                ent.client.showscores = true;
            }

            Math3D.VectorCopy(GameBase.level.intermission_origin, ent.s.origin);
            ent.client.ps.pmove.origin[0] = (short)(GameBase.level.intermission_origin[0] * 8);
            ent.client.ps.pmove.origin[1] = (short)(GameBase.level.intermission_origin[1] * 8);
            ent.client.ps.pmove.origin[2] = (short)(GameBase.level.intermission_origin[2] * 8);
            Math3D.VectorCopy(GameBase.level.intermission_angle, ent.client.ps.viewangles);
            ent.client.ps.pmove.pm_type = Defines.PM_FREEZE;
            ent.client.ps.gunindex      = 0;
            ent.client.ps.blend[3]      = 0;
            ent.client.ps.rdflags      &= ~Defines.RDF_UNDERWATER;

            // clean up powerup info
            ent.client.quad_framenum       = 0;
            ent.client.invincible_framenum = 0;
            ent.client.breather_framenum   = 0;
            ent.client.enviro_framenum     = 0;
            ent.client.grenade_blew_up     = false;
            ent.client.grenade_time        = 0;

            ent.viewheight    = 0;
            ent.s.modelindex  = 0;
            ent.s.modelindex2 = 0;
            ent.s.modelindex3 = 0;
            ent.s.modelindex  = 0;
            ent.s.effects     = 0;
            ent.s.sound       = 0;
            ent.solid         = Defines.SOLID_NOT;

            // add the layout

            if (GameBase.deathmatch.value != 0 || GameBase.coop.value != 0)
            {
                PlayerHud.DeathmatchScoreboardMessage(ent, null);
                GameBase.gi.unicast(ent, true);
            }
        }
示例#2
0
 /*
  * ==================
  * DeathmatchScoreboard
  *
  * Draw instead of help message. Note that it isn't that hard to overflow
  * the 1400 byte message limit!
  * ==================
  */
 public static void DeathmatchScoreboard(edict_t ent)
 {
     PlayerHud.DeathmatchScoreboardMessage(ent, ent.enemy);
     GameBase.gi.unicast(ent, true);
 }
示例#3
0
        /**
         * Called for each player at the end of the server frame and right after
         * spawning.
         */
        public static void ClientEndServerFrame(edict_t ent)
        {
            float bobtime;
            int   i;

            PlayerView.current_player = ent;
            PlayerView.current_client = ent.client;

            //
            // If the origin or velocity have changed since ClientThink(),
            // update the pmove values. This will happen when the client
            // is pushed by a bmodel or kicked by an explosion.
            //
            // If it wasn't updated here, the view position would lag a frame
            // behind the body position when pushed -- "sinking into plats"
            //
            for (i = 0; i < 3; i++)
            {
                PlayerView.current_client.ps.pmove.origin[i]   = (short)(ent.s.origin[i] * 8.0);
                PlayerView.current_client.ps.pmove.velocity[i] = (short)(ent.velocity[i] * 8.0);
            }

            //
            // If the end of unit layout is displayed, don't give
            // the player any normal movement attributes
            //
            if (GameBase.level.intermissiontime != 0)
            {
                // FIXME: add view drifting here?
                PlayerView.current_client.ps.blend[3] = 0;
                PlayerView.current_client.ps.fov      = 90;
                PlayerHud.G_SetStats(ent);

                return;
            }

            Math3D.AngleVectors(ent.client.v_angle, PlayerView.forward, PlayerView.right, PlayerView.up);

            // burn from lava, etc
            PlayerView.P_WorldEffects();

            //
            // set model angles from view angles so other things in
            // the world can tell which direction you are looking
            //
            if (ent.client.v_angle[Defines.PITCH] > 180)
            {
                ent.s.angles[Defines.PITCH] = (-360 + ent.client.v_angle[Defines.PITCH]) / 3;
            }
            else
            {
                ent.s.angles[Defines.PITCH] = ent.client.v_angle[Defines.PITCH] / 3;
            }

            ent.s.angles[Defines.YAW]  = ent.client.v_angle[Defines.YAW];
            ent.s.angles[Defines.ROLL] = 0;
            ent.s.angles[Defines.ROLL] = PlayerView.SV_CalcRoll(ent.s.angles, ent.velocity) * 4;

            //
            // calculate speed and cycle to be used for
            // all cyclic walking effects
            //
            PlayerView.xyspeed = (float)Math.Sqrt(ent.velocity[0] * ent.velocity[0] + ent.velocity[1] * ent.velocity[1]);

            if (PlayerView.xyspeed < 5)
            {
                PlayerView.bobmove = 0;
                PlayerView.current_client.bobtime = 0;                 // start at beginning of cycle again
            }
            else if (ent.groundentity != null)
            {
                // so bobbing only cycles when on
                // ground
                if (PlayerView.xyspeed > 210)
                {
                    PlayerView.bobmove = 0.25f;
                }
                else if (PlayerView.xyspeed > 100)
                {
                    PlayerView.bobmove = 0.125f;
                }
                else
                {
                    PlayerView.bobmove = 0.0625f;
                }
            }

            bobtime = PlayerView.current_client.bobtime += PlayerView.bobmove;

            if ((PlayerView.current_client.ps.pmove.pm_flags & pmove_t.PMF_DUCKED) != 0)
            {
                bobtime *= 4;
            }

            PlayerView.bobcycle   = (int)bobtime;
            PlayerView.bobfracsin = (float)Math.Abs(Math.Sin(bobtime * Math.PI));

            // detect hitting the floor
            PlayerView.P_FallingDamage(ent);

            // apply all the damage taken this frame
            PlayerView.P_DamageFeedback(ent);

            // determine the view offsets
            PlayerView.SV_CalcViewOffset(ent);

            // determine the gun offsets
            PlayerView.SV_CalcGunOffset(ent);

            // determine the full screen color blend
            // must be after viewoffset, so eye contents can be
            // accurately determined
            // FIXME: with client prediction, the contents
            // should be determined by the client
            PlayerView.SV_CalcBlend(ent);

            // chase cam stuff
            if (ent.client.resp.spectator)
            {
                PlayerHud.G_SetSpectatorStats(ent);
            }
            else
            {
                PlayerHud.G_SetStats(ent);
            }

            PlayerHud.G_CheckChaseStats(ent);

            PlayerView.G_SetClientEvent(ent);

            PlayerView.G_SetClientEffects(ent);

            PlayerView.G_SetClientSound(ent);

            PlayerView.G_SetClientFrame(ent);

            Math3D.VectorCopy(ent.velocity, ent.client.oldvelocity);
            Math3D.VectorCopy(ent.client.ps.viewangles, ent.client.oldviewangles);

            // clear weapon kicks
            Math3D.VectorClear(ent.client.kick_origin);
            Math3D.VectorClear(ent.client.kick_angles);

            // if the scoreboard is up, update it
            if (ent.client.showscores && 0 == (GameBase.level.framenum & 31))
            {
                PlayerHud.DeathmatchScoreboardMessage(ent, ent.enemy);
                GameBase.gi.unicast(ent, false);
            }
        }