hedgewars/uVisualGears.pas
changeset 2695 ed789a7ef68d
parent 2671 7e0f88013fe8
child 2699 249adefa9c1c
equal deleted inserted replaced
2694:dcd248e04f3d 2695:ed789a7ef68d
   334 			@doStepSteam,
   334 			@doStepSteam,
   335 			@doStepHealth
   335 			@doStepHealth
   336 		);
   336 		);
   337 
   337 
   338 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
   338 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
   339 var Result: PVisualGear;
   339 var gear: PVisualGear;
   340 	t: Longword;
   340 	t: Longword;
   341 	sp: hwFloat;
   341 	sp: hwFloat;
   342 begin
   342 begin
   343 if (GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) then // we are scrolling now
   343 if (GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) then // we are scrolling now
   344 	if Kind <> vgtCloud then
   344 	if Kind <> vgtCloud then
   354 	begin
   354 	begin
   355 	AddVisualGear:= nil;
   355 	AddVisualGear:= nil;
   356 	exit
   356 	exit
   357 	end;
   357 	end;
   358 
   358 
   359 New(Result);
   359 New(gear);
   360 FillChar(Result^, sizeof(TVisualGear), 0);
   360 FillChar(gear^, sizeof(TVisualGear), 0);
   361 Result^.X:= int2hwFloat(X);
   361 gear^.X:= int2hwFloat(X);
   362 Result^.Y:= int2hwFloat(Y);
   362 gear^.Y:= int2hwFloat(Y);
   363 Result^.Kind := Kind;
   363 gear^.Kind := Kind;
   364 Result^.doStep:= doStepHandlers[Kind];
   364 gear^.doStep:= doStepHandlers[Kind];
   365 
   365 
   366 with Result^ do
   366 with gear^ do
   367 	case Kind of
   367 	case Kind of
   368 	vgtFlake: begin
   368 	vgtFlake: begin
   369 				FrameTicks:= random(vobFrameTicks);
   369 				FrameTicks:= random(vobFrameTicks);
   370 				Frame:= random(vobFramesCount);
   370 				Frame:= random(vobFramesCount);
   371 				Angle:= random * 360;
   371 				Angle:= random * 360;
   403 				dy.isNegative:= random(2) = 0;
   403 				dy.isNegative:= random(2) = 0;
   404 				FrameTicks:= 650 + random(250);
   404 				FrameTicks:= 650 + random(250);
   405 				Frame:= random(8)
   405 				Frame:= random(8)
   406 				end;
   406 				end;
   407 	vgtSmallDamageTag: begin
   407 	vgtSmallDamageTag: begin
   408 				Result^.FrameTicks:= 1100
   408 				gear^.FrameTicks:= 1100
   409 				end;
   409 				end;
   410 	vgtBubble: begin
   410 	vgtBubble: begin
   411 				dx.isNegative:= random(2) = 0;
   411 				dx.isNegative:= random(2) = 0;
   412 				dx.QWordValue:= random(100000000);
   412 				dx.QWordValue:= random(100000000);
   413 				dy:= _0_001 * (random(85) + 95);
   413 				dy:= _0_001 * (random(85) + 95);
   432 				end;
   432 				end;
   433 		end;
   433 		end;
   434 
   434 
   435 if VisualGearsList <> nil then
   435 if VisualGearsList <> nil then
   436 	begin
   436 	begin
   437 	VisualGearsList^.PrevGear:= Result;
   437 	VisualGearsList^.PrevGear:= gear;
   438 	Result^.NextGear:= VisualGearsList
   438 	gear^.NextGear:= VisualGearsList
   439 	end;
   439 	end;
   440 VisualGearsList:= Result;
   440 VisualGearsList:= gear;
   441 
   441 
   442 AddVisualGear:= Result
   442 AddVisualGear:= gear;
   443 end;
   443 end;
   444 
   444 
   445 procedure DeleteVisualGear(Gear: PVisualGear);
   445 procedure DeleteVisualGear(Gear: PVisualGear);
   446 begin
   446 begin
   447 if Gear^.Tex <> nil then
   447 if Gear^.Tex <> nil then