From: Ketmar Dark Date: Mon, 28 Aug 2017 11:16:49 +0000 (+0300) Subject: added lights for some items X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=b7ff38d281991866c467f65974df53b305711281;p=d2df-sdl.git added lights for some items --- diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 844e9a4..9336894 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -1990,7 +1990,11 @@ begin UPSTime := Time; end; - if gGameOn then g_Weapon_AddDynLights(); + if gGameOn then + begin + g_Weapon_AddDynLights(); + g_Items_AddDynLights(); + end; end; procedure g_Game_LoadData(); diff --git a/src/game/g_items.pas b/src/game/g_items.pas index 5ec5ddb..dffeb96 100644 --- a/src/game/g_items.pas +++ b/src/game/g_items.pas @@ -68,6 +68,8 @@ function g_Items_ObjByIdx (idx: Integer): PObj; procedure g_Items_EmitPickupSound (idx: Integer); // at item position procedure g_Items_EmitPickupSoundAt (idx, x, y: Integer); +procedure g_Items_AddDynLights(); + type TItemEachAliveCB = function (it: PItem): Boolean is nested; // return `true` to stop @@ -879,4 +881,30 @@ begin end; end; + +procedure g_Items_AddDynLights(); +var + f: Integer; + it: PItem; +begin + for f := 0 to High(ggItems) do + begin + it := @ggItems[f]; + if not it.Live then continue; + case it.ItemType of + ITEM_KEY_RED: g_AddDynLight(it.Obj.X+(it.Obj.Rect.Width div 2), it.Obj.Y+(it.Obj.Rect.Height div 2), 32, 1.0, 0.0, 0.0, 0.6); + ITEM_KEY_GREEN: g_AddDynLight(it.Obj.X+(it.Obj.Rect.Width div 2), it.Obj.Y+(it.Obj.Rect.Height div 2), 32, 0.0, 1.0, 0.0, 0.6); + ITEM_KEY_BLUE: g_AddDynLight(it.Obj.X+(it.Obj.Rect.Width div 2), it.Obj.Y+(it.Obj.Rect.Height div 2), 32, 0.0, 0.0, 1.0, 0.6); + ITEM_ARMOR_GREEN: g_AddDynLight(it.Obj.X+(it.Obj.Rect.Width div 2), it.Obj.Y+(it.Obj.Rect.Height div 2), 42, 0.0, 1.0, 0.0, 0.6); + ITEM_ARMOR_BLUE: g_AddDynLight(it.Obj.X+(it.Obj.Rect.Width div 2), it.Obj.Y+(it.Obj.Rect.Height div 2), 42, 0.0, 0.0, 1.0, 0.6); + ITEM_SPHERE_BLUE: g_AddDynLight(it.Obj.X+(it.Obj.Rect.Width div 2), it.Obj.Y+(it.Obj.Rect.Height div 2), 32, 0.0, 1.0, 0.0, 0.6); + ITEM_SPHERE_WHITE: g_AddDynLight(it.Obj.X+(it.Obj.Rect.Width div 2), it.Obj.Y+(it.Obj.Rect.Height div 2), 32, 1.0, 1.0, 1.0, 0.6); + ITEM_INVUL: g_AddDynLight(it.Obj.X+(it.Obj.Rect.Width div 2), it.Obj.Y+(it.Obj.Rect.Height div 2), 32, 1.0, 0.0, 0.0, 0.6); + ITEM_INVIS: g_AddDynLight(it.Obj.X+(it.Obj.Rect.Width div 2), it.Obj.Y+(it.Obj.Rect.Height div 2), 32, 1.0, 1.0, 0.0, 0.6); + ITEM_BOTTLE: g_AddDynLight(it.Obj.X+(it.Obj.Rect.Width div 2), it.Obj.Y+(it.Obj.Rect.Height div 2), 32, 0.0, 0.0, 1.0, 0.6); + end; + end; +end; + + end.