/** * Returns the origin of the base of this team. * This returns null if the base has no flag !!! **/ public Point3f getBaseOrigin() { if ( fFlag != null ) return fFlag.getBaseOrigin(); else return null; }
public String getDeathmatchScoreboardMessage( GameObject victim, GameObject killer, boolean inIntermission ) { int xOffset, statHeader, statCaps, headerIndex; String s; Team otherTeam; otherTeam = ( this == TEAM1 ? TEAM2 : TEAM1 ); xOffset = ( this == TEAM1 ? 0 : 160 ); statHeader = ( this == TEAM1 ? STAT_CTF_TEAM1_HEADER : STAT_CTF_TEAM2_HEADER ); headerIndex = ( this == TEAM1 ? Engine.getImageIndex("ctfsb1") : Engine.getImageIndex("ctfsb2") ); statCaps = ( this == TEAM1 ? STAT_CTF_TEAM1_CAPS : STAT_CTF_TEAM2_CAPS ); // display our teamheader victim.fEntity.setPlayerStat( statHeader, (short)headerIndex ); /* // if during intermission, we must blink our header if we're the winning team (or tie) if ( inIntermission && ((int)Game.getGameTime()%2 == 0 ) ) // blink every second { if ( this.getCaptures() > otherTeam.getCaptures() ) victim.fEntity.setPlayerStat( statHeader, (short)0 ); // Capture tie, check total frags else if ( this.getScore() >= otherTeam.getScore() ) victim.fEntity.setPlayerStat( statHeader, (short)0 ); } */ s = "if " + statHeader + " xv " + (8+xOffset) + " yv 8 pic " + statHeader + " endif " + "xv " + (40+xOffset) + " yv 28 string \"" + getScore() + "/" + fCaptures + "\" " + "xv " + (98+xOffset) + " yv 12 num 2 " + statCaps + " "; // TODO: sort players by score Player[] players = getPlayers(); /* int begin = 0; int i = begin; while ( i < players.length-1 ) { if ( players[i].getScore() < players[i+1].getScore() ) { Player dummy = players[i]; players[i] = players[i+1]; players[i+1] = dummy; } if ( i == players.length-2 ) i = ++begin; } */ for ( int i=0; i<8 && i<players.length; i++ ) { Player p = players[i]; int ping = Math.min( p.fEntity.getPlayerPing(), 999 ); s += "ctf " + xOffset + " " + (42+i*8) + " " + p.fEntity.getPlayerNum() + " " + p.getScore() + " " + ping + " "; GenericFlag flag = (GenericFlag)p.getInventory( "flag" ); if ( flag != null ) // flag IS other teams flag... { s += "xv " + (56+xOffset) + " picn " + flag.getSmallIconName() + " "; } } if ( players.length > 8 ) { s += "xv " + (8+xOffset) + " yv " + (42+8*8) + " string \"...and " + (players.length-8) + " more\" "; } return s; }