1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
22 MAPDEF
, g_textures
, g_phys
, g_saveload
;
30 arrIdx
: Integer; // in ggItems
35 InitX
, InitY
: Integer;
39 QuietRespawn
: Boolean;
40 SpawnTrigger
: Integer;
42 Animation
: TAnimationState
;
43 dropped
: Boolean; // dropped from the monster? drops should be rendered after corpses, so zombie corpse will not obscure ammo container, for example
45 procedure positionChanged (); //WARNING! call this after monster position was changed, or coldet will not work right!
47 property used
: Boolean read slotIsUsed
;
48 property myid
: Integer read arrIdx
;
51 procedure g_Items_LoadData();
52 procedure g_Items_FreeData();
53 procedure g_Items_Init();
54 procedure g_Items_Free();
55 function g_Items_Create(X
, Y
: Integer; ItemType
: Byte;
56 Fall
, Respawnable
: Boolean; AdjCoord
: Boolean = False; ForcedID
: Integer = -1): DWORD
;
57 procedure g_Items_SetDrop (ID
: DWORD
);
58 procedure g_Items_PreUpdate();
59 procedure g_Items_Update();
60 procedure g_Items_Pick(ID
: DWORD
);
61 procedure g_Items_Remove(ID
: DWORD
);
62 procedure g_Items_SaveState (st
: TStream
);
63 procedure g_Items_LoadState (st
: TStream
);
65 procedure g_Items_RestartRound ();
67 function g_Items_ValidId (idx
: Integer): Boolean; inline;
68 function g_Items_ByIdx (idx
: Integer): PItem
;
69 function g_Items_ObjByIdx (idx
: Integer): PObj
;
71 procedure g_Items_EmitPickupSound (idx
: Integer); // at item position
72 procedure g_Items_EmitPickupSoundAt (idx
, x
, y
: Integer);
74 procedure g_Items_AddDynLights();
78 TItemEachAliveCB
= function (it
: PItem
): Boolean is nested
; // return `true` to stop
80 function g_Items_ForEachAlive (cb
: TItemEachAliveCB
; backwards
: Boolean=false): Boolean;
84 gMaxDist
: Integer = 1; // for sounds
86 var (* private state *)
87 ggItems
: Array of TItem
= nil;
96 g_basic
, g_sound
, g_map
,
97 g_game
, g_triggers
, g_console
, g_player
, g_net
, g_netmsg
,
99 g_grid
, binheap
, idpool
, utils
, xstreams
102 // ////////////////////////////////////////////////////////////////////////// //
104 freeIds
: TIdPool
= nil;
107 // ////////////////////////////////////////////////////////////////////////// //
108 function g_Items_ValidId (idx
: Integer): Boolean; inline;
111 if (idx
< 0) or (idx
> High(ggItems
)) then exit
;
112 if not ggItems
[idx
].slotIsUsed
then exit
;
117 function g_Items_ByIdx (idx
: Integer): PItem
;
119 if (idx
< 0) or (idx
> High(ggItems
)) then raise Exception
.Create('g_ItemObjByIdx: invalid index');
120 result
:= @ggItems
[idx
];
121 if not result
.slotIsUsed
then raise Exception
.Create('g_ItemObjByIdx: requested inexistent item');
125 function g_Items_ObjByIdx (idx
: Integer): PObj
;
127 if (idx
< 0) or (idx
> High(ggItems
)) then raise Exception
.Create('g_ItemObjByIdx: invalid index');
128 if not ggItems
[idx
].slotIsUsed
then raise Exception
.Create('g_ItemObjByIdx: requested inexistent item');
129 result
:= @ggItems
[idx
].Obj
;
133 // ////////////////////////////////////////////////////////////////////////// //
134 procedure TItem
.positionChanged ();
139 // ////////////////////////////////////////////////////////////////////////// //
141 ITEM_SIGNATURE
= $4D455449; // 'ITEM'
143 ITEMSIZE
: Array [ITEM_MEDKIT_SMALL
..ITEM_MAX
] of Array [0..1] of Byte =
144 (((14), (15)), // MEDKIT_SMALL
145 ((28), (19)), // MEDKIT_LARGE
146 ((28), (19)), // MEDKIT_BLACK
147 ((31), (16)), // ARMOR_GREEN
148 ((31), (16)), // ARMOR_BLUE
149 ((25), (25)), // SPHERE_BLUE
150 ((25), (25)), // SPHERE_WHITE
151 ((24), (47)), // SUIT
152 ((14), (27)), // OXYGEN
153 ((25), (25)), // INVUL
154 ((62), (24)), // WEAPON_SAW
155 ((63), (12)), // WEAPON_SHOTGUN1
156 ((54), (13)), // WEAPON_SHOTGUN2
157 ((54), (16)), // WEAPON_CHAINGUN
158 ((62), (16)), // WEAPON_ROCKETLAUNCHER
159 ((54), (16)), // WEAPON_PLASMA
160 ((61), (36)), // WEAPON_BFG
161 ((54), (16)), // WEAPON_SUPERPULEMET
162 (( 9), (11)), // AMMO_BULLETS
163 ((28), (16)), // AMMO_BULLETS_BOX
164 ((15), ( 7)), // AMMO_SHELLS
165 ((32), (12)), // AMMO_SHELLS_BOX
166 ((12), (27)), // AMMO_ROCKET
167 ((54), (21)), // AMMO_ROCKET_BOX
168 ((15), (12)), // AMMO_CELL
169 ((32), (21)), // AMMO_CELL_BIG
170 ((22), (29)), // AMMO_BACKPACK
171 ((16), (16)), // KEY_RED
172 ((16), (16)), // KEY_GREEN
173 ((16), (16)), // KEY_BLUE
174 (( 1), ( 1)), // WEAPON_KASTET
175 ((43), (16)), // WEAPON_PISTOL
176 ((14), (18)), // BOTTLE
177 ((16), (15)), // HELMET
178 ((32), (24)), // JETPACK
179 ((25), (25)), // INVIS
180 ((53), (20)), // WEAPON_FLAMETHROWER
181 ((13), (20))); // AMMO_FUELCAN
183 procedure g_Items_LoadData();
185 e_WriteLog('Loading items data...', TMsgType
.Notify
);
187 g_Sound_CreateWADEx('SOUND_ITEM_RESPAWNITEM', GameWAD
+':SOUNDS\RESPAWNITEM');
188 g_Sound_CreateWADEx('SOUND_ITEM_GETRULEZ', GameWAD
+':SOUNDS\GETRULEZ');
189 g_Sound_CreateWADEx('SOUND_ITEM_GETWEAPON', GameWAD
+':SOUNDS\GETWEAPON');
190 g_Sound_CreateWADEx('SOUND_ITEM_GETITEM', GameWAD
+':SOUNDS\GETITEM');
192 freeIds
:= TIdPool
.Create();
196 procedure g_Items_FreeData();
198 e_WriteLog('Releasing items data...', TMsgType
.Notify
);
200 g_Sound_Delete('SOUND_ITEM_RESPAWNITEM');
201 g_Sound_Delete('SOUND_ITEM_GETRULEZ');
202 g_Sound_Delete('SOUND_ITEM_GETWEAPON');
203 g_Sound_Delete('SOUND_ITEM_GETITEM');
210 procedure releaseItem (idx
: Integer);
214 if (idx
< 0) or (idx
> High(ggItems
)) then raise Exception
.Create('releaseItem: invalid item id');
215 if not freeIds
.hasAlloced
[LongWord(idx
)] then raise Exception
.Create('releaseItem: trying to release unallocated item (0)');
217 if not it
.slotIsUsed
then raise Exception
.Create('releaseItem: trying to release unallocated item (1)');
218 if (it
.arrIdx
<> idx
) then raise Exception
.Create('releaseItem: arrIdx inconsistency');
219 it
.slotIsUsed
:= false;
220 if (it
.Animation
<> nil) then
226 it
.SpawnTrigger
:= -1;
227 it
.ItemType
:= ITEM_NONE
;
228 freeIds
.release(LongWord(idx
));
232 procedure growItemArrayTo (newsz
: Integer);
237 if (newsz
< Length(ggItems
)) then exit
;
239 olen
:= Length(ggItems
);
240 SetLength(ggItems
, newsz
);
241 for i
:= olen
to High(ggItems
) do
244 it
.slotIsUsed
:= false;
246 it
.ItemType
:= ITEM_NONE
;
249 it
.SpawnTrigger
:= -1;
250 it
.Respawnable
:= false;
251 //if not freeIds.hasFree[LongWord(i)] then raise Exception.Create('internal error in item idx manager');
256 function allocItem (): DWORD
;
258 result
:= freeIds
.alloc();
259 if (result
>= Length(ggItems
)) then growItemArrayTo(Integer(result
)+64);
260 if (Integer(result
) > High(ggItems
)) then raise Exception
.Create('allocItem: freeid list corrupted');
261 if (ggItems
[result
].arrIdx
<> Integer(result
)) then raise Exception
.Create('allocItem: arrIdx inconsistency');
265 // it will be slow if the slot is free (we have to rebuild the heap)
266 function wantItemSlot (slot
: Integer): Integer;
271 if (slot
< 0) or (slot
> $0fffffff) then raise Exception
.Create('wantItemSlot: bad item slot request');
272 // do we need to grow item storate?
273 olen
:= Length(ggItems
);
274 if (slot
>= olen
) then growItemArrayTo(slot
+64);
276 it
:= @ggItems
[slot
];
277 if not it
.slotIsUsed
then
279 freeIds
.alloc(LongWord(slot
));
283 if not freeIds
.hasAlloced
[slot
] then raise Exception
.Create('wantItemSlot: internal error in item idx manager');
285 it
.slotIsUsed
:= false;
291 // ////////////////////////////////////////////////////////////////////////// //
292 procedure g_Items_Init ();
296 if gMapInfo
.Height
> gPlayerScreenSize
.Y
then a
:= gMapInfo
.Height
-gPlayerScreenSize
.Y
else a
:= gMapInfo
.Height
;
297 if gMapInfo
.Width
> gPlayerScreenSize
.X
then b
:= gMapInfo
.Width
-gPlayerScreenSize
.X
else b
:= gMapInfo
.Width
;
298 gMaxDist
:= Trunc(Hypot(a
, b
));
302 procedure g_Items_Free ();
306 if (ggItems
<> nil) then
308 for i
:= 0 to High(ggItems
) do ggItems
[i
].Animation
.Free();
315 function g_Items_Create (X
, Y
: Integer; ItemType
: Byte;
316 Fall
, Respawnable
: Boolean; AdjCoord
: Boolean = False; ForcedID
: Integer = -1): DWORD
;
321 if ForcedID
< 0 then find_id
:= allocItem() else find_id
:= wantItemSlot(ForcedID
);
323 //{$IF DEFINED(D2F_DEBUG)}e_WriteLog(Format('allocated item #%d', [Integer(find_id)]), MSG_NOTIFY);{$ENDIF}
325 it
:= @ggItems
[find_id
];
327 if (it
.arrIdx
<> Integer(find_id
)) then raise Exception
.Create('g_Items_Create: arrIdx inconsistency');
328 //it.arrIdx := find_id;
329 it
.slotIsUsed
:= true;
331 it
.ItemType
:= ItemType
;
332 it
.Respawnable
:= Respawnable
;
338 it
.QuietRespawn
:= False;
344 it
.Obj
.Rect
.Width
:= ITEMSIZE
[ItemType
][0];
345 it
.Obj
.Rect
.Height
:= ITEMSIZE
[ItemType
][1];
348 it
.SpawnTrigger
:= -1;
350 // Êîîðäèíàòû îòíîñèòåëüíî öåíòðà íèæíåãî ðåáðà
355 Obj
.X
:= X
- (Obj
.Rect
.Width
div 2);
356 Obj
.Y
:= Y
- Obj
.Rect
.Height
;
362 it
.Obj
.oldX
:= it
.Obj
.X
;
363 it
.Obj
.oldY
:= it
.Obj
.Y
;
365 // Óñòàíîâêà àíèìàöèè
367 ITEM_ARMOR_GREEN
: it
.Animation
:= TAnimationState
.Create(True, 20, 3);
368 ITEM_ARMOR_BLUE
: it
.Animation
:= TAnimationState
.Create(True, 20, 3);
369 ITEM_JETPACK
: it
.Animation
:= TAnimationState
.Create(True, 15, 3);
370 ITEM_SPHERE_BLUE
: it
.Animation
:= TAnimationState
.Create(True, 15, 4);
371 ITEM_SPHERE_WHITE
: it
.Animation
:= TAnimationState
.Create(True, 20, 4);
372 ITEM_INVUL
: it
.Animation
:= TAnimationState
.Create(True, 20, 4);
373 ITEM_INVIS
: it
.Animation
:= TAnimationState
.Create(True, 20, 4);
374 ITEM_BOTTLE
: it
.Animation
:= TAnimationState
.Create(True, 20, 4);
375 ITEM_HELMET
: it
.Animation
:= TAnimationState
.Create(True, 20, 4);
378 it
.positionChanged();
383 procedure g_Items_PreUpdate ();
387 if (ggItems
= nil) then Exit
;
388 for i
:= 0 to High(ggItems
) do
389 if (ggItems
[i
].ItemType
<> ITEM_NONE
) and ggItems
[i
].slotIsUsed
then
391 ggItems
[i
].Obj
.oldX
:= ggItems
[i
].Obj
.X
;
392 ggItems
[i
].Obj
.oldY
:= ggItems
[i
].Obj
.Y
;
396 procedure g_Items_Update ();
399 m
, ItemRespawnTime
: Word;
402 if (ggItems
= nil) then exit
;
404 // respawn items in 15 seconds regardless of settings during warmup
405 ItemRespawnTime
:= IfThen(gLMSRespawn
= LMS_RESPAWN_NONE
, gGameSettings
.ItemRespawnTime
, 15);
407 for i
:= 0 to High(ggItems
) do
409 if (ggItems
[i
].ItemType
= ITEM_NONE
) then continue
;
410 if not ggItems
[i
].slotIsUsed
then continue
; // just in case
420 m
:= g_Obj_Move(@Obj
, True, True);
421 positionChanged(); // this updates spatial accelerators
423 // Ñîïðîòèâëåíèå âîçäóõà
424 if gTime
mod (GAME_TICK
*2) = 0 then Obj
.Vel
.X
:= z_dec(Obj
.Vel
.X
, 1);
426 // Åñëè âûïàë çà êàðòó
427 if WordBool(m
and MOVE_FALLOUT
) then
429 if SpawnTrigger
= -1 then
436 if g_Game_IsServer
and g_Game_IsNet
then MH_SEND_ItemDestroy(True, i
);
442 // Åñëè èãðîêè ïîáëèçîñòè
443 if (gPlayers
<> nil) then
445 j
:= Random(Length(gPlayers
))-1;
447 for k
:= 0 to High(gPlayers
) do
450 if j
> High(gPlayers
) then j
:= 0;
452 if (gPlayers
[j
] <> nil) and gPlayers
[j
].alive
and g_Obj_Collide(@gPlayers
[j
].Obj
, @Obj
) then
454 if g_Game_IsClient
then continue
;
456 if not gPlayers
[j
].PickItem(ItemType
, Respawnable
, r
) then continue
;
458 if g_Game_IsNet
then MH_SEND_PlayerStats(gPlayers
[j
].UID
);
462 1. I_NONE,I_CLIP,I_SHEL,I_ROCKET,I_CELL,I_AMMO,I_SBOX,I_RBOX,I_CELP,I_BPACK,I_CSAW,I_SGUN,I_SGUN2,I_MGUN,I_LAUN,I_PLAS,I_BFG,I_GUN2
463 +2. I_MEGA,I_INVL,I_SUPER
464 3. I_STIM,I_MEDI,I_ARM1,I_ARM2,I_AQUA,I_KEYR,I_KEYG,I_KEYB,I_SUIT,I_RTORCH,I_GTORCH,I_BTORCH,I_GOR1,I_FCAN
466 g_Items_EmitPickupSoundAt(i
, gPlayers
[j
].Obj
.X
, gPlayers
[j
].Obj
.Y
);
468 // Íàäî óáðàòü ñ êàðòû, åñëè ýòî íå êëþ÷, êîòîðûì íóæíî ïîäåëèòüñÿ ñ äðóãèì èãðîêîì
471 if not (Respawnable
and (ItemRespawnTime
> 0)) then
475 if g_Game_IsNet
then MH_SEND_ItemDestroy(False, i
);
483 if nxt
then continue
;
486 if Respawnable
and g_Game_IsServer
then
488 DecMin(RespawnTime
, 0);
489 if (RespawnTime
= 0) and (not alive
) then
491 if not QuietRespawn
then g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', InitX
, InitY
);
495 InitX
+ (Obj
.Rect
.Width
div 2) - 16,
496 InitY
+ (Obj
.Rect
.Height
div 2) - 16
507 positionChanged(); // this updates spatial accelerators
511 if g_Game_IsNet
then MH_SEND_ItemSpawn(QuietRespawn
, i
);
512 QuietRespawn
:= false;
516 if (Animation
<> nil) then Animation
.Update();
521 procedure g_Items_SetDrop (ID
: DWORD
);
523 if (ID
< Length(ggItems
)) then
525 ggItems
[ID
].dropped
:= true;
530 procedure g_Items_Pick (ID
: DWORD
);
532 if (ID
< Length(ggItems
)) then
534 ggItems
[ID
].Obj
.oldX
:= ggItems
[ID
].Obj
.X
;
535 ggItems
[ID
].Obj
.oldY
:= ggItems
[ID
].Obj
.Y
;
536 ggItems
[ID
].alive
:= false;
537 ggItems
[ID
].RespawnTime
:= IfThen(gLMSRespawn
= LMS_RESPAWN_NONE
, gGameSettings
.ItemRespawnTime
, 15) * 36;
542 procedure g_Items_Remove (ID
: DWORD
);
547 if not g_Items_ValidId(ID
) then
549 //writeln('g_Items_Remove: invalid item id: ', ID);
550 raise Exception
.Create('g_Items_Remove: invalid item id');
555 if (it
.arrIdx
<> Integer(ID
)) then raise Exception
.Create('g_Items_Remove: arrIdx desync');
557 it
.Obj
.oldX
:= it
.Obj
.X
;
558 it
.Obj
.oldY
:= it
.Obj
.Y
;
559 trig
:= it
.SpawnTrigger
;
563 if (trig
> -1) then g_Triggers_DecreaseSpawner(trig
);
567 procedure g_Items_SaveState (st
: TStream
);
572 // Ñ÷èòàåì êîëè÷åñòâî ñóùåñòâóþùèõ ïðåäìåòîâ
574 for i
:= 0 to High(ggItems
) do if (ggItems
[i
].ItemType
<> ITEM_NONE
) and (ggItems
[i
].slotIsUsed
) then Inc(count
);
576 // Êîëè÷åñòâî ïðåäìåòîâ
577 utils
.writeInt(st
, LongInt(count
));
578 if (count
= 0) then exit
;
580 for i
:= 0 to High(ggItems
) do
582 if (ggItems
[i
].ItemType
<> ITEM_NONE
) and (ggItems
[i
].slotIsUsed
) then
584 // Ñèãíàòóðà ïðåäìåòà
585 utils
.writeSign(st
, 'ITEM');
586 utils
.writeInt(st
, Byte(0));
588 tt
:= ggItems
[i
].ItemType
;
589 if ggItems
[i
].dropped
then tt
:= tt
or $80;
590 utils
.writeInt(st
, Byte(tt
));
592 utils
.writeBool(st
, ggItems
[i
].Respawnable
);
593 // Êîîðäèíàòû ðåñïóíà
594 utils
.writeInt(st
, LongInt(ggItems
[i
].InitX
));
595 utils
.writeInt(st
, LongInt(ggItems
[i
].InitY
));
597 utils
.writeInt(st
, Word(ggItems
[i
].RespawnTime
));
598 // Ñóùåñòâóåò ëè ýòîò ïðåäìåò
599 utils
.writeBool(st
, ggItems
[i
].alive
);
600 // Ìîæåò ëè îí ïàäàòü
601 utils
.writeBool(st
, ggItems
[i
].Fall
);
602 // Èíäåêñ òðèããåðà, ñîçäàâøåãî ïðåäìåò
603 utils
.writeInt(st
, LongInt(ggItems
[i
].SpawnTrigger
));
605 Obj_SaveState(st
, @ggItems
[i
].Obj
);
611 procedure g_Items_LoadState (st
: TStream
);
613 count
, i
, a
: Integer;
620 // Êîëè÷åñòâî ïðåäìåòîâ
621 count
:= utils
.readLongInt(st
);
622 if (count
= 0) then exit
;
623 if (count
< 0) or (count
> 1024*1024) then raise XStreamError
.Create('invalid number of items');
625 for a
:= 0 to count
-1 do
627 // Ñèãíàòóðà ïðåäìåòà
628 if not utils
.checkSign(st
, 'ITEM') then raise XStreamError
.Create('invalid item signature');
629 if (utils
.readByte(st
) <> 0) then raise XStreamError
.Create('invalid item version');
631 b
:= utils
.readByte(st
); // bit7=1: monster drop
633 i
:= g_Items_Create(0, 0, b
and $7F, False, False);
634 if ((b
and $80) <> 0) then g_Items_SetDrop(i
);
636 ggItems
[i
].Respawnable
:= utils
.readBool(st
);
637 // Êîîðäèíàòû ðåñïóíà
638 ggItems
[i
].InitX
:= utils
.readLongInt(st
);
639 ggItems
[i
].InitY
:= utils
.readLongInt(st
);
641 ggItems
[i
].RespawnTime
:= utils
.readWord(st
);
642 // Ñóùåñòâóåò ëè ýòîò ïðåäìåò
643 ggItems
[i
].alive
:= utils
.readBool(st
);
644 // Ìîæåò ëè îí ïàäàòü
645 ggItems
[i
].Fall
:= utils
.readBool(st
);
646 // Èíäåêñ òðèããåðà, ñîçäàâøåãî ïðåäìåò
647 ggItems
[i
].SpawnTrigger
:= utils
.readLongInt(st
);
649 Obj_LoadState(@ggItems
[i
].Obj
, st
);
654 procedure g_Items_RestartRound ();
659 for i
:= 0 to High(ggItems
) do
662 it
.Obj
.oldX
:= it
.Obj
.X
;
663 it
.Obj
.oldY
:= it
.Obj
.Y
;
664 if not it
.slotIsUsed
then continue
;
665 if it
.Respawnable
and (it
.ItemType
<> ITEM_NONE
) then
667 it
.QuietRespawn
:= True;
673 if g_Game_IsNet
then MH_SEND_ItemDestroy(True, i
);
679 function g_Items_ForEachAlive (cb
: TItemEachAliveCB
; backwards
: Boolean=false): Boolean;
684 if (ggItems
= nil) or not assigned(cb
) then exit
;
688 for idx
:= High(ggItems
) downto 0 do
690 if ggItems
[idx
].alive
and ggItems
[idx
].slotIsUsed
then
692 result
:= cb(@ggItems
[idx
]);
699 for idx
:= 0 to High(ggItems
) do
701 if ggItems
[idx
].alive
and ggItems
[idx
].slotIsUsed
then
703 result
:= cb(@ggItems
[idx
]);
711 // ////////////////////////////////////////////////////////////////////////// //
712 procedure g_Items_EmitPickupSound (idx
: Integer);
716 if not g_Items_ValidId(idx
) then exit
;
718 g_Items_EmitPickupSoundAt(idx
, it
.Obj
.X
, it
.Obj
.Y
);
721 procedure g_Items_EmitPickupSoundAt (idx
, x
, y
: Integer);
725 if not g_Items_ValidId(idx
) then exit
;
728 if gSoundEffectsDF
then
730 if it
.ItemType
in [ITEM_SPHERE_BLUE
, ITEM_SPHERE_WHITE
, ITEM_INVUL
,
731 ITEM_INVIS
, ITEM_MEDKIT_BLACK
, ITEM_JETPACK
] then
733 g_Sound_PlayExAt('SOUND_ITEM_GETRULEZ', x
, y
);
735 else if it
.ItemType
in [ITEM_WEAPON_SAW
, ITEM_WEAPON_PISTOL
, ITEM_WEAPON_SHOTGUN1
, ITEM_WEAPON_SHOTGUN2
,
736 ITEM_WEAPON_CHAINGUN
, ITEM_WEAPON_ROCKETLAUNCHER
, ITEM_WEAPON_PLASMA
,
737 ITEM_WEAPON_BFG
, ITEM_WEAPON_SUPERPULEMET
, ITEM_WEAPON_FLAMETHROWER
,
738 ITEM_AMMO_BACKPACK
] then
740 g_Sound_PlayExAt('SOUND_ITEM_GETWEAPON', x
, y
);
744 g_Sound_PlayExAt('SOUND_ITEM_GETITEM', x
, y
);
749 if it
.ItemType
in [ITEM_SPHERE_BLUE
, ITEM_SPHERE_WHITE
, ITEM_SUIT
,
750 ITEM_MEDKIT_BLACK
, ITEM_INVUL
, ITEM_INVIS
, ITEM_JETPACK
] then
752 g_Sound_PlayExAt('SOUND_ITEM_GETRULEZ', x
, y
);
754 else if it
.ItemType
in [ITEM_WEAPON_SAW
, ITEM_WEAPON_PISTOL
, ITEM_WEAPON_SHOTGUN1
, ITEM_WEAPON_SHOTGUN2
,
755 ITEM_WEAPON_CHAINGUN
, ITEM_WEAPON_ROCKETLAUNCHER
, ITEM_WEAPON_PLASMA
,
756 ITEM_WEAPON_BFG
, ITEM_WEAPON_SUPERPULEMET
, ITEM_WEAPON_FLAMETHROWER
] then
758 g_Sound_PlayExAt('SOUND_ITEM_GETWEAPON', x
, y
);
762 g_Sound_PlayExAt('SOUND_ITEM_GETITEM', x
, y
);
768 procedure g_Items_AddDynLights();
773 for f
:= 0 to High(ggItems
) do
776 if not it
.alive
then continue
;
778 ITEM_KEY_RED
: g_AddDynLight(it
.Obj
.X
+(it
.Obj
.Rect
.Width
div 2), it
.Obj
.Y
+(it
.Obj
.Rect
.Height
div 2), 24, 1.0, 0.0, 0.0, 0.6);
779 ITEM_KEY_GREEN
: g_AddDynLight(it
.Obj
.X
+(it
.Obj
.Rect
.Width
div 2), it
.Obj
.Y
+(it
.Obj
.Rect
.Height
div 2), 24, 0.0, 1.0, 0.0, 0.6);
780 ITEM_KEY_BLUE
: g_AddDynLight(it
.Obj
.X
+(it
.Obj
.Rect
.Width
div 2), it
.Obj
.Y
+(it
.Obj
.Rect
.Height
div 2), 24, 0.0, 0.0, 1.0, 0.6);
781 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);
782 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);
783 ITEM_JETPACK
: 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);
784 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);
785 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);
786 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);
787 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);
788 ITEM_BOTTLE
: g_AddDynLight(it
.Obj
.X
+(it
.Obj
.Rect
.Width
div 2), it
.Obj
.Y
+(it
.Obj
.Rect
.Height
div 2), 16, 0.0, 0.0, 0.8, 0.6);
789 ITEM_HELMET
: g_AddDynLight(it
.Obj
.X
+(it
.Obj
.Rect
.Width
div 2), it
.Obj
.Y
+(it
.Obj
.Rect
.Height
div 2), 16, 0.0, 0.8, 0.0, 0.6);