Path: blob/master/Sonic 2/Scripts/Special/Bomb.txt
1482 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Bomb Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value1 : object.localPos.x12private alias object.value2 : object.localPos.y13private alias object.value3 : object.localPos.z14private alias object.value4 : object.worldPos.x15private alias object.value5 : object.worldPos.y16private alias object.value6 : object.worldPos.z1718private alias object.value7 : object.shadowsEnabled19private alias object.value8 : object.localShadowPos.x20private alias object.value9 : object.localShadowPos.y21private alias object.value11 : object.worldShadowPos.x22private alias object.value12 : object.worldShadowPos.y23private alias object.value13 : object.worldShadowPos.z24private alias object.value14 : object.worldShadowPos.u2526// Halfpipe Aliases27private alias object.value13 : halfpipe.playerPos.z2829// Player Aliases30private alias object.state : player.state31private alias object.gravity : player.gravity3233private alias object.value7 : player.invincibilityTimer34private alias object.value14 : player.localPos.z35private alias object.value15 : player.localPos.x36private alias object.value16 : player.localPos.y3738// Face Buffer Flag Aliases39private alias 5 : FACE_TEXTURED_C40private alias 6 : FACE_TEXTURED_C_BLEND414243// ========================44// Events45// ========================4647event ObjectUpdate48arrayPos0 = scene3D.vertexCount49arrayPos1 = scene3D.faceCount5051if object.shadowsEnabled == true52faceBuffer[arrayPos1].flag = FACE_TEXTURED_C_BLEND53faceBuffer[arrayPos1].a = arrayPos054vertexBuffer[arrayPos0].x = object.worldShadowPos.x55vertexBuffer[arrayPos0].y = object.worldShadowPos.y56vertexBuffer[arrayPos0].z = object.worldShadowPos.z57vertexBuffer[arrayPos0].u = object.worldShadowPos.u58vertexBuffer[arrayPos0].v = 5059arrayPos0++6061faceBuffer[arrayPos1].b = arrayPos062vertexBuffer[arrayPos0].x = object.worldShadowPos.x63vertexBuffer[arrayPos0].y = object.worldShadowPos.y64vertexBuffer[arrayPos0].z = object.worldShadowPos.z65temp0 = object[0].ypos66temp0 -= 0xE0000067object.scale = object.ypos68object.scale -= temp069if object.scale > 070object.scale >>= 1471object.scale += 0x40072else73object.scale = 0x40074end if75vertexBuffer[arrayPos0].u = object.scale76vertexBuffer[arrayPos0].v = object.scale77arrayPos0++7879faceBuffer[arrayPos1].c = arrayPos080vertexBuffer[arrayPos0].x = object.worldShadowPos.x81vertexBuffer[arrayPos0].y = object.worldShadowPos.y82vertexBuffer[arrayPos0].z = object.worldShadowPos.z83vertexBuffer[arrayPos0].u = 1784vertexBuffer[arrayPos0].v = 1685arrayPos0++8687faceBuffer[arrayPos1].d = arrayPos088vertexBuffer[arrayPos0].x = object.worldShadowPos.x89vertexBuffer[arrayPos0].y = object.worldShadowPos.y90vertexBuffer[arrayPos0].z = object.worldShadowPos.z91arrayPos0++9293arrayPos1++94scene3D.vertexCount += 495scene3D.faceCount++96end if9798faceBuffer[arrayPos1].flag = FACE_TEXTURED_C99faceBuffer[arrayPos1].a = arrayPos0100vertexBuffer[arrayPos0].x = object.worldPos.x101vertexBuffer[arrayPos0].y = object.worldPos.y102vertexBuffer[arrayPos0].z = object.worldPos.z103vertexBuffer[arrayPos0].u = 83104vertexBuffer[arrayPos0].v = 50105arrayPos0++106107faceBuffer[arrayPos1].b = arrayPos0108vertexBuffer[arrayPos0].x = object.worldPos.x109vertexBuffer[arrayPos0].y = object.worldPos.y110vertexBuffer[arrayPos0].z = object.worldPos.z111temp0 = object[0].ypos112temp0 -= 0x1000000113temp1 = object.ypos114temp1 -= temp0115if temp1 > 0116temp1 >>= 14117temp1 += 0x600118else119temp1 = 0x600120end if121vertexBuffer[arrayPos0].u = temp1122vertexBuffer[arrayPos0].v = temp1123arrayPos0++124125faceBuffer[arrayPos1].c = arrayPos0126vertexBuffer[arrayPos0].x = object.worldPos.x127vertexBuffer[arrayPos0].y = object.worldPos.y128vertexBuffer[arrayPos0].z = object.worldPos.z129vertexBuffer[arrayPos0].u = 16130vertexBuffer[arrayPos0].v = 16131arrayPos0++132133faceBuffer[arrayPos1].d = arrayPos0134vertexBuffer[arrayPos0].x = object.worldPos.x135vertexBuffer[arrayPos0].y = object.worldPos.y136vertexBuffer[arrayPos0].z = object.worldPos.z137scene3D.vertexCount += 4138scene3D.faceCount++139140if object.localPos.z < halfpipe[0].playerPos.z141object.type = TypeName[Blank Object]142else143foreach (TypeName[Player Object], currentPlayer, ACTIVE_ENTITIES)144temp1 = object.localPos.z145temp1 -= 0x20000146temp2 = object.localPos.z147temp2 += 0x20000148if player[currentPlayer].localPos.z > temp1149if player[currentPlayer].localPos.z < temp2150temp0 = player[currentPlayer].localPos.x151temp0 -= object.localPos.x152temp1 = temp0153temp1 *= temp0154155temp0 = player[currentPlayer].localPos.y156temp0 -= object.localPos.y157temp2 = temp0158temp2 *= temp0159temp1 += temp2160161if temp1 < 0xC40000162object.type = TypeName[Explosion]163object.animationTimer = 0164object.frame = 0165166if player[currentPlayer].state != Player_State_Hurt167if player[currentPlayer].invincibilityTimer == 0168CallFunction(Player_LoseRings)169if player[currentPlayer].gravity == 0170player[currentPlayer].state = Player_State_Hurt171else172player[currentPlayer].invincibilityTimer = 60173end if174end if175end if176177PlaySfx(SfxName[Bomb], false)178end if179end if180end if181next182end if183end event184185186event ObjectStartup187LoadSpriteSheet("Special/Objects.gif")188foreach (TypeName[Bomb], arrayPos0, ALL_ENTITIES)189object[arrayPos0].angle = object[arrayPos0].ixpos190object[arrayPos0].angle -= 448191object[arrayPos0].angle &= 0x1FF192193Sin(object[arrayPos0].localPos.x, object[arrayPos0].angle)194object[arrayPos0].localPos.x *= -48195object[arrayPos0].localPos.x >>= 1196197Cos(object[arrayPos0].localPos.y, object[arrayPos0].angle)198object[arrayPos0].localPos.y *= -48199object[arrayPos0].localPos.y >>= 1200201if object[arrayPos0].localPos.y < -0x800202object[arrayPos0].shadowsEnabled = true203204Sin(object[arrayPos0].localShadowPos.x, object[arrayPos0].angle)205object[arrayPos0].localShadowPos.x *= -60206object[arrayPos0].localShadowPos.x >>= 1207208Cos(object[arrayPos0].localShadowPos.y, object[arrayPos0].angle)209object[arrayPos0].localShadowPos.y *= -60210object[arrayPos0].localShadowPos.y >>= 1211212object[arrayPos0].worldShadowPos.u = 116213if object[arrayPos0].angle > 32214if object[arrayPos0].angle < 480215if object[arrayPos0].angle < 256216object[arrayPos0].worldShadowPos.u = 149217else218object[arrayPos0].worldShadowPos.u = 182219end if220end if221end if222end if223next224end event225226227// ========================228// Editor Events229// ========================230231event RSDKDraw232DrawSprite(0)233end event234235236event RSDKLoad237LoadSpriteSheet("Special/Objects.gif")238SpriteFrame(-8, -8, 16, 16, 233, 17)239240SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")241end event242243244