Path: blob/master/Sonic 1/Scripts/Special/RedWhiteBlock.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Red White Block Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Function Declarations9// ========================1011reserve function RedWhiteBlock_DebugDraw12reserve function RedWhiteBlock_DebugSpawn131415// ========================16// Function Definitions17// ========================1819private function RedWhiteBlock_DebugDraw20DrawSprite(0)21end function222324private function RedWhiteBlock_DebugSpawn25temp5 = TypeName[Red White Block]26CallFunction(DebugMode_PlaceBlock)27object[arrayPos0].drawOrder = 428object[arrayPos0].groupID = GROUP_BLOCKS29end function303132// ========================33// Events34// ========================3536event ObjectUpdate37foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)38if object.propertyValue == 039CallFunction(SpecialSetup_PlayerBlockCol)40else41switch object.propertyValue42case 143BoxCollisionTest(C_TOUCH, object.entityPos, -160, 36, 160, 60, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)44if checkResult == true45object.propertyValue = 046object.inkEffect = INK_NONE47end if48break4950case 251BoxCollisionTest(C_TOUCH, object.entityPos, 36, -160, 60, 160, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)52if checkResult == true53object.propertyValue = 054object.inkEffect = INK_NONE55end if56break5758case 359BoxCollisionTest(C_TOUCH, object.entityPos, -60, -160, -36, 160, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)60if checkResult == true61object.propertyValue = 062object.inkEffect = INK_NONE63end if64break6566case 467BoxCollisionTest(C_TOUCH, object.entityPos, -160, -60, 160, -36, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)68if checkResult == true69object.propertyValue = 070object.inkEffect = INK_NONE71end if72break7374case 575BoxCollisionTest(C_TOUCH, object.entityPos, 36, -24, 60, 24, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)76if checkResult == true77object.propertyValue = 078object.inkEffect = INK_NONE79end if80break8182end switch83end if84next85end event868788event ObjectDraw89CallFunction(SpecialSetup_GetBlockPos)90temp2 = oscillation91temp2 &= 1592temp2 >>= 393DrawSpriteFX(temp2, FX_INK, temp0, temp1)94end event959697event ObjectStartup98LoadSpriteSheet("Special/Objects.gif")99SpriteFrame(-12, -12, 24, 24, 276, 76)100SpriteFrame(-12, -12, 24, 24, 276, 176)101102foreach (TypeName[Red White Block], arrayPos0, ALL_ENTITIES)103object[arrayPos0].groupID = GROUP_BLOCKS104if object[arrayPos0].propertyValue > 0105object[arrayPos0].inkEffect = INK_BLEND106object[arrayPos0].alpha = 128107end if108next109110SetTableValue(TypeName[Red White Block], DebugMode_ObjCount, DebugMode_TypeTable)111SetTableValue(RedWhiteBlock_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)112SetTableValue(RedWhiteBlock_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)113DebugMode_ObjCount++114end event115116117// ========================118// Editor Events119// ========================120121event RSDKEdit122if editor.returnVariable == true123switch editor.variableID124case EDIT_VAR_PROPVAL // property value125checkResult = object.propertyValue126break127128case 0 // type129checkResult = object.propertyValue130break131132end switch133else134switch editor.variableID135case EDIT_VAR_PROPVAL // property value136object.propertyValue = editor.variableValue137break138139case 0 // type140object.propertyValue = temp0141break142143end switch144end if145end event146147148event RSDKDraw149object.inkEffect = INK_NONE150if object.propertyValue > 0151object.inkEffect = INK_BLEND152end if153154DrawSpriteFX(0, FX_INK, object.xpos, object.ypos)155end event156157158event RSDKLoad159LoadSpriteSheet("Special/Objects.gif")160SpriteFrame(-12, -12, 24, 24, 276, 76)161162AddEditorVariable("type")163SetActiveVariable("type")164AddEnumVariable("Solid", 0)165AddEnumVariable("Transparent (Enter From Top)", 1)166AddEnumVariable("Transparent (Enter From Right)", 2)167AddEnumVariable("Transparent (Enter From Left)", 3)168AddEnumVariable("Transparent (Enter From Bottom)", 4)169AddEnumVariable("Transparent (Enter From Right, Small)", 5)170end event171172173