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

// This Object is used in Mission "Tornado Flyby" - M040 - Mission_Zone10

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

event ObjectUpdate
	// What this object does is make every projectile move just a tad bit faster, at double the projectile's standard speed
	
	// Cycle through the entire temp object list and update its objects, looking for projectiles
	arrayPos0 = 0x420
	while arrayPos0 < 0x4A0
		switch object[arrayPos0].type
		case TypeName[Turtloid Shot]
			// Turtloid Shot xvel is normally -0x8000, this is double that
			object[arrayPos0].xvel = -0x10000
			break
			
		case TypeName[Nebula Bomb]
			// Making it fall faster, apply 2x gravity
			// (The first round of `+= 0x3800` is already done in the Nebula Bomb script)
			object[arrayPos0].yvel += 0x3800
			break
			
		case TypeName[OctusShot] // Normally has a name of [Octus Shot] in OOZ, but WFZ removes the space
			// Octus Shot xvel is normally +/- 0x20000, is this again double that
			if object[arrayPos0].xvel < 0
				object[arrayPos0].xvel = -0x40000
			else
				object[arrayPos0].xvel =  0x40000
			end if
			break
			
		case TypeName[AsteronSpike] // Similar case here, normally [Asteron Spike] but WFZ's entry removes the space
			switch object[arrayPos0].propertyValue
			case 0
				// Normally has a yvel of -0x40000 (and an xvel of 0)
				object[arrayPos0].yvel = -0x80000
				break
				
			case 1
				// Normally has an xvel of +/- 0x30000, and a yvel of -0x10000
				if object[arrayPos0].xvel < 0
					object[arrayPos0].xvel = -0x60000
				else
					object[arrayPos0].xvel =  0x60000
				end if
				object[arrayPos0].yvel = -0x20000
				break
				
			case 2
				// Normally has an xvel of +/- 0x30000, and a yvel of -0x30000
				if object[arrayPos0].xvel < 0
					object[arrayPos0].xvel = -0x60000
				else
					object[arrayPos0].xvel =  0x60000
				end if
				object[arrayPos0].yvel = 0x60000
				break
				
			end switch // object[arrayPos0].propertyValue
			break
			
		end switch // object[arrayPos0].type
		
		arrayPos0++
	loop
end event


event ObjectStartup
	foreach (TypeName[SCZSpeedUp], arrayPos0, ALL_ENTITIES)
		object[arrayPos0].priority = PRIORITY_ACTIVE
	next
end event


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

event RSDKDraw
	DrawSprite(0)
end event


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