hedgewars/GSHandlers.inc
changeset 2177 c045698e044f
parent 2143 ad05f6b2d1c0
child 2179 839472821b4d
equal deleted inserted replaced
2176:fc082baf448c 2177:c045698e044f
  2181 Gear^.Angle:= HHGear^.Angle;
  2181 Gear^.Angle:= HHGear^.Angle;
  2182 Gear^.Tag:= hwSign(HHGear^.dX);
  2182 Gear^.Tag:= hwSign(HHGear^.dX);
  2183 if HHGear^.dX.isNegative then Gear^.Angle:= 4096 - Gear^.Angle;
  2183 if HHGear^.dX.isNegative then Gear^.Angle:= 4096 - Gear^.Angle;
  2184 Gear^.doStep:= @doStepRCPlaneWork
  2184 Gear^.doStep:= @doStepRCPlaneWork
  2185 end;
  2185 end;
       
  2186 
       
  2187 procedure doStepJetpackWork(Gear: PGear);
       
  2188 var HHGear: PGear;
       
  2189     fuel: LongInt;
       
  2190     move: hwFloat;
       
  2191 begin
       
  2192 AllInactive:= false;
       
  2193 HHGear:=PHedgehog(Gear^.Hedgehog)^.Gear;
       
  2194 //dec(Gear^.Timer);
       
  2195 move:= _0_2;
       
  2196 fuel:= 50;
       
  2197 if (HHGear^.Message and gm_Precise) <> 0 then
       
  2198     begin
       
  2199     move:= _0_02;
       
  2200     fuel:= 5;
       
  2201     end;
       
  2202 if (HHGear^.Message and gm_Left) <> 0 then move.isNegative:= true;
       
  2203 
       
  2204 if (HHGear^.Message and gm_Up) <> 0 then
       
  2205     begin
       
  2206     HHGear^.dY:= HHGear^.dY - move;
       
  2207     dec(Gear^.Health, fuel)
       
  2208     end;
       
  2209 if (HHGear^.Message and (gm_Left or gm_Right)) <> 0 then
       
  2210     begin
       
  2211     HHGear^.dX:= HHGear^.dX + (move * _0_2);
       
  2212     dec(Gear^.Health, fuel div 5)
       
  2213     end;
       
  2214 if Gear^.Health < 0 then Gear^.Health:= 0;
       
  2215 if (GameTicks and $3F) = 0 then AddCaption('Fuel: '+inttostr(round(Gear^.Health/20))+'%', $FFFFFF, capgrpMessage);
       
  2216 
       
  2217 //AddCaption(inttostr(round(Gear^.Health/20))+'% : '+inttostr(round(Gear^.Timer/1000)), $FFFFFF, capgrpMessage);
       
  2218 
       
  2219 HHGear^.Message:= HHGear^.Message and not (gm_Up or gm_Precise or gm_Left or gm_Right);
       
  2220 HHGear^.State:= HHGear^.State and gstMoving and (not gstNotKickable); 
       
  2221 
       
  2222 Gear^.X:= HHGear^.X;
       
  2223 Gear^.Y:= HHGear^.Y;
       
  2224 doStepHedgehogMoving(HHGear);
       
  2225 
       
  2226 if //(Gear^.Timer = 0) or
       
  2227    (Gear^.Health = 0) or 
       
  2228    ((HHGear^.Message and gm_Attack) <> 0) or
       
  2229    (HHGear^.Damage <> 0) then
       
  2230 	begin
       
  2231 	HHGear^.Message:= 0;
       
  2232 	DeleteGear(Gear);
       
  2233 	AfterAttack;
       
  2234     HHGear^.Active:= true;
       
  2235 	end
       
  2236 end;
       
  2237 
       
  2238 procedure doStepJetpack(Gear: PGear);
       
  2239 var HHGear: PGear;
       
  2240 begin
       
  2241 Gear^.doStep:= @doStepJetpackWork;
       
  2242 
       
  2243 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
       
  2244 FollowGear:= HHGear;
       
  2245 with HHGear^ do
       
  2246 	begin
       
  2247 	State:= State and not gstAttacking;
       
  2248 	Message:= Message and not gm_Attack
       
  2249 	end
       
  2250 end;