Path: blob/master/Sonic 2/Scripts/Mission/M035Block.txt
1478 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: M035Block Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011// Player Aliases12private alias object.xpos : player.xpos131415// ========================16// Events17// ========================1819event ObjectUpdate20temp6 = PRIORITY_XBOUNDS2122if object.propertyValue == 023// Check for collision, all the way from this platform to the next24// Notably this is Platform collision, not Solid collision like the normal type of Mission Block2526temp0 = object[+1].ixpos27temp0 -= object.ixpos28temp0 += 16 // (if the two blocks are far away enough from each other, the left block will stop providing collision as soon as p1's past the second block's midpoint, which would mean that this line doesn't matter)29BoxCollisionTest(C_PLATFORM, object.entityPos, -16, -16, temp0, 16, 0, C_BOX, C_BOX, C_BOX, C_BOX)30end if3132// (currentPlayer is never set in this script btw so i hope you don't have a p2 tails around...)33if object.propertyValue == 034if object.xpos <= player[currentPlayer].xpos35temp6 = PRIORITY_ACTIVE36end if37else38if player[currentPlayer].xpos <= object.xpos39temp6 = PRIORITY_ACTIVE40end if41end if4243object.priority = temp644if object.propertyValue == 045object[+1].priority = temp646else47object[-1].priority = temp648end if49end event505152event ObjectDraw53if object.propertyValue == 054CheckNotEqual(object[+1].type, TypeName[M035Block])55temp0 = checkResult56CheckNotEqual(object[+1].propertyValue, 1)57temp0 |= checkResult58if temp0 != false59// Setup isn't right, just draw a single block6061DrawSprite(0)62else63temp0 = object.xpos64temp1 = object[+1].xpos65object[+1].ypos = object.ypos66temp2 = 3267temp2 <<= 1668while temp0 < temp169DrawSpriteXY(0, temp0, object.ypos)70temp0 += temp271loop72end if73else74CheckNotEqual(object[-1].type, TypeName[M035Block])75temp0 = checkResult76CheckNotEqual(object[-1].propertyValue, 0)77temp0 |= checkResult78if temp0 != false79// Setup isn't right, just draw a single block8081DrawSprite(0)82else83temp0 = object[-1].xpos84temp1 = object.xpos85object.ypos = object[-1].ypos86temp2 = 3287temp2 <<= 1688while temp0 < temp189DrawSpriteXY(0, temp0, object.ypos)90temp0 += temp291loop92end if93end if94end event959697event ObjectStartup98foreach (TypeName[M035Block], arrayPos0, ALL_ENTITIES)99object[arrayPos0].priority = PRIORITY_INACTIVE100if object[arrayPos0].propertyValue == 0101arrayPos1 = arrayPos0102arrayPos1++103if object[arrayPos1].type == TypeName[M035Block]104object[arrayPos0].priority = PRIORITY_XBOUNDS105object[arrayPos1].ypos = object[arrayPos0].ypos106end if107else108arrayPos1 = arrayPos0109arrayPos1--110if object[arrayPos1].type == TypeName[M035Block]111object[arrayPos0].priority = PRIORITY_XBOUNDS112object[arrayPos0].ypos = object[arrayPos1].ypos113end if114end if115next116117// Normally loading sheets are the first thing done in a script, but this one's among the few exceptions118LoadSpriteSheet("Mission/Objects.gif")119120// Mission Block Frame121SpriteFrame(-16, -16, 32, 32, 1, 18)122end event123124125// ========================126// Editor Events127// ========================128129event RSDKEdit130if editor.returnVariable == true131switch editor.variableID132case EDIT_VAR_PROPVAL // property value133checkResult = object.propertyValue134break135136case 0 // childType137checkResult = object.propertyValue138break139140end switch141else142switch editor.variableID143case EDIT_VAR_PROPVAL // property value144object.propertyValue = editor.variableValue145break146147case 0 // childType148object.propertyValue = editor.variableValue149break150151end switch152end if153end event154155156event RSDKDraw157if object.propertyValue == 0158CheckNotEqual(object[+1].type, TypeName[M035Block])159temp0 = checkResult160CheckNotEqual(object[+1].propertyValue, 1)161temp0 |= checkResult162if temp0 == true163DrawSprite(0)164else165temp0 = object.xpos166temp1 = object[+1].xpos167temp2 = 32168temp2 <<= 16169while temp0 < temp1170DrawSpriteXY(0, temp0, object.ypos)171temp0 += temp2172loop173end if174else175CheckNotEqual(object[-1].type, TypeName[M035Block])176temp0 = checkResult177CheckNotEqual(object[-1].propertyValue, 0)178temp0 |= checkResult179if temp0 == true180DrawSprite(0)181else182temp0 = object[-1].xpos183temp1 = object.xpos184temp2 = 32185temp2 <<= 16186while temp0 < temp1187DrawSpriteXY(0, temp0, object[-1].ypos)188temp0 += temp2189loop190end if191end if192end event193194195event RSDKLoad196LoadSpriteSheet("Mission/Objects.gif")197SpriteFrame(-16, -16, 32, 32, 1, 18)198199// objs should be in order of 0->1 xpos-wise, as well as object order-wise200AddEditorVariable("childType")201SetActiveVariable("childType")202AddEnumVariable("Next Slot", 0)203AddEnumVariable("Previous Slot", 1)204end event205206207