4 procedure loadObject(_x
, _y
, _w
, _h
, _velx
, _vely
:integer; _jmp
:boolean);
6 function isSolid(x
, y
, velx
, vely
:integer):boolean;
8 function mapCollType(_type
, x
, y
, w
, h
:integer):boolean;
10 function CollTwoObj(x1
,y1
,w1
,h1
,x2
,y2
,w2
,h2
:integer):boolean;
12 procedure jumpObj(vel
:integer);
13 procedure calc(gravity
:boolean);
15 function getX
:integer;
16 function getY
:integer;
17 function getVelX
:integer;
18 function getVelY
:integer;
19 function getJmp
:boolean;
21 function canSeeObj(x1
, y1
, x2
, y2
:integer):boolean;
24 uses items_store
, maps
;
29 x
, y
, w
, h
, velx
, vely
:integer;
32 function CollTwoObj(x1
,y1
,w1
,h1
,x2
,y2
,w2
,h2
:integer):boolean;
34 if (x1
+w1
>x2
) and (x1
<x2
+w2
) and (y1
+h1
>y2
) and (y1
<y2
+h2
) then
38 procedure loadObject(_x
, _y
, _w
, _h
, _velx
, _vely
:integer; _jmp
:boolean);
49 function isSolid(x
, y
, velx
, vely
:integer):boolean;
51 if getBlockColl(getMap(x
, y
))<>0 then
55 function mapColl(x
, y
, w
, h
, velx
, vely
:integer):boolean;
58 minx
, miny
, maxx
, maxy
:integer;
60 minx
:=x
div TILE_SIZE
;
61 miny
:=y
div TILE_SIZE
;
62 maxx
:=(x
+w
-1) div TILE_SIZE
;
63 maxy
:=(y
+h
-1) div TILE_SIZE
;
64 for i
:=minx
to maxx
do
65 for j
:=miny
to maxy
do
67 if isSolid(i
, j
, velx
, vely
) then
75 function canSeeObj(x1
, y1
, x2
, y2
:integer):boolean;
77 deltax
, deltay
:integer;
79 error
, error2
:integer;
101 while((x1
<>x2
) or (y1
<>y2
)) do
103 if isSolid(x1
, y1
, 0, 0) then
107 if error2
>-deltaY
then
113 if error2
<deltaX
then
122 function mapCollType(_type
, x
, y
, w
, h
:integer):boolean;
125 minx
, miny
, maxx
, maxy
:integer;
127 minx
:=x
div TILE_SIZE
;
128 miny
:=y
div TILE_SIZE
;
129 maxx
:=(x
+w
-1) div TILE_SIZE
;
130 maxy
:=(y
+h
-1) div TILE_SIZE
;
131 for i
:=minx
to maxx
do
132 for j
:=miny
to maxy
do
134 if getMap(i
, j
)=_type
then
142 procedure calcGravity
;
147 if vely
>MAX_VELY
then
156 if mapColl(x
, y
, w
, h
, velx
, vely
) then
165 for i
:=1 to abs(vely
) do
168 if mapColl(x
, y
, w
, h
, velx
, vely
) then
178 function fixVYup
:boolean;
181 (mapCollType(49, x
, y
, w
, h
) or
182 mapCollType(103, x
, y
, w
, h
) or
183 mapCollType(108, x
, y
, w
, h
)) then
187 (mapCollType(50, x
, y
, w
, h
) or
188 mapCollType(51, x
, y
, w
, h
)) then
197 (mapCollType(49, x
, y
, w
, h
) or
198 mapCollType(103, x
, y
, w
, h
)) then
202 (mapCollType(50, x
, y
, w
, h
) or
203 mapCollType(51, x
, y
, w
, h
)) then
207 procedure jumpObj(vel
:integer);
225 if mapColl(x
, y
, w
, h
, velx
, vely
) then
234 for i
:=1 to abs(velx
) do //there for-downto-do have a bug!
237 if mapColl(x
, y
, w
, h
, velx
, vely
) then
260 if mapColl(x
, y
, w
, h
, velx
, vely
) then
269 for i
:=1 to abs(vely
) do //there for-downto-do have a bug!
272 if mapColl(x
, y
, w
, h
, velx
, vely
) then
287 function getX
:integer;
292 function getY
:integer;
297 function getVelX
:integer;
302 function getVelY
:integer;
307 function getJmp
:boolean;
312 procedure calc(gravity
:boolean);