// ----------------------------------
// RSDK Project: Sonic 2
// Script Description: Hex No Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

// ========================
// Aliases
// ========================

private alias object.value0 : object.number
private alias object.value1 : object.highlighted


// ========================
// Events
// ========================

event ObjectDraw
	temp0 = object.number
	temp0 >>= 4
	temp0 += object.highlighted
	temp1 = object.xpos
	DrawSpriteScreenXY(temp0, temp1, object.ypos)

	temp1 += 8
	temp0 = object.number
	temp0 &= 15
	temp0 += object.highlighted
	DrawSpriteScreenXY(temp0, temp1, object.ypos)
end event


event ObjectStartup
	LoadSpriteSheet("LevelSelect/Text.gif")

	// Use loops to automate sprite framing
	temp0 = 0
	while temp0 < 80
		SpriteFrame(0, 0, 8, 8, temp0, 24)
		temp0 += 8
	loop

	temp0 = 8
	while temp0 < 56
		SpriteFrame(0, 0, 8, 8, temp0, 32)
		temp0 += 8
	loop

	temp0 = 0
	while temp0 < 80
		SpriteFrame(0, 0, 8, 8, temp0, 152)
		temp0 += 8
	loop

	temp0 = 8
	while temp0 < 56
		SpriteFrame(0, 0, 8, 8, temp0, 160)
		temp0 += 8
	loop
end event


// ========================
// Editor Events
// ========================

event RSDKDraw
	object.number = 0x12
	object.highlighted = false

	temp0 = object.number
	temp0 >>= 4
	DrawSpriteXY(temp0, object.xpos, object.ypos)

	temp1 = object.xpos
	temp1 += 0x80000
	temp0 = object.number
	temp0 &= 15
	DrawSpriteXY(temp0, temp1, object.ypos)
end event


event RSDKLoad
	LoadSpriteSheet("LevelSelect/Text.gif")

	// Use loops to automate sprite framing
	temp0 = 0
	while temp0 < 80
		SpriteFrame(0, 0, 8, 8, temp0, 24)
		temp0 += 8
	loop

	temp0 = 8
	while temp0 < 56
		SpriteFrame(0, 0, 8, 8, temp0, 32)
		temp0 += 8
	loop

	temp0 = 0
	while temp0 < 80
		SpriteFrame(0, 0, 8, 8, temp0, 152)
		temp0 += 8
	loop

	temp0 = 8
	while temp0 < 56
		SpriteFrame(0, 0, 8, 8, temp0, 160)
		temp0 += 8
	loop
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
