Path: blob/master/Sonic 1/Scripts/Special/ZoneBlock.txt
1483 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Zone Block Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer1213private alias 0 : BLOCK_ZONE_IDLE14private alias 1 : BLOCK_ZONE_ACTIVATED1516// Player aliases17private alias object.value10 : debugMode.currentSelection1819// ========================20// Function Declarations21// ========================2223reserve function ZoneBlock_DebugDraw24reserve function ZoneBlock_DebugSpawn252627// ========================28// Static Values29// ========================3031private value ZoneBlock_startDebugID = 0323334// ========================35// Function Definitions36// ========================3738private function ZoneBlock_DebugDraw39temp4 = debugMode[0].currentSelection40temp4 -= ZoneBlock_startDebugID41DrawSprite(temp4)42end function434445private function ZoneBlock_DebugSpawn46temp4 = debugMode[0].currentSelection47temp4 -= ZoneBlock_startDebugID48temp5 = TypeName[Zone Block]49CallFunction(DebugMode_PlaceBlock)50object[arrayPos0].drawOrder = 451object[arrayPos0].groupID = GROUP_BLOCKS52end function535455// ========================56// Events57// ========================5859event ObjectUpdate60if object.state == BLOCK_ZONE_ACTIVATED61object.frame = object.timer62object.frame >>= 363object.timer++64if object.timer == 3265object.timer = 066object.state = BLOCK_ZONE_IDLE67object.frame = 068end if69end if7071foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)72CallFunction(SpecialSetup_PlayerBlockCol)73next74end event757677event ObjectDraw78CallFunction(SpecialSetup_GetBlockPos)79#platform: USE_ORIGINS80// This object isn't even used normally, but it's cool to see them update it regardless81if game.playMode == BOOT_PLAYMODE_MIRRORING82object.direction = FLIP_X83DrawSpriteFX(object.propertyValue, FX_FLIP, temp0, temp1)84else85DrawSpriteXY(object.propertyValue, temp0, temp1)86end if87#endplatform88#platform: USE_STANDALONE89DrawSpriteXY(object.propertyValue, temp0, temp1)90#endplatform91end event929394event ObjectStartup95LoadSpriteSheet("Special/Objects.gif")9697// Zone block frames98SpriteFrame(-12, -12, 24, 24, 326, 176)99SpriteFrame(-12, -12, 24, 24, 351, 176)100SpriteFrame(-12, -12, 24, 24, 376, 176)101SpriteFrame(-12, -12, 24, 24, 426, 176)102SpriteFrame(-12, -12, 24, 24, 451, 176)103SpriteFrame(-12, -12, 24, 24, 476, 176)104SpriteFrame(-12, -12, 24, 24, 476, 276)105106foreach (TypeName[Zone Block], arrayPos0, ALL_ENTITIES)107object[arrayPos0].groupID = GROUP_BLOCKS108next109110// Add the Zone Block to the debug object list seven times for the seven different zones111temp0 = 0112ZoneBlock_startDebugID = DebugMode_ObjCount113while temp0 < 7114SetTableValue(TypeName[Zone Block], DebugMode_ObjCount, DebugMode_TypeTable)115SetTableValue(ZoneBlock_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)116SetTableValue(ZoneBlock_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)117DebugMode_ObjCount++118temp0++119loop120end event121122123// ========================124// Editor Events125// ========================126127event RSDKEdit128if editor.returnVariable == true129switch editor.variableID130case EDIT_VAR_PROPVAL // property value131checkResult = object.propertyValue132break133134case 0 // zoneID135checkResult = object.propertyValue136break137138end switch139else140switch editor.variableID141case EDIT_VAR_PROPVAL // property value142object.propertyValue = editor.variableValue143break144145case 0 // zoneID146object.propertyValue = temp0147break148149end switch150end if151end event152153154event RSDKDraw155DrawSprite(object.propertyValue)156end event157158159event RSDKLoad160LoadSpriteSheet("Special/Objects.gif")161SpriteFrame(-12, -12, 24, 24, 326, 176)162SpriteFrame(-12, -12, 24, 24, 351, 176)163SpriteFrame(-12, -12, 24, 24, 376, 176)164SpriteFrame(-12, -12, 24, 24, 426, 176)165SpriteFrame(-12, -12, 24, 24, 451, 176)166SpriteFrame(-12, -12, 24, 24, 476, 176)167SpriteFrame(-12, -12, 24, 24, 476, 276)168169AddEditorVariable("zoneID")170SetActiveVariable("zoneID")171AddEnumVariable("Zone 1", 0)172AddEnumVariable("Zone 2", 1)173AddEnumVariable("Zone 3", 2)174AddEnumVariable("Zone 4", 3)175AddEnumVariable("Zone 5", 4)176AddEnumVariable("Zone 6", 5)177AddEnumVariable("Zone 7", 6)178end event179180181