306 end |
306 end |
307 else |
307 else |
308 LuaToSoundOrd:= i; |
308 LuaToSoundOrd:= i; |
309 end; |
309 end; |
310 |
310 |
311 function LuaToHogEffectOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; |
311 function LuaToMsgStrIdOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; inline; |
|
312 begin |
|
313 if lua_isnoneornil(L, i) then i:= -1 |
|
314 else i:= Trunc(lua_tonumber(L, i)); |
|
315 if (i < ord(Low(TMsgStrId))) or (i > ord(High(TMsgStrId))) then |
|
316 begin |
|
317 LuaCallError('Invalid message ID!', call, paramsyntax); |
|
318 LuaToMsgStrIdOrd:= -1; |
|
319 end |
|
320 else |
|
321 LuaToMsgStrIdOrd:= i; |
|
322 end; |
|
323 |
|
324 function LuaToGoalStrIdOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; inline; |
|
325 begin |
|
326 if lua_isnoneornil(L, i) then i:= -1 |
|
327 else i:= Trunc(lua_tonumber(L, i)); |
|
328 if (i < ord(Low(TGoalStrId))) or (i > ord(High(TGoalStrId))) then |
|
329 begin |
|
330 LuaCallError('Invalid goal string ID!', call, paramsyntax); |
|
331 LuaToGoalStrIdOrd:= -1; |
|
332 end |
|
333 else |
|
334 LuaToGoalStrIdOrd:= i; |
|
335 end; |
|
336 |
|
337 function LuaToHogEffectOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; |
312 begin |
338 begin |
313 if lua_isnoneornil(L, i) then i:= -1 |
339 if lua_isnoneornil(L, i) then i:= -1 |
314 else i:= Trunc(lua_tonumber(L, i)); |
340 else i:= Trunc(lua_tonumber(L, i)); |
315 if (i < ord(Low(THogEffect))) or (i > ord(High(THogEffect))) then |
341 if (i < ord(Low(THogEffect))) or (i > ord(High(THogEffect))) then |
316 begin |
342 begin |
454 |
480 |
455 // sets weapon to the desired ammo type |
481 // sets weapon to the desired ammo type |
456 function lc_setweapon(L : Plua_State) : LongInt; Cdecl; |
482 function lc_setweapon(L : Plua_State) : LongInt; Cdecl; |
457 var at: LongInt; |
483 var at: LongInt; |
458 const |
484 const |
459 call = 'SetWeapon'; |
485 callStr = 'SetWeapon'; |
460 params = 'ammoType'; |
486 paramsStr = 'ammoType'; |
461 begin |
487 begin |
462 // no point to run this without any CurrentHedgehog |
488 // no point to run this without any CurrentHedgehog |
463 if (CurrentHedgehog <> nil) and (CheckLuaParamCount(L, 1, call, params)) then |
489 if (CurrentHedgehog <> nil) and (CheckLuaParamCount(L, 1, callStr, paramsStr)) then |
464 begin |
490 begin |
465 at:= LuaToAmmoTypeOrd(L, 1, call, params); |
491 at:= LuaToAmmoTypeOrd(L, 1, callStr, paramsStr); |
466 if at >= 0 then |
492 if at >= 0 then |
467 ParseCommand('setweap ' + char(at), true, true); |
493 ParseCommand('setweap ' + char(at), true, true); |
468 end; |
494 end; |
469 lc_setweapon:= 0; |
495 lc_setweapon:= 0; |
470 end; |
496 end; |
471 |
497 |
472 // enable/disable cinematic effects |
498 // enable/disable cinematic effects |
473 function lc_setcinematicmode(L : Plua_State) : LongInt; Cdecl; |
499 function lc_setcinematicmode(L : Plua_State) : LongInt; Cdecl; |
474 const |
500 const |
475 call = 'SetCinematicMode'; |
501 callStr = 'SetCinematicMode'; |
476 params = 'enable'; |
502 paramsStr = 'enable'; |
477 begin |
503 begin |
478 if (CheckLuaParamCount(L, 1, call, params)) then |
504 if (CheckLuaParamCount(L, 1, callStr, paramsStr)) then |
479 begin |
505 begin |
480 CinematicScript:= lua_toboolean(L, 1); |
506 CinematicScript:= lua_toboolean(L, 1); |
481 end; |
507 end; |
482 lc_setcinematicmode:= 0; |
508 lc_setcinematicmode:= 0; |
483 end; |
509 end; |
484 |
510 |
485 // no parameter means reset to default (and 0 means unlimited) |
511 // no parameter means reset to default (and 0 means unlimited) |
486 function lc_setmaxbuilddistance(L : Plua_State) : LongInt; Cdecl; |
512 function lc_setmaxbuilddistance(L : Plua_State) : LongInt; Cdecl; |
487 var np: LongInt; |
513 var np: LongInt; |
488 const |
514 const |
489 call = 'SetMaxBuildDistance'; |
515 callStr = 'SetMaxBuildDistance'; |
490 params = '[ distInPx ]'; |
516 paramsStr = '[ distInPx ]'; |
491 begin |
517 begin |
492 if CheckAndFetchParamCountRange(L, 0, 1, call, params, np) then |
518 if CheckAndFetchParamCountRange(L, 0, 1, callStr, paramsStr, np) then |
493 begin |
519 begin |
494 if np = 0 then |
520 if np = 0 then |
495 begin |
521 begin |
496 // no args? reset |
522 // no args? reset |
497 cBuildMaxDist:= cDefaultBuildMaxDist; |
523 cBuildMaxDist:= cDefaultBuildMaxDist; |
506 function lc_setnextweapon(L : Plua_State) : LongInt; Cdecl; |
532 function lc_setnextweapon(L : Plua_State) : LongInt; Cdecl; |
507 var at : LongInt; |
533 var at : LongInt; |
508 nextAmmo : TAmmo; |
534 nextAmmo : TAmmo; |
509 s, a, cs, fa: LongInt; |
535 s, a, cs, fa: LongInt; |
510 const |
536 const |
511 call = 'SetNextWeapon'; |
537 callStr = 'SetNextWeapon'; |
512 params = ''; |
538 paramsStr = ''; |
513 begin |
539 begin |
514 if (CurrentHedgehog <> nil) and (CheckLuaParamCount(L, 0, call, params)) then |
540 if (CurrentHedgehog <> nil) and (CheckLuaParamCount(L, 0, callStr, paramsStr)) then |
515 begin |
541 begin |
516 at:= -1; |
542 at:= -1; |
517 with CurrentHedgehog^ do |
543 with CurrentHedgehog^ do |
518 begin |
544 begin |
519 cs:= 0; // current slot |
545 cs:= 0; // current slot |
582 L:= L; // avoid compiler hint |
608 L:= L; // avoid compiler hint |
583 HideMission; |
609 HideMission; |
584 lc_hidemission:= 0; |
610 lc_hidemission:= 0; |
585 end; |
611 end; |
586 |
612 |
|
613 function lc_getenginestring(L : Plua_state) : LongInt; Cdecl; |
|
614 var stringType: shortstring; |
|
615 msgId: LongInt; |
|
616 const callStr = 'GetEngineString'; |
|
617 paramsStr = 'stringType, msgId'; |
|
618 begin |
|
619 if CheckLuaParamCount(L, 2, callStr, paramsStr) then |
|
620 begin |
|
621 stringType:= lua_tostring(L, 1); |
|
622 if (not lua_isnumber(L, 2)) then |
|
623 begin |
|
624 LuaError('Argument ''msgId'' must be a number!'); |
|
625 lua_pushnil(L); |
|
626 end |
|
627 else if stringType = 'TMsgStrId' then |
|
628 begin |
|
629 msgId:= LuaToMsgStrIdOrd(L, 2, callStr, paramsStr); |
|
630 if msgId = -1 then |
|
631 lua_pushnil(L) |
|
632 else |
|
633 lua_pushstring(L, PChar(trmsg[TMsgStrId(msgId)])) |
|
634 end |
|
635 else if stringType = 'TGoalStrId' then |
|
636 begin |
|
637 msgId:= LuaToGoalStrIdOrd(L, 2, callStr, paramsStr); |
|
638 if msgId = -1 then |
|
639 lua_pushnil(L) |
|
640 else |
|
641 lua_pushstring(L, PChar(trgoal[TGoalStrId(msgId)])); |
|
642 end |
|
643 else |
|
644 begin |
|
645 LuaError('Invalid stringType!'); |
|
646 lua_pushnil(L); |
|
647 end |
|
648 end |
|
649 else |
|
650 lua_pushnil(L); |
|
651 lc_getenginestring:= 1; |
|
652 end; |
|
653 |
587 function lc_setammotexts(L : Plua_State) : LongInt; Cdecl; |
654 function lc_setammotexts(L : Plua_State) : LongInt; Cdecl; |
588 const |
655 const |
589 call = 'SetAmmoTexts'; |
656 callStr = 'SetAmmoTexts'; |
590 params = 'ammoType, name, caption, description [, showExtra]'; |
657 paramsStr = 'ammoType, name, caption, description [, showExtra]'; |
591 var n: integer; |
658 var n: integer; |
592 showExtra: boolean; |
659 showExtra: boolean; |
593 begin |
660 begin |
594 if CheckAndFetchParamCount(L, 4, 5, call, params, n) then |
661 if CheckAndFetchParamCount(L, 4, 5, callStr, paramsStr, n) then |
595 begin |
662 begin |
596 if n = 5 then |
663 if n = 5 then |
597 showExtra:= lua_toboolean(L, 5) |
664 showExtra:= lua_toboolean(L, 5) |
598 else |
665 else |
599 showExtra:= true; |
666 showExtra:= true; |
600 SetAmmoTexts(TAmmoType(LuaToAmmoTypeOrd(L, 1, call, params)), lua_tostringA(L, 2), lua_tostringA(L, 3), lua_tostringA(L, 4), showExtra); |
667 SetAmmoTexts(TAmmoType(LuaToAmmoTypeOrd(L, 1, callStr, paramsStr)), lua_tostringA(L, 2), lua_tostringA(L, 3), lua_tostringA(L, 4), showExtra); |
601 end; |
668 end; |
602 lc_setammotexts:= 0; |
669 lc_setammotexts:= 0; |
603 end; |
670 end; |
604 |
671 |
605 function lc_setammodescriptionappendix(L : Plua_State) : LongInt; Cdecl; |
672 function lc_setammodescriptionappendix(L : Plua_State) : LongInt; Cdecl; |
606 const |
673 const |
607 call = 'SetAmmoDescriptionAppendix'; |
674 callStr = 'SetAmmoDescriptionAppendix'; |
608 params = 'ammoType, descAppend'; |
675 paramsStr = 'ammoType, descAppend'; |
609 var |
676 var |
610 ammoType: TAmmoType; |
677 ammoType: TAmmoType; |
611 descAppend: ansistring; |
678 descAppend: ansistring; |
612 begin |
679 begin |
613 if CheckLuaParamCount(L, 2, call, params) then |
680 if CheckLuaParamCount(L, 2, callStr, paramsStr) then |
614 begin |
681 begin |
615 ammoType := TAmmoType(LuaToAmmoTypeOrd(L, 1, call, params)); |
682 ammoType := TAmmoType(LuaToAmmoTypeOrd(L, 1, callStr, paramsStr)); |
616 descAppend := lua_tostringA(L, 2); |
683 descAppend := lua_tostringA(L, 2); |
617 trluaammoa[Ammoz[ammoType].NameId] := descAppend; |
684 trluaammoa[Ammoz[ammoType].NameId] := descAppend; |
618 end; |
685 end; |
619 lc_setammodescriptionappendix := 0; |
686 lc_setammodescriptionappendix := 0; |
620 end; |
687 end; |
665 end; |
732 end; |
666 |
733 |
667 function lc_addcaption(L : Plua_State) : LongInt; Cdecl; |
734 function lc_addcaption(L : Plua_State) : LongInt; Cdecl; |
668 var cg: LongInt; |
735 var cg: LongInt; |
669 const |
736 const |
670 call = 'AddCaption'; |
737 callStr = 'AddCaption'; |
671 params = 'text [, color, captiongroup]'; |
738 paramsStr = 'text [, color, captiongroup]'; |
672 begin |
739 begin |
673 if CheckAndFetchParamCount(L, 1, 3, call, params, cg) then |
740 if CheckAndFetchParamCount(L, 1, 3, callStr, paramsStr, cg) then |
674 begin |
741 begin |
675 if cg = 1 then |
742 if cg = 1 then |
676 AddCaption(lua_tostringA(L, 1), capcolDefault, capgrpMessage) |
743 AddCaption(lua_tostringA(L, 1), capcolDefault, capgrpMessage) |
677 else |
744 else |
678 begin |
745 begin |
679 cg:= LuaToCapGroupOrd(L, 3, call, params); |
746 cg:= LuaToCapGroupOrd(L, 3, callStr, paramsStr); |
680 if cg >= 0 then |
747 if cg >= 0 then |
681 AddCaption(lua_tostringA(L, 1), Trunc(lua_tonumber(L, 2)) shr 8, TCapGroup(cg)); |
748 AddCaption(lua_tostringA(L, 1), Trunc(lua_tonumber(L, 2)) shr 8, TCapGroup(cg)); |
682 end |
749 end |
683 end; |
750 end; |
684 lc_addcaption:= 0; |
751 lc_addcaption:= 0; |
844 var gear : PGear; |
911 var gear : PGear; |
845 x, y, s, t: LongInt; |
912 x, y, s, t: LongInt; |
846 dx, dy: hwFloat; |
913 dx, dy: hwFloat; |
847 gt: TGearType; |
914 gt: TGearType; |
848 const |
915 const |
849 call = 'AddGear'; |
916 callStr = 'AddGear'; |
850 params = 'x, y, gearType, state, dx, dy, timer'; |
917 paramsStr = 'x, y, gearType, state, dx, dy, timer'; |
851 begin |
918 begin |
852 if CheckLuaParamCount(L, 7, call, params) then |
919 if CheckLuaParamCount(L, 7, callStr, paramsStr) then |
853 begin |
920 begin |
854 t:= LuaToGearTypeOrd(L, 3, call, params); |
921 t:= LuaToGearTypeOrd(L, 3, callStr, paramsStr); |
855 if t >= 0 then |
922 if t >= 0 then |
856 begin |
923 begin |
857 gt:= TGearType(t); |
924 gt:= TGearType(t); |
858 x:= Trunc(lua_tonumber(L, 1)); |
925 x:= Trunc(lua_tonumber(L, 1)); |
859 y:= Trunc(lua_tonumber(L, 2)); |
926 y:= Trunc(lua_tonumber(L, 2)); |
891 x, y, s, n, layer: LongInt; |
958 x, y, s, n, layer: LongInt; |
892 c: Boolean; |
959 c: Boolean; |
893 vgt: TVisualGearType; |
960 vgt: TVisualGearType; |
894 uid: Longword; |
961 uid: Longword; |
895 const |
962 const |
896 call = 'AddVisualGear'; |
963 callStr = 'AddVisualGear'; |
897 params = 'x, y, visualGearType, state, critical [, layer]'; |
964 paramsStr = 'x, y, visualGearType, state, critical [, layer]'; |
898 begin |
965 begin |
899 uid:= 0; |
966 uid:= 0; |
900 if CheckAndFetchParamCount(L, 5, 6, call, params, n) then |
967 if CheckAndFetchParamCount(L, 5, 6, callStr, paramsStr, n) then |
901 begin |
968 begin |
902 s:= LuaToVisualGearTypeOrd(L, 3, call, params); |
969 s:= LuaToVisualGearTypeOrd(L, 3, callStr, paramsStr); |
903 if s >= 0 then |
970 if s >= 0 then |
904 begin |
971 begin |
905 vgt:= TVisualGearType(s); |
972 vgt:= TVisualGearType(s); |
906 x:= Trunc(lua_tonumber(L, 1)); |
973 x:= Trunc(lua_tonumber(L, 1)); |
907 y:= Trunc(lua_tonumber(L, 2)); |
974 y:= Trunc(lua_tonumber(L, 2)); |
1814 |
1881 |
1815 function lc_addammo(L : Plua_State) : LongInt; Cdecl; |
1882 function lc_addammo(L : Plua_State) : LongInt; Cdecl; |
1816 var gear : PGear; |
1883 var gear : PGear; |
1817 at, n, c: LongInt; |
1884 at, n, c: LongInt; |
1818 const |
1885 const |
1819 call = 'AddAmmo'; |
1886 callStr = 'AddAmmo'; |
1820 params = 'gearUid, ammoType [, ammoCount]'; |
1887 paramsStr = 'gearUid, ammoType [, ammoCount]'; |
1821 begin |
1888 begin |
1822 if CheckAndFetchParamCount(L, 2, 3, call, params, n) then |
1889 if CheckAndFetchParamCount(L, 2, 3, callStr, paramsStr, n) then |
1823 begin |
1890 begin |
1824 at:= LuaToAmmoTypeOrd(L, 2, call, params); |
1891 at:= LuaToAmmoTypeOrd(L, 2, callStr, paramsStr); |
1825 if (at >= 0) and (TAmmoType(at) <> amNothing) then |
1892 if (at >= 0) and (TAmmoType(at) <> amNothing) then |
1826 begin |
1893 begin |
1827 gear:= GearByUID(Trunc(lua_tonumber(L, 1))); |
1894 gear:= GearByUID(Trunc(lua_tonumber(L, 1))); |
1828 if (gear <> nil) and (gear^.Hedgehog <> nil) then |
1895 if (gear <> nil) and (gear^.Hedgehog <> nil) then |
1829 if n = 2 then |
1896 if n = 2 then |
1843 function lc_getammocount(L : Plua_State) : LongInt; Cdecl; |
1910 function lc_getammocount(L : Plua_State) : LongInt; Cdecl; |
1844 var gear : PGear; |
1911 var gear : PGear; |
1845 ammo : PAmmo; |
1912 ammo : PAmmo; |
1846 at : LongInt; |
1913 at : LongInt; |
1847 const |
1914 const |
1848 call = 'GetAmmoCount'; |
1915 callStr = 'GetAmmoCount'; |
1849 params = 'gearUid, ammoType'; |
1916 paramsStr = 'gearUid, ammoType'; |
1850 begin |
1917 begin |
1851 if CheckLuaParamCount(L, 2, call, params) then |
1918 if CheckLuaParamCount(L, 2, callStr, paramsStr) then |
1852 begin |
1919 begin |
1853 gear:= GearByUID(Trunc(lua_tonumber(L, 1))); |
1920 gear:= GearByUID(Trunc(lua_tonumber(L, 1))); |
1854 if (gear <> nil) and (gear^.Hedgehog <> nil) then |
1921 if (gear <> nil) and (gear^.Hedgehog <> nil) then |
1855 begin |
1922 begin |
1856 at:= LuaToAmmoTypeOrd(L, 2, call, params); |
1923 at:= LuaToAmmoTypeOrd(L, 2, callStr, paramsStr); |
1857 if at >= 0 then |
1924 if at >= 0 then |
1858 begin |
1925 begin |
1859 ammo:= GetAmmoEntry(gear^.Hedgehog^, TAmmoType(at)); |
1926 ammo:= GetAmmoEntry(gear^.Hedgehog^, TAmmoType(at)); |
1860 if ammo^.AmmoType = amNothing then |
1927 if ammo^.AmmoType = amNothing then |
1861 lua_pushnumber(L, 0) |
1928 lua_pushnumber(L, 0) |
1953 |
2020 |
1954 function lc_seteffect(L : Plua_State) : LongInt; Cdecl; |
2021 function lc_seteffect(L : Plua_State) : LongInt; Cdecl; |
1955 var gear: PGear; |
2022 var gear: PGear; |
1956 t : LongInt; |
2023 t : LongInt; |
1957 const |
2024 const |
1958 call = 'SetEffect'; |
2025 callStr = 'SetEffect'; |
1959 params = 'gearUid, effect, effectState'; |
2026 paramsStr = 'gearUid, effect, effectState'; |
1960 begin |
2027 begin |
1961 if CheckLuaParamCount(L, 3, call, params) then |
2028 if CheckLuaParamCount(L, 3, callStr, paramsStr) then |
1962 begin |
2029 begin |
1963 t:= LuaToHogEffectOrd(L, 2, call, params); |
2030 t:= LuaToHogEffectOrd(L, 2, callStr, paramsStr); |
1964 if t >= 0 then |
2031 if t >= 0 then |
1965 begin |
2032 begin |
1966 gear := GearByUID(Trunc(lua_tonumber(L, 1))); |
2033 gear := GearByUID(Trunc(lua_tonumber(L, 1))); |
1967 if (gear <> nil) and (gear^.Hedgehog <> nil) then |
2034 if (gear <> nil) and (gear^.Hedgehog <> nil) then |
1968 gear^.Hedgehog^.Effects[THogEffect(t)]:= Trunc(lua_tonumber(L, 3)); |
2035 gear^.Hedgehog^.Effects[THogEffect(t)]:= Trunc(lua_tonumber(L, 3)); |
1973 |
2040 |
1974 function lc_geteffect(L : Plua_State) : LongInt; Cdecl; |
2041 function lc_geteffect(L : Plua_State) : LongInt; Cdecl; |
1975 var gear : PGear; |
2042 var gear : PGear; |
1976 t : LongInt; |
2043 t : LongInt; |
1977 const |
2044 const |
1978 call = 'GetEffect'; |
2045 callStr = 'GetEffect'; |
1979 params = 'gearUid, effect'; |
2046 paramsStr = 'gearUid, effect'; |
1980 begin |
2047 begin |
1981 if CheckLuaParamCount(L, 2, call, params) then |
2048 if CheckLuaParamCount(L, 2, callStr, paramsStr) then |
1982 begin |
2049 begin |
1983 t:= LuaToHogEffectOrd(L, 2, call, params); |
2050 t:= LuaToHogEffectOrd(L, 2, callStr, paramsStr); |
1984 if t >= 0 then |
2051 if t >= 0 then |
1985 begin |
2052 begin |
1986 gear:= GearByUID(Trunc(lua_tonumber(L, 1))); |
2053 gear:= GearByUID(Trunc(lua_tonumber(L, 1))); |
1987 if (gear <> nil) and (gear^.Hedgehog <> nil) then |
2054 if (gear <> nil) and (gear^.Hedgehog <> nil) then |
1988 lua_pushnumber(L, gear^.Hedgehog^.Effects[THogEffect(t)]) |
2055 lua_pushnumber(L, gear^.Hedgehog^.Effects[THogEffect(t)]) |
2066 end; |
2133 end; |
2067 |
2134 |
2068 function lc_endturn(L : Plua_State) : LongInt; Cdecl; |
2135 function lc_endturn(L : Plua_State) : LongInt; Cdecl; |
2069 var n: LongInt; |
2136 var n: LongInt; |
2070 const |
2137 const |
2071 call = 'EndTurn'; |
2138 callStr = 'EndTurn'; |
2072 params = '[noTaunts]'; |
2139 paramsStr = '[noTaunts]'; |
2073 begin |
2140 begin |
2074 if CheckAndFetchParamCount(L, 0, 1, call, params, n) then |
2141 if CheckAndFetchParamCount(L, 0, 1, callStr, paramsStr, n) then |
2075 if n >= 1 then |
2142 if n >= 1 then |
2076 LuaNoEndTurnTaunts:= lua_toboolean(L, 1); |
2143 LuaNoEndTurnTaunts:= lua_toboolean(L, 1); |
2077 LuaEndTurnRequested:= true; |
2144 LuaEndTurnRequested:= true; |
2078 lc_endturn:= 0 |
2145 lc_endturn:= 0 |
2079 end; |
2146 end; |
2080 |
2147 |
2081 function lc_retreat(L : Plua_State) : LongInt; Cdecl; |
2148 function lc_retreat(L : Plua_State) : LongInt; Cdecl; |
2082 var n, time: LongInt; |
2149 var n, time: LongInt; |
2083 respectFactor: Boolean; |
2150 respectFactor: Boolean; |
2084 const |
2151 const |
2085 call = 'Retreat'; |
2152 callStr = 'Retreat'; |
2086 params = 'time [, respectGetAwayTimeFactor]'; |
2153 paramsStr = 'time [, respectGetAwayTimeFactor]'; |
2087 begin |
2154 begin |
2088 if CheckAndFetchParamCount(L, 1, 2, call, params, n) then |
2155 if CheckAndFetchParamCount(L, 1, 2, callStr, paramsStr, n) then |
2089 begin |
2156 begin |
2090 IsGetAwayTime:= true; |
2157 IsGetAwayTime:= true; |
2091 AttackBar:= 0; |
2158 AttackBar:= 0; |
2092 time:= Trunc(lua_tonumber(L, 1)); |
2159 time:= Trunc(lua_tonumber(L, 1)); |
2093 if n = 2 then |
2160 if n = 2 then |
2119 var statInfo : TStatInfoType; |
2186 var statInfo : TStatInfoType; |
2120 i, n : LongInt; |
2187 i, n : LongInt; |
2121 color, tn: shortstring; |
2188 color, tn: shortstring; |
2122 needsTn : boolean; |
2189 needsTn : boolean; |
2123 const |
2190 const |
2124 call = 'SendStat'; |
2191 callStr = 'SendStat'; |
2125 params = 'statInfoType, color [, teamname]'; |
2192 paramsStr = 'statInfoType, color [, teamname]'; |
2126 begin |
2193 begin |
2127 if CheckAndFetchParamCount(L, 2, 3, call, params, n) then |
2194 if CheckAndFetchParamCount(L, 2, 3, callStr, paramsStr, n) then |
2128 begin |
2195 begin |
2129 i:= LuaToStatInfoTypeOrd(L, 1, call, params); |
2196 i:= LuaToStatInfoTypeOrd(L, 1, callStr, paramsStr); |
2130 if i >= 0 then |
2197 if i >= 0 then |
2131 begin |
2198 begin |
2132 statInfo:= TStatInfoType(i); |
2199 statInfo:= TStatInfoType(i); |
2133 needsTn:= ((statInfo = siPlayerKills) or (statInfo = siClanHealth)); |
2200 needsTn:= ((statInfo = siPlayerKills) or (statInfo = siClanHealth)); |
2134 // check if param count is correct for the used statInfo |
2201 // check if param count is correct for the used statInfo |
2135 if (n = 3) <> needsTn then |
2202 if (n = 3) <> needsTn then |
2136 begin |
2203 begin |
2137 if n = 3 then |
2204 if n = 3 then |
2138 LuaCallError(EnumToStr(statInfo) + ' does not support the teamname parameter', call, params) |
2205 LuaCallError(EnumToStr(statInfo) + ' does not support the teamname parameter', callStr, paramsStr) |
2139 else |
2206 else |
2140 LuaCallError(EnumToStr(statInfo) + ' requires the teamname parameter', call, params); |
2207 LuaCallError(EnumToStr(statInfo) + ' requires the teamname parameter', callStr, paramsStr); |
2141 end |
2208 end |
2142 else // count is correct! |
2209 else // count is correct! |
2143 begin |
2210 begin |
2144 if needsTn then |
2211 if needsTn then |
2145 begin |
2212 begin |
2237 function lc_playsound(L : Plua_State) : LongInt; Cdecl; |
2304 function lc_playsound(L : Plua_State) : LongInt; Cdecl; |
2238 var gear: PGear; |
2305 var gear: PGear; |
2239 n, s: LongInt; |
2306 n, s: LongInt; |
2240 instaVoice: boolean; |
2307 instaVoice: boolean; |
2241 const |
2308 const |
2242 call = 'PlaySound'; |
2309 callStr = 'PlaySound'; |
2243 params = 'soundId [, hhGearUid [, instaVoice]]'; |
2310 paramsStr = 'soundId [, hhGearUid [, instaVoice]]'; |
2244 begin |
2311 begin |
2245 if CheckAndFetchParamCountRange(L, 1, 3, call, params, n) then |
2312 if CheckAndFetchParamCountRange(L, 1, 3, callStr, paramsStr, n) then |
2246 begin |
2313 begin |
2247 s:= LuaToSoundOrd(L, 1, call, params); |
2314 s:= LuaToSoundOrd(L, 1, callStr, paramsStr); |
2248 if s >= 0 then |
2315 if s >= 0 then |
2249 begin |
2316 begin |
2250 // no gear specified |
2317 // no gear specified |
2251 if n = 1 then |
2318 if n = 1 then |
2252 PlaySound(TSound(s), false, true) |
2319 PlaySound(TSound(s), false, true) |
2270 end; |
2337 end; |
2271 |
2338 |
2272 function lc_playmusicsound(L : Plua_State) : LongInt; Cdecl; |
2339 function lc_playmusicsound(L : Plua_State) : LongInt; Cdecl; |
2273 var s: LongInt; |
2340 var s: LongInt; |
2274 const |
2341 const |
2275 call = 'PlayMusicSound'; |
2342 callStr = 'PlayMusicSound'; |
2276 params = 'soundId'; |
2343 paramsStr = 'soundId'; |
2277 begin |
2344 begin |
2278 if CheckLuaParamCount(L, 1, call, params) then |
2345 if CheckLuaParamCount(L, 1, callStr, paramsStr) then |
2279 begin |
2346 begin |
2280 s:= LuaToSoundOrd(L, 1, call, params); |
2347 s:= LuaToSoundOrd(L, 1, callStr, paramsStr); |
2281 if s >= 0 then |
2348 if s >= 0 then |
2282 PlayMusicSound(TSound(s)) |
2349 PlayMusicSound(TSound(s)) |
2283 end; |
2350 end; |
2284 lc_playmusicsound:= 0; |
2351 lc_playmusicsound:= 0; |
2285 end; |
2352 end; |
2286 |
2353 |
2287 function lc_stopmusicsound(L : Plua_State) : LongInt; Cdecl; |
2354 function lc_stopmusicsound(L : Plua_State) : LongInt; Cdecl; |
2288 var s: LongInt; |
2355 var s: LongInt; |
2289 const |
2356 const |
2290 call = 'StopMusicSound'; |
2357 callStr = 'StopMusicSound'; |
2291 params = 'soundId'; |
2358 paramsStr = 'soundId'; |
2292 begin |
2359 begin |
2293 if CheckLuaParamCount(L, 1, call, params) then |
2360 if CheckLuaParamCount(L, 1, callStr, paramsStr) then |
2294 begin |
2361 begin |
2295 s:= LuaToSoundOrd(L, 1, call, params); |
2362 s:= LuaToSoundOrd(L, 1, callStr, paramsStr); |
2296 if s >= 0 then |
2363 if s >= 0 then |
2297 StopMusicSound(TSound(s)) |
2364 StopMusicSound(TSound(s)) |
2298 end; |
2365 end; |
2299 lc_stopmusicsound:= 0; |
2366 lc_stopmusicsound:= 0; |
2300 end; |
2367 end; |
2302 |
2369 |
2303 function lc_setsoundmask(L : Plua_State) : LongInt; Cdecl; |
2370 function lc_setsoundmask(L : Plua_State) : LongInt; Cdecl; |
2304 var s: LongInt; |
2371 var s: LongInt; |
2305 soundState: boolean; |
2372 soundState: boolean; |
2306 const |
2373 const |
2307 call = 'SetSoundMask'; |
2374 callStr = 'SetSoundMask'; |
2308 params = 'soundId, isMasked'; |
2375 paramsStr = 'soundId, isMasked'; |
2309 begin |
2376 begin |
2310 if CheckLuaParamCount(L, 2, call, params) then |
2377 if CheckLuaParamCount(L, 2, callStr, paramsStr) then |
2311 begin |
2378 begin |
2312 s:= LuaToSoundOrd(L, 1, call, params); |
2379 s:= LuaToSoundOrd(L, 1, callStr, paramsStr); |
2313 if s <> Ord(sndNone) then |
2380 if s <> Ord(sndNone) then |
2314 begin |
2381 begin |
2315 soundState:= lua_toboolean(L, 2); |
2382 soundState:= lua_toboolean(L, 2); |
2316 MaskedSounds[TSound(s)]:= soundState; |
2383 MaskedSounds[TSound(s)]:= soundState; |
2317 end; |
2384 end; |
2856 end; |
2923 end; |
2857 |
2924 |
2858 function lc_setammo(L : Plua_State) : LongInt; Cdecl; |
2925 function lc_setammo(L : Plua_State) : LongInt; Cdecl; |
2859 var np, at: LongInt; |
2926 var np, at: LongInt; |
2860 const |
2927 const |
2861 call = 'SetAmmo'; |
2928 callStr = 'SetAmmo'; |
2862 params = 'ammoType, count, probability, delay [, numberInCrate]'; |
2929 paramsStr = 'ammoType, count, probability, delay [, numberInCrate]'; |
2863 begin |
2930 begin |
2864 if CheckAndFetchParamCount(L, 4, 5, call, params, np) then |
2931 if CheckAndFetchParamCount(L, 4, 5, callStr, paramsStr, np) then |
2865 begin |
2932 begin |
2866 at:= LuaToAmmoTypeOrd(L, 1, call, params); |
2933 at:= LuaToAmmoTypeOrd(L, 1, callStr, paramsStr); |
2867 if at >= 0 then |
2934 if at >= 0 then |
2868 begin |
2935 begin |
2869 if np = 4 then |
2936 if np = 4 then |
2870 ScriptSetAmmo(TAmmoType(at), Trunc(lua_tonumber(L, 2)), Trunc(lua_tonumber(L, 3)), Trunc(lua_tonumber(L, 4)), 1) |
2937 ScriptSetAmmo(TAmmoType(at), Trunc(lua_tonumber(L, 2)), Trunc(lua_tonumber(L, 3)), Trunc(lua_tonumber(L, 4)), 1) |
2871 else |
2938 else |
2877 |
2944 |
2878 |
2945 |
2879 function lc_getammo(L : Plua_State) : LongInt; Cdecl; |
2946 function lc_getammo(L : Plua_State) : LongInt; Cdecl; |
2880 var i, at, rawProb, probLevel: LongInt; |
2947 var i, at, rawProb, probLevel: LongInt; |
2881 const |
2948 const |
2882 call = 'GetAmmo'; |
2949 callStr = 'GetAmmo'; |
2883 params = 'ammoType'; |
2950 paramsStr = 'ammoType'; |
2884 begin |
2951 begin |
2885 lc_getammo:= 0; |
2952 lc_getammo:= 0; |
2886 if CheckLuaParamCount(L, 1, call, params) then |
2953 if CheckLuaParamCount(L, 1, callStr, paramsStr) then |
2887 begin |
2954 begin |
2888 at:= LuaToAmmoTypeOrd(L, 1, call, params); |
2955 at:= LuaToAmmoTypeOrd(L, 1, callStr, paramsStr); |
2889 if at >= 0 then |
2956 if at >= 0 then |
2890 begin |
2957 begin |
2891 // Ammo count |
2958 // Ammo count |
2892 i:= InitialAmmoCounts[TAmmoType(at)]; |
2959 i:= InitialAmmoCounts[TAmmoType(at)]; |
2893 if i = AMMO_INFINITE then |
2960 if i = AMMO_INFINITE then |
2911 |
2978 |
2912 |
2979 |
2913 function lc_setammodelay(L : Plua_State) : LongInt; Cdecl; |
2980 function lc_setammodelay(L : Plua_State) : LongInt; Cdecl; |
2914 var at, delay: LongInt; |
2981 var at, delay: LongInt; |
2915 const |
2982 const |
2916 call = 'SetAmmoDelay'; |
2983 callStr = 'SetAmmoDelay'; |
2917 params = 'ammoType, delay'; |
2984 paramsStr = 'ammoType, delay'; |
2918 begin |
2985 begin |
2919 if CheckLuaParamCount(L, 2, call, params) then |
2986 if CheckLuaParamCount(L, 2, callStr, paramsStr) then |
2920 begin |
2987 begin |
2921 at:= LuaToAmmoTypeOrd(L, 1, call, params); |
2988 at:= LuaToAmmoTypeOrd(L, 1, callStr, paramsStr); |
2922 delay:= Trunc(lua_tonumber(L, 2)); |
2989 delay:= Trunc(lua_tonumber(L, 2)); |
2923 if (at >= 0) and (TAmmoType(at) <> amNothing) then |
2990 if (at >= 0) and (TAmmoType(at) <> amNothing) then |
2924 begin |
2991 begin |
2925 ScriptSetAmmoDelay(TAmmoType(at), delay); |
2992 ScriptSetAmmoDelay(TAmmoType(at), delay); |
2926 // Unselect weapon if neccessary |
2993 // Unselect weapon if neccessary |
3063 lf : Word; |
3130 lf : Word; |
3064 tint : LongWord; |
3131 tint : LongWord; |
3065 i, n : LongInt; |
3132 i, n : LongInt; |
3066 placed, behind, flipHoriz, flipVert : boolean; |
3133 placed, behind, flipHoriz, flipVert : boolean; |
3067 const |
3134 const |
3068 call = 'PlaceSprite'; |
3135 callStr = 'PlaceSprite'; |
3069 params = 'x, y, sprite, frameIdx, tint, behind, flipHoriz, flipVert [, landFlag, ... ]'; |
3136 paramsStr = 'x, y, sprite, frameIdx, tint, behind, flipHoriz, flipVert [, landFlag, ... ]'; |
3070 begin |
3137 begin |
3071 placed:= false; |
3138 placed:= false; |
3072 if CheckAndFetchLuaParamMinCount(L, 4, call, params, n) then |
3139 if CheckAndFetchLuaParamMinCount(L, 4, callStr, paramsStr, n) then |
3073 begin |
3140 begin |
3074 if not lua_isnoneornil(L, 5) then |
3141 if not lua_isnoneornil(L, 5) then |
3075 tint := Trunc(lua_tonumber(L, 5)) |
3142 tint := Trunc(lua_tonumber(L, 5)) |
3076 else tint := $FFFFFFFF; |
3143 else tint := $FFFFFFFF; |
3077 if not lua_isnoneornil(L, 6) then |
3144 if not lua_isnoneornil(L, 6) then |
3087 |
3154 |
3088 // accept any amount of landflags, loop is never executed if n<9 |
3155 // accept any amount of landflags, loop is never executed if n<9 |
3089 for i:= 9 to n do |
3156 for i:= 9 to n do |
3090 lf:= lf or Trunc(lua_tonumber(L, i)); |
3157 lf:= lf or Trunc(lua_tonumber(L, i)); |
3091 |
3158 |
3092 n:= LuaToSpriteOrd(L, 3, call, params); |
3159 n:= LuaToSpriteOrd(L, 3, callStr, paramsStr); |
3093 if n >= 0 then |
3160 if n >= 0 then |
3094 begin |
3161 begin |
3095 spr:= TSprite(n); |
3162 spr:= TSprite(n); |
3096 if SpritesData[spr].Surface = nil then |
3163 if SpritesData[spr].Surface = nil then |
3097 LuaError(call + ': ' + EnumToStr(spr) + ' cannot be placed! (required information not loaded)' ) |
3164 LuaError(callStr + ': ' + EnumToStr(spr) + ' cannot be placed! (required information not loaded)' ) |
3098 else |
3165 else |
3099 placed:= ForcePlaceOnLand( |
3166 placed:= ForcePlaceOnLand( |
3100 Trunc(lua_tonumber(L, 1)) - SpritesData[spr].Width div 2, |
3167 Trunc(lua_tonumber(L, 1)) - SpritesData[spr].Width div 2, |
3101 Trunc(lua_tonumber(L, 2)) - SpritesData[spr].Height div 2, |
3168 Trunc(lua_tonumber(L, 2)) - SpritesData[spr].Height div 2, |
3102 spr, Trunc(lua_tonumber(L, 4)), lf, tint, behind, flipHoriz, flipVert); |
3169 spr, Trunc(lua_tonumber(L, 4)), lf, tint, behind, flipHoriz, flipVert); |
3111 var spr : TSprite; |
3178 var spr : TSprite; |
3112 lf : Word; |
3179 lf : Word; |
3113 i, n : LongInt; |
3180 i, n : LongInt; |
3114 eraseOnLFMatch, onlyEraseLF, flipHoriz, flipVert : boolean; |
3181 eraseOnLFMatch, onlyEraseLF, flipHoriz, flipVert : boolean; |
3115 const |
3182 const |
3116 call = 'EraseSprite'; |
3183 callStr = 'EraseSprite'; |
3117 params = 'x, y, sprite, frameIdx, eraseOnLFMatch, onlyEraseLF, flipHoriz, flipVert [, landFlag, ... ]'; |
3184 paramsStr = 'x, y, sprite, frameIdx, eraseOnLFMatch, onlyEraseLF, flipHoriz, flipVert [, landFlag, ... ]'; |
3118 begin |
3185 begin |
3119 if CheckAndFetchLuaParamMinCount(L, 4, call, params, n) then |
3186 if CheckAndFetchLuaParamMinCount(L, 4, callStr, paramsStr, n) then |
3120 begin |
3187 begin |
3121 if not lua_isnoneornil(L, 5) then |
3188 if not lua_isnoneornil(L, 5) then |
3122 eraseOnLFMatch := lua_toboolean(L, 5) |
3189 eraseOnLFMatch := lua_toboolean(L, 5) |
3123 else eraseOnLFMatch := false; |
3190 else eraseOnLFMatch := false; |
3124 if not lua_isnoneornil(L, 6) then |
3191 if not lua_isnoneornil(L, 6) then |
3134 |
3201 |
3135 // accept any amount of landflags, loop is never executed if n<9 |
3202 // accept any amount of landflags, loop is never executed if n<9 |
3136 for i:= 9 to n do |
3203 for i:= 9 to n do |
3137 lf:= lf or Trunc(lua_tonumber(L, i)); |
3204 lf:= lf or Trunc(lua_tonumber(L, i)); |
3138 |
3205 |
3139 n:= LuaToSpriteOrd(L, 3, call, params); |
3206 n:= LuaToSpriteOrd(L, 3, callStr, paramsStr); |
3140 if n >= 0 then |
3207 if n >= 0 then |
3141 begin |
3208 begin |
3142 spr:= TSprite(n); |
3209 spr:= TSprite(n); |
3143 if SpritesData[spr].Surface = nil then |
3210 if SpritesData[spr].Surface = nil then |
3144 LuaError(call + ': ' + EnumToStr(spr) + ' cannot be placed! (required information not loaded)' ) |
3211 LuaError(callStr + ': ' + EnumToStr(spr) + ' cannot be placed! (required information not loaded)' ) |
3145 else |
3212 else |
3146 EraseLand( |
3213 EraseLand( |
3147 Trunc(lua_tonumber(L, 1)) - SpritesData[spr].Width div 2, |
3214 Trunc(lua_tonumber(L, 1)) - SpritesData[spr].Width div 2, |
3148 Trunc(lua_tonumber(L, 2)) - SpritesData[spr].Height div 2, |
3215 Trunc(lua_tonumber(L, 2)) - SpritesData[spr].Height div 2, |
3149 spr, Trunc(lua_tonumber(L, 4)), lf, eraseOnLFMatch, onlyEraseLF, flipHoriz, flipVert); |
3216 spr, Trunc(lua_tonumber(L, 4)), lf, eraseOnLFMatch, onlyEraseLF, flipHoriz, flipVert); |
3386 end; |
3453 end; |
3387 |
3454 |
3388 function lc_getammoname(L : Plua_state) : LongInt; Cdecl; |
3455 function lc_getammoname(L : Plua_state) : LongInt; Cdecl; |
3389 var np, at: LongInt; |
3456 var np, at: LongInt; |
3390 ignoreOverwrite: Boolean; |
3457 ignoreOverwrite: Boolean; |
3391 const call = 'GetAmmoName'; |
3458 const callStr = 'GetAmmoName'; |
3392 params = 'ammoType [, ignoreOverwrite ]'; |
3459 paramsStr = 'ammoType [, ignoreOverwrite ]'; |
3393 begin |
3460 begin |
3394 if CheckAndFetchParamCountRange(L, 1, 2, call, params, np) then |
3461 if CheckAndFetchParamCountRange(L, 1, 2, callStr, paramsStr, np) then |
3395 begin |
3462 begin |
3396 at:= LuaToAmmoTypeOrd(L, 1, call, params); |
3463 at:= LuaToAmmoTypeOrd(L, 1, callStr, paramsStr); |
3397 ignoreOverwrite := false; |
3464 ignoreOverwrite := false; |
3398 if np > 1 then |
3465 if np > 1 then |
3399 ignoreOverwrite := lua_toboolean(L, 2); |
3466 ignoreOverwrite := lua_toboolean(L, 2); |
3400 if at >= 0 then |
3467 if at >= 0 then |
3401 if (not ignoreOverwrite) and (length(trluaammo[Ammoz[TAmmoType(at)].NameId]) > 0) then |
3468 if (not ignoreOverwrite) and (length(trluaammo[Ammoz[TAmmoType(at)].NameId]) > 0) then |
3410 |
3477 |
3411 function lc_getammotimer(L : Plua_state) : LongInt; Cdecl; |
3478 function lc_getammotimer(L : Plua_state) : LongInt; Cdecl; |
3412 var at: LongInt; |
3479 var at: LongInt; |
3413 weapon: PAmmo; |
3480 weapon: PAmmo; |
3414 gear: PGear; |
3481 gear: PGear; |
3415 const call = 'GetAmmoTimer'; |
3482 const callStr = 'GetAmmoTimer'; |
3416 params = 'gearUid, ammoType'; |
3483 paramsStr = 'gearUid, ammoType'; |
3417 begin |
3484 begin |
3418 if CheckLuaParamCount(L, 2, call, params) then |
3485 if CheckLuaParamCount(L, 2, callStr, paramsStr) then |
3419 begin |
3486 begin |
3420 gear:= GearByUID(Trunc(lua_tonumber(L, 1))); |
3487 gear:= GearByUID(Trunc(lua_tonumber(L, 1))); |
3421 if (gear <> nil) and (gear^.Hedgehog <> nil) then |
3488 if (gear <> nil) and (gear^.Hedgehog <> nil) then |
3422 begin |
3489 begin |
3423 at:= LuaToAmmoTypeOrd(L, 2, call, params); |
3490 at:= LuaToAmmoTypeOrd(L, 2, callStr, paramsStr); |
3424 weapon:= GetAmmoEntry(gear^.Hedgehog^, TAmmoType(at)); |
3491 weapon:= GetAmmoEntry(gear^.Hedgehog^, TAmmoType(at)); |
3425 if (Ammoz[TAmmoType(at)].Ammo.Propz and ammoprop_Timerable) <> 0 then |
3492 if (Ammoz[TAmmoType(at)].Ammo.Propz and ammoprop_Timerable) <> 0 then |
3426 lua_pushnumber(L, weapon^.Timer) |
3493 lua_pushnumber(L, weapon^.Timer) |
3427 else |
3494 else |
3428 lua_pushnil(L); |
3495 lua_pushnil(L); |
3598 |
3665 |
3599 // stuff for lua tests |
3666 // stuff for lua tests |
3600 function lc_endluatest(L : Plua_State) : LongInt; Cdecl; |
3667 function lc_endluatest(L : Plua_State) : LongInt; Cdecl; |
3601 var rstring: shortstring; |
3668 var rstring: shortstring; |
3602 const |
3669 const |
3603 call = 'EndLuaTest'; |
3670 callStr = 'EndLuaTest'; |
3604 params = 'TEST_SUCCESSFUL or TEST_FAILED'; |
3671 paramsStr = 'TEST_SUCCESSFUL or TEST_FAILED'; |
3605 begin |
3672 begin |
3606 if CheckLuaParamCount(L, 1, call, params) then |
3673 if CheckLuaParamCount(L, 1, callStr, paramsStr) then |
3607 begin |
3674 begin |
3608 |
3675 |
3609 case Trunc(lua_tonumber(L, 1)) of |
3676 case Trunc(lua_tonumber(L, 1)) of |
3610 HaltTestSuccess : rstring:= 'Success'; |
3677 HaltTestSuccess : rstring:= 'Success'; |
3611 HaltTestFailed: rstring:= 'FAILED'; |
3678 HaltTestFailed: rstring:= 'FAILED'; |
3612 else |
3679 else |
3613 begin |
3680 begin |
3614 LuaCallError('Parameter must be either ' + params, call, params); |
3681 LuaCallError('Parameter must be either ' + paramsStr, callStr, paramsStr); |
3615 exit(0); |
3682 exit(0); |
3616 end; |
3683 end; |
3617 end; |
3684 end; |
3618 |
3685 |
3619 if cTestLua then |
3686 if cTestLua then |
4372 for mg:= Low(TMapGen) to High(TMapGen) do |
4441 for mg:= Low(TMapGen) to High(TMapGen) do |
4373 ScriptSetInteger(EnumToStr(mg), ord(mg)); |
4442 ScriptSetInteger(EnumToStr(mg), ord(mg)); |
4374 |
4443 |
4375 for we:= Low(TWorldEdge) to High(TWorldEdge) do |
4444 for we:= Low(TWorldEdge) to High(TWorldEdge) do |
4376 ScriptSetInteger(EnumToStr(we), ord(we)); |
4445 ScriptSetInteger(EnumToStr(we), ord(we)); |
|
4446 |
|
4447 // register message IDs |
|
4448 for msi:= Low(TMsgStrId) to High(TMsgStrId) do |
|
4449 ScriptSetInteger(EnumToStr(msi), ord(msi)); |
|
4450 |
|
4451 for gsi:= Low(TGoalStrId) to High(TGoalStrId) do |
|
4452 ScriptSetInteger(EnumToStr(gsi), ord(gsi)); |
4377 |
4453 |
4378 ScriptSetLongWord('capcolDefault' , capcolDefaultLua); |
4454 ScriptSetLongWord('capcolDefault' , capcolDefaultLua); |
4379 ScriptSetLongWord('capcolSetting' , capcolSettingLua); |
4455 ScriptSetLongWord('capcolSetting' , capcolSettingLua); |
4380 |
4456 |
4381 ScriptSetInteger('gstDrowning' , gstDrowning); |
4457 ScriptSetInteger('gstDrowning' , gstDrowning); |
4483 lua_register(luaState, _P'SetGearVelocity', @lc_setgearvelocity); |
4559 lua_register(luaState, _P'SetGearVelocity', @lc_setgearvelocity); |
4484 lua_register(luaState, _P'GetGearVelocity', @lc_getgearvelocity); |
4560 lua_register(luaState, _P'GetGearVelocity', @lc_getgearvelocity); |
4485 lua_register(luaState, _P'ParseCommand', @lc_parsecommand); |
4561 lua_register(luaState, _P'ParseCommand', @lc_parsecommand); |
4486 lua_register(luaState, _P'ShowMission', @lc_showmission); |
4562 lua_register(luaState, _P'ShowMission', @lc_showmission); |
4487 lua_register(luaState, _P'HideMission', @lc_hidemission); |
4563 lua_register(luaState, _P'HideMission', @lc_hidemission); |
|
4564 lua_register(luaState, _P'GetEngineString', @lc_getenginestring); |
4488 lua_register(luaState, _P'SetAmmoTexts', @lc_setammotexts); |
4565 lua_register(luaState, _P'SetAmmoTexts', @lc_setammotexts); |
4489 lua_register(luaState, _P'SetAmmoDescriptionAppendix', @lc_setammodescriptionappendix); |
4566 lua_register(luaState, _P'SetAmmoDescriptionAppendix', @lc_setammodescriptionappendix); |
4490 lua_register(luaState, _P'AddCaption', @lc_addcaption); |
4567 lua_register(luaState, _P'AddCaption', @lc_addcaption); |
4491 lua_register(luaState, _P'SetAmmo', @lc_setammo); |
4568 lua_register(luaState, _P'SetAmmo', @lc_setammo); |
4492 lua_register(luaState, _P'GetAmmo', @lc_getammo); |
4569 lua_register(luaState, _P'GetAmmo', @lc_getammo); |