2957 end; |
2957 end; |
2958 |
2958 |
2959 procedure doStepJetpackWork(Gear: PGear); |
2959 procedure doStepJetpackWork(Gear: PGear); |
2960 var |
2960 var |
2961 HHGear: PGear; |
2961 HHGear: PGear; |
2962 fuel: LongInt; |
2962 fuel, i: LongInt; |
2963 move: hwFloat; |
2963 move: hwFloat; |
2964 begin |
2964 isUnderwater: Boolean; |
|
2965 bubble: PVisualGear; |
|
2966 begin |
|
2967 isUnderwater:= cWaterLine < hwRound(Gear^.Y) + Gear^.Radius; |
2965 if Gear^.Pos > 0 then dec(Gear^.Pos); |
2968 if Gear^.Pos > 0 then dec(Gear^.Pos); |
2966 AllInactive := false; |
2969 AllInactive := false; |
2967 HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; |
2970 HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; |
2968 //dec(Gear^.Timer); |
2971 //dec(Gear^.Timer); |
2969 move := _0_2; |
2972 move := _0_2; |
2977 if Gear^.Health > 0 then |
2980 if Gear^.Health > 0 then |
2978 begin |
2981 begin |
2979 if (HHGear^.Message and gmUp) <> 0 then |
2982 if (HHGear^.Message and gmUp) <> 0 then |
2980 begin |
2983 begin |
2981 if (not HHGear^.dY.isNegative) or (HHGear^.Y > -_256) then |
2984 if (not HHGear^.dY.isNegative) or (HHGear^.Y > -_256) then |
2982 HHGear^.dY := HHGear^.dY - move; |
2985 begin |
|
2986 if isUnderwater then |
|
2987 begin |
|
2988 HHGear^.dY := HHGear^.dY - (move * _0_7); |
|
2989 for i:= random(10)+10 downto 0 do |
|
2990 begin |
|
2991 bubble := AddVisualGear(hwRound(HHGear^.X) - 8 + random(16), hwRound(HHGear^.Y) + 16 + random(8), vgtBubble); |
|
2992 if bubble <> nil then bubble^.dY:= random(20)/10+0.1; |
|
2993 end |
|
2994 end |
|
2995 else HHGear^.dY := HHGear^.dY - move; |
|
2996 end; |
2983 dec(Gear^.Health, fuel); |
2997 dec(Gear^.Health, fuel); |
2984 Gear^.MsgParam := Gear^.MsgParam or gmUp; |
2998 Gear^.MsgParam := Gear^.MsgParam or gmUp; |
2985 Gear^.Timer := GameTicks |
2999 Gear^.Timer := GameTicks |
2986 end; |
3000 end; |
2987 if (HHGear^.Message and gmLeft) <> 0 then move.isNegative := true; |
3001 move.isNegative := (HHGear^.Message and gmLeft) <> 0; |
2988 if (HHGear^.Message and (gmLeft or gmRight)) <> 0 then |
3002 if (HHGear^.Message and (gmLeft or gmRight)) <> 0 then |
2989 begin |
3003 begin |
2990 HHGear^.dX := HHGear^.dX + (move * _0_1); |
3004 HHGear^.dX := HHGear^.dX + (move * _0_1); |
|
3005 if isUnderwater then |
|
3006 begin |
|
3007 for i:= random(5)+5 downto 0 do |
|
3008 begin |
|
3009 bubble := AddVisualGear(hwRound(HHGear^.X)+random(8), hwRound(HHGear^.Y) - 8 + random(16), vgtBubble); |
|
3010 if bubble <> nil then |
|
3011 begin |
|
3012 bubble^.dX:= (random(10)/10 + 0.02) * -1; |
|
3013 if (move.isNegative) then |
|
3014 begin |
|
3015 bubble^.X := bubble^.X + 28; |
|
3016 bubble^.dX *= -1 |
|
3017 end |
|
3018 else bubble^.X := bubble^.X - 28; |
|
3019 end; |
|
3020 end |
|
3021 end; |
2991 dec(Gear^.Health, fuel div 5); |
3022 dec(Gear^.Health, fuel div 5); |
2992 Gear^.MsgParam := Gear^.MsgParam or (HHGear^.Message and (gmLeft or gmRight)); |
3023 Gear^.MsgParam := Gear^.MsgParam or (HHGear^.Message and (gmLeft or gmRight)); |
2993 Gear^.Timer := GameTicks |
3024 Gear^.Timer := GameTicks |
2994 end |
3025 end |
2995 end; |
3026 end; |