void actMinotaurTrap(Entity* my)
{
	if ( !my->skill[28] )
	{
		return;
	}

	// received on signal
	if ( my->skill[28] == 2)
	{
		if ( !MINOTAURTRAP_FIRED )
		{
			Entity* monster = summonMonster(MINOTAUR, my->x, my->y);
			if ( monster )
			{
				MINOTAURTRAP_FIRED = 1;
				if ( strcmp(map.name, "Hell Boss") )
				{
					int c;
					for ( c = 0; c < MAXPLAYERS; c++ )
					{
						playSoundPlayer( c, 107 + rand() % 3, 128 );
						Uint32 color = SDL_MapRGB(mainsurface->format, 255, 128, 0);
						messagePlayerColor(c, color, language[1113]);
					}
				}
			}
		}
	}
}
Exemple #2
0
void Entity::actSoundSource()
{
#ifdef SOUND
	if ( multiplayer == CLIENT )
	{
		return;
	}

	if ( soundSourceDelay > 0 && soundSourceDelayCounter == 0 )
	{
		soundSourceDelayCounter = soundSourceDelay;
	}

	if ( circuit_status == CIRCUIT_ON )
	{
		// received power
		if ( soundSourceDelayCounter > 0 )
		{
			--soundSourceDelayCounter;
			if ( soundSourceDelayCounter != 0 )
			{
				return;
			}
		}
		if ( !soundSourceFired )
		{
			soundSourceFired = 1;
			if ( soundSourceToPlay >= 0 && soundSourceToPlay < numsounds )
			{
				if ( soundSourceOrigin == 1 )
				{
					for ( int c = 0; c < MAXPLAYERS; ++c )
					{
						playSoundPlayer(c, soundSourceToPlay, soundSourceVolume);
					}
				}
				else
				{
					playSoundEntity(this, soundSourceToPlay, soundSourceVolume);
				}
			}
		}
	}
	else if ( circuit_status == CIRCUIT_OFF )
	{
		if ( soundSourceDelay > 0 )
		{
			soundSourceDelayCounter = soundSourceDelay;
		}
		if ( soundSourceFired && !soundSourceLatchOn )
		{
			soundSourceFired = 0;
		}
	}
#endif // SOUND
}
void minotaurDie(Entity* my)
{
	int c;
	for ( c = 0; c < 5; c++ )
	{
		Entity* gib = spawnGib(my);
		serverSpawnGibForClient(gib);
	}

	my->spawnBlood();

	for ( c = 0; c < MAXPLAYERS; c++ )
	{
		playSoundPlayer(c, 114, 128);
	}

	my->removeMonsterDeathNodes();

	list_RemoveNode(my->mynode);
	return;
}
void actMinotaurTimer(Entity* my)
{
	node_t* node;

	MINOTAURTIMER_LIFE++;
	if (( (currentlevel < 25 && MINOTAURTIMER_LIFE == TICKS_PER_SECOND * 120)
			|| (currentlevel >= 25 && MINOTAURTIMER_LIFE == TICKS_PER_SECOND * 180)
		)
		&& rand() % 5 == 0 )   // two minutes if currentlevel < 25, else 3 minutes.
	{
		int c;
		bool spawnedsomebody = false;
		for ( c = 0; c < 9; c++ )
		{
			Uint32 zapLeaderUid = 0;
			Entity* monster = summonMonster(HUMAN, my->x, my->y);
			if ( monster )
			{
				monster->skill[29] = 1; // so we spawn a zap brigadier
				spawnedsomebody = true;
				if ( !zapLeaderUid )
				{
					zapLeaderUid = monster->getUID();
				}
				else
				{
					Stat* monsterStats = monster->getStats();
					monsterStats->leader_uid = zapLeaderUid;
				}
			}
		}

		if ( spawnedsomebody )
		{
#ifdef MUSIC
			fadein_increment = default_fadein_increment * 20;
			fadeout_increment = default_fadeout_increment * 5;
			playmusic( sounds[175], false, true, false);
#endif
			for ( c = 0; c < MAXPLAYERS; c++ )
			{
				Uint32 color = SDL_MapRGB(mainsurface->format, 0, 255, 255);
				if ( stats[c]->type == HUMAN )
				{
					messagePlayerColor(c, color, language[1114], stats[c]->name);
				}
				else
				{
					messagePlayerColor(c, color, language[3285]);
				}
			}
		}
	}
	else if (( (currentlevel < 25 && MINOTAURTIMER_LIFE >= TICKS_PER_SECOND * 150)
					|| (currentlevel >= 25 && MINOTAURTIMER_LIFE >= TICKS_PER_SECOND * 210)
				)
		&& !MINOTAURTIMER_ACTIVE )     // two and a half minutes if currentlevel < 25, else 3.5 minutes
	{
		Entity* monster = summonMonster(MINOTAUR, my->x, my->y);
		if ( monster )
		{
			int c;
			for ( c = 0; c < MAXPLAYERS; c++ )
			{
				playSoundPlayer( c, 107 + rand() % 3, 128 );
				Uint32 color = SDL_MapRGB(mainsurface->format, 255, 128, 0);
				messagePlayerColor(c, color, language[1115]);
			}
			MINOTAURTIMER_ACTIVE = MINOTAURTIMER_LIFE;
		}
	}
	if ( MINOTAURTIMER_ACTIVE && MINOTAURTIMER_LIFE >= MINOTAURTIMER_ACTIVE + TICKS_PER_SECOND * 3 )
	{
		int c;
		for ( c = 0; c < MAXPLAYERS; c++ )
		{
			if ( currentlevel < 25 )
			{
				playSoundPlayer(c, 120 + rand() % 3, 128);
				Uint32 color = SDL_MapRGB(mainsurface->format, 255, 0, 255);
				messagePlayerColor(c, color, language[1116]);
				messagePlayerColor(c, color, language[73]);
			}
			else
			{
				playSoundPlayer(c, 375, 128);
				playSoundPlayer(c, 379, 128);
				messagePlayerColor(c, uint32ColorOrange(*mainsurface), language[1116]);
				messagePlayerColor(c, uint32ColorOrange(*mainsurface), language[73]);
				messagePlayerColor(c, uint32ColorBaronyBlue(*mainsurface), language[73]);
			}
		}
		list_RemoveNode(my->mynode);
		return;
	}
}
Exemple #5
0
void actBoulderTrap(Entity *my) {
	int x, y;
	int c;

	BOULDERTRAP_AMBIENCE--;
	if( BOULDERTRAP_AMBIENCE<=0 ) {
		BOULDERTRAP_AMBIENCE = TICKS_PER_SECOND*30;
		playSoundEntity( my, 149, 64 );
	}
	
	if( !my->skill[28] )
		return;

	// received on signal
	if( my->skill[28] == 2) {
		if( !BOULDERTRAP_FIRED ) {
			playSoundEntity(my, 150, 128);
			for( c=0; c<MAXPLAYERS; c++ )
				playSoundPlayer(c, 150, 64);
			BOULDERTRAP_FIRED = 1;
			for( c=0; c<4; c++ ) {
				switch( c ) {
					case 0:
						x = 16;
						y = 0;
						break;
					case 1:
						x = 0;
						y = 16;
						break;
					case 2:
						x = -16;
						y = 0;
						break;
					case 3:
						x = 0;
						y = -16;
						break;
				}
				x = ((int)(x+my->x))>>4;
				y = ((int)(y+my->y))>>4;
				if( x>=0 && y>=0 && x<map.width && y<map.height ) {
					if( !map.tiles[OBSTACLELAYER+y*MAPLAYERS+x*MAPLAYERS*map.height] ) {
						Entity *entity = newEntity(245, 1, map.entities); // boulder
						entity->parent = my->uid;
						entity->x = (x<<4)+8;
						entity->y = (y<<4)+8;
						entity->z = -64;
						entity->yaw = c*(PI/2.f);
						entity->sizex = 7;
						entity->sizey = 7;
						if( checkObstacle( entity->x+cos(entity->yaw)*16, entity->y+sin(entity->yaw)*16, entity, NULL ) ) {
							entity->yaw += PI*(rand()%2)-PI/2;
							if( entity->yaw >= PI*2 )
								entity->yaw -= PI*2;
							else if( entity->yaw < 0 )
								entity->yaw += PI*2;
						}
						entity->behavior = &actBoulder;
						entity->flags[UPDATENEEDED] = TRUE;
						entity->flags[PASSABLE] = TRUE;
					}
				}
			}
		}
	}