-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.bas
271 lines (153 loc) · 5.52 KB
/
map.bas
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
'$INCLUDE: 'settings.bas'
'_ = False
'matrix_map = [
' [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
' [1, _, _, _, _, _, 2, _, _, _, _, _, _, _, _, _, _, 4, _, _, _, _, _, 1],
' [1, _, 2, 2, _, _, _, _, _, 2, 2, 2, _, _, _, 3, _, _, _, _, 4, _, _, 1],
' [1, _, _, _, _, _, _, _, _, _, _, 2, 2, _, _, _, 3, _, _, _, _, _, _, 1],
' [1, _, 2, 2, _, _, _, _, _, _, _, _, 2, _, 4, _, _, 3, _, _, _, 4, _, 1],
' [1, _, _, _, _, _, 4, _, _, 2, 2, _, 2, _, _, _, _, _, _, 4, _, _, _, 1],
' [1, _, 3, _, _, _, 2, _, _, 2, _, _, 2, _, _, _, 4, _, _, _, _, 4, _, 1],
' [1, _, _, 3, _, _, 2, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, 1],
' [1, _, 3, _, _, _, _, _, _, _, 3, _, _, 3, 3, _, _, _, _, 3, 3, _, _, 1],
' [1, _, 3, _, _, _, 3, 3, _, 3, _, _, _, 3, 3, _, _, _, _, 2, 3, _, _, 1],
' [1, _, _, _, _, 3, _, 3, _, _, 3, _, _, _, _, _, _, _, _, _, _, _, _, 1],
' [1, _, 4, _, 3, _, _, _, _, 3, _, _, 2, _, _, _, _, _, _, _, _, 2, _, 1],
' [1, _, _, _, _, _, 4, _, _, _, _, _, 2, 2, _, _, _, _, _, _, 2, 2, _, 1],
' [1, _, _, 4, _, _, _, _, 4, _, _, _, _, 2, 2, 2, 2, 2, 2, 2, 2, _, _, 1],
' [1, _, _, _, _, _, _, _, _, _, 4, _, _, _, _, _, _, _, _, _, _, _, _, 1],
' [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
']
'DIM SHARED map_data(12, 8) AS INTEGER
'DIM SHARED world_map(12, 8) AS INTEGER
'FOR y = 0 TO 8 - 1
' FOR x = 0 TO 12 - 1
' READ map_data(x, y)
' NEXT
'NEXT
'FOR y = 0 TO 8 - 1
' FOR x = 0 TO 12 - 1
' world_map(x, y) = 0
' NEXT
'NEXT
'DATA 1,1,1,1,1,1,1,1,1,1,1,1
'DATA 1,0,0,0,0,0,0,1,0,0,0,1
'DATA 1,0,0,1,1,1,0,0,0,1,0,1
'DATA 1,0,0,0,0,1,0,0,1,1,0,1
'DATA 1,0,0,2,0,0,0,0,1,0,0,1
'DATA 1,0,0,2,0,0,0,1,1,1,0,1
'DATA 1,0,0,0,0,1,0,0,0,0,0,1
'DATA 1,1,1,1,1,1,1,1,1,1,1,1
'$DYNAMIC
DIM SHARED text_map(ROWS_SCALE) AS STRING
DIM SHARED mini_map(0) AS map_data
DIM SHARED world_map(0) AS map_data
TYPE map_data
x AS LONG
y AS LONG
textureID AS LONG
END TYPE
FOR ROW = 0 TO UBOUND(text_map) - 1
READ text_map(ROW)
NEXT
' 24x16
'DATA "111111111111111111111111"
'DATA "1.....2.........4......1"
'DATA "1.22.......2..3....4...1"
'DATA "1..........2...3.......1"
'DATA "1.22....22.2.4..3...4..1"
'DATA "1.....4.2..2......4....1"
'DATA "1.3...2........4....4..1"
'DATA "1..3..2.....33.........1"
'DATA "1.3.........33....33...1"
'DATA "1.3...33..........23...1"
'DATA "1....3.3...............1"
'DATA "1.4.3......2........2..1"
'DATA "1.....4....22......22..1"
'DATA "1..4........22222222...1"
'DATA "1......................1"
'DATA "111111111111111111111111"
'DATA "111111111111111111111111"
'DATA "1.....2..........4.....1"
'DATA "1.22.....222...3....4..1"
'DATA "1..........22...3......1"
'DATA "1.22........2.4..3...4.1"
'DATA "1.....4..22.2......4...1"
'DATA "1.3...2..2..2...4....4.1"
'DATA "1..3..2................1"
'DATA "1.3.......3..33....33..1"
'DATA "1.3...33.3...33....23..1"
'DATA "1....3.3..3............1"
'DATA "1.4.3....3..2........2.1"
'DATA "1.....4.....22......22.1"
'DATA "1..4....4....22222222..1"
'DATA "1.........4............1"
'DATA "111111111111111111111111"
'DATA "111111111111"
'DATA "1..........1"
'DATA "1..........1"
'DATA "1....22....1"
'DATA "1....22....1"
'DATA "1..........1"
'DATA "1..........1"
'DATA "111111111111"
DATA "111111111111"
DATA "1.....2....1"
DATA "1.22.....2.1"
DATA "1..........1"
DATA "1.22.......1"
DATA "1.2......2.1"
DATA "1.....2....1"
DATA "111111111111"
DIM SHARED WORLD_WIDTH: WORLD_WIDTH = LEN(text_map(0)) * TILE
DIM SHARED WORLD_HEIGHT: WORLD_HEIGHT = UBOUND(text_map) * TILE
'PRINT UBOUND(text_map)
add = 0
add2 = 0
ROWS = UBOUND(text_map)
FOR j = 0 TO ROWS - 1
row$ = text_map(j)
FOR i = 0 TO LEN(row$) - 1
char$ = (MID$(row$, i + 1, 1))
IF char$ <> "." THEN
REDIM _PRESERVE mini_map(add) AS map_data
mini_map(add).x = i * MAP_TILE
mini_map(add).y = j * MAP_TILE
add = add + 1
IF char$ = "1" THEN
REDIM _PRESERVE world_map(add2) AS map_data
world_map(add2).textureID = 1
world_map(add2).x = i * TILE
world_map(add2).y = j * TILE
add2 = add2 + 1
ELSEIF char$ = "2" THEN
REDIM _PRESERVE world_map(add2) AS map_data
world_map(add2).textureID = 2
world_map(add2).x = i * TILE
world_map(add2).y = j * TILE
add2 = add2 + 1
ELSEIF char$ = "3" THEN
REDIM _PRESERVE world_map(add2) AS map_data
world_map(add2).textureID = 3
world_map(add2).x = i * TILE
world_map(add2).y = j * TILE
add2 = add2 + 1
ELSEIF char$ = "4" THEN
REDIM _PRESERVE world_map(add2) AS map_data
world_map(add2).textureID = 4
world_map(add2).x = i * TILE
world_map(add2).y = j * TILE
add2 = add2 + 1
END IF
END IF
NEXT i
NEXT j
'PRINT STR$(UBOUND(mini_map))
'DIM mini1(0)
'DIM SHARED mini5(10) AS map_data
'PRINT add2
''FOR y = 0 TO 8 - 1
'' FOR x = 0 TO 12 - 1
'' world_map(x, y) = "."
'' NEXT
''NEXT