Path: blob/master/Sonic 2/Scripts/EHZ/BridgeEnd.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Bridge End Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Function Declarations9// ========================1011reserve function BridgeEnd_DebugDraw12reserve function BridgeEnd_DebugSpawn131415// ========================16// Function Definitions17// ========================1819private function BridgeEnd_DebugDraw20// Bug Details:21// -> For some reason this object is set up to draw different sprites for each direction, but22// because this object only has 1 Sprite Frame at all, this means that no sprite is rendered if23// the player entered Debug Mode while facing left24// -> This feature is likely a carryover from this object being a modified copy of S1's GHZ Bridge End,25// where there were indeed separate (and correctly functioning) sprites for each direction26temp0 = object.direction27temp0 &= FLIP_X28DrawSprite(temp0)29end function303132private function BridgeEnd_DebugSpawn33CreateTempObject(TypeName[Bridge End], 0, object.xpos, object.ypos)34object[tempObjectPos].drawOrder = 43536// this object's propertyValue isn't even used...37// (this is leftover from S1'S GHZ Bridge End, it doesn't have any effect in this game though)38object[tempObjectPos].propertyValue = object.direction39object[tempObjectPos].propertyValue &= FLIP_X40end function414243// ========================44// Events45// ========================4647event ObjectDraw48DrawSprite(0)49end event505152event ObjectStartup53CheckCurrentStageFolder("Zone01")54if checkResult == true55LoadSpriteSheet("EHZ/Objects.gif")56SpriteFrame(-8, -8, 16, 16, 82, 61)57else58LoadSpriteSheet("MBZ/Objects.gif")59SpriteFrame(-8, -8, 16, 16, 111, 333)60end if6162// An old v3-styled loop rather than a v4 foreach loop, once again this is leftover from this object63// being a copy of S1's Bridge End64// (S1's GHZ was developed while v4 spec was still being made, foreaches presumably didn't exist at the time)65arrayPos0 = 3266while arrayPos0 < 0x42067if object[arrayPos0].type == TypeName[Bridge End]68object[arrayPos0].drawOrder = 469end if7071arrayPos0++72loop7374SetTableValue(TypeName[Bridge End], DebugMode_ObjCount, DebugMode_TypesTable)75SetTableValue(BridgeEnd_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)76SetTableValue(BridgeEnd_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)77DebugMode_ObjCount++78end event798081// ========================82// Editor Events83// ========================8485event RSDKDraw86DrawSprite(0)87end event888990event RSDKLoad91CheckCurrentStageFolder("Zone01")92if checkResult == true93LoadSpriteSheet("EHZ/Objects.gif")94SpriteFrame(-8, -8, 16, 16, 82, 61)95else96LoadSpriteSheet("MBZ/Objects.gif")97SpriteFrame(-8, -8, 16, 16, 111, 333)98end if99100// it *is* set, but its not used101// debugMode sets it to either 0/1 based on direction and in the original game it was used as a sort of "type", but in this game it isn't really used102SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")103end event104105106