diff -r 4c35e9cf6057 -r 40e5af28d026 hedgewars/PascalExports.pas --- a/hedgewars/PascalExports.pas Wed May 02 11:28:38 2012 +0200 +++ b/hedgewars/PascalExports.pas Wed May 02 10:53:13 2012 +0100 @@ -91,12 +91,12 @@ function HW_zoomFactor: GLfloat; cdecl; export; begin - exit( ZoomValue / cDefaultZoomLevel ); + HW_zoomFactor:= ZoomValue / cDefaultZoomLevel; end; function HW_zoomLevel: LongInt; cdecl; export; begin - exit( trunc((ZoomValue - cDefaultZoomLevel) / cZoomDelta) ); + HW_zoomLevel:= trunc((ZoomValue - cDefaultZoomLevel) / cZoomDelta); end; procedure HW_walkingKeysUp; cdecl; export; @@ -189,7 +189,7 @@ function HW_isPaused: boolean; cdecl; export; begin - exit( isPaused ); + HW_isPaused:= isPaused; end; // equivalent to esc+y; when closeFrontend = true the game exits after memory cleanup @@ -201,10 +201,9 @@ function HW_getSDLWindow: pointer; cdecl; export; begin + HW_getSDLWindow:= nil; {$IFDEF SDL13} - exit( SDLwindow ); -{$ELSE} - exit( nil ); + HW_getSDLWindow:= SDLwindow; {$ENDIF} end; @@ -224,45 +223,41 @@ // ammo menu related functions function HW_isAmmoMenuOpen: boolean; cdecl; export; begin - exit( bShowAmmoMenu ); + HW_isAmmoMenuOpen:= bShowAmmoMenu; end; function HW_isAmmoMenuNotAllowed: boolean; cdecl; export; begin; - exit( (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) - or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) ); + HW_isAmmoMenuNotAllowed:= ( (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or + ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) ); end; function HW_isWeaponRequiringClick: boolean; cdecl; export; begin + HW_isWeaponRequiringClick:= false; if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.BotLevel = 0) then - exit( (CurrentHedgehog^.Gear^.State and gstHHChooseTarget) <> 0 ) - else - exit(false); + HW_isWeaponRequiringClick:= (CurrentHedgehog^.Gear^.State and gstHHChooseTarget) <> 0; end; function HW_isWeaponTimerable: boolean; cdecl; export; begin + HW_isWeaponTimerable:= false; if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0) then - exit( (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_Timerable) <> 0) - else - exit(false); + HW_isWeaponTimerable:= (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_Timerable) <> 0; end; function HW_isWeaponSwitch: boolean cdecl; export; begin + HW_isWeaponSwitch:= false; if (CurAmmoGear <> nil) and (CurrentHedgehog^.BotLevel = 0) then - exit(CurAmmoGear^.AmmoType = amSwitch) - else - exit(false) + HW_isWeaponSwitch:= (CurAmmoGear^.AmmoType = amSwitch); end; function HW_isWeaponRope: boolean cdecl; export; begin + HW_isWeaponRope:= false if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0) then - exit(CurrentHedgehog^.CurAmmoType = amRope) - else - exit(false); + HW_isWeaponRope:= (CurrentHedgehog^.CurAmmoType = amRope); end; procedure HW_setGrenadeTime(time: LongInt); cdecl; export; @@ -272,14 +267,13 @@ function HW_getGrenadeTime: LongInt; cdecl; export; var CurWeapon: PAmmo; - res: LongInt = 3; begin + HW_getGrenadeTime:= 3; if HW_isWeaponTimerable then begin CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^); - res:= CurWeapon^.Timer div 1000; + HW_getGrenadeTime:= CurWeapon^.Timer div 1000; end; - exit(res); end; procedure HW_setPianoSound(snd: LongInt); cdecl; export; @@ -302,22 +296,22 @@ function HW_getWeaponNameByIndex(whichone: LongInt): PChar; cdecl; export; begin - exit(str2pchar(trammo[Ammoz[TAmmoType(whichone+1)].NameId])); + HW_getWeaponNameByIndex:= (str2pchar(trammo[Ammoz[TAmmoType(whichone+1)].NameId])); end; function HW_getWeaponCaptionByIndex(whichone: LongInt): PChar; cdecl; export; begin - exit(str2pchar(trammoc[Ammoz[TAmmoType(whichone+1)].NameId])); + HW_getWeaponCaptionByIndex:= (str2pchar(trammoc[Ammoz[TAmmoType(whichone+1)].NameId])); end; function HW_getWeaponDescriptionByIndex(whichone: LongInt): PChar; cdecl; export; begin - exit(str2pchar(trammod[Ammoz[TAmmoType(whichone+1)].NameId])); + HW_getWeaponDescriptionByIndex:= (str2pchar(trammod[Ammoz[TAmmoType(whichone+1)].NameId])); end; -function HW_getNumberOfWeapons:LongInt; cdecl; export; +function HW_getNumberOfWeapons: LongInt; cdecl; export; begin - exit(ord(high(TAmmoType))); + HW_getNumberOfWeapons:= ord(high(TAmmoType)); end; procedure HW_setWeapon(whichone: LongInt); cdecl; export; @@ -329,26 +323,27 @@ function HW_isWeaponAnEffect(whichone: LongInt): boolean; cdecl; export; begin - exit(Ammoz[TAmmoType(whichone+1)].Ammo.Propz and ammoprop_Effect <> 0) + HW_isWeaponAnEffect:= Ammoz[TAmmoType(whichone+1)].Ammo.Propz and ammoprop_Effect <> 0; end; function HW_getAmmoCounts(counts: PLongInt): LongInt; cdecl; export; var a : PHHAmmo; - slot, index: LongInt; + slot, index, res: LongInt; begin + HW_getAmmoCounts:= -1; // nil check if (CurrentHedgehog = nil) or (CurrentHedgehog^.Ammo = nil) or (CurrentTeam = nil) then - exit(-1); + exit; // hog controlled by opponent (net or ai) if (CurrentTeam^.ExtDriven) or (CurrentTeam^.Hedgehogs[0].BotLevel <> 0) then - exit(1); + exit; a:= CurrentHedgehog^.Ammo; for slot:= 0 to cMaxSlotIndex do for index:= 0 to cMaxSlotAmmoIndex do if a^[slot,index].Count <> 0 then // yes, ammomenu is hell counts[ord(a^[slot,index].AmmoType)-1]:= a^[slot,index].Count; - exit(0); + HW_getAmmoCounts:= 0; end; procedure HW_getAmmoDelays (skipTurns: PByte); cdecl; export; @@ -360,20 +355,19 @@ function HW_getTurnsForCurrentTeam: LongInt; cdecl; export; begin + HW_getTurnsForCurrentTeam:= 0; if (CurrentTeam <> nil) and (CurrentTeam^.Clan <> nil) then - exit(CurrentTeam^.Clan^.TurnNumber) - else - exit(0); + HW_getTurnsForCurrentTeam:= CurrentTeam^.Clan^.TurnNumber; end; function HW_getMaxNumberOfHogs: LongInt; cdecl; export; begin - exit(cMaxHHIndex+1); + HW_getMaxNumberOfHogs:= cMaxHHIndex + 1; end; function HW_getMaxNumberOfTeams: LongInt; cdecl; export; begin - exit(cMaxTeams); + HW_getMaxNumberOfTeams:= cMaxTeams; end; procedure HW_memoryWarningCallback; cdecl; export;