35 interface |
35 interface |
36 uses SDLh, uConsts, uFloat, uTypes; |
36 uses SDLh, uConsts, uFloat, uTypes; |
37 |
37 |
38 procedure initModule; |
38 procedure initModule; |
39 procedure freeModule; |
39 procedure freeModule; |
40 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword ): PGear; |
40 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content, cnt: Longword): PGear; |
41 function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; explode: boolean; poison: boolean ): PGear; |
41 function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; explode: boolean; poison: boolean ): PGear; |
42 function GetAmmo(Hedgehog: PHedgehog): TAmmoType; |
42 function GetAmmo(Hedgehog: PHedgehog): TAmmoType; |
43 function GetUtility(Hedgehog: PHedgehog): TAmmoType; |
43 function GetUtility(Hedgehog: PHedgehog): TAmmoType; |
44 procedure HideHog(HH: PHedgehog); |
44 procedure HideHog(HH: PHedgehog); |
45 procedure RestoreHog(HH: PHedgehog); |
45 procedure RestoreHog(HH: PHedgehog); |
57 |
57 |
58 implementation |
58 implementation |
59 uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics, |
59 uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics, |
60 uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables, |
60 uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables, |
61 uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture, |
61 uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture, |
62 uGearsHedgehog, uGearsUtils, uGearsList; |
62 uGearsHedgehog, uGearsUtils, uGearsList, uGearsHandlers; |
63 |
63 |
64 var skipFlag: boolean; |
64 var skipFlag: boolean; |
65 |
65 |
66 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward; |
66 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward; |
67 //procedure AmmoFlameWork(Ammo: PGear); forward; |
67 //procedure AmmoFlameWork(Ammo: PGear); forward; |
68 function GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): TPGearArray; forward; |
68 function GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): PGearArrayS; forward; |
69 procedure SpawnBoxOfSmth; forward; |
69 procedure SpawnBoxOfSmth; forward; |
70 procedure ShotgunShot(Gear: PGear); forward; |
70 procedure ShotgunShot(Gear: PGear); forward; |
71 procedure doStepCase(Gear: PGear); forward; |
71 procedure doStepCase(Gear: PGear); forward; |
72 |
72 |
73 |
73 |
869 dec(Count) |
869 dec(Count) |
870 end |
870 end |
871 end |
871 end |
872 end; |
872 end; |
873 |
873 |
874 function GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): TPGearArray; |
874 var GearsNearArray : TPGearArray; |
|
875 function GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): PGearArrayS; |
875 var |
876 var |
876 t: PGear; |
877 t: PGear; |
877 l: Longword; |
878 s: Longword; |
878 begin |
879 begin |
879 r:= r*r; |
880 r:= r*r; |
880 GearsNear := nil; |
881 s:= 0; |
|
882 SetLength(GearsNearArray, s); |
881 t := GearsList; |
883 t := GearsList; |
882 while t <> nil do |
884 while t <> nil do |
883 begin |
885 begin |
884 if (t^.Kind = Kind) |
886 if (t^.Kind = Kind) |
885 and ((X - t^.X)*(X - t^.X) + (Y - t^.Y)*(Y-t^.Y) < int2hwFloat(r)) then |
887 and ((X - t^.X)*(X - t^.X) + (Y - t^.Y)*(Y-t^.Y) < int2hwFloat(r)) then |
886 begin |
888 begin |
887 l:= Length(GearsNear); |
889 inc(s); |
888 SetLength(GearsNear, l + 1); |
890 SetLength(GearsNearArray, s); |
889 GearsNear[l] := t; |
891 GearsNearArray[s - 1] := t; |
890 end; |
892 end; |
891 t := t^.NextGear; |
893 t := t^.NextGear; |
892 end; |
894 end; |
|
895 |
|
896 GearsNear.size:= s; |
|
897 GearsNear.ar:= @GearsNearArray |
893 end; |
898 end; |
894 |
899 |
895 {procedure AmmoFlameWork(Ammo: PGear); |
900 {procedure AmmoFlameWork(Ammo: PGear); |
896 var t: PGear; |
901 var t: PGear; |
897 begin |
902 begin |
926 t:= t^.NextGear |
931 t:= t^.NextGear |
927 end; |
932 end; |
928 CountGears:= count; |
933 CountGears:= count; |
929 end; |
934 end; |
930 |
935 |
931 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword): PGear; |
936 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content, cnt: Longword): PGear; |
932 begin |
937 begin |
933 FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0); |
938 FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0); |
934 cCaseFactor := 0; |
939 cCaseFactor := 0; |
935 |
940 |
936 if (crate <> HealthCrate) and (content > ord(High(TAmmoType))) then |
941 if (crate <> HealthCrate) and (content > ord(High(TAmmoType))) then |
937 content := ord(High(TAmmoType)); |
942 content := ord(High(TAmmoType)); |
|
943 |
|
944 FollowGear^.Power:= cnt; |
938 |
945 |
939 case crate of |
946 case crate of |
940 HealthCrate: |
947 HealthCrate: |
941 begin |
948 begin |
942 FollowGear^.Pos := posCaseHealth; |
949 FollowGear^.Pos := posCaseHealth; |