1654 if lua_gettop(L) <> 0 then |
1655 if lua_gettop(L) <> 0 then |
1655 LuaError('Lua: Wrong number of parameters passed to GetCurAmmoType!') |
1656 LuaError('Lua: Wrong number of parameters passed to GetCurAmmoType!') |
1656 else |
1657 else |
1657 lua_pushinteger(L, ord(CurrentHedgehog^.CurAmmoType)); |
1658 lua_pushinteger(L, ord(CurrentHedgehog^.CurAmmoType)); |
1658 lc_getcurammotype := 1; |
1659 lc_getcurammotype := 1; |
|
1660 end; |
|
1661 |
|
1662 function lc_savecampaignvar(L : Plua_State): LongInt; Cdecl; |
|
1663 begin |
|
1664 if lua_gettop(L) <> 2 then |
|
1665 LuaError('Lua: Wrong number of parameters passed to SaveCampaignVar!') |
|
1666 else begin |
|
1667 SendIPC('V!' + lua_tostring(L, 1) + ' ' + lua_tostring(L, 2) + #0); |
|
1668 end; |
|
1669 lc_savecampaignvar := 0; |
|
1670 end; |
|
1671 |
|
1672 function lc_getcampaignvar(L : Plua_State): LongInt; Cdecl; |
|
1673 begin |
|
1674 if (lua_gettop(L) <> 1) then |
|
1675 LuaError('Lua: Wrong number of parameters passed to GetCampaignVar!') |
|
1676 else |
|
1677 SendIPCAndWaitReply('V?' + lua_tostring(L, 1)); |
|
1678 lua_pushstring(L, str2pchar(CampaignVariable)); |
|
1679 lc_getcampaignvar := 1; |
|
1680 end; |
|
1681 |
|
1682 function lc_hidehog(L: Plua_State): LongInt; Cdecl; |
|
1683 var gear: PGear; |
|
1684 begin |
|
1685 if lua_gettop(L) <> 1 then |
|
1686 LuaError('Lua: Wrong number of parameters passed to HideHog!') |
|
1687 else |
|
1688 begin |
|
1689 gear:= GearByUID(lua_tointeger(L, 1)); |
|
1690 hiddenHedgehogs[hiddenHedgehogsNumber]:=gear^.hedgehog; |
|
1691 inc(hiddenHedgehogsNumber); |
|
1692 HideHog(gear^.hedgehog); |
|
1693 end; |
|
1694 lc_hidehog := 0; |
|
1695 end; |
|
1696 |
|
1697 function lc_restorehog(L: Plua_State): LongInt; Cdecl; |
|
1698 var hog: PHedgehog; |
|
1699 i, j: LongInt; |
|
1700 begin |
|
1701 if lua_gettop(L) <> 1 then |
|
1702 LuaError('Lua: Wrong number of parameters passed to RestoreHog!') |
|
1703 else |
|
1704 begin |
|
1705 i := 0; |
|
1706 while (i < hiddenHedgehogsNumber) do |
|
1707 begin |
|
1708 if hiddenHedgehogs[i]^.gearHidden^.uid = lua_tointeger(L, 1) then |
|
1709 begin |
|
1710 hog := hiddenHedgehogs[i]; |
|
1711 RestoreHog(hog); |
|
1712 dec(hiddenHedgehogsNumber); |
|
1713 for j := i to hiddenHedgehogsNumber - 1 do |
|
1714 hiddenHedgehogs[j] := hiddenHedgehogs[j + 1]; |
|
1715 lc_restorehog := 0; |
|
1716 exit; |
|
1717 end; |
|
1718 inc(i); |
|
1719 end; |
|
1720 end; |
|
1721 lc_restorehog := 0; |
1659 end; |
1722 end; |
1660 |
1723 |
1661 // boolean TestRectForObstacle(x1, y1, x2, y2, landOnly) |
1724 // boolean TestRectForObstacle(x1, y1, x2, y2, landOnly) |
1662 function lc_testrectforobstacle(L : Plua_State) : LongInt; Cdecl; |
1725 function lc_testrectforobstacle(L : Plua_State) : LongInt; Cdecl; |
1663 var rtn: Boolean; |
1726 var rtn: Boolean; |
2175 ScriptSetInteger('gstLoser' ,$00080000); |
2238 ScriptSetInteger('gstLoser' ,$00080000); |
2176 ScriptSetInteger('gstHHGone' ,$00100000); |
2239 ScriptSetInteger('gstHHGone' ,$00100000); |
2177 ScriptSetInteger('gstInvisible' ,$00200000); |
2240 ScriptSetInteger('gstInvisible' ,$00200000); |
2178 |
2241 |
2179 // register functions |
2242 // register functions |
|
2243 lua_register(luaState, _P'HideHog', @lc_hidehog); |
|
2244 lua_register(luaState, _P'RestoreHog', @lc_restorehog); |
|
2245 lua_register(luaState, _P'SaveCampaignVar', @lc_savecampaignvar); |
|
2246 lua_register(luaState, _P'GetCampaignVar', @lc_getcampaignvar); |
2180 lua_register(luaState, _P'band', @lc_band); |
2247 lua_register(luaState, _P'band', @lc_band); |
2181 lua_register(luaState, _P'bor', @lc_bor); |
2248 lua_register(luaState, _P'bor', @lc_bor); |
2182 lua_register(luaState, _P'bnot', @lc_bnot); |
2249 lua_register(luaState, _P'bnot', @lc_bnot); |
2183 lua_register(luaState, _P'div', @lc_div); |
2250 lua_register(luaState, _P'div', @lc_div); |
2184 lua_register(luaState, _P'GetInputMask', @lc_getinputmask); |
2251 lua_register(luaState, _P'GetInputMask', @lc_getinputmask); |