// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Transport Tube Object
// Script Author: Christan Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 56 : TYPE_TRANSPORTTUBE

// Function declarations
reserve function TransportTube_Function135

// Static Values

// Tables
public table TransportTube_table46
	160, 256, 288
end table

public table TransportTube_table47
	2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 1, 2, 1
	
end table

public table TransportTube_table48
	29, 23, 29, 23, 28, 23, 28, 23, 29, 23, 29, 23
end table

public table TransportTube_table50
	5, 5, 10, 5, 5, 5, 4, 6, 6, 4, 4, 6, 5, 3, 7
end table

public table TransportTube_table49
	2, 1, 0, 0, -1, 3, 0, 0, 4, -2, 0, 0, -3, -4, 0, 0
	-5, -5, 0, 0, 7, 6, 0, 0, -7, -6, 0, 0, 8, 9, 0, 0
	-8, -9, 0, 0, 11, 10, 0, 0, 12, 0, 0, 0, -11, -10, 0, 0
	-12, 0, 0, 0, 0, 13, 0, 0, -13, 14, 0, 0, 0, -14, 0, 0
	
end table

public table TransportTube_table44
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
end table

public table TransportTube_table45
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
end table

private table TransportTube_table0
	0x900000, 0x100000, 0x900000, 0x700000, 0x400000, 0x700000, 0x350000, 0x6F0000, 0x280000, 0x6A0000, 0x1E0000, 0x620000, 0x150000, 0x580000, 0x110000, 0x4A0000, 0x100000, 0x400000, 0x110000, 0x350000, 0x150000, 0x270000, 0x1E0000, 0x1E0000, 0x280000, 0x150000, 0x350000, 0x110000, 0x400000, 0x100000, 0x500000, 0x100000, 0x5E0000, 0x120000, 0x680000, 0x180000, 0x6D0000, 0x240000, 0x700000, 0x300000, 0x6D0000, 0x3D0000, 0x680000, 0x480000, 0x5E0000, 0x4E0000, 0x500000, 0x500000, 0x300000, 0x500000, 0x220000, 0x520000, 0x170000, 0x5A0000, 0x110000, 0x630000, 0x100000, 0x700000
end table

private table TransportTube_table1
	0x900000, 0x100000, 0x900000, 0x700000, 0x400000, 0x700000, 0x2E0000, 0x6E0000, 0x1D0000, 0x620000, 0x130000, 0x530000, 0x100000, 0x400000, 0x130000, 0x2D0000, 0x1D0000, 0x1E0000, 0x2E0000, 0x130000, 0x400000, 0x100000, 0x580000, 0x100000, 0x640000, 0x140000, 0x6C0000, 0x1A0000, 0x700000, 0x280000, 0x6C0000, 0x360000, 0x640000, 0x3C0000, 0x580000, 0x400000, 0x4B0000, 0x3D0000, 0x400000, 0x380000, 0x360000, 0x320000, 0x280000, 0x300000, 0x100000, 0x300000
end table

private table TransportTube_table2
	0x100000, 0x700000, 0x110000, 0x630000, 0x170000, 0x5A0000, 0x220000, 0x520000, 0x300000, 0x500000, 0x500000, 0x500000, 0x5E0000, 0x4E0000, 0x680000, 0x480000, 0x6D0000, 0x3D0000, 0x700000, 0x300000, 0x6D0000, 0x240000, 0x680000, 0x180000, 0x5E0000, 0x120000, 0x500000, 0x100000, 0x400000, 0x100000, 0x350000, 0x110000, 0x280000, 0x150000, 0x1E0000, 0x1E0000, 0x150000, 0x270000, 0x110000, 0x350000, 0x100000, 0x400000, 0x110000, 0x4A0000, 0x150000, 0x580000, 0x1E0000, 0x620000, 0x280000, 0x6A0000, 0x350000, 0x6F0000, 0x400000, 0x700000, 0x900000, 0x700000, 0x900000, 0x100000
end table

private table TransportTube_table3
	0x100000, 0x300000, 0x280000, 0x300000, 0x360000, 0x320000, 0x400000, 0x380000, 0x4B0000, 0x3D0000, 0x580000, 0x400000, 0x640000, 0x3C0000, 0x6C0000, 0x360000, 0x700000, 0x280000, 0x6C0000, 0x1A0000, 0x640000, 0x140000, 0x580000, 0x100000, 0x400000, 0x100000, 0x2E0000, 0x130000, 0x1D0000, 0x1E0000, 0x130000, 0x2D0000, 0x100000, 0x400000, 0x130000, 0x530000, 0x1D0000, 0x620000, 0x2E0000, 0x6E0000, 0x400000, 0x700000, 0x900000, 0x700000, 0x900000, 0x100000
end table

private table TransportTube_table4
	0x100000, 0x100000, 0x100000, 0x700000, 0xC00000, 0x700000, 0xCA0000, 0x6F0000, 0xD40000, 0x6C0000, 0xDB0000, 0x680000, 0xE30000, 0x620000, 0xE80000, 0x5A0000, 0xED0000, 0x520000, 0xEF0000, 0x480000, 0xF00000, 0x400000, 0xEF0000, 0x360000, 0xED0000, 0x2E0000, 0xE80000, 0x260000, 0xE30000, 0x1E0000, 0xDB0000, 0x170000, 0xD40000, 0x140000, 0xCA0000, 0x120000, 0xC00000, 0x100000, 0xB70000, 0x110000, 0xAF0000, 0x120000, 0xA60000, 0x170000, 0x9E0000, 0x1E0000, 0x970000, 0x260000, 0x930000, 0x2E0000, 0x910000, 0x360000, 0x900000, 0x400000, 0x900000, 0x700000
end table

private table TransportTube_table5
	0x100000, 0x100000, 0x100000, 0x700000, 0xC00000, 0x700000, 0xD20000, 0x6E0000, 0xE30000, 0x620000, 0xED0000, 0x530000, 0xF00000, 0x400000, 0xED0000, 0x2D0000, 0xE30000, 0x1E0000, 0xD20000, 0x130000, 0xC00000, 0x100000, 0xA80000, 0x100000, 0x9C0000, 0x140000, 0x940000, 0x1A0000, 0x900000, 0x280000, 0x940000, 0x360000, 0x9C0000, 0x3C0000, 0xA80000, 0x400000, 0xB50000, 0x3D0000, 0xC00000, 0x380000, 0xCA0000, 0x320000, 0xD80000, 0x300000, 0xF00000, 0x300000
end table

private table TransportTube_table6
	0x900000, 0x700000, 0x900000, 0x400000, 0x910000, 0x360000, 0x930000, 0x2E0000, 0x970000, 0x260000, 0x9E0000, 0x1E0000, 0xA60000, 0x170000, 0xAF0000, 0x120000, 0xB70000, 0x110000, 0xC00000, 0x100000, 0xCA0000, 0x120000, 0xD40000, 0x140000, 0xDB0000, 0x170000, 0xE30000, 0x1E0000, 0xE80000, 0x260000, 0xED0000, 0x2E0000, 0xEF0000, 0x360000, 0xF00000, 0x400000, 0xEF0000, 0x480000, 0xED0000, 0x520000, 0xE80000, 0x5A0000, 0xE30000, 0x620000, 0xDB0000, 0x680000, 0xD40000, 0x6C0000, 0xCA0000, 0x6F0000, 0xC00000, 0x700000, 0x100000, 0x700000, 0x100000, 0x100000
end table

private table TransportTube_table7
	0xF00000, 0x300000, 0xD80000, 0x300000, 0xCA0000, 0x320000, 0xC00000, 0x380000, 0xB50000, 0x3D0000, 0xA80000, 0x400000, 0x9C0000, 0x3C0000, 0x940000, 0x360000, 0x900000, 0x280000, 0x940000, 0x1A0000, 0x9C0000, 0x140000, 0xA80000, 0x100000, 0xC00000, 0x100000, 0xD20000, 0x130000, 0xE30000, 0x1E0000, 0xED0000, 0x2D0000, 0xF00000, 0x400000, 0xED0000, 0x530000, 0xE30000, 0x620000, 0xD20000, 0x6E0000, 0xC00000, 0x700000, 0x100000, 0x700000, 0x100000, 0x100000
end table

private table TransportTube_table8
	0x1100000, 0x100000, 0x1100000, 0x700000, 0x400000, 0x700000, 0x350000, 0x6F0000, 0x280000, 0x6A0000, 0x1E0000, 0x620000, 0x150000, 0x580000, 0x110000, 0x4A0000, 0x100000, 0x400000, 0x110000, 0x350000, 0x150000, 0x270000, 0x1E0000, 0x1E0000, 0x280000, 0x150000, 0x350000, 0x110000, 0x400000, 0x100000, 0x500000, 0x100000, 0x5E0000, 0x120000, 0x680000, 0x180000, 0x6D0000, 0x240000, 0x700000, 0x300000, 0x6D0000, 0x3D0000, 0x680000, 0x480000, 0x5E0000, 0x4E0000, 0x500000, 0x500000, 0x300000, 0x500000, 0x220000, 0x520000, 0x170000, 0x5A0000, 0x110000, 0x630000, 0x100000, 0x700000
end table

private table TransportTube_table9
	0x1100000, 0x100000, 0x1100000, 0x700000, 0x400000, 0x700000, 0x2E0000, 0x6E0000, 0x1D0000, 0x620000, 0x130000, 0x530000, 0x100000, 0x400000, 0x130000, 0x2D0000, 0x1D0000, 0x1E0000, 0x2E0000, 0x130000, 0x400000, 0x100000, 0x580000, 0x100000, 0x640000, 0x140000, 0x6C0000, 0x1A0000, 0x700000, 0x280000, 0x6C0000, 0x360000, 0x640000, 0x3C0000, 0x580000, 0x400000, 0x4B0000, 0x3D0000, 0x400000, 0x380000, 0x360000, 0x320000, 0x280000, 0x300000, 0x100000, 0x300000
end table

private table TransportTube_table10
	0x100000, 0x700000, 0x110000, 0x630000, 0x170000, 0x5A0000, 0x220000, 0x520000, 0x300000, 0x500000, 0x500000, 0x500000, 0x5E0000, 0x4E0000, 0x680000, 0x480000, 0x6D0000, 0x3D0000, 0x700000, 0x300000, 0x6D0000, 0x240000, 0x680000, 0x180000, 0x5E0000, 0x120000, 0x500000, 0x100000, 0x400000, 0x100000, 0x350000, 0x110000, 0x280000, 0x150000, 0x1E0000, 0x1E0000, 0x150000, 0x270000, 0x110000, 0x350000, 0x100000, 0x400000, 0x110000, 0x4A0000, 0x150000, 0x580000, 0x1E0000, 0x620000, 0x280000, 0x6A0000, 0x350000, 0x6F0000, 0x400000, 0x700000, 0x1100000, 0x700000, 0x1100000, 0x100000
end table

private table TransportTube_table11
	0x100000, 0x300000, 0x280000, 0x300000, 0x360000, 0x320000, 0x400000, 0x380000, 0x4B0000, 0x3D0000, 0x580000, 0x400000, 0x640000, 0x3C0000, 0x6C0000, 0x360000, 0x700000, 0x280000, 0x6C0000, 0x1A0000, 0x640000, 0x140000, 0x580000, 0x100000, 0x400000, 0x100000, 0x2E0000, 0x130000, 0x1D0000, 0x1E0000, 0x130000, 0x2D0000, 0x100000, 0x400000, 0x130000, 0x530000, 0x1D0000, 0x620000, 0x2E0000, 0x6E0000, 0x400000, 0x700000, 0x1100000, 0x700000, 0x1100000, 0x100000
end table

private table TransportTube_table12
	0x7900000, 0x3B00000, 0x7100000, 0x3B00000, 0x7100000, 0x6B00000, 0xA900000, 0x6B00000, 0xA900000, 0x6700000
end table

private table TransportTube_table13
	0x7900000, 0x3F00000, 0x7900000, 0x4B00000, 0xA000000, 0x4B00000, 0xC100000, 0x4B00000, 0xC100000, 0x3300000, 0xD900000, 0x3300000, 0xD900000, 0x1B00000, 0xF100000, 0x1B00000, 0xF100000, 0x2B00000, 0xF900000, 0x2B00000
end table

private table TransportTube_table14
	0xAF00000, 0x6300000, 0xE900000, 0x6300000, 0xE900000, 0x6B00000, 0xF900000, 0x6B00000, 0xF900000, 0x6700000
end table

private table TransportTube_table15
	0xF900000, 0x2F00000, 0xF900000, 0x4B00000, 0xF100000, 0x4B00000, 0xF100000, 0x6300000, 0xF900000, 0x6300000
end table

private table TransportTube_table16
	0x14100000, 0x5300000, 0x11900000, 0x5300000, 0x11900000, 0x6B00000, 0x14100000, 0x6B00000, 0x14100000, 0x5700000
end table

private table TransportTube_table17
	0x1AF00000, 0x5300000, 0x1B900000, 0x5300000, 0x1B900000, 0x3300000, 0x1E100000, 0x3300000
end table

private table TransportTube_table18
0x1A900000, 0x5700000, 0x1A900000, 0x5B00000, 0x1C100000, 0x5B00000, 0x1C100000, 0x4300000, 0x1E100000, 0x4300000, 0x1E100000, 0x3700000
end table

private table TransportTube_table19
0x24900000, 0x3700000, 0x24900000, 0x3D00000, 0x23900000, 0x3D00000, 0x23900000, 0x5D00000, 0x25100000, 0x5D00000, 0x25100000, 0x5700000
end table

private table TransportTube_table20
0x24F00000, 0x3300000, 0x25900000, 0x3300000, 0x25900000, 0x5300000, 0x25700000, 0x5300000
end table

private table TransportTube_table21
	0x3100000, 0x3300000, 0x2900000, 0x3300000, 0x2900000, 0x2300000, 0x4900000, 0x2300000
end table

private table TransportTube_table22
	0x3100000, 0x3700000, 0x3100000, 0x3B00000, 0x4100000, 0x3B00000, 0x4100000, 0x2B00000, 0x4900000, 0x2B00000, 0x4900000, 0x2700000
end table

private table TransportTube_table23
	0x4900000, 0x6F00000, 0x4900000, 0x7300000, 0x6900000, 0x7300000, 0x8900000, 0x7300000, 0x8900000, 0x6F00000
end table

private table TransportTube_table24
	0xBF00000, 0x3300000, 0xD900000, 0x3300000, 0xD900000, 0x2F00000
end table

private table TransportTube_table25
	0xD900000, 0x2B00000, 0xC900000, 0x2B00000, 0xC900000, 0xB00000, 0xE800000, 0xB00000, 0x11100000, 0xB00000, 0x11100000, 0x2300000, 0x10F00000, 0x2300000
end table

function TransportTube_Function135
	temp0 = object.value1
	temp2 = 0xC00
	temp0 -= object[currentPlayer].xpos
	if temp0 < 0
		FlipSign(temp0)
		FlipSign(temp2)
	end if
	temp0 >>= 16
	temp1 = object.value2
	temp3 = 0xC00
	temp1 -= object[currentPlayer].ypos
	if temp1 < 0
		FlipSign(temp1)
		FlipSign(temp3)
	end if
	temp1 >>= 16
	if temp1 >= temp0
		temp1 = object.value2
		temp1 -= object[currentPlayer].ypos
		temp1 &= -0x10000
		temp1 /= temp3
		temp0 = object.value1
		temp0 -= object[currentPlayer].xpos
		if temp0 != 0
			temp0 &= -0x10000
			temp0 /= temp1
		end if
		temp0 <<= 8
		temp3 <<= 8
		temp1 >>= 8
		object[currentPlayer].xvel = temp0
		object[currentPlayer].yvel = temp3
		Abs(temp1)
		object.value3 = temp1
	else
		temp0 = object.value1
		temp0 -= object[currentPlayer].xpos
		temp0 &= -0x10000
		temp0 /= temp2
		temp1 = object.value2
		temp1 -= object[currentPlayer].ypos
		if temp1 != 0
			temp1 &= -0x10000
			temp1 /= temp0
		end if
		temp1 <<= 8
		temp2 <<= 8
		temp0 >>= 8
		object[currentPlayer].xvel = temp2
		object[currentPlayer].yvel = temp1
		Abs(temp0)
		object.value3 = temp0
	end if
end function


event ObjectMain
	if stage.debugMode == 0
		if stage.actNum == 1
			foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
				BoxCollisionTest(C_TOUCH, object.entityPos, 0, 0, object.value7, 128, currentPlayer, 0, 0, 0, 0)
				if checkResult == 1
					if object.entityPos == 306
						achievement.trigger = 10
					end if
				end if
			next
		end if
	end if
	switch object.state
	case 0
		foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
			arrayPos0 = object.entityPos
			arrayPos0 += currentPlayer
			arrayPos0++
			if object[currentPlayer].state != PlayerObject_Blank
				if object[currentPlayer].yvel > -0x40000
					temp0 = object.value7
					BoxCollisionTest(C_TOUCH, object.entityPos, 0, 0, object.value7, 128, currentPlayer, 0, 0, 0, 0)
					if checkResult == 1
						if object[arrayPos0].state == PlayerObject_Blank
							temp0 = object[currentPlayer].xpos
							temp0 -= object.xpos
							if object.value7 == 256
								FlipSign(temp0)
								temp0 += 0x1000000
							end if
							if temp0 >= 0x800000
								if object.value9 != 2
									temp3 = object.value9
								else
									temp3 = stage.seconds
									temp3 &= 1
								end if
							else
								temp1 = object[currentPlayer].ypos
								temp1 -= object.ypos
								if temp1 >= 0x400000
									temp3 = 2
								else
									temp3 = 3
								end if
							end if
							object[arrayPos0].value9 = temp3
							temp3 += object.value8
							GetTableValue(object[arrayPos0].value10, temp3, TransportTube_table44)
							GetTableValue(object[arrayPos0].value12, temp3, TransportTube_table48)
							object[arrayPos0].value12--
							object[arrayPos0].value11 = 0
							GetTableValue(object[currentPlayer].xpos, object[arrayPos0].value11, object[arrayPos0].value10)
							object[currentPlayer].xpos += object.xpos
							object[arrayPos0].value11++
							GetTableValue(object[currentPlayer].ypos, object[arrayPos0].value11, object[arrayPos0].value10)
							object[currentPlayer].ypos += object.ypos
							object[arrayPos0].value11++
							temp0 = object[arrayPos0].value11
							GetTableValue(object.value1, temp0, object[arrayPos0].value10)
							object.value1 += object.xpos
							temp0++
							GetTableValue(object.value2, temp0, object[arrayPos0].value10)
							object.value2 += object.ypos
							CallFunction(TransportTube_Function135)
							object[arrayPos0].value3 = object.value3
							object[arrayPos0].state = 2
							object[arrayPos0].propertyValue = object.propertyValue
							object[arrayPos0].priority = PRIORITY_ACTIVE
							object[arrayPos0].value7 = object.value7
							object[arrayPos0].value0 = currentPlayer
							object[currentPlayer].speed = 0
							object[currentPlayer].value1 = 0
							object[currentPlayer].value15 = 0
							object[currentPlayer].state = PlayerObject_Blank
							object[currentPlayer].tileCollisions = 0
							object[currentPlayer].interaction = 0
							object[currentPlayer].animation = ANI_JUMPING
							object[currentPlayer].value5 = 0
							object[currentPlayer].animationSpeed = 0
							object[currentPlayer].gravity = GRAVITY_AIR
							object[currentPlayer].scrollTracking = 1
							object[currentPlayer].value18 = 4
							PlaySfx(SfxName[Rolling], 0)
						end if
					end if
				end if
			end if
		next
		break
	case 1
		break
	case 2
		currentPlayer = object.value0
		object.value3--
		if object.value3 >= 0
		else
			GetTableValue(object[currentPlayer].xpos, object.value11, object.value10)
			object[currentPlayer].xpos += object.xpos
			object.value11++
			GetTableValue(object[currentPlayer].ypos, object.value11, object.value10)
			object[currentPlayer].ypos += object.ypos
			object.value11++
			if object.value9 < 0
				object.value11 -= 4
			end if
			object.value12--
			if object.value12 == 0
				if object.value9 >= 4
					object.state = 4
					object[currentPlayer].ypos &= 0x7FF0000
					object[currentPlayer].state = PlayerObject_HandleAir
					object[currentPlayer].value35 = 1
					object[currentPlayer].tileCollisions = 1
					object[currentPlayer].interaction = 1
					object[currentPlayer].xvel = 0
					object[currentPlayer].yvel = -0x80000
					PlaySfx(SfxName[Release], 0)
				else
					temp0 = object.propertyValue
					temp0 &= 252
					temp0 += object.value9
					object.value9 = 4
					GetTableValue(temp1, temp0, TransportTube_table49)
					if temp1 == 0
						object.state = 4
						object[currentPlayer].ypos &= 0x7FF0000
						object[currentPlayer].state = PlayerObject_HandleAir
						object[currentPlayer].tileCollisions = 1
						object[currentPlayer].interaction = 1
						object[currentPlayer].xvel = 0
						object[currentPlayer].yvel = -0x80000
						PlaySfx(SfxName[Release], 0)
					else
						if temp1 < 0
							FlipSign(temp1)
							object.value9 = -4
							GetTableValue(object.value10, temp1, TransportTube_table45)
							GetTableValue(object.value12, temp1, TransportTube_table50)
							object.value12--
							object.value11 = object.value12
							object.value11 <<= 1
						else
							GetTableValue(object.value10, temp1, TransportTube_table45)
							GetTableValue(object.value12, temp1, TransportTube_table50)
							object.value12--
							object.value11 = 0
						end if
						GetTableValue(object[currentPlayer].xpos, object.value11, object.value10)
						object.value11++
						GetTableValue(object[currentPlayer].ypos, object.value11, object.value10)
						object.value11++
						if object.value9 < 0
							object.value11 -= 4
						end if
						temp0 = object.value11
						GetTableValue(object.value1, temp0, object.value10)
						temp0++
						GetTableValue(object.value2, temp0, object.value10)
						CallFunction(TransportTube_Function135)
						PlaySfx(SfxName[Rolling], 0)
						object.state = 3
					end if
				end if
			else
				temp0 = object.value11
				GetTableValue(object.value1, temp0, object.value10)
				object.value1 += object.xpos
				temp0++
				GetTableValue(object.value2, temp0, object.value10)
				object.value2 += object.ypos
				CallFunction(TransportTube_Function135)
			end if
		end if
		if object[currentPlayer].state != PlayerObject_Blank
			object.state = 1
			object.priority = PRIORITY_ACTIVE_BOUNDS
		end if
		if object[currentPlayer].type == TypeName[Debug Mode]
			object.state = 1
			object.priority = PRIORITY_ACTIVE_BOUNDS
		end if
		break
	case 3
		currentPlayer = object.value0
		object.value3--
		if object.value3 >= 0
		else
			GetTableValue(object[currentPlayer].xpos, object.value11, object.value10)
			object.value11++
			GetTableValue(object[currentPlayer].ypos, object.value11, object.value10)
			object.value11++
			if object.value9 < 0
				object.value11 -= 4
			end if
			object.value12--
			if object.value12 == 0
				object.state = 4
				object[currentPlayer].ypos &= 0x7FF0000
				object[currentPlayer].state = PlayerObject_HandleAir
				object[currentPlayer].tileCollisions = 1
				object[currentPlayer].interaction = 1
				object[currentPlayer].xvel = 0
				object[currentPlayer].yvel = -0x80000
				PlaySfx(SfxName[Release], 0)
			else
				temp0 = object.value11
				GetTableValue(object.value1, temp0, object.value10)
				temp0++
				GetTableValue(object.value2, temp0, object.value10)
				CallFunction(TransportTube_Function135)
			end if
		end if
		if object[currentPlayer].state != 1
			object.state = 1
			object.priority = PRIORITY_ACTIVE_BOUNDS
		end if
		if object[currentPlayer].type == TypeName[Debug Mode]
			object.state = 1
			object.priority = PRIORITY_ACTIVE_BOUNDS
		end if
		break
	case 4
		BoxCollisionTest(C_TOUCH, object.entityPos, 0, 0, object.value7, 128, currentPlayer, 0, 0, 0, 0)
		if checkResult == 0
			object.state = 1
			object.priority = PRIORITY_ACTIVE_BOUNDS
		end if
		break
	end switch
end event


event ObjectStartup
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
	SetTableValue(TransportTube_table0, 0, TransportTube_table44)
	SetTableValue(TransportTube_table1, 1, TransportTube_table44)
	SetTableValue(TransportTube_table2, 2, TransportTube_table44)
	SetTableValue(TransportTube_table3, 3, TransportTube_table44)
	SetTableValue(TransportTube_table4, 4, TransportTube_table44)
	SetTableValue(TransportTube_table5, 5, TransportTube_table44)
	SetTableValue(TransportTube_table6, 6, TransportTube_table44)
	SetTableValue(TransportTube_table7, 7, TransportTube_table44)
	SetTableValue(TransportTube_table8, 8, TransportTube_table44)
	SetTableValue(TransportTube_table9, 9, TransportTube_table44)
	SetTableValue(TransportTube_table10, 10, TransportTube_table44)
	SetTableValue(TransportTube_table11, 11, TransportTube_table44)
	SetTableValue(TransportTube_table12, 0, TransportTube_table45)
	SetTableValue(TransportTube_table12, 1, TransportTube_table45)
	SetTableValue(TransportTube_table13, 2, TransportTube_table45)
	SetTableValue(TransportTube_table14, 3, TransportTube_table45)
	SetTableValue(TransportTube_table15, 4, TransportTube_table45)
	SetTableValue(TransportTube_table16, 5, TransportTube_table45)
	SetTableValue(TransportTube_table17, 6, TransportTube_table45)
	SetTableValue(TransportTube_table18, 7, TransportTube_table45)
	SetTableValue(TransportTube_table19, 8, TransportTube_table45)
	SetTableValue(TransportTube_table20, 9, TransportTube_table45)
	SetTableValue(TransportTube_table21, 10, TransportTube_table45)
	SetTableValue(TransportTube_table22, 11, TransportTube_table45)
	SetTableValue(TransportTube_table23, 12, TransportTube_table45)
	SetTableValue(TransportTube_table24, 13, TransportTube_table45)
	SetTableValue(TransportTube_table25, 14, TransportTube_table45)
	foreach (TypeName[Transport Tube], arrayPos0, ALL_ENTITIES)
		if object[arrayPos0].propertyValue == 255
			object[arrayPos0].state = 1
			object[arrayPos0].propertyValue = 0
		else
			object[arrayPos0].value8 = object[arrayPos0].propertyValue
			object[arrayPos0].value8 &= 3
			GetTableValue(object[arrayPos0].value7, object[arrayPos0].value8, TransportTube_table46)
			object[arrayPos0].value8 <<= 2
			temp0 = object[arrayPos0].propertyValue
			temp0 >>= 2
			temp0 &= 15
			GetTableValue(object[arrayPos0].value9, temp0, TransportTube_table47)
		end if
	next
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
