throw in some 'nots' trying to restore pas2c functionality webgl
authorkoda
Thu, 22 Nov 2012 01:47:09 +0100
branchwebgl
changeset 8099 a7f02b902b6f
parent 8096 453917e94e55
child 8102 20ef5bf0dc7f
throw in some 'nots' trying to restore pas2c functionality
hedgewars/uGears.pas
hedgewars/uPhysFSLayer.pas
hedgewars/uWorld.pas
--- a/hedgewars/uGears.pas	Thu Nov 22 00:41:53 2012 +0100
+++ b/hedgewars/uGears.pas	Thu Nov 22 01:47:09 2012 +0100
@@ -98,7 +98,7 @@
         begin
         if (not isInMultiShoot) then
             inc(Gear^.Damage, Gear^.Karma);
-        if (Gear^.Damage <> 0) and (not Gear^.Invulnerable) then
+        if ((Gear^.Damage <> 0) and (not Gear^.Invulnerable)) then
             begin
             CheckNoDamage:= false;
 
@@ -165,7 +165,7 @@
                     if (team^.Hedgehogs[i].Gear <> nil) and (not team^.Hedgehogs[i].King)
                     and (team^.Hedgehogs[i].Gear^.Health > team^.Hedgehogs[i].Gear^.Damage) then
                         flag:= true;
-                if not flag then
+                if (not flag) then
                     begin
                     inc(tmp, 5);
                     if (GameFlags and gfResetHealth) <> 0 then
@@ -217,7 +217,7 @@
             RemoveGearFromList(curHandledGear);
             // since I can't think of any good reason this would ever be separate from a remove from list, going to keep it inside this block
             if curHandledGear^.Message and gmAddToList <> 0 then InsertGearToList(curHandledGear);
-            curHandledGear^.Message:= curHandledGear^.Message and (not (gmRemoveFromList or gmAddToList))
+            curHandledGear^.Message:= (curHandledGear^.Message and (not (gmRemoveFromList or gmAddToList)))
             end;
         if curHandledGear^.Active then
             begin
@@ -332,7 +332,7 @@
                 StopMusic //No SDMusic for now
                     //ChangeMusic(SDMusic)
                     end
-                else if (TotalRounds < cSuddenDTurns) and (not isInMultiShoot) then
+                else if ((TotalRounds < cSuddenDTurns) and (not isInMultiShoot)) then
                     begin
                     i:= cSuddenDTurns - TotalRounds;
                     s:= inttostr(i);
@@ -355,7 +355,7 @@
             end;
     stSpawn:
         begin
-        if not isInMultiShoot then
+        if (not isInMultiShoot) then
             SpawnBoxOfSmth;
         inc(step)
         end;
@@ -404,7 +404,7 @@
                 CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State or gstHHChooseTarget;
                 isCursorVisible := true
                 end;
-            CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State and (not gstAttacked);
+            CurrentHedgehog^.Gear^.State:= (CurrentHedgehog^.Gear^.State and (not gstAttacked));
             end;
         if delay2 = 0 then
             begin
@@ -702,7 +702,7 @@
                         t^.dX:= t^.dX + Gear^.dX * dmg * _0_01 + SignAs(cHHKick, Gear^.dX);
                         t^.dY:= t^.dY + Gear^.dY * dmg * _0_01;
                         t^.State:= t^.State or gstMoving;
-                        if t^.Kind = gtKnife then t^.State:= t^.State and (not gstCollision);
+                        if t^.Kind = gtKnife then t^.State:= (t^.State and (not gstCollision));
                         t^.Active:= true;
                         FollowGear:= t
                         end
@@ -813,7 +813,7 @@
             if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then 
                 begin
                 if (Ammo^.Hedgehog^.Gear <> nil) then
-                    Ammo^.Hedgehog^.Gear^.State:= Ammo^.Hedgehog^.Gear^.State and (not gstNotKickable);
+                    Ammo^.Hedgehog^.Gear^.State:= (Ammo^.Hedgehog^.Gear^.State and (not gstNotKickable));
                 ApplyDamage(Gear, Ammo^.Hedgehog, tmpDmg * 100, dsUnknown); // crank up damage for explosives + blowtorch
                 end;
 
@@ -833,17 +833,17 @@
                 Gear^.Active:= true;
                 DeleteCI(Gear);
                 Gear^.State:= Gear^.State or gstMoving;
-                if Gear^.Kind = gtKnife then Gear^.State:= Gear^.State and (not gstCollision);
+                if Gear^.Kind = gtKnife then Gear^.State:= (Gear^.State and (not gstCollision));
                 // move the gear upwards a bit to throw it over tiny obstacles at start
                 if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
                     begin
-                    if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX))
+                    if (not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX)))
                     or (TestCollisionYwithGear(Gear, -1) <> 0)) then
                         Gear^.Y:= Gear^.Y - _1;
-                    if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX))
+                    if (not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)))
                     or (TestCollisionYwithGear(Gear, -1) <> 0)) then
                         Gear^.Y:= Gear^.Y - _1;
-                    if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX))
+                    if (not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)))
                     or (TestCollisionYwithGear(Gear, -1) <> 0)) then
                         Gear^.Y:= Gear^.Y - _1;
                     end
@@ -961,7 +961,7 @@
 while t <> nil do
     begin
     if (t^.Kind = gtHedgehog) and (t^.Y < Ammo^.Y) then
-        if not (hwSqr(Ammo^.X - t^.X) + hwSqr(Ammo^.Y - t^.Y - int2hwFloat(cHHRadius)) * 2 > _2) then
+        if (not (hwSqr(Ammo^.X - t^.X) + hwSqr(Ammo^.Y - t^.Y - int2hwFloat(cHHRadius)) * 2 > _2)) then
             begin
             ApplyDamage(t, 5);
             t^.dX:= t^.dX + (t^.X - Ammo^.X) * _0_02;
@@ -1226,7 +1226,7 @@
 procedure chSkip(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
-if not isExternalSource then
+if (not isExternalSource) then
     SendIPC(_S',');
 uStats.Skipped;
 skipFlag:= true
--- a/hedgewars/uPhysFSLayer.pas	Thu Nov 22 00:41:53 2012 +0100
+++ b/hedgewars/uPhysFSLayer.pas	Thu Nov 22 01:47:09 2012 +0100
@@ -22,6 +22,10 @@
 procedure freeModule;
 
 type PFSFile = pointer;
+{$IFDEF PAS2C}
+     Int64 = LongInt; //FIXME!!!!!!!!!
+     LongBool = boolean;
+{$ENDIF}
 
 function rwopsOpenRead(fname: shortstring): PSDL_RWops;
 function rwopsOpenWrite(fname: shortstring): PSDL_RWops;
@@ -41,9 +45,12 @@
 implementation
 uses uUtils, uVariables;
 
+{$IFNDEF PAS2C}
+// pas2c unable to parse this section???
+
 function PHYSFS_init(argv0: PChar) : LongInt; cdecl; external PhysfsLibName;
-function PHYSFS_deinit() : LongInt; cdecl; external PhysfsLibName;
-function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl ; external PhysfsLibName;
+function PHYSFS_deinit: LongInt; cdecl; external PhysfsLibName;
+function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl; external PhysfsLibName;
 function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external PhysfsLibName;
 
 function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongInt; cdecl; external PhysfsLibName;
@@ -53,7 +60,9 @@
 function PHYSFS_close(f: PFSFile): LongBool; cdecl; external PhysfsLibName;
 function PHYSFS_exists(fname: PChar): LongBool; cdecl; external PhysfsLibName;
 
-procedure hedgewarsMountPackages(); cdecl; external PhysfsLibName;
+procedure hedgewarsMountPackages; cdecl; external PhysfsLibName;
+
+(*****************************************************************)
 
 function rwopsOpenRead(fname: shortstring): PSDL_RWops;
 begin
@@ -128,5 +137,6 @@
 begin
     PHYSFS_deinit;
 end;
+{$ENDIF}
 
 end.
--- a/hedgewars/uWorld.pas	Thu Nov 22 00:41:53 2012 +0100
+++ b/hedgewars/uWorld.pas	Thu Nov 22 01:47:09 2012 +0100
@@ -721,7 +721,7 @@
 {$IFDEF USE_TOUCH_INTERFACE}//show the aiming buttons + animation
                 if (Ammo^[Slot, Pos].Propz and ammoprop_NeedUpDown) <> 0 then
                     begin
-                    if not(arrowUp.show) then
+                    if (not arrowUp.show) then
                         begin
                         animateWidget(@arrowUp, true, true);
                         animateWidget(@arrowDown, true, true);
@@ -744,7 +744,7 @@
 
     if (WeaponTooltipTex <> nil) and (AMShiftX = 0) and (AMShiftY = 0) then
 {$IFDEF USE_LANDSCAPE_AMMOMENU}
-        if not isPhone() then
+        if (not isPhone()) then
             ShowWeaponTooltip(-WeaponTooltipTex^.w div 2, AmmoRect.y - WeaponTooltipTex^.h - AMSlotSize);
 {$ELSE}
         ShowWeaponTooltip(AmmoRect.x - WeaponTooltipTex^.w - 3, Min(AmmoRect.y + 1, cScreenHeight - WeaponTooltipTex^.h - 40));
@@ -994,7 +994,7 @@
 {$IFNDEF S3D_DISABLED}
     else if (cStereoMode = smAFR) then
         begin
-        AFRToggle:= not AFRToggle;
+        AFRToggle:= (not AFRToggle);
         glClear(GL_COLOR_BUFFER_BIT);
         if AFRToggle then
             DrawWorldStereo(Lag, rmLeftEye)
@@ -1370,7 +1370,7 @@
         r.w:= 3;
         DrawTextureFromRect(TeamHealthBarWidth + 16, cScreenHeight + DrawHealthY + smallScreenOffset, @r, HealthTex);
 
-        if not highlight and (not hasGone) then
+        if (not highlight) and (not hasGone) then
             for i:= 0 to cMaxHHIndex do
                 if Hedgehogs[i].Gear <> nil then
                     begin
@@ -1406,7 +1406,7 @@
             r.w:= TeamHealthBarWidth + 1;
             r.h:= HealthTex^.h - 4;
             DrawTextureFromRect(16, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, HealthTex);
-            if not hasGone and (TeamHealth > 1) then
+            if (not hasGone) and (TeamHealth > 1) then
                 begin
                 Tint(Clan^.Color shl 8 or $FF);
                 for i:= 0 to cMaxHHIndex do
@@ -1472,7 +1472,7 @@
         AMAnimStartTime:= RealTicks - (AMAnimDuration - (RealTicks - AMAnimStartTime));
     AMState:= AMShowingUp;
     end;
-if not(bShowAmmoMenu) and ((AMstate = AMShowing) or (AMState = AMShowingUp)) then
+if (not bShowAmmoMenu) and ((AMstate = AMShowing) or (AMState = AMShowingUp)) then
     begin
     if (AMState = AMShowing) then
         AMAnimStartTime:= RealTicks
@@ -1584,7 +1584,7 @@
 
 if ScreenFade <> sfNone then
     begin
-    if not isFirstFrame then
+    if (not isFirstFrame) then
         case ScreenFade of
             sfToBlack, sfToWhite:     if ScreenFadeValue + Lag * ScreenFadeSpeed < sfMax then
                                           inc(ScreenFadeValue, Lag * ScreenFadeSpeed)
@@ -1678,7 +1678,7 @@
 // Cursor
 if isCursorVisible then
     begin
-    if not bShowAmmoMenu then
+    if (not bShowAmmoMenu) then
         begin
         with CurrentHedgehog^ do
             if (Gear <> nil) and ((Gear^.State and gstHHChooseTarget) <> 0) then
@@ -1707,7 +1707,7 @@
     uCursor.updatePosition();
 {$ENDIF}
 z:= round(200/zoom);
-if not PlacingHogs and (FollowGear <> nil) and (not isCursorVisible) and (not bShowAmmoMenu) and (not fastUntilLag) and autoCameraOn then
+if (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not bShowAmmoMenu) and (not fastUntilLag) and autoCameraOn then
     if ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then
         begin
         FollowGear:= nil;
@@ -1876,10 +1876,10 @@
 
 {$IFDEF USE_VIDEO_RECORDING}
 // do not change volume during prerecording as it will affect sound in video file
-if not flagPrerecording then
+if (not flagPrerecording) then
 {$ENDIF}
     begin
-    if not cHasFocus then DampenAudio()
+    if (not cHasFocus) then DampenAudio()
     else UndampenAudio();
     end;
 end;