Convert some stuff to sprites
authorunc0rr
Sun, 30 Dec 2007 15:24:02 +0000
changeset 688 e4d1fb310a66
parent 687 8e2dedaa01b4
child 689 f4ec46c48ed2
Convert some stuff to sprites
hedgewars/uConsole.pas
hedgewars/uConsts.pas
hedgewars/uGears.pas
--- a/hedgewars/uConsole.pas	Wed Dec 26 22:18:34 2007 +0000
+++ b/hedgewars/uConsole.pas	Sun Dec 30 15:24:02 2007 +0000
@@ -115,7 +115,7 @@
 SDL_FillRect(Surface, @r, cConsoleSplitterColor);
 for y:= 0 to cConsoleHeight div 256 + 1 do
     for x:= 0 to cScreenWidth div 256 + 1 do
-        DrawGear(sConsoleBG, x * 256, cConsoleHeight - 256 - y * 256, Surface);
+        DrawSprite(sprConsoleBG, x * 256, cConsoleHeight - 256 - y * 256, 0, Surface);
 for y:= 0 to cConsoleHeight div Fontz[fnt16].Height do
     DXOutText(4, cConsoleHeight - (y + 2) * (Fontz[fnt16].Height + 2), fnt16, ConsoleLines[(CurrLine - 1 - y + cLinesCount) mod cLinesCount], Surface);
 DXOutText(4, cConsoleHeight - Fontz[fnt16].Height - 2, fnt16, '> '+InputStr, Surface);
--- a/hedgewars/uConsts.pas	Wed Dec 26 22:18:34 2007 +0000
+++ b/hedgewars/uConsts.pas	Sun Dec 30 15:24:02 2007 +0000
@@ -21,8 +21,8 @@
 uses SDLh, uLocale;
 {$INCLUDE options.inc}
 {$INCLUDE proto.inc}
-type TStuff     = (sConsoleBG, sPowerBar, sQuestion, sWindBar,
-                   sWindL, sWindR, sRopeNode);
+type TStuff     = (sPowerBar, sWindBar,
+                   sWindL, sWindR);
 
      TGameState = (gsLandGen, gsStart, gsGame, gsConsole, gsExit);
 
@@ -40,7 +40,8 @@
                    sprSky, sprAMBorders, sprAMSlot, sprAMSlotName, sprAMAmmos,
                    sprAMSlotKeys, sprAMSelection, sprFinger, sprAirBomb,
                    sprAirplane, sprAmAirplane, sprAmGirder, sprHHTelepMask,
-                   sprSwitch, sprParachute, sprTarget);
+                   sprSwitch, sprParachute, sprTarget, sprRopeNode, sprConsoleBG,
+                   sprQuestion);
 
      TGearType  = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
                    gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope,
@@ -233,22 +234,16 @@
                                      FileName: String[31];
                                      Path    : TPathType;
                                      end = (
-                                     (FileName:  'Console'; Path: ptGraphics     ),    // sConsoleBG
                                      (FileName: 'PowerBar'; Path: ptGraphics     ),    // sPowerBar
-                                     (FileName: 'thinking'; Path: ptGraphics     ),    // sQuestion
                                      (FileName:  'WindBar'; Path: ptGraphics     ),    // sWindBar
                                      (FileName:    'WindL'; Path: ptGraphics     ),    // sWindL
-                                     (FileName:    'WindR'; Path: ptGraphics     ),    // sWindR
-                                     (FileName: 'RopeNode'; Path: ptGraphics     )     // sRopeNode
+                                     (FileName:    'WindR'; Path: ptGraphics     )     // sWindR
                                      );
       StuffPoz: array[TStuff] of TSDL_Rect = (
-                                      (x: 256; y: 256; w: 256; h: 256), // sConsoleBG
                                       (x: 256; y: 768; w: 256; h:  32), // sPowerBar
-                                      (x: 256; y: 512; w:  32; h:  32), // sQuestion
                                       (x: 256; y: 800; w: 151; h:  17), // sWindBar
                                       (x: 256; y: 817; w:  80; h:  13), // sWindL
-                                      (x: 336; y: 817; w:  80; h:  13), // sWindR
-                                      (x: 256; y: 544; w:   6; h:   6)  // sRopeNode
+                                      (x: 336; y: 817; w:  80; h:  13)  // sWindR
                                       );
       SpritesData: array[TSprite] of record
                      FileName: String[31];
@@ -257,86 +252,92 @@
                      Width, Height: LongInt;
                      hasAlpha: boolean;
                      end = (
-                     (FileName: 'BlueWater'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width: 256; Height: 48; hasAlpha: false),// sprWater
-                     (FileName:    'Clouds'; Path: ptCurrTheme; AltPath: ptGraphics; Surface: nil;
-                     Width: 256; Height:128; hasAlpha: false),// sprCloud
-                     (FileName:      'Bomb'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  16; Height: 16; hasAlpha: false),// sprBomb
-                     (FileName: 'BigDigits'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha:  true),// sprBigDigit
-                     (FileName:     'Frame'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:   4; Height: 32; hasAlpha:  true),// sprFrame
-                     (FileName:       'Lag'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  65; Height: 65; hasAlpha:  true),// sprLag
-                     (FileName:     'Arrow'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  16; Height: 16; hasAlpha: false),// sprCursor
-                     (FileName:   'Grenade'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha: false),// sprGrenade
-                     (FileName:   'Targetp'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha: false),// sprTargetP
-                     (FileName:       'UFO'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha: false),// sprUFO
-                     (FileName:'SmokeTrace'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha:  true),// sprSmokeTrace
-                     (FileName:  'RopeHook'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha: false),// sprRopeHook
-                     (FileName:    'Expl50'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  64; Height: 64; hasAlpha: false),// sprExplosion50
-                     (FileName:   'MineOff'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  16; Height: 16; hasAlpha: false),// sprMineOff
-                     (FileName:    'MineOn'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  16; Height: 16; hasAlpha: false),// sprMineOn
-                     (FileName:      'Case'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha: false),// sprCase
-                     (FileName:  'FirstAid'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  48; Height: 48; hasAlpha: false),// sprFAid
-                     (FileName:  'dynamite'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha: false),// sprDynamite
-                     (FileName:     'Power'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha:  true),// sprPower
-                     (FileName:    'ClBomb'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  16; Height: 16; hasAlpha: false),// sprClusterBomb
-                     (FileName:'ClParticle'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  16; Height: 16; hasAlpha: false),// sprClusterParticle
-                     (FileName:     'Flame'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  16; Height: 16; hasAlpha: false),// sprFlame
-                     (FileName:  'horizont'; Path: ptCurrTheme; AltPath: ptNone; Surface: nil;
-                     Width:   0; Height:  0; hasAlpha: false),// sprHorizont
-                     (FileName:       'Sky'; Path: ptCurrTheme; AltPath: ptNone; Surface: nil;
-                     Width:   0; Height:  0; hasAlpha: false),// sprSky
-                     (FileName: 'BrdrLines'; Path: ptAmmoMenu; AltPath: ptNone; Surface: nil;
-                     Width: 202; Height:  1; hasAlpha: false),// sprAMBorders
-                     (FileName:      'Slot'; Path: ptAmmoMenu; AltPath: ptNone; Surface: nil;
-                     Width: 202; Height: 33; hasAlpha: false),// sprAMSlot
-                     (FileName:  'AmmoName'; Path: ptAmmoMenu; AltPath: ptNone; Surface: nil;
-                     Width: 202; Height: 33; hasAlpha: false),// sprAMSlotName
-                     (FileName:     'Ammos'; Path: ptAmmoMenu; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha: false),// sprAMAmmos
-                     (FileName:  'SlotKeys'; Path: ptAmmoMenu; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha: false),// sprAMSlotKeys
-                     (FileName: 'Selection'; Path: ptAmmoMenu; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha: false),// sprAMSelection
-                     (FileName:    'Finger'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 48; hasAlpha: false),// sprFinger
-                     (FileName:   'AirBomb'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha: false),// sprAirBomb
-                     (FileName:  'Airplane'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width: 125; Height: 42; hasAlpha: false),// sprAirplane
-                     (FileName:'amAirplane'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  64; Height: 32; hasAlpha:  true),// sprAirplane
-                     (FileName:  'amGirder'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width: 160; Height:160; hasAlpha: false),// sprAmGirder
-                     (FileName:    'hhMask'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha: false),// sprHHTelepMask
-                     (FileName:    'Switch'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha: false),// sprSwitch
-                     (FileName: 'Parachute'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  48; Height: 48; hasAlpha: true),// sprParachute
-                     (FileName:    'Target'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
-                     Width:  32; Height: 32; hasAlpha:false) // sprTarget
+                     (FileName:  'BlueWater'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width: 256; Height: 48; hasAlpha: false),// sprWater
+                     (FileName:     'Clouds'; Path: ptCurrTheme; AltPath: ptGraphics; Surface: nil;
+                      Width: 256; Height:128; hasAlpha: false),// sprCloud
+                     (FileName:       'Bomb'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  16; Height: 16; hasAlpha: false),// sprBomb
+                     (FileName:  'BigDigits'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha:  true),// sprBigDigit
+                     (FileName:      'Frame'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:   4; Height: 32; hasAlpha:  true),// sprFrame
+                     (FileName:        'Lag'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  65; Height: 65; hasAlpha:  true),// sprLag
+                     (FileName:      'Arrow'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  16; Height: 16; hasAlpha: false),// sprCursor
+                     (FileName:    'Grenade'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha: false),// sprGrenade
+                     (FileName:    'Targetp'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha: false),// sprTargetP
+                     (FileName:        'UFO'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha: false),// sprUFO
+                     (FileName: 'SmokeTrace'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha:  true),// sprSmokeTrace
+                     (FileName:   'RopeHook'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha: false),// sprRopeHook
+                     (FileName:     'Expl50'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  64; Height: 64; hasAlpha: false),// sprExplosion50
+                     (FileName:    'MineOff'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  16; Height: 16; hasAlpha: false),// sprMineOff
+                     (FileName:     'MineOn'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  16; Height: 16; hasAlpha: false),// sprMineOn
+                     (FileName:       'Case'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha: false),// sprCase
+                     (FileName:   'FirstAid'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  48; Height: 48; hasAlpha: false),// sprFAid
+                     (FileName:   'dynamite'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha: false),// sprDynamite
+                     (FileName:      'Power'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha:  true),// sprPower
+                     (FileName:     'ClBomb'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  16; Height: 16; hasAlpha: false),// sprClusterBomb
+                     (FileName: 'ClParticle'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  16; Height: 16; hasAlpha: false),// sprClusterParticle
+                     (FileName:      'Flame'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  16; Height: 16; hasAlpha: false),// sprFlame
+                     (FileName:   'horizont'; Path: ptCurrTheme; AltPath: ptNone; Surface: nil;
+                      Width:   0; Height:  0; hasAlpha: false),// sprHorizont
+                     (FileName:        'Sky'; Path: ptCurrTheme; AltPath: ptNone; Surface: nil;
+                      Width:   0; Height:  0; hasAlpha: false),// sprSky
+                     (FileName:  'BrdrLines'; Path: ptAmmoMenu; AltPath: ptNone; Surface: nil;
+                      Width: 202; Height:  1; hasAlpha: false),// sprAMBorders
+                     (FileName:       'Slot'; Path: ptAmmoMenu; AltPath: ptNone; Surface: nil;
+                      Width: 202; Height: 33; hasAlpha: false),// sprAMSlot
+                     (FileName:   'AmmoName'; Path: ptAmmoMenu; AltPath: ptNone; Surface: nil;
+                      Width: 202; Height: 33; hasAlpha: false),// sprAMSlotName
+                     (FileName:      'Ammos'; Path: ptAmmoMenu; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha: false),// sprAMAmmos
+                     (FileName:   'SlotKeys'; Path: ptAmmoMenu; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha: false),// sprAMSlotKeys
+                     (FileName:  'Selection'; Path: ptAmmoMenu; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha: false),// sprAMSelection
+                     (FileName:     'Finger'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 48; hasAlpha: false),// sprFinger
+                     (FileName:    'AirBomb'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha: false),// sprAirBomb
+                     (FileName:   'Airplane'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width: 125; Height: 42; hasAlpha: false),// sprAirplane
+                     (FileName: 'amAirplane'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  64; Height: 32; hasAlpha:  true),// sprAirplane
+                     (FileName:   'amGirder'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width: 160; Height:160; hasAlpha: false),// sprAmGirder
+                     (FileName:     'hhMask'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha: false),// sprHHTelepMask
+                     (FileName:     'Switch'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha: false),// sprSwitch
+                     (FileName:  'Parachute'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  48; Height: 48; hasAlpha: true),// sprParachute
+                     (FileName:     'Target'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha:false),// sprTarget
+                     (FileName:   'RopeNode'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:   6; Height:  6; hasAlpha:false),// sprRopeNode
+                     (FileName:    'Console'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width: 256; Height:256; hasAlpha:false),// sprConsoleBG
+                     (FileName:   'thinking'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+                      Width:  32; Height: 32; hasAlpha:false) // sprQuestion
                      );
-                     
+
       Soundz: array[TSound] of record
                                        FileName: String[31];
                                        Path    : TPathType;
--- a/hedgewars/uGears.pas	Wed Dec 26 22:18:34 2007 +0000
+++ b/hedgewars/uGears.pas	Sun Dec 30 15:24:02 2007 +0000
@@ -490,7 +490,7 @@
                       GameTicks div 32 mod 16, Surface);
         if (Gear^.State and (gstMoving or gstDrowning)) = 0 then
            if (Gear^.State and gstHHThinking) <> 0 then
-              DrawGear(sQuestion, hwRound(Gear^.X) - 10 + WorldDx, hwRound(Gear^.Y) - cHHRadius - 34 + WorldDy, Surface)
+              DrawSprite(sprQuestion, hwRound(Gear^.X) - 10 + WorldDx, hwRound(Gear^.Y) - cHHRadius - 34 + WorldDy, 0, Surface)
               else
               if ShowCrosshair and ((Gear^.State and gstAttacked) = 0) then
                  DrawSurfSprite(Round(hwRound(Gear^.X) + hwSign(Gear^.dX) * Sin(Gear^.Angle*pi/cMaxAngle)*60) + WorldDx - 11,
@@ -562,7 +562,7 @@
         if b then
            begin
            inc(roplen);
-           if (roplen mod 4) = 0 then DrawGear(sRopeNode, x - 2, y - 2, Surface)
+           if (roplen mod 4) = 0 then DrawSprite(sprRopeNode, x - 2, y - 2, 0, Surface)
            end
        end
     end;