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; }
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(); }
public PlayerView(idPlayer player) { _player = player; /*memset(screenBlobs, 0, sizeof(screenBlobs)); dvMaterial = declManager->FindMaterial("_scratch"); tunnelMaterial = declManager->FindMaterial("textures/decals/tunnel"); armorMaterial = declManager->FindMaterial("armorViewEffect"); berserkMaterial = declManager->FindMaterial("textures/decals/berserk"); irGogglesMaterial = declManager->FindMaterial("textures/decals/irblend"); bloodSprayMaterial = declManager->FindMaterial("textures/decals/bloodspray"); bfgMaterial = declManager->FindMaterial("textures/decals/bfgvision"); lagoMaterial = declManager->FindMaterial(LAGO_MATERIAL, false); bfgVision = false; dvFinishTime = 0; kickFinishTime = 0; kickAngles.Zero(); lastDamageTime = 0.0f; fadeTime = 0; fadeRate = 0.0; fadeFromColor.Zero(); fadeToColor.Zero(); fadeColor.Zero(); shakeAng.Zero(); ClearEffects();*/ }
/// <summary> /// spectators are spawned randomly anywhere. /// in-game clients are spawned based on distance to active players (randomized on the first half) /// upon map restart, initial spawns are used (randomized ordered list of spawns flagged "initial"). /// if there are more players than initial spots, overflow to regular spawning. /// </summary> /// <param name="player"></param> /// <returns></returns> public idEntity SelectInitialSpawnPoint(idPlayer player) { if((this.IsMultiplayer == false) || (_spawnPoints.Length == 0)) { idEntity ent = FindEntityUsingDef(null, "info_player_start"); if(ent == null) { idConsole.Error("No info_player_start on map."); } return ent; } if(player.IsSpectating == true) { // plain random spot, don't bother return _spawnPoints[_random.Next(_spawnPoints.Length)].Entity; /*} else if ( player->useInitialSpawns && currentInitialSpot < initialSpots.Num() ) { return initialSpots[ currentInitialSpot++ ];*/ } else { // check if we are alone in map bool alone = true; for(int j = 0; j < idR.MaxClients; j++) { if((_entities[j] != null) && (_entities[j] != player)) { alone = false; } } if(alone == true) { // don't do distance-based return _spawnPoints[_random.Next(_spawnPoints.Length)].Entity; } // TODO // find the distance to the closest active player for each spawn spot /*for( i = 0; i < spawnSpots.Num(); i++ ) { pos = spawnSpots[ i ].ent->GetPhysics()->GetOrigin(); spawnSpots[ i ].dist = 0x7fffffff; for( j = 0; j < MAX_CLIENTS; j++ ) { if ( !entities[ j ] || !entities[ j ]->IsType( idPlayer::Type ) || entities[ j ] == player || static_cast< idPlayer * >( entities[ j ] )->spectating ) { continue; } dist = ( pos - entities[ j ]->GetPhysics()->GetOrigin() ).LengthSqr(); if ( dist < spawnSpots[ i ].dist ) { spawnSpots[ i ].dist = dist; } } } // sort the list qsort( ( void * )spawnSpots.Ptr(), spawnSpots.Num(), sizeof( spawnSpot_t ), ( int (*)(const void *, const void *) )sortSpawnPoints ); // choose a random one in the top half which = random.RandomInt( spawnSpots.Num() / 2 ); spot = spawnSpots[ which ];*/ } // TODO: return spot.ent; return null; }
protected virtual string GetPlayerSkin(idPlayer player) { return player.Info.GetString("ui_skin"); }
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"); }*/ }