-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.lua
More file actions
294 lines (246 loc) · 23.2 KB
/
Copy pathmap.lua
File metadata and controls
294 lines (246 loc) · 23.2 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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
require("maths")
MAP_W = 128
MAP_H = 72
map = nil
spawn_points = {}
spawn_points_copy = {}
cacti_spawn_points = {}
ground = {}
local walls = {2,1,3,4}
local map_data = {
[0]={[0]=2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,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2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
}
function init_map()
local i,j = 0, 0
for i = 0, (MAP_H-1) do
for j = 0, (MAP_W-1) do
local m = map_data[i][j]
if m == 8 then
add(spawn_points, {x = j*8+4, y = i*8+4})
elseif m == 9 then
add(cacti_spawn_points, {x = j*8+4, y = i*8+4})
elseif m == 0 or m == 7 then
add(ground, {x = j*8+4, y = i*8+4})
end
end
end
spawn_points_copy = copy_table(spawn_points_copy)
local owalls = walls
walls = {}
for _,i in ipairs(owalls) do
walls[i] = true
end
gen_mapsurf()
end
function draw_map()
local w,h = screen_size()
local x,y = get_camera_pos()
local sx,sy
if x<0 then sx,x,w = -x,0,w-x end
if y<0 then sy,y,h = -y,0,h-y end
local ssw,ssh = surface_size(mapsurf)
if x+w > ssw then w = ssw-x end
if y+h > ssh then h = ssh-y end
palt(0,false)
draw_surface(mapsurf, sx, sy, x, y, w, h)
palt(0,true)
end
function check_mapcol(s,x,y,further)
local sx = x or s.x
local sy = y or s.y
local dirs = {{-1,-1},{1,-1},{-1,1},{1,1}}
nirs=dirs
local dd = further and (server_only and 0.8 or 0.7) or 0.5
local w = s.w
local h = further and (s.h+2) or s.h
local res,b={0,0}
for k,d in pairs(dirs) do
local x = sx+w*dd*d[1]
local y = sy+h*dd*d[2]
local tx = flr(x/8)
local ty = flr(y/8)
if tx < 0 or tx >= MAP_W or ty < 0 or ty >= MAP_H or walls[map_data[ty][tx]] then
res[1] = res[1] + d[1]
res[2] = res[2] + d[2]
b=true
end
end
if res[1]~=0 then res[1] = sgn(res[1]) end
if res[2]~=0 then res[2] = sgn(res[2]) end
return b and {dir_x = res[1], dir_y = res[2]}
end
function get_maptile(x,y)
if not map_data[y] then return nil end
return map_data[y][x]
end
mapsurf = nil
function gen_mapsurf()
if server_only then return end
local tile_map = {}
for y = 0,MAP_H-1 do
local line = {}
local d_line = map_data[y]
for x = 0,MAP_W-1 do
local v = d_line[x]
local n = 0
if v == 0 then
if chance(1) then
n = 8+irnd(7)
elseif chance(15) then
n = irnd(8)
end
elseif v == 7 then
if chance(5) then
n = 15
elseif chance(5) then
n = 8+irnd(2)
else
n = 10+irnd(4)
end
elseif v == 1 then
local down = map_data[y+1] and map_data[y+1][x]
down = down == 1 or down == 3 or down == 4
local left = (d_line[x-1] and d_line[x-1] >= 1 and d_line[x-1] < 5)
local right = (d_line[x+1] and d_line[x+1] >= 1 and d_line[x+1] < 5)
if down then
if left and right then
n = 16
elseif left then
n = 18
elseif right then
n = 17
else
n = 19
end
else
if left and right then
n = pick{21,22,23,24}
elseif left then
n = 26
elseif right then
n = 25
else
n = 27
end
end
elseif v == 2 then
local k = 0
if x<=0 or d_line[x-1] == v then k = k+1 end
if x>=MAP_W-1 or d_line[x+1] == v then k = k+2 end
if y<=0 or map_data[y-1][x]==v then k = k+4 end
if y>=MAP_H-1 or map_data[y+1][x]==v then k = k+8 end
n = 32+k
if n == 47 then
local i = min(x,y,MAP_W-1-x,MAP_H-1-y)
if i < 2 then
n = 62+i
end
end
elseif v == 3 then
n = pick{30,31}
elseif v == 4 then
local down = map_data[y+1] and map_data[y+1][x]
if down == 1 or down == 3 or down == 4 then
n = 20
else
n = pick{28,29}
end
end
line[x] = n
end
tile_map[y] = line
end
local flippable = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,20,21,22,23,24,28,29,30,31}
local is_flippable = {}
for _,n in pairs(flippable) do is_flippable[n] = true end
mapsurf = new_surface(MAP_W*8, MAP_H*8)
draw_to(mapsurf)
palt(0,false)
for y = 0,MAP_H-1 do
local line = tile_map[y]
for x = 0,MAP_W-1 do
local n = line[x]
spr(n, x*8+4, y*8+4, 1, 1, 0, is_flippable[n] and chance(50))
end
end
draw_to()
palt(0,true)
end
function reset_spawn()
spawn_points_copy = copy_table(spawn_points)
end
function get_spawn()
if #spawn_points_copy < 1 then reset_spawn() end
return pick_and_remove(spawn_points_copy)
end