equal
deleted
inserted
replaced
45 uGearsList; |
45 uGearsList; |
46 |
46 |
47 procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord); |
47 procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord); |
48 var Gear: PGear; |
48 var Gear: PGear; |
49 dmg, dmgRadius, dmgBase: LongInt; |
49 dmg, dmgRadius, dmgBase: LongInt; |
50 fX, fY: hwFloat; |
50 fX, fY, tdX, tdY: hwFloat; |
51 vg: PVisualGear; |
51 vg: PVisualGear; |
52 i, cnt: LongInt; |
52 i, cnt: LongInt; |
53 begin |
53 begin |
54 if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')'); |
54 if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')'); |
55 if Radius > 25 then KickFlakes(Radius, X, Y); |
55 if Radius > 25 then KickFlakes(Radius, X, Y); |
62 if vg <> nil then |
62 if vg <> nil then |
63 vg^.Tint:= Tint; |
63 vg^.Tint:= Tint; |
64 end; |
64 end; |
65 if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion); |
65 if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion); |
66 |
66 |
67 if (Mask and EXPLAllDamageInRadius) = 0 then |
67 (*if (Mask and EXPLAllDamageInRadius) = 0 then |
68 dmgRadius:= Radius shl 1 |
68 dmgRadius:= Radius shl 1 |
69 else |
69 else |
70 dmgRadius:= Radius; |
70 dmgRadius:= Radius; |
71 dmgBase:= dmgRadius + cHHRadius div 2; |
71 dmgBase:= dmgRadius + cHHRadius div 2;*) |
|
72 dmgBase:= Radius shl 1 + cHHRadius div 2; |
72 fX:= int2hwFloat(X); |
73 fX:= int2hwFloat(X); |
73 fY:= int2hwFloat(Y); |
74 fY:= int2hwFloat(Y); |
74 Gear:= GearsList; |
75 Gear:= GearsList; |
75 while Gear <> nil do |
76 while Gear <> nil do |
76 begin |
77 begin |
92 gtTarget, |
93 gtTarget, |
93 gtFlame, |
94 gtFlame, |
94 gtExplosives, |
95 gtExplosives, |
95 gtStructure: begin |
96 gtStructure: begin |
96 // Run the calcs only once we know we have a type that will need damage |
97 // Run the calcs only once we know we have a type that will need damage |
97 if hwRound(hwAbs(Gear^.X-fX)+hwAbs(Gear^.Y-fY)) < dmgBase then |
98 tdX:= Gear^.X-fX; |
98 dmg:= dmgBase - max(hwRound(Distance(Gear^.X - fX, Gear^.Y - fY)),Gear^.Radius); |
99 tdY:= Gear^.Y-fY; |
|
100 if hwRound(hwAbs(tdX)+hwAbs(tdY)) < dmgBase then |
|
101 dmg:= dmgBase - max(hwRound(Distance(tdX, tdY)),Gear^.Radius); |
99 if dmg > 1 then |
102 if dmg > 1 then |
100 begin |
103 begin |
101 dmg:= ModifyDamage(min(dmg div 2, Radius), Gear); |
104 dmg:= ModifyDamage(min(dmg div 2, Radius), Gear); |
102 //AddFileLog('Damage: ' + inttostr(dmg)); |
105 //AddFileLog('Damage: ' + inttostr(dmg)); |
103 if (Mask and EXPLNoDamage) = 0 then |
106 if (Mask and EXPLNoDamage) = 0 then |
108 Gear^.State:= Gear^.State or gstWinner; |
111 Gear^.State:= Gear^.State or gstWinner; |
109 end; |
112 end; |
110 if ((Mask and EXPLDoNotTouchAny) = 0) and (((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog)) then |
113 if ((Mask and EXPLDoNotTouchAny) = 0) and (((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog)) then |
111 begin |
114 begin |
112 DeleteCI(Gear); |
115 DeleteCI(Gear); |
113 Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - fX)/(Gear^.Density/_3); |
116 Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, tdX)/(Gear^.Density/_3); |
114 Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - fY)/(Gear^.Density/_3); |
117 Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, tdY)/(Gear^.Density/_3); |
115 |
118 |
116 Gear^.State:= (Gear^.State or gstMoving) and (not gstLoser); |
119 Gear^.State:= (Gear^.State or gstMoving) and (not gstLoser); |
117 if not Gear^.Invulnerable then |
120 if not Gear^.Invulnerable then |
118 Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner); |
121 Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner); |
119 Gear^.Active:= true; |
122 Gear^.Active:= true; |
124 end; |
127 end; |
125 |
128 |
126 end; |
129 end; |
127 gtGrave: begin |
130 gtGrave: begin |
128 // Run the calcs only once we know we have a type that will need damage |
131 // Run the calcs only once we know we have a type that will need damage |
129 if hwRound(hwAbs(Gear^.X-fX)+hwAbs(Gear^.Y-fY)) < dmgBase then |
132 tdX:= Gear^.X-fX; |
130 dmg:= dmgBase - hwRound(Distance(Gear^.X - fX, Gear^.Y - fY)); |
133 tdY:= Gear^.Y-fY; |
|
134 if hwRound(hwAbs(tdX)+hwAbs(tdY)) < dmgBase then |
|
135 dmg:= dmgBase - hwRound(Distance(tdX, tdY)); |
131 if dmg > 1 then |
136 if dmg > 1 then |
132 begin |
137 begin |
133 dmg:= ModifyDamage(min(dmg div 2, Radius), Gear); |
138 dmg:= ModifyDamage(min(dmg div 2, Radius), Gear); |
134 Gear^.dY:= - _0_004 * dmg; |
139 Gear^.dY:= - _0_004 * dmg; |
135 Gear^.Active:= true |
140 Gear^.Active:= true |