summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f2ba8f1)
raw | patch | inline | side by side (parent: f2ba8f1)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 28 Aug 2017 11:16:49 +0000 (14:16 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 28 Aug 2017 11:21:27 +0000 (14:21 +0300) |
src/game/g_game.pas | patch | blob | history | |
src/game/g_items.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 844e9a4554a02fcf4f9650a6fb2b230658e53d5d..93368940da0d943a1223f77191f923c7432b5bfd 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
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 5ec5ddb77998633d60adbd4ebd7ee1f9f007bc5a..dffeb96096c08d34d753150f155a2f86cfb2e057 100644 (file)
--- a/src/game/g_items.pas
+++ b/src/game/g_items.pas
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
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.