Path: blob/master/Sonic 2/Scripts/Mission/MissionWindCurrent.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Wind Current Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// This Object is used in Mission "Quick Step" - M050 - Mission_Zone1189// ========================10// Aliases11// ========================1213private alias object.value0 : object.minPos.x14private alias object.value1 : object.minPos.y15private alias object.value2 : object.maxPos.x16private alias object.value3 : object.maxPos.y1718// Player Aliases19private alias object.gravity : player.gravity20private alias object.animation : player.animation21private alias object.speed : player.speed22private alias object.xpos : player.xpos23private alias object.ypos : player.ypos24private alias object.xvel : player.xvel25private alias object.yvel : player.yvel26private alias object.state : player.state27private alias object.tileCollisions : player.tileCollisions28private alias object.up : player.up29private alias object.down : player.down30private alias object.left : player.left31private alias object.right : player.right323334// ========================35// Function declarations36// ========================3738reserve function WindCurrent_State_Clinging394041// ========================42// Function Definitions43// ========================4445// Copy of WFZSetup_State_Clinging, just with those xvel and speed values' signs flipped46private function WindCurrent_State_Clinging47player.gravity = GRAVITY_AIR4849if player.animation != ANI_CLINGING50player.xvel = 0x8000051player.speed = 0x8000052else53player.xvel = 054player.speed = 055end if5657if player.up == true58player.ypos -= 0x1000059else60if player.down == true61player.ypos += 0x1000062end if63end if6465player.yvel = 066end function676869// ========================70// Events71// ========================727374event ObjectUpdate75temp6 = PRIORITY_XBOUNDS7677foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)78CheckLower(player[currentPlayer].xpos, object.minPos.x)79temp0 = checkResult80CheckGreater(player[currentPlayer].xpos, object.minPos.y)81temp0 |= checkResult82CheckLower(player[currentPlayer].ypos, object.maxPos.x)83temp0 |= checkResult84CheckGreater(player[currentPlayer].ypos, object.maxPos.y)85temp0 |= checkResult86if temp0 == false87temp6 = PRIORITY_ACTIVE8889CheckEqual(player[currentPlayer].state, Player_State_GotHit)90temp0 = checkResult91CheckEqual(player[currentPlayer].state, Player_State_Hurt)92temp0 |= checkResult93CheckEqual(player[currentPlayer].state, Player_State_Death)94temp0 |= checkResult95CheckEqual(player[currentPlayer].state, Player_State_Drown)96temp0 |= checkResult97CheckEqual(player[currentPlayer].state, WindCurrent_State_Clinging)98temp0 |= checkResult99if temp0 == false100player[currentPlayer].state = WindCurrent_State_Clinging101player[currentPlayer].animation = ANI_FANROTATE102player[currentPlayer].tileCollisions = true103end if104105if player[currentPlayer].animation == ANI_FANROTATE106if player[currentPlayer].xvel == 0107temp1 = object.maxPos.y108temp1 -= object.maxPos.x109temp1 >>= 1110temp1 += object.maxPos.x111if player[currentPlayer].ypos < temp1112player[currentPlayer].ypos += 0x40000113else114player[currentPlayer].ypos -= 0x40000115end if116end if117end if118else119if player[currentPlayer].state == WindCurrent_State_Clinging120player[currentPlayer].state = Player_State_Air_NoDropDash121player[currentPlayer].xvel = 0x40000 // these values are normally negative in the original Wind Current script, the Mission ver flips them122player[currentPlayer].speed = 0x40000123end if124end if125next126127object.priority = temp6128if object.propertyValue == 0129object[+1].priority = temp6130else131object[-1].priority = temp6132end if133end event134135136event ObjectStartup137foreach (TypeName[Wind Current], arrayPos0, ALL_ENTITIES)138if object[arrayPos0].propertyValue == 0139arrayPos1 = arrayPos0140arrayPos1++141object[arrayPos0].minPos.x = object[arrayPos0].xpos142object[arrayPos0].minPos.y = object[arrayPos1].xpos143temp1 = object[arrayPos0].ypos144temp2 = object[arrayPos1].ypos145else146arrayPos1 = arrayPos0147arrayPos1--148object[arrayPos0].minPos.x = object[arrayPos1].xpos149object[arrayPos0].minPos.y = object[arrayPos0].xpos150temp1 = object[arrayPos1].ypos151temp2 = object[arrayPos0].ypos152end if153154if temp1 < temp2155object[arrayPos0].maxPos.x = temp1156object[arrayPos0].maxPos.y = temp2157else158object[arrayPos0].maxPos.x = temp2159object[arrayPos0].maxPos.y = temp1160end if161162object[arrayPos0].priority = PRIORITY_XBOUNDS163next164end event165166167// ========================168// Editor Events169// ========================170171event RSDKEdit172if editor.returnVariable == true173switch editor.variableID174case EDIT_VAR_PROPVAL // property value175checkResult = object.propertyValue176break177178case 0 // childType179checkResult = object.propertyValue180break181182end switch183else184switch editor.variableID185case EDIT_VAR_PROPVAL // property value186object.propertyValue = editor.variableValue187break188189case 0 // childType190object.propertyValue = editor.variableValue191break192193end switch194end if195end event196197198event RSDKDraw199DrawSprite(0)200end event201202203event RSDKLoad204LoadSpriteSheet("Global/Display.gif")205SpriteFrame(-16, -16, 32, 32, 1, 143)206207AddEditorVariable("childType")208SetActiveVariable("childType")209AddEnumVariable("Next Slot", 0)210AddEnumVariable("Previous Slot", 1)211end event212213214