# HG changeset patch # User unc0rr # Date 1206390432 0 # Node ID 2ae8fd8ef804f3e1c2910dca6d2ea069650297f8 # Parent e6c0408b54ed8f6a5d71a6a4ac6cb5022e1421c9 Use 'rope gun' sprite diff -r e6c0408b54ed -r 2ae8fd8ef804 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Mon Mar 24 19:18:13 2008 +0000 +++ b/hedgewars/uConsts.pas Mon Mar 24 20:27:12 2008 +0000 @@ -29,7 +29,7 @@ TPathType = (ptNone, ptData, ptGraphics, ptThemes, ptCurrTheme, ptTeams, ptMaps, ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts, - ptLocale, ptAmmoMenu, ptVoices); + ptLocale, ptAmmoMenu, ptHedgehog, ptVoices); TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame, sprLag, sprArrow, sprGrenade, sprTargetP, sprUFO, @@ -41,7 +41,7 @@ sprAirplane, sprAmAirplane, sprAmGirder, sprHHTelepMask, sprSwitch, sprParachute, sprTarget, sprRopeNode, sprConsoleBG, sprQuestion, sprPowerBar, sprWindBar, - sprWindL, sprWindR, sprFlake); + sprWindL, sprWindR, sprFlake, sprHandRope); TGearType = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag, gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope, @@ -239,6 +239,7 @@ 'Forts', // ptForts 'Locale', // ptLocale 'Graphics/AmmoMenu', // ptAmmoMenu + 'Graphics/Hedgehog', // ptHedgehog 'Sounds/voices' // ptVoices ); @@ -343,7 +344,9 @@ (FileName: 'WindR'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; Width: 80; Height: 13; saveSurf: false),// sprWindR (FileName: 'Flake'; Path:ptCurrTheme; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; saveSurf: false) // sprFlake + Width: 64; Height: 64; saveSurf: false),// sprFlake + (FileName: 'amRope'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false) // sprHandRope ); Soundz: array[TSound] of record @@ -511,7 +514,7 @@ Slot: 7; TimeAfterTurn: 0; minAngle: 0; - maxAngle: cMaxAngle div 2; + maxAngle: cMaxAngle;// div 2; PosCount: 1; PosSprite: sprWater), (NameId: sidMine; diff -r e6c0408b54ed -r 2ae8fd8ef804 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Mon Mar 24 19:18:13 2008 +0000 +++ b/hedgewars/uGears.pas Mon Mar 24 20:27:12 2008 +0000 @@ -471,29 +471,57 @@ procedure DrawHH(Gear: PGear; Surface: PSDL_Surface); var t: LongInt; + amt: TAmmoType; + hx, hy: LongInt; + aangle: real; begin if (Gear^.State and gstHHDriven) <> 0 then - begin - if CurAmmoGear <> nil then - begin - if (CurAmmoGear^.Kind = gtRope) then - DrawHedgehog(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, - 1, - 1, - 0, - DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) - 110); - end else - DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, - hwSign(Gear^.dX), - 0, - PHedgehog(Gear^.Hedgehog)^.visStepPos div 2, - 0); - end else - DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, - hwSign(Gear^.dX), - 0, - 8, - 0); +begin + if CurAmmoGear <> nil then + begin + if (CurAmmoGear^.Kind = gtRope) then + DrawHedgehog(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, + 1, + 1, + 0, + DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) - 110); + end else + if (Gear^.Message and (gm_Left or gm_Right) <> 0) then + DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, + hwSign(Gear^.dX), + 0, + PHedgehog(Gear^.Hedgehog)^.visStepPos div 2, + 0) + else + begin + amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType; + hx:= hwRound(Gear^.X) + 1 + 8 * hwSign(Gear^.dX) + WorldDx; + hy:= hwRound(Gear^.Y) - 2 + WorldDy; + aangle:= Gear^.Angle * 180 / cMaxAngle - 90; + case amt of + amRope: DrawRotated(sprHandRope, hx, hy, hwSign(Gear^.dX), aangle); + else + end; + case amt of + amRope: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, + hwSign(Gear^.dX), + 0, + 4, + 0); + else + DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, + hwSign(Gear^.dX), + 0, + 3, + 0); + end + end +end else + DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, + hwSign(Gear^.dX), + 0, + 3, + 0); with PHedgehog(Gear^.Hedgehog)^ do if (Gear^.State{ and not gstAnimation}) = 0 then @@ -531,7 +559,7 @@ Round(hwRound(Gear^.X) + hwSign(Gear^.dX) * Sin(Gear^.Angle*pi/cMaxAngle)*60) + WorldDx, Round(hwRound(Gear^.Y) - - Cos(Gear^.Angle*pi/cMaxAngle)*60) + WorldDy, + Cos(Gear^.Angle*pi/cMaxAngle)*60) + WorldDy, 0, hwSign(Gear^.dX) * Gear^.Angle * 180 / cMaxAngle) end; end; @@ -608,9 +636,9 @@ while Gear<>nil do begin case Gear^.Kind of - gtAmmo_Bomb: DrawRotated(sprBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.DirAngle); + gtAmmo_Bomb: DrawRotated(sprBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); gtHedgehog: DrawHH(Gear, Surface); - gtAmmo_Grenade: DrawRotated(sprGrenade, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, DxDy2Angle(Gear^.dY, Gear^.dX)); + gtAmmo_Grenade: DrawRotated(sprGrenade, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); gtHealthTag, gtSmallDamage: if Gear^.Tex <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex); gtGrave: DrawSurfSprite(hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 32, (GameTicks shr 7) and 7, PHedgehog(Gear^.Hedgehog)^.Team^.GraveTex, Surface); @@ -630,31 +658,31 @@ hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy); DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); - DrawRotated(sprRopeHook, hwRound(RopePoints.ar[0].X) + WorldDx, hwRound(RopePoints.ar[0].Y) + WorldDy, RopePoints.HookAngle) + DrawRotated(sprRopeHook, hwRound(RopePoints.ar[0].X) + WorldDx, hwRound(RopePoints.ar[0].Y) + WorldDy, 1, RopePoints.HookAngle) end else begin DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); - DrawRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, DxDy2Angle(Gear^.dY, Gear^.dX)); + DrawRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); end; end; gtSmokeTrace: if Gear^.State < 8 then DrawSprite(sprSmokeTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State, Surface); gtExplosion: DrawSprite(sprExplosion50, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State, Surface); gtMine: if ((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420) - then DrawRotated(sprMineOff, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.DirAngle) - else DrawRotated(sprMineOn, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.DirAngle); + then DrawRotated(sprMineOff, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle) + else DrawRotated(sprMineOn, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); gtCase: case Gear^.Pos of posCaseAmmo : DrawSprite(sprCase, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0, Surface); posCaseHealth: DrawSprite(sprFAid, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 24 + WorldDy, (GameTicks shr 6) mod 13, Surface); end; gtDynamite: DrawSprite2(sprDynamite, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, Gear^.Tag and 1, Gear^.Tag shr 1, Surface); - gtClusterBomb: DrawRotated(sprClusterBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.DirAngle); + gtClusterBomb: DrawRotated(sprClusterBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); gtCluster: DrawSprite(sprClusterParticle, hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy, 0, Surface); gtFlame: DrawSprite(sprFlame, hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy,(GameTicks div 128 + Gear^.Angle) mod 8, Surface); gtParachute: DrawSprite(sprParachute, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 48 + WorldDy, 0, Surface); gtAirAttack: if Gear^.Tag > 0 then DrawSprite(sprAirplane, hwRound(Gear^.X) - 60 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, 0, Surface) else DrawSprite(sprAirplane, hwRound(Gear^.X) - 60 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, 1, Surface); - gtAirBomb: DrawRotated(sprAirBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, DxDy2Angle(Gear^.dY, Gear^.dX)); + gtAirBomb: DrawRotated(sprAirBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); gtSwitcher: DrawSprite(sprSwitch, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 56 + WorldDy, (GameTicks shr 6) mod 12, Surface); gtTarget: DrawSprite(sprTarget, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0, Surface); end; diff -r e6c0408b54ed -r 2ae8fd8ef804 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Mon Mar 24 19:18:13 2008 +0000 +++ b/hedgewars/uStore.pas Mon Mar 24 20:27:12 2008 +0000 @@ -30,9 +30,9 @@ procedure DrawSurfSprite(X, Y, Height, Frame: LongInt; Source: PTexture; Surface: PSDL_Surface); procedure DrawLand (X, Y: LongInt); procedure DrawTexture(X, Y: LongInt; Texture: PTexture); -procedure DrawRotated(Sprite: TSprite; X, Y: LongInt; Angle: real); +procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real); procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame: LongInt; Angle: real); -procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y: LongInt; Angle: real); +procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real); procedure DXOutText(X, Y: LongInt; Font: THWFont; s: string; Surface: PSDL_Surface); procedure DrawCentered(X, Top: LongInt; Source: PTexture); procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture; DestSurface: PSDL_Surface); @@ -358,12 +358,12 @@ glEnd() end; -procedure DrawRotated(Sprite: TSprite; X, Y: LongInt; Angle: real); +procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real); begin DrawRotatedTex(SpritesData[Sprite].Texture, - SpritesData[Sprite].Width, - SpritesData[Sprite].Height, - X, Y, Angle) + SpritesData[Sprite].Width, + SpritesData[Sprite].Height, + X, Y, Dir, Angle) end; procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame: LongInt; Angle: real); @@ -377,11 +377,18 @@ glPopMatrix end; -procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y: LongInt; Angle: real); +procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real); begin glPushMatrix; glTranslatef(X, Y, 0); -glRotatef(Angle, 0, 0, 1); + +if Dir < 0 then + begin + hw:= - hw; + glRotatef(Angle, 0, 0, -1); + end else + glRotatef(Angle, 0, 0, 1); + glBindTexture(GL_TEXTURE_2D, Tex^.id); diff -r e6c0408b54ed -r 2ae8fd8ef804 share/hedgewars/Data/Graphics/CMakeLists.txt --- a/share/hedgewars/Data/Graphics/CMakeLists.txt Mon Mar 24 19:18:13 2008 +0000 +++ b/share/hedgewars/Data/Graphics/CMakeLists.txt Mon Mar 24 20:27:12 2008 +0000 @@ -1,5 +1,6 @@ add_subdirectory(Graves) add_subdirectory(AmmoMenu) +add_subdirectory(Hedgehog) file(GLOB BaseSprites *.png) diff -r e6c0408b54ed -r 2ae8fd8ef804 share/hedgewars/Data/Graphics/Hedgehog.png Binary file share/hedgewars/Data/Graphics/Hedgehog.png has changed diff -r e6c0408b54ed -r 2ae8fd8ef804 share/hedgewars/Data/Graphics/Hedgehog/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Graphics/Hedgehog/CMakeLists.txt Mon Mar 24 20:27:12 2008 +0000 @@ -0,0 +1,5 @@ +file(GLOB HedgehogSprites *.png) + +install(FILES + ${HedgehogSprites} + DESTINATION ${SHAREPATH}Data/Graphics/Hedgehog) diff -r e6c0408b54ed -r 2ae8fd8ef804 share/hedgewars/Data/Graphics/Hedgehog/amRope.png Binary file share/hedgewars/Data/Graphics/Hedgehog/amRope.png has changed