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

//-------Aliases-------//
private alias 50 : TYPE_BRIDGEEND

// Function declarations
reserve function BridgeEnd_DebugDraw
reserve function BridgeEnd_DebugSpawn

// Static Values

// Tables

function BridgeEnd_DebugDraw
	temp0 = object.direction
	temp0 &= 1
	DrawSprite(temp0)
end function


function BridgeEnd_DebugSpawn
	CreateTempObject(TypeName[Bridge End], 0, object.xpos, object.ypos)
	object[tempObjectPos].drawOrder = 4
	object[tempObjectPos].propertyValue = object.direction
	object[tempObjectPos].propertyValue &= 1
end function


event ObjectMain
	object.frame = object.animationTimer
	object.frame /= 9
	object.animationTimer++
	object.animationTimer %= 54
end event


event ObjectDraw
	DrawSprite(object.frame)
end event


event ObjectStartup
	LoadSpriteSheet("HPZ/Objects.gif")
	SpriteFrame(-4, -12, 8, 24, 214, 206)
	SpriteFrame(-4, -12, 8, 24, 214, 206)
	SpriteFrame(-4, -12, 8, 24, 205, 206)
	SpriteFrame(-4, -12, 8, 24, 196, 206)
	SpriteFrame(-4, -12, 8, 24, 196, 206)
	SpriteFrame(-4, -12, 8, 24, 205, 206)
	arrayPos0 = 32
	while arrayPos0 < 0x420
		if object[arrayPos0].type == TypeName[Bridge End]
			object[arrayPos0].drawOrder = 4
		end if
		arrayPos0++
	loop
	SetTableValue(TypeName[Bridge End], DebugMode_ObjCount, DebugMode_TypesTable)
	SetTableValue(BridgeEnd_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(BridgeEnd_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
	DebugMode_ObjCount++
end event

event RSDKDraw
	DrawSprite(0)
end event

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