# HG changeset patch # User unc0rr # Date 1159133538 0 # Node ID 9b91449486681924d9ee1f5e25e609dc44e19238 # Parent 92cff18a3ab6758ef54ad1e4bd1f25132a1c6f03 Many small fixes diff -r 92cff18a3ab6 -r 9b9144948668 QTfrontend/CMakeLists.txt --- a/QTfrontend/CMakeLists.txt Sun Sep 24 19:51:16 2006 +0000 +++ b/QTfrontend/CMakeLists.txt Sun Sep 24 21:32:18 2006 +0000 @@ -37,6 +37,7 @@ set(hwfr_moc_hdrs game.h hwform.h + binds.h netclient.h teamselect.h teamselhelper.h diff -r 92cff18a3ab6 -r 9b9144948668 hedgewars/uAIActions.pas --- a/hedgewars/uAIActions.pas Sun Sep 24 19:51:16 2006 +0000 +++ b/hedgewars/uAIActions.pas Sun Sep 24 21:32:18 2006 +0000 @@ -125,14 +125,6 @@ end end; -procedure SetWeapon(weap: Longword); -begin -with CurrentTeam^ do - with Hedgehogs[CurrHedgehog] do - while Ammo[CurSlot, CurAmmo].AmmoType <> TAmmoType(weap) do - ParseCommand('/slot ' + chr(49 + Ammoz[TAmmoType(weap)].Slot)); -end; - procedure ProcessAction(var Actions: TActions; Me: PGear); var s: shortstring; begin @@ -145,7 +137,7 @@ {$ENDIF} if (Action and ai_specmask) <> 0 then case Action of - aia_Weapon: SetWeapon(Param); + aia_Weapon: SetWeapon(TAmmoType(Param)); aia_WaitX: if round(Me.X) = Param then Time:= GameTicks else exit; aia_WaitY: if round(Me.Y) = Param then Time:= GameTicks diff -r 92cff18a3ab6 -r 9b9144948668 hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Sun Sep 24 19:51:16 2006 +0000 +++ b/hedgewars/uTeams.pas Sun Sep 24 21:32:18 2006 +0000 @@ -84,9 +84,10 @@ procedure RecountTeamHealth(team: PTeam); procedure RestoreTeamsFromSave; function CheckForWin: boolean; +procedure SetWeapon(weap: TAmmoType); implementation -uses uMisc, uStore, uWorld, uIO, uAI, uLocale; +uses uMisc, uStore, uWorld, uIO, uAI, uLocale, uConsole; const MaxTeamHealth: integer = 0; procedure FreeTeamsList; forward; @@ -359,6 +360,14 @@ end; end; +procedure SetWeapon(weap: TAmmoType); +begin +with CurrentTeam^ do + with Hedgehogs[CurrHedgehog] do + while Ammo[CurSlot, CurAmmo].AmmoType <> weap do + ParseCommand('/slot ' + chr(49 + Ammoz[TAmmoType(weap)].Slot)); +end; + initialization finalization diff -r 92cff18a3ab6 -r 9b9144948668 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Sun Sep 24 19:51:16 2006 +0000 +++ b/hedgewars/uWorld.pas Sun Sep 24 21:32:18 2006 +0000 @@ -88,8 +88,21 @@ Slot, Pos: integer; begin if (TurnTimeLeft = 0) or KbdKeyPressed then bShowAmmoMenu:= false; -if bShowAmmoMenu and (AMxCurr > AMxLeft) then dec(AMxCurr, MENUSPEED); -if (not bShowAmmoMenu) and (AMxCurr < cScreenWidth) then inc(AMxCurr, MENUSPEED); +if bShowAmmoMenu then + begin + if AMxCurr = cScreenWidth then prevPoint.X:= 0; + if AMxCurr > AMxLeft then dec(AMxCurr, MENUSPEED); + end else + begin + if AMxCurr = AMxLeft then + begin + CursorPoint.X:= cScreenWidth div 2; + CursorPoint.Y:= cScreenHeight div 2; + prevPoint:= CursorPoint; + SDL_WarpMouse(CursorPoint.X, CursorPoint.Y) + end; + if AMxCurr < cScreenWidth then inc(AMxCurr, MENUSPEED); + end; if CurrentTeam = nil then exit; Slot:= 0; @@ -137,16 +150,16 @@ DXOutText(AMxCurr + 175, cScreenHeight - 68, fnt16, chr(Ammo[Slot, Pos].Count + 48) + 'x', Surface); if bSelected then begin - CurSlot:= Slot; - CurAmmo:= Pos; - ApplyAmmoChanges(CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog]); - bShowAmmoMenu:= false + bShowAmmoMenu:= false; + SetWeapon(Ammo[Slot, Pos].AmmoType); + bSelected:= false; + exit end; end; end; bSelected:= false; -DrawSprite(sprArrow, CursorPoint.X, CursorPoint.Y, (RealTicks shr 6) mod 8, Surface) +if AMxLeft = AMxCurr then DrawSprite(sprArrow, CursorPoint.X, CursorPoint.Y, (RealTicks shr 6) mod 8, Surface) end; procedure MoveCamera; forward;