hedgewars/uGears.pas
changeset 1286 a02a5345b91e
parent 1285 993845ea5c8d
child 1294 50198e5c7f02
equal deleted inserted replaced
1285:993845ea5c8d 1286:a02a5345b91e
   700 						hwSign(Gear^.dX),
   700 						hwSign(Gear^.dX),
   701 						0);
   701 						0);
   702 				defaultPos:= false
   702 				defaultPos:= false
   703 				end;
   703 				end;
   704 			gtKamikaze: begin
   704 			gtKamikaze: begin
   705 						if CurAmmoGear^.Pos = 0 then
   705 				if CurAmmoGear^.Pos = 0 then
   706 							DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   706 					DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   707 									hwSign(Gear^.dX),
   707 							hwSign(Gear^.dX),
   708 									1,
   708 							1,
   709 									6,
   709 							6,
   710 									0)
   710 							0)
   711 						else
   711 				else
   712 							DrawRotatedF(sprKamikaze,
   712 					DrawRotatedF(sprKamikaze,
   713 									hwRound(Gear^.X) + WorldDx,
   713 							hwRound(Gear^.X) + WorldDx,
   714 									hwRound(Gear^.Y) + WorldDy,
   714 							hwRound(Gear^.Y) + WorldDy,
   715 									CurAmmoGear^.Pos - 1,
   715 							CurAmmoGear^.Pos - 1,
   716 									1,
   716 							1,
   717 									DxDy2Angle(Gear^.dY, Gear^.dX));
   717 							DxDy2Angle(Gear^.dY, Gear^.dX));
   718 
   718 
   719 						defaultPos:= false
   719 				defaultPos:= false
   720 						end;
   720 				end;
       
   721 			gtSeduction: begin
       
   722 				if CurAmmoGear^.Pos >= 6 then
       
   723 					DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
       
   724 							hwSign(Gear^.dX),
       
   725 							2,
       
   726 							2,
       
   727 							0)
       
   728 				else
       
   729 					begin
       
   730 					DrawRotatedF(sprDress,
       
   731 							hwRound(Gear^.X) + WorldDx,
       
   732 							hwRound(Gear^.Y) + WorldDy,
       
   733 							CurAmmoGear^.Pos,
       
   734 							hwSign(Gear^.dX),
       
   735 							0);
       
   736 					DrawSprite(sprCensored, hwRound(Gear^.X) - 32 + WorldDx, hwRound(Gear^.Y) - 20 + WorldDy, 0)
       
   737 					end;
       
   738 				defaultPos:= false
       
   739 				end;
   721 		end;
   740 		end;
   722 
   741 
   723 		case CurAmmoGear^.Kind of
   742 		case CurAmmoGear^.Kind of
   724 			gtShotgunShot,
   743 			gtShotgunShot,
   725 			gtDEagleShot,
   744 			gtDEagleShot,
   808 			amWhip: DrawRotatedF(sprWhip,
   827 			amWhip: DrawRotatedF(sprWhip,
   809 						hwRound(Gear^.X) + 1 + WorldDx,
   828 						hwRound(Gear^.X) + 1 + WorldDx,
   810 						hwRound(Gear^.Y) - 3 + WorldDy,
   829 						hwRound(Gear^.Y) - 3 + WorldDy,
   811 						0,
   830 						0,
   812 						hwSign(Gear^.dX),
   831 						hwSign(Gear^.dX),
   813 						0);
       
   814 			amSeduction: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
       
   815 						hwSign(Gear^.dX),
       
   816 						2,
       
   817 						2,
       
   818 						0);
   832 						0);
   819 		else
   833 		else
   820 			DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   834 			DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
   821 				hwSign(Gear^.dX),
   835 				hwSign(Gear^.dX),
   822 				0,
   836 				0,
  1094           gtMortar: DrawRotated(sprMortar, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1108           gtMortar: DrawRotated(sprMortar, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1095           gtCake: if Gear^.Pos = 6 then
  1109           gtCake: if Gear^.Pos = 6 then
  1096                      DrawRotatedf(sprCakeWalk, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle + hwSign(Gear^.dX) * 90)
  1110                      DrawRotatedf(sprCakeWalk, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle + hwSign(Gear^.dX) * 90)
  1097                   else
  1111                   else
  1098                      DrawRotatedf(sprCakeDown, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 5 - Gear^.Pos, hwSign(Gear^.dX), 0);
  1112                      DrawRotatedf(sprCakeDown, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 5 - Gear^.Pos, hwSign(Gear^.dX), 0);
  1099        gtSeduction: DrawSprite(sprSeduction, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0);
  1113        gtSeduction: if Gear^.Pos >= 6 then DrawSprite(sprSeduction, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0);
  1100       gtWatermelon: DrawRotatedf(sprWatermelon, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 0, Gear^.DirAngle);
  1114       gtWatermelon: DrawRotatedf(sprWatermelon, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 0, Gear^.DirAngle);
  1101       gtMelonPiece: DrawRotatedf(sprWatermelon, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 1, 0, Gear^.DirAngle);
  1115       gtMelonPiece: DrawRotatedf(sprWatermelon, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 1, 0, Gear^.DirAngle);
  1102      gtHellishBomb: DrawRotated(sprHellishBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle);
  1116      gtHellishBomb: DrawRotated(sprHellishBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle);
  1103       gtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State);
  1117       gtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State);
  1104          end;
  1118          end;
  1189     dmg: LongInt;
  1203     dmg: LongInt;
  1190 begin
  1204 begin
  1191 Gear^.Radius:= cShotgunRadius;
  1205 Gear^.Radius:= cShotgunRadius;
  1192 t:= GearsList;
  1206 t:= GearsList;
  1193 while t <> nil do
  1207 while t <> nil do
  1194     begin
  1208 	begin
  1195     dmg:= min(Gear^.Radius + t^.Radius - hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y)), 25);
  1209 	dmg:= min(Gear^.Radius + t^.Radius - hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y)), 25);
  1196     if dmg > 0 then
  1210 	if dmg > 0 then
  1197        case t^.Kind of
  1211 	case t^.Kind of
  1198            gtHedgehog,
  1212 		gtHedgehog,
  1199                gtMine,
  1213 			gtMine,
  1200                gtCase,
  1214 			gtCase,
  1201              gtTarget: begin
  1215 			gtTarget: begin
  1202                        inc(t^.Damage, dmg);
  1216 					inc(t^.Damage, dmg);
  1203 
  1217 
  1204                        if t^.Kind = gtHedgehog then
  1218 					if t^.Kind = gtHedgehog then
  1205                           AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, t);
  1219 							AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, t);
  1206 
  1220 
  1207                        DeleteCI(t);
  1221 					DeleteCI(t);
  1208                        t^.dX:= t^.dX + Gear^.dX * dmg * _0_01 + SignAs(cHHKick, Gear^.dX);
  1222 					t^.dX:= t^.dX + Gear^.dX * dmg * _0_01 + SignAs(cHHKick, Gear^.dX);
  1209                        t^.dY:= t^.dY + Gear^.dY * dmg * _0_01;
  1223 					t^.dY:= t^.dY + Gear^.dY * dmg * _0_01;
  1210                        t^.State:= t^.State or gstMoving;
  1224 					t^.State:= t^.State or gstMoving;
  1211                        t^.Active:= true;
  1225 					t^.Active:= true;
  1212                        FollowGear:= t
  1226 					FollowGear:= t
  1213                        end;
  1227 					end;
  1214               gtGrave: begin
  1228 			gtGrave: begin
  1215                        t^.dY:= - _0_1;
  1229 					t^.dY:= - _0_1;
  1216                        t^.Active:= true
  1230 					t^.Active:= true
  1217                        end;
  1231 					end;
  1218            end;
  1232 		end;
  1219     t:= t^.NextGear
  1233 	t:= t^.NextGear
  1220     end;
  1234 	end;
  1221 if (GameFlags and gfSolidLand) = 0 then DrawExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cShotgunRadius)
  1235 if (GameFlags and gfSolidLand) = 0 then DrawExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cShotgunRadius)
  1222 end;
  1236 end;
  1223 
  1237 
  1224 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt);
  1238 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt);
  1225 var t: PGearArray;
  1239 var t: PGearArray;