Exemplo n.º 1
0
 /*
  * ===============
  * RegisterItem
  *
  * The item will be added to the precache list
  * ===============
  */
 void RegisterItem(gitem_t *item)
 {
     if (!item)
     {
         G_Error("RegisterItem: NULL");
     }
     itemRegistered[item - bg_itemlist] = true;
 }
Exemplo n.º 2
0
        /*
         * ================
         * Drop_Item
         *
         * Spawns an item and tosses it forward
         * ================
         */
        gentity_t *Drop_Item(gentity_t *ent, gitem_t *item, float angle)
        {
            vec3_t velocity;
            vec3_t angles;

            VectorCopy(ent->s.apos.trBase, angles);
            angles[YAW]  += angle;
            angles[PITCH] = 0;                  // always forward

            AngleVectors(angles, velocity, NULL, NULL);
            VectorScale(velocity, 150, velocity);
            velocity[2] += 200 + crandom() * 50;

            return(LaunchItem(item, ent->s.pos.trBase, velocity));
        }
Exemplo n.º 3
0
        //======================================================================

        /*
         * ================
         * LaunchItem
         *
         * Spawns an item and tosses it forward
         * ================
         */
        gentity_t *LaunchItem(gitem_t *item, vec3_t origin, vec3_t velocity)
        {
            gentity_t *dropped;

            dropped = G_Spawn();

            dropped->s.eType       = ET_ITEM;
            dropped->s.modelindex  = item - bg_itemlist; // store item number in modelindex
            dropped->s.modelindex2 = 1;                  // This is non-zero is it's a dropped item

            dropped->classname = item->classname;
            dropped->item      = item;
            VectorSet(dropped->r.mins, -ITEM_RADIUS, -ITEM_RADIUS, -ITEM_RADIUS);
            VectorSet(dropped->r.maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS);
            dropped->r.contents = CONTENTS_TRIGGER;

            dropped->touch = Touch_Item;

            G_SetOrigin(dropped, origin);
            dropped->s.pos.trType = TR_GRAVITY;
            dropped->s.pos.trTime = level.time;
            VectorCopy(velocity, dropped->s.pos.trDelta);

            dropped->s.eFlags |= EF_BOUNCE_HALF;
            if (g_gametype.integer == GT_CTF && item->giType == IT_TEAM)               // Special case for CTF flags
            {
                dropped->think     = Team_DroppedFlagThink;
                dropped->nextthink = level.time + 30000;
                Team_CheckDroppedItem(dropped);
            }
            else                 // auto-remove after 30 seconds
            {
                dropped->think     = G_FreeEntity;
                dropped->nextthink = level.time + 30000;
            }

            dropped->flags = FL_DROPPED_ITEM;

            trap_LinkEntity(dropped);

            return(dropped);
        }
Exemplo n.º 4
0
 /*
  * ============
  * G_ItemDisabled
  * ============
  */
 int G_ItemDisabled(gitem_t *item)
 {
     char name[128];