hedgewars/PascalExports.pas
changeset 3740 2e7dda50fddd
parent 3739 97cf933e5bd2
child 3778 2e61bb50cc57
equal deleted inserted replaced
3735:26de8c8a5b5d 3740:2e7dda50fddd
    16 uses uKeys, GLunit, uWorld, uMisc, uConsole, uTeams, uConsts, uChat, uGears, uSound, hwengine;
    16 uses uKeys, GLunit, uWorld, uMisc, uConsole, uTeams, uConsts, uChat, uGears, uSound, hwengine;
    17 
    17 
    18 {$INCLUDE "config.inc"}
    18 {$INCLUDE "config.inc"}
    19 
    19 
    20 implementation
    20 implementation
    21 
       
    22 {$IFDEF HWLIBRARY}
    21 {$IFDEF HWLIBRARY}
       
    22 var cZoomVal: GLfloat;
    23 
    23 
    24 // retrieve protocol information
    24 // retrieve protocol information
    25 procedure HW_versionInfo(netProto: PShortInt; versionStr: PPChar); cdecl; export;
    25 procedure HW_versionInfo(netProto: PShortInt; versionStr: PPChar); cdecl; export;
    26 begin
    26 begin
    27 // http://bugs.freepascal.org/view.php?id=16156
    27 // http://bugs.freepascal.org/view.php?id=16156
    32 procedure HW_click; cdecl; export;
    32 procedure HW_click; cdecl; export;
    33 begin
    33 begin
    34     leftClick:= true;
    34     leftClick:= true;
    35 end;
    35 end;
    36 
    36 
       
    37 procedure HW_ammoMenu; cdecl; export;
       
    38 begin
       
    39     rightClick:= true;
       
    40 end;
       
    41 
       
    42 procedure HW_zoomSet(value: GLfloat); cdecl; export;
       
    43 begin
       
    44     cZoomVal:= value;
       
    45     ZoomValue:= value;
       
    46 end;
       
    47 
    37 procedure HW_zoomIn; cdecl; export;
    48 procedure HW_zoomIn; cdecl; export;
    38 begin
    49 begin
    39     if wheelDown = false then
    50     if wheelDown = false then
    40         wheelUp:= true;
    51         wheelUp:= true;
    41 end;
    52 end;
    46         wheelDown:= true;
    57         wheelDown:= true;
    47 end;
    58 end;
    48 
    59 
    49 procedure HW_zoomReset; cdecl; export;
    60 procedure HW_zoomReset; cdecl; export;
    50 begin
    61 begin
    51     middleClick:= true;
    62     ZoomValue:= cZoomVal;
       
    63     //middleClick:= true;
    52     // center the camera at current hog
    64     // center the camera at current hog
    53     if CurrentHedgehog <> nil then
    65     if CurrentHedgehog <> nil then
    54         followGear:= CurrentHedgehog^.Gear;
    66         followGear:= CurrentHedgehog^.Gear;
    55 end;
    67 end;
    56 
    68 
    61 
    73 
    62 function HW_zoomLevel: LongInt; cdecl; export;
    74 function HW_zoomLevel: LongInt; cdecl; export;
    63 begin
    75 begin
    64     writelntoconsole(inttostr(trunc((ZoomValue - cDefaultZoomLevel) / cZoomDelta) ));
    76     writelntoconsole(inttostr(trunc((ZoomValue - cDefaultZoomLevel) / cZoomDelta) ));
    65     exit( trunc((ZoomValue - cDefaultZoomLevel) / cZoomDelta) );
    77     exit( trunc((ZoomValue - cDefaultZoomLevel) / cZoomDelta) );
    66 end;
       
    67 
       
    68 procedure HW_ammoMenu; cdecl; export;
       
    69 begin
       
    70     rightClick:= true;
       
    71 end;
    78 end;
    72 
    79 
    73 procedure HW_walkingKeysUp; cdecl; export;
    80 procedure HW_walkingKeysUp; cdecl; export;
    74 begin
    81 begin
    75     leftKey:= false;
    82     leftKey:= false;
   181 begin
   188 begin
   182     x^:= CursorPoint.X;
   189     x^:= CursorPoint.X;
   183     y^:= CursorPoint.Y;
   190     y^:= CursorPoint.Y;
   184 end;
   191 end;
   185 
   192 
       
   193 function HW_isAmmoOpen: boolean; cdecl; export;
       
   194 begin
       
   195     exit(bShowAmmoMenu);
       
   196 end;
       
   197 
       
   198 function HW_isPaused: boolean; cdecl; export;
       
   199 begin
       
   200     exit( isPaused );
       
   201 end;
       
   202 
       
   203 function HW_isWeaponRequiringClick: boolean; cdecl; export;
       
   204 begin
       
   205     if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.BotLevel = 0) then
       
   206         exit( (CurrentHedgehog^.Gear^.State and gstHHChooseTarget) <> 0 )
       
   207     else
       
   208         exit(false);
       
   209 end;
       
   210 
       
   211 function HW_isWeaponTimerable: boolean; cdecl; export;
       
   212 var CurSlot, CurAmmo: LongWord;
       
   213 begin
       
   214     CurSlot:= CurrentHedgehog^.CurSlot;
       
   215     CurAmmo:= CurrentHedgehog^.CurAmmo;
       
   216     if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0) then
       
   217         exit( (CurrentHedgehog^.Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Timerable) <> 0)
       
   218     else
       
   219         exit(false);
       
   220 end;
       
   221 
       
   222 function HW_isWeaponSwitch: boolean cdecl; export;
       
   223 begin
       
   224     if (CurAmmoGear <> nil) and (CurrentHedgehog^.BotLevel = 0) then
       
   225         exit(CurAmmoGear^.AmmoType = amSwitch)
       
   226     else
       
   227         exit(false)
       
   228 end;
       
   229 
       
   230 function HW_isWeaponRope: boolean cdecl; export;
       
   231 var CurSlot, CurAmmo: LongWord;
       
   232 begin
       
   233     CurSlot:= CurrentHedgehog^.CurSlot;
       
   234     CurAmmo:= CurrentHedgehog^.CurAmmo;
       
   235     if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0) then
       
   236         exit (CurrentHedgehog^.Ammo^[CurSlot, CurAmmo].AmmoType = amRope)
       
   237     else
       
   238         exit(false);
       
   239 end;
       
   240 
       
   241 procedure HW_setGrenadeTime(time: LongInt); cdecl; export;
       
   242 begin
       
   243     ParseCommand('/timer ' + inttostr(time), true);
       
   244 end;
       
   245 
   186 procedure HW_setPianoSound(snd: LongInt); cdecl; export;
   246 procedure HW_setPianoSound(snd: LongInt); cdecl; export;
   187 var CurSlot, CurAmmo: LongWord;
   247 var CurSlot, CurAmmo: LongWord;
   188 begin
   248 begin
   189     CurSlot:= CurrentHedgehog^.CurSlot;
   249     CurSlot:= CurrentHedgehog^.CurSlot;
   190     CurAmmo:= CurrentHedgehog^.CurAmmo;
   250     CurAmmo:= CurrentHedgehog^.CurAmmo;
   191     // this most likely won't work in network game
   251     // this most likely won't work in network game
   192     if (CurrentHedgehog^.Ammo^[CurSlot, CurAmmo].AmmoType = amPiano) then
   252     if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0)
       
   253        and (CurrentHedgehog^.Ammo^[CurSlot, CurAmmo].AmmoType = amPiano) then
   193         case snd of
   254         case snd of
   194             0: PlaySound(sndPiano0);
   255             0: PlaySound(sndPiano0);
   195             1: PlaySound(sndPiano1);
   256             1: PlaySound(sndPiano1);
   196             2: PlaySound(sndPiano2);
   257             2: PlaySound(sndPiano2);
   197             3: PlaySound(sndPiano3);
   258             3: PlaySound(sndPiano3);
   200             6: PlaySound(sndPiano6);
   261             6: PlaySound(sndPiano6);
   201             7: PlaySound(sndPiano7);
   262             7: PlaySound(sndPiano7);
   202             else PlaySound(sndPiano8);
   263             else PlaySound(sndPiano8);
   203         end;
   264         end;
   204 end;
   265 end;
   205 
       
   206 function HW_isAmmoOpen: boolean; cdecl; export;
       
   207 begin
       
   208     exit(bShowAmmoMenu);
       
   209 end;
       
   210 
       
   211 function HW_isWeaponRequiringClick: boolean; cdecl; export;
       
   212 begin
       
   213     if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) then
       
   214         exit( (CurrentHedgehog^.Gear^.State and gstHHChooseTarget) <> 0 )
       
   215     else
       
   216         exit(false);
       
   217 end;
       
   218 
       
   219 function HW_isWeaponTimerable: boolean; cdecl; export;
       
   220 var CurSlot, CurAmmo: LongWord;
       
   221 begin
       
   222     CurSlot:= CurrentHedgehog^.CurSlot;
       
   223     CurAmmo:= CurrentHedgehog^.CurAmmo;
       
   224     exit( (CurrentHedgehog^.Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Timerable) <> 0)
       
   225 end;
       
   226 
       
   227 function HW_isWeaponSwitch: boolean cdecl; export;
       
   228 begin
       
   229     if CurAmmoGear <> nil then
       
   230         exit(CurAmmoGear^.AmmoType = amSwitch)
       
   231     else
       
   232         exit(false)
       
   233 end;
       
   234 
       
   235 function HW_isPaused: boolean; cdecl; export;
       
   236 begin
       
   237     exit( isPaused );
       
   238 end;
       
   239 
       
   240 procedure HW_setGrenadeTime(time: LongInt); cdecl; export;
       
   241 begin
       
   242     ParseCommand('/timer ' + inttostr(time), true);
       
   243 end;
       
   244 
       
   245 //amSwitch
       
   246 {$ENDIF}
   266 {$ENDIF}
   247 
   267 
   248 end.
   268 end.
   249 
   269