Path: blob/master/Sonic 2/Scripts/Mission/MissionGrabPanel.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Grab Panel Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// This Object is used in Mission "Quick Step" - M050 - Mission_Zone1189// ========================10// Aliases11// ========================1213private alias object.value0 : object.delay1415// Player Aliases16private alias object.type : player.type17private alias object.state : player.state18private alias object.xpos : player.xpos19private alias object.ypos : player.ypos20private alias object.xvel : player.xvel21private alias object.yvel : player.yvel22private alias object.speed : player.speed23private alias object.animationSpeed : player.animationSpeed24private alias object.animation : player.animation25private alias object.jumpPress : player.jumpPress262728// ========================29// Function Declarations30// ========================3132reserve function GrabPanel_DebugDraw33reserve function GrabPanel_DebugSpawn343536// ========================37// Function Definitions38// ========================3940private function GrabPanel_DebugDraw41DrawSprite(0)42end function434445private function GrabPanel_DebugSpawn46CreateTempObject(TypeName[Grab Panel], 0, object.xpos, object.ypos)47object[tempObjectPos].delay = 6048end function495051// ========================52// Events53// ========================5455event ObjectUpdate56temp7 = false57foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)58temp2 = false59temp3 = -0x2800006061temp0 = object.xpos62temp0 += temp363temp0 -= player[currentPlayer].xpos64Abs(temp0)65if temp0 <= 0x4000066temp0 = object.ypos67temp0 -= player[currentPlayer].ypos68temp1 = temp069Abs(temp0)70if temp0 <= 0x16000071player[currentPlayer].animation = ANI_CLINGING72player[currentPlayer].animationSpeed = 12873player[currentPlayer].xpos = object.xpos74player[currentPlayer].xpos += temp375if object.propertyValue == 0x7F76player[currentPlayer].state = Player_State_Static77player[currentPlayer].xvel = 078player[currentPlayer].yvel = 079player[currentPlayer].speed = 080end if8182temp2 = true83else84if player[currentPlayer].animation == ANI_CLINGING85player[currentPlayer].ypos = object.ypos86if temp1 < 087player[currentPlayer].ypos += 0x16000088else89player[currentPlayer].ypos -= 0x16000090end if9192temp2 = true93end if94end if9596if temp2 != false97if currentPlayer == 098if player[currentPlayer].jumpPress != false99if player[currentPlayer].ypos < object.ypos100temp7 = 1101else102temp7 = 2103end if104end if105106object.delay--107if object.delay == 0108if player[currentPlayer].ypos < object.ypos109temp7 = 1110else111temp7 = 2112end if113end if114end if115end if116end if117next118119if temp7 != 0120player[currentPlayer].animation = ANI_FANROTATE121PlaySfx(SfxName[Ledge Break], false)122temp0 = object.xpos123temp0 -= 0x100000124temp1 = object.ypos125temp1 -= 0x100000126if temp7 == 1127CreateTempObject(TypeName[Grab Panel Part], 16, temp0, temp1)128object[tempObjectPos].xvel = 0x40000129temp1 += 0x200000130131CreateTempObject(TypeName[Grab Panel Part], 24, temp0, temp1)132object[tempObjectPos].xvel = 0x40000133temp0 -= 0x200000134temp1 -= 0x200000135136CreateTempObject(TypeName[Grab Panel Part], 0, temp0, temp1)137object[tempObjectPos].xvel = 0x40000138object[tempObjectPos].state = 1139temp1 += 0x200000140141CreateTempObject(TypeName[Grab Panel Part], 4, temp0, temp1)142object[tempObjectPos].xvel = 0x40000143else144CreateTempObject(TypeName[Grab Panel Part], 24, temp0, temp1)145object[tempObjectPos].xvel = 0x40000146temp1 += 0x200000147148CreateTempObject(TypeName[Grab Panel Part], 16, temp0, temp1)149object[tempObjectPos].xvel = 0x40000150temp0 -= 0x200000151temp1 -= 0x200000152153CreateTempObject(TypeName[Grab Panel Part], 4, temp0, temp1)154object[tempObjectPos].xvel = 0x40000155temp1 += 0x200000156157CreateTempObject(TypeName[Grab Panel Part], 0, temp0, temp1)158object[tempObjectPos].xvel = 0x40000159object[tempObjectPos].state = 1160end if161162object.type = TypeName[Blank Object]163end if164end event165166167event ObjectDraw168if object.propertyValue != 0x7F169DrawSprite(0)170171// ??? no end if?172// I mean code-wise, yeah the end event will reset it but, this is prolly a "bug"173// (btw it was like this in the original script already, this isn't something new introduced in the Mission ver)174175#platform: USE_DECOMP176// just for peace of mind :)177end if178#endplatform179end event180181182event ObjectStartup183LoadSpriteSheet("SCZ/Objects.gif")184SpriteFrame(-64, -32, 64, 64, 1, 69)185186foreach (TypeName[Grab Panel], arrayPos0, ALL_ENTITIES)187object[arrayPos0].delay = object[arrayPos0].propertyValue188object[arrayPos0].delay *= 60189next190191SetTableValue(TypeName[Grab Panel], DebugMode_ObjCount, DebugMode_TypesTable)192SetTableValue(GrabPanel_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)193SetTableValue(GrabPanel_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)194DebugMode_ObjCount++195end event196197198// ========================199// Editor Events200// ========================201202event RSDKDraw203CheckEqual(object.propertyValue, 0x7F)204object.inkEffect = checkResult205DrawSpriteFX(0, FX_INK, object.xpos, object.ypos)206object.inkEffect = INK_NONE207end event208209210event RSDKLoad211LoadSpriteSheet("SCZ/Objects.gif")212SpriteFrame(-64, -32, 64, 64, 1, 69)213214// 0x7F == Eggman Shuttle Grab Panel215SetVariableAlias(ALIAS_VAR_PROPVAL, "delay")216end event217218219