Annotation of quake2/ctf/g_items.c, revision 1.1.1.1

1.1       root        1: #include "g_local.h"
                      2: 
                      3: 
                      4: qboolean       Pickup_Weapon (edict_t *ent, edict_t *other);
                      5: void           Use_Weapon (edict_t *ent, gitem_t *inv);
                      6: void           Drop_Weapon (edict_t *ent, gitem_t *inv);
                      7: 
                      8: void Weapon_Blaster (edict_t *ent);
                      9: void Weapon_Shotgun (edict_t *ent);
                     10: void Weapon_SuperShotgun (edict_t *ent);
                     11: void Weapon_Machinegun (edict_t *ent);
                     12: void Weapon_Chaingun (edict_t *ent);
                     13: void Weapon_HyperBlaster (edict_t *ent);
                     14: void Weapon_RocketLauncher (edict_t *ent);
                     15: void Weapon_Grenade (edict_t *ent);
                     16: void Weapon_GrenadeLauncher (edict_t *ent);
                     17: void Weapon_Railgun (edict_t *ent);
                     18: void Weapon_BFG (edict_t *ent);
                     19: 
                     20: gitem_armor_t jacketarmor_info = { 25,  50, .30, .00, ARMOR_JACKET};
                     21: gitem_armor_t combatarmor_info = { 50, 100, .60, .30, ARMOR_COMBAT};
                     22: gitem_armor_t bodyarmor_info   = {100, 200, .80, .60, ARMOR_BODY};
                     23: 
                     24: static int     jacket_armor_index;
                     25: static int     combat_armor_index;
                     26: static int     body_armor_index;
                     27: static int     power_screen_index;
                     28: static int     power_shield_index;
                     29: 
                     30: #define HEALTH_IGNORE_MAX      1
                     31: #define HEALTH_TIMED           2
                     32: 
                     33: void Use_Quad (edict_t *ent, gitem_t *item);
                     34: static int     quad_drop_timeout_hack;
                     35: 
                     36: //======================================================================
                     37: 
                     38: /*
                     39: ===============
                     40: GetItemByIndex
                     41: ===============
                     42: */
                     43: gitem_t        *GetItemByIndex (int index)
                     44: {
                     45:        if (index == 0 || index >= game.num_items)
                     46:                return NULL;
                     47: 
                     48:        return &itemlist[index];
                     49: }
                     50: 
                     51: 
                     52: /*
                     53: ===============
                     54: FindItemByClassname
                     55: 
                     56: ===============
                     57: */
                     58: gitem_t        *FindItemByClassname (char *classname)
                     59: {
                     60:        int             i;
                     61:        gitem_t *it;
                     62: 
                     63:        it = itemlist;
                     64:        for (i=0 ; i<game.num_items ; i++, it++)
                     65:        {
                     66:                if (!it->classname)
                     67:                        continue;
                     68:                if (!Q_stricmp(it->classname, classname))
                     69:                        return it;
                     70:        }
                     71: 
                     72:        return NULL;
                     73: }
                     74: 
                     75: /*
                     76: ===============
                     77: FindItem
                     78: 
                     79: ===============
                     80: */
                     81: gitem_t        *FindItem (char *pickup_name)
                     82: {
                     83:        int             i;
                     84:        gitem_t *it;
                     85: 
                     86:        it = itemlist;
                     87:        for (i=0 ; i<game.num_items ; i++, it++)
                     88:        {
                     89:                if (!it->pickup_name)
                     90:                        continue;
                     91:                if (!Q_stricmp(it->pickup_name, pickup_name))
                     92:                        return it;
                     93:        }
                     94: 
                     95:        return NULL;
                     96: }
                     97: 
                     98: //======================================================================
                     99: 
                    100: void DoRespawn (edict_t *ent)
                    101: {
                    102:        if (ent->team)
                    103:        {
                    104:                edict_t *master;
                    105:                int     count;
                    106:                int choice;
                    107: 
                    108:                master = ent->teammaster;
                    109: 
                    110: //ZOID
                    111: //in ctf, when we are weapons stay, only the master of a team of weapons
                    112: //is spawned
                    113:                if (ctf->value &&
                    114:                        ((int)dmflags->value & DF_WEAPONS_STAY) &&
                    115:                        master->item && (master->item->flags & IT_WEAPON))
                    116:                        ent = master;
                    117:                else {
                    118: //ZOID
                    119: 
                    120:                        for (count = 0, ent = master; ent; ent = ent->chain, count++)
                    121:                                ;
                    122: 
                    123:                        choice = rand() % count;
                    124: 
                    125:                        for (count = 0, ent = master; count < choice; ent = ent->chain, count++)
                    126:                                ;
                    127:                }
                    128:        }
                    129: 
                    130:        ent->svflags &= ~SVF_NOCLIENT;
                    131:        ent->solid = SOLID_TRIGGER;
                    132:        gi.linkentity (ent);
                    133: 
                    134:        // send an effect
                    135:        ent->s.event = EV_ITEM_RESPAWN;
                    136: }
                    137: 
                    138: void SetRespawn (edict_t *ent, float delay)
                    139: {
                    140:        ent->flags |= FL_RESPAWN;
                    141:        ent->svflags |= SVF_NOCLIENT;
                    142:        ent->solid = SOLID_NOT;
                    143:        ent->nextthink = level.time + delay;
                    144:        ent->think = DoRespawn;
                    145:        gi.linkentity (ent);
                    146: }
                    147: 
                    148: 
                    149: //======================================================================
                    150: 
                    151: qboolean Pickup_Powerup (edict_t *ent, edict_t *other)
                    152: {
                    153:        int             quantity;
                    154: 
                    155:        quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
                    156:        if ((skill->value == 1 && quantity >= 2) || (skill->value >= 2 && quantity >= 1))
                    157:                return false;
                    158: 
                    159:        if ((coop->value) && (ent->item->flags & IT_STAY_COOP) && (quantity > 0))
                    160:                return false;
                    161: 
                    162:        other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
                    163: 
                    164:        if (deathmatch->value)
                    165:        {
                    166:                if (!(ent->spawnflags & DROPPED_ITEM) )
                    167:                        SetRespawn (ent, ent->item->quantity);
                    168:                if (((int)dmflags->value & DF_INSTANT_ITEMS) || ((ent->item->use == Use_Quad) && (ent->spawnflags & DROPPED_PLAYER_ITEM)))
                    169:                {
                    170:                        if ((ent->item->use == Use_Quad) && (ent->spawnflags & DROPPED_PLAYER_ITEM))
                    171:                                quad_drop_timeout_hack = (ent->nextthink - level.time) / FRAMETIME;
                    172:                        ent->item->use (other, ent->item);
                    173:                }
                    174:        }
                    175: 
                    176:        return true;
                    177: }
                    178: 
                    179: void Drop_General (edict_t *ent, gitem_t *item)
                    180: {
                    181:        Drop_Item (ent, item);
                    182:        ent->client->pers.inventory[ITEM_INDEX(item)]--;
                    183:        ValidateSelectedItem (ent);
                    184: }
                    185: 
                    186: 
                    187: //======================================================================
                    188: 
                    189: qboolean Pickup_Adrenaline (edict_t *ent, edict_t *other)
                    190: {
                    191:        if (!deathmatch->value)
                    192:                other->max_health += 1;
                    193: 
                    194:        if (other->health < other->max_health)
                    195:                other->health = other->max_health;
                    196: 
                    197:        if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
                    198:                SetRespawn (ent, ent->item->quantity);
                    199: 
                    200:        return true;
                    201: }
                    202: 
                    203: qboolean Pickup_AncientHead (edict_t *ent, edict_t *other)
                    204: {
                    205:        other->max_health += 2;
                    206: 
                    207:        if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
                    208:                SetRespawn (ent, ent->item->quantity);
                    209: 
                    210:        return true;
                    211: }
                    212: 
                    213: qboolean Pickup_Bandolier (edict_t *ent, edict_t *other)
                    214: {
                    215:        gitem_t *item;
                    216:        int             index;
                    217: 
                    218:        if (other->client->pers.max_bullets < 250)
                    219:                other->client->pers.max_bullets = 250;
                    220:        if (other->client->pers.max_shells < 150)
                    221:                other->client->pers.max_shells = 150;
                    222:        if (other->client->pers.max_cells < 250)
                    223:                other->client->pers.max_cells = 250;
                    224:        if (other->client->pers.max_slugs < 75)
                    225:                other->client->pers.max_slugs = 75;
                    226: 
                    227:        item = FindItem("Bullets");
                    228:        if (item)
                    229:        {
                    230:                index = ITEM_INDEX(item);
                    231:                other->client->pers.inventory[index] += item->quantity;
                    232:                if (other->client->pers.inventory[index] > other->client->pers.max_bullets)
                    233:                        other->client->pers.inventory[index] = other->client->pers.max_bullets;
                    234:        }
                    235: 
                    236:        item = FindItem("Shells");
                    237:        if (item)
                    238:        {
                    239:                index = ITEM_INDEX(item);
                    240:                other->client->pers.inventory[index] += item->quantity;
                    241:                if (other->client->pers.inventory[index] > other->client->pers.max_shells)
                    242:                        other->client->pers.inventory[index] = other->client->pers.max_shells;
                    243:        }
                    244: 
                    245:        if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
                    246:                SetRespawn (ent, ent->item->quantity);
                    247: 
                    248:        return true;
                    249: }
                    250: 
                    251: qboolean Pickup_Pack (edict_t *ent, edict_t *other)
                    252: {
                    253:        gitem_t *item;
                    254:        int             index;
                    255: 
                    256:        if (other->client->pers.max_bullets < 300)
                    257:                other->client->pers.max_bullets = 300;
                    258:        if (other->client->pers.max_shells < 200)
                    259:                other->client->pers.max_shells = 200;
                    260:        if (other->client->pers.max_rockets < 100)
                    261:                other->client->pers.max_rockets = 100;
                    262:        if (other->client->pers.max_grenades < 100)
                    263:                other->client->pers.max_grenades = 100;
                    264:        if (other->client->pers.max_cells < 300)
                    265:                other->client->pers.max_cells = 300;
                    266:        if (other->client->pers.max_slugs < 100)
                    267:                other->client->pers.max_slugs = 100;
                    268: 
                    269:        item = FindItem("Bullets");
                    270:        if (item)
                    271:        {
                    272:                index = ITEM_INDEX(item);
                    273:                other->client->pers.inventory[index] += item->quantity;
                    274:                if (other->client->pers.inventory[index] > other->client->pers.max_bullets)
                    275:                        other->client->pers.inventory[index] = other->client->pers.max_bullets;
                    276:        }
                    277: 
                    278:        item = FindItem("Shells");
                    279:        if (item)
                    280:        {
                    281:                index = ITEM_INDEX(item);
                    282:                other->client->pers.inventory[index] += item->quantity;
                    283:                if (other->client->pers.inventory[index] > other->client->pers.max_shells)
                    284:                        other->client->pers.inventory[index] = other->client->pers.max_shells;
                    285:        }
                    286: 
                    287:        item = FindItem("Cells");
                    288:        if (item)
                    289:        {
                    290:                index = ITEM_INDEX(item);
                    291:                other->client->pers.inventory[index] += item->quantity;
                    292:                if (other->client->pers.inventory[index] > other->client->pers.max_cells)
                    293:                        other->client->pers.inventory[index] = other->client->pers.max_cells;
                    294:        }
                    295: 
                    296:        item = FindItem("Grenades");
                    297:        if (item)
                    298:        {
                    299:                index = ITEM_INDEX(item);
                    300:                other->client->pers.inventory[index] += item->quantity;
                    301:                if (other->client->pers.inventory[index] > other->client->pers.max_grenades)
                    302:                        other->client->pers.inventory[index] = other->client->pers.max_grenades;
                    303:        }
                    304: 
                    305:        item = FindItem("Rockets");
                    306:        if (item)
                    307:        {
                    308:                index = ITEM_INDEX(item);
                    309:                other->client->pers.inventory[index] += item->quantity;
                    310:                if (other->client->pers.inventory[index] > other->client->pers.max_rockets)
                    311:                        other->client->pers.inventory[index] = other->client->pers.max_rockets;
                    312:        }
                    313: 
                    314:        item = FindItem("Slugs");
                    315:        if (item)
                    316:        {
                    317:                index = ITEM_INDEX(item);
                    318:                other->client->pers.inventory[index] += item->quantity;
                    319:                if (other->client->pers.inventory[index] > other->client->pers.max_slugs)
                    320:                        other->client->pers.inventory[index] = other->client->pers.max_slugs;
                    321:        }
                    322: 
                    323:        if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
                    324:                SetRespawn (ent, ent->item->quantity);
                    325: 
                    326:        return true;
                    327: }
                    328: 
                    329: //======================================================================
                    330: 
                    331: void Use_Quad (edict_t *ent, gitem_t *item)
                    332: {
                    333:        int             timeout;
                    334: 
                    335:        ent->client->pers.inventory[ITEM_INDEX(item)]--;
                    336:        ValidateSelectedItem (ent);
                    337: 
                    338:        if (quad_drop_timeout_hack)
                    339:        {
                    340:                timeout = quad_drop_timeout_hack;
                    341:                quad_drop_timeout_hack = 0;
                    342:        }
                    343:        else
                    344:        {
                    345:                timeout = 300;
                    346:        }
                    347: 
                    348:        if (ent->client->quad_framenum > level.framenum)
                    349:                ent->client->quad_framenum += timeout;
                    350:        else
                    351:                ent->client->quad_framenum = level.framenum + timeout;
                    352: 
                    353:        gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
                    354: }
                    355: 
                    356: //======================================================================
                    357: 
                    358: void Use_Breather (edict_t *ent, gitem_t *item)
                    359: {
                    360:        ent->client->pers.inventory[ITEM_INDEX(item)]--;
                    361:        ValidateSelectedItem (ent);
                    362: 
                    363:        if (ent->client->breather_framenum > level.framenum)
                    364:                ent->client->breather_framenum += 300;
                    365:        else
                    366:                ent->client->breather_framenum = level.framenum + 300;
                    367: 
                    368: //     gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
                    369: }
                    370: 
                    371: //======================================================================
                    372: 
                    373: void Use_Envirosuit (edict_t *ent, gitem_t *item)
                    374: {
                    375:        ent->client->pers.inventory[ITEM_INDEX(item)]--;
                    376:        ValidateSelectedItem (ent);
                    377: 
                    378:        if (ent->client->enviro_framenum > level.framenum)
                    379:                ent->client->enviro_framenum += 300;
                    380:        else
                    381:                ent->client->enviro_framenum = level.framenum + 300;
                    382: 
                    383: //     gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
                    384: }
                    385: 
                    386: //======================================================================
                    387: 
                    388: void   Use_Invulnerability (edict_t *ent, gitem_t *item)
                    389: {
                    390:        ent->client->pers.inventory[ITEM_INDEX(item)]--;
                    391:        ValidateSelectedItem (ent);
                    392: 
                    393:        if (ent->client->invincible_framenum > level.framenum)
                    394:                ent->client->invincible_framenum += 300;
                    395:        else
                    396:                ent->client->invincible_framenum = level.framenum + 300;
                    397: 
                    398:        gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect.wav"), 1, ATTN_NORM, 0);
                    399: }
                    400: 
                    401: //======================================================================
                    402: 
                    403: void   Use_Silencer (edict_t *ent, gitem_t *item)
                    404: {
                    405:        ent->client->pers.inventory[ITEM_INDEX(item)]--;
                    406:        ValidateSelectedItem (ent);
                    407:        ent->client->silencer_shots += 30;
                    408: 
                    409: //     gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
                    410: }
                    411: 
                    412: //======================================================================
                    413: 
                    414: qboolean Pickup_Key (edict_t *ent, edict_t *other)
                    415: {
                    416:        if (coop->value)
                    417:        {
                    418:                if (strcmp(ent->classname, "key_power_cube") == 0)
                    419:                {
                    420:                        if (other->client->pers.power_cubes & ((ent->spawnflags & 0x0000ff00)>> 8))
                    421:                                return false;
                    422:                        other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
                    423:                        other->client->pers.power_cubes |= ((ent->spawnflags & 0x0000ff00) >> 8);
                    424:                }
                    425:                else
                    426:                {
                    427:                        if (other->client->pers.inventory[ITEM_INDEX(ent->item)])
                    428:                                return false;
                    429:                        other->client->pers.inventory[ITEM_INDEX(ent->item)] = 1;
                    430:                }
                    431:                return true;
                    432:        }
                    433:        other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
                    434:        return true;
                    435: }
                    436: 
                    437: //======================================================================
                    438: 
                    439: qboolean Add_Ammo (edict_t *ent, gitem_t *item, int count)
                    440: {
                    441:        int                     index;
                    442:        int                     max;
                    443: 
                    444:        if (!ent->client)
                    445:                return false;
                    446: 
                    447:        if (item->tag == AMMO_BULLETS)
                    448:                max = ent->client->pers.max_bullets;
                    449:        else if (item->tag == AMMO_SHELLS)
                    450:                max = ent->client->pers.max_shells;
                    451:        else if (item->tag == AMMO_ROCKETS)
                    452:                max = ent->client->pers.max_rockets;
                    453:        else if (item->tag == AMMO_GRENADES)
                    454:                max = ent->client->pers.max_grenades;
                    455:        else if (item->tag == AMMO_CELLS)
                    456:                max = ent->client->pers.max_cells;
                    457:        else if (item->tag == AMMO_SLUGS)
                    458:                max = ent->client->pers.max_slugs;
                    459:        else
                    460:                return false;
                    461: 
                    462:        index = ITEM_INDEX(item);
                    463: 
                    464:        if (ent->client->pers.inventory[index] == max)
                    465:                return false;
                    466: 
                    467:        ent->client->pers.inventory[index] += count;
                    468: 
                    469:        if (ent->client->pers.inventory[index] > max)
                    470:                ent->client->pers.inventory[index] = max;
                    471: 
                    472:        return true;
                    473: }
                    474: 
                    475: qboolean Pickup_Ammo (edict_t *ent, edict_t *other)
                    476: {
                    477:        int                     oldcount;
                    478:        int                     count;
                    479:        qboolean        weapon;
                    480: 
                    481:        weapon = (ent->item->flags & IT_WEAPON);
                    482:        if ( (weapon) && ( (int)dmflags->value & DF_INFINITE_AMMO ) )
                    483:                count = 1000;
                    484:        else if (ent->count)
                    485:                count = ent->count;
                    486:        else
                    487:                count = ent->item->quantity;
                    488: 
                    489:        oldcount = other->client->pers.inventory[ITEM_INDEX(ent->item)];
                    490: 
                    491:        if (!Add_Ammo (other, ent->item, count))
                    492:                return false;
                    493: 
                    494:        if (weapon && !oldcount)
                    495:        {
                    496:                if (other->client->pers.weapon != ent->item && ( !deathmatch->value || other->client->pers.weapon == FindItem("blaster") ) )
                    497:                        other->client->newweapon = ent->item;
                    498:        }
                    499: 
                    500:        if (!(ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)) && (deathmatch->value))
                    501:                SetRespawn (ent, 30);
                    502:        return true;
                    503: }
                    504: 
                    505: void Drop_Ammo (edict_t *ent, gitem_t *item)
                    506: {
                    507:        edict_t *dropped;
                    508:        int             index;
                    509: 
                    510:        index = ITEM_INDEX(item);
                    511:        dropped = Drop_Item (ent, item);
                    512:        if (ent->client->pers.inventory[index] >= item->quantity)
                    513:                dropped->count = item->quantity;
                    514:        else
                    515:                dropped->count = ent->client->pers.inventory[index];
                    516:        ent->client->pers.inventory[index] -= dropped->count;
                    517:        ValidateSelectedItem (ent);
                    518: }
                    519: 
                    520: 
                    521: //======================================================================
                    522: 
                    523: void MegaHealth_think (edict_t *self)
                    524: {
                    525:        if (self->owner->health > self->owner->max_health
                    526: //ZOID
                    527:                && !CTFHasRegeneration(self->owner)
                    528: //ZOID
                    529:                )
                    530:        {
                    531:                self->nextthink = level.time + 1;
                    532:                self->owner->health -= 1;
                    533:                return;
                    534:        }
                    535: 
                    536:        if (!(self->spawnflags & DROPPED_ITEM) && (deathmatch->value))
                    537:                SetRespawn (self, 20);
                    538:        else
                    539:                G_FreeEdict (self);
                    540: }
                    541: 
                    542: qboolean Pickup_Health (edict_t *ent, edict_t *other)
                    543: {
                    544:        if (!(ent->style & HEALTH_IGNORE_MAX))
                    545:                if (other->health >= other->max_health)
                    546:                        return false;
                    547: 
                    548: //ZOID
                    549:        if (other->health >= 250 && ent->count > 25)
                    550:                return false;
                    551: //ZOID
                    552: 
                    553:        other->health += ent->count;
                    554: 
                    555: //ZOID
                    556:        if (other->health > 250 && ent->count > 25)
                    557:                other->health = 250;
                    558: //ZOID
                    559: 
                    560:        if (!(ent->style & HEALTH_IGNORE_MAX))
                    561:        {
                    562:                if (other->health > other->max_health)
                    563:                        other->health = other->max_health;
                    564:        }
                    565: 
                    566: //ZOID
                    567:        if ((ent->style & HEALTH_TIMED)
                    568:                && !CTFHasRegeneration(other)
                    569: //ZOID
                    570:        )
                    571:        {
                    572:                ent->think = MegaHealth_think;
                    573:                ent->nextthink = level.time + 5;
                    574:                ent->owner = other;
                    575:                ent->flags |= FL_RESPAWN;
                    576:                ent->svflags |= SVF_NOCLIENT;
                    577:                ent->solid = SOLID_NOT;
                    578:        }
                    579:        else
                    580:        {
                    581:                if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
                    582:                        SetRespawn (ent, 30);
                    583:        }
                    584: 
                    585:        return true;
                    586: }
                    587: 
                    588: //======================================================================
                    589: 
                    590: int ArmorIndex (edict_t *ent)
                    591: {
                    592:        if (!ent->client)
                    593:                return 0;
                    594: 
                    595:        if (ent->client->pers.inventory[jacket_armor_index] > 0)
                    596:                return jacket_armor_index;
                    597: 
                    598:        if (ent->client->pers.inventory[combat_armor_index] > 0)
                    599:                return combat_armor_index;
                    600: 
                    601:        if (ent->client->pers.inventory[body_armor_index] > 0)
                    602:                return body_armor_index;
                    603: 
                    604:        return 0;
                    605: }
                    606: 
                    607: qboolean Pickup_Armor (edict_t *ent, edict_t *other)
                    608: {
                    609:        int                             old_armor_index;
                    610:        gitem_armor_t   *oldinfo;
                    611:        gitem_armor_t   *newinfo;
                    612:        int                             newcount;
                    613:        float                   salvage;
                    614:        int                             salvagecount;
                    615: 
                    616:        // get info on new armor
                    617:        newinfo = (gitem_armor_t *)ent->item->info;
                    618: 
                    619:        old_armor_index = ArmorIndex (other);
                    620: 
                    621:        // handle armor shards specially
                    622:        if (ent->item->tag == ARMOR_SHARD)
                    623:        {
                    624:                if (!old_armor_index)
                    625:                        other->client->pers.inventory[jacket_armor_index] = 2;
                    626:                else
                    627:                        other->client->pers.inventory[old_armor_index] += 2;
                    628:        }
                    629: 
                    630:        // if player has no armor, just use it
                    631:        else if (!old_armor_index)
                    632:        {
                    633:                other->client->pers.inventory[ITEM_INDEX(ent->item)] = newinfo->base_count;
                    634:        }
                    635: 
                    636:        // use the better armor
                    637:        else
                    638:        {
                    639:                // get info on old armor
                    640:                if (old_armor_index == jacket_armor_index)
                    641:                        oldinfo = &jacketarmor_info;
                    642:                else if (old_armor_index == combat_armor_index)
                    643:                        oldinfo = &combatarmor_info;
                    644:                else // (old_armor_index == body_armor_index)
                    645:                        oldinfo = &bodyarmor_info;
                    646: 
                    647:                if (newinfo->normal_protection > oldinfo->normal_protection)
                    648:                {
                    649:                        // calc new armor values
                    650:                        salvage = oldinfo->normal_protection / newinfo->normal_protection;
                    651:                        salvagecount = salvage * other->client->pers.inventory[old_armor_index];
                    652:                        newcount = newinfo->base_count + salvagecount;
                    653:                        if (newcount > newinfo->max_count)
                    654:                                newcount = newinfo->max_count;
                    655: 
                    656:                        // zero count of old armor so it goes away
                    657:                        other->client->pers.inventory[old_armor_index] = 0;
                    658: 
                    659:                        // change armor to new item with computed value
                    660:                        other->client->pers.inventory[ITEM_INDEX(ent->item)] = newcount;
                    661:                }
                    662:                else
                    663:                {
                    664:                        // calc new armor values
                    665:                        salvage = newinfo->normal_protection / oldinfo->normal_protection;
                    666:                        salvagecount = salvage * newinfo->base_count;
                    667:                        newcount = other->client->pers.inventory[old_armor_index] + salvagecount;
                    668:                        if (newcount > oldinfo->max_count)
                    669:                                newcount = oldinfo->max_count;
                    670: 
                    671:                        // if we're already maxed out then we don't need the new armor
                    672:                        if (other->client->pers.inventory[old_armor_index] >= newcount)
                    673:                                return false;
                    674: 
                    675:                        // update current armor value
                    676:                        other->client->pers.inventory[old_armor_index] = newcount;
                    677:                }
                    678:        }
                    679: 
                    680:        if (!(ent->spawnflags & DROPPED_ITEM) && (deathmatch->value))
                    681:                SetRespawn (ent, 20);
                    682: 
                    683:        return true;
                    684: }
                    685: 
                    686: //======================================================================
                    687: 
                    688: int PowerArmorType (edict_t *ent)
                    689: {
                    690:        if (!ent->client)
                    691:                return POWER_ARMOR_NONE;
                    692: 
                    693:        if (!(ent->flags & FL_POWER_ARMOR))
                    694:                return POWER_ARMOR_NONE;
                    695: 
                    696:        if (ent->client->pers.inventory[power_shield_index] > 0)
                    697:                return POWER_ARMOR_SHIELD;
                    698: 
                    699:        if (ent->client->pers.inventory[power_screen_index] > 0)
                    700:                return POWER_ARMOR_SCREEN;
                    701: 
                    702:        return POWER_ARMOR_NONE;
                    703: }
                    704: 
                    705: void Use_PowerArmor (edict_t *ent, gitem_t *item)
                    706: {
                    707:        int             index;
                    708: 
                    709:        if (ent->flags & FL_POWER_ARMOR)
                    710:        {
                    711:                ent->flags &= ~FL_POWER_ARMOR;
                    712:                gi.sound(ent, CHAN_AUTO, gi.soundindex("misc/power2.wav"), 1, ATTN_NORM, 0);
                    713:        }
                    714:        else
                    715:        {
                    716:                index = ITEM_INDEX(FindItem("cells"));
                    717:                if (!ent->client->pers.inventory[index])
                    718:                {
                    719:                        gi.cprintf (ent, PRINT_HIGH, "No cells for power armor.\n");
                    720:                        return;
                    721:                }
                    722:                ent->flags |= FL_POWER_ARMOR;
                    723:                gi.sound(ent, CHAN_AUTO, gi.soundindex("misc/power1.wav"), 1, ATTN_NORM, 0);
                    724:        }
                    725: }
                    726: 
                    727: qboolean Pickup_PowerArmor (edict_t *ent, edict_t *other)
                    728: {
                    729:        int             quantity;
                    730: 
                    731:        quantity = other->client->pers.inventory[ITEM_INDEX(ent->item)];
                    732: 
                    733:        other->client->pers.inventory[ITEM_INDEX(ent->item)]++;
                    734: 
                    735:        if (deathmatch->value)
                    736:        {
                    737:                if (!(ent->spawnflags & DROPPED_ITEM) )
                    738:                        SetRespawn (ent, ent->item->quantity);
                    739:                // auto-use for DM only if we didn't already have one
                    740:                if (!quantity)
                    741:                        ent->item->use (other, ent->item);
                    742:        }
                    743: 
                    744:        return true;
                    745: }
                    746: 
                    747: void Drop_PowerArmor (edict_t *ent, gitem_t *item)
                    748: {
                    749:        if ((ent->flags & FL_POWER_ARMOR) && (ent->client->pers.inventory[ITEM_INDEX(item)] == 1))
                    750:                Use_PowerArmor (ent, item);
                    751:        Drop_General (ent, item);
                    752: }
                    753: 
                    754: //======================================================================
                    755: 
                    756: /*
                    757: ===============
                    758: Touch_Item
                    759: ===============
                    760: */
                    761: void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
                    762: {
                    763:        qboolean        taken;
                    764: 
                    765:        if (!other->client)
                    766:                return;
                    767:        if (other->health < 1)
                    768:                return;         // dead people can't pickup
                    769:        if (!ent->item->pickup)
                    770:                return;         // not a grabbable item?
                    771: 
                    772:        if (CTFMatchSetup())
                    773:                return; // can't pick stuff up right now
                    774: 
                    775:        taken = ent->item->pickup(ent, other);
                    776: 
                    777:        if (taken)
                    778:        {
                    779:                // flash the screen
                    780:                other->client->bonus_alpha = 0.25;      
                    781: 
                    782:                // show icon and name on status bar
                    783:                other->client->ps.stats[STAT_PICKUP_ICON] = gi.imageindex(ent->item->icon);
                    784:                other->client->ps.stats[STAT_PICKUP_STRING] = CS_ITEMS+ITEM_INDEX(ent->item);
                    785:                other->client->pickup_msg_time = level.time + 3.0;
                    786: 
                    787:                // change selected item
                    788:                if (ent->item->use)
                    789:                        other->client->pers.selected_item = other->client->ps.stats[STAT_SELECTED_ITEM] = ITEM_INDEX(ent->item);
                    790: 
                    791:                if (ent->item->pickup == Pickup_Health)
                    792:                {
                    793:                        if (ent->count == 2)
                    794:                                gi.sound(other, CHAN_ITEM, gi.soundindex("items/s_health.wav"), 1, ATTN_NORM, 0);
                    795:                        else if (ent->count == 10)
                    796:                                gi.sound(other, CHAN_ITEM, gi.soundindex("items/n_health.wav"), 1, ATTN_NORM, 0);
                    797:                        else if (ent->count == 25)
                    798:                                gi.sound(other, CHAN_ITEM, gi.soundindex("items/l_health.wav"), 1, ATTN_NORM, 0);
                    799:                        else // (ent->count == 100)
                    800:                                gi.sound(other, CHAN_ITEM, gi.soundindex("items/m_health.wav"), 1, ATTN_NORM, 0);
                    801:                }
                    802:                else if (ent->item->pickup_sound)
                    803:                {
                    804:                        gi.sound(other, CHAN_ITEM, gi.soundindex(ent->item->pickup_sound), 1, ATTN_NORM, 0);
                    805:                }
                    806:        }
                    807: 
                    808:        if (!(ent->spawnflags & ITEM_TARGETS_USED))
                    809:        {
                    810:                G_UseTargets (ent, other);
                    811:                ent->spawnflags |= ITEM_TARGETS_USED;
                    812:        }
                    813: 
                    814:        if (!taken)
                    815:                return;
                    816: 
                    817:        if (!((coop->value) &&  (ent->item->flags & IT_STAY_COOP)) || (ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)))
                    818:        {
                    819:                if (ent->flags & FL_RESPAWN)
                    820:                        ent->flags &= ~FL_RESPAWN;
                    821:                else
                    822:                        G_FreeEdict (ent);
                    823:        }
                    824: }
                    825: 
                    826: //======================================================================
                    827: 
                    828: static void drop_temp_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
                    829: {
                    830:        if (other == ent->owner)
                    831:                return;
                    832: 
                    833:        Touch_Item (ent, other, plane, surf);
                    834: }
                    835: 
                    836: static void drop_make_touchable (edict_t *ent)
                    837: {
                    838:        ent->touch = Touch_Item;
                    839:        if (deathmatch->value)
                    840:        {
                    841:                ent->nextthink = level.time + 29;
                    842:                ent->think = G_FreeEdict;
                    843:        }
                    844: }
                    845: 
                    846: edict_t *Drop_Item (edict_t *ent, gitem_t *item)
                    847: {
                    848:        edict_t *dropped;
                    849:        vec3_t  forward, right;
                    850:        vec3_t  offset;
                    851: 
                    852:        dropped = G_Spawn();
                    853: 
                    854:        dropped->classname = item->classname;
                    855:        dropped->item = item;
                    856:        dropped->spawnflags = DROPPED_ITEM;
                    857:        dropped->s.effects = item->world_model_flags;
                    858:        dropped->s.renderfx = RF_GLOW;
                    859:        VectorSet (dropped->mins, -15, -15, -15);
                    860:        VectorSet (dropped->maxs, 15, 15, 15);
                    861:        gi.setmodel (dropped, dropped->item->world_model);
                    862:        dropped->solid = SOLID_TRIGGER;
                    863:        dropped->movetype = MOVETYPE_TOSS;  
                    864:        dropped->touch = drop_temp_touch;
                    865:        dropped->owner = ent;
                    866: 
                    867:        if (ent->client)
                    868:        {
                    869:                trace_t trace;
                    870: 
                    871:                AngleVectors (ent->client->v_angle, forward, right, NULL);
                    872:                VectorSet(offset, 24, 0, -16);
                    873:                G_ProjectSource (ent->s.origin, offset, forward, right, dropped->s.origin);
                    874:                trace = gi.trace (ent->s.origin, dropped->mins, dropped->maxs,
                    875:                        dropped->s.origin, ent, CONTENTS_SOLID);
                    876:                VectorCopy (trace.endpos, dropped->s.origin);
                    877:        }
                    878:        else
                    879:        {
                    880:                AngleVectors (ent->s.angles, forward, right, NULL);
                    881:                VectorCopy (ent->s.origin, dropped->s.origin);
                    882:        }
                    883: 
                    884:        VectorScale (forward, 100, dropped->velocity);
                    885:        dropped->velocity[2] = 300;
                    886: 
                    887:        dropped->think = drop_make_touchable;
                    888:        dropped->nextthink = level.time + 1;
                    889: 
                    890:        gi.linkentity (dropped);
                    891: 
                    892:        return dropped;
                    893: }
                    894: 
                    895: void Use_Item (edict_t *ent, edict_t *other, edict_t *activator)
                    896: {
                    897:        ent->svflags &= ~SVF_NOCLIENT;
                    898:        ent->use = NULL;
                    899: 
                    900:        if (ent->spawnflags & ITEM_NO_TOUCH)
                    901:        {
                    902:                ent->solid = SOLID_BBOX;
                    903:                ent->touch = NULL;
                    904:        }
                    905:        else
                    906:        {
                    907:                ent->solid = SOLID_TRIGGER;
                    908:                ent->touch = Touch_Item;
                    909:        }
                    910: 
                    911:        gi.linkentity (ent);
                    912: }
                    913: 
                    914: //======================================================================
                    915: 
                    916: /*
                    917: ================
                    918: droptofloor
                    919: ================
                    920: */
                    921: void droptofloor (edict_t *ent)
                    922: {
                    923:        trace_t         tr;
                    924:        vec3_t          dest;
                    925:        float           *v;
                    926: 
                    927:        v = tv(-15,-15,-15);
                    928:        VectorCopy (v, ent->mins);
                    929:        v = tv(15,15,15);
                    930:        VectorCopy (v, ent->maxs);
                    931: 
                    932:        if (ent->model)
                    933:                gi.setmodel (ent, ent->model);
                    934:        else
                    935:                gi.setmodel (ent, ent->item->world_model);
                    936:        ent->solid = SOLID_TRIGGER;
                    937:        ent->movetype = MOVETYPE_TOSS;  
                    938:        ent->touch = Touch_Item;
                    939: 
                    940:        v = tv(0,0,-128);
                    941:        VectorAdd (ent->s.origin, v, dest);
                    942: 
                    943:        tr = gi.trace (ent->s.origin, ent->mins, ent->maxs, dest, ent, MASK_SOLID);
                    944:        if (tr.startsolid)
                    945:        {
                    946:                gi.dprintf ("droptofloor: %s startsolid at %s\n", ent->classname, vtos(ent->s.origin));
                    947:                G_FreeEdict (ent);
                    948:                return;
                    949:        }
                    950: 
                    951:        VectorCopy (tr.endpos, ent->s.origin);
                    952: 
                    953:        if (ent->team)
                    954:        {
                    955:                ent->flags &= ~FL_TEAMSLAVE;
                    956:                ent->chain = ent->teamchain;
                    957:                ent->teamchain = NULL;
                    958: 
                    959:                ent->svflags |= SVF_NOCLIENT;
                    960:                ent->solid = SOLID_NOT;
                    961:                if (ent == ent->teammaster)
                    962:                {
                    963:                        ent->nextthink = level.time + FRAMETIME;
                    964:                        ent->think = DoRespawn;
                    965:                }
                    966:        }
                    967: 
                    968:        if (ent->spawnflags & ITEM_NO_TOUCH)
                    969:        {
                    970:                ent->solid = SOLID_BBOX;
                    971:                ent->touch = NULL;
                    972:                ent->s.effects &= ~EF_ROTATE;
                    973:                ent->s.renderfx &= ~RF_GLOW;
                    974:        }
                    975: 
                    976:        if (ent->spawnflags & ITEM_TRIGGER_SPAWN)
                    977:        {
                    978:                ent->svflags |= SVF_NOCLIENT;
                    979:                ent->solid = SOLID_NOT;
                    980:                ent->use = Use_Item;
                    981:        }
                    982: 
                    983:        gi.linkentity (ent);
                    984: }
                    985: 
                    986: 
                    987: /*
                    988: ===============
                    989: PrecacheItem
                    990: 
                    991: Precaches all data needed for a given item.
                    992: This will be called for each item spawned in a level,
                    993: and for each item in each client's inventory.
                    994: ===============
                    995: */
                    996: void PrecacheItem (gitem_t *it)
                    997: {
                    998:        char    *s, *start;
                    999:        char    data[MAX_QPATH];
                   1000:        int             len;
                   1001:        gitem_t *ammo;
                   1002: 
                   1003:        if (!it)
                   1004:                return;
                   1005: 
                   1006:        if (it->pickup_sound)
                   1007:                gi.soundindex (it->pickup_sound);
                   1008:        if (it->world_model)
                   1009:                gi.modelindex (it->world_model);
                   1010:        if (it->view_model)
                   1011:                gi.modelindex (it->view_model);
                   1012:        if (it->icon)
                   1013:                gi.imageindex (it->icon);
                   1014: 
                   1015:        // parse everything for its ammo
                   1016:        if (it->ammo && it->ammo[0])
                   1017:        {
                   1018:                ammo = FindItem (it->ammo);
                   1019:                if (ammo != it)
                   1020:                        PrecacheItem (ammo);
                   1021:        }
                   1022: 
                   1023:        // parse the space seperated precache string for other items
                   1024:        s = it->precaches;
                   1025:        if (!s || !s[0])
                   1026:                return;
                   1027: 
                   1028:        while (*s)
                   1029:        {
                   1030:                start = s;
                   1031:                while (*s && *s != ' ')
                   1032:                        s++;
                   1033: 
                   1034:                len = s-start;
                   1035:                if (len >= MAX_QPATH || len < 5)
                   1036:                        gi.error ("PrecacheItem: %s has bad precache string", it->classname);
                   1037:                memcpy (data, start, len);
                   1038:                data[len] = 0;
                   1039:                if (*s)
                   1040:                        s++;
                   1041: 
                   1042:                // determine type based on extension
                   1043:                if (!strcmp(data+len-3, "md2"))
                   1044:                        gi.modelindex (data);
                   1045:                else if (!strcmp(data+len-3, "sp2"))
                   1046:                        gi.modelindex (data);
                   1047:                else if (!strcmp(data+len-3, "wav"))
                   1048:                        gi.soundindex (data);
                   1049:                if (!strcmp(data+len-3, "pcx"))
                   1050:                        gi.imageindex (data);
                   1051:        }
                   1052: }
                   1053: 
                   1054: /*
                   1055: ============
                   1056: SpawnItem
                   1057: 
                   1058: Sets the clipping size and plants the object on the floor.
                   1059: 
                   1060: Items can't be immediately dropped to floor, because they might
                   1061: be on an entity that hasn't spawned yet.
                   1062: ============
                   1063: */
                   1064: void SpawnItem (edict_t *ent, gitem_t *item)
                   1065: {
                   1066:        PrecacheItem (item);
                   1067: 
                   1068:        if (ent->spawnflags)
                   1069:        {
                   1070:                if (strcmp(ent->classname, "key_power_cube") != 0)
                   1071:                {
                   1072:                        ent->spawnflags = 0;
                   1073:                        gi.dprintf("%s at %s has invalid spawnflags set\n", ent->classname, vtos(ent->s.origin));
                   1074:                }
                   1075:        }
                   1076: 
                   1077:        // some items will be prevented in deathmatch
                   1078:        if (deathmatch->value)
                   1079:        {
                   1080:                if ( (int)dmflags->value & DF_NO_ARMOR )
                   1081:                {
                   1082:                        if (item->pickup == Pickup_Armor || item->pickup == Pickup_PowerArmor)
                   1083:                        {
                   1084:                                G_FreeEdict (ent);
                   1085:                                return;
                   1086:                        }
                   1087:                }
                   1088:                if ( (int)dmflags->value & DF_NO_ITEMS )
                   1089:                {
                   1090:                        if (item->pickup == Pickup_Powerup)
                   1091:                        {
                   1092:                                G_FreeEdict (ent);
                   1093:                                return;
                   1094:                        }
                   1095:                }
                   1096:                if ( (int)dmflags->value & DF_NO_HEALTH )
                   1097:                {
                   1098:                        if (item->pickup == Pickup_Health || item->pickup == Pickup_Adrenaline || item->pickup == Pickup_AncientHead)
                   1099:                        {
                   1100:                                G_FreeEdict (ent);
                   1101:                                return;
                   1102:                        }
                   1103:                }
                   1104:                if ( (int)dmflags->value & DF_INFINITE_AMMO )
                   1105:                {
                   1106:                        if ( (item->flags == IT_AMMO) || (strcmp(ent->classname, "weapon_bfg") == 0) )
                   1107:                        {
                   1108:                                G_FreeEdict (ent);
                   1109:                                return;
                   1110:                        }
                   1111:                }
                   1112:        }
                   1113: 
                   1114:        if (coop->value && (strcmp(ent->classname, "key_power_cube") == 0))
                   1115:        {
                   1116:                ent->spawnflags |= (1 << (8 + level.power_cubes));
                   1117:                level.power_cubes++;
                   1118:        }
                   1119: 
                   1120:        // don't let them drop items that stay in a coop game
                   1121:        if ((coop->value) && (item->flags & IT_STAY_COOP))
                   1122:        {
                   1123:                item->drop = NULL;
                   1124:        }
                   1125: 
                   1126: //ZOID
                   1127: //Don't spawn the flags unless enabled
                   1128:        if (!ctf->value &&
                   1129:                (strcmp(ent->classname, "item_flag_team1") == 0 ||
                   1130:                strcmp(ent->classname, "item_flag_team2") == 0)) {
                   1131:                G_FreeEdict(ent);
                   1132:                return;
                   1133:        }
                   1134: //ZOID
                   1135: 
                   1136:        ent->item = item;
                   1137:        ent->nextthink = level.time + 2 * FRAMETIME;    // items start after other solids
                   1138:        ent->think = droptofloor;
                   1139:        ent->s.effects = item->world_model_flags;
                   1140:        ent->s.renderfx = RF_GLOW;
                   1141:        if (ent->model)
                   1142:                gi.modelindex (ent->model);
                   1143: 
                   1144: //ZOID
                   1145: //flags are server animated and have special handling
                   1146:        if (strcmp(ent->classname, "item_flag_team1") == 0 ||
                   1147:                strcmp(ent->classname, "item_flag_team2") == 0) {
                   1148:                ent->think = CTFFlagSetup;
                   1149:        }
                   1150: //ZOID
                   1151: 
                   1152: }
                   1153: 
                   1154: //======================================================================
                   1155: 
                   1156: gitem_t        itemlist[] = 
                   1157: {
                   1158:        {
                   1159:                NULL
                   1160:        },      // leave index 0 alone
                   1161: 
                   1162:        //
                   1163:        // ARMOR
                   1164:        //
                   1165: 
                   1166: /*QUAKED item_armor_body (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1167: */
                   1168:        {
                   1169:                "item_armor_body", 
                   1170:                Pickup_Armor,
                   1171:                NULL,
                   1172:                NULL,
                   1173:                NULL,
                   1174:                "misc/ar1_pkup.wav",
                   1175:                "models/items/armor/body/tris.md2", EF_ROTATE,
                   1176:                NULL,
                   1177: /* icon */             "i_bodyarmor",
                   1178: /* pickup */   "Body Armor",
                   1179: /* width */            3,
                   1180:                0,
                   1181:                NULL,
                   1182:                IT_ARMOR,
                   1183:                0,
                   1184:                &bodyarmor_info,
                   1185:                ARMOR_BODY,
                   1186: /* precache */ ""
                   1187:        },
                   1188: 
                   1189: /*QUAKED item_armor_combat (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1190: */
                   1191:        {
                   1192:                "item_armor_combat", 
                   1193:                Pickup_Armor,
                   1194:                NULL,
                   1195:                NULL,
                   1196:                NULL,
                   1197:                "misc/ar1_pkup.wav",
                   1198:                "models/items/armor/combat/tris.md2", EF_ROTATE,
                   1199:                NULL,
                   1200: /* icon */             "i_combatarmor",
                   1201: /* pickup */   "Combat Armor",
                   1202: /* width */            3,
                   1203:                0,
                   1204:                NULL,
                   1205:                IT_ARMOR,
                   1206:                0,
                   1207:                &combatarmor_info,
                   1208:                ARMOR_COMBAT,
                   1209: /* precache */ ""
                   1210:        },
                   1211: 
                   1212: /*QUAKED item_armor_jacket (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1213: */
                   1214:        {
                   1215:                "item_armor_jacket", 
                   1216:                Pickup_Armor,
                   1217:                NULL,
                   1218:                NULL,
                   1219:                NULL,
                   1220:                "misc/ar1_pkup.wav",
                   1221:                "models/items/armor/jacket/tris.md2", EF_ROTATE,
                   1222:                NULL,
                   1223: /* icon */             "i_jacketarmor",
                   1224: /* pickup */   "Jacket Armor",
                   1225: /* width */            3,
                   1226:                0,
                   1227:                NULL,
                   1228:                IT_ARMOR,
                   1229:                0,
                   1230:                &jacketarmor_info,
                   1231:                ARMOR_JACKET,
                   1232: /* precache */ ""
                   1233:        },
                   1234: 
                   1235: /*QUAKED item_armor_shard (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1236: */
                   1237:        {
                   1238:                "item_armor_shard", 
                   1239:                Pickup_Armor,
                   1240:                NULL,
                   1241:                NULL,
                   1242:                NULL,
                   1243:                "misc/ar2_pkup.wav",
                   1244:                "models/items/armor/shard/tris.md2", EF_ROTATE,
                   1245:                NULL,
                   1246: /* icon */             "i_jacketarmor",
                   1247: /* pickup */   "Armor Shard",
                   1248: /* width */            3,
                   1249:                0,
                   1250:                NULL,
                   1251:                IT_ARMOR,
                   1252:                0,
                   1253:                NULL,
                   1254:                ARMOR_SHARD,
                   1255: /* precache */ ""
                   1256:        },
                   1257: 
                   1258: 
                   1259: /*QUAKED item_power_screen (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1260: */
                   1261:        {
                   1262:                "item_power_screen", 
                   1263:                Pickup_PowerArmor,
                   1264:                Use_PowerArmor,
                   1265:                Drop_PowerArmor,
                   1266:                NULL,
                   1267:                "misc/ar3_pkup.wav",
                   1268:                "models/items/armor/screen/tris.md2", EF_ROTATE,
                   1269:                NULL,
                   1270: /* icon */             "i_powerscreen",
                   1271: /* pickup */   "Power Screen",
                   1272: /* width */            0,
                   1273:                60,
                   1274:                NULL,
                   1275:                IT_ARMOR,
                   1276:                0,
                   1277:                NULL,
                   1278:                0,
                   1279: /* precache */ ""
                   1280:        },
                   1281: 
                   1282: /*QUAKED item_power_shield (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1283: */
                   1284:        {
                   1285:                "item_power_shield",
                   1286:                Pickup_PowerArmor,
                   1287:                Use_PowerArmor,
                   1288:                Drop_PowerArmor,
                   1289:                NULL,
                   1290:                "misc/ar3_pkup.wav",
                   1291:                "models/items/armor/shield/tris.md2", EF_ROTATE,
                   1292:                NULL,
                   1293: /* icon */             "i_powershield",
                   1294: /* pickup */   "Power Shield",
                   1295: /* width */            0,
                   1296:                60,
                   1297:                NULL,
                   1298:                IT_ARMOR,
                   1299:                0,
                   1300:                NULL,
                   1301:                0,
                   1302: /* precache */ "misc/power2.wav misc/power1.wav"
                   1303:        },
                   1304: 
                   1305: 
                   1306:        //
                   1307:        // WEAPONS 
                   1308:        //
                   1309: 
                   1310: /* weapon_grapple (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1311: always owned, never in the world
                   1312: */
                   1313:        {
                   1314:                "weapon_grapple", 
                   1315:                NULL,
                   1316:                Use_Weapon,
                   1317:                NULL,
                   1318:                CTFWeapon_Grapple,
                   1319:                "misc/w_pkup.wav",
                   1320:                NULL, 0,
                   1321:                "models/weapons/grapple/tris.md2",
                   1322: /* icon */             "w_grapple",
                   1323: /* pickup */   "Grapple",
                   1324:                0,
                   1325:                0,
                   1326:                NULL,
                   1327:                IT_WEAPON,
                   1328:                WEAP_GRAPPLE,
                   1329:                NULL,
                   1330:                0,
                   1331: /* precache */ "weapons/grapple/grfire.wav weapons/grapple/grpull.wav weapons/grapple/grhang.wav weapons/grapple/grreset.wav weapons/grapple/grhit.wav"
                   1332:        },
                   1333: 
                   1334: /* weapon_blaster (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1335: always owned, never in the world
                   1336: */
                   1337:        {
                   1338:                "weapon_blaster", 
                   1339:                NULL,
                   1340:                Use_Weapon,
                   1341:                NULL,
                   1342:                Weapon_Blaster,
                   1343:                "misc/w_pkup.wav",
                   1344:                NULL, 0,
                   1345:                "models/weapons/v_blast/tris.md2",
                   1346: /* icon */             "w_blaster",
                   1347: /* pickup */   "Blaster",
                   1348:                0,
                   1349:                0,
                   1350:                NULL,
                   1351:                IT_WEAPON|IT_STAY_COOP,
                   1352:                WEAP_BLASTER,
                   1353:                NULL,
                   1354:                0,
                   1355: /* precache */ "weapons/blastf1a.wav misc/lasfly.wav"
                   1356:        },
                   1357: 
                   1358:        
                   1359: /*QUAKED weapon_shotgun (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1360: */
                   1361:        {
                   1362:                "weapon_shotgun", 
                   1363:                Pickup_Weapon,
                   1364:                Use_Weapon,
                   1365:                Drop_Weapon,
                   1366:                Weapon_Shotgun,
                   1367:                "misc/w_pkup.wav",
                   1368:                "models/weapons/g_shotg/tris.md2", EF_ROTATE,
                   1369:                "models/weapons/v_shotg/tris.md2",
                   1370: /* icon */             "w_shotgun",
                   1371: /* pickup */   "Shotgun",
                   1372:                0,
                   1373:                1,
                   1374:                "Shells",
                   1375:                IT_WEAPON|IT_STAY_COOP,
                   1376:                WEAP_SHOTGUN,
                   1377:                NULL,
                   1378:                0,
                   1379: /* precache */ "weapons/shotgf1b.wav weapons/shotgr1b.wav"
                   1380:        },
                   1381: 
                   1382: /*QUAKED weapon_supershotgun (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1383: */
                   1384:        {
                   1385:                "weapon_supershotgun", 
                   1386:                Pickup_Weapon,
                   1387:                Use_Weapon,
                   1388:                Drop_Weapon,
                   1389:                Weapon_SuperShotgun,
                   1390:                "misc/w_pkup.wav",
                   1391:                "models/weapons/g_shotg2/tris.md2", EF_ROTATE,
                   1392:                "models/weapons/v_shotg2/tris.md2",
                   1393: /* icon */             "w_sshotgun",
                   1394: /* pickup */   "Super Shotgun",
                   1395:                0,
                   1396:                2,
                   1397:                "Shells",
                   1398:                IT_WEAPON|IT_STAY_COOP,
                   1399:                WEAP_SUPERSHOTGUN,
                   1400:                NULL,
                   1401:                0,
                   1402: /* precache */ "weapons/sshotf1b.wav"
                   1403:        },
                   1404: 
                   1405: /*QUAKED weapon_machinegun (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1406: */
                   1407:        {
                   1408:                "weapon_machinegun", 
                   1409:                Pickup_Weapon,
                   1410:                Use_Weapon,
                   1411:                Drop_Weapon,
                   1412:                Weapon_Machinegun,
                   1413:                "misc/w_pkup.wav",
                   1414:                "models/weapons/g_machn/tris.md2", EF_ROTATE,
                   1415:                "models/weapons/v_machn/tris.md2",
                   1416: /* icon */             "w_machinegun",
                   1417: /* pickup */   "Machinegun",
                   1418:                0,
                   1419:                1,
                   1420:                "Bullets",
                   1421:                IT_WEAPON|IT_STAY_COOP,
                   1422:                WEAP_MACHINEGUN,
                   1423:                NULL,
                   1424:                0,
                   1425: /* precache */ "weapons/machgf1b.wav weapons/machgf2b.wav weapons/machgf3b.wav weapons/machgf4b.wav weapons/machgf5b.wav"
                   1426:        },
                   1427: 
                   1428: /*QUAKED weapon_chaingun (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1429: */
                   1430:        {
                   1431:                "weapon_chaingun", 
                   1432:                Pickup_Weapon,
                   1433:                Use_Weapon,
                   1434:                Drop_Weapon,
                   1435:                Weapon_Chaingun,
                   1436:                "misc/w_pkup.wav",
                   1437:                "models/weapons/g_chain/tris.md2", EF_ROTATE,
                   1438:                "models/weapons/v_chain/tris.md2",
                   1439: /* icon */             "w_chaingun",
                   1440: /* pickup */   "Chaingun",
                   1441:                0,
                   1442:                1,
                   1443:                "Bullets",
                   1444:                IT_WEAPON|IT_STAY_COOP,
                   1445:                WEAP_CHAINGUN,
                   1446:                NULL,
                   1447:                0,
                   1448: /* precache */ "weapons/chngnu1a.wav weapons/chngnl1a.wav weapons/machgf3b.wav` weapons/chngnd1a.wav"
                   1449:        },
                   1450: 
                   1451: /*QUAKED ammo_grenades (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1452: */
                   1453:        {
                   1454:                "ammo_grenades",
                   1455:                Pickup_Ammo,
                   1456:                Use_Weapon,
                   1457:                Drop_Ammo,
                   1458:                Weapon_Grenade,
                   1459:                "misc/am_pkup.wav",
                   1460:                "models/items/ammo/grenades/medium/tris.md2", 0,
                   1461:                "models/weapons/v_handgr/tris.md2",
                   1462: /* icon */             "a_grenades",
                   1463: /* pickup */   "Grenades",
                   1464: /* width */            3,
                   1465:                5,
                   1466:                "grenades",
                   1467:                IT_AMMO|IT_WEAPON,
                   1468:                WEAP_GRENADES,
                   1469:                NULL,
                   1470:                AMMO_GRENADES,
                   1471: /* precache */ "weapons/hgrent1a.wav weapons/hgrena1b.wav weapons/hgrenc1b.wav weapons/hgrenb1a.wav weapons/hgrenb2a.wav "
                   1472:        },
                   1473: 
                   1474: /*QUAKED weapon_grenadelauncher (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1475: */
                   1476:        {
                   1477:                "weapon_grenadelauncher",
                   1478:                Pickup_Weapon,
                   1479:                Use_Weapon,
                   1480:                Drop_Weapon,
                   1481:                Weapon_GrenadeLauncher,
                   1482:                "misc/w_pkup.wav",
                   1483:                "models/weapons/g_launch/tris.md2", EF_ROTATE,
                   1484:                "models/weapons/v_launch/tris.md2",
                   1485: /* icon */             "w_glauncher",
                   1486: /* pickup */   "Grenade Launcher",
                   1487:                0,
                   1488:                1,
                   1489:                "Grenades",
                   1490:                IT_WEAPON|IT_STAY_COOP,
                   1491:                WEAP_GRENADELAUNCHER,
                   1492:                NULL,
                   1493:                0,
                   1494: /* precache */ "models/objects/grenade/tris.md2 weapons/grenlf1a.wav weapons/grenlr1b.wav weapons/grenlb1b.wav"
                   1495:        },
                   1496: 
                   1497: /*QUAKED weapon_rocketlauncher (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1498: */
                   1499:        {
                   1500:                "weapon_rocketlauncher",
                   1501:                Pickup_Weapon,
                   1502:                Use_Weapon,
                   1503:                Drop_Weapon,
                   1504:                Weapon_RocketLauncher,
                   1505:                "misc/w_pkup.wav",
                   1506:                "models/weapons/g_rocket/tris.md2", EF_ROTATE,
                   1507:                "models/weapons/v_rocket/tris.md2",
                   1508: /* icon */             "w_rlauncher",
                   1509: /* pickup */   "Rocket Launcher",
                   1510:                0,
                   1511:                1,
                   1512:                "Rockets",
                   1513:                IT_WEAPON|IT_STAY_COOP,
                   1514:                WEAP_ROCKETLAUNCHER,
                   1515:                NULL,
                   1516:                0,
                   1517: /* precache */ "models/objects/rocket/tris.md2 weapons/rockfly.wav weapons/rocklf1a.wav weapons/rocklr1b.wav models/objects/debris2/tris.md2"
                   1518:        },
                   1519: 
                   1520: /*QUAKED weapon_hyperblaster (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1521: */
                   1522:        {
                   1523:                "weapon_hyperblaster", 
                   1524:                Pickup_Weapon,
                   1525:                Use_Weapon,
                   1526:                Drop_Weapon,
                   1527:                Weapon_HyperBlaster,
                   1528:                "misc/w_pkup.wav",
                   1529:                "models/weapons/g_hyperb/tris.md2", EF_ROTATE,
                   1530:                "models/weapons/v_hyperb/tris.md2",
                   1531: /* icon */             "w_hyperblaster",
                   1532: /* pickup */   "HyperBlaster",
                   1533:                0,
                   1534:                1,
                   1535:                "Cells",
                   1536:                IT_WEAPON|IT_STAY_COOP,
                   1537:                WEAP_HYPERBLASTER,
                   1538:                NULL,
                   1539:                0,
                   1540: /* precache */ "weapons/hyprbu1a.wav weapons/hyprbl1a.wav weapons/hyprbf1a.wav weapons/hyprbd1a.wav misc/lasfly.wav"
                   1541:        },
                   1542: 
                   1543: /*QUAKED weapon_railgun (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1544: */
                   1545:        {
                   1546:                "weapon_railgun", 
                   1547:                Pickup_Weapon,
                   1548:                Use_Weapon,
                   1549:                Drop_Weapon,
                   1550:                Weapon_Railgun,
                   1551:                "misc/w_pkup.wav",
                   1552:                "models/weapons/g_rail/tris.md2", EF_ROTATE,
                   1553:                "models/weapons/v_rail/tris.md2",
                   1554: /* icon */             "w_railgun",
                   1555: /* pickup */   "Railgun",
                   1556:                0,
                   1557:                1,
                   1558:                "Slugs",
                   1559:                IT_WEAPON|IT_STAY_COOP,
                   1560:                WEAP_RAILGUN,
                   1561:                NULL,
                   1562:                0,
                   1563: /* precache */ "weapons/rg_hum.wav"
                   1564:        },
                   1565: 
                   1566: /*QUAKED weapon_bfg (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1567: */
                   1568:        {
                   1569:                "weapon_bfg",
                   1570:                Pickup_Weapon,
                   1571:                Use_Weapon,
                   1572:                Drop_Weapon,
                   1573:                Weapon_BFG,
                   1574:                "misc/w_pkup.wav",
                   1575:                "models/weapons/g_bfg/tris.md2", EF_ROTATE,
                   1576:                "models/weapons/v_bfg/tris.md2",
                   1577: /* icon */             "w_bfg",
                   1578: /* pickup */   "BFG10K",
                   1579:                0,
                   1580:                50,
                   1581:                "Cells",
                   1582:                IT_WEAPON|IT_STAY_COOP,
                   1583:                WEAP_BFG,
                   1584:                NULL,
                   1585:                0,
                   1586: /* precache */ "sprites/s_bfg1.sp2 sprites/s_bfg2.sp2 sprites/s_bfg3.sp2 weapons/bfg__f1y.wav weapons/bfg__l1a.wav weapons/bfg__x1b.wav weapons/bfg_hum.wav"
                   1587:        },
                   1588: 
                   1589: #if 0
                   1590: //ZOID
                   1591: /*QUAKED weapon_laser (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1592: */
                   1593:        {
                   1594:                "weapon_laser",
                   1595:                Pickup_Weapon,
                   1596:                Use_Weapon,
                   1597:                Drop_Weapon,
                   1598:                Weapon_Laser,
                   1599:                "misc/w_pkup.wav",
                   1600:                "models/weapons/g_laser/tris.md2", EF_ROTATE,
                   1601:                "models/weapons/v_laser/tris.md2",
                   1602: /* icon */             "w_bfg",
                   1603: /* pickup */   "Flashlight Laser",
                   1604:                0,
                   1605:                1,
                   1606:                "Cells",
                   1607:                IT_WEAPON,
                   1608:                0,
                   1609:                NULL,
                   1610:                0,
                   1611: /* precache */ ""
                   1612:        },
                   1613: #endif
                   1614: 
                   1615:        //
                   1616:        // AMMO ITEMS
                   1617:        //
                   1618: 
                   1619: /*QUAKED ammo_shells (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1620: */
                   1621:        {
                   1622:                "ammo_shells",
                   1623:                Pickup_Ammo,
                   1624:                NULL,
                   1625:                Drop_Ammo,
                   1626:                NULL,
                   1627:                "misc/am_pkup.wav",
                   1628:                "models/items/ammo/shells/medium/tris.md2", 0,
                   1629:                NULL,
                   1630: /* icon */             "a_shells",
                   1631: /* pickup */   "Shells",
                   1632: /* width */            3,
                   1633:                10,
                   1634:                NULL,
                   1635:                IT_AMMO,
                   1636:                0,
                   1637:                NULL,
                   1638:                AMMO_SHELLS,
                   1639: /* precache */ ""
                   1640:        },
                   1641: 
                   1642: /*QUAKED ammo_bullets (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1643: */
                   1644:        {
                   1645:                "ammo_bullets",
                   1646:                Pickup_Ammo,
                   1647:                NULL,
                   1648:                Drop_Ammo,
                   1649:                NULL,
                   1650:                "misc/am_pkup.wav",
                   1651:                "models/items/ammo/bullets/medium/tris.md2", 0,
                   1652:                NULL,
                   1653: /* icon */             "a_bullets",
                   1654: /* pickup */   "Bullets",
                   1655: /* width */            3,
                   1656:                50,
                   1657:                NULL,
                   1658:                IT_AMMO,
                   1659:                0,
                   1660:                NULL,
                   1661:                AMMO_BULLETS,
                   1662: /* precache */ ""
                   1663:        },
                   1664: 
                   1665: /*QUAKED ammo_cells (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1666: */
                   1667:        {
                   1668:                "ammo_cells",
                   1669:                Pickup_Ammo,
                   1670:                NULL,
                   1671:                Drop_Ammo,
                   1672:                NULL,
                   1673:                "misc/am_pkup.wav",
                   1674:                "models/items/ammo/cells/medium/tris.md2", 0,
                   1675:                NULL,
                   1676: /* icon */             "a_cells",
                   1677: /* pickup */   "Cells",
                   1678: /* width */            3,
                   1679:                50,
                   1680:                NULL,
                   1681:                IT_AMMO,
                   1682:                0,
                   1683:                NULL,
                   1684:                AMMO_CELLS,
                   1685: /* precache */ ""
                   1686:        },
                   1687: 
                   1688: /*QUAKED ammo_rockets (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1689: */
                   1690:        {
                   1691:                "ammo_rockets",
                   1692:                Pickup_Ammo,
                   1693:                NULL,
                   1694:                Drop_Ammo,
                   1695:                NULL,
                   1696:                "misc/am_pkup.wav",
                   1697:                "models/items/ammo/rockets/medium/tris.md2", 0,
                   1698:                NULL,
                   1699: /* icon */             "a_rockets",
                   1700: /* pickup */   "Rockets",
                   1701: /* width */            3,
                   1702:                5,
                   1703:                NULL,
                   1704:                IT_AMMO,
                   1705:                0,
                   1706:                NULL,
                   1707:                AMMO_ROCKETS,
                   1708: /* precache */ ""
                   1709:        },
                   1710: 
                   1711: /*QUAKED ammo_slugs (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1712: */
                   1713:        {
                   1714:                "ammo_slugs",
                   1715:                Pickup_Ammo,
                   1716:                NULL,
                   1717:                Drop_Ammo,
                   1718:                NULL,
                   1719:                "misc/am_pkup.wav",
                   1720:                "models/items/ammo/slugs/medium/tris.md2", 0,
                   1721:                NULL,
                   1722: /* icon */             "a_slugs",
                   1723: /* pickup */   "Slugs",
                   1724: /* width */            3,
                   1725:                10,
                   1726:                NULL,
                   1727:                IT_AMMO,
                   1728:                0,
                   1729:                NULL,
                   1730:                AMMO_SLUGS,
                   1731: /* precache */ ""
                   1732:        },
                   1733: 
                   1734: 
                   1735:        //
                   1736:        // POWERUP ITEMS
                   1737:        //
                   1738: /*QUAKED item_quad (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1739: */
                   1740:        {
                   1741:                "item_quad", 
                   1742:                Pickup_Powerup,
                   1743:                Use_Quad,
                   1744:                Drop_General,
                   1745:                NULL,
                   1746:                "items/pkup.wav",
                   1747:                "models/items/quaddama/tris.md2", EF_ROTATE,
                   1748:                NULL,
                   1749: /* icon */             "p_quad",
                   1750: /* pickup */   "Quad Damage",
                   1751: /* width */            2,
                   1752:                60,
                   1753:                NULL,
                   1754:                IT_POWERUP,
                   1755:                0,
                   1756:                NULL,
                   1757:                0,
                   1758: /* precache */ "items/damage.wav items/damage2.wav items/damage3.wav"
                   1759:        },
                   1760: 
                   1761: /*QUAKED item_invulnerability (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1762: */
                   1763:        {
                   1764:                "item_invulnerability",
                   1765:                Pickup_Powerup,
                   1766:                Use_Invulnerability,
                   1767:                Drop_General,
                   1768:                NULL,
                   1769:                "items/pkup.wav",
                   1770:                "models/items/invulner/tris.md2", EF_ROTATE,
                   1771:                NULL,
                   1772: /* icon */             "p_invulnerability",
                   1773: /* pickup */   "Invulnerability",
                   1774: /* width */            2,
                   1775:                300,
                   1776:                NULL,
                   1777:                IT_POWERUP,
                   1778:                0,
                   1779:                NULL,
                   1780:                0,
                   1781: /* precache */ "items/protect.wav items/protect2.wav items/protect4.wav"
                   1782:        },
                   1783: 
                   1784: /*QUAKED item_silencer (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1785: */
                   1786:        {
                   1787:                "item_silencer",
                   1788:                Pickup_Powerup,
                   1789:                Use_Silencer,
                   1790:                Drop_General,
                   1791:                NULL,
                   1792:                "items/pkup.wav",
                   1793:                "models/items/silencer/tris.md2", EF_ROTATE,
                   1794:                NULL,
                   1795: /* icon */             "p_silencer",
                   1796: /* pickup */   "Silencer",
                   1797: /* width */            2,
                   1798:                60,
                   1799:                NULL,
                   1800:                IT_POWERUP,
                   1801:                0,
                   1802:                NULL,
                   1803:                0,
                   1804: /* precache */ ""
                   1805:        },
                   1806: 
                   1807: /*QUAKED item_breather (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1808: */
                   1809:        {
                   1810:                "item_breather",
                   1811:                Pickup_Powerup,
                   1812:                Use_Breather,
                   1813:                Drop_General,
                   1814:                NULL,
                   1815:                "items/pkup.wav",
                   1816:                "models/items/breather/tris.md2", EF_ROTATE,
                   1817:                NULL,
                   1818: /* icon */             "p_rebreather",
                   1819: /* pickup */   "Rebreather",
                   1820: /* width */            2,
                   1821:                60,
                   1822:                NULL,
                   1823:                IT_STAY_COOP|IT_POWERUP,
                   1824:                0,
                   1825:                NULL,
                   1826:                0,
                   1827: /* precache */ "items/airout.wav"
                   1828:        },
                   1829: 
                   1830: /*QUAKED item_enviro (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1831: */
                   1832:        {
                   1833:                "item_enviro",
                   1834:                Pickup_Powerup,
                   1835:                Use_Envirosuit,
                   1836:                Drop_General,
                   1837:                NULL,
                   1838:                "items/pkup.wav",
                   1839:                "models/items/enviro/tris.md2", EF_ROTATE,
                   1840:                NULL,
                   1841: /* icon */             "p_envirosuit",
                   1842: /* pickup */   "Environment Suit",
                   1843: /* width */            2,
                   1844:                60,
                   1845:                NULL,
                   1846:                IT_STAY_COOP|IT_POWERUP,
                   1847:                0,
                   1848:                NULL,
                   1849:                0,
                   1850: /* precache */ "items/airout.wav"
                   1851:        },
                   1852: 
                   1853: /*QUAKED item_ancient_head (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1854: Special item that gives +2 to maximum health
                   1855: */
                   1856:        {
                   1857:                "item_ancient_head",
                   1858:                Pickup_AncientHead,
                   1859:                NULL,
                   1860:                NULL,
                   1861:                NULL,
                   1862:                "items/pkup.wav",
                   1863:                "models/items/c_head/tris.md2", EF_ROTATE,
                   1864:                NULL,
                   1865: /* icon */             "i_fixme",
                   1866: /* pickup */   "Ancient Head",
                   1867: /* width */            2,
                   1868:                60,
                   1869:                NULL,
                   1870:                0,
                   1871:                0,
                   1872:                NULL,
                   1873:                0,
                   1874: /* precache */ ""
                   1875:        },
                   1876: 
                   1877: /*QUAKED item_adrenaline (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1878: gives +1 to maximum health
                   1879: */
                   1880:        {
                   1881:                "item_adrenaline",
                   1882:                Pickup_Adrenaline,
                   1883:                NULL,
                   1884:                NULL,
                   1885:                NULL,
                   1886:                "items/pkup.wav",
                   1887:                "models/items/adrenal/tris.md2", EF_ROTATE,
                   1888:                NULL,
                   1889: /* icon */             "p_adrenaline",
                   1890: /* pickup */   "Adrenaline",
                   1891: /* width */            2,
                   1892:                60,
                   1893:                NULL,
                   1894:                0,
                   1895:                0,
                   1896:                NULL,
                   1897:                0,
                   1898: /* precache */ ""
                   1899:        },
                   1900: 
                   1901: /*QUAKED item_bandolier (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1902: */
                   1903:        {
                   1904:                "item_bandolier",
                   1905:                Pickup_Bandolier,
                   1906:                NULL,
                   1907:                NULL,
                   1908:                NULL,
                   1909:                "items/pkup.wav",
                   1910:                "models/items/band/tris.md2", EF_ROTATE,
                   1911:                NULL,
                   1912: /* icon */             "p_bandolier",
                   1913: /* pickup */   "Bandolier",
                   1914: /* width */            2,
                   1915:                60,
                   1916:                NULL,
                   1917:                0,
                   1918:                0,
                   1919:                NULL,
                   1920:                0,
                   1921: /* precache */ ""
                   1922:        },
                   1923: 
                   1924: /*QUAKED item_pack (.3 .3 1) (-16 -16 -16) (16 16 16)
                   1925: */
                   1926:        {
                   1927:                "item_pack",
                   1928:                Pickup_Pack,
                   1929:                NULL,
                   1930:                NULL,
                   1931:                NULL,
                   1932:                "items/pkup.wav",
                   1933:                "models/items/pack/tris.md2", EF_ROTATE,
                   1934:                NULL,
                   1935: /* icon */             "i_pack",
                   1936: /* pickup */   "Ammo Pack",
                   1937: /* width */            2,
                   1938:                180,
                   1939:                NULL,
                   1940:                0,
                   1941:                0,
                   1942:                NULL,
                   1943:                0,
                   1944: /* precache */ ""
                   1945:        },
                   1946: 
                   1947:        //
                   1948:        // KEYS
                   1949:        //
                   1950: /*QUAKED key_data_cd (0 .5 .8) (-16 -16 -16) (16 16 16)
                   1951: key for computer centers
                   1952: */
                   1953:        {
                   1954:                "key_data_cd",
                   1955:                Pickup_Key,
                   1956:                NULL,
                   1957:                Drop_General,
                   1958:                NULL,
                   1959:                "items/pkup.wav",
                   1960:                "models/items/keys/data_cd/tris.md2", EF_ROTATE,
                   1961:                NULL,
                   1962:                "k_datacd",
                   1963:                "Data CD",
                   1964:                2,
                   1965:                0,
                   1966:                NULL,
                   1967:                IT_STAY_COOP|IT_KEY,
                   1968:                0,
                   1969:                NULL,
                   1970:                0,
                   1971: /* precache */ ""
                   1972:        },
                   1973: 
                   1974: /*QUAKED key_power_cube (0 .5 .8) (-16 -16 -16) (16 16 16) TRIGGER_SPAWN NO_TOUCH
                   1975: warehouse circuits
                   1976: */
                   1977:        {
                   1978:                "key_power_cube",
                   1979:                Pickup_Key,
                   1980:                NULL,
                   1981:                Drop_General,
                   1982:                NULL,
                   1983:                "items/pkup.wav",
                   1984:                "models/items/keys/power/tris.md2", EF_ROTATE,
                   1985:                NULL,
                   1986:                "k_powercube",
                   1987:                "Power Cube",
                   1988:                2,
                   1989:                0,
                   1990:                NULL,
                   1991:                IT_STAY_COOP|IT_KEY,
                   1992:                0,
                   1993:                NULL,
                   1994:                0,
                   1995: /* precache */ ""
                   1996:        },
                   1997: 
                   1998: /*QUAKED key_pyramid (0 .5 .8) (-16 -16 -16) (16 16 16)
                   1999: key for the entrance of jail3
                   2000: */
                   2001:        {
                   2002:                "key_pyramid",
                   2003:                Pickup_Key,
                   2004:                NULL,
                   2005:                Drop_General,
                   2006:                NULL,
                   2007:                "items/pkup.wav",
                   2008:                "models/items/keys/pyramid/tris.md2", EF_ROTATE,
                   2009:                NULL,
                   2010:                "k_pyramid",
                   2011:                "Pyramid Key",
                   2012:                2,
                   2013:                0,
                   2014:                NULL,
                   2015:                IT_STAY_COOP|IT_KEY,
                   2016:                0,
                   2017:                NULL,
                   2018:                0,
                   2019: /* precache */ ""
                   2020:        },
                   2021: 
                   2022: /*QUAKED key_data_spinner (0 .5 .8) (-16 -16 -16) (16 16 16)
                   2023: key for the city computer
                   2024: */
                   2025:        {
                   2026:                "key_data_spinner",
                   2027:                Pickup_Key,
                   2028:                NULL,
                   2029:                Drop_General,
                   2030:                NULL,
                   2031:                "items/pkup.wav",
                   2032:                "models/items/keys/spinner/tris.md2", EF_ROTATE,
                   2033:                NULL,
                   2034:                "k_dataspin",
                   2035:                "Data Spinner",
                   2036:                2,
                   2037:                0,
                   2038:                NULL,
                   2039:                IT_STAY_COOP|IT_KEY,
                   2040:                0,
                   2041:                NULL,
                   2042:                0,
                   2043: /* precache */ ""
                   2044:        },
                   2045: 
                   2046: /*QUAKED key_pass (0 .5 .8) (-16 -16 -16) (16 16 16)
                   2047: security pass for the security level
                   2048: */
                   2049:        {
                   2050:                "key_pass",
                   2051:                Pickup_Key,
                   2052:                NULL,
                   2053:                Drop_General,
                   2054:                NULL,
                   2055:                "items/pkup.wav",
                   2056:                "models/items/keys/pass/tris.md2", EF_ROTATE,
                   2057:                NULL,
                   2058:                "k_security",
                   2059:                "Security Pass",
                   2060:                2,
                   2061:                0,
                   2062:                NULL,
                   2063:                IT_STAY_COOP|IT_KEY,
                   2064:                0,
                   2065:                NULL,
                   2066:                0,
                   2067: /* precache */ ""
                   2068:        },
                   2069: 
                   2070: /*QUAKED key_blue_key (0 .5 .8) (-16 -16 -16) (16 16 16)
                   2071: normal door key - blue
                   2072: */
                   2073:        {
                   2074:                "key_blue_key",
                   2075:                Pickup_Key,
                   2076:                NULL,
                   2077:                Drop_General,
                   2078:                NULL,
                   2079:                "items/pkup.wav",
                   2080:                "models/items/keys/key/tris.md2", EF_ROTATE,
                   2081:                NULL,
                   2082:                "k_bluekey",
                   2083:                "Blue Key",
                   2084:                2,
                   2085:                0,
                   2086:                NULL,
                   2087:                IT_STAY_COOP|IT_KEY,
                   2088:                0,
                   2089:                NULL,
                   2090:                0,
                   2091: /* precache */ ""
                   2092:        },
                   2093: 
                   2094: /*QUAKED key_red_key (0 .5 .8) (-16 -16 -16) (16 16 16)
                   2095: normal door key - red
                   2096: */
                   2097:        {
                   2098:                "key_red_key",
                   2099:                Pickup_Key,
                   2100:                NULL,
                   2101:                Drop_General,
                   2102:                NULL,
                   2103:                "items/pkup.wav",
                   2104:                "models/items/keys/red_key/tris.md2", EF_ROTATE,
                   2105:                NULL,
                   2106:                "k_redkey",
                   2107:                "Red Key",
                   2108:                2,
                   2109:                0,
                   2110:                NULL,
                   2111:                IT_STAY_COOP|IT_KEY,
                   2112:                0,
                   2113:                NULL,
                   2114:                0,
                   2115: /* precache */ ""
                   2116:        },
                   2117: 
                   2118: /*QUAKED key_commander_head (0 .5 .8) (-16 -16 -16) (16 16 16)
                   2119: tank commander's head
                   2120: */
                   2121:        {
                   2122:                "key_commander_head",
                   2123:                Pickup_Key,
                   2124:                NULL,
                   2125:                Drop_General,
                   2126:                NULL,
                   2127:                "items/pkup.wav",
                   2128:                "models/monsters/commandr/head/tris.md2", EF_GIB,
                   2129:                NULL,
                   2130: /* icon */             "k_comhead",
                   2131: /* pickup */   "Commander's Head",
                   2132: /* width */            2,
                   2133:                0,
                   2134:                NULL,
                   2135:                IT_STAY_COOP|IT_KEY,
                   2136:                0,
                   2137:                NULL,
                   2138:                0,
                   2139: /* precache */ ""
                   2140:        },
                   2141: 
                   2142: /*QUAKED key_airstrike_target (0 .5 .8) (-16 -16 -16) (16 16 16)
                   2143: tank commander's head
                   2144: */
                   2145:        {
                   2146:                "key_airstrike_target",
                   2147:                Pickup_Key,
                   2148:                NULL,
                   2149:                Drop_General,
                   2150:                NULL,
                   2151:                "items/pkup.wav",
                   2152:                "models/items/keys/target/tris.md2", EF_ROTATE,
                   2153:                NULL,
                   2154: /* icon */             "i_airstrike",
                   2155: /* pickup */   "Airstrike Marker",
                   2156: /* width */            2,
                   2157:                0,
                   2158:                NULL,
                   2159:                IT_STAY_COOP|IT_KEY,
                   2160:                0,
                   2161:                NULL,
                   2162:                0,
                   2163: /* precache */ ""
                   2164:        },
                   2165: 
                   2166:        {
                   2167:                NULL,
                   2168:                Pickup_Health,
                   2169:                NULL,
                   2170:                NULL,
                   2171:                NULL,
                   2172:                "items/pkup.wav",
                   2173:                NULL, 0,
                   2174:                NULL,
                   2175: /* icon */             "i_health",
                   2176: /* pickup */   "Health",
                   2177: /* width */            3,
                   2178:                0,
                   2179:                NULL,
                   2180:                0,
                   2181:                0,
                   2182:                NULL,
                   2183:                0,
                   2184: /* precache */ "items/s_health.wav items/n_health.wav items/l_health.wav items/m_health.wav"
                   2185:        },
                   2186: 
                   2187: 
                   2188: //ZOID
                   2189: /*QUAKED item_flag_team1 (1 0.2 0) (-16 -16 -24) (16 16 32)
                   2190: */
                   2191:        {
                   2192:                "item_flag_team1",
                   2193:                CTFPickup_Flag,
                   2194:                NULL,
                   2195:                CTFDrop_Flag, //Should this be null if we don't want players to drop it manually?
                   2196:                NULL,
                   2197:                "ctf/flagtk.wav",
                   2198:                "players/male/flag1.md2", EF_FLAG1,
                   2199:                NULL,
                   2200: /* icon */             "i_ctf1",
                   2201: /* pickup */   "Red Flag",
                   2202: /* width */            2,
                   2203:                0,
                   2204:                NULL,
                   2205:                0,
                   2206:                0,
                   2207:                NULL,
                   2208:                0,
                   2209: /* precache */ "ctf/flagcap.wav"
                   2210:        },
                   2211: 
                   2212: /*QUAKED item_flag_team2 (1 0.2 0) (-16 -16 -24) (16 16 32)
                   2213: */
                   2214:        {
                   2215:                "item_flag_team2",
                   2216:                CTFPickup_Flag,
                   2217:                NULL,
                   2218:                CTFDrop_Flag, //Should this be null if we don't want players to drop it manually?
                   2219:                NULL,
                   2220:                "ctf/flagtk.wav",
                   2221:                "players/male/flag2.md2", EF_FLAG2,
                   2222:                NULL,
                   2223: /* icon */             "i_ctf2",
                   2224: /* pickup */   "Blue Flag",
                   2225: /* width */            2,
                   2226:                0,
                   2227:                NULL,
                   2228:                0,
                   2229:                0,
                   2230:                NULL,
                   2231:                0,
                   2232: /* precache */ "ctf/flagcap.wav"
                   2233:        },
                   2234: 
                   2235: /* Resistance Tech */
                   2236:        {
                   2237:                "item_tech1",
                   2238:                CTFPickup_Tech,
                   2239:                NULL,
                   2240:                CTFDrop_Tech, //Should this be null if we don't want players to drop it manually?
                   2241:                NULL,
                   2242:                "items/pkup.wav",
                   2243:                "models/ctf/resistance/tris.md2", EF_ROTATE,
                   2244:                NULL,
                   2245: /* icon */             "tech1",
                   2246: /* pickup */   "Disruptor Shield",
                   2247: /* width */            2,
                   2248:                0,
                   2249:                NULL,
                   2250:                IT_TECH,
                   2251:                0,
                   2252:                NULL,
                   2253:                0,
                   2254: /* precache */ "ctf/tech1.wav"
                   2255:        },
                   2256: 
                   2257: /* Strength Tech */
                   2258:        {
                   2259:                "item_tech2",
                   2260:                CTFPickup_Tech,
                   2261:                NULL,
                   2262:                CTFDrop_Tech, //Should this be null if we don't want players to drop it manually?
                   2263:                NULL,
                   2264:                "items/pkup.wav",
                   2265:                "models/ctf/strength/tris.md2", EF_ROTATE,
                   2266:                NULL,
                   2267: /* icon */             "tech2",
                   2268: /* pickup */   "Power Amplifier",
                   2269: /* width */            2,
                   2270:                0,
                   2271:                NULL,
                   2272:                IT_TECH,
                   2273:                0,
                   2274:                NULL,
                   2275:                0,
                   2276: /* precache */ "ctf/tech2.wav ctf/tech2x.wav"
                   2277:        },
                   2278: 
                   2279: /* Haste Tech */
                   2280:        {
                   2281:                "item_tech3",
                   2282:                CTFPickup_Tech,
                   2283:                NULL,
                   2284:                CTFDrop_Tech, //Should this be null if we don't want players to drop it manually?
                   2285:                NULL,
                   2286:                "items/pkup.wav",
                   2287:                "models/ctf/haste/tris.md2", EF_ROTATE,
                   2288:                NULL,
                   2289: /* icon */             "tech3",
                   2290: /* pickup */   "Time Accel",
                   2291: /* width */            2,
                   2292:                0,
                   2293:                NULL,
                   2294:                IT_TECH,
                   2295:                0,
                   2296:                NULL,
                   2297:                0,
                   2298: /* precache */ "ctf/tech3.wav"
                   2299:        },
                   2300: 
                   2301: /* Regeneration Tech */
                   2302:        {
                   2303:                "item_tech4",
                   2304:                CTFPickup_Tech,
                   2305:                NULL,
                   2306:                CTFDrop_Tech, //Should this be null if we don't want players to drop it manually?
                   2307:                NULL,
                   2308:                "items/pkup.wav",
                   2309:                "models/ctf/regeneration/tris.md2", EF_ROTATE,
                   2310:                NULL,
                   2311: /* icon */             "tech4",
                   2312: /* pickup */   "AutoDoc",
                   2313: /* width */            2,
                   2314:                0,
                   2315:                NULL,
                   2316:                IT_TECH,
                   2317:                0,
                   2318:                NULL,
                   2319:                0,
                   2320: /* precache */ "ctf/tech4.wav"
                   2321:        },
                   2322: 
                   2323: //ZOID
                   2324: 
                   2325:        // end of list marker
                   2326:        {NULL}
                   2327: };
                   2328: 
                   2329: 
                   2330: /*QUAKED item_health (.3 .3 1) (-16 -16 -16) (16 16 16)
                   2331: */
                   2332: void SP_item_health (edict_t *self)
                   2333: {
                   2334:        if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
                   2335:        {
                   2336:                G_FreeEdict (self);
                   2337:                return;
                   2338:        }
                   2339: 
                   2340:        self->model = "models/items/healing/medium/tris.md2";
                   2341:        self->count = 10;
                   2342:        SpawnItem (self, FindItem ("Health"));
                   2343:        gi.soundindex ("items/n_health.wav");
                   2344: }
                   2345: 
                   2346: /*QUAKED item_health_small (.3 .3 1) (-16 -16 -16) (16 16 16)
                   2347: */
                   2348: void SP_item_health_small (edict_t *self)
                   2349: {
                   2350:        if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
                   2351:        {
                   2352:                G_FreeEdict (self);
                   2353:                return;
                   2354:        }
                   2355: 
                   2356:        self->model = "models/items/healing/stimpack/tris.md2";
                   2357:        self->count = 2;
                   2358:        SpawnItem (self, FindItem ("Health"));
                   2359:        self->style = HEALTH_IGNORE_MAX;
                   2360:        gi.soundindex ("items/s_health.wav");
                   2361: }
                   2362: 
                   2363: /*QUAKED item_health_large (.3 .3 1) (-16 -16 -16) (16 16 16)
                   2364: */
                   2365: void SP_item_health_large (edict_t *self)
                   2366: {
                   2367:        if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
                   2368:        {
                   2369:                G_FreeEdict (self);
                   2370:                return;
                   2371:        }
                   2372: 
                   2373:        self->model = "models/items/healing/large/tris.md2";
                   2374:        self->count = 25;
                   2375:        SpawnItem (self, FindItem ("Health"));
                   2376:        gi.soundindex ("items/l_health.wav");
                   2377: }
                   2378: 
                   2379: /*QUAKED item_health_mega (.3 .3 1) (-16 -16 -16) (16 16 16)
                   2380: */
                   2381: void SP_item_health_mega (edict_t *self)
                   2382: {
                   2383:        if ( deathmatch->value && ((int)dmflags->value & DF_NO_HEALTH) )
                   2384:        {
                   2385:                G_FreeEdict (self);
                   2386:                return;
                   2387:        }
                   2388: 
                   2389:        self->model = "models/items/mega_h/tris.md2";
                   2390:        self->count = 100;
                   2391:        SpawnItem (self, FindItem ("Health"));
                   2392:        gi.soundindex ("items/m_health.wav");
                   2393:        self->style = HEALTH_IGNORE_MAX|HEALTH_TIMED;
                   2394: }
                   2395: 
                   2396: 
                   2397: void InitItems (void)
                   2398: {
                   2399:        game.num_items = sizeof(itemlist)/sizeof(itemlist[0]) - 1;
                   2400: }
                   2401: 
                   2402: 
                   2403: 
                   2404: /*
                   2405: ===============
                   2406: SetItemNames
                   2407: 
                   2408: Called by worldspawn
                   2409: ===============
                   2410: */
                   2411: void SetItemNames (void)
                   2412: {
                   2413:        int             i;
                   2414:        gitem_t *it;
                   2415: 
                   2416:        for (i=0 ; i<game.num_items ; i++)
                   2417:        {
                   2418:                it = &itemlist[i];
                   2419:                gi.configstring (CS_ITEMS+i, it->pickup_name);
                   2420:        }
                   2421: 
                   2422:        jacket_armor_index = ITEM_INDEX(FindItem("Jacket Armor"));
                   2423:        combat_armor_index = ITEM_INDEX(FindItem("Combat Armor"));
                   2424:        body_armor_index   = ITEM_INDEX(FindItem("Body Armor"));
                   2425:        power_screen_index = ITEM_INDEX(FindItem("Power Screen"));
                   2426:        power_shield_index = ITEM_INDEX(FindItem("Power Shield"));
                   2427: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.