Path: blob/master/Sonic 2/Scripts/WFZ/GrabPanel.txt
1479 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Grab Panel Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.delay1213// Player Aliases14private alias object.type : player.type15private alias object.state : player.state16private alias object.xpos : player.xpos17private alias object.ypos : player.ypos18private alias object.xvel : player.xvel19private alias object.yvel : player.yvel20private alias object.speed : player.speed21private alias object.direction : player.direction22private alias object.animationSpeed : player.animationSpeed23private alias object.animation : player.animation24private alias object.jumpPress : player.jumpPress252627// ========================28// Function Declarations29// ========================3031reserve function GrabPanel_DebugDraw32reserve function GrabPanel_DebugSpawn333435// ========================36// Function Definitions37// ========================3839private function GrabPanel_DebugDraw40DrawSprite(0)41end function424344private function GrabPanel_DebugSpawn45CreateTempObject(TypeName[Grab Panel], 0, object.xpos, object.ypos)46object[tempObjectPos].delay = 6047end function484950// ========================51// Events52// ========================5354event ObjectUpdate55temp7 = false56foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)57temp2 = false58if player[currentPlayer].type == TypeName[Tails Object]59temp3 = -0x10000060else61temp3 = -0x16000062end if6364temp0 = object.xpos65temp0 += temp366temp0 -= player[currentPlayer].xpos67Abs(temp0)68if temp0 <= 0x4000069temp0 = object.ypos70temp0 -= player[currentPlayer].ypos71temp1 = temp072Abs(temp0)73if temp0 <= 0x16000074player[currentPlayer].animation = ANI_CLINGING75player[currentPlayer].animationSpeed = 12876player[currentPlayer].direction = FACING_LEFT77player[currentPlayer].xpos = object.xpos78player[currentPlayer].xpos += temp379if object.propertyValue == 0x7F80player[currentPlayer].state = Player_State_Static81player[currentPlayer].xvel = 082player[currentPlayer].yvel = 083player[currentPlayer].speed = 084end if8586temp2 = true87else88if player[currentPlayer].animation == ANI_CLINGING89player[currentPlayer].ypos = object.ypos90if temp1 < 091player[currentPlayer].ypos += 0x16000092else93player[currentPlayer].ypos -= 0x16000094end if9596temp2 = true97end if98end if99100if temp2 != false101if currentPlayer == 0102if player[currentPlayer].jumpPress != false103if player[currentPlayer].ypos < object.ypos104temp7 = 1105else106temp7 = 2107end if108end if109110object.delay--111if object.delay == 0112if player[currentPlayer].ypos < object.ypos113temp7 = 1114else115temp7 = 2116end if117end if118end if119end if120end if121next122123if temp7 != 0124player[currentPlayer].animation = ANI_FANROTATE125PlaySfx(SfxName[Ledge Break], false)126temp0 = object.xpos127temp0 -= 0x100000128temp1 = object.ypos129temp1 -= 0x100000130if temp7 == 1131CreateTempObject(TypeName[Grab Panel Part], 0, temp0, temp1)132object[tempObjectPos].xvel = -0x40000133object[tempObjectPos].state = 1134temp1 += 0x200000135136CreateTempObject(TypeName[Grab Panel Part], 4, temp0, temp1)137object[tempObjectPos].xvel = -0x40000138temp0 -= 0x200000139temp1 -= 0x200000140141CreateTempObject(TypeName[Grab Panel Part], 16, temp0, temp1)142object[tempObjectPos].xvel = -0x40000143temp1 += 0x200000144145CreateTempObject(TypeName[Grab Panel Part], 24, temp0, temp1)146object[tempObjectPos].xvel = -0x40000147else148CreateTempObject(TypeName[Grab Panel Part], 4, temp0, temp1)149object[tempObjectPos].xvel = -0x40000150temp1 += 0x200000151152CreateTempObject(TypeName[Grab Panel Part], 0, temp0, temp1)153object[tempObjectPos].xvel = -0x40000154object[tempObjectPos].state = 1155temp0 -= 0x200000156temp1 -= 0x200000157158CreateTempObject(TypeName[Grab Panel Part], 24, temp0, temp1)159object[tempObjectPos].xvel = -0x40000160temp1 += 0x200000161162CreateTempObject(TypeName[Grab Panel Part], 16, temp0, temp1)163object[tempObjectPos].xvel = -0x40000164end if165166object.type = TypeName[Blank Object]167end if168end event169170171event ObjectDraw172if object.propertyValue != 0x7F173DrawSprite(0)174175// ??? no end if?176// I mean code-wise, yeah the end event will reset it but, this is prolly a "bug"177178#platform: USE_DECOMP179// Just for good measure :)180end if181#endplatform182end event183184185event ObjectStartup186LoadSpriteSheet("SCZ/Objects.gif")187SpriteFrame(-64, -32, 64, 64, 1, 69)188189foreach (TypeName[Grab Panel], arrayPos0, ALL_ENTITIES)190object[arrayPos0].delay = object[arrayPos0].propertyValue191object[arrayPos0].delay *= 60192next193194SetTableValue(TypeName[Grab Panel], DebugMode_ObjCount, DebugMode_TypesTable)195SetTableValue(GrabPanel_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)196SetTableValue(GrabPanel_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)197DebugMode_ObjCount++198end event199200201// ========================202// Editor Events203// ========================204205event RSDKDraw206CheckEqual(object.propertyValue, 0x7F)207object.inkEffect = checkResult208DrawSpriteFX(0, FX_INK, object.xpos, object.ypos)209object.inkEffect = INK_NONE210end event211212213event RSDKLoad214LoadSpriteSheet("SCZ/Objects.gif")215SpriteFrame(-64, -32, 64, 64, 1, 69)216217// 0x7F == Eggman Shuttle Grab Panel218SetVariableAlias(ALIAS_VAR_PROPVAL, "delay")219end event220221222