hedgewars/PascalExports.pas
changeset 4861 91f889289a47
parent 4812 f924be23ffb4
child 4920 bc3c077e15a2
equal deleted inserted replaced
4860:4f9d05416fd6 4861:91f889289a47
    20 
    20 
    21 unit PascalExports;
    21 unit PascalExports;
    22 
    22 
    23 interface
    23 interface
    24 uses uTypes, uConsts, uVariables, GLunit, uKeys, uChat, uSound, uAmmos, uUtils,
    24 uses uTypes, uConsts, uVariables, GLunit, uKeys, uChat, uSound, uAmmos, uUtils,
    25      uCommands;
    25      uCommands, uMobile;
    26 
    26 
    27 {$INCLUDE "config.inc"}
    27 {$INCLUDE "config.inc"}
    28 
    28 
    29 implementation
    29 implementation
    30 {$IFDEF HWLIBRARY}
    30 {$IFDEF HWLIBRARY}
    36 begin
    36 begin
    37     netProto^:= cNetProtoVersion;
    37     netProto^:= cNetProtoVersion;
    38     versionStr^:= cVersionString;
    38     versionStr^:= cVersionString;
    39 end;
    39 end;
    40 
    40 
       
    41 // emulate mouse/keyboard input
    41 procedure HW_click; cdecl; export;
    42 procedure HW_click; cdecl; export;
    42 begin
    43 begin
    43     leftClick:= true;
    44     leftClick:= true;
    44 end;
    45 end;
    45 
    46 
   188 procedure HW_resume; cdecl; export;
   189 procedure HW_resume; cdecl; export;
   189 begin
   190 begin
   190     GameState:= previousGameState;
   191     GameState:= previousGameState;
   191 end;
   192 end;
   192 
   193 
       
   194 // equivalent to esc+y; when closeFrontend = true the game exits after memory cleanup
   193 procedure HW_terminate(closeFrontend: boolean); cdecl; export;
   195 procedure HW_terminate(closeFrontend: boolean); cdecl; export;
   194 begin
   196 begin
   195     isTerminated:= true;
   197     {$IFDEF IPHONEOS}setGameRunning(false);{$ENDIF}
   196     if closeFrontend then alsoShutdownFrontend:= true;
   198     alsoShutdownFrontend:= closeFrontend;
   197 end;
   199     ParseCommand('forcequit', true);
   198 
   200 end;
       
   201 
       
   202 // cursor handling
   199 procedure HW_setCursor(x,y: LongInt); cdecl; export;
   203 procedure HW_setCursor(x,y: LongInt); cdecl; export;
   200 begin
   204 begin
   201     CursorPoint.X:= x;
   205     CursorPoint.X:= x;
   202     CursorPoint.Y:= y;
   206     CursorPoint.Y:= y;
   203 end;
   207 end;
   206 begin
   210 begin
   207     x^:= CursorPoint.X;
   211     x^:= CursorPoint.X;
   208     y^:= CursorPoint.Y;
   212     y^:= CursorPoint.Y;
   209 end;
   213 end;
   210 
   214 
       
   215 // ammo menu related functions
   211 function HW_isAmmoMenuOpen: boolean; cdecl; export;
   216 function HW_isAmmoMenuOpen: boolean; cdecl; export;
   212 begin
   217 begin
   213     exit(bShowAmmoMenu);
   218     exit( bShowAmmoMenu );
   214 end;
   219 end;
   215 
   220 
   216 function HW_isAmmoMenuNotAllowed: boolean; cdecl; export;
   221 function HW_isAmmoMenuNotAllowed: boolean; cdecl; export;
   217 begin;
   222 begin;
   218     exit ( (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or
   223     exit ( (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or
   219            ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) );
   224            ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) );
   220 end;
       
   221 
       
   222 function HW_isWaiting: boolean; cdecl; export;
       
   223 begin
       
   224     exit( ReadyTimeLeft > 0 );
       
   225 end;
   225 end;
   226 
   226 
   227 function HW_isWeaponRequiringClick: boolean; cdecl; export;
   227 function HW_isWeaponRequiringClick: boolean; cdecl; export;
   228 begin
   228 begin
   229     if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.BotLevel = 0) then
   229     if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.BotLevel = 0) then