Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R8/BoundaryAdjust.txt
1319 views
1
//---------------Sonic CD Boundary Adjust Script--------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// States
6
#alias 0 : BOUNDARYADJUST_SET_BOUNDS
7
#alias 1 : BOUNDARYADJUST_RESTORE_BOUNDS
8
9
10
sub ObjectMain
11
if Object.State == BOUNDARYADJUST_SET_BOUNDS
12
#platform: Use_Origins
13
if Object.PropertyValue == 0
14
if game.playMode == BOOT_PLAYMODE_BOSSRUSH
15
Object.Type = TypeName[Blank Object]
16
else
17
#endplatform
18
if Player.XPos > Object.XPos
19
// Set Left Bound
20
TempValue0 = 3120
21
TempValue0 -= Screen.CenterX
22
Stage.NewXBoundary1 = TempValue0
23
24
// Set Right Bound
25
TempValue0 += Screen.XSize
26
Stage.NewXBoundary2 = TempValue0
27
28
// Set Top Bound
29
TempValue0 = Object.iYPos
30
TempValue0 -= Screen.YSize
31
Stage.NewYBoundary1 = TempValue0
32
33
// Set Bottom Bound
34
Stage.YBoundary2 = Screen.YOffset
35
Stage.YBoundary2 += Screen.YSize
36
if Stage.YBoundary2 < Object.iYPos
37
Stage.YBoundary2 = Object.iYPos
38
end if
39
40
Object.State++
41
end if
42
#platform: Use_Origins
43
end if
44
else
45
if game.playMode != BOOT_PLAYMODE_BOSSRUSH
46
Object.Type = TypeName[Blank Object]
47
else
48
if Player.XPos > Object.XPos
49
// Set Left Bound
50
TempValue0 = 3840
51
TempValue0 -= Screen.CenterX
52
Stage.NewXBoundary1 = TempValue0
53
54
// Set Right Bound
55
TempValue0 += Screen.XSize
56
Stage.NewXBoundary2 = TempValue0
57
58
Screen.XOffset = 3260
59
60
// Set Top Bound
61
TempValue0 = Object.iYPos
62
TempValue0 -= Screen.YSize
63
Stage.NewYBoundary1 = TempValue0
64
65
// Set Bottom Bound
66
Stage.YBoundary2 = Screen.YOffset
67
Stage.YBoundary2 += Screen.YSize
68
Stage.YBoundary2 = Object.iYPos
69
70
Object.State++
71
end if
72
end if
73
end if
74
#endplatform
75
else
76
Stage.YBoundary2 -= 3
77
if Stage.YBoundary2 <= Object.iYPos
78
Stage.YBoundary2 = Object.iYPos
79
Object.Type = TypeName[Blank Object]
80
end if
81
end if
82
end sub
83
84
85
// ========================
86
// Editor Subs
87
// ========================
88
89
sub RSDKDraw
90
if Editor.ShowGizmos == true
91
Editor.DrawingOverlay = true
92
// Draw a little indicator of where the bounds will be moved to
93
94
// Let's assume it's the original width res of the game, 424
95
TempValue0 = 3120
96
TempValue0 -= 242
97
TempValue0 <<= 16
98
TempValue1 = Object.iYPos
99
TempValue1 -= 240
100
TempValue1 <<= 16
101
DrawRectOutline(TempValue0, TempValue1, 424, 240, 255, 255, 0, 255)
102
Editor.DrawingOverlay = false
103
end if
104
105
TempValue0 = Object.XPos
106
TempValue0 -= 0x80000
107
TempValue1 = Object.YPos
108
TempValue1 -= 0x80000
109
110
DrawSpriteXY(0, TempValue0, TempValue1)
111
112
TempValue0 += 0x100000
113
DrawSpriteXY(0, TempValue0, TempValue1)
114
115
TempValue1 += 0x100000
116
DrawSpriteXY(0, TempValue0, TempValue1)
117
118
TempValue0 -= 0x100000
119
DrawSpriteXY(0, TempValue0, TempValue1)
120
end sub
121
122
123
sub RSDKLoad
124
LoadSpriteSheet("Global/Display.gif")
125
SpriteFrame(-8, -8, 16, 16, 173, 67) // #0 - "T" Icon
126
127
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
128
end sub
129
130