
#include "common.acs"

#define CURRENT_MAP 1


#include "pllrdoor.acs"


// PILLAR DROP ROOM
script 11 ( void )
{
	// DROP SMALL PILLARS ONE AT A TIME
	Floor_MoveToValueTimes8(const: 11, 255, 192, TRUE);
	tagwait(const: 11);
	Floor_MoveToValueTimes8(const: 12, 255, 192, TRUE);
	tagwait(const: 12);
	Floor_MoveToValueTimes8(const: 13, 255, 192, TRUE);
	tagwait(const: 13);
	Floor_MoveToValueTimes8(const: 14, 255, 192, TRUE);
	tagwait(const: 14);
	Floor_MoveToValueTimes8(const: 15, 255, 192, TRUE);
	tagwait(const: 15);
	Floor_MoveToValueTimes8(const: 16, 255, 192, TRUE);
	tagwait(const: 16);
	Floor_MoveToValueTimes8(const: 17, 255, 192, TRUE);
	tagwait(const: 17);
	Floor_MoveToValueTimes8(const: 18, 255, 192, TRUE);
	tagwait(const: 18);
	Floor_MoveToValueTimes8(const: 19, 255, 192, TRUE);
	tagwait(const: 19);
	Floor_MoveToValueTimes8(const: 20, 255, 192, TRUE);
	tagwait(const: 20);
	Floor_MoveToValueTimes8(const: 21, 255, 192, TRUE);
	tagwait(const: 21);
	Floor_MoveToValueTimes8(const: 22, 255, 192, TRUE);
	tagwait(const: 22);

	// DROP LARGE PILLAR
	Floor_MoveToValueTimes8(const: 23, 255, 192, TRUE);
	tagwait(const: 23);

	// MOVE POLY OBJECTS OUT OF THE WAY
	Polyobj_Move(const: 1, 32, 64, 64);
	Polyobj_Move(const: 3, 32, 64, 64);
	polywait(const: 4);

	delay(const: 1);

	// DROP CEILING
	Ceiling_LowerAndCrush(const: 24, 255, 255);
	tagwait(const: 24);

	// WAIT 3 SECONDS
	delay ( const: 105 );

	// OPEN OUTER HALLWAYS
	Polyobj_Move(const: 5, 32, 64, 128);
	polywait(const: 6);

	// RAISE PILLAR FLOORS TO ROOM FLOOR/CEILING LEVEL
	Floor_MoveToValueTimes8(const: 11, 128, 129, FALSE);
	Floor_MoveToValueTimes8(const: 12, 128, 129, FALSE);
	Floor_MoveToValueTimes8(const: 13, 128, 129, FALSE);
	Floor_MoveToValueTimes8(const: 14, 128, 129, FALSE);
	Floor_MoveToValueTimes8(const: 15, 128, 129, FALSE);
	Floor_MoveToValueTimes8(const: 16, 128, 129, FALSE);
	Floor_MoveToValueTimes8(const: 17, 128, 129, FALSE);
	Floor_MoveToValueTimes8(const: 18, 128, 129, FALSE);
	Floor_MoveToValueTimes8(const: 19, 128, 129, FALSE);
	Floor_MoveToValueTimes8(const: 20, 128, 129, FALSE);
	Floor_MoveToValueTimes8(const: 21, 128, 129, FALSE);
	Floor_MoveToValueTimes8(const: 22, 128, 129, FALSE);
	Floor_MoveToValueTimes8(const: 23, 128, 129, FALSE);
	tagwait(const: 23);

	delay(const: 175);

	// CLOSE OUTER HALLWAYS
	Polyobj_Move(const: 5, 32, 192, 128);
	polywait(const: 6);


	// RAISE PILLAR FLOORS AND CRUSH
	Floor_RaiseAndCrush(const: 11, 16, 50);
	Floor_RaiseAndCrush(const: 12, 16, 50);
	Floor_RaiseAndCrush(const: 13, 16, 50);
	Floor_RaiseAndCrush(const: 14, 16, 50);
	Floor_RaiseAndCrush(const: 15, 16, 50);
	Floor_RaiseAndCrush(const: 16, 16, 50);
	Floor_RaiseAndCrush(const: 17, 16, 50);
	Floor_RaiseAndCrush(const: 18, 16, 50);
	Floor_RaiseAndCrush(const: 19, 16, 50);
	Floor_RaiseAndCrush(const: 20, 16, 50);
	Floor_RaiseAndCrush(const: 21, 16, 50);
	Floor_RaiseAndCrush(const: 22, 16, 50);
	Floor_RaiseAndCrush(const: 23, 16, 50);


	// RAISE ROOM CEILING WITH PILLARS
	Ceiling_MoveToValueTimes8(const: 24, 16, 160, FALSE);
	tagwait(const: 24);

	delay(const: 35);

	// MOVE POLY OBJECTS INTO PLACE
	Polyobj_Move(const: 1, 32, 192, 64);
	Polyobj_Move(const: 3, 32, 192, 64);
	polywait(const: 4);


	// OPEN DOOR
	ACS_Execute(5, CURRENT_MAP, 25, 128, 10);
	scriptwait(const: 5);

}  // END SCRIPT 11


// ICON TRAP START MOVING WALLS
script 30 ( void )
{
	// START NORTH WALL MOVING
	ACS_Execute(const: 31, CURRENT_MAP, 0, 0, 0);

	// START SOUTH WALL MOVING
	ACS_Execute(const: 32, CURRENT_MAP, 0, 0, 0);

	// START EAST WALL MOVING
	ACS_Execute(const: 33, CURRENT_MAP, 0, 0, 0);

	// START CRUSHING CEILINGS
	ACS_Execute(const: 34, CURRENT_MAP, 0, 0, 0);

}  // END SCRIPT 30 (ICON TRAP MOVING WALLS)


// ICON TRAP NORTH WALL
script 31 ( void )
{
	int i;


	while ( i++ < 8 )
	{
		// MOVE NORTH WALL SOUTH
		Polyobj_Move(const: 7, 16, 192, 64);
		polywait(const: 7);

		// MOVE NORTH WALL NORTH
		Polyobj_Move(const: 7, 16, 64, 64);
		polywait(const: 7);
	}

}  // END SCRIPT 31


// ICON TRAP SOUTH WALL
script 32 ( void )
{
	int i;

	while ( i++ < 8 )
	{
		// MOVE SOUTH WALL NORTH
		Polyobj_Move(const: 8, 16, 64, 64);
		polywait(const: 8);

		// MOVE SOUTH WALL SOUTH
		Polyobj_Move(const: 8, 16, 192, 64);
		polywait(const: 8);
	}

}  // END SCRIPT 32 (ICON TRAP MOVING WALLS)



script 33 ( void )
{
	int i;


	while ( i++ < 8 )
	{
		// CRUSH STANDING SECTOR
		Ceiling_CrushRaiseAndStay(const: 32, 64, 20);
		delay ( const: 15 );

		// CRUSH STANDING SECTOR
		Ceiling_CrushRaiseAndStay(const: 33, 64, 20);
		tagwait(const: 33);
	}

}  // END SCRIPT 33


// ICON TRAP EAST WALL
script 34 ( void )
{
	int i;


	while ( i++ < 2 )
	{
		// MOVE 
		Polyobj_Move(const: 9, 16, 128, 128);
		polywait(const: 9);

		// MOVE 
		Polyobj_Move(const: 9, 16, 0, 128);
		polywait(const: 9);

		// MOVE 
		Polyobj_Move(const: 9, 16, 128, 128);
		polywait(const: 9);

		// MOVE 
		Polyobj_Move(const: 9, 16, 0, 128);
		polywait(const: 9);

		// MOVE 
		Polyobj_Move(const: 9, 16, 0, 128);
		polywait(const: 9);

		// MOVE 
		Polyobj_Move(const: 9, 16, 128, 128);
		polywait(const: 9);
	}

}  // END SCRIPT 34 (ICON TRAP EAST WALL)


// OCTAGON ROOM FLOOR RAISE/LOWER)
int miFloorUpFlag;
script 16 ( int iToggle )
{
	if ( iToggle == 1 && miFloorUpFlag == FALSE )
	{
		// RAISE OCTAGON FLOOR
		Floor_MoveToValueTimes8(const: 35, 64, 125, FALSE);
		tagwait(const: 35);

		// SET FLOOR UP FLAG
		miFloorUpFlag = TRUE;
	}
	else if ( iToggle == 0 && miFloorUpFlag == TRUE )
	{
		// LOWER OCTAGON FLOOR
		Floor_MoveToValueTimes8(const: 35, 64, 240, TRUE);
		tagwait(const: 35);

		// CLEAR FLOOR UP FLAG
		miFloorUpFlag = FALSE;
	}

}  // END SCRIPT 16 (OCTAGON ROOM FLOOR RAISE/LOWER)


// CRUSHING BOOTH
int miBooth;
script 18 ( int iDirection )
{
	if ( miBooth == 0 ) miBooth = 2;


	if ( iDirection == 1 && miBooth < 3 )
	{
		Polyobj_Move(const: 10, 64, 64, 128);
		polywait(const: 10);

		miBooth++;
	}

	if ( iDirection == 0 && miBooth > 1 )
	{
		Polyobj_Move(const: 10, 64, 192, 128);
		polywait(const: 10);

		miBooth--;
	}

	// CRUSH BOOTH 
	Ceiling_CrushRaiseAndStay( 50 + miBooth, 32, 10);

}  // END SCRIPT 18 (CRUSHING BOOTH)


// FIREBALL ROOM
script 19 OPEN
{
	// SOUTH + NORTH
	setlinetexture(1, SIDE_FRONT, TEXTURE_MIDDLE, "spawn09");
	delay(const: 3);
	setlinetexture(1, SIDE_FRONT, TEXTURE_MIDDLE, "spawn10");
	delay(const: 3);

	thingsound(170, "FireDemonAttack", 127);
	delay(const: 1);
	thingsound(171, "FireDemonAttack", 127);
	delay(const: 1);
	Thing_Projectile(const: 170, T_FIREBALL1, 192, 128, 0);
	Thing_Projectile(const: 171, T_FIREBALL1, 64, 128, 0);

	delay(const: 3);
	setlinetexture(1, SIDE_FRONT, TEXTURE_MIDDLE, "spawn08");
	delay(const: 16);


	// WEST
	setlinetexture(3, SIDE_FRONT, TEXTURE_MIDDLE, "spawn09");
	delay(const: 3);
	setlinetexture(3, SIDE_FRONT, TEXTURE_MIDDLE, "spawn10");
	delay(const: 3);

	thingsound(174, "FireDemonAttack", 127);
	delay(const: 1);
	Thing_Projectile(const: 174, T_FIREBALL1, 128, 128, 0);

	delay(const: 3);
	setlinetexture(3, SIDE_FRONT, TEXTURE_MIDDLE, "spawn08");
	delay(const: 16);


	// NORTH + SOUTH
	setlinetexture(2, SIDE_FRONT, TEXTURE_MIDDLE, "spawn09");
	delay(const: 3);
	setlinetexture(2, SIDE_FRONT, TEXTURE_MIDDLE, "spawn10");
	delay(const: 3);

	thingsound(172, "FireDemonAttack", 127);
	delay(const: 1);
	thingsound(173, "FireDemonAttack", 127);
	delay(const: 1);
	Thing_Projectile(const: 172, T_FIREBALL1, 192, 128, 0);
	Thing_Projectile(const: 173, T_FIREBALL1, 64, 128, 0);

	delay(const: 3);
	setlinetexture(2, SIDE_FRONT, TEXTURE_MIDDLE, "spawn08");
	delay(const: 16);


	// EAST + WEST
	setlinetexture(4, SIDE_FRONT, TEXTURE_MIDDLE, "spawn09");
	delay(const: 3);
	setlinetexture(4, SIDE_FRONT, TEXTURE_MIDDLE, "spawn10");
	delay(const: 3);

	thingsound(175, "FireDemonAttack", 127);
	delay(const: 1);
	thingsound(176, "FireDemonAttack", 127);
	delay(const: 1);
	Thing_Projectile(const: 175, T_FIREBALL1, 0, 128, 0);
	Thing_Projectile(const: 176, T_FIREBALL1, 128, 128, 0);

	delay(const: 3);
	setlinetexture(4, SIDE_FRONT, TEXTURE_MIDDLE, "spawn08");
	delay(const: 16);

	restart;

}  // END SCRIPT 19 (FIREBALL ROOM)


// SOUTH CRUSHER TRIP WIRE
script 22 ( void )
{
	delay(const: 35);
	Ceiling_LowerAndCrush(const: 10, 128, 10);
	tagwait(const: 10);
	Ceiling_MoveToValueTimes8(const: 10, 128, 128, FALSE);
	tagwait(const: 10);

	delay(const: 70);

	Ceiling_MoveToValueTimes8(const: 10, 64, 142, FALSE);
	tagwait(const: 10);

}  // END SCRIPT 22 (SOUTH CRUSHER TRIP WIRE)


script 23 OPEN
{
	ambientsound("Ambient13", 127);
	printbold(s: "MAP CREATED BY JOHN FRENCH");
}
