hedgewars/uVisualGears.pas
changeset 2827 45817d8386c7
parent 2716 b9ca1bfca24f
child 2848 8a1725b4f724
equal deleted inserted replaced
2826:fbcfc86ef477 2827:45817d8386c7
   153        DeleteVisualGear(Gear)
   153        DeleteVisualGear(Gear)
   154 else
   154 else
   155 	dec(Gear^.FrameTicks, Steps)
   155 	dec(Gear^.FrameTicks, Steps)
   156 end;
   156 end;
   157 
   157 
       
   158 procedure doStepShell(Gear: PVisualGear; Steps: Longword);
       
   159 begin
       
   160 Gear^.X:= Gear^.X + Gear^.dX * Steps;
       
   161 
       
   162 Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
       
   163 Gear^.dY:= Gear^.dY + cGravity * Steps;
       
   164 
       
   165 Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle;
       
   166 
       
   167 if Gear^.FrameTicks <= Steps then
       
   168 	DeleteVisualGear(Gear)
       
   169 else
       
   170 	dec(Gear^.FrameTicks, Steps)
       
   171 end;
       
   172 
   158 procedure doStepSmallDamage(Gear: PVisualGear; Steps: Longword);
   173 procedure doStepSmallDamage(Gear: PVisualGear; Steps: Longword);
   159 begin
   174 begin
   160 Gear^.Y:= Gear^.Y - _0_02 * Steps;
   175 Gear^.Y:= Gear^.Y - _0_02 * Steps;
   161 
   176 
   162 if Gear^.FrameTicks <= Steps then
   177 if Gear^.FrameTicks <= Steps then
   351 			@doStepTeamHealthSorter,
   366 			@doStepTeamHealthSorter,
   352 			@doStepSpeechBubble,
   367 			@doStepSpeechBubble,
   353 			@doStepBubble,
   368 			@doStepBubble,
   354 			@doStepSteam,
   369 			@doStepSteam,
   355 			@doStepSmoke,
   370 			@doStepSmoke,
   356 			@doStepHealth
   371 			@doStepHealth,
       
   372 			@doStepShell
   357 		);
   373 		);
   358 
   374 
   359 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
   375 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
   360 var gear: PVisualGear;
   376 var gear: PVisualGear;
   361 	t: Longword;
   377 	t: Longword;
   423 				dy:= AngleCos(t) * sp;
   439 				dy:= AngleCos(t) * sp;
   424 				dy.isNegative:= random(2) = 0;
   440 				dy.isNegative:= random(2) = 0;
   425 				FrameTicks:= 650 + random(250);
   441 				FrameTicks:= 650 + random(250);
   426 				Frame:= random(8)
   442 				Frame:= random(8)
   427 				end;
   443 				end;
       
   444 		vgtShell: FrameTicks:= 500;
   428 	vgtSmallDamageTag: begin
   445 	vgtSmallDamageTag: begin
   429 				gear^.FrameTicks:= 1100
   446 				gear^.FrameTicks:= 1100
   430 				end;
   447 				end;
   431 	vgtBubble: begin
   448 	vgtBubble: begin
   432 				dx.isNegative:= random(2) = 0;
   449 				dx.isNegative:= random(2) = 0;
   536 								1:glColor4f(1, 0, 0, Gear^.FrameTicks / 1000);
   553 								1:glColor4f(1, 0, 0, Gear^.FrameTicks / 1000);
   537 							end;
   554 							end;
   538 							DrawSprite(sprHealth, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, 0);
   555 							DrawSprite(sprHealth, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, 0);
   539 							glColor4f(1, 1, 1, 1);
   556 							glColor4f(1, 1, 1, 1);
   540 							end;
   557 							end;
       
   558 				vgtShell: begin
       
   559 							if Gear^.FrameTicks < 250 then
       
   560 								glColor4f(1, 1, 1, Gear^.FrameTicks / 250);
       
   561 							DrawRotatedF(sprShell, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
       
   562 							if Gear^.FrameTicks < 250 then
       
   563 								glColor4f(1, 1, 1, 1);
       
   564 							end;
   541             end;
   565             end;
   542         case Gear^.Kind of
   566         case Gear^.Kind of
   543             vgtSmallDamageTag: DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
   567             vgtSmallDamageTag: DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
   544             vgtSpeechBubble: if Gear^.Tex <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
   568             vgtSpeechBubble: if Gear^.Tex <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
   545         end;
   569         end;