Quake 2 Oop Conversion Project - Source Diff 3.05 vs 3.14 - g_items.c
diff -s -r q2_305/g_items.c q2_314/g_items.c
Left File < - 3.05/g_items.c
Right File > - 3.14/g_items.c
Back to Index
32a33,35
> void Use_Quad (edict_t *ent, gitem_t *item);
> static int quad_drop_timeout_hack;
>
138a142,150
> int quantity;
>
> quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
> if ((skill->value == 1 && quantity >= 2) || (skill->value >= 2 && quantity >= 1))
> return false;
>
> if ((coop->value) && (ent->item->flags & IT_STAY_COOP) && (quantity > 0))
> return false;
>
145,146c157,160
< if ( (int)dmflags->value & DF_INSTANT_ITEMS)
< { // use it immediately
---
> if (((int)dmflags->value & DF_INSTANT_ITEMS) || ((ent->item->use == Use_Quad) && (ent->spawnflags & DROPPED_PLAYER_ITEM)))
> {
> if ((ent->item->use == Use_Quad) && (ent->spawnflags & DROPPED_PLAYER_ITEM))
> quad_drop_timeout_hack = (ent->nextthink - level.time) / FRAMETIME;
270a285
> item = FindItem("Grenades");
273d287
< item = FindItem("Grenades");
307a322,323
> int timeout;
>
310a327,336
> if (quad_drop_timeout_hack)
> {
> timeout = quad_drop_timeout_hack;
> quad_drop_timeout_hack = 0;
> }
> else
> {
> timeout = 300;
> }
>
312c338
< ent->client->quad_framenum += 300;
---
> ent->client->quad_framenum += timeout;
314c340
< ent->client->quad_framenum = level.framenum + 300;
---
> ent->client->quad_framenum = level.framenum + timeout;
378a405,421
> if (coop->value)
> {
> if (strcmp(ent->classname, "key_power_cube") == 0)
> {
> if (other->client->pers.power_cubes & ((ent->spawnflags & 0x0000ff00)>> 8))
> return false;
> other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
> other->client->pers.power_cubes |= ((ent->spawnflags & 0x0000ff00) >> 8);
> }
> else
> {
> if (other->client->pers.inventory[ITEM_INDEX(ent->item)])
> return false;
> other->client->pers.inventory[ITEM_INDEX(ent->item)] = 1;
> }
> return true;
> }
423,425c466,473
< int count;
<
< if (ent->count)
---
> int oldcount;
> int count;
> qboolean weapon;
>
> weapon = (ent->item->flags & IT_WEAPON);
> if ( (weapon) && ( (int)dmflags->value & DF_INFINITE_AMMO ) )
> count = 1000;
> else if (ent->count)
429a478,479
> oldcount = other->client->pers.inventory[ITEM_INDEX(ent->item)];
>
433c483,489
< if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
---
> if (weapon && !oldcount)
> {
> if (other->client->pers.weapon != ent->item && ( !deathmatch->value || other->client->pers.weapon == FindItem("blaster") ) )
> other->client->newweapon = ent->item;
> }
>
> if (!(ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)) && (deathmatch->value))
636c692
< gi.sound(ent, CHAN_ITEM, gi.soundindex("misc/power1.wav"), 1, ATTN_NORM, 0); //FIXME powering down sound
---
> gi.sound(ent, CHAN_AUTO, gi.soundindex("misc/power2.wav"), 1, ATTN_NORM, 0);
647c703,721
< gi.sound(ent, CHAN_ITEM, gi.soundindex("misc/power2.wav"), 1, ATTN_NORM, 0); //FIXME powering up sound
---
> gi.sound(ent, CHAN_AUTO, gi.soundindex("misc/power1.wav"), 1, ATTN_NORM, 0);
> }
> }
>
> qboolean Pickup_PowerArmor (edict_t *ent, edict_t *other)
> {
> int quantity;
>
> quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
>
> other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
>
> if (deathmatch->value)
> {
> if (!(ent->spawnflags & DROPPED_ITEM) )
> SetRespawn (ent, ent->item->quantity);
> // auto-use for DM only if we didn't already have one
> if (!quantity)
> ent->item->use (other, ent->item);
648a723,724
>
> return true;
650a727,732
> void Drop_PowerArmor (edict_t *ent, gitem_t *item)
> {
> if ((ent->flags & FL_POWER_ARMOR) && (ent->client->pers.inventory[ITEM_INDEX(item)] == 1))
> Use_PowerArmor (ent, item);
> Drop_General (ent, item);
> }
661c743,745
< if (strcmp(other->classname, "player"))
---
> qboolean taken;
>
> if (!other->client)
667,668d750
< if (!ent->item->pickup(ent, other))
< return; // player can't hold it
669a752
> taken = ent->item->pickup(ent, other);
671,672c754,757
< // flash the screen
< other->client->bonus_alpha = 0.25;
---
> if (taken)
> {
> // flash the screen
> other->client->bonus_alpha = 0.25;
674,677c759,762
< // show icon and name on status bar
< other->client->ps.stats[STAT_PICKUP_ICON] = gi.imageindex(ent->item->icon);
< other->client->ps.stats[STAT_PICKUP_STRING] = CS_ITEMS+ITEM_INDEX(ent->item);
< other->client->pickup_msg_time = level.time + 3.0;
---
> // show icon and name on status bar
> other->client->ps.stats[STAT_PICKUP_ICON] = gi.imageindex(ent->item->icon);
> other->client->ps.stats[STAT_PICKUP_STRING] = CS_ITEMS+ITEM_INDEX(ent->item);
> other->client->pickup_msg_time = level.time + 3.0;
679,681c764,766
< // change selected item
< if (ent->item->use)
< other->client->pers.selected_item = other->client->ps.stats[STAT_SELECTED_ITEM] = ITEM_INDEX(ent->item);
---
> // change selected item
> if (ent->item->use)
> other->client->pers.selected_item = other->client->ps.stats[STAT_SELECTED_ITEM] = ITEM_INDEX(ent->item);
683c768,769
< gi.sound(other, CHAN_ITEM, gi.soundindex(ent->item->pickup_sound), 1, ATTN_NORM, 0);
---
> gi.sound(other, CHAN_ITEM, gi.soundindex(ent->item->pickup_sound), 1, ATTN_NORM, 0);
> }
685c771,775
< G_UseTargets (ent, other);
---
> if (!(ent->spawnflags & ITEM_TARGETS_USED))
> {
> G_UseTargets (ent, other);
> ent->spawnflags |= ITEM_TARGETS_USED;
> }
687,690c777,786
< if (ent->flags & FL_RESPAWN)
< ent->flags &= ~FL_RESPAWN;
< else
< G_FreeEdict (ent);
---
> if (!taken)
> return;
>
> if (!((coop->value) && (ent->item->flags & IT_STAY_COOP)) || (ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)))
> {
> if (ent->flags & FL_RESPAWN)
> ent->flags &= ~FL_RESPAWN;
> else
> G_FreeEdict (ent);
> }
767c863
< if (ent->spawnflags & 2) // NO_TOUCH
---
> if (ent->spawnflags & ITEM_NO_TOUCH)
835c931
< if (ent->spawnflags & 2) // NO_TOUCH
---
> if (ent->spawnflags & ITEM_NO_TOUCH)
843c939
< if (ent->spawnflags & 1) // TRIGGER_SPAWN
---
> if (ent->spawnflags & ITEM_TRIGGER_SPAWN)
949c1045
< if (item->pickup == Pickup_Armor)
---
> if (item->pickup == Pickup_Armor || item->pickup == Pickup_PowerArmor)
965c1061,1069
< if (item->pickup == Pickup_Health)
---
> if (item->pickup == Pickup_Health || item->pickup == Pickup_Adrenaline || item->pickup == Pickup_AncientHead)
> {
> G_FreeEdict (ent);
> return;
> }
> }
> if ( (int)dmflags->value & DF_INFINITE_AMMO )
> {
> if ( (item->flags == IT_AMMO) || (strcmp(ent->classname, "weapon_bfg") == 0) )
972a1077,1088
> if (coop->value && (strcmp(ent->classname, "key_power_cube") == 0))
> {
> ent->spawnflags |= (1 << (8 + level.power_cubes));
> level.power_cubes++;
> }
>
> // don't let them drop items that stay in a coop game
> if ((coop->value) && (item->flags & IT_STAY_COOP))
> {
> item->drop = NULL;
> }
>
1087c1203
< Pickup_Powerup,
---
> Pickup_PowerArmor,
1089c1205
< Drop_General,
---
> Drop_PowerArmor,
1109c1225
< Pickup_Powerup,
---
> Pickup_PowerArmor,
1111c1227
< Drop_General,
---
> Drop_PowerArmor,
1149c1265
< IT_WEAPON,
---
> IT_WEAPON|IT_STAY_COOP,
1171c1287
< IT_WEAPON,
---
> IT_WEAPON|IT_STAY_COOP,
1174c1290
< /* precache */ "weapons/v_shotg/flash2/tris.md2 weapons/shotgf1b.wav weapons/shotgr1b.wav"
---
> /* precache */ "weapons/shotgf1b.wav weapons/shotgr1b.wav"
1193c1309
< IT_WEAPON,
---
> IT_WEAPON|IT_STAY_COOP,
1215c1331
< IT_WEAPON,
---
> IT_WEAPON|IT_STAY_COOP,
1237c1353
< IT_WEAPON,
---
> IT_WEAPON|IT_STAY_COOP,
1242a1359,1380
> /*QUAKED ammo_grenades (.3 .3 1) (-16 -16 -16) (16 16 16)
> */
> {
> "ammo_grenades",
> Pickup_Ammo,
> Use_Weapon,
> Drop_Ammo,
> Weapon_Grenade,
> "misc/am_pkup.wav",
> "models/items/ammo/grenades/medium/tris.md2", 0,
> "models/weapons/v_handgr/tris.md2",
> /* icon */ "a_grenades",
> /* pickup */ "Grenades",
> /* width */ 3,
> 5,
> "grenades",
> IT_AMMO|IT_WEAPON,
> NULL,
> AMMO_GRENADES,
> /* precache */ "weapons/hgrent1a.wav weapons/hgrena1b.wav weapons/hgrenc1b.wav weapons/hgrenb1a.wav weapons/hgrenb2a.wav "
> },
>
1259c1397
< IT_WEAPON,
---
> IT_WEAPON|IT_STAY_COOP,
1281c1419
< IT_WEAPON,
---
> IT_WEAPON|IT_STAY_COOP,
1303c1441
< IT_WEAPON,
---
> IT_WEAPON|IT_STAY_COOP,
1325c1463
< IT_WEAPON,
---
> IT_WEAPON|IT_STAY_COOP,
1347c1485
< IT_WEAPON,
---
> IT_WEAPON|IT_STAY_COOP,
1423,1444d1560
< /*QUAKED ammo_grenades (.3 .3 1) (-16 -16 -16) (16 16 16)
< */
< {
< "ammo_grenades",
< Pickup_Ammo,
< Use_Weapon,
< Drop_Ammo,
< Weapon_Grenade,
< "misc/am_pkup.wav",
< "models/items/ammo/grenades/medium/tris.md2", 0,
< "models/weapons/v_handgr/tris.md2",
< /* icon */ "a_grenades",
< /* pickup */ "Grenades",
< /* width */ 3,
< 5,
< "grenades",
< IT_AMMO,
< NULL,
< AMMO_GRENADES,
< /* precache */ "weapons/hgrent1a.wav weapons/hgrena1b.wav weapons/hgrenc1b.wav weapons/hgrenb1a.wav weapons/hgrenb2a.wav "
< },
<
1509c1625
< 0,
---
> IT_POWERUP,
1531c1647
< 0,
---
> IT_POWERUP,
1553c1669
< 0,
---
> IT_POWERUP,
1575c1691
< 0,
---
> IT_STAY_COOP|IT_POWERUP,
1597c1713
< 0,
---
> IT_STAY_COOP|IT_POWERUP,
1713c1829
< 0,
---
> IT_STAY_COOP|IT_KEY,
1736c1852
< 0,
---
> IT_STAY_COOP|IT_KEY,
1759c1875
< 0,
---
> IT_STAY_COOP|IT_KEY,
1782c1898
< 0,
---
> IT_STAY_COOP|IT_KEY,
1805c1921
< 0,
---
> IT_STAY_COOP|IT_KEY,
1828c1944
< 0,
---
> IT_STAY_COOP|IT_KEY,
1851c1967
< 0,
---
> IT_STAY_COOP|IT_KEY,
1874c1990
< 0,
---
> IT_STAY_COOP|IT_KEY,
1897c2013
< 0,
---
> IT_STAY_COOP|IT_KEY,