hedgewars/PascalExports.pas
changeset 5492 a0455a050ca8
parent 5194 851c6fbb44e6
child 5495 272ed78e59a7
child 5662 99083392cd4f
equal deleted inserted replaced
5491:3a82724de759 5492:a0455a050ca8
    75 end;
    75 end;
    76 
    76 
    77 procedure HW_zoomReset; cdecl; export;
    77 procedure HW_zoomReset; cdecl; export;
    78 begin
    78 begin
    79     ZoomValue:= cZoomVal;
    79     ZoomValue:= cZoomVal;
    80     //middleClick:= true;
       
    81     // center the camera at current hog
    80     // center the camera at current hog
    82     if CurrentHedgehog <> nil then
    81     if CurrentHedgehog <> nil then
    83         followGear:= CurrentHedgehog^.Gear;
    82         followGear:= CurrentHedgehog^.Gear;
    84 end;
    83 end;
    85 
    84 
   232     exit( bShowAmmoMenu );
   231     exit( bShowAmmoMenu );
   233 end;
   232 end;
   234 
   233 
   235 function HW_isAmmoMenuNotAllowed: boolean; cdecl; export;
   234 function HW_isAmmoMenuNotAllowed: boolean; cdecl; export;
   236 begin;
   235 begin;
   237     exit ( (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or
   236     exit( (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or
   238            ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) );
   237           ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) );
   239 end;
   238 end;
   240 
   239 
   241 function HW_isWeaponRequiringClick: boolean; cdecl; export;
   240 function HW_isWeaponRequiringClick: boolean; cdecl; export;
   242 begin
   241 begin
   243     if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.BotLevel = 0) then
   242     if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.BotLevel = 0) then
   263 end;
   262 end;
   264 
   263 
   265 function HW_isWeaponRope: boolean cdecl; export;
   264 function HW_isWeaponRope: boolean cdecl; export;
   266 begin
   265 begin
   267     if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0) then
   266     if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0) then
   268         exit (CurrentHedgehog^.CurAmmoType = amRope)
   267         exit(CurrentHedgehog^.CurAmmoType = amRope)
   269     else
   268     else
   270         exit(false);
   269         exit(false);
   271 end;
   270 end;
   272 
   271 
   273 procedure HW_setGrenadeTime(time: LongInt); cdecl; export;
   272 procedure HW_setGrenadeTime(time: LongInt); cdecl; export;
   293         end;
   292         end;
   294 end;
   293 end;
   295 
   294 
   296 function HW_getWeaponNameByIndex(whichone: LongInt): PChar; cdecl; export;
   295 function HW_getWeaponNameByIndex(whichone: LongInt): PChar; cdecl; export;
   297 begin
   296 begin
   298     exit (str2pchar(trammo[Ammoz[TAmmoType(whichone+1)].NameId]));
   297     exit(str2pchar(trammo[Ammoz[TAmmoType(whichone+1)].NameId]));
   299 end;
   298 end;
   300 
   299 
   301 function HW_getWeaponCaptionByIndex(whichone: LongInt): PChar; cdecl; export;
   300 function HW_getWeaponCaptionByIndex(whichone: LongInt): PChar; cdecl; export;
   302 begin
   301 begin
   303     exit (str2pchar(trammoc[Ammoz[TAmmoType(whichone+1)].NameId]));
   302     exit(str2pchar(trammoc[Ammoz[TAmmoType(whichone+1)].NameId]));
   304 end;
   303 end;
   305 
   304 
   306 function HW_getWeaponDescriptionByIndex(whichone: LongInt): PChar; cdecl; export;
   305 function HW_getWeaponDescriptionByIndex(whichone: LongInt): PChar; cdecl; export;
   307 begin
   306 begin
   308     exit (str2pchar(trammod[Ammoz[TAmmoType(whichone+1)].NameId]));
   307     exit(str2pchar(trammod[Ammoz[TAmmoType(whichone+1)].NameId]));
   309 end;
   308 end;
   310 
   309 
   311 function HW_getNumberOfWeapons:LongInt; cdecl; export;
   310 function HW_getNumberOfWeapons:LongInt; cdecl; export;
   312 begin
   311 begin
   313     exit(ord(high(TAmmoType)));
   312     exit(ord(high(TAmmoType)));
   314 end;
   313 end;
   315 
   314 
   316 procedure HW_setWeapon(whichone: LongInt); cdecl; export;
   315 procedure HW_setWeapon(whichone: LongInt); cdecl; export;
   317 begin
   316 begin
       
   317     if (CurrentTeam = nil) then exit;
   318     if (not CurrentTeam^.ExtDriven) and (CurrentTeam^.Hedgehogs[0].BotLevel = 0) then
   318     if (not CurrentTeam^.ExtDriven) and (CurrentTeam^.Hedgehogs[0].BotLevel = 0) then
   319         SetWeapon(TAmmoType(whichone+1));
   319         SetWeapon(TAmmoType(whichone+1));
   320 end;
   320 end;
   321 
   321 
   322 function HW_isWeaponAnEffect(whichone: LongInt): boolean; cdecl; export;
   322 function HW_isWeaponAnEffect(whichone: LongInt): boolean; cdecl; export;
   326 
   326 
   327 function HW_getAmmoCounts(counts: PLongInt): LongInt; cdecl; export;
   327 function HW_getAmmoCounts(counts: PLongInt): LongInt; cdecl; export;
   328 var a : PHHAmmo;
   328 var a : PHHAmmo;
   329     slot, index: LongInt;
   329     slot, index: LongInt;
   330 begin
   330 begin
   331     if (CurrentTeam = nil) or
   331     // nil check
   332        (CurrentHedgehog = nil) or
   332     if (CurrentHedgehog = nil) or (CurrentHedgehog^.Ammo = nil) or (CurrentTeam = nil) then
   333        (CurrentTeam^.ExtDriven) or
       
   334        (CurrentTeam^.Hedgehogs[0].BotLevel <> 0) then
       
   335         exit(-1);
   333         exit(-1);
       
   334     // hog controlled by opponent (net or ai)
       
   335     if (CurrentTeam^.ExtDriven) or (CurrentTeam^.Hedgehogs[0].BotLevel <> 0) then
       
   336         exit(1);
   336 
   337 
   337     a:= CurrentHedgehog^.Ammo;
   338     a:= CurrentHedgehog^.Ammo;
   338     for slot:= 0 to cMaxSlotIndex do
   339     for slot:= 0 to cMaxSlotIndex do
   339         for index:= 0 to cMaxSlotAmmoIndex do
   340         for index:= 0 to cMaxSlotAmmoIndex do
   340             if a^[slot,index].Count <> 0 then // yes, ammomenu is hell
   341             if a^[slot,index].Count <> 0 then // yes, ammomenu is hell
   349         skipTurns[ord(a)-1]:= byte(Ammoz[a].SkipTurns);
   350         skipTurns[ord(a)-1]:= byte(Ammoz[a].SkipTurns);
   350 end;
   351 end;
   351 
   352 
   352 function HW_getTurnsForCurrentTeam: LongInt; cdecl; export;
   353 function HW_getTurnsForCurrentTeam: LongInt; cdecl; export;
   353 begin
   354 begin
   354     exit(CurrentTeam^.Clan^.TurnNumber);
   355     if (CurrentTeam <> nil) and (CurrentTeam^.Clan <> nil) then
       
   356         exit(CurrentTeam^.Clan^.TurnNumber)
       
   357     else
       
   358         exit(0);
   355 end;
   359 end;
   356 
   360 
   357 function HW_getMaxNumberOfHogs: LongInt; cdecl; export;
   361 function HW_getMaxNumberOfHogs: LongInt; cdecl; export;
   358 begin
   362 begin
   359     exit(cMaxHHIndex+1);
   363     exit(cMaxHHIndex+1);