//{ //HEADER
// Rocket Chamber - combined script
// script and map by elypter
// for details look at rocket_chamber_readme.txt

// this is the a combined file with all modes. the final scripts are generated from that.

//todo

//not yet commited changes

/*
//close whole in roof over respawn points

IF(HAS_CHARACTER_DIED(p1))
		//{ //all
			CHANGE_BLOCK TYPE (26, 26, 1) FIELD 0
			CHANGE_BLOCK TYPE (26, 34, 1) FIELD 0
			CHANGE_BLOCK TYPE (34, 26, 1) FIELD 0
			CHANGE_BLOCK TYPE (34, 34, 1) FIELD 0
		//}
	ENDIF
	
//reduce rocket death flight
	
OBJ_DATA twr1 = (30.4, 29.6, 2.9) 0 TOWER
OBJ_DATA twr2 = (30.9, 29.6, 2.9) 0 TOWER
OBJ_DATA twr3 = (30.9, 29.6, 2.9) 0 TOWER
OBJ_DATA twr4 = (29.4, 30.5, 2.9) 0 TOWER
OBJ_DATA twr5 = (29.7, 30.5, 2.9) 0 TOWER
OBJ_DATA twr6 = (30.0, 30.5, 2.9) 0 TOWER	
	
	
*/
	
//}

//{ //Declares

//{ //all
//{ //player
PLAYER_PED p1 = (29.5, 30.5, 1.0) 9 270
PLAYER_PED p2 = (31.5, 30.5, 1.0) 9 90
PLAYER_PED p3 = (31.0, 29.5, 1.0) 9 135
PLAYER_PED p4 = (30.0, 31.5, 1.0) 9 315
PLAYER_PED p5 = (30.0, 29.5, 1.0) 9 225
PLAYER_PED p6 = (31.0, 31.5, 1.0) 9 45
//}

OBJ_DATA name = (30.5, 24.2, 1.0) 0 FOOTY //Radio

COUNTER mainloop = 1
COUNTER temp = 0
COUNTER temp2 =0
COUNTER rand = 0
COUNTER tmr = 0
COUNTER roof_tmr = 0

COUNTER dsum = 0
COUNTER psum = 0

//doors - you cannot shoot rockets through them or bots cannot walk through them
DECLARE_DOOR_INFO ( 32 , 35 , 2 )
DECLARE_DOOR_INFO ( 31 , 35 , 2 )
DOOR_DATA door_1 = SINGLE (23, 30, 1) (24.0, 30.5, 1.0, 2.0, 1.0) RIGHT 0 ANY_PLAYER CLOSE_WHEN_OPEN_RULE_FAILS 0 FLIP_RIGHT NOT_REVERSED
DOOR_DATA door_2 = SINGLE (37, 30, 1) (37.0, 30.5, 1.0, 2.0, 1.0) LEFT 0 ANY_PLAYER CLOSE_WHEN_OPEN_RULE_FAILS 0 FLIP_RIGHT NOT_REVERSED

//debug
ONSCREEN_COUNTER dummy_osc
//}

//}

LEVELSTART

WHILE_EXEC (mainloop = 1)
++tmr
++rand
IF(tmr = 1)

//{ //all
ADD_NEW_BLOCK  (  22 ,  29 ,  5   )
CHANGE_BLOCK TYPE (22, 29, 5) AIR 43
CHANGE_BLOCK LID (22, 29, 5) NOT_FLAT NOT_FLIP 0 270 1

ADD_NEW_BLOCK  (  22 ,  31 ,  5   )
CHANGE_BLOCK TYPE (22, 31, 5) AIR 43
CHANGE_BLOCK LID (22, 31, 5) NOT_FLAT NOT_FLIP 0 270 1

ADD_NEW_BLOCK  (  38 ,  29 ,  5   )
CHANGE_BLOCK TYPE (38, 29, 5) AIR 44
CHANGE_BLOCK LID (38, 29, 5) NOT_FLAT NOT_FLIP 3 90 1

ADD_NEW_BLOCK  (  38 ,  31 ,  5   )
CHANGE_BLOCK TYPE (38, 31, 5) AIR 44
CHANGE_BLOCK LID (38, 31, 5) NOT_FLAT NOT_FLIP 3 90 1

//}

//{ //not hd

ADD_NEW_BLOCK  (  30 ,  30 ,  1   )
CHANGE_BLOCK TYPE (30, 30, 1) AIR 0
CHANGE_BLOCK LID (30, 30, 1) NOT_FLAT NOT_FLIP 0 0 4
CHANGE_BLOCK SIDE (30, 30, 1) TOP WALL BULLET NOT_FLAT NOT_FLIP 0 4
CHANGE_BLOCK SIDE (30, 30, 1) BOTTOM WALL BULLET NOT_FLAT NOT_FLIP 0 4
CHANGE_BLOCK SIDE (30, 30, 1) LEFT WALL BULLET NOT_FLAT NOT_FLIP 0 4
CHANGE_BLOCK SIDE (30, 30, 1) RIGHT WALL BULLET NOT_FLAT NOT_FLIP 0 4
//}

//{ //none
DISPLAY_BRIEF ( 1606 )
//}

ENDIF

//{ //Player Check
IF (CHECK_CHARACTER_HEALTH(p1, 0))
	//{ //all
	GIVE_WEAPON (  p1 , rocket_launcher, 99 )
	IF ( LOCATE_CHARACTER_ANY_MEANS ( p1, 22.5, 30.5, 1.0, 1.0, 1.0) )
		WARP_FROM_CAR_TO_POINT ( p1, 37.5, 30.5, 1.0, 270 )
	ENDIF
	IF ( LOCATE_CHARACTER_ANY_MEANS ( p1, 38.5, 30.5, 1.0, 1.0, 1.0) )
		WARP_FROM_CAR_TO_POINT ( p1, 23.5, 30.5, 1.0, 90 )
	ENDIF
	
	IF (IS_CHAR_FIRING_ONSCREEN(p1))
		SET temp = ( rand / 3 )
		SET temp = ( temp * 3 )
		SET rand= ( rand - temp )
	ENDIF
	SET psum = (psum+1)
	IF(HAS_CHARACTER_DIED(p1))
		SET dsum = (dsum+1)
	ENDIF
	//}

ENDIF

IF (CHECK_CHARACTER_HEALTH(p2, 0))
	//{ //all
	GIVE_WEAPON (  p2 , rocket_launcher, 99 )
	IF ( LOCATE_CHARACTER_ANY_MEANS ( p2, 22.5, 30.5, 1.0, 1.0, 1.0) )
		WARP_FROM_CAR_TO_POINT ( p2, 37.5, 30.5, 1.0, 270 )
	ENDIF
	IF ( LOCATE_CHARACTER_ANY_MEANS ( p2, 38.5, 30.5, 1.0, 1.0, 1.0) )
		WARP_FROM_CAR_TO_POINT ( p2, 23.5, 30.5, 1.0, 90 )
	ENDIF
	
	IF (IS_CHAR_FIRING_ONSCREEN(p2))
		SET temp = ( rand / 3 )
		SET temp = ( temp * 3 )
		SET rand= ( rand - temp )
	ENDIF
	SET psum = (psum+1)
	IF(HAS_CHARACTER_DIED(p2))
		SET dsum = (dsum+1)
	ENDIF
	//}

ENDIF

IF (CHECK_CHARACTER_HEALTH(p3, 0))
	//{ //all
	GIVE_WEAPON (  p3 , rocket_launcher, 99 )
	IF ( LOCATE_CHARACTER_ANY_MEANS ( p3, 22.5, 30.5, 1.0, 1.0, 1.0) )
		WARP_FROM_CAR_TO_POINT ( p3, 37.5, 30.5, 1.0, 270 )
	ENDIF
	IF ( LOCATE_CHARACTER_ANY_MEANS ( p3, 38.5, 30.5, 1.0, 1.0, 1.0) )
		WARP_FROM_CAR_TO_POINT ( p3, 23.5, 30.5, 1.0, 90 )
	ENDIF
	
	IF (IS_CHAR_FIRING_ONSCREEN(p3))
		SET temp = ( rand / 3 )
		SET temp = ( temp * 3 )
		SET rand= ( rand - temp )
	ENDIF
	SET psum = (psum+1)
	IF(HAS_CHARACTER_DIED(p3))
		SET dsum = (dsum+1)
	ENDIF
	//}

ENDIF

IF (CHECK_CHARACTER_HEALTH(p4, 0))
	//{ //all
	GIVE_WEAPON (  p4 , rocket_launcher, 99 )
	IF ( LOCATE_CHARACTER_ANY_MEANS ( p4, 22.5, 30.5, 1.0, 1.0, 1.0) )
		WARP_FROM_CAR_TO_POINT ( p4, 37.5, 30.5, 1.0, 270 )
	ENDIF
	IF ( LOCATE_CHARACTER_ANY_MEANS ( p4, 38.5, 30.5, 1.0, 1.0, 1.0) )
		WARP_FROM_CAR_TO_POINT ( p4, 23.5, 30.5, 1.0, 90 )
	ENDIF
	
	IF (IS_CHAR_FIRING_ONSCREEN(p4))
		SET temp = ( rand / 3 )
		SET temp = ( temp * 3 )
		SET rand= ( rand - temp )
	ENDIF
	SET psum = (psum+1)
	IF(HAS_CHARACTER_DIED(p4))
		SET dsum = (dsum+1)
	ENDIF
	//}

ENDIF

IF (CHECK_CHARACTER_HEALTH(p5, 0))
	//{ //all
	GIVE_WEAPON (  p5 , rocket_launcher, 99 )
	IF ( LOCATE_CHARACTER_ANY_MEANS ( p5, 22.5, 30.5, 1.0, 1.0, 1.0) )
		WARP_FROM_CAR_TO_POINT ( p5, 37.5, 30.5, 1.0, 270 )
	ENDIF
	IF ( LOCATE_CHARACTER_ANY_MEANS ( p5, 38.5, 30.5, 1.0, 1.0, 1.0) )
		WARP_FROM_CAR_TO_POINT ( p5, 23.5, 30.5, 1.0, 90 )
	ENDIF
	
	IF (IS_CHAR_FIRING_ONSCREEN(p5))
		SET temp = ( rand / 3 )
		SET temp = ( temp * 3 )
		SET rand= ( rand - temp )
	ENDIF
	SET psum = (psum+1)
	IF(HAS_CHARACTER_DIED(p5))
		SET dsum = (dsum+1)
	ENDIF
	//}

ENDIF

IF (CHECK_CHARACTER_HEALTH(p6, 0))
	//{ //all
	GIVE_WEAPON (  p6 , rocket_launcher, 99 )
	IF ( LOCATE_CHARACTER_ANY_MEANS ( p6, 22.5, 30.5, 1.0, 1.0, 1.0) )
		WARP_FROM_CAR_TO_POINT ( p6, 37.5, 30.5, 1.0, 270 )
	ENDIF
	IF ( LOCATE_CHARACTER_ANY_MEANS ( p6, 38.5, 30.5, 1.0, 1.0, 1.0) )
		WARP_FROM_CAR_TO_POINT ( p6, 23.5, 30.5, 1.0, 90 )
	ENDIF
	
	IF (IS_CHAR_FIRING_ONSCREEN(p6))
		SET temp = ( rand / 3 )
		SET temp = ( temp * 3 )
		SET rand= ( rand - temp )
	ENDIF
	SET psum = (psum+1)
	IF(HAS_CHARACTER_DIED(p6))
		SET dsum = (dsum+1)
	ENDIF
	//}

ENDIF
//}

//{ //all
IF (dsum = 0)
	IF (roof_tmr>1)
		--roof_tmr
	ENDIF
	IF (roof_tmr=1)
		CHANGE_BLOCK TYPE (26, 26, 1) FIELD 0
		CHANGE_BLOCK TYPE (26, 34, 1) FIELD 0
		CHANGE_BLOCK TYPE (34, 26, 1) FIELD 0
		CHANGE_BLOCK TYPE (34, 34, 1) FIELD 0
		SET roof_tmr=0
	ENDIF
ENDIF
IF (dsum > 0)
	SET roof_tmr=100
	CHANGE_BLOCK TYPE (26, 26, 1) AIR 0
	CHANGE_BLOCK TYPE (26, 34, 1) AIR 0
	CHANGE_BLOCK TYPE (34, 26, 1) AIR 0
	CHANGE_BLOCK TYPE (34, 34, 1) AIR 0
ENDIF
//}

ENDWHILE

LEVELEND

//SUBS
