- Initialize translations earlier
authorunc0rr
Sat, 12 Aug 2006 17:41:02 +0000
changeset 109 ab0340f580c2
parent 108 08f1fe6f21f8
child 110 330a2dbacd67
- Initialize translations earlier - Fix some small issues and small cleanup
QTfrontend/main.cpp
hedgewars/GSHandlers.inc
hedgewars/SDLh.pas
hedgewars/hwengine.dpr
hedgewars/uConsts.pas
hedgewars/uGame.pas
hedgewars/uKeys.pas
hedgewars/uLand.pas
hedgewars/uLandGraphics.pas
hedgewars/uLandTemplates.pas
hedgewars/uWorld.pas
--- a/QTfrontend/main.cpp	Fri Aug 11 20:00:29 2006 +0000
+++ b/QTfrontend/main.cpp	Sat Aug 12 17:41:02 2006 +0000
@@ -47,6 +47,12 @@
 {
 	QApplication app(argc, argv);
 
+	Q_INIT_RESOURCE(hedgewars);
+
+	QTranslator Translator;
+	Translator.load(":/translations/hedgewars_" + QLocale::system().name());
+	app.installTranslator(&Translator);
+
 	QDir mydir = QFileInfo(argv[0]).dir();
 	bindir = new QDir(mydir);
 	cfgdir = new QDir();
@@ -67,12 +73,6 @@
 	datadir = new QDir(mydir);
 	datadir->cd("../share/hedgewars/Data");
 
-	Q_INIT_RESOURCE(hedgewars);
-
-	QTranslator Translator;
-	Translator.load(":/translations/hedgewars_" + QLocale::system().name());
-	app.installTranslator(&Translator);
-
 	HWForm *Form = new HWForm();
 	Form->show();
 	return app.exec();
--- a/hedgewars/GSHandlers.inc	Fri Aug 11 20:00:29 2006 +0000
+++ b/hedgewars/GSHandlers.inc	Sat Aug 12 17:41:02 2006 +0000
@@ -533,13 +533,6 @@
 HHGear.X:= Gear.X + cc*Gear.Elasticity;
 HHGear.Y:= Gear.Y + cs*Gear.Elasticity;
 
-if (GameTicks >= 165118) and (GameTicks <= 165121) then
-   begin
-   AddFileLog('==9==> ('+floattostr(cc)+','+floattostr(cs)+')');
-   AddFileLog('==a==>  '+floattostr(Gear.Elasticity));
-   AddFileLog('==b==> ('+floattostr(HHGear.X)+','+floattostr(HHGear.Y)+')');
-   end;
-
 HHGear.dX:= HHGear.X - HHGear.dX;
 HHGear.dY:= HHGear.Y - HHGear.dY;
 
--- a/hedgewars/SDLh.pas	Fri Aug 11 20:00:29 2006 +0000
+++ b/hedgewars/SDLh.pas	Sat Aug 12 17:41:02 2006 +0000
@@ -47,7 +47,7 @@
 
 {$IFDEF FPC}
   {$MODE Delphi}
-  {$PACKRECORDS 4}
+  { $PACKRECORDS 4}
 {$ENDIF}
 
 (*  SDL *)
--- a/hedgewars/hwengine.dpr	Fri Aug 11 20:00:29 2006 +0000
+++ b/hedgewars/hwengine.dpr	Sat Aug 12 17:41:02 2006 +0000
@@ -183,8 +183,6 @@
 AddFileLog('Prefix: "' + PathPrefix +'"');
 for i:= 0 to ParamCount do
     AddFileLog(inttostr(i) + ': ' + ParamStr(i));
-{$ELSE}
-begin
 {$ENDIF}
 if ParamCount = 7 then
    begin
--- a/hedgewars/uConsts.pas	Fri Aug 11 20:00:29 2006 +0000
+++ b/hedgewars/uConsts.pas	Sat Aug 12 17:41:02 2006 +0000
@@ -104,7 +104,7 @@
 
       cTransparentColor: Cardinal = $000000;
 
-      cMaxHHIndex      = 9;
+      cMaxHHIndex      = 7;
       cMaxHHs          = 20;
       cMaxSpawnPoints  = 1024;
       cHHSurfaceWidth     = 512;
@@ -115,7 +115,7 @@
       cHHRadius = 9;
       cHHStepTicks = 38;
 
-      cKeyMaxIndex = 322;
+      cKeyMaxIndex = 1023;
 
       cMaxCaptions = 4;
 
--- a/hedgewars/uGame.pas	Fri Aug 11 20:00:29 2006 +0000
+++ b/hedgewars/uGame.pas	Sat Aug 12 17:41:02 2006 +0000
@@ -64,7 +64,7 @@
    end;
 
 if Lag > 100 then Lag:= 100
-else if GameType = gmtSave then if GameTicks < 164550 then Lag:= 2500;
+else if GameType = gmtSave then Lag:= 2500;
 
 i:= 1;
 while (GameState <> gsExit) and (i <= Lag) do
--- a/hedgewars/uKeys.pas	Fri Aug 11 20:00:29 2006 +0000
+++ b/hedgewars/uKeys.pas	Sat Aug 12 17:41:02 2006 +0000
@@ -43,8 +43,8 @@
 
 implementation
 uses SDLh, uTeams, uConsole, uConsts, uMisc;
-
-type TKeyboardState = array[0..322] of Byte;
+const KeyNumber = 1024;
+type TKeyboardState = array[0..cKeyMaxIndex] of Byte;
 var tkbd: TKeyboardState;
     KeyNames: array [0..cKeyMaxIndex] of string[15];
 
@@ -101,6 +101,7 @@
     pkbd: PByteArray;
 begin
 pkbd:= PByteArray(SDL_GetKeyState(@i));
+TryDo(i < cKeyMaxIndex, 'SDL keys number is more than expected (' + inttostr(i) + ')', true);
 for t:= 0 to Pred(i) do
     tkbd[i]:= pkbd^[i]
 end;
--- a/hedgewars/uLand.pas	Fri Aug 11 20:00:29 2006 +0000
+++ b/hedgewars/uLand.pas	Sat Aug 12 17:41:02 2006 +0000
@@ -229,7 +229,7 @@
     end;
 
 var xl, xr, dir: integer;
-begin
+begin     
 Stack.Count:= 0;
 xl:= x - 1;
 xr:= x;
@@ -462,11 +462,12 @@
 
 procedure GenLandSurface;
 var tmpsurf: PSDL_Surface;
-    i: Longword;
+    y, x: Longword;
 begin
 WriteLnToConsole('Generating land...');
-for i:= 0 to sizeof(Land) div 4 do
-    PLongword(Longword(@Land) + i * 4)^:= COLOR_LAND;
+for y:= 0 to 1023 do
+    for x:= 0 to 2047 do
+        Land[y, x]:= COLOR_LAND;
 GenBlank(EdgeTemplates[getrandom(Succ(High(EdgeTemplates)))]);
 
 AddProgress;
--- a/hedgewars/uLandGraphics.pas	Fri Aug 11 20:00:29 2006 +0000
+++ b/hedgewars/uLandGraphics.pas	Sat Aug 12 17:41:02 2006 +0000
@@ -154,7 +154,7 @@
 end;
 
 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: integer; y, dY: integer; Count: Byte);
-var tx, ty, i: integer;
+var tx, ty, i: LongInt;
 begin
 if SDL_MustLock(LandSurface) then
    SDL_LockSurface(LandSurface);
@@ -188,8 +188,8 @@
 //
 procedure DrawTunnel(X, Y, dX, dY: Double; ticks, HalfWidth: integer);
 var nx, ny: Double;
-    i, t, tx, ty: integer;
-begin  // (-dY, dX) is (dX, dY) turned by PI/2
+    i, t, tx, ty: Longint;
+begin  // (-dY, dX) is (dX, dY) rotated by PI/2
 if SDL_MustLock(LandSurface) then
    SDL_LockSurface(LandSurface);
 
--- a/hedgewars/uLandTemplates.pas	Fri Aug 11 20:00:29 2006 +0000
+++ b/hedgewars/uLandTemplates.pas	Sat Aug 12 17:41:02 2006 +0000
@@ -37,7 +37,7 @@
 {$INCLUDE options.inc}
 
 type PPointArray = ^TPointArray;
-     TPointArray = array[0..0] of TPoint;
+     TPointArray = array[0..64] of TPoint;
      TEdgeTemplate = record
                      BasePoints: PPointArray;
                      BasePointsCount: Longword;
--- a/hedgewars/uWorld.pas	Fri Aug 11 20:00:29 2006 +0000
+++ b/hedgewars/uWorld.pas	Sat Aug 12 17:41:02 2006 +0000
@@ -99,10 +99,10 @@
 begin
 // Sky
 inc(RealTicks, Lag);
-r.h:= WorldDy;
-if r.h > 0 then
+if WorldDy > 0 then
    begin
-   if r.h > cScreenHeight then r.h:= cScreenHeight;
+   if WorldDy > cScreenHeight then r.h:= cScreenHeight
+                              else r.h:= WorldDy;
    r.x:= 0;
    r.y:= 0;
    r.w:= cScreenWidth;