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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
|
-
|
|
!
-
|
|
|
|
|
!
-
|
|
|
|
|
|
|
|
|
|
|
!
-
|
|
|
|
|
|
|
!
-
|
|
|
|
|
-
|
!
|
-
|
!
|
|
-
|
!
|
-
|
!
!
-
|
-
|
!
|
-
|
!
!
-
|
|
-
|
!
|
-
|
!
!
-
|
|
!
-
|
|
!
-
|
|
|
-
|
|
!
-
|
|
|
!
|
#module
#deffunc m_ini
bksizex = 32 bksizey = 32 grv = 50 ChrSizeX = 16 ChrSizeY = 32
ChrCPosX = ChrSizeX / 2-1 ChrCPosY = ChrSizeY / 2-1
ChrCPosX2= ChrSizeX / 2 ChrCPosY2= ChrSizeY / 2
dim ChrPr, 7, 256
screen 2 picload "chara00.bmp" gsel 0, 1
chracnts = 1 gmode 2,32,32
return
#deffunc m_BBlock val
mref bblk, 48
return
#deffunc m_SetChrDrc int, int
mref ChrID, 0
mref ChrPtId, 1
ChrPr.5.ChrID = ChrPtId return
#deffunc m_ChngChrAni int, int
mref ChrID, 0
mref p2, 1
ChrPr.6.ChrID = p2
return
#deffunc m_CntChrAni
chrcnt2++
if chrcnt2>5 : chracnt+=chracnts : chrcnt2 = 0 if chracnt>2 : chracnt-=2 : chracnts =-1 if chracnt<0 : chracnt+=2 : chracnts = 1
return
#deffunc m_GetCellPosX100 val, int
mref cx, 16
mref ppx100, 1
cx = ppx100/100 / bksizex - (ppx100 \ (bksizex*100) <0)
return
#deffunc m_GetCellPosY100 val, int
mref cy, 16
mref ppy100, 1
cy = ppy100/100 / bksizey - (ppy100 \ (bksizey*100) <0)
return
#deffunc m_GetCellPosX val, int
mref cx, 16
mref ppx, 1
cx = ppx / bksizex - (ppx \ bksizex <0)
return
#deffunc m_GetCellPosY val, int
mref cy, 16
mref ppy, 1
cy = ppy / bksizey - (ppy \ bksizey <0)
return
#deffunc m_GetCellPosXY100 val, val, int, int
mref cx, 16
mref cy, 17
mref ppx100, 2
mref ppy100, 3
cx = ppx100/100 / bksizex - (ppx100 \ (bksizex*100) <0)
cy = ppy100/100 / bksizey - (ppy100 \ (bksizey*100) <0)
return
#deffunc m_VaddChr int, int, int
mref pvx100, 0 mref pvy100, 1
mref ChrID, 2
ChrPr.2.ChrID += pvx100
ChrPr.3.ChrID += pvy100
return
#deffunc m_VsubChr int, int, int
mref pvx100, 0
mref pvy100, 1
mref ChrID, 2
ChrPr.2.ChrID -= pvx100
ChrPr.3.ChrID -= pvy100
return
#deffunc m_VmulChr int, int, int
mref pvx100, 0
mref pvy100, 1
mref ChrID, 2
ChrPr.2.ChrID = ChrPr.2 * pvx100
ChrPr.3.ChrID = ChrPr.3 * pvy100
return
#deffunc m_VdivChr int, int, int
mref pvx100, 0
mref pvy100, 1
mref ChrID, 2
if pvx100*pvy100!0 {
ChrPr.2.ChrID = ChrPr.2.ChrID / pvx100
ChrPr.3.ChrID = ChrPr.3.ChrID / pvy100
}
return
#deffunc m_VsetChr int, int, int
mref pvx100, 0
mref pvy100, 1
mref ChrID, 2
ChrPr.2.ChrID = pvx100
ChrPr.3.ChrID = pvy100
return
#deffunc m_GetChrPosCell val, val, int
mref cpbkx, 16
mref cpbky, 17
mref ChrID, 2
m_GetCellPosXY100 cpbkx, cpbky, ChrPr.0.ChrID, ChrPr.1.ChrID
return
#deffunc m_ChrChk int
mref ChrID, 0
mref statout, 64
statout = 0
statout = ChrPr.4.ChrID
return
#deffunc m_GetVChr val, val, int
mref pvx100, 16
mref pvy100, 17
mref ChrID, 2
pvx100 = ChrPr.2.ChrID
pvy100 = ChrPr.3.ChrID
return
#deffunc m_GetPosChr val, val, int
mref ppx100, 16
mref ppy100, 17
mref ChrID, 2
ppx100 = ChrPr.0.ChrID
ppy100 = ChrPr.1.ChrID
return
#deffunc m_PutChr int
mref ChrID, 0
if ChrPr.5.ChrID = 0 {
color 0,0,0
px = ChrPr.0.ChrID/100 -vwposx
py = ChrPr.1.ChrID/100
boxf px-ChrCPosX,py-ChrCPosY, px+ChrCPosX2,py+ChrCPosY2
}
if (ChrPr.5.ChrID = 1)|(ChrPr.5.ChrID = 2) {
px = ChrPr.0.ChrID/100 -vwposx -16 py = ChrPr.1.ChrID/100 -ChrCPosY
pos px, py
if ChrPr.5.ChrID = 1 : csx = 0 : csy = 0
if ChrPr.5.ChrID = 2 : csx = 3 *3*32 : csy = 1 *4*32
gcopy 2, chracnt*32 + csx, ChrPr.6.ChrID * 32 + csy }
return
#deffunc m_DrwCell
i=0
repeat 20 repeat 5 if bblk.cnt.i=1 {
color 192,192,255
iCellPosX = i*bksizex - vwposx iCellPoxY = cnt*bksizey boxf iCellPosX, iCellPoxY, iCellPosX + bksizex-1, iCellPoxY + bksizey-1
color 127,127,255
boxf iCellPosX+1, iCellPoxY+1, iCellPosX + bksizex-2, iCellPoxY + bksizey-2
color 0,0,0
}
loop
i++
loop
return
#deffunc mdb_PutChrPosBlk int
mref ChrID, 0
m_GetChrPosCell bx, by, ChrID
color 255,127,127
boxf bx*bksizex-vwposx, by*bksizey, bx*bksizex-vwposx + bksizex-1, by*bksizey + bksizey-1
return
#deffunc m_ViewPos int
mref p1, 0
vwposx = p1
return
#deffunc m_ChrPos int
mref p1, 0
ChrID2 = p1
px100 = ChrPr.0.ChrID2
py100 = ChrPr.1.ChrID2
vx100 = ChrPr.2.ChrID2
vy100 = ChrPr.3.ChrID2
vy100f = vy100 + grv px100f = px100 + vx100
py100f = py100 + vy100f
pxf = px100f/100 pyf = py100f/100
fkabe = 0
if vx100!0 {
m_GetCellPosY100 bkyt0, py100-(ChrCPosY*100) m_GetCellPosY100 bkyd0, py100+(ChrCPosY2*100) m_GetCellPosX bkxr1, pxf+ChrCPosX2 m_GetCellPosX bkxl1, pxf-ChrCPosX if (bkyd0>=0)&(bkyd0<5) & (bkxr1>=0)&(bkxr1<100) {
if bblk.bkyd0.bkxr1!0 : fkabe = 1 }
if (bkyd0>=0)&(bkyd0<5) & (bkxl1>=0)&(bkxl1<100) {
if bblk.bkyd0.bkxl1!0 : fkabe = 1
}
if (bkyt0>=0)&(bkyt0<5) & (bkxr1>=0)&(bkxr1<100) {
if bblk.bkyt0.bkxr1!0 : fkabe = 1
}
if (bkyt0>=0)&(bkyt0<5) & (bkxl1>=0)&(bkxl1<100) {
if bblk.bkyt0.bkxl1!0 : fkabe = 1
}
}
m_GetCellPosX100 bkxl0, px100-(ChrCPosX*100) m_GetCellPosX100 bkxr0, px100+(ChrCPosX2*100) m_GetCellPosY bkyd1, pyf+ChrCPosY2
fyuka = 0
if vy100f>0 {
if (bkyd1>=0)&(bkyd1<5) & (bkxl0>=0)&(bkxl0<100) {
if bblk.bkyd1.bkxl0!0 : fyuka = 1 }
if (bkyd1>=0)&(bkyd1<5) & (bkxr0>=0)&(bkxr0<100) {
if bblk.bkyd1.bkxr0!0 : fyuka = 1
}
}
ften = 0
if vy100f<0 {
m_GetCellPosY bkyt1, pyf-ChrCPosY if (bkyt1>=0)&(bkyt1<5) & (bkxl0>=0)&(bkxl0<100) {
if bblk.bkyt1.bkxl0!0 : ften = 1 }
if (bkyt1>=0)&(bkyt1<5) & (bkxr0>=0)&(bkxr0<100) {
if bblk.bkyt1.bkxr0!0 : ften = 1
}
}
if fkabe!0 {
vx100 = -1*vx100/2
}
if ften!0 {
vy100 = -1*vy100
}
if fyuka!0 {
if vy100>0 : vy100 = 0 py100 = bkyd1*bksizey *100-1 -(ChrCPosY2*100) -(bkyd1<=0 *100)
} else {
vy100 = vy100 + grv }
if fyuka!0 {
if 0 > vx100 : vx100=vx100+30 : if 0 < vx100 : vx100=0
if 0 < vx100 : vx100=vx100-30 : if 0 > vx100 : vx100=0
}
px100 = px100 + vx100
py100 = py100 + vy100
ChrPr.0.ChrID2 = px100
ChrPr.1.ChrID2 = py100
ChrPr.2.ChrID2 = vx100
ChrPr.3.ChrID2 = vy100
ChrPr.4.ChrID2 = fkabe*4 + (ften*2) + fyuka
return
#global
m_ini
|