--- a/QTfrontend/gameuiconfig.cpp Tue Jul 05 18:27:18 2011 +0200
+++ b/QTfrontend/gameuiconfig.cpp Tue Jul 05 18:33:42 2011 +0200
@@ -66,13 +66,6 @@
Form->ui.pageOptions->volumeBox->setValue(value("audio/volume", 100).toUInt());
QString netNick = value("net/nick", "").toString();
- if (netNick.isEmpty())
- netNick = QInputDialog::getText(Form,
- QObject::tr("Nickname"),
- QObject::tr("Please enter your nickname"),
- QLineEdit::Normal,
- QDir::home().dirName());
-
Form->ui.pageOptions->editNetNick->setText(netNick);
Form->ui.pageOptions->editNetPassword->installEventFilter(this);
@@ -314,6 +307,11 @@
return Form->ui.pageOptions->editNetNick->text();
}
+void GameUIConfig::updNetNick()
+{
+ Form->ui.pageOptions->editNetNick->setText(value("net/nick", "").toString());
+}
+
QByteArray GameUIConfig::netPasswordHash()
{
return QCryptographicHash::hash(Form->ui.pageOptions->editNetPassword->text().toLatin1(), QCryptographicHash::Md5).toHex();
--- a/QTfrontend/gameuiconfig.h Tue Jul 05 18:27:18 2011 +0200
+++ b/QTfrontend/gameuiconfig.h Tue Jul 05 18:33:42 2011 +0200
@@ -70,6 +70,7 @@
public slots:
void SaveOptions();
+ void updNetNick();
private:
bool netPasswordIsValid();
bool eventFilter(QObject *object, QEvent *event);
--- a/QTfrontend/newnetclient.cpp Tue Jul 05 18:27:18 2011 +0200
+++ b/QTfrontend/newnetclient.cpp Tue Jul 05 18:33:42 2011 +0200
@@ -70,7 +70,16 @@
void HWNewNet::Connect(const QString & hostName, quint16 port, const QString & nick)
{
- mynick = nick.isEmpty() ? QLineEdit::tr("unnamed") : nick;
+ mynick = nick;
+ while (mynick.isEmpty()) {
+ mynick = QInputDialog::getText(m_pGameCFGWidget,
+ QObject::tr("Nickname"),
+ QObject::tr("Please enter your nickname"),
+ QLineEdit::Normal,
+ QDir::home().dirName());
+ config->setValue("net/nick",mynick);
+ config->updNetNick();
+ }
myhost = hostName + QString(":%1").arg(port);
NetSocket.connectToHost(hostName, port);
}
@@ -507,7 +516,7 @@
// If the password is blank, ask the user to enter one in
if (passLength == 0)
{
- QString password = QInputDialog::getText(0, tr("Password"), tr("Your nickname %1 is\nregistered on Hedgewars.org\nPlease provide your password below\nor pick another nickname in game config:").arg(mynick), QLineEdit::Password, passLength==0?NULL:QString(passLength,'\0'), &ok);
+ QString password = QInputDialog::getText(m_pGameCFGWidget, tr("Password"), tr("Your nickname %1 is\nregistered on Hedgewars.org\nPlease provide your password below\nor pick another nickname in game config:").arg(mynick), QLineEdit::Password, passLength==0?NULL:QString(passLength,'\0'), &ok);
if (!ok) {
Disconnect();
@@ -831,6 +840,7 @@
}
config->setValue("net/nick", newNick);
+ config->updNetNick();
mynick = newNick;
RawSendNet(QString("NICK%1%2").arg(delimeter).arg(newNick));
--- a/hedgewars/GSHandlers.inc Tue Jul 05 18:27:18 2011 +0200
+++ b/hedgewars/GSHandlers.inc Tue Jul 05 18:33:42 2011 +0200
@@ -1080,31 +1080,22 @@
AddCaption(trmsg[sidStartFight], cWhiteColor, capgrpGameState);
end
end;
- gtATSmoothWindCh:
-begin
- if Gear^.Timer = 0 then
+ gtATFinishGame:
begin
- if WindBarWidth < Gear^.Tag then inc(WindBarWidth)
- else if WindBarWidth > Gear^.Tag then dec(WindBarWidth);
- if WindBarWidth <> Gear^.Tag then Gear^.Timer := 10;
- end
-end;
-gtATFinishGame:
-begin
- AllInactive := false;
- if Gear^.Timer = 1000 then
- begin
- ScreenFade := sfToBlack;
- ScreenFadeValue := 0;
- ScreenFadeSpeed := 1;
+ AllInactive := false;
+ if Gear^.Timer = 1000 then
+ begin
+ ScreenFade := sfToBlack;
+ ScreenFadeValue := 0;
+ ScreenFadeSpeed := 1;
+ end;
+ if Gear^.Timer = 0 then
+ begin
+ SendIPC('N');
+ SendIPC('q');
+ GameState := gsExit
+ end
end;
- if Gear^.Timer = 0 then
- begin
- SendIPC('N');
- SendIPC('q');
- GameState := gsExit
- end
-end;
end;
if Gear^.Timer = 0 then DeleteGear(Gear)
end;
@@ -1877,6 +1868,7 @@
i: LongInt;
particle: PVisualGear;
begin
+ if (Gear^.dY.QWordValue = 0) and (Gear^.dY.QWordValue = 0) and not TestCollisionYwithGear(Gear, 1) then SetLittle(Gear^.dY);
Gear^.State := Gear^.State or gstAnimation;
if ((Gear^.dX.QWordValue <> 0) or (Gear^.dY.QWordValue <> 0)) then
begin
@@ -2416,7 +2408,7 @@
// calcs for Napalm Strike, so that it will hit the target (without wind at least :P)
if (Gear^.State = 2) then
- Gear^.dX := Gear^.dX - cBombsSpeed * Gear^.Tag * 1000 // ^.Timer of gtNapalmBomb, make it a constant var if you prefer that :P
+ Gear^.dX := Gear^.dX - cBombsSpeed * Gear^.Tag * 900
// calcs for regular falling gears
else if (int2hwFloat(TargetPoint.Y) - Gear^.Y > _0) then
Gear^.dX := Gear^.dX - cBombsSpeed * hwSqrt((int2hwFloat(TargetPoint.Y) - Gear^.Y) * 2 /
--- a/hedgewars/HHHandlers.inc Tue Jul 05 18:27:18 2011 +0200
+++ b/hedgewars/HHHandlers.inc Tue Jul 05 18:33:42 2011 +0200
@@ -285,6 +285,8 @@
// we save CurWeapon^.Pos (in this case: cursor direction) by using it as (otherwise irrelevant) X value of the new gear.
amAirAttack: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 0, _0, _0, 0);
amMineStrike: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 1, _0, _0, 0);
+ amDrillStrike: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 3, _0, _0, CurWeapon^.Timer);
+ amNapalm: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 2, _0, _0, 0);
amBlowTorch: newGear:= AddGear(hwRound(lx), hwRound(ly), gtBlowTorch, 0, SignAs(_0_5, dX), _0, 0);
amGirder: newGear:= AddGear(0, 0, gtGirder, CurWeapon^.Pos, _0, _0, 0);
amTeleport: newGear:= AddGear(CurWeapon^.Pos, 0, gtTeleport, 0, _0, _0, 0);
@@ -302,7 +304,6 @@
amSeduction: newGear:= AddGear(hwRound(lx + xx * cHHRadius * 2), hwRound(ly + yy * cHHRadius * 2), gtSeduction, 0, xx * _0_4, yy * _0_4, 0);
amWatermelon: newGear:= AddGear(hwRound(lx), hwRound(ly), gtWatermelon, 0, newDx, newDy, CurWeapon^.Timer);
amHellishBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtHellishBomb, 0, newDx, newDy, 0);
- amNapalm: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 2, _0, _0, 0);
amDrill: newGear:= AddGear(hwRound(lx), hwRound(ly), gtDrill, 0, newDx, newDy, 0);
amBallgun: newGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun, 0, xx * _0_5, yy * _0_5, 0);
amJetpack: newGear:= AddGear(hwRound(lx), hwRound(ly), gtJetpack, 0, _0, _0, 0);
@@ -344,7 +345,6 @@
gtResurrector, 0, _0, _0, 0);
newGear^.SoundChannel := LoopSound(sndResurrector);
end;
- amDrillStrike: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 3, _0, _0, CurWeapon^.Timer);
//amMelonStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 4, _0, _0, 0);
amStructure: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtStructure, gstWait, SignAs(_0_02, dX), _0, 3000);
amTardis: newGear:= AddGear(hwRound(X), hwRound(Y), gtTardis, 0, _0, _0, 5000);
--- a/hedgewars/uAI.pas Tue Jul 05 18:27:18 2011 +0200
+++ b/hedgewars/uAI.pas Tue Jul 05 18:33:42 2011 +0200
@@ -86,7 +86,6 @@
begin
BestActions:= Actions;
inc(BestActions.Score, Score);
- addfilelog('AI: curr score ' + inttostr(bestactions.score));
if (ap.Angle > 0) then AddAction(BestActions, aia_LookRight, 0, 200, 0, 0)
else if (ap.Angle < 0) then AddAction(BestActions, aia_LookLeft, 0, 200, 0, 0);
--- a/hedgewars/uChat.pas Tue Jul 05 18:27:18 2011 +0200
+++ b/hedgewars/uChat.pas Tue Jul 05 18:33:42 2011 +0200
@@ -51,12 +51,13 @@
ChatReady: boolean;
showAll: boolean;
-const colors: array[#1..#5] of TSDL_Color = (
+const colors: array[#1..#6] of TSDL_Color = (
(r:$FF; g:$FF; b:$FF; unused:$FF), // chat message [White]
(r:$FF; g:$00; b:$FF; unused:$FF), // action message [Purple]
(r:$90; g:$FF; b:$90; unused:$FF), // join/leave message [Lime]
(r:$FF; g:$FF; b:$A0; unused:$FF), // team message [Light Yellow]
- (r:$FF; g:$00; b:$00; unused:$ff) // error messages [Red]
+ (r:$FF; g:$00; b:$00; unused:$FF), // error messages [Red]
+ (r:$00; g:$FF; b:$FF; unused:$FF) // input line [Light Blue]
);
procedure SetLine(var cl: TChatLine; str: shortstring; isInput: boolean);
@@ -72,11 +73,7 @@
if isInput then
begin
- // [Light Blue]
- color.r:= $00;
- color.g:= $FF;
- color.b:= $FF;
- color.unused:= $FF;
+ color:= colors[#6];
str:= UserNick + '> ' + str + '_'
end
else
@@ -153,14 +150,9 @@
dec(r.y, 16);
-while
- (
- ((t < 7) and (Strs[i].Time > RealTicks))
- or
- ((t < MaxStrIndex) and showAll)
- )
- and
- (Strs[i].Tex <> nil) do
+while (((t < 7) and (Strs[i].Time > RealTicks)) or
+ ((t < MaxStrIndex) and showAll)) and
+ (Strs[i].Tex <> nil) do
begin
r.w:= Strs[i].Width;
DrawFillRect(r);
--- a/hedgewars/uLandGraphics.pas Tue Jul 05 18:27:18 2011 +0200
+++ b/hedgewars/uLandGraphics.pas Tue Jul 05 18:33:42 2011 +0200
@@ -29,7 +29,7 @@
function addBgColor(OldColor, NewColor: LongWord): LongWord;
function SweepDirty: boolean;
-function Despeckle(X, Y: LongInt): boolean;
+function Despeckle(X, Y: LongInt; gfxOnly: boolean): LongWord;
procedure Smooth(X, Y: LongInt);
function CheckLandValue(X, Y: LongInt; LandFlag: Word): boolean;
function DrawExplosion(X, Y, Radius: LongInt): Longword;
@@ -700,7 +700,7 @@
end;
// was experimenting with applying as damage occurred.
-function Despeckle(X, Y: LongInt): boolean;
+function Despeckle(X, Y: LongInt; gfxOnly: boolean): LongWord;
var nx, ny, i, j, c, xx, yy: LongInt;
pixelsweep: boolean;
begin
@@ -715,6 +715,7 @@
yy:= Y div 2;
end;
pixelsweep:= ((Land[Y, X] and $FF00) = 0) and (LandPixels[yy, xx] <> 0);
+if not pixelsweep and gfxOnly then exit(0);
if ((Land[Y, X] > 255) and ((Land[Y, X] and lfIndestructible) = 0)) or pixelsweep then
begin
c:= 0;
@@ -747,10 +748,11 @@
LandPixels[yy, xx]:= 0;
Land[Y, X]:= 0;
- exit(true);
+ if not pixelsweep then exit(1) // cannot exit true on pixel sweep, or risk desyncs due to inconsistent resweeps
+ else exit(2)
end;
end;
-Despeckle:= false
+Despeckle:= 0
end;
procedure Smooth(X, Y: LongInt);
@@ -797,8 +799,8 @@
end;
function SweepDirty: boolean;
-var x, y, xx, yy, ty, tx: LongInt;
- bRes, updateBlock, resweep, recheck, firstpass: boolean;
+var x, y, xx, yy, ty, tx, d: LongInt;
+ bRes, updateBlock, resweepCol, resweepGfx, gfxOnly, recheck, firstpass: boolean;
begin
bRes:= false;
reCheck:= true;
@@ -813,41 +815,47 @@
if LandDirty[y, x] <> 0 then
begin
updateBlock:= false;
- resweep:= true;
+ resweepCol:= true;
+ resweepGfx:= true;
firstpass:= true;
ty:= y * 32;
tx:= x * 32;
- while(resweep) do
+ while(resweepCol or resweepGfx) do
begin
- resweep:= false;
+ gfxOnly:= resweepGfx and not resweepCol;
+ resweepCol:= false;
+ resweepGfx:= false;
for yy:= ty to ty + 31 do
for xx:= tx to tx + 31 do
begin
- if Despeckle(xx, yy) then
+ d:= Despeckle(xx, yy, gfxOnly);
+ if d <> 0 then
begin
bRes:= true;
updateBlock:= true;
- resweep:= true;
- if (yy = ty) and (y > 0) then
- begin
- LandDirty[y-1, x]:= 1;
- recheck:= true;
- end
- else if (yy = ty+31) and (y < LAND_HEIGHT div 32 - 1) then
- begin
- LandDirty[y+1, x]:= 1;
- recheck:= true;
- end;
- if (xx = tx) and (x > 0) then
- begin
- LandDirty[y, x-1]:= 1;
- recheck:= true;
- end
- else if (xx = tx+31) and (x < LAND_WIDTH div 32 - 1) then
- begin
- LandDirty[y, x+1]:= 1;
- recheck:= true;
- end
+ if d = 1 then resweepCol:= true
+ else resweepGfx:= true;
+ if d = 1 then
+ if (yy = ty) and (y > 0) then
+ begin
+ LandDirty[y-1, x]:= 1;
+ recheck:= true;
+ end
+ else if (yy = ty+31) and (y < LAND_HEIGHT div 32 - 1) then
+ begin
+ LandDirty[y+1, x]:= 1;
+ recheck:= true;
+ end;
+ if (xx = tx) and (x > 0) then
+ begin
+ LandDirty[y, x-1]:= 1;
+ recheck:= true;
+ end
+ else if (xx = tx+31) and (x < LAND_WIDTH div 32 - 1) then
+ begin
+ LandDirty[y, x+1]:= 1;
+ recheck:= true;
+ end
end;
if firstpass then Smooth(xx,yy);
end;
--- a/hedgewars/uVariables.pas Tue Jul 05 18:27:18 2011 +0200
+++ b/hedgewars/uVariables.pas Tue Jul 05 18:33:42 2011 +0200
@@ -865,8 +865,8 @@
maxAngle: 0;
isDamaging: true;
SkipTurns: 0;
- PosCount: 1;
- PosSprite: sprWater;
+ PosCount: 2;
+ PosSprite: sprTargetBee;
ejectX: 0; //16;
ejectY: 0),
--- a/hedgewars/uWorld.pas Tue Jul 05 18:27:18 2011 +0200
+++ b/hedgewars/uWorld.pas Tue Jul 05 18:33:42 2011 +0200
@@ -749,7 +749,7 @@
tdx, tdy: Double;
s: string[15];
highlight: Boolean;
- offsetX, offsetY, screenBottom: LongInt;
+ smallScreenOffset, offsetX, offsetY, screenBottom: LongInt;
VertexBuffer: array [0..3] of TVertex2f;
begin
if (cReducedQuality and rqNoBackground) = 0 then
@@ -865,11 +865,11 @@
begin
with PHedgehog(CurrentHedgehog)^ do
begin
- if (CurAmmoType = amBee) then
+ if CurAmmoType = amBee then
DrawRotatedF(sprTargetBee, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
else
- DrawRotatedF(sprTargetP, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360);
- end;
+ DrawRotatedF(sprTargetP, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
+ end
end;
{$WARNINGS ON}
@@ -907,6 +907,13 @@
DrawCaptions;
// Teams Healths
+if TeamsCount * 20 > cScreenHeight div 7 then // take up less screen on small displays
+ begin
+ SetScale(1.5);
+ smallScreenOffset:= cScreenHeight div 6;
+ if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$80);
+ end
+else smallScreenOffset:= 0;
for t:= 0 to Pred(TeamsCount) do
with TeamsArray[t]^ do
begin
@@ -916,26 +923,26 @@
Tint(Clan^.Color shl 8 or $FF);
// draw name
- DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY, NameTagTex);
+ DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY + smallScreenOffset, NameTagTex);
// draw flag
- DrawTexture(-14, cScreenHeight + DrawHealthY, FlagTex);
+ DrawTexture(-14, cScreenHeight + DrawHealthY + smallScreenOffset, FlagTex);
// draw health bar
r.x:= 0;
r.y:= 0;
r.w:= 2 + TeamHealthBarWidth;
r.h:= HealthTex^.h;
- DrawFromRect(14, cScreenHeight + DrawHealthY, @r, HealthTex);
+ DrawFromRect(14, cScreenHeight + DrawHealthY + smallScreenOffset, @r, HealthTex);
// draw health bars right border
inc(r.x, cTeamHealthWidth + 2);
r.w:= 3;
- DrawFromRect(TeamHealthBarWidth + 16, cScreenHeight + DrawHealthY, @r, HealthTex);
+ DrawFromRect(TeamHealthBarWidth + 16, cScreenHeight + DrawHealthY + smallScreenOffset, @r, HealthTex);
// draw ai kill counter for gfAISurvival
if (GameFlags and gfAISurvival) <> 0 then begin
- DrawTexture(TeamHealthBarWidth + 22, cScreenHeight + DrawHealthY,
+ DrawTexture(TeamHealthBarWidth + 22, cScreenHeight + DrawHealthY + smallScreenOffset,
AIKillsTex);
end;
@@ -943,24 +950,30 @@
// this approach should be faster than drawing all borders one by one tinted or not
if highlight then
begin
- Tint($FF, $FF, $FF, $FF);
+ if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$80)
+ else Tint($FF, $FF, $FF, $FF);
// draw name
r.x:= 2;
r.y:= 2;
r.w:= NameTagTex^.w - 4;
r.h:= NameTagTex^.h - 4;
- DrawFromRect(-NameTagTex^.w - 14, cScreenHeight + DrawHealthY + 2, @r, NameTagTex);
+ DrawFromRect(-NameTagTex^.w - 14, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, NameTagTex);
// draw flag
r.w:= 22;
r.h:= 15;
- DrawFromRect(-12, cScreenHeight + DrawHealthY + 2, @r, FlagTex);
+ DrawFromRect(-12, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, FlagTex);
// draw health bar
r.w:= TeamHealthBarWidth + 1;
r.h:= HealthTex^.h - 4;
- DrawFromRect(16, cScreenHeight + DrawHealthY + 2, @r, HealthTex);
+ DrawFromRect(16, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, HealthTex);
end;
end;
+if smallScreenOffset <> 0 then
+ begin
+ SetScale(zoom);
+ if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$FF);
+ end;
// Lag alert
if isInLag then DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
@@ -1144,6 +1157,8 @@
with CurrentHedgehog^ do
if (Gear <> nil) and ((Gear^.State and gstHHChooseTarget) <> 0) then
begin
+ if CurAmmoType = amNapalm then
+ DrawLine(-3000, topY-300, 7000, topY-300, 3.0, (Team^.Clan^.Color shr 16), (Team^.Clan^.Color shr 8) and $FF, Team^.Clan^.Color and $FF, $FF);
i:= GetAmmoEntry(CurrentHedgehog^)^.Pos;
with Ammoz[CurAmmoType] do
if PosCount > 1 then
--- a/project_files/HedgewarsMobile/Classes/CreationChamber.m Tue Jul 05 18:27:18 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/CreationChamber.m Tue Jul 05 18:33:42 2011 +0200
@@ -96,9 +96,9 @@
switch (type) {
default: //default
qt = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_QT length:ammolineSize encoding:NSUTF8StringEncoding];
- prob = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_QT length:ammolineSize encoding:NSUTF8StringEncoding];
- delay = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_QT length:ammolineSize encoding:NSUTF8StringEncoding];
- crate = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_QT length:ammolineSize encoding:NSUTF8StringEncoding];
+ prob = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_PROB length:ammolineSize encoding:NSUTF8StringEncoding];
+ delay = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_DELAY length:ammolineSize encoding:NSUTF8StringEncoding];
+ crate = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_CRATE length:ammolineSize encoding:NSUTF8StringEncoding];
break;
case 1: //crazy
qt = [[NSString alloc] initWithBytes:AMMOLINE_CRAZY_QT length:ammolineSize encoding:NSUTF8StringEncoding];
--- a/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m Tue Jul 05 18:27:18 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m Tue Jul 05 18:33:42 2011 +0200
@@ -285,6 +285,11 @@
NSString *saveHeader = @"TS";
[self dumpRawData:[saveHeader UTF8String] ofSize:[saveHeader length]];
+ // lua script (if set)
+ NSString *script = [gameConfig objectForKey:@"mission_command"];
+ if ([script length] != 0)
+ [self sendToEngine:script];
+
// seed info
[self sendToEngine:[gameConfig objectForKey:@"seed_command"]];
@@ -298,11 +303,6 @@
if ([staticMap length] != 0)
[self sendToEngine:staticMap];
- // lua script (if set)
- NSString *script = [gameConfig objectForKey:@"mission_command"];
- if ([script length] != 0)
- [self sendToEngine:script];
-
// theme info
[self sendToEngine:[gameConfig objectForKey:@"theme_command"]];
--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Tue Jul 05 18:27:18 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Tue Jul 05 18:33:42 2011 +0200
@@ -183,8 +183,7 @@
// release the network manager and the savepath as they are not needed anymore
releaseAndNil(self.engineProtocol);
- if (self.gameType != gtSave)
- releaseAndNil(self.savePath);
+ releaseAndNil(self.savePath);
if ([[userDefaults objectForKey:@"music"] boolValue])
[HedgewarsAppDelegate playBackgroundMusic];
@@ -210,7 +209,7 @@
// set up variables for a save game
-(void) startSaveGame:(NSString *)atPath {
self.gameType = gtSave;
- self.savePath = atPath;
+ self.savePath = [atPath retain];
[self.engineProtocol spawnThread:self.savePath];
[self prepareEngineLaunch];
--- a/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m Tue Jul 05 18:27:18 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m Tue Jul 05 18:33:42 2011 +0200
@@ -62,6 +62,9 @@
[settings setObject:[NSNumber numberWithBool:NO] forKey:@"music"];
theOtherSwitch = (UISwitch *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:1]].accessoryView;
[theOtherSwitch setOn:NO animated:YES];
+
+ if (theOtherSwitch.on)
+ [HedgewarsAppDelegate pauseBackgroundMusic];
break;
case 20: //musicSwitch
// if switch above (sound) is off, never turn on
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Tue Jul 05 18:27:18 2011 +0200
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Tue Jul 05 18:33:42 2011 +0200
@@ -701,7 +701,6 @@
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
- 612CABAA1391CE68005E9596 /* AVFoundation.framework */,
619599BA1364E65900B429B6 /* Freetype.xcodeproj */,
6195993F1364C82B00B429B6 /* Lua.xcodeproj */,
619598181364BCD200B429B6 /* Tremor.xcodeproj */,
@@ -711,6 +710,7 @@
618E27B612A2C30700C20EF0 /* SDL_net.xcodeproj */,
61798A0B114AB65600BA94A9 /* SDL_ttf.xcodeproj */,
61798934114AB25F00BA94A9 /* AudioToolbox.framework */,
+ 612CABAA1391CE68005E9596 /* AVFoundation.framework */,
61A117FE1168322700359010 /* CoreGraphics.framework */,
1D30AB110D05D00D00671497 /* Foundation.framework */,
28FD14FF0DC6FC520079059D /* OpenGLES.framework */,
--- a/share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua Tue Jul 05 18:27:18 2011 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua Tue Jul 05 18:33:42 2011 +0200
@@ -1,5 +1,5 @@
----------------------------------
--- THE SPECIALISTS MODE 0.3
+-- THE SPECIALISTS MODE 0.4
-- by mikade
----------------------------------
@@ -22,6 +22,13 @@
-- added switching on start
-- removed switch from engineer weaponset
+----------------
+-- version 0.4
+----------------
+-- Attempted to:
+-- fix potential switch explit
+-- improve user feedback on start
+
--------------------
--TO DO
--------------------
@@ -32,204 +39,204 @@
loadfile(GetDataPath() .. "Scripts/Locale.lua")()
-local numhhs = 0
-local hhs = {}
+local numhhs = 0
+local hhs = {}
-local currName
+local currName
local lastName
local started = false
local switchStage = 0
function CreateTeam()
- currTeam = ""
- lastTeam = ""
- z = 0
+ currTeam = ""
+ lastTeam = ""
+ z = 0
- for i = 0, (numhhs-1) do
+ for i = 0, (numhhs-1) do
- currTeam = GetHogTeamName(hhs[i])
+ currTeam = GetHogTeamName(hhs[i])
- if currTeam == lastTeam then
- z = z + 1
- else
- z = 1
- end
+ if currTeam == lastTeam then
+ z = z + 1
+ else
+ z = 1
+ end
- if z == 1 then
+ if z == 1 then
- SetHogName(hhs[i],"Soldier")
- SetHogHat(hhs[i], "Vega")
- SetHealth(hhs[i],200)
+ SetHogName(hhs[i],"Soldier")
+ SetHogHat(hhs[i], "Vega")
+ SetHealth(hhs[i],200)
- elseif z == 2 then
+ elseif z == 2 then
- SetHogHat(hhs[i], "Glasses")
- SetHogName(hhs[i],"Engineer")
+ SetHogHat(hhs[i], "Glasses")
+ SetHogName(hhs[i],"Engineer")
- elseif z == 3 then
+ elseif z == 3 then
- SetHogName(hhs[i],"Ninja")
- SetHogHat(hhs[i], "NinjaFull")
- SetHealth(hhs[i],80)
+ SetHogName(hhs[i],"Ninja")
+ SetHogHat(hhs[i], "NinjaFull")
+ SetHealth(hhs[i],80)
- elseif z == 4 then
+ elseif z == 4 then
- SetHogName(hhs[i],"Demo")
- SetHogHat(hhs[i], "Skull")
- SetHealth(hhs[i],200)
+ SetHogName(hhs[i],"Demo")
+ SetHogHat(hhs[i], "Skull")
+ SetHealth(hhs[i],200)
- elseif z == 5 then
+ elseif z == 5 then
- SetHogName(hhs[i],"Sniper")
- SetHogHat(hhs[i], "Sniper")
- SetHealth(hhs[i],120)
+ SetHogName(hhs[i],"Sniper")
+ SetHogHat(hhs[i], "Sniper")
+ SetHealth(hhs[i],120)
- elseif z == 6 then
+ elseif z == 6 then
- SetHogName(hhs[i],"Saint")
- SetHogHat(hhs[i], "angel")
- SetHealth(hhs[i],300)
+ SetHogName(hhs[i],"Saint")
+ SetHogHat(hhs[i], "angel")
+ SetHealth(hhs[i],300)
- elseif z == 7 then
+ elseif z == 7 then
+
+ SetHogName(hhs[i],"Pyro")
+ SetHogHat(hhs[i], "Gasmask")
+ SetHealth(hhs[i],150)
+
+ elseif z == 8 then
- SetHogName(hhs[i],"Pyro")
- SetHogHat(hhs[i], "Gasmask")
- SetHealth(hhs[i],150)
-
- elseif z == 8 then
-
- SetHogName(hhs[i],"Loon")
- SetHogHat(hhs[i], "clown")
- SetHealth(hhs[i],100)
+ SetHogName(hhs[i],"Loon")
+ SetHogHat(hhs[i], "clown")
+ SetHealth(hhs[i],100)
- end
+ end
- lastTeam = GetHogTeamName(hhs[i])
+ lastTeam = GetHogTeamName(hhs[i])
- end
+ end
end
function ResetAllAmmo()
- AddAmmo(CurrentHedgehog, amBazooka, 0)
- AddAmmo(CurrentHedgehog, amGrenade, 0)
- AddAmmo(CurrentHedgehog, amShotgun, 0)
-
- AddAmmo(CurrentHedgehog, amGirder, 0)
- AddAmmo(CurrentHedgehog, amBlowTorch, 0)
- AddAmmo(CurrentHedgehog, amPickHammer, 0)
- AddAmmo(CurrentHedgehog, amSwitch, 0)
+ AddAmmo(CurrentHedgehog, amBazooka, 0)
+ AddAmmo(CurrentHedgehog, amGrenade, 0)
+ AddAmmo(CurrentHedgehog, amShotgun, 0)
- AddAmmo(CurrentHedgehog, amRope, 0)
- AddAmmo(CurrentHedgehog, amParachute, 0)
- AddAmmo(CurrentHedgehog, amFirePunch, 0)
+ AddAmmo(CurrentHedgehog, amGirder, 0)
+ AddAmmo(CurrentHedgehog, amBlowTorch, 0)
+ AddAmmo(CurrentHedgehog, amPickHammer, 0)
+ AddAmmo(CurrentHedgehog, amSwitch, 0)
+
+ AddAmmo(CurrentHedgehog, amRope, 0)
+ AddAmmo(CurrentHedgehog, amParachute, 0)
+ AddAmmo(CurrentHedgehog, amFirePunch, 0)
- AddAmmo(CurrentHedgehog, amDynamite, 0)
- AddAmmo(CurrentHedgehog, amDrill, 0)
- AddAmmo(CurrentHedgehog, amMine, 0)
+ AddAmmo(CurrentHedgehog, amDynamite, 0)
+ AddAmmo(CurrentHedgehog, amDrill, 0)
+ AddAmmo(CurrentHedgehog, amMine, 0)
- AddAmmo(CurrentHedgehog, amSniperRifle, 0)
- AddAmmo(CurrentHedgehog, amDEagle, 0)
- AddAmmo(CurrentHedgehog, amPortalGun, 0)
+ AddAmmo(CurrentHedgehog, amSniperRifle, 0)
+ AddAmmo(CurrentHedgehog, amDEagle, 0)
+ AddAmmo(CurrentHedgehog, amPortalGun, 0)
- AddAmmo(CurrentHedgehog, amSeduction, 0)
- AddAmmo(CurrentHedgehog, amResurrector, 0)
- AddAmmo(CurrentHedgehog, amInvulnerable, 0)
-
- AddAmmo(CurrentHedgehog, amFlamethrower, 0)
- AddAmmo(CurrentHedgehog, amMolotov, 0)
- AddAmmo(CurrentHedgehog, amNapalm, 0)
-
- AddAmmo(CurrentHedgehog, amBaseballBat, 0)
- AddAmmo(CurrentHedgehog, amGasBomb, 0)
- AddAmmo(CurrentHedgehog, amKamikaze, 0)
+ AddAmmo(CurrentHedgehog, amSeduction, 0)
+ AddAmmo(CurrentHedgehog, amResurrector, 0)
+ AddAmmo(CurrentHedgehog, amInvulnerable, 0)
+
+ AddAmmo(CurrentHedgehog, amFlamethrower, 0)
+ AddAmmo(CurrentHedgehog, amMolotov, 0)
+ AddAmmo(CurrentHedgehog, amNapalm, 0)
+
+ AddAmmo(CurrentHedgehog, amBaseballBat, 0)
+ AddAmmo(CurrentHedgehog, amGasBomb, 0)
+ AddAmmo(CurrentHedgehog, amKamikaze, 0)
end
function AssignAmmo()
- ResetAllAmmo()
- n = GetHogName(CurrentHedgehog)
+ ResetAllAmmo()
+ n = GetHogName(CurrentHedgehog)
- AddAmmo(CurrentHedgehog, amSkip,100)
+ AddAmmo(CurrentHedgehog, amSkip,100)
- if n == "Soldier" then
- AddAmmo(CurrentHedgehog, amBazooka,1)
- AddAmmo(CurrentHedgehog, amGrenade,1)
- AddAmmo(CurrentHedgehog, amShotgun,1)
- elseif n == "Engineer" then
- AddAmmo(CurrentHedgehog, amGirder, 2)
- AddAmmo(CurrentHedgehog, amBlowTorch, 1)
- AddAmmo(CurrentHedgehog, amPickHammer, 1)
- --AddAmmo(CurrentHedgehog, amSwitch, 2)
- elseif n == "Ninja" then
- AddAmmo(CurrentHedgehog, amRope, 100)
- AddAmmo(CurrentHedgehog, amParachute, 100)
- AddAmmo(CurrentHedgehog, amFirePunch, 1)
- elseif n == "Demo" then
- AddAmmo(CurrentHedgehog, amDynamite, 1)
- AddAmmo(CurrentHedgehog, amMine, 1)
- AddAmmo(CurrentHedgehog, amDrill, 1)
- elseif n == "Sniper" then
- AddAmmo(CurrentHedgehog, amSniperRifle, 1)
- AddAmmo(CurrentHedgehog, amDEagle, 1)
- AddAmmo(CurrentHedgehog, amPortalGun, 2)
- elseif n == "Saint" then
- AddAmmo(CurrentHedgehog, amSeduction, 100)
- AddAmmo(CurrentHedgehog, amResurrector, 1)
- AddAmmo(CurrentHedgehog, amInvulnerable, 1)
- elseif n == "Pyro" then
- AddAmmo(CurrentHedgehog, amFlamethrower, 1)
- AddAmmo(CurrentHedgehog, amMolotov, 1)
- AddAmmo(CurrentHedgehog, amNapalm, 1)
- elseif n == "Loon" then
- AddAmmo(CurrentHedgehog, amBaseballBat, 1)
- AddAmmo(CurrentHedgehog, amGasBomb, 1)
- AddAmmo(CurrentHedgehog, amKamikaze, 1)
- end
+ if n == "Soldier" then
+ AddAmmo(CurrentHedgehog, amBazooka,1)
+ AddAmmo(CurrentHedgehog, amGrenade,1)
+ AddAmmo(CurrentHedgehog, amShotgun,1)
+ elseif n == "Engineer" then
+ AddAmmo(CurrentHedgehog, amGirder, 2)
+ AddAmmo(CurrentHedgehog, amBlowTorch, 1)
+ AddAmmo(CurrentHedgehog, amPickHammer, 1)
+ elseif n == "Ninja" then
+ AddAmmo(CurrentHedgehog, amRope, 100)
+ AddAmmo(CurrentHedgehog, amParachute, 100)
+ AddAmmo(CurrentHedgehog, amFirePunch, 1)
+ elseif n == "Demo" then
+ AddAmmo(CurrentHedgehog, amDynamite, 1)
+ AddAmmo(CurrentHedgehog, amMine, 1)
+ AddAmmo(CurrentHedgehog, amDrill, 1)
+ elseif n == "Sniper" then
+ AddAmmo(CurrentHedgehog, amSniperRifle, 1)
+ AddAmmo(CurrentHedgehog, amDEagle, 1)
+ AddAmmo(CurrentHedgehog, amPortalGun, 2)
+ elseif n == "Saint" then
+ AddAmmo(CurrentHedgehog, amSeduction, 100)
+ AddAmmo(CurrentHedgehog, amResurrector, 1)
+ AddAmmo(CurrentHedgehog, amInvulnerable, 1)
+ elseif n == "Pyro" then
+ AddAmmo(CurrentHedgehog, amFlamethrower, 1)
+ AddAmmo(CurrentHedgehog, amMolotov, 1)
+ AddAmmo(CurrentHedgehog, amNapalm, 1)
+ elseif n == "Loon" then
+ AddAmmo(CurrentHedgehog, amBaseballBat, 1)
+ AddAmmo(CurrentHedgehog, amGasBomb, 1)
+ AddAmmo(CurrentHedgehog, amKamikaze, 1)
+ end
end
function onGameInit()
- GameFlags = gfRandomOrder + gfResetWeps + gfInfAttack + gfPlaceHog
- Delay = 10
+ GameFlags = gfRandomOrder + gfResetWeps + gfInfAttack + gfPlaceHog
+ Delay = 10
end
function onGameStart()
-
- CreateTeam()
+
+ CreateTeam()
- ShowMission (
- loc("THE SPECIALISTS"),
- loc("a Hedgewars mini-game"),
+ ShowMission (
+ loc("THE SPECIALISTS"),
+ loc("a Hedgewars mini-game"),
- loc("Eliminate the enemy specialists.") .. "|" ..
- " " .. "|" ..
+ loc("Eliminate the enemy specialists.") .. "|" ..
+ " " .. "|" ..
- loc("Game Modifiers: ") .. "|" ..
- loc("Per-Hog Ammo") .. "|" ..
- loc("Weapons Reset") .. "|" ..
- loc("Unlimited Attacks") .. "|" ..
+ loc("Game Modifiers: ") .. "|" ..
+ loc("Per-Hog Ammo") .. "|" ..
+ loc("Weapons Reset") .. "|" ..
+ loc("Unlimited Attacks") .. "|" ..
- "", 4, 4000
- )
+ "", 4, 4000
+ )
end
function onNewTurn()
- currName = GetHogName(CurrentHedgehog)
- lastName = GetHogName(CurrentHedgehog)
- AssignAmmo()
-
- --AddAmmo(CurrentHedgehog, amSwitch, 1)
+ currName = GetHogName(CurrentHedgehog)
+ lastName = GetHogName(CurrentHedgehog)
+ AssignAmmo()
+
+ ---------------
+ --switch
+ started = false
+ switchStage = 0
+ --AddAmmo(CurrentHedgehog, amSwitch, 1)
---------------
- --switch
- started = false
- switchStage = 0
- ---------------
+
end
function onGameTick()
@@ -238,27 +245,30 @@
currName = GetHogName(CurrentHedgehog)
- if currName ~= lastName then
+ if (currName ~= lastName) and (switchStage > 100) then
AddCaption(loc("Switched to ") .. currName .. "!")
AssignAmmo()
end
if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and (switchStage < 100) then
+ AddCaption(loc("Prepare yourself") .. ", " .. currName .. "!")
+
switchStage = switchStage + 1
- if switchStage == 10 then
+ if switchStage == 1 then
AddAmmo(CurrentHedgehog, amSwitch, 1)
- elseif switchStage == 20 then
+
+ elseif switchStage == 2 then
ParseCommand("setweap " .. string.char(amSwitch))
- elseif switchStage == 30 then
+ elseif switchStage == 3 then
SetGearMessage(CurrentHedgehog,gmAttack)
+ elseif switchStage == 4 then
switchStage = 110
+ AddAmmo(CurrentHedgehog, amSwitch, 0)
end
end
- --------------------------------------------------------------------------------------
-
lastName = currName
end
@@ -266,11 +276,11 @@
end
function onGearAdd(gear)
-
- if GetGearType(gear) == gtHedgehog then
- hhs[numhhs] = gear
- numhhs = numhhs + 1
- end
+
+ if GetGearType(gear) == gtHedgehog then
+ hhs[numhhs] = gear
+ numhhs = numhhs + 1
+ end
end
@@ -282,5 +292,3 @@
--
end
-
-