void trigger_ammo_setup(gentity_t* self) { self->target_ent = G_FindByTargetname( NULL, self->target ); if(!self->target_ent) { G_Error( "trigger_ammo failed to find target: %s\n", self->target ); } if(TRIGGER_AMMO_CANTHINK(self)) { self->think = trigger_ammo_think; self->nextthink = level.time + FRAMETIME; } }
/* ============== SP_trigger_ammo ============== */ void SP_trigger_ammo(gentity_t * self) { char *spawnstr; int ammovalue; InitTrigger(self); self->touch = ammo_touch; // ammototal specifies the maximum amount of ammo this trigger contains G_SpawnString("ammototal", "0", &spawnstr); ammovalue = atoi(spawnstr); // Gordon: -9999 means infinite now self->health = ammovalue; if(self->health <= 0) { self->health = -9999; } self->count = self->health; self->s.eType = ET_SUPPLIER; self->target_ent = NULL; if(self->target && *self->target) { self->think = trigger_ammo_setup; self->nextthink = level.time + FRAMETIME; } else if(TRIGGER_AMMO_CANTHINK(self)) { self->think = trigger_ammo_think; self->nextthink = level.time + AMMO_REGENTIME; } // ammorate specifies the amount of ammo added per second G_SpawnString("ammorate", "1", &spawnstr); ammovalue = atoi(spawnstr); // store the rate of ammo addition in damage self->damage = ammovalue; }