# HG changeset patch # User nemo # Date 1302190256 14400 # Node ID 9cfdb9bc6140087fbb3fa81da3e995488b15b46b # Parent 71f94af9d1a4ee73e3d5ea4c4974486840881f27 For mikade - bit more flexibility in script captions diff -r 71f94af9d1a4 -r 9cfdb9bc6140 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Thu Apr 07 13:26:56 2011 +0200 +++ b/hedgewars/uScript.pas Thu Apr 07 11:30:56 2011 -0400 @@ -180,8 +180,10 @@ function lc_addcaption(L : Plua_State) : LongInt; Cdecl; begin if lua_gettop(L) = 1 then + AddCaption(lua_tostring(L, 1), cWhiteColor, capgrpMessage) + else if lua_gettop(L) = 3 then begin - AddCaption(lua_tostring(L, 1), cWhiteColor, capgrpMessage); + AddCaption(lua_tostring(L, 1), lua_tointeger(L, 2) shr 8, TCapGroup(lua_tointeger(L, 3))); end else LuaError('Lua: Wrong number of parameters passed to AddCaption!'); @@ -1555,7 +1557,8 @@ vgt: TVisualGearType; am : TAmmoType; st : TSound; - he: THogEffect; + he : THogEffect; + cg : TCapGroup; s, t : ansistring; begin // initialize lua @@ -1645,6 +1648,9 @@ for he:= Low(THogEffect) to High(THogEffect) do ScriptSetInteger(EnumToStr(he), ord(he)); +for cg:= Low(TCapGroup) to High(TCapGroup) do + ScriptSetInteger(EnumToStr(cg), ord(cg)); + // register functions lua_register(luaState, 'band', @lc_band); lua_register(luaState, 'bor', @lc_bor); diff -r 71f94af9d1a4 -r 9cfdb9bc6140 hedgewars/uTypes.pas --- a/hedgewars/uTypes.pas Thu Apr 07 13:26:56 2011 +0200 +++ b/hedgewars/uTypes.pas Thu Apr 07 11:30:56 2011 -0400 @@ -141,7 +141,7 @@ THWFont = (fnt16, fntBig, fntSmall {$IFNDEF IPHONEOS}, CJKfnt16, CJKfntBig, CJKfntSmall{$ENDIF}); TCapGroup = (capgrpGameState, capgrpAmmoinfo, capgrpVolume, - capgrpMessage, capgrpAmmostate); + capgrpMessage, capgrpMessage2, capgrpAmmostate); TStatInfoType = (siGameResult, siMaxStepDamage, siMaxStepKills, siKilledHHs, siClanHealth, siTeamStats, siPlayerKills, siMaxTeamDamage, diff -r 71f94af9d1a4 -r 9cfdb9bc6140 hedgewars/uUtils.pas --- a/hedgewars/uUtils.pas Thu Apr 07 13:26:56 2011 +0200 +++ b/hedgewars/uUtils.pas Thu Apr 07 11:30:56 2011 -0400 @@ -31,6 +31,7 @@ function EnumToStr(const en : TSound) : shortstring; overload; function EnumToStr(const en : TAmmoType) : shortstring; overload; function EnumToStr(const en : THogEffect) : shortstring; overload; +function EnumToStr(const en : TCapGroup) : shortstring; overload; function Min(a, b: LongInt): LongInt; inline; function Max(a, b: LongInt): LongInt; inline; @@ -118,7 +119,12 @@ function EnumToStr(const en: THogEffect) : shortstring; overload; begin - EnumToStr := GetEnumName(TypeInfo(THogEffect), ord(en)) +EnumToStr := GetEnumName(TypeInfo(THogEffect), ord(en)) +end; + +function EnumToStr(const en: TCapGroup) : shortstring; overload; +begin +EnumToStr := GetEnumName(TypeInfo(TCapGroup), ord(en)) end;