- Fixed dynamit sprite
authorunc0rr
Wed, 11 Jan 2006 20:01:36 +0000
changeset 46 c99140d2355a
parent 45 1072e7fe85c8
child 47 8daf1ee0b9a3
- Fixed dynamit sprite - Console with autocompletion
hedgewars/GSHandlers.inc
hedgewars/uConsole.pas
hedgewars/uGears.pas
--- a/hedgewars/GSHandlers.inc	Tue Jan 10 22:29:51 2006 +0000
+++ b/hedgewars/GSHandlers.inc	Wed Jan 11 20:01:36 2006 +0000
@@ -647,7 +647,7 @@
 if Gear.Timer mod 166 = 0 then inc(Gear.Tag);
 if Gear.Timer = 0 then
    begin
-   doMakeExplosion(round(Gear.X), round(Gear.Y), 85, EXPLAutoSound);
+   doMakeExplosion(round(Gear.X), round(Gear.Y), 75, EXPLAutoSound);
    DeleteGear(Gear);
    exit
    end;
--- a/hedgewars/uConsole.pas	Tue Jan 10 22:29:51 2006 +0000
+++ b/hedgewars/uConsole.pas	Wed Jan 11 20:01:36 2006 +0000
@@ -215,12 +215,40 @@
      else WriteLnToConsole(errmsgUnknownCommand  + ': "/' + CmdStr + '"') end
 end;
 
+procedure AutoComplete;
+var t: PVariable;
+    c: char;
+begin
+if InputStr[0] = #0 then exit;
+c:= InputStr[1];
+if c in ['/', '$'] then Delete(InputStr, 1, 1)
+                   else c:= #0;
+if InputStr[byte(InputStr[0])] = #32 then dec(InputStr[0]);
+t:= Variables;
+while t <> nil do
+      begin
+      if (c=#0) or ((t.VType =  vtCommand) and (c='/'))or
+                   ((t.VType <> vtCommand) and (c='$'))then
+         if copy(t.Name, 1, Length(InputStr)) = InputStr then
+            begin
+            if t.VType = vtCommand then InputStr:= '/' + t.Name + ' '
+                                   else InputStr:= '$' + t.Name + ' ';
+            exit
+            end;
+      t:= t.Next
+      end
+end;
+
 procedure KeyPressConsole(Key: Longword);
 begin
 case Key of
       8: if Length(InputStr)>0 then dec(InputStr[0]);
+      9: AutoComplete;
  13,271: begin
-         ParseCommand('/say ' + InputStr);
+         if InputStr[1] in ['/', '$'] then
+            ParseCommand(InputStr)
+         else
+            ParseCommand('/say ' + InputStr);
          InputStr:= ''
          end;
      96: begin
--- a/hedgewars/uGears.pas	Tue Jan 10 22:29:51 2006 +0000
+++ b/hedgewars/uGears.pas	Wed Jan 11 20:01:36 2006 +0000
@@ -493,7 +493,7 @@
             gtMine: if ((Gear.State and gstAttacking) = 0)or((Gear.Timer and $3FF) < 420)
                        then DrawSprite(sprMineOff , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface)
                        else DrawSprite(sprMineOn  , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface);
-        gtDynamite: DrawSprite2(sprDynamite, Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, Gear.Tag and 1, Gear.Tag shr 1, Surface);
+        gtDynamite: DrawSprite2(sprDynamite, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 25 + WorldDy, Gear.Tag and 1, Gear.Tag shr 1, Surface);
             gtCase: case Gear.Pos of
                          posCaseAmmo  : DrawSprite(sprCase, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, 0, Surface);
                          posCaseHealth: DrawSprite(sprFAid, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, (GameTicks shr 6) and $F, Surface);
@@ -632,7 +632,7 @@
          if sqr(mX - t.X) / rX + sqr(mY - t.Y) / rY <= 1 then
             begin
             Result:= t;
-            {$IFDEF DEBUGFILE}AddFileLog('CheckGearsNear: near ('+inttostr(mx)+','+inttostr(my)+') is gear '+inttostr(integer(t)));{$ENDIF}
+//            {$IFDEF DEBUGFILE}AddFileLog('CheckGearsNear: near ('+inttostr(mx)+','+inttostr(my)+') is gear '+inttostr(integer(t)));{$ENDIF}
             exit
             end;
       t:= t.NextGear
@@ -672,7 +672,7 @@
               if Land[y, i] <> 0 then
                  begin
                  b:= true;
-                 {$IFDEF DEBUGFILE}AddFileLog('SpawnBoxOfSmth: Land['+inttostr(y)+','+inttostr(i)+'] <> 0');{$ENDIF}
+//                 {$IFDEF DEBUGFILE}AddFileLog('SpawnBoxOfSmth: Land['+inttostr(y)+','+inttostr(i)+'] <> 0');{$ENDIF}
                  end;
               inc(i)
               end;