-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameScript.bb2
More file actions
276 lines (247 loc) · 9.36 KB
/
Copy pathGameScript.bb2
File metadata and controls
276 lines (247 loc) · 9.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
Statement CreateLevelEvents{}
; Oh the pain, but i wasted too much time, so I had to hard code these....
; Post Jam, I need to finish my scripting language.
Shared le.LevelEvent()
shared stringTable()
Shared eventCount
Shared *currentLevel.Level
restore demoEvents
for i=0 to 255
le(i)\mapX = 40
le(i)\mapY = 40
le(i)\eventType=0
next
read eventCount
for i=0 to eventCount - 1
temp.b =0
read temp.b : le(i)\mapX = temp.b
read temp.b : le(i)\mapY = temp.b
read temp.b : le(i)\facing = temp.b
read temp.b : le(i)\wmi = temp.b
read temp.b : le(i)\eventType = temp.b
read temp.b : le(i)\eventLocX = temp.b
read temp.b : le(i)\eventLocY = temp.b
read temp.b : le(i)\eventVal = temp.b
if (le(i)\eventType = 13) ; Use Item Key
read temp.b : le(i)\eventExtra1 = temp.b
read temp.b : le(i)\eventExtra2 = temp.b
end if
next
restore stringTable
read stringCount
for i=0 to stringCount - 1
read stringTable(i)
stringTable(i) =stringTable(i)
;dbugprintstring{stringTable(i)}
next
; The Map has all charge Locations on it.
; process it to create the events.
for y=0 to 31 : for x=0 to 31
mapoff.w = ((y & $1f) * 32) + (x & $1F)
wmi.b = *currentLevel\walldata[(mapoff*4)+1]
dbugprintstring{"val " + str$(x) + ", " +str$(y)}
if ( wmi.b = 1)
dbugprintstring{"CHARGE " + str$(x) + ", " +str$(y)}
le(eventCount)\mapX = x
le(eventCount)\mapY = y
le(eventCount)\facing = 5
le(eventCount)\wmi = 5
le(eventCount)\eventType = 11
le(eventCount)\eventLocX = 100
le(eventCount)\eventLocY = 0
le(eventCount)\eventVal = 4
eventCount + 1
end if
next : next
;data .b 7,11,5,5,11,100,0,4
;data .b 9,25,5,5,11,100,0,4
demoEvents:
data .b 21
data .b 1,3,2,1,3,1,3,0
data .b 2,6,2,1,4,1,6,0
data .b 1,1,5,5,9,5,240,1
data .b 1,2,5,5,9,5,240,2
data .b 8,1,1,1,11,2,0,0
data .b 4,1,1,5,12,7,4,22
data .b 4,10,2,5,12,2,11,22
data .b 30,1,5,5,10,0,0,0
data .b 4,15,5,5,9,5,240,13
data .b 4,16,5,5,9,5,240,14
data .b 4,27,5,5,9,5,240,15
data .b 12,29,5,5,9,5,240,16
data .b 14,23,5,5,9,5,240,17
data .b 9,23,5,5,9,5,240,13
data .b 18,23,5,5,9,5,240,18
data .b 4,23,5,5,9,5,240,19
data .b 28,3,5,5,9,5,240,22
data .b 4,25,5,5,9,5,240,25
data .b 27,1,5,5,12,2,20,22
data .b 25,16,5,5,12,2,23,22
data .b 26,19,1,1,1,26,20,0
data .b 2,6,2,1,4,1,6,0
stringTable:
; "==========================="
data .b 26
data .s "HELLO" ;0
data .s "WELCOME TO MY LIFE SUCKS" ;1
data .s "YOU FEEL A DRAFT" ;2
data .s "CHARGING BATTERY" ;3
data .s "EVERY ACTION YOU TAKE" ;4
data .s "USES ENERGY. YOUR ORIGINAL" ;5
data .s "BATTERY HAS ONLY 100 UNITS" ;6
data .s "ONCE ALL GONE YOURE DEAD.." ;7
data .s "YOU CAN RECHARGE AT " ;8
data .s "A CHARGE STATION OR " ;9
data .s "BY REFILLING YOUR OIL" ; 10
data .s "YOU HEAR A BUZZING" ;11
data .s "NOISE TO YOUR LEFT" ;12
data .s "PRETTY DUSTY HERE..." ;13
data .s "I HATE DUST." ;14
data .s "DOES IT EVER END?" ;15
data .s "THIS WAY, NO THAT WAY." ;16
data .s "HMM, STILL DUSTY" ;17
data .s "I WONDER IF IT WILL RAIN." ;18
data .s "SO EMPTY, ALL ALONE" ; 19
data .s "SOME STAIRS DOWN," ;20
data .s "BUT I CAN'T TAKE STAIRS" ;21
data .s "I SEE LIGHT.. LIGHT." ;22
data .s "IM GOING TO GOSUB SPACE," ;;23
data .s "AND NOT RETURN" ;24
data .s "WALKING WALKING BAH" ;25
End Statement
function processLevelEvents{}
Shared gd.GameData
shared bkgindex, gameEnd
shared gShowMap
shared *player
Shared le.LevelEvent()
shared *currentLevel.Level
shared eventCount
shared stringTable()
px = gd\playerLocation MOD 32;
py = gd\playerLocation/32;div(int(pos), 32).quot;
realFacing.b = gd\playerFacing
xn.b=0: yn.b=0
dbugprintval{realFacing}
if realFacing.b = 0
xn.b=0 : yn.b=-1
endif
if realFacing.b = 3
yn.b=0 : xn.b=-1
endif
if realFacing.b = 2
xn.b=0 : yn.b=1
endif
if realFacing.b = 1
yn.b=0 : xn.b=1
endif
nx = px + xn
ny = py + yn
np.w = ((ny & $1f) * 32) + (nx & $1F)
wmi.b = *currentLevel\walldata[np*4]
dbugprintstring{str$(nx)+ " " + str$(ny) + " " + str$( wmi.b)}
if JoyB(0) =1
for i=0 to eventCount - 1
; dbugprintstring{"E:" + str$(le(i)\mapX)+ " " + str$(le(i)\mapY) + " " + str$( le(i)\wmi)}
if nx = le(i)\mapX
if ny = le(i)\mapY
if wmi = le(i)\wmi or le(i)\wmi =5
if realFacing = le(i)\facing or le(i)\facing=5
Select (le(i)\eventType)
Case 1
doOpenDoor{le(i)\eventLocX, le(i)\eventLocY}
Case 2
doCloseDoor{le(i)\eventLocX, le(i)\eventLocY}
case 3
doChangeWall{le(i)\eventLocX, le(i)\eventLocY, le(i)\eventVal}
le(i)\eventType = 0
case 4
doSetwall{le(i)\eventLocX, le(i)\eventLocY}
case 5
doSetFlag{le(i)\eventVal}
case 6
doClearFlag{le(i)\eventVal}
case 9
;dbugprintstring{stringTable(le(i)\eventVal)}
drawColouredText{le(i)\eventLocX, le(i)\eventLocY, 200,100,0,stringTable(le(i)\eventVal)}
case 11
if (le(i)\eventLocX >0)
gd\player\sp+2
le(i)\eventLocX-1
endif
End Select
function return 1
end if
end if
end if
end if
Next
if wmi.b =2
doOpenDoor{nx,ny}
function return 1
end if
if wmi.b =3
doCloseDoor{nx,ny}
function return 1
end if
if wmi.b =4
drawBitmapText{40,240, "DOOR IS LOCKED!"}
end if
endif
function return 0
End Function
statement processLevelEventsCell{}
Shared gd.GameData
shared bkgindex, gameEnd
shared gShowMap
shared *player
Shared le.LevelEvent()
shared *currentLevel.Level
shared eventCount
shared stringTable()
px = gd\playerLocation MOD 32;
py = gd\playerLocation/32;div(int(pos), 32).quot;
realFacing.b = gd\playerFacing
wmi.b = *currentLevel\walldata[gd\playerLocation*4]
;dbugprintstring{str$(nx)+ " " + str$(ny) + " " + str$( wmi.b)}
for i=0 to eventCount - 1
; dbugprintstring{"E:" + str$(le(i)\mapX)+ " " + str$(le(i)\mapY) + " " + str$( le(i)\wmi)}
if px = le(i)\mapX
if py = le(i)\mapY
if wmi = le(i)\wmi or le(i)\wmi =5
if realFacing = le(i)\facing or le(i)\facing=5
Select (le(i)\eventType)
case 7
doSetFlag{le(i)\eventVal}
case 8
doClearFlag{le(i)\eventVal}
case 9
;dbugprintstring{stringTable(le(i)\eventVal)}
drawColouredText{le(i)\eventLocX, le(i)\eventLocY, 200,100,0,stringTable(le(i)\eventVal)}
case 10
gameEnd = 4
case 11
if (le(i)\eventLocX >0 and gd\player\sp<100)
gd\player\sp+1
le(i)\eventLocX-1
chrg.s + "CHARGING " + str$(le(i)\eventLocX-1) + " CHARGE LEFT"
drawColouredText{5,240, 200,100,0, chrg.s}
endif
case 12
if (le(i)\eventVal >0)
Boxf 10,30, 230,50 + (10*le(i)\eventLocX),9
for t=0 to le(i)\eventLocX -1
dbugprintval{t}
dbugprintval{le(i)\eventLocY+t}
dbugprintstring{ stringTable(le(i)\eventLocY+t)}
drawBitmapTextNoClear{20, 40 + (10*t), stringTable(le(i)\eventLocY+t)}
next
le(i)\eventVal -1
endif
End Select
end if
end if
end if
end if
Next
End Statement