예제 #1
0
        public override void SpawnPlayer(int clientIndex)
        {
            base.SpawnPlayer(clientIndex);

            idPlayer player = (idPlayer)idR.Game.Entities[clientIndex];

            player.SpawnedTime = idR.Game.Time;
        }
예제 #2
0
        public override void SpawnPlayer(int clientIndex)
        {
            base.SpawnPlayer(clientIndex);

            if (idR.Game.IsClient == false)
            {
                if (this.State == MultiplayerGameState.GameOn)
                {
                    idPlayer player = (idPlayer)idR.Game.Entities[clientIndex];
                    player.TourneyRank = 1;
                }
            }
        }
예제 #3
0
        protected override string GetPlayerSkin(idPlayer player)
        {
            string baseName = string.Empty;

            if (player.Team == PlayerTeam.Blue)
            {
                baseName = "skins/characters/player/marine_mp_blue";
            }
            else
            {
                baseName = "skins/characters/player/marine_mp_red";
            }

            return(baseName);
        }
예제 #4
0
        private void UpdatePlayerSkin(idPlayer player, bool restart)
        {
            if (restart == true)
            {
                player.Team = (player.Info.GetString("ui_team").ToLower() == "blue") ? PlayerTeam.Blue : PlayerTeam.Red;
            }

            player.BaseSkin = this.GetPlayerSkin(player);

            if (player.BaseSkin == string.Empty)
            {
                player.BaseSkin = "skins/characters/player/marine_mp";
            }

            player.Skin = idR.DeclManager.FindSkin(player.BaseSkin, false);

            // match the skin to a color band for scoreboard
            if (player.BaseSkin.Contains("red") == true)
            {
                player.ColorBarIndex = 1;
            }
            else if (player.BaseSkin.Contains("green") == true)
            {
                player.ColorBarIndex = 2;
            }
            else if (player.BaseSkin.Contains("blue") == true)
            {
                player.ColorBarIndex = 3;
            }
            else if (player.BaseSkin.Contains("yellow") == true)
            {
                player.ColorBarIndex = 4;
            }
            else
            {
                player.ColorBarIndex = 0;
            }

            player.ColorBar = idPlayer.ColorBarTable[player.ColorBarIndex];

            idConsole.Warning("TODO: powerup active");

            /*if(PowerUpActive(BERSERK))
             * {
             *      powerUpSkin = declManager->FindSkin(baseSkinName + "_berserk");
             * }*/
        }
예제 #5
0
        public idPlayerView(idPlayer player)
        {
            _player      = player;
            _screenBlobs = new ScreenBlob[idR.MaxScreenBlobs];
            _view        = new idRenderView();

            _doubleVisionMaterial = idR.DeclManager.FindMaterial("_scratch");
            _tunnelMaterial       = idR.DeclManager.FindMaterial("textures/decals/tunnel");
            _armorMaterial        = idR.DeclManager.FindMaterial("armorViewEffect");
            _berserkMaterial      = idR.DeclManager.FindMaterial("textures/decals/berserk");
            _irGogglesMaterial    = idR.DeclManager.FindMaterial("textures/decals/irblend");
            _bloodSprayMaterial   = idR.DeclManager.FindMaterial("textures/decals/bloodspray");
            _bfgMaterial          = idR.DeclManager.FindMaterial("textures/decals/bfgvision");
            _lagoMaterial         = idR.DeclManager.FindMaterial(idR.LagometerMaterial, false);

            ClearEffects();
        }
예제 #6
0
        public virtual bool Draw(int clientIndex)
        {
            if (this.Disposed == true)
            {
                throw new ObjectDisposedException(this.GetType().Name);
            }

            idPlayer player = idR.Game.Entities[clientIndex] as idPlayer;

            if (player == null)
            {
                return(false);
            }

            // render the scene
            player.View.Draw(player.Hud);

            return(true);
        }
예제 #7
0
        public override bool UserInfoChanged(int clientIndex, bool canModify)
        {
            bool modifiedInfo = base.UserInfoChanged(clientIndex, canModify);

            idPlayer player = (idPlayer)idR.Game.Entities[clientIndex];

            player.Team = (player.Info.GetString("ui_team").ToLower() == "blue") ? PlayerTeam.Blue : PlayerTeam.Red;

            // server maintains TDM balance
            if ((canModify == true) && (this.IsInGame(clientIndex) == true) && (idR.CvarSystem.GetBool("g_balanceTDM") == true))
            {
                idConsole.Warning("TODO: modifiedInfo |= BalanceTeams();");
            }

            // TODO: REFACTOR THIS AWAY
            if ((idR.Game.IsClient == false) && (player.Team != player.LatchedTeam))
            {
                idConsole.Warning("TODO: gameLocal.mpGame.SwitchToTeam(entityNumber, latchedTeam, team);");
            }

            player.LatchedTeam = player.Team;

            return(modifiedInfo);
        }
예제 #8
0
        public override bool UserInfoChanged(int clientIndex, bool canModify)
        {
            bool modifiedInfo = base.UserInfoChanged(clientIndex, canModify);

            idPlayer player   = (idPlayer)idR.Game.Entities[clientIndex];
            bool     spectate = (player.Info.GetString("ui_spectate").ToLower() == "spectate");

            if (idR.Game.ServerInfo.GetBool("si_spectators") == true)
            {
                // never let spectators go back to game while sudden death is on
                if ((canModify == true) && (this.State == MultiplayerGameState.SuddenDeath) && (spectate == false) && (player.WantToSpectate == true))
                {
                    player.Info.Set("ui_spectate", "Spectate");
                    modifiedInfo |= true;
                }
                else
                {
                    if ((spectate != player.WantToSpectate) && (spectate == false))
                    {
                        // returning from spectate, set forceRespawn so we don't get stuck in spectate forever
                        player.ForceRespawn = true;
                    }

                    player.WantToSpectate = spectate;
                }
            }
            else
            {
                if ((canModify == true) && (spectate == true))
                {
                    player.Info.Set("ui_spectate", "Play");
                    modifiedInfo |= true;
                }
                else if (player.IsSpectating)
                {
                    // allow player to leaving spectator mode if they were in it when si_spectators got turned off
                    player.ForceRespawn = true;
                }

                player.WantToSpectate = false;
            }

            bool newReady = (player.Info.GetString("ui_ready").ToLower() == "ready");

            if ((player.IsReady != newReady) && (this.State == MultiplayerGameState.WarmUp) && (player.WantToSpectate == false))
            {
                this.AddChatLine(idR.Language.Get("#str_07180"), player.Info.GetString("ui_name"), (newReady == true) ? idR.Language.Get("#str_04300") : idR.Language.Get("#str_04301"));
            }

            player.IsReady    = newReady;
            player.IsChatting = player.Info.GetBool("ui_chat", false);

            UpdatePlayerSkin(player, false);

            if ((canModify == true) && (player.IsChatting == true) /* TODO: && AI_DEAD*/)
            {
                // if dead, always force chat icon off.
                player.IsChatting = false;
                player.Info.Set("ui_chat", false);

                modifiedInfo |= true;
            }

            return(modifiedInfo);
        }
예제 #9
0
 protected virtual string GetPlayerSkin(idPlayer player)
 {
     return(player.Info.GetString("ui_skin"));
 }