Path: blob/master/Sonic 1/Scripts/MZ/GrassFireball.txt
1482 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Grass Fireball Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer12private alias object.value1 : object.parentSlot13private alias object.value2 : object.platformPos14private alias object.value3 : object.parentType15private alias object.value4 : object.spawnLimit1617private alias 0 : GRASSFIREBALL_SETUP18private alias 1 : GRASSFIREBALL_MOVING19private alias 2 : GRASSFIREBALL_IDLE2021// Large Platform Aliases22private alias object.value1 : largePlatform.drawPos.y23private alias object.value3 : largePlatform.spawnedFireballs2425private alias 0 : LARGEPLATFORM_TYPE_ARCH26private alias 1 : LARGEPLATFORM_TYPE_CURVE27private alias 2 : LARGEPLATFORM_TYPE_RECT2829// ========================30// Static Values31// ========================3233// ========================34// Tables35// ========================3637event ObjectUpdate38switch object.state39case GRASSFIREBALL_SETUP40temp0 = object.platformPos41temp0 >>= 142switch object.parentType43case LARGEPLATFORM_TYPE_ARCH44GetTableValue(object.ypos, temp0, LargePlatform_heightTableArch)45object.ypos <<= 1646object.spawnLimit = 747break4849case LARGEPLATFORM_TYPE_CURVE50GetTableValue(object.ypos, temp0, LargePlatform_heightTableCurved)51object.ypos <<= 1652object.spawnLimit = 753break5455case LARGEPLATFORM_TYPE_RECT56object.ypos = -0x30000057object.spawnLimit = 358break5960end switch6162arrayPos0 = object.parentSlot63object.ypos += largePlatform[arrayPos0].drawPos.y64if object.propertyValue == 065CreateTempObject(TypeName[Grass Fireball], object.propertyValue, object.xpos, object.ypos)66object[tempObjectPos].propertyValue++67object[tempObjectPos].parentSlot = object.parentSlot68object[tempObjectPos].drawOrder = 569object[tempObjectPos].platformPos = object.platformPos70object[tempObjectPos].parentType = object.parentType71object[tempObjectPos].spawnLimit = object.spawnLimit72object[tempObjectPos].state = GRASSFIREBALL_MOVING73object[tempObjectPos].animationTimer = object.animationTimer74object.animationTimer = 075object.state = GRASSFIREBALL_IDLE76PlaySfx(SfxName[Fire Burn], false)77else78object.state++79end if80break8182case GRASSFIREBALL_MOVING83object.timer++84object.xpos += 0x1000085object.platformPos++86temp0 = object.platformPos87temp0 >>= 188switch object.parentType89case LARGEPLATFORM_TYPE_ARCH90GetTableValue(object.ypos, temp0, LargePlatform_heightTableArch)91object.ypos <<= 1692break9394case LARGEPLATFORM_TYPE_CURVE95GetTableValue(object.ypos, temp0, LargePlatform_heightTableCurved)96object.ypos <<= 1697break9899case LARGEPLATFORM_TYPE_RECT100object.ypos = -0x300000101break102103end switch104105arrayPos0 = object.parentSlot106object.ypos += largePlatform[arrayPos0].drawPos.y107if object.timer == 16108object.state++109if object.propertyValue < object.spawnLimit110CreateTempObject(TypeName[Grass Fireball], object.propertyValue, object.xpos, object.ypos)111object[tempObjectPos].propertyValue++112object[tempObjectPos].parentSlot = object.parentSlot113object[tempObjectPos].drawOrder = 5114object[tempObjectPos].platformPos = object.platformPos115object[tempObjectPos].parentType = object.parentType116object[tempObjectPos].spawnLimit = object.spawnLimit117if object.propertyValue == 7118object[tempObjectPos].state = GRASSFIREBALL_IDLE119else120object[tempObjectPos].state = GRASSFIREBALL_MOVING121end if122object[tempObjectPos].animationTimer = object.animationTimer123object.animationTimer = 0124PlaySfx(SfxName[Fire Burn], false)125end if126end if127break128129case GRASSFIREBALL_IDLE130temp0 = object.platformPos131temp0 >>= 1132switch object.parentType133case LARGEPLATFORM_TYPE_ARCH134GetTableValue(object.ypos, temp0, LargePlatform_heightTableArch)135object.ypos <<= 16136break137138case LARGEPLATFORM_TYPE_CURVE139GetTableValue(object.ypos, temp0, LargePlatform_heightTableCurved)140object.ypos <<= 16141break142143case LARGEPLATFORM_TYPE_RECT144object.ypos = -0x300000145break146147end switch148arrayPos0 = object.parentSlot149object.ypos += largePlatform[arrayPos0].drawPos.y150break151152end switch153154foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)155BoxCollisionTest(C_TOUCH, object.entityPos, -6, -14, 6, 14, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)156if checkResult == true157CallFunction(Player_FireHit)158end if159next160161object.frame = object.animationTimer162object.frame /= 12163object.direction = object.animationTimer164object.direction /= 6165object.direction &= 1166object.animationTimer++167object.animationTimer %= 24168169arrayPos0 = object.parentSlot170if object[arrayPos0].outOfBounds == true171object.type = TypeName[Blank Object]172largePlatform[arrayPos0].spawnedFireballs = false173end if174end event175176177event ObjectDraw178DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)179end event180181182event ObjectStartup183LoadSpriteSheet("MZ/Objects.gif")184SpriteFrame(-7, -23, 15, 31, 52, 114)185SpriteFrame(-8, -24, 16, 32, 68, 114)186end event187188189event RSDKDraw190DrawSprite(0)191end event192193194event RSDKLoad195LoadSpriteSheet("MZ/Objects.gif")196SpriteFrame(-7, -23, 15, 31, 52, 114)197198SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")199end event200201202