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;
93 g_basic
, g_sound
, g_gfx
, g_map
, r_textures
, r_animations
,
94 g_game
, g_triggers
, g_console
, g_player
, g_net
, g_netmsg
,
96 g_grid
, binheap
, idpool
, utils
, xstreams
;
98 // ////////////////////////////////////////////////////////////////////////// //
100 freeIds
: TIdPool
= nil;
103 // ////////////////////////////////////////////////////////////////////////// //
104 function g_Items_ValidId (idx
: Integer): Boolean; inline;
107 if (idx
< 0) or (idx
> High(ggItems
)) then exit
;
108 if not ggItems
[idx
].slotIsUsed
then exit
;
113 function g_Items_ByIdx (idx
: Integer): PItem
;
115 if (idx
< 0) or (idx
> High(ggItems
)) then raise Exception
.Create('g_ItemObjByIdx: invalid index');
116 result
:= @ggItems
[idx
];
117 if not result
.slotIsUsed
then raise Exception
.Create('g_ItemObjByIdx: requested inexistent item');
121 function g_Items_ObjByIdx (idx
: Integer): PObj
;
123 if (idx
< 0) or (idx
> High(ggItems
)) then raise Exception
.Create('g_ItemObjByIdx: invalid index');
124 if not ggItems
[idx
].slotIsUsed
then raise Exception
.Create('g_ItemObjByIdx: requested inexistent item');
125 result
:= @ggItems
[idx
].Obj
;
129 // ////////////////////////////////////////////////////////////////////////// //
130 procedure TItem
.positionChanged ();
135 // ////////////////////////////////////////////////////////////////////////// //
137 ITEM_SIGNATURE
= $4D455449; // 'ITEM'
139 ITEMSIZE
: Array [ITEM_MEDKIT_SMALL
..ITEM_MAX
] of Array [0..1] of Byte =
140 (((14), (15)), // MEDKIT_SMALL
141 ((28), (19)), // MEDKIT_LARGE
142 ((28), (19)), // MEDKIT_BLACK
143 ((31), (16)), // ARMOR_GREEN
144 ((31), (16)), // ARMOR_BLUE
145 ((25), (25)), // SPHERE_BLUE
146 ((25), (25)), // SPHERE_WHITE
147 ((24), (47)), // SUIT
148 ((14), (27)), // OXYGEN
149 ((25), (25)), // INVUL
150 ((62), (24)), // WEAPON_SAW
151 ((63), (12)), // WEAPON_SHOTGUN1
152 ((54), (13)), // WEAPON_SHOTGUN2
153 ((54), (16)), // WEAPON_CHAINGUN
154 ((62), (16)), // WEAPON_ROCKETLAUNCHER
155 ((54), (16)), // WEAPON_PLASMA
156 ((61), (36)), // WEAPON_BFG
157 ((54), (16)), // WEAPON_SUPERPULEMET
158 (( 9), (11)), // AMMO_BULLETS
159 ((28), (16)), // AMMO_BULLETS_BOX
160 ((15), ( 7)), // AMMO_SHELLS
161 ((32), (12)), // AMMO_SHELLS_BOX
162 ((12), (27)), // AMMO_ROCKET
163 ((54), (21)), // AMMO_ROCKET_BOX
164 ((15), (12)), // AMMO_CELL
165 ((32), (21)), // AMMO_CELL_BIG
166 ((22), (29)), // AMMO_BACKPACK
167 ((16), (16)), // KEY_RED
168 ((16), (16)), // KEY_GREEN
169 ((16), (16)), // KEY_BLUE
170 (( 1), ( 1)), // WEAPON_KASTET
171 ((43), (16)), // WEAPON_PISTOL
172 ((14), (18)), // BOTTLE
173 ((16), (15)), // HELMET
174 ((32), (24)), // JETPACK
175 ((25), (25)), // INVIS
176 ((53), (20)), // WEAPON_FLAMETHROWER
177 ((13), (20))); // AMMO_FUELCAN
179 procedure g_Items_LoadData();
181 e_WriteLog('Loading items data...', TMsgType
.Notify
);
183 g_Sound_CreateWADEx('SOUND_ITEM_RESPAWNITEM', GameWAD
+':SOUNDS\RESPAWNITEM');
184 g_Sound_CreateWADEx('SOUND_ITEM_GETRULEZ', GameWAD
+':SOUNDS\GETRULEZ');
185 g_Sound_CreateWADEx('SOUND_ITEM_GETWEAPON', GameWAD
+':SOUNDS\GETWEAPON');
186 g_Sound_CreateWADEx('SOUND_ITEM_GETITEM', GameWAD
+':SOUNDS\GETITEM');
188 freeIds
:= TIdPool
.Create();
192 procedure g_Items_FreeData();
194 e_WriteLog('Releasing items data...', TMsgType
.Notify
);
196 g_Sound_Delete('SOUND_ITEM_RESPAWNITEM');
197 g_Sound_Delete('SOUND_ITEM_GETRULEZ');
198 g_Sound_Delete('SOUND_ITEM_GETWEAPON');
199 g_Sound_Delete('SOUND_ITEM_GETITEM');
206 procedure releaseItem (idx
: Integer);
210 if (idx
< 0) or (idx
> High(ggItems
)) then raise Exception
.Create('releaseItem: invalid item id');
211 if not freeIds
.hasAlloced
[LongWord(idx
)] then raise Exception
.Create('releaseItem: trying to release unallocated item (0)');
213 if not it
.slotIsUsed
then raise Exception
.Create('releaseItem: trying to release unallocated item (1)');
214 if (it
.arrIdx
<> idx
) then raise Exception
.Create('releaseItem: arrIdx inconsistency');
215 it
.slotIsUsed
:= false;
216 if (it
.Animation
<> nil) then
222 it
.SpawnTrigger
:= -1;
223 it
.ItemType
:= ITEM_NONE
;
224 freeIds
.release(LongWord(idx
));
228 procedure growItemArrayTo (newsz
: Integer);
233 if (newsz
< Length(ggItems
)) then exit
;
235 olen
:= Length(ggItems
);
236 SetLength(ggItems
, newsz
);
237 for i
:= olen
to High(ggItems
) do
240 it
.slotIsUsed
:= false;
242 it
.ItemType
:= ITEM_NONE
;
245 it
.SpawnTrigger
:= -1;
246 it
.Respawnable
:= false;
247 //if not freeIds.hasFree[LongWord(i)] then raise Exception.Create('internal error in item idx manager');
252 function allocItem (): DWORD
;
254 result
:= freeIds
.alloc();
255 if (result
>= Length(ggItems
)) then growItemArrayTo(Integer(result
)+64);
256 if (Integer(result
) > High(ggItems
)) then raise Exception
.Create('allocItem: freeid list corrupted');
257 if (ggItems
[result
].arrIdx
<> Integer(result
)) then raise Exception
.Create('allocItem: arrIdx inconsistency');
261 // it will be slow if the slot is free (we have to rebuild the heap)
262 function wantItemSlot (slot
: Integer): Integer;
267 if (slot
< 0) or (slot
> $0fffffff) then raise Exception
.Create('wantItemSlot: bad item slot request');
268 // do we need to grow item storate?
269 olen
:= Length(ggItems
);
270 if (slot
>= olen
) then growItemArrayTo(slot
+64);
272 it
:= @ggItems
[slot
];
273 if not it
.slotIsUsed
then
275 freeIds
.alloc(LongWord(slot
));
279 if not freeIds
.hasAlloced
[slot
] then raise Exception
.Create('wantItemSlot: internal error in item idx manager');
281 it
.slotIsUsed
:= false;
287 // ////////////////////////////////////////////////////////////////////////// //
288 procedure g_Items_Init ();
292 if gMapInfo
.Height
> gPlayerScreenSize
.Y
then a
:= gMapInfo
.Height
-gPlayerScreenSize
.Y
else a
:= gMapInfo
.Height
;
293 if gMapInfo
.Width
> gPlayerScreenSize
.X
then b
:= gMapInfo
.Width
-gPlayerScreenSize
.X
else b
:= gMapInfo
.Width
;
294 gMaxDist
:= Trunc(Hypot(a
, b
));
298 procedure g_Items_Free ();
302 if (ggItems
<> nil) then
304 for i
:= 0 to High(ggItems
) do ggItems
[i
].Animation
.Free();
311 function g_Items_Create (X
, Y
: Integer; ItemType
: Byte;
312 Fall
, Respawnable
: Boolean; AdjCoord
: Boolean = False; ForcedID
: Integer = -1): DWORD
;
317 if ForcedID
< 0 then find_id
:= allocItem() else find_id
:= wantItemSlot(ForcedID
);
319 //{$IF DEFINED(D2F_DEBUG)}e_WriteLog(Format('allocated item #%d', [Integer(find_id)]), MSG_NOTIFY);{$ENDIF}
321 it
:= @ggItems
[find_id
];
323 if (it
.arrIdx
<> Integer(find_id
)) then raise Exception
.Create('g_Items_Create: arrIdx inconsistency');
324 //it.arrIdx := find_id;
325 it
.slotIsUsed
:= true;
327 it
.ItemType
:= ItemType
;
328 it
.Respawnable
:= Respawnable
;
334 it
.QuietRespawn
:= False;
340 it
.Obj
.Rect
.Width
:= ITEMSIZE
[ItemType
][0];
341 it
.Obj
.Rect
.Height
:= ITEMSIZE
[ItemType
][1];
344 it
.SpawnTrigger
:= -1;
346 // Êîîðäèíàòû îòíîñèòåëüíî öåíòðà íèæíåãî ðåáðà
351 Obj
.X
:= X
- (Obj
.Rect
.Width
div 2);
352 Obj
.Y
:= Y
- Obj
.Rect
.Height
;
358 it
.Obj
.oldX
:= it
.Obj
.X
;
359 it
.Obj
.oldY
:= it
.Obj
.Y
;
361 // Óñòàíîâêà àíèìàöèè
363 ITEM_ARMOR_GREEN
: it
.Animation
:= TAnimationState
.Create(True, 20, 3);
364 ITEM_ARMOR_BLUE
: it
.Animation
:= TAnimationState
.Create(True, 20, 3);
365 ITEM_JETPACK
: it
.Animation
:= TAnimationState
.Create(True, 15, 3);
366 ITEM_SPHERE_BLUE
: it
.Animation
:= TAnimationState
.Create(True, 15, 4);
367 ITEM_SPHERE_WHITE
: it
.Animation
:= TAnimationState
.Create(True, 20, 4);
368 ITEM_INVUL
: it
.Animation
:= TAnimationState
.Create(True, 20, 4);
369 ITEM_INVIS
: it
.Animation
:= TAnimationState
.Create(True, 20, 4);
370 ITEM_BOTTLE
: it
.Animation
:= TAnimationState
.Create(True, 20, 4);
371 ITEM_HELMET
: it
.Animation
:= TAnimationState
.Create(True, 20, 4);
374 it
.positionChanged();
379 procedure g_Items_PreUpdate ();
383 if (ggItems
= nil) then Exit
;
384 for i
:= 0 to High(ggItems
) do
385 if (ggItems
[i
].ItemType
<> ITEM_NONE
) and ggItems
[i
].slotIsUsed
then
387 ggItems
[i
].Obj
.oldX
:= ggItems
[i
].Obj
.X
;
388 ggItems
[i
].Obj
.oldY
:= ggItems
[i
].Obj
.Y
;
392 procedure g_Items_Update ();
397 m
, ItemRespawnTime
: Word;
400 if (ggItems
= nil) then exit
;
402 // respawn items in 15 seconds regardless of settings during warmup
403 ItemRespawnTime
:= IfThen(gLMSRespawn
= LMS_RESPAWN_NONE
, gGameSettings
.ItemRespawnTime
, 15);
405 for i
:= 0 to High(ggItems
) do
407 if (ggItems
[i
].ItemType
= ITEM_NONE
) then continue
;
408 if not ggItems
[i
].slotIsUsed
then continue
; // just in case
418 m
:= g_Obj_Move(@Obj
, True, True);
419 positionChanged(); // this updates spatial accelerators
421 // Ñîïðîòèâëåíèå âîçäóõà
422 if gTime
mod (GAME_TICK
*2) = 0 then Obj
.Vel
.X
:= z_dec(Obj
.Vel
.X
, 1);
424 // Åñëè âûïàë çà êàðòó
425 if WordBool(m
and MOVE_FALLOUT
) then
427 if SpawnTrigger
= -1 then
434 if g_Game_IsServer
and g_Game_IsNet
then MH_SEND_ItemDestroy(True, i
);
440 // Åñëè èãðîêè ïîáëèçîñòè
441 if (gPlayers
<> nil) then
443 j
:= Random(Length(gPlayers
))-1;
445 for k
:= 0 to High(gPlayers
) do
448 if j
> High(gPlayers
) then j
:= 0;
450 if (gPlayers
[j
] <> nil) and gPlayers
[j
].alive
and g_Obj_Collide(@gPlayers
[j
].Obj
, @Obj
) then
452 if g_Game_IsClient
then continue
;
454 if not gPlayers
[j
].PickItem(ItemType
, Respawnable
, r
) then continue
;
456 if g_Game_IsNet
then MH_SEND_PlayerStats(gPlayers
[j
].UID
);
460 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
461 +2. I_MEGA,I_INVL,I_SUPER
462 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
464 g_Items_EmitPickupSoundAt(i
, gPlayers
[j
].Obj
.X
, gPlayers
[j
].Obj
.Y
);
466 // Íàäî óáðàòü ñ êàðòû, åñëè ýòî íå êëþ÷, êîòîðûì íóæíî ïîäåëèòüñÿ ñ äðóãèì èãðîêîì
469 if not (Respawnable
and (ItemRespawnTime
> 0)) then
473 if g_Game_IsNet
then MH_SEND_ItemDestroy(False, i
);
481 if nxt
then continue
;
484 if Respawnable
and g_Game_IsServer
then
486 DecMin(RespawnTime
, 0);
487 if (RespawnTime
= 0) and (not alive
) then
489 if not QuietRespawn
then g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', InitX
, InitY
);
491 if g_Frames_Get(ID
, 'FRAMES_ITEM_RESPAWN') then
493 Anim
:= TAnimation
.Create(ID
, False, 4);
494 g_GFX_OnceAnim(InitX
+(Obj
.Rect
.Width
div 2)-16, InitY
+(Obj
.Rect
.Height
div 2)-16, Anim
);
506 positionChanged(); // this updates spatial accelerators
510 if g_Game_IsNet
then MH_SEND_ItemSpawn(QuietRespawn
, i
);
511 QuietRespawn
:= false;
515 if (Animation
<> nil) then Animation
.Update();
520 procedure g_Items_SetDrop (ID
: DWORD
);
522 if (ID
< Length(ggItems
)) then
524 ggItems
[ID
].dropped
:= true;
529 procedure g_Items_Pick (ID
: DWORD
);
531 if (ID
< Length(ggItems
)) then
533 ggItems
[ID
].Obj
.oldX
:= ggItems
[ID
].Obj
.X
;
534 ggItems
[ID
].Obj
.oldY
:= ggItems
[ID
].Obj
.Y
;
535 ggItems
[ID
].alive
:= false;
536 ggItems
[ID
].RespawnTime
:= IfThen(gLMSRespawn
= LMS_RESPAWN_NONE
, gGameSettings
.ItemRespawnTime
, 15) * 36;
541 procedure g_Items_Remove (ID
: DWORD
);
546 if not g_Items_ValidId(ID
) then
548 //writeln('g_Items_Remove: invalid item id: ', ID);
549 raise Exception
.Create('g_Items_Remove: invalid item id');
554 if (it
.arrIdx
<> Integer(ID
)) then raise Exception
.Create('g_Items_Remove: arrIdx desync');
556 it
.Obj
.oldX
:= it
.Obj
.X
;
557 it
.Obj
.oldY
:= it
.Obj
.Y
;
558 trig
:= it
.SpawnTrigger
;
562 if (trig
> -1) then g_Triggers_DecreaseSpawner(trig
);
566 procedure g_Items_SaveState (st
: TStream
);
571 // Ñ÷èòàåì êîëè÷åñòâî ñóùåñòâóþùèõ ïðåäìåòîâ
573 for i
:= 0 to High(ggItems
) do if (ggItems
[i
].ItemType
<> ITEM_NONE
) and (ggItems
[i
].slotIsUsed
) then Inc(count
);
575 // Êîëè÷åñòâî ïðåäìåòîâ
576 utils
.writeInt(st
, LongInt(count
));
577 if (count
= 0) then exit
;
579 for i
:= 0 to High(ggItems
) do
581 if (ggItems
[i
].ItemType
<> ITEM_NONE
) and (ggItems
[i
].slotIsUsed
) then
583 // Ñèãíàòóðà ïðåäìåòà
584 utils
.writeSign(st
, 'ITEM');
585 utils
.writeInt(st
, Byte(0));
587 tt
:= ggItems
[i
].ItemType
;
588 if ggItems
[i
].dropped
then tt
:= tt
or $80;
589 utils
.writeInt(st
, Byte(tt
));
591 utils
.writeBool(st
, ggItems
[i
].Respawnable
);
592 // Êîîðäèíàòû ðåñïóíà
593 utils
.writeInt(st
, LongInt(ggItems
[i
].InitX
));
594 utils
.writeInt(st
, LongInt(ggItems
[i
].InitY
));
596 utils
.writeInt(st
, Word(ggItems
[i
].RespawnTime
));
597 // Ñóùåñòâóåò ëè ýòîò ïðåäìåò
598 utils
.writeBool(st
, ggItems
[i
].alive
);
599 // Ìîæåò ëè îí ïàäàòü
600 utils
.writeBool(st
, ggItems
[i
].Fall
);
601 // Èíäåêñ òðèããåðà, ñîçäàâøåãî ïðåäìåò
602 utils
.writeInt(st
, LongInt(ggItems
[i
].SpawnTrigger
));
604 Obj_SaveState(st
, @ggItems
[i
].Obj
);
610 procedure g_Items_LoadState (st
: TStream
);
612 count
, i
, a
: Integer;
619 // Êîëè÷åñòâî ïðåäìåòîâ
620 count
:= utils
.readLongInt(st
);
621 if (count
= 0) then exit
;
622 if (count
< 0) or (count
> 1024*1024) then raise XStreamError
.Create('invalid number of items');
624 for a
:= 0 to count
-1 do
626 // Ñèãíàòóðà ïðåäìåòà
627 if not utils
.checkSign(st
, 'ITEM') then raise XStreamError
.Create('invalid item signature');
628 if (utils
.readByte(st
) <> 0) then raise XStreamError
.Create('invalid item version');
630 b
:= utils
.readByte(st
); // bit7=1: monster drop
632 i
:= g_Items_Create(0, 0, b
and $7F, False, False);
633 if ((b
and $80) <> 0) then g_Items_SetDrop(i
);
635 ggItems
[i
].Respawnable
:= utils
.readBool(st
);
636 // Êîîðäèíàòû ðåñïóíà
637 ggItems
[i
].InitX
:= utils
.readLongInt(st
);
638 ggItems
[i
].InitY
:= utils
.readLongInt(st
);
640 ggItems
[i
].RespawnTime
:= utils
.readWord(st
);
641 // Ñóùåñòâóåò ëè ýòîò ïðåäìåò
642 ggItems
[i
].alive
:= utils
.readBool(st
);
643 // Ìîæåò ëè îí ïàäàòü
644 ggItems
[i
].Fall
:= utils
.readBool(st
);
645 // Èíäåêñ òðèããåðà, ñîçäàâøåãî ïðåäìåò
646 ggItems
[i
].SpawnTrigger
:= utils
.readLongInt(st
);
648 Obj_LoadState(@ggItems
[i
].Obj
, st
);
653 procedure g_Items_RestartRound ();
658 for i
:= 0 to High(ggItems
) do
661 it
.Obj
.oldX
:= it
.Obj
.X
;
662 it
.Obj
.oldY
:= it
.Obj
.Y
;
663 if not it
.slotIsUsed
then continue
;
664 if it
.Respawnable
and (it
.ItemType
<> ITEM_NONE
) then
666 it
.QuietRespawn
:= True;
672 if g_Game_IsNet
then MH_SEND_ItemDestroy(True, i
);
678 function g_Items_ForEachAlive (cb
: TItemEachAliveCB
; backwards
: Boolean=false): Boolean;
683 if (ggItems
= nil) or not assigned(cb
) then exit
;
687 for idx
:= High(ggItems
) downto 0 do
689 if ggItems
[idx
].alive
and ggItems
[idx
].slotIsUsed
then
691 result
:= cb(@ggItems
[idx
]);
698 for idx
:= 0 to High(ggItems
) do
700 if ggItems
[idx
].alive
and ggItems
[idx
].slotIsUsed
then
702 result
:= cb(@ggItems
[idx
]);
710 // ////////////////////////////////////////////////////////////////////////// //
711 procedure g_Items_EmitPickupSound (idx
: Integer);
715 if not g_Items_ValidId(idx
) then exit
;
717 g_Items_EmitPickupSoundAt(idx
, it
.Obj
.X
, it
.Obj
.Y
);
720 procedure g_Items_EmitPickupSoundAt (idx
, x
, y
: Integer);
724 if not g_Items_ValidId(idx
) then exit
;
727 if gSoundEffectsDF
then
729 if it
.ItemType
in [ITEM_SPHERE_BLUE
, ITEM_SPHERE_WHITE
, ITEM_INVUL
,
730 ITEM_INVIS
, ITEM_MEDKIT_BLACK
, ITEM_JETPACK
] then
732 g_Sound_PlayExAt('SOUND_ITEM_GETRULEZ', x
, y
);
734 else if it
.ItemType
in [ITEM_WEAPON_SAW
, ITEM_WEAPON_PISTOL
, ITEM_WEAPON_SHOTGUN1
, ITEM_WEAPON_SHOTGUN2
,
735 ITEM_WEAPON_CHAINGUN
, ITEM_WEAPON_ROCKETLAUNCHER
, ITEM_WEAPON_PLASMA
,
736 ITEM_WEAPON_BFG
, ITEM_WEAPON_SUPERPULEMET
, ITEM_WEAPON_FLAMETHROWER
,
737 ITEM_AMMO_BACKPACK
] then
739 g_Sound_PlayExAt('SOUND_ITEM_GETWEAPON', x
, y
);
743 g_Sound_PlayExAt('SOUND_ITEM_GETITEM', x
, y
);
748 if it
.ItemType
in [ITEM_SPHERE_BLUE
, ITEM_SPHERE_WHITE
, ITEM_SUIT
,
749 ITEM_MEDKIT_BLACK
, ITEM_INVUL
, ITEM_INVIS
, ITEM_JETPACK
] then
751 g_Sound_PlayExAt('SOUND_ITEM_GETRULEZ', x
, y
);
753 else if it
.ItemType
in [ITEM_WEAPON_SAW
, ITEM_WEAPON_PISTOL
, ITEM_WEAPON_SHOTGUN1
, ITEM_WEAPON_SHOTGUN2
,
754 ITEM_WEAPON_CHAINGUN
, ITEM_WEAPON_ROCKETLAUNCHER
, ITEM_WEAPON_PLASMA
,
755 ITEM_WEAPON_BFG
, ITEM_WEAPON_SUPERPULEMET
, ITEM_WEAPON_FLAMETHROWER
] then
757 g_Sound_PlayExAt('SOUND_ITEM_GETWEAPON', x
, y
);
761 g_Sound_PlayExAt('SOUND_ITEM_GETITEM', x
, y
);
767 procedure g_Items_AddDynLights();
772 for f
:= 0 to High(ggItems
) do
775 if not it
.alive
then continue
;
777 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);
778 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);
779 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);
780 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);
781 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);
782 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);
783 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);
784 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);
785 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);
786 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);
787 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);
788 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);