547 else lua_pushinteger(L, ClansArray[lua_tointeger(L, 1)]^.Color shl 8 or $FF); |
550 else lua_pushinteger(L, ClansArray[lua_tointeger(L, 1)]^.Color shl 8 or $FF); |
548 lc_getclancolor:= 1 |
551 lc_getclancolor:= 1 |
549 end; |
552 end; |
550 |
553 |
551 function lc_setclancolor(L : Plua_State) : LongInt; Cdecl; |
554 function lc_setclancolor(L : Plua_State) : LongInt; Cdecl; |
552 var gear : PGear; |
555 var clan : PClan; |
|
556 team : PTeam; |
|
557 hh : THedgehog; |
|
558 i, j : LongInt; |
|
559 r, rr: TSDL_Rect; |
|
560 texsurf: PSDL_Surface; |
553 begin |
561 begin |
554 if lua_gettop(L) <> 2 then |
562 if lua_gettop(L) <> 2 then |
555 LuaError('Lua: Wrong number of parameters passed to SetClanColor!') |
563 LuaError('Lua: Wrong number of parameters passed to SetClanColor!') |
556 else ClansArray[lua_tointeger(L, 1)]^.Color:= lua_tointeger(L, 2) shr 8; |
564 else |
|
565 begin |
|
566 clan := ClansArray[lua_tointeger(L, 1)]; |
|
567 clan^.Color:= lua_tointeger(L, 2) shr 8; |
|
568 for i:= 0 to Pred(clan^.TeamsNumber) do |
|
569 begin |
|
570 team:= clan^.Teams[i]; |
|
571 for j:= 0 to 7 do |
|
572 begin |
|
573 hh:= team^.Hedgehogs[i]; |
|
574 if (hh.Gear <> nil) and (hh.GearHidden <> nil) then |
|
575 begin |
|
576 FreeTexture(hh.NameTagTex); |
|
577 hh.NameTagTex:= RenderStringTex(hh.Name, clan^.Color, fnt16); |
|
578 RenderHealth(hh); |
|
579 end; |
|
580 end; |
|
581 FreeTexture(team^.NameTagTex); |
|
582 team^.NameTagTex:= RenderStringTex(clan^.Teams[i]^.TeamName, clan^.Color, fnt16); |
|
583 r.w:= cTeamHealthWidth + 5; |
|
584 r.h:= team^.NameTagTex^.h; |
|
585 |
|
586 texsurf:= SDL_CreateRGBSurface(SDL_SWSURFACE, r.w, r.h, 32, RMask, GMask, BMask, AMask); |
|
587 TryDo(texsurf <> nil, errmsgCreateSurface, true); |
|
588 TryDo(SDL_SetColorKey(texsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); |
|
589 |
|
590 DrawRoundRect(@r, cWhiteColor, cNearBlackColorChannels.value, texsurf, true); |
|
591 rr:= r; |
|
592 inc(rr.x, 2); dec(rr.w, 4); inc(rr.y, 2); dec(rr.h, 4); |
|
593 DrawRoundRect(@rr, clan^.Color, clan^.Color, texsurf, false); |
|
594 |
|
595 FreeTexture(team^.HealthTex); |
|
596 team^.HealthTex:= Surface2Tex(texsurf, false); |
|
597 SDL_FreeSurface(texsurf); |
|
598 MakeCrossHairs |
|
599 end |
|
600 end; |
557 lc_setclancolor:= 0 |
601 lc_setclancolor:= 0 |
558 end; |
602 end; |
559 |
603 |
560 function lc_gethogteamname(L : Plua_State) : LongInt; Cdecl; |
604 function lc_gethogteamname(L : Plua_State) : LongInt; Cdecl; |
561 var gear : PGear; |
605 var gear : PGear; |