1645 if lua_gettop(L) <> 0 then |
1646 if lua_gettop(L) <> 0 then |
1646 LuaError('Lua: Wrong number of parameters passed to GetCurAmmoType!') |
1647 LuaError('Lua: Wrong number of parameters passed to GetCurAmmoType!') |
1647 else |
1648 else |
1648 lua_pushinteger(L, ord(CurrentHedgehog^.CurAmmoType)); |
1649 lua_pushinteger(L, ord(CurrentHedgehog^.CurAmmoType)); |
1649 lc_getcurammotype := 1; |
1650 lc_getcurammotype := 1; |
|
1651 end; |
|
1652 |
|
1653 function lc_savecampaignvar(L : Plua_State): LongInt; Cdecl; |
|
1654 begin |
|
1655 if lua_gettop(L) <> 2 then |
|
1656 LuaError('Lua: Wrong number of parameters passed to SaveCampaignVar!') |
|
1657 else begin |
|
1658 SendIPC('V!' + lua_tostring(L, 1) + ' ' + lua_tostring(L, 2) + #0); |
|
1659 end; |
|
1660 lc_savecampaignvar := 0; |
|
1661 end; |
|
1662 |
|
1663 function lc_getcampaignvar(L : Plua_State): LongInt; Cdecl; |
|
1664 begin |
|
1665 if (lua_gettop(L) <> 1) then |
|
1666 LuaError('Lua: Wrong number of parameters passed to GetCampaignVar!') |
|
1667 else |
|
1668 SendIPCAndWaitReply('V?' + lua_tostring(L, 1)); |
|
1669 lua_pushstring(L, str2pchar(CampaignVariable)); |
|
1670 lc_getcampaignvar := 1; |
|
1671 end; |
|
1672 |
|
1673 function lc_hidehog(L: Plua_State): LongInt; Cdecl; |
|
1674 var gear: PGear; |
|
1675 begin |
|
1676 if lua_gettop(L) <> 1 then |
|
1677 LuaError('Lua: Wrong number of parameters passed to HideHog!') |
|
1678 else |
|
1679 begin |
|
1680 gear:= GearByUID(lua_tointeger(L, 1)); |
|
1681 hiddenHedgehogs[hiddenHedgehogsNumber]:=gear^.hedgehog; |
|
1682 inc(hiddenHedgehogsNumber); |
|
1683 HideHog(gear^.hedgehog); |
|
1684 end; |
|
1685 lc_hidehog := 0; |
|
1686 end; |
|
1687 |
|
1688 function lc_restorehog(L: Plua_State): LongInt; Cdecl; |
|
1689 var hog: PHedgehog; |
|
1690 i, j: LongInt; |
|
1691 begin |
|
1692 if lua_gettop(L) <> 1 then |
|
1693 LuaError('Lua: Wrong number of parameters passed to RestoreHog!') |
|
1694 else |
|
1695 begin |
|
1696 i := 0; |
|
1697 while (i < hiddenHedgehogsNumber) do |
|
1698 begin |
|
1699 if hiddenHedgehogs[i]^.gearHidden^.uid = lua_tointeger(L, 1) then |
|
1700 begin |
|
1701 hog := hiddenHedgehogs[i]; |
|
1702 RestoreHog(hog); |
|
1703 dec(hiddenHedgehogsNumber); |
|
1704 for j := i to hiddenHedgehogsNumber - 1 do |
|
1705 hiddenHedgehogs[j] := hiddenHedgehogs[j + 1]; |
|
1706 lc_restorehog := 0; |
|
1707 exit; |
|
1708 end; |
|
1709 inc(i); |
|
1710 end; |
|
1711 end; |
|
1712 lc_restorehog := 0; |
1650 end; |
1713 end; |
1651 |
1714 |
1652 // boolean TestRectForObstacle(x1, y1, x2, y2, landOnly) |
1715 // boolean TestRectForObstacle(x1, y1, x2, y2, landOnly) |
1653 function lc_testrectforobstacle(L : Plua_State) : LongInt; Cdecl; |
1716 function lc_testrectforobstacle(L : Plua_State) : LongInt; Cdecl; |
1654 var rtn: Boolean; |
1717 var rtn: Boolean; |
2166 ScriptSetInteger('gstLoser' ,$00080000); |
2229 ScriptSetInteger('gstLoser' ,$00080000); |
2167 ScriptSetInteger('gstHHGone' ,$00100000); |
2230 ScriptSetInteger('gstHHGone' ,$00100000); |
2168 ScriptSetInteger('gstInvisible' ,$00200000); |
2231 ScriptSetInteger('gstInvisible' ,$00200000); |
2169 |
2232 |
2170 // register functions |
2233 // register functions |
|
2234 lua_register(luaState, _P'HideHog', @lc_hidehog); |
|
2235 lua_register(luaState, _P'RestoreHog', @lc_restorehog); |
|
2236 lua_register(luaState, _P'SaveCampaignVar', @lc_savecampaignvar); |
|
2237 lua_register(luaState, _P'GetCampaignVar', @lc_getcampaignvar); |
2171 lua_register(luaState, _P'band', @lc_band); |
2238 lua_register(luaState, _P'band', @lc_band); |
2172 lua_register(luaState, _P'bor', @lc_bor); |
2239 lua_register(luaState, _P'bor', @lc_bor); |
2173 lua_register(luaState, _P'bnot', @lc_bnot); |
2240 lua_register(luaState, _P'bnot', @lc_bnot); |
2174 lua_register(luaState, _P'div', @lc_div); |
2241 lua_register(luaState, _P'div', @lc_div); |
2175 lua_register(luaState, _P'GetInputMask', @lc_getinputmask); |
2242 lua_register(luaState, _P'GetInputMask', @lc_getinputmask); |