# HG changeset patch # User smxx # Date 1272576351 0 # Node ID f8800c44b3debab2ad4692fba3547d8b9e82fdfc # Parent a46a311097af81ce702668f556f8a7b6a59daeec Engine: * Fixed tint color byte order * Fixed invulnerability's flashing * Added some more stats/achievement code (unfinished) Frontend: * Added ability to check for existing/missing team files * Added some more stats/achievement code (unfinished) diff -r a46a311097af -r f8800c44b3de QTfrontend/statsPage.cpp --- a/QTfrontend/statsPage.cpp Thu Apr 29 19:40:13 2010 +0000 +++ b/QTfrontend/statsPage.cpp Thu Apr 29 21:25:51 2010 +0000 @@ -21,6 +21,7 @@ #include #include "statsPage.h" +#include "team.h" FitGraphicsView::FitGraphicsView(QWidget* parent) : QGraphicsView(parent) { @@ -123,5 +124,18 @@ healthPoints[clan].append(hp); break; } + case 'T': { // local team stats + //AddStatText("

local team: " + info + "

"); + QStringList infol = info.split(":"); + HWTeam team(infol[0]); + if(team.FileExists()) // do some better test to avoid influence from scripted/predefined teams? + { + team.LoadFromFile(); + team.Rounds++; + if(infol[1].toInt() > 0) // might require some better test for winning condition (or changed flag) ... WIP! + team.Wins++; // should draws count as wins? + //team.SaveToFile(); // don't save yet + } + } } } diff -r a46a311097af -r f8800c44b3de QTfrontend/team.cpp --- a/QTfrontend/team.cpp Thu Apr 29 19:40:13 2010 +0000 +++ b/QTfrontend/team.cpp Thu Apr 29 21:25:51 2010 +0000 @@ -50,6 +50,8 @@ binds[i].action = cbinds[i].action; binds[i].strbind = cbinds[i].strbind; } + Rounds = 0; + Wins = 0; } HWTeam::HWTeam(const QStringList& strLst) : @@ -73,6 +75,8 @@ // Checking net teams is probably pointless, but can't hurt. if (Hedgehogs[i].Hat.length() == 0) Hedgehogs[i].Hat = "NoHat"; } + Rounds = 0; + Wins = 0; } HWTeam::HWTeam() : @@ -97,6 +101,8 @@ binds[i].action = cbinds[i].action; binds[i].strbind = cbinds[i].strbind; } + Rounds = 0; + Wins = 0; } @@ -110,6 +116,8 @@ Voicepack = teamfile.value("Team/Voicepack", "Default").toString(); Flag = teamfile.value("Team/Flag", "hedgewars").toString(); difficulty = teamfile.value("Team/Difficulty", 0).toInt(); + Rounds = teamfile.value("Team/Rounds", 0).toInt(); + Wins = teamfile.value("Team/Wins", 0).toInt(); for(int i = 0; i < 8; i++) { QString hh = QString("Hedgehog%1/").arg(i); @@ -130,6 +138,12 @@ return true; } +bool HWTeam::FileExists() +{ + QFile f(cfgdir->absolutePath() + "/Teams/" + TeamName + ".ini"); + return f.exists(); +} + bool HWTeam::DeleteFile() { if(m_isNetTeam) @@ -155,6 +169,8 @@ teamfile.setValue("Team/Voicepack", Voicepack); teamfile.setValue("Team/Flag", Flag); teamfile.setValue("Team/Difficulty", difficulty); + teamfile.setValue("Team/Rounds", Rounds); + teamfile.setValue("Team/Wins", Wins); for(int i = 0; i < 8; i++) { QString hh = QString("Hedgehog%1/").arg(i); diff -r a46a311097af -r f8800c44b3de QTfrontend/team.h --- a/QTfrontend/team.h Thu Apr 29 19:40:13 2010 +0000 +++ b/QTfrontend/team.h Thu Apr 29 21:25:51 2010 +0000 @@ -54,6 +54,8 @@ QString Flag; QString Voicepack; QString Owner; + int Rounds; + int Wins; HWHog Hedgehogs[8]; unsigned int AchievementProgress[MAX_ACHIEVEMENTS]; unsigned int difficulty; @@ -65,6 +67,7 @@ bool LoadFromFile(); bool DeleteFile(); bool SaveToFile(); + bool FileExists(); void SetToPage(HWForm * hwform); void GetFromPage(HWForm * hwform); QStringList TeamGameConfig(quint32 InitHealth) const; diff -r a46a311097af -r f8800c44b3de hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Thu Apr 29 19:40:13 2010 +0000 +++ b/hedgewars/uConsts.pas Thu Apr 29 21:25:51 2010 +0000 @@ -131,7 +131,7 @@ capgrpMessage, capgrpAmmostate); TStatInfoType = (siGameResult, siMaxStepDamage, siMaxStepKills, siKilledHHs, - siClanHealth); + siClanHealth, siTeamStats); TWave = (waveRollup, waveSad, waveWave, waveHurrah, waveLemonade, waveShrug, waveJuggle); diff -r a46a311097af -r f8800c44b3de hedgewars/uGears.pas --- a/hedgewars/uGears.pas Thu Apr 29 19:40:13 2010 +0000 +++ b/hedgewars/uGears.pas Thu Apr 29 21:25:51 2010 +0000 @@ -962,7 +962,7 @@ if HH^.Effects[hePoisoned] then begin - Tint($4000FF40); + Tint($4040FF00); DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 2, 0, 0, sx, sy, 0, 1, 22, 22, (RealTicks shr 36) mod 360); Tint($FFFFFFFF) end; @@ -1047,7 +1047,7 @@ glLineWidth(1.0); - Tint($C00000FF); + Tint($C0FF0000); VertexBuffer[0].X:= hx + WorldDx; VertexBuffer[0].Y:= hy + WorldDy; VertexBuffer[1].X:= tx + WorldDx; @@ -1487,13 +1487,13 @@ if HH^.Effects[hePoisoned] then begin - Tint($8000FF40); + Tint($8040FF00); DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 1.5, 0, 0, sx, sy, 0, 1, 22, 22, 360 - (RealTicks shr 37) mod 360); end; if Gear^.Invulnerable then begin - Tint($FF, $FF, $FF, max($40, floor($FF * abs(1 - 2 * ((RealTicks div 2 + Gear^.uid * 491) mod 1500) / 750)))); + Tint($FF, $FF, $FF, max($40, floor($FF * abs(1 - ((RealTicks div 2 + Gear^.uid * 491) mod 1500) / 750)))); DrawSprite(sprInvulnerable, sx - 24, sy - 24, 0); end; if cVampiric and diff -r a46a311097af -r f8800c44b3de hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Thu Apr 29 19:40:13 2010 +0000 +++ b/hedgewars/uMisc.pas Thu Apr 29 21:25:51 2010 +0000 @@ -345,7 +345,7 @@ end; procedure SendStat(sit: TStatInfoType; s: shortstring); -const stc: array [TStatInfoType] of char = 'rDkKH'; +const stc: array [TStatInfoType] of char = 'rDkKHT'; var buf: shortstring; begin buf:= 'i' + stc[sit] + s; diff -r a46a311097af -r f8800c44b3de hedgewars/uStats.pas --- a/hedgewars/uStats.pas Thu Apr 29 19:40:13 2010 +0000 +++ b/hedgewars/uStats.pas Thu Apr 29 21:25:51 2010 +0000 @@ -193,6 +193,8 @@ for t:= 0 to Pred(TeamsCount) do with TeamsArray[t]^ do begin + if not ExtDriven then + SendStat(siTeamStats, GetTeamStatString(TeamsArray[t])); for i:= 0 to cMaxHHIndex do begin if Hedgehogs[i].stats.MaxStepDamageGiven > msd then diff -r a46a311097af -r f8800c44b3de hedgewars/uStore.pas --- a/hedgewars/uStore.pas Thu Apr 29 19:40:13 2010 +0000 +++ b/hedgewars/uStore.pas Thu Apr 29 21:25:51 2010 +0000 @@ -91,7 +91,7 @@ {$IFNDEF IPHONEOS} procedure Tint(r, g, b, a: Byte); inline; begin -Tint((a shl 24) or (b shl 16) or (g shl 8) or r); +Tint((a shl 24) or (r shl 16) or (g shl 8) or b); end; procedure Tint(c: Longword); inline; @@ -116,7 +116,7 @@ begin if c = lastTint then exit; -Tint(c and $FF, (c shr 8) and $FF, (c shr 16) and $FF, (c shr 24) and $FF); +Tint((c shr 16) and $FF, (c shr 8) and $FF, c and $FF, (c shr 24) and $FF); lastTint:= c; end; {$ENDIF} diff -r a46a311097af -r f8800c44b3de hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Thu Apr 29 19:40:13 2010 +0000 +++ b/hedgewars/uTeams.pas Thu Apr 29 21:25:51 2010 +0000 @@ -80,7 +80,6 @@ TClan = record Color: Longword; - RColor: Longword; // color with reversed byte order Teams: array[0..Pred(cMaxTeams)] of PTeam; TeamsNumber: Longword; CurrTeam: LongWord; @@ -315,7 +314,6 @@ begin ClanIndex:= Pred(ClansCount); Color:= TeamColor; - RColor:= $FF000000 or ((Color shr 16) and $FF) or ((Color shl 16) and $00FF0000) or (Color and $0000FF00) end end else begin diff -r a46a311097af -r f8800c44b3de hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Thu Apr 29 19:40:13 2010 +0000 +++ b/hedgewars/uWorld.pas Thu Apr 29 21:25:51 2010 +0000 @@ -652,7 +652,7 @@ highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500); if highlight then - Tint(Clan^.RColor); + Tint(Clan^.Color); // draw name DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY, NameTagTex);