Path: blob/master/Sonic 2/Scripts/HPZ/Eggman.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: B08 Eggman Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// Using HPZEggman/B08Eggman as a prefix here because there's like 12 "Eggman" objects in the game so its less confusing this way8// ("B08 Eggman" is the object's TypeName in the scene btw, it's not like every other zone where it's just "Eggman" or MBZ where it's the boss's respective zone initials)910// ========================11// Aliases12// ========================1314private alias object.value0 : object.timer15private alias object.value1 : object.originPos.y16private alias object.value2 : object.oscillationAngle17private alias object.value3 : object.health18private alias object.value4 : object.invincibilityTimer19private alias object.value5 : object.exploding20private alias object.value6 : object.boundsM21private alias object.value7 : object.boundsL // unused22private alias object.value8 : object.boundsR // unused23private alias object.value9 : object.boundsT24private alias object.value10 : object.boundsB25private alias object.value11 : object.groundPos26// value12 is unused27private alias object.value13 : object.flameAnimation28private alias object.value14 : object.flameAnimTimer29// value15 is unused30private alias object.value16 : object.shakeTimer31private alias object.value17 : object.trumboneExtendPos32private alias object.value18 : object.trumboneExtendMax33private alias object.value19 : object.trumboneOffset.y34private alias object.value20 : object.showTrumbone35private alias object.value21 : object.trumboneExtendSpeed36private alias object.value22 : object.trumboneVelocity.y37private alias object.value23 : object.mineSlot38private alias object.value24 : object.waterLevel39private alias object.value25 : object.impactCount4041// Eggman States42private alias 0 : HPZEGGMAN_AWAITPLAYER43private alias 1 : HPZEGGMAN_ENTERDELAY44private alias 2 : HPZEGGMAN_ENTEREGGMAN45private alias 3 : HPZEGGMAN_EXTENDTRUMBONE46private alias 4 : HPZEGGMAN_DROPSMALLBOMBS47private alias 5 : HPZEGGMAN_DROPPEDSMALLBOMBS48private alias 6 : HPZEGGMAN_RAISEBOMBS49private alias 7 : HPZEGGMAN_PLAYLOUDHORN50private alias 8 : HPZEGGMAN_DROPLARGEBOMB51private alias 9 : HPZEGGMAN_AWAITBOMBSEXPLODE52private alias 10 : HPZEGGMAN_GEYSERHIT53private alias 11 : HPZEGGMAN_GEYSERFALL54private alias 12 : HPZEGGMAN_GEYSERRISE55private alias 13 : HPZEGGMAN_EXPLODE56private alias 14 : HPZEGGMAN_DEFEATFALL57private alias 15 : HPZEGGMAN_DEFEATRISE58private alias 16 : HPZEGGMAN_FLEE59private alias 17 : HPZEGGMAN_ESCAPE6061// Eggman Animations62private alias 0 : HPZEGGANI_INVISIBLE63private alias 1 : HPZEGGANI_IDLE64private alias 2 : HPZEGGANI_LAUGH65private alias 3 : HPZEGGANI_HIT66private alias 4 : HPZEGGANI_DEFEATED67private alias 5 : HPZEGGANI_TOASTED68private alias 6 : HPZEGGANI_PANIC6970// Flame Animations71private alias 0 : FLAMEANI_INVISIBLE72private alias 1 : FLAMEANI_FALLING73private alias 2 : FLAMEANI_RISE74private alias 3 : FLAMEANI_MOVING7576// EggmanHorn Aliases77private alias object.value0 : hpzEggmanHorn.timer7879// EggmanHorn States80private alias 0 : HPZEGGMANHORN_IDLE81private alias 1 : HPZEGGMANHORN_PLAYINGNOISE82private alias 2 : HPZEGGMANHORN_FINISHEDNOISE83private alias 3 : HPZEGGMANHORN_DEBRIS8485// EggmanValve States86private alias 0 : HPZEGGMANVALVE_RESETBOTH87private alias 1 : HPZEGGMANVALVE_USEL88private alias 2 : HPZEGGMANVALVE_USER89private alias 3 : HPZEGGMANVALVE_USEBOTH90private alias 4 : HPZEGGMANVALVE_DEBRIS9192// EggmanMine States93private alias 0 : HPZEGGMANMINE_SETUP94private alias 1 : HPZEGGMANMINE_SMALL_FALL95private alias 2 : HPZEGGMANMINE_SMALL_RISE96private alias 3 : HPZEGGMANMINE_SMALL_FLOAT97private alias 4 : HPZEGGMANMINE_SMALL_EXPLODE98private alias 5 : HPZEGGMANMINE_BIG_FALL99private alias 6 : HPZEGGMANMINE_BIG_FOLLOW100private alias 7 : HPZEGGMANMINE_BIG_EXPLODE101private alias 8 : HPZEGGMANMINE_BIG_EXPLODED102103// BreakGem Aliases104private alias object.value1 : breakGem.gravityStrength105106// BreakGem States107private alias 1 : BREAKGEM_SHARD108109// Music Events110private alias 26 : SLOT_MUSICEVENT_BOSS111112private alias 0 : MUSICEVENT_FADETOBOSS113private alias 1 : MUSICEVENT_FADETOSTAGE114115// Player Aliases116private alias object.xpos : player.xpos117private alias object.ypos : player.ypos118private alias object.xvel : player.xvel119private alias object.yvel : player.yvel120private alias object.speed : player.speed121private alias object.animation : player.animation122private alias object.collisionRight : player.collisionRight123124private alias object.value40 : player.hitboxLeft125private alias object.value38 : player.hitboxTop126private alias object.value41 : player.hitboxRight127private alias object.value39 : player.hitboxBottom128129130// ========================131// Function Declarations132// ========================133134reserve function B08Eggman_Oscillate135reserve function B08Eggman_HandleChildren136reserve function B08Eggman_HandleMovement137138139// ========================140// Tables141// ========================142143private table B08Eggman_flameFrames_Falling1447, 7, 8, 8145end table146147private table B08Eggman_flameFrames_Rise1489, 9, 10, 10149end table150151private table B08Eggman_flameFrames_Moving15211, 11, 12, 12153end table154155156// ========================157// Function Definitions158// ========================159160private function B08Eggman_Oscillate161Sin256(object.ypos, object.oscillationAngle)162object.ypos <<= 10163object.ypos += object.originPos.y164object.oscillationAngle += 2165object.oscillationAngle &= 0xFF166end function167168169private function B08Eggman_HandleChildren170// Horn171object[+1].xpos = object.xpos172object[+1].ypos = object.ypos173object[+1].direction = object.direction174175// Valve176object[+2].xpos = object.xpos177object[+2].ypos = object.ypos178object[+2].direction = object.direction179end function180181182private function B08Eggman_HandleMovement183checkResult = false184foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)185if player[currentPlayer].yvel < 0186checkResult |= true187end if188next189190if checkResult == true191object.originPos.y -= 0xC000192if object.originPos.y < object.boundsB193object.originPos.y = object.boundsB194end if195object.flameAnimation = FLAMEANI_MOVING196else197object.originPos.y += 0x8000198if object.originPos.y > object.boundsT199object.originPos.y = object.boundsT200end if201object.flameAnimation = FLAMEANI_FALLING202end if203204temp0 = player[0].xpos205temp0 -= 0x80000206temp1 = player[0].xpos207temp1 += 0x80000208if object.xpos < temp0209object.xpos += 0x10000210object.direction = FLIP_X211end if212213if object.xpos > temp1214object.xpos -= 0x10000215object.direction = FLIP_NONE216end if217end function218219220// ========================221// Events222// ========================223224event ObjectUpdate225switch object.state226case HPZEGGMAN_AWAITPLAYER227if player[0].xpos > object[+1].xpos228temp0 = object[+1].ixpos229temp0 -= screen.xcenter230stage.newXBoundary1 = temp0231232temp0 = object[+1].ixpos233temp0 += screen.xcenter234stage.newXBoundary2 = temp0235236temp0 = stage.newYBoundary2237temp0 -= screen.ysize238stage.newYBoundary1 = temp0239240object.boundsM = object[+1].xpos241object.boundsL = -112242object.boundsL *= screen.xsize243object.boundsL /= 320244object.boundsL <<= 16245object.boundsR = object.boundsL246FlipSign(object.boundsR)247248object.boundsL += object[-1].xpos249object.boundsR += object[-1].xpos250object.boundsT = object[+1].ypos251object.boundsB = object.boundsT252object.boundsB -= 0x200000253object.groundPos = object[+2].ypos254255object.xpos = 72256object.xpos *= screen.xsize257object.xpos /= 320258object.xpos <<= 16259object.xpos += object[+1].xpos260object.ypos = object.boundsT261object.ypos += 0xF00000262263object.animation = HPZEGGANI_IDLE264ResetObjectEntity(SLOT_MUSICEVENT_BOSS, TypeName[Music Event], MUSICEVENT_FADETOBOSS, 0, 0)265object[SLOT_MUSICEVENT_BOSS].priority = PRIORITY_ACTIVE266267object[+1].type = TypeName[Eggman Horn]268object[+2].type = TypeName[Eggman Valve]269CallFunction(B08Eggman_HandleChildren)270object.trumboneExtendPos = -0x280000271object.showTrumbone = true272object.flameAnimation = FLAMEANI_RISE273HPZSetup_bossFightActive = true274object.waterLevel = object[-1].iypos275stage.waterLevel = object.waterLevel276stage.waterLevel += 192277object.priority = PRIORITY_ACTIVE278object.state = HPZEGGMAN_ENTERDELAY279end if280break281282case HPZEGGMAN_ENTERDELAY283object.timer++284if object.timer == 60285object.timer = 0286object.yvel = 0287object.state = HPZEGGMAN_ENTEREGGMAN288end if289break290291case HPZEGGMAN_ENTEREGGMAN292object.yvel -= 0x1800293if object.yvel < -0x20000294object.yvel = -0x20000295end if296297object.ypos += object.yvel298if stage.waterLevel > object.waterLevel299stage.waterLevel -= 2300end if301302if object.ypos <= object.boundsT303object.ypos = object.boundsT304object.originPos.y = object.ypos305306#platform: USE_STANDALONE307object.health = 8308#endplatform309#platform: USE_ORIGINS310if game.bossOneLife == false311object.health = 8312else313object.health = 1314end if315#endplatform316317object.state = HPZEGGMAN_EXTENDTRUMBONE318end if319320CallFunction(B08Eggman_HandleChildren)321break322323case HPZEGGMAN_EXTENDTRUMBONE324object.timer++325if object.trumboneExtendPos < -0x280000326object.trumboneExtendPos += 0x20000327end if328329if object.timer == 240330object.timer = 0331object.mineSlot = object.entityPos332object.mineSlot -= 4333object.trumboneExtendMax = -0x280000334object.state = 4335end if336337CallFunction(B08Eggman_HandleMovement)338CallFunction(B08Eggman_Oscillate)339CallFunction(B08Eggman_HandleChildren)340break341342case HPZEGGMAN_DROPSMALLBOMBS343temp0 = object.timer344temp0 %= 60345if temp0 == 0346object[+1].state = HPZEGGMANHORN_PLAYINGNOISE347hpzEggmanHorn[+1].timer = 30348object[+2].state++349if object[+2].state == HPZEGGMANVALVE_USEBOTH350object[+2].state = HPZEGGMANVALVE_USEL351end if352353temp1 = object.timer354temp1 /= 60355switch temp1356case 0357PlaySfx(SfxName[Horn 1], false)358break359360case 1361PlaySfx(SfxName[Horn 2], false)362break363364case 2365PlaySfx(SfxName[Horn 3], false)366break367368case 3369PlaySfx(SfxName[Horn 4], false)370break371end switch372end if373374if hpzEggmanHorn[+1].timer == 1375temp1 = screen.xsize376temp1 *= 224377temp1 >>= 8378Rand(temp0, temp1)379temp0 >>= 6380temp0 <<= 6381temp1 >>= 1382temp0 -= temp1383temp0 <<= 16384temp0 += object.boundsM385foreach (TypeName[Eggman Mine], arrayPos0, ACTIVE_ENTITIES)386temp1 = object[arrayPos0].xpos387temp1 -= temp0388Abs(temp1)389if temp1 <= 0x180000390if temp0 < object.boundsM391temp0 += 0x200000392else393temp0 -= 0x200000394end if395end if396next397398arrayPos0 = object.mineSlot399ResetObjectEntity(object.mineSlot, TypeName[Eggman Mine], 0, temp0, object.boundsB)400object[arrayPos0].ypos -= 0x400000401object.mineSlot++402object.trumboneExtendMax -= 0xA0000403end if404405if hpzEggmanHorn[+1].timer == 0406if object.trumboneExtendPos > object.trumboneExtendMax407object.trumboneExtendPos -= 0x10000408end if409end if410411object.timer++412if object.timer == 240413object.timer = 0414object.state = HPZEGGMAN_DROPPEDSMALLBOMBS415object[+2].state = HPZEGGMANVALVE_RESETBOTH416end if417418CallFunction(B08Eggman_HandleMovement)419CallFunction(B08Eggman_Oscillate)420CallFunction(B08Eggman_HandleChildren)421break422423case HPZEGGMAN_DROPPEDSMALLBOMBS424object.timer++425if object.timer == 160426object.timer = 0427object.angle = 256428object[+1].state = HPZEGGMANHORN_FINISHEDNOISE429hpzEggmanHorn[+1].timer = 128430object.state = HPZEGGMAN_RAISEBOMBS431PlaySfx(SfxName[Horn Sweep], false)432end if433434CallFunction(B08Eggman_HandleMovement)435CallFunction(B08Eggman_Oscillate)436CallFunction(B08Eggman_HandleChildren)437break438439case HPZEGGMAN_RAISEBOMBS440object.angle += 4441Cos(stage.waterLevel, object.angle)442stage.waterLevel >>= 4443FlipSign(stage.waterLevel)444stage.waterLevel -= 32445temp0 = stage.waterLevel446temp0 *= 3447temp0 /= 6448object.trumboneExtendPos = -80449object.trumboneExtendPos -= temp0450object.trumboneExtendPos <<= 16451stage.waterLevel += object.waterLevel452if object.angle == 0x300453object[-1].state = HPZEGGMANMINE_SMALL_EXPLODE454object[-2].state = HPZEGGMANMINE_SMALL_EXPLODE455object[-3].state = HPZEGGMANMINE_SMALL_EXPLODE456object[-4].state = HPZEGGMANMINE_SMALL_EXPLODE457object[+2].state = HPZEGGMANVALVE_RESETBOTH458object.state = HPZEGGMAN_PLAYLOUDHORN459end if460461CallFunction(B08Eggman_HandleMovement)462CallFunction(B08Eggman_Oscillate)463CallFunction(B08Eggman_HandleChildren)464break465466case HPZEGGMAN_PLAYLOUDHORN467object.timer++468if object.trumboneExtendPos < -0x280000469object.trumboneExtendPos += 0x20000470end if471472if object.timer == 240473object.timer = 0474object[+1].state = HPZEGGMANHORN_PLAYINGNOISE475hpzEggmanHorn[+1].timer = 240476object[+2].state = HPZEGGMANVALVE_USEBOTH477object.state = HPZEGGMAN_DROPLARGEBOMB478PlaySfx(SfxName[Loud Horn], false)479end if480481CallFunction(B08Eggman_HandleMovement)482CallFunction(B08Eggman_Oscillate)483CallFunction(B08Eggman_HandleChildren)484break485486case HPZEGGMAN_DROPLARGEBOMB487if object.trumboneExtendPos > -0x500000488object.trumboneExtendPos -= 0x40000489end if490491if hpzEggmanHorn[+1].timer == 0492object.state = HPZEGGMAN_AWAITBOMBSEXPLODE493object[+2].state = HPZEGGMANVALVE_RESETBOTH494arrayPos0 = object.entityPos495arrayPos0--496ResetObjectEntity(arrayPos0, TypeName[Eggman Mine], 2, player[0].xpos, object.boundsB)497object[arrayPos0].ypos -= 0x400000498end if499500temp0 = oscillation501temp0 &= 7502if temp0 == 0503temp0 = oscillation504temp0 &= 15505if temp0 == 0506temp0 = 10507else508temp0 = 11509end if510511Rand(temp1, screen.xsize)512temp1 -= screen.xcenter513temp1 <<= 16514temp1 += object.boundsM515temp2 = object.boundsT516temp2 -= 0x500000517CreateTempObject(TypeName[Break Gem], temp0, temp1, temp2)518breakGem[tempObjectPos].gravityStrength = 0x2800519object[tempObjectPos].state = BREAKGEM_SHARD520end if521522CallFunction(B08Eggman_HandleMovement)523CallFunction(B08Eggman_Oscillate)524CallFunction(B08Eggman_HandleChildren)525break526527case HPZEGGMAN_AWAITBOMBSEXPLODE528if object[-1].type == TypeName[Blank Object]529if object[-2].type == TypeName[Blank Object]530object.state = HPZEGGMAN_EXTENDTRUMBONE531end if532end if533534CallFunction(B08Eggman_HandleMovement)535CallFunction(B08Eggman_Oscillate)536CallFunction(B08Eggman_HandleChildren)537break538539case HPZEGGMAN_GEYSERHIT540// is this supposed to be set...?541// update: is this set from water geyser????542// why does this use arrayPos0 here lol543object[arrayPos0].flameAnimation = 0544switch object.shakeTimer545case 0546object.xpos += 0x20000547break548549case 2550object.xpos -= 0x20000551break552553end switch554555object.animation = HPZEGGANI_HIT556object.shakeTimer++557object.shakeTimer &= 3558CallFunction(B08Eggman_HandleChildren)559break560561case HPZEGGMAN_GEYSERFALL562object.ypos += object.yvel563object.yvel += 0x1800564565if object.impactCount < 3566if object.ypos > object.groundPos567object.ypos = object.groundPos568object.yvel >>= 1569FlipSign(object.yvel)570object.impactCount++571PlaySfx(SfxName[Ground Impact], false)572end if573else574if object.yvel > 0575object.impactCount = 0576object.flameAnimation = FLAMEANI_FALLING577object.state = HPZEGGMAN_GEYSERRISE578end if579end if580581CallFunction(B08Eggman_HandleChildren)582break583584case HPZEGGMAN_GEYSERRISE585object.yvel -= 0x1800586if object.yvel < -0x20000587object.yvel = -0x20000588object.flameAnimation = FLAMEANI_RISE589end if590591object.ypos += object.yvel592if object.ypos <= object.boundsT593object.ypos = object.boundsT594object.originPos.y = object.ypos595object.oscillationAngle = 0596object.state = HPZEGGMAN_EXTENDTRUMBONE597end if598599CallFunction(B08Eggman_HandleChildren)600break601602case HPZEGGMAN_EXPLODE603object.timer++604if object.timer == 30605object.trumboneExtendSpeed = -0x20000606object.trumboneVelocity.y = 0607end if608609if object.showTrumbone == true610object.trumboneExtendPos += object.trumboneExtendSpeed611if object.trumboneExtendPos < -0x500000612object.trumboneVelocity.y += 0x3800613object.trumboneOffset.y += object.trumboneVelocity.y614end if615end if616617if object.timer == 60618if object.direction == FLIP_NONE619object[+1].xvel = -0x10000620else621object[+1].xvel = 0x10000622end if623object[+1].yvel = -0x20000624object[+1].state = HPZEGGMANHORN_DEBRIS625end if626627if object.timer == 120628object.showTrumbone = false629if object.direction == FLIP_NONE630object[+2].xvel = 0x10000631else632object[+2].xvel = -0x10000633end if634object[+2].yvel = -0x20000635object[+2].state = HPZEGGMANVALVE_DEBRIS636end if637638if object.timer == 180639object.timer = 0640object.animation = HPZEGGANI_TOASTED641object.exploding = false642object.yvel = 0643object.flameAnimation = FLAMEANI_INVISIBLE644HPZSetup_bossFightActive = false645object.state = HPZEGGMAN_DEFEATFALL646ResetObjectEntity(SLOT_MUSICEVENT_BOSS, TypeName[Music Event], MUSICEVENT_FADETOSTAGE, 0, 0)647object[SLOT_MUSICEVENT_BOSS].priority = PRIORITY_ACTIVE648649// this should prolly be an animal prison or signpost?650// in the layout its just a ring651// a little speculation here - if it was a signpost this state'd be SIGNPOST_IDLE_VS which is kinda weird, but it'd be SIGNPOST_EXITSTAGERIGHT with the S1 ver of the obj652// if it was an animal prison though, it'd be ANIMALPRISON_HANDLEACTCLEAR in both games, nothing too strange653object[+3].priority = PRIORITY_ACTIVE654object[+3].state = 3655656temp0 = tileLayer[0].xsize657temp0 <<= 7658stage.newXBoundary2 = temp0659end if660break661662case HPZEGGMAN_DEFEATFALL663object.ypos += object.yvel664object.yvel += 0x1800665666object.timer++667if object.timer == 16668object.yvel = 0669object.timer = 0670object.animationTimer = 0671object.flameAnimation = FLAMEANI_FALLING672object.state++673end if674break675676case HPZEGGMAN_DEFEATRISE677if object.timer < 24678object.ypos += object.yvel679object.yvel -= 0x800680object.timer++681else682object.timer = 0683object.yvel = 0684object.originPos.y = object.ypos685object.state++686end if687break688689case HPZEGGMAN_FLEE690CallFunction(B08Eggman_Oscillate)691if object.timer < 8692object.timer++693else694object.timer = 0695object.animation = HPZEGGANI_PANIC696object.flameAnimation = FLAMEANI_RISE697object.animationTimer = 0698object.direction = FLIP_X699object.priority = PRIORITY_ACTIVE700701#platform: USE_STANDALONE702// Stage bounds are already restored in HPZEGGMAN_EXPLODE, Origins removed the unnecesary duplicate code703temp0 = tileLayer[0].xsize704temp0 <<= 7705stage.newXBoundary2 = temp0706#endplatform707708object.state++709end if710break711712case HPZEGGMAN_ESCAPE713object.xpos += 0x40000714object.originPos.y -= 0x4000715CallFunction(B08Eggman_Oscillate)716if object.outOfBounds == true717ResetObjectEntity(object.entityPos, TypeName[Blank Object], 0, 0, 0)718end if719break720721end switch722723if object.health != 0724if object.invincibilityTimer > 0725object.invincibilityTimer--726GetBit(temp0, object.invincibilityTimer, 0)727if temp0 == true728SetPaletteEntry(0, 192, 0xE0E0E0)729else730SetPaletteEntry(0, 192, 0x000000)731end if732end if733734foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)735if object.invincibilityTimer < 32736CheckEqual(player[currentPlayer].animation, ANI_HURT)737temp0 = checkResult738CheckEqual(player[currentPlayer].animation, ANI_DYING)739temp0 |= checkResult740CheckEqual(player[currentPlayer].animation, ANI_DROWNING)741temp0 |= checkResult742if temp0 != false743if object.animation != HPZEGGANI_LAUGH744object.animation = HPZEGGANI_LAUGH745object.animationTimer = 0746end if747end if748749BoxCollisionTest(C_TOUCH, object.entityPos, -24, -24, 24, 20, currentPlayer, player[currentPlayer].hitboxLeft, player[currentPlayer].hitboxTop, player[currentPlayer].hitboxRight, player[currentPlayer].hitboxBottom)750if checkResult == true751CallFunction(Player_CheckHit)752if checkResult == true753object.health--754if object.health == 0755#platform: USE_ORIGINS756CallNativeFunction2(NotifyCallback, NOTIFY_KILL_BOSS, 0)757CallNativeFunction2(NotifyCallback, NOTIFY_BOSS_END, 1)758#endplatform759player.score += 1000760object.timer = 0761object.animation = HPZEGGANI_DEFEATED762object.flameAnimation = FLAMEANI_FALLING763object.animationTimer = 0764object.exploding = true765object.originPos.y = object.ypos766object.state = HPZEGGMAN_EXPLODE767SetPaletteEntry(0, 192, 0x000000)768else769object.animation = HPZEGGANI_HIT770object.animationTimer = 0771object.invincibilityTimer = 64772PlaySfx(SfxName[Boss Hit], false)773end if774end if775end if776777if object.flameAnimation == FLAMEANI_MOVING778BoxCollisionTest(C_TOUCH, object.entityPos, -8, 0, 8, 32, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)779if checkResult == true780CallFunction(Player_Hit)781end if782end if783end if784next785end if786787if object.state != HPZEGGMAN_ESCAPE788foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)789temp0 = player[currentPlayer].collisionRight790temp0 <<= 16791temp0 += player[currentPlayer].xpos792temp1 = stage.curXBoundary2793temp1 <<= 16794if temp0 > temp1795player[currentPlayer].xvel = 0796player[currentPlayer].speed = 0797player[currentPlayer].xpos = temp1798temp0 = player[currentPlayer].collisionRight799temp0 <<= 16800player[currentPlayer].xpos -= temp0801end if802next803end if804805if object.exploding == true806temp0 = oscillation807temp0 &= 7808if temp0 == 0809Rand(temp0, 48)810temp0 -= 24811temp0 <<= 16812temp0 += object.xpos813Rand(temp1, 48)814temp1 -= 24815temp1 <<= 16816temp1 += object.ypos817CreateTempObject(TypeName[Explosion], 0, temp0, temp1)818object[tempObjectPos].drawOrder = 5819PlaySfx(SfxName[Explosion], false)820end if821end if822end event823824825event ObjectDraw826temp2 = object.trumboneExtendPos827FlipSign(temp2)828temp2 >>= 16829if temp2 < 0830temp2 = 0831end if832if temp2 > 80833temp2 = 80834end if835836temp3 = object.trumboneExtendPos837temp3 >>= 16838temp3 -= 16839temp4 = object.trumboneOffset.y840temp4 += object.ypos841842if object.showTrumbone == true843EditFrame(13, temp3, 0, temp2, 6, 265, 235)844DrawSpriteFX(13, FX_FLIP, object.xpos, temp4)845end if846847DrawSpriteFX(6, FX_FLIP, object.xpos, object.ypos)848849switch object.animation850default851case HPZEGGANI_INVISIBLE852break853854case HPZEGGANI_IDLE855temp0 = object.animationTimer856temp0 >>= 3857object.animationTimer++858object.animationTimer &= 15859DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)860break861862case HPZEGGANI_LAUGH863temp0 = object.animationTimer864temp0 &= 15865temp0 >>= 3866temp0 += 2867object.animationTimer++868if object.animationTimer == 50869object.animationTimer = 0870if player[0].animation != ANI_DYING871object.animation = HPZEGGANI_IDLE872end if873end if874DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)875break876877case HPZEGGANI_HIT878temp0 = object.animationTimer // huh? temp0 isn't used here at all, what's this for?879temp0 &= 1880temp0 += 2 // ..2? that's the frame offset for the laughing animation though..881object.animationTimer++882if object.animationTimer == 50883object.animationTimer = 0884object.animation = HPZEGGANI_IDLE885end if886DrawSpriteFX(4, FX_FLIP, object.xpos, object.ypos)887break888889case HPZEGGANI_DEFEATED890temp0 = object.animationTimer891temp0 >>= 5892temp0 += 4893temp0 %= 5894object.animationTimer++895object.animationTimer &= 63896DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)897break898899case HPZEGGANI_TOASTED900DrawSpriteFX(5, FX_FLIP, object.xpos, object.ypos)901break902903case HPZEGGANI_PANIC904temp0 = object.animationTimer905temp0 >>= 3906object.animationTimer++907object.animationTimer &= 15908DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)909temp0 = object.animationTimer910temp0 >>= 2911temp0 &= 1912if temp0 == 1913DrawSpriteFX(15, FX_FLIP, object.xpos, object.ypos)914end if915break916917end switch918919if object.showTrumbone == true920EditFrame(14, temp3, 6, temp2, 6, 265, 241)921DrawSpriteFX(14, FX_FLIP, object.xpos, temp4)922end if923924switch object.flameAnimation925default926case FLAMEANI_INVISIBLE927break928929case FLAMEANI_FALLING930GetTableValue(temp0, object.flameAnimTimer, B08Eggman_flameFrames_Falling)931object.flameAnimTimer++932object.flameAnimTimer &= 3933DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)934break935936case FLAMEANI_RISE937GetTableValue(temp0, object.flameAnimTimer, B08Eggman_flameFrames_Rise)938object.flameAnimTimer++939object.flameAnimTimer &= 3940DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)941break942943case FLAMEANI_MOVING944GetTableValue(temp0, object.flameAnimTimer, B08Eggman_flameFrames_Moving)945object.flameAnimTimer++946object.flameAnimTimer &= 3947DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)948break949950end switch951end event952953954event ObjectStartup955LoadSpriteSheet("HPZ/Objects.gif")956SpriteFrame(-28, -28, 60, 20, 265, 139) // eggman idle 1 - #0957SpriteFrame(-28, -28, 60, 20, 326, 139) // eggman idle 2 - #1958SpriteFrame(-28, -28, 60, 20, 265, 160) // eggman laugh 1 - #2959SpriteFrame(-28, -28, 60, 20, 326, 160) // eggman laugh 2 - #3960SpriteFrame(-28, -28, 60, 20, 265, 181) // eggman hit - #4961SpriteFrame(-28, -28, 60, 20, 326, 181) // eggman destroyed - #5962SpriteFrame(-32, -8, 64, 32, 265, 202) // eggmobile - #6963SpriteFrame(-4, 24, 16, 8, 432, 178) // flame 1 - #7964SpriteFrame(-4, 24, 16, 12, 415, 170) // flame 2 - #8965SpriteFrame(-4, 24, 16, 8, 432, 178) // flame 3 - #9966SpriteFrame(-4, 24, 16, 24, 432, 153) // flame 4 - #10967SpriteFrame(-4, 24, 16, 12, 415, 157) // flame 5 - #11968SpriteFrame(-4, 24, 16, 24, 398, 157) // flame 6 - #12969SpriteFrame(-96, 0, 80, 6, 265, 235) // trumbone (top) - #13970SpriteFrame(-96, 6, 80, 6, 265, 241) // trumbone (bottom) - #14971SpriteFrame(3, -28, 11, 8, 437, 187) // panic sweat - #15972end event973974975// ========================976// Editor Events977// ========================978979event RSDKDraw980DrawSprite(6)981DrawSprite(0)982end event983984985event RSDKLoad986LoadSpriteSheet("HPZ/Objects.gif")987SpriteFrame(-28, -28, 60, 20, 265, 139)988SpriteFrame(-28, -28, 60, 20, 326, 139)989SpriteFrame(-28, -28, 60, 20, 265, 160)990SpriteFrame(-28, -28, 60, 20, 326, 160)991SpriteFrame(-28, -28, 60, 20, 265, 181)992SpriteFrame(-28, -28, 60, 20, 326, 181)993SpriteFrame(-32, -8, 64, 32, 265, 202)994SpriteFrame(-4, 24, 16, 8, 432, 178)995SpriteFrame(-4, 24, 16, 12, 415, 170)996SpriteFrame(-4, 24, 16, 8, 432, 178)997SpriteFrame(-4, 24, 16, 24, 432, 153)998SpriteFrame(-4, 24, 16, 12, 415, 157)999SpriteFrame(-4, 24, 16, 24, 398, 157)1000SpriteFrame(-96, 0, 80, 6, 265, 235)1001SpriteFrame(-96, 6, 80, 6, 265, 241)1002SpriteFrame(3, -28, 11, 8, 437, 187)10031004SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")1005end event100610071008