Пример #1
0
void SP_trigger_key (edict_t *self)
{
	if (!st.item)
	{
		gi.dprintf("no key item for trigger_key at %s\n", vtos(self->s.origin));
		return;
	}
	self->item = FindItemByClassname (st.item);

	if (!self->item)
	{
		gi.dprintf("item %s not found for trigger_key at %s\n", st.item, vtos(self->s.origin));
		return;
	}

	if (!self->target)
	{
		gi.dprintf("%s at %s has no target\n", self->classname, vtos(self->s.origin));
		return;
	}

	gi.soundindex ("misc/keytry.wav");
	gi.soundindex ("misc/keyuse.wav");

	self->use = trigger_key_use;
}
Пример #2
0
void SP_briefcase(edict_t *self)
{
	if (!self->count)
		level.ctb_time = 180;
	else
		level.ctb_time = self->count;

    SpawnItem(self,FindItemByClassname("briefcase"));
}
Пример #3
0
void
SP_turret_driver(edict_t *self)
{
  	if (!self)
	{
		return;
	}

	if (deathmatch->value)
	{
		G_FreeEdict(self);
		return;
	}

	self->movetype = MOVETYPE_PUSH;
	self->solid = SOLID_BBOX;
	self->s.modelindex = gi.modelindex("models/monsters/infantry/tris.md2");
	VectorSet(self->mins, -16, -16, -24);
	VectorSet(self->maxs, 16, 16, 32);

	self->health = 100;
	self->gib_health = 0;
	self->mass = 200;
	self->viewheight = 24;

	self->die = turret_driver_die;
	self->monsterinfo.stand = infantry_stand;

	self->flags |= FL_NO_KNOCKBACK;

	level.total_monsters++;

	self->svflags |= SVF_MONSTER;
	self->s.renderfx |= RF_FRAMELERP;
	self->takedamage = DAMAGE_AIM;
	self->use = monster_use;
	self->clipmask = MASK_MONSTERSOLID;
	VectorCopy(self->s.origin, self->s.old_origin);
	self->monsterinfo.aiflags |= AI_STAND_GROUND | AI_DUCKED;

	if (st.item)
	{
		self->item = FindItemByClassname(st.item);

		if (!self->item)
		{
			gi.dprintf("%s at %s has bad item: %s\n", self->classname,
					vtos(self->s.origin), st.item);
		}
	}

	self->think = turret_driver_link;
	self->nextthink = level.time + FRAMETIME;

	gi.linkentity(self);
}
Пример #4
0
void Z_SpawnDMItems()
{
	char **ptr = NULL;
	int added = 0;
	int count = 1;
	
	// only in deathmatch
	if (!deathmatch->value)
		return;

	// only with the flag set
	if ((int)zdmflags->value & ZDM_ZAERO_ITEMS)
		return;

	// scan thru all the items looking for our items
	ptr = items;
	while (*ptr != NULL)
	{
		edict_t *e = G_Find(NULL, FOFS(classname), *ptr);
		if (e != NULL)
			return;

		ptr++;
	}
	
	// try to spawn 1 of each item near a deathmatch spot
	ptr = &items[0];
	while(*ptr != NULL)
	{
		int j = 0;
		gitem_t *i = NULL;
		edict_t *spot = NULL;

		i = FindItemByClassname(*ptr);
		ptr++;
		if (i == NULL)
			continue;

		for (j = 0; j < 4; j++)
		{
			spot = FindZSpawn(count++);
			if (spot == NULL)
				break;

			if (SpawnZ(i, spot))
			{
				added++;
				break;
			}
		}
	}
	gi.dprintf ("%i Zaero entities added\n", added);
}
Пример #5
0
qboolean monster_start (edict_t *self)
{
	if (deathmatch->value)
	{
		G_FreeEdict (self);
		return false;
	}

	if ((self->spawnflags & 4) && !(self->monsterinfo.aiflags & AI_GOOD_GUY))
	{
		self->spawnflags &= ~4;
		self->spawnflags |= 1;
	}

	if (!(self->monsterinfo.aiflags & AI_GOOD_GUY))
	{
		if(!(self->spawnflags & 16))
		{
			level.total_monsters++;
		}
	}

	self->nextthink = level.time + FRAMETIME;
	self->svflags |= SVF_MONSTER;
	self->s.renderfx |= RF_FRAMELERP;
	self->takedamage = DAMAGE_AIM;
	self->air_finished = level.time + 12;
	self->use = monster_use;
	self->max_health = self->health;
	self->clipmask = MASK_MONSTERSOLID;

	self->s.skinnum = 0;
	self->deadflag = DEAD_NO;
	self->svflags &= ~SVF_DEADMONSTER;

	if (!self->monsterinfo.checkattack)
		self->monsterinfo.checkattack = M_CheckAttack;
	VectorCopy (self->s.origin, self->s.old_origin);

	if (st.item)
	{
		self->item = FindItemByClassname (st.item);
		if (!self->item)
			gi.dprintf("%s at %s has bad item: %s\n", self->classname, vtos(self->s.origin), st.item);
	}

	// randomize what frame they start on
	if (self->monsterinfo.currentmove)
		self->s.frame = self->monsterinfo.currentmove->firstframe + (rand() % (self->monsterinfo.currentmove->lastframe - self->monsterinfo.currentmove->firstframe + 1));

	return true;
}
Пример #6
0
void SpawnSpecs(edict_t *ent)
{
        gitem_t *spec;
        edict_t *spot;
        int i;
        i = 0;
        while (tnames[i]) {
                if ((spec = FindItemByClassname(tnames[i])) != NULL &&
                        (spot = FindSpecSpawn()) != NULL)
                        SpawnSpec(spec, spot);
                i++;
        }
}
Пример #7
0
void TossClientWeapon (edict_t *self)
{
	gitem_t		*item;
	edict_t		*drop;
	qboolean	quad;
	float		spread;

	if (!deathmatch->value)
		return;

	item = self->client->pers.weapon;
	if (! self->client->pers.inventory[self->client->ammo_index] )
		item = NULL;
	if (item && (strcmp (item->pickup_name, "Blaster") == 0))
		item = NULL;

#if defined(_DEBUG) && defined(_Z_TESTMODE)
	if (item && (strcmp (item->pickup_name, "Line Draw") == 0))
		item = NULL;
#endif

	if (!((int)(dmflags->value) & DF_QUAD_DROP))
		quad = false;
	else
		quad = (self->client->quad_framenum > (level.framenum + 10));

	if (item && quad)
		spread = 22.5;
	else
		spread = 0.0;

	if (item)
	{
		self->client->v_angle[YAW] -= spread;
		drop = Drop_Item (self, item);
		self->client->v_angle[YAW] += spread;
		drop->spawnflags = DROPPED_PLAYER_ITEM;
	}

	if (quad)
	{
		self->client->v_angle[YAW] += spread;
		drop = Drop_Item (self, FindItemByClassname ("item_quad"));
		self->client->v_angle[YAW] -= spread;
		drop->spawnflags |= DROPPED_PLAYER_ITEM;

		drop->touch = Touch_Item;
		drop->nextthink = level.time + (self->client->quad_framenum - level.framenum) * FRAMETIME;
		drop->think = G_FreeEdict;
	}
}
Пример #8
0
void dom_spawnflag (void)
{
	edict_t *flag;

	flag = Spawn_Item(FindItemByClassname("item_flag"));
	flag->think = dom_flagthink;
	flag->nextthink = level.time + FRAMETIME;
	if (FindValidSpawnPoint(flag, false))
		gi.dprintf("INFO: Flag spawned successfully.\n");
	else
		gi.dprintf("WARNING: Flag failed to spawn!\n");
	DEFENSE_TEAM = 0;
	FLAG_FRAMES = 0;
}
Пример #9
0
void M_default_Start( edict_t *self )
{
	self->health = 30;
	self->max_health = self->health;
	self->item = FindItemByClassname("ammo_bullets");


	self->think = AI_Think;
	self->nextthink = level.time + FRAMETIME;
	self->yaw_speed = 100;
	M_default_InitPersistant(self);
	AI_ResetNavigation(self);

	//add as bot enemy
	AI_EnemyAdded( self );

	//if(AIDevel.debugMode && bot_debugmonster->integer)
		Com_Printf ("monster: Spawn\n");
}
Пример #10
0
edict_t *DropRandomAmmo (edict_t *self)
{
	gitem_t *item;

	switch (GetRandom(1, 6))
	{
	case 1: item = FindItemByClassname("ammo_shells"); break;
	case 2: item = FindItemByClassname("ammo_bullets"); break;
	case 3: item = FindItemByClassname("ammo_grenades"); break;
	case 4: item = FindItemByClassname("ammo_rockets"); break;
	case 5: item = FindItemByClassname("ammo_cells"); break;
	case 6: item = FindItemByClassname("ammo_slugs"); break;
	}
	return Drop_Item(self, item);
}
Пример #11
0
void init_drone_gladiator (edict_t *self)
{
	sound_die = gi.soundindex ("gladiator/glddeth2.wav");	
	sound_gun = gi.soundindex ("gladiator/railgun.wav");
	sound_cleaver_swing = gi.soundindex ("gladiator/melee1.wav");
	sound_cleaver_hit = gi.soundindex ("gladiator/melee2.wav");
	sound_cleaver_miss = gi.soundindex ("gladiator/melee3.wav");
	sound_idle = gi.soundindex ("gladiator/gldidle1.wav");
	sound_search = gi.soundindex ("gladiator/gldsrch1.wav");
	sound_sight = gi.soundindex ("gladiator/sight.wav");

	self->s.modelindex = gi.modelindex ("models/monsters/gladiatr/tris.md2");
	VectorSet (self->mins, -24, -24, -24);
	VectorSet (self->maxs, 24, 24, 48);
	self->health = 95 + 10*self->monsterinfo.level;
	self->max_health = self->health;
	self->gib_health = -100;
	self->mass = 400;
	self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD;
	self->monsterinfo.power_armor_power = 100 + 20*self->monsterinfo.level;
	self->monsterinfo.max_armor = self->monsterinfo.power_armor_power;
	self->mtype = M_GLADIATOR;
	self->item = FindItemByClassname("ammo_slugs");
	self->monsterinfo.jumpup = 64;
	self->monsterinfo.jumpdn = 512;
	self->monsterinfo.aiflags |= AI_NO_CIRCLE_STRAFE;
	self->monsterinfo.control_cost = M_GLADIATOR_CONTROL_COST;

	self->die = gladiator_die;
	self->monsterinfo.stand = gladiator_stand;
	self->monsterinfo.run = gladiator_run;
	self->monsterinfo.attack = gladiator_attack;
	self->monsterinfo.melee = gladiator_melee;
	self->monsterinfo.sight = gladiator_sight;
	self->monsterinfo.idle = gladiator_idle;
	self->monsterinfo.walk = gladiator_walk;

	gi.linkentity (self);
	self->monsterinfo.currentmove = &gladiator_move_stand;
	self->monsterinfo.scale = MODEL_SCALE;
}
Пример #12
0
void DeadDropSpec(edict_t *ent)
{
        gitem_t *spec;
        edict_t *dropped;
        int i;

        i = 0;
        while (tnames[i]) {
                if ((spec = FindItemByClassname(tnames[i])) != NULL &&
                        ent->client->pers.inventory[ITEM_INDEX(spec)]) {
                        dropped = Drop_Item(ent, spec);
                        // hack the velocity to make it bounce random
                        dropped->velocity[0] = (rand() % 600) - 300;
                        dropped->velocity[1] = (rand() % 600) - 300;
                        dropped->nextthink = level.time + 1;
                        dropped->think = MakeTouchSpecThink;
                        dropped->owner = NULL;
                        ent->client->pers.inventory[ITEM_INDEX(spec)] = 0;
                }
                i++;
        }
}
Пример #13
0
void SP_item_weapon_arisakas(edict_t *self)
{
    SpawnItem(self,FindItemByClassname("weapon_arisakas"));
}
Пример #14
0
void init_drone_gunner (edict_t *self)
{
	sound_death = gi.soundindex ("gunner/death1.wav");	
	sound_pain = gi.soundindex ("gunner/gunpain2.wav");	
	sound_pain2 = gi.soundindex ("gunner/gunpain1.wav");	
	sound_idle = gi.soundindex ("gunner/gunidle1.wav");	
	sound_open = gi.soundindex ("gunner/gunatck1.wav");	
	sound_search = gi.soundindex ("gunner/gunsrch1.wav");	
	sound_sight = gi.soundindex ("gunner/sight1.wav");
	sound_thud = gi.soundindex ("player/land1.wav");

	gi.soundindex ("gunner/gunatck2.wav");
	gi.soundindex ("gunner/gunatck3.wav");

	self->monsterinfo.control_cost = M_GUNNER_CONTROL_COST;
	self->monsterinfo.cost = M_GUNNER_COST;
	self->s.modelindex = gi.modelindex ("models/monsters/gunner/tris.md2");
	VectorSet (self->mins, -16, -16, -24);
	VectorSet (self->maxs, 16, 16, 32);

	//if (self->activator && self->activator->client)
	self->health = 50 + 25*self->monsterinfo.level;
	//else self->health = 100 + 30*self->monsterinfo.level;

	self->max_health = self->health;
	self->gib_health = -100;
	self->mass = 200;
	self->monsterinfo.jumpdn = 512;
	self->monsterinfo.jumpup = 64;
	
	if (random() > 0.5)
		self->item = FindItemByClassname("ammo_bullets");
	else
		self->item = FindItemByClassname("ammo_grenades");

	self->die = mygunnerdie;

	self->monsterinfo.stand = mygunnerstand;
	self->monsterinfo.run = mygunnerrun;
	self->monsterinfo.dodge = mygunner_dodge;
	self->monsterinfo.attack = mygunner_attack;
	self->monsterinfo.walk = gunner_walk;

	//K03 Begin
	self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD;

	//if (self->activator && self->activator->client)
		self->monsterinfo.power_armor_power = 50 + 15*self->monsterinfo.level;
	//else self->monsterinfo.power_armor_power = 100 + 50*self->monsterinfo.level;

	self->monsterinfo.max_armor = self->monsterinfo.power_armor_power;
	self->mtype = M_GUNNER;
	//K03 End

	gi.linkentity (self);

	self->monsterinfo.currentmove = &mygunnermove_stand;	
	self->monsterinfo.scale = MODEL_SCALE;

//	walkmonster_start (self);
	self->nextthink = level.time + FRAMETIME;
}
Пример #15
0
/*QUAKED monster_medic (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
*/
void init_drone_medic (edict_t *self)
{
	sound_idle1 = gi.soundindex ("medic/idle.wav");
	sound_pain1 = gi.soundindex ("medic/medpain1.wav");
	sound_pain2 = gi.soundindex ("medic/medpain2.wav");
	sound_die = gi.soundindex ("medic/meddeth1.wav");
	sound_sight = gi.soundindex ("medic/medsght1.wav");
	sound_search = gi.soundindex ("medic/medsrch1.wav");
	sound_hook_launch = gi.soundindex ("medic/medatck2.wav");
	sound_hook_hit = gi.soundindex ("medic/medatck3.wav");
	sound_hook_heal = gi.soundindex ("medic/medatck4.wav");
	sound_hook_retract = gi.soundindex ("medic/medatck5.wav");

	gi.soundindex ("medic/medatck1.wav");

	self->monsterinfo.control_cost = M_MEDIC_CONTROL_COST;
	self->monsterinfo.cost = M_MEDIC_COST;
	self->movetype = MOVETYPE_STEP;
	self->solid = SOLID_BBOX;
	self->s.modelindex = gi.modelindex ("models/monsters/medic/tris.md2");
	VectorSet (self->mins, -24, -24, -24);
	VectorSet (self->maxs, 24, 24, 32);

	//if (self->activator && self->activator->client)
	self->health = 100 + 10*self->monsterinfo.level;
	//else self->health = 200 + 20*self->monsterinfo.level;

	self->max_health = self->health;
	self->gib_health = -100;//-self->health;
	self->mass = 400;
	self->mtype = M_MEDIC;
	self->monsterinfo.aiflags |= AI_MEDIC; // use medic ai
	self->style = 1;// for blaster bolt

//	self->pain = mymedic_pain;
	self->die = mymedic_die;
//	self->touch = mymedic_touch;

	self->item = FindItemByClassname("item_adrenaline");

	self->monsterinfo.stand = mymedic_stand;
	self->monsterinfo.walk = medic_walk;
	self->monsterinfo.run = mymedic_run;
	self->monsterinfo.dodge = mymedic_dodge;
	self->monsterinfo.attack = mymedic_attack;
	self->monsterinfo.melee = mymedic_melee;
	self->monsterinfo.sight = mymedic_sight;
	self->monsterinfo.jumpup = 64;
	self->monsterinfo.jumpdn = 512;
//	self->monsterinfo.idle = mymedic_idle;
//	self->monsterinfo.search = mymedic_search;
//	self->monsterinfo.checkattack = mymedic_checkattack;
//	self->monsterinfo.control_cost = 1;
//	self->monsterinfo.cost = 150;
	self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD;
	self->monsterinfo.aiflags |= AI_NO_CIRCLE_STRAFE;
	//self->monsterinfo.melee = 1;

	//if (self->activator && self->activator->client)
		self->monsterinfo.power_armor_power = 100 + 20*self->monsterinfo.level;
	//else self->monsterinfo.power_armor_power = 200 + 40*self->monsterinfo.level;

	self->monsterinfo.max_armor = self->monsterinfo.power_armor_power;

	gi.linkentity (self);

	self->monsterinfo.currentmove = &mymedic_move_stand;
	self->monsterinfo.scale = MODEL_SCALE;

//	walkmonster_start (self);
	self->nextthink = level.time + FRAMETIME;
	//self->activator->num_monsters += self->monsterinfo.control_cost;
}
Пример #16
0
void SP_item_ammo_arisakas(edict_t *self)
{
    SpawnItem(self,FindItemByClassname("ammo_arisakas"));
}
Пример #17
0
void SP_item_ammo_type_99(edict_t *self)
{
    SpawnItem(self,FindItemByClassname("ammo_type_99"));
}
Пример #18
0
void SP_item_ammo_grenades_jpn(edict_t *self)
{
    SpawnItem(self,FindItemByClassname("ammo_grenades_jpn"));
}
Пример #19
0
void SP_item_ammo_nambu(edict_t *self)
{
    SpawnItem(self,FindItemByClassname("ammo_nambu"));
}
Пример #20
0
void cht_Give (player_t *player, const char *name)
{
	BOOL giveall;
	int i;
	gitem_t *it;

	if (player != &consoleplayer())
		Printf (PRINT_HIGH, "%s is a cheater: give %s\n", player->userinfo.netname, name);

	if (stricmp (name, "all") == 0)
		giveall = true;
	else
		giveall = false;

	if (giveall || strnicmp (name, "health", 6) == 0) {
		int h;

		if (0 < (h = atoi (name + 6))) {
			if (player->mo) {
				player->mo->health += h;
	  			player->health = player->mo->health;
			} else {
				player->health += h;
			}
		} else {
			if (player->mo)
				player->mo->health = deh.GodHealth;
	  
			player->health = deh.GodHealth;
		}

		if (!giveall)
			return;
	}

	if (giveall || stricmp (name, "backpack") == 0) {
		if (!player->backpack) {
			for (i=0 ; i<NUMAMMO ; i++)
			player->maxammo[i] *= 2;
			player->backpack = true;
		}
		for (i=0 ; i<NUMAMMO ; i++)
			P_GiveAmmo (player, (ammotype_t)i, 1);

		if (!giveall)
			return;
	}

	if (giveall || stricmp (name, "weapons") == 0) {
		weapontype_t pendweap = player->pendingweapon;
		for (i = 0; i<NUMWEAPONS; i++)
			P_GiveWeapon (player, (weapontype_t)i, false);
		player->pendingweapon = pendweap;

		if (!giveall)
			return;
	}

	if (giveall || stricmp (name, "ammo") == 0) {
		for (i=0;i<NUMAMMO;i++)
			player->ammo[i] = player->maxammo[i];

		if (!giveall)
			return;
	}

	if (giveall || stricmp (name, "armor") == 0) {
		player->armorpoints = 200;
		player->armortype = 2;

		if (!giveall)
			return;
	}

	if (giveall || stricmp (name, "keys") == 0) {
		for (i=0;i<NUMCARDS;i++)
			player->cards[i] = true;

		if (!giveall)
			return;
	}

	if (giveall)
		return;

	it = FindItem (name);
	if (!it) {
		it = FindItemByClassname (name);
		if (!it) {
			if (player == &consoleplayer())
				Printf (PRINT_HIGH, "Unknown item\n");
			return;
		}
	}

	if (it->flags & IT_AMMO) {
		int howmuch;

	/*	if (argc == 3)
			howmuch = atoi (argv[2]);
		else */
			howmuch = it->quantity;

		P_GiveAmmo (player, (ammotype_t)it->offset, howmuch);
	} else if (it->flags & IT_WEAPON) {
		P_GiveWeapon (player, (weapontype_t)it->offset, 0);
	} else if (it->flags & IT_KEY) {
		P_GiveCard (player, (card_t)it->offset);
	} else if (it->flags & IT_POWERUP) {
		P_GivePower (player, it->offset);
	} else if (it->flags & IT_ARMOR) {
		P_GiveArmor (player, it->offset);
	}
}
Пример #21
0
qboolean monster_start (edict_t *self)
{
	if (deathmatch->value)
	{
		G_FreeEdict (self);
		return false;
	}

	// Lazarus: Already gibbed monsters passed across levels via trigger_transition:
	if ( (self->max_health > 0) && (self->health <= self->gib_health) && !(self->spawnflags & SF_MONSTER_NOGIB) )
	{
		void	SP_gibhead(edict_t *);

		SP_gibhead(self);
		return true;
	}

	// Lazarus: Good guys
	if (self->spawnflags & SF_MONSTER_GOODGUY) {
		self->monsterinfo.aiflags |= AI_GOOD_GUY;
		if(!self->dmgteam) {
			self->dmgteam = gi.TagMalloc(8*sizeof(char), TAG_LEVEL);
			strcpy(self->dmgteam,"player");
		}
	}

	// Lazarus: Max range for sight/attack
	if(st.distance)
		self->monsterinfo.max_range = max(500,st.distance);
	else
		self->monsterinfo.max_range = 1280;	// Q2 default is 1000. We're mean.

	// Lazarus: We keep SIGHT to mean what old AMBUSH does, and AMBUSH additionally
	//          now means don't play idle sounds
/*	if ((self->spawnflags & MONSTER_SIGHT) && !(self->monsterinfo.aiflags & AI_GOOD_GUY))
	{
		self->spawnflags &= ~MONSTER_SIGHT;
		self->spawnflags |= MONSTER_AMBUSH;
	} */
	if ((self->spawnflags & SF_MONSTER_AMBUSH) && !(self->monsterinfo.aiflags & AI_GOOD_GUY))
		self->spawnflags |= SF_MONSTER_SIGHT;

	// Lazarus: Don't add trigger spawned monsters until they are actually spawned
	if (!(self->monsterinfo.aiflags & AI_GOOD_GUY) && !(self->spawnflags & SF_MONSTER_TRIGGER_SPAWN))
		level.total_monsters++;

	self->nextthink = level.time + FRAMETIME;
	self->svflags |= SVF_MONSTER;
	self->s.renderfx |= RF_FRAMELERP;
	self->air_finished = level.time + 12;
	self->use = monster_use;
	// Lazarus - don't reset max_health unnecessarily
	if(!self->max_health)
		self->max_health = self->health;
	if (self->health < (self->max_health / 2))
		self->s.skinnum |= 1;
	else
		self->s.skinnum &= ~1;
	self->clipmask = MASK_MONSTERSOLID;

	if (self->s.skinnum < 1) // Knightmare added
		self->s.skinnum = 0;
	self->deadflag = DEAD_NO;
	self->svflags &= ~SVF_DEADMONSTER;

	if(self->monsterinfo.flies > 1.0)
	{
		self->s.effects |= EF_FLIES;
		self->s.sound = gi.soundindex ("infantry/inflies1.wav");
	}

	// Lazarus
	if(self->health <=0)
	{
		self->svflags |= SVF_DEADMONSTER;
		self->movetype = MOVETYPE_TOSS;
		self->takedamage = DAMAGE_YES;
		self->monsterinfo.pausetime = 100000000;
		self->monsterinfo.aiflags &= ~AI_RESPAWN_FINDPLAYER;
		if(self->max_health > 0)
		{
			// This must be a dead monster who changed levels
			// via trigger_transition
			self->nextthink = 0;
			self->deadflag = DEAD_DEAD;
		}
		if(self->s.effects & EF_FLIES && self->monsterinfo.flies <= 1.0)
		{
			self->think = M_FliesOff;
			self->nextthink = level.time + 1 + random()*60;
		}
		return true;
	}
	else
	{
		// make sure red shell is turned off in case medic got confused:
		self->monsterinfo.aiflags &= ~AI_RESURRECTING;
		self->svflags &= ~SVF_DEADMONSTER;
		self->takedamage = DAMAGE_AIM;
	}

	if (!self->monsterinfo.checkattack)
		self->monsterinfo.checkattack = M_CheckAttack;
	VectorCopy (self->s.origin, self->s.old_origin);

	if (st.item)
	{
		self->item = FindItemByClassname (st.item);
		if (!self->item)
			gi.dprintf("%s at %s has bad item: %s\n", self->classname, vtos(self->s.origin), st.item);
	}

	// randomize what frame they start on
	// Lazarus: preserve frame if set for monsters changing levels
	if (!self->s.frame)
	{
		if (self->monsterinfo.currentmove)
			self->s.frame = self->monsterinfo.currentmove->firstframe + (rand() % (self->monsterinfo.currentmove->lastframe - self->monsterinfo.currentmove->firstframe + 1));
	}

	return true;
}
Пример #22
0
void G_SetStats (edict_t *ent)
{
	gitem_t		*item;
	int			index, cells;
	int			power_armor_type;

	//
	// health
	//
	ent->client->ps.stats[STAT_HEALTH_ICON] = level.pic_health;
	ent->client->ps.stats[STAT_HEALTH] = ent->health;

	//
	// ammo
	//
	if (!ent->client->ammo_index )
	{
		ent->client->ps.stats[STAT_AMMO_ICON] = 0;
		ent->client->ps.stats[STAT_AMMO] = 0;
	}
	else
	{
		item = &itemlist[ent->client->ammo_index];
		ent->client->ps.stats[STAT_AMMO_ICON] = gi.imageindex (item->icon);
		ent->client->ps.stats[STAT_AMMO] = ent->client->pers.inventory[ent->client->ammo_index];
	}
	
	//
	// armor
	//
	power_armor_type = PowerArmorType (ent);
	if (power_armor_type)
	{
		cells = ent->client->pers.inventory[ITEM_INDEX(FindItem ("cells"))];
		if (cells == 0)
		{	// ran out of cells for power armor
			ent->flags &= ~(FL_POWER_SHIELD|FL_POWER_SCREEN);
			gi.sound(ent, CHAN_ITEM, gi.soundindex("misc/power2.wav"), 1, ATTN_NORM, 0);
			power_armor_type = 0;
		}
	}
	index = ArmorIndex (ent);
	// Knightmare- show correct icon
	if ((power_armor_type == POWER_ARMOR_SHIELD) && (!index || (level.framenum & 8) ) )
	{	// flash between power armor and other armor icon
		ent->client->ps.stats[STAT_ARMOR_ICON] = gi.imageindex ("i_powershield");
		ent->client->ps.stats[STAT_ARMOR] = cells;
	}
	else if ((power_armor_type == POWER_ARMOR_SCREEN) && (!index || (level.framenum & 8) ) )
	{	// flash between power armor and other armor icon
		ent->client->ps.stats[STAT_ARMOR_ICON] = gi.imageindex ("i_powerscreen");
		ent->client->ps.stats[STAT_ARMOR] = cells;
	}
	else if (index)
	{
		item = GetItemByIndex (index);
		ent->client->ps.stats[STAT_ARMOR_ICON] = gi.imageindex (item->icon);
		ent->client->ps.stats[STAT_ARMOR] = ent->client->pers.inventory[index];
	}
	else
	{
		ent->client->ps.stats[STAT_ARMOR_ICON] = 0;
		ent->client->ps.stats[STAT_ARMOR] = 0;
	}

	//
	// pickup message
	//
	if (level.time > ent->client->pickup_msg_time)
	{
		ent->client->ps.stats[STAT_PICKUP_ICON] = 0;
		ent->client->ps.stats[STAT_PICKUP_STRING] = 0;
	}

	//
	// timers
	//
	if (ent->client->quad_framenum > level.framenum)
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_quad");
		ent->client->ps.stats[STAT_TIMER] = (ent->client->quad_framenum - level.framenum)/10;
	}
	else if (ent->client->invincible_framenum > level.framenum)
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_invulnerability");
		ent->client->ps.stats[STAT_TIMER] = (ent->client->invincible_framenum - level.framenum)/10;
	}
	else if (ent->client->enviro_framenum > level.framenum)
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_envirosuit");
		ent->client->ps.stats[STAT_TIMER] = (ent->client->enviro_framenum - level.framenum)/10;
	}
	else if (ent->client->breather_framenum > level.framenum)
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_rebreather");
		ent->client->ps.stats[STAT_TIMER] = (ent->client->breather_framenum - level.framenum)/10;
	}
#ifdef JETPACK_MOD
	else if ( (ent->client->jetpack) &&
			  (!ent->client->jetpack_infinite) &&
			  (ent->client->pers.inventory[fuel_index] >= 0) &&
		      (ent->client->pers.inventory[fuel_index] < 100000))
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex("p_jet");
		ent->client->ps.stats[STAT_TIMER] = ent->client->pers.inventory[fuel_index];
	}
#endif
	else if (level.freeze)
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_freeze");
		ent->client->ps.stats[STAT_TIMER] = stasis_time->value - level.freezeframes/10;
	}
	else
	{
		ent->client->ps.stats[STAT_TIMER_ICON] = 0;
		ent->client->ps.stats[STAT_TIMER] = 0;
	}

	//
	// selected item
	//
	if (ent->client->pers.selected_item == -1)
		ent->client->ps.stats[STAT_SELECTED_ICON] = 0;
	else
		ent->client->ps.stats[STAT_SELECTED_ICON] = gi.imageindex (itemlist[ent->client->pers.selected_item].icon);

	ent->client->ps.stats[STAT_SELECTED_ITEM] = ent->client->pers.selected_item;

	// Lazarus vehicle/tracktrain
	// Knightmare- speed bar for CTF
	if (ctf->value)
	{
		if(ent->vehicle && !(ent->vehicle->spawnflags & 16))
		{
			switch(ent->vehicle->moveinfo.state)
			{
			case -3: ent->client->ps.stats[STAT_SPEED_CTF] = gi.imageindex("speedr3"); break;
			case -2: ent->client->ps.stats[STAT_SPEED_CTF] = gi.imageindex("speedr2"); break;
			case -1: ent->client->ps.stats[STAT_SPEED_CTF] = gi.imageindex("speedr1"); break;
			case  1: ent->client->ps.stats[STAT_SPEED_CTF] = gi.imageindex("speed1"); break;
			case  2: ent->client->ps.stats[STAT_SPEED_CTF] = gi.imageindex("speed2"); break;
			case  3: ent->client->ps.stats[STAT_SPEED_CTF] = gi.imageindex("speed3"); break;
			default: ent->client->ps.stats[STAT_SPEED_CTF] = gi.imageindex("speed0"); break;
			}
		}
		else
			ent->client->ps.stats[STAT_SPEED_CTF] = 0;
	}
	else
	{
		if(ent->vehicle && !(ent->vehicle->spawnflags & 16))
		{
			switch(ent->vehicle->moveinfo.state)
			{
			case -3: ent->client->ps.stats[STAT_SPEED] = gi.imageindex("speedr3"); break;
			case -2: ent->client->ps.stats[STAT_SPEED] = gi.imageindex("speedr2"); break;
			case -1: ent->client->ps.stats[STAT_SPEED] = gi.imageindex("speedr1"); break;
			case  1: ent->client->ps.stats[STAT_SPEED] = gi.imageindex("speed1"); break;
			case  2: ent->client->ps.stats[STAT_SPEED] = gi.imageindex("speed2"); break;
			case  3: ent->client->ps.stats[STAT_SPEED] = gi.imageindex("speed3"); break;
			default: ent->client->ps.stats[STAT_SPEED] = gi.imageindex("speed0"); break;
			}
		}
		else
			ent->client->ps.stats[STAT_SPEED] = 0;
	}

	// "whatsit"
	if (world->effects & FX_WORLDSPAWN_WHATSIT)
	{
		if (ent->client->showscores || ent->client->showhelp || ent->client->showinventory)
			ent->client->whatsit = NULL;
		else if(!(level.framenum % 5))    // only update every 1/2 second
		{
			char *temp = ent->client->whatsit;

			ent->client->whatsit = NULL;
			WhatIsIt(ent);
			if(ent->client->whatsit && !temp)
				WhatsIt(ent);
		}
	}
	else
		ent->client->whatsit = NULL;

	//
	// layouts
	//
	ent->client->ps.stats[STAT_LAYOUTS] = 0;

	if (deathmatch->value)
	{
		if (ent->client->pers.health <= 0 || level.intermissiontime
			|| ent->client->showscores)
			ent->client->ps.stats[STAT_LAYOUTS] |= 1;
		if (ent->client->showinventory && ent->client->pers.health > 0)
			ent->client->ps.stats[STAT_LAYOUTS] |= 2;
	}
	else
	{
		if (ent->client->showscores || ent->client->showhelp)
			ent->client->ps.stats[STAT_LAYOUTS] |= 1;
		if (ent->client->showinventory && ent->client->pers.health > 0)
			ent->client->ps.stats[STAT_LAYOUTS] |= 2;
	}
	if(!ent->client->ps.stats[STAT_LAYOUTS] && ent->client->whatsit)
		ent->client->ps.stats[STAT_LAYOUTS] |= 1;

	//
	// frags
	//
	ent->client->ps.stats[STAT_FRAGS] = ent->client->resp.score;

	//
	// help icon / current weapon if not shown
	//
	if (ent->client->pers.helpchanged && (level.framenum&8) )
		ent->client->ps.stats[STAT_HELPICON] = gi.imageindex ("i_help");
	else if ( (ent->client->pers.hand == CENTER_HANDED || ent->client->ps.fov > 91)
		&& ent->client->pers.weapon)
		ent->client->ps.stats[STAT_HELPICON] = gi.imageindex (ent->client->pers.weapon->icon);
	else
		ent->client->ps.stats[STAT_HELPICON] = 0;

	ent->client->ps.stats[STAT_SPECTATOR] = 0;

	if(ent->client->zoomed)
		ent->client->ps.stats[STAT_ZOOM] = gi.imageindex("zoom");
	else
		ent->client->ps.stats[STAT_ZOOM] = 0;

//ZOID
	SetCTFStats(ent);
//ZOID

	// Knightmare- show tech icon if in DM
	if (deathmatch->value && !ctf->value)
	{
		int i = 0;
		gitem_t *tech;

		ent->client->ps.stats[STAT_CTF_TECH] = 0;
		while (tnames[i]) {
			if ((tech = FindItemByClassname(tnames[i])) != NULL &&
				ent->client->pers.inventory[ITEM_INDEX(tech)])
			{
				ent->client->ps.stats[STAT_CTF_TECH] = gi.imageindex(tech->icon);
				break;
			}
			i++;
		}
	}
	// end Knightmare
}
Пример #23
0
void InitTestWeapon(void)
{
  FILE *wCfgFile;
  char fname[256];

  testWeapon = FindItemByClassname ("weapon_test");
  if(!testWeapon)
  {
    return;
  }

  strcpy(fname, gamedir->string);
  strcat(fname, "/testweapon.cfg");

  wCfgFile = fopen(fname, "rt");
  if(!wCfgFile)
  {
    return;
  }

  if(!fgets(testWeap_className, 256, wCfgFile))
  {
    fclose(wCfgFile);
    return;
  }

  testWeap_className[strlen(testWeap_className) - 1] = 0;

  if(!fgets(testWeap_gModel, 256, wCfgFile))
  {
    fclose(wCfgFile);
    return;
  }

  testWeap_gModel[strlen(testWeap_gModel) - 1] = 0;

  if(!fgets(testWeap_vModel, 256, wCfgFile))
  {
    fclose(wCfgFile);
    return;
  }

  testWeap_vModel[strlen(testWeap_vModel) - 1] = 0;

  if(!fgets(testWeap_icon, 256, wCfgFile))
  {
    fclose(wCfgFile);
    return;
  }

  testWeap_icon[strlen(testWeap_icon) - 1] = 0;

  if(!fgets(testWeap_name, 256, wCfgFile))
  {
    fclose(wCfgFile);
    return;
  }

  testWeap_name[strlen(testWeap_name) - 1] = 0;

  if(!fgets(testWeap_aminationFrames, 512, wCfgFile))
  {
    fclose(wCfgFile);
    return;
  }

  if(!fgets(testWeap_idleFrames, 512, wCfgFile))
  {
    fclose(wCfgFile);
    return;
  }

  if(!fgets(testWeap_fireFrames, 512, wCfgFile))
  {
    fclose(wCfgFile);
    return;
  }

  fclose(wCfgFile);


  sscanf(testWeap_aminationFrames, "%d,%d,%d,%d", &testWeap_FRAME_ACTIVATE_LAST, &testWeap_FRAME_FIRE_LAST, &testWeap_FRAME_IDLE_LAST, &testWeap_FRAME_DEACTIVATE_LAST);

  convertToNumbers(testWeap_idleFrames, testWeap_pause_frames);
  convertToNumbers(testWeap_fireFrames, testWeap_fire_frames);

  testWeapon->classname = testWeap_className;
  testWeapon->world_model = testWeap_gModel;
  testWeapon->view_model = testWeap_vModel;
  testWeapon->icon = testWeap_icon;
  testWeapon->pickup_name = testWeap_name;
}
Пример #24
0
void InitTestItem(void)
{
  FILE *wCfgFile;
  char fname[256];

  testItem = FindItemByClassname ("item_test");
  if(!testItem)
  {
    return;
  }

  strcpy(fname, gamedir->string);
  strcat(fname, "/testitem.cfg");

  wCfgFile = fopen(fname, "rt");
  if(!wCfgFile)
  {
    return;
  }

  if(!fgets(testItem_className, 256, wCfgFile))
  {
    fclose(wCfgFile);
    return;
  }

  testItem_className[strlen(testItem_className) - 1] = 0;

  if(!fgets(testItem_gModel, 256, wCfgFile))
  {
    fclose(wCfgFile);
    return;
  }

  testItem_gModel[strlen(testItem_gModel) - 1] = 0;

  if(!fgets(testItem_icon, 256, wCfgFile))
  {
    fclose(wCfgFile);
    return;
  }

  testItem_icon[strlen(testItem_icon) - 1] = 0;

  if(!fgets(testItem_name, 256, wCfgFile))
  {
    fclose(wCfgFile);
    return;
  }

  testItem_name[strlen(testItem_name) - 1] = 0;

  if(!fgets(testItem_aminationFramesStr, 4096, wCfgFile))
  {
    fclose(wCfgFile);
    return;
  }

  convertToNumbers(testItem_aminationFramesStr, testItem_aminationFrames);


  if(!fgets(testItem_aminationFramesStr, 4096, wCfgFile))
  {
    fclose(wCfgFile);
    return;
  }
  
  convertToVector(testItem_aminationFramesStr, &(testItem_Size[0]));

  if(!fgets(testItem_aminationFramesStr, 4096, wCfgFile))
  {
    fclose(wCfgFile);
    return;
  }
  
  convertToVector(testItem_aminationFramesStr, &(testItem_Size[1]));

  testItem->classname = testItem_className;
  testItem->world_model = testItem_gModel;
  testItem->view_model = testItem_gModel;
  testItem->icon = testItem_icon;
  testItem->pickup_name = testItem_name;
}
Пример #25
0
void station_dropitem (edict_t *self)
{
	int		index;
	float	health, armor, ammo;
	gitem_t	*item=NULL;
	edict_t *item_ent;

	// if there's nobody around, drop a random item
	if (!self->enemy)
	{
		// don't cause an entity overflow
		if (numNearbyEntities(self, 128, true) > 5)
			return;

		switch (GetRandom(1,3))
		{
		case 1: item_ent = SpawnHealthBox(self, HEALTHBOX_LARGE); break;
		case 2: item = FindItemByClassname("item_armor_combat"); break;
		case 3: item_ent = DropRandomAmmo(self); break;
		}

		if (item)	item_ent = Drop_Item(self, item);
	}
	else
	{
		health = HealthLevel(self->enemy);
		armor = ArmorLevel(self->enemy);

		// get ammo level for respawn weapon
		index = G_GetAmmoIndexByWeaponIndex(G_GetRespawnWeaponIndex(self->enemy));
		ammo = AmmoLevel(self->enemy, index);

		// if we have some ammo for respawn weapon, then get ammo level for equipped weapon
		if (ammo >= 0.25)
		{
			index = self->enemy->client->ammo_index;
			ammo = AmmoLevel(self->enemy, index);
		}

		// if we have full ammo AND we have a sentry built, make sure we
		// have some rockets or bullets to feed the sentry
		if ((ammo == 1.0) && PlayerHasSentry(self->enemy))
		{
			int bullet_ammo = self->enemy->client->pers.inventory[bullet_index];
			int rocket_ammo = self->enemy->client->pers.inventory[rocket_index];

			if (!bullet_ammo || !rocket_ammo)
			{
				if (!bullet_ammo)
					index = bullet_index;
				else if (!rocket_ammo)
					index = rocket_index;
				ammo = 0; // indicate that we need ammo dropped
			}
		}
		// drop health
		if ((health < 1) && (health <= armor) && (health <= ammo))
			item_ent = SpawnHealthBox(self, HEALTHBOX_LARGE);
		// drop armor
		else if ((armor < 1) && (armor <= health) && (armor <= ammo))
			item = FindItemByClassname("item_armor_combat");
		// drop ammo
		else if (index && (ammo < 1))
			item = GetItemByIndex(index);
		else
		{
			// drop armor shards or stimpaks
			if (random() > 0.5)
				item = FindItemByClassname("item_armor_shard");
			else
				item_ent = SpawnHealthBox(self, HEALTHBOX_SMALL);
		}

		// drop selected item
		if (item)
			item_ent = Drop_Item(self, item);
	}
}
Пример #26
0
/*QUAKED monster_brain (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
*/
void init_drone_brain (edict_t *self)
{
//	if (deathmatch->value)
//	{
//		G_FreeEdict (self);
//		return;
//	}

	sound_chest_open = gi.soundindex ("brain/brnatck1.wav");
	sound_tentacles_extend = gi.soundindex ("brain/brnatck2.wav");
	sound_tentacles_retract = gi.soundindex ("brain/brnatck3.wav");
	sound_death = gi.soundindex ("brain/brndeth1.wav");
	sound_idle1 = gi.soundindex ("brain/brnidle1.wav");
	sound_idle2 = gi.soundindex ("brain/brnidle2.wav");
	sound_idle3 = gi.soundindex ("brain/brnlens1.wav");
	sound_pain1 = gi.soundindex ("brain/brnpain1.wav");
	sound_pain2 = gi.soundindex ("brain/brnpain2.wav");
	sound_sight = gi.soundindex ("brain/brnsght1.wav");
	sound_search = gi.soundindex ("brain/brnsrch1.wav");
	sound_melee1 = gi.soundindex ("brain/melee1.wav");
	sound_melee2 = gi.soundindex ("brain/melee2.wav");
	sound_melee3 = gi.soundindex ("brain/melee3.wav");
	sound_thud = gi.soundindex ("player/land1.wav");

	self->monsterinfo.control_cost = M_BRAIN_CONTROL_COST;
	self->monsterinfo.cost = M_BRAIN_COST;
	self->movetype = MOVETYPE_STEP;
	self->solid = SOLID_BBOX;
	self->s.modelindex = gi.modelindex ("models/monsters/brain/tris.md2");
	VectorSet (self->mins, -16, -16, -24);
	VectorSet (self->maxs, 16, 16, 32);

	//if (self->activator && self->activator->client)
	self->health = 35 + 45*self->monsterinfo.level;
	//else self->health = 100 + 40*self->monsterinfo.level;

	self->max_health = self->health;
	self->gib_health = -100;
	self->mass = 400;

	self->item = FindItemByClassname("ammo_cells");

//	self->pain = mybrain_pain;
	self->die = mybrain_die;
//	self->touch = mybrain_touch;

	self->monsterinfo.stand = mybrain_stand;
	self->monsterinfo.walk = mybrain_walk;
	self->monsterinfo.run = mybrain_run;
	self->monsterinfo.dodge = mybrain_dodge;
	self->monsterinfo.attack = mybrain_attack;
	self->monsterinfo.melee = mybrain_melee;
	self->monsterinfo.sight = mybrain_sight;
//	self->monsterinfo.search = mybrain_search;
	//self->monsterinfo.idle = mybrain_idle;
	self->monsterinfo.jumpup = 64;
	self->monsterinfo.jumpdn = 512;

	self->monsterinfo.power_armor_type = POWER_ARMOR_SCREEN;

	//if (self->activator && self->activator->client)
		self->monsterinfo.power_armor_power = 150 + 150*self->monsterinfo.level;
	//else self->monsterinfo.power_armor_power = 300 + 120*self->monsterinfo.level;

	self->monsterinfo.max_armor = self->monsterinfo.power_armor_power;
	self->mtype = M_BRAIN;

	gi.linkentity (self);

	self->monsterinfo.aiflags |= AI_NO_CIRCLE_STRAFE;
	//self->monsterinfo.melee = 1;
	self->monsterinfo.currentmove = &mybrain_move_stand;	
	self->monsterinfo.scale = MODEL_SCALE;

//	walkmonster_start (self);
	self->nextthink = level.time + FRAMETIME;
}
Пример #27
0
void SP_item_weapon_katana(edict_t *self)
{
    SpawnItem(self,FindItemByClassname("weapon_katana"));
}
Пример #28
0
void
SV_CalcGunOffset(edict_t *ent)
{
	int i;
	float delta;
	static gitem_t *heatbeam;

	if (!ent)
	{
		return;
	}

	if (!heatbeam)
	{
		heatbeam = FindItemByClassname("weapon_plasmabeam");
	}

	/* heatbeam shouldn't bob so the beam looks right */
	if (ent->client->pers.weapon != heatbeam)
	{
		/* gun angles from bobbing */
		ent->client->ps.gunangles[ROLL] = xyspeed * bobfracsin * 0.005;
		ent->client->ps.gunangles[YAW] = xyspeed * bobfracsin * 0.01;

		if (bobcycle & 1)
		{
			ent->client->ps.gunangles[ROLL] = -ent->client->ps.gunangles[ROLL];
			ent->client->ps.gunangles[YAW] = -ent->client->ps.gunangles[YAW];
		}

		ent->client->ps.gunangles[PITCH] = xyspeed * bobfracsin * 0.005;

		/* gun angles from delta movement */
		for (i = 0; i < 3; i++)
		{
			delta = ent->client->oldviewangles[i] -
					ent->client->ps.viewangles[i];

			if (delta > 180)
			{
				delta -= 360;
			}

			if (delta < -180)
			{
				delta += 360;
			}

			if (delta > 45)
			{
				delta = 45;
			}

			if (delta < -45)
			{
				delta = -45;
			}

			if (i == YAW)
			{
				ent->client->ps.gunangles[ROLL] += 0.1 * delta;
			}

			ent->client->ps.gunangles[i] += 0.2 * delta;
		}
	}
	else
	{
		for (i = 0; i < 3; i++)
		{
			ent->client->ps.gunangles[i] = 0;
		}
	}

	/* gun height */
	VectorClear(ent->client->ps.gunoffset);

	/* gun_x / gun_y / gun_z are development tools */
	for (i = 0; i < 3; i++)
	{
		ent->client->ps.gunoffset[i] += forward[i] * (gun_y->value);
		ent->client->ps.gunoffset[i] += right[i] * gun_x->value;
		ent->client->ps.gunoffset[i] += up[i] * (-gun_z->value);
	}
}
Пример #29
0
/*QUAKED monster_chick (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
*/
void init_drone_bitch (edict_t *self)
{
	sound_missile_prelaunch	= gi.soundindex ("chick/chkatck1.wav");	
	sound_missile_launch	= gi.soundindex ("chick/chkatck2.wav");	
	sound_melee_swing		= gi.soundindex ("chick/chkatck3.wav");	
	sound_melee_hit			= gi.soundindex ("chick/chkatck4.wav");	
	sound_missile_reload	= gi.soundindex ("chick/chkatck5.wav");	
	sound_death1			= gi.soundindex ("chick/chkdeth1.wav");	
	sound_death2			= gi.soundindex ("chick/chkdeth2.wav");	
	sound_fall_down			= gi.soundindex ("chick/chkfall1.wav");	
	sound_idle1				= gi.soundindex ("chick/chkidle1.wav");	
	sound_idle2				= gi.soundindex ("chick/chkidle2.wav");	
	sound_pain1				= gi.soundindex ("chick/chkpain1.wav");	
	sound_pain2				= gi.soundindex ("chick/chkpain2.wav");	
	sound_pain3				= gi.soundindex ("chick/chkpain3.wav");	
	sound_sight				= gi.soundindex ("chick/chksght1.wav");	
	sound_search			= gi.soundindex ("chick/chksrch1.wav");	

	self->mtype = M_CHICK;
	self->monsterinfo.control_cost = M_CHICK_CONTROL_COST;
	self->monsterinfo.cost = M_CHICK_COST;

	self->movetype = MOVETYPE_STEP;
	self->solid = SOLID_BBOX;
	self->s.modelindex = gi.modelindex ("models/monsters/bitch/tris.md2");
	VectorSet (self->mins, -16, -16, 0);
	VectorSet (self->maxs, 16, 16, 56);
	
	if (self->activator && self->activator->client)
		self->health = 100 + 10*self->monsterinfo.level;
	else
		self->health = 65 + 15*self->monsterinfo.level;

	self->max_health = self->health;
	self->gib_health = -100;
	self->mass = 200;

	if (random() > 0.5)
		self->item = FindItemByClassname("ammo_rails");
	else
		self->item = FindItemByClassname("ammo_rockets");
	
	self->monsterinfo.power_armor_type = POWER_ARMOR_SHIELD;

	//if (self->activator && self->activator->client)
		self->monsterinfo.power_armor_power = 25 + 15*self->monsterinfo.level;
	//else self->monsterinfo.power_armor_power = 20*self->monsterinfo.level;

	self->monsterinfo.max_armor = self->monsterinfo.power_armor_power;

//	self->pain = mychick_pain;
	self->die = mychick_die;

	self->monsterinfo.stand = mychick_stand;
	self->monsterinfo.walk = chick_walk;
	self->monsterinfo.run = mychick_run;
//	self->monsterinfo.jump = mychick_jump;
	self->monsterinfo.jumpup = 64;
	self->monsterinfo.jumpdn = 512;
	self->monsterinfo.dodge = mychick_dodge;
	self->monsterinfo.attack = mychick_attack;
	//self->monsterinfo.melee = mychick_melee;
	self->monsterinfo.sight = mychick_sight;

	gi.linkentity (self);

	self->monsterinfo.currentmove = &mychick_move_stand;
	self->monsterinfo.scale = MODEL_SCALE;

//	walkmonster_start (self);
	self->nextthink = level.time + FRAMETIME;
}
Пример #30
0
void SP_item_weapon_type_99(edict_t *self)
{
    SpawnItem(self,FindItemByClassname("weapon_type_99"));
}