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