hedgewars/PascalExports.pas
changeset 3737 2ba6ac8a114b
parent 3697 d5b30d6373fc
child 3739 97cf933e5bd2
equal deleted inserted replaced
3736:d8982f9e7e2c 3737:2ba6ac8a114b
    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;
   179 
   186 
   180 procedure HW_getCursor(x,y: PLongInt); cdecl; export;
   187 procedure HW_getCursor(x,y: PLongInt); cdecl; export;
   181 begin
   188 begin
   182     x^:= CursorPoint.X;
   189     x^:= CursorPoint.X;
   183     y^:= CursorPoint.Y;
   190     y^:= CursorPoint.Y;
       
   191 end;
       
   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) 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     exit( (CurrentHedgehog^.Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Timerable) <> 0)
       
   217 end;
       
   218 
       
   219 function HW_isWeaponSwitch: boolean cdecl; export;
       
   220 begin
       
   221     if CurAmmoGear <> nil then
       
   222         exit(CurAmmoGear^.AmmoType = amSwitch)
       
   223     else
       
   224         exit(false)
       
   225 end;
       
   226 
       
   227 function HW_isWeaponRope: boolean cdecl; export;
       
   228 var CurSlot, CurAmmo: LongWord;
       
   229 begin
       
   230     CurSlot:= CurrentHedgehog^.CurSlot;
       
   231     CurAmmo:= CurrentHedgehog^.CurAmmo;
       
   232     exit (CurrentHedgehog^.Ammo^[CurSlot, CurAmmo].AmmoType = amRope)
       
   233 end;
       
   234 
       
   235 procedure HW_setGrenadeTime(time: LongInt); cdecl; export;
       
   236 begin
       
   237     ParseCommand('/timer ' + inttostr(time), true);
   184 end;
   238 end;
   185 
   239 
   186 procedure HW_setPianoSound(snd: LongInt); cdecl; export;
   240 procedure HW_setPianoSound(snd: LongInt); cdecl; export;
   187 var CurSlot, CurAmmo: LongWord;
   241 var CurSlot, CurAmmo: LongWord;
   188 begin
   242 begin
   201             7: PlaySound(sndPiano7);
   255             7: PlaySound(sndPiano7);
   202             else PlaySound(sndPiano8);
   256             else PlaySound(sndPiano8);
   203         end;
   257         end;
   204 end;
   258 end;
   205 
   259 
   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
   260 //amSwitch
   246 {$ENDIF}
   261 {$ENDIF}
   247 
   262 
   248 end.
   263 end.
   249 
   264