Path: blob/master/Sonic 2/Scripts/Enemies/BeeShot.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Bee Shot Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011// Bridge Aliases12private alias object.value2 : bridge.stoodPos13private alias object.value4 : bridge.bridgeDepth14private alias object.value6 : bridge.startPos15private alias object.value7 : bridge.endPos1617// Burning Log aliases18private alias object.value0 : burningLog.timer192021// ========================22// Events23// ========================2425event ObjectUpdate26object.xpos += object.xvel27object.ypos += object.yvel2829if object.outOfBounds == true30object.type = TypeName[Blank Object]31end if3233foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)34BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)35if checkResult == true36CallFunction(Player_ProjectileHit)37end if38next3940// Check if we touched a bridge... and if we did, burn that sucka to the ground41foreach (TypeName[Bridge], arrayPos0, ACTIVE_ENTITIES)42if object.xpos > bridge[arrayPos0].startPos43if object.xpos < bridge[arrayPos0].endPos44temp0 = object[arrayPos0].ypos45temp0 -= 0x8000046if object.ypos >= temp047temp0 += 0x10000048if object.ypos <= temp049temp7 = object.xpos50temp7 -= bridge[arrayPos0].startPos51temp7 >>= 2052temp7 *= 1553temp7 -= 1554temp6 = -155556temp0 = 057temp1 = bridge[arrayPos0].startPos58temp1 += 0x8000059temp4 = 0x8000060temp5 = bridge[arrayPos0].stoodPos61temp5 >>= 2062while temp0 < temp563temp3 = temp464temp3 <<= 765temp3 /= bridge[arrayPos0].stoodPos66Sin(temp2, temp3)67temp2 *= bridge[arrayPos0].bridgeDepth68temp2 >>= 969temp2 += object[arrayPos0].ypos7071CreateTempObject(TypeName[Burning Log], 0, temp1, temp2)72burningLog[tempObjectPos].timer = temp77374temp7 += temp675if temp7 == 1576FlipSign(temp6)77end if7879temp1 += 0x10000080temp4 += 0x10000081temp0++82loop8384temp2 = bridge[arrayPos0].bridgeDepth85temp2 += object[arrayPos0].ypos86CreateTempObject(TypeName[Burning Log], 0, temp1, temp2)87burningLog[tempObjectPos].timer = temp78889temp7 += temp690if temp7 == 1591FlipSign(temp6)92end if93temp1 += 0x1000009495temp0++96temp5 = bridge[arrayPos0].endPos97temp5 -= bridge[arrayPos0].startPos98temp5 -= bridge[arrayPos0].stoodPos99temp1 = bridge[arrayPos0].endPos100temp1 -= 0x80000101temp4 = 0x80000102temp7 = object[arrayPos0].propertyValue103temp7 -= temp0104temp7 *= 15105temp6 = -15106while temp0 < object[arrayPos0].propertyValue107temp3 = temp4108temp3 <<= 7109temp3 /= temp5110Sin(temp2, temp3)111temp2 *= bridge[arrayPos0].bridgeDepth112temp2 >>= 9113temp2 += object[arrayPos0].ypos114115CreateTempObject(TypeName[Burning Log], 0, temp1, temp2)116burningLog[tempObjectPos].timer = temp7117118temp7 += temp6119if temp7 == 15120FlipSign(temp6)121end if122temp1 -= 0x100000123temp4 += 0x100000124temp0++125loop126127object[arrayPos0].type = TypeName[Blank Object]128end if129end if130end if131end if132next133end event134135136event ObjectDraw137DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)138end event139140141event ObjectStartup142// Interestingly this object checks for both of its folders explicitly, while most other objects instead check for their primary zone and then MBZ's within a simple `else` instead143// Given that the MBZ frame data is a duplicate of the EHZ frame data, it is kinda confusing why it's structered like this...144// Perhaps this object was based off an S1 badnik shot, where individual checks are the norm?145146CheckCurrentStageFolder("Zone01")147if checkResult == true148LoadSpriteSheet("EHZ/Objects.gif")149SpriteFrame(-12, -3, 8, 10, 1, 50)150SpriteFrame(-12, -3, 8, 10, 10, 50)151SpriteFrame(-8, -8, 16, 24, 110, 19)152end if153154CheckCurrentStageFolder("ZoneM")155if checkResult == true156LoadSpriteSheet("MBZ/Objects.gif")157158// This is just duplicated EHZ frame data, so it doesn't quite look right in-game159// (The correct sprites are present on the MBZ sheet, though, and those sprites are even used by the MBZ Buzzer too!)160SpriteFrame(-12, -3, 8, 10, 1, 50)161SpriteFrame(-12, -3, 8, 10, 10, 50)162SpriteFrame(-8, -8, 16, 24, 110, 19)163end if164end event165166167// ========================168// Editor Events169// ========================170171event RSDKDraw172DrawSprite(0)173end event174175176event RSDKLoad177CheckCurrentStageFolder("Zone01")178if checkResult == true179LoadSpriteSheet("EHZ/Objects.gif")180SpriteFrame(-12, -3, 8, 10, 1, 50)181else182LoadSpriteSheet("MBZ/Objects.gif")183SpriteFrame(-12, -3, 8, 10, 66, 302) // Decomp note - using fixed frame here184end if185186SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")187end event188189190