hedgewars/HHHandlers.inc
changeset 1519 7b6adbe5266a
parent 1518 4e5796fe3aac
child 1528 3fee15104c1d
equal deleted inserted replaced
1518:4e5796fe3aac 1519:7b6adbe5266a
   486    end
   486    end
   487 end;
   487 end;
   488 
   488 
   489 procedure doStepHedgehogDriven(Gear: PGear);
   489 procedure doStepHedgehogDriven(Gear: PGear);
   490 var t: PGear;
   490 var t: PGear;
       
   491 	wasJumping: boolean;
   491 begin
   492 begin
   492 if not isInMultiShoot then
   493 if not isInMultiShoot then
   493    AllInactive:= false
   494    AllInactive:= false
   494 else
   495 else
   495    Gear^.Message:= 0;
   496    Gear^.Message:= 0;
   535 	if (((Gear^.Message and gm_Attack) <> 0)
   536 	if (((Gear^.Message and gm_Attack) <> 0)
   536 		or ((Gear^.State and gstAttacking) <> 0)) then
   537 		or ((Gear^.State and gstAttacking) <> 0)) then
   537 		Attack(Gear) // should be before others to avoid desync with '/put' msg and changing weapon msgs
   538 		Attack(Gear) // should be before others to avoid desync with '/put' msg and changing weapon msgs
   538 	else
   539 	else
   539 else with PHedgehog(Gear^.Hedgehog)^ do
   540 else with PHedgehog(Gear^.Hedgehog)^ do
   540 	 if ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0) 
   541 	 if ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0)
   541 		and ((Gear^.Message and gm_LJump) <> 0)
   542 		and ((Gear^.Message and gm_LJump) <> 0)
   542 		and (((Ammo^[CurSlot, CurAmmo].Propz) and ammoprop_AltUse) <> 0) then
   543 		and (((Ammo^[CurSlot, CurAmmo].Propz) and ammoprop_AltUse) <> 0) then
   543 		begin
   544 		begin
   544 		Gear^.Message:= Gear^.Message and not gm_LJump;
   545 		Gear^.Message:= Gear^.Message and not gm_LJump;
   545 		Attack(Gear)
   546 		Attack(Gear)
   563 
   564 
   564 if not isInMultiShoot then
   565 if not isInMultiShoot then
   565    HedgehogChAngle(Gear);
   566    HedgehogChAngle(Gear);
   566 
   567 
   567 if (Gear^.State and gstMoving) <> 0 then
   568 if (Gear^.State and gstMoving) <> 0 then
   568    begin
   569 	begin
   569    if ((Gear^.Message and gm_HJump) <> 0) and
   570 	wasJumping:= ((Gear^.State and gstHHJumping) <> 0);
   570       ((Gear^.State and gstHHJumping) <> 0) and
   571 	
   571       ((Gear^.State and gstHHHJump) = 0) then
   572 	if ((Gear^.Message and gm_HJump) <> 0) and
   572       if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then
   573 		wasJumping and
   573          begin
   574 		((Gear^.State and gstHHHJump) = 0) then
   574          Gear^.State:= Gear^.State or gstHHHJump or gstMoving;
   575 		if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then
   575          Gear^.dY:= -_0_25;
   576 			begin
   576          Gear^.dX:= -SignAs(_0_02, Gear^.dX);
   577 			Gear^.State:= Gear^.State or gstHHHJump or gstMoving;
   577          PlaySound(sndJump2, false)
   578 			Gear^.dY:= -_0_25;
   578          end;
   579 			Gear^.dX:= -SignAs(_0_02, Gear^.dX);
   579    Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
   580 			PlaySound(sndJump2, false)
   580 
   581 			end;
   581    if ((Gear^.State and gstHHJumping) <> 0) and
   582 	
   582       TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then SetLittle(Gear^.dX);
   583 	Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
   583 
   584 
   584    doStepHedgehogMoving(Gear);
   585 	if wasJumping and
   585 
   586 		TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then SetLittle(Gear^.dX);
   586    if ((Gear^.State and (gstMoving or gstDrowning)) = 0) then
   587 
   587       begin
   588 	doStepHedgehogMoving(Gear);
   588       AddGearCI(Gear);
   589 
   589       StepTicks:= 350
   590 	if ((Gear^.State and (gstMoving or gstDrowning)) = 0) then
   590       end;
   591 		begin
   591    exit
   592 		AddGearCI(Gear);
   592    end;
   593 		if wasJumping then
       
   594 			StepTicks:= 410
       
   595 		else
       
   596 			StepTicks:= 95
       
   597 		end;
       
   598 	exit
       
   599 	end;
   593 
   600 
   594 	if not isInMultiShoot then
   601 	if not isInMultiShoot then
   595 		begin
   602 		begin
   596 		if StepTicks > 0 then dec(StepTicks);
   603 		if StepTicks > 0 then dec(StepTicks);
   597 		if (StepTicks = 0) then HedgehogStep(Gear)
   604 		if (StepTicks = 0) then HedgehogStep(Gear)