--- a/QTfrontend/team.cpp Sun Aug 31 16:27:47 2008 +0000
+++ b/QTfrontend/team.cpp Sun Aug 31 17:22:50 2008 +0000
@@ -242,10 +242,14 @@
sl.push_back(QString("ebind " + binds[i].strbind + " " + binds[i].action));
for (int t = 0; t < numHedgehogs; t++)
+ {
sl.push_back(QString("eaddhh %1 %2 %3")
.arg(QString::number(difficulty),
QString::number(InitHealth),
HHName[t]));
+ sl.push_back(QString("ehat %1")
+ .arg(HHHat[t]));
+ }
return sl;
}
--- a/hedgewars/CCHandlers.inc Sun Aug 31 16:27:47 2008 +0000
+++ b/hedgewars/CCHandlers.inc Sun Aug 31 17:22:50 2008 +0000
@@ -107,20 +107,30 @@
begin
if (not isDeveloperMode) or (CurrentTeam = nil) then exit;
with CurrentTeam^ do
- begin
- SplitBySpace(id, s);
- CurrentHedgehog:= @Hedgehogs[HedgehogsNumber];
- val(id, CurrentHedgehog^.BotLevel);
- Gear:= AddGear(0, 0, gtHedgehog, 0, _0, _0, 0);
- SplitBySpace(s, id);
- val(s, Gear^.Health);
- TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true);
- PHedgehog(Gear^.Hedgehog)^.Team:= CurrentTeam;
- Hedgehogs[HedgehogsNumber].AmmoStore:= TeamsCount - 1; // FIXME HACK to get ammostores work
- Hedgehogs[HedgehogsNumber].Gear:= Gear;
- Hedgehogs[HedgehogsNumber].Name:= id;
- inc(HedgehogsNumber)
- end
+ begin
+ SplitBySpace(id, s);
+ CurrentHedgehog:= @Hedgehogs[HedgehogsNumber];
+ val(id, CurrentHedgehog^.BotLevel);
+ Gear:= AddGear(0, 0, gtHedgehog, 0, _0, _0, 0);
+ SplitBySpace(s, id);
+ val(s, Gear^.Health);
+ TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true);
+ PHedgehog(Gear^.Hedgehog)^.Team:= CurrentTeam;
+ CurrentHedgehog^.AmmoStore:= TeamsCount - 1; // FIXME HACK to get ammostores work
+ CurrentHedgehog^.Gear:= Gear;
+ CurrentHedgehog^.Name:= id;
+ inc(HedgehogsNumber)
+ end
+end;
+
+procedure chSetHat(var s: shortstring);
+begin
+if (not isDeveloperMode) or (CurrentTeam = nil) then exit;
+with CurrentTeam^ do
+ if s = '' then
+ CurrentHedgehog^.Hat:= 'NoHat'
+ else
+ CurrentHedgehog^.Hat:= s
end;
procedure chSetHHCoords(var x: shortstring);
--- a/hedgewars/uConsole.pas Sun Aug 31 16:27:47 2008 +0000
+++ b/hedgewars/uConsole.pas Sun Aug 31 17:22:50 2008 +0000
@@ -200,9 +200,18 @@
end;
function GetLastConsoleLine: shortstring;
+var Result: shortstring;
+ i: LongWord;
begin
-if CurrLine = 0 then GetLastConsoleLine:= ConsoleLines[Pred(cLinesCount)].s
- else GetLastConsoleLine:= ConsoleLines[Pred(CurrLine)].s
+i:= (CurrLine + cLinesCount - 2) mod cLinesCount;
+Result:= ConsoleLines[i].s;
+
+//Result:= Result + #10;
+
+i:= (CurrLine + cLinesCount - 1) mod cLinesCount;
+Result:= Result + ConsoleLines[i].s;
+
+GetLastConsoleLine:= Result
end;
procedure StopMessages(Message: Longword);
@@ -236,6 +245,7 @@
RegisterVariable('grave' , vtCommand, @chGrave , false);
RegisterVariable('bind' , vtCommand, @chBind , true );
RegisterVariable('addhh' , vtCommand, @chAddHH , false);
+RegisterVariable('hat' , vtCommand, @chSetHat , false);
RegisterVariable('hhcoords', vtCommand, @chSetHHCoords , false);
RegisterVariable('ammstore', vtCommand, @chAddAmmoStore , false);
RegisterVariable('quit' , vtCommand, @chQuit , true );
--- a/hedgewars/uConsts.pas Sun Aug 31 16:27:47 2008 +0000
+++ b/hedgewars/uConsts.pas Sun Aug 31 17:22:50 2008 +0000
@@ -45,7 +45,7 @@
sprHandDEagle, sprHandAirAttack, sprHandBaseball, sprPHammer,
sprHandBlowTorch, sprBlowTorch, sprTeleport, sprHHDeath,
sprShotgun, sprDEagle, sprHHIdle, sprMortar, sprTurnsLeft,
- sprHat, sprKamikaze, sprWhip, sprKowtow, sprSad, sprWave,
+ sprKamikaze, sprWhip, sprKowtow, sprSad, sprWave,
sprHurrah, sprLemonade, sprExplPart, sprExplPart2,
sprCakeWalk, sprCakeDown, sprAMAmmosBW);
@@ -400,8 +400,6 @@
Width: 16; Height: 16; saveSurf: false),// sprMortar
(FileName: 'TurnsLeft'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
Width: 16; Height: 16; saveSurf: false),// sprTurnsLeft
- (FileName: 'Samurai'; Path: ptHats ; AltPath: ptNone; Texture: nil; Surface: nil;
- Width: 32; Height: 32; saveSurf: false),// sprHat
(FileName: 'amKamikaze'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
Width: 256; Height: 32; saveSurf: false),// sprKamikaze
(FileName: 'amWhip'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
--- a/hedgewars/uGears.pas Sun Aug 31 16:27:47 2008 +0000
+++ b/hedgewars/uGears.pas Sun Aug 31 17:22:50 2008 +0000
@@ -852,12 +852,12 @@
(RealTicks div 128 + Gear^.Pos) mod 19,
hwSign(Gear^.dX),
0);
- DrawRotatedF(sprHat,
+ DrawTextureF(PHedgehog(Gear^.Hedgehog)^.HatTex,
hwRound(Gear^.X) + 1 + WorldDx,
hwRound(Gear^.Y) - 8 + WorldDy,
(RealTicks div 128 + Gear^.Pos) mod 19,
hwSign(Gear^.dX),
- 0);
+ 32);
end;
with PHedgehog(Gear^.Hedgehog)^ do
--- a/hedgewars/uStore.pas Sun Aug 31 16:27:47 2008 +0000
+++ b/hedgewars/uStore.pas Sun Aug 31 17:22:50 2008 +0000
@@ -30,6 +30,7 @@
procedure DrawSurfSprite(X, Y, Height, Frame: LongInt; Source: PTexture);
procedure DrawLand (X, Y: LongInt);
procedure DrawTexture(X, Y: LongInt; Texture: PTexture);
+procedure DrawTextureF(Texture: PTexture; X, Y, Frame, Dir, Frames: LongInt);
procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real);
procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real);
procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real);
@@ -153,7 +154,12 @@
for i:= 0 to 7 do
with Hedgehogs[i] do
if Gear <> nil then
+ begin
NameTagTex:= RenderStringTex(Name, Clan^.Color, fnt16);
+ texsurf:= LoadImage(Pathz[ptHats] + '/' + Hat, false, true, false);
+ HatTex:= Surface2Tex(texsurf);
+ SDL_FreeSurface(texsurf)
+ end;
end;
end;
@@ -351,6 +357,42 @@
glEnd()
end;
+procedure DrawTextureF(Texture: PTexture; X, Y, Frame, Dir, Frames: LongInt);
+var ft, fb: GLfloat;
+ hw: LongInt;
+begin
+glPushMatrix;
+glTranslatef(X, Y, 0);
+
+if Dir < 0 then
+ hw:= - 16
+else
+ hw:= 16;
+
+ft:= Frame / Frames;
+fb:= (Frame + 1) / Frames;
+
+glBindTexture(GL_TEXTURE_2D, Texture^.id);
+
+glBegin(GL_QUADS);
+
+glTexCoord2f(0, ft);
+glVertex2i(-hw, -16);
+
+glTexCoord2f(1, ft);
+glVertex2i(hw, -16);
+
+glTexCoord2f(1, fb);
+glVertex2i(hw, 16);
+
+glTexCoord2f(0, fb);
+glVertex2i(-hw, 16);
+
+glEnd();
+
+glPopMatrix
+end;
+
procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real);
begin
DrawRotatedTex(SpritesData[Sprite].Texture,
--- a/hedgewars/uTeams.pas Sun Aug 31 16:27:47 2008 +0000
+++ b/hedgewars/uTeams.pas Sun Aug 31 17:22:50 2008 +0000
@@ -30,8 +30,9 @@
THedgehog = record
Name: string[MAXNAMELEN];
Gear: PGear;
- NameTagTex: PTexture;
- HealthTagTex: PTexture;
+ NameTagTex,
+ HealthTagTex,
+ HatTex: PTexture;
Ammo: PHHAmmo;
AmmoStore: Longword;
CurSlot, CurAmmo: LongWord;
@@ -40,6 +41,7 @@
visStepPos: LongWord;
BotLevel : LongWord; // 0 - Human player
stats: TStatistics;
+ Hat: String;
end;
TTeam = record
Clan: PClan;