Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 2/Scripts/EHZ/BridgeEnd.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Bridge End Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Function Declarations
10
// ========================
11
12
reserve function BridgeEnd_DebugDraw
13
reserve function BridgeEnd_DebugSpawn
14
15
16
// ========================
17
// Function Definitions
18
// ========================
19
20
private function BridgeEnd_DebugDraw
21
// Bug Details:
22
// -> For some reason this object is set up to draw different sprites for each direction, but
23
// because this object only has 1 Sprite Frame at all, this means that no sprite is rendered if
24
// the player entered Debug Mode while facing left
25
// -> This feature is likely a carryover from this object being a modified copy of S1's GHZ Bridge End,
26
// where there were indeed separate (and correctly functioning) sprites for each direction
27
temp0 = object.direction
28
temp0 &= FLIP_X
29
DrawSprite(temp0)
30
end function
31
32
33
private function BridgeEnd_DebugSpawn
34
CreateTempObject(TypeName[Bridge End], 0, object.xpos, object.ypos)
35
object[tempObjectPos].drawOrder = 4
36
37
// this object's propertyValue isn't even used...
38
// (this is leftover from S1'S GHZ Bridge End, it doesn't have any effect in this game though)
39
object[tempObjectPos].propertyValue = object.direction
40
object[tempObjectPos].propertyValue &= FLIP_X
41
end function
42
43
44
// ========================
45
// Events
46
// ========================
47
48
event ObjectDraw
49
DrawSprite(0)
50
end event
51
52
53
event ObjectStartup
54
CheckCurrentStageFolder("Zone01")
55
if checkResult == true
56
LoadSpriteSheet("EHZ/Objects.gif")
57
SpriteFrame(-8, -8, 16, 16, 82, 61)
58
else
59
LoadSpriteSheet("MBZ/Objects.gif")
60
SpriteFrame(-8, -8, 16, 16, 111, 333)
61
end if
62
63
// An old v3-styled loop rather than a v4 foreach loop, once again this is leftover from this object
64
// being a copy of S1's Bridge End
65
// (S1's GHZ was developed while v4 spec was still being made, foreaches presumably didn't exist at the time)
66
arrayPos0 = 32
67
while arrayPos0 < 0x420
68
if object[arrayPos0].type == TypeName[Bridge End]
69
object[arrayPos0].drawOrder = 4
70
end if
71
72
arrayPos0++
73
loop
74
75
SetTableValue(TypeName[Bridge End], DebugMode_ObjCount, DebugMode_TypesTable)
76
SetTableValue(BridgeEnd_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
77
SetTableValue(BridgeEnd_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
78
DebugMode_ObjCount++
79
end event
80
81
82
// ========================
83
// Editor Events
84
// ========================
85
86
event RSDKDraw
87
DrawSprite(0)
88
end event
89
90
91
event RSDKLoad
92
CheckCurrentStageFolder("Zone01")
93
if checkResult == true
94
LoadSpriteSheet("EHZ/Objects.gif")
95
SpriteFrame(-8, -8, 16, 16, 82, 61)
96
else
97
LoadSpriteSheet("MBZ/Objects.gif")
98
SpriteFrame(-8, -8, 16, 16, 111, 333)
99
end if
100
101
// it *is* set, but its not used
102
// 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 used
103
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
104
end event
105
106