Path: blob/master/Sonic 1/Scripts/LZ/Cork.txt
1483 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Cork Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011// Player Aliases12private alias object.ypos : player.ypos13private alias object.yvel : player.yvel14private alias object.gravity : player.gravity1516// Path ID Aliases17private alias 0 : PATH_A181920// ========================21// Function Declarations22// ========================2324reserve function Cork_DebugDraw25reserve function Cork_DebugSpawn262728// ========================29// Function Definitions30// ========================3132private function Cork_DebugDraw33DrawSprite(0)34end function353637private function Cork_DebugSpawn38CreateTempObject(TypeName[Cork], 0, object.xpos, object.ypos)39object[tempObjectPos].ypos &= 0xFFFF000040GetBit(temp0, object.ypos, 16)41if temp0 == true42object[tempObjectPos].ypos++43end if4445// As with the foreach in the ObjectStartup, this line was similarly only added after initial release, in an update46object[tempObjectPos].drawOrder = 447end function484950// ========================51// Events52// ========================5354event ObjectUpdate55temp4 = stage.waterLevel56temp4 <<= 1657temp3 = object.ypos58if temp3 != temp459if temp3 < temp460temp3 += 0x1000061if temp3 < temp462temp3 += 0x1000063end if64else65temp3 -= 0x1000066if temp3 > temp467temp3 -= 0x1000068end if69end if70end if7172object.yvel = temp373object.yvel -= object.ypos74if object.yvel > 075ObjectTileCollision(CSIDE_FLOOR, 0, 16, PATH_A)76else77ObjectTileCollision(CSIDE_ROOF, 0, -16, PATH_A)78end if7980foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)81BoxCollisionTest(C_SOLID, object.entityPos, -16, -16, 16, 16, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)8283if checkResult == COL_TOP84player[currentPlayer].ypos += object.yvel85end if8687if checkResult == COL_BOTTOM88if player[currentPlayer].gravity == GRAVITY_GROUND89CallFunction(Player_Kill)90end if91end if92next9394object.ypos += object.yvel95end event969798event ObjectDraw99// this part is kinda weird..100// - in mobile S1, the number in the check is 39101// - in Origins 1.0.0, it's 43102// - in Origins 1.0.4, it's 46103// - in Origins 2.0.0 and later, it's 48104105// maybe it's a function ID? 39/43/46 all match Player_HandleSuperPalette_Sonic in their respective game versions... but then Plus's 48 is Player_HandleAmyHitbox??106// if that's somehow what it is, then why is stage state being compared to a function anyways?? and where's that arrayPos0 even coming from??107// so many unanswered questions...108109if stage.state == 48110object[arrayPos0].priority = PRIORITY_ACTIVE111end if112113DrawSprite(0)114end event115116117event ObjectStartup118LoadSpriteSheet("LZ/Objects.gif")119SpriteFrame(-16, -16, 32, 32, 1, 51)120121// Interesting note - this wasn't in the initial versions of S1, this was only introduced later in an update122foreach (TypeName[Cork], arrayPos0, ALL_ENTITIES)123object[arrayPos0].drawOrder = 4124next125126SetTableValue(TypeName[Cork], DebugMode_ObjCount, DebugMode_TypesTable)127SetTableValue(Cork_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)128SetTableValue(Cork_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)129DebugMode_ObjCount++130end event131132133// ========================134// Editor Events135// ========================136137event RSDKDraw138DrawSprite(0)139end event140141142event RSDKLoad143LoadSpriteSheet("LZ/Objects.gif")144SpriteFrame(-16, -16, 32, 32, 1, 51)145146SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")147end event148149150